n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Monthly production of smartphones: \", model.getVal(Smartphones))\n    print(\"Monthly production of tablets: \", model.getVal(Tablets))\n    print(\"Monthly production of laptops: \", model.getVal(Laptops))\n    print(\"Monthly production of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 645,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit and the raw material cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit |\n|---------|-----------------|----------------------------|\n| A       | $50             | $20                        |\n| B       | $70             | $30                        |\n| C       | $60             | $25                        |\n| D       | $40             | $15                        |\n\nThe company has a total production capacity of 10,000 units. The company has a budget of $250,000 for raw materials. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The company wants to maximize its total profit. The company has a total production capacity of 10,000 units and a budget of $250,000 for raw materials. The raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit. Please help the company determine the optimal production quantity for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 661,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries and a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n\nPlease help the bakery to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required per Unit |\n|----------|-----------------|-------------------------|\n| Croissants | $2             | 2 units                 |\n| Muffins   | $3             | 3 units                 |\n| Donuts    | $2.5           | 2 units                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = model.addVar(vtype=\"INTEGER\", name=\"Production_Capacity\", lb=0) # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\nmodel.addCons(Production_Capacity == 200)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries. The bakery also has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = model.addVar(vtype=\"INTEGER\", name=\"Production_Capacity\", lb=0) # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\nmodel.addCons(Production_Capacity == 200)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 615,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n\n| Pastry | Profit per Unit | Flour Required (grams) | Sugar Required (grams) |\n|--------|-----------------|------------------------|------------------------|\n| Croissants | $0.50 | 50 | 20 |\n| Muffins | $0.75 | 75 | 30 |\n| Donuts | $1.00 | 100 | 40 |\n\nThe bakery has a daily supply of 10 kilograms of flour and 5 kilograms of sugar. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour. Each croissant also requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production.\n// {\"number of chocolate cakes to produce\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate >= 20\n// Vanilla >= 15\n// Strawberry >= 10\n\n## Generate Constraint-2:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens.\n// Chocolate + Vanilla + Strawberry <= 10*Ovens",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100.\n\n| Cake Type     | Production Cost |\n|---------------|-----------------|\n| Chocolate     | $5              |\n| Vanilla       | $4              |\n| Strawberry    | $6              |\n\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. Each oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens.\n\nPlease help the bakery to minimize the total daily cost of production and oven rental.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes to produce\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes to produce\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate >= 20)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 10)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type.\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 10*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production.\n// {\"number of chocolate cakes to produce\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate >= 20\n// Vanilla >= 15\n// Strawberry >= 10\n\n## Generate Constraint-2:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens.\n// Chocolate + Vanilla + Strawberry <= 10*Ovens",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental. The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. Each oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens. Please help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent to minimize the total daily cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes to produce\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes to produce\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate >= 20)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 10)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type.\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 10*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue and cost per cake, as well as the rental cost per oven per week, are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Oven Rental Cost per Week |\n|-----------------|------------------|---------------|---------------------------|\n| Chocolate       | $10              | $4            | $150                      |\n| Vanilla         | $8               | $3            | $150                      |\n| Strawberry      | $9               | $5            | $150                      |\n\nThe bakery wants to maximize the weekly profit. The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental.\n\nPlease help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent for each type of cake to maximize the weekly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. The cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. The rental cost per oven per week is $150. The bakery wants to maximize the weekly profit. The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental. Please help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent for each type of cake to maximize their weekly profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (kg) | Sugar Required (kg) |\n|----------|-----------------|---------------------|---------------------|\n| Croissant| $1.50           | 0.1                 | 0.05                |\n| Muffin   | $2.00           | 0.2                 | 0.1                 |\n| Doughnut | $1.75           | 0.15                | 0.08                |\n\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg. The bakery also has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n\nPlease help the bakery to determine the optimal number of each type of pastry to produce daily to maximize profit while adhering to the constraints of flour and sugar availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit. The bakery has a total of 300 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, and each doughnut requiring 0.15 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, and each doughnut requiring 0.08 kg. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase. The profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Raw Material per Unit | Labor per Unit |\n|----------|-----------------|-----------------------|----------------|\n| Croissant| $1              | 0.5 units             | 0.2 hours      |\n| Muffin   | $1.5            | 0.6 units             | 0.3 hours      |\n| Donut    | $2              | 0.8 units             | 0.4 hours      |\n\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units. The bakery also has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the amount of raw materials to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\nTotal_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Total_Revenue - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of raw materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The bakery aims to maximize its daily profit. The bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units. The bakery also has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\nTotal_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Total_Revenue - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of raw materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery wants to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 15\n// Strawberry_Cakes >= 10\n\n## Generate Constraint-2:\nThe bakery has a limited workspace that can accommodate a maximum of 5 ovens.\n// Ovens <= 5",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes. The cost of producing each type of cake and the rental cost for each oven per day are given in the following Table.\n\n| Cake Type       | Production Cost |\n|-----------------|-----------------|\n| Chocolate       | $5              |\n| Vanilla         | $4              |\n| Strawberry      | $6              |\n| Oven Rental     | $100 per day    |\n\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. The bakery has a limited workspace that can accommodate a maximum of 5 ovens. Please help the bakery to minimize the total daily cost of production and oven rental.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 15)\nmodel.addCons(Strawberry_Cakes >= 10)\n## The bakery has a limited workspace that can accommodate a maximum of 5 ovens.\nmodel.addCons(Ovens <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery wants to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 15\n// Strawberry_Cakes >= 10\n\n## Generate Constraint-2:\nThe bakery has a limited workspace that can accommodate a maximum of 5 ovens.\n// Ovens <= 5",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery wants to minimize the total daily cost of production and oven rental. The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. The bakery has a limited workspace that can accommodate a maximum of 5 ovens. Please help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent to minimize the total daily cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 15)\nmodel.addCons(Strawberry_Cakes >= 10)\n## The bakery has a limited workspace that can accommodate a maximum of 5 ovens.\nmodel.addCons(Ovens <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per day\": \"Oven_Usage\", \"range\": \"Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\n// 15*Croissants + 20*Muffins + 30*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100 (flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50 (sugar constraint)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The following table shows the oven time and ingredient requirements for each pastry.\n\n| Pastry   | Oven Time per Unit | Flour per Unit | Sugar per Unit |\n|----------|-------------------|----------------|----------------|\n| Croissant| 15 minutes        | 0.1 kg         | 0.05 kg        |\n| Muffin   | 20 minutes        | 0.2 kg         | 0.1 kg         |\n| Donut    | 30 minutes        | 0.3 kg         | 0.15 kg        |\n\nThe bakery has a total daily oven capacity of 480 minutes. The bakery also has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Please help the bakery to maximize its daily profit from pastry sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Donuts <= 480)\n## The bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar.\n## Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100) # flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50) # sugar constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per day\": \"Oven_Usage\", \"range\": \"Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\n// 15*Croissants + 20*Muffins + 30*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100 (flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50 (sugar constraint)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. Each croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes, with a total daily oven capacity of 480 minutes. The bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar. Please help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Donuts <= 480)\n## The bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar.\n## Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100) # flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50) # sugar constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The number of each type of cake produced must be between 0 and 100.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| Cake 1    | $5              | 1                   | 0.5                 |\n| Cake 2    | $7              | 2                   | 0.8                 |\n| Cake 3    | $6              | 1.5                 | 0.6                 |\n| Cake 4    | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Please help the bakery determine the optimal number of each type of cake to produce to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, with the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit of 150 hours of labor available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. The production quantities for each type of bread must be between 0 and 100 loaves.\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to maximize its daily profit.\n\n| Bread Type   | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|--------------|-----------------|-------------------------|-------------------------|\n| Whole Wheat  | $2              | 0.5 kg                  | 0.2 hours               |\n| Rye          | $3              | 0.4 kg                  | 0.3 hours               |\n| Sourdough    | $2.5            | 0.3 kg                  | 0.15 hours              |\n| Brioche      | $4              | 0.6 kg                  | 0.4 hours               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1412,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit of 150 hours of labor available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The bakery aims to maximize its daily profit. The profit per loaf and the cost per loaf for each type of bread are given in the following Table.\n\n| Bread Type       | Profit per Loaf | Cost per Loaf |\n|------------------|-----------------|---------------|\n| Wheat            | $0.50           | $0.30         |\n| Rye              | $0.70           | $0.40         |\n| Sourdough        | $0.60           | $0.50         |\n| Whole Grain      | $0.80           | $0.60         |\n\nThe bakery has a limited daily budget of $100 for production costs. The bakery also has a maximum daily oven capacity of 200 loaves. Please help the bakery to determine the optimal daily production quantities of each type of bread to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively. The bakery also has a maximum daily oven capacity of 200 loaves. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 627,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The number of each type of cake produced must be between 0 and 100.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| Cake 1    | $5              | 1                   | 0.5                 |\n| Cake 2    | $7              | 2                   | 0.7                 |\n| Cake 3    | $6              | 1.5                 | 0.6                 |\n| Cake 4    | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Please help the bakery determine the optimal number of each type of cake to produce to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for each cake type is 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for each cake type is 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with the amount of flour required for each cake type being 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4. Additionally, the bakery has a total of 150 kg of sugar available daily, with the amount of sugar required for each cake type being 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4. The number of each type of cake produced must be between 0 and 100.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| Cake 1    | $5              | 1                   | 0.5                 |\n| Cake 2    | $7              | 2                   | 0.7                 |\n| Cake 3    | $6              | 1.5                 | 0.6                 |\n| Cake 4    | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for each cake type is 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for each cake type is 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake type requiring 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake type requiring 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4. Please help the bakery determine the optimal number of each type of cake to produce to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 706,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively. The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Please help the bakery to maximize its total profit.\n\n| Bread Type | Profit Margin per Loaf | Flour Required per Loaf (kg) |\n|------------|-------------------------|------------------------------|\n| Bread 1    | $0.50                   | 0.2                          |\n| Bread 2    | $0.75                   | 0.3                          |\n| Bread 3    | $0.60                   | 0.25                         |\n| Bread 4    | $0.45                   | 0.15                         |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery has 50 kg of flour available, with each loaf of bread 1-4 requiring 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively. Additionally, the bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Please help the bakery to maximize its total profit by determining the optimal amount of each type of bread to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 535,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The number of each type of cake produced must be between 0 and 100.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| Cake 1    | $5              | 1                   | 0.5                 |\n| Cake 2    | $7              | 2                   | 0.7                 |\n| Cake 3    | $6              | 1.5                 | 0.6                 |\n| Cake 4    | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Please help the bakery determine the optimal number of each type of cake to produce to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit and production cost for each product are given in the following Table.\n\n| Product | Expected Profit | Production Cost |\n|---------|-----------------|-----------------|\n| A       | $20,000         | $6,000          |\n| B       | $30,000         | $8,000          |\n| C       | $15,000         | $5,000          |\n| D       | $25,000         | $7,000          |\n\nThe company has a budget of $18,000 for launching new products. Due to limited marketing capabilities, the company can only allocate resources to at most two products. \nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products. Due to limited marketing capabilities, the company can only allocate resources to at most two products. \n\nPlease help the company to maximize the total expected profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 554,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for each type is as follows:\n\n| Cake Type    | Profit per Cake |\n|--------------|-----------------|\n| Chocolate    | $5              |\n| Vanilla      | $4              |\n| Strawberry   | $3              |\n| Carrot       | $6              |\n\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n\nPlease help the bakery to maximize its daily profit while considering the labor and ingredient constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit. The bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily. Please help the bakery determine the optimal number of each type of cake to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 746,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 500\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\n// 0.2*Whole_Wheat + 0.3*Rye <= 100",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Requirement (kg) | Labor Hours Required |\n|----------------|------------------|------------------------|----------------------|\n| Whole Wheat    | $2               | 0.5                    | 0.2                  |\n| Rye            | $3               | 0.4                    | 0.3                  |\n\nThe bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery also has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of whole wheat and rye breads to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 500 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 500)\n## The bakery has 100 labor hours available daily.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1171,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 500\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\n// 0.2*Whole_Wheat + 0.3*Rye <= 100",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 500 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 500)\n## The bakery has 100 labor hours available daily.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 672,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The bakery has a daily budget of $100 for ingredients, where each croissant requires $0.50 worth of ingredients and each muffin requires $0.75 worth of ingredients. Additionally, the bakery has a daily labor limit of 8 hours, with each croissant requiring 0.1 hours of labor and each muffin requiring 0.2 hours of labor.\n\nPlease help the bakery to maximize the total daily profit.\n\n| Pastry   | Profit per Unit | Cost per Unit (Ingredients) | Labor Time per Unit |\n|----------|-----------------|-----------------------------|---------------------|\n| Croissants | $2             | $0.50                       | 0.1 hours           |\n| Muffins   | $3             | $0.75                       | 0.2 hours           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients. The bakery also has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 657,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Labor Requirement (hours) |\n|------------|-----------------|------------------------|---------------------------|\n| Wheat      | $2              | 0.5                    | 0.2                       |\n| Rye        | $3              | 0.6                    | 0.3                       |\n\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery also has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of wheat and rye loaves to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has 200 kg of flour available daily, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.6 kg of flour. Additionally, the bakery has 100 hours of labor available daily, with each loaf of wheat bread requiring 0.2 hours of labor and each loaf of rye bread requiring 0.3 hours of labor. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor. Please help the bakery to maximize the total daily profit.\n\n| Bread Type | Profit per Bread | Flour Required (kg) | Labor Time (minutes) |\n|------------|------------------|---------------------|----------------------|\n| Whole Wheat | $2 | 0.5 | 15 |\n| Rye | $3 | 0.4 | 20 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 675,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery also has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n\nPlease help the bakery to maximize the total daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery also has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor. Please help the bakery to maximize the total daily profit from selling both types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations.\n// {\"daily production quantity of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requires 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively.\n// 0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for raw materials per day. The cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain is $1, $1.2, $1.5, and $1.1, respectively.\n// Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations. The profit per loaf for each type of bread is as follows: Whole Wheat at $2, Rye at $2.5, Sourdough at $3, and Multigrain at $2.2. The bakery aims to maximize the total daily profit.\n\n| Bread Type     | Profit per Loaf | Labor Hours per Loaf | Raw Material Cost per Loaf |\n|----------------|-----------------|----------------------|----------------------------|\n| Whole Wheat    | $2              | 0.5                  | $1                         |\n| Rye            | $2.5            | 0.4                  | $1.2                       |\n| Sourdough      | $3              | 0.6                  | $1.5                       |\n| Multigrain     | $2.2            | 0.5                  | $1.1                       |\n\nThe bakery has a total of 1000 hours of labor available per day and a budget of $2000 for raw materials per day. Each loaf of bread requires a certain amount of labor and raw materials as shown in the table. Please help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # daily production quantity of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000)\n## The bakery has a budget of $2000 for raw materials per day.\nmodel.addCons(Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations.\n// {\"daily production quantity of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requires 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively.\n// 0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for raw materials per day. The cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain is $1, $1.2, $1.5, and $1.1, respectively.\n// Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations. The profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 hours of labor available per day, with each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requiring 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively. Additionally, the bakery has a budget of $2000 for raw materials per day, with the cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain being $1, $1.2, $1.5, and $1.1, respectively. Please help the bakery determine the optimal daily production quantity for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # daily production quantity of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000)\n## The bakery has a budget of $2000 for raw materials per day.\nmodel.addCons(Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources. The cost and revenue for each device are given in the following Table.\n\n| Device       | Production Cost | Selling Price |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $200          |\n| Tablets      | $150            | $300          |\n| Laptops      | $300            | $500          |\n| Smartwatches | $50             | $100          |\n\nThe manufacturer has a production capacity of 1000 units. The budget for production is $200,000. Please help the manufacturer to maximize the total profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nTotal_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\nTotal_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(Total_Cost <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources. The cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit. The manufacturer has a production capacity of 1000 units and a budget for production of $200,000. Please help the manufacturer to maximize the total profit (which is defined as the total revenue minus the total cost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nTotal_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\nTotal_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(Total_Cost <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n\n| Cake Type       | Profit per Cake | Sugar Required (cups) | Eggs Required |\n|------------------|-----------------|-----------------------|---------------|\n| Chocolate        | $5              | 2                     | 3             |\n| Vanilla          | $4              | 1                     | 2             |\n| Strawberry       | $3              | 1                     | 2             |\n\nThe bakery has 100 cups of sugar available daily. The bakery also has 80 eggs available daily.\n\nPlease help the bakery to determine the optimal number of each type of cake to produce daily to maximize its profit, considering the constraints on sugar and eggs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily. Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit and cost per pastry, as well as the baking time and chocolate requirements, are given in the following Table.\n\n| Pastry   | Profit per Unit | Cost per Unit | Baking Time per Unit | Chocolate per Unit |\n|----------|-----------------|---------------|----------------------|--------------------|\n| Croissant| $0.50           | $0.20         | 0.1 hours            | -                  |\n| Muffin   | $0.75           | $0.30         | 0.2 hours            | 20 grams           |\n| Eclair   | $1.20           | $0.50         | 0.3 hours            | 50 grams           |\n\nThe bakery has a total of 8 hours available for baking each day. The daily supply of chocolate is 400 grams. The bakery wants to maximize the daily profit, which is defined as the total revenue minus the total cost.\nPlease help the bakery determine the optimal number of each type of pastry to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day. The bakery also has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The following table shows the requirements for oven time and flour for each pastry type.\n\n| Pastry   | Profit per Unit | Oven Time per Unit | Flour per Unit |\n|----------|-----------------|--------------------|----------------|\n| Croissants | $0.50          | 0.1 hours          | 0.1 kg         |\n| Muffins   | $0.75          | 0.2 hours          | 0.2 kg         |\n| Donuts    | $0.60          | 0.15 hours         | 0.15 kg        |\n\nThe bakery has a total of 8 hours of oven time available daily. The bakery also has 10 kg of flour available daily. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## The bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours, with a total of 8 hours of oven time available daily. The bakery also has 10 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, and each donut requiring 0.15 kg. Please help the bakery maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## The bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"quantity of wheat bread\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"quantity of any bread\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n// The total quantity of bread produced should not exceed the bakery's capacity: x1 + x2 + x3 + x4 <= 1000\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand.\n// x1 >= 100\n// x2 >= 100\n// x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event.\n// x4 >= 200",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The following table summarizes the flour requirements per loaf of each type of bread:\n\n| Type of Bread | Profit per Loaf | Flour Requirement per Loaf |\n|---------------|-----------------|----------------------------|\n| Wheat         | $1.50           | 0.5 kg                     |\n| Rye           | $2.00           | 0.6 kg                     |\n| Sourdough     | $2.50           | 0.7 kg                     |\n\nThe bakery has a limited amount of flour available each day, with a total daily flour usage not exceeding 500 kg. The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand. Additionally, the bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event. The total quantity of bread produced should not exceed the bakery's capacity of 1000 loaves per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of any bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4)\n\n# Add constraints\n## The total quantity of bread produced should not exceed the bakery's capacity\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The total daily flour usage should not exceed 500 kg\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 100)\nmodel.addCons(x3 >= 100)\n## The bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event\nmodel.addCons(x4 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(x1))\n    print(\"Quantity of rye bread: \", model.getVal(x2))\n    print(\"Quantity of sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of any bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"quantity of wheat bread\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"quantity of any bread\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n// The total quantity of bread produced should not exceed the bakery's capacity: x1 + x2 + x3 + x4 <= 1000\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand.\n// x1 >= 100\n// x2 >= 100\n// x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event.\n// x4 >= 200",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg. The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand. Additionally, the bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event. The total quantity of bread produced should not exceed the bakery's capacity of 1000 loaves. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of any bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4)\n\n# Add constraints\n## The total quantity of bread produced should not exceed the bakery's capacity\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The total daily flour usage should not exceed 500 kg\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 100)\nmodel.addCons(x3 >= 100)\n## The bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event\nmodel.addCons(x4 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(x1))\n    print(\"Quantity of rye bread: \", model.getVal(x2))\n    print(\"Quantity of sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of any bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Specialty. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $3              |\n| Rye              | $4              |\n| Sourdough        | $5              |\n| Specialty        | $6              |\n\nThe bakery has a total oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough, as well as Specialty bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery has a total oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations. Additionally, the bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 200 loaves per day.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\n// x1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor hours required for each type of bread:\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf |\n|------------|-----------------|----------------------|\n| Bread 1    | $1.50           | 0.5 hours            |\n| Bread 2    | $2.00           | 0.7 hours            |\n| Bread 3    | $1.75           | 0.6 hours            |\n| Bread 4    | $1.80           | 0.8 hours            |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven space and can bake a maximum of 200 loaves per day. Additionally, the bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space and can bake a maximum of 200 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 200 loaves per day.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\n// x1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven space and can bake a maximum of 200 loaves per day. Additionally, the bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement. Please help the bakery to maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space and can bake a maximum of 200 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 684,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients (Ingredient 1-4) and need to determine the optimal amount of each ingredient to use in the recipe.\n// {\"amount of Ingredient 1 in the recipe\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 2 in the recipe\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 3 in the recipe\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 4 in the recipe\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"continuous\"}\n// The total amount of ingredients should not exceed 100 units: x1 + x2 + x3 + x4 <= 100\n\n## Define Objective Function:\nThe cost of Ingredient 1-4 is $5, $7, $6, and $4 per unit, respectively. The bakery wants to minimize the cost of the cake recipe.\n// Minimize: 5*x1 + 7*x2 + 6*x3 + 4*x4\n\n## Generate Constraint-1:\nThe nutritional content of Ingredient 1-4 per unit is 10g of fat, 15g of sugar, 20g of protein, and 5g of fiber, respectively. The bakery wants the cake to have at least 50g of fat, 100g of sugar, 150g of protein, and 20g of fiber.\n// 10*x1 + 15*x2 + 20*x3 + 5*x4 >= 50 (fat)\n// 15*x1 + 20*x2 + 15*x3 + 10*x4 >= 100 (sugar)\n// 20*x1 + 25*x2 + 30*x3 + 10*x4 >= 150 (protein)\n// 5*x1 + 10*x2 + 5*x3 + 10*x4 >= 20 (fiber)\n\n## Generate Constraint-2:\nThe recipe should contain at least 10 units of Ingredient 1.\n// x1 >= 10\n\n## Generate Constraint-3:\nThe total amount of ingredients should not exceed 100 units.\n// x1 + x2 + x3 + x4 <= 100",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients (Ingredient 1-4) and need to determine the optimal amount of each ingredient to use in the recipe. The cost per unit of Ingredient 1-4 is $5, $7, $6, and $4, respectively. The nutritional content per unit of Ingredient 1-4 is as follows:\n\n| Ingredient | Cost per Unit | Fat (g) | Sugar (g) | Protein (g) | Fiber (g) |\n|------------|---------------|---------|-----------|-------------|-----------|\n| 1          | 5$            | 10      | 15        | 20          | 5         |\n| 2          | 7$            | -       | 20        | 25          | 10        |\n| 3          | 6$            | -       | -         | 30          | 5         |\n| 4          | 4$            | -       | 10        | 10          | 10        |\n\nThe bakery wants the cake to have at least 50g of fat, 100g of sugar, 150g of protein, and 20g of fiber. The recipe should contain at least 10 units of Ingredient 1. The total amount of ingredients should not exceed 100 units.\n\nPlease help the bakery to minimize the cost of the cake recipe while meeting these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient in the recipe\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=100) # amount of Ingredient 1 in the recipe\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=100) # amount of Ingredient 2 in the recipe\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=100) # amount of Ingredient 3 in the recipe\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=100) # amount of Ingredient 4 in the recipe\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*x1 + 7*x2 + 6*x3 + 4*x4)\n\n# Add constraints\n## The nutritional content constraints\nmodel.addCons(10*x1 + 15*x2 + 20*x3 + 5*x4 >= 50) # fat\nmodel.addCons(15*x1 + 20*x2 + 15*x3 + 10*x4 >= 100) # sugar\nmodel.addCons(20*x1 + 25*x2 + 30*x3 + 10*x4 >= 150) # protein\nmodel.addCons(5*x1 + 10*x2 + 5*x3 + 10*x4 >= 20) # fiber\n## The recipe should contain at least 10 units of Ingredient 1.\nmodel.addCons(x1 >= 10)\n## The total amount of ingredients should not exceed 100 units.\nmodel.addCons(x1 + x2 + x3 + x4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Ingredient 1 in the recipe: \", model.getVal(x1))\n    print(\"Amount of Ingredient 2 in the recipe: \", model.getVal(x2))\n    print(\"Amount of Ingredient 3 in the recipe: \", model.getVal(x3))\n    print(\"Amount of Ingredient 4 in the recipe: \", model.getVal(x4))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients (Ingredient 1-4) and need to determine the optimal amount of each ingredient to use in the recipe.\n// {\"amount of Ingredient 1 in the recipe\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 2 in the recipe\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 3 in the recipe\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"continuous\"}\n// {\"amount of Ingredient 4 in the recipe\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"continuous\"}\n// The total amount of ingredients should not exceed 100 units: x1 + x2 + x3 + x4 <= 100\n\n## Define Objective Function:\nThe cost of Ingredient 1-4 is $5, $7, $6, and $4 per unit, respectively. The bakery wants to minimize the cost of the cake recipe.\n// Minimize: 5*x1 + 7*x2 + 6*x3 + 4*x4\n\n## Generate Constraint-1:\nThe nutritional content of Ingredient 1-4 per unit is 10g of fat, 15g of sugar, 20g of protein, and 5g of fiber, respectively. The bakery wants the cake to have at least 50g of fat, 100g of sugar, 150g of protein, and 20g of fiber.\n// 10*x1 + 15*x2 + 20*x3 + 5*x4 >= 50 (fat)\n// 15*x1 + 20*x2 + 15*x3 + 10*x4 >= 100 (sugar)\n// 20*x1 + 25*x2 + 30*x3 + 10*x4 >= 150 (protein)\n// 5*x1 + 10*x2 + 5*x3 + 10*x4 >= 20 (fiber)\n\n## Generate Constraint-2:\nThe recipe should contain at least 10 units of Ingredient 1.\n// x1 >= 10\n\n## Generate Constraint-3:\nThe total amount of ingredients should not exceed 100 units.\n// x1 + x2 + x3 + x4 <= 100",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients (Ingredient 1-4) and need to determine the optimal amount of each ingredient to use in the recipe. The cost of Ingredient 1-4 is $5, $7, $6, and $4 per unit, respectively. The bakery wants to minimize the cost of the cake recipe. The nutritional content of Ingredient 1-4 per unit is 10g of fat, 15g of sugar, 20g of protein, and 5g of fiber, respectively. The bakery wants the cake to have at least 50g of fat, 100g of sugar, 150g of protein, and 20g of fiber. The recipe should contain at least 10 units of Ingredient 1. The total amount of ingredients should not exceed 100 units. Please help the bakery to determine the optimal amounts of Ingredient 1-4 to use in the recipe.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient in the recipe\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=100) # amount of Ingredient 1 in the recipe\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=100) # amount of Ingredient 2 in the recipe\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=100) # amount of Ingredient 3 in the recipe\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=100) # amount of Ingredient 4 in the recipe\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*x1 + 7*x2 + 6*x3 + 4*x4)\n\n# Add constraints\n## The nutritional content constraints\nmodel.addCons(10*x1 + 15*x2 + 20*x3 + 5*x4 >= 50) # fat\nmodel.addCons(15*x1 + 20*x2 + 15*x3 + 10*x4 >= 100) # sugar\nmodel.addCons(20*x1 + 25*x2 + 30*x3 + 10*x4 >= 150) # protein\nmodel.addCons(5*x1 + 10*x2 + 5*x3 + 10*x4 >= 20) # fiber\n## The recipe should contain at least 10 units of Ingredient 1.\nmodel.addCons(x1 >= 10)\n## The total amount of ingredients should not exceed 100 units.\nmodel.addCons(x1 + x2 + x3 + x4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Ingredient 1 in the recipe: \", model.getVal(x1))\n    print(\"Amount of Ingredient 2 in the recipe: \", model.getVal(x2))\n    print(\"Amount of Ingredient 3 in the recipe: \", model.getVal(x3))\n    print(\"Amount of Ingredient 4 in the recipe: \", model.getVal(x4))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"y1\", \"range\": \"y1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"y2\", \"range\": \"y2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"y3\", \"range\": \"y3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"y4\", \"range\": \"y4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $150 for ingredients. Each loaf of Bread 1-4 costs $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively.\n// 0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\n// y1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf and the cost of ingredients for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost of Ingredients per Loaf |\n|------------|-----------------|------------------------------|\n| Bread 1    | $1.50           | $0.80                        |\n| Bread 2    | $2.00           | $1.00                        |\n| Bread 3    | $1.75           | $0.90                        |\n| Bread 4    | $1.60           | $0.95                        |\n\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a daily budget of $150 for ingredients. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\ny1 = model.addVar(vtype=\"INTEGER\", name=\"y1\", lb=0) # number of Bread 1 produced daily\ny2 = model.addVar(vtype=\"INTEGER\", name=\"y2\", lb=0) # number of Bread 2 produced daily\ny3 = model.addVar(vtype=\"INTEGER\", name=\"y3\", lb=0) # number of Bread 3 produced daily\ny4 = model.addVar(vtype=\"INTEGER\", name=\"y4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100)\n## The bakery has a daily budget of $150 for ingredients.\nmodel.addCons(0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\nmodel.addCons(y1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(y1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(y2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(y3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(y4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"y1\", \"range\": \"y1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"y2\", \"range\": \"y2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"y3\", \"range\": \"y3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"y4\", \"range\": \"y4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $150 for ingredients. Each loaf of Bread 1-4 costs $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively.\n// 0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\n// y1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery has a total of 100 hours of labor available daily, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery also has a daily budget of $150 for ingredients, with each loaf of Bread 1-4 costing $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively. Additionally, the bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement. Please help the bakery maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\ny1 = model.addVar(vtype=\"INTEGER\", name=\"y1\", lb=0) # number of Bread 1 produced daily\ny2 = model.addVar(vtype=\"INTEGER\", name=\"y2\", lb=0) # number of Bread 2 produced daily\ny3 = model.addVar(vtype=\"INTEGER\", name=\"y3\", lb=0) # number of Bread 3 produced daily\ny4 = model.addVar(vtype=\"INTEGER\", name=\"y4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100)\n## The bakery has a daily budget of $150 for ingredients.\nmodel.addCons(0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\nmodel.addCons(y1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(y1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(y2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(y3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(y4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery aims to minimize the total production cost per day.\n// Minimize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\n// x2 + x3 <= 500",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing each type of bread is given in the following Table.\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations. The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves. \n\nPlease help the bakery to minimize the total production cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\nmodel.addCons(x2 + x3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(x4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery aims to minimize the total production cost per day.\n// Minimize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\n// x2 + x3 <= 500",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations. The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves. Please help the bakery determine the optimal number of each type of bread to produce daily to minimize the total production cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\nmodel.addCons(x2 + x3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(x4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 580,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe using four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of each ingredient is given in the following Table.\n\n| Ingredient | Cost per Unit | Unit |\n|------------|---------------|------|\n| Flour      | $0.05/gram    | gram |\n| Sugar      | $0.03/gram    | gram |\n| Eggs       | $0.10/unit    | unit |\n| Butter     | $0.08/gram    | gram |\n\nThe bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight and no more than 20% sugar by weight.\n\nPlease help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) to use in the cake to minimize the total cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1))\n    print(\"Amount of sugar: \", model.getVal(x2))\n    print(\"Amount of eggs: \", model.getVal(x3))\n    print(\"Amount of butter: \", model.getVal(x4))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe using four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight and no more than 20% sugar by weight. Please help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) within the specified ranges.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1))\n    print(\"Amount of sugar: \", model.getVal(x2))\n    print(\"Amount of eggs: \", model.getVal(x3))\n    print(\"Amount of butter: \", model.getVal(x4))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"b4\", \"range\": \"0 <= b4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total production cost per day.\n// Minimize: 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// b1 + b2 + b3 + b4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\n// b1 >= 100\n// b2 >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\n// b3 + b4 <= 600",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing each type of bread is given in the following Table.\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations. The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\nPlease help the bakery to minimize the total production cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of Bread 1 produced daily\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of Bread 2 produced daily\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of Bread 3 produced daily\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 1000)\n## The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\nmodel.addCons(b1 >= 100)\nmodel.addCons(b2 >= 200)\n## The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\nmodel.addCons(b3 + b4 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(b1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(b2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(b3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(b4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"b4\", \"range\": \"0 <= b4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total production cost per day.\n// Minimize: 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// b1 + b2 + b3 + b4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\n// b1 >= 100\n// b2 >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\n// b3 + b4 <= 600",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations. The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined. Please help the bakery to minimize the total production cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of Bread 1 produced daily\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of Bread 2 produced daily\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of Bread 3 produced daily\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 1000)\n## The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\nmodel.addCons(b1 >= 100)\nmodel.addCons(b2 >= 200)\n## The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\nmodel.addCons(b3 + b4 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(b1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(b2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(b3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(b4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 630,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Specialty. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $3              |\n| Rye              | $4              |\n| Sourdough        | $5              |\n| Specialty        | $6              |\n\nThe bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough, along with Specialty bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations. Additionally, the bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread. They have four different types of flour (Flour 1-4) available and need to determine the optimal amount of each flour to use in the recipe.\n// {\"amount of Flour 1 in the recipe\": \"x1\", \"range\": \"0 <= x1 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 2 in the recipe\": \"x2\", \"range\": \"0 <= x2 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 3 in the recipe\": \"x3\", \"range\": \"0 <= x3 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 4 in the recipe\": \"x4\", \"range\": \"0 <= x4 <= 1\", \"type\": \"continuous\"}\n// The total amount of flour should be 1: x1 + x2 + x3 + x4 = 1\n\n## Define Objective Function:\nThe cost of Flour 1-4 is $0.50, $0.60, $0.70, and $0.80 per kilogram, respectively. The bakery wants to minimize the cost of the flour mix per kilogram.\n// Minimize: 0.50*x1 + 0.60*x2 + 0.70*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe protein content of Flour 1-4 is 10%, 12%, 14%, and 16%; the bakery wants the protein content of the bread to be between 11% and 13%.\n// 11 <= 10*x1 + 12*x2 + 14*x3 + 16*x4 <= 13\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 30% of the flour mix comes from Flour 1.\n// x1 >= 0.3\n\n## Generate Constraint-3:\nThe bakery also wants to limit the use of Flour 4 to no more than 20% of the total flour mix.\n// x4 <= 0.2",
        "question": "A bakery wants to optimize the ingredients for a new type of bread. They have four different types of flour (Flour 1-4) available and need to determine the optimal amount of each flour to use in the recipe. The cost per kilogram for Flour 1-4 is $0.50, $0.60, $0.70, and $0.80, respectively. The total amount of flour should be 1: x1 + x2 + x3 + x4 = 1.\n\n| Flour Type | Cost per Kilogram | Protein Content |\n|------------|-------------------|-----------------|\n| Flour 1    | $0.50             | 10%             |\n| Flour 2    | $0.60             | 12%             |\n| Flour 3    | $0.70             | 14%             |\n| Flour 4    | $0.80             | 16%             |\n\nThe bakery wants the protein content of the bread to be between 11% and 13%. The bakery wants to ensure that at least 30% of the flour mix comes from Flour 1. Additionally, the bakery wants to limit the use of Flour 4 to no more than 20% of the total flour mix.\n\nPlease help the bakery to minimize the cost of the flour mix per kilogram while meeting these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each flour in the recipe\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1) # amount of Flour 1 in the recipe\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=1) # amount of Flour 2 in the recipe\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=1) # amount of Flour 3 in the recipe\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=1) # amount of Flour 4 in the recipe\nmodel.addCons(x1 + x2 + x3 + x4 == 1)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.60*x2 + 0.70*x3 + 0.80*x4)\n\n# Add constraints\n## The protein content of the bread to be between 11% and 13%.\nmodel.addCons(11 <= 10*x1 + 12*x2 + 14*x3 + 16*x4)\nmodel.addCons(10*x1 + 12*x2 + 14*x3 + 16*x4 <= 13)\n## At least 30% of the flour mix comes from Flour 1.\nmodel.addCons(x1 >= 0.3)\n## Limit the use of Flour 4 to no more than 20% of the total flour mix.\nmodel.addCons(x4 <= 0.2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Flour 1 in the recipe: \", model.getVal(x1))\n    print(\"Amount of Flour 2 in the recipe: \", model.getVal(x2))\n    print(\"Amount of Flour 3 in the recipe: \", model.getVal(x3))\n    print(\"Amount of Flour 4 in the recipe: \", model.getVal(x4))\n    print(\"Minimized Cost of Flour Mix: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread. They have four different types of flour (Flour 1-4) available and need to determine the optimal amount of each flour to use in the recipe.\n// {\"amount of Flour 1 in the recipe\": \"x1\", \"range\": \"0 <= x1 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 2 in the recipe\": \"x2\", \"range\": \"0 <= x2 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 3 in the recipe\": \"x3\", \"range\": \"0 <= x3 <= 1\", \"type\": \"continuous\"}\n// {\"amount of Flour 4 in the recipe\": \"x4\", \"range\": \"0 <= x4 <= 1\", \"type\": \"continuous\"}\n// The total amount of flour should be 1: x1 + x2 + x3 + x4 = 1\n\n## Define Objective Function:\nThe cost of Flour 1-4 is $0.50, $0.60, $0.70, and $0.80 per kilogram, respectively. The bakery wants to minimize the cost of the flour mix per kilogram.\n// Minimize: 0.50*x1 + 0.60*x2 + 0.70*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe protein content of Flour 1-4 is 10%, 12%, 14%, and 16%; the bakery wants the protein content of the bread to be between 11% and 13%.\n// 11 <= 10*x1 + 12*x2 + 14*x3 + 16*x4 <= 13\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 30% of the flour mix comes from Flour 1.\n// x1 >= 0.3\n\n## Generate Constraint-3:\nThe bakery also wants to limit the use of Flour 4 to no more than 20% of the total flour mix.\n// x4 <= 0.2",
        "question": "A bakery wants to optimize the ingredients for a new type of bread using four different types of flour (Flour 1-4). They need to determine the optimal amount of each flour to use in the recipe, with the total amount of flour being 1. The cost of Flour 1-4 is $0.50, $0.60, $0.70, and $0.80 per kilogram, respectively. The bakery aims to minimize the cost of the flour mix per kilogram. The protein content of Flour 1-4 is 10%, 12%, 14%, and 16%, and the bakery wants the protein content of the bread to be between 11% and 13%. Additionally, the bakery wants to ensure that at least 30% of the flour mix comes from Flour 1 and limit the use of Flour 4 to no more than 20% of the total flour mix. Please help the bakery determine the optimal amounts of each flour to use in the recipe.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each flour in the recipe\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1) # amount of Flour 1 in the recipe\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=1) # amount of Flour 2 in the recipe\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=1) # amount of Flour 3 in the recipe\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=1) # amount of Flour 4 in the recipe\nmodel.addCons(x1 + x2 + x3 + x4 == 1)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.60*x2 + 0.70*x3 + 0.80*x4)\n\n# Add constraints\n## The protein content of the bread to be between 11% and 13%.\nmodel.addCons(11 <= 10*x1 + 12*x2 + 14*x3 + 16*x4)\nmodel.addCons(10*x1 + 12*x2 + 14*x3 + 16*x4 <= 13)\n## At least 30% of the flour mix comes from Flour 1.\nmodel.addCons(x1 >= 0.3)\n## Limit the use of Flour 4 to no more than 20% of the total flour mix.\nmodel.addCons(x4 <= 0.2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Flour 1 in the recipe: \", model.getVal(x1))\n    print(\"Amount of Flour 2 in the recipe: \", model.getVal(x2))\n    print(\"Amount of Flour 3 in the recipe: \", model.getVal(x3))\n    print(\"Amount of Flour 4 in the recipe: \", model.getVal(x4))\n    print(\"Minimized Cost of Flour Mix: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"amount of Bread A produced\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"continuous\"}\n// {\"amount of Bread B produced\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"continuous\"}\n// {\"amount of Bread C produced\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"continuous\"}\n// {\"amount of Bread D produced\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively.\n// x1 + 1.5*x2 + x3 + 2*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\n// x2 >= 300",
        "question": "A bakery wants to optimize the production of four types of bread (Bread A, Bread B, Bread C, and Bread D) to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for each type of bread is as follows:\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Bread A    | $1.50           |\n| Bread B    | $2.00           |\n| Bread C    | $1.75           |\n| Bread D    | $1.80           |\n\nThe bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively. The bakery must produce at least 200 loaves of Bread A to meet a contract obligation. Additionally, the bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread produced\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # amount of Bread A produced\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # amount of Bread B produced\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # amount of Bread C produced\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # amount of Bread D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily limit of 1000 pounds of flour.\nmodel.addCons(x1 + 1.5*x2 + x3 + 2*x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n## The bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\nmodel.addCons(x2 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread A produced: \", model.getVal(x1))\n    print(\"Amount of Bread B produced: \", model.getVal(x2))\n    print(\"Amount of Bread C produced: \", model.getVal(x3))\n    print(\"Amount of Bread D produced: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"amount of Bread A produced\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"continuous\"}\n// {\"amount of Bread B produced\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"continuous\"}\n// {\"amount of Bread C produced\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"continuous\"}\n// {\"amount of Bread D produced\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively.\n// x1 + 1.5*x2 + x3 + 2*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\n// x2 >= 300",
        "question": "A bakery wants to optimize the production of four types of bread (Bread A, Bread B, Bread C, and Bread D) to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively. The bakery must produce at least 200 loaves of Bread A to meet a contract obligation. Additionally, the bakery has a daily demand for Bread B that must be met, which is at least 300 loaves. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread produced\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # amount of Bread A produced\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # amount of Bread B produced\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # amount of Bread C produced\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # amount of Bread D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily limit of 1000 pounds of flour.\nmodel.addCons(x1 + 1.5*x2 + x3 + 2*x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n## The bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\nmodel.addCons(x2 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread A produced: \", model.getVal(x1))\n    print(\"Amount of Bread B produced: \", model.getVal(x2))\n    print(\"Amount of Bread C produced: \", model.getVal(x3))\n    print(\"Amount of Bread D produced: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily.\n// {\"quantity of Bread 1 produced daily\": \"q1\", \"range\": \"0 <= q1\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"q2\", \"range\": \"0 <= q2\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"q3\", \"range\": \"0 <= q3\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced daily\": \"q4\", \"range\": \"0 <= q4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively.\n// 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\n// 5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// q1 + q2 + q3 + q4 <= 200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily. The profit per loaf and the cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost of Ingredients per Loaf |\n|------------|-----------------|------------------------------|\n| Bread 1    | $1.50           | $0.50                        |\n| Bread 2    | $2.00           | $0.75                        |\n| Bread 3    | $1.75           | $0.60                        |\n| Bread 4    | $1.80           | $0.65                        |\n\nThe bakery has a daily budget of $100 for ingredients. Each loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced daily\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0) # quantity of Bread 1 produced daily\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0) # quantity of Bread 2 produced daily\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0) # quantity of Bread 3 produced daily\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0) # quantity of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100)\n## The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\nmodel.addCons(5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(q1 + q2 + q3 + q4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(q1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(q2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(q3))\n    print(\"Quantity of Bread 4 produced daily: \", model.getVal(q4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily.\n// {\"quantity of Bread 1 produced daily\": \"q1\", \"range\": \"0 <= q1\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"q2\", \"range\": \"0 <= q2\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"q3\", \"range\": \"0 <= q3\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced daily\": \"q4\", \"range\": \"0 <= q4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively.\n// 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\n// 5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// q1 + q2 + q3 + q4 <= 200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively. Each loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. Please help the bakery to maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced daily\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0) # quantity of Bread 1 produced daily\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0) # quantity of Bread 2 produced daily\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0) # quantity of Bread 3 produced daily\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0) # quantity of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100)\n## The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\nmodel.addCons(5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(q1 + q2 + q3 + q4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(q1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(q2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(q3))\n    print(\"Quantity of Bread 4 produced daily: \", model.getVal(q4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\n// x1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor hours required for each type of bread:\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf |\n|------------|-----------------|----------------------|\n| Bread 1    | $1.50           | 0.5 hours            |\n| Bread 2    | $2.00           | 0.7 hours            |\n| Bread 3    | $1.75           | 0.6 hours            |\n| Bread 4    | $1.80           | 0.8 hours            |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily. The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\n// x1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily. Additionally, the bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation. Please help the bakery maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are limited.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from selling both products.\n// Objective Function: Maximize: 50*A_sold + 70*B_sold\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced.\n// A_units <= 100\n// B_units <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 80 units, and for Product B is at least 90 units.\n// A_sold >= 80\n// B_sold >= 90\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A_units\n// B_sold <= B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit from selling one unit of Product A is $50, and from Product B is $70. The production capacity and market demand for each product are limited.\n\n| Product | Profit per Unit | Production Capacity | Market Demand |\n|---------|-----------------|----------------------|---------------|\n| A       | $50             | 100 units            | 80 units      |\n| B       | $70             | 120 units            | 90 units      |\n\nThe production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced. The market demand for Product A is at least 80 units, and for Product B is at least 90 units. The company can only sell as many units as it produces for each product.\n\nPlease help the company to maximize its total profit from selling both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of Product A sold\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of Product B sold\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 70*B_sold)\n\n# Add constraints\n## The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced.\nmodel.addCons(A_units <= 100)\nmodel.addCons(B_units <= 120)\n## The market demand for Product A is at least 80 units, and for Product B is at least 90 units.\nmodel.addCons(A_sold >= 80)\nmodel.addCons(B_sold >= 90)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A_units)\nmodel.addCons(B_sold <= B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Number of units of Product A sold: \", model.getVal(A_sold))\n    print(\"Number of units of Product B sold: \", model.getVal(B_sold))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are limited.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from selling both products.\n// Objective Function: Maximize: 50*A_sold + 70*B_sold\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced.\n// A_units <= 100\n// B_units <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 80 units, and for Product B is at least 90 units.\n// A_sold >= 80\n// B_sold >= 90\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A_units\n// B_sold <= B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit from selling one unit of Product A is $50, and from Product B is $70. The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced. The market demand for Product A is at least 80 units, and for Product B is at least 90 units. The company can only sell as many units as it produces for each product. Please help the company to maximize its total profit from selling both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of Product A sold\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of Product B sold\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 70*B_sold)\n\n# Add constraints\n## The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced.\nmodel.addCons(A_units <= 100)\nmodel.addCons(B_units <= 120)\n## The market demand for Product A is at least 80 units, and for Product B is at least 90 units.\nmodel.addCons(A_sold >= 80)\nmodel.addCons(B_sold >= 90)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A_units)\nmodel.addCons(B_sold <= B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Number of units of Product A sold: \", model.getVal(A_sold))\n    print(\"Number of units of Product B sold: \", model.getVal(B_sold))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 613,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials. The total raw materials used should not exceed the available raw materials.\n// 3*A + 5*B <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours. The total labor hours used should not exceed the available labor hours.\n// 4*A + 6*B <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 80 units.\n// A >= 100\n// B >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit per unit for Product A is $50 and for Product B is $70. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $50             | 3 kg                    | 4 hours              |\n| B       | $70             | 5 kg                    | 6 hours              |\n\nThe total raw materials used should not exceed the available raw materials, and the total labor hours used should not exceed the available labor hours. The market demand for Product A is at least 100 units, and for Product B is at least 80 units. Please help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## Available resources\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # available raw materials\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials.\nmodel.addCons(3*A + 5*B <= Raw_Materials)\n## Each unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours.\nmodel.addCons(4*A + 6*B <= Labor_Hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 80 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials. The total raw materials used should not exceed the available raw materials.\n// 3*A + 5*B <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours. The total labor hours used should not exceed the available labor hours.\n// 4*A + 6*B <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 80 units.\n// A >= 100\n// B >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products. Each unit of Product A requires 3 kg of raw materials and 4 labor hours, while each unit of Product B requires 5 kg of raw materials and 6 labor hours. The total raw materials used should not exceed the available raw materials, and the total labor hours used should not exceed the available labor hours. The market demand for Product A is at least 100 units, and for Product B is at least 80 units. Please help the manufacturer decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## Available resources\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # available raw materials\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials.\nmodel.addCons(3*A + 5*B <= Raw_Materials)\n## Each unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours.\nmodel.addCons(4*A + 6*B <= Labor_Hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 80 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 30 units per week.\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe total production capacity of the manufacturer is 200 units per week. The market demand for product A is at least 50 units per week, and the market demand for product B is at least 30 units per week. Please help the manufacturer determine the optimal number of units of each product to produce to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 30 units per week.\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 30 units per week.\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products. The total production capacity of the manufacturer is 200 units per week. The market demand for product A is at least 50 units per week. The market demand for product B is at least 30 units per week. \nPlease help the manufacturer decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 30 units per week.\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 659,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes.\n// 15*A/60 + 20*B/60 + 30*C/60 <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\n// A >= 100\n// B >= 50\n\n## Generate Constraint-3:\nThe raw material constraint limits the production of product C to a maximum of 20 units per day.\n// C <= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $10, product B is $15, and product C is $20. The production times for each product are as follows:\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | 10$             | 15 minutes               |\n| B       | 15$             | 20 minutes               |\n| C       | 20$             | 30 minutes               |\n\nThe total production time for all products cannot exceed 8 hours per day. The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day. The raw material constraint limits the production of product C to a maximum of 20 units per day.\n\nPlease help the company to maximize the total daily profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production time for all products cannot exceed 8 hours per day.\nmodel.addCons(15*A/60 + 20*B/60 + 30*C/60 <= 8)\n## The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 50)\n## The raw material constraint limits the production of product C to a maximum of 20 units per day.\nmodel.addCons(C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes.\n// 15*A/60 + 20*B/60 + 30*C/60 <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\n// A >= 100\n// B >= 50\n\n## Generate Constraint-3:\nThe raw material constraint limits the production of product C to a maximum of 20 units per day.\n// C <= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $10, product B is $15, and product C is $20. The company aims to maximize the total daily profit from the production of these three products. The total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes. The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day. The raw material constraint limits the production of product C to a maximum of 20 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production time for all products cannot exceed 8 hours per day.\nmodel.addCons(15*A/60 + 20*B/60 + 30*C/60 <= 8)\n## The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 50)\n## The raw material constraint limits the production of product C to a maximum of 20 units per day.\nmodel.addCons(C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of units of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2\n\n## Generate Constraint-1:\nThe total production capacity of Factory 1 is 100 units per day.\n// A_F1 + B_F1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Factory 2 is 120 units per day.\n// A_F2 + B_F2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units per day.\n// A_F1 + A_F2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The following table summarizes the production costs for each product in each factory.\n\n| Product | Factory 1 Cost | Factory 2 Cost |\n|---------|----------------|----------------|\n| A       | 10$            | 12$            |\n| B       | 8$             | 9$             |\n\nThe total production capacity of Factory 1 is 100 units per day. The total production capacity of Factory 2 is 120 units per day. The market demand for Product A is at least 50 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the production capacity and market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of units of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of units of Product A produced in Factory 2\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of units of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of units of Product B produced in Factory 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2)\n\n# Add constraints\n## The total production capacity of Factory 1 is 100 units per day.\nmodel.addCons(A_F1 + B_F1 <= 100)\n## The total production capacity of Factory 2 is 120 units per day.\nmodel.addCons(A_F2 + B_F2 <= 120)\n## The market demand for Product A is at least 50 units per day.\nmodel.addCons(A_F1 + A_F2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Number of units of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Number of units of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Number of units of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of units of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2\n\n## Generate Constraint-1:\nThe total production capacity of Factory 1 is 100 units per day.\n// A_F1 + B_F1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Factory 2 is 120 units per day.\n// A_F2 + B_F2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units per day.\n// A_F1 + A_F2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\nThe cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost.\nThe total production capacity of Factory 1 is 100 units per day. The total production capacity of Factory 2 is 120 units per day. The market demand for Product A is at least 50 units per day.\nPlease help the manufacturer determine the optimal number of units of each product to produce in each factory to minimize the total production cost while meeting the production capacity and market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of units of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of units of Product A produced in Factory 2\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of units of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of units of Product B produced in Factory 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2)\n\n# Add constraints\n## The total production capacity of Factory 1 is 100 units per day.\nmodel.addCons(A_F1 + B_F1 <= 100)\n## The total production capacity of Factory 2 is 120 units per day.\nmodel.addCons(A_F2 + B_F2 <= 120)\n## The market demand for Product A is at least 50 units per day.\nmodel.addCons(A_F1 + A_F2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Number of units of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Number of units of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Number of units of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available labor hours per day\": \"Labor\", \"range\": \"Labor = 480\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total labor hours used per day should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 480\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and the company must meet this demand.\n// A >= 50\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the labor hours required for each product:\n\n| Product | Labor Hours Required per Unit |\n|---------|-------------------------------|\n| A       | 2 hours                       |\n| B       | 3 hours                       |\n| C       | 4 hours                       |\n\nThe company has 480 labor hours available per day. The market demand for product A is at least 50 units per day, and the company must meet this demand. The combined production of products B and C should not exceed twice the production of product A. \n\nPlease help the company to maximize the total daily profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 480)\n## The market demand for product A is at least 50 units per day, and the company must meet this demand.\nmodel.addCons(A >= 50)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available labor hours per day\": \"Labor\", \"range\": \"Labor = 480\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total labor hours used per day should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 480\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and the company must meet this demand.\n// A >= 50\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total labor hours used per day should not exceed 480 hours. The market demand for product A is at least 50 units per day, and the company must meet this demand. The combined production of products B and C should not exceed twice the production of product A. Please help the company to maximize the total daily profit from the production of these three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 480)\n## The market demand for product A is at least 50 units per day, and the company must meet this demand.\nmodel.addCons(A >= 50)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Factory X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. The manufacturer wants to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 8*X_B + 12*Y_A + 9*Y_B\n\n## Generate Constraint-1:\nFactory X has a maximum production capacity of 200 units per week.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nFactory Y has a maximum production capacity of 150 units per week.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per week.\n// X_A + Y_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each factory is given in the following Table.\n\n| Product | Factory X Cost | Factory Y Cost |\n|---------|----------------|----------------|\n| A       | $10            | $12            |\n| B       | $8             | $9             |\n\nFactory X has a maximum production capacity of 200 units per week. Factory Y has a maximum production capacity of 150 units per week. The market demand for Product A is 100 units per week. Please help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of units of Product A produced in Factory X\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of units of Product B produced in Factory X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of units of Product A produced in Factory Y\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of units of Product B produced in Factory Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 8*X_B + 12*Y_A + 9*Y_B)\n\n# Add constraints\n## Factory X has a maximum production capacity of 200 units per week.\nmodel.addCons(X_A + X_B <= 200)\n## Factory Y has a maximum production capacity of 150 units per week.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per week.\nmodel.addCons(X_A + Y_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory X: \", model.getVal(X_A))\n    print(\"Number of units of Product B produced in Factory X: \", model.getVal(X_B))\n    print(\"Number of units of Product A produced in Factory Y: \", model.getVal(Y_A))\n    print(\"Number of units of Product B produced in Factory Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Factory X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. The manufacturer wants to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 8*X_B + 12*Y_A + 9*Y_B\n\n## Generate Constraint-1:\nFactory X has a maximum production capacity of 200 units per week.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nFactory Y has a maximum production capacity of 150 units per week.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per week.\n// X_A + Y_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost. The cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. Factory X has a maximum production capacity of 200 units per week, and Factory Y has a maximum production capacity of 150 units per week. The market demand for Product A is 100 units per week. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of units of Product A produced in Factory X\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of units of Product B produced in Factory X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of units of Product A produced in Factory Y\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of units of Product B produced in Factory Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 8*X_B + 12*Y_A + 9*Y_B)\n\n# Add constraints\n## Factory X has a maximum production capacity of 200 units per week.\nmodel.addCons(X_A + X_B <= 200)\n## Factory Y has a maximum production capacity of 150 units per week.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per week.\nmodel.addCons(X_A + Y_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory X: \", model.getVal(X_A))\n    print(\"Number of units of Product B produced in Factory X: \", model.getVal(X_B))\n    print(\"Number of units of Product A produced in Factory Y: \", model.getVal(Y_A))\n    print(\"Number of units of Product B produced in Factory Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost.\n// {\"number of Product A produced in Facility X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Facility Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 12*Y_A + 8*X_B + 9*Y_B\n\n## Generate Constraint-1:\nThe total production capacity of Facility X is 200 units per day.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Facility Y is 150 units per day.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per day.\n// X_A + Y_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each facility is given in the following Table.\n\n| Product | Facility X Cost | Facility Y Cost |\n|---------|-----------------|-----------------|\n| A       | $10             | $12             |\n| B       | $8              | $9              |\n\nThe total production capacity of Facility X is 200 units per day, and the total production capacity of Facility Y is 150 units per day. The market demand for Product A is 100 units per day. Please help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each facility\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of Product A produced in Facility X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of Product A produced in Facility Y\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of Product B produced in Facility X\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of Product B produced in Facility Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 12*Y_A + 8*X_B + 9*Y_B)\n\n# Add constraints\n## The total production capacity of Facility X is 200 units per day.\nmodel.addCons(X_A + X_B <= 200)\n## The total production capacity of Facility Y is 150 units per day.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per day.\nmodel.addCons(X_A + Y_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Facility X: \", model.getVal(X_A))\n    print(\"Number of Product A produced in Facility Y: \", model.getVal(Y_A))\n    print(\"Number of Product B produced in Facility X: \", model.getVal(X_B))\n    print(\"Number of Product B produced in Facility Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost.\n// {\"number of Product A produced in Facility X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Facility Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 12*Y_A + 8*X_B + 9*Y_B\n\n## Generate Constraint-1:\nThe total production capacity of Facility X is 200 units per day.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Facility Y is 150 units per day.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per day.\n// X_A + Y_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost. The cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The total production capacity of Facility X is 200 units per day, and the total production capacity of Facility Y is 150 units per day. The market demand for Product A is 100 units per day. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each facility\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of Product A produced in Facility X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of Product A produced in Facility Y\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of Product B produced in Facility X\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of Product B produced in Facility Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 12*Y_A + 8*X_B + 9*Y_B)\n\n# Add constraints\n## The total production capacity of Facility X is 200 units per day.\nmodel.addCons(X_A + X_B <= 200)\n## The total production capacity of Facility Y is 150 units per day.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per day.\nmodel.addCons(X_A + Y_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Facility X: \", model.getVal(X_A))\n    print(\"Number of Product A produced in Facility Y: \", model.getVal(Y_A))\n    print(\"Number of Product B produced in Facility X: \", model.getVal(X_B))\n    print(\"Number of Product B produced in Facility Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 753,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total amount of raw materials available per day is 500 units. Producing one unit of product A requires 5 units of raw materials, product B requires 8 units, and product C requires 10 units.\n// 5*A + 8*B + 10*C <= 500\n\n## Generate Constraint-2:\nThe total labor hours available per day are 400 hours. Producing one unit of product A requires 4 hours of labor, product B requires 6 hours, and product C requires 5 hours.\n// 4*A + 6*B + 5*C <= 400\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// A >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the raw material and labor requirements for each product.\n\n| Product | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------------|----------------------|\n| A       | 5 units               | 4 hours              |\n| B       | 8 units               | 6 hours              |\n| C       | 10 units              | 5 hours              |\n\nThe total amount of raw materials available per day is 500 units. The total labor hours available per day are 400 hours. The market demand for product A is at least 20 units per day.\n\nPlease help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total amount of raw materials available per day is 500 units.\nmodel.addCons(5*A + 8*B + 10*C <= 500)\n## The total labor hours available per day are 400 hours.\nmodel.addCons(4*A + 6*B + 5*C <= 400)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total amount of raw materials available per day is 500 units. Producing one unit of product A requires 5 units of raw materials, product B requires 8 units, and product C requires 10 units.\n// 5*A + 8*B + 10*C <= 500\n\n## Generate Constraint-2:\nThe total labor hours available per day are 400 hours. Producing one unit of product A requires 4 hours of labor, product B requires 6 hours, and product C requires 5 hours.\n// 4*A + 6*B + 5*C <= 400\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// A >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products. The total amount of raw materials available per day is 500 units, with each unit of product A requiring 5 units of raw materials, product B requiring 8 units, and product C requiring 10 units. The total labor hours available per day are 400 hours, with each unit of product A requiring 4 hours of labor, product B requiring 6 hours, and product C requiring 5 hours. The market demand for product A is at least 20 units per day. Please help the company decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total amount of raw materials available per day is 500 units.\nmodel.addCons(5*A + 8*B + 10*C <= 500)\n## The total labor hours available per day are 400 hours.\nmodel.addCons(4*A + 6*B + 5*C <= 400)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials = 1000\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from producing these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*A + 3*B + 4*C <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours. The total labor hours used must not exceed the available labor hours.\n// 8*A + 6*B + 5*C <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the manufacturer must meet this demand.\n// A >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table shows the requirements for raw materials and labor for each product.\n\n| Product | Raw Materials per Unit | Labor Hours per Unit |\n|---------|------------------------|----------------------|\n| A       | 5                      | 8                    |\n| B       | 3                      | 6                    |\n| C       | 4                      | 5                    |\n\nThe manufacturer has 1000 units of raw materials and 800 labor hours available. The market demand for product A is at least 50 units, and the manufacturer must meet this demand. The total raw materials used must not exceed the available raw materials, and the total labor hours used must not exceed the available labor hours. Please help the manufacturer to maximize the total profit from producing these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## Available resources\nRaw_Materials = 1000 # available raw materials\nLabor_Hours = 800 # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Constraint on raw materials\nmodel.addCons(5*A + 3*B + 4*C <= Raw_Materials)\n## Constraint on labor hours\nmodel.addCons(8*A + 6*B + 5*C <= Labor_Hours)\n## Market demand for product A\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials = 1000\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from producing these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*A + 3*B + 4*C <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours. The total labor hours used must not exceed the available labor hours.\n// 8*A + 6*B + 5*C <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the manufacturer must meet this demand.\n// A >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer has 1000 units of raw materials and 800 labor hours available. Each unit of product A requires 5 units of raw materials and 8 labor hours, each unit of product B requires 3 units of raw materials and 6 labor hours, and each unit of product C requires 4 units of raw materials and 5 labor hours. The market demand for product A is at least 50 units, and the manufacturer must meet this demand. Please help the manufacturer to maximize the total profit from producing these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## Available resources\nRaw_Materials = 1000 # available raw materials\nLabor_Hours = 800 # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Constraint on raw materials\nmodel.addCons(5*A + 3*B + 4*C <= Raw_Materials)\n## Constraint on labor hours\nmodel.addCons(8*A + 6*B + 5*C <= Labor_Hours)\n## Market demand for product A\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor\", \"range\": \"labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used daily\": \"machine\", \"range\": \"machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total daily labor hours available are 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The total daily machine hours available are 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day.\n// A >= 20\n// B >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from Product B is $70. The following table summarizes the resource requirements for each product:\n\n| Product | Labor Hours per Unit | Machine Hours per Unit |\n|---------|----------------------|------------------------|\n| A       | 2                    | 1                      |\n| B       | 3                    | 2                      |\n\nThe total daily labor hours available are 120 hours, and the total daily machine hours available are 80 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day. Please help the company to maximize the total daily profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total daily labor hours available are 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The total daily machine hours available are 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor\", \"range\": \"labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used daily\": \"machine\", \"range\": \"machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total daily labor hours available are 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The total daily machine hours available are 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day.\n// A >= 20\n// B >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from Product B is $70. Each unit of Product A requires 2 hours of labor and 1 machine hour, while each unit of Product B requires 3 hours of labor and 2 machine hours. The total daily labor hours available are 120 hours, and the total daily machine hours available are 80 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day. Please help the company to maximize the total daily profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total daily labor hours available are 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The total daily machine hours available are 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 10 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 746,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"A_raw_material\", \"range\": \"A_raw_material >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"B_raw_material\", \"range\": \"B_raw_material >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units. Each unit of Product A requires 5 units of raw material, and each unit of Product B requires 10 units of raw material.\n// A_raw_material = 5*A_units\n// B_raw_material = 10*B_units\n// Constraint: A_raw_material + B_raw_material <= 1000\n\n## Generate Constraint-2:\nThe total amount of labor available is 800 hours. Each unit of Product A requires 4 hours of labor, and each unit of Product B requires 6 hours of labor.\n// A_labor = 4*A_units\n// B_labor = 6*B_units\n// Constraint: A_labor + B_labor <= 800\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product B is at least 40 units.\n// Constraint: A_units >= 50\n// Constraint: B_units >= 40",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit of Product A is $50, and for Product B is $70. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Raw Material per Unit | Labor per Unit |\n|---------|-----------------|-----------------------|----------------|\n| A       | $50             | 5 units               | 4 hours        |\n| B       | $70             | 10 units              | 6 hours        |\n\nThe total amount of raw material available is 1000 units, and the total amount of labor available is 800 hours. The market demand for Product A is at least 50 units, and for Product B is at least 40 units. \n\nPlease help the manufacturer to maximize the total profit from the production of both products, considering the constraints on raw materials, labor, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The amount of raw material and labor used for each product\nA_raw_material = model.addVar(vtype=\"CONTINUOUS\", name=\"A_raw_material\", lb=0) # amount of raw material used for Product A\nB_raw_material = model.addVar(vtype=\"CONTINUOUS\", name=\"B_raw_material\", lb=0) # amount of raw material used for Product B\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # amount of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # amount of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(A_raw_material == 5*A_units)\nmodel.addCons(B_raw_material == 10*B_units)\nmodel.addCons(A_raw_material + B_raw_material <= 1000)\n## The total amount of labor available is 800 hours.\nmodel.addCons(A_labor == 4*A_units)\nmodel.addCons(B_labor == 6*B_units)\nmodel.addCons(A_labor + B_labor <= 800)\n## The market demand for Product A is at least 50 units, and for Product B is at least 40 units.\nmodel.addCons(A_units >= 50)\nmodel.addCons(B_units >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"A_raw_material\", \"range\": \"A_raw_material >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"B_raw_material\", \"range\": \"B_raw_material >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units. Each unit of Product A requires 5 units of raw material, and each unit of Product B requires 10 units of raw material.\n// A_raw_material = 5*A_units\n// B_raw_material = 10*B_units\n// Constraint: A_raw_material + B_raw_material <= 1000\n\n## Generate Constraint-2:\nThe total amount of labor available is 800 hours. Each unit of Product A requires 4 hours of labor, and each unit of Product B requires 6 hours of labor.\n// A_labor = 4*A_units\n// B_labor = 6*B_units\n// Constraint: A_labor + B_labor <= 800\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product B is at least 40 units.\n// Constraint: A_units >= 50\n// Constraint: B_units >= 40",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit of Product A is $50, and for Product B is $70. The total amount of raw material available is 1000 units, with each unit of Product A requiring 5 units of raw material and each unit of Product B requiring 10 units of raw material. The total amount of labor available is 800 hours, with each unit of Product A requiring 4 hours of labor and each unit of Product B requiring 6 hours of labor. The market demand for Product A is at least 50 units, and for Product B is at least 40 units. Please help the manufacturer to maximize the total profit from the production of both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The amount of raw material and labor used for each product\nA_raw_material = model.addVar(vtype=\"CONTINUOUS\", name=\"A_raw_material\", lb=0) # amount of raw material used for Product A\nB_raw_material = model.addVar(vtype=\"CONTINUOUS\", name=\"B_raw_material\", lb=0) # amount of raw material used for Product B\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # amount of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # amount of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(A_raw_material == 5*A_units)\nmodel.addCons(B_raw_material == 10*B_units)\nmodel.addCons(A_raw_material + B_raw_material <= 1000)\n## The total amount of labor available is 800 hours.\nmodel.addCons(A_labor == 4*A_units)\nmodel.addCons(B_labor == 6*B_units)\nmodel.addCons(A_labor + B_labor <= 800)\n## The market demand for Product A is at least 50 units, and for Product B is at least 40 units.\nmodel.addCons(A_units >= 50)\nmodel.addCons(B_units >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | $10          | $12          |\n| B       | $8           | $9           |\n\nThe total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand and staying within the production capacities of both plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production and distribution of three types of bread: wheat, rye, and sourdough. The bakery has two ovens and needs to decide how many hours to operate each oven and how many loaves of each type of bread to produce.\n// {\"hours of operation for Oven 1\": \"Oven1_hours\", \"range\": \"Oven1_hours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for Oven 2\": \"Oven2_hours\", \"range\": \"Oven2_hours >= 0\", \"type\": \"real\"}\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Oven 1 is $10 per hour, and Oven 2 is $15 per hour. The profit from selling wheat, rye, and sourdough bread is $2, $3, and $4 per loaf, respectively. The bakery wants to maximize its profit while considering the operational costs.\n// Operating_Cost = 10 * Oven1_hours + 15 * Oven2_hours\n// Profit = 2 * wheat_loaves + 3 * rye_loaves + 4 * sourdough_loaves\n// Objective Function: Maximize: Profit - Operating_Cost\n\n## Generate Constraint-1:\nEach oven can operate a maximum of 40 hours per week.\n// Oven1_hours <= 40\n// Oven2_hours <= 40\n\n## Generate Constraint-2:\nThe bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 75\n// sourdough_loaves >= 50\n\n## Generate Constraint-3:\nThe production capacity of each oven is limited. Oven 1 can produce up to 50 loaves per hour, and Oven 2 can produce up to 60 loaves per hour.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 50 * Oven1_hours\n// wheat_loaves + rye_loaves + sourdough_loaves <= 60 * Oven2_hours",
        "question": "A bakery wants to optimize its production and distribution of three types of bread: wheat, rye, and sourdough. The bakery has two ovens and needs to decide how many hours to operate each oven and how many loaves of each type of bread to produce. The cost of operating Oven 1 is $10 per hour, and Oven 2 is $15 per hour. The profit from selling wheat, rye, and sourdough bread is $2, $3, and $4 per loaf, respectively. The bakery wants to maximize its profit while considering the operational costs.\n\n| Oven | Cost per Hour | Production Capacity per Hour |\n|------|---------------|-------------------------------|\n| 1    | 10$           | 50 loaves                     |\n| 2    | 15$           | 60 loaves                     |\n\nEach oven can operate a maximum of 40 hours per week. The bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread. The production capacity of each oven is limited. Oven 1 can produce up to 50 loaves per hour, and Oven 2 can produce up to 60 loaves per hour.\n\nPlease help the bakery to maximize its profit by determining the optimal hours of operation for each oven and the number of loaves of each type of bread to produce, considering the operational costs and constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Hours of operation for each oven and number of loaves of each type of bread\nOven1_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven1_hours\", lb=0) # hours of operation for Oven 1\nOven2_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven2_hours\", lb=0) # hours of operation for Oven 2\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Operating_Cost = 10 * Oven1_hours + 15 * Oven2_hours\n## Profit = 2 * wheat_loaves + 3 * rye_loaves + 4 * sourdough_loaves\nmodel.addCons(obj == 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves - 10*Oven1_hours - 15*Oven2_hours)\n\n# Add constraints\n## Each oven can operate a maximum of 40 hours per week.\nmodel.addCons(Oven1_hours <= 40)\nmodel.addCons(Oven2_hours <= 40)\n## The bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 75)\nmodel.addCons(sourdough_loaves >= 50)\n## The production capacity of each oven is limited.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 50 * Oven1_hours)\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 60 * Oven2_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Oven 1: \", model.getVal(Oven1_hours))\n    print(\"Hours of operation for Oven 2: \", model.getVal(Oven2_hours))\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production and distribution of three types of bread: wheat, rye, and sourdough. The bakery has two ovens and needs to decide how many hours to operate each oven and how many loaves of each type of bread to produce.\n// {\"hours of operation for Oven 1\": \"Oven1_hours\", \"range\": \"Oven1_hours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for Oven 2\": \"Oven2_hours\", \"range\": \"Oven2_hours >= 0\", \"type\": \"real\"}\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Oven 1 is $10 per hour, and Oven 2 is $15 per hour. The profit from selling wheat, rye, and sourdough bread is $2, $3, and $4 per loaf, respectively. The bakery wants to maximize its profit while considering the operational costs.\n// Operating_Cost = 10 * Oven1_hours + 15 * Oven2_hours\n// Profit = 2 * wheat_loaves + 3 * rye_loaves + 4 * sourdough_loaves\n// Objective Function: Maximize: Profit - Operating_Cost\n\n## Generate Constraint-1:\nEach oven can operate a maximum of 40 hours per week.\n// Oven1_hours <= 40\n// Oven2_hours <= 40\n\n## Generate Constraint-2:\nThe bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 75\n// sourdough_loaves >= 50\n\n## Generate Constraint-3:\nThe production capacity of each oven is limited. Oven 1 can produce up to 50 loaves per hour, and Oven 2 can produce up to 60 loaves per hour.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 50 * Oven1_hours\n// wheat_loaves + rye_loaves + sourdough_loaves <= 60 * Oven2_hours",
        "question": "A bakery wants to optimize its production and distribution of three types of bread: wheat, rye, and sourdough. The bakery has two ovens and needs to decide how many hours to operate each oven and how many loaves of each type of bread to produce. The cost of operating Oven 1 is $10 per hour, and Oven 2 is $15 per hour. The profit from selling wheat, rye, and sourdough bread is $2, $3, and $4 per loaf, respectively. The bakery wants to maximize its profit while considering the operational costs. Each oven can operate a maximum of 40 hours per week. The bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread. The production capacity of each oven is limited. Oven 1 can produce up to 50 loaves per hour, and Oven 2 can produce up to 60 loaves per hour. Please help the bakery to maximize its profit while considering the operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Hours of operation for each oven and number of loaves of each type of bread\nOven1_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven1_hours\", lb=0) # hours of operation for Oven 1\nOven2_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven2_hours\", lb=0) # hours of operation for Oven 2\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Operating_Cost = 10 * Oven1_hours + 15 * Oven2_hours\n## Profit = 2 * wheat_loaves + 3 * rye_loaves + 4 * sourdough_loaves\nmodel.addCons(obj == 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves - 10*Oven1_hours - 15*Oven2_hours)\n\n# Add constraints\n## Each oven can operate a maximum of 40 hours per week.\nmodel.addCons(Oven1_hours <= 40)\nmodel.addCons(Oven2_hours <= 40)\n## The bakery has a weekly demand for at least 100 loaves of wheat bread, 75 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 75)\nmodel.addCons(sourdough_loaves >= 50)\n## The production capacity of each oven is limited.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 50 * Oven1_hours)\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 60 * Oven2_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Oven 1: \", model.getVal(Oven1_hours))\n    print(\"Hours of operation for Oven 2: \", model.getVal(Oven2_hours))\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"units_A\", \"range\": \"units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"units_B\", \"range\": \"units_B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials in kg\": \"raw_materials\", \"range\": \"raw_materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize the total profit from the production and sale of both products.\n// Objective Function: Maximize: 50*units_A + 70*units_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 5 kg of raw materials, and each unit of Product B requires 10 kg of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*units_A + 10*units_B <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, and each unit of Product B requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*units_A + 4*units_B <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 50 units.\n// units_A >= 100\n// units_B >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit from selling one unit of Product A is $50, and from Product B is $70. The requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Materials per Unit (kg) | Labor Hours per Unit |\n|---------|-----------------|-----------------------------|----------------------|\n| A       | 50$             | 5                           | 3                    |\n| B       | 70$             | 10                          | 4                    |\n\nThe total raw materials used must not exceed the available raw materials, and the total labor hours used must not exceed the available labor hours. The market demand for Product A is at least 100 units, and for Product B is at least 50 units. Please help the company to maximize the total profit from the production and sale of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nunits_A = model.addVar(vtype=\"INTEGER\", name=\"units_A\", lb=0) # number of units of Product A produced\nunits_B = model.addVar(vtype=\"INTEGER\", name=\"units_B\", lb=0) # number of units of Product B produced\n## Available resources\nraw_materials = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_materials\", lb=0) # available raw materials in kg\nlabor_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*units_A + 70*units_B)\n\n# Add constraints\n## Each unit of Product A requires 5 kg of raw materials, and each unit of Product B requires 10 kg of raw materials.\nmodel.addCons(5*units_A + 10*units_B <= raw_materials)\n## Each unit of Product A requires 3 labor hours, and each unit of Product B requires 4 labor hours.\nmodel.addCons(3*units_A + 4*units_B <= labor_hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 50 units.\nmodel.addCons(units_A >= 100)\nmodel.addCons(units_B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(units_A))\n    print(\"Number of units of Product B produced: \", model.getVal(units_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"units_A\", \"range\": \"units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"units_B\", \"range\": \"units_B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials in kg\": \"raw_materials\", \"range\": \"raw_materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize the total profit from the production and sale of both products.\n// Objective Function: Maximize: 50*units_A + 70*units_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 5 kg of raw materials, and each unit of Product B requires 10 kg of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*units_A + 10*units_B <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, and each unit of Product B requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*units_A + 4*units_B <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 50 units.\n// units_A >= 100\n// units_B >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit from selling one unit of Product A is $50, and from Product B is $70. Each unit of Product A requires 5 kg of raw materials and 3 labor hours, while each unit of Product B requires 10 kg of raw materials and 4 labor hours. The total raw materials used must not exceed the available raw materials, and the total labor hours used must not exceed the available labor hours. The market demand for Product A is at least 100 units, and for Product B is at least 50 units. Please help the company to maximize the total profit from the production and sale of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nunits_A = model.addVar(vtype=\"INTEGER\", name=\"units_A\", lb=0) # number of units of Product A produced\nunits_B = model.addVar(vtype=\"INTEGER\", name=\"units_B\", lb=0) # number of units of Product B produced\n## Available resources\nraw_materials = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_materials\", lb=0) # available raw materials in kg\nlabor_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*units_A + 70*units_B)\n\n# Add constraints\n## Each unit of Product A requires 5 kg of raw materials, and each unit of Product B requires 10 kg of raw materials.\nmodel.addCons(5*units_A + 10*units_B <= raw_materials)\n## Each unit of Product A requires 3 labor hours, and each unit of Product B requires 4 labor hours.\nmodel.addCons(3*units_A + 4*units_B <= labor_hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 50 units.\nmodel.addCons(units_A >= 100)\nmodel.addCons(units_B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(units_A))\n    print(\"Number of units of Product B produced: \", model.getVal(units_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"prod_C\", \"range\": \"prod_C >= 0\", \"type\": \"integer\"}\n// {\"resource X used for production\": \"resource_X\", \"range\": \"resource_X >= 0\", \"type\": \"real\"}\n// {\"resource Y used for production\": \"resource_Y\", \"range\": \"resource_Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*prod_A + 70*prod_B + 60*prod_C\n\n## Generate Constraint-1:\nThe total amount of resource X available for production is 500 units. Each unit of product A requires 2 units of resource X, product B requires 3 units, and product C requires 4 units.\n// 2*prod_A + 3*prod_B + 4*prod_C <= 500\n\n## Generate Constraint-2:\nThe total amount of resource Y available for production is 600 units. Each unit of product A requires 1 unit of resource Y, product B requires 2 units, and product C requires 3 units.\n// prod_A + 2*prod_B + 3*prod_C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C.\n// prod_A >= 10\n// prod_B >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the resource requirements for each product:\n\n| Product | Resource X per Unit | Resource Y per Unit |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 1 unit              |\n| B       | 3 units             | 2 units             |\n| C       | 4 units             | 3 units             |\n\nThe total amount of resource X available for production is 500 units, and the total amount of resource Y available for production is 600 units. The market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of product B\nprod_C = model.addVar(vtype=\"INTEGER\", name=\"prod_C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*prod_A + 70*prod_B + 60*prod_C)\n\n# Add constraints\n## The total amount of resource X available for production is 500 units.\nmodel.addCons(2*prod_A + 3*prod_B + 4*prod_C <= 500)\n## The total amount of resource Y available for production is 600 units.\nmodel.addCons(prod_A + 2*prod_B + 3*prod_C <= 600)\n## The market demand for product A is at least 10 units, and for product B is at least 20 units.\nmodel.addCons(prod_A >= 10)\nmodel.addCons(prod_B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(prod_A))\n    print(\"Production quantity of product B: \", model.getVal(prod_B))\n    print(\"Production quantity of product C: \", model.getVal(prod_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"prod_C\", \"range\": \"prod_C >= 0\", \"type\": \"integer\"}\n// {\"resource X used for production\": \"resource_X\", \"range\": \"resource_X >= 0\", \"type\": \"real\"}\n// {\"resource Y used for production\": \"resource_Y\", \"range\": \"resource_Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*prod_A + 70*prod_B + 60*prod_C\n\n## Generate Constraint-1:\nThe total amount of resource X available for production is 500 units. Each unit of product A requires 2 units of resource X, product B requires 3 units, and product C requires 4 units.\n// 2*prod_A + 3*prod_B + 4*prod_C <= 500\n\n## Generate Constraint-2:\nThe total amount of resource Y available for production is 600 units. Each unit of product A requires 1 unit of resource Y, product B requires 2 units, and product C requires 3 units.\n// prod_A + 2*prod_B + 3*prod_C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C.\n// prod_A >= 10\n// prod_B >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total amount of resource X available for production is 500 units, with each unit of product A requiring 2 units of resource X, product B requiring 3 units, and product C requiring 4 units. The total amount of resource Y available for production is 600 units, with each unit of product A requiring 1 unit of resource Y, product B requiring 2 units, and product C requiring 3 units. The market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of product B\nprod_C = model.addVar(vtype=\"INTEGER\", name=\"prod_C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*prod_A + 70*prod_B + 60*prod_C)\n\n# Add constraints\n## The total amount of resource X available for production is 500 units.\nmodel.addCons(2*prod_A + 3*prod_B + 4*prod_C <= 500)\n## The total amount of resource Y available for production is 600 units.\nmodel.addCons(prod_A + 2*prod_B + 3*prod_C <= 600)\n## The market demand for product A is at least 10 units, and for product B is at least 20 units.\nmodel.addCons(prod_A >= 10)\nmodel.addCons(prod_B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(prod_A))\n    print(\"Production quantity of product B: \", model.getVal(prod_B))\n    print(\"Production quantity of product C: \", model.getVal(prod_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B.\n\n| Material/Product | Cost per Unit | Required for Product A | Required for Product B |\n|------------------|---------------|-------------------------|-------------------------|\n| Material X       | $10           | 2 units                 | 1 unit                  |\n| Material Y       | $15           | 1 unit                  | 3 units                 |\n\nThe total amount of Material X available for purchase is limited to 300 units. The total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units.\n\nPlease help the manufacturer to minimize the total cost of raw materials and production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The total amount of Material X available for purchase is limited to 300 units, and the total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units. Please help the manufacturer to minimize the total cost of raw materials and production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is limited by the availability of three raw materials: Material X, Material Y, and Material Z. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the constraints on raw material availability.\n// {\"number of units of Product A\": \"units_A\", \"range\": \"units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"units_B\", \"range\": \"units_B >= 0\", \"type\": \"integer\"}\n// {\"availability of Material X\": \"avail_X\", \"range\": \"avail_X >= 0\", \"type\": \"real\"}\n// {\"availability of Material Y\": \"avail_Y\", \"range\": \"avail_Y >= 0\", \"type\": \"real\"}\n// {\"availability of Material Z\": \"avail_Z\", \"range\": \"avail_Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*units_A + 70*units_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y. Each unit of Product B requires 4 units of Material X, 2 units of Material Y, and 1 unit of Material Z. The total usage of each material must not exceed its availability.\n// 2*units_A + 4*units_B <= avail_X\n// 3*units_A + 2*units_B <= avail_Y\n// units_B <= avail_Z\n\n## Generate Constraint-2:\nThe production of Product A must not exceed 100 units per week.\n// units_A <= 100\n\n## Generate Constraint-3:\nThe total production of both products must not exceed the combined capacity of 150 units per week.\n// units_A + units_B <= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is limited by the availability of three raw materials: Material X, Material Y, and Material Z. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the constraints on raw material availability. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The following table summarizes the requirements of each product in terms of raw materials:\n\n| Product | Material X | Material Y | Material Z | Profit per Unit |\n|---------|------------|------------|------------|-----------------|\n| A       | 2 units    | 3 units    | 0 units    | $50             |\n| B       | 4 units    | 2 units    | 1 unit     | $70             |\n\nThe constraints are as follows:\n1. The total usage of Material X must not exceed its availability.\n2. The total usage of Material Y must not exceed its availability.\n3. The usage of Material Z for Product B must not exceed its availability.\n4. The production of Product A must not exceed 100 units per week.\n5. The total production of both products must not exceed the combined capacity of 150 units per week.\n\nPlease help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nunits_A = model.addVar(vtype=\"INTEGER\", name=\"units_A\", lb=0) # number of units of Product A\nunits_B = model.addVar(vtype=\"INTEGER\", name=\"units_B\", lb=0) # number of units of Product B\n## The availability of each material\navail_X = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_X\", lb=0) # availability of Material X\navail_Y = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_Y\", lb=0) # availability of Material Y\navail_Z = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_Z\", lb=0) # availability of Material Z\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*units_A + 70*units_B)\n\n# Add constraints\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\n## Each unit of Product B requires 4 units of Material X, 2 units of Material Y, and 1 unit of Material Z.\n## The total usage of each material must not exceed its availability.\nmodel.addCons(2*units_A + 4*units_B <= avail_X)\nmodel.addCons(3*units_A + 2*units_B <= avail_Y)\nmodel.addCons(units_B <= avail_Z)\n## The production of Product A must not exceed 100 units per week.\nmodel.addCons(units_A <= 100)\n## The total production of both products must not exceed the combined capacity of 150 units per week.\nmodel.addCons(units_A + units_B <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(units_A))\n    print(\"Number of units of Product B: \", model.getVal(units_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is limited by the availability of three raw materials: Material X, Material Y, and Material Z. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the constraints on raw material availability.\n// {\"number of units of Product A\": \"units_A\", \"range\": \"units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"units_B\", \"range\": \"units_B >= 0\", \"type\": \"integer\"}\n// {\"availability of Material X\": \"avail_X\", \"range\": \"avail_X >= 0\", \"type\": \"real\"}\n// {\"availability of Material Y\": \"avail_Y\", \"range\": \"avail_Y >= 0\", \"type\": \"real\"}\n// {\"availability of Material Z\": \"avail_Z\", \"range\": \"avail_Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*units_A + 70*units_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y. Each unit of Product B requires 4 units of Material X, 2 units of Material Y, and 1 unit of Material Z. The total usage of each material must not exceed its availability.\n// 2*units_A + 4*units_B <= avail_X\n// 3*units_A + 2*units_B <= avail_Y\n// units_B <= avail_Z\n\n## Generate Constraint-2:\nThe production of Product A must not exceed 100 units per week.\n// units_A <= 100\n\n## Generate Constraint-3:\nThe total production of both products must not exceed the combined capacity of 150 units per week.\n// units_A + units_B <= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is limited by the availability of three raw materials: Material X, Material Y, and Material Z. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y. Each unit of Product B requires 4 units of Material X, 2 units of Material Y, and 1 unit of Material Z. The total usage of each material must not exceed its availability. The production of Product A must not exceed 100 units per week. The total production of both products must not exceed the combined capacity of 150 units per week.\nPlease help the manufacturer decide how many units of each product to produce to maximize profit while considering the constraints on raw material availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nunits_A = model.addVar(vtype=\"INTEGER\", name=\"units_A\", lb=0) # number of units of Product A\nunits_B = model.addVar(vtype=\"INTEGER\", name=\"units_B\", lb=0) # number of units of Product B\n## The availability of each material\navail_X = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_X\", lb=0) # availability of Material X\navail_Y = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_Y\", lb=0) # availability of Material Y\navail_Z = model.addVar(vtype=\"CONTINUOUS\", name=\"avail_Z\", lb=0) # availability of Material Z\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*units_A + 70*units_B)\n\n# Add constraints\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\n## Each unit of Product B requires 4 units of Material X, 2 units of Material Y, and 1 unit of Material Z.\n## The total usage of each material must not exceed its availability.\nmodel.addCons(2*units_A + 4*units_B <= avail_X)\nmodel.addCons(3*units_A + 2*units_B <= avail_Y)\nmodel.addCons(units_B <= avail_Z)\n## The production of Product A must not exceed 100 units per week.\nmodel.addCons(units_A <= 100)\n## The total production of both products must not exceed the combined capacity of 150 units per week.\nmodel.addCons(units_A + units_B <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(units_A))\n    print(\"Number of units of Product B: \", model.getVal(units_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n\nThe total time available for Assembly is 100 hours, for Quality Check is 80 hours, and for Packaging is 60 hours. Please help the manufacturer determine the optimal number of units of each product to produce and the allocation of time across the three stages to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the time spent on each stage\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n\n# Additional constraints for time allocation per unit\nmodel.addCons(A_Assembly == 2*A_units) # assuming 2 hours per unit for Assembly of Product A\nmodel.addCons(B_Assembly == 3*B_units) # assuming 3 hours per unit for Assembly of Product B\nmodel.addCons(A_Quality == 1*A_units) # assuming 1 hour per unit for Quality Check of Product A\nmodel.addCons(B_Quality == 1*B_units) # assuming 1 hour per unit for Quality Check of Product B\nmodel.addCons(A_Packaging == 1*A_units) # assuming 1 hour per unit for Packaging of Product A\nmodel.addCons(B_Packaging == 1*B_units) # assuming 1 hour per unit for Packaging of Product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products. The total time available for Assembly is 100 hours, for Quality Check is 80 hours, and for Packaging is 60 hours. Please help the manufacturer determine the optimal number of units of each product to produce and the allocation of time across the three stages to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the time spent on each stage\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n\n# Additional constraints for time allocation per unit\nmodel.addCons(A_Assembly == 2*A_units) # assuming 2 hours per unit for Assembly of Product A\nmodel.addCons(B_Assembly == 3*B_units) # assuming 3 hours per unit for Assembly of Product B\nmodel.addCons(A_Quality == 1*A_units) # assuming 1 hour per unit for Quality Check of Product A\nmodel.addCons(B_Quality == 1*B_units) # assuming 1 hour per unit for Quality Check of Product B\nmodel.addCons(A_Packaging == 1*A_units) # assuming 1 hour per unit for Packaging of Product A\nmodel.addCons(B_Packaging == 1*B_units) # assuming 1 hour per unit for Packaging of Product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 736,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products.\n// Profit_A = (50 - 30) * A = 20 * A\n// Profit_B = (70 - 40) * B = 30 * B\n// Profit_C = (60 - 35) * C = 25 * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 60 units per week.\n// B >= 60",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand. The selling price and production cost for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| A       | $50           | $30             |\n| B       | $70           | $40             |\n| C       | $60           | $35             |\n\nThe total production capacity is limited to 200 units per week. The market demand for product A is at least 50 units per week. The market demand for product B is at least 60 units per week. \nPlease help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The total production capacity is limited to 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 60 units per week.\nmodel.addCons(B >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products.\n// Profit_A = (50 - 30) * A = 20 * A\n// Profit_B = (70 - 40) * B = 30 * B\n// Profit_C = (60 - 35) * C = 25 * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 60 units per week.\n// B >= 60",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products. The total production capacity is limited to 200 units per week. The market demand for product A is at least 50 units per week. The market demand for product B is at least 60 units per week. Please help the manufacturer decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The total production capacity is limited to 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 60 units per week.\nmodel.addCons(B >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3.\n// {\"whether to operate factory in Chicago\": \"open_CHI\", \"range\": \"open_CHI = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to operate factory in Denver\": \"open_DEN\", \"range\": \"open_DEN = 0 or 1\", \"type\": \"binary\"}\n// {\"number of Product A units produced in Chicago\": \"CHI_A\", \"range\": \"CHI_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"DEN_A\", \"range\": \"DEN_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"CHI_B\", \"range\": \"CHI_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"DEN_B\", \"range\": \"DEN_B >= 0\", \"type\": \"integer\"}\n// The factories can't produce anything unless they are operational:\n// CHI_A + CHI_B == open_CHI * (CHI_A + CHI_B)\n// DEN_A + DEN_B == open_DEN * (DEN_A + DEN_B)\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. The goal is to minimize the total production and operational costs while meeting the market demands.\n// Operational_Cost = 600*open_CHI + 500*open_DEN\n// CHI_Production_Cost = 30*CHI_A + 40*CHI_B\n// DEN_Production_Cost = 25*DEN_A + 35*DEN_B\n// Objective Function: Minimize: Operational_Cost + CHI_Production_Cost + DEN_Production_Cost\n\n## Generate Constraint-1:\nEach factory has a production capacity of 200 units per week.\n// CHI_A + CHI_B <= 200\n// DEN_A + DEN_B <= 200\n\n## Generate Constraint-2:\nMarket 1 requires 100 units of Product A and 50 units of Product B per week.\n// CHI_A + DEN_A >= 100\n// CHI_B + DEN_B >= 50\n\n## Generate Constraint-3:\nMarket 2 requires 80 units of Product A and 70 units of Product B per week.\n// CHI_A + DEN_A >= 80\n// CHI_B + DEN_B >= 70",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver.\n\n| Factory | Product A Cost | Product B Cost | Fixed Operational Cost |\n|---------|----------------|----------------|------------------------|\n| Chicago | 30$            | 40$            | 600$                   |\n| Denver  | 25$            | 35$            | 500$                   |\n\nEach factory has a production capacity of 200 units per week. Market 1 requires 100 units of Product A and 50 units of Product B per week. Market 2 requires 80 units of Product A and 70 units of Product B per week. The factories can't produce anything unless they are operational.\n\nPlease help the manufacturer to minimize the total production and operational costs while meeting the market demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to operate factory in Chicago and Denver\nopen_CHI = model.addVar(vtype=\"B\", name=\"open_CHI\") # whether to operate factory in Chicago\nopen_DEN = model.addVar(vtype=\"B\", name=\"open_DEN\") # whether to operate factory in Denver\n## Number of Product A and B units produced in Chicago and Denver\nCHI_A = model.addVar(vtype=\"INTEGER\", name=\"CHI_A\", lb=0) # number of Product A units produced in Chicago\nCHI_B = model.addVar(vtype=\"INTEGER\", name=\"CHI_B\", lb=0) # number of Product B units produced in Chicago\nDEN_A = model.addVar(vtype=\"INTEGER\", name=\"DEN_A\", lb=0) # number of Product A units produced in Denver\nDEN_B = model.addVar(vtype=\"INTEGER\", name=\"DEN_B\", lb=0) # number of Product B units produced in Denver\n\n# The factories can't produce anything unless they are operational\nmodel.addCons(CHI_A + CHI_B <= open_CHI * (CHI_A + CHI_B))\nmodel.addCons(DEN_A + DEN_B <= open_DEN * (DEN_A + DEN_B))\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Operational_Cost = 600*open_CHI + 500*open_DEN\nOperational_Cost = 600*open_CHI + 500*open_DEN\n## CHI_Production_Cost = 30*CHI_A + 40*CHI_B\nCHI_Production_Cost = 30*CHI_A + 40*CHI_B\n## DEN_Production_Cost = 25*DEN_A + 35*DEN_B\nDEN_Production_Cost = 25*DEN_A + 35*DEN_B\nmodel.addCons(obj == Operational_Cost + CHI_Production_Cost + DEN_Production_Cost)\n\n# Add constraints\n## Each factory has a production capacity of 200 units per week.\nmodel.addCons(CHI_A + CHI_B <= 200)\nmodel.addCons(DEN_A + DEN_B <= 200)\n## Market 1 requires 100 units of Product A and 50 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 100)\nmodel.addCons(CHI_B + DEN_B >= 50)\n## Market 2 requires 80 units of Product A and 70 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 80)\nmodel.addCons(CHI_B + DEN_B >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to operate factory in Chicago: \", model.getVal(open_CHI))\n    print(\"Whether to operate factory in Denver: \", model.getVal(open_DEN))\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(CHI_A))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(DEN_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(CHI_B))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(DEN_B))\n    print(\"Minimized Total Production and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3.\n// {\"whether to operate factory in Chicago\": \"open_CHI\", \"range\": \"open_CHI = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to operate factory in Denver\": \"open_DEN\", \"range\": \"open_DEN = 0 or 1\", \"type\": \"binary\"}\n// {\"number of Product A units produced in Chicago\": \"CHI_A\", \"range\": \"CHI_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"DEN_A\", \"range\": \"DEN_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"CHI_B\", \"range\": \"CHI_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"DEN_B\", \"range\": \"DEN_B >= 0\", \"type\": \"integer\"}\n// The factories can't produce anything unless they are operational:\n// CHI_A + CHI_B == open_CHI * (CHI_A + CHI_B)\n// DEN_A + DEN_B == open_DEN * (DEN_A + DEN_B)\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. The goal is to minimize the total production and operational costs while meeting the market demands.\n// Operational_Cost = 600*open_CHI + 500*open_DEN\n// CHI_Production_Cost = 30*CHI_A + 40*CHI_B\n// DEN_Production_Cost = 25*DEN_A + 35*DEN_B\n// Objective Function: Minimize: Operational_Cost + CHI_Production_Cost + DEN_Production_Cost\n\n## Generate Constraint-1:\nEach factory has a production capacity of 200 units per week.\n// CHI_A + CHI_B <= 200\n// DEN_A + DEN_B <= 200\n\n## Generate Constraint-2:\nMarket 1 requires 100 units of Product A and 50 units of Product B per week.\n// CHI_A + DEN_A >= 100\n// CHI_B + DEN_B >= 50\n\n## Generate Constraint-3:\nMarket 2 requires 80 units of Product A and 70 units of Product B per week.\n// CHI_A + DEN_A >= 80\n// CHI_B + DEN_B >= 70",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. Each factory has a production capacity of 200 units per week. Market 1 requires 100 units of Product A and 50 units of Product B per week. Market 2 requires 80 units of Product A and 70 units of Product B per week. The factories can't produce anything unless they are operational. The goal is to minimize the total production and operational costs while meeting the market demands. Please help the manufacturer determine the optimal production and operational strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to operate factory in Chicago and Denver\nopen_CHI = model.addVar(vtype=\"B\", name=\"open_CHI\") # whether to operate factory in Chicago\nopen_DEN = model.addVar(vtype=\"B\", name=\"open_DEN\") # whether to operate factory in Denver\n## Number of Product A and B units produced in Chicago and Denver\nCHI_A = model.addVar(vtype=\"INTEGER\", name=\"CHI_A\", lb=0) # number of Product A units produced in Chicago\nCHI_B = model.addVar(vtype=\"INTEGER\", name=\"CHI_B\", lb=0) # number of Product B units produced in Chicago\nDEN_A = model.addVar(vtype=\"INTEGER\", name=\"DEN_A\", lb=0) # number of Product A units produced in Denver\nDEN_B = model.addVar(vtype=\"INTEGER\", name=\"DEN_B\", lb=0) # number of Product B units produced in Denver\n\n# The factories can't produce anything unless they are operational\nmodel.addCons(CHI_A + CHI_B <= open_CHI * (CHI_A + CHI_B))\nmodel.addCons(DEN_A + DEN_B <= open_DEN * (DEN_A + DEN_B))\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Operational_Cost = 600*open_CHI + 500*open_DEN\nOperational_Cost = 600*open_CHI + 500*open_DEN\n## CHI_Production_Cost = 30*CHI_A + 40*CHI_B\nCHI_Production_Cost = 30*CHI_A + 40*CHI_B\n## DEN_Production_Cost = 25*DEN_A + 35*DEN_B\nDEN_Production_Cost = 25*DEN_A + 35*DEN_B\nmodel.addCons(obj == Operational_Cost + CHI_Production_Cost + DEN_Production_Cost)\n\n# Add constraints\n## Each factory has a production capacity of 200 units per week.\nmodel.addCons(CHI_A + CHI_B <= 200)\nmodel.addCons(DEN_A + DEN_B <= 200)\n## Market 1 requires 100 units of Product A and 50 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 100)\nmodel.addCons(CHI_B + DEN_B >= 50)\n## Market 2 requires 80 units of Product A and 70 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 80)\nmodel.addCons(CHI_B + DEN_B >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to operate factory in Chicago: \", model.getVal(open_CHI))\n    print(\"Whether to operate factory in Denver: \", model.getVal(open_DEN))\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(CHI_A))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(DEN_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(CHI_B))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(DEN_B))\n    print(\"Minimized Total Production and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A produced\": \"A_produced\", \"range\": \"A_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_produced\", \"range\": \"B_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs.\n// Production_Cost_A = 10 * A_produced\n// Production_Cost_B = 15 * B_produced\n// Shipping_Cost_A_M1 = 5 * A_M1\n// Shipping_Cost_A_M2 = 6 * A_M2\n// Shipping_Cost_A_M3 = 7 * A_M3\n// Shipping_Cost_B_M1 = 8 * B_M1\n// Shipping_Cost_B_M2 = 7 * B_M2\n// Shipping_Cost_B_M3 = 9 * B_M3\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\n// A_produced + B_produced <= 200\n\n## Generate Constraint-2:\nMarket 1 requires at least 50 units of Product A and 40 units of Product B per week.\n// A_M1 >= 50\n// B_M1 >= 40\n\n## Generate Constraint-3:\nMarket 2 requires at least 60 units of Product A and 50 units of Product B per week.\n// A_M2 >= 60\n// B_M2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3. The cost of producing and shipping each product to each market is given in the following Table.\n\n| Product | Production Cost | Market 1 Shipping Cost | Market 2 Shipping Cost | Market 3 Shipping Cost |\n|---------|-----------------|------------------------|------------------------|------------------------|\n| A       | $10             | $5                     | $6                     | $7                     |\n| B       | $15             | $8                     | $7                     | $9                     |\n\nThe company aims to minimize the total production and shipping costs. The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week. Market 1 requires at least 50 units of Product A and 40 units of Product B per week. Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\n\nPlease help the company determine the optimal number of units of Product A and Product B to produce and their distribution to the three markets to minimize the total production and shipping costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and shipped to each market\nA_produced = model.addVar(vtype=\"INTEGER\", name=\"A_produced\", lb=0) # number of units of Product A produced\nB_produced = model.addVar(vtype=\"INTEGER\", name=\"B_produced\", lb=0) # number of units of Product B produced\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A shipped to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A shipped to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A shipped to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B shipped to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B shipped to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B shipped to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production and shipping costs\nProduction_Cost_A = 10 * A_produced\nProduction_Cost_B = 15 * B_produced\nShipping_Cost_A_M1 = 5 * A_M1\nShipping_Cost_A_M2 = 6 * A_M2\nShipping_Cost_A_M3 = 7 * A_M3\nShipping_Cost_B_M1 = 8 * B_M1\nShipping_Cost_B_M2 = 7 * B_M2\nShipping_Cost_B_M3 = 9 * B_M3\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\nmodel.addCons(A_produced + B_produced <= 200)\n## Market 1 requires at least 50 units of Product A and 40 units of Product B per week.\nmodel.addCons(A_M1 >= 50)\nmodel.addCons(B_M1 >= 40)\n## Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\nmodel.addCons(A_M2 >= 60)\nmodel.addCons(B_M2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_produced))\n    print(\"Number of units of Product B produced: \", model.getVal(B_produced))\n    print(\"Number of units of Product A shipped to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A shipped to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A shipped to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B shipped to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B shipped to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B shipped to Market 3: \", model.getVal(B_M3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A produced\": \"A_produced\", \"range\": \"A_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_produced\", \"range\": \"B_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs.\n// Production_Cost_A = 10 * A_produced\n// Production_Cost_B = 15 * B_produced\n// Shipping_Cost_A_M1 = 5 * A_M1\n// Shipping_Cost_A_M2 = 6 * A_M2\n// Shipping_Cost_A_M3 = 7 * A_M3\n// Shipping_Cost_B_M1 = 8 * B_M1\n// Shipping_Cost_B_M2 = 7 * B_M2\n// Shipping_Cost_B_M3 = 9 * B_M3\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\n// A_produced + B_produced <= 200\n\n## Generate Constraint-2:\nMarket 1 requires at least 50 units of Product A and 40 units of Product B per week.\n// A_M1 >= 50\n// B_M1 >= 40\n\n## Generate Constraint-3:\nMarket 2 requires at least 60 units of Product A and 50 units of Product B per week.\n// A_M2 >= 60\n// B_M2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\nThe cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs.\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units per week. Market 1 requires at least 50 units of Product A and 40 units of Product B per week. Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\nPlease help the company to determine the optimal number of units of Product A and Product B to produce and their distribution to minimize the total production and shipping costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and shipped to each market\nA_produced = model.addVar(vtype=\"INTEGER\", name=\"A_produced\", lb=0) # number of units of Product A produced\nB_produced = model.addVar(vtype=\"INTEGER\", name=\"B_produced\", lb=0) # number of units of Product B produced\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A shipped to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A shipped to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A shipped to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B shipped to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B shipped to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B shipped to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production and shipping costs\nProduction_Cost_A = 10 * A_produced\nProduction_Cost_B = 15 * B_produced\nShipping_Cost_A_M1 = 5 * A_M1\nShipping_Cost_A_M2 = 6 * A_M2\nShipping_Cost_A_M3 = 7 * A_M3\nShipping_Cost_B_M1 = 8 * B_M1\nShipping_Cost_B_M2 = 7 * B_M2\nShipping_Cost_B_M3 = 9 * B_M3\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\nmodel.addCons(A_produced + B_produced <= 200)\n## Market 1 requires at least 50 units of Product A and 40 units of Product B per week.\nmodel.addCons(A_M1 >= 50)\nmodel.addCons(B_M1 >= 40)\n## Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\nmodel.addCons(A_M2 >= 60)\nmodel.addCons(B_M2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_produced))\n    print(\"Number of units of Product B produced: \", model.getVal(B_produced))\n    print(\"Number of units of Product A shipped to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A shipped to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A shipped to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B shipped to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B shipped to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B shipped to Market 3: \", model.getVal(B_M3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company has three production lines: Line 1, Line 2, and Line 3. The company needs to decide how many units of each product to produce on each line to maximize profit while considering the production capacity and demand constraints.\n// {\"number of Product A units produced on Line 1\": \"A_L1\", \"range\": \"A_L1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced on Line 2\": \"A_L2\", \"range\": \"A_L2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced on Line 3\": \"A_L3\", \"range\": \"A_L3 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 1\": \"B_L1\", \"range\": \"B_L1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 2\": \"B_L2\", \"range\": \"B_L2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 3\": \"B_L3\", \"range\": \"B_L3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and Product B is $70 per unit. The company aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*(A_L1 + A_L2 + A_L3) + 70*(B_L1 + B_L2 + B_L3)\n\n## Generate Constraint-1:\nEach production line has a maximum capacity of 100 units per day.\n// A_L1 + B_L1 <= 100\n// A_L2 + B_L2 <= 100\n// A_L3 + B_L3 <= 100\n\n## Generate Constraint-2:\nThe total demand for Product A is 200 units per day, and for Product B is 150 units per day.\n// A_L1 + A_L2 + A_L3 >= 200\n// B_L1 + B_L2 + B_L3 >= 150\n\n## Generate Constraint-3:\nDue to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B.\n// B_L1 == 0\n// A_L3 == 0",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company has three production lines: Line 1, Line 2, and Line 3. The company needs to decide how many units of each product to produce on each line to maximize profit while considering the production capacity and demand constraints. The profit from selling Product A is $50 per unit, and Product B is $70 per unit.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n\nEach production line has a maximum capacity of 100 units per day. The total demand for Product A is 200 units per day, and for Product B is 150 units per day. Due to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B.\n\nPlease help the company to maximize the total profit from the production of both products, considering the following constraints:\n- The number of Product A units produced on Line 1, Line 2, and Line 3 are A_L1, A_L2, and A_L3 respectively, all of which must be non-negative integers.\n- The number of Product B units produced on Line 1, Line 2, and Line 3 are B_L1, B_L2, and B_L3 respectively, all of which must be non-negative integers.\n- A_L1 + B_L1 <= 100, A_L2 + B_L2 <= 100, A_L3 + B_L3 <= 100 (production line capacity constraints).\n- A_L1 + A_L2 + A_L3 >= 200, B_L1 + B_L2 + B_L3 >= 150 (demand constraints).\n- B_L1 == 0 (Line 1 can only produce Product A), A_L3 == 0 (Line 3 can only produce Product B).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced on each line\nA_L1 = model.addVar(vtype=\"INTEGER\", name=\"A_L1\", lb=0) # number of Product A units produced on Line 1\nA_L2 = model.addVar(vtype=\"INTEGER\", name=\"A_L2\", lb=0) # number of Product A units produced on Line 2\nA_L3 = model.addVar(vtype=\"INTEGER\", name=\"A_L3\", lb=0) # number of Product A units produced on Line 3\nB_L1 = model.addVar(vtype=\"INTEGER\", name=\"B_L1\", lb=0) # number of Product B units produced on Line 1\nB_L2 = model.addVar(vtype=\"INTEGER\", name=\"B_L2\", lb=0) # number of Product B units produced on Line 2\nB_L3 = model.addVar(vtype=\"INTEGER\", name=\"B_L3\", lb=0) # number of Product B units produced on Line 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_L1 + A_L2 + A_L3) + 70*(B_L1 + B_L2 + B_L3))\n\n# Add constraints\n## Each production line has a maximum capacity of 100 units per day.\nmodel.addCons(A_L1 + B_L1 <= 100)\nmodel.addCons(A_L2 + B_L2 <= 100)\nmodel.addCons(A_L3 + B_L3 <= 100)\n## The total demand for Product A is 200 units per day, and for Product B is 150 units per day.\nmodel.addCons(A_L1 + A_L2 + A_L3 >= 200)\nmodel.addCons(B_L1 + B_L2 + B_L3 >= 150)\n## Due to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B.\nmodel.addCons(B_L1 == 0)\nmodel.addCons(A_L3 == 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced on Line 1: \", model.getVal(A_L1))\n    print(\"Number of Product A units produced on Line 2: \", model.getVal(A_L2))\n    print(\"Number of Product A units produced on Line 3: \", model.getVal(A_L3))\n    print(\"Number of Product B units produced on Line 1: \", model.getVal(B_L1))\n    print(\"Number of Product B units produced on Line 2: \", model.getVal(B_L2))\n    print(\"Number of Product B units produced on Line 3: \", model.getVal(B_L3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1487,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company has three production lines: Line 1, Line 2, and Line 3. The company needs to decide how many units of each product to produce on each line to maximize profit while considering the production capacity and demand constraints.\n// {\"number of Product A units produced on Line 1\": \"A_L1\", \"range\": \"A_L1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced on Line 2\": \"A_L2\", \"range\": \"A_L2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced on Line 3\": \"A_L3\", \"range\": \"A_L3 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 1\": \"B_L1\", \"range\": \"B_L1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 2\": \"B_L2\", \"range\": \"B_L2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced on Line 3\": \"B_L3\", \"range\": \"B_L3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and Product B is $70 per unit. The company aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*(A_L1 + A_L2 + A_L3) + 70*(B_L1 + B_L2 + B_L3)\n\n## Generate Constraint-1:\nEach production line has a maximum capacity of 100 units per day.\n// A_L1 + B_L1 <= 100\n// A_L2 + B_L2 <= 100\n// A_L3 + B_L3 <= 100\n\n## Generate Constraint-2:\nThe total demand for Product A is 200 units per day, and for Product B is 150 units per day.\n// A_L1 + A_L2 + A_L3 >= 200\n// B_L1 + B_L2 + B_L3 >= 150\n\n## Generate Constraint-3:\nDue to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B.\n// B_L1 == 0\n// A_L3 == 0",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company has three production lines: Line 1, Line 2, and Line 3. The company needs to decide how many units of each product to produce on each line to maximize profit while considering the production capacity and demand constraints. The profit from selling Product A is $50 per unit, and Product B is $70 per unit. Each production line has a maximum capacity of 100 units per day. The total demand for Product A is 200 units per day, and for Product B is 150 units per day. Due to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B. Please help the company to maximize the total profit from the production of both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced on each line\nA_L1 = model.addVar(vtype=\"INTEGER\", name=\"A_L1\", lb=0) # number of Product A units produced on Line 1\nA_L2 = model.addVar(vtype=\"INTEGER\", name=\"A_L2\", lb=0) # number of Product A units produced on Line 2\nA_L3 = model.addVar(vtype=\"INTEGER\", name=\"A_L3\", lb=0) # number of Product A units produced on Line 3\nB_L1 = model.addVar(vtype=\"INTEGER\", name=\"B_L1\", lb=0) # number of Product B units produced on Line 1\nB_L2 = model.addVar(vtype=\"INTEGER\", name=\"B_L2\", lb=0) # number of Product B units produced on Line 2\nB_L3 = model.addVar(vtype=\"INTEGER\", name=\"B_L3\", lb=0) # number of Product B units produced on Line 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_L1 + A_L2 + A_L3) + 70*(B_L1 + B_L2 + B_L3))\n\n# Add constraints\n## Each production line has a maximum capacity of 100 units per day.\nmodel.addCons(A_L1 + B_L1 <= 100)\nmodel.addCons(A_L2 + B_L2 <= 100)\nmodel.addCons(A_L3 + B_L3 <= 100)\n## The total demand for Product A is 200 units per day, and for Product B is 150 units per day.\nmodel.addCons(A_L1 + A_L2 + A_L3 >= 200)\nmodel.addCons(B_L1 + B_L2 + B_L3 >= 150)\n## Due to specialized machinery, Line 1 can only produce Product A, and Line 3 can only produce Product B.\nmodel.addCons(B_L1 == 0)\nmodel.addCons(A_L3 == 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced on Line 1: \", model.getVal(A_L1))\n    print(\"Number of Product A units produced on Line 2: \", model.getVal(A_L2))\n    print(\"Number of Product A units produced on Line 3: \", model.getVal(A_L3))\n    print(\"Number of Product B units produced on Line 1: \", model.getVal(B_L1))\n    print(\"Number of Product B units produced on Line 2: \", model.getVal(B_L2))\n    print(\"Number of Product B units produced on Line 3: \", model.getVal(B_L3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 743,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 200 units per day.\n// A_P1 + B_P1 <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 180 units per day.\n// A_P2 + B_P2 <= 180\n\n## Generate Constraint-3:\nThe market demand for Product A is 150 units per day.\n// A_P1 + A_P2 >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | 10$          | 12$          |\n| B       | 8$           | 9$           |\n\nThe total production capacity of Plant 1 is 200 units per day, and the total production capacity of Plant 2 is 180 units per day. The market demand for Product A is 150 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand and not exceeding the production capacities of the plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 200 units per day.\nmodel.addCons(A_P1 + B_P1 <= 200)\n## The total production capacity of Plant 2 is 180 units per day.\nmodel.addCons(A_P2 + B_P2 <= 180)\n## The market demand for Product A is 150 units per day.\nmodel.addCons(A_P1 + A_P2 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 200 units per day.\n// A_P1 + B_P1 <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 180 units per day.\n// A_P2 + B_P2 <= 180\n\n## Generate Constraint-3:\nThe market demand for Product A is 150 units per day.\n// A_P1 + A_P2 >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 200 units per day, and the total production capacity of Plant 2 is 180 units per day. The market demand for Product A is 150 units per day. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 200 units per day.\nmodel.addCons(A_P1 + B_P1 <= 200)\n## The total production capacity of Plant 2 is 180 units per day.\nmodel.addCons(A_P2 + B_P2 <= 180)\n## The market demand for Product A is 150 units per day.\nmodel.addCons(A_P1 + A_P2 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 722,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory to meet the demand while minimizing the production cost.\n// {\"number of Product A units produced in Chicago\": \"Chi_A\", \"range\": \"Chi_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"Chi_B\", \"range\": \"Chi_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Dallas\": \"Dal_A\", \"range\": \"Dal_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Dallas\": \"Dal_B\", \"range\": \"Dal_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $15, and in Dallas is $18. The manufacturer wants to minimize the total production cost.\n// Chi_Cost = 10*Chi_A + 15*Chi_B\n// Dal_Cost = 12*Dal_A + 18*Dal_B\n// Objective Function: Minimize: Chi_Cost + Dal_Cost\n\n## Generate Constraint-1:\nThe total production capacity of each factory is limited. The Chicago factory can produce up to 200 units in total, and the Dallas factory can produce up to 300 units in total.\n// Chi_A + Chi_B <= 200\n// Dal_A + Dal_B <= 300\n\n## Generate Constraint-2:\nThe market demand for Product A is 150 units, and for Product B is 100 units.\n// Chi_A + Dal_A >= 150\n// Chi_B + Dal_B >= 100\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 30% of each product in Chicago.\n// Chi_A >= 0.3 * (Chi_A + Dal_A)\n// Chi_B >= 0.3 * (Chi_B + Dal_B)",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory to meet the demand while minimizing the production cost. The cost of producing one unit of each product in each factory is given in the following Table.\n\n| Product | Chicago Cost | Dallas Cost |\n|---------|--------------|-------------|\n| A       | $10          | $12         |\n| B       | $15          | $18         |\n\nThe total production capacity of each factory is limited. The Chicago factory can produce up to 200 units in total, and the Dallas factory can produce up to 300 units in total. The market demand for Product A is 150 units, and for Product B is 100 units. The manufacturer has a policy to produce at least 30% of each product in Chicago. \n\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nChi_A = model.addVar(vtype=\"INTEGER\", name=\"Chi_A\", lb=0) # number of Product A units produced in Chicago\nChi_B = model.addVar(vtype=\"INTEGER\", name=\"Chi_B\", lb=0) # number of Product B units produced in Chicago\nDal_A = model.addVar(vtype=\"INTEGER\", name=\"Dal_A\", lb=0) # number of Product A units produced in Dallas\nDal_B = model.addVar(vtype=\"INTEGER\", name=\"Dal_B\", lb=0) # number of Product B units produced in Dallas\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nChi_Cost = 10*Chi_A + 15*Chi_B\nDal_Cost = 12*Dal_A + 18*Dal_B\nmodel.addCons(obj == Chi_Cost + Dal_Cost)\n\n# Add constraints\n## The total production capacity of each factory is limited.\nmodel.addCons(Chi_A + Chi_B <= 200)\nmodel.addCons(Dal_A + Dal_B <= 300)\n## The market demand for Product A and Product B.\nmodel.addCons(Chi_A + Dal_A >= 150)\nmodel.addCons(Chi_B + Dal_B >= 100)\n## The manufacturer has a policy to produce at least 30% of each product in Chicago.\nmodel.addCons(Chi_A >= 0.3 * (Chi_A + Dal_A))\nmodel.addCons(Chi_B >= 0.3 * (Chi_B + Dal_B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(Chi_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(Chi_B))\n    print(\"Number of Product A units produced in Dallas: \", model.getVal(Dal_A))\n    print(\"Number of Product B units produced in Dallas: \", model.getVal(Dal_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory to meet the demand while minimizing the production cost.\n// {\"number of Product A units produced in Chicago\": \"Chi_A\", \"range\": \"Chi_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"Chi_B\", \"range\": \"Chi_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Dallas\": \"Dal_A\", \"range\": \"Dal_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Dallas\": \"Dal_B\", \"range\": \"Dal_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $15, and in Dallas is $18. The manufacturer wants to minimize the total production cost.\n// Chi_Cost = 10*Chi_A + 15*Chi_B\n// Dal_Cost = 12*Dal_A + 18*Dal_B\n// Objective Function: Minimize: Chi_Cost + Dal_Cost\n\n## Generate Constraint-1:\nThe total production capacity of each factory is limited. The Chicago factory can produce up to 200 units in total, and the Dallas factory can produce up to 300 units in total.\n// Chi_A + Chi_B <= 200\n// Dal_A + Dal_B <= 300\n\n## Generate Constraint-2:\nThe market demand for Product A is 150 units, and for Product B is 100 units.\n// Chi_A + Dal_A >= 150\n// Chi_B + Dal_B >= 100\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 30% of each product in Chicago.\n// Chi_A >= 0.3 * (Chi_A + Dal_A)\n// Chi_B >= 0.3 * (Chi_B + Dal_B)",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory to meet the demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $15, and in Dallas is $18. The manufacturer wants to minimize the total production cost.\nThe total production capacity of each factory is limited. The Chicago factory can produce up to 200 units in total, and the Dallas factory can produce up to 300 units in total.\nThe market demand for Product A is 150 units, and for Product B is 100 units.\nThe manufacturer has a policy to produce at least 30% of each product in Chicago.\nPlease help the manufacturer determine the optimal number of units of Product A and Product B to produce in each factory to meet these conditions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nChi_A = model.addVar(vtype=\"INTEGER\", name=\"Chi_A\", lb=0) # number of Product A units produced in Chicago\nChi_B = model.addVar(vtype=\"INTEGER\", name=\"Chi_B\", lb=0) # number of Product B units produced in Chicago\nDal_A = model.addVar(vtype=\"INTEGER\", name=\"Dal_A\", lb=0) # number of Product A units produced in Dallas\nDal_B = model.addVar(vtype=\"INTEGER\", name=\"Dal_B\", lb=0) # number of Product B units produced in Dallas\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nChi_Cost = 10*Chi_A + 15*Chi_B\nDal_Cost = 12*Dal_A + 18*Dal_B\nmodel.addCons(obj == Chi_Cost + Dal_Cost)\n\n# Add constraints\n## The total production capacity of each factory is limited.\nmodel.addCons(Chi_A + Chi_B <= 200)\nmodel.addCons(Dal_A + Dal_B <= 300)\n## The market demand for Product A and Product B.\nmodel.addCons(Chi_A + Dal_A >= 150)\nmodel.addCons(Chi_B + Dal_B >= 100)\n## The manufacturer has a policy to produce at least 30% of each product in Chicago.\nmodel.addCons(Chi_A >= 0.3 * (Chi_A + Dal_A))\nmodel.addCons(Chi_B >= 0.3 * (Chi_B + Dal_B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(Chi_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(Chi_B))\n    print(\"Number of Product A units produced in Dallas: \", model.getVal(Dal_A))\n    print(\"Number of Product B units produced in Dallas: \", model.getVal(Dal_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A_units + B_units <= 1000\n\n## Generate Constraint-2:\nThe labor hours available per week are limited to 1200 hours. Producing one unit of Product A requires 2 hours, and Product B requires 3 hours.\n// A_labor = 2*A_units\n// B_labor = 3*B_units\n// A_labor + B_labor <= 1200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 400 units per week.\n// A_units >= 400",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity, labor hours, and market demand for each product must be considered. The profit from selling one unit of Product A is $50, and from Product B is $70. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Required per Unit |\n|---------|-------------------------|\n| A       | 2 hours                 |\n| B       | 3 hours                 |\n\nThe company has a total production capacity of 1000 units per week. The labor hours available per week are limited to 1200 hours. The market demand for Product A is at least 400 units per week.\n\nPlease help the company to maximize its total profit from both products, considering the constraints on production capacity, labor hours, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor used for each product\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # number of hours of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # number of hours of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A_units + B_units <= 1000)\n## The labor hours available per week are limited to 1200 hours.\nmodel.addCons(A_labor == 2*A_units)\nmodel.addCons(B_labor == 3*B_units)\nmodel.addCons(A_labor + B_labor <= 1200)\n## The market demand for Product A is at least 400 units per week.\nmodel.addCons(A_units >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A_units + B_units <= 1000\n\n## Generate Constraint-2:\nThe labor hours available per week are limited to 1200 hours. Producing one unit of Product A requires 2 hours, and Product B requires 3 hours.\n// A_labor = 2*A_units\n// B_labor = 3*B_units\n// A_labor + B_labor <= 1200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 400 units per week.\n// A_units >= 400",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered. The profit from selling one unit of Product A is $50, and from Product B is $70. The total production capacity is limited to 1000 units per week. The labor hours available per week are limited to 1200 hours, with producing one unit of Product A requiring 2 hours and Product B requiring 3 hours. The market demand for Product A is at least 400 units per week. Please help the company to maximize its total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor used for each product\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # number of hours of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # number of hours of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A_units + B_units <= 1000)\n## The labor hours available per week are limited to 1200 hours.\nmodel.addCons(A_labor == 2*A_units)\nmodel.addCons(B_labor == 3*B_units)\nmodel.addCons(A_labor + B_labor <= 1200)\n## The market demand for Product A is at least 400 units per week.\nmodel.addCons(A_units >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are limited.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from selling both products.\n// Objective Function: Maximize: 50*A_sold + 70*B_sold\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced per week.\n// A_units <= 100\n// B_units <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 80 units per week, and for Product B is at least 90 units per week.\n// A_sold >= 80\n// B_sold >= 90\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A_units\n// B_sold <= B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit from selling one unit of Product A is $50, and from Product B is $70. The production capacity and market demand for each product are limited. The following table summarizes the constraints:\n\n| Constraint Description | Constraint |\n|------------------------|------------|\n| Maximum units of Product A produced per week | A_units <= 100 |\n| Maximum units of Product B produced per week | B_units <= 120 |\n| Minimum units of Product A sold per week | A_sold >= 80 |\n| Minimum units of Product B sold per week | B_sold >= 90 |\n| Units of Product A sold cannot exceed production | A_sold <= A_units |\n| Units of Product B sold cannot exceed production | B_sold <= B_units |\n\nPlease help the company to maximize its total profit from selling both products, which is defined as 50*A_sold + 70*B_sold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of Product A sold\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of Product B sold\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 70*B_sold)\n\n# Add constraints\n## The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced per week.\nmodel.addCons(A_units <= 100)\nmodel.addCons(B_units <= 120)\n## The market demand for Product A is at least 80 units per week, and for Product B is at least 90 units per week.\nmodel.addCons(A_sold >= 80)\nmodel.addCons(B_sold >= 90)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A_units)\nmodel.addCons(B_sold <= B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Number of units of Product A sold: \", model.getVal(A_sold))\n    print(\"Number of units of Product B sold: \", model.getVal(B_sold))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are limited.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from selling both products.\n// Objective Function: Maximize: 50*A_sold + 70*B_sold\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced per week.\n// A_units <= 100\n// B_units <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 80 units per week, and for Product B is at least 90 units per week.\n// A_sold >= 80\n// B_sold >= 90\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A_units\n// B_sold <= B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit from selling one unit of Product A is $50, and from Product B is $70. The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced per week. The market demand for Product A is at least 80 units per week, and for Product B is at least 90 units per week. The company can only sell as many units as it produces for each product. Please help the company to maximize its total profit from selling both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of Product A sold\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of Product B sold\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 70*B_sold)\n\n# Add constraints\n## The production capacity allows for a maximum of 100 units of Product A and 120 units of Product B to be produced per week.\nmodel.addCons(A_units <= 100)\nmodel.addCons(B_units <= 120)\n## The market demand for Product A is at least 80 units per week, and for Product B is at least 90 units per week.\nmodel.addCons(A_sold >= 80)\nmodel.addCons(B_sold >= 90)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A_units)\nmodel.addCons(B_sold <= B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Number of units of Product A sold: \", model.getVal(A_sold))\n    print(\"Number of units of Product B sold: \", model.getVal(B_sold))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are key factors.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machines used\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total labor hours available per day are 100 hours. Producing one unit of Product A requires 2 hours of labor, and Product B requires 3 hours.\n// 2*A_units + 3*B_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available per day are 120 hours. Producing one unit of Product A requires 1 hour of machine time, and Product B requires 2 hours.\n// A_units + 2*B_units <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A_units >= 20\n// B_units >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are key factors. The profit per unit of Product A is $50, and for Product B is $70. The following table summarizes the labor and machine requirements for each product.\n\n| Product | Profit per Unit | Labor per Unit | Machine per Unit |\n|---------|-----------------|----------------|------------------|\n| A       | $50             | 2 hours        | 1 hour           |\n| B       | $70             | 3 hours        | 2 hours          |\n\nThe total labor hours available per day are 100 hours, and the total machine hours available per day are 120 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day. \n\nPlease help the company to maximize its total profit from both products, considering the constraints on labor, machine hours, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total labor hours available per day are 100 hours.\nmodel.addCons(2*A_units + 3*B_units <= 100)\n## The total machine hours available per day are 120 hours.\nmodel.addCons(A_units + 2*B_units <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A_units >= 20)\nmodel.addCons(B_units >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are key factors.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machines used\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total labor hours available per day are 100 hours. Producing one unit of Product A requires 2 hours of labor, and Product B requires 3 hours.\n// 2*A_units + 3*B_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available per day are 120 hours. Producing one unit of Product A requires 1 hour of machine time, and Product B requires 2 hours.\n// A_units + 2*B_units <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A_units >= 20\n// B_units >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit per unit of Product A is $50, and for Product B is $70. The total labor hours available per day are 100 hours, with each unit of Product A requiring 2 hours of labor and Product B requiring 3 hours. The total machine hours available per day are 120 hours, with each unit of Product A requiring 1 hour of machine time and Product B requiring 2 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day. Please help the company to maximize its total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total labor hours available per day are 100 hours.\nmodel.addCons(2*A_units + 3*B_units <= 100)\n## The total machine hours available per day are 120 hours.\nmodel.addCons(A_units + 2*B_units <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A_units >= 20)\nmodel.addCons(B_units >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 714,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available machinery hours\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours available are 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, product B requires 7 units, and product C requires 6 units. The total raw materials available are 150 units.\n// 5*A + 7*B + 6*C <= 150\n\n## Generate Constraint-3:\nEach unit of product A requires 1 hour of machinery time, product B requires 2 hours, and product C requires 1 hour. The total machinery hours available are 50 hours.\n// A + 2*B + C <= 50",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to optimize profits while considering the availability of resources. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the resource requirements for each product:\n\n| Product | Labor Hours | Raw Materials | Machinery Hours |\n|---------|-------------|---------------|-----------------|\n| A       | 2 hours     | 5 units       | 1 hour          |\n| B       | 3 hours     | 7 units       | 2 hours         |\n| C       | 4 hours     | 6 units       | 1 hour          |\n\nThe total labor hours available are 100 hours, the total raw materials available are 150 units, and the total machinery hours available are 50 hours. \n\nPlease help the manufacturer to maximize the total profit from the production of these three products, subject to the resource constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours available are 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, product B requires 7 units, and product C requires 6 units. The total raw materials available are 150 units.\nmodel.addCons(5*A + 7*B + 6*C <= 150)\n## Each unit of product A requires 1 hour of machinery time, product B requires 2 hours, and product C requires 1 hour. The total machinery hours available are 50 hours.\nmodel.addCons(A + 2*B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available machinery hours\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours available are 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, product B requires 7 units, and product C requires 6 units. The total raw materials available are 150 units.\n// 5*A + 7*B + 6*C <= 150\n\n## Generate Constraint-3:\nEach unit of product A requires 1 hour of machinery time, product B requires 2 hours, and product C requires 1 hour. The total machinery hours available are 50 hours.\n// A + 2*B + C <= 50",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to optimize profits while considering the availability of resources.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from the production of these three products.\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours available are 100 hours.\nEach unit of product A requires 5 units of raw materials, product B requires 7 units, and product C requires 6 units. The total raw materials available are 150 units.\nEach unit of product A requires 1 hour of machinery time, product B requires 2 hours, and product C requires 1 hour. The total machinery hours available are 50 hours.\nPlease help the manufacturer determine the optimal number of units of products A, B, and C to produce to maximize total profit while adhering to the resource constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours available are 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, product B requires 7 units, and product C requires 6 units. The total raw materials available are 150 units.\nmodel.addCons(5*A + 7*B + 6*C <= 150)\n## Each unit of product A requires 1 hour of machinery time, product B requires 2 hours, and product C requires 1 hour. The total machinery hours available are 50 hours.\nmodel.addCons(A + 2*B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y purchased\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\n// Material_X_Cost = 10 * X\n// Material_Y_Cost = 15 * Y\n// Objective Function: Minimize: Material_X_Cost + Material_Y_Cost\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\n// 2 * A <= X\n// A <= Y\n\n## Generate Constraint-2:\nEach unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n// B <= X\n// 3 * B <= Y\n\n## Generate Constraint-3:\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\n// 10 * X + 15 * Y <= 1000",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs. The cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\n\n| Product | Material X Required | Material Y Required |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 1 unit              |\n| B       | 1 unit              | 3 units             |\n\nThe manufacturer has the following constraints:\n- The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\n- Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n- The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\n\nPlease help the manufacturer determine the optimal number of units of Product A and Product B to produce, and the amount of each material to purchase to minimize the total cost of materials while meeting the production needs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of Product A and Product B\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The amount of Material X and Material Y purchased\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X purchased\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_X_Cost = 10 * X\n## Material_Y_Cost = 15 * Y\nmodel.addCons(obj == 10*X + 15*Y)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\nmodel.addCons(2 * A <= X)\nmodel.addCons(A <= Y)\n## Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\nmodel.addCons(B <= X)\nmodel.addCons(3 * B <= Y)\n## The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\nmodel.addCons(10 * X + 15 * Y <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Amount of Material X purchased: \", model.getVal(X))\n    print(\"Amount of Material Y purchased: \", model.getVal(Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y purchased\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\n// Material_X_Cost = 10 * X\n// Material_Y_Cost = 15 * Y\n// Objective Function: Minimize: Material_X_Cost + Material_Y_Cost\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\n// 2 * A <= X\n// A <= Y\n\n## Generate Constraint-2:\nEach unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n// B <= X\n// 3 * B <= Y\n\n## Generate Constraint-3:\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\n// 10 * X + 15 * Y <= 1000",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y, and each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\nPlease help the manufacturer determine the optimal number of units of Product A and Product B to produce, and the amount of each material to purchase to minimize the total cost of materials while meeting the production needs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of Product A and Product B\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The amount of Material X and Material Y purchased\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X purchased\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_X_Cost = 10 * X\n## Material_Y_Cost = 15 * Y\nmodel.addCons(obj == 10*X + 15*Y)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\nmodel.addCons(2 * A <= X)\nmodel.addCons(A <= Y)\n## Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\nmodel.addCons(B <= X)\nmodel.addCons(3 * B <= Y)\n## The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\nmodel.addCons(10 * X + 15 * Y <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Amount of Material X purchased: \", model.getVal(X))\n    print(\"Amount of Material Y purchased: \", model.getVal(Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from producing both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 500 units. Each unit of Product A requires 2 units of raw material, and each unit of Product B requires 3 units of raw material.\n// 2*A + 3*B <= 500\n\n## Generate Constraint-2:\nThe total amount of labor available is 400 hours. Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor.\n// A + 2*B <= 400\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor. The profit per unit for Product A is $50 and for Product B is $70. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Raw Material per Unit | Labor per Unit |\n|---------|-----------------|-----------------------|----------------|\n| A       | $50             | 2 units               | 1 hour         |\n| B       | $70             | 3 units               | 2 hours        |\n\nThe total amount of raw materials available is 500 units, and the total amount of labor available is 400 hours. The market demand for Product A is at least 100 units. Please help the manufacturer determine the optimal number of units of Product A (A) and Product B (B) to produce to maximize the total profit, subject to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## The amount of raw material and labor used for each product\nraw_A = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_A\", lb=0) # amount of raw material used for Product A\nraw_B = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_B\", lb=0) # amount of raw material used for Product B\nlabor_A = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_A\", lb=0) # amount of labor used for Product A\nlabor_B = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_B\", lb=0) # amount of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The total amount of raw materials available is 500 units.\nmodel.addCons(2*A + 3*B <= 500)\n## The total amount of labor available is 400 hours.\nmodel.addCons(A + 2*B <= 400)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from producing both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 500 units. Each unit of Product A requires 2 units of raw material, and each unit of Product B requires 3 units of raw material.\n// 2*A + 3*B <= 500\n\n## Generate Constraint-2:\nThe total amount of labor available is 400 hours. Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor.\n// A + 2*B <= 400\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer has a total of 500 units of raw materials available, where each unit of Product A requires 2 units of raw material and each unit of Product B requires 3 units of raw material. The total amount of labor available is 400 hours, with each unit of Product A requiring 1 hour of labor and each unit of Product B requiring 2 hours of labor. The market demand for Product A is at least 100 units. The manufacturer needs to decide how many units of each product to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## The amount of raw material and labor used for each product\nraw_A = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_A\", lb=0) # amount of raw material used for Product A\nraw_B = model.addVar(vtype=\"CONTINUOUS\", name=\"raw_B\", lb=0) # amount of raw material used for Product B\nlabor_A = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_A\", lb=0) # amount of labor used for Product A\nlabor_B = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_B\", lb=0) # amount of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The total amount of raw materials available is 500 units.\nmodel.addCons(2*A + 3*B <= 500)\n## The total amount of labor available is 400 hours.\nmodel.addCons(A + 2*B <= 400)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C_units\", \"range\": \"C_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used daily\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $30, and for product C is $40. The objective is to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 50*A_units + 30*B_units + 40*C_units\n\n## Generate Constraint-1:\nThe total labor hours available daily are 100 hours. Producing one unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour.\n// 2*A_units + 3*B_units + 1*C_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available daily are 80 hours. Producing one unit of product A requires 1 hour of machine time, product B requires 2 hours, and product C requires 3 hours.\n// 1*A_units + 2*B_units + 3*C_units <= 80\n\n## Generate Constraint-3:\nThe market demand for product A is at least 15 units daily, and for product B is at least 20 units daily. There is no minimum demand specified for product C.\n// A_units >= 15\n// B_units >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for product A is $50, for product B is $30, and for product C is $40. The labor and machine requirements for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Machine Hours per Unit |\n|---------|----------------------|------------------------|\n| A       | 2 hours              | 1 hour                 |\n| B       | 3 hours              | 2 hours                |\n| C       | 1 hour               | 3 hours                |\n\nThe total labor hours available daily are 100 hours, and the total machine hours available daily are 80 hours. The market demand for product A is at least 15 units daily, and for product B is at least 20 units daily. There is no minimum demand specified for product C. \n\nPlease help the company to maximize the total daily profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of product A produced daily\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of product B produced daily\nC_units = model.addVar(vtype=\"INTEGER\", name=\"C_units\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 30*B_units + 40*C_units)\n\n# Add constraints\n## The total labor hours available daily are 100 hours.\nmodel.addCons(2*A_units + 3*B_units + 1*C_units <= 100)\n## The total machine hours available daily are 80 hours.\nmodel.addCons(1*A_units + 2*B_units + 3*C_units <= 80)\n## The market demand for product A is at least 15 units daily, and for product B is at least 20 units daily.\nmodel.addCons(A_units >= 15)\nmodel.addCons(B_units >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A_units))\n    print(\"Number of units of product B produced daily: \", model.getVal(B_units))\n    print(\"Number of units of product C produced daily: \", model.getVal(C_units))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C_units\", \"range\": \"C_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used daily\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $30, and for product C is $40. The objective is to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 50*A_units + 30*B_units + 40*C_units\n\n## Generate Constraint-1:\nThe total labor hours available daily are 100 hours. Producing one unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour.\n// 2*A_units + 3*B_units + 1*C_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available daily are 80 hours. Producing one unit of product A requires 1 hour of machine time, product B requires 2 hours, and product C requires 3 hours.\n// 1*A_units + 2*B_units + 3*C_units <= 80\n\n## Generate Constraint-3:\nThe market demand for product A is at least 15 units daily, and for product B is at least 20 units daily. There is no minimum demand specified for product C.\n// A_units >= 15\n// B_units >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for product A is $50, for product B is $30, and for product C is $40. The total labor hours available daily are 100 hours, with producing one unit of product A requiring 2 hours of labor, product B requiring 3 hours, and product C requiring 1 hour. The total machine hours available daily are 80 hours, with producing one unit of product A requiring 1 hour of machine time, product B requiring 2 hours, and product C requiring 3 hours. The market demand for product A is at least 15 units daily, and for product B is at least 20 units daily. There is no minimum demand specified for product C. Please help the company to maximize the total daily profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of product A produced daily\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of product B produced daily\nC_units = model.addVar(vtype=\"INTEGER\", name=\"C_units\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 30*B_units + 40*C_units)\n\n# Add constraints\n## The total labor hours available daily are 100 hours.\nmodel.addCons(2*A_units + 3*B_units + 1*C_units <= 100)\n## The total machine hours available daily are 80 hours.\nmodel.addCons(1*A_units + 2*B_units + 3*C_units <= 80)\n## The market demand for product A is at least 15 units daily, and for product B is at least 20 units daily.\nmodel.addCons(A_units >= 15)\nmodel.addCons(B_units >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A_units))\n    print(\"Number of units of product B produced daily: \", model.getVal(B_units))\n    print(\"Number of units of product C produced daily: \", model.getVal(C_units))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, sourdough bread for $5 per loaf, and whole grain bread for $6 per loaf. The bakery aims to determine the optimal number of loaves of each type of bread to maximize daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough + 6*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 kilograms, and the yeast supply is 50 kilograms. Each loaf of wheat bread requires 0.5 kilograms of flour and 0.1 kilograms of yeast. Each loaf of rye bread requires 0.4 kilograms of flour and 0.1 kilograms of yeast. Each loaf of sourdough bread requires 0.3 kilograms of flour and 0.2 kilograms of yeast. Each loaf of whole grain bread requires 0.6 kilograms of flour and 0.1 kilograms of yeast.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 300\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*WholeGrain <= 50\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of bread. At least 50 loaves of wheat bread, 40 loaves of rye bread, 30 loaves of sourdough bread, and 20 loaves of whole grain bread must be produced daily.\n// Wheat >= 50, Rye >= 40, Sourdough >= 30, WholeGrain >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily production capacity for each type of bread due to oven limitations. The maximum number of loaves that can be baked daily is 100 for wheat bread, 80 for rye bread, 60 for sourdough bread, and 40 for whole grain bread.\n// Wheat <= 100, Rye <= 80, Sourdough <= 60, WholeGrain <= 40",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The selling price for each type of bread is as follows: wheat bread for $3 per loaf, rye bread for $4 per loaf, sourdough bread for $5 per loaf, and whole grain bread for $6 per loaf.\n\n| Bread Type     | Selling Price | Flour Requirement (kg) | Yeast Requirement (kg) |\n|----------------|---------------|------------------------|-----------------------|\n| Wheat          | $3            | 0.5                    | 0.1                   |\n| Rye            | $4            | 0.4                    | 0.1                   |\n| Sourdough      | $5            | 0.3                    | 0.2                   |\n| Whole Grain    | $6            | 0.6                    | 0.1                   |\n\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 kilograms, and the yeast supply is 50 kilograms. The bakery has a minimum daily production requirement for each type of bread: at least 50 loaves of wheat bread, 40 loaves of rye bread, 30 loaves of sourdough bread, and 20 loaves of whole grain bread must be produced daily. Additionally, due to oven limitations, the bakery has a maximum daily production capacity for each type of bread: 100 loaves for wheat bread, 80 loaves for rye bread, 60 loaves for sourdough bread, and 40 loaves for whole grain bread.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to maximize daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWholeGrain = model.addVar(vtype=\"INTEGER\", name=\"WholeGrain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough + 6*WholeGrain)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 300) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*WholeGrain <= 50) # yeast constraint\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourdough >= 30)\nmodel.addCons(WholeGrain >= 20)\n## The bakery also has a maximum daily production capacity for each type of bread.\nmodel.addCons(Wheat <= 100)\nmodel.addCons(Rye <= 80)\nmodel.addCons(Sourdough <= 60)\nmodel.addCons(WholeGrain <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(WholeGrain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1642,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, sourdough bread for $5 per loaf, and whole grain bread for $6 per loaf. The bakery aims to determine the optimal number of loaves of each type of bread to maximize daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough + 6*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 kilograms, and the yeast supply is 50 kilograms. Each loaf of wheat bread requires 0.5 kilograms of flour and 0.1 kilograms of yeast. Each loaf of rye bread requires 0.4 kilograms of flour and 0.1 kilograms of yeast. Each loaf of sourdough bread requires 0.3 kilograms of flour and 0.2 kilograms of yeast. Each loaf of whole grain bread requires 0.6 kilograms of flour and 0.1 kilograms of yeast.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 300\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*WholeGrain <= 50\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of bread. At least 50 loaves of wheat bread, 40 loaves of rye bread, 30 loaves of sourdough bread, and 20 loaves of whole grain bread must be produced daily.\n// Wheat >= 50, Rye >= 40, Sourdough >= 30, WholeGrain >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily production capacity for each type of bread due to oven limitations. The maximum number of loaves that can be baked daily is 100 for wheat bread, 80 for rye bread, 60 for sourdough bread, and 40 for whole grain bread.\n// Wheat <= 100, Rye <= 80, Sourdough <= 60, WholeGrain <= 40",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, sourdough bread for $5 per loaf, and whole grain bread for $6 per loaf. The bakery has a limited supply of flour and yeast. The daily supply of flour is 300 kilograms, and the yeast supply is 50 kilograms. Each loaf of wheat bread requires 0.5 kilograms of flour and 0.1 kilograms of yeast. Each loaf of rye bread requires 0.4 kilograms of flour and 0.1 kilograms of yeast. Each loaf of sourdough bread requires 0.3 kilograms of flour and 0.2 kilograms of yeast. Each loaf of whole grain bread requires 0.6 kilograms of flour and 0.1 kilograms of yeast. The bakery has a minimum daily production requirement for each type of bread. At least 50 loaves of wheat bread, 40 loaves of rye bread, 30 loaves of sourdough bread, and 20 loaves of whole grain bread must be produced daily. The bakery also has a maximum daily production capacity for each type of bread due to oven limitations. The maximum number of loaves that can be baked daily is 100 for wheat bread, 80 for rye bread, 60 for sourdough bread, and 40 for whole grain bread. Please help the bakery determine the optimal number of loaves of each type of bread to maximize daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWholeGrain = model.addVar(vtype=\"INTEGER\", name=\"WholeGrain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough + 6*WholeGrain)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 300) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*WholeGrain <= 50) # yeast constraint\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourdough >= 30)\nmodel.addCons(WholeGrain >= 20)\n## The bakery also has a maximum daily production capacity for each type of bread.\nmodel.addCons(Wheat <= 100)\nmodel.addCons(Rye <= 80)\nmodel.addCons(Sourdough <= 60)\nmodel.addCons(WholeGrain <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(WholeGrain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1461,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of all loaves\": \"Total\", \"range\": \"Total >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The objective is to determine the optimal number of loaves of each type to maximize the daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 400 loaves.\n// Wheat + Rye + Sourdough <= 400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time. The selling price for each type of bread is as follows:\n\n| Bread Type | Selling Price |\n|------------|---------------|\n| Wheat      | $3 per loaf   |\n| Rye        | $4 per loaf   |\n| Sourdough  | $5 per loaf   |\n\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The total daily flour supply is 200 pounds. The bakery has a daily production capacity of 400 loaves. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n\nPlease help the bakery determine the optimal number of loaves of each type to maximize the daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nTotal = model.addVar(vtype=\"INTEGER\", name=\"Total\", lb=0) # total number of loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a daily production capacity of 400 loaves.\nmodel.addCons(Wheat + Rye + Sourdough <= 400)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of all loaves\": \"Total\", \"range\": \"Total >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The objective is to determine the optimal number of loaves of each type to maximize the daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 400 loaves.\n// Wheat + Rye + Sourdough <= 400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time. The bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 pounds of flour, each loaf of rye bread requiring 0.4 pounds, and each loaf of sourdough requiring 0.6 pounds. The total daily flour supply is 200 pounds. The bakery has a daily production capacity of 400 loaves. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery determine the optimal number of loaves of each type to maximize the daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nTotal = model.addVar(vtype=\"INTEGER\", name=\"Total\", lb=0) # total number of loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a daily production capacity of 400 loaves.\nmodel.addCons(Wheat + Rye + Sourdough <= 400)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed breads\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and mixed bread (containing equal parts of wheat, rye, and sourdough) for $3.50 per loaf. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.6 pounds of flour, each loaf of sourdough bread requires 0.4 pounds of flour, and each loaf of mixed bread requires 0.3 pounds of flour. The total daily supply of flour is 200 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.4*Sourdough + 0.3*Mixed <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each loaf of bread requires 0.05 pounds of yeast. The total daily supply of yeast is 10 pounds.\n// 0.05*(Wheat + Rye + Sourdough + Mixed) <= 10\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for mixed bread.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Mixed >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and mixed. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and market demand. The selling price for each type of bread is given in the following Table.\n\n| Bread Type | Selling Price |\n|------------|---------------|\n| Wheat      | $2 per loaf   |\n| Rye        | $2.50 per loaf|\n| Sourdough  | $3 per loaf   |\n| Mixed      | $3.50 per loaf|\n\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.6 pounds of flour, each loaf of sourdough bread requires 0.4 pounds of flour, and each loaf of mixed bread requires 0.3 pounds of flour. The total daily supply of flour is 200 pounds. Each loaf of bread also requires 0.05 pounds of yeast, and the total daily supply of yeast is 10 pounds.\n\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for mixed bread.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.4*Sourdough + 0.3*Mixed <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.05*(Wheat + Rye + Sourdough + Mixed) <= 10)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Mixed >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of mixed breads: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed breads\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and mixed bread (containing equal parts of wheat, rye, and sourdough) for $3.50 per loaf. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.6 pounds of flour, each loaf of sourdough bread requires 0.4 pounds of flour, and each loaf of mixed bread requires 0.3 pounds of flour. The total daily supply of flour is 200 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.4*Sourdough + 0.3*Mixed <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each loaf of bread requires 0.05 pounds of yeast. The total daily supply of yeast is 10 pounds.\n// 0.05*(Wheat + Rye + Sourdough + Mixed) <= 10\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for mixed bread.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Mixed >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and mixed. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and market demand. The bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and mixed bread for $3.50 per loaf. The bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.6 pounds of flour, each loaf of sourdough bread requires 0.4 pounds of flour, and each loaf of mixed bread requires 0.3 pounds of flour. The total daily supply of flour is 200 pounds. Each loaf of bread also requires 0.05 pounds of yeast, and the total daily supply of yeast is 10 pounds. The bakery must meet a minimum daily demand for each type of bread: 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for mixed bread.\n\nPlease help the bakery to maximize its daily revenue from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.4*Sourdough + 0.3*Mixed <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.05*(Wheat + Rye + Sourdough + Mixed) <= 10)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Mixed >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of mixed breads: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while considering the limited availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, the profit per loaf of rye bread is $2.50, and the profit per loaf of sourdough bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds of flour, and each loaf of sourdough bread requires 0.6 pounds of flour. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 40 loaves, and for sourdough bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 40\n// Sourdough >= 30\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each loaf of bread requires 10 minutes of oven time. The total daily oven time available is 1200 minutes.\n// Wheat + Rye + Sourdough <= 1200 / 10\n// Wheat + Rye + Sourdough <= 120",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while considering the limited availability of ingredients and the demand for each type of bread. The profit per loaf of wheat bread is $2, the profit per loaf of rye bread is $2.50, and the profit per loaf of sourdough bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type   | Profit per Loaf | Flour Required (pounds) | Oven Time (minutes) |\n|--------------|-----------------|-------------------------|---------------------|\n| Wheat        | $2              | 0.5                     | 10                  |\n| Rye          | $2.50           | 0.4                     | 10                  |\n| Sourdough    | $3              | 0.6                     | 10                  |\n\nThe bakery has a limited supply of flour, with a total daily supply of 200 pounds. The bakery must meet a minimum demand for each type of bread: 50 loaves of wheat bread, 40 loaves of rye bread, and 30 loaves of sourdough bread. Additionally, the bakery has a limited oven capacity, with a total daily oven time available of 1200 minutes. \n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery must meet a minimum demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourdough >= 30)\n## The bakery has a limited oven capacity.\nmodel.addCons(Wheat + Rye + Sourdough <= 1200 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while considering the limited availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, the profit per loaf of rye bread is $2.50, and the profit per loaf of sourdough bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds of flour, and each loaf of sourdough bread requires 0.6 pounds of flour. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 40 loaves, and for sourdough bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 40\n// Sourdough >= 30\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each loaf of bread requires 10 minutes of oven time. The total daily oven time available is 1200 minutes.\n// Wheat + Rye + Sourdough <= 1200 / 10\n// Wheat + Rye + Sourdough <= 120",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while considering the limited availability of ingredients and the demand for each type of bread. The profit per loaf of wheat bread is $2, the profit per loaf of rye bread is $2.50, and the profit per loaf of sourdough bread is $3. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 pounds of flour, each loaf of rye bread requiring 0.4 pounds of flour, and each loaf of sourdough bread requiring 0.6 pounds of flour, with a total daily flour supply of 200 pounds. The bakery must meet a minimum demand for each type of bread, with the minimum daily demand for wheat bread being 50 loaves, for rye bread being 40 loaves, and for sourdough bread being 30 loaves. Additionally, the bakery has a limited oven capacity, with each loaf of bread requiring 10 minutes of oven time and a total daily oven time available of 1200 minutes. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery must meet a minimum demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourdough >= 30)\n## The bakery has a limited oven capacity.\nmodel.addCons(Wheat + Rye + Sourdough <= 1200 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery wants to determine the optimal daily production quantity for each type of pastry to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"Tar\", \"range\": \"Tar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per tart is $0.80. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.80*Tar\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour and butter. The flour supply is 300 kg, and the butter supply is 150 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of butter, each muffin requires 0.08 kg of flour and 0.03 kg of butter, each eclair requires 0.05 kg of flour and 0.02 kg of butter, and each tart requires 0.06 kg of flour and 0.04 kg of butter.\n// 0.1*Cro + 0.08*Muf + 0.05*Ecl + 0.06*Tar <= 300 (Flour constraint)\n// 0.05*Cro + 0.03*Muf + 0.02*Ecl + 0.04*Tar <= 150 (Butter constraint)\n\n## Generate Constraint-2:\nThe bakery has a limited storage capacity for finished products. The total storage space is 500 units, and each croissant, muffin, eclair, and tart occupies 1 unit of space.\n// Cro + Muf + Ecl + Tar <= 500 (Storage constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of each type of pastry to meet the minimum order requirements from regular customers.\n// Cro >= 50, Muf >= 50, Ecl >= 50, Tar >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery wants to determine the optimal daily production quantity for each type of pastry to maximize profit while considering the limited availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per tart is $0.80. The bakery has a limited daily supply of flour and butter. The flour supply is 300 kg, and the butter supply is 150 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of butter, each muffin requires 0.08 kg of flour and 0.03 kg of butter, each eclair requires 0.05 kg of flour and 0.02 kg of butter, and each tart requires 0.06 kg of flour and 0.04 kg of butter. The bakery also has a limited storage capacity for finished products, with a total storage space of 500 units, and each croissant, muffin, eclair, and tart occupies 1 unit of space. Additionally, the bakery must produce at least 50 units of each type of pastry to meet the minimum order requirements from regular customers.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (kg) | Butter Required (kg) | Storage Space (units) |\n|----------|-----------------|---------------------|----------------------|-----------------------|\n| Croissant| $0.50           | 0.1                 | 0.05                 | 1                     |\n| Muffin   | $0.60           | 0.08                | 0.03                 | 1                     |\n| Eclair   | $0.70           | 0.05                | 0.02                 | 1                     |\n| Tart     | $0.80           | 0.06                | 0.04                 | 1                     |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nTar = model.addVar(vtype=\"INTEGER\", name=\"Tar\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.80*Tar)\n\n# Add constraints\n## The bakery has a limited daily supply of flour and butter.\nmodel.addCons(0.1*Cro + 0.08*Muf + 0.05*Ecl + 0.06*Tar <= 300) # Flour constraint\nmodel.addCons(0.05*Cro + 0.03*Muf + 0.02*Ecl + 0.04*Tar <= 150) # Butter constraint\n## The bakery has a limited storage capacity for finished products.\nmodel.addCons(Cro + Muf + Ecl + Tar <= 500) # Storage constraint\n## The bakery must produce at least 50 units of each type of pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 50)\nmodel.addCons(Ecl >= 50)\nmodel.addCons(Tar >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of tarts: \", model.getVal(Tar))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1753,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery wants to determine the optimal daily production quantity for each type of pastry to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"Tar\", \"range\": \"Tar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per tart is $0.80. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.80*Tar\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour and butter. The flour supply is 300 kg, and the butter supply is 150 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of butter, each muffin requires 0.08 kg of flour and 0.03 kg of butter, each eclair requires 0.05 kg of flour and 0.02 kg of butter, and each tart requires 0.06 kg of flour and 0.04 kg of butter.\n// 0.1*Cro + 0.08*Muf + 0.05*Ecl + 0.06*Tar <= 300 (Flour constraint)\n// 0.05*Cro + 0.03*Muf + 0.02*Ecl + 0.04*Tar <= 150 (Butter constraint)\n\n## Generate Constraint-2:\nThe bakery has a limited storage capacity for finished products. The total storage space is 500 units, and each croissant, muffin, eclair, and tart occupies 1 unit of space.\n// Cro + Muf + Ecl + Tar <= 500 (Storage constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of each type of pastry to meet the minimum order requirements from regular customers.\n// Cro >= 50, Muf >= 50, Ecl >= 50, Tar >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery wants to determine the optimal daily production quantity for each type of pastry to maximize profit while considering the limited availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per tart is $0.80. The bakery has a limited daily supply of flour and butter. The flour supply is 300 kg, and the butter supply is 150 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of butter, each muffin requires 0.08 kg of flour and 0.03 kg of butter, each eclair requires 0.05 kg of flour and 0.02 kg of butter, and each tart requires 0.06 kg of flour and 0.04 kg of butter. The bakery also has a limited storage capacity for finished products, with a total storage space of 500 units, and each pastry occupies 1 unit of space. Additionally, the bakery must produce at least 50 units of each type of pastry to meet the minimum order requirements from regular customers. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nTar = model.addVar(vtype=\"INTEGER\", name=\"Tar\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.80*Tar)\n\n# Add constraints\n## The bakery has a limited daily supply of flour and butter.\nmodel.addCons(0.1*Cro + 0.08*Muf + 0.05*Ecl + 0.06*Tar <= 300) # Flour constraint\nmodel.addCons(0.05*Cro + 0.03*Muf + 0.02*Ecl + 0.04*Tar <= 150) # Butter constraint\n## The bakery has a limited storage capacity for finished products.\nmodel.addCons(Cro + Muf + Ecl + Tar <= 500) # Storage constraint\n## The bakery must produce at least 50 units of each type of pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 50)\nmodel.addCons(Ecl >= 50)\nmodel.addCons(Tar >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of tarts: \", model.getVal(Tar))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of fallow land\": \"Fallow\", \"range\": \"Fallow >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// Wheat + Corn + Soy + Fallow = 100\n\n## Generate Constraint-2:\nAt least 20% of the land must be left fallow for soil regeneration.\n// Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow)\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\n// Soy >= 10",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The farmer wants to maximize his total profit from these crops.\n\n| Crop       | Profit per Acre |\n|------------|-----------------|\n| Wheat      | $200            |\n| Corn       | $300            |\n| Soybeans   | $250            |\n\nThe total available land for farming is 100 acres. At least 20% of the land must be left fallow for soil regeneration. The farmer must also plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\n\nPlease help the farmer determine the optimal allocation of acres to wheat, corn, soybeans, and fallow land to maximize his profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop and fallow land\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nFallow = model.addVar(vtype=\"INTEGER\", name=\"Fallow\", lb=0) # acres of fallow land\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Fallow == 100)\n## At least 20% of the land must be left fallow for soil regeneration.\nmodel.addCons(Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow))\n## The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\nmodel.addCons(Soy >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Fallow Land: \", model.getVal(Fallow))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of fallow land\": \"Fallow\", \"range\": \"Fallow >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// Wheat + Corn + Soy + Fallow = 100\n\n## Generate Constraint-2:\nAt least 20% of the land must be left fallow for soil regeneration.\n// Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow)\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\n// Soy >= 10",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The total available land for farming is 100 acres. At least 20% of the land must be left fallow for soil regeneration. The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock. Please help the farmer to maximize his total profit from these crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop and fallow land\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nFallow = model.addVar(vtype=\"INTEGER\", name=\"Fallow\", lb=0) # acres of fallow land\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Fallow == 100)\n## At least 20% of the land must be left fallow for soil regeneration.\nmodel.addCons(Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow))\n## The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\nmodel.addCons(Soy >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Fallow Land: \", model.getVal(Fallow))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 619,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while considering the constraints of available ingredients and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of specialty breads\": \"Specialty\", \"range\": \"Specialty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and specialty bread for $4 per loaf. The objective is to maximize the total daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 4*Specialty\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg of flour, while each specialty loaf requires 0.7 kg of flour. The daily supply of flour is 200 kg.\n// 0.5*(Wheat + Rye + Sourdough) + 0.7*Specialty <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The daily supply of yeast is 1 kg.\n// 0.01*(Wheat + Rye + Sourdough + Specialty) <= 1\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for specialty bread.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Specialty >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and specialty. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while considering the constraints of available ingredients and market demand. The selling prices for each type of bread are as follows:\n\n| Bread Type     | Selling Price |\n|----------------|---------------|\n| Wheat          | $2 per loaf   |\n| Rye            | $2.50 per loaf|\n| Sourdough      | $3 per loaf   |\n| Specialty      | $4 per loaf   |\n\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg of flour, while each specialty loaf requires 0.7 kg of flour. The daily supply of flour is 200 kg. Each loaf of bread also requires 0.01 kg of yeast, and the daily supply of yeast is 1 kg.\n\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for specialty bread.\n\nPlease help the bakery to maximize the total daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nSpecialty = model.addVar(vtype=\"INTEGER\", name=\"Specialty\", lb=0) # number of specialty breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 4*Specialty)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*(Wheat + Rye + Sourdough) + 0.7*Specialty <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.01*(Wheat + Rye + Sourdough + Specialty) <= 1)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Specialty >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of specialty breads: \", model.getVal(Specialty))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while considering the constraints of available ingredients and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of specialty breads\": \"Specialty\", \"range\": \"Specialty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and specialty bread for $4 per loaf. The objective is to maximize the total daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 4*Specialty\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg of flour, while each specialty loaf requires 0.7 kg of flour. The daily supply of flour is 200 kg.\n// 0.5*(Wheat + Rye + Sourdough) + 0.7*Specialty <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The daily supply of yeast is 1 kg.\n// 0.01*(Wheat + Rye + Sourdough + Specialty) <= 1\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for specialty bread.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Specialty >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and specialty. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while considering the constraints of available ingredients and market demand. The bakery sells wheat bread for $2 per loaf, rye bread for $2.50 per loaf, sourdough bread for $3 per loaf, and specialty bread for $4 per loaf. The objective is to maximize the total daily revenue from bread sales. The bakery has a limited supply of flour and yeast. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg of flour, while each specialty loaf requires 0.7 kg of flour. The daily supply of flour is 200 kg. Each loaf of bread also requires 0.01 kg of yeast, and the daily supply of yeast is 1 kg. The bakery must meet a minimum daily demand for each type of bread. The minimum demand is 30 loaves for wheat bread, 25 loaves for rye bread, 20 loaves for sourdough bread, and 15 loaves for specialty bread. Please help the bakery determine the optimal daily production quantities of each type of bread to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nSpecialty = model.addVar(vtype=\"INTEGER\", name=\"Specialty\", lb=0) # number of specialty breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 4*Specialty)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*(Wheat + Rye + Sourdough) + 0.7*Specialty <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.01*(Wheat + Rye + Sourdough + Specialty) <= 1)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Specialty >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of specialty breads: \", model.getVal(Specialty))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.75, and each eclair is $1.00. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.75*Muf + 1.00*Ecl\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It can use up to 200 pounds of flour and 150 pounds of sugar daily. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, and each eclair requires 0.15 pounds of flour and 0.1 pounds of sugar.\n// 0.1*Cro + 0.2*Muf + 0.15*Ecl <= 200 (Flour constraint)\n// 0.1*Muf + 0.1*Ecl <= 150 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Cro >= 50, Muf >= 30, Ecl >= 20\n\n## Generate Constraint-3:\nThe bakery also has a storage constraint. The total number of pastries produced daily must not exceed 500.\n// Cro + Muf + Ecl <= 500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The profit from each croissant is $0.50, each muffin is $0.75, and each eclair is $1.00. The bakery has a limited supply of ingredients, with up to 200 pounds of flour and 150 pounds of sugar available daily. The requirements for each pastry are as follows:\n\n| Pastry   | Flour (pounds) | Sugar (pounds) |\n|----------|----------------|----------------|\n| Croissant| 0.1            | 0.0            |\n| Muffin   | 0.2            | 0.1            |\n| Eclair   | 0.15           | 0.1            |\n\nThe bakery has a minimum daily production requirement for each type of pastry: at least 50 croissants, 30 muffins, and 20 eclairs. Additionally, the bakery has a storage constraint, where the total number of pastries produced daily must not exceed 500.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries, considering all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.75*Muf + 1.00*Ecl)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Ecl <= 200) # Flour constraint\nmodel.addCons(0.1*Muf + 0.1*Ecl <= 150) # Sugar constraint\n## The bakery has a minimum daily production requirement for each type of pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 30)\nmodel.addCons(Ecl >= 20)\n## The bakery also has a storage constraint.\nmodel.addCons(Cro + Muf + Ecl <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.75, and each eclair is $1.00. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.75*Muf + 1.00*Ecl\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It can use up to 200 pounds of flour and 150 pounds of sugar daily. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, and each eclair requires 0.15 pounds of flour and 0.1 pounds of sugar.\n// 0.1*Cro + 0.2*Muf + 0.15*Ecl <= 200 (Flour constraint)\n// 0.1*Muf + 0.1*Ecl <= 150 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Cro >= 50, Muf >= 30, Ecl >= 20\n\n## Generate Constraint-3:\nThe bakery also has a storage constraint. The total number of pastries produced daily must not exceed 500.\n// Cro + Muf + Ecl <= 500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The profit from each croissant is $0.50, each muffin is $0.75, and each eclair is $1.00. The bakery has a limited supply of ingredients, with up to 200 pounds of flour and 150 pounds of sugar daily. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, and each eclair requires 0.15 pounds of flour and 0.1 pounds of sugar. The bakery has a minimum daily production requirement for each type of pastry, which includes at least 50 croissants, 30 muffins, and 20 eclairs. Additionally, the bakery has a storage constraint, where the total number of pastries produced daily must not exceed 500. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.75*Muf + 1.00*Ecl)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Ecl <= 200) # Flour constraint\nmodel.addCons(0.1*Muf + 0.1*Ecl <= 150) # Sugar constraint\n## The bakery has a minimum daily production requirement for each type of pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 30)\nmodel.addCons(Ecl >= 20)\n## The bakery also has a storage constraint.\nmodel.addCons(Cro + Muf + Ecl <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize the production quantities to maximize profit while considering the availability of ingredients and minimum daily production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of pastries in a mixed pack\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per mixed pack (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and eggs. Each croissant requires 50 grams of flour, each muffin requires 100 grams, each eclair requires 80 grams, and each mixed pack requires 70 grams. The daily supply of flour is 10 kilograms and eggs is 5 kilograms.\n// 0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 10000\n// 0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 5000\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, and 30 eclairs daily. Additionally, the mixed pack should be at least 10.\n// Cro >= 50\n// Muf >= 40\n// Ecl >= 30\n// Mix >= 10\n\n## Generate Constraint-3:\nThe total number of pastries produced (excluding the mixed packs) should not exceed 200.\n// Cro + Muf + Ecl <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs, and also offers a mixed pack containing one of each pastry. The bakery wants to optimize the production quantities to maximize profit while considering the availability of ingredients and minimum daily production requirements. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per mixed pack is $1.50. The bakery has a limited supply of flour and eggs, with each pastry type requiring different amounts of these ingredients as shown in the following Table.\n\n| Pastry       | Flour Requirement (grams) | Eggs Requirement (grams) |\n|--------------|--------------------------|-------------------------|\n| Croissant    | 50                       | 50                      |\n| Muffin       | 100                      | 100                     |\n| Eclair       | 80                       | 80                      |\n| Mixed Pack   | 70                       | 70                      |\n\nThe daily supply of flour is 10 kilograms and eggs is 5 kilograms. The bakery must produce at least 50 croissants, 40 muffins, 30 eclairs, and 10 mixed packs daily. Additionally, the total number of pastries produced (excluding the mixed packs) should not exceed 200. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of pastries in a mixed pack\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 1.50*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and eggs.\nmodel.addCons(0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 10000) # flour constraint\nmodel.addCons(0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 5000) # eggs constraint\n## The bakery must produce at least 50 croissants, 40 muffins, and 30 eclairs daily.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Ecl >= 30)\nmodel.addCons(Mix >= 10)\n## The total number of pastries produced (excluding the mixed packs) should not exceed 200.\nmodel.addCons(Cro + Muf + Ecl <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of pastries in a mixed pack: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1309,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery wants to optimize the production quantities to maximize profit while considering the availability of ingredients and minimum daily production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of pastries in a mixed pack\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per mixed pack (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and eggs. Each croissant requires 50 grams of flour, each muffin requires 100 grams, each eclair requires 80 grams, and each mixed pack requires 70 grams. The daily supply of flour is 10 kilograms and eggs is 5 kilograms.\n// 0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 10000\n// 0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 5000\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, and 30 eclairs daily. Additionally, the mixed pack should be at least 10.\n// Cro >= 50\n// Muf >= 40\n// Ecl >= 30\n// Mix >= 10\n\n## Generate Constraint-3:\nThe total number of pastries produced (excluding the mixed packs) should not exceed 200.\n// Cro + Muf + Ecl <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs, and also offers a mixed pack containing one of each pastry. The bakery wants to optimize the production quantities to maximize profit while considering the availability of ingredients and minimum daily production requirements. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per mixed pack is $1.50. The bakery has a limited supply of flour and eggs, with each pastry type requiring a specific amount of these ingredients. The daily supply of flour is 10 kilograms and eggs is 5 kilograms. The bakery must produce at least 50 croissants, 40 muffins, and 30 eclairs daily, and at least 10 mixed packs. Additionally, the total number of pastries produced (excluding the mixed packs) should not exceed 200. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of pastries in a mixed pack\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 1.50*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and eggs.\nmodel.addCons(0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 10000) # flour constraint\nmodel.addCons(0.05*Cro + 0.10*Muf + 0.08*Ecl + 0.07*Mix <= 5000) # eggs constraint\n## The bakery must produce at least 50 croissants, 40 muffins, and 30 eclairs daily.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Ecl >= 30)\nmodel.addCons(Mix >= 10)\n## The total number of pastries produced (excluding the mixed packs) should not exceed 200.\nmodel.addCons(Cro + Muf + Ecl <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of pastries in a mixed pack: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and minimum production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of gluten-free breads\": \"GlutenFree\", \"range\": \"GlutenFree >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, sourdough bread is $4, and gluten-free bread is $5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 5*GlutenFree\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast, each rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast, each sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast, and each gluten-free bread requires 0.6 pounds of flour and 0.1 ounces of yeast. The daily supply of flour is 150 pounds and yeast is 20 ounces.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*GlutenFree <= 150\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*GlutenFree <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + GlutenFree >= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to produce at least 10 loaves of each type of bread daily.\n// Wheat >= 10, Rye >= 10, Sourdough >= 10, GlutenFree >= 10",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and minimum production requirements. The profit per loaf of wheat bread is $2, rye bread is $3, sourdough bread is $4, and gluten-free bread is $5. The bakery aims to maximize its daily profit from bread sales. The following table shows the requirements for flour and yeast for each type of bread.\n\n| Bread Type       | Flour Requirement (pounds) | Yeast Requirement (ounces) |\n|------------------|---------------------------|---------------------------|\n| Wheat            | 0.5                       | 0.1                       |\n| Rye              | 0.4                       | 0.1                       |\n| Sourdough        | 0.3                       | 0.2                       |\n| Gluten-Free      | 0.6                       | 0.1                       |\n\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 150 pounds and yeast is 20 ounces. The bakery must produce at least 50 loaves of bread in total each day. Additionally, the bakery has a contract to produce at least 10 loaves of each type of bread daily. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nGlutenFree = model.addVar(vtype=\"INTEGER\", name=\"GlutenFree\", lb=0) # number of gluten-free breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 5*GlutenFree)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*GlutenFree <= 150) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*GlutenFree <= 20) # yeast constraint\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + GlutenFree >= 50)\n## The bakery has a contract to produce at least 10 loaves of each type of bread daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 10)\nmodel.addCons(Sourdough >= 10)\nmodel.addCons(GlutenFree >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of gluten-free breads: \", model.getVal(GlutenFree))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and minimum production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of gluten-free breads\": \"GlutenFree\", \"range\": \"GlutenFree >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, sourdough bread is $4, and gluten-free bread is $5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 5*GlutenFree\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast, each rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast, each sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast, and each gluten-free bread requires 0.6 pounds of flour and 0.1 ounces of yeast. The daily supply of flour is 150 pounds and yeast is 20 ounces.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*GlutenFree <= 150\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*GlutenFree <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + GlutenFree >= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to produce at least 10 loaves of each type of bread daily.\n// Wheat >= 10, Rye >= 10, Sourdough >= 10, GlutenFree >= 10",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and minimum production requirements.\nThe profit per loaf of wheat bread is $2, rye bread is $3, sourdough bread is $4, and gluten-free bread is $5. The bakery aims to maximize its daily profit from bread sales.\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast, each rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast, each sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast, and each gluten-free bread requires 0.6 pounds of flour and 0.1 ounces of yeast. The daily supply of flour is 150 pounds and yeast is 20 ounces.\nThe bakery must produce at least 50 loaves of bread in total each day. The bakery also has a contract to produce at least 10 loaves of each type of bread daily.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nGlutenFree = model.addVar(vtype=\"INTEGER\", name=\"GlutenFree\", lb=0) # number of gluten-free breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 5*GlutenFree)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*GlutenFree <= 150) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.1*GlutenFree <= 20) # yeast constraint\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + GlutenFree >= 50)\n## The bakery has a contract to produce at least 10 loaves of each type of bread daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 10)\nmodel.addCons(Sourdough >= 10)\nmodel.addCons(GlutenFree >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of gluten-free breads: \", model.getVal(GlutenFree))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\n// Wheat >= 10\n// Soy >= 15\n\n## Generate Constraint-3:\nDue to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\n// Corn + Barley <= 40",
        "question": "A farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources. The profit per acre for each crop is given in the following Table.\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $300            |\n| Soybeans | $250            |\n| Barley   | $150            |\n\nThe total available land for planting is 100 acres. The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans. Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres. Please help the farmer to maximize his total profit from these crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Soy >= 15)\n## Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\nmodel.addCons(Corn + Barley <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\n// Wheat >= 10\n// Soy >= 15\n\n## Generate Constraint-3:\nDue to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\n// Corn + Barley <= 40",
        "question": "A farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources. The profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The total available land for planting is 100 acres. The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans. Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres. Please help the farmer to maximize his total profit from these crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Soy >= 15)\n## Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\nmodel.addCons(Corn + Barley <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 663,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each type of bread is different: wheat breads yield $2 per loaf, rye breads yield $3 per loaf, sourdough breads yield $4 per loaf, and whole grain breads yield $3.50 per loaf. The bakery wants to determine the optimal number of loaves of each type of bread to maximize daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.05 pounds of yeast. Each rye bread requires 0.4 pounds of flour and 0.04 pounds of yeast. Each sourdough bread requires 0.3 pounds of flour and 0.03 pounds of yeast. Each whole grain bread requires 0.6 pounds of flour and 0.05 pounds of yeast. The daily supply of flour is 200 pounds and yeast is 15 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 200\n// 0.05*Wheat + 0.04*Rye + 0.03*Sourdough + 0.05*WholeGrain <= 15\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of bread. At least 30 loaves of wheat bread, 25 loaves of rye bread, 20 loaves of sourdough bread, and 35 loaves of whole grain bread must be produced daily.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, WholeGrain >= 35\n\n## Generate Constraint-3:\nThe total number of loaves produced daily should not exceed 200.\n// Wheat + Rye + Sourdough + WholeGrain <= 200",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The profit from each type of bread is different: wheat breads yield $2 per loaf, rye breads yield $3 per loaf, sourdough breads yield $4 per loaf, and whole grain breads yield $3.50 per loaf. The bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.05 pounds of yeast. Each rye bread requires 0.4 pounds of flour and 0.04 pounds of yeast. Each sourdough bread requires 0.3 pounds of flour and 0.03 pounds of yeast. Each whole grain bread requires 0.6 pounds of flour and 0.05 pounds of yeast. The daily supply of flour is 200 pounds and yeast is 15 pounds. The bakery has a minimum daily production requirement for each type of bread. At least 30 loaves of wheat bread, 25 loaves of rye bread, 20 loaves of sourdough bread, and 35 loaves of whole grain bread must be produced daily. The total number of loaves produced daily should not exceed 200.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to maximize daily profit.\n\n| Type of Bread | Profit per Loaf | Flour Required (lbs) | Yeast Required (lbs) |\n|---------------|-----------------|----------------------|----------------------|\n| Wheat         | $2              | 0.5                  | 0.05                 |\n| Rye           | $3              | 0.4                  | 0.04                 |\n| Sourdough     | $4              | 0.3                  | 0.03                 |\n| Whole Grain   | $3.50           | 0.6                  | 0.05                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWholeGrain = model.addVar(vtype=\"INTEGER\", name=\"WholeGrain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 200) # flour constraint\nmodel.addCons(0.05*Wheat + 0.04*Rye + 0.03*Sourdough + 0.05*WholeGrain <= 15) # yeast constraint\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(WholeGrain >= 35)\n## The total number of loaves produced daily should not exceed 200.\nmodel.addCons(Wheat + Rye + Sourdough + WholeGrain <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(WholeGrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1751,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each type of bread is different: wheat breads yield $2 per loaf, rye breads yield $3 per loaf, sourdough breads yield $4 per loaf, and whole grain breads yield $3.50 per loaf. The bakery wants to determine the optimal number of loaves of each type of bread to maximize daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.05 pounds of yeast. Each rye bread requires 0.4 pounds of flour and 0.04 pounds of yeast. Each sourdough bread requires 0.3 pounds of flour and 0.03 pounds of yeast. Each whole grain bread requires 0.6 pounds of flour and 0.05 pounds of yeast. The daily supply of flour is 200 pounds and yeast is 15 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 200\n// 0.05*Wheat + 0.04*Rye + 0.03*Sourdough + 0.05*WholeGrain <= 15\n\n## Generate Constraint-2:\nThe bakery has a minimum daily production requirement for each type of bread. At least 30 loaves of wheat bread, 25 loaves of rye bread, 20 loaves of sourdough bread, and 35 loaves of whole grain bread must be produced daily.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, WholeGrain >= 35\n\n## Generate Constraint-3:\nThe total number of loaves produced daily should not exceed 200.\n// Wheat + Rye + Sourdough + WholeGrain <= 200",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The profit from each type of bread is different: wheat breads yield $2 per loaf, rye breads yield $3 per loaf, sourdough breads yield $4 per loaf, and whole grain breads yield $3.50 per loaf. The bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour and 0.05 pounds of yeast. Each rye bread requires 0.4 pounds of flour and 0.04 pounds of yeast. Each sourdough bread requires 0.3 pounds of flour and 0.03 pounds of yeast. Each whole grain bread requires 0.6 pounds of flour and 0.05 pounds of yeast. The daily supply of flour is 200 pounds and yeast is 15 pounds. The bakery has a minimum daily production requirement for each type of bread. At least 30 loaves of wheat bread, 25 loaves of rye bread, 20 loaves of sourdough bread, and 35 loaves of whole grain bread must be produced daily. The total number of loaves produced daily should not exceed 200. Please help the bakery determine the optimal number of loaves of each type of bread to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWholeGrain = model.addVar(vtype=\"INTEGER\", name=\"WholeGrain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.6*WholeGrain <= 200) # flour constraint\nmodel.addCons(0.05*Wheat + 0.04*Rye + 0.03*Sourdough + 0.05*WholeGrain <= 15) # yeast constraint\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(WholeGrain >= 35)\n## The total number of loaves produced daily should not exceed 200.\nmodel.addCons(Wheat + Rye + Sourdough + WholeGrain <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(WholeGrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1257,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed grain loaves\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient.\n// Wheat <= 200\n// Rye <= 150\n// Sourdough <= 100\n\n## Generate Constraint-2:\nThe mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient.\n// Mixed <= 200 (Wheat flour constraint)\n// Mixed <= 150 (Rye flour constraint)\n// Mixed <= 100 (Sourdough starter constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + Mixed >= 50",
        "question": "A bakery is planning to produce four types of bread: wheat, rye, sourdough, and mixed grain. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The selling price for each type of bread is as follows:\n\n| Bread Type    | Selling Price |\n|---------------|---------------|\n| Wheat         | $2            |\n| Rye           | $2.50         |\n| Sourdough     | $3            |\n| Mixed Grain   | $3.50         |\n\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient. The mixed grain loaf requires 1/2 pound of each type of flour, and the total amount of mixed grain loaves should not exceed the availability of any single ingredient. The bakery must produce at least 50 loaves of bread in total each day.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(Wheat <= 200) # Wheat flour is limited to 200 pounds\nmodel.addCons(Rye <= 150) # Rye flour to 150 pounds\nmodel.addCons(Sourdough <= 100) # Sourdough starter to 100 pounds\n## The mixed grain loaf requires 1/2 pound of each type of flour.\nmodel.addCons(Mixed <= 200) # Mixed should not exceed Wheat flour availability\nmodel.addCons(Mixed <= 150) # Mixed should not exceed Rye flour availability\nmodel.addCons(Mixed <= 100) # Mixed should not exceed Sourdough starter availability\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + Mixed >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of mixed grain loaves: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed grain loaves\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient.\n// Wheat <= 200\n// Rye <= 150\n// Sourdough <= 100\n\n## Generate Constraint-2:\nThe mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient.\n// Mixed <= 200 (Wheat flour constraint)\n// Mixed <= 150 (Rye flour constraint)\n// Mixed <= 100 (Sourdough starter constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + Mixed >= 50",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough, as well as mixed grain loaves. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales. The bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient. The mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient. The bakery must produce at least 50 loaves of bread in total each day. Please help the bakery to maximize its daily revenue from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(Wheat <= 200) # Wheat flour is limited to 200 pounds\nmodel.addCons(Rye <= 150) # Rye flour to 150 pounds\nmodel.addCons(Sourdough <= 100) # Sourdough starter to 100 pounds\n## The mixed grain loaf requires 1/2 pound of each type of flour.\nmodel.addCons(Mixed <= 200) # Mixed should not exceed Wheat flour availability\nmodel.addCons(Mixed <= 150) # Mixed should not exceed Rye flour availability\nmodel.addCons(Mixed <= 100) # Mixed should not exceed Sourdough starter availability\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + Mixed >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of mixed grain loaves: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of pasture\": \"Pasture\", \"range\": \"Pasture >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The farmer wants to maximize his total profit from all crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 100*Pasture\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Pasture <= 100\n\n## Generate Constraint-2:\nThe farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\n// Corn >= 0.30 * (Wheat + Corn + Soy + Pasture)\n\n## Generate Constraint-3:\nThe farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\n// Soy >= 20",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and also maintain pasture. He needs to decide how many acres to allocate to each to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre for each type of crop is given in the following Table.\n\n| Crop       | Profit per Acre |\n|------------|-----------------|\n| Wheat      | $200            |\n| Corn       | $300            |\n| Soybeans   | $250            |\n| Pasture    | $100            |\n\nThe total available land for planting is 100 acres. The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock. Additionally, the farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\n\nPlease help the farmer to maximize his total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nPasture = model.addVar(vtype=\"INTEGER\", name=\"Pasture\", lb=0) # acres of pasture\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 100*Pasture)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Pasture <= 100)\n## The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\nmodel.addCons(Corn >= 0.30 * (Wheat + Corn + Soy + Pasture))\n## The farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\nmodel.addCons(Soy >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Pasture: \", model.getVal(Pasture))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of pasture\": \"Pasture\", \"range\": \"Pasture >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The farmer wants to maximize his total profit from all crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 100*Pasture\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Pasture <= 100\n\n## Generate Constraint-2:\nThe farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\n// Corn >= 0.30 * (Wheat + Corn + Soy + Pasture)\n\n## Generate Constraint-3:\nThe farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\n// Soy >= 20",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and also needs to allocate some land for pasture. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The total available land for planting is 100 acres. The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock. Additionally, the farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company. Please help the farmer to maximize his total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nPasture = model.addVar(vtype=\"INTEGER\", name=\"Pasture\", lb=0) # acres of pasture\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 100*Pasture)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Pasture <= 100)\n## The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\nmodel.addCons(Corn >= 0.30 * (Wheat + Corn + Soy + Pasture))\n## The farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\nmodel.addCons(Soy >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Pasture: \", model.getVal(Pasture))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each multigrain bread for $4. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3*Wheat + 2.50*Rye + 3.50*Sourdough + 4*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour, each rye bread requires 0.4 pounds, each sourdough bread requires 0.6 pounds, and each multigrain bread requires 0.7 pounds. The total daily supply of flour is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each type of bread requires 0.05 pounds of yeast. The total daily supply of yeast is 10 pounds.\n// 0.05*(Wheat + Rye + Sourdough + Multigrain) <= 10\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 30 wheat breads, 25 rye breads, 20 sourdough breads, and 15 multigrain breads.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Multigrain >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The selling price for each type of bread is as follows:\n\n| Bread Type     | Selling Price |\n|----------------|---------------|\n| Wheat          | $3            |\n| Rye            | $2.50         |\n| Sourdough      | $3.50         |\n| Multigrain     | $4            |\n\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour, each rye bread requires 0.4 pounds, each sourdough bread requires 0.6 pounds, and each multigrain bread requires 0.7 pounds. The total daily supply of flour is 200 pounds. Each type of bread also requires 0.05 pounds of yeast, and the total daily supply of yeast is 10 pounds.\n\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 30 wheat breads, 25 rye breads, 20 sourdough breads, and 15 multigrain breads.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 2.50*Rye + 3.50*Sourdough + 4*Multigrain)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.05*(Wheat + Rye + Sourdough + Multigrain) <= 10)\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Multigrain >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of multigrain breads: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each multigrain bread for $4. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3*Wheat + 2.50*Rye + 3.50*Sourdough + 4*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour, each rye bread requires 0.4 pounds, each sourdough bread requires 0.6 pounds, and each multigrain bread requires 0.7 pounds. The total daily supply of flour is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 200\n\n## Generate Constraint-2:\nThe bakery also has a limited supply of yeast. Each type of bread requires 0.05 pounds of yeast. The total daily supply of yeast is 10 pounds.\n// 0.05*(Wheat + Rye + Sourdough + Multigrain) <= 10\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 30 wheat breads, 25 rye breads, 20 sourdough breads, and 15 multigrain breads.\n// Wheat >= 30, Rye >= 25, Sourdough >= 20, Multigrain >= 15",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery wants to optimize its daily production to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The bakery sells each wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each multigrain bread for $4. The bakery has a limited supply of flour and yeast. Each wheat bread requires 0.5 pounds of flour, each rye bread requires 0.4 pounds, each sourdough bread requires 0.6 pounds, and each multigrain bread requires 0.7 pounds. The total daily supply of flour is 200 pounds. Each type of bread also requires 0.05 pounds of yeast, and the total daily supply of yeast is 10 pounds. The bakery has a minimum daily production requirement for each type of bread. It must produce at least 30 wheat breads, 25 rye breads, 20 sourdough breads, and 15 multigrain breads. Please help the bakery to maximize its daily revenue from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 2.50*Rye + 3.50*Sourdough + 4*Multigrain)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 200)\n## The bakery also has a limited supply of yeast.\nmodel.addCons(0.05*(Wheat + Rye + Sourdough + Multigrain) <= 10)\n## The bakery has a minimum daily production requirement for each type of bread.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 25)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Multigrain >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of multigrain breads: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to optimize the production of these cakes to maximize its daily profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of mixed flavor cakes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, per strawberry cake is $3, and per mixed flavor cake (containing equal parts of each flavor) is $6. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Str + 6*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavor. Each chocolate cake requires 2 pounds of chocolate, each vanilla cake requires 1.5 pounds of vanilla, each strawberry cake requires 1 pound of strawberry, and each mixed cake requires 1 pound of each flavor.\n// 2*Choc + 1.5*Van + 1*Str + 1*Mix <= 200\n// 1.5*Van + 1*Mix <= 150\n// 1*Str + 1*Mix <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 30 cakes of each type per day to meet customer demand and maintain brand presence.\n// Choc >= 30, Van >= 30, Str >= 30, Mix >= 30\n\n## Generate Constraint-3:\nThe total number of cakes produced daily should not exceed 100 to ensure quality and freshness.\n// Choc + Van + Str + Mix <= 100",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry, as well as mixed flavor cakes. The bakery wants to optimize the production of these cakes to maximize its daily profit while considering the availability of ingredients and the minimum daily production requirement. The profit per chocolate cake is $5, per vanilla cake is $4, per strawberry cake is $3, and per mixed flavor cake is $6. The following table summarizes the ingredient requirements and profit per cake:\n\n| Cake Type       | Profit per Cake | Chocolate Ingredient (lbs) | Vanilla Ingredient (lbs) | Strawberry Ingredient (lbs) |\n|-----------------|-----------------|----------------------------|--------------------------|-----------------------------|\n| Chocolate       | $5              | 2                          | 0                        | 0                           |\n| Vanilla         | $4              | 0                          | 1.5                      | 0                           |\n| Strawberry      | $3              | 0                          | 0                        | 1                           |\n| Mixed Flavor    | $6              | 1                          | 1                        | 1                           |\n\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavor. Each chocolate cake requires 2 pounds of chocolate, each vanilla cake requires 1.5 pounds of vanilla, each strawberry cake requires 1 pound of strawberry, and each mixed cake requires 1 pound of each flavor. The bakery must produce at least 30 cakes of each type per day to meet customer demand and maintain brand presence. The total number of cakes produced daily should not exceed 100 to ensure quality and freshness.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStr = model.addVar(vtype=\"INTEGER\", name=\"Str\", lb=0) # number of strawberry cakes\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed flavor cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Str + 6*Mix)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(2*Choc + 1.5*Van + 1*Str + 1*Mix <= 200)\nmodel.addCons(1.5*Van + 1*Mix <= 150)\nmodel.addCons(1*Str + 1*Mix <= 100)\n## The bakery must produce at least 30 cakes of each type per day\nmodel.addCons(Choc >= 30)\nmodel.addCons(Van >= 30)\nmodel.addCons(Str >= 30)\nmodel.addCons(Mix >= 30)\n## The total number of cakes produced daily should not exceed 100\nmodel.addCons(Choc + Van + Str + Mix <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Str))\n    print(\"Number of mixed flavor cakes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1860,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to optimize the production of these cakes to maximize its daily profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of mixed flavor cakes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, per strawberry cake is $3, and per mixed flavor cake (containing equal parts of each flavor) is $6. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Str + 6*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavor. Each chocolate cake requires 2 pounds of chocolate, each vanilla cake requires 1.5 pounds of vanilla, each strawberry cake requires 1 pound of strawberry, and each mixed cake requires 1 pound of each flavor.\n// 2*Choc + 1.5*Van + 1*Str + 1*Mix <= 200\n// 1.5*Van + 1*Mix <= 150\n// 1*Str + 1*Mix <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 30 cakes of each type per day to meet customer demand and maintain brand presence.\n// Choc >= 30, Van >= 30, Str >= 30, Mix >= 30\n\n## Generate Constraint-3:\nThe total number of cakes produced daily should not exceed 100 to ensure quality and freshness.\n// Choc + Van + Str + Mix <= 100",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry, as well as mixed flavor cakes. The bakery wants to optimize the production of these cakes to maximize its daily profit while considering the availability of ingredients and the minimum daily production requirement. The profit per chocolate cake is $5, per vanilla cake is $4, per strawberry cake is $3, and per mixed flavor cake is $6. The bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavor. Each chocolate cake requires 2 pounds of chocolate, each vanilla cake requires 1.5 pounds of vanilla, each strawberry cake requires 1 pound of strawberry, and each mixed cake requires 1 pound of each flavor. The bakery must produce at least 30 cakes of each type per day to meet customer demand and maintain brand presence. The total number of cakes produced daily should not exceed 100 to ensure quality and freshness. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStr = model.addVar(vtype=\"INTEGER\", name=\"Str\", lb=0) # number of strawberry cakes\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed flavor cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Str + 6*Mix)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(2*Choc + 1.5*Van + 1*Str + 1*Mix <= 200)\nmodel.addCons(1.5*Van + 1*Mix <= 150)\nmodel.addCons(1*Str + 1*Mix <= 100)\n## The bakery must produce at least 30 cakes of each type per day\nmodel.addCons(Choc >= 30)\nmodel.addCons(Van >= 30)\nmodel.addCons(Str >= 30)\nmodel.addCons(Mix >= 30)\n## The total number of cakes produced daily should not exceed 100\nmodel.addCons(Choc + Van + Str + Mix <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Str))\n    print(\"Number of mixed flavor cakes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and minimum production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of pastries in a mixed box\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe price of a croissant is $1.50, a muffin is $2.00, a doughnut is $1.00, and a mixed box containing one of each pastry is $4.00. The bakery aims to maximize its daily revenue.\n// Objective Function: Maximize: 1.50*Cro + 2.00*Muf + 1.00*Don + 4.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and sugar. The daily supply of flour is 300 pounds, and sugar is 150 pounds. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each doughnut requires 0.15 pounds of flour and 0.05 pounds of sugar, and each mixed box requires 0.1 pounds of flour and 0.05 pounds of sugar.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.1*Mix <= 300 (Flour constraint)\n// 0.1*Muf + 0.05*Don + 0.05*Mix <= 150 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily to meet the minimum customer demand.\n// Cro >= 50\n// Muf >= 40\n// Don >= 30\n\n## Generate Constraint-3:\nThe bakery aims to promote its mixed box, so it must produce at least 20 mixed boxes daily.\n// Mix >= 20",
        "question": "A bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts, as well as mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and minimum production requirements. The price of a croissant is $1.50, a muffin is $2.00, a doughnut is $1.00, and a mixed box is $4.00. The bakery has a limited supply of flour and sugar. The daily supply of flour is 300 pounds, and sugar is 150 pounds. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each doughnut requires 0.15 pounds of flour and 0.05 pounds of sugar, and each mixed box requires 0.1 pounds of flour and 0.05 pounds of sugar. The bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily to meet the minimum customer demand. Additionally, the bakery aims to promote its mixed box, so it must produce at least 20 mixed boxes daily.\n\nPlease help the bakery to maximize its daily revenue.\n\n| Pastry Type | Price | Flour Required (pounds) | Sugar Required (pounds) |\n|-------------|-------|-------------------------|-------------------------|\n| Croissant   | $1.50 | 0.1                     | 0.0                     |\n| Muffin      | $2.00 | 0.2                     | 0.1                     |\n| Doughnut    | $1.00 | 0.15                    | 0.05                    |\n| Mixed Box   | $4.00 | 0.1                     | 0.05                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of pastries in a mixed box\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Cro + 2.00*Muf + 1.00*Don + 4.00*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and sugar.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.1*Mix <= 300) # Flour constraint\nmodel.addCons(0.1*Muf + 0.05*Don + 0.05*Mix <= 150) # Sugar constraint\n## The bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Don >= 30)\n## The bakery aims to promote its mixed box, so it must produce at least 20 mixed boxes daily.\nmodel.addCons(Mix >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Number of pastries in a mixed box: \", model.getVal(Mix))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1540,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and minimum production requirements.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of pastries in a mixed box\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe price of a croissant is $1.50, a muffin is $2.00, a doughnut is $1.00, and a mixed box containing one of each pastry is $4.00. The bakery aims to maximize its daily revenue.\n// Objective Function: Maximize: 1.50*Cro + 2.00*Muf + 1.00*Don + 4.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and sugar. The daily supply of flour is 300 pounds, and sugar is 150 pounds. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each doughnut requires 0.15 pounds of flour and 0.05 pounds of sugar, and each mixed box requires 0.1 pounds of flour and 0.05 pounds of sugar.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.1*Mix <= 300 (Flour constraint)\n// 0.1*Muf + 0.05*Don + 0.05*Mix <= 150 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily to meet the minimum customer demand.\n// Cro >= 50\n// Muf >= 40\n// Don >= 30\n\n## Generate Constraint-3:\nThe bakery aims to promote its mixed box, so it must produce at least 20 mixed boxes daily.\n// Mix >= 20",
        "question": "A bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts, as well as mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and minimum production requirements. The price of a croissant is $1.50, a muffin is $2.00, a doughnut is $1.00, and a mixed box is $4.00. The bakery has a limited supply of flour and sugar, with a daily supply of 300 pounds of flour and 150 pounds of sugar. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each doughnut requires 0.15 pounds of flour and 0.05 pounds of sugar, and each mixed box requires 0.1 pounds of flour and 0.05 pounds of sugar. The bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily to meet the minimum customer demand. Additionally, the bakery aims to promote its mixed box and must produce at least 20 mixed boxes daily. Please help the bakery to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of pastries in a mixed box\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Cro + 2.00*Muf + 1.00*Don + 4.00*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and sugar.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.1*Mix <= 300) # Flour constraint\nmodel.addCons(0.1*Muf + 0.05*Don + 0.05*Mix <= 150) # Sugar constraint\n## The bakery must produce at least 50 croissants, 40 muffins, and 30 doughnuts daily.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Don >= 30)\n## The bakery aims to promote its mixed box, so it must produce at least 20 mixed boxes daily.\nmodel.addCons(Mix >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Number of pastries in a mixed box: \", model.getVal(Mix))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively.\n// Objective Function: Maximize: 2b1 + 3b2 + 4b3 + 5b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively. The bakery has a daily supply of 100 kg of flour.\n// Constraint-1: 0.5b1 + 0.7b2 + 0.6b3 + 0.8b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast. The amount of yeast required to produce one loaf of Bread 1-4 is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. The bakery has a daily supply of 2 kg of yeast.\n// Constraint-2: 0.01b1 + 0.02b2 + 0.015b3 + 0.025b4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\n// Constraint-3: b1 >= 50",
        "question": "A bakery produces four types of bread (Bread 1-4) and must decide how many loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively. The bakery has a limited daily supply of flour and yeast, with the amount of flour and yeast required to produce one loaf of each type of bread given in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Yeast Required (kg) |\n|------------|-----------------|---------------------|---------------------|\n| Bread 1    | $2              | 0.5                 | 0.01                |\n| Bread 2    | $3              | 0.7                 | 0.02                |\n| Bread 3    | $4              | 0.6                 | 0.015               |\n| Bread 4    | $5              | 0.8                 | 0.025               |\n\nThe bakery has a daily supply of 100 kg of flour and 2 kg of yeast. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation. Please help the bakery maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*b1 + 3*b2 + 4*b3 + 5*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.6*b3 + 0.8*b4 <= 100)\n## The bakery also has a limited daily supply of yeast.\nmodel.addCons(0.01*b1 + 0.02*b2 + 0.015*b3 + 0.025*b4 <= 2)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(b1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively.\n// Objective Function: Maximize: 2b1 + 3b2 + 4b3 + 5b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively. The bakery has a daily supply of 100 kg of flour.\n// Constraint-1: 0.5b1 + 0.7b2 + 0.6b3 + 0.8b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast. The amount of yeast required to produce one loaf of Bread 1-4 is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. The bakery has a daily supply of 2 kg of yeast.\n// Constraint-2: 0.01b1 + 0.02b2 + 0.015b3 + 0.025b4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\n// Constraint-3: b1 >= 50",
        "question": "A bakery produces four types of bread (bread 1-4) and must decide how many loaves of each type of bread to produce daily. The bakery wants to maximize its daily profit from selling bread. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively. The bakery has a limited daily supply of 100 kg of flour and 2 kg of yeast. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively, and the amount of yeast required is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. Additionally, the bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*b1 + 3*b2 + 4*b3 + 5*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.6*b3 + 0.8*b4 <= 100)\n## The bakery also has a limited daily supply of yeast.\nmodel.addCons(0.01*b1 + 0.02*b2 + 0.015*b3 + 0.025*b4 <= 2)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(b1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many units of each widget to produce daily.\n// {\"number of units of Widget A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily revenue from selling these widgets.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each widget requires a certain amount of raw materials. The total raw materials available daily are limited to 100 units.\n// Constraint-1: 5a + 3b + 4c + 2d <= 100\n\n## Generate Constraint-2:\nThe production of each widget requires a certain amount of labor hours. The total labor hours available daily are limited to 80 hours.\n// Constraint-2: 2a + 4b + 3c + 1d <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 50 units. This constraint ensures that the total number of widgets produced does not exceed the storage capacity.\n// Constraint-3: a + b + c + d <= 50",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many units of each widget to produce daily. The company aims to maximize its daily revenue from selling these widgets. The following table provides the revenue per unit for each widget.\n\n| Widget | Revenue per Unit |\n|--------|------------------|\n| A      | 50$              |\n| B      | 30$              |\n| C      | 40$              |\n| D      | 20$              |\n\nThe company faces several constraints:\n1. The production of each widget requires a certain amount of raw materials. The total raw materials available daily are limited to 100 units.\n2. The production of each widget requires a certain amount of labor hours. The total labor hours available daily are limited to 80 hours.\n3. The company has a storage capacity limit of 50 units. This constraint ensures that the total number of widgets produced does not exceed the storage capacity.\n\nPlease help the company determine the optimal number of units of each widget to produce daily to maximize its revenue, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Widget A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Widget B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Widget C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available daily are limited to 100 units.\nmodel.addCons(5*a + 3*b + 4*c + 2*d <= 100)\n## Constraint-2: The total labor hours available daily are limited to 80 hours.\nmodel.addCons(2*a + 4*b + 3*c + 1*d <= 80)\n## Constraint-3: The company has a storage capacity limit of 50 units.\nmodel.addCons(a + b + c + d <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Widget A: \", model.getVal(a))\n    print(\"Number of units of Widget B: \", model.getVal(b))\n    print(\"Number of units of Widget C: \", model.getVal(c))\n    print(\"Number of units of Widget D: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many units of each widget to produce daily.\n// {\"number of units of Widget A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily revenue from selling these widgets.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each widget requires a certain amount of raw materials. The total raw materials available daily are limited to 100 units.\n// Constraint-1: 5a + 3b + 4c + 2d <= 100\n\n## Generate Constraint-2:\nThe production of each widget requires a certain amount of labor hours. The total labor hours available daily are limited to 80 hours.\n// Constraint-2: 2a + 4b + 3c + 1d <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 50 units. This constraint ensures that the total number of widgets produced does not exceed the storage capacity.\n// Constraint-3: a + b + c + d <= 50",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many units of each widget to produce daily. The company wants to maximize its daily revenue from selling these widgets. The production of each widget requires a certain amount of raw materials, with a total of 100 units available daily. Additionally, the production requires labor hours, with a total of 80 hours available daily. The company also has a storage capacity limit of 50 units, ensuring that the total number of widgets produced does not exceed this capacity.\n\nPlease help the company determine the optimal number of units of each widget to produce daily to maximize its revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Widget A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Widget B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Widget C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available daily are limited to 100 units.\nmodel.addCons(5*a + 3*b + 4*c + 2*d <= 100)\n## Constraint-2: The total labor hours available daily are limited to 80 hours.\nmodel.addCons(2*a + 4*b + 3*c + 1*d <= 80)\n## Constraint-3: The company has a storage capacity limit of 50 units.\nmodel.addCons(a + b + c + d <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Widget A: \", model.getVal(a))\n    print(\"Number of units of Widget B: \", model.getVal(b))\n    print(\"Number of units of Widget C: \", model.getVal(c))\n    print(\"Number of units of Widget D: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread per day.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\n// Constraint-3: w >= 2s",
        "question": "A bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery has a contract to supply at least 30 loaves of rye bread per day. Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Wheat      | $2              |\n| Rye        | $3              |\n| Sourdough  | $4              |\n| Whole Grain| $3              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*g)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread per day.\nmodel.addCons(r >= 30)\n## Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\nmodel.addCons(w >= 2*s)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of whole grain bread loaves: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread per day.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\n// Constraint-3: w >= 2s",
        "question": "A bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain. The bakery aims to maximize its daily profit from selling these bread types. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery has a contract to supply at least 30 loaves of rye bread per day. Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*g)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread per day.\nmodel.addCons(r >= 30)\n## Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\nmodel.addCons(w >= 2*s)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of whole grain bread loaves: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 747,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling all four products.\n// Objective Function: Maximize: 50a + 70b + 60c + 80d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10a + 15b + 20c + 25d <= 1000\n\n## Generate Constraint-2:\nThe production process also requires labor hours. The total labor hours available are limited to 800 hours.\n// Constraint-2: 5a + 10b + 15c + 20d <= 800\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// Constraint-3: a >= 2b",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced. The company aims to maximize its total profit from selling all four products. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n| D       | 80$             |\n\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units. The production process also requires labor hours, and the total labor hours available are limited to 800 hours. Due to market demand, the production of Product A must be at least twice the production of Product B.\n\nPlease help the company determine the optimal number of units of each product to produce in order to maximize its total profit, subject to the constraints on raw materials and labor hours, and the market demand requirement for Product A.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 70*b + 60*c + 80*d)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*a + 15*b + 20*c + 25*d <= 1000)\n## The total labor hours available are limited to 800 hours.\nmodel.addCons(5*a + 10*b + 15*c + 20*d <= 800)\n## The production of Product A must be at least twice the production of Product B.\nmodel.addCons(a >= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling all four products.\n// Objective Function: Maximize: 50a + 70b + 60c + 80d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10a + 15b + 20c + 25d <= 1000\n\n## Generate Constraint-2:\nThe production process also requires labor hours. The total labor hours available are limited to 800 hours.\n// Constraint-2: 5a + 10b + 15c + 20d <= 800\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// Constraint-3: a >= 2b",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced. The company aims to maximize its total profit from selling all four products. The production of each product requires a certain amount of raw materials, and the total raw materials available are limited to 1000 units. The production process also requires labor hours, and the total labor hours available are limited to 800 hours. Due to market demand, the production of Product A must be at least twice the production of Product B. Please help the company determine the optimal number of units of each product to produce to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 70*b + 60*c + 80*d)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*a + 15*b + 20*c + 25*d <= 1000)\n## The total labor hours available are limited to 800 hours.\nmodel.addCons(5*a + 10*b + 15*c + 20*d <= 800)\n## The production of Product A must be at least twice the production of Product B.\nmodel.addCons(a >= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 723,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily.\n// {\"number of wheat breads\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3w + 4r + 5s + 6m\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg.\n// Constraint: 0.5w + 0.4r + 0.6s + 0.7m <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg.\n// Constraint: 0.1w + 0.15r + 0.2s + 0.25m <= 10\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement.\n// Constraint: w >= 20",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling these bread types.\n\n| Bread Type | Profit per Bread | Flour Required (kg) | Yeast Required (kg) |\n|------------|------------------|---------------------|---------------------|\n| Wheat      | 3$               | 0.5                 | 0.1                 |\n| Rye        | 4$               | 0.4                 | 0.15                |\n| Sourdough  | 5$               | 0.6                 | 0.2                 |\n| Multigrain | 6$               | 0.7                 | 0.25                |\n\nThe bakery has a limited daily supply of flour, which is 100 kg, and a limited daily supply of yeast, which is 10 kg. The bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement.\n\nPlease help the bakery to maximize its daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat breads\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye breads\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough breads\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 6*m)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*w + 0.4*r + 0.6*s + 0.7*m <= 100)\n## The bakery also has a limited daily supply of yeast\nmodel.addCons(0.1*w + 0.15*r + 0.2*s + 0.25*m <= 10)\n## The bakery must ensure that at least 20 wheat breads are produced daily\nmodel.addCons(w >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(w))\n    print(\"Number of rye breads: \", model.getVal(r))\n    print(\"Number of sourdough breads: \", model.getVal(s))\n    print(\"Number of multigrain breads: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily.\n// {\"number of wheat breads\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3w + 4r + 5s + 6m\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg.\n// Constraint: 0.5w + 0.4r + 0.6s + 0.7m <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg.\n// Constraint: 0.1w + 0.15r + 0.2s + 0.25m <= 10\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement.\n// Constraint: w >= 20",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling these bread types. The bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg. The bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg. The bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat breads\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye breads\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough breads\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 6*m)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*w + 0.4*r + 0.6*s + 0.7*m <= 100)\n## The bakery also has a limited daily supply of yeast\nmodel.addCons(0.1*w + 0.15*r + 0.2*s + 0.25*m <= 10)\n## The bakery must ensure that at least 20 wheat breads are produced daily\nmodel.addCons(w >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(w))\n    print(\"Number of rye breads: \", model.getVal(r))\n    print(\"Number of sourdough breads: \", model.getVal(s))\n    print(\"Number of multigrain breads: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available for production are limited to 1000 units.\n// Constraint-1: 10a + 5b + 8c + 3d <= 1000\n\n## Generate Constraint-2:\nThe production of each product requires a certain amount of labor hours. The total labor hours available for production are limited to 800 hours.\n// Constraint-2: 20a + 15b + 10c + 5d <= 800\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 500 units.\n// Constraint-3: a + b + c + d <= 500",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the profit per unit for each product.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n| C       | 40$             |\n| D       | 20$             |\n\nThe production of each product requires a certain amount of raw materials and labor hours. The total raw materials available for production are limited to 1000 units, and the total labor hours available for production are limited to 800 hours. Additionally, the company has a storage capacity limit of 500 units.\n\nPlease help the company determine the optimal number of units to produce for each product (A, B, C, D) to maximize its total profit, subject to the constraints on raw materials, labor hours, and storage capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available for production are limited to 1000 units.\nmodel.addCons(10*a + 5*b + 8*c + 3*d <= 1000)\n## Constraint-2: The total labor hours available for production are limited to 800 hours.\nmodel.addCons(20*a + 15*b + 10*c + 5*d <= 800)\n## Constraint-3: The company has a storage capacity limit of 500 units.\nmodel.addCons(a + b + c + d <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available for production are limited to 1000 units.\n// Constraint-1: 10a + 5b + 8c + 3d <= 1000\n\n## Generate Constraint-2:\nThe production of each product requires a certain amount of labor hours. The total labor hours available for production are limited to 800 hours.\n// Constraint-2: 20a + 15b + 10c + 5d <= 800\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 500 units.\n// Constraint-3: a + b + c + d <= 500",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. The production of each product requires a certain amount of raw materials, and the total raw materials available for production are limited to 1000 units. Additionally, the production of each product requires a certain amount of labor hours, and the total labor hours available for production are limited to 800 hours. The company also has a storage capacity limit of 500 units. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available for production are limited to 1000 units.\nmodel.addCons(10*a + 5*b + 8*c + 3*d <= 1000)\n## Constraint-2: The total labor hours available for production are limited to 800 hours.\nmodel.addCons(20*a + 15*b + 10*c + 5*d <= 800)\n## Constraint-3: The company has a storage capacity limit of 500 units.\nmodel.addCons(a + b + c + d <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 688,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not.\n// {\"whether to produce Product A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 500y1 + 300y2 + 400y3 + 200y4\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited.\n// Raw materials required for Product A, B, C, D are 10, 15, 20, 5 units respectively. The total raw materials available are 50 units.\n// Constraint: 10y1 + 15y2 + 20y3 + 5y4 <= 50\n\n## Generate Constraint-2:\nThe production of each product also requires a certain amount of labor hours. The total labor hours available are limited.\n// Labor hours required for Product A, B, C, D are 8, 10, 12, 6 hours respectively. The total labor hours available are 40 hours.\n// Constraint: 8y1 + 10y2 + 12y3 + 6y4 <= 40\n\n## Generate Constraint-3:\nThe company wants to ensure that at least two types of products are produced to diversify its product line.\n// Constraint: y1 + y2 + y3 + y4 >= 2",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not. The company aims to maximize its total profit from the production of these products. The raw materials and labor hours required for each product, as well as the total available resources, are given in the following Table.\n\n| Product | Raw Materials Required | Labor Hours Required |\n|---------|------------------------|----------------------|\n| A       | 10 units               | 8 hours              |\n| B       | 15 units               | 10 hours             |\n| C       | 20 units               | 12 hours             |\n| D       | 5 units                | 6 hours              |\n\nThe total raw materials available are 50 units, and the total labor hours available are 40 hours. The company wants to ensure that at least two types of products are produced to diversify its product line. Please help the company determine whether to produce each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to produce Product A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to produce Product B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to produce Product C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500*y1 + 300*y2 + 400*y3 + 200*y4)\n\n# Add constraints\n## The total raw materials available are 50 units.\nmodel.addCons(10*y1 + 15*y2 + 20*y3 + 5*y4 <= 50)\n## The total labor hours available are 40 hours.\nmodel.addCons(8*y1 + 10*y2 + 12*y3 + 6*y4 <= 40)\n## The company wants to ensure that at least two types of products are produced.\nmodel.addCons(y1 + y2 + y3 + y4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(y1))\n    print(\"Whether to produce Product B: \", model.getVal(y2))\n    print(\"Whether to produce Product C: \", model.getVal(y3))\n    print(\"Whether to produce Product D: \", model.getVal(y4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not.\n// {\"whether to produce Product A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 500y1 + 300y2 + 400y3 + 200y4\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited.\n// Raw materials required for Product A, B, C, D are 10, 15, 20, 5 units respectively. The total raw materials available are 50 units.\n// Constraint: 10y1 + 15y2 + 20y3 + 5y4 <= 50\n\n## Generate Constraint-2:\nThe production of each product also requires a certain amount of labor hours. The total labor hours available are limited.\n// Labor hours required for Product A, B, C, D are 8, 10, 12, 6 hours respectively. The total labor hours available are 40 hours.\n// Constraint: 8y1 + 10y2 + 12y3 + 6y4 <= 40\n\n## Generate Constraint-3:\nThe company wants to ensure that at least two types of products are produced to diversify its product line.\n// Constraint: y1 + y2 + y3 + y4 >= 2",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D) and needs to decide whether to produce each product or not. The company aims to maximize its total profit from the production of these products. The production of each product requires a certain amount of raw materials and labor hours. The total raw materials available are 50 units, with Product A, B, C, D requiring 10, 15, 20, 5 units of raw materials respectively. The total labor hours available are 40 hours, with Product A, B, C, D requiring 8, 10, 12, 6 hours respectively. The company wants to ensure that at least two types of products are produced to diversify its product line.\nPlease help the company determine whether to produce each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to produce Product A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to produce Product B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to produce Product C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500*y1 + 300*y2 + 400*y3 + 200*y4)\n\n# Add constraints\n## The total raw materials available are 50 units.\nmodel.addCons(10*y1 + 15*y2 + 20*y3 + 5*y4 <= 50)\n## The total labor hours available are 40 hours.\nmodel.addCons(8*y1 + 10*y2 + 12*y3 + 6*y4 <= 40)\n## The company wants to ensure that at least two types of products are produced.\nmodel.addCons(y1 + y2 + y3 + y4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(y1))\n    print(\"Whether to produce Product B: \", model.getVal(y2))\n    print(\"Whether to produce Product C: \", model.getVal(y3))\n    print(\"Whether to produce Product D: \", model.getVal(y4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many of each type of widget to produce daily.\n// {\"number of Widget A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Widget D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily profit from widget sales. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited daily production capacity of 200 widgets.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nDue to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\n// Constraint-2: b <= 2a\n\n## Generate Constraint-3:\nThe demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\n// Constraint-3: c >= 0.20 * (a + b + d)",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many of each type to produce daily. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D. The company has a limited daily production capacity of 200 widgets. Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A. The demand for Widget C requires that its production must be at least 20% of the total production of Widgets A, B, and D.\n\n| Widget | Profit per Widget |\n|--------|-------------------|\n| A      | $5                |\n| B      | $7                |\n| C      | $6                |\n| D      | $8                |\n\nPlease help the company maximize its daily profit from widget sales, given the constraints mentioned above.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of widget produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Widget A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Widget B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Widget C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Widget D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited daily production capacity of 200 widgets.\nmodel.addCons(a + b + c + d <= 200)\n## Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\nmodel.addCons(b <= 2*a)\n## The demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\nmodel.addCons(c >= 0.20 * (a + b + d))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(a))\n    print(\"Number of Widget B produced: \", model.getVal(b))\n    print(\"Number of Widget C produced: \", model.getVal(c))\n    print(\"Number of Widget D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many of each type of widget to produce daily.\n// {\"number of Widget A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Widget D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily profit from widget sales. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited daily production capacity of 200 widgets.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nDue to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\n// Constraint-2: b <= 2a\n\n## Generate Constraint-3:\nThe demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\n// Constraint-3: c >= 0.20 * (a + b + d)",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many of each type to produce daily. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D. The company has a limited daily production capacity of 200 widgets. Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A. The demand for Widget C requires that its production must be at least 20% of the total production of Widgets A, B, and D. The company wants to maximize its daily profit from widget sales. Please help the company determine the optimal number of each type of widget to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of widget produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Widget A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Widget B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Widget C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Widget D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited daily production capacity of 200 widgets.\nmodel.addCons(a + b + c + d <= 200)\n## Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\nmodel.addCons(b <= 2*a)\n## The demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\nmodel.addCons(c >= 0.20 * (a + b + d))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(a))\n    print(\"Number of Widget B produced: \", model.getVal(b))\n    print(\"Number of Widget C produced: \", model.getVal(c))\n    print(\"Number of Widget D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not.\n// {\"whether to invest in Project A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from all the projects.\n// Objective Function: Maximize: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,500,000 for all projects.\n// Constraint-1: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000\n\n## Generate Constraint-2:\nDue to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint-2: y1 + y2 + y3 + y4 <= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\n// Constraint-3: y1 + y2 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not. The company aims to maximize the total expected return from all the projects. The company has a budget constraint of $1,500,000 for all projects. Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously. Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\n\n| Project | Expected Return |\n|---------|-----------------|\n| A       | 500,000$        |\n| B       | 750,000$        |\n| C       | 600,000$        |\n| D       | 800,000$        |\n\nPlease help the company determine whether to invest in each project (0 for not investing, 1 for investing) to maximize the total expected return while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to invest in Project A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to invest in Project B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to invest in Project C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4)\n\n# Add constraints\n## The company has a budget constraint of $1,500,000 for all projects.\nmodel.addCons(500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000)\n## Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(y1 + y2 + y3 + y4 <= 2)\n## Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\nmodel.addCons(y1 + y2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(y1))\n    print(\"Invest in Project B: \", model.getVal(y2))\n    print(\"Invest in Project C: \", model.getVal(y3))\n    print(\"Invest in Project D: \", model.getVal(y4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not.\n// {\"whether to invest in Project A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from all the projects.\n// Objective Function: Maximize: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,500,000 for all projects.\n// Constraint-1: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000\n\n## Generate Constraint-2:\nDue to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint-2: y1 + y2 + y3 + y4 <= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\n// Constraint-3: y1 + y2 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not. The company aims to maximize the total expected return from all the projects. The company has a budget constraint of $1,500,000 for all projects. Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously. Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together. Please help the company determine the optimal investment strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to invest in Project A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to invest in Project B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to invest in Project C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4)\n\n# Add constraints\n## The company has a budget constraint of $1,500,000 for all projects.\nmodel.addCons(500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000)\n## Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(y1 + y2 + y3 + y4 <= 2)\n## Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\nmodel.addCons(y1 + y2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(y1))\n    print(\"Invest in Project B: \", model.getVal(y2))\n    print(\"Invest in Project C: \", model.getVal(y3))\n    print(\"Invest in Project D: \", model.getVal(y4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 583,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales, where the profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. Due to a contractual agreement, the bakery must ensure that at least 50 loaves of wheat bread are produced daily. Additionally, there is a minimum demand for rye bread, which is 30 loaves per day.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize their daily profit.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n| Multigrain    | $5              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement. Additionally, the bakery has a minimum demand for rye bread, which is 30 loaves per day. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 689,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 3 hours, Product C takes 1 hour, and Product D takes 2 hours. The total production hours available per day are 40 hours.\n// Constraint-2: 2a + 3b + c + 2d <= 40\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C, which must be at least 5 units.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the required raw material and production time for each product.\n\n| Product | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------------|--------------------------|\n| A       | 3 units               | 2 hours                  |\n| B       | 2 units               | 3 hours                  |\n| C       | 4 units               | 1 hour                   |\n| D       | 1 unit                | 2 hours                  |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production line has a limited capacity, with a total of 40 hours available per day. Additionally, the company has a minimum order requirement for Product C, which must be at least 5 units.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + c + 2*d <= 40)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 3 hours, Product C takes 1 hour, and Product D takes 2 hours. The total production hours available per day are 40 hours.\n// Constraint-2: 2a + 3b + c + 2d <= 40\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C, which must be at least 5 units.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 3 hours, Product C requires 4 units of raw material and takes 1 hour, and Product D requires 1 unit of raw material and takes 2 hours. The total raw material available is 100 units, and the total production hours available per day are 40 hours. The company has a minimum order requirement for Product C, which must be at least 5 units. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + c + 2*d <= 40)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0).\n// {\"whether to invest in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4.\n// Constraint: 250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000\n\n## Generate Constraint-2:\nDue to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint: p1 + p2 + p3 + p4 <= 2\n\n## Generate Constraint-3:\nProject 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\n// Constraint: p1 + p2 <= 1",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0). The company aims to maximize the total expected profit from all the projects. The cost and expected profit for each project are given in the following Table.\n\n| Project | Cost | Expected Profit |\n|---------|------|-----------------|\n| 1       | $250,000 | $500,000 |\n| 2       | $200,000 | $300,000 |\n| 3       | $300,000 | $400,000 |\n| 4       | $150,000 | $200,000 |\n\nThe company has a budget constraint of $1,000,000. Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously. Additionally, Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\n\nPlease help the company determine whether to invest in each project to maximize its total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\np1 = model.addVar(vtype=\"BINARY\", name=\"p1\") # whether to invest in Project 1\np2 = model.addVar(vtype=\"BINARY\", name=\"p2\") # whether to invest in Project 2\np3 = model.addVar(vtype=\"BINARY\", name=\"p3\") # whether to invest in Project 3\np4 = model.addVar(vtype=\"BINARY\", name=\"p4\") # whether to invest in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a budget constraint of $1,000,000.\nmodel.addCons(250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000)\n## Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(p1 + p2 + p3 + p4 <= 2)\n## Project 1 and Project 2 are mutually exclusive.\nmodel.addCons(p1 + p2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project 1: \", model.getVal(p1))\n    print(\"Whether to invest in Project 2: \", model.getVal(p2))\n    print(\"Whether to invest in Project 3: \", model.getVal(p3))\n    print(\"Whether to invest in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0).\n// {\"whether to invest in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4.\n// Constraint: 250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000\n\n## Generate Constraint-2:\nDue to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint: p1 + p2 + p3 + p4 <= 2\n\n## Generate Constraint-3:\nProject 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\n// Constraint: p1 + p2 <= 1",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0). The company aims to maximize the total expected profit from all the projects. The company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4. Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously. Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\nPlease help the company determine whether to invest in each project to maximize its total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\np1 = model.addVar(vtype=\"BINARY\", name=\"p1\") # whether to invest in Project 1\np2 = model.addVar(vtype=\"BINARY\", name=\"p2\") # whether to invest in Project 2\np3 = model.addVar(vtype=\"BINARY\", name=\"p3\") # whether to invest in Project 3\np4 = model.addVar(vtype=\"BINARY\", name=\"p4\") # whether to invest in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a budget constraint of $1,000,000.\nmodel.addCons(250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000)\n## Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(p1 + p2 + p3 + p4 <= 2)\n## Project 1 and Project 2 are mutually exclusive.\nmodel.addCons(p1 + p2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project 1: \", model.getVal(p1))\n    print(\"Whether to invest in Project 2: \", model.getVal(p2))\n    print(\"Whether to invest in Project 3: \", model.getVal(p3))\n    print(\"Whether to invest in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize their daily revenue from selling pastries. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5.\n// Objective Function: Maximize: 2c + 3m + 1.5d + 2.5e\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\n// Constraint-1: 0.5c + 0.7m + 0.4d + 0.6e <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\n// Constraint-2: 5c + 7m + 4d + 6e <= 600\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\n// Constraint-3: c >= 20, m >= 20, d >= 20, e >= 20",
        "question": "A bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs. The selling price for each pastry is as follows:\n\n| Pastry   | Selling Price |\n|----------|---------------|\n| Croissants | $2           |\n| Muffins    | $3           |\n| Doughnuts  | $1.5         |\n| Eclairs    | $2.5         |\n\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\n\nThe bakery also has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\n\nAdditionally, the bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize their daily revenue from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of doughnuts\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*d + 2.5*e)\n\n# Add constraints\n## The total daily ingredient cost must not exceed $50.\nmodel.addCons(0.5*c + 0.7*m + 0.4*d + 0.6*e <= 50)\n## The total daily oven time must not exceed 600 minutes.\nmodel.addCons(5*c + 7*m + 4*d + 6*e <= 600)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(d >= 20)\nmodel.addCons(e >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of doughnuts: \", model.getVal(d))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize their daily revenue from selling pastries. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5.\n// Objective Function: Maximize: 2c + 3m + 1.5d + 2.5e\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\n// Constraint-1: 0.5c + 0.7m + 0.4d + 0.6e <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\n// Constraint-2: 5c + 7m + 4d + 6e <= 600\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\n// Constraint-3: c >= 20, m >= 20, d >= 20, e >= 20",
        "question": "A bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5. The bakery aims to maximize their daily revenue from selling pastries.\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\nThe bakery also has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\nAdditionally, the bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\nPlease help the bakery determine the optimal number of each type of pastry to produce daily to maximize their revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of doughnuts\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*d + 2.5*e)\n\n# Add constraints\n## The total daily ingredient cost must not exceed $50.\nmodel.addCons(0.5*c + 0.7*m + 0.4*d + 0.6*e <= 50)\n## The total daily oven time must not exceed 600 minutes.\nmodel.addCons(5*c + 7*m + 4*d + 6*e <= 600)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(d >= 20)\nmodel.addCons(e >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of doughnuts: \", model.getVal(d))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit.\n// {\"units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively.\n// Objective Function: Maximize: 10a + 15b + 20c + 25d\n\n## Generate Constraint-1:\nThe production capacity of the company allows for a maximum of 100 units in total across all products.\n// Constraint-1: a + b + c + d <= 100\n\n## Generate Constraint-2:\nDue to limited resources, the production of Product B is limited to at most 30 units.\n// Constraint-2: b <= 30\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of Product A to fulfill a contract.\n// Constraint-3: a >= 20",
        "question": "A company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $10             |\n| B       | $15             |\n| C       | $20             |\n| D       | $25             |\n\nThe company has a production capacity that allows for a maximum of 100 units in total across all products. Due to limited resources, the production of Product B is limited to at most 30 units. Additionally, the company must produce at least 20 units of Product A to fulfill a contract.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit, subject to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*a + 15*b + 20*c + 25*d)\n\n# Add constraints\n## The production capacity of the company allows for a maximum of 100 units in total across all products.\nmodel.addCons(a + b + c + d <= 100)\n## Due to limited resources, the production of Product B is limited to at most 30 units.\nmodel.addCons(b <= 30)\n## The company must produce at least 20 units of Product A to fulfill a contract.\nmodel.addCons(a >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit.\n// {\"units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively.\n// Objective Function: Maximize: 10a + 15b + 20c + 25d\n\n## Generate Constraint-1:\nThe production capacity of the company allows for a maximum of 100 units in total across all products.\n// Constraint-1: a + b + c + d <= 100\n\n## Generate Constraint-2:\nDue to limited resources, the production of Product B is limited to at most 30 units.\n// Constraint-2: b <= 30\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of Product A to fulfill a contract.\n// Constraint-3: a >= 20",
        "question": "A company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively. The production capacity of the company allows for a maximum of 100 units in total across all products. Due to limited resources, the production of Product B is limited to at most 30 units. The company must produce at least 20 units of Product A to fulfill a contract. Please help the company to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*a + 15*b + 20*c + 25*d)\n\n# Add constraints\n## The production capacity of the company allows for a maximum of 100 units in total across all products.\nmodel.addCons(a + b + c + d <= 100)\n## Due to limited resources, the production of Product B is limited to at most 30 units.\nmodel.addCons(b <= 30)\n## The company must produce at least 20 units of Product A to fulfill a contract.\nmodel.addCons(a >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 579,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3x1 + 4x2 + 5x3 + 6x4 (Profit per loaf is $3 for Whole Wheat, $4 for Rye, $5 for Sourdough, and $6 for Brioche)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively.\n// Constraint: 0.5x1 + 0.4x2 + 0.6x3 + 0.7x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 10, 15, 20, and 25 loaves respectively.\n// Constraint: x1 >= 10\n// Constraint: x2 >= 15\n// Constraint: x3 >= 20\n// Constraint: x4 >= 25\n\n## Generate Constraint-3:\nThe bakery has a daily labor constraint, with a maximum of 8 hours available. Each loaf of bread requires 0.05 hours of labor.\n// Constraint: 0.05x1 + 0.05x2 + 0.05x3 + 0.05x4 <= 8",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit from selling these four types of bread. The profit per loaf is $3 for Whole Wheat, $4 for Rye, $5 for Sourdough, and $6 for Brioche. The bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery has a daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 10, 15, 20, and 25 loaves respectively. The bakery also has a daily labor constraint, with a maximum of 8 hours available. Each loaf of bread requires 0.05 hours of labor.\n\nPlease help the bakery to maximize its daily profit while meeting these constraints.\n\n| Bread Type     | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|----------------|-----------------|-------------------------|-------------------------|\n| Whole Wheat    | $3              | 0.5 kg                  | 0.05 hours              |\n| Rye            | $4              | 0.4 kg                  | 0.05 hours              |\n| Sourdough      | $5              | 0.6 kg                  | 0.05 hours              |\n| Brioche        | $6              | 0.7 kg                  | 0.05 hours              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 100)\n## The bakery has a daily demand for each type of bread\nmodel.addCons(x1 >= 10)\nmodel.addCons(x2 >= 15)\nmodel.addCons(x3 >= 20)\nmodel.addCons(x4 >= 25)\n## The bakery has a daily labor constraint\nmodel.addCons(0.05*x1 + 0.05*x2 + 0.05*x3 + 0.05*x4 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Quantity of Rye bread: \", model.getVal(x2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1400,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3x1 + 4x2 + 5x3 + 6x4 (Profit per loaf is $3 for Whole Wheat, $4 for Rye, $5 for Sourdough, and $6 for Brioche)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively.\n// Constraint: 0.5x1 + 0.4x2 + 0.6x3 + 0.7x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 10, 15, 20, and 25 loaves respectively.\n// Constraint: x1 >= 10\n// Constraint: x2 >= 15\n// Constraint: x3 >= 20\n// Constraint: x4 >= 25\n\n## Generate Constraint-3:\nThe bakery has a daily labor constraint, with a maximum of 8 hours available. Each loaf of bread requires 0.05 hours of labor.\n// Constraint: 0.05x1 + 0.05x2 + 0.05x3 + 0.05x4 <= 8",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit from selling these four types of bread, where the profit per loaf is $3 for Whole Wheat, $4 for Rye, $5 for Sourdough, and $6 for Brioche. The bakery has a limited daily supply of 100 kg of flour, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery also has a daily demand for each type of bread, with the minimum demand for Whole Wheat, Rye, Sourdough, and Brioche being 10, 15, 20, and 25 loaves respectively. Additionally, the bakery has a daily labor constraint, with a maximum of 8 hours available, and each loaf of bread requires 0.05 hours of labor. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 100)\n## The bakery has a daily demand for each type of bread\nmodel.addCons(x1 >= 10)\nmodel.addCons(x2 >= 15)\nmodel.addCons(x3 >= 20)\nmodel.addCons(x4 >= 25)\n## The bakery has a daily labor constraint\nmodel.addCons(0.05*x1 + 0.05*x2 + 0.05*x3 + 0.05*x4 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Quantity of Rye bread: \", model.getVal(x2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"p\", \"range\": \"p >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling bread and pastries.\n// Objective Function: Maximize: 3w + 4r + 5s + 2p\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\n// Constraint-1: w + r + s <= 100\n\n## Generate Constraint-2:\nThe bakery's pastry oven can handle up to 50 pastries per day.\n// Constraint-2: p <= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 20 wheat bread loaves per day.\n// Constraint-3: w >= 20",
        "question": "A bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make. The bakery aims to maximize its daily revenue from selling bread and pastries. The revenue from each type of item is as follows:\n\n| Item          | Revenue per Item |\n|---------------|------------------|\n| Wheat Bread   | 3$               |\n| Rye Bread     | 4$               |\n| Sourdough Bread | 5$             |\n| Pastries      | 2$               |\n\nThe bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day. The bakery's pastry oven can handle up to 50 pastries per day. The bakery also has a contract to supply at least 20 wheat bread loaves per day.\n\nPlease help the bakery determine the optimal number of each type of item to produce daily to maximize revenue, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of pastries\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough bread loaves\np = model.addVar(vtype=\"INTEGER\", name=\"p\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 2*p)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\nmodel.addCons(w + r + s <= 100)\n## The bakery's pastry oven can handle up to 50 pastries per day.\nmodel.addCons(p <= 50)\n## The bakery has a contract to supply at least 20 wheat bread loaves per day.\nmodel.addCons(w >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of pastries: \", model.getVal(p))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"p\", \"range\": \"p >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling bread and pastries.\n// Objective Function: Maximize: 3w + 4r + 5s + 2p\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\n// Constraint-1: w + r + s <= 100\n\n## Generate Constraint-2:\nThe bakery's pastry oven can handle up to 50 pastries per day.\n// Constraint-2: p <= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 20 wheat bread loaves per day.\n// Constraint-3: w >= 20",
        "question": "A bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make. The bakery aims to maximize its daily revenue from selling bread and pastries. The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day. The bakery's pastry oven can handle up to 50 pastries per day. The bakery also has a contract to supply at least 20 wheat bread loaves per day. Please help the bakery determine the optimal number of each type of bread and pastries to produce to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of pastries\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough bread loaves\np = model.addVar(vtype=\"INTEGER\", name=\"p\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 2*p)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\nmodel.addCons(w + r + s <= 100)\n## The bakery's pastry oven can handle up to 50 pastries per day.\nmodel.addCons(p <= 50)\n## The bakery has a contract to supply at least 20 wheat bread loaves per day.\nmodel.addCons(w >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of pastries: \", model.getVal(p))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 597,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce.\n// {\"number of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited budget and can only spend up to $1000 on production costs. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively.\n// Constraint-1: 20a + 15b + 25c + 10d <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce and can only produce up to 30 units in total.\n// Constraint-2: a + b + c + d <= 30\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\n// Constraint-3: a >= 5\n// Constraint-4: d <= 10",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce. The company aims to maximize its total profit from selling these products. The cost of producing each unit and the profit per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Profit per Unit |\n|---------|---------------|-----------------|\n| A       | $20           | $50             |\n| B       | $15           | $30             |\n| C       | $25           | $40             |\n| D       | $10           | $20             |\n\nThe company has a limited budget and can only spend up to $1000 on production costs. The company has a limited workforce and can only produce up to 30 units in total. Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\nPlease help the company to determine the optimal number of each product to produce in order to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited budget and can only spend up to $1000 on production costs.\nmodel.addCons(20*a + 15*b + 25*c + 10*d <= 1000)\n## The company has a limited workforce and can only produce up to 30 units in total.\nmodel.addCons(a + b + c + d <= 30)\n## Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\nmodel.addCons(a >= 5)\nmodel.addCons(d <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(a))\n    print(\"Number of Product B: \", model.getVal(b))\n    print(\"Number of Product C: \", model.getVal(c))\n    print(\"Number of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce.\n// {\"number of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited budget and can only spend up to $1000 on production costs. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively.\n// Constraint-1: 20a + 15b + 25c + 10d <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce and can only produce up to 30 units in total.\n// Constraint-2: a + b + c + d <= 30\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\n// Constraint-3: a >= 5\n// Constraint-4: d <= 10",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D) and needs to determine the number of each product to produce. The company aims to maximize its total profit from selling these products. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively, and the company has a limited budget of $1000 for production costs. The company also has a limited workforce and can only produce up to 30 units in total. Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D. Please help the company to maximize its total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited budget and can only spend up to $1000 on production costs.\nmodel.addCons(20*a + 15*b + 25*c + 10*d <= 1000)\n## The company has a limited workforce and can only produce up to 30 units in total.\nmodel.addCons(a + b + c + d <= 30)\n## Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\nmodel.addCons(a >= 5)\nmodel.addCons(d <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(a))\n    print(\"Number of Product B: \", model.getVal(b))\n    print(\"Number of Product C: \", model.getVal(c))\n    print(\"Number of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 667,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0).\n// {\"whether to invest in Project A\": \"x1\", \"range\": \"x1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"x2\", \"range\": \"x2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"x3\", \"range\": \"x3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"x4\", \"range\": \"x4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively.\n// Objective Function: Maximize: 100000x1 + 150000x2 + 200000x3 + 120000x4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively.\n// Constraint: 50000x1 + 75000x2 + 100000x3 + 60000x4 <= 300000\n\n## Generate Constraint-2:\nDue to strategic considerations, the company must invest in at least two projects.\n// Constraint: x1 + x2 + x3 + x4 >= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive; the company cannot invest in both.\n// Constraint: x1 + x2 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0). The expected returns and costs for each project are given in the following Table.\n\n| Project | Expected Return | Cost |\n|---------|-----------------|------|\n| A       | $100,000        | $50,000 |\n| B       | $150,000        | $75,000 |\n| C       | $200,000        | $100,000 |\n| D       | $120,000        | $60,000 |\n\nThe company has a budget constraint of $300,000. Due to strategic considerations, the company must invest in at least two projects. Additionally, Project A and Project B are mutually exclusive; the company cannot invest in both. \n\nPlease help the company to maximize the total expected return from the investments.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\nx1 = model.addVar(vtype=\"BINARY\", name=\"x1\") # whether to invest in Project A\nx2 = model.addVar(vtype=\"BINARY\", name=\"x2\") # whether to invest in Project B\nx3 = model.addVar(vtype=\"BINARY\", name=\"x3\") # whether to invest in Project C\nx4 = model.addVar(vtype=\"BINARY\", name=\"x4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100000*x1 + 150000*x2 + 200000*x3 + 120000*x4)\n\n# Add constraints\n## The company has a budget constraint of $300,000.\nmodel.addCons(50000*x1 + 75000*x2 + 100000*x3 + 60000*x4 <= 300000)\n## Due to strategic considerations, the company must invest in at least two projects.\nmodel.addCons(x1 + x2 + x3 + x4 >= 2)\n## Project A and Project B are mutually exclusive; the company cannot invest in both.\nmodel.addCons(x1 + x2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(x1))\n    print(\"Invest in Project B: \", model.getVal(x2))\n    print(\"Invest in Project C: \", model.getVal(x3))\n    print(\"Invest in Project D: \", model.getVal(x4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0).\n// {\"whether to invest in Project A\": \"x1\", \"range\": \"x1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"x2\", \"range\": \"x2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"x3\", \"range\": \"x3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"x4\", \"range\": \"x4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively.\n// Objective Function: Maximize: 100000x1 + 150000x2 + 200000x3 + 120000x4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively.\n// Constraint: 50000x1 + 75000x2 + 100000x3 + 60000x4 <= 300000\n\n## Generate Constraint-2:\nDue to strategic considerations, the company must invest in at least two projects.\n// Constraint: x1 + x2 + x3 + x4 >= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive; the company cannot invest in both.\n// Constraint: x1 + x2 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0). The company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively. The company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively. Due to strategic considerations, the company must invest in at least two projects. Additionally, Project A and Project B are mutually exclusive; the company cannot invest in both. Please help the company determine the optimal investment strategy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\nx1 = model.addVar(vtype=\"BINARY\", name=\"x1\") # whether to invest in Project A\nx2 = model.addVar(vtype=\"BINARY\", name=\"x2\") # whether to invest in Project B\nx3 = model.addVar(vtype=\"BINARY\", name=\"x3\") # whether to invest in Project C\nx4 = model.addVar(vtype=\"BINARY\", name=\"x4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100000*x1 + 150000*x2 + 200000*x3 + 120000*x4)\n\n# Add constraints\n## The company has a budget constraint of $300,000.\nmodel.addCons(50000*x1 + 75000*x2 + 100000*x3 + 60000*x4 <= 300000)\n## Due to strategic considerations, the company must invest in at least two projects.\nmodel.addCons(x1 + x2 + x3 + x4 >= 2)\n## Project A and Project B are mutually exclusive; the company cannot invest in both.\nmodel.addCons(x1 + x2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(x1))\n    print(\"Invest in Project B: \", model.getVal(x2))\n    print(\"Invest in Project C: \", model.getVal(x3))\n    print(\"Invest in Project D: \", model.getVal(x4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of bread (B), croissants (C), muffins (M), and bagels (Ba) to produce each day to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of bread\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Ba\", \"range\": \"Ba >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf of bread is $2, per croissant is $1.5, per muffin is $1.2, and per bagel is $1.\n// Objective Function: Maximize: 2B + 1.5C + 1.2M + 1Ba\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 0.5 kg of flour for each loaf of bread, 0.2 kg for each croissant, 0.3 kg for each muffin, and 0.1 kg for each bagel. The total daily flour usage must not exceed 100 kg.\n// Constraint-1: 0.5B + 0.2C + 0.3M + 0.1Ba <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited oven time. It takes 10 minutes to bake each loaf of bread, 5 minutes for each croissant, 8 minutes for each muffin, and 4 minutes for each bagel. The total daily oven time must not exceed 8 hours (480 minutes).\n// Constraint-2: 10B + 5C + 8M + 4Ba <= 480\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each product. The minimum demand for loaves of bread is 50, for croissants is 100, for muffins is 80, and for bagels is 120.\n// Constraint-3: B >= 50\n// Constraint-4: C >= 100\n// Constraint-5: M >= 80\n// Constraint-6: Ba >= 120",
        "question": "A bakery needs to decide how many loaves of bread (B), croissants (C), muffins (M), and bagels (Ba) to produce each day to maximize profit while meeting customer demand and resource constraints. The profit per loaf of bread is $2, per croissant is $1.5, per muffin is $1.2, and per bagel is $1. The bakery has a limited amount of flour available each day, using 0.5 kg of flour for each loaf of bread, 0.2 kg for each croissant, 0.3 kg for each muffin, and 0.1 kg for each bagel, with a total daily flour usage not exceeding 100 kg. The bakery also has a limited oven time, taking 10 minutes to bake each loaf of bread, 5 minutes for each croissant, 8 minutes for each muffin, and 4 minutes for each bagel, with a total daily oven time not exceeding 8 hours (480 minutes). The bakery must meet a minimum daily demand for each product: 50 loaves of bread, 100 croissants, 80 muffins, and 120 bagels.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each product to produce.\n\n| Product | Profit per Unit | Flour Usage (kg) | Oven Time (minutes) | Minimum Demand |\n|---------|-----------------|------------------|----------------------|----------------|\n| Bread   | $2              | 0.5              | 10                   | 50             |\n| Croissant | $1.5          | 0.2              | 5                    | 100            |\n| Muffin  | $1.2           | 0.3              | 8                    | 80             |\n| Bagel   | $1              | 0.1              | 4                    | 120            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of loaves of bread\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nBa = model.addVar(vtype=\"INTEGER\", name=\"Ba\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B + 1.5*C + 1.2*M + 1*Ba)\n\n# Add constraints\n## Constraint-1: Total daily flour usage must not exceed 100 kg.\nmodel.addCons(0.5*B + 0.2*C + 0.3*M + 0.1*Ba <= 100)\n## Constraint-2: Total daily oven time must not exceed 8 hours (480 minutes).\nmodel.addCons(10*B + 5*C + 8*M + 4*Ba <= 480)\n## Constraint-3: Bakery must meet a minimum daily demand for each product.\nmodel.addCons(B >= 50)\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 80)\nmodel.addCons(Ba >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of bread: \", model.getVal(B))\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(Ba))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1546,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of bread (B), croissants (C), muffins (M), and bagels (Ba) to produce each day to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of bread\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Ba\", \"range\": \"Ba >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf of bread is $2, per croissant is $1.5, per muffin is $1.2, and per bagel is $1.\n// Objective Function: Maximize: 2B + 1.5C + 1.2M + 1Ba\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 0.5 kg of flour for each loaf of bread, 0.2 kg for each croissant, 0.3 kg for each muffin, and 0.1 kg for each bagel. The total daily flour usage must not exceed 100 kg.\n// Constraint-1: 0.5B + 0.2C + 0.3M + 0.1Ba <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited oven time. It takes 10 minutes to bake each loaf of bread, 5 minutes for each croissant, 8 minutes for each muffin, and 4 minutes for each bagel. The total daily oven time must not exceed 8 hours (480 minutes).\n// Constraint-2: 10B + 5C + 8M + 4Ba <= 480\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each product. The minimum demand for loaves of bread is 50, for croissants is 100, for muffins is 80, and for bagels is 120.\n// Constraint-3: B >= 50\n// Constraint-4: C >= 100\n// Constraint-5: M >= 80\n// Constraint-6: Ba >= 120",
        "question": "A bakery needs to decide how many loaves of bread (B), croissants (C), muffins (M), and bagels (Ba) to produce each day to maximize profit while meeting customer demand and resource constraints. The profit per loaf of bread is $2, per croissant is $1.5, per muffin is $1.2, and per bagel is $1. The bakery has a limited amount of flour available each day, using 0.5 kg of flour for each loaf of bread, 0.2 kg for each croissant, 0.3 kg for each muffin, and 0.1 kg for each bagel, with the total daily flour usage not exceeding 100 kg. The bakery also has a limited oven time, taking 10 minutes to bake each loaf of bread, 5 minutes for each croissant, 8 minutes for each muffin, and 4 minutes for each bagel, with the total daily oven time not exceeding 8 hours (480 minutes). The bakery must meet a minimum daily demand for each product: 50 loaves of bread, 100 croissants, 80 muffins, and 120 bagels. Please help the bakery maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of loaves of bread\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nBa = model.addVar(vtype=\"INTEGER\", name=\"Ba\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B + 1.5*C + 1.2*M + 1*Ba)\n\n# Add constraints\n## Constraint-1: Total daily flour usage must not exceed 100 kg.\nmodel.addCons(0.5*B + 0.2*C + 0.3*M + 0.1*Ba <= 100)\n## Constraint-2: Total daily oven time must not exceed 8 hours (480 minutes).\nmodel.addCons(10*B + 5*C + 8*M + 4*Ba <= 480)\n## Constraint-3: Bakery must meet a minimum daily demand for each product.\nmodel.addCons(B >= 50)\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 80)\nmodel.addCons(Ba >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of bread: \", model.getVal(B))\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(Ba))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours.\n// Constraint-1: 0.5w + 0.75r + s + 0.8m <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg.\n// Constraint-2: 0.5w + 0.6r + 0.7s + 0.8m <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Constraint-3: w >= 20, r >= 20, s >= 20, m >= 20",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain. The bakery has a limited oven capacity of 100 hours per day, and the baking times for each loaf are as follows:\n\n| Bread Type | Baking Time per Loaf |\n|------------|----------------------|\n| Wheat      | 0.5 hours            |\n| Rye        | 0.75 hours           |\n| Sourdough  | 1 hour               |\n| Multigrain | 0.8 hours            |\n\nAdditionally, the bakery has a daily supply of 150 kg of flour, and each loaf requires the following amount of flour:\n\n| Bread Type | Flour Required per Loaf |\n|------------|-------------------------|\n| Wheat      | 0.5 kg                  |\n| Rye        | 0.6 kg                  |\n| Sourdough  | 0.7 kg                  |\n| Multigrain | 0.8 kg                  |\n\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery determine the optimal daily production quantities to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # quantity of sourdough bread\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 100 hours per day.\nmodel.addCons(0.5*w + 0.75*r + s + 0.8*m <= 100)\n## The bakery has a daily supply of 150 kg of flour.\nmodel.addCons(0.5*w + 0.6*r + 0.7*s + 0.8*m <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(w >= 20)\nmodel.addCons(r >= 20)\nmodel.addCons(s >= 20)\nmodel.addCons(m >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of multigrain bread: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours.\n// Constraint-1: 0.5w + 0.75r + s + 0.8m <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg.\n// Constraint-2: 0.5w + 0.6r + 0.7s + 0.8m <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Constraint-3: w >= 20, r >= 20, s >= 20, m >= 20",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain. The bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours. The bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg. The bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # quantity of sourdough bread\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 100 hours per day.\nmodel.addCons(0.5*w + 0.75*r + s + 0.8*m <= 100)\n## The bakery has a daily supply of 150 kg of flour.\nmodel.addCons(0.5*w + 0.6*r + 0.7*s + 0.8*m <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(w >= 20)\nmodel.addCons(r >= 20)\nmodel.addCons(s >= 20)\nmodel.addCons(m >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of multigrain bread: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. Each project can either be fully invested in (1) or not invested in (0).\n// {\"investment in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a limited budget of $800,000 for all projects. The cost of each project is $200,000 for Project 1, $150,000 for Project 2, $250,000 for Project 3, and $100,000 for Project 4.\n// Constraint: 200000*p1 + 150000*p2 + 250000*p3 + 100000*p4 <= 800000\n\n## Generate Constraint-2:\nDue to strategic reasons, the company must invest in at least two projects.\n// Constraint: p1 + p2 + p3 + p4 >= 2\n\n## Generate Constraint-3:\nProject 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen.\n// Constraint: p3 + p4 <= 1",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. Each project can either be fully invested in (1) or not invested in (0). The company aims to maximize the total expected profit from all the projects. The cost and expected profit for each project are given in the following Table.\n\n| Project | Cost | Expected Profit |\n|---------|------|-----------------|\n| 1       | $200,000 | $500,000 |\n| 2       | $150,000 | $300,000 |\n| 3       | $250,000 | $400,000 |\n| 4       | $100,000 | $200,000 |\n\nThe company has a limited budget of $800,000 for all projects. Due to strategic reasons, the company must invest in at least two projects. Additionally, Project 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen.\n\nPlease help the company determine the optimal investment strategy to maximize its total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The investment in each project\np1 = model.addVar(vtype=\"B\", name=\"p1\") # investment in Project 1\np2 = model.addVar(vtype=\"B\", name=\"p2\") # investment in Project 2\np3 = model.addVar(vtype=\"B\", name=\"p3\") # investment in Project 3\np4 = model.addVar(vtype=\"B\", name=\"p4\") # investment in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a limited budget of $800,000 for all projects.\nmodel.addCons(200000*p1 + 150000*p2 + 250000*p3 + 100000*p4 <= 800000)\n## Due to strategic reasons, the company must invest in at least two projects.\nmodel.addCons(p1 + p2 + p3 + p4 >= 2)\n## Project 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen.\nmodel.addCons(p3 + p4 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in Project 1: \", model.getVal(p1))\n    print(\"Investment in Project 2: \", model.getVal(p2))\n    print(\"Investment in Project 3: \", model.getVal(p3))\n    print(\"Investment in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. Each project can either be fully invested in (1) or not invested in (0).\n// {\"investment in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"investment in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a limited budget of $800,000 for all projects. The cost of each project is $200,000 for Project 1, $150,000 for Project 2, $250,000 for Project 3, and $100,000 for Project 4.\n// Constraint: 200000*p1 + 150000*p2 + 250000*p3 + 100000*p4 <= 800000\n\n## Generate Constraint-2:\nDue to strategic reasons, the company must invest in at least two projects.\n// Constraint: p1 + p2 + p3 + p4 >= 2\n\n## Generate Constraint-3:\nProject 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen.\n// Constraint: p3 + p4 <= 1",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. Each project can either be fully invested in (1) or not invested in (0). The company aims to maximize the total expected profit from all the projects. The company has a limited budget of $800,000 for all projects. The cost of each project is $200,000 for Project 1, $150,000 for Project 2, $250,000 for Project 3, and $100,000 for Project 4. Due to strategic reasons, the company must invest in at least two projects. Additionally, Project 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen. Please help the company determine the optimal investment strategy for each project.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The investment in each project\np1 = model.addVar(vtype=\"B\", name=\"p1\") # investment in Project 1\np2 = model.addVar(vtype=\"B\", name=\"p2\") # investment in Project 2\np3 = model.addVar(vtype=\"B\", name=\"p3\") # investment in Project 3\np4 = model.addVar(vtype=\"B\", name=\"p4\") # investment in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a limited budget of $800,000 for all projects.\nmodel.addCons(200000*p1 + 150000*p2 + 250000*p3 + 100000*p4 <= 800000)\n## Due to strategic reasons, the company must invest in at least two projects.\nmodel.addCons(p1 + p2 + p3 + p4 >= 2)\n## Project 3 and Project 4 are mutually exclusive; if one is chosen, the other must not be chosen.\nmodel.addCons(p3 + p4 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in Project 1: \", model.getVal(p1))\n    print(\"Investment in Project 2: \", model.getVal(p2))\n    print(\"Investment in Project 3: \", model.getVal(p3))\n    print(\"Investment in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes A-D). The bakery must decide how many of each type of cake to produce daily.\n// {\"number of Cake A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d (where each coefficient represents the profit per cake)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg.\n// Constraint: 2a + 3b + 2c + 4d <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Constraint: a + b + c + d >= 30\n\n## Generate Constraint-3:\nDue to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\n// Constraint: a <= 50\n// Constraint: b <= 40",
        "question": "A bakery produces four types of cakes (cakes A-D) and must decide how many of each type of cake to produce daily. The bakery aims to maximize its daily profit from selling cakes. The profit per cake for each type is as follows:\n\n| Cake Type | Profit per Cake |\n|-----------|-----------------|\n| A         | 5$              |\n| B         | 7$              |\n| C         | 6$              |\n| D         | 8$              |\n\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg. The bakery also has a daily demand for at least 30 cakes in total. Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Cake A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Cake B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Cake C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Cake D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The bakery has a limited daily supply of 200 kg of flour.\nmodel.addCons(2*a + 3*b + 2*c + 4*d <= 200)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(a + b + c + d >= 30)\n## Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\nmodel.addCons(a <= 50)\nmodel.addCons(b <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A produced: \", model.getVal(a))\n    print(\"Number of Cake B produced: \", model.getVal(b))\n    print(\"Number of Cake C produced: \", model.getVal(c))\n    print(\"Number of Cake D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes A-D). The bakery must decide how many of each type of cake to produce daily.\n// {\"number of Cake A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d (where each coefficient represents the profit per cake)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg.\n// Constraint: 2a + 3b + 2c + 4d <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Constraint: a + b + c + d >= 30\n\n## Generate Constraint-3:\nDue to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\n// Constraint: a <= 50\n// Constraint: b <= 40",
        "question": "A bakery produces four types of cakes (cakes A-D) and must decide how many of each type of cake to produce daily. The bakery wants to maximize its daily profit from selling cakes, where the profit per cake is $5 for cake A, $7 for cake B, $6 for cake C, and $8 for cake D. The bakery has a limited daily supply of 200 kg of flour, with each cake A requiring 2 kg of flour, cake B requiring 3 kg, cake C requiring 2 kg, and cake D requiring 4 kg. The bakery also has a daily demand for at least 30 cakes in total. Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily. Please help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Cake A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Cake B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Cake C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Cake D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The bakery has a limited daily supply of 200 kg of flour.\nmodel.addCons(2*a + 3*b + 2*c + 4*d <= 200)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(a + b + c + d >= 30)\n## Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\nmodel.addCons(a <= 50)\nmodel.addCons(b <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A produced: \", model.getVal(a))\n    print(\"Number of Cake B produced: \", model.getVal(b))\n    print(\"Number of Cake C produced: \", model.getVal(c))\n    print(\"Number of Cake D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon.\n// {\"number of chocolate cakes\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"v\", \"range\": \"v >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"l\", \"range\": \"l >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon.\n// Objective Function: Maximize: 5c + 4v + 3s + 2l\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements are as follows:\n- Chocolate cake requires 3 units of ingredient A.\n- Vanilla cake requires 2 units of ingredient A.\n- Strawberry cake requires 1 unit of ingredient A.\n- Lemon cake requires 1 unit of ingredient A.\nThe total daily supply of ingredient A is 100 units.\n// Constraint: 3c + 2v + s + l <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient B:\n- Chocolate cake requires 2 units of ingredient B.\n- Vanilla cake requires 3 units of ingredient B.\n- Strawberry cake requires 2 units of ingredient B.\n- Lemon cake requires 1 unit of ingredient B.\nThe total daily supply of ingredient B is 80 units.\n// Constraint: 2c + 3v + 2s + l <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 cakes of any type each day to meet minimum production standards.\n// Constraint: c + v + s + l >= 10",
        "question": "A bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon. The bakery has a limited daily supply of ingredients as shown in the following Table.\n\n| Cake Type | Ingredient A Required | Ingredient B Required |\n|-----------|-----------------------|----------------------|\n| Chocolate | 3 units               | 2 units              |\n| Vanilla   | 2 units               | 3 units              |\n| Strawberry| 1 unit                | 2 units              |\n| Lemon     | 1 unit                | 1 unit               |\n\nThe total daily supply of ingredient A is 100 units, and the total daily supply of ingredient B is 80 units. The bakery must produce at least 10 cakes of any type each day to meet minimum production standards. Please help the bakery to maximize its daily profit from selling cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of chocolate cakes\nv = model.addVar(vtype=\"INTEGER\", name=\"v\", lb=0) # number of vanilla cakes\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of strawberry cakes\nl = model.addVar(vtype=\"INTEGER\", name=\"l\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*c + 4*v + 3*s + 2*l)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient A.\nmodel.addCons(3*c + 2*v + s + l <= 100)\n## The bakery also has a limited daily supply of ingredient B.\nmodel.addCons(2*c + 3*v + 2*s + l <= 80)\n## The bakery must produce at least 10 cakes of any type each day.\nmodel.addCons(c + v + s + l >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(c))\n    print(\"Number of vanilla cakes: \", model.getVal(v))\n    print(\"Number of strawberry cakes: \", model.getVal(s))\n    print(\"Number of lemon cakes: \", model.getVal(l))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon.\n// {\"number of chocolate cakes\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"v\", \"range\": \"v >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"l\", \"range\": \"l >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon.\n// Objective Function: Maximize: 5c + 4v + 3s + 2l\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements are as follows:\n- Chocolate cake requires 3 units of ingredient A.\n- Vanilla cake requires 2 units of ingredient A.\n- Strawberry cake requires 1 unit of ingredient A.\n- Lemon cake requires 1 unit of ingredient A.\nThe total daily supply of ingredient A is 100 units.\n// Constraint: 3c + 2v + s + l <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient B:\n- Chocolate cake requires 2 units of ingredient B.\n- Vanilla cake requires 3 units of ingredient B.\n- Strawberry cake requires 2 units of ingredient B.\n- Lemon cake requires 1 unit of ingredient B.\nThe total daily supply of ingredient B is 80 units.\n// Constraint: 2c + 3v + 2s + l <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 cakes of any type each day to meet minimum production standards.\n// Constraint: c + v + s + l >= 10",
        "question": "A bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon. The bakery has a limited daily supply of ingredients. Chocolate cake requires 3 units of ingredient A, vanilla cake requires 2 units of ingredient A, strawberry cake requires 1 unit of ingredient A, and lemon cake requires 1 unit of ingredient A. The total daily supply of ingredient A is 100 units. Chocolate cake also requires 2 units of ingredient B, vanilla cake requires 3 units of ingredient B, strawberry cake requires 2 units of ingredient B, and lemon cake requires 1 unit of ingredient B. The total daily supply of ingredient B is 80 units. The bakery must produce at least 10 cakes of any type each day to meet minimum production standards. Please help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of chocolate cakes\nv = model.addVar(vtype=\"INTEGER\", name=\"v\", lb=0) # number of vanilla cakes\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of strawberry cakes\nl = model.addVar(vtype=\"INTEGER\", name=\"l\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*c + 4*v + 3*s + 2*l)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient A.\nmodel.addCons(3*c + 2*v + s + l <= 100)\n## The bakery also has a limited daily supply of ingredient B.\nmodel.addCons(2*c + 3*v + 2*s + l <= 80)\n## The bakery must produce at least 10 cakes of any type each day.\nmodel.addCons(c + v + s + l >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(c))\n    print(\"Number of vanilla cakes: \", model.getVal(v))\n    print(\"Number of strawberry cakes: \", model.getVal(s))\n    print(\"Number of lemon cakes: \", model.getVal(l))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the required raw material units and production hours for each product.\n\n| Product | Raw Material Units | Production Hours |\n|---------|-------------------|------------------|\n| A       | 3                 | 2                |\n| B       | 2                 | 1                |\n| C       | 4                 | 3                |\n| D       | 1                 | 1                |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production line has a limited capacity, with a total of 50 hours available per day. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, given the constraints on raw material and production hours, and the minimum order requirement for Product C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day is 50 hours. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for baguette is $1.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 1.5*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of whole wheat requires 0.5 hours, rye requires 0.4 hours, sourdough requires 0.6 hours, and baguette requires 0.3 hours.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 5000 kilograms of flour available. Each loaf of whole wheat requires 0.5 kilograms, rye requires 0.4 kilograms, sourdough requires 0.6 kilograms, and baguette requires 0.3 kilograms.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 5000\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 500 loaves of each type of bread.\n// WholeWheat >= 500\n// Rye >= 500\n// Sourdough >= 500\n// Baguette >= 500",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.5            |\n| Sourdough     | $3              |\n| Baguette      | $1.5            |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of whole wheat requires 0.5 hours, rye requires 0.4 hours, sourdough requires 0.6 hours, and baguette requires 0.3 hours. The bakery also has a total of 5000 kilograms of flour available. Each loaf of whole wheat requires 0.5 kilograms, rye requires 0.4 kilograms, sourdough requires 0.6 kilograms, and baguette requires 0.3 kilograms. The bakery has a demand for at least 500 loaves of each type of bread.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # number of loaves of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 1.5*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 1000)\n## The bakery has a total of 5000 kilograms of flour available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 5000)\n## The bakery has a demand for at least 500 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 500)\nmodel.addCons(Rye >= 500)\nmodel.addCons(Sourdough >= 500)\nmodel.addCons(Baguette >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for baguette is $1.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 1.5*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of whole wheat requires 0.5 hours, rye requires 0.4 hours, sourdough requires 0.6 hours, and baguette requires 0.3 hours.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 5000 kilograms of flour available. Each loaf of whole wheat requires 0.5 kilograms, rye requires 0.4 kilograms, sourdough requires 0.6 kilograms, and baguette requires 0.3 kilograms.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 5000\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 500 loaves of each type of bread.\n// WholeWheat >= 500\n// Rye >= 500\n// Sourdough >= 500\n// Baguette >= 500",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for baguette is $1.5. The bakery has a total of 1000 hours of labor available, with each loaf of whole wheat requiring 0.5 hours, rye requiring 0.4 hours, sourdough requiring 0.6 hours, and baguette requiring 0.3 hours. Additionally, the bakery has a total of 5000 kilograms of flour available, with each loaf of whole wheat requiring 0.5 kilograms, rye requiring 0.4 kilograms, sourdough requiring 0.6 kilograms, and baguette requiring 0.3 kilograms. The bakery has a demand for at least 500 loaves of each type of bread. Please help the bakery to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # number of loaves of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 1.5*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 1000)\n## The bakery has a total of 5000 kilograms of flour available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.3*Baguette <= 5000)\n## The bakery has a demand for at least 500 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 500)\nmodel.addCons(Rye >= 500)\nmodel.addCons(Sourdough >= 500)\nmodel.addCons(Baguette >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials.\n// White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 4000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 4000",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| White Bread      | $2              |\n| Whole Wheat Bread| $2.5            |\n| Rye Bread        | $3              |\n| Sourdough Bread  | $3.5            |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours. The bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials. The bakery also has a storage capacity of 4000 loaves.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # number of loaves of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000)\n## The bakery has a budget of $5000 for raw materials.\nmodel.addCons(White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000)\n## The bakery has a storage capacity of 4000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials.\n// White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 4000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 4000",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5. The bakery has a total of 1000 hours of labor available, with each loaf of white bread requiring 0.5 hours, whole wheat bread requiring 0.6 hours, rye bread requiring 0.7 hours, and sourdough bread requiring 0.8 hours. The bakery also has a budget of $5000 for raw materials, with each loaf of white bread requiring $1 of raw materials, whole wheat bread requiring $1.2 of raw materials, rye bread requiring $1.5 of raw materials, and sourdough bread requiring $1.8 of raw materials. Additionally, the bakery has a storage capacity of 4000 loaves. Please help the bakery to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # number of loaves of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000)\n## The bakery has a budget of $5000 for raw materials.\nmodel.addCons(White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000)\n## The bakery has a storage capacity of 4000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $50                      | 2 hours                |\n| Tablets      | $150            | $70                      | 3 hours                |\n| Laptops      | $200            | $100                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 12,000 hours available for assembly. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit.\nThe company has a total production capacity of 5000 units. The production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\nPlease help the company determine the optimal number of units to produce for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms.\n// 100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000\n\n## Generate Constraint-3:\nThe bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms.\n// 20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits. The profit per pastry and the resource usage for each pastry are given in the following Table.\n\n| Pastry   | Profit per Pastry | Flour Usage (grams) | Sugar Usage (grams) |\n|----------|-------------------|---------------------|---------------------|\n| Croissant| 1.50$             | 100                 | 20                  |\n| Muffin   | 2.00$             | 150                 | 30                  |\n| Doughnut | 1.75$             | 120                 | 25                  |\n| Eclair   | 2.50$             | 200                 | 40                  |\n\nThe bakery has a daily production capacity of 1000 pastries. The bakery has a limited daily supply of flour, which is used in all pastries, totaling 150 kilograms. The bakery also has a limited daily supply of sugar, totaling 20 kilograms. \n\nPlease help the bakery to maximize its daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 1000)\n## The bakery has a limited daily supply of flour.\nmodel.addCons(100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000)\n## The bakery also has a limited daily supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms.\n// 100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000\n\n## Generate Constraint-3:\nThe bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms.\n// 20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits. The profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit. The bakery has a daily production capacity of 1000 pastries. The bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms. The bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms. Please help the bakery to determine the optimal number of each pastry to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 1000)\n## The bakery has a limited daily supply of flour.\nmodel.addCons(100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000)\n## The bakery also has a limited daily supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 5 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 10,000 hours available for assembly. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company has a total production capacity of 5000 units. The production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// WholeWheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Whole wheat requires 0.5 kg of flour per loaf, rye requires 0.4 kg, sourdough requires 0.6 kg, and multigrain requires 0.7 kg. The total daily flour supply is 500 kg.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited amount of yeast available each day. Whole wheat requires 0.01 kg of yeast per loaf, rye requires 0.015 kg, sourdough requires 0.02 kg, and multigrain requires 0.01 kg. The total daily yeast supply is 10 kg.\n// 0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations. The profit per loaf for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.5            |\n| Sourdough     | $3              |\n| Multigrain    | $2.2            |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery also has a limited amount of flour and yeast available each day. The requirements for flour and yeast per loaf for each type of bread are as follows:\n\n| Bread Type    | Flour per Loaf (kg) | Yeast per Loaf (kg) |\n|---------------|---------------------|---------------------|\n| Whole Wheat   | 0.5                 | 0.01                |\n| Rye           | 0.4                 | 0.015               |\n| Sourdough     | 0.6                 | 0.02                |\n| Multigrain    | 0.7                 | 0.01                |\n\nThe total daily flour supply is 500 kg, and the total daily yeast supply is 10 kg.\n\nPlease help the bakery to maximize the total daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500)\n## The bakery has a limited amount of yeast available each day.\nmodel.addCons(0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// WholeWheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Whole wheat requires 0.5 kg of flour per loaf, rye requires 0.4 kg, sourdough requires 0.6 kg, and multigrain requires 0.7 kg. The total daily flour supply is 500 kg.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited amount of yeast available each day. Whole wheat requires 0.01 kg of yeast per loaf, rye requires 0.015 kg, sourdough requires 0.02 kg, and multigrain requires 0.01 kg. The total daily yeast supply is 10 kg.\n// 0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations. The profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2. The bakery wants to maximize the total daily profit. The bakery has a daily production capacity of 1000 loaves. The bakery has a limited amount of flour available each day, with whole wheat requiring 0.5 kg of flour per loaf, rye requiring 0.4 kg, sourdough requiring 0.6 kg, and multigrain requiring 0.7 kg, and the total daily flour supply is 500 kg. The bakery also has a limited amount of yeast available each day, with whole wheat requiring 0.01 kg of yeast per loaf, rye requiring 0.015 kg, sourdough requiring 0.02 kg, and multigrain requiring 0.01 kg, and the total daily yeast supply is 10 kg. Please help the bakery determine the optimal number of loaves to produce for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500)\n## The bakery has a limited amount of yeast available each day.\nmodel.addCons(0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and ciabatta. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and labor.\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of ciabatta bread\": \"Ciabatta\", \"range\": \"Ciabatta >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for ciabatta is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 3.5*Ciabatta\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and ciabatta requires 1.2 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 1.2*Ciabatta <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 for daily ingredient costs. The cost of ingredients per loaf for whole wheat is $0.5, for rye is $0.6, for sourdough is $0.8, and for ciabatta is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.6*Rye + 0.8*Sourdough + 1*Ciabatta <= 500\n\n## Generate Constraint-3:\nThe bakery has a maximum of 40 hours of labor available daily. Each loaf of whole wheat requires 0.1 hours of labor, rye requires 0.05 hours, sourdough requires 0.15 hours, and ciabatta requires 0.2 hours. The total labor hours used should not exceed the available hours.\n// 0.1*WholeWheat + 0.05*Rye + 0.15*Sourdough + 0.2*Ciabatta <= 40",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and ciabatta. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and labor. The profit per loaf for each type of bread is as follows: whole wheat at $2, rye at $2.5, sourdough at $3, and ciabatta at $3.5.\n\n| Bread Type     | Profit per Loaf | Flour Required (pounds) | Ingredient Cost per Loaf | Labor Required (hours) |\n|----------------|-----------------|-------------------------|--------------------------|------------------------|\n| Whole Wheat    | $2              | 1.5                     | $0.5                     | 0.1                    |\n| Rye            | $2.5            | 1                       | $0.6                     | 0.05                   |\n| Sourdough      | $3              | 2                       | $0.8                     | 0.15                   |\n| Ciabatta       | $3.5            | 1.2                     | $1                       | 0.2                    |\n\nThe bakery has a total of 1000 pounds of flour available daily. The bakery has a budget of $500 for daily ingredient costs. The total cost of ingredients should not exceed the budget. The bakery has a maximum of 40 hours of labor available daily. The total labor hours used should not exceed the available hours.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nCiabatta = model.addVar(vtype=\"CONTINUOUS\", name=\"Ciabatta\", lb=0) # number of loaves of ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 3.5*Ciabatta)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 1.2*Ciabatta <= 1000)\n## The bakery has a budget of $500 for daily ingredient costs.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.8*Sourdough + 1*Ciabatta <= 500)\n## The bakery has a maximum of 40 hours of labor available daily.\nmodel.addCons(0.1*WholeWheat + 0.05*Rye + 0.15*Sourdough + 0.2*Ciabatta <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of ciabatta bread: \", model.getVal(Ciabatta))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1516,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and ciabatta. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and labor.\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of ciabatta bread\": \"Ciabatta\", \"range\": \"Ciabatta >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for ciabatta is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 3.5*Ciabatta\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and ciabatta requires 1.2 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 1.2*Ciabatta <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 for daily ingredient costs. The cost of ingredients per loaf for whole wheat is $0.5, for rye is $0.6, for sourdough is $0.8, and for ciabatta is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.6*Rye + 0.8*Sourdough + 1*Ciabatta <= 500\n\n## Generate Constraint-3:\nThe bakery has a maximum of 40 hours of labor available daily. Each loaf of whole wheat requires 0.1 hours of labor, rye requires 0.05 hours, sourdough requires 0.15 hours, and ciabatta requires 0.2 hours. The total labor hours used should not exceed the available hours.\n// 0.1*WholeWheat + 0.05*Rye + 0.15*Sourdough + 0.2*Ciabatta <= 40",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and ciabatta. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and labor.\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for ciabatta is $3.5. The bakery wants to maximize the total daily profit.\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and ciabatta requires 1.2 pounds.\nThe bakery has a budget of $500 for daily ingredient costs. The cost of ingredients per loaf for whole wheat is $0.5, for rye is $0.6, for sourdough is $0.8, and for ciabatta is $1. The total cost of ingredients should not exceed the budget.\nThe bakery has a maximum of 40 hours of labor available daily. Each loaf of whole wheat requires 0.1 hours of labor, rye requires 0.05 hours, sourdough requires 0.15 hours, and ciabatta requires 0.2 hours. The total labor hours used should not exceed the available hours.\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce daily to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nCiabatta = model.addVar(vtype=\"CONTINUOUS\", name=\"Ciabatta\", lb=0) # number of loaves of ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 3.5*Ciabatta)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 1.2*Ciabatta <= 1000)\n## The bakery has a budget of $500 for daily ingredient costs.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.8*Sourdough + 1*Ciabatta <= 500)\n## The bakery has a maximum of 40 hours of labor available daily.\nmodel.addCons(0.1*WholeWheat + 0.05*Rye + 0.15*Sourdough + 0.2*Ciabatta <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of ciabatta bread: \", model.getVal(Ciabatta))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\n// 30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and the cost of materials and labor for each device are given in the following Table.\n\n| Device       | Profit per Unit | Material Cost per Unit | Labor Cost per Unit |\n|--------------|-----------------|------------------------|---------------------|\n| Smartphones  | $100            | $50                    | $30                 |\n| Tablets      | $150            | $70                    | $40                 |\n| Laptops      | $200            | $100                   | $50                 |\n| Smartwatches | $50             | $20                    | $10                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $200,000 for materials and $100,000 for labor. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000)\n## The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\nmodel.addCons(30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\n// 30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials. The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000)\n## The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\nmodel.addCons(30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of pumpernickel bread\": \"Pumpernickel\", \"range\": \"Pumpernickel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.75*Pumpernickel\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of whole wheat bread requires 0.5 hours, rye bread requires 0.6 hours, sourdough bread requires 0.7 hours, and pumpernickel bread requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.6*Rye + 0.7*Sourdough + 0.8*Pumpernickel <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours per day. Each loaf of whole wheat bread requires 1.5 hours, rye bread requires 1.8 hours, sourdough bread requires 2 hours, and pumpernickel bread requires 2.2 hours of oven time.\n// 1.5*WholeWheat + 1.8*Rye + 2*Sourdough + 2.2*Pumpernickel <= 1500\n\n## Generate Constraint-3:\nThe bakery has a budget of $5000 for ingredients per day. The cost of ingredients for each loaf of whole wheat bread is $1, rye bread is $1.2, sourdough bread is $1.5, and pumpernickel bread is $1.3.\n// WholeWheat + 1.2*Rye + 1.5*Sourdough + 1.3*Pumpernickel <= 5000",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize its operations. The profit per loaf and the labor, oven time, and ingredient costs for each type of bread are given in the following Table.\n\n| Type of Bread | Profit per Loaf | Labor per Loaf | Oven Time per Loaf | Ingredient Cost per Loaf |\n|---------------|-----------------|----------------|---------------------|--------------------------|\n| Whole Wheat   | $2              | 0.5 hours      | 1.5 hours           | $1                      |\n| Rye           | $2.5            | 0.6 hours      | 1.8 hours           | $1.2                    |\n| Sourdough     | $3              | 0.7 hours      | 2 hours             | $1.5                    |\n| Pumpernickel  | $2.75           | 0.8 hours      | 2.2 hours           | $1.3                    |\n\nThe bakery has a total of 1000 hours of labor available per day and a limited oven capacity of 1500 hours per day. The bakery also has a budget of $5000 for ingredients per day. The bakery wants to maximize the total daily profit. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nPumpernickel = model.addVar(vtype=\"CONTINUOUS\", name=\"Pumpernickel\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.75*Pumpernickel)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.7*Sourdough + 0.8*Pumpernickel <= 1000)\n## The bakery has a limited oven capacity of 1500 hours per day.\nmodel.addCons(1.5*WholeWheat + 1.8*Rye + 2*Sourdough + 2.2*Pumpernickel <= 1500)\n## The bakery has a budget of $5000 for ingredients per day.\nmodel.addCons(WholeWheat + 1.2*Rye + 1.5*Sourdough + 1.3*Pumpernickel <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(Pumpernickel))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of pumpernickel bread\": \"Pumpernickel\", \"range\": \"Pumpernickel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.75*Pumpernickel\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of whole wheat bread requires 0.5 hours, rye bread requires 0.6 hours, sourdough bread requires 0.7 hours, and pumpernickel bread requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.6*Rye + 0.7*Sourdough + 0.8*Pumpernickel <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours per day. Each loaf of whole wheat bread requires 1.5 hours, rye bread requires 1.8 hours, sourdough bread requires 2 hours, and pumpernickel bread requires 2.2 hours of oven time.\n// 1.5*WholeWheat + 1.8*Rye + 2*Sourdough + 2.2*Pumpernickel <= 1500\n\n## Generate Constraint-3:\nThe bakery has a budget of $5000 for ingredients per day. The cost of ingredients for each loaf of whole wheat bread is $1, rye bread is $1.2, sourdough bread is $1.5, and pumpernickel bread is $1.3.\n// WholeWheat + 1.2*Rye + 1.5*Sourdough + 1.3*Pumpernickel <= 5000",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize its operations. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 hours of labor available per day, with each loaf of whole wheat bread requiring 0.5 hours, rye bread requiring 0.6 hours, sourdough bread requiring 0.7 hours, and pumpernickel bread requiring 0.8 hours of labor. The bakery also has a limited oven capacity of 1500 hours per day, with each loaf of whole wheat bread requiring 1.5 hours, rye bread requiring 1.8 hours, sourdough bread requiring 2 hours, and pumpernickel bread requiring 2.2 hours of oven time. Additionally, the bakery has a budget of $5000 for ingredients per day, with the cost of ingredients for each loaf of whole wheat bread being $1, rye bread being $1.2, sourdough bread being $1.5, and pumpernickel bread being $1.3. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nPumpernickel = model.addVar(vtype=\"CONTINUOUS\", name=\"Pumpernickel\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.75*Pumpernickel)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.7*Sourdough + 0.8*Pumpernickel <= 1000)\n## The bakery has a limited oven capacity of 1500 hours per day.\nmodel.addCons(1.5*WholeWheat + 1.8*Rye + 2*Sourdough + 2.2*Pumpernickel <= 1500)\n## The bakery has a budget of $5000 for ingredients per day.\nmodel.addCons(WholeWheat + 1.2*Rye + 1.5*Sourdough + 1.3*Pumpernickel <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(Pumpernickel))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily.\n// {\"number of loaves of white bread\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat_Bread\", \"range\": \"Whole_Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.7 hours, rye bread requires 0.8 hours, and sourdough bread requires 1 hour of labor.\n// 0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for ingredients. The cost of ingredients for each loaf of white bread is $0.50, for whole wheat bread is $0.70, for rye bread is $0.80, and for sourdough bread is $1.00.\n// 0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500\n\n## Generate Constraint-3:\nThe bakery can only store a maximum of 1500 loaves of bread at any given time.\n// White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily. The profit per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Type of Bread       | Profit per Loaf | Labor Hours per Loaf | Ingredient Cost per Loaf |\n|---------------------|-----------------|----------------------|--------------------------|\n| White Bread         | $1.50           | 0.5 hours            | $0.50                    |\n| Whole Wheat Bread   | $2.00           | 0.7 hours            | $0.70                    |\n| Rye Bread           | $2.50           | 0.8 hours            | $0.80                    |\n| Sourdough Bread     | $3.00           | 1 hour               | $1.00                    |\n\nThe bakery has a total of 1000 hours of labor available per day and a daily budget of $500 for ingredients. The bakery can only store a maximum of 1500 loaves of bread at any given time. \nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of loaves of white bread\nWhole_Wheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat_Bread\", lb=0) # number of loaves of whole wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000)\n## The bakery has a daily budget of $500 for ingredients.\nmodel.addCons(0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500)\n## The bakery can only store a maximum of 1500 loaves of bread at any given time.\nmodel.addCons(White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White_Bread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily.\n// {\"number of loaves of white bread\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat_Bread\", \"range\": \"Whole_Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.7 hours, rye bread requires 0.8 hours, and sourdough bread requires 1 hour of labor.\n// 0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for ingredients. The cost of ingredients for each loaf of white bread is $0.50, for whole wheat bread is $0.70, for rye bread is $0.80, and for sourdough bread is $1.00.\n// 0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500\n\n## Generate Constraint-3:\nThe bakery can only store a maximum of 1500 loaves of bread at any given time.\n// White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales.\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.7 hours, rye bread requires 0.8 hours, and sourdough bread requires 1 hour of labor. The bakery has a daily budget of $500 for ingredients. The cost of ingredients for each loaf of white bread is $0.50, for whole wheat bread is $0.70, for rye bread is $0.80, and for sourdough bread is $1.00. The bakery can only store a maximum of 1500 loaves of bread at any given time.\nPlease help the bakery to determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of loaves of white bread\nWhole_Wheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat_Bread\", lb=0) # number of loaves of whole wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000)\n## The bakery has a daily budget of $500 for ingredients.\nmodel.addCons(0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500)\n## The bakery can only store a maximum of 1500 loaves of bread at any given time.\nmodel.addCons(White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White_Bread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"continuous\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40.\nThe bakery wants to maximize the total daily profit from selling all types of pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each bagel requires 0.05 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per day for ingredients. The cost of ingredients for each croissant is $0.20, for each muffin is $0.30, for each donut is $0.25, and for each bagel is $0.15.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 pastries per day.\n// Croissants + Muffins + Donuts + Bagels <= 5000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The profit per pastry and the labor and ingredient requirements for each type of pastry are given in the following Table.\n\n| Pastry   | Profit per Pastry | Labor per Pastry | Ingredient Cost per Pastry |\n|----------|-------------------|------------------|----------------------------|\n| Croissants | $0.50            | 0.1 hours        | $0.20                      |\n| Muffins    | $0.75            | 0.2 hours        | $0.30                      |\n| Donuts     | $0.60            | 0.15 hours       | $0.25                      |\n| Bagels     | $0.40            | 0.05 hours       | $0.15                      |\n\nThe bakery has a total of 1000 hours of labor available per day and a budget of $500 per day for ingredients. The bakery also has a storage capacity limit of 5000 pastries per day. Please help the bakery to maximize the total daily profit from selling all types of pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Donuts\", lb=0) # number of donuts\nBagels = model.addVar(vtype=\"CONTINUOUS\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000)\n## The bakery has a budget of $500 per day for ingredients.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500)\n## The bakery has a storage capacity limit of 5000 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts + Bagels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"continuous\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40.\nThe bakery wants to maximize the total daily profit from selling all types of pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each bagel requires 0.05 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per day for ingredients. The cost of ingredients for each croissant is $0.20, for each muffin is $0.30, for each donut is $0.25, and for each bagel is $0.15.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 pastries per day.\n// Croissants + Muffins + Donuts + Bagels <= 5000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40. The bakery has a total of 1000 hours of labor available per day, with each croissant requiring 0.1 hours of labor, each muffin requiring 0.2 hours, each donut requiring 0.15 hours, and each bagel requiring 0.05 hours. The bakery also has a budget of $500 per day for ingredients, with the cost of ingredients for each croissant being $0.20, for each muffin being $0.30, for each donut being $0.25, and for each bagel being $0.15. Additionally, the bakery has a storage capacity limit of 5000 pastries per day. Please help the bakery to maximize the total daily profit from selling all types of pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Donuts\", lb=0) # number of donuts\nBagels = model.addVar(vtype=\"CONTINUOUS\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000)\n## The bakery has a budget of $500 per day for ingredients.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500)\n## The bakery has a storage capacity limit of 5000 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts + Bagels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company wants to maximize the total profit.\n// Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n// Total_Revenue = 50*A + 70*B + 60*C + 40*D\n// Objective Function: Maximize: Total_Revenue - Total_Production_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for production costs.\n// Total_Production_Cost <= 250000\n\n## Generate Constraint-3:\nThe demand for product A is at least 500 units.\n// A >= 500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n| D       | $40             | $15                      |\n\nThe company has a total production capacity of 10,000 units. The company has a budget of $250,000 for production costs. The demand for product A is at least 500 units. \nPlease help the company to maximize the total profit, which is defined as the total revenue minus the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n## Total_Revenue = 50*A + 70*B + 60*C + 40*D\nmodel.addCons(obj == (50*A + 70*B + 60*C + 40*D) - (20*A + 30*B + 25*C + 15*D))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The demand for product A is at least 500 units.\nmodel.addCons(A >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company wants to maximize the total profit.\n// Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n// Total_Revenue = 50*A + 70*B + 60*C + 40*D\n// Objective Function: Maximize: Total_Revenue - Total_Production_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for production costs.\n// Total_Production_Cost <= 250000\n\n## Generate Constraint-3:\nThe demand for product A is at least 500 units.\n// A >= 500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit. The profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company has a total production capacity of 10,000 units and a budget of $250,000 for production costs. The demand for product A is at least 500 units. Please help the company to maximize the total profit, which is defined as the total revenue minus the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n## Total_Revenue = 50*A + 70*B + 60*C + 40*D\nmodel.addCons(obj == (50*A + 70*B + 60*C + 40*D) - (20*A + 30*B + 25*C + 15*D))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The demand for product A is at least 500 units.\nmodel.addCons(A >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 692,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total profit.\n// Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n// Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\n// Objective Function: Maximize: Total_Revenue - Total_Manufacturing_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// ProductA + ProductB + ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for manufacturing costs.\n// Total_Manufacturing_Cost <= 250000\n\n## Generate Constraint-3:\nDue to market demand, the number of units of product A must not exceed 4,000 units.\n// ProductA <= 4000",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and manufacturing cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Manufacturing Cost per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $20                         |\n| B       | $70             | $30                         |\n| C       | $60             | $25                         |\n\nThe company has a total production capacity of 10,000 units. The company has a budget of $250,000 for manufacturing costs. Due to market demand, the number of units of product A must not exceed 4,000 units. \nPlease help the company to maximize the total profit, which is defined as the total revenue minus the total manufacturing cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n## Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\nmodel.addCons(obj == (50*ProductA + 70*ProductB + 60*ProductC) - (20*ProductA + 30*ProductB + 25*ProductC))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 10000)\n## The company has a budget of $250,000 for manufacturing costs.\nmodel.addCons(20*ProductA + 30*ProductB + 25*ProductC <= 250000)\n## Due to market demand, the number of units of product A must not exceed 4,000 units.\nmodel.addCons(ProductA <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(ProductA))\n    print(\"Number of units of product B: \", model.getVal(ProductB))\n    print(\"Number of units of product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total profit.\n// Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n// Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\n// Objective Function: Maximize: Total_Revenue - Total_Manufacturing_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// ProductA + ProductB + ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for manufacturing costs.\n// Total_Manufacturing_Cost <= 250000\n\n## Generate Constraint-3:\nDue to market demand, the number of units of product A must not exceed 4,000 units.\n// ProductA <= 4000",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company has a total production capacity of 10,000 units and a budget of $250,000 for manufacturing costs. Due to market demand, the number of units of product A must not exceed 4,000 units. Please help the company to maximize the total profit, which is defined as the total revenue minus the total manufacturing cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n## Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\nmodel.addCons(obj == (50*ProductA + 70*ProductB + 60*ProductC) - (20*ProductA + 30*ProductB + 25*ProductC))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 10000)\n## The company has a budget of $250,000 for manufacturing costs.\nmodel.addCons(20*ProductA + 30*ProductB + 25*ProductC <= 250000)\n## Due to market demand, the number of units of product A must not exceed 4,000 units.\nmodel.addCons(ProductA <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(ProductA))\n    print(\"Number of units of product B: \", model.getVal(ProductB))\n    print(\"Number of units of product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 671,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $2, and per donut is $1. The rental cost per oven per day is $50. The bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 2*Muffins + Donuts + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time for each croissant is 15 minutes, for each muffin is 20 minutes, and for each donut is 10 minutes. The total daily baking time available is 2400 minutes.\n// 15*Croissants + 20*Muffins + 10*Donuts <= 2400\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts.\n// Croissants >= 50, Muffins >= 40, Donuts >= 60\n\n## Generate Constraint-3:\nEach oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented.\n// Croissants + Muffins + Donuts <= 100*Ovens",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost per Pastry | Baking Time per Pastry |\n|----------|--------------------|-----------------|------------------------|\n| Croissants | $2                | $1              | 15 minutes             |\n| Muffins    | $3                | $2              | 20 minutes             |\n| Donuts     | $1.5              | $1              | 10 minutes             |\n\nThe bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts. The total daily baking time available is 2400 minutes. Each oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented. The bakery wants to maximize its daily profit, which is defined as the total revenue minus the total cost.\n\nPlease help the bakery determine the optimal number of each type of pastry to produce and the number of ovens to rent to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 2*Muffins + Donuts + 50*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 2*Muffins + Donuts + 50*Ovens))\n\n# Add constraints\n## The baking time for each croissant is 15 minutes, for each muffin is 20 minutes, and for each donut is 10 minutes. The total daily baking time available is 2400 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Donuts <= 2400)\n## The bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 40)\nmodel.addCons(Donuts >= 60)\n## Each oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented.\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $2, and per donut is $1. The rental cost per oven per day is $50. The bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 2*Muffins + Donuts + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time for each croissant is 15 minutes, for each muffin is 20 minutes, and for each donut is 10 minutes. The total daily baking time available is 2400 minutes.\n// 15*Croissants + 20*Muffins + 10*Donuts <= 2400\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts.\n// Croissants >= 50, Muffins >= 40, Donuts >= 60\n\n## Generate Constraint-3:\nEach oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented.\n// Croissants + Muffins + Donuts <= 100*Ovens",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $2, and per donut is $1. The rental cost per oven per day is $50. The bakery wants to maximize its daily profit. The baking time for each croissant is 15 minutes, for each muffin is 20 minutes, and for each donut is 10 minutes. The total daily baking time available is 2400 minutes. The bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts. Each oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the number of ovens to rent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 2*Muffins + Donuts + 50*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 2*Muffins + Donuts + 50*Ovens))\n\n# Add constraints\n## The baking time for each croissant is 15 minutes, for each muffin is 20 minutes, and for each donut is 10 minutes. The total daily baking time available is 2400 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Donuts <= 2400)\n## The bakery has a daily demand for at least 50 croissants, 40 muffins, and 60 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 40)\nmodel.addCons(Donuts >= 60)\n## Each oven can bake a maximum of 100 pastries per day. The bakery needs to ensure that the number of pastries produced does not exceed the capacity of the ovens rented.\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of flour to purchase\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost of flour per kilogram is $0.5. The bakery aims to maximize its profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Flour\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery can purchase up to 100 kg of flour per day.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= Flour\n// Flour <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Donuts <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations.\n// Croissants >= 100\n// Muffins >= 50",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost of flour per kilogram is $0.5. The bakery aims to maximize its profit.\n\n| Pastry   | Revenue per Unit | Flour Required (kg) |\n|----------|------------------|---------------------|\n| Croissants | $2              | 0.1                 |\n| Muffins   | $3              | 0.2                 |\n| Donuts    | $1.5            | 0.15                |\n\nThe bakery can purchase up to 100 kg of flour per day. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery has a daily production capacity of 500 pastries. The bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations.\n\nPlease help the bakery to maximize its profit by determining the optimal number of each type of pastry to produce and the amount of flour to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of flour to purchase\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Flour\nTotal_Cost = 0.5*Flour\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery can purchase up to 100 kg of flour per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= Flour)\nmodel.addCons(Flour <= 100)\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n## The bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of flour to purchase: \", model.getVal(Flour))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of flour to purchase\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost of flour per kilogram is $0.5. The bakery aims to maximize its profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Flour\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery can purchase up to 100 kg of flour per day.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= Flour\n// Flour <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Donuts <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations.\n// Croissants >= 100\n// Muffins >= 50",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost of flour per kilogram is $0.5. The bakery aims to maximize its profit. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery can purchase up to 100 kg of flour per day. The bakery has a daily production capacity of 500 pastries. The bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations. Please help the bakery to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of flour to purchase\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Flour\nTotal_Cost = 0.5*Flour\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery can purchase up to 100 kg of flour per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= Flour)\nmodel.addCons(Flour <= 100)\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n## The bakery must produce at least 100 croissants and 50 muffins per day to meet contractual obligations.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of flour to purchase: \", model.getVal(Flour))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor. The revenue and cost per pastry, as well as the required ingredients and labor, are given in the following Table.\n\n| Pastry   | Revenue per Unit | Cost per Unit | Flour Required (kg) | Sugar Required (kg) | Labor Required (hours) |\n|----------|------------------|---------------|---------------------|---------------------|------------------------|\n| Croissant| 2$               | 0.5$          | 0.1                 | 0.05                | 0.5                    |\n| Muffin   | 3$               | 1$            | 0.2                 | 0.1                 | 0.4                    |\n| Bagel    | 1.5$             | 0.7$          | 0.15                | 0.05                | 0.3                    |\n\nThe bakery has a daily limit of 100 kg of flour and 80 kg of sugar. The bakery also has a daily limit of 40 hours of labor. The bakery wants to maximize the daily profit, which is defined as the total revenue minus the total cost.\n\nPlease help the bakery determine the optimal number of croissants, muffins, and bagels to produce daily to maximize profit while adhering to the constraints on ingredients and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (0.5*Croissants + 1*Muffins + 0.7*Bagels))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor. The revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit. The bakery has a daily limit of 100 kg of flour, where each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg. The bakery also has a daily limit of 80 kg of sugar, where each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg. Additionally, the bakery has a daily limit of 40 hours of labor, where each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (0.5*Croissants + 1*Muffins + 0.7*Bagels))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor.\n// 0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type. The revenue and cost per pastry, as well as the ingredient and labor requirements, are given in the following Table.\n\n| Pastry   | Revenue per Unit | Cost per Unit | Flour Requirement (kg) | Sugar Requirement (kg) | Labor Requirement (hours) |\n|----------|------------------|---------------|------------------------|-----------------------|---------------------------|\n| Croissant| 2$              | 1$            | 0.1                    | 0.05                  | 0.2                       |\n| Muffin   | 3$              | 1.5$          | 0.2                    | 0.1                   | 0.3                       |\n| Donut    | 1.5$            | 0.8$          | 0.15                   | 0.08                  | 0.15                      |\n\nThe bakery has a daily limit of 100 kg of flour and 80 kg of sugar. The bakery also has a daily limit of 40 hours of labor. The bakery wants to maximize the daily profit, which is defined as the total revenue minus the total cost.\n\nPlease help the bakery determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 1.5*Muffins + 0.8*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor.\n// 0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit. The bakery has a daily limit of 100 kg of flour, where each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour. The bakery also has a daily limit of 80 kg of sugar, where each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar. Additionally, the bakery has a daily limit of 40 hours of labor, where each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 1.5*Muffins + 0.8*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for croissants\": \"Croissants_Ovens\", \"range\": \"Croissants_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for muffins\": \"Muffins_Ovens\", \"range\": \"Muffins_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for donuts\": \"Donuts_Ovens\", \"range\": \"Donuts_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per oven per day is $50 for croissants, $40 for muffins, and $30 for donuts.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 120\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts.\n// Croissants >= 50, Muffins >= 60, Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissants_Ovens >= 1, Muffins_Ovens >= 1, Donuts_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry     | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|------------|--------------------|-----------------|------------------------------|\n| Croissants | $2                 | $0.5            | $50                          |\n| Muffins    | $3                 | $1              | $40                          |\n| Donuts     | $1.5               | $0.7            | $30                          |\n\nThe bakery wants to maximize the daily profit. Each croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours. The bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts. The bakery needs to rent at least one oven for each type of pastry.\n\nPlease help the bakery to determine the optimal number of each type of pastry to produce and the number of ovens to rent to maximize daily profits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissants_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissants_Ovens\", lb=0) # number of ovens to rent for croissants\nMuffins_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffins_Ovens\", lb=0) # number of ovens to rent for muffins\nDonuts_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donuts_Ovens\", lb=0) # number of ovens to rent for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 120)\n## The bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 60)\nmodel.addCons(Donuts >= 100)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissants_Ovens >= 1)\nmodel.addCons(Muffins_Ovens >= 1)\nmodel.addCons(Donuts_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to rent for croissants: \", model.getVal(Croissants_Ovens))\n    print(\"Number of ovens to rent for muffins: \", model.getVal(Muffins_Ovens))\n    print(\"Number of ovens to rent for donuts: \", model.getVal(Donuts_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for croissants\": \"Croissants_Ovens\", \"range\": \"Croissants_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for muffins\": \"Muffins_Ovens\", \"range\": \"Muffins_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for donuts\": \"Donuts_Ovens\", \"range\": \"Donuts_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per oven per day is $50 for croissants, $40 for muffins, and $30 for donuts.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 120\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts.\n// Croissants >= 50, Muffins >= 60, Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissants_Ovens >= 1, Muffins_Ovens >= 1, Donuts_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. The rental cost per oven per day is $50 for croissants, $40 for muffins, and $30 for donuts. The bakery wants to maximize the daily profit. Each croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours. The bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissants_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissants_Ovens\", lb=0) # number of ovens to rent for croissants\nMuffins_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffins_Ovens\", lb=0) # number of ovens to rent for muffins\nDonuts_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donuts_Ovens\", lb=0) # number of ovens to rent for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Croissants_Ovens + 40*Muffins_Ovens + 30*Donuts_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.5 hour of baking time, each muffin requires 0.4 hour, and each donut requires 0.3 hour. The total daily baking time available is 120 hours.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 120)\n## The bakery has a daily demand for at least 50 croissants, 60 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 60)\nmodel.addCons(Donuts >= 100)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissants_Ovens >= 1)\nmodel.addCons(Muffins_Ovens >= 1)\nmodel.addCons(Donuts_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to rent for croissants: \", model.getVal(Croissants_Ovens))\n    print(\"Number of ovens to rent for muffins: \", model.getVal(Muffins_Ovens))\n    print(\"Number of ovens to rent for donuts: \", model.getVal(Donuts_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of doughnut ovens to rent\": \"Doughnut_Ovens\", \"range\": \"Doughnut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\n// 15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Doughnut_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry       | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|--------------|--------------------|-----------------|------------------------------|\n| Croissants   | $2                 | $1              | $100                         |\n| Muffins      | $3                 | $1.5            | $120                         |\n| Doughnuts    | $2.5               | $1.2            | $90                          |\n\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours. The bakery has a daily budget of $500 for oven rentals. The bakery needs to rent at least one oven for each type of pastry.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDoughnut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Doughnut_Ovens\", lb=0) # number of doughnut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Doughnut_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of doughnut ovens to rent: \", model.getVal(Doughnut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of doughnut ovens to rent\": \"Doughnut_Ovens\", \"range\": \"Doughnut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\n// 15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Doughnut_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry. The revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90. The bakery wants to maximize the daily profit. The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes, with a total daily baking time available of 8 hours. The bakery has a daily budget of $500 for oven rentals. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDoughnut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Doughnut_Ovens\", lb=0) # number of doughnut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Doughnut_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of doughnut ovens to rent: \", model.getVal(Doughnut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide the optimal number of each type of pastry to produce and the number of ovens to rent for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $1, and the cost per muffin is $1.50. \nThe rental cost per croissant oven per day is $50, and the rental cost per muffin oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day.\n// 15*Croissants/60*Croissant_Ovens + 20*Muffins/60*Muffin_Ovens <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for oven rentals.\n// 50*Croissant_Ovens + 40*Muffin_Ovens <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide the optimal number of each type of pastry to produce and the number of ovens to rent for each type. The revenue and cost per pastry, as well as the rental cost per oven, are given in the following Table.\n\n| Pastry       | Revenue per Pastry | Cost per Pastry | Time to Bake (minutes) | Rental Cost per Oven per Day |\n|--------------|--------------------|-----------------|-------------------------|------------------------------|\n| Croissants   | $2                 | $1              | 15                      | $50                          |\n| Muffins      | $3                 | $1.50           | 20                      | $40                          |\n\nThe bakery wants to maximize the daily profit. The time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day. The bakery has a daily budget of $200 for oven rentals. The bakery needs to rent at least one oven for each type of pastry.\n\nPlease help the bakery determine the optimal number of croissants and muffins to produce, and the number of ovens to rent for each type to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day.\nmodel.addCons(15*Croissants/60*Croissant_Ovens + 20*Muffins/60*Muffin_Ovens <= 8)\n## The bakery has a daily budget of $200 for oven rentals.\nmodel.addCons(50*Croissant_Ovens + 40*Muffin_Ovens <= 200)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide the optimal number of each type of pastry to produce and the number of ovens to rent for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $1, and the cost per muffin is $1.50. \nThe rental cost per croissant oven per day is $50, and the rental cost per muffin oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day.\n// 15*Croissants/60*Croissant_Ovens + 20*Muffins/60*Muffin_Ovens <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for oven rentals.\n// 50*Croissant_Ovens + 40*Muffin_Ovens <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide the optimal number of each type of pastry to produce and the number of ovens to rent for each type. The revenue per croissant is $2, and the revenue per muffin is $3. The cost per croissant is $1, and the cost per muffin is $1.50. The rental cost per croissant oven per day is $50, and the rental cost per muffin oven per day is $40. The bakery wants to maximize the daily profit. The time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day. The bakery has a daily budget of $200 for oven rentals. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery determine the optimal number of croissants and muffins to produce and the number of ovens to rent for each type to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 50*Croissant_Ovens + 40*Muffin_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, and the time required to bake a muffin is 20 minutes. Each oven can operate for a maximum of 8 hours per day.\nmodel.addCons(15*Croissants/60*Croissant_Ovens + 20*Muffins/60*Muffin_Ovens <= 8)\n## The bakery has a daily budget of $200 for oven rentals.\nmodel.addCons(50*Croissant_Ovens + 40*Muffin_Ovens <= 200)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of bagel ovens to rent\": \"Bagel_Ovens\", \"range\": \"Bagel_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. \nThe cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes.\n// 15*Croissants + 20*Muffins + 10*Bagels <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams.\n// 0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Bagel_Ovens >= 1",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry     | Revenue per Unit | Cost per Unit | Time to Bake per Unit | Oven Rental Cost per Day |\n|------------|------------------|---------------|-----------------------|--------------------------|\n| Croissants | $2               | $1            | 15 minutes            | $100                     |\n| Muffins    | $3               | $1.5          | 20 minutes            | $120                     |\n| Bagels     | $1.5             | $0.8          | 10 minutes            | $80                      |\n\nThe bakery wants to maximize the daily profit. The time required to bake each pastry and the total daily baking time available are as follows: 15 minutes per croissant, 20 minutes per muffin, 10 minutes per bagel, and a total of 480 minutes daily. The bakery has a daily supply of 200 kg of flour, with each croissant requiring 50 grams, each muffin requiring 75 grams, and each bagel requiring 100 grams. The bakery needs to rent at least one oven for each type of pastry.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of each type of pastry to produce and the number of ovens to rent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nBagel_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Bagel_Ovens\", lb=0) # number of bagel ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens))\n\n# Add constraints\n## The time required to bake each pastry\nmodel.addCons(15*Croissants + 20*Muffins + 10*Bagels <= 480)\n## The bakery has a daily supply of 200 kg of flour\nmodel.addCons(0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200)\n## The bakery needs to rent at least one oven for each type of pastry\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Bagel_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of bagel ovens to rent: \", model.getVal(Bagel_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of bagel ovens to rent\": \"Bagel_Ovens\", \"range\": \"Bagel_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. \nThe cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes.\n// 15*Croissants + 20*Muffins + 10*Bagels <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams.\n// 0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Bagel_Ovens >= 1",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry. The revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80. The bakery wants to maximize the daily profit. The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes. The bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nBagel_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Bagel_Ovens\", lb=0) # number of bagel ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens))\n\n# Add constraints\n## The time required to bake each pastry\nmodel.addCons(15*Croissants + 20*Muffins + 10*Bagels <= 480)\n## The bakery has a daily supply of 200 kg of flour\nmodel.addCons(0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200)\n## The bakery needs to rent at least one oven for each type of pastry\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Bagel_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of bagel ovens to rent: \", model.getVal(Bagel_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\n// Croissants >= 20, Muffins >= 30",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required. The revenue and cost per pastry, as well as the required ingredients and labor, are given in the following Table.\n\n| Pastry    | Revenue per Unit | Cost per Unit | Ingredients per Unit | Labor per Unit |\n|-----------|------------------|---------------|----------------------|----------------|\n| Croissant | $2               | $0.5          | 0.5 pounds           | 0.2 hours      |\n| Muffin    | $3               | $1             | 0.4 pounds           | 0.3 hours      |\n| Doughnut  | $1.5             | $0.7          | 0.3 pounds           | 0.1 hours      |\n\nThe bakery has a daily limit of 100 pounds of flour and 80 hours of labor. The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand. Please help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Doughnuts) - (0.5*Croissants + 1*Muffins + 0.7*Doughnuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80)\n## The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\n// Croissants >= 20, Muffins >= 30",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required. The revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. The cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. The bakery has a daily limit of 100 pounds of flour, where each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds. The bakery also has a daily limit of 80 hours of labor, where each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours. The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand. Please help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Doughnuts) - (0.5*Croissants + 1*Muffins + 0.7*Doughnuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80)\n## The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. \nThe cost per chocolate cake is $10, and the cost per vanilla cake is $8. \nThe rental cost per oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n// Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent. The revenue and cost per cake, as well as the rental cost per oven, are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Ingredients Required per Cake | Baking Time per Cake |\n|------------------|------------------|---------------|-------------------------------|----------------------|\n| Chocolate        | $20              | $10           | 2 kg                          | 2 hours              |\n| Vanilla          | $18              | $8            | 1 kg                          | 1 hour               |\n\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day. The bakery needs to rent at least one oven. The rental cost per oven per day is $150.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\nTotal_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n## Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nTotal_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1303,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. \nThe cost per chocolate cake is $10, and the cost per vanilla cake is $8. \nThe rental cost per oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n// Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent. The revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. The cost per chocolate cake is $10, and the cost per vanilla cake is $8. The rental cost per oven per day is $150. The bakery wants to maximize the daily profit. The chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day. The bakery needs to rent at least one oven. Please help the bakery determine the optimal number of chocolate and vanilla cakes to produce and the number of ovens to rent to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\nTotal_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n## Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nTotal_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many ovens to rent to meet demand efficiently.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ovens to rent\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ovens to rent\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. \nThe cost per chocolate cake is $4, and the cost per vanilla cake is $3. \nThe rental cost per chocolate cake oven per day is $50, and the rental cost per vanilla cake oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many ovens to rent to meet demand efficiently. The revenue and cost details for each type of cake and the rental cost for each type of oven are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Oven Rental Cost per Day |\n|-----------------|------------------|---------------|--------------------------|\n| Chocolate       | $10              | $4            | $50                      |\n| Vanilla         | $8               | $3            | $40                      |\n\nThe bakery wants to maximize the daily profit. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available. The ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available. The bakery needs to rent at least one oven for each type of cake.\n\nPlease help the bakery to determine the optimal number of chocolate and vanilla cakes to produce and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of chocolate cake ovens to rent\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of vanilla cake ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes) - (4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens))\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 120)\n## The ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 100)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of chocolate cake ovens to rent: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of vanilla cake ovens to rent: \", model.getVal(Vanilla_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many ovens to rent to meet demand efficiently.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ovens to rent\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ovens to rent\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. \nThe cost per chocolate cake is $4, and the cost per vanilla cake is $3. \nThe rental cost per chocolate cake oven per day is $50, and the rental cost per vanilla cake oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many ovens to rent to meet demand efficiently. The revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. The cost per chocolate cake is $4, and the cost per vanilla cake is $3. The rental cost per chocolate cake oven per day is $50, and the rental cost per vanilla cake oven per day is $40. The bakery wants to maximize the daily profit. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available. The ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available. The bakery needs to rent at least one oven for each type of cake. Please help the bakery determine the optimal number of chocolate and vanilla cakes to produce and the number of ovens to rent to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of chocolate cake ovens to rent\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of vanilla cake ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes) - (4*Chocolate_Cakes + 3*Vanilla_Cakes + 50*Chocolate_Ovens + 40*Vanilla_Ovens))\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each day, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 120)\n## The ingredients required for a chocolate cake is 3 lbs, and the ingredients required for a vanilla cake is 2 lbs. Each day, 100 lbs of ingredients are available.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 100)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of chocolate cake ovens to rent: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of vanilla cake ovens to rent: \", model.getVal(Vanilla_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 40\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\n// 0.5*Wheat_Bread + 0.7*Rye_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type. The revenue and cost details for each type of bread and oven rental are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Oven Rental Cost per Hour |\n|------------|------------------|---------------|---------------------------|\n| Wheat      | $3               | $1            | $50                       |\n| Rye        | $4               | $2            | $60                       |\n\nThe bakery wants to maximize the daily profit. Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day. The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour. The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\n\nPlease help the bakery determine the optimal number of loaves of wheat bread and rye bread to produce, and the optimal number of oven hours to rent for each type of bread to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of oven hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven_Hours\", lb=0) # number of oven hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven_Hours\", lb=0) # number of oven hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nTotal_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 40)\n## The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\nmodel.addCons(0.5*Wheat_Bread + 0.7*Rye_Bread <= 50)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of oven hours for wheat bread: \", model.getVal(Wheat_Oven_Hours))\n    print(\"Number of oven hours for rye bread: \", model.getVal(Rye_Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 40\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\n// 0.5*Wheat_Bread + 0.7*Rye_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type. The revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. The cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. The cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60. The bakery wants to maximize the daily profit. Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day. The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour. The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of oven hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven_Hours\", lb=0) # number of oven hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven_Hours\", lb=0) # number of oven hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nTotal_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 40)\n## The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\nmodel.addCons(0.5*Wheat_Bread + 0.7*Rye_Bread <= 50)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of oven hours for wheat bread: \", model.getVal(Wheat_Oven_Hours))\n    print(\"Number of oven hours for rye bread: \", model.getVal(Rye_Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce and how many ovens to rent for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of wheat bread ovens to rent\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread ovens to rent\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. \nThe cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. \nThe rental cost per wheat bread oven per day is $100, and the rental cost per rye bread oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\n// Total_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour. Each day, 10 hours of baking time are available.\n// 0.5*Wheat_Loaves + 1*Rye_Loaves <= 10\n\n## Generate Constraint-2:\nThe flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg. Each day, 6 kg of flour are available.\n// 0.5*Wheat_Loaves + 0.7*Rye_Loaves <= 6\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of bread.\n// Wheat_Ovens >= 1, Rye_Ovens >= 1",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce and how many ovens to rent for each type. The revenue and cost per loaf, as well as the rental cost per oven, are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Rental Cost per Oven per Day |\n|------------|------------------|---------------|------------------------------|\n| Wheat      | $3               | $1            | $100                         |\n| Rye        | $4               | $2            | $150                         |\n\nThe bakery wants to maximize the daily profit. The baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour, with a total of 10 hours of baking time available each day. The flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg, with a total of 6 kg of flour available each day. The bakery needs to rent at least one oven for each type of bread.\n\nPlease help the bakery determine the optimal number of wheat and rye bread loaves to produce and the number of ovens to rent for each type to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves and ovens for each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of wheat bread ovens to rent\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of rye bread ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\nTotal_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\n## Total_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\nTotal_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour. Each day, 10 hours of baking time are available.\nmodel.addCons(0.5*Wheat_Loaves + 1*Rye_Loaves <= 10)\n## The flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg. Each day, 6 kg of flour are available.\nmodel.addCons(0.5*Wheat_Loaves + 0.7*Rye_Loaves <= 6)\n## The bakery needs to rent at least one oven for each type of bread.\nmodel.addCons(Wheat_Ovens >= 1)\nmodel.addCons(Rye_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Number of wheat bread ovens to rent: \", model.getVal(Wheat_Ovens))\n    print(\"Number of rye bread ovens to rent: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce and how many ovens to rent for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of wheat bread ovens to rent\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread ovens to rent\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. \nThe cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. \nThe rental cost per wheat bread oven per day is $100, and the rental cost per rye bread oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\n// Total_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour. Each day, 10 hours of baking time are available.\n// 0.5*Wheat_Loaves + 1*Rye_Loaves <= 10\n\n## Generate Constraint-2:\nThe flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg. Each day, 6 kg of flour are available.\n// 0.5*Wheat_Loaves + 0.7*Rye_Loaves <= 6\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of bread.\n// Wheat_Ovens >= 1, Rye_Ovens >= 1",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce and how many ovens to rent for each type. The revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. The cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. The rental cost per wheat bread oven per day is $100, and the rental cost per rye bread oven per day is $150. The bakery wants to maximize the daily profit. The baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour. Each day, 10 hours of baking time are available. The flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg. Each day, 6 kg of flour are available. The bakery needs to rent at least one oven for each type of bread. Please help the bakery determine the optimal number of loaves and ovens to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves and ovens for each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of wheat bread ovens to rent\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of rye bread ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\nTotal_Revenue = 3*Wheat_Loaves + 4*Rye_Loaves\n## Total_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\nTotal_Cost = 1*Wheat_Loaves + 2*Rye_Loaves + 100*Wheat_Ovens + 150*Rye_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per wheat bread loaf is 0.5 hours, and the baking time required per rye bread loaf is 1 hour. Each day, 10 hours of baking time are available.\nmodel.addCons(0.5*Wheat_Loaves + 1*Rye_Loaves <= 10)\n## The flour required per wheat bread loaf is 0.5 kg, and the flour required per rye bread loaf is 0.7 kg. Each day, 6 kg of flour are available.\nmodel.addCons(0.5*Wheat_Loaves + 0.7*Rye_Loaves <= 6)\n## The bakery needs to rent at least one oven for each type of bread.\nmodel.addCons(Wheat_Ovens >= 1)\nmodel.addCons(Rye_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Number of wheat bread ovens to rent: \", model.getVal(Wheat_Ovens))\n    print(\"Number of rye bread ovens to rent: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"amount of flour to purchase\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"amount of sugar to purchase\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of flour per kg is $1, and the cost of sugar per kg is $2. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Flour + 2*Sugar\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 kg of flour and 0.05 kg of sugar. Each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily budget of $20 for purchasing ingredients.\n// 0.1*Croissants + 0.2*Muffins <= Flour\n// 0.05*Croissants + 0.1*Muffins <= Sugar\n// Flour + 2*Sugar <= 20\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 100 pastries.\n// Croissants + Muffins <= 100\n\n## Generate Constraint-3:\nThe bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\n// 0.1*Croissants + 0.2*Muffins <= Flour",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of flour per kg is $1, and the cost of sugar per kg is $2. The bakery wants to maximize the daily profit.\n\n| Pastry   | Revenue per Unit | Flour Required (kg) | Sugar Required (kg) |\n|----------|------------------|---------------------|---------------------|\n| Croissant| 3$               | 0.1                 | 0.05                |\n| Muffin   | 2$               | 0.2                 | 0.1                 |\n\nThe bakery has a daily budget of $20 for purchasing ingredients. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, and each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily production capacity of 100 pastries. The bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\n\nPlease help the bakery to determine the optimal number of croissants and muffins to produce, and the corresponding amount of flour and sugar to purchase to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the amount of ingredients to purchase\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour to purchase\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # amount of sugar to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Flour + 2*Sugar\nmodel.addCons(obj == 3*Croissants + 2*Muffins - Flour - 2*Sugar)\n\n# Add constraints\n## Each croissant requires 0.1 kg of flour and 0.05 kg of sugar. Each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily budget of $20 for purchasing ingredients.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Flour)\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= Sugar)\nmodel.addCons(Flour + 2*Sugar <= 20)\n## The bakery has a daily production capacity of 100 pastries.\nmodel.addCons(Croissants + Muffins <= 100)\n## The bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Flour)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Amount of flour to purchase: \", model.getVal(Flour))\n    print(\"Amount of sugar to purchase: \", model.getVal(Sugar))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"amount of flour to purchase\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"amount of sugar to purchase\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of flour per kg is $1, and the cost of sugar per kg is $2. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Flour + 2*Sugar\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 kg of flour and 0.05 kg of sugar. Each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily budget of $20 for purchasing ingredients.\n// 0.1*Croissants + 0.2*Muffins <= Flour\n// 0.05*Croissants + 0.1*Muffins <= Sugar\n// Flour + 2*Sugar <= 20\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 100 pastries.\n// Croissants + Muffins <= 100\n\n## Generate Constraint-3:\nThe bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\n// 0.1*Croissants + 0.2*Muffins <= Flour",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce and the corresponding amount of ingredients to purchase. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of flour per kg is $1, and the cost of sugar per kg is $2. The bakery wants to maximize the daily profit.\nEach croissant requires 0.1 kg of flour and 0.05 kg of sugar. Each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily budget of $20 for purchasing ingredients. The bakery has a daily production capacity of 100 pastries. The bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\nPlease help the bakery to determine the optimal number of croissants and muffins to produce and the corresponding amount of flour and sugar to purchase to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the amount of ingredients to purchase\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour to purchase\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # amount of sugar to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Flour + 2*Sugar\nmodel.addCons(obj == 3*Croissants + 2*Muffins - Flour - 2*Sugar)\n\n# Add constraints\n## Each croissant requires 0.1 kg of flour and 0.05 kg of sugar. Each muffin requires 0.2 kg of flour and 0.1 kg of sugar. The bakery has a daily budget of $20 for purchasing ingredients.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Flour)\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= Sugar)\nmodel.addCons(Flour + 2*Sugar <= 20)\n## The bakery has a daily production capacity of 100 pastries.\nmodel.addCons(Croissants + Muffins <= 100)\n## The bakery must ensure that the total amount of flour used does not exceed the total amount purchased.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Flour)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Amount of flour to purchase: \", model.getVal(Flour))\n    print(\"Amount of sugar to purchase: \", model.getVal(Sugar))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry    | Revenue per Pastry | Cost per Pastry | Baking Time per Pastry | Flour Required per Pastry |\n|-----------|--------------------|-----------------|------------------------|---------------------------|\n| Croissants| 2$                | 1$              | 10 minutes             | 0.1 kg                    |\n| Muffins   | 3$                | 1.5$            | 15 minutes             | 0.2 kg                    |\n| Doughnuts | 4$                | 2$              | 20 minutes             | 0.3 kg                    |\n\nThe bakery wants to maximize the daily profit. The baking time required for each pastry and the maximum operating time of each oven are given. The bakery has a daily supply of 200 kg of flour. The bakery needs to rent at least one oven. Please help the bakery to determine the optimal number of each type of pastry to produce and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Doughnuts) - (Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens))\n\n# Add constraints\n## The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens)\n## The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue per croissant is $2, per muffin is $3, and per doughnut is $4. The cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. The rental cost per oven per day is $100. The bakery wants to maximize the daily profit. The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour. The bakery needs to rent at least one oven. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Doughnuts) - (Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens))\n\n# Add constraints\n## The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens)\n## The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of donut ovens to rent\": \"Donut_Ovens\", \"range\": \"Donut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to produce at least 50 pastries of each type daily.\n// Croissants >= 50, Muffins >= 50, Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry     | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|------------|--------------------|-----------------|------------------------------|\n| Croissants | $2                 | $1              | $100                         |\n| Muffins    | $3                 | $1.5            | $120                         |\n| Donuts     | $2.5               | $1.2            | $90                          |\n\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily budget of $500 for oven rentals. The bakery needs to produce at least 50 pastries of each type daily.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDonut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donut_Ovens\", lb=0) # number of donut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500)\n## The bakery needs to produce at least 50 pastries of each type daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of donut ovens to rent: \", model.getVal(Donut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of donut ovens to rent\": \"Donut_Ovens\", \"range\": \"Donut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to produce at least 50 pastries of each type daily.\n// Croissants >= 50, Muffins >= 50, Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue per croissant is $2, per muffin is $3, and per donut is $2.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90. The bakery wants to maximize the daily profit. The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily budget of $500 for oven rentals. The bakery needs to produce at least 50 pastries of each type daily. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDonut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donut_Ovens\", lb=0) # number of donut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500)\n## The bakery needs to produce at least 50 pastries of each type daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of donut ovens to rent: \", model.getVal(Donut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of equipment to rent\": \"Equipment\", \"range\": \"Equipment >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per equipment per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units.\n// 0.5*Croissants + Muffins + 0.5*Donuts <= 150\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one equipment for production.\n// Equipment >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment. The revenue and cost per pastry, as well as the rental cost per equipment, are given in the following Table.\n\n| Pastry     | Revenue per Unit | Cost per Unit | Units of Flour Required | Units of Sugar Required |\n|------------|------------------|---------------|-------------------------|------------------------|\n| Croissants | $2               | $0.5          | 1                       | 0.5                    |\n| Muffins    | $3               | $1             | 2                       | 1                      |\n| Donuts     | $1.5             | $0.7          | 1                       | 0.5                    |\n\nThe bakery has a daily limit of 200 units of flour and 150 units of sugar. Each croissant requires 1 unit of flour and 0.5 units of sugar, each muffin requires 2 units of flour and 1 unit of sugar, and each donut requires 1 unit of flour and 0.5 units of sugar. The bakery needs to rent at least one equipment for production, with a rental cost of $50 per day.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of equipment to rent\nEquipment = model.addVar(vtype=\"INTEGER\", name=\"Equipment\", lb=0) # number of equipment to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 200 units of flour.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a daily limit of 150 units of sugar.\nmodel.addCons(0.5*Croissants + Muffins + 0.5*Donuts <= 150)\n## The bakery needs to rent at least one equipment for production.\nmodel.addCons(Equipment >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of equipment to rent: \", model.getVal(Equipment))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of equipment to rent\": \"Equipment\", \"range\": \"Equipment >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per equipment per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units.\n// 0.5*Croissants + Muffins + 0.5*Donuts <= 150\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one equipment for production.\n// Equipment >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. The rental cost per equipment per day is $50. The bakery wants to maximize the daily profit. The bakery has a daily limit of 200 units of flour, where each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit. The bakery also has a daily limit of 150 units of sugar, where each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units. The bakery needs to rent at least one equipment for production. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of equipment to rent\nEquipment = model.addVar(vtype=\"INTEGER\", name=\"Equipment\", lb=0) # number of equipment to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 200 units of flour.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a daily limit of 150 units of sugar.\nmodel.addCons(0.5*Croissants + Muffins + 0.5*Donuts <= 150)\n## The bakery needs to rent at least one equipment for production.\nmodel.addCons(Equipment >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of equipment to rent: \", model.getVal(Equipment))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake ingredients\": \"Strawberry_Ingredients\", \"range\": \"Strawberry_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. \nThe cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. \nThe cost of ingredients for each type of cake is $5.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n// Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each chocolate cake requires 2 kg of flour, each vanilla cake requires 1 kg, and each strawberry cake requires 3 kg.\n// 2*Chocolate + Vanilla + 3*Strawberry <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each chocolate cake requires 1 kg of sugar, each vanilla cake requires 2 kg, and each strawberry cake requires 1 kg.\n// Chocolate + 2*Vanilla + Strawberry <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for each type of cake. The maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20.\n// Chocolate <= 30, Vanilla <= 25, Strawberry <= 20",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake. The revenue and cost per cake, as well as the ingredient requirements, are given in the following Table.\n\n| Cake Type     | Revenue per Cake | Cost per Cake | Ingredient Cost | Flour Requirement | Sugar Requirement |\n|---------------|------------------|---------------|-----------------|-------------------|-------------------|\n| Chocolate     | $20              | $10           | $5              | 2 kg              | 1 kg              |\n| Vanilla       | $18              | $8            | $5              | 1 kg              | 2 kg              |\n| Strawberry    | $22              | $12           | $5              | 3 kg              | 1 kg              |\n\nThe bakery has 100 kg of flour and 50 kg of sugar available daily. The bakery has a daily demand limit for each type of cake: the maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20. \n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the ingredients\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\nStrawberry_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ingredients\", lb=0) # number of strawberry cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n## Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\nmodel.addCons(obj == (20*Chocolate + 18*Vanilla + 22*Strawberry) - (10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(2*Chocolate + Vanilla + 3*Strawberry <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(Chocolate + 2*Vanilla + Strawberry <= 50)\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Chocolate <= 30)\nmodel.addCons(Vanilla <= 25)\nmodel.addCons(Strawberry <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of chocolate cake ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Number of vanilla cake ingredients: \", model.getVal(Vanilla_Ingredients))\n    print(\"Number of strawberry cake ingredients: \", model.getVal(Strawberry_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake ingredients\": \"Strawberry_Ingredients\", \"range\": \"Strawberry_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. \nThe cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. \nThe cost of ingredients for each type of cake is $5.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n// Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each chocolate cake requires 2 kg of flour, each vanilla cake requires 1 kg, and each strawberry cake requires 3 kg.\n// 2*Chocolate + Vanilla + 3*Strawberry <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each chocolate cake requires 1 kg of sugar, each vanilla cake requires 2 kg, and each strawberry cake requires 1 kg.\n// Chocolate + 2*Vanilla + Strawberry <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for each type of cake. The maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20.\n// Chocolate <= 30, Vanilla <= 25, Strawberry <= 20",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake. The revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. The cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. The cost of ingredients for each type of cake is $5. The bakery has 100 kg of flour available daily, with each chocolate cake requiring 2 kg of flour, each vanilla cake requiring 1 kg, and each strawberry cake requiring 3 kg. The bakery also has 50 kg of sugar available daily, with each chocolate cake requiring 1 kg of sugar, each vanilla cake requiring 2 kg, and each strawberry cake requiring 1 kg. The bakery has a daily demand limit for each type of cake: the maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the ingredients\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\nStrawberry_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ingredients\", lb=0) # number of strawberry cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n## Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\nmodel.addCons(obj == (20*Chocolate + 18*Vanilla + 22*Strawberry) - (10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(2*Chocolate + Vanilla + 3*Strawberry <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(Chocolate + 2*Vanilla + Strawberry <= 50)\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Chocolate <= 30)\nmodel.addCons(Vanilla <= 25)\nmodel.addCons(Strawberry <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of chocolate cake ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Number of vanilla cake ingredients: \", model.getVal(Vanilla_Ingredients))\n    print(\"Number of strawberry cake ingredients: \", model.getVal(Strawberry_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The following table summarizes the raw material units and labor hours required for each product.\n\n| Product | Raw Material Units | Labor Hours | Profit per Unit |\n|---------|-------------------|-------------|-----------------|\n| A       | 2                 | 1           | $10             |\n| B       | 3                 | 2           | $15             |\n| C       | 4                 | 3           | $20             |\n| D       | 5                 | 4           | $25             |\n\nThe company has 100 raw material units and 60 labor hours available. The company must produce at least 5 units of product A. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively, and the company has 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively, and the company has 60 labor hours available. The company must produce at least 5 units of product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $20, and $15 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 15*D\n\n## Generate Constraint-1:\nThe company has a total of 100 labor hours available. Each unit of product A, B, C, and D requires 4, 5, 2, and 3 labor hours respectively.\n// 4*A + 5*B + 2*C + 3*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B.\n// A <= 20\n// B <= 15\n\n## Generate Constraint-3:\nThe market demand for product C is at least 5 units and for product D is at least 10 units.\n// C >= 5\n// D >= 10",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $20, and $15 respectively. The company has a total of 100 labor hours available, with each unit of product A, B, C, and D requiring 4, 5, 2, and 3 labor hours respectively. The company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B. The market demand for product C is at least 5 units and for product D is at least 10 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $30             | 4                    |\n| B       | $40             | 5                    |\n| C       | $20             | 2                    |\n| D       | $15             | 3                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 15*D)\n\n# Add constraints\n## The company has a total of 100 labor hours available.\nmodel.addCons(4*A + 5*B + 2*C + 3*D <= 100)\n## The company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 15)\n## The market demand for product C is at least 5 units and for product D is at least 10 units.\nmodel.addCons(C >= 5)\nmodel.addCons(D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $20, and $15 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 15*D\n\n## Generate Constraint-1:\nThe company has a total of 100 labor hours available. Each unit of product A, B, C, and D requires 4, 5, 2, and 3 labor hours respectively.\n// 4*A + 5*B + 2*C + 3*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B.\n// A <= 20\n// B <= 15\n\n## Generate Constraint-3:\nThe market demand for product C is at least 5 units and for product D is at least 10 units.\n// C >= 5\n// D >= 10",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The profit per unit for products A-D is $30, $40, $20, and $15 respectively. The company has a total of 100 labor hours available, with each unit of product A, B, C, and D requiring 4, 5, 2, and 3 labor hours respectively. The company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B. The market demand for product C is at least 5 units and for product D is at least 10 units. Please help the company decide how many units of each product to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 15*D)\n\n# Add constraints\n## The company has a total of 100 labor hours available.\nmodel.addCons(4*A + 5*B + 2*C + 3*D <= 100)\n## The company has a limited supply of raw material that can produce at most 20 units of product A and 15 units of product B.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 15)\n## The market demand for product C is at least 5 units and for product D is at least 10 units.\nmodel.addCons(C >= 5)\nmodel.addCons(D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 641,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\n// 4*A + 6*B + 3*C + 5*D <= 120\n\n## Generate Constraint-3:\nThe company has a minimum demand for product C, which is 5 units.\n// C >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. The requirements for labor hours and raw materials for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Raw Materials per Unit |\n|---------|----------------------|------------------------|\n| A       | 2 hours              | 4 units                |\n| B       | 3 hours              | 6 units                |\n| C       | 1 hour               | 3 units                |\n| D       | 2 hours              | 5 units                |\n\nThe total available labor hours are 100 hours, and the total available raw materials are 120 units. The company has a minimum demand for product C, which is 5 units. Please help the company determine the optimal number of units of each product to produce in order to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\nmodel.addCons(4*A + 6*B + 3*C + 5*D <= 120)\n## The company has a minimum demand for product C, which is 5 units.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\n// 4*A + 6*B + 3*C + 5*D <= 120\n\n## Generate Constraint-3:\nThe company has a minimum demand for product C, which is 5 units.\n// C >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively, with a total available labor hours of 100 hours. Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively, with a total available raw materials of 120 units. The company has a minimum demand for product C, which is 5 units. Please help the company determine the optimal number of units of each product to produce to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\nmodel.addCons(4*A + 6*B + 3*C + 5*D <= 120)\n## The company has a minimum demand for product C, which is 5 units.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours per unit of each product are given in the following Table.\n\n| Product | Raw Material Units | Labor Hours | Profit per Unit |\n|---------|-------------------|-------------|-----------------|\n| A       | 2                 | 1           | $10             |\n| B       | 3                 | 2           | $15             |\n| C       | 4                 | 3           | $20             |\n| D       | 5                 | 4           | $25             |\n\nThe company has 100 raw material units and 60 labor hours available. The company must produce at least 5 units of product A. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively, and the company has 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively, and the company has 60 labor hours available. The company must produce at least 5 units of product A. Please help the company determine the optimal number of units of each product to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 750,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $10             | $5                       |\n| B       | $15             | $7                       |\n| C       | $8              | $4                       |\n| D       | $12             | $6                       |\n\nThe company has a budget of $100 for production. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit. The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming event. Each cake type requires a specific amount of ingredients and contributes differently to the bakery's revenue. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each cake type is $10, $15, $8, and $12 respectively. The bakery wants to maximize the total revenue from the cakes.\n// Objective Function: Maximize: 10*C1 + 15*C2 + 8*C3 + 12*C4\n\n## Generate Constraint-1:\nThe total baking time for Cake 1, Cake 2, Cake 3, and Cake 4 is 2 hours, 3 hours, 1 hour, and 2 hours respectively. The bakery has a total of 10 hours available for baking.\n// 2*C1 + 3*C2 + 1*C3 + 2*C4 <= 10\n\n## Generate Constraint-2:\nThe bakery has a limited supply of a key ingredient, with enough for 5 units of Cake 1, 4 units of Cake 2, 3 units of Cake 3, and 2 units of Cake 4.\n// C1 <= 5\n// C2 <= 4\n// C3 <= 3\n// C4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 2 cakes of any type.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming event. Each cake type requires a specific amount of ingredients and contributes differently to the bakery's revenue. The bakery needs to decide how many of each type of cake to produce. The revenue generated by each cake type is $10, $15, $8, and $12 respectively. The baking time for each cake type is 2 hours for Cake 1, 3 hours for Cake 2, 1 hour for Cake 3, and 2 hours for Cake 4. The bakery has a total of 10 hours available for baking. The bakery also has a limited supply of a key ingredient, with enough for 5 units of Cake 1, 4 units of Cake 2, 3 units of Cake 3, and 2 units of Cake 4. The bakery must produce at least 2 cakes of any type.\n\nPlease help the bakery to maximize the total revenue from the cakes.\n\n| Cake Type | Revenue per Cake | Baking Time | Ingredient Limit |\n|-----------|------------------|-------------|------------------|\n| 1         | $10              | 2 hours     | 5 units          |\n| 2         | $15              | 3 hours     | 4 units          |\n| 3         | $8               | 1 hour      | 3 units          |\n| 4         | $12              | 2 hours     | 2 units          |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*C1 + 15*C2 + 8*C3 + 12*C4)\n\n# Add constraints\n## The total baking time for all cakes\nmodel.addCons(2*C1 + 3*C2 + 1*C3 + 2*C4 <= 10)\n## The limited supply of a key ingredient\nmodel.addCons(C1 <= 5)\nmodel.addCons(C2 <= 4)\nmodel.addCons(C3 <= 3)\nmodel.addCons(C4 <= 2)\n## The bakery must produce at least 2 cakes of any type\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1: \", model.getVal(C1))\n    print(\"Number of Cake 2: \", model.getVal(C2))\n    print(\"Number of Cake 3: \", model.getVal(C3))\n    print(\"Number of Cake 4: \", model.getVal(C4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming event. Each cake type requires a specific amount of ingredients and contributes differently to the bakery's revenue. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each cake type is $10, $15, $8, and $12 respectively. The bakery wants to maximize the total revenue from the cakes.\n// Objective Function: Maximize: 10*C1 + 15*C2 + 8*C3 + 12*C4\n\n## Generate Constraint-1:\nThe total baking time for Cake 1, Cake 2, Cake 3, and Cake 4 is 2 hours, 3 hours, 1 hour, and 2 hours respectively. The bakery has a total of 10 hours available for baking.\n// 2*C1 + 3*C2 + 1*C3 + 2*C4 <= 10\n\n## Generate Constraint-2:\nThe bakery has a limited supply of a key ingredient, with enough for 5 units of Cake 1, 4 units of Cake 2, 3 units of Cake 3, and 2 units of Cake 4.\n// C1 <= 5\n// C2 <= 4\n// C3 <= 3\n// C4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 2 cakes of any type.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming event. Each cake type requires a specific amount of ingredients and contributes differently to the bakery's revenue. The revenue generated by each cake type is $10, $15, $8, and $12 respectively. The bakery wants to maximize the total revenue from the cakes. The total baking time for Cake 1, Cake 2, Cake 3, and Cake 4 is 2 hours, 3 hours, 1 hour, and 2 hours respectively, with a total of 10 hours available for baking. The bakery has a limited supply of a key ingredient, with enough for 5 units of Cake 1, 4 units of Cake 2, 3 units of Cake 3, and 2 units of Cake 4. The bakery must also produce at least 2 cakes of any type. Please help the bakery decide how many of each type of cake to produce to maximize their total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*C1 + 15*C2 + 8*C3 + 12*C4)\n\n# Add constraints\n## The total baking time for all cakes\nmodel.addCons(2*C1 + 3*C2 + 1*C3 + 2*C4 <= 10)\n## The limited supply of a key ingredient\nmodel.addCons(C1 <= 5)\nmodel.addCons(C2 <= 4)\nmodel.addCons(C3 <= 3)\nmodel.addCons(C4 <= 2)\n## The bakery must produce at least 2 cakes of any type\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1: \", model.getVal(C1))\n    print(\"Number of Cake 2: \", model.getVal(C2))\n    print(\"Number of Cake 3: \", model.getVal(C3))\n    print(\"Number of Cake 4: \", model.getVal(C4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not.\n// {\"whether to allocate resources to Project 1\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 2\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 3\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 4\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4\n\n## Generate Constraint-1:\nThe required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\n// 3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10\n\n## Generate Constraint-2:\nThe company can allocate resources to at most two projects.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nAt least one project must be selected.\n// P1 + P2 + P3 + P4 >= 1",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not. The expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available. The company can allocate resources to at most two projects. At least one project must be selected.\n\nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to allocate resources to each project\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to allocate resources to Project 1\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to allocate resources to Project 2\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to allocate resources to Project 3\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to allocate resources to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4)\n\n# Add constraints\n## The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\nmodel.addCons(3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10)\n## The company can allocate resources to at most two projects.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## At least one project must be selected.\nmodel.addCons(P1 + P2 + P3 + P4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to allocate resources to Project 1: \", model.getVal(P1))\n    print(\"Whether to allocate resources to Project 2: \", model.getVal(P2))\n    print(\"Whether to allocate resources to Project 3: \", model.getVal(P3))\n    print(\"Whether to allocate resources to Project 4: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 585,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not.\n// {\"whether to allocate resources to Project 1\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 2\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 3\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 4\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4\n\n## Generate Constraint-1:\nThe required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\n// 3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10\n\n## Generate Constraint-2:\nThe company can allocate resources to at most two projects.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nAt least one project must be selected.\n// P1 + P2 + P3 + P4 >= 1",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not. The expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The company has a total of 10 units of resources available, with the required resources for projects 1-4 being 3 units, 5 units, 2 units, and 4 units respectively. The company can allocate resources to at most two projects and must select at least one project. \nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to allocate resources to each project\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to allocate resources to Project 1\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to allocate resources to Project 2\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to allocate resources to Project 3\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to allocate resources to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4)\n\n# Add constraints\n## The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\nmodel.addCons(3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10)\n## The company can allocate resources to at most two projects.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## At least one project must be selected.\nmodel.addCons(P1 + P2 + P3 + P4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to allocate resources to Project 1: \", model.getVal(P1))\n    print(\"Whether to allocate resources to Project 2: \", model.getVal(P2))\n    print(\"Whether to allocate resources to Project 3: \", model.getVal(P3))\n    print(\"Whether to allocate resources to Project 4: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 590,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 20 units for all products combined.\n// A + B + C + D <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The labor hours and raw materials required for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Raw Materials per Unit (kg) |\n|---------|----------------------|-----------------------------|\n| A       | 2                    | 3                           |\n| B       | 3                    | 2                           |\n| C       | 4                    | 1                           |\n| D       | 5                    | 4                           |\n\nThe total available labor hours are 100. The total available raw materials are 80 kg. The company has a storage capacity limit of 20 units for all products combined. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company has a storage capacity limit of 20 units for all products combined.\nmodel.addCons(A + B + C + D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 20 units for all products combined.\n// A + B + C + D <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, with a total available labor hours of 100. The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively, with a total available raw materials of 80 kg. The company also has a storage capacity limit of 20 units for all products combined.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company has a storage capacity limit of 20 units for all products combined.\nmodel.addCons(A + B + C + D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Materials (kg) | Labor Hours | Profit per Unit |\n|---------|--------------------|-------------|-----------------|\n| A       | 2                  | 1           | $10             |\n| B       | 3                  | 2           | $15             |\n| C       | 4                  | 3           | $20             |\n| D       | 5                  | 4           | $25             |\n\nThe company has 100 kg of raw materials available and 50 labor hours available. The market demand for Product A is at most 10 units, and for Product D is at least 5 units. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2 hours              | 3 units                     |\n| B       | 15$             | 3 hours              | 2 units                     |\n| C       | 20$             | 4 hours              | 1 unit                      |\n| D       | 25$             | 5 hours              | 4 units                     |\n\nThe company has a total of 100 labor hours and 60 units of raw material available. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100. The company also has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 785,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours.\n// {\"amount of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of Product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 20\n\n## Generate Constraint-2:\nThe labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\n// A + 2*B + 3*C + 4*D <= 10\n\n## Generate Constraint-3:\nThe company can produce at most 5 units of each product.\n// A <= 5, B <= 5, C <= 5, D <= 5",
        "question": "A manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The raw materials and labor hours required for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Materials Required (kg) | Labor Hours Required |\n|---------|-----------------|-----------------------------|----------------------|\n| A       | 10$             | 2                           | 1                    |\n| B       | 15$             | 3                           | 2                    |\n| C       | 20$             | 4                           | 3                    |\n| D       | 25$             | 5                           | 4                    |\n\nThe company has 20 kg of raw materials available and 10 hours of labor available. The company can produce at most 5 units of each product. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # amount of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # amount of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # amount of Product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # amount of Product D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 20)\n## The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 10)\n## The company can produce at most 5 units of each product.\nmodel.addCons(A <= 5)\nmodel.addCons(B <= 5)\nmodel.addCons(C <= 5)\nmodel.addCons(D <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(A))\n    print(\"Amount of Product B produced: \", model.getVal(B))\n    print(\"Amount of Product C produced: \", model.getVal(C))\n    print(\"Amount of Product D produced: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours.\n// {\"amount of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of Product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 20\n\n## Generate Constraint-2:\nThe labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\n// A + 2*B + 3*C + 4*D <= 10\n\n## Generate Constraint-3:\nThe company can produce at most 5 units of each product.\n// A <= 5, B <= 5, C <= 5, D <= 5",
        "question": "A manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the company has 20 kg of raw materials available. The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the company has 10 hours of labor available. The company can produce at most 5 units of each product. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # amount of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # amount of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # amount of Product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # amount of Product D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 20)\n## The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 10)\n## The company can produce at most 5 units of each product.\nmodel.addCons(A <= 5)\nmodel.addCons(B <= 5)\nmodel.addCons(C <= 5)\nmodel.addCons(D <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(A))\n    print(\"Amount of Product B produced: \", model.getVal(B))\n    print(\"Amount of Product C produced: \", model.getVal(C))\n    print(\"Amount of Product D produced: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 602,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce.\n// {\"number of Widget A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Widget D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\n// 2*A + 3*B + 1*C + 2*D <= 30\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 5 units of Widget C.\n// C >= 5",
        "question": "A manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce. The profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit. The raw materials and labor hours required for each widget are given in the following Table.\n\n| Widget | Raw Materials Required | Labor Hours Required |\n|--------|------------------------|----------------------|\n| A      | 5 units                | 2 hours              |\n| B      | 7 units                | 3 hours              |\n| C      | 4 units                | 1 hour               |\n| D      | 6 units                | 2 hours              |\n\nThe manufacturer has 100 units of raw materials available and 30 labor hours available. The manufacturer must produce at least 5 units of Widget C. Please help the manufacturer determine the optimal number of units of each widget to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each widget to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Widget A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Widget B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Widget C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 30)\n## The manufacturer must produce at least 5 units of Widget C.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A: \", model.getVal(A))\n    print(\"Number of Widget B: \", model.getVal(B))\n    print(\"Number of Widget C: \", model.getVal(C))\n    print(\"Number of Widget D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce.\n// {\"number of Widget A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Widget D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\n// 2*A + 3*B + 1*C + 2*D <= 30\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 5 units of Widget C.\n// C >= 5",
        "question": "A manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce. The profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit. The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively, with a total of 100 units of raw materials available. The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively, with a total of 30 labor hours available. Additionally, the manufacturer must produce at least 5 units of Widget C. Please help the manufacturer determine the optimal number of units of each widget to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each widget to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Widget A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Widget B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Widget C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 30)\n## The manufacturer must produce at least 5 units of Widget C.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A: \", model.getVal(A))\n    print(\"Number of Widget B: \", model.getVal(B))\n    print(\"Number of Widget C: \", model.getVal(C))\n    print(\"Number of Widget D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $40 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe total production time for products A, B, C, and D is 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. The company has a total of 200 hours available for production.\n// 2*A + 3*B + 2.5*C + 1.5*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited raw material supply, where the required raw material for products A, B, C, and D is 3 units, 4 units, 3.5 units, and 2 units respectively. The total raw material available is 300 units.\n// 3*A + 4*B + 3.5*C + 2*D <= 300\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced.\n// A + B + C + D >= 1",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce. The profit per unit for products A, B, C, and D is $50, $70, $60, and $40 respectively. The production time for products A, B, C, and D is 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. The required raw material for products A, B, C, and D is 3 units, 4 units, 3.5 units, and 2 units respectively. The company has a total of 200 hours available for production and a total raw material supply of 300 units.\n\n| Product | Profit per Unit | Production Time | Required Raw Material |\n|---------|-----------------|-----------------|-----------------------|\n| A       | $50             | 2 hours         | 3 units               |\n| B       | $70             | 3 hours         | 4 units               |\n| C       | $60             | 2.5 hours       | 3.5 units             |\n| D       | $40             | 1.5 hours       | 2 units               |\n\nThe company wants to ensure that at least one of the products is produced. Please help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The total production time for products A, B, C, and D is 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. The company has a total of 200 hours available for production.\nmodel.addCons(2*A + 3*B + 2.5*C + 1.5*D <= 200)\n## The company has a limited raw material supply, where the required raw material for products A, B, C, and D is 3 units, 4 units, 3.5 units, and 2 units respectively. The total raw material available is 300 units.\nmodel.addCons(3*A + 4*B + 3.5*C + 2*D <= 300)\n## The company wants to ensure that at least one of the products is produced.\nmodel.addCons(A + B + C + D >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $40 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe total production time for products A, B, C, and D is 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. The company has a total of 200 hours available for production.\n// 2*A + 3*B + 2.5*C + 1.5*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited raw material supply, where the required raw material for products A, B, C, and D is 3 units, 4 units, 3.5 units, and 2 units respectively. The total raw material available is 300 units.\n// 3*A + 4*B + 3.5*C + 2*D <= 300\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced.\n// A + B + C + D >= 1",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide how many units of each product to produce, with each unit of Product A, B, C, and D having a profit of $50, $70, $60, and $40 respectively. The company has a total of 200 hours available for production, with each unit of products A, B, C, and D requiring 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. Additionally, the company has a total raw material supply of 300 units, with each unit of products A, B, C, and D requiring 3 units, 4 units, 3.5 units, and 2 units respectively. The company wants to ensure that at least one of the products is produced. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The total production time for products A, B, C, and D is 2 hours, 3 hours, 2.5 hours, and 1.5 hours respectively. The company has a total of 200 hours available for production.\nmodel.addCons(2*A + 3*B + 2.5*C + 1.5*D <= 200)\n## The company has a limited raw material supply, where the required raw material for products A, B, C, and D is 3 units, 4 units, 3.5 units, and 2 units respectively. The total raw material available is 300 units.\nmodel.addCons(3*A + 4*B + 3.5*C + 2*D <= 300)\n## The company wants to ensure that at least one of the products is produced.\nmodel.addCons(A + B + C + D >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce.\n// {\"number of units of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types.\n// Objective Function: Maximize: 3*B1 + 5*B2 + 2*B3 + 4*B4\n\n## Generate Constraint-1:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively. The bakery has a total of 20 kg of flour available.\n// 2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20\n\n## Generate Constraint-2:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively. The bakery has a total of 10 hours of labor available.\n// 1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 15 units.\n// B1 + B2 + B3 + B4 <= 15",
        "question": "A bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce. The profit per unit for each type of bread is as follows:\n\n| Bread Type | Profit per Unit |\n|------------|-----------------|\n| Bread 1    | $3              |\n| Bread 2    | $5              |\n| Bread 3    | $2              |\n| Bread 4    | $4              |\n\nThe bakery has a total of 20 kg of flour available, and each unit of bread requires the following amounts of flour:\n\n| Bread Type | Flour Required (kg) |\n|------------|---------------------|\n| Bread 1    | 2                   |\n| Bread 2    | 3                   |\n| Bread 3    | 1                   |\n| Bread 4    | 2                   |\n\nThe bakery also has a total of 10 hours of labor available, and each unit of bread requires the following amounts of labor:\n\n| Bread Type | Labor Required (hours) |\n|------------|-----------------------|\n| Bread 1    | 1                     |\n| Bread 2    | 2                     |\n| Bread 3    | 0.5                   |\n| Bread 4    | 1.5                   |\n\nAdditionally, the bakery has a storage capacity limit of 15 units.\n\nPlease help the bakery to maximize the total profit from the sales of these bread types, considering the constraints on flour, labor, and storage capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*B1 + 5*B2 + 2*B3 + 4*B4)\n\n# Add constraints\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of flour.\nmodel.addCons(2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20)\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of labor.\nmodel.addCons(1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10)\n## The bakery has a storage capacity limit of 15 units.\nmodel.addCons(B1 + B2 + B3 + B4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Bread 1: \", model.getVal(B1))\n    print(\"Number of units of Bread 2: \", model.getVal(B2))\n    print(\"Number of units of Bread 3: \", model.getVal(B3))\n    print(\"Number of units of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1462,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce.\n// {\"number of units of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types.\n// Objective Function: Maximize: 3*B1 + 5*B2 + 2*B3 + 4*B4\n\n## Generate Constraint-1:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively. The bakery has a total of 20 kg of flour available.\n// 2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20\n\n## Generate Constraint-2:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively. The bakery has a total of 10 hours of labor available.\n// 1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 15 units.\n// B1 + B2 + B3 + B4 <= 15",
        "question": "A bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types. Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively, and the bakery has a total of 20 kg of flour available. Each unit also requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively, with a total of 10 hours of labor available. Additionally, the bakery has a storage capacity limit of 15 units. Please help the bakery decide how many units of each type of bread to produce to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*B1 + 5*B2 + 2*B3 + 4*B4)\n\n# Add constraints\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of flour.\nmodel.addCons(2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20)\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of labor.\nmodel.addCons(1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10)\n## The bakery has a storage capacity limit of 15 units.\nmodel.addCons(B1 + B2 + B3 + B4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Bread 1: \", model.getVal(B1))\n    print(\"Number of units of Bread 2: \", model.getVal(B2))\n    print(\"Number of units of Bread 3: \", model.getVal(B3))\n    print(\"Number of units of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, with a total of 100 kg of raw materials available. The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, with a total of 50 labor hours available. The company must produce at least 5 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $10             | 2 kg                    | 1 hour               |\n| B       | $15             | 3 kg                    | 2 hours              |\n| C       | $20             | 4 kg                    | 3 hours              |\n| D       | $25             | 5 kg                    | 4 hours              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the company has 100 kg of raw materials available. The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the company has 50 labor hours available. The company must produce at least 5 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200.\n// 2*A + 3*B + 1*C + 2*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units.\n// 4*A + 5*B + 3*C + 4*D <= 180\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\n// A > 10 or B > 10 or C > 10 or D > 10",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Required |\n|---------|-----------------|----------------------|-----------------------|\n| A       | $50             | 2                    | 4                     |\n| B       | $70             | 3                    | 5                     |\n| C       | $40             | 1                    | 3                     |\n| D       | $30             | 2                    | 4                     |\n\nThe company has a total of 200 labor hours and 180 units of raw material available. The company wants to ensure that at least one of the products is produced in quantities greater than 10 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 200)\n## The company has a limited amount of raw material.\nmodel.addCons(4*A + 5*B + 3*C + 4*D <= 180)\n## The company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\nmodel.addCons(A >= 10*A_b)\nmodel.addCons(B >= 10*B_b)\nmodel.addCons(C >= 10*C_b)\nmodel.addCons(D >= 10*D_b)\nmodel.addCons(A_b + B_b + C_b + D_b >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200.\n// 2*A + 3*B + 1*C + 2*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units.\n// 4*A + 5*B + 3*C + 4*D <= 180\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\n// A > 10 or B > 10 or C > 10 or D > 10",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200. The company also has a limited amount of raw material. Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units. The company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 200)\n## The company has a limited amount of raw material.\nmodel.addCons(4*A + 5*B + 3*C + 4*D <= 180)\n## The company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\nmodel.addCons(A >= 10*A_b)\nmodel.addCons(B >= 10*B_b)\nmodel.addCons(C >= 10*C_b)\nmodel.addCons(D >= 10*D_b)\nmodel.addCons(A_b + B_b + C_b + D_b >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of product A.\n// A <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Material Units | Labor Hours | Profit per Unit |\n|---------|--------------------|-------------|-----------------|\n| A       | 2                  | 1           | $10             |\n| B       | 3                  | 2           | $15             |\n| C       | 4                  | 3           | $20             |\n| D       | 5                  | 4           | $25             |\n\nThe company has a total of 100 raw material units available. The company has a total of 60 labor hours available. The company can produce at most 20 units of product A. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company can produce at most 20 units of product A.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of product A.\n// A <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available. The company can produce at most 20 units of product A.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company can produce at most 20 units of product A.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units in total.\n// A + B + C + D <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The labor hours and raw materials required for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Raw Materials per Unit (kg) |\n|---------|----------------------|-----------------------------|\n| A       | 2                    | 3                            |\n| B       | 3                    | 2                            |\n| C       | 4                    | 1                            |\n| D       | 5                    | 4                            |\n\nThe company has a total of 100 labor hours and 60 kg of raw materials available. The company can produce at most 20 units in total. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## The company can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units in total.\n// A + B + C + D <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, and the company has a total of 100 labor hours available. The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively, and the company has a total of 60 kg of raw materials available. The company can produce at most 20 units in total. Please help the company determine the optimal number of units of each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## The company can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of Product A.\n// A <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material per Unit (kg) | Labor Hours per Unit |\n|---------|-----------------|-----------------------------|----------------------|\n| A       | 10$             | 2                           | 1                    |\n| B       | 15$             | 3                           | 2                    |\n| C       | 20$             | 4                           | 3                    |\n| D       | 25$             | 5                           | 4                    |\n\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company can produce at most 20 units of Product A.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company can produce at most 20 units of Product A.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of Product A.\n// A <= 20",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company can produce at most 20 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company can produce at most 20 units of Product A.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\n// 2*A + 3*B + 2*C + 4*D <= 60\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\n// A + 2*B + C + 3*D <= 40\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 5 units, and for Product D is at most 6 units.\n// A >= 5\n// D <= 6",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------|----------------------|\n| A       | $30             | 2 kg                  | 1 hour               |\n| B       | $40             | 3 kg                  | 2 hours              |\n| C       | $25             | 2 kg                  | 1 hour               |\n| D       | $35             | 4 kg                  | 3 hours              |\n\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available. The market demand for Product A is at least 5 units, and for Product D is at most 6 units.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\nmodel.addCons(2*A + 3*B + 2*C + 4*D <= 60)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\nmodel.addCons(A + 2*B + C + 3*D <= 40)\n## The market demand for Product A is at least 5 units, and for Product D is at most 6 units.\nmodel.addCons(A >= 5)\nmodel.addCons(D <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1358,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\n// 2*A + 3*B + 2*C + 4*D <= 60\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\n// A + 2*B + C + 3*D <= 40\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 5 units, and for Product D is at most 6 units.\n// A >= 5\n// D <= 6",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available. The market demand for Product A is at least 5 units, and for Product D is at most 6 units. Please help the company determine the optimal number of units of each product to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\nmodel.addCons(2*A + 3*B + 2*C + 4*D <= 60)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\nmodel.addCons(A + 2*B + C + 3*D <= 40)\n## The market demand for Product A is at least 5 units, and for Product D is at most 6 units.\nmodel.addCons(A >= 5)\nmodel.addCons(D <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*P1 + 40*P2 + 25*P3 + 35*P4\n\n## Generate Constraint-1:\nThe production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\n// 10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// P1 + P2 + P3 + P4 <= 20\n\n## Generate Constraint-3:\nDue to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\n// P1 <= 10\n// P2 <= 15",
        "question": "A manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| 1       | $30             | $10                      |\n| 2       | $40             | $15                      |\n| 3       | $25             | $8                       |\n| 4       | $35             | $12                      |\n\nThe company has a budget of $500 for production costs. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of units of Product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of units of Product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of units of Product 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of units of Product 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*P1 + 40*P2 + 25*P3 + 35*P4)\n\n# Add constraints\n## The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\nmodel.addCons(10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(P1 + P2 + P3 + P4 <= 20)\n## Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\nmodel.addCons(P1 <= 10)\nmodel.addCons(P2 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product 1: \", model.getVal(P1))\n    print(\"Number of units of Product 2: \", model.getVal(P2))\n    print(\"Number of units of Product 3: \", model.getVal(P3))\n    print(\"Number of units of Product 4: \", model.getVal(P4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*P1 + 40*P2 + 25*P3 + 35*P4\n\n## Generate Constraint-1:\nThe production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\n// 10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// P1 + P2 + P3 + P4 <= 20\n\n## Generate Constraint-3:\nDue to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\n// P1 <= 10\n// P2 <= 15",
        "question": "A manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively, and the company has a budget of $500 for production costs. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of units of Product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of units of Product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of units of Product 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of units of Product 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*P1 + 40*P2 + 25*P3 + 35*P4)\n\n# Add constraints\n## The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\nmodel.addCons(10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(P1 + P2 + P3 + P4 <= 20)\n## Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\nmodel.addCons(P1 <= 10)\nmodel.addCons(P2 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product 1: \", model.getVal(P1))\n    print(\"Number of units of Product 2: \", model.getVal(P2))\n    print(\"Number of units of Product 3: \", model.getVal(P3))\n    print(\"Number of units of Product 4: \", model.getVal(P4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively.\n// 5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively.\n// Product_A <= 100\n// Product_B <= 150\n// Product_C <= 200\n// Product_D <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product A to fulfill a contract.\n// Product_A >= 50",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for each product and the labor hours required to produce one unit are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 5 hours              |\n| B       | $30             | 3 hours              |\n| C       | $40             | 4 hours              |\n| D       | $20             | 2 hours              |\n\nThe company has a total of 1000 labor hours available. The market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively. The company must also produce at least 50 units of Product A to fulfill a contract.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000)\n## The market demand for each product is limited.\nmodel.addCons(Product_A <= 100)\nmodel.addCons(Product_B <= 150)\nmodel.addCons(Product_C <= 200)\nmodel.addCons(Product_D <= 300)\n## The company must produce at least 50 units of Product A.\nmodel.addCons(Product_A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively.\n// 5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively.\n// Product_A <= 100\n// Product_B <= 150\n// Product_C <= 200\n// Product_D <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product A to fulfill a contract.\n// Product_A >= 50",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively. The market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively. The company must produce at least 50 units of Product A to fulfill a contract. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000)\n## The market demand for each product is limited.\nmodel.addCons(Product_A <= 100)\nmodel.addCons(Product_B <= 150)\nmodel.addCons(Product_C <= 200)\nmodel.addCons(Product_D <= 300)\n## The company must produce at least 50 units of Product A.\nmodel.addCons(Product_A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 80*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is limited to 50 units.\n// B <= 50",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints. The profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The production time for each product is as follows:\n\n| Product | Production Time per Unit |\n|---------|--------------------------|\n| A       | 2 hours                   |\n| B       | 3 hours                   |\n| C       | 4 hours                   |\n| D       | 5 hours                   |\n\nThe company has a total production capacity of 1000 hours. The company must produce at least 10 units of product A. The market demand for product B is limited to 50 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 80*D)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company must produce at least 10 units of product A\nmodel.addCons(A >= 10)\n## The market demand for product B is limited to 50 units\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 80*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is limited to 50 units.\n// B <= 50",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints. The profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D. The company must produce at least 10 units of product A. The market demand for product B is limited to 50 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 80*D)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company must produce at least 10 units of product A\nmodel.addCons(A >= 10)\n## The market demand for product B is limited to 50 units\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 633,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat bread produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of White bread produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\n// x1 >= 100\n// x2 >= 50\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\n// x3 <= 300",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $1.50           |\n| Rye           | $1.20           |\n| Sourdough     | $1.80           |\n| White         | $1.00           |\n\nThe bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations. Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat bread produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye bread produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough bread produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of White bread produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 50)\n## Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\nmodel.addCons(x3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat bread produced: \", model.getVal(x1))\n    print(\"Number of Rye bread produced: \", model.getVal(x2))\n    print(\"Number of Sourdough bread produced: \", model.getVal(x3))\n    print(\"Number of White bread produced: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat bread produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of White bread produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\n// x1 >= 100\n// x2 >= 50\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\n// x3 <= 300",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations. Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat bread produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye bread produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough bread produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of White bread produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 50)\n## Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\nmodel.addCons(x3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat bread produced: \", model.getVal(x1))\n    print(\"Number of Rye bread produced: \", model.getVal(x2))\n    print(\"Number of Sourdough bread produced: \", model.getVal(x3))\n    print(\"Number of White bread produced: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 200 loaves.\n// x1 + x2 + x3 <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\n// x2 >= 0.5*x1",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The following table summarizes the profit per loaf for each type of bread.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n\nThe bakery has a daily oven capacity of 200 loaves. The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation. Additionally, the bakery must ensure that the production of Rye bread is at least half the production of Wheat bread. Please help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # daily production of Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 200 loaves.\nmodel.addCons(x1 + x2 + x3 <= 200)\n## The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 200 loaves.\n// x1 + x2 + x3 <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\n// x2 >= 0.5*x1",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery has a daily oven capacity of 200 loaves. The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation. The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # daily production of Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 200 loaves.\nmodel.addCons(x1 + x2 + x3 <= 200)\n## The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 684,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2000 loaves.\n// x1 + x2 + x3 <= 2000\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\n// x1 >= 500\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\n// x2 <= 0.7 * (x1 + x2 + x3)",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The following table summarizes the profit per loaf for each type of bread.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n\nThe bakery has a daily oven capacity of 2000 loaves. The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement. Additionally, the bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 <= 2000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\nmodel.addCons(x1 >= 500)\n## The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\nmodel.addCons(x2 <= 0.7 * (x1 + x2 + x3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2000 loaves.\n// x1 + x2 + x3 <= 2000\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\n// x1 >= 500\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\n// x2 <= 0.7 * (x1 + x2 + x3)",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery has a daily oven capacity of 2000 loaves. The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement. The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 <= 2000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\nmodel.addCons(x1 >= 500)\n## The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\nmodel.addCons(x2 <= 0.7 * (x1 + x2 + x3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of extra sourdough bread (if demand exceeds regular sourdough)\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery aims to maximize its daily profit.\n// Maximize: 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available per day. Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each.\n// 0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe oven capacity is limited to 120 hours per day. Each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each.\n// 1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\n// x1 >= 50\n// x2 >= 40",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The following table summarizes the labor and oven hours required for each type of bread.\n\n| Bread Type       | Labor Hours per Loaf | Oven Hours per Loaf | Profit per Loaf |\n|------------------|----------------------|---------------------|-----------------|\n| Wheat            | 0.5                  | 1.0                 | $1.50           |\n| Rye              | 0.7                  | 1.2                 | $2.00           |\n| Sourdough        | 1.0                  | 1.5                 | $3.00           |\n| Extra Sourdough  | 0.8                  | 1.3                 | $2.50           |\n\nThe bakery has a total of 100 labor hours and 120 oven hours available per day. The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production of extra sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100)\n## The oven capacity is limited to 120 hours per day.\nmodel.addCons(1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120)\n## The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(x1 >= 50)\nmodel.addCons(x2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of extra sourdough bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of extra sourdough bread (if demand exceeds regular sourdough)\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery aims to maximize its daily profit.\n// Maximize: 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available per day. Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each.\n// 0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe oven capacity is limited to 120 hours per day. Each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each.\n// 1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\n// x1 >= 50\n// x2 >= 40",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery has a total of 100 labor hours available per day, and each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each. The oven capacity is limited to 120 hours per day, and each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each. The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production of extra sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100)\n## The oven capacity is limited to 120 hours per day.\nmodel.addCons(1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120)\n## The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(x1 >= 50)\nmodel.addCons(x2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of extra sourdough bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat breads\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery earns a profit of $3 per Whole Wheat bread, $4 per Rye bread, $5 per Sourdough bread, and $6 per Brioche bread. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 breads per day.\n// x1 + x2 + x3 + x4 <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types.\n// x1 >= 20\n// x2 >= 15\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day.\n// x3 <= 50\n// x4 <= 40",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering production constraints. The bakery earns a profit of $3 per Whole Wheat bread, $4 per Rye bread, $5 per Sourdough bread, and $6 per Brioche bread. The bakery has a limited oven capacity, which can bake a maximum of 100 breads per day. The bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types. Due to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Bread |\n|---------------|------------------|\n| Whole Wheat   | $3               |\n| Rye           | $4               |\n| Sourdough     | $5               |\n| Brioche       | $6               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat breads\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye breads\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough breads\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 breads per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 100)\n## The bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types.\nmodel.addCons(x1 >= 20)\nmodel.addCons(x2 >= 15)\n## Due to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day.\nmodel.addCons(x3 <= 50)\nmodel.addCons(x4 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(x1))\n    print(\"Number of Rye breads: \", model.getVal(x2))\n    print(\"Number of Sourdough breads: \", model.getVal(x3))\n    print(\"Number of Brioche breads: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat breads\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery earns a profit of $3 per Whole Wheat bread, $4 per Rye bread, $5 per Sourdough bread, and $6 per Brioche bread. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 breads per day.\n// x1 + x2 + x3 + x4 <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types.\n// x1 >= 20\n// x2 >= 15\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day.\n// x3 <= 50\n// x4 <= 40",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering production constraints. The bakery earns a profit of $3 per Whole Wheat bread, $4 per Rye bread, $5 per Sourdough bread, and $6 per Brioche bread. The bakery has a limited oven capacity, which can bake a maximum of 100 breads per day. The bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types. Due to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat breads\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye breads\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough breads\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 breads per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 100)\n## The bakery must produce at least 20 Whole Wheat breads and 15 Rye breads to meet the minimum customer demand for these types.\nmodel.addCons(x1 >= 20)\nmodel.addCons(x2 >= 15)\n## Due to staffing limitations, the bakery can only handle a maximum of 50 Sourdough breads and 40 Brioche breads per day.\nmodel.addCons(x3 <= 50)\nmodel.addCons(x4 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(x1))\n    print(\"Number of Rye breads: \", model.getVal(x2))\n    print(\"Number of Sourdough breads: \", model.getVal(x3))\n    print(\"Number of Brioche breads: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*W + 4*R + 5*S\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 1 kg of flour and 0.1 kg of yeast, each loaf of rye bread requires 1.2 kg of flour and 0.15 kg of yeast, and each loaf of sourdough bread requires 1 kg of flour and 0.2 kg of yeast. The daily supply of flour is 300 kg and yeast is 40 kg.\n// W + 1.2*R + S <= 300 (flour constraint)\n// 0.1*W + 0.15*R + 0.2*S <= 40 (yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 50, 30, and 20 loaves, respectively.\n// W >= 50\n// R >= 30\n// S >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily production capacity for each type of bread due to oven space and staffing. The maximum number of wheat, rye, and sourdough bread loaves that can be produced daily is 100, 70, and 50, respectively.\n// W <= 100\n// R <= 70\n// S <= 50",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Flour Requirement (kg) | Yeast Requirement (kg) |\n|------------|------------------------|------------------------|\n| Wheat      | 1                      | 0.1                    |\n| Rye        | 1.2                    | 0.15                   |\n| Sourdough  | 1                      | 0.2                    |\n\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 kg and yeast is 40 kg. The bakery has a minimum daily demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 50, 30, and 20 loaves, respectively. The bakery also has a maximum daily production capacity for each type of bread due to oven space and staffing. The maximum number of wheat, rye, and sourdough bread loaves that can be produced daily is 100, 70, and 50, respectively.\n\nPlease help the bakery to maximize its daily profit from bread sales, subject to the constraints of ingredient availability, minimum demand, and maximum production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*W + 4*R + 5*S)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(W + 1.2*R + S <= 300) # flour constraint\nmodel.addCons(0.1*W + 0.15*R + 0.2*S <= 40) # yeast constraint\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 30)\nmodel.addCons(S >= 20)\n## The bakery also has a maximum daily production capacity for each type of bread.\nmodel.addCons(W <= 100)\nmodel.addCons(R <= 70)\nmodel.addCons(S <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*W + 4*R + 5*S\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 1 kg of flour and 0.1 kg of yeast, each loaf of rye bread requires 1.2 kg of flour and 0.15 kg of yeast, and each loaf of sourdough bread requires 1 kg of flour and 0.2 kg of yeast. The daily supply of flour is 300 kg and yeast is 40 kg.\n// W + 1.2*R + S <= 300 (flour constraint)\n// 0.1*W + 0.15*R + 0.2*S <= 40 (yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 50, 30, and 20 loaves, respectively.\n// W >= 50\n// R >= 30\n// S >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily production capacity for each type of bread due to oven space and staffing. The maximum number of wheat, rye, and sourdough bread loaves that can be produced daily is 100, 70, and 50, respectively.\n// W <= 100\n// R <= 70\n// S <= 50",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 1 kg of flour and 0.1 kg of yeast, each loaf of rye bread requires 1.2 kg of flour and 0.15 kg of yeast, and each loaf of sourdough bread requires 1 kg of flour and 0.2 kg of yeast. The daily supply of flour is 300 kg and yeast is 40 kg.\n\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 50, 30, and 20 loaves, respectively.\n\nThe bakery also has a maximum daily production capacity for each type of bread due to oven space and staffing. The maximum number of wheat, rye, and sourdough bread loaves that can be produced daily is 100, 70, and 50, respectively.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*W + 4*R + 5*S)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(W + 1.2*R + S <= 300) # flour constraint\nmodel.addCons(0.1*W + 0.15*R + 0.2*S <= 40) # yeast constraint\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 30)\nmodel.addCons(S >= 20)\n## The bakery also has a maximum daily production capacity for each type of bread.\nmodel.addCons(W <= 100)\nmodel.addCons(R <= 70)\nmodel.addCons(S <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"} // Duplicate variable name, corrected below\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Straw\n\n## Generate Constraint-1:\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring.\n// Choc <= 300\n// Van <= 200\n// Straw <= 150\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors.\n// Choc + Van + Straw >= 50\n\n## Generate Constraint-3:\nDue to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes.\n// Straw >= 0.5 * Van",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences. The profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The following table summarizes the ingredient requirements for each type of cake:\n\n| Cake Type | Ingredient Requirement |\n|-----------|-----------------------|\n| Chocolate | 1 pound of chocolate  |\n| Vanilla   | 1 pound of vanilla    |\n| Strawberry| 1 pound of strawberry |\n\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring. The bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors. Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStraw = model.addVar(vtype=\"INTEGER\", name=\"Straw\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Straw)\n\n# Add constraints\n## The bakery has a limited amount of ingredients\nmodel.addCons(Choc <= 300)\nmodel.addCons(Van <= 200)\nmodel.addCons(Straw <= 150)\n## The bakery must produce at least 50 cakes in total each day\nmodel.addCons(Choc + Van + Straw >= 50)\n## Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes\nmodel.addCons(Straw >= 0.5 * Van)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Straw))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"} // Duplicate variable name, corrected below\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Straw\n\n## Generate Constraint-1:\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring.\n// Choc <= 300\n// Van <= 200\n// Straw <= 150\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors.\n// Choc + Van + Straw >= 50\n\n## Generate Constraint-3:\nDue to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes.\n// Straw >= 0.5 * Van",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences. The profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring. The bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors. Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStraw = model.addVar(vtype=\"INTEGER\", name=\"Straw\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Straw)\n\n# Add constraints\n## The bakery has a limited amount of ingredients\nmodel.addCons(Choc <= 300)\nmodel.addCons(Van <= 200)\nmodel.addCons(Straw <= 150)\n## The bakery must produce at least 50 cakes in total each day\nmodel.addCons(Choc + Van + Straw >= 50)\n## Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes\nmodel.addCons(Straw >= 0.5 * Van)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Straw))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery wants to optimize the production of these cakes to maximize profit while considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of Chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Chocolate cake is $5, per Vanilla cake is $4, and per Strawberry cake is $3. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Str\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavoring. Each Chocolate cake requires 2 pounds of chocolate, each Vanilla cake requires 1 pound of vanilla, and each Strawberry cake requires 1 pound of strawberry flavoring.\n// 2*Choc <= 200\n// Van <= 150\n// Str <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of cake: at least 50 Chocolate cakes, at most 80 Vanilla cakes, and at least 30 Strawberry cakes.\n// Choc >= 50\n// Van <= 80\n// Str >= 30\n\n## Generate Constraint-3:\nThe bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity of 150 cakes per day.\n// Choc + Van + Str <= 150",
        "question": "A bakery specializes in making three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery wants to optimize the production of these cakes to maximize profit while considering the limited availability of ingredients and the demand for each type of cake. The profit per Chocolate cake is $5, per Vanilla cake is $4, and per Strawberry cake is $3. The following table summarizes the ingredient requirements for each type of cake:\n\n| Cake Type     | Ingredient Requirement |\n|---------------|-----------------------|\n| Chocolate     | 2 pounds of chocolate |\n| Vanilla       | 1 pound of vanilla    |\n| Strawberry    | 1 pound of strawberry |\n\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavoring. The bakery has a daily demand limit for each type of cake: at least 50 Chocolate cakes, at most 80 Vanilla cakes, and at least 30 Strawberry cakes. The bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity of 150 cakes per day.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of Chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of Vanilla cakes\nStr = model.addVar(vtype=\"INTEGER\", name=\"Str\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Str)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(2*Choc <= 200)\nmodel.addCons(Van <= 150)\nmodel.addCons(Str <= 100)\n## The bakery has a daily demand limit for each type of cake\nmodel.addCons(Choc >= 50)\nmodel.addCons(Van <= 80)\nmodel.addCons(Str >= 30)\n## The bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity\nmodel.addCons(Choc + Van + Str <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of Vanilla cakes: \", model.getVal(Van))\n    print(\"Number of Strawberry cakes: \", model.getVal(Str))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery wants to optimize the production of these cakes to maximize profit while considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of Chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Chocolate cake is $5, per Vanilla cake is $4, and per Strawberry cake is $3. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Str\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavoring. Each Chocolate cake requires 2 pounds of chocolate, each Vanilla cake requires 1 pound of vanilla, and each Strawberry cake requires 1 pound of strawberry flavoring.\n// 2*Choc <= 200\n// Van <= 150\n// Str <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of cake: at least 50 Chocolate cakes, at most 80 Vanilla cakes, and at least 30 Strawberry cakes.\n// Choc >= 50\n// Van <= 80\n// Str >= 30\n\n## Generate Constraint-3:\nThe bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity of 150 cakes per day.\n// Choc + Van + Str <= 150",
        "question": "A bakery specializes in making three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery wants to optimize the production of these cakes to maximize profit while considering the limited availability of ingredients and the demand for each type of cake. The profit per Chocolate cake is $5, per Vanilla cake is $4, and per Strawberry cake is $3. The bakery has a limited supply of ingredients: 200 pounds of chocolate, 150 pounds of vanilla, and 100 pounds of strawberry flavoring. Each Chocolate cake requires 2 pounds of chocolate, each Vanilla cake requires 1 pound of vanilla, and each Strawberry cake requires 1 pound of strawberry flavoring. The bakery has a daily demand limit for each type of cake: at least 50 Chocolate cakes, at most 80 Vanilla cakes, and at least 30 Strawberry cakes. The bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity of 150 cakes per day. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of Chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of Vanilla cakes\nStr = model.addVar(vtype=\"INTEGER\", name=\"Str\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Str)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(2*Choc <= 200)\nmodel.addCons(Van <= 150)\nmodel.addCons(Str <= 100)\n## The bakery has a daily demand limit for each type of cake\nmodel.addCons(Choc >= 50)\nmodel.addCons(Van <= 80)\nmodel.addCons(Str >= 30)\n## The bakery must also ensure that the total number of cakes produced does not exceed the bakery's capacity\nmodel.addCons(Choc + Van + Str <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of Vanilla cakes: \", model.getVal(Van))\n    print(\"Number of Strawberry cakes: \", model.getVal(Str))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*W + 2.00*R + 2.50*S\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves. Each loaf of bread requires the same amount of oven space.\n// W + R + S <= 500\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily.\n// W >= 100\n// R >= 50\n\n## Generate Constraint-3:\nDue to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread.\n// S >= 1.20 * (W + R)",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a daily oven capacity of 500 loaves. Each loaf of bread requires the same amount of oven space. The bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily. Due to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Wheat      | $1.50           |\n| Rye        | $2.00           |\n| Sourdough  | $2.50           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*W + 2.00*R + 2.50*S)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(W + R + S <= 500)\n## The bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily.\nmodel.addCons(W >= 100)\nmodel.addCons(R >= 50)\n## Due to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread.\nmodel.addCons(S >= 1.20 * (W + R))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(W))\n    print(\"Daily production of rye bread: \", model.getVal(R))\n    print(\"Daily production of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*W + 2.00*R + 2.50*S\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves. Each loaf of bread requires the same amount of oven space.\n// W + R + S <= 500\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily.\n// W >= 100\n// R >= 50\n\n## Generate Constraint-3:\nDue to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread.\n// S >= 1.20 * (W + R)",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a daily oven capacity of 500 loaves. Each loaf of bread requires the same amount of oven space. The bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily. Due to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*W + 2.00*R + 2.50*S)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(W + R + S <= 500)\n## The bakery has a contract to supply at least 100 loaves of wheat bread and 50 loaves of rye bread daily.\nmodel.addCons(W >= 100)\nmodel.addCons(R >= 50)\n## Due to the popularity of sourdough bread, the bakery must produce at least 20% more sourdough bread than the combined production of wheat and rye bread.\nmodel.addCons(S >= 1.20 * (W + R))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(W))\n    print(\"Daily production of rye bread: \", model.getVal(R))\n    print(\"Daily production of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its production schedule to maximize profit while considering the limited oven space and labor hours. The bakery needs to determine the optimal number of loaves for each type of bread to produce daily.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a total of 10 hours of labor available each day. Each loaf of wheat, rye, and sourdough bread requires 0.1, 0.15, and 0.2 hours of labor, respectively.\n// 0.1*W + 0.15*R + 0.2*S <= 10\n\n## Generate Constraint-2:\nThe bakery's oven can accommodate a maximum of 150 loaves at a time. Each loaf of wheat, rye, and sourdough bread requires 1 unit of oven space.\n// W + R + S <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread. It must produce at least 30 loaves of wheat, 20 loaves of rye, and 25 loaves of sourdough.\n// W >= 30\n// R >= 20\n// S >= 25",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its production schedule to maximize profit while considering the limited oven space and labor hours. The bakery needs to determine the optimal number of loaves for each type of bread to produce daily. The profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The following table summarizes the labor hours required for each type of bread:\n\n| Bread Type | Profit per Loaf | Labor Hours Required |\n|------------|-----------------|----------------------|\n| Wheat      | $2.50           | 0.1 hours            |\n| Rye        | $3.00           | 0.15 hours           |\n| Sourdough  | $3.50           | 0.2 hours            |\n\nThe bakery has a total of 10 hours of labor available each day. The bakery's oven can accommodate a maximum of 150 loaves at a time. Each loaf of wheat, rye, and sourdough bread requires 1 unit of oven space. The bakery has a minimum daily demand for each type of bread. It must produce at least 30 loaves of wheat, 20 loaves of rye, and 25 loaves of sourdough.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves for each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a total of 10 hours of labor available each day.\nmodel.addCons(0.1*W + 0.15*R + 0.2*S <= 10)\n## The bakery's oven can accommodate a maximum of 150 loaves at a time.\nmodel.addCons(W + R + S <= 150)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(W >= 30)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its production schedule to maximize profit while considering the limited oven space and labor hours. The bakery needs to determine the optimal number of loaves for each type of bread to produce daily.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a total of 10 hours of labor available each day. Each loaf of wheat, rye, and sourdough bread requires 0.1, 0.15, and 0.2 hours of labor, respectively.\n// 0.1*W + 0.15*R + 0.2*S <= 10\n\n## Generate Constraint-2:\nThe bakery's oven can accommodate a maximum of 150 loaves at a time. Each loaf of wheat, rye, and sourdough bread requires 1 unit of oven space.\n// W + R + S <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread. It must produce at least 30 loaves of wheat, 20 loaves of rye, and 25 loaves of sourdough.\n// W >= 30\n// R >= 20\n// S >= 25",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its production schedule to maximize profit while considering the limited oven space and labor hours. The bakery needs to determine the optimal number of loaves for each type of bread to produce daily.\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\nThe bakery has a total of 10 hours of labor available each day. Each loaf of wheat, rye, and sourdough bread requires 0.1, 0.15, and 0.2 hours of labor, respectively.\nThe bakery's oven can accommodate a maximum of 150 loaves at a time. Each loaf of wheat, rye, and sourdough bread requires 1 unit of oven space.\nThe bakery has a minimum daily demand for each type of bread. It must produce at least 30 loaves of wheat, 20 loaves of rye, and 25 loaves of sourdough.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves for each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a total of 10 hours of labor available each day.\nmodel.addCons(0.1*W + 0.15*R + 0.2*S <= 10)\n## The bakery's oven can accommodate a maximum of 150 loaves at a time.\nmodel.addCons(W + R + S <= 150)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(W >= 30)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 3.00*Rye + 2.75*Sour + 3.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 pounds, and yeast is 10 pounds. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 1.5 pounds of flour and 0.05 pounds of yeast, 1.2 pounds of flour and 0.03 pounds of yeast, 1.3 pounds of flour and 0.04 pounds of yeast, and 1.8 pounds of flour and 0.06 pounds of yeast, respectively.\n// 1.5*WW + 1.2*Rye + 1.3*Sour + 1.8*Brioche <= 300 (Flour constraint)\n// 0.05*WW + 0.03*Rye + 0.04*Sour + 0.06*Brioche <= 10 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 50, 30, 40, and 20 loaves, respectively.\n// WW >= 50\n// Rye >= 30\n// Sour >= 40\n// Brioche >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily demand for each type of bread. The maximum demand for Whole Wheat, Rye, Sourdough, and Brioche is 100, 60, 80, and 40 loaves, respectively.\n// WW <= 100\n// Rye <= 60\n// Sour <= 80\n// Brioche <= 40",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2.50           |\n| Rye          | $3.00           |\n| Sourdough    | $2.75           |\n| Brioche      | $3.50           |\n\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 pounds, and yeast is 10 pounds. Each loaf of bread requires specific amounts of flour and yeast as shown in the following table:\n\n| Bread Type   | Flour per Loaf | Yeast per Loaf |\n|--------------|----------------|----------------|\n| Whole Wheat  | 1.5 pounds     | 0.05 pounds    |\n| Rye          | 1.2 pounds     | 0.03 pounds    |\n| Sourdough    | 1.3 pounds     | 0.04 pounds    |\n| Brioche      | 1.8 pounds     | 0.06 pounds    |\n\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 50, 30, 40, and 20 loaves, respectively. Additionally, there is a maximum daily demand for each type of bread. The maximum demand for Whole Wheat, Rye, Sourdough, and Brioche is 100, 60, 80, and 40 loaves, respectively.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to the constraints of ingredient availability and customer demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*Rye + 2.75*Sour + 3.50*Brioche)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(1.5*WW + 1.2*Rye + 1.3*Sour + 1.8*Brioche <= 300) # Flour constraint\nmodel.addCons(0.05*WW + 0.03*Rye + 0.04*Sour + 0.06*Brioche <= 10) # Yeast constraint\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 30)\nmodel.addCons(Sour >= 40)\nmodel.addCons(Brioche >= 20)\n## The bakery also has a maximum daily demand for each type of bread.\nmodel.addCons(WW <= 100)\nmodel.addCons(Rye <= 60)\nmodel.addCons(Sour <= 80)\nmodel.addCons(Brioche <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1566,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 3.00*Rye + 2.75*Sour + 3.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. The daily supply of flour is 300 pounds, and yeast is 10 pounds. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 1.5 pounds of flour and 0.05 pounds of yeast, 1.2 pounds of flour and 0.03 pounds of yeast, 1.3 pounds of flour and 0.04 pounds of yeast, and 1.8 pounds of flour and 0.06 pounds of yeast, respectively.\n// 1.5*WW + 1.2*Rye + 1.3*Sour + 1.8*Brioche <= 300 (Flour constraint)\n// 0.05*WW + 0.03*Rye + 0.04*Sour + 0.06*Brioche <= 10 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of bread. The minimum demand for Whole Wheat, Rye, Sourdough, and Brioche is 50, 30, 40, and 20 loaves, respectively.\n// WW >= 50\n// Rye >= 30\n// Sour >= 40\n// Brioche >= 20\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily demand for each type of bread. The maximum demand for Whole Wheat, Rye, Sourdough, and Brioche is 100, 60, 80, and 40 loaves, respectively.\n// WW <= 100\n// Rye <= 60\n// Sour <= 80\n// Brioche <= 40",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a limited supply of flour and yeast. The daily supply of flour is 300 pounds, and yeast is 10 pounds. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires specific amounts of flour and yeast. The bakery has a minimum daily demand for each type of bread and a maximum daily demand for each type of bread. Please help the bakery to maximize its daily profit from bread sales while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*Rye + 2.75*Sour + 3.50*Brioche)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(1.5*WW + 1.2*Rye + 1.3*Sour + 1.8*Brioche <= 300) # Flour constraint\nmodel.addCons(0.05*WW + 0.03*Rye + 0.04*Sour + 0.06*Brioche <= 10) # Yeast constraint\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 30)\nmodel.addCons(Sour >= 40)\nmodel.addCons(Brioche >= 20)\n## The bakery also has a maximum daily demand for each type of bread.\nmodel.addCons(WW <= 100)\nmodel.addCons(Rye <= 60)\nmodel.addCons(Sour <= 80)\nmodel.addCons(Brioche <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.70*M + 0.40*B\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds.\n// 0.1*C + 0.2*M + 0.15*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds.\n// 0.05*C + 0.1*M + 0.05*B <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n// 0.2*C + 0.3*M + 0.15*B <= 80",
        "question": "A small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours. The profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds. The bakery also has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds. Additionally, the bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n\nPlease help the bakery to maximize the total daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (pounds) | Sugar Required (pounds) | Labor Hours Required |\n|----------|-----------------|-------------------------|-------------------------|----------------------|\n| Croissant| $0.50           | 0.1                     | 0.05                   | 0.2                  |\n| Muffin   | $0.70           | 0.2                     | 0.1                    | 0.3                  |\n| Bagel    | $0.40           | 0.15                    | 0.05                   | 0.15                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.70*M + 0.40*B)\n\n# Add constraints\n## The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.1*C + 0.2*M + 0.15*B <= 100)\n## The bakery has a daily supply of 50 pounds of sugar.\nmodel.addCons(0.05*C + 0.1*M + 0.05*B <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.2*C + 0.3*M + 0.15*B <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1569,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.70*M + 0.40*B\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds.\n// 0.1*C + 0.2*M + 0.15*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds.\n// 0.05*C + 0.1*M + 0.05*B <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n// 0.2*C + 0.3*M + 0.15*B <= 80",
        "question": "A small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours. The profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery has a daily supply of 100 pounds of flour, with each croissant requiring 0.1 pounds, each muffin requiring 0.2 pounds, and each bagel requiring 0.15 pounds. The bakery also has a daily supply of 50 pounds of sugar, with each croissant requiring 0.05 pounds, each muffin requiring 0.1 pounds, and each bagel requiring 0.05 pounds. Additionally, the bakery has a daily limit of 80 labor hours, with each croissant requiring 0.2 hours, each muffin requiring 0.3 hours, and each bagel requiring 0.15 hours. Please help the bakery to maximize the total daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.70*M + 0.40*B)\n\n# Add constraints\n## The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.1*C + 0.2*M + 0.15*B <= 100)\n## The bakery has a daily supply of 50 pounds of sugar.\nmodel.addCons(0.05*C + 0.1*M + 0.05*B <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.2*C + 0.3*M + 0.15*B <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strb\", \"range\": \"Strb >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Strb\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It can use up to 300 eggs, 200 pounds of flour, and 150 pounds of sugar daily. Each chocolate cake requires 2 eggs, 1 pound of flour, and 1 pound of sugar. Each vanilla cake requires 1 egg, 1 pound of flour, and 1 pound of sugar. Each strawberry cake requires 1 egg, 1 pound of flour, and 2 pounds of sugar.\n// 2*Choc + Van + Strb <= 300 (eggs)\n// Choc + Van + Strb <= 200 (flour)\n// Choc + Van + 2*Strb <= 150 (sugar)\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of cake. It cannot sell more than 100 chocolate cakes, 120 vanilla cakes, and 80 strawberry cakes.\n// Choc <= 100\n// Van <= 120\n// Strb <= 80\n\n## Generate Constraint-3:\nTo ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily.\n// Choc >= 20\n// Van >= 20\n// Strb >= 20",
        "question": "A small bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and the demand for each type of cake. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery has a limited supply of ingredients: it can use up to 300 eggs, 200 pounds of flour, and 150 pounds of sugar daily. The requirements for each type of cake are as follows:\n\n| Cake Type | Eggs | Flour | Sugar |\n|-----------|------|-------|-------|\n| Chocolate | 2    | 1     | 1     |\n| Vanilla   | 1    | 1     | 1     |\n| Strawberry| 1    | 1     | 2     |\n\nThe bakery has a daily demand limit for each type of cake. It cannot sell more than 100 chocolate cakes, 120 vanilla cakes, and 80 strawberry cakes. Additionally, to ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStrb = model.addVar(vtype=\"INTEGER\", name=\"Strb\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Strb)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*Choc + Van + Strb <= 300) # eggs\nmodel.addCons(Choc + Van + Strb <= 200) # flour\nmodel.addCons(Choc + Van + 2*Strb <= 150) # sugar\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Choc <= 100)\nmodel.addCons(Van <= 120)\nmodel.addCons(Strb <= 80)\n## To ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 20)\nmodel.addCons(Strb >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Strb))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strb\", \"range\": \"Strb >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Strb\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It can use up to 300 eggs, 200 pounds of flour, and 150 pounds of sugar daily. Each chocolate cake requires 2 eggs, 1 pound of flour, and 1 pound of sugar. Each vanilla cake requires 1 egg, 1 pound of flour, and 1 pound of sugar. Each strawberry cake requires 1 egg, 1 pound of flour, and 2 pounds of sugar.\n// 2*Choc + Van + Strb <= 300 (eggs)\n// Choc + Van + Strb <= 200 (flour)\n// Choc + Van + 2*Strb <= 150 (sugar)\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of cake. It cannot sell more than 100 chocolate cakes, 120 vanilla cakes, and 80 strawberry cakes.\n// Choc <= 100\n// Van <= 120\n// Strb <= 80\n\n## Generate Constraint-3:\nTo ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily.\n// Choc >= 20\n// Van >= 20\n// Strb >= 20",
        "question": "A small bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and the demand for each type of cake. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery has a limited supply of ingredients, with up to 300 eggs, 200 pounds of flour, and 150 pounds of sugar available daily. Each chocolate cake requires 2 eggs, 1 pound of flour, and 1 pound of sugar. Each vanilla cake requires 1 egg, 1 pound of flour, and 1 pound of sugar. Each strawberry cake requires 1 egg, 1 pound of flour, and 2 pounds of sugar. The bakery has a daily demand limit for each type of cake, with a maximum of 100 chocolate cakes, 120 vanilla cakes, and 80 strawberry cakes. Additionally, to ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily. Please help the bakery maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStrb = model.addVar(vtype=\"INTEGER\", name=\"Strb\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Strb)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*Choc + Van + Strb <= 300) # eggs\nmodel.addCons(Choc + Van + Strb <= 200) # flour\nmodel.addCons(Choc + Van + 2*Strb <= 150) # sugar\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Choc <= 100)\nmodel.addCons(Van <= 120)\nmodel.addCons(Strb <= 80)\n## To ensure variety and customer satisfaction, the bakery must produce at least 20 of each type of cake daily.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 20)\nmodel.addCons(Strb >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Strb))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price.\n// {\"number of Bread 1 produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\n// x1 >= 100\n// x2 >= 200",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types. The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total. Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively, and the bakery has a total of 600 hours of labor available per week. The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\n\nPlease help the bakery determine the optimal number of each type of bread to produce to maximize its total revenue.\n\n| Bread Type | Selling Price per Loaf | Labor Required per Loaf (hours) |\n|------------|------------------------|---------------------------------|\n| Bread 1    | $3.50                  | 0.5                             |\n| Bread 2    | $4.00                  | 0.6                             |\n| Bread 3    | $4.50                  | 0.7                             |\n| Bread 4    | $5.00                  | 0.8                             |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600)\n## The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price.\n// {\"number of Bread 1 produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\n// x1 >= 100\n// x2 >= 200",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total. Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively, and the bakery has a total of 600 hours of labor available per week. The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week. Please help the bakery to maximize its total revenue from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600)\n## The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily.\n// {\"number of Cake 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 10*x1 + 12*x2 + 15*x3 + 18*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units.\n// 2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours.\n// x1 + 2*x2 + 3*x3 + 4*x4 <= 50\n\n## Generate Constraint-3:\nThe bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes.\n// x1 <= 15",
        "question": "A bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily. The selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The following table summarizes the requirements and constraints:\n\n| Cake | Selling Price | Ingredient A Required | Labor Required |\n|------|---------------|-----------------------|----------------|\n| 1    | $10           | 2 units               | 1 hour         |\n| 2    | $12           | 3 units               | 2 hours        |\n| 3    | $15           | 4 units               | 3 hours        |\n| 4    | $18           | 5 units               | 4 hours        |\n\nThe bakery has a limited supply of ingredients. The total daily supply of ingredient A is 100 units. The bakery also has a limited labor force, with a total daily labor available of 50 hours. Additionally, the bakery has a demand constraint for Cake 1, with the maximum daily demand for Cake 1 being 15 cakes.\n\nPlease help the bakery to maximize its daily revenue from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Cake 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Cake 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Cake 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Cake 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*x1 + 12*x2 + 15*x3 + 18*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100)\n## The bakery also has a limited labor force.\nmodel.addCons(x1 + 2*x2 + 3*x3 + 4*x4 <= 50)\n## The bakery has a demand constraint for Cake 1.\nmodel.addCons(x1 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Cake 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Cake 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Cake 4 produced daily: \", model.getVal(x4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily.\n// {\"number of Cake 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 10*x1 + 12*x2 + 15*x3 + 18*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units.\n// 2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours.\n// x1 + 2*x2 + 3*x3 + 4*x4 <= 50\n\n## Generate Constraint-3:\nThe bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes.\n// x1 <= 15",
        "question": "A bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales. The bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units. The bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours. Additionally, the bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes. Please help the bakery determine the number of each type of cake to produce daily to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Cake 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Cake 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Cake 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Cake 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*x1 + 12*x2 + 15*x3 + 18*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100)\n## The bakery also has a limited labor force.\nmodel.addCons(x1 + 2*x2 + 3*x3 + 4*x4 <= 50)\n## The bakery has a demand constraint for Cake 1.\nmodel.addCons(x1 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Cake 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Cake 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Cake 4 produced daily: \", model.getVal(x4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"quantity of Bread 1 produced\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total profit from selling all types of bread.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2500 loaves.\n// x1 + x2 + x3 + x4 <= 2500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\n// x1 >= 500\n// x2 >= 600\n// x3 >= 400\n// x4 >= 500\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\n// x3 <= 800",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Bread 1    | $1.50           |\n| Bread 2    | $2.00           |\n| Bread 3    | $1.75           |\n| Bread 4    | $1.80           |\n\nThe bakery has a daily oven capacity of 2500 loaves. The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4. Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # quantity of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # quantity of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # quantity of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=1000) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2500 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2500)\n## The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\nmodel.addCons(x1 >= 500)\nmodel.addCons(x2 >= 600)\nmodel.addCons(x3 >= 400)\nmodel.addCons(x4 >= 500)\n## Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\nmodel.addCons(x3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(x1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(x2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(x3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"quantity of Bread 1 produced\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total profit from selling all types of bread.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2500 loaves.\n// x1 + x2 + x3 + x4 <= 2500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\n// x1 >= 500\n// x2 >= 600\n// x3 >= 400\n// x4 >= 500\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\n// x3 <= 800",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a daily oven capacity of 2500 loaves. The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4. Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day. Please help the bakery to maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # quantity of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # quantity of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # quantity of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=1000) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2500 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2500)\n## The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\nmodel.addCons(x1 >= 500)\nmodel.addCons(x2 >= 600)\nmodel.addCons(x3 >= 400)\nmodel.addCons(x4 >= 500)\n## Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\nmodel.addCons(x3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(x1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(x2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(x3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"WheatLoaves\", \"range\": \"WheatLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeLoaves\", \"range\": \"RyeLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughLoaves\", \"range\": \"SourdoughLoaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n// Objective Function: Maximize: 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg of flour, and each loaf of sourdough bread requires 0.3 kg of flour. The total available flour is 1000 kg.\n// 0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.015 kg of yeast. The total available yeast is 15 kg.\n// 0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.4 hours of labor. The total available labor hours is 200 hours.\n// 0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf | Yeast Required per Loaf | Labor Hours Required per Loaf |\n|---------------|-----------------|-------------------------|-------------------------|-------------------------------|\n| Wheat         | $2              | 0.5 kg                  | 0.01 kg                 | 0.2 hours                     |\n| Rye           | $3              | 0.4 kg                  | 0.02 kg                 | 0.3 hours                     |\n| Sourdough     | $4              | 0.3 kg                  | 0.015 kg                | 0.4 hours                     |\n\nThe bakery has a limited amount of flour available, with a total of 1000 kg. The bakery also has a limited amount of yeast available, with a total of 15 kg. Additionally, the bakery has a limited amount of labor hours, with a total of 200 hours.\n\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheatLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatLoaves\", lb=0) # number of loaves of wheat bread\nRyeLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeLoaves\", lb=0) # number of loaves of rye bread\nSourdoughLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughLoaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(WheatLoaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeLoaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughLoaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"WheatLoaves\", \"range\": \"WheatLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeLoaves\", \"range\": \"RyeLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughLoaves\", \"range\": \"SourdoughLoaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n// Objective Function: Maximize: 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg of flour, and each loaf of sourdough bread requires 0.3 kg of flour. The total available flour is 1000 kg.\n// 0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.015 kg of yeast. The total available yeast is 15 kg.\n// 0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.4 hours of labor. The total available labor hours is 200 hours.\n// 0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery has a limited amount of flour available, with each loaf of wheat bread requiring 0.5 kg of flour, each loaf of rye bread requiring 0.4 kg of flour, and each loaf of sourdough bread requiring 0.3 kg of flour, with a total of 1000 kg of flour available. The bakery also has a limited amount of yeast available, with each loaf of wheat bread requiring 0.01 kg of yeast, each loaf of rye bread requiring 0.02 kg of yeast, and each loaf of sourdough bread requiring 0.015 kg of yeast, with a total of 15 kg of yeast available. Additionally, the bakery has a limited amount of labor hours, with each loaf of wheat bread requiring 0.2 hours of labor, each loaf of rye bread requiring 0.3 hours of labor, and each loaf of sourdough bread requiring 0.4 hours of labor, with a total of 200 hours of labor available. Please help the bakery to maximize the total profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheatLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatLoaves\", lb=0) # number of loaves of wheat bread\nRyeLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeLoaves\", lb=0) # number of loaves of rye bread\nSourdoughLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughLoaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(WheatLoaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeLoaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughLoaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.7 hours of labor.\n// 0.5*WholeWheat + 0.6*Rye + 0.4*Sourdough + 0.7*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 per week for ingredients. The cost of ingredients for each loaf of Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The bakery must stay within this budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced.\n// Brioche >= 0.1*(WholeWheat + Rye + Sourdough + Brioche)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2              |\n| Rye          | $3              |\n| Sourdough    | $2.50           |\n| Brioche      | $4              |\n\nThe bakery has a total of 1000 hours of labor available per week. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.7 hours of labor. The bakery also has a budget of $5000 per week for ingredients. The cost of ingredients for each loaf of Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The bakery must stay within this budget. Additionally, the bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced.\n\nPlease help the bakery to maximize the total profit from selling these bread types while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.4*Sourdough + 0.7*Brioche <= 1000)\n## The bakery has a budget of $5000 per week for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Brioche >= 0.1*(WholeWheat + Rye + Sourdough + Brioche))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.7 hours of labor.\n// 0.5*WholeWheat + 0.6*Rye + 0.4*Sourdough + 0.7*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 per week for ingredients. The cost of ingredients for each loaf of Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The bakery must stay within this budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced.\n// Brioche >= 0.1*(WholeWheat + Rye + Sourdough + Brioche)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available per week, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.6 hours, Sourdough requiring 0.4 hours, and Brioche requiring 0.7 hours of labor. The bakery also has a budget of $5000 per week for ingredients, with the cost of ingredients for each loaf of Whole Wheat being $0.50, for Rye being $0.70, for Sourdough being $0.60, and for Brioche being $1. Additionally, the bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.6*Rye + 0.4*Sourdough + 0.7*Brioche <= 1000)\n## The bakery has a budget of $5000 per week for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a demand constraint where the number of Brioche loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Brioche >= 0.1*(WholeWheat + Rye + Sourdough + Brioche))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*x1 + 3*x2 + 2.5*x3 + 4*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.5, Rye is $0.7, Sourdough is $0.6, and Brioche is $1.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\n// x1 >= 0.2*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Bread Type   | Profit per Loaf | Labor per Loaf | Ingredient Cost per Loaf |\n|--------------|-----------------|----------------|--------------------------|\n| Whole Wheat  | $2              | 0.5 hours      | $0.5                     |\n| Rye          | $3              | 0.6 hours      | $0.7                     |\n| Sourdough    | $2.5            | 0.4 hours      | $0.6                     |\n| Brioche      | $4              | 0.8 hours      | $1                       |\n\nThe bakery has a total of 1000 hours of labor available and a budget of $5000 for ingredients. The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread. Please help the bakery to maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3 + 4*x4)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000)\n## The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\nmodel.addCons(x1 >= 0.2*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*x1 + 3*x2 + 2.5*x3 + 4*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.5, Rye is $0.7, Sourdough is $0.6, and Brioche is $1.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\n// x1 >= 0.2*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.6 hours, Sourdough requiring 0.4 hours, and Brioche requiring 0.8 hours of labor. The bakery also has a budget of $5000 for ingredients, with the cost of ingredients per loaf for Whole Wheat being $0.5, Rye being $0.7, Sourdough being $0.6, and Brioche being $1. The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3 + 4*x4)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000)\n## The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\nmodel.addCons(x1 >= 0.2*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"continuous\"}\n// {\"number of Multigrain loaves\": \"M\", \"range\": \"M >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*WW + 2.50*R + 3*S + 2.75*M\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.5 hours of labor.\n// 0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of Whole Wheat requires 1.5 hours, Rye requires 1.2 hours, Sourdough requires 1.8 hours, and Multigrain requires 1.6 hours of oven time.\n// 1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500\n\n## Generate Constraint-3:\nThere is a minimum customer demand for each type of bread. The bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\n// WW >= 100\n// R >= 150\n// S >= 200\n// M >= 120",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf and the time required for labor and oven usage for each type of bread are given in the following Table.\n\n| Bread Type     | Profit per Loaf | Labor Time per Loaf | Oven Time per Loaf |\n|----------------|-----------------|---------------------|--------------------|\n| Whole Wheat (WW)| $2              | 0.5 hours           | 1.5 hours          |\n| Rye (R)        | $2.50           | 0.4 hours           | 1.2 hours          |\n| Sourdough (S)  | $3              | 0.6 hours           | 1.8 hours          |\n| Multigrain (M) | $2.75           | 0.5 hours           | 1.6 hours          |\n\nThe bakery has a total of 1000 hours of labor available and a limited oven capacity of 1500 hours. There is a minimum customer demand for each type of bread: the bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # number of Rye loaves\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # number of Sourdough loaves\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # number of Multigrain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*R + 3*S + 2.75*M)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500)\n## There is a minimum customer demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(R >= 150)\nmodel.addCons(S >= 200)\nmodel.addCons(M >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(R))\n    print(\"Number of Sourdough loaves: \", model.getVal(S))\n    print(\"Number of Multigrain loaves: \", model.getVal(M))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"continuous\"}\n// {\"number of Multigrain loaves\": \"M\", \"range\": \"M >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*WW + 2.50*R + 3*S + 2.75*M\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.5 hours of labor.\n// 0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of Whole Wheat requires 1.5 hours, Rye requires 1.2 hours, Sourdough requires 1.8 hours, and Multigrain requires 1.6 hours of oven time.\n// 1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500\n\n## Generate Constraint-3:\nThere is a minimum customer demand for each type of bread. The bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\n// WW >= 100\n// R >= 150\n// S >= 200\n// M >= 120",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\nThe profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery wants to maximize the total profit from selling all types of bread.\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.5 hours of labor.\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of Whole Wheat requires 1.5 hours, Rye requires 1.2 hours, Sourdough requires 1.8 hours, and Multigrain requires 1.6 hours of oven time.\nThere is a minimum customer demand for each type of bread. The bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\nPlease help the bakery to maximize the total profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # number of Rye loaves\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # number of Sourdough loaves\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # number of Multigrain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*R + 3*S + 2.75*M)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500)\n## There is a minimum customer demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(R >= 150)\nmodel.addCons(S >= 200)\nmodel.addCons(M >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(R))\n    print(\"Number of Sourdough loaves: \", model.getVal(S))\n    print(\"Number of Multigrain loaves: \", model.getVal(M))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the constraints of oven capacity, ingredient availability, and market demand.\n// {\"daily production of whole wheat bread\": \"ww_bread\", \"range\": \"ww_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"rye_bread\", \"range\": \"rye_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"sourdough_bread\", \"range\": \"sourdough_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of baguette\": \"baguette\", \"range\": \"baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $1.50, for rye bread is $1.75, for sourdough bread is $2.00, and for baguette is $1.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*ww_bread + 1.75*rye_bread + 2.00*sourdough_bread + 1.25*baguette\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// ww_bread + rye_bread + sourdough_bread + baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast. Each loaf of bread requires 1 pound of flour and 0.02 pounds of yeast.\n// ww_bread + rye_bread + sourdough_bread + baguette <= 1500 (flour constraint)\n// 0.02*ww_bread + 0.02*rye_bread + 0.02*sourdough_bread + 0.02*baguette <= 300 (yeast constraint)\n\n## Generate Constraint-3:\nMarket demand limits the daily sales of each type of bread: 500 loaves for whole wheat, 300 loaves for rye, 400 loaves for sourdough, and 200 loaves for baguette.\n// ww_bread <= 500\n// rye_bread <= 300\n// sourdough_bread <= 400\n// baguette <= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the constraints of oven capacity, ingredient availability, and market demand. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $1.50           |\n| Rye           | $1.75           |\n| Sourdough     | $2.00           |\n| Baguette      | $1.25           |\n\nThe bakery has an oven capacity of 1000 loaves per day. The bakery also has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast, with each loaf of bread requiring 1 pound of flour and 0.02 pounds of yeast. Market demand limits the daily sales of each type of bread: 500 loaves for whole wheat, 300 loaves for rye, 400 loaves for sourdough, and 200 loaves for baguette.\n\nPlease help the bakery to maximize the total daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nww_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"ww_bread\", lb=0) # daily production of whole wheat bread\nrye_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"rye_bread\", lb=0) # daily production of rye bread\nsourdough_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"sourdough_bread\", lb=0) # daily production of sourdough bread\nbaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"baguette\", lb=0) # daily production of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*ww_bread + 1.75*rye_bread + 2.00*sourdough_bread + 1.25*baguette)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(ww_bread + rye_bread + sourdough_bread + baguette <= 1000)\n## The bakery has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast.\nmodel.addCons(ww_bread + rye_bread + sourdough_bread + baguette <= 1500) # flour constraint\nmodel.addCons(0.02*ww_bread + 0.02*rye_bread + 0.02*sourdough_bread + 0.02*baguette <= 300) # yeast constraint\n## Market demand limits the daily sales of each type of bread.\nmodel.addCons(ww_bread <= 500)\nmodel.addCons(rye_bread <= 300)\nmodel.addCons(sourdough_bread <= 400)\nmodel.addCons(baguette <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of whole wheat bread: \", model.getVal(ww_bread))\n    print(\"Daily production of rye bread: \", model.getVal(rye_bread))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_bread))\n    print(\"Daily production of baguette: \", model.getVal(baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the constraints of oven capacity, ingredient availability, and market demand.\n// {\"daily production of whole wheat bread\": \"ww_bread\", \"range\": \"ww_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"rye_bread\", \"range\": \"rye_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"sourdough_bread\", \"range\": \"sourdough_bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production of baguette\": \"baguette\", \"range\": \"baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $1.50, for rye bread is $1.75, for sourdough bread is $2.00, and for baguette is $1.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*ww_bread + 1.75*rye_bread + 2.00*sourdough_bread + 1.25*baguette\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// ww_bread + rye_bread + sourdough_bread + baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast. Each loaf of bread requires 1 pound of flour and 0.02 pounds of yeast.\n// ww_bread + rye_bread + sourdough_bread + baguette <= 1500 (flour constraint)\n// 0.02*ww_bread + 0.02*rye_bread + 0.02*sourdough_bread + 0.02*baguette <= 300 (yeast constraint)\n\n## Generate Constraint-3:\nMarket demand limits the daily sales of each type of bread: 500 loaves for whole wheat, 300 loaves for rye, 400 loaves for sourdough, and 200 loaves for baguette.\n// ww_bread <= 500\n// rye_bread <= 300\n// sourdough_bread <= 400\n// baguette <= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the constraints of oven capacity, ingredient availability, and market demand. The profit per loaf for whole wheat bread is $1.50, for rye bread is $1.75, for sourdough bread is $2.00, and for baguette is $1.25. The bakery has an oven capacity of 1000 loaves per day. The bakery has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast, with each loaf requiring 1 pound of flour and 0.02 pounds of yeast. Market demand limits the daily sales of each type of bread: 500 loaves for whole wheat, 300 loaves for rye, 400 loaves for sourdough, and 200 loaves for baguette. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nww_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"ww_bread\", lb=0) # daily production of whole wheat bread\nrye_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"rye_bread\", lb=0) # daily production of rye bread\nsourdough_bread = model.addVar(vtype=\"CONTINUOUS\", name=\"sourdough_bread\", lb=0) # daily production of sourdough bread\nbaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"baguette\", lb=0) # daily production of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*ww_bread + 1.75*rye_bread + 2.00*sourdough_bread + 1.25*baguette)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(ww_bread + rye_bread + sourdough_bread + baguette <= 1000)\n## The bakery has a limited supply of key ingredients: 1500 pounds of flour and 300 pounds of yeast.\nmodel.addCons(ww_bread + rye_bread + sourdough_bread + baguette <= 1500) # flour constraint\nmodel.addCons(0.02*ww_bread + 0.02*rye_bread + 0.02*sourdough_bread + 0.02*baguette <= 300) # yeast constraint\n## Market demand limits the daily sales of each type of bread.\nmodel.addCons(ww_bread <= 500)\nmodel.addCons(rye_bread <= 300)\nmodel.addCons(sourdough_bread <= 400)\nmodel.addCons(baguette <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of whole wheat bread: \", model.getVal(ww_bread))\n    print(\"Daily production of rye bread: \", model.getVal(rye_bread))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_bread))\n    print(\"Daily production of baguette: \", model.getVal(baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of wheat bread requires 0.5 hours, rye bread requires 0.7 hours, sourdough bread requires 1 hour, and whole grain bread requires 0.8 hours of labor.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of wheat bread requires 1.5 hours, rye bread requires 2 hours, sourdough bread requires 2.5 hours, and whole grain bread requires 2 hours of oven time.\n// 1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500\n\n## Generate Constraint-3:\nThe bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\n// Wheat >= 500\n// Rye >= 300",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery has a total of 1000 hours of labor available, with each loaf of wheat bread requiring 0.5 hours, rye bread requiring 0.7 hours, sourdough bread requiring 1 hour, and whole grain bread requiring 0.8 hours of labor. The bakery also has a limited oven capacity of 1500 hours, with each loaf of wheat bread requiring 1.5 hours, rye bread requiring 2 hours, sourdough bread requiring 2.5 hours, and whole grain bread requiring 2 hours of oven time. The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\n\nPlease help the bakery to maximize the total profit from selling these bread types.\n\n| Bread Type       | Profit per Loaf | Labor Time per Loaf | Oven Time per Loaf |\n|------------------|-----------------|---------------------|--------------------|\n| Wheat            | $2              | 0.5 hours           | 1.5 hours          |\n| Rye              | $3              | 0.7 hours           | 2 hours            |\n| Sourdough        | $4              | 1 hour              | 2.5 hours          |\n| Whole Grain      | $3.5            | 0.8 hours           | 2 hours            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # number of loaves of wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nWholeGrain = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeGrain\", lb=0) # number of loaves of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500)\n## The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\nmodel.addCons(Wheat >= 500)\nmodel.addCons(Rye >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(WholeGrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1521,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of wheat bread requires 0.5 hours, rye bread requires 0.7 hours, sourdough bread requires 1 hour, and whole grain bread requires 0.8 hours of labor.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of wheat bread requires 1.5 hours, rye bread requires 2 hours, sourdough bread requires 2.5 hours, and whole grain bread requires 2 hours of oven time.\n// 1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500\n\n## Generate Constraint-3:\nThe bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\n// Wheat >= 500\n// Rye >= 300",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery has a total of 1000 hours of labor available, with each loaf of wheat bread requiring 0.5 hours, rye bread requiring 0.7 hours, sourdough bread requiring 1 hour, and whole grain bread requiring 0.8 hours of labor. The bakery also has a limited oven capacity of 1500 hours, with each loaf of wheat bread requiring 1.5 hours, rye bread requiring 2 hours, sourdough bread requiring 2.5 hours, and whole grain bread requiring 2 hours of oven time. The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # number of loaves of wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nWholeGrain = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeGrain\", lb=0) # number of loaves of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500)\n## The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\nmodel.addCons(Wheat >= 500)\nmodel.addCons(Rye >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(WholeGrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of White Bread loaves\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 1000 loaves due to oven limitations.\n// WholeWheat + Rye + Sourdough + WhiteBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds.\n// 0.5*WholeWheat + 0.4*Rye <= 600\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread.\n// WholeWheat >= 50\n// Rye >= 75\n// Sourdough >= 100\n// WhiteBread >= 125",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery has a daily capacity of 1000 loaves due to oven limitations. The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds, with each loaf of Whole Wheat requiring 0.5 pounds and each loaf of Rye requiring 0.4 pounds. The bakery also has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Whole Grain Flour Required (pounds) |\n|---------------|-----------------|------------------------------------|\n| Whole Wheat   | $2.50           | 0.5                                |\n| Rye           | $3.00           | 0.4                                |\n| Sourdough     | $2.75           | 0                                  |\n| White Bread   | $2.25           | 0                                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of White Bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread)\n\n# Add constraints\n## The bakery has a daily capacity of 1000 loaves due to oven limitations.\nmodel.addCons(WholeWheat + Rye + Sourdough + WhiteBread <= 1000)\n## The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 600)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 75)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(WhiteBread >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White Bread loaves: \", model.getVal(WhiteBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1424,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of White Bread loaves\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 1000 loaves due to oven limitations.\n// WholeWheat + Rye + Sourdough + WhiteBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds.\n// 0.5*WholeWheat + 0.4*Rye <= 600\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread.\n// WholeWheat >= 50\n// Rye >= 75\n// Sourdough >= 100\n// WhiteBread >= 125",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery has a daily capacity of 1000 loaves due to oven limitations. The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds. The bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of White Bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread)\n\n# Add constraints\n## The bakery has a daily capacity of 1000 loaves due to oven limitations.\nmodel.addCons(WholeWheat + Rye + Sourdough + WhiteBread <= 1000)\n## The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 600)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 75)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(WhiteBread >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White Bread loaves: \", model.getVal(WhiteBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of loaves of Whole Wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds.\n// 1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\n// 0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600\n\n## Generate Constraint-3:\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\n// WholeWheat <= 300",
        "question": "A bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $2              |\n| Rye              | $2.5            |\n| Sourdough        | $3              |\n| Multigrain       | $2.75           |\n\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds. The bakery also has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours. Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of Whole Wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000)\n## The bakery has a maximum oven capacity of 600 hours.\nmodel.addCons(0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600)\n## Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\nmodel.addCons(WholeWheat <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of loaves of Whole Wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds.\n// 1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\n// 0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600\n\n## Generate Constraint-3:\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\n// WholeWheat <= 300",
        "question": "A bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75. The bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds. The bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours. Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves. Please help the bakery to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of Whole Wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000)\n## The bakery has a maximum oven capacity of 600 hours.\nmodel.addCons(0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600)\n## Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\nmodel.addCons(WholeWheat <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can only bake a total of 2500 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\n// WholeWheat >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2              |\n| Rye          | $3              |\n| Sourdough    | $2.50           |\n| Brioche      | $4              |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor. The bakery has a limited oven space and can only bake a total of 2500 loaves. Additionally, the bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\n\nPlease help the bakery to maximize the total profit from selling these bread types while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a limited oven space and can only bake a total of 2500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2500)\n## The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\nmodel.addCons(WholeWheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can only bake a total of 2500 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\n// WholeWheat >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.4 hours, Sourdough requiring 0.6 hours, and Brioche requiring 0.8 hours of labor. The bakery has a limited oven space and can only bake a total of 2500 loaves. Additionally, the bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week. Please help the bakery maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a limited oven space and can only bake a total of 2500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2500)\n## The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\nmodel.addCons(WholeWheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe.\n// {\"amount of Whole Wheat flour\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye flour\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Spelt flour\": \"Spelt\", \"range\": \"Spelt >= 0\", \"type\": \"continuous\"}\n// {\"amount of Oat flour\": \"Oat\", \"range\": \"Oat >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe.\n// Minimize: 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat\n\n## Generate Constraint-1:\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\n// WW + Rye + Spelt + Oat = 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\n// WW >= 0.20 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-3:\nThe bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\n// WW <= 0.50 * (WW + Rye + Spelt + Oat)\n// Rye <= 0.50 * (WW + Rye + Spelt + Oat)\n// Spelt <= 0.50 * (WW + Rye + Spelt + Oat)\n// Oat <= 0.50 * (WW + Rye + Spelt + Oat)",
        "question": "A bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe. The cost per kilogram for each type of flour is given in the following Table.\n\n| Type of Flour | Cost per Kilogram |\n|---------------|-------------------|\n| Whole Wheat   | $0.50             |\n| Rye           | $0.60             |\n| Spelt         | $0.70             |\n| Oat           | $0.45             |\n\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms. The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons. Additionally, the bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\n\nPlease help the bakery to minimize the total cost of the flour used in the bread recipe.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of flour\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # amount of Whole Wheat flour\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye flour\nSpelt = model.addVar(vtype=\"CONTINUOUS\", name=\"Spelt\", lb=0) # amount of Spelt flour\nOat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oat\", lb=0) # amount of Oat flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat)\n\n# Add constraints\n## The bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\nmodel.addCons(WW + Rye + Spelt + Oat == 100)\n## The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Spelt + Oat))\n## The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\nmodel.addCons(WW <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Rye <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Spelt <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Oat <= 0.50 * (WW + Rye + Spelt + Oat))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat flour: \", model.getVal(WW))\n    print(\"Amount of Rye flour: \", model.getVal(Rye))\n    print(\"Amount of Spelt flour: \", model.getVal(Spelt))\n    print(\"Amount of Oat flour: \", model.getVal(Oat))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe.\n// {\"amount of Whole Wheat flour\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye flour\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Spelt flour\": \"Spelt\", \"range\": \"Spelt >= 0\", \"type\": \"continuous\"}\n// {\"amount of Oat flour\": \"Oat\", \"range\": \"Oat >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe.\n// Minimize: 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat\n\n## Generate Constraint-1:\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\n// WW + Rye + Spelt + Oat = 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\n// WW >= 0.20 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-3:\nThe bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\n// WW <= 0.50 * (WW + Rye + Spelt + Oat)\n// Rye <= 0.50 * (WW + Rye + Spelt + Oat)\n// Spelt <= 0.50 * (WW + Rye + Spelt + Oat)\n// Oat <= 0.50 * (WW + Rye + Spelt + Oat)",
        "question": "A bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe. The cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe. The bread recipe requires that the total amount of flour used must be exactly 100 kilograms. The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons. Additionally, the bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\nPlease help the bakery determine the optimal amounts of Whole Wheat, Rye, Spelt, and Oat flour to use in the bread recipe.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of flour\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # amount of Whole Wheat flour\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye flour\nSpelt = model.addVar(vtype=\"CONTINUOUS\", name=\"Spelt\", lb=0) # amount of Spelt flour\nOat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oat\", lb=0) # amount of Oat flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat)\n\n# Add constraints\n## The bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\nmodel.addCons(WW + Rye + Spelt + Oat == 100)\n## The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Spelt + Oat))\n## The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\nmodel.addCons(WW <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Rye <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Spelt <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Oat <= 0.50 * (WW + Rye + Spelt + Oat))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat flour: \", model.getVal(WW))\n    print(\"Amount of Rye flour: \", model.getVal(Rye))\n    print(\"Amount of Spelt flour: \", model.getVal(Spelt))\n    print(\"Amount of Oat flour: \", model.getVal(Oat))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain_Loaves\", \"range\": \"Multigrain_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery wants to maximize the total profit from selling all types of bread.\n// Maximize: 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds.\n// Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf for each type of bread is as follows: wheat bread at $2.50, rye bread at $3.00, sourdough bread at $3.50, and multigrain bread at $4.00.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf | Labor Hours Required per Loaf |\n|---------------|-----------------|-------------------------|-------------------------------|\n| Wheat         | $2.50           | 1 pound                  | 0.5 hours                     |\n| Rye           | $3.00           | 1.5 pounds               | 0.75 hours                    |\n| Sourdough     | $3.50           | 2 pounds                 | 1 hour                        |\n| Multigrain    | $4.00           | 2.5 pounds               | 1.25 hours                    |\n\nThe bakery has a total of 1000 pounds of flour available and a total of 400 labor hours available. Additionally, the bakery has a storage capacity limit of 500 loaves.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\nMultigrain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Loaves\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000)\n## The bakery has a total of 400 labor hours available.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain_Loaves\", \"range\": \"Multigrain_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery wants to maximize the total profit from selling all types of bread.\n// Maximize: 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds.\n// Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds. The bakery also has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours. Additionally, the bakery has a storage capacity limit of 500 loaves. Please help the bakery to maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\nMultigrain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Loaves\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000)\n## The bakery has a total of 400 labor hours available.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints.\n// {\"daily production of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Objective Function: Maximize: 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor.\n// 0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\n// Whole_Wheat + Rye + Sourdough + Brioche <= 1500\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// Whole_Wheat >= 200",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $1.50           |\n| Rye              | $2.00           |\n| Sourdough        | $2.50           |\n| Brioche          | $3.00           |\n\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor. The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily. Additionally, the bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000)\n## The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Brioche <= 1500)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(Whole_Wheat >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints.\n// {\"daily production of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Objective Function: Maximize: 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor.\n// 0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\n// Whole_Wheat + Rye + Sourdough + Brioche <= 1500\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// Whole_Wheat >= 200",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints. The profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery has a total of 1000 hours of labor available per day, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.7 hours, Sourdough requiring 0.8 hours, and Brioche requiring 1 hour of labor. The bakery also has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily. Additionally, the bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. Please help the bakery to maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000)\n## The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Brioche <= 1500)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(Whole_Wheat >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\n// Chocolate_Cakes >= 10",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table outlines the labor and flour requirements for each type of cake.\n\n| Cake Type | Labor per Cake | Flour per Cake |\n|-----------|----------------|----------------|\n| Chocolate | 2 hours        | 3 pounds       |\n| Vanilla   | 1 hour         | 2 pounds       |\n\nThe bakery has a maximum of 100 hours of labor available daily and a maximum of 150 pounds of flour available daily. The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation. Please help the bakery maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of hours of labor and amount of flour used are not directly variables but can be calculated from the cakes produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## Each chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n## The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\nmodel.addCons(Chocolate_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\n// Chocolate_Cakes >= 10",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 hours of labor and 3 pounds of flour, while each vanilla cake requires 1 hour of labor and 2 pounds of flour. The bakery has a maximum of 100 hours of labor and 150 pounds of flour available daily. Additionally, the bakery must produce at least 10 chocolate cakes daily to meet a contract obligation. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of hours of labor and amount of flour used are not directly variables but can be calculated from the cakes produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## Each chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n## The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\nmodel.addCons(Chocolate_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time used for wheat bread\": \"Oven_Time_Wheat\", \"range\": \"Oven_Time_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven time used for rye bread\": \"Oven_Time_Rye\", \"range\": \"Oven_Time_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. \nThe bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.4 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available. Each wheat bread loaf requires 200 grams of flour, and each rye bread loaf requires 250 grams of flour. The total daily flour supply is 20 kilograms.\n// 200*Wheat_Loaves + 250*Rye_Loaves <= 20000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Time per Loaf | Flour Required per Loaf |\n|------------|-----------------|---------------------|-------------------------|\n| Wheat      | $3              | 0.5 hours           | 200 grams               |\n| Rye        | $4              | 0.4 hours           | 250 grams               |\n\nThe bakery has a total of 8 hours of oven time available daily and a total daily flour supply of 20 kilograms. The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread. Please help the bakery to maximize its daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nOven_Time_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Wheat\", lb=0) # oven time used for wheat bread\nOven_Time_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Rye\", lb=0) # oven time used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.4 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 8)\n## The bakery has a limited amount of flour available. Each wheat bread loaf requires 200 grams of flour, and each rye bread loaf requires 250 grams of flour. The total daily flour supply is 20 kilograms.\nmodel.addCons(200*Wheat_Loaves + 250*Rye_Loaves <= 20000)\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time used for wheat bread\": \"Oven_Time_Wheat\", \"range\": \"Oven_Time_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven time used for rye bread\": \"Oven_Time_Rye\", \"range\": \"Oven_Time_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. \nThe bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.4 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available. Each wheat bread loaf requires 200 grams of flour, and each rye bread loaf requires 250 grams of flour. The total daily flour supply is 20 kilograms.\n// 200*Wheat_Loaves + 250*Rye_Loaves <= 20000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.4 hours of oven time. The bakery has a total of 8 hours of oven time available daily. The bakery also has a limited amount of flour available; each wheat bread loaf requires 200 grams of flour, and each rye bread loaf requires 250 grams of flour, with a total daily flour supply of 20 kilograms. The bakery has a minimum daily production requirement for each type of bread; it must produce at least 10 loaves of wheat bread and 15 loaves of rye bread. Please help the bakery to maximize its daily profit from selling both types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nOven_Time_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Wheat\", lb=0) # oven time used for wheat bread\nOven_Time_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Rye\", lb=0) # oven time used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.4 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 8)\n## The bakery has a limited amount of flour available. Each wheat bread loaf requires 200 grams of flour, and each rye bread loaf requires 250 grams of flour. The total daily flour supply is 20 kilograms.\nmodel.addCons(200*Wheat_Loaves + 250*Rye_Loaves <= 20000)\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, each vanilla cake requires 1.5 hours, and each strawberry cake requires 1 hour. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate + 1.5*Vanilla + 1*Strawberry <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 square meters of oven space, each vanilla cake requires 0.4 square meters, and each strawberry cake requires 0.3 square meters. The bakery has a total of 40 square meters of oven space available daily.\n// 0.5*Chocolate + 0.4*Vanilla + 0.3*Strawberry <= 40\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 10, for vanilla cakes is 15, and for strawberry cakes is 20.\n// Chocolate >= 10\n// Vanilla >= 15\n// Strawberry >= 20",
        "question": "A bakery specializes in producing three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The following table summarizes the labor and oven space requirements for each type of cake.\n\n| Cake Type     | Profit per Cake | Labor Hours per Cake | Oven Space per Cake |\n|---------------|-----------------|----------------------|---------------------|\n| Chocolate     | $5              | 2 hours              | 0.5 square meters  |\n| Vanilla       | $4              | 1.5 hours            | 0.4 square meters  |\n| Strawberry    | $3              | 1 hour               | 0.3 square meters  |\n\nThe bakery has a total of 100 labor hours and 40 square meters of oven space available daily. Additionally, the bakery has a minimum daily demand for each type of cake: 10 chocolate cakes, 15 vanilla cakes, and 20 strawberry cakes. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, each vanilla cake requires 1.5 hours, and each strawberry cake requires 1 hour. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate + 1.5*Vanilla + 1*Strawberry <= 100)\n## Each chocolate cake requires 0.5 square meters of oven space, each vanilla cake requires 0.4 square meters, and each strawberry cake requires 0.3 square meters. The bakery has a total of 40 square meters of oven space available daily.\nmodel.addCons(0.5*Chocolate + 0.4*Vanilla + 0.3*Strawberry <= 40)\n## The bakery has a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 10, for vanilla cakes is 15, and for strawberry cakes is 20.\nmodel.addCons(Chocolate >= 10)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, each vanilla cake requires 1.5 hours, and each strawberry cake requires 1 hour. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate + 1.5*Vanilla + 1*Strawberry <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 square meters of oven space, each vanilla cake requires 0.4 square meters, and each strawberry cake requires 0.3 square meters. The bakery has a total of 40 square meters of oven space available daily.\n// 0.5*Chocolate + 0.4*Vanilla + 0.3*Strawberry <= 40\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 10, for vanilla cakes is 15, and for strawberry cakes is 20.\n// Chocolate >= 10\n// Vanilla >= 15\n// Strawberry >= 20",
        "question": "A bakery specializes in producing three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. Each chocolate cake requires 2 hours of labor, each vanilla cake requires 1.5 hours, and each strawberry cake requires 1 hour. The bakery has a total of 100 labor hours available daily. Each chocolate cake requires 0.5 square meters of oven space, each vanilla cake requires 0.4 square meters, and each strawberry cake requires 0.3 square meters. The bakery has a total of 40 square meters of oven space available daily. The bakery has a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 10, for vanilla cakes is 15, and for strawberry cakes is 20. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, each vanilla cake requires 1.5 hours, and each strawberry cake requires 1 hour. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate + 1.5*Vanilla + 1*Strawberry <= 100)\n## Each chocolate cake requires 0.5 square meters of oven space, each vanilla cake requires 0.4 square meters, and each strawberry cake requires 0.3 square meters. The bakery has a total of 40 square meters of oven space available daily.\nmodel.addCons(0.5*Chocolate + 0.4*Vanilla + 0.3*Strawberry <= 40)\n## The bakery has a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 10, for vanilla cakes is 15, and for strawberry cakes is 20.\nmodel.addCons(Chocolate >= 10)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"oven time for chocolate cakes\": \"Oven_Time_Chocolate\", \"range\": \"Oven_Time_Chocolate >= 0\", \"type\": \"real\"}\n// {\"oven time for vanilla cakes\": \"Oven_Time_Vanilla\", \"range\": \"Oven_Time_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The bakery has a total of 12 hours of oven time available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 3 units of chocolate, and each vanilla cake requires 2 units of vanilla. The bakery has 24 units of chocolate and 16 units of vanilla available daily.\n// 3*Chocolate_Cakes <= 24\n// 2*Vanilla_Cakes <= 16\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings.\n// Vanilla_Cakes >= 2",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The following table summarizes the requirements and constraints for each type of cake.\n\n| Cake Type       | Profit per Cake | Oven Time per Cake | Chocolate Ingredient per Cake | Vanilla Ingredient per Cake |\n|-----------------|-----------------|--------------------|-------------------------------|-----------------------------|\n| Chocolate       | $10             | 2 hours            | 3 units                       | -                           |\n| Vanilla         | $8              | 1.5 hours          | -                             | 2 units                     |\n\nThe bakery has a total of 12 hours of oven time available daily. The bakery has 24 units of chocolate and 16 units of vanilla available daily. The bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings.\n\nPlease help the bakery to maximize its daily profit from cake sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The bakery has a total of 12 hours of oven time available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12)\n## The bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 3 units of chocolate, and each vanilla cake requires 2 units of vanilla. The bakery has 24 units of chocolate and 16 units of vanilla available daily.\nmodel.addCons(3*Chocolate_Cakes <= 24)\nmodel.addCons(2*Vanilla_Cakes <= 16)\n## The bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"oven time for chocolate cakes\": \"Oven_Time_Chocolate\", \"range\": \"Oven_Time_Chocolate >= 0\", \"type\": \"real\"}\n// {\"oven time for vanilla cakes\": \"Oven_Time_Vanilla\", \"range\": \"Oven_Time_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The bakery has a total of 12 hours of oven time available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 3 units of chocolate, and each vanilla cake requires 2 units of vanilla. The bakery has 24 units of chocolate and 16 units of vanilla available daily.\n// 3*Chocolate_Cakes <= 24\n// 2*Vanilla_Cakes <= 16\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings.\n// Vanilla_Cakes >= 2",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The bakery has a total of 12 hours of oven time available daily. Each chocolate cake requires 3 units of chocolate, and each vanilla cake requires 2 units of vanilla. The bakery has 24 units of chocolate and 16 units of vanilla available daily. The bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The bakery has a total of 12 hours of oven time available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12)\n## The bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 3 units of chocolate, and each vanilla cake requires 2 units of vanilla. The bakery has 24 units of chocolate and 16 units of vanilla available daily.\nmodel.addCons(3*Chocolate_Cakes <= 24)\nmodel.addCons(2*Vanilla_Cakes <= 16)\n## The bakery has a policy to produce at least 2 vanilla cakes daily to maintain a variety of offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate frosting used\": \"Chocolate_Frosting\", \"range\": \"Chocolate_Frosting >= 0\", \"type\": \"continuous\"}\n// {\"amount of vanilla frosting used\": \"Vanilla_Frosting\", \"range\": \"Vanilla_Frosting >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\n// 0.5*Chocolate_Cakes <= Chocolate_Frosting\n// 0.4*Vanilla_Cakes <= Vanilla_Frosting\n// Chocolate_Frosting <= 10\n// Vanilla_Frosting <= 8\n\n## Generate Constraint-2:\nEach cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\n// Chocolate_Cakes + Vanilla_Cakes <= 12\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\n// Vanilla_Cakes >= 2",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Profit per Cake | Frosting Required (kg) | Oven Time Required (hours) |\n|-----------------|-----------------|------------------------|----------------------------|\n| Chocolate       | $10             | 0.5                    | 1                          |\n| Vanilla         | $8              | 0.4                    | 1                          |\n\nThe bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting. Each cake requires 1 hour of oven time, and the bakery has a daily limit of 12 hours of oven time. The bakery also has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of frosting used\nChocolate_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Frosting\", lb=0) # amount of chocolate frosting used\nVanilla_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Frosting\", lb=0) # amount of vanilla frosting used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Frosting)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Frosting)\n## The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\nmodel.addCons(Chocolate_Frosting <= 10)\nmodel.addCons(Vanilla_Frosting <= 8)\n## Each cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 12)\n## The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate frosting used: \", model.getVal(Chocolate_Frosting))\n    print(\"Amount of vanilla frosting used: \", model.getVal(Vanilla_Frosting))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate frosting used\": \"Chocolate_Frosting\", \"range\": \"Chocolate_Frosting >= 0\", \"type\": \"continuous\"}\n// {\"amount of vanilla frosting used\": \"Vanilla_Frosting\", \"range\": \"Vanilla_Frosting >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\n// 0.5*Chocolate_Cakes <= Chocolate_Frosting\n// 0.4*Vanilla_Cakes <= Vanilla_Frosting\n// Chocolate_Frosting <= 10\n// Vanilla_Frosting <= 8\n\n## Generate Constraint-2:\nEach cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\n// Chocolate_Cakes + Vanilla_Cakes <= 12\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\n// Vanilla_Cakes >= 2",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit from selling a chocolate cake is $10, and from a vanilla cake is $8. Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting. Each cake requires 1 hour of oven time, and the bakery has a daily limit of 12 hours of oven time. The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of frosting used\nChocolate_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Frosting\", lb=0) # amount of chocolate frosting used\nVanilla_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Frosting\", lb=0) # amount of vanilla frosting used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Frosting)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Frosting)\n## The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\nmodel.addCons(Chocolate_Frosting <= 10)\nmodel.addCons(Vanilla_Frosting <= 8)\n## Each cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 12)\n## The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate frosting used: \", model.getVal(Chocolate_Frosting))\n    print(\"Amount of vanilla frosting used: \", model.getVal(Vanilla_Frosting))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 2.5*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20\n\n## Generate Constraint-2:\nEach wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\n// 15*Wheat_Loaves + 20*Rye_Loaves <= 240\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\n// Wheat_Loaves + Rye_Loaves >= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Usage per Loaf | Oven Time per Loaf |\n|------------|-----------------|----------------------|---------------------|\n| Wheat      | $3              | 0.5 kg               | 15 minutes         |\n| Rye        | $2.5            | 0.4 kg               | 20 minutes         |\n\nThe bakery has a daily supply of 20 kg of flour. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day. The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Flour usage in each type of bread\nFlour_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Wheat\", lb=0) # flour usage in wheat bread\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour usage in rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 2.5*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20)\n## Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\nmodel.addCons(15*Wheat_Loaves + 20*Rye_Loaves <= 240)\n## The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 2.5*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20\n\n## Generate Constraint-2:\nEach wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\n// 15*Wheat_Loaves + 20*Rye_Loaves <= 240\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\n// Wheat_Loaves + Rye_Loaves >= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour. Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day. The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Flour usage in each type of bread\nFlour_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Wheat\", lb=0) # flour usage in wheat bread\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour usage in rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 2.5*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20)\n## Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\nmodel.addCons(15*Wheat_Loaves + 20*Rye_Loaves <= 240)\n## The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"oven usage hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Each wheat bread loaf requires 200 grams of flour and 5 grams of yeast, while each rye bread loaf requires 250 grams of flour and 10 grams of yeast. The bakery has 20 kilograms of flour and 500 grams of yeast available daily.\n// 200*Wheat_Loaves + 250*Rye_Loaves <= 20000 (20 kg of flour)\n// 5*Wheat_Loaves + 10*Rye_Loaves <= 500 (500 grams of yeast)\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Loaf | Flour per Loaf | Yeast per Loaf |\n|------------|--------------------|----------------|----------------|\n| Wheat      | 0.5 hours          | 200 grams      | 5 grams        |\n| Rye        | 0.75 hours         | 250 grams      | 10 grams       |\n\nThe bakery has a total of 8 hours of oven time available daily. It also has a limited supply of ingredients: 20 kilograms of flour and 500 grams of yeast. The bakery has a minimum daily production requirement for each type of bread: it must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven usage hours for each type of bread\nWheat_Oven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Hours\", lb=0) # oven usage hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Hours\", lb=0) # oven usage hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves <= 8)\n## The bakery has a limited supply of flour and yeast. Each wheat bread loaf requires 200 grams of flour and 5 grams of yeast, while each rye bread loaf requires 250 grams of flour and 10 grams of yeast. The bakery has 20 kilograms of flour and 500 grams of yeast available daily.\nmodel.addCons(200*Wheat_Loaves + 250*Rye_Loaves <= 20000) # 20 kg of flour\nmodel.addCons(5*Wheat_Loaves + 10*Rye_Loaves <= 500) # 500 grams of yeast\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"oven usage hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Each wheat bread loaf requires 200 grams of flour and 5 grams of yeast, while each rye bread loaf requires 250 grams of flour and 10 grams of yeast. The bakery has 20 kilograms of flour and 500 grams of yeast available daily.\n// 200*Wheat_Loaves + 250*Rye_Loaves <= 20000 (20 kg of flour)\n// 5*Wheat_Loaves + 10*Rye_Loaves <= 500 (500 grams of yeast)\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily. Each wheat bread loaf requires 200 grams of flour and 5 grams of yeast, while each rye bread loaf requires 250 grams of flour and 10 grams of yeast. The bakery has 20 kilograms of flour and 500 grams of yeast available daily. The bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven usage hours for each type of bread\nWheat_Oven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Hours\", lb=0) # oven usage hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Hours\", lb=0) # oven usage hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves <= 8)\n## The bakery has a limited supply of flour and yeast. Each wheat bread loaf requires 200 grams of flour and 5 grams of yeast, while each rye bread loaf requires 250 grams of flour and 10 grams of yeast. The bakery has 20 kilograms of flour and 500 grams of yeast available daily.\nmodel.addCons(200*Wheat_Loaves + 250*Rye_Loaves <= 20000) # 20 kg of flour\nmodel.addCons(5*Wheat_Loaves + 10*Rye_Loaves <= 500) # 500 grams of yeast\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 10 loaves of wheat bread and 15 loaves of rye bread.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven is used for chocolate cakes\": \"Oven_Hours_Chocolate\", \"range\": \"Oven_Hours_Chocolate >= 0\", \"type\": \"real\"}\n// {\"number of hours the oven is used for vanilla cakes\": \"Oven_Hours_Vanilla\", \"range\": \"Oven_Hours_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The oven can operate for a maximum of 12 hours per day.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg.\n// 0.5*Chocolate_Cakes <= 3\n// 0.4*Vanilla_Cakes <= 2\n\n## Generate Constraint-3:\nThe bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 4",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The following table summarizes the requirements and constraints for each type of cake.\n\n| Cake Type | Profit per Cake | Oven Time per Cake | Chocolate Ingredient per Cake | Vanilla Ingredient per Cake |\n|-----------|-----------------|---------------------|-------------------------------|----------------------------|\n| Chocolate | $10             | 2 hours             | 0.5 kg                        | -                          |\n| Vanilla   | $8              | 1.5 hours           | -                             | 0.4 kg                     |\n\nThe bakery has the following constraints:\n- The oven can operate for a maximum of 12 hours per day.\n- The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg.\n- The bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOven_Hours_Chocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours_Chocolate\", lb=0) # hours the oven is used for chocolate cakes\nOven_Hours_Vanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours_Vanilla\", lb=0) # hours the oven is used for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The oven can operate for a maximum of 12 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12)\n## The bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg.\nmodel.addCons(0.5*Chocolate_Cakes <= 3)\nmodel.addCons(0.4*Vanilla_Cakes <= 2)\n## The bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1273,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven is used for chocolate cakes\": \"Oven_Hours_Chocolate\", \"range\": \"Oven_Hours_Chocolate >= 0\", \"type\": \"real\"}\n// {\"number of hours the oven is used for vanilla cakes\": \"Oven_Hours_Vanilla\", \"range\": \"Oven_Hours_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The oven can operate for a maximum of 12 hours per day.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg.\n// 0.5*Chocolate_Cakes <= 3\n// 0.4*Vanilla_Cakes <= 2\n\n## Generate Constraint-3:\nThe bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 4",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The oven can operate for a maximum of 12 hours per day. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg. The bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOven_Hours_Chocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours_Chocolate\", lb=0) # hours the oven is used for chocolate cakes\nOven_Hours_Vanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours_Vanilla\", lb=0) # hours the oven is used for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of oven time, and each vanilla cake requires 1.5 hours of oven time. The oven can operate for a maximum of 12 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12)\n## The bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The daily supply of chocolate is 3 kg, and the daily supply of vanilla is 2 kg.\nmodel.addCons(0.5*Chocolate_Cakes <= 3)\nmodel.addCons(0.4*Vanilla_Cakes <= 2)\n## The bakery aims to produce at least 5 chocolate cakes and 4 vanilla cakes daily to meet the minimum order requirements from regular customers.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"hours of labor for chocolate cakes\": \"Labor_Chocolate\", \"range\": \"Labor_Chocolate >= 0\", \"type\": \"real\"}\n// {\"hours of labor for vanilla cakes\": \"Labor_Vanilla\", \"range\": \"Labor_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily.\n// 0.5*Chocolate_Cakes <= 3\n// 0.3*Vanilla_Cakes <= 2\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of at least 5 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The following table summarizes the labor and ingredient requirements for each type of cake.\n\n| Cake Type       | Profit per Cake | Labor per Cake | Chocolate Required | Vanilla Extract Required |\n|-----------------|-----------------|----------------|--------------------|--------------------------|\n| Chocolate       | $10             | 2 hours        | 0.5 kg             | 0 kg                     |\n| Vanilla         | $8              | 1.5 hours      | 0 kg               | 0.3 kg                   |\n\nThe bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily. The bakery also has a minimum daily production requirement of at least 5 cakes in total.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## Hours of labor for each type of cake\nLabor_Chocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Chocolate\", lb=0) # hours of labor for chocolate cakes\nLabor_Vanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Vanilla\", lb=0) # hours of labor for vanilla cakes\nmodel.addCons(Labor_Chocolate == 2*Chocolate_Cakes)\nmodel.addCons(Labor_Vanilla == 1.5*Vanilla_Cakes)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(Labor_Chocolate + Labor_Vanilla <= 12)\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily.\nmodel.addCons(0.5*Chocolate_Cakes <= 3)\nmodel.addCons(0.3*Vanilla_Cakes <= 2)\n## The bakery has a minimum daily production requirement of at least 5 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"hours of labor for chocolate cakes\": \"Labor_Chocolate\", \"range\": \"Labor_Chocolate >= 0\", \"type\": \"real\"}\n// {\"hours of labor for vanilla cakes\": \"Labor_Vanilla\", \"range\": \"Labor_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily.\n// 0.5*Chocolate_Cakes <= 3\n// 0.3*Vanilla_Cakes <= 2\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of at least 5 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily. The bakery also has a minimum daily production requirement of at least 5 cakes in total.\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## Hours of labor for each type of cake\nLabor_Chocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Chocolate\", lb=0) # hours of labor for chocolate cakes\nLabor_Vanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Vanilla\", lb=0) # hours of labor for vanilla cakes\nmodel.addCons(Labor_Chocolate == 2*Chocolate_Cakes)\nmodel.addCons(Labor_Vanilla == 1.5*Vanilla_Cakes)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(Labor_Chocolate + Labor_Vanilla <= 12)\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of vanilla extract. The bakery has a maximum of 3 kg of chocolate and 2 kg of vanilla extract available daily.\nmodel.addCons(0.5*Chocolate_Cakes <= 3)\nmodel.addCons(0.3*Vanilla_Cakes <= 2)\n## The bakery has a minimum daily production requirement of at least 5 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. The bakery wants to maximize the daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each eclair requires 0.3 hours. The bakery has a total of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, each donut requires 0.06 square meters, and each eclair requires 0.1 square meters. The bakery has a total of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30",
        "question": "A bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per pastry and the resources required for each type of pastry are given in the following Table.\n\n| Pastry   | Profit per Unit | Labor Hours per Unit | Oven Space per Unit |\n|----------|-----------------|----------------------|---------------------|\n| Croissants | $0.50          | 0.1 hours            | 0.05 square meters  |\n| Muffins   | $0.75          | 0.2 hours            | 0.08 square meters  |\n| Donuts    | $0.60          | 0.15 hours           | 0.06 square meters  |\n| Eclairs   | $1.00          | 0.3 hours            | 0.1 square meters   |\n\nThe bakery has a total of 10 hours of labor available daily and 1.5 square meters of oven space available daily. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\nPlease help the bakery to maximize the daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs)\n\n# Add constraints\n## Each pastry requires a certain amount of labor and oven space\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10) # labor constraint\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5) # oven space constraint\n## The bakery must produce at least 50 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. The bakery wants to maximize the daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each eclair requires 0.3 hours. The bakery has a total of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, each donut requires 0.06 square meters, and each eclair requires 0.1 square meters. The bakery has a total of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30",
        "question": "A bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each eclair requires 0.3 hours. The bakery has a total of 10 hours of labor available daily. Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, each donut requires 0.06 square meters, and each eclair requires 0.1 square meters. The bakery has a total of 1.5 square meters of oven space available daily. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes. Please help the bakery to maximize the daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs)\n\n# Add constraints\n## Each pastry requires a certain amount of labor and oven space\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10) # labor constraint\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5) # oven space constraint\n## The bakery must produce at least 50 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours required for chocolate cakes\": \"Chocolate_Labor\", \"range\": \"Chocolate_Labor >= 0\", \"type\": \"real\"}\n// {\"number of labor hours required for vanilla cakes\": \"Vanilla_Labor\", \"range\": \"Vanilla_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\n// 1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 20",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The following table summarizes the labor and oven space requirements for each type of cake.\n\n| Cake Type       | Profit per Cake | Labor Hours per Cake | Oven Space per Cake |\n|-----------------|-----------------|----------------------|---------------------|\n| Chocolate       | $10             | 2 hours              | 1.5 square feet    |\n| Vanilla         | $8              | 1.5 hours            | 1 square foot       |\n\nThe total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space. The bakery has a minimum daily production requirement of 20 cakes in total.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## The total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120)\n## The total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\nmodel.addCons(1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery has a minimum daily production requirement of 20 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours required for chocolate cakes\": \"Chocolate_Labor\", \"range\": \"Chocolate_Labor >= 0\", \"type\": \"real\"}\n// {\"number of labor hours required for vanilla cakes\": \"Vanilla_Labor\", \"range\": \"Vanilla_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\n// 1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 20",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The total labor hours available per day are 120, with each chocolate cake requiring 2 hours of labor and each vanilla cake requiring 1.5 hours of labor. The total oven space available per day is 100 square feet, with each chocolate cake requiring 1.5 square feet of oven space and each vanilla cake requiring 1 square foot of oven space. The bakery has a minimum daily production requirement of 20 cakes in total. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## The total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120)\n## The total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\nmodel.addCons(1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery has a minimum daily production requirement of 20 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 kilograms of flour. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of Bread 1-4 requires 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation.\n// B1 >= 20",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The following table shows the amount of flour and labor required for each loaf of bread.\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Labor Required (hours) |\n|------------|-----------------|---------------------|-------------------------|\n| Bread 1    | $2.50           | 0.5                 | 0.05                    |\n| Bread 2    | $3.00           | 0.4                 | 0.04                    |\n| Bread 3    | $2.75           | 0.6                 | 0.06                    |\n| Bread 4    | $2.25           | 0.3                 | 0.03                    |\n\nThe bakery has a daily limit of 200 kilograms of flour and a labor limit of 8 hours. The bakery must also produce at least 20 loaves of Bread 1 daily to meet a contractual obligation. Please help the bakery to maximize the total daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # number of loaves of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # number of loaves of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # number of loaves of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4)\n\n# Add constraints\n## The bakery has a daily limit of 200 kilograms of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8)\n## The bakery must produce at least 20 loaves of Bread 1 daily.\nmodel.addCons(B1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(B1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(B2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(B3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 kilograms of flour. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of Bread 1-4 requires 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation.\n// B1 >= 20",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery has a daily limit of 200 kilograms of flour, with each loaf of Bread 1-4 requiring 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively. The bakery also has a daily labor limit of 8 hours, with each loaf of Bread 1-4 requiring 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively. Additionally, the bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation. Please help the bakery to maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # number of loaves of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # number of loaves of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # number of loaves of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4)\n\n# Add constraints\n## The bakery has a daily limit of 200 kilograms of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8)\n## The bakery must produce at least 20 loaves of Bread 1 daily.\nmodel.addCons(B1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(B1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(B2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(B3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and a pastry (Pastry D). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product.\n// {\"daily production quantity of Bread A\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread B\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread C\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Pastry D\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for Bread A, Bread B, Bread C, and Pastry D are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 1.20*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 100 kg of flour, 50 kg of sugar, and 20 kg of yeast. Each unit of Bread A requires 0.2 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Bread B requires 0.3 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast. Each unit of Bread C requires 0.25 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Pastry D requires 0.1 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n// 0.2*x1 + 0.3*x2 + 0.25*x3 + 0.1*x4 <= 100 (flour constraint)\n// 0.1*x1 + 0.15*x2 + 0.1*x3 + 0.2*x4 <= 50 (sugar constraint)\n// 0.05*x1 + 0.05*x2 + 0.05*x3 + 0.1*x4 <= 20 (yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 units in total.\n// x1 + x2 + x3 + x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A to meet a contract obligation.\n// x1 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and a pastry (Pastry D). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product. The profit margins for Bread A, Bread B, Bread C, and Pastry D are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize the total daily profit.\n\nThe bakery has a limited supply of ingredients: 100 kg of flour, 50 kg of sugar, and 20 kg of yeast. Each unit of Bread A requires 0.2 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Bread B requires 0.3 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast. Each unit of Bread C requires 0.25 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Pastry D requires 0.1 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n\nThe bakery has a daily production capacity of 500 units in total. The bakery must produce at least 100 units of Bread A to meet a contract obligation.\n\nPlease help the bakery to determine the optimal daily production quantity for each product to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread A\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread B\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread C\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 1.20*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.25*x3 + 0.1*x4 <= 100) # flour constraint\nmodel.addCons(0.1*x1 + 0.15*x2 + 0.1*x3 + 0.2*x4 <= 50) # sugar constraint\nmodel.addCons(0.05*x1 + 0.05*x2 + 0.05*x3 + 0.1*x4 <= 20) # yeast constraint\n## The bakery has a daily production capacity of 500 units in total\nmodel.addCons(x1 + x2 + x3 + x4 <= 500)\n## The bakery must produce at least 100 units of Bread A to meet a contract obligation\nmodel.addCons(x1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread A: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread B: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread C: \", model.getVal(x3))\n    print(\"Daily production quantity of Pastry D: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and a pastry (Pastry D). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product.\n// {\"daily production quantity of Bread A\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread B\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread C\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Pastry D\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for Bread A, Bread B, Bread C, and Pastry D are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 1.20*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients: 100 kg of flour, 50 kg of sugar, and 20 kg of yeast. Each unit of Bread A requires 0.2 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Bread B requires 0.3 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast. Each unit of Bread C requires 0.25 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Pastry D requires 0.1 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n// 0.2*x1 + 0.3*x2 + 0.25*x3 + 0.1*x4 <= 100 (flour constraint)\n// 0.1*x1 + 0.15*x2 + 0.1*x3 + 0.2*x4 <= 50 (sugar constraint)\n// 0.05*x1 + 0.05*x2 + 0.05*x3 + 0.1*x4 <= 20 (yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 units in total.\n// x1 + x2 + x3 + x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A to meet a contract obligation.\n// x1 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and a pastry (Pastry D). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The profit margins for Bread A, Bread B, Bread C, and Pastry D are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize the total daily profit.\n\nThe bakery has a limited supply of ingredients: 100 kg of flour, 50 kg of sugar, and 20 kg of yeast. Each unit of Bread A requires 0.2 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Bread B requires 0.3 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast. Each unit of Bread C requires 0.25 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast. Each unit of Pastry D requires 0.1 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n\nThe bakery has a daily production capacity of 500 units in total. The bakery must produce at least 100 units of Bread A to meet a contract obligation.\n\nPlease help the bakery determine the optimal daily production quantity for each product to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread A\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread B\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread C\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 1.20*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.25*x3 + 0.1*x4 <= 100) # flour constraint\nmodel.addCons(0.1*x1 + 0.15*x2 + 0.1*x3 + 0.2*x4 <= 50) # sugar constraint\nmodel.addCons(0.05*x1 + 0.05*x2 + 0.05*x3 + 0.1*x4 <= 20) # yeast constraint\n## The bakery has a daily production capacity of 500 units in total\nmodel.addCons(x1 + x2 + x3 + x4 <= 500)\n## The bakery must produce at least 100 units of Bread A to meet a contract obligation\nmodel.addCons(x1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread A: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread B: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread C: \", model.getVal(x3))\n    print(\"Daily production quantity of Pastry D: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4\n\n## Generate Constraint-1:\nEach loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery has a daily supply of 100 kg of flour.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively. The bakery has a daily supply of 2 kg of yeast.\n// 0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2\n\n## Generate Constraint-3:\nEach loaf of Bread 1-4 requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively. The bakery has a daily supply of 15 kg of sugar.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types. The requirements for each type of bread are given in the following Table.\n\n| Bread Type | Selling Price | Flour (kg) | Yeast (kg) | Sugar (kg) |\n|------------|---------------|------------|------------|------------|\n| Bread 1    | 3.50$         | 0.5        | 0.01       | 0.05       |\n| Bread 2    | 4.00$         | 0.4        | 0.02       | 0.04       |\n| Bread 3    | 4.50$         | 0.6        | 0.015      | 0.06       |\n| Bread 4    | 5.00$         | 0.7        | 0.025      | 0.07       |\n\nThe bakery has a daily supply of 100 kg of flour, 2 kg of yeast, and 15 kg of sugar. Please help the bakery to determine the optimal number of each type of bread to produce daily to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of Bread 3 produced daily\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4)\n\n# Add constraints\n## Each loaf of Bread 1-4 requires different amounts of flour, and the bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100)\n## Each loaf of Bread 1-4 requires different amounts of yeast, and the bakery has a daily supply of 2 kg of yeast.\nmodel.addCons(0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2)\n## Each loaf of Bread 1-4 requires different amounts of sugar, and the bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(B4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4\n\n## Generate Constraint-1:\nEach loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery has a daily supply of 100 kg of flour.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively. The bakery has a daily supply of 2 kg of yeast.\n// 0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2\n\n## Generate Constraint-3:\nEach loaf of Bread 1-4 requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively. The bakery has a daily supply of 15 kg of sugar.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively, and the bakery has a daily supply of 100 kg of flour. Each loaf also requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively, with a daily supply of 2 kg of yeast. Additionally, each loaf requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively, and the bakery has a daily supply of 15 kg of sugar. Please help the bakery determine the optimal number of each type of bread to produce daily to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of Bread 3 produced daily\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4)\n\n# Add constraints\n## Each loaf of Bread 1-4 requires different amounts of flour, and the bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100)\n## Each loaf of Bread 1-4 requires different amounts of yeast, and the bakery has a daily supply of 2 kg of yeast.\nmodel.addCons(0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2)\n## Each loaf of Bread 1-4 requires different amounts of sugar, and the bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(B4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product.\n// {\"quantity of Bread 1 produced daily\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"B2\", \"range\": \"0 <= B2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"B3\", \"range\": \"0 <= B3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Pastry 1 produced daily\": \"P1\", \"range\": \"0 <= P1 <= 500\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for Bread 1, Bread 2, Bread 3, and Pastry 1 are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 1.20*P1\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour, 150 kg of sugar, and 50 kg of yeast. Each unit of Bread 1 requires 0.5 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast; Bread 2 requires 0.6 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast; Bread 3 requires 0.4 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast; Pastry 1 requires 0.3 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n// 0.5*B1 + 0.6*B2 + 0.4*B3 + 0.3*P1 <= 500 (Flour constraint)\n// 0.1*B1 + 0.2*B2 + 0.15*B3 + 0.2*P1 <= 150 (Sugar constraint)\n// 0.05*B1 + 0.1*B2 + 0.05*B3 + 0.1*P1 <= 50 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a labor constraint, with a maximum of 800 hours available daily. Each unit of Bread 1 requires 0.5 hours of labor, Bread 2 requires 0.7 hours, Bread 3 requires 0.6 hours, and Pastry 1 requires 1 hour.\n// 0.5*B1 + 0.7*B2 + 0.6*B3 + 1*P1 <= 800 (Labor constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread 1 daily to meet contractual obligations.\n// B1 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product. The profit margins for Bread 1, Bread 2, Bread 3, and Pastry 1 are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize its daily profit.\n\nThe bakery has a daily supply of 500 kg of flour, 150 kg of sugar, and 50 kg of yeast. Each unit of Bread 1 requires 0.5 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast; Bread 2 requires 0.6 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast; Bread 3 requires 0.4 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast; Pastry 1 requires 0.3 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast. The bakery also has a labor constraint, with a maximum of 800 hours available daily. Each unit of Bread 1 requires 0.5 hours of labor, Bread 2 requires 0.7 hours, Bread 3 requires 0.6 hours, and Pastry 1 requires 1 hour.\n\nAdditionally, the bakery must produce at least 100 units of Bread 1 daily to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit by determining the optimal daily production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # quantity of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1000) # quantity of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=1000) # quantity of Bread 3 produced daily\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=500) # quantity of Pastry 1 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 1.20*P1)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.5*B1 + 0.6*B2 + 0.4*B3 + 0.3*P1 <= 500)\n## Sugar constraint\nmodel.addCons(0.1*B1 + 0.2*B2 + 0.15*B3 + 0.2*P1 <= 150)\n## Yeast constraint\nmodel.addCons(0.05*B1 + 0.1*B2 + 0.05*B3 + 0.1*P1 <= 50)\n## Labor constraint\nmodel.addCons(0.5*B1 + 0.7*B2 + 0.6*B3 + 1*P1 <= 800)\n## Contractual obligation for Bread 1\nmodel.addCons(B1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Quantity of Pastry 1 produced daily: \", model.getVal(P1))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product.\n// {\"quantity of Bread 1 produced daily\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"B2\", \"range\": \"0 <= B2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"B3\", \"range\": \"0 <= B3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Pastry 1 produced daily\": \"P1\", \"range\": \"0 <= P1 <= 500\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for Bread 1, Bread 2, Bread 3, and Pastry 1 are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 1.20*P1\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour, 150 kg of sugar, and 50 kg of yeast. Each unit of Bread 1 requires 0.5 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast; Bread 2 requires 0.6 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast; Bread 3 requires 0.4 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast; Pastry 1 requires 0.3 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast.\n// 0.5*B1 + 0.6*B2 + 0.4*B3 + 0.3*P1 <= 500 (Flour constraint)\n// 0.1*B1 + 0.2*B2 + 0.15*B3 + 0.2*P1 <= 150 (Sugar constraint)\n// 0.05*B1 + 0.1*B2 + 0.05*B3 + 0.1*P1 <= 50 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a labor constraint, with a maximum of 800 hours available daily. Each unit of Bread 1 requires 0.5 hours of labor, Bread 2 requires 0.7 hours, Bread 3 requires 0.6 hours, and Pastry 1 requires 1 hour.\n// 0.5*B1 + 0.7*B2 + 0.6*B3 + 1*P1 <= 800 (Labor constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread 1 daily to meet contractual obligations.\n// B1 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1). Each product requires different amounts of flour, sugar, and yeast, and has a different profit margin. The bakery needs to determine the optimal daily production quantity for each product. The profit margins for Bread 1, Bread 2, Bread 3, and Pastry 1 are $0.50, $0.75, $0.60, and $1.20 per unit, respectively. The bakery wants to maximize its daily profit.\n\nThe bakery has a daily supply of 500 kg of flour, 150 kg of sugar, and 50 kg of yeast. Each unit of Bread 1 requires 0.5 kg of flour, 0.1 kg of sugar, and 0.05 kg of yeast; Bread 2 requires 0.6 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast; Bread 3 requires 0.4 kg of flour, 0.15 kg of sugar, and 0.05 kg of yeast; Pastry 1 requires 0.3 kg of flour, 0.2 kg of sugar, and 0.1 kg of yeast. The bakery also has a labor constraint, with a maximum of 800 hours available daily. Each unit of Bread 1 requires 0.5 hours of labor, Bread 2 requires 0.7 hours, Bread 3 requires 0.6 hours, and Pastry 1 requires 1 hour. The bakery must produce at least 100 units of Bread 1 daily to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit by determining the optimal production quantity for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # quantity of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1000) # quantity of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=1000) # quantity of Bread 3 produced daily\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=500) # quantity of Pastry 1 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 1.20*P1)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.5*B1 + 0.6*B2 + 0.4*B3 + 0.3*P1 <= 500)\n## Sugar constraint\nmodel.addCons(0.1*B1 + 0.2*B2 + 0.15*B3 + 0.2*P1 <= 150)\n## Yeast constraint\nmodel.addCons(0.05*B1 + 0.1*B2 + 0.05*B3 + 0.1*P1 <= 50)\n## Labor constraint\nmodel.addCons(0.5*B1 + 0.7*B2 + 0.6*B3 + 1*P1 <= 800)\n## Contractual obligation for Bread 1\nmodel.addCons(B1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Quantity of Pastry 1 produced daily: \", model.getVal(P1))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints.\n// {\"quantity of Bread A produced daily\": \"qA\", \"range\": \"0 <= qA <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread B produced daily\": \"qB\", \"range\": \"0 <= qB <= 800\", \"type\": \"integer\"}\n// {\"quantity of Bread C produced daily\": \"qC\", \"range\": \"0 <= qC <= 500\", \"type\": \"integer\"}\n// {\"quantity of Pastry D produced daily\": \"qD\", \"range\": \"0 <= qD <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery aims to maximize the total daily profit.\n// Objective Function: Maximize: 2*qA + 3*qB + 4*qC + 5*qD\n\n## Generate Constraint-1:\nThe bakery has a total of 2000 kg of flour available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively.\n// qA + 2*qB + 3*qC + qD <= 2000\n\n## Generate Constraint-2:\nThe bakery has a total of 1000 hours of labor available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively.\n// 0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\n// qA >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints. The profit per unit of each product and the resources required for each unit are given in the following Table.\n\n| Product | Profit per Unit | Flour Required (kg) | Labor Required (hours) |\n|---------|-----------------|---------------------|------------------------|\n| Bread A | $2              | 1                   | 0.5                    |\n| Bread B | $3              | 2                   | 1                      |\n| Bread C | $4              | 3                   | 1.5                    |\n| Pastry D| $5              | 1                   | 0.5                    |\n\nThe bakery has a total of 2000 kg of flour available daily. The bakery also has a total of 1000 hours of labor available daily. The bakery must produce at least 100 units of Bread A daily to meet contractual obligations. The bakery aims to maximize the total daily profit. Please help the bakery determine the optimal daily production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nqA = model.addVar(vtype=\"INTEGER\", name=\"qA\", lb=0, ub=1000) # quantity of Bread A produced daily\nqB = model.addVar(vtype=\"INTEGER\", name=\"qB\", lb=0, ub=800) # quantity of Bread B produced daily\nqC = model.addVar(vtype=\"INTEGER\", name=\"qC\", lb=0, ub=500) # quantity of Bread C produced daily\nqD = model.addVar(vtype=\"INTEGER\", name=\"qD\", lb=0, ub=300) # quantity of Pastry D produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*qA + 3*qB + 4*qC + 5*qD)\n\n# Add constraints\n## The bakery has a total of 2000 kg of flour available daily.\nmodel.addCons(qA + 2*qB + 3*qC + qD <= 2000)\n## The bakery has a total of 1000 hours of labor available daily.\nmodel.addCons(0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000)\n## The bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\nmodel.addCons(qA >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread A produced daily: \", model.getVal(qA))\n    print(\"Quantity of Bread B produced daily: \", model.getVal(qB))\n    print(\"Quantity of Bread C produced daily: \", model.getVal(qC))\n    print(\"Quantity of Pastry D produced daily: \", model.getVal(qD))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints.\n// {\"quantity of Bread A produced daily\": \"qA\", \"range\": \"0 <= qA <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread B produced daily\": \"qB\", \"range\": \"0 <= qB <= 800\", \"type\": \"integer\"}\n// {\"quantity of Bread C produced daily\": \"qC\", \"range\": \"0 <= qC <= 500\", \"type\": \"integer\"}\n// {\"quantity of Pastry D produced daily\": \"qD\", \"range\": \"0 <= qD <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery aims to maximize the total daily profit.\n// Objective Function: Maximize: 2*qA + 3*qB + 4*qC + 5*qD\n\n## Generate Constraint-1:\nThe bakery has a total of 2000 kg of flour available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively.\n// qA + 2*qB + 3*qC + qD <= 2000\n\n## Generate Constraint-2:\nThe bakery has a total of 1000 hours of labor available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively.\n// 0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\n// qA >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints. The profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery has a total of 2000 kg of flour available daily, with each unit of Bread A, Bread B, Bread C, and Pastry D requiring 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively. The bakery also has a total of 1000 hours of labor available daily, with each unit of Bread A, Bread B, Bread C, and Pastry D requiring 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively. The bakery must produce at least 100 units of Bread A daily to meet contractual obligations. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nqA = model.addVar(vtype=\"INTEGER\", name=\"qA\", lb=0, ub=1000) # quantity of Bread A produced daily\nqB = model.addVar(vtype=\"INTEGER\", name=\"qB\", lb=0, ub=800) # quantity of Bread B produced daily\nqC = model.addVar(vtype=\"INTEGER\", name=\"qC\", lb=0, ub=500) # quantity of Bread C produced daily\nqD = model.addVar(vtype=\"INTEGER\", name=\"qD\", lb=0, ub=300) # quantity of Pastry D produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*qA + 3*qB + 4*qC + 5*qD)\n\n# Add constraints\n## The bakery has a total of 2000 kg of flour available daily.\nmodel.addCons(qA + 2*qB + 3*qC + qD <= 2000)\n## The bakery has a total of 1000 hours of labor available daily.\nmodel.addCons(0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000)\n## The bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\nmodel.addCons(qA >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread A produced daily: \", model.getVal(qA))\n    print(\"Quantity of Bread B produced daily: \", model.getVal(qB))\n    print(\"Quantity of Bread C produced daily: \", model.getVal(qC))\n    print(\"Quantity of Pastry D produced daily: \", model.getVal(qD))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"q1\", \"range\": \"0 <= q1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"q2\", \"range\": \"0 <= q2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"q3\", \"range\": \"0 <= q3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"q4\", \"range\": \"0 <= q4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost.\n// Objective Function: Minimize: 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4\n\n## Generate Constraint-1:\nThe bakery has a total of 20 hours of labor available daily. Producing Bread 1-4 requires 0.01, 0.02, 0.015, and 0.025 hours of labor per loaf, respectively.\n// 0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\n// q1 >= 500\n\n## Generate Constraint-3:\nThe total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\n// q2 + q3 <= 800",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread. The cost of producing each type of bread is given in the following Table.\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a total of 20 hours of labor available daily. Producing each type of bread requires a certain amount of labor per loaf, as shown in the following Table.\n\n| Bread Type | Labor per Loaf |\n|------------|----------------|\n| Bread 1    | 0.01 hours     |\n| Bread 2    | 0.02 hours     |\n| Bread 3    | 0.015 hours    |\n| Bread 4    | 0.025 hours    |\n\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand. The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\nPlease help the bakery to minimize the total daily production cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0, ub=1000) # daily production quantity of Bread 1\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0, ub=1000) # daily production quantity of Bread 2\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0, ub=1000) # daily production quantity of Bread 3\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0, ub=1000) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4)\n\n# Add constraints\n## The bakery has a total of 20 hours of labor available daily.\nmodel.addCons(0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20)\n## The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\nmodel.addCons(q1 >= 500)\n## The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\nmodel.addCons(q2 + q3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(q1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(q2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(q3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(q4))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"q1\", \"range\": \"0 <= q1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"q2\", \"range\": \"0 <= q2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"q3\", \"range\": \"0 <= q3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"q4\", \"range\": \"0 <= q4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost.\n// Objective Function: Minimize: 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4\n\n## Generate Constraint-1:\nThe bakery has a total of 20 hours of labor available daily. Producing Bread 1-4 requires 0.01, 0.02, 0.015, and 0.025 hours of labor per loaf, respectively.\n// 0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\n// q1 >= 500\n\n## Generate Constraint-3:\nThe total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\n// q2 + q3 <= 800",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost. The bakery has a total of 20 hours of labor available daily. Producing Bread 1-4 requires 0.01, 0.02, 0.015, and 0.025 hours of labor per loaf, respectively. The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand. The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves. Please help the bakery determine the optimal daily production quantity for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0, ub=1000) # daily production quantity of Bread 1\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0, ub=1000) # daily production quantity of Bread 2\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0, ub=1000) # daily production quantity of Bread 3\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0, ub=1000) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4)\n\n# Add constraints\n## The bakery has a total of 20 hours of labor available daily.\nmodel.addCons(0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20)\n## The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\nmodel.addCons(q1 >= 500)\n## The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\nmodel.addCons(q2 + q3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(q1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(q2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(q3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(q4))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour, respectively.\n// 0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 10 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.01 kg, 0.02 kg, and 0.03 kg of yeast, respectively.\n// 0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints. The profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The following table shows the ingredient requirements per loaf of each type of bread.\n\n| Bread Type   | Profit per Loaf | Flour (kg) | Yeast (kg) | Water (liters) |\n|--------------|-----------------|------------|------------|----------------|\n| Wheat        | $1.50           | 0.2        | 0.01       | 0.5            |\n| Rye          | $2.00           | 0.3        | 0.02       | 0.6            |\n| Sourdough    | $2.50           | 0.4        | 0.03       | 0.7            |\n\nThe bakery has a daily supply of 100 kg of flour, 10 kg of yeast, and 500 liters of water. Please help the bakery to maximize the total daily profit from bread sales while ensuring that the production does not exceed the available supplies of flour, yeast, and water.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100)\n## The bakery has a daily supply of 10 kg of yeast.\nmodel.addCons(0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10)\n## The bakery has a daily supply of 500 liters of water.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour, respectively.\n// 0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 10 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.01 kg, 0.02 kg, and 0.03 kg of yeast, respectively.\n// 0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales.\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour, respectively.\nThe bakery has a daily supply of 10 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.01 kg, 0.02 kg, and 0.03 kg of yeast, respectively.\nThe bakery has a daily supply of 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively.\nPlease help the bakery determine the daily production quantities of each type of bread to maximize profit while meeting these ingredient constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100)\n## The bakery has a daily supply of 10 kg of yeast.\nmodel.addCons(0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10)\n## The bakery has a daily supply of 500 liters of water.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily.\n// {\"number of Whole Wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively.\n// 1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 loaves of each type of bread.\n// Whole_Wheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// White >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\n// Whole_Wheat + Rye + Sourdough + White <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily. The selling price per loaf for each type of bread is given in the following Table.\n\n| Bread Type   | Selling Price per Loaf |\n|--------------|------------------------|\n| Whole Wheat  | $3.50                  |\n| Rye          | $4.00                  |\n| Sourdough    | $4.50                  |\n| White        | $3.00                  |\n\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively. The bakery has a daily demand for at least 100 loaves of each type of bread. The bakery also has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500)\n## The bakery has a daily demand for at least 100 loaves of each type of bread.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(White >= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily.\n// {\"number of Whole Wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively.\n// 1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 loaves of each type of bread.\n// Whole_Wheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// White >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\n// Whole_Wheat + Rye + Sourdough + White <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales. The bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively. The bakery has a daily demand for at least 100 loaves of each type of bread. The bakery also has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500)\n## The bakery has a daily demand for at least 100 loaves of each type of bread.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(White >= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Whole Grain bread\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available each day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively. The total daily supply of flour is 150 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value.\n// Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery has a total of 100 hours of labor available each day, and each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery also has a limited supply of flour, with each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requiring 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively, and a total daily supply of flour is 150 pounds. The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n\n| Bread Type       | Profit per Loaf | Labor per Loaf | Flour per Loaf |\n|-------------------|-----------------|----------------|----------------|\n| Wheat             | $1.50           | 0.1 hours      | 0.5 pounds     |\n| Rye               | $2.00           | 0.2 hours      | 0.6 pounds     |\n| Sourdough         | $2.50           | 0.3 hours      | 0.7 pounds     |\n| Whole Grain       | $3.00           | 0.4 hours      | 0.8 pounds     |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available each day.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100)\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150)\n## The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread.\nmodel.addCons(Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1460,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Whole Grain bread\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available each day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively. The total daily supply of flour is 150 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value.\n// Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery has a total of 100 hours of labor available each day, and each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery also has a limited supply of flour, with each loaf of bread requiring 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively, and a total daily supply of 150 pounds. Additionally, the bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available each day.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100)\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150)\n## The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread.\nmodel.addCons(Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake. The cost per unit of each ingredient is given in the following Table.\n\n| Ingredient | Cost per Unit |\n|------------|---------------|\n| Flour      | $0.50         |\n| Sugar      | $0.25         |\n| Eggs       | $1.00         |\n| Butter     | $2.00         |\n\nThe bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour. The cake must contain no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. Please help the bakery determine the optimal quantities of Flour, Sugar, and Butter to use in the recipe.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake. The cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour. The cake must contain no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. Please help the bakery determine the optimal quantities of Flour, Sugar, and Butter to minimize the total cost of the ingredients while meeting these requirements.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 707,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery wants to maximize the total daily revenue from selling these breads.\n// Objective Function: Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5, 0.7, 0.6, and 1 hour of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $1, $1.5, $2, and $3, respectively.\n// x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\n// x1 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price and ingredient cost per loaf for each type of bread are given in the following Table.\n\n| Bread Type     | Selling Price | Ingredient Cost | Labor Time per Loaf |\n|----------------|---------------|-----------------|---------------------|\n| Whole Wheat    | $3            | $1              | 0.5 hours           |\n| Rye            | $4            | $1.5            | 0.7 hours           |\n| Sourdough      | $5            | $2              | 0.6 hours           |\n| Brioche        | $6            | $3              | 1 hour              |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a daily budget of $200 for ingredients. The bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\nPlease help the bakery to maximize the total daily revenue from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100)\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200)\n## The bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery wants to maximize the total daily revenue from selling these breads.\n// Objective Function: Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5, 0.7, 0.6, and 1 hour of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $1, $1.5, $2, and $3, respectively.\n// x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\n// x1 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.5, 0.7, 0.6, and 1 hour of labor, respectively. The bakery also has a daily budget of $200 for ingredients, with the cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $1, $1.5, $2, and $3, respectively. Additionally, the bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement. Please help the bakery maximize the total daily revenue from selling these breads.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100)\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200)\n## The bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of French Baguette\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\n// x1 >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type         | Profit per Loaf |\n|--------------------|-----------------|\n| Whole Wheat        | $1.50           |\n| Rye                | $1.75           |\n| Sourdough          | $2.00           |\n| French Baguette    | $2.25           |\n\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery also has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively. The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of French Baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100)\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\nmodel.addCons(x1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of French Baguette: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of French Baguette\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\n// x1 >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales. The bakery has a total of 100 hours of labor available per day, with each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requiring 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery also has a daily flour supply limit of 500 kg, with each loaf of Whole Wheat, Rye, Sourdough, and French Baguette using 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively. Additionally, the bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of French Baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100)\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\nmodel.addCons(x1 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of French Baguette: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit.\n// {\"number of Wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Whole Grain loaves\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Wheat, Rye, Sourdough, and Whole Grain requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\n// Wheat + Rye + Sourdough + Whole_Grain <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\n// Whole_Grain >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit. The profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery has a total of 100 hours of labor available daily, with each loaf of Wheat, Rye, Sourdough, and Whole Grain requiring 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily. Additionally, the bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of Whole Grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 500)\n## The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\nmodel.addCons(Whole_Grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Whole Grain loaves: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit.\n// {\"number of Wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Whole Grain loaves\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Wheat, Rye, Sourdough, and Whole Grain requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\n// Wheat + Rye + Sourdough + Whole_Grain <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\n// Whole_Grain >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales. The bakery has a total of 100 hours of labor available daily, with each loaf of Wheat, Rye, Sourdough, and Whole Grain requiring 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery also has a limited oven capacity, which can bake a maximum of 500 loaves daily. Additionally, the bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement. Please help the bakery determine the number of loaves of each type of bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of Whole Grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 500)\n## The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\nmodel.addCons(Whole_Grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Whole Grain loaves: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Ciabatta bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// x1 >= 200",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $1.50           |\n| Rye            | $1.75           |\n| Sourdough      | $2.00           |\n| Ciabatta       | $2.25           |\n\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 1000 loaves per day. Additionally, the bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # daily production quantity of Ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a daily limit of 500 kilograms of flour.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500)\n## The bakery can produce a maximum of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Ciabatta bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Ciabatta bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// x1 >= 200",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 1000 loaves per day. The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # daily production quantity of Ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a daily limit of 500 kilograms of flour.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500)\n## The bakery can produce a maximum of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Ciabatta bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints.\n// {\"number of Wheat bread produced daily\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced daily\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced daily\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 kg, 0.4 kg, and 0.6 kg of flour, respectively.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 5 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively.\n// 0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5\n\n## Generate Constraint-3:\nThe bakery has a daily baking time limit of 8 hours. Each loaf of Wheat, Rye, and Sourdough bread requires 10 minutes, 15 minutes, and 20 minutes of baking time, respectively.\n// (10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The following table shows the requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Yeast Requirement (kg) | Baking Time (minutes) |\n|------------|-----------------|------------------------|------------------------|-----------------------|\n| Wheat      | $2              | 0.5                    | 0.02                   | 10                    |\n| Rye        | $3              | 0.4                    | 0.03                   | 15                    |\n| Sourdough  | $4              | 0.6                    | 0.04                   | 20                    |\n\nThe bakery has a daily supply of 100 kg of flour and 5 kg of yeast. The bakery also has a daily baking time limit of 8 hours. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat bread produced daily\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye bread produced daily\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough bread produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100)\n## The bakery has a daily supply of 5 kg of yeast.\nmodel.addCons(0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5)\n## The bakery has a daily baking time limit of 8 hours.\nmodel.addCons((10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat bread produced daily: \", model.getVal(Wheat))\n    print(\"Number of Rye bread produced daily: \", model.getVal(Rye))\n    print(\"Number of Sourdough bread produced daily: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints.\n// {\"number of Wheat bread produced daily\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced daily\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced daily\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 kg, 0.4 kg, and 0.6 kg of flour, respectively.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 5 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively.\n// 0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5\n\n## Generate Constraint-3:\nThe bakery has a daily baking time limit of 8 hours. Each loaf of Wheat, Rye, and Sourdough bread requires 10 minutes, 15 minutes, and 20 minutes of baking time, respectively.\n// (10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery has a daily supply of 100 kg of flour, with each loaf of Wheat, Rye, and Sourdough bread requiring 0.5 kg, 0.4 kg, and 0.6 kg of flour, respectively. The bakery also has a daily supply of 5 kg of yeast, with each loaf of Wheat, Rye, and Sourdough bread requiring 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively. Additionally, the bakery has a daily baking time limit of 8 hours, with each loaf of Wheat, Rye, and Sourdough bread requiring 10 minutes, 15 minutes, and 20 minutes of baking time, respectively. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat bread produced daily\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye bread produced daily\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough bread produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100)\n## The bakery has a daily supply of 5 kg of yeast.\nmodel.addCons(0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5)\n## The bakery has a daily baking time limit of 8 hours.\nmodel.addCons((10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat bread produced daily: \", model.getVal(Wheat))\n    print(\"Number of Rye bread produced daily: \", model.getVal(Rye))\n    print(\"Number of Sourdough bread produced daily: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units produced daily\": \"Total_Units\", \"range\": \"Total_Units = Smartphones + Tablets + Laptops\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. The company aims to maximize its daily profit from the production of these devices.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 units per day.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day.\n// Smartphones >= 100\n// Tablets >= 150\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe total production of laptops and tablets should not exceed twice the production of smartphones.\n// Laptops + Tablets <= 2*Smartphones",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand. The profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. The company aims to maximize its daily profit from the production of these devices.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $50             |\n| Tablets      | $70             |\n| Laptops      | $100            |\n\nThe production capacity of the factory is limited to 500 units per day. The market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day. Additionally, the total production of laptops and tablets should not exceed twice the production of smartphones.\n\nPlease help the company determine the optimal number of smartphones, tablets, and laptops to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day.\nmodel.addCons(Smartphones >= 100)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 50)\n## The total production of laptops and tablets should not exceed twice the production of smartphones.\nmodel.addCons(Laptops + Tablets <= 2*Smartphones)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units produced daily\": \"Total_Units\", \"range\": \"Total_Units = Smartphones + Tablets + Laptops\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. The company aims to maximize its daily profit from the production of these devices.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 units per day.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day.\n// Smartphones >= 100\n// Tablets >= 150\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe total production of laptops and tablets should not exceed twice the production of smartphones.\n// Laptops + Tablets <= 2*Smartphones",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand. The profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. The company aims to maximize its daily profit from the production of these devices. The production capacity of the factory is limited to 500 units per day. The market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day. Additionally, the total production of laptops and tablets should not exceed twice the production of smartphones. Please help the company determine the optimal number of smartphones, tablets, and laptops to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day, for tablets is at least 150 units per day, and for laptops is at least 50 units per day.\nmodel.addCons(Smartphones >= 100)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 50)\n## The total production of laptops and tablets should not exceed twice the production of smartphones.\nmodel.addCons(Laptops + Tablets <= 2*Smartphones)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production capacity limit\": \"Capacity\", \"range\": \"Capacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 500 units per day.\n// A + B + C <= Capacity\n// Capacity = 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units.\n// B >= 50\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe total production capacity of the factory is limited to 500 units per day. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units. \n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nCapacity = 500 # production capacity limit\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 500 units per day.\nmodel.addCons(A + B + C <= Capacity)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production capacity limit\": \"Capacity\", \"range\": \"Capacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 500 units per day.\n// A + B + C <= Capacity\n// Capacity = 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units.\n// B >= 50\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total production capacity of the factory is limited to 500 units per day. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nCapacity = 500 # production capacity limit\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 500 units per day.\nmodel.addCons(A + B + C <= Capacity)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 624,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat bread is $1.50, rye bread is $2.00, and sourdough bread is $2.50. The bakery aims to minimize the total daily production cost while meeting the market demand.\n// Objective Function: Minimize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 300 loaves of bread.\n// Wheat + Rye + Sourdough <= 300\n\n## Generate Constraint-2:\nThe market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day.\n// Wheat >= 100\n// Rye >= 50\n// Sourdough >= 75\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day.\n// Wheat <= 200\n// Rye <= 150",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and market demand. The cost of producing each loaf of wheat bread is $1.50, rye bread is $2.00, and sourdough bread is $2.50. The bakery aims to minimize the total daily production cost while meeting the market demand.\n\nThe bakery has a daily capacity of 300 loaves of bread. The market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day. The bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day.\n\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce daily to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily capacity of 300 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough <= 300)\n## The market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 75)\n## The bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day.\nmodel.addCons(Wheat <= 200)\nmodel.addCons(Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat bread is $1.50, rye bread is $2.00, and sourdough bread is $2.50. The bakery aims to minimize the total daily production cost while meeting the market demand.\n// Objective Function: Minimize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 300 loaves of bread.\n// Wheat + Rye + Sourdough <= 300\n\n## Generate Constraint-2:\nThe market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day.\n// Wheat >= 100\n// Rye >= 50\n// Sourdough >= 75\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day.\n// Wheat <= 200\n// Rye <= 150",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and market demand. The cost of producing each loaf of wheat bread is $1.50, rye bread is $2.00, and sourdough bread is $2.50. The bakery aims to minimize the total daily production cost while meeting the market demand. The bakery has a daily capacity of 300 loaves of bread. The market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day. The bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day. Please help the bakery determine the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily capacity of 300 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough <= 300)\n## The market demand for wheat bread is at least 100 loaves per day, for rye bread is at least 50 loaves per day, and for sourdough bread is at least 75 loaves per day.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 75)\n## The bakery has a limited supply of ingredients that can only produce a maximum of 200 loaves of wheat bread and 150 loaves of rye bread per day.\nmodel.addCons(Wheat <= 200)\nmodel.addCons(Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its central hub to three regional depots.\n// {\"number of small packages delivered\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages delivered\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large packages delivered\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 1\": \"Depot1\", \"range\": \"Depot1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 2\": \"Depot2\", \"range\": \"Depot2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 3\": \"Depot3\", \"range\": \"Depot3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one small package is $5, one medium package is $10, and one large package is $15. The company aims to minimize the total delivery cost while meeting the demand at each depot.\n// Objective Function: Minimize: 5*Small + 10*Medium + 15*Large\n\n## Generate Constraint-1:\nThe total number of packages delivered to each depot must meet the demand. Depot 1 requires 100 packages, Depot 2 requires 150 packages, and Depot 3 requires 200 packages.\n// Small + Medium + Large = Depot1\n// Small + Medium + Large = Depot2\n// Small + Medium + Large = Depot3\n// Depot1 = 100\n// Depot2 = 150\n// Depot3 = 200\n\n## Generate Constraint-2:\nThe company has a limited fleet capacity. The total number of packages that can be delivered daily is capped at 400.\n// Small + Medium + Large <= 400\n\n## Generate Constraint-3:\nThe company must ensure that at least 25% of the packages delivered are small packages.\n// Small >= 0.25 * (Small + Medium + Large)",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its central hub to three regional depots. The cost of delivering one small package is $5, one medium package is $10, and one large package is $15. The company aims to minimize the total delivery cost while meeting the demand at each depot.\n\n| Package Type | Cost per Delivery |\n|--------------|-------------------|\n| Small        | $5                |\n| Medium       | $10               |\n| Large        | $15               |\n\nThe total number of packages delivered to each depot must meet the demand. Depot 1 requires 100 packages, Depot 2 requires 150 packages, and Depot 3 requires 200 packages. The company has a limited fleet capacity, and the total number of packages that can be delivered daily is capped at 400. Additionally, the company must ensure that at least 25% of the packages delivered are small packages.\n\nPlease help the company determine the optimal number of small, medium, and large packages to deliver to minimize the total delivery cost while satisfying all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of package delivered\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small packages delivered\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium packages delivered\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large packages delivered\n## The number of packages delivered to each depot\nDepot1 = model.addVar(vtype=\"INTEGER\", name=\"Depot1\", lb=0) # number of packages delivered to Depot 1\nDepot2 = model.addVar(vtype=\"INTEGER\", name=\"Depot2\", lb=0) # number of packages delivered to Depot 2\nDepot3 = model.addVar(vtype=\"INTEGER\", name=\"Depot3\", lb=0) # number of packages delivered to Depot 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Small + 10*Medium + 15*Large)\n\n# Add constraints\n## The total number of packages delivered to each depot must meet the demand.\nmodel.addCons(Small + Medium + Large == Depot1)\nmodel.addCons(Small + Medium + Large == Depot2)\nmodel.addCons(Small + Medium + Large == Depot3)\nmodel.addCons(Depot1 == 100)\nmodel.addCons(Depot2 == 150)\nmodel.addCons(Depot3 == 200)\n## The company has a limited fleet capacity.\nmodel.addCons(Small + Medium + Large <= 400)\n## The company must ensure that at least 25% of the packages delivered are small packages.\nmodel.addCons(Small >= 0.25 * (Small + Medium + Large))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages delivered: \", model.getVal(Small))\n    print(\"Number of medium packages delivered: \", model.getVal(Medium))\n    print(\"Number of large packages delivered: \", model.getVal(Large))\n    print(\"Number of packages delivered to Depot 1: \", model.getVal(Depot1))\n    print(\"Number of packages delivered to Depot 2: \", model.getVal(Depot2))\n    print(\"Number of packages delivered to Depot 3: \", model.getVal(Depot3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its central hub to three regional depots.\n// {\"number of small packages delivered\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages delivered\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large packages delivered\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 1\": \"Depot1\", \"range\": \"Depot1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 2\": \"Depot2\", \"range\": \"Depot2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages delivered to Depot 3\": \"Depot3\", \"range\": \"Depot3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one small package is $5, one medium package is $10, and one large package is $15. The company aims to minimize the total delivery cost while meeting the demand at each depot.\n// Objective Function: Minimize: 5*Small + 10*Medium + 15*Large\n\n## Generate Constraint-1:\nThe total number of packages delivered to each depot must meet the demand. Depot 1 requires 100 packages, Depot 2 requires 150 packages, and Depot 3 requires 200 packages.\n// Small + Medium + Large = Depot1\n// Small + Medium + Large = Depot2\n// Small + Medium + Large = Depot3\n// Depot1 = 100\n// Depot2 = 150\n// Depot3 = 200\n\n## Generate Constraint-2:\nThe company has a limited fleet capacity. The total number of packages that can be delivered daily is capped at 400.\n// Small + Medium + Large <= 400\n\n## Generate Constraint-3:\nThe company must ensure that at least 25% of the packages delivered are small packages.\n// Small >= 0.25 * (Small + Medium + Large)",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its central hub to three regional depots. The cost of delivering one small package is $5, one medium package is $10, and one large package is $15. The company aims to minimize the total delivery cost while meeting the demand at each depot. Depot 1 requires 100 packages, Depot 2 requires 150 packages, and Depot 3 requires 200 packages. The company has a limited fleet capacity, with the total number of packages that can be delivered daily capped at 400. Additionally, the company must ensure that at least 25% of the packages delivered are small packages. Please help the company determine the optimal number of small, medium, and large packages to deliver to minimize the total delivery cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of package delivered\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small packages delivered\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium packages delivered\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large packages delivered\n## The number of packages delivered to each depot\nDepot1 = model.addVar(vtype=\"INTEGER\", name=\"Depot1\", lb=0) # number of packages delivered to Depot 1\nDepot2 = model.addVar(vtype=\"INTEGER\", name=\"Depot2\", lb=0) # number of packages delivered to Depot 2\nDepot3 = model.addVar(vtype=\"INTEGER\", name=\"Depot3\", lb=0) # number of packages delivered to Depot 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Small + 10*Medium + 15*Large)\n\n# Add constraints\n## The total number of packages delivered to each depot must meet the demand.\nmodel.addCons(Small + Medium + Large == Depot1)\nmodel.addCons(Small + Medium + Large == Depot2)\nmodel.addCons(Small + Medium + Large == Depot3)\nmodel.addCons(Depot1 == 100)\nmodel.addCons(Depot2 == 150)\nmodel.addCons(Depot3 == 200)\n## The company has a limited fleet capacity.\nmodel.addCons(Small + Medium + Large <= 400)\n## The company must ensure that at least 25% of the packages delivered are small packages.\nmodel.addCons(Small >= 0.25 * (Small + Medium + Large))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages delivered: \", model.getVal(Small))\n    print(\"Number of medium packages delivered: \", model.getVal(Medium))\n    print(\"Number of large packages delivered: \", model.getVal(Large))\n    print(\"Number of packages delivered to Depot 1: \", model.getVal(Depot1))\n    print(\"Number of packages delivered to Depot 2: \", model.getVal(Depot2))\n    print(\"Number of packages delivered to Depot 3: \", model.getVal(Depot3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company has two delivery trucks and needs to decide how many of each type of package to load onto each truck to minimize the total delivery time.\n// {\"number of small packages on Truck 1\": \"S_T1\", \"range\": \"S_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages on Truck 1\": \"M_T1\", \"range\": \"M_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of large packages on Truck 1\": \"L_T1\", \"range\": \"L_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of small packages on Truck 2\": \"S_T2\", \"range\": \"S_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages on Truck 2\": \"M_T2\", \"range\": \"M_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of large packages on Truck 2\": \"L_T2\", \"range\": \"L_T2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery time for small, medium, and large packages is 10 minutes, 20 minutes, and 30 minutes per package, respectively. The company aims to minimize the total delivery time for all packages on both trucks.\n// Objective Function: Minimize: 10*(S_T1 + S_T2) + 20*(M_T1 + M_T2) + 30*(L_T1 + L_T2)\n\n## Generate Constraint-1:\nEach truck has a maximum capacity of 100 packages in total.\n// S_T1 + M_T1 + L_T1 <= 100\n// S_T2 + M_T2 + L_T2 <= 100\n\n## Generate Constraint-2:\nThe company has a total of 50 small, 40 medium, and 30 large packages to deliver.\n// S_T1 + S_T2 == 50\n// M_T1 + M_T2 == 40\n// L_T1 + L_T2 == 30\n\n## Generate Constraint-3:\nThe weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg. The small, medium, and large packages weigh 5 kg, 10 kg, and 15 kg, respectively.\n// 5*S_T1 + 10*M_T1 + 15*L_T1 <= 1500\n// 5*S_T2 + 10*M_T2 + 15*L_T2 <= 1500",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company has two delivery trucks and needs to decide how many of each type of package to load onto each truck to minimize the total delivery time. The delivery time for small, medium, and large packages is 10 minutes, 20 minutes, and 30 minutes per package, respectively. The company aims to minimize the total delivery time for all packages on both trucks.\n\n| Package Type | Delivery Time per Package | Weight per Package |\n|--------------|---------------------------|--------------------|\n| Small        | 10 minutes                 | 5 kg               |\n| Medium       | 20 minutes                 | 10 kg              |\n| Large        | 30 minutes                 | 15 kg              |\n\nEach truck has a maximum capacity of 100 packages in total. The company has a total of 50 small, 40 medium, and 30 large packages to deliver. The weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg.\n\nPlease help the company determine the optimal number of small, medium, and large packages to load onto each truck (S_T1, M_T1, L_T1, S_T2, M_T2, L_T2) to minimize the total delivery time while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of package on each truck\nS_T1 = model.addVar(vtype=\"INTEGER\", name=\"S_T1\", lb=0) # number of small packages on Truck 1\nM_T1 = model.addVar(vtype=\"INTEGER\", name=\"M_T1\", lb=0) # number of medium packages on Truck 1\nL_T1 = model.addVar(vtype=\"INTEGER\", name=\"L_T1\", lb=0) # number of large packages on Truck 1\nS_T2 = model.addVar(vtype=\"INTEGER\", name=\"S_T2\", lb=0) # number of small packages on Truck 2\nM_T2 = model.addVar(vtype=\"INTEGER\", name=\"M_T2\", lb=0) # number of medium packages on Truck 2\nL_T2 = model.addVar(vtype=\"INTEGER\", name=\"L_T2\", lb=0) # number of large packages on Truck 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*(S_T1 + S_T2) + 20*(M_T1 + M_T2) + 30*(L_T1 + L_T2))\n\n# Add constraints\n## Each truck has a maximum capacity of 100 packages in total.\nmodel.addCons(S_T1 + M_T1 + L_T1 <= 100)\nmodel.addCons(S_T2 + M_T2 + L_T2 <= 100)\n## The company has a total of 50 small, 40 medium, and 30 large packages to deliver.\nmodel.addCons(S_T1 + S_T2 == 50)\nmodel.addCons(M_T1 + M_T2 == 40)\nmodel.addCons(L_T1 + L_T2 == 30)\n## The weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg.\nmodel.addCons(5*S_T1 + 10*M_T1 + 15*L_T1 <= 1500)\nmodel.addCons(5*S_T2 + 10*M_T2 + 15*L_T2 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages on Truck 1: \", model.getVal(S_T1))\n    print(\"Number of medium packages on Truck 1: \", model.getVal(M_T1))\n    print(\"Number of large packages on Truck 1: \", model.getVal(L_T1))\n    print(\"Number of small packages on Truck 2: \", model.getVal(S_T2))\n    print(\"Number of medium packages on Truck 2: \", model.getVal(M_T2))\n    print(\"Number of large packages on Truck 2: \", model.getVal(L_T2))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company has two delivery trucks and needs to decide how many of each type of package to load onto each truck to minimize the total delivery time.\n// {\"number of small packages on Truck 1\": \"S_T1\", \"range\": \"S_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages on Truck 1\": \"M_T1\", \"range\": \"M_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of large packages on Truck 1\": \"L_T1\", \"range\": \"L_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of small packages on Truck 2\": \"S_T2\", \"range\": \"S_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages on Truck 2\": \"M_T2\", \"range\": \"M_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of large packages on Truck 2\": \"L_T2\", \"range\": \"L_T2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery time for small, medium, and large packages is 10 minutes, 20 minutes, and 30 minutes per package, respectively. The company aims to minimize the total delivery time for all packages on both trucks.\n// Objective Function: Minimize: 10*(S_T1 + S_T2) + 20*(M_T1 + M_T2) + 30*(L_T1 + L_T2)\n\n## Generate Constraint-1:\nEach truck has a maximum capacity of 100 packages in total.\n// S_T1 + M_T1 + L_T1 <= 100\n// S_T2 + M_T2 + L_T2 <= 100\n\n## Generate Constraint-2:\nThe company has a total of 50 small, 40 medium, and 30 large packages to deliver.\n// S_T1 + S_T2 == 50\n// M_T1 + M_T2 == 40\n// L_T1 + L_T2 == 30\n\n## Generate Constraint-3:\nThe weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg. The small, medium, and large packages weigh 5 kg, 10 kg, and 15 kg, respectively.\n// 5*S_T1 + 10*M_T1 + 15*L_T1 <= 1500\n// 5*S_T2 + 10*M_T2 + 15*L_T2 <= 1500",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company has two delivery trucks and needs to decide how many of each type of package to load onto each truck to minimize the total delivery time. The delivery time for small, medium, and large packages is 10 minutes, 20 minutes, and 30 minutes per package, respectively. Each truck has a maximum capacity of 100 packages in total. The company has a total of 50 small, 40 medium, and 30 large packages to deliver. The weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg. The small, medium, and large packages weigh 5 kg, 10 kg, and 15 kg, respectively.\n\nPlease help the company to minimize the total delivery time for all packages on both trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of package on each truck\nS_T1 = model.addVar(vtype=\"INTEGER\", name=\"S_T1\", lb=0) # number of small packages on Truck 1\nM_T1 = model.addVar(vtype=\"INTEGER\", name=\"M_T1\", lb=0) # number of medium packages on Truck 1\nL_T1 = model.addVar(vtype=\"INTEGER\", name=\"L_T1\", lb=0) # number of large packages on Truck 1\nS_T2 = model.addVar(vtype=\"INTEGER\", name=\"S_T2\", lb=0) # number of small packages on Truck 2\nM_T2 = model.addVar(vtype=\"INTEGER\", name=\"M_T2\", lb=0) # number of medium packages on Truck 2\nL_T2 = model.addVar(vtype=\"INTEGER\", name=\"L_T2\", lb=0) # number of large packages on Truck 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*(S_T1 + S_T2) + 20*(M_T1 + M_T2) + 30*(L_T1 + L_T2))\n\n# Add constraints\n## Each truck has a maximum capacity of 100 packages in total.\nmodel.addCons(S_T1 + M_T1 + L_T1 <= 100)\nmodel.addCons(S_T2 + M_T2 + L_T2 <= 100)\n## The company has a total of 50 small, 40 medium, and 30 large packages to deliver.\nmodel.addCons(S_T1 + S_T2 == 50)\nmodel.addCons(M_T1 + M_T2 == 40)\nmodel.addCons(L_T1 + L_T2 == 30)\n## The weight of the packages must not exceed the weight capacity of each truck, which is 1500 kg.\nmodel.addCons(5*S_T1 + 10*M_T1 + 15*L_T1 <= 1500)\nmodel.addCons(5*S_T2 + 10*M_T2 + 15*L_T2 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages on Truck 1: \", model.getVal(S_T1))\n    print(\"Number of medium packages on Truck 1: \", model.getVal(M_T1))\n    print(\"Number of large packages on Truck 1: \", model.getVal(L_T1))\n    print(\"Number of small packages on Truck 2: \", model.getVal(S_T2))\n    print(\"Number of medium packages on Truck 2: \", model.getVal(M_T2))\n    print(\"Number of large packages on Truck 2: \", model.getVal(L_T2))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. They need to decide how many of each type of pastry to produce daily to maximize their profit while considering the limited resources such as oven time and ingredients.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.70, and each doughnut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.70*Muf + 0.60*Don\n\n## Generate Constraint-1:\nThe bakery has a limited oven time of 8 hours per day. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each doughnut requires 0.15 hours.\n// 0.1*Cro + 0.2*Muf + 0.15*Don <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Each croissant requires 0.05 kg of flour, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg. The total daily supply of flour is 10 kg.\n// 0.05*Cro + 0.1*Muf + 0.08*Don <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\n// Cro >= 50, Muf >= 50, Don >= 50",
        "question": "A bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. They need to decide how many of each type of pastry to produce daily to maximize their profit while considering the limited resources such as oven time and ingredients. The profit from selling each croissant is $0.50, each muffin is $0.70, and each doughnut is $0.60. The bakery has a limited oven time of 8 hours per day. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each doughnut requires 0.15 hours. The bakery also has a limited amount of flour available each day. Each croissant requires 0.05 kg of flour, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg. The total daily supply of flour is 10 kg. Additionally, the bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.70*Muf + 0.60*Don)\n\n# Add constraints\n## The bakery has a limited oven time of 8 hours per day.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don <= 8)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.05*Cro + 0.1*Muf + 0.08*Don <= 10)\n## The bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 50)\nmodel.addCons(Don >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. They need to decide how many of each type of pastry to produce daily to maximize their profit while considering the limited resources such as oven time and ingredients.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.70, and each doughnut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.70*Muf + 0.60*Don\n\n## Generate Constraint-1:\nThe bakery has a limited oven time of 8 hours per day. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each doughnut requires 0.15 hours.\n// 0.1*Cro + 0.2*Muf + 0.15*Don <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Each croissant requires 0.05 kg of flour, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg. The total daily supply of flour is 10 kg.\n// 0.05*Cro + 0.1*Muf + 0.08*Don <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\n// Cro >= 50, Muf >= 50, Don >= 50",
        "question": "A bakery is planning to produce three types of pastries: croissants, muffins, and doughnuts. They need to decide how many of each type of pastry to produce daily to maximize their profit while considering the limited resources such as oven time and ingredients.\nThe profit from selling each croissant is $0.50, each muffin is $0.70, and each doughnut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\nThe bakery has a limited oven time of 8 hours per day. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each doughnut requires 0.15 hours.\nThe bakery has a limited amount of flour available each day. Each croissant requires 0.05 kg of flour, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg. The total daily supply of flour is 10 kg.\nThe bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\nPlease help the bakery determine the optimal number of croissants, muffins, and doughnuts to produce daily to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.70*Muf + 0.60*Don)\n\n# Add constraints\n## The bakery has a limited oven time of 8 hours per day.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don <= 8)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.05*Cro + 0.1*Muf + 0.08*Don <= 10)\n## The bakery must produce at least 50 pastries of each type to meet the minimum order requirements from local cafes.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 50)\nmodel.addCons(Don >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3. The cost of delivering one unit of each product to each center is given in the following Table.\n\n| Product | Center 1 Cost | Center 2 Cost | Center 3 Cost |\n|---------|---------------|---------------|---------------|\n| A       | 5$            | 6$            | 7$            |\n| B       | 8$            | 9$            | 10$           |\n| C       | 11$           | 12$           | 13$           |\n\nThe company aims to minimize the total delivery cost while meeting the demand at each center. The total number of units of product A that can be delivered is limited to 100 units. The total number of units of product B that can be delivered is limited to 150 units. The total number of units of product C that can be delivered is limited to 200 units.\n\nPlease help the company determine the optimal number of units of each product to deliver to each center to minimize the total delivery cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 9,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\nThe total number of units of product A that can be delivered is limited to 100 units. The total number of units of product B that can be delivered is limited to 150 units. The total number of units of product C that can be delivered is limited to 200 units.\nPlease help the company to determine the optimal number of units of each product to deliver to each center to minimize the total delivery cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 9,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of total devices produced\": \"Total_Devices\", \"range\": \"Total_Devices >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 100*Smartphones + 200*Tablets + 300*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 devices per week.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\n// Smartphones >= 150\n// Tablets >= 100\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\n// Smartphones + Tablets + Laptops <= 2 * Laptops",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs. The cost of producing each device is as follows:\n\n| Device     | Production Cost |\n|------------|-----------------|\n| Smartphones| $100            |\n| Tablets    | $200            |\n| Laptops    | $300            |\n\nThe production capacity of the factory is limited to 500 devices per week. The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week. The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\n\nPlease help the company to minimize the total production cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\nTotal_Devices = model.addVar(vtype=\"INTEGER\", name=\"Total_Devices\", lb=0) # total number of devices produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Smartphones + 200*Tablets + 300*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 devices per week.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\nmodel.addCons(Smartphones >= 150)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 50)\n## The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\nmodel.addCons(Smartphones + Tablets + Laptops <= 2 * Laptops)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced: \", model.getVal(Tablets))\n    print(\"Number of laptops produced: \", model.getVal(Laptops))\n    print(\"Total number of devices produced: \", model.getVal(Total_Devices))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of total devices produced\": \"Total_Devices\", \"range\": \"Total_Devices >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 100*Smartphones + 200*Tablets + 300*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 devices per week.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\n// Smartphones >= 150\n// Tablets >= 100\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\n// Smartphones + Tablets + Laptops <= 2 * Laptops",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs. The cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand. The production capacity of the factory is limited to 500 devices per week. The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week. The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops. Please help the company determine the optimal number of smartphones, tablets, and laptops to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\nTotal_Devices = model.addVar(vtype=\"INTEGER\", name=\"Total_Devices\", lb=0) # total number of devices produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Smartphones + 200*Tablets + 300*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 devices per week.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\nmodel.addCons(Smartphones >= 150)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 50)\n## The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\nmodel.addCons(Smartphones + Tablets + Laptops <= 2 * Laptops)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced: \", model.getVal(Tablets))\n    print(\"Number of laptops produced: \", model.getVal(Laptops))\n    print(\"Total number of devices produced: \", model.getVal(Total_Devices))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the availability of raw materials and the market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Raw Material 1 used\": \"RM1\", \"range\": \"RM1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Raw Material 2 used\": \"RM2\", \"range\": \"RM2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize its daily profit from the sales of both products.\n// Objective Function: Maximize: 50*A + 30*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 units of Raw Material 1 and 1 unit of Raw Material 2. Each unit of Product B requires 1 unit of Raw Material 1 and 2 units of Raw Material 2. The daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units.\n// 2*A + RM1 <= 100\n// A + 2*B + RM2 <= 80\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of both products should not exceed 50 units per day to maintain quality control.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the availability of raw materials and the market demand. The profit from selling one unit of Product A is $50, and from Product B is $30. The requirements for raw materials and the market demand are given in the following Table.\n\n| Product | Profit per Unit | Raw Material 1 Required | Raw Material 2 Required | Market Demand |\n|---------|-----------------|-------------------------|-------------------------|---------------|\n| A       | $50             | 2 units                 | 1 unit                  | At least 20   |\n| B       | $30             | 1 unit                  | 2 units                 | At least 30   |\n\nThe daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units. The total production of both products should not exceed 50 units per day to maintain quality control.\n\nPlease help the company to maximize its daily profit from the sales of both products while adhering to the constraints on raw materials and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and raw materials used\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nRM1 = model.addVar(vtype=\"INTEGER\", name=\"RM1\", lb=0) # number of units of Raw Material 1 used\nRM2 = model.addVar(vtype=\"INTEGER\", name=\"RM2\", lb=0) # number of units of Raw Material 2 used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B)\n\n# Add constraints\n## Each unit of Product A requires 2 units of Raw Material 1 and 1 unit of Raw Material 2.\n## Each unit of Product B requires 1 unit of Raw Material 1 and 2 units of Raw Material 2.\n## The daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units.\nmodel.addCons(2*A + RM1 <= 100)\nmodel.addCons(A + 2*B + RM2 <= 80)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of both products should not exceed 50 units per day to maintain quality control.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Raw Material 1 used: \", model.getVal(RM1))\n    print(\"Number of units of Raw Material 2 used: \", model.getVal(RM2))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the availability of raw materials and the market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Raw Material 1 used\": \"RM1\", \"range\": \"RM1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Raw Material 2 used\": \"RM2\", \"range\": \"RM2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize its daily profit from the sales of both products.\n// Objective Function: Maximize: 50*A + 30*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 units of Raw Material 1 and 1 unit of Raw Material 2. Each unit of Product B requires 1 unit of Raw Material 1 and 2 units of Raw Material 2. The daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units.\n// 2*A + RM1 <= 100\n// A + 2*B + RM2 <= 80\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of both products should not exceed 50 units per day to maintain quality control.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the availability of raw materials and the market demand.\nThe profit from selling one unit of Product A is $50, and from Product B is $30. Each unit of Product A requires 2 units of Raw Material 1 and 1 unit of Raw Material 2. Each unit of Product B requires 1 unit of Raw Material 1 and 2 units of Raw Material 2. The daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units. The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day. The total production of both products should not exceed 50 units per day to maintain quality control.\nPlease help the company to maximize its daily profit from the sales of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and raw materials used\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nRM1 = model.addVar(vtype=\"INTEGER\", name=\"RM1\", lb=0) # number of units of Raw Material 1 used\nRM2 = model.addVar(vtype=\"INTEGER\", name=\"RM2\", lb=0) # number of units of Raw Material 2 used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B)\n\n# Add constraints\n## Each unit of Product A requires 2 units of Raw Material 1 and 1 unit of Raw Material 2.\n## Each unit of Product B requires 1 unit of Raw Material 1 and 2 units of Raw Material 2.\n## The daily availability of Raw Material 1 is 100 units, and Raw Material 2 is 80 units.\nmodel.addCons(2*A + RM1 <= 100)\nmodel.addCons(A + 2*B + RM2 <= 80)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of both products should not exceed 50 units per day to maintain quality control.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Raw Material 1 used: \", model.getVal(RM1))\n    print(\"Number of units of Raw Material 2 used: \", model.getVal(RM2))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $20. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 20*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\n// 2*A + 3*B + 1*C <= 150\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of products A and B should not exceed 50 units combined.\n// A + B <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $30, and product C is $20. The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150. The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day. The total production of products A and B should not exceed 50 units combined.\n\nPlease help the company to maximize the total daily profit from the production of these products.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 2                    |\n| B       | $30             | 3                    |\n| C       | $20             | 1                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 20*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\nmodel.addCons(2*A + 3*B + 1*C <= 150)\n## The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of products A and B should not exceed 50 units combined.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $20. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 20*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\n// 2*A + 3*B + 1*C <= 150\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of products A and B should not exceed 50 units combined.\n// A + B <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $30, and product C is $20. The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150. The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day. The total production of products A and B should not exceed 50 units combined. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 20*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\nmodel.addCons(2*A + 3*B + 1*C <= 150)\n## The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of products A and B should not exceed 50 units combined.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.70, and each donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.70*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery's oven has a total capacity of 1000 minutes per day. Each croissant requires 5 minutes of oven time, each muffin requires 10 minutes, and each donut requires 8 minutes.\n// Oven_Croissants = 5*Croissants\n// Oven_Muffins = 10*Muffins\n// Oven_Donuts = 8*Donuts\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery must also ensure that the total number of pastries produced does not exceed 500 to maintain quality.\n// Croissants + Muffins + Donuts <= 500",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and daily demand. The profit from selling each croissant is $0.50, each muffin is $0.70, and each donut is $0.60. The bakery's oven has a total capacity of 1000 minutes per day, with each croissant requiring 5 minutes of oven time, each muffin requiring 10 minutes, and each donut requiring 8 minutes. The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. Additionally, the bakery must ensure that the total number of pastries produced does not exceed 500 to maintain quality.\n\nPlease help the bakery to maximize its daily profit from pastry sales.\n\n| Pastry   | Profit per Unit | Oven Time per Unit | Daily Demand |\n|----------|-----------------|--------------------|--------------|\n| Croissants | $0.50          | 5 minutes          | 100          |\n| Muffins   | $0.70          | 10 minutes         | 150          |\n| Donuts    | $0.60          | 8 minutes          | 200          |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts\n## Oven capacity used by each type of pastry\nOven_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Croissants\", lb=0) # oven capacity used by croissants\nOven_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Muffins\", lb=0) # oven capacity used by muffins\nOven_Donuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Donuts\", lb=0) # oven capacity used by donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.70*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery's oven has a total capacity of 1000 minutes per day.\nmodel.addCons(Oven_Croissants == 5*Croissants)\nmodel.addCons(Oven_Muffins == 10*Muffins)\nmodel.addCons(Oven_Donuts == 8*Donuts)\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 1000)\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery must also ensure that the total number of pastries produced does not exceed 500 to maintain quality.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.70, and each donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.70*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery's oven has a total capacity of 1000 minutes per day. Each croissant requires 5 minutes of oven time, each muffin requires 10 minutes, and each donut requires 8 minutes.\n// Oven_Croissants = 5*Croissants\n// Oven_Muffins = 10*Muffins\n// Oven_Donuts = 8*Donuts\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery must also ensure that the total number of pastries produced does not exceed 500 to maintain quality.\n// Croissants + Muffins + Donuts <= 500",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and daily demand. The profit from selling each croissant is $0.50, each muffin is $0.70, and each donut is $0.60. The bakery's oven has a total capacity of 1000 minutes per day, with each croissant requiring 5 minutes of oven time, each muffin requiring 10 minutes, and each donut requiring 8 minutes. The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. Additionally, the bakery must ensure that the total number of pastries produced does not exceed 500 to maintain quality. Please help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts\n## Oven capacity used by each type of pastry\nOven_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Croissants\", lb=0) # oven capacity used by croissants\nOven_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Muffins\", lb=0) # oven capacity used by muffins\nOven_Donuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Donuts\", lb=0) # oven capacity used by donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.70*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery's oven has a total capacity of 1000 minutes per day.\nmodel.addCons(Oven_Croissants == 5*Croissants)\nmodel.addCons(Oven_Muffins == 10*Muffins)\nmodel.addCons(Oven_Donuts == 8*Donuts)\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 1000)\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery must also ensure that the total number of pastries produced does not exceed 500 to maintain quality.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce to maximize profit while considering the limited availability of ingredients and the demand for each pastry.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each croissant for $2, each muffin for $3, and each eclair for $4. The goal is to maximize the daily revenue from selling these pastries.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 4*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and eggs. Each croissant requires 100 grams of flour and 1 egg, each muffin requires 150 grams of flour and 2 eggs, and each eclair requires 50 grams of flour and 3 eggs. The bakery has 10 kilograms of flour and 100 eggs available daily.\n// 100*Croissants + 150*Muffins + 50*Eclairs <= 10000 (grams of flour)\n// Croissants + 2*Muffins + 3*Eclairs <= 100 (eggs)\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 30 muffins. Additionally, the bakery can only produce a maximum of 40 eclairs due to the complexity of the recipe.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery aims to maintain a balanced production, ensuring that the number of eclairs produced does not exceed twice the number of muffins.\n// Eclairs <= 2*Muffins",
        "question": "A small bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce to maximize profit while considering the limited availability of ingredients and the demand for each pastry. The bakery sells each croissant for $2, each muffin for $3, and each eclair for $4. The goal is to maximize the daily revenue from selling these pastries.\n\nThe bakery has a limited amount of flour and eggs. Each croissant requires 100 grams of flour and 1 egg, each muffin requires 150 grams of flour and 2 eggs, and each eclair requires 50 grams of flour and 3 eggs. The bakery has 10 kilograms of flour and 100 eggs available daily. The bakery has a daily demand for at least 50 croissants and 30 muffins. Additionally, the bakery can only produce a maximum of 40 eclairs due to the complexity of the recipe. The bakery aims to maintain a balanced production, ensuring that the number of eclairs produced does not exceed twice the number of muffins.\n\nPlease help the bakery to maximize its daily revenue by determining the optimal number of each type of pastry to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 4*Eclairs)\n\n# Add constraints\n## The bakery has a limited amount of flour and eggs.\nmodel.addCons(100*Croissants + 150*Muffins + 50*Eclairs <= 10000) # grams of flour\nmodel.addCons(Croissants + 2*Muffins + 3*Eclairs <= 100) # eggs\n## The bakery has a daily demand for at least 50 croissants and 30 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs <= 40)\n## The bakery aims to maintain a balanced production.\nmodel.addCons(Eclairs <= 2*Muffins)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce to maximize profit while considering the limited availability of ingredients and the demand for each pastry.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each croissant for $2, each muffin for $3, and each eclair for $4. The goal is to maximize the daily revenue from selling these pastries.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 4*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and eggs. Each croissant requires 100 grams of flour and 1 egg, each muffin requires 150 grams of flour and 2 eggs, and each eclair requires 50 grams of flour and 3 eggs. The bakery has 10 kilograms of flour and 100 eggs available daily.\n// 100*Croissants + 150*Muffins + 50*Eclairs <= 10000 (grams of flour)\n// Croissants + 2*Muffins + 3*Eclairs <= 100 (eggs)\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 30 muffins. Additionally, the bakery can only produce a maximum of 40 eclairs due to the complexity of the recipe.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery aims to maintain a balanced production, ensuring that the number of eclairs produced does not exceed twice the number of muffins.\n// Eclairs <= 2*Muffins",
        "question": "A small bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery sells each croissant for $2, each muffin for $3, and each eclair for $4. The goal is to maximize the daily revenue from selling these pastries. The bakery has a limited amount of flour and eggs. Each croissant requires 100 grams of flour and 1 egg, each muffin requires 150 grams of flour and 2 eggs, and each eclair requires 50 grams of flour and 3 eggs. The bakery has 10 kilograms of flour and 100 eggs available daily. The bakery has a daily demand for at least 50 croissants and 30 muffins. Additionally, the bakery can only produce a maximum of 40 eclairs due to the complexity of the recipe. The bakery aims to maintain a balanced production, ensuring that the number of eclairs produced does not exceed twice the number of muffins. Please help the bakery determine the optimal number of each type of pastry to produce to maximize profit while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 4*Eclairs)\n\n# Add constraints\n## The bakery has a limited amount of flour and eggs.\nmodel.addCons(100*Croissants + 150*Muffins + 50*Eclairs <= 10000) # grams of flour\nmodel.addCons(Croissants + 2*Muffins + 3*Eclairs <= 100) # eggs\n## The bakery has a daily demand for at least 50 croissants and 30 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs <= 40)\n## The bakery aims to maintain a balanced production.\nmodel.addCons(Eclairs <= 2*Muffins)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The objective is to maximize the total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours.\n// 2*Smartphones + 3*Tablets + 4*Laptops <= 800\n\n## Generate Constraint-2:\nThe raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe company has a policy to produce at least 50 units of each device type per day to maintain market presence.\n// Smartphones >= 50\n// Tablets >= 50\n// Laptops >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials. The profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The following table summarizes the labor hours required for each device:\n\n| Device       | Labor Hours Required |\n|--------------|----------------------|\n| Smartphones  | 2 hours              |\n| Tablets      | 3 hours              |\n| Laptops      | 4 hours              |\n\nThe total labor hours available per day are 800 hours. The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day. The company has a policy to produce at least 50 units of each device type per day to maintain market presence.\n\nPlease help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\n## The number of labor hours used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops <= 800)\n## The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The company has a policy to produce at least 50 units of each device type per day to maintain market presence.\nmodel.addCons(Smartphones >= 50)\nmodel.addCons(Tablets >= 50)\nmodel.addCons(Laptops >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The objective is to maximize the total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours.\n// 2*Smartphones + 3*Tablets + 4*Laptops <= 800\n\n## Generate Constraint-2:\nThe raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe company has a policy to produce at least 50 units of each device type per day to maintain market presence.\n// Smartphones >= 50\n// Tablets >= 50\n// Laptops >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials. The profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours. The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day. The company has a policy to produce at least 50 units of each device type per day to maintain market presence. Please help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\n## The number of labor hours used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops <= 800)\n## The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The company has a policy to produce at least 50 units of each device type per day to maintain market presence.\nmodel.addCons(Smartphones >= 50)\nmodel.addCons(Tablets >= 50)\nmodel.addCons(Laptops >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company has two delivery trucks and needs to determine the optimal number of each product to load onto each truck to minimize the total delivery time.\n// {\"number of product A loaded on Truck 1\": \"A_T1\", \"range\": \"A_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product B loaded on Truck 1\": \"B_T1\", \"range\": \"B_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product C loaded on Truck 1\": \"C_T1\", \"range\": \"C_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product A loaded on Truck 2\": \"A_T2\", \"range\": \"A_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of product B loaded on Truck 2\": \"B_T2\", \"range\": \"B_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of product C loaded on Truck 2\": \"C_T2\", \"range\": \"C_T2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery time for each product varies based on the truck it is loaded on. For Truck 1, the delivery time for products A, B, and C is 5, 10, and 15 minutes per unit, respectively. For Truck 2, the delivery time for products A, B, and C is 10, 5, and 10 minutes per unit, respectively. The company aims to minimize the total delivery time.\n// Objective Function: Minimize: 5*A_T1 + 10*B_T1 + 15*C_T1 + 10*A_T2 + 5*B_T2 + 10*C_T2\n\n## Generate Constraint-1:\nEach truck has a maximum capacity of 100 units.\n// A_T1 + B_T1 + C_T1 <= 100\n// A_T2 + B_T2 + C_T2 <= 100\n\n## Generate Constraint-2:\nThe total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units.\n// A_T1 + A_T2 >= 50\n// B_T1 + B_T2 >= 70\n// C_T1 + C_T2 >= 60\n\n## Generate Constraint-3:\nThe company must ensure that at least 30 units of each product are delivered.\n// A_T1 + A_T2 >= 30\n// B_T1 + B_T2 >= 30\n// C_T1 + C_T2 >= 30",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company has two delivery trucks and needs to determine the optimal number of each product to load onto each truck to minimize the total delivery time. The delivery time for each product varies based on the truck it is loaded on, as shown in the following Table.\n\n| Product | Truck 1 Delivery Time (min/unit) | Truck 2 Delivery Time (min/unit) |\n|---------|---------------------------------|---------------------------------|\n| A       | 5                               | 10                              |\n| B       | 10                              | 5                               |\n| C       | 15                              | 10                              |\n\nEach truck has a maximum capacity of 100 units. The total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units. The company must ensure that at least 30 units of each product are delivered.\n\nPlease help the company to minimize the total delivery time, which is calculated as follows:\n- For Truck 1: 5*A_T1 + 10*B_T1 + 15*C_T1\n- For Truck 2: 10*A_T2 + 5*B_T2 + 10*C_T2\n\nWhere A_T1, B_T1, C_T1 are the number of product A, B, and C loaded on Truck 1, and A_T2, B_T2, C_T2 are the number of product A, B, and C loaded on Truck 2.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product loaded on each truck\nA_T1 = model.addVar(vtype=\"INTEGER\", name=\"A_T1\", lb=0) # number of product A loaded on Truck 1\nB_T1 = model.addVar(vtype=\"INTEGER\", name=\"B_T1\", lb=0) # number of product B loaded on Truck 1\nC_T1 = model.addVar(vtype=\"INTEGER\", name=\"C_T1\", lb=0) # number of product C loaded on Truck 1\nA_T2 = model.addVar(vtype=\"INTEGER\", name=\"A_T2\", lb=0) # number of product A loaded on Truck 2\nB_T2 = model.addVar(vtype=\"INTEGER\", name=\"B_T2\", lb=0) # number of product B loaded on Truck 2\nC_T2 = model.addVar(vtype=\"INTEGER\", name=\"C_T2\", lb=0) # number of product C loaded on Truck 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_T1 + 10*B_T1 + 15*C_T1 + 10*A_T2 + 5*B_T2 + 10*C_T2)\n\n# Add constraints\n## Each truck has a maximum capacity of 100 units.\nmodel.addCons(A_T1 + B_T1 + C_T1 <= 100)\nmodel.addCons(A_T2 + B_T2 + C_T2 <= 100)\n## The total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units.\nmodel.addCons(A_T1 + A_T2 >= 50)\nmodel.addCons(B_T1 + B_T2 >= 70)\nmodel.addCons(C_T1 + C_T2 >= 60)\n## The company must ensure that at least 30 units of each product are delivered.\nmodel.addCons(A_T1 + A_T2 >= 30)\nmodel.addCons(B_T1 + B_T2 >= 30)\nmodel.addCons(C_T1 + C_T2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A loaded on Truck 1: \", model.getVal(A_T1))\n    print(\"Number of product B loaded on Truck 1: \", model.getVal(B_T1))\n    print(\"Number of product C loaded on Truck 1: \", model.getVal(C_T1))\n    print(\"Number of product A loaded on Truck 2: \", model.getVal(A_T2))\n    print(\"Number of product B loaded on Truck 2: \", model.getVal(B_T2))\n    print(\"Number of product C loaded on Truck 2: \", model.getVal(C_T2))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company has two delivery trucks and needs to determine the optimal number of each product to load onto each truck to minimize the total delivery time.\n// {\"number of product A loaded on Truck 1\": \"A_T1\", \"range\": \"A_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product B loaded on Truck 1\": \"B_T1\", \"range\": \"B_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product C loaded on Truck 1\": \"C_T1\", \"range\": \"C_T1 >= 0\", \"type\": \"integer\"}\n// {\"number of product A loaded on Truck 2\": \"A_T2\", \"range\": \"A_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of product B loaded on Truck 2\": \"B_T2\", \"range\": \"B_T2 >= 0\", \"type\": \"integer\"}\n// {\"number of product C loaded on Truck 2\": \"C_T2\", \"range\": \"C_T2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery time for each product varies based on the truck it is loaded on. For Truck 1, the delivery time for products A, B, and C is 5, 10, and 15 minutes per unit, respectively. For Truck 2, the delivery time for products A, B, and C is 10, 5, and 10 minutes per unit, respectively. The company aims to minimize the total delivery time.\n// Objective Function: Minimize: 5*A_T1 + 10*B_T1 + 15*C_T1 + 10*A_T2 + 5*B_T2 + 10*C_T2\n\n## Generate Constraint-1:\nEach truck has a maximum capacity of 100 units.\n// A_T1 + B_T1 + C_T1 <= 100\n// A_T2 + B_T2 + C_T2 <= 100\n\n## Generate Constraint-2:\nThe total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units.\n// A_T1 + A_T2 >= 50\n// B_T1 + B_T2 >= 70\n// C_T1 + C_T2 >= 60\n\n## Generate Constraint-3:\nThe company must ensure that at least 30 units of each product are delivered.\n// A_T1 + A_T2 >= 30\n// B_T1 + B_T2 >= 30\n// C_T1 + C_T2 >= 30",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company has two delivery trucks and needs to determine the optimal number of each product to load onto each truck to minimize the total delivery time. The delivery time for each product varies based on the truck it is loaded on. For Truck 1, the delivery time for products A, B, and C is 5, 10, and 15 minutes per unit, respectively. For Truck 2, the delivery time for products A, B, and C is 10, 5, and 10 minutes per unit, respectively. Each truck has a maximum capacity of 100 units. The total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units. The company must ensure that at least 30 units of each product are delivered. Please help the company to minimize the total delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product loaded on each truck\nA_T1 = model.addVar(vtype=\"INTEGER\", name=\"A_T1\", lb=0) # number of product A loaded on Truck 1\nB_T1 = model.addVar(vtype=\"INTEGER\", name=\"B_T1\", lb=0) # number of product B loaded on Truck 1\nC_T1 = model.addVar(vtype=\"INTEGER\", name=\"C_T1\", lb=0) # number of product C loaded on Truck 1\nA_T2 = model.addVar(vtype=\"INTEGER\", name=\"A_T2\", lb=0) # number of product A loaded on Truck 2\nB_T2 = model.addVar(vtype=\"INTEGER\", name=\"B_T2\", lb=0) # number of product B loaded on Truck 2\nC_T2 = model.addVar(vtype=\"INTEGER\", name=\"C_T2\", lb=0) # number of product C loaded on Truck 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_T1 + 10*B_T1 + 15*C_T1 + 10*A_T2 + 5*B_T2 + 10*C_T2)\n\n# Add constraints\n## Each truck has a maximum capacity of 100 units.\nmodel.addCons(A_T1 + B_T1 + C_T1 <= 100)\nmodel.addCons(A_T2 + B_T2 + C_T2 <= 100)\n## The total demand for product A is 50 units, for product B is 70 units, and for product C is 60 units.\nmodel.addCons(A_T1 + A_T2 >= 50)\nmodel.addCons(B_T1 + B_T2 >= 70)\nmodel.addCons(C_T1 + C_T2 >= 60)\n## The company must ensure that at least 30 units of each product are delivered.\nmodel.addCons(A_T1 + A_T2 >= 30)\nmodel.addCons(B_T1 + B_T2 >= 30)\nmodel.addCons(C_T1 + C_T2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A loaded on Truck 1: \", model.getVal(A_T1))\n    print(\"Number of product B loaded on Truck 1: \", model.getVal(B_T1))\n    print(\"Number of product C loaded on Truck 1: \", model.getVal(C_T1))\n    print(\"Number of product A loaded on Truck 2: \", model.getVal(A_T2))\n    print(\"Number of product B loaded on Truck 2: \", model.getVal(B_T2))\n    print(\"Number of product C loaded on Truck 2: \", model.getVal(C_T2))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints.\n// {\"amount of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n// Objective Function: Maximize: 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3)\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units of either product, Factory 2 can produce a maximum of 150 units, and Factory 3 can produce a maximum of 200 units.\n// A_F1 + B_F1 <= 100\n// A_F2 + B_F2 <= 150\n// A_F3 + B_F3 <= 200\n\n## Generate Constraint-2:\nThe company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client.\n// A_F1 + A_F2 + A_F3 >= 200\n// B_F1 + B_F2 + B_F3 >= 150\n\n## Generate Constraint-3:\nDue to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n// A_F1 + A_F2 + A_F3 <= 300\n// B_F1 + B_F2 + B_F3 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints. The profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units of either product, Factory 2 can produce a maximum of 150 units, and Factory 3 can produce a maximum of 200 units. The company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client. Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n\nPlease help the company determine the optimal production quantities for Product A and Product B in each factory to maximize total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of Product A and Product B produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # amount of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # amount of Product A produced in Factory 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # amount of Product A produced in Factory 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # amount of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # amount of Product B produced in Factory 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # amount of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3))\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(A_F1 + B_F1 <= 100)\nmodel.addCons(A_F2 + B_F2 <= 150)\nmodel.addCons(A_F3 + B_F3 <= 200)\n## The company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client.\nmodel.addCons(A_F1 + A_F2 + A_F3 >= 200)\nmodel.addCons(B_F1 + B_F2 + B_F3 >= 150)\n## Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 <= 300)\nmodel.addCons(B_F1 + B_F2 + B_F3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Amount of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Amount of Product A produced in Factory 3: \", model.getVal(A_F3))\n    print(\"Amount of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Amount of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Amount of Product B produced in Factory 3: \", model.getVal(B_F3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints.\n// {\"amount of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n// Objective Function: Maximize: 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3)\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units of either product, Factory 2 can produce a maximum of 150 units, and Factory 3 can produce a maximum of 200 units.\n// A_F1 + B_F1 <= 100\n// A_F2 + B_F2 <= 150\n// A_F3 + B_F3 <= 200\n\n## Generate Constraint-2:\nThe company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client.\n// A_F1 + A_F2 + A_F3 >= 200\n// B_F1 + B_F2 + B_F3 >= 150\n\n## Generate Constraint-3:\nDue to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n// A_F1 + A_F2 + A_F3 <= 300\n// B_F1 + B_F2 + B_F3 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories. Each factory has a limited production capacity: Factory 1 can produce a maximum of 100 units of either product, Factory 2 can produce a maximum of 150 units, and Factory 3 can produce a maximum of 200 units. The company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client. Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\nPlease help the company decide how much of each product to produce in each factory to maximize profit while meeting these production constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of Product A and Product B produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # amount of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # amount of Product A produced in Factory 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # amount of Product A produced in Factory 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # amount of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # amount of Product B produced in Factory 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # amount of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3))\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(A_F1 + B_F1 <= 100)\nmodel.addCons(A_F2 + B_F2 <= 150)\nmodel.addCons(A_F3 + B_F3 <= 200)\n## The company has a contract to supply at least 200 units of Product A and 150 units of Product B to its main client.\nmodel.addCons(A_F1 + A_F2 + A_F3 >= 200)\nmodel.addCons(B_F1 + B_F2 + B_F3 >= 150)\n## Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 <= 300)\nmodel.addCons(B_F1 + B_F2 + B_F3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Amount of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Amount of Product A produced in Factory 3: \", model.getVal(A_F3))\n    print(\"Amount of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Amount of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Amount of Product B produced in Factory 3: \", model.getVal(B_F3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by determining the number of trucks to use for each route and the number of trips each truck will make. The company has identified three main routes (Route A, Route B, and Route C) and needs to decide how many trucks to allocate to each route and how many trips each truck will make.\n// {\"number of trucks for Route A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route A\": \"trips_A\", \"range\": \"trips_A >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route B\": \"trips_B\", \"range\": \"trips_B >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route C\": \"trips_C\", \"range\": \"trips_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the fixed cost of truck maintenance and the variable cost per trip. The fixed cost for each truck is $1000 per week, and the variable cost per trip is $50 for Route A, $70 for Route B, and $60 for Route C.\n// Fixed_Cost = 1000 * (trucks_A + trucks_B + trucks_C)\n// Variable_Cost_A = 50 * trucks_A * trips_A\n// Variable_Cost_B = 70 * trucks_B * trips_B\n// Variable_Cost_C = 60 * trucks_C * trips_C\n// Objective Function: Minimize: Fixed_Cost + Variable_Cost_A + Variable_Cost_B + Variable_Cost_C\n\n## Generate Constraint-1:\nThe total number of trips across all routes must not exceed 500 trips per week.\n// trucks_A * trips_A + trucks_B * trips_B + trucks_C * trips_C <= 500\n\n## Generate Constraint-2:\nRoute A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week.\n// trucks_A * trips_A >= 100\n// trucks_B * trips_B >= 150\n// trucks_C * trips_C >= 200\n\n## Generate Constraint-3:\nThe company has a maximum of 10 trucks available for allocation across all routes.\n// trucks_A + trucks_B + trucks_C <= 10",
        "question": "A logistics company is planning to optimize its delivery routes by determining the number of trucks to use for each route and the number of trips each truck will make. The company has identified three main routes (Route A, Route B, and Route C) and needs to decide how many trucks to allocate to each route and how many trips each truck will make. The operational costs include a fixed cost of truck maintenance and a variable cost per trip. The fixed cost for each truck is $1000 per week, and the variable cost per trip is $50 for Route A, $70 for Route B, and $60 for Route C.\n\n| Route | Fixed Cost per Truck | Variable Cost per Trip |\n|-------|----------------------|-----------------------|\n| A     | 1000$                | 50$                   |\n| B     | 1000$                | 70$                   |\n| C     | 1000$                | 60$                   |\n\nThe company aims to minimize the total operational cost. The total number of trips across all routes must not exceed 500 trips per week. Route A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week. The company has a maximum of 10 trucks available for allocation across all routes.\n\nPlease help the company determine the optimal number of trucks and trips for each route to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of trucks and trips for each route\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks for Route A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks for Route B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks for Route C\ntrips_A = model.addVar(vtype=\"INTEGER\", name=\"trips_A\", lb=0) # number of trips per truck for Route A\ntrips_B = model.addVar(vtype=\"INTEGER\", name=\"trips_B\", lb=0) # number of trips per truck for Route B\ntrips_C = model.addVar(vtype=\"INTEGER\", name=\"trips_C\", lb=0) # number of trips per truck for Route C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Calculate costs\nFixed_Cost = 1000 * (trucks_A + trucks_B + trucks_C)\nVariable_Cost_A = 50 * trucks_A * trips_A\nVariable_Cost_B = 70 * trucks_B * trips_B\nVariable_Cost_C = 60 * trucks_C * trips_C\nmodel.addCons(obj == Fixed_Cost + Variable_Cost_A + Variable_Cost_B + Variable_Cost_C)\n\n# Add constraints\n## Total number of trips across all routes must not exceed 500 trips per week.\nmodel.addCons(trucks_A * trips_A + trucks_B * trips_B + trucks_C * trips_C <= 500)\n## Route A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week.\nmodel.addCons(trucks_A * trips_A >= 100)\nmodel.addCons(trucks_B * trips_B >= 150)\nmodel.addCons(trucks_C * trips_C >= 200)\n## The company has a maximum of 10 trucks available for allocation across all routes.\nmodel.addCons(trucks_A + trucks_B + trucks_C <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Route A: \", model.getVal(trucks_A))\n    print(\"Number of trucks for Route B: \", model.getVal(trucks_B))\n    print(\"Number of trucks for Route C: \", model.getVal(trucks_C))\n    print(\"Number of trips per truck for Route A: \", model.getVal(trips_A))\n    print(\"Number of trips per truck for Route B: \", model.getVal(trips_B))\n    print(\"Number of trips per truck for Route C: \", model.getVal(trips_C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1358,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by determining the number of trucks to use for each route and the number of trips each truck will make. The company has identified three main routes (Route A, Route B, and Route C) and needs to decide how many trucks to allocate to each route and how many trips each truck will make.\n// {\"number of trucks for Route A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route A\": \"trips_A\", \"range\": \"trips_A >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route B\": \"trips_B\", \"range\": \"trips_B >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Route C\": \"trips_C\", \"range\": \"trips_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the fixed cost of truck maintenance and the variable cost per trip. The fixed cost for each truck is $1000 per week, and the variable cost per trip is $50 for Route A, $70 for Route B, and $60 for Route C.\n// Fixed_Cost = 1000 * (trucks_A + trucks_B + trucks_C)\n// Variable_Cost_A = 50 * trucks_A * trips_A\n// Variable_Cost_B = 70 * trucks_B * trips_B\n// Variable_Cost_C = 60 * trucks_C * trips_C\n// Objective Function: Minimize: Fixed_Cost + Variable_Cost_A + Variable_Cost_B + Variable_Cost_C\n\n## Generate Constraint-1:\nThe total number of trips across all routes must not exceed 500 trips per week.\n// trucks_A * trips_A + trucks_B * trips_B + trucks_C * trips_C <= 500\n\n## Generate Constraint-2:\nRoute A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week.\n// trucks_A * trips_A >= 100\n// trucks_B * trips_B >= 150\n// trucks_C * trips_C >= 200\n\n## Generate Constraint-3:\nThe company has a maximum of 10 trucks available for allocation across all routes.\n// trucks_A + trucks_B + trucks_C <= 10",
        "question": "A logistics company is planning to optimize its delivery routes by determining the number of trucks to use for each route and the number of trips each truck will make. The company has identified three main routes (Route A, Route B, and Route C) and needs to decide how many trucks to allocate to each route and how many trips each truck will make. The company aims to minimize the total operational cost, which includes the fixed cost of truck maintenance and the variable cost per trip. The fixed cost for each truck is $1000 per week, and the variable cost per trip is $50 for Route A, $70 for Route B, and $60 for Route C. The total number of trips across all routes must not exceed 500 trips per week. Route A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week. The company has a maximum of 10 trucks available for allocation across all routes. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of trucks and trips for each route\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks for Route A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks for Route B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks for Route C\ntrips_A = model.addVar(vtype=\"INTEGER\", name=\"trips_A\", lb=0) # number of trips per truck for Route A\ntrips_B = model.addVar(vtype=\"INTEGER\", name=\"trips_B\", lb=0) # number of trips per truck for Route B\ntrips_C = model.addVar(vtype=\"INTEGER\", name=\"trips_C\", lb=0) # number of trips per truck for Route C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Calculate costs\nFixed_Cost = 1000 * (trucks_A + trucks_B + trucks_C)\nVariable_Cost_A = 50 * trucks_A * trips_A\nVariable_Cost_B = 70 * trucks_B * trips_B\nVariable_Cost_C = 60 * trucks_C * trips_C\nmodel.addCons(obj == Fixed_Cost + Variable_Cost_A + Variable_Cost_B + Variable_Cost_C)\n\n# Add constraints\n## Total number of trips across all routes must not exceed 500 trips per week.\nmodel.addCons(trucks_A * trips_A + trucks_B * trips_B + trucks_C * trips_C <= 500)\n## Route A requires at least 100 trips per week, Route B requires at least 150 trips per week, and Route C requires at least 200 trips per week.\nmodel.addCons(trucks_A * trips_A >= 100)\nmodel.addCons(trucks_B * trips_B >= 150)\nmodel.addCons(trucks_C * trips_C >= 200)\n## The company has a maximum of 10 trucks available for allocation across all routes.\nmodel.addCons(trucks_A + trucks_B + trucks_C <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Route A: \", model.getVal(trucks_A))\n    print(\"Number of trucks for Route B: \", model.getVal(trucks_B))\n    print(\"Number of trucks for Route C: \", model.getVal(trucks_C))\n    print(\"Number of trips per truck for Route A: \", model.getVal(trips_A))\n    print(\"Number of trips per truck for Route B: \", model.getVal(trips_B))\n    print(\"Number of trips per truck for Route C: \", model.getVal(trips_C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The wheat bread requires 200 grams of flour per loaf, rye bread requires 250 grams, and sourdough requires 300 grams. The total daily flour supply is 100 kilograms.\n// 200*wheat_loaves + 250*rye_loaves + 300*sourdough_loaves <= 100000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of bread. The demand for wheat bread is at most 300 loaves, rye bread is at most 200 loaves, and sourdough bread is at most 150 loaves.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150\n\n## Generate Constraint-3:\nThe bakery has a labor constraint, with a maximum of 8 hours of labor available each day. Each loaf of wheat bread requires 5 minutes of labor, rye bread requires 8 minutes, and sourdough requires 10 minutes.\n// (5/60)*wheat_loaves + (8/60)*rye_loaves + (10/60)*sourdough_loaves <= 8",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources and market demand. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Loaf | Flour Required (grams) | Labor Time per Loaf (minutes) |\n|----------------|-----------------|------------------------|-------------------------------|\n| Wheat          | $2              | 200                    | 5                             |\n| Rye            | $3              | 250                    | 8                             |\n| Sourdough      | $4              | 300                    | 10                            |\n\nThe bakery has a limited amount of flour available each day, with a total daily supply of 100 kilograms. The bakery also has a daily demand limit for each type of bread: the demand for wheat bread is at most 300 loaves, rye bread is at most 200 loaves, and sourdough bread is at most 150 loaves. Additionally, the bakery has a labor constraint, with a maximum of 8 hours of labor available each day. \n\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*wheat_loaves + 250*rye_loaves + 300*sourdough_loaves <= 100000)\n## The bakery has a daily demand limit for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n## The bakery has a labor constraint, with a maximum of 8 hours of labor available each day.\nmodel.addCons((5/60)*wheat_loaves + (8/60)*rye_loaves + (10/60)*sourdough_loaves <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1507,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The wheat bread requires 200 grams of flour per loaf, rye bread requires 250 grams, and sourdough requires 300 grams. The total daily flour supply is 100 kilograms.\n// 200*wheat_loaves + 250*rye_loaves + 300*sourdough_loaves <= 100000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of bread. The demand for wheat bread is at most 300 loaves, rye bread is at most 200 loaves, and sourdough bread is at most 150 loaves.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150\n\n## Generate Constraint-3:\nThe bakery has a labor constraint, with a maximum of 8 hours of labor available each day. Each loaf of wheat bread requires 5 minutes of labor, rye bread requires 8 minutes, and sourdough requires 10 minutes.\n// (5/60)*wheat_loaves + (8/60)*rye_loaves + (10/60)*sourdough_loaves <= 8",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources and market demand. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales. The bakery has a limited amount of flour available each day, with a total daily supply of 100 kilograms. The wheat bread requires 200 grams of flour per loaf, rye bread requires 250 grams, and sourdough requires 300 grams. The bakery also has a daily demand limit for each type of bread: the demand for wheat bread is at most 300 loaves, rye bread is at most 200 loaves, and sourdough bread is at most 150 loaves. Additionally, the bakery has a labor constraint, with a maximum of 8 hours of labor available each day. Each loaf of wheat bread requires 5 minutes of labor, rye bread requires 8 minutes, and sourdough requires 10 minutes. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*wheat_loaves + 3*rye_loaves + 4*sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*wheat_loaves + 250*rye_loaves + 300*sourdough_loaves <= 100000)\n## The bakery has a daily demand limit for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n## The bakery has a labor constraint, with a maximum of 8 hours of labor available each day.\nmodel.addCons((5/60)*wheat_loaves + (8/60)*rye_loaves + (10/60)*sourdough_loaves <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of trips each truck will make. The company operates in three major cities: City A, City B, and City C. They need to determine how many trucks to allocate to each city and how many trips each truck will make to maximize efficiency while minimizing costs.\n// {\"number of trucks allocated to City A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to City B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to City C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City A\": \"trips_A\", \"range\": \"trips_A >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City B\": \"trips_B\", \"range\": \"trips_B >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City C\": \"trips_C\", \"range\": \"trips_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in City A is $500 per trip, in City B is $600 per trip, and in City C is $700 per trip. The company aims to minimize the total operational cost while ensuring all deliveries are made.\n// Objective Function: Minimize: 500 * trucks_A * trips_A + 600 * trucks_B * trips_B + 700 * trucks_C * trips_C\n\n## Generate Constraint-1:\nThe total number of trips required in each city must be met. City A requires 1000 trips, City B requires 1500 trips, and City C requires 2000 trips.\n// trucks_A * trips_A >= 1000\n// trucks_B * trips_B >= 1500\n// trucks_C * trips_C >= 2000\n\n## Generate Constraint-2:\nThe company has a limited fleet of trucks. The total number of trucks allocated across all cities cannot exceed 50.\n// trucks_A + trucks_B + trucks_C <= 50\n\n## Generate Constraint-3:\nEach truck can make a maximum of 20 trips per week.\n// trips_A <= 20\n// trips_B <= 20\n// trips_C <= 20",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of trips each truck will make. The company operates in three major cities: City A, City B, and City C. They need to determine how many trucks to allocate to each city and how many trips each truck will make to maximize efficiency while minimizing costs. The cost of operating a truck in City A is $500 per trip, in City B is $600 per trip, and in City C is $700 per trip. The company aims to minimize the total operational cost while ensuring all deliveries are made.\n\n| City | Cost per Trip | Required Trips |\n|------|---------------|----------------|\n| A    | $500          | 1000           |\n| B    | $600          | 1500           |\n| C    | $700          | 2000           |\n\nThe total number of trips required in each city must be met. City A requires 1000 trips, City B requires 1500 trips, and City C requires 2000 trips. The company has a limited fleet of trucks. The total number of trucks allocated across all cities cannot exceed 50. Each truck can make a maximum of 20 trips per week.\n\nPlease help the company to determine the optimal allocation of trucks and trips to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks allocated to each city and the number of trips per truck\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks allocated to City A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks allocated to City B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks allocated to City C\ntrips_A = model.addVar(vtype=\"INTEGER\", name=\"trips_A\", lb=0) # number of trips per truck in City A\ntrips_B = model.addVar(vtype=\"INTEGER\", name=\"trips_B\", lb=0) # number of trips per truck in City B\ntrips_C = model.addVar(vtype=\"INTEGER\", name=\"trips_C\", lb=0) # number of trips per truck in City C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500 * trucks_A * trips_A + 600 * trucks_B * trips_B + 700 * trucks_C * trips_C)\n\n# Add constraints\n## The total number of trips required in each city must be met.\nmodel.addCons(trucks_A * trips_A >= 1000)\nmodel.addCons(trucks_B * trips_B >= 1500)\nmodel.addCons(trucks_C * trips_C >= 2000)\n## The total number of trucks allocated across all cities cannot exceed 50.\nmodel.addCons(trucks_A + trucks_B + trucks_C <= 50)\n## Each truck can make a maximum of 20 trips per week.\nmodel.addCons(trips_A <= 20)\nmodel.addCons(trips_B <= 20)\nmodel.addCons(trips_C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks allocated to City A: \", model.getVal(trucks_A))\n    print(\"Number of trucks allocated to City B: \", model.getVal(trucks_B))\n    print(\"Number of trucks allocated to City C: \", model.getVal(trucks_C))\n    print(\"Number of trips per truck in City A: \", model.getVal(trips_A))\n    print(\"Number of trips per truck in City B: \", model.getVal(trips_B))\n    print(\"Number of trips per truck in City C: \", model.getVal(trips_C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of trips each truck will make. The company operates in three major cities: City A, City B, and City C. They need to determine how many trucks to allocate to each city and how many trips each truck will make to maximize efficiency while minimizing costs.\n// {\"number of trucks allocated to City A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to City B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to City C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City A\": \"trips_A\", \"range\": \"trips_A >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City B\": \"trips_B\", \"range\": \"trips_B >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck in City C\": \"trips_C\", \"range\": \"trips_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in City A is $500 per trip, in City B is $600 per trip, and in City C is $700 per trip. The company aims to minimize the total operational cost while ensuring all deliveries are made.\n// Objective Function: Minimize: 500 * trucks_A * trips_A + 600 * trucks_B * trips_B + 700 * trucks_C * trips_C\n\n## Generate Constraint-1:\nThe total number of trips required in each city must be met. City A requires 1000 trips, City B requires 1500 trips, and City C requires 2000 trips.\n// trucks_A * trips_A >= 1000\n// trucks_B * trips_B >= 1500\n// trucks_C * trips_C >= 2000\n\n## Generate Constraint-2:\nThe company has a limited fleet of trucks. The total number of trucks allocated across all cities cannot exceed 50.\n// trucks_A + trucks_B + trucks_C <= 50\n\n## Generate Constraint-3:\nEach truck can make a maximum of 20 trips per week.\n// trips_A <= 20\n// trips_B <= 20\n// trips_C <= 20",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of trips each truck will make. The company operates in three major cities: City A, City B, and City C. They need to determine how many trucks to allocate to each city and how many trips each truck will make to maximize efficiency while minimizing costs. The cost of operating a truck in City A is $500 per trip, in City B is $600 per trip, and in City C is $700 per trip. The company aims to minimize the total operational cost while ensuring all deliveries are made. The total number of trips required in each city must be met. City A requires 1000 trips, City B requires 1500 trips, and City C requires 2000 trips. The company has a limited fleet of trucks. The total number of trucks allocated across all cities cannot exceed 50. Each truck can make a maximum of 20 trips per week. Please help the company to determine the optimal allocation of trucks and trips to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks allocated to each city and the number of trips per truck\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks allocated to City A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks allocated to City B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks allocated to City C\ntrips_A = model.addVar(vtype=\"INTEGER\", name=\"trips_A\", lb=0) # number of trips per truck in City A\ntrips_B = model.addVar(vtype=\"INTEGER\", name=\"trips_B\", lb=0) # number of trips per truck in City B\ntrips_C = model.addVar(vtype=\"INTEGER\", name=\"trips_C\", lb=0) # number of trips per truck in City C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500 * trucks_A * trips_A + 600 * trucks_B * trips_B + 700 * trucks_C * trips_C)\n\n# Add constraints\n## The total number of trips required in each city must be met.\nmodel.addCons(trucks_A * trips_A >= 1000)\nmodel.addCons(trucks_B * trips_B >= 1500)\nmodel.addCons(trucks_C * trips_C >= 2000)\n## The total number of trucks allocated across all cities cannot exceed 50.\nmodel.addCons(trucks_A + trucks_B + trucks_C <= 50)\n## Each truck can make a maximum of 20 trips per week.\nmodel.addCons(trips_A <= 20)\nmodel.addCons(trips_B <= 20)\nmodel.addCons(trips_C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks allocated to City A: \", model.getVal(trucks_A))\n    print(\"Number of trucks allocated to City B: \", model.getVal(trucks_B))\n    print(\"Number of trucks allocated to City C: \", model.getVal(trucks_C))\n    print(\"Number of trips per truck in City A: \", model.getVal(trips_A))\n    print(\"Number of trips per truck in City B: \", model.getVal(trips_B))\n    print(\"Number of trips per truck in City C: \", model.getVal(trips_C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours worked\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n// Production_Cost = wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours\n// Objective Function: Minimize: Production_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n// sourdough_loaves >= 20\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 100 loaves of bread per day without overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nIf the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\n// (wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours\n// extra_hours <= 2",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery. The cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1            |\n| Rye           | $2            |\n| Sourdough     | $3            |\n\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread. The bakery can produce a maximum of 100 loaves of bread per day without overtime. If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\n\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce and the number of extra hours to work to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of extra hours worked\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"INTEGER\", name=\"extra_hours\", lb=0) # number of extra hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\nmodel.addCons(sourdough_loaves >= 20)\n## The bakery can produce a maximum of 100 loaves of bread per day without overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours)\nmodel.addCons(extra_hours <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours worked: \", model.getVal(extra_hours))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours worked\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n// Production_Cost = wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours\n// Objective Function: Minimize: Production_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n// sourdough_loaves >= 20\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 100 loaves of bread per day without overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nIf the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\n// (wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours\n// extra_hours <= 2",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery. The cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production. The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread. The bakery can produce a maximum of 100 loaves of bread per day without overtime. If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour. Please help the bakery to minimize the total cost of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of extra hours worked\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"INTEGER\", name=\"extra_hours\", lb=0) # number of extra hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\nmodel.addCons(sourdough_loaves >= 20)\n## The bakery can produce a maximum of 100 loaves of bread per day without overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours)\nmodel.addCons(extra_hours <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours worked: \", model.getVal(extra_hours))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread.\n\n| Type of Bread | Profit per Loaf | Flour Required (kg) | Daily Demand |\n|---------------|-----------------|---------------------|--------------|\n| Wheat         | $3              | 0.5                 | 400          |\n| Rye           | $4              | 0.7                 | 300          |\n| Sourdough     | $5              | 0.6                 | 200          |\n\nThe bakery has a daily limit of 500kg of flour. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. Please help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. Please help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how many units of each product to produce in each factory to maximize profit while considering production capacity and demand constraints.\n// {\"number of units of Product A produced in Factory 1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total profit from the production of both products across all factories.\n// Objective Function: Maximize: 50*(A1 + A2 + A3) + 70*(B1 + B2 + B3)\n\n## Generate Constraint-1:\nEach factory has a maximum production capacity. Factory 1 can produce up to 100 units in total, Factory 2 up to 120 units, and Factory 3 up to 150 units.\n// A1 + B1 <= 100\n// A2 + B2 <= 120\n// A3 + B3 <= 150\n\n## Generate Constraint-2:\nThe total demand for Product A is 200 units, and for Product B is 250 units. The company must meet these demands.\n// A1 + A2 + A3 >= 200\n// B1 + B2 + B3 >= 250\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 30% of the total production in each factory is Product A to maintain a balanced product mix.\n// A1 >= 0.3 * (A1 + B1)\n// A2 >= 0.3 * (A2 + B2)\n// A3 >= 0.3 * (A3 + B3)",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how many units of each product to produce in each factory to maximize profit while considering production capacity and demand constraints. The profit per unit of Product A is $50, and for Product B is $70.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n\nEach factory has a maximum production capacity. Factory 1 can produce up to 100 units in total, Factory 2 up to 120 units, and Factory 3 up to 150 units. The total demand for Product A is 200 units, and for Product B is 250 units. The company must meet these demands. Additionally, the company has a policy to ensure that at least 30% of the total production in each factory is Product A to maintain a balanced product mix.\n\nPlease help the company to maximize the total profit from the production of both products across all factories.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # units of Product A produced in Factory 1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # units of Product A produced in Factory 2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # units of Product A produced in Factory 3\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # units of Product B produced in Factory 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # units of Product B produced in Factory 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # units of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A1 + A2 + A3) + 70*(B1 + B2 + B3))\n\n# Add constraints\n## Each factory has a maximum production capacity.\nmodel.addCons(A1 + B1 <= 100)\nmodel.addCons(A2 + B2 <= 120)\nmodel.addCons(A3 + B3 <= 150)\n## The total demand for Product A and Product B.\nmodel.addCons(A1 + A2 + A3 >= 200)\nmodel.addCons(B1 + B2 + B3 >= 250)\n## The company has a policy to ensure that at least 30% of the total production in each factory is Product A.\nmodel.addCons(A1 >= 0.3 * (A1 + B1))\nmodel.addCons(A2 >= 0.3 * (A2 + B2))\nmodel.addCons(A3 >= 0.3 * (A3 + B3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A produced in Factory 1: \", model.getVal(A1))\n    print(\"Units of Product A produced in Factory 2: \", model.getVal(A2))\n    print(\"Units of Product A produced in Factory 3: \", model.getVal(A3))\n    print(\"Units of Product B produced in Factory 1: \", model.getVal(B1))\n    print(\"Units of Product B produced in Factory 2: \", model.getVal(B2))\n    print(\"Units of Product B produced in Factory 3: \", model.getVal(B3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how many units of each product to produce in each factory to maximize profit while considering production capacity and demand constraints.\n// {\"number of units of Product A produced in Factory 1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total profit from the production of both products across all factories.\n// Objective Function: Maximize: 50*(A1 + A2 + A3) + 70*(B1 + B2 + B3)\n\n## Generate Constraint-1:\nEach factory has a maximum production capacity. Factory 1 can produce up to 100 units in total, Factory 2 up to 120 units, and Factory 3 up to 150 units.\n// A1 + B1 <= 100\n// A2 + B2 <= 120\n// A3 + B3 <= 150\n\n## Generate Constraint-2:\nThe total demand for Product A is 200 units, and for Product B is 250 units. The company must meet these demands.\n// A1 + A2 + A3 >= 200\n// B1 + B2 + B3 >= 250\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 30% of the total production in each factory is Product A to maintain a balanced product mix.\n// A1 >= 0.3 * (A1 + B1)\n// A2 >= 0.3 * (A2 + B2)\n// A3 >= 0.3 * (A3 + B3)",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how many units of each product to produce in each factory to maximize profit while considering production capacity and demand constraints. The profit per unit of Product A is $50, and for Product B is $70. Each factory has a maximum production capacity. Factory 1 can produce up to 100 units in total, Factory 2 up to 120 units, and Factory 3 up to 150 units. The total demand for Product A is 200 units, and for Product B is 250 units. The company must meet these demands. Additionally, the company has a policy to ensure that at least 30% of the total production in each factory is Product A to maintain a balanced product mix. Please help the company to maximize the total profit from the production of both products across all factories.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # units of Product A produced in Factory 1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # units of Product A produced in Factory 2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # units of Product A produced in Factory 3\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # units of Product B produced in Factory 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # units of Product B produced in Factory 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # units of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A1 + A2 + A3) + 70*(B1 + B2 + B3))\n\n# Add constraints\n## Each factory has a maximum production capacity.\nmodel.addCons(A1 + B1 <= 100)\nmodel.addCons(A2 + B2 <= 120)\nmodel.addCons(A3 + B3 <= 150)\n## The total demand for Product A and Product B.\nmodel.addCons(A1 + A2 + A3 >= 200)\nmodel.addCons(B1 + B2 + B3 >= 250)\n## The company has a policy to ensure that at least 30% of the total production in each factory is Product A.\nmodel.addCons(A1 >= 0.3 * (A1 + B1))\nmodel.addCons(A2 >= 0.3 * (A2 + B2))\nmodel.addCons(A3 >= 0.3 * (A3 + B3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A produced in Factory 1: \", model.getVal(A1))\n    print(\"Units of Product A produced in Factory 2: \", model.getVal(A2))\n    print(\"Units of Product A produced in Factory 3: \", model.getVal(A3))\n    print(\"Units of Product B produced in Factory 1: \", model.getVal(B1))\n    print(\"Units of Product B produced in Factory 2: \", model.getVal(B2))\n    print(\"Units of Product B produced in Factory 3: \", model.getVal(B3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\n// A_sold >= 200\n// B_sold >= 300\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the profit per unit for each product.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n| C       | 40$             |\n\nThe production capacity of the factory limits the total number of units that can be produced daily to 1000 units. The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily. The company can only sell as many units as it produces. \n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\nmodel.addCons(A_sold >= 200)\nmodel.addCons(B_sold >= 300)\n## The company can only sell as many units as it produces.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\n// A_sold >= 200\n// B_sold >= 300\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory limits the total number of units that can be produced daily to 1000 units. The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily. The company can only sell as many units as it produces. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\nmodel.addCons(A_sold >= 200)\nmodel.addCons(B_sold >= 300)\n## The company can only sell as many units as it produces.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in units\": \"capacity\", \"range\": \"capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize its daily profit from the production and sale of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe total daily production cannot exceed the production capacity of 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units per day.\n// B >= 50\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $30             |\n| C       | $40             |\n\nThe company has a daily production capacity of 500 units. The market demand for product A is at least 100 units per day, and for product B, it is at least 50 units per day but not more than 200 units per day. \n\nPlease help the company to maximize its daily profit from the production and sale of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The total daily production cannot exceed the production capacity of 500 units.\nmodel.addCons(A + B + C <= 500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units per day.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in units\": \"capacity\", \"range\": \"capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize its daily profit from the production and sale of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe total daily production cannot exceed the production capacity of 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units per day.\n// B >= 50\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints. The profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize its daily profit from the production and sale of these products. The total daily production cannot exceed the production capacity of 500 units. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The total daily production cannot exceed the production capacity of 500 units.\nmodel.addCons(A + B + C <= 500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units per day.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to deploy from three different depots (Depot A, Depot B, and Depot C) to two major distribution centers (Center X and Center Y). The company needs to determine how many trucks to send from each depot to each distribution center.\n// {\"number of trucks from Depot A to Center X\": \"A_X\", \"range\": \"A_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot A to Center Y\": \"A_Y\", \"range\": \"A_Y >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot B to Center X\": \"B_X\", \"range\": \"B_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot B to Center Y\": \"B_Y\", \"range\": \"B_Y >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot C to Center X\": \"C_X\", \"range\": \"C_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot C to Center Y\": \"C_Y\", \"range\": \"C_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck from Depot A to Center X is $500, to Center Y is $600. From Depot B, the cost is $450 to Center X and $550 to Center Y. From Depot C, the cost is $550 to Center X and $450 to Center Y. The company aims to minimize the total cost of truck deployment.\n// Objective Function: Minimize: 500*A_X + 600*A_Y + 450*B_X + 550*B_Y + 550*C_X + 450*C_Y\n\n## Generate Constraint-1:\nEach depot has a limited number of trucks available for deployment. Depot A has 100 trucks, Depot B has 120 trucks, and Depot C has 80 trucks.\n// A_X + A_Y <= 100\n// B_X + B_Y <= 120\n// C_X + C_Y <= 80\n\n## Generate Constraint-2:\nCenter X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week.\n// A_X + B_X + C_X >= 150\n// A_Y + B_Y + C_Y >= 180\n\n## Generate Constraint-3:\nThe total number of trucks deployed from all depots should not exceed 300 trucks per week.\n// A_X + A_Y + B_X + B_Y + C_X + C_Y <= 300",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to deploy from three different depots (Depot A, Depot B, and Depot C) to two major distribution centers (Center X and Center Y). The company needs to determine how many trucks to send from each depot to each distribution center. The cost of sending a truck from each depot to each center is given in the following Table.\n\n| From Depot | To Center X | To Center Y |\n|------------|-------------|-------------|\n| Depot A    | $500        | $600        |\n| Depot B    | $450        | $550        |\n| Depot C    | $550        | $450        |\n\nEach depot has a limited number of trucks available for deployment. Depot A has 100 trucks, Depot B has 120 trucks, and Depot C has 80 trucks. Center X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week. The total number of trucks deployed from all depots should not exceed 300 trucks per week.\n\nPlease help the company to minimize the total cost of truck deployment.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks from each depot to each distribution center\nA_X = model.addVar(vtype=\"INTEGER\", name=\"A_X\", lb=0) # number of trucks from Depot A to Center X\nA_Y = model.addVar(vtype=\"INTEGER\", name=\"A_Y\", lb=0) # number of trucks from Depot A to Center Y\nB_X = model.addVar(vtype=\"INTEGER\", name=\"B_X\", lb=0) # number of trucks from Depot B to Center X\nB_Y = model.addVar(vtype=\"INTEGER\", name=\"B_Y\", lb=0) # number of trucks from Depot B to Center Y\nC_X = model.addVar(vtype=\"INTEGER\", name=\"C_X\", lb=0) # number of trucks from Depot C to Center X\nC_Y = model.addVar(vtype=\"INTEGER\", name=\"C_Y\", lb=0) # number of trucks from Depot C to Center Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*A_X + 600*A_Y + 450*B_X + 550*B_Y + 550*C_X + 450*C_Y)\n\n# Add constraints\n## Each depot has a limited number of trucks available for deployment.\nmodel.addCons(A_X + A_Y <= 100)\nmodel.addCons(B_X + B_Y <= 120)\nmodel.addCons(C_X + C_Y <= 80)\n## Center X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week.\nmodel.addCons(A_X + B_X + C_X >= 150)\nmodel.addCons(A_Y + B_Y + C_Y >= 180)\n## The total number of trucks deployed from all depots should not exceed 300 trucks per week.\nmodel.addCons(A_X + A_Y + B_X + B_Y + C_X + C_Y <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks from Depot A to Center X: \", model.getVal(A_X))\n    print(\"Number of trucks from Depot A to Center Y: \", model.getVal(A_Y))\n    print(\"Number of trucks from Depot B to Center X: \", model.getVal(B_X))\n    print(\"Number of trucks from Depot B to Center Y: \", model.getVal(B_Y))\n    print(\"Number of trucks from Depot C to Center X: \", model.getVal(C_X))\n    print(\"Number of trucks from Depot C to Center Y: \", model.getVal(C_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to deploy from three different depots (Depot A, Depot B, and Depot C) to two major distribution centers (Center X and Center Y). The company needs to determine how many trucks to send from each depot to each distribution center.\n// {\"number of trucks from Depot A to Center X\": \"A_X\", \"range\": \"A_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot A to Center Y\": \"A_Y\", \"range\": \"A_Y >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot B to Center X\": \"B_X\", \"range\": \"B_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot B to Center Y\": \"B_Y\", \"range\": \"B_Y >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot C to Center X\": \"C_X\", \"range\": \"C_X >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from Depot C to Center Y\": \"C_Y\", \"range\": \"C_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck from Depot A to Center X is $500, to Center Y is $600. From Depot B, the cost is $450 to Center X and $550 to Center Y. From Depot C, the cost is $550 to Center X and $450 to Center Y. The company aims to minimize the total cost of truck deployment.\n// Objective Function: Minimize: 500*A_X + 600*A_Y + 450*B_X + 550*B_Y + 550*C_X + 450*C_Y\n\n## Generate Constraint-1:\nEach depot has a limited number of trucks available for deployment. Depot A has 100 trucks, Depot B has 120 trucks, and Depot C has 80 trucks.\n// A_X + A_Y <= 100\n// B_X + B_Y <= 120\n// C_X + C_Y <= 80\n\n## Generate Constraint-2:\nCenter X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week.\n// A_X + B_X + C_X >= 150\n// A_Y + B_Y + C_Y >= 180\n\n## Generate Constraint-3:\nThe total number of trucks deployed from all depots should not exceed 300 trucks per week.\n// A_X + A_Y + B_X + B_Y + C_X + C_Y <= 300",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to deploy from three different depots (Depot A, Depot B, and Depot C) to two major distribution centers (Center X and Center Y). The company needs to determine how many trucks to send from each depot to each distribution center.\nThe cost of sending a truck from Depot A to Center X is $500, to Center Y is $600. From Depot B, the cost is $450 to Center X and $550 to Center Y. From Depot C, the cost is $550 to Center X and $450 to Center Y. The company aims to minimize the total cost of truck deployment.\nEach depot has a limited number of trucks available for deployment. Depot A has 100 trucks, Depot B has 120 trucks, and Depot C has 80 trucks. Center X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week. The total number of trucks deployed from all depots should not exceed 300 trucks per week.\nPlease help the company to minimize the total cost of truck deployment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks from each depot to each distribution center\nA_X = model.addVar(vtype=\"INTEGER\", name=\"A_X\", lb=0) # number of trucks from Depot A to Center X\nA_Y = model.addVar(vtype=\"INTEGER\", name=\"A_Y\", lb=0) # number of trucks from Depot A to Center Y\nB_X = model.addVar(vtype=\"INTEGER\", name=\"B_X\", lb=0) # number of trucks from Depot B to Center X\nB_Y = model.addVar(vtype=\"INTEGER\", name=\"B_Y\", lb=0) # number of trucks from Depot B to Center Y\nC_X = model.addVar(vtype=\"INTEGER\", name=\"C_X\", lb=0) # number of trucks from Depot C to Center X\nC_Y = model.addVar(vtype=\"INTEGER\", name=\"C_Y\", lb=0) # number of trucks from Depot C to Center Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*A_X + 600*A_Y + 450*B_X + 550*B_Y + 550*C_X + 450*C_Y)\n\n# Add constraints\n## Each depot has a limited number of trucks available for deployment.\nmodel.addCons(A_X + A_Y <= 100)\nmodel.addCons(B_X + B_Y <= 120)\nmodel.addCons(C_X + C_Y <= 80)\n## Center X requires at least 150 trucks per week, and Center Y requires at least 180 trucks per week.\nmodel.addCons(A_X + B_X + C_X >= 150)\nmodel.addCons(A_Y + B_Y + C_Y >= 180)\n## The total number of trucks deployed from all depots should not exceed 300 trucks per week.\nmodel.addCons(A_X + A_Y + B_X + B_Y + C_X + C_Y <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks from Depot A to Center X: \", model.getVal(A_X))\n    print(\"Number of trucks from Depot A to Center Y: \", model.getVal(A_Y))\n    print(\"Number of trucks from Depot B to Center X: \", model.getVal(B_X))\n    print(\"Number of trucks from Depot B to Center Y: \", model.getVal(B_Y))\n    print(\"Number of trucks from Depot C to Center X: \", model.getVal(C_X))\n    print(\"Number of trucks from Depot C to Center Y: \", model.getVal(C_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. The following table summarizes the labor and raw material requirements for each product:\n\n| Product | Profit per Unit | Labor per Unit | Raw Material per Unit |\n|---------|-----------------|----------------|-----------------------|\n| A       | $50             | 2 hours        | 5 units               |\n| B       | $30             | 1 hour         | 3 units               |\n| C       | $40             | 3 hours        | 4 units               |\n\nThe company has 8 hours of labor available per day and 100 units of raw material available per day. The total labor hours used per day should not exceed 8 hours, and the total raw material used per day should not exceed 100 units. The market demand for product A is at least 1 unit per day. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours. Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units. The market demand for product A is at least 1 unit per day. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes between three cities: City A, City B, and City C. The company needs to decide the number of trucks to dispatch from each city to the others to minimize the total fuel cost while ensuring all deliveries are made.\n// {\"number of trucks dispatched from City A to City B\": \"T_AB\", \"range\": \"T_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City A to City C\": \"T_AC\", \"range\": \"T_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City B to City A\": \"T_BA\", \"range\": \"T_BA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City B to City C\": \"T_BC\", \"range\": \"T_BC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City C to City A\": \"T_CA\", \"range\": \"T_CA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City C to City B\": \"T_CB\", \"range\": \"T_CB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for each truck traveling from City A to City B is $500, from City A to City C is $600, from City B to City A is $550, from City B to City C is $450, from City C to City A is $650, and from City C to City B is $400. The company aims to minimize the total fuel cost of all truck movements.\n// Objective Function: Minimize: 500*T_AB + 600*T_AC + 550*T_BA + 450*T_BC + 650*T_CA + 400*T_CB\n\n## Generate Constraint-1:\nThe total number of trucks dispatched from each city must not exceed 100.\n// T_AB + T_AC <= 100\n// T_BA + T_BC <= 100\n// T_CA + T_CB <= 100\n\n## Generate Constraint-2:\nThe total number of trucks arriving at each city must meet the city's demand of 150 trucks.\n// T_AB + T_BA + T_CA = 150\n// T_AC + T_BC + T_CB = 150\n\n## Generate Constraint-3:\nThe number of trucks dispatched from each city must be non-negative.\n// T_AB >= 0, T_AC >= 0, T_BA >= 0, T_BC >= 0, T_CA >= 0, T_CB >= 0",
        "question": "A logistics company is planning to optimize its delivery routes between three cities: City A, City B, and City C. The company needs to decide the number of trucks to dispatch from each city to the others to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost for each truck traveling between cities is given in the following Table.\n\n| From/To | City B | City C |\n|---------|--------|--------|\n| City A  | 500$   | 600$   |\n| City B  | 550$   | 450$   |\n| City C  | 650$   | 400$   |\n\nThe total number of trucks dispatched from each city must not exceed 100. The total number of trucks arriving at each city must meet the city's demand of 150 trucks. The number of trucks dispatched from each city must be non-negative.\n\nPlease help the company to minimize the total fuel cost of all truck movements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks dispatched from each city to the others\nT_AB = model.addVar(vtype=\"INTEGER\", name=\"T_AB\", lb=0) # number of trucks dispatched from City A to City B\nT_AC = model.addVar(vtype=\"INTEGER\", name=\"T_AC\", lb=0) # number of trucks dispatched from City A to City C\nT_BA = model.addVar(vtype=\"INTEGER\", name=\"T_BA\", lb=0) # number of trucks dispatched from City B to City A\nT_BC = model.addVar(vtype=\"INTEGER\", name=\"T_BC\", lb=0) # number of trucks dispatched from City B to City C\nT_CA = model.addVar(vtype=\"INTEGER\", name=\"T_CA\", lb=0) # number of trucks dispatched from City C to City A\nT_CB = model.addVar(vtype=\"INTEGER\", name=\"T_CB\", lb=0) # number of trucks dispatched from City C to City B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*T_AB + 600*T_AC + 550*T_BA + 450*T_BC + 650*T_CA + 400*T_CB)\n\n# Add constraints\n## The total number of trucks dispatched from each city must not exceed 100.\nmodel.addCons(T_AB + T_AC <= 100)\nmodel.addCons(T_BA + T_BC <= 100)\nmodel.addCons(T_CA + T_CB <= 100)\n## The total number of trucks arriving at each city must meet the city's demand of 150 trucks.\nmodel.addCons(T_AB + T_BA + T_CA == 150)\nmodel.addCons(T_AC + T_BC + T_CB == 150)\n## The number of trucks dispatched from each city must be non-negative.\nmodel.addCons(T_AB >= 0)\nmodel.addCons(T_AC >= 0)\nmodel.addCons(T_BA >= 0)\nmodel.addCons(T_BC >= 0)\nmodel.addCons(T_CA >= 0)\nmodel.addCons(T_CB >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks dispatched from City A to City B: \", model.getVal(T_AB))\n    print(\"Number of trucks dispatched from City A to City C: \", model.getVal(T_AC))\n    print(\"Number of trucks dispatched from City B to City A: \", model.getVal(T_BA))\n    print(\"Number of trucks dispatched from City B to City C: \", model.getVal(T_BC))\n    print(\"Number of trucks dispatched from City C to City A: \", model.getVal(T_CA))\n    print(\"Number of trucks dispatched from City C to City B: \", model.getVal(T_CB))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes between three cities: City A, City B, and City C. The company needs to decide the number of trucks to dispatch from each city to the others to minimize the total fuel cost while ensuring all deliveries are made.\n// {\"number of trucks dispatched from City A to City B\": \"T_AB\", \"range\": \"T_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City A to City C\": \"T_AC\", \"range\": \"T_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City B to City A\": \"T_BA\", \"range\": \"T_BA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City B to City C\": \"T_BC\", \"range\": \"T_BC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City C to City A\": \"T_CA\", \"range\": \"T_CA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks dispatched from City C to City B\": \"T_CB\", \"range\": \"T_CB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for each truck traveling from City A to City B is $500, from City A to City C is $600, from City B to City A is $550, from City B to City C is $450, from City C to City A is $650, and from City C to City B is $400. The company aims to minimize the total fuel cost of all truck movements.\n// Objective Function: Minimize: 500*T_AB + 600*T_AC + 550*T_BA + 450*T_BC + 650*T_CA + 400*T_CB\n\n## Generate Constraint-1:\nThe total number of trucks dispatched from each city must not exceed 100.\n// T_AB + T_AC <= 100\n// T_BA + T_BC <= 100\n// T_CA + T_CB <= 100\n\n## Generate Constraint-2:\nThe total number of trucks arriving at each city must meet the city's demand of 150 trucks.\n// T_AB + T_BA + T_CA = 150\n// T_AC + T_BC + T_CB = 150\n\n## Generate Constraint-3:\nThe number of trucks dispatched from each city must be non-negative.\n// T_AB >= 0, T_AC >= 0, T_BA >= 0, T_BC >= 0, T_CA >= 0, T_CB >= 0",
        "question": "A logistics company is planning to optimize its delivery routes between three cities: City A, City B, and City C. The company needs to decide the number of trucks to dispatch from each city to the others to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost for each truck traveling from City A to City B is $500, from City A to City C is $600, from City B to City A is $550, from City B to City C is $450, from City C to City A is $650, and from City C to City B is $400. The company aims to minimize the total fuel cost of all truck movements. The total number of trucks dispatched from each city must not exceed 100. The total number of trucks arriving at each city must meet the city's demand of 150 trucks. The number of trucks dispatched from each city must be non-negative. Please help the company to determine the optimal number of trucks to dispatch from each city to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks dispatched from each city to the others\nT_AB = model.addVar(vtype=\"INTEGER\", name=\"T_AB\", lb=0) # number of trucks dispatched from City A to City B\nT_AC = model.addVar(vtype=\"INTEGER\", name=\"T_AC\", lb=0) # number of trucks dispatched from City A to City C\nT_BA = model.addVar(vtype=\"INTEGER\", name=\"T_BA\", lb=0) # number of trucks dispatched from City B to City A\nT_BC = model.addVar(vtype=\"INTEGER\", name=\"T_BC\", lb=0) # number of trucks dispatched from City B to City C\nT_CA = model.addVar(vtype=\"INTEGER\", name=\"T_CA\", lb=0) # number of trucks dispatched from City C to City A\nT_CB = model.addVar(vtype=\"INTEGER\", name=\"T_CB\", lb=0) # number of trucks dispatched from City C to City B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*T_AB + 600*T_AC + 550*T_BA + 450*T_BC + 650*T_CA + 400*T_CB)\n\n# Add constraints\n## The total number of trucks dispatched from each city must not exceed 100.\nmodel.addCons(T_AB + T_AC <= 100)\nmodel.addCons(T_BA + T_BC <= 100)\nmodel.addCons(T_CA + T_CB <= 100)\n## The total number of trucks arriving at each city must meet the city's demand of 150 trucks.\nmodel.addCons(T_AB + T_BA + T_CA == 150)\nmodel.addCons(T_AC + T_BC + T_CB == 150)\n## The number of trucks dispatched from each city must be non-negative.\nmodel.addCons(T_AB >= 0)\nmodel.addCons(T_AC >= 0)\nmodel.addCons(T_BA >= 0)\nmodel.addCons(T_BC >= 0)\nmodel.addCons(T_CA >= 0)\nmodel.addCons(T_CB >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks dispatched from City A to City B: \", model.getVal(T_AB))\n    print(\"Number of trucks dispatched from City A to City C: \", model.getVal(T_AC))\n    print(\"Number of trucks dispatched from City B to City A: \", model.getVal(T_BA))\n    print(\"Number of trucks dispatched from City B to City C: \", model.getVal(T_BC))\n    print(\"Number of trucks dispatched from City C to City A: \", model.getVal(T_CA))\n    print(\"Number of trucks dispatched from City C to City B: \", model.getVal(T_CB))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit while considering the availability of raw materials and production capacity.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product C\": \"raw_C\", \"range\": \"raw_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $10, $15, and $20, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units. Each unit of Product A, B, and C requires 2, 3, and 4 units of raw material, respectively.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The manufacturer can produce at most 200 units of Product A, 150 units of Product B, and 100 units of Product C.\n// A <= 200\n// B <= 150\n// C <= 100\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product C, it is at most 80 units.\n// A >= 50\n// C <= 80",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit while considering the availability of raw materials and production capacity. The profit per unit of Product A, B, and C is $10, $15, and $20, respectively. Each unit of Product A, B, and C requires 2, 3, and 4 units of raw material, respectively. The following table summarizes the constraints and requirements:\n\n| Product | Profit per Unit | Raw Material Required per Unit | Production Capacity | Market Demand |\n|---------|-----------------|--------------------------------|---------------------|---------------|\n| A       | $10             | 2 units                        | 200 units           | At least 50   |\n| B       | $15             | 3 units                        | 150 units           | No specific   |\n| C       | $20             | 4 units                        | 100 units           | At most 80    |\n\nThe total amount of raw material available is 1000 units. The manufacturer aims to maximize the total profit from the production of these products. Please help the manufacturer determine the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n## The quantity of raw material used for each product\nraw_A = model.addVar(vtype=\"INTEGER\", name=\"raw_A\", lb=0) # quantity of raw material used for Product A\nraw_B = model.addVar(vtype=\"INTEGER\", name=\"raw_B\", lb=0) # quantity of raw material used for Product B\nraw_C = model.addVar(vtype=\"INTEGER\", name=\"raw_C\", lb=0) # quantity of raw material used for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The production capacity for each product is limited.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 100)\n## The market demand for Product A is at least 50 units, and for Product C, it is at most 80 units.\nmodel.addCons(A >= 50)\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit while considering the availability of raw materials and production capacity.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material used for Product C\": \"raw_C\", \"range\": \"raw_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $10, $15, and $20, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units. Each unit of Product A, B, and C requires 2, 3, and 4 units of raw material, respectively.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The manufacturer can produce at most 200 units of Product A, 150 units of Product B, and 100 units of Product C.\n// A <= 200\n// B <= 150\n// C <= 100\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product C, it is at most 80 units.\n// A >= 50\n// C <= 80",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit while considering the availability of raw materials and production capacity. The profit per unit of Product A, B, and C is $10, $15, and $20, respectively. The total amount of raw material available is 1000 units, with each unit of Product A, B, and C requiring 2, 3, and 4 units of raw material, respectively. The manufacturer can produce at most 200 units of Product A, 150 units of Product B, and 100 units of Product C. The market demand for Product A is at least 50 units, and for Product C, it is at most 80 units. Please help the manufacturer to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n## The quantity of raw material used for each product\nraw_A = model.addVar(vtype=\"INTEGER\", name=\"raw_A\", lb=0) # quantity of raw material used for Product A\nraw_B = model.addVar(vtype=\"INTEGER\", name=\"raw_B\", lb=0) # quantity of raw material used for Product B\nraw_C = model.addVar(vtype=\"INTEGER\", name=\"raw_C\", lb=0) # quantity of raw material used for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The production capacity for each product is limited.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 100)\n## The market demand for Product A is at least 50 units, and for Product C, it is at most 80 units.\nmodel.addCons(A >= 50)\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 785,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different routes (Route 1 and Route 2). The decision also includes whether to use a particular truck type on a specific route.\n// {\"whether to use Truck A on Route 1\": \"use_A1\", \"range\": \"use_A1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck A on Route 2\": \"use_A2\", \"range\": \"use_A2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck B on Route 1\": \"use_B1\", \"range\": \"use_B1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck B on Route 2\": \"use_B2\", \"range\": \"use_B2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck C on Route 1\": \"use_C1\", \"range\": \"use_C1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck C on Route 2\": \"use_C2\", \"range\": \"use_C2 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe cost of using Truck A, B, and C on Route 1 is $500, $600, and $700 respectively. The cost of using these trucks on Route 2 is $400, $500, and $600 respectively. The company aims to minimize the total operational cost of the trucks on both routes.\n// Objective Function: Minimize: 500*use_A1 + 400*use_A2 + 600*use_B1 + 500*use_B2 + 700*use_C1 + 600*use_C2\n\n## Generate Constraint-1:\nEach route must be covered by at least one type of truck.\n// use_A1 + use_B1 + use_C1 >= 1\n// use_A2 + use_B2 + use_C2 >= 1\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3.\n// use_A1 + use_A2 + use_B1 + use_B2 + use_C1 + use_C2 <= 3\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one truck of each type is used across both routes.\n// use_A1 + use_A2 >= 1\n// use_B1 + use_B2 >= 1\n// use_C1 + use_C2 >= 1",
        "question": "A logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different routes (Route 1 and Route 2). The decision also includes whether to use a particular truck type on a specific route. The cost of using each truck type on each route is given in the following Table.\n\n| Truck Type | Route 1 Cost | Route 2 Cost |\n|------------|--------------|--------------|\n| Truck A    | $500         | $400         |\n| Truck B    | $600         | $500         |\n| Truck C    | $700         | $600         |\n\nThe company aims to minimize the total operational cost of the trucks on both routes. Each route must be covered by at least one type of truck. The company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3. The company also wants to ensure that at least one truck of each type is used across both routes. Please help the company determine the optimal usage of each truck type on each route to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each type of truck on each route\nuse_A1 = model.addVar(vtype=\"B\", name=\"use_A1\") # whether to use Truck A on Route 1\nuse_A2 = model.addVar(vtype=\"B\", name=\"use_A2\") # whether to use Truck A on Route 2\nuse_B1 = model.addVar(vtype=\"B\", name=\"use_B1\") # whether to use Truck B on Route 1\nuse_B2 = model.addVar(vtype=\"B\", name=\"use_B2\") # whether to use Truck B on Route 2\nuse_C1 = model.addVar(vtype=\"B\", name=\"use_C1\") # whether to use Truck C on Route 1\nuse_C2 = model.addVar(vtype=\"B\", name=\"use_C2\") # whether to use Truck C on Route 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*use_A1 + 400*use_A2 + 600*use_B1 + 500*use_B2 + 700*use_C1 + 600*use_C2)\n\n# Add constraints\n## Each route must be covered by at least one type of truck.\nmodel.addCons(use_A1 + use_B1 + use_C1 >= 1)\nmodel.addCons(use_A2 + use_B2 + use_C2 >= 1)\n## The company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3.\nmodel.addCons(use_A1 + use_A2 + use_B1 + use_B2 + use_C1 + use_C2 <= 3)\n## The company wants to ensure that at least one truck of each type is used across both routes.\nmodel.addCons(use_A1 + use_A2 >= 1)\nmodel.addCons(use_B1 + use_B2 >= 1)\nmodel.addCons(use_C1 + use_C2 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Truck A on Route 1: \", model.getVal(use_A1))\n    print(\"Whether to use Truck A on Route 2: \", model.getVal(use_A2))\n    print(\"Whether to use Truck B on Route 1: \", model.getVal(use_B1))\n    print(\"Whether to use Truck B on Route 2: \", model.getVal(use_B2))\n    print(\"Whether to use Truck C on Route 1: \", model.getVal(use_C1))\n    print(\"Whether to use Truck C on Route 2: \", model.getVal(use_C2))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different routes (Route 1 and Route 2). The decision also includes whether to use a particular truck type on a specific route.\n// {\"whether to use Truck A on Route 1\": \"use_A1\", \"range\": \"use_A1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck A on Route 2\": \"use_A2\", \"range\": \"use_A2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck B on Route 1\": \"use_B1\", \"range\": \"use_B1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck B on Route 2\": \"use_B2\", \"range\": \"use_B2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck C on Route 1\": \"use_C1\", \"range\": \"use_C1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Truck C on Route 2\": \"use_C2\", \"range\": \"use_C2 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe cost of using Truck A, B, and C on Route 1 is $500, $600, and $700 respectively. The cost of using these trucks on Route 2 is $400, $500, and $600 respectively. The company aims to minimize the total operational cost of the trucks on both routes.\n// Objective Function: Minimize: 500*use_A1 + 400*use_A2 + 600*use_B1 + 500*use_B2 + 700*use_C1 + 600*use_C2\n\n## Generate Constraint-1:\nEach route must be covered by at least one type of truck.\n// use_A1 + use_B1 + use_C1 >= 1\n// use_A2 + use_B2 + use_C2 >= 1\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3.\n// use_A1 + use_A2 + use_B1 + use_B2 + use_C1 + use_C2 <= 3\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one truck of each type is used across both routes.\n// use_A1 + use_A2 >= 1\n// use_B1 + use_B2 >= 1\n// use_C1 + use_C2 >= 1",
        "question": "A logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different routes (Route 1 and Route 2). The decision also includes whether to use a particular truck type on a specific route.\nThe cost of using Truck A, B, and C on Route 1 is $500, $600, and $700 respectively. The cost of using these trucks on Route 2 is $400, $500, and $600 respectively. The company aims to minimize the total operational cost of the trucks on both routes.\nEach route must be covered by at least one type of truck. The company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3. The company wants to ensure that at least one truck of each type is used across both routes.\nPlease help the company determine the optimal usage of each truck type on both routes to minimize the total operational cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each type of truck on each route\nuse_A1 = model.addVar(vtype=\"B\", name=\"use_A1\") # whether to use Truck A on Route 1\nuse_A2 = model.addVar(vtype=\"B\", name=\"use_A2\") # whether to use Truck A on Route 2\nuse_B1 = model.addVar(vtype=\"B\", name=\"use_B1\") # whether to use Truck B on Route 1\nuse_B2 = model.addVar(vtype=\"B\", name=\"use_B2\") # whether to use Truck B on Route 2\nuse_C1 = model.addVar(vtype=\"B\", name=\"use_C1\") # whether to use Truck C on Route 1\nuse_C2 = model.addVar(vtype=\"B\", name=\"use_C2\") # whether to use Truck C on Route 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500*use_A1 + 400*use_A2 + 600*use_B1 + 500*use_B2 + 700*use_C1 + 600*use_C2)\n\n# Add constraints\n## Each route must be covered by at least one type of truck.\nmodel.addCons(use_A1 + use_B1 + use_C1 >= 1)\nmodel.addCons(use_A2 + use_B2 + use_C2 >= 1)\n## The company has a budget constraint that limits the total number of trucks used across both routes to a maximum of 3.\nmodel.addCons(use_A1 + use_A2 + use_B1 + use_B2 + use_C1 + use_C2 <= 3)\n## The company wants to ensure that at least one truck of each type is used across both routes.\nmodel.addCons(use_A1 + use_A2 >= 1)\nmodel.addCons(use_B1 + use_B2 >= 1)\nmodel.addCons(use_C1 + use_C2 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Truck A on Route 1: \", model.getVal(use_A1))\n    print(\"Whether to use Truck A on Route 2: \", model.getVal(use_A2))\n    print(\"Whether to use Truck B on Route 1: \", model.getVal(use_B1))\n    print(\"Whether to use Truck B on Route 2: \", model.getVal(use_B2))\n    print(\"Whether to use Truck C on Route 1: \", model.getVal(use_C1))\n    print(\"Whether to use Truck C on Route 2: \", model.getVal(use_C2))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type varies, and there are constraints on the raw materials and labor hours available.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer aims to maximize the total weekly profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity for all products is 500 units per week.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\n// 2*A + 3*B + 4*C <= 1200\n\n## Generate Constraint-3:\nThe labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\n// A + 2*B + 3*C <= 600",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The production capacity, raw material requirements, and labor hours for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Capacity | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|-----------------------|----------------------|\n| A       | $50             | A + B + C <= 500    | 2 units               | 1 hour               |\n| B       | $70             |                      | 3 units               | 2 hours              |\n| C       | $60             |                      | 4 units               | 3 hours              |\n\nThe total production capacity for all products is 500 units per week. The total available raw material per week is 1200 units. The total available labor hours per week is 600 hours.\n\nPlease help the manufacturer to maximize the total weekly profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity for all products is 500 units per week.\nmodel.addCons(A + B + C <= 500)\n## The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1200)\n## The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\nmodel.addCons(A + 2*B + 3*C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type varies, and there are constraints on the raw materials and labor hours available.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer aims to maximize the total weekly profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity for all products is 500 units per week.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\n// 2*A + 3*B + 4*C <= 1200\n\n## Generate Constraint-3:\nThe labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\n// A + 2*B + 3*C <= 600",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The total production capacity for all products is 500 units per week. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units, with a total of 1200 units of raw material available per week. The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours, with a total of 600 labor hours available per week. Please help the manufacturer to maximize the total weekly profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity for all products is 500 units per week.\nmodel.addCons(A + B + C <= 500)\n## The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1200)\n## The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\nmodel.addCons(A + 2*B + 3*C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor\", \"range\": \"labor >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used daily\": \"material\", \"range\": \"material >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 units of raw material, and each unit of Product B requires 5 units of raw material. The company has a maximum of 200 units of raw material available daily.\n// 4*A + 5*B <= 200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily.\n// A >= 20\n// B >= 15",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $70. The following table summarizes the resource requirements for each product:\n\n| Product | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|----------------------|-----------------------------|\n| A       | 2                    | 4                           |\n| B       | 3                    | 5                           |\n\nThe company has a maximum of 120 hours of labor and 200 units of raw material available daily. The market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily. Please help the company to maximize the total daily profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 4 units of raw material, and each unit of Product B requires 5 units of raw material. The company has a maximum of 200 units of raw material available daily.\nmodel.addCons(4*A + 5*B <= 200)\n## The market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"labor\", \"range\": \"labor >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used daily\": \"material\", \"range\": \"material >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 units of raw material, and each unit of Product B requires 5 units of raw material. The company has a maximum of 200 units of raw material available daily.\n// 4*A + 5*B <= 200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily.\n// A >= 20\n// B >= 15",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $70. The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily. Each unit of Product A requires 4 units of raw material, and each unit of Product B requires 5 units of raw material. The company has a maximum of 200 units of raw material available daily. The market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily. Please help the company to maximize the total daily profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 4 units of raw material, and each unit of Product B requires 5 units of raw material. The company has a maximum of 200 units of raw material available daily.\nmodel.addCons(4*A + 5*B <= 200)\n## The market demand for Product A is at least 20 units daily, and for Product B is at least 15 units daily.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime_hours <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the minimum demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 100, 80, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n\n| Type of Bread | Profit per Loaf | Minimum Demand |\n|---------------|-----------------|----------------|\n| Wheat         | $3              | 100 loaves     |\n| Rye           | $4              | 80 loaves      |\n| Sourdough     | $5              | 50 loaves      |\n\nThe bakery has a daily production capacity of 500 loaves. The bakery can work up to 10 overtime hours per day. Please help the bakery to maximize its daily profit by determining the optimal number of loaves of each type of bread to produce and the number of overtime hours to work.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime_hours <= 10)\n## The bakery must meet the minimum demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime_hours <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the minimum demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 100, 80, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery has a daily production capacity of 500 loaves and can work up to 10 overtime hours per day. The bakery must meet the minimum demand for each type of bread, which is 100 loaves for wheat, 80 loaves for rye, and 50 loaves for sourdough. Please help the bakery to maximize its daily profit, which is the total profit from selling bread minus the overtime cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime_hours <= 10)\n## The bakery must meet the minimum demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"Labor_Hours\", \"range\": \"Labor_Hours = 100\", \"type\": \"integer\"}\n// {\"number of machine hours available daily\": \"Machine_Hours\", \"range\": \"Machine_Hours = 80\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used cannot exceed the available labor hours.\n// 2*A + 3*B + 4*C <= Labor_Hours\n\n## Generate Constraint-2:\nEach unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours. The total machine hours used cannot exceed the available machine hours.\n// A + 2*B + 3*C <= Machine_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\n// A >= 10\n// B >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table shows the labor and machine hours required for each product.\n\n| Product | Labor Hours per Unit | Machine Hours per Unit |\n|---------|----------------------|------------------------|\n| A       | 2                    | 1                      |\n| B       | 3                    | 2                      |\n| C       | 4                    | 3                      |\n\nThe company has 100 hours of labor and 80 machine hours available daily. The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day. The total labor hours used cannot exceed the available labor hours, and the total machine hours used cannot exceed the available machine hours. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n## The number of hours of labor and machine hours available daily\nLabor_Hours = 100\nMachine_Hours = 80\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= Labor_Hours)\n## Each unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours.\nmodel.addCons(A + 2*B + 3*C <= Machine_Hours)\n## The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"Labor_Hours\", \"range\": \"Labor_Hours = 100\", \"type\": \"integer\"}\n// {\"number of machine hours available daily\": \"Machine_Hours\", \"range\": \"Machine_Hours = 80\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used cannot exceed the available labor hours.\n// 2*A + 3*B + 4*C <= Labor_Hours\n\n## Generate Constraint-2:\nEach unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours. The total machine hours used cannot exceed the available machine hours.\n// A + 2*B + 3*C <= Machine_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\n// A >= 10\n// B >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. Each unit of product A requires 2 hours of labor and 1 machine hour, product B requires 3 hours of labor and 2 machine hours, and product C requires 4 hours of labor and 3 machine hours. The company has 100 hours of labor and 80 machine hours available daily. The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n## The number of hours of labor and machine hours available daily\nLabor_Hours = 100\nMachine_Hours = 80\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= Labor_Hours)\n## Each unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours.\nmodel.addCons(A + 2*B + 3*C <= Machine_Hours)\n## The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours Required per Unit |\n|---------|-------------------------------|\n| A       | 2 hours                       |\n| B       | 3 hours                       |\n| C       | 4 hours                       |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day. The combined production of products B and C should not exceed twice the production of product A. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed the available labor hours of 100 hours daily. The market demand for product A is at least 10 units per day. The combined production of products B and C should not exceed twice the production of product A. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily.\n// A <= 100\n// B <= 120\n// C <= 80\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively.\n// SA <= 80\n// SB <= 100\n// SC <= 70\n\n## Generate Constraint-3:\nThe company must ensure that the number of units sold does not exceed the number of units produced for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the production and market constraints:\n\n| Product | Production Capacity | Market Demand | Profit per Unit |\n|---------|---------------------|---------------|-----------------|\n| A       | 100 units           | 80 units      | $10             |\n| B       | 120 units           | 100 units     | $15             |\n| C       | 80 units            | 70 units      | $20             |\n\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily. The market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively. The company must ensure that the number of units sold does not exceed the number of units produced for each product.\n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\nmodel.addCons(C <= 80)\n## The market demand for products\nmodel.addCons(SA <= 80)\nmodel.addCons(SB <= 100)\nmodel.addCons(SC <= 70)\n## The number of units sold does not exceed the number of units produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily.\n// A <= 100\n// B <= 120\n// C <= 80\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively.\n// SA <= 80\n// SB <= 100\n// SC <= 70\n\n## Generate Constraint-3:\nThe company must ensure that the number of units sold does not exceed the number of units produced for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily. The market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively. The company must ensure that the number of units sold does not exceed the number of units produced for each product.\nPlease help the company to determine the optimal number of units of each product to produce and sell daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\nmodel.addCons(C <= 80)\n## The market demand for products\nmodel.addCons(SA <= 80)\nmodel.addCons(SB <= 100)\nmodel.addCons(SC <= 70)\n## The number of units sold does not exceed the number of units produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra staff hours\": \"extra_staff_hours\", \"range\": \"extra_staff_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n// Objective Function: Minimize: 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 50\n// sourdough_loaves >= 30\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\n// If (wheat_loaves + rye_loaves + sourdough_loaves) > 150, then extra_staff_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50\n// Otherwise, extra_staff_hours = 0",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1            |\n| Rye           | $1.50         |\n| Sourdough     | $2            |\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\n\nPlease help the bakery to determine the optimal number of wheat, rye, and sourdough bread loaves to produce daily, along with the necessary extra staff hours, to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_staff_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_staff_hours\", lb=0) # number of extra staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 50)\nmodel.addCons(sourdough_loaves >= 30)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves - 150) <= 0)\nmodel.addCons(extra_staff_hours >= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra staff hours: \", model.getVal(extra_staff_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra staff hours\": \"extra_staff_hours\", \"range\": \"extra_staff_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n// Objective Function: Minimize: 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 50\n// sourdough_loaves >= 30\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\n// If (wheat_loaves + rye_loaves + sourdough_loaves) > 150, then extra_staff_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50\n// Otherwise, extra_staff_hours = 0",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce and the necessary extra staff hours to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_staff_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_staff_hours\", lb=0) # number of extra staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 50)\nmodel.addCons(sourdough_loaves >= 30)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves - 150) <= 0)\nmodel.addCons(extra_staff_hours >= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra staff hours: \", model.getVal(extra_staff_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor required per unit of product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor required per unit of product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor required per unit of product C\": \"labor_C\", \"range\": \"labor_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\n// 2*A + 3*B + 4*C <= 800\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units, and for product C is at most 200 units.\n// A >= 100\n// C <= 200\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product B as product A.\n// B >= 2*A",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The labor requirements and market constraints are as follows:\n\n| Product | Profit per Unit | Labor Hours per Unit | Market Constraints |\n|---------|-----------------|----------------------|---------------------|\n| A       | $50             | 2 hours              | A >= 100           |\n| B       | $70             | 3 hours              | B >= 2*A           |\n| C       | $60             | 4 hours              | C <= 200           |\n\nThe total labor hours available per day are 800 hours. The company has a policy to produce at least twice as many units of product B as product A. Please help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 800)\n## The market demand for product A is at least 100 units, and for product C is at most 200 units.\nmodel.addCons(A >= 100)\nmodel.addCons(C <= 200)\n## The company has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor required per unit of product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor required per unit of product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor required per unit of product C\": \"labor_C\", \"range\": \"labor_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\n// 2*A + 3*B + 4*C <= 800\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units, and for product C is at most 200 units.\n// A >= 100\n// C <= 200\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product B as product A.\n// B >= 2*A",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total labor hours available per day are 800 hours. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The market demand for product A is at least 100 units, and for product C is at most 200 units. The company has a policy to produce at least twice as many units of product B as product A. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 800)\n## The market demand for product A is at least 100 units, and for product C is at most 200 units.\nmodel.addCons(A >= 100)\nmodel.addCons(C <= 200)\n## The company has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the cost of ingredients, the oven capacity, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours needed to produce more bread\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. The bakery has a fixed daily cost of $100 for utilities and labor. The bakery wants to minimize the total cost of production, including the cost of extra hours if the oven capacity is exceeded.\n// Production_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\n// Extra_Hour_Cost = 50*extra_hours\n// Objective Function: Minimize: Production_Cost + Extra_Hour_Cost\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand of 30 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread.\n// wheat_loaves >= 30\n// rye_loaves >= 20\n// sourdough_loaves >= 10\n\n## Generate Constraint-3:\nIf the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven. Each extra hour costs $50.\n// If (wheat_loaves + rye_loaves + sourdough_loaves > 100), then extra_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 100) / 10\n// else extra_hours = 0",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the cost of ingredients, the oven capacity, and the demand for each type of bread. The cost of producing each type of bread and the minimum demand for each are given in the following Table.\n\n| Type of Bread | Cost per Loaf | Minimum Demand |\n|---------------|---------------|----------------|\n| Wheat         | $1            | 30 loaves      |\n| Rye           | $2            | 20 loaves      |\n| Sourdough     | $3            | 10 loaves      |\n\nThe bakery has an oven capacity of 100 loaves per day. If the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven, with each extra hour costing $50. The bakery has a fixed daily cost of $100 for utilities and labor. \n\nPlease help the bakery to minimize the total cost of production, including the cost of extra hours if the oven capacity is exceeded.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_hours\", lb=0) # number of extra hours needed to produce more bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\nProduction_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\n## Extra_Hour_Cost = 50*extra_hours\nExtra_Hour_Cost = 50*extra_hours\nmodel.addCons(obj == Production_Cost + Extra_Hour_Cost)\n\n# Add constraints\n## The bakery has an oven capacity of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must meet a minimum demand of 30 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 30)\nmodel.addCons(rye_loaves >= 20)\nmodel.addCons(sourdough_loaves >= 10)\n## If the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven. Each extra hour costs $50.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves - 100) <= 10*extra_hours)\nmodel.addCons((100 - wheat_loaves - rye_loaves - sourdough_loaves) <= 10*(1 - extra_hours))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours: \", model.getVal(extra_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the cost of ingredients, the oven capacity, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours needed to produce more bread\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. The bakery has a fixed daily cost of $100 for utilities and labor. The bakery wants to minimize the total cost of production, including the cost of extra hours if the oven capacity is exceeded.\n// Production_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\n// Extra_Hour_Cost = 50*extra_hours\n// Objective Function: Minimize: Production_Cost + Extra_Hour_Cost\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand of 30 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread.\n// wheat_loaves >= 30\n// rye_loaves >= 20\n// sourdough_loaves >= 10\n\n## Generate Constraint-3:\nIf the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven. Each extra hour costs $50.\n// If (wheat_loaves + rye_loaves + sourdough_loaves > 100), then extra_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 100) / 10\n// else extra_hours = 0",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the cost of ingredients, the oven capacity, and the demand for each type of bread. The cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. The bakery has a fixed daily cost of $100 for utilities and labor. The bakery has an oven capacity of 100 loaves per day and must meet a minimum demand of 30 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread. If the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven, with each extra hour costing $50. Please help the bakery to minimize the total cost of production, including the cost of extra hours if the oven capacity is exceeded.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_hours\", lb=0) # number of extra hours needed to produce more bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\nProduction_Cost = 1*wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 100\n## Extra_Hour_Cost = 50*extra_hours\nExtra_Hour_Cost = 50*extra_hours\nmodel.addCons(obj == Production_Cost + Extra_Hour_Cost)\n\n# Add constraints\n## The bakery has an oven capacity of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must meet a minimum demand of 30 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 30)\nmodel.addCons(rye_loaves >= 20)\nmodel.addCons(sourdough_loaves >= 10)\n## If the total number of loaves produced exceeds the oven capacity, the bakery must pay for extra hours to use a secondary oven. Each extra hour costs $50.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves - 100) <= 10*extra_hours)\nmodel.addCons((100 - wheat_loaves - rye_loaves - sourdough_loaves) <= 10*(1 - extra_hours))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours: \", model.getVal(extra_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs.\n// {\"daily production of wheat bread\": \"wheat_prod\", \"range\": \"wheat_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"rye_prod\", \"range\": \"rye_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"sourdough_prod\", \"range\": \"sourdough_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of all bread types\": \"total_prod\", \"range\": \"total_prod = wheat_prod + rye_prod + sourdough_prod\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery aims to minimize the total production cost while meeting the daily demand for each type of bread.\n// Objective Function: Minimize: 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod\n\n## Generate Constraint-1:\nThe bakery has a daily demand for wheat bread of at least 100 loaves.\n// wheat_prod >= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for rye bread of at least 80 loaves.\n// rye_prod >= 80\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread of at least 50 loaves.\n// sourdough_prod >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs. The cost of producing each type of bread is given in the following Table.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $0.5          |\n| Rye           | $0.7          |\n| Sourdough     | $1.0          |\n\nThe bakery has a daily demand for wheat bread of at least 100 loaves, for rye bread of at least 80 loaves, and for sourdough bread of at least 50 loaves. Please help the bakery to minimize the total production cost while meeting these daily demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nwheat_prod = model.addVar(vtype=\"INTEGER\", name=\"wheat_prod\", lb=0) # daily production of wheat bread\nrye_prod = model.addVar(vtype=\"INTEGER\", name=\"rye_prod\", lb=0) # daily production of rye bread\nsourdough_prod = model.addVar(vtype=\"INTEGER\", name=\"sourdough_prod\", lb=0) # daily production of sourdough bread\ntotal_prod = model.addVar(vtype=\"INTEGER\", name=\"total_prod\") # total daily production of all bread types\nmodel.addCons(total_prod == wheat_prod + rye_prod + sourdough_prod)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod)\n\n# Add constraints\n## The bakery has a daily demand for wheat bread of at least 100 loaves.\nmodel.addCons(wheat_prod >= 100)\n## The bakery has a daily demand for rye bread of at least 80 loaves.\nmodel.addCons(rye_prod >= 80)\n## The bakery has a daily demand for sourdough bread of at least 50 loaves.\nmodel.addCons(sourdough_prod >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(wheat_prod))\n    print(\"Daily production of rye bread: \", model.getVal(rye_prod))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_prod))\n    print(\"Total daily production: \", model.getVal(total_prod))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs.\n// {\"daily production of wheat bread\": \"wheat_prod\", \"range\": \"wheat_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"rye_prod\", \"range\": \"rye_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"sourdough_prod\", \"range\": \"sourdough_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of all bread types\": \"total_prod\", \"range\": \"total_prod = wheat_prod + rye_prod + sourdough_prod\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery aims to minimize the total production cost while meeting the daily demand for each type of bread.\n// Objective Function: Minimize: 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod\n\n## Generate Constraint-1:\nThe bakery has a daily demand for wheat bread of at least 100 loaves.\n// wheat_prod >= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for rye bread of at least 80 loaves.\n// rye_prod >= 80\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread of at least 50 loaves.\n// sourdough_prod >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs. The cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery has a daily demand for wheat bread of at least 100 loaves, a daily demand for rye bread of at least 80 loaves, and a daily demand for sourdough bread of at least 50 loaves. Please help the bakery to minimize the total production cost while meeting the daily demand for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nwheat_prod = model.addVar(vtype=\"INTEGER\", name=\"wheat_prod\", lb=0) # daily production of wheat bread\nrye_prod = model.addVar(vtype=\"INTEGER\", name=\"rye_prod\", lb=0) # daily production of rye bread\nsourdough_prod = model.addVar(vtype=\"INTEGER\", name=\"sourdough_prod\", lb=0) # daily production of sourdough bread\ntotal_prod = model.addVar(vtype=\"INTEGER\", name=\"total_prod\") # total daily production of all bread types\nmodel.addCons(total_prod == wheat_prod + rye_prod + sourdough_prod)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod)\n\n# Add constraints\n## The bakery has a daily demand for wheat bread of at least 100 loaves.\nmodel.addCons(wheat_prod >= 100)\n## The bakery has a daily demand for rye bread of at least 80 loaves.\nmodel.addCons(rye_prod >= 80)\n## The bakery has a daily demand for sourdough bread of at least 50 loaves.\nmodel.addCons(sourdough_prod >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(wheat_prod))\n    print(\"Daily production of rye bread: \", model.getVal(rye_prod))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_prod))\n    print(\"Total daily production: \", model.getVal(total_prod))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 643,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\n// A <= 50\n// B <= 70\n// C <= 60\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\n// SA >= 30\n// SB >= 40\n// SC >= 50\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the production and market demand constraints:\n\n| Product | Production Capacity | Market Demand |\n|---------|---------------------|---------------|\n| A       | 50 units            | 30 units      |\n| B       | 70 units            | 40 units      |\n| C       | 60 units            | 50 units      |\n\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively. The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands. Additionally, the company can only sell as many units as it produces. \n\nPlease help the company to maximize the total daily profit from selling these products, which is defined as 10*SA + 15*SB + 20*SC, where SA, SB, and SC are the number of units of products A, B, and C sold daily, respectively.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 70)\nmodel.addCons(C <= 60)\n## The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 40)\nmodel.addCons(SC >= 50)\n## The company can only sell as many units as it produces.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\n// A <= 50\n// B <= 70\n// C <= 60\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\n// SA >= 30\n// SB >= 40\n// SC >= 50\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively. The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands. The company can only sell as many units as it produces.\nPlease help the company to determine the optimal daily production and sales quantities for products A, B, and C to maximize their total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 70)\nmodel.addCons(C <= 60)\n## The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 40)\nmodel.addCons(SC >= 50)\n## The company can only sell as many units as it produces.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 873,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different delivery routes (Route 1 and Route 2).\n// {\"number of Truck A used\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B used\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C used\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of deliveries via Route 1\": \"Route1\", \"range\": \"Route1 >= 0\", \"type\": \"integer\"}\n// {\"number of deliveries via Route 2\": \"Route2\", \"range\": \"Route2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of using Truck A, Truck B, and Truck C is $500, $700, and $900 per day, respectively. The cost of operating on Route 1 and Route 2 is $300 and $400 per delivery, respectively. The company aims to minimize the total daily operational cost.\n// Truck_Cost = 500*TruckA + 700*TruckB + 900*TruckC\n// Route_Cost = 300*Route1 + 400*Route2\n// Objective Function: Minimize: Truck_Cost + Route_Cost\n\n## Generate Constraint-1:\nEach truck can handle a maximum of 10 deliveries per day.\n// TruckA <= 10\n// TruckB <= 10\n// TruckC <= 10\n\n## Generate Constraint-2:\nThe total number of deliveries on both routes must not exceed the total capacity of all trucks.\n// Route1 + Route2 <= TruckA + TruckB + TruckC\n\n## Generate Constraint-3:\nRoute 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day.\n// Route1 >= 20\n// Route2 >= 15",
        "question": "A logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different delivery routes (Route 1 and Route 2). The cost of using each type of truck and the cost of operating on each route are given in the following Table.\n\n| Truck/Route | Cost per Day/Delivery |\n|-------------|-----------------------|\n| Truck A     | $500                  |\n| Truck B     | $700                  |\n| Truck C     | $900                  |\n| Route 1     | $300 per delivery    |\n| Route 2     | $400 per delivery    |\n\nEach truck can handle a maximum of 10 deliveries per day. The total number of deliveries on both routes must not exceed the total capacity of all trucks. Route 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day. The company aims to minimize the total daily operational cost.\n\nPlease help the company determine the optimal number of each type of truck to use and the number of deliveries via each route to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of truck used and the number of deliveries via each route\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A used\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B used\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C used\nRoute1 = model.addVar(vtype=\"INTEGER\", name=\"Route1\", lb=0) # number of deliveries via Route 1\nRoute2 = model.addVar(vtype=\"INTEGER\", name=\"Route2\", lb=0) # number of deliveries via Route 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Truck_Cost = 500*TruckA + 700*TruckB + 900*TruckC\n## Route_Cost = 300*Route1 + 400*Route2\nmodel.addCons(obj == 500*TruckA + 700*TruckB + 900*TruckC + 300*Route1 + 400*Route2)\n\n# Add constraints\n## Each truck can handle a maximum of 10 deliveries per day.\nmodel.addCons(TruckA <= 10)\nmodel.addCons(TruckB <= 10)\nmodel.addCons(TruckC <= 10)\n## The total number of deliveries on both routes must not exceed the total capacity of all trucks.\nmodel.addCons(Route1 + Route2 <= TruckA + TruckB + TruckC)\n## Route 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day.\nmodel.addCons(Route1 >= 20)\nmodel.addCons(Route2 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A used: \", model.getVal(TruckA))\n    print(\"Number of Truck B used: \", model.getVal(TruckB))\n    print(\"Number of Truck C used: \", model.getVal(TruckC))\n    print(\"Number of deliveries via Route 1: \", model.getVal(Route1))\n    print(\"Number of deliveries via Route 2: \", model.getVal(Route2))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different delivery routes (Route 1 and Route 2).\n// {\"number of Truck A used\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B used\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C used\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of deliveries via Route 1\": \"Route1\", \"range\": \"Route1 >= 0\", \"type\": \"integer\"}\n// {\"number of deliveries via Route 2\": \"Route2\", \"range\": \"Route2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of using Truck A, Truck B, and Truck C is $500, $700, and $900 per day, respectively. The cost of operating on Route 1 and Route 2 is $300 and $400 per delivery, respectively. The company aims to minimize the total daily operational cost.\n// Truck_Cost = 500*TruckA + 700*TruckB + 900*TruckC\n// Route_Cost = 300*Route1 + 400*Route2\n// Objective Function: Minimize: Truck_Cost + Route_Cost\n\n## Generate Constraint-1:\nEach truck can handle a maximum of 10 deliveries per day.\n// TruckA <= 10\n// TruckB <= 10\n// TruckC <= 10\n\n## Generate Constraint-2:\nThe total number of deliveries on both routes must not exceed the total capacity of all trucks.\n// Route1 + Route2 <= TruckA + TruckB + TruckC\n\n## Generate Constraint-3:\nRoute 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day.\n// Route1 >= 20\n// Route2 >= 15",
        "question": "A logistics company is planning to optimize its delivery routes by selecting the best combination of trucks and routes. The company has three types of trucks (Truck A, Truck B, and Truck C) and needs to decide how many of each type to use for two different delivery routes (Route 1 and Route 2). The cost of using Truck A, Truck B, and Truck C is $500, $700, and $900 per day, respectively. The cost of operating on Route 1 and Route 2 is $300 and $400 per delivery, respectively. The company aims to minimize the total daily operational cost.\nEach truck can handle a maximum of 10 deliveries per day. The total number of deliveries on both routes must not exceed the total capacity of all trucks. Route 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day.\nPlease help the company determine the optimal number of each type of truck and the number of deliveries via each route to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of truck used and the number of deliveries via each route\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A used\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B used\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C used\nRoute1 = model.addVar(vtype=\"INTEGER\", name=\"Route1\", lb=0) # number of deliveries via Route 1\nRoute2 = model.addVar(vtype=\"INTEGER\", name=\"Route2\", lb=0) # number of deliveries via Route 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Truck_Cost = 500*TruckA + 700*TruckB + 900*TruckC\n## Route_Cost = 300*Route1 + 400*Route2\nmodel.addCons(obj == 500*TruckA + 700*TruckB + 900*TruckC + 300*Route1 + 400*Route2)\n\n# Add constraints\n## Each truck can handle a maximum of 10 deliveries per day.\nmodel.addCons(TruckA <= 10)\nmodel.addCons(TruckB <= 10)\nmodel.addCons(TruckC <= 10)\n## The total number of deliveries on both routes must not exceed the total capacity of all trucks.\nmodel.addCons(Route1 + Route2 <= TruckA + TruckB + TruckC)\n## Route 1 requires at least 20 deliveries per day, and Route 2 requires at least 15 deliveries per day.\nmodel.addCons(Route1 >= 20)\nmodel.addCons(Route2 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A used: \", model.getVal(TruckA))\n    print(\"Number of Truck B used: \", model.getVal(TruckB))\n    print(\"Number of Truck C used: \", model.getVal(TruckC))\n    print(\"Number of deliveries via Route 1: \", model.getVal(Route1))\n    print(\"Number of deliveries via Route 2: \", model.getVal(Route2))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor_hours\", \"range\": \"labor_hours = 8\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 1 hour of labor, product B requires 2 hours, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// A + 2*B + 3*C <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day. There is no minimum demand specified for product C.\n// A >= 2\n// B >= 1\n\n## Generate Constraint-3:\nThe company has a policy to produce at least as many units of product C as the combined production of products A and B.\n// C >= A + B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours Required per Unit |\n|---------|-------------------------------|\n| A       | 1                             |\n| B       | 2                             |\n| C       | 3                             |\n\nThe company has 8 hours of labor available per day. The market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day. The company has a policy to produce at least as many units of product C as the combined production of products A and B. \n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 1 hour of labor, product B requires 2 hours, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(A + 2*B + 3*C <= 8)\n## The market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day.\nmodel.addCons(A >= 2)\nmodel.addCons(B >= 1)\n## The company has a policy to produce at least as many units of product C as the combined production of products A and B.\nmodel.addCons(C >= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor_hours\", \"range\": \"labor_hours = 8\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 1 hour of labor, product B requires 2 hours, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// A + 2*B + 3*C <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day. There is no minimum demand specified for product C.\n// A >= 2\n// B >= 1\n\n## Generate Constraint-3:\nThe company has a policy to produce at least as many units of product C as the combined production of products A and B.\n// C >= A + B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. Each unit of product A requires 1 hour of labor, product B requires 2 hours, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours. The market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day. There is no minimum demand specified for product C. The company has a policy to produce at least as many units of product C as the combined production of products A and B. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 1 hour of labor, product B requires 2 hours, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(A + 2*B + 3*C <= 8)\n## The market demand for product A is at least 2 units per day, and for product B is at least 1 unit per day.\nmodel.addCons(A >= 2)\nmodel.addCons(B >= 1)\n## The company has a policy to produce at least as many units of product C as the combined production of products A and B.\nmodel.addCons(C >= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime\", \"range\": \"overtime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n// Production_Cost = wheat + 2*rye + 3*sourdough\n// Overtime_Cost = 50*overtime\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 loaves of bread.\n// wheat + rye + sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\n// wheat >= 100\n// rye >= 100\n// sourdough >= 100",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs. The cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1            |\n| Rye           | $2            |\n| Sourdough     | $3            |\n\nThe bakery has a daily capacity of 500 loaves of bread. The bakery can work up to 10 overtime hours per day. The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand. Please help the bakery determine the optimal number of loaves of each type of bread and the necessary overtime hours to minimize the total production and labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\novertime = model.addVar(vtype=\"INTEGER\", name=\"overtime\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = wheat + 2*rye + 3*sourdough\n## Overtime_Cost = 50*overtime\nmodel.addCons(obj == wheat + 2*rye + 3*sourdough + 50*overtime)\n\n# Add constraints\n## The bakery has a daily capacity of 500 loaves of bread.\nmodel.addCons(wheat + rye + sourdough <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime <= 10)\n## The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(wheat >= 100)\nmodel.addCons(rye >= 100)\nmodel.addCons(sourdough >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of overtime hours: \", model.getVal(overtime))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime\", \"range\": \"overtime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n// Production_Cost = wheat + 2*rye + 3*sourdough\n// Overtime_Cost = 50*overtime\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 loaves of bread.\n// wheat + rye + sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\n// wheat >= 100\n// rye >= 100\n// sourdough >= 100",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs. The cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs. The bakery has a daily capacity of 500 loaves of bread. The bakery can work up to 10 overtime hours per day. The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand. Please help the bakery determine the optimal number of loaves of each type of bread and the necessary overtime hours to minimize the total production and labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\novertime = model.addVar(vtype=\"INTEGER\", name=\"overtime\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = wheat + 2*rye + 3*sourdough\n## Overtime_Cost = 50*overtime\nmodel.addCons(obj == wheat + 2*rye + 3*sourdough + 50*overtime)\n\n# Add constraints\n## The bakery has a daily capacity of 500 loaves of bread.\nmodel.addCons(wheat + rye + sourdough <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime <= 10)\n## The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(wheat >= 100)\nmodel.addCons(rye >= 100)\nmodel.addCons(sourdough >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of overtime hours: \", model.getVal(overtime))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is at least 5 units per day.\n// B >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours Required per Unit |\n|---------|-------------------------------|\n| A       | 2 hours                       |\n| B       | 3 hours                       |\n| C       | 4 hours                       |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day, and for product B, it is at least 5 units per day. \n\nPlease help the company to maximize the total daily profit from the production of these products, ensuring that the total labor hours used do not exceed the available labor hours and that the market demand for each product is met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100) # The total labor hours used must not exceed the available labor hours.\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product B is at least 5 units per day.\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is at least 5 units per day.\n// B >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours of 100 hours daily. The market demand for product A is at least 10 units per day, and for product B is at least 5 units per day. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100) # The total labor hours used must not exceed the available labor hours.\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product B is at least 5 units per day.\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe first production stage has a capacity of 1000 hours, and it takes 2 hours to produce one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe second production stage has a capacity of 1200 hours, and it takes 1 hour to produce one unit of product A, 2 hours for product B, and 3 hours for product C.\n// A + 2*B + 3*C <= 1200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C.\n// A >= 100\n// B >= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the production times for each product at both stages:\n\n| Product | Production Time Stage 1 | Production Time Stage 2 |\n|---------|-------------------------|-------------------------|\n| A       | 2 hours                 | 1 hour                  |\n| B       | 3 hours                 | 2 hours                 |\n| C       | 4 hours                 | 3 hours                 |\n\nThe first production stage has a capacity of 1000 hours, and the second production stage has a capacity of 1200 hours. The market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C. \n\nPlease help the manufacturer to maximize the total profit from selling all products, considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The first production stage has a capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The second production stage has a capacity of 1200 hours\nmodel.addCons(A + 2*B + 3*C <= 1200)\n## The market demand for product A is at least 100 units, for product B is at least 200 units\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe first production stage has a capacity of 1000 hours, and it takes 2 hours to produce one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe second production stage has a capacity of 1200 hours, and it takes 1 hour to produce one unit of product A, 2 hours for product B, and 3 hours for product C.\n// A + 2*B + 3*C <= 1200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C.\n// A >= 100\n// B >= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The first production stage has a capacity of 1000 hours, and it takes 2 hours to produce one unit of product A, 3 hours for product B, and 4 hours for product C. The second production stage has a capacity of 1200 hours, and it takes 1 hour to produce one unit of product A, 2 hours for product B, and 3 hours for product C. The market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C. Please help the manufacturer to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The first production stage has a capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The second production stage has a capacity of 1200 hours\nmodel.addCons(A + 2*B + 3*C <= 1200)\n## The market demand for product A is at least 100 units, for product B is at least 200 units\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.5*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms.\n// 200*WholeWheat + 150*Rye + 180*Sourdough <= 15000\n\n## Generate Constraint-2:\nThe bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams.\n// 5*WholeWheat + 7*Rye + 10*Sourdough <= 500\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 15 minutes of labor. The bakery can dedicate a maximum of 6 hours of labor per day.\n// 15*WholeWheat + 15*Rye + 15*Sourdough <= 360",
        "question": "A small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor. The profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4.\n\n| Bread Type     | Profit per Loaf | Flour Required per Loaf | Yeast Required per Loaf | Labor Time per Loaf |\n|----------------|-----------------|-------------------------|-------------------------|---------------------|\n| Whole Wheat    | $3              | 200 grams                | 5 grams                 | 15 minutes          |\n| Rye            | $2.5            | 150 grams                | 7 grams                 | 15 minutes          |\n| Sourdough      | $4              | 180 grams                | 10 grams                | 15 minutes          |\n\nThe bakery has a limited amount of flour available each day, with a total daily supply of 15 kilograms. The bakery also has a limited amount of yeast, with a total daily supply of 500 grams. Additionally, the bakery has a labor constraint, with a maximum of 6 hours of labor per day.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.5*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*WholeWheat + 150*Rye + 180*Sourdough <= 15000)\n## The bakery also has a limited amount of yeast.\nmodel.addCons(5*WholeWheat + 7*Rye + 10*Sourdough <= 500)\n## The bakery has a labor constraint.\nmodel.addCons(15*WholeWheat + 15*Rye + 15*Sourdough <= 360)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1360,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.5*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms.\n// 200*WholeWheat + 150*Rye + 180*Sourdough <= 15000\n\n## Generate Constraint-2:\nThe bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams.\n// 5*WholeWheat + 7*Rye + 10*Sourdough <= 500\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 15 minutes of labor. The bakery can dedicate a maximum of 6 hours of labor per day.\n// 15*WholeWheat + 15*Rye + 15*Sourdough <= 360",
        "question": "A small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor. The profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery has a limited amount of flour available each day, with whole wheat bread requiring 200 grams of flour per loaf, rye bread requiring 150 grams, and sourdough requiring 180 grams, with a total daily flour supply of 15 kilograms. The bakery also has a limited amount of yeast, with each loaf of whole wheat bread requiring 5 grams of yeast, rye bread requiring 7 grams, and sourdough requiring 10 grams, with a total daily yeast supply of 500 grams. Additionally, the bakery has a labor constraint, with each loaf of bread requiring 15 minutes of labor and the bakery can dedicate a maximum of 6 hours of labor per day. Please help the bakery maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.5*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*WholeWheat + 150*Rye + 180*Sourdough <= 15000)\n## The bakery also has a limited amount of yeast.\nmodel.addCons(5*WholeWheat + 7*Rye + 10*Sourdough <= 500)\n## The bakery has a labor constraint.\nmodel.addCons(15*WholeWheat + 15*Rye + 15*Sourdough <= 360)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of whole wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves.\n// Whole_Wheat + Rye + Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\n// Whole_Wheat <= 300\n\n## Generate Constraint-3:\nThe bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\n// Rye <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n\nThe bakery has a daily oven capacity of 500 loaves. The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread. Additionally, the bakery has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough <= 500)\n## The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat <= 300)\n## The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\nmodel.addCons(Rye <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough Loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of whole wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves.\n// Whole_Wheat + Rye + Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\n// Whole_Wheat <= 300\n\n## Generate Constraint-3:\nThe bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\n// Rye <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily oven capacity of 500 loaves. The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread. The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread. Please help the bakery determine how many loaves of each type of bread to produce daily to maximize profit while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough <= 500)\n## The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat <= 300)\n## The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\nmodel.addCons(Rye <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough Loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 726,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily, considering the cost of ingredients and the demand from customers.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for donuts\": \"Cost_Donuts\", \"range\": \"Cost_Donuts >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.50. The cost of ingredients per croissant is $0.50, per muffin is $0.75, and per donut is $0.40. The bakery aims to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 0.75*Muffins + 0.4*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of flour, which is used in all pastries. Each croissant requires 2 units, each muffin requires 3 units, and each donut requires 1 unit.\n// 2*Croissants + 3*Muffins + 1*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery has a budget of $200 for daily ingredient costs.\n// 0.5*Croissants + 0.75*Muffins + 0.4*Donuts <= 200",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily, considering the cost of ingredients and the demand from customers. The revenue and cost of ingredients for each pastry are given in the following Table.\n\n| Pastry    | Revenue per Unit | Cost of Ingredients per Unit |\n|-----------|------------------|------------------------------|\n| Croissants| 2$               | 0.50$                        |\n| Muffins   | 3$               | 0.75$                        |\n| Donuts    | 1.50$            | 0.40$                        |\n\nThe bakery has a daily limit of 500 units of flour, which is used in all pastries. Each croissant requires 2 units, each muffin requires 3 units, and each donut requires 1 unit. The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. The bakery has a budget of $200 for daily ingredient costs. \n\nPlease help the bakery to maximize its daily profit, which is defined as the total revenue minus the total cost of ingredients.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 0.75*Muffins + 0.4*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (0.5*Croissants + 0.75*Muffins + 0.4*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 500 units of flour.\nmodel.addCons(2*Croissants + 3*Muffins + 1*Donuts <= 500)\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a budget of $200 for daily ingredient costs.\nmodel.addCons(0.5*Croissants + 0.75*Muffins + 0.4*Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily, considering the cost of ingredients and the demand from customers.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for donuts\": \"Cost_Donuts\", \"range\": \"Cost_Donuts >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.50. The cost of ingredients per croissant is $0.50, per muffin is $0.75, and per donut is $0.40. The bakery aims to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 0.75*Muffins + 0.4*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of flour, which is used in all pastries. Each croissant requires 2 units, each muffin requires 3 units, and each donut requires 1 unit.\n// 2*Croissants + 3*Muffins + 1*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery has a budget of $200 for daily ingredient costs.\n// 0.5*Croissants + 0.75*Muffins + 0.4*Donuts <= 200",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily, considering the cost of ingredients and the demand from customers. The revenue per croissant is $2, per muffin is $3, and per donut is $1.50. The cost of ingredients per croissant is $0.50, per muffin is $0.75, and per donut is $0.40. The bakery aims to maximize its daily profit. The bakery has a daily limit of 500 units of flour, which is used in all pastries. Each croissant requires 2 units, each muffin requires 3 units, and each donut requires 1 unit. The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. The bakery also has a budget of $200 for daily ingredient costs. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 0.75*Muffins + 0.4*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (0.5*Croissants + 0.75*Muffins + 0.4*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 500 units of flour.\nmodel.addCons(2*Croissants + 3*Muffins + 1*Donuts <= 500)\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a budget of $200 for daily ingredient costs.\nmodel.addCons(0.5*Croissants + 0.75*Muffins + 0.4*Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate used\": \"Chocolate_Used\", \"range\": \"Chocolate_Used >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla used\": \"Vanilla_Used\", \"range\": \"Vanilla_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\n// 0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\n// 0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6\n\n## Generate Constraint-3:\nThe bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 15",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The following table shows the ingredients required for each type of cake.\n\n| Cake Type | Chocolate Required (kg) | Vanilla Required (kg) |\n|-----------|-------------------------|-----------------------|\n| Chocolate | 0.5                     | 0.2                   |\n| Vanilla   | 0.3                     | 0.4                   |\n\nThe bakery has a daily supply of 10 kg of chocolate and 6 kg of vanilla. The bakery also has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of each ingredient used\nChocolate_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Used\", lb=0) # amount of chocolate used\nVanilla_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Used\", lb=0) # amount of vanilla used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\nmodel.addCons(0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes == Chocolate_Used)\nmodel.addCons(Chocolate_Used <= 10)\n## Each chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\nmodel.addCons(0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes == Vanilla_Used)\nmodel.addCons(Vanilla_Used <= 6)\n## The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate used: \", model.getVal(Chocolate_Used))\n    print(\"Amount of vanilla used: \", model.getVal(Vanilla_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate used\": \"Chocolate_Used\", \"range\": \"Chocolate_Used >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla used\": \"Vanilla_Used\", \"range\": \"Vanilla_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\n// 0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\n// 0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6\n\n## Generate Constraint-3:\nThe bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 15",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate. Each chocolate cake also requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla. Additionally, the bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of each ingredient used\nChocolate_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Used\", lb=0) # amount of chocolate used\nVanilla_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Used\", lb=0) # amount of vanilla used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\nmodel.addCons(0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes == Chocolate_Used)\nmodel.addCons(Chocolate_Used <= 10)\n## Each chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\nmodel.addCons(0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes == Vanilla_Used)\nmodel.addCons(Vanilla_Used <= 6)\n## The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate used: \", model.getVal(Chocolate_Used))\n    print(\"Amount of vanilla used: \", model.getVal(Vanilla_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour available\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.50, and the cost per muffin is $0.75. \nThe bakery aims to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= Labor_Hours\n// Labor_Hours <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.2*Croissants + 0.3*Muffins <= Flour_Pounds\n// Flour_Pounds <= 5\n\n## Generate Constraint-3:\nThe daily demand for croissants is at least 20 and for muffins is at least 15.\n// Croissants >= 20\n// Muffins >= 15",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each pastry. The revenue and cost per pastry are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost per Pastry |\n|----------|--------------------|-----------------|\n| Croissants | $2               | $0.50           |\n| Muffins   | $3               | $0.75           |\n\nThe bakery aims to maximize its daily profit. Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily. Each croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily. The daily demand for croissants is at least 20 and for muffins is at least 15.\n\nPlease help the bakery determine the optimal number of croissants and muffins to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor available\nFlour_Pounds = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour available\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins\nmodel.addCons(obj == (2*Croissants + 3*Muffins) - (0.50*Croissants + 0.75*Muffins))\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Labor_Hours)\nmodel.addCons(Labor_Hours <= 10)\n## Each croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins <= Flour_Pounds)\nmodel.addCons(Flour_Pounds <= 5)\n## The daily demand for croissants is at least 20 and for muffins is at least 15.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour available\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.50, and the cost per muffin is $0.75. \nThe bakery aims to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= Labor_Hours\n// Labor_Hours <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.2*Croissants + 0.3*Muffins <= Flour_Pounds\n// Flour_Pounds <= 5\n\n## Generate Constraint-3:\nThe daily demand for croissants is at least 20 and for muffins is at least 15.\n// Croissants >= 20\n// Muffins >= 15",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each pastry. The revenue per croissant is $2, and the revenue per muffin is $3. The cost per croissant is $0.50, and the cost per muffin is $0.75. The bakery aims to maximize its daily profit.\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily. Each croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily. The daily demand for croissants is at least 20 and for muffins is at least 15.\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor available\nFlour_Pounds = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour available\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins\nmodel.addCons(obj == (2*Croissants + 3*Muffins) - (0.50*Croissants + 0.75*Muffins))\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= Labor_Hours)\nmodel.addCons(Labor_Hours <= 10)\n## Each croissant requires 0.2 pounds of flour and each muffin requires 0.3 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins <= Flour_Pounds)\nmodel.addCons(Flour_Pounds <= 5)\n## The daily demand for croissants is at least 20 and for muffins is at least 15.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily. Additionally, the bakery must determine the number of ovens to rent to meet the production needs.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The cost to rent an oven per day is $100. The bakery aims to maximize its daily profit from bread sales minus the cost of oven rental.\n// Total_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\n// Oven_Cost = 100*Ovens\n// Objective Function: Maximize: Total_Profit - Oven_Cost\n\n## Generate Constraint-1:\nEach oven can bake a maximum of 100 loaves of bread per day. The total number of loaves produced should not exceed the capacity of the ovens.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves <= 100*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 150 loaves of bread in total.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves >= 150\n\n## Generate Constraint-3:\nThe bakery must rent at least one oven to start production.\n// Ovens >= 1",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily and the number of ovens to rent to meet the production needs. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The cost to rent an oven per day is $100. The following table summarizes the profit per loaf and the oven rental cost.\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Wheat            | $2              |\n| Rye              | $3              |\n| Sourdough        | $4              |\n| Oven Rental Cost | $100            |\n\nThe bakery aims to maximize its daily profit from bread sales minus the cost of oven rental. Each oven can bake a maximum of 100 loaves of bread per day. The total number of loaves produced should not exceed the capacity of the ovens. The bakery has a daily demand for at least 150 loaves of bread in total. The bakery must rent at least one oven to start production.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce and the number of ovens to rent to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of ovens to rent\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nSourdough_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Loaves\", lb=0) # number of sourdough bread loaves\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\nTotal_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\n## Oven_Cost = 100*Ovens\nOven_Cost = 100*Ovens\nmodel.addCons(obj == Total_Profit - Oven_Cost)\n\n# Add constraints\n## Each oven can bake a maximum of 100 loaves of bread per day.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves <= 100*Ovens)\n## The bakery has a daily demand for at least 150 loaves of bread in total.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves >= 150)\n## The bakery must rent at least one oven to start production.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily. Additionally, the bakery must determine the number of ovens to rent to meet the production needs.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The cost to rent an oven per day is $100. The bakery aims to maximize its daily profit from bread sales minus the cost of oven rental.\n// Total_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\n// Oven_Cost = 100*Ovens\n// Objective Function: Maximize: Total_Profit - Oven_Cost\n\n## Generate Constraint-1:\nEach oven can bake a maximum of 100 loaves of bread per day. The total number of loaves produced should not exceed the capacity of the ovens.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves <= 100*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 150 loaves of bread in total.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves >= 150\n\n## Generate Constraint-3:\nThe bakery must rent at least one oven to start production.\n// Ovens >= 1",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily and how many ovens to rent to meet the production needs. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The cost to rent an oven per day is $100. The bakery aims to maximize its daily profit from bread sales minus the cost of oven rental. Each oven can bake a maximum of 100 loaves of bread per day, and the total number of loaves produced should not exceed the capacity of the ovens. The bakery has a daily demand for at least 150 loaves of bread in total. The bakery must rent at least one oven to start production. Please help the bakery to maximize its daily profit from bread sales minus the cost of oven rental.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of ovens to rent\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\nSourdough_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Loaves\", lb=0) # number of sourdough bread loaves\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\nTotal_Profit = 2*Wheat_Loaves + 3*Rye_Loaves + 4*Sourdough_Loaves\n## Oven_Cost = 100*Ovens\nOven_Cost = 100*Ovens\nmodel.addCons(obj == Total_Profit - Oven_Cost)\n\n# Add constraints\n## Each oven can bake a maximum of 100 loaves of bread per day.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves <= 100*Ovens)\n## The bakery has a daily demand for at least 150 loaves of bread in total.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves >= 150)\n## The bakery must rent at least one oven to start production.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $1, and the cost per muffin is $1.50. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce a maximum of 100 croissants or 120 muffins per day.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 120*Oven_Muffins\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 pastries in total.\n// Croissants + Muffins >= 200\n\n## Generate Constraint-3:\nThe bakery can only rent a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins <= 3",
        "question": "A bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each pastry to produce and how many ovens to rent for the day. The revenue per croissant is $2, the cost per croissant is $1, the revenue per muffin is $3, and the cost per muffin is $1.50. The rental cost per oven per day is $50. The bakery wants to maximize the daily profit.\n\n| Pastry     | Revenue per Unit | Cost per Unit | Production Capacity per Oven |\n|------------|------------------|---------------|------------------------------|\n| Croissants | 2$               | 1$            | 100                          |\n| Muffins    | 3$               | 1.50$         | 120                          |\n\nEach oven can produce a maximum of 100 croissants or 120 muffins per day. The bakery has a daily demand for at least 200 pastries in total. The bakery can only rent a maximum of 3 ovens in total.\n\nPlease help the bakery determine the optimal number of croissants and muffins to produce, and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to rent for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to rent for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\nTotal_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce a maximum of 100 croissants or 120 muffins per day.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 120*Oven_Muffins)\n## The bakery has a daily demand for at least 200 pastries in total.\nmodel.addCons(Croissants + Muffins >= 200)\n## The bakery can only rent a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to rent for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $1, and the cost per muffin is $1.50. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce a maximum of 100 croissants or 120 muffins per day.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 120*Oven_Muffins\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 pastries in total.\n// Croissants + Muffins >= 200\n\n## Generate Constraint-3:\nThe bakery can only rent a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins <= 3",
        "question": "A bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each pastry to produce and how many ovens to rent for the day. The revenue per croissant is $2, and the revenue per muffin is $3. The cost per croissant is $1, and the cost per muffin is $1.50. The rental cost per oven per day is $50. Each oven can produce a maximum of 100 croissants or 120 muffins per day. The bakery has a daily demand for at least 200 pastries in total. The bakery can only rent a maximum of 3 ovens in total. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to rent for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to rent for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\nTotal_Cost = Croissants + 1.5*Muffins + 50*(Oven_Croissants + Oven_Muffins)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce a maximum of 100 croissants or 120 muffins per day.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 120*Oven_Muffins)\n## The bakery has a daily demand for at least 200 pastries in total.\nmodel.addCons(Croissants + Muffins >= 200)\n## The bakery can only rent a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to rent for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 620,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources such as flour and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5*Wheat_Loaves <= Wheat_Flour\n// 0.4*Rye_Loaves <= Rye_Flour\n// Wheat_Flour <= 100\n// Rye_Flour <= 80\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 20 hours.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 10",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources such as flour and labor. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The requirements for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|------------|-----------------|-------------------------|-------------------------|\n| Wheat      | $3              | 0.5 kg of wheat flour   | 0.2 hours               |\n| Rye        | $4              | 0.4 kg of rye flour     | 0.3 hours               |\n\nThe bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour. The bakery has a daily labor capacity of 20 hours. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nWheat_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Flour\", lb=0) # amount of wheat flour used\nRye_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Flour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*Wheat_Loaves <= Wheat_Flour)\nmodel.addCons(0.4*Rye_Loaves <= Rye_Flour)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 80)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Amount of wheat flour used: \", model.getVal(Wheat_Flour))\n    print(\"Amount of rye flour used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources such as flour and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5*Wheat_Loaves <= Wheat_Flour\n// 0.4*Rye_Loaves <= Rye_Flour\n// Wheat_Flour <= 100\n// Rye_Flour <= 80\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 20 hours.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 10",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the available resources such as flour and labor. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. Each loaf of wheat bread requires 0.5 kg of wheat flour and 0.2 hours of labor, while each loaf of rye bread requires 0.4 kg of rye flour and 0.3 hours of labor. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour, and a daily labor capacity of 20 hours. The bakery must also produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nWheat_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Flour\", lb=0) # amount of wheat flour used\nRye_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Flour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*Wheat_Loaves <= Wheat_Flour)\nmodel.addCons(0.4*Rye_Loaves <= Rye_Flour)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 80)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Amount of wheat flour used: \", model.getVal(Wheat_Flour))\n    print(\"Amount of rye flour used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many ovens to rent to meet the production demands.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"daily rental cost per oven\": \"Rental_Cost\", \"range\": \"Rental_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.5, and the cost per muffin is $1. \nThe daily rental cost per oven is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce a maximum of 100 pastries per day. The total number of pastries produced should not exceed the number of ovens times the production capacity per oven.\n// Croissants + Muffins <= 100*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 pastries.\n// Croissants + Muffins >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven rentals, which is $200 per day.\n// 50*Ovens <= 200",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many ovens to rent to meet the production demands. The revenue and cost per pastry, as well as the daily rental cost per oven, are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost per Pastry |\n|----------|--------------------|-----------------|\n| Croissants | $2               | $0.5            |\n| Muffins   | $3               | $1              |\n\nThe daily rental cost per oven is $50.\n\nThe bakery wants to maximize the daily profit. Each oven can produce a maximum of 100 pastries per day. The total number of pastries produced should not exceed the number of ovens times the production capacity per oven. The bakery has a daily demand for at least 200 pastries. The bakery has a limited budget for oven rentals, which is $200 per day.\n\nPlease help the bakery determine the optimal number of croissants and muffins to produce daily, as well as the number of ovens to rent, to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\nTotal_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce a maximum of 100 pastries per day.\nmodel.addCons(Croissants + Muffins <= 100*Ovens)\n## The bakery has a daily demand for at least 200 pastries.\nmodel.addCons(Croissants + Muffins >= 200)\n## The bakery has a limited budget for oven rentals, which is $200 per day.\nmodel.addCons(50*Ovens <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many ovens to rent to meet the production demands.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"daily rental cost per oven\": \"Rental_Cost\", \"range\": \"Rental_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.5, and the cost per muffin is $1. \nThe daily rental cost per oven is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce a maximum of 100 pastries per day. The total number of pastries produced should not exceed the number of ovens times the production capacity per oven.\n// Croissants + Muffins <= 100*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 pastries.\n// Croissants + Muffins >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven rentals, which is $200 per day.\n// 50*Ovens <= 200",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many ovens to rent to meet the production demands. The revenue per croissant is $2, and the revenue per muffin is $3. The cost per croissant is $0.5, and the cost per muffin is $1. The daily rental cost per oven is $50. The bakery wants to maximize the daily profit. Each oven can produce a maximum of 100 pastries per day. The total number of pastries produced should not exceed the number of ovens times the production capacity per oven. The bakery has a daily demand for at least 200 pastries. The bakery has a limited budget for oven rentals, which is $200 per day. Please help the bakery to determine the optimal number of croissants, muffins, and ovens to rent to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\nTotal_Cost = 0.5*Croissants + 1*Muffins + 50*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce a maximum of 100 pastries per day.\nmodel.addCons(Croissants + Muffins <= 100*Ovens)\n## The bakery has a daily demand for at least 200 pastries.\nmodel.addCons(Croissants + Muffins >= 200)\n## The bakery has a limited budget for oven rentals, which is $200 per day.\nmodel.addCons(50*Ovens <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for wheat bread\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage time for rye bread\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Bread + 4*Rye_Bread\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The total daily oven time available is 8 hours.\n// Oven_Wheat = 0.5 * Wheat_Bread\n// Oven_Rye = 0.4 * Rye_Bread\n// Oven_Wheat + Oven_Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 2 pounds of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has 15 pounds of flour available daily.\n// 2 * Wheat_Bread + 1.5 * Rye_Bread <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\n// Wheat_Bread + Rye_Bread >= 10",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The following table summarizes the requirements and constraints:\n\n| Bread Type | Profit per Loaf | Oven Time per Loaf | Flour Required per Loaf |\n|------------|-----------------|---------------------|-------------------------|\n| Wheat      | $3              | 0.5 hours           | 2 pounds                |\n| Rye        | $4              | 0.4 hours           | 1.5 pounds              |\n\nThe bakery has the following constraints:\n- Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The total daily oven time available is 8 hours.\n- Each loaf of wheat bread requires 2 pounds of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has 15 pounds of flour available daily.\n- The bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\n\nPlease help the bakery to maximize its daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\n## Oven usage time for each type of bread\nOven_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Wheat\", lb=0) # oven usage time for wheat bread\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven usage time for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(Oven_Wheat == 0.5 * Wheat_Bread)\nmodel.addCons(Oven_Rye == 0.4 * Rye_Bread)\nmodel.addCons(Oven_Wheat + Oven_Rye <= 8)\n## Each loaf of wheat bread requires 2 pounds of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has 15 pounds of flour available daily.\nmodel.addCons(2 * Wheat_Bread + 1.5 * Rye_Bread <= 15)\n## The bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread + Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for wheat bread\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage time for rye bread\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Bread + 4*Rye_Bread\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The total daily oven time available is 8 hours.\n// Oven_Wheat = 0.5 * Wheat_Bread\n// Oven_Rye = 0.4 * Rye_Bread\n// Oven_Wheat + Oven_Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 2 pounds of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has 15 pounds of flour available daily.\n// 2 * Wheat_Bread + 1.5 * Rye_Bread <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\n// Wheat_Bread + Rye_Bread >= 10",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. Each loaf of wheat bread requires 0.5 hours of oven time and 2 pounds of flour, while each loaf of rye bread requires 0.4 hours of oven time and 1.5 pounds of flour. The total daily oven time available is 8 hours, and the bakery has 15 pounds of flour available daily. The bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\nPlease help the bakery to maximize its daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\n## Oven usage time for each type of bread\nOven_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Wheat\", lb=0) # oven usage time for wheat bread\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven usage time for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(Oven_Wheat == 0.5 * Wheat_Bread)\nmodel.addCons(Oven_Rye == 0.4 * Rye_Bread)\nmodel.addCons(Oven_Wheat + Oven_Rye <= 8)\n## Each loaf of wheat bread requires 2 pounds of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has 15 pounds of flour available daily.\nmodel.addCons(2 * Wheat_Bread + 1.5 * Rye_Bread <= 15)\n## The bakery must produce at least 10 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread + Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 croissants, 80 muffins, or 120 donuts per day. The bakery has a total of 5 ovens available.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 5\n\n## Generate Constraint-2:\nThe bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar. Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 500 (flour constraint)\n// 0.2*Croissants + 0.3*Muffins + 0.1*Donuts <= 300 (sugar constraint)",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit.\n\n| Pastry     | Revenue per Unit | Cost per Oven Usage | Units per Oven |\n|------------|------------------|---------------------|----------------|\n| Croissants | $2               | $50                 | 100            |\n| Muffins    | $3               | $60                 | 80             |\n| Donuts     | $1.5             | $40                 | 120            |\n\nThe bakery has a total of 5 ovens available. The bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts. The bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar. Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\n\nPlease help the bakery to maximize its daily profit, considering the constraints on ovens, demand, and ingredient availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 croissants, 80 muffins, or 120 donuts per day. The bakery has a total of 5 ovens available.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 5)\n## The bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 300)\n## The bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar.\n## Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 500) # flour constraint\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Donuts <= 300) # sugar constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 croissants, 80 muffins, or 120 donuts per day. The bakery has a total of 5 ovens available.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 5\n\n## Generate Constraint-2:\nThe bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar. Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 500 (flour constraint)\n// 0.2*Croissants + 0.3*Muffins + 0.1*Donuts <= 300 (sugar constraint)",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit. Each oven can produce 100 croissants, 80 muffins, or 120 donuts per day. The bakery has a total of 5 ovens available. The bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts. The bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar. Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the number of ovens to use for each type.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 croissants, 80 muffins, or 120 donuts per day. The bakery has a total of 5 ovens available.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 5)\n## The bakery has a daily demand of at least 200 croissants, 150 muffins, and 300 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 300)\n## The bakery has a limited amount of ingredients: 500 kg of flour and 300 kg of sugar.\n## Each croissant requires 0.5 kg of flour and 0.2 kg of sugar, each muffin requires 0.4 kg of flour and 0.3 kg of sugar, and each donut requires 0.3 kg of flour and 0.1 kg of sugar.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 500) # flour constraint\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Donuts <= 300) # sugar constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily, considering the cost of ingredients, labor, and the potential revenue from each cake type.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each chocolate cake is $5, each vanilla cake is $4, and each strawberry cake is $6. \nThe revenue from selling each chocolate cake is $10, each vanilla cake is $8, and each strawberry cake is $12. \nThe bakery aims to maximize its daily profit.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients for each chocolate cake is $3, each vanilla cake is $2, and each strawberry cake is $4.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 4*Strawberry_Cakes <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 10 hours. It takes 1 hour to produce each chocolate cake, 1.5 hours for each vanilla cake, and 2 hours for each strawberry cake.\n// Chocolate_Cakes + 1.5*Vanilla_Cakes + 2*Strawberry_Cakes <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes of each type to meet the minimum order requirements from local cafes.\n// Chocolate_Cakes >= 5, Vanilla_Cakes >= 5, Strawberry_Cakes >= 5",
        "question": "A bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily, considering the cost of ingredients, labor, and the potential revenue from each cake type. The cost and revenue for each cake type are given in the following Table.\n\n| Cake Type       | Cost per Cake | Revenue per Cake |\n|-----------------|---------------|------------------|\n| Chocolate       | $5            | $10              |\n| Vanilla         | $4            | $8               |\n| Strawberry      | $6            | $12              |\n\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients for each chocolate cake is $3, each vanilla cake is $2, and each strawberry cake is $4. The bakery has a daily labor limit of 10 hours. It takes 1 hour to produce each chocolate cake, 1.5 hours for each vanilla cake, and 2 hours for each strawberry cake. The bakery must produce at least 5 cakes of each type to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes) - (5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes))\n\n# Add constraints\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 4*Strawberry_Cakes <= 200)\n## The bakery has a daily labor limit of 10 hours.\nmodel.addCons(Chocolate_Cakes + 1.5*Vanilla_Cakes + 2*Strawberry_Cakes <= 10)\n## The bakery must produce at least 5 cakes of each type.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 5)\nmodel.addCons(Strawberry_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily, considering the cost of ingredients, labor, and the potential revenue from each cake type.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each chocolate cake is $5, each vanilla cake is $4, and each strawberry cake is $6. \nThe revenue from selling each chocolate cake is $10, each vanilla cake is $8, and each strawberry cake is $12. \nThe bakery aims to maximize its daily profit.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients for each chocolate cake is $3, each vanilla cake is $2, and each strawberry cake is $4.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 4*Strawberry_Cakes <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 10 hours. It takes 1 hour to produce each chocolate cake, 1.5 hours for each vanilla cake, and 2 hours for each strawberry cake.\n// Chocolate_Cakes + 1.5*Vanilla_Cakes + 2*Strawberry_Cakes <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes of each type to meet the minimum order requirements from local cafes.\n// Chocolate_Cakes >= 5, Vanilla_Cakes >= 5, Strawberry_Cakes >= 5",
        "question": "A bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily, considering the cost of ingredients, labor, and the potential revenue from each cake type. The cost of producing each chocolate cake is $5, each vanilla cake is $4, and each strawberry cake is $6. The revenue from selling each chocolate cake is $10, each vanilla cake is $8, and each strawberry cake is $12. The bakery aims to maximize its daily profit. The bakery has a daily budget of $200 for ingredients. The cost of ingredients for each chocolate cake is $3, each vanilla cake is $2, and each strawberry cake is $4. The bakery has a daily labor limit of 10 hours. It takes 1 hour to produce each chocolate cake, 1.5 hours for each vanilla cake, and 2 hours for each strawberry cake. The bakery must produce at least 5 cakes of each type to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes + 12*Strawberry_Cakes) - (5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes))\n\n# Add constraints\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 4*Strawberry_Cakes <= 200)\n## The bakery has a daily labor limit of 10 hours.\nmodel.addCons(Chocolate_Cakes + 1.5*Vanilla_Cakes + 2*Strawberry_Cakes <= 10)\n## The bakery must produce at least 5 cakes of each type.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 5)\nmodel.addCons(Strawberry_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per eclair is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per eclair is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n// Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\n// 15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 pastries in total.\n// Croissants + Muffins + Eclairs >= 100\n\n## Generate Constraint-3:\nThe bakery can rent a maximum of 3 ovens.\n// Ovens <= 3",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day. The revenue and cost per pastry, as well as the rental cost per oven, are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost per Pastry | Baking Time per Pastry |\n|----------|--------------------|-----------------|------------------------|\n| Croissant| $2                 | $1              | 15 minutes             |\n| Muffin   | $3                 | $1.5            | 20 minutes             |\n| Eclair   | $4                 | $2              | 30 minutes             |\n\nThe rental cost per oven per day is $100. The bakery has a total of 8 hours of baking time available each day. The bakery has a daily demand for at least 100 pastries in total. The bakery can rent a maximum of 3 ovens. \nPlease help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\nTotal_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n## Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60)\n## The bakery has a daily demand for at least 100 pastries in total.\nmodel.addCons(Croissants + Muffins + Eclairs >= 100)\n## The bakery can rent a maximum of 3 ovens.\nmodel.addCons(Ovens <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per eclair is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per eclair is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n// Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\n// 15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 pastries in total.\n// Croissants + Muffins + Eclairs >= 100\n\n## Generate Constraint-3:\nThe bakery can rent a maximum of 3 ovens.\n// Ovens <= 3",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day. The revenue per croissant is $2, per muffin is $3, and per eclair is $4. The cost per croissant is $1, per muffin is $1.5, and per eclair is $2. The rental cost per oven per day is $100. The bakery wants to maximize the daily profit. The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day. The bakery has a daily demand for at least 100 pastries in total. The bakery can rent a maximum of 3 ovens. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\nTotal_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n## Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60)\n## The bakery has a daily demand for at least 100 pastries in total.\nmodel.addCons(Croissants + Muffins + Eclairs >= 100)\n## The bakery can rent a maximum of 3 ovens.\nmodel.addCons(Ovens <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven operates\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. \nThe cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. \nThe cost of operating the oven per hour is $10, and the cost of hiring each worker is $80 per day.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day.\n// 0.5*Wheat_Bread + 0.6*Rye_Bread <= Oven_Hours\n// Oven_Hours <= 10\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= Workers\n// Workers <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 20\n// Rye_Bread >= 15",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven. The revenue and cost details for each type of bread are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Oven Time per Loaf | Labor Time per Loaf |\n|------------|------------------|---------------|---------------------|----------------------|\n| Wheat      | $3               | $1            | 0.5 hours           | 0.2 hours            |\n| Rye        | $4               | $2            | 0.6 hours           | 0.3 hours            |\n\nThe cost of operating the oven per hour is $10, and the cost of hiring each worker is $80 per day. The bakery wants to maximize the daily profit. The constraints are as follows:\n- Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day.\n- Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\n- The bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\n\nPlease help the bakery determine the optimal number of wheat and rye bread loaves to produce and the optimal number of hours to operate the oven to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of hours the oven operates\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours the oven operates\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\nTotal_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day.\nmodel.addCons(0.5*Wheat_Bread + 0.6*Rye_Bread <= Oven_Hours)\nmodel.addCons(Oven_Hours <= 10)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= Workers)\nmodel.addCons(Workers <= 8)\n## The bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 20)\nmodel.addCons(Rye_Bread >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of hours the oven operates: \", model.getVal(Oven_Hours))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1509,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven operates\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. \nThe cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. \nThe cost of operating the oven per hour is $10, and the cost of hiring each worker is $80 per day.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day.\n// 0.5*Wheat_Bread + 0.6*Rye_Bread <= Oven_Hours\n// Oven_Hours <= 10\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= Workers\n// Workers <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 20\n// Rye_Bread >= 15",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven. The revenue per wheat bread loaf is $3, and the revenue per rye bread loaf is $4. The cost per wheat bread loaf is $1, and the cost per rye bread loaf is $2. The cost of operating the oven per hour is $10, and the cost of hiring each worker is $80 per day. The bakery wants to maximize the daily profit.\n\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day. The bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\n\nPlease help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of hours the oven operates\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours the oven operates\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\nTotal_Cost = (1*Wheat_Bread + 2*Rye_Bread) + 10*Oven_Hours + 80*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The oven can operate for a maximum of 10 hours per day.\nmodel.addCons(0.5*Wheat_Bread + 0.6*Rye_Bread <= Oven_Hours)\nmodel.addCons(Oven_Hours <= 10)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= Workers)\nmodel.addCons(Workers <= 8)\n## The bakery must produce at least 20 loaves of wheat bread and 15 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 20)\nmodel.addCons(Rye_Bread >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of hours the oven operates: \", model.getVal(Oven_Hours))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. \nThe labor cost is $15 per hour.\nThe bakery wants to maximize the daily profit.\n// Total_Profit = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour.\n// 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor.\n// 0.05*Croissants + 0.1*Muffins <= 8\n\n## Generate Constraint-3:\nThe cost of ingredients must not exceed $50 per day.\n// Ingredient_Cost <= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. The labor cost is $15 per hour.\n\n| Pastry   | Profit per Unit | Cost of Ingredients per Unit | Labor Time per Unit |\n|----------|-----------------|------------------------------|---------------------|\n| Croissant| $2              | $0.50                        | 0.05 hours          |\n| Muffin   | $3              | $0.75                        | 0.1 hours           |\n\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour. The bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor. The cost of ingredients must not exceed $50 per day.\n\nPlease help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The number of hours of labor and the cost of ingredients\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # cost of ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Croissants + 3*Muffins\nTotal_Profit = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nTotal_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nmodel.addCons(obj == Total_Profit - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a daily limit of 8 hours of labor\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 8)\nmodel.addCons(Labor_Hours == 0.05*Croissants + 0.1*Muffins)\n## The cost of ingredients must not exceed $50 per day\nmodel.addCons(Ingredient_Cost <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of hours of labor: \", model.getVal(Labor_Hours))\n    print(\"Cost of ingredients: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. \nThe labor cost is $15 per hour.\nThe bakery wants to maximize the daily profit.\n// Total_Profit = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour.\n// 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor.\n// 0.05*Croissants + 0.1*Muffins <= 8\n\n## Generate Constraint-3:\nThe cost of ingredients must not exceed $50 per day.\n// Ingredient_Cost <= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. The labor cost is $15 per hour. The bakery has a daily limit of 100 kg of flour, where each croissant requires 0.1 kg of flour and each muffin requires 0.2 kg of flour. The bakery also has a daily limit of 8 hours of labor, where each croissant requires 0.05 hours of labor and each muffin requires 0.1 hours of labor. Additionally, the cost of ingredients must not exceed $50 per day. Please help the bakery maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The number of hours of labor and the cost of ingredients\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # cost of ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Croissants + 3*Muffins\nTotal_Profit = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nTotal_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nmodel.addCons(obj == Total_Profit - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a daily limit of 8 hours of labor\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 8)\nmodel.addCons(Labor_Hours == 0.05*Croissants + 0.1*Muffins)\n## The cost of ingredients must not exceed $50 per day\nmodel.addCons(Ingredient_Cost <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of hours of labor: \", model.getVal(Labor_Hours))\n    print(\"Cost of ingredients: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The following table outlines the labor and sugar requirements for each type of cake.\n\n| Cake Type     | Labor Requirement | Sugar Requirement |\n|---------------|-------------------|-------------------|\n| Chocolate     | 2 hours           | 0.5 kg            |\n| Vanilla       | 1.5 hours         | 0.4 kg            |\n\nThe bakery has a maximum of 12 hours of labor available daily and a maximum of 4 kg of sugar available daily. The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily. The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total production time in hours\": \"Production_Time\", \"range\": \"Production_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour and sugar. Each croissant requires 20 grams of flour and 10 grams of sugar, each muffin requires 30 grams of flour and 20 grams of sugar, and each donut requires 25 grams of flour and 15 grams of sugar. The bakery has 1000 grams of flour and 600 grams of sugar available daily.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 1000 (flour constraint)\n// 10*Croissants + 20*Muffins + 15*Donuts <= 600 (sugar constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total each day to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours. The bakery has a limited amount of flour and sugar. Each croissant requires 20 grams of flour and 10 grams of sugar, each muffin requires 30 grams of flour and 20 grams of sugar, and each donut requires 25 grams of flour and 15 grams of sugar. The bakery has 1000 grams of flour and 600 grams of sugar available daily. The bakery must produce at least 50 pastries in total each day to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n\n| Pastry | Profit per Unit | Flour Required (grams) | Sugar Required (grams) | Production Time (hours) |\n|--------|-----------------|------------------------|------------------------|-------------------------|\n| Croissant | $0.50 | 20 | 10 | 0.05 |\n| Muffin | $0.75 | 30 | 20 | 0.10 |\n| Donut | $0.60 | 25 | 15 | 0.08 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= 8)\n## The bakery has a limited amount of flour and sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 1000) # flour constraint\nmodel.addCons(10*Croissants + 20*Muffins + 15*Donuts <= 600) # sugar constraint\n## The bakery must produce at least 50 pastries in total each day.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total production time in hours\": \"Production_Time\", \"range\": \"Production_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour and sugar. Each croissant requires 20 grams of flour and 10 grams of sugar, each muffin requires 30 grams of flour and 20 grams of sugar, and each donut requires 25 grams of flour and 15 grams of sugar. The bakery has 1000 grams of flour and 600 grams of sugar available daily.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 1000 (flour constraint)\n// 10*Croissants + 20*Muffins + 15*Donuts <= 600 (sugar constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total each day to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours. The bakery has a limited amount of flour and sugar. Each croissant requires 20 grams of flour and 10 grams of sugar, each muffin requires 30 grams of flour and 20 grams of sugar, and each donut requires 25 grams of flour and 15 grams of sugar. The bakery has 1000 grams of flour and 600 grams of sugar available daily. The bakery must produce at least 50 pastries in total each day to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= 8)\n## The bakery has a limited amount of flour and sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 1000) # flour constraint\nmodel.addCons(10*Croissants + 20*Muffins + 15*Donuts <= 600) # sugar constraint\n## The bakery must produce at least 50 pastries in total each day.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\n// 0.05*Croissants + 0.1*Muffins <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for 50 pastries.\n// Croissants + Muffins >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $1.50, and the profit per muffin is $2.00. The following table shows the labor and flour requirements for each type of pastry.\n\n| Pastry   | Labor Requirement (hours) | Flour Requirement (kg) |\n|----------|--------------------------|-----------------------|\n| Croissant| 0.1                      | 0.05                  |\n| Muffin   | 0.2                      | 0.1                   |\n\nThe bakery has a maximum of 8 hours of labor available daily and a maximum of 3 kg of flour available daily. The bakery also has a minimum daily demand for 50 pastries. Please help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## Each croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 3)\n## The bakery has a minimum daily demand for 50 pastries.\nmodel.addCons(Croissants + Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 873,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\n// 0.05*Croissants + 0.1*Muffins <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for 50 pastries.\n// Croissants + Muffins >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $1.50, and the profit per muffin is $2.00. Each croissant requires 0.1 hours of labor and 0.05 kg of flour, while each muffin requires 0.2 hours of labor and 0.1 kg of flour. The bakery has a maximum of 8 hours of labor and 3 kg of flour available daily. Additionally, the bakery has a minimum daily demand for 50 pastries. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## Each croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 3)\n## The bakery has a minimum daily demand for 50 pastries.\nmodel.addCons(Croissants + Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 641,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor hours.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. \nThe cost of chocolate cake ingredients is $3 per cake, and the cost of vanilla cake ingredients is $2 per cake. \nThe bakery wants to maximize the daily profit.\n// Total_Profit = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 3*Chocolate_Cakes + 2*Vanilla_Cakes\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily.\n// Chocolate_Ingredients <= 200\n// Vanilla_Ingredients <= 150\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand.\n// Chocolate_Cakes >= 10\n// Vanilla_Cakes >= 10",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor hours. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The cost of chocolate cake ingredients is $3 per cake, and the cost of vanilla cake ingredients is $2 per cake. The following table summarizes the costs and labor requirements for each type of cake.\n\n| Cake Type       | Profit per Cake | Cost per Cake | Labor Hours per Cake |\n|-----------------|-----------------|---------------|----------------------|\n| Chocolate       | $10             | $3            | 2 hours              |\n| Vanilla         | $8              | $2            | 1 hour               |\n\nThe bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily. The bakery has 100 labor hours available daily. The bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of ingredients for each type of cake\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 3*Chocolate_Cakes + 2*Vanilla_Cakes\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes) - (3*Chocolate_Cakes + 2*Vanilla_Cakes))\n\n# Add constraints\n## The bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily.\nmodel.addCons(Chocolate_Ingredients <= 200)\nmodel.addCons(Vanilla_Ingredients <= 150)\n## The bakery has 100 labor hours available daily. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor hours.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. \nThe cost of chocolate cake ingredients is $3 per cake, and the cost of vanilla cake ingredients is $2 per cake. \nThe bakery wants to maximize the daily profit.\n// Total_Profit = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 3*Chocolate_Cakes + 2*Vanilla_Cakes\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily.\n// Chocolate_Ingredients <= 200\n// Vanilla_Ingredients <= 150\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand.\n// Chocolate_Cakes >= 10\n// Vanilla_Cakes >= 10",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor hours. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The cost of chocolate cake ingredients is $3 per cake, and the cost of vanilla cake ingredients is $2 per cake. The bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily. The bakery has 100 labor hours available daily, with each chocolate cake requiring 2 hours of labor and each vanilla cake requiring 1 hour of labor. The bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of ingredients for each type of cake\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 3*Chocolate_Cakes + 2*Vanilla_Cakes\nmodel.addCons(obj == (10*Chocolate_Cakes + 8*Vanilla_Cakes) - (3*Chocolate_Cakes + 2*Vanilla_Cakes))\n\n# Add constraints\n## The bakery has 200 units of chocolate cake ingredients and 150 units of vanilla cake ingredients available daily.\nmodel.addCons(Chocolate_Ingredients <= 200)\nmodel.addCons(Vanilla_Ingredients <= 150)\n## The bakery has 100 labor hours available daily. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery must produce at least 10 chocolate cakes and 10 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery can only use a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit.\n\n| Pastry     | Revenue per Unit | Cost per Oven Usage per Day |\n|------------|------------------|-----------------------------|\n| Croissants | $2               | $50                         |\n| Muffins    | $3               | $60                         |\n| Donuts     | $1.5             | $40                         |\n\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used. The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts. The bakery can only use a maximum of 3 ovens in total.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the number of ovens to use for each type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 100)\n## The bakery can only use a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery can only use a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit. Each oven can produce 100 pastries per day, and the total number of pastries produced should not exceed the capacity of the ovens used. The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts. The bakery can only use a maximum of 3 ovens in total. Please help the bakery determine the optimal number of each type of pastry to produce and the number of ovens to use for each type to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 100)\n## The bakery can only use a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to allocate to each type of bread production.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to wheat bread production\": \"Wheat_Hours\", \"range\": \"Wheat_Hours >= 0\", \"type\": \"real\"}\n// {\"hours allocated to rye bread production\": \"Rye_Hours\", \"range\": \"Rye_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of labor per hour is $10. The bakery aims to maximize its daily profit from bread sales while considering the labor costs.\n// Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\n// Labor_Cost = 10*(Wheat_Hours + Rye_Hours)\n// Objective Function: Maximize: Total_Profit - Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a total of 8 hours available for bread production each day.\n// Wheat_Hours + Rye_Hours <= 8\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor.\n// Wheat_Bread * 0.5 <= Wheat_Hours\n// Rye_Bread * 0.4 <= Rye_Hours\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread.\n// Wheat_Bread >= 10\n// Rye_Bread >= 12",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to allocate to each type of bread production. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of labor per hour is $10. The bakery aims to maximize its daily profit from bread sales while considering the labor costs.\n\n| Type of Bread | Profit per Loaf | Labor Time per Loaf |\n|---------------|-----------------|---------------------|\n| Wheat Bread   | $3              | 0.5 hours           |\n| Rye Bread     | $4              | 0.4 hours           |\n\nThe bakery has a total of 8 hours available for bread production each day. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor. The bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread.\n\nPlease help the bakery to maximize its daily profit from bread sales by determining the optimal number of loaves of each type of bread to produce and the hours to allocate to each type of bread production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the hours allocated to each type of bread production\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Hours\", lb=0) # hours allocated to wheat bread production\nRye_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Hours\", lb=0) # hours allocated to rye bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Profit = 3*Wheat_Bread + 4*Rye_Bread\n## Labor_Cost = 10*(Wheat_Hours + Rye_Hours)\nLabor_Cost = 10*(Wheat_Hours + Rye_Hours)\nmodel.addCons(obj == Total_Profit - Labor_Cost)\n\n# Add constraints\n## The bakery has a total of 8 hours available for bread production each day.\nmodel.addCons(Wheat_Hours + Rye_Hours <= 8)\n## Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor.\nmodel.addCons(Wheat_Bread * 0.5 <= Wheat_Hours)\nmodel.addCons(Rye_Bread * 0.4 <= Rye_Hours)\n## The bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Hours allocated to wheat bread production: \", model.getVal(Wheat_Hours))\n    print(\"Hours allocated to rye bread production: \", model.getVal(Rye_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to allocate to each type of bread production.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to wheat bread production\": \"Wheat_Hours\", \"range\": \"Wheat_Hours >= 0\", \"type\": \"real\"}\n// {\"hours allocated to rye bread production\": \"Rye_Hours\", \"range\": \"Rye_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of labor per hour is $10. The bakery aims to maximize its daily profit from bread sales while considering the labor costs.\n// Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\n// Labor_Cost = 10*(Wheat_Hours + Rye_Hours)\n// Objective Function: Maximize: Total_Profit - Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a total of 8 hours available for bread production each day.\n// Wheat_Hours + Rye_Hours <= 8\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor.\n// Wheat_Bread * 0.5 <= Wheat_Hours\n// Rye_Bread * 0.4 <= Rye_Hours\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread.\n// Wheat_Bread >= 10\n// Rye_Bread >= 12",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to allocate to each type of bread production. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of labor per hour is $10. The bakery aims to maximize its daily profit from bread sales while considering the labor costs. The bakery has a total of 8 hours available for bread production each day. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor. The bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread. Please help the bakery to maximize its daily profit from bread sales while considering the labor costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the hours allocated to each type of bread production\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Hours\", lb=0) # hours allocated to wheat bread production\nRye_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Hours\", lb=0) # hours allocated to rye bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Profit = 3*Wheat_Bread + 4*Rye_Bread\n## Labor_Cost = 10*(Wheat_Hours + Rye_Hours)\nLabor_Cost = 10*(Wheat_Hours + Rye_Hours)\nmodel.addCons(obj == Total_Profit - Labor_Cost)\n\n# Add constraints\n## The bakery has a total of 8 hours available for bread production each day.\nmodel.addCons(Wheat_Hours + Rye_Hours <= 8)\n## Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.4 hours of labor.\nmodel.addCons(Wheat_Bread * 0.5 <= Wheat_Hours)\nmodel.addCons(Rye_Bread * 0.4 <= Rye_Hours)\n## The bakery has a daily demand for at least 10 loaves of wheat bread and 12 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Hours allocated to wheat bread production: \", model.getVal(Wheat_Hours))\n    print(\"Hours allocated to rye bread production: \", model.getVal(Rye_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 0.5\", \"type\": \"real\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 0.4\", \"type\": \"real\"}\n// {\"oven usage per donut\": \"Oven_Donut\", \"range\": \"Oven_Donut = 0.3\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The bakery aims to maximize its daily profit from selling pastries.\n// Profit_Croissant = 1.5 * Croissants\n// Profit_Muffin = 2 * Muffins\n// Profit_Donut = 1.2 * Donuts\n// Objective Function: Maximize: Profit_Croissant + Profit_Muffin + Profit_Donut\n\n## Generate Constraint-1:\nThe total oven usage per day cannot exceed 10 hours.\n// Oven_Croissant * Croissants + Oven_Muffin * Muffins + Oven_Donut * Donuts <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 15 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability. The profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The bakery aims to maximize its daily profit from selling pastries. The oven usage per croissant is 0.5 hours, per muffin is 0.4 hours, and per donut is 0.3 hours. The total oven usage per day cannot exceed 10 hours. The bakery has a daily supply of 20 kg of flour, with each croissant requiring 0.1 kg, each muffin requiring 0.2 kg, and each donut requiring 0.15 kg. Additionally, the bakery has a daily supply of 15 kg of sugar, with each croissant requiring 0.05 kg, each muffin requiring 0.1 kg, and each donut requiring 0.08 kg.\n\nPlease help the bakery to determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit while adhering to these constraints.\n\n| Pastry   | Profit per Unit | Oven Usage per Unit | Flour Usage per Unit | Sugar Usage per Unit |\n|----------|-----------------|---------------------|----------------------|----------------------|\n| Croissant| $1.5            | 0.5 hours           | 0.1 kg               | 0.05 kg              |\n| Muffin   | $2              | 0.4 hours           | 0.2 kg               | 0.1 kg               |\n| Donut    | $1.2            | 0.3 hours           | 0.15 kg              | 0.08 kg              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from each type of pastry\nProfit_Croissant = 1.5 * Croissants\nProfit_Muffin = 2 * Muffins\nProfit_Donut = 1.2 * Donuts\nmodel.addCons(obj == Profit_Croissant + Profit_Muffin + Profit_Donut)\n\n# Add constraints\n## The total oven usage per day cannot exceed 10 hours.\nmodel.addCons(0.5 * Croissants + 0.4 * Muffins + 0.3 * Donuts <= 10)\n## The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20)\n## The bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1512,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 0.5\", \"type\": \"real\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 0.4\", \"type\": \"real\"}\n// {\"oven usage per donut\": \"Oven_Donut\", \"range\": \"Oven_Donut = 0.3\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The bakery aims to maximize its daily profit from selling pastries.\n// Profit_Croissant = 1.5 * Croissants\n// Profit_Muffin = 2 * Muffins\n// Profit_Donut = 1.2 * Donuts\n// Objective Function: Maximize: Profit_Croissant + Profit_Muffin + Profit_Donut\n\n## Generate Constraint-1:\nThe total oven usage per day cannot exceed 10 hours.\n// Oven_Croissant * Croissants + Oven_Muffin * Muffins + Oven_Donut * Donuts <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 15 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability. The profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The total oven usage per day cannot exceed 10 hours. The bakery has a daily supply of 20 kg of flour, with each croissant requiring 0.1 kg, each muffin requiring 0.2 kg, and each donut requiring 0.15 kg. Additionally, the bakery has a daily supply of 15 kg of sugar, with each croissant requiring 0.05 kg, each muffin requiring 0.1 kg, and each donut requiring 0.08 kg. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from each type of pastry\nProfit_Croissant = 1.5 * Croissants\nProfit_Muffin = 2 * Muffins\nProfit_Donut = 1.2 * Donuts\nmodel.addCons(obj == Profit_Croissant + Profit_Muffin + Profit_Donut)\n\n# Add constraints\n## The total oven usage per day cannot exceed 10 hours.\nmodel.addCons(0.5 * Croissants + 0.4 * Muffins + 0.3 * Donuts <= 10)\n## The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20)\n## The bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs available\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of cups of sugar available\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\n// Chocolate_Cakes + Vanilla_Cakes <= 80\n\n## Generate Constraint-3:\nThe daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 30",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the ingredient requirements for each type of cake:\n\n| Cake Type       | Eggs Required | Sugar Required |\n|-----------------|---------------|----------------|\n| Chocolate Cake  | 2             | 1              |\n| Vanilla Cake    | 1             | 1              |\n\nThe bakery has a daily supply of 100 eggs and 80 cups of sugar. The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## Each chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 80)\n## The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs available\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of cups of sugar available\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\n// Chocolate_Cakes + Vanilla_Cakes <= 80\n\n## Generate Constraint-3:\nThe daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 30",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. Each chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar. The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## Each chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 80)\n## The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage per wheat loaf\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage per rye loaf\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat loaf is $3, and the profit per rye loaf is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe total oven space used for baking wheat and rye bread cannot exceed 100 square feet per day. Each wheat loaf requires 2 square feet of oven space, and each rye loaf requires 3 square feet.\n// 2*Wheat_Loaves + 3*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 80 hours. Each wheat loaf requires 1 hour of labor, and each rye loaf requires 2 hours.\n// Wheat_Loaves + 2*Rye_Loaves <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 10",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per wheat loaf is $3, and the profit per rye loaf is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Space per Loaf | Labor Hours per Loaf |\n|------------|-----------------|---------------------|----------------------|\n| Wheat      | $3              | 2 square feet       | 1 hour               |\n| Rye        | $4              | 3 square feet       | 2 hours              |\n\nThe bakery has a total oven space of 100 square feet per day and a daily labor limit of 80 hours. The bakery must also produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The total oven space used for baking wheat and rye bread cannot exceed 100 square feet per day.\nmodel.addCons(2*Wheat_Loaves + 3*Rye_Loaves <= 100)\n## The bakery has a daily labor limit of 80 hours.\nmodel.addCons(Wheat_Loaves + 2*Rye_Loaves <= 80)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage per wheat loaf\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage per rye loaf\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat loaf is $3, and the profit per rye loaf is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe total oven space used for baking wheat and rye bread cannot exceed 100 square feet per day. Each wheat loaf requires 2 square feet of oven space, and each rye loaf requires 3 square feet.\n// 2*Wheat_Loaves + 3*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 80 hours. Each wheat loaf requires 1 hour of labor, and each rye loaf requires 2 hours.\n// Wheat_Loaves + 2*Rye_Loaves <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 10",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per wheat loaf is $3, and the profit per rye loaf is $4. The total oven space used for baking wheat and rye bread cannot exceed 100 square feet per day. Each wheat loaf requires 2 square feet of oven space, and each rye loaf requires 3 square feet. The bakery has a daily labor limit of 80 hours. Each wheat loaf requires 1 hour of labor, and each rye loaf requires 2 hours. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from selling both types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The total oven space used for baking wheat and rye bread cannot exceed 100 square feet per day.\nmodel.addCons(2*Wheat_Loaves + 3*Rye_Loaves <= 100)\n## The bakery has a daily labor limit of 80 hours.\nmodel.addCons(Wheat_Loaves + 2*Rye_Loaves <= 80)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"cost of producing a chocolate cake\": \"Cost_Chocolate\", \"range\": \"Cost_Chocolate >= 0\", \"type\": \"real\"}\n// {\"cost of producing a vanilla cake\": \"Cost_Vanilla\", \"range\": \"Cost_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $15. \nThe cost of producing a chocolate cake is $8, and the cost of producing a vanilla cake is $6. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 15*Vanilla_Cakes\n// Total_Cost = 8*Chocolate_Cakes + 6*Vanilla_Cakes\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 eggs, and each chocolate cake requires 2 eggs, while each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily storage capacity of 50 cakes.\n// Chocolate_Cakes + Vanilla_Cakes <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 150 pounds of flour, and each chocolate cake requires 1 pound, while each vanilla cake requires 2 pounds.\n// Chocolate_Cakes + 2*Vanilla_Cakes <= 150",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The revenue and cost per cake, as well as the ingredient requirements, are given in the following Table.\n\n| Cake Type | Revenue per Cake | Cost per Cake | Eggs Required | Flour Required |\n|-----------|------------------|---------------|---------------|----------------|\n| Chocolate | $20              | $8            | 2             | 1              |\n| Vanilla   | $15              | $6            | 1             | 2              |\n\nThe bakery has a daily limit of 100 eggs, and each chocolate cake requires 2 eggs, while each vanilla cake requires 1 egg. The bakery has a daily storage capacity of 50 cakes. The bakery also has a daily limit of 150 pounds of flour, and each chocolate cake requires 1 pound, while each vanilla cake requires 2 pounds.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 15*Vanilla_Cakes\n## Total_Cost = 8*Chocolate_Cakes + 6*Vanilla_Cakes\nmodel.addCons(obj == (20*Chocolate_Cakes + 15*Vanilla_Cakes) - (8*Chocolate_Cakes + 6*Vanilla_Cakes))\n\n# Add constraints\n## The bakery has a daily limit of 100 eggs, and each chocolate cake requires 2 eggs, while each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## The bakery has a daily storage capacity of 50 cakes.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 50)\n## The bakery has a daily limit of 150 pounds of flour, and each chocolate cake requires 1 pound, while each vanilla cake requires 2 pounds.\nmodel.addCons(Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"cost of producing a chocolate cake\": \"Cost_Chocolate\", \"range\": \"Cost_Chocolate >= 0\", \"type\": \"real\"}\n// {\"cost of producing a vanilla cake\": \"Cost_Vanilla\", \"range\": \"Cost_Vanilla >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $15. \nThe cost of producing a chocolate cake is $8, and the cost of producing a vanilla cake is $6. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 15*Vanilla_Cakes\n// Total_Cost = 8*Chocolate_Cakes + 6*Vanilla_Cakes\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 eggs, and each chocolate cake requires 2 eggs, while each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily storage capacity of 50 cakes.\n// Chocolate_Cakes + Vanilla_Cakes <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 150 pounds of flour, and each chocolate cake requires 1 pound, while each vanilla cake requires 2 pounds.\n// Chocolate_Cakes + 2*Vanilla_Cakes <= 150",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The revenue per chocolate cake is $20, and the revenue per vanilla cake is $15. The cost of producing a chocolate cake is $8, and the cost of producing a vanilla cake is $6. The bakery has a daily limit of 100 eggs, with each chocolate cake requiring 2 eggs and each vanilla cake requiring 1 egg. The bakery also has a daily storage capacity of 50 cakes. Additionally, the bakery has a daily limit of 150 pounds of flour, with each chocolate cake requiring 1 pound and each vanilla cake requiring 2 pounds. Please help the bakery maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 15*Vanilla_Cakes\n## Total_Cost = 8*Chocolate_Cakes + 6*Vanilla_Cakes\nmodel.addCons(obj == (20*Chocolate_Cakes + 15*Vanilla_Cakes) - (8*Chocolate_Cakes + 6*Vanilla_Cakes))\n\n# Add constraints\n## The bakery has a daily limit of 100 eggs, and each chocolate cake requires 2 eggs, while each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## The bakery has a daily storage capacity of 50 cakes.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 50)\n## The bakery has a daily limit of 150 pounds of flour, and each chocolate cake requires 1 pound, while each vanilla cake requires 2 pounds.\nmodel.addCons(Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total cost of production\": \"Total_Cost\", \"range\": \"Total_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each croissant is $0.50, each muffin is $0.30, and each donut is $0.40. The bakery aims to minimize the total daily production cost while meeting the demand for each pastry.\n// Objective Function: Minimize: 0.50*Croissants + 0.30*Muffins + 0.40*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is 500 kg. Each croissant requires 0.5 kg of flour, each muffin requires 0.4 kg, and each donut requires 0.6 kg.\n// 0.5*Croissants + 0.4*Muffins + 0.6*Donuts <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited daily labor capacity of 8 hours. Each croissant requires 0.02 hours of labor, each muffin requires 0.015 hours, and each donut requires 0.03 hours.\n// 0.02*Croissants + 0.015*Muffins + 0.03*Donuts <= 8",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the demand for each pastry. The cost of producing each pastry and the requirements for flour and labor are given in the following Table.\n\n| Pastry   | Production Cost | Flour Requirement (kg) | Labor Requirement (hours) |\n|----------|-----------------|------------------------|---------------------------|\n| Croissants | $0.50          | 0.5                    | 0.02                      |\n| Muffins   | $0.30          | 0.4                    | 0.015                     |\n| Donuts    | $0.40          | 0.6                    | 0.03                      |\n\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. The bakery has a limited daily supply of flour, which is 500 kg. The bakery also has a limited daily labor capacity of 8 hours. \n\nPlease help the bakery to minimize the total daily production cost while meeting the demand and constraints for each pastry.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Croissants + 0.30*Muffins + 0.40*Donuts)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a limited daily supply of flour, which is 500 kg.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.6*Donuts <= 500)\n## The bakery has a limited daily labor capacity of 8 hours.\nmodel.addCons(0.02*Croissants + 0.015*Muffins + 0.03*Donuts <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Minimized Total Cost of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1130,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total cost of production\": \"Total_Cost\", \"range\": \"Total_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each croissant is $0.50, each muffin is $0.30, and each donut is $0.40. The bakery aims to minimize the total daily production cost while meeting the demand for each pastry.\n// Objective Function: Minimize: 0.50*Croissants + 0.30*Muffins + 0.40*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is 500 kg. Each croissant requires 0.5 kg of flour, each muffin requires 0.4 kg, and each donut requires 0.6 kg.\n// 0.5*Croissants + 0.4*Muffins + 0.6*Donuts <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited daily labor capacity of 8 hours. Each croissant requires 0.02 hours of labor, each muffin requires 0.015 hours, and each donut requires 0.03 hours.\n// 0.02*Croissants + 0.015*Muffins + 0.03*Donuts <= 8",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the demand for each pastry. The cost of producing each croissant is $0.50, each muffin is $0.30, and each donut is $0.40. The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts. The bakery has a limited daily supply of flour, which is 500 kg, with each croissant requiring 0.5 kg of flour, each muffin requiring 0.4 kg, and each donut requiring 0.6 kg. Additionally, the bakery has a limited daily labor capacity of 8 hours, with each croissant requiring 0.02 hours of labor, each muffin requiring 0.015 hours, and each donut requiring 0.03 hours. The bakery aims to minimize the total daily production cost while meeting the demand for each pastry. Please help the bakery determine the optimal number of each type of pastry to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Croissants + 0.30*Muffins + 0.40*Donuts)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 croissants, 150 muffins, and 200 donuts.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a limited daily supply of flour, which is 500 kg.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.6*Donuts <= 500)\n## The bakery has a limited daily labor capacity of 8 hours.\nmodel.addCons(0.02*Croissants + 0.015*Muffins + 0.03*Donuts <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Minimized Total Cost of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 1\", \"type\": \"integer\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 2\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 200 units per day. Each croissant requires 1 unit of oven capacity, and each muffin requires 2 units.\n// Croissants + 2*Muffins <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 75 muffins.\n// Croissants >= 50\n// Muffins >= 75\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day.\n// Muffins <= 100",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and the demand for each pastry. The profit per croissant is $2, and the profit per muffin is $3. The bakery has an oven capacity of 200 units per day. Each croissant requires 1 unit of oven capacity, and each muffin requires 2 units. The bakery has a daily demand for at least 50 croissants and 75 muffins. Additionally, the bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day.\n\nPlease help the bakery to maximize its daily profit from selling pastries.\n\n| Pastry   | Profit per Unit | Oven Usage per Unit |\n|----------|-----------------|---------------------|\n| Croissants | $2             | 1 unit              |\n| Muffins    | $3             | 2 units             |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of croissants and muffins to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has an oven capacity of 200 units per day.\nmodel.addCons(Croissants + 2*Muffins <= 200)\n## The bakery has a daily demand for at least 50 croissants and 75 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 75)\n## The bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day.\nmodel.addCons(Muffins <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to Produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to Produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and the demand for each pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 1\", \"type\": \"integer\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 2\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 200 units per day. Each croissant requires 1 unit of oven capacity, and each muffin requires 2 units.\n// Croissants + 2*Muffins <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 75 muffins.\n// Croissants >= 50\n// Muffins >= 75\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day.\n// Muffins <= 100",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and the demand for each pastry. The profit per croissant is $2, and the profit per muffin is $3. The bakery has an oven capacity of 200 units per day. Each croissant requires 1 unit of oven capacity, and each muffin requires 2 units. The bakery has a daily demand for at least 50 croissants and 75 muffins. Additionally, the bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of croissants and muffins to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has an oven capacity of 200 units per day.\nmodel.addCons(Croissants + 2*Muffins <= 200)\n## The bakery has a daily demand for at least 50 croissants and 75 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 75)\n## The bakery has a limited supply of ingredients, which allows for the production of at most 100 muffins per day.\nmodel.addCons(Muffins <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to Produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to Produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 711,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and daily demand.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage per wheat loaf\": \"Wheat_Oven_Usage\", \"range\": \"Wheat_Oven_Usage >= 0\", \"type\": \"real\"}\n// {\"oven usage per rye loaf\": \"Rye_Oven_Usage\", \"range\": \"Rye_Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat loaf is $3, and the profit per rye loaf is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe total oven usage for wheat bread is 0.5 hours per loaf, and for rye bread, it is 0.4 hours per loaf. The bakery has a daily oven capacity of 8 hours.\n// Wheat_Oven_Usage * Wheat_Loaves + Rye_Oven_Usage * Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours. The labor time for baking wheat bread is 1 hour per loaf, and for rye bread, it is 0.8 hours per loaf.\n// Wheat_Loaves + 0.8 * Rye_Loaves <= 12",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and daily demand. The profit per wheat loaf is $3, and the profit per rye loaf is $4. The following table summarizes the oven usage and labor time per loaf for each type of bread.\n\n| Bread Type | Profit per Loaf | Oven Usage per Loaf | Labor Time per Loaf |\n|------------|-----------------|---------------------|---------------------|\n| Wheat      | $3              | 0.5 hours           | 1 hour              |\n| Rye        | $4              | 0.4 hours           | 0.8 hours           |\n\nThe bakery has a daily oven capacity of 8 hours. The daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves. The bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours. \n\nPlease help the bakery to maximize its daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven usage per loaf of each type of bread\nWheat_Oven_Usage = 0.5 # hours per loaf\nRye_Oven_Usage = 0.4 # hours per loaf\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The total oven usage for wheat bread is 0.5 hours per loaf, and for rye bread, it is 0.4 hours per loaf. The bakery has a daily oven capacity of 8 hours.\nmodel.addCons(Wheat_Oven_Usage * Wheat_Loaves + Rye_Oven_Usage * Rye_Loaves <= 8)\n## The daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n## The bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours. The labor time for baking wheat bread is 1 hour per loaf, and for rye bread, it is 0.8 hours per loaf.\nmodel.addCons(Wheat_Loaves + 0.8 * Rye_Loaves <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and daily demand.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven usage per wheat loaf\": \"Wheat_Oven_Usage\", \"range\": \"Wheat_Oven_Usage >= 0\", \"type\": \"real\"}\n// {\"oven usage per rye loaf\": \"Rye_Oven_Usage\", \"range\": \"Rye_Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat loaf is $3, and the profit per rye loaf is $4. The bakery aims to maximize its daily profit from selling both types of bread.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe total oven usage for wheat bread is 0.5 hours per loaf, and for rye bread, it is 0.4 hours per loaf. The bakery has a daily oven capacity of 8 hours.\n// Wheat_Oven_Usage * Wheat_Loaves + Rye_Oven_Usage * Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves.\n// Wheat_Loaves >= 10\n// Rye_Loaves >= 15\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours. The labor time for baking wheat bread is 1 hour per loaf, and for rye bread, it is 0.8 hours per loaf.\n// Wheat_Loaves + 0.8 * Rye_Loaves <= 12",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and daily demand. The profit per wheat loaf is $3, and the profit per rye loaf is $4. The total oven usage for wheat bread is 0.5 hours per loaf, and for rye bread, it is 0.4 hours per loaf, with a daily oven capacity of 8 hours. The daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves. Additionally, the bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours, with labor time for baking wheat bread being 1 hour per loaf and for rye bread being 0.8 hours per loaf. Please help the bakery to maximize its daily profit from selling both types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven usage per loaf of each type of bread\nWheat_Oven_Usage = 0.5 # hours per loaf\nRye_Oven_Usage = 0.4 # hours per loaf\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The total oven usage for wheat bread is 0.5 hours per loaf, and for rye bread, it is 0.4 hours per loaf. The bakery has a daily oven capacity of 8 hours.\nmodel.addCons(Wheat_Oven_Usage * Wheat_Loaves + Rye_Oven_Usage * Rye_Loaves <= 8)\n## The daily demand for wheat bread is at least 10 loaves, and for rye bread, it is at least 15 loaves.\nmodel.addCons(Wheat_Loaves >= 10)\nmodel.addCons(Rye_Loaves >= 15)\n## The bakery has a labor constraint where the total time spent on baking both types of bread should not exceed 12 hours. The labor time for baking wheat bread is 1 hour per loaf, and for rye bread, it is 0.8 hours per loaf.\nmodel.addCons(Wheat_Loaves + 0.8 * Rye_Loaves <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources such as flour and labor hours.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"total flour used\": \"Total_Flour\", \"range\": \"Total_Flour >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Total_Labor\", \"range\": \"Total_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves.\n// Wheat_Loaves >= 50\n// Rye_Loaves >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources such as flour and labor hours. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The requirements for each type of bread are given in the following Table.\n\n| Bread Type | Flour per Loaf | Labor Hours per Loaf |\n|------------|----------------|----------------------|\n| Wheat      | 0.5 kg         | 0.2 hours            |\n| Rye        | 0.6 kg         | 0.3 hours            |\n\nThe bakery has a daily supply of 100 kg of flour and a daily limit of 20 hours of labor. The bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves.\nmodel.addCons(Wheat_Loaves >= 50)\nmodel.addCons(Rye_Loaves >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources such as flour and labor hours.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"total flour used\": \"Total_Flour\", \"range\": \"Total_Flour >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Total_Labor\", \"range\": \"Total_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves.\n// Wheat_Loaves >= 50\n// Rye_Loaves >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources such as flour and labor hours.\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nThe bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves.\nPlease help the bakery determine the optimal number of wheat and rye bread loaves to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery has a minimum daily demand for wheat bread of 50 loaves and a minimum daily demand for rye bread of 30 loaves.\nmodel.addCons(Wheat_Loaves >= 50)\nmodel.addCons(Rye_Loaves >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// Wheat_Loaves + Rye_Loaves >= 50",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table shows the requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Flour per Loaf | Labor per Loaf |\n|------------|-----------------|----------------|----------------|\n| Wheat      | $2              | 0.5 kg         | 0.2 hours      |\n| Rye        | $3              | 0.6 kg         | 0.3 hours      |\n\nThe bakery has a daily supply of 100 kg of flour and a daily limit of 20 hours of labor. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// Wheat_Loaves + Rye_Loaves >= 50",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"hours of oven time used for wheat bread\": \"Wheat_Oven_Time\", \"range\": \"Wheat_Oven_Time >= 0\", \"type\": \"real\"}\n// {\"hours of oven time used for rye bread\": \"Rye_Oven_Time\", \"range\": \"Rye_Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 10 hours of oven time. Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.15 hours of oven time.\n// Wheat_Oven_Time + Rye_Oven_Time <= 10\n// Wheat_Oven_Time = 0.1 * Wheat_Loaves\n// Rye_Oven_Time = 0.15 * Rye_Loaves\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 120 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5 * Wheat_Loaves + 0.6 * Rye_Loaves <= 120\n\n## Generate Constraint-3:\nThe market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day.\n// Wheat_Loaves >= 50\n// Rye_Loaves >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources and market demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The following table summarizes the resource requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement per Loaf | Oven Time per Loaf |\n|------------|-----------------|----------------------------|---------------------|\n| Wheat      | $3              | 0.5 kg                     | 0.1 hours          |\n| Rye        | $4              | 0.6 kg                     | 0.15 hours         |\n\nThe bakery has a daily limit of 10 hours of oven time and a daily supply of 120 kg of flour. The market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The hours of oven time used for each type of bread\nWheat_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Time\", lb=0) # hours of oven time used for wheat bread\nRye_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Time\", lb=0) # hours of oven time used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The bakery has a daily limit of 10 hours of oven time.\nmodel.addCons(Wheat_Oven_Time + Rye_Oven_Time <= 10)\n## Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.15 hours of oven time.\nmodel.addCons(Wheat_Oven_Time == 0.1 * Wheat_Loaves)\nmodel.addCons(Rye_Oven_Time == 0.15 * Rye_Loaves)\n## The bakery has a daily supply of 120 kg of flour.\nmodel.addCons(0.5 * Wheat_Loaves + 0.6 * Rye_Loaves <= 120)\n## The market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day.\nmodel.addCons(Wheat_Loaves >= 50)\nmodel.addCons(Rye_Loaves >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"hours of oven time used for wheat bread\": \"Wheat_Oven_Time\", \"range\": \"Wheat_Oven_Time >= 0\", \"type\": \"real\"}\n// {\"hours of oven time used for rye bread\": \"Rye_Oven_Time\", \"range\": \"Rye_Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 10 hours of oven time. Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.15 hours of oven time.\n// Wheat_Oven_Time + Rye_Oven_Time <= 10\n// Wheat_Oven_Time = 0.1 * Wheat_Loaves\n// Rye_Oven_Time = 0.15 * Rye_Loaves\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 120 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5 * Wheat_Loaves + 0.6 * Rye_Loaves <= 120\n\n## Generate Constraint-3:\nThe market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day.\n// Wheat_Loaves >= 50\n// Rye_Loaves >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available resources and market demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery has a daily limit of 10 hours of oven time. Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.15 hours of oven time. The bakery has a daily supply of 120 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The hours of oven time used for each type of bread\nWheat_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Time\", lb=0) # hours of oven time used for wheat bread\nRye_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Time\", lb=0) # hours of oven time used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves)\n\n# Add constraints\n## The bakery has a daily limit of 10 hours of oven time.\nmodel.addCons(Wheat_Oven_Time + Rye_Oven_Time <= 10)\n## Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.15 hours of oven time.\nmodel.addCons(Wheat_Oven_Time == 0.1 * Wheat_Loaves)\nmodel.addCons(Rye_Oven_Time == 0.15 * Rye_Loaves)\n## The bakery has a daily supply of 120 kg of flour.\nmodel.addCons(0.5 * Wheat_Loaves + 0.6 * Rye_Loaves <= 120)\n## The market demand for wheat bread is at least 50 loaves per day, and for rye bread, it is at least 40 loaves per day.\nmodel.addCons(Wheat_Loaves >= 50)\nmodel.addCons(Rye_Loaves >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Bread Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"real\"}\n// {\"oven usage time for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 5 minutes of oven time, and each muffin requires 10 minutes of oven time. The bakery has a total of 480 minutes of oven time available daily.\n// 5*Croissants + 10*Muffins <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and sugar. Each croissant requires 100 grams of flour and 50 grams of sugar. Each muffin requires 150 grams of flour and 75 grams of sugar. The daily supply of flour is 12 kilograms, and the daily supply of sugar is 6 kilograms.\n// 100*Croissants + 150*Muffins <= 12000\n// 50*Croissants + 75*Muffins <= 6000\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per croissant is $1.50, and the profit per muffin is $2.00. The requirements for oven time and ingredients for each pastry are given in the following Table.\n\n| Pastry   | Oven Time per Unit | Flour per Unit | Sugar per Unit |\n|----------|--------------------|----------------|----------------|\n| Croissant| 5 minutes          | 100 grams      | 50 grams       |\n| Muffin   | 10 minutes         | 150 grams      | 75 grams       |\n\nThe bakery has a total of 480 minutes of oven time available daily. The daily supply of flour is 12 kilograms, and the daily supply of sugar is 6 kilograms. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## Oven usage time for each type of pastry\nOven_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Croissants\", lb=0) # oven usage time for croissants\nOven_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Muffins\", lb=0) # oven usage time for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 5 minutes of oven time, and each muffin requires 10 minutes of oven time.\nmodel.addCons(5*Croissants + 10*Muffins <= 480)\n## Each croissant requires 100 grams of flour and 50 grams of sugar. Each muffin requires 150 grams of flour and 75 grams of sugar.\nmodel.addCons(100*Croissants + 150*Muffins <= 12000)\nmodel.addCons(50*Croissants + 75*Muffins <= 6000)\n## The bakery must produce at least 50 croissants and 30 muffins daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"real\"}\n// {\"oven usage time for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 5 minutes of oven time, and each muffin requires 10 minutes of oven time. The bakery has a total of 480 minutes of oven time available daily.\n// 5*Croissants + 10*Muffins <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and sugar. Each croissant requires 100 grams of flour and 50 grams of sugar. Each muffin requires 150 grams of flour and 75 grams of sugar. The daily supply of flour is 12 kilograms, and the daily supply of sugar is 6 kilograms.\n// 100*Croissants + 150*Muffins <= 12000\n// 50*Croissants + 75*Muffins <= 6000\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per croissant is $1.50, and the profit per muffin is $2.00. Each croissant requires 5 minutes of oven time, and each muffin requires 10 minutes of oven time. The bakery has a total of 480 minutes of oven time available daily. The bakery has a limited supply of flour and sugar. Each croissant requires 100 grams of flour and 50 grams of sugar. Each muffin requires 150 grams of flour and 75 grams of sugar. The daily supply of flour is 12 kilograms, and the daily supply of sugar is 6 kilograms. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## Oven usage time for each type of pastry\nOven_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Croissants\", lb=0) # oven usage time for croissants\nOven_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Muffins\", lb=0) # oven usage time for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 5 minutes of oven time, and each muffin requires 10 minutes of oven time.\nmodel.addCons(5*Croissants + 10*Muffins <= 480)\n## Each croissant requires 100 grams of flour and 50 grams of sugar. Each muffin requires 150 grams of flour and 75 grams of sugar.\nmodel.addCons(100*Croissants + 150*Muffins <= 12000)\nmodel.addCons(50*Croissants + 75*Muffins <= 6000)\n## The bakery must produce at least 50 croissants and 30 muffins daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Profit per Cake | Eggs Required |\n|-----------------|-----------------|---------------|\n| Chocolate       | $5              | 2             |\n| Vanilla         | $4              | 1             |\n\nThe bakery has a daily supply of 100 eggs. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 873,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 659,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves four main resources: labor, raw materials, machinery, and storage.\n// {\"number of units of Product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and for Product B is $15. The company wants to minimize the total production cost while meeting the demand for each product.\n// Objective Function: Minimize: 10*A + 15*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor and 3 units of raw materials. Each unit of Product B requires 4 hours of labor and 2 units of raw materials. The company has 100 hours of labor and 120 units of raw materials available.\n// 2*A + 4*B <= 100 (Labor constraint)\n// 3*A + 2*B <= 120 (Raw materials constraint)\n\n## Generate Constraint-2:\nThe demand for Product A is at least 20 units, and for Product B is at least 15 units.\n// A >= 20\n// B >= 15\n\n## Generate Constraint-3:\nThe machinery and storage constraints are not considered in this scenario as they are not critical to the current decision-making process.\n// (No additional constraints needed for machinery and storage)",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves four main resources: labor, raw materials, machinery, and storage. The cost of producing one unit of Product A is $10, and for Product B is $15.\n\n| Product | Cost per Unit | Labor per Unit | Raw Materials per Unit |\n|---------|---------------|----------------|-------------------------|\n| A       | $10           | 2 hours        | 3 units                 |\n| B       | $15           | 4 hours        | 2 units                 |\n\nThe company has 100 hours of labor and 120 units of raw materials available. The demand for Product A is at least 20 units, and for Product B is at least 15 units. The machinery and storage constraints are not considered in this scenario as they are not critical to the current decision-making process.\n\nPlease help the company to minimize the total production cost while meeting the demand for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor and 3 units of raw materials.\n## Each unit of Product B requires 4 hours of labor and 2 units of raw materials.\n## The company has 100 hours of labor and 120 units of raw materials available.\nmodel.addCons(2*A + 4*B <= 100) # Labor constraint\nmodel.addCons(3*A + 2*B <= 120) # Raw materials constraint\n## The demand for Product A is at least 20 units, and for Product B is at least 15 units.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A to produce: \", model.getVal(A))\n    print(\"Number of units of Product B to produce: \", model.getVal(B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves four main resources: labor, raw materials, machinery, and storage.\n// {\"number of units of Product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and for Product B is $15. The company wants to minimize the total production cost while meeting the demand for each product.\n// Objective Function: Minimize: 10*A + 15*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor and 3 units of raw materials. Each unit of Product B requires 4 hours of labor and 2 units of raw materials. The company has 100 hours of labor and 120 units of raw materials available.\n// 2*A + 4*B <= 100 (Labor constraint)\n// 3*A + 2*B <= 120 (Raw materials constraint)\n\n## Generate Constraint-2:\nThe demand for Product A is at least 20 units, and for Product B is at least 15 units.\n// A >= 20\n// B >= 15\n\n## Generate Constraint-3:\nThe machinery and storage constraints are not considered in this scenario as they are not critical to the current decision-making process.\n// (No additional constraints needed for machinery and storage)",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The cost of producing one unit of Product A is $10, and for Product B is $15. Each unit of Product A requires 2 hours of labor and 3 units of raw materials. Each unit of Product B requires 4 hours of labor and 2 units of raw materials. The company has 100 hours of labor and 120 units of raw materials available. The demand for Product A is at least 20 units, and for Product B is at least 15 units. Please help the company to minimize the total production cost while meeting the demand for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor and 3 units of raw materials.\n## Each unit of Product B requires 4 hours of labor and 2 units of raw materials.\n## The company has 100 hours of labor and 120 units of raw materials available.\nmodel.addCons(2*A + 4*B <= 100) # Labor constraint\nmodel.addCons(3*A + 2*B <= 120) # Raw materials constraint\n## The demand for Product A is at least 20 units, and for Product B is at least 15 units.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A to produce: \", model.getVal(A))\n    print(\"Number of units of Product B to produce: \", model.getVal(B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 694,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\n// 2*A + 3*B + 5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per week.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 5 units per week.\n// B >= 5",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Requirement (hours) |\n|---------|--------------------------|\n| A       | 2                        |\n| B       | 3                        |\n| C       | 5                        |\n\nThe company has a total of 100 hours of labor available per week. The market demand for Product A is at least 10 units per week, and for Product B is at least 5 units per week. The company aims to maximize the total profit from the sales of these products. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 5*C <= 100)\n## The market demand for Product A is at least 10 units per week.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at least 5 units per week.\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\n// 2*A + 3*B + 5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per week.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 5 units per week.\n// B >= 5",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products. Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week. The market demand for Product A is at least 10 units per week, and the market demand for Product B is at least 5 units per week. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 5*C <= 100)\n## The market demand for Product A is at least 10 units per week.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at least 5 units per week.\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs, profits, and daily demand.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of unsold wheat bread loaves\": \"unsold_wheat\", \"range\": \"unsold_wheat >= 0\", \"type\": \"integer\"}\n// {\"number of unsold rye bread loaves\": \"unsold_rye\", \"range\": \"unsold_rye >= 0\", \"type\": \"integer\"}\n// {\"number of unsold sourdough bread loaves\": \"unsold_sourdough\", \"range\": \"unsold_sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The selling price for each loaf is $3.00, $4.00, and $5.00 respectively. The bakery wants to maximize its daily profit, considering the cost of unsold bread (half the production cost).\n// Production_Cost = 1.50*wheat + 2.00*rye + 2.50*sourdough\n// Selling_Revenue = 3.00*wheat + 4.00*rye + 5.00*sourdough\n// Unsold_Cost = 0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough\n// Objective Function: Maximize: Selling_Revenue - Production_Cost - Unsold_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 100 loaves of each type of bread per day.\n// wheat <= 100\n// rye <= 100\n// sourdough <= 100\n\n## Generate Constraint-2:\nThe daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively.\n// wheat - unsold_wheat == 80\n// rye - unsold_rye == 60\n// sourdough - unsold_sourdough == 40\n\n## Generate Constraint-3:\nThe total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day.\n// wheat + rye + sourdough <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs, profits, and daily demand. The cost of producing each loaf and the selling price for each loaf are given in the following Table.\n\n| Type of Bread | Production Cost | Selling Price |\n|---------------|-----------------|---------------|\n| Wheat         | $1.50           | $3.00         |\n| Rye           | $2.00           | $4.00         |\n| Sourdough     | $2.50           | $5.00         |\n\nThe bakery can produce a maximum of 100 loaves of each type of bread per day. The daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively. The bakery wants to minimize the cost of unsold bread (half the production cost). The total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day.\n\nPlease help the bakery to maximize its daily profit, considering the cost of unsold bread and the constraints on production and demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread to produce and unsold\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nunsold_wheat = model.addVar(vtype=\"INTEGER\", name=\"unsold_wheat\", lb=0) # number of unsold wheat bread loaves\nunsold_rye = model.addVar(vtype=\"INTEGER\", name=\"unsold_rye\", lb=0) # number of unsold rye bread loaves\nunsold_sourdough = model.addVar(vtype=\"INTEGER\", name=\"unsold_sourdough\", lb=0) # number of unsold sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 1.50*wheat + 2.00*rye + 2.50*sourdough\n## Selling_Revenue = 3.00*wheat + 4.00*rye + 5.00*sourdough\n## Unsold_Cost = 0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough\nmodel.addCons(obj == (3.00*wheat + 4.00*rye + 5.00*sourdough) - (1.50*wheat + 2.00*rye + 2.50*sourdough) - (0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough))\n\n# Add constraints\n## The bakery can produce a maximum of 100 loaves of each type of bread per day.\nmodel.addCons(wheat <= 100)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 100)\n## The daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively.\nmodel.addCons(wheat - unsold_wheat == 80)\nmodel.addCons(rye - unsold_rye == 60)\nmodel.addCons(sourdough - unsold_sourdough == 40)\n## The total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day.\nmodel.addCons(wheat + rye + sourdough <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of unsold wheat bread loaves: \", model.getVal(unsold_wheat))\n    print(\"Number of unsold rye bread loaves: \", model.getVal(unsold_rye))\n    print(\"Number of unsold sourdough bread loaves: \", model.getVal(unsold_sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs, profits, and daily demand.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of unsold wheat bread loaves\": \"unsold_wheat\", \"range\": \"unsold_wheat >= 0\", \"type\": \"integer\"}\n// {\"number of unsold rye bread loaves\": \"unsold_rye\", \"range\": \"unsold_rye >= 0\", \"type\": \"integer\"}\n// {\"number of unsold sourdough bread loaves\": \"unsold_sourdough\", \"range\": \"unsold_sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The selling price for each loaf is $3.00, $4.00, and $5.00 respectively. The bakery wants to maximize its daily profit, considering the cost of unsold bread (half the production cost).\n// Production_Cost = 1.50*wheat + 2.00*rye + 2.50*sourdough\n// Selling_Revenue = 3.00*wheat + 4.00*rye + 5.00*sourdough\n// Unsold_Cost = 0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough\n// Objective Function: Maximize: Selling_Revenue - Production_Cost - Unsold_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 100 loaves of each type of bread per day.\n// wheat <= 100\n// rye <= 100\n// sourdough <= 100\n\n## Generate Constraint-2:\nThe daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively.\n// wheat - unsold_wheat == 80\n// rye - unsold_rye == 60\n// sourdough - unsold_sourdough == 40\n\n## Generate Constraint-3:\nThe total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day.\n// wheat + rye + sourdough <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs, profits, and daily demand. The cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The selling price for each loaf is $3.00, $4.00, and $5.00 respectively. The bakery wants to maximize its daily profit, considering the cost of unsold bread (half the production cost). The bakery can produce a maximum of 100 loaves of each type of bread per day. The daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively. The total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread to produce and unsold\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nunsold_wheat = model.addVar(vtype=\"INTEGER\", name=\"unsold_wheat\", lb=0) # number of unsold wheat bread loaves\nunsold_rye = model.addVar(vtype=\"INTEGER\", name=\"unsold_rye\", lb=0) # number of unsold rye bread loaves\nunsold_sourdough = model.addVar(vtype=\"INTEGER\", name=\"unsold_sourdough\", lb=0) # number of unsold sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 1.50*wheat + 2.00*rye + 2.50*sourdough\n## Selling_Revenue = 3.00*wheat + 4.00*rye + 5.00*sourdough\n## Unsold_Cost = 0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough\nmodel.addCons(obj == (3.00*wheat + 4.00*rye + 5.00*sourdough) - (1.50*wheat + 2.00*rye + 2.50*sourdough) - (0.75*unsold_wheat + 1.00*unsold_rye + 1.25*unsold_sourdough))\n\n# Add constraints\n## The bakery can produce a maximum of 100 loaves of each type of bread per day.\nmodel.addCons(wheat <= 100)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 100)\n## The daily demand for wheat, rye, and sourdough bread is 80, 60, and 40 loaves respectively.\nmodel.addCons(wheat - unsold_wheat == 80)\nmodel.addCons(rye - unsold_rye == 60)\nmodel.addCons(sourdough - unsold_sourdough == 40)\n## The total number of loaves produced should not exceed the bakery's capacity of 200 loaves per day.\nmodel.addCons(wheat + rye + sourdough <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of unsold wheat bread loaves: \", model.getVal(unsold_wheat))\n    print(\"Number of unsold rye bread loaves: \", model.getVal(unsold_rye))\n    print(\"Number of unsold sourdough bread loaves: \", model.getVal(unsold_sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product.\n// {\"whether to use Machine 1\": \"M1\", \"range\": \"M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2\": \"M2\", \"range\": \"M2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 3\": \"M3\", \"range\": \"M3 = 0 or 1\", \"type\": \"binary\"}\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines.\n// Profit = 10*A + 15*B + 20*C + 25*D\n// Machine_Cost = 500*M1 + 600*M2 + 700*M3\n// Objective Function: Maximize: Profit - Machine_Cost\n\n## Generate Constraint-1:\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units.\n// A + B + C + D <= 100*M1\n// A + B + C + D <= 150*M2\n// A + B + C + D <= 200*M3\n\n## Generate Constraint-2:\nThe total production of all products should not exceed 300 units.\n// A + B + C + D <= 300\n\n## Generate Constraint-3:\nThe manufacturer can only use two machines at most.\n// M1 + M2 + M3 <= 2",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The following table summarizes the profit per unit and the fixed cost of each machine.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n| D       | 25$             |\n\n| Machine | Fixed Cost |\n|---------|------------|\n| 1       | 500$       |\n| 2       | 600$       |\n| 3       | 700$       |\n\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units. The total production of all products should not exceed 300 units. The manufacturer can only use two machines at most.\n\nPlease help the manufacturer to maximize the total profit while considering the fixed costs of machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each machine\nM1 = model.addVar(vtype=\"B\", name=\"M1\") # whether to use Machine 1\nM2 = model.addVar(vtype=\"B\", name=\"M2\") # whether to use Machine 2\nM3 = model.addVar(vtype=\"B\", name=\"M3\") # whether to use Machine 3\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 10*A + 15*B + 20*C + 25*D\nProfit = 10*A + 15*B + 20*C + 25*D\n## Machine_Cost = 500*M1 + 600*M2 + 700*M3\nMachine_Cost = 500*M1 + 600*M2 + 700*M3\nmodel.addCons(obj == Profit - Machine_Cost)\n\n# Add constraints\n## Each machine has a limited production capacity.\nmodel.addCons(A + B + C + D <= 100*M1)\nmodel.addCons(A + B + C + D <= 150*M2)\nmodel.addCons(A + B + C + D <= 200*M3)\n## The total production of all products should not exceed 300 units.\nmodel.addCons(A + B + C + D <= 300)\n## The manufacturer can only use two machines at most.\nmodel.addCons(M1 + M2 + M3 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Machine 1: \", model.getVal(M1))\n    print(\"Whether to use Machine 2: \", model.getVal(M2))\n    print(\"Whether to use Machine 3: \", model.getVal(M3))\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 7,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product.\n// {\"whether to use Machine 1\": \"M1\", \"range\": \"M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2\": \"M2\", \"range\": \"M2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 3\": \"M3\", \"range\": \"M3 = 0 or 1\", \"type\": \"binary\"}\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines.\n// Profit = 10*A + 15*B + 20*C + 25*D\n// Machine_Cost = 500*M1 + 600*M2 + 700*M3\n// Objective Function: Maximize: Profit - Machine_Cost\n\n## Generate Constraint-1:\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units.\n// A + B + C + D <= 100*M1\n// A + B + C + D <= 150*M2\n// A + B + C + D <= 200*M3\n\n## Generate Constraint-2:\nThe total production of all products should not exceed 300 units.\n// A + B + C + D <= 300\n\n## Generate Constraint-3:\nThe manufacturer can only use two machines at most.\n// M1 + M2 + M3 <= 2",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines. Each machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units. The total production of all products should not exceed 300 units. The manufacturer can only use two machines at most. Please help the manufacturer to maximize the total profit while considering the fixed costs of machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each machine\nM1 = model.addVar(vtype=\"B\", name=\"M1\") # whether to use Machine 1\nM2 = model.addVar(vtype=\"B\", name=\"M2\") # whether to use Machine 2\nM3 = model.addVar(vtype=\"B\", name=\"M3\") # whether to use Machine 3\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 10*A + 15*B + 20*C + 25*D\nProfit = 10*A + 15*B + 20*C + 25*D\n## Machine_Cost = 500*M1 + 600*M2 + 700*M3\nMachine_Cost = 500*M1 + 600*M2 + 700*M3\nmodel.addCons(obj == Profit - Machine_Cost)\n\n# Add constraints\n## Each machine has a limited production capacity.\nmodel.addCons(A + B + C + D <= 100*M1)\nmodel.addCons(A + B + C + D <= 150*M2)\nmodel.addCons(A + B + C + D <= 200*M3)\n## The total production of all products should not exceed 300 units.\nmodel.addCons(A + B + C + D <= 300)\n## The manufacturer can only use two machines at most.\nmodel.addCons(M1 + M2 + M3 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Machine 1: \", model.getVal(M1))\n    print(\"Whether to use Machine 2: \", model.getVal(M2))\n    print(\"Whether to use Machine 3: \", model.getVal(M3))\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 7,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many units of each type of bread to produce daily while considering the production capacity, demand, and cost of ingredients.\n// {\"number of wheat bread units produced\": \"wheat_bread\", \"range\": \"wheat_bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread units produced\": \"rye_bread\", \"range\": \"rye_bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread units produced\": \"sourdough_bread\", \"range\": \"sourdough_bread >= 0\", \"type\": \"integer\"}\n// {\"cost of producing wheat bread\": \"cost_wheat\", \"range\": \"cost_wheat >= 0\", \"type\": \"real\"}\n// {\"cost of producing rye bread\": \"cost_rye\", \"range\": \"cost_rye >= 0\", \"type\": \"real\"}\n// {\"cost of producing sourdough bread\": \"cost_sourdough\", \"range\": \"cost_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: cost_wheat * wheat_bread + cost_rye * rye_bread + cost_sourdough * sourdough_bread\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 units.\n// wheat_bread + rye_bread + sourdough_bread <= 500\n\n## Generate Constraint-2:\nThe daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively.\n// wheat_bread >= 200\n// rye_bread >= 150\n// sourdough_bread >= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least twice as many wheat bread units as rye bread units.\n// wheat_bread >= 2 * rye_bread",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many units of each type of bread to produce daily while considering the production capacity, demand, and cost of ingredients. The cost of producing each unit of wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to minimize the total daily production cost. The bakery has a daily production capacity of 500 units. The daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively. The bakery must produce at least twice as many wheat bread units as rye bread units.\n\nPlease help the bakery determine the optimal number of units of each type of bread to produce daily to meet these conditions.\n\n| Type of Bread | Cost per Unit |\n|---------------|---------------|\n| Wheat         | $2            |\n| Rye           | $3            |\n| Sourdough     | $4            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread produced\nwheat_bread = model.addVar(vtype=\"INTEGER\", name=\"wheat_bread\", lb=0) # number of wheat bread units produced\nrye_bread = model.addVar(vtype=\"INTEGER\", name=\"rye_bread\", lb=0) # number of rye bread units produced\nsourdough_bread = model.addVar(vtype=\"INTEGER\", name=\"sourdough_bread\", lb=0) # number of sourdough bread units produced\n## The cost of producing each unit of bread\ncost_wheat = 2 # cost of producing wheat bread\ncost_rye = 3 # cost of producing rye bread\ncost_sourdough = 4 # cost of producing sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == cost_wheat * wheat_bread + cost_rye * rye_bread + cost_sourdough * sourdough_bread)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 units.\nmodel.addCons(wheat_bread + rye_bread + sourdough_bread <= 500)\n## The daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively.\nmodel.addCons(wheat_bread >= 200)\nmodel.addCons(rye_bread >= 150)\nmodel.addCons(sourdough_bread >= 100)\n## The bakery must produce at least twice as many wheat bread units as rye bread units.\nmodel.addCons(wheat_bread >= 2 * rye_bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread units produced: \", model.getVal(wheat_bread))\n    print(\"Number of rye bread units produced: \", model.getVal(rye_bread))\n    print(\"Number of sourdough bread units produced: \", model.getVal(sourdough_bread))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many units of each type of bread to produce daily while considering the production capacity, demand, and cost of ingredients.\n// {\"number of wheat bread units produced\": \"wheat_bread\", \"range\": \"wheat_bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread units produced\": \"rye_bread\", \"range\": \"rye_bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread units produced\": \"sourdough_bread\", \"range\": \"sourdough_bread >= 0\", \"type\": \"integer\"}\n// {\"cost of producing wheat bread\": \"cost_wheat\", \"range\": \"cost_wheat >= 0\", \"type\": \"real\"}\n// {\"cost of producing rye bread\": \"cost_rye\", \"range\": \"cost_rye >= 0\", \"type\": \"real\"}\n// {\"cost of producing sourdough bread\": \"cost_sourdough\", \"range\": \"cost_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: cost_wheat * wheat_bread + cost_rye * rye_bread + cost_sourdough * sourdough_bread\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 units.\n// wheat_bread + rye_bread + sourdough_bread <= 500\n\n## Generate Constraint-2:\nThe daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively.\n// wheat_bread >= 200\n// rye_bread >= 150\n// sourdough_bread >= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least twice as many wheat bread units as rye bread units.\n// wheat_bread >= 2 * rye_bread",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many units of each type of bread to produce daily while considering the production capacity, demand, and cost of ingredients. The cost of producing each unit of wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to minimize the total daily production cost. The bakery has a daily production capacity of 500 units. The daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively. The bakery must produce at least twice as many wheat bread units as rye bread units. Please help the bakery determine the optimal number of units of each type of bread to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread produced\nwheat_bread = model.addVar(vtype=\"INTEGER\", name=\"wheat_bread\", lb=0) # number of wheat bread units produced\nrye_bread = model.addVar(vtype=\"INTEGER\", name=\"rye_bread\", lb=0) # number of rye bread units produced\nsourdough_bread = model.addVar(vtype=\"INTEGER\", name=\"sourdough_bread\", lb=0) # number of sourdough bread units produced\n## The cost of producing each unit of bread\ncost_wheat = 2 # cost of producing wheat bread\ncost_rye = 3 # cost of producing rye bread\ncost_sourdough = 4 # cost of producing sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == cost_wheat * wheat_bread + cost_rye * rye_bread + cost_sourdough * sourdough_bread)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 units.\nmodel.addCons(wheat_bread + rye_bread + sourdough_bread <= 500)\n## The daily demand for wheat, rye, and sourdough bread is 200, 150, and 100 units respectively.\nmodel.addCons(wheat_bread >= 200)\nmodel.addCons(rye_bread >= 150)\nmodel.addCons(sourdough_bread >= 100)\n## The bakery must produce at least twice as many wheat bread units as rye bread units.\nmodel.addCons(wheat_bread >= 2 * rye_bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread units produced: \", model.getVal(wheat_bread))\n    print(\"Number of rye bread units produced: \", model.getVal(rye_bread))\n    print(\"Number of sourdough bread units produced: \", model.getVal(sourdough_bread))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of units of Product A demanded daily\": \"Demand_A\", \"range\": \"Demand_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B demanded daily\": \"Demand_B\", \"range\": \"Demand_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\n// A <= Demand_A\n// B <= Demand_B\n\n## Generate Constraint-3:\nThe company must meet at least 90% of the daily demand for each product.\n// A >= 0.9 * Demand_A\n// B >= 0.9 * Demand_B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $50, and for Product B is $70. The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily. The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product. Additionally, the company must meet at least 90% of the daily demand for each product.\n\nPlease help the company to maximize the total daily profit from both products.\n\n| Product | Profit per Unit | Labor Hours per Unit | Daily Demand |\n|---------|-----------------|----------------------|--------------|\n| A       | $50             | 2                    | 20           |\n| B       | $70             | 3                    | 30           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of units of each product demanded daily\nDemand_A = model.addVar(vtype=\"INTEGER\", name=\"Demand_A\", lb=0) # number of units of Product A demanded daily\nDemand_B = model.addVar(vtype=\"INTEGER\", name=\"Demand_B\", lb=0) # number of units of Product B demanded daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\nmodel.addCons(A <= Demand_A)\nmodel.addCons(B <= Demand_B)\n## The company must meet at least 90% of the daily demand for each product.\nmodel.addCons(A >= 0.9 * Demand_A)\nmodel.addCons(B >= 0.9 * Demand_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of units of Product A demanded daily\": \"Demand_A\", \"range\": \"Demand_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B demanded daily\": \"Demand_B\", \"range\": \"Demand_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\n// A <= Demand_A\n// B <= Demand_B\n\n## Generate Constraint-3:\nThe company must meet at least 90% of the daily demand for each product.\n// A >= 0.9 * Demand_A\n// B >= 0.9 * Demand_B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $50, and for Product B is $70. The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily. The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product. Additionally, the company must meet at least 90% of the daily demand for each product. Please help the company to maximize the total daily profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of units of each product demanded daily\nDemand_A = model.addVar(vtype=\"INTEGER\", name=\"Demand_A\", lb=0) # number of units of Product A demanded daily\nDemand_B = model.addVar(vtype=\"INTEGER\", name=\"Demand_B\", lb=0) # number of units of Product B demanded daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\nmodel.addCons(A <= Demand_A)\nmodel.addCons(B <= Demand_B)\n## The company must meet at least 90% of the daily demand for each product.\nmodel.addCons(A >= 0.9 * Demand_A)\nmodel.addCons(B >= 0.9 * Demand_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs of production and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"total cost of wheat bread\": \"wheat_cost\", \"range\": \"wheat_cost >= 0\", \"type\": \"real\"}\n// {\"total cost of rye bread\": \"rye_cost\", \"range\": \"rye_cost >= 0\", \"type\": \"real\"}\n// {\"total cost of sourdough bread\": \"sourdough_cost\", \"range\": \"sourdough_cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The bakery wants to minimize the total cost of bread production while meeting the daily demand.\n// Objective Function: Minimize: wheat_cost + rye_cost + sourdough_cost\n// where wheat_cost = 1.50 * wheat_loaves\n//       rye_cost = 2.00 * rye_loaves\n//       sourdough_cost = 2.50 * sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least twice as many wheat bread loaves as rye bread loaves.\n// wheat_loaves >= 2 * rye_loaves",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs of production and the demand for each type of bread. The cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The bakery wants to minimize the total cost of bread production while meeting the daily demand.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1.50         |\n| Rye           | $2.00         |\n| Sourdough     | $2.50         |\n\nThe bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery must produce at least twice as many wheat bread loaves as rye bread loaves.\n\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce to minimize the total cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The total cost of each type of bread\nwheat_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"wheat_cost\", lb=0) # total cost of wheat bread\nrye_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"rye_cost\", lb=0) # total cost of rye bread\nsourdough_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"sourdough_cost\", lb=0) # total cost of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_cost + rye_cost + sourdough_cost)\nmodel.addCons(wheat_cost == 1.50 * wheat_loaves)\nmodel.addCons(rye_cost == 2.00 * rye_loaves)\nmodel.addCons(sourdough_cost == 2.50 * sourdough_loaves)\n\n# Add constraints\n## The bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery must produce at least twice as many wheat bread loaves as rye bread loaves.\nmodel.addCons(wheat_loaves >= 2 * rye_loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs of production and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"total cost of wheat bread\": \"wheat_cost\", \"range\": \"wheat_cost >= 0\", \"type\": \"real\"}\n// {\"total cost of rye bread\": \"rye_cost\", \"range\": \"rye_cost >= 0\", \"type\": \"real\"}\n// {\"total cost of sourdough bread\": \"sourdough_cost\", \"range\": \"sourdough_cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The bakery wants to minimize the total cost of bread production while meeting the daily demand.\n// Objective Function: Minimize: wheat_cost + rye_cost + sourdough_cost\n// where wheat_cost = 1.50 * wheat_loaves\n//       rye_cost = 2.00 * rye_loaves\n//       sourdough_cost = 2.50 * sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least twice as many wheat bread loaves as rye bread loaves.\n// wheat_loaves >= 2 * rye_loaves",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce, considering the costs of production and the demand for each type of bread. The cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery must produce at least twice as many wheat bread loaves as rye bread loaves. Please help the bakery to minimize the total cost of bread production while meeting the daily demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The total cost of each type of bread\nwheat_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"wheat_cost\", lb=0) # total cost of wheat bread\nrye_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"rye_cost\", lb=0) # total cost of rye bread\nsourdough_cost = model.addVar(vtype=\"CONTINUOUS\", name=\"sourdough_cost\", lb=0) # total cost of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_cost + rye_cost + sourdough_cost)\nmodel.addCons(wheat_cost == 1.50 * wheat_loaves)\nmodel.addCons(rye_cost == 2.00 * rye_loaves)\nmodel.addCons(sourdough_cost == 2.50 * sourdough_loaves)\n\n# Add constraints\n## The bakery has a daily demand of 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery must produce at least twice as many wheat bread loaves as rye bread loaves.\nmodel.addCons(wheat_loaves >= 2 * rye_loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"QD\", \"range\": \"QD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost.\n// Cost = 5*QA + 8*QB + 10*QC + 12*QD\n// Revenue = 15*QA + 20*QB + 25*QC + 30*QD\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units.\n// 2*QA + 3*QB + 4*QC + 5*QD <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours.\n// QA + 2*QB + 3*QC + 4*QD <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and for product D is at most 100 units.\n// QA >= 50\n// QD <= 100",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product. The following table summarizes the cost, selling price, and resource requirements per unit for each product.\n\n| Product | Production Cost | Selling Price | Raw Material Required | Production Time Required |\n|---------|-----------------|---------------|-----------------------|--------------------------|\n| A       | $5              | $15           | 2 units               | 1 hour                   |\n| B       | $8              | $20           | 3 units               | 2 hours                  |\n| C       | $10             | $25           | 4 units               | 3 hours                  |\n| D       | $12             | $30           | 5 units               | 4 hours                  |\n\nThe manufacturer has a limited amount of raw material, with a total of 1000 units available. The production line also has a limited capacity, with a total of 500 hours available. The market demand for product A is at least 50 units, and for product D is at most 100 units. \n\nPlease help the manufacturer to maximize the profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of Product C\nQD = model.addVar(vtype=\"INTEGER\", name=\"QD\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 5*QA + 8*QB + 10*QC + 12*QD\n## Revenue = 15*QA + 20*QB + 25*QC + 30*QD\nmodel.addCons(obj == (15*QA + 20*QB + 25*QC + 30*QD) - (5*QA + 8*QB + 10*QC + 12*QD))\n\n# Add constraints\n## The manufacturer has a limited amount of raw material.\nmodel.addCons(2*QA + 3*QB + 4*QC + 5*QD <= 1000)\n## The production line has a limited capacity.\nmodel.addCons(QA + 2*QB + 3*QC + 4*QD <= 500)\n## The market demand for product A is at least 50 units, and for product D is at most 100 units.\nmodel.addCons(QA >= 50)\nmodel.addCons(QD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Quantity of Product C: \", model.getVal(QC))\n    print(\"Quantity of Product D: \", model.getVal(QD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"QD\", \"range\": \"QD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost.\n// Cost = 5*QA + 8*QB + 10*QC + 12*QD\n// Revenue = 15*QA + 20*QB + 25*QC + 30*QD\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units.\n// 2*QA + 3*QB + 4*QC + 5*QD <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours.\n// QA + 2*QB + 3*QC + 4*QD <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and for product D is at most 100 units.\n// QA >= 50\n// QD <= 100",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost. The manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units. The production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours. The market demand for product A is at least 50 units, and for product D is at most 100 units. Please help the manufacturer determine the optimal production quantities for products A, B, C, D to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of Product C\nQD = model.addVar(vtype=\"INTEGER\", name=\"QD\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 5*QA + 8*QB + 10*QC + 12*QD\n## Revenue = 15*QA + 20*QB + 25*QC + 30*QD\nmodel.addCons(obj == (15*QA + 20*QB + 25*QC + 30*QD) - (5*QA + 8*QB + 10*QC + 12*QD))\n\n# Add constraints\n## The manufacturer has a limited amount of raw material.\nmodel.addCons(2*QA + 3*QB + 4*QC + 5*QD <= 1000)\n## The production line has a limited capacity.\nmodel.addCons(QA + 2*QB + 3*QC + 4*QD <= 500)\n## The market demand for product A is at least 50 units, and for product D is at most 100 units.\nmodel.addCons(QA >= 50)\nmodel.addCons(QD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Quantity of Product C: \", model.getVal(QC))\n    print(\"Quantity of Product D: \", model.getVal(QD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n// Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Labor_Cost = 15 * 8 + 20 * overtime_hours\n// Objective Function: Minimize: Bread_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1.50         |\n| Rye           | $2.00         |\n| Sourdough     | $2.50         |\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\n\nPlease help the bakery to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nBread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Labor_Cost = 15 * 8 + 20 * overtime_hours\nLabor_Cost = 15 * 8 + 20 * overtime_hours\nmodel.addCons(obj == Bread_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n// Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Labor_Cost = 15 * 8 + 20 * overtime_hours\n// Objective Function: Minimize: Bread_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor. The bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime. Please help the bakery to minimize the total cost of production and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nBread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Labor_Cost = 15 * 8 + 20 * overtime_hours\nLabor_Cost = 15 * 8 + 20 * overtime_hours\nmodel.addCons(obj == Bread_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\n// A + 2*B + 3*C + 4*D <= 150\n\n## Generate Constraint-3:\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\n// 3*A + 2*B + C + 2*D <= 200",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The following table shows the resource requirements for each product:\n\n| Product | Resource 1 | Resource 2 | Resource 3 | Profit per Unit |\n|---------|------------|------------|------------|-----------------|\n| A       | 2 units    | 1 unit     | 3 units    | $10             |\n| B       | 3 units    | 2 units    | 2 units    | $15             |\n| C       | 4 units    | 3 units    | 1 unit     | $20             |\n| D       | 5 units    | 4 units    | 2 units    | $25             |\n\nResource 1 is available in the amount of 100 units. Resource 2 is available in the amount of 150 units. Resource 3 is available in the amount of 200 units. The manufacturer wants to maximize the total profit from the production of these products. Please help the manufacturer determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Resource 1 constraint\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Resource 2 constraint\nmodel.addCons(A + 2*B + 3*C + 4*D <= 150)\n## Resource 3 constraint\nmodel.addCons(3*A + 2*B + C + 2*D <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\n// A + 2*B + 3*C + 4*D <= 150\n\n## Generate Constraint-3:\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\n// 3*A + 2*B + C + 2*D <= 200",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\nPlease help the manufacturer to determine the optimal number of units to produce for each product to maximize total profit while adhering to the resource constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Resource 1 constraint\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Resource 2 constraint\nmodel.addCons(A + 2*B + 3*C + 4*D <= 150)\n## Resource 3 constraint\nmodel.addCons(3*A + 2*B + C + 2*D <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively. The selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit.\n// Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $150 for ingredients and labor.\n// 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a special order.\n// rye_loaves >= 20",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf. The cost and selling price for each type of bread are given in the following Table.\n\n| Type of Bread | Cost per Loaf | Selling Price per Loaf |\n|---------------|---------------|------------------------|\n| Wheat         | $1.50         | $3.00                  |\n| Rye           | $2.00         | $4.00                  |\n| Sourdough     | $2.50         | $5.00                  |\n\nThe bakery has a daily budget of $150 for ingredients and labor. The bakery has a limited oven space and can bake a maximum of 100 loaves per day. The bakery must produce at least 20 loaves of rye bread to meet a special order. \nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\nmodel.addCons(obj == (3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves) - (1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves))\n\n# Add constraints\n## The bakery has a daily budget of $150 for ingredients and labor.\nmodel.addCons(1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150)\n## The bakery has a limited oven space and can bake a maximum of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must produce at least 20 loaves of rye bread to meet a special order.\nmodel.addCons(rye_loaves >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively. The selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit.\n// Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $150 for ingredients and labor.\n// 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a special order.\n// rye_loaves >= 20",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf. The cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively, while the selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit. The bakery has a daily budget of $150 for ingredients and labor. It also has a limited oven space and can bake a maximum of 100 loaves per day. Additionally, the bakery must produce at least 20 loaves of rye bread to meet a special order. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\nmodel.addCons(obj == (3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves) - (1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves))\n\n# Add constraints\n## The bakery has a daily budget of $150 for ingredients and labor.\nmodel.addCons(1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150)\n## The bakery has a limited oven space and can bake a maximum of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must produce at least 20 loaves of rye bread to meet a special order.\nmodel.addCons(rye_loaves >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 15*C + 25*D\n\n## Generate Constraint-1:\nThe total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\n// 5*A + 3*B + 2*C + 4*D <= 200\n\n## Generate Constraint-2:\nThe total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\n// 2*A + 4*B + 3*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units.\n// A >= 10",
        "question": "A manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The following table shows the raw materials and labor hours required for each product.\n\n| Product | Raw Materials Required | Labor Hours Required |\n|---------|------------------------|----------------------|\n| A       | 5 units                | 2 hours              |\n| B       | 3 units                | 4 hours              |\n| C       | 2 units                | 3 hours              |\n| D       | 4 units                | 1 hour               |\n\nThe manufacturer has a total of 200 units of raw materials available and 100 labor hours available. The market demand for product A is at least 10 units. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 15*C + 25*D)\n\n# Add constraints\n## The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\nmodel.addCons(5*A + 3*B + 2*C + 4*D <= 200)\n## The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\nmodel.addCons(2*A + 4*B + 3*C + 1*D <= 100)\n## The market demand for product A is at least 10 units.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 15*C + 25*D\n\n## Generate Constraint-1:\nThe total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\n// 5*A + 3*B + 2*C + 4*D <= 200\n\n## Generate Constraint-2:\nThe total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\n// 2*A + 4*B + 3*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units.\n// A >= 10",
        "question": "A manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products. The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D, with a total of 200 units of raw materials available. The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D, with a total of 100 labor hours available. The market demand for product A is at least 10 units. Please help the manufacturer determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 15*C + 25*D)\n\n# Add constraints\n## The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\nmodel.addCons(5*A + 3*B + 2*C + 4*D <= 200)\n## The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\nmodel.addCons(2*A + 4*B + 3*C + 1*D <= 100)\n## The market demand for product A is at least 10 units.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $30, and for Product B is $40. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 30*A + 40*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available daily is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day.\n// A >= 20\n// B >= 15\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A >= 2*B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $30, and for Product B is $40. The following table summarizes the machine time required for each product:\n\n| Product | Profit per Unit | Machine Time per Unit |\n|---------|-----------------|-----------------------|\n| A       | $30             | 2 hours               |\n| B       | $40             | 3 hours               |\n\nThe company has a total of 120 hours of machine time available daily. The market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day. The company also has a policy to produce at least twice as many units of Product A as Product B. \n\nPlease help the company to maximize the total daily profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # number of hours of machine time used for Product A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # number of hours of machine time used for Product B\nmodel.addCons(MA == 2*A)\nmodel.addCons(MB == 3*B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available daily is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $30, and for Product B is $40. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 30*A + 40*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available daily is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day.\n// A >= 20\n// B >= 15\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A >= 2*B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $30, and for Product B is $40. Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available daily is 120 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day. The company has a policy to produce at least twice as many units of Product A as Product B. Please help the company to maximize the total daily profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # number of hours of machine time used for Product A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # number of hours of machine time used for Product B\nmodel.addCons(MA == 2*A)\nmodel.addCons(MB == 3*B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available daily is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 15 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet market demand while minimizing production costs. The production cost varies for each product, and there are constraints on the available raw materials and production capacity.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe raw material required for producing product A is 2 units per product, for product B is 3 units per product, and for product C is 4 units per product. The total available raw material is 2500 units per day.\n// 2*A + 3*B + 4*C <= 2500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 200 units per day, and for product B is at least 300 units per day. There is no minimum demand specified for product C.\n// A >= 200\n// B >= 300",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet market demand while minimizing production costs. The production cost for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The following table summarizes the production costs and raw material requirements per unit of each product.\n\n| Product | Production Cost per Unit | Raw Material Required per Unit |\n|---------|--------------------------|--------------------------------|\n| A       | $10                      | 2 units                         |\n| B       | $15                      | 3 units                         |\n| C       | $20                      | 4 units                         |\n\nThe total production capacity is limited to 1000 units per day. The total available raw material is 2500 units per day. The market demand for product A is at least 200 units per day, and for product B is at least 300 units per day. There is no minimum demand specified for product C.\n\nPlease help the manufacturer to determine the optimal production quantities for products A, B, and C to minimize the total production cost while meeting the constraints on production capacity and raw material availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The raw material required for producing product A is 2 units per product, for product B is 3 units per product, and for product C is 4 units per product. The total available raw material is 2500 units per day.\nmodel.addCons(2*A + 3*B + 4*C <= 2500)\n## The market demand for product A is at least 200 units per day, and for product B is at least 300 units per day.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet market demand while minimizing production costs. The production cost varies for each product, and there are constraints on the available raw materials and production capacity.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe raw material required for producing product A is 2 units per product, for product B is 3 units per product, and for product C is 4 units per product. The total available raw material is 2500 units per day.\n// 2*A + 3*B + 4*C <= 2500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 200 units per day, and for product B is at least 300 units per day. There is no minimum demand specified for product C.\n// A >= 200\n// B >= 300",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet market demand while minimizing production costs. The production cost for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The total production capacity is limited to 1000 units per day. The raw material required for producing product A is 2 units per product, for product B is 3 units per product, and for product C is 4 units per product, with a total available raw material of 2500 units per day. The market demand for product A is at least 200 units per day, and for product B is at least 300 units per day. There is no minimum demand specified for product C. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The raw material required for producing product A is 2 units per product, for product B is 3 units per product, and for product C is 4 units per product. The total available raw material is 2500 units per day.\nmodel.addCons(2*A + 3*B + 4*C <= 2500)\n## The market demand for product A is at least 200 units per day, and for product B is at least 300 units per day.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves raw material usage and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"availability of raw material\": \"RM\", \"range\": \"RM = 1000\", \"type\": \"integer\"}\n// {\"availability of labor hours\": \"LH\", \"range\": \"LH = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A, B, and C is $10, $15, and $20 respectively. The company aims to minimize the total production cost while meeting the demand.\n// Objective Function: Minimize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe raw material required for producing one unit of Product A, B, and C is 5, 10, and 15 units respectively. The total raw material usage must not exceed the available raw material.\n// 5*A + 10*B + 15*C <= 1000\n\n## Generate Constraint-2:\nThe labor hours required for producing one unit of Product A, B, and C is 2, 3, and 4 hours respectively. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 800\n\n## Generate Constraint-3:\nThe demand for Product A, B, and C is 50, 70, and 60 units respectively. The company must meet these demands.\n// A >= 50\n// B >= 70\n// C >= 60",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves raw material usage and labor hours. The cost of producing each unit of Product A, B, and C is $10, $15, and $20 respectively. The raw material and labor hours required for each product are given in the following Table.\n\n| Product | Raw Material Usage per Unit | Labor Hours per Unit |\n|---------|-----------------------------|----------------------|\n| A       | 5 units                     | 2 hours              |\n| B       | 10 units                    | 3 hours              |\n| C       | 15 units                    | 4 hours              |\n\nThe company has 1000 units of raw material and 800 labor hours available. The demand for Product A, B, and C is 50, 70, and 60 units respectively. The company must meet these demands. Please help the company to minimize the total production cost while meeting the demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The raw material required for producing one unit of Product A, B, and C is 5, 10, and 15 units respectively.\n## The total raw material usage must not exceed the available raw material.\nmodel.addCons(5*A + 10*B + 15*C <= 1000)\n## The labor hours required for producing one unit of Product A, B, and C is 2, 3, and 4 hours respectively.\n## The total labor hours used must not exceed the available labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 800)\n## The demand for Product A, B, and C is 50, 70, and 60 units respectively.\n## The company must meet these demands.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 70)\nmodel.addCons(C >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves raw material usage and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"availability of raw material\": \"RM\", \"range\": \"RM = 1000\", \"type\": \"integer\"}\n// {\"availability of labor hours\": \"LH\", \"range\": \"LH = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A, B, and C is $10, $15, and $20 respectively. The company aims to minimize the total production cost while meeting the demand.\n// Objective Function: Minimize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe raw material required for producing one unit of Product A, B, and C is 5, 10, and 15 units respectively. The total raw material usage must not exceed the available raw material.\n// 5*A + 10*B + 15*C <= 1000\n\n## Generate Constraint-2:\nThe labor hours required for producing one unit of Product A, B, and C is 2, 3, and 4 hours respectively. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 800\n\n## Generate Constraint-3:\nThe demand for Product A, B, and C is 50, 70, and 60 units respectively. The company must meet these demands.\n// A >= 50\n// B >= 70\n// C >= 60",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing costs. The production process involves raw material usage and labor hours. The cost of producing each unit of Product A, B, and C is $10, $15, and $20 respectively. The raw material required for producing one unit of Product A, B, and C is 5, 10, and 15 units respectively, and the total raw material usage must not exceed 1000 units. The labor hours required for producing one unit of Product A, B, and C is 2, 3, and 4 hours respectively, and the total labor hours used must not exceed 800 hours. The demand for Product A, B, and C is 50, 70, and 60 units respectively. The company must meet these demands. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The raw material required for producing one unit of Product A, B, and C is 5, 10, and 15 units respectively.\n## The total raw material usage must not exceed the available raw material.\nmodel.addCons(5*A + 10*B + 15*C <= 1000)\n## The labor hours required for producing one unit of Product A, B, and C is 2, 3, and 4 hours respectively.\n## The total labor hours used must not exceed the available labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 800)\n## The demand for Product A, B, and C is 50, 70, and 60 units respectively.\n## The company must meet these demands.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 70)\nmodel.addCons(C >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 10*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours.\n// 5*A + 3*B + 2*C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10.\n// 20*A + 15*B + 10*C <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the company must meet this demand.\n// A >= 50",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently. The profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products. The following table shows the labor hours required and the cost of raw materials for each product.\n\n| Product | Profit per Unit | Labor Hours per Unit | Cost of Raw Materials per Unit |\n|---------|-----------------|----------------------|--------------------------------|\n| A       | $30             | 5 hours              | $20                            |\n| B       | $20             | 3 hours              | $15                            |\n| C       | $10             | 2 hours              | $10                            |\n\nThe company has a total of 1000 labor hours available and a budget constraint of $2000 for raw materials. The market demand for product A is at least 50 units, and the company must meet this demand. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 10*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*A + 3*B + 2*C <= 1000)\n## The company has a budget constraint of $2000 for raw materials.\nmodel.addCons(20*A + 15*B + 10*C <= 2000)\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 10*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours.\n// 5*A + 3*B + 2*C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10.\n// 20*A + 15*B + 10*C <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the company must meet this demand.\n// A >= 50",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently. The profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products. The company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours. The company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10. The market demand for product A is at least 50 units, and the company must meet this demand. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 10*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*A + 3*B + 2*C <= 1000)\n## The company has a budget constraint of $2000 for raw materials.\nmodel.addCons(20*A + 15*B + 10*C <= 2000)\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $30, and for Product B is $40. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 30*A + 40*B\n\n## Generate Constraint-1:\nThe total machine time available per day is 8 hours. Each unit of Product A requires 0.5 hours of machine time, and each unit of Product B requires 0.4 hours of machine time.\n// MA = 0.5*A\n// MB = 0.4*B\n// MA + MB <= 8\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\n// A >= 10\n// B >= 12\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A >= 2*B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $30, and for Product B is $40. The following table summarizes the machine time required for each product:\n\n| Product | Profit per Unit | Machine Time per Unit |\n|---------|-----------------|-----------------------|\n| A       | $30             | 0.5 hours             |\n| B       | $40             | 0.4 hours             |\n\nThe total machine time available per day is 8 hours. The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day. The company has a policy to produce at least twice as many units of Product A as Product B. \n\nPlease help the company to maximize the total daily profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # number of hours of machine time used for Product A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # number of hours of machine time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B)\n\n# Add constraints\n## The total machine time available per day is 8 hours.\nmodel.addCons(MA == 0.5*A)\nmodel.addCons(MB == 0.4*B)\nmodel.addCons(MA + MB <= 8)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 12)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $30, and for Product B is $40. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 30*A + 40*B\n\n## Generate Constraint-1:\nThe total machine time available per day is 8 hours. Each unit of Product A requires 0.5 hours of machine time, and each unit of Product B requires 0.4 hours of machine time.\n// MA = 0.5*A\n// MB = 0.4*B\n// MA + MB <= 8\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\n// A >= 10\n// B >= 12\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A >= 2*B",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $30, and for Product B is $40. The total machine time available per day is 8 hours. Each unit of Product A requires 0.5 hours of machine time, and each unit of Product B requires 0.4 hours of machine time. The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day. The company has a policy to produce at least twice as many units of Product A as Product B. Please help the company to maximize the total daily profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # number of hours of machine time used for Product A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # number of hours of machine time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B)\n\n# Add constraints\n## The total machine time available per day is 8 hours.\nmodel.addCons(MA == 0.5*A)\nmodel.addCons(MB == 0.4*B)\nmodel.addCons(MA + MB <= 8)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 12)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum weekly production capacity for each product are different. The manufacturer needs to decide how many units of each product to produce weekly to maximize profit.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for product A, B, and C is $10, $15, and $20, respectively. The selling price per unit for product A, B, and C is $30, $40, and $50, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (30*A - 10*A) + (40*B - 15*B) + (50*C - 20*C)\n\n## Generate Constraint-1:\nThe maximum weekly production capacity for product A, B, and C is 500, 400, and 300 units, respectively.\n// A <= 500\n// B <= 400\n// C <= 300\n\n## Generate Constraint-2:\nThe manufacturer has a limited budget for production costs. The total production cost per week should not exceed $10,000.\n// 10*A + 15*B + 20*C <= 10000\n\n## Generate Constraint-3:\nTo ensure product diversity, the manufacturer must produce at least one unit of each product.\n// A >= 1\n// B >= 1\n// C >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum weekly production capacity for each product are different. The manufacturer needs to decide how many units of each product to produce weekly to maximize profit. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Maximum Weekly Production Capacity |\n|---------|--------------------------|------------------------|------------------------------------|\n| A       | $10                      | $30                    | 500 units                          |\n| B       | $15                      | $40                    | 400 units                          |\n| C       | $20                      | $50                    | 300 units                          |\n\nThe manufacturer has a limited budget for production costs. The total production cost per week should not exceed $10,000. To ensure product diversity, the manufacturer must produce at least one unit of each product. The maximum weekly production capacity for each product must also be respected. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (30*A - 10*A) + (40*B - 15*B) + (50*C - 20*C))\n\n# Add constraints\n## The maximum weekly production capacity for each product\nmodel.addCons(A <= 500)\nmodel.addCons(B <= 400)\nmodel.addCons(C <= 300)\n## The total production cost per week should not exceed $10,000.\nmodel.addCons(10*A + 15*B + 20*C <= 10000)\n## The manufacturer must produce at least one unit of each product.\nmodel.addCons(A >= 1)\nmodel.addCons(B >= 1)\nmodel.addCons(C >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum weekly production capacity for each product are different. The manufacturer needs to decide how many units of each product to produce weekly to maximize profit.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for product A, B, and C is $10, $15, and $20, respectively. The selling price per unit for product A, B, and C is $30, $40, and $50, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (30*A - 10*A) + (40*B - 15*B) + (50*C - 20*C)\n\n## Generate Constraint-1:\nThe maximum weekly production capacity for product A, B, and C is 500, 400, and 300 units, respectively.\n// A <= 500\n// B <= 400\n// C <= 300\n\n## Generate Constraint-2:\nThe manufacturer has a limited budget for production costs. The total production cost per week should not exceed $10,000.\n// 10*A + 15*B + 20*C <= 10000\n\n## Generate Constraint-3:\nTo ensure product diversity, the manufacturer must produce at least one unit of each product.\n// A >= 1\n// B >= 1\n// C >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost per unit for product A, B, and C is $10, $15, and $20, respectively. The selling price per unit for product A, B, and C is $30, $40, and $50, respectively. The manufacturer wants to maximize the total profit. The maximum weekly production capacity for product A, B, and C is 500, 400, and 300 units, respectively. The manufacturer has a limited budget for production costs, and the total production cost per week should not exceed $10,000. To ensure product diversity, the manufacturer must produce at least one unit of each product. Please help the manufacturer decide how many units of each product to produce weekly to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (30*A - 10*A) + (40*B - 15*B) + (50*C - 20*C))\n\n# Add constraints\n## The maximum weekly production capacity for each product\nmodel.addCons(A <= 500)\nmodel.addCons(B <= 400)\nmodel.addCons(C <= 300)\n## The total production cost per week should not exceed $10,000.\nmodel.addCons(10*A + 15*B + 20*C <= 10000)\n## The manufacturer must produce at least one unit of each product.\nmodel.addCons(A >= 1)\nmodel.addCons(B >= 1)\nmodel.addCons(C >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints. The details for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price | Maximum Daily Production Capacity |\n|---------|-----------------|---------------|-----------------------------------|\n| A       | $50             | $100          | 100 units                         |\n| B       | $70             | $120          | 150 units                         |\n| C       | $60             | $110          | 200 units                         |\n\nThe manufacturer aims to maximize the daily profit. The maximum daily production capacity for each product is as specified in the table. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A per day.\n\nPlease help the manufacturer determine the optimal daily production quantities of each product to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A per day.\nPlease help the manufacturer determine the daily production quantities of each product to maximize profit while considering these production constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of each product is given in the following Table.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $5                       |\n| B       | $10                      |\n| C       | $8                       |\n\nThe company has a production capacity of 100 units per day. The demand for product A is at least 20 units per day, and the demand for product B is at least 15 units per day. Please help the company to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 716,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost. The production capacity of the company is limited to 100 units per day. The demand for product A is at least 20 units per day, and the demand for product B is at least 15 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 636,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs.\n// {\"number of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Prod_C\", \"range\": \"Prod_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*Prod_A + 15*Prod_B + 20*Prod_C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 1000 units per day.\n// Prod_A + Prod_B + Prod_C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 300 units per day.\n// Prod_A >= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 200 units per day.\n// Prod_B >= 200",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs. The cost of producing one unit of each product is given in the following Table.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $10                      |\n| B       | $15                      |\n| C       | $20                      |\n\nThe production capacity of the company is limited to 1000 units per day. The market demand for Product A is at least 300 units per day, and for Product B is at least 200 units per day. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # number of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # number of Product B produced\nProd_C = model.addVar(vtype=\"INTEGER\", name=\"Prod_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Prod_A + 15*Prod_B + 20*Prod_C)\n\n# Add constraints\n## The production capacity of the company is limited to 1000 units per day.\nmodel.addCons(Prod_A + Prod_B + Prod_C <= 1000)\n## The market demand for Product A is at least 300 units per day.\nmodel.addCons(Prod_A >= 300)\n## The market demand for Product B is at least 200 units per day.\nmodel.addCons(Prod_B >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Prod_A))\n    print(\"Number of Product B produced: \", model.getVal(Prod_B))\n    print(\"Number of Product C produced: \", model.getVal(Prod_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs.\n// {\"number of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Prod_C\", \"range\": \"Prod_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*Prod_A + 15*Prod_B + 20*Prod_C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 1000 units per day.\n// Prod_A + Prod_B + Prod_C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 300 units per day.\n// Prod_A >= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 200 units per day.\n// Prod_B >= 200",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs. The cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost. The production capacity of the company is limited to 1000 units per day. The market demand for Product A is at least 300 units per day. The market demand for Product B is at least 200 units per day. Please help the company determine the optimal number of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # number of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # number of Product B produced\nProd_C = model.addVar(vtype=\"INTEGER\", name=\"Prod_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Prod_A + 15*Prod_B + 20*Prod_C)\n\n# Add constraints\n## The production capacity of the company is limited to 1000 units per day.\nmodel.addCons(Prod_A + Prod_B + Prod_C <= 1000)\n## The market demand for Product A is at least 300 units per day.\nmodel.addCons(Prod_A >= 300)\n## The market demand for Product B is at least 200 units per day.\nmodel.addCons(Prod_B >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Prod_A))\n    print(\"Number of Product B produced: \", model.getVal(Prod_B))\n    print(\"Number of Product C produced: \", model.getVal(Prod_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 662,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 60)*B + (150 - 70)*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at most 200 units per week.\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand. The production cost and selling price for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price |\n|---------|-----------------|---------------|\n| A       | $50             | $100          |\n| B       | $60             | $120          |\n| C       | $70             | $150          |\n\nThe total production capacity is limited to 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at most 200 units per week. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 60)*B + (150 - 70)*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per week.\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 60)*B + (150 - 70)*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at most 200 units per week.\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand. The total production capacity is limited to 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at most 200 units per week. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 60)*B + (150 - 70)*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per week.\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand. The profit per unit for product A, B, and C is $50, $70, and $60, respectively. The total production capacity of the factory is 1000 units per week. The demand for product A is at least 200 units per week, and the demand for product B is at most 300 units per week.\n\nPlease help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 656,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\nThe total production capacity of the factory is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week.\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products.\n// Profit_A = (25 - 10) * A\n// Profit_B = (30 - 15) * B\n// Profit_C = (40 - 20) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\n// A <= 300\n// B <= 250\n// C <= 400\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 50 units of product A to meet contractual obligations.\n// A >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price | Maximum Daily Demand |\n|---------|-----------------|---------------|----------------------|\n| A       | $10             | $25           | 300 units            |\n| B       | $15             | $30           | 250 units            |\n| C       | $20             | $40           | 400 units            |\n\nThe total production capacity of the manufacturer is 1000 units per day. The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively. The manufacturer must produce at least 50 units of product A to meet contractual obligations.\nPlease help the manufacturer to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\nmodel.addCons(A <= 300)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 400)\n## The manufacturer must produce at least 50 units of product A to meet contractual obligations.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products.\n// Profit_A = (25 - 10) * A\n// Profit_B = (30 - 15) * B\n// Profit_C = (40 - 20) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\n// A <= 300\n// B <= 250\n// C <= 400\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 50 units of product A to meet contractual obligations.\n// A >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products. The total production capacity of the manufacturer is 1000 units per day. The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively. The manufacturer must produce at least 50 units of product A to meet contractual obligations. Please help the manufacturer determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\nmodel.addCons(A <= 300)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 400)\n## The manufacturer must produce at least 50 units of product A to meet contractual obligations.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: Product A, Product B, and Product C. The production costs, selling prices, and available production time are known. The manufacturer needs to decide how many units of each product to produce to maximize profit.\n// {\"number of units of Product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $50 per unit, and it sells for $100. For Product B, the cost is $70 per unit, and it sells for $120. For Product C, the cost is $60 per unit, and it sells for $110. The manufacturer wants to maximize the total profit from selling these products.\n// Profit_A = 100*A - 50*A\n// Profit_B = 120*B - 70*B\n// Profit_C = 110*C - 60*C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production time available is 100 hours. Producing one unit of Product A takes 2 hours, Product B takes 3 hours, and Product C takes 2.5 hours.\n// 2*A + 3*B + 2.5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product B is at least 8 units.\n// A >= 10\n// B >= 8\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of Product C as Product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: Product A, Product B, and Product C. The production costs, selling prices, and available production time are known. The manufacturer needs to decide how many units of each product to produce to maximize profit. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Production Time per Unit |\n|---------|--------------------------|-------------------------|--------------------------|\n| A       | $50                      | $100                    | 2 hours                  |\n| B       | $70                      | $120                    | 3 hours                  |\n| C       | $60                      | $110                    | 2.5 hours                |\n\nThe total production time available is 100 hours. The market demand for Product A is at least 10 units, and for Product B is at least 8 units. The manufacturer has a policy to produce at least twice as many units of Product C as Product A. Please help the manufacturer to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100*A - 50*A) + (120*B - 70*B) + (110*C - 60*C))\n\n# Add constraints\n## The total production time available is 100 hours.\nmodel.addCons(2*A + 3*B + 2.5*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product B is at least 8 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 8)\n## The manufacturer has a policy to produce at least twice as many units of Product C as Product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A to produce: \", model.getVal(A))\n    print(\"Number of units of Product B to produce: \", model.getVal(B))\n    print(\"Number of units of Product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: Product A, Product B, and Product C. The production costs, selling prices, and available production time are known. The manufacturer needs to decide how many units of each product to produce to maximize profit.\n// {\"number of units of Product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $50 per unit, and it sells for $100. For Product B, the cost is $70 per unit, and it sells for $120. For Product C, the cost is $60 per unit, and it sells for $110. The manufacturer wants to maximize the total profit from selling these products.\n// Profit_A = 100*A - 50*A\n// Profit_B = 120*B - 70*B\n// Profit_C = 110*C - 60*C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production time available is 100 hours. Producing one unit of Product A takes 2 hours, Product B takes 3 hours, and Product C takes 2.5 hours.\n// 2*A + 3*B + 2.5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product B is at least 8 units.\n// A >= 10\n// B >= 8\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of Product C as Product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: Product A, Product B, and Product C. The production costs, selling prices, and available production time are known. The manufacturer needs to decide how many units of each product to produce to maximize profit.\nThe production cost for Product A is $50 per unit, and it sells for $100. For Product B, the cost is $70 per unit, and it sells for $120. For Product C, the cost is $60 per unit, and it sells for $110. The manufacturer wants to maximize the total profit from selling these products.\nThe total production time available is 100 hours. Producing one unit of Product A takes 2 hours, Product B takes 3 hours, and Product C takes 2.5 hours. The market demand for Product A is at least 10 units, and for Product B is at least 8 units. The manufacturer has a policy to produce at least twice as many units of Product C as Product A.\nPlease help the manufacturer determine the optimal number of units of each product to produce to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100*A - 50*A) + (120*B - 70*B) + (110*C - 60*C))\n\n# Add constraints\n## The total production time available is 100 hours.\nmodel.addCons(2*A + 3*B + 2.5*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product B is at least 8 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 8)\n## The manufacturer has a policy to produce at least twice as many units of Product C as Product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A to produce: \", model.getVal(A))\n    print(\"Number of units of Product B to produce: \", model.getVal(B))\n    print(\"Number of units of Product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (10-5)*A + (15-7)*B + (20-10)*C\n\n## Generate Constraint-1:\nThe total production capacity is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints. The production cost and selling price for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price |\n|---------|-----------------|---------------|\n| A       | $5              | $10           |\n| B       | $7              | $15           |\n| C       | $10             | $20           |\n\nThe total production capacity is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10-5)*A + (15-7)*B + (20-10)*C)\n\n# Add constraints\n## The total production capacity is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (10-5)*A + (15-7)*B + (20-10)*C\n\n## Generate Constraint-1:\nThe total production capacity is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit. The total production capacity is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week. Please help the manufacturer determine the quantity of each product to maximize profit while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10-5)*A + (15-7)*B + (20-10)*C)\n\n# Add constraints\n## The total production capacity is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 535,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\n// {\"quantity of product A\": \"A\", \"range\": \"0 <= A <= 1000\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"0 <= B <= 1500\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"0 <= C <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (50 - 30)*A + (70 - 40)*B + (60 - 35)*C\n// Objective Function: Maximize: 20*A + 30*B + 25*C\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 3000 units per day.\n// A + B + C <= 3000\n\n## Generate Constraint-2:\nThe maximum demand for product A is 1000 units per day.\n// A <= 1000\n\n## Generate Constraint-3:\nThe maximum demand for product B is 1500 units per day.\n// B <= 1500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity. The selling price and production cost for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost | Maximum Demand |\n|---------|---------------|-----------------|----------------|\n| A       | $50           | $30             | 1000 units     |\n| B       | $70           | $40             | 1500 units     |\n| C       | $60           | $35             | 2000 units     |\n\nThe production capacity of the factory is limited to 3000 units per day. The maximum demand for product A is 1000 units per day, and for product B is 1500 units per day. \nPlease help the manufacturer to maximize the total profit, which is calculated as the difference between the selling price and the production cost for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=2000) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The production capacity of the factory is limited to 3000 units per day.\nmodel.addCons(A + B + C <= 3000)\n## The maximum demand for product A is 1000 units per day.\nmodel.addCons(A <= 1000)\n## The maximum demand for product B is 1500 units per day.\nmodel.addCons(B <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\n// {\"quantity of product A\": \"A\", \"range\": \"0 <= A <= 1000\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"0 <= B <= 1500\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"0 <= C <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (50 - 30)*A + (70 - 40)*B + (60 - 35)*C\n// Objective Function: Maximize: 20*A + 30*B + 25*C\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 3000 units per day.\n// A + B + C <= 3000\n\n## Generate Constraint-2:\nThe maximum demand for product A is 1000 units per day.\n// A <= 1000\n\n## Generate Constraint-3:\nThe maximum demand for product B is 1500 units per day.\n// B <= 1500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit. The production capacity of the factory is limited to 3000 units per day. The maximum demand for product A is 1000 units per day, and for product B is 1500 units per day. \nPlease help the manufacturer determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=2000) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The production capacity of the factory is limited to 3000 units per day.\nmodel.addCons(A + B + C <= 3000)\n## The maximum demand for product A is 1000 units per day.\nmodel.addCons(A <= 1000)\n## The maximum demand for product B is 1500 units per day.\nmodel.addCons(B <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock.\n// {\"area of land for wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 180*Corn + 220*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\n// Soy >= 0.30 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-3:\nThe farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\n// Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley)",
        "question": "A farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock. The profit per acre for each crop is as follows:\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $180            |\n| Soybeans | $220            |\n| Barley   | $150            |\n\nThe total available land for planting is 100 acres. The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock. Additionally, the farmer must ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\n\nPlease help the farmer to maximize the total profit from these crops while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The area of land for each crop\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for corn\nSoy = model.addVar(vtype=\"CONTINUOUS\", name=\"Soy\", lb=0) # area of land for soybeans\nBarley = model.addVar(vtype=\"CONTINUOUS\", name=\"Barley\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 180*Corn + 220*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\nmodel.addCons(Soy >= 0.30 * (Wheat + Corn + Soy + Barley))\n## The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\nmodel.addCons(Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for wheat: \", model.getVal(Wheat))\n    print(\"Area of land for corn: \", model.getVal(Corn))\n    print(\"Area of land for soybeans: \", model.getVal(Soy))\n    print(\"Area of land for barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock.\n// {\"area of land for wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 180*Corn + 220*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\n// Soy >= 0.30 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-3:\nThe farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\n// Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley)",
        "question": "A farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops. The total available land for planting is 100 acres. The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock. Additionally, the farmer must ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health. Please help the farmer determine the optimal allocation of land for each crop to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The area of land for each crop\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for corn\nSoy = model.addVar(vtype=\"CONTINUOUS\", name=\"Soy\", lb=0) # area of land for soybeans\nBarley = model.addVar(vtype=\"CONTINUOUS\", name=\"Barley\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 180*Corn + 220*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\nmodel.addCons(Soy >= 0.30 * (Wheat + Corn + Soy + Barley))\n## The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\nmodel.addCons(Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for wheat: \", model.getVal(Wheat))\n    print(\"Area of land for corn: \", model.getVal(Corn))\n    print(\"Area of land for soybeans: \", model.getVal(Soy))\n    print(\"Area of land for barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $80             |\n| Laptops      | $150            |\n| Smartwatches | $50             |\n\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units. The company has a contract to produce at least 50 laptops per day.\n\nPlease help the company to maximize its total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units. The company has a contract to produce at least 50 laptops per day. Please help the company to maximize its total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 723,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units per day.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $80             |\n| Laptops      | $150            |\n| Smartwatches | $50             |\n\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units per day. The company has a contract to produce at least 50 laptops per day.\n\nPlease help the company to maximize its total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units per day.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units per day.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units per day. The company has a contract to produce at least 50 laptops per day. Please help the company to maximize its total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units per day.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets is $150, laptops is $200, and smartwatches is $50. The company aims to maximize its total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap + 50*Watch\n\n## Generate Constraint-1:\nThe production facility has a limited capacity. It can produce a maximum of 500 smartphones, 300 tablets, 200 laptops, and 1000 smartwatches per month.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n// Watch <= 1000\n\n## Generate Constraint-2:\nThe market demand for each device type must be met. The minimum required production for smartphones is 100 units, tablets is 50 units, laptops is 150 units, and smartwatches is 200 units per month.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 150\n// Watch >= 200\n\n## Generate Constraint-3:\nThe company has a budget constraint for production. The total cost of producing all devices must not exceed $50,000 per month. The cost per unit for smartphones is $50, tablets is $75, laptops is $100, and smartwatches is $25.\n// 50*Smart + 75*Tab + 100*Lap + 25*Watch <= 50000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit and cost per unit for each device are given in the following Table.\n\n| Device       | Profit per Unit | Cost per Unit |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $50           |\n| Tablets      | $150            | $75           |\n| Laptops      | $200            | $100          |\n| Smartwatches | $50             | $25           |\n\nThe production facility has a limited capacity. It can produce a maximum of 500 smartphones, 300 tablets, 200 laptops, and 1000 smartwatches per month. The market demand for each device type must be met. The minimum required production for smartphones is 100 units, tablets is 50 units, laptops is 150 units, and smartwatches is 200 units per month. The company has a budget constraint for production. The total cost of producing all devices must not exceed $50,000 per month.\n\nPlease help the company to maximize its total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap + 50*Watch)\n\n# Add constraints\n## The production facility has a limited capacity.\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\nmodel.addCons(Watch <= 1000)\n## The market demand for each device type must be met.\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 150)\nmodel.addCons(Watch >= 200)\n## The company has a budget constraint for production.\nmodel.addCons(50*Smart + 75*Tab + 100*Lap + 25*Watch <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Number of smartwatches: \", model.getVal(Watch))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets is $150, laptops is $200, and smartwatches is $50. The company aims to maximize its total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap + 50*Watch\n\n## Generate Constraint-1:\nThe production facility has a limited capacity. It can produce a maximum of 500 smartphones, 300 tablets, 200 laptops, and 1000 smartwatches per month.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n// Watch <= 1000\n\n## Generate Constraint-2:\nThe market demand for each device type must be met. The minimum required production for smartphones is 100 units, tablets is 50 units, laptops is 150 units, and smartwatches is 200 units per month.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 150\n// Watch >= 200\n\n## Generate Constraint-3:\nThe company has a budget constraint for production. The total cost of producing all devices must not exceed $50,000 per month. The cost per unit for smartphones is $50, tablets is $75, laptops is $100, and smartwatches is $25.\n// 50*Smart + 75*Tab + 100*Lap + 25*Watch <= 50000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\nThe profit per unit for smartphones is $100, tablets is $150, laptops is $200, and smartwatches is $50. The production facility has a limited capacity. It can produce a maximum of 500 smartphones, 300 tablets, 200 laptops, and 1000 smartwatches per month. The market demand for each device type must be met. The minimum required production for smartphones is 100 units, tablets is 50 units, laptops is 150 units, and smartwatches is 200 units per month. The company has a budget constraint for production. The total cost of producing all devices must not exceed $50,000 per month. The cost per unit for smartphones is $50, tablets is $75, laptops is $100, and smartwatches is $25.\nPlease help the company to maximize its total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap + 50*Watch)\n\n# Add constraints\n## The production facility has a limited capacity.\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\nmodel.addCons(Watch <= 1000)\n## The market demand for each device type must be met.\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 150)\nmodel.addCons(Watch >= 200)\n## The company has a budget constraint for production.\nmodel.addCons(50*Smart + 75*Tab + 100*Lap + 25*Watch <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Number of smartwatches: \", model.getVal(Watch))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and doughnuts. The bakery needs to decide the daily production quantities of each pastry to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per doughnut is $0.30. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*C + 0.40*M + 0.60*E + 0.30*D\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and sugar. Each croissant requires 50 grams of flour and 20 grams of sugar. Each muffin requires 40 grams of flour and 15 grams of sugar. Each eclair requires 30 grams of flour and 25 grams of sugar. Each doughnut requires 20 grams of flour and 30 grams of sugar. The total available flour is 100 kg and sugar is 80 kg.\n// 50*C + 40*M + 30*E + 20*D <= 100000 (flour constraint)\n// 20*C + 15*M + 25*E + 30*D <= 80000 (sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a limited storage capacity. Each croissant takes up 100 cubic cm, each muffin takes up 80 cubic cm, each eclair takes up 120 cubic cm, and each doughnut takes up 90 cubic cm. The total storage capacity is 120,000 cubic cm.\n// 100*C + 80*M + 120*E + 90*D <= 120000 (storage constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each pastry type to meet the minimum order requirements from local cafes.\n// C >= 100, M >= 100, E >= 100, D >= 100",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and doughnuts. The bakery needs to decide the daily production quantities of each pastry to maximize profit while considering the availability of ingredients and storage capacity. The profit per pastry is as follows: $0.50 per croissant, $0.40 per muffin, $0.60 per eclair, and $0.30 per doughnut. The bakery aims to maximize its daily profit from the sales of these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Sugar Required (grams) | Storage Space (cubic cm) |\n|----------|-----------------|------------------------|------------------------|--------------------------|\n| Croissant| $0.50           | 50                     | 20                     | 100                      |\n| Muffin   | $0.40           | 40                     | 15                     | 80                       |\n| Eclair   | $0.60           | 30                     | 25                     | 120                      |\n| Doughnut | $0.30           | 20                     | 30                     | 90                       |\n\nThe bakery has a limited amount of flour (100 kg) and sugar (80 kg). The total storage capacity is 120,000 cubic cm. The bakery must produce at least 100 units of each pastry type to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to determine the optimal daily production quantities of each pastry to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of doughnuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.40*M + 0.60*E + 0.30*D)\n\n# Add constraints\n## The bakery has a limited amount of flour and sugar.\nmodel.addCons(50*C + 40*M + 30*E + 20*D <= 100000) # flour constraint\nmodel.addCons(20*C + 15*M + 25*E + 30*D <= 80000) # sugar constraint\n## The bakery has a limited storage capacity.\nmodel.addCons(100*C + 80*M + 120*E + 90*D <= 120000) # storage constraint\n## The bakery must produce at least 100 units of each pastry type.\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 100)\nmodel.addCons(E >= 100)\nmodel.addCons(D >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Number of doughnuts: \", model.getVal(D))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1483,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and doughnuts. The bakery needs to decide the daily production quantities of each pastry to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per doughnut is $0.30. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*C + 0.40*M + 0.60*E + 0.30*D\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and sugar. Each croissant requires 50 grams of flour and 20 grams of sugar. Each muffin requires 40 grams of flour and 15 grams of sugar. Each eclair requires 30 grams of flour and 25 grams of sugar. Each doughnut requires 20 grams of flour and 30 grams of sugar. The total available flour is 100 kg and sugar is 80 kg.\n// 50*C + 40*M + 30*E + 20*D <= 100000 (flour constraint)\n// 20*C + 15*M + 25*E + 30*D <= 80000 (sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a limited storage capacity. Each croissant takes up 100 cubic cm, each muffin takes up 80 cubic cm, each eclair takes up 120 cubic cm, and each doughnut takes up 90 cubic cm. The total storage capacity is 120,000 cubic cm.\n// 100*C + 80*M + 120*E + 90*D <= 120000 (storage constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each pastry type to meet the minimum order requirements from local cafes.\n// C >= 100, M >= 100, E >= 100, D >= 100",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and doughnuts. The bakery needs to decide the daily production quantities of each pastry to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per doughnut is $0.30. The bakery has a limited amount of flour and sugar. Each croissant requires 50 grams of flour and 20 grams of sugar. Each muffin requires 40 grams of flour and 15 grams of sugar. Each eclair requires 30 grams of flour and 25 grams of sugar. Each doughnut requires 20 grams of flour and 30 grams of sugar. The total available flour is 100 kg and sugar is 80 kg. The bakery also has a limited storage capacity. Each croissant takes up 100 cubic cm, each muffin takes up 80 cubic cm, each eclair takes up 120 cubic cm, and each doughnut takes up 90 cubic cm. The total storage capacity is 120,000 cubic cm. The bakery must produce at least 100 units of each pastry type to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of doughnuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.40*M + 0.60*E + 0.30*D)\n\n# Add constraints\n## The bakery has a limited amount of flour and sugar.\nmodel.addCons(50*C + 40*M + 30*E + 20*D <= 100000) # flour constraint\nmodel.addCons(20*C + 15*M + 25*E + 30*D <= 80000) # sugar constraint\n## The bakery has a limited storage capacity.\nmodel.addCons(100*C + 80*M + 120*E + 90*D <= 120000) # storage constraint\n## The bakery must produce at least 100 units of each pastry type.\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 100)\nmodel.addCons(E >= 100)\nmodel.addCons(D >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Number of doughnuts: \", model.getVal(D))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week. The market demand for tablets is at least 150 units per week.\n\nPlease help the company to determine the optimal number of smartphones, tablets, and laptops to produce to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week, and the market demand for tablets is at least 150 units per week. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 642,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches\": \"Watches\", \"range\": \"Watches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 80*Tablets + 150*Laptops + 50*Watches\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited. The maximum number of smartphones that can be produced daily is 500, tablets is 300, laptops is 200, and smartwatches is 400.\n// Smart <= 500\n// Tablets <= 300\n// Laptops <= 200\n// Watches <= 400\n\n## Generate Constraint-2:\nThe market demand for each device type must be met. The minimum required production of smartphones is 200, tablets is 100, laptops is 150, and smartwatches is 250.\n// Smart >= 200\n// Tablets >= 100\n// Laptops >= 150\n// Watches >= 250\n\n## Generate Constraint-3:\nThe total production cost for all devices must not exceed $100,000. The cost per unit for smartphones is $50, for tablets is $40, for laptops is $70, and for smartwatches is $30.\n// 50*Smart + 40*Tablets + 70*Laptops + 30*Watches <= 100000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit and the cost per unit for each device are given in the following Table.\n\n| Device       | Profit per Unit | Cost per Unit |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $50           |\n| Tablets      | $80             | $40           |\n| Laptops      | $150            | $70           |\n| Smartwatches | $50             | $30           |\n\nThe production capacity of the factory is limited. The maximum number of smartphones that can be produced daily is 500, tablets is 300, laptops is 200, and smartwatches is 400. The market demand for each device type must be met. The minimum required production of smartphones is 200, tablets is 100, laptops is 150, and smartwatches is 250. The total production cost for all devices must not exceed $100,000.\n\nPlease help the company to maximize the total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\nWatches = model.addVar(vtype=\"INTEGER\", name=\"Watches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 80*Tablets + 150*Laptops + 50*Watches)\n\n# Add constraints\n## The production capacity of the factory is limited.\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Watches <= 400)\n## The market demand for each device type must be met.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 150)\nmodel.addCons(Watches >= 250)\n## The total production cost for all devices must not exceed $100,000.\nmodel.addCons(50*Smart + 40*Tablets + 70*Laptops + 30*Watches <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Watches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches\": \"Watches\", \"range\": \"Watches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 80*Tablets + 150*Laptops + 50*Watches\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited. The maximum number of smartphones that can be produced daily is 500, tablets is 300, laptops is 200, and smartwatches is 400.\n// Smart <= 500\n// Tablets <= 300\n// Laptops <= 200\n// Watches <= 400\n\n## Generate Constraint-2:\nThe market demand for each device type must be met. The minimum required production of smartphones is 200, tablets is 100, laptops is 150, and smartwatches is 250.\n// Smart >= 200\n// Tablets >= 100\n// Laptops >= 150\n// Watches >= 250\n\n## Generate Constraint-3:\nThe total production cost for all devices must not exceed $100,000. The cost per unit for smartphones is $50, for tablets is $40, for laptops is $70, and for smartwatches is $30.\n// 50*Smart + 40*Tablets + 70*Laptops + 30*Watches <= 100000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The production capacity of the factory is limited, with a maximum daily production of 500 smartphones, 300 tablets, 200 laptops, and 400 smartwatches. The market demand requires a minimum production of 200 smartphones, 100 tablets, 150 laptops, and 250 smartwatches. Additionally, the total production cost for all devices must not exceed $100,000, with costs per unit of $50 for smartphones, $40 for tablets, $70 for laptops, and $30 for smartwatches. Please help the company maximize the total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\nWatches = model.addVar(vtype=\"INTEGER\", name=\"Watches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 80*Tablets + 150*Laptops + 50*Watches)\n\n# Add constraints\n## The production capacity of the factory is limited.\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Watches <= 400)\n## The market demand for each device type must be met.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 150)\nmodel.addCons(Watches >= 250)\n## The total production cost for all devices must not exceed $100,000.\nmodel.addCons(50*Smart + 40*Tablets + 70*Laptops + 30*Watches <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Watches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredient availability and demand.\n// {\"number of loaves of whole wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2*WW + 2.50*Rye + 3*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread must not exceed 500 kilograms. Each loaf of whole wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg, and each loaf of sourdough bread requires 0.6 kg.\n// 0.5*WW + 0.4*Rye + 0.6*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, the demand for rye bread is at least 80 loaves, and the demand for sourdough bread is at least 50 loaves.\n// WW >= 100\n// Rye >= 80\n// Sourdough >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each loaf of bread requires 15 minutes of baking time. The total baking time for all loaves must not exceed 12 hours (720 minutes) per day.\n// 15*WW + 15*Rye + 15*Sourdough <= 720",
        "question": "A bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredient availability and demand. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat (WW) | $2              |\n| Rye              | $2.50           |\n| Sourdough        | $3              |\n\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread must not exceed 500 kilograms. Each loaf of whole wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg, and each loaf of sourdough bread requires 0.6 kg. The bakery also has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, the demand for rye bread is at least 80 loaves, and the demand for sourdough bread is at least 50 loaves. Additionally, the bakery has a limited oven capacity. Each loaf of bread requires 15 minutes of baking time, and the total baking time for all loaves must not exceed 12 hours (720 minutes) per day.\n\nPlease help the bakery to maximize the total daily profit from bread sales by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*Rye + 3*Sourdough)\n\n# Add constraints\n## The total flour usage for all types of bread must not exceed 500 kilograms.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.6*Sourdough <= 500)\n## The demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 50)\n## The total baking time for all loaves must not exceed 12 hours (720 minutes) per day.\nmodel.addCons(15*WW + 15*Rye + 15*Sourdough <= 720)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WW))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredient availability and demand.\n// {\"number of loaves of whole wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2*WW + 2.50*Rye + 3*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread must not exceed 500 kilograms. Each loaf of whole wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg, and each loaf of sourdough bread requires 0.6 kg.\n// 0.5*WW + 0.4*Rye + 0.6*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, the demand for rye bread is at least 80 loaves, and the demand for sourdough bread is at least 50 loaves.\n// WW >= 100\n// Rye >= 80\n// Sourdough >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each loaf of bread requires 15 minutes of baking time. The total baking time for all loaves must not exceed 12 hours (720 minutes) per day.\n// 15*WW + 15*Rye + 15*Sourdough <= 720",
        "question": "A bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredient availability and demand. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, and the profit per loaf for sourdough bread is $3. The bakery has a limited amount of flour available each day, with the total flour usage for all types of bread not exceeding 500 kilograms. Each loaf of whole wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg, and each loaf of sourdough bread requires 0.6 kg. The bakery also has a daily demand for each type of bread: at least 100 loaves of whole wheat bread, at least 80 loaves of rye bread, and at least 50 loaves of sourdough bread. Additionally, the bakery has a limited oven capacity, with each loaf of bread requiring 15 minutes of baking time and the total baking time for all loaves not exceeding 12 hours (720 minutes) per day. Please help the bakery maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*Rye + 3*Sourdough)\n\n# Add constraints\n## The total flour usage for all types of bread must not exceed 500 kilograms.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.6*Sourdough <= 500)\n## The demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 50)\n## The total baking time for all loaves must not exceed 12 hours (720 minutes) per day.\nmodel.addCons(15*WW + 15*Rye + 15*Sourdough <= 720)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WW))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month.\n// Smart <= 500\n// Tablets <= 300\n// Laptops <= 200\n\n## Generate Constraint-2:\nThe total production of all devices must not exceed 800 units per month due to limited assembly line capacity.\n// Smart + Tablets + Laptops <= 800\n\n## Generate Constraint-3:\nThe company has a minimum market demand requirement of 100 units for each type of device to maintain market presence and customer satisfaction.\n// Smart >= 100\n// Tablets >= 100\n// Laptops >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\nThe production capacity of the factory allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month. The total production of all devices must not exceed 800 units per month due to limited assembly line capacity. The company has a minimum market demand requirement of 100 units for each type of device to maintain market presence and customer satisfaction.\n\nPlease help the company to determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce per month to maximize profit, given the following constraints:\n\n1. The number of smartphones produced (Smart) must be less than or equal to 500.\n2. The number of tablets produced (Tablets) must be less than or equal to 300.\n3. The number of laptops produced (Laptops) must be less than or equal to 200.\n4. The total number of all devices produced (Smart + Tablets + Laptops) must be less than or equal to 800.\n5. The number of smartphones produced (Smart) must be greater than or equal to 100.\n6. The number of tablets produced (Tablets) must be greater than or equal to 100.\n7. The number of laptops produced (Laptops) must be greater than or equal to 100.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\n## The total production of all devices\nmodel.addCons(Smart + Tablets + Laptops <= 800)\n## The company has a minimum market demand requirement\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1624,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month.\n// Smart <= 500\n// Tablets <= 300\n// Laptops <= 200\n\n## Generate Constraint-2:\nThe total production of all devices must not exceed 800 units per month due to limited assembly line capacity.\n// Smart + Tablets + Laptops <= 800\n\n## Generate Constraint-3:\nThe company has a minimum market demand requirement of 100 units for each type of device to maintain market presence and customer satisfaction.\n// Smart >= 100\n// Tablets >= 100\n// Laptops >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month. The total production of all devices must not exceed 800 units per month due to limited assembly line capacity. The company has a minimum market demand requirement of 100 units for each type of device to maintain market presence and customer satisfaction. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\n## The total production of all devices\nmodel.addCons(Smart + Tablets + Laptops <= 800)\n## The company has a minimum market demand requirement\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per day.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 100000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit | Raw Material Cost |\n|------------|-----------------|-------------------|\n| Smartphones| $100            | $50               |\n| Tablets    | $150            | $75               |\n| Laptops    | $200            | $100              |\n\nThe production capacity of the factory allows for a maximum of 1000 devices per day. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $100,000 per day.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce each day to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per day.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $100,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1206,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per day.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 100000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 1000 devices per day. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100. Please help the company to determine the optimal number of smartphones, tablets, and laptops to produce per day to maximize profit while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per day.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $100,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. The total budget for raw materials is $75,000 per week.\n// 50*Smart + 75*Tablets + 100*Laptops <= 75000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $150            |\n| Laptops      | $200            |\n\nThe production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week. The company has a budget constraint for raw materials. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. The total budget for raw materials is $75,000 per week.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a budget constraint for raw materials.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 75000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smart))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. The total budget for raw materials is $75,000 per week.\n// 50*Smart + 75*Tablets + 100*Laptops <= 75000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week. The company has a budget constraint for raw materials, with the cost of raw materials for smartphones being $50 per unit, for tablets $75 per unit, and for laptops $100 per unit, and a total budget for raw materials of $75,000 per week. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week, and the demand for tablets and laptops combined should not exceed 500 units per week.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a budget constraint for raw materials.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 75000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smart))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap\n\n## Generate Constraint-1:\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n\n## Generate Constraint-2:\nThe total production cannot exceed 800 units per day across all devices.\n// Smart + Tab + Lap <= 800\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n\n| Device     | Profit per Unit | Production Limit per Day |\n|------------|-----------------|--------------------------|\n| Smartphones| $100            | 500                      |\n| Tablets    | $150            | 300                      |\n| Laptops    | $200            | 200                      |\n\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops. The total production cannot exceed 800 units per day across all devices. The company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations.\n\nPlease help the company determine the optimal number of each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\n## Total production constraint\nmodel.addCons(Smart + Tab + Lap <= 800)\n## Minimum daily production requirements\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap\n\n## Generate Constraint-1:\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n\n## Generate Constraint-2:\nThe total production cannot exceed 800 units per day across all devices.\n// Smart + Tab + Lap <= 800\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices. The production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops. The total production cannot exceed 800 units per day across all devices. The company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations. Please help the company determine the optimal number of each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\n## Total production constraint\nmodel.addCons(Smart + Tab + Lap <= 800)\n## Minimum daily production requirements\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company wants to maximize the total profit from sales.\n// Objective Function: Maximize: 100*Smart + 150*Tablet + 200*Laptop\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month.\n// Smart <= 500\n// Tablet <= 300\n// Laptop <= 200\n\n## Generate Constraint-2:\nThe market demand indicates that at least 100 smartphones, 50 tablets, and 75 laptops should be produced each month to meet the minimum customer expectations.\n// Smart >= 100\n// Tablet >= 50\n// Laptop >= 75\n\n## Generate Constraint-3:\nThe total production time for all devices should not exceed 1000 hours per month. Producing a smartphone takes 2 hours, a tablet takes 3 hours, and a laptop takes 4 hours.\n// 2*Smart + 3*Tablet + 4*Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month. The market demand indicates that at least 100 smartphones, 50 tablets, and 75 laptops should be produced each month to meet the minimum customer expectations. The total production time for all devices should not exceed 1000 hours per month, with producing a smartphone taking 2 hours, a tablet taking 3 hours, and a laptop taking 4 hours.\n\nPlease help the company to maximize the total profit from sales.\n\n| Device     | Profit per Unit | Production Time per Unit |\n|------------|-----------------|--------------------------|\n| Smartphones| $100            | 2 hours                  |\n| Tablets    | $150            | 3 hours                  |\n| Laptops    | $200            | 4 hours                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablet + 200*Laptop)\n\n# Add constraints\n## The production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablet <= 300)\nmodel.addCons(Laptop <= 200)\n## The market demand constraints\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tablet >= 50)\nmodel.addCons(Laptop >= 75)\n## The total production time constraint\nmodel.addCons(2*Smart + 3*Tablet + 4*Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablet))\n    print(\"Number of laptops: \", model.getVal(Laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company wants to maximize the total profit from sales.\n// Objective Function: Maximize: 100*Smart + 150*Tablet + 200*Laptop\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month.\n// Smart <= 500\n// Tablet <= 300\n// Laptop <= 200\n\n## Generate Constraint-2:\nThe market demand indicates that at least 100 smartphones, 50 tablets, and 75 laptops should be produced each month to meet the minimum customer expectations.\n// Smart >= 100\n// Tablet >= 50\n// Laptop >= 75\n\n## Generate Constraint-3:\nThe total production time for all devices should not exceed 1000 hours per month. Producing a smartphone takes 2 hours, a tablet takes 3 hours, and a laptop takes 4 hours.\n// 2*Smart + 3*Tablet + 4*Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company wants to maximize the total profit from sales.\nThe production capacity allows for a maximum of 500 units of smartphones, 300 units of tablets, and 200 units of laptops per month. The market demand indicates that at least 100 smartphones, 50 tablets, and 75 laptops should be produced each month to meet the minimum customer expectations. The total production time for all devices should not exceed 1000 hours per month, with producing a smartphone taking 2 hours, a tablet taking 3 hours, and a laptop taking 4 hours.\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablet), and laptops (Laptop) to produce each month to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablet + 200*Laptop)\n\n# Add constraints\n## The production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tablet <= 300)\nmodel.addCons(Laptop <= 200)\n## The market demand constraints\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tablet >= 50)\nmodel.addCons(Laptop >= 75)\n## The total production time constraint\nmodel.addCons(2*Smart + 3*Tablet + 4*Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablet))\n    print(\"Number of laptops: \", model.getVal(Laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day. The market demand for tablets is at least 50 units per day.\n\nPlease help the company determine the optimal number of smartphones, tablets, and laptops to produce each day to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day, and the market demand for tablets is at least 50 units per day. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 648,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit | Raw Material Cost per Unit |\n|------------|-----------------|----------------------------|\n| Smartphones| $100            | $50                        |\n| Tablets    | $150            | $75                        |\n| Laptops    | $200            | $100                       |\n\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $120,000 per day.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. Please help the company to determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce daily to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of wheat flour bags used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"integer\"}\n// {\"number of rye flour bags used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5 * Wheat <= Wheat_Flour\n// 0.4 * Rye <= Rye_Flour\n// Wheat_Flour <= 100\n// Rye_Flour <= 80\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily.\n// Wheat + Rye <= 150",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n\n| Bread Type | Profit per Loaf | Flour Type | Flour Required per Loaf |\n|------------|-----------------|------------|-------------------------|\n| Wheat      | $3              | Wheat      | 0.5 kg                  |\n| Rye        | $4              | Rye        | 0.4 kg                  |\n\nEach loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour. The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily to meet contractual obligations. The bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily.\n\nPlease help the bakery determine the optimal number of wheat and rye bread loaves to produce daily to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The number of flour bags used for each type of bread\nWheat_Flour = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Flour\", lb=0) # number of wheat flour bags used\nRye_Flour = model.addVar(vtype=\"INTEGER\", name=\"Rye_Flour\", lb=0) # number of rye flour bags used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5 * Wheat <= Wheat_Flour)\nmodel.addCons(0.4 * Rye <= Rye_Flour)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 80)\n## The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily.\nmodel.addCons(Wheat + Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of wheat flour bags used: \", model.getVal(Wheat_Flour))\n    print(\"Number of rye flour bags used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of wheat flour bags used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"integer\"}\n// {\"number of rye flour bags used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5 * Wheat <= Wheat_Flour\n// 0.4 * Rye <= Rye_Flour\n// Wheat_Flour <= 100\n// Rye_Flour <= 80\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily.\n// Wheat + Rye <= 150",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirements. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. Each loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour. The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily to meet contractual obligations. The bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The number of flour bags used for each type of bread\nWheat_Flour = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Flour\", lb=0) # number of wheat flour bags used\nRye_Flour = model.addVar(vtype=\"INTEGER\", name=\"Rye_Flour\", lb=0) # number of rye flour bags used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of wheat flour, and each loaf of rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5 * Wheat <= Wheat_Flour)\nmodel.addCons(0.4 * Rye <= Rye_Flour)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 80)\n## The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves of bread daily.\nmodel.addCons(Wheat + Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of wheat flour bags used: \", model.getVal(Wheat_Flour))\n    print(\"Number of rye flour bags used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The total daily supply of flour is 150 kg.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 10 minutes of labor. The bakery has a total of 12 hours of labor available daily.\n// (10/60)*Wheat + (10/60)*Rye <= 12",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Labor Time (minutes) |\n|------------|-----------------|---------------------|----------------------|\n| Wheat      | $3              | 0.5                 | 10                   |\n| Rye        | $4              | 0.6                 | 10                   |\n\nThe bakery has a limited supply of flour, with a total daily supply of 150 kg. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand. Additionally, each loaf of bread requires 10 minutes of labor, and the bakery has a total of 12 hours of labor available daily.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nFlour_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Flour_Wheat\", lb=0) # number of flour used for wheat bread\nFlour_Rye = model.addVar(vtype=\"INTEGER\", name=\"Flour_Rye\", lb=0) # number of flour used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## The bakery has a daily demand constraint.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a labor constraint.\nmodel.addCons((10/60)*Wheat + (10/60)*Rye <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The total daily supply of flour is 150 kg.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 10 minutes of labor. The bakery has a total of 12 hours of labor available daily.\n// (10/60)*Wheat + (10/60)*Rye <= 12",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.6 kg of flour, and a total daily supply of flour is 150 kg. The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand. Additionally, each loaf of bread requires 10 minutes of labor, and the bakery has a total of 12 hours of labor available daily. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nFlour_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Flour_Wheat\", lb=0) # number of flour used for wheat bread\nFlour_Rye = model.addVar(vtype=\"INTEGER\", name=\"Flour_Rye\", lb=0) # number of flour used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## The bakery has a daily demand constraint.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a labor constraint.\nmodel.addCons((10/60)*Wheat + (10/60)*Rye <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and storage space.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for wheat bread\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for rye bread\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 2 pounds of flour for each wheat bread and 3 pounds of flour for each rye bread. The total daily flour supply is 300 pounds.\n// 2*Wheat + 3*Rye <= 300\n\n## Generate Constraint-2:\nThe bakery has a limited number of ovens available each day. Each wheat bread requires 1/10 of an oven's capacity, and each rye bread requires 1/15 of an oven's capacity. The total oven capacity available daily is 20 ovens.\n// Wheat_Ovens + Rye_Ovens <= 20\n// Wheat_Ovens = Wheat / 10\n// Rye_Ovens = Rye / 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and storage space. The profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery has a limited amount of flour available each day. It uses 2 pounds of flour for each wheat bread and 3 pounds of flour for each rye bread. The total daily flour supply is 300 pounds. The bakery also has a limited number of ovens available each day. Each wheat bread requires 1/10 of an oven's capacity, and each rye bread requires 1/15 of an oven's capacity. The total oven capacity available daily is 20 ovens. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The number of ovens used for each type of bread\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of ovens used for wheat bread\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of ovens used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(2*Wheat + 3*Rye <= 300)\n## The bakery has a limited number of ovens available each day.\nmodel.addCons(Wheat_Ovens + Rye_Ovens <= 20)\nmodel.addCons(Wheat_Ovens == Wheat / 10)\nmodel.addCons(Rye_Ovens == Rye / 15)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of ovens used for wheat bread: \", model.getVal(Wheat_Ovens))\n    print(\"Number of ovens used for rye bread: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and storage space.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for wheat bread\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for rye bread\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 2 pounds of flour for each wheat bread and 3 pounds of flour for each rye bread. The total daily flour supply is 300 pounds.\n// 2*Wheat + 3*Rye <= 300\n\n## Generate Constraint-2:\nThe bakery has a limited number of ovens available each day. Each wheat bread requires 1/10 of an oven's capacity, and each rye bread requires 1/15 of an oven's capacity. The total oven capacity available daily is 20 ovens.\n// Wheat_Ovens + Rye_Ovens <= 20\n// Wheat_Ovens = Wheat / 10\n// Rye_Ovens = Rye / 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and storage space. The profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery has a limited amount of flour available each day, using 2 pounds of flour for each wheat bread and 3 pounds of flour for each rye bread, with a total daily flour supply of 300 pounds. The bakery also has a limited number of ovens available each day, with each wheat bread requiring 1/10 of an oven's capacity and each rye bread requiring 1/15 of an oven's capacity, and a total oven capacity of 20 ovens. Additionally, the bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations. Please help the bakery maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The number of ovens used for each type of bread\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of ovens used for wheat bread\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of ovens used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(2*Wheat + 3*Rye <= 300)\n## The bakery has a limited number of ovens available each day.\nmodel.addCons(Wheat_Ovens + Rye_Ovens <= 20)\nmodel.addCons(Wheat_Ovens == Wheat / 10)\nmodel.addCons(Rye_Ovens == Rye / 15)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of ovens used for wheat bread: \", model.getVal(Wheat_Ovens))\n    print(\"Number of ovens used for rye bread: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donut\", \"range\": \"Donut >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.60*Muffin + 0.70*Donut\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each donut requires 0.3 pounds.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each donut requires 0.15 pounds.\n// 0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.5 hours to prepare, each muffin requires 0.4 hours, and each donut requires 0.6 hours.\n// 0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours. The profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The following table shows the requirements for each type of pastry:\n\n| Pastry   | Flour (pounds) | Sugar (pounds) | Labor Hours |\n|----------|----------------|----------------|-------------|\n| Croissant| 0.1            | 0.05           | 0.5         |\n| Muffin   | 0.2            | 0.1            | 0.4         |\n| Donut    | 0.3            | 0.15           | 0.6         |\n\nThe bakery has a daily limit of 100 pounds of flour and 50 pounds of sugar. Additionally, the bakery has a daily limit of 80 labor hours. Please help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nDonut = model.addVar(vtype=\"INTEGER\", name=\"Donut\", lb=0) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.60*Muffin + 0.70*Donut)\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100)\n## The bakery has a daily limit of 50 pounds of sugar.\nmodel.addCons(0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of donuts: \", model.getVal(Donut))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donut\", \"range\": \"Donut >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.60*Muffin + 0.70*Donut\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each donut requires 0.3 pounds.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each donut requires 0.15 pounds.\n// 0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.5 hours to prepare, each muffin requires 0.4 hours, and each donut requires 0.6 hours.\n// 0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours.\nThe profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery aims to maximize its daily profit from the sales of these pastries.\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each donut requires 0.3 pounds.\nThe bakery has a daily limit of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each donut requires 0.15 pounds.\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.5 hours to prepare, each muffin requires 0.4 hours, and each donut requires 0.6 hours.\nPlease help the bakery determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nDonut = model.addVar(vtype=\"INTEGER\", name=\"Donut\", lb=0) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.60*Muffin + 0.70*Donut)\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100)\n## The bakery has a daily limit of 50 pounds of sugar.\nmodel.addCons(0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of donuts: \", model.getVal(Donut))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and yeast.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour.\n// Wheat_Flour = 0.5 * Wheat\n// Rye_Flour = 0.4 * Rye\n// Constraint: Wheat_Flour <= 100\n// Constraint: Rye_Flour <= 50\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each wheat bread requires 0.5 hours of labor, and each rye bread requires 0.6 hours of labor.\n// 0.5 * Wheat + 0.6 * Rye <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and yeast. The profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour. Each wheat bread requires 0.5 kg of wheat flour and 0.5 hours of labor, while each rye bread requires 0.4 kg of rye flour and 0.6 hours of labor. The bakery has a daily limit of 80 hours of labor. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit from selling these breads.\n\n| Bread Type | Profit per Bread | Flour Required (kg) | Labor Required (hours) |\n|------------|------------------|---------------------|------------------------|\n| Wheat      | $2               | 0.5                 | 0.5                    |\n| Rye        | $3               | 0.4                 | 0.6                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour used for each type of bread\nWheat_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Flour\", lb=0) # amount of wheat flour used\nRye_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Flour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour.\nmodel.addCons(Wheat_Flour == 0.5 * Wheat)\nmodel.addCons(Rye_Flour == 0.4 * Rye)\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 50)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.5 * Wheat + 0.6 * Rye <= 80)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of wheat flour used: \", model.getVal(Wheat_Flour))\n    print(\"Amount of rye flour used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and yeast.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"Wheat_Flour\", \"range\": \"Wheat_Flour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"Rye_Flour\", \"range\": \"Rye_Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour.\n// Wheat_Flour = 0.5 * Wheat\n// Rye_Flour = 0.4 * Rye\n// Constraint: Wheat_Flour <= 100\n// Constraint: Rye_Flour <= 50\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each wheat bread requires 0.5 hours of labor, and each rye bread requires 0.6 hours of labor.\n// 0.5 * Wheat + 0.6 * Rye <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and yeast. The profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery also has a daily limit of 80 hours of labor, with each wheat bread requiring 0.5 hours of labor and each rye bread requiring 0.6 hours of labor. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations. Please help the bakery maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour used for each type of bread\nWheat_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Flour\", lb=0) # amount of wheat flour used\nRye_Flour = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Flour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of wheat flour and 50 kg of rye flour.\nmodel.addCons(Wheat_Flour == 0.5 * Wheat)\nmodel.addCons(Rye_Flour == 0.4 * Rye)\nmodel.addCons(Wheat_Flour <= 100)\nmodel.addCons(Rye_Flour <= 50)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.5 * Wheat + 0.6 * Rye <= 80)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of wheat flour used: \", model.getVal(Wheat_Flour))\n    print(\"Amount of rye flour used: \", model.getVal(Rye_Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\n// 0.2*Wheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table shows the requirements for each type of bread.\n\n| Bread Type | Flour Requirement (pounds) | Labor Requirement (hours) |\n|------------|---------------------------|---------------------------|\n| Wheat      | 0.5                       | 0.2                       |\n| Rye        | 0.6                       | 0.3                       |\n\nThe bakery has a daily supply of 150 pounds of flour and a daily labor capacity of 30 hours. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 30)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Breads: \", model.getVal(Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\n// 0.2*Wheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 30)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Breads: \", model.getVal(Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources such as flour and labor hours.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"real\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour.\n// 0.5 * Wheat + 0.6 * Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor hour limit of 80 hours. Each wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Wheat + 1.5 * Rye <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources such as flour and labor hours. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Flour Usage (kg) | Labor Hours Required |\n|------------|------------------|------------------|----------------------|\n| Wheat      | $2               | 0.5              | 1                    |\n| Rye        | $3               | 0.6              | 1.5                  |\n\nThe bakery has a daily limit of 100 kg of flour and a labor hour limit of 80 hours. The bakery must also produce at least 10 wheat breads and 15 rye breads daily to meet the minimum order requirements from local stores. \n\nPlease help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.5 * Wheat + 0.6 * Rye <= 100)\n## The bakery has a daily labor hour limit of 80 hours.\nmodel.addCons(Wheat + 1.5 * Rye <= 80)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources such as flour and labor hours.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"real\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour.\n// 0.5 * Wheat + 0.6 * Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor hour limit of 80 hours. Each wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Wheat + 1.5 * Rye <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources such as flour and labor hours. The profit per wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily limit of 100 kg of flour. Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery also has a daily labor hour limit of 80 hours. Each wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor. Additionally, the bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from selling these breads.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.5 * Wheat + 0.6 * Rye <= 100)\n## The bakery has a daily labor hour limit of 80 hours.\nmodel.addCons(Wheat + 1.5 * Rye <= 80)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour usage in pounds per day\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"oven time in hours per day\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach whole wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery has a daily limit of 20 hours of oven time.\n// 0.2*Whole_Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// Whole_Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $2, and the profit from selling each rye bread is $3. The following table summarizes the resource requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Usage (pounds) | Oven Time (hours) |\n|----------------|------------------|----------------------|-------------------|\n| Whole Wheat    | $2               | 0.5                  | 0.2               |\n| Rye            | $3               | 0.4                  | 0.3               |\n\nThe bakery has a daily supply of 100 pounds of flour and a daily limit of 20 hours of oven time. Additionally, the bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand. Please help the bakery determine the optimal number of whole wheat and rye breads to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## Each whole wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery has a daily limit of 20 hours of oven time.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Whole_Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour usage in pounds per day\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"oven time in hours per day\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach whole wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery has a daily limit of 20 hours of oven time.\n// 0.2*Whole_Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// Whole_Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $2, and the profit from selling each rye bread is $3. Each whole wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour. Each whole wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery has a daily limit of 20 hours of oven time. The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## Each whole wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery has a daily limit of 20 hours of oven time.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Whole_Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven space and ingredients.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for wheat breads\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye breads\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 square feet of oven space, and each rye bread requires 0.6 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 1 pound of flour, and each rye bread requires 1.5 pounds of flour.\n// Wheat + 1.5*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven space and ingredients. The profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Oven Space Required (sq. ft.) | Flour Required (lbs) |\n|------------|------------------|-------------------------------|----------------------|\n| Wheat      | $2               | 0.5                           | 1                    |\n| Rye        | $3               | 0.6                           | 1.5                  |\n\nThe bakery has a total oven space of 100 square feet available daily. The daily supply of flour is 150 pounds. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand. \n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## Oven space used for each type of bread\nOven_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Wheat\", lb=0) # oven space used for wheat breads\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 square feet of oven space, and each rye bread requires 0.6 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 1 pound of flour, and each rye bread requires 1.5 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye <= 150)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven space and ingredients.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for wheat breads\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye breads\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 square feet of oven space, and each rye bread requires 0.6 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 1 pound of flour, and each rye bread requires 1.5 pounds of flour.\n// Wheat + 1.5*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven space and ingredients.\nThe profit from selling each wheat bread is $2, and the profit from selling each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\nEach wheat bread requires 0.5 square feet of oven space, and each rye bread requires 0.6 square feet of oven space. The total oven space available daily is 100 square feet.\nThe bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 1 pound of flour, and each rye bread requires 1.5 pounds of flour.\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand.\nPlease help the bakery to determine the optimal number of wheat and rye breads to bake daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## Oven space used for each type of bread\nOven_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Wheat\", lb=0) # oven space used for wheat breads\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 square feet of oven space, and each rye bread requires 0.6 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 1 pound of flour, and each rye bread requires 1.5 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye <= 150)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven usage time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for wheat bread\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage time for rye bread\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a total of 12 hours of oven time available each day. Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.4 hours of oven time.\n// 0.5*Wheat + 0.4*Rye <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 1 kg of wheat flour, and each rye bread requires 0.8 kg of rye flour. The total available wheat flour is 10 kg, and the total available rye flour is 8 kg.\n// Wheat <= 10\n// Rye <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand.\n// Wheat >= 5\n// Rye >= 4",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven usage time and ingredient availability. The profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The following table summarizes the requirements and constraints for each type of bread.\n\n| Bread Type | Profit per Bread | Oven Time per Bread | Wheat Flour per Bread | Rye Flour per Bread |\n|------------|------------------|---------------------|-----------------------|---------------------|\n| Wheat      | $3               | 0.5 hours           | 1 kg                  | 0 kg                |\n| Rye        | $4               | 0.4 hours           | 0 kg                  | 0.8 kg              |\n\nThe bakery has a total of 12 hours of oven time available each day. The total available wheat flour is 10 kg, and the total available rye flour is 8 kg. The bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a total of 12 hours of oven time available each day.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 12)\n## The bakery has a limited supply of wheat flour and rye flour.\nmodel.addCons(Wheat <= 10)\nmodel.addCons(Rye <= 8)\n## The bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 5)\nmodel.addCons(Rye >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven usage time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven usage time for wheat bread\": \"Oven_Wheat\", \"range\": \"Oven_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven usage time for rye bread\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a total of 12 hours of oven time available each day. Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.4 hours of oven time.\n// 0.5*Wheat + 0.4*Rye <= 12\n\n## Generate Constraint-2:\nThe bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 1 kg of wheat flour, and each rye bread requires 0.8 kg of rye flour. The total available wheat flour is 10 kg, and the total available rye flour is 8 kg.\n// Wheat <= 10\n// Rye <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand.\n// Wheat >= 5\n// Rye >= 4",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven usage time and ingredient availability. The profit from selling each wheat bread is $3, and the profit from selling each rye bread is $4. The bakery has a total of 12 hours of oven time available each day. Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.4 hours of oven time. The bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 1 kg of wheat flour, and each rye bread requires 0.8 kg of rye flour. The total available wheat flour is 10 kg, and the total available rye flour is 8 kg. The bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a total of 12 hours of oven time available each day.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 12)\n## The bakery has a limited supply of wheat flour and rye flour.\nmodel.addCons(Wheat <= 10)\nmodel.addCons(Rye <= 8)\n## The bakery must produce at least 5 wheat breads and 4 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 5)\nmodel.addCons(Rye >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. They also offer two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each product to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, per rye bread is $3, per croissant is $1, and per muffin is $1.50. The bakery aims to maximize its daily profit from these products.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 1*Croissants + 1.5*Muffins\n\n## Generate Constraint-1:\nThe bakery has a limited oven space. Each wheat bread requires 0.5 square feet, each rye bread requires 0.4 square feet, each croissant requires 0.1 square feet, and each muffin requires 0.2 square feet. The total available oven space is 100 square feet.\n// 0.5*Wheat + 0.4*Rye + 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited number of labor hours. Each wheat bread requires 15 minutes, each rye bread requires 20 minutes, each croissant requires 10 minutes, and each muffin requires 15 minutes. The total available labor hours per day is 480 minutes.\n// (15/60)*Wheat + (20/60)*Rye + (10/60)*Croissants + (15/60)*Muffins <= 480/60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of each type of bread and pastry to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Croissants >= 50, Muffins >= 50",
        "question": "A bakery produces two types of bread: wheat and rye, and two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each product to maximize profit while considering the limited resources such as oven space and labor hours. The profit per wheat bread is $2, per rye bread is $3, per croissant is $1, and per muffin is $1.50. The bakery aims to maximize its daily profit from these products.\n\n| Product       | Profit per Unit | Oven Space Required (sq.ft) | Labor Time Required (minutes) |\n|---------------|-----------------|-----------------------------|-------------------------------|\n| Wheat Bread   | $2              | 0.5                         | 15                            |\n| Rye Bread     | $3              | 0.4                         | 20                            |\n| Croissants    | $1              | 0.1                         | 10                            |\n| Muffins       | $1.50           | 0.2                         | 15                            |\n\nThe bakery has a limited oven space of 100 square feet. The total available labor hours per day is 480 minutes. The bakery must produce at least 50 units of each type of bread and pastry to meet the minimum order requirements from local stores.\n\nPlease help the bakery to determine the optimal number of each product to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 1*Croissants + 1.5*Muffins)\n\n# Add constraints\n## The bakery has a limited oven space.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a limited number of labor hours.\nmodel.addCons((15/60)*Wheat + (20/60)*Rye + (10/60)*Croissants + (15/60)*Muffins <= 480/60)\n## The bakery must produce at least 50 units of each type of bread and pastry.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of rye bread: \", model.getVal(Rye))\n    print(\"Number of croissants: \", model.getVal(Croissants))\n    print(\"Number of muffins: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1367,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. They also offer two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each product to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, per rye bread is $3, per croissant is $1, and per muffin is $1.50. The bakery aims to maximize its daily profit from these products.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 1*Croissants + 1.5*Muffins\n\n## Generate Constraint-1:\nThe bakery has a limited oven space. Each wheat bread requires 0.5 square feet, each rye bread requires 0.4 square feet, each croissant requires 0.1 square feet, and each muffin requires 0.2 square feet. The total available oven space is 100 square feet.\n// 0.5*Wheat + 0.4*Rye + 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited number of labor hours. Each wheat bread requires 15 minutes, each rye bread requires 20 minutes, each croissant requires 10 minutes, and each muffin requires 15 minutes. The total available labor hours per day is 480 minutes.\n// (15/60)*Wheat + (20/60)*Rye + (10/60)*Croissants + (15/60)*Muffins <= 480/60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of each type of bread and pastry to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Croissants >= 50, Muffins >= 50",
        "question": "A bakery produces two types of bread: wheat and rye, and two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each product to maximize profit while considering the limited resources such as oven space and labor hours. The profit per wheat bread is $2, per rye bread is $3, per croissant is $1, and per muffin is $1.50. The bakery has a limited oven space where each wheat bread requires 0.5 square feet, each rye bread requires 0.4 square feet, each croissant requires 0.1 square feet, and each muffin requires 0.2 square feet, with a total available oven space of 100 square feet. The bakery also has a limited number of labor hours where each wheat bread requires 15 minutes, each rye bread requires 20 minutes, each croissant requires 10 minutes, and each muffin requires 15 minutes, with a total available labor hours per day of 480 minutes. The bakery must produce at least 50 units of each type of bread and pastry to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 1*Croissants + 1.5*Muffins)\n\n# Add constraints\n## The bakery has a limited oven space.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a limited number of labor hours.\nmodel.addCons((15/60)*Wheat + (20/60)*Rye + (10/60)*Croissants + (15/60)*Muffins <= 480/60)\n## The bakery must produce at least 50 units of each type of bread and pastry.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of rye bread: \", model.getVal(Rye))\n    print(\"Number of croissants: \", model.getVal(Croissants))\n    print(\"Number of muffins: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. They need to decide on the optimal number of each type of bread to bake daily to maximize their profit, considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"total flour usage\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n// {\"total oven time\": \"OvenTime\", \"range\": \"OvenTime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $2, and each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 2 pounds of flour, and each rye bread requires 1 pound of flour. The bakery has a daily supply of 200 pounds of flour.\n// 2*WholeWheat + Rye <= 200\n\n## Generate Constraint-2:\nEach whole wheat bread requires 30 minutes of oven time, and each rye bread requires 45 minutes of oven time. The bakery has a daily limit of 2400 minutes of oven time.\n// 30*WholeWheat + 45*Rye <= 2400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// WholeWheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. They need to decide on the optimal number of each type of bread to bake daily to maximize their profit, considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $2, and each rye bread is $3. The requirements for each type of bread are given in the following Table.\n\n| Bread Type     | Flour Usage (pounds) | Oven Time (minutes) |\n|----------------|----------------------|---------------------|\n| Whole Wheat    | 2                    | 30                  |\n| Rye            | 1                    | 45                  |\n\nThe bakery has a daily supply of 200 pounds of flour and a daily limit of 2400 minutes of oven time. The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 2 pounds of flour, and each rye bread requires 1 pound of flour. The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(2*WholeWheat + Rye <= 200)\n## Each whole wheat bread requires 30 minutes of oven time, and each rye bread requires 45 minutes of oven time. The bakery has a daily limit of 2400 minutes of oven time.\nmodel.addCons(30*WholeWheat + 45*Rye <= 2400)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. They need to decide on the optimal number of each type of bread to bake daily to maximize their profit, considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"total flour usage\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n// {\"total oven time\": \"OvenTime\", \"range\": \"OvenTime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $2, and each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 2 pounds of flour, and each rye bread requires 1 pound of flour. The bakery has a daily supply of 200 pounds of flour.\n// 2*WholeWheat + Rye <= 200\n\n## Generate Constraint-2:\nEach whole wheat bread requires 30 minutes of oven time, and each rye bread requires 45 minutes of oven time. The bakery has a daily limit of 2400 minutes of oven time.\n// 30*WholeWheat + 45*Rye <= 2400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\n// WholeWheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. They need to decide on the optimal number of each type of bread to bake daily to maximize their profit, considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $2, and each rye bread is $3. Each whole wheat bread requires 2 pounds of flour, and each rye bread requires 1 pound of flour. The bakery has a daily supply of 200 pounds of flour. Each whole wheat bread requires 30 minutes of oven time, and each rye bread requires 45 minutes of oven time. The bakery has a daily limit of 2400 minutes of oven time. The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 2 pounds of flour, and each rye bread requires 1 pound of flour. The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(2*WholeWheat + Rye <= 200)\n## Each whole wheat bread requires 30 minutes of oven time, and each rye bread requires 45 minutes of oven time. The bakery has a daily limit of 2400 minutes of oven time.\nmodel.addCons(30*WholeWheat + 45*Rye <= 2400)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclair\", \"range\": \"Eclair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin + 1.00*Eclair\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 eggs, and each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs.\n// Croissant + 2*Muffin + 3*Eclair <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 1500 pastries.\n// Croissant + Muffin + Eclair <= 1500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery has a daily limit of 500 eggs, where each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs. Additionally, the bakery has a daily limit of 100 kg of flour, where each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. The bakery also has a daily production capacity of 1500 pastries.\n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Egg Requirement | Flour Requirement |\n|----------|-----------------|-----------------|-------------------|\n| Croissant| $0.50           | 1 egg           | 0.1 kg            |\n| Muffin   | $0.70           | 2 eggs          | 0.2 kg            |\n| Eclair   | $1.00           | 3 eggs          | 0.3 kg            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nEclair = model.addVar(vtype=\"INTEGER\", name=\"Eclair\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin + 1.00*Eclair)\n\n# Add constraints\n## The bakery has a daily limit of 500 eggs.\nmodel.addCons(Croissant + 2*Muffin + 3*Eclair <= 500)\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100)\n## The bakery has a daily production capacity of 1500 pastries.\nmodel.addCons(Croissant + Muffin + Eclair <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Number of Eclairs: \", model.getVal(Eclair))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclair\", \"range\": \"Eclair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin + 1.00*Eclair\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 eggs, and each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs.\n// Croissant + 2*Muffin + 3*Eclair <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 1500 pastries.\n// Croissant + Muffin + Eclair <= 1500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery has a daily limit of 500 eggs, and each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs. The bakery also has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. Additionally, the bakery has a daily production capacity of 1500 pastries. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nEclair = model.addVar(vtype=\"INTEGER\", name=\"Eclair\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin + 1.00*Eclair)\n\n# Add constraints\n## The bakery has a daily limit of 500 eggs.\nmodel.addCons(Croissant + 2*Muffin + 3*Eclair <= 500)\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100)\n## The bakery has a daily production capacity of 1500 pastries.\nmodel.addCons(Croissant + Muffin + Eclair <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Number of Eclairs: \", model.getVal(Eclair))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 20*Choc + 18*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\n// 2*Choc + 1.5*Van <= 80\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\n// Choc + 0.8*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\n// Choc >= 10, Van >= 15",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor. The selling price for each chocolate cake is $20 and for each vanilla cake is $18. The following table summarizes the labor and sugar requirements for each type of cake.\n\n| Cake Type | Selling Price | Labor per Cake | Sugar per Cake |\n|-----------|---------------|----------------|----------------|\n| Chocolate | $20           | 2 hours        | 1 pound        |\n| Vanilla   | $18           | 1.5 hours      | 0.8 pounds     |\n\nThe bakery has a maximum of 80 hours of labor and 60 pounds of sugar available each day. The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand. Please help the bakery to maximize its daily revenue from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*Choc + 18*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\nmodel.addCons(2*Choc + 1.5*Van <= 80)\n## Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\nmodel.addCons(Choc + 0.8*Van <= 60)\n## The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\nmodel.addCons(Choc >= 10)\nmodel.addCons(Van >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 20*Choc + 18*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\n// 2*Choc + 1.5*Van <= 80\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\n// Choc + 0.8*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\n// Choc >= 10, Van >= 15",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor. Each chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales. Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day. Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day. The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand. Please help the bakery determine the optimal number of chocolate and vanilla cakes to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*Choc + 18*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\nmodel.addCons(2*Choc + 1.5*Van <= 80)\n## Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\nmodel.addCons(Choc + 0.8*Van <= 60)\n## The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\nmodel.addCons(Choc >= 10)\nmodel.addCons(Van >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The total daily supply of flour is 100 kg.\n// 0.5*Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each loaf of bread requires 0.1 hours of oven time. The total daily oven time available is 15 hours.\n// 0.1*Wheat + 0.1*Rye <= 15\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat bread is 50 loaves, and for rye bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand. The profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The total daily supply of flour is 100 kg. The bakery also has a limited oven capacity; each loaf of bread requires 0.1 hours of oven time, and the total daily oven time available is 15 hours. Additionally, the bakery must meet a minimum daily demand for each type of bread: the minimum demand for wheat bread is 50 loaves, and for rye bread is 30 loaves.\n\nPlease help the bakery determine the optimal number of wheat and rye bread loaves to produce daily to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 100)\n## The bakery has a limited oven capacity.\nmodel.addCons(0.1*Wheat + 0.1*Rye <= 15)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The total daily supply of flour is 100 kg.\n// 0.5*Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each loaf of bread requires 0.1 hours of oven time. The total daily oven time available is 15 hours.\n// 0.1*Wheat + 0.1*Rye <= 15\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat bread is 50 loaves, and for rye bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand. The profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.4 kg of flour, and the total daily supply of flour is 100 kg. The bakery also has a limited oven capacity, with each loaf of bread requiring 0.1 hours of oven time, and the total daily oven time available is 15 hours. Additionally, the bakery must meet a minimum daily demand for each type of bread, with the minimum demand for wheat bread being 50 loaves and for rye bread being 30 loaves. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 100)\n## The bakery has a limited oven capacity.\nmodel.addCons(0.1*Wheat + 0.1*Rye <= 15)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, and the profit from each muffin is $0.70. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries daily to meet the minimum order requirements.\n// Croissant + Muffin >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit from each croissant is $0.50, and the profit from each muffin is $0.70. The following table summarizes the labor and flour requirements for each type of pastry:\n\n| Pastry   | Labor Requirement (hours) | Flour Requirement (pounds) |\n|----------|--------------------------|---------------------------|\n| Croissant| 0.1                      | 0.05                      |\n| Muffin   | 0.2                      | 0.1                       |\n\nThe bakery has a maximum of 8 hours of labor and 5 pounds of flour available daily. The bakery must also produce at least 50 pastries daily to meet the minimum order requirements. Please help the bakery maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 5)\n## The bakery must produce at least 50 pastries daily to meet the minimum order requirements.\nmodel.addCons(Croissant + Muffin >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, and the profit from each muffin is $0.70. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries daily to meet the minimum order requirements.\n// Croissant + Muffin >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit from each croissant is $0.50, and the profit from each muffin is $0.70. Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor, with a maximum of 8 hours of labor available daily. Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour, with a maximum of 5 pounds of flour available daily. The bakery must produce at least 50 pastries daily to meet the minimum order requirements. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 5)\n## The bakery must produce at least 50 pastries daily to meet the minimum order requirements.\nmodel.addCons(Croissant + Muffin >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each donut requires 0.15 kg, and each mixed box requires 0.1 kg of each pastry.\n// 0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each donut requires 0.08 kg, and each mixed box requires 0.05 kg of each pastry.\n// 0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\n// Cro >= 100, Muff >= 80, Don >= 120",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space. The profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n\n| Pastry       | Profit per Unit | Flour Required (kg) | Sugar Required (kg) |\n|--------------|-----------------|---------------------|---------------------|\n| Croissants   | $0.50           | 0.1                 | 0.05                |\n| Muffins      | $0.60           | 0.2                 | 0.1                 |\n| Donuts       | $0.70           | 0.15                | 0.08                |\n| Mixed Box    | $2.00           | 0.1*(Cro+Muff+Don)  | 0.05*(Cro+Muff+Don) |\n\nThe bakery has a daily supply of 100 kg of flour and 50 kg of sugar. The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\n\nPlease help the bakery to determine the optimal number of croissants (Cro), muffins (Muff), donuts (Don), and mixed boxes (Mix) to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry and the mixed box\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100)\n## The bakery has a daily supply of 50 kg of sugar.\nmodel.addCons(0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50)\n## The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 80)\nmodel.addCons(Don >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each donut requires 0.15 kg, and each mixed box requires 0.1 kg of each pastry.\n// 0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each donut requires 0.08 kg, and each mixed box requires 0.05 kg of each pastry.\n// 0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\n// Cro >= 100, Muff >= 80, Don >= 120",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space. The profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery has a daily supply of 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, each donut requires 0.15 kg of flour and 0.08 kg of sugar, and each mixed box requires 0.1 kg of flour and 0.05 kg of sugar for each pastry. The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry and the mixed box\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100)\n## The bakery has a daily supply of 50 kg of sugar.\nmodel.addCons(0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50)\n## The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 80)\nmodel.addCons(Don >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. They need to decide how many loaves of each type to bake daily to maximize their profit, considering the limited resources such as flour and yeast.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"WheatFlour\", \"range\": \"WheatFlour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"RyeFlour\", \"range\": \"RyeFlour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat loaf is $2, and the profit from selling each rye loaf is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat loaf requires 0.5 pounds of wheat flour, and each rye loaf requires 0.4 pounds of rye flour. The bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour.\n// 0.5 * WholeWheat <= WheatFlour\n// 0.4 * Rye <= RyeFlour\n// WheatFlour <= 100\n// RyeFlour <= 80\n\n## Generate Constraint-2:\nEach loaf of bread requires 0.1 grams of yeast. The bakery has a daily supply of 15 grams of yeast.\n// 0.1 * (WholeWheat + Rye) <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. They need to decide how many loaves of each type to bake daily to maximize their profit, considering the limited resources such as flour and yeast. The profit from selling each whole wheat loaf is $2, and the profit from selling each rye loaf is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Wheat Flour per Loaf | Rye Flour per Loaf | Yeast per Loaf |\n|------------|-----------------|----------------------|--------------------|----------------|\n| Whole Wheat | $2              | 0.5 pounds           | 0 pounds           | 0.1 grams      |\n| Rye        | $3              | 0 pounds             | 0.4 pounds         | 0.1 grams      |\n\nThe bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour. Each loaf of bread requires 0.1 grams of yeast, and the bakery has a daily supply of 15 grams of yeast. The bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of whole wheat and rye loaves to bake.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## The amount of flour used for each type of bread\nWheatFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatFlour\", lb=0) # amount of wheat flour used\nRyeFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeFlour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat loaf requires 0.5 pounds of wheat flour, and each rye loaf requires 0.4 pounds of rye flour.\nmodel.addCons(0.5 * WholeWheat <= WheatFlour)\nmodel.addCons(0.4 * Rye <= RyeFlour)\n## The bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour.\nmodel.addCons(WheatFlour <= 100)\nmodel.addCons(RyeFlour <= 80)\n## Each loaf of bread requires 0.1 grams of yeast. The bakery has a daily supply of 15 grams of yeast.\nmodel.addCons(0.1 * (WholeWheat + Rye) <= 15)\n## The bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Amount of wheat flour used: \", model.getVal(WheatFlour))\n    print(\"Amount of rye flour used: \", model.getVal(RyeFlour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. They need to decide how many loaves of each type to bake daily to maximize their profit, considering the limited resources such as flour and yeast.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of wheat flour used\": \"WheatFlour\", \"range\": \"WheatFlour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"RyeFlour\", \"range\": \"RyeFlour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat loaf is $2, and the profit from selling each rye loaf is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach whole wheat loaf requires 0.5 pounds of wheat flour, and each rye loaf requires 0.4 pounds of rye flour. The bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour.\n// 0.5 * WholeWheat <= WheatFlour\n// 0.4 * Rye <= RyeFlour\n// WheatFlour <= 100\n// RyeFlour <= 80\n\n## Generate Constraint-2:\nEach loaf of bread requires 0.1 grams of yeast. The bakery has a daily supply of 15 grams of yeast.\n// 0.1 * (WholeWheat + Rye) <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. They need to decide how many loaves of each type to bake daily to maximize their profit, considering the limited resources such as flour and yeast. The profit from selling each whole wheat loaf is $2, and the profit from selling each rye loaf is $3. Each whole wheat loaf requires 0.5 pounds of wheat flour, and each rye loaf requires 0.4 pounds of rye flour. The bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour. Each loaf of bread requires 0.1 grams of yeast, and the bakery has a daily supply of 15 grams of yeast. The bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## The amount of flour used for each type of bread\nWheatFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatFlour\", lb=0) # amount of wheat flour used\nRyeFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeFlour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each whole wheat loaf requires 0.5 pounds of wheat flour, and each rye loaf requires 0.4 pounds of rye flour.\nmodel.addCons(0.5 * WholeWheat <= WheatFlour)\nmodel.addCons(0.4 * Rye <= RyeFlour)\n## The bakery has a daily supply of 100 pounds of wheat flour and 80 pounds of rye flour.\nmodel.addCons(WheatFlour <= 100)\nmodel.addCons(RyeFlour <= 80)\n## Each loaf of bread requires 0.1 grams of yeast. The bakery has a daily supply of 15 grams of yeast.\nmodel.addCons(0.1 * (WholeWheat + Rye) <= 15)\n## The bakery must produce at least 50 loaves of bread daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Amount of wheat flour used: \", model.getVal(WheatFlour))\n    print(\"Amount of rye flour used: \", model.getVal(RyeFlour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 773,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of wheat flour bags\": \"WheatFlour\", \"range\": \"WheatFlour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of wheat flour. The bakery has a daily supply of 100 kg of wheat flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach whole wheat bread requires 0.2 labor hours, and each rye bread requires 0.3 labor hours. The bakery has a daily limit of 20 labor hours.\n// 0.2*WholeWheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations.\n// WholeWheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and labor. The profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2. The following table summarizes the requirements for each type of bread:\n\n| Bread Type       | Profit per Bread | Wheat Flour Requirement (kg) | Labor Hours Required |\n|------------------|------------------|------------------------------|----------------------|\n| Whole Wheat      | $3               | 0.5                          | 0.2                  |\n| Rye              | $2               | 0.4                          | 0.3                  |\n\nThe bakery has a daily supply of 100 kg of wheat flour and a daily limit of 20 labor hours. The bakery must also produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of wheat flour. The bakery has a daily supply of 100 kg of wheat flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each whole wheat bread requires 0.2 labor hours, and each rye bread requires 0.3 labor hours. The bakery has a daily limit of 20 labor hours.\nmodel.addCons(0.2*WholeWheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of wheat flour bags\": \"WheatFlour\", \"range\": \"WheatFlour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of wheat flour. The bakery has a daily supply of 100 kg of wheat flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach whole wheat bread requires 0.2 labor hours, and each rye bread requires 0.3 labor hours. The bakery has a daily limit of 20 labor hours.\n// 0.2*WholeWheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations.\n// WholeWheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and labor. The profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2. Each whole wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of wheat flour. The bakery has a daily supply of 100 kg of wheat flour. Each whole wheat bread requires 0.2 labor hours, and each rye bread requires 0.3 labor hours. The bakery has a daily limit of 20 labor hours. The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of wheat flour. The bakery has a daily supply of 100 kg of wheat flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each whole wheat bread requires 0.2 labor hours, and each rye bread requires 0.3 labor hours. The bakery has a daily limit of 20 labor hours.\nmodel.addCons(0.2*WholeWheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 whole wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for whole wheat\": \"Oven_WholeWheat\", \"range\": \"Oven_WholeWheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\n// WholeWheat + 0.8*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread in total.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour. The profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Space per Loaf | Flour per Loaf |\n|------------|-----------------|---------------------|----------------|\n| Whole Wheat | $2              | 0.5 square feet     | 1 pound        |\n| Rye        | $3              | 0.4 square feet     | 0.8 pounds     |\n\nThe bakery has a total oven space of 100 square feet available daily. The bakery also has a daily supply of 150 pounds of flour. The bakery has a minimum daily production requirement of 50 loaves of bread in total. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Oven space used for each type of bread\nOven_WholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_WholeWheat\", lb=0) # oven space used for whole wheat\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\nmodel.addCons(WholeWheat + 0.8*Rye <= 150)\n## The bakery has a minimum daily production requirement of 50 loaves of bread in total.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for whole wheat\": \"Oven_WholeWheat\", \"range\": \"Oven_WholeWheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\n// WholeWheat + 0.8*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread in total.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour. The profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet. The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour. The bakery has a minimum daily production requirement of 50 loaves of bread in total. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Oven space used for each type of bread\nOven_WholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_WholeWheat\", lb=0) # oven space used for whole wheat\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\nmodel.addCons(WholeWheat + 0.8*Rye <= 150)\n## The bakery has a minimum daily production requirement of 50 loaves of bread in total.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources of flour and yeast.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"amount of yeast used\": \"Yeast\", \"range\": \"Yeast >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, while each rye bread requires 0.4 kg of flour and 0.2 kg of yeast. The bakery has a daily supply of 100 kg of flour and 20 kg of yeast.\n// 0.5*Wheat + 0.4*Rye <= 100 (Flour constraint)\n// 0.1*Wheat + 0.2*Rye <= 20 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-3:\nThe total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads.\n// Wheat + Rye <= 150",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources of flour and yeast. The profit from selling each wheat bread is $2, and each rye bread is $3. The requirements for flour and yeast per bread type are given in the following Table.\n\n| Bread Type | Flour (kg) | Yeast (kg) |\n|------------|------------|------------|\n| Wheat      | 0.5        | 0.1        |\n| Rye        | 0.4        | 0.2        |\n\nThe bakery has a daily supply of 100 kg of flour and 20 kg of yeast. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations. The total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour and yeast used\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour used\nYeast = model.addVar(vtype=\"CONTINUOUS\", name=\"Yeast\", lb=0) # amount of yeast used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, while each rye bread requires 0.4 kg of flour and 0.2 kg of yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye == Flour)\nmodel.addCons(0.1*Wheat + 0.2*Rye == Yeast)\n## The bakery has a daily supply of 100 kg of flour and 20 kg of yeast.\nmodel.addCons(Flour <= 100)\nmodel.addCons(Yeast <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads.\nmodel.addCons(Wheat + Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of flour used: \", model.getVal(Flour))\n    print(\"Amount of yeast used: \", model.getVal(Yeast))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources of flour and yeast.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n// {\"amount of yeast used\": \"Yeast\", \"range\": \"Yeast >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, while each rye bread requires 0.4 kg of flour and 0.2 kg of yeast. The bakery has a daily supply of 100 kg of flour and 20 kg of yeast.\n// 0.5*Wheat + 0.4*Rye <= 100 (Flour constraint)\n// 0.1*Wheat + 0.2*Rye <= 20 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-3:\nThe total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads.\n// Wheat + Rye <= 150",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the limited resources of flour and yeast. The profit from selling each wheat bread is $2, and each rye bread is $3. Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, while each rye bread requires 0.4 kg of flour and 0.2 kg of yeast. The bakery has a daily supply of 100 kg of flour and 20 kg of yeast. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations. The total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour and yeast used\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # amount of flour used\nYeast = model.addVar(vtype=\"CONTINUOUS\", name=\"Yeast\", lb=0) # amount of yeast used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, while each rye bread requires 0.4 kg of flour and 0.2 kg of yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye == Flour)\nmodel.addCons(0.1*Wheat + 0.2*Rye == Yeast)\n## The bakery has a daily supply of 100 kg of flour and 20 kg of yeast.\nmodel.addCons(Flour <= 100)\nmodel.addCons(Yeast <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The total amount of bread produced daily should not exceed the bakery's production capacity of 150 breads.\nmodel.addCons(Wheat + Rye <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of flour used: \", model.getVal(Flour))\n    print(\"Amount of yeast used: \", model.getVal(Yeast))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit, considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla\n\n## Generate Constraint-1:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 2 units of chocolate ingredients, and each vanilla cake requires 3 units of vanilla ingredients. The total available chocolate ingredients are 200 units, and the total available vanilla ingredients are 300 units.\n// 2*Chocolate <= Chocolate_Ingredients <= 200\n// 3*Vanilla <= Vanilla_Ingredients <= 300\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 30, and for vanilla cakes is 40.\n// Chocolate >= 30\n// Vanilla >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each cake requires 1 hour of oven time. The total available oven time per day is 100 hours.\n// Chocolate + Vanilla <= 100",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit, considering the limited availability of ingredients and the demand for each type of cake. The profit per chocolate cake is $5, and the profit per vanilla cake is $4.\n\n| Cake Type | Profit per Cake | Ingredient Requirement | Oven Time per Cake |\n|-----------|-----------------|------------------------|---------------------|\n| Chocolate | $5              | 2 units of chocolate  | 1 hour              |\n| Vanilla   | $4              | 3 units of vanilla    | 1 hour              |\n\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 2 units of chocolate ingredients, and each vanilla cake requires 3 units of vanilla ingredients. The total available chocolate ingredients are 200 units, and the total available vanilla ingredients are 300 units. The bakery must meet a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 30, and for vanilla cakes is 40. The bakery has a limited oven capacity. Each cake requires 1 hour of oven time, and the total available oven time per day is 100 hours.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the amount of ingredients used\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla)\n\n# Add constraints\n## The bakery has a limited supply of chocolate and vanilla ingredients.\nmodel.addCons(2*Chocolate <= Chocolate_Ingredients)\nmodel.addCons(Chocolate_Ingredients <= 200)\nmodel.addCons(3*Vanilla <= Vanilla_Ingredients)\nmodel.addCons(Vanilla_Ingredients <= 300)\n## The bakery must meet a minimum daily demand for each type of cake.\nmodel.addCons(Chocolate >= 30)\nmodel.addCons(Vanilla >= 40)\n## The bakery has a limited oven capacity.\nmodel.addCons(Chocolate + Vanilla <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit, considering the limited availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla\n\n## Generate Constraint-1:\nThe bakery has a limited supply of chocolate and vanilla ingredients. Each chocolate cake requires 2 units of chocolate ingredients, and each vanilla cake requires 3 units of vanilla ingredients. The total available chocolate ingredients are 200 units, and the total available vanilla ingredients are 300 units.\n// 2*Chocolate <= Chocolate_Ingredients <= 200\n// 3*Vanilla <= Vanilla_Ingredients <= 300\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of cake. The minimum demand for chocolate cakes is 30, and for vanilla cakes is 40.\n// Chocolate >= 30\n// Vanilla >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. Each cake requires 1 hour of oven time. The total available oven time per day is 100 hours.\n// Chocolate + Vanilla <= 100",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit, considering the limited availability of ingredients and the demand for each type of cake. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 units of chocolate ingredients, and each vanilla cake requires 3 units of vanilla ingredients. The total available chocolate ingredients are 200 units, and the total available vanilla ingredients are 300 units. The bakery must meet a minimum daily demand for each type of cake, with the minimum demand for chocolate cakes being 30 and for vanilla cakes being 40. Additionally, the bakery has a limited oven capacity, with each cake requiring 1 hour of oven time and a total available oven time per day of 100 hours. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the amount of ingredients used\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla)\n\n# Add constraints\n## The bakery has a limited supply of chocolate and vanilla ingredients.\nmodel.addCons(2*Chocolate <= Chocolate_Ingredients)\nmodel.addCons(Chocolate_Ingredients <= 200)\nmodel.addCons(3*Vanilla <= Vanilla_Ingredients)\nmodel.addCons(Vanilla_Ingredients <= 300)\n## The bakery must meet a minimum daily demand for each type of cake.\nmodel.addCons(Chocolate >= 30)\nmodel.addCons(Vanilla >= 40)\n## The bakery has a limited oven capacity.\nmodel.addCons(Chocolate + Vanilla <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour required for whole wheat\": \"Flour_WW\", \"range\": \"Flour_WW >= 0\", \"type\": \"real\"}\n// {\"flour required for rye\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 1.5*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour.\n// Flour_WW = WholeWheat\n// Flour_Rye = 0.75*Rye\n// Flour_WW + Flour_Rye <= 200\n\n## Generate Constraint-2:\nThe bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing.\n// WholeWheat + Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 50\n// Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand. The profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour. The bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Flour required for each type of bread\nFlour_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_WW\", lb=0) # flour required for whole wheat\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour required for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 1.5*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(Flour_WW == WholeWheat)\nmodel.addCons(Flour_Rye == 0.75*Rye)\nmodel.addCons(Flour_WW + Flour_Rye <= 200)\n## The bakery can only bake a maximum of 150 loaves of bread per day.\nmodel.addCons(WholeWheat + Rye <= 150)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour required for whole wheat\": \"Flour_WW\", \"range\": \"Flour_WW >= 0\", \"type\": \"real\"}\n// {\"flour required for rye\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 1.5*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour.\n// Flour_WW = WholeWheat\n// Flour_Rye = 0.75*Rye\n// Flour_WW + Flour_Rye <= 200\n\n## Generate Constraint-2:\nThe bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing.\n// WholeWheat + Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 50\n// Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand. The profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour. The bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Flour required for each type of bread\nFlour_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_WW\", lb=0) # flour required for whole wheat\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour required for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 1.5*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(Flour_WW == WholeWheat)\nmodel.addCons(Flour_Rye == 0.75*Rye)\nmodel.addCons(Flour_WW + Flour_Rye <= 200)\n## The bakery can only bake a maximum of 150 loaves of bread per day.\nmodel.addCons(WholeWheat + Rye <= 150)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nEach loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1 hour of oven time respectively. The bakery has a total of 10 hours of oven time available daily.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough <= OvenHours\n// OvenHours <= 10\n\n## Generate Constraint-2:\nThe bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand.\n// Wheat <= 15\n// Rye <= 20\n// Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 5\n// Rye >= 5\n// Sourdough >= 5",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited oven capacity and daily demand. The profit per loaf for wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The following table summarizes the oven time required for each type of bread:\n\n| Bread Type | Oven Time per Loaf |\n|------------|--------------------|\n| Wheat      | 0.5 hours          |\n| Rye        | 0.7 hours          |\n| Sourdough  | 1 hour             |\n\nThe bakery has a total of 10 hours of oven time available daily. The bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand. The bakery must also produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\nOvenHours = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenHours\", lb=0) # oven capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1 hour of oven time respectively. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough <= OvenHours)\nmodel.addCons(OvenHours <= 10)\n## The bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand.\nmodel.addCons(Wheat <= 15)\nmodel.addCons(Rye <= 20)\nmodel.addCons(Sourdough <= 10)\n## The bakery must produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 5)\nmodel.addCons(Rye >= 5)\nmodel.addCons(Sourdough >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, and sourdough bread is $2, $3, and $4 respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nEach loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1 hour of oven time respectively. The bakery has a total of 10 hours of oven time available daily.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough <= OvenHours\n// OvenHours <= 10\n\n## Generate Constraint-2:\nThe bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand.\n// Wheat <= 15\n// Rye <= 20\n// Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 5\n// Rye >= 5\n// Sourdough >= 5",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited oven capacity and daily demand.\nThe profit per loaf for wheat, rye, and sourdough bread is $2, $3, and $4 respectively. Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1 hour of oven time respectively. The bakery has a total of 10 hours of oven time available daily. The bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand. The bakery must produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\nOvenHours = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenHours\", lb=0) # oven capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1 hour of oven time respectively. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough <= OvenHours)\nmodel.addCons(OvenHours <= 10)\n## The bakery can sell at most 15 loaves of wheat bread, 20 loaves of rye bread, and 10 loaves of sourdough bread daily due to market demand.\nmodel.addCons(Wheat <= 15)\nmodel.addCons(Rye <= 20)\nmodel.addCons(Sourdough <= 10)\n## The bakery must produce at least 5 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 5)\nmodel.addCons(Rye >= 5)\nmodel.addCons(Sourdough >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*S\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\n// 2*W + 3*C + 1*S <= 200\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to fulfill a contract.\n// W >= 10",
        "question": "A farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops. The total available land for planting is 100 acres. The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours. The farmer must plant at least 10 acres of wheat to fulfill a contract.\n\nPlease help the farmer determine the optimal allocation of acres for wheat (W), corn (C), and soybeans (S) to maximize his profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*S)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\nmodel.addCons(2*W + 3*C + 1*S <= 200)\n## The farmer must plant at least 10 acres of wheat to fulfill a contract.\nmodel.addCons(W >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*S\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\n// 2*W + 3*C + 1*S <= 200\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to fulfill a contract.\n// W >= 10",
        "question": "A farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The total available land for planting is 100 acres. The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours. The farmer must plant at least 10 acres of wheat to fulfill a contract. Please help the farmer to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*S)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\nmodel.addCons(2*W + 3*C + 1*S <= 200)\n## The farmer must plant at least 10 acres of wheat to fulfill a contract.\nmodel.addCons(W >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Multigrain <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Multigrain >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// Wheat + Rye + Sourdough + Multigrain <= 300",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Wheat          | $1.50           |\n| Rye            | $1.75           |\n| Sourdough      | $2.00           |\n| Multigrain     | $2.25           |\n\nThe bakery has a daily production capacity of 500 loaves of bread. The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Multigrain <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Multigrain >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// Wheat + Rye + Sourdough + Multigrain <= 300",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery has a daily production capacity of 500 loaves of bread and must produce at least 100 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 669,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Gluten_Free >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread.\n// Wheat <= 300\n// Rye <= 200\n// Sourdough <= 150\n// Gluten_Free <= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $1.50           |\n| Rye           | $2.00           |\n| Sourdough     | $2.50           |\n| Gluten-Free   | $3.00           |\n\nThe bakery has a daily production capacity of 500 loaves of bread. It must produce at least 50 loaves of each type of bread to meet contractual obligations. The bakery also has a limited supply of ingredients, specifically flour, which is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Gluten_Free <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Gluten_Free >= 50)\n## The bakery has a limited supply of ingredients, specifically flour.\nmodel.addCons(Wheat <= 300)\nmodel.addCons(Rye <= 200)\nmodel.addCons(Sourdough <= 150)\nmodel.addCons(Gluten_Free <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Gluten_Free >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread.\n// Wheat <= 300\n// Rye <= 200\n// Sourdough <= 150\n// Gluten_Free <= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily production capacity of 500 loaves of bread. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a limited supply of ingredients, specifically flour, which is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Gluten_Free <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Gluten_Free >= 50)\n## The bakery has a limited supply of ingredients, specifically flour.\nmodel.addCons(Wheat <= 300)\nmodel.addCons(Rye <= 200)\nmodel.addCons(Sourdough <= 150)\nmodel.addCons(Gluten_Free <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of ingredient availability and minimum production requirements.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"Tarts\", \"range\": \"Tarts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $1.00, and per tart is $1.20. The bakery aims to maximize its daily profit from these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.60*Muffins + 1.00*Eclairs + 1.20*Tarts\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and sugar. It can use up to 150 pounds of flour and 100 pounds of sugar daily. Each croissant requires 0.1 pounds of flour and 0.05 pounds of sugar, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each eclair requires 0.3 pounds of flour and 0.2 pounds of sugar, and each tart requires 0.4 pounds of flour and 0.3 pounds of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs + 0.4*Tarts <= 150 (Flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.2*Eclairs + 0.3*Tarts <= 100 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 of each type of pastry daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50, Muffins >= 50, Eclairs >= 50, Tarts >= 50\n\n## Generate Constraint-3:\nThe bakery has a labor constraint, limiting the total number of pastries that can be produced daily to 500.\n// Croissants + Muffins + Eclairs + Tarts <= 500",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of ingredient availability and minimum production requirements. The profit per pastry and the ingredient requirements for each pastry are given in the following Table.\n\n| Pastry   | Profit per Unit | Flour Required (lbs) | Sugar Required (lbs) |\n|----------|-----------------|----------------------|----------------------|\n| Croissant| $0.50           | 0.1                  | 0.05                 |\n| Muffin   | $0.60           | 0.2                  | 0.1                  |\n| Eclair   | $1.00           | 0.3                  | 0.2                  |\n| Tart     | $1.20           | 0.4                  | 0.3                  |\n\nThe bakery has a limited amount of flour and sugar. It can use up to 150 pounds of flour and 100 pounds of sugar daily. The bakery must produce at least 50 of each type of pastry daily to meet the minimum order requirements from local cafes. Additionally, the bakery has a labor constraint, limiting the total number of pastries that can be produced daily to 500.\n\nPlease help the bakery to maximize its daily profit from these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs\nTarts = model.addVar(vtype=\"INTEGER\", name=\"Tarts\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.60*Muffins + 1.00*Eclairs + 1.20*Tarts)\n\n# Add constraints\n## Flour and sugar constraints\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs + 0.4*Tarts <= 150) # Flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.2*Eclairs + 0.3*Tarts <= 100) # Sugar constraint\n## Minimum production requirements\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Eclairs >= 50)\nmodel.addCons(Tarts >= 50)\n## Labor constraint\nmodel.addCons(Croissants + Muffins + Eclairs + Tarts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Number of Tarts: \", model.getVal(Tarts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of ingredient availability and minimum production requirements.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"Tarts\", \"range\": \"Tarts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $1.00, and per tart is $1.20. The bakery aims to maximize its daily profit from these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.60*Muffins + 1.00*Eclairs + 1.20*Tarts\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and sugar. It can use up to 150 pounds of flour and 100 pounds of sugar daily. Each croissant requires 0.1 pounds of flour and 0.05 pounds of sugar, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each eclair requires 0.3 pounds of flour and 0.2 pounds of sugar, and each tart requires 0.4 pounds of flour and 0.3 pounds of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs + 0.4*Tarts <= 150 (Flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.2*Eclairs + 0.3*Tarts <= 100 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 of each type of pastry daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50, Muffins >= 50, Eclairs >= 50, Tarts >= 50\n\n## Generate Constraint-3:\nThe bakery has a labor constraint, limiting the total number of pastries that can be produced daily to 500.\n// Croissants + Muffins + Eclairs + Tarts <= 500",
        "question": "A bakery produces four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the constraints of ingredient availability and minimum production requirements. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $1.00, and per tart is $1.20. The bakery has a limited amount of flour and sugar, being able to use up to 150 pounds of flour and 100 pounds of sugar daily. Each croissant requires 0.1 pounds of flour and 0.05 pounds of sugar, each muffin requires 0.2 pounds of flour and 0.1 pounds of sugar, each eclair requires 0.3 pounds of flour and 0.2 pounds of sugar, and each tart requires 0.4 pounds of flour and 0.3 pounds of sugar. The bakery must produce at least 50 of each type of pastry daily to meet the minimum order requirements from local cafes. Additionally, the bakery has a labor constraint, limiting the total number of pastries that can be produced daily to 500. Please help the bakery to maximize its daily profit from these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs\nTarts = model.addVar(vtype=\"INTEGER\", name=\"Tarts\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.60*Muffins + 1.00*Eclairs + 1.20*Tarts)\n\n# Add constraints\n## Flour and sugar constraints\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs + 0.4*Tarts <= 150) # Flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.2*Eclairs + 0.3*Tarts <= 100) # Sugar constraint\n## Minimum production requirements\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Eclairs >= 50)\nmodel.addCons(Tarts >= 50)\n## Labor constraint\nmodel.addCons(Croissants + Muffins + Eclairs + Tarts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Number of Tarts: \", model.getVal(Tarts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints.\n// Wheat + Rye + Sourdough + Whole_Grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Whole_Grain >= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The following table shows the flour requirements for each type of bread.\n\n| Bread Type     | Profit per Loaf | Flour Requirement per Loaf |\n|----------------|-----------------|----------------------------|\n| Wheat          | $2              | 0.5 kg                     |\n| Rye            | $3              | 0.7 kg                     |\n| Sourdough      | $4              | 0.6 kg                     |\n| Whole Grain    | $3.50           | 0.8 kg                     |\n\nThe bakery has a daily flour supply limit of 500 kg. The bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 300)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Whole_Grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(Whole_Grain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints.\n// Wheat + Rye + Sourdough + Whole_Grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Whole_Grain >= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery has a daily flour supply limit of 500 kg, with each loaf of wheat, rye, sourdough, and whole grain bread requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively. The bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints. Additionally, the bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 300)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Whole_Grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(Whole_Grain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively.\n// Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day.\n// Wheat + Rye + Sourdough + Brioche <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Brioche >= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand. The profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The following table shows the flour requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Flour per Loaf |\n|------------|-----------------|----------------|\n| Wheat      | $1.50           | 1 pound        |\n| Rye        | $1.75           | 1.5 pounds     |\n| Sourdough  | $2.00           | 1.25 pounds    |\n| Brioche    | $2.50           | 2 pounds       |\n\nThe bakery has a daily limit of 500 pounds of flour. The bakery can produce a maximum of 300 loaves of bread per day. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # quantity of brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Brioche <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Brioche >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively.\n// Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day.\n// Wheat + Rye + Sourdough + Brioche <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Brioche >= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand. The profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively. The bakery can produce a maximum of 300 loaves of bread per day. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # quantity of brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Brioche <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Brioche >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints.\n// {\"number of loaves of white bread\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheatBread\", \"range\": \"WholeWheatBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughBread\", \"range\": \"SourdoughBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds.\n// WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 500 loaves per day.\n// WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500\n\n## Generate Constraint-3:\nThe bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\n// WhiteBread + WholeWheatBread <= 400",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread       | Profit per Loaf |\n|---------------------|-----------------|\n| White Bread         | $2              |\n| Whole Wheat Bread   | $3              |\n| Rye Bread           | $2.50           |\n| Sourdough Bread     | $4              |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds. The bakery also has a maximum oven capacity of 500 loaves per day. Additionally, the bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of loaves of white bread\nWholeWheatBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatBread\", lb=0) # number of loaves of whole wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of rye bread\nSourdoughBread = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughBread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000)\n## The bakery has a maximum oven capacity of 500 loaves per day.\nmodel.addCons(WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500)\n## The bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\nmodel.addCons(WhiteBread + WholeWheatBread <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(WhiteBread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheatBread))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints.\n// {\"number of loaves of white bread\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheatBread\", \"range\": \"WholeWheatBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughBread\", \"range\": \"SourdoughBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds.\n// WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 500 loaves per day.\n// WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500\n\n## Generate Constraint-3:\nThe bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\n// WhiteBread + WholeWheatBread <= 400",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints. The profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery has a total of 1000 pounds of flour available daily, with each loaf of white bread requiring 1 pound of flour, whole wheat bread requiring 1.5 pounds, rye bread requiring 1.2 pounds, and sourdough bread requiring 2 pounds. The bakery also has a maximum oven capacity of 500 loaves per day. Additionally, the bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of loaves of white bread\nWholeWheatBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatBread\", lb=0) # number of loaves of whole wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of rye bread\nSourdoughBread = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughBread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000)\n## The bakery has a maximum oven capacity of 500 loaves per day.\nmodel.addCons(WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500)\n## The bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\nmodel.addCons(WhiteBread + WholeWheatBread <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(WhiteBread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheatBread))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. The cost of raw materials for one unit of product A is $50, for product B is $75, for product C is $100, and for product D is $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe warehouse space is limited to 5000 cubic feet. One unit of product A requires 5 cubic feet, product B requires 10 cubic feet, product C requires 15 cubic feet, and product D requires 20 cubic feet.\n// 5*A + 10*B + 15*C + 20*D <= 5000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit, labor hours required, raw material cost, and warehouse space required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours | Raw Material Cost | Warehouse Space |\n|---------|-----------------|-------------|-------------------|-----------------|\n| A       | $100            | 2 hours     | $50               | 5 cubic feet    |\n| B       | $150            | 3 hours     | $75               | 10 cubic feet   |\n| C       | $200            | 4 hours     | $100              | 15 cubic feet   |\n| D       | $250            | 5 hours     | $125              | 20 cubic feet   |\n\nThe company has a total of 1000 hours of labor available. The company has a budget of $50,000 for raw materials. The warehouse space is limited to 5000 cubic feet. \nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The warehouse space is limited to 5000 cubic feet.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. The cost of raw materials for one unit of product A is $50, for product B is $75, for product C is $100, and for product D is $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe warehouse space is limited to 5000 cubic feet. One unit of product A requires 5 cubic feet, product B requires 10 cubic feet, product C requires 15 cubic feet, and product D requires 20 cubic feet.\n// 5*A + 10*B + 15*C + 20*D <= 5000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\nThe company has a total of 1000 hours of labor available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours. The company has a budget of $50,000 for raw materials. The cost of raw materials for one unit of product A is $50, for product B is $75, for product C is $100, and for product D is $125. The warehouse space is limited to 5000 cubic feet. One unit of product A requires 5 cubic feet, product B requires 10 cubic feet, product C requires 15 cubic feet, and product D requires 20 cubic feet.\nPlease help the company to maximize the total profit while considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The warehouse space is limited to 5000 cubic feet.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs.\n// {\"daily production of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 5000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 5000\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 1000 loaves of each type of bread daily.\n// White >= 1000\n// WholeWheat >= 1000\n// Rye >= 1000\n// Sourdough >= 1000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\n// White + WholeWheat + Rye + Sourdough <= 3000",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs. The cost of producing one loaf of each type of bread is as follows:\n\n| Bread Type       | Production Cost per Loaf |\n|------------------|--------------------------|\n| White            | $0.50                    |\n| Whole Wheat      | $0.60                    |\n| Rye              | $0.70                    |\n| Sourdough        | $0.80                    |\n\nThe bakery has a daily production capacity of 5000 loaves. It also has a contract to supply at least 1000 loaves of each type of bread daily. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\n\nPlease help the bakery to minimize the total production cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough)\n\n# Add constraints\n## The bakery has a daily production capacity of 5000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 5000)\n## The bakery has a contract to supply at least 1000 loaves of each type of bread daily.\nmodel.addCons(White >= 1000)\nmodel.addCons(WholeWheat >= 1000)\nmodel.addCons(Rye >= 1000)\nmodel.addCons(Sourdough >= 1000)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of white bread: \", model.getVal(White))\n    print(\"Daily production of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production of rye bread: \", model.getVal(Rye))\n    print(\"Daily production of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs.\n// {\"daily production of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 5000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 5000\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 1000 loaves of each type of bread daily.\n// White >= 1000\n// WholeWheat >= 1000\n// Rye >= 1000\n// Sourdough >= 1000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\n// White + WholeWheat + Rye + Sourdough <= 3000",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs. The cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost. The bakery has a daily production capacity of 5000 loaves and a contract to supply at least 1000 loaves of each type of bread daily. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough)\n\n# Add constraints\n## The bakery has a daily production capacity of 5000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 5000)\n## The bakery has a contract to supply at least 1000 loaves of each type of bread daily.\nmodel.addCons(White >= 1000)\nmodel.addCons(WholeWheat >= 1000)\nmodel.addCons(Rye >= 1000)\nmodel.addCons(Sourdough >= 1000)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of white bread: \", model.getVal(White))\n    print(\"Daily production of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production of rye bread: \", model.getVal(Rye))\n    print(\"Daily production of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources. The cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n\n| Component | Production Cost per Unit |\n|-----------|--------------------------|\n| Resistors | $0.50                    |\n| Capacitors| $0.75                    |\n| Inductors | $1.00                    |\n| Diodes    | $0.60                    |\n\nThe total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week, and the demand for capacitors is at least 1500 units per week.\n\nPlease help the company determine the optimal number of units to produce for each component to minimize the total production cost while meeting the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component to produce\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources. The cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost. The total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week. The demand for capacitors is at least 1500 units per week. Please help the company determine the optimal number of units to produce for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component to produce\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven hours used\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\n// 0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The requirements for oven time and labor for each pastry type are given in the following Table.\n\n| Pastry Type | Profit per Unit | Oven Time per Unit | Labor Time per Unit |\n|-------------|-----------------|---------------------|---------------------|\n| Croissants  | $0.50           | 0.1 hours           | 0.2 hours           |\n| Muffins     | $0.75           | 0.2 hours           | 0.3 hours           |\n| Donuts      | $0.60           | 0.15 hours          | 0.25 hours          |\n\nThe bakery has a total of 10 hours of oven time and 8 hours of labor available daily. The bakery must also produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven hours used\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\n// 0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce.\n// {\"number of Cake A\": \"CA\", \"range\": \"0 <= CA <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B\": \"CB\", \"range\": \"0 <= CB <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C\": \"CC\", \"range\": \"0 <= CC <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D\": \"CD\", \"range\": \"0 <= CD <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*CA + 7*CB + 6*CC + 4*CD\n\n## Generate Constraint-1:\nThe total amount of flour available is 500 kg. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2.5 kg, and cake D requires 1 kg.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 500\n\n## Generate Constraint-2:\nThe total amount of sugar available is 300 kg. Each cake A requires 1 kg of sugar, cake B requires 1.5 kg, cake C requires 1 kg, and cake D requires 0.5 kg.\n// 1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300\n\n## Generate Constraint-3:\nThe total production time available is 400 hours. Each cake A requires 2 hours to produce, cake B requires 3 hours, cake C requires 2.5 hours, and cake D requires 1 hour.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 400",
        "question": "A bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce. The profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. The following table shows the requirements for each cake type:\n\n| Cake Type | Flour (kg) | Sugar (kg) | Production Time (hours) |\n|-----------|------------|------------|-------------------------|\n| A         | 2          | 1          | 2                       |\n| B         | 3          | 1.5        | 3                       |\n| C         | 2.5        | 1          | 2.5                     |\n| D         | 1          | 0.5        | 1                       |\n\nThe total amount of flour available is 500 kg, and the total amount of sugar available is 300 kg. The total production time available is 400 hours. The bakery has a constraint that the number of each cake type produced must be between 0 and 100. Please help the bakery determine the optimal number of each cake type to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each cake type to produce\nCA = model.addVar(vtype=\"INTEGER\", name=\"CA\", lb=0, ub=100) # number of Cake A\nCB = model.addVar(vtype=\"INTEGER\", name=\"CB\", lb=0, ub=100) # number of Cake B\nCC = model.addVar(vtype=\"INTEGER\", name=\"CC\", lb=0, ub=100) # number of Cake C\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0, ub=100) # number of Cake D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*CA + 7*CB + 6*CC + 4*CD)\n\n# Add constraints\n## The total amount of flour available is 500 kg.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 500)\n## The total amount of sugar available is 300 kg.\nmodel.addCons(1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300)\n## The total production time available is 400 hours.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(CA))\n    print(\"Number of Cake B: \", model.getVal(CB))\n    print(\"Number of Cake C: \", model.getVal(CC))\n    print(\"Number of Cake D: \", model.getVal(CD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce.\n// {\"number of Cake A\": \"CA\", \"range\": \"0 <= CA <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B\": \"CB\", \"range\": \"0 <= CB <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C\": \"CC\", \"range\": \"0 <= CC <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D\": \"CD\", \"range\": \"0 <= CD <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*CA + 7*CB + 6*CC + 4*CD\n\n## Generate Constraint-1:\nThe total amount of flour available is 500 kg. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2.5 kg, and cake D requires 1 kg.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 500\n\n## Generate Constraint-2:\nThe total amount of sugar available is 300 kg. Each cake A requires 1 kg of sugar, cake B requires 1.5 kg, cake C requires 1 kg, and cake D requires 0.5 kg.\n// 1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300\n\n## Generate Constraint-3:\nThe total production time available is 400 hours. Each cake A requires 2 hours to produce, cake B requires 3 hours, cake C requires 2.5 hours, and cake D requires 1 hour.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 400",
        "question": "A bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce. The profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. The total amount of flour available is 500 kg, with each cake A requiring 2 kg of flour, cake B requiring 3 kg, cake C requiring 2.5 kg, and cake D requiring 1 kg. The total amount of sugar available is 300 kg, with each cake A requiring 1 kg of sugar, cake B requiring 1.5 kg, cake C requiring 1 kg, and cake D requiring 0.5 kg. The total production time available is 400 hours, with each cake A requiring 2 hours to produce, cake B requiring 3 hours, cake C requiring 2.5 hours, and cake D requiring 1 hour. Please help the bakery determine the optimal number of each cake type to produce to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each cake type to produce\nCA = model.addVar(vtype=\"INTEGER\", name=\"CA\", lb=0, ub=100) # number of Cake A\nCB = model.addVar(vtype=\"INTEGER\", name=\"CB\", lb=0, ub=100) # number of Cake B\nCC = model.addVar(vtype=\"INTEGER\", name=\"CC\", lb=0, ub=100) # number of Cake C\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0, ub=100) # number of Cake D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*CA + 7*CB + 6*CC + 4*CD)\n\n# Add constraints\n## The total amount of flour available is 500 kg.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 500)\n## The total amount of sugar available is 300 kg.\nmodel.addCons(1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300)\n## The total production time available is 400 hours.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(CA))\n    print(\"Number of Cake B: \", model.getVal(CB))\n    print(\"Number of Cake C: \", model.getVal(CC))\n    print(\"Number of Cake D: \", model.getVal(CD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce.\n// {\"number of Pastry A\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry B\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry C\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry D\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each unit of Pastry A, B, C, and D requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each unit of Pastry A, B, C, and D requires 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively.\n// 0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each pastry. The maximum daily demand for Pastry A, B, C, and D is 80, 70, 90, and 60 units respectively.\n// P1 <= 80\n// P2 <= 70\n// P3 <= 90\n// P4 <= 60",
        "question": "A bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce. The profit per unit for each pastry and the required ingredients for each unit are given in the following Table.\n\n| Pastry | Profit per Unit | Flour Required (kg) | Sugar Required (kg) | Maximum Daily Demand |\n|--------|-----------------|---------------------|---------------------|----------------------|\n| A      | $2              | 0.5                 | 0.3                 | 80                   |\n| B      | $3              | 0.7                 | 0.2                 | 70                   |\n| C      | $2.5            | 0.6                 | 0.4                 | 90                   |\n| D      | $1.5            | 0.4                 | 0.5                 | 60                   |\n\nThe bakery has a total of 200 kg of flour and 150 kg of sugar available daily. The bakery wants to maximize its total daily profit. Please help the bakery determine the optimal number of each pastry to produce, considering the constraints on flour, sugar, and maximum daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # number of Pastry A\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=100) # number of Pastry B\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # number of Pastry C\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0, ub=100) # number of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150)\n## The bakery has a demand limit for each pastry.\nmodel.addCons(P1 <= 80)\nmodel.addCons(P2 <= 70)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(P1))\n    print(\"Number of Pastry B: \", model.getVal(P2))\n    print(\"Number of Pastry C: \", model.getVal(P3))\n    print(\"Number of Pastry D: \", model.getVal(P4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce.\n// {\"number of Pastry A\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry B\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry C\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry D\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each unit of Pastry A, B, C, and D requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each unit of Pastry A, B, C, and D requires 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively.\n// 0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each pastry. The maximum daily demand for Pastry A, B, C, and D is 80, 70, 90, and 60 units respectively.\n// P1 <= 80\n// P2 <= 70\n// P3 <= 90\n// P4 <= 60",
        "question": "A bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce. The profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit. The bakery has a total of 200 kg of flour available daily, with each unit of Pastry A, B, C, and D requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively. Additionally, the bakery has a total of 150 kg of sugar available daily, with each unit of Pastry A, B, C, and D requiring 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively. The bakery also has a demand limit for each pastry, with the maximum daily demand for Pastry A, B, C, and D being 80, 70, 90, and 60 units respectively. Please help the bakery determine the optimal number of each pastry to produce to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # number of Pastry A\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=100) # number of Pastry B\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # number of Pastry C\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0, ub=100) # number of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150)\n## The bakery has a demand limit for each pastry.\nmodel.addCons(P1 <= 80)\nmodel.addCons(P2 <= 70)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(P1))\n    print(\"Number of Pastry B: \", model.getVal(P2))\n    print(\"Number of Pastry C: \", model.getVal(P3))\n    print(\"Number of Pastry D: \", model.getVal(P4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"G\", \"range\": \"0 <= G <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has a total of 250 kg of flour available daily. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively.\n// 0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 150 loaves in total due to oven capacity.\n// W + R + S + G <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\n// R >= 20",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit, with the profit per loaf for wheat, rye, sourdough, and whole grain bread being $2, $3, $2.5, and $2.75 respectively. The bakery has a total of 250 kg of flour available daily, with each loaf of wheat, rye, sourdough, and whole grain bread requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively. The bakery can produce a maximum of 150 loaves in total due to oven capacity. Additionally, the bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf |\n|------------|-----------------|-------------------------|\n| Wheat      | $2              | 0.5 kg                  |\n| Rye        | $3              | 0.7 kg                  |\n| Sourdough  | $2.5            | 0.6 kg                  |\n| Whole Grain| $2.75           | 0.8 kg                  |\n\nPlease help the bakery determine the optimal daily production quantities of wheat (W), rye (R), sourdough (S), and whole grain (G) bread to maximize its daily profit, given the constraints on flour availability and oven capacity, and the requirement to produce at least 20 loaves of rye bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # quantity of sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 2.75*G)\n\n# Add constraints\n## The bakery has a total of 250 kg of flour available daily.\nmodel.addCons(0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250)\n## The bakery can produce a maximum of 150 loaves in total due to oven capacity.\nmodel.addCons(W + R + S + G <= 150)\n## The bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\nmodel.addCons(R >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Quantity of whole grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1303,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"G\", \"range\": \"0 <= G <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has a total of 250 kg of flour available daily. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively.\n// 0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 150 loaves in total due to oven capacity.\n// W + R + S + G <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\n// R >= 20",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit, where the profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively. The bakery has a total of 250 kg of flour available daily, with each loaf of wheat, rye, sourdough, and whole grain bread requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively. The bakery can produce a maximum of 150 loaves in total due to oven capacity. Additionally, the bakery must produce at least 20 loaves of rye bread to meet a contract obligation. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # quantity of sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 2.75*G)\n\n# Add constraints\n## The bakery has a total of 250 kg of flour available daily.\nmodel.addCons(0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250)\n## The bakery can produce a maximum of 150 loaves in total due to oven capacity.\nmodel.addCons(W + R + S + G <= 150)\n## The bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\nmodel.addCons(R >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Quantity of whole grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (products A-D). The company needs to decide how many units of each product to produce to optimize its profits.\n// {\"number of units of Product A\": \"P_A\", \"range\": \"0 <= P_A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"P_B\", \"range\": \"0 <= P_B <= 150\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"P_C\", \"range\": \"0 <= P_C <= 200\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"P_D\", \"range\": \"0 <= P_D <= 120\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*P_A + 15*P_B + 20*P_C + 12*P_D\n\n## Generate Constraint-1:\nThe company has a total of 400 labor hours available. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, Product C requires 4 hours, and Product D requires 2 hours.\n// 2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials. The cost of raw materials per unit for products A-D is $5, $8, $10, and $6 respectively.\n// 5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units, and for Product D is at most 80 units.\n// P_A >= 20\n// P_D <= 80",
        "question": "A manufacturing company produces four types of products (products A-D) and needs to decide how many units of each product to produce to optimize its profits. The profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company has a total of 400 labor hours available, with each unit of Product A requiring 2 hours, Product B requiring 3 hours, Product C requiring 4 hours, and Product D requiring 2 hours. The company also has a budget of $5000 for raw materials, with the cost of raw materials per unit for products A-D being $5, $8, $10, and $6 respectively. The market demand for Product A is at least 20 units, and for Product D is at most 80 units. The company wants to maximize the total profit.\n\nPlease help the company determine the optimal number of units to produce for each product, considering the constraints on labor hours, raw material budget, and market demand.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Cost per Unit |\n|---------|-----------------|----------------------|---------------------------|\n| A       | $10             | 2 hours              | $5                        |\n| B       | $15             | 3 hours              | $8                        |\n| C       | $20             | 4 hours              | $10                       |\n| D       | $12             | 2 hours              | $6                        |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP_A = model.addVar(vtype=\"INTEGER\", name=\"P_A\", lb=0, ub=100) # number of units of Product A\nP_B = model.addVar(vtype=\"INTEGER\", name=\"P_B\", lb=0, ub=150) # number of units of Product B\nP_C = model.addVar(vtype=\"INTEGER\", name=\"P_C\", lb=0, ub=200) # number of units of Product C\nP_D = model.addVar(vtype=\"INTEGER\", name=\"P_D\", lb=0, ub=120) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*P_A + 15*P_B + 20*P_C + 12*P_D)\n\n# Add constraints\n## The company has a total of 400 labor hours available.\nmodel.addCons(2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400)\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000)\n## The market demand for Product A is at least 20 units, and for Product D is at most 80 units.\nmodel.addCons(P_A >= 20)\nmodel.addCons(P_D <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(P_A))\n    print(\"Number of units of Product B: \", model.getVal(P_B))\n    print(\"Number of units of Product C: \", model.getVal(P_C))\n    print(\"Number of units of Product D: \", model.getVal(P_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1386,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (products A-D). The company needs to decide how many units of each product to produce to optimize its profits.\n// {\"number of units of Product A\": \"P_A\", \"range\": \"0 <= P_A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"P_B\", \"range\": \"0 <= P_B <= 150\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"P_C\", \"range\": \"0 <= P_C <= 200\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"P_D\", \"range\": \"0 <= P_D <= 120\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*P_A + 15*P_B + 20*P_C + 12*P_D\n\n## Generate Constraint-1:\nThe company has a total of 400 labor hours available. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, Product C requires 4 hours, and Product D requires 2 hours.\n// 2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials. The cost of raw materials per unit for products A-D is $5, $8, $10, and $6 respectively.\n// 5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units, and for Product D is at most 80 units.\n// P_A >= 20\n// P_D <= 80",
        "question": "A manufacturing company produces four types of products (products A-D) and needs to decide how many units of each product to produce to optimize its profits. The profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company has a total of 400 labor hours available, with producing one unit of Product A requiring 2 hours, Product B requiring 3 hours, Product C requiring 4 hours, and Product D requiring 2 hours. The company also has a budget of $5000 for raw materials, with the cost of raw materials per unit for products A-D being $5, $8, $10, and $6 respectively. The market demand for Product A is at least 20 units, and for Product D is at most 80 units. The company wants to maximize the total profit. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP_A = model.addVar(vtype=\"INTEGER\", name=\"P_A\", lb=0, ub=100) # number of units of Product A\nP_B = model.addVar(vtype=\"INTEGER\", name=\"P_B\", lb=0, ub=150) # number of units of Product B\nP_C = model.addVar(vtype=\"INTEGER\", name=\"P_C\", lb=0, ub=200) # number of units of Product C\nP_D = model.addVar(vtype=\"INTEGER\", name=\"P_D\", lb=0, ub=120) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*P_A + 15*P_B + 20*P_C + 12*P_D)\n\n# Add constraints\n## The company has a total of 400 labor hours available.\nmodel.addCons(2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400)\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000)\n## The market demand for Product A is at least 20 units, and for Product D is at most 80 units.\nmodel.addCons(P_A >= 20)\nmodel.addCons(P_D <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(P_A))\n    print(\"Number of units of Product B: \", model.getVal(P_B))\n    print(\"Number of units of Product C: \", model.getVal(P_C))\n    print(\"Number of units of Product D: \", model.getVal(P_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake. The maximum number of cake 1 that can be sold is 80, cake 2 is 60, cake 3 is 70, and cake 4 is 90.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery also has a demand limit for each cake, with the maximum number of cake 1 that can be sold being 80, cake 2 being 60, cake 3 being 70, and cake 4 being 90.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit, given the constraints on flour, sugar, and demand.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Max Demand |\n|-----------|-----------------|---------------------|---------------------|------------|\n| 1         | $5              | 1                   | 0.5                 | 80         |\n| 2         | $7              | 2                   | 0.8                 | 60         |\n| 3         | $6              | 1.5                 | 0.6                 | 70         |\n| 4         | $4              | 1                   | 0.5                 | 90         |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1479,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake. The maximum number of cake 1 that can be sold is 80, cake 2 is 60, cake 3 is 70, and cake 4 is 90.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery also has a demand limit for each cake, with the maximum number of cake 1 that can be sold being 80, cake 2 being 60, cake 3 being 70, and cake 4 being 90. Please help the bakery determine the optimal number of each type of cake to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for cakes 1-4 is 1 kg, 2 kg, 1.5 kg, and 1 kg respectively.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for cakes 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg respectively.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 60, 70, and 50 respectively.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with the amount of flour required for cakes 1-4 being 1 kg, 2 kg, 1.5 kg, and 1 kg respectively. Additionally, the bakery has a total of 150 kg of sugar available daily, with the amount of sugar required for cakes 1-4 being 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg respectively. The bakery also has a demand limit for each cake type, with the maximum daily demand for cakes 1-4 being 80, 60, 70, and 50 respectively.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit, given the constraints on flour, sugar, and demand.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Maximum Daily Demand |\n|-----------|-----------------|---------------------|---------------------|----------------------|\n| 1         | $5              | 1                   | 0.5                 | 80                   |\n| 2         | $7              | 2                   | 0.7                 | 60                   |\n| 3         | $6              | 1.5                 | 0.6                 | 70                   |\n| 4         | $4              | 1                   | 0.4                 | 50                   |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1471,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for cakes 1-4 is 1 kg, 2 kg, 1.5 kg, and 1 kg respectively.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for cakes 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg respectively.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 60, 70, and 50 respectively.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with the amount of flour required for cakes 1-4 being 1 kg, 2 kg, 1.5 kg, and 1 kg respectively. Additionally, the bakery has a total of 150 kg of sugar available daily, with the amount of sugar required for cakes 1-4 being 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg respectively. The bakery also has a demand limit for each cake type, with the maximum daily demand for cakes 1-4 being 80, 60, 70, and 50 respectively. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours.\n// 2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units.\n// 4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet.\n// 3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce. The profit per cake and the resource requirements for each cake are given in the following Table.\n\n| Cake Type | Profit per Cake | Labor Hours | Ingredient Units | Storage Cubic Feet |\n|-----------|-----------------|-------------|------------------|---------------------|\n| Cake 1    | $5              | 2 hours     | 4 units          | 3 cubic feet        |\n| Cake 2    | $7              | 3 hours     | 5 units          | 4 cubic feet        |\n| Cake 3    | $6              | 2.5 hours   | 4.5 units        | 3.5 cubic feet      |\n| Cake 4    | $4              | 1.5 hours   | 3 units          | 2 cubic feet        |\n\nThe bakery has a total of 100 hours of labor available daily. The total available ingredients are 180 units. The total storage capacity is 120 cubic feet. \nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180)\n## The bakery has a storage capacity limit.\nmodel.addCons(3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours.\n// 2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units.\n// 4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet.\n// 3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce. Each cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit. The bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours. The bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units. The bakery also has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180)\n## The bakery has a storage capacity limit.\nmodel.addCons(3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its daily profit. Each type of bread requires a specific amount of flour and has a different profit per unit.\n// {\"quantity of Bread 1 produced\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for bread 1-4 is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*B1 + 3*B2 + 2.5*B3 + 1.5*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 500 kg of flour available daily. Each unit of bread 1-4 requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*B1 + 0.7*B2 + 0.6*B3 + 0.4*B4 <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of bread: 80 units for Bread 1, 70 units for Bread 2, 90 units for Bread 3, and 60 units for Bread 4.\n// B1 <= 80\n// B2 <= 70\n// B3 <= 90\n// B4 <= 60\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 units of each type of bread are produced to meet the minimum order requirements from regular customers.\n// B1 >= 20\n// B2 >= 20\n// B3 >= 20\n// B4 >= 20",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its daily profit. Each type of bread requires a specific amount of flour and has a different profit per unit. The details of each bread type are given in the following Table.\n\n| Bread Type | Profit per Unit | Flour Required per Unit (kg) |\n|------------|-----------------|------------------------------|\n| Bread 1    | $2              | 0.5                          |\n| Bread 2    | $3              | 0.7                          |\n| Bread 3    | $2.5            | 0.6                          |\n| Bread 4    | $1.5            | 0.4                          |\n\nThe bakery has a total of 500 kg of flour available daily. The bakery has a daily demand limit for each type of bread: 80 units for Bread 1, 70 units for Bread 2, 90 units for Bread 3, and 60 units for Bread 4. The bakery must ensure that at least 20 units of each type of bread are produced to meet the minimum order requirements from regular customers.\n\nPlease help the bakery to maximize its total daily profit by determining the optimal quantity of each type of bread to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # quantity of Bread 1 produced\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # quantity of Bread 2 produced\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # quantity of Bread 3 produced\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B1 + 3*B2 + 2.5*B3 + 1.5*B4)\n\n# Add constraints\n## The bakery has a total of 500 kg of flour available daily.\nmodel.addCons(0.5*B1 + 0.7*B2 + 0.6*B3 + 0.4*B4 <= 500)\n## The bakery has a daily demand limit for each type of bread.\nmodel.addCons(B1 <= 80)\nmodel.addCons(B2 <= 70)\nmodel.addCons(B3 <= 90)\nmodel.addCons(B4 <= 60)\n## The bakery must ensure that at least 20 units of each type of bread are produced.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 20)\nmodel.addCons(B3 >= 20)\nmodel.addCons(B4 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(B1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(B2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(B3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its daily profit. Each type of bread requires a specific amount of flour and has a different profit per unit.\n// {\"quantity of Bread 1 produced\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for bread 1-4 is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*B1 + 3*B2 + 2.5*B3 + 1.5*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 500 kg of flour available daily. Each unit of bread 1-4 requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*B1 + 0.7*B2 + 0.6*B3 + 0.4*B4 <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each type of bread: 80 units for Bread 1, 70 units for Bread 2, 90 units for Bread 3, and 60 units for Bread 4.\n// B1 <= 80\n// B2 <= 70\n// B3 <= 90\n// B4 <= 60\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 units of each type of bread are produced to meet the minimum order requirements from regular customers.\n// B1 >= 20\n// B2 >= 20\n// B3 >= 20\n// B4 >= 20",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its daily profit. Each type of bread requires a specific amount of flour and has a different profit per unit. The profit per unit for bread 1-4 is $2, $3, $2.5, and $1.5 respectively. The bakery has a total of 500 kg of flour available daily. Each unit of bread 1-4 requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively. The bakery has a daily demand limit for each type of bread: 80 units for Bread 1, 70 units for Bread 2, 90 units for Bread 3, and 60 units for Bread 4. The bakery must ensure that at least 20 units of each type of bread are produced to meet the minimum order requirements from regular customers. \nPlease help the bakery to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # quantity of Bread 1 produced\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # quantity of Bread 2 produced\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # quantity of Bread 3 produced\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B1 + 3*B2 + 2.5*B3 + 1.5*B4)\n\n# Add constraints\n## The bakery has a total of 500 kg of flour available daily.\nmodel.addCons(0.5*B1 + 0.7*B2 + 0.6*B3 + 0.4*B4 <= 500)\n## The bakery has a daily demand limit for each type of bread.\nmodel.addCons(B1 <= 80)\nmodel.addCons(B2 <= 70)\nmodel.addCons(B3 <= 90)\nmodel.addCons(B4 <= 60)\n## The bakery must ensure that at least 20 units of each type of bread are produced.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 20)\nmodel.addCons(B3 >= 20)\nmodel.addCons(B4 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(B1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(B2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(B3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 758,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery also has a demand limit for each cake type, with the maximum demand for cakes 1-4 being 80, 70, 60, and 90 respectively.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit, given the constraints on flour, sugar, and demand.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Maximum Demand |\n|-----------|-----------------|---------------------|---------------------|----------------|\n| 1         | $5              | 1                   | 0.5                 | 80             |\n| 2         | $7              | 2                   | 0.7                 | 70             |\n| 3         | $6              | 1.5                 | 0.6                 | 60             |\n| 4         | $4              | 1                   | 0.5                 | 90             |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1469,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\nThe bakery also has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\nAdditionally, the bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limit on the oven usage time, which is 8 hours daily. Each loaf of bread requires 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively.\n// (5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively.\n// Q1 <= 1500\n// Q2 <= 1200\n// Q3 <= 1000\n// Q4 <= 800",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, with the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $2, $3, $2.5, and $4 respectively. The bakery has a total of 1000 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit on the oven usage time, which is 8 hours daily, with each loaf of bread requiring 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively. The bakery also has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively.\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to maximize its daily profit.\n\n| Bread Type     | Profit per Loaf | Flour Required per Loaf | Oven Time per Loaf | Daily Demand Limit |\n|----------------|-----------------|-------------------------|--------------------|--------------------|\n| Whole Wheat    | $2              | 0.5 kg                  | 5 minutes          | 1500               |\n| Rye            | $3              | 0.4 kg                  | 7 minutes          | 1200               |\n| Sourdough      | $2.5            | 0.3 kg                  | 6 minutes          | 1000               |\n| Brioche        | $4              | 0.6 kg                  | 10 minutes         | 800                |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of Whole Wheat bread\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of Rye bread\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of Sourdough bread\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4)\n\n# Add constraints\n## The bakery has a total of 1000 kg of flour available daily.\nmodel.addCons(0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000)\n## The bakery has a limit on the oven usage time, which is 8 hours daily.\nmodel.addCons((5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8)\n## The bakery has a demand constraint where the daily demand for each type of bread should not exceed certain limits.\nmodel.addCons(Q1 <= 1500)\nmodel.addCons(Q2 <= 1200)\nmodel.addCons(Q3 <= 1000)\nmodel.addCons(Q4 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(Q1))\n    print(\"Quantity of Rye bread: \", model.getVal(Q2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(Q3))\n    print(\"Quantity of Brioche bread: \", model.getVal(Q4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1595,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limit on the oven usage time, which is 8 hours daily. Each loaf of bread requires 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively.\n// (5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively.\n// Q1 <= 1500\n// Q2 <= 1200\n// Q3 <= 1000\n// Q4 <= 800",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 1000 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit on the oven usage time, which is 8 hours daily, and each loaf of bread requires 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively. The bakery also has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively. Please help the bakery determine the optimal daily production quantities of each type of bread to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of Whole Wheat bread\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of Rye bread\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of Sourdough bread\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4)\n\n# Add constraints\n## The bakery has a total of 1000 kg of flour available daily.\nmodel.addCons(0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000)\n## The bakery has a limit on the oven usage time, which is 8 hours daily.\nmodel.addCons((5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8)\n## The bakery has a demand constraint where the daily demand for each type of bread should not exceed certain limits.\nmodel.addCons(Q1 <= 1500)\nmodel.addCons(Q2 <= 1200)\nmodel.addCons(Q3 <= 1000)\nmodel.addCons(Q4 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(Q1))\n    print(\"Quantity of Rye bread: \", model.getVal(Q2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(Q3))\n    print(\"Quantity of Brioche bread: \", model.getVal(Q4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 0.5 kg.\n// C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.4 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 hours of labor available daily. Each cake 1 requires 1 hour of labor, cake 2 requires 1.5 hours, cake 3 requires 2 hours, and cake 4 requires 1 hour.\n// C1 + 1.5*C2 + 2*C3 + C4 <= 100",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 0.5 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.4 kg. Additionally, the bakery has a total of 100 hours of labor available daily, with each cake 1 requiring 1 hour of labor, cake 2 requiring 1.5 hours, cake 3 requiring 2 hours, and cake 4 requiring 1 hour.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit, given the constraints on flour, sugar, and labor.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Labor Required (hours) |\n|-----------|-----------------|---------------------|---------------------|------------------------|\n| 1         | $5              | 1                   | 0.5                 | 1                      |\n| 2         | $7              | 2                   | 0.7                 | 1.5                    |\n| 3         | $6              | 1.5                 | 0.6                 | 2                      |\n| 4         | $4              | 0.5                 | 0.4                 | 1                      |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(C1 + 1.5*C2 + 2*C3 + C4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1580,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 0.5 kg.\n// C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.4 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 hours of labor available daily. Each cake 1 requires 1 hour of labor, cake 2 requires 1.5 hours, cake 3 requires 2 hours, and cake 4 requires 1 hour.\n// C1 + 1.5*C2 + 2*C3 + C4 <= 100",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 0.5 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.4 kg. Additionally, the bakery has a total of 100 hours of labor available daily, with each cake 1 requiring 1 hour of labor, cake 2 requiring 1.5 hours, cake 3 requiring 2 hours, and cake 4 requiring 1 hour. The number of each type of cake produced must be between 0 and 100.\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(C1 + 1.5*C2 + 2*C3 + C4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily.\n// {\"number of Whole Wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively.\n// Objective Function: Maximize: 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100\n\n## Generate Constraint-2:\nThe bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20 units of any type of bread are produced daily.\n// Whole_Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20",
        "question": "A bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily. The bakery wants to maximize its daily revenue. The selling price and ingredient cost for each type of bread and pastry are given in the following Table.\n\n| Product       | Selling Price | Ingredient Cost | Labor Time |\n|---------------|---------------|-----------------|------------|\n| Whole Wheat   | $3            | $1              | 1 hour     |\n| Rye           | $4            | $2              | 2 hours    |\n| Sourdough     | $5            | $3              | 3 hours    |\n| Croissant     | $2            | $1              | 1 hour     |\n\nThe bakery has a total of 100 hours of labor available daily. The bakery has a budget of $200 for daily ingredient purchases. The bakery wants to ensure that at least 20 units of any type of bread are produced daily. Please help the bakery to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough breads\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of Croissants\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100)\n## The bakery has a budget of $200 for daily ingredient purchases.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200)\n## The bakery wants to ensure that at least 20 units of any type of bread are produced daily.\nmodel.addCons(Whole_Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye breads: \", model.getVal(Rye))\n    print(\"Number of Sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily.\n// {\"number of Whole Wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively.\n// Objective Function: Maximize: 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100\n\n## Generate Constraint-2:\nThe bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20 units of any type of bread are produced daily.\n// Whole_Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20",
        "question": "A bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily. The bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively. The bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively. The bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively. The bakery wants to ensure that at least 20 units of any type of bread are produced daily.\nPlease help the bakery determine the optimal number of each product to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough breads\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of Croissants\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100)\n## The bakery has a budget of $200 for daily ingredient purchases.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200)\n## The bakery wants to ensure that at least 20 units of any type of bread are produced daily.\nmodel.addCons(Whole_Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye breads: \", model.getVal(Rye))\n    print(\"Number of Sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 80 hours of labor available daily. Each whole wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Whole_Wheat + 1.5*Rye <= 80\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 breads.\n// Whole_Wheat + Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Requirement (kg) | Labor Hours Required |\n|----------------|------------------|------------------------|----------------------|\n| Whole Wheat    | $2               | 0.5                    | 1                    |\n| Rye            | $3               | 0.4                    | 1.5                  |\n\nThe bakery has 100 kg of flour available daily. The bakery has 80 hours of labor available daily. The bakery has a minimum daily production requirement of 50 breads. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 80 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 1.5*Rye <= 80)\n## The bakery has a minimum daily production requirement of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 80 hours of labor available daily. Each whole wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Whole_Wheat + 1.5*Rye <= 80\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 breads.\n// Whole_Wheat + Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has 100 kg of flour available daily. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 80 hours of labor available daily. Each whole wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor. The bakery has a minimum daily production requirement of 50 breads. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 80 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 1.5*Rye <= 80)\n## The bakery has a minimum daily production requirement of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat breads\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg.\n// 0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each wheat bread requires 0.2 hours of labor, each rye bread requires 0.3 hours, and each sourdough bread requires 0.4 hours.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 breads.\n// Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4. The bakery has 200 kg of flour available daily, with each wheat bread requiring 0.5 kg of flour, each rye bread requiring 0.4 kg, and each sourdough bread requiring 0.6 kg. Additionally, the bakery has 100 hours of labor available daily, with each wheat bread requiring 0.2 hours of labor, each rye bread requiring 0.3 hours, and each sourdough bread requiring 0.4 hours. The bakery also has a minimum daily demand of 100 breads.\n\nPlease help the bakery to maximize the total daily profit.\n\n| Type of Bread | Profit per Bread | Flour Required (kg) | Labor Hours Required |\n|---------------|------------------|---------------------|----------------------|\n| Wheat         | $2               | 0.5                 | 0.2                  |\n| Rye           | $3               | 0.4                 | 0.3                  |\n| Sourdough     | $4               | 0.6                 | 0.4                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads\nSourdough_Bread = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Bread\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100)\n## The bakery has a minimum daily demand of 100 breads.\nmodel.addCons(Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads: \", model.getVal(Rye_Bread))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat breads\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg.\n// 0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each wheat bread requires 0.2 hours of labor, each rye bread requires 0.3 hours, and each sourdough bread requires 0.4 hours.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 breads.\n// Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4. The bakery has 200 kg of flour available daily, with each wheat bread requiring 0.5 kg of flour, each rye bread requiring 0.4 kg, and each sourdough bread requiring 0.6 kg. The bakery also has 100 hours of labor available daily, with each wheat bread requiring 0.2 hours of labor, each rye bread requiring 0.3 hours, and each sourdough bread requiring 0.4 hours. Additionally, the bakery has a minimum daily demand of 100 breads. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads\nSourdough_Bread = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Bread\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100)\n## The bakery has a minimum daily demand of 100 breads.\nmodel.addCons(Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads: \", model.getVal(Rye_Bread))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor.\n// {\"daily production quantity of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of multigrain bread\": \"Multigrain_Bread\", \"range\": \"Multigrain_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat bread requires 0.2 kg of flour, rye bread requires 0.25 kg, sourdough bread requires 0.3 kg, and multigrain bread requires 0.35 kg.\n// 0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily yeast supply limit of 50 kg. Each loaf of wheat bread requires 0.01 kg of yeast, rye bread requires 0.015 kg, sourdough bread requires 0.02 kg, and multigrain bread requires 0.025 kg.\n// 0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily labor limit of 40 hours. Each loaf of wheat bread requires 0.05 hours of labor, rye bread requires 0.06 hours, sourdough bread requires 0.07 hours, and multigrain bread requires 0.08 hours.\n// 0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $2.5            |\n| Sourdough     | $3              |\n| Multigrain    | $3.5            |\n\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat bread requires 0.2 kg of flour, rye bread requires 0.25 kg, sourdough bread requires 0.3 kg, and multigrain bread requires 0.35 kg. The bakery also has a daily yeast supply limit of 50 kg. Each loaf of wheat bread requires 0.01 kg of yeast, rye bread requires 0.015 kg, sourdough bread requires 0.02 kg, and multigrain bread requires 0.025 kg. Additionally, the bakery has a daily labor limit of 40 hours. Each loaf of wheat bread requires 0.05 hours of labor, rye bread requires 0.06 hours, sourdough bread requires 0.07 hours, and multigrain bread requires 0.08 hours.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Bread\", lb=0) # daily production quantity of wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # daily production quantity of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # daily production quantity of sourdough bread\nMultigrain_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Bread\", lb=0) # daily production quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500)\n## The bakery has a daily yeast supply limit of 50 kg.\nmodel.addCons(0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50)\n## The bakery has a daily labor limit of 40 hours.\nmodel.addCons(0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Daily production quantity of multigrain bread: \", model.getVal(Multigrain_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1314,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor.\n// {\"daily production quantity of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of multigrain bread\": \"Multigrain_Bread\", \"range\": \"Multigrain_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat bread requires 0.2 kg of flour, rye bread requires 0.25 kg, sourdough bread requires 0.3 kg, and multigrain bread requires 0.35 kg.\n// 0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily yeast supply limit of 50 kg. Each loaf of wheat bread requires 0.01 kg of yeast, rye bread requires 0.015 kg, sourdough bread requires 0.02 kg, and multigrain bread requires 0.025 kg.\n// 0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily labor limit of 40 hours. Each loaf of wheat bread requires 0.05 hours of labor, rye bread requires 0.06 hours, sourdough bread requires 0.07 hours, and multigrain bread requires 0.08 hours.\n// 0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery has a daily flour supply limit of 500 kg, with each loaf of wheat bread requiring 0.2 kg of flour, rye bread requiring 0.25 kg, sourdough bread requiring 0.3 kg, and multigrain bread requiring 0.35 kg. The bakery also has a daily yeast supply limit of 50 kg, with each loaf of wheat bread requiring 0.01 kg of yeast, rye bread requiring 0.015 kg, sourdough bread requiring 0.02 kg, and multigrain bread requiring 0.025 kg. Additionally, the bakery has a daily labor limit of 40 hours, with each loaf of wheat bread requiring 0.05 hours of labor, rye bread requiring 0.06 hours, sourdough bread requiring 0.07 hours, and multigrain bread requiring 0.08 hours.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Bread\", lb=0) # daily production quantity of wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # daily production quantity of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # daily production quantity of sourdough bread\nMultigrain_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Bread\", lb=0) # daily production quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500)\n## The bakery has a daily yeast supply limit of 50 kg.\nmodel.addCons(0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50)\n## The bakery has a daily labor limit of 40 hours.\nmodel.addCons(0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Daily production quantity of multigrain bread: \", model.getVal(Multigrain_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits.\n// {\"daily production quantity of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 500 hours of labor available per day. Each loaf of white bread requires 0.1 hours of labor, whole wheat bread requires 0.2 hours, rye bread requires 0.3 hours, and sourdough bread requires 0.4 hours.\n// 0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $1000 for raw materials. The cost of raw materials for each loaf of white bread is $0.50, for whole wheat bread is $0.75, for rye bread is $1.00, and for sourdough bread is $1.25.\n// 0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of bread in total each day.\n// White + Whole_Wheat + Rye + Sourdough >= 500",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits. The profit per loaf and the labor and raw material costs for each type of bread are given in the following Table.\n\n| Bread Type       | Profit per Loaf | Labor per Loaf | Raw Material Cost per Loaf |\n|------------------|-----------------|----------------|----------------------------|\n| White            | $1.50           | 0.1 hours      | $0.50                      |\n| Whole Wheat      | $2.00           | 0.2 hours      | $0.75                      |\n| Rye              | $2.50           | 0.3 hours      | $1.00                      |\n| Sourdough        | $3.00           | 0.4 hours      | $1.25                      |\n\nThe bakery has a total of 500 hours of labor available per day and a daily budget of $1000 for raw materials. The bakery must produce at least 500 loaves of bread in total each day. \nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production quantity of white bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a total of 500 hours of labor available per day.\nmodel.addCons(0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500)\n## The bakery has a daily budget of $1000 for raw materials.\nmodel.addCons(0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000)\n## The bakery must produce at least 500 loaves of bread in total each day.\nmodel.addCons(White + Whole_Wheat + Rye + Sourdough >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of white bread: \", model.getVal(White))\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits.\n// {\"daily production quantity of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 500 hours of labor available per day. Each loaf of white bread requires 0.1 hours of labor, whole wheat bread requires 0.2 hours, rye bread requires 0.3 hours, and sourdough bread requires 0.4 hours.\n// 0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $1000 for raw materials. The cost of raw materials for each loaf of white bread is $0.50, for whole wheat bread is $0.75, for rye bread is $1.00, and for sourdough bread is $1.25.\n// 0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of bread in total each day.\n// White + Whole_Wheat + Rye + Sourdough >= 500",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales. The bakery has a total of 500 hours of labor available per day, with each loaf of white bread requiring 0.1 hours of labor, whole wheat bread requiring 0.2 hours, rye bread requiring 0.3 hours, and sourdough bread requiring 0.4 hours. The bakery also has a daily budget of $1000 for raw materials, with the cost of raw materials for each loaf of white bread being $0.50, for whole wheat bread $0.75, for rye bread $1.00, and for sourdough bread $1.25. Additionally, the bakery must produce at least 500 loaves of bread in total each day. Please help the bakery determine the optimal daily production quantity for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production quantity of white bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a total of 500 hours of labor available per day.\nmodel.addCons(0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500)\n## The bakery has a daily budget of $1000 for raw materials.\nmodel.addCons(0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000)\n## The bakery must produce at least 500 loaves of bread in total each day.\nmodel.addCons(White + Whole_Wheat + Rye + Sourdough >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of white bread: \", model.getVal(White))\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit.\n// {\"number of white bread loaves\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of whole wheat bread loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds.\n// 0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints.\n// White_Bread + Whole_Wheat + Rye + Sourdough <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation.\n// Whole_Wheat >= 500",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| White Bread      | $1.50           |\n| Whole Wheat Bread| $2.00           |\n| Rye Bread        | $1.75           |\n| Sourdough Bread  | $2.50           |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds. The bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints. Additionally, the bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of white bread loaves\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of whole wheat bread loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000)\n## The bakery can produce a maximum of 2000 loaves daily.\nmodel.addCons(White_Bread + Whole_Wheat + Rye + Sourdough <= 2000)\n## The bakery must produce at least 500 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white bread loaves: \", model.getVal(White_Bread))\n    print(\"Number of whole wheat bread loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit.\n// {\"number of white bread loaves\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of whole wheat bread loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds.\n// 0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints.\n// White_Bread + Whole_Wheat + Rye + Sourdough <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation.\n// Whole_Wheat >= 500",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds. The bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints. The bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of white bread loaves\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of whole wheat bread loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000)\n## The bakery can produce a maximum of 2000 loaves daily.\nmodel.addCons(White_Bread + Whole_Wheat + Rye + Sourdough <= 2000)\n## The bakery must produce at least 500 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white bread loaves: \", model.getVal(White_Bread))\n    print(\"Number of whole wheat bread loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WWB + 2.5*RB + 3*SDB\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds.\n// 1.5*WWB + 1.2*RB + 1.8*SDB <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 loaves per day. The bakery can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread.\n// WWB <= 300\n// RB <= 200\n// SDB <= 200\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours.\n// 0.5*WWB + 0.4*RB + 0.6*SDB <= 400",
        "question": "A bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for each type of bread is as follows: whole wheat bread at $2, rye bread at $2.5, and sourdough bread at $3. The bakery aims to maximize the total daily profit.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf | Time Required per Loaf |\n|-------------------|-----------------|--------------------------|-------------------------|\n| Whole Wheat Bread | $2              | 1.5 pounds               | 0.5 hours               |\n| Rye Bread         | $2.5            | 1.2 pounds               | 0.4 hours               |\n| Sourdough Bread   | $3              | 1.8 pounds               | 0.6 hours               |\n\nThe bakery has a total of 1000 pounds of flour available daily. The bakery has a maximum oven capacity of 600 loaves per day, with a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread. Additionally, the bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours.\n\nPlease help the bakery determine the optimal daily production quantity for each type of bread to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWWB = model.addVar(vtype=\"CONTINUOUS\", name=\"WWB\", lb=0) # daily production quantity of whole wheat bread\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # daily production quantity of rye bread\nSDB = model.addVar(vtype=\"CONTINUOUS\", name=\"SDB\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.5*RB + 3*SDB)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WWB + 1.2*RB + 1.8*SDB <= 1000)\n## The bakery has a maximum oven capacity of 600 loaves per day.\nmodel.addCons(WWB <= 300)\nmodel.addCons(RB <= 200)\nmodel.addCons(SDB <= 200)\n## The bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.6*SDB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WWB))\n    print(\"Daily production quantity of rye bread: \", model.getVal(RB))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(SDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WWB + 2.5*RB + 3*SDB\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds.\n// 1.5*WWB + 1.2*RB + 1.8*SDB <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 loaves per day. The bakery can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread.\n// WWB <= 300\n// RB <= 200\n// SDB <= 200\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours.\n// 0.5*WWB + 0.4*RB + 0.6*SDB <= 400",
        "question": "A bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds. The bakery has a maximum oven capacity of 600 loaves per day and can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread. The bakery also has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours. Please help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWWB = model.addVar(vtype=\"CONTINUOUS\", name=\"WWB\", lb=0) # daily production quantity of whole wheat bread\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # daily production quantity of rye bread\nSDB = model.addVar(vtype=\"CONTINUOUS\", name=\"SDB\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.5*RB + 3*SDB)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WWB + 1.2*RB + 1.8*SDB <= 1000)\n## The bakery has a maximum oven capacity of 600 loaves per day.\nmodel.addCons(WWB <= 300)\nmodel.addCons(RB <= 200)\nmodel.addCons(SDB <= 200)\n## The bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.6*SDB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WWB))\n    print(\"Daily production quantity of rye bread: \", model.getVal(RB))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(SDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours.\n// 0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// WholeWheat + Rye + Sourdough + Baguette <= 500",
        "question": "A bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $1.20           |\n| Rye              | $1.50           |\n| Sourdough        | $2.00           |\n| Baguette         | $1.00           |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds. The bakery also has a daily labor limit of 8 hours, with each loaf of whole wheat taking 0.02 hours to make, rye taking 0.01 hours, sourdough taking 0.03 hours, and baguette taking 0.01 hours. Additionally, the bakery has a storage capacity limit of 500 loaves.\n\nPlease help the bakery to maximize the total daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # daily production quantity of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Baguette <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours.\n// 0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// WholeWheat + Rye + Sourdough + Baguette <= 500",
        "question": "A bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds. The bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours. The bakery also has a storage capacity limit of 500 loaves. Please help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # daily production quantity of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Baguette <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in hours\": \"Production_Hours\", \"range\": \"Production_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from selling these pastries.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each croissant requires 50 grams of flour, each muffin requires 80 grams, and each donut requires 60 grams. The daily supply of flour is 10 kilograms.\n// 50*Croissants + 80*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar. Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 25 grams. The daily supply of sugar is 4 kilograms.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 4000",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The following table summarizes the production requirements for each pastry:\n\n| Pastry    | Production Time per Unit | Flour Required (grams) | Sugar Required (grams) |\n|-----------|--------------------------|------------------------|------------------------|\n| Croissant | 0.05 hours               | 50                     | 20                     |\n| Muffin    | 0.10 hours               | 80                     | 30                     |\n| Donut     | 0.08 hours               | 60                     | 25                     |\n\nThe bakery has a daily production capacity of 8 hours. The daily supply of flour is 10 kilograms, and the daily supply of sugar is 4 kilograms. Please help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Production_Hours\", lb=0) # daily production capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours)\nmodel.addCons(Production_Hours <= 8)\n## The bakery has a limited supply of flour.\nmodel.addCons(50*Croissants + 80*Muffins + 60*Donuts <= 10000)\n## The bakery has a limited supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in hours\": \"Production_Hours\", \"range\": \"Production_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from selling these pastries.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each croissant requires 50 grams of flour, each muffin requires 80 grams, and each donut requires 60 grams. The daily supply of flour is 10 kilograms.\n// 50*Croissants + 80*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar. Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 25 grams. The daily supply of sugar is 4 kilograms.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 4000",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has a daily production capacity of 8 hours, with each croissant requiring 0.05 hours to produce, each muffin requiring 0.10 hours, and each donut requiring 0.08 hours. The bakery has a limited supply of flour, with each croissant requiring 50 grams, each muffin requiring 80 grams, and each donut requiring 60 grams, and a daily supply of 10 kilograms. Additionally, the bakery has a limited supply of sugar, with each croissant requiring 20 grams, each muffin requiring 30 grams, and each donut requiring 25 grams, and a daily supply of 4 kilograms. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Production_Hours\", lb=0) # daily production capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours)\nmodel.addCons(Production_Hours <= 8)\n## The bakery has a limited supply of flour.\nmodel.addCons(50*Croissants + 80*Muffins + 60*Donuts <= 10000)\n## The bakery has a limited supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of workers required\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\n// 50*Croissants + 75*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-3:\nThe bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\n// Workers <= 5\n// Croissants + Muffins + Donuts <= 100*Workers",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Labor Time (minutes) |\n|----------|-----------------|------------------------|----------------------|\n| Croissants | $0.50          | 50                     | 10                   |\n| Muffins   | $0.75          | 75                     | 15                   |\n| Donuts    | $0.60          | 60                     | 12                   |\n\nThe bakery has 10 kg of flour available daily. Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 8 hours of labor available daily. Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\n\nPlease help the bakery to maximize the total daily profit while adhering to the constraints on flour and labor, and the limit on the number of workers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers required\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\nmodel.addCons(50*Croissants + 75*Muffins + 60*Donuts <= 10000)\n## Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\nmodel.addCons(Workers <= 5)\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Workers)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of workers required: \", model.getVal(Workers))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of workers required\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\n// 50*Croissants + 75*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-3:\nThe bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\n// Workers <= 5\n// Croissants + Muffins + Donuts <= 100*Workers",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily. Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily. The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers required\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\nmodel.addCons(50*Croissants + 75*Muffins + 60*Donuts <= 10000)\n## Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\nmodel.addCons(Workers <= 5)\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Workers)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of workers required: \", model.getVal(Workers))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 100 kg available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 50 kg available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery has a daily production capacity of 500 pastries. The bakery has a limited amount of flour, with 100 kg available daily, and each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. Additionally, the bakery has a limited amount of sugar, with 50 kg available daily, and each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg.\n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Eclairs <= 500)\n## The bakery has a limited amount of flour, with 100 kg available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100)\n## The bakery has a limited amount of sugar, with 50 kg available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 100 kg available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 50 kg available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery has a daily production capacity of 500 pastries. The bakery has a limited amount of flour, with 100 kg available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. The bakery also has a limited amount of sugar, with 50 kg available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Eclairs <= 500)\n## The bakery has a limited amount of flour, with 100 kg available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100)\n## The bakery has a limited amount of sugar, with 50 kg available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of cookies to produce\": \"Cookies\", \"range\": \"Cookies >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\n// 50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\n// 30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 150 pastries.\n// Croissants + Muffins + Cupcakes + Cookies <= 150",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per pastry is as follows: $0.50 per croissant, $0.75 per muffin, $1.00 per cupcake, and $0.40 per cookie. The bakery aims to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Sugar Required (grams) |\n|----------|-----------------|------------------------|------------------------|\n| Croissant| $0.50           | 50                     | 30                     |\n| Muffin   | $0.75           | 80                     | 40                     |\n| Cupcake  | $1.00           | 100                    | 50                     |\n| Cookie   | $0.40           | 30                     | 20                     |\n\nThe bakery has 10 kilograms of flour and 6 kilograms of sugar available daily. The bakery also has a daily production capacity of 150 pastries. Please help the bakery to determine the optimal number of each type of pastry to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nCookies = model.addVar(vtype=\"INTEGER\", name=\"Cookies\", lb=0) # number of cookies to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\nmodel.addCons(50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000)\n## Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\nmodel.addCons(30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000)\n## The bakery has a daily production capacity of 150 pastries.\nmodel.addCons(Croissants + Muffins + Cupcakes + Cookies <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of cookies to produce: \", model.getVal(Cookies))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of cookies to produce\": \"Cookies\", \"range\": \"Cookies >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\n// 50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\n// 30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 150 pastries.\n// Croissants + Muffins + Cupcakes + Cookies <= 150",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily. Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily. The bakery has a daily production capacity of 150 pastries. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nCookies = model.addVar(vtype=\"INTEGER\", name=\"Cookies\", lb=0) # number of cookies to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\nmodel.addCons(50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000)\n## Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\nmodel.addCons(30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000)\n## The bakery has a daily production capacity of 150 pastries.\nmodel.addCons(Croissants + Muffins + Cupcakes + Cookies <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of cookies to produce: \", model.getVal(Cookies))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven usage time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 100 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a total of 50 kg of yeast available daily. Each loaf of wheat bread requires 0.1 kg of yeast, rye bread requires 0.2 kg, and sourdough bread requires 0.3 kg.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50\n\n## Generate Constraint-3:\nThe bakery's oven can operate for a maximum of 12 hours daily. Each loaf of wheat bread requires 0.1 hours of oven time, rye bread requires 0.2 hours, and sourdough bread requires 0.3 hours.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The following table shows the requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Yeast Requirement (kg) | Oven Time (hours) |\n|------------|-----------------|------------------------|------------------------|-------------------|\n| Wheat      | $2              | 0.5                    | 0.1                    | 0.1               |\n| Rye        | $3              | 0.6                    | 0.2                    | 0.2               |\n| Sourdough  | $4              | 0.7                    | 0.3                    | 0.3               |\n\nThe bakery has a total of 100 kg of flour and 50 kg of yeast available daily. The bakery's oven can operate for a maximum of 12 hours daily. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven usage time in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a total of 100 kg of flour available daily.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100)\n## The bakery has a total of 50 kg of yeast available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50)\n## The bakery's oven can operate for a maximum of 12 hours daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven usage time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 100 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a total of 50 kg of yeast available daily. Each loaf of wheat bread requires 0.1 kg of yeast, rye bread requires 0.2 kg, and sourdough bread requires 0.3 kg.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50\n\n## Generate Constraint-3:\nThe bakery's oven can operate for a maximum of 12 hours daily. Each loaf of wheat bread requires 0.1 hours of oven time, rye bread requires 0.2 hours, and sourdough bread requires 0.3 hours.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery has a total of 100 kg of flour available daily, with each loaf of wheat bread requiring 0.5 kg of flour, rye bread requiring 0.6 kg, and sourdough bread requiring 0.7 kg. Additionally, the bakery has a total of 50 kg of yeast available daily, with each loaf of wheat bread requiring 0.1 kg of yeast, rye bread requiring 0.2 kg, and sourdough bread requiring 0.3 kg. The bakery's oven can operate for a maximum of 12 hours daily, with each loaf of wheat bread requiring 0.1 hours of oven time, rye bread requiring 0.2 hours, and sourdough bread requiring 0.3 hours. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven usage time in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a total of 100 kg of flour available daily.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100)\n## The bakery has a total of 50 kg of yeast available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50)\n## The bakery's oven can operate for a maximum of 12 hours daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost to produce each croissant is $0.50, and the selling price is $1.50.\nThe cost to produce each muffin is $0.40, and the selling price is $1.20.\nThe cost to produce each doughnut is $0.60, and the selling price is $1.80.\nThe cost to produce each eclair is $0.70, and the selling price is $2.00.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n// Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 total pastries due to oven capacity.\n// Croissants + Muffins + Doughnuts + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\n// 0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 of each type of pastry to meet customer expectations.\n// Croissants >= 50, Muffins >= 50, Doughnuts >= 50, Eclairs >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The cost to produce and the selling price for each pastry are given in the following Table.\n\n| Pastry   | Cost to Produce | Selling Price |\n|----------|-----------------|---------------|\n| Croissants | $0.50          | $1.50         |\n| Muffins   | $0.40          | $1.20         |\n| Doughnuts | $0.60          | $1.80         |\n| Eclairs   | $0.70          | $2.00         |\n\nThe bakery has a daily limit of 500 total pastries due to oven capacity. The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce. The bakery must produce at least 50 of each type of pastry to meet customer expectations.\n\nPlease help the bakery to maximize the daily profit, which is calculated as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n## Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nTotal_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\nTotal_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 500 total pastries due to oven capacity.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 500)\n## The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\nmodel.addCons(0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40)\n## The bakery must produce at least 50 of each type of pastry to meet customer expectations.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Doughnuts >= 50)\nmodel.addCons(Eclairs >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost to produce each croissant is $0.50, and the selling price is $1.50.\nThe cost to produce each muffin is $0.40, and the selling price is $1.20.\nThe cost to produce each doughnut is $0.60, and the selling price is $1.80.\nThe cost to produce each eclair is $0.70, and the selling price is $2.00.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n// Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 total pastries due to oven capacity.\n// Croissants + Muffins + Doughnuts + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\n// 0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 of each type of pastry to meet customer expectations.\n// Croissants >= 50, Muffins >= 50, Doughnuts >= 50, Eclairs >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The cost to produce each croissant is $0.50, and the selling price is $1.50. The cost to produce each muffin is $0.40, and the selling price is $1.20. The cost to produce each doughnut is $0.60, and the selling price is $1.80. The cost to produce each eclair is $0.70, and the selling price is $2.00. The bakery wants to maximize the daily profit.\n\nThe bakery has a daily limit of 500 total pastries due to oven capacity. The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce. The bakery must produce at least 50 of each type of pastry to meet customer expectations.\n\nPlease help the bakery determine the optimal number of each type of pastry to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n## Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nTotal_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\nTotal_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 500 total pastries due to oven capacity.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 500)\n## The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\nmodel.addCons(0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40)\n## The bakery must produce at least 50 of each type of pastry to meet customer expectations.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Doughnuts >= 50)\nmodel.addCons(Eclairs >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n// Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50\n\n## Generate Constraint-3:\nThe bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The selling price and cost for each pastry are given in the following Table.\n\n| Pastry    | Selling Price | Cost |\n|-----------|---------------|------|\n| Croissants| 2$            | 1$   |\n| Muffins   | 3$            | 1.5$ |\n| Cupcakes  | 4$            | 2$   |\n| Doughnuts | 2.5$          | 1.2$ |\n\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg. The bakery also has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg. Additionally, the bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of each type of pastry to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n## Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts) - (1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50)\n## The bakery has 8 hours of labor available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n// Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50\n\n## Generate Constraint-3:\nThe bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery has 100 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, each cupcake requiring 0.3 kg, and each doughnut requiring 0.15 kg. The bakery also has 50 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, each cupcake requiring 0.15 kg, and each doughnut requiring 0.08 kg. Additionally, the bakery has 8 hours of labor available daily, with each croissant requiring 0.05 hours of labor, each muffin requiring 0.1 hours, each cupcake requiring 0.15 hours, and each doughnut requiring 0.08 hours.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of each type of pastry to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n## Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts) - (1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50)\n## The bakery has 8 hours of labor available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the availability of baking time.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"baking time in minutes per day\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.40. The bakery aims to maximize daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.40*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 5 minutes of baking time, each muffin requires 10 minutes, and each donut requires 15 minutes. The bakery has a total of 600 minutes of baking time available per day.\n// 5*Croissants + 10*Muffins + 15*Donuts <= 600\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day.\n// Croissants <= 100\n// Muffins <= 80\n// Donuts <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 muffins per day to meet a contract requirement.\n// Muffins >= 20",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the availability of baking time. The profit and cost per pastry are as follows:\n\n| Pastry   | Profit per Pastry | Cost per Pastry | Baking Time per Pastry (minutes) |\n|----------|-------------------|-----------------|---------------------------------|\n| Croissant| $0.50             | $0.20           | 5                               |\n| Muffin   | $0.75             | $0.30           | 10                              |\n| Donut    | $1.00             | $0.40           | 15                              |\n\nThe bakery has a total of 600 minutes of baking time available per day. The bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day. The bakery must also produce at least 20 muffins per day to meet a contract requirement.\n\nPlease help the bakery to maximize its daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.40*Donuts\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.00*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.40*Donuts))\n\n# Add constraints\n## Each croissant requires 5 minutes of baking time, each muffin requires 10 minutes, and each donut requires 15 minutes. The bakery has a total of 600 minutes of baking time available per day.\nmodel.addCons(5*Croissants + 10*Muffins + 15*Donuts <= 600)\n## The bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day.\nmodel.addCons(Croissants <= 100)\nmodel.addCons(Muffins <= 80)\nmodel.addCons(Donuts <= 50)\n## The bakery must produce at least 20 muffins per day to meet a contract requirement.\nmodel.addCons(Muffins >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the availability of baking time.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"baking time in minutes per day\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.40. The bakery aims to maximize daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.40*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 5 minutes of baking time, each muffin requires 10 minutes, and each donut requires 15 minutes. The bakery has a total of 600 minutes of baking time available per day.\n// 5*Croissants + 10*Muffins + 15*Donuts <= 600\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day.\n// Croissants <= 100\n// Muffins <= 80\n// Donuts <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 muffins per day to meet a contract requirement.\n// Muffins >= 20",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the availability of baking time. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.40. Each croissant requires 5 minutes of baking time, each muffin requires 10 minutes, and each donut requires 15 minutes. The bakery has a total of 600 minutes of baking time available per day. The bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day. The bakery must also produce at least 20 muffins per day to meet a contract requirement. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.40*Donuts\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.00*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.40*Donuts))\n\n# Add constraints\n## Each croissant requires 5 minutes of baking time, each muffin requires 10 minutes, and each donut requires 15 minutes. The bakery has a total of 600 minutes of baking time available per day.\nmodel.addCons(5*Croissants + 10*Muffins + 15*Donuts <= 600)\n## The bakery has a limited supply of ingredients that can produce at most 100 croissants, 80 muffins, and 50 donuts per day.\nmodel.addCons(Croissants <= 100)\nmodel.addCons(Muffins <= 80)\nmodel.addCons(Donuts <= 50)\n## The bakery must produce at least 20 muffins per day to meet a contract requirement.\nmodel.addCons(Muffins >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day. Each loaf of Bread 1-4 requires 1, 1.2, 1.1, and 1.3 oven-hours, respectively.\n// x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\n// x1 >= 20",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor and oven requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf | Oven-Hours per Loaf |\n|------------|-----------------|----------------------|---------------------|\n| Bread 1    | $1.50           | 0.5                  | 1                   |\n| Bread 2    | $2.00           | 0.7                  | 1.2                 |\n| Bread 3    | $1.75           | 0.6                  | 1.1                 |\n| Bread 4    | $1.80           | 0.8                  | 1.3                 |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day. The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day.\nmodel.addCons(x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\nmodel.addCons(x1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1144,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day. Each loaf of Bread 1-4 requires 1, 1.2, 1.1, and 1.3 oven-hours, respectively.\n// x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\n// x1 >= 20",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery also has a limited oven capacity, which can bake a maximum of 150 loaves per day, with each loaf of Bread 1-4 requiring 1, 1.2, 1.1, and 1.3 oven-hours, respectively. Additionally, the bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation. Please help the bakery maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day.\nmodel.addCons(x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\nmodel.addCons(x1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 779,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1) to maximize profit while meeting customer demand and resource constraints.\n// {\"amount of Bread 1 produced\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"amount of Bread 2 produced\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"amount of Bread 3 produced\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"amount of Pastry 1 produced\": \"p1\", \"range\": \"0 <= p1\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread 1, Bread 2, Bread 3, and Pastry 1 is $3, $4, $5, and $2, respectively. The bakery aims to maximize the total daily profit from the production of these items.\n// Maximize: 3*b1 + 4*b2 + 5*b3 + 2*p1\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each unit of Bread 1, Bread 2, Bread 3, and Pastry 1 requires 1 kg, 2 kg, 3 kg, and 0.5 kg of flour, respectively.\n// b1 + 2*b2 + 3*b3 + 0.5*p1 <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2 to meet contractual obligations.\n// b1 >= 10\n// b2 >= 15\n\n## Generate Constraint-3:\nThe bakery has a demand limit for Bread 3 and Pastry 1, which should not exceed 20 units and 30 units, respectively, to maintain product freshness.\n// b3 <= 20\n// p1 <= 30",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1) to maximize profit while meeting customer demand and resource constraints. The profit per unit of each item is as follows: Bread 1 ($3), Bread 2 ($4), Bread 3 ($5), and Pastry 1 ($2). The bakery has a limited daily supply of 100 kg of flour. Each unit of Bread 1, Bread 2, Bread 3, and Pastry 1 requires 1 kg, 2 kg, 3 kg, and 0.5 kg of flour, respectively.\n\n| Product    | Profit per Unit | Flour Required per Unit |\n|------------|-----------------|-------------------------|\n| Bread 1    | $3              | 1 kg                    |\n| Bread 2    | $4              | 2 kg                    |\n| Bread 3    | $5              | 3 kg                    |\n| Pastry 1   | $2              | 0.5 kg                  |\n\nThe bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2 to meet contractual obligations. Additionally, the bakery has a demand limit for Bread 3 and Pastry 1, which should not exceed 20 units and 30 units, respectively, to maintain product freshness.\n\nPlease help the bakery to maximize the total daily profit from the production of these items while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry produced\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # amount of Bread 1 produced\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # amount of Bread 2 produced\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # amount of Bread 3 produced\np1 = model.addVar(vtype=\"INTEGER\", name=\"p1\", lb=0) # amount of Pastry 1 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 2*p1)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(b1 + 2*b2 + 3*b3 + 0.5*p1 <= 100)\n## The bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2\nmodel.addCons(b1 >= 10)\nmodel.addCons(b2 >= 15)\n## The bakery has a demand limit for Bread 3 and Pastry 1\nmodel.addCons(b3 <= 20)\nmodel.addCons(p1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 produced: \", model.getVal(b1))\n    print(\"Amount of Bread 2 produced: \", model.getVal(b2))\n    print(\"Amount of Bread 3 produced: \", model.getVal(b3))\n    print(\"Amount of Pastry 1 produced: \", model.getVal(p1))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1) to maximize profit while meeting customer demand and resource constraints.\n// {\"amount of Bread 1 produced\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"amount of Bread 2 produced\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"amount of Bread 3 produced\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"amount of Pastry 1 produced\": \"p1\", \"range\": \"0 <= p1\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread 1, Bread 2, Bread 3, and Pastry 1 is $3, $4, $5, and $2, respectively. The bakery aims to maximize the total daily profit from the production of these items.\n// Maximize: 3*b1 + 4*b2 + 5*b3 + 2*p1\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each unit of Bread 1, Bread 2, Bread 3, and Pastry 1 requires 1 kg, 2 kg, 3 kg, and 0.5 kg of flour, respectively.\n// b1 + 2*b2 + 3*b3 + 0.5*p1 <= 100\n\n## Generate Constraint-2:\nThe bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2 to meet contractual obligations.\n// b1 >= 10\n// b2 >= 15\n\n## Generate Constraint-3:\nThe bakery has a demand limit for Bread 3 and Pastry 1, which should not exceed 20 units and 30 units, respectively, to maintain product freshness.\n// b3 <= 20\n// p1 <= 30",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry (Pastry 1) to maximize profit while meeting customer demand and resource constraints. The profit per unit of Bread 1, Bread 2, Bread 3, and Pastry 1 is $3, $4, $5, and $2, respectively. The bakery has a limited daily supply of flour, which is 100 kg. Each unit of Bread 1, Bread 2, Bread 3, and Pastry 1 requires 1 kg, 2 kg, 3 kg, and 0.5 kg of flour, respectively. The bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2 to meet contractual obligations. Additionally, the bakery has a demand limit for Bread 3 and Pastry 1, which should not exceed 20 units and 30 units, respectively, to maintain product freshness. Please help the bakery to maximize the total daily profit from the production of these items.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry produced\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # amount of Bread 1 produced\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # amount of Bread 2 produced\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # amount of Bread 3 produced\np1 = model.addVar(vtype=\"INTEGER\", name=\"p1\", lb=0) # amount of Pastry 1 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 2*p1)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(b1 + 2*b2 + 3*b3 + 0.5*p1 <= 100)\n## The bakery must produce at least 10 units of Bread 1 and 15 units of Bread 2\nmodel.addCons(b1 >= 10)\nmodel.addCons(b2 >= 15)\n## The bakery has a demand limit for Bread 3 and Pastry 1\nmodel.addCons(b3 <= 20)\nmodel.addCons(p1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 produced: \", model.getVal(b1))\n    print(\"Amount of Bread 2 produced: \", model.getVal(b2))\n    print(\"Amount of Bread 3 produced: \", model.getVal(b3))\n    print(\"Amount of Pastry 1 produced: \", model.getVal(p1))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\n// x1 >= 20",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor hours required per loaf for each type of bread.\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf |\n|------------|-----------------|----------------------|\n| Bread 1    | $1.50           | 0.5                  |\n| Bread 2    | $2.00           | 0.7                  |\n| Bread 3    | $1.75           | 0.6                  |\n| Bread 4    | $1.80           | 0.8                  |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily. The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(x1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\n// x1 >= 20",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily. Additionally, the bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation. Please help the bakery to maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(x1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 695,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B.\n\n| Material/Product | Cost per Unit | Required for Product A | Required for Product B |\n|------------------|---------------|-------------------------|-------------------------|\n| Material X       | $10           | 2 units                 | 1 unit                  |\n| Material Y       | $15           | 1 unit                  | 3 units                 |\n\nThe total amount of Material X available for purchase is limited to 300 units. The total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units.\n\nPlease help the manufacturer to minimize the total cost of raw materials and production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The total amount of Material X available for purchase is limited to 300 units, and the total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units. The manufacturer aims to minimize the total cost of raw materials and production. Please help the manufacturer decide how much of each product to produce and how much of each raw material to purchase to meet the market demand for both products while minimizing the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs.\n// {\"amount of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product A\": \"MatX_A\", \"range\": \"MatX_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product B\": \"MatX_B\", \"range\": \"MatX_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product A\": \"MatY_A\", \"range\": \"MatY_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product B\": \"MatY_B\", \"range\": \"MatY_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The manufacturer aims to minimize the total production and material costs.\n// Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n// Production_Cost = 30*Prod_A + 40*Prod_B\n// Objective Function: Minimize: Material_Cost + Production_Cost\n\n## Generate Constraint-1:\nThe total amount of Material X available is 200 units.\n// MatX_A + MatX_B <= 200\n\n## Generate Constraint-2:\nThe total amount of Material Y available is 300 units.\n// MatY_A + MatY_B <= 300\n\n## Generate Constraint-3:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y.\n// MatX_A == 2*Prod_A\n// MatY_A == 3*Prod_A",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs. The cost of Material X is $10 per unit, the cost of Material Y is $15 per unit, the production cost for Product A is $30 per unit, and for Product B is $40 per unit. The following table summarizes the material requirements for each product:\n\n| Product | Material X Required | Material Y Required |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 3 units             |\n| B       | -                   | -                   |\n\nThe total amount of Material X available is 200 units, and the total amount of Material Y available is 300 units. Each unit of Product A requires 2 units of Material X and 3 units of Material Y. The manufacturer aims to minimize the total production and material costs. Please help the manufacturer determine the optimal production quantities for Product A and Product B, and the allocation of Materials X and Y to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and the amount of each material used\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # amount of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # amount of Product B produced\nMatX_A = model.addVar(vtype=\"INTEGER\", name=\"MatX_A\", lb=0) # amount of Material X used for Product A\nMatX_B = model.addVar(vtype=\"INTEGER\", name=\"MatX_B\", lb=0) # amount of Material X used for Product B\nMatY_A = model.addVar(vtype=\"INTEGER\", name=\"MatY_A\", lb=0) # amount of Material Y used for Product A\nMatY_B = model.addVar(vtype=\"INTEGER\", name=\"MatY_B\", lb=0) # amount of Material Y used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n## Production_Cost = 30*Prod_A + 40*Prod_B\nMaterial_Cost = 10*MatX_A + 10*MatX_B + 15*MatY_A + 15*MatY_B\nProduction_Cost = 30*Prod_A + 40*Prod_B\nmodel.addCons(obj == Material_Cost + Production_Cost)\n\n# Add constraints\n## The total amount of Material X available is 200 units.\nmodel.addCons(MatX_A + MatX_B <= 200)\n## The total amount of Material Y available is 300 units.\nmodel.addCons(MatY_A + MatY_B <= 300)\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\nmodel.addCons(MatX_A == 2*Prod_A)\nmodel.addCons(MatY_A == 3*Prod_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(Prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(Prod_B))\n    print(\"Amount of Material X used for Product A: \", model.getVal(MatX_A))\n    print(\"Amount of Material X used for Product B: \", model.getVal(MatX_B))\n    print(\"Amount of Material Y used for Product A: \", model.getVal(MatY_A))\n    print(\"Amount of Material Y used for Product B: \", model.getVal(MatY_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1231,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs.\n// {\"amount of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product A\": \"MatX_A\", \"range\": \"MatX_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product B\": \"MatX_B\", \"range\": \"MatX_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product A\": \"MatY_A\", \"range\": \"MatY_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product B\": \"MatY_B\", \"range\": \"MatY_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The manufacturer aims to minimize the total production and material costs.\n// Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n// Production_Cost = 30*Prod_A + 40*Prod_B\n// Objective Function: Minimize: Material_Cost + Production_Cost\n\n## Generate Constraint-1:\nThe total amount of Material X available is 200 units.\n// MatX_A + MatX_B <= 200\n\n## Generate Constraint-2:\nThe total amount of Material Y available is 300 units.\n// MatY_A + MatY_B <= 300\n\n## Generate Constraint-3:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y.\n// MatX_A == 2*Prod_A\n// MatY_A == 3*Prod_A",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs. The cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The total amount of Material X available is 200 units, and the total amount of Material Y available is 300 units. Each unit of Product A requires 2 units of Material X and 3 units of Material Y. Please help the manufacturer to minimize the total production and material costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and the amount of each material used\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # amount of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # amount of Product B produced\nMatX_A = model.addVar(vtype=\"INTEGER\", name=\"MatX_A\", lb=0) # amount of Material X used for Product A\nMatX_B = model.addVar(vtype=\"INTEGER\", name=\"MatX_B\", lb=0) # amount of Material X used for Product B\nMatY_A = model.addVar(vtype=\"INTEGER\", name=\"MatY_A\", lb=0) # amount of Material Y used for Product A\nMatY_B = model.addVar(vtype=\"INTEGER\", name=\"MatY_B\", lb=0) # amount of Material Y used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n## Production_Cost = 30*Prod_A + 40*Prod_B\nMaterial_Cost = 10*MatX_A + 10*MatX_B + 15*MatY_A + 15*MatY_B\nProduction_Cost = 30*Prod_A + 40*Prod_B\nmodel.addCons(obj == Material_Cost + Production_Cost)\n\n# Add constraints\n## The total amount of Material X available is 200 units.\nmodel.addCons(MatX_A + MatX_B <= 200)\n## The total amount of Material Y available is 300 units.\nmodel.addCons(MatY_A + MatY_B <= 300)\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\nmodel.addCons(MatX_A == 2*Prod_A)\nmodel.addCons(MatY_A == 3*Prod_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(Prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(Prod_B))\n    print(\"Amount of Material X used for Product A: \", model.getVal(MatX_A))\n    print(\"Amount of Material X used for Product B: \", model.getVal(MatX_B))\n    print(\"Amount of Material Y used for Product A: \", model.getVal(MatY_A))\n    print(\"Amount of Material Y used for Product B: \", model.getVal(MatY_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of Product A produced daily\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"A_time\", \"range\": \"A_time >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"B_time\", \"range\": \"B_time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and for Product B is $70. The company aims to maximize its daily profit from the sales of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production time available on the machines is 8 hours per day. Producing one unit of Product A requires 0.5 hours, and one unit of Product B requires 0.4 hours.\n// A_time = 0.5 * A_units\n// B_time = 0.4 * B_units\n// A_time + B_time <= 8\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\n// A_units >= 10\n// B_units >= 12\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A_units >= 2 * B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand. The profit from selling one unit of Product A is $50, and for Product B is $70. The following table summarizes the production requirements for each product:\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 0.5 hours                |\n| B       | $70             | 0.4 hours                |\n\nThe total production time available on the machines is 8 hours per day. The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day. The company has a policy to produce at least twice as many units of Product A as Product B.\n\nPlease help the company to maximize its daily profit from the sales of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced daily\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nA_time = model.addVar(vtype=\"CONTINUOUS\", name=\"A_time\", lb=0) # number of hours of machine time used for Product A\nB_time = model.addVar(vtype=\"CONTINUOUS\", name=\"B_time\", lb=0) # number of hours of machine time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production time available on the machines is 8 hours per day.\nmodel.addCons(A_time == 0.5 * A_units)\nmodel.addCons(B_time == 0.4 * B_units)\nmodel.addCons(A_time + B_time <= 8)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\nmodel.addCons(A_units >= 10)\nmodel.addCons(B_units >= 12)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A_units >= 2 * B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B_units))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of Product A produced daily\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used for Product A\": \"A_time\", \"range\": \"A_time >= 0\", \"type\": \"real\"}\n// {\"number of hours of machine time used for Product B\": \"B_time\", \"range\": \"B_time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and for Product B is $70. The company aims to maximize its daily profit from the sales of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production time available on the machines is 8 hours per day. Producing one unit of Product A requires 0.5 hours, and one unit of Product B requires 0.4 hours.\n// A_time = 0.5 * A_units\n// B_time = 0.4 * B_units\n// A_time + B_time <= 8\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\n// A_units >= 10\n// B_units >= 12\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of Product A as Product B.\n// A_units >= 2 * B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available production capacity and market demand. The profit from selling one unit of Product A is $50, and for Product B is $70. The total production time available on the machines is 8 hours per day. Producing one unit of Product A requires 0.5 hours, and one unit of Product B requires 0.4 hours. The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day. The company has a policy to produce at least twice as many units of Product A as Product B.\nPlease help the company to maximize its daily profit from the sales of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced daily\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced daily\n## The number of hours of machine time used for each product\nA_time = model.addVar(vtype=\"CONTINUOUS\", name=\"A_time\", lb=0) # number of hours of machine time used for Product A\nB_time = model.addVar(vtype=\"CONTINUOUS\", name=\"B_time\", lb=0) # number of hours of machine time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production time available on the machines is 8 hours per day.\nmodel.addCons(A_time == 0.5 * A_units)\nmodel.addCons(B_time == 0.4 * B_units)\nmodel.addCons(A_time + B_time <= 8)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 12 units per day.\nmodel.addCons(A_units >= 10)\nmodel.addCons(B_units >= 12)\n## The company has a policy to produce at least twice as many units of Product A as Product B.\nmodel.addCons(A_units >= 2 * B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B_units))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide the production quantities of each product and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"production quantity of Product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 1\": \"dist_A1\", \"range\": \"dist_A1 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 2\": \"dist_A2\", \"range\": \"dist_A2 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 3\": \"dist_A3\", \"range\": \"dist_A3 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 1\": \"dist_B1\", \"range\": \"dist_B1 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 2\": \"dist_B2\", \"range\": \"dist_B2 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 3\": \"dist_B3\", \"range\": \"dist_B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The distribution cost to Market 1 is $5 per unit, to Market 2 is $6 per unit, and to Market 3 is $7 per unit. The company aims to minimize the total production and distribution costs.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Distribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\n// Objective Function: Minimize: Production_Cost + Distribution_Cost\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nThe distribution of each product to each market should meet the market demand: Market 1 requires 50 units of each product, Market 2 requires 60 units of each product, and Market 3 requires 40 units of each product.\n// dist_A1 + dist_B1 >= 50\n// dist_A2 + dist_B2 >= 60\n// dist_A3 + dist_B3 >= 40\n\n## Generate Constraint-3:\nThe distribution quantities must not exceed the production quantities for each product.\n// dist_A1 + dist_A2 + dist_A3 <= prod_A\n// dist_B1 + dist_B2 + dist_B3 <= prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide the production quantities of each product and the distribution of these products to three different markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A is $10, and Product B is $15. The distribution cost to Market 1 is $5 per unit, to Market 2 is $6 per unit, and to Market 3 is $7 per unit. The company aims to minimize the total production and distribution costs.\n\n| Product | Production Cost | Distribution Cost to Market 1 | Distribution Cost to Market 2 | Distribution Cost to Market 3 |\n|---------|-----------------|--------------------------------|--------------------------------|--------------------------------|\n| A       | 10$             | 5$                             | 6$                             | 7$                             |\n| B       | 15$             | 5$                             | 6$                             | 7$                             |\n\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units. The distribution of each product to each market should meet the market demand: Market 1 requires 50 units of each product, Market 2 requires 60 units of each product, and Market 3 requires 40 units of each product. The distribution quantities must not exceed the production quantities for each product.\n\nPlease help the company to minimize the total production and distribution costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Production quantities and distribution quantities\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of Product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of Product B\ndist_A1 = model.addVar(vtype=\"INTEGER\", name=\"dist_A1\", lb=0) # distribution of Product A to Market 1\ndist_A2 = model.addVar(vtype=\"INTEGER\", name=\"dist_A2\", lb=0) # distribution of Product A to Market 2\ndist_A3 = model.addVar(vtype=\"INTEGER\", name=\"dist_A3\", lb=0) # distribution of Product A to Market 3\ndist_B1 = model.addVar(vtype=\"INTEGER\", name=\"dist_B1\", lb=0) # distribution of Product B to Market 1\ndist_B2 = model.addVar(vtype=\"INTEGER\", name=\"dist_B2\", lb=0) # distribution of Product B to Market 2\ndist_B3 = model.addVar(vtype=\"INTEGER\", name=\"dist_B3\", lb=0) # distribution of Product B to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Distribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\nProduction_Cost = 10*prod_A + 15*prod_B\nDistribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\nmodel.addCons(obj == Production_Cost + Distribution_Cost)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units.\nmodel.addCons(prod_A + prod_B <= 200)\n## The distribution of each product to each market should meet the market demand:\nmodel.addCons(dist_A1 + dist_B1 >= 50)\nmodel.addCons(dist_A2 + dist_B2 >= 60)\nmodel.addCons(dist_A3 + dist_B3 >= 40)\n## The distribution quantities must not exceed the production quantities for each product.\nmodel.addCons(dist_A1 + dist_A2 + dist_A3 <= prod_A)\nmodel.addCons(dist_B1 + dist_B2 + dist_B3 <= prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(prod_A))\n    print(\"Production quantity of Product B: \", model.getVal(prod_B))\n    print(\"Distribution of Product A to Market 1: \", model.getVal(dist_A1))\n    print(\"Distribution of Product A to Market 2: \", model.getVal(dist_A2))\n    print(\"Distribution of Product A to Market 3: \", model.getVal(dist_A3))\n    print(\"Distribution of Product B to Market 1: \", model.getVal(dist_B1))\n    print(\"Distribution of Product B to Market 2: \", model.getVal(dist_B2))\n    print(\"Distribution of Product B to Market 3: \", model.getVal(dist_B3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1514,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide the production quantities of each product and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"production quantity of Product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 1\": \"dist_A1\", \"range\": \"dist_A1 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 2\": \"dist_A2\", \"range\": \"dist_A2 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product A to Market 3\": \"dist_A3\", \"range\": \"dist_A3 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 1\": \"dist_B1\", \"range\": \"dist_B1 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 2\": \"dist_B2\", \"range\": \"dist_B2 >= 0\", \"type\": \"integer\"}\n// {\"distribution of Product B to Market 3\": \"dist_B3\", \"range\": \"dist_B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The distribution cost to Market 1 is $5 per unit, to Market 2 is $6 per unit, and to Market 3 is $7 per unit. The company aims to minimize the total production and distribution costs.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Distribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\n// Objective Function: Minimize: Production_Cost + Distribution_Cost\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nThe distribution of each product to each market should meet the market demand: Market 1 requires 50 units of each product, Market 2 requires 60 units of each product, and Market 3 requires 40 units of each product.\n// dist_A1 + dist_B1 >= 50\n// dist_A2 + dist_B2 >= 60\n// dist_A3 + dist_B3 >= 40\n\n## Generate Constraint-3:\nThe distribution quantities must not exceed the production quantities for each product.\n// dist_A1 + dist_A2 + dist_A3 <= prod_A\n// dist_B1 + dist_B2 + dist_B3 <= prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide the production quantities of each product and the distribution of these products to three different markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A is $10, and Product B is $15. The distribution cost to Market 1 is $5 per unit, to Market 2 is $6 per unit, and to Market 3 is $7 per unit. The company aims to minimize the total production and distribution costs. The total production of Product A and Product B should not exceed the company's production capacity of 200 units. The distribution of each product to each market should meet the market demand: Market 1 requires 50 units of each product, Market 2 requires 60 units of each product, and Market 3 requires 40 units of each product. The distribution quantities must not exceed the production quantities for each product. Please help the company to determine the optimal production and distribution quantities to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Production quantities and distribution quantities\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of Product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of Product B\ndist_A1 = model.addVar(vtype=\"INTEGER\", name=\"dist_A1\", lb=0) # distribution of Product A to Market 1\ndist_A2 = model.addVar(vtype=\"INTEGER\", name=\"dist_A2\", lb=0) # distribution of Product A to Market 2\ndist_A3 = model.addVar(vtype=\"INTEGER\", name=\"dist_A3\", lb=0) # distribution of Product A to Market 3\ndist_B1 = model.addVar(vtype=\"INTEGER\", name=\"dist_B1\", lb=0) # distribution of Product B to Market 1\ndist_B2 = model.addVar(vtype=\"INTEGER\", name=\"dist_B2\", lb=0) # distribution of Product B to Market 2\ndist_B3 = model.addVar(vtype=\"INTEGER\", name=\"dist_B3\", lb=0) # distribution of Product B to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Distribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\nProduction_Cost = 10*prod_A + 15*prod_B\nDistribution_Cost = 5*dist_A1 + 6*dist_A2 + 7*dist_A3 + 5*dist_B1 + 6*dist_B2 + 7*dist_B3\nmodel.addCons(obj == Production_Cost + Distribution_Cost)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units.\nmodel.addCons(prod_A + prod_B <= 200)\n## The distribution of each product to each market should meet the market demand:\nmodel.addCons(dist_A1 + dist_B1 >= 50)\nmodel.addCons(dist_A2 + dist_B2 >= 60)\nmodel.addCons(dist_A3 + dist_B3 >= 40)\n## The distribution quantities must not exceed the production quantities for each product.\nmodel.addCons(dist_A1 + dist_A2 + dist_A3 <= prod_A)\nmodel.addCons(dist_B1 + dist_B2 + dist_B3 <= prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(prod_A))\n    print(\"Production quantity of Product B: \", model.getVal(prod_B))\n    print(\"Distribution of Product A to Market 1: \", model.getVal(dist_A1))\n    print(\"Distribution of Product A to Market 2: \", model.getVal(dist_A2))\n    print(\"Distribution of Product A to Market 3: \", model.getVal(dist_A3))\n    print(\"Distribution of Product B to Market 1: \", model.getVal(dist_B1))\n    print(\"Distribution of Product B to Market 2: \", model.getVal(dist_B2))\n    print(\"Distribution of Product B to Market 3: \", model.getVal(dist_B3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time. The time requirements for each stage and product are given in the following Table.\n\n| Product | Assembly Time | Quality Check Time | Packaging Time |\n|---------|---------------|--------------------|----------------|\n| A       | 2 hours       | 1 hour             | 1 hour         |\n| B       | 3 hours       | 2 hours            | 1 hour         |\n\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging. Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging. The total time available for Assembly is 120 hours per week.\n\nPlease help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nThe total time available for Assembly is 120 hours per week.\nPlease help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total labor hours used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"total raw materials used\": \"Materials\", \"range\": \"Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\n// 5*A + 3*B + 2*C <= 150\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day.\n// A >= 10",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table shows the labor and raw material requirements for each product.\n\n| Product | Labor per Unit | Raw Materials per Unit |\n|---------|----------------|-------------------------|\n| A       | 2 hours        | 5 units                 |\n| B       | 3 hours        | 3 units                 |\n| C       | 4 hours        | 2 units                 |\n\nThe total labor available per day is 100 hours, and the total raw materials available per day is 150 units. The market demand for product A is at least 10 units per day. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\nmodel.addCons(5*A + 3*B + 2*C <= 150)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total labor hours used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"total raw materials used\": \"Materials\", \"range\": \"Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\n// 5*A + 3*B + 2*C <= 150\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day.\n// A >= 10",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor and 5 units of raw materials, each unit of product B requires 3 hours of labor and 3 units of raw materials, and each unit of product C requires 4 hours of labor and 2 units of raw materials. The total labor available per day is 100 hours, and the total raw materials available per day is 150 units. The market demand for product A is at least 10 units per day.\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\nmodel.addCons(5*A + 3*B + 2*C <= 150)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// The total number of units sent to each market must equal the production of each product:\n// A_M1 + A_M2 + A_M3 == A\n// B_M1 + B_M2 + B_M3 == B\n\n## Define Objective Function:\nThe profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\n// Profit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\n// Profit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\n// Objective Function: Maximize: Profit_A + Profit_B\n\n## Generate Constraint-1:\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week.\n// A <= 100\n// B <= 120\n\n## Generate Constraint-2:\nMarket 1 requires at least 40 units of Product A and 50 units of Product B per week.\n// A_M1 >= 40\n// B_M1 >= 50\n\n## Generate Constraint-3:\nMarket 2 requires at least 30 units of Product A and 40 units of Product B per week.\n// A_M2 >= 30\n// B_M2 >= 40",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3. The profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\n\n| Product | Market 1 Profit | Market 2 Profit | Market 3 Profit |\n|---------|-----------------|-----------------|-----------------|\n| A       | 30$             | 25$             | 20$             |\n| B       | 40$             | 35$             | 30$             |\n\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week. Market 1 requires at least 40 units of Product A and 50 units of Product B per week. Market 2 requires at least 30 units of Product A and 40 units of Product B per week. The total number of units sent to each market must equal the production of each product.\n\nPlease help the company to determine the optimal production and allocation of products to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the allocation to each market\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A sent to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A sent to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A sent to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B sent to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B sent to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B sent to Market 3\n\n# Constraints to ensure the total number of units sent to each market equals the production of each product\nmodel.addCons(A_M1 + A_M2 + A_M3 == A)\nmodel.addCons(B_M1 + B_M2 + B_M3 == B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit from each product in each market\nProfit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\nProfit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\n## The production capacity for Product A and B\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\n## Market 1 and Market 2 requirements\nmodel.addCons(A_M1 >= 40)\nmodel.addCons(B_M1 >= 50)\nmodel.addCons(A_M2 >= 30)\nmodel.addCons(B_M2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product A sent to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A sent to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A sent to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B sent to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B sent to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B sent to Market 3: \", model.getVal(B_M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// The total number of units sent to each market must equal the production of each product:\n// A_M1 + A_M2 + A_M3 == A\n// B_M1 + B_M2 + B_M3 == B\n\n## Define Objective Function:\nThe profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\n// Profit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\n// Profit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\n// Objective Function: Maximize: Profit_A + Profit_B\n\n## Generate Constraint-1:\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week.\n// A <= 100\n// B <= 120\n\n## Generate Constraint-2:\nMarket 1 requires at least 40 units of Product A and 50 units of Product B per week.\n// A_M1 >= 40\n// B_M1 >= 50\n\n## Generate Constraint-3:\nMarket 2 requires at least 30 units of Product A and 40 units of Product B per week.\n// A_M2 >= 30\n// B_M2 >= 40",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3. The profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit. The production capacity for Product A is 100 units per week, and for Product B is 120 units per week. Market 1 requires at least 40 units of Product A and 50 units of Product B per week. Market 2 requires at least 30 units of Product A and 40 units of Product B per week. The total number of units sent to each market must equal the production of each product. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the allocation to each market\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A sent to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A sent to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A sent to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B sent to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B sent to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B sent to Market 3\n\n# Constraints to ensure the total number of units sent to each market equals the production of each product\nmodel.addCons(A_M1 + A_M2 + A_M3 == A)\nmodel.addCons(B_M1 + B_M2 + B_M3 == B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit from each product in each market\nProfit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\nProfit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\n## The production capacity for Product A and B\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\n## Market 1 and Market 2 requirements\nmodel.addCons(A_M1 >= 40)\nmodel.addCons(B_M1 >= 50)\nmodel.addCons(A_M2 >= 30)\nmodel.addCons(B_M2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product A sent to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A sent to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A sent to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B sent to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B sent to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B sent to Market 3: \", model.getVal(B_M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of Product A produced in Chicago\": \"A_Chicago\", \"range\": \"A_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Dallas\": \"A_Dallas\", \"range\": \"A_Dallas >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Chicago\": \"B_Chicago\", \"range\": \"B_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Dallas\": \"B_Dallas\", \"range\": \"B_Dallas >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $8, and in Dallas is $9. The manufacturer wants to minimize the total production cost while meeting the market demand for both products.\n// Objective Function: Minimize: 10*A_Chicago + 12*A_Dallas + 8*B_Chicago + 9*B_Dallas\n\n## Generate Constraint-1:\nThe production capacity of each factory is limited. The Chicago factory can produce up to 100 units in total, and the Dallas factory can produce up to 120 units in total.\n// A_Chicago + B_Chicago <= 100\n// A_Dallas + B_Dallas <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is 60 units, and for Product B is 70 units.\n// A_Chicago + A_Dallas >= 60\n// B_Chicago + B_Dallas >= 70\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 20 units of Product A in Chicago and 30 units of Product B in Dallas to maintain local market presence.\n// A_Chicago >= 20\n// B_Dallas >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $8, and in Dallas is $9. The following table summarizes the production costs for each product in each location.\n\n| Product | Chicago Cost | Dallas Cost |\n|---------|--------------|-------------|\n| A       | 10$          | 12$         |\n| B       | 8$           | 9$          |\n\nThe production capacity of each factory is limited. The Chicago factory can produce up to 100 units in total, and the Dallas factory can produce up to 120 units in total. The market demand for Product A is 60 units, and for Product B is 70 units. The manufacturer has a policy to produce at least 20 units of Product A in Chicago and 30 units of Product B in Dallas to maintain local market presence.\n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each factory\nA_Chicago = model.addVar(vtype=\"INTEGER\", name=\"A_Chicago\", lb=0) # number of Product A produced in Chicago\nA_Dallas = model.addVar(vtype=\"INTEGER\", name=\"A_Dallas\", lb=0) # number of Product A produced in Dallas\nB_Chicago = model.addVar(vtype=\"INTEGER\", name=\"B_Chicago\", lb=0) # number of Product B produced in Chicago\nB_Dallas = model.addVar(vtype=\"INTEGER\", name=\"B_Dallas\", lb=0) # number of Product B produced in Dallas\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_Chicago + 12*A_Dallas + 8*B_Chicago + 9*B_Dallas)\n\n# Add constraints\n## The production capacity of each factory is limited.\nmodel.addCons(A_Chicago + B_Chicago <= 100) # Chicago factory capacity\nmodel.addCons(A_Dallas + B_Dallas <= 120) # Dallas factory capacity\n## The market demand for Product A and Product B.\nmodel.addCons(A_Chicago + A_Dallas >= 60) # Demand for Product A\nmodel.addCons(B_Chicago + B_Dallas >= 70) # Demand for Product B\n## The manufacturer's policy for local market presence.\nmodel.addCons(A_Chicago >= 20) # At least 20 units of Product A in Chicago\nmodel.addCons(B_Dallas >= 30) # At least 30 units of Product B in Dallas\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Chicago: \", model.getVal(A_Chicago))\n    print(\"Number of Product A produced in Dallas: \", model.getVal(A_Dallas))\n    print(\"Number of Product B produced in Chicago: \", model.getVal(B_Chicago))\n    print(\"Number of Product B produced in Dallas: \", model.getVal(B_Dallas))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of Product A produced in Chicago\": \"A_Chicago\", \"range\": \"A_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Dallas\": \"A_Dallas\", \"range\": \"A_Dallas >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Chicago\": \"B_Chicago\", \"range\": \"B_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Dallas\": \"B_Dallas\", \"range\": \"B_Dallas >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $8, and in Dallas is $9. The manufacturer wants to minimize the total production cost while meeting the market demand for both products.\n// Objective Function: Minimize: 10*A_Chicago + 12*A_Dallas + 8*B_Chicago + 9*B_Dallas\n\n## Generate Constraint-1:\nThe production capacity of each factory is limited. The Chicago factory can produce up to 100 units in total, and the Dallas factory can produce up to 120 units in total.\n// A_Chicago + B_Chicago <= 100\n// A_Dallas + B_Dallas <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is 60 units, and for Product B is 70 units.\n// A_Chicago + A_Dallas >= 60\n// B_Chicago + B_Dallas >= 70\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 20 units of Product A in Chicago and 30 units of Product B in Dallas to maintain local market presence.\n// A_Chicago >= 20\n// B_Dallas >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Dallas. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Chicago is $10, and in Dallas is $12. The cost of producing one unit of Product B in Chicago is $8, and in Dallas is $9. The Chicago factory can produce up to 100 units in total, and the Dallas factory can produce up to 120 units in total. The market demand for Product A is 60 units, and for Product B is 70 units. The manufacturer has a policy to produce at least 20 units of Product A in Chicago and 30 units of Product B in Dallas to maintain local market presence. Please help the manufacturer to minimize the total production cost while meeting the market demand for both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each factory\nA_Chicago = model.addVar(vtype=\"INTEGER\", name=\"A_Chicago\", lb=0) # number of Product A produced in Chicago\nA_Dallas = model.addVar(vtype=\"INTEGER\", name=\"A_Dallas\", lb=0) # number of Product A produced in Dallas\nB_Chicago = model.addVar(vtype=\"INTEGER\", name=\"B_Chicago\", lb=0) # number of Product B produced in Chicago\nB_Dallas = model.addVar(vtype=\"INTEGER\", name=\"B_Dallas\", lb=0) # number of Product B produced in Dallas\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_Chicago + 12*A_Dallas + 8*B_Chicago + 9*B_Dallas)\n\n# Add constraints\n## The production capacity of each factory is limited.\nmodel.addCons(A_Chicago + B_Chicago <= 100) # Chicago factory capacity\nmodel.addCons(A_Dallas + B_Dallas <= 120) # Dallas factory capacity\n## The market demand for Product A and Product B.\nmodel.addCons(A_Chicago + A_Dallas >= 60) # Demand for Product A\nmodel.addCons(B_Chicago + B_Dallas >= 70) # Demand for Product B\n## The manufacturer's policy for local market presence.\nmodel.addCons(A_Chicago >= 20) # At least 20 units of Product A in Chicago\nmodel.addCons(B_Dallas >= 30) # At least 30 units of Product B in Dallas\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Chicago: \", model.getVal(A_Chicago))\n    print(\"Number of Product A produced in Dallas: \", model.getVal(A_Dallas))\n    print(\"Number of Product B produced in Chicago: \", model.getVal(B_Chicago))\n    print(\"Number of Product B produced in Dallas: \", model.getVal(B_Dallas))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of Product A units produced in Chicago\": \"A_Chicago\", \"range\": \"A_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"B_Chicago\", \"range\": \"B_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"A_Denver\", \"range\": \"A_Denver >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"B_Denver\", \"range\": \"B_Denver >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Denver is $12. The cost of producing one unit of Product B in Chicago is $15, and in Denver is $14. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_Chicago + 15*B_Chicago + 12*A_Denver + 14*B_Denver\n\n## Generate Constraint-1:\nThe total production capacity of Product A in both factories is 100 units.\n// A_Chicago + A_Denver <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Product B in both factories is 120 units.\n// B_Chicago + B_Denver <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 70 units, and for Product B is 80 units.\n// A_Chicago + A_Denver >= 70\n// B_Chicago + B_Denver >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each location is given in the following Table.\n\n| Product | Chicago Cost | Denver Cost |\n|---------|--------------|-------------|\n| A       | $10          | $12         |\n| B       | $15          | $14         |\n\nThe total production capacity of Product A in both factories is 100 units, and the total production capacity of Product B in both factories is 120 units. The market demand for Product A is 70 units, and for Product B is 80 units. \n\nPlease help the manufacturer to determine the optimal number of units of Product A and Product B to produce in each factory to minimize the total production cost while meeting the market demand and production capacity constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_Chicago = model.addVar(vtype=\"INTEGER\", name=\"A_Chicago\", lb=0) # number of Product A units produced in Chicago\nB_Chicago = model.addVar(vtype=\"INTEGER\", name=\"B_Chicago\", lb=0) # number of Product B units produced in Chicago\nA_Denver = model.addVar(vtype=\"INTEGER\", name=\"A_Denver\", lb=0) # number of Product A units produced in Denver\nB_Denver = model.addVar(vtype=\"INTEGER\", name=\"B_Denver\", lb=0) # number of Product B units produced in Denver\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_Chicago + 15*B_Chicago + 12*A_Denver + 14*B_Denver)\n\n# Add constraints\n## The total production capacity of Product A in both factories is 100 units.\nmodel.addCons(A_Chicago + A_Denver <= 100)\n## The total production capacity of Product B in both factories is 120 units.\nmodel.addCons(B_Chicago + B_Denver <= 120)\n## The market demand for Product A is 70 units, and for Product B is 80 units.\nmodel.addCons(A_Chicago + A_Denver >= 70)\nmodel.addCons(B_Chicago + B_Denver >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(A_Chicago))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(B_Chicago))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(A_Denver))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(B_Denver))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of Product A units produced in Chicago\": \"A_Chicago\", \"range\": \"A_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"B_Chicago\", \"range\": \"B_Chicago >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"A_Denver\", \"range\": \"A_Denver >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"B_Denver\", \"range\": \"B_Denver >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $10, and in Denver is $12. The cost of producing one unit of Product B in Chicago is $15, and in Denver is $14. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_Chicago + 15*B_Chicago + 12*A_Denver + 14*B_Denver\n\n## Generate Constraint-1:\nThe total production capacity of Product A in both factories is 100 units.\n// A_Chicago + A_Denver <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Product B in both factories is 120 units.\n// B_Chicago + B_Denver <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 70 units, and for Product B is 80 units.\n// A_Chicago + A_Denver >= 70\n// B_Chicago + B_Denver >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Chicago is $10, and in Denver is $12. The cost of producing one unit of Product B in Chicago is $15, and in Denver is $14. The manufacturer aims to minimize the total production cost.\nThe total production capacity of Product A in both factories is 100 units. The total production capacity of Product B in both factories is 120 units. The market demand for Product A is 70 units, and for Product B is 80 units.\nPlease help the manufacturer determine the optimal production quantities for each product in each factory.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_Chicago = model.addVar(vtype=\"INTEGER\", name=\"A_Chicago\", lb=0) # number of Product A units produced in Chicago\nB_Chicago = model.addVar(vtype=\"INTEGER\", name=\"B_Chicago\", lb=0) # number of Product B units produced in Chicago\nA_Denver = model.addVar(vtype=\"INTEGER\", name=\"A_Denver\", lb=0) # number of Product A units produced in Denver\nB_Denver = model.addVar(vtype=\"INTEGER\", name=\"B_Denver\", lb=0) # number of Product B units produced in Denver\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_Chicago + 15*B_Chicago + 12*A_Denver + 14*B_Denver)\n\n# Add constraints\n## The total production capacity of Product A in both factories is 100 units.\nmodel.addCons(A_Chicago + A_Denver <= 100)\n## The total production capacity of Product B in both factories is 120 units.\nmodel.addCons(B_Chicago + B_Denver <= 120)\n## The market demand for Product A is 70 units, and for Product B is 80 units.\nmodel.addCons(A_Chicago + A_Denver >= 70)\nmodel.addCons(B_Chicago + B_Denver >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(A_Chicago))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(B_Chicago))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(A_Denver))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(B_Denver))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"availability of Resource X\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"availability of Resource Y\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\n// 2*A + 3*B <= 300\n\n## Generate Constraint-2:\nThe production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\n// 4*A + 2*B <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a minimum production requirement for Product A, which is 10 units.\n// A >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The following table summarizes the resource requirements for each product:\n\n| Product | Resource X Required | Resource Y Required |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 4 units             |\n| B       | 3 units             | 2 units             |\n\nThe total amount of Resource X available is 300 units, and the total amount of Resource Y available is 200 units. The manufacturer has a minimum production requirement for Product A, which is 10 units. Please help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\nmodel.addCons(2*A + 3*B <= 300)\n## The production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\nmodel.addCons(4*A + 2*B <= 200)\n## The manufacturer has a minimum production requirement for Product A, which is 10 units.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"availability of Resource X\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"availability of Resource Y\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\n// 2*A + 3*B <= 300\n\n## Generate Constraint-2:\nThe production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\n// 4*A + 2*B <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a minimum production requirement for Product A, which is 10 units.\n// A >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\nThe production of each unit of Product A requires 2 units of Resource X and 4 units of Resource Y, while each unit of Product B requires 3 units of Resource X and 2 units of Resource Y. The total amount of Resource X available is 300 units, and the total amount of Resource Y available is 200 units. The manufacturer has a minimum production requirement for Product A, which is 10 units.\nPlease help the manufacturer decide how many units of each product to produce to maximize profit while considering the availability of resources.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\nmodel.addCons(2*A + 3*B <= 300)\n## The production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\nmodel.addCons(4*A + 2*B <= 200)\n## The manufacturer has a minimum production requirement for Product A, which is 10 units.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Testing, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate resources efficiently to minimize production costs while meeting market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hours of Assembly time used for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"hours of Assembly time used for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and Product B is $15 per unit. The cost of using Assembly time is $50 per hour. The goal is to minimize the total production cost.\n// Objective Function: Minimize: 10*A + 15*B + 50*(Assembly_A + Assembly_B)\n\n## Generate Constraint-1:\nThe Assembly stage has a total of 100 hours available per week.\n// Assembly_A + Assembly_B <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 2 hours of Assembly time, and each unit of Product B requires 3 hours of Assembly time.\n// Assembly_A = 2*A\n// Assembly_B = 3*B\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week.\n// A >= 30\n// B >= 20",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Testing, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate resources efficiently to minimize production costs while meeting market demand. The cost of producing Product A is $10 per unit, and Product B is $15 per unit. The cost of using Assembly time is $50 per hour. The following table summarizes the assembly time requirements for each product:\n\n| Product | Assembly Time per Unit |\n|---------|-------------------------|\n| A       | 2 hours                 |\n| B       | 3 hours                 |\n\nThe Assembly stage has a total of 100 hours available per week. The market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week. Please help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the hours of Assembly time used\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # hours of Assembly time used for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # hours of Assembly time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 50*(Assembly_A + Assembly_B))\n\n# Add constraints\n## The Assembly stage has a total of 100 hours available per week.\nmodel.addCons(Assembly_A + Assembly_B <= 100)\n## Each unit of Product A requires 2 hours of Assembly time, and each unit of Product B requires 3 hours of Assembly time.\nmodel.addCons(Assembly_A == 2*A)\nmodel.addCons(Assembly_B == 3*B)\n## The market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week.\nmodel.addCons(A >= 30)\nmodel.addCons(B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Hours of Assembly time used for Product A: \", model.getVal(Assembly_A))\n    print(\"Hours of Assembly time used for Product B: \", model.getVal(Assembly_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Testing, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate resources efficiently to minimize production costs while meeting market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hours of Assembly time used for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"hours of Assembly time used for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and Product B is $15 per unit. The cost of using Assembly time is $50 per hour. The goal is to minimize the total production cost.\n// Objective Function: Minimize: 10*A + 15*B + 50*(Assembly_A + Assembly_B)\n\n## Generate Constraint-1:\nThe Assembly stage has a total of 100 hours available per week.\n// Assembly_A + Assembly_B <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 2 hours of Assembly time, and each unit of Product B requires 3 hours of Assembly time.\n// Assembly_A = 2*A\n// Assembly_B = 3*B\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week.\n// A >= 30\n// B >= 20",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Testing, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate resources efficiently to minimize production costs while meeting market demand. The cost of producing Product A is $10 per unit, and Product B is $15 per unit. The cost of using Assembly time is $50 per hour. The Assembly stage has a total of 100 hours available per week. Each unit of Product A requires 2 hours of Assembly time, and each unit of Product B requires 3 hours of Assembly time. The market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and the hours of Assembly time used\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # hours of Assembly time used for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # hours of Assembly time used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A + 15*B + 50*(Assembly_A + Assembly_B))\n\n# Add constraints\n## The Assembly stage has a total of 100 hours available per week.\nmodel.addCons(Assembly_A + Assembly_B <= 100)\n## Each unit of Product A requires 2 hours of Assembly time, and each unit of Product B requires 3 hours of Assembly time.\nmodel.addCons(Assembly_A == 2*A)\nmodel.addCons(Assembly_B == 3*B)\n## The market demand for Product A is at least 30 units per week, and for Product B is at least 20 units per week.\nmodel.addCons(A >= 30)\nmodel.addCons(B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Hours of Assembly time used for Product A: \", model.getVal(Assembly_A))\n    print(\"Hours of Assembly time used for Product B: \", model.getVal(Assembly_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available machine hours\": \"Machine_Hours\", \"range\": \"Machine_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*Product_A + 70*Product_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total labor hours used must not exceed the available labor hours.\n// 2*Product_A + 3*Product_B <= Labor\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 units of raw materials, and each unit of Product B requires 5 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 4*Product_A + 5*Product_B <= Raw_Materials\n\n## Generate Constraint-3:\nEach unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time. The total machine hours used must not exceed the available machine hours.\n// Product_A + 2*Product_B <= Machine_Hours",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources. The profit per unit of Product A is $50, and for Product B is $70. The following table summarizes the resource requirements for each product:\n\n| Product | Labor Hours | Raw Materials | Machine Hours |\n|---------|-------------|---------------|---------------|\n| A       | 2 hours     | 4 units       | 1 hour        |\n| B       | 3 hours     | 5 units       | 2 hours       |\n\nThe manufacturer has a certain amount of labor hours, raw materials, and machine hours available. Each unit of Product A requires 2 hours of labor and 4 units of raw materials, while each unit of Product B requires 3 hours of labor and 5 units of raw materials. The total labor hours used must not exceed the available labor hours, and the total raw materials used must not exceed the available raw materials. Additionally, each unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time, with the total machine hours used not exceeding the available machine hours.\n\nPlease help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 70*Product_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor.\nmodel.addCons(2*Product_A + 3*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0)) # available labor hours\n## Each unit of Product A requires 4 units of raw materials, and each unit of Product B requires 5 units of raw materials.\nmodel.addCons(4*Product_A + 5*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0)) # available raw materials\n## Each unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time.\nmodel.addCons(Product_A + 2*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Hours\", lb=0)) # available machine hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1383,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available machine hours\": \"Machine_Hours\", \"range\": \"Machine_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*Product_A + 70*Product_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The total labor hours used must not exceed the available labor hours.\n// 2*Product_A + 3*Product_B <= Labor\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 units of raw materials, and each unit of Product B requires 5 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 4*Product_A + 5*Product_B <= Raw_Materials\n\n## Generate Constraint-3:\nEach unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time. The total machine hours used must not exceed the available machine hours.\n// Product_A + 2*Product_B <= Machine_Hours",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three resources: labor, raw materials, and machinery. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\nThe profit per unit of Product A is $50, and for Product B is $70. Each unit of Product A requires 2 hours of labor and 4 units of raw materials, and each unit of Product B requires 3 hours of labor and 5 units of raw materials. Additionally, each unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time.\nThe manufacturer aims to maximize the total profit from the production of both products while ensuring that the total labor hours used do not exceed the available labor hours, the total raw materials used do not exceed the available raw materials, and the total machine hours used do not exceed the available machine hours.\nPlease help the manufacturer determine the optimal number of units of Product A and Product B to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 70*Product_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor.\nmodel.addCons(2*Product_A + 3*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0)) # available labor hours\n## Each unit of Product A requires 4 units of raw materials, and each unit of Product B requires 5 units of raw materials.\nmodel.addCons(4*Product_A + 5*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0)) # available raw materials\n## Each unit of Product A requires 1 hour of machine time, and each unit of Product B requires 2 hours of machine time.\nmodel.addCons(Product_A + 2*Product_B <= model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Hours\", lb=0)) # available machine hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves two main processes: machining and assembly. The manufacturer needs to decide how many units of each product to produce and how to allocate the production time between the two processes.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total time spent on machining\": \"machining_time\", \"range\": \"machining_time >= 0\", \"type\": \"real\"}\n// {\"total time spent on assembly\": \"assembly_time\", \"range\": \"assembly_time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The cost of machining time is $10 per hour, and the cost of assembly time is $8 per hour. The total available machining time is 100 hours, and the total available assembly time is 120 hours. The objective is to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.\n// Profit_A = 50*A\n// Profit_B = 30*B\n// Profit_C = 40*C\n// Machining_Cost = 10*machining_time\n// Assembly_Cost = 8*assembly_time\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C - Machining_Cost - Assembly_Cost\n\n## Generate Constraint-1:\nThe time required for machining per unit of product A, B, and C is 2 hours, 3 hours, and 1 hour, respectively. The total machining time should not exceed 100 hours.\n// 2*A + 3*B + 1*C <= 100\n\n## Generate Constraint-2:\nThe time required for assembly per unit of product A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The total assembly time should not exceed 120 hours.\n// 1*A + 2*B + 3*C <= 120\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C to meet contractual obligations.\n// A >= 10\n// B >= 20\n// C >= 15",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves two main processes: machining and assembly. The manufacturer needs to decide how many units of each product to produce and how to allocate the production time between the two processes. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The cost of machining time is $10 per hour, and the cost of assembly time is $8 per hour. The total available machining time is 100 hours, and the total available assembly time is 120 hours. The objective is to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.\n\n| Product | Profit per Unit | Machining Time per Unit | Assembly Time per Unit |\n|---------|-----------------|-------------------------|------------------------|\n| A       | 50$             | 2 hours                 | 1 hour                 |\n| B       | 30$             | 3 hours                 | 2 hours                |\n| C       | 40$             | 1 hour                  | 3 hours                |\n\nThe time required for machining per unit of product A, B, and C is 2 hours, 3 hours, and 1 hour, respectively. The total machining time should not exceed 100 hours. The time required for assembly per unit of product A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The total assembly time should not exceed 120 hours. The manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C to meet contractual obligations.\n\nPlease help the manufacturer to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The total time spent on each process\nmachining_time = model.addVar(vtype=\"CONTINUOUS\", name=\"machining_time\", lb=0) # total time spent on machining\nassembly_time = model.addVar(vtype=\"CONTINUOUS\", name=\"assembly_time\", lb=0) # total time spent on assembly\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit and cost calculations\nProfit_A = 50*A\nProfit_B = 30*B\nProfit_C = 40*C\nMachining_Cost = 10*machining_time\nAssembly_Cost = 8*assembly_time\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Machining_Cost - Assembly_Cost)\n\n# Add constraints\n## The time required for machining per unit of product A, B, and C\nmodel.addCons(2*A + 3*B + 1*C == machining_time)\n## The time required for assembly per unit of product A, B, and C\nmodel.addCons(1*A + 2*B + 3*C == assembly_time)\n## The total machining time should not exceed 100 hours\nmodel.addCons(machining_time <= 100)\n## The total assembly time should not exceed 120 hours\nmodel.addCons(assembly_time <= 120)\n## The manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 20)\nmodel.addCons(C >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Total time spent on machining: \", model.getVal(machining_time))\n    print(\"Total time spent on assembly: \", model.getVal(assembly_time))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1707,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves two main processes: machining and assembly. The manufacturer needs to decide how many units of each product to produce and how to allocate the production time between the two processes.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total time spent on machining\": \"machining_time\", \"range\": \"machining_time >= 0\", \"type\": \"real\"}\n// {\"total time spent on assembly\": \"assembly_time\", \"range\": \"assembly_time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The cost of machining time is $10 per hour, and the cost of assembly time is $8 per hour. The total available machining time is 100 hours, and the total available assembly time is 120 hours. The objective is to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.\n// Profit_A = 50*A\n// Profit_B = 30*B\n// Profit_C = 40*C\n// Machining_Cost = 10*machining_time\n// Assembly_Cost = 8*assembly_time\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C - Machining_Cost - Assembly_Cost\n\n## Generate Constraint-1:\nThe time required for machining per unit of product A, B, and C is 2 hours, 3 hours, and 1 hour, respectively. The total machining time should not exceed 100 hours.\n// 2*A + 3*B + 1*C <= 100\n\n## Generate Constraint-2:\nThe time required for assembly per unit of product A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The total assembly time should not exceed 120 hours.\n// 1*A + 2*B + 3*C <= 120\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C to meet contractual obligations.\n// A >= 10\n// B >= 20\n// C >= 15",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves two main processes: machining and assembly. The manufacturer needs to decide how many units of each product to produce and how to allocate the production time between the two processes. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The cost of machining time is $10 per hour, and the cost of assembly time is $8 per hour. The total available machining time is 100 hours, and the total available assembly time is 120 hours. The objective is to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.\n\nThe time required for machining per unit of product A, B, and C is 2 hours, 3 hours, and 1 hour, respectively. The total machining time should not exceed 100 hours. The time required for assembly per unit of product A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The total assembly time should not exceed 120 hours. The manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C to meet contractual obligations.\n\nPlease help the manufacturer to maximize the total profit from the sales of products A, B, and C, minus the costs of machining and assembly.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The total time spent on each process\nmachining_time = model.addVar(vtype=\"CONTINUOUS\", name=\"machining_time\", lb=0) # total time spent on machining\nassembly_time = model.addVar(vtype=\"CONTINUOUS\", name=\"assembly_time\", lb=0) # total time spent on assembly\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit and cost calculations\nProfit_A = 50*A\nProfit_B = 30*B\nProfit_C = 40*C\nMachining_Cost = 10*machining_time\nAssembly_Cost = 8*assembly_time\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Machining_Cost - Assembly_Cost)\n\n# Add constraints\n## The time required for machining per unit of product A, B, and C\nmodel.addCons(2*A + 3*B + 1*C == machining_time)\n## The time required for assembly per unit of product A, B, and C\nmodel.addCons(1*A + 2*B + 3*C == assembly_time)\n## The total machining time should not exceed 100 hours\nmodel.addCons(machining_time <= 100)\n## The total assembly time should not exceed 120 hours\nmodel.addCons(assembly_time <= 120)\n## The manufacturer must produce at least 10 units of product A, 20 units of product B, and 15 units of product C\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 20)\nmodel.addCons(C >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Total time spent on machining: \", model.getVal(machining_time))\n    print(\"Total time spent on assembly: \", model.getVal(assembly_time))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | 10$          | 12$          |\n| B       | 8$           | 9$           |\n\nThe total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand and staying within the production capacities of both plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day. Please help the manufacturer to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of Product A units produced in Chicago\": \"Chi_A\", \"range\": \"Chi_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"Chi_B\", \"range\": \"Chi_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"Den_A\", \"range\": \"Den_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"Den_B\", \"range\": \"Den_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $20, and in Denver is $22. The manufacturer aims to minimize the total production cost while meeting the market demand for both products.\n// Chi_Cost_A = 30*Chi_A\n// Chi_Cost_B = 20*Chi_B\n// Den_Cost_A = 25*Den_A\n// Den_Cost_B = 22*Den_B\n// Objective Function: Minimize: Chi_Cost_A + Chi_Cost_B + Den_Cost_A + Den_Cost_B\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. The Chicago factory can produce up to 100 units in total, and the Denver factory can produce up to 120 units in total.\n// Chi_A + Chi_B <= 100\n// Den_A + Den_B <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is 80 units, and for Product B is 90 units.\n// Chi_A + Den_A >= 80\n// Chi_B + Den_B >= 90\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 20 units of Product A in Denver.\n// Den_A >= 20",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $20, and in Denver is $22. The following table summarizes the production costs for each product in each location.\n\n| Product | Chicago Cost | Denver Cost |\n|---------|--------------|-------------|\n| A       | 30$          | 25$         |\n| B       | 20$          | 22$         |\n\nEach factory has a limited production capacity. The Chicago factory can produce up to 100 units in total, and the Denver factory can produce up to 120 units in total. The market demand for Product A is 80 units, and for Product B is 90 units. The manufacturer has a policy to produce at least 20 units of Product A in Denver.\n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nChi_A = model.addVar(vtype=\"INTEGER\", name=\"Chi_A\", lb=0) # number of Product A units produced in Chicago\nChi_B = model.addVar(vtype=\"INTEGER\", name=\"Chi_B\", lb=0) # number of Product B units produced in Chicago\nDen_A = model.addVar(vtype=\"INTEGER\", name=\"Den_A\", lb=0) # number of Product A units produced in Denver\nDen_B = model.addVar(vtype=\"INTEGER\", name=\"Den_B\", lb=0) # number of Product B units produced in Denver\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 30*Chi_A + 20*Chi_B + 25*Den_A + 22*Den_B)\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(Chi_A + Chi_B <= 100)\nmodel.addCons(Den_A + Den_B <= 120)\n## The market demand for Product A is 80 units, and for Product B is 90 units.\nmodel.addCons(Chi_A + Den_A >= 80)\nmodel.addCons(Chi_B + Den_B >= 90)\n## The manufacturer has a policy to produce at least 20 units of Product A in Denver.\nmodel.addCons(Den_A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(Chi_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(Chi_B))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(Den_A))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(Den_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of Product A units produced in Chicago\": \"Chi_A\", \"range\": \"Chi_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"Chi_B\", \"range\": \"Chi_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"Den_A\", \"range\": \"Den_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"Den_B\", \"range\": \"Den_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $20, and in Denver is $22. The manufacturer aims to minimize the total production cost while meeting the market demand for both products.\n// Chi_Cost_A = 30*Chi_A\n// Chi_Cost_B = 20*Chi_B\n// Den_Cost_A = 25*Den_A\n// Den_Cost_B = 22*Den_B\n// Objective Function: Minimize: Chi_Cost_A + Chi_Cost_B + Den_Cost_A + Den_Cost_B\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. The Chicago factory can produce up to 100 units in total, and the Denver factory can produce up to 120 units in total.\n// Chi_A + Chi_B <= 100\n// Den_A + Den_B <= 120\n\n## Generate Constraint-2:\nThe market demand for Product A is 80 units, and for Product B is 90 units.\n// Chi_A + Den_A >= 80\n// Chi_B + Den_B >= 90\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least 20 units of Product A in Denver.\n// Den_A >= 20",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $20, and in Denver is $22. Each factory has a limited production capacity. The Chicago factory can produce up to 100 units in total, and the Denver factory can produce up to 120 units in total. The market demand for Product A is 80 units, and for Product B is 90 units. The manufacturer has a policy to produce at least 20 units of Product A in Denver. Please help the manufacturer to minimize the total production cost while meeting the market demand for both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nChi_A = model.addVar(vtype=\"INTEGER\", name=\"Chi_A\", lb=0) # number of Product A units produced in Chicago\nChi_B = model.addVar(vtype=\"INTEGER\", name=\"Chi_B\", lb=0) # number of Product B units produced in Chicago\nDen_A = model.addVar(vtype=\"INTEGER\", name=\"Den_A\", lb=0) # number of Product A units produced in Denver\nDen_B = model.addVar(vtype=\"INTEGER\", name=\"Den_B\", lb=0) # number of Product B units produced in Denver\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 30*Chi_A + 20*Chi_B + 25*Den_A + 22*Den_B)\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(Chi_A + Chi_B <= 100)\nmodel.addCons(Den_A + Den_B <= 120)\n## The market demand for Product A is 80 units, and for Product B is 90 units.\nmodel.addCons(Chi_A + Den_A >= 80)\nmodel.addCons(Chi_B + Den_B >= 90)\n## The manufacturer has a policy to produce at least 20 units of Product A in Denver.\nmodel.addCons(Den_A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units produced in Chicago: \", model.getVal(Chi_A))\n    print(\"Number of Product B units produced in Chicago: \", model.getVal(Chi_B))\n    print(\"Number of Product A units produced in Denver: \", model.getVal(Den_A))\n    print(\"Number of Product B units produced in Denver: \", model.getVal(Den_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company has three production facilities and needs to decide how many units of each product to produce at each facility to meet the demand while minimizing the total production cost.\n// {\"number of Product A produced at Facility 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced at Facility 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced at Facility 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A at Facility 1, 2, and 3 is $10, $12, and $15, respectively. The cost of producing one unit of Product B at Facility 1, 2, and 3 is $8, $9, and $11, respectively. The company aims to minimize the total production cost.\n// Cost_A_F1 = 10*A_F1\n// Cost_A_F2 = 12*A_F2\n// Cost_A_F3 = 15*A_F3\n// Cost_B_F1 = 8*B_F1\n// Cost_B_F2 = 9*B_F2\n// Cost_B_F3 = 11*B_F3\n// Objective Function: Minimize: Cost_A_F1 + Cost_A_F2 + Cost_A_F3 + Cost_B_F1 + Cost_B_F2 + Cost_B_F3\n\n## Generate Constraint-1:\nThe total production of Product A should meet the demand of 100 units.\n// A_F1 + A_F2 + A_F3 = 100\n\n## Generate Constraint-2:\nThe total production of Product B should meet the demand of 120 units.\n// B_F1 + B_F2 + B_F3 = 120\n\n## Generate Constraint-3:\nEach facility has a production capacity of 50 units per week.\n// A_F1 + B_F1 <= 50\n// A_F2 + B_F2 <= 50\n// A_F3 + B_F3 <= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company has three production facilities and needs to decide how many units of each product to produce at each facility to meet the demand while minimizing the total production cost. The cost of producing one unit of each product at each facility is given in the following Table.\n\n| Product | Facility 1 | Facility 2 | Facility 3 |\n|---------|------------|------------|------------|\n| A       | 10$        | 12$        | 15$        |\n| B       | 8$         | 9$         | 11$        |\n\nThe total production of Product A should meet the demand of 100 units, and the total production of Product B should meet the demand of 120 units. Each facility has a production capacity of 50 units per week. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced at each facility\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of Product A produced at Facility 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of Product A produced at Facility 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # number of Product A produced at Facility 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of Product B produced at Facility 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of Product B produced at Facility 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # number of Product B produced at Facility 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Calculate the total production cost\nCost_A_F1 = 10*A_F1\nCost_A_F2 = 12*A_F2\nCost_A_F3 = 15*A_F3\nCost_B_F1 = 8*B_F1\nCost_B_F2 = 9*B_F2\nCost_B_F3 = 11*B_F3\nmodel.addCons(obj == Cost_A_F1 + Cost_A_F2 + Cost_A_F3 + Cost_B_F1 + Cost_B_F2 + Cost_B_F3)\n\n# Add constraints\n## The total production of Product A should meet the demand of 100 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 == 100)\n## The total production of Product B should meet the demand of 120 units.\nmodel.addCons(B_F1 + B_F2 + B_F3 == 120)\n## Each facility has a production capacity of 50 units per week.\nmodel.addCons(A_F1 + B_F1 <= 50)\nmodel.addCons(A_F2 + B_F2 <= 50)\nmodel.addCons(A_F3 + B_F3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced at Facility 1: \", model.getVal(A_F1))\n    print(\"Number of Product A produced at Facility 2: \", model.getVal(A_F2))\n    print(\"Number of Product A produced at Facility 3: \", model.getVal(A_F3))\n    print(\"Number of Product B produced at Facility 1: \", model.getVal(B_F1))\n    print(\"Number of Product B produced at Facility 2: \", model.getVal(B_F2))\n    print(\"Number of Product B produced at Facility 3: \", model.getVal(B_F3))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company has three production facilities and needs to decide how many units of each product to produce at each facility to meet the demand while minimizing the total production cost.\n// {\"number of Product A produced at Facility 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced at Facility 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced at Facility 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced at Facility 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A at Facility 1, 2, and 3 is $10, $12, and $15, respectively. The cost of producing one unit of Product B at Facility 1, 2, and 3 is $8, $9, and $11, respectively. The company aims to minimize the total production cost.\n// Cost_A_F1 = 10*A_F1\n// Cost_A_F2 = 12*A_F2\n// Cost_A_F3 = 15*A_F3\n// Cost_B_F1 = 8*B_F1\n// Cost_B_F2 = 9*B_F2\n// Cost_B_F3 = 11*B_F3\n// Objective Function: Minimize: Cost_A_F1 + Cost_A_F2 + Cost_A_F3 + Cost_B_F1 + Cost_B_F2 + Cost_B_F3\n\n## Generate Constraint-1:\nThe total production of Product A should meet the demand of 100 units.\n// A_F1 + A_F2 + A_F3 = 100\n\n## Generate Constraint-2:\nThe total production of Product B should meet the demand of 120 units.\n// B_F1 + B_F2 + B_F3 = 120\n\n## Generate Constraint-3:\nEach facility has a production capacity of 50 units per week.\n// A_F1 + B_F1 <= 50\n// A_F2 + B_F2 <= 50\n// A_F3 + B_F3 <= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company has three production facilities and needs to decide how many units of each product to produce at each facility to meet the demand while minimizing the total production cost. The cost of producing one unit of Product A at Facility 1, 2, and 3 is $10, $12, and $15, respectively. The cost of producing one unit of Product B at Facility 1, 2, and 3 is $8, $9, and $11, respectively. The total production of Product A should meet the demand of 100 units, and the total production of Product B should meet the demand of 120 units. Each facility has a production capacity of 50 units per week. Please help the company to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced at each facility\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of Product A produced at Facility 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of Product A produced at Facility 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # number of Product A produced at Facility 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of Product B produced at Facility 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of Product B produced at Facility 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # number of Product B produced at Facility 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Calculate the total production cost\nCost_A_F1 = 10*A_F1\nCost_A_F2 = 12*A_F2\nCost_A_F3 = 15*A_F3\nCost_B_F1 = 8*B_F1\nCost_B_F2 = 9*B_F2\nCost_B_F3 = 11*B_F3\nmodel.addCons(obj == Cost_A_F1 + Cost_A_F2 + Cost_A_F3 + Cost_B_F1 + Cost_B_F2 + Cost_B_F3)\n\n# Add constraints\n## The total production of Product A should meet the demand of 100 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 == 100)\n## The total production of Product B should meet the demand of 120 units.\nmodel.addCons(B_F1 + B_F2 + B_F3 == 120)\n## Each facility has a production capacity of 50 units per week.\nmodel.addCons(A_F1 + B_F1 <= 50)\nmodel.addCons(A_F2 + B_F2 <= 50)\nmodel.addCons(A_F3 + B_F3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced at Facility 1: \", model.getVal(A_F1))\n    print(\"Number of Product A produced at Facility 2: \", model.getVal(A_F2))\n    print(\"Number of Product A produced at Facility 3: \", model.getVal(A_F3))\n    print(\"Number of Product B produced at Facility 1: \", model.getVal(B_F1))\n    print(\"Number of Product B produced at Facility 2: \", model.getVal(B_F2))\n    print(\"Number of Product B produced at Facility 3: \", model.getVal(B_F3))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"availability of raw material\": \"raw_material\", \"range\": \"raw_material >= 0\", \"type\": \"real\"}\n// {\"availability of labor hours\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material available is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe production of each unit of product A requires 3 labor hours, product B requires 2 hours, and product C requires 5 hours. The total labor hours available are 120 hours.\n// 3*A + 2*B + 5*C <= 120\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product C, it is at least 15 units.\n// A >= 10\n// C >= 15",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table shows the requirements for raw materials and labor for each product.\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------|----------------------|\n| A       | $50             | 2 units               | 3 hours              |\n| B       | $70             | 3 units               | 2 hours              |\n| C       | $60             | 4 units               | 5 hours              |\n\nThe total raw material available is 100 units, and the total labor hours available are 120 hours. The market demand for product A is at least 10 units, and for product C, it is at least 15 units. Please help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material available is 100 units.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The production of each unit of product A requires 3 labor hours, product B requires 2 hours, and product C requires 5 hours. The total labor hours available are 120 hours.\nmodel.addCons(3*A + 2*B + 5*C <= 120)\n## The market demand for product A is at least 10 units, and for product C, it is at least 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"availability of raw material\": \"raw_material\", \"range\": \"raw_material >= 0\", \"type\": \"real\"}\n// {\"availability of labor hours\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material available is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe production of each unit of product A requires 3 labor hours, product B requires 2 hours, and product C requires 5 hours. The total labor hours available are 120 hours.\n// 3*A + 2*B + 5*C <= 120\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product C, it is at least 15 units.\n// A >= 10\n// C >= 15",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $70, and product C is $60. The production of each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material available is 100 units. The production of each unit of product A requires 3 labor hours, product B requires 2 hours, and product C requires 5 hours. The total labor hours available are 120 hours. The market demand for product A is at least 10 units, and for product C, it is at least 15 units. Please help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material available is 100 units.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The production of each unit of product A requires 3 labor hours, product B requires 2 hours, and product C requires 5 hours. The total labor hours available are 120 hours.\nmodel.addCons(3*A + 2*B + 5*C <= 120)\n## The market demand for product A is at least 10 units, and for product C, it is at least 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves two stages, each requiring a different type of machine. The manufacturer needs to decide how many units of each product to produce and which machines to use for each stage.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"whether to use Machine 1 for stage 1\": \"use_M1\", \"range\": \"use_M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2 for stage 1\": \"use_M2\", \"range\": \"use_M2 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10 if Machine 1 is used for stage 1, and $12 if Machine 2 is used. The cost of producing one unit of Product B is $15 if Machine 1 is used, and $14 if Machine 2 is used. The fixed cost of using Machine 1 is $500, and Machine 2 is $600. The objective is to minimize the total production cost.\n// Production_Cost_A = 10*A*use_M1 + 12*A*use_M2\n// Production_Cost_B = 15*B*use_M1 + 14*B*use_M2\n// Fixed_Cost = 500*use_M1 + 600*use_M2\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Fixed_Cost\n\n## Generate Constraint-1:\nThe total production capacity for both products is 100 units per day.\n// A + B <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day.\n// A >= 40\n// B >= 30\n\n## Generate Constraint-3:\nOnly one machine can be used for stage 1 each day.\n// use_M1 + use_M2 = 1",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves two stages, each requiring a different type of machine. The manufacturer needs to decide how many units of each product to produce and which machines to use for each stage. The cost of producing one unit of Product A is $10 if Machine 1 is used for stage 1, and $12 if Machine 2 is used. The cost of producing one unit of Product B is $15 if Machine 1 is used, and $14 if Machine 2 is used. The fixed cost of using Machine 1 is $500, and Machine 2 is $600. The objective is to minimize the total production cost.\n\n| Product | Cost with Machine 1 | Cost with Machine 2 |\n|---------|---------------------|---------------------|\n| A       | 10$                 | 12$                 |\n| B       | 15$                 | 14$                 |\n\nThe total production capacity for both products is 100 units per day. The demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day. Only one machine can be used for stage 1 each day.\n\nPlease help the manufacturer to determine the optimal number of units of each product to produce and which machine to use for stage 1 to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## Whether to use each machine for stage 1\nuse_M1 = model.addVar(vtype=\"BINARY\", name=\"use_M1\") # whether to use Machine 1 for stage 1\nuse_M2 = model.addVar(vtype=\"BINARY\", name=\"use_M2\") # whether to use Machine 2 for stage 1\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production cost and fixed cost\nProduction_Cost_A = 10*A*use_M1 + 12*A*use_M2\nProduction_Cost_B = 15*B*use_M1 + 14*B*use_M2\nFixed_Cost = 500*use_M1 + 600*use_M2\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Fixed_Cost)\n\n# Add constraints\n## The total production capacity for both products is 100 units per day.\nmodel.addCons(A + B <= 100)\n## The demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A >= 40)\nmodel.addCons(B >= 30)\n## Only one machine can be used for stage 1 each day.\nmodel.addCons(use_M1 + use_M2 == 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Use Machine 1 for stage 1: \", model.getVal(use_M1))\n    print(\"Use Machine 2 for stage 1: \", model.getVal(use_M2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves two stages, each requiring a different type of machine. The manufacturer needs to decide how many units of each product to produce and which machines to use for each stage.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"whether to use Machine 1 for stage 1\": \"use_M1\", \"range\": \"use_M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2 for stage 1\": \"use_M2\", \"range\": \"use_M2 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10 if Machine 1 is used for stage 1, and $12 if Machine 2 is used. The cost of producing one unit of Product B is $15 if Machine 1 is used, and $14 if Machine 2 is used. The fixed cost of using Machine 1 is $500, and Machine 2 is $600. The objective is to minimize the total production cost.\n// Production_Cost_A = 10*A*use_M1 + 12*A*use_M2\n// Production_Cost_B = 15*B*use_M1 + 14*B*use_M2\n// Fixed_Cost = 500*use_M1 + 600*use_M2\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Fixed_Cost\n\n## Generate Constraint-1:\nThe total production capacity for both products is 100 units per day.\n// A + B <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day.\n// A >= 40\n// B >= 30\n\n## Generate Constraint-3:\nOnly one machine can be used for stage 1 each day.\n// use_M1 + use_M2 = 1",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves two stages, each requiring a different type of machine. The manufacturer needs to decide how many units of each product to produce and which machines to use for each stage.\nThe cost of producing one unit of Product A is $10 if Machine 1 is used for stage 1, and $12 if Machine 2 is used. The cost of producing one unit of Product B is $15 if Machine 1 is used, and $14 if Machine 2 is used. The fixed cost of using Machine 1 is $500, and Machine 2 is $600. The objective is to minimize the total production cost.\nThe total production capacity for both products is 100 units per day. The demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day. Only one machine can be used for stage 1 each day.\nPlease help the manufacturer to determine the optimal number of units of each product to produce and which machine to use for stage 1 to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## Whether to use each machine for stage 1\nuse_M1 = model.addVar(vtype=\"BINARY\", name=\"use_M1\") # whether to use Machine 1 for stage 1\nuse_M2 = model.addVar(vtype=\"BINARY\", name=\"use_M2\") # whether to use Machine 2 for stage 1\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production cost and fixed cost\nProduction_Cost_A = 10*A*use_M1 + 12*A*use_M2\nProduction_Cost_B = 15*B*use_M1 + 14*B*use_M2\nFixed_Cost = 500*use_M1 + 600*use_M2\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Fixed_Cost)\n\n# Add constraints\n## The total production capacity for both products is 100 units per day.\nmodel.addCons(A + B <= 100)\n## The demand for Product A is at least 40 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A >= 40)\nmodel.addCons(B >= 30)\n## Only one machine can be used for stage 1 each day.\nmodel.addCons(use_M1 + use_M2 == 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Use Machine 1 for stage 1: \", model.getVal(use_M1))\n    print(\"Use Machine 2 for stage 1: \", model.getVal(use_M2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer.\n// {\"number of units of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 1\": \"sell_A1\", \"range\": \"sell_A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 2\": \"sell_A2\", \"range\": \"sell_A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 1\": \"sell_B1\", \"range\": \"sell_B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 2\": \"sell_B2\", \"range\": \"sell_B2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Revenue_A = 20*sell_A1 + 25*sell_A2\n// Revenue_B = 30*sell_B1 + 35*sell_B2\n// Objective Function: Maximize: Revenue_A + Revenue_B - Production_Cost\n\n## Generate Constraint-1:\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nRetailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\n// sell_A1 >= 50\n// sell_B1 >= 60\n\n## Generate Constraint-3:\nRetailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\n// sell_A2 >= 40\n// sell_B2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer. The following table summarizes the production costs and selling prices for each product and retailer.\n\n| Product | Production Cost | Retailer 1 Selling Price | Retailer 2 Selling Price |\n|---------|-----------------|---------------------------|---------------------------|\n| A       | $10             | $20                       | $25                       |\n| B       | $15             | $30                       | $35                       |\n\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week. Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B. Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B. \n\nPlease help the company to maximize the profit from selling both products to both retailers, which is defined as the sum of the revenues from selling both products minus the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold to each retailer\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # number of units of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # number of units of Product B produced\nsell_A1 = model.addVar(vtype=\"INTEGER\", name=\"sell_A1\", lb=0) # number of units of Product A sold to Retailer 1\nsell_A2 = model.addVar(vtype=\"INTEGER\", name=\"sell_A2\", lb=0) # number of units of Product A sold to Retailer 2\nsell_B1 = model.addVar(vtype=\"INTEGER\", name=\"sell_B1\", lb=0) # number of units of Product B sold to Retailer 1\nsell_B2 = model.addVar(vtype=\"INTEGER\", name=\"sell_B2\", lb=0) # number of units of Product B sold to Retailer 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Revenue_A = 20*sell_A1 + 25*sell_A2\n## Revenue_B = 30*sell_B1 + 35*sell_B2\nmodel.addCons(obj == (20*sell_A1 + 25*sell_A2 + 30*sell_B1 + 35*sell_B2) - (10*prod_A + 15*prod_B))\n\n# Add constraints\n## The total number of units produced of both products cannot exceed the production capacity of 200 units per week.\nmodel.addCons(prod_A + prod_B <= 200)\n## Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\nmodel.addCons(sell_A1 >= 50)\nmodel.addCons(sell_B1 >= 60)\n## Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\nmodel.addCons(sell_A2 >= 40)\nmodel.addCons(sell_B2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(prod_A))\n    print(\"Number of units of Product B produced: \", model.getVal(prod_B))\n    print(\"Number of units of Product A sold to Retailer 1: \", model.getVal(sell_A1))\n    print(\"Number of units of Product A sold to Retailer 2: \", model.getVal(sell_A2))\n    print(\"Number of units of Product B sold to Retailer 1: \", model.getVal(sell_B1))\n    print(\"Number of units of Product B sold to Retailer 2: \", model.getVal(sell_B2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer.\n// {\"number of units of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 1\": \"sell_A1\", \"range\": \"sell_A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 2\": \"sell_A2\", \"range\": \"sell_A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 1\": \"sell_B1\", \"range\": \"sell_B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 2\": \"sell_B2\", \"range\": \"sell_B2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Revenue_A = 20*sell_A1 + 25*sell_A2\n// Revenue_B = 30*sell_B1 + 35*sell_B2\n// Objective Function: Maximize: Revenue_A + Revenue_B - Production_Cost\n\n## Generate Constraint-1:\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nRetailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\n// sell_A1 >= 50\n// sell_B1 >= 60\n\n## Generate Constraint-3:\nRetailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\n// sell_A2 >= 40\n// sell_B2 >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer. The production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers. The total number of units produced of both products cannot exceed the production capacity of 200 units per week. Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B. Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B. Please help the company to maximize the profit from selling both products to both retailers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold to each retailer\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # number of units of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # number of units of Product B produced\nsell_A1 = model.addVar(vtype=\"INTEGER\", name=\"sell_A1\", lb=0) # number of units of Product A sold to Retailer 1\nsell_A2 = model.addVar(vtype=\"INTEGER\", name=\"sell_A2\", lb=0) # number of units of Product A sold to Retailer 2\nsell_B1 = model.addVar(vtype=\"INTEGER\", name=\"sell_B1\", lb=0) # number of units of Product B sold to Retailer 1\nsell_B2 = model.addVar(vtype=\"INTEGER\", name=\"sell_B2\", lb=0) # number of units of Product B sold to Retailer 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Revenue_A = 20*sell_A1 + 25*sell_A2\n## Revenue_B = 30*sell_B1 + 35*sell_B2\nmodel.addCons(obj == (20*sell_A1 + 25*sell_A2 + 30*sell_B1 + 35*sell_B2) - (10*prod_A + 15*prod_B))\n\n# Add constraints\n## The total number of units produced of both products cannot exceed the production capacity of 200 units per week.\nmodel.addCons(prod_A + prod_B <= 200)\n## Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\nmodel.addCons(sell_A1 >= 50)\nmodel.addCons(sell_B1 >= 60)\n## Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\nmodel.addCons(sell_A2 >= 40)\nmodel.addCons(sell_B2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(prod_A))\n    print(\"Number of units of Product B produced: \", model.getVal(prod_B))\n    print(\"Number of units of Product A sold to Retailer 1: \", model.getVal(sell_A1))\n    print(\"Number of units of Product A sold to Retailer 2: \", model.getVal(sell_A2))\n    print(\"Number of units of Product B sold to Retailer 1: \", model.getVal(sell_B1))\n    print(\"Number of units of Product B sold to Retailer 2: \", model.getVal(sell_B2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units.\n// Wheat + 1.5*Rye + 2*Sourdough <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\n// Wheat >= 30\n// Rye >= 20",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity. The profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery aims to maximize its daily profit.\n\n| Bread Type | Profit per Bread | Flour Required (kg) | Storage Units Required |\n|------------|------------------|---------------------|------------------------|\n| Wheat      | $2               | 0.5                 | 1                      |\n| Rye        | $3               | 0.4                 | 1.5                    |\n| Sourdough  | $4               | 0.6                 | 2                      |\n\nThe bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg. The bakery also has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units. The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\n\nPlease help the bakery determine the optimal number of each type of bread to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a storage capacity of 150 units.\nmodel.addCons(Wheat + 1.5*Rye + 2*Sourdough <= 150)\n## The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of storage units used: \", model.getVal(Storage))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1391,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units.\n// Wheat + 1.5*Rye + 2*Sourdough <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\n// Wheat >= 30\n// Rye >= 20",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity.\nThe profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg. The bakery has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units. The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a storage capacity of 150 units.\nmodel.addCons(Wheat + 1.5*Rye + 2*Sourdough <= 150)\n## The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of storage units used: \", model.getVal(Storage))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources and demand.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of special mix loaves\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread at $2 per loaf, rye bread at $2.50 per loaf, sourdough bread at $3 per loaf, and a special mix bread at $3.50 per loaf. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sour + 3.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast. Each loaf of rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast. Each loaf of sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast. Each loaf of special mix bread requires 0.4 pounds of flour and 0.15 ounces of yeast. The daily supply of flour is 200 pounds and yeast is 30 ounces.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sour + 0.4*Mix <= 200\n// 0.1*Wheat + 0.1*Rye + 0.2*Sour + 0.15*Mix <= 30\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 30 loaves, for sourdough bread is 20 loaves, and for special mix bread is 10 loaves.\n// Wheat >= 50\n// Rye >= 30\n// Sour >= 20\n// Mix >= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. The total number of loaves that can be stored at the end of the day is 150.\n// Wheat + Rye + Sour + Mix <= 150",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and a special mix. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources and demand. The selling price for each type of bread is as follows:\n\n| Bread Type | Selling Price |\n|------------|---------------|\n| Wheat      | $2 per loaf   |\n| Rye        | $2.50 per loaf|\n| Sourdough  | $3 per loaf   |\n| Special Mix| $3.50 per loaf|\n\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast. Each loaf of rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast. Each loaf of sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast. Each loaf of special mix bread requires 0.4 pounds of flour and 0.15 ounces of yeast. The daily supply of flour is 200 pounds and yeast is 30 ounces.\n\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 30 loaves, for sourdough bread is 20 loaves, and for special mix bread is 10 loaves.\n\nThe bakery has a storage capacity limit. The total number of loaves that can be stored at the end of the day is 150.\n\nPlease help the bakery to maximize its daily revenue from bread sales, subject to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of sourdough loaves\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mix loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sour + 3.50*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sour + 0.4*Mix <= 200) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sour + 0.15*Mix <= 30) # yeast constraint\n## The bakery must meet a minimum demand for each type of bread.\nmodel.addCons(Wheat >= 50) # minimum demand for wheat\nmodel.addCons(Rye >= 30) # minimum demand for rye\nmodel.addCons(Sour >= 20) # minimum demand for sourdough\nmodel.addCons(Mix >= 10) # minimum demand for special mix\n## The bakery has a storage capacity limit.\nmodel.addCons(Wheat + Rye + Sour + Mix <= 150) # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of special mix loaves: \", model.getVal(Mix))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources and demand.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of special mix loaves\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread at $2 per loaf, rye bread at $2.50 per loaf, sourdough bread at $3 per loaf, and a special mix bread at $3.50 per loaf. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sour + 3.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast. Each loaf of rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast. Each loaf of sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast. Each loaf of special mix bread requires 0.4 pounds of flour and 0.15 ounces of yeast. The daily supply of flour is 200 pounds and yeast is 30 ounces.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sour + 0.4*Mix <= 200\n// 0.1*Wheat + 0.1*Rye + 0.2*Sour + 0.15*Mix <= 30\n\n## Generate Constraint-2:\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 30 loaves, for sourdough bread is 20 loaves, and for special mix bread is 10 loaves.\n// Wheat >= 50\n// Rye >= 30\n// Sour >= 20\n// Mix >= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. The total number of loaves that can be stored at the end of the day is 150.\n// Wheat + Rye + Sour + Mix <= 150",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough, as well as a special mix bread. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources and demand. The bakery sells wheat bread at $2 per loaf, rye bread at $2.50 per loaf, sourdough bread at $3 per loaf, and special mix bread at $3.50 per loaf. The bakery aims to maximize its daily revenue from bread sales.\n\nThe bakery has a limited supply of flour and yeast. Each loaf of wheat bread requires 0.5 pounds of flour and 0.1 ounces of yeast. Each loaf of rye bread requires 0.4 pounds of flour and 0.1 ounces of yeast. Each loaf of sourdough bread requires 0.3 pounds of flour and 0.2 ounces of yeast. Each loaf of special mix bread requires 0.4 pounds of flour and 0.15 ounces of yeast. The daily supply of flour is 200 pounds and yeast is 30 ounces.\n\nThe bakery must meet a minimum demand for each type of bread. The minimum daily demand for wheat bread is 50 loaves, for rye bread is 30 loaves, for sourdough bread is 20 loaves, and for special mix bread is 10 loaves.\n\nThe bakery also has a storage capacity limit. The total number of loaves that can be stored at the end of the day is 150.\n\nPlease help the bakery to maximize its daily revenue from bread sales while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of sourdough loaves\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mix loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sour + 3.50*Mix)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sour + 0.4*Mix <= 200) # flour constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sour + 0.15*Mix <= 30) # yeast constraint\n## The bakery must meet a minimum demand for each type of bread.\nmodel.addCons(Wheat >= 50) # minimum demand for wheat\nmodel.addCons(Rye >= 30) # minimum demand for rye\nmodel.addCons(Sour >= 20) # minimum demand for sourdough\nmodel.addCons(Mix >= 10) # minimum demand for special mix\n## The bakery has a storage capacity limit.\nmodel.addCons(Wheat + Rye + Sour + Mix <= 150) # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of special mix loaves: \", model.getVal(Mix))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the demand for each type of bread.\n// {\"number of whole wheat breads\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of regular breads\": \"Reg\", \"range\": \"Reg >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each whole wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each regular bread for $2. The bakery aims to determine the optimal number of each type of bread to maximize daily revenue.\n// Objective Function: Maximize: 3*WW + 2.50*Rye + 3.50*Sour + 2*Reg\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each whole wheat bread requires 0.5 kg of flour and 0.05 kg of yeast, each rye bread requires 0.4 kg of flour and 0.04 kg of yeast, each sourdough bread requires 0.6 kg of flour and 0.06 kg of yeast, and each regular bread requires 0.3 kg of flour and 0.03 kg of yeast. The daily supply of flour is 200 kg and yeast is 20 kg.\n// 0.5*WW + 0.4*Rye + 0.6*Sour + 0.3*Reg <= 200\n// 0.05*WW + 0.04*Rye + 0.06*Sour + 0.03*Reg <= 20\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for whole wheat, rye, sourdough, and regular breads is 30, 40, 20, and 50, respectively.\n// WW >= 30, Rye >= 40, Sour >= 20, Reg >= 50\n\n## Generate Constraint-3:\nThe bakery has a production capacity limit. The total number of breads produced daily should not exceed 200.\n// WW + Rye + Sour + Reg <= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and regular. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the demand for each type of bread. The selling price for each type of bread is given in the following Table.\n\n| Bread Type   | Selling Price |\n|--------------|---------------|\n| Whole Wheat  | $3            |\n| Rye          | $2.50         |\n| Sourdough    | $3.50         |\n| Regular      | $2            |\n\nThe bakery has a limited supply of flour and yeast. Each whole wheat bread requires 0.5 kg of flour and 0.05 kg of yeast, each rye bread requires 0.4 kg of flour and 0.04 kg of yeast, each sourdough bread requires 0.6 kg of flour and 0.06 kg of yeast, and each regular bread requires 0.3 kg of flour and 0.03 kg of yeast. The daily supply of flour is 200 kg and yeast is 20 kg. The bakery must meet a minimum daily demand for each type of bread. The minimum demand for whole wheat, rye, sourdough, and regular breads is 30, 40, 20, and 50, respectively. The bakery has a production capacity limit. The total number of breads produced daily should not exceed 200.\n\nPlease help the bakery determine the optimal number of each type of bread to maximize daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of sourdough breads\nReg = model.addVar(vtype=\"INTEGER\", name=\"Reg\", lb=0) # number of regular breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WW + 2.50*Rye + 3.50*Sour + 2*Reg)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.6*Sour + 0.3*Reg <= 200) # flour constraint\nmodel.addCons(0.05*WW + 0.04*Rye + 0.06*Sour + 0.03*Reg <= 20) # yeast constraint\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 30)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sour >= 20)\nmodel.addCons(Reg >= 50)\n## The bakery has a production capacity limit.\nmodel.addCons(WW + Rye + Sour + Reg <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WW))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sour))\n    print(\"Number of regular breads: \", model.getVal(Reg))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: whole wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the demand for each type of bread.\n// {\"number of whole wheat breads\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of regular breads\": \"Reg\", \"range\": \"Reg >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells each whole wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each regular bread for $2. The bakery aims to determine the optimal number of each type of bread to maximize daily revenue.\n// Objective Function: Maximize: 3*WW + 2.50*Rye + 3.50*Sour + 2*Reg\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and yeast. Each whole wheat bread requires 0.5 kg of flour and 0.05 kg of yeast, each rye bread requires 0.4 kg of flour and 0.04 kg of yeast, each sourdough bread requires 0.6 kg of flour and 0.06 kg of yeast, and each regular bread requires 0.3 kg of flour and 0.03 kg of yeast. The daily supply of flour is 200 kg and yeast is 20 kg.\n// 0.5*WW + 0.4*Rye + 0.6*Sour + 0.3*Reg <= 200\n// 0.05*WW + 0.04*Rye + 0.06*Sour + 0.03*Reg <= 20\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for whole wheat, rye, sourdough, and regular breads is 30, 40, 20, and 50, respectively.\n// WW >= 30, Rye >= 40, Sour >= 20, Reg >= 50\n\n## Generate Constraint-3:\nThe bakery has a production capacity limit. The total number of breads produced daily should not exceed 200.\n// WW + Rye + Sour + Reg <= 200",
        "question": "A bakery produces three types of bread: whole wheat, rye, and sourdough, as well as regular bread. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and the demand for each type of bread. The bakery sells each whole wheat bread for $3, each rye bread for $2.50, each sourdough bread for $3.50, and each regular bread for $2. The bakery has a limited supply of flour and yeast, with a daily supply of 200 kg of flour and 20 kg of yeast. Each whole wheat bread requires 0.5 kg of flour and 0.05 kg of yeast, each rye bread requires 0.4 kg of flour and 0.04 kg of yeast, each sourdough bread requires 0.6 kg of flour and 0.06 kg of yeast, and each regular bread requires 0.3 kg of flour and 0.03 kg of yeast. The bakery must meet a minimum daily demand for each type of bread, with the minimum demand for whole wheat, rye, sourdough, and regular breads being 30, 40, 20, and 50, respectively. Additionally, the bakery has a production capacity limit, with the total number of breads produced daily not exceeding 200.\n\nPlease help the bakery determine the optimal number of each type of bread to maximize daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of sourdough breads\nReg = model.addVar(vtype=\"INTEGER\", name=\"Reg\", lb=0) # number of regular breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WW + 2.50*Rye + 3.50*Sour + 2*Reg)\n\n# Add constraints\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.6*Sour + 0.3*Reg <= 200) # flour constraint\nmodel.addCons(0.05*WW + 0.04*Rye + 0.06*Sour + 0.03*Reg <= 20) # yeast constraint\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 30)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sour >= 20)\nmodel.addCons(Reg >= 50)\n## The bakery has a production capacity limit.\nmodel.addCons(WW + Rye + Sour + Reg <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WW))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sour))\n    print(\"Number of regular breads: \", model.getVal(Reg))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily.\n// {\"number of wheat bread batches\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread batches\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling bread. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively.\n// Objective Function: Maximize: 5w + 6r + 7s + 8g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 batches per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 batches of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\n// Constraint-3: s <= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively. The bakery has a limited oven capacity of 200 batches per day. The bakery has a contract to supply at least 30 batches of rye bread daily. Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\n\nPlease help the bakery to maximize its daily profit from selling bread.\n\n| Type of Bread | Profit per Batch |\n|---------------|------------------|\n| Wheat         | $5               |\n| Rye           | $6               |\n| Sourdough     | $7               |\n| Whole Grain   | $8               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of batches of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread batches\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread batches\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread batches\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread batches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*w + 6*r + 7*s + 8*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 batches per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 batches of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\nmodel.addCons(s <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread batches: \", model.getVal(w))\n    print(\"Number of rye bread batches: \", model.getVal(r))\n    print(\"Number of sourdough bread batches: \", model.getVal(s))\n    print(\"Number of whole grain bread batches: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily.\n// {\"number of wheat bread batches\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread batches\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling bread. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively.\n// Objective Function: Maximize: 5w + 6r + 7s + 8g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 batches per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 batches of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\n// Constraint-3: s <= 50",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively. The bakery aims to maximize its daily profit. The bakery has a limited oven capacity of 200 batches per day. The bakery has a contract to supply at least 30 batches of rye bread daily. Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily. Please help the bakery determine the optimal number of batches of each type of bread to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of batches of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread batches\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread batches\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread batches\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread batches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*w + 6*r + 7*s + 8*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 batches per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 batches of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\nmodel.addCons(s <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread batches: \", model.getVal(w))\n    print(\"Number of rye bread batches: \", model.getVal(r))\n    print(\"Number of sourdough bread batches: \", model.getVal(s))\n    print(\"Number of whole grain bread batches: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 661,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a market demand constraint for Product C. The maximum number of units of Product C that can be sold is 10 units.\n// Constraint: c <= 10",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n| C       | 40$             |\n| D       | 20$             |\n\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units. The production capacity is also limited; each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours. Additionally, the company has a market demand constraint for Product C, where the maximum number of units of Product C that can be sold is 10 units.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a market demand constraint for Product C.\nmodel.addCons(c <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a market demand constraint for Product C. The maximum number of units of Product C that can be sold is 10 units.\n// Constraint: c <= 10",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day are 50 hours. Additionally, the maximum number of units of Product C that can be sold is 10 units. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a market demand constraint for Product C.\nmodel.addCons(c <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 810,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily. The pastries include croissants, muffins, eclairs, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling these pastries. The price of croissants is $2, muffins are $3, eclairs are $4, and donuts are $2.\n// Objective Function: Maximize: 2c + 3m + 4e + 2d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredients required for each pastry are as follows: croissants require 1 unit, muffins require 2 units, eclairs require 3 units, and donuts require 1 unit. The total daily supply of ingredients is 150 units.\n// Constraint-1: c + 2m + 3e + d <= 150\n\n## Generate Constraint-2:\nThe bakery also has a limited workforce. Each pastry requires a certain amount of labor time: croissants require 0.5 hours, muffins require 1 hour, eclairs require 1.5 hours, and donuts require 0.5 hours. The total daily labor hours available are 50 hours.\n// Constraint-2: 0.5c + m + 1.5e + 0.5d <= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from regular customers.\n// Constraint-3: c >= 20\n// Constraint-4: m >= 20\n// Constraint-5: e >= 20\n// Constraint-6: d >= 20",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily. The pastries include croissants, muffins, eclairs, and donuts. The bakery aims to maximize its daily revenue from selling these pastries. The price of croissants is $2, muffins are $3, eclairs are $4, and donuts are $2. The bakery has a limited daily supply of ingredients and a limited workforce. The ingredients required for each pastry and the labor time required for each pastry are given in the following Table.\n\n| Pastry   | Price | Ingredients Required | Labor Time Required |\n|----------|-------|----------------------|---------------------|\n| Croissant| $2    | 1 unit               | 0.5 hours           |\n| Muffin   | $3    | 2 units              | 1 hour              |\n| Eclair   | $4    | 3 units              | 1.5 hours           |\n| Donut    | $2    | 1 unit               | 0.5 hours           |\n\nThe total daily supply of ingredients is 150 units. The total daily labor hours available are 50 hours. The bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from regular customers. Please help the bakery to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 4*e + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredients.\nmodel.addCons(c + 2*m + 3*e + d <= 150)\n## The bakery also has a limited workforce.\nmodel.addCons(0.5*c + m + 1.5*e + 0.5*d <= 50)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(e >= 20)\nmodel.addCons(d >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily. The pastries include croissants, muffins, eclairs, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling these pastries. The price of croissants is $2, muffins are $3, eclairs are $4, and donuts are $2.\n// Objective Function: Maximize: 2c + 3m + 4e + 2d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredients required for each pastry are as follows: croissants require 1 unit, muffins require 2 units, eclairs require 3 units, and donuts require 1 unit. The total daily supply of ingredients is 150 units.\n// Constraint-1: c + 2m + 3e + d <= 150\n\n## Generate Constraint-2:\nThe bakery also has a limited workforce. Each pastry requires a certain amount of labor time: croissants require 0.5 hours, muffins require 1 hour, eclairs require 1.5 hours, and donuts require 0.5 hours. The total daily labor hours available are 50 hours.\n// Constraint-2: 0.5c + m + 1.5e + 0.5d <= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from regular customers.\n// Constraint-3: c >= 20\n// Constraint-4: m >= 20\n// Constraint-5: e >= 20\n// Constraint-6: d >= 20",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily. The pastries include croissants, muffins, eclairs, and donuts. The bakery aims to maximize its daily revenue from selling these pastries. The price of croissants is $2, muffins are $3, eclairs are $4, and donuts are $2. The bakery has a limited daily supply of ingredients, with a total daily supply of 150 units. Each croissant requires 1 unit, each muffin requires 2 units, each eclair requires 3 units, and each donut requires 1 unit. The bakery also has a limited workforce, with a total daily labor hours available of 50 hours. Each croissant requires 0.5 hours, each muffin requires 1 hour, each eclair requires 1.5 hours, and each donut requires 0.5 hours. The bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from regular customers. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize its revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 4*e + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredients.\nmodel.addCons(c + 2*m + 3*e + d <= 150)\n## The bakery also has a limited workforce.\nmodel.addCons(0.5*c + m + 1.5*e + 0.5*d <= 50)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(e >= 20)\nmodel.addCons(d >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D).\n// {\"number of units of Product A\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 40b + 30c + 20d\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 200 units per day.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nThe raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\n// Constraint-2: 2a + 3b + c + 4d <= 500\n\n## Generate Constraint-3:\nDue to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\n// Constraint-3: a >= 2d",
        "question": "A company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D). The company aims to maximize its total profit from selling these products, with the profit per unit for each product as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 40$             |\n| C       | 30$             |\n| D       | 20$             |\n\nThe company has a production capacity of 200 units per day. The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively, and the daily supply of raw material is limited to 500 units. Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 40*b + 30*c + 20*d)\n\n# Add constraints\n## The production capacity of the company is limited to 200 units per day.\nmodel.addCons(a + b + c + d <= 200)\n## The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\nmodel.addCons(2*a + 3*b + c + 4*d <= 500)\n## Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\nmodel.addCons(a >= 2*d)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D).\n// {\"number of units of Product A\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 40b + 30c + 20d\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 200 units per day.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nThe raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\n// Constraint-2: 2a + 3b + c + 4d <= 500\n\n## Generate Constraint-3:\nDue to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\n// Constraint-3: a >= 2d",
        "question": "A company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D). The company aims to maximize its total profit from selling these products, with profits of $50 per unit of Product A, $40 per unit of Product B, $30 per unit of Product C, and $20 per unit of Product D. The production capacity of the company is limited to 200 units per day. The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively, with a daily supply of raw material limited to 500 units. Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 40*b + 30*c + 20*d)\n\n# Add constraints\n## The production capacity of the company is limited to 200 units per day.\nmodel.addCons(a + b + c + d <= 200)\n## The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\nmodel.addCons(2*a + 3*b + c + 4*d <= 500)\n## Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\nmodel.addCons(a >= 2*d)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 1000\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 800\", \"type\": \"integer\"}\n// {\"number of cookies\": \"co\", \"range\": \"0 <= co <= 1200\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 900\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling pastries.\n// Objective Function: Maximize: 2c + 3m + 1.5co + 2.5d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 2000 grams. Each croissant requires 50 grams, each muffin requires 60 grams, each cookie requires 30 grams, and each donut requires 40 grams.\n// Constraint: 50c + 60m + 30co + 40d <= 2000\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of sugar, which is 1000 grams. Each croissant requires 20 grams, each muffin requires 15 grams, each cookie requires 10 grams, and each donut requires 25 grams.\n// Constraint: 20c + 15m + 10co + 25d <= 1000\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\n// Constraint: c + m + co + d >= 200",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts. The bakery aims to maximize its daily revenue from selling pastries. The following table shows the amount of flour and sugar required for each type of pastry:\n\n| Pastry   | Flour (grams) | Sugar (grams) |\n|----------|---------------|---------------|\n| Croissant| 50            | 20            |\n| Muffin   | 60            | 15            |\n| Cookie   | 30            | 10            |\n| Donut    | 40            | 25            |\n\nThe bakery has a limited daily supply of flour, which is 2000 grams, and a limited daily supply of sugar, which is 1000 grams. The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand. Please help the bakery to determine the optimal number of each type of pastry to produce daily to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=1000) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=800) # number of muffins\nco = model.addVar(vtype=\"INTEGER\", name=\"co\", lb=0, ub=1200) # number of cookies\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=900) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*co + 2.5*d)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(50*c + 60*m + 30*co + 40*d <= 2000)\n## The bakery also has a limited daily supply of sugar.\nmodel.addCons(20*c + 15*m + 10*co + 25*d <= 1000)\n## The bakery must ensure that at least 200 pastries are produced daily.\nmodel.addCons(c + m + co + d >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of cookies: \", model.getVal(co))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 1000\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 800\", \"type\": \"integer\"}\n// {\"number of cookies\": \"co\", \"range\": \"0 <= co <= 1200\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 900\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling pastries.\n// Objective Function: Maximize: 2c + 3m + 1.5co + 2.5d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 2000 grams. Each croissant requires 50 grams, each muffin requires 60 grams, each cookie requires 30 grams, and each donut requires 40 grams.\n// Constraint: 50c + 60m + 30co + 40d <= 2000\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of sugar, which is 1000 grams. Each croissant requires 20 grams, each muffin requires 15 grams, each cookie requires 10 grams, and each donut requires 25 grams.\n// Constraint: 20c + 15m + 10co + 25d <= 1000\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\n// Constraint: c + m + co + d >= 200",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts. The bakery aims to maximize its daily revenue from selling pastries. The bakery has a limited daily supply of flour, which is 2000 grams. Each croissant requires 50 grams, each muffin requires 60 grams, each cookie requires 30 grams, and each donut requires 40 grams. The bakery also has a limited daily supply of sugar, which is 1000 grams. Each croissant requires 20 grams, each muffin requires 15 grams, each cookie requires 10 grams, and each donut requires 25 grams. The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand. Please help the bakery to maximize its daily revenue from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=1000) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=800) # number of muffins\nco = model.addVar(vtype=\"INTEGER\", name=\"co\", lb=0, ub=1200) # number of cookies\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=900) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*co + 2.5*d)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(50*c + 60*m + 30*co + 40*d <= 2000)\n## The bakery also has a limited daily supply of sugar.\nmodel.addCons(20*c + 15*m + 10*co + 25*d <= 1000)\n## The bakery must ensure that at least 200 pastries are produced daily.\nmodel.addCons(c + m + co + d >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of cookies: \", model.getVal(co))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The details of each product's production requirements and profit are given in the following Table.\n\n| Product | Profit per Unit | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------|-------------------------|\n| A       | 50$             | 3 units               | 2 hours                 |\n| B       | 30$             | 2 units               | 1 hour                  |\n| C       | 40$             | 4 units               | 3 hours                 |\n| D       | 20$             | 1 unit                | 1 hour                  |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production capacity is also limited, with a total of 50 hours available per day. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day are 50 hours. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3w + 2r + 4s + 5g (where each coefficient represents the profit per loaf of bread)\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\n// Constraint-3: s <= 50",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit from selling these four types of bread, where the profit per loaf is $3 for wheat, $2 for rye, $4 for sourdough, and $5 for whole grain. The bakery has a limited oven capacity of 200 loaves per day. It also has a contract to supply at least 30 loaves of rye bread daily. Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily. The production quantities for each type of bread must be within the following ranges: wheat (0 to 100), rye (0 to 100), sourdough (0 to 100), and whole grain (0 to 100).\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $3              |\n| Rye           | $2              |\n| Sourdough     | $4              |\n| Whole Grain   | $5              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # quantity of sourdough bread\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 2*r + 4*s + 5*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\nmodel.addCons(s <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of whole grain bread: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3w + 2r + 4s + 5g (where each coefficient represents the profit per loaf of bread)\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\n// Constraint-3: s <= 50",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit from selling these four types of bread, where the profit per loaf is $3 for wheat, $2 for rye, $4 for sourdough, and $5 for whole grain. The bakery has a limited oven capacity of 200 loaves per day. It also has a contract to supply at least 30 loaves of rye bread daily. Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # quantity of sourdough bread\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 2*r + 4*s + 5*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\nmodel.addCons(s <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of whole grain bread: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 658,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 2 hours. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + 2d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the required raw material and production time for each product.\n\n| Product | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------------|--------------------------|\n| A       | 3 units               | 2 hours                  |\n| B       | 2 units               | 1 hour                   |\n| C       | 4 units               | 3 hours                  |\n| D       | 1 unit                | 2 hours                  |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The total production hours available per day is 50 hours. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, given the objective function: Maximize: 50a + 30b + 40c + 20d.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + 2*d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 2 hours. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + 2d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 2 hours to produce. The total raw material available is 100 units, and the total production hours available per day is 50 hours. Additionally, the company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + 2*d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries (pastry A, B, C, and D). The bakery needs to decide how many of each type of pastry to produce daily.\n// {\"number of pastry A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of pastry B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of pastry C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of pastry D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling the pastries.\n// Objective Function: Maximize: 3a + 5b + 4c + 2d (where 3, 5, 4, and 2 are the profits per unit of pastry A, B, C, and D respectively)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n- Pastry A requires 2 units of ingredient X.\n- Pastry B requires 3 units of ingredient X.\n- Pastry C requires 4 units of ingredient X.\n- Pastry D requires 1 unit of ingredient X.\nThe total daily supply of ingredient X is 20 units.\n// Constraint: 2a + 3b + 4c + d <= 20\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient Y:\n- Pastry A requires 1 unit of ingredient Y.\n- Pastry B requires 2 units of ingredient Y.\n- Pastry C requires 3 units of ingredient Y.\n- Pastry D requires 2 units of ingredient Y.\nThe total daily supply of ingredient Y is 15 units.\n// Constraint: a + 2b + 3c + 2d <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 units of pastry D daily due to a contractual agreement.\n// Constraint: d >= 5",
        "question": "A bakery produces four types of pastries (pastry A, B, C, and D) and needs to decide how many of each type to produce daily. The bakery aims to maximize its daily profit from selling the pastries. The profit per unit for each pastry type is as follows:\n\n| Pastry | Profit per Unit |\n|--------|-----------------|\n| A      | 3$              |\n| B      | 5$              |\n| C      | 4$              |\n| D      | 2$              |\n\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n\n| Pastry | Ingredient X Required | Ingredient Y Required |\n|--------|-----------------------|----------------------|\n| A      | 2 units               | 1 unit               |\n| B      | 3 units               | 2 units              |\n| C      | 4 units               | 3 units              |\n| D      | 1 unit                | 2 units              |\n\nThe total daily supply of ingredient X is 20 units, and the total daily supply of ingredient Y is 15 units. The bakery must also produce at least 5 units of pastry D daily due to a contractual agreement.\n\nPlease help the bakery to maximize its daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of pastry A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of pastry B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of pastry C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of pastry D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*a + 5*b + 4*c + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient X.\nmodel.addCons(2*a + 3*b + 4*c + d <= 20)\n## The bakery also has a limited daily supply of ingredient Y.\nmodel.addCons(a + 2*b + 3*c + 2*d <= 15)\n## The bakery must produce at least 5 units of pastry D daily.\nmodel.addCons(d >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of pastry A produced: \", model.getVal(a))\n    print(\"Number of pastry B produced: \", model.getVal(b))\n    print(\"Number of pastry C produced: \", model.getVal(c))\n    print(\"Number of pastry D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries (pastry A, B, C, and D). The bakery needs to decide how many of each type of pastry to produce daily.\n// {\"number of pastry A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of pastry B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of pastry C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of pastry D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling the pastries.\n// Objective Function: Maximize: 3a + 5b + 4c + 2d (where 3, 5, 4, and 2 are the profits per unit of pastry A, B, C, and D respectively)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n- Pastry A requires 2 units of ingredient X.\n- Pastry B requires 3 units of ingredient X.\n- Pastry C requires 4 units of ingredient X.\n- Pastry D requires 1 unit of ingredient X.\nThe total daily supply of ingredient X is 20 units.\n// Constraint: 2a + 3b + 4c + d <= 20\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient Y:\n- Pastry A requires 1 unit of ingredient Y.\n- Pastry B requires 2 units of ingredient Y.\n- Pastry C requires 3 units of ingredient Y.\n- Pastry D requires 2 units of ingredient Y.\nThe total daily supply of ingredient Y is 15 units.\n// Constraint: a + 2b + 3c + 2d <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 units of pastry D daily due to a contractual agreement.\n// Constraint: d >= 5",
        "question": "A bakery produces four types of pastries (pastry A, B, C, and D) and needs to decide how many of each type to produce daily. The bakery aims to maximize its daily profit from selling the pastries, where the profit per unit of pastry A, B, C, and D is $3, $5, $4, and $2 respectively. The bakery has a limited daily supply of ingredients: 20 units of ingredient X and 15 units of ingredient Y. Each pastry A requires 2 units of ingredient X and 1 unit of ingredient Y, each pastry B requires 3 units of ingredient X and 2 units of ingredient Y, each pastry C requires 4 units of ingredient X and 3 units of ingredient Y, and each pastry D requires 1 unit of ingredient X and 2 units of ingredient Y. Additionally, the bakery must produce at least 5 units of pastry D daily due to a contractual agreement. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of pastry A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of pastry B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of pastry C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of pastry D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*a + 5*b + 4*c + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient X.\nmodel.addCons(2*a + 3*b + 4*c + d <= 20)\n## The bakery also has a limited daily supply of ingredient Y.\nmodel.addCons(a + 2*b + 3*c + 2*d <= 15)\n## The bakery must produce at least 5 units of pastry D daily.\nmodel.addCons(d >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of pastry A produced: \", model.getVal(a))\n    print(\"Number of pastry B produced: \", model.getVal(b))\n    print(\"Number of pastry C produced: \", model.getVal(c))\n    print(\"Number of pastry D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum demand for each product. The minimum demand for Product A is 2 units, for Product B is 3 units, for Product C is 1 unit, and for Product D is 4 units.\n// Constraint-3: a >= 2, b >= 3, c >= 1, d >= 4",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the profit per unit, raw material requirements, and production time for each product.\n\n| Product | Profit per Unit | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------|--------------------------|\n| A       | 50$             | 3 units               | 2 hours                  |\n| B       | 30$             | 2 units               | 1 hour                   |\n| C       | 40$             | 4 units               | 3 hours                  |\n| D       | 20$             | 1 unit                | 1 hour                   |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production line has a limited capacity, with a total of 50 hours available per day. The company also has a minimum demand for each product: 2 units for Product A, 3 units for Product B, 1 unit for Product C, and 4 units for Product D.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum demand for each product.\nmodel.addCons(a >= 2)\nmodel.addCons(b >= 3)\nmodel.addCons(c >= 1)\nmodel.addCons(d >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum demand for each product. The minimum demand for Product A is 2 units, for Product B is 3 units, for Product C is 1 unit, and for Product D is 4 units.\n// Constraint-3: a >= 2, b >= 3, c >= 1, d >= 4",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day are 50 hours. The company has a minimum demand for each product: 2 units for Product A, 3 units for Product B, 1 unit for Product C, and 4 units for Product D.\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum demand for each product.\nmodel.addCons(a >= 2)\nmodel.addCons(b >= 3)\nmodel.addCons(c >= 1)\nmodel.addCons(d >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not.\n// {\"whether to produce Product A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 500y1 + 300y2 + 400y3 + 200y4\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10y1 + 5y2 + 15y3 + 8y4 <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The total production time for all products must not exceed 80 hours.\n// Constraint-2: 20y1 + 10y2 + 30y3 + 15y4 <= 80\n\n## Generate Constraint-3:\nThe company has a policy to produce at least one of the products from each category (A, B, C, D).\n// Constraint-3: y1 + y2 + y3 + y4 >= 1",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not. The company aims to maximize its total profit from the production of these products. The profit from producing each product is as follows:\n\n| Product | Profit |\n|---------|--------|\n| A       | 500    |\n| B       | 300    |\n| C       | 400    |\n| D       | 200    |\n\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units. The production line has a limited capacity, and the total production time for all products must not exceed 80 hours. The company has a policy to produce at least one of the products from each category (A, B, C, D).\n\nPlease help the company determine whether to produce each product to maximize its total profit, subject to the constraints on raw materials and production time, and ensuring at least one product from each category is produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to produce Product A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to produce Product B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to produce Product C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500*y1 + 300*y2 + 400*y3 + 200*y4)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*y1 + 5*y2 + 15*y3 + 8*y4 <= 1000)\n## The total production time for all products must not exceed 80 hours.\nmodel.addCons(20*y1 + 10*y2 + 30*y3 + 15*y4 <= 80)\n## The company has a policy to produce at least one of the products from each category (A, B, C, D).\nmodel.addCons(y1 + y2 + y3 + y4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(y1))\n    print(\"Whether to produce Product B: \", model.getVal(y2))\n    print(\"Whether to produce Product C: \", model.getVal(y3))\n    print(\"Whether to produce Product D: \", model.getVal(y4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not.\n// {\"whether to produce Product A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 500y1 + 300y2 + 400y3 + 200y4\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10y1 + 5y2 + 15y3 + 8y4 <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The total production time for all products must not exceed 80 hours.\n// Constraint-2: 20y1 + 10y2 + 30y3 + 15y4 <= 80\n\n## Generate Constraint-3:\nThe company has a policy to produce at least one of the products from each category (A, B, C, D).\n// Constraint-3: y1 + y2 + y3 + y4 >= 1",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision is whether to produce each product or not. The company aims to maximize its total profit from the production of these products. The production of each product requires a certain amount of raw materials, and the total raw materials available are limited to 1000 units. The production line has a limited capacity, and the total production time for all products must not exceed 80 hours. The company has a policy to produce at least one of the products from each category (A, B, C, D). Please help the company determine whether to produce each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to produce Product A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to produce Product B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to produce Product C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500*y1 + 300*y2 + 400*y3 + 200*y4)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*y1 + 5*y2 + 15*y3 + 8*y4 <= 1000)\n## The total production time for all products must not exceed 80 hours.\nmodel.addCons(20*y1 + 10*y2 + 30*y3 + 15*y4 <= 80)\n## The company has a policy to produce at least one of the products from each category (A, B, C, D).\nmodel.addCons(y1 + y2 + y3 + y4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(y1))\n    print(\"Whether to produce Product B: \", model.getVal(y2))\n    print(\"Whether to produce Product C: \", model.getVal(y3))\n    print(\"Whether to produce Product D: \", model.getVal(y4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability.\n// {\"number of widgets A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of widgets B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of widgets C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of widgets D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. The raw material requirements per widget are 3 units for A, 4 units for B, 5 units for C, and 6 units for D. The total available raw materials are 100 units.\n// Constraint-1: 3a + 4b + 5c + 6d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The time required to produce each widget is 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D. The total available production time is 20 hours.\n// Constraint-2: 2a + 3b + 2.5c + 3.5d <= 20\n\n## Generate Constraint-3:\nThe company has a contractual obligation to produce at least 2 widgets of type C.\n// Constraint-3: c >= 2",
        "question": "A company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability. The company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D. The raw material requirements per widget and the production time for each widget are given in the following Table.\n\n| Widget | Profit per Widget | Raw Material Requirement | Production Time |\n|--------|-------------------|--------------------------|-----------------|\n| A      | 5$                | 3 units                  | 2 hours         |\n| B      | 7$                | 4 units                  | 3 hours         |\n| C      | 6$                | 5 units                  | 2.5 hours       |\n| D      | 8$                | 6 units                  | 3.5 hours       |\n\nThe company has a limited supply of raw materials, with a total of 100 units available. The production line has a limited capacity, with a total available production time of 20 hours. The company also has a contractual obligation to produce at least 2 widgets of type C.\n\nPlease help the company determine the optimal number of widgets A, B, C, and D to produce in order to maximize its total profit, while adhering to the constraints on raw materials and production time, and fulfilling the contractual obligation for type C widgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of widgets A-D produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of widgets A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of widgets B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of widgets C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of widgets D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(3*a + 4*b + 5*c + 6*d <= 100)\n## The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + 2.5*c + 3.5*d <= 20)\n## The company has a contractual obligation to produce at least 2 widgets of type C.\nmodel.addCons(c >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of widgets A produced: \", model.getVal(a))\n    print(\"Number of widgets B produced: \", model.getVal(b))\n    print(\"Number of widgets C produced: \", model.getVal(c))\n    print(\"Number of widgets D produced: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability.\n// {\"number of widgets A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of widgets B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of widgets C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of widgets D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. The raw material requirements per widget are 3 units for A, 4 units for B, 5 units for C, and 6 units for D. The total available raw materials are 100 units.\n// Constraint-1: 3a + 4b + 5c + 6d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The time required to produce each widget is 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D. The total available production time is 20 hours.\n// Constraint-2: 2a + 3b + 2.5c + 3.5d <= 20\n\n## Generate Constraint-3:\nThe company has a contractual obligation to produce at least 2 widgets of type C.\n// Constraint-3: c >= 2",
        "question": "A company produces four types of widgets (widgets A-D) and can adjust the production of each type based on demand and resource availability. The company aims to maximize its total profit from the sale of all widget types, with a profit per widget of $5 for A, $7 for B, $6 for C, and $8 for D. The company has a limited supply of raw materials, with requirements of 3 units for A, 4 units for B, 5 units for C, and 6 units for D, and a total of 100 units available. The production line also has a limited capacity, with time requirements of 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D, and a total of 20 hours available. Additionally, the company has a contractual obligation to produce at least 2 widgets of type C.\n\nPlease help the company determine the optimal number of widgets to produce (a, b, c, d) to maximize its total profit, subject to the constraints of raw material availability, production time, and the contractual obligation for type C widgets.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of widgets A-D produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of widgets A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of widgets B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of widgets C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of widgets D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(3*a + 4*b + 5*c + 6*d <= 100)\n## The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + 2.5*c + 3.5*d <= 20)\n## The company has a contractual obligation to produce at least 2 widgets of type C.\nmodel.addCons(c >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of widgets A produced: \", model.getVal(a))\n    print(\"Number of widgets B produced: \", model.getVal(b))\n    print(\"Number of widgets C produced: \", model.getVal(c))\n    print(\"Number of widgets D produced: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 3b1 + 4b2 + 5b3 + 6b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg.\n// Constraint: 0.5b1 + 0.7b2 + 0.8b3 + 1b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 15 kg. Each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg.\n// Constraint: 0.1b1 + 0.2b2 + 0.3b3 + 0.4b4 <= 15\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\n// Constraint: b1 >= 20",
        "question": "A bakery produces four types of bread (Bread 1-4) and must decide how many loaves of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling bread. The requirements for flour and yeast per loaf, as well as the daily supply limits, are given in the following Table.\n\n| Bread Type | Flour Required (kg) | Yeast Required (kg) |\n|------------|---------------------|---------------------|\n| Bread 1    | 0.5                 | 0.1                 |\n| Bread 2    | 0.7                 | 0.2                 |\n| Bread 3    | 0.8                 | 0.3                 |\n| Bread 4    | 1.0                 | 0.4                 |\n\nThe bakery has a limited daily supply of 100 kg of flour and 15 kg of yeast. Additionally, the bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\nPlease help the bakery to maximize its daily profit, which is defined as 3 times the number of loaves of Bread 1, plus 4 times the number of loaves of Bread 2, plus 5 times the number of loaves of Bread 3, plus 6 times the number of loaves of Bread 4.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 6*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour, which is 100 kg.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.8*b3 + 1*b4 <= 100)\n## The bakery also has a limited daily supply of yeast, which is 15 kg.\nmodel.addCons(0.1*b1 + 0.2*b2 + 0.3*b3 + 0.4*b4 <= 15)\n## The bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\nmodel.addCons(b1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 3b1 + 4b2 + 5b3 + 6b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg.\n// Constraint: 0.5b1 + 0.7b2 + 0.8b3 + 1b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 15 kg. Each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg.\n// Constraint: 0.1b1 + 0.2b2 + 0.3b3 + 0.4b4 <= 15\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\n// Constraint: b1 >= 20",
        "question": "A bakery produces four types of bread (bread 1-4) and must decide how many loaves of each type of bread to produce daily. The bakery wants to maximize its daily profit from selling bread. The bakery has a limited daily supply of flour, which is 100 kg, and each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg. The bakery also has a limited daily supply of yeast, which is 15 kg, and each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg. Additionally, the bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement. Please help the bakery maximize its daily profit from selling bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 6*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour, which is 100 kg.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.8*b3 + 1*b4 <= 100)\n## The bakery also has a limited daily supply of yeast, which is 15 kg.\nmodel.addCons(0.1*b1 + 0.2*b2 + 0.3*b3 + 0.4*b4 <= 15)\n## The bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\nmodel.addCons(b1 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $400,000 for production costs. The company has a total of 12,000 hours available for assembly. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $400,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $400,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $50                      | 2 hours                |\n| Tablets      | $150            | $70                      | 3 hours                |\n| Laptops      | $200            | $100                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 12,000 hours available for assembly. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 10,000 hours available for assembly. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit.\nThe company has a total production capacity of 5000 units. The production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 10,000 hours available for assembly.\nPlease help the company determine the optimal number of units to produce for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and manufacturing cost per unit for each device are given in the following Table.\n\n| Device       | Profit per Unit | Manufacturing Cost per Unit |\n|--------------|-----------------|-----------------------------|\n| Smartphones  | $100            | $50                         |\n| Tablets      | $150            | $70                         |\n| Laptops      | $200            | $100                        |\n| Smartwatches | $50             | $30                         |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $200,000 for manufacturing costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $200,000 for manufacturing costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company has a total production capacity of 5000 units. The manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $200,000 for manufacturing costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability.\n// {\"number of dozens of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 dozens of pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\n// Doughnuts + Eclairs <= 120",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability. The profit per dozen for each type of pastry is as follows:\n\n| Pastry   | Profit per Dozen |\n|----------|------------------|\n| Croissants | $10            |\n| Muffins    | $8             | |\n| Doughnuts  | $12            |\n| Eclairs    | $15            |\n\nThe bakery has a daily production capacity of 200 dozens of pastries. The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined. Additionally, the bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of dozens of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of dozens of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of dozens of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of dozens of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of dozens of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 dozens of pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 200)\n## The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\nmodel.addCons(Doughnuts + Eclairs <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of dozens of croissants: \", model.getVal(Croissants))\n    print(\"Number of dozens of muffins: \", model.getVal(Muffins))\n    print(\"Number of dozens of doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of dozens of eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability.\n// {\"number of dozens of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 dozens of pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\n// Doughnuts + Eclairs <= 120",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability. The profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery has a daily production capacity of 200 dozens of pastries. The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined. The bakery also has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of dozens of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of dozens of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of dozens of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of dozens of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of dozens of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 dozens of pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 200)\n## The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\nmodel.addCons(Doughnuts + Eclairs <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of dozens of croissants: \", model.getVal(Croissants))\n    print(\"Number of dozens of muffins: \", model.getVal(Muffins))\n    print(\"Number of dozens of doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of dozens of eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Total_Profit = 100*Smartphones + 150*Tablets + 200*Laptops\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops <= 5000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100.\n// 50*Smartphones + 75*Tablets + 100*Laptops <= 600000\n\n## Generate Constraint-3:\nThe company has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40.\n// 20*Smartphones + 30*Tablets + 40*Laptops <= 200000",
        "question": "A company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints. The profit per unit and the costs associated with each device are given in the following Table.\n\n| Device     | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit |\n|------------|-----------------|----------------------------|---------------------|\n| Smartphones| $100            | $50                        | $20                 |\n| Tablets    | $150            | $75                        | $30                 |\n| Laptops    | $200            | $100                       | $40                 |\n\nThe company has a total production capacity of 5000 units. The company has a limited budget for raw materials, which cannot exceed $600,000. The company also has a labor constraint, with a maximum labor cost of $200,000.\n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to manufacture\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 5000)\n## The company has a limited budget for raw materials, which cannot exceed $600,000.\nmodel.addCons(50*Smartphones + 75*Tablets + 100*Laptops <= 600000)\n## The company has a labor constraint, with a maximum labor cost of $200,000.\nmodel.addCons(20*Smartphones + 30*Tablets + 40*Laptops <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Total_Profit = 100*Smartphones + 150*Tablets + 200*Laptops\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops <= 5000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100.\n// 50*Smartphones + 75*Tablets + 100*Laptops <= 600000\n\n## Generate Constraint-3:\nThe company has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40.\n// 20*Smartphones + 30*Tablets + 40*Laptops <= 200000",
        "question": "A company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company has a total production capacity of 5000 units. The company has a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100. The company also has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to manufacture\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 5000)\n## The company has a limited budget for raw materials, which cannot exceed $600,000.\nmodel.addCons(50*Smartphones + 75*Tablets + 100*Laptops <= 600000)\n## The company has a labor constraint, with a maximum labor cost of $200,000.\nmodel.addCons(20*Smartphones + 30*Tablets + 40*Laptops <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits.\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50.\nThe cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20.\nThe bakery wants to maximize its daily profit.\n// Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n// Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// Whole_Wheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for daily ingredient costs.\n// Total_Cost <= 2000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\n// Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain)",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits. The selling price and cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type       | Selling Price | Cost of Ingredients |\n|------------------|---------------|---------------------|\n| Whole Wheat      | $3            | $1.50               |\n| Rye              | $4            | $2                  |\n| Sourdough        | $5            | $2.50               |\n| Multigrain       | $4.50         | $2.20               |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery has a budget of $2000 for daily ingredient costs. The bakery also has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced. \n\nPlease help the bakery to maximize its daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n## Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\nmodel.addCons(obj == (3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain) - (1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain))\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a budget of $2000 for daily ingredient costs.\nmodel.addCons(1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain <= 2000)\n## The bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits.\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50.\nThe cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20.\nThe bakery wants to maximize its daily profit.\n// Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n// Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// Whole_Wheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for daily ingredient costs.\n// Total_Cost <= 2000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\n// Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain)",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits. The selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50. The cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20. The bakery has a daily production capacity of 1000 loaves and a budget of $2000 for daily ingredient costs. Additionally, the bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n## Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\nmodel.addCons(obj == (3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain) - (1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain))\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a budget of $2000 for daily ingredient costs.\nmodel.addCons(1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain <= 2000)\n## The bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide on the optimal number of each type of bread to bake and the number of ovens to rent for each type.\n// {\"number of wheat bread to bake\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread to bake\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of wheat ovens to rent\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of rye ovens to rent\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread is $3, and the revenue per rye bread is $4. \nThe cost per wheat bread is $1, and the cost per rye bread is $2. \nThe rental cost per wheat oven per day is $50, and the rental cost per rye oven per day is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours. Each day, 12 hours of oven time are available.\n// 2*Wheat_Bread + 3*Rye_Bread <= 12\n\n## Generate Constraint-2:\nThe flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg. Each day, 8 kg of flour are available.\n// Wheat_Bread + Rye_Bread <= 8\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of bread.\n// Wheat_Ovens >= 1, Rye_Ovens >= 1",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide on the optimal number of each type of bread to bake and the number of ovens to rent for each type. The revenue and cost details for each type of bread and the rental cost for each type of oven are given in the following Table.\n\n| Type       | Revenue per Bread | Cost per Bread | Rental Cost per Oven per Day |\n|------------|-------------------|----------------|------------------------------|\n| Wheat Bread| $3                | $1             | $50                          |\n| Rye Bread  | $4                | $2             | $60                          |\n\nThe bakery wants to maximize the daily profit. The baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours, with a total of 12 hours of oven time available each day. The flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg, with a total of 8 kg of flour available each day. The bakery needs to rent at least one oven for each type of bread.\n\nPlease help the bakery determine the optimal number of each type of bread to bake and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake and the number of ovens to rent for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread to bake\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread to bake\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of wheat ovens to rent\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of rye ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread - (1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens))\n\n# Add constraints\n## The baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours. Each day, 12 hours of oven time are available.\nmodel.addCons(2*Wheat_Bread + 3*Rye_Bread <= 12)\n## The flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg. Each day, 8 kg of flour are available.\nmodel.addCons(Wheat_Bread + Rye_Bread <= 8)\n## The bakery needs to rent at least one oven for each type of bread.\nmodel.addCons(Wheat_Ovens >= 1)\nmodel.addCons(Rye_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread to bake: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread to bake: \", model.getVal(Rye_Bread))\n    print(\"Number of wheat ovens to rent: \", model.getVal(Wheat_Ovens))\n    print(\"Number of rye ovens to rent: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide on the optimal number of each type of bread to bake and the number of ovens to rent for each type.\n// {\"number of wheat bread to bake\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread to bake\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of wheat ovens to rent\": \"Wheat_Ovens\", \"range\": \"Wheat_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of rye ovens to rent\": \"Rye_Ovens\", \"range\": \"Rye_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per wheat bread is $3, and the revenue per rye bread is $4. \nThe cost per wheat bread is $1, and the cost per rye bread is $2. \nThe rental cost per wheat oven per day is $50, and the rental cost per rye oven per day is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours. Each day, 12 hours of oven time are available.\n// 2*Wheat_Bread + 3*Rye_Bread <= 12\n\n## Generate Constraint-2:\nThe flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg. Each day, 8 kg of flour are available.\n// Wheat_Bread + Rye_Bread <= 8\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of bread.\n// Wheat_Ovens >= 1, Rye_Ovens >= 1",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to decide on the optimal number of each type of bread to bake and the number of ovens to rent for each type. The revenue per wheat bread is $3, and the revenue per rye bread is $4. The cost per wheat bread is $1, and the cost per rye bread is $2. The rental cost per wheat oven per day is $50, and the rental cost per rye oven per day is $60. The bakery wants to maximize the daily profit. The baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours. Each day, 12 hours of oven time are available. The flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg. Each day, 8 kg of flour are available. The bakery needs to rent at least one oven for each type of bread. Please help the bakery determine the optimal number of each type of bread to bake and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake and the number of ovens to rent for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread to bake\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread to bake\nWheat_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ovens\", lb=0) # number of wheat ovens to rent\nRye_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ovens\", lb=0) # number of rye ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread - (1*Wheat_Bread + 2*Rye_Bread + 50*Wheat_Ovens + 60*Rye_Ovens))\n\n# Add constraints\n## The baking time required per wheat bread is 2 hours, and the baking time required per rye bread is 3 hours. Each day, 12 hours of oven time are available.\nmodel.addCons(2*Wheat_Bread + 3*Rye_Bread <= 12)\n## The flour required per wheat bread is 1 kg, and the flour required per rye bread is 1 kg. Each day, 8 kg of flour are available.\nmodel.addCons(Wheat_Bread + Rye_Bread <= 8)\n## The bakery needs to rent at least one oven for each type of bread.\nmodel.addCons(Wheat_Ovens >= 1)\nmodel.addCons(Rye_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread to bake: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread to bake: \", model.getVal(Rye_Bread))\n    print(\"Number of wheat ovens to rent: \", model.getVal(Wheat_Ovens))\n    print(\"Number of rye ovens to rent: \", model.getVal(Rye_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of labor to allocate to each type of bread.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"labor hours for wheat bread\": \"Labor_Wheat\", \"range\": \"Labor_Wheat >= 0\", \"type\": \"real\"}\n// {\"labor hours for rye bread\": \"Labor_Rye\", \"range\": \"Labor_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe labor cost per hour is $10.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available daily. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each loaf of wheat bread requires 0.2 kg of wheat flour, and each loaf of rye bread requires 0.3 kg of rye flour. The total available flour is 25 kg.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= 25\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of bread daily to meet minimum customer demand.\n// Wheat_Bread + Rye_Bread >= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of labor to allocate to each type of bread. The revenue and cost details for each type of bread are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Labor Hours per Loaf |\n|------------|------------------|---------------|----------------------|\n| Wheat      | $3               | $1            | 0.5                  |\n| Rye        | $4               | $2            | 0.75                 |\n\nThe bakery has a total of 100 labor hours available daily. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor. The bakery has a limited supply of ingredients, with each loaf of wheat bread requiring 0.2 kg of wheat flour and each loaf of rye bread requiring 0.3 kg of rye flour, and the total available flour is 25 kg. The bakery must produce at least 20 loaves of bread daily to meet minimum customer demand. \n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the labor hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nLabor_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Wheat\", lb=0) # labor hours for wheat bread\nLabor_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Rye\", lb=0) # labor hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye))\n\n# Add constraints\n## The bakery has a total of 100 labor hours available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 100)\n## Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\nmodel.addCons(Labor_Wheat == 0.5*Wheat_Bread)\nmodel.addCons(Labor_Rye == 0.75*Rye_Bread)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= 25)\n## The bakery must produce at least 20 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Bread + Rye_Bread >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Labor hours for wheat bread: \", model.getVal(Labor_Wheat))\n    print(\"Labor hours for rye bread: \", model.getVal(Labor_Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of labor to allocate to each type of bread.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"labor hours for wheat bread\": \"Labor_Wheat\", \"range\": \"Labor_Wheat >= 0\", \"type\": \"real\"}\n// {\"labor hours for rye bread\": \"Labor_Rye\", \"range\": \"Labor_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe labor cost per hour is $10.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available daily. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each loaf of wheat bread requires 0.2 kg of wheat flour, and each loaf of rye bread requires 0.3 kg of rye flour. The total available flour is 25 kg.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= 25\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of bread daily to meet minimum customer demand.\n// Wheat_Bread + Rye_Bread >= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of labor to allocate to each type of bread. The revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. The cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. The labor cost per hour is $10. The bakery has a total of 100 labor hours available daily. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor. The bakery has a limited supply of ingredients. Each loaf of wheat bread requires 0.2 kg of wheat flour, and each loaf of rye bread requires 0.3 kg of rye flour. The total available flour is 25 kg. The bakery must produce at least 20 loaves of bread daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the labor hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nLabor_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Wheat\", lb=0) # labor hours for wheat bread\nLabor_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Rye\", lb=0) # labor hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = 1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (1*Wheat_Bread + 2*Rye_Bread + 10*Labor_Wheat + 10*Labor_Rye))\n\n# Add constraints\n## The bakery has a total of 100 labor hours available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 100)\n## Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\nmodel.addCons(Labor_Wheat == 0.5*Wheat_Bread)\nmodel.addCons(Labor_Rye == 0.75*Rye_Bread)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= 25)\n## The bakery must produce at least 20 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Bread + Rye_Bread >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Labor hours for wheat bread: \", model.getVal(Labor_Wheat))\n    print(\"Labor hours for rye bread: \", model.getVal(Labor_Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of oven time to allocate for each type of bread.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"hours of oven time for wheat bread\": \"Wheat_Oven_Time\", \"range\": \"Wheat_Oven_Time >= 0\", \"type\": \"real\"}\n// {\"hours of oven time for rye bread\": \"Rye_Oven_Time\", \"range\": \"Rye_Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost of oven time per hour for wheat bread is $10, and the cost of oven time per hour for rye bread is $15.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The total daily oven time available is 10 hours.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each loaf of wheat bread requires 0.2 kg of flour, and each loaf of rye bread requires 0.3 kg of flour.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of oven time to allocate for each type of bread. The revenue and costs associated with each type of bread are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Oven Time per Loaf | Oven Time Cost per Hour |\n|------------|------------------|---------------|---------------------|-------------------------|\n| Wheat      | $3               | $1            | 0.5 hours           | $10                     |\n| Rye        | $4               | $2            | 0.75 hours          | $15                     |\n\nThe bakery has a total daily oven time available of 10 hours. The bakery also has a daily supply of 20 kg of flour, with each loaf of wheat bread requiring 0.2 kg of flour and each loaf of rye bread requiring 0.3 kg of flour. The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves and oven time for each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Time\", lb=0) # hours of oven time for wheat bread\nRye_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Time\", lb=0) # hours of oven time for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time))\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The total daily oven time available is 10 hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 10)\n## The bakery has a daily supply of 20 kg of flour. Each loaf of wheat bread requires 0.2 kg of flour, and each loaf of rye bread requires 0.3 kg of flour.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Hours of oven time for wheat bread: \", model.getVal(Wheat_Oven_Time))\n    print(\"Hours of oven time for rye bread: \", model.getVal(Rye_Oven_Time))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1177,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of oven time to allocate for each type of bread.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"hours of oven time for wheat bread\": \"Wheat_Oven_Time\", \"range\": \"Wheat_Oven_Time >= 0\", \"type\": \"real\"}\n// {\"hours of oven time for rye bread\": \"Rye_Oven_Time\", \"range\": \"Rye_Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost of oven time per hour for wheat bread is $10, and the cost of oven time per hour for rye bread is $15.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The total daily oven time available is 10 hours.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each loaf of wheat bread requires 0.2 kg of flour, and each loaf of rye bread requires 0.3 kg of flour.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type to produce daily, as well as how many hours of oven time to allocate for each type of bread. The revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. The cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. The cost of oven time per hour for wheat bread is $10, and the cost of oven time per hour for rye bread is $15. Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The total daily oven time available is 10 hours. The bakery has a daily supply of 20 kg of flour. Each loaf of wheat bread requires 0.2 kg of flour, and each loaf of rye bread requires 0.3 kg of flour. The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves and oven time for each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Oven_Time\", lb=0) # hours of oven time for wheat bread\nRye_Oven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Oven_Time\", lb=0) # hours of oven time for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (Wheat_Bread + 2*Rye_Bread + 10*Wheat_Oven_Time + 15*Rye_Oven_Time))\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The total daily oven time available is 10 hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 10)\n## The bakery has a daily supply of 20 kg of flour. Each loaf of wheat bread requires 0.2 kg of flour, and each loaf of rye bread requires 0.3 kg of flour.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Hours of oven time for wheat bread: \", model.getVal(Wheat_Oven_Time))\n    print(\"Hours of oven time for rye bread: \", model.getVal(Rye_Oven_Time))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and eclairs. The bakery needs to decide on the optimal number of each type of pastry to produce and the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of eclair ovens to rent\": \"Eclair_Ovens\", \"range\": \"Eclair_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per eclair is $4. \nThe cost per croissant is $1, and the cost per eclair is $2. \nThe rental cost per croissant oven per day is $50, and the rental cost per eclair oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 4*Eclairs\n// Total_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, and the time required to bake an eclair is 20 minutes. Each day, the bakery has 8 hours of baking time available.\n// 15*Croissants + 20*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe flour required per croissant is 100 grams, and the flour required per eclair is 150 grams. Each day, the bakery has 10 kilograms of flour available.\n// 100*Croissants + 150*Eclairs <= 10000\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Eclair_Ovens >= 1",
        "question": "A bakery specializes in producing two types of pastries: croissants and eclairs. The bakery needs to decide on the optimal number of each type of pastry to produce and the number of ovens to rent for each type of pastry. The revenue and cost details for each pastry and the rental cost for each type of oven are given in the following Table.\n\n| Pastry       | Revenue per Unit | Cost per Unit | Time to Bake (minutes) | Flour Required (grams) |\n|--------------|------------------|---------------|------------------------|------------------------|\n| Croissants   | $3               | $1            | 15                     | 100                    |\n| Eclairs      | $4               | $2            | 20                     | 150                    |\n\n| Oven Type       | Rental Cost per Day |\n|------------------|---------------------|\n| Croissant Ovens | $50                 |\n| Eclair Ovens    | $40                 |\n\nThe bakery has 8 hours of baking time available each day and 10 kilograms of flour. The bakery needs to rent at least one oven for each type of pastry. The bakery wants to maximize the daily profit. Please help the bakery determine the optimal number of each type of pastry to produce and the number of ovens to rent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nEclair_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Eclair_Ovens\", lb=0) # number of eclair ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 4*Eclairs\nTotal_Revenue = 3*Croissants + 4*Eclairs\n## Total_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\nTotal_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, and the time required to bake an eclair is 20 minutes. Each day, the bakery has 8 hours of baking time available.\nmodel.addCons(15*Croissants + 20*Eclairs <= 8 * 60)\n## The flour required per croissant is 100 grams, and the flour required per eclair is 150 grams. Each day, the bakery has 10 kilograms of flour available.\nmodel.addCons(100*Croissants + 150*Eclairs <= 10000)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Eclair_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of eclair ovens to rent: \", model.getVal(Eclair_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and eclairs. The bakery needs to decide on the optimal number of each type of pastry to produce and the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of eclair ovens to rent\": \"Eclair_Ovens\", \"range\": \"Eclair_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per eclair is $4. \nThe cost per croissant is $1, and the cost per eclair is $2. \nThe rental cost per croissant oven per day is $50, and the rental cost per eclair oven per day is $40.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 4*Eclairs\n// Total_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, and the time required to bake an eclair is 20 minutes. Each day, the bakery has 8 hours of baking time available.\n// 15*Croissants + 20*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe flour required per croissant is 100 grams, and the flour required per eclair is 150 grams. Each day, the bakery has 10 kilograms of flour available.\n// 100*Croissants + 150*Eclairs <= 10000\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Eclair_Ovens >= 1",
        "question": "A bakery specializes in producing two types of pastries: croissants and eclairs. The bakery needs to decide on the optimal number of each type of pastry to produce and the number of ovens to rent for each type of pastry. The revenue per croissant is $3, and the revenue per eclair is $4. The cost per croissant is $1, and the cost per eclair is $2. The rental cost per croissant oven per day is $50, and the rental cost per eclair oven per day is $40. The bakery wants to maximize the daily profit. The time required to bake a croissant is 15 minutes, and the time required to bake an eclair is 20 minutes. Each day, the bakery has 8 hours of baking time available. The flour required per croissant is 100 grams, and the flour required per eclair is 150 grams. Each day, the bakery has 10 kilograms of flour available. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery determine the optimal production and oven rental strategy to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nEclair_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Eclair_Ovens\", lb=0) # number of eclair ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 4*Eclairs\nTotal_Revenue = 3*Croissants + 4*Eclairs\n## Total_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\nTotal_Cost = 1*Croissants + 2*Eclairs + 50*Croissant_Ovens + 40*Eclair_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, and the time required to bake an eclair is 20 minutes. Each day, the bakery has 8 hours of baking time available.\nmodel.addCons(15*Croissants + 20*Eclairs <= 8 * 60)\n## The flour required per croissant is 100 grams, and the flour required per eclair is 150 grams. Each day, the bakery has 10 kilograms of flour available.\nmodel.addCons(100*Croissants + 150*Eclairs <= 10000)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Eclair_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of eclair ovens to rent: \", model.getVal(Eclair_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 993,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\n// 2*A + 3*B + 2*C + 1*D <= 200\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\n// 4*A + 5*B + 3*C + 2*D <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units.\n// A <= 20\n// D >= 10",
        "question": "A manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce. The profit per unit for products A-D is $50, $70, $40, and $30 respectively. The following table summarizes the raw material and labor requirements for each product.\n\n| Product | Raw Material (kg) | Labor Hours |\n|---------|-------------------|-------------|\n| A       | 2                 | 4           |\n| B       | 3                 | 5           |\n| C       | 2                 | 3           |\n| D       | 1                 | 2           |\n\nThe manufacturer has 200 kg of raw materials and 150 labor hours available. The market demand for Product A is at most 20 units, and for Product D is at least 10 units. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 2*C + 1*D <= 200)\n## Each unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nmodel.addCons(4*A + 5*B + 3*C + 2*D <= 150)\n## The market demand for Product A is at most 20 units, and for Product D is at least 10 units.\nmodel.addCons(A <= 20)\nmodel.addCons(D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\n// 2*A + 3*B + 2*C + 1*D <= 200\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\n// 4*A + 5*B + 3*C + 2*D <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units.\n// A <= 20\n// D >= 10",
        "question": "A manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce. The profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units.\nPlease help the manufacturer determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 2*C + 1*D <= 200)\n## Each unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nmodel.addCons(4*A + 5*B + 3*C + 2*D <= 150)\n## The market demand for Product A is at most 20 units, and for Product D is at least 10 units.\nmodel.addCons(A <= 20)\nmodel.addCons(D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\n// 5*A + 7*B + 4*C + 6*D <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $10             | $5                       |\n| B       | $15             | $7                       |\n| C       | $8              | $4                       |\n| D       | $12             | $6                       |\n\nThe company has a budget of $1000 for production. The company has a limited workforce that can produce at most 100 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 1000)\n## The company has a limited workforce that can produce at most 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\n// 5*A + 7*B + 4*C + 6*D <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit. The production cost per unit for products A-D is $5, $7, $4, and $6 respectively, and the company has a budget of $1000 for production. The company has a limited workforce that can produce at most 100 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 1000)\n## The company has a limited workforce that can produce at most 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 30*A + 45*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\n// 4*A + 6*B + 2*C + 5*D <= 150\n\n## Generate Constraint-3:\nThe company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\n// A + B + C + D <= 30",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce. The profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The following table shows the labor hours and raw material requirements for each product.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Materials per Unit |\n|---------|-----------------|----------------------|------------------------|\n| A       | $30             | 2                    | 4                      |\n| B       | $45             | 3                    | 6                      |\n| C       | $20             | 1                    | 2                      |\n| D       | $25             | 2                    | 5                      |\n\nThe total available labor hours are 100 hours, and the total available raw materials are 150 units. The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products. Please help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 45*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\nmodel.addCons(4*A + 6*B + 2*C + 5*D <= 150)\n## The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\nmodel.addCons(A + B + C + D <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 30*A + 45*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\n// 4*A + 6*B + 2*C + 5*D <= 150\n\n## Generate Constraint-3:\nThe company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\n// A + B + C + D <= 30",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively, with a total available labor hours of 100 hours. The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively, with a total available raw materials of 150 units. The company also has a storage capacity limit that allows for a maximum of 30 units of any combination of products. Please help the company decide how many units of each product to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 45*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\nmodel.addCons(4*A + 6*B + 2*C + 5*D <= 150)\n## The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\nmodel.addCons(A + B + C + D <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2                    | 3                           |\n| B       | 15$             | 3                    | 2                           |\n| C       | 20$             | 4                    | 1                           |\n| D       | 25$             | 5                    | 4                           |\n\nThe company has a total of 100 labor hours and 60 units of raw material available. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100. The company also has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. Please help the company determine the optimal quantity of each product to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\n// 3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n\n| Cake Type | Profit per Cake | Labor Hours per Cake | Units of Ingredients per Cake |\n|-----------|-----------------|----------------------|-------------------------------|\n| 1         | $5              | 2                    | 3                             |\n| 2         | $7              | 3                    | 4                             |\n| 3         | $6              | 2                    | 3                             |\n| 4         | $4              | 1                    | 2                             |\n\nThe bakery has a total of 20 labor hours available. The bakery has a limited supply of ingredients, with a total of 30 units available. The bakery wants to ensure that at least two types of cakes are produced. Please help the bakery to maximize the total profit from selling the cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\nmodel.addCons(3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\n// 3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively, and the bakery has a total of 20 labor hours available. The bakery also has a limited supply of ingredients, with each cake type 1-4 requiring 3, 4, 3, and 2 units of ingredients respectively, and a total of 30 units available. Additionally, the bakery wants to ensure that at least two types of cakes are produced.\nPlease help the bakery to maximize the total profit from selling the cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\nmodel.addCons(3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------|----------------------|\n| A       | $10             | 2 kg                   | 1 hour               |\n| B       | $15             | 3 kg                   | 2 hours              |\n| C       | $20             | 4 kg                   | 3 hours              |\n| D       | $25             | 5 kg                   | 4 hours              |\n\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit, considering the constraints on raw materials, labor hours, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1444,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nPlease help the company determine the optimal number of units of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $10             | 2 kg                    | 1 hour               |\n| B       | $15             | 3 kg                    | 2 hours              |\n| C       | $20             | 4 kg                    | 3 hours              |\n| D       | $25             | 5 kg                    | 4 hours              |\n\nThe company has 100 kg of raw materials available and 50 labor hours available. The company must produce at least 5 units of Product A.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company must produce at least 5 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost).\n// Objective Function: Maximize: (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D\n\n## Generate Constraint-1:\nThe total production cost must not exceed $1500.\n// 10*A + 15*B + 12*C + 8*D <= 1500\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 100.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nAt least 20 units of Product A must be produced.\n// A >= 20",
        "question": "A manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit and the production cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit |\n|---------|------------------|--------------------------|\n| A       | $20              | $10                      |\n| B       | $30              | $15                      |\n| C       | $25              | $12                      |\n| D       | $15              | $8                       |\n\nThe company wants to maximize the net profit (revenue minus cost). The total production cost must not exceed $1500. The total number of units produced must not exceed 100. At least 20 units of Product A must be produced. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D)\n\n# Add constraints\n## The total production cost must not exceed $1500.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 1500)\n## The total number of units produced must not exceed 100.\nmodel.addCons(A + B + C + D <= 100)\n## At least 20 units of Product A must be produced.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost).\n// Objective Function: Maximize: (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D\n\n## Generate Constraint-1:\nThe total production cost must not exceed $1500.\n// 10*A + 15*B + 12*C + 8*D <= 1500\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 100.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nAt least 20 units of Product A must be produced.\n// A >= 20",
        "question": "A manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost). The total production cost must not exceed $1500. The total number of units produced must not exceed 100. At least 20 units of Product A must be produced. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D)\n\n# Add constraints\n## The total production cost must not exceed $1500.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 1500)\n## The total number of units produced must not exceed 100.\nmodel.addCons(A + B + C + D <= 100)\n## At least 20 units of Product A must be produced.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 656,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit.\n// {\"amount of resources allocated to Project 1\": \"R1\", \"range\": \"0 <= R1 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 2\": \"R2\", \"range\": \"0 <= R2 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 3\": \"R3\", \"range\": \"0 <= R3 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 4\": \"R4\", \"range\": \"0 <= R4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 20*R1 + 30*R2 + 15*R3 + 25*R4\n\n## Generate Constraint-1:\nThe total resources available for allocation are 200 units.\n// R1 + R2 + R3 + R4 <= 200\n\n## Generate Constraint-2:\nProject 1 and Project 2 cannot receive more than 80 units of resources combined.\n// R1 + R2 <= 80\n\n## Generate Constraint-3:\nAt least 40 units of resources must be allocated to Project 3.\n// R3 >= 40",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit. The profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit. The total resources available for allocation are 200 units. Project 1 and Project 2 cannot receive more than 80 units of resources combined. At least 40 units of resources must be allocated to Project 3.\n\nPlease help the company determine the optimal allocation of resources to each project to maximize its profit, given the following constraints:\n\n| Project | Profit per Unit of Resource |\n|---------|------------------------------|\n| 1       | $20                          |\n| 2       | $30                          |\n| 3       | $15                          |\n| 4       | $25                          |\n\nConstraints:\n1. The total resources allocated to all projects (R1 + R2 + R3 + R4) must not exceed 200 units.\n2. The combined resources allocated to Project 1 and Project 2 (R1 + R2) must not exceed 80 units.\n3. At least 40 units of resources must be allocated to Project 3 (R3 >= 40).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of resources allocated to each project\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=100) # amount of resources allocated to Project 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=100) # amount of resources allocated to Project 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=100) # amount of resources allocated to Project 3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0, ub=100) # amount of resources allocated to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*R1 + 30*R2 + 15*R3 + 25*R4)\n\n# Add constraints\n## The total resources available for allocation are 200 units.\nmodel.addCons(R1 + R2 + R3 + R4 <= 200)\n## Project 1 and Project 2 cannot receive more than 80 units of resources combined.\nmodel.addCons(R1 + R2 <= 80)\n## At least 40 units of resources must be allocated to Project 3.\nmodel.addCons(R3 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of resources allocated to Project 1: \", model.getVal(R1))\n    print(\"Amount of resources allocated to Project 2: \", model.getVal(R2))\n    print(\"Amount of resources allocated to Project 3: \", model.getVal(R3))\n    print(\"Amount of resources allocated to Project 4: \", model.getVal(R4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit.\n// {\"amount of resources allocated to Project 1\": \"R1\", \"range\": \"0 <= R1 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 2\": \"R2\", \"range\": \"0 <= R2 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 3\": \"R3\", \"range\": \"0 <= R3 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 4\": \"R4\", \"range\": \"0 <= R4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 20*R1 + 30*R2 + 15*R3 + 25*R4\n\n## Generate Constraint-1:\nThe total resources available for allocation are 200 units.\n// R1 + R2 + R3 + R4 <= 200\n\n## Generate Constraint-2:\nProject 1 and Project 2 cannot receive more than 80 units of resources combined.\n// R1 + R2 <= 80\n\n## Generate Constraint-3:\nAt least 40 units of resources must be allocated to Project 3.\n// R3 >= 40",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit. The profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit. The total resources available for allocation are 200 units. Project 1 and Project 2 cannot receive more than 80 units of resources combined. At least 40 units of resources must be allocated to Project 3. Please help the company determine the optimal allocation of resources to each project.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of resources allocated to each project\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=100) # amount of resources allocated to Project 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=100) # amount of resources allocated to Project 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=100) # amount of resources allocated to Project 3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0, ub=100) # amount of resources allocated to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*R1 + 30*R2 + 15*R3 + 25*R4)\n\n# Add constraints\n## The total resources available for allocation are 200 units.\nmodel.addCons(R1 + R2 + R3 + R4 <= 200)\n## Project 1 and Project 2 cannot receive more than 80 units of resources combined.\nmodel.addCons(R1 + R2 <= 80)\n## At least 40 units of resources must be allocated to Project 3.\nmodel.addCons(R3 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of resources allocated to Project 1: \", model.getVal(R1))\n    print(\"Amount of resources allocated to Project 2: \", model.getVal(R2))\n    print(\"Amount of resources allocated to Project 3: \", model.getVal(R3))\n    print(\"Amount of resources allocated to Project 4: \", model.getVal(R4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 613,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-50)*A + (150-75)*B + (200-100)*C + (250-125)*D\n// Objective Function: Maximize: 50*A + 75*B + 100*C + 125*D\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 50*A + 75*B + 100*C + 125*D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of Product A.\n// A >= 10",
        "question": "A manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce. The revenue and production cost for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit |\n|---------|------------------|--------------------------|\n| A       | $100             | $50                      |\n| B       | $150             | $75                      |\n| C       | $200             | $100                     |\n| D       | $250             | $125                     |\n\nThe company has a total production budget of $10,000. The company has a limited workforce that can produce a maximum of 100 units in total. The company must produce at least 10 units of Product A. \nPlease help the company to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 75*B + 100*C + 125*D)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 10000)\n## The company has a limited workforce that can produce a maximum of 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## The company must produce at least 10 units of Product A.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-50)*A + (150-75)*B + (200-100)*C + (250-125)*D\n// Objective Function: Maximize: 50*A + 75*B + 100*C + 125*D\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 50*A + 75*B + 100*C + 125*D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of Product A.\n// A >= 10",
        "question": "A manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce. The revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit. The company has a total production budget of $10,000. The company has a limited workforce that can produce a maximum of 100 units in total. The company must produce at least 10 units of Product A. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 75*B + 100*C + 125*D)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 10000)\n## The company has a limited workforce that can produce a maximum of 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## The company must produce at least 10 units of Product A.\nmodel.addCons(A >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 689,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\n// 2*A + 3*B + 4*C + 5*D <= 60\n\n## Generate Constraint-2:\nThe labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\n// A + 2*B + 3*C + 4*D <= 40\n\n## Generate Constraint-3:\nThe company can produce at most 10 units of Product A.\n// A <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg. The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours. The company can produce at most 10 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.\n\n| Product | Profit per Unit | Raw Materials Required (kg) | Labor Hours Required |\n|---------|-----------------|-----------------------------|----------------------|\n| A       | $10             | 2                           | 1                    |\n| B       | $15             | 3                           | 2                    |\n| C       | $20             | 4                           | 3                    |\n| D       | $25             | 5                           | 4                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 60)\n## The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 40)\n## The company can produce at most 10 units of Product A.\nmodel.addCons(A <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\n// 2*A + 3*B + 4*C + 5*D <= 60\n\n## Generate Constraint-2:\nThe labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\n// A + 2*B + 3*C + 4*D <= 40\n\n## Generate Constraint-3:\nThe company can produce at most 10 units of Product A.\n// A <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg. The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours. The company can produce at most 10 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 60)\n## The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 40)\n## The company can produce at most 10 units of Product A.\nmodel.addCons(A <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Material (kg) | Labor Hours |\n|---------|-------------------|-------------|\n| A       | 2                 | 1           |\n| B       | 3                 | 2           |\n| C       | 4                 | 3           |\n| D       | 5                 | 4           |\n\nThe company has 100 kg of raw material available and 50 labor hours available. The company must produce at least 5 units of Product A. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company must produce at least 5 units of Product A.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n// D <= 250\n\n## Generate Constraint-2:\nThe total production time for all products must not exceed 500 hours. The production time per unit for products A, B, C, and D is 2, 3, 4, and 5 hours respectively.\n// 2*A + 3*B + 4*C + 5*D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A.\n// A >= 50",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production time per unit for products A, B, C, and D is 2, 3, 4, and 5 hours respectively. The company has the following constraints:\n\n| Product | Production Capacity | Production Time per Unit |\n|---------|---------------------|--------------------------|\n| A       | 100 units           | 2 hours                  |\n| B       | 150 units           | 3 hours                  |\n| C       | 200 units           | 4 hours                  |\n| D       | 250 units           | 5 hours                  |\n\nThe production capacity for each product is limited as shown in the table. The total production time for all products must not exceed 500 hours. The company must also produce at least 50 units of product A.\n\nPlease help the company to maximize the total profit by determining the optimal quantity of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\nmodel.addCons(D <= 250)\n## The total production time for all products must not exceed 500 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 500)\n## The company must produce at least 50 units of product A.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n// D <= 250\n\n## Generate Constraint-2:\nThe total production time for all products must not exceed 500 hours. The production time per unit for products A, B, C, and D is 2, 3, 4, and 5 hours respectively.\n// 2*A + 3*B + 4*C + 5*D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A.\n// A >= 50",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively. The total production time for all products must not exceed 500 hours, with the production time per unit for products A, B, C, and D being 2, 3, 4, and 5 hours respectively. Additionally, the company must produce at least 50 units of product A. Please help the company determine the optimal quantity of each product to produce to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\nmodel.addCons(D <= 250)\n## The total production time for all products must not exceed 500 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 500)\n## The company must produce at least 50 units of product A.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0).\n// {\"whether to produce Product A\": \"A\", \"range\": \"A = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"B\", \"range\": \"B = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"C\", \"range\": \"C = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"D\", \"range\": \"D = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 100*A + 150*B + 80*C + 90*D\n\n## Generate Constraint-1:\nThe company has a limited budget of $200 for production. The cost per unit for products A, B, C, and D is $30, $40, $20, and $25 respectively.\n// 30*A + 40*B + 20*C + 25*D <= 200\n\n## Generate Constraint-2:\nThe company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy.\n// A + B + C + D <= 2\n\n## Generate Constraint-3:\nThe company must produce at least one product to maintain operational efficiency.\n// A + B + C + D >= 1",
        "question": "A manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0). The profit per unit and cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $100            | $30           |\n| B       | $150            | $40           |\n| C       | $80             | $20           |\n| D       | $90             | $25           |\n\nThe company has a limited budget of $200 for production. The company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy. The company must also produce at least one product to maintain operational efficiency.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\nA = model.addVar(vtype=\"BINARY\", name=\"A\") # whether to produce Product A\nB = model.addVar(vtype=\"BINARY\", name=\"B\") # whether to produce Product B\nC = model.addVar(vtype=\"BINARY\", name=\"C\") # whether to produce Product C\nD = model.addVar(vtype=\"BINARY\", name=\"D\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 80*C + 90*D)\n\n# Add constraints\n## The company has a limited budget of $200 for production.\nmodel.addCons(30*A + 40*B + 20*C + 25*D <= 200)\n## The company can only produce a maximum of two different types of products.\nmodel.addCons(A + B + C + D <= 2)\n## The company must produce at least one product.\nmodel.addCons(A + B + C + D >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(A))\n    print(\"Whether to produce Product B: \", model.getVal(B))\n    print(\"Whether to produce Product C: \", model.getVal(C))\n    print(\"Whether to produce Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0).\n// {\"whether to produce Product A\": \"A\", \"range\": \"A = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"B\", \"range\": \"B = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"C\", \"range\": \"C = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"D\", \"range\": \"D = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 100*A + 150*B + 80*C + 90*D\n\n## Generate Constraint-1:\nThe company has a limited budget of $200 for production. The cost per unit for products A, B, C, and D is $30, $40, $20, and $25 respectively.\n// 30*A + 40*B + 20*C + 25*D <= 200\n\n## Generate Constraint-2:\nThe company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy.\n// A + B + C + D <= 2\n\n## Generate Constraint-3:\nThe company must produce at least one product to maintain operational efficiency.\n// A + B + C + D >= 1",
        "question": "A manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0). The profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company has a limited budget of $200 for production, with the cost per unit for products A, B, C, and D being $30, $40, $20, and $25 respectively. The company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy. Additionally, the company must produce at least one product to maintain operational efficiency. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\nA = model.addVar(vtype=\"BINARY\", name=\"A\") # whether to produce Product A\nB = model.addVar(vtype=\"BINARY\", name=\"B\") # whether to produce Product B\nC = model.addVar(vtype=\"BINARY\", name=\"C\") # whether to produce Product C\nD = model.addVar(vtype=\"BINARY\", name=\"D\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 80*C + 90*D)\n\n# Add constraints\n## The company has a limited budget of $200 for production.\nmodel.addCons(30*A + 40*B + 20*C + 25*D <= 200)\n## The company can only produce a maximum of two different types of products.\nmodel.addCons(A + B + C + D <= 2)\n## The company must produce at least one product.\nmodel.addCons(A + B + C + D >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(A))\n    print(\"Whether to produce Product B: \", model.getVal(B))\n    print(\"Whether to produce Product C: \", model.getVal(C))\n    print(\"Whether to produce Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce.\n// {\"number of units of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 75*C + 50*D\n\n## Generate Constraint-1:\nThe total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer must produce at least 5 units of Device A.\n// A >= 5\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of either Device B or Device C, but not both.\n// B + C >= 10",
        "question": "A manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce. The profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit. The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively, and the manufacturer has a total of 100 hours available for production. The manufacturer must produce at least 5 units of Device A. Additionally, the manufacturer must produce at least 10 units of either Device B or Device C, but not both.\n\nPlease help the manufacturer determine the optimal number of units to produce for each device to maximize the total profit.\n\n| Device | Profit per Unit | Production Time |\n|--------|-----------------|-----------------|\n| A      | $100            | 2 hours         |\n| B      | $150            | 3 hours         |\n| C      | $75             | 1 hour          |\n| D      | $50             | 1 hour          |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Device D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 75*C + 50*D)\n\n# Add constraints\n## The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The manufacturer must produce at least 5 units of Device A.\nmodel.addCons(A >= 5)\n## The manufacturer must produce at least 10 units of either Device B or Device C, but not both.\nB_or_C = model.addVar(vtype=\"INTEGER\", name=\"B_or_C\", lb=0)\nmodel.addCons(B_or_C <= B)\nmodel.addCons(B_or_C <= C)\nmodel.addCons(B + C - B_or_C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Device A: \", model.getVal(A))\n    print(\"Number of units of Device B: \", model.getVal(B))\n    print(\"Number of units of Device C: \", model.getVal(C))\n    print(\"Number of units of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce.\n// {\"number of units of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 75*C + 50*D\n\n## Generate Constraint-1:\nThe total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer must produce at least 5 units of Device A.\n// A >= 5\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of either Device B or Device C, but not both.\n// B + C >= 10",
        "question": "A manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce. The profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit. The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively, and the manufacturer has a total of 100 hours available for production. The manufacturer must produce at least 5 units of Device A and at least 10 units of either Device B or Device C, but not both. Please help the manufacturer determine the optimal number of units to produce for each device to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Device D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 75*C + 50*D)\n\n# Add constraints\n## The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The manufacturer must produce at least 5 units of Device A.\nmodel.addCons(A >= 5)\n## The manufacturer must produce at least 10 units of either Device B or Device C, but not both.\nB_or_C = model.addVar(vtype=\"INTEGER\", name=\"B_or_C\", lb=0)\nmodel.addCons(B_or_C <= B)\nmodel.addCons(B_or_C <= C)\nmodel.addCons(B + C - B_or_C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Device A: \", model.getVal(A))\n    print(\"Number of units of Device B: \", model.getVal(B))\n    print(\"Number of units of Device C: \", model.getVal(C))\n    print(\"Number of units of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 695,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4.\n// C1 <= 5\n// C2 <= 4\n// C3 <= 3\n// C4 <= 6\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n\n| Cake Type | Profit per Cake | Labor Hours Required |\n|-----------|-----------------|----------------------|\n| 1         | $5              | 2                    |\n| 2         | $7              | 3                    |\n| 3         | $6              | 2                    |\n| 4         | $4              | 1                    |\n\nThe bakery has a total of 20 labor hours available. The bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4. The bakery wants to ensure that at least two types of cakes are produced.\n\nPlease help the bakery to maximize the total profit from selling the cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4.\nmodel.addCons(C1 <= 5)\nmodel.addCons(C2 <= 4)\nmodel.addCons(C3 <= 3)\nmodel.addCons(C4 <= 6)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4.\n// C1 <= 5\n// C2 <= 4\n// C3 <= 3\n// C4 <= 6\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively, and the bakery has a total of 20 labor hours available. The bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4. The bakery wants to ensure that at least two types of cakes are produced.\nPlease help the bakery determine the optimal number of cakes of each type to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients, with enough for 5 cakes of type 1, 4 cakes of type 2, 3 cakes of type 3, and 6 cakes of type 4.\nmodel.addCons(C1 <= 5)\nmodel.addCons(C2 <= 4)\nmodel.addCons(C3 <= 3)\nmodel.addCons(C4 <= 6)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The labor hours and raw material requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit |\n|---------|-----------------|----------------------|-----------------------|\n| A       | 10$             | 2 hours              | 3 kg                  |\n| B       | 15$             | 3 hours              | 2 kg                  |\n| C       | 20$             | 4 hours              | 1 kg                  |\n| D       | 25$             | 5 hours              | 4 kg                  |\n\nThe company has a total of 100 labor hours available and 80 kg of raw materials. The company must produce at least 5 units of product A. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, and the company has a total of 100 labor hours available. The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively, and the company has 80 kg of raw materials available. The company must produce at least 5 units of product A. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $100, $150, $90, and $70 respectively. The production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 40*A + 60*B + 30*C + 20*D <= 10000\n\n## Generate Constraint-2:\nThe total production time for all products should not exceed 100 hours. The production time per unit for products A-D is 2 hours, 3 hours, 1 hour, and 1 hour respectively.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units in total.\n// A + B + C + D >= 50",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|------------------|--------------------------|--------------------------|\n| A       | $100             | $40                      | 2 hours                  |\n| B       | $150             | $60                      | 3 hours                  |\n| C       | $90              | $30                      | 1 hour                   |\n| D       | $70              | $20                      | 1 hour                   |\n\nThe company has a total budget of $10,000 for production costs. The total production time for all products should not exceed 100 hours. The company must produce at least 50 units in total. \nPlease help the company to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D)\n\n# Add constraints\n## The company has a total budget of $10,000 for production costs.\nmodel.addCons(40*A + 60*B + 30*C + 20*D <= 10000)\n## The total production time for all products should not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The company must produce at least 50 units in total.\nmodel.addCons(A + B + C + D >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $100, $150, $90, and $70 respectively. The production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 40*A + 60*B + 30*C + 20*D <= 10000\n\n## Generate Constraint-2:\nThe total production time for all products should not exceed 100 hours. The production time per unit for products A-D is 2 hours, 3 hours, 1 hour, and 1 hour respectively.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units in total.\n// A + B + C + D >= 50",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit for products A-D is $100, $150, $90, and $70 respectively, and the production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit. The company has a total budget of $10,000 for production costs. The total production time for all products should not exceed 100 hours, with the production time per unit for products A-D being 2 hours, 3 hours, 1 hour, and 1 hour respectively. Additionally, the company must produce at least 50 units in total. Please help the company determine the optimal number of units to produce for each product to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D)\n\n# Add constraints\n## The company has a total budget of $10,000 for production costs.\nmodel.addCons(40*A + 60*B + 30*C + 20*D <= 10000)\n## The total production time for all products should not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The company must produce at least 50 units in total.\nmodel.addCons(A + B + C + D >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively.\n// 4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// Product_A >= 10\n\n## Generate Constraint-3:\nThe company can produce a maximum of 50 units of Product B due to limited raw material availability.\n// Product_B <= 50",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $30             |\n| C       | $40             |\n| D       | $20             |\n\nThe company has a total of 1000 labor hours available. Producing one unit of each product requires the following hours:\n\n| Product | Hours Required |\n|---------|---------------|\n| A       | 4 hours       |\n| B       | 3 hours       |\n| C       | 5 hours       |\n| D       | 2 hours       |\n\nThe market demand for Product A is at least 10 units. The company can produce a maximum of 50 units of Product B due to limited raw material availability.\n\nPlease help the company to maximize the total profit from all products, considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(Product_A >= 10)\n## The company can produce a maximum of 50 units of Product B due to limited raw material availability.\nmodel.addCons(Product_B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively.\n// 4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// Product_A >= 10\n\n## Generate Constraint-3:\nThe company can produce a maximum of 50 units of Product B due to limited raw material availability.\n// Product_B <= 50",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively. The market demand for Product A is at least 10 units. The company can produce a maximum of 50 units of Product B due to limited raw material availability. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(Product_A >= 10)\n## The company can produce a maximum of 50 units of Product B due to limited raw material availability.\nmodel.addCons(Product_B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of additional special loaves\": \"x4\", \"range\": \"0 <= x4 <= 50\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3 + 5*x4\n\n## Generate Constraint-1:\nThe total number of loaves that can be baked daily is limited to 200 due to oven capacity.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\n// x1 >= 30\n// x2 >= 20\n\n## Generate Constraint-3:\nThe bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\n// x4 <= 50",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough, along with a special type of bread. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n| Special       | $5              |\n\nThe bakery has an oven capacity that allows for a maximum of 200 loaves to be baked daily. The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively. The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=50) # number of additional special loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3 + 5*x4)\n\n# Add constraints\n## The total number of loaves that can be baked daily is limited to 200 due to oven capacity.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\nmodel.addCons(x1 >= 30)\nmodel.addCons(x2 >= 20)\n## The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\nmodel.addCons(x4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of additional special loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of additional special loaves\": \"x4\", \"range\": \"0 <= x4 <= 50\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3 + 5*x4\n\n## Generate Constraint-1:\nThe total number of loaves that can be baked daily is limited to 200 due to oven capacity.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\n// x1 >= 30\n// x2 >= 20\n\n## Generate Constraint-3:\nThe bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\n// x4 <= 50",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough, as well as a special type of bread. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The total number of loaves that can be baked daily is limited to 200 due to oven capacity. The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively. The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=50) # number of additional special loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3 + 5*x4)\n\n# Add constraints\n## The total number of loaves that can be baked daily is limited to 200 due to oven capacity.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\nmodel.addCons(x1 >= 30)\nmodel.addCons(x2 >= 20)\n## The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\nmodel.addCons(x4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of additional special loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n// x4 is a dummy variable used to simplify the constraint equations.\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 2.5*x3\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// x1 + x2 + x3 <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. Each loaf of Whole Wheat, Rye, and Sourdough bread contains 2 grams, 1 gram, and 1.5 grams of fiber, respectively.\n// 2*x1 + x2 + 1.5*x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\n// x1 >= 150\n// x2 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The following table summarizes the fiber content per loaf of each type of bread.\n\n| Bread Type       | Profit per Loaf | Fiber Content per Loaf |\n|------------------|-----------------|------------------------|\n| Whole Wheat      | $2              | 2 grams                |\n| Rye              | $3              | 1 gram                 |\n| Sourdough        | $2.50           | 1.5 grams              |\n\nThe bakery has a daily production capacity of 500 loaves of bread. The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # dummy variable for simplifying constraints\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(x1 + x2 + x3 <= 500)\n## The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day.\nmodel.addCons(2*x1 + x2 + 1.5*x3 >= 100)\n## The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\nmodel.addCons(x1 >= 150)\nmodel.addCons(x2 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n// x4 is a dummy variable used to simplify the constraint equations.\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 2.5*x3\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// x1 + x2 + x3 <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. Each loaf of Whole Wheat, Rye, and Sourdough bread contains 2 grams, 1 gram, and 1.5 grams of fiber, respectively.\n// 2*x1 + x2 + 1.5*x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\n// x1 >= 150\n// x2 >= 100",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily production capacity of 500 loaves of bread. The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day, with each loaf of Whole Wheat, Rye, and Sourdough bread containing 2 grams, 1 gram, and 1.5 grams of fiber, respectively. Additionally, the bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\nPlease help the bakery determine the optimal daily production quantities of Whole Wheat, Rye, and Sourdough bread to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # dummy variable for simplifying constraints\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(x1 + x2 + x3 <= 500)\n## The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day.\nmodel.addCons(2*x1 + x2 + 1.5*x3 >= 100)\n## The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\nmodel.addCons(x1 >= 150)\nmodel.addCons(x2 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of Ciabatta loaves\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Maximize: 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 250 loaves.\n// x1 + x2 + x3 + x4 <= 250\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Rye bread of 30 loaves.\n// x2 >= 30",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2.50           |\n| Rye          | $3.00           |\n| Sourdough    | $3.50           |\n| Ciabatta     | $4.00           |\n\nThe bakery has a daily production capacity of 250 loaves. The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation. The bakery also has a minimum daily demand for Rye bread of 30 loaves. \n\nPlease help the bakery to maximize its daily profit from bread sales, considering the constraints on production capacity and minimum production requirements for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=100) # number of Ciabatta loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 250 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 250)\n## The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery has a minimum daily demand for Rye bread of 30 loaves.\nmodel.addCons(x2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Ciabatta loaves: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of Ciabatta loaves\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Maximize: 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 250 loaves.\n// x1 + x2 + x3 + x4 <= 250\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Rye bread of 30 loaves.\n// x2 >= 30",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery has a daily production capacity of 250 loaves. The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation. Additionally, the bakery has a minimum daily demand for Rye bread of 30 loaves. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=100) # number of Ciabatta loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 250 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 250)\n## The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery has a minimum daily demand for Rye bread of 30 loaves.\nmodel.addCons(x2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Ciabatta loaves: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 706,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"0 <= x2 <= 800\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 500\", \"type\": \"integer\"}\n// {\"daily production of specialty bread\": \"x4\", \"range\": \"0 <= x4 <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread should not exceed 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 8 hours. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively.\n// 0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat, rye, sourdough, and specialty bread is 200, 150, 100, and 50 loaves, respectively.\n// x1 >= 200\n// x2 >= 150\n// x3 >= 100\n// x4 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and specialty. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand. The profit per loaf and the resources required for each type of bread are given in the following Table.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|------------------|-----------------|-------------------------|-------------------------|\n| Wheat            | $1.50           | 0.5 kg                  | 0.01 hours              |\n| Rye              | $2.00           | 0.7 kg                  | 0.02 hours              |\n| Sourdough        | $2.50           | 0.6 kg                  | 0.03 hours              |\n| Specialty        | $3.00           | 0.8 kg                  | 0.04 hours              |\n\nThe bakery has a limited amount of flour available each day, with the total flour usage for all types of bread not exceeding 1500 kg. The bakery also has a daily labor constraint of 8 hours. Additionally, the bakery must meet a minimum daily demand for each type of bread: 200 loaves for wheat, 150 loaves for rye, 100 loaves for sourdough, and 50 loaves for specialty bread.\n\nPlease help the bakery to maximize its daily profit from bread sales, considering the constraints on flour usage, labor hours, and minimum daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=800) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=500) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=300) # daily production of specialty bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4)\n\n# Add constraints\n## The total flour usage for all types of bread should not exceed 1500 kg.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500)\n## The bakery has a daily labor constraint of 8 hours.\nmodel.addCons(0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\nmodel.addCons(x3 >= 100)\nmodel.addCons(x4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of specialty bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1449,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"0 <= x2 <= 800\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 500\", \"type\": \"integer\"}\n// {\"daily production of specialty bread\": \"x4\", \"range\": \"0 <= x4 <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread should not exceed 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 8 hours. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively.\n// 0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat, rye, sourdough, and specialty bread is 200, 150, 100, and 50 loaves, respectively.\n// x1 >= 200\n// x2 >= 150\n// x3 >= 100\n// x4 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and specialty. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand. The profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread should not exceed 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively. The bakery also has a daily labor constraint of 8 hours. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively.\n\nAdditionally, the bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat, rye, sourdough, and specialty bread is 200, 150, 100, and 50 loaves, respectively.\n\nPlease help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=800) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=500) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=300) # daily production of specialty bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4)\n\n# Add constraints\n## The total flour usage for all types of bread should not exceed 1500 kg.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500)\n## The bakery has a daily labor constraint of 8 hours.\nmodel.addCons(0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\nmodel.addCons(x3 >= 100)\nmodel.addCons(x4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of specialty bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// W + R + S + G <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\n// W >= 50, R >= 50, S >= 50, G >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\n// W + 1.5*R + 2*S + 1.2*G <= 400",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery has an oven capacity of 500 loaves per day and must produce at least 50 loaves of each type of bread to meet minimum customer demand. Additionally, the bakery has a limited supply of ingredients, specifically flour, which is enough for 400 loaves of bread per day.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Wheat      | $2.50           |\n| Rye        | $3.00           |\n| Sourdough  | $3.50           |\n| Whole Grain| $2.75           |\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S + 2.75*G)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(W + R + S + G <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\nmodel.addCons(G >= 50)\n## The bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\nmodel.addCons(W + 1.5*R + 2*S + 1.2*G <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Number of whole grain bread loaves: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// W + R + S + G <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\n// W >= 50, R >= 50, S >= 50, G >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\n// W + 1.5*R + 2*S + 1.2*G <= 400",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery has an oven capacity of 500 loaves per day and must produce at least 50 loaves of each type of bread to meet minimum customer demand. Additionally, the bakery has a limited supply of ingredients, specifically flour, which is enough for 400 loaves of bread per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S + 2.75*G)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(W + R + S + G <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\nmodel.addCons(G >= 50)\n## The bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\nmodel.addCons(W + 1.5*R + 2*S + 1.2*G <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Number of whole grain bread loaves: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and considering storage limitations.\n// {\"daily production of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of multigrain bread\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*W + 1.75*R + 2.00*S + 2.25*M\n\n## Generate Constraint-1:\nThe bakery has a limited storage capacity of 500 loaves per day.\n// W + R + S + M <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of wheat bread, 30 loaves of rye bread, 40 loaves of sourdough bread, and 20 loaves of multigrain bread.\n// W >= 50\n// R >= 30\n// S >= 40\n// M >= 20\n\n## Generate Constraint-3:\nDue to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\n// W <= 200\n// R <= 150",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and considering storage limitations. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Wheat          | $1.50           |\n| Rye            | $1.75           |\n| Sourdough      | $2.00           |\n| Multigrain     | $2.25           |\n\nThe bakery has a limited storage capacity of 500 loaves per day. It must meet a minimum daily demand for each type of bread: at least 50 loaves of wheat bread, 30 loaves of rye bread, 40 loaves of sourdough bread, and 20 loaves of multigrain bread. Due to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of sourdough bread\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # daily production of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*W + 1.75*R + 2.00*S + 2.25*M)\n\n# Add constraints\n## The bakery has a limited storage capacity of 500 loaves per day.\nmodel.addCons(W + R + S + M <= 500)\n## The bakery must meet a minimum daily demand for each type of bread:\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 30)\nmodel.addCons(S >= 40)\nmodel.addCons(M >= 20)\n## Due to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\nmodel.addCons(W <= 200)\nmodel.addCons(R <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(W))\n    print(\"Daily production of rye bread: \", model.getVal(R))\n    print(\"Daily production of sourdough bread: \", model.getVal(S))\n    print(\"Daily production of multigrain bread: \", model.getVal(M))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and considering storage limitations.\n// {\"daily production of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of multigrain bread\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*W + 1.75*R + 2.00*S + 2.25*M\n\n## Generate Constraint-1:\nThe bakery has a limited storage capacity of 500 loaves per day.\n// W + R + S + M <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of wheat bread, 30 loaves of rye bread, 40 loaves of sourdough bread, and 20 loaves of multigrain bread.\n// W >= 50\n// R >= 30\n// S >= 40\n// M >= 20\n\n## Generate Constraint-3:\nDue to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\n// W <= 200\n// R <= 150",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and considering storage limitations. The profit per loaf of wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a limited storage capacity of 500 loaves per day. The bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of wheat bread, 30 loaves of rye bread, 40 loaves of sourdough bread, and 20 loaves of multigrain bread. Due to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\nPlease help the bakery determine the optimal daily production quantities for wheat, rye, sourdough, and multigrain bread to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of sourdough bread\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # daily production of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*W + 1.75*R + 2.00*S + 2.25*M)\n\n# Add constraints\n## The bakery has a limited storage capacity of 500 loaves per day.\nmodel.addCons(W + R + S + M <= 500)\n## The bakery must meet a minimum daily demand for each type of bread:\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 30)\nmodel.addCons(S >= 40)\nmodel.addCons(M >= 20)\n## Due to production constraints, the bakery can only produce up to 200 loaves of wheat bread and 150 loaves of rye bread per day.\nmodel.addCons(W <= 200)\nmodel.addCons(R <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(W))\n    print(\"Daily production of rye bread: \", model.getVal(R))\n    print(\"Daily production of sourdough bread: \", model.getVal(S))\n    print(\"Daily production of multigrain bread: \", model.getVal(M))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of White bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// WW + Rye + Sourd + White <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White.\n// WW >= 50\n// Rye >= 40\n// Sourd >= 60\n// White >= 70\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// WW + Rye + Sourd + White <= 300",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $1.50           |\n| Rye            | $1.20           |\n| Sourdough      | $1.30           |\n| White          | $1.00           |\n\nThe bakery has an oven capacity of 500 loaves per day. The bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # daily production of White bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 500)\n## The bakery must meet a minimum daily demand for each type of bread:\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourd >= 60)\nmodel.addCons(White >= 70)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of White bread: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of White bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// WW + Rye + Sourd + White <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White.\n// WW >= 50\n// Rye >= 40\n// Sourd >= 60\n// White >= 70\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// WW + Rye + Sourd + White <= 300",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery has an oven capacity of 500 loaves per day and must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # daily production of White bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 500)\n## The bakery must meet a minimum daily demand for each type of bread:\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourd >= 60)\nmodel.addCons(White >= 70)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of White bread: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of pastries: croissants, muffins, and eclairs. The bakery wants to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources and demand constraints.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per eclair is $0.75. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*C + 0.60*M + 0.75*E\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Each croissant requires 100 grams of flour, each muffin requires 150 grams, and each eclair requires 200 grams. The total daily flour supply is 10 kilograms.\n// 100*C + 150*M + 200*E <= 10000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space. Each batch of croissants takes 15 minutes, muffins take 20 minutes, and eclairs take 30 minutes. The total daily oven time available is 6 hours.\n// 15*C + 20*M + 30*E <= 360\n\n## Generate Constraint-3:\nThe bakery must meet a minimum demand for each type of pastry. The minimum daily demand for croissants is 50, for muffins is 40, and for eclairs is 30.\n// C >= 50\n// M >= 40\n// E >= 30",
        "question": "A small bakery specializes in making three types of pastries: croissants, muffins, and eclairs. The bakery wants to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources and demand constraints. The profit per croissant is $0.50, per muffin is $0.60, and per eclair is $0.75. The bakery has a limited supply of ingredients, with each croissant requiring 100 grams of flour, each muffin requiring 150 grams, and each eclair requiring 200 grams. The total daily flour supply is 10 kilograms. Additionally, the bakery has a limited oven space, with each batch of croissants taking 15 minutes, muffins taking 20 minutes, and eclairs taking 30 minutes. The total daily oven time available is 6 hours. The bakery must also meet a minimum demand for each type of pastry, with the minimum daily demand for croissants being 50, for muffins being 40, and for eclairs being 30.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.60*M + 0.75*E)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(100*C + 150*M + 200*E <= 10000)\n## The bakery has a limited oven space.\nmodel.addCons(15*C + 20*M + 30*E <= 360)\n## The bakery must meet a minimum demand for each type of pastry.\nmodel.addCons(C >= 50)\nmodel.addCons(M >= 40)\nmodel.addCons(E >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of pastries: croissants, muffins, and eclairs. The bakery wants to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources and demand constraints.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per eclair is $0.75. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*C + 0.60*M + 0.75*E\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Each croissant requires 100 grams of flour, each muffin requires 150 grams, and each eclair requires 200 grams. The total daily flour supply is 10 kilograms.\n// 100*C + 150*M + 200*E <= 10000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space. Each batch of croissants takes 15 minutes, muffins take 20 minutes, and eclairs take 30 minutes. The total daily oven time available is 6 hours.\n// 15*C + 20*M + 30*E <= 360\n\n## Generate Constraint-3:\nThe bakery must meet a minimum demand for each type of pastry. The minimum daily demand for croissants is 50, for muffins is 40, and for eclairs is 30.\n// C >= 50\n// M >= 40\n// E >= 30",
        "question": "A small bakery specializes in making three types of pastries: croissants, muffins, and eclairs. The bakery wants to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources and demand constraints.\nThe profit per croissant is $0.50, per muffin is $0.60, and per eclair is $0.75. The bakery aims to maximize its daily profit from the sales of these pastries.\nThe bakery has a limited supply of ingredients. Each croissant requires 100 grams of flour, each muffin requires 150 grams, and each eclair requires 200 grams. The total daily flour supply is 10 kilograms.\nThe bakery has a limited oven space. Each batch of croissants takes 15 minutes, muffins take 20 minutes, and eclairs take 30 minutes. The total daily oven time available is 6 hours.\nThe bakery must meet a minimum demand for each type of pastry. The minimum daily demand for croissants is 50, for muffins is 40, and for eclairs is 30.\nPlease help the bakery to determine the optimal number of each type of pastry to produce daily to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.60*M + 0.75*E)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(100*C + 150*M + 200*E <= 10000)\n## The bakery has a limited oven space.\nmodel.addCons(15*C + 20*M + 30*E <= 360)\n## The bakery must meet a minimum demand for each type of pastry.\nmodel.addCons(C >= 50)\nmodel.addCons(M >= 40)\nmodel.addCons(E >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*W + 3*R + 4*SD\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// W + R + SD <= 500\n\n## Generate Constraint-2:\nEach loaf of bread must meet a minimum nutritional requirement. Wheat bread provides 10 units of nutrition, rye bread provides 15 units, and sourdough bread provides 20 units. The total daily nutritional output must be at least 7000 units.\n// 10*W + 15*R + 20*SD >= 7000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all three bread types. The supply is enough for 300 loaves per day.\n// W + R + SD <= 300",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The following table summarizes the nutritional content per loaf of each type of bread:\n\n| Bread Type | Profit per Loaf | Nutritional Units per Loaf |\n|------------|-----------------|----------------------------|\n| Wheat      | $2              | 10                         |\n| Rye        | $3              | 15                         |\n| Sourdough  | $4              | 20                         |\n\nThe bakery has a daily production capacity of 500 loaves. Each loaf of bread must meet a minimum nutritional requirement, and the total daily nutritional output must be at least 7000 units. Additionally, the bakery has a limited supply of a special ingredient used in all three bread types, which is enough for 300 loaves per day.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 4*SD)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(W + R + SD <= 500)\n## Each loaf of bread must meet a minimum nutritional requirement.\nmodel.addCons(10*W + 15*R + 20*SD >= 7000)\n## The bakery has a limited supply of a special ingredient used in all three bread types.\nmodel.addCons(W + R + SD <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(SD))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*W + 3*R + 4*SD\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// W + R + SD <= 500\n\n## Generate Constraint-2:\nEach loaf of bread must meet a minimum nutritional requirement. Wheat bread provides 10 units of nutrition, rye bread provides 15 units, and sourdough bread provides 20 units. The total daily nutritional output must be at least 7000 units.\n// 10*W + 15*R + 20*SD >= 7000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all three bread types. The supply is enough for 300 loaves per day.\n// W + R + SD <= 300",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily production capacity of 500 loaves. Each loaf of bread must meet a minimum nutritional requirement. Wheat bread provides 10 units of nutrition, rye bread provides 15 units, and sourdough bread provides 20 units. The total daily nutritional output must be at least 7000 units. The bakery also has a limited supply of a special ingredient used in all three bread types, which is enough for 300 loaves per day. Please help the bakery determine the optimal number of loaves of each type of bread to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 4*SD)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(W + R + SD <= 500)\n## Each loaf of bread must meet a minimum nutritional requirement.\nmodel.addCons(10*W + 15*R + 20*SD >= 7000)\n## The bakery has a limited supply of a special ingredient used in all three bread types.\nmodel.addCons(W + R + SD <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(SD))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// WW + Rye + Sour + White <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\n// WW >= 100\n// Rye >= 50\n// Sour >= 50\n// White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients. Specifically, the supply of whole grains is limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds. Each loaf of bread requires 0.5 pounds of its respective ingredient.\n// 0.5 * WW <= 200\n// 0.5 * Rye <= 150\n// 0.5 * Sour <= 100\n// 0.5 * White <= 300",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2.50           |\n| Rye           | $2.00           |\n| Sourdough     | $3.00           |\n| White         | $1.50           |\n\nThe bakery has a daily production capacity of 500 loaves. It must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations. Additionally, the bakery has a limited supply of ingredients: 200 pounds of whole grains, 150 pounds of rye, 100 pounds of sourdough starter, and 300 pounds of refined flour. Each loaf of bread requires 0.5 pounds of its respective ingredient.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(WW + Rye + Sour + White <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sour >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.5 * WW <= 200)\nmodel.addCons(0.5 * Rye <= 150)\nmodel.addCons(0.5 * Sour <= 100)\nmodel.addCons(0.5 * White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// WW + Rye + Sour + White <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\n// WW >= 100\n// Rye >= 50\n// Sour >= 50\n// White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients. Specifically, the supply of whole grains is limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds. Each loaf of bread requires 0.5 pounds of its respective ingredient.\n// 0.5 * WW <= 200\n// 0.5 * Rye <= 150\n// 0.5 * Sour <= 100\n// 0.5 * White <= 300",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily production capacity of 500 loaves. The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations. Additionally, the bakery has a limited supply of ingredients: whole grains are limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds, with each loaf of bread requiring 0.5 pounds of its respective ingredient. Please help the bakery determine the optimal number of loaves of each type of bread to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(WW + Rye + Sour + White <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sour >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.5 * WW <= 200)\nmodel.addCons(0.5 * Rye <= 150)\nmodel.addCons(0.5 * Sour <= 100)\nmodel.addCons(0.5 * White <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively.\n// 0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands.\n// WW >= 0.20 * (WW + Rye + Sourd + Brioche)\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance.\n// Brioche <= 300",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf for each type of bread is as follows: Whole Wheat - $1.50, Rye - $1.20, Sourdough - $1.30, and Brioche - $1.70.\n\n| Bread Type    | Profit per Loaf | Flour Required per Loaf |\n|---------------|-----------------|-------------------------|\n| Whole Wheat   | $1.50           | 0.5 kg                  |\n| Rye           | $1.20           | 0.4 kg                  |\n| Sourdough     | $1.30           | 0.3 kg                  |\n| Brioche       | $1.70           | 0.6 kg                  |\n\nThe bakery has a daily flour supply limit of 500 kg. The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands. Additionally, the bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500)\n## The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Sourd + Brioche))\n## The bakery has a daily demand limit for Brioche bread of 300 loaves.\nmodel.addCons(Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively.\n// 0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands.\n// WW >= 0.20 * (WW + Rye + Sourd + Brioche)\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance.\n// Brioche <= 300",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively. The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands. Additionally, the bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500)\n## The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Sourd + Brioche))\n## The bakery has a daily demand limit for Brioche bread of 300 loaves.\nmodel.addCons(Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 pounds of flour. Each loaf of Whole Wheat, Sourdough, Rye, and White bread requires 1 pound of flour.\n// WW + SD + Rye + White <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 50 loaves of each type of bread daily.\n// WW >= 50, SD >= 50, Rye >= 50, White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye.\n// SD <= 100, Rye <= 80",
        "question": "A small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery has a daily limit of 200 pounds of flour, and each loaf of bread requires 1 pound of flour. The bakery has a contract to supply at least 50 loaves of each type of bread daily. Additionally, the bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye.\n\nPlease help the bakery to maximize its daily profit.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf | Yeast Constraint |\n|------------|-----------------|-------------------------|------------------|\n| Whole Wheat | $2.50 | 1 pound | None |\n| Sourdough | $3.00 | 1 pound | SD <= 100 |\n| Rye | $2.00 | 1 pound | Rye <= 80 |\n| White | $1.50 | 1 pound | None |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of Sourdough loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White)\n\n# Add constraints\n## The bakery has a daily limit of 200 pounds of flour.\nmodel.addCons(WW + SD + Rye + White <= 200)\n## The bakery has a contract to supply at least 50 loaves of each type of bread daily.\nmodel.addCons(WW >= 50)\nmodel.addCons(SD >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread.\nmodel.addCons(SD <= 100)\nmodel.addCons(Rye <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Sourdough loaves: \", model.getVal(SD))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 pounds of flour. Each loaf of Whole Wheat, Sourdough, Rye, and White bread requires 1 pound of flour.\n// WW + SD + Rye + White <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 50 loaves of each type of bread daily.\n// WW >= 50, SD >= 50, Rye >= 50, White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye.\n// SD <= 100, Rye <= 80",
        "question": "A small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery has a daily limit of 200 pounds of flour, and each loaf of bread requires 1 pound of flour. The bakery has a contract to supply at least 50 loaves of each type of bread daily. Additionally, the bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye. Please help the bakery maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of Sourdough loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White)\n\n# Add constraints\n## The bakery has a daily limit of 200 pounds of flour.\nmodel.addCons(WW + SD + Rye + White <= 200)\n## The bakery has a contract to supply at least 50 loaves of each type of bread daily.\nmodel.addCons(WW >= 50)\nmodel.addCons(SD >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread.\nmodel.addCons(SD <= 100)\nmodel.addCons(Rye <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Sourdough loaves: \", model.getVal(SD))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to determine the optimal number of each type of pastry to maximize profit while meeting certain constraints on ingredients and demand.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per tart is $0.70. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.40*M + 0.60*E + 0.70*T\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It has 200 pounds of flour, 100 pounds of sugar, and 150 pounds of butter. Each croissant requires 0.1 pounds of flour and 0.05 pounds of butter, each muffin requires 0.08 pounds of flour and 0.02 pounds of sugar, each eclair requires 0.06 pounds of flour, 0.03 pounds of sugar, and 0.04 pounds of butter, and each tart requires 0.05 pounds of flour and 0.05 pounds of sugar.\n// 0.1*C + 0.08*M + 0.06*E + 0.05*T <= 200 (flour constraint)\n// 0.02*M + 0.03*E + 0.05*T <= 100 (sugar constraint)\n// 0.05*C + 0.04*E <= 150 (butter constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 croissants, 60 muffins, 40 eclairs, and 30 tarts to meet customer expectations.\n// C >= 50\n// M >= 60\n// E >= 40\n// T >= 30\n\n## Generate Constraint-3:\nThe bakery also wants to ensure that the total number of pastries produced does not exceed 300 to maintain quality.\n// C + M + E + T <= 300",
        "question": "A small bakery specializes in producing four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to determine the optimal number of each type of pastry to maximize profit while meeting certain constraints on ingredients and demand. The profit per pastry is as follows: $0.50 per croissant, $0.40 per muffin, $0.60 per eclair, and $0.70 per tart.\n\n| Pastry  | Profit per Unit |\n|---------|-----------------|\n| Croissants | $0.50       |\n| Muffins    | $0.40       |\n| Eclairs    | $0.60       |\n| Tarts      | $0.70       |\n\nThe bakery has a limited supply of ingredients: 200 pounds of flour, 100 pounds of sugar, and 150 pounds of butter. The ingredient requirements per pastry are as follows:\n\n| Pastry  | Flour (pounds) | Sugar (pounds) | Butter (pounds) |\n|---------|----------------|----------------|-----------------|\n| Croissants | 0.1          | 0            | 0.05           |\n| Muffins    | 0.08         | 0.02          | 0             |\n| Eclairs    | 0.06         | 0.03          | 0.04           |\n| Tarts      | 0.05         | 0.05          | 0             |\n\nThe bakery has a daily demand constraint. It must produce at least 50 croissants, 60 muffins, 40 eclairs, and 30 tarts to meet customer expectations. Additionally, the bakery wants to ensure that the total number of pastries produced does not exceed 300 to maintain quality.\n\nPlease help the bakery to maximize its daily profit from selling these pastries while adhering to the constraints on ingredients and demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.40*M + 0.60*E + 0.70*T)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.1*C + 0.08*M + 0.06*E + 0.05*T <= 200) # flour constraint\nmodel.addCons(0.02*M + 0.03*E + 0.05*T <= 100) # sugar constraint\nmodel.addCons(0.05*C + 0.04*E <= 150) # butter constraint\n## The bakery has a daily demand constraint.\nmodel.addCons(C >= 50)\nmodel.addCons(M >= 60)\nmodel.addCons(E >= 40)\nmodel.addCons(T >= 30)\n## The bakery also wants to ensure that the total number of pastries produced does not exceed 300.\nmodel.addCons(C + M + E + T <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Number of tarts: \", model.getVal(T))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1515,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to determine the optimal number of each type of pastry to maximize profit while meeting certain constraints on ingredients and demand.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of tarts\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per tart is $0.70. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.40*M + 0.60*E + 0.70*T\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. It has 200 pounds of flour, 100 pounds of sugar, and 150 pounds of butter. Each croissant requires 0.1 pounds of flour and 0.05 pounds of butter, each muffin requires 0.08 pounds of flour and 0.02 pounds of sugar, each eclair requires 0.06 pounds of flour, 0.03 pounds of sugar, and 0.04 pounds of butter, and each tart requires 0.05 pounds of flour and 0.05 pounds of sugar.\n// 0.1*C + 0.08*M + 0.06*E + 0.05*T <= 200 (flour constraint)\n// 0.02*M + 0.03*E + 0.05*T <= 100 (sugar constraint)\n// 0.05*C + 0.04*E <= 150 (butter constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 croissants, 60 muffins, 40 eclairs, and 30 tarts to meet customer expectations.\n// C >= 50\n// M >= 60\n// E >= 40\n// T >= 30\n\n## Generate Constraint-3:\nThe bakery also wants to ensure that the total number of pastries produced does not exceed 300 to maintain quality.\n// C + M + E + T <= 300",
        "question": "A small bakery specializes in producing four types of pastries: croissants, muffins, eclairs, and tarts. The bakery needs to determine the optimal number of each type of pastry to maximize profit while meeting certain constraints on ingredients and demand. The profit per croissant is $0.50, per muffin is $0.40, per eclair is $0.60, and per tart is $0.70. The bakery aims to maximize its daily profit from selling these pastries.\n\nThe bakery has a limited supply of ingredients. It has 200 pounds of flour, 100 pounds of sugar, and 150 pounds of butter. Each croissant requires 0.1 pounds of flour and 0.05 pounds of butter, each muffin requires 0.08 pounds of flour and 0.02 pounds of sugar, each eclair requires 0.06 pounds of flour, 0.03 pounds of sugar, and 0.04 pounds of butter, and each tart requires 0.05 pounds of flour and 0.05 pounds of sugar.\n\nThe bakery has a daily demand constraint. It must produce at least 50 croissants, 60 muffins, 40 eclairs, and 30 tarts to meet customer expectations. The bakery also wants to ensure that the total number of pastries produced does not exceed 300 to maintain quality.\n\nPlease help the bakery to maximize its daily profit from selling these pastries while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of eclairs\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tarts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.40*M + 0.60*E + 0.70*T)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.1*C + 0.08*M + 0.06*E + 0.05*T <= 200) # flour constraint\nmodel.addCons(0.02*M + 0.03*E + 0.05*T <= 100) # sugar constraint\nmodel.addCons(0.05*C + 0.04*E <= 150) # butter constraint\n## The bakery has a daily demand constraint.\nmodel.addCons(C >= 50)\nmodel.addCons(M >= 60)\nmodel.addCons(E >= 40)\nmodel.addCons(T >= 30)\n## The bakery also wants to ensure that the total number of pastries produced does not exceed 300.\nmodel.addCons(C + M + E + T <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of eclairs: \", model.getVal(E))\n    print(\"Number of tarts: \", model.getVal(T))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds.\n// 1.5*W + 1.2*R + 1.3*S <= 500\n\n## Generate Constraint-2:\nTo maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\n// W >= 50, R >= 50, S >= 50\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\n// W >= 100",
        "question": "A small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards. The profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds. To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day. Additionally, the bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf |\n|------------|-----------------|-------------------------|\n| Wheat      | $2.50           | 1.5 pounds              |\n| Rye        | $3.00           | 1.2 pounds              |\n| Sourdough  | $3.50           | 1.3 pounds              |\n\nPlease help the bakery determine the optimal daily production quantities of wheat (W), rye (R), and sourdough (S) bread to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(1.5*W + 1.2*R + 1.3*S <= 500)\n## To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\n## The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\nmodel.addCons(W >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds.\n// 1.5*W + 1.2*R + 1.3*S <= 500\n\n## Generate Constraint-2:\nTo maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\n// W >= 50, R >= 50, S >= 50\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\n// W >= 100",
        "question": "A small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards. The profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds. To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day. Additionally, the bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day. Please help the bakery determine the optimal quantities of wheat, rye, and sourdough bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(1.5*W + 1.2*R + 1.3*S <= 500)\n## To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\n## The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\nmodel.addCons(W >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves of bread.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\n// x1 >= 200\n// x2 >= 300\n\n## Generate Constraint-3:\nDue to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\n// x3 <= 400\n// x4 <= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery has a daily production capacity of 1000 loaves of bread. It must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2. Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Bread 1    | $1.50           |\n| Bread 2    | $2.00           |\n| Bread 3    | $1.75           |\n| Bread 4    | $1.90           |\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves of bread.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 300)\n## Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\nmodel.addCons(x3 <= 400)\nmodel.addCons(x4 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves of bread.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\n// x1 >= 200\n// x2 >= 300\n\n## Generate Constraint-3:\nDue to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\n// x3 <= 400\n// x4 <= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery has a daily production capacity of 1000 loaves of bread. The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2. Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves of bread.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 300)\n## Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\nmodel.addCons(x3 <= 400)\nmodel.addCons(x4 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 686,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The cost of production per loaf for Bread 1-4 is $2.00, $2.50, $3.00, and $3.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively. The total daily flour supply is 100 kg.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively. The total daily labor capacity is 20 hours.\n// 0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n// x1 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread. The selling price and cost of production per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Selling Price per Loaf | Cost of Production per Loaf |\n|------------|-----------------------|-----------------------------|\n| Bread 1    | $3.50                 | $2.00                       |\n| Bread 2    | $4.00                 | $2.50                       |\n| Bread 3    | $4.50                 | $3.00                       |\n| Bread 4    | $5.00                 | $3.50                       |\n\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively, and the total daily flour supply is 100 kg. The bakery also has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively, and the total daily labor capacity is 20 hours. The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n\nPlease help the bakery to maximize its daily profit by determining the optimal daily production quantity of each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited daily labor capacity.\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20)\n## The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1438,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The cost of production per loaf for Bread 1-4 is $2.00, $2.50, $3.00, and $3.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively. The total daily flour supply is 100 kg.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively. The total daily labor capacity is 20 hours.\n// 0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n// x1 >= 50",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively, with corresponding production costs of $2.00, $2.50, $3.00, and $3.50 per loaf. The bakery needs to determine the daily production quantity of each type of bread.\n\nThe bakery has a limited daily supply of flour, with Bread 1-4 requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively, and a total daily flour supply of 100 kg. Additionally, the bakery has a limited daily labor capacity, with Bread 1-4 requiring 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively, and a total daily labor capacity of 20 hours. The bakery also wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n\nPlease help the bakery to maximize its daily profit by determining the optimal daily production quantity of each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited daily labor capacity.\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20)\n## The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily.\nmodel.addCons(x1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit.\n// WholeWheat + Rye + Sourdough + Brioche <= 5000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Bread Type   | Profit per Loaf | Labor per Loaf | Ingredient Cost per Loaf |\n|--------------|-----------------|----------------|--------------------------|\n| Whole Wheat  | $2              | 0.5 hours      | $0.50                    |\n| Rye          | $3              | 0.4 hours      | $0.70                    |\n| Sourdough    | $2.50           | 0.6 hours      | $0.60                    |\n| Brioche      | $4              | 0.8 hours      | $1.00                    |\n\nThe bakery has a total of 1000 hours of labor available and a budget of $5000 for ingredients. The total cost of ingredients should not exceed the budget, and the total labor hours should not exceed 1000 hours. Additionally, the bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit.\n\nPlease help the bakery to maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a storage capacity limit of 5000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit.\n// WholeWheat + Rye + Sourdough + Brioche <= 5000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.4 hours, Sourdough requiring 0.6 hours, and Brioche requiring 0.8 hours of labor. The bakery also has a budget of $5000 for ingredients, with the cost of ingredients per loaf for Whole Wheat being $0.50, for Rye being $0.70, for Sourdough being $0.60, and for Brioche being $1. Additionally, the bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a storage capacity limit of 5000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. It takes 0.5 hours to make a loaf of Whole Wheat, 0.7 hours for Rye, 0.6 hours for Sourdough, and 1 hour for Brioche.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients per week. The cost of ingredients for a loaf of Whole Wheat is $1, for Rye is $1.50, for Sourdough is $1.20, and for Brioche is $2.\n// WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\n// WholeWheat >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf and the time and cost of ingredients for each type of bread are given in the following Table.\n\n| Bread Type   | Profit per Loaf | Time per Loaf | Cost of Ingredients per Loaf |\n|--------------|-----------------|---------------|------------------------------|\n| Whole Wheat  | $2              | 0.5 hours     | $1                          |\n| Rye          | $3              | 0.7 hours     | $1.50                       |\n| Sourdough    | $2.50           | 0.6 hours     | $1.20                       |\n| Brioche      | $4              | 1 hour        | $2                          |\n\nThe bakery has a total of 1000 hours of labor available per week. It has a budget of $5000 for ingredients per week. The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\nPlease help the bakery to maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients per week.\nmodel.addCons(WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\nmodel.addCons(WholeWheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. It takes 0.5 hours to make a loaf of Whole Wheat, 0.7 hours for Rye, 0.6 hours for Sourdough, and 1 hour for Brioche.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients per week. The cost of ingredients for a loaf of Whole Wheat is $1, for Rye is $1.50, for Sourdough is $1.20, and for Brioche is $2.\n// WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\n// WholeWheat >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available per week, with each loaf requiring different amounts of time to produce. The bakery also has a budget of $5000 for ingredients per week. Additionally, the bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations. Please help the bakery maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients per week.\nmodel.addCons(WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\nmodel.addCons(WholeWheat >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"Q_WW\", \"range\": \"Q_WW >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Q_Rye\", \"range\": \"Q_Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Q_Sourdough\", \"range\": \"Q_Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Brioche bread\": \"Q_Brioche\", \"range\": \"Q_Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche.\n// 0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints.\n// Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\n// Q_WW >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $1.50           |\n| Rye              | $2.00           |\n| Sourdough        | $2.50           |\n| Brioche          | $3.00           |\n\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche. The bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints. Additionally, the bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\n\nPlease help the bakery to maximize the total daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nQ_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_WW\", lb=0) # daily production quantity of Whole Wheat bread\nQ_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Rye\", lb=0) # daily production quantity of Rye bread\nQ_Sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Sourdough\", lb=0) # daily production quantity of Sourdough bread\nQ_Brioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Brioche\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 1000 kg.\nmodel.addCons(0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000)\n## The bakery can produce a maximum of 2000 loaves per day.\nmodel.addCons(Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000)\n## The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\nmodel.addCons(Q_WW >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Q_WW))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Q_Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Q_Sourdough))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(Q_Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"Q_WW\", \"range\": \"Q_WW >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Q_Rye\", \"range\": \"Q_Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Q_Sourdough\", \"range\": \"Q_Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Brioche bread\": \"Q_Brioche\", \"range\": \"Q_Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche.\n// 0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints.\n// Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\n// Q_WW >= 500",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery has a daily flour supply limit of 1000 kg, with flour requirements per loaf of 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche. The bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints. Additionally, the bakery has a minimum daily demand for Whole Wheat bread of 500 loaves. Please help the bakery maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nQ_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_WW\", lb=0) # daily production quantity of Whole Wheat bread\nQ_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Rye\", lb=0) # daily production quantity of Rye bread\nQ_Sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Sourdough\", lb=0) # daily production quantity of Sourdough bread\nQ_Brioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Brioche\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 1000 kg.\nmodel.addCons(0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000)\n## The bakery can produce a maximum of 2000 loaves per day.\nmodel.addCons(Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000)\n## The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\nmodel.addCons(Q_WW >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Q_WW))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Q_Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Q_Sourdough))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(Q_Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"Whole_Grain_Loaves\", \"range\": \"Whole_Grain_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\n// 0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\n// 0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for each type of bread is as follows: wheat bread at $2, rye bread at $2.5, whole grain bread at $3, and sourdough bread at $3.5.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf (kg) | Yeast Required per Loaf (kg) | Labor Hours Required per Loaf |\n|---------------|-----------------|------------------------------|------------------------------|-------------------------------|\n| Wheat         | $2              | 0.5                          | 0.01                        | 0.2                           |\n| Rye           | $2.5            | 0.6                          | 0.015                       | 0.25                          |\n| Whole Grain   | $3              | 0.7                          | 0.02                        | 0.3                           |\n| Sourdough     | $3.5            | 0.8                          | 0.025                       | 0.35                          |\n\nThe bakery has a limited amount of flour available, totaling 1000 kg. The bakery also has a limited amount of yeast available, totaling 15 kg. Additionally, the bakery has a limited amount of labor hours available, totaling 200 hours.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nWhole_Grain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Grain_Loaves\", lb=0) # number of loaves of whole grain bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(Whole_Grain_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1562,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"Whole_Grain_Loaves\", \"range\": \"Whole_Grain_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\n// 0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\n// 0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\nThe bakery also has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\nAdditionally, the bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\nPlease help the bakery to maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nWhole_Grain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Grain_Loaves\", lb=0) # number of loaves of whole grain bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(Whole_Grain_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1530,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"ingredient cost in dollars\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases.\n// 1*Wheat_Loaves + 1.5*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye.\n// Wheat_Loaves + Rye_Loaves >= 50",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Loaf | Ingredient Cost per Loaf |\n|------------|--------------------|--------------------------|\n| Wheat      | 0.5 hours          | $1                       |\n| Rye        | 0.6 hours          | $1.50                    |\n\nThe bakery has a total of 8 hours of oven time available daily and a budget of $100 for daily ingredient purchases. The bakery also has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of wheat bread loaves and rye bread loaves\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven time and ingredient cost\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven time in hours\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # ingredient cost in dollars\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves == Oven_Time)\n## The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(Oven_Time <= 8)\n## The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50.\nmodel.addCons(1*Wheat_Loaves + 1.5*Rye_Loaves == Ingredient_Cost)\n## The bakery has a budget of $100 for daily ingredient purchases.\nmodel.addCons(Ingredient_Cost <= 100)\n## The bakery has a minimum daily production requirement of 50 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Oven Time used: \", model.getVal(Oven_Time))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"ingredient cost in dollars\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases.\n// 1*Wheat_Loaves + 1.5*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye.\n// Wheat_Loaves + Rye_Loaves >= 50",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints.\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily. The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases. The bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of wheat bread loaves and rye bread loaves\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven time and ingredient cost\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven time in hours\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # ingredient cost in dollars\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves == Oven_Time)\n## The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(Oven_Time <= 8)\n## The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50.\nmodel.addCons(1*Wheat_Loaves + 1.5*Rye_Loaves == Ingredient_Cost)\n## The bakery has a budget of $100 for daily ingredient purchases.\nmodel.addCons(Ingredient_Cost <= 100)\n## The bakery has a minimum daily production requirement of 50 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Oven Time used: \", model.getVal(Oven_Time))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads to produce\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads to produce\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"oven time used for wheat breads\": \"Oven_Time_Wheat\", \"range\": \"Oven_Time_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven time used for rye breads\": \"Oven_Time_Rye\", \"range\": \"Oven_Time_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $3, and the profit per rye bread is $4. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 3*Wheat_Bread + 4*Rye_Bread\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has 4 kg of wheat flour and 3 kg of rye flour available daily.\n// 0.5*Wheat_Bread <= 4\n// 0.4*Rye_Bread <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 5 wheat breads and 4 rye breads.\n// Wheat_Bread >= 5\n// Rye_Bread >= 4",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit per wheat bread is $3, and the profit per rye bread is $4. The following table summarizes the requirements and constraints for each type of bread.\n\n| Bread Type | Profit per Bread | Oven Time per Bread | Wheat Flour per Bread | Rye Flour per Bread |\n|------------|------------------|---------------------|-----------------------|---------------------|\n| Wheat      | $3               | 0.5 hours           | 0.5 kg                | -                   |\n| Rye        | $4               | 0.75 hours          | -                     | 0.4 kg              |\n\nThe bakery has a total of 8 hours of oven time available daily. The bakery has 4 kg of wheat flour and 3 kg of rye flour available daily. The bakery has a minimum daily production requirement for each type of bread. It must produce at least 5 wheat breads and 4 rye breads.\n\nPlease help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads to produce\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads to produce\n## Oven time used for each type of bread\nOven_Time_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Wheat\", lb=0) # oven time used for wheat breads\nOven_Time_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Rye\", lb=0) # oven time used for rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 8)\n## The bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has 4 kg of wheat flour and 3 kg of rye flour available daily.\nmodel.addCons(0.5*Wheat_Bread <= 4)\nmodel.addCons(0.4*Rye_Bread <= 3)\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 5 wheat breads and 4 rye breads.\nmodel.addCons(Wheat_Bread >= 5)\nmodel.addCons(Rye_Bread >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads to produce: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads to produce: \", model.getVal(Rye_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads to produce\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads to produce\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"oven time used for wheat breads\": \"Oven_Time_Wheat\", \"range\": \"Oven_Time_Wheat >= 0\", \"type\": \"real\"}\n// {\"oven time used for rye breads\": \"Oven_Time_Rye\", \"range\": \"Oven_Time_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $3, and the profit per rye bread is $4. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 3*Wheat_Bread + 4*Rye_Bread\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has 4 kg of wheat flour and 3 kg of rye flour available daily.\n// 0.5*Wheat_Bread <= 4\n// 0.4*Rye_Bread <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of bread. It must produce at least 5 wheat breads and 4 rye breads.\n// Wheat_Bread >= 5\n// Rye_Bread >= 4",
        "question": "A bakery specializes in producing two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit per wheat bread is $3, and the profit per rye bread is $4. Each wheat bread requires 0.5 hours of oven time and 0.5 kg of wheat flour, while each rye bread requires 0.75 hours of oven time and 0.4 kg of rye flour. The bakery has a total of 8 hours of oven time, 4 kg of wheat flour, and 3 kg of rye flour available daily. The bakery must produce at least 5 wheat breads and 4 rye breads. Please help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads to produce\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads to produce\n## Oven time used for each type of bread\nOven_Time_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Wheat\", lb=0) # oven time used for wheat breads\nOven_Time_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time_Rye\", lb=0) # oven time used for rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Bread + 4*Rye_Bread)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 8)\n## The bakery has a limited supply of wheat flour and rye flour. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has 4 kg of wheat flour and 3 kg of rye flour available daily.\nmodel.addCons(0.5*Wheat_Bread <= 4)\nmodel.addCons(0.4*Rye_Bread <= 3)\n## The bakery has a minimum daily production requirement for each type of bread. It must produce at least 5 wheat breads and 4 rye breads.\nmodel.addCons(Wheat_Bread >= 5)\nmodel.addCons(Rye_Bread >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads to produce: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads to produce: \", model.getVal(Rye_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 740,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cupcakes\": \"Chocolate_Cupcakes\", \"range\": \"Chocolate_Cupcakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The bakery aims to maximize its daily profit from selling cakes and cupcakes.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes\n\n## Generate Constraint-1:\nEach cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100\n\n## Generate Constraint-2:\nEach cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\n// 4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 10",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry, and also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The following table summarizes the labor and oven space requirements for each product:\n\n| Product             | Profit per Unit | Labor Hours per Unit | Oven Space per Unit |\n|---------------------|-----------------|----------------------|---------------------|\n| Chocolate Cake      | $10             | 2 hours              | 4 square feet      |\n| Vanilla Cake        | $8              | 2 hours              | 4 square feet      |\n| Strawberry Cake     | $9              | 2 hours              | 4 square feet      |\n| Chocolate Cupcake   | $3              | 1 hour               | 1 square foot      |\n\nThe bakery has a total of 100 labor hours and 80 square feet of oven space available daily. The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations. Please help the bakery maximize its daily profit from selling cakes and cupcakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and cupcake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes\nChocolate_Cupcakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cupcakes\", lb=0) # number of chocolate cupcakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes)\n\n# Add constraints\n## Each cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100)\n## Each cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\nmodel.addCons(4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80)\n## The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of chocolate cupcakes: \", model.getVal(Chocolate_Cupcakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1345,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cupcakes\": \"Chocolate_Cupcakes\", \"range\": \"Chocolate_Cupcakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The bakery aims to maximize its daily profit from selling cakes and cupcakes.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes\n\n## Generate Constraint-1:\nEach cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100\n\n## Generate Constraint-2:\nEach cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\n// 4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 10",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry, and also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. Each cake requires 2 hours of labor and 4 square feet of oven space, while each cupcake requires 1 hour of labor and 1 square foot of oven space. The bakery has a total of 100 labor hours and 80 square feet of oven space available daily. Additionally, the bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations. Please help the bakery maximize its daily profit from selling cakes and cupcakes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and cupcake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes\nChocolate_Cupcakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cupcakes\", lb=0) # number of chocolate cupcakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes)\n\n# Add constraints\n## Each cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100)\n## Each cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\nmodel.addCons(4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80)\n## The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of chocolate cupcakes: \", model.getVal(Chocolate_Cupcakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry. Each bread type requires different amounts of flour, yeast, and sugar, and the pastry requires a specific amount of each ingredient. The bakery needs to determine the optimal daily production quantities of each item to maximize profit while meeting ingredient constraints.\n// {\"quantity of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Pastry\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and the Pastry is $2, $3, $2.5, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*B1 + 3*B2 + 2.5*B3 + 4*P\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour, 20 kg of yeast, and 30 kg of sugar available daily. Bread 1 requires 0.5 kg of flour, 0.1 kg of yeast, and 0.2 kg of sugar per unit; Bread 2 requires 0.4 kg of flour, 0.2 kg of yeast, and 0.1 kg of sugar per unit; Bread 3 requires 0.3 kg of flour, 0.15 kg of yeast, and 0.15 kg of sugar per unit; the Pastry requires 0.2 kg of flour, 0.05 kg of yeast, and 0.3 kg of sugar per unit.\n// 0.5*B1 + 0.4*B2 + 0.3*B3 + 0.2*P <= 100 (Flour constraint)\n// 0.1*B1 + 0.2*B2 + 0.15*B3 + 0.05*P <= 20 (Yeast constraint)\n// 0.2*B1 + 0.1*B2 + 0.15*B3 + 0.3*P <= 30 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery can produce at most 200 units of bread daily.\n// B1 + B2 + B3 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of Bread 1 to meet a contract obligation.\n// B1 >= 50",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry. Each bread type and the pastry require different amounts of flour, yeast, and sugar, and the bakery needs to determine the optimal daily production quantities of each item to maximize profit while meeting ingredient constraints. The profit per unit for Bread 1, Bread 2, Bread 3, and the Pastry is $2, $3, $2.5, and $4 respectively. The bakery has 100 kg of flour, 20 kg of yeast, and 30 kg of sugar available daily. The bakery can produce at most 200 units of bread daily and must produce at least 50 units of Bread 1 to meet a contract obligation. The required amounts of ingredients per unit for each item are given in the following Table.\n\n| Item       | Flour (kg) | Yeast (kg) | Sugar (kg) |\n|------------|------------|------------|------------|\n| Bread 1    | 0.5        | 0.1        | 0.2        |\n| Bread 2    | 0.4        | 0.2        | 0.1        |\n| Bread 3    | 0.3        | 0.15       | 0.15       |\n| Pastry     | 0.2        | 0.05       | 0.3        |\n\nPlease help the bakery to maximize the total daily profit by determining the optimal production quantities of Bread 1, Bread 2, Bread 3, and the Pastry.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread and pastry\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # quantity of Bread 3\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0) # quantity of Pastry\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B1 + 3*B2 + 2.5*B3 + 4*P)\n\n# Add constraints\n## Ingredient constraints\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.3*B3 + 0.2*P <= 100) # Flour constraint\nmodel.addCons(0.1*B1 + 0.2*B2 + 0.15*B3 + 0.05*P <= 20) # Yeast constraint\nmodel.addCons(0.2*B1 + 0.1*B2 + 0.15*B3 + 0.3*P <= 30) # Sugar constraint\n## Production constraints\nmodel.addCons(B1 + B2 + B3 <= 200) # Maximum bread production\nmodel.addCons(B1 >= 50) # Minimum Bread 1 production\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1: \", model.getVal(B1))\n    print(\"Quantity of Bread 2: \", model.getVal(B2))\n    print(\"Quantity of Bread 3: \", model.getVal(B3))\n    print(\"Quantity of Pastry: \", model.getVal(P))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry. Each bread type requires different amounts of flour, yeast, and sugar, and the pastry requires a specific amount of each ingredient. The bakery needs to determine the optimal daily production quantities of each item to maximize profit while meeting ingredient constraints.\n// {\"quantity of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Pastry\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and the Pastry is $2, $3, $2.5, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*B1 + 3*B2 + 2.5*B3 + 4*P\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour, 20 kg of yeast, and 30 kg of sugar available daily. Bread 1 requires 0.5 kg of flour, 0.1 kg of yeast, and 0.2 kg of sugar per unit; Bread 2 requires 0.4 kg of flour, 0.2 kg of yeast, and 0.1 kg of sugar per unit; Bread 3 requires 0.3 kg of flour, 0.15 kg of yeast, and 0.15 kg of sugar per unit; the Pastry requires 0.2 kg of flour, 0.05 kg of yeast, and 0.3 kg of sugar per unit.\n// 0.5*B1 + 0.4*B2 + 0.3*B3 + 0.2*P <= 100 (Flour constraint)\n// 0.1*B1 + 0.2*B2 + 0.15*B3 + 0.05*P <= 20 (Yeast constraint)\n// 0.2*B1 + 0.1*B2 + 0.15*B3 + 0.3*P <= 30 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery can produce at most 200 units of bread daily.\n// B1 + B2 + B3 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of Bread 1 to meet a contract obligation.\n// B1 >= 50",
        "question": "A bakery wants to optimize the production of three types of bread (Bread 1, Bread 2, Bread 3) and a pastry. The profit per unit for Bread 1, Bread 2, Bread 3, and the Pastry is $2, $3, $2.5, and $4 respectively. The bakery has 100 kg of flour, 20 kg of yeast, and 30 kg of sugar available daily. Bread 1 requires 0.5 kg of flour, 0.1 kg of yeast, and 0.2 kg of sugar per unit; Bread 2 requires 0.4 kg of flour, 0.2 kg of yeast, and 0.1 kg of sugar per unit; Bread 3 requires 0.3 kg of flour, 0.15 kg of yeast, and 0.15 kg of sugar per unit; the Pastry requires 0.2 kg of flour, 0.05 kg of yeast, and 0.3 kg of sugar per unit. The bakery can produce at most 200 units of bread daily and must produce at least 50 units of Bread 1 to meet a contract obligation.\n\nPlease help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread and pastry\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # quantity of Bread 3\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0) # quantity of Pastry\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*B1 + 3*B2 + 2.5*B3 + 4*P)\n\n# Add constraints\n## Ingredient constraints\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.3*B3 + 0.2*P <= 100) # Flour constraint\nmodel.addCons(0.1*B1 + 0.2*B2 + 0.15*B3 + 0.05*P <= 20) # Yeast constraint\nmodel.addCons(0.2*B1 + 0.1*B2 + 0.15*B3 + 0.3*P <= 30) # Sugar constraint\n## Production constraints\nmodel.addCons(B1 + B2 + B3 <= 200) # Maximum bread production\nmodel.addCons(B1 >= 50) # Minimum Bread 1 production\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1: \", model.getVal(B1))\n    print(\"Quantity of Bread 2: \", model.getVal(B2))\n    print(\"Quantity of Bread 3: \", model.getVal(B3))\n    print(\"Quantity of Pastry: \", model.getVal(P))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Whole Wheat breads\": \"W\", \"range\": \"0 <= W\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"R\", \"range\": \"0 <= R\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"S\", \"range\": \"0 <= S\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"B\", \"range\": \"0 <= B\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 2.75*S + 4.00*B\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of baking time available daily. Each Whole Wheat, Rye, Sourdough, and Brioche loaf requires 1.5, 2, 1.25, and 3 hours respectively to bake.\n// 1.5*W + 2*R + 1.25*S + 3*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Whole Wheat, Rye, Sourdough, and Brioche require 0.5, 0.75, 0.6, and 1.2 pounds of flour per loaf respectively. The total flour available is 80 pounds.\n// 0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\n// W >= 50",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery has a total of 100 hours of baking time available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 1.5, 2, 1.25, and 3 hours respectively to bake. The bakery also has a limited supply of 80 pounds of flour, and each loaf requires 0.5, 0.75, 0.6, and 1.2 pounds of flour respectively. The bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\n\nPlease help the bakery to maximize its daily profit.\n\n| Type of Bread | Profit per Loaf | Baking Time per Loaf | Flour Required per Loaf |\n|---------------|-----------------|----------------------|-------------------------|\n| Whole Wheat   | $2.50           | 1.5 hours            | 0.5 pounds              |\n| Rye           | $3.00           | 2 hours              | 0.75 pounds             |\n| Sourdough     | $2.75           | 1.25 hours           | 0.6 pounds              |\n| Brioche       | $4.00           | 3 hours              | 1.2 pounds              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of Whole Wheat breads\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Rye breads\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sourdough breads\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 2.75*S + 4.00*B)\n\n# Add constraints\n## The bakery has a total of 100 hours of baking time available daily.\nmodel.addCons(1.5*W + 2*R + 1.25*S + 3*B <= 100)\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80)\n## The bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\nmodel.addCons(W >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(W))\n    print(\"Number of Rye breads: \", model.getVal(R))\n    print(\"Number of Sourdough breads: \", model.getVal(S))\n    print(\"Number of Brioche breads: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1354,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Whole Wheat breads\": \"W\", \"range\": \"0 <= W\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"R\", \"range\": \"0 <= R\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"S\", \"range\": \"0 <= S\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"B\", \"range\": \"0 <= B\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 2.75*S + 4.00*B\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of baking time available daily. Each Whole Wheat, Rye, Sourdough, and Brioche loaf requires 1.5, 2, 1.25, and 3 hours respectively to bake.\n// 1.5*W + 2*R + 1.25*S + 3*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Whole Wheat, Rye, Sourdough, and Brioche require 0.5, 0.75, 0.6, and 1.2 pounds of flour per loaf respectively. The total flour available is 80 pounds.\n// 0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\n// W >= 50",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit. The bakery has a total of 100 hours of baking time available daily, with each Whole Wheat, Rye, Sourdough, and Brioche loaf requiring 1.5, 2, 1.25, and 3 hours respectively to bake. The bakery also has a limited supply of 80 pounds of flour, with each loaf requiring 0.5, 0.75, 0.6, and 1.2 pounds of flour respectively. Additionally, the bakery has a demand for at least 50 loaves of Whole Wheat bread daily. Please help the bakery determine the optimal number of each type of bread to produce daily to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of Whole Wheat breads\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Rye breads\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sourdough breads\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 2.75*S + 4.00*B)\n\n# Add constraints\n## The bakery has a total of 100 hours of baking time available daily.\nmodel.addCons(1.5*W + 2*R + 1.25*S + 3*B <= 100)\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80)\n## The bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\nmodel.addCons(W >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(W))\n    print(\"Number of Rye breads: \", model.getVal(R))\n    print(\"Number of Sourdough breads: \", model.getVal(S))\n    print(\"Number of Brioche breads: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread has a different production cost, selling price, and requires a specific baking time. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering time and ingredient constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3.50, $4.00, $4.50, and $5.00 respectively. The production cost per loaf is $1.50, $2.00, $2.50, and $3.00 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: (3.50 - 1.50)*x1 + (4.00 - 2.00)*x2 + (4.50 - 2.50)*x3 + (5.00 - 3.00)*x4\n\n## Generate Constraint-1:\nThe total baking time for Whole Wheat, Rye, Sourdough, and Brioche is 30 minutes, 40 minutes, 50 minutes, and 60 minutes respectively. The bakery has a total of 8 hours of baking time available daily.\n// 30*x1 + 40*x2 + 50*x3 + 60*x4 <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a limited supply of a key ingredient that is used in all four types of bread. The supply is enough for 200 loaves in total.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 30% of the total production is Whole Wheat bread to meet health-conscious customer demand.\n// x1 >= 0.30 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread has a different production cost, selling price, and requires a specific baking time. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering time and ingredient constraints. The selling price and production cost per loaf for each type of bread are given in the following Table.\n\n| Bread Type    | Selling Price | Production Cost | Baking Time |\n|---------------|---------------|-----------------|-------------|\n| Whole Wheat   | $3.50         | $1.50           | 30 minutes  |\n| Rye           | $4.00         | $2.00           | 40 minutes  |\n| Sourdough     | $4.50         | $2.50           | 50 minutes  |\n| Brioche       | $5.00         | $3.00           | 60 minutes  |\n\nThe bakery has a total of 8 hours of baking time available daily. The bakery also has a limited supply of a key ingredient that is used in all four types of bread, enough for 200 loaves in total. Additionally, the bakery wants to ensure that at least 30% of the total production is Whole Wheat bread to meet health-conscious customer demand.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 1.50)*x1 + (4.00 - 2.00)*x2 + (4.50 - 2.50)*x3 + (5.00 - 3.00)*x4)\n\n# Add constraints\n## The total baking time for all types of bread\nmodel.addCons(30*x1 + 40*x2 + 50*x3 + 60*x4 <= 8 * 60)\n## The limited supply of a key ingredient\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## At least 30% of the total production is Whole Wheat bread\nmodel.addCons(x1 >= 0.30 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread has a different production cost, selling price, and requires a specific baking time. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering time and ingredient constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3.50, $4.00, $4.50, and $5.00 respectively. The production cost per loaf is $1.50, $2.00, $2.50, and $3.00 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: (3.50 - 1.50)*x1 + (4.00 - 2.00)*x2 + (4.50 - 2.50)*x3 + (5.00 - 3.00)*x4\n\n## Generate Constraint-1:\nThe total baking time for Whole Wheat, Rye, Sourdough, and Brioche is 30 minutes, 40 minutes, 50 minutes, and 60 minutes respectively. The bakery has a total of 8 hours of baking time available daily.\n// 30*x1 + 40*x2 + 50*x3 + 60*x4 <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a limited supply of a key ingredient that is used in all four types of bread. The supply is enough for 200 loaves in total.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 30% of the total production is Whole Wheat bread to meet health-conscious customer demand.\n// x1 >= 0.30 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread has a different production cost, selling price, and requires a specific baking time. The selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3.50, $4.00, $4.50, and $5.00 respectively. The production cost per loaf is $1.50, $2.00, $2.50, and $3.00 respectively. The bakery wants to maximize the total daily profit.\n\nThe total baking time for Whole Wheat, Rye, Sourdough, and Brioche is 30 minutes, 40 minutes, 50 minutes, and 60 minutes respectively. The bakery has a total of 8 hours of baking time available daily. The bakery has a limited supply of a key ingredient that is used in all four types of bread. The supply is enough for 200 loaves in total. The bakery wants to ensure that at least 30% of the total production is Whole Wheat bread to meet health-conscious customer demand.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize profit while considering time and ingredient constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 1.50)*x1 + (4.00 - 2.00)*x2 + (4.50 - 2.50)*x3 + (5.00 - 3.00)*x4)\n\n# Add constraints\n## The total baking time for all types of bread\nmodel.addCons(30*x1 + 40*x2 + 50*x3 + 60*x4 <= 8 * 60)\n## The limited supply of a key ingredient\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## At least 30% of the total production is Whole Wheat bread\nmodel.addCons(x1 >= 0.30 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type.\n// {\"daily production quantity of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 1500\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 800\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 3000 kilograms of flour available daily. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000\n\n## Generate Constraint-2:\nThe bakery can produce at most 2500 loaves of bread in total daily.\n// B1 + B2 + B3 + B4 <= 2500\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\n// B1 >= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The following table summarizes the flour requirements per loaf for each bread type.\n\n| Bread Type | Profit per Loaf | Flour Requirement per Loaf |\n|------------|-----------------|----------------------------|\n| Bread 1    | $1.50           | 0.5 kg                     |\n| Bread 2    | $2.00           | 0.4 kg                     |\n| Bread 3    | $1.80           | 0.6 kg                     |\n| Bread 4    | $2.20           | 0.3 kg                     |\n\nThe bakery has a total of 3000 kilograms of flour available daily. The bakery can produce at most 2500 loaves of bread in total daily. The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation. Please help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each bread type\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # daily production quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500) # daily production quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=800) # daily production quantity of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=1200) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4)\n\n# Add constraints\n## The bakery has a total of 3000 kilograms of flour available daily.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000)\n## The bakery can produce at most 2500 loaves of bread in total daily.\nmodel.addCons(B1 + B2 + B3 + B4 <= 2500)\n## The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\nmodel.addCons(B1 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(B1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(B2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(B3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type.\n// {\"daily production quantity of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 1500\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 800\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 3000 kilograms of flour available daily. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000\n\n## Generate Constraint-2:\nThe bakery can produce at most 2500 loaves of bread in total daily.\n// B1 + B2 + B3 + B4 <= 2500\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\n// B1 >= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery has a total of 3000 kilograms of flour available daily, with each loaf of Bread 1-4 requiring 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively. The bakery can produce at most 2500 loaves of bread in total daily. Additionally, the bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each bread type\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # daily production quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500) # daily production quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=800) # daily production quantity of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=1200) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4)\n\n# Add constraints\n## The bakery has a total of 3000 kilograms of flour available daily.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000)\n## The bakery can produce at most 2500 loaves of bread in total daily.\nmodel.addCons(B1 + B2 + B3 + B4 <= 2500)\n## The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\nmodel.addCons(B1 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(B1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(B2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(B3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily.\n// {\"amount of Bread 1 to produce\": \"b1\", \"range\": \"0 <= b1 <= 1000\", \"type\": \"integer\"}\n// {\"amount of Bread 2 to produce\": \"b2\", \"range\": \"0 <= b2 <= 1500\", \"type\": \"integer\"}\n// {\"amount of Bread 3 to produce\": \"b3\", \"range\": \"0 <= b3 <= 800\", \"type\": \"integer\"}\n// {\"amount of Bread 4 to produce\": \"b4\", \"range\": \"0 <= b4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4\n\n## Generate Constraint-1:\nThe total daily production capacity of the bakery is 3000 loaves.\n// b1 + b2 + b3 + b4 <= 3000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\n// 10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000\n\n## Generate Constraint-3:\nThe cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\n// 0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily. The profit per loaf and the cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost of Ingredients per Loaf |\n|------------|-----------------|------------------------------|\n| Bread 1    | $1.50           | $0.50                        |\n| Bread 2    | $2.00           | $0.70                        |\n| Bread 3    | $1.80           | $0.60                        |\n| Bread 4    | $2.20           | $0.80                        |\n\nThe bakery has a total daily production capacity of 3000 loaves. Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g. The bakery has a daily budget of $2000 for ingredients.\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0, ub=1000) # amount of Bread 1 to produce\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0, ub=1500) # amount of Bread 2 to produce\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0, ub=800) # amount of Bread 3 to produce\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0, ub=1200) # amount of Bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4)\n\n# Add constraints\n## The total daily production capacity of the bakery is 3000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 3000)\n## Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\nmodel.addCons(10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000)\n## The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\nmodel.addCons(0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 to produce: \", model.getVal(b1))\n    print(\"Amount of Bread 2 to produce: \", model.getVal(b2))\n    print(\"Amount of Bread 3 to produce: \", model.getVal(b3))\n    print(\"Amount of Bread 4 to produce: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily.\n// {\"amount of Bread 1 to produce\": \"b1\", \"range\": \"0 <= b1 <= 1000\", \"type\": \"integer\"}\n// {\"amount of Bread 2 to produce\": \"b2\", \"range\": \"0 <= b2 <= 1500\", \"type\": \"integer\"}\n// {\"amount of Bread 3 to produce\": \"b3\", \"range\": \"0 <= b3 <= 800\", \"type\": \"integer\"}\n// {\"amount of Bread 4 to produce\": \"b4\", \"range\": \"0 <= b4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4\n\n## Generate Constraint-1:\nThe total daily production capacity of the bakery is 3000 loaves.\n// b1 + b2 + b3 + b4 <= 3000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\n// 10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000\n\n## Generate Constraint-3:\nThe cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\n// 0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The total daily production capacity of the bakery is 3000 loaves. Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively, and the bakery must ensure that the total daily fiber content is at least 40,000g. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively, and the bakery has a daily budget of $2000 for ingredients. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0, ub=1000) # amount of Bread 1 to produce\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0, ub=1500) # amount of Bread 2 to produce\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0, ub=800) # amount of Bread 3 to produce\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0, ub=1200) # amount of Bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4)\n\n# Add constraints\n## The total daily production capacity of the bakery is 3000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 3000)\n## Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\nmodel.addCons(10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000)\n## The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\nmodel.addCons(0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 to produce: \", model.getVal(b1))\n    print(\"Amount of Bread 2 to produce: \", model.getVal(b2))\n    print(\"Amount of Bread 3 to produce: \", model.getVal(b3))\n    print(\"Amount of Bread 4 to produce: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints.\n// {\"amount of Whole Wheat bread to produce\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye bread to produce\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Sourdough bread to produce\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"amount of Croissants to produce\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 units.\n// Whole_Wheat + Rye + Sourdough + Croissant <= 1000\n\n## Generate Constraint-2:\nEach type of bread must contribute at least 20% of the total bread production (excluding pastries).\n// Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Whole Wheat bread daily.\n// Whole_Wheat >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints. The profit per unit for each product is as follows:\n\n| Product         | Profit per Unit |\n|-----------------|-----------------|\n| Whole Wheat     | $2              |\n| Rye             | $3              |\n| Sourdough       | $2.5            |\n| Croissant       | $1.5            |\n\nThe bakery has a daily production capacity of 1000 units. Each type of bread must contribute at least 20% of the total bread production (excluding pastries). Additionally, the bakery must produce at least 100 units of Whole Wheat bread daily.\n\nPlease help the bakery to maximize the total daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry to produce\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # amount of Whole Wheat bread to produce\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye bread to produce\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # amount of Sourdough bread to produce\nCroissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissant\", lb=0) # amount of Croissants to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 units.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Croissant <= 1000)\n## Each type of bread must contribute at least 20% of the total bread production (excluding pastries).\nmodel.addCons(Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough))\n## The bakery must produce at least 100 units of Whole Wheat bread daily.\nmodel.addCons(Whole_Wheat >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat bread to produce: \", model.getVal(Whole_Wheat))\n    print(\"Amount of Rye bread to produce: \", model.getVal(Rye))\n    print(\"Amount of Sourdough bread to produce: \", model.getVal(Sourdough))\n    print(\"Amount of Croissants to produce: \", model.getVal(Croissant))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints.\n// {\"amount of Whole Wheat bread to produce\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye bread to produce\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Sourdough bread to produce\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"amount of Croissants to produce\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 units.\n// Whole_Wheat + Rye + Sourdough + Croissant <= 1000\n\n## Generate Constraint-2:\nEach type of bread must contribute at least 20% of the total bread production (excluding pastries).\n// Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Whole Wheat bread daily.\n// Whole_Wheat >= 100",
        "question": "A bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints. The profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery has a daily production capacity of 1000 units. Each type of bread must contribute at least 20% of the total bread production (excluding pastries). The bakery must also produce at least 100 units of Whole Wheat bread daily. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry to produce\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # amount of Whole Wheat bread to produce\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye bread to produce\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # amount of Sourdough bread to produce\nCroissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissant\", lb=0) # amount of Croissants to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 units.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Croissant <= 1000)\n## Each type of bread must contribute at least 20% of the total bread production (excluding pastries).\nmodel.addCons(Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough))\n## The bakery must produce at least 100 units of Whole Wheat bread daily.\nmodel.addCons(Whole_Wheat >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat bread to produce: \", model.getVal(Whole_Wheat))\n    print(\"Amount of Rye bread to produce: \", model.getVal(Rye))\n    print(\"Amount of Sourdough bread to produce: \", model.getVal(Sourdough))\n    print(\"Amount of Croissants to produce: \", model.getVal(Croissant))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 615,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"q_wheat\", \"range\": \"q_wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"q_rye\", \"range\": \"q_rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"q_sourdough\", \"range\": \"q_sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Whole Grain bread\": \"q_whole_grain\", \"range\": \"q_whole_grain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily revenue.\n// Objective Function: Maximize: 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\n// q_wheat + q_rye + q_sourdough + q_whole_grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\n// q_whole_grain >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for each type of bread is given in the following Table.\n\n| Bread Type       | Selling Price per Loaf |\n|------------------|------------------------|\n| Wheat            | $2.50                  |\n| Rye              | $3.00                  |\n| Sourdough        | $3.50                  |\n| Whole Grain      | $4.00                  |\n\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day. The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\n\nPlease help the bakery to maximize its daily revenue by determining the optimal daily production quantity for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"q_wheat\", lb=0) # daily production quantity of Wheat bread\nq_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"q_rye\", lb=0) # daily production quantity of Rye bread\nq_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"q_sourdough\", lb=0) # daily production quantity of Sourdough bread\nq_whole_grain = model.addVar(vtype=\"CONTINUOUS\", name=\"q_whole_grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\nmodel.addCons(q_wheat + q_rye + q_sourdough + q_whole_grain <= 300)\n## The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\nmodel.addCons(q_whole_grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(q_wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(q_rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(q_sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(q_whole_grain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1171,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"q_wheat\", \"range\": \"q_wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"q_rye\", \"range\": \"q_rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"q_sourdough\", \"range\": \"q_sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Whole Grain bread\": \"q_whole_grain\", \"range\": \"q_whole_grain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily revenue.\n// Objective Function: Maximize: 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\n// q_wheat + q_rye + q_sourdough + q_whole_grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\n// q_whole_grain >= 50",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requiring 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day. Additionally, the bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations. Please help the bakery maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"q_wheat\", lb=0) # daily production quantity of Wheat bread\nq_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"q_rye\", lb=0) # daily production quantity of Rye bread\nq_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"q_sourdough\", lb=0) # daily production quantity of Sourdough bread\nq_whole_grain = model.addVar(vtype=\"CONTINUOUS\", name=\"q_whole_grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\nmodel.addCons(q_wheat + q_rye + q_sourdough + q_whole_grain <= 300)\n## The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\nmodel.addCons(q_whole_grain >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(q_wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(q_rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(q_sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(q_whole_grain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to determine the daily production quantities of each pastry type to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of croissants produced\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins produced\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts produced\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.70*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery's oven can only handle a total of 500 pastries per day.\n// Croissants + Muffins + Donuts <= 500\n\n## Generate Constraint-2:\nThe daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least twice as many muffins as croissants.\n// Muffins >= 2*Croissants",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to determine the daily production quantities of each pastry type to maximize profit while considering the limited oven capacity and daily demand. The profit per croissant is $0.50, per muffin is $0.70, and per donut is $0.60. The bakery's oven can only handle a total of 500 pastries per day. The daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200. The bakery has a policy to produce at least twice as many muffins as croissants.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n\n| Pastry Type | Profit per Unit |\n|-------------|-----------------|\n| Croissants  | $0.50           |\n| Muffins     | $0.70           |\n| Donuts      | $0.60           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants produced\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins produced\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.70*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery's oven can only handle a total of 500 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n## The daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a policy to produce at least twice as many muffins as croissants.\nmodel.addCons(Muffins >= 2*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants produced: \", model.getVal(Croissants))\n    print(\"Number of Muffins produced: \", model.getVal(Muffins))\n    print(\"Number of Donuts produced: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to determine the daily production quantities of each pastry type to maximize profit while considering the limited oven capacity and daily demand.\n// {\"number of croissants produced\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins produced\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts produced\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.70*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nThe bakery's oven can only handle a total of 500 pastries per day.\n// Croissants + Muffins + Donuts <= 500\n\n## Generate Constraint-2:\nThe daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200.\n// Croissants >= 100\n// Muffins >= 150\n// Donuts >= 200\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least twice as many muffins as croissants.\n// Muffins >= 2*Croissants",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to determine the daily production quantities of each pastry type to maximize profit while considering the limited oven capacity and daily demand. The profit per croissant is $0.50, per muffin is $0.70, and per donut is $0.60. The bakery's oven can only handle a total of 500 pastries per day. The daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200. The bakery has a policy to produce at least twice as many muffins as croissants. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants produced\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins produced\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.70*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery's oven can only handle a total of 500 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts <= 500)\n## The daily demand for croissants is at least 100, for muffins is at least 150, and for donuts is at least 200.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 200)\n## The bakery has a policy to produce at least twice as many muffins as croissants.\nmodel.addCons(Muffins >= 2*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants produced: \", model.getVal(Croissants))\n    print(\"Number of Muffins produced: \", model.getVal(Muffins))\n    print(\"Number of Donuts produced: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 668,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used\": \"Machine_Time\", \"range\": \"Machine_Time >= 0\", \"type\": \"real\"}\n// {\"number of labor hours used\": \"Labor_Time\", \"range\": \"Labor_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from each unit of Product B is $70. The company aims to maximize its daily profit from the production of these two products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\n// A >= 10\n// B >= 5",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from each unit of Product B is $70. The requirements for machine and labor hours for each product are given in the following Table.\n\n| Product | Profit per Unit | Machine Hours per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------|----------------------|\n| A       | $50             | 2 hours                | 1 hour               |\n| B       | $70             | 3 hours                | 2 hours              |\n\nThe total machine time available per day is 120 hours. The total labor hours available per day is 80 hours. The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\n\nPlease help the company to maximize its daily profit from the production of these two products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The number of hours of machine time and labor hours used\nMachine_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Time\", lb=0) # number of hours of machine time used\nLabor_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Time\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used\": \"Machine_Time\", \"range\": \"Machine_Time >= 0\", \"type\": \"real\"}\n// {\"number of labor hours used\": \"Labor_Time\", \"range\": \"Labor_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from each unit of Product B is $70. The company aims to maximize its daily profit from the production of these two products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\n// A >= 10\n// B >= 5",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from each unit of Product B is $70. Each unit of Product A requires 2 hours of machine time and 1 hour of labor, while each unit of Product B requires 3 hours of machine time and 2 hours of labor. The total machine time available per day is 120 hours, and the total labor hours available per day is 80 hours. The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day. Please help the company to maximize its daily profit from the production of these two products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The number of hours of machine time and labor hours used\nMachine_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Time\", lb=0) # number of hours of machine time used\nLabor_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Time\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by using three different types of vehicles: small, medium, and large. The company needs to decide how many of each type of vehicle to use for a specific delivery task, considering the capacity and cost of each vehicle.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"total cost of using all vehicles\": \"Total_Cost\", \"range\": \"Total_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of using a small vehicle is $100 per trip, a medium vehicle is $200 per trip, and a large vehicle is $300 per trip. The company aims to minimize the total cost of all vehicle trips.\n// Objective Function: Minimize: 100*Small + 200*Medium + 300*Large\n\n## Generate Constraint-1:\nThe total capacity of all vehicles must meet the delivery demand, which is 500 units. A small vehicle can carry 50 units, a medium vehicle can carry 100 units, and a large vehicle can carry 150 units.\n// 50*Small + 100*Medium + 150*Large >= 500\n\n## Generate Constraint-2:\nThe company has a limited fleet size. The maximum number of small vehicles available is 10, medium vehicles is 8, and large vehicles is 6.\n// Small <= 10\n// Medium <= 8\n// Large <= 6\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the total vehicles used are small vehicles to maintain flexibility in narrow routes.\n// Small >= 0.20 * (Small + Medium + Large)",
        "question": "A logistics company is planning to optimize its delivery routes by using three different types of vehicles: small, medium, and large. The company needs to decide how many of each type of vehicle to use for a specific delivery task, considering the capacity and cost of each vehicle. The cost of using a small vehicle is $100 per trip, a medium vehicle is $200 per trip, and a large vehicle is $300 per trip. The company aims to minimize the total cost of all vehicle trips.\n\n| Vehicle Type | Cost per Trip | Capacity |\n|--------------|---------------|----------|\n| Small        | $100          | 50 units |\n| Medium       | $200          | 100 units|\n| Large        | $300          | 150 units|\n\nThe total capacity of all vehicles must meet the delivery demand, which is 500 units. The company has a limited fleet size. The maximum number of small vehicles available is 10, medium vehicles is 8, and large vehicles is 6. The company wants to ensure that at least 20% of the total vehicles used are small vehicles to maintain flexibility in narrow routes.\n\nPlease help the company to determine the optimal number of each type of vehicle to minimize the total cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of vehicle\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Small + 200*Medium + 300*Large)\n\n# Add constraints\n## The total capacity of all vehicles must meet the delivery demand, which is 500 units.\nmodel.addCons(50*Small + 100*Medium + 150*Large >= 500)\n## The company has a limited fleet size.\nmodel.addCons(Small <= 10)\nmodel.addCons(Medium <= 8)\nmodel.addCons(Large <= 6)\n## The company wants to ensure that at least 20% of the total vehicles used are small vehicles.\nmodel.addCons(Small >= 0.20 * (Small + Medium + Large))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small vehicles: \", model.getVal(Small))\n    print(\"Number of medium vehicles: \", model.getVal(Medium))\n    print(\"Number of large vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1193,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by using three different types of vehicles: small, medium, and large. The company needs to decide how many of each type of vehicle to use for a specific delivery task, considering the capacity and cost of each vehicle.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"total cost of using all vehicles\": \"Total_Cost\", \"range\": \"Total_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of using a small vehicle is $100 per trip, a medium vehicle is $200 per trip, and a large vehicle is $300 per trip. The company aims to minimize the total cost of all vehicle trips.\n// Objective Function: Minimize: 100*Small + 200*Medium + 300*Large\n\n## Generate Constraint-1:\nThe total capacity of all vehicles must meet the delivery demand, which is 500 units. A small vehicle can carry 50 units, a medium vehicle can carry 100 units, and a large vehicle can carry 150 units.\n// 50*Small + 100*Medium + 150*Large >= 500\n\n## Generate Constraint-2:\nThe company has a limited fleet size. The maximum number of small vehicles available is 10, medium vehicles is 8, and large vehicles is 6.\n// Small <= 10\n// Medium <= 8\n// Large <= 6\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the total vehicles used are small vehicles to maintain flexibility in narrow routes.\n// Small >= 0.20 * (Small + Medium + Large)",
        "question": "A logistics company is planning to optimize its delivery routes by using three different types of vehicles: small, medium, and large. The company needs to decide how many of each type of vehicle to use for a specific delivery task, considering the capacity and cost of each vehicle. The cost of using a small vehicle is $100 per trip, a medium vehicle is $200 per trip, and a large vehicle is $300 per trip. The company aims to minimize the total cost of all vehicle trips. The total capacity of all vehicles must meet the delivery demand, which is 500 units. A small vehicle can carry 50 units, a medium vehicle can carry 100 units, and a large vehicle can carry 150 units. The company has a limited fleet size. The maximum number of small vehicles available is 10, medium vehicles is 8, and large vehicles is 6. The company wants to ensure that at least 20% of the total vehicles used are small vehicles to maintain flexibility in narrow routes. Please help the company determine the optimal number of each type of vehicle to use.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of vehicle\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Small + 200*Medium + 300*Large)\n\n# Add constraints\n## The total capacity of all vehicles must meet the delivery demand, which is 500 units.\nmodel.addCons(50*Small + 100*Medium + 150*Large >= 500)\n## The company has a limited fleet size.\nmodel.addCons(Small <= 10)\nmodel.addCons(Medium <= 8)\nmodel.addCons(Large <= 6)\n## The company wants to ensure that at least 20% of the total vehicles used are small vehicles.\nmodel.addCons(Small >= 0.20 * (Small + Medium + Large))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small vehicles: \", model.getVal(Small))\n    print(\"Number of medium vehicles: \", model.getVal(Medium))\n    print(\"Number of large vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its hub to three distinct zones: Zone A, Zone B, and Zone C.\n// {\"number of small packages to Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of small packages to Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of small packages to Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone A\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone B\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone C\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one small package to each zone is $5, $6, and $7 respectively. The cost of delivering one medium package is $10, $12, and $15 respectively. The cost of delivering one large package is $20, $25, and $30 respectively. The company aims to minimize the total delivery cost.\n// Objective Function: Minimize: 5*SA + 6*SB + 7*SC + 10*MA + 12*MB + 15*MC + 20*LA + 25*LB + 30*LC\n\n## Generate Constraint-1:\nThe company has a daily capacity of 500 small packages, 300 medium packages, and 200 large packages.\n// SA + SB + SC <= 500\n// MA + MB + MC <= 300\n// LA + LB + LC <= 200\n\n## Generate Constraint-2:\nEach zone has a minimum delivery requirement. Zone A requires at least 100 small, 50 medium, and 20 large packages. Zone B requires at least 150 small, 75 medium, and 30 large packages. Zone C requires at least 200 small, 100 medium, and 40 large packages.\n// SA + MA + LA >= 100\n// SB + MB + LB >= 150\n// SC + MC + LC >= 200\n\n## Generate Constraint-3:\nThe total number of packages delivered to each zone should not exceed the zone's capacity. Zone A can handle up to 300 packages, Zone B up to 400, and Zone C up to 500.\n// SA + MA + LA <= 300\n// SB + MB + LB <= 400\n// SC + MC + LC <= 500",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its hub to three distinct zones: Zone A, Zone B, and Zone C. The cost of delivering one small package to each zone is $5, $6, and $7 respectively. The cost of delivering one medium package is $10, $12, and $15 respectively. The cost of delivering one large package is $20, $25, and $30 respectively. The company aims to minimize the total delivery cost.\n\n| Package Type | Zone A Cost | Zone B Cost | Zone C Cost |\n|--------------|-------------|-------------|-------------|\n| Small        | 5$          | 6$          | 7$          |\n| Medium       | 10$         | 12$         | 15$         |\n| Large        | 20$         | 25$         | 30$         |\n\nThe company has a daily capacity of 500 small packages, 300 medium packages, and 200 large packages. Each zone has a minimum delivery requirement. Zone A requires at least 100 small, 50 medium, and 20 large packages. Zone B requires at least 150 small, 75 medium, and 30 large packages. Zone C requires at least 200 small, 100 medium, and 40 large packages. The total number of packages delivered to each zone should not exceed the zone's capacity. Zone A can handle up to 300 packages, Zone B up to 400, and Zone C up to 500.\n\nPlease help the company to determine the optimal number of each type of package to deliver to each zone to minimize the total delivery cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of packages to each zone\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of small packages to Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of small packages to Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of small packages to Zone C\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of medium packages to Zone A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of medium packages to Zone B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of medium packages to Zone C\nLA = model.addVar(vtype=\"INTEGER\", name=\"LA\", lb=0) # number of large packages to Zone A\nLB = model.addVar(vtype=\"INTEGER\", name=\"LB\", lb=0) # number of large packages to Zone B\nLC = model.addVar(vtype=\"INTEGER\", name=\"LC\", lb=0) # number of large packages to Zone C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*SA + 6*SB + 7*SC + 10*MA + 12*MB + 15*MC + 20*LA + 25*LB + 30*LC)\n\n# Add constraints\n## Daily capacity constraints\nmodel.addCons(SA + SB + SC <= 500)\nmodel.addCons(MA + MB + MC <= 300)\nmodel.addCons(LA + LB + LC <= 200)\n## Minimum delivery requirements\nmodel.addCons(SA + MA + LA >= 100)\nmodel.addCons(SB + MB + LB >= 150)\nmodel.addCons(SC + MC + LC >= 200)\n## Zone capacity constraints\nmodel.addCons(SA + MA + LA <= 300)\nmodel.addCons(SB + MB + LB <= 400)\nmodel.addCons(SC + MC + LC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages to Zone A: \", model.getVal(SA))\n    print(\"Number of small packages to Zone B: \", model.getVal(SB))\n    print(\"Number of small packages to Zone C: \", model.getVal(SC))\n    print(\"Number of medium packages to Zone A: \", model.getVal(MA))\n    print(\"Number of medium packages to Zone B: \", model.getVal(MB))\n    print(\"Number of medium packages to Zone C: \", model.getVal(MC))\n    print(\"Number of large packages to Zone A: \", model.getVal(LA))\n    print(\"Number of large packages to Zone B: \", model.getVal(LB))\n    print(\"Number of large packages to Zone C: \", model.getVal(LC))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1525,
        "var_num": 9,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its hub to three distinct zones: Zone A, Zone B, and Zone C.\n// {\"number of small packages to Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of small packages to Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of small packages to Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of medium packages to Zone C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone A\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone B\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"integer\"}\n// {\"number of large packages to Zone C\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one small package to each zone is $5, $6, and $7 respectively. The cost of delivering one medium package is $10, $12, and $15 respectively. The cost of delivering one large package is $20, $25, and $30 respectively. The company aims to minimize the total delivery cost.\n// Objective Function: Minimize: 5*SA + 6*SB + 7*SC + 10*MA + 12*MB + 15*MC + 20*LA + 25*LB + 30*LC\n\n## Generate Constraint-1:\nThe company has a daily capacity of 500 small packages, 300 medium packages, and 200 large packages.\n// SA + SB + SC <= 500\n// MA + MB + MC <= 300\n// LA + LB + LC <= 200\n\n## Generate Constraint-2:\nEach zone has a minimum delivery requirement. Zone A requires at least 100 small, 50 medium, and 20 large packages. Zone B requires at least 150 small, 75 medium, and 30 large packages. Zone C requires at least 200 small, 100 medium, and 40 large packages.\n// SA + MA + LA >= 100\n// SB + MB + LB >= 150\n// SC + MC + LC >= 200\n\n## Generate Constraint-3:\nThe total number of packages delivered to each zone should not exceed the zone's capacity. Zone A can handle up to 300 packages, Zone B up to 400, and Zone C up to 500.\n// SA + MA + LA <= 300\n// SB + MB + LB <= 400\n// SC + MC + LC <= 500",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of packages: small, medium, and large. The company needs to decide how many of each type of package to deliver from its hub to three distinct zones: Zone A, Zone B, and Zone C.\nThe cost of delivering one small package to each zone is $5, $6, and $7 respectively. The cost of delivering one medium package is $10, $12, and $15 respectively. The cost of delivering one large package is $20, $25, and $30 respectively. The company aims to minimize the total delivery cost.\nThe company has a daily capacity of 500 small packages, 300 medium packages, and 200 large packages. Each zone has a minimum delivery requirement. Zone A requires at least 100 small, 50 medium, and 20 large packages. Zone B requires at least 150 small, 75 medium, and 30 large packages. Zone C requires at least 200 small, 100 medium, and 40 large packages. The total number of packages delivered to each zone should not exceed the zone's capacity. Zone A can handle up to 300 packages, Zone B up to 400, and Zone C up to 500.\nPlease help the company to minimize the total delivery cost while meeting all the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of packages to each zone\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of small packages to Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of small packages to Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of small packages to Zone C\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of medium packages to Zone A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of medium packages to Zone B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of medium packages to Zone C\nLA = model.addVar(vtype=\"INTEGER\", name=\"LA\", lb=0) # number of large packages to Zone A\nLB = model.addVar(vtype=\"INTEGER\", name=\"LB\", lb=0) # number of large packages to Zone B\nLC = model.addVar(vtype=\"INTEGER\", name=\"LC\", lb=0) # number of large packages to Zone C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*SA + 6*SB + 7*SC + 10*MA + 12*MB + 15*MC + 20*LA + 25*LB + 30*LC)\n\n# Add constraints\n## Daily capacity constraints\nmodel.addCons(SA + SB + SC <= 500)\nmodel.addCons(MA + MB + MC <= 300)\nmodel.addCons(LA + LB + LC <= 200)\n## Minimum delivery requirements\nmodel.addCons(SA + MA + LA >= 100)\nmodel.addCons(SB + MB + LB >= 150)\nmodel.addCons(SC + MC + LC >= 200)\n## Zone capacity constraints\nmodel.addCons(SA + MA + LA <= 300)\nmodel.addCons(SB + MB + LB <= 400)\nmodel.addCons(SC + MC + LC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of small packages to Zone A: \", model.getVal(SA))\n    print(\"Number of small packages to Zone B: \", model.getVal(SB))\n    print(\"Number of small packages to Zone C: \", model.getVal(SC))\n    print(\"Number of medium packages to Zone A: \", model.getVal(MA))\n    print(\"Number of medium packages to Zone B: \", model.getVal(MB))\n    print(\"Number of medium packages to Zone C: \", model.getVal(MC))\n    print(\"Number of large packages to Zone A: \", model.getVal(LA))\n    print(\"Number of large packages to Zone B: \", model.getVal(LB))\n    print(\"Number of large packages to Zone C: \", model.getVal(LC))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 9,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units of overproduction\": \"Overproduction\", \"range\": \"Overproduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// Smartphones + Tablets + Laptops + Overproduction <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\n// Smartphones >= 200\n// Tablets >= 150\n// Laptops >= 100\n\n## Generate Constraint-3:\nThe company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\n// Overproduction <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand. The profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $50             |\n| Tablets      | $70             |\n| Laptops      | $100            |\n\nThe production capacity of the factory is limited to 1000 units per day. The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day. The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\n\nPlease help the company determine the optimal number of smartphones, tablets, laptops, and units of overproduction to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\nOverproduction = model.addVar(vtype=\"INTEGER\", name=\"Overproduction\", lb=0) # number of units of overproduction\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops + Overproduction <= 1000)\n## The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\nmodel.addCons(Smartphones >= 200)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 100)\n## The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\nmodel.addCons(Overproduction <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Number of units of overproduction: \", model.getVal(Overproduction))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units of overproduction\": \"Overproduction\", \"range\": \"Overproduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// Smartphones + Tablets + Laptops + Overproduction <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\n// Smartphones >= 200\n// Tablets >= 150\n// Laptops >= 100\n\n## Generate Constraint-3:\nThe company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\n// Overproduction <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\nThe production capacity of the factory is limited to 1000 units per day. The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day. The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\nPlease help the company determine the optimal number of smartphones, tablets, laptops, and units of overproduction to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\nOverproduction = model.addVar(vtype=\"INTEGER\", name=\"Overproduction\", lb=0) # number of units of overproduction\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops + Overproduction <= 1000)\n## The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\nmodel.addCons(Smartphones >= 200)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 100)\n## The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\nmodel.addCons(Overproduction <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Number of units of overproduction: \", model.getVal(Overproduction))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by wheat bread\": \"oven_wheat\", \"range\": \"oven_wheat >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by rye bread\": \"oven_rye\", \"range\": \"oven_rye >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by sourdough bread\": \"oven_sourdough\", \"range\": \"oven_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively.\n// oven_wheat = 5*wheat\n// oven_rye = 7*rye\n// oven_sourdough = 10*sourdough\n// Constraint: oven_wheat + oven_rye + oven_sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\n// wheat <= 150\n// rye <= 100\n// sourdough <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\n// wheat >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively. The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively. The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Oven Capacity per Loaf | Daily Demand |\n|---------------|-----------------|------------------------|--------------|\n| Wheat         | $3              | 5 units                | 150 loaves   |\n| Rye           | $4              | 7 units                | 100 loaves   |\n| Sourdough     | $5              | 10 units               | 80 loaves    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\n## Oven capacity used by each type of bread\noven_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_wheat\", lb=0) # oven capacity used by wheat bread\noven_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_rye\", lb=0) # oven capacity used by rye bread\noven_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_sourdough\", lb=0) # oven capacity used by sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 units.\nmodel.addCons(oven_wheat == 5*wheat)\nmodel.addCons(oven_rye == 7*rye)\nmodel.addCons(oven_sourdough == 10*sourdough)\nmodel.addCons(oven_wheat + oven_rye + oven_sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\nmodel.addCons(wheat <= 150)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 80)\n## The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\nmodel.addCons(wheat >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by wheat bread\": \"oven_wheat\", \"range\": \"oven_wheat >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by rye bread\": \"oven_rye\", \"range\": \"oven_rye >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by sourdough bread\": \"oven_sourdough\", \"range\": \"oven_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively.\n// oven_wheat = 5*wheat\n// oven_rye = 7*rye\n// oven_sourdough = 10*sourdough\n// Constraint: oven_wheat + oven_rye + oven_sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\n// wheat <= 150\n// rye <= 100\n// sourdough <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\n// wheat >= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively. The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively. The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\n## Oven capacity used by each type of bread\noven_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_wheat\", lb=0) # oven capacity used by wheat bread\noven_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_rye\", lb=0) # oven capacity used by rye bread\noven_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_sourdough\", lb=0) # oven capacity used by sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 units.\nmodel.addCons(oven_wheat == 5*wheat)\nmodel.addCons(oven_rye == 7*rye)\nmodel.addCons(oven_sourdough == 10*sourdough)\nmodel.addCons(oven_wheat + oven_rye + oven_sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\nmodel.addCons(wheat <= 150)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 80)\n## The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\nmodel.addCons(wheat >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 200 units per day.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\n// A_sold >= 50\n// B_sold >= 70\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n| C       | 40$             |\n\nThe production capacity of the factory is limited to 200 units per day. The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day. The company can only sell as many units as it produces for each product.\n\nPlease help the company to determine the optimal number of units of products A, B, and C to produce and sell daily to maximize profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory is limited to 200 units per day.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\nmodel.addCons(A_sold >= 50)\nmodel.addCons(B_sold >= 70)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 200 units per day.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\n// A_sold >= 50\n// B_sold >= 70\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory is limited to 200 units per day. The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day. The company can only sell as many units as it produces for each product. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory is limited to 200 units per day.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\nmodel.addCons(A_sold >= 50)\nmodel.addCons(B_sold >= 70)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw materials used\": \"raw_materials\", \"range\": \"raw_materials >= 0\", \"type\": \"real\"}\n// {\"quantity of labor hours used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total raw materials available for production is 1000 units. Each unit of Product A requires 5 units of raw materials, Product B requires 7 units, and Product C requires 6 units.\n// 5*A + 7*B + 6*C <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for production is 800 hours. Each unit of Product A requires 4 hours of labor, Product B requires 5 hours, and Product C requires 3 hours.\n// 4*A + 5*B + 3*C <= 800\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product C is at least 60 units.\n// A >= 50\n// C >= 60",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $50             | 5 units                 | 4 hours              |\n| B       | $70             | 7 units                 | 5 hours              |\n| C       | $60             | 6 units                 | 3 hours              |\n\nThe total raw materials available for production is 1000 units. The total labor hours available for production is 800 hours. The market demand for Product A is at least 50 units, and for Product C is at least 60 units. \n\nPlease help the manufacturer to maximize the total profit from the production of these products, considering the constraints on raw materials, labor hours, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total raw materials available for production is 1000 units.\nmodel.addCons(5*A + 7*B + 6*C <= 1000)\n## The total labor hours available for production is 800 hours.\nmodel.addCons(4*A + 5*B + 3*C <= 800)\n## The market demand for Product A is at least 50 units, and for Product C is at least 60 units.\nmodel.addCons(A >= 50)\nmodel.addCons(C >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw materials used\": \"raw_materials\", \"range\": \"raw_materials >= 0\", \"type\": \"real\"}\n// {\"quantity of labor hours used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total raw materials available for production is 1000 units. Each unit of Product A requires 5 units of raw materials, Product B requires 7 units, and Product C requires 6 units.\n// 5*A + 7*B + 6*C <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for production is 800 hours. Each unit of Product A requires 4 hours of labor, Product B requires 5 hours, and Product C requires 3 hours.\n// 4*A + 5*B + 3*C <= 800\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units, and for Product C is at least 60 units.\n// A >= 50\n// C >= 60",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The manufacturer aims to maximize the total profit from the production of these products. The total raw materials available for production is 1000 units. Each unit of Product A requires 5 units of raw materials, Product B requires 7 units, and Product C requires 6 units. The total labor hours available for production is 800 hours. Each unit of Product A requires 4 hours of labor, Product B requires 5 hours, and Product C requires 3 hours. The market demand for Product A is at least 50 units, and for Product C is at least 60 units. Please help the manufacturer determine the optimal production quantities for each product to maximize profit while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total raw materials available for production is 1000 units.\nmodel.addCons(5*A + 7*B + 6*C <= 1000)\n## The total labor hours available for production is 800 hours.\nmodel.addCons(4*A + 5*B + 3*C <= 800)\n## The market demand for Product A is at least 50 units, and for Product C is at least 60 units.\nmodel.addCons(A >= 50)\nmodel.addCons(C >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day, and for product B, it is at least 20 units per day. Please help the company determine the optimal number of units of each product to produce and sell daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n\n# Additional constraints to link production and sales\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day, and the market demand for product B is at least 20 units per day. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n\n# Additional constraints to link production and sales\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the time required for baking, and the demand from customers.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"oven_hours\", \"range\": \"oven_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of ingredients for wheat, rye, and sourdough bread are $0.50, $0.75, and $1.00 per loaf, respectively. The bakery has a daily budget of $150 for ingredients. The time required to bake each loaf of wheat, rye, and sourdough bread is 0.1 hours, 0.15 hours, and 0.2 hours, respectively. The bakery has a daily limit of 10 hours of oven usage. The bakery wants to maximize the number of loaves produced within these constraints.\n// Objective Function: Maximize: wheat_loaves + rye_loaves + sourdough_loaves\n\n## Generate Constraint-1:\nThe total cost of ingredients for all bread types should not exceed $150.\n// 0.50 * wheat_loaves + 0.75 * rye_loaves + 1.00 * sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe total time spent baking all bread types should not exceed 10 hours.\n// 0.1 * wheat_loaves + 0.15 * rye_loaves + 0.2 * sourdough_loaves <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 100, 75, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 75\n// sourdough_loaves >= 50",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the time required for baking, and the demand from customers. The cost of ingredients and the time required to bake each loaf are given in the following Table.\n\n| Bread Type     | Cost per Loaf | Baking Time per Loaf |\n|----------------|---------------|----------------------|\n| Wheat          | $0.50         | 0.1 hours            |\n| Rye            | $0.75         | 0.15 hours           |\n| Sourdough      | $1.00         | 0.2 hours            |\n\nThe bakery has a daily budget of $150 for ingredients. The bakery has a daily limit of 10 hours of oven usage. The bakery must meet the daily demand for each type of bread, which is 100 loaves for wheat, 75 loaves for rye, and 50 loaves for sourdough. \n\nPlease help the bakery to maximize the number of loaves produced within these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\noven_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_hours\", lb=0) # number of hours of oven usage\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == wheat_loaves + rye_loaves + sourdough_loaves)\n\n# Add constraints\n## The total cost of ingredients for all bread types should not exceed $150.\nmodel.addCons(0.50 * wheat_loaves + 0.75 * rye_loaves + 1.00 * sourdough_loaves <= 150)\n## The total time spent baking all bread types should not exceed 10 hours.\nmodel.addCons(0.1 * wheat_loaves + 0.15 * rye_loaves + 0.2 * sourdough_loaves <= 10)\n## The bakery must meet the daily demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 75)\nmodel.addCons(sourdough_loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Number of Loaves Produced: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the time required for baking, and the demand from customers.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"oven_hours\", \"range\": \"oven_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of ingredients for wheat, rye, and sourdough bread are $0.50, $0.75, and $1.00 per loaf, respectively. The bakery has a daily budget of $150 for ingredients. The time required to bake each loaf of wheat, rye, and sourdough bread is 0.1 hours, 0.15 hours, and 0.2 hours, respectively. The bakery has a daily limit of 10 hours of oven usage. The bakery wants to maximize the number of loaves produced within these constraints.\n// Objective Function: Maximize: wheat_loaves + rye_loaves + sourdough_loaves\n\n## Generate Constraint-1:\nThe total cost of ingredients for all bread types should not exceed $150.\n// 0.50 * wheat_loaves + 0.75 * rye_loaves + 1.00 * sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe total time spent baking all bread types should not exceed 10 hours.\n// 0.1 * wheat_loaves + 0.15 * rye_loaves + 0.2 * sourdough_loaves <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 100, 75, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 75\n// sourdough_loaves >= 50",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the time required for baking, and the demand from customers. The cost of ingredients for wheat, rye, and sourdough bread are $0.50, $0.75, and $1.00 per loaf, respectively. The bakery has a daily budget of $150 for ingredients. The time required to bake each loaf of wheat, rye, and sourdough bread is 0.1 hours, 0.15 hours, and 0.2 hours, respectively. The bakery has a daily limit of 10 hours of oven usage. The bakery must meet the daily demand for each type of bread, which is 100 loaves of wheat, 75 loaves of rye, and 50 loaves of sourdough.\nPlease help the bakery to maximize the number of loaves produced within these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\noven_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_hours\", lb=0) # number of hours of oven usage\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == wheat_loaves + rye_loaves + sourdough_loaves)\n\n# Add constraints\n## The total cost of ingredients for all bread types should not exceed $150.\nmodel.addCons(0.50 * wheat_loaves + 0.75 * rye_loaves + 1.00 * sourdough_loaves <= 150)\n## The total time spent baking all bread types should not exceed 10 hours.\nmodel.addCons(0.1 * wheat_loaves + 0.15 * rye_loaves + 0.2 * sourdough_loaves <= 10)\n## The bakery must meet the daily demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 75)\nmodel.addCons(sourdough_loaves >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Number of Loaves Produced: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to determine the production quantities for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"quantity of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"raw material used for Product A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"raw material used for Product B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"raw material used for Product C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, Product B, and Product C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*PA + 70*PB + 60*PC\n\n## Generate Constraint-1:\nThe total raw material available for production is 1000 units. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units.\n// 2*PA + 3*PB + 4*PC <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units.\n// PA >= 10\n// PB >= 20\n// PC >= 15\n\n## Generate Constraint-3:\nThe production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\n// PA <= 50\n// PB <= 40\n// PC <= 30",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to determine the production quantities for each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit of Product A, Product B, and Product C is $50, $70, and $60, respectively. The following table summarizes the raw material requirements and production capacity constraints for each product.\n\n| Product | Profit per Unit | Raw Material per Unit | Maximum Production Capacity |\n|---------|-----------------|-----------------------|-----------------------------|\n| A       | $50             | 2 units               | 50 units                     |\n| B       | $70             | 3 units               | 40 units                     |\n| C       | $60             | 4 units               | 30 units                     |\n\nThe total raw material available for production is 1000 units. The market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units. The production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\n\nPlease help the manufacturer to maximize the total profit from the production of these products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # quantity of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # quantity of Product B produced\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 70*PB + 60*PC)\n\n# Add constraints\n## The total raw material available for production is 1000 units.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 1000)\n## The market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units.\nmodel.addCons(PA >= 10)\nmodel.addCons(PB >= 20)\nmodel.addCons(PC >= 15)\n## The production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\nmodel.addCons(PA <= 50)\nmodel.addCons(PB <= 40)\nmodel.addCons(PC <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(PA))\n    print(\"Quantity of Product B produced: \", model.getVal(PB))\n    print(\"Quantity of Product C produced: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to determine the production quantities for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"quantity of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"raw material used for Product A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"raw material used for Product B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"raw material used for Product C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, Product B, and Product C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*PA + 70*PB + 60*PC\n\n## Generate Constraint-1:\nThe total raw material available for production is 1000 units. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units.\n// 2*PA + 3*PB + 4*PC <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units.\n// PA >= 10\n// PB >= 20\n// PC >= 15\n\n## Generate Constraint-3:\nThe production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\n// PA <= 50\n// PB <= 40\n// PC <= 30",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to determine the production quantities for each product to maximize profit while considering the constraints of raw material availability and market demand.\nThe profit per unit of Product A, Product B, and Product C is $50, $70, and $60, respectively. The total raw material available for production is 1000 units. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units. The production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # quantity of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # quantity of Product B produced\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 70*PB + 60*PC)\n\n# Add constraints\n## The total raw material available for production is 1000 units.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 1000)\n## The market demand for Product A is at least 10 units, for Product B is at least 20 units, and for Product C is at least 15 units.\nmodel.addCons(PA >= 10)\nmodel.addCons(PB >= 20)\nmodel.addCons(PC >= 15)\n## The production capacity of the factory allows for a maximum of 50 units of Product A, 40 units of Product B, and 30 units of Product C to be produced.\nmodel.addCons(PA <= 50)\nmodel.addCons(PB <= 40)\nmodel.addCons(PC <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(PA))\n    print(\"Quantity of Product B produced: \", model.getVal(PB))\n    print(\"Quantity of Product C produced: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake.\n// {\"number of chocolate cakes produced\": \"chocolate_cakes\", \"range\": \"chocolate_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes produced\": \"vanilla_cakes\", \"range\": \"vanilla_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes produced\": \"strawberry_cakes\", \"range\": \"strawberry_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours worked\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n// Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n// Labor_Cost = 20*(8 + overtime_hours)\n// Objective Function: Minimize: Production_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a maximum capacity of 100 cakes per day.\n// chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100\n\n## Generate Constraint-2:\nThe demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\n// chocolate_cakes >= 30\n// vanilla_cakes >= 20\n// strawberry_cakes >= 15\n\n## Generate Constraint-3:\nThe bakery can operate for a maximum of 10 hours of overtime per day.\n// overtime_hours <= 10",
        "question": "A bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake. The cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n\n| Cake Type       | Production Cost |\n|-----------------|-----------------|\n| Chocolate Cakes | $5              |\n| Vanilla Cakes   | $4              |\n| Strawberry Cakes| $6              |\n\nThe bakery has a maximum capacity of 100 cakes per day. The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day. The bakery can operate for a maximum of 10 hours of overtime per day.\n\nPlease help the bakery determine the optimal number of each type of cake to produce and the necessary overtime hours to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced and the overtime hours\nchocolate_cakes = model.addVar(vtype=\"INTEGER\", name=\"chocolate_cakes\", lb=0) # number of chocolate cakes produced\nvanilla_cakes = model.addVar(vtype=\"INTEGER\", name=\"vanilla_cakes\", lb=0) # number of vanilla cakes produced\nstrawberry_cakes = model.addVar(vtype=\"INTEGER\", name=\"strawberry_cakes\", lb=0) # number of strawberry cakes produced\novertime_hours = model.addVar(vtype=\"INTEGER\", name=\"overtime_hours\", lb=0) # number of overtime hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\nProduction_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n## Labor_Cost = 20*(8 + overtime_hours)\nLabor_Cost = 20*(8 + overtime_hours)\nmodel.addCons(obj == Production_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a maximum capacity of 100 cakes per day.\nmodel.addCons(chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100)\n## The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\nmodel.addCons(chocolate_cakes >= 30)\nmodel.addCons(vanilla_cakes >= 20)\nmodel.addCons(strawberry_cakes >= 15)\n## The bakery can operate for a maximum of 10 hours of overtime per day.\nmodel.addCons(overtime_hours <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes produced: \", model.getVal(chocolate_cakes))\n    print(\"Number of vanilla cakes produced: \", model.getVal(vanilla_cakes))\n    print(\"Number of strawberry cakes produced: \", model.getVal(strawberry_cakes))\n    print(\"Number of overtime hours worked: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake.\n// {\"number of chocolate cakes produced\": \"chocolate_cakes\", \"range\": \"chocolate_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes produced\": \"vanilla_cakes\", \"range\": \"vanilla_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes produced\": \"strawberry_cakes\", \"range\": \"strawberry_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours worked\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n// Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n// Labor_Cost = 20*(8 + overtime_hours)\n// Objective Function: Minimize: Production_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a maximum capacity of 100 cakes per day.\n// chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100\n\n## Generate Constraint-2:\nThe demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\n// chocolate_cakes >= 30\n// vanilla_cakes >= 20\n// strawberry_cakes >= 15\n\n## Generate Constraint-3:\nThe bakery can operate for a maximum of 10 hours of overtime per day.\n// overtime_hours <= 10",
        "question": "A bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake. The cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor. The bakery has a maximum capacity of 100 cakes per day. The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day. The bakery can operate for a maximum of 10 hours of overtime per day. Please help the bakery determine the optimal number of each type of cake to produce and the necessary overtime hours to minimize the total cost of production and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced and the overtime hours\nchocolate_cakes = model.addVar(vtype=\"INTEGER\", name=\"chocolate_cakes\", lb=0) # number of chocolate cakes produced\nvanilla_cakes = model.addVar(vtype=\"INTEGER\", name=\"vanilla_cakes\", lb=0) # number of vanilla cakes produced\nstrawberry_cakes = model.addVar(vtype=\"INTEGER\", name=\"strawberry_cakes\", lb=0) # number of strawberry cakes produced\novertime_hours = model.addVar(vtype=\"INTEGER\", name=\"overtime_hours\", lb=0) # number of overtime hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\nProduction_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n## Labor_Cost = 20*(8 + overtime_hours)\nLabor_Cost = 20*(8 + overtime_hours)\nmodel.addCons(obj == Production_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a maximum capacity of 100 cakes per day.\nmodel.addCons(chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100)\n## The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\nmodel.addCons(chocolate_cakes >= 30)\nmodel.addCons(vanilla_cakes >= 20)\nmodel.addCons(strawberry_cakes >= 15)\n## The bakery can operate for a maximum of 10 hours of overtime per day.\nmodel.addCons(overtime_hours <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes produced: \", model.getVal(chocolate_cakes))\n    print(\"Number of vanilla cakes produced: \", model.getVal(vanilla_cakes))\n    print(\"Number of strawberry cakes produced: \", model.getVal(strawberry_cakes))\n    print(\"Number of overtime hours worked: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type is limited.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product A\": \"cap_A\", \"range\": \"cap_A >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product B\": \"cap_B\", \"range\": \"cap_B >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product C\": \"cap_C\", \"range\": \"cap_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer wants to maximize the total weekly profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe weekly production capacity for Product A is 100 units.\n// A <= cap_A\n\n## Generate Constraint-2:\nThe weekly production capacity for Product B is 150 units.\n// B <= cap_B\n\n## Generate Constraint-3:\nThe weekly production capacity for Product C is 200 units.\n// C <= cap_C",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The weekly production capacities for each product type are limited as follows:\n\n| Product | Profit per Unit | Weekly Production Capacity |\n|---------|-----------------|-----------------------------|\n| A       | $50             | 100 units                    |\n| B       | $70             | 150 units                    |\n| C       | $60             | 200 units                    |\n\nThe manufacturer wants to maximize the total weekly profit. Please help the manufacturer determine the optimal number of units of each product to produce, considering the given production capacities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n## Weekly production capacity for each product\ncap_A = 100 # weekly production capacity for Product A\ncap_B = 150 # weekly production capacity for Product B\ncap_C = 200 # weekly production capacity for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The weekly production capacity for Product A is 100 units.\nmodel.addCons(A <= cap_A)\n## The weekly production capacity for Product B is 150 units.\nmodel.addCons(B <= cap_B)\n## The weekly production capacity for Product C is 200 units.\nmodel.addCons(C <= cap_C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type is limited.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product A\": \"cap_A\", \"range\": \"cap_A >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product B\": \"cap_B\", \"range\": \"cap_B >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product C\": \"cap_C\", \"range\": \"cap_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer wants to maximize the total weekly profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe weekly production capacity for Product A is 100 units.\n// A <= cap_A\n\n## Generate Constraint-2:\nThe weekly production capacity for Product B is 150 units.\n// B <= cap_B\n\n## Generate Constraint-3:\nThe weekly production capacity for Product C is 200 units.\n// C <= cap_C",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The weekly production capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units. Please help the manufacturer to maximize the total weekly profit while adhering to the production capacities.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n## Weekly production capacity for each product\ncap_A = 100 # weekly production capacity for Product A\ncap_B = 150 # weekly production capacity for Product B\ncap_C = 200 # weekly production capacity for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The weekly production capacity for Product A is 100 units.\nmodel.addCons(A <= cap_A)\n## The weekly production capacity for Product B is 150 units.\nmodel.addCons(B <= cap_B)\n## The weekly production capacity for Product C is 200 units.\nmodel.addCons(C <= cap_C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 493,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\n// B <= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours Required per Unit |\n|---------|-------------------------------|\n| A       | 2 hours                       |\n| B       | 3 hours                       |\n| C       | 4 hours                       |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day. The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity. \n\nPlease help the company to maximize the total daily profit from the production of these products, ensuring that the total labor hours used for production do not exceed the available labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\nmodel.addCons(B <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\n// B <= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours of 100 hours daily. The market demand for product A is at least 10 units per day, and the company can only produce a maximum of 20 units of product B per day due to limited machinery capacity. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\nmodel.addCons(B <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total labor hours used daily must not exceed 100 hours.\n// 2*A + 3*B + 1*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units.\n// A >= 10\n// B >= 15\n// C >= 20\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Requirement per Unit |\n|---------|---------------------------|\n| A       | 2 hours                   |\n| B       | 3 hours                   |\n| C       | 1 hour                    |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units. The company also has a policy to produce at least twice as many units of product C as product A. \n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total labor hours used daily must not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C <= 100)\n## The market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\nmodel.addCons(C >= 20)\n## The company has a policy to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total labor hours used daily must not exceed 100 hours.\n// 2*A + 3*B + 1*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units.\n// A >= 10\n// B >= 15\n// C >= 20\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total labor hours used daily must not exceed 100 hours. The market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units. The company has a policy to produce at least twice as many units of product C as product A. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total labor hours used daily must not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C <= 100)\n## The market demand for product A is at least 10 units daily, for product B is at least 15 units, and for product C is at least 20 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\nmodel.addCons(C >= 20)\n## The company has a policy to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"sold_A\", \"range\": \"sold_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"sold_B\", \"range\": \"sold_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"sold_C\", \"range\": \"sold_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*sold_A + 30*sold_B + 40*sold_C\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day.\n// sold_A >= 50\n// sold_B >= 75\n// sold_C >= 100\n\n## Generate Constraint-3:\nThe company must sell all products produced each day.\n// sold_A == A\n// sold_B == B\n// sold_C == C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the production and market demand constraints:\n\n| Product | Production Capacity | Market Demand |\n|---------|---------------------|---------------|\n| A       | 100 units           | 50 units      |\n| B       | 150 units           | 75 units      |\n| C       | 200 units           | 100 units     |\n\nThe production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units. The market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day. The company must sell all products produced each day. \n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nsold_A = model.addVar(vtype=\"INTEGER\", name=\"sold_A\", lb=0) # number of units of product A sold daily\nsold_B = model.addVar(vtype=\"INTEGER\", name=\"sold_B\", lb=0) # number of units of product B sold daily\nsold_C = model.addVar(vtype=\"INTEGER\", name=\"sold_C\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*sold_A + 30*sold_B + 40*sold_C)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day.\nmodel.addCons(sold_A >= 50)\nmodel.addCons(sold_B >= 75)\nmodel.addCons(sold_C >= 100)\n## The company must sell all products produced each day.\nmodel.addCons(sold_A == A)\nmodel.addCons(sold_B == B)\nmodel.addCons(sold_C == C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(sold_A))\n    print(\"Number of units of product B sold daily: \", model.getVal(sold_B))\n    print(\"Number of units of product C sold daily: \", model.getVal(sold_C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"sold_A\", \"range\": \"sold_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"sold_B\", \"range\": \"sold_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"sold_C\", \"range\": \"sold_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*sold_A + 30*sold_B + 40*sold_C\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day.\n// sold_A >= 50\n// sold_B >= 75\n// sold_C >= 100\n\n## Generate Constraint-3:\nThe company must sell all products produced each day.\n// sold_A == A\n// sold_B == B\n// sold_C == C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units. The market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day. The company must sell all products produced each day. Please help the company determine the optimal daily production and sales quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nsold_A = model.addVar(vtype=\"INTEGER\", name=\"sold_A\", lb=0) # number of units of product A sold daily\nsold_B = model.addVar(vtype=\"INTEGER\", name=\"sold_B\", lb=0) # number of units of product B sold daily\nsold_C = model.addVar(vtype=\"INTEGER\", name=\"sold_C\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*sold_A + 30*sold_B + 40*sold_C)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of product A to 100 units, product B to 150 units, and product C to 200 units.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The market demand for product A is at least 50 units per day, for product B is at least 75 units per day, and for product C is at least 100 units per day.\nmodel.addCons(sold_A >= 50)\nmodel.addCons(sold_B >= 75)\nmodel.addCons(sold_C >= 100)\n## The company must sell all products produced each day.\nmodel.addCons(sold_A == A)\nmodel.addCons(sold_B == B)\nmodel.addCons(sold_C == C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(sold_A))\n    print(\"Number of units of product B sold daily: \", model.getVal(sold_B))\n    print(\"Number of units of product C sold daily: \", model.getVal(sold_C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of packages to deliver on each route. The company has four routes (Route A, Route B, Route C, Route D) and needs to determine the optimal number of trucks and packages for each route.\n// {\"number of trucks for Route A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"trucks_D\", \"range\": \"trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route A\": \"packages_A\", \"range\": \"packages_A >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route B\": \"packages_B\", \"range\": \"packages_B >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route C\": \"packages_C\", \"range\": \"packages_C >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route D\": \"packages_D\", \"range\": \"packages_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route is different. The cost for Route A is $100 per truck, for Route B is $120 per truck, for Route C is $150 per truck, and for Route D is $180 per truck. The company wants to minimize the total cost of operating trucks and delivering packages.\n// Objective Function: Minimize: 100*trucks_A + 120*trucks_B + 150*trucks_C + 180*trucks_D + 5*packages_A + 6*packages_B + 7*packages_C + 8*packages_D\n\n## Generate Constraint-1:\nEach truck can carry a maximum of 100 packages.\n// packages_A <= 100*trucks_A\n// packages_B <= 100*trucks_B\n// packages_C <= 100*trucks_C\n// packages_D <= 100*trucks_D\n\n## Generate Constraint-2:\nThe company has a total of 400 packages to deliver.\n// packages_A + packages_B + packages_C + packages_D = 400\n\n## Generate Constraint-3:\nThe company can use a maximum of 5 trucks in total.\n// trucks_A + trucks_B + trucks_C + trucks_D <= 5",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of packages to deliver on each route. The company has four routes (Route A, Route B, Route C, Route D) and needs to determine the optimal number of trucks and packages for each route. The cost of operating a truck on each route is different, as shown in the following Table.\n\n| Route | Cost per Truck |\n|-------|----------------|\n| A     | $100           |\n| B     | $120           |\n| C     | $150           |\n| D     | $180           |\n\nThe company wants to minimize the total cost of operating trucks and delivering packages, which includes a cost of $5 per package for Route A, $6 per package for Route B, $7 per package for Route C, and $8 per package for Route D. Each truck can carry a maximum of 100 packages. The company has a total of 400 packages to deliver and can use a maximum of 5 trucks in total.\n\nPlease help the company to determine the optimal number of trucks and packages for each route to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks for each route\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks for Route A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks for Route B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks for Route C\ntrucks_D = model.addVar(vtype=\"INTEGER\", name=\"trucks_D\", lb=0) # number of trucks for Route D\n## The number of packages for each route\npackages_A = model.addVar(vtype=\"INTEGER\", name=\"packages_A\", lb=0) # number of packages for Route A\npackages_B = model.addVar(vtype=\"INTEGER\", name=\"packages_B\", lb=0) # number of packages for Route B\npackages_C = model.addVar(vtype=\"INTEGER\", name=\"packages_C\", lb=0) # number of packages for Route C\npackages_D = model.addVar(vtype=\"INTEGER\", name=\"packages_D\", lb=0) # number of packages for Route D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*trucks_A + 120*trucks_B + 150*trucks_C + 180*trucks_D + 5*packages_A + 6*packages_B + 7*packages_C + 8*packages_D)\n\n# Add constraints\n## Each truck can carry a maximum of 100 packages.\nmodel.addCons(packages_A <= 100*trucks_A)\nmodel.addCons(packages_B <= 100*trucks_B)\nmodel.addCons(packages_C <= 100*trucks_C)\nmodel.addCons(packages_D <= 100*trucks_D)\n## The company has a total of 400 packages to deliver.\nmodel.addCons(packages_A + packages_B + packages_C + packages_D == 400)\n## The company can use a maximum of 5 trucks in total.\nmodel.addCons(trucks_A + trucks_B + trucks_C + trucks_D <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Route A: \", model.getVal(trucks_A))\n    print(\"Number of trucks for Route B: \", model.getVal(trucks_B))\n    print(\"Number of trucks for Route C: \", model.getVal(trucks_C))\n    print(\"Number of trucks for Route D: \", model.getVal(trucks_D))\n    print(\"Number of packages for Route A: \", model.getVal(packages_A))\n    print(\"Number of packages for Route B: \", model.getVal(packages_B))\n    print(\"Number of packages for Route C: \", model.getVal(packages_C))\n    print(\"Number of packages for Route D: \", model.getVal(packages_D))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of packages to deliver on each route. The company has four routes (Route A, Route B, Route C, Route D) and needs to determine the optimal number of trucks and packages for each route.\n// {\"number of trucks for Route A\": \"trucks_A\", \"range\": \"trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"trucks_B\", \"range\": \"trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"trucks_C\", \"range\": \"trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"trucks_D\", \"range\": \"trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route A\": \"packages_A\", \"range\": \"packages_A >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route B\": \"packages_B\", \"range\": \"packages_B >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route C\": \"packages_C\", \"range\": \"packages_C >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Route D\": \"packages_D\", \"range\": \"packages_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route is different. The cost for Route A is $100 per truck, for Route B is $120 per truck, for Route C is $150 per truck, and for Route D is $180 per truck. The company wants to minimize the total cost of operating trucks and delivering packages.\n// Objective Function: Minimize: 100*trucks_A + 120*trucks_B + 150*trucks_C + 180*trucks_D + 5*packages_A + 6*packages_B + 7*packages_C + 8*packages_D\n\n## Generate Constraint-1:\nEach truck can carry a maximum of 100 packages.\n// packages_A <= 100*trucks_A\n// packages_B <= 100*trucks_B\n// packages_C <= 100*trucks_C\n// packages_D <= 100*trucks_D\n\n## Generate Constraint-2:\nThe company has a total of 400 packages to deliver.\n// packages_A + packages_B + packages_C + packages_D = 400\n\n## Generate Constraint-3:\nThe company can use a maximum of 5 trucks in total.\n// trucks_A + trucks_B + trucks_C + trucks_D <= 5",
        "question": "A logistics company is planning to optimize its delivery routes by deciding the number of trucks to use for each route and the number of packages to deliver on each route. The company has four routes (Route A, Route B, Route C, Route D) and needs to determine the optimal number of trucks and packages for each route. The cost of operating a truck on each route is different: $100 per truck for Route A, $120 per truck for Route B, $150 per truck for Route C, and $180 per truck for Route D. The company wants to minimize the total cost of operating trucks and delivering packages. Each truck can carry a maximum of 100 packages. The company has a total of 400 packages to deliver and can use a maximum of 5 trucks in total.\n\nPlease help the company to minimize the total cost of operating trucks and delivering packages, considering the constraints on the number of trucks and packages for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of trucks for each route\ntrucks_A = model.addVar(vtype=\"INTEGER\", name=\"trucks_A\", lb=0) # number of trucks for Route A\ntrucks_B = model.addVar(vtype=\"INTEGER\", name=\"trucks_B\", lb=0) # number of trucks for Route B\ntrucks_C = model.addVar(vtype=\"INTEGER\", name=\"trucks_C\", lb=0) # number of trucks for Route C\ntrucks_D = model.addVar(vtype=\"INTEGER\", name=\"trucks_D\", lb=0) # number of trucks for Route D\n## The number of packages for each route\npackages_A = model.addVar(vtype=\"INTEGER\", name=\"packages_A\", lb=0) # number of packages for Route A\npackages_B = model.addVar(vtype=\"INTEGER\", name=\"packages_B\", lb=0) # number of packages for Route B\npackages_C = model.addVar(vtype=\"INTEGER\", name=\"packages_C\", lb=0) # number of packages for Route C\npackages_D = model.addVar(vtype=\"INTEGER\", name=\"packages_D\", lb=0) # number of packages for Route D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*trucks_A + 120*trucks_B + 150*trucks_C + 180*trucks_D + 5*packages_A + 6*packages_B + 7*packages_C + 8*packages_D)\n\n# Add constraints\n## Each truck can carry a maximum of 100 packages.\nmodel.addCons(packages_A <= 100*trucks_A)\nmodel.addCons(packages_B <= 100*trucks_B)\nmodel.addCons(packages_C <= 100*trucks_C)\nmodel.addCons(packages_D <= 100*trucks_D)\n## The company has a total of 400 packages to deliver.\nmodel.addCons(packages_A + packages_B + packages_C + packages_D == 400)\n## The company can use a maximum of 5 trucks in total.\nmodel.addCons(trucks_A + trucks_B + trucks_C + trucks_D <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Route A: \", model.getVal(trucks_A))\n    print(\"Number of trucks for Route B: \", model.getVal(trucks_B))\n    print(\"Number of trucks for Route C: \", model.getVal(trucks_C))\n    print(\"Number of trucks for Route D: \", model.getVal(trucks_D))\n    print(\"Number of packages for Route A: \", model.getVal(packages_A))\n    print(\"Number of packages for Route B: \", model.getVal(packages_B))\n    print(\"Number of packages for Route C: \", model.getVal(packages_C))\n    print(\"Number of packages for Route D: \", model.getVal(packages_D))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra wheat bread loaves if demand exceeds\": \"extra_wheat_loaves\", \"range\": \"extra_wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra rye bread loaves if demand exceeds\": \"extra_rye_loaves\", \"range\": \"extra_rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra sourdough bread loaves if demand exceeds\": \"extra_sourdough_loaves\", \"range\": \"extra_sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 800\n\n## Generate Constraint-3:\nThe bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The following table shows the flour requirements per loaf and the daily demand for each type of bread.\n\n| Type of Bread | Profit per Loaf | Flour Requirement per Loaf | Daily Demand |\n|---------------|-----------------|----------------------------|--------------|\n| Wheat         | $3              | 0.5 kg                     | 300 loaves   |\n| Rye           | $4              | 0.6 kg                     | 200 loaves   |\n| Sourdough     | $5              | 0.7 kg                     | 150 loaves   |\n\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. The bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints. The bakery should not produce more than the demand for each type of bread. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The number of extra loaves if demand exceeds\nextra_wheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_wheat_loaves\", lb=0) # number of extra wheat bread loaves if demand exceeds\nextra_rye_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_rye_loaves\", lb=0) # number of extra rye bread loaves if demand exceeds\nextra_sourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_sourdough_loaves\", lb=0) # number of extra sourdough bread loaves if demand exceeds\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available daily.\nmodel.addCons(0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500)\n## The bakery can produce a maximum of 800 loaves of bread daily.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 800)\n## The bakery has a daily demand for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra wheat bread loaves: \", model.getVal(extra_wheat_loaves))\n    print(\"Number of extra rye bread loaves: \", model.getVal(extra_rye_loaves))\n    print(\"Number of extra sourdough bread loaves: \", model.getVal(extra_sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1350,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra wheat bread loaves if demand exceeds\": \"extra_wheat_loaves\", \"range\": \"extra_wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra rye bread loaves if demand exceeds\": \"extra_rye_loaves\", \"range\": \"extra_rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra sourdough bread loaves if demand exceeds\": \"extra_sourdough_loaves\", \"range\": \"extra_sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 800\n\n## Generate Constraint-3:\nThe bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit. The bakery has a limited amount of flour available daily, with the total amount of flour used for all types of bread not exceeding 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints. The bakery has a daily demand for each type of bread, with the demand for wheat, rye, and sourdough bread being 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The number of extra loaves if demand exceeds\nextra_wheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_wheat_loaves\", lb=0) # number of extra wheat bread loaves if demand exceeds\nextra_rye_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_rye_loaves\", lb=0) # number of extra rye bread loaves if demand exceeds\nextra_sourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_sourdough_loaves\", lb=0) # number of extra sourdough bread loaves if demand exceeds\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available daily.\nmodel.addCons(0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500)\n## The bakery can produce a maximum of 800 loaves of bread daily.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 800)\n## The bakery has a daily demand for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra wheat bread loaves: \", model.getVal(extra_wheat_loaves))\n    print(\"Number of extra rye bread loaves: \", model.getVal(extra_rye_loaves))\n    print(\"Number of extra sourdough bread loaves: \", model.getVal(extra_sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints.\n// {\"amount of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n// Objective Function: Maximize: 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3)\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units in total, Factory 2 can produce a maximum of 150 units in total, and Factory 3 can produce a maximum of 200 units in total.\n// A_F1 + B_F1 <= 100\n// A_F2 + B_F2 <= 150\n// A_F3 + B_F3 <= 200\n\n## Generate Constraint-2:\nThe company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client.\n// A_F1 + A_F2 + A_F3 >= 200\n// B_F1 + B_F2 + B_F3 >= 150\n\n## Generate Constraint-3:\nDue to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n// A_F1 + A_F2 + A_F3 <= 300\n// B_F1 + B_F2 + B_F3 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints. The profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units in total, Factory 2 can produce a maximum of 150 units in total, and Factory 3 can produce a maximum of 200 units in total. The company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client. Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n\nPlease help the company determine the optimal production quantities for Product A and Product B in each factory to maximize total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of Product A and Product B produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # amount of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # amount of Product A produced in Factory 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # amount of Product A produced in Factory 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # amount of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # amount of Product B produced in Factory 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # amount of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3))\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(A_F1 + B_F1 <= 100)\nmodel.addCons(A_F2 + B_F2 <= 150)\nmodel.addCons(A_F3 + B_F3 <= 200)\n## The company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client.\nmodel.addCons(A_F1 + A_F2 + A_F3 >= 200)\nmodel.addCons(B_F1 + B_F2 + B_F3 >= 150)\n## Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 <= 300)\nmodel.addCons(B_F1 + B_F2 + B_F3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Amount of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Amount of Product A produced in Factory 3: \", model.getVal(A_F3))\n    print(\"Amount of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Amount of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Amount of Product B produced in Factory 3: \", model.getVal(B_F3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1257,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints.\n// {\"amount of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product A produced in Factory 3\": \"A_F3\", \"range\": \"A_F3 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced in Factory 3\": \"B_F3\", \"range\": \"B_F3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. The company aims to maximize its total profit from all factories.\n// Objective Function: Maximize: 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3)\n\n## Generate Constraint-1:\nEach factory has a limited production capacity. Factory 1 can produce a maximum of 100 units in total, Factory 2 can produce a maximum of 150 units in total, and Factory 3 can produce a maximum of 200 units in total.\n// A_F1 + B_F1 <= 100\n// A_F2 + B_F2 <= 150\n// A_F3 + B_F3 <= 200\n\n## Generate Constraint-2:\nThe company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client.\n// A_F1 + A_F2 + A_F3 >= 200\n// B_F1 + B_F2 + B_F3 >= 150\n\n## Generate Constraint-3:\nDue to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\n// A_F1 + A_F2 + A_F3 <= 300\n// B_F1 + B_F2 + B_F3 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company has three factories located in different regions. The company needs to decide how much of each product to produce in each factory to maximize profit while meeting certain production constraints. The profit from selling Product A is $50 per unit, and the profit from selling Product B is $30 per unit. Each factory has a limited production capacity. Factory 1 can produce a maximum of 100 units in total, Factory 2 can produce a maximum of 150 units in total, and Factory 3 can produce a maximum of 200 units in total. The company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client. Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units. Please help the company to maximize its total profit from all factories.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of Product A and Product B produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # amount of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # amount of Product A produced in Factory 2\nA_F3 = model.addVar(vtype=\"INTEGER\", name=\"A_F3\", lb=0) # amount of Product A produced in Factory 3\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # amount of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # amount of Product B produced in Factory 2\nB_F3 = model.addVar(vtype=\"INTEGER\", name=\"B_F3\", lb=0) # amount of Product B produced in Factory 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*(A_F1 + A_F2 + A_F3) + 30*(B_F1 + B_F2 + B_F3))\n\n# Add constraints\n## Each factory has a limited production capacity.\nmodel.addCons(A_F1 + B_F1 <= 100)\nmodel.addCons(A_F2 + B_F2 <= 150)\nmodel.addCons(A_F3 + B_F3 <= 200)\n## The company has a contract to supply at least 200 units of Product A and 150 units of Product B to a major client.\nmodel.addCons(A_F1 + A_F2 + A_F3 >= 200)\nmodel.addCons(B_F1 + B_F2 + B_F3 >= 150)\n## Due to labor constraints, the total production of Product A across all factories cannot exceed 300 units, and the total production of Product B cannot exceed 250 units.\nmodel.addCons(A_F1 + A_F2 + A_F3 <= 300)\nmodel.addCons(B_F1 + B_F2 + B_F3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Amount of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Amount of Product A produced in Factory 3: \", model.getVal(A_F3))\n    print(\"Amount of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Amount of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Amount of Product B produced in Factory 3: \", model.getVal(B_F3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units produced daily to 100.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\n// SA >= 30\n// SB >= 20\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the profit per unit for each product.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe production capacity of the factory limits the total number of units produced daily to 100. The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily. The company can only sell as many units as it produces for each product. \n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units produced daily to 100.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 20)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units produced daily to 100.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\n// SA >= 30\n// SB >= 20\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory limits the total number of units produced daily to 100. The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily. The company can only sell as many units as it produces for each product. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units produced daily to 100.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 20)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"raw_materials\", \"range\": \"raw_materials = 1000 units\", \"type\": \"constant\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours = 800 hours\", \"type\": \"constant\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe production of each unit of Product A, B, and C requires 2 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 2*A + 2*B + 2*C <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*A + 2*B + 4*C <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours. The profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------|----------------------|\n| A       | $50             | 2 units                | 3 hours              |\n| B       | $30             | 2 units                | 2 hours              |\n| C       | $40             | 2 units                | 4 hours              |\n\nThe manufacturer has 1000 units of raw materials and 800 labor hours available. The market demand for Product A is at least 100 units. The total raw materials used must not exceed the available raw materials, and the total labor hours used must not exceed the available labor hours.\n\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The production of each unit of Product A, B, and C requires 2 units of raw materials.\nraw_materials = 1000 # available raw materials\nmodel.addCons(2*A + 2*B + 2*C <= raw_materials)\n## Each unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours.\nlabor_hours = 800 # available labor hours\nmodel.addCons(3*A + 2*B + 4*C <= labor_hours)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"raw_materials\", \"range\": \"raw_materials = 1000 units\", \"type\": \"constant\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours = 800 hours\", \"type\": \"constant\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe production of each unit of Product A, B, and C requires 2 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 2*A + 2*B + 2*C <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*A + 2*B + 4*C <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The production is limited by the availability of 1000 units of raw materials and 800 labor hours. The production of each unit of Product A, B, and C requires 2 units of raw materials. Each unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours. The market demand for Product A is at least 100 units. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The production of each unit of Product A, B, and C requires 2 units of raw materials.\nraw_materials = 1000 # available raw materials\nmodel.addCons(2*A + 2*B + 2*C <= raw_materials)\n## Each unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours.\nlabor_hours = 800 # available labor hours\nmodel.addCons(3*A + 2*B + 4*C <= labor_hours)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe assembly stage has a capacity of 1000 hours per week. It takes 2 hours to assemble one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe testing stage has a capacity of 800 hours per week. It takes 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C.\n// A + 2*B + C <= 800\n\n## Generate Constraint-3:\nThe packaging stage has a capacity of 700 hours per week. It takes 1 hour to package one unit of product A, 1 hour for product B, and 2 hours for product C.\n// A + B + 2*C <= 700",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The following table shows the time required for each stage of production for each product.\n\n| Product | Assembly Time | Testing Time | Packaging Time |\n|---------|---------------|--------------|----------------|\n| A       | 2 hours       | 1 hour       | 1 hour         |\n| B       | 3 hours       | 2 hours      | 1 hour         |\n| C       | 4 hours       | 1 hour       | 2 hours        |\n\nThe assembly stage has a capacity of 1000 hours per week. The testing stage has a capacity of 800 hours per week. The packaging stage has a capacity of 700 hours per week. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The assembly stage has a capacity of 1000 hours per week.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The testing stage has a capacity of 800 hours per week.\nmodel.addCons(A + 2*B + C <= 800)\n## The packaging stage has a capacity of 700 hours per week.\nmodel.addCons(A + B + 2*C <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe assembly stage has a capacity of 1000 hours per week. It takes 2 hours to assemble one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe testing stage has a capacity of 800 hours per week. It takes 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C.\n// A + 2*B + C <= 800\n\n## Generate Constraint-3:\nThe packaging stage has a capacity of 700 hours per week. It takes 1 hour to package one unit of product A, 1 hour for product B, and 2 hours for product C.\n// A + B + 2*C <= 700",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The assembly stage has a capacity of 1000 hours per week, with 2 hours required to assemble one unit of product A, 3 hours for product B, and 4 hours for product C. The testing stage has a capacity of 800 hours per week, requiring 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C. The packaging stage has a capacity of 700 hours per week, with 1 hour needed to package one unit of product A, 1 hour for product B, and 2 hours for product C.\nPlease help the manufacturer to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The assembly stage has a capacity of 1000 hours per week.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The testing stage has a capacity of 800 hours per week.\nmodel.addCons(A + 2*B + C <= 800)\n## The packaging stage has a capacity of 700 hours per week.\nmodel.addCons(A + B + 2*C <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The following table shows the resource requirements for each product:\n\n| Product | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|----------------------|-----------------------------|\n| A       | 2                    | 3                           |\n| B       | 3                    | 4                           |\n| C       | 5                    | 6                           |\n\nThe total labor hours available per day are 1000 hours. The total raw material available per day is 1500 units. The market demand for product A is at least 100 units per day. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products. The total labor hours available per day are 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 5 hours. The total raw material available per day is 1500 units, with each unit of product A requiring 3 units, product B requiring 4 units, and product C requiring 6 units. The market demand for product A is at least 100 units per day. Please help the manufacturer determine the optimal number of units to produce for each product to maximize profit while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven operates\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of operating the oven per hour is $10. The bakery aims to maximize its daily profit.\n// Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\n// Oven_Cost = 10*Oven_Hours\n// Objective Function: Maximize: Total_Profit - Oven_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.2 hours of oven time. The oven can operate for a maximum of 10 hours per day.\n// 0.1*Wheat_Bread + 0.2*Rye_Bread <= Oven_Hours\n// Oven_Hours <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread.\n// Wheat_Bread >= 50\n// Rye_Bread >= 30\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily.\n// Wheat_Bread + Rye_Bread <= 80",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of operating the oven per hour is $10. The following table summarizes the production requirements and constraints:\n\n| Bread Type | Profit per Loaf | Oven Time per Loaf |\n|------------|-----------------|--------------------|\n| Wheat      | $3              | 0.1 hours          |\n| Rye        | $4              | 0.2 hours          |\n\nThe bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread. The oven can operate for a maximum of 10 hours per day. The bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily. \n\nPlease help the bakery to maximize its daily profit, considering the constraints on oven hours, bread production, and ingredient supply.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of hours the oven operates\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours the oven operates\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Profit = 3*Wheat_Bread + 4*Rye_Bread\n## Oven_Cost = 10*Oven_Hours\nmodel.addCons(obj == Total_Profit - 10*Oven_Hours)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.2 hours of oven time. The oven can operate for a maximum of 10 hours per day.\nmodel.addCons(0.1*Wheat_Bread + 0.2*Rye_Bread <= Oven_Hours)\nmodel.addCons(Oven_Hours <= 10)\n## The bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 50)\nmodel.addCons(Rye_Bread >= 30)\n## The bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily.\nmodel.addCons(Wheat_Bread + Rye_Bread <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of hours the oven operates: \", model.getVal(Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of hours the oven operates\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of operating the oven per hour is $10. The bakery aims to maximize its daily profit.\n// Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\n// Oven_Cost = 10*Oven_Hours\n// Objective Function: Maximize: Total_Profit - Oven_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.2 hours of oven time. The oven can operate for a maximum of 10 hours per day.\n// 0.1*Wheat_Bread + 0.2*Rye_Bread <= Oven_Hours\n// Oven_Hours <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread.\n// Wheat_Bread >= 50\n// Rye_Bread >= 30\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily.\n// Wheat_Bread + Rye_Bread <= 80",
        "question": "A bakery wants to optimize its daily production of two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to operate the oven. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The cost of operating the oven per hour is $10. The bakery aims to maximize its daily profit. Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.2 hours of oven time. The oven can operate for a maximum of 10 hours per day. The bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread. The bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of hours the oven operates\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours the oven operates\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 3*Wheat_Bread + 4*Rye_Bread\nTotal_Profit = 3*Wheat_Bread + 4*Rye_Bread\n## Oven_Cost = 10*Oven_Hours\nmodel.addCons(obj == Total_Profit - 10*Oven_Hours)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.1 hours of oven time, and each loaf of rye bread requires 0.2 hours of oven time. The oven can operate for a maximum of 10 hours per day.\nmodel.addCons(0.1*Wheat_Bread + 0.2*Rye_Bread <= Oven_Hours)\nmodel.addCons(Oven_Hours <= 10)\n## The bakery has a daily demand for at least 50 loaves of wheat bread and 30 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 50)\nmodel.addCons(Rye_Bread >= 30)\n## The bakery has a limited supply of ingredients, which allows for a maximum of 80 loaves of bread to be produced daily.\nmodel.addCons(Wheat_Bread + Rye_Bread <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of hours the oven operates: \", model.getVal(Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Profit per Cake | Eggs Required |\n|-----------------|-----------------|---------------|\n| Chocolate       | $5              | 2             |\n| Vanilla         | $4              | 1             |\n\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. Additionally, the bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## The bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery has a daily supply of 100 eggs, with each chocolate cake requiring 2 eggs and each vanilla cake requiring 1 egg. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. Additionally, the bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## The bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many workers to hire to meet the production demands. The bakery also needs to consider the cost of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of workers to hire\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe labor cost per worker per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 70 muffins.\n// Croissants >= 50\n// Muffins >= 70\n\n## Generate Constraint-3:\nThe cost of ingredients for each croissant and muffin is directly proportional to the number of each pastry produced.\n// Cost_Croissants = Croissants * 1\n// Cost_Muffins = Muffins * 0.5",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many workers to hire to meet the production demands. The bakery also needs to consider the cost of ingredients and labor. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. The labor cost per worker per day is $100. The bakery wants to maximize the daily profit.\n\n| Pastry   | Revenue per Unit | Cost of Ingredients per Unit | Labor Time per Unit |\n|----------|------------------|------------------------------|---------------------|\n| Croissants | $3              | $1                           | 0.1 hours           |\n| Muffins   | $2              | $0.5                         | 0.2 hours           |\n\nThe bakery has a maximum of 8 hours of labor available per day. The bakery has a daily demand for at least 50 croissants and 70 muffins. The cost of ingredients for each croissant and muffin is directly proportional to the number of each pastry produced.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of croissants, muffins, and workers to hire.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of workers to hire\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers to hire\n## The cost of ingredients for each type of pastry\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\nTotal_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\nTotal_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\nmodel.addCons(Cost_Croissants == Croissants * 1)\nmodel.addCons(Cost_Muffins == Muffins * 0.5)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a daily demand for at least 50 croissants and 70 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of workers to hire: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many workers to hire to meet the production demands. The bakery also needs to consider the cost of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of workers to hire\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe labor cost per worker per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 50 croissants and 70 muffins.\n// Croissants >= 50\n// Muffins >= 70\n\n## Generate Constraint-3:\nThe cost of ingredients for each croissant and muffin is directly proportional to the number of each pastry produced.\n// Cost_Croissants = Croissants * 1\n// Cost_Muffins = Muffins * 0.5",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily and how many workers to hire to meet the production demands. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. The labor cost per worker per day is $100. The bakery wants to maximize the daily profit. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available per day. The bakery has a daily demand for at least 50 croissants and 70 muffins. The cost of ingredients for each croissant and muffin is directly proportional to the number of each pastry produced. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of workers to hire\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers to hire\n## The cost of ingredients for each type of pastry\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\nTotal_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\nTotal_Cost = Cost_Croissants + Cost_Muffins + 100*Workers\nmodel.addCons(Cost_Croissants == Croissants * 1)\nmodel.addCons(Cost_Muffins == Muffins * 0.5)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a daily demand for at least 50 croissants and 70 muffins.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of workers to hire: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\n// Chocolate_Cakes >= 3",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The following table summarizes the labor and sugar requirements for each type of cake.\n\n| Cake Type       | Labor per Cake | Sugar per Cake |\n|-----------------|----------------|----------------|\n| Chocolate       | 2 hours        | 0.5 kg         |\n| Vanilla         | 1.5 hours      | 0.4 kg         |\n\nThe bakery has a maximum of 12 hours of labor available daily and a maximum of 4 kg of sugar available daily. The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\nmodel.addCons(Chocolate_Cakes >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\n// Chocolate_Cakes >= 3",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily. The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\nmodel.addCons(Chocolate_Cakes >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for croissants\": \"Ovens_Croissants\", \"range\": \"Ovens_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for muffins\": \"Ovens_Muffins\", \"range\": \"Ovens_Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.50, and the cost per muffin is $1. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 croissants or 80 muffins per day. The bakery has a total of 3 ovens available.\n// Ovens_Croissants + Ovens_Muffins <= 3\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants and 150 muffins.\n// Croissants >= 200\n// Muffins >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited amount of ingredients. Each croissant requires 0.1 kg of flour, and each muffin requires 0.2 kg of flour. The bakery has 50 kg of flour available daily.\n// 0.1*Croissants + 0.2*Muffins <= 50",
        "question": "A bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, the cost per croissant is $0.50, and each croissant requires 0.1 kg of flour. The revenue per muffin is $3, the cost per muffin is $1, and each muffin requires 0.2 kg of flour. The rental cost per oven per day is $50. The bakery has a total of 3 ovens available.\n\n| Pastry    | Revenue per Unit | Cost per Unit | Flour Required (kg) |\n|-----------|------------------|---------------|---------------------|\n| Croissants | 2$               | 0.50$         | 0.1                 |\n| Muffins    | 3$               | 1$            | 0.2                 |\n\nThe bakery has a daily demand for at least 200 croissants and 150 muffins. The bakery has 50 kg of flour available daily. The bakery wants to maximize the daily profit. Please help the bakery determine the optimal number of croissants and muffins to produce, and the number of ovens to use for each type of pastry.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens used for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Ovens_Croissants\", lb=0) # number of ovens used for croissants\nOvens_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Ovens_Muffins\", lb=0) # number of ovens used for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\nTotal_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 croissants or 80 muffins per day. The bakery has a total of 3 ovens available.\nmodel.addCons(Ovens_Croissants + Ovens_Muffins <= 3)\n## The bakery has a daily demand for at least 200 croissants and 150 muffins.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\n## The bakery has a limited amount of ingredients. Each croissant requires 0.1 kg of flour, and each muffin requires 0.2 kg of flour. The bakery has 50 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens used for croissants: \", model.getVal(Ovens_Croissants))\n    print(\"Number of ovens used for muffins: \", model.getVal(Ovens_Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for croissants\": \"Ovens_Croissants\", \"range\": \"Ovens_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens used for muffins\": \"Ovens_Muffins\", \"range\": \"Ovens_Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost per croissant is $0.50, and the cost per muffin is $1. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 croissants or 80 muffins per day. The bakery has a total of 3 ovens available.\n// Ovens_Croissants + Ovens_Muffins <= 3\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants and 150 muffins.\n// Croissants >= 200\n// Muffins >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited amount of ingredients. Each croissant requires 0.1 kg of flour, and each muffin requires 0.2 kg of flour. The bakery has 50 kg of flour available daily.\n// 0.1*Croissants + 0.2*Muffins <= 50",
        "question": "A bakery wants to optimize its daily production of two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, and the revenue per muffin is $3. The cost per croissant is $0.50, and the cost per muffin is $1. The rental cost per oven per day is $50. The bakery wants to maximize the daily profit. Each oven can produce 100 croissants or 80 muffins per day. The bakery has a total of 3 ovens available. The bakery has a daily demand for at least 200 croissants and 150 muffins. The bakery has a limited amount of ingredients. Each croissant requires 0.1 kg of flour, and each muffin requires 0.2 kg of flour. The bakery has 50 kg of flour available daily. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens used for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Ovens_Croissants\", lb=0) # number of ovens used for croissants\nOvens_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Ovens_Muffins\", lb=0) # number of ovens used for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\nTotal_Cost = 0.50*Croissants + 1*Muffins + 50*Ovens_Croissants + 50*Ovens_Muffins\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 croissants or 80 muffins per day. The bakery has a total of 3 ovens available.\nmodel.addCons(Ovens_Croissants + Ovens_Muffins <= 3)\n## The bakery has a daily demand for at least 200 croissants and 150 muffins.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\n## The bakery has a limited amount of ingredients. Each croissant requires 0.1 kg of flour, and each muffin requires 0.2 kg of flour. The bakery has 50 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens used for croissants: \", model.getVal(Ovens_Croissants))\n    print(\"Number of ovens used for muffins: \", model.getVal(Ovens_Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while optimizing costs and resources. The bakery also needs to determine the amount of ingredients to purchase, considering the availability and cost of ingredients.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate needed for chocolate cakes\": \"Chocolate_Needed\", \"range\": \"Chocolate_Needed >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla needed for vanilla cakes\": \"Vanilla_Needed\", \"range\": \"Vanilla_Needed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. \nThe cost of chocolate per kg is $5, and the cost of vanilla per kg is $4. \nThe bakery aims to maximize its daily profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 5*Chocolate_Needed + 4*Vanilla_Needed\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla.\n// 0.5*Chocolate_Cakes <= Chocolate_Needed\n// 0.4*Vanilla_Cakes <= Vanilla_Needed\n// Chocolate_Needed <= 20\n// Vanilla_Needed <= 16\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 30\n\n## Generate Constraint-3:\nThe bakery can produce a maximum of 50 cakes per day due to labor constraints.\n// Chocolate_Cakes + Vanilla_Cakes <= 50",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while optimizing costs and resources. The revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. The cost of chocolate per kg is $5, and the cost of vanilla per kg is $4. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Revenue per Cake | Ingredient Requirement (kg) |\n|-----------------|------------------|-----------------------------|\n| Chocolate       | $10              | 0.5 chocolate               |\n| Vanilla         | $8               | 0.4 vanilla                 |\n\nThe bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily demand for at least 30 cakes in total. Due to labor constraints, the bakery can produce a maximum of 50 cakes per day. \n\nPlease help the bakery to maximize its daily profit by determining the optimal number of chocolate and vanilla cakes to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and the amount of ingredients needed\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Needed = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Needed\", lb=0) # amount of chocolate needed for chocolate cakes\nVanilla_Needed = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Needed\", lb=0) # amount of vanilla needed for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 5*Chocolate_Needed + 4*Vanilla_Needed\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes - 5*Chocolate_Needed - 4*Vanilla_Needed)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Needed)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Needed)\n## The bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla.\nmodel.addCons(Chocolate_Needed <= 20)\nmodel.addCons(Vanilla_Needed <= 16)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 30)\n## The bakery can produce a maximum of 50 cakes per day due to labor constraints.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate needed: \", model.getVal(Chocolate_Needed))\n    print(\"Amount of vanilla needed: \", model.getVal(Vanilla_Needed))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while optimizing costs and resources. The bakery also needs to determine the amount of ingredients to purchase, considering the availability and cost of ingredients.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate needed for chocolate cakes\": \"Chocolate_Needed\", \"range\": \"Chocolate_Needed >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla needed for vanilla cakes\": \"Vanilla_Needed\", \"range\": \"Vanilla_Needed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. \nThe cost of chocolate per kg is $5, and the cost of vanilla per kg is $4. \nThe bakery aims to maximize its daily profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n// Total_Cost = 5*Chocolate_Needed + 4*Vanilla_Needed\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla.\n// 0.5*Chocolate_Cakes <= Chocolate_Needed\n// 0.4*Vanilla_Cakes <= Vanilla_Needed\n// Chocolate_Needed <= 20\n// Vanilla_Needed <= 16\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 30\n\n## Generate Constraint-3:\nThe bakery can produce a maximum of 50 cakes per day due to labor constraints.\n// Chocolate_Cakes + Vanilla_Cakes <= 50",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while optimizing costs and resources. The revenue per chocolate cake is $10, and the revenue per vanilla cake is $8. The cost of chocolate per kg is $5, and the cost of vanilla per kg is $4. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla. The bakery has a daily demand for at least 30 cakes in total. The bakery can produce a maximum of 50 cakes per day due to labor constraints. The bakery aims to maximize its daily profit. Please help the bakery determine the optimal number of chocolate and vanilla cakes to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and the amount of ingredients needed\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Needed = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Needed\", lb=0) # amount of chocolate needed for chocolate cakes\nVanilla_Needed = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Needed\", lb=0) # amount of vanilla needed for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes\n## Total_Cost = 5*Chocolate_Needed + 4*Vanilla_Needed\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes - 5*Chocolate_Needed - 4*Vanilla_Needed)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.4 kg of vanilla.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Needed)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Needed)\n## The bakery has a daily supply of 20 kg of chocolate and 16 kg of vanilla.\nmodel.addCons(Chocolate_Needed <= 20)\nmodel.addCons(Vanilla_Needed <= 16)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 30)\n## The bakery can produce a maximum of 50 cakes per day due to labor constraints.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate needed: \", model.getVal(Chocolate_Needed))\n    print(\"Amount of vanilla needed: \", model.getVal(Vanilla_Needed))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 pastries per day.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-2:\nThe demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\n// Croissants >= 50\n// Muffins >= 80\n\n## Generate Constraint-3:\nEach oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\n// Croissants/50 + Muffins/50 <= Ovens",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity. The revenue and cost of ingredients for each pastry type are given in the following Table.\n\n| Pastry Type | Revenue per Pastry | Cost of Ingredients per Pastry |\n|-------------|--------------------|--------------------------------|\n| Croissants  | $3                 | $1                             |\n| Muffins     | $2                 | $0.5                           |\n\nThe bakery can produce a maximum of 200 pastries per day. The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day. Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity. The rental cost per oven per day is $50.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost (including the cost of ingredients and the rental cost of ovens).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n## The cost of ingredients for each type of pastry\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\nTotal_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nCost_Croissants = Croissants * 1\nCost_Muffins = Muffins * 0.5\nTotal_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery can produce a maximum of 200 pastries per day.\nmodel.addCons(Croissants + Muffins <= 200)\n## The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 80)\n## Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\nmodel.addCons(Croissants/50 + Muffins/50 <= Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 pastries per day.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-2:\nThe demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\n// Croissants >= 50\n// Muffins >= 80\n\n## Generate Constraint-3:\nEach oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\n// Croissants/50 + Muffins/50 <= Ovens",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. The rental cost per oven per day is $50. The bakery wants to maximize the daily profit. The bakery can produce a maximum of 200 pastries per day. The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day. Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity. Please help the bakery determine the optimal number of croissants, muffins, and ovens to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n## The cost of ingredients for each type of pastry\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\nTotal_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nCost_Croissants = Croissants * 1\nCost_Muffins = Muffins * 0.5\nTotal_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery can produce a maximum of 200 pastries per day.\nmodel.addCons(Croissants + Muffins <= 200)\n## The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 80)\n## Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\nmodel.addCons(Croissants/50 + Muffins/50 <= Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven space used\": \"Oven_Space\", \"range\": \"Oven_Space >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The following table summarizes the labor and oven space requirements for each type of pastry.\n\n| Pastry   | Labor Hours Required | Oven Space Required |\n|----------|----------------------|---------------------|\n| Croissant| 0.1 hours            | 0.05 square meters  |\n| Muffin   | 0.2 hours            | 0.08 square meters  |\n| Donut    | 0.3 hours            | 0.1 square meters   |\n\nThe bakery has a maximum of 10 hours of labor available daily and a maximum of 1.5 square meters of oven space available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10)\n## Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven space used\": \"Oven_Space\", \"range\": \"Oven_Space >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily. Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Please help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10)\n## Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total time used in ovens\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. \nThe cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.25. \nThe bakery wants to maximize its daily profit.\n// Total_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 10 minutes of oven time, each muffin requires 15 minutes, and each donut requires 12 minutes. The total daily oven time available is 480 minutes.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget for ingredients and labor, which is $100. The cost of ingredients and labor for each croissant is $0.20, for each muffin is $0.30, and for each donut is $0.25.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 40 muffins, and 30 donuts.\n// Croissants >= 50\n// Muffins >= 40\n// Donuts >= 30",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens. The profit and cost per pastry, as well as the oven time required for each, are given in the following Table.\n\n| Pastry   | Profit per Unit | Cost per Unit | Oven Time per Unit |\n|----------|-----------------|---------------|---------------------|\n| Croissant| $0.50           | $0.20         | 10 minutes          |\n| Muffin   | $0.75           | $0.30         | 15 minutes          |\n| Donut    | $0.60           | $0.25         | 12 minutes          |\n\nThe bakery has a daily budget for ingredients and labor, which is $100. The total daily oven time available is 480 minutes. The bakery has a minimum daily production requirement for each type of pastry: it must produce at least 50 croissants, 40 muffins, and 30 donuts.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\nTotal_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\n## Each croissant requires 10 minutes of oven time, each muffin requires 15 minutes, and each donut requires 12 minutes. The total daily oven time available is 480 minutes.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery has a daily budget for ingredients and labor, which is $100. The cost of ingredients and labor for each croissant is $0.20, for each muffin is $0.30, and for each donut is $0.25.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts <= 100)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 40 muffins, and 30 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 40)\nmodel.addCons(Donuts >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total time used in ovens\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. \nThe cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.25. \nThe bakery wants to maximize its daily profit.\n// Total_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 10 minutes of oven time, each muffin requires 15 minutes, and each donut requires 12 minutes. The total daily oven time available is 480 minutes.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget for ingredients and labor, which is $100. The cost of ingredients and labor for each croissant is $0.20, for each muffin is $0.30, and for each donut is $0.25.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 40 muffins, and 30 donuts.\n// Croissants >= 50\n// Muffins >= 40\n// Donuts >= 30",
        "question": "A bakery wants to optimize its production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The cost per croissant is $0.20, per muffin is $0.30, and per donut is $0.25. Each croissant requires 10 minutes of oven time, each muffin requires 15 minutes, and each donut requires 12 minutes. The total daily oven time available is 480 minutes. The bakery has a daily budget for ingredients and labor, which is $100. The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 40 muffins, and 30 donuts. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\nTotal_Profit = (0.50*Croissants + 0.75*Muffins + 0.60*Donuts) - (0.20*Croissants + 0.30*Muffins + 0.25*Donuts)\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\n## Each croissant requires 10 minutes of oven time, each muffin requires 15 minutes, and each donut requires 12 minutes. The total daily oven time available is 480 minutes.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery has a daily budget for ingredients and labor, which is $100. The cost of ingredients and labor for each croissant is $0.20, for each muffin is $0.30, and for each donut is $0.25.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts <= 100)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 40 muffins, and 30 donuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 40)\nmodel.addCons(Donuts >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients per croissant\": \"Cost_Croissant\", \"range\": \"Cost_Croissant >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients per muffin\": \"Cost_Muffin\", \"range\": \"Cost_Muffin >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost of ingredients per muffin is $0.75. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily labor limit of 100 hours, with each croissant requiring 0.5 hours and each muffin requiring 0.75 hours of labor.\n// 0.5*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery's ovens can handle a maximum of 150 pastries per day.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand.\n// Croissants >= 20\n// Muffins >= 30",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens. The revenue and cost of ingredients for each type of pastry are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost of Ingredients per Pastry |\n|----------|--------------------|--------------------------------|\n| Croissant| 2$                 | 0.50$                          |\n| Muffin   | 3$                 | 0.75$                          |\n\nThe bakery has a daily labor limit of 100 hours, with each croissant requiring 0.5 hours and each muffin requiring 0.75 hours of labor. The bakery's ovens can handle a maximum of 150 pastries per day. The bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand. \nPlease help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The cost of ingredients per pastry\nCost_Croissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissant\", lb=0) # cost of ingredients per croissant\nCost_Muffin = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffin\", lb=0) # cost of ingredients per muffin\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\nTotal_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily labor limit of 100 hours\nmodel.addCons(0.5*Croissants + 0.75*Muffins <= 100)\n## The bakery's ovens can handle a maximum of 150 pastries per day\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery must produce at least 20 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients per croissant\": \"Cost_Croissant\", \"range\": \"Cost_Croissant >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients per muffin\": \"Cost_Muffin\", \"range\": \"Cost_Muffin >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, and the revenue per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost of ingredients per muffin is $0.75. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins\n// Total_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily labor limit of 100 hours, with each croissant requiring 0.5 hours and each muffin requiring 0.75 hours of labor.\n// 0.5*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery's ovens can handle a maximum of 150 pastries per day.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand.\n// Croissants >= 20\n// Muffins >= 30",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients, labor, and the capacity of the ovens. The revenue per croissant is $2, and the revenue per muffin is $3. The cost of ingredients per croissant is $0.50, and the cost of ingredients per muffin is $0.75. The bakery has a daily labor limit of 100 hours, with each croissant requiring 0.5 hours and each muffin requiring 0.75 hours of labor. The bakery's ovens can handle a maximum of 150 pastries per day. The bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The cost of ingredients per pastry\nCost_Croissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissant\", lb=0) # cost of ingredients per croissant\nCost_Muffin = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffin\", lb=0) # cost of ingredients per muffin\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins\nTotal_Revenue = 2*Croissants + 3*Muffins\n## Total_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\nTotal_Cost = Cost_Croissant*Croissants + Cost_Muffin*Muffins\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily labor limit of 100 hours\nmodel.addCons(0.5*Croissants + 0.75*Muffins <= 100)\n## The bakery's ovens can handle a maximum of 150 pastries per day\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery must produce at least 20 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for 500 pastries in total.\n// Croissants + Muffins + Donuts >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven usage, which is $300 per day.\n// 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts <= 300",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit.\n\n| Pastry       | Revenue per Unit | Cost per Oven Usage per Day |\n|--------------|------------------|-----------------------------|\n| Croissants   | $2               | $50                         |\n| Muffins      | $3               | $60                         |\n| Donuts       | $1.5             | $40                         |\n\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used. The bakery has a daily demand for 500 pastries in total. The bakery has a limited budget for oven usage, which is $300 per day.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the number of ovens to use for each type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for 500 pastries in total.\nmodel.addCons(Croissants + Muffins + Donuts >= 500)\n## The bakery has a limited budget for oven usage, which is $300 per day.\nmodel.addCons(50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for 500 pastries in total.\n// Croissants + Muffins + Donuts >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven usage, which is $300 per day.\n// 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts <= 300",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit. Each oven can produce 100 pastries per day, and the total number of pastries produced should not exceed the capacity of the ovens used. The bakery has a daily demand for 500 pastries in total. The bakery also has a limited budget for oven usage, which is $300 per day. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for 500 pastries in total.\nmodel.addCons(Croissants + Muffins + Donuts >= 500)\n## The bakery has a limited budget for oven usage, which is $300 per day.\nmodel.addCons(50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many hours to allocate to each type of cake production.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to chocolate cake production\": \"Chocolate_Hours\", \"range\": \"Chocolate_Hours >= 0\", \"type\": \"real\"}\n// {\"hours allocated to vanilla cake production\": \"Vanilla_Hours\", \"range\": \"Vanilla_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. \nThe cost of labor per hour is $10. \nThe bakery wants to maximize its daily profit.\n// Total_Profit = 5*Chocolate_Cakes + 4*Vanilla_Cakes\n// Labor_Cost = 10*(Chocolate_Hours + Vanilla_Hours)\n// Objective Function: Maximize: Total_Profit - Labor_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 hours of labor, and each vanilla cake requires 0.4 hours of labor. The bakery has a total of 8 hours of labor available each day.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes.\n// Chocolate_Cakes >= 10\n// Vanilla_Cakes >= 12\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time.\n// Chocolate_Cakes + Vanilla_Cakes <= 15",
        "question": "A bakery wants to optimize its daily production of two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many hours to allocate to each type of cake production. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The cost of labor per hour is $10. The bakery wants to maximize its daily profit.\n\n| Cake Type | Profit per Cake | Labor Time per Cake |\n|-----------|-----------------|---------------------|\n| Chocolate | $5              | 0.5 hours           |\n| Vanilla   | $4              | 0.4 hours           |\n\nThe bakery has a total of 8 hours of labor available each day. The bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes. The bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time.\n\nPlease help the bakery to maximize its daily profit, considering the constraints on labor hours, cake demand, and oven capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the hours allocated to each type of cake production\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Hours\", lb=0) # hours allocated to chocolate cake production\nVanilla_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Hours\", lb=0) # hours allocated to vanilla cake production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 5*Chocolate_Cakes + 4*Vanilla_Cakes\n## Labor_Cost = 10*(Chocolate_Hours + Vanilla_Hours)\nmodel.addCons(Chocolate_Hours == 0.5 * Chocolate_Cakes)\nmodel.addCons(Vanilla_Hours == 0.4 * Vanilla_Cakes)\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes - 10*(Chocolate_Hours + Vanilla_Hours))\n\n# Add constraints\n## Each chocolate cake requires 0.5 hours of labor, and each vanilla cake requires 0.4 hours of labor. The bakery has a total of 8 hours of labor available each day.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 8)\n## The bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 12)\n## The bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Hours allocated to chocolate cake production: \", model.getVal(Chocolate_Hours))\n    print(\"Hours allocated to vanilla cake production: \", model.getVal(Vanilla_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many hours to allocate to each type of cake production.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to chocolate cake production\": \"Chocolate_Hours\", \"range\": \"Chocolate_Hours >= 0\", \"type\": \"real\"}\n// {\"hours allocated to vanilla cake production\": \"Vanilla_Hours\", \"range\": \"Vanilla_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. \nThe cost of labor per hour is $10. \nThe bakery wants to maximize its daily profit.\n// Total_Profit = 5*Chocolate_Cakes + 4*Vanilla_Cakes\n// Labor_Cost = 10*(Chocolate_Hours + Vanilla_Hours)\n// Objective Function: Maximize: Total_Profit - Labor_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 hours of labor, and each vanilla cake requires 0.4 hours of labor. The bakery has a total of 8 hours of labor available each day.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 8\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes.\n// Chocolate_Cakes >= 10\n// Vanilla_Cakes >= 12\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time.\n// Chocolate_Cakes + Vanilla_Cakes <= 15",
        "question": "A bakery wants to optimize its daily production of two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce and how many hours to allocate to each type of cake production. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The cost of labor per hour is $10. Each chocolate cake requires 0.5 hours of labor, and each vanilla cake requires 0.4 hours of labor. The bakery has a total of 8 hours of labor available each day. The bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes. The bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time. \nPlease help the bakery to maximize its daily profit, which is defined as the total profit from selling cakes minus the labor cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the hours allocated to each type of cake production\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nChocolate_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Hours\", lb=0) # hours allocated to chocolate cake production\nVanilla_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Hours\", lb=0) # hours allocated to vanilla cake production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 5*Chocolate_Cakes + 4*Vanilla_Cakes\n## Labor_Cost = 10*(Chocolate_Hours + Vanilla_Hours)\nmodel.addCons(Chocolate_Hours == 0.5 * Chocolate_Cakes)\nmodel.addCons(Vanilla_Hours == 0.4 * Vanilla_Cakes)\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes - 10*(Chocolate_Hours + Vanilla_Hours))\n\n# Add constraints\n## Each chocolate cake requires 0.5 hours of labor, and each vanilla cake requires 0.4 hours of labor. The bakery has a total of 8 hours of labor available each day.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 8)\n## The bakery has a daily demand for at least 10 chocolate cakes and 12 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 12)\n## The bakery has a limited oven space, which can only accommodate a maximum of 15 cakes at a time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Hours allocated to chocolate cake production: \", model.getVal(Chocolate_Hours))\n    print(\"Hours allocated to vanilla cake production: \", model.getVal(Vanilla_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known.\n// {\"quantity of product A produced\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*QA + 15*QB + 20*QC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-2:\nThe daily demand for products A, B, and C is 300, 200, and 150 units respectively.\n// QA >= 300\n// QB >= 200\n// QC >= 150\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of product A as product B.\n// QA >= 2*QB",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known. The production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost. The production capacity of the factory is limited to 1000 units per day. The daily demand for products A, B, and C is 300, 200, and 150 units respectively. The manufacturer has a policy to produce at least twice as many units of product A as product B.\n\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C to minimize the total production cost while meeting all constraints.\n\n| Product | Production Cost per Unit | Daily Demand |\n|---------|--------------------------|--------------|\n| A       | $10                      | 300 units    |\n| B       | $15                      | 200 units    |\n| C       | $20                      | 150 units    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of product A produced\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of product B produced\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*QA + 15*QB + 20*QC)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(QA + QB + QC <= 1000)\n## The daily demand for products A, B, and C is 300, 200, and 150 units respectively.\nmodel.addCons(QA >= 300)\nmodel.addCons(QB >= 200)\nmodel.addCons(QC >= 150)\n## The manufacturer has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(QA >= 2*QB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(QA))\n    print(\"Quantity of product B produced: \", model.getVal(QB))\n    print(\"Quantity of product C produced: \", model.getVal(QC))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known.\n// {\"quantity of product A produced\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*QA + 15*QB + 20*QC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-2:\nThe daily demand for products A, B, and C is 300, 200, and 150 units respectively.\n// QA >= 300\n// QB >= 200\n// QC >= 150\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of product A as product B.\n// QA >= 2*QB",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs per unit for products A, B, and C are $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost. The production capacity of the factory is limited to 1000 units per day. The daily demand for products A, B, and C is 300, 200, and 150 units respectively. The manufacturer has a policy to produce at least twice as many units of product A as product B. \n\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C to minimize the total production cost while meeting all constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of product A produced\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of product B produced\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*QA + 15*QB + 20*QC)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(QA + QB + QC <= 1000)\n## The daily demand for products A, B, and C is 300, 200, and 150 units respectively.\nmodel.addCons(QA >= 300)\nmodel.addCons(QB >= 200)\nmodel.addCons(QC >= 150)\n## The manufacturer has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(QA >= 2*QB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(QA))\n    print(\"Quantity of product B produced: \", model.getVal(QB))\n    print(\"Quantity of product C produced: \", model.getVal(QC))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 733,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"overtime hours used\": \"OT\", \"range\": \"OT >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\n// Production_Cost = 10*A + 15*B + 20*C\n// Overtime_Cost = 30*OT\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe production capacity for normal hours is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\n// A >= 50\n// B >= 60\n// C >= 40\n\n## Generate Constraint-3:\nThe company can use up to 10 overtime hours per day.\n// OT <= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs. The cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $10                      |\n| B       | $15                      |\n| C       | $20                      |\n\nThe production capacity for normal hours is 100 units per day. The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day. The company can use up to 10 overtime hours per day.\n\nPlease help the company determine the optimal number of units of each product to produce and the amount of overtime hours to use to minimize the total production and overtime costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and overtime hours\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nOT = model.addVar(vtype=\"CONTINUOUS\", name=\"OT\", lb=0) # overtime hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*A + 15*B + 20*C\nProduction_Cost = 10*A + 15*B + 20*C\n## Overtime_Cost = 30*OT\nOvertime_Cost = 30*OT\nmodel.addCons(obj == Production_Cost + Overtime_Cost)\n\n# Add constraints\n## The production capacity for normal hours is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 60)\nmodel.addCons(C >= 40)\n## The company can use up to 10 overtime hours per day.\nmodel.addCons(OT <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Overtime hours used: \", model.getVal(OT))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 993,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"overtime hours used\": \"OT\", \"range\": \"OT >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\n// Production_Cost = 10*A + 15*B + 20*C\n// Overtime_Cost = 30*OT\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe production capacity for normal hours is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\n// A >= 50\n// B >= 60\n// C >= 40\n\n## Generate Constraint-3:\nThe company can use up to 10 overtime hours per day.\n// OT <= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs. The cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs. The production capacity for normal hours is 100 units per day. The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day. The company can use up to 10 overtime hours per day. Please help the company determine the optimal number of units to produce for each product and the amount of overtime to use.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and overtime hours\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nOT = model.addVar(vtype=\"CONTINUOUS\", name=\"OT\", lb=0) # overtime hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*A + 15*B + 20*C\nProduction_Cost = 10*A + 15*B + 20*C\n## Overtime_Cost = 30*OT\nOvertime_Cost = 30*OT\nmodel.addCons(obj == Production_Cost + Overtime_Cost)\n\n# Add constraints\n## The production capacity for normal hours is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 60)\nmodel.addCons(C >= 40)\n## The company can use up to 10 overtime hours per day.\nmodel.addCons(OT <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Overtime hours used: \", model.getVal(OT))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"number of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used\": \"Machine\", \"range\": \"Machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize the total profit from the sales of both products.\n// Objective Function: Maximize: 50*PA + 30*PB\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\n// 2*PA + 3*PB <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\n// PA + 2*PB <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 15 units per week.\n// PA >= 15",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $30. The following table summarizes the labor and machine hours required for each product:\n\n| Product | Labor Hours Required | Machine Hours Required |\n|---------|----------------------|------------------------|\n| A       | 2                    | 1                      |\n| B       | 3                    | 2                      |\n\nThe company has a total of 100 hours of labor available per week and 50 machine hours available per week. The market demand for Product A is at least 15 units per week. Please help the company to maximize the total profit from the sales of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # number of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # number of Product B produced\n## The number of hours of labor and machine hours used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\nMachine = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine\", lb=0) # number of machine hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 30*PB)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*PA + 3*PB == Labor)\nmodel.addCons(Labor <= 100)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\nmodel.addCons(PA + 2*PB == Machine)\nmodel.addCons(Machine <= 50)\n## The market demand for Product A is at least 15 units per week.\nmodel.addCons(PA >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(PA))\n    print(\"Number of Product B produced: \", model.getVal(PB))\n    print(\"Number of hours of labor used: \", model.getVal(Labor))\n    print(\"Number of machine hours used: \", model.getVal(Machine))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"number of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used\": \"Machine\", \"range\": \"Machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize the total profit from the sales of both products.\n// Objective Function: Maximize: 50*PA + 30*PB\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\n// 2*PA + 3*PB <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\n// PA + 2*PB <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 15 units per week.\n// PA >= 15",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $30. Each unit of Product A requires 2 hours of labor and 1 machine hour, while each unit of Product B requires 3 hours of labor and 2 machine hours. The company has a total of 100 hours of labor and 50 machine hours available per week. The market demand for Product A is at least 15 units per week. Please help the company to maximize the total profit from the sales of both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # number of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # number of Product B produced\n## The number of hours of labor and machine hours used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\nMachine = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine\", lb=0) # number of machine hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 30*PB)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*PA + 3*PB == Labor)\nmodel.addCons(Labor <= 100)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\nmodel.addCons(PA + 2*PB == Machine)\nmodel.addCons(Machine <= 50)\n## The market demand for Product A is at least 15 units per week.\nmodel.addCons(PA >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(PA))\n    print(\"Number of Product B produced: \", model.getVal(PB))\n    print(\"Number of hours of labor used: \", model.getVal(Labor))\n    print(\"Number of machine hours used: \", model.getVal(Machine))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs.\n// {\"number of chocolate cakes\": \"chocolate\", \"range\": \"chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"vanilla\", \"range\": \"vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"strawberry\", \"range\": \"strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"lemon\", \"range\": \"lemon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 cakes.\n// chocolate + vanilla + strawberry + lemon <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\n// chocolate >= 50\n// vanilla >= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\n// strawberry >= 20\n// lemon >= 20",
        "question": "A bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs. The cost of producing each type of cake is as follows:\n\n| Cake Type     | Production Cost |\n|---------------|-----------------|\n| Chocolate     | $3              |\n| Vanilla       | $2              |\n| Strawberry    | $4              |\n| Lemon         | $3              |\n\nThe bakery has a daily production capacity of 200 cakes. The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand. Additionally, the bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\n\nPlease help the bakery to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nchocolate = model.addVar(vtype=\"INTEGER\", name=\"chocolate\", lb=0) # number of chocolate cakes\nvanilla = model.addVar(vtype=\"INTEGER\", name=\"vanilla\", lb=0) # number of vanilla cakes\nstrawberry = model.addVar(vtype=\"INTEGER\", name=\"strawberry\", lb=0) # number of strawberry cakes\nlemon = model.addVar(vtype=\"INTEGER\", name=\"lemon\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 cakes.\nmodel.addCons(chocolate + vanilla + strawberry + lemon <= 200)\n## The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(chocolate >= 50)\nmodel.addCons(vanilla >= 30)\n## The bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\nmodel.addCons(strawberry >= 20)\nmodel.addCons(lemon >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(strawberry))\n    print(\"Number of lemon cakes: \", model.getVal(lemon))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs.\n// {\"number of chocolate cakes\": \"chocolate\", \"range\": \"chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"vanilla\", \"range\": \"vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"strawberry\", \"range\": \"strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"lemon\", \"range\": \"lemon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 cakes.\n// chocolate + vanilla + strawberry + lemon <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\n// chocolate >= 50\n// vanilla >= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\n// strawberry >= 20\n// lemon >= 20",
        "question": "A bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs. The cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery has a daily production capacity of 200 cakes. The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand. Additionally, the bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand. Please help the bakery to minimize the total daily production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nchocolate = model.addVar(vtype=\"INTEGER\", name=\"chocolate\", lb=0) # number of chocolate cakes\nvanilla = model.addVar(vtype=\"INTEGER\", name=\"vanilla\", lb=0) # number of vanilla cakes\nstrawberry = model.addVar(vtype=\"INTEGER\", name=\"strawberry\", lb=0) # number of strawberry cakes\nlemon = model.addVar(vtype=\"INTEGER\", name=\"lemon\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 cakes.\nmodel.addCons(chocolate + vanilla + strawberry + lemon <= 200)\n## The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(chocolate >= 50)\nmodel.addCons(vanilla >= 30)\n## The bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\nmodel.addCons(strawberry >= 20)\nmodel.addCons(lemon >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(strawberry))\n    print(\"Number of lemon cakes: \", model.getVal(lemon))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of Product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*PA + 15*PB + 20*PC\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 100 hours. Producing one unit of A, B, and C requires 1, 2, and 3 hours respectively.\n// PA + 2*PB + 3*PC <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\n// PA >= 20\n// PB >= 10\n\n## Generate Constraint-3:\nThe company has a limited raw material supply. Producing one unit of A, B, and C requires 2, 3, and 4 units of raw material respectively. The total raw material available is 150 units.\n// 2*PA + 3*PB + 4*PC <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The production time and raw material requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit | Raw Material per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | 10$             | 1 hour                   | 2 units               |\n| B       | 15$             | 2 hours                  | 3 units               |\n| C       | 20$             | 3 hours                  | 4 units               |\n\nThe total production time for all products cannot exceed 100 hours. The market demand for product A is at least 20 units, and the demand for product B is at least 10 units. The company has a limited raw material supply, with a total of 150 units available. Please help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of Product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of Product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*PA + 15*PB + 20*PC)\n\n# Add constraints\n## The total production time for all products cannot exceed 100 hours.\nmodel.addCons(PA + 2*PB + 3*PC <= 100)\n## The market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\nmodel.addCons(PA >= 20)\nmodel.addCons(PB >= 10)\n## The company has a limited raw material supply.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(PA))\n    print(\"Production quantity of Product B: \", model.getVal(PB))\n    print(\"Production quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of Product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*PA + 15*PB + 20*PC\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 100 hours. Producing one unit of A, B, and C requires 1, 2, and 3 hours respectively.\n// PA + 2*PB + 3*PC <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\n// PA >= 20\n// PB >= 10\n\n## Generate Constraint-3:\nThe company has a limited raw material supply. Producing one unit of A, B, and C requires 2, 3, and 4 units of raw material respectively. The total raw material available is 150 units.\n// 2*PA + 3*PB + 4*PC <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The total production time for all products cannot exceed 100 hours, with each unit of A, B, and C requiring 1, 2, and 3 hours respectively. The market demand for product A is at least 20 units, and the demand for product B is at least 10 units. Additionally, the company has a limited raw material supply, with each unit of A, B, and C requiring 2, 3, and 4 units of raw material respectively, and a total of 150 units of raw material available. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of Product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of Product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*PA + 15*PB + 20*PC)\n\n# Add constraints\n## The total production time for all products cannot exceed 100 hours.\nmodel.addCons(PA + 2*PB + 3*PC <= 100)\n## The market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\nmodel.addCons(PA >= 20)\nmodel.addCons(PB >= 10)\n## The company has a limited raw material supply.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(PA))\n    print(\"Production quantity of Product B: \", model.getVal(PB))\n    print(\"Production quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to meet customer demand while minimizing costs. The bakery also needs to consider whether to hire an additional baker to increase production capacity.\n// {\"whether to hire additional baker\": \"hire_baker\", \"range\": \"hire_baker = 0 or 1\", \"type\": \"binary\"}\n// {\"number of wheat bread loaves produced\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves produced\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves produced\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. Hiring an additional baker would incur a daily cost of $100. The bakery aims to minimize the total daily production cost.\n// Production_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Baker_Cost = 100*hire_baker\n// Objective Function: Minimize: Production_Cost + Baker_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= (200 + 100*hire_baker)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production.\n// sourdough_loaves <= 0.80 * (wheat_loaves + rye_loaves + sourdough_loaves)",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to meet customer demand while minimizing costs. The bakery also needs to consider whether to hire an additional baker to increase production capacity. The cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. Hiring an additional baker would incur a daily cost of $100.\n\n| Bread Type       | Production Cost per Loaf |\n|------------------|--------------------------|\n| Wheat            | $1.50                    |\n| Rye              | $2.00                    |\n| Sourdough        | $2.50                    |\n\nThe bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day. The bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand. The bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production.\n\nPlease help the bakery to minimize the total daily production cost, which includes the cost of bread production and the cost of hiring an additional baker if necessary.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to hire additional baker and the number of loaves of each type of bread produced\nhire_baker = model.addVar(vtype=\"B\", name=\"hire_baker\") # whether to hire additional baker\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves produced\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves produced\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Baker_Cost = 100*hire_baker\nProduction_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nBaker_Cost = 100*hire_baker\nmodel.addCons(obj == Production_Cost + Baker_Cost)\n\n# Add constraints\n## The bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= (200 + 100*hire_baker))\n## The bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\n## The bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production.\nmodel.addCons(sourdough_loaves <= 0.80 * (wheat_loaves + rye_loaves + sourdough_loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to hire additional baker: \", model.getVal(hire_baker))\n    print(\"Number of wheat bread loaves produced: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves produced: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves produced: \", model.getVal(sourdough_loaves))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to meet customer demand while minimizing costs. The bakery also needs to consider whether to hire an additional baker to increase production capacity.\n// {\"whether to hire additional baker\": \"hire_baker\", \"range\": \"hire_baker = 0 or 1\", \"type\": \"binary\"}\n// {\"number of wheat bread loaves produced\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves produced\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves produced\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. Hiring an additional baker would incur a daily cost of $100. The bakery aims to minimize the total daily production cost.\n// Production_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Baker_Cost = 100*hire_baker\n// Objective Function: Minimize: Production_Cost + Baker_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= (200 + 100*hire_baker)\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production.\n// sourdough_loaves <= 0.80 * (wheat_loaves + rye_loaves + sourdough_loaves)",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to meet customer demand while minimizing costs. The bakery also needs to consider whether to hire an additional baker to increase production capacity. The cost of producing each loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. Hiring an additional baker would incur a daily cost of $100. The bakery aims to minimize the total daily production cost. The bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day. The bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand. The bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production. Please help the bakery determine the optimal number of loaves to produce and whether to hire an additional baker.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to hire additional baker and the number of loaves of each type of bread produced\nhire_baker = model.addVar(vtype=\"B\", name=\"hire_baker\") # whether to hire additional baker\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves produced\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves produced\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Baker_Cost = 100*hire_baker\nProduction_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nBaker_Cost = 100*hire_baker\nmodel.addCons(obj == Production_Cost + Baker_Cost)\n\n# Add constraints\n## The bakery can produce a maximum of 200 loaves per day without hiring an additional baker. If the additional baker is hired, the capacity increases to 300 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= (200 + 100*hire_baker))\n## The bakery must produce at least 50 loaves of wheat bread and 30 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\n## The bakery has a daily demand for sourdough bread that cannot exceed 80% of the total bread production.\nmodel.addCons(sourdough_loaves <= 0.80 * (wheat_loaves + rye_loaves + sourdough_loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to hire additional baker: \", model.getVal(hire_baker))\n    print(\"Number of wheat bread loaves produced: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves produced: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves produced: \", model.getVal(sourdough_loaves))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to determine the production quantities for each product. The production cost and potential revenue vary for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The revenue per unit for products A, B, C, D is $30, $45, $60, and $75 respectively. The manufacturer wants to maximize the net profit (revenue minus cost).\n// Production_Cost = 10*A + 15*B + 20*C + 25*D\n// Revenue = 30*A + 45*B + 60*C + 75*D\n// Objective Function: Maximize: Revenue - Production_Cost\n\n## Generate Constraint-1:\nThe total production time available is 100 hours. Producing one unit of product A, B, C, D requires 1, 2, 3, and 4 hours respectively.\n// A + 2*B + 3*C + 4*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer has a limited budget of $1500 for raw materials. The cost of raw materials per unit for products A, B, C, D is $5, $10, $15, and $20 respectively.\n// 5*A + 10*B + 15*C + 20*D <= 1500\n\n## Generate Constraint-3:\nThe market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively.\n// A >= 10\n// B >= 20\n// C >= 30\n// D >= 40",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to determine the production quantities for each product. The production cost, revenue, production time, and raw material cost per unit vary for each product. The details are given in the following Table.\n\n| Product | Production Cost | Revenue | Production Time | Raw Material Cost |\n|---------|-----------------|---------|-----------------|-------------------|\n| A       | $10             | $30     | 1 hour          | $5                |\n| B       | $15             | $45     | 2 hours         | $10               |\n| C       | $20             | $60     | 3 hours         | $15               |\n| D       | $25             | $75     | 4 hours         | $20               |\n\nThe manufacturer has a total production time of 100 hours. The budget for raw materials is $1500. The market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively. \n\nPlease help the manufacturer to maximize the net profit (revenue minus cost) while considering the constraints on production time, raw material budget, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*A + 15*B + 20*C + 25*D\n## Revenue = 30*A + 45*B + 60*C + 75*D\nmodel.addCons(obj == (30*A + 45*B + 60*C + 75*D) - (10*A + 15*B + 20*C + 25*D))\n\n# Add constraints\n## The total production time available is 100 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 100)\n## The manufacturer has a limited budget of $1500 for raw materials.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 1500)\n## The market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 20)\nmodel.addCons(C >= 30)\nmodel.addCons(D >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to determine the production quantities for each product. The production cost and potential revenue vary for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The revenue per unit for products A, B, C, D is $30, $45, $60, and $75 respectively. The manufacturer wants to maximize the net profit (revenue minus cost).\n// Production_Cost = 10*A + 15*B + 20*C + 25*D\n// Revenue = 30*A + 45*B + 60*C + 75*D\n// Objective Function: Maximize: Revenue - Production_Cost\n\n## Generate Constraint-1:\nThe total production time available is 100 hours. Producing one unit of product A, B, C, D requires 1, 2, 3, and 4 hours respectively.\n// A + 2*B + 3*C + 4*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer has a limited budget of $1500 for raw materials. The cost of raw materials per unit for products A, B, C, D is $5, $10, $15, and $20 respectively.\n// 5*A + 10*B + 15*C + 20*D <= 1500\n\n## Generate Constraint-3:\nThe market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively.\n// A >= 10\n// B >= 20\n// C >= 30\n// D >= 40",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to determine the production quantities for each product. The production cost per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The revenue per unit for products A, B, C, D is $30, $45, $60, and $75 respectively. The manufacturer wants to maximize the net profit (revenue minus cost).\nThe total production time available is 100 hours. Producing one unit of product A, B, C, D requires 1, 2, 3, and 4 hours respectively. The manufacturer has a limited budget of $1500 for raw materials. The cost of raw materials per unit for products A, B, C, D is $5, $10, $15, and $20 respectively. The market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively.\nPlease help the manufacturer determine the optimal production quantities for each product to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*A + 15*B + 20*C + 25*D\n## Revenue = 30*A + 45*B + 60*C + 75*D\nmodel.addCons(obj == (30*A + 45*B + 60*C + 75*D) - (10*A + 15*B + 20*C + 25*D))\n\n# Add constraints\n## The total production time available is 100 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 100)\n## The manufacturer has a limited budget of $1500 for raw materials.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 1500)\n## The market demand for products A, B, C, D is at least 10, 20, 30, and 40 units respectively.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 20)\nmodel.addCons(C >= 30)\nmodel.addCons(D >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product.\n// {\"number of units of Product A produced by Machine 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced by Machine 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 4\": \"B_M4\", \"range\": \"B_M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4\n\n## Generate Constraint-1:\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units.\n// A_M1 <= 100\n// A_M2 <= 120\n\n## Generate Constraint-2:\nThe daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units.\n// B_M3 <= 80\n// B_M4 <= 90\n\n## Generate Constraint-3:\nThe daily demand for Product A is 150 units, and for Product B is 100 units.\n// A_M1 + A_M2 >= 150\n// B_M3 + B_M4 >= 100",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product. The cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n\n| Machine | Product | Cost per Unit | Daily Capacity |\n|---------|---------|---------------|----------------|\n| 1       | A       | $10           | 100 units      |\n| 2       | A       | $12           | 120 units      |\n| 3       | B       | $8            | 80 units       |\n| 4       | B       | $9            | 90 units       |\n\nThe daily production capacity of each machine is specified in the table. The daily demand for Product A is 150 units, and for Product B is 100 units. Please help the company determine the optimal number of units of each product to produce daily to meet the demand while minimizing the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced by each machine\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A produced by Machine 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A produced by Machine 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B produced by Machine 3\nB_M4 = model.addVar(vtype=\"INTEGER\", name=\"B_M4\", lb=0) # number of units of Product B produced by Machine 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4)\n\n# Add constraints\n## The daily production capacity of Machine 1 and Machine 2\nmodel.addCons(A_M1 <= 100)\nmodel.addCons(A_M2 <= 120)\n## The daily production capacity of Machine 3 and Machine 4\nmodel.addCons(B_M3 <= 80)\nmodel.addCons(B_M4 <= 90)\n## The daily demand for Product A and Product B\nmodel.addCons(A_M1 + A_M2 >= 150)\nmodel.addCons(B_M3 + B_M4 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced by Machine 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A produced by Machine 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product B produced by Machine 3: \", model.getVal(B_M3))\n    print(\"Number of units of Product B produced by Machine 4: \", model.getVal(B_M4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product.\n// {\"number of units of Product A produced by Machine 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced by Machine 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 4\": \"B_M4\", \"range\": \"B_M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4\n\n## Generate Constraint-1:\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units.\n// A_M1 <= 100\n// A_M2 <= 120\n\n## Generate Constraint-2:\nThe daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units.\n// B_M3 <= 80\n// B_M4 <= 90\n\n## Generate Constraint-3:\nThe daily demand for Product A is 150 units, and for Product B is 100 units.\n// A_M1 + A_M2 >= 150\n// B_M3 + B_M4 >= 100",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product. The cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units. The daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units. The daily demand for Product A is 150 units, and for Product B is 100 units.\nPlease help the company determine the optimal number of units of each product to produce daily to meet the demand while minimizing the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced by each machine\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A produced by Machine 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A produced by Machine 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B produced by Machine 3\nB_M4 = model.addVar(vtype=\"INTEGER\", name=\"B_M4\", lb=0) # number of units of Product B produced by Machine 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4)\n\n# Add constraints\n## The daily production capacity of Machine 1 and Machine 2\nmodel.addCons(A_M1 <= 100)\nmodel.addCons(A_M2 <= 120)\n## The daily production capacity of Machine 3 and Machine 4\nmodel.addCons(B_M3 <= 80)\nmodel.addCons(B_M4 <= 90)\n## The daily demand for Product A and Product B\nmodel.addCons(A_M1 + A_M2 >= 150)\nmodel.addCons(B_M3 + B_M4 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced by Machine 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A produced by Machine 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product B produced by Machine 3: \", model.getVal(B_M3))\n    print(\"Number of units of Product B produced by Machine 4: \", model.getVal(B_M4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\n// A >= 10\n// C <= 15\n\n## Generate Constraint-3:\nThe production of Product B must be at least twice the production of Product A.\n// B >= 2*A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units. The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units. Additionally, the production of Product B must be at least twice the production of Product A.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C <= 15)\n## The production of Product B must be at least twice the production of Product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\n// A >= 10\n// C <= 15\n\n## Generate Constraint-3:\nThe production of Product B must be at least twice the production of Product A.\n// B >= 2*A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units. The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units. The production of Product B must be at least twice the production of Product A. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C <= 15)\n## The production of Product B must be at least twice the production of Product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 1000 kg.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at most 30 units.\n// B <= 30",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The following table summarizes the raw material requirements for each product:\n\n| Product | Profit per Unit | Raw Material per Unit |\n|---------|-----------------|-----------------------|\n| A       | $50             | 2 kg                  |\n| B       | $70             | 3 kg                  |\n| C       | $60             | 4 kg                  |\n\nThe company has a limited amount of raw material, with a total of 1000 kg available. The market demand for Product A is at least 10 units, and the market demand for Product B is at most 30 units. Please help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at most 30 units.\nmodel.addCons(B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 1000 kg.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at most 30 units.\n// B <= 30",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 1000 kg. The market demand for Product A is at least 10 units. The market demand for Product B is at most 30 units.\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at most 30 units.\nmodel.addCons(B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost.\n// {\"number of Product A produced\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 10*Product_A + 15*Product_B + 20*Product_C\n\n## Generate Constraint-1:\nThe market demand for Product A is at least 50 units.\n// Product_A >= 50\n\n## Generate Constraint-2:\nThe market demand for Product B is at least 75 units.\n// Product_B >= 75\n\n## Generate Constraint-3:\nThe market demand for Product C is at least 100 units.\n// Product_C >= 100",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost. The production cost per unit for each product is given in the following Table.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $10                      |\n| B       | $15                      |\n| C       | $20                      |\n\nThe market demand for Product A is at least 50 units. The market demand for Product B is at least 75 units. The market demand for Product C is at least 100 units. \n\nPlease help the company to minimize the total production cost while meeting the market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of Product A produced\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of Product B produced\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Product_A + 15*Product_B + 20*Product_C)\n\n# Add constraints\n## The market demand for Product A is at least 50 units.\nmodel.addCons(Product_A >= 50)\n## The market demand for Product B is at least 75 units.\nmodel.addCons(Product_B >= 75)\n## The market demand for Product C is at least 100 units.\nmodel.addCons(Product_C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Product_A))\n    print(\"Number of Product B produced: \", model.getVal(Product_B))\n    print(\"Number of Product C produced: \", model.getVal(Product_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost.\n// {\"number of Product A produced\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 10*Product_A + 15*Product_B + 20*Product_C\n\n## Generate Constraint-1:\nThe market demand for Product A is at least 50 units.\n// Product_A >= 50\n\n## Generate Constraint-2:\nThe market demand for Product B is at least 75 units.\n// Product_B >= 75\n\n## Generate Constraint-3:\nThe market demand for Product C is at least 100 units.\n// Product_C >= 100",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost. The production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand. The market demand for Product A is at least 50 units. The market demand for Product B is at least 75 units. The market demand for Product C is at least 100 units. Please help the company determine the optimal number of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of Product A produced\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of Product B produced\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Product_A + 15*Product_B + 20*Product_C)\n\n# Add constraints\n## The market demand for Product A is at least 50 units.\nmodel.addCons(Product_A >= 50)\n## The market demand for Product B is at least 75 units.\nmodel.addCons(Product_B >= 75)\n## The market demand for Product C is at least 100 units.\nmodel.addCons(Product_C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Product_A))\n    print(\"Number of Product B produced: \", model.getVal(Product_B))\n    print(\"Number of Product C produced: \", model.getVal(Product_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 660,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B.\n// A >= 50\n// B <= 200\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The production requirements for each product in terms of labor hours are as follows:\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 4 hours              |\n| B       | $30             | 6 hours              |\n| C       | $40             | 5 hours              |\n\nThe company has a total of 1000 labor hours available. The market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B. The company has a policy to produce at least twice as many units of product C as product A.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B.\nmodel.addCons(A >= 50)\nmodel.addCons(B <= 200)\n## The company has a policy to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B.\n// A >= 50\n// B <= 200\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company has a total of 1000 labor hours available, with producing one unit of A, B, and C requiring 4, 6, and 5 hours, respectively. The market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B. Additionally, the company has a policy to produce at least twice as many units of product C as product A. Please help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 50 units, and the company cannot produce more than 200 units of product B.\nmodel.addCons(A >= 50)\nmodel.addCons(B <= 200)\n## The company has a policy to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-3:\nThe total production of products B and C should not exceed 150 units.\n// B + C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The production of one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 4 hours                  |\n| B       | $30             | 6 hours                  |\n| C       | $40             | 5 hours                  |\n\nThe company has a total of 1000 labor hours available. The market demand for product A is at least 100 units. The total production of products B and C should not exceed 150 units.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The total production of products B and C should not exceed 150 units.\nmodel.addCons(B + C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-3:\nThe total production of products B and C should not exceed 150 units.\n// B + C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company has a total of 1000 labor hours available, with producing one unit of A, B, and C requiring 4, 6, and 5 hours, respectively. The market demand for product A is at least 100 units, and the total production of products B and C should not exceed 150 units. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The total production of products B and C should not exceed 150 units.\nmodel.addCons(B + C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 658,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material, which allows for the production of at most 100 units in total.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\n// 2*A + 3*B + 4*C <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 30 units, and the company must meet this demand.\n// A >= 30",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company has a limited amount of raw material, which allows for the production of at most 100 units in total. The production of each product requires a specific amount of labor hours: Product A requires 2 hours, B requires 3 hours, and C requires 4 hours, with a total of 200 labor hours available per day. The market demand for product A is at least 30 units, and the company must meet this demand.\n\nPlease help the company to maximize the total profit from the production of these products.\n\n| Product | Profit per Unit | Labor Hours Required |\n|---------|-----------------|----------------------|\n| A       | $50             | 2                    |\n| B       | $30             | 3                    |\n| C       | $40             | 4                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a limited amount of raw material, which allows for the production of at most 100 units in total.\nmodel.addCons(A + B + C <= 100)\n## The production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The market demand for product A is at least 30 units, and the company must meet this demand.\nmodel.addCons(A >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material, which allows for the production of at most 100 units in total.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\n// 2*A + 3*B + 4*C <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 30 units, and the company must meet this demand.\n// A >= 30",
        "question": "A manufacturing company produces three types of products: A, B, and C. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products. The company has a limited amount of raw material, which allows for the production of at most 100 units in total. The production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200. The market demand for product A is at least 30 units, and the company must meet this demand. Please help the company determine the number of each product to produce to maximize profit while considering the available resources and market demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a limited amount of raw material, which allows for the production of at most 100 units in total.\nmodel.addCons(A + B + C <= 100)\n## The production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The market demand for product A is at least 30 units, and the company must meet this demand.\nmodel.addCons(A >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Maximum Weekly Demand |\n|---------|--------------------------|------------------------|-----------------------|\n| A       | $20                      | $50                    | 400 units             |\n| B       | $30                      | $70                    | 300 units             |\n| C       | $40                      | $90                    | 200 units             |\n\nThe total production capacity of the manufacturer is 1000 units per week. The manufacturer must produce at least 100 units of product A per week. Please help the manufacturer to maximize the total profit, which is calculated as the difference between the selling price and the production cost per unit for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (50 - 20) * A + (70 - 30) * B + (90 - 40) * C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\nThe total production capacity of the manufacturer is 1000 units per week. The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively. The manufacturer must produce at least 100 units of product A per week.\nPlease help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (50 - 20) * A + (70 - 30) * B + (90 - 40) * C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 701,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of special mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, each donut requires 0.15 pounds, and each mixed box requires 0.45 pounds.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day. Each type of pastry counts as one unit towards the oven capacity.\n// Cro + Muf + Don + Mix <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts, and also sells special mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity. The profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box is $1.50. The bakery has a daily supply of 200 pounds of flour, and each pastry requires a certain amount of flour as shown in the following Table.\n\n| Pastry       | Profit per Unit | Flour Required (pounds) |\n|--------------|-----------------|-------------------------|\n| Croissants   | $0.50           | 0.1                     |\n| Muffins      | $0.60           | 0.2                     |\n| Donuts       | $0.40           | 0.15                    |\n| Mixed Boxes  | $1.50           | 0.45                    |\n\nThe bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day. Each type of pastry counts as one unit towards the oven capacity. The bakery must also produce at least 50 croissants and 40 muffins per day to meet the minimum demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day.\nmodel.addCons(Cro + Muf + Don + Mix <= 150)\n## The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of special mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of special mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, each donut requires 0.15 pounds, and each mixed box requires 0.45 pounds.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day. Each type of pastry counts as one unit towards the oven capacity.\n// Cro + Muf + Don + Mix <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts, and also sells special mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity. The profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box is $1.50. The bakery has a daily supply of 200 pounds of flour, with each croissant requiring 0.1 pounds of flour, each muffin requiring 0.2 pounds, each donut requiring 0.15 pounds, and each mixed box requiring 0.45 pounds. The bakery's oven capacity allows for a maximum of 150 pastries per day, with each type of pastry counting as one unit towards the oven capacity. Additionally, the bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand. Please help the bakery maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day.\nmodel.addCons(Cro + Muf + Don + Mix <= 150)\n## The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of special mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of oats\": \"O\", \"range\": \"O >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*B + 100*O\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// W + C + B + O <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer.\n// W + C + 0.5*B + 0.5*O <= 60\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to meet contractual obligations.\n// W >= 10",
        "question": "A farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources. The profit per acre for each crop is given in the following Table.\n\n| Crop   | Profit per Acre |\n|--------|-----------------|\n| Wheat  | $200            |\n| Corn   | $300            |\n| Barley | $150            |\n| Oats   | $100            |\n\nThe total available land for farming is 100 acres. The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer. The farmer must also plant at least 10 acres of wheat to meet contractual obligations.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\nO = model.addVar(vtype=\"INTEGER\", name=\"O\", lb=0) # acres of oats\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*B + 100*O)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(W + C + B + O <= 100)\n## The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops.\nmodel.addCons(W + C + 0.5*B + 0.5*O <= 60)\n## The farmer must plant at least 10 acres of wheat to meet contractual obligations.\nmodel.addCons(W >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of barley: \", model.getVal(B))\n    print(\"Acres of oats: \", model.getVal(O))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of oats\": \"O\", \"range\": \"O >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*B + 100*O\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// W + C + B + O <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer.\n// W + C + 0.5*B + 0.5*O <= 60\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to meet contractual obligations.\n// W >= 10",
        "question": "A farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources. The profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The total available land for farming is 100 acres. The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer. The farmer must plant at least 10 acres of wheat to meet contractual obligations. Please help the farmer to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\nO = model.addVar(vtype=\"INTEGER\", name=\"O\", lb=0) # acres of oats\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*B + 100*O)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(W + C + B + O <= 100)\n## The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops.\nmodel.addCons(W + C + 0.5*B + 0.5*O <= 60)\n## The farmer must plant at least 10 acres of wheat to meet contractual obligations.\nmodel.addCons(W >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of barley: \", model.getVal(B))\n    print(\"Acres of oats: \", model.getVal(O))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit | Raw Material Cost per Unit |\n|------------|-----------------|----------------------------|\n| Smartphones| $100            | $50                        |\n| Tablets    | $150            | $75                        |\n| Laptops    | $200            | $100                       |\n\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day. The company has a limited budget for raw materials, which is $120,000 per day.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day. The company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the constraints of ingredient availability and demand.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per doughnut is $0.35, and per eclair is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Cro + 0.40*Muff + 0.35*Don + 0.60*Ecl\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and sugar. The daily supply of flour is 100 kg, and sugar is 50 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.08 kg of flour and 0.04 kg of sugar, each doughnut requires 0.06 kg of flour and 0.03 kg of sugar, and each eclair requires 0.12 kg of flour and 0.06 kg of sugar.\n// 0.1*Cro + 0.08*Muff + 0.06*Don + 0.12*Ecl <= 100 (Flour constraint)\n// 0.05*Cro + 0.04*Muff + 0.03*Don + 0.06*Ecl <= 50 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of pastry. The minimum demand for croissants is 100, for muffins is 150, for doughnuts is 200, and for eclairs is 50.\n// Cro >= 100\n// Muff >= 150\n// Don >= 200\n// Ecl >= 50\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily demand for each type of pastry. The maximum demand for croissants is 200, for muffins is 300, for doughnuts is 400, and for eclairs is 100.\n// Cro <= 200\n// Muff <= 300\n// Don <= 400\n// Ecl <= 100",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the constraints of ingredient availability and demand. The profit per croissant is $0.50, per muffin is $0.40, per doughnut is $0.35, and per eclair is $0.60. The bakery has a limited supply of flour and sugar. The daily supply of flour is 100 kg, and sugar is 50 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.08 kg of flour and 0.04 kg of sugar, each doughnut requires 0.06 kg of flour and 0.03 kg of sugar, and each eclair requires 0.12 kg of flour and 0.06 kg of sugar. The bakery has a minimum daily demand for each type of pastry: 100 croissants, 150 muffins, 200 doughnuts, and 50 eclairs. Additionally, there is a maximum daily demand for each type of pastry: 200 croissants, 300 muffins, 400 doughnuts, and 100 eclairs.\n\nPlease help the bakery to maximize its daily profit from pastry sales, considering all these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.40*Muff + 0.35*Don + 0.60*Ecl)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.1*Cro + 0.08*Muff + 0.06*Don + 0.12*Ecl <= 100)\n## Sugar constraint\nmodel.addCons(0.05*Cro + 0.04*Muff + 0.03*Don + 0.06*Ecl <= 50)\n## Minimum daily demand for each type of pastry\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 150)\nmodel.addCons(Don >= 200)\nmodel.addCons(Ecl >= 50)\n## Maximum daily demand for each type of pastry\nmodel.addCons(Cro <= 200)\nmodel.addCons(Muff <= 300)\nmodel.addCons(Don <= 400)\nmodel.addCons(Ecl <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the constraints of ingredient availability and demand.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.40, per doughnut is $0.35, and per eclair is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Cro + 0.40*Muff + 0.35*Don + 0.60*Ecl\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour and sugar. The daily supply of flour is 100 kg, and sugar is 50 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.08 kg of flour and 0.04 kg of sugar, each doughnut requires 0.06 kg of flour and 0.03 kg of sugar, and each eclair requires 0.12 kg of flour and 0.06 kg of sugar.\n// 0.1*Cro + 0.08*Muff + 0.06*Don + 0.12*Ecl <= 100 (Flour constraint)\n// 0.05*Cro + 0.04*Muff + 0.03*Don + 0.06*Ecl <= 50 (Sugar constraint)\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for each type of pastry. The minimum demand for croissants is 100, for muffins is 150, for doughnuts is 200, and for eclairs is 50.\n// Cro >= 100\n// Muff >= 150\n// Don >= 200\n// Ecl >= 50\n\n## Generate Constraint-3:\nThe bakery also has a maximum daily demand for each type of pastry. The maximum demand for croissants is 200, for muffins is 300, for doughnuts is 400, and for eclairs is 100.\n// Cro <= 200\n// Muff <= 300\n// Don <= 400\n// Ecl <= 100",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the constraints of ingredient availability and demand. The profit per croissant is $0.50, per muffin is $0.40, per doughnut is $0.35, and per eclair is $0.60. The bakery has a limited supply of flour and sugar. The daily supply of flour is 100 kg, and sugar is 50 kg. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.08 kg of flour and 0.04 kg of sugar, each doughnut requires 0.06 kg of flour and 0.03 kg of sugar, and each eclair requires 0.12 kg of flour and 0.06 kg of sugar. The bakery has a minimum daily demand for each type of pastry. The minimum demand for croissants is 100, for muffins is 150, for doughnuts is 200, and for eclairs is 50. The bakery also has a maximum daily demand for each type of pastry. The maximum demand for croissants is 200, for muffins is 300, for doughnuts is 400, and for eclairs is 100.\n\nPlease help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of doughnuts\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.40*Muff + 0.35*Don + 0.60*Ecl)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.1*Cro + 0.08*Muff + 0.06*Don + 0.12*Ecl <= 100)\n## Sugar constraint\nmodel.addCons(0.05*Cro + 0.04*Muff + 0.03*Don + 0.06*Ecl <= 50)\n## Minimum daily demand for each type of pastry\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 150)\nmodel.addCons(Don >= 200)\nmodel.addCons(Ecl >= 50)\n## Maximum daily demand for each type of pastry\nmodel.addCons(Cro <= 200)\nmodel.addCons(Muff <= 300)\nmodel.addCons(Don <= 400)\nmodel.addCons(Ecl <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of doughnuts: \", model.getVal(Don))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce each month to maximize profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. Please help the company determine the optimal production quantities for each device to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce each month to maximize profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. Please help the company determine the optimal production quantities for each device to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand.\n// {\"number of loaves of whole wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of baguettes\": \"Baguettes\", \"range\": \"Baguettes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\n// Wheat + Rye + Sourdough + Baguettes <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\n// Wheat >= 100, Rye >= 80, Sourdough >= 120, Baguettes >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\n// Wheat + Rye + Sourdough + Baguettes <= 300",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.50           |\n| Sourdough     | $3              |\n| Baguettes     | $1.50           |\n\nThe bakery has a limited amount of flour available, with a maximum of 500 pounds per day, and each loaf of bread requires 1 pound of flour. The bakery also faces daily demand constraints: at least 100 loaves of whole wheat bread, 80 loaves of rye bread, 120 loaves of sourdough bread, and 150 loaves of baguettes must be produced. Additionally, the bakery's oven capacity is limited to 300 loaves per day.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nBaguettes = model.addVar(vtype=\"INTEGER\", name=\"Baguettes\", lb=0) # number of loaves of baguettes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes)\n\n# Add constraints\n## The bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 500)\n## The bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 120)\nmodel.addCons(Baguettes >= 150)\n## The bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of baguettes: \", model.getVal(Baguettes))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand.\n// {\"number of loaves of whole wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of baguettes\": \"Baguettes\", \"range\": \"Baguettes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\n// Wheat + Rye + Sourdough + Baguettes <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\n// Wheat >= 100, Rye >= 80, Sourdough >= 120, Baguettes >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\n// Wheat + Rye + Sourdough + Baguettes <= 300",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50. The bakery has a limited amount of flour available, with up to 500 pounds of flour per day, and each loaf of bread requires 1 pound of flour. The bakery also has a daily demand for each type of bread: at least 100 loaves of whole wheat bread, at least 80 loaves of rye bread, at least 120 loaves of sourdough bread, and at least 150 loaves of baguettes. Additionally, the bakery's oven can handle up to 300 loaves per day. Please help the bakery maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nBaguettes = model.addVar(vtype=\"INTEGER\", name=\"Baguettes\", lb=0) # number of loaves of baguettes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes)\n\n# Add constraints\n## The bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 500)\n## The bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 120)\nmodel.addCons(Baguettes >= 150)\n## The bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of baguettes: \", model.getVal(Baguettes))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of loaves of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of pumpernickel bread\": \"PDB\", \"range\": \"PDB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery aims to maximize its total daily profit from bread sales.\n// Objective Function: Maximize: 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 pounds of yeast. The total daily yeast supply is 1 pound.\n// 0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1\n\n## Generate Constraint-3:\nThe bakery has a limited number of labor hours. Each loaf of bread requires 15 minutes of labor. The total daily labor hours available are 480 minutes.\n// (WWB + RB + SDB + PDB) * 15 <= 480 * 60",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.50           |\n| Sourdough     | $3              |\n| Pumpernickel  | $2.75           |\n\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds.\n\nThe bakery also has a limited supply of yeast. Each loaf of bread requires 0.01 pounds of yeast, and the total daily yeast supply is 1 pound.\n\nAdditionally, the bakery has a limited number of labor hours. Each loaf of bread requires 15 minutes of labor, and the total daily labor hours available are 480 minutes.\n\nPlease help the bakery to maximize its total daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWWB = model.addVar(vtype=\"INTEGER\", name=\"WWB\", lb=0) # number of loaves of whole wheat bread\nRB = model.addVar(vtype=\"INTEGER\", name=\"RB\", lb=0) # number of loaves of rye bread\nSDB = model.addVar(vtype=\"INTEGER\", name=\"SDB\", lb=0) # number of loaves of sourdough bread\nPDB = model.addVar(vtype=\"INTEGER\", name=\"PDB\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1)\n## The bakery has a limited number of labor hours.\nmodel.addCons((WWB + RB + SDB + PDB) * 15 <= 480 * 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WWB))\n    print(\"Number of loaves of rye bread: \", model.getVal(RB))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SDB))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(PDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of loaves of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of pumpernickel bread\": \"PDB\", \"range\": \"PDB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery aims to maximize its total daily profit from bread sales.\n// Objective Function: Maximize: 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 pounds of yeast. The total daily yeast supply is 1 pound.\n// 0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1\n\n## Generate Constraint-3:\nThe bakery has a limited number of labor hours. Each loaf of bread requires 15 minutes of labor. The total daily labor hours available are 480 minutes.\n// (WWB + RB + SDB + PDB) * 15 <= 480 * 60",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75. The bakery aims to maximize its total daily profit from bread sales.\n\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds. The bakery also has a limited supply of yeast, with each loaf of bread requiring 0.01 pounds of yeast and a total daily yeast supply of 1 pound. Additionally, the bakery has a limited number of labor hours, with each loaf of bread requiring 15 minutes of labor and a total daily labor hours available of 480 minutes.\n\nPlease help the bakery to determine the optimal number of loaves to produce for each type of bread to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWWB = model.addVar(vtype=\"INTEGER\", name=\"WWB\", lb=0) # number of loaves of whole wheat bread\nRB = model.addVar(vtype=\"INTEGER\", name=\"RB\", lb=0) # number of loaves of rye bread\nSDB = model.addVar(vtype=\"INTEGER\", name=\"SDB\", lb=0) # number of loaves of sourdough bread\nPDB = model.addVar(vtype=\"INTEGER\", name=\"PDB\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1)\n## The bakery has a limited number of labor hours.\nmodel.addCons((WWB + RB + SDB + PDB) * 15 <= 480 * 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WWB))\n    print(\"Number of loaves of rye bread: \", model.getVal(RB))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SDB))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(PDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1291,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time.\n// {\"number of white breads\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of white bread requires 0.5 kg of flour, whole wheat bread requires 0.6 kg, rye bread requires 0.7 kg, and sourdough bread requires 0.8 kg. The total daily flour supply is 500 kg.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The total daily yeast supply is 3 kg.\n// 0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3\n\n## Generate Constraint-3:\nThe bakery has a limited oven time. Each loaf of bread requires 15 minutes of oven time. The total daily oven time available is 12 hours.\n// (White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time. The profit per loaf for each type of bread is as follows: white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf | Yeast Required per Loaf | Oven Time Required per Loaf |\n|---------------|-----------------|-------------------------|-------------------------|-----------------------------|\n| White         | $1.50           | 0.5 kg                  | 0.01 kg                 | 15 minutes                  |\n| Whole Wheat   | $2.00           | 0.6 kg                  | 0.01 kg                 | 15 minutes                  |\n| Rye           | $2.50           | 0.7 kg                  | 0.01 kg                 | 15 minutes                  |\n| Sourdough     | $3.00           | 0.8 kg                  | 0.01 kg                 | 15 minutes                  |\n\nThe bakery has a limited supply of flour, with a total daily supply of 500 kg. Each loaf of bread requires a certain amount of flour as shown in the table. The bakery also has a limited supply of yeast, with a total daily supply of 3 kg, and each loaf of bread requires 0.01 kg of yeast. Additionally, the bakery has a limited oven time, with a total daily availability of 12 hours. Each loaf of bread requires 15 minutes of oven time.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of white breads\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3)\n## The bakery has a limited oven time.\nmodel.addCons((White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white breads: \", model.getVal(White))\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1676,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time.\n// {\"number of white breads\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of white bread requires 0.5 kg of flour, whole wheat bread requires 0.6 kg, rye bread requires 0.7 kg, and sourdough bread requires 0.8 kg. The total daily flour supply is 500 kg.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The total daily yeast supply is 3 kg.\n// 0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3\n\n## Generate Constraint-3:\nThe bakery has a limited oven time. Each loaf of bread requires 15 minutes of oven time. The total daily oven time available is 12 hours.\n// (White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time. The profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery aims to maximize its daily profit from bread sales. The bakery has a limited supply of flour, with each loaf of white bread requiring 0.5 kg of flour, whole wheat bread requiring 0.6 kg, rye bread requiring 0.7 kg, and sourdough bread requiring 0.8 kg, with a total daily flour supply of 500 kg. The bakery also has a limited supply of yeast, with each loaf of bread requiring 0.01 kg of yeast and a total daily yeast supply of 3 kg. Additionally, the bakery has a limited oven time, with each loaf of bread requiring 15 minutes of oven time and a total daily oven time available of 12 hours. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of white breads\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3)\n## The bakery has a limited oven time.\nmodel.addCons((White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white breads: \", model.getVal(White))\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\n// Croissant + Muffin >= 100",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The following table summarizes the requirements for each type of pastry:\n\n| Pastry   | Oven Time per Unit | Flour per Unit | Profit per Unit |\n|----------|--------------------|----------------|-----------------|\n| Croissant| 0.1 hours          | 0.05 pounds    | $0.50           |\n| Muffin   | 0.2 hours          | 0.1 pounds     | $0.70           |\n\nThe bakery has a total of 8 hours of oven time and 20 pounds of flour available daily. The bakery must also produce at least 100 pastries in total each day to meet minimum customer demand. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Pounds = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 20)\n## The bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissant + Muffin >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\n// Croissant + Muffin >= 100",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily. Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily. The bakery must produce at least 100 pastries in total each day to meet minimum customer demand. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nOven_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Pounds = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 20)\n## The bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissant + Muffin >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of sugar required\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, and from each vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Choc + Van <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\n// Choc + 0.5*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\n// Choc >= 20\n// Van >= 30",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement. The profit from each chocolate cake is $5, and from each vanilla cake is $4. The following table shows the requirements for each type of cake:\n\n| Cake Type | Profit per Cake | Eggs Required | Sugar Required |\n|-----------|-----------------|---------------|----------------|\n| Chocolate | $5              | 2             | 1 kg           |\n| Vanilla   | $4              | 1             | 0.5 kg         |\n\nThe bakery has a daily supply of 100 eggs and 60 kg of sugar. The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Choc + Van <= 100)\n## Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\nmodel.addCons(Choc + 0.5*Van <= 60)\n## The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of sugar required\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, and from each vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Choc + Van <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\n// Choc + 0.5*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\n// Choc >= 20\n// Van >= 30",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement. The profit from each chocolate cake is $5, and from each vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar. The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Choc + Van <= 100)\n## Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\nmodel.addCons(Choc + 0.5*Van <= 60)\n## The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for wheat bread\": \"Wheat_Oven\", \"range\": \"Wheat_Oven >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for rye bread\": \"Rye_Oven\", \"range\": \"Rye_Oven >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread. The total daily flour supply is 200 kg.\n// Wheat + 1.5*Rye <= 200\n\n## Generate Constraint-2:\nThe bakery's oven can only operate for a maximum of 12 hours per day. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time.\n// 0.2*Wheat + 0.3*Rye <= 12\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The bakery has a limited amount of flour available each day, using 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread, with a total daily flour supply of 200 kg. The bakery's oven can only operate for a maximum of 12 hours per day, with each wheat bread requiring 0.2 hours of oven time and each rye bread requiring 0.3 hours of oven time. The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\n\nPlease help the bakery to maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nWheat_Oven = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven\", lb=0) # number of hours of oven use for wheat bread\nRye_Oven = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven\", lb=0) # number of hours of oven use for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(Wheat + 1.5*Rye <= 200)\n## The bakery's oven can only operate for a maximum of 12 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 12)\n## The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for wheat bread\": \"Wheat_Oven\", \"range\": \"Wheat_Oven >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for rye bread\": \"Rye_Oven\", \"range\": \"Rye_Oven >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread. The total daily flour supply is 200 kg.\n// Wheat + 1.5*Rye <= 200\n\n## Generate Constraint-2:\nThe bakery's oven can only operate for a maximum of 12 hours per day. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time.\n// 0.2*Wheat + 0.3*Rye <= 12\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The bakery has a limited amount of flour available each day, using 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread, with a total daily flour supply of 200 kg. The bakery's oven can only operate for a maximum of 12 hours per day, with each wheat bread requiring 0.2 hours of oven time and each rye bread requiring 0.3 hours of oven time. The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads. Please help the bakery to maximize its daily profit from selling bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nWheat_Oven = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven\", lb=0) # number of hours of oven use for wheat bread\nRye_Oven = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven\", lb=0) # number of hours of oven use for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(Wheat + 1.5*Rye <= 200)\n## The bakery's oven can only operate for a maximum of 12 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 12)\n## The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 40\n\n## Generate Constraint-2:\nEach loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\n// 0.4*Wheat + 0.5*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\n// Wheat >= 10, Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Time per Loaf | Flour Usage per Loaf |\n|------------|-----------------|---------------------|----------------------|\n| Wheat      | $3              | 0.5 hours           | 0.4 pounds           |\n| Rye        | $4              | 0.75 hours          | 0.5 pounds           |\n\nThe bakery has a maximum of 40 hours of oven time available daily and a maximum of 20 pounds of flour available daily. The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 40)\n## Each loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.5*Rye <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 40\n\n## Generate Constraint-2:\nEach loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\n// 0.4*Wheat + 0.5*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\n// Wheat >= 10, Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily. Each loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily. The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 40)\n## Each loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.5*Rye <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of whole wheat flour used\": \"WholeWheatFlour\", \"range\": \"WholeWheatFlour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"RyeFlour\", \"range\": \"RyeFlour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 kg of whole wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour.\n// 0.5*WholeWheat <= WholeWheatFlour\n// 0.4*Rye <= RyeFlour\n// WholeWheatFlour <= 100\n// RyeFlour <= 80\n\n## Generate Constraint-2:\nEach whole wheat bread requires 20 minutes of oven time, and each rye bread requires 15 minutes of oven time. The bakery has a total of 1200 minutes of oven time available daily.\n// 20*WholeWheat + 15*Rye <= 1200\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// WholeWheat >= 10\n// Rye >= 15",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2.50. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Requirement (kg) | Oven Time (minutes) |\n|----------------|------------------|------------------------|---------------------|\n| Whole Wheat    | $3               | 0.5                    | 20                  |\n| Rye            | $2.50            | 0.4                    | 15                  |\n\nThe bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour. The bakery has a total of 1200 minutes of oven time available daily. The bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour used for each type of bread\nWholeWheatFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatFlour\", lb=0) # amount of whole wheat flour used\nRyeFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeFlour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 kg of whole wheat flour, and each rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*WholeWheat <= WholeWheatFlour)\nmodel.addCons(0.4*Rye <= RyeFlour)\n## The bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour.\nmodel.addCons(WholeWheatFlour <= 100)\nmodel.addCons(RyeFlour <= 80)\n## Each whole wheat bread requires 20 minutes of oven time, and each rye bread requires 15 minutes of oven time.\nmodel.addCons(20*WholeWheat + 15*Rye <= 1200)\n## The bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of whole wheat flour used: \", model.getVal(WholeWheatFlour))\n    print(\"Amount of rye flour used: \", model.getVal(RyeFlour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and oven time.\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"amount of whole wheat flour used\": \"WholeWheatFlour\", \"range\": \"WholeWheatFlour >= 0\", \"type\": \"real\"}\n// {\"amount of rye flour used\": \"RyeFlour\", \"range\": \"RyeFlour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach whole wheat bread requires 0.5 kg of whole wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour.\n// 0.5*WholeWheat <= WholeWheatFlour\n// 0.4*Rye <= RyeFlour\n// WholeWheatFlour <= 100\n// RyeFlour <= 80\n\n## Generate Constraint-2:\nEach whole wheat bread requires 20 minutes of oven time, and each rye bread requires 15 minutes of oven time. The bakery has a total of 1200 minutes of oven time available daily.\n// 20*WholeWheat + 15*Rye <= 1200\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// WholeWheat >= 10\n// Rye >= 15",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit, considering the limited resources such as flour and oven time. The profit from selling each whole wheat bread is $3, and the profit from selling each rye bread is $2.50. Each whole wheat bread requires 0.5 kg of whole wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour. Each whole wheat bread requires 20 minutes of oven time, and each rye bread requires 15 minutes of oven time. The bakery has a total of 1200 minutes of oven time available daily. The bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of flour used for each type of bread\nWholeWheatFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatFlour\", lb=0) # amount of whole wheat flour used\nRyeFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeFlour\", lb=0) # amount of rye flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each whole wheat bread requires 0.5 kg of whole wheat flour, and each rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*WholeWheat <= WholeWheatFlour)\nmodel.addCons(0.4*Rye <= RyeFlour)\n## The bakery has a daily supply of 100 kg of whole wheat flour and 80 kg of rye flour.\nmodel.addCons(WholeWheatFlour <= 100)\nmodel.addCons(RyeFlour <= 80)\n## Each whole wheat bread requires 20 minutes of oven time, and each rye bread requires 15 minutes of oven time.\nmodel.addCons(20*WholeWheat + 15*Rye <= 1200)\n## The bakery must bake at least 10 whole wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Amount of whole wheat flour used: \", model.getVal(WholeWheatFlour))\n    print(\"Amount of rye flour used: \", model.getVal(RyeFlour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"flour in kilograms\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\n// 0.2*Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table outlines the requirements for each type of bread:\n\n| Bread Type | Flour Requirement (kg) | Oven Time Requirement (hours) |\n|------------|------------------------|-------------------------------|\n| Wheat      | 0.5                    | 0.2                           |\n| Rye        | 0.6                    | 0.3                           |\n\nThe bakery has a daily supply of 100 kg of flour and its oven can operate for a maximum of 20 hours per day. Additionally, the bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\n\nPlease help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"flour in kilograms\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\n// 0.2*Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 50\n// Rye >= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from selling these breads.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"FlourUsed\", \"range\": \"FlourUsed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\n// 0.5*WholeWheat + 0.4*Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\n// 0.4*WholeWheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 10, Rye >= 10",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Loaf | Flour Used per Loaf |\n|------------|--------------------|---------------------|\n| Whole Wheat | 0.5 hours          | 0.4 pounds          |\n| Rye        | 0.4 hours          | 0.3 pounds          |\n\nThe bakery has a maximum of 8 hours of oven time available daily and a total of 30 pounds of flour available daily. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 8)\n## Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\nmodel.addCons(0.4*WholeWheat + 0.3*Rye <= 30)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"FlourUsed\", \"range\": \"FlourUsed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\n// 0.5*WholeWheat + 0.4*Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\n// 0.4*WholeWheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 10, Rye >= 10",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily. Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 8)\n## Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\nmodel.addCons(0.4*WholeWheat + 0.3*Rye <= 30)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"FlourPounds\", \"range\": \"FlourPounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\n// 0.75*WholeWheat + 0.6*Rye <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The requirements for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required (pounds) | Oven Time Required (hours) |\n|------------|-----------------|-------------------------|----------------------------|\n| Whole Wheat | $3              | 0.5                     | 0.75                       |\n| Rye        | $2.50           | 0.4                     | 0.6                        |\n\nThe bakery has a daily supply of 100 pounds of flour and a daily limit of 60 hours of oven usage. The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\nmodel.addCons(0.75*WholeWheat + 0.6*Rye <= 60)\n## The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"FlourPounds\", \"range\": \"FlourPounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\n// 0.75*WholeWheat + 0.6*Rye <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour. Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage. The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\nmodel.addCons(0.75*WholeWheat + 0.6*Rye <= 60)\n## The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the constraints on ingredients and demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of wheat ingredients\": \"Wheat_Ingredient\", \"range\": \"Wheat_Ingredient >= 0\", \"type\": \"integer\"}\n// {\"number of rye ingredients\": \"Rye_Ingredient\", \"range\": \"Rye_Ingredient >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5*Wheat <= Wheat_Ingredient\n// 0.4*Rye <= Rye_Ingredient\n// Wheat_Ingredient <= 100\n// Rye_Ingredient <= 80\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each wheat bread requires 10 minutes of oven time, and each rye bread requires 15 minutes. The total daily oven time available is 1200 minutes.\n// 10*Wheat + 15*Rye <= 1200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the constraints on ingredients and demand. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Flour Requirement (kg) | Oven Time (minutes) |\n|------------|------------------|------------------------|---------------------|\n| Wheat      | $2               | 0.5                    | 10                  |\n| Rye        | $3               | 0.4                    | 15                  |\n\nThe bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour. The bakery also has a limited oven capacity, with a total daily oven time available of 1200 minutes. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of wheat and rye ingredients used\nWheat_Ingredient = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ingredient\", lb=0) # number of wheat ingredients\nRye_Ingredient = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ingredient\", lb=0) # number of rye ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*Wheat <= Wheat_Ingredient)\nmodel.addCons(0.4*Rye <= Rye_Ingredient)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Ingredient <= 100)\nmodel.addCons(Rye_Ingredient <= 80)\n## The bakery has a limited oven capacity.\nmodel.addCons(10*Wheat + 15*Rye <= 1200)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the constraints on ingredients and demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of wheat ingredients\": \"Wheat_Ingredient\", \"range\": \"Wheat_Ingredient >= 0\", \"type\": \"integer\"}\n// {\"number of rye ingredients\": \"Rye_Ingredient\", \"range\": \"Rye_Ingredient >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\n// 0.5*Wheat <= Wheat_Ingredient\n// 0.4*Rye <= Rye_Ingredient\n// Wheat_Ingredient <= 100\n// Rye_Ingredient <= 80\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each wheat bread requires 10 minutes of oven time, and each rye bread requires 15 minutes. The total daily oven time available is 1200 minutes.\n// 10*Wheat + 15*Rye <= 1200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit, considering the constraints on ingredients and demand. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour. The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour. Each wheat bread requires 10 minutes of oven time, and each rye bread requires 15 minutes. The total daily oven time available is 1200 minutes. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The amount of wheat and rye ingredients used\nWheat_Ingredient = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Ingredient\", lb=0) # number of wheat ingredients\nRye_Ingredient = model.addVar(vtype=\"INTEGER\", name=\"Rye_Ingredient\", lb=0) # number of rye ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of wheat flour, and each rye bread requires 0.4 kg of rye flour.\nmodel.addCons(0.5*Wheat <= Wheat_Ingredient)\nmodel.addCons(0.4*Rye <= Rye_Ingredient)\n## The bakery has a daily supply of 100 kg of wheat flour and 80 kg of rye flour.\nmodel.addCons(Wheat_Ingredient <= 100)\nmodel.addCons(Rye_Ingredient <= 80)\n## The bakery has a limited oven capacity.\nmodel.addCons(10*Wheat + 15*Rye <= 1200)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"amount of flour in kg\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and from each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\n// 0.4*Wheat + 0.6*Rye <= 6\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit from selling each wheat bread is $2, and from each rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Bread (hours) | Flour per Bread (kg) |\n|------------|-----------------------------|----------------------|\n| Wheat      | 0.5                         | 0.4                  |\n| Rye        | 0.75                        | 0.6                  |\n\nThe bakery has a total daily oven time available of 8 hours and a total daily flour availability of 6 kg. The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 6)\n## The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"amount of flour in kg\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and from each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\n// 0.4*Wheat + 0.6*Rye <= 6\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit from selling each wheat bread is $2, and from each rye bread is $3. Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time, with a total daily oven time available of 8 hours. Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour, with a total daily flour available of 6 kg. The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 6)\n## The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and storage space.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"available flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n// {\"available yeast\": \"Yeast\", \"range\": \"Yeast >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 kg of flour and 0.01 kg of yeast. Each loaf of rye bread requires 0.4 kg of flour and 0.01 kg of yeast. The bakery has a daily supply of 100 kg of flour and 1 kg of yeast.\n// 0.5*WholeWheat + 0.4*Rye <= Flour\n// 0.01*WholeWheat + 0.01*Rye <= Yeast\n\n## Generate Constraint-2:\nThe bakery has limited storage space and can only store up to 200 loaves of bread at a time.\n// WholeWheat + Rye <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and storage space. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The requirements for each type of bread in terms of flour and yeast are given in the following Table.\n\n| Type of Bread | Flour (kg/loaf) | Yeast (kg/loaf) | Profit ($/loaf) |\n|---------------|-----------------|-----------------|-----------------|\n| Whole Wheat   | 0.5             | 0.01            | 3               |\n| Rye           | 0.4             | 0.01            | 2.5             |\n\nThe bakery has a daily supply of 100 kg of flour and 1 kg of yeast. The bakery has limited storage space and can only store up to 200 loaves of bread at a time. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Available ingredients\nFlour = model.addVar(vtype=\"INTEGER\", name=\"Flour\", lb=0) # available flour\nYeast = model.addVar(vtype=\"INTEGER\", name=\"Yeast\", lb=0) # available yeast\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 kg of flour and 0.01 kg of yeast.\n## Each loaf of rye bread requires 0.4 kg of flour and 0.01 kg of yeast.\n## The bakery has a daily supply of 100 kg of flour and 1 kg of yeast.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= Flour)\nmodel.addCons(0.01*WholeWheat + 0.01*Rye <= Yeast)\nmodel.addCons(Flour == 100)\nmodel.addCons(Yeast == 1)\n## The bakery has limited storage space and can only store up to 200 loaves of bread at a time.\nmodel.addCons(WholeWheat + Rye <= 200)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and storage space.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"available flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n// {\"available yeast\": \"Yeast\", \"range\": \"Yeast >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 kg of flour and 0.01 kg of yeast. Each loaf of rye bread requires 0.4 kg of flour and 0.01 kg of yeast. The bakery has a daily supply of 100 kg of flour and 1 kg of yeast.\n// 0.5*WholeWheat + 0.4*Rye <= Flour\n// 0.01*WholeWheat + 0.01*Rye <= Yeast\n\n## Generate Constraint-2:\nThe bakery has limited storage space and can only store up to 200 loaves of bread at a time.\n// WholeWheat + Rye <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// WholeWheat + Rye >= 50",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and storage space. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. Each loaf of whole wheat bread requires 0.5 kg of flour and 0.01 kg of yeast. Each loaf of rye bread requires 0.4 kg of flour and 0.01 kg of yeast. The bakery has a daily supply of 100 kg of flour and 1 kg of yeast. The bakery has limited storage space and can only store up to 200 loaves of bread at a time. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Available ingredients\nFlour = model.addVar(vtype=\"INTEGER\", name=\"Flour\", lb=0) # available flour\nYeast = model.addVar(vtype=\"INTEGER\", name=\"Yeast\", lb=0) # available yeast\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 kg of flour and 0.01 kg of yeast.\n## Each loaf of rye bread requires 0.4 kg of flour and 0.01 kg of yeast.\n## The bakery has a daily supply of 100 kg of flour and 1 kg of yeast.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= Flour)\nmodel.addCons(0.01*WholeWheat + 0.01*Rye <= Yeast)\nmodel.addCons(Flour == 100)\nmodel.addCons(Yeast == 1)\n## The bakery has limited storage space and can only store up to 200 loaves of bread at a time.\nmodel.addCons(WholeWheat + Rye <= 200)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\n// 0.4*Wheat + 0.6*Rye <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table outlines the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Oven Time per Bread | Flour Used per Bread |\n|------------|------------------|---------------------|----------------------|\n| Wheat      | $2               | 0.5 hours           | 0.4 pounds           |\n| Rye        | $3               | 0.75 hours          | 0.6 pounds           |\n\nThe bakery has a total of 8 hours of oven time and 4 pounds of flour available daily. The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Please help the bakery maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 4)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\n// 0.4*Wheat + 0.6*Rye <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily. Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily. The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit from selling these breads.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 4)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread (wheat, rye, and sourdough) and one type of pastry (cinnamon rolls). The bakery needs to decide how many units of each product to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of cinnamon rolls\": \"Cinnamon\", \"range\": \"Cinnamon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for wheat bread is $2, for rye bread is $3, for sourdough bread is $4, and for cinnamon rolls is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 1.50*Cinnamon\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and yeast. Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, each rye bread requires 0.4 kg of flour and 0.1 kg of yeast, each sourdough bread requires 0.3 kg of flour and 0.2 kg of yeast, and each cinnamon roll requires 0.2 kg of flour and 0.05 kg of yeast. The total available flour is 200 kg and yeast is 30 kg.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.2*Cinnamon <= 200 (Flour constraint)\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 30 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each wheat bread takes 0.1 hours to make, each rye bread takes 0.15 hours, each sourdough bread takes 0.2 hours, and each cinnamon roll takes 0.05 hours.\n// 0.1*Wheat + 0.15*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 8 (Labor constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of bread in total each day.\n// Wheat + Rye + Sourdough >= 50 (Minimum bread production constraint)",
        "question": "A bakery produces three types of bread (wheat, rye, and sourdough) and one type of pastry (cinnamon rolls). The bakery needs to decide how many units of each product to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per unit for wheat bread is $2, for rye bread is $3, for sourdough bread is $4, and for cinnamon rolls is $1.50. The bakery aims to maximize its daily profit. The following table shows the requirements for each product:\n\n| Product         | Flour (kg) | Yeast (kg) | Labor (hours) |\n|-----------------|------------|------------|---------------|\n| Wheat Bread     | 0.5        | 0.1        | 0.1           |\n| Rye Bread       | 0.4        | 0.1        | 0.15          |\n| Sourdough Bread | 0.3        | 0.2        | 0.2           |\n| Cinnamon Rolls  | 0.2        | 0.05       | 0.05          |\n\nThe bakery has a limited amount of flour (200 kg) and yeast (30 kg). The bakery also has a daily labor limit of 8 hours. Additionally, the bakery must produce at least 50 units of bread in total each day.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nCinnamon = model.addVar(vtype=\"INTEGER\", name=\"Cinnamon\", lb=0) # number of cinnamon rolls\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 1.50*Cinnamon)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.2*Cinnamon <= 200)\n## Yeast constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 30)\n## Labor constraint\nmodel.addCons(0.1*Wheat + 0.15*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 8)\n## Minimum bread production constraint\nmodel.addCons(Wheat + Rye + Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of cinnamon rolls: \", model.getVal(Cinnamon))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread (wheat, rye, and sourdough) and one type of pastry (cinnamon rolls). The bakery needs to decide how many units of each product to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of cinnamon rolls\": \"Cinnamon\", \"range\": \"Cinnamon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for wheat bread is $2, for rye bread is $3, for sourdough bread is $4, and for cinnamon rolls is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 1.50*Cinnamon\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and yeast. Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, each rye bread requires 0.4 kg of flour and 0.1 kg of yeast, each sourdough bread requires 0.3 kg of flour and 0.2 kg of yeast, and each cinnamon roll requires 0.2 kg of flour and 0.05 kg of yeast. The total available flour is 200 kg and yeast is 30 kg.\n// 0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.2*Cinnamon <= 200 (Flour constraint)\n// 0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 30 (Yeast constraint)\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each wheat bread takes 0.1 hours to make, each rye bread takes 0.15 hours, each sourdough bread takes 0.2 hours, and each cinnamon roll takes 0.05 hours.\n// 0.1*Wheat + 0.15*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 8 (Labor constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 units of bread in total each day.\n// Wheat + Rye + Sourdough >= 50 (Minimum bread production constraint)",
        "question": "A bakery produces three types of bread (wheat, rye, and sourdough) and one type of pastry (cinnamon rolls). The bakery needs to decide how many units of each product to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per unit for wheat bread is $2, for rye bread is $3, for sourdough bread is $4, and for cinnamon rolls is $1.50. The bakery has a limited amount of flour and yeast. Each wheat bread requires 0.5 kg of flour and 0.1 kg of yeast, each rye bread requires 0.4 kg of flour and 0.1 kg of yeast, each sourdough bread requires 0.3 kg of flour and 0.2 kg of yeast, and each cinnamon roll requires 0.2 kg of flour and 0.05 kg of yeast. The total available flour is 200 kg and yeast is 30 kg. The bakery has a daily labor limit of 8 hours. Each wheat bread takes 0.1 hours to make, each rye bread takes 0.15 hours, each sourdough bread takes 0.2 hours, and each cinnamon roll takes 0.05 hours. The bakery must produce at least 50 units of bread in total each day. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nCinnamon = model.addVar(vtype=\"INTEGER\", name=\"Cinnamon\", lb=0) # number of cinnamon rolls\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 1.50*Cinnamon)\n\n# Add constraints\n## Flour constraint\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.3*Sourdough + 0.2*Cinnamon <= 200)\n## Yeast constraint\nmodel.addCons(0.1*Wheat + 0.1*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 30)\n## Labor constraint\nmodel.addCons(0.1*Wheat + 0.15*Rye + 0.2*Sourdough + 0.05*Cinnamon <= 8)\n## Minimum bread production constraint\nmodel.addCons(Wheat + Rye + Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of cinnamon rolls: \", model.getVal(Cinnamon))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and demand.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"Pas\", \"range\": \"Pas >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per pastry is $0.40. The bakery aims to maximize its daily profit from these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.40*Pas\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and eggs. It has 100 pounds of flour and 50 dozen eggs. Each croissant requires 0.1 pounds of flour and 0.1 dozen eggs, each muffin requires 0.2 pounds of flour and 0.05 dozen eggs, each eclair requires 0.3 pounds of flour and 0.2 dozen eggs, and each pastry requires 0.15 pounds of flour and 0.1 dozen eggs.\n// 0.1*Cro + 0.2*Muf + 0.3*Ecl + 0.15*Pas <= 100\n// 0.1*Cro + 0.05*Muf + 0.2*Ecl + 0.1*Pas <= 50\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, 30 eclairs, and 60 pastries daily to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40\n// Ecl >= 30\n// Pas >= 60\n\n## Generate Constraint-3:\nThe total number of pastries produced should not exceed 200.\n// Cro + Muf + Ecl + Pas <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and demand. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per pastry is $0.40. The bakery has a limited amount of flour and eggs. It has 100 pounds of flour and 50 dozen eggs. Each croissant requires 0.1 pounds of flour and 0.1 dozen eggs, each muffin requires 0.2 pounds of flour and 0.05 dozen eggs, each eclair requires 0.3 pounds of flour and 0.2 dozen eggs, and each pastry requires 0.15 pounds of flour and 0.1 dozen eggs.\n\n| Pastry   | Profit per Unit | Flour Required (pounds) | Eggs Required (dozen) |\n|----------|-----------------|-------------------------|-----------------------|\n| Croissant| $0.50           | 0.1                     | 0.1                   |\n| Muffin   | $0.60           | 0.2                     | 0.05                  |\n| Eclair   | $0.70           | 0.3                     | 0.2                   |\n| Pastry   | $0.40           | 0.15                    | 0.1                   |\n\nThe bakery must produce at least 50 croissants, 40 muffins, 30 eclairs, and 60 pastries daily to meet the minimum demand. The total number of pastries produced should not exceed 200. Please help the bakery to maximize its daily profit from these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nPas = model.addVar(vtype=\"INTEGER\", name=\"Pas\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.40*Pas)\n\n# Add constraints\n## The bakery has a limited amount of flour and eggs.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.3*Ecl + 0.15*Pas <= 100) # flour constraint\nmodel.addCons(0.1*Cro + 0.05*Muf + 0.2*Ecl + 0.1*Pas <= 50) # eggs constraint\n## The bakery must produce at least the minimum demand for each pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Ecl >= 30)\nmodel.addCons(Pas >= 60)\n## The total number of pastries produced should not exceed 200.\nmodel.addCons(Cro + Muf + Ecl + Pas <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of pastries: \", model.getVal(Pas))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1429,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and demand.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Ecl\", \"range\": \"Ecl >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"Pas\", \"range\": \"Pas >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per pastry is $0.40. The bakery aims to maximize its daily profit from these pastries.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.40*Pas\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour and eggs. It has 100 pounds of flour and 50 dozen eggs. Each croissant requires 0.1 pounds of flour and 0.1 dozen eggs, each muffin requires 0.2 pounds of flour and 0.05 dozen eggs, each eclair requires 0.3 pounds of flour and 0.2 dozen eggs, and each pastry requires 0.15 pounds of flour and 0.1 dozen eggs.\n// 0.1*Cro + 0.2*Muf + 0.3*Ecl + 0.15*Pas <= 100\n// 0.1*Cro + 0.05*Muf + 0.2*Ecl + 0.1*Pas <= 50\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 croissants, 40 muffins, 30 eclairs, and 60 pastries daily to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40\n// Ecl >= 30\n// Pas >= 60\n\n## Generate Constraint-3:\nThe total number of pastries produced should not exceed 200.\n// Cro + Muf + Ecl + Pas <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and demand. The profit per croissant is $0.50, per muffin is $0.60, per eclair is $0.70, and per pastry is $0.40. The bakery has a limited amount of flour and eggs, with 100 pounds of flour and 50 dozen eggs. Each croissant requires 0.1 pounds of flour and 0.1 dozen eggs, each muffin requires 0.2 pounds of flour and 0.05 dozen eggs, each eclair requires 0.3 pounds of flour and 0.2 dozen eggs, and each pastry requires 0.15 pounds of flour and 0.1 dozen eggs. The bakery must produce at least 50 croissants, 40 muffins, 30 eclairs, and 60 pastries daily to meet the minimum demand. The total number of pastries produced should not exceed 200. Please help the bakery to maximize its daily profit from these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nEcl = model.addVar(vtype=\"INTEGER\", name=\"Ecl\", lb=0) # number of eclairs\nPas = model.addVar(vtype=\"INTEGER\", name=\"Pas\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.70*Ecl + 0.40*Pas)\n\n# Add constraints\n## The bakery has a limited amount of flour and eggs.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.3*Ecl + 0.15*Pas <= 100) # flour constraint\nmodel.addCons(0.1*Cro + 0.05*Muf + 0.2*Ecl + 0.1*Pas <= 50) # eggs constraint\n## The bakery must produce at least the minimum demand for each pastry.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\nmodel.addCons(Ecl >= 30)\nmodel.addCons(Pas >= 60)\n## The total number of pastries produced should not exceed 200.\nmodel.addCons(Cro + Muf + Ecl + Pas <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of eclairs: \", model.getVal(Ecl))\n    print(\"Number of pastries: \", model.getVal(Pas))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 labor hours. Each loaf of wheat, rye, sourdough, and gluten-free bread requires 0.5, 0.7, 1.0, and 1.5 hours of labor, respectively.\n// 0.5*Wheat + 0.7*Rye + 1.0*Sourdough + 1.5*Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of ingredients: 600 kg of wheat flour, 300 kg of rye flour, 200 kg of sourdough starter, and 100 kg of gluten-free flour. Each loaf of bread requires 0.2 kg of its respective flour.\n// 0.2*Wheat <= 600\n// 0.2*Rye <= 300\n// 0.2*Sourdough <= 200\n// 0.2*Gluten_Free <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Gluten_Free >= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $1.50           |\n| Rye           | $2.00           |\n| Sourdough     | $2.50           |\n| Gluten-Free   | $3.00           |\n\nThe bakery has a daily capacity of 500 labor hours. Each loaf of wheat, rye, sourdough, and gluten-free bread requires 0.5, 0.7, 1.0, and 1.5 hours of labor, respectively. The bakery has a limited daily supply of ingredients: 600 kg of wheat flour, 300 kg of rye flour, 200 kg of sourdough starter, and 100 kg of gluten-free flour. Each loaf of bread requires 0.2 kg of its respective flour. The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily capacity of 500 labor hours.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1.0*Sourdough + 1.5*Gluten_Free <= 500)\n## The bakery has a limited daily supply of ingredients.\nmodel.addCons(0.2*Wheat <= 600)\nmodel.addCons(0.2*Rye <= 300)\nmodel.addCons(0.2*Sourdough <= 200)\nmodel.addCons(0.2*Gluten_Free <= 100)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Gluten_Free >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 labor hours. Each loaf of wheat, rye, sourdough, and gluten-free bread requires 0.5, 0.7, 1.0, and 1.5 hours of labor, respectively.\n// 0.5*Wheat + 0.7*Rye + 1.0*Sourdough + 1.5*Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of ingredients: 600 kg of wheat flour, 300 kg of rye flour, 200 kg of sourdough starter, and 100 kg of gluten-free flour. Each loaf of bread requires 0.2 kg of its respective flour.\n// 0.2*Wheat <= 600\n// 0.2*Rye <= 300\n// 0.2*Sourdough <= 200\n// 0.2*Gluten_Free <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Gluten_Free >= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily capacity of 500 labor hours, with each loaf of wheat, rye, sourdough, and gluten-free bread requiring 0.5, 0.7, 1.0, and 1.5 hours of labor, respectively. The bakery also has a limited daily supply of ingredients: 600 kg of wheat flour, 300 kg of rye flour, 200 kg of sourdough starter, and 100 kg of gluten-free flour, with each loaf of bread requiring 0.2 kg of its respective flour. Additionally, the bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily capacity of 500 labor hours.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1.0*Sourdough + 1.5*Gluten_Free <= 500)\n## The bakery has a limited daily supply of ingredients.\nmodel.addCons(0.2*Wheat <= 600)\nmodel.addCons(0.2*Rye <= 300)\nmodel.addCons(0.2*Sourdough <= 200)\nmodel.addCons(0.2*Gluten_Free <= 100)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Gluten_Free >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. Producing one unit of product A costs $50 in raw materials, product B costs $75, product C costs $100, and product D costs $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space.\n// A + B + C + D <= 500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit and the resource requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Cost per Unit | Storage Space per Unit |\n|---------|-----------------|----------------------|----------------------------|-------------------------|\n| A       | $100            | 2 hours              | $50                        | 1 unit                  |\n| B       | $150            | 3 hours              | $75                        | 1 unit                  |\n| C       | $200            | 4 hours              | $100                       | 1 unit                  |\n| D       | $250            | 5 hours              | $125                       | 1 unit                  |\n\nThe company has a total of 1000 labor hours available and a budget of $50,000 for raw materials. The company also has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space. \n\nPlease help the company to maximize the total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(A + B + C + D <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. Producing one unit of product A costs $50 in raw materials, product B costs $75, product C costs $100, and product D costs $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space.\n// A + B + C + D <= 500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company has a total of 1000 labor hours available, with each unit of product A requiring 2 hours, product B requiring 3 hours, product C requiring 4 hours, and product D requiring 5 hours. The company also has a budget of $50,000 for raw materials, with each unit of product A costing $50, product B costing $75, product C costing $100, and product D costing $125. Additionally, the company has a storage capacity of 500 units, with each unit of product A, B, C, and D occupying 1 unit of storage space.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(A + B + C + D <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. The time required to produce one croissant is 0.5 hours, one muffin is 0.7 hours, one doughnut is 0.6 hours, and one bagel is 0.4 hours.\n// 0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\n// Croissants + Muffins + Doughnuts + Bagels <= 1500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 200 croissants and 300 muffins per day.\n// Croissants >= 200\n// Muffins >= 300",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. The profit per pastry and the time required to produce each pastry are given in the following Table.\n\n| Pastry   | Profit per Pastry | Production Time per Pastry |\n|----------|-------------------|----------------------------|\n| Croissants | $0.50            | 0.5 hours                   |\n| Muffins    | $0.75            | 0.7 hours                   |\n| Doughnuts  | $0.60            | 0.6 hours                   |\n| Bagels     | $0.40            | 0.4 hours                   |\n\nThe bakery has a total of 1000 hours of labor available per day. The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day. The bakery has a contract to supply at least 200 croissants and 300 muffins per day. \nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000)\n## The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\nmodel.addCons(Croissants + Muffins + Doughnuts + Bagels <= 1500)\n## The bakery has a contract to supply at least 200 croissants and 300 muffins per day.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. The time required to produce one croissant is 0.5 hours, one muffin is 0.7 hours, one doughnut is 0.6 hours, and one bagel is 0.4 hours.\n// 0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\n// Croissants + Muffins + Doughnuts + Bagels <= 1500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 200 croissants and 300 muffins per day.\n// Croissants >= 200\n// Muffins >= 300",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. The profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery wants to maximize its daily profit.\nThe bakery has a total of 1000 hours of labor available per day. The time required to produce one croissant is 0.5 hours, one muffin is 0.7 hours, one doughnut is 0.6 hours, and one bagel is 0.4 hours. The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day. The bakery also has a contract to supply at least 200 croissants and 300 muffins per day.\nPlease help the bakery determine the optimal number of each type of pastry to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000)\n## The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\nmodel.addCons(Croissants + Muffins + Doughnuts + Bagels <= 1500)\n## The bakery has a contract to supply at least 200 croissants and 300 muffins per day.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits.\n// {\"monthly production of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"monthly production of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"monthly production of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"monthly production of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company aims to maximize the total monthly profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production of laptops must be at least half the total production of smartphones and tablets combined.\n// Laptops >= 0.5 * (Smartphones + Tablets)\n\n## Generate Constraint-3:\nThe production of smartwatches cannot exceed 20% of the total production.\n// Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches)",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $150            |\n| Laptops      | $200            |\n| Smartwatches | $50             |\n\nThe company has a total production capacity of 5000 units per month. The production of laptops must be at least half the total production of smartphones and tablets combined. The production of smartwatches cannot exceed 20% of the total production.\n\nPlease help the company to maximize the total monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The monthly production of each device\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # monthly production of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # monthly production of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # monthly production of laptops\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0) # monthly production of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The production of laptops must be at least half the total production of smartphones and tablets combined.\nmodel.addCons(Laptops >= 0.5 * (Smartphones + Tablets))\n## The production of smartwatches cannot exceed 20% of the total production.\nmodel.addCons(Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Monthly production of smartphones: \", model.getVal(Smartphones))\n    print(\"Monthly production of tablets: \", model.getVal(Tablets))\n    print(\"Monthly production of laptops: \", model.getVal(Laptops))\n    print(\"Monthly production of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits.\n// {\"monthly production of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"monthly production of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"monthly production of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"monthly production of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company aims to maximize the total monthly profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production of laptops must be at least half the total production of smartphones and tablets combined.\n// Laptops >= 0.5 * (Smartphones + Tablets)\n\n## Generate Constraint-3:\nThe production of smartwatches cannot exceed 20% of the total production.\n// Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches)",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits. The profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company aims to maximize the total monthly profit. The company has a total production capacity of 5000 units per month. The production of laptops must be at least half the total production of smartphones and tablets combined. The production of smartwatches cannot exceed 20% of the total production. Please help the company determine the optimal monthly production quantities for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The monthly production of each device\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # monthly production of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # monthly production of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # monthly production of laptops\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0) # monthly production of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The production of laptops must be at least half the total production of smartphones and tablets combined.\nmodel.addCons(Laptops >= 0.5 * (Smartphones + Tablets))\n## The production of smartwatches cannot exceed 20% of the total production.\nmodel.addCons(Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Monthly production of smartphones: \", model.getVal(Smartphones))\n    print(\"Monthly production of tablets: \", model.getVal(Tablets))\n    print(\"Monthly production of laptops: \", model.getVal(Laptops))\n    print(\"Monthly production of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000\n\n## Generate Constraint-3:\nThe labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit.\nThe company has a budget of $120,000 for labor costs.\n// 10*A + 15*B + 12*C + 8*D <= 120000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit for each product is given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n| D       | $40             |\n\nThe company has a total production capacity of 10,000 units. The raw material cost for producing each product and the company's budget for raw materials are given in the following Table.\n\n| Product | Raw Material Cost per Unit | Company's Raw Material Budget |\n|---------|----------------------------|--------------------------------|\n| A       | $20                        | $250,000                       |\n| B       | $30                        | $250,000                       |\n| C       | $25                        | $250,000                       |\n| D       | $15                        | $250,000                       |\n\nThe labor cost for producing each product and the company's budget for labor costs are given in the following Table.\n\n| Product | Labor Cost per Unit | Company's Labor Budget |\n|---------|---------------------|------------------------|\n| A       | $10                 | $120,000               |\n| B       | $15                 | $120,000               |\n| C       | $12                 | $120,000               |\n| D       | $8                  | $120,000               |\n\nPlease help the company to maximize its total profit while adhering to the constraints of production capacity, raw material budget, and labor budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The company has a budget of $120,000 for labor costs.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1660,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000\n\n## Generate Constraint-3:\nThe labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit.\nThe company has a budget of $120,000 for labor costs.\n// 10*A + 15*B + 12*C + 8*D <= 120000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The company has a total production capacity of 10,000 units and a budget of $250,000 for raw materials. The raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit. Additionally, the company has a budget of $120,000 for labor costs. The labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The company has a budget of $120,000 for labor costs.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries. The bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units. The bakery also has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit.\n\nPlease help the bakery to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required | Sugar Required |\n|----------|-----------------|----------------|----------------|\n| Croissant| $2              | 2 units        | 1 unit         |\n| Muffin   | $3              | 3 units        | 2 units        |\n| Donut    | $2.5            | 2 units        | 1 unit         |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = model.addVar(vtype=\"INTEGER\", name=\"Production_Capacity\", lb=0) # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\nmodel.addCons(Production_Capacity == 200)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n## The bakery has a limited amount of sugar, with 200 units available daily.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries. The bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units. The bakery also has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = model.addVar(vtype=\"INTEGER\", name=\"Production_Capacity\", lb=0) # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\nmodel.addCons(Production_Capacity == 200)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n## The bakery has a limited amount of sugar, with 200 units available daily.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)\n\n## Generate Constraint-3:\nThe bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\n// 100*Croissants + 100*Muffins + 100*Donuts <= 50000 (in cubic centimeters)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The following table shows the ingredient requirements and storage space for each type of pastry.\n\n| Pastry   | Flour (grams) | Sugar (grams) | Storage (cubic cm) |\n|----------|---------------|---------------|---------------------|\n| Croissant| 50            | 20            | 100                 |\n| Muffin   | 75            | 30            | 100                 |\n| Donut    | 100           | 40            | 100                 |\n\nThe bakery has a daily supply of 10 kilograms of flour and 5 kilograms of sugar. The total storage capacity is 50 liters. Please help the bakery to maximize its daily profit from selling pastries while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n## The bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\nmodel.addCons(100*Croissants + 100*Muffins + 100*Donuts <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)\n\n## Generate Constraint-3:\nThe bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\n// 100*Croissants + 100*Muffins + 100*Donuts <= 50000 (in cubic centimeters)",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams, with a daily supply of 10 kilograms of flour. Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams, with a daily supply of 5 kilograms of sugar. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space, and the total storage capacity is 50 liters. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n## The bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\nmodel.addCons(100*Croissants + 100*Muffins + 100*Donuts <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production.\n// {\"number of chocolate cakes to produce\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate >= 20\n// Vanilla >= 15\n// Strawberry >= 10\n\n## Generate Constraint-2:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens.\n// Chocolate + Vanilla + Strawberry <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven rental, which cannot exceed $300 per day.\n// 100*Ovens <= 300",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100.\n\n| Cake Type     | Production Cost |\n|---------------|-----------------|\n| Chocolate     | $5              |\n| Vanilla       | $4              |\n| Strawberry    | $6              |\n\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. Each oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens. The bakery has a limited budget for oven rental, which cannot exceed $300 per day.\n\nPlease help the bakery to minimize the total daily cost of production and oven rental.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes to produce\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes to produce\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate >= 20)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 10)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type.\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 10*Ovens)\n## The bakery has a limited budget for oven rental, which cannot exceed $300 per day.\nmodel.addCons(100*Ovens <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1064,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production.\n// {\"number of chocolate cakes to produce\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate >= 20\n// Vanilla >= 15\n// Strawberry >= 10\n\n## Generate Constraint-2:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens.\n// Chocolate + Vanilla + Strawberry <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery has a limited budget for oven rental, which cannot exceed $300 per day.\n// 100*Ovens <= 300",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to accommodate the production. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery aims to minimize the total daily cost of production and oven rental. The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. Each oven can bake a maximum of 10 cakes per day, regardless of the type. The bakery wants to ensure that it can meet the daily production needs without over-renting ovens. The bakery has a limited budget for oven rental, which cannot exceed $300 per day. Please help the bakery to determine the optimal number of each type of cake to produce and the number of ovens to rent to minimize the total daily cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes to produce\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes to produce\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 6*Strawberry + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate >= 20)\nmodel.addCons(Vanilla >= 15)\nmodel.addCons(Strawberry >= 10)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type.\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 10*Ovens)\n## The bakery has a limited budget for oven rental, which cannot exceed $300 per day.\nmodel.addCons(100*Ovens <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1, Strawberry_Ovens >= 1",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue and cost per cake, as well as the rental cost per oven, are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Oven Rental Cost per Week |\n|------------------|------------------|---------------|---------------------------|\n| Chocolate        | $10              | $4            | $150                      |\n| Vanilla          | $8               | $3            | $150                      |\n| Strawberry       | $9               | $5            | $150                      |\n\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental. The bakery needs to rent at least one oven for each type of cake.\n\nPlease help the bakery to maximize the weekly profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\nmodel.addCons(Strawberry_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1, Strawberry_Ovens >= 1",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. The cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. The rental cost per oven per week is $150. The bakery wants to maximize the weekly profit.\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental. The bakery needs to rent at least one oven for each type of cake.\nPlease help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent for each type of cake to maximize the weekly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\nmodel.addCons(Strawberry_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 500 units. Each croissant requires 1 unit of storage, each muffin requires 1.5 units, and each doughnut requires 1 unit.\n// Croissants + 1.5*Muffins + Doughnuts <= 500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery has a total of 300 kg of flour and 200 kg of sugar available daily. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each doughnut requires 0.15 kg of flour and 0.08 kg of sugar. The bakery also has a storage capacity of 500 units, with each croissant requiring 1 unit of storage, each muffin requiring 1.5 units, and each doughnut requiring 1 unit.\n\nPlease help the bakery to maximize its daily profit while adhering to the constraints of ingredient availability and storage capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n## The bakery has a storage capacity of 500 units.\nmodel.addCons(Croissants + 1.5*Muffins + Doughnuts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 500 units. Each croissant requires 1 unit of storage, each muffin requires 1.5 units, and each doughnut requires 1 unit.\n// Croissants + 1.5*Muffins + Doughnuts <= 500",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery has a total of 300 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, and each doughnut requiring 0.15 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, and each doughnut requiring 0.08 kg. The bakery also has a storage capacity of 500 units, with each croissant requiring 1 unit of storage, each muffin requiring 1.5 units, and each doughnut requiring 1 unit. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n## The bakery has a storage capacity of 500 units.\nmodel.addCons(Croissants + 1.5*Muffins + Doughnuts <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\n// Croissants >= 100, Muffins >= 100, Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. The profit per croissant is $1, per muffin is $1.5, and per donut is $2. The bakery also needs to determine the amount of raw materials (flour, sugar, and eggs) to purchase. The following table shows the requirements for raw materials and labor for each type of pastry.\n\n| Pastry   | Profit per Unit | Raw Materials per Unit | Labor per Unit |\n|----------|-----------------|------------------------|----------------|\n| Croissant| $1              | 0.5 units              | 0.2 hours      |\n| Muffin   | $1.5            | 0.6 units              | 0.3 hours      |\n| Donut    | $2              | 0.8 units              | 0.4 hours      |\n\nThe bakery has a daily limit of 500 units of raw materials and a labor limit of 200 hours. The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand. Please help the bakery to maximize its daily profit, which is defined as the total revenue from selling pastries minus the cost of raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\nTotal_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Total_Revenue - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n## The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of raw materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\n// Croissants >= 100, Muffins >= 100, Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase. The profit per croissant is $1, per muffin is $1.5, and per donut is $2. The bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units. The bakery also has a daily labor limit of 200 hours, with each croissant requiring 0.2 hours of labor, each muffin requiring 0.3 hours, and each donut requiring 0.4 hours. The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand. Please help the bakery to maximize its daily profit, which is defined as the total revenue from selling pastries minus the cost of raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\nTotal_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Total_Revenue - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n## The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of raw materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery wants to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 15\n// Strawberry_Cakes >= 10\n\n## Generate Constraint-2:\nThe bakery has a limited workspace that can accommodate a maximum of 5 ovens.\n// Ovens <= 5\n\n## Generate Constraint-3:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens.\n// Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes <= 10*Ovens",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100.\n\n| Cake Type       | Production Cost |\n|-----------------|-----------------|\n| Chocolate       | 5$              |\n| Vanilla         | 4$              |\n| Strawberry      | 6$              |\n\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. The bakery has a limited workspace that can accommodate a maximum of 5 ovens. Each oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens.\n\nPlease help the bakery to minimize the total daily cost of production and oven rental.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 15)\nmodel.addCons(Strawberry_Cakes >= 10)\n## The bakery has a limited workspace that can accommodate a maximum of 5 ovens.\nmodel.addCons(Ovens <= 5)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes <= 10*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery wants to minimize the total daily cost of production and oven rental.\n// Total_Cost = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens\n// Objective Function: Minimize: Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 15\n// Strawberry_Cakes >= 10\n\n## Generate Constraint-2:\nThe bakery has a limited workspace that can accommodate a maximum of 5 ovens.\n// Ovens <= 5\n\n## Generate Constraint-3:\nEach oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens.\n// Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes <= 10*Ovens",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to meet customer demand while minimizing costs. Additionally, the bakery must decide how many ovens to rent to bake these cakes. The cost of producing a chocolate cake is $5, a vanilla cake is $4, and a strawberry cake is $6. The rental cost for each oven per day is $100. The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes. The bakery has a limited workspace that can accommodate a maximum of 5 ovens. Each oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens. Please help the bakery to minimize the total daily cost of production and oven rental.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of ovens to rent\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes + 6*Strawberry_Cakes + 100*Ovens)\n\n# Add constraints\n## The bakery has a daily demand for at least 20 chocolate cakes, 15 vanilla cakes, and 10 strawberry cakes.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 15)\nmodel.addCons(Strawberry_Cakes >= 10)\n## The bakery has a limited workspace that can accommodate a maximum of 5 ovens.\nmodel.addCons(Ovens <= 5)\n## Each oven can bake a maximum of 10 cakes per day, regardless of the type of cake. The total number of cakes baked should not exceed the capacity of the ovens.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes <= 10*Ovens)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per day\": \"Oven_Usage\", \"range\": \"Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\n// 15*Croissants + 20*Muffins + 30*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100 (flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50 (sugar constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total each day to meet minimum customer demand.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The following table summarizes the requirements for each pastry:\n\n| Pastry   | Oven Time (minutes) | Flour (kg) | Sugar (kg) |\n|----------|---------------------|------------|------------|\n| Croissant| 15                  | 0.1        | 0.05       |\n| Muffin   | 20                  | 0.2        | 0.1        |\n| Donut    | 30                  | 0.3        | 0.15       |\n\nThe bakery has a total daily oven capacity of 480 minutes. It also has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. The bakery must produce at least 50 pastries in total each day to meet minimum customer demand. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Donuts <= 480)\n## The bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100) # flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50) # sugar constraint\n## The bakery must produce at least 50 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per day\": \"Oven_Usage\", \"range\": \"Oven_Usage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\n// 15*Croissants + 20*Muffins + 30*Donuts <= 480\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100 (flour constraint)\n// 0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50 (sugar constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total each day to meet minimum customer demand.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each pastry to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from pastry sales.\nEach croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\nThe bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.3 kg of flour and 0.15 kg of sugar.\nThe bakery must produce at least 50 pastries in total each day to meet minimum customer demand.\nPlease help the bakery determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 15 minutes of oven time, each muffin requires 20 minutes, and each donut requires 30 minutes. The total daily oven capacity is 480 minutes.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Donuts <= 480)\n## The bakery has a limited supply of ingredients: 100 kg of flour and 50 kg of sugar.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 100) # flour constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Donuts <= 50) # sugar constraint\n## The bakery must produce at least 50 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 80 cakes of each type daily.\n// C1 <= 80, C2 <= 80, C3 <= 80, C4 <= 80",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery can only produce a maximum of 80 cakes of each type daily.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| 1         | $5              | 1                   | 0.5                 |\n| 2         | $7              | 2                   | 0.8                 |\n| 3         | $6              | 1.5                 | 0.6                 |\n| 4         | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery can only produce a maximum of 80 cakes of each type daily.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 80)\nmodel.addCons(C3 <= 80)\nmodel.addCons(C4 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 80 cakes of each type daily.\n// C1 <= 80, C2 <= 80, C3 <= 80, C4 <= 80",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery can only produce a maximum of 80 cakes of each type daily. Please help the bakery determine the optimal number of each type of cake to produce to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery can only produce a maximum of 80 cakes of each type daily.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 80)\nmodel.addCons(C3 <= 80)\nmodel.addCons(C4 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// W >= 20\n// R >= 20\n// S >= 20\n// B >= 20",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, with the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit of 150 hours of labor available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. The bakery must also produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|------------|-----------------|-------------------------|-------------------------|\n| Whole Wheat | $2              | 0.5 kg                  | 0.2 hours               |\n| Rye        | $3              | 0.4 kg                  | 0.3 hours               |\n| Sourdough  | $2.5            | 0.3 kg                  | 0.15 hours              |\n| Brioche    | $4              | 0.6 kg                  | 0.4 hours               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// W >= 20\n// R >= 20\n// S >= 20\n// B >= 20",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit of 150 hours of labor available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. The bakery must also produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(B >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\n// W >= 20\n// R >= 20\n// S >= 20\n// G >= 20",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n\n| Bread Type | Profit per Loaf | Cost per Loaf |\n|------------|-----------------|---------------|\n| Wheat      | $0.50           | $0.30         |\n| Rye        | $0.70           | $0.40         |\n| Sourdough  | $0.60           | $0.50         |\n| Whole Grain| $0.80           | $0.60         |\n\nThe bakery has a limited daily budget of $100 for production costs. The bakery has a maximum daily oven capacity of 200 loaves. The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit by determining the optimal daily production quantities for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n## The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(G >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\n// W >= 20\n// R >= 20\n// S >= 20\n// G >= 20",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively. The bakery has a maximum daily oven capacity of 200 loaves. The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations. Please help the bakery determine the optimal daily production quantities for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n## The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(G >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 kg of eggs available daily. Each cake 1 requires 0.3 kg of eggs, cake 2 requires 0.4 kg, cake 3 requires 0.3 kg, and cake 4 requires 0.2 kg.\n// 0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Additionally, the bakery has a total of 100 kg of eggs available daily, with each cake 1 requiring 0.3 kg of eggs, cake 2 requiring 0.4 kg, cake 3 requiring 0.3 kg, and cake 4 requiring 0.2 kg. The bakery's production of each type of cake is limited to a maximum of 100 units per day.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize the total profit, given the constraints on flour, sugar, and eggs.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Eggs Required (kg) |\n|-----------|-----------------|---------------------|---------------------|--------------------|\n| 1         | $5              | 1                   | 0.5                 | 0.3                |\n| 2         | $7              | 2                   | 0.7                 | 0.4                |\n| 3         | $6              | 1.5                 | 0.6                 | 0.3                |\n| 4         | $4              | 1                   | 0.5                 | 0.2                |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a total of 100 kg of eggs available daily.\nmodel.addCons(0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1645,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 kg of eggs available daily. Each cake 1 requires 0.3 kg of eggs, cake 2 requires 0.4 kg, cake 3 requires 0.3 kg, and cake 4 requires 0.2 kg.\n// 0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Additionally, the bakery has a total of 100 kg of eggs available daily, with each cake 1 requiring 0.3 kg of eggs, cake 2 requiring 0.4 kg, cake 3 requiring 0.3 kg, and cake 4 requiring 0.2 kg. Please help the bakery determine the optimal number of each type of cake to produce to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a total of 100 kg of eggs available daily.\nmodel.addCons(0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for each cake type is 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for each cake type is 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum number of each cake type that can be sold is 80 for Cake 1, 70 for Cake 2, 90 for Cake 3, and 60 for Cake 4.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 90\n// C4 <= 60",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The amount of flour and sugar required for each cake type, as well as the available daily quantities of these ingredients, are given in the following Table.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| Cake 1    | $5              | 1                   | 0.5                 |\n| Cake 2    | $7              | 2                   | 0.7                 |\n| Cake 3    | $6              | 1.5                 | 0.6                 |\n| Cake 4    | $4              | 1                   | 0.5                 |\n\nThe bakery has a total of 200 kg of flour and 150 kg of sugar available daily. Additionally, there are demand limits for each cake type: the maximum number of each cake type that can be sold is 80 for Cake 1, 70 for Cake 2, 90 for Cake 3, and 60 for Cake 4. \n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize the total profit, while adhering to the constraints on ingredient availability and demand limits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 90)\nmodel.addCons(C4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. The amount of flour required for each cake type is 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. The amount of sugar required for each cake type is 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum number of each cake type that can be sold is 80 for Cake 1, 70 for Cake 2, 90 for Cake 3, and 60 for Cake 4.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 90\n// C4 <= 60",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake type requiring 1 kg for Cake 1, 2 kg for Cake 2, 1.5 kg for Cake 3, and 1 kg for Cake 4. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake type requiring 0.5 kg for Cake 1, 0.7 kg for Cake 2, 0.6 kg for Cake 3, and 0.5 kg for Cake 4. The bakery also has a demand limit for each cake type, with a maximum number of each cake type that can be sold being 80 for Cake 1, 70 for Cake 2, 90 for Cake 3, and 60 for Cake 4. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 90)\nmodel.addCons(C4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\n// B1 >= 20\n// B2 >= 30",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively. The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\n\nPlease help the bakery to maximize its total profit by determining the optimal amount of each type of bread to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n## Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 708,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\n// B1 >= 20\n// B2 >= 30",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively, and the bakery has 50 kg of flour available. The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2. Please help the bakery to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n## Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 554,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery also has a demand limit for each cake type, with the maximum daily demand for cakes 1-4 being 80, 70, 60, and 90 respectively.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit, given the constraints on flour, sugar, and demand.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Maximum Daily Demand |\n|-----------|-----------------|---------------------|---------------------|----------------------|\n| 1         | $5              | 1                   | 0.5                 | 80                   |\n| 2         | $7              | 2                   | 0.7                 | 70                   |\n| 3         | $6              | 1.5                 | 0.6                 | 60                   |\n| 4         | $4              | 1                   | 0.5                 | 90                   |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1511,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\nThe bakery also has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\nAdditionally, the bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nProduct A and Product B cannot be launched together due to market overlap.\n// P1 + P2 <= 1",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit and production cost for each product are given in the following Table.\n\n| Product | Expected Profit | Production Cost |\n|---------|-----------------|-----------------|\n| A       | $20,000         | $6,000          |\n| B       | $30,000         | $8,000          |\n| C       | $15,000         | $5,000          |\n| D       | $25,000         | $7,000          |\n\nThe company has a budget of $18,000 for launching new products. The company can only allocate resources to at most two products due to limited marketing capabilities. Additionally, Product A and Product B cannot be launched together due to market overlap. \n\nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## Product A and Product B cannot be launched together due to market overlap.\nmodel.addCons(P1 + P2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nProduct A and Product B cannot be launched together due to market overlap.\n// P1 + P2 <= 1",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products. The company can only allocate resources to at most two products due to limited marketing capabilities. Product A and Product B cannot be launched together due to market overlap. Please help the company to maximize the total expected profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"BINARY\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"BINARY\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"BINARY\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"BINARY\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## Product A and Product B cannot be launched together due to market overlap.\nmodel.addCons(P1 + P2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 626,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\n// Vanilla >= 10\n// Strawberry >= 15",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for each type is given in the following Table.\n\n| Cake Type    | Profit per Cake |\n|--------------|-----------------|\n| Chocolate    | $5              |\n| Vanilla      | $4              |\n| Strawberry   | $3              |\n| Carrot       | $6              |\n\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily. The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n## The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\nmodel.addCons(Vanilla >= 10)\nmodel.addCons(Strawberry >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\n// Vanilla >= 10\n// Strawberry >= 15",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit. The bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily. The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand. Please help the bakery determine the optimal number of each type of cake to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n## The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\nmodel.addCons(Vanilla >= 10)\nmodel.addCons(Strawberry >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 500\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\n// 0.2*Whole_Wheat + 0.3*Rye <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 whole wheat breads and 50 rye breads.\n// Whole_Wheat >= 100\n// Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type       | Profit per Bread | Flour Requirement (kg) | Labor Hours Required |\n|------------------|------------------|------------------------|----------------------|\n| Whole Wheat      | $2               | 0.5                    | 0.2                  |\n| Rye              | $3               | 0.4                    | 0.3                  |\n\nThe bakery has a daily supply of 500 kg of flour and 100 labor hours available. The bakery also has a minimum daily demand of 100 whole wheat breads and 50 rye breads. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 500 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 500)\n## The bakery has 100 labor hours available daily.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 100)\n## The bakery has a minimum daily demand of 100 whole wheat breads and 50 rye breads.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 500\n\n## Generate Constraint-2:\nThe bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor.\n// 0.2*Whole_Wheat + 0.3*Rye <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 whole wheat breads and 50 rye breads.\n// Whole_Wheat >= 100\n// Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 500 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 100 labor hours available daily. Each whole wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a minimum daily demand of 100 whole wheat breads and 50 rye breads. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 500 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 500)\n## The bakery has 100 labor hours available daily.\nmodel.addCons(0.2*Whole_Wheat + 0.3*Rye <= 100)\n## The bakery has a minimum daily demand of 100 whole wheat breads and 50 rye breads.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 200 pastries.\n// Croissants + Muffins <= 200",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The following table summarizes the cost and labor requirements for each type of pastry.\n\n| Pastry   | Profit per Unit | Cost per Unit | Labor per Unit |\n|----------|-----------------|---------------|----------------|\n| Croissant| $2              | $0.50         | 0.1 hours      |\n| Muffin   | $3              | $0.75         | 0.2 hours      |\n\nThe bakery has a daily budget of $100 for ingredients. The bakery has a daily labor limit of 8 hours. The bakery also has a storage capacity limit of 200 pastries. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a storage capacity limit of 200 pastries.\nmodel.addCons(Croissants + Muffins <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 200 pastries.\n// Croissants + Muffins <= 200",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients. The bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery also has a storage capacity limit of 200 pastries. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a storage capacity limit of 200 pastries.\nmodel.addCons(Croissants + Muffins <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 714,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 loaves of bread.\n// Wheat_Loaves + Rye_Loaves >= 100",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Labor Hours Required |\n|------------|-----------------|------------------------|----------------------|\n| Wheat      | $2              | 0.5                    | 0.2                  |\n| Rye        | $3              | 0.6                    | 0.3                  |\n\nThe bakery has 200 kg of flour available daily. The bakery has 100 hours of labor available daily. The bakery has a minimum daily demand of 100 loaves of bread. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n## The bakery has a minimum daily demand of 100 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 loaves of bread.\n// Wheat_Loaves + Rye_Loaves >= 100",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has 200 kg of flour available daily, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.6 kg of flour. The bakery also has 100 hours of labor available daily, with each loaf of wheat bread requiring 0.2 hours of labor and each loaf of rye bread requiring 0.3 hours of labor. Additionally, the bakery has a minimum daily demand of 100 loaves of bread. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n## The bakery has a minimum daily demand of 100 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 50 breads.\n// Whole_Wheat + Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor. The bakery has a minimum daily demand of 50 breads. Please help the bakery to maximize the total daily profit.\n\n| Bread Type | Profit per Bread | Flour Required (kg) | Labor Time (minutes) |\n|------------|------------------|---------------------|----------------------|\n| Whole Wheat | $2 | 0.5 | 15 |\n| Rye | $3 | 0.4 | 20 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n## The bakery has a minimum daily demand of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 50 breads.\n// Whole_Wheat + Rye >= 50",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor. The bakery has a minimum daily demand of 50 breads. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n## The bakery has a minimum daily demand of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations.\n// Wheat_Bread >= 100, Rye_Bread >= 50",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour per Loaf | Labor Hours per Loaf |\n|------------|-----------------|----------------|----------------------|\n| Wheat      | $2              | 1 pound        | 0.5 hours            |\n| Rye        | $3              | 1.5 pounds     | 0.75 hours           |\n\nThe bakery has a daily supply of 500 pounds of flour. The bakery has a daily limit of 300 labor hours. The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations. Please help the bakery to maximize the total daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n## The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations.\n// Wheat_Bread >= 100, Rye_Bread >= 50",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has a daily supply of 500 pounds of flour, where each loaf of wheat bread requires 1 pound of flour and each loaf of rye bread requires 1.5 pounds of flour. The bakery also has a daily limit of 300 labor hours, with each loaf of wheat bread requiring 0.5 hours of labor and each loaf of rye bread requiring 0.75 hours of labor. Additionally, the bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations. Please help the bakery maximize the total daily profit from selling both types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n## The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations.\n// {\"daily production quantity of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requires 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively.\n// 0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for raw materials per day. The cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain is $1, $1.2, $1.5, and $1.1, respectively.\n// Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of each type of bread to meet contractual obligations.\n// Whole_Wheat >= 200\n// Rye >= 200\n// Sourdough >= 200\n// Multigrain >= 200",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations. The profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit.\n\n| Bread Type       | Profit per Loaf | Labor Hours per Loaf | Raw Material Cost per Loaf |\n|------------------|-----------------|----------------------|----------------------------|\n| Whole Wheat      | $2              | 0.5                  | $1                         |\n| Rye              | $2.5            | 0.4                  | $1.2                       |\n| Sourdough        | $3              | 0.6                  | $1.5                       |\n| Multigrain       | $2.2            | 0.5                  | $1.1                       |\n\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requires 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively. The bakery has a budget of $2000 for raw materials per day. The cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain is $1, $1.2, $1.5, and $1.1, respectively. The bakery must produce at least 200 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to determine the optimal daily production quantity for each type of bread to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # daily production quantity of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000)\n## The bakery has a budget of $2000 for raw materials per day.\nmodel.addCons(Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000)\n## The bakery must produce at least 200 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Whole_Wheat >= 200)\nmodel.addCons(Rye >= 200)\nmodel.addCons(Sourdough >= 200)\nmodel.addCons(Multigrain >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1511,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations.\n// {\"daily production quantity of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Multigrain requires 0.5, 0.4, 0.6, and 0.5 hours of labor, respectively.\n// 0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for raw materials per day. The cost of raw materials for each loaf of Whole Wheat, Rye, Sourdough, and Multigrain is $1, $1.2, $1.5, and $1.1, respectively.\n// Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of each type of bread to meet contractual obligations.\n// Whole_Wheat >= 200\n// Rye >= 200\n// Sourdough >= 200\n// Multigrain >= 200",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its operations. The profit per loaf for Whole Wheat is $2, for Rye is $2.5, for Sourdough is $3, and for Multigrain is $2.2. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 hours of labor available per day, with each loaf requiring 0.5 hours for Whole Wheat, 0.4 hours for Rye, 0.6 hours for Sourdough, and 0.5 hours for Multigrain. The bakery also has a budget of $2000 for raw materials per day, with costs of $1 for Whole Wheat, $1.2 for Rye, $1.5 for Sourdough, and $1.1 for Multigrain. Additionally, the bakery must produce at least 200 loaves of each type of bread to meet contractual obligations. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # daily production quantity of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye + 0.6*Sourdough + 0.5*Multigrain <= 1000)\n## The bakery has a budget of $2000 for raw materials per day.\nmodel.addCons(Whole_Wheat + 1.2*Rye + 1.5*Sourdough + 1.1*Multigrain <= 2000)\n## The bakery must produce at least 200 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Whole_Wheat >= 200)\nmodel.addCons(Rye >= 200)\nmodel.addCons(Sourdough >= 200)\nmodel.addCons(Multigrain >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000\n\n## Generate Constraint-3:\nThe demand for laptops must be met, with at least 200 laptops produced.\n// Laptops >= 200",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources. The cost and revenue for each device are given in the following Table.\n\n| Device       | Production Cost | Selling Price |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $200          |\n| Tablets      | $150            | $300          |\n| Laptops      | $300            | $500          |\n| Smartwatches | $50             | $100          |\n\nThe manufacturer has a production capacity of 1000 units. The budget for production is $200,000. The demand for laptops must be met, with at least 200 laptops produced. \nPlease help the manufacturer to maximize the total profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == (200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches) - (100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches))\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches <= 200000)\n## The demand for laptops must be met, with at least 200 laptops produced.\nmodel.addCons(Laptops >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000\n\n## Generate Constraint-3:\nThe demand for laptops must be met, with at least 200 laptops produced.\n// Laptops >= 200",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\nThe manufacturer has a production capacity of 1000 units. The budget for production is $200,000. The demand for laptops must be met, with at least 200 laptops produced.\nPlease help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == (200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches) - (100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches))\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches <= 200000)\n## The demand for laptops must be met, with at least 200 laptops produced.\nmodel.addCons(Laptops >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80\n\n## Generate Constraint-3:\nEach cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\n// 0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The following table shows the ingredients required for each type of cake:\n\n| Cake Type       | Sugar (cups) | Eggs | Labor (hours) |\n|-----------------|--------------|------|---------------|\n| Chocolate       | 2            | 3    | 0.5           |\n| Vanilla         | 1            | 2    | 0.5           |\n| Strawberry      | 1            | 2    | 0.5           |\n\nThe bakery has 100 cups of sugar and 80 eggs available daily. The bakery also has 20 hours of labor available daily. Each cake requires 0.5 hours of labor. Please help the bakery to maximize its daily profit by determining the optimal number of each type of cake to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n## Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80\n\n## Generate Constraint-3:\nEach cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\n// 0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily. Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily. Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n## Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs >= 20",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit and cost per pastry, as well as the baking time and chocolate requirements, are given in the following Table.\n\n| Pastry   | Profit per Unit | Cost per Unit | Baking Time per Unit | Chocolate Required per Unit |\n|----------|-----------------|---------------|----------------------|----------------------------|\n| Croissant| $0.50           | $0.20         | 0.1 hours            | -                          |\n| Muffin   | $0.75           | $0.30         | 0.2 hours            | 20 grams                   |\n| Eclair   | $1.20           | $0.50         | 0.3 hours            | 50 grams                   |\n\nThe bakery has a total of 8 hours available for baking each day. The daily supply of chocolate is 400 grams. The bakery has a minimum daily production requirement for each type of pastry: it must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1231,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs >= 20",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day. The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams. The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-3:\nThe bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The following table summarizes the requirements for each pastry type:\n\n| Pastry   | Oven Time (hours) | Flour (kg) | Sugar (kg) |\n|----------|-------------------|------------|------------|\n| Croissant| 0.1               | 0.1        | 0.05       |\n| Muffin   | 0.2               | 0.2        | 0.1        |\n| Donut    | 0.15              | 0.15       | 0.08       |\n\nThe bakery has a total of 8 hours of oven time available daily and 10 kg of flour. Additionally, the bakery has 5 kg of sugar available daily. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## The bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## The bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-3:\nThe bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours, with a total of 8 hours of oven time available daily. The bakery has 10 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, and each donut requiring 0.15 kg. Additionally, the bakery has 5 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, and each donut requiring 0.08 kg. Please help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## The bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## The bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"quantity of wheat bread\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"quantity of any bread\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n// The total quantity of bread produced should not exceed the bakery's capacity: x1 + x2 + x3 + x4 <= 1000\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand.\n// x1 >= 100\n// x2 >= 100\n// x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event.\n// x4 >= 200\n\n## Generate Constraint-4:\nThe bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread.\n// x1 <= 300",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg. The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand. Additionally, the bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event. The bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread. The total quantity of bread produced should not exceed the bakery's capacity of 1000 loaves.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Flour Usage per Loaf |\n|---------------|-----------------|----------------------|\n| Wheat         | $1.50           | 0.5 kg               |\n| Rye           | $2.00           | 0.6 kg               |\n| Sourdough     | $2.50           | 0.7 kg               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of any bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4)\n\n# Add constraints\n## The total quantity of bread produced should not exceed the bakery's capacity\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The total daily flour usage should not exceed 500 kg\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 100)\nmodel.addCons(x3 >= 100)\n## The bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event\nmodel.addCons(x4 >= 200)\n## The bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread\nmodel.addCons(x1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(x1))\n    print(\"Quantity of rye bread: \", model.getVal(x2))\n    print(\"Quantity of sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of any bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1386,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"quantity of wheat bread\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"quantity of any bread\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n// The total quantity of bread produced should not exceed the bakery's capacity: x1 + x2 + x3 + x4 <= 1000\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. Wheat bread requires 0.5 kg of flour per loaf, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg. The total daily flour usage should not exceed 500 kg.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand.\n// x1 >= 100\n// x2 >= 100\n// x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event.\n// x4 >= 200\n\n## Generate Constraint-4:\nThe bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread.\n// x1 <= 300",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a limited amount of flour available each day, with wheat bread requiring 0.5 kg of flour per loaf, rye bread requiring 0.6 kg, and sourdough bread requiring 0.7 kg, and the total daily flour usage should not exceed 500 kg. The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand. Additionally, the bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event. The bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread. The total quantity of bread produced should not exceed the bakery's capacity of 1000 loaves. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # quantity of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # quantity of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # quantity of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # quantity of any bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 0*x4)\n\n# Add constraints\n## The total quantity of bread produced should not exceed the bakery's capacity\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The total daily flour usage should not exceed 500 kg\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0*x4 <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet the minimum customer demand\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 100)\nmodel.addCons(x3 >= 100)\n## The bakery has a contractual obligation to produce at least 200 loaves of any type of bread for a local event\nmodel.addCons(x4 >= 200)\n## The bakery should not produce more than 300 loaves of wheat bread due to limited oven space dedicated to this type of bread\nmodel.addCons(x1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(x1))\n    print(\"Quantity of rye bread: \", model.getVal(x2))\n    print(\"Quantity of sourdough bread: \", model.getVal(x3))\n    print(\"Quantity of any bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300\n\n## Generate Constraint-4:\nTo maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves.\n// x4 >= 0.1 * (x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Specialty. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $3              |\n| Rye            | $4              |\n| Sourdough      | $5              |\n| Specialty      | $6              |\n\nThe bakery has a total oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. To maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n## To maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves.\nmodel.addCons(x4 >= 0.1 * (x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300\n\n## Generate Constraint-4:\nTo maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves.\n// x4 >= 0.1 * (x3 + x4)",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough, as well as Specialty bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery has a total oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. To maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n## To maintain variety and customer satisfaction, the bakery must ensure that the number of Specialty loaves is at least 10% of the total number of Sourdough and Specialty loaves.\nmodel.addCons(x4 >= 0.1 * (x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 200 loaves per day.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2.\n// x2 >= 0.25 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven space and can bake a maximum of 200 loaves per day. The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement. Additionally, the bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n\n| Bread Type | Profit per Loaf | Labor Time per Loaf |\n|------------|-----------------|---------------------|\n| Bread 1    | $1.50           | 0.5 hours           |\n| Bread 2    | $2.00           | 0.7 hours           |\n| Bread 3    | $1.75           | 0.6 hours           |\n| Bread 4    | $1.80           | 0.8 hours           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space and can bake a maximum of 200 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\nmodel.addCons(x1 >= 50)\n## The bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2.\nmodel.addCons(x2 >= 0.25 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 200 loaves per day.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2.\n// x2 >= 0.25 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven space and can bake a maximum of 200 loaves per day. The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement. Additionally, the bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2. Please help the bakery maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space and can bake a maximum of 200 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 per day to meet a contract requirement.\nmodel.addCons(x1 >= 50)\n## The bakery has a promotional goal to ensure that at least 25% of the total bread produced is Bread 2.\nmodel.addCons(x2 >= 0.25 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"y1\", \"range\": \"y1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"y2\", \"range\": \"y2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"y3\", \"range\": \"y3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"y4\", \"range\": \"y4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $150 for ingredients. Each loaf of Bread 1-4 costs $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively.\n// 0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\n// y1 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of loaves produced daily does not exceed 200 to maintain quality.\n// y1 + y2 + y3 + y4 <= 200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Labor Time per Loaf | Ingredient Cost per Loaf |\n|------------|-----------------|---------------------|--------------------------|\n| Bread 1    | $1.50           | 0.5 hours           | $0.80                    |\n| Bread 2    | $2.00           | 0.7 hours           | $1.00                    |\n| Bread 3    | $1.75           | 0.6 hours           | $0.90                    |\n| Bread 4    | $1.60           | 0.8 hours           | $0.95                    |\n\nThe bakery has a total of 100 hours of labor available daily. The bakery has a daily budget of $150 for ingredients. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement. The bakery wants to ensure that the total number of loaves produced daily does not exceed 200 to maintain quality.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\ny1 = model.addVar(vtype=\"INTEGER\", name=\"y1\", lb=0) # number of Bread 1 produced daily\ny2 = model.addVar(vtype=\"INTEGER\", name=\"y2\", lb=0) # number of Bread 2 produced daily\ny3 = model.addVar(vtype=\"INTEGER\", name=\"y3\", lb=0) # number of Bread 3 produced daily\ny4 = model.addVar(vtype=\"INTEGER\", name=\"y4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100)\n## The bakery has a daily budget of $150 for ingredients.\nmodel.addCons(0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150)\n## The bakery must produce at least 50 loaves of Bread 1 daily.\nmodel.addCons(y1 >= 50)\n## The bakery wants to ensure that the total number of loaves produced daily does not exceed 200.\nmodel.addCons(y1 + y2 + y3 + y4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(y1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(y2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(y3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(y4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"y1\", \"range\": \"y1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"y2\", \"range\": \"y2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"y3\", \"range\": \"y3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"y4\", \"range\": \"y4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $150 for ingredients. Each loaf of Bread 1-4 costs $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively.\n// 0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement.\n// y1 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of loaves produced daily does not exceed 200 to maintain quality.\n// y1 + y2 + y3 + y4 <= 200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize their profit. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.60, respectively. The bakery has a total of 100 hours of labor available daily, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery also has a daily budget of $150 for ingredients, with each loaf of Bread 1-4 costing $0.80, $1.00, $0.90, and $0.95 for ingredients, respectively. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract requirement. Additionally, the bakery wants to ensure that the total number of loaves produced daily does not exceed 200 to maintain quality. Please help the bakery maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\ny1 = model.addVar(vtype=\"INTEGER\", name=\"y1\", lb=0) # number of Bread 1 produced daily\ny2 = model.addVar(vtype=\"INTEGER\", name=\"y2\", lb=0) # number of Bread 2 produced daily\ny3 = model.addVar(vtype=\"INTEGER\", name=\"y3\", lb=0) # number of Bread 3 produced daily\ny4 = model.addVar(vtype=\"INTEGER\", name=\"y4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*y1 + 2.00*y2 + 1.75*y3 + 1.60*y4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.5*y1 + 0.7*y2 + 0.6*y3 + 0.8*y4 <= 100)\n## The bakery has a daily budget of $150 for ingredients.\nmodel.addCons(0.80*y1 + 1.00*y2 + 0.90*y3 + 0.95*y4 <= 150)\n## The bakery must produce at least 50 loaves of Bread 1 daily.\nmodel.addCons(y1 >= 50)\n## The bakery wants to ensure that the total number of loaves produced daily does not exceed 200.\nmodel.addCons(y1 + y2 + y3 + y4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(y1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(y2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(y3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(y4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery aims to minimize the total production cost per day.\n// Minimize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\n// x2 + x3 <= 500\n\n## Generate Constraint-4:\nThe bakery has a demand for at least 150 loaves of Bread 4.\n// x4 >= 150",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing each type of bread is given in the following Table.\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations. The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves. The bakery has a demand for at least 150 loaves of Bread 4.\n\nPlease help the bakery to minimize the total production cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\nmodel.addCons(x2 + x3 <= 500)\n## The bakery has a demand for at least 150 loaves of Bread 4.\nmodel.addCons(x4 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(x4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery aims to minimize the total production cost per day.\n// Minimize: 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\n// x2 + x3 <= 500\n\n## Generate Constraint-4:\nThe bakery has a demand for at least 150 loaves of Bread 4.\n// x4 >= 150",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations. The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves. The bakery has a demand for at least 150 loaves of Bread 4. Please help the bakery to minimize the total production cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*x1 + 0.75*x2 + 0.60*x3 + 0.80*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread 1 to meet contractual obligations.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the total production of Bread 2 and Bread 3 does not exceed 500 loaves.\nmodel.addCons(x2 + x3 <= 500)\n## The bakery has a demand for at least 150 loaves of Bread 4.\nmodel.addCons(x4 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(x4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 661,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe cake should contain at least 10% eggs by weight.\n// x3 >= 0.1 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of each ingredient is given in the following Table.\n\n| Ingredient | Cost per Unit | Unit |\n|------------|---------------|------|\n| Flour      | $0.05/gram    | gram |\n| Sugar      | $0.03/gram    | gram |\n| Eggs       | $0.10/unit    | unit |\n| Butter     | $0.08/gram    | gram |\n\nThe bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight. The cake should contain no more than 20% sugar by weight. The cake should contain at least 10% eggs by weight.\n\nPlease help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) to use in the cake recipe.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n## The cake should contain at least 10% eggs by weight.\nmodel.addCons(x3 >= 0.1 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1))\n    print(\"Amount of sugar: \", model.getVal(x2))\n    print(\"Amount of eggs: \", model.getVal(x3))\n    print(\"Amount of butter: \", model.getVal(x4))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe cake should contain at least 10% eggs by weight.\n// x3 >= 0.1 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe using four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight, no more than 20% sugar by weight, and at least 10% eggs by weight. Please help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) within the specified ranges.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n## The cake should contain at least 10% eggs by weight.\nmodel.addCons(x3 >= 0.1 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1))\n    print(\"Amount of sugar: \", model.getVal(x2))\n    print(\"Amount of eggs: \", model.getVal(x3))\n    print(\"Amount of butter: \", model.getVal(x4))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"b4\", \"range\": \"0 <= b4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total production cost per day.\n// Minimize: 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// b1 + b2 + b3 + b4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\n// b1 >= 100\n// b2 >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\n// b3 + b4 <= 600\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced.\n// b4 <= 2*b1",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing each type of bread is given in the following Table.\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations. The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined. The bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced.\n\nPlease help the bakery to minimize the total production cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of Bread 1 produced daily\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of Bread 2 produced daily\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of Bread 3 produced daily\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 1000)\n## The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\nmodel.addCons(b1 >= 100)\nmodel.addCons(b2 >= 200)\n## The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\nmodel.addCons(b3 + b4 <= 600)\n## The bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced.\nmodel.addCons(b4 <= 2*b1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(b1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(b2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(b3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(b4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 957,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"b1\", \"range\": \"0 <= b1\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"b2\", \"range\": \"0 <= b2\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"b3\", \"range\": \"0 <= b3\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"b4\", \"range\": \"0 <= b4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total production cost per day.\n// Minimize: 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// b1 + b2 + b3 + b4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\n// b1 >= 100\n// b2 >= 200\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\n// b3 + b4 <= 600\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced.\n// b4 <= 2*b1",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while minimizing costs. The bakery needs to determine the optimal number of each type of bread to produce daily. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery has a daily production capacity of 1000 loaves. The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations. The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined. The bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced. Please help the bakery to minimize the total production cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of Bread 1 produced daily\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of Bread 2 produced daily\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of Bread 3 produced daily\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*b1 + 0.75*b2 + 0.60*b3 + 0.80*b4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 1000)\n## The bakery must produce at least 100 loaves of Bread 1 and 200 loaves of Bread 2 to meet contractual obligations.\nmodel.addCons(b1 >= 100)\nmodel.addCons(b2 >= 200)\n## The bakery has a limited oven space, which can only handle up to 600 loaves of Bread 3 and 4 combined.\nmodel.addCons(b3 + b4 <= 600)\n## The bakery aims to maintain a balanced product mix, requiring that the number of Bread 4 produced should not exceed twice the number of Bread 1 produced.\nmodel.addCons(b4 <= 2*b1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(b1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(b2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(b3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(b4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety.\n// x4 >= 0.25 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Specialty. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $3              |\n| Rye            | $4              |\n| Sourdough      | $5              |\n| Specialty      | $6              |\n\nThe bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. The bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n## The bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety.\nmodel.addCons(x4 >= 0.25 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"integer\"}\n// {\"number of Specialty loaves\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\n// x1 >= 200\n// x2 >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\n// x3 + x4 <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety.\n// x4 >= 0.25 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough, as well as Specialty bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Specialty bread is $3, $4, $5, and $6, respectively. The bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations. The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types. The bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Specialty loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 Whole Wheat loaves and 150 Rye loaves daily to meet contractual obligations.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\n## The bakery has a limited supply of a special ingredient used in Sourdough and Specialty breads, which allows for a maximum of 300 loaves combined of these two types.\nmodel.addCons(x3 + x4 <= 300)\n## The bakery wants to ensure that at least 25% of the total bread production is Specialty bread to maintain its reputation for quality and variety.\nmodel.addCons(x4 >= 0.25 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Specialty loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"amount of Bread A produced\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"continuous\"}\n// {\"amount of Bread B produced\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"continuous\"}\n// {\"amount of Bread C produced\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"continuous\"}\n// {\"amount of Bread D produced\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively.\n// x1 + 1.5*x2 + x3 + 2*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\n// x2 >= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves.\n// x3 + x4 <= 400",
        "question": "A bakery wants to optimize the production of four types of bread (Bread A, Bread B, Bread C, and Bread D) to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf and the amount of flour required for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf |\n|------------|-----------------|-------------------------|\n| Bread A    | $1.50           | 1 pound                 |\n| Bread B    | $2.00           | 1.5 pounds              |\n| Bread C    | $1.75           | 1 pound                 |\n| Bread D    | $1.80           | 2 pounds                |\n\nThe bakery has a daily limit of 1000 pounds of flour. The bakery must produce at least 200 loaves of Bread A to meet a contract obligation. The bakery has a daily demand for Bread B that must be met, which is at least 300 loaves. The bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread produced\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # amount of Bread A produced\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # amount of Bread B produced\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # amount of Bread C produced\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # amount of Bread D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily limit of 1000 pounds of flour.\nmodel.addCons(x1 + 1.5*x2 + x3 + 2*x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread A.\nmodel.addCons(x1 >= 200)\n## The bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\nmodel.addCons(x2 >= 300)\n## The bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves.\nmodel.addCons(x3 + x4 <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread A produced: \", model.getVal(x1))\n    print(\"Amount of Bread B produced: \", model.getVal(x2))\n    print(\"Amount of Bread C produced: \", model.getVal(x3))\n    print(\"Amount of Bread D produced: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"amount of Bread A produced\": \"x1\", \"range\": \"0 <= x1\", \"type\": \"continuous\"}\n// {\"amount of Bread B produced\": \"x2\", \"range\": \"0 <= x2\", \"type\": \"continuous\"}\n// {\"amount of Bread C produced\": \"x3\", \"range\": \"0 <= x3\", \"type\": \"continuous\"}\n// {\"amount of Bread D produced\": \"x4\", \"range\": \"0 <= x4\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 1000 pounds of flour. Each loaf of Bread A, Bread B, Bread C, and Bread D requires 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively.\n// x1 + 1.5*x2 + x3 + 2*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 200 loaves of Bread A to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-3:\nThe bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\n// x2 >= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves.\n// x3 + x4 <= 400",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one additional type of bread (Bread D) to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf of Bread A, Bread B, Bread C, and Bread D is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a daily limit of 1000 pounds of flour, with each loaf of Bread A, Bread B, Bread C, and Bread D requiring 1 pound, 1.5 pounds, 1 pound, and 2 pounds of flour, respectively. The bakery must produce at least 200 loaves of Bread A to meet a contract obligation and at least 300 loaves of Bread B to meet daily demand. Additionally, the bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread produced\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # amount of Bread A produced\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # amount of Bread B produced\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # amount of Bread C produced\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # amount of Bread D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily limit of 1000 pounds of flour.\nmodel.addCons(x1 + 1.5*x2 + x3 + 2*x4 <= 1000)\n## The bakery must produce at least 200 loaves of Bread A.\nmodel.addCons(x1 >= 200)\n## The bakery has a daily demand for Bread B that must be met, which is at least 300 loaves.\nmodel.addCons(x2 >= 300)\n## The bakery wants to ensure that the total production of Bread C and Bread D combined does not exceed 400 loaves.\nmodel.addCons(x3 + x4 <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread A produced: \", model.getVal(x1))\n    print(\"Amount of Bread B produced: \", model.getVal(x2))\n    print(\"Amount of Bread C produced: \", model.getVal(x3))\n    print(\"Amount of Bread D produced: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily.\n// {\"quantity of Bread 1 produced daily\": \"q1\", \"range\": \"0 <= q1\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"q2\", \"range\": \"0 <= q2\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"q3\", \"range\": \"0 <= q3\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced daily\": \"q4\", \"range\": \"0 <= q4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively.\n// 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\n// 5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// q1 + q2 + q3 + q4 <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total daily production is of Bread 1.\n// q1 >= 0.30 * (q1 + q2 + q3 + q4)",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily. The profit per loaf and the cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost of Ingredients per Loaf |\n|------------|-----------------|------------------------------|\n| Bread 1    | $1.50           | $0.50                        |\n| Bread 2    | $2.00           | $0.75                        |\n| Bread 3    | $1.75           | $0.60                        |\n| Bread 4    | $1.80           | $0.65                        |\n\nThe bakery has a daily budget of $100 for ingredients. Each loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery wants to ensure that at least 30% of the total daily production is of Bread 1.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced daily\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0) # quantity of Bread 1 produced daily\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0) # quantity of Bread 2 produced daily\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0) # quantity of Bread 3 produced daily\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0) # quantity of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100)\n## The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\nmodel.addCons(5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(q1 + q2 + q3 + q4 <= 200)\n## The bakery wants to ensure that at least 30% of the total daily production is of Bread 1.\nmodel.addCons(q1 >= 0.30 * (q1 + q2 + q3 + q4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(q1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(q2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(q3))\n    print(\"Quantity of Bread 4 produced daily: \", model.getVal(q4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily.\n// {\"quantity of Bread 1 produced daily\": \"q1\", \"range\": \"0 <= q1\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced daily\": \"q2\", \"range\": \"0 <= q2\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced daily\": \"q3\", \"range\": \"0 <= q3\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced daily\": \"q4\", \"range\": \"0 <= q4\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total daily profit from selling all types of bread.\n// Maximize: 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively.\n// 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\n// 5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// q1 + q2 + q3 + q4 <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total daily production is of Bread 1.\n// q1 >= 0.30 * (q1 + q2 + q3 + q4)",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize profit while meeting certain nutritional and cost constraints. The bakery needs to determine the optimal quantity of each type of bread to produce daily. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a daily budget of $100 for ingredients. The cost of ingredients per loaf for Bread 1-4 is $0.50, $0.75, $0.60, and $0.65, respectively. Each loaf of Bread 1-4 contains 5g, 10g, 8g, and 7g of fiber, respectively. The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery wants to ensure that at least 30% of the total daily production is of Bread 1. Please help the bakery to maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced daily\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0) # quantity of Bread 1 produced daily\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0) # quantity of Bread 2 produced daily\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0) # quantity of Bread 3 produced daily\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0) # quantity of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*q1 + 2.00*q2 + 1.75*q3 + 1.80*q4)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*q1 + 0.75*q2 + 0.60*q3 + 0.65*q4 <= 100)\n## The bakery wants to ensure that the total daily fiber content from all bread types is at least 500g.\nmodel.addCons(5*q1 + 10*q2 + 8*q3 + 7*q4 >= 500)\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(q1 + q2 + q3 + q4 <= 200)\n## The bakery wants to ensure that at least 30% of the total daily production is of Bread 1.\nmodel.addCons(q1 >= 0.30 * (q1 + q2 + q3 + q4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced daily: \", model.getVal(q1))\n    print(\"Quantity of Bread 2 produced daily: \", model.getVal(q2))\n    print(\"Quantity of Bread 3 produced daily: \", model.getVal(q3))\n    print(\"Quantity of Bread 4 produced daily: \", model.getVal(q4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\n// x1 >= 50\n\n## Generate Constraint-4:\nDue to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily.\n// x4 <= 100",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor hours required for each type of bread:\n\n| Bread Type | Profit per Loaf | Labor Hours Required |\n|------------|-----------------|----------------------|\n| Bread 1    | $1.50           | 0.5 hours            |\n| Bread 2    | $2.00           | 0.7 hours            |\n| Bread 3    | $1.75           | 0.6 hours            |\n| Bread 4    | $1.80           | 0.8 hours            |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily. The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation. Due to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\nmodel.addCons(x1 >= 50)\n## Due to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily.\nmodel.addCons(x4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\n// x1 >= 50\n\n## Generate Constraint-4:\nDue to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily.\n// x4 <= 100",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily. The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation. Due to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily. Please help the bakery maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven space, allowing a maximum of 200 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery must produce at least 50 loaves of Bread 1 to meet a contractual obligation.\nmodel.addCons(x1 >= 50)\n## Due to market demand, the bakery can only sell up to 100 loaves of Bread 4 daily.\nmodel.addCons(x4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 750,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials. The total raw materials used should not exceed the available raw materials.\n// 3*A + 5*B <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours. The total labor hours used should not exceed the available labor hours.\n// 4*A + 6*B <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 80 units.\n// A >= 100\n// B >= 80\n\n## Generate Constraint-4:\nThe total production of both products should not exceed 200 units.\n// A + B <= 200",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit per unit for Product A is $50 and for Product B is $70. The following table summarizes the requirements for each product:\n\n| Product | Raw Materials (kg) | Labor Hours |\n|---------|--------------------|-------------|\n| A       | 3                  | 4           |\n| B       | 5                  | 6           |\n\nThe manufacturer has a limited amount of raw materials and labor hours. The market demand for Product A is at least 100 units, and for Product B is at least 80 units. The total production of both products should not exceed 200 units. \n\nPlease help the manufacturer to maximize the total profit from the production of both products, considering the constraints on raw materials, labor hours, market demand, and total production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## Available resources\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # available raw materials\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials.\nmodel.addCons(3*A + 5*B <= Raw_Materials)\n## Each unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours.\nmodel.addCons(4*A + 6*B <= Labor_Hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 80 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 80)\n## The total production of both products should not exceed 200 units.\nmodel.addCons(A + B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials. The total raw materials used should not exceed the available raw materials.\n// 3*A + 5*B <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours. The total labor hours used should not exceed the available labor hours.\n// 4*A + 6*B <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product B is at least 80 units.\n// A >= 100\n// B >= 80\n\n## Generate Constraint-4:\nThe total production of both products should not exceed 200 units.\n// A + B <= 200",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The market demand for Product A is at least 100 units, and for Product B is at least 80 units. The total production of both products should not exceed 200 units. Each unit of Product A requires 3 kg of raw materials and 4 labor hours, while each unit of Product B requires 5 kg of raw materials and 6 labor hours. The total raw materials used should not exceed the available raw materials, and the total labor hours used should not exceed the available labor hours. Please help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n## Available resources\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # available raw materials\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # available labor hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 3 kg of raw materials, and each unit of Product B requires 5 kg of raw materials.\nmodel.addCons(3*A + 5*B <= Raw_Materials)\n## Each unit of Product A requires 4 labor hours, and each unit of Product B requires 6 labor hours.\nmodel.addCons(4*A + 6*B <= Labor_Hours)\n## The market demand for Product A is at least 100 units, and for Product B is at least 80 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 80)\n## The total production of both products should not exceed 200 units.\nmodel.addCons(A + B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 30 units per week.\n// B >= 30\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per week.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The following table summarizes the profit per unit for each product:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe total production capacity of the manufacturer is 200 units per week. The market demand for product A is at least 50 units per week, for product B is at least 30 units per week, and for product C is at least 40 units per week. \n\nPlease help the manufacturer to maximize the total profit from selling all products while adhering to the production capacity and market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 30 units per week.\nmodel.addCons(B >= 30)\n## The market demand for product C is at least 40 units per week.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 30 units per week.\n// B >= 30\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per week.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and sales prices of these products vary. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer aims to maximize the total profit from selling all products. The total production capacity of the manufacturer is 200 units per week. The market demand for product A is at least 50 units per week. The market demand for product B is at least 30 units per week. The market demand for product C is at least 40 units per week. Please help the manufacturer decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 30 units per week.\nmodel.addCons(B >= 30)\n## The market demand for product C is at least 40 units per week.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes.\n// 15*A/60 + 20*B/60 + 30*C/60 <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\n// A >= 100\n// B >= 50\n\n## Generate Constraint-3:\nThe raw material constraint limits the production of product C to a maximum of 20 units per day.\n// C <= 20\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $10, product B is $15, and product C is $20. The production times for each product are as follows:\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $10             | 15 minutes               |\n| B       | $15             | 20 minutes               |\n| C       | $20             | 30 minutes               |\n\nThe total production time for all products cannot exceed 8 hours per day. The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day. The raw material constraint limits the production of product C to a maximum of 20 units per day. The company must produce at least twice as many units of product A as product B.\n\nPlease help the company to maximize the total daily profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production time for all products cannot exceed 8 hours per day.\nmodel.addCons(15*A/60 + 20*B/60 + 30*C/60 <= 8)\n## The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 50)\n## The raw material constraint limits the production of product C to a maximum of 20 units per day.\nmodel.addCons(C <= 20)\n## The company must produce at least twice as many units of product A as product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The company aims to maximize the total daily profit from the production of these three products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes.\n// 15*A/60 + 20*B/60 + 30*C/60 <= 8\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\n// A >= 100\n// B >= 50\n\n## Generate Constraint-3:\nThe raw material constraint limits the production of product C to a maximum of 20 units per day.\n// C <= 20\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $10, product B is $15, and product C is $20. The total production time for all products cannot exceed 8 hours per day. Producing one unit of product A takes 15 minutes, product B takes 20 minutes, and product C takes 30 minutes. The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day. The raw material constraint limits the production of product C to a maximum of 20 units per day. The company must produce at least twice as many units of product A as product B. Please help the company to maximize the total daily profit from the production of these three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total production time for all products cannot exceed 8 hours per day.\nmodel.addCons(15*A/60 + 20*B/60 + 30*C/60 <= 8)\n## The market demand for product A is at least 100 units per day, and the demand for product B is at least 50 units per day.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 50)\n## The raw material constraint limits the production of product C to a maximum of 20 units per day.\nmodel.addCons(C <= 20)\n## The company must produce at least twice as many units of product A as product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of units of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2\n\n## Generate Constraint-1:\nThe total production capacity of Factory 1 is 100 units per day.\n// A_F1 + B_F1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Factory 2 is 120 units per day.\n// A_F2 + B_F2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units per day.\n// A_F1 + A_F2 >= 50\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 60 units per day.\n// B_F1 + B_F2 >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of each product in each factory is given in the following Table.\n\n| Product | Factory 1 Cost | Factory 2 Cost |\n|---------|----------------|----------------|\n| A       | 10$            | 12$            |\n| B       | 8$             | 9$             |\n\nThe total production capacity of Factory 1 is 100 units per day, and Factory 2 is 120 units per day. The market demand for Product A is at least 50 units per day, and for Product B is at least 60 units per day. \n\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of units of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of units of Product A produced in Factory 2\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of units of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of units of Product B produced in Factory 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2)\n\n# Add constraints\n## The total production capacity of Factory 1 is 100 units per day.\nmodel.addCons(A_F1 + B_F1 <= 100)\n## The total production capacity of Factory 2 is 120 units per day.\nmodel.addCons(A_F2 + B_F2 <= 120)\n## The market demand for Product A is at least 50 units per day.\nmodel.addCons(A_F1 + A_F2 >= 50)\n## The market demand for Product B is at least 60 units per day.\nmodel.addCons(B_F1 + B_F2 >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Number of units of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Number of units of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Number of units of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand.\n// {\"number of units of Product A produced in Factory 1\": \"A_F1\", \"range\": \"A_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory 2\": \"A_F2\", \"range\": \"A_F2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 1\": \"B_F1\", \"range\": \"B_F1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory 2\": \"B_F2\", \"range\": \"B_F2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2\n\n## Generate Constraint-1:\nThe total production capacity of Factory 1 is 100 units per day.\n// A_F1 + B_F1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Factory 2 is 120 units per day.\n// A_F2 + B_F2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units per day.\n// A_F1 + A_F2 >= 50\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 60 units per day.\n// B_F1 + B_F2 >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory 1 and Factory 2. The manufacturer needs to decide how many units of each product to produce in each factory while considering the production capacity and market demand. The cost of producing one unit of Product A in Factory 1 is $10, and in Factory 2 is $12. The cost of producing one unit of Product B in Factory 1 is $8, and in Factory 2 is $9. The manufacturer aims to minimize the total production cost. The total production capacity of Factory 1 is 100 units per day, and Factory 2 is 120 units per day. The market demand for Product A is at least 50 units per day, and for Product B is at least 60 units per day. Please help the manufacturer determine the optimal production quantities for each product in each factory to meet these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nA_F1 = model.addVar(vtype=\"INTEGER\", name=\"A_F1\", lb=0) # number of units of Product A produced in Factory 1\nA_F2 = model.addVar(vtype=\"INTEGER\", name=\"A_F2\", lb=0) # number of units of Product A produced in Factory 2\nB_F1 = model.addVar(vtype=\"INTEGER\", name=\"B_F1\", lb=0) # number of units of Product B produced in Factory 1\nB_F2 = model.addVar(vtype=\"INTEGER\", name=\"B_F2\", lb=0) # number of units of Product B produced in Factory 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_F1 + 12*A_F2 + 8*B_F1 + 9*B_F2)\n\n# Add constraints\n## The total production capacity of Factory 1 is 100 units per day.\nmodel.addCons(A_F1 + B_F1 <= 100)\n## The total production capacity of Factory 2 is 120 units per day.\nmodel.addCons(A_F2 + B_F2 <= 120)\n## The market demand for Product A is at least 50 units per day.\nmodel.addCons(A_F1 + A_F2 >= 50)\n## The market demand for Product B is at least 60 units per day.\nmodel.addCons(B_F1 + B_F2 >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory 1: \", model.getVal(A_F1))\n    print(\"Number of units of Product A produced in Factory 2: \", model.getVal(A_F2))\n    print(\"Number of units of Product B produced in Factory 1: \", model.getVal(B_F1))\n    print(\"Number of units of Product B produced in Factory 2: \", model.getVal(B_F2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Factory X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. The manufacturer wants to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 8*X_B + 12*Y_A + 9*Y_B\n\n## Generate Constraint-1:\nFactory X has a maximum production capacity of 200 units per week.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nFactory Y has a maximum production capacity of 150 units per week.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per week.\n// X_A + Y_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per week.\n// X_B + Y_B >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each factory is given in the following Table.\n\n| Product | Factory X Cost | Factory Y Cost |\n|---------|----------------|----------------|\n| A       | 10$            | 12$            |\n| B       | 8$             | 9$             |\n\nFactory X has a maximum production capacity of 200 units per week. Factory Y has a maximum production capacity of 150 units per week. The market demand for Product A is 100 units per week, and for Product B is 120 units per week. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of units of Product A produced in Factory X\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of units of Product B produced in Factory X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of units of Product A produced in Factory Y\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of units of Product B produced in Factory Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 8*X_B + 12*Y_A + 9*Y_B)\n\n# Add constraints\n## Factory X has a maximum production capacity of 200 units per week.\nmodel.addCons(X_A + X_B <= 200)\n## Factory Y has a maximum production capacity of 150 units per week.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per week.\nmodel.addCons(X_A + Y_A >= 100)\n## The market demand for Product B is 120 units per week.\nmodel.addCons(X_B + Y_B >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory X: \", model.getVal(X_A))\n    print(\"Number of units of Product B produced in Factory X: \", model.getVal(X_B))\n    print(\"Number of units of Product A produced in Factory Y: \", model.getVal(Y_A))\n    print(\"Number of units of Product B produced in Factory Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Factory X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Factory Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Factory Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. The manufacturer wants to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 8*X_B + 12*Y_A + 9*Y_B\n\n## Generate Constraint-1:\nFactory X has a maximum production capacity of 200 units per week.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nFactory Y has a maximum production capacity of 150 units per week.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per week.\n// X_A + Y_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per week.\n// X_B + Y_B >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories: Factory X and Factory Y. The manufacturer needs to decide how many units of each product to produce in each factory to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Factory X is $10, and in Factory Y is $12. The cost of producing one unit of Product B in Factory X is $8, and in Factory Y is $9. Factory X has a maximum production capacity of 200 units per week. Factory Y has a maximum production capacity of 150 units per week. The market demand for Product A is 100 units per week. The market demand for Product B is 120 units per week.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each factory\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of units of Product A produced in Factory X\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of units of Product B produced in Factory X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of units of Product A produced in Factory Y\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of units of Product B produced in Factory Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 8*X_B + 12*Y_A + 9*Y_B)\n\n# Add constraints\n## Factory X has a maximum production capacity of 200 units per week.\nmodel.addCons(X_A + X_B <= 200)\n## Factory Y has a maximum production capacity of 150 units per week.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per week.\nmodel.addCons(X_A + Y_A >= 100)\n## The market demand for Product B is 120 units per week.\nmodel.addCons(X_B + Y_B >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Factory X: \", model.getVal(X_A))\n    print(\"Number of units of Product B produced in Factory X: \", model.getVal(X_B))\n    print(\"Number of units of Product A produced in Factory Y: \", model.getVal(Y_A))\n    print(\"Number of units of Product B produced in Factory Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost.\n// {\"number of Product A produced in Facility X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Facility Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 12*Y_A + 8*X_B + 9*Y_B\n\n## Generate Constraint-1:\nThe total production capacity of Facility X is 200 units per day.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Facility Y is 150 units per day.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per day.\n// X_A + Y_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per day.\n// X_B + Y_B >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each facility is given in the following Table.\n\n| Product | Facility X Cost | Facility Y Cost |\n|---------|-----------------|-----------------|\n| A       | 10$             | 12$             |\n| B       | 8$              | 9$              |\n\nThe total production capacity of Facility X is 200 units per day, and the total production capacity of Facility Y is 150 units per day. The market demand for Product A is 100 units per day, and the market demand for Product B is 120 units per day. Please help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each facility\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of Product A produced in Facility X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of Product A produced in Facility Y\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of Product B produced in Facility X\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of Product B produced in Facility Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 12*Y_A + 8*X_B + 9*Y_B)\n\n# Add constraints\n## The total production capacity of Facility X is 200 units per day.\nmodel.addCons(X_A + X_B <= 200)\n## The total production capacity of Facility Y is 150 units per day.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per day.\nmodel.addCons(X_A + Y_A >= 100)\n## The market demand for Product B is 120 units per day.\nmodel.addCons(X_B + Y_B >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Facility X: \", model.getVal(X_A))\n    print(\"Number of Product A produced in Facility Y: \", model.getVal(Y_A))\n    print(\"Number of Product B produced in Facility X: \", model.getVal(X_B))\n    print(\"Number of Product B produced in Facility Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost.\n// {\"number of Product A produced in Facility X\": \"X_A\", \"range\": \"X_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A produced in Facility Y\": \"Y_A\", \"range\": \"Y_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility X\": \"X_B\", \"range\": \"X_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced in Facility Y\": \"Y_B\", \"range\": \"Y_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*X_A + 12*Y_A + 8*X_B + 9*Y_B\n\n## Generate Constraint-1:\nThe total production capacity of Facility X is 200 units per day.\n// X_A + X_B <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Facility Y is 150 units per day.\n// Y_A + Y_B <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is 100 units per day.\n// X_A + Y_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per day.\n// X_B + Y_B >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different facilities: Facility X and Facility Y. The manufacturer needs to decide how many units of each product to produce in each facility to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Facility X is $10, and in Facility Y is $12. The cost of producing one unit of Product B in Facility X is $8, and in Facility Y is $9. The total production capacity of Facility X is 200 units per day, and the total production capacity of Facility Y is 150 units per day. The market demand for Product A is 100 units per day, and the market demand for Product B is 120 units per day.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced in each facility\nX_A = model.addVar(vtype=\"INTEGER\", name=\"X_A\", lb=0) # number of Product A produced in Facility X\nY_A = model.addVar(vtype=\"INTEGER\", name=\"Y_A\", lb=0) # number of Product A produced in Facility Y\nX_B = model.addVar(vtype=\"INTEGER\", name=\"X_B\", lb=0) # number of Product B produced in Facility X\nY_B = model.addVar(vtype=\"INTEGER\", name=\"Y_B\", lb=0) # number of Product B produced in Facility Y\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*X_A + 12*Y_A + 8*X_B + 9*Y_B)\n\n# Add constraints\n## The total production capacity of Facility X is 200 units per day.\nmodel.addCons(X_A + X_B <= 200)\n## The total production capacity of Facility Y is 150 units per day.\nmodel.addCons(Y_A + Y_B <= 150)\n## The market demand for Product A is 100 units per day.\nmodel.addCons(X_A + Y_A >= 100)\n## The market demand for Product B is 120 units per day.\nmodel.addCons(X_B + Y_B >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced in Facility X: \", model.getVal(X_A))\n    print(\"Number of Product A produced in Facility Y: \", model.getVal(Y_A))\n    print(\"Number of Product B produced in Facility X: \", model.getVal(X_B))\n    print(\"Number of Product B produced in Facility Y: \", model.getVal(Y_B))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total amount of raw materials available per day is 500 units. Producing one unit of product A requires 5 units of raw materials, product B requires 8 units, and product C requires 10 units.\n// 5*A + 8*B + 10*C <= 500\n\n## Generate Constraint-2:\nThe total labor hours available per day are 400 hours. Producing one unit of product A requires 4 hours of labor, product B requires 6 hours, and product C requires 5 hours.\n// 4*A + 6*B + 5*C <= 400\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product B as product A.\n// B >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the requirements for each product:\n\n| Product | Raw Materials per Unit | Labor Hours per Unit |\n|---------|------------------------|----------------------|\n| A       | 5 units                | 4 hours              |\n| B       | 8 units                | 6 hours              |\n| C       | 10 units               | 5 hours              |\n\nThe total amount of raw materials available per day is 500 units. The total labor hours available per day are 400 hours. The market demand for product A is at least 20 units per day. The company has a policy to produce at least twice as many units of product B as product A.\n\nPlease help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total amount of raw materials available per day is 500 units.\nmodel.addCons(5*A + 8*B + 10*C <= 500)\n## The total labor hours available per day are 400 hours.\nmodel.addCons(4*A + 6*B + 5*C <= 400)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The company has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The company needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total amount of raw materials available per day is 500 units. Producing one unit of product A requires 5 units of raw materials, product B requires 8 units, and product C requires 10 units.\n// 5*A + 8*B + 10*C <= 500\n\n## Generate Constraint-2:\nThe total labor hours available per day are 400 hours. Producing one unit of product A requires 4 hours of labor, product B requires 6 hours, and product C requires 5 hours.\n// 4*A + 6*B + 5*C <= 400\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product B as product A.\n// B >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a specific amount of raw materials and labor. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the production of these three products. The total amount of raw materials available per day is 500 units, with each unit of product A requiring 5 units of raw materials, product B requiring 8 units, and product C requiring 10 units. The total labor hours available per day are 400 hours, with each unit of product A requiring 4 hours of labor, product B requiring 6 hours, and product C requiring 5 hours. The market demand for product A is at least 20 units per day. The company has a policy to produce at least twice as many units of product B as product A. Please help the company determine how many units of each product to produce to maximize profit while considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total amount of raw materials available per day is 500 units.\nmodel.addCons(5*A + 8*B + 10*C <= 500)\n## The total labor hours available per day are 400 hours.\nmodel.addCons(4*A + 6*B + 5*C <= 400)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The company has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials = 1000\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from producing these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*A + 3*B + 4*C <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours. The total labor hours used must not exceed the available labor hours.\n// 8*A + 6*B + 5*C <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the manufacturer must meet this demand.\n// A >= 50\n\n## Generate Constraint-4:\nThe total production of products B and C combined must not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table shows the raw materials and labor hours required for each product.\n\n| Product | Raw Materials Required | Labor Hours Required |\n|---------|------------------------|----------------------|\n| A       | 5 units                | 8 hours              |\n| B       | 3 units                | 6 hours              |\n| C       | 4 units                | 5 hours              |\n\nThe manufacturer has 1000 units of raw materials and 800 labor hours available. The market demand for product A is at least 50 units, and the manufacturer must meet this demand. The total production of products B and C combined must not exceed twice the production of product A. Please help the manufacturer to maximize the total profit from producing these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials.\nmodel.addCons(5*A + 3*B + 4*C <= 1000) # Raw_Materials is set to 1000\n## Each unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours.\nmodel.addCons(8*A + 6*B + 5*C <= 800) # Labor_Hours is set to 800\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n## The total production of products B and C combined must not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1141,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"Raw_Materials\", \"range\": \"Raw_Materials = 1000\", \"type\": \"integer\"}\n// {\"available labor hours\": \"Labor_Hours\", \"range\": \"Labor_Hours = 800\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from producing these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 5*A + 3*B + 4*C <= Raw_Materials\n\n## Generate Constraint-2:\nEach unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours. The total labor hours used must not exceed the available labor hours.\n// 8*A + 6*B + 5*C <= Labor_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the manufacturer must meet this demand.\n// A >= 50\n\n## Generate Constraint-4:\nThe total production of products B and C combined must not exceed twice the production of product A.\n// B + C <= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires a certain amount of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from producing these products. Each unit of product A requires 5 units of raw materials and 8 labor hours, each unit of product B requires 3 units of raw materials and 6 labor hours, and each unit of product C requires 4 units of raw materials and 5 labor hours. The total raw materials used must not exceed 1000 units, and the total labor hours used must not exceed 800 hours. The market demand for product A is at least 50 units, and the manufacturer must meet this demand. The total production of products B and C combined must not exceed twice the production of product A. Please help the manufacturer decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units of raw materials, and each unit of product C requires 4 units of raw materials.\nmodel.addCons(5*A + 3*B + 4*C <= 1000) # Raw_Materials is set to 1000\n## Each unit of product A requires 8 labor hours, each unit of product B requires 6 labor hours, and each unit of product C requires 5 labor hours.\nmodel.addCons(8*A + 6*B + 5*C <= 800) # Labor_Hours is set to 800\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n## The total production of products B and C combined must not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80\n\n## Generate Constraint-4:\nThe market demand for Product B is 90 units per day.\n// B_P1 + B_P2 >= 90",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | $10          | $12          |\n| B       | $8           | $9           |\n\nThe total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day, and for Product B is 90 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand and not exceeding the production capacities of the plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n## The market demand for Product B is 90 units per day.\nmodel.addCons(B_P1 + B_P2 >= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80\n\n## Generate Constraint-4:\nThe market demand for Product B is 90 units per day.\n// B_P1 + B_P2 >= 90",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day, and the market demand for Product B is 90 units per day.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n## The market demand for Product B is 90 units per day.\nmodel.addCons(B_P1 + B_P2 >= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"prod_C\", \"range\": \"prod_C >= 0\", \"type\": \"integer\"}\n// {\"resource X used for production\": \"resource_X\", \"range\": \"resource_X >= 0\", \"type\": \"real\"}\n// {\"resource Y used for production\": \"resource_Y\", \"range\": \"resource_Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*prod_A + 70*prod_B + 60*prod_C\n\n## Generate Constraint-1:\nThe total amount of resource X available for production is 500 units. Each unit of product A requires 2 units of resource X, product B requires 3 units, and product C requires 4 units.\n// 2*prod_A + 3*prod_B + 4*prod_C <= 500\n\n## Generate Constraint-2:\nThe total amount of resource Y available for production is 600 units. Each unit of product A requires 1 unit of resource Y, product B requires 2 units, and product C requires 3 units.\n// prod_A + 2*prod_B + 3*prod_C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C.\n// prod_A >= 10\n// prod_B >= 20\n\n## Generate Constraint-4:\nThe total production quantity of all products should not exceed 100 units.\n// prod_A + prod_B + prod_C <= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit for product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products. The following table summarizes the resource requirements for each product:\n\n| Product | Resource X per Unit | Resource Y per Unit |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 1 unit              |\n| B       | 3 units             | 2 units             |\n| C       | 4 units             | 3 units             |\n\nThe total amount of resource X available for production is 500 units, and the total amount of resource Y available is 600 units. The market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C. The total production quantity of all products should not exceed 100 units. Please help the company determine the optimal production quantities for products A, B, and C to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of product B\nprod_C = model.addVar(vtype=\"INTEGER\", name=\"prod_C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*prod_A + 70*prod_B + 60*prod_C)\n\n# Add constraints\n## The total amount of resource X available for production is 500 units.\nmodel.addCons(2*prod_A + 3*prod_B + 4*prod_C <= 500)\n## The total amount of resource Y available for production is 600 units.\nmodel.addCons(prod_A + 2*prod_B + 3*prod_C <= 600)\n## The market demand for product A is at least 10 units, and for product B is at least 20 units.\nmodel.addCons(prod_A >= 10)\nmodel.addCons(prod_B >= 20)\n## The total production quantity of all products should not exceed 100 units.\nmodel.addCons(prod_A + prod_B + prod_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(prod_A))\n    print(\"Production quantity of product B: \", model.getVal(prod_B))\n    print(\"Production quantity of product C: \", model.getVal(prod_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1222,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"prod_C\", \"range\": \"prod_C >= 0\", \"type\": \"integer\"}\n// {\"resource X used for production\": \"resource_X\", \"range\": \"resource_X >= 0\", \"type\": \"real\"}\n// {\"resource Y used for production\": \"resource_Y\", \"range\": \"resource_Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*prod_A + 70*prod_B + 60*prod_C\n\n## Generate Constraint-1:\nThe total amount of resource X available for production is 500 units. Each unit of product A requires 2 units of resource X, product B requires 3 units, and product C requires 4 units.\n// 2*prod_A + 3*prod_B + 4*prod_C <= 500\n\n## Generate Constraint-2:\nThe total amount of resource Y available for production is 600 units. Each unit of product A requires 1 unit of resource Y, product B requires 2 units, and product C requires 3 units.\n// prod_A + 2*prod_B + 3*prod_C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C.\n// prod_A >= 10\n// prod_B >= 20\n\n## Generate Constraint-4:\nThe total production quantity of all products should not exceed 100 units.\n// prod_A + prod_B + prod_C <= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total amount of resource X available for production is 500 units, with each unit of product A requiring 2 units of resource X, product B requiring 3 units, and product C requiring 4 units. The total amount of resource Y available for production is 600 units, with each unit of product A requiring 1 unit of resource Y, product B requiring 2 units, and product C requiring 3 units. The market demand for product A is at least 10 units, and for product B is at least 20 units. There is no minimum demand specified for product C. The total production quantity of all products should not exceed 100 units. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # production quantity of product A\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # production quantity of product B\nprod_C = model.addVar(vtype=\"INTEGER\", name=\"prod_C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*prod_A + 70*prod_B + 60*prod_C)\n\n# Add constraints\n## The total amount of resource X available for production is 500 units.\nmodel.addCons(2*prod_A + 3*prod_B + 4*prod_C <= 500)\n## The total amount of resource Y available for production is 600 units.\nmodel.addCons(prod_A + 2*prod_B + 3*prod_C <= 600)\n## The market demand for product A is at least 10 units, and for product B is at least 20 units.\nmodel.addCons(prod_A >= 10)\nmodel.addCons(prod_B >= 20)\n## The total production quantity of all products should not exceed 100 units.\nmodel.addCons(prod_A + prod_B + prod_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(prod_A))\n    print(\"Production quantity of product B: \", model.getVal(prod_B))\n    print(\"Production quantity of product C: \", model.getVal(prod_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 150 units.\n// prod_B >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B.\n\n| Material/Product | Cost per Unit | Required for Product A | Required for Product B |\n|------------------|---------------|-------------------------|-------------------------|\n| Material X       | $10           | 2 units                 | 1 unit                  |\n| Material Y       | $15           | 1 unit                  | 3 units                 |\n\nThe total amount of Material X available for purchase is limited to 300 units. The total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units. The market demand for Product B is at least 150 units.\n\nPlease help the manufacturer to minimize the total cost of raw materials and production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n## The market demand for Product B is at least 150 units.\nmodel.addCons(prod_B >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 150 units.\n// prod_B >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B.\nThe total amount of Material X available for purchase is limited to 300 units. The total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units. The market demand for Product B is at least 150 units.\nPlease help the manufacturer to minimize the total cost of raw materials and production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n## The market demand for Product B is at least 150 units.\nmodel.addCons(prod_B >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60\n\n## Generate Constraint-4:\nThe production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\n// A_Assembly = A_units\n// A_Quality = 0.5 * A_units\n// A_Packaging = 0.5 * A_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n\nThe total time available for Assembly is 100 hours, for Quality Check is 80 hours, and for Packaging is 60 hours. The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\n\nPlease help the manufacturer determine the optimal number of units of Product A and Product B to produce and allocate the production time across the three stages to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units and time spent on each stage for each product\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n## The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\nmodel.addCons(A_Assembly == A_units)\nmodel.addCons(A_Quality == 0.5 * A_units)\nmodel.addCons(A_Packaging == 0.5 * A_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60\n\n## Generate Constraint-4:\nThe production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\n// A_Assembly = A_units\n// A_Quality = 0.5 * A_units\n// A_Packaging = 0.5 * A_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products. The total time available for Assembly is 100 hours, for Quality Check is 80 hours, and for Packaging is 60 hours. The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively. Please help the manufacturer determine the optimal number of units of each product to produce and the allocation of production time across the three stages to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units and time spent on each stage for each product\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n## The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\nmodel.addCons(A_Assembly == A_units)\nmodel.addCons(A_Quality == 0.5 * A_units)\nmodel.addCons(A_Packaging == 0.5 * A_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products.\n// Profit_A = (50 - 30) * A = 20 * A\n// Profit_B = (70 - 40) * B = 30 * B\n// Profit_C = (60 - 35) * C = 25 * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 60 units per week.\n// B >= 60\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per week.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand. The selling price and production cost for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| A       | $50           | $30             |\n| B       | $70           | $40             |\n| C       | $60           | $35             |\n\nThe total production capacity is limited to 200 units per week. The market demand for product A is at least 50 units per week, for product B is at least 60 units per week, and for product C is at least 40 units per week. \n\nPlease help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from each product\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 25 * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity is limited to 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 60 units per week.\nmodel.addCons(B >= 60)\n## The market demand for product C is at least 40 units per week.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products.\n// Profit_A = (50 - 30) * A = 20 * A\n// Profit_B = (70 - 40) * B = 30 * B\n// Profit_C = (60 - 35) * C = 25 * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 200 units per week.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 60 units per week.\n// B >= 60\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per week.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The production costs and selling prices for each product vary. The selling price of product A is $50, product B is $70, and product C is $60. The production cost of product A is $30, product B is $40, and product C is $35. The manufacturer aims to maximize the total profit from selling all products. The total production capacity is limited to 200 units per week. The market demand for product A is at least 50 units per week. The market demand for product B is at least 60 units per week. The market demand for product C is at least 40 units per week. Please help the manufacturer decide how many units of each product to produce to maximize profit while considering the available production capacity and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from each product\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 25 * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity is limited to 200 units per week.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The market demand for product B is at least 60 units per week.\nmodel.addCons(B >= 60)\n## The market demand for product C is at least 40 units per week.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3.\n// {\"whether to operate factory in Chicago\": \"open_CHI\", \"range\": \"open_CHI = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to operate factory in Denver\": \"open_DEN\", \"range\": \"open_DEN = 0 or 1\", \"type\": \"binary\"}\n// {\"number of Product A units produced in Chicago\": \"CHI_A\", \"range\": \"CHI_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"DEN_A\", \"range\": \"DEN_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"CHI_B\", \"range\": \"CHI_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"DEN_B\", \"range\": \"DEN_B >= 0\", \"type\": \"integer\"}\n// The factories can't produce anything unless they are operational:\n// CHI_A + CHI_B == open_CHI * (CHI_A + CHI_B)\n// DEN_A + DEN_B == open_DEN * (DEN_A + DEN_B)\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. The goal is to minimize the total production and operational costs while meeting the market demands.\n// Operational_Cost = 600*open_CHI + 500*open_DEN\n// CHI_Production_Cost = 30*CHI_A + 40*CHI_B\n// DEN_Production_Cost = 25*DEN_A + 35*DEN_B\n// Objective Function: Minimize: Operational_Cost + CHI_Production_Cost + DEN_Production_Cost\n\n## Generate Constraint-1:\nEach factory has a production capacity of 200 units per week.\n// CHI_A + CHI_B <= 200\n// DEN_A + DEN_B <= 200\n\n## Generate Constraint-2:\nMarket 1 requires 100 units of Product A and 50 units of Product B per week.\n// CHI_A + DEN_A >= 100\n// CHI_B + DEN_B >= 50\n\n## Generate Constraint-3:\nMarket 2 requires 80 units of Product A and 70 units of Product B per week.\n// CHI_A + DEN_A >= 80\n// CHI_B + DEN_B >= 70\n\n## Generate Constraint-4:\nMarket 3 requires 70 units of Product A and 60 units of Product B per week.\n// CHI_A + DEN_A >= 70\n// CHI_B + DEN_B >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. The following table summarizes the production costs:\n\n| Factory | Product A Cost | Product B Cost | Fixed Operational Cost |\n|---------|----------------|----------------|------------------------|\n| Chicago | 30$            | 40$            | 600$                   |\n| Denver  | 25$            | 35$            | 500$                   |\n\nEach factory has a production capacity of 200 units per week. Market 1 requires 100 units of Product A and 50 units of Product B per week. Market 2 requires 80 units of Product A and 70 units of Product B per week. Market 3 requires 70 units of Product A and 60 units of Product B per week. The factories can't produce anything unless they are operational. \n\nPlease help the manufacturer to minimize the total production and operational costs while meeting the market demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to operate factory in Chicago and Denver\nopen_CHI = model.addVar(vtype=\"B\", name=\"open_CHI\") # whether to operate factory in Chicago\nopen_DEN = model.addVar(vtype=\"B\", name=\"open_DEN\") # whether to operate factory in Denver\n## Number of Product A and B units produced in Chicago and Denver\nCHI_A = model.addVar(vtype=\"INTEGER\", name=\"CHI_A\", lb=0) # number of Product A units produced in Chicago\nCHI_B = model.addVar(vtype=\"INTEGER\", name=\"CHI_B\", lb=0) # number of Product B units produced in Chicago\nDEN_A = model.addVar(vtype=\"INTEGER\", name=\"DEN_A\", lb=0) # number of Product A units produced in Denver\nDEN_B = model.addVar(vtype=\"INTEGER\", name=\"DEN_B\", lb=0) # number of Product B units produced in Denver\n\n# The factories can't produce anything unless they are operational\nmodel.addCons(CHI_A + CHI_B <= open_CHI * (CHI_A + CHI_B))\nmodel.addCons(DEN_A + DEN_B <= open_DEN * (DEN_A + DEN_B))\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Operational_Cost = 600*open_CHI + 500*open_DEN\nOperational_Cost = 600*open_CHI + 500*open_DEN\n## CHI_Production_Cost = 30*CHI_A + 40*CHI_B\nCHI_Production_Cost = 30*CHI_A + 40*CHI_B\n## DEN_Production_Cost = 25*DEN_A + 35*DEN_B\nDEN_Production_Cost = 25*DEN_A + 35*DEN_B\nmodel.addCons(obj == Operational_Cost + CHI_Production_Cost + DEN_Production_Cost)\n\n# Add constraints\n## Each factory has a production capacity of 200 units per week.\nmodel.addCons(CHI_A + CHI_B <= 200)\nmodel.addCons(DEN_A + DEN_B <= 200)\n## Market 1 requires 100 units of Product A and 50 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 100)\nmodel.addCons(CHI_B + DEN_B >= 50)\n## Market 2 requires 80 units of Product A and 70 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 80)\nmodel.addCons(CHI_B + DEN_B >= 70)\n## Market 3 requires 70 units of Product A and 60 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 70)\nmodel.addCons(CHI_B + DEN_B >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operate Chicago Factory: \", model.getVal(open_CHI))\n    print(\"Operate Denver Factory: \", model.getVal(open_DEN))\n    print(\"Product A units in Chicago: \", model.getVal(CHI_A))\n    print(\"Product A units in Denver: \", model.getVal(DEN_A))\n    print(\"Product B units in Chicago: \", model.getVal(CHI_B))\n    print(\"Product B units in Denver: \", model.getVal(DEN_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1416,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3.\n// {\"whether to operate factory in Chicago\": \"open_CHI\", \"range\": \"open_CHI = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to operate factory in Denver\": \"open_DEN\", \"range\": \"open_DEN = 0 or 1\", \"type\": \"binary\"}\n// {\"number of Product A units produced in Chicago\": \"CHI_A\", \"range\": \"CHI_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product A units produced in Denver\": \"DEN_A\", \"range\": \"DEN_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Chicago\": \"CHI_B\", \"range\": \"CHI_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units produced in Denver\": \"DEN_B\", \"range\": \"DEN_B >= 0\", \"type\": \"integer\"}\n// The factories can't produce anything unless they are operational:\n// CHI_A + CHI_B == open_CHI * (CHI_A + CHI_B)\n// DEN_A + DEN_B == open_DEN * (DEN_A + DEN_B)\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. The goal is to minimize the total production and operational costs while meeting the market demands.\n// Operational_Cost = 600*open_CHI + 500*open_DEN\n// CHI_Production_Cost = 30*CHI_A + 40*CHI_B\n// DEN_Production_Cost = 25*DEN_A + 35*DEN_B\n// Objective Function: Minimize: Operational_Cost + CHI_Production_Cost + DEN_Production_Cost\n\n## Generate Constraint-1:\nEach factory has a production capacity of 200 units per week.\n// CHI_A + CHI_B <= 200\n// DEN_A + DEN_B <= 200\n\n## Generate Constraint-2:\nMarket 1 requires 100 units of Product A and 50 units of Product B per week.\n// CHI_A + DEN_A >= 100\n// CHI_B + DEN_B >= 50\n\n## Generate Constraint-3:\nMarket 2 requires 80 units of Product A and 70 units of Product B per week.\n// CHI_A + DEN_A >= 80\n// CHI_B + DEN_B >= 70\n\n## Generate Constraint-4:\nMarket 3 requires 70 units of Product A and 60 units of Product B per week.\n// CHI_A + DEN_A >= 70\n// CHI_B + DEN_B >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different factories located in Chicago and Denver. The manufacturer needs to decide how many units of each product to produce in each factory and the distribution of these products to three markets: Market 1, Market 2, and Market 3.\nThe cost of producing one unit of Product A in Chicago is $30, and in Denver is $25. The cost of producing one unit of Product B in Chicago is $40, and in Denver is $35. The fixed weekly cost of operating each factory is $600 for Chicago and $500 for Denver. Each factory has a production capacity of 200 units per week. Market 1 requires 100 units of Product A and 50 units of Product B per week. Market 2 requires 80 units of Product A and 70 units of Product B per week. Market 3 requires 70 units of Product A and 60 units of Product B per week.\nPlease help the manufacturer to minimize the total production and operational costs while meeting the market demands.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to operate factory in Chicago and Denver\nopen_CHI = model.addVar(vtype=\"B\", name=\"open_CHI\") # whether to operate factory in Chicago\nopen_DEN = model.addVar(vtype=\"B\", name=\"open_DEN\") # whether to operate factory in Denver\n## Number of Product A and B units produced in Chicago and Denver\nCHI_A = model.addVar(vtype=\"INTEGER\", name=\"CHI_A\", lb=0) # number of Product A units produced in Chicago\nCHI_B = model.addVar(vtype=\"INTEGER\", name=\"CHI_B\", lb=0) # number of Product B units produced in Chicago\nDEN_A = model.addVar(vtype=\"INTEGER\", name=\"DEN_A\", lb=0) # number of Product A units produced in Denver\nDEN_B = model.addVar(vtype=\"INTEGER\", name=\"DEN_B\", lb=0) # number of Product B units produced in Denver\n\n# The factories can't produce anything unless they are operational\nmodel.addCons(CHI_A + CHI_B <= open_CHI * (CHI_A + CHI_B))\nmodel.addCons(DEN_A + DEN_B <= open_DEN * (DEN_A + DEN_B))\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Operational_Cost = 600*open_CHI + 500*open_DEN\nOperational_Cost = 600*open_CHI + 500*open_DEN\n## CHI_Production_Cost = 30*CHI_A + 40*CHI_B\nCHI_Production_Cost = 30*CHI_A + 40*CHI_B\n## DEN_Production_Cost = 25*DEN_A + 35*DEN_B\nDEN_Production_Cost = 25*DEN_A + 35*DEN_B\nmodel.addCons(obj == Operational_Cost + CHI_Production_Cost + DEN_Production_Cost)\n\n# Add constraints\n## Each factory has a production capacity of 200 units per week.\nmodel.addCons(CHI_A + CHI_B <= 200)\nmodel.addCons(DEN_A + DEN_B <= 200)\n## Market 1 requires 100 units of Product A and 50 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 100)\nmodel.addCons(CHI_B + DEN_B >= 50)\n## Market 2 requires 80 units of Product A and 70 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 80)\nmodel.addCons(CHI_B + DEN_B >= 70)\n## Market 3 requires 70 units of Product A and 60 units of Product B per week.\nmodel.addCons(CHI_A + DEN_A >= 70)\nmodel.addCons(CHI_B + DEN_B >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operate Chicago Factory: \", model.getVal(open_CHI))\n    print(\"Operate Denver Factory: \", model.getVal(open_DEN))\n    print(\"Product A units in Chicago: \", model.getVal(CHI_A))\n    print(\"Product A units in Denver: \", model.getVal(DEN_A))\n    print(\"Product B units in Chicago: \", model.getVal(CHI_B))\n    print(\"Product B units in Denver: \", model.getVal(DEN_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A produced\": \"A_produced\", \"range\": \"A_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_produced\", \"range\": \"B_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs.\n// Production_Cost_A = 10 * A_produced\n// Production_Cost_B = 15 * B_produced\n// Shipping_Cost_A_M1 = 5 * A_M1\n// Shipping_Cost_A_M2 = 6 * A_M2\n// Shipping_Cost_A_M3 = 7 * A_M3\n// Shipping_Cost_B_M1 = 8 * B_M1\n// Shipping_Cost_B_M2 = 7 * B_M2\n// Shipping_Cost_B_M3 = 9 * B_M3\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\n// A_produced + B_produced <= 200\n\n## Generate Constraint-2:\nMarket 1 requires at least 50 units of Product A and 40 units of Product B per week.\n// A_M1 >= 50\n// B_M1 >= 40\n\n## Generate Constraint-3:\nMarket 2 requires at least 60 units of Product A and 50 units of Product B per week.\n// A_M2 >= 60\n// B_M2 >= 50\n\n## Generate Constraint-4:\nMarket 3 requires at least 70 units of Product A and 60 units of Product B per week.\n// A_M3 >= 70\n// B_M3 >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3. The cost of producing and shipping each product to each market is given in the following Table.\n\n| Product | Production Cost | Market 1 Shipping Cost | Market 2 Shipping Cost | Market 3 Shipping Cost |\n|---------|-----------------|------------------------|------------------------|------------------------|\n| A       | $10             | $5                     | $6                     | $7                     |\n| B       | $15             | $8                     | $7                     | $9                     |\n\nThe company aims to minimize the total production and shipping costs. The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week. Market 1 requires at least 50 units of Product A and 40 units of Product B per week. Market 2 requires at least 60 units of Product A and 50 units of Product B per week. Market 3 requires at least 70 units of Product A and 60 units of Product B per week.\n\nPlease help the company determine the optimal number of units of Product A and Product B to produce and their distribution to each market to minimize the total production and shipping costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and shipped to each market\nA_produced = model.addVar(vtype=\"INTEGER\", name=\"A_produced\", lb=0) # number of units of Product A produced\nB_produced = model.addVar(vtype=\"INTEGER\", name=\"B_produced\", lb=0) # number of units of Product B produced\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A shipped to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A shipped to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A shipped to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B shipped to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B shipped to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B shipped to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production and shipping costs\nProduction_Cost_A = 10 * A_produced\nProduction_Cost_B = 15 * B_produced\nShipping_Cost_A_M1 = 5 * A_M1\nShipping_Cost_A_M2 = 6 * A_M2\nShipping_Cost_A_M3 = 7 * A_M3\nShipping_Cost_B_M1 = 8 * B_M1\nShipping_Cost_B_M2 = 7 * B_M2\nShipping_Cost_B_M3 = 9 * B_M3\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\nmodel.addCons(A_produced + B_produced <= 200)\n## Market 1 requires at least 50 units of Product A and 40 units of Product B per week.\nmodel.addCons(A_M1 >= 50)\nmodel.addCons(B_M1 >= 40)\n## Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\nmodel.addCons(A_M2 >= 60)\nmodel.addCons(B_M2 >= 50)\n## Market 3 requires at least 70 units of Product A and 60 units of Product B per week.\nmodel.addCons(A_M3 >= 70)\nmodel.addCons(B_M3 >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_produced))\n    print(\"Number of units of Product B produced: \", model.getVal(B_produced))\n    print(\"Number of units of Product A shipped to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A shipped to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A shipped to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B shipped to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B shipped to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B shipped to Market 3: \", model.getVal(B_M3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1400,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A produced\": \"A_produced\", \"range\": \"A_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_produced\", \"range\": \"B_produced >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A shipped to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B shipped to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs.\n// Production_Cost_A = 10 * A_produced\n// Production_Cost_B = 15 * B_produced\n// Shipping_Cost_A_M1 = 5 * A_M1\n// Shipping_Cost_A_M2 = 6 * A_M2\n// Shipping_Cost_A_M3 = 7 * A_M3\n// Shipping_Cost_B_M1 = 8 * B_M1\n// Shipping_Cost_B_M2 = 7 * B_M2\n// Shipping_Cost_B_M3 = 9 * B_M3\n// Objective Function: Minimize: Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3\n\n## Generate Constraint-1:\nThe total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\n// A_produced + B_produced <= 200\n\n## Generate Constraint-2:\nMarket 1 requires at least 50 units of Product A and 40 units of Product B per week.\n// A_M1 >= 50\n// B_M1 >= 40\n\n## Generate Constraint-3:\nMarket 2 requires at least 60 units of Product A and 50 units of Product B per week.\n// A_M2 >= 60\n// B_M2 >= 50\n\n## Generate Constraint-4:\nMarket 3 requires at least 70 units of Product A and 60 units of Product B per week.\n// A_M3 >= 70\n// B_M3 >= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and the distribution of these products to three different markets: Market 1, Market 2, and Market 3. The cost of producing one unit of Product A is $10, and Product B is $15. The shipping cost to Market 1 is $5 for Product A and $8 for Product B. The shipping cost to Market 2 is $6 for Product A and $7 for Product B. The shipping cost to Market 3 is $7 for Product A and $9 for Product B. The company aims to minimize the total production and shipping costs. The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week. Market 1 requires at least 50 units of Product A and 40 units of Product B per week. Market 2 requires at least 60 units of Product A and 50 units of Product B per week. Market 3 requires at least 70 units of Product A and 60 units of Product B per week. Please help the company to determine the optimal production and distribution strategy to minimize the total costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and shipped to each market\nA_produced = model.addVar(vtype=\"INTEGER\", name=\"A_produced\", lb=0) # number of units of Product A produced\nB_produced = model.addVar(vtype=\"INTEGER\", name=\"B_produced\", lb=0) # number of units of Product B produced\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A shipped to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A shipped to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A shipped to Market 3\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B shipped to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B shipped to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B shipped to Market 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production and shipping costs\nProduction_Cost_A = 10 * A_produced\nProduction_Cost_B = 15 * B_produced\nShipping_Cost_A_M1 = 5 * A_M1\nShipping_Cost_A_M2 = 6 * A_M2\nShipping_Cost_A_M3 = 7 * A_M3\nShipping_Cost_B_M1 = 8 * B_M1\nShipping_Cost_B_M2 = 7 * B_M2\nShipping_Cost_B_M3 = 9 * B_M3\nmodel.addCons(obj == Production_Cost_A + Production_Cost_B + Shipping_Cost_A_M1 + Shipping_Cost_A_M2 + Shipping_Cost_A_M3 + Shipping_Cost_B_M1 + Shipping_Cost_B_M2 + Shipping_Cost_B_M3)\n\n# Add constraints\n## The total production of Product A and Product B should not exceed the company's production capacity of 200 units per week.\nmodel.addCons(A_produced + B_produced <= 200)\n## Market 1 requires at least 50 units of Product A and 40 units of Product B per week.\nmodel.addCons(A_M1 >= 50)\nmodel.addCons(B_M1 >= 40)\n## Market 2 requires at least 60 units of Product A and 50 units of Product B per week.\nmodel.addCons(A_M2 >= 60)\nmodel.addCons(B_M2 >= 50)\n## Market 3 requires at least 70 units of Product A and 60 units of Product B per week.\nmodel.addCons(A_M3 >= 70)\nmodel.addCons(B_M3 >= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_produced))\n    print(\"Number of units of Product B produced: \", model.getVal(B_produced))\n    print(\"Number of units of Product A shipped to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A shipped to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A shipped to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B shipped to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B shipped to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B shipped to Market 3: \", model.getVal(B_M3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 200 units per day.\n// A_P1 + B_P1 <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 180 units per day.\n// A_P2 + B_P2 <= 180\n\n## Generate Constraint-3:\nThe market demand for Product A is 150 units per day.\n// A_P1 + A_P2 >= 150\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per day.\n// B_P1 + B_P2 >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | 10$          | 12$          |\n| B       | 8$           | 9$           |\n\nThe total production capacity of Plant 1 is 200 units per day, and the total production capacity of Plant 2 is 180 units per day. The market demand for Product A is 150 units per day, and the market demand for Product B is 120 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand and staying within the production capacities of both plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 200 units per day.\nmodel.addCons(A_P1 + B_P1 <= 200)\n## The total production capacity of Plant 2 is 180 units per day.\nmodel.addCons(A_P2 + B_P2 <= 180)\n## The market demand for Product A is 150 units per day.\nmodel.addCons(A_P1 + A_P2 >= 150)\n## The market demand for Product B is 120 units per day.\nmodel.addCons(B_P1 + B_P2 >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 200 units per day.\n// A_P1 + B_P1 <= 200\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 180 units per day.\n// A_P2 + B_P2 <= 180\n\n## Generate Constraint-3:\nThe market demand for Product A is 150 units per day.\n// A_P1 + A_P2 >= 150\n\n## Generate Constraint-4:\nThe market demand for Product B is 120 units per day.\n// B_P1 + B_P2 >= 120",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 200 units per day, and the total production capacity of Plant 2 is 180 units per day. The market demand for Product A is 150 units per day, and the market demand for Product B is 120 units per day.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 200 units per day.\nmodel.addCons(A_P1 + B_P1 <= 200)\n## The total production capacity of Plant 2 is 180 units per day.\nmodel.addCons(A_P2 + B_P2 <= 180)\n## The market demand for Product A is 150 units per day.\nmodel.addCons(A_P1 + A_P2 >= 150)\n## The market demand for Product B is 120 units per day.\nmodel.addCons(B_P1 + B_P2 >= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A_units + B_units <= 1000\n\n## Generate Constraint-2:\nThe labor hours available per week are limited to 1200 hours. Producing one unit of Product A requires 2 hours, and Product B requires 3 hours.\n// A_labor = 2*A_units\n// B_labor = 3*B_units\n// A_labor + B_labor <= 1200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 400 units per week.\n// A_units >= 400\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 200 units per week.\n// B_units >= 200",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity, labor hours, and market demand for each product must be considered. The profit from selling one unit of Product A is $50, and from Product B is $70. The following table summarizes the production requirements and market demands:\n\n| Product | Profit per Unit | Production Time (hours per unit) | Market Demand (units) |\n|---------|-----------------|---------------------------------|----------------------|\n| A       | 50$             | 2                               | 400                  |\n| B       | 70$             | 3                               | 200                  |\n\nThe total production capacity is limited to 1000 units per week. The labor hours available per week are limited to 1200 hours. The market demand for Product A is at least 400 units per week, and for Product B is at least 200 units per week.\n\nPlease help the company to maximize its total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor used for each product\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # number of hours of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # number of hours of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A_units + B_units <= 1000)\n## The labor hours available per week are limited to 1200 hours.\nmodel.addCons(A_labor == 2*A_units)\nmodel.addCons(B_labor == 3*B_units)\nmodel.addCons(A_labor + B_labor <= 1200)\n## The market demand for Product A is at least 400 units per week.\nmodel.addCons(A_units >= 400)\n## The market demand for Product B is at least 200 units per week.\nmodel.addCons(B_units >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used for Product A\": \"A_labor\", \"range\": \"A_labor >= 0\", \"type\": \"real\"}\n// {\"number of hours of labor used for Product B\": \"B_labor\", \"range\": \"B_labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A_units + B_units <= 1000\n\n## Generate Constraint-2:\nThe labor hours available per week are limited to 1200 hours. Producing one unit of Product A requires 2 hours, and Product B requires 3 hours.\n// A_labor = 2*A_units\n// B_labor = 3*B_units\n// A_labor + B_labor <= 1200\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 400 units per week.\n// A_units >= 400\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 200 units per week.\n// B_units >= 200",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product must be considered. The profit from selling one unit of Product A is $50, and from Product B is $70. The total production capacity is limited to 1000 units per week. The labor hours available per week are limited to 1200 hours, with each unit of Product A requiring 2 hours to produce and each unit of Product B requiring 3 hours. The market demand for Product A is at least 400 units per week, and for Product B is at least 200 units per week.\nPlease help the company to maximize its total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor used for each product\nA_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_labor\", lb=0) # number of hours of labor used for Product A\nB_labor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_labor\", lb=0) # number of hours of labor used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A_units + B_units <= 1000)\n## The labor hours available per week are limited to 1200 hours.\nmodel.addCons(A_labor == 2*A_units)\nmodel.addCons(B_labor == 3*B_units)\nmodel.addCons(A_labor + B_labor <= 1200)\n## The market demand for Product A is at least 400 units per week.\nmodel.addCons(A_units >= 400)\n## The market demand for Product B is at least 200 units per week.\nmodel.addCons(B_units >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 747,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are key factors.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machines used\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total labor hours available per day are 100 hours. Producing one unit of Product A requires 2 hours of labor, and Product B requires 3 hours.\n// 2*A_units + 3*B_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available per day are 120 hours. Producing one unit of Product A requires 1 hour of machine time, and Product B requires 2 hours.\n// A_units + 2*B_units <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A_units >= 20\n// B_units >= 30\n\n## Generate Constraint-4:\nThe company has a policy to use at least 50% of the total available labor hours.\n// 2*A_units + 3*B_units >= 0.5 * 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit per unit of Product A is $50, and for Product B is $70. The production requirements and constraints for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Machine Hours per Unit | Minimum Market Demand |\n|---------|----------------------|------------------------|-----------------------|\n| A       | 2 hours              | 1 hour                 | 20 units              |\n| B       | 3 hours              | 2 hours                | 30 units              |\n\nThe total labor hours available per day are 100 hours, and the total machine hours available per day are 120 hours. The company has a policy to use at least 50% of the total available labor hours. \n\nPlease help the company to maximize its total profit from both products, subject to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor and machines used\nlabor_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_hours\", lb=0) # number of hours of labor used\nmachine_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"machine_hours\", lb=0) # number of machines used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total labor hours available per day are 100 hours.\nmodel.addCons(2*A_units + 3*B_units <= 100)\n## The total machine hours available per day are 120 hours.\nmodel.addCons(A_units + 2*B_units <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A_units >= 20)\nmodel.addCons(B_units >= 30)\n## The company has a policy to use at least 50% of the total available labor hours.\nmodel.addCons(2*A_units + 3*B_units >= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The production capacity and market demand for each product are key factors.\n// {\"number of units of Product A produced\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"labor_hours\", \"range\": \"labor_hours >= 0\", \"type\": \"real\"}\n// {\"number of machines used\": \"machine_hours\", \"range\": \"machine_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize its total profit from both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total labor hours available per day are 100 hours. Producing one unit of Product A requires 2 hours of labor, and Product B requires 3 hours.\n// 2*A_units + 3*B_units <= 100\n\n## Generate Constraint-2:\nThe total machine hours available per day are 120 hours. Producing one unit of Product A requires 1 hour of machine time, and Product B requires 2 hours.\n// A_units + 2*B_units <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\n// A_units >= 20\n// B_units >= 30\n\n## Generate Constraint-4:\nThe company has a policy to use at least 50% of the total available labor hours.\n// 2*A_units + 3*B_units >= 0.5 * 100",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and sell to maximize profit. The profit per unit of Product A is $50, and for Product B is $70. The total labor hours available per day are 100 hours, with each unit of Product A requiring 2 hours of labor and Product B requiring 3 hours. The total machine hours available per day are 120 hours, with each unit of Product A requiring 1 hour of machine time and Product B requiring 2 hours. The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day. The company has a policy to use at least 50% of the total available labor hours. Please help the company to maximize its total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of units of Product A produced\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of units of Product B produced\n## The number of hours of labor and machines used\nlabor_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"labor_hours\", lb=0) # number of hours of labor used\nmachine_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"machine_hours\", lb=0) # number of machines used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total labor hours available per day are 100 hours.\nmodel.addCons(2*A_units + 3*B_units <= 100)\n## The total machine hours available per day are 120 hours.\nmodel.addCons(A_units + 2*B_units <= 120)\n## The market demand for Product A is at least 20 units per day, and for Product B is at least 30 units per day.\nmodel.addCons(A_units >= 20)\nmodel.addCons(B_units >= 30)\n## The company has a policy to use at least 50% of the total available labor hours.\nmodel.addCons(2*A_units + 3*B_units >= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A_units))\n    print(\"Number of units of Product B produced: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y purchased\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\n// Material_X_Cost = 10 * X\n// Material_Y_Cost = 15 * Y\n// Objective Function: Minimize: Material_X_Cost + Material_Y_Cost\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\n// 2 * A <= X\n// A <= Y\n\n## Generate Constraint-2:\nEach unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n// B <= X\n// 3 * B <= Y\n\n## Generate Constraint-3:\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\n// 10 * X + 15 * Y <= 1000\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand.\n// A >= 20\n// B >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs. The cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n\n| Product | Material X Required | Material Y Required |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 1 unit              |\n| B       | 1 unit              | 3 units             |\n\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000. The manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand. Please help the manufacturer to minimize the total cost of materials while meeting the production needs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of Product A and Product B to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The amount of Material X and Material Y purchased\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X purchased\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_X_Cost = 10 * X\n## Material_Y_Cost = 15 * Y\nmodel.addCons(obj == 10*X + 15*Y)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\nmodel.addCons(2 * A <= X)\nmodel.addCons(A <= Y)\n## Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\nmodel.addCons(B <= X)\nmodel.addCons(3 * B <= Y)\n## The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\nmodel.addCons(10 * X + 15 * Y <= 1000)\n## The manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Amount of Material X purchased: \", model.getVal(X))\n    print(\"Amount of Material Y purchased: \", model.getVal(Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y purchased\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer aims to minimize the total cost of materials while meeting the production needs.\n// Material_X_Cost = 10 * X\n// Material_Y_Cost = 15 * Y\n// Objective Function: Minimize: Material_X_Cost + Material_Y_Cost\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\n// 2 * A <= X\n// A <= Y\n\n## Generate Constraint-2:\nEach unit of Product B requires 1 unit of Material X and 3 units of Material Y.\n// B <= X\n// 3 * B <= Y\n\n## Generate Constraint-3:\nThe manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\n// 10 * X + 15 * Y <= 1000\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand.\n// A >= 20\n// B >= 10",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how many units of Product A and Product B to produce, and how much of each material to purchase to meet the production needs while minimizing costs.\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y. Each unit of Product B requires 1 unit of Material X and 3 units of Material Y. The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000. The manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand.\nPlease help the manufacturer to minimize the total cost of materials while meeting the production needs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of Product A and Product B to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The amount of Material X and Material Y purchased\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X purchased\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_X_Cost = 10 * X\n## Material_Y_Cost = 15 * Y\nmodel.addCons(obj == 10*X + 15*Y)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Material X and 1 unit of Material Y.\nmodel.addCons(2 * A <= X)\nmodel.addCons(A <= Y)\n## Each unit of Product B requires 1 unit of Material X and 3 units of Material Y.\nmodel.addCons(B <= X)\nmodel.addCons(3 * B <= Y)\n## The manufacturer has a budget constraint where the total cost of materials cannot exceed $1000.\nmodel.addCons(10 * X + 15 * Y <= 1000)\n## The manufacturer must produce at least 20 units of Product A and 10 units of Product B to meet market demand.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Amount of Material X purchased: \", model.getVal(X))\n    print(\"Amount of Material Y purchased: \", model.getVal(Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from producing both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 500 units. Each unit of Product A requires 2 units of raw material, and each unit of Product B requires 3 units of raw material.\n// 2*A + 3*B <= 500\n\n## Generate Constraint-2:\nThe total amount of labor available is 400 hours. Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor.\n// A + 2*B <= 400\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 50 units.\n// B >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor. The profit per unit for Product A is $50 and for Product B is $70. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Raw Material per Unit | Labor per Unit |\n|---------|-----------------|-----------------------|----------------|\n| A       | $50             | 2 units               | 1 hour         |\n| B       | $70             | 3 units               | 2 hours        |\n\nThe total amount of raw materials available is 500 units, and the total amount of labor available is 400 hours. The market demand for Product A is at least 100 units, and for Product B is at least 50 units. Please help the manufacturer to maximize the total profit from producing both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The total amount of raw materials available is 500 units.\nmodel.addCons(2*A + 3*B <= 500)\n## The total amount of labor available is 400 hours.\nmodel.addCons(A + 2*B <= 400)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The market demand for Product B is at least 50 units.\nmodel.addCons(B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires a certain amount of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material used for Product A\": \"raw_A\", \"range\": \"raw_A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material used for Product B\": \"raw_B\", \"range\": \"raw_B >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product A\": \"labor_A\", \"range\": \"labor_A >= 0\", \"type\": \"real\"}\n// {\"amount of labor used for Product B\": \"labor_B\", \"range\": \"labor_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from producing both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 500 units. Each unit of Product A requires 2 units of raw material, and each unit of Product B requires 3 units of raw material.\n// 2*A + 3*B <= 500\n\n## Generate Constraint-2:\nThe total amount of labor available is 400 hours. Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor.\n// A + 2*B <= 400\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 50 units.\n// B >= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer needs to decide how many units of each product to produce to maximize profit, considering the availability of raw materials and labor. The total amount of raw materials available is 500 units, with each unit of Product A requiring 2 units of raw material and each unit of Product B requiring 3 units of raw material. The total amount of labor available is 400 hours, with each unit of Product A requiring 1 hour of labor and each unit of Product B requiring 2 hours of labor. The market demand for Product A is at least 100 units, and the market demand for Product B is at least 50 units. Please help the manufacturer determine the optimal number of units of Product A and Product B to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The total amount of raw materials available is 500 units.\nmodel.addCons(2*A + 3*B <= 500)\n## The total amount of labor available is 400 hours.\nmodel.addCons(A + 2*B <= 400)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The market demand for Product B is at least 50 units.\nmodel.addCons(B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of all loaves\": \"Total\", \"range\": \"Total >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The objective is to determine the optimal number of loaves of each type to maximize the daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 400 loaves.\n// Wheat + Rye + Sourdough <= 400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, ensuring that the number of sourdough loaves is at least half the number of rye loaves.\n// Sourdough >= 0.5 * Rye",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time. The selling prices for each type of bread are as follows: wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf.\n\n| Bread Type | Selling Price | Flour Required (pounds) |\n|------------|---------------|-------------------------|\n| Wheat      | $3            | 0.5                     |\n| Rye        | $4            | 0.4                     |\n| Sourdough  | $5            | 0.6                     |\n\nThe bakery has a limited supply of flour, with a total daily supply of 200 pounds. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The bakery has a daily production capacity of 400 loaves. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Additionally, the bakery aims to maintain a balanced product mix, ensuring that the number of sourdough loaves is at least half the number of rye loaves.\n\nPlease help the bakery determine the optimal number of loaves of each type to maximize the daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nTotal = model.addVar(vtype=\"INTEGER\", name=\"Total\", lb=0) # total number of loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a daily production capacity of 400 loaves.\nmodel.addCons(Wheat + Rye + Sourdough <= 400)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n## The bakery aims to maintain a balanced product mix.\nmodel.addCons(Sourdough >= 0.5 * Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1329,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of all loaves\": \"Total\", \"range\": \"Total >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The objective is to determine the optimal number of loaves of each type to maximize the daily revenue.\n// Objective Function: Maximize: 3*Wheat + 4*Rye + 5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, and each loaf of sourdough requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 400 loaves.\n// Wheat + Rye + Sourdough <= 400\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, ensuring that the number of sourdough loaves is at least half the number of rye loaves.\n// Sourdough >= 0.5 * Rye",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the limited resources such as flour and time. The bakery sells wheat bread for $3 per loaf, rye bread for $4 per loaf, and sourdough bread for $5 per loaf. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 pounds of flour, each loaf of rye bread requiring 0.4 pounds, and each loaf of sourdough requiring 0.6 pounds, with a total daily flour supply of 200 pounds. The bakery has a daily production capacity of 400 loaves. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Additionally, the bakery aims to maintain a balanced product mix, ensuring that the number of sourdough loaves is at least half the number of rye loaves. Please help the bakery determine the optimal number of loaves of each type to maximize the daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nTotal = model.addVar(vtype=\"INTEGER\", name=\"Total\", lb=0) # total number of loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye + 5*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a daily production capacity of 400 loaves.\nmodel.addCons(Wheat + Rye + Sourdough <= 400)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n## The bakery aims to maintain a balanced product mix.\nmodel.addCons(Sourdough >= 0.5 * Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of fallow land\": \"Fallow\", \"range\": \"Fallow >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// Wheat + Corn + Soy + Fallow = 100\n\n## Generate Constraint-2:\nAt least 20% of the land must be left fallow for soil regeneration.\n// Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow)\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\n// Soy >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 30 acres of corn to fulfill a contract with a local food processing company.\n// Corn >= 30",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and leave some land fallow. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre for each crop is as follows:\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $300            |\n| Soybeans | $250            |\n\nThe total available land for farming is 100 acres. At least 20% of the land must be left fallow for soil regeneration. The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock. Additionally, the farmer must plant at least 30 acres of corn to fulfill a contract with a local food processing company.\n\nPlease help the farmer to maximize his total profit from these crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop and fallow land\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nFallow = model.addVar(vtype=\"INTEGER\", name=\"Fallow\", lb=0) # acres of fallow land\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Fallow == 100)\n## At least 20% of the land must be left fallow for soil regeneration.\nmodel.addCons(Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow))\n## The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\nmodel.addCons(Soy >= 10)\n## The farmer must plant at least 30 acres of corn to fulfill a contract with a local food processing company.\nmodel.addCons(Corn >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Fallow Land: \", model.getVal(Fallow))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of fallow land\": \"Fallow\", \"range\": \"Fallow >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// Wheat + Corn + Soy + Fallow = 100\n\n## Generate Constraint-2:\nAt least 20% of the land must be left fallow for soil regeneration.\n// Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow)\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\n// Soy >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 30 acres of corn to fulfill a contract with a local food processing company.\n// Corn >= 30",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The total available land for farming is 100 acres. At least 20% of the land must be left fallow for soil regeneration. The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock. The farmer must also plant at least 30 acres of corn to fulfill a contract with a local food processing company. Please help the farmer to maximize his total profit from these crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop and fallow land\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nFallow = model.addVar(vtype=\"INTEGER\", name=\"Fallow\", lb=0) # acres of fallow land\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Fallow == 100)\n## At least 20% of the land must be left fallow for soil regeneration.\nmodel.addCons(Fallow >= 0.20 * (Wheat + Corn + Soy + Fallow))\n## The farmer must plant at least 10 acres of soybeans to meet the nutritional needs of his livestock.\nmodel.addCons(Soy >= 10)\n## The farmer must plant at least 30 acres of corn to fulfill a contract with a local food processing company.\nmodel.addCons(Corn >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Fallow Land: \", model.getVal(Fallow))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\n// Wheat >= 10\n// Soy >= 15\n\n## Generate Constraint-3:\nDue to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\n// Corn + Barley <= 40\n\n## Generate Constraint-4:\nThe farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn.\n// Soy <= Wheat + Corn",
        "question": "A farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources. The profit per acre for each crop is given in the following Table.\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $300            |\n| Soybeans | $250            |\n| Barley   | $150            |\n\nThe total available land for planting is 100 acres. The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans. Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres. The farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn.\n\nPlease help the farmer to maximize his total profit from these crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Soy >= 15)\n## Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\nmodel.addCons(Corn + Barley <= 40)\n## The farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn.\nmodel.addCons(Soy <= Wheat + Corn)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The farmer wants to maximize his total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\n// Wheat >= 10\n// Soy >= 15\n\n## Generate Constraint-3:\nDue to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\n// Corn + Barley <= 40\n\n## Generate Constraint-4:\nThe farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn.\n// Soy <= Wheat + Corn",
        "question": "A farmer is planning to plant four different crops on his land: wheat, corn, soybeans, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the limitations of his land and resources. The profit per acre for wheat is $200, for corn is $300, for soybeans is $250, and for barley is $150. The total available land for planting is 100 acres. The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans. Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres. The farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn. Please help the farmer to maximize his total profit from these crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer has a contract that requires him to plant at least 10 acres of wheat and 15 acres of soybeans.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Soy >= 15)\n## Due to soil conditions, the total area of corn and barley combined cannot exceed 40 acres.\nmodel.addCons(Corn + Barley <= 40)\n## The farmer must also ensure that the total area of soybeans does not exceed the combined area of wheat and corn.\nmodel.addCons(Soy <= Wheat + Corn)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed grain loaves\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient.\n// Wheat <= 200\n// Rye <= 150\n// Sourdough <= 100\n\n## Generate Constraint-2:\nThe mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient.\n// Mixed <= 200 (Wheat flour constraint)\n// Mixed <= 150 (Rye flour constraint)\n// Mixed <= 100 (Sourdough starter constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + Mixed >= 50\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 20 loaves of each type of bread to a local restaurant.\n// Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20\n// Mixed >= 20",
        "question": "A bakery is planning to produce four types of bread: wheat, rye, sourdough, and mixed grain. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The selling price for each type of bread is as follows:\n\n| Bread Type     | Selling Price |\n|----------------|---------------|\n| Wheat          | $2            |\n| Rye            | $2.50         |\n| Sourdough      | $3            |\n| Mixed Grain    | $3.50         |\n\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient. The mixed grain loaf requires 1/2 pound of each type of flour, and the total amount of mixed grain loaves should not exceed the availability of any single ingredient.\n\nThe bakery must produce at least 50 loaves of bread in total each day and has a contract to supply at least 20 loaves of each type of bread to a local restaurant.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(Wheat <= 200) # Wheat flour is limited to 200 pounds\nmodel.addCons(Rye <= 150) # Rye flour to 150 pounds\nmodel.addCons(Sourdough <= 100) # Sourdough starter to 100 pounds\n## The mixed grain loaf requires 1/2 pound of each type of flour.\nmodel.addCons(Mixed <= 200) # Mixed should not exceed Wheat flour availability\nmodel.addCons(Mixed <= 150) # Mixed should not exceed Rye flour availability\nmodel.addCons(Mixed <= 100) # Mixed should not exceed Sourdough starter availability\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + Mixed >= 50)\n## The bakery has a contract to supply at least 20 loaves of each type of bread to a local restaurant.\nmodel.addCons(Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Mixed >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of mixed grain loaves: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements.\n// {\"number of wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of mixed grain loaves\": \"Mixed\", \"range\": \"Mixed >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient.\n// Wheat <= 200\n// Rye <= 150\n// Sourdough <= 100\n\n## Generate Constraint-2:\nThe mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient.\n// Mixed <= 200 (Wheat flour constraint)\n// Mixed <= 150 (Rye flour constraint)\n// Mixed <= 100 (Sourdough starter constraint)\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day.\n// Wheat + Rye + Sourdough + Mixed >= 50\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 20 loaves of each type of bread to a local restaurant.\n// Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20\n// Mixed >= 20",
        "question": "A bakery is planning to produce three types of bread: wheat, rye, and sourdough, as well as mixed grain loaves. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the limited availability of ingredients and the minimum daily production requirements. The bakery sells wheat loaves for $2 each, rye loaves for $2.50 each, sourdough loaves for $3 each, and mixed grain loaves for $3.50 each. The bakery aims to maximize its daily revenue from bread sales. The bakery has a limited supply of flour. Wheat flour is limited to 200 pounds, rye flour to 150 pounds, and sourdough starter to 100 pounds. Each loaf of bread requires 1 pound of its respective ingredient. The mixed grain loaf requires 1/2 pound of each type of flour. The total amount of mixed grain loaves should not exceed the availability of any single ingredient. The bakery must produce at least 50 loaves of bread in total each day. The bakery also has a contract to supply at least 20 loaves of each type of bread to a local restaurant. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\nMixed = model.addVar(vtype=\"INTEGER\", name=\"Mixed\", lb=0) # number of mixed grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 3.50*Mixed)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(Wheat <= 200) # Wheat flour is limited to 200 pounds\nmodel.addCons(Rye <= 150) # Rye flour to 150 pounds\nmodel.addCons(Sourdough <= 100) # Sourdough starter to 100 pounds\n## The mixed grain loaf requires 1/2 pound of each type of flour.\nmodel.addCons(Mixed <= 200) # Mixed should not exceed Wheat flour availability\nmodel.addCons(Mixed <= 150) # Mixed should not exceed Rye flour availability\nmodel.addCons(Mixed <= 100) # Mixed should not exceed Sourdough starter availability\n## The bakery must produce at least 50 loaves of bread in total each day.\nmodel.addCons(Wheat + Rye + Sourdough + Mixed >= 50)\n## The bakery has a contract to supply at least 20 loaves of each type of bread to a local restaurant.\nmodel.addCons(Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\nmodel.addCons(Mixed >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of mixed grain loaves: \", model.getVal(Mixed))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of pasture\": \"Pasture\", \"range\": \"Pasture >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The farmer wants to maximize his total profit from all crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 100*Pasture\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Pasture <= 100\n\n## Generate Constraint-2:\nThe farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\n// Corn >= 0.30 * (Wheat + Corn + Soy + Pasture)\n\n## Generate Constraint-3:\nThe farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\n// Soy >= 20\n\n## Generate Constraint-4:\nTo maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land.\n// Wheat + Corn <= 0.60 * (Wheat + Corn + Soy + Pasture)",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and also maintain some pasture. He needs to decide how many acres to allocate to each to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The farmer has a total of 100 acres available for planting. He needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock. Additionally, he must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company. To maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land.\n\nPlease help the farmer to maximize his total profit from all crops.\n\n| Crop       | Profit per Acre |\n|------------|-----------------|\n| Wheat      | $200            |\n| Corn       | $300            |\n| Soybeans   | $250            |\n| Pasture    | $100            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nPasture = model.addVar(vtype=\"INTEGER\", name=\"Pasture\", lb=0) # acres of pasture\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 100*Pasture)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Pasture <= 100)\n## The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\nmodel.addCons(Corn >= 0.30 * (Wheat + Corn + Soy + Pasture))\n## The farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\nmodel.addCons(Soy >= 20)\n## To maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land.\nmodel.addCons(Wheat + Corn <= 0.60 * (Wheat + Corn + Soy + Pasture))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Pasture: \", model.getVal(Pasture))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"integer\"}\n// {\"acres of pasture\": \"Pasture\", \"range\": \"Pasture >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The farmer wants to maximize his total profit from all crops.\n// Objective Function: Maximize: 200*Wheat + 300*Corn + 250*Soy + 100*Pasture\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Pasture <= 100\n\n## Generate Constraint-2:\nThe farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\n// Corn >= 0.30 * (Wheat + Corn + Soy + Pasture)\n\n## Generate Constraint-3:\nThe farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\n// Soy >= 20\n\n## Generate Constraint-4:\nTo maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land.\n// Wheat + Corn <= 0.60 * (Wheat + Corn + Soy + Pasture)",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans, and also needs to allocate some land for pasture. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the nutritional needs of his livestock. The profit per acre from wheat is $200, from corn is $300, from soybeans is $250, and from pasture is $100. The total available land for planting is 100 acres. The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock. He must also allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company. Additionally, to maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land. Please help the farmer to maximize his total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoy = model.addVar(vtype=\"INTEGER\", name=\"Soy\", lb=0) # acres of soybeans\nPasture = model.addVar(vtype=\"INTEGER\", name=\"Pasture\", lb=0) # acres of pasture\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 300*Corn + 250*Soy + 100*Pasture)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Pasture <= 100)\n## The farmer needs to ensure that at least 30% of the land is used for growing corn to meet the high nutritional needs of his livestock.\nmodel.addCons(Corn >= 0.30 * (Wheat + Corn + Soy + Pasture))\n## The farmer must allocate at least 20 acres to soybeans to fulfill a contract with a local food processing company.\nmodel.addCons(Soy >= 20)\n## To maintain soil health, the farmer must ensure that the total acres of wheat and corn do not exceed 60% of the total land.\nmodel.addCons(Wheat + Corn <= 0.60 * (Wheat + Corn + Soy + Pasture))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soy))\n    print(\"Acres of Pasture: \", model.getVal(Pasture))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively.\n// Objective Function: Maximize: 2b1 + 3b2 + 4b3 + 5b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively. The bakery has a daily supply of 100 kg of flour.\n// Constraint-1: 0.5b1 + 0.7b2 + 0.6b3 + 0.8b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast. The amount of yeast required to produce one loaf of Bread 1-4 is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. The bakery has a daily supply of 2 kg of yeast.\n// Constraint-2: 0.01b1 + 0.02b2 + 0.015b3 + 0.025b4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\n// Constraint-3: b1 >= 50\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of loaves produced does not exceed 200 to maintain quality.\n// Constraint-4: b1 + b2 + b3 + b4 <= 200",
        "question": "A bakery produces four types of bread (Bread 1-4) and must decide how many loaves of each type to produce daily. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively. The bakery has a limited daily supply of flour and yeast, with the amount of flour and yeast required to produce one loaf of each type of bread as shown in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Yeast Required (kg) |\n|------------|-----------------|---------------------|---------------------|\n| Bread 1    | $2              | 0.5                 | 0.01                |\n| Bread 2    | $3              | 0.7                 | 0.02                |\n| Bread 3    | $4              | 0.6                 | 0.015               |\n| Bread 4    | $5              | 0.8                 | 0.025               |\n\nThe bakery has a daily supply of 100 kg of flour and 2 kg of yeast. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation. Additionally, the bakery must ensure that the total number of loaves produced does not exceed 200 to maintain quality.\n\nPlease help the bakery maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*b1 + 3*b2 + 4*b3 + 5*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.6*b3 + 0.8*b4 <= 100)\n## The bakery also has a limited daily supply of yeast.\nmodel.addCons(0.01*b1 + 0.02*b2 + 0.015*b3 + 0.025*b4 <= 2)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(b1 >= 50)\n## The bakery must ensure that the total number of loaves produced does not exceed 200 to maintain quality.\nmodel.addCons(b1 + b2 + b3 + b4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively.\n// Objective Function: Maximize: 2b1 + 3b2 + 4b3 + 5b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively. The bakery has a daily supply of 100 kg of flour.\n// Constraint-1: 0.5b1 + 0.7b2 + 0.6b3 + 0.8b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast. The amount of yeast required to produce one loaf of Bread 1-4 is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. The bakery has a daily supply of 2 kg of yeast.\n// Constraint-2: 0.01b1 + 0.02b2 + 0.015b3 + 0.025b4 <= 2\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\n// Constraint-3: b1 >= 50\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of loaves produced does not exceed 200 to maintain quality.\n// Constraint-4: b1 + b2 + b3 + b4 <= 200",
        "question": "A bakery produces four types of bread (bread 1-4) and must decide how many loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2, $3, $4, and $5, respectively. The bakery has a limited daily supply of 100 kg of flour and 2 kg of yeast. The amount of flour required to produce one loaf of Bread 1-4 is 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg, respectively, and the amount of yeast required is 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg, respectively. The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation and must ensure that the total number of loaves produced does not exceed 200 to maintain quality. Please help the bakery maximize its daily profit from selling bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*b1 + 3*b2 + 4*b3 + 5*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.6*b3 + 0.8*b4 <= 100)\n## The bakery also has a limited daily supply of yeast.\nmodel.addCons(0.01*b1 + 0.02*b2 + 0.015*b3 + 0.025*b4 <= 2)\n## The bakery must produce at least 50 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(b1 >= 50)\n## The bakery must ensure that the total number of loaves produced does not exceed 200 to maintain quality.\nmodel.addCons(b1 + b2 + b3 + b4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many units of each widget to produce daily.\n// {\"number of units of Widget A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily revenue from selling these widgets.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each widget requires a certain amount of raw materials. The total raw materials available daily are limited to 100 units.\n// Constraint-1: 5a + 3b + 4c + 2d <= 100\n\n## Generate Constraint-2:\nThe production of each widget requires a certain amount of labor hours. The total labor hours available daily are limited to 80 hours.\n// Constraint-2: 2a + 4b + 3c + 1d <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 50 units. This constraint ensures that the total number of widgets produced does not exceed the storage capacity.\n// Constraint-3: a + b + c + d <= 50\n\n## Generate Constraint-4:\nThe company has a minimum production requirement for Widget A, which must be at least 5 units per day.\n// Constraint-4: a >= 5",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many units of each widget to produce daily. The company aims to maximize its daily revenue from selling these widgets. The following table provides the revenue per unit for each widget.\n\n| Widget | Revenue per Unit |\n|--------|------------------|\n| A      | 50$              |\n| B      | 30$              |\n| C      | 40$              |\n| D      | 20$              |\n\nThe company faces several constraints:\n1. The total raw materials available daily are limited to 100 units.\n2. The total labor hours available daily are limited to 80 hours.\n3. The company has a storage capacity limit of 50 units.\n4. The company has a minimum production requirement for Widget A, which must be at least 5 units per day.\n\nPlease help the company determine the optimal number of units to produce for each widget to maximize its daily revenue while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Widget A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Widget B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Widget C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available daily are limited to 100 units.\nmodel.addCons(5*a + 3*b + 4*c + 2*d <= 100)\n## Constraint-2: The total labor hours available daily are limited to 80 hours.\nmodel.addCons(2*a + 4*b + 3*c + 1*d <= 80)\n## Constraint-3: The company has a storage capacity limit of 50 units.\nmodel.addCons(a + b + c + d <= 50)\n## Constraint-4: The company has a minimum production requirement for Widget A, which must be at least 5 units per day.\nmodel.addCons(a >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Widget A: \", model.getVal(a))\n    print(\"Number of units of Widget B: \", model.getVal(b))\n    print(\"Number of units of Widget C: \", model.getVal(c))\n    print(\"Number of units of Widget D: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many units of each widget to produce daily.\n// {\"number of units of Widget A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Widget D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily revenue from selling these widgets.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each widget requires a certain amount of raw materials. The total raw materials available daily are limited to 100 units.\n// Constraint-1: 5a + 3b + 4c + 2d <= 100\n\n## Generate Constraint-2:\nThe production of each widget requires a certain amount of labor hours. The total labor hours available daily are limited to 80 hours.\n// Constraint-2: 2a + 4b + 3c + 1d <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 50 units. This constraint ensures that the total number of widgets produced does not exceed the storage capacity.\n// Constraint-3: a + b + c + d <= 50\n\n## Generate Constraint-4:\nThe company has a minimum production requirement for Widget A, which must be at least 5 units per day.\n// Constraint-4: a >= 5",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many units of each widget to produce daily. The company aims to maximize its daily revenue from selling these widgets. The production of each widget requires a certain amount of raw materials, with a daily limit of 100 units. It also requires a certain amount of labor hours, with a daily limit of 80 hours. The company has a storage capacity limit of 50 units, ensuring that the total number of widgets produced does not exceed this capacity. Additionally, the company has a minimum production requirement for Widget A, which must be at least 5 units per day.\nPlease help the company determine the optimal number of units to produce for each widget to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Widget A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Widget B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Widget C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available daily are limited to 100 units.\nmodel.addCons(5*a + 3*b + 4*c + 2*d <= 100)\n## Constraint-2: The total labor hours available daily are limited to 80 hours.\nmodel.addCons(2*a + 4*b + 3*c + 1*d <= 80)\n## Constraint-3: The company has a storage capacity limit of 50 units.\nmodel.addCons(a + b + c + d <= 50)\n## Constraint-4: The company has a minimum production requirement for Widget A, which must be at least 5 units per day.\nmodel.addCons(a >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Widget A: \", model.getVal(a))\n    print(\"Number of units of Widget B: \", model.getVal(b))\n    print(\"Number of units of Widget C: \", model.getVal(c))\n    print(\"Number of units of Widget D: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread per day.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\n// Constraint-3: w >= 2s\n\n## Generate Constraint-4:\nThe bakery must ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves.\n// Constraint-4: g + s <= 120",
        "question": "A bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Wheat      | 2$              |\n| Rye        | 3$              |\n| Sourdough  | 4$              |\n| Whole Grain| 3$              |\n\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery has a contract to supply at least 30 loaves of rye bread per day. Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves. The bakery must ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*g)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread per day.\nmodel.addCons(r >= 30)\n## Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\nmodel.addCons(w >= 2*s)\n## The bakery must ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves.\nmodel.addCons(g + s <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of whole grain bread loaves: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread per day.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\n// Constraint-3: w >= 2s\n\n## Generate Constraint-4:\nThe bakery must ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves.\n// Constraint-4: g + s <= 120",
        "question": "A bakery wants to optimize its daily production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many loaves of each type to produce. The bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for whole grain. The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day. The bakery has a contract to supply at least 30 loaves of rye bread per day. Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves. The bakery must also ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves. Please help the bakery determine the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*g)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread per day.\nmodel.addCons(r >= 30)\n## Due to market demand, the bakery must produce at least twice as many wheat bread loaves as sourdough loaves.\nmodel.addCons(w >= 2*s)\n## The bakery must ensure that the total production of whole grain and sourdough bread does not exceed 120 loaves.\nmodel.addCons(g + s <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of whole grain bread loaves: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling all four products.\n// Objective Function: Maximize: 50a + 70b + 60c + 80d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10a + 15b + 20c + 25d <= 1000\n\n## Generate Constraint-2:\nThe production process also requires labor hours. The total labor hours available are limited to 800 hours.\n// Constraint-2: 5a + 10b + 15c + 20d <= 800\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// Constraint-3: a >= 2b\n\n## Generate Constraint-4:\nThe company has a storage capacity limit that allows for a maximum of 100 units of any combination of products.\n// Constraint-4: a + b + c + d <= 100",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced. The company aims to maximize its total profit from selling all four products. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n| D       | 80$             |\n\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units. The production process also requires labor hours, and the total labor hours available are limited to 800 hours. Due to market demand, the production of Product A must be at least twice the production of Product B. The company has a storage capacity limit that allows for a maximum of 100 units of any combination of products.\n\nPlease help the company determine the optimal number of units of each product to produce to maximize its total profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to be produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 70*b + 60*c + 80*d)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*a + 15*b + 20*c + 25*d <= 1000)\n## The total labor hours available are limited to 800 hours.\nmodel.addCons(5*a + 10*b + 15*c + 20*d <= 800)\n## The production of Product A must be at least twice the production of Product B.\nmodel.addCons(a >= 2*b)\n## The company has a storage capacity limit that allows for a maximum of 100 units of any combination of products.\nmodel.addCons(a + b + c + d <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling all four products.\n// Objective Function: Maximize: 50a + 70b + 60c + 80d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available are limited to 1000 units.\n// Constraint-1: 10a + 15b + 20c + 25d <= 1000\n\n## Generate Constraint-2:\nThe production process also requires labor hours. The total labor hours available are limited to 800 hours.\n// Constraint-2: 5a + 10b + 15c + 20d <= 800\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// Constraint-3: a >= 2b\n\n## Generate Constraint-4:\nThe company has a storage capacity limit that allows for a maximum of 100 units of any combination of products.\n// Constraint-4: a + b + c + d <= 100",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision variables represent the number of units of each product to be produced. The company aims to maximize its total profit from selling all four products. The production of each product requires a certain amount of raw materials, and the total raw materials available are limited to 1000 units. The production process also requires labor hours, and the total labor hours available are limited to 800 hours. Due to market demand, the production of Product A must be at least twice the production of Product B. Additionally, the company has a storage capacity limit that allows for a maximum of 100 units of any combination of products. Please help the company determine the optimal number of units of each product to produce to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to be produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 70*b + 60*c + 80*d)\n\n# Add constraints\n## The total raw materials available are limited to 1000 units.\nmodel.addCons(10*a + 15*b + 20*c + 25*d <= 1000)\n## The total labor hours available are limited to 800 hours.\nmodel.addCons(5*a + 10*b + 15*c + 20*d <= 800)\n## The production of Product A must be at least twice the production of Product B.\nmodel.addCons(a >= 2*b)\n## The company has a storage capacity limit that allows for a maximum of 100 units of any combination of products.\nmodel.addCons(a + b + c + d <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily.\n// {\"number of wheat breads\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3w + 4r + 5s + 6m\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg.\n// Constraint: 0.5w + 0.4r + 0.6s + 0.7m <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg.\n// Constraint: 0.1w + 0.15r + 0.2s + 0.25m <= 10\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement.\n// Constraint: w >= 20\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total number of breads produced does not exceed 200 due to oven capacity limitations.\n// Constraint: w + r + s + m <= 200",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling these bread types. The bakery has a limited daily supply of flour and yeast, and there are contractual and oven capacity limitations. The requirements for each type of bread are given in the following Table.\n\n| Bread Type | Flour Requirement (kg) | Yeast Requirement (kg) |\n|------------|------------------------|------------------------|\n| Wheat      | 0.5                    | 0.1                    |\n| Rye        | 0.4                    | 0.15                   |\n| Sourdough  | 0.6                    | 0.2                    |\n| Multigrain | 0.7                    | 0.25                   |\n\nThe bakery has a limited daily supply of flour, which is 100 kg, and a limited daily supply of yeast, which is 10 kg. The bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement. Additionally, the bakery must ensure that the total number of breads produced does not exceed 200 due to oven capacity limitations. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat breads\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye breads\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough breads\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 6*m)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*w + 0.4*r + 0.6*s + 0.7*m <= 100)\n## The bakery has a limited daily supply of yeast\nmodel.addCons(0.1*w + 0.15*r + 0.2*s + 0.25*m <= 10)\n## The bakery must ensure that at least 20 wheat breads are produced daily\nmodel.addCons(w >= 20)\n## The bakery must ensure that the total number of breads produced does not exceed 200\nmodel.addCons(w + r + s + m <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(w))\n    print(\"Number of rye breads: \", model.getVal(r))\n    print(\"Number of sourdough breads: \", model.getVal(s))\n    print(\"Number of multigrain breads: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily.\n// {\"number of wheat breads\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of multigrain breads\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3w + 4r + 5s + 6m\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg.\n// Constraint: 0.5w + 0.4r + 0.6s + 0.7m <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg.\n// Constraint: 0.1w + 0.15r + 0.2s + 0.25m <= 10\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement.\n// Constraint: w >= 20\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total number of breads produced does not exceed 200 due to oven capacity limitations.\n// Constraint: w + r + s + m <= 200",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery must decide how many of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling these bread types. The bakery has a limited daily supply of flour, which is 100 kg. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, each sourdough bread requires 0.6 kg, and each multigrain bread requires 0.7 kg. The bakery also has a limited daily supply of yeast, which is 10 kg. Each wheat bread requires 0.1 kg of yeast, each rye bread requires 0.15 kg, each sourdough bread requires 0.2 kg, and each multigrain bread requires 0.25 kg. The bakery must ensure that at least 20 wheat breads are produced daily due to a contractual agreement. The bakery must also ensure that the total number of breads produced does not exceed 200 due to oven capacity limitations.\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat breads\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye breads\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough breads\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # number of multigrain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 6*m)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*w + 0.4*r + 0.6*s + 0.7*m <= 100)\n## The bakery has a limited daily supply of yeast\nmodel.addCons(0.1*w + 0.15*r + 0.2*s + 0.25*m <= 10)\n## The bakery must ensure that at least 20 wheat breads are produced daily\nmodel.addCons(w >= 20)\n## The bakery must ensure that the total number of breads produced does not exceed 200\nmodel.addCons(w + r + s + m <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(w))\n    print(\"Number of rye breads: \", model.getVal(r))\n    print(\"Number of sourdough breads: \", model.getVal(s))\n    print(\"Number of multigrain breads: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available for production are limited to 1000 units.\n// Constraint-1: 10a + 5b + 8c + 3d <= 1000\n\n## Generate Constraint-2:\nThe production of each product requires a certain amount of labor hours. The total labor hours available for production are limited to 800 hours.\n// Constraint-2: 20a + 15b + 10c + 5d <= 800\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 500 units.\n// Constraint-3: a + b + c + d <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of Product A to meet a contract obligation.\n// Constraint-4: a >= 50",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The details of the products are given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 30$             |\n| C       | 40$             |\n| D       | 20$             |\n\nThe production of each product requires a certain amount of raw materials and labor hours. The total raw materials available for production are limited to 1000 units, and the total labor hours available for production are limited to 800 hours. The company also has a storage capacity limit of 500 units. Additionally, the company must produce at least 50 units of Product A to meet a contract obligation.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, considering all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available for production are limited to 1000 units.\nmodel.addCons(10*a + 5*b + 8*c + 3*d <= 1000)\n## Constraint-2: The total labor hours available for production are limited to 800 hours.\nmodel.addCons(20*a + 15*b + 10*c + 5*d <= 800)\n## Constraint-3: The company has a storage capacity limit of 500 units.\nmodel.addCons(a + b + c + d <= 500)\n## Constraint-4: The company must produce at least 50 units of Product A to meet a contract obligation.\nmodel.addCons(a >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of raw materials. The total raw materials available for production are limited to 1000 units.\n// Constraint-1: 10a + 5b + 8c + 3d <= 1000\n\n## Generate Constraint-2:\nThe production of each product requires a certain amount of labor hours. The total labor hours available for production are limited to 800 hours.\n// Constraint-2: 20a + 15b + 10c + 5d <= 800\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 500 units.\n// Constraint-3: a + b + c + d <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of Product A to meet a contract obligation.\n// Constraint-4: a >= 50",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. The production of each product requires a certain amount of raw materials, and the total raw materials available for production are limited to 1000 units. The production also requires a certain amount of labor hours, and the total labor hours available for production are limited to 800 hours. The company has a storage capacity limit of 500 units. Additionally, the company must produce at least 50 units of Product A to meet a contract obligation.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The total raw materials available for production are limited to 1000 units.\nmodel.addCons(10*a + 5*b + 8*c + 3*d <= 1000)\n## Constraint-2: The total labor hours available for production are limited to 800 hours.\nmodel.addCons(20*a + 15*b + 10*c + 5*d <= 800)\n## Constraint-3: The company has a storage capacity limit of 500 units.\nmodel.addCons(a + b + c + d <= 500)\n## Constraint-4: The company must produce at least 50 units of Product A to meet a contract obligation.\nmodel.addCons(a >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many of each type of widget to produce daily.\n// {\"number of Widget A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Widget D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily profit from widget sales. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited daily production capacity of 200 widgets.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nDue to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\n// Constraint-2: b <= 2a\n\n## Generate Constraint-3:\nThe demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\n// Constraint-3: c >= 0.20 * (a + b + d)\n\n## Generate Constraint-4:\nThe company must produce at least 50 widgets in total each day to meet minimum operational requirements.\n// Constraint-4: a + b + c + d >= 50",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many of each type of widget to produce daily. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D. The company has a limited daily production capacity of 200 widgets. Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A. The demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D. The company must also produce at least 50 widgets in total each day to meet minimum operational requirements.\n\n| Widget | Profit per Widget |\n|--------|-------------------|\n| A      | $5                |\n| B      | $7                |\n| C      | $6                |\n| D      | $8                |\n\nPlease help the company to maximize its daily profit from widget sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of widget produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Widget A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Widget B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Widget C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Widget D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited daily production capacity of 200 widgets.\nmodel.addCons(a + b + c + d <= 200)\n## Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\nmodel.addCons(b <= 2*a)\n## The demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\nmodel.addCons(c >= 0.20 * (a + b + d))\n## The company must produce at least 50 widgets in total each day to meet minimum operational requirements.\nmodel.addCons(a + b + c + d >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(a))\n    print(\"Number of Widget B produced: \", model.getVal(b))\n    print(\"Number of Widget C produced: \", model.getVal(c))\n    print(\"Number of Widget D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The company must decide how many of each type of widget to produce daily.\n// {\"number of Widget A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Widget D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its daily profit from widget sales. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited daily production capacity of 200 widgets.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nDue to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\n// Constraint-2: b <= 2a\n\n## Generate Constraint-3:\nThe demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\n// Constraint-3: c >= 0.20 * (a + b + d)\n\n## Generate Constraint-4:\nThe company must produce at least 50 widgets in total each day to meet minimum operational requirements.\n// Constraint-4: a + b + c + d >= 50",
        "question": "A company produces four types of widgets (widgets A-D) and must decide how many of each type to produce daily. The profit per widget is $5 for Widget A, $7 for Widget B, $6 for Widget C, and $8 for Widget D. The company has a limited daily production capacity of 200 widgets. Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A. The demand for Widget C requires its production to be at least 20% of the total production of Widgets A, B, and D. Additionally, the company must produce at least 50 widgets in total each day to meet minimum operational requirements.\n\nPlease help the company maximize its daily profit from widget sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of widget produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Widget A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Widget B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Widget C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Widget D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited daily production capacity of 200 widgets.\nmodel.addCons(a + b + c + d <= 200)\n## Due to raw material constraints, the production of Widget B cannot exceed twice the production of Widget A.\nmodel.addCons(b <= 2*a)\n## The demand for Widget C is such that its production must be at least 20% of the total production of Widgets A, B, and D.\nmodel.addCons(c >= 0.20 * (a + b + d))\n## The company must produce at least 50 widgets in total each day to meet minimum operational requirements.\nmodel.addCons(a + b + c + d >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(a))\n    print(\"Number of Widget B produced: \", model.getVal(b))\n    print(\"Number of Widget C produced: \", model.getVal(c))\n    print(\"Number of Widget D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not.\n// {\"whether to invest in Project A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from all the projects.\n// Objective Function: Maximize: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,500,000 for all projects.\n// Constraint-1: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000\n\n## Generate Constraint-2:\nDue to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint-2: y1 + y2 + y3 + y4 <= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\n// Constraint-3: y1 + y2 <= 1\n\n## Generate Constraint-4:\nProject C requires a partnership with Project D; if one is invested in, the other must also be invested in.\n// Constraint-4: y3 - y4 = 0",
        "question": "A company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not. The company aims to maximize the total expected return from all the projects, which is given in the following Table.\n\n| Project | Expected Return |\n|---------|-----------------|\n| A       | 500,000$        |\n| B       | 750,000$        |\n| C       | 600,000$        |\n| D       | 800,000$        |\n\nThe company has a budget constraint of $1,500,000 for all projects. Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously. Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together. Project C requires a partnership with Project D; if one is invested in, the other must also be invested in.\n\nPlease help the company determine the optimal investment strategy to maximize its total expected return.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to invest in Project A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to invest in Project B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to invest in Project C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4)\n\n# Add constraints\n## The company has a budget constraint of $1,500,000 for all projects.\nmodel.addCons(500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000)\n## Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(y1 + y2 + y3 + y4 <= 2)\n## Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\nmodel.addCons(y1 + y2 <= 1)\n## Project C requires a partnership with Project D; if one is invested in, the other must also be invested in.\nmodel.addCons(y3 - y4 == 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project A: \", model.getVal(y1))\n    print(\"Whether to invest in Project B: \", model.getVal(y2))\n    print(\"Whether to invest in Project C: \", model.getVal(y3))\n    print(\"Whether to invest in Project D: \", model.getVal(y4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not.\n// {\"whether to invest in Project A\": \"y1\", \"range\": \"y1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"y2\", \"range\": \"y2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"y3\", \"range\": \"y3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"y4\", \"range\": \"y4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from all the projects.\n// Objective Function: Maximize: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,500,000 for all projects.\n// Constraint-1: 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000\n\n## Generate Constraint-2:\nDue to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint-2: y1 + y2 + y3 + y4 <= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\n// Constraint-3: y1 + y2 <= 1\n\n## Generate Constraint-4:\nProject C requires a partnership with Project D; if one is invested in, the other must also be invested in.\n// Constraint-4: y3 - y4 = 0",
        "question": "A company is planning to invest in four different projects (projects A-D) to maximize its returns. The decision is whether to invest in each project or not. The company aims to maximize the total expected return from all the projects. The company has a budget constraint of $1,500,000 for all projects. Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously. Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together. Project C requires a partnership with Project D; if one is invested in, the other must also be invested in. Please help the company determine the optimal investment strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\ny1 = model.addVar(vtype=\"BINARY\", name=\"y1\") # whether to invest in Project A\ny2 = model.addVar(vtype=\"BINARY\", name=\"y2\") # whether to invest in Project B\ny3 = model.addVar(vtype=\"BINARY\", name=\"y3\") # whether to invest in Project C\ny4 = model.addVar(vtype=\"BINARY\", name=\"y4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*y1 + 750000*y2 + 600000*y3 + 800000*y4)\n\n# Add constraints\n## The company has a budget constraint of $1,500,000 for all projects.\nmodel.addCons(500000*y1 + 750000*y2 + 600000*y3 + 800000*y4 <= 1500000)\n## Due to limited managerial resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(y1 + y2 + y3 + y4 <= 2)\n## Project A and Project B are mutually exclusive due to market overlap; they cannot be invested in together.\nmodel.addCons(y1 + y2 <= 1)\n## Project C requires a partnership with Project D; if one is invested in, the other must also be invested in.\nmodel.addCons(y3 - y4 == 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project A: \", model.getVal(y1))\n    print(\"Whether to invest in Project B: \", model.getVal(y2))\n    print(\"Whether to invest in Project C: \", model.getVal(y3))\n    print(\"Whether to invest in Project D: \", model.getVal(y4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 691,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30\n\n## Generate Constraint-4:\nThe bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n// Constraint-4: s <= 40",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales, with the profit per loaf being $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. Due to a contractual agreement, the bakery must ensure that at least 50 loaves of wheat bread are produced daily. The bakery also has a minimum demand for rye bread, which is 30 loaves per day. Additionally, the bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize their daily profit.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n| Multigrain    | $5              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n## The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\nmodel.addCons(s <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30\n\n## Generate Constraint-4:\nThe bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n// Constraint-4: s <= 40",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement. The bakery has a minimum demand for rye bread, which is 30 loaves per day. The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n## The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\nmodel.addCons(s <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 3 hours, Product C takes 1 hour, and Product D takes 2 hours. The total production hours available per day are 40 hours.\n// Constraint-2: 2a + 3b + c + 2d <= 40\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C, which must be at least 5 units.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of Product A does not exceed twice the production of Product B.\n// Constraint-4: a <= 2b",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the required raw material units, production hours, and profit per unit for each product.\n\n| Product | Raw Material Units | Production Hours | Profit per Unit |\n|---------|--------------------|------------------|-----------------|\n| A       | 3                  | 2                | 50$             |\n| B       | 2                  | 3                | 30$             |\n| C       | 4                  | 1                | 40$             |\n| D       | 1                  | 2                | 20$             |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production line has a limited capacity, with a total of 40 hours available per day. The company has a minimum order requirement for Product C, which must be at least 5 units. The company wants to ensure that the production of Product A does not exceed twice the production of Product B.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + c + 2*d <= 40)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that the production of Product A does not exceed twice the production of Product B.\nmodel.addCons(a <= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 3 hours, Product C takes 1 hour, and Product D takes 2 hours. The total production hours available per day are 40 hours.\n// Constraint-2: 2a + 3b + c + 2d <= 40\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C, which must be at least 5 units.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of Product A does not exceed twice the production of Product B.\n// Constraint-4: a <= 2b",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 3 hours, Product C requires 4 units of raw material and takes 1 hour, and Product D requires 1 unit of raw material and takes 2 hours. The total raw material available is 100 units, and the total production hours available per day are 40 hours. The company has a minimum order requirement for Product C, which must be at least 5 units. Additionally, the company wants to ensure that the production of Product A does not exceed twice the production of Product B. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + c + 2*d <= 40)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that the production of Product A does not exceed twice the production of Product B.\nmodel.addCons(a <= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0).\n// {\"whether to invest in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4.\n// Constraint: 250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000\n\n## Generate Constraint-2:\nDue to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint: p1 + p2 + p3 + p4 <= 2\n\n## Generate Constraint-3:\nProject 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\n// Constraint: p1 + p2 <= 1\n\n## Generate Constraint-4:\nProject 3 requires the completion of either Project 1 or Project 2 as a prerequisite.\n// Constraint: p3 <= p1 + p2",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision for each project is binary, meaning each project can either be invested in (1) or not (0). The company aims to maximize the total expected profit from all the projects. The expected profit from each project is as follows:\n\n| Project | Expected Profit |\n|---------|-----------------|\n| 1       | 500,000$        |\n| 2       | 300,000$        |\n| 3       | 400,000$        |\n| 4       | 200,000$        |\n\nThe company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4. Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously. Additionally, Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together. Project 3 requires the completion of either Project 1 or Project 2 as a prerequisite.\n\nPlease help the company determine the optimal investment strategy to maximize its total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\np1 = model.addVar(vtype=\"BINARY\", name=\"p1\") # whether to invest in Project 1\np2 = model.addVar(vtype=\"BINARY\", name=\"p2\") # whether to invest in Project 2\np3 = model.addVar(vtype=\"BINARY\", name=\"p3\") # whether to invest in Project 3\np4 = model.addVar(vtype=\"BINARY\", name=\"p4\") # whether to invest in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a budget constraint of $1,000,000.\nmodel.addCons(250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000)\n## Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(p1 + p2 + p3 + p4 <= 2)\n## Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\nmodel.addCons(p1 + p2 <= 1)\n## Project 3 requires the completion of either Project 1 or Project 2 as a prerequisite.\nmodel.addCons(p3 <= p1 + p2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project 1: \", model.getVal(p1))\n    print(\"Whether to invest in Project 2: \", model.getVal(p2))\n    print(\"Whether to invest in Project 3: \", model.getVal(p3))\n    print(\"Whether to invest in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0).\n// {\"whether to invest in Project 1\": \"p1\", \"range\": \"p1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 2\": \"p2\", \"range\": \"p2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 3\": \"p3\", \"range\": \"p3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project 4\": \"p4\", \"range\": \"p4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected profit from all the projects.\n// Objective Function: Maximize: 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4.\n// Constraint: 250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000\n\n## Generate Constraint-2:\nDue to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\n// Constraint: p1 + p2 + p3 + p4 <= 2\n\n## Generate Constraint-3:\nProject 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\n// Constraint: p1 + p2 <= 1\n\n## Generate Constraint-4:\nProject 3 requires the completion of either Project 1 or Project 2 as a prerequisite.\n// Constraint: p3 <= p1 + p2",
        "question": "A company is planning to invest in four different projects (projects 1-4) to maximize its profit. The decision is binary, meaning each project can either be invested in (1) or not (0). The company aims to maximize the total expected profit from all the projects. The company has a budget constraint of $1,000,000. The cost of each project is $250,000 for Project 1, $200,000 for Project 2, $300,000 for Project 3, and $150,000 for Project 4. Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously. Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together. Project 3 requires the completion of either Project 1 or Project 2 as a prerequisite. Please help the company determine the optimal investment strategy for these projects.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\np1 = model.addVar(vtype=\"BINARY\", name=\"p1\") # whether to invest in Project 1\np2 = model.addVar(vtype=\"BINARY\", name=\"p2\") # whether to invest in Project 2\np3 = model.addVar(vtype=\"BINARY\", name=\"p3\") # whether to invest in Project 3\np4 = model.addVar(vtype=\"BINARY\", name=\"p4\") # whether to invest in Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 500000*p1 + 300000*p2 + 400000*p3 + 200000*p4)\n\n# Add constraints\n## The company has a budget constraint of $1,000,000.\nmodel.addCons(250000*p1 + 200000*p2 + 300000*p3 + 150000*p4 <= 1000000)\n## Due to limited personnel resources, the company can only manage a maximum of two projects simultaneously.\nmodel.addCons(p1 + p2 + p3 + p4 <= 2)\n## Project 1 and Project 2 are mutually exclusive due to strategic reasons; they cannot be undertaken together.\nmodel.addCons(p1 + p2 <= 1)\n## Project 3 requires the completion of either Project 1 or Project 2 as a prerequisite.\nmodel.addCons(p3 <= p1 + p2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to invest in Project 1: \", model.getVal(p1))\n    print(\"Whether to invest in Project 2: \", model.getVal(p2))\n    print(\"Whether to invest in Project 3: \", model.getVal(p3))\n    print(\"Whether to invest in Project 4: \", model.getVal(p4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize their daily revenue from selling pastries. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5.\n// Objective Function: Maximize: 2c + 3m + 1.5d + 2.5e\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\n// Constraint-1: 0.5c + 0.7m + 0.4d + 0.6e <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\n// Constraint-2: 5c + 7m + 4d + 6e <= 600\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\n// Constraint-3: c >= 20, m >= 20, d >= 20, e >= 20\n\n## Generate Constraint-4:\nThe bakery wants to maintain a balanced production, ensuring that the number of doughnuts produced is at least half the number of croissants.\n// Constraint-4: d >= 0.5c",
        "question": "A bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs. The selling price and the cost of ingredients for each pastry are given in the following Table.\n\n| Pastry   | Selling Price | Cost of Ingredients | Oven Time (minutes) |\n|----------|---------------|---------------------|---------------------|\n| Croissant| 2$            | 0.5$                | 5                   |\n| Muffin   | 3$            | 0.7$                | 7                   |\n| Doughnut | 1.5$          | 0.4$                | 4                   |\n| Eclair   | 2.5$          | 0.6$                | 6                   |\n\nThe bakery has a limited daily budget for ingredients, with the total daily ingredient cost not exceeding $50. The bakery also has a limited oven capacity, with the total daily oven time not exceeding 600 minutes. The bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes. Additionally, the bakery wants to maintain a balanced production, ensuring that the number of doughnuts produced is at least half the number of croissants.\n\nPlease help the bakery to maximize their daily revenue from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of doughnuts\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*d + 2.5*e)\n\n# Add constraints\n## The total daily ingredient cost must not exceed $50.\nmodel.addCons(0.5*c + 0.7*m + 0.4*d + 0.6*e <= 50)\n## The total daily oven time must not exceed 600 minutes.\nmodel.addCons(5*c + 7*m + 4*d + 6*e <= 600)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(d >= 20)\nmodel.addCons(e >= 20)\n## The number of doughnuts produced is at least half the number of croissants.\nmodel.addCons(d >= 0.5*c)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of doughnuts: \", model.getVal(d))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"e\", \"range\": \"0 <= e <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize their daily revenue from selling pastries. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5.\n// Objective Function: Maximize: 2c + 3m + 1.5d + 2.5e\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget for ingredients. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The total daily ingredient cost must not exceed $50.\n// Constraint-1: 0.5c + 0.7m + 0.4d + 0.6e <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The total daily oven time must not exceed 600 minutes.\n// Constraint-2: 5c + 7m + 4d + 6e <= 600\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes.\n// Constraint-3: c >= 20, m >= 20, d >= 20, e >= 20\n\n## Generate Constraint-4:\nThe bakery wants to maintain a balanced production, ensuring that the number of doughnuts produced is at least half the number of croissants.\n// Constraint-4: d >= 0.5c",
        "question": "A bakery needs to decide how many of each type of pastry to produce daily. They have four types of pastries: croissants, muffins, doughnuts, and eclairs. Each croissant sells for $2, each muffin for $3, each doughnut for $1.5, and each eclair for $2.5. The bakery aims to maximize their daily revenue from selling pastries. The bakery has a limited daily budget for ingredients, with the total daily ingredient cost not exceeding $50. The cost of ingredients for each croissant is $0.5, for each muffin is $0.7, for each doughnut is $0.4, and for each eclair is $0.6. The bakery also has a limited oven capacity, with the total daily oven time not exceeding 600 minutes. Each croissant requires 5 minutes of oven time, each muffin requires 7 minutes, each doughnut requires 4 minutes, and each eclair requires 6 minutes. The bakery must ensure that at least 20 pastries of each type are produced to meet the minimum order requirements from local cafes. Additionally, the bakery wants to maintain a balanced production, ensuring that the number of doughnuts produced is at least half the number of croissants. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize their revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of muffins\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of doughnuts\ne = model.addVar(vtype=\"INTEGER\", name=\"e\", lb=0, ub=100) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*d + 2.5*e)\n\n# Add constraints\n## The total daily ingredient cost must not exceed $50.\nmodel.addCons(0.5*c + 0.7*m + 0.4*d + 0.6*e <= 50)\n## The total daily oven time must not exceed 600 minutes.\nmodel.addCons(5*c + 7*m + 4*d + 6*e <= 600)\n## The bakery must ensure that at least 20 pastries of each type are produced.\nmodel.addCons(c >= 20)\nmodel.addCons(m >= 20)\nmodel.addCons(d >= 20)\nmodel.addCons(e >= 20)\n## The number of doughnuts produced is at least half the number of croissants.\nmodel.addCons(d >= 0.5*c)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of doughnuts: \", model.getVal(d))\n    print(\"Number of eclairs: \", model.getVal(e))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit.\n// {\"units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively.\n// Objective Function: Maximize: 10a + 15b + 20c + 25d\n\n## Generate Constraint-1:\nThe production capacity of the company allows for a maximum of 100 units in total across all products.\n// Constraint-1: a + b + c + d <= 100\n\n## Generate Constraint-2:\nDue to limited resources, the production of Product B is limited to at most 30 units.\n// Constraint-2: b <= 30\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of Product A to fulfill a contract.\n// Constraint-3: a >= 20\n\n## Generate Constraint-4:\nThe production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units.\n// Constraint-4: |c - d| <= 10",
        "question": "A company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively. The company has a production capacity that allows for a maximum of 100 units in total across all products. Due to limited resources, the production of Product B is limited to at most 30 units. The company must produce at least 20 units of Product A to fulfill a contract. Additionally, the production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $10             |\n| B       | $15             |\n| C       | $20             |\n| D       | $25             |\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*a + 15*b + 20*c + 25*d)\n\n# Add constraints\n## The production capacity of the company allows for a maximum of 100 units in total across all products.\nmodel.addCons(a + b + c + d <= 100)\n## Due to limited resources, the production of Product B is limited to at most 30 units.\nmodel.addCons(b <= 30)\n## The company must produce at least 20 units of Product A to fulfill a contract.\nmodel.addCons(a >= 20)\n## The production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units.\nmodel.addCons(c - d <= 10)\nmodel.addCons(d - c <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A: \", model.getVal(a))\n    print(\"Units of Product B: \", model.getVal(b))\n    print(\"Units of Product C: \", model.getVal(c))\n    print(\"Units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit.\n// {\"units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively.\n// Objective Function: Maximize: 10a + 15b + 20c + 25d\n\n## Generate Constraint-1:\nThe production capacity of the company allows for a maximum of 100 units in total across all products.\n// Constraint-1: a + b + c + d <= 100\n\n## Generate Constraint-2:\nDue to limited resources, the production of Product B is limited to at most 30 units.\n// Constraint-2: b <= 30\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of Product A to fulfill a contract.\n// Constraint-3: a >= 20\n\n## Generate Constraint-4:\nThe production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units.\n// Constraint-4: |c - d| <= 10",
        "question": "A company needs to decide how many units of four different products (Product A, Product B, Product C, Product D) to produce to maximize profit. The profit per unit for Product A, B, C, and D are $10, $15, $20, and $25 respectively. The production capacity of the company allows for a maximum of 100 units in total across all products. Due to limited resources, the production of Product B is limited to at most 30 units. The company must produce at least 20 units of Product A to fulfill a contract. The production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units. Please help the company to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*a + 15*b + 20*c + 25*d)\n\n# Add constraints\n## The production capacity of the company allows for a maximum of 100 units in total across all products.\nmodel.addCons(a + b + c + d <= 100)\n## Due to limited resources, the production of Product B is limited to at most 30 units.\nmodel.addCons(b <= 30)\n## The company must produce at least 20 units of Product A to fulfill a contract.\nmodel.addCons(a >= 20)\n## The production of Product C and Product D must be balanced such that the difference in their quantities does not exceed 10 units.\nmodel.addCons(c - d <= 10)\nmodel.addCons(d - c <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A: \", model.getVal(a))\n    print(\"Units of Product B: \", model.getVal(b))\n    print(\"Units of Product C: \", model.getVal(c))\n    print(\"Units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"p\", \"range\": \"p >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling bread and pastries.\n// Objective Function: Maximize: 3w + 4r + 5s + 2p\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\n// Constraint-1: w + r + s <= 100\n\n## Generate Constraint-2:\nThe bakery's pastry oven can handle up to 50 pastries per day.\n// Constraint-2: p <= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 20 wheat bread loaves per day.\n// Constraint-3: w >= 20\n\n## Generate Constraint-4:\nDue to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day.\n// Constraint-4: w + r + s + p <= 120",
        "question": "A bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) and how many pastries to produce each day. The bakery aims to maximize its daily revenue from selling these items. The revenue from each type of item is as follows:\n\n| Item          | Revenue per Item |\n|---------------|------------------|\n| Wheat Bread   | 3$               |\n| Rye Bread     | 4$               |\n| Sourdough Bread | 5$             |\n| Pastries      | 2$               |\n\nThe bakery has the following constraints:\n- The main oven can bake a maximum of 100 bread loaves per day.\n- The pastry oven can handle up to 50 pastries per day.\n- The bakery has a contract to supply at least 20 wheat bread loaves per day.\n- Due to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day.\n\nPlease help the bakery determine the optimal number of each item to produce daily to maximize its revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastries\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough bread loaves\np = model.addVar(vtype=\"INTEGER\", name=\"p\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 2*p)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\nmodel.addCons(w + r + s <= 100)\n## The bakery's pastry oven can handle up to 50 pastries per day.\nmodel.addCons(p <= 50)\n## The bakery has a contract to supply at least 20 wheat bread loaves per day.\nmodel.addCons(w >= 20)\n## Due to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day.\nmodel.addCons(w + r + s + p <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of pastries: \", model.getVal(p))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of pastries\": \"p\", \"range\": \"p >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling bread and pastries.\n// Objective Function: Maximize: 3w + 4r + 5s + 2p\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\n// Constraint-1: w + r + s <= 100\n\n## Generate Constraint-2:\nThe bakery's pastry oven can handle up to 50 pastries per day.\n// Constraint-2: p <= 50\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 20 wheat bread loaves per day.\n// Constraint-3: w >= 20\n\n## Generate Constraint-4:\nDue to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day.\n// Constraint-4: w + r + s + p <= 120",
        "question": "A bakery needs to decide how many loaves of three types of bread (wheat, rye, and sourdough) to produce each day, as well as how many pastries to make. The bakery aims to maximize its daily revenue from selling bread and pastries. The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day. The bakery's pastry oven can handle up to 50 pastries per day. The bakery has a contract to supply at least 20 wheat bread loaves per day. Due to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day. Please help the bakery determine the optimal number of each product to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastries\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of sourdough bread loaves\np = model.addVar(vtype=\"INTEGER\", name=\"p\", lb=0) # number of pastries\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 4*r + 5*s + 2*p)\n\n# Add constraints\n## The bakery has a limited oven capacity, which can bake a maximum of 100 bread loaves per day.\nmodel.addCons(w + r + s <= 100)\n## The bakery's pastry oven can handle up to 50 pastries per day.\nmodel.addCons(p <= 50)\n## The bakery has a contract to supply at least 20 wheat bread loaves per day.\nmodel.addCons(w >= 20)\n## Due to staffing limitations, the total number of bread loaves and pastries produced cannot exceed 120 items per day.\nmodel.addCons(w + r + s + p <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of pastries: \", model.getVal(p))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce.\n// {\"number of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited budget and can only spend up to $1000 on production costs. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively.\n// Constraint-1: 20a + 15b + 25c + 10d <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce and can only produce up to 30 units in total.\n// Constraint-2: a + b + c + d <= 30\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\n// Constraint-3: a >= 5\n// Constraint-4: d <= 10\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units.\n// Constraint-5: |a - d| <= 5",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively. The company aims to maximize its total profit from selling these products, which is given by the following equation: 50a + 30b + 40c + 20d.\n\nThe company has a limited budget and can only spend up to $1000 on production costs. The company also has a limited workforce and can only produce up to 30 units in total. Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D. Additionally, the company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units.\n\nPlease help the company determine the optimal number of each product to produce to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited budget and can only spend up to $1000 on production costs.\nmodel.addCons(20*a + 15*b + 25*c + 10*d <= 1000)\n## The company has a limited workforce and can only produce up to 30 units in total.\nmodel.addCons(a + b + c + d <= 30)\n## Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\nmodel.addCons(a >= 5)\nmodel.addCons(d <= 10)\n## The company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units.\nmodel.addCons(abs(a - d) <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(a))\n    print(\"Number of Product B: \", model.getVal(b))\n    print(\"Number of Product C: \", model.getVal(c))\n    print(\"Number of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to produce four different types of products (Product A, B, C, D). The decision is to determine the number of each product to produce.\n// {\"number of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited budget and can only spend up to $1000 on production costs. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively.\n// Constraint-1: 20a + 15b + 25c + 10d <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce and can only produce up to 30 units in total.\n// Constraint-2: a + b + c + d <= 30\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\n// Constraint-3: a >= 5\n// Constraint-4: d <= 10\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units.\n// Constraint-5: |a - d| <= 5",
        "question": "A company is planning to produce four different types of products (Product A, B, C, D) and needs to determine the number of each product to produce. The company aims to maximize its total profit from selling these products. The cost of producing each unit of Product A, B, C, D is $20, $15, $25, $10 respectively, and the company has a limited budget of $1000 for production costs. The company also has a limited workforce and can only produce up to 30 units in total. Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D. Additionally, the company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units. Please help the company to maximize its total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product to produce\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited budget and can only spend up to $1000 on production costs.\nmodel.addCons(20*a + 15*b + 25*c + 10*d <= 1000)\n## The company has a limited workforce and can only produce up to 30 units in total.\nmodel.addCons(a + b + c + d <= 30)\n## Due to market demand, the company must produce at least 5 units of Product A and no more than 10 units of Product D.\nmodel.addCons(a >= 5)\nmodel.addCons(d <= 10)\n## The company wants to ensure a balanced product mix, so the difference between the number of Product A and Product D should not exceed 5 units.\nmodel.addCons(abs(a - d) <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(a))\n    print(\"Number of Product B: \", model.getVal(b))\n    print(\"Number of Product C: \", model.getVal(c))\n    print(\"Number of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0).\n// {\"whether to invest in Project A\": \"x1\", \"range\": \"x1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"x2\", \"range\": \"x2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"x3\", \"range\": \"x3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"x4\", \"range\": \"x4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively.\n// Objective Function: Maximize: 100000x1 + 150000x2 + 200000x3 + 120000x4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively.\n// Constraint: 50000x1 + 75000x2 + 100000x3 + 60000x4 <= 300000\n\n## Generate Constraint-2:\nDue to strategic considerations, the company must invest in at least two projects.\n// Constraint: x1 + x2 + x3 + x4 >= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive; the company cannot invest in both.\n// Constraint: x1 + x2 <= 1\n\n## Generate Constraint-4:\nProject C requires that either Project A or Project D must also be invested in, but not both.\n// Constraint: x3 <= x1 + x4, and x1 + x4 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0). The expected returns and costs for each project are given in the following Table.\n\n| Project | Expected Return | Cost |\n|---------|-----------------|------|\n| A       | $100,000        | $50,000 |\n| B       | $150,000        | $75,000 |\n| C       | $200,000        | $100,000 |\n| D       | $120,000        | $60,000 |\n\nThe company has a budget constraint of $300,000. Due to strategic considerations, the company must invest in at least two projects. Project A and Project B are mutually exclusive; the company cannot invest in both. Project C requires that either Project A or Project D must also be invested in, but not both. \n\nPlease help the company to maximize the total expected return from the investments.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\nx1 = model.addVar(vtype=\"BINARY\", name=\"x1\") # whether to invest in Project A\nx2 = model.addVar(vtype=\"BINARY\", name=\"x2\") # whether to invest in Project B\nx3 = model.addVar(vtype=\"BINARY\", name=\"x3\") # whether to invest in Project C\nx4 = model.addVar(vtype=\"BINARY\", name=\"x4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100000*x1 + 150000*x2 + 200000*x3 + 120000*x4)\n\n# Add constraints\n## The company has a budget constraint of $300,000.\nmodel.addCons(50000*x1 + 75000*x2 + 100000*x3 + 60000*x4 <= 300000)\n## Due to strategic considerations, the company must invest in at least two projects.\nmodel.addCons(x1 + x2 + x3 + x4 >= 2)\n## Project A and Project B are mutually exclusive; the company cannot invest in both.\nmodel.addCons(x1 + x2 <= 1)\n## Project C requires that either Project A or Project D must also be invested in, but not both.\nmodel.addCons(x3 <= x1 + x4)\nmodel.addCons(x1 + x4 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(x1))\n    print(\"Invest in Project B: \", model.getVal(x2))\n    print(\"Invest in Project C: \", model.getVal(x3))\n    print(\"Invest in Project D: \", model.getVal(x4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0).\n// {\"whether to invest in Project A\": \"x1\", \"range\": \"x1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project B\": \"x2\", \"range\": \"x2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project C\": \"x3\", \"range\": \"x3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to invest in Project D\": \"x4\", \"range\": \"x4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively.\n// Objective Function: Maximize: 100000x1 + 150000x2 + 200000x3 + 120000x4\n\n## Generate Constraint-1:\nThe company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively.\n// Constraint: 50000x1 + 75000x2 + 100000x3 + 60000x4 <= 300000\n\n## Generate Constraint-2:\nDue to strategic considerations, the company must invest in at least two projects.\n// Constraint: x1 + x2 + x3 + x4 >= 2\n\n## Generate Constraint-3:\nProject A and Project B are mutually exclusive; the company cannot invest in both.\n// Constraint: x1 + x2 <= 1\n\n## Generate Constraint-4:\nProject C requires that either Project A or Project D must also be invested in, but not both.\n// Constraint: x3 <= x1 + x4, and x1 + x4 <= 1",
        "question": "A company is planning to invest in four different projects (projects A-D). The decision to invest in each project is binary, meaning the company either invests (1) or does not invest (0). The company aims to maximize the total expected return from the investments. The expected returns for projects A, B, C, and D are $100,000, $150,000, $200,000, and $120,000, respectively. The company has a budget constraint of $300,000. The costs of projects A, B, C, and D are $50,000, $75,000, $100,000, and $60,000, respectively. Due to strategic considerations, the company must invest in at least two projects. Project A and Project B are mutually exclusive; the company cannot invest in both. Project C requires that either Project A or Project D must also be invested in, but not both. Please help the company determine the optimal investment strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to invest in each project\nx1 = model.addVar(vtype=\"BINARY\", name=\"x1\") # whether to invest in Project A\nx2 = model.addVar(vtype=\"BINARY\", name=\"x2\") # whether to invest in Project B\nx3 = model.addVar(vtype=\"BINARY\", name=\"x3\") # whether to invest in Project C\nx4 = model.addVar(vtype=\"BINARY\", name=\"x4\") # whether to invest in Project D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100000*x1 + 150000*x2 + 200000*x3 + 120000*x4)\n\n# Add constraints\n## The company has a budget constraint of $300,000.\nmodel.addCons(50000*x1 + 75000*x2 + 100000*x3 + 60000*x4 <= 300000)\n## Due to strategic considerations, the company must invest in at least two projects.\nmodel.addCons(x1 + x2 + x3 + x4 >= 2)\n## Project A and Project B are mutually exclusive; the company cannot invest in both.\nmodel.addCons(x1 + x2 <= 1)\n## Project C requires that either Project A or Project D must also be invested in, but not both.\nmodel.addCons(x3 <= x1 + x4)\nmodel.addCons(x1 + x4 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Invest in Project A: \", model.getVal(x1))\n    print(\"Invest in Project B: \", model.getVal(x2))\n    print(\"Invest in Project C: \", model.getVal(x3))\n    print(\"Invest in Project D: \", model.getVal(x4))\n    print(\"Maximized Total Expected Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours.\n// Constraint-1: 0.5w + 0.75r + s + 0.8m <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg.\n// Constraint-2: 0.5w + 0.6r + 0.7s + 0.8m <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Constraint-3: w >= 20, r >= 20, s >= 20, m >= 20\n\n## Generate Constraint-4:\nThe bakery needs to ensure that the total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined.\n// Constraint-4: w + r <= 2(s + m)",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from selling these bread types. The profit per loaf and the time and flour requirements for each bread type are given in the following Table.\n\n| Bread Type | Profit per Loaf | Baking Time per Loaf | Flour Required per Loaf |\n|------------|-----------------|----------------------|-------------------------|\n| Wheat      | $2              | 0.5 hours            | 0.5 kg                  |\n| Rye        | $3              | 0.75 hours           | 0.6 kg                  |\n| Sourdough  | $4              | 1 hour               | 0.7 kg                  |\n| Multigrain | $3              | 0.8 hours            | 0.8 kg                  |\n\nThe bakery has a limited oven capacity of 100 hours per day and a daily supply of 150 kg of flour. The bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. Additionally, the bakery needs to ensure that the total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # quantity of sourdough bread\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 100 hours per day.\nmodel.addCons(0.5*w + 0.75*r + s + 0.8*m <= 100)\n## The bakery has a daily supply of 150 kg of flour.\nmodel.addCons(0.5*w + 0.6*r + 0.7*s + 0.8*m <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(w >= 20)\nmodel.addCons(r >= 20)\nmodel.addCons(s >= 20)\nmodel.addCons(m >= 20)\n## The total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined.\nmodel.addCons(w + r <= 2*(s + m))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of multigrain bread: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"w >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"r >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"m\", \"range\": \"m >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 3m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours.\n// Constraint-1: 0.5w + 0.75r + s + 0.8m <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg.\n// Constraint-2: 0.5w + 0.6r + 0.7s + 0.8m <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Constraint-3: w >= 20, r >= 20, s >= 20, m >= 20\n\n## Generate Constraint-4:\nThe bakery needs to ensure that the total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined.\n// Constraint-4: w + r <= 2(s + m)",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from selling these bread types. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $3 for multigrain. The bakery has a limited oven capacity of 100 hours per day. Baking one loaf of wheat bread takes 0.5 hours, rye bread takes 0.75 hours, sourdough bread takes 1 hour, and multigrain bread takes 0.8 hours. The bakery has a daily supply of 150 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, sourdough bread requires 0.7 kg, and multigrain bread requires 0.8 kg. The bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. The bakery needs to ensure that the total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # quantity of sourdough bread\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 3*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 100 hours per day.\nmodel.addCons(0.5*w + 0.75*r + s + 0.8*m <= 100)\n## The bakery has a daily supply of 150 kg of flour.\nmodel.addCons(0.5*w + 0.6*r + 0.7*s + 0.8*m <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(w >= 20)\nmodel.addCons(r >= 20)\nmodel.addCons(s >= 20)\nmodel.addCons(m >= 20)\n## The total production of wheat and rye bread does not exceed twice the production of sourdough and multigrain bread combined.\nmodel.addCons(w + r <= 2*(s + m))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of multigrain bread: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes A-D). The bakery must decide how many of each type of cake to produce daily.\n// {\"number of Cake A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d (where each coefficient represents the profit per cake)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg.\n// Constraint: 2a + 3b + 2c + 4d <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Constraint: a + b + c + d >= 30\n\n## Generate Constraint-3:\nDue to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\n// Constraint: a <= 50\n// Constraint: b <= 40\n\n## Generate Constraint-4:\nThe bakery must ensure that the number of cake C produced is at least half the number of cake D produced.\n// Constraint: c >= 0.5d",
        "question": "A bakery produces four types of cakes (cakes A-D) and must decide how many of each type of cake to produce daily. The bakery aims to maximize its daily profit from selling cakes. The profit per cake for each type is as follows:\n\n| Cake Type | Profit per Cake |\n|-----------|-----------------|\n| A         | 5$              |\n| B         | 7$              |\n| C         | 6$              |\n| D         | 8$              |\n\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg. The bakery has a daily demand for at least 30 cakes in total. Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily. The bakery must also ensure that the number of cake C produced is at least half the number of cake D produced.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Cake A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Cake B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Cake C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Cake D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The bakery has a limited daily supply of 200 kg of flour.\nmodel.addCons(2*a + 3*b + 2*c + 4*d <= 200)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(a + b + c + d >= 30)\n## Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\nmodel.addCons(a <= 50)\nmodel.addCons(b <= 40)\n## The bakery must ensure that the number of cake C produced is at least half the number of cake D produced.\nmodel.addCons(c >= 0.5*d)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A produced: \", model.getVal(a))\n    print(\"Number of Cake B produced: \", model.getVal(b))\n    print(\"Number of Cake C produced: \", model.getVal(c))\n    print(\"Number of Cake D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes A-D). The bakery must decide how many of each type of cake to produce daily.\n// {\"number of Cake A produced\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B produced\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C produced\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D produced\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d (where each coefficient represents the profit per cake)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of 200 kg of flour. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2 kg, and cake D requires 4 kg.\n// Constraint: 2a + 3b + 2c + 4d <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 cakes in total.\n// Constraint: a + b + c + d >= 30\n\n## Generate Constraint-3:\nDue to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\n// Constraint: a <= 50\n// Constraint: b <= 40\n\n## Generate Constraint-4:\nThe bakery must ensure that the number of cake C produced is at least half the number of cake D produced.\n// Constraint: c >= 0.5d",
        "question": "A bakery produces four types of cakes (cakes A-D) and must decide how many of each type of cake to produce daily. The bakery wants to maximize its daily profit from selling cakes, with each cake A yielding a profit of $5, cake B $7, cake C $6, and cake D $8. The bakery has a limited daily supply of 200 kg of flour, with each cake A requiring 2 kg of flour, cake B requiring 3 kg, cake C requiring 2 kg, and cake D requiring 4 kg. The bakery has a daily demand for at least 30 cakes in total. Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily. Additionally, the bakery must ensure that the number of cake C produced is at least half the number of cake D produced. Please help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of Cake A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of Cake B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of Cake C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of Cake D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The bakery has a limited daily supply of 200 kg of flour.\nmodel.addCons(2*a + 3*b + 2*c + 4*d <= 200)\n## The bakery has a daily demand for at least 30 cakes in total.\nmodel.addCons(a + b + c + d >= 30)\n## Due to equipment limitations, the bakery can produce no more than 50 cakes of type A and 40 cakes of type B daily.\nmodel.addCons(a <= 50)\nmodel.addCons(b <= 40)\n## The bakery must ensure that the number of cake C produced is at least half the number of cake D produced.\nmodel.addCons(c >= 0.5*d)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A produced: \", model.getVal(a))\n    print(\"Number of Cake B produced: \", model.getVal(b))\n    print(\"Number of Cake C produced: \", model.getVal(c))\n    print(\"Number of Cake D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon.\n// {\"number of chocolate cakes\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"v\", \"range\": \"v >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"l\", \"range\": \"l >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon.\n// Objective Function: Maximize: 5c + 4v + 3s + 2l\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements are as follows:\n- Chocolate cake requires 3 units of ingredient A.\n- Vanilla cake requires 2 units of ingredient A.\n- Strawberry cake requires 1 unit of ingredient A.\n- Lemon cake requires 1 unit of ingredient A.\nThe total daily supply of ingredient A is 100 units.\n// Constraint: 3c + 2v + s + l <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient B:\n- Chocolate cake requires 2 units of ingredient B.\n- Vanilla cake requires 3 units of ingredient B.\n- Strawberry cake requires 2 units of ingredient B.\n- Lemon cake requires 1 unit of ingredient B.\nThe total daily supply of ingredient B is 80 units.\n// Constraint: 2c + 3v + 2s + l <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 cakes of any type each day to meet minimum production standards.\n// Constraint: c + v + s + l >= 10\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced variety of cakes. It must produce at least one of each type of cake each day.\n// Constraint: c >= 1, v >= 1, s >= 1, l >= 1",
        "question": "A bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon. The ingredient requirements and daily supplies are as follows:\n\n| Cake Type | Ingredient A | Ingredient B | Profit per Cake |\n|-----------|--------------|--------------|-----------------|\n| Chocolate | 3 units      | 2 units      | $5              |\n| Vanilla   | 2 units      | 3 units      | $4              |\n| Strawberry| 1 unit       | 2 units      | $3              |\n| Lemon     | 1 unit       | 1 unit       | $2              |\n\nThe bakery has a limited daily supply of ingredients:\n- The total daily supply of ingredient A is 100 units.\n- The total daily supply of ingredient B is 80 units.\n\nThe bakery must also meet the following constraints:\n- Produce at least 10 cakes of any type each day to meet minimum production standards.\n- Produce at least one of each type of cake each day to ensure a balanced variety.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of chocolate cakes\nv = model.addVar(vtype=\"INTEGER\", name=\"v\", lb=0) # number of vanilla cakes\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of strawberry cakes\nl = model.addVar(vtype=\"INTEGER\", name=\"l\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*c + 4*v + 3*s + 2*l)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient A.\nmodel.addCons(3*c + 2*v + s + l <= 100)\n## The bakery also has a limited daily supply of ingredient B.\nmodel.addCons(2*c + 3*v + 2*s + l <= 80)\n## The bakery must produce at least 10 cakes of any type each day.\nmodel.addCons(c + v + s + l >= 10)\n## The bakery wants to ensure a balanced variety of cakes.\nmodel.addCons(c >= 1)\nmodel.addCons(v >= 1)\nmodel.addCons(s >= 1)\nmodel.addCons(l >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(c))\n    print(\"Number of vanilla cakes: \", model.getVal(v))\n    print(\"Number of strawberry cakes: \", model.getVal(s))\n    print(\"Number of lemon cakes: \", model.getVal(l))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon.\n// {\"number of chocolate cakes\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"v\", \"range\": \"v >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"s\", \"range\": \"s >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"l\", \"range\": \"l >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon.\n// Objective Function: Maximize: 5c + 4v + 3s + 2l\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements are as follows:\n- Chocolate cake requires 3 units of ingredient A.\n- Vanilla cake requires 2 units of ingredient A.\n- Strawberry cake requires 1 unit of ingredient A.\n- Lemon cake requires 1 unit of ingredient A.\nThe total daily supply of ingredient A is 100 units.\n// Constraint: 3c + 2v + s + l <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient B:\n- Chocolate cake requires 2 units of ingredient B.\n- Vanilla cake requires 3 units of ingredient B.\n- Strawberry cake requires 2 units of ingredient B.\n- Lemon cake requires 1 unit of ingredient B.\nThe total daily supply of ingredient B is 80 units.\n// Constraint: 2c + 3v + 2s + l <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 cakes of any type each day to meet minimum production standards.\n// Constraint: c + v + s + l >= 10\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced variety of cakes. It must produce at least one of each type of cake each day.\n// Constraint: c >= 1, v >= 1, s >= 1, l >= 1",
        "question": "A bakery needs to decide how many of each type of cake to produce daily. There are four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery wants to maximize its daily profit from selling cakes. The profit per cake is $5 for chocolate, $4 for vanilla, $3 for strawberry, and $2 for lemon. The bakery has a limited daily supply of ingredients. Each chocolate cake requires 3 units of ingredient A and 2 units of ingredient B, each vanilla cake requires 2 units of ingredient A and 3 units of ingredient B, each strawberry cake requires 1 unit of ingredient A and 2 units of ingredient B, and each lemon cake requires 1 unit of ingredient A and 1 unit of ingredient B. The total daily supply of ingredient A is 100 units, and the total daily supply of ingredient B is 80 units. The bakery must produce at least 10 cakes of any type each day to meet minimum production standards and must produce at least one of each type of cake each day. Please help the bakery determine the optimal number of each type of cake to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of chocolate cakes\nv = model.addVar(vtype=\"INTEGER\", name=\"v\", lb=0) # number of vanilla cakes\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0) # number of strawberry cakes\nl = model.addVar(vtype=\"INTEGER\", name=\"l\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*c + 4*v + 3*s + 2*l)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient A.\nmodel.addCons(3*c + 2*v + s + l <= 100)\n## The bakery also has a limited daily supply of ingredient B.\nmodel.addCons(2*c + 3*v + 2*s + l <= 80)\n## The bakery must produce at least 10 cakes of any type each day.\nmodel.addCons(c + v + s + l >= 10)\n## The bakery wants to ensure a balanced variety of cakes.\nmodel.addCons(c >= 1)\nmodel.addCons(v >= 1)\nmodel.addCons(s >= 1)\nmodel.addCons(l >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(c))\n    print(\"Number of vanilla cakes: \", model.getVal(v))\n    print(\"Number of strawberry cakes: \", model.getVal(s))\n    print(\"Number of lemon cakes: \", model.getVal(l))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of any product are produced.\n// Constraint-4: a + b + c + d >= 10",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The following table provides the required raw material units and production hours for each product.\n\n| Product | Raw Material Units | Production Hours |\n|---------|-------------------|------------------|\n| A       | 3                 | 2                |\n| B       | 2                 | 1                |\n| C       | 4                 | 3                |\n| D       | 1                 | 1                |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production line has a limited capacity, with a total of 50 hours available per day. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure that at least 10 units of any product are produced.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that at least 10 units of any product are produced.\nmodel.addCons(a + b + c + d >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of any product are produced.\n// Constraint-4: a + b + c + d >= 10",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day is 50 hours. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure that at least 10 units of any product are produced.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production line has a limited capacity.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that at least 10 units of any product are produced.\nmodel.addCons(a + b + c + d >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials.\n// White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 4000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 4000\n\n## Generate Constraint-4:\nThe bakery has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread.\n// White >= 500\n// WholeWheat >= 300",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| White Bread      | $2              |\n| Whole Wheat Bread| $2.5            |\n| Rye Bread        | $3              |\n| Sourdough Bread  | $3.5            |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours. The bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials. The bakery has a storage capacity of 4000 loaves. The bakery has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # number of loaves of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000)\n## The bakery has a budget of $5000 for raw materials.\nmodel.addCons(White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000)\n## The bakery has a storage capacity of 4000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 4000)\n## The bakery has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread.\nmodel.addCons(White >= 500)\nmodel.addCons(WholeWheat >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of loaves of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.6 hours, rye bread requires 0.7 hours, and sourdough bread requires 0.8 hours.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for raw materials. Each loaf of white bread requires $1 of raw materials, whole wheat bread requires $1.2 of raw materials, rye bread requires $1.5 of raw materials, and sourdough bread requires $1.8 of raw materials.\n// White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 4000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 4000\n\n## Generate Constraint-4:\nThe bakery has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread.\n// White >= 500\n// WholeWheat >= 300",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for white bread is $2, the profit per loaf for whole wheat bread is $2.5, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $3.5. The bakery has a total of 1000 hours of labor available, with each loaf of white bread requiring 0.5 hours, whole wheat bread requiring 0.6 hours, rye bread requiring 0.7 hours, and sourdough bread requiring 0.8 hours. The bakery has a budget of $5000 for raw materials, with each loaf of white bread requiring $1 of raw materials, whole wheat bread requiring $1.2 of raw materials, rye bread requiring $1.5 of raw materials, and sourdough bread requiring $1.8 of raw materials. The bakery has a storage capacity of 4000 loaves. The bakery also has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread. Please help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # number of loaves of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*White + 2.5*WholeWheat + 3*Rye + 3.5*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 1000)\n## The bakery has a budget of $5000 for raw materials.\nmodel.addCons(White + 1.2*WholeWheat + 1.5*Rye + 1.8*Sourdough <= 5000)\n## The bakery has a storage capacity of 4000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 4000)\n## The bakery has a minimum demand of 500 loaves of white bread and 300 loaves of whole wheat bread.\nmodel.addCons(White >= 500)\nmodel.addCons(WholeWheat >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $50                      | 2 hours                |\n| Tablets      | $150            | $70                      | 3 hours                |\n| Laptops      | $200            | $100                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 12,000 hours available for assembly. The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n## The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit.\nThe company has a total production capacity of 5000 units. The production cost per unit for smartphones is $50, the production cost per unit for tablets is $70, the production cost per unit for laptops is $100, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly. The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nPlease help the company determine the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n## The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms.\n// 100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000\n\n## Generate Constraint-3:\nThe bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms.\n// 20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000\n\n## Generate Constraint-4:\nThe bakery has a labor constraint. Each croissant requires 5 minutes of labor, each muffin requires 7 minutes, each doughnut requires 6 minutes, and each eclair requires 10 minutes. The total daily labor available is 800 minutes.\n// 5*Croissants + 7*Muffins + 6*Doughnuts + 10*Eclairs <= 800",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits. The profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit. The details of the resources used for each pastry are given in the following Table.\n\n| Pastry   | Profit per Unit | Flour Usage (grams) | Sugar Usage (grams) | Labor Time (minutes) |\n|----------|-----------------|---------------------|---------------------|----------------------|\n| Croissant| 1.50$           | 100                 | 20                  | 5                    |\n| Muffin   | 2.00$           | 150                 | 30                  | 7                    |\n| Doughnut | 1.75$           | 120                 | 25                  | 6                    |\n| Eclair   | 2.50$           | 200                 | 40                  | 10                   |\n\nThe bakery has a daily production capacity of 1000 pastries. The bakery has a limited daily supply of flour, which is used in all pastries, totaling 150 kilograms. The bakery also has a limited daily supply of sugar, totaling 20 kilograms. The bakery has a labor constraint, with a total daily labor available of 800 minutes.\n\nPlease help the bakery to determine the optimal number of each pastry to produce daily to maximize its profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 1000)\n## The bakery has a limited daily supply of flour.\nmodel.addCons(100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000)\n## The bakery has a limited daily supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000)\n## The bakery has a labor constraint.\nmodel.addCons(5*Croissants + 7*Muffins + 6*Doughnuts + 10*Eclairs <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1532,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms.\n// 100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000\n\n## Generate Constraint-3:\nThe bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms.\n// 20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000\n\n## Generate Constraint-4:\nThe bakery has a labor constraint. Each croissant requires 5 minutes of labor, each muffin requires 7 minutes, each doughnut requires 6 minutes, and each eclair requires 10 minutes. The total daily labor available is 800 minutes.\n// 5*Croissants + 7*Muffins + 6*Doughnuts + 10*Eclairs <= 800",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many of each pastry to produce daily to optimize their resources and profits. The profit per croissant is $1.50, the profit per muffin is $2.00, the profit per doughnut is $1.75, and the profit per eclair is $2.50. The bakery aims to maximize its daily profit. The bakery has a daily production capacity of 1000 pastries. The bakery has a limited daily supply of flour, which is used in all pastries. The flour usage for each croissant is 100 grams, for each muffin is 150 grams, for each doughnut is 120 grams, and for each eclair is 200 grams. The total daily flour supply is 150 kilograms. The bakery also has a limited daily supply of sugar. The sugar usage for each croissant is 20 grams, for each muffin is 30 grams, for each doughnut is 25 grams, and for each eclair is 40 grams. The total daily sugar supply is 20 kilograms. The bakery has a labor constraint. Each croissant requires 5 minutes of labor, each muffin requires 7 minutes, each doughnut requires 6 minutes, and each eclair requires 10 minutes. The total daily labor available is 800 minutes. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts + 2.50*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 1000)\n## The bakery has a limited daily supply of flour.\nmodel.addCons(100*Croissants + 150*Muffins + 120*Doughnuts + 200*Eclairs <= 150000)\n## The bakery has a limited daily supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Doughnuts + 40*Eclairs <= 20000)\n## The bakery has a labor constraint.\nmodel.addCons(5*Croissants + 7*Muffins + 6*Doughnuts + 10*Eclairs <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 5 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 10,000 hours available for assembly. The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n## The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The company has a budget of $250,000 for production costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly. The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n## The company has a minimum order requirement from a key client for 500 smartphones and 300 tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// WholeWheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Whole wheat requires 0.5 kg of flour per loaf, rye requires 0.4 kg, sourdough requires 0.6 kg, and multigrain requires 0.7 kg. The total daily flour supply is 500 kg.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited amount of yeast available each day. Whole wheat requires 0.01 kg of yeast per loaf, rye requires 0.015 kg, sourdough requires 0.02 kg, and multigrain requires 0.01 kg. The total daily yeast supply is 10 kg.\n// 0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 200 loaves of sourdough daily to meet a specific market demand.\n// Sourdough >= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $2              |\n| Rye            | $2.5            |\n| Sourdough      | $3              |\n| Multigrain     | $2.2            |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery also has a limited amount of flour and yeast available each day. The requirements for flour and yeast per loaf are as follows:\n\n| Bread Type     | Flour per Loaf (kg) | Yeast per Loaf (kg) |\n|----------------|---------------------|---------------------|\n| Whole Wheat    | 0.5                 | 0.01                |\n| Rye            | 0.4                 | 0.015               |\n| Sourdough      | 0.6                 | 0.02                |\n| Multigrain     | 0.7                 | 0.01                |\n\nThe total daily flour supply is 500 kg, and the total daily yeast supply is 10 kg. The bakery aims to produce at least 200 loaves of sourdough daily to meet a specific market demand.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500)\n## The bakery has a limited amount of yeast available each day.\nmodel.addCons(0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10)\n## The bakery aims to produce at least 200 loaves of sourdough daily.\nmodel.addCons(Sourdough >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1364,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations.\n// {\"number of loaves of whole wheat\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// WholeWheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour available each day. Whole wheat requires 0.5 kg of flour per loaf, rye requires 0.4 kg, sourdough requires 0.6 kg, and multigrain requires 0.7 kg. The total daily flour supply is 500 kg.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500\n\n## Generate Constraint-3:\nThe bakery has a limited amount of yeast available each day. Whole wheat requires 0.01 kg of yeast per loaf, rye requires 0.015 kg, sourdough requires 0.02 kg, and multigrain requires 0.01 kg. The total daily yeast supply is 10 kg.\n// 0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 200 loaves of sourdough daily to meet a specific market demand.\n// Sourdough >= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type to produce daily to optimize its operations. The profit per loaf for whole wheat is $2, the profit per loaf for rye is $2.5, the profit per loaf for sourdough is $3, and the profit per loaf for multigrain is $2.2. The bakery wants to maximize the total daily profit. The bakery has a daily production capacity of 1000 loaves. The bakery has a limited amount of flour available each day, with whole wheat requiring 0.5 kg of flour per loaf, rye requiring 0.4 kg, sourdough requiring 0.6 kg, and multigrain requiring 0.7 kg, and the total daily flour supply is 500 kg. The bakery also has a limited amount of yeast available each day, with whole wheat requiring 0.01 kg of yeast per loaf, rye requiring 0.015 kg, sourdough requiring 0.02 kg, and multigrain requiring 0.01 kg, and the total daily yeast supply is 10 kg. The bakery aims to produce at least 200 loaves of sourdough daily to meet a specific market demand. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of whole wheat\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*Rye + 3*Sourdough + 2.2*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.7*Multigrain <= 500)\n## The bakery has a limited amount of yeast available each day.\nmodel.addCons(0.01*WholeWheat + 0.015*Rye + 0.02*Sourdough + 0.01*Multigrain <= 10)\n## The bakery aims to produce at least 200 loaves of sourdough daily.\nmodel.addCons(Sourdough >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye: \", model.getVal(Rye))\n    print(\"Number of loaves of Sourdough: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain: \", model.getVal(Multigrain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\n// 30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000\n\n## Generate Constraint-4:\nThe company has a storage constraint where the total number of devices cannot exceed 4000 units at any time.\n// Smartphones + Tablets + Laptops + Smartwatches <= 4000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $150            |\n| Laptops      | $200            |\n| Smartwatches | $50             |\n\nThe company has a total production capacity of 5000 units. The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials. The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor. The company also has a storage constraint where the total number of devices cannot exceed 4000 units at any time.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000)\n## The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\nmodel.addCons(30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000)\n## The company has a storage constraint where the total number of devices cannot exceed 4000 units at any time.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1171,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\n// 30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000\n\n## Generate Constraint-4:\nThe company has a storage constraint where the total number of devices cannot exceed 4000 units at any time.\n// Smartphones + Tablets + Laptops + Smartwatches <= 4000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials. The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor. The company also has a storage constraint where the total number of devices cannot exceed 4000 units at any time. Please help the company determine the optimal number of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The cost of materials for 1 unit of smartphone is $50, for 1 unit of tablet is $70, for 1 unit of laptop is $100, and for 1 unit of smartwatch is $20. The company has a budget of $200,000 for materials.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 20*Smartwatches <= 200000)\n## The labor cost for 1 unit of smartphone is $30, for 1 unit of tablet is $40, for 1 unit of laptop is $50, and for 1 unit of smartwatch is $10. The company has a budget of $100,000 for labor.\nmodel.addCons(30*Smartphones + 40*Tablets + 50*Laptops + 10*Smartwatches <= 100000)\n## The company has a storage constraint where the total number of devices cannot exceed 4000 units at any time.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily.\n// {\"number of loaves of white bread\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat_Bread\", \"range\": \"Whole_Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.7 hours, rye bread requires 0.8 hours, and sourdough bread requires 1 hour of labor.\n// 0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for ingredients. The cost of ingredients for each loaf of white bread is $0.50, for whole wheat bread is $0.70, for rye bread is $0.80, and for sourdough bread is $1.00.\n// 0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500\n\n## Generate Constraint-3:\nThe bakery can only store a maximum of 1500 loaves of bread at any given time.\n// White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 200 loaves of whole wheat bread per day.\n// Whole_Wheat_Bread >= 200",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily. The profit per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Type of Bread       | Profit per Loaf | Labor Hours per Loaf | Ingredient Cost per Loaf |\n|---------------------|-----------------|----------------------|--------------------------|\n| White Bread         | $1.50           | 0.5 hours            | $0.50                    |\n| Whole Wheat Bread   | $2.00           | 0.7 hours            | $0.70                    |\n| Rye Bread           | $2.50           | 0.8 hours            | $0.80                    |\n| Sourdough Bread     | $3.00           | 1 hour               | $1.00                    |\n\nThe bakery has a total of 1000 hours of labor available per day. The bakery has a daily budget of $500 for ingredients. The bakery can only store a maximum of 1500 loaves of bread at any given time. The bakery has a contract to supply at least 200 loaves of whole wheat bread per day.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of loaves of white bread\nWhole_Wheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat_Bread\", lb=0) # number of loaves of whole wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000)\n## The bakery has a daily budget of $500 for ingredients.\nmodel.addCons(0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500)\n## The bakery can only store a maximum of 1500 loaves of bread at any given time.\nmodel.addCons(White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500)\n## The bakery has a contract to supply at least 200 loaves of whole wheat bread per day.\nmodel.addCons(Whole_Wheat_Bread >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White_Bread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily.\n// {\"number of loaves of white bread\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat_Bread\", \"range\": \"Whole_Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of white bread requires 0.5 hours, whole wheat bread requires 0.7 hours, rye bread requires 0.8 hours, and sourdough bread requires 1 hour of labor.\n// 0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for ingredients. The cost of ingredients for each loaf of white bread is $0.50, for whole wheat bread is $0.70, for rye bread is $0.80, and for sourdough bread is $1.00.\n// 0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500\n\n## Generate Constraint-3:\nThe bakery can only store a maximum of 1500 loaves of bread at any given time.\n// White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 200 loaves of whole wheat bread per day.\n// Whole_Wheat_Bread >= 200",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread daily. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize its daily profit from bread sales. The bakery has a total of 1000 hours of labor available per day, with each loaf of white bread requiring 0.5 hours, whole wheat bread requiring 0.7 hours, rye bread requiring 0.8 hours, and sourdough bread requiring 1 hour of labor. The bakery has a daily budget of $500 for ingredients, with the cost of ingredients for each loaf of white bread being $0.50, for whole wheat bread being $0.70, for rye bread being $0.80, and for sourdough bread being $1.00. The bakery can only store a maximum of 1500 loaves of bread at any given time. Additionally, the bakery has a contract to supply at least 200 loaves of whole wheat bread per day. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of loaves of white bread\nWhole_Wheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat_Bread\", lb=0) # number of loaves of whole wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat_Bread + 2.50*Rye_Bread + 3.00*Sourdough_Bread)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*White_Bread + 0.7*Whole_Wheat_Bread + 0.8*Rye_Bread + 1*Sourdough_Bread <= 1000)\n## The bakery has a daily budget of $500 for ingredients.\nmodel.addCons(0.50*White_Bread + 0.70*Whole_Wheat_Bread + 0.80*Rye_Bread + 1.00*Sourdough_Bread <= 500)\n## The bakery can only store a maximum of 1500 loaves of bread at any given time.\nmodel.addCons(White_Bread + Whole_Wheat_Bread + Rye_Bread + Sourdough_Bread <= 1500)\n## The bakery has a contract to supply at least 200 loaves of whole wheat bread per day.\nmodel.addCons(Whole_Wheat_Bread >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(White_Bread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"continuous\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40.\nThe bakery wants to maximize the total daily profit from selling all types of pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each bagel requires 0.05 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per day for ingredients. The cost of ingredients for each croissant is $0.20, for each muffin is $0.30, for each donut is $0.25, and for each bagel is $0.15.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 pastries per day.\n// Croissants + Muffins + Donuts + Bagels <= 5000\n\n## Generate Constraint-4:\nThe bakery has a demand limit for donuts, which should not exceed 2000 per day.\n// Donuts <= 2000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The profit per pastry and the labor and ingredient requirements are given in the following Table.\n\n| Pastry   | Profit per Unit | Labor per Unit | Ingredient Cost per Unit |\n|----------|-----------------|----------------|--------------------------|\n| Croissants | $0.50          | 0.1 hours      | $0.20                    |\n| Muffins   | $0.75          | 0.2 hours      | $0.30                    |\n| Donuts    | $0.60          | 0.15 hours     | $0.25                    |\n| Bagels    | $0.40          | 0.05 hours     | $0.15                    |\n\nThe bakery has a total of 1000 hours of labor available per day and a budget of $500 per day for ingredients. The bakery also has a storage capacity limit of 5000 pastries per day and a demand limit for donuts, which should not exceed 2000 per day. \n\nPlease help the bakery to maximize the total daily profit from selling all types of pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Donuts\", lb=0) # number of donuts\nBagels = model.addVar(vtype=\"CONTINUOUS\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000)\n## The bakery has a budget of $500 per day for ingredients.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500)\n## The bakery has a storage capacity limit of 5000 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts + Bagels <= 5000)\n## The bakery has a demand limit for donuts, which should not exceed 2000 per day.\nmodel.addCons(Donuts <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of donuts\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"continuous\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40.\nThe bakery wants to maximize the total daily profit from selling all types of pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each bagel requires 0.05 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per day for ingredients. The cost of ingredients for each croissant is $0.20, for each muffin is $0.30, for each donut is $0.25, and for each bagel is $0.15.\n// 0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 pastries per day.\n// Croissants + Muffins + Donuts + Bagels <= 5000\n\n## Generate Constraint-4:\nThe bakery has a demand limit for donuts, which should not exceed 2000 per day.\n// Donuts <= 2000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, donuts, and bagels. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The profit per croissant is $0.50, the profit per muffin is $0.75, the profit per donut is $0.60, and the profit per bagel is $0.40. The bakery has a total of 1000 hours of labor available per day, with each croissant requiring 0.1 hours of labor, each muffin requiring 0.2 hours, each donut requiring 0.15 hours, and each bagel requiring 0.05 hours. The bakery also has a budget of $500 per day for ingredients, with the cost of ingredients for each croissant being $0.20, for each muffin being $0.30, for each donut being $0.25, and for each bagel being $0.15. Additionally, the bakery has a storage capacity limit of 5000 pastries per day and a demand limit for donuts, which should not exceed 2000 per day. Please help the bakery maximize the total daily profit from selling all types of pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of muffins\nDonuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Donuts\", lb=0) # number of donuts\nBagels = model.addVar(vtype=\"CONTINUOUS\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.05*Bagels <= 1000)\n## The bakery has a budget of $500 per day for ingredients.\nmodel.addCons(0.20*Croissants + 0.30*Muffins + 0.25*Donuts + 0.15*Bagels <= 500)\n## The bakery has a storage capacity limit of 5000 pastries per day.\nmodel.addCons(Croissants + Muffins + Donuts + Bagels <= 5000)\n## The bakery has a demand limit for donuts, which should not exceed 2000 per day.\nmodel.addCons(Donuts <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Donuts: \", model.getVal(Donuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company wants to maximize the total profit.\n// Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n// Total_Revenue = 50*A + 70*B + 60*C + 40*D\n// Objective Function: Maximize: Total_Revenue - Total_Production_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for production costs.\n// Total_Production_Cost <= 250000\n\n## Generate Constraint-3:\nThe demand for product A is at least 500 units.\n// A >= 500\n\n## Generate Constraint-4:\nThe demand for product D is at most 2000 units.\n// D <= 2000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n| D       | $40             | $15                      |\n\nThe company has a total production capacity of 10,000 units. The company has a budget of $250,000 for production costs. The demand for product A is at least 500 units. The demand for product D is at most 2000 units. \nPlease help the company to maximize the total profit, which is defined as the total revenue minus the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n## Total_Revenue = 50*A + 70*B + 60*C + 40*D\nmodel.addCons(obj == (50*A + 70*B + 60*C + 40*D) - (20*A + 30*B + 25*C + 15*D))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The demand for product A is at least 500 units.\nmodel.addCons(A >= 500)\n## The demand for product D is at most 2000 units.\nmodel.addCons(D <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company wants to maximize the total profit.\n// Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n// Total_Revenue = 50*A + 70*B + 60*C + 40*D\n// Objective Function: Maximize: Total_Revenue - Total_Production_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for production costs.\n// Total_Production_Cost <= 250000\n\n## Generate Constraint-3:\nThe demand for product A is at least 500 units.\n// A >= 500\n\n## Generate Constraint-4:\nThe demand for product D is at most 2000 units.\n// D <= 2000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the optimal number of units to produce for each product to maximize profit. The profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The production cost per unit for product A is $20, for product B is $30, for product C is $25, and for product D is $15. The company has a total production capacity of 10,000 units and a budget of $250,000 for production costs. The demand for product A is at least 500 units, and the demand for product D is at most 2000 units. Please help the company to maximize the total profit by determining the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Production_Cost = 20*A + 30*B + 25*C + 15*D\n## Total_Revenue = 50*A + 70*B + 60*C + 40*D\nmodel.addCons(obj == (50*A + 70*B + 60*C + 40*D) - (20*A + 30*B + 25*C + 15*D))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The demand for product A is at least 500 units.\nmodel.addCons(A >= 500)\n## The demand for product D is at most 2000 units.\nmodel.addCons(D <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total profit.\n// Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n// Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\n// Objective Function: Maximize: Total_Revenue - Total_Manufacturing_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// ProductA + ProductB + ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for manufacturing costs.\n// Total_Manufacturing_Cost <= 250000\n\n## Generate Constraint-3:\nDue to market demand, the number of units of product A must not exceed 4,000 units.\n// ProductA <= 4000\n\n## Generate Constraint-4:\nTo maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A.\n// ProductB >= 0.5 * ProductA",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and manufacturing cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Manufacturing Cost per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $20                         |\n| B       | $70             | $30                         |\n| C       | $60             | $25                         |\n\nThe company has a total production capacity of 10,000 units. The company has a budget of $250,000 for manufacturing costs. Due to market demand, the number of units of product A must not exceed 4,000 units. To maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A.\nPlease help the company to maximize the total profit, which is defined as the total revenue minus the total manufacturing cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n## Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\nmodel.addCons(obj == (50*ProductA + 70*ProductB + 60*ProductC) - (20*ProductA + 30*ProductB + 25*ProductC))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 10000)\n## The company has a budget of $250,000 for manufacturing costs.\nmodel.addCons(20*ProductA + 30*ProductB + 25*ProductC <= 250000)\n## Due to market demand, the number of units of product A must not exceed 4,000 units.\nmodel.addCons(ProductA <= 4000)\n## To maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A.\nmodel.addCons(ProductB >= 0.5 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(ProductA))\n    print(\"Number of units of product B: \", model.getVal(ProductB))\n    print(\"Number of units of product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total profit.\n// Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n// Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\n// Objective Function: Maximize: Total_Revenue - Total_Manufacturing_Cost\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// ProductA + ProductB + ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $250,000 for manufacturing costs.\n// Total_Manufacturing_Cost <= 250000\n\n## Generate Constraint-3:\nDue to market demand, the number of units of product A must not exceed 4,000 units.\n// ProductA <= 4000\n\n## Generate Constraint-4:\nTo maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A.\n// ProductB >= 0.5 * ProductA",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturing cost per unit for product A is $20, for product B is $30, and for product C is $25. The company has a total production capacity of 10,000 units and a budget of $250,000 for manufacturing costs. Due to market demand, the number of units of product A must not exceed 4,000 units. To maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Manufacturing_Cost = 20*ProductA + 30*ProductB + 25*ProductC\n## Total_Revenue = 50*ProductA + 70*ProductB + 60*ProductC\nmodel.addCons(obj == (50*ProductA + 70*ProductB + 60*ProductC) - (20*ProductA + 30*ProductB + 25*ProductC))\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 10000)\n## The company has a budget of $250,000 for manufacturing costs.\nmodel.addCons(20*ProductA + 30*ProductB + 25*ProductC <= 250000)\n## Due to market demand, the number of units of product A must not exceed 4,000 units.\nmodel.addCons(ProductA <= 4000)\n## To maintain a balanced product portfolio, the number of units of product B must be at least half the number of units of product A.\nmodel.addCons(ProductB >= 0.5 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(ProductA))\n    print(\"Number of units of product B: \", model.getVal(ProductB))\n    print(\"Number of units of product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 muffins per day to meet a contractual obligation.\n// Muffins >= 20",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor. The revenue and cost per pastry, as well as the required ingredients and labor, are given in the following Table.\n\n| Pastry   | Revenue per Unit | Cost per Unit | Flour Required (kg) | Sugar Required (kg) | Labor Required (hours) |\n|----------|------------------|---------------|---------------------|---------------------|------------------------|\n| Croissant| 2$               | 0.5$          | 0.1                 | 0.05                | 0.5                    |\n| Muffin   | 3$               | 1$            | 0.2                 | 0.1                 | 0.4                    |\n| Bagel    | 1.5$             | 0.7$          | 0.15                | 0.05                | 0.3                    |\n\nThe bakery has a daily limit of 100 kg of flour and 80 kg of sugar. The bakery also has a daily limit of 40 hours of labor. The bakery must produce at least 20 muffins per day to meet a contractual obligation. The bakery wants to maximize the daily profit.\n\nPlease help the bakery determine the optimal number of croissants, muffins, and bagels to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (0.5*Croissants + 1*Muffins + 0.7*Bagels))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40)\n## The bakery must produce at least 20 muffins per day to meet a contractual obligation.\nmodel.addCons(Muffins >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 muffins per day to meet a contractual obligation.\n// Muffins >= 20",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide on the optimal number of each type of pastry to produce daily, considering the availability of ingredients and labor. The revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $0.5, per muffin is $1, and per bagel is $0.7. The bakery wants to maximize the daily profit. The bakery has a daily limit of 100 kg of flour, where each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each bagel requires 0.15 kg. The bakery also has a daily limit of 80 kg of sugar, where each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each bagel requires 0.05 kg. Additionally, the bakery has a daily limit of 40 hours of labor, where each croissant requires 0.5 hours of labor, each muffin requires 0.4 hours, and each bagel requires 0.3 hours. The bakery must produce at least 20 muffins per day to meet a contractual obligation. Please help the bakery determine the optimal number of each type of pastry to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Bagels\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (0.5*Croissants + 1*Muffins + 0.7*Bagels))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Bagels <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.05*Bagels <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Bagels <= 40)\n## The bakery must produce at least 20 muffins per day to meet a contractual obligation.\nmodel.addCons(Muffins >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor.\n// 0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 pastries in total each day to meet the minimum demand.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type. The revenue and cost per pastry, as well as the required ingredients and labor for each pastry, are given in the following Table.\n\n| Pastry   | Revenue per Pastry | Cost per Pastry | Flour Required (kg) | Sugar Required (kg) | Labor Required (hours) |\n|----------|--------------------|-----------------|---------------------|---------------------|------------------------|\n| Croissant| 2$                 | 1$              | 0.1                 | 0.05                | 0.2                    |\n| Muffin   | 3$                 | 1.5$            | 0.2                 | 0.1                 | 0.3                    |\n| Donut    | 1.5$               | 0.8$            | 0.15                | 0.08                | 0.15                   |\n\nThe bakery has a daily limit of 100 kg of flour and 80 kg of sugar. The bakery also has a daily limit of 40 hours of labor. The bakery must produce at least 50 pastries in total each day to meet the minimum demand. \nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 1.5*Muffins + 0.8*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40)\n## The bakery must produce at least 50 pastries in total each day to meet the minimum demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1292,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 40 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor.\n// 0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 pastries in total each day to meet the minimum demand.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, considering the availability of ingredients and the demand for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $0.8. The bakery wants to maximize the daily profit.\n\nThe bakery has a daily limit of 100 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each donut requires 0.15 kg of flour. The bakery also has a daily limit of 80 kg of sugar. Each croissant requires 0.05 kg, each muffin requires 0.1 kg, and each donut requires 0.08 kg of sugar. Additionally, the bakery has a daily limit of 40 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each donut requires 0.15 hours of labor. The bakery must produce at least 50 pastries in total each day to meet the minimum demand.\n\nPlease help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 0.8*Donuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Donuts) - (Croissants + 1.5*Muffins + 0.8*Donuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 100)\n## The bakery has a daily limit of 80 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 80)\n## The bakery has a daily limit of 40 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.15*Donuts <= 40)\n## The bakery must produce at least 50 pastries in total each day to meet the minimum demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of doughnut ovens to rent\": \"Doughnut_Ovens\", \"range\": \"Doughnut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\n// 15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Doughnut_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 muffins.\n// Muffins >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry       | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|--------------|--------------------|-----------------|------------------------------|\n| Croissants   | $2                 | $1              | $100                         |\n| Muffins      | $3                 | $1.5            | $120                         |\n| Doughnuts    | $2.5               | $1.2            | $90                          |\n\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours. The bakery has a daily budget of $500 for oven rentals. The bakery needs to rent at least one oven for each type of pastry. The bakery has a daily demand for at least 50 muffins.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDoughnut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Doughnut_Ovens\", lb=0) # number of doughnut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Doughnut_Ovens >= 1)\n## The bakery has a daily demand for at least 50 muffins.\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of doughnut ovens to rent: \", model.getVal(Doughnut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1218,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of doughnut ovens to rent\": \"Doughnut_Ovens\", \"range\": \"Doughnut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\n// 15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Doughnut_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 muffins.\n// Muffins >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as the number of ovens to rent for each type of pastry. The revenue per croissant is $2, per muffin is $3, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, and per doughnut is $1.2. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per doughnut oven is $90. The bakery wants to maximize the daily profit. The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours. The bakery has a daily budget of $500 for oven rentals. The bakery needs to rent at least one oven for each type of pastry. The bakery has a daily demand for at least 50 muffins. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDoughnut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Doughnut_Ovens\", lb=0) # number of doughnut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Doughnuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a croissant is 15 minutes, a muffin is 20 minutes, and a doughnut is 10 minutes. The total daily baking time available is 8 hours.\nmodel.addCons(15*Croissants + 20*Muffins + 10*Doughnuts <= 8 * 60)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Doughnut_Ovens <= 500)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Doughnut_Ovens >= 1)\n## The bakery has a daily demand for at least 50 muffins.\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of doughnut ovens to rent: \", model.getVal(Doughnut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of bagel ovens to rent\": \"Bagel_Ovens\", \"range\": \"Bagel_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. \nThe cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes.\n// 15*Croissants + 20*Muffins + 10*Bagels <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams.\n// 0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Bagel_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels.\n// Croissants >= 50, Muffins >= 70, Bagels >= 100",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry     | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|------------|--------------------|-----------------|------------------------------|\n| Croissants | 2$                 | 1$              | 100$                         |\n| Muffins    | 3$                 | 1.5$            | 120$                         |\n| Bagels     | 1.5$               | 0.8$            | 80$                          |\n\nThe bakery wants to maximize the daily profit. The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes, with a total daily baking time available of 480 minutes. The bakery has a daily supply of 200 kg of flour, with each croissant requiring 50 grams, each muffin requiring 75 grams, and each bagel requiring 100 grams. The bakery needs to rent at least one oven for each type of pastry. Additionally, the bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels.\n\nPlease help the bakery determine the optimal number of each type of pastry to produce and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nBagel_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Bagel_Ovens\", lb=0) # number of bagel ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens))\n\n# Add constraints\n## The time required to bake each pastry\nmodel.addCons(15*Croissants + 20*Muffins + 10*Bagels <= 480)\n## The bakery has a daily supply of 200 kg of flour\nmodel.addCons(0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200)\n## The bakery needs to rent at least one oven for each type of pastry\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Bagel_Ovens >= 1)\n## The bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 70)\nmodel.addCons(Bagels >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of bagel ovens to rent: \", model.getVal(Bagel_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1451,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of bagels to produce\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of bagel ovens to rent\": \"Bagel_Ovens\", \"range\": \"Bagel_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. \nThe cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n// Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes.\n// 15*Croissants + 20*Muffins + 10*Bagels <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams.\n// 0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Bagel_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels.\n// Croissants >= 50, Muffins >= 70, Bagels >= 100",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to decide how many of each type of pastry to produce daily, and how many ovens to rent for each type of pastry. The revenue per croissant is $2, per muffin is $3, and per bagel is $1.5. The cost per croissant is $1, per muffin is $1.5, and per bagel is $0.8. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per bagel oven is $80. The bakery wants to maximize the daily profit.\n\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each bagel is 10 minutes. The total daily baking time available is 480 minutes. The bakery has a daily supply of 200 kg of flour. Each croissant requires 50 grams, each muffin requires 75 grams, and each bagel requires 100 grams. The bakery needs to rent at least one oven for each type of pastry. The bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels.\n\nPlease help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nBagel_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Bagel_Ovens\", lb=0) # number of bagel ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Bagels\n## Total_Cost = 1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Bagels) - (1*Croissants + 1.5*Muffins + 0.8*Bagels + 100*Croissant_Ovens + 120*Muffin_Ovens + 80*Bagel_Ovens))\n\n# Add constraints\n## The time required to bake each pastry\nmodel.addCons(15*Croissants + 20*Muffins + 10*Bagels <= 480)\n## The bakery has a daily supply of 200 kg of flour\nmodel.addCons(0.05*Croissants + 0.075*Muffins + 0.1*Bagels <= 200)\n## The bakery needs to rent at least one oven for each type of pastry\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Bagel_Ovens >= 1)\n## The bakery has a daily demand for at least 50 croissants, 70 muffins, and 100 bagels\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 70)\nmodel.addCons(Bagels >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of bagels to produce: \", model.getVal(Bagels))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of bagel ovens to rent: \", model.getVal(Bagel_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\n// Croissants >= 20, Muffins >= 30\n\n## Generate Constraint-4:\nThe total number of pastries produced should not exceed 200 to maintain quality.\n// Croissants + Muffins + Doughnuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required. The revenue and cost per pastry, as well as the required ingredients and labor, are given in the following Table.\n\n| Pastry    | Revenue per Unit | Cost per Unit | Ingredients (lbs) | Labor (hours) |\n|-----------|------------------|---------------|--------------------|---------------|\n| Croissants| 2$               | 0.5$          | 0.5                | 0.2           |\n| Muffins   | 3$               | 1$            | 0.4                | 0.3           |\n| Doughnuts | 1.5$             | 0.7$          | 0.3                | 0.1           |\n\nThe bakery has a daily limit of 100 pounds of flour and 80 hours of labor. The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand. The total number of pastries produced should not exceed 200 to maintain quality.\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Doughnuts) - (0.5*Croissants + 1*Muffins + 0.7*Doughnuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80)\n## The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n## The total number of pastries produced should not exceed 200 to maintain quality.\nmodel.addCons(Croissants + Muffins + Doughnuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. \nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds.\n// 0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 80 hours of labor. Each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\n// Croissants >= 20, Muffins >= 30\n\n## Generate Constraint-4:\nThe total number of pastries produced should not exceed 200 to maintain quality.\n// Croissants + Muffins + Doughnuts <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the ingredients and labor required. The revenue per croissant is $2, per muffin is $3, and per doughnut is $1.5. The cost per croissant is $0.5, per muffin is $1, and per doughnut is $0.7. The bakery has a daily limit of 100 pounds of flour, where each croissant requires 0.5 pounds, each muffin requires 0.4 pounds, and each doughnut requires 0.3 pounds. The bakery also has a daily limit of 80 hours of labor, where each croissant requires 0.2 hours, each muffin requires 0.3 hours, and each doughnut requires 0.1 hours. The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand. Additionally, the total number of pastries produced should not exceed 200 to maintain quality. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Doughnuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Doughnuts\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 1.5*Doughnuts) - (0.5*Croissants + 1*Muffins + 0.7*Doughnuts))\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Doughnuts <= 100)\n## The bakery has a daily limit of 80 hours of labor.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.1*Doughnuts <= 80)\n## The bakery must produce at least 20 croissants and 30 muffins daily to meet customer demand.\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n## The total number of pastries produced should not exceed 200 to maintain quality.\nmodel.addCons(Croissants + Muffins + Doughnuts <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. \nThe cost per chocolate cake is $10, and the cost per vanilla cake is $8. \nThe rental cost per oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n// Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery must use at least 50 kg of chocolate ingredients daily.\n// Chocolate_Ingredients >= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent. The revenue and cost per cake, as well as the rental cost per oven, are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Ingredients Required per Cake |\n|------------------|------------------|---------------|-------------------------------|\n| Chocolate        | $20              | $10           | 2 kg                          |\n| Vanilla          | $18              | $8            | 1 kg                          |\n\nThe rental cost per oven per day is $150. The bakery has 100 kg of ingredients available daily. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day. The bakery needs to rent at least one oven and must use at least 50 kg of chocolate ingredients daily.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\nTotal_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n## Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nTotal_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n## The bakery must use at least 50 kg of chocolate ingredients daily.\nmodel.addCons(Chocolate_Ingredients >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Number of chocolate ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. \nThe cost per chocolate cake is $10, and the cost per vanilla cake is $8. \nThe rental cost per oven per day is $150.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n// Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nThe time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery must use at least 50 kg of chocolate ingredients daily.\n// Chocolate_Ingredients >= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily, considering the availability of ingredients and the number of ovens to rent. The revenue per chocolate cake is $20, and the revenue per vanilla cake is $18. The cost per chocolate cake is $10, and the cost per vanilla cake is $8. The rental cost per oven per day is $150. The bakery wants to maximize the daily profit.\nThe chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available. The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day. The bakery needs to rent at least one oven. The bakery must use at least 50 kg of chocolate ingredients daily.\nPlease help the bakery determine the optimal number of chocolate and vanilla cakes to produce and the number of ovens to rent to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce and the number of ovens to rent\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\nTotal_Revenue = 20*Chocolate_Cakes + 18*Vanilla_Cakes\n## Total_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nTotal_Cost = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 150*Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The chocolate ingredients required per chocolate cake is 2 kg, and the vanilla ingredients required per vanilla cake is 1 kg. Each day, 100 kg of ingredients are available.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The time required to bake a chocolate cake is 2 hours, and the time required to bake a vanilla cake is 1 hour. Each oven can operate for 10 hours per day.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 10*Ovens)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n## The bakery must use at least 50 kg of chocolate ingredients daily.\nmodel.addCons(Chocolate_Ingredients >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Number of chocolate ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 40\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\n// 0.5*Wheat_Bread + 0.7*Rye_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10\n\n## Generate Constraint-4:\nThe bakery must rent at least 5 hours of oven time for each type of bread to cover the setup costs.\n// Wheat_Oven_Hours >= 5, Rye_Oven_Hours >= 5",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type. The revenue and costs for each type of bread and oven rental are given in the following Table.\n\n| Bread Type | Revenue per Loaf | Cost per Loaf | Cost per Oven Hour |\n|------------|------------------|---------------|---------------------|\n| Wheat      | $3               | $1            | $50                 |\n| Rye        | $4               | $2            | $60                 |\n\nThe bakery wants to maximize the daily profit. Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day. The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour. The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand. The bakery must also rent at least 5 hours of oven time for each type of bread to cover the setup costs.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce and the optimal number of oven hours to rent for each type to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of oven hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven_Hours\", lb=0) # number of oven hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven_Hours\", lb=0) # number of oven hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours))\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 40)\n## The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\nmodel.addCons(0.5*Wheat_Bread + 0.7*Rye_Bread <= 50)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n## The bakery must rent at least 5 hours of oven time for each type of bread to cover the setup costs.\nmodel.addCons(Wheat_Oven_Hours >= 5)\nmodel.addCons(Rye_Oven_Hours >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of oven hours for wheat bread: \", model.getVal(Wheat_Oven_Hours))\n    print(\"Number of oven hours for rye bread: \", model.getVal(Rye_Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type.\n// {\"number of wheat bread loaves\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for wheat bread\": \"Wheat_Oven_Hours\", \"range\": \"Wheat_Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of oven hours for rye bread\": \"Rye_Oven_Hours\", \"range\": \"Rye_Oven_Hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n// Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 40\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\n// 0.5*Wheat_Bread + 0.7*Rye_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\n// Wheat_Bread >= 10, Rye_Bread >= 10\n\n## Generate Constraint-4:\nThe bakery must rent at least 5 hours of oven time for each type of bread to cover the setup costs.\n// Wheat_Oven_Hours >= 5, Rye_Oven_Hours >= 5",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce and how many hours to rent the ovens for each type.\nThe revenue per loaf of wheat bread is $3, and the revenue per loaf of rye bread is $4. \nThe cost per loaf of wheat bread is $1, and the cost per loaf of rye bread is $2. \nThe cost per hour of oven rental for wheat bread is $50, and the cost per hour of oven rental for rye bread is $60.\nThe bakery wants to maximize the daily profit.\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\nThe bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\nThe bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\nThe bakery must rent at least 5 hours of oven time for each type of bread to cover the setup costs.\nPlease help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of oven hours for each type\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat bread loaves\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye bread loaves\nWheat_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven_Hours\", lb=0) # number of oven hours for wheat bread\nRye_Oven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven_Hours\", lb=0) # number of oven hours for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Wheat_Bread + 4*Rye_Bread\n## Total_Cost = Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours\nmodel.addCons(obj == (3*Wheat_Bread + 4*Rye_Bread) - (Wheat_Bread + 2*Rye_Bread + 50*Wheat_Oven_Hours + 60*Rye_Oven_Hours))\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery can rent a maximum of 40 hours of oven time per day.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 40)\n## The bakery has a daily supply of 50 kg of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.7 kg of flour.\nmodel.addCons(0.5*Wheat_Bread + 0.7*Rye_Bread <= 50)\n## The bakery must produce at least 10 loaves of wheat bread and 10 loaves of rye bread per day to meet minimum customer demand.\nmodel.addCons(Wheat_Bread >= 10)\nmodel.addCons(Rye_Bread >= 10)\n## The bakery must rent at least 5 hours of oven time for each type of bread to cover the setup costs.\nmodel.addCons(Wheat_Oven_Hours >= 5)\nmodel.addCons(Rye_Oven_Hours >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Bread))\n    print(\"Number of oven hours for wheat bread: \", model.getVal(Wheat_Oven_Hours))\n    print(\"Number of oven hours for rye bread: \", model.getVal(Rye_Oven_Hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts.\n// Croissants >= 50, Muffins >= 30, Doughnuts >= 40",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry    | Revenue per Pastry | Cost per Pastry | Baking Time per Pastry | Flour Required per Pastry |\n|-----------|--------------------|-----------------|------------------------|---------------------------|\n| Croissants| 2$                | 1$              | 10 minutes             | 0.1 kg                    |\n| Muffins   | 3$                | 1.5$            | 15 minutes             | 0.2 kg                    |\n| Doughnuts | 4$                | 2$              | 20 minutes             | 0.3 kg                    |\n\nThe bakery wants to maximize the daily profit. The baking time required for each pastry and the maximum operating time of each oven are given in the table. The bakery has a daily supply of 200 kg of flour. The bakery needs to rent at least one oven. The bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts. Please help the bakery determine the optimal number of each type of pastry to produce and the number of ovens to rent to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Doughnuts) - (Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens))\n\n# Add constraints\n## The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens)\n## The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n## The bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Doughnuts >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per doughnut is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n// Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts.\n// Croissants >= 50, Muffins >= 30, Doughnuts >= 40",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for baking these pastries. The revenue per croissant is $2, per muffin is $3, and per doughnut is $4. The cost per croissant is $1, per muffin is $1.5, and per doughnut is $2. The rental cost per oven per day is $100. The bakery wants to maximize the daily profit. The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour. The bakery needs to rent at least one oven. The bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts.\n\nPlease help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Doughnuts\n## Total_Cost = Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Doughnuts) - (Croissants + 1.5*Muffins + 2*Doughnuts + 100*Ovens))\n\n# Add constraints\n## The baking time required per croissant is 10 minutes, per muffin is 15 minutes, and per doughnut is 20 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(10*Croissants + 15*Muffins + 20*Doughnuts <= 480*Ovens)\n## The bakery has a daily supply of 200 kg of flour. Each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each doughnut requires 0.3 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Doughnuts <= 200)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n## The bakery has a daily demand for at least 50 croissants, 30 muffins, and 40 doughnuts.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Doughnuts >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of donut ovens to rent\": \"Donut_Ovens\", \"range\": \"Donut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to produce at least 50 pastries of each type daily.\n// Croissants >= 50, Muffins >= 50, Donuts >= 50\n\n## Generate Constraint-4:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Donut_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue and cost per pastry, as well as the rental cost per oven per day, are given in the following Table.\n\n| Pastry     | Revenue per Pastry | Cost per Pastry | Rental Cost per Oven per Day |\n|------------|--------------------|-----------------|------------------------------|\n| Croissants | $2                 | $1              | $100                         |\n| Muffins    | $3                 | $1.5            | $120                         |\n| Donuts     | $2.5               | $1.2            | $90                          |\n\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily budget of $500 for oven rentals. The bakery needs to produce at least 50 pastries of each type daily. The bakery also needs to rent at least one oven for each type of pastry.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDonut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donut_Ovens\", lb=0) # number of donut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500)\n## The bakery needs to produce at least 50 pastries of each type daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Donuts >= 50)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Donut_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of donut ovens to rent: \", model.getVal(Donut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of croissant ovens to rent\": \"Croissant_Ovens\", \"range\": \"Croissant_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of muffin ovens to rent\": \"Muffin_Ovens\", \"range\": \"Muffin_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of donut ovens to rent\": \"Donut_Ovens\", \"range\": \"Donut_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $2.5. \nThe cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. \nThe rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n// Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\n// 15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $500 for oven rentals.\n// 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500\n\n## Generate Constraint-3:\nThe bakery needs to produce at least 50 pastries of each type daily.\n// Croissants >= 50, Muffins >= 50, Donuts >= 50\n\n## Generate Constraint-4:\nThe bakery needs to rent at least one oven for each type of pastry.\n// Croissant_Ovens >= 1, Muffin_Ovens >= 1, Donut_Ovens >= 1",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily, as well as how many ovens to rent for each type of pastry to meet demand and optimize profits. The revenue per croissant is $2, per muffin is $3, and per donut is $2.5. The cost per croissant is $1, per muffin is $1.5, and per donut is $1.2. The rental cost per croissant oven per day is $100, per muffin oven is $120, and per donut oven is $90. The bakery wants to maximize the daily profit. The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day. The bakery has a daily budget of $500 for oven rentals. The bakery needs to produce at least 50 pastries of each type daily. The bakery needs to rent at least one oven for each type of pastry. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nCroissant_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Croissant_Ovens\", lb=0) # number of croissant ovens to rent\nMuffin_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Muffin_Ovens\", lb=0) # number of muffin ovens to rent\nDonut_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Donut_Ovens\", lb=0) # number of donut ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 2.5*Donuts\n## Total_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nTotal_Cost = Croissants + 1.5*Muffins + 1.2*Donuts + 100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The baking time required per croissant is 15 minutes, per muffin is 20 minutes, and per donut is 10 minutes. Each oven can operate for a maximum of 480 minutes per day.\nmodel.addCons(15*Croissants/Croissant_Ovens + 20*Muffins/Muffin_Ovens + 10*Donuts/Donut_Ovens <= 480)\n## The bakery has a daily budget of $500 for oven rentals.\nmodel.addCons(100*Croissant_Ovens + 120*Muffin_Ovens + 90*Donut_Ovens <= 500)\n## The bakery needs to produce at least 50 pastries of each type daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Donuts >= 50)\n## The bakery needs to rent at least one oven for each type of pastry.\nmodel.addCons(Croissant_Ovens >= 1)\nmodel.addCons(Muffin_Ovens >= 1)\nmodel.addCons(Donut_Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of croissant ovens to rent: \", model.getVal(Croissant_Ovens))\n    print(\"Number of muffin ovens to rent: \", model.getVal(Muffin_Ovens))\n    print(\"Number of donut ovens to rent: \", model.getVal(Donut_Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of equipment to rent\": \"Equipment\", \"range\": \"Equipment >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per equipment per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units.\n// 0.5*Croissants + Muffins + 0.5*Donuts <= 150\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one equipment for production.\n// Equipment >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily labor limit of 10 hours. Each croissant requires 0.1 hours, each muffin requires 0.2 hours, and each donut requires 0.1 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.1*Donuts <= 10",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment. The revenue and cost per pastry, as well as the rental cost per equipment, are given in the following Table.\n\n| Pastry    | Revenue per Unit | Cost per Unit |\n|-----------|------------------|---------------|\n| Croissants| 2$              | 0.5$          |\n| Muffins   | 3$              | 1$            |\n| Donuts    | 1.5$            | 0.7$          |\n\nThe rental cost per equipment per day is $50.\n\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit. The bakery also has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units. The bakery needs to rent at least one equipment for production. Additionally, the bakery has a daily labor limit of 10 hours. Each croissant requires 0.1 hours, each muffin requires 0.2 hours, and each donut requires 0.1 hours.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of equipment to rent\nEquipment = model.addVar(vtype=\"INTEGER\", name=\"Equipment\", lb=0) # number of equipment to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 200 units of flour.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a daily limit of 150 units of sugar.\nmodel.addCons(0.5*Croissants + Muffins + 0.5*Donuts <= 150)\n## The bakery needs to rent at least one equipment for production.\nmodel.addCons(Equipment >= 1)\n## The bakery has a daily labor limit of 10 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.1*Donuts <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of equipment to rent: \", model.getVal(Equipment))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of equipment to rent\": \"Equipment\", \"range\": \"Equipment >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. \nThe rental cost per equipment per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units.\n// 0.5*Croissants + Muffins + 0.5*Donuts <= 150\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one equipment for production.\n// Equipment >= 1\n\n## Generate Constraint-4:\nThe bakery has a daily labor limit of 10 hours. Each croissant requires 0.1 hours, each muffin requires 0.2 hours, and each donut requires 0.1 hours.\n// 0.1*Croissants + 0.2*Muffins + 0.1*Donuts <= 10",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily, considering the cost of ingredients, labor, and the rental cost of equipment.\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per croissant is $0.5, per muffin is $1, and per donut is $0.7. The rental cost per equipment per day is $50. The bakery wants to maximize the daily profit.\nThe bakery has a daily limit of 200 units of flour. Each croissant requires 1 unit, each muffin requires 2 units, and each donut requires 1 unit. The bakery also has a daily limit of 150 units of sugar. Each croissant requires 0.5 units, each muffin requires 1 unit, and each donut requires 0.5 units. The bakery needs to rent at least one equipment for production. Additionally, the bakery has a daily labor limit of 10 hours. Each croissant requires 0.1 hours, each muffin requires 0.2 hours, and each donut requires 0.1 hours.\nPlease help the bakery to maximize the daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The number of equipment to rent\nEquipment = model.addVar(vtype=\"INTEGER\", name=\"Equipment\", lb=0) # number of equipment to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nTotal_Cost = 0.5*Croissants + 1*Muffins + 0.7*Donuts + 50*Equipment\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 200 units of flour.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a daily limit of 150 units of sugar.\nmodel.addCons(0.5*Croissants + Muffins + 0.5*Donuts <= 150)\n## The bakery needs to rent at least one equipment for production.\nmodel.addCons(Equipment >= 1)\n## The bakery has a daily labor limit of 10 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.1*Donuts <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of equipment to rent: \", model.getVal(Equipment))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake ingredients\": \"Strawberry_Ingredients\", \"range\": \"Strawberry_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. \nThe cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. \nThe cost of ingredients for each type of cake is $5.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n// Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each chocolate cake requires 2 kg of flour, each vanilla cake requires 1 kg, and each strawberry cake requires 3 kg.\n// 2*Chocolate + Vanilla + 3*Strawberry <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each chocolate cake requires 1 kg of sugar, each vanilla cake requires 2 kg, and each strawberry cake requires 1 kg.\n// Chocolate + 2*Vanilla + Strawberry <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for each type of cake. The maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20.\n// Chocolate <= 30, Vanilla <= 25, Strawberry <= 20\n\n## Generate Constraint-4:\nThe bakery must use at least the minimum required amount of ingredients for each type of cake to maintain quality. The minimum required ingredients for chocolate cakes is 10 kg, for vanilla cakes is 5 kg, and for strawberry cakes is 15 kg.\n// Chocolate_Ingredients >= 10, Vanilla_Ingredients >= 5, Strawberry_Ingredients >= 15",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake. The revenue and cost per cake, as well as the ingredient requirements, are given in the following Table.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Ingredient Cost | Flour Required (kg) | Sugar Required (kg) |\n|-----------------|------------------|---------------|-----------------|---------------------|---------------------|\n| Chocolate       | $20              | $10           | $5              | 2                   | 1                   |\n| Vanilla         | $18              | $8            | $5              | 1                   | 2                   |\n| Strawberry      | $22              | $12           | $5              | 3                   | 1                   |\n\nThe bakery has 100 kg of flour and 50 kg of sugar available daily. The bakery has a daily demand limit for each type of cake: the maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20. The bakery must use at least the minimum required amount of ingredients for each type of cake to maintain quality: the minimum required ingredients for chocolate cakes is 10 kg, for vanilla cakes is 5 kg, and for strawberry cakes is 15 kg.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the amount of ingredients\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\nStrawberry_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ingredients\", lb=0) # number of strawberry cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n## Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\nmodel.addCons(obj == (20*Chocolate + 18*Vanilla + 22*Strawberry) - (10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(2*Chocolate + Vanilla + 3*Strawberry <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(Chocolate + 2*Vanilla + Strawberry <= 50)\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Chocolate <= 30)\nmodel.addCons(Vanilla <= 25)\nmodel.addCons(Strawberry <= 20)\n## The bakery must use at least the minimum required amount of ingredients for each type of cake.\nmodel.addCons(Chocolate_Ingredients >= 10)\nmodel.addCons(Vanilla_Ingredients >= 5)\nmodel.addCons(Strawberry_Ingredients >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Amount of chocolate cake ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Amount of vanilla cake ingredients: \", model.getVal(Vanilla_Ingredients))\n    print(\"Amount of strawberry cake ingredients: \", model.getVal(Strawberry_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1552,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake.\n// {\"number of chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cake ingredients\": \"Chocolate_Ingredients\", \"range\": \"Chocolate_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake ingredients\": \"Vanilla_Ingredients\", \"range\": \"Vanilla_Ingredients >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake ingredients\": \"Strawberry_Ingredients\", \"range\": \"Strawberry_Ingredients >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. \nThe cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. \nThe cost of ingredients for each type of cake is $5.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n// Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each chocolate cake requires 2 kg of flour, each vanilla cake requires 1 kg, and each strawberry cake requires 3 kg.\n// 2*Chocolate + Vanilla + 3*Strawberry <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each chocolate cake requires 1 kg of sugar, each vanilla cake requires 2 kg, and each strawberry cake requires 1 kg.\n// Chocolate + 2*Vanilla + Strawberry <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for each type of cake. The maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20.\n// Chocolate <= 30, Vanilla <= 25, Strawberry <= 20\n\n## Generate Constraint-4:\nThe bakery must use at least the minimum required amount of ingredients for each type of cake to maintain quality. The minimum required ingredients for chocolate cakes is 10 kg, for vanilla cakes is 5 kg, and for strawberry cakes is 15 kg.\n// Chocolate_Ingredients >= 10, Vanilla_Ingredients >= 5, Strawberry_Ingredients >= 15",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of cake. The revenue per chocolate cake is $20, per vanilla cake is $18, and per strawberry cake is $22. The cost per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $12. The cost of ingredients for each type of cake is $5.\n\nThe bakery has 100 kg of flour available daily. Each chocolate cake requires 2 kg of flour, each vanilla cake requires 1 kg, and each strawberry cake requires 3 kg. The bakery also has 50 kg of sugar available daily. Each chocolate cake requires 1 kg of sugar, each vanilla cake requires 2 kg, and each strawberry cake requires 1 kg.\n\nThe bakery has a daily demand limit for each type of cake. The maximum number of chocolate cakes that can be sold is 30, vanilla cakes is 25, and strawberry cakes is 20. Additionally, the bakery must use at least the minimum required amount of ingredients for each type of cake to maintain quality. The minimum required ingredients for chocolate cakes is 10 kg, for vanilla cakes is 5 kg, and for strawberry cakes is 15 kg.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of each type of cake to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and the amount of ingredients\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of strawberry cakes\nChocolate_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ingredients\", lb=0) # number of chocolate cake ingredients\nVanilla_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ingredients\", lb=0) # number of vanilla cake ingredients\nStrawberry_Ingredients = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ingredients\", lb=0) # number of strawberry cake ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 20*Chocolate + 18*Vanilla + 22*Strawberry\n## Total_Cost = 10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients\nmodel.addCons(obj == (20*Chocolate + 18*Vanilla + 22*Strawberry) - (10*Chocolate + 8*Vanilla + 12*Strawberry + 5*Chocolate_Ingredients + 5*Vanilla_Ingredients + 5*Strawberry_Ingredients))\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(2*Chocolate + Vanilla + 3*Strawberry <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(Chocolate + 2*Vanilla + Strawberry <= 50)\n## The bakery has a daily demand limit for each type of cake.\nmodel.addCons(Chocolate <= 30)\nmodel.addCons(Vanilla <= 25)\nmodel.addCons(Strawberry <= 20)\n## The bakery must use at least the minimum required amount of ingredients for each type of cake.\nmodel.addCons(Chocolate_Ingredients >= 10)\nmodel.addCons(Vanilla_Ingredients >= 5)\nmodel.addCons(Strawberry_Ingredients >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Amount of chocolate cake ingredients: \", model.getVal(Chocolate_Ingredients))\n    print(\"Amount of vanilla cake ingredients: \", model.getVal(Vanilla_Ingredients))\n    print(\"Amount of strawberry cake ingredients: \", model.getVal(Strawberry_Ingredients))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1390,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 10 units of product D.\n// D <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material Units per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------------|----------------------|\n| A       | 10$             | 2                            | 1                    |\n| B       | 15$             | 3                            | 2                    |\n| C       | 20$             | 4                            | 3                    |\n| D       | 25$             | 5                            | 4                    |\n\nThe company has 100 raw material units available. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 60 labor hours available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company must produce at least 5 units of product A. The company can produce at most 10 units of product D.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company can produce at most 10 units of product D.\nmodel.addCons(D <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 10 units of product D.\n// D <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available. The company must produce at least 5 units of product A. The company can produce at most 10 units of product D.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company can produce at most 10 units of product D.\nmodel.addCons(D <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\n// 4*A + 6*B + 3*C + 5*D <= 120\n\n## Generate Constraint-3:\nThe company has a minimum demand for product C, which is 5 units.\n// C >= 5\n\n## Generate Constraint-4:\nThe company cannot produce more than 15 units of product A.\n// A <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The following table summarizes the labor hours and raw materials required for each product.\n\n| Product | Labor Hours per Unit | Raw Materials per Unit |\n|---------|----------------------|------------------------|\n| A       | 2 hours              | 4 units                |\n| B       | 3 hours              | 6 units                |\n| C       | 1 hour               | 3 units                |\n| D       | 2 hours              | 5 units                |\n\nThe company has a total of 100 labor hours and 120 units of raw materials available. The company has a minimum demand for product C, which is 5 units, and cannot produce more than 15 units of product A. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\nmodel.addCons(4*A + 6*B + 3*C + 5*D <= 120)\n## The company has a minimum demand for product C, which is 5 units.\nmodel.addCons(C >= 5)\n## The company cannot produce more than 15 units of product A.\nmodel.addCons(A <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\n// 4*A + 6*B + 3*C + 5*D <= 120\n\n## Generate Constraint-3:\nThe company has a minimum demand for product C, which is 5 units.\n// C >= 5\n\n## Generate Constraint-4:\nThe company cannot produce more than 15 units of product A.\n// A <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively, with a total available labor hours of 100 hours. Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively, with a total available raw materials of 120 units. The company has a minimum demand for product C, which is 5 units, and cannot produce more than 15 units of product A.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 hours of labor respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## Each unit of product A, B, C, and D requires 4, 6, 3, and 5 units of raw materials respectively. The total available raw materials are 120 units.\nmodel.addCons(4*A + 6*B + 3*C + 5*D <= 120)\n## The company has a minimum demand for product C, which is 5 units.\nmodel.addCons(C >= 5)\n## The company cannot produce more than 15 units of product A.\nmodel.addCons(A <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material Units per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------------|----------------------|\n| A       | 10$             | 2                            | 1                    |\n| B       | 15$             | 3                            | 2                    |\n| C       | 20$             | 4                            | 3                    |\n| D       | 25$             | 5                            | 4                    |\n\nThe company has 100 raw material units available. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 60 labor hours available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company must produce at least 5 units of product A and at least 3 units of product B.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively, and the company has 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively, and the company has 60 labor hours available. The company must produce at least 5 units of product A and at least 3 units of product B. Please help the company determine the optimal number of units of each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D\n\n## Generate Constraint-4:\nThe production of Product B cannot exceed the combined production of Products A and C.\n// B <= A + C",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|---------------------------|\n| A       | $10             | $5                        |\n| B       | $15             | $7                        |\n| C       | $8              | $4                        |\n| D       | $12             | $6                        |\n\nThe company has a budget of $100 for production. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. The production of Product B cannot exceed the combined production of Products A and C.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n## The production of Product B cannot exceed the combined production of Products A and C.\nmodel.addCons(B <= A + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D\n\n## Generate Constraint-4:\nThe production of Product B cannot exceed the combined production of Products A and C.\n// B <= A + C",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit. The production cost per unit for products A-D is $5, $7, $4, and $6 respectively, and the company has a budget of $100 for production. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. The production of Product B cannot exceed the combined production of Products A and C. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $100 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n## The production of Product B cannot exceed the combined production of Products A and C.\nmodel.addCons(B <= A + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not.\n// {\"whether to allocate resources to Project 1\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 2\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 3\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 4\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4\n\n## Generate Constraint-1:\nThe required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\n// 3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10\n\n## Generate Constraint-2:\nThe company can allocate resources to at most two projects.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nAt least one project must be selected.\n// P1 + P2 + P3 + P4 >= 1\n\n## Generate Constraint-4:\nProject 1 and Project 2 cannot be selected together due to conflicting objectives.\n// P1 + P2 <= 1",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not. The expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\n\n| Project | Expected Profit | Required Resources |\n|---------|-----------------|--------------------|\n| 1       | $10,000         | 3 units            |\n| 2       | $15,000         | 5 units            |\n| 3       | $8,000          | 2 units            |\n| 4       | $12,000         | 4 units            |\n\nThe company can allocate resources to at most two projects. At least one project must be selected. Project 1 and Project 2 cannot be selected together due to conflicting objectives. Please help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to allocate resources to each project\nP1 = model.addVar(vtype=\"B\", name=\"P1\") # whether to allocate resources to Project 1\nP2 = model.addVar(vtype=\"B\", name=\"P2\") # whether to allocate resources to Project 2\nP3 = model.addVar(vtype=\"B\", name=\"P3\") # whether to allocate resources to Project 3\nP4 = model.addVar(vtype=\"B\", name=\"P4\") # whether to allocate resources to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4)\n\n# Add constraints\n## The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\nmodel.addCons(3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10)\n## The company can allocate resources to at most two projects.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## At least one project must be selected.\nmodel.addCons(P1 + P2 + P3 + P4 >= 1)\n## Project 1 and Project 2 cannot be selected together due to conflicting objectives.\nmodel.addCons(P1 + P2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to allocate resources to Project 1: \", model.getVal(P1))\n    print(\"Whether to allocate resources to Project 2: \", model.getVal(P2))\n    print(\"Whether to allocate resources to Project 3: \", model.getVal(P3))\n    print(\"Whether to allocate resources to Project 4: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not.\n// {\"whether to allocate resources to Project 1\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 2\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 3\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to allocate resources to Project 4\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4\n\n## Generate Constraint-1:\nThe required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\n// 3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10\n\n## Generate Constraint-2:\nThe company can allocate resources to at most two projects.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nAt least one project must be selected.\n// P1 + P2 + P3 + P4 >= 1\n\n## Generate Constraint-4:\nProject 1 and Project 2 cannot be selected together due to conflicting objectives.\n// P1 + P2 <= 1",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. The decision is whether to allocate resources to each project or not. The expected profits from projects 1-4 are $10,000, $15,000, $8,000, and $12,000 respectively. The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively, and the company has a total of 10 units of resources available. The company can allocate resources to at most two projects and must select at least one project. Additionally, Project 1 and Project 2 cannot be selected together due to conflicting objectives.\nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to allocate resources to each project\nP1 = model.addVar(vtype=\"B\", name=\"P1\") # whether to allocate resources to Project 1\nP2 = model.addVar(vtype=\"B\", name=\"P2\") # whether to allocate resources to Project 2\nP3 = model.addVar(vtype=\"B\", name=\"P3\") # whether to allocate resources to Project 3\nP4 = model.addVar(vtype=\"B\", name=\"P4\") # whether to allocate resources to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000*P1 + 15000*P2 + 8000*P3 + 12000*P4)\n\n# Add constraints\n## The required resources for projects 1-4 are 3 units, 5 units, 2 units, and 4 units respectively. The company has a total of 10 units of resources available.\nmodel.addCons(3*P1 + 5*P2 + 2*P3 + 4*P4 <= 10)\n## The company can allocate resources to at most two projects.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## At least one project must be selected.\nmodel.addCons(P1 + P2 + P3 + P4 >= 1)\n## Project 1 and Project 2 cannot be selected together due to conflicting objectives.\nmodel.addCons(P1 + P2 <= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to allocate resources to Project 1: \", model.getVal(P1))\n    print(\"Whether to allocate resources to Project 2: \", model.getVal(P2))\n    print(\"Whether to allocate resources to Project 3: \", model.getVal(P3))\n    print(\"Whether to allocate resources to Project 4: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 683,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 20 units for all products combined.\n// A + B + C + D <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Materials per Unit (kg) |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2                    | 3                           |\n| B       | 15$             | 3                    | 2                           |\n| C       | 20$             | 4                    | 1                           |\n| D       | 25$             | 5                    | 4                           |\n\nThe company has a total of 100 labor hours available. The total available raw materials are 80 kg. The company has a storage capacity limit of 20 units for all products combined. The company must produce at least 3 units of product B.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company has a storage capacity limit of 20 units for all products combined.\nmodel.addCons(A + B + C + D <= 20)\n## The company must produce at least 3 units of product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 20 units for all products combined.\n// A + B + C + D <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, with a total available labor hours of 100. The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively, with a total available raw materials of 80 kg. The company has a storage capacity limit of 20 units for all products combined. The company must also produce at least 3 units of product B. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The total available labor hours are 100.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The total available raw materials are 80 kg.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company has a storage capacity limit of 20 units for all products combined.\nmodel.addCons(A + B + C + D <= 20)\n## The company must produce at least 3 units of product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 15 units in total.\n// A + B + C + D >= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Materials (kg) | Labor Hours | Profit per Unit |\n|---------|--------------------|-------------|-----------------|\n| A       | 2                  | 1           | $10             |\n| B       | 3                  | 2           | $15             |\n| C       | 4                  | 3           | $20             |\n| D       | 5                  | 4           | $25             |\n\nThe company has 100 kg of raw materials available and 50 labor hours available. The market demand for Product A is at most 10 units, and for Product D is at least 5 units. The company must produce at least 15 units in total. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n## The company must produce at least 15 units in total.\nmodel.addCons(A + B + C + D >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 15 units in total.\n// A + B + C + D >= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units. The company must produce at least 15 units in total.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n## The company must produce at least 15 units in total.\nmodel.addCons(A + B + C + D >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A.\n// B + C <= 2*A",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2 hours              | 3 units                     |\n| B       | 15$             | 3 hours              | 2 units                     |\n| C       | 20$             | 4 hours              | 1 unit                      |\n| D       | 25$             | 5 hours              | 4 units                     |\n\nThe company has a total of 100 labor hours and 60 units of raw material available. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. The company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A.\n\nPlease help the company to maximize the total profit by determining the optimal quantity of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n## The company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A.\n// B + C <= 2*A",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours and raw material. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100. These products also require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. The company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n## The company aims to maintain a balanced production, requiring that the total production of Products B and C does not exceed twice the production of Product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours.\n// {\"amount of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of Product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 20\n\n## Generate Constraint-2:\nThe labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\n// A + 2*B + 3*C + 4*D <= 10\n\n## Generate Constraint-3:\nThe company can produce at most 5 units of each product.\n// A <= 5, B <= 5, C <= 5, D <= 5\n\n## Generate Constraint-4:\nThe company must produce at least 2 units of product A.\n// A >= 2",
        "question": "A manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The raw materials and labor hours required for each product are given in the following Table.\n\n| Product | Raw Materials (kg) | Labor Hours | Profit per Unit |\n|---------|--------------------|-------------|-----------------|\n| A       | 2                  | 1           | $10             |\n| B       | 3                  | 2           | $15             |\n| C       | 4                  | 3           | $20             |\n| D       | 5                  | 4           | $25             |\n\nThe company has 20 kg of raw materials available and 10 hours of labor available. The company can produce at most 5 units of each product. The company must produce at least 2 units of product A. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # amount of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # amount of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # amount of Product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # amount of Product D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 20)\n## The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 10)\n## The company can produce at most 5 units of each product.\nmodel.addCons(A <= 5)\nmodel.addCons(B <= 5)\nmodel.addCons(C <= 5)\nmodel.addCons(D <= 5)\n## The company must produce at least 2 units of product A.\nmodel.addCons(A >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(A))\n    print(\"Amount of Product B produced: \", model.getVal(B))\n    print(\"Amount of Product C produced: \", model.getVal(C))\n    print(\"Amount of Product D produced: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. Each product requires a specific amount of raw materials and labor hours.\n// {\"amount of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of Product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 20\n\n## Generate Constraint-2:\nThe labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\n// A + 2*B + 3*C + 4*D <= 10\n\n## Generate Constraint-3:\nThe company can produce at most 5 units of each product.\n// A <= 5, B <= 5, C <= 5, D <= 5\n\n## Generate Constraint-4:\nThe company must produce at least 2 units of product A.\n// A >= 2",
        "question": "A manufacturing company is planning to produce four different products (A, B, C, D) to maximize profit. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the company has 20 kg of raw materials available. The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the company has 10 hours of labor available. The company can produce at most 5 units of each product and must produce at least 2 units of product A. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # amount of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # amount of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # amount of Product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # amount of Product D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A, B, C, D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 20 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 20)\n## The labor hours required for products A, B, C, D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 10 hours of labor available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 10)\n## The company can produce at most 5 units of each product.\nmodel.addCons(A <= 5)\nmodel.addCons(B <= 5)\nmodel.addCons(C <= 5)\nmodel.addCons(D <= 5)\n## The company must produce at least 2 units of product A.\nmodel.addCons(A >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(A))\n    print(\"Amount of Product B produced: \", model.getVal(B))\n    print(\"Amount of Product C produced: \", model.getVal(C))\n    print(\"Amount of Product D produced: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 649,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce.\n// {\"number of Widget A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Widget D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\n// 2*A + 3*B + 1*C + 2*D <= 30\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 5 units of Widget C.\n// C >= 5\n\n## Generate Constraint-4:\nThe total production of Widgets A and B combined must not exceed 10 units.\n// A + B <= 10",
        "question": "A manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce. The profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit. The raw materials and labor hours required for each widget are given in the following Table.\n\n| Widget | Raw Materials Required | Labor Hours Required |\n|--------|------------------------|----------------------|\n| A      | 5 units                | 2 hours              |\n| B      | 7 units                | 3 hours              |\n| C      | 4 units                | 1 hour               |\n| D      | 6 units                | 2 hours              |\n\nThe manufacturer has 100 units of raw materials available and 30 labor hours available. The manufacturer must produce at least 5 units of Widget C. The total production of Widgets A and B combined must not exceed 10 units. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Widget A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Widget B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Widget C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 30)\n## The manufacturer must produce at least 5 units of Widget C.\nmodel.addCons(C >= 5)\n## The total production of Widgets A and B combined must not exceed 10 units.\nmodel.addCons(A + B <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A: \", model.getVal(A))\n    print(\"Number of Widget B: \", model.getVal(B))\n    print(\"Number of Widget C: \", model.getVal(C))\n    print(\"Number of Widget D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce.\n// {\"number of Widget A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Widget D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\n// 5*A + 7*B + 4*C + 6*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\n// 2*A + 3*B + 1*C + 2*D <= 30\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 5 units of Widget C.\n// C >= 5\n\n## Generate Constraint-4:\nThe total production of Widgets A and B combined must not exceed 10 units.\n// A + B <= 10",
        "question": "A manufacturer produces four types of widgets (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each widget to produce. The profit per unit for widgets A-D is $30, $40, $20, and $25 respectively. The manufacturer wants to maximize the total profit. The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively, with a total of 100 units of raw materials available. The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively, with a total of 30 labor hours available. The manufacturer must produce at least 5 units of Widget C. The total production of Widgets A and B combined must not exceed 10 units. Please help the manufacturer determine the optimal number of units of each widget to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each widget\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Widget A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Widget B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Widget C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Widget D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for widgets A-D are 5 units, 7 units, 4 units, and 6 units respectively. The manufacturer has 100 units of raw materials available.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 100)\n## The labor hours required for widgets A-D are 2 hours, 3 hours, 1 hour, and 2 hours respectively. The manufacturer has 30 labor hours available.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 30)\n## The manufacturer must produce at least 5 units of Widget C.\nmodel.addCons(C >= 5)\n## The total production of Widgets A and B combined must not exceed 10 units.\nmodel.addCons(A + B <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A: \", model.getVal(A))\n    print(\"Number of Widget B: \", model.getVal(B))\n    print(\"Number of Widget C: \", model.getVal(C))\n    print(\"Number of Widget D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce.\n// {\"number of units of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types.\n// Objective Function: Maximize: 3*B1 + 5*B2 + 2*B3 + 4*B4\n\n## Generate Constraint-1:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively. The bakery has a total of 20 kg of flour available.\n// 2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20\n\n## Generate Constraint-2:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively. The bakery has a total of 10 hours of labor available.\n// 1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 15 units.\n// B1 + B2 + B3 + B4 <= 15\n\n## Generate Constraint-4:\nThe bakery must produce at least 2 units of Bread 3.\n// B3 >= 2",
        "question": "A bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce. The profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types.\n\nThe requirements for each type of bread are as follows:\n\n| Bread Type | Profit per Unit | Flour Required (kg) | Labor Required (hours) |\n|------------|-----------------|---------------------|------------------------|\n| 1          | $3              | 2                   | 1                      |\n| 2          | $5              | 3                   | 2                      |\n| 3          | $2              | 1                   | 0.5                    |\n| 4          | $4              | 2                   | 1.5                    |\n\nThe bakery has a total of 20 kg of flour available and 10 hours of labor available. The bakery also has a storage capacity limit of 15 units. Additionally, the bakery must produce at least 2 units of Bread 3.\n\nPlease help the bakery determine the optimal number of units to produce for each type of bread to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*B1 + 5*B2 + 2*B3 + 4*B4)\n\n# Add constraints\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of flour.\nmodel.addCons(2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20)\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of labor.\nmodel.addCons(1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10)\n## The bakery has a storage capacity limit.\nmodel.addCons(B1 + B2 + B3 + B4 <= 15)\n## The bakery must produce at least 2 units of Bread 3.\nmodel.addCons(B3 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Bread 1: \", model.getVal(B1))\n    print(\"Number of units of Bread 2: \", model.getVal(B2))\n    print(\"Number of units of Bread 3: \", model.getVal(B3))\n    print(\"Number of units of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The bakery needs to decide how many units of each type of bread to produce.\n// {\"number of units of Bread 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Bread 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types.\n// Objective Function: Maximize: 3*B1 + 5*B2 + 2*B3 + 4*B4\n\n## Generate Constraint-1:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively. The bakery has a total of 20 kg of flour available.\n// 2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20\n\n## Generate Constraint-2:\nEach unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively. The bakery has a total of 10 hours of labor available.\n// 1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 15 units.\n// B1 + B2 + B3 + B4 <= 15\n\n## Generate Constraint-4:\nThe bakery must produce at least 2 units of Bread 3.\n// B3 >= 2",
        "question": "A bakery is planning to produce four types of bread (1-4) for the upcoming holiday season. Each type of bread requires a specific amount of ingredients and contributes differently to the bakery's profit. The profit per unit for Bread 1, Bread 2, Bread 3, and Bread 4 is $3, $5, $2, and $4 respectively. The bakery wants to maximize the total profit from the sales of these bread types. Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires 2 kg, 3 kg, 1 kg, and 2 kg of flour respectively, and the bakery has a total of 20 kg of flour available. Each unit also requires 1 hour, 2 hours, 0.5 hours, and 1.5 hours of labor respectively, with a total of 10 hours of labor available. The bakery has a storage capacity limit of 15 units. Additionally, the bakery must produce at least 2 units of Bread 3. Please help the bakery decide how many units of each type of bread to produce to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*B1 + 5*B2 + 2*B3 + 4*B4)\n\n# Add constraints\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of flour.\nmodel.addCons(2*B1 + 3*B2 + 1*B3 + 2*B4 <= 20)\n## Each unit of Bread 1, Bread 2, Bread 3, and Bread 4 requires specific amounts of labor.\nmodel.addCons(1*B1 + 2*B2 + 0.5*B3 + 1.5*B4 <= 10)\n## The bakery has a storage capacity limit.\nmodel.addCons(B1 + B2 + B3 + B4 <= 15)\n## The bakery must produce at least 2 units of Bread 3.\nmodel.addCons(B3 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Bread 1: \", model.getVal(B1))\n    print(\"Number of units of Bread 2: \", model.getVal(B2))\n    print(\"Number of units of Bread 3: \", model.getVal(B3))\n    print(\"Number of units of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The raw materials and labor hours required per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------|----------------------|\n| A       | 10$             | 2 kg                   | 1 hour               |\n| B       | 15$             | 3 kg                   | 2 hours              |\n| C       | 20$             | 4 kg                   | 3 hours              |\n| D       | 25$             | 5 kg                   | 4 hours              |\n\nThe company has 100 kg of raw materials available and 50 labor hours available. The company must produce at least 5 units of Product A and at least 3 units of Product B. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the company has 100 kg of raw materials available. The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the company has 50 labor hours available. The company must produce at least 5 units of Product A and at least 3 units of Product B.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required per unit for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The labor hours required per unit for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200.\n// 2*A + 3*B + 1*C + 2*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units.\n// 4*A + 5*B + 3*C + 4*D <= 180\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\n// A > 10 or B > 10 or C > 10 or D > 10\n\n## Generate Constraint-4:\nThe company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C.\n// B >= A\n// D >= C",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Required |\n|---------|-----------------|----------------------|-----------------------|\n| A       | $50             | 2                    | 4                     |\n| B       | $70             | 3                    | 5                     |\n| C       | $40             | 1                    | 3                     |\n| D       | $30             | 2                    | 4                     |\n\nThe company has a total of 200 labor hours and 180 units of raw material available. The company wants to ensure that at least one of the products is produced in quantities greater than 10 units. Additionally, the company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 200)\n## The company has a limited amount of raw material.\nmodel.addCons(4*A + 5*B + 3*C + 4*D <= 180)\n## The company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\nmodel.addCons(A >= 10*A_b)\nmodel.addCons(B >= 10*B_b)\nmodel.addCons(C >= 10*C_b)\nmodel.addCons(D >= 10*D_b)\nmodel.addCons(A_b + B_b + C_b + D_b >= 1)\n## The company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C.\nmodel.addCons(B >= A)\nmodel.addCons(D >= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200.\n// 2*A + 3*B + 1*C + 2*D <= 200\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units.\n// 4*A + 5*B + 3*C + 4*D <= 180\n\n## Generate Constraint-3:\nThe company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\n// A > 10 or B > 10 or C > 10 or D > 10\n\n## Generate Constraint-4:\nThe company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C.\n// B >= A\n// D >= C",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $50, $70, $40, and $30 respectively. The production of each product requires a certain amount of labor hours: Product A, B, C, and D require 2, 3, 1, and 2 hours respectively, and the total available labor hours are 200. The company also has a limited amount of raw material: Product A, B, C, and D require 4, 5, 3, and 4 units of raw material respectively, and the total available raw material is 180 units. The company wants to ensure that at least one of the products is produced in quantities greater than 10 units. Additionally, the company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 200)\n## The company has a limited amount of raw material.\nmodel.addCons(4*A + 5*B + 3*C + 4*D <= 180)\n## The company wants to ensure that at least one of the products is produced in quantities greater than 10 units.\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\nmodel.addCons(A >= 10*A_b)\nmodel.addCons(B >= 10*B_b)\nmodel.addCons(C >= 10*C_b)\nmodel.addCons(D >= 10*D_b)\nmodel.addCons(A_b + B_b + C_b + D_b >= 1)\n## The company prefers to produce at least as many units of Product B as Product A, and at least as many units of Product D as Product C.\nmodel.addCons(B >= A)\nmodel.addCons(D >= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of product A.\n// A <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product D.\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material Units Required | Labor Hours Required |\n|---------|-----------------|------------------------------|----------------------|\n| A       | $10             | 2                            | 1                    |\n| B       | $15             | 3                            | 2                    |\n| C       | $20             | 4                            | 3                    |\n| D       | $25             | 5                            | 4                    |\n\nThe company has a total of 100 raw material units available and a total of 60 labor hours available. The company can produce at most 20 units of product A and must produce at least 5 units of product D.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company can produce at most 20 units of product A.\nmodel.addCons(A <= 20)\n## The company must produce at least 5 units of product D.\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\n// A + 2*B + 3*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of product A.\n// A <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product D.\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively, and the company has a total of 100 raw material units available. Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively, and the company has a total of 60 labor hours available. The company can produce at most 20 units of product A and must produce at least 5 units of product D.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 raw material units respectively. The company has a total of 100 raw material units available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of product A, B, C, and D requires 1, 2, 3, and 4 labor hours respectively. The company has a total of 60 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 60)\n## The company can produce at most 20 units of product A.\nmodel.addCons(A <= 20)\n## The company must produce at least 5 units of product D.\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Materials per Unit (kg) |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2                    | 3                           |\n| B       | 15$             | 3                    | 2                           |\n| C       | 20$             | 4                    | 1                           |\n| D       | 25$             | 5                    | 4                           |\n\nThe company has a total of 100 labor hours available and 60 kg of raw materials. The company can produce at most 20 units in total. The company must produce at least 5 units of product A.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## The company can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nThe company can produce at most 20 units in total.\n// A + B + C + D <= 20\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product A.\n// A >= 5",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, and the company has a total of 100 labor hours available. The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively, and the company has a total of 60 kg of raw materials available. The company can produce at most 20 units in total. The company must produce at least 5 units of product A.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw materials required for each unit of product A, B, C, and D are 3, 2, 1, and 4 kg respectively. The company has a total of 60 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## The company can produce at most 20 units in total.\nmodel.addCons(A + B + C + D <= 20)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of Product A.\n// A <= 20\n\n## Generate Constraint-4:\nThe company can produce at most 15 units of Product B.\n// B <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Material (kg) | Labor Hours | Profit per Unit |\n|---------|-------------------|-------------|-----------------|\n| A       | 2                 | 1           | $10             |\n| B       | 3                 | 2           | $15             |\n| C       | 4                 | 3           | $20             |\n| D       | 5                 | 4           | $25             |\n\nThe company has 100 kg of raw material available and 50 labor hours available. The company can produce at most 20 units of Product A and at most 15 units of Product B. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company can produce at most 20 units of Product A.\nmodel.addCons(A <= 20)\n## The company can produce at most 15 units of Product B.\nmodel.addCons(B <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company can produce at most 20 units of Product A.\n// A <= 20\n\n## Generate Constraint-4:\nThe company can produce at most 15 units of Product B.\n// B <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company can produce at most 20 units of Product A and at most 15 units of Product B.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company can produce at most 20 units of Product A.\nmodel.addCons(A <= 20)\n## The company can produce at most 15 units of Product B.\nmodel.addCons(B <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\n// 2*A + 3*B + 2*C + 4*D <= 60\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\n// A + 2*B + C + 3*D <= 40\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 5 units, and for Product D is at most 6 units.\n// A >= 5\n// D <= 6\n\n## Generate Constraint-4:\nThe company aims to produce at least 10 units in total.\n// A + B + C + D >= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. The following table summarizes the raw material and labor requirements for each product:\n\n| Product | Raw Material (kg) | Labor Hours |\n|---------|-------------------|-------------|\n| A       | 2                 | 1           |\n| B       | 3                 | 2           |\n| C       | 2                 | 1           |\n| D       | 4                 | 3           |\n\nThe company has 60 kg of raw material and 40 labor hours available. The market demand for Product A is at least 5 units, and for Product D is at most 6 units. The company aims to produce at least 10 units in total.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\nmodel.addCons(2*A + 3*B + 2*C + 4*D <= 60)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\nmodel.addCons(A + 2*B + C + 3*D <= 40)\n## The market demand for Product A is at least 5 units, and for Product D is at most 6 units.\nmodel.addCons(A >= 5)\nmodel.addCons(D <= 6)\n## The company aims to produce at least 10 units in total.\nmodel.addCons(A + B + C + D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*A + 40*B + 25*C + 35*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\n// 2*A + 3*B + 2*C + 4*D <= 60\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\n// A + 2*B + C + 3*D <= 40\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 5 units, and for Product D is at most 6 units.\n// A >= 5\n// D <= 6\n\n## Generate Constraint-4:\nThe company aims to produce at least 10 units in total.\n// A + B + C + D >= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\nThe market demand for Product A is at least 5 units, and for Product D is at most 6 units. The company aims to produce at least 10 units in total.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 25*C + 35*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 4 kg. The company has 60 kg of raw material available.\nmodel.addCons(2*A + 3*B + 2*C + 4*D <= 60)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 1 hour, and Product D requires 3 hours. The company has 40 labor hours available.\nmodel.addCons(A + 2*B + C + 3*D <= 40)\n## The market demand for Product A is at least 5 units, and for Product D is at most 6 units.\nmodel.addCons(A >= 5)\nmodel.addCons(D <= 6)\n## The company aims to produce at least 10 units in total.\nmodel.addCons(A + B + C + D >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*P1 + 40*P2 + 25*P3 + 35*P4\n\n## Generate Constraint-1:\nThe production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\n// 10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// P1 + P2 + P3 + P4 <= 20\n\n## Generate Constraint-3:\nDue to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\n// P1 <= 10\n// P2 <= 15\n\n## Generate Constraint-4:\nThe company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements.\n// P3 >= 5\n// P4 >= 7",
        "question": "A manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| 1       | $30             | $10                      |\n| 2       | $40             | $15                      |\n| 3       | $25             | $8                       |\n| 4       | $35             | $12                      |\n\nThe company has a budget of $500 for production costs. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2. The company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of units of Product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of units of Product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of units of Product 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of units of Product 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*P1 + 40*P2 + 25*P3 + 35*P4)\n\n# Add constraints\n## The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\nmodel.addCons(10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(P1 + P2 + P3 + P4 <= 20)\n## Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\nmodel.addCons(P1 <= 10)\nmodel.addCons(P2 <= 15)\n## The company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements.\nmodel.addCons(P3 >= 5)\nmodel.addCons(P4 >= 7)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product 1: \", model.getVal(P1))\n    print(\"Number of units of Product 2: \", model.getVal(P2))\n    print(\"Number of units of Product 3: \", model.getVal(P3))\n    print(\"Number of units of Product 4: \", model.getVal(P4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 30*P1 + 40*P2 + 25*P3 + 35*P4\n\n## Generate Constraint-1:\nThe production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\n// 10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 20 units in total.\n// P1 + P2 + P3 + P4 <= 20\n\n## Generate Constraint-3:\nDue to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\n// P1 <= 10\n// P2 <= 15\n\n## Generate Constraint-4:\nThe company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements.\n// P3 >= 5\n// P4 >= 7",
        "question": "A manufacturing company is planning to produce four different products (1-4), each with its own profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products 1-4 is $30, $40, $25, and $35 respectively. The company wants to maximize the total profit. The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively, and the company has a budget of $500 for production costs. The company has a limited workforce that can produce at most 20 units in total. Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2. The company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of units of Product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of units of Product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of units of Product 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of units of Product 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*P1 + 40*P2 + 25*P3 + 35*P4)\n\n# Add constraints\n## The production cost per unit for products 1-4 is $10, $15, $8, and $12 respectively. The company has a budget of $500 for production costs.\nmodel.addCons(10*P1 + 15*P2 + 8*P3 + 12*P4 <= 500)\n## The company has a limited workforce that can produce at most 20 units in total.\nmodel.addCons(P1 + P2 + P3 + P4 <= 20)\n## Due to market demand, the company can sell at most 10 units of Product 1 and 15 units of Product 2.\nmodel.addCons(P1 <= 10)\nmodel.addCons(P2 <= 15)\n## The company aims to produce at least 5 units of Product 3 and 7 units of Product 4 to meet minimum order requirements.\nmodel.addCons(P3 >= 5)\nmodel.addCons(P4 >= 7)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product 1: \", model.getVal(P1))\n    print(\"Number of units of Product 2: \", model.getVal(P2))\n    print(\"Number of units of Product 3: \", model.getVal(P3))\n    print(\"Number of units of Product 4: \", model.getVal(P4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively.\n// 5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively.\n// Product_A <= 100\n// Product_B <= 150\n// Product_C <= 200\n// Product_D <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product A to fulfill a contract.\n// Product_A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// Product_B >= 2*Product_A",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for each product and the labor hours required to produce one unit are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 5                    |\n| B       | $30             | 3                    |\n| C       | $40             | 4                    |\n| D       | $20             | 2                    |\n\nThe company has a total of 1000 labor hours available. The market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively. The company must produce at least 50 units of Product A to fulfill a contract. Additionally, the company aims to produce at least twice as many units of Product B as Product A.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000)\n## The market demand for each product is limited.\nmodel.addCons(Product_A <= 100)\nmodel.addCons(Product_B <= 150)\nmodel.addCons(Product_C <= 200)\nmodel.addCons(Product_D <= 300)\n## The company must produce at least 50 units of Product A.\nmodel.addCons(Product_A >= 50)\n## The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(Product_B >= 2*Product_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively.\n// 5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively.\n// Product_A <= 100\n// Product_B <= 150\n// Product_C <= 200\n// Product_D <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product A to fulfill a contract.\n// Product_A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// Product_B >= 2*Product_A",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 5, 3, 4, and 2 hours, respectively. The market demand for Product A, Product B, Product C, and Product D is limited to 100, 150, 200, and 300 units, respectively. The company must produce at least 50 units of Product A to fulfill a contract. The company aims to produce at least twice as many units of Product B as Product A. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*Product_A + 3*Product_B + 4*Product_C + 2*Product_D <= 1000)\n## The market demand for each product is limited.\nmodel.addCons(Product_A <= 100)\nmodel.addCons(Product_B <= 150)\nmodel.addCons(Product_C <= 200)\nmodel.addCons(Product_D <= 300)\n## The company must produce at least 50 units of Product A.\nmodel.addCons(Product_A >= 50)\n## The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(Product_B >= 2*Product_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 80*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is limited to 50 units.\n// B <= 50\n\n## Generate Constraint-4:\nThe company has a policy to produce at least two products.\n// (A > 0) + (B > 0) + (C > 0) + (D > 0) >= 2",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints. The profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The production time for each unit of A, B, C, and D is 2 hours, 3 hours, 4 hours, and 5 hours, respectively.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 4 hours                  |\n| D       | $80             | 5 hours                  |\n\nThe company has a total production capacity of 1000 hours. The company must produce at least 10 units of product A. The market demand for product B is limited to 50 units. The company has a policy to produce at least two products.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 80*D)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company must produce at least 10 units of product A\nmodel.addCons(A >= 10)\n## The market demand for product B is limited to 50 units\nmodel.addCons(B <= 50)\n## The company has a policy to produce at least two products\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\n## These constraints ensure that if a product is produced, its binary variable is 1, and 0 otherwise\nmodel.addCons(A <= A_b * (A+1)) \nmodel.addCons(B <= B_b * (B+1))\nmodel.addCons(C <= C_b * (C+1))\nmodel.addCons(D <= D_b * (D+1))\nmodel.addCons(A_b + B_b + C_b + D_b >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 80*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is limited to 50 units.\n// B <= 50\n\n## Generate Constraint-4:\nThe company has a policy to produce at least two products.\n// (A > 0) + (B > 0) + (C > 0) + (D > 0) >= 2",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize its profit while considering various constraints. The profit per unit for products A, B, C, and D is $50, $70, $60, and $80, respectively. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 hours, and it takes 2 hours to produce one unit of A, 3 hours for B, 4 hours for C, and 5 hours for D. The company must produce at least 10 units of product A. The market demand for product B is limited to 50 units. The company has a policy to produce at least two products. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 80*D)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company must produce at least 10 units of product A\nmodel.addCons(A >= 10)\n## The market demand for product B is limited to 50 units\nmodel.addCons(B <= 50)\n## The company has a policy to produce at least two products\nA_b = model.addVar(vtype=\"B\", name=\"A_b\")\nB_b = model.addVar(vtype=\"B\", name=\"B_b\")\nC_b = model.addVar(vtype=\"B\", name=\"C_b\")\nD_b = model.addVar(vtype=\"B\", name=\"D_b\")\n## These constraints ensure that if a product is produced, its binary variable is 1, and 0 otherwise\nmodel.addCons(A <= A_b * (A+1)) \nmodel.addCons(B <= B_b * (B+1))\nmodel.addCons(C <= C_b * (C+1))\nmodel.addCons(D <= D_b * (D+1))\nmodel.addCons(A_b + B_b + C_b + D_b >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat bread produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of White bread produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\n// x1 >= 100\n// x2 >= 50\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\n// x3 <= 300\n\n## Generate Constraint-4:\nTo maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread.\n// x4 <= x1 + x2 + x3",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $1.50           |\n| Rye           | $1.20           |\n| Sourdough     | $1.80           |\n| White         | $1.00           |\n\nThe bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations. Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day. To maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat bread produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye bread produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough bread produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of White bread produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 50)\n## Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\nmodel.addCons(x3 <= 300)\n## To maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread.\nmodel.addCons(x4 <= x1 + x2 + x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat bread produced: \", model.getVal(x1))\n    print(\"Number of Rye bread produced: \", model.getVal(x2))\n    print(\"Number of Sourdough bread produced: \", model.getVal(x3))\n    print(\"Number of White bread produced: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1064,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of Whole Wheat bread produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of White bread produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\n// x1 >= 100\n// x2 >= 50\n\n## Generate Constraint-3:\nDue to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\n// x3 <= 300\n\n## Generate Constraint-4:\nTo maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread.\n// x4 <= x1 + x2 + x3",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the number of each type of bread to produce to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.80, and $1.00, respectively. The bakery has an oven capacity of 1000 loaves per day. The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations. Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day. To maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Whole Wheat bread produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Rye bread produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Sourdough bread produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of White bread produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.20*x2 + 1.80*x3 + 1.00*x4)\n\n# Add constraints\n## The bakery has an oven capacity of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 100 Whole Wheat and 50 Rye breads daily to meet contractual obligations.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 50)\n## Due to staffing limitations, the bakery can only produce a maximum of 300 Sourdough breads per day.\nmodel.addCons(x3 <= 300)\n## To maintain variety, the bakery must ensure that the total production of White bread does not exceed the combined production of the other three types of bread.\nmodel.addCons(x4 <= x1 + x2 + x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat bread produced: \", model.getVal(x1))\n    print(\"Number of Rye bread produced: \", model.getVal(x2))\n    print(\"Number of Sourdough bread produced: \", model.getVal(x3))\n    print(\"Number of White bread produced: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 200 loaves.\n// x1 + x2 + x3 <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\n// x2 >= 0.5*x1\n\n## Generate Constraint-4:\nThe bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread.\n// x3 <= x1 + x2",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The following table summarizes the profit per loaf for each type of bread.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n\nThe bakery has a daily oven capacity of 200 loaves. The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation. The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread. Additionally, the bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # daily production of Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 200 loaves.\nmodel.addCons(x1 + x2 + x3 <= 200)\n## The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n## The bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread.\nmodel.addCons(x3 <= x1 + x2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 200 loaves.\n// x1 + x2 + x3 <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\n// x2 >= 0.5*x1\n\n## Generate Constraint-4:\nThe bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread.\n// x3 <= x1 + x2",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery has a daily oven capacity of 200 loaves. The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation. The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread. The bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # daily production of Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 200 loaves.\nmodel.addCons(x1 + x2 + x3 <= 200)\n## The bakery must produce at least 50 loaves of Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery must ensure that the production of Rye bread is at least half the production of Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n## The bakery must maintain a balanced production, ensuring that the total production of Sourdough bread does not exceed the combined production of Wheat and Rye bread.\nmodel.addCons(x3 <= x1 + x2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2000 loaves.\n// x1 + x2 + x3 <= 2000\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\n// x1 >= 500\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\n// x2 <= 0.7 * (x1 + x2 + x3)\n\n## Generate Constraint-4:\nThe bakery must meet a minimum daily demand of 1200 loaves of any type of bread.\n// x1 + x2 + x3 >= 1200",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively.\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $2              |\n| Rye              | $3              |\n| Sourdough        | $4              |\n\nThe bakery has a daily oven capacity of 2000 loaves. The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement. The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production. The bakery must meet a minimum daily demand of 1200 loaves of any type of bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 <= 2000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\nmodel.addCons(x1 >= 500)\n## The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\nmodel.addCons(x2 <= 0.7 * (x1 + x2 + x3))\n## The bakery must meet a minimum daily demand of 1200 loaves of any type of bread.\nmodel.addCons(x1 + x2 + x3 >= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2000 loaves.\n// x1 + x2 + x3 <= 2000\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\n// x1 >= 500\n\n## Generate Constraint-3:\nThe bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\n// x2 <= 0.7 * (x1 + x2 + x3)\n\n## Generate Constraint-4:\nThe bakery must meet a minimum daily demand of 1200 loaves of any type of bread.\n// x1 + x2 + x3 >= 1200",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery has a daily oven capacity of 2000 loaves. The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement. The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production. The bakery must meet a minimum daily demand of 1200 loaves of any type of bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # daily production of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 <= 2000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread daily due to a contractual agreement.\nmodel.addCons(x1 >= 500)\n## The bakery must ensure that the production of Rye bread does not exceed 70% of the total bread production.\nmodel.addCons(x2 <= 0.7 * (x1 + x2 + x3))\n## The bakery must meet a minimum daily demand of 1200 loaves of any type of bread.\nmodel.addCons(x1 + x2 + x3 >= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of extra sourdough bread (if demand exceeds regular sourdough)\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery aims to maximize its daily profit.\n// Maximize: 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available per day. Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each.\n// 0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe oven capacity is limited to 120 hours per day. Each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each.\n// 1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\n// x1 >= 50\n// x2 >= 40\n\n## Generate Constraint-4:\nThe bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves.\n// x4 <= x3\n// x3 + x4 >= 30",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The following table shows the labor and oven hours required for each type of bread.\n\n| Bread Type       | Profit per Loaf | Labor Hours per Loaf | Oven Hours per Loaf |\n|------------------|-----------------|----------------------|---------------------|\n| Wheat            | $1.50           | 0.5                  | 1.0                 |\n| Rye              | $2.00           | 0.7                  | 1.2                 |\n| Sourdough        | $3.00           | 1.0                  | 1.5                 |\n| Extra Sourdough  | $2.50           | 0.8                  | 1.3                 |\n\nThe bakery has a total of 100 labor hours and 120 oven hours available per day. The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily. The bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production of extra sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100)\n## The oven capacity is limited to 120 hours per day.\nmodel.addCons(1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120)\n## The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(x1 >= 50)\nmodel.addCons(x2 >= 40)\n## The bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves.\nmodel.addCons(x4 <= x3)\nmodel.addCons(x3 + x4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of extra sourdough bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1515,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of extra sourdough bread (if demand exceeds regular sourdough)\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery aims to maximize its daily profit.\n// Maximize: 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available per day. Each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each.\n// 0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe oven capacity is limited to 120 hours per day. Each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each.\n// 1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\n// x1 >= 50\n// x2 >= 40\n\n## Generate Constraint-4:\nThe bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves.\n// x4 <= x3\n// x3 + x4 >= 30",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources such as oven time, labor hours, and ingredient availability. The profit per loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $3.00, respectively. If the demand for sourdough exceeds the regular production, the bakery can produce extra sourdough loaves at a slightly lower profit of $2.50 per loaf. The bakery has a total of 100 labor hours available per day, and each loaf of wheat, rye, and sourdough bread requires 0.5, 0.7, and 1.0 labor hours, respectively. Extra sourdough loaves require 0.8 labor hours each. The oven capacity is limited to 120 hours per day, and each loaf of wheat, rye, and sourdough bread requires 1.0, 1.2, and 1.5 oven hours, respectively. Extra sourdough loaves require 1.3 oven hours each. The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily. The bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production of extra sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 3.00*x3 + 2.50*x4)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 1.0*x3 + 0.8*x4 <= 100)\n## The oven capacity is limited to 120 hours per day.\nmodel.addCons(1.0*x1 + 1.2*x2 + 1.5*x3 + 1.3*x4 <= 120)\n## The bakery has a contract to supply at least 50 loaves of wheat bread and 40 loaves of rye bread daily.\nmodel.addCons(x1 >= 50)\nmodel.addCons(x2 >= 40)\n## The bakery can only produce extra sourdough loaves if the regular sourdough production does not meet the demand, which is at least 30 loaves.\nmodel.addCons(x4 <= x3)\nmodel.addCons(x3 + x4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of extra sourdough bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"} // Duplicate variable name, corrected below\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Straw\n\n## Generate Constraint-1:\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring.\n// Choc <= 300\n// Van <= 200\n// Straw <= 150\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors.\n// Choc + Van + Straw >= 50\n\n## Generate Constraint-3:\nDue to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes.\n// Straw >= 0.5 * Van\n\n## Generate Constraint-4:\nThe bakery also needs to ensure that the number of chocolate cakes does not exceed twice the number of vanilla cakes to maintain a balanced product mix.\n// Choc <= 2 * Van",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences. The profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The following table summarizes the ingredient requirements per cake type.\n\n| Cake Type | Ingredient Requirement |\n|-----------|-----------------------|\n| Chocolate | 1 pound of chocolate  |\n| Vanilla   | 1 pound of vanilla    |\n| Strawberry| 1 pound of strawberry |\n\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring. The bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors. Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes. Additionally, the bakery needs to ensure that the number of chocolate cakes does not exceed twice the number of vanilla cakes to maintain a balanced product mix.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStraw = model.addVar(vtype=\"INTEGER\", name=\"Straw\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Straw)\n\n# Add constraints\n## The bakery has a limited amount of ingredients\nmodel.addCons(Choc <= 300)\nmodel.addCons(Van <= 200)\nmodel.addCons(Straw <= 150)\n## The bakery must produce at least 50 cakes in total each day\nmodel.addCons(Choc + Van + Straw >= 50)\n## The number of strawberry cakes produced must be at least half the number of vanilla cakes\nmodel.addCons(Straw >= 0.5 * Van)\n## The number of chocolate cakes does not exceed twice the number of vanilla cakes\nmodel.addCons(Choc <= 2 * Van)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Straw))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Str\", \"range\": \"Str >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"} // Duplicate variable name, corrected below\n// {\"number of strawberry cakes\": \"Straw\", \"range\": \"Straw >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van + 3*Straw\n\n## Generate Constraint-1:\nThe bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring.\n// Choc <= 300\n// Van <= 200\n// Straw <= 150\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors.\n// Choc + Van + Straw >= 50\n\n## Generate Constraint-3:\nDue to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes.\n// Straw >= 0.5 * Van\n\n## Generate Constraint-4:\nThe bakery also needs to ensure that the number of chocolate cakes does not exceed twice the number of vanilla cakes to maintain a balanced product mix.\n// Choc <= 2 * Van",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery wants to determine the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources and customer preferences. The profit per cake is $5 for chocolate, $4 for vanilla, and $3 for strawberry. The bakery has a limited amount of ingredients: 300 pounds of chocolate, 200 pounds of vanilla, and 150 pounds of strawberry flavoring. Each chocolate cake requires 1 pound of chocolate, each vanilla cake requires 1 pound of vanilla, and each strawberry cake requires 1 pound of strawberry flavoring. The bakery must produce at least 50 cakes in total each day to meet the minimum order requirements from distributors. Due to customer preferences, the number of strawberry cakes produced must be at least half the number of vanilla cakes. The bakery also needs to ensure that the number of chocolate cakes does not exceed twice the number of vanilla cakes to maintain a balanced product mix.\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\nStraw = model.addVar(vtype=\"INTEGER\", name=\"Straw\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van + 3*Straw)\n\n# Add constraints\n## The bakery has a limited amount of ingredients\nmodel.addCons(Choc <= 300)\nmodel.addCons(Van <= 200)\nmodel.addCons(Straw <= 150)\n## The bakery must produce at least 50 cakes in total each day\nmodel.addCons(Choc + Van + Straw >= 50)\n## The number of strawberry cakes produced must be at least half the number of vanilla cakes\nmodel.addCons(Straw >= 0.5 * Van)\n## The number of chocolate cakes does not exceed twice the number of vanilla cakes\nmodel.addCons(Choc <= 2 * Van)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Number of strawberry cakes: \", model.getVal(Straw))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.70*M + 0.40*B\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds.\n// 0.1*C + 0.2*M + 0.15*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds.\n// 0.05*C + 0.1*M + 0.05*B <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n// 0.2*C + 0.3*M + 0.15*B <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 pastries of each type to meet the minimum order requirements from local cafes.\n// C >= 100, M >= 100, B >= 100",
        "question": "A small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours. The profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds. The bakery also has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds. Additionally, the bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n\nThe bakery must produce at least 100 pastries of each type to meet the minimum order requirements from local cafes.\n\nPlease help the bakery to maximize the total daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.70*M + 0.40*B)\n\n# Add constraints\n## The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.1*C + 0.2*M + 0.15*B <= 100)\n## The bakery has a daily supply of 50 pounds of sugar.\nmodel.addCons(0.05*C + 0.1*M + 0.05*B <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.2*C + 0.3*M + 0.15*B <= 80)\n## The bakery must produce at least 100 pastries of each type.\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 100)\nmodel.addCons(B >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours.\n// {\"number of croissants\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery aims to maximize the total daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*C + 0.70*M + 0.40*B\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds.\n// 0.1*C + 0.2*M + 0.15*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds.\n// 0.05*C + 0.1*M + 0.05*B <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours.\n// 0.2*C + 0.3*M + 0.15*B <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 pastries of each type to meet the minimum order requirements from local cafes.\n// C >= 100, M >= 100, B >= 100",
        "question": "A small bakery specializes in producing three types of pastries: croissants, muffins, and bagels. The bakery needs to determine the optimal number of each type of pastry to maximize profit while considering the limited resources such as flour, sugar, and labor hours. The profit from each croissant is $0.50, each muffin is $0.70, and each bagel is $0.40. The bakery has a daily supply of 100 pounds of flour, where each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each bagel requires 0.15 pounds. The bakery also has a daily supply of 50 pounds of sugar, where each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each bagel requires 0.05 pounds. Additionally, the bakery has a daily limit of 80 labor hours, where each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each bagel requires 0.15 hours. The bakery must produce at least 100 pastries of each type to meet the minimum order requirements from local cafes. Please help the bakery to maximize the total daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of croissants\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of muffins\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*C + 0.70*M + 0.40*B)\n\n# Add constraints\n## The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.1*C + 0.2*M + 0.15*B <= 100)\n## The bakery has a daily supply of 50 pounds of sugar.\nmodel.addCons(0.05*C + 0.1*M + 0.05*B <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.2*C + 0.3*M + 0.15*B <= 80)\n## The bakery must produce at least 100 pastries of each type.\nmodel.addCons(C >= 100)\nmodel.addCons(M >= 100)\nmodel.addCons(B >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(C))\n    print(\"Number of muffins: \", model.getVal(M))\n    print(\"Number of bagels: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price.\n// {\"number of Bread 1 produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\n// x1 >= 100\n// x2 >= 200\n\n## Generate Constraint-4:\nDue to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined.\n// x3 + x4 <= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types.\n\n| Bread Type | Selling Price per Loaf | Labor Required per Loaf |\n|------------|-------------------------|-------------------------|\n| Bread 1    | $3.50                   | 0.5 hours               |\n| Bread 2    | $4.00                   | 0.6 hours               |\n| Bread 3    | $4.50                   | 0.7 hours               |\n| Bread 4    | $5.00                   | 0.8 hours               |\n\nThe bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total. The bakery has a total of 600 hours of labor available per week. The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week. Due to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its total revenue, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600)\n## The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 200)\n## Due to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined.\nmodel.addCons(x3 + x4 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price.\n// {\"number of Bread 1 produced\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery wants to maximize its total revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\n// 0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\n// x1 >= 100\n// x2 >= 200\n\n## Generate Constraint-4:\nDue to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined.\n// x3 + x4 <= 500",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each bread type requires different amounts of ingredients and labor, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total. Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively, and the bakery has a total of 600 hours of labor available per week. The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week. Due to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined. Please help the bakery to maximize its total revenue from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*x1 + 4.00*x2 + 4.50*x3 + 5.00*x4)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is enough to produce a maximum of 1000 loaves of bread in total.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## Each loaf of Bread 1-4 requires 0.5, 0.6, 0.7, and 0.8 hours of labor, respectively. The bakery has a total of 600 hours of labor available per week.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.7*x3 + 0.8*x4 <= 600)\n## The bakery has a demand for at least 100 loaves of Bread 1 and 200 loaves of Bread 2 per week.\nmodel.addCons(x1 >= 100)\nmodel.addCons(x2 >= 200)\n## Due to storage limitations, the bakery cannot store more than 500 loaves of Bread 3 and 4 combined.\nmodel.addCons(x3 + x4 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced: \", model.getVal(x1))\n    print(\"Number of Bread 2 produced: \", model.getVal(x2))\n    print(\"Number of Bread 3 produced: \", model.getVal(x3))\n    print(\"Number of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily.\n// {\"number of Cake 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 10*x1 + 12*x2 + 15*x3 + 18*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units.\n// 2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours.\n// x1 + 2*x2 + 3*x3 + 4*x4 <= 50\n\n## Generate Constraint-3:\nThe bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes.\n// x1 <= 15\n\n## Generate Constraint-4:\nThe bakery wants to ensure a minimum production of Cake 4 to meet a special order. At least 5 Cake 4 must be produced daily.\n// x4 >= 5",
        "question": "A bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily. The selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales.\n\n| Cake | Selling Price | Ingredient A Required | Labor Required |\n|------|---------------|-----------------------|----------------|\n| 1    | $10           | 2 units               | 1 hour         |\n| 2    | $12           | 3 units               | 2 hours        |\n| 3    | $15           | 4 units               | 3 hours        |\n| 4    | $18           | 5 units               | 4 hours        |\n\nThe bakery has a limited supply of ingredients. The total daily supply of ingredient A is 100 units. The bakery also has a limited labor force, with a total daily labor available of 50 hours. The bakery has a demand constraint for Cake 1, with a maximum daily demand of 15 cakes. Additionally, the bakery wants to ensure a minimum production of Cake 4 to meet a special order, requiring at least 5 Cake 4 to be produced daily.\n\nPlease help the bakery to maximize its daily revenue from cake sales while considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Cake 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Cake 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Cake 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Cake 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*x1 + 12*x2 + 15*x3 + 18*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100)\n## The bakery also has a limited labor force.\nmodel.addCons(x1 + 2*x2 + 3*x3 + 4*x4 <= 50)\n## The bakery has a demand constraint for Cake 1.\nmodel.addCons(x1 <= 15)\n## The bakery wants to ensure a minimum production of Cake 4.\nmodel.addCons(x4 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Cake 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Cake 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Cake 4 produced daily: \", model.getVal(x4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily.\n// {\"number of Cake 1 produced daily\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced daily\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced daily\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced daily\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 10*x1 + 12*x2 + 15*x3 + 18*x4\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units.\n// 2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours.\n// x1 + 2*x2 + 3*x3 + 4*x4 <= 50\n\n## Generate Constraint-3:\nThe bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes.\n// x1 <= 15\n\n## Generate Constraint-4:\nThe bakery wants to ensure a minimum production of Cake 4 to meet a special order. At least 5 Cake 4 must be produced daily.\n// x4 >= 5",
        "question": "A bakery wants to optimize the production of four types of cakes (Cake 1-4) to maximize profit. Each cake requires different amounts of ingredients and labor, and has a different selling price. The bakery needs to determine the number of each type of cake to produce daily. The selling price per cake for Cake 1-4 is $10, $12, $15, and $18, respectively. The bakery aims to maximize its daily revenue from cake sales. The bakery has a limited supply of ingredients. Cake 1 requires 2 units of ingredient A, Cake 2 requires 3 units, Cake 3 requires 4 units, and Cake 4 requires 5 units. The total daily supply of ingredient A is 100 units. The bakery also has a limited labor force. Each Cake 1 requires 1 hour of labor, Cake 2 requires 2 hours, Cake 3 requires 3 hours, and Cake 4 requires 4 hours. The total daily labor available is 50 hours. The bakery has a demand constraint for Cake 1. The maximum daily demand for Cake 1 is 15 cakes. The bakery wants to ensure a minimum production of Cake 4 to meet a special order. At least 5 Cake 4 must be produced daily. Please help the bakery to maximize its daily revenue from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced daily\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of Cake 1 produced daily\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of Cake 2 produced daily\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of Cake 3 produced daily\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of Cake 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*x1 + 12*x2 + 15*x3 + 18*x4)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(2*x1 + 3*x2 + 4*x3 + 5*x4 <= 100)\n## The bakery also has a limited labor force.\nmodel.addCons(x1 + 2*x2 + 3*x3 + 4*x4 <= 50)\n## The bakery has a demand constraint for Cake 1.\nmodel.addCons(x1 <= 15)\n## The bakery wants to ensure a minimum production of Cake 4.\nmodel.addCons(x4 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced daily: \", model.getVal(x1))\n    print(\"Number of Cake 2 produced daily: \", model.getVal(x2))\n    print(\"Number of Cake 3 produced daily: \", model.getVal(x3))\n    print(\"Number of Cake 4 produced daily: \", model.getVal(x4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"quantity of Bread 1 produced\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total profit from selling all types of bread.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2500 loaves.\n// x1 + x2 + x3 + x4 <= 2500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\n// x1 >= 500\n// x2 >= 600\n// x3 >= 400\n// x4 >= 500\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\n// x3 <= 800\n\n## Generate Constraint-4:\nThe bakery aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves.\n// |x1 - x2| <= 300\n// |x1 - x3| <= 300\n// |x1 - x4| <= 300\n// |x2 - x3| <= 300\n// |x2 - x4| <= 300\n// |x3 - x4| <= 300",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Bread 1    | $1.50           |\n| Bread 2    | $2.00           |\n| Bread 3    | $1.75           |\n| Bread 4    | $1.80           |\n\nThe bakery has a daily oven capacity of 2500 loaves. The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4. Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day. The bakery aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # quantity of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # quantity of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # quantity of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=1000) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2500 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2500)\n## The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\nmodel.addCons(x1 >= 500)\nmodel.addCons(x2 >= 600)\nmodel.addCons(x3 >= 400)\nmodel.addCons(x4 >= 500)\n## Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\nmodel.addCons(x3 <= 800)\n## The bakery aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves.\nmodel.addCons(abs(x1 - x2) <= 300)\nmodel.addCons(abs(x1 - x3) <= 300)\nmodel.addCons(abs(x1 - x4) <= 300)\nmodel.addCons(abs(x2 - x3) <= 300)\nmodel.addCons(abs(x2 - x4) <= 300)\nmodel.addCons(abs(x3 - x4) <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(x1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(x2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(x3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"quantity of Bread 1 produced\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 2 produced\": \"x2\", \"range\": \"0 <= x2 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 3 produced\": \"x3\", \"range\": \"0 <= x3 <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread 4 produced\": \"x4\", \"range\": \"0 <= x4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total profit from selling all types of bread.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 2500 loaves.\n// x1 + x2 + x3 + x4 <= 2500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\n// x1 >= 500\n// x2 >= 600\n// x3 >= 400\n// x4 >= 500\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\n// x3 <= 800\n\n## Generate Constraint-4:\nThe bakery aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves.\n// |x1 - x2| <= 300\n// |x1 - x3| <= 300\n// |x1 - x4| <= 300\n// |x2 - x3| <= 300\n// |x2 - x4| <= 300\n// |x3 - x4| <= 300",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery aims to maximize the total profit from selling all types of bread. The bakery has a daily oven capacity of 2500 loaves. The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4. Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day. The bakery also aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves. Please help the bakery determine the optimal quantities of each type of bread to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread produced\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # quantity of Bread 1 produced\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=1000) # quantity of Bread 2 produced\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=1000) # quantity of Bread 3 produced\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=1000) # quantity of Bread 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a daily oven capacity of 2500 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2500)\n## The bakery must meet a minimum daily demand of 500 loaves for Bread 1, 600 loaves for Bread 2, 400 loaves for Bread 3, and 500 loaves for Bread 4.\nmodel.addCons(x1 >= 500)\nmodel.addCons(x2 >= 600)\nmodel.addCons(x3 >= 400)\nmodel.addCons(x4 >= 500)\n## Due to ingredient availability, the bakery can only produce a maximum of 800 loaves of Bread 3 per day.\nmodel.addCons(x3 <= 800)\n## The bakery aims to balance the production of all bread types, ensuring that the difference in production quantities between any two types does not exceed 300 loaves.\nmodel.addCons(abs(x1 - x2) <= 300)\nmodel.addCons(abs(x1 - x3) <= 300)\nmodel.addCons(abs(x1 - x4) <= 300)\nmodel.addCons(abs(x2 - x3) <= 300)\nmodel.addCons(abs(x2 - x4) <= 300)\nmodel.addCons(abs(x3 - x4) <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread 1 produced: \", model.getVal(x1))\n    print(\"Quantity of Bread 2 produced: \", model.getVal(x2))\n    print(\"Quantity of Bread 3 produced: \", model.getVal(x3))\n    print(\"Quantity of Bread 4 produced: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"WheatLoaves\", \"range\": \"WheatLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeLoaves\", \"range\": \"RyeLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughLoaves\", \"range\": \"SourdoughLoaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n// Objective Function: Maximize: 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg of flour, and each loaf of sourdough bread requires 0.3 kg of flour. The total available flour is 1000 kg.\n// 0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.015 kg of yeast. The total available yeast is 15 kg.\n// 0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.4 hours of labor. The total available labor hours is 200 hours.\n// 0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread production is wheat bread to meet customer demand.\n// WheatLoaves >= 0.3 * (WheatLoaves + RyeLoaves + SourdoughLoaves)",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf | Yeast Required per Loaf | Labor Hours Required per Loaf |\n|------------------|-----------------|-------------------------|-------------------------|-------------------------------|\n| Wheat            | $2              | 0.5 kg                  | 0.01 kg                 | 0.2 hours                     |\n| Rye              | $3              | 0.4 kg                  | 0.02 kg                 | 0.3 hours                     |\n| Sourdough        | $4              | 0.3 kg                  | 0.015 kg                | 0.4 hours                     |\n\nThe bakery has a limited amount of flour available, with a total of 1000 kg. The bakery also has a limited amount of yeast available, with a total of 15 kg. Additionally, the bakery has a limited amount of labor hours, with a total of 200 hours. The bakery wants to ensure that at least 30% of the total bread production is wheat bread to meet customer demand.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheatLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatLoaves\", lb=0) # number of loaves of wheat bread\nRyeLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeLoaves\", lb=0) # number of loaves of rye bread\nSourdoughLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughLoaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200)\n## The bakery wants to ensure that at least 30% of the total bread production is wheat bread.\nmodel.addCons(WheatLoaves >= 0.3 * (WheatLoaves + RyeLoaves + SourdoughLoaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(WheatLoaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeLoaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughLoaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1595,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"WheatLoaves\", \"range\": \"WheatLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeLoaves\", \"range\": \"RyeLoaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughLoaves\", \"range\": \"SourdoughLoaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery wants to maximize the total profit from bread sales.\n// Objective Function: Maximize: 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.4 kg of flour, and each loaf of sourdough bread requires 0.3 kg of flour. The total available flour is 1000 kg.\n// 0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.015 kg of yeast. The total available yeast is 15 kg.\n// 0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.4 hours of labor. The total available labor hours is 200 hours.\n// 0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread production is wheat bread to meet customer demand.\n// WheatLoaves >= 0.3 * (WheatLoaves + RyeLoaves + SourdoughLoaves)",
        "question": "A bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery has a limited amount of flour available, with each loaf of wheat bread requiring 0.5 kg of flour, each loaf of rye bread requiring 0.4 kg of flour, and each loaf of sourdough bread requiring 0.3 kg of flour, with a total of 1000 kg of flour available. The bakery also has a limited amount of yeast available, with each loaf of wheat bread requiring 0.01 kg of yeast, each loaf of rye bread requiring 0.02 kg of yeast, and each loaf of sourdough bread requiring 0.015 kg of yeast, with a total of 15 kg of yeast available. Additionally, the bakery has a limited amount of labor hours, with each loaf of wheat bread requiring 0.2 hours of labor, each loaf of rye bread requiring 0.3 hours of labor, and each loaf of sourdough bread requiring 0.4 hours of labor, with a total of 200 hours of labor available. The bakery wants to ensure that at least 30% of the total bread production is wheat bread to meet customer demand. Please help the bakery to maximize the total profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheatLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"WheatLoaves\", lb=0) # number of loaves of wheat bread\nRyeLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeLoaves\", lb=0) # number of loaves of rye bread\nSourdoughLoaves = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughLoaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WheatLoaves + 3*RyeLoaves + 4*SourdoughLoaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*WheatLoaves + 0.4*RyeLoaves + 0.3*SourdoughLoaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*WheatLoaves + 0.02*RyeLoaves + 0.015*SourdoughLoaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*WheatLoaves + 0.3*RyeLoaves + 0.4*SourdoughLoaves <= 200)\n## The bakery wants to ensure that at least 30% of the total bread production is wheat bread.\nmodel.addCons(WheatLoaves >= 0.3 * (WheatLoaves + RyeLoaves + SourdoughLoaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(WheatLoaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeLoaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughLoaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1402,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*x1 + 3*x2 + 2.5*x3 + 4*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.5, Rye is $0.7, Sourdough is $0.6, and Brioche is $1.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\n// x1 >= 0.2*(x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe bakery has a storage capacity limit of 2000 loaves.\n// x1 + x2 + x3 + x4 <= 2000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows: Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4.\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2              |\n| Rye          | $3              |\n| Sourdough    | $2.5            |\n| Brioche      | $4              |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.8 hours of labor. The bakery also has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.5, Rye is $0.7, Sourdough is $0.6, and Brioche is $1.\n\nThe bakery wants to ensure that at least 20% of the total production is Whole Wheat bread. Additionally, the bakery has a storage capacity limit of 2000 loaves.\n\nPlease help the bakery to maximize the total profit from selling these bread types while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3 + 4*x4)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000)\n## The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\nmodel.addCons(x1 >= 0.2*(x1 + x2 + x3 + x4))\n## The bakery has a storage capacity limit of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*x1 + 3*x2 + 2.5*x3 + 4*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.6 hours, Sourdough requires 0.4 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.5, Rye is $0.7, Sourdough is $0.6, and Brioche is $1.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\n// x1 >= 0.2*(x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe bakery has a storage capacity limit of 2000 loaves.\n// x1 + x2 + x3 + x4 <= 2000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, Rye is $3, Sourdough is $2.5, and Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.6 hours, Sourdough requiring 0.4 hours, and Brioche requiring 0.8 hours of labor. The bakery also has a budget of $5000 for ingredients, with the cost of ingredients per loaf for Whole Wheat being $0.5, Rye being $0.7, Sourdough being $0.6, and Brioche being $1. The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread and has a storage capacity limit of 2000 loaves. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # number of Rye loaves\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3 + 4*x4)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*x1 + 0.6*x2 + 0.4*x3 + 0.8*x4 <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 5000)\n## The bakery wants to ensure that at least 20% of the total production is Whole Wheat bread.\nmodel.addCons(x1 >= 0.2*(x1 + x2 + x3 + x4))\n## The bakery has a storage capacity limit of 2000 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Brioche loaves: \", model.getVal(x4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"continuous\"}\n// {\"number of Multigrain loaves\": \"M\", \"range\": \"M >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*WW + 2.50*R + 3*S + 2.75*M\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.5 hours of labor.\n// 0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of Whole Wheat requires 1.5 hours, Rye requires 1.2 hours, Sourdough requires 1.8 hours, and Multigrain requires 1.6 hours of oven time.\n// 1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500\n\n## Generate Constraint-3:\nThere is a minimum customer demand for each type of bread. The bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\n// WW >= 100\n// R >= 150\n// S >= 200\n// M >= 120\n\n## Generate Constraint-4:\nThe bakery has a storage constraint. The total number of loaves that can be stored is 1000.\n// WW + R + S + M <= 1000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows: Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The following table shows the labor and oven time required for each loaf of bread.\n\n| Bread Type    | Profit per Loaf | Labor Time per Loaf | Oven Time per Loaf |\n|---------------|-----------------|---------------------|--------------------|\n| Whole Wheat   | $2              | 0.5 hours           | 1.5 hours          |\n| Rye           | $2.50           | 0.4 hours           | 1.2 hours          |\n| Sourdough     | $3              | 0.6 hours           | 1.8 hours          |\n| Multigrain    | $2.75           | 0.5 hours           | 1.6 hours          |\n\nThe bakery has a total of 1000 hours of labor available and a limited oven capacity of 1500 hours. There is a minimum customer demand for each type of bread: the bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain. Additionally, the bakery has a storage constraint where the total number of loaves that can be stored is 1000.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # number of Rye loaves\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # number of Sourdough loaves\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # number of Multigrain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*R + 3*S + 2.75*M)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500)\n## There is a minimum customer demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(R >= 150)\nmodel.addCons(S >= 200)\nmodel.addCons(M >= 120)\n## The bakery has a storage constraint.\nmodel.addCons(WW + R + S + M <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(R))\n    print(\"Number of Sourdough loaves: \", model.getVal(S))\n    print(\"Number of Multigrain loaves: \", model.getVal(M))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"continuous\"}\n// {\"number of Multigrain loaves\": \"M\", \"range\": \"M >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*WW + 2.50*R + 3*S + 2.75*M\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.5 hours of labor.\n// 0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of Whole Wheat requires 1.5 hours, Rye requires 1.2 hours, Sourdough requires 1.8 hours, and Multigrain requires 1.6 hours of oven time.\n// 1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500\n\n## Generate Constraint-3:\nThere is a minimum customer demand for each type of bread. The bakery must produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain.\n// WW >= 100\n// R >= 150\n// S >= 200\n// M >= 120\n\n## Generate Constraint-4:\nThe bakery has a storage constraint. The total number of loaves that can be stored is 1000.\n// WW + R + S + M <= 1000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $2, Rye is $2.50, Sourdough is $3, and Multigrain is $2.75. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.4 hours, Sourdough requiring 0.6 hours, and Multigrain requiring 0.5 hours of labor. The bakery also has a limited oven capacity of 1500 hours, with each loaf of Whole Wheat requiring 1.5 hours, Rye requiring 1.2 hours, Sourdough requiring 1.8 hours, and Multigrain requiring 1.6 hours of oven time. There is a minimum customer demand for each type of bread, requiring the bakery to produce at least 100 loaves of Whole Wheat, 150 loaves of Rye, 200 loaves of Sourdough, and 120 loaves of Multigrain. Additionally, the bakery has a storage constraint where the total number of loaves that can be stored is 1000. Please help the bakery maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # number of Rye loaves\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # number of Sourdough loaves\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # number of Multigrain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WW + 2.50*R + 3*S + 2.75*M)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WW + 0.4*R + 0.6*S + 0.5*M <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*WW + 1.2*R + 1.8*S + 1.6*M <= 1500)\n## There is a minimum customer demand for each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(R >= 150)\nmodel.addCons(S >= 200)\nmodel.addCons(M >= 120)\n## The bakery has a storage constraint.\nmodel.addCons(WW + R + S + M <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(R))\n    print(\"Number of Sourdough loaves: \", model.getVal(S))\n    print(\"Number of Multigrain loaves: \", model.getVal(M))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of wheat bread requires 0.5 hours, rye bread requires 0.7 hours, sourdough bread requires 1 hour, and whole grain bread requires 0.8 hours of labor.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of wheat bread requires 1.5 hours, rye bread requires 2 hours, sourdough bread requires 2.5 hours, and whole grain bread requires 2 hours of oven time.\n// 1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500\n\n## Generate Constraint-3:\nThe bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\n// Wheat >= 500\n// Rye >= 300\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 20% of its total bread production as sourdough bread.\n// Sourdough >= 0.2 * (Wheat + Rye + Sourdough + WholeGrain)",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows: wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5.\n\n| Bread Type       | Profit per Loaf | Labor Hours per Loaf | Oven Hours per Loaf |\n|------------------|-----------------|----------------------|---------------------|\n| Wheat            | $2              | 0.5                  | 1.5                 |\n| Rye              | $3              | 0.7                  | 2                   |\n| Sourdough        | $4              | 1                    | 2.5                 |\n| Whole Grain      | $3.5            | 0.8                  | 2                   |\n\nThe bakery has a total of 1000 hours of labor available and a limited oven capacity of 1500 hours. The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread. Additionally, the bakery aims to produce at least 20% of its total bread production as sourdough bread.\n\nPlease help the bakery to maximize the total profit from selling these bread types while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # number of loaves of wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nWholeGrain = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeGrain\", lb=0) # number of loaves of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500)\n## The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\nmodel.addCons(Wheat >= 500)\nmodel.addCons(Rye >= 300)\n## The bakery aims to produce at least 20% of its total bread production as sourdough bread.\nmodel.addCons(Sourdough >= 0.2 * (Wheat + Rye + Sourdough + WholeGrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(WholeGrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of loaves of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"WholeGrain\", \"range\": \"WholeGrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of wheat bread requires 0.5 hours, rye bread requires 0.7 hours, sourdough bread requires 1 hour, and whole grain bread requires 0.8 hours of labor.\n// 0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity of 1500 hours. Each loaf of wheat bread requires 1.5 hours, rye bread requires 2 hours, sourdough bread requires 2.5 hours, and whole grain bread requires 2 hours of oven time.\n// 1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500\n\n## Generate Constraint-3:\nThe bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\n// Wheat >= 500\n// Rye >= 300\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 20% of its total bread production as sourdough bread.\n// Sourdough >= 0.2 * (Wheat + Rye + Sourdough + WholeGrain)",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for wheat bread is $2, rye bread is $3, sourdough bread is $4, and whole grain bread is $3.5. The bakery has a total of 1000 hours of labor available, with each loaf of wheat bread requiring 0.5 hours, rye bread requiring 0.7 hours, sourdough bread requiring 1 hour, and whole grain bread requiring 0.8 hours of labor. The bakery also has a limited oven capacity of 1500 hours, with each loaf of wheat bread requiring 1.5 hours, rye bread requiring 2 hours, sourdough bread requiring 2.5 hours, and whole grain bread requiring 2 hours of oven time. The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread. Additionally, the bakery aims to produce at least 20% of its total bread production as sourdough bread. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # number of loaves of wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nWholeGrain = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeGrain\", lb=0) # number of loaves of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*WholeGrain)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 1*Sourdough + 0.8*WholeGrain <= 1000)\n## The bakery has a limited oven capacity of 1500 hours.\nmodel.addCons(1.5*Wheat + 2*Rye + 2.5*Sourdough + 2*WholeGrain <= 1500)\n## The bakery has a customer demand for at least 500 loaves of wheat bread and 300 loaves of rye bread.\nmodel.addCons(Wheat >= 500)\nmodel.addCons(Rye >= 300)\n## The bakery aims to produce at least 20% of its total bread production as sourdough bread.\nmodel.addCons(Sourdough >= 0.2 * (Wheat + Rye + Sourdough + WholeGrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(WholeGrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of White Bread loaves\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 1000 loaves due to oven limitations.\n// WholeWheat + Rye + Sourdough + WhiteBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds.\n// 0.5*WholeWheat + 0.4*Rye <= 600\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread.\n// WholeWheat >= 50\n// Rye >= 75\n// Sourdough >= 100\n// WhiteBread >= 125\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves due to a limitation in the availability of a special ingredient used in both breads.\n// Sourdough + WhiteBread <= 600",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $2.50           |\n| Rye            | $3.00           |\n| Sourdough      | $2.75           |\n| White Bread    | $2.25           |\n\nThe bakery has a daily capacity of 1000 loaves due to oven limitations. The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds. The bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread. The bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves due to a limitation in the availability of a special ingredient used in both breads.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of White Bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread)\n\n# Add constraints\n## The bakery has a daily capacity of 1000 loaves due to oven limitations.\nmodel.addCons(WholeWheat + Rye + Sourdough + WhiteBread <= 1000)\n## The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 600)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 75)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(WhiteBread >= 125)\n## The bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves.\nmodel.addCons(Sourdough + WhiteBread <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White Bread loaves: \", model.getVal(WhiteBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1331,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of White Bread loaves\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 1000 loaves due to oven limitations.\n// WholeWheat + Rye + Sourdough + WhiteBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds.\n// 0.5*WholeWheat + 0.4*Rye <= 600\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread.\n// WholeWheat >= 50\n// Rye >= 75\n// Sourdough >= 100\n// WhiteBread >= 125\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves due to a limitation in the availability of a special ingredient used in both breads.\n// Sourdough + WhiteBread <= 600",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White Bread. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $2.50, for Rye is $3.00, for Sourdough is $2.75, and for White Bread is $2.25. The bakery has a daily capacity of 1000 loaves due to oven limitations. The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread. The total amount of whole grain flour available daily is 600 pounds. Each loaf of Whole Wheat requires 0.5 pounds and each loaf of Rye requires 0.4 pounds. The bakery has a minimum daily demand for each type of bread: 50 loaves of Whole Wheat, 75 loaves of Rye, 100 loaves of Sourdough, and 125 loaves of White Bread. The bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves due to a limitation in the availability of a special ingredient used in both breads. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of White Bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WholeWheat + 3.00*Rye + 2.75*Sourdough + 2.25*WhiteBread)\n\n# Add constraints\n## The bakery has a daily capacity of 1000 loaves due to oven limitations.\nmodel.addCons(WholeWheat + Rye + Sourdough + WhiteBread <= 1000)\n## The bakery has a limited supply of whole grain flour, which is primarily used in Whole Wheat and Rye bread.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 600)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 75)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(WhiteBread >= 125)\n## The bakery must also ensure that the total production of Sourdough and White Bread does not exceed 600 loaves.\nmodel.addCons(Sourdough + WhiteBread <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White Bread loaves: \", model.getVal(WhiteBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of loaves of Whole Wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds.\n// 1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\n// 0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600\n\n## Generate Constraint-3:\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\n// WholeWheat <= 300\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\n// WholeWheat >= 100\n// RyeBread >= 100\n// Sourdough >= 100\n// Multigrain >= 100",
        "question": "A bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $2              |\n| Rye            | $2.5            |\n| Sourdough      | $3              |\n| Multigrain     | $2.75           |\n\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds. The bakery also has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\n\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves. The bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of Whole Wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000)\n## The bakery has a maximum oven capacity of 600 hours.\nmodel.addCons(0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600)\n## Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\nmodel.addCons(WholeWheat <= 300)\n## The bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(RyeBread >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of loaves of Whole Wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of Multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds.\n// 1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\n// 0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600\n\n## Generate Constraint-3:\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\n// WholeWheat <= 300\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\n// WholeWheat >= 100\n// RyeBread >= 100\n// Sourdough >= 100\n// Multigrain >= 100",
        "question": "A bakery wants to produce four types of bread: Whole Wheat, Rye, Sourdough, and Multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and market demand.\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $2.5, the profit per loaf for Sourdough is $3, and the profit per loaf for Multigrain is $2.75.\nThe bakery has a total of 1000 pounds of flour available. Each loaf of Whole Wheat requires 1.5 pounds of flour, Rye requires 1.2 pounds, Sourdough requires 1.8 pounds, and Multigrain requires 2 pounds.\nThe bakery has a maximum oven capacity of 600 hours. Each loaf of Whole Wheat requires 0.5 hours of oven time, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Multigrain requires 0.7 hours.\nMarket demand limits the production of Whole Wheat bread to a maximum of 300 loaves. The bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\nPlease help the bakery to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of loaves of Whole Wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of Sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of Multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 2.5*RyeBread + 3*Sourdough + 2.75*Multigrain)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(1.5*WholeWheat + 1.2*RyeBread + 1.8*Sourdough + 2*Multigrain <= 1000)\n## The bakery has a maximum oven capacity of 600 hours.\nmodel.addCons(0.5*WholeWheat + 0.4*RyeBread + 0.6*Sourdough + 0.7*Multigrain <= 600)\n## Market demand limits the production of Whole Wheat bread to a maximum of 300 loaves.\nmodel.addCons(WholeWheat <= 300)\n## The bakery aims to produce at least 100 loaves of each type of bread to meet minimum order requirements.\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(RyeBread >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Whole Wheat bread: \", model.getVal(WholeWheat))\n    print(\"Number of loaves of Rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of Multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can only bake a total of 2500 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\n// WholeWheat >= 500\n\n## Generate Constraint-4:\nDue to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye.\n// Sourdough >= 2*Rye",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2              |\n| Rye          | $3              |\n| Sourdough    | $2.50           |\n| Brioche      | $4              |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor. The bakery has a limited oven space and can only bake a total of 2500 loaves. The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week. Due to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye.\n\nPlease help the bakery to maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a limited oven space and can only bake a total of 2500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2500)\n## The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\nmodel.addCons(WholeWheat >= 500)\n## Due to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye.\nmodel.addCons(Sourdough >= 2*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can only bake a total of 2500 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\n// WholeWheat >= 500\n\n## Generate Constraint-4:\nDue to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye.\n// Sourdough >= 2*Rye",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.4 hours, Sourdough requiring 0.6 hours, and Brioche requiring 0.8 hours of labor. The bakery has a limited oven space and can only bake a total of 2500 loaves. The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week. Due to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a limited oven space and can only bake a total of 2500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2500)\n## The bakery has a contract to supply at least 500 loaves of Whole Wheat bread per week.\nmodel.addCons(WholeWheat >= 500)\n## Due to market demand, the bakery must produce at least twice as many loaves of Sourdough as Rye.\nmodel.addCons(Sourdough >= 2*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe.\n// {\"amount of Whole Wheat flour\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye flour\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Spelt flour\": \"Spelt\", \"range\": \"Spelt >= 0\", \"type\": \"continuous\"}\n// {\"amount of Oat flour\": \"Oat\", \"range\": \"Oat >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe.\n// Minimize: 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat\n\n## Generate Constraint-1:\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\n// WW + Rye + Spelt + Oat = 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\n// WW >= 0.20 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-3:\nThe bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\n// WW <= 0.50 * (WW + Rye + Spelt + Oat)\n// Rye <= 0.50 * (WW + Rye + Spelt + Oat)\n// Spelt <= 0.50 * (WW + Rye + Spelt + Oat)\n// Oat <= 0.50 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor.\n// Rye >= 10",
        "question": "A bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe. The cost per kilogram for each type of flour is given in the following Table.\n\n| Flour Type    | Cost per Kilogram |\n|---------------|-------------------|\n| Whole Wheat   | $0.50             |\n| Rye           | $0.60             |\n| Spelt         | $0.70             |\n| Oat           | $0.45             |\n\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms. The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons. The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour. Additionally, the bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor.\n\nPlease help the bakery to minimize the total cost of the flour used in the bread recipe.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of flour\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # amount of Whole Wheat flour\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye flour\nSpelt = model.addVar(vtype=\"CONTINUOUS\", name=\"Spelt\", lb=0) # amount of Spelt flour\nOat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oat\", lb=0) # amount of Oat flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat)\n\n# Add constraints\n## The bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\nmodel.addCons(WW + Rye + Spelt + Oat == 100)\n## The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Spelt + Oat))\n## The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\nmodel.addCons(WW <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Rye <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Spelt <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Oat <= 0.50 * (WW + Rye + Spelt + Oat))\n## The bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor.\nmodel.addCons(Rye >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat flour: \", model.getVal(WW))\n    print(\"Amount of Rye flour: \", model.getVal(Rye))\n    print(\"Amount of Spelt flour: \", model.getVal(Spelt))\n    print(\"Amount of Oat flour: \", model.getVal(Oat))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe.\n// {\"amount of Whole Wheat flour\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye flour\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Spelt flour\": \"Spelt\", \"range\": \"Spelt >= 0\", \"type\": \"continuous\"}\n// {\"amount of Oat flour\": \"Oat\", \"range\": \"Oat >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe.\n// Minimize: 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat\n\n## Generate Constraint-1:\nThe bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\n// WW + Rye + Spelt + Oat = 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\n// WW >= 0.20 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-3:\nThe bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\n// WW <= 0.50 * (WW + Rye + Spelt + Oat)\n// Rye <= 0.50 * (WW + Rye + Spelt + Oat)\n// Spelt <= 0.50 * (WW + Rye + Spelt + Oat)\n// Oat <= 0.50 * (WW + Rye + Spelt + Oat)\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor.\n// Rye >= 10",
        "question": "A bakery wants to optimize the ingredients for a new type of bread that uses four different types of flour: Whole Wheat, Rye, Spelt, and Oat. The bakery needs to determine the optimal amount of each type of flour to use in the bread recipe. The cost per kilogram for Whole Wheat flour is $0.50, for Rye flour is $0.60, for Spelt flour is $0.70, and for Oat flour is $0.45. The bakery wants to minimize the total cost of the flour used in the bread recipe. The bread recipe requires that the total amount of flour used must be exactly 100 kilograms. The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons. The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour. Additionally, the bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor. Please help the bakery determine the optimal amounts of each type of flour to use in the bread recipe.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of flour\nWW = model.addVar(vtype=\"CONTINUOUS\", name=\"WW\", lb=0) # amount of Whole Wheat flour\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye flour\nSpelt = model.addVar(vtype=\"CONTINUOUS\", name=\"Spelt\", lb=0) # amount of Spelt flour\nOat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oat\", lb=0) # amount of Oat flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*WW + 0.60*Rye + 0.70*Spelt + 0.45*Oat)\n\n# Add constraints\n## The bread recipe requires that the total amount of flour used must be exactly 100 kilograms.\nmodel.addCons(WW + Rye + Spelt + Oat == 100)\n## The bakery wants to ensure that at least 20% of the flour mix is Whole Wheat flour for nutritional reasons.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Spelt + Oat))\n## The bakery has a preference for a diverse flour mix and wants to limit the use of any single type of flour to no more than 50% of the total flour.\nmodel.addCons(WW <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Rye <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Spelt <= 0.50 * (WW + Rye + Spelt + Oat))\nmodel.addCons(Oat <= 0.50 * (WW + Rye + Spelt + Oat))\n## The bakery wants to ensure that the mix includes at least 10 kilograms of Rye flour for flavor.\nmodel.addCons(Rye >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat flour: \", model.getVal(WW))\n    print(\"Amount of Rye flour: \", model.getVal(Rye))\n    print(\"Amount of Spelt flour: \", model.getVal(Spelt))\n    print(\"Amount of Oat flour: \", model.getVal(Oat))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain_Loaves\", \"range\": \"Multigrain_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery wants to maximize the total profit from selling all types of bread.\n// Maximize: 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds.\n// Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat_Loaves >= 100\n// Rye_Loaves >= 100\n// Sourdough_Loaves >= 100\n// Multigrain_Loaves >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2.50           |\n| Rye           | $3.00           |\n| Sourdough     | $3.50           |\n| Multigrain    | $4.00           |\n\nThe bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds. The bakery also has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours. The bakery has a storage capacity limit of 500 loaves. Additionally, the bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize the total profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\nMultigrain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Loaves\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000)\n## The bakery has a total of 400 labor hours available.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat_Loaves >= 100)\nmodel.addCons(Rye_Loaves >= 100)\nmodel.addCons(Sourdough_Loaves >= 100)\nmodel.addCons(Multigrain_Loaves >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain_Loaves\", \"range\": \"Multigrain_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery wants to maximize the total profit from selling all types of bread.\n// Maximize: 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available. Each loaf of wheat bread requires 1 pound of flour, rye bread requires 1.5 pounds, sourdough requires 2 pounds, and multigrain requires 2.5 pounds.\n// Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a total of 400 labor hours available. Each loaf of wheat bread requires 0.5 hours of labor, rye bread requires 0.75 hours, sourdough requires 1 hour, and multigrain requires 1.25 hours.\n// 0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat_Loaves >= 100\n// Rye_Loaves >= 100\n// Sourdough_Loaves >= 100\n// Multigrain_Loaves >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf for wheat bread is $2.50, for rye bread is $3.00, for sourdough bread is $3.50, and for multigrain bread is $4.00. The bakery has a total of 1000 pounds of flour available, with each loaf of wheat bread requiring 1 pound of flour, rye bread requiring 1.5 pounds, sourdough requiring 2 pounds, and multigrain requiring 2.5 pounds. The bakery also has a total of 400 labor hours available, with each loaf of wheat bread requiring 0.5 hours of labor, rye bread requiring 0.75 hours, sourdough requiring 1 hour, and multigrain requiring 1.25 hours. The bakery has a storage capacity limit of 500 loaves. Additionally, the bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. Please help the bakery maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\nMultigrain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Loaves\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*Wheat_Loaves + 3.00*Rye_Loaves + 3.50*Sourdough_Loaves + 4.00*Multigrain_Loaves)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available.\nmodel.addCons(Wheat_Loaves + 1.5*Rye_Loaves + 2*Sourdough_Loaves + 2.5*Multigrain_Loaves <= 1000)\n## The bakery has a total of 400 labor hours available.\nmodel.addCons(0.5*Wheat_Loaves + 0.75*Rye_Loaves + 1*Sourdough_Loaves + 1.25*Multigrain_Loaves <= 400)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(Wheat_Loaves + Rye_Loaves + Sourdough_Loaves + Multigrain_Loaves <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat_Loaves >= 100)\nmodel.addCons(Rye_Loaves >= 100)\nmodel.addCons(Sourdough_Loaves >= 100)\nmodel.addCons(Multigrain_Loaves >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints.\n// {\"daily production of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Objective Function: Maximize: 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor.\n// 0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\n// Whole_Wheat + Rye + Sourdough + Brioche <= 1500\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// Whole_Wheat >= 200\n\n## Generate Constraint-4:\nDue to market demand, the bakery should not produce more than 300 loaves of Brioche daily.\n// Brioche <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $1.50           |\n| Rye            | $2.00           |\n| Sourdough      | $2.50           |\n| Brioche        | $3.00           |\n\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor. The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily. The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. Due to market demand, the bakery should not produce more than 300 loaves of Brioche daily.\n\nPlease help the bakery to maximize the total daily profit from selling all types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000)\n## The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Brioche <= 1500)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(Whole_Wheat >= 200)\n## Due to market demand, the bakery should not produce more than 300 loaves of Brioche daily.\nmodel.addCons(Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints.\n// {\"daily production of Whole Wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling all types of bread.\n// Objective Function: Maximize: 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor.\n// 0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\n// Whole_Wheat + Rye + Sourdough + Brioche <= 1500\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// Whole_Wheat >= 200\n\n## Generate Constraint-4:\nDue to market demand, the bakery should not produce more than 300 loaves of Brioche daily.\n// Brioche <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering various constraints. The profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery has a total of 1000 hours of labor available per day. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.7 hours, Sourdough requires 0.8 hours, and Brioche requires 1 hour of labor. The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily. The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. Due to market demand, the bakery should not produce more than 300 loaves of Brioche daily. Please help the bakery to maximize the total daily profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Whole_Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Whole_Wheat + 0.7*Rye + 0.8*Sourdough + 1*Brioche <= 1000)\n## The bakery has a limited oven space, allowing for a maximum of 1500 loaves to be baked daily.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Brioche <= 1500)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(Whole_Wheat >= 200)\n## Due to market demand, the bakery should not produce more than 300 loaves of Brioche daily.\nmodel.addCons(Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\n// Chocolate_Cakes >= 10\n\n## Generate Constraint-4:\nThe bakery must use at least 50 pounds of flour daily for other products.\n// Flour_Used >= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the labor and flour requirements for each type of cake.\n\n| Cake Type | Labor per Cake | Flour per Cake |\n|-----------|----------------|----------------|\n| Chocolate | 2 hours        | 3 pounds       |\n| Vanilla   | 1 hour         | 2 pounds       |\n\nThe bakery has a maximum of 100 hours of labor available daily and a maximum of 150 pounds of flour available daily. The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation and must use at least 50 pounds of flour daily for other products. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of hours of labor and amount of flour used\nLabor_Hours = model.addVar(vtype=\"INTEGER\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## Each chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n## The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\nmodel.addCons(Chocolate_Cakes >= 10)\n## The bakery must use at least 50 pounds of flour daily for other products.\nmodel.addCons(Flour_Used >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor: \", model.getVal(Labor_Hours))\n    print(\"Amount of flour used: \", model.getVal(Flour_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"integer\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\n// Chocolate_Cakes >= 10\n\n## Generate Constraint-4:\nThe bakery must use at least 50 pounds of flour daily for other products.\n// Flour_Used >= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to determine the optimal number of each type of cake to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor. The bakery has a maximum of 100 hours of labor available daily. Each chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour. The bakery has a maximum of 150 pounds of flour available daily. The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation. The bakery must use at least 50 pounds of flour daily for other products. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of hours of labor and amount of flour used\nLabor_Hours = model.addVar(vtype=\"INTEGER\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1 hour of labor.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## Each chocolate cake requires 3 pounds of flour, and each vanilla cake requires 2 pounds of flour.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes <= 150)\n## The bakery must produce at least 10 chocolate cakes daily to meet a contract obligation.\nmodel.addCons(Chocolate_Cakes >= 10)\n## The bakery must use at least 50 pounds of flour daily for other products.\nmodel.addCons(Flour_Used >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor: \", model.getVal(Labor_Hours))\n    print(\"Amount of flour used: \", model.getVal(Flour_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate frosting used\": \"Chocolate_Frosting\", \"range\": \"Chocolate_Frosting >= 0\", \"type\": \"continuous\"}\n// {\"amount of vanilla frosting used\": \"Vanilla_Frosting\", \"range\": \"Vanilla_Frosting >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\n// 0.5*Chocolate_Cakes <= Chocolate_Frosting\n// 0.4*Vanilla_Cakes <= Vanilla_Frosting\n// Chocolate_Frosting <= 10\n// Vanilla_Frosting <= 8\n\n## Generate Constraint-2:\nEach cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\n// Chocolate_Cakes + Vanilla_Cakes <= 12\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\n// Vanilla_Cakes >= 2\n\n## Generate Constraint-4:\nThe total amount of frosting used should not exceed the available supply.\n// Chocolate_Frosting + Vanilla_Frosting <= 10 + 8",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Profit per Cake | Frosting Required (kg) | Oven Time Required (hours) |\n|-----------------|-----------------|------------------------|----------------------------|\n| Chocolate       | $10             | 0.5                    | 1                          |\n| Vanilla         | $8              | 0.4                    | 1                          |\n\nThe bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting. Each cake requires 1 hour of oven time, and the bakery has a daily limit of 12 hours of oven time. The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings. The total amount of frosting used should not exceed the available supply.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of each type of frosting used\nChocolate_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Frosting\", lb=0) # amount of chocolate frosting used\nVanilla_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Frosting\", lb=0) # amount of vanilla frosting used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Frosting)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Frosting)\n## The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\nmodel.addCons(Chocolate_Frosting <= 10)\nmodel.addCons(Vanilla_Frosting <= 8)\n## Each cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 12)\n## The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n## The total amount of frosting used should not exceed the available supply.\nmodel.addCons(Chocolate_Frosting + Vanilla_Frosting <= 10 + 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate frosting used: \", model.getVal(Chocolate_Frosting))\n    print(\"Amount of vanilla frosting used: \", model.getVal(Vanilla_Frosting))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1218,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate frosting used\": \"Chocolate_Frosting\", \"range\": \"Chocolate_Frosting >= 0\", \"type\": \"continuous\"}\n// {\"amount of vanilla frosting used\": \"Vanilla_Frosting\", \"range\": \"Vanilla_Frosting >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and from a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\n// 0.5*Chocolate_Cakes <= Chocolate_Frosting\n// 0.4*Vanilla_Cakes <= Vanilla_Frosting\n// Chocolate_Frosting <= 10\n// Vanilla_Frosting <= 8\n\n## Generate Constraint-2:\nEach cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\n// Chocolate_Cakes + Vanilla_Cakes <= 12\n\n## Generate Constraint-3:\nThe bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\n// Vanilla_Cakes >= 2\n\n## Generate Constraint-4:\nThe total amount of frosting used should not exceed the available supply.\n// Chocolate_Frosting + Vanilla_Frosting <= 10 + 8",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as ingredients and oven time. The profit from selling a chocolate cake is $10, and from a vanilla cake is $8. Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting. The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting. Each cake requires 1 hour of oven time, and the bakery has a daily limit of 12 hours of oven time. The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings. The total amount of frosting used should not exceed the available supply. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of each type of frosting used\nChocolate_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Frosting\", lb=0) # amount of chocolate frosting used\nVanilla_Frosting = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Frosting\", lb=0) # amount of vanilla frosting used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate frosting, and each vanilla cake requires 0.4 kg of vanilla frosting.\nmodel.addCons(0.5*Chocolate_Cakes <= Chocolate_Frosting)\nmodel.addCons(0.4*Vanilla_Cakes <= Vanilla_Frosting)\n## The bakery has a daily supply of 10 kg of chocolate frosting and 8 kg of vanilla frosting.\nmodel.addCons(Chocolate_Frosting <= 10)\nmodel.addCons(Vanilla_Frosting <= 8)\n## Each cake requires 1 hour of oven time. The bakery has a daily limit of 12 hours of oven time.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 12)\n## The bakery has a policy to produce at least 2 vanilla cakes per day to maintain variety in its offerings.\nmodel.addCons(Vanilla_Cakes >= 2)\n## The total amount of frosting used should not exceed the available supply.\nmodel.addCons(Chocolate_Frosting + Vanilla_Frosting <= 10 + 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Amount of chocolate frosting used: \", model.getVal(Chocolate_Frosting))\n    print(\"Amount of vanilla frosting used: \", model.getVal(Vanilla_Frosting))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 2.5*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20\n\n## Generate Constraint-2:\nEach wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\n// 15*Wheat_Loaves + 20*Rye_Loaves <= 240\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\n// Wheat_Loaves + Rye_Loaves >= 20\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand.\n// Wheat_Loaves >= 2*Rye_Loaves",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The details of the ingredients and production times for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Usage per Loaf | Oven Time per Loaf |\n|------------|-----------------|----------------------|---------------------|\n| Wheat      | $3              | 0.5 kg               | 15 minutes         |\n| Rye        | $2.5            | 0.4 kg               | 20 minutes         |\n\nThe bakery has a daily supply of 20 kg of flour. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day. The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread. The bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Flour usage in each type of bread\nFlour_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Wheat\", lb=0) # flour usage in wheat bread\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour usage in rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 2.5*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20)\n## Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\nmodel.addCons(15*Wheat_Loaves + 20*Rye_Loaves <= 240)\n## The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 20)\n## The bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand.\nmodel.addCons(Wheat_Loaves >= 2*Rye_Loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"flour usage in wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"flour usage in rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 2.5*Rye_Loaves\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\n// 0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20\n\n## Generate Constraint-2:\nEach wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\n// 15*Wheat_Loaves + 20*Rye_Loaves <= 240\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\n// Wheat_Loaves + Rye_Loaves >= 20\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand.\n// Wheat_Loaves >= 2*Rye_Loaves",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $2.5. Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour. Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day. The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread. The bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Flour usage in each type of bread\nFlour_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Wheat\", lb=0) # flour usage in wheat bread\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour usage in rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 2.5*Rye_Loaves)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 kg of flour, and each rye bread loaf requires 0.4 kg of flour. The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.4*Rye_Loaves <= 20)\n## Each wheat bread loaf takes 15 minutes of oven time, and each rye bread loaf takes 20 minutes of oven time. The bakery's oven can operate for a maximum of 4 hours (240 minutes) per day.\nmodel.addCons(15*Wheat_Loaves + 20*Rye_Loaves <= 240)\n## The bakery has a minimum daily production requirement of 20 loaves of bread, which can be any combination of wheat and rye bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 20)\n## The bakery aims to produce at least twice as many wheat bread loaves as rye bread loaves to meet market demand.\nmodel.addCons(Wheat_Loaves >= 2*Rye_Loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. The bakery wants to maximize the daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each eclair requires 0.3 hours. The bakery has a total of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, each donut requires 0.06 square meters, and each eclair requires 0.1 square meters. The bakery has a total of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30\n\n## Generate Constraint-4:\nThe bakery aims to produce no more than 100 donuts and 60 eclairs daily to maintain product freshness and quality.\n// Donuts <= 100\n// Eclairs <= 60",
        "question": "A bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per pastry and the resources required for each type of pastry are given in the following Table.\n\n| Pastry   | Profit per Unit | Labor Hours per Unit | Oven Space per Unit |\n|----------|-----------------|----------------------|---------------------|\n| Croissants | $0.50          | 0.1 hours            | 0.05 square meters  |\n| Muffins    | $0.75          | 0.2 hours            | 0.08 square meters  |\n| Donuts     | $0.60          | 0.15 hours           | 0.06 square meters  |\n| Eclairs    | $1.00          | 0.3 hours            | 0.1 square meters   |\n\nThe bakery has a total of 10 hours of labor available daily and 1.5 square meters of oven space available daily. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes. The bakery aims to produce no more than 100 donuts and 60 eclairs daily to maintain product freshness and quality.\n\nPlease help the bakery to maximize the daily profit from selling these pastries by determining the optimal number of each type of pastry to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs)\n\n# Add constraints\n## Each pastry type requires a certain amount of labor hours\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10)\n## Each pastry type requires a certain amount of oven space\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5)\n## The bakery must produce at least 50 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n## The bakery aims to produce no more than 100 donuts and 60 eclairs daily\nmodel.addCons(Donuts <= 100)\nmodel.addCons(Eclairs <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of Eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1339,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. The bakery wants to maximize the daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, each donut requires 0.15 hours, and each eclair requires 0.3 hours. The bakery has a total of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, each donut requires 0.06 square meters, and each eclair requires 0.1 square meters. The bakery has a total of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes.\n// Croissants >= 50\n// Muffins >= 30\n\n## Generate Constraint-4:\nThe bakery aims to produce no more than 100 donuts and 60 eclairs daily to maintain product freshness and quality.\n// Donuts <= 100\n// Eclairs <= 60",
        "question": "A bakery produces four types of pastries: croissants, muffins, donuts, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, per donut is $0.60, and per eclair is $1.00. Each croissant requires 0.1 hours of labor and 0.05 square meters of oven space, each muffin requires 0.2 hours of labor and 0.08 square meters of oven space, each donut requires 0.15 hours of labor and 0.06 square meters of oven space, and each eclair requires 0.3 hours of labor and 0.1 square meters of oven space. The bakery has a total of 10 hours of labor and 1.5 square meters of oven space available daily. The bakery must produce at least 50 croissants and 30 muffins daily to meet the minimum order requirements from local cafes. The bakery aims to produce no more than 100 donuts and 60 eclairs daily to maintain product freshness and quality. Please help the bakery to maximize the daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts + 1.00*Eclairs)\n\n# Add constraints\n## Each pastry type requires a certain amount of labor hours\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts + 0.3*Eclairs <= 10)\n## Each pastry type requires a certain amount of oven space\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.06*Donuts + 0.1*Eclairs <= 1.5)\n## The bakery must produce at least 50 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\n## The bakery aims to produce no more than 100 donuts and 60 eclairs daily\nmodel.addCons(Donuts <= 100)\nmodel.addCons(Eclairs <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of Eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours required for chocolate cakes\": \"Chocolate_Labor\", \"range\": \"Chocolate_Labor >= 0\", \"type\": \"real\"}\n// {\"number of labor hours required for vanilla cakes\": \"Vanilla_Labor\", \"range\": \"Vanilla_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\n// 1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes.\n// Chocolate_Cakes >= 0.3 * (Chocolate_Cakes + Vanilla_Cakes)",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The following table summarizes the labor and oven space requirements for each type of cake.\n\n| Cake Type       | Profit per Cake | Labor Hours Required | Oven Space Required |\n|-----------------|-----------------|----------------------|---------------------|\n| Chocolate       | $10             | 2 hours              | 1.5 square feet    |\n| Vanilla         | $8              | 1.5 hours            | 1 square foot       |\n\nThe bakery has a total of 120 labor hours and 100 square feet of oven space available per day. The bakery has a minimum daily production requirement of 20 cakes in total. Additionally, the bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## The total labor hours available per day are 120.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120)\n## The total oven space available per day is 100 square feet.\nmodel.addCons(1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery has a minimum daily production requirement of 20 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 20)\n## The bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes.\nmodel.addCons(Chocolate_Cakes >= 0.3 * (Chocolate_Cakes + Vanilla_Cakes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours required for chocolate cakes\": \"Chocolate_Labor\", \"range\": \"Chocolate_Labor >= 0\", \"type\": \"real\"}\n// {\"number of labor hours required for vanilla cakes\": \"Vanilla_Labor\", \"range\": \"Vanilla_Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, and the profit per vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe total labor hours available per day are 120. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120\n\n## Generate Constraint-2:\nThe total oven space available per day is 100 square feet. Each chocolate cake requires 1.5 square feet of oven space, and each vanilla cake requires 1 square foot of oven space.\n// 1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 20 cakes in total.\n// Chocolate_Cakes + Vanilla_Cakes >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes.\n// Chocolate_Cakes >= 0.3 * (Chocolate_Cakes + Vanilla_Cakes)",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide on the optimal number of each type of cake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, and the profit per vanilla cake is $8. The total labor hours available per day are 120, with each chocolate cake requiring 2 hours of labor and each vanilla cake requiring 1.5 hours of labor. The total oven space available per day is 100 square feet, with each chocolate cake requiring 1.5 square feet of oven space and each vanilla cake requiring 1 square foot of oven space. The bakery has a minimum daily production requirement of 20 cakes in total. Additionally, the bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## The total labor hours available per day are 120.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 120)\n## The total oven space available per day is 100 square feet.\nmodel.addCons(1.5*Chocolate_Cakes + 1*Vanilla_Cakes <= 100)\n## The bakery has a minimum daily production requirement of 20 cakes in total.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 20)\n## The bakery wants to ensure that at least 30% of the total cakes produced are chocolate cakes.\nmodel.addCons(Chocolate_Cakes >= 0.3 * (Chocolate_Cakes + Vanilla_Cakes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 kilograms of flour. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of Bread 1-4 requires 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation.\n// B1 >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of loaves produced does not exceed 150 to maintain product quality.\n// B1 + B2 + B3 + B4 <= 150",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery has a daily limit of 200 kilograms of flour and a labor limit of 8 hours. Each loaf of Bread 1-4 requires different amounts of flour and labor as shown in the following Table.\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Labor Required (hours) |\n|------------|-----------------|---------------------|------------------------|\n| Bread 1    | $2.50           | 0.5                 | 0.05                   |\n| Bread 2    | $3.00           | 0.4                 | 0.04                   |\n| Bread 3    | $2.75           | 0.6                 | 0.06                   |\n| Bread 4    | $2.25           | 0.3                 | 0.03                   |\n\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation. The bakery wants to ensure that the total number of loaves produced does not exceed 150 to maintain product quality. Please help the bakery to maximize the total daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # number of loaves of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # number of loaves of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # number of loaves of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4)\n\n# Add constraints\n## The bakery has a daily limit of 200 kilograms of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8)\n## The bakery must produce at least 20 loaves of Bread 1 daily.\nmodel.addCons(B1 >= 20)\n## The bakery wants to ensure that the total number of loaves produced does not exceed 150.\nmodel.addCons(B1 + B2 + B3 + B4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(B1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(B2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(B3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 kilograms of flour. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of Bread 1-4 requires 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation.\n// B1 >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of loaves produced does not exceed 150 to maintain product quality.\n// B1 + B2 + B3 + B4 <= 150",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while considering the availability of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $2.50, $3.00, $2.75, and $2.25 respectively. The bakery has a daily limit of 200 kilograms of flour, with each loaf of Bread 1-4 requiring 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively. The bakery also has a daily labor limit of 8 hours, with each loaf of Bread 1-4 requiring 0.05 hours, 0.04 hours, 0.06 hours, and 0.03 hours of labor respectively. The bakery must produce at least 20 loaves of Bread 1 daily to meet a contractual obligation. Additionally, the bakery wants to ensure that the total number of loaves produced does not exceed 150 to maintain product quality. Please help the bakery to maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # number of loaves of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # number of loaves of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # number of loaves of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*B1 + 3.00*B2 + 2.75*B3 + 2.25*B4)\n\n# Add constraints\n## The bakery has a daily limit of 200 kilograms of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 200)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.03*B4 <= 8)\n## The bakery must produce at least 20 loaves of Bread 1 daily.\nmodel.addCons(B1 >= 20)\n## The bakery wants to ensure that the total number of loaves produced does not exceed 150.\nmodel.addCons(B1 + B2 + B3 + B4 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(B1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(B2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(B3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4\n\n## Generate Constraint-1:\nEach loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery has a daily supply of 100 kg of flour.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively. The bakery has a daily supply of 2 kg of yeast.\n// 0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2\n\n## Generate Constraint-3:\nEach loaf of Bread 1-4 requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively. The bakery has a daily supply of 15 kg of sugar.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 loaves of Bread 1.\n// B1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types.\n\n| Bread Type | Selling Price per Loaf | Flour Required per Loaf (kg) | Yeast Required per Loaf (kg) | Sugar Required per Loaf (kg) |\n|------------|------------------------|------------------------------|------------------------------|------------------------------|\n| Bread 1    | $3.50                  | 0.5                          | 0.01                        | 0.05                        |\n| Bread 2    | $4.00                  | 0.4                          | 0.02                        | 0.04                        |\n| Bread 3    | $4.50                  | 0.6                          | 0.015                       | 0.06                        |\n| Bread 4    | $5.00                  | 0.7                          | 0.025                       | 0.07                        |\n\nThe bakery has a daily supply of 100 kg of flour, 2 kg of yeast, and 15 kg of sugar. The bakery has a daily demand for at least 50 loaves of Bread 1.\n\nPlease help the bakery to determine the optimal number of each type of bread to produce daily to maximize its daily revenue, given the constraints on the supplies of flour, yeast, and sugar, and the demand for Bread 1.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of Bread 3 produced daily\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4)\n\n# Add constraints\n## Each loaf of Bread 1-4 requires different amounts of flour, and the bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100)\n## Each loaf of Bread 1-4 requires different amounts of yeast, and the bakery has a daily supply of 2 kg of yeast.\nmodel.addCons(0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2)\n## Each loaf of Bread 1-4 requires different amounts of sugar, and the bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15)\n## The bakery has a daily demand for at least 50 loaves of Bread 1.\nmodel.addCons(B1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(B4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1615,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Bread 1 produced daily\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 2 produced daily\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 3 produced daily\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of Bread 4 produced daily\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types.\n// Objective Function: Maximize: 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4\n\n## Generate Constraint-1:\nEach loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively. The bakery has a daily supply of 100 kg of flour.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively. The bakery has a daily supply of 2 kg of yeast.\n// 0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2\n\n## Generate Constraint-3:\nEach loaf of Bread 1-4 requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively. The bakery has a daily supply of 15 kg of sugar.\n// 0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 loaves of Bread 1.\n// B1 >= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its daily profit. Each type of bread requires different amounts of flour, yeast, and sugar, and has a different selling price. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00 respectively. The bakery wants to maximize its daily revenue from selling these bread types. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour respectively, and the bakery has a daily supply of 100 kg of flour. Each loaf also requires 0.01 kg, 0.02 kg, 0.015 kg, and 0.025 kg of yeast respectively, with a daily supply of 2 kg of yeast. Additionally, each loaf requires 0.05 kg, 0.04 kg, 0.06 kg, and 0.07 kg of sugar respectively, with a daily supply of 15 kg of sugar. The bakery has a daily demand for at least 50 loaves of Bread 1. Please help the bakery determine the optimal number of each type of bread to produce daily to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of Bread 1 produced daily\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of Bread 2 produced daily\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of Bread 3 produced daily\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of Bread 4 produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*B1 + 4.00*B2 + 4.50*B3 + 5.00*B4)\n\n# Add constraints\n## Each loaf of Bread 1-4 requires different amounts of flour, and the bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.7*B4 <= 100)\n## Each loaf of Bread 1-4 requires different amounts of yeast, and the bakery has a daily supply of 2 kg of yeast.\nmodel.addCons(0.01*B1 + 0.02*B2 + 0.015*B3 + 0.025*B4 <= 2)\n## Each loaf of Bread 1-4 requires different amounts of sugar, and the bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*B1 + 0.04*B2 + 0.06*B3 + 0.07*B4 <= 15)\n## The bakery has a daily demand for at least 50 loaves of Bread 1.\nmodel.addCons(B1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Bread 1 produced daily: \", model.getVal(B1))\n    print(\"Number of Bread 2 produced daily: \", model.getVal(B2))\n    print(\"Number of Bread 3 produced daily: \", model.getVal(B3))\n    print(\"Number of Bread 4 produced daily: \", model.getVal(B4))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints.\n// {\"quantity of Bread A produced daily\": \"qA\", \"range\": \"0 <= qA <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread B produced daily\": \"qB\", \"range\": \"0 <= qB <= 800\", \"type\": \"integer\"}\n// {\"quantity of Bread C produced daily\": \"qC\", \"range\": \"0 <= qC <= 500\", \"type\": \"integer\"}\n// {\"quantity of Pastry D produced daily\": \"qD\", \"range\": \"0 <= qD <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery aims to maximize the total daily profit.\n// Objective Function: Maximize: 2*qA + 3*qB + 4*qC + 5*qD\n\n## Generate Constraint-1:\nThe bakery has a total of 2000 kg of flour available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively.\n// qA + 2*qB + 3*qC + qD <= 2000\n\n## Generate Constraint-2:\nThe bakery has a total of 1000 hours of labor available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively.\n// 0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\n// qA >= 100\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined.\n// qC <= 0.5*(qA + qB)",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints. The profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The following table summarizes the requirements for each product:\n\n| Product | Profit per Unit | Flour Required (kg) | Labor Required (hours) |\n|---------|-----------------|---------------------|-------------------------|\n| Bread A | $2              | 1                   | 0.5                     |\n| Bread B | $3              | 2                   | 1                       |\n| Bread C | $4              | 3                   | 1.5                     |\n| Pastry D| $5              | 1                   | 0.5                     |\n\nThe bakery has a total of 2000 kg of flour available daily. The bakery also has a total of 1000 hours of labor available daily. The bakery must produce at least 100 units of Bread A daily to meet contractual obligations. Additionally, the bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nqA = model.addVar(vtype=\"INTEGER\", name=\"qA\", lb=0, ub=1000) # quantity of Bread A produced daily\nqB = model.addVar(vtype=\"INTEGER\", name=\"qB\", lb=0, ub=800) # quantity of Bread B produced daily\nqC = model.addVar(vtype=\"INTEGER\", name=\"qC\", lb=0, ub=500) # quantity of Bread C produced daily\nqD = model.addVar(vtype=\"INTEGER\", name=\"qD\", lb=0, ub=300) # quantity of Pastry D produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*qA + 3*qB + 4*qC + 5*qD)\n\n# Add constraints\n## The bakery has a total of 2000 kg of flour available daily.\nmodel.addCons(qA + 2*qB + 3*qC + qD <= 2000)\n## The bakery has a total of 1000 hours of labor available daily.\nmodel.addCons(0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000)\n## The bakery must produce at least 100 units of Bread A daily.\nmodel.addCons(qA >= 100)\n## The bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined.\nmodel.addCons(qC <= 0.5*(qA + qB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread A produced daily: \", model.getVal(qA))\n    print(\"Quantity of Bread B produced daily: \", model.getVal(qB))\n    print(\"Quantity of Bread C produced daily: \", model.getVal(qC))\n    print(\"Quantity of Pastry D produced daily: \", model.getVal(qD))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1392,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints.\n// {\"quantity of Bread A produced daily\": \"qA\", \"range\": \"0 <= qA <= 1000\", \"type\": \"integer\"}\n// {\"quantity of Bread B produced daily\": \"qB\", \"range\": \"0 <= qB <= 800\", \"type\": \"integer\"}\n// {\"quantity of Bread C produced daily\": \"qC\", \"range\": \"0 <= qC <= 500\", \"type\": \"integer\"}\n// {\"quantity of Pastry D produced daily\": \"qD\", \"range\": \"0 <= qD <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery aims to maximize the total daily profit.\n// Objective Function: Maximize: 2*qA + 3*qB + 4*qC + 5*qD\n\n## Generate Constraint-1:\nThe bakery has a total of 2000 kg of flour available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively.\n// qA + 2*qB + 3*qC + qD <= 2000\n\n## Generate Constraint-2:\nThe bakery has a total of 1000 hours of labor available daily. Each unit of Bread A, Bread B, Bread C, and Pastry D requires 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively.\n// 0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Bread A daily to meet contractual obligations.\n// qA >= 100\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined.\n// qC <= 0.5*(qA + qB)",
        "question": "A bakery wants to optimize the production of three types of bread (Bread A, Bread B, and Bread C) and one type of pastry (Pastry D). The bakery needs to determine the daily production quantity of each product to maximize profit while meeting certain constraints. The profit per unit of Bread A, Bread B, Bread C, and Pastry D is $2, $3, $4, and $5 respectively. The bakery has a total of 2000 kg of flour available daily, and each unit of Bread A, Bread B, Bread C, and Pastry D requires 1 kg, 2 kg, 3 kg, and 1 kg of flour respectively. The bakery also has a total of 1000 hours of labor available daily, with each unit of Bread A, Bread B, Bread C, and Pastry D requiring 0.5 hours, 1 hour, 1.5 hours, and 0.5 hours of labor respectively. The bakery must produce at least 100 units of Bread A daily to meet contractual obligations. Additionally, the bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced daily\nqA = model.addVar(vtype=\"INTEGER\", name=\"qA\", lb=0, ub=1000) # quantity of Bread A produced daily\nqB = model.addVar(vtype=\"INTEGER\", name=\"qB\", lb=0, ub=800) # quantity of Bread B produced daily\nqC = model.addVar(vtype=\"INTEGER\", name=\"qC\", lb=0, ub=500) # quantity of Bread C produced daily\nqD = model.addVar(vtype=\"INTEGER\", name=\"qD\", lb=0, ub=300) # quantity of Pastry D produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*qA + 3*qB + 4*qC + 5*qD)\n\n# Add constraints\n## The bakery has a total of 2000 kg of flour available daily.\nmodel.addCons(qA + 2*qB + 3*qC + qD <= 2000)\n## The bakery has a total of 1000 hours of labor available daily.\nmodel.addCons(0.5*qA + qB + 1.5*qC + 0.5*qD <= 1000)\n## The bakery must produce at least 100 units of Bread A daily.\nmodel.addCons(qA >= 100)\n## The bakery must ensure that the production of Bread C does not exceed 50% of the total production of Bread A and Bread B combined.\nmodel.addCons(qC <= 0.5*(qA + qB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Bread A produced daily: \", model.getVal(qA))\n    print(\"Quantity of Bread B produced daily: \", model.getVal(qB))\n    print(\"Quantity of Bread C produced daily: \", model.getVal(qC))\n    print(\"Quantity of Pastry D produced daily: \", model.getVal(qD))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"q1\", \"range\": \"0 <= q1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"q2\", \"range\": \"0 <= q2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"q3\", \"range\": \"0 <= q3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"q4\", \"range\": \"0 <= q4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost.\n// Objective Function: Minimize: 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4\n\n## Generate Constraint-1:\nThe bakery has a total of 20 hours of labor available daily. Producing Bread 1-4 requires 0.01, 0.02, 0.015, and 0.025 hours of labor per loaf, respectively.\n// 0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\n// q1 >= 500\n\n## Generate Constraint-3:\nThe total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\n// q2 + q3 <= 800\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 1200 loaves in total daily.\n// q1 + q2 + q3 + q4 >= 1200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread. The cost of producing each type of bread per loaf is as follows:\n\n| Bread Type | Cost per Loaf |\n|------------|---------------|\n| Bread 1    | $0.50         |\n| Bread 2    | $0.75         |\n| Bread 3    | $0.60         |\n| Bread 4    | $0.80         |\n\nThe bakery has a total of 20 hours of labor available daily. Producing each type of bread requires a certain amount of labor per loaf:\n\n| Bread Type | Labor per Loaf |\n|------------|----------------|\n| Bread 1    | 0.01 hours     |\n| Bread 2    | 0.02 hours     |\n| Bread 3    | 0.015 hours    |\n| Bread 4    | 0.025 hours    |\n\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand. The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves. The bakery aims to produce at least 1200 loaves in total daily.\n\nPlease help the bakery to minimize the total daily production cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0, ub=1000) # daily production quantity of Bread 1\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0, ub=1000) # daily production quantity of Bread 2\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0, ub=1000) # daily production quantity of Bread 3\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0, ub=1000) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4)\n\n# Add constraints\n## The bakery has a total of 20 hours of labor available daily.\nmodel.addCons(0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20)\n## The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\nmodel.addCons(q1 >= 500)\n## The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\nmodel.addCons(q2 + q3 <= 800)\n## The bakery aims to produce at least 1200 loaves in total daily.\nmodel.addCons(q1 + q2 + q3 + q4 >= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(q1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(q2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(q3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(q4))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"q1\", \"range\": \"0 <= q1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"q2\", \"range\": \"0 <= q2 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"q3\", \"range\": \"0 <= q3 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"q4\", \"range\": \"0 <= q4 <= 1000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost.\n// Objective Function: Minimize: 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4\n\n## Generate Constraint-1:\nThe bakery has a total of 20 hours of labor available daily. Producing Bread 1-4 requires 0.01, 0.02, 0.015, and 0.025 hours of labor per loaf, respectively.\n// 0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20\n\n## Generate Constraint-2:\nThe bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\n// q1 >= 500\n\n## Generate Constraint-3:\nThe total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\n// q2 + q3 <= 800\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 1200 loaves in total daily.\n// q1 + q2 + q3 + q4 >= 1200",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to meet customer demand while optimizing costs and maintaining quality. The bakery needs to determine the daily production quantity of each type of bread. The cost of producing Bread 1-4 is $0.50, $0.75, $0.60, and $0.80 per loaf, respectively. The bakery wants to minimize the total daily production cost. The bakery has a total of 20 hours of labor available daily, with each loaf of Bread 1-4 requiring 0.01, 0.02, 0.015, and 0.025 hours of labor, respectively. The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand. The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves. The bakery aims to produce at least 1200 loaves in total daily. Please help the bakery determine the optimal daily production quantity for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq1 = model.addVar(vtype=\"INTEGER\", name=\"q1\", lb=0, ub=1000) # daily production quantity of Bread 1\nq2 = model.addVar(vtype=\"INTEGER\", name=\"q2\", lb=0, ub=1000) # daily production quantity of Bread 2\nq3 = model.addVar(vtype=\"INTEGER\", name=\"q3\", lb=0, ub=1000) # daily production quantity of Bread 3\nq4 = model.addVar(vtype=\"INTEGER\", name=\"q4\", lb=0, ub=1000) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*q1 + 0.75*q2 + 0.60*q3 + 0.80*q4)\n\n# Add constraints\n## The bakery has a total of 20 hours of labor available daily.\nmodel.addCons(0.01*q1 + 0.02*q2 + 0.015*q3 + 0.025*q4 <= 20)\n## The bakery must produce at least 500 loaves of Bread 1 daily to meet minimum customer demand.\nmodel.addCons(q1 >= 500)\n## The total daily production of Bread 2 and Bread 3 should not exceed 800 loaves.\nmodel.addCons(q2 + q3 <= 800)\n## The bakery aims to produce at least 1200 loaves in total daily.\nmodel.addCons(q1 + q2 + q3 + q4 >= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(q1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(q2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(q3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(q4))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour, respectively.\n// 0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 10 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.01 kg, 0.02 kg, and 0.03 kg of yeast, respectively.\n// 0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 loaves of each type of bread are produced daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 50\n// Sourdough >= 50",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints. The profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery has a daily supply of 100 kg of flour, 10 kg of yeast, and 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires the following amounts of ingredients:\n\n| Bread Type | Flour (kg) | Yeast (kg) | Water (liters) |\n|------------|------------|------------|----------------|\n| Wheat      | 0.2        | 0.01       | 0.5            |\n| Rye        | 0.3        | 0.02       | 0.6            |\n| Sourdough  | 0.4        | 0.03       | 0.7            |\n\nThe bakery wants to ensure that at least 50 loaves of each type of bread are produced daily to meet minimum customer demand. Please help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100)\n## The bakery has a daily supply of 10 kg of yeast.\nmodel.addCons(0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10)\n## The bakery has a daily supply of 500 liters of water.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500)\n## The bakery wants to ensure that at least 50 loaves of each type of bread are produced daily.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting ingredient constraints.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour, respectively.\n// 0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 10 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.01 kg, 0.02 kg, and 0.03 kg of yeast, respectively.\n// 0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 loaves of each type of bread are produced daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 50\n// Sourdough >= 50",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and water, and yields different profits. The profit per loaf for Wheat, Rye, and Sourdough bread is $1.50, $2.00, and $2.50, respectively. The bakery wants to maximize the total daily profit from bread sales. The bakery has a daily supply of 100 kg of flour, 10 kg of yeast, and 500 liters of water. Each loaf of Wheat, Rye, and Sourdough bread requires 0.2 kg, 0.3 kg, and 0.4 kg of flour; 0.01 kg, 0.02 kg, and 0.03 kg of yeast; and 0.5 liters, 0.6 liters, and 0.7 liters of water, respectively. The bakery wants to ensure that at least 50 loaves of each type of bread are produced daily to meet minimum customer demand. Please help the bakery determine the daily production quantities of each type of bread to maximize profit while meeting these ingredient constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.2*Wheat + 0.3*Rye + 0.4*Sourdough <= 100)\n## The bakery has a daily supply of 10 kg of yeast.\nmodel.addCons(0.01*Wheat + 0.02*Rye + 0.03*Sourdough <= 10)\n## The bakery has a daily supply of 500 liters of water.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 500)\n## The bakery wants to ensure that at least 50 loaves of each type of bread are produced daily.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily.\n// {\"number of Whole Wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively.\n// 1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 loaves of each type of bread.\n// Whole_Wheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// White >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\n// Whole_Wheat + Rye + Sourdough + White <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread.\n// Whole_Wheat >= 0.30 * (Whole_Wheat + Rye + Sourdough + White)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily. The selling price per loaf for each type of bread is given in the following Table.\n\n| Bread Type   | Selling Price per Loaf |\n|--------------|------------------------|\n| Whole Wheat  | $3.50                  |\n| Rye          | $4.00                  |\n| Sourdough    | $4.50                  |\n| White        | $3.00                  |\n\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively. The bakery has a daily demand for at least 100 loaves of each type of bread. The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once. The bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread.\n\nPlease help the bakery to maximize its daily revenue from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500)\n## The bakery has a daily demand for at least 100 loaves of each type of bread.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(White >= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + White <= 300)\n## The bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread.\nmodel.addCons(Whole_Wheat >= 0.30 * (Whole_Wheat + Rye + Sourdough + White))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily.\n// {\"number of Whole Wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales.\n// Objective Function: Maximize: 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively.\n// 1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 loaves of each type of bread.\n// Whole_Wheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// White >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\n// Whole_Wheat + Rye + Sourdough + White <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread.\n// Whole_Wheat >= 0.30 * (Whole_Wheat + Rye + Sourdough + White)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and White. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily. The selling price per loaf for Whole Wheat, Rye, Sourdough, and White bread is $3.50, $4.00, $4.50, and $3.00, respectively. The bakery wants to maximize its daily revenue from bread sales. The bakery has a daily limit of 500 pounds of flour. Each loaf of Whole Wheat, Rye, Sourdough, and White bread requires 1.5 pounds, 1.2 pounds, 1.3 pounds, and 1.0 pounds of flour, respectively. The bakery has a daily demand for at least 100 loaves of each type of bread. The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once. The bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3.50*Whole_Wheat + 4.00*Rye + 4.50*Sourdough + 3.00*White)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(1.5*Whole_Wheat + 1.2*Rye + 1.3*Sourdough + 1.0*White <= 500)\n## The bakery has a daily demand for at least 100 loaves of each type of bread.\nmodel.addCons(Whole_Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(White >= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 300 loaves to be baked at once.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + White <= 300)\n## The bakery wants to ensure that at least 30% of the total bread production is Whole Wheat bread.\nmodel.addCons(Whole_Wheat >= 0.30 * (Whole_Wheat + Rye + Sourdough + White))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Whole Grain bread\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available each day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively. The total daily supply of flour is 150 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value.\n// Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for Wheat bread of 100 loaves.\n// Wheat >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery has a total of 100 hours of labor available each day, and each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery also has a limited supply of flour, with each loaf of bread requiring 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively, and a total daily supply of 150 pounds. The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value. Additionally, the bakery has a minimum daily demand for Wheat bread of 100 loaves.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n\n| Bread Type       | Profit per Loaf | Labor per Loaf | Flour per Loaf |\n|-------------------|-----------------|----------------|----------------|\n| Wheat             | $1.50           | 0.1 hours      | 0.5 pounds     |\n| Rye               | $2.00           | 0.2 hours      | 0.6 pounds     |\n| Sourdough         | $2.50           | 0.3 hours      | 0.7 pounds     |\n| Whole Grain       | $3.00           | 0.4 hours      | 0.8 pounds     |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available each day.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100)\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150)\n## The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread.\nmodel.addCons(Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n## The bakery has a minimum daily demand for Wheat bread of 100 loaves.\nmodel.addCons(Wheat >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Whole Grain bread\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available each day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively. The total daily supply of flour is 150 pounds.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value.\n// Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for Wheat bread of 100 loaves.\n// Wheat >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and labor. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The profit per loaf of Wheat, Rye, Sourdough, and Whole Grain bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery has a total of 100 hours of labor available each day, and each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery also has a limited supply of flour, with each loaf of bread requiring 0.5, 0.6, 0.7, and 0.8 pounds of flour, respectively, and a total daily supply of 150 pounds. The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread due to its high nutritional value. Additionally, the bakery has a minimum daily demand for Wheat bread of 100 loaves. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # daily production quantity of Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production quantity of Rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # daily production quantity of Sourdough bread\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available each day.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.4*Whole_Grain <= 100)\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough + 0.8*Whole_Grain <= 150)\n## The bakery wants to ensure that at least 20% of the total bread production is Whole Grain bread.\nmodel.addCons(Whole_Grain >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n## The bakery has a minimum daily demand for Wheat bread of 100 loaves.\nmodel.addCons(Wheat >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(Wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10\n\n## Generate Constraint-4:\nThe total weight of the cake should not exceed 2000 grams.\n// Flour + Sugar + Eggs + Butter <= 2000",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake. The cost per unit of each ingredient is given in the following Table.\n\n| Ingredient | Cost per Unit |\n|------------|---------------|\n| Flour      | $0.50         |\n| Sugar      | $0.25         |\n| Eggs       | $1.00         |\n| Butter     | $2.00         |\n\nThe bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour. It must contain no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. The total weight of the cake should not exceed 2000 grams.\n\nPlease help the bakery determine the optimal quantities of Flour, Sugar, Eggs, and Butter to use in the cake recipe to minimize the total cost while meeting these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n## The total weight of the cake should not exceed 2000 grams.\nmodel.addCons(Flour + Sugar + Eggs + Butter <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10\n\n## Generate Constraint-4:\nThe total weight of the cake should not exceed 2000 grams.\n// Flour + Sugar + Eggs + Butter <= 2000",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour. It must contain no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. The total weight of the cake should not exceed 2000 grams. Please help the bakery determine the optimal quantities of Flour, Sugar, Eggs, and Butter to use in the cake recipe.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n## The total weight of the cake should not exceed 2000 grams.\nmodel.addCons(Flour + Sugar + Eggs + Butter <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 638,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery wants to maximize the total daily revenue from selling these breads.\n// Objective Function: Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5, 0.7, 0.6, and 1 hour of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $1, $1.5, $2, and $3, respectively.\n// x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production.\n// x2 <= 0.3*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf and the labor and ingredient costs for each type of bread are given in the following Table.\n\n| Bread Type    | Selling Price | Labor Time per Loaf | Ingredient Cost per Loaf |\n|---------------|---------------|---------------------|--------------------------|\n| Whole Wheat   | $3            | 0.5 hours           | $1                      |\n| Rye           | $4            | 0.7 hours           | $1.5                    |\n| Sourdough     | $5            | 0.6 hours           | $2                      |\n| Brioche       | $6            | 1 hour              | $3                      |\n\nThe bakery has a total of 100 hours of labor available per day and a daily budget of $200 for ingredients. The bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement. The bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production. Please help the bakery to maximize the total daily revenue from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100)\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200)\n## The bakery must produce at least 50 loaves of Whole Wheat bread per day.\nmodel.addCons(x1 >= 50)\n## The bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production.\nmodel.addCons(x2 <= 0.3*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1328,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Brioche bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery wants to maximize the total daily revenue from selling these breads.\n// Objective Function: Maximize: 3*x1 + 4*x2 + 5*x3 + 6*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5, 0.7, 0.6, and 1 hour of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $200 for ingredients. The cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $1, $1.5, $2, and $3, respectively.\n// x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production.\n// x2 <= 0.3*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $3, $4, $5, and $6, respectively. The bakery has a total of 100 hours of labor available per day, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5, 0.7, 0.6, and 1 hour of labor, respectively. The bakery also has a daily budget of $200 for ingredients, with the cost of ingredients per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $1, $1.5, $2, and $3, respectively. The bakery must produce at least 50 loaves of Whole Wheat bread per day due to a contractual agreement. Additionally, the bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production. Please help the bakery to maximize the total daily revenue from selling these breads.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*x1 + 4*x2 + 5*x3 + 6*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 1*x4 <= 100)\n## The bakery has a daily budget of $200 for ingredients.\nmodel.addCons(x1 + 1.5*x2 + 2*x3 + 3*x4 <= 200)\n## The bakery must produce at least 50 loaves of Whole Wheat bread per day.\nmodel.addCons(x1 >= 50)\n## The bakery wants to ensure that the production of Rye bread does not exceed 30% of the total bread production.\nmodel.addCons(x2 <= 0.3*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of French Baguette\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\n// x1 >= 100\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production.\n// x3 <= 0.5*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type        | Profit per Loaf |\n|-------------------|-----------------|\n| Whole Wheat       | $1.50           |\n| Rye               | $1.75           |\n| Sourdough         | $2.00           |\n| French Baguette   | $2.25           |\n\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery also has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively. The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation. Additionally, the bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of French Baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100)\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\nmodel.addCons(x1 >= 100)\n## The bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production.\nmodel.addCons(x3 <= 0.5*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of French Baguette: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of French Baguette\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and French Baguette uses 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\n// x1 >= 100\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production.\n// x3 <= 0.5*(x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and French Baguette. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and French Baguette is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales. The bakery has a total of 100 hours of labor available per day, and each loaf of Whole Wheat, Rye, Sourdough, and French Baguette requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery also has a daily flour supply limit of 500 kg, with each loaf of Whole Wheat, Rye, Sourdough, and French Baguette using 0.5, 0.4, 0.6, and 0.3 kg of flour, respectively. The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation. Additionally, the bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of French Baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*x1 + 0.2*x2 + 0.3*x3 + 0.2*x4 <= 100)\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.3*x4 <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread per day to meet a contract obligation.\nmodel.addCons(x1 >= 100)\n## The bakery must ensure that the production of Sourdough bread does not exceed 50% of the total bread production.\nmodel.addCons(x3 <= 0.5*(x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of French Baguette: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit.\n// {\"number of Wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Whole Grain loaves\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Wheat, Rye, Sourdough, and Whole Grain requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\n// Wheat + Rye + Sourdough + Whole_Grain <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\n// Whole_Grain >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality.\n// Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit. The profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery has a total of 100 hours of labor available daily, with each loaf of Wheat, Rye, Sourdough, and Whole Grain requiring 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily. The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement. Additionally, the bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n\n| Bread Type       | Profit per Loaf | Labor per Loaf | Minimum Production |\n|------------------|-----------------|----------------|--------------------|\n| Wheat            | $1.50           | 0.1 hours      | None               |\n| Rye              | $2.00           | 0.2 hours      | None               |\n| Sourdough        | $2.50           | 0.3 hours      | 20% of total       |\n| Whole Grain      | $1.75           | 0.2 hours      | 50 loaves          |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of Whole Grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 500)\n## The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\nmodel.addCons(Whole_Grain >= 50)\n## The bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality.\nmodel.addCons(Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Whole Grain loaves: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1457,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The bakery needs to determine the number of loaves of each type of bread to produce daily to maximize profit.\n// {\"number of Wheat loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Whole Grain loaves\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each loaf of Wheat, Rye, Sourdough, and Whole Grain requires 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\n// Wheat + Rye + Sourdough + Whole_Grain <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\n// Whole_Grain >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality.\n// Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires a different amount of ingredients and labor. The profit per loaf for Wheat, Rye, Sourdough, and Whole Grain is $1.50, $2.00, $2.50, and $1.75, respectively. The bakery wants to maximize the total daily profit from bread sales. The bakery has a total of 100 hours of labor available daily, with each loaf of Wheat, Rye, Sourdough, and Whole Grain requiring 0.1, 0.2, 0.3, and 0.2 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily. The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement. Additionally, the bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality. Please help the bakery determine the number of loaves of each type of bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of Whole Grain loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 1.75*Whole_Grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough + 0.2*Whole_Grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 500 loaves daily.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 500)\n## The bakery must produce at least 50 loaves of Whole Grain bread daily to meet a contract requirement.\nmodel.addCons(Whole_Grain >= 50)\n## The bakery wants to ensure at least 20% of the total production is Sourdough bread to maintain its reputation for artisanal quality.\nmodel.addCons(Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Whole_Grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(Wheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Whole Grain loaves: \", model.getVal(Whole_Grain))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Ciabatta bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread.\n// x2 >= 0.5*x1",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $1.50           |\n| Rye              | $1.75           |\n| Sourdough        | $2.00           |\n| Ciabatta         | $2.25           |\n\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 1000 loaves per day. The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. Additionally, the bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # daily production quantity of Ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a daily limit of 500 kilograms of flour.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500)\n## The bakery can produce a maximum of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Ciabatta bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Ciabatta bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 1000 loaves per day.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\n// x1 >= 200\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread.\n// x2 >= 0.5*x1",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery has a daily limit of 500 kilograms of flour. Each loaf of Whole Wheat, Rye, Sourdough, and Ciabatta requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 1000 loaves per day. The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation. The bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0) # daily production quantity of Whole Wheat bread\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0) # daily production quantity of Rye bread\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0) # daily production quantity of Sourdough bread\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0) # daily production quantity of Ciabatta bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 1.75*x2 + 2.00*x3 + 2.25*x4)\n\n# Add constraints\n## The bakery has a daily limit of 500 kilograms of flour.\nmodel.addCons(0.5*x1 + 0.4*x2 + 0.6*x3 + 0.7*x4 <= 500)\n## The bakery can produce a maximum of 1000 loaves per day.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must produce at least 200 loaves of Whole Wheat bread daily to meet a contract obligation.\nmodel.addCons(x1 >= 200)\n## The bakery must ensure that the production of Rye bread is at least 50% of the total production of Whole Wheat bread.\nmodel.addCons(x2 >= 0.5*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(x2))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(x3))\n    print(\"Daily production quantity of Ciabatta bread: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints.\n// {\"number of Wheat bread produced daily\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced daily\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced daily\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 kg, 0.4 kg, and 0.6 kg of flour, respectively.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 5 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively.\n// 0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5\n\n## Generate Constraint-3:\nThe bakery has a daily baking time limit of 8 hours. Each loaf of Wheat, Rye, and Sourdough bread requires 10 minutes, 15 minutes, and 20 minutes of baking time, respectively.\n// (10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the daily production is Wheat bread.\n// Wheat >= 0.2 * (Wheat + Rye + Sourdough)",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Yeast Required (kg) | Baking Time (minutes) |\n|------------|-----------------|---------------------|---------------------|-----------------------|\n| Wheat      | $2              | 0.5                 | 0.02                | 10                    |\n| Rye        | $3              | 0.4                 | 0.03                | 15                    |\n| Sourdough  | $4              | 0.6                 | 0.04                | 20                    |\n\nThe bakery has a daily supply of 100 kg of flour and 5 kg of yeast. The bakery also has a daily baking time limit of 8 hours. Additionally, the bakery wants to ensure that at least 20% of the daily production is Wheat bread. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat bread produced daily\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye bread produced daily\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough bread produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100)\n## The bakery has a daily supply of 5 kg of yeast.\nmodel.addCons(0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5)\n## The bakery has a daily baking time limit of 8 hours.\nmodel.addCons((10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8)\n## The bakery wants to ensure that at least 20% of the daily production is Wheat bread.\nmodel.addCons(Wheat >= 0.2 * (Wheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat bread produced daily: \", model.getVal(Wheat))\n    print(\"Number of Rye bread produced daily: \", model.getVal(Rye))\n    print(\"Number of Sourdough bread produced daily: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The bakery needs to determine the number of each type of bread to produce daily to maximize profit while meeting ingredient and time constraints.\n// {\"number of Wheat bread produced daily\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye bread produced daily\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough bread produced daily\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 kg, 0.4 kg, and 0.6 kg of flour, respectively.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 5 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively.\n// 0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5\n\n## Generate Constraint-3:\nThe bakery has a daily baking time limit of 8 hours. Each loaf of Wheat, Rye, and Sourdough bread requires 10 minutes, 15 minutes, and 20 minutes of baking time, respectively.\n// (10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the daily production is Wheat bread.\n// Wheat >= 0.2 * (Wheat + Rye + Sourdough)",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. Each type of bread requires different amounts of flour, yeast, and time to bake. The profit per loaf of Wheat, Rye, and Sourdough bread is $2, $3, and $4, respectively. The bakery wants to maximize its daily profit. The bakery has a daily supply of 100 kg of flour and 5 kg of yeast. Each loaf of Wheat, Rye, and Sourdough bread requires 0.5 kg, 0.4 kg, and 0.6 kg of flour, and 0.02 kg, 0.03 kg, and 0.04 kg of yeast, respectively. The bakery also has a daily baking time limit of 8 hours, with each loaf of Wheat, Rye, and Sourdough bread requiring 10 minutes, 15 minutes, and 20 minutes of baking time, respectively. Additionally, the bakery wants to ensure that at least 20% of the daily production is Wheat bread. Please help the bakery determine the number of each type of bread to produce daily to maximize profit while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of Wheat bread produced daily\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye bread produced daily\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough bread produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 100)\n## The bakery has a daily supply of 5 kg of yeast.\nmodel.addCons(0.02*Wheat + 0.03*Rye + 0.04*Sourdough <= 5)\n## The bakery has a daily baking time limit of 8 hours.\nmodel.addCons((10/60)*Wheat + (15/60)*Rye + (20/60)*Sourdough <= 8)\n## The bakery wants to ensure that at least 20% of the daily production is Wheat bread.\nmodel.addCons(Wheat >= 0.2 * (Wheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat bread produced daily: \", model.getVal(Wheat))\n    print(\"Number of Rye bread produced daily: \", model.getVal(Rye))\n    print(\"Number of Sourdough bread produced daily: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production capacity limit\": \"Capacity\", \"range\": \"Capacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 500 units per day.\n// A + B + C <= Capacity\n// Capacity = 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units.\n// B >= 50\n// B <= 200\n\n## Generate Constraint-4:\nThe production of product C must not exceed 150 units per day.\n// C <= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe total production capacity of the factory is limited to 500 units per day. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units. The production of product C must not exceed 150 units per day.\n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nCapacity = 500 # production capacity limit\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 500 units per day.\nmodel.addCons(A + B + C <= Capacity)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n## The production of product C must not exceed 150 units per day.\nmodel.addCons(C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production capacity limit\": \"Capacity\", \"range\": \"Capacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 500 units per day.\n// A + B + C <= Capacity\n// Capacity = 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units.\n// B >= 50\n// B <= 200\n\n## Generate Constraint-4:\nThe production of product C must not exceed 150 units per day.\n// C <= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total production capacity of the factory is limited to 500 units per day. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units. The production of product C must not exceed 150 units per day. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nCapacity = 500 # production capacity limit\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 500 units per day.\nmodel.addCons(A + B + C <= Capacity)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n## The production of product C must not exceed 150 units per day.\nmodel.addCons(C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200\n\n## Generate Constraint-4:\nEach center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\n// A_C1 >= 30\n// B_C1 >= 40\n// C_C1 >= 50",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3. The cost of delivering one unit of each product to each center is given in the following Table.\n\n| Product | Center 1 Cost | Center 2 Cost | Center 3 Cost |\n|---------|---------------|---------------|---------------|\n| A       | 5$            | 6$            | 7$            |\n| B       | 8$            | 9$            | 10$           |\n| C       | 11$           | 12$           | 13$           |\n\nThe company aims to minimize the total delivery cost while meeting the demand at each center. The total number of units of product A that can be delivered is limited to 100 units, the total number of units of product B is limited to 150 units, and the total number of units of product C is limited to 200 units. Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\n\nPlease help the company determine the optimal number of units of each product to deliver to each center to minimize the total delivery cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n## Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\nmodel.addCons(A_C1 >= 30)\nmodel.addCons(B_C1 >= 40)\nmodel.addCons(C_C1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 9,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200\n\n## Generate Constraint-4:\nEach center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\n// A_C1 >= 30\n// B_C1 >= 40\n// C_C1 >= 50",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3. The cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center. The total number of units of product A that can be delivered is limited to 100 units. The total number of units of product B that can be delivered is limited to 150 units. The total number of units of product C that can be delivered is limited to 200 units. Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C. Please help the company to minimize the total delivery cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n## Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\nmodel.addCons(A_C1 >= 30)\nmodel.addCons(B_C1 >= 40)\nmodel.addCons(C_C1 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 9,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of total devices produced\": \"Total_Devices\", \"range\": \"Total_Devices >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 100*Smartphones + 200*Tablets + 300*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 devices per week.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\n// Smartphones >= 150\n// Tablets >= 100\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\n// Smartphones + Tablets + Laptops <= 2 * Laptops\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units.\n// Tablets <= Smartphones + Laptops + 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs. The cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand.\n\n| Device       | Production Cost |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $200            |\n| Laptops      | $300            |\n\nThe production capacity of the factory is limited to 500 devices per week. The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week. The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops. Additionally, the company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units.\n\nPlease help the company determine the optimal number of smartphones, tablets, and laptops to produce each week to minimize the total production cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\nTotal_Devices = model.addVar(vtype=\"INTEGER\", name=\"Total_Devices\", lb=0) # total number of devices produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Smartphones + 200*Tablets + 300*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 devices per week.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\nmodel.addCons(Smartphones >= 150)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 50)\n## The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\nmodel.addCons(Smartphones + Tablets + Laptops <= 2 * Laptops)\n## The company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units.\nmodel.addCons(Tablets <= Smartphones + Laptops + 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of total devices produced\": \"Total_Devices\", \"range\": \"Total_Devices >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 100*Smartphones + 200*Tablets + 300*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 500 devices per week.\n// Smartphones + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\n// Smartphones >= 150\n// Tablets >= 100\n// Laptops >= 50\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\n// Smartphones + Tablets + Laptops <= 2 * Laptops\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units.\n// Tablets <= Smartphones + Laptops + 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to meet market demand while optimizing production costs. The cost of producing each smartphone is $100, each tablet is $200, and each laptop is $300. The company aims to minimize the total production cost while meeting the market demand. The production capacity of the factory is limited to 500 devices per week. The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week. The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops. Additionally, the company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units. Please help the company determine the optimal number of smartphones, tablets, and laptops to produce each week.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\nTotal_Devices = model.addVar(vtype=\"INTEGER\", name=\"Total_Devices\", lb=0) # total number of devices produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100*Smartphones + 200*Tablets + 300*Laptops)\n\n# Add constraints\n## The production capacity of the factory is limited to 500 devices per week.\nmodel.addCons(Smartphones + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 150 units per week, for tablets is at least 100 units per week, and for laptops is at least 50 units per week.\nmodel.addCons(Smartphones >= 150)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 50)\n## The company has a policy to ensure that the total number of devices produced does not exceed twice the demand for laptops.\nmodel.addCons(Smartphones + Tablets + Laptops <= 2 * Laptops)\n## The company wants to ensure that the production of tablets does not exceed the combined production of smartphones and laptops by more than 50 units.\nmodel.addCons(Tablets <= Smartphones + Laptops + 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $20. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 20*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\n// 2*A + 3*B + 1*C <= 150\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of products A and B should not exceed 50 units combined.\n// A + B <= 50\n\n## Generate Constraint-4:\nThe production of product C should not exceed twice the combined production of products A and B.\n// C <= 2*(A + B)",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of product A is $50, product B is $30, and product C is $20. The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150. The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day. The total production of products A and B should not exceed 50 units combined. The production of product C should not exceed twice the combined production of products A and B.\n\nPlease help the company to maximize the total daily profit from the production of these products.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 2                    |\n| B       | $30             | 3                    |\n| C       | $20             | 1                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 20*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\nmodel.addCons(2*A + 3*B + 1*C <= 150)\n## The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of products A and B should not exceed 50 units combined.\nmodel.addCons(A + B <= 50)\n## The production of product C should not exceed twice the combined production of products A and B.\nmodel.addCons(C <= 2*(A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $20. The objective is to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 20*C\n\n## Generate Constraint-1:\nThe production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\n// 2*A + 3*B + 1*C <= 150\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\n// A >= 20\n// B >= 30\n\n## Generate Constraint-3:\nThe total production of products A and B should not exceed 50 units combined.\n// A + B <= 50\n\n## Generate Constraint-4:\nThe production of product C should not exceed twice the combined production of products A and B.\n// C <= 2*(A + B)",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\nThe profit per unit of product A is $50, product B is $30, and product C is $20. The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150. The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day. The total production of products A and B should not exceed 50 units combined. The production of product C should not exceed twice the combined production of products A and B.\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 20*C)\n\n# Add constraints\n## The production of each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 1 hour. The total available labor hours per day are 150.\nmodel.addCons(2*A + 3*B + 1*C <= 150)\n## The market demand for product A is at least 20 units per day, and for product B, it is at least 30 units per day.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n## The total production of products A and B should not exceed 50 units combined.\nmodel.addCons(A + B <= 50)\n## The production of product C should not exceed twice the combined production of products A and B.\nmodel.addCons(C <= 2*(A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The objective is to maximize the total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours.\n// 2*Smartphones + 3*Tablets + 4*Laptops <= 800\n\n## Generate Constraint-2:\nThe raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe company has a policy to produce at least 50 units of each device type per day to maintain market presence.\n// Smartphones >= 50\n// Tablets >= 50\n// Laptops >= 50\n\n## Generate Constraint-4:\nThe total production should not exceed the company's daily capacity of 300 units.\n// Smartphones + Tablets + Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials. The profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The following table summarizes the labor hours required for each device:\n\n| Device       | Labor Hours Required |\n|--------------|----------------------|\n| Smartphones  | 2 hours              |\n| Tablets      | 3 hours              |\n| Laptops      | 4 hours              |\n\nThe total labor hours available per day are 800 hours. The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day. The company has a policy to produce at least 50 units of each device type per day to maintain market presence. The total production should not exceed the company's daily capacity of 300 units.\n\nPlease help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops <= 800)\n## The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The company has a policy to produce at least 50 units of each device type per day to maintain market presence.\nmodel.addCons(Smartphones >= 50)\nmodel.addCons(Tablets >= 50)\nmodel.addCons(Laptops >= 50)\n## The total production should not exceed the company's daily capacity of 300 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The objective is to maximize the total profit from the sales of these devices.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours.\n// 2*Smartphones + 3*Tablets + 4*Laptops <= 800\n\n## Generate Constraint-2:\nThe raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe company has a policy to produce at least 50 units of each device type per day to maintain market presence.\n// Smartphones >= 50\n// Tablets >= 50\n// Laptops >= 50\n\n## Generate Constraint-4:\nThe total production should not exceed the company's daily capacity of 300 units.\n// Smartphones + Tablets + Laptops <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal production quantity for each device to maximize profit while considering the available resources such as labor hours and raw materials. The profit from selling each smartphone is $100, each tablet is $150, and each laptop is $200. The total labor hours available per day are 800 hours. Producing one smartphone requires 2 hours, one tablet requires 3 hours, and one laptop requires 4 hours. The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day. The company has a policy to produce at least 50 units of each device type per day to maintain market presence. The total production should not exceed the company's daily capacity of 300 units. Please help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The total labor hours available per day are 800 hours.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops <= 800)\n## The raw material stock allows for the production of at most 200 smartphones, 150 tablets, and 100 laptops per day.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The company has a policy to produce at least 50 units of each device type per day to maintain market presence.\nmodel.addCons(Smartphones >= 50)\nmodel.addCons(Tablets >= 50)\nmodel.addCons(Laptops >= 50)\n## The total production should not exceed the company's daily capacity of 300 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops produced: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours worked\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n// Production_Cost = wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours\n// Objective Function: Minimize: Production_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n// sourdough_loaves >= 20\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 100 loaves of bread per day without overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nIf the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\n// (wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours\n// extra_hours <= 2\n\n## Generate Constraint-4:\nThe total number of loaves produced must not exceed 200, considering overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves + 50*extra_hours <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery. The cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1            |\n| Rye           | $2            |\n| Sourdough     | $3            |\n\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread. The bakery can produce a maximum of 100 loaves of bread per day without overtime. If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour. The total number of loaves produced must not exceed 200, considering overtime.\n\nPlease help the bakery to determine the optimal number of wheat, rye, and sourdough bread loaves to produce daily, along with the number of extra hours worked, to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of extra hours worked\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"INTEGER\", name=\"extra_hours\", lb=0) # number of extra hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\nmodel.addCons(sourdough_loaves >= 20)\n## The bakery can produce a maximum of 100 loaves of bread per day without overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours)\nmodel.addCons(extra_hours <= 2)\n## The total number of loaves produced must not exceed 200, considering overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves + 50*extra_hours <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours worked: \", model.getVal(extra_hours))\n    print(\"Minimized Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra hours worked\": \"extra_hours\", \"range\": \"extra_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production.\n// Production_Cost = wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours\n// Objective Function: Minimize: Production_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\n// wheat_loaves >= 50\n// rye_loaves >= 30\n// sourdough_loaves >= 20\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 100 loaves of bread per day without overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nIf the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\n// (wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours\n// extra_hours <= 2\n\n## Generate Constraint-4:\nThe total number of loaves produced must not exceed 200, considering overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves + 50*extra_hours <= 200",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, the demand for each type of bread, and the production capacity of the bakery. The cost of producing each loaf of wheat, rye, and sourdough bread is $1, $2, and $3, respectively. The bakery incurs an additional cost of $10 per hour for any extra hours worked beyond the standard 8-hour day. The bakery aims to minimize the total cost of production. The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread. The bakery can produce a maximum of 100 loaves of bread per day without overtime. If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour. The total number of loaves produced must not exceed 200, considering overtime. Please help the bakery to minimize the total cost of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of extra hours worked\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_hours = model.addVar(vtype=\"INTEGER\", name=\"extra_hours\", lb=0) # number of extra hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == wheat_loaves + 2*rye_loaves + 3*sourdough_loaves + 10*extra_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 50 loaves of wheat bread, 30 loaves of rye bread, and 20 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 50)\nmodel.addCons(rye_loaves >= 30)\nmodel.addCons(sourdough_loaves >= 20)\n## The bakery can produce a maximum of 100 loaves of bread per day without overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## If the bakery exceeds the 100 loaves limit, it can work up to 2 extra hours, producing an additional 50 loaves per hour.\nmodel.addCons((wheat_loaves + rye_loaves + sourdough_loaves) - 100 <= 50*extra_hours)\nmodel.addCons(extra_hours <= 2)\n## The total number of loaves produced must not exceed 200, considering overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves + 50*extra_hours <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra hours worked: \", model.getVal(extra_hours))\n    print(\"Minimized Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200\n\n## Generate Constraint-4:\nThe bakery can hire up to 50 additional staff hours per day.\n// staff_hours <= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) |\n|------------|-----------------|------------------------|\n| Wheat      | $3              | 0.5                    |\n| Rye        | $4              | 0.7                    |\n| Sourdough  | $5              | 0.6                    |\n\nThe bakery has a daily limit of 500kg of flour. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. The bakery can hire up to 50 additional staff hours per day. Please help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n## The bakery can hire up to 50 additional staff hours per day\nmodel.addCons(staff_hours <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200\n\n## Generate Constraint-4:\nThe bakery can hire up to 50 additional staff hours per day.\n// staff_hours <= 50",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. The bakery can hire up to 50 additional staff hours per day. Please help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n## The bakery can hire up to 50 additional staff hours per day\nmodel.addCons(staff_hours <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\n// A_sold >= 200\n// B_sold >= 300\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C\n\n## Generate Constraint-4:\nThe total number of units sold daily cannot exceed 800 units due to market saturation.\n// A_sold + B_sold + C_sold <= 800",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the constraints:\n\n| Constraint | Description |\n|------------|-------------|\n| Production Capacity | The total number of units that can be produced daily is limited to 1000 units. |\n| Market Demand for A | At least 200 units of product A must be sold daily. |\n| Market Demand for B | At least 300 units of product B must be sold daily. |\n| Production and Sales | The company can only sell as many units as it produces for each product. |\n| Market Saturation | The total number of units sold daily cannot exceed 800 units. |\n\nPlease help the company to maximize the total daily profit from selling these products, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\nmodel.addCons(A_sold >= 200)\nmodel.addCons(B_sold >= 300)\n## The company can only sell as many units as it produces.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n## The total number of units sold daily cannot exceed 800 units due to market saturation.\nmodel.addCons(A_sold + B_sold + C_sold <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\n// A_sold >= 200\n// B_sold >= 300\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C\n\n## Generate Constraint-4:\nThe total number of units sold daily cannot exceed 800 units due to market saturation.\n// A_sold + B_sold + C_sold <= 800",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory limits the total number of units that can be produced daily to 1000 units. The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily. The company can only sell as many units as it produces. The total number of units sold daily cannot exceed 800 units due to market saturation.\nPlease help the company determine the optimal number of units of products A, B, and C to produce and sell daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units that can be produced daily to 1000 units.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units daily, and for product B, it is at least 300 units daily.\nmodel.addCons(A_sold >= 200)\nmodel.addCons(B_sold >= 300)\n## The company can only sell as many units as it produces.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n## The total number of units sold daily cannot exceed 800 units due to market saturation.\nmodel.addCons(A_sold + B_sold + C_sold <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in units\": \"capacity\", \"range\": \"capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize its daily profit from the production and sale of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe total daily production cannot exceed the production capacity of 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units per day.\n// B >= 50\n// B <= 200\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product C as product B.\n// C >= 2*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $30             |\n| C       | $40             |\n\nThe company has a daily production capacity of 500 units. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units per day. The company has a policy to produce at least twice as many units of product C as product B.\n\nPlease help the company to maximize its daily profit from the production and sale of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The total daily production cannot exceed the production capacity of 500 units.\nmodel.addCons(A + B + C <= 500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units per day.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n## The company has a policy to produce at least twice as many units of product C as product B.\nmodel.addCons(C >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in units\": \"capacity\", \"range\": \"capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize its daily profit from the production and sale of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe total daily production cannot exceed the production capacity of 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 50 units per day, but not more than 200 units per day.\n// B >= 50\n// B <= 200\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product C as product B.\n// C >= 2*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production capacity and market demand constraints. The profit per unit of product A is $50, product B is $30, and product C is $40. The total daily production cannot exceed the production capacity of 500 units. The market demand for product A is at least 100 units per day. The market demand for product B is at least 50 units per day, but not more than 200 units per day. The company has a policy to produce at least twice as many units of product C as product B. Please help the company to maximize its daily profit from the production and sale of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The total daily production cannot exceed the production capacity of 500 units.\nmodel.addCons(A + B + C <= 500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at least 50 units per day, but not more than 200 units per day.\nmodel.addCons(B >= 50)\nmodel.addCons(B <= 200)\n## The company has a policy to produce at least twice as many units of product C as product B.\nmodel.addCons(C >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 740,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1\n\n## Generate Constraint-4:\nThe market demand for product B is at least 2 units per day.\n// B >= 2",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. The following table shows the labor and raw material requirements for each product:\n\n| Product | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|----------------------|-----------------------------|\n| A       | 2                    | 5                           |\n| B       | 1                    | 3                           |\n| C       | 3                    | 4                           |\n\nThe company has 8 hours of labor available per day and 100 units of raw material available per day. The market demand for product A is at least 1 unit per day, and for product B is at least 2 units per day. \n\nPlease help the company to maximize the total daily profit from the production of these products, subject to the constraints of labor and raw material availability and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n## The market demand for product B is at least 2 units per day.\nmodel.addCons(B >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1\n\n## Generate Constraint-4:\nThe market demand for product B is at least 2 units per day.\n// B >= 2",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours. Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units. The market demand for product A is at least 1 unit per day, and the market demand for product B is at least 2 units per day. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n## The market demand for product B is at least 2 units per day.\nmodel.addCons(B >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type varies, and there are constraints on the raw materials and labor hours available.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer aims to maximize the total weekly profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity for all products is 500 units per week.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\n// 2*A + 3*B + 4*C <= 1200\n\n## Generate Constraint-3:\nThe labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\n// A + 2*B + 3*C <= 600\n\n## Generate Constraint-4:\nThe market demand for Product A is at least 100 units per week.\n// A >= 100",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer aims to maximize the total weekly profit from the production of these products.\n\nThe production capacity for all products is 500 units per week. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units, with a total of 1200 units of raw material available per week. The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours, with a total of 600 labor hours available per week. The market demand for Product A is at least 100 units per week.\n\nPlease help the manufacturer determine the optimal number of units of each product to produce weekly to maximize profit, considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity for all products is 500 units per week.\nmodel.addCons(A + B + C <= 500)\n## The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1200)\n## The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\nmodel.addCons(A + 2*B + 3*C <= 600)\n## The market demand for Product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type varies, and there are constraints on the raw materials and labor hours available.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer aims to maximize the total weekly profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity for all products is 500 units per week.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\n// 2*A + 3*B + 4*C <= 1200\n\n## Generate Constraint-3:\nThe labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\n// A + 2*B + 3*C <= 600\n\n## Generate Constraint-4:\nThe market demand for Product A is at least 100 units per week.\n// A >= 100",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The total production capacity for all products is 500 units per week. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units, with a total available raw material per week of 1200 units. The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours, with a total available labor hours per week of 600 hours. The market demand for Product A is at least 100 units per week. Please help the manufacturer to maximize the total weekly profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity for all products is 500 units per week.\nmodel.addCons(A + B + C <= 500)\n## The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total available raw material per week is 1200 units.\nmodel.addCons(2*A + 3*B + 4*C <= 1200)\n## The labor hours required to produce one unit of Product A is 1 hour, for Product B is 2 hours, and for Product C is 3 hours. The total available labor hours per week is 600 hours.\nmodel.addCons(A + 2*B + 3*C <= 600)\n## The market demand for Product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime_hours <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the minimum demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 100, 80, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-4:\nThe bakery's regular working hours can produce up to 300 loaves. Any additional loaves require overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves - 300 <= overtime_hours",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n\n| Type of Bread | Profit per Loaf | Minimum Demand |\n|---------------|-----------------|----------------|\n| Wheat         | $3              | 100 loaves     |\n| Rye           | $4              | 80 loaves      |\n| Sourdough     | $5              | 50 loaves      |\n\nThe bakery has a daily production capacity of 500 loaves. The bakery can work up to 10 overtime hours per day. The bakery's regular working hours can produce up to 300 loaves. Any additional loaves require overtime.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of loaves of each type of bread to produce and the necessary overtime hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime_hours <= 10)\n## The bakery must meet the minimum demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery's regular working hours can produce up to 300 loaves. Any additional loaves require overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves - 300 <= overtime_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime_hours <= 10\n\n## Generate Constraint-3:\nThe bakery must meet the minimum demand for each type of bread. The minimum demand for wheat, rye, and sourdough bread is 100, 80, and 50 loaves, respectively.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-4:\nThe bakery's regular working hours can produce up to 300 loaves. Any additional loaves require overtime.\n// wheat_loaves + rye_loaves + sourdough_loaves - 300 <= overtime_hours",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily while considering the production capacity and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery incurs a cost of $20 per hour for overtime. The bakery should maximize the total profit from selling bread minus the overtime cost.\nThe bakery has a daily production capacity of 500 loaves. The bakery can work up to 10 overtime hours per day. The bakery must meet the minimum demand for each type of bread, with a minimum demand for wheat, rye, and sourdough bread being 100, 80, and 50 loaves, respectively. The bakery's regular working hours can produce up to 300 loaves, and any additional loaves require overtime.\nPlease help the bakery to maximize its daily profit by determining the optimal number of loaves of each type of bread to produce and the necessary overtime hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves - 20*overtime_hours)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime_hours <= 10)\n## The bakery must meet the minimum demand for each type of bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery's regular working hours can produce up to 300 loaves. Any additional loaves require overtime.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves - 300 <= overtime_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"Labor_Hours\", \"range\": \"Labor_Hours = 100\", \"type\": \"integer\"}\n// {\"number of machine hours available daily\": \"Machine_Hours\", \"range\": \"Machine_Hours = 80\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used cannot exceed the available labor hours.\n// 2*A + 3*B + 4*C <= Labor_Hours\n\n## Generate Constraint-2:\nEach unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours. The total machine hours used cannot exceed the available machine hours.\n// A + 2*B + 3*C <= Machine_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\n// A >= 10\n// B >= 5\n\n## Generate Constraint-4:\nThe total production of all products should not exceed 30 units per day to maintain quality control.\n// A + B + C <= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the labor and machine hours required for each product:\n\n| Product | Labor Hours per Unit | Machine Hours per Unit |\n|---------|----------------------|------------------------|\n| A       | 2                    | 1                      |\n| B       | 3                    | 2                      |\n| C       | 4                    | 3                      |\n\nThe company has 100 hours of labor and 80 machine hours available daily. The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day. The total production of all products should not exceed 30 units per day to maintain quality control. \n\nPlease help the company to maximize the total daily profit from the production of these products, ensuring that the total labor and machine hours used do not exceed the available hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n## The number of hours of labor and machine hours available daily\nLabor_Hours = 100\nMachine_Hours = 80\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= Labor_Hours)\n## Each unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours.\nmodel.addCons(A + 2*B + 3*C <= Machine_Hours)\n## The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n## The total production of all products should not exceed 30 units per day to maintain quality control.\nmodel.addCons(A + B + C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"Labor_Hours\", \"range\": \"Labor_Hours = 100\", \"type\": \"integer\"}\n// {\"number of machine hours available daily\": \"Machine_Hours\", \"range\": \"Machine_Hours = 80\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used cannot exceed the available labor hours.\n// 2*A + 3*B + 4*C <= Labor_Hours\n\n## Generate Constraint-2:\nEach unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours. The total machine hours used cannot exceed the available machine hours.\n// A + 2*B + 3*C <= Machine_Hours\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\n// A >= 10\n// B >= 5\n\n## Generate Constraint-4:\nThe total production of all products should not exceed 30 units per day to maintain quality control.\n// A + B + C <= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used cannot exceed 100 hours. Each unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours. The total machine hours used cannot exceed 80 hours. The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day. The total production of all products should not exceed 30 units per day to maintain quality control. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n## The number of hours of labor and machine hours available daily\nLabor_Hours = 100\nMachine_Hours = 80\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= Labor_Hours)\n## Each unit of product A requires 1 machine hour, product B requires 2 machine hours, and product C requires 3 machine hours.\nmodel.addCons(A + 2*B + 3*C <= Machine_Hours)\n## The market demand for product A is at least 10 units per day, and the demand for product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n## The total production of all products should not exceed 30 units per day to maintain quality control.\nmodel.addCons(A + B + C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A\n\n## Generate Constraint-4:\nThe production of product C should not exceed the production of product B by more than 5 units.\n// C - B <= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours per Unit |\n|---------|----------------------|\n| A       | 2                    |\n| B       | 3                    |\n| C       | 4                    |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day. The combined production of products B and C should not exceed twice the production of product A. The production of product C should not exceed the production of product B by more than 5 units.\n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n## The production of product C should not exceed the production of product B by more than 5 units.\nmodel.addCons(C - B <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe combined production of products B and C should not exceed twice the production of product A.\n// B + C <= 2*A\n\n## Generate Constraint-4:\nThe production of product C should not exceed the production of product B by more than 5 units.\n// C - B <= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production should not exceed 100 hours daily. The market demand for product A is at least 10 units per day. The combined production of products B and C should not exceed twice the production of product A. The production of product C should not exceed the production of product B by more than 5 units. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The combined production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n## The production of product C should not exceed the production of product B by more than 5 units.\nmodel.addCons(C - B <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily.\n// A <= 100\n// B <= 120\n// C <= 80\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively.\n// SA <= 80\n// SB <= 100\n// SC <= 70\n\n## Generate Constraint-3:\nThe company must ensure that the number of units sold does not exceed the number of units produced for each product.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe company has a policy to produce at least 20 units of product A and 30 units of product B daily to maintain market presence.\n// A >= 20\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the production and market constraints:\n\n| Product | Production Capacity | Market Demand |\n|---------|---------------------|---------------|\n| A       | 100 units           | 80 units      |\n| B       | 120 units           | 100 units     |\n| C       | 80 units            | 70 units      |\n\nThe company has a policy to produce at least 20 units of product A and 30 units of product B daily to maintain market presence. The company must ensure that the number of units sold does not exceed the number of units produced for each product. \n\nPlease help the company to maximize the total daily profit from selling these products, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\nmodel.addCons(C <= 80)\n## The market demand for products\nmodel.addCons(SA <= 80)\nmodel.addCons(SB <= 100)\nmodel.addCons(SC <= 70)\n## The number of units sold does not exceed the number of units produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The company's policy to maintain market presence\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily.\n// A <= 100\n// B <= 120\n// C <= 80\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively.\n// SA <= 80\n// SB <= 100\n// SC <= 70\n\n## Generate Constraint-3:\nThe company must ensure that the number of units sold does not exceed the number of units produced for each product.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe company has a policy to produce at least 20 units of product A and 30 units of product B daily to maintain market presence.\n// A >= 20\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\nThe production capacity of the factory allows for a maximum of 100 units of product A, 120 units of product B, and 80 units of product C to be produced daily. The market demand for products A, B, and C is limited to 80 units, 100 units, and 70 units daily, respectively. The company must ensure that the number of units sold does not exceed the number of units produced for each product. The company has a policy to produce at least 20 units of product A and 30 units of product B daily to maintain market presence.\nPlease help the company to determine the optimal daily production and sales quantities for products A, B, and C to maximize their total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\nmodel.addCons(C <= 80)\n## The market demand for products\nmodel.addCons(SA <= 80)\nmodel.addCons(SB <= 100)\nmodel.addCons(SC <= 70)\n## The number of units sold does not exceed the number of units produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The company's policy to maintain market presence\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra staff hours\": \"extra_staff_hours\", \"range\": \"extra_staff_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n// Objective Function: Minimize: 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 50\n// sourdough_loaves >= 30\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\n// If (wheat_loaves + rye_loaves + sourdough_loaves) > 150, then extra_staff_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50\n// Otherwise, extra_staff_hours = 0\n\n## Generate Constraint-4:\nThe bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\n// 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours >= 80",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | 1$            |\n| Rye           | 1.50$         |\n| Sourdough     | 2$            |\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches. The bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\n\nPlease help the bakery to determine the optimal number of wheat, rye, and sourdough bread loaves to produce, along with the necessary extra staff hours, to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_staff_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_staff_hours\", lb=0) # number of extra staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 50)\nmodel.addCons(sourdough_loaves >= 30)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once.\nmodel.addCons(extra_staff_hours >= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\nmodel.addCons(extra_staff_hours <= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\n## The bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\nmodel.addCons(1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra staff hours: \", model.getVal(extra_staff_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra staff hours\": \"extra_staff_hours\", \"range\": \"extra_staff_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n// Objective Function: Minimize: 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 50\n// sourdough_loaves >= 30\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches.\n// If (wheat_loaves + rye_loaves + sourdough_loaves) > 150, then extra_staff_hours = (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50\n// Otherwise, extra_staff_hours = 0\n\n## Generate Constraint-4:\nThe bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\n// 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours >= 80",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat bread is $1, rye bread is $1.50, and sourdough bread is $2. The bakery incurs an additional labor cost of $10 per hour for any extra staff hours needed beyond the standard 8-hour day. The bakery aims to minimize the total cost of production and labor.\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once. If the total number of loaves exceeds this, extra staff hours are required to manage multiple batches. The bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\n\nPlease help the bakery to minimize the total cost of production and labor, considering all these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\nextra_staff_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"extra_staff_hours\", lb=0) # number of extra staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 50 loaves of rye bread, and 30 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 50)\nmodel.addCons(sourdough_loaves >= 30)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's oven capacity allows for a maximum of 150 loaves of bread to be baked at once.\nmodel.addCons(extra_staff_hours >= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\nmodel.addCons(extra_staff_hours <= (wheat_loaves + rye_loaves + sourdough_loaves - 150) / 50)\n## The bakery has a fixed labor cost of $80 per day, regardless of the number of loaves produced.\nmodel.addCons(1*wheat_loaves + 1.5*rye_loaves + 2*sourdough_loaves + 10*extra_staff_hours >= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra staff hours: \", model.getVal(extra_staff_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs.\n// {\"daily production of wheat bread\": \"wheat_prod\", \"range\": \"wheat_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"rye_prod\", \"range\": \"rye_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"sourdough_prod\", \"range\": \"sourdough_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of all bread types\": \"total_prod\", \"range\": \"total_prod = wheat_prod + rye_prod + sourdough_prod\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery aims to minimize the total production cost while meeting the daily demand for each type of bread.\n// Objective Function: Minimize: 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod\n\n## Generate Constraint-1:\nThe bakery has a daily demand for wheat bread of at least 100 loaves.\n// wheat_prod >= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for rye bread of at least 80 loaves.\n// rye_prod >= 80\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread of at least 50 loaves.\n// sourdough_prod >= 50\n\n## Generate Constraint-4:\nThe bakery has a maximum daily production capacity of 300 loaves.\n// total_prod <= 300",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs. The cost of producing each type of bread is given in the following Table.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $0.5          |\n| Rye           | $0.7          |\n| Sourdough     | $1.0          |\n\nThe bakery has a daily demand for wheat bread of at least 100 loaves, for rye bread of at least 80 loaves, and for sourdough bread of at least 50 loaves. The bakery has a maximum daily production capacity of 300 loaves. \n\nPlease help the bakery to minimize the total production cost while meeting the daily demand for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nwheat_prod = model.addVar(vtype=\"INTEGER\", name=\"wheat_prod\", lb=0) # daily production of wheat bread\nrye_prod = model.addVar(vtype=\"INTEGER\", name=\"rye_prod\", lb=0) # daily production of rye bread\nsourdough_prod = model.addVar(vtype=\"INTEGER\", name=\"sourdough_prod\", lb=0) # daily production of sourdough bread\ntotal_prod = model.addVar(vtype=\"INTEGER\", name=\"total_prod\", lb=0) # daily production of all bread types\nmodel.addCons(total_prod == wheat_prod + rye_prod + sourdough_prod)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod)\n\n# Add constraints\n## The bakery has a daily demand for wheat bread of at least 100 loaves.\nmodel.addCons(wheat_prod >= 100)\n## The bakery has a daily demand for rye bread of at least 80 loaves.\nmodel.addCons(rye_prod >= 80)\n## The bakery has a daily demand for sourdough bread of at least 50 loaves.\nmodel.addCons(sourdough_prod >= 50)\n## The bakery has a maximum daily production capacity of 300 loaves.\nmodel.addCons(total_prod <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(wheat_prod))\n    print(\"Daily production of rye bread: \", model.getVal(rye_prod))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_prod))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs.\n// {\"daily production of wheat bread\": \"wheat_prod\", \"range\": \"wheat_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"rye_prod\", \"range\": \"rye_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"sourdough_prod\", \"range\": \"sourdough_prod >= 0\", \"type\": \"integer\"}\n// {\"daily production of all bread types\": \"total_prod\", \"range\": \"total_prod = wheat_prod + rye_prod + sourdough_prod\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery aims to minimize the total production cost while meeting the daily demand for each type of bread.\n// Objective Function: Minimize: 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod\n\n## Generate Constraint-1:\nThe bakery has a daily demand for wheat bread of at least 100 loaves.\n// wheat_prod >= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for rye bread of at least 80 loaves.\n// rye_prod >= 80\n\n## Generate Constraint-3:\nThe bakery has a daily demand for sourdough bread of at least 50 loaves.\n// sourdough_prod >= 50\n\n## Generate Constraint-4:\nThe bakery has a maximum daily production capacity of 300 loaves.\n// total_prod <= 300",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to meet customer demand while minimizing costs. The cost of producing wheat bread is $0.5 per loaf, rye bread is $0.7 per loaf, and sourdough bread is $1.0 per loaf. The bakery has a daily demand for wheat bread of at least 100 loaves, a daily demand for rye bread of at least 80 loaves, and a daily demand for sourdough bread of at least 50 loaves. The bakery has a maximum daily production capacity of 300 loaves. Please help the bakery to minimize the total production cost while meeting the daily demand for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nwheat_prod = model.addVar(vtype=\"INTEGER\", name=\"wheat_prod\", lb=0) # daily production of wheat bread\nrye_prod = model.addVar(vtype=\"INTEGER\", name=\"rye_prod\", lb=0) # daily production of rye bread\nsourdough_prod = model.addVar(vtype=\"INTEGER\", name=\"sourdough_prod\", lb=0) # daily production of sourdough bread\ntotal_prod = model.addVar(vtype=\"INTEGER\", name=\"total_prod\", lb=0) # daily production of all bread types\nmodel.addCons(total_prod == wheat_prod + rye_prod + sourdough_prod)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.5*wheat_prod + 0.7*rye_prod + 1.0*sourdough_prod)\n\n# Add constraints\n## The bakery has a daily demand for wheat bread of at least 100 loaves.\nmodel.addCons(wheat_prod >= 100)\n## The bakery has a daily demand for rye bread of at least 80 loaves.\nmodel.addCons(rye_prod >= 80)\n## The bakery has a daily demand for sourdough bread of at least 50 loaves.\nmodel.addCons(sourdough_prod >= 50)\n## The bakery has a maximum daily production capacity of 300 loaves.\nmodel.addCons(total_prod <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(wheat_prod))\n    print(\"Daily production of rye bread: \", model.getVal(rye_prod))\n    print(\"Daily production of sourdough bread: \", model.getVal(sourdough_prod))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\n// A <= 50\n// B <= 70\n// C <= 60\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\n// SA >= 30\n// SB >= 40\n// SC >= 50\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe total production time for all products must not exceed 12 hours per day. Producing one unit of A, B, and C takes 0.1, 0.2, and 0.3 hours, respectively.\n// 0.1*A + 0.2*B + 0.3*C <= 12",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The production time for one unit of A, B, and C is 0.1, 0.2, and 0.3 hours, respectively.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $10             | 0.1 hours                |\n| B       | $15             | 0.2 hours                |\n| C       | $20             | 0.3 hours                |\n\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively. The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands. The company can only sell as many units as it produces. The total production time for all products must not exceed 12 hours per day.\n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 70)\nmodel.addCons(C <= 60)\n## The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 40)\nmodel.addCons(SC >= 50)\n## The company can only sell as many units as it produces.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The total production time for all products must not exceed 12 hours per day. Producing one unit of A, B, and C takes 0.1, 0.2, and 0.3 hours, respectively.\nmodel.addCons(0.1*A + 0.2*B + 0.3*C <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\n// A <= 50\n// B <= 70\n// C <= 60\n\n## Generate Constraint-2:\nThe market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\n// SA >= 30\n// SB >= 40\n// SC >= 50\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe total production time for all products must not exceed 12 hours per day. Producing one unit of A, B, and C takes 0.1, 0.2, and 0.3 hours, respectively.\n// 0.1*A + 0.2*B + 0.3*C <= 12",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\nThe production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively. The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands. The company can only sell as many units as it produces. The total production time for all products must not exceed 12 hours per day. Producing one unit of A, B, and C takes 0.1, 0.2, and 0.3 hours, respectively.\nPlease help the company to determine the optimal daily production and sales quantities for products A, B, and C to maximize their total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the daily production of products A, B, and C to a maximum of 50, 70, and 60 units, respectively.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 70)\nmodel.addCons(C <= 60)\n## The market demand for products A, B, and C is at least 30, 40, and 50 units per day, respectively. The company must meet or exceed these demands.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 40)\nmodel.addCons(SC >= 50)\n## The company can only sell as many units as it produces.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The total production time for all products must not exceed 12 hours per day. Producing one unit of A, B, and C takes 0.1, 0.2, and 0.3 hours, respectively.\nmodel.addCons(0.1*A + 0.2*B + 0.3*C <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime\", \"range\": \"overtime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n// Production_Cost = wheat + 2*rye + 3*sourdough\n// Overtime_Cost = 50*overtime\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 loaves of bread.\n// wheat + rye + sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\n// wheat >= 100\n// rye >= 100\n// sourdough >= 100\n\n## Generate Constraint-4:\nThe bakery's regular hours can produce up to 300 loaves. Any additional loaves require overtime.\n// wheat + rye + sourdough - 300 <= overtime",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs. The cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n\n| Type of Bread | Cost per Loaf |\n|---------------|---------------|\n| Wheat         | $1            |\n| Rye           | $2            |\n| Sourdough     | $3            |\n\nThe bakery has a daily capacity of 500 loaves of bread. The bakery can work up to 10 overtime hours per day. The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand. The bakery's regular hours can produce up to 300 loaves. Any additional loaves require overtime.\n\nPlease help the bakery to determine the optimal number of loaves of each type of bread and the necessary overtime hours to minimize the total production and labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\novertime = model.addVar(vtype=\"INTEGER\", name=\"overtime\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = wheat + 2*rye + 3*sourdough\n## Overtime_Cost = 50*overtime\nmodel.addCons(obj == wheat + 2*rye + 3*sourdough + 50*overtime)\n\n# Add constraints\n## The bakery has a daily capacity of 500 loaves of bread.\nmodel.addCons(wheat + rye + sourdough <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime <= 10)\n## The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(wheat >= 100)\nmodel.addCons(rye >= 100)\nmodel.addCons(sourdough >= 100)\n## The bakery's regular hours can produce up to 300 loaves. Any additional loaves require overtime.\nmodel.addCons(wheat + rye + sourdough - 300 <= overtime)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of overtime hours: \", model.getVal(overtime))\n    print(\"Minimized Total Production and Labor Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime\", \"range\": \"overtime >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs.\n// Production_Cost = wheat + 2*rye + 3*sourdough\n// Overtime_Cost = 50*overtime\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily capacity of 500 loaves of bread.\n// wheat + rye + sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can work up to 10 overtime hours per day.\n// overtime <= 10\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\n// wheat >= 100\n// rye >= 100\n// sourdough >= 100\n\n## Generate Constraint-4:\nThe bakery's regular hours can produce up to 300 loaves. Any additional loaves require overtime.\n// wheat + rye + sourdough - 300 <= overtime",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to meet customer demand while minimizing costs. The cost of producing wheat, rye, and sourdough bread is $1, $2, and $3 per loaf, respectively. Overtime labor costs are $50 per hour. The bakery aims to minimize the total production and labor costs. The bakery has a daily capacity of 500 loaves of bread and can work up to 10 overtime hours per day. The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand. The bakery's regular hours can produce up to 300 loaves, and any additional loaves require overtime.\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce daily and the necessary overtime hours to minimize the total production and labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\novertime = model.addVar(vtype=\"INTEGER\", name=\"overtime\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = wheat + 2*rye + 3*sourdough\n## Overtime_Cost = 50*overtime\nmodel.addCons(obj == wheat + 2*rye + 3*sourdough + 50*overtime)\n\n# Add constraints\n## The bakery has a daily capacity of 500 loaves of bread.\nmodel.addCons(wheat + rye + sourdough <= 500)\n## The bakery can work up to 10 overtime hours per day.\nmodel.addCons(overtime <= 10)\n## The bakery must produce at least 100 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(wheat >= 100)\nmodel.addCons(rye >= 100)\nmodel.addCons(sourdough >= 100)\n## The bakery's regular hours can produce up to 300 loaves. Any additional loaves require overtime.\nmodel.addCons(wheat + rye + sourdough - 300 <= overtime)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of overtime hours: \", model.getVal(overtime))\n    print(\"Minimized Total Production and Labor Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is at least 5 units per day.\n// B >= 5\n\n## Generate Constraint-4:\nThe market demand for product C is at least 8 units per day.\n// C >= 8",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours per Unit |\n|---------|----------------------|\n| A       | 2                    |\n| B       | 3                    |\n| C       | 4                    |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day, for product B is at least 5 units per day, and for product C is at least 8 units per day. \n\nPlease help the company to maximize the total daily profit from the production of these products, subject to the labor constraints and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product B is at least 5 units per day.\nmodel.addCons(B >= 5)\n## The market demand for product C is at least 8 units per day.\nmodel.addCons(C >= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for product B is at least 5 units per day.\n// B >= 5\n\n## Generate Constraint-4:\nThe market demand for product C is at least 8 units per day.\n// C >= 8",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours of 100 hours daily. The market demand for product A is at least 10 units per day, for product B is at least 5 units per day, and for product C is at least 8 units per day. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used must not exceed the available labor hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product B is at least 5 units per day.\nmodel.addCons(B >= 5)\n## The market demand for product C is at least 8 units per day.\nmodel.addCons(C >= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 747,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe first production stage has a capacity of 1000 hours, and it takes 2 hours to produce one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe second production stage has a capacity of 1200 hours, and it takes 1 hour to produce one unit of product A, 2 hours for product B, and 3 hours for product C.\n// A + 2*B + 3*C <= 1200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C.\n// A >= 100\n// B >= 200\n\n## Generate Constraint-4:\nThe total production of all products cannot exceed 500 units due to overall market saturation.\n// A + B + C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the production times for each product in both stages:\n\n| Product | Stage 1 Production Time | Stage 2 Production Time |\n|---------|-------------------------|-------------------------|\n| A       | 2 hours                  | 1 hour                  |\n| B       | 3 hours                  | 2 hours                 |\n| C       | 4 hours                  | 3 hours                 |\n\nThe first production stage has a capacity of 1000 hours, and the second production stage has a capacity of 1200 hours. The market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C. Additionally, the total production of all products cannot exceed 500 units due to overall market saturation.\n\nPlease help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The first production stage has a capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The second production stage has a capacity of 1200 hours\nmodel.addCons(A + 2*B + 3*C <= 1200)\n## The market demand for product A is at least 100 units, for product B is at least 200 units\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\n## The total production of all products cannot exceed 500 units\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe first production stage has a capacity of 1000 hours, and it takes 2 hours to produce one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe second production stage has a capacity of 1200 hours, and it takes 1 hour to produce one unit of product A, 2 hours for product B, and 3 hours for product C.\n// A + 2*B + 3*C <= 1200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C.\n// A >= 100\n// B >= 200\n\n## Generate Constraint-4:\nThe total production of all products cannot exceed 500 units due to overall market saturation.\n// A + B + C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two stages, and the manufacturer needs to decide how many units of each product to produce to maximize profit while considering the limitations of production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The first production stage has a capacity of 1000 hours, with 2 hours required to produce one unit of product A, 3 hours for product B, and 4 hours for product C. The second production stage has a capacity of 1200 hours, with 1 hour required to produce one unit of product A, 2 hours for product B, and 3 hours for product C. The market demand for product A is at least 100 units, for product B is at least 200 units, and there is no minimum demand specified for product C. Additionally, the total production of all products cannot exceed 500 units due to overall market saturation. Please help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The first production stage has a capacity of 1000 hours\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The second production stage has a capacity of 1200 hours\nmodel.addCons(A + 2*B + 3*C <= 1200)\n## The market demand for product A is at least 100 units, for product B is at least 200 units\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\n## The total production of all products cannot exceed 500 units\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.5*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms.\n// 200*WholeWheat + 150*Rye + 180*Sourdough <= 15000\n\n## Generate Constraint-2:\nThe bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams.\n// 5*WholeWheat + 7*Rye + 10*Sourdough <= 500\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 15 minutes of labor. The bakery can dedicate a maximum of 6 hours of labor per day.\n// 15*WholeWheat + 15*Rye + 15*Sourdough <= 360\n\n## Generate Constraint-4:\nThe bakery has a demand constraint. The daily demand for whole wheat bread is at least 50 loaves, for rye bread is at least 30 loaves, and for sourdough bread is at least 20 loaves.\n// WholeWheat >= 50\n// Rye >= 30\n// Sourdough >= 20",
        "question": "A small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $3              |\n| Rye           | $2.5            |\n| Sourdough     | $4              |\n\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms. The bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams. The bakery has a labor constraint where each loaf of bread requires 15 minutes of labor, and the bakery can dedicate a maximum of 6 hours of labor per day. Additionally, the bakery has a demand constraint where the daily demand for whole wheat bread is at least 50 loaves, for rye bread is at least 30 loaves, and for sourdough bread is at least 20 loaves.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.5*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*WholeWheat + 150*Rye + 180*Sourdough <= 15000)\n## The bakery also has a limited amount of yeast.\nmodel.addCons(5*WholeWheat + 7*Rye + 10*Sourdough <= 500)\n## The bakery has a labor constraint.\nmodel.addCons(15*WholeWheat + 15*Rye + 15*Sourdough <= 360)\n## The bakery has a demand constraint.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\nmodel.addCons(Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1410,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.5*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms.\n// 200*WholeWheat + 150*Rye + 180*Sourdough <= 15000\n\n## Generate Constraint-2:\nThe bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams.\n// 5*WholeWheat + 7*Rye + 10*Sourdough <= 500\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 15 minutes of labor. The bakery can dedicate a maximum of 6 hours of labor per day.\n// 15*WholeWheat + 15*Rye + 15*Sourdough <= 360\n\n## Generate Constraint-4:\nThe bakery has a demand constraint. The daily demand for whole wheat bread is at least 50 loaves, for rye bread is at least 30 loaves, and for sourdough bread is at least 20 loaves.\n// WholeWheat >= 50\n// Rye >= 30\n// Sourdough >= 20",
        "question": "A small bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce to maximize profit while considering the limitations of ingredients and labor.\nThe profit per loaf for whole wheat bread is $3, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\nThe bakery has a limited amount of flour available each day. The whole wheat bread requires 200 grams of flour per loaf, rye bread requires 150 grams, and sourdough requires 180 grams. The total daily flour supply is 15 kilograms.\nThe bakery also has a limited amount of yeast. Each loaf of whole wheat bread requires 5 grams of yeast, rye bread requires 7 grams, and sourdough requires 10 grams. The total daily yeast supply is 500 grams.\nThe bakery has a labor constraint. Each loaf of bread requires 15 minutes of labor. The bakery can dedicate a maximum of 6 hours of labor per day.\nThe bakery has a demand constraint. The daily demand for whole wheat bread is at least 50 loaves, for rye bread is at least 30 loaves, and for sourdough bread is at least 20 loaves.\nPlease help the bakery to determine the optimal number of loaves of each type of bread to produce to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.5*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(200*WholeWheat + 150*Rye + 180*Sourdough <= 15000)\n## The bakery also has a limited amount of yeast.\nmodel.addCons(5*WholeWheat + 7*Rye + 10*Sourdough <= 500)\n## The bakery has a labor constraint.\nmodel.addCons(15*WholeWheat + 15*Rye + 15*Sourdough <= 360)\n## The bakery has a demand constraint.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 30)\nmodel.addCons(Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of whole wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves.\n// Whole_Wheat + Rye + Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\n// Whole_Wheat <= 300\n\n## Generate Constraint-3:\nThe bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\n// Rye <= 200\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation.\n// Sourdough >= 50",
        "question": "A bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n\nThe bakery has a daily oven capacity of 500 loaves. The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread. The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread. The bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough <= 500)\n## The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat <= 300)\n## The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\nmodel.addCons(Rye <= 200)\n## The bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation.\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough Loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability.\n// {\"number of whole wheat loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily oven capacity of 500 loaves.\n// Whole_Wheat + Rye + Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\n// Whole_Wheat <= 300\n\n## Generate Constraint-3:\nThe bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\n// Rye <= 200\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation.\n// Sourdough >= 50",
        "question": "A bakery wants to optimize its daily production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of oven capacity and ingredient availability. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $3, and the profit per loaf for sourdough bread is $4. The bakery has a daily oven capacity of 500 loaves. The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread. The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread. The bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a daily oven capacity of 500 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough <= 500)\n## The bakery has a limited supply of whole wheat flour, which can only produce up to 300 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat <= 300)\n## The bakery also has a limited supply of rye flour, which can only produce up to 200 loaves of rye bread.\nmodel.addCons(Rye <= 200)\n## The bakery must produce at least 50 loaves of sourdough bread to meet a contractual obligation.\nmodel.addCons(Sourdough >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough Loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate used\": \"Chocolate_Used\", \"range\": \"Chocolate_Used >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla used\": \"Vanilla_Used\", \"range\": \"Vanilla_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\n// 0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\n// 0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6\n\n## Generate Constraint-3:\nThe bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 15\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The following table shows the ingredients required for each type of cake.\n\n| Cake Type       | Chocolate Required (kg) | Vanilla Required (kg) |\n|-----------------|-------------------------|-----------------------|\n| Chocolate Cake  | 0.5                     | 0.2                   |\n| Vanilla Cake    | 0.3                     | 0.4                   |\n\nThe bakery has a daily supply of 10 kg of chocolate and 6 kg of vanilla. The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily. The bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of chocolate and vanilla used\nChocolate_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Used\", lb=0) # amount of chocolate used\nVanilla_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Used\", lb=0) # amount of vanilla used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\nmodel.addCons(0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10)\n## Each chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\nmodel.addCons(0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6)\n## The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n## The bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"amount of chocolate used\": \"Chocolate_Used\", \"range\": \"Chocolate_Used >= 0\", \"type\": \"real\"}\n// {\"amount of vanilla used\": \"Vanilla_Used\", \"range\": \"Vanilla_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\n// 0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\n// 0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6\n\n## Generate Constraint-3:\nThe bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 15\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand.\n// Chocolate_Cakes + Vanilla_Cakes >= 5",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and storage capacity. The profit from selling a chocolate cake is $10, and the profit from selling a vanilla cake is $8. Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate. Each chocolate cake also requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla, with a daily supply of 6 kg of vanilla. The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily. Additionally, the bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The amount of chocolate and vanilla used\nChocolate_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Chocolate_Used\", lb=0) # amount of chocolate used\nVanilla_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Vanilla_Used\", lb=0) # amount of vanilla used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 0.5 kg of chocolate, and each vanilla cake requires 0.3 kg of chocolate. The bakery has a daily supply of 10 kg of chocolate.\nmodel.addCons(0.5*Chocolate_Cakes + 0.3*Vanilla_Cakes <= 10)\n## Each chocolate cake requires 0.2 kg of vanilla, and each vanilla cake requires 0.4 kg of vanilla. The bakery has a daily supply of 6 kg of vanilla.\nmodel.addCons(0.2*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 6)\n## The bakery has a limited storage capacity, allowing for a maximum of 15 cakes to be produced daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 15)\n## The bakery must ensure that at least 5 cakes are produced daily to meet minimum customer demand.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per eclair is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per eclair is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n// Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\n// 15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 pastries in total.\n// Croissants + Muffins + Eclairs >= 100\n\n## Generate Constraint-3:\nThe bakery can rent a maximum of 3 ovens.\n// Ovens <= 3\n\n## Generate Constraint-4:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day. The revenue and cost per pastry, as well as the rental cost per oven, are given in the following Table.\n\n| Pastry    | Revenue per Pastry | Cost per Pastry | Baking Time per Pastry |\n|-----------|--------------------|-----------------|------------------------|\n| Croissants| 2$                | 1$              | 15 minutes             |\n| Muffins   | 3$                | 1.5$            | 20 minutes             |\n| Eclairs   | 4$                | 2$              | 30 minutes             |\n\nThe rental cost per oven per day is $100. The bakery has a total of 8 hours of baking time available each day. The bakery has a daily demand for at least 100 pastries in total. The bakery can rent a maximum of 3 ovens and needs to rent at least one oven. \n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n## Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Eclairs) - (Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens))\n\n# Add constraints\n## The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60)\n## The bakery has a daily demand for at least 100 pastries in total.\nmodel.addCons(Croissants + Muffins + Eclairs >= 100)\n## The bakery can rent a maximum of 3 ovens.\nmodel.addCons(Ovens <= 3)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per eclair is $4. \nThe cost per croissant is $1, per muffin is $1.5, and per eclair is $2. \nThe rental cost per oven per day is $100.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n// Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\n// 15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 100 pastries in total.\n// Croissants + Muffins + Eclairs >= 100\n\n## Generate Constraint-3:\nThe bakery can rent a maximum of 3 ovens.\n// Ovens <= 3\n\n## Generate Constraint-4:\nThe bakery needs to rent at least one oven.\n// Ovens >= 1",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce and how many ovens to rent for the day. The revenue per croissant is $2, per muffin is $3, and per eclair is $4. The cost per croissant is $1, per muffin is $1.5, and per eclair is $2. The rental cost per oven per day is $100. The bakery wants to maximize the daily profit. The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day. The bakery has a daily demand for at least 100 pastries in total. The bakery can rent a maximum of 3 ovens. The bakery needs to rent at least one oven. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Eclairs\n## Total_Cost = Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens\nmodel.addCons(obj == (2*Croissants + 3*Muffins + 4*Eclairs) - (Croissants + 1.5*Muffins + 2*Eclairs + 100*Ovens))\n\n# Add constraints\n## The time required to bake each croissant is 15 minutes, each muffin is 20 minutes, and each eclair is 30 minutes. The bakery has a total of 8 hours of baking time available each day.\nmodel.addCons(15*Croissants + 20*Muffins + 30*Eclairs <= 8 * 60)\n## The bakery has a daily demand for at least 100 pastries in total.\nmodel.addCons(Croissants + Muffins + Eclairs >= 100)\n## The bakery can rent a maximum of 3 ovens.\nmodel.addCons(Ovens <= 3)\n## The bakery needs to rent at least one oven.\nmodel.addCons(Ovens >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. \nThe labor cost is $15 per hour.\nThe bakery wants to maximize the daily profit.\n// Total_Profit = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour.\n// 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor.\n// 0.05*Croissants + 0.1*Muffins <= 8\n\n## Generate Constraint-3:\nThe cost of ingredients must not exceed $50 per day.\n// Ingredient_Cost <= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand.\n// Croissants >= 20\n// Muffins >= 30",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. The labor cost is $15 per hour. The following table summarizes the requirements for each pastry:\n\n| Pastry   | Profit per Unit | Ingredient Cost per Unit | Labor Time per Unit |\n|----------|-----------------|--------------------------|---------------------|\n| Croissant| 2$              | 0.50$                    | 0.05 hours          |\n| Muffin   | 3$              | 0.75$                    | 0.1 hours           |\n\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour. The bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor. The cost of ingredients must not exceed $50 per day. The bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of croissants and muffins to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The number of hours of labor and the cost of ingredients\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # cost of ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Croissants + 3*Muffins\nTotal_Profit = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nTotal_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nmodel.addCons(obj == Total_Profit - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a daily limit of 8 hours of labor\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 8)\n## The cost of ingredients must not exceed $50 per day\nmodel.addCons(Ingredient_Cost <= 50)\n## The bakery must produce at least 20 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Labor Hours: \", model.getVal(Labor_Hours))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. \nThe cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. \nThe labor cost is $15 per hour.\nThe bakery wants to maximize the daily profit.\n// Total_Profit = 2*Croissants + 3*Muffins\n// Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\n// Objective Function: Maximize: Total_Profit - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour.\n// 0.1*Croissants + 0.2*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor.\n// 0.05*Croissants + 0.1*Muffins <= 8\n\n## Generate Constraint-3:\nThe cost of ingredients must not exceed $50 per day.\n// Ingredient_Cost <= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand.\n// Croissants >= 20\n// Muffins >= 30",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The cost of ingredients per croissant is $0.50, and the cost per muffin is $0.75. The labor cost is $15 per hour. The bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg of flour, while each muffin requires 0.2 kg of flour. The bakery has a daily limit of 8 hours of labor, and each croissant requires 0.05 hours of labor, while each muffin requires 0.1 hours of labor. The cost of ingredients must not exceed $50 per day. The bakery must produce at least 20 croissants and 30 muffins daily to meet minimum customer demand. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The number of hours of labor and the cost of ingredients\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # cost of ingredients\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Profit = 2*Croissants + 3*Muffins\nTotal_Profit = 2*Croissants + 3*Muffins\n## Total_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nTotal_Cost = 0.50*Croissants + 0.75*Muffins + 15*Labor_Hours + Ingredient_Cost\nmodel.addCons(obj == Total_Profit - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 100)\n## The bakery has a daily limit of 8 hours of labor\nmodel.addCons(0.05*Croissants + 0.1*Muffins <= 8)\n## The cost of ingredients must not exceed $50 per day\nmodel.addCons(Ingredient_Cost <= 50)\n## The bakery must produce at least 20 croissants and 30 muffins daily\nmodel.addCons(Croissants >= 20)\nmodel.addCons(Muffins >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Labor Hours: \", model.getVal(Labor_Hours))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\n// Chocolate_Cakes + Vanilla_Cakes >= 5\n\n## Generate Constraint-4:\nThe bakery should not produce more than 10 chocolate cakes daily due to market saturation.\n// Chocolate_Cakes <= 10",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The following table summarizes the labor and sugar requirements for each type of cake.\n\n| Cake Type | Labor Requirement (hours) | Sugar Requirement (kg) |\n|-----------|--------------------------|-----------------------|\n| Chocolate | 2                        | 0.5                   |\n| Vanilla   | 1.5                      | 0.4                   |\n\nThe bakery has a maximum of 12 hours of labor available daily and a maximum of 4 kg of sugar available daily. The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements. Additionally, the bakery should not produce more than 10 chocolate cakes daily due to market saturation. \n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n## The bakery should not produce more than 10 chocolate cakes daily due to market saturation.\nmodel.addCons(Chocolate_Cakes <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\n// Chocolate_Cakes + Vanilla_Cakes >= 5\n\n## Generate Constraint-4:\nThe bakery should not produce more than 10 chocolate cakes daily due to market saturation.\n// Chocolate_Cakes <= 10",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily. The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements. The bakery should not produce more than 10 chocolate cakes daily due to market saturation. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 5 cakes in total daily to meet minimum operational requirements.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes >= 5)\n## The bakery should not produce more than 10 chocolate cakes daily due to market saturation.\nmodel.addCons(Chocolate_Cakes <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\n// 0.05*Croissants + 0.1*Muffins <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for 50 pastries.\n// Croissants + Muffins >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 100 croissants daily.\n// Croissants <= 100",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $1.50, and the profit per muffin is $2.00. The requirements for labor and flour for each type of pastry are given in the following Table.\n\n| Pastry   | Labor Requirement (hours) | Flour Requirement (kg) |\n|----------|--------------------------|-----------------------|\n| Croissant| 0.1                      | 0.05                  |\n| Muffin   | 0.2                      | 0.1                   |\n\nThe bakery has a maximum of 8 hours of labor available daily and a maximum of 3 kg of flour available daily. The bakery has a minimum daily demand for 50 pastries and should not produce more than 100 croissants daily. Please help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins == Labor_Hours)\nmodel.addCons(Labor_Hours <= 8)\n## Each croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins == Flour_Used)\nmodel.addCons(Flour_Used <= 3)\n## The bakery has a minimum daily demand for 50 pastries.\nmodel.addCons(Croissants + Muffins >= 50)\n## The bakery should not produce more than 100 croissants daily.\nmodel.addCons(Croissants <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, and the profit per muffin is $2.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\n// 0.05*Croissants + 0.1*Muffins <= 3\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for 50 pastries.\n// Croissants + Muffins >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 100 croissants daily.\n// Croissants <= 100",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $1.50, and the profit per muffin is $2.00. Each croissant requires 0.1 hours of labor and 0.05 kg of flour, while each muffin requires 0.2 hours of labor and 0.1 kg of flour. The bakery has a maximum of 8 hours of labor and 3 kg of flour available daily. The bakery has a minimum daily demand for 50 pastries and should not produce more than 100 croissants daily. Please help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins == Labor_Hours)\nmodel.addCons(Labor_Hours <= 8)\n## Each croissant requires 0.05 kg of flour, and each muffin requires 0.1 kg of flour. The bakery has a maximum of 3 kg of flour available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins == Flour_Used)\nmodel.addCons(Flour_Used <= 3)\n## The bakery has a minimum daily demand for 50 pastries.\nmodel.addCons(Croissants + Muffins >= 50)\n## The bakery should not produce more than 100 croissants daily.\nmodel.addCons(Croissants <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 681,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery can only use a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3\n\n## Generate Constraint-4:\nThe bakery must use at least one oven for each type of pastry.\n// Oven_Croissants >= 1, Oven_Muffins >= 1, Oven_Donuts >= 1",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit.\n\n| Pastry       | Revenue per Unit | Cost per Oven Usage | Capacity per Oven |\n|--------------|------------------|---------------------|-------------------|\n| Croissants   | $2               | $50                 | 100 pastries      |\n| Muffins      | $3               | $60                 | 100 pastries      |\n| Donuts       | $1.5             | $40                 | 100 pastries      |\n\nThe bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts. Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used. The bakery can only use a maximum of 3 ovens in total and must use at least one oven for each type of pastry.\n\nPlease help the bakery to determine the optimal number of each type of pastry to produce and the number of ovens to use for each type to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 100)\n## The bakery can only use a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3)\n## The bakery must use at least one oven for each type of pastry.\nmodel.addCons(Oven_Croissants >= 1)\nmodel.addCons(Oven_Muffins >= 1)\nmodel.addCons(Oven_Donuts >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for croissants\": \"Oven_Croissants\", \"range\": \"Oven_Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for muffins\": \"Oven_Muffins\", \"range\": \"Oven_Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to use for donuts\": \"Oven_Donuts\", \"range\": \"Oven_Donuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per croissant is $2, per muffin is $3, and per donut is $1.5. \nThe cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts.\nThe bakery wants to maximize its daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n// Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\n// Croissants <= 100*Oven_Croissants\n// Muffins <= 100*Oven_Muffins\n// Donuts <= 100*Oven_Donuts\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\n// Croissants >= 200\n// Muffins >= 150\n// Donuts >= 100\n\n## Generate Constraint-3:\nThe bakery can only use a maximum of 3 ovens in total.\n// Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3\n\n## Generate Constraint-4:\nThe bakery must use at least one oven for each type of pastry.\n// Oven_Croissants >= 1, Oven_Muffins >= 1, Oven_Donuts >= 1",
        "question": "A bakery wants to optimize its daily production of three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce and how many ovens to use for each type. The revenue per croissant is $2, per muffin is $3, and per donut is $1.5. The cost per oven usage per day is $50 for croissants, $60 for muffins, and $40 for donuts. The bakery wants to maximize its daily profit. Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used. The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts. The bakery can only use a maximum of 3 ovens in total. The bakery must use at least one oven for each type of pastry. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to use for each type\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nOven_Croissants = model.addVar(vtype=\"INTEGER\", name=\"Oven_Croissants\", lb=0) # number of ovens to use for croissants\nOven_Muffins = model.addVar(vtype=\"INTEGER\", name=\"Oven_Muffins\", lb=0) # number of ovens to use for muffins\nOven_Donuts = model.addVar(vtype=\"INTEGER\", name=\"Oven_Donuts\", lb=0) # number of ovens to use for donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 1.5*Donuts\n## Total_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nTotal_Cost = 50*Oven_Croissants + 60*Oven_Muffins + 40*Oven_Donuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each oven can produce 100 pastries per day. The total number of pastries produced should not exceed the capacity of the ovens used.\nmodel.addCons(Croissants <= 100*Oven_Croissants)\nmodel.addCons(Muffins <= 100*Oven_Muffins)\nmodel.addCons(Donuts <= 100*Oven_Donuts)\n## The bakery has a daily demand for at least 200 croissants, 150 muffins, and 100 donuts.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 150)\nmodel.addCons(Donuts >= 100)\n## The bakery can only use a maximum of 3 ovens in total.\nmodel.addCons(Oven_Croissants + Oven_Muffins + Oven_Donuts <= 3)\n## The bakery must use at least one oven for each type of pastry.\nmodel.addCons(Oven_Croissants >= 1)\nmodel.addCons(Oven_Muffins >= 1)\nmodel.addCons(Oven_Donuts >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of ovens to use for croissants: \", model.getVal(Oven_Croissants))\n    print(\"Number of ovens to use for muffins: \", model.getVal(Oven_Muffins))\n    print(\"Number of ovens to use for donuts: \", model.getVal(Oven_Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 0.5\", \"type\": \"real\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 0.4\", \"type\": \"real\"}\n// {\"oven usage per donut\": \"Oven_Donut\", \"range\": \"Oven_Donut = 0.3\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The bakery aims to maximize its daily profit from selling pastries.\n// Profit_Croissant = 1.5 * Croissants\n// Profit_Muffin = 2 * Muffins\n// Profit_Donut = 1.2 * Donuts\n// Objective Function: Maximize: Profit_Croissant + Profit_Muffin + Profit_Donut\n\n## Generate Constraint-1:\nThe total oven usage per day cannot exceed 10 hours.\n// Oven_Croissant * Croissants + Oven_Muffin * Muffins + Oven_Donut * Donuts <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 15 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 pastries in total.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability. The profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The oven usage per croissant is 0.5 hours, per muffin is 0.4 hours, and per donut is 0.3 hours. The bakery has a daily supply of 20 kg of flour and 15 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.15 kg of flour and 0.08 kg of sugar.\n\n| Pastry | Profit per Unit | Oven Usage per Unit | Flour Required per Unit | Sugar Required per Unit |\n|--------|-----------------|---------------------|-------------------------|-------------------------|\n| Croissant | $1.5 | 0.5 hours | 0.1 kg | 0.05 kg |\n| Muffin | $2 | 0.4 hours | 0.2 kg | 0.1 kg |\n| Donut | $1.2 | 0.3 hours | 0.15 kg | 0.08 kg |\n\nThe total oven usage per day cannot exceed 10 hours. The bakery has a daily supply of 20 kg of flour and 15 kg of sugar. The bakery has a daily demand for at least 50 pastries in total. Please help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.5*Croissants + 2*Muffins + 1.2*Donuts)\n\n# Add constraints\n## The total oven usage per day cannot exceed 10 hours.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 10)\n## The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 20)\n## The bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 15)\n## The bakery has a daily demand for at least 50 pastries in total.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"oven usage per croissant\": \"Oven_Croissant\", \"range\": \"Oven_Croissant = 0.5\", \"type\": \"real\"}\n// {\"oven usage per muffin\": \"Oven_Muffin\", \"range\": \"Oven_Muffin = 0.4\", \"type\": \"real\"}\n// {\"oven usage per donut\": \"Oven_Donut\", \"range\": \"Oven_Donut = 0.3\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The bakery aims to maximize its daily profit from selling pastries.\n// Profit_Croissant = 1.5 * Croissants\n// Profit_Muffin = 2 * Muffins\n// Profit_Donut = 1.2 * Donuts\n// Objective Function: Maximize: Profit_Croissant + Profit_Muffin + Profit_Donut\n\n## Generate Constraint-1:\nThe total oven usage per day cannot exceed 10 hours.\n// Oven_Croissant * Croissants + Oven_Muffin * Muffins + Oven_Donut * Donuts <= 10\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 20 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1 * Croissants + 0.2 * Muffins + 0.15 * Donuts <= 20\n\n## Generate Constraint-3:\nThe bakery has a daily supply of 15 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05 * Croissants + 0.1 * Muffins + 0.08 * Donuts <= 15\n\n## Generate Constraint-4:\nThe bakery has a daily demand for at least 50 pastries in total.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited oven capacity and ingredient availability. The profit per croissant is $1.5, per muffin is $2, and per donut is $1.2. The total oven usage per day cannot exceed 10 hours. The bakery has a daily supply of 20 kg of flour and 15 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each donut requires 0.15 kg of flour and 0.08 kg of sugar. The bakery has a daily demand for at least 50 pastries in total. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.5*Croissants + 2*Muffins + 1.2*Donuts)\n\n# Add constraints\n## The total oven usage per day cannot exceed 10 hours.\nmodel.addCons(0.5*Croissants + 0.4*Muffins + 0.3*Donuts <= 10)\n## The bakery has a daily supply of 20 kg of flour.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 20)\n## The bakery has a daily supply of 15 kg of sugar.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 15)\n## The bakery has a daily demand for at least 50 pastries in total.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs available\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of cups of sugar available\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\n// Chocolate_Cakes + Vanilla_Cakes <= 80\n\n## Generate Constraint-3:\nThe daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 30\n\n## Generate Constraint-4:\nThe bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes.\n// Chocolate_Cakes + Vanilla_Cakes <= 20 + 30",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the ingredient requirements per cake type:\n\n| Cake Type       | Eggs Required | Sugar Required |\n|-----------------|---------------|----------------|\n| Chocolate Cake  | 2             | 1              |\n| Vanilla Cake    | 1             | 1              |\n\nThe bakery has a daily supply of 100 eggs and 80 cups of sugar. The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30. The bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes. \n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## Each chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 80)\n## The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 30)\n## The bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 20 + 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs available\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of cups of sugar available\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Vanilla_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\n// Chocolate_Cakes + Vanilla_Cakes <= 80\n\n## Generate Constraint-3:\nThe daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\n// Chocolate_Cakes >= 20\n// Vanilla_Cakes >= 30\n\n## Generate Constraint-4:\nThe bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes.\n// Chocolate_Cakes + Vanilla_Cakes <= 20 + 30",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. Each chocolate cake and each vanilla cake require 1 cup of sugar, and the bakery has a daily supply of 80 cups of sugar. The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30. The bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Vanilla_Cakes <= 100)\n## Each chocolate cake requires 1 cup of sugar, and each vanilla cake requires 1 cup of sugar. The bakery has a daily supply of 80 cups of sugar.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 80)\n## The daily demand for chocolate cakes is at least 20, and the daily demand for vanilla cakes is at least 30.\nmodel.addCons(Chocolate_Cakes >= 20)\nmodel.addCons(Vanilla_Cakes >= 30)\n## The bakery cannot produce more cakes than the sum of the minimum demands for both types of cakes.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 20 + 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// Wheat_Loaves + Rye_Loaves >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 150 loaves of bread daily to maintain quality.\n// Wheat_Loaves + Rye_Loaves <= 150",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Flour Requirement (kg/loaf) | Labor Requirement (hours/loaf) |\n|------------|-----------------------------|--------------------------------|\n| Wheat      | 0.5                         | 0.2                            |\n| Rye        | 0.6                         | 0.3                            |\n\nThe bakery has a daily supply of 100 kg of flour and a daily limit of 20 hours of labor. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand and should not produce more than 150 loaves of bread daily to maintain quality. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n## The bakery should not produce more than 150 loaves of bread daily to maintain quality.\nmodel.addCons(Wheat_Loaves + Rye_Loaves <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100\n\n## Generate Constraint-2:\nEach loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\n// Wheat_Loaves + Rye_Loaves >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 150 loaves of bread daily to maintain quality.\n// Wheat_Loaves + Rye_Loaves <= 150",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the available ingredients and labor. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor. The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand. The bakery should not produce more than 150 loaves of bread daily to maintain quality. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## The amount of resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nFlour_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Used\", lb=0) # amount of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 100)\n## Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor. The bakery has a daily limit of 20 hours of labor.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 20)\n## The bakery must produce at least 50 loaves of bread daily to meet minimum customer demand.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n## The bakery should not produce more than 150 loaves of bread daily to maintain quality.\nmodel.addCons(Wheat_Loaves + Rye_Loaves <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n// Eggs_Chocolate + Eggs_Vanilla = 2*Chocolate_Cakes + Vanilla_Cakes",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the requirements for each type of cake:\n\n| Cake Type       | Profit per Cake | Eggs Required |\n|-----------------|-----------------|---------------|\n| Chocolate       | $5              | 2             |\n| Vanilla         | $4              | 1             |\n\nThe bakery has a daily supply of 100 eggs. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of eggs required for each type of cake\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n## The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\nmodel.addCons(Eggs_Chocolate + Eggs_Vanilla == 2*Chocolate_Cakes + Vanilla_Cakes)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n// Eggs_Chocolate + Eggs_Vanilla = 2*Chocolate_Cakes + Vanilla_Cakes",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of eggs required for each type of cake\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n## The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\nmodel.addCons(Eggs_Chocolate + Eggs_Vanilla == 2*Chocolate_Cakes + Vanilla_Cakes)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\n// 2*A + 3*B + 5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per week.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 5 units per week.\n// B >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 20 units of Product C per week.\n// C <= 20",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The labor requirements for each product are as follows:\n\n| Product | Labor Hours Required |\n|---------|----------------------|\n| A       | 2 hours              |\n| B       | 3 hours              |\n| C       | 5 hours              |\n\nThe company has a total of 100 hours of labor available per week. The market demand for Product A is at least 10 units per week, and for Product B is at least 5 units per week. The company can produce at most 20 units of Product C per week. \n\nPlease help the company to maximize the total profit from the sales of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 5*C <= 100)\n## The market demand for Product A is at least 10 units per week.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at least 5 units per week.\nmodel.addCons(B >= 5)\n## The company can produce at most 20 units of Product C per week.\nmodel.addCons(C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\n// 2*A + 3*B + 5*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units per week.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 5 units per week.\n// B >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 20 units of Product C per week.\n// C <= 20",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce based on the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the sales of these products. Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week. The market demand for Product A is at least 10 units per week. The market demand for Product B is at least 5 units per week. The company can produce at most 20 units of Product C per week. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n## The number of hours of labor used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, Product B requires 3 hours, and Product C requires 5 hours. The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 5*C <= 100)\n## The market demand for Product A is at least 10 units per week.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at least 5 units per week.\nmodel.addCons(B >= 5)\n## The company can produce at most 20 units of Product C per week.\nmodel.addCons(C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product.\n// {\"whether to use Machine 1\": \"M1\", \"range\": \"M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2\": \"M2\", \"range\": \"M2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 3\": \"M3\", \"range\": \"M3 = 0 or 1\", \"type\": \"binary\"}\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines.\n// Profit = 10*A + 15*B + 20*C + 25*D\n// Machine_Cost = 500*M1 + 600*M2 + 700*M3\n// Objective Function: Maximize: Profit - Machine_Cost\n\n## Generate Constraint-1:\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units.\n// A + B + C + D <= 100*M1\n// A + B + C + D <= 150*M2\n// A + B + C + D <= 200*M3\n\n## Generate Constraint-2:\nThe total production of all products should not exceed 300 units.\n// A + B + C + D <= 300\n\n## Generate Constraint-3:\nThe manufacturer can only use two machines at most.\n// M1 + M2 + M3 <= 2\n\n## Generate Constraint-4:\nProduct A must be produced in at least 50 units.\n// A >= 50",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n| D       | 25$             |\n\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units. The total production of all products should not exceed 300 units. The manufacturer can only use two machines at most. Product A must be produced in at least 50 units.\n\nPlease help the manufacturer to maximize the total profit while considering the fixed costs of machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each machine\nM1 = model.addVar(vtype=\"B\", name=\"M1\") # whether to use Machine 1\nM2 = model.addVar(vtype=\"B\", name=\"M2\") # whether to use Machine 2\nM3 = model.addVar(vtype=\"B\", name=\"M3\") # whether to use Machine 3\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 10*A + 15*B + 20*C + 25*D\nProfit = 10*A + 15*B + 20*C + 25*D\n## Machine_Cost = 500*M1 + 600*M2 + 700*M3\nMachine_Cost = 500*M1 + 600*M2 + 700*M3\nmodel.addCons(obj == Profit - Machine_Cost)\n\n# Add constraints\n## Each machine has a limited production capacity.\nmodel.addCons(A + B + C + D <= 100*M1)\nmodel.addCons(A + B + C + D <= 150*M2)\nmodel.addCons(A + B + C + D <= 200*M3)\n## The total production of all products should not exceed 300 units.\nmodel.addCons(A + B + C + D <= 300)\n## The manufacturer can only use two machines at most.\nmodel.addCons(M1 + M2 + M3 <= 2)\n## Product A must be produced in at least 50 units.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Machine 1: \", model.getVal(M1))\n    print(\"Whether to use Machine 2: \", model.getVal(M2))\n    print(\"Whether to use Machine 3: \", model.getVal(M3))\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 7,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product.\n// {\"whether to use Machine 1\": \"M1\", \"range\": \"M1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 2\": \"M2\", \"range\": \"M2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to use Machine 3\": \"M3\", \"range\": \"M3 = 0 or 1\", \"type\": \"binary\"}\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines.\n// Profit = 10*A + 15*B + 20*C + 25*D\n// Machine_Cost = 500*M1 + 600*M2 + 700*M3\n// Objective Function: Maximize: Profit - Machine_Cost\n\n## Generate Constraint-1:\nEach machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units.\n// A + B + C + D <= 100*M1\n// A + B + C + D <= 150*M2\n// A + B + C + D <= 200*M3\n\n## Generate Constraint-2:\nThe total production of all products should not exceed 300 units.\n// A + B + C + D <= 300\n\n## Generate Constraint-3:\nThe manufacturer can only use two machines at most.\n// M1 + M2 + M3 <= 2\n\n## Generate Constraint-4:\nProduct A must be produced in at least 50 units.\n// A >= 50",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different machines (Machine 1, Machine 2, Machine 3). The manufacturer needs to determine how many units of each product to produce and which machines to use for each product. The profit per unit for products A, B, C, D is $10, $15, $20, and $25 respectively. The fixed cost of operating each machine is $500 for Machine 1, $600 for Machine 2, and $700 for Machine 3. The manufacturer wants to maximize the total profit while considering the fixed costs of machines. Each machine has a limited production capacity. Machine 1 can produce at most 100 units of any product, Machine 2 can produce at most 150 units, and Machine 3 can produce at most 200 units. The total production of all products should not exceed 300 units. The manufacturer can only use two machines at most. Product A must be produced in at least 50 units. Please help the manufacturer to maximize the total profit while considering the fixed costs of machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to use each machine\nM1 = model.addVar(vtype=\"B\", name=\"M1\") # whether to use Machine 1\nM2 = model.addVar(vtype=\"B\", name=\"M2\") # whether to use Machine 2\nM3 = model.addVar(vtype=\"B\", name=\"M3\") # whether to use Machine 3\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 10*A + 15*B + 20*C + 25*D\nProfit = 10*A + 15*B + 20*C + 25*D\n## Machine_Cost = 500*M1 + 600*M2 + 700*M3\nMachine_Cost = 500*M1 + 600*M2 + 700*M3\nmodel.addCons(obj == Profit - Machine_Cost)\n\n# Add constraints\n## Each machine has a limited production capacity.\nmodel.addCons(A + B + C + D <= 100*M1)\nmodel.addCons(A + B + C + D <= 150*M2)\nmodel.addCons(A + B + C + D <= 200*M3)\n## The total production of all products should not exceed 300 units.\nmodel.addCons(A + B + C + D <= 300)\n## The manufacturer can only use two machines at most.\nmodel.addCons(M1 + M2 + M3 <= 2)\n## Product A must be produced in at least 50 units.\nmodel.addCons(A >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to use Machine 1: \", model.getVal(M1))\n    print(\"Whether to use Machine 2: \", model.getVal(M2))\n    print(\"Whether to use Machine 3: \", model.getVal(M3))\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 7,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of units of Product A demanded daily\": \"Demand_A\", \"range\": \"Demand_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B demanded daily\": \"Demand_B\", \"range\": \"Demand_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\n// A <= Demand_A\n// B <= Demand_B\n\n## Generate Constraint-3:\nThe company must meet at least 90% of the daily demand for each product.\n// A >= 0.9 * Demand_A\n// B >= 0.9 * Demand_B\n\n## Generate Constraint-4:\nThe total number of units produced daily (Product A and Product B) must not exceed 50 units.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $50, and for Product B is $70. The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily. The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product. The company must meet at least 90% of the daily demand for each product. The total number of units produced daily (Product A and Product B) must not exceed 50 units.\n\nPlease help the company to maximize the total daily profit from both products.\n\n| Product | Profit per Unit | Labor Required per Unit | Daily Demand |\n|---------|-----------------|-------------------------|--------------|\n| A       | $50             | 2 hours                 | 20 units     |\n| B       | $70             | 3 hours                 | 30 units     |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of labor used daily\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used daily\n## The number of units of each product demanded daily\nDemand_A = model.addVar(vtype=\"INTEGER\", name=\"Demand_A\", lb=0) # number of units of Product A demanded daily\nDemand_B = model.addVar(vtype=\"INTEGER\", name=\"Demand_B\", lb=0) # number of units of Product B demanded daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\nmodel.addCons(A <= Demand_A)\nmodel.addCons(B <= Demand_B)\n## The company must meet at least 90% of the daily demand for each product.\nmodel.addCons(A >= 0.9 * Demand_A)\nmodel.addCons(B >= 0.9 * Demand_B)\n## The total number of units produced daily (Product A and Product B) must not exceed 50 units.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 5,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used daily\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of units of Product A demanded daily\": \"Demand_A\", \"range\": \"Demand_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B demanded daily\": \"Demand_B\", \"range\": \"Demand_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and for Product B is $70. The company aims to maximize the total daily profit from both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nThe daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\n// A <= Demand_A\n// B <= Demand_B\n\n## Generate Constraint-3:\nThe company must meet at least 90% of the daily demand for each product.\n// A >= 0.9 * Demand_A\n// B >= 0.9 * Demand_B\n\n## Generate Constraint-4:\nThe total number of units produced daily (Product A and Product B) must not exceed 50 units.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit of Product A is $50, and for Product B is $70. The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily. The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product. The company must meet at least 90% of the daily demand for each product. The total number of units produced daily (Product A and Product B) must not exceed 50 units.\nPlease help the company to maximize the total daily profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced daily\n## The number of hours of labor used daily\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used daily\n## The number of units of each product demanded daily\nDemand_A = model.addVar(vtype=\"INTEGER\", name=\"Demand_A\", lb=0) # number of units of Product A demanded daily\nDemand_B = model.addVar(vtype=\"INTEGER\", name=\"Demand_B\", lb=0) # number of units of Product B demanded daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a maximum of 120 hours of labor available daily.\nmodel.addCons(2*A + 3*B <= 120)\n## The daily demand for Product A is 20 units, and for Product B is 30 units. The company cannot produce more units than the demand for each product.\nmodel.addCons(A <= Demand_A)\nmodel.addCons(B <= Demand_B)\n## The company must meet at least 90% of the daily demand for each product.\nmodel.addCons(A >= 0.9 * Demand_A)\nmodel.addCons(B >= 0.9 * Demand_B)\n## The total number of units produced daily (Product A and Product B) must not exceed 50 units.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced daily: \", model.getVal(A))\n    print(\"Number of units of Product B produced daily: \", model.getVal(B))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 5,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"QD\", \"range\": \"QD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost.\n// Cost = 5*QA + 8*QB + 10*QC + 12*QD\n// Revenue = 15*QA + 20*QB + 25*QC + 30*QD\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units.\n// 2*QA + 3*QB + 4*QC + 5*QD <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours.\n// QA + 2*QB + 3*QC + 4*QD <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and for product D is at most 100 units.\n// QA >= 50\n// QD <= 100\n\n## Generate Constraint-4:\nThe manufacturer aims to produce at least twice as many units of product B as product C.\n// QB >= 2*QC",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product. The following table summarizes the cost, selling price, and resource requirements per unit for each product.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Raw Material Required per Unit | Production Time Required per Unit |\n|---------|--------------------------|------------------------|--------------------------------|----------------------------------|\n| A       | $5                       | $15                    | 2 units                        | 1 hour                           |\n| B       | $8                       | $20                    | 3 units                        | 2 hours                          |\n| C       | $10                      | $25                    | 4 units                        | 3 hours                          |\n| D       | $12                      | $30                    | 5 units                        | 4 hours                          |\n\nThe manufacturer has a limited amount of raw material, with a total of 1000 units available. The production line has a limited capacity, with a total of 500 hours available. The market demand for product A is at least 50 units, and for product D is at most 100 units. The manufacturer aims to produce at least twice as many units of product B as product C.\n\nPlease help the manufacturer to maximize the profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of Product C\nQD = model.addVar(vtype=\"INTEGER\", name=\"QD\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 5*QA + 8*QB + 10*QC + 12*QD\n## Revenue = 15*QA + 20*QB + 25*QC + 30*QD\nmodel.addCons(obj == (15*QA + 20*QB + 25*QC + 30*QD) - (5*QA + 8*QB + 10*QC + 12*QD))\n\n# Add constraints\n## The manufacturer has a limited amount of raw material.\nmodel.addCons(2*QA + 3*QB + 4*QC + 5*QD <= 1000)\n## The production line has a limited capacity.\nmodel.addCons(QA + 2*QB + 3*QC + 4*QD <= 500)\n## The market demand for product A is at least 50 units, and for product D is at most 100 units.\nmodel.addCons(QA >= 50)\nmodel.addCons(QD <= 100)\n## The manufacturer aims to produce at least twice as many units of product B as product C.\nmodel.addCons(QB >= 2*QC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Quantity of Product C: \", model.getVal(QC))\n    print(\"Quantity of Product D: \", model.getVal(QD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1601,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost, revenue, and resource requirements vary for each product.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"QD\", \"range\": \"QD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost.\n// Cost = 5*QA + 8*QB + 10*QC + 12*QD\n// Revenue = 15*QA + 20*QB + 25*QC + 30*QD\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units.\n// 2*QA + 3*QB + 4*QC + 5*QD <= 1000\n\n## Generate Constraint-2:\nThe production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours.\n// QA + 2*QB + 3*QC + 4*QD <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and for product D is at most 100 units.\n// QA >= 50\n// QD <= 100\n\n## Generate Constraint-4:\nThe manufacturer aims to produce at least twice as many units of product B as product C.\n// QB >= 2*QC",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) and needs to decide the production quantities for each product. The production cost per unit for products A, B, C, D is $5, $8, $10, and $12 respectively. The selling price per unit for products A, B, C, D is $15, $20, $25, and $30 respectively. The manufacturer aims to maximize the profit, which is the difference between the total revenue and the total cost.\nThe manufacturer has a limited amount of raw material. Each unit of product A, B, C, D requires 2, 3, 4, and 5 units of raw material respectively. The total available raw material is 1000 units. The production line has a limited capacity. Each unit of product A, B, C, D requires 1, 2, 3, and 4 hours of production time respectively. The total available production time is 500 hours. The market demand for product A is at least 50 units, and for product D is at most 100 units. The manufacturer aims to produce at least twice as many units of product B as product C.\nPlease help the manufacturer to maximize the profit, which is the difference between the total revenue and the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of Product C\nQD = model.addVar(vtype=\"INTEGER\", name=\"QD\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 5*QA + 8*QB + 10*QC + 12*QD\n## Revenue = 15*QA + 20*QB + 25*QC + 30*QD\nmodel.addCons(obj == (15*QA + 20*QB + 25*QC + 30*QD) - (5*QA + 8*QB + 10*QC + 12*QD))\n\n# Add constraints\n## The manufacturer has a limited amount of raw material.\nmodel.addCons(2*QA + 3*QB + 4*QC + 5*QD <= 1000)\n## The production line has a limited capacity.\nmodel.addCons(QA + 2*QB + 3*QC + 4*QD <= 500)\n## The market demand for product A is at least 50 units, and for product D is at most 100 units.\nmodel.addCons(QA >= 50)\nmodel.addCons(QD <= 100)\n## The manufacturer aims to produce at least twice as many units of product B as product C.\nmodel.addCons(QB >= 2*QC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Quantity of Product C: \", model.getVal(QC))\n    print(\"Quantity of Product D: \", model.getVal(QD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n// Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Labor_Cost = 15 * 8 + 20 * overtime_hours\n// Objective Function: Minimize: Bread_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10\n\n## Generate Constraint-4:\nThe bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) <= 8 + overtime_hours",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n\n| Bread Type       | Cost per Loaf |\n|------------------|---------------|\n| Wheat            | $1.50         |\n| Rye              | $2.00         |\n| Sourdough        | $2.50         |\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime. The bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\n\nPlease help the bakery to minimize the total cost of production and labor while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Labor_Cost = 15 * 8 + 20 * overtime_hours\nBread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nLabor_Cost = 15 * 8 + 20 * overtime_hours\nmodel.addCons(obj == Bread_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10)\n## The bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) <= 8 + overtime_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n// Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Labor_Cost = 15 * 8 + 20 * overtime_hours\n// Objective Function: Minimize: Bread_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\n// wheat_loaves >= 100\n// rye_loaves >= 80\n// sourdough_loaves >= 50\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 200 loaves of bread per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 200\n\n## Generate Constraint-3:\nThe bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10\n\n## Generate Constraint-4:\nThe bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\n// 0.1*(wheat_loaves + rye_loaves + sourdough_loaves) <= 8 + overtime_hours",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the demand for each type of bread. The cost of producing one loaf of wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 respectively. The labor cost is $15 per hour, and the bakery operates for 8 hours a day. Any additional hours are considered overtime, costing $20 per hour. The bakery aims to minimize the total cost of production and labor.\n\nThe bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread. The bakery can produce a maximum of 200 loaves of bread per day. The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime. The bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\n\nPlease help the bakery to minimize the total cost of production and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and overtime hours\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\novertime_hours = model.addVar(vtype=\"CONTINUOUS\", name=\"overtime_hours\", lb=0) # number of overtime hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Bread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Labor_Cost = 15 * 8 + 20 * overtime_hours\nBread_Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\nLabor_Cost = 15 * 8 + 20 * overtime_hours\nmodel.addCons(obj == Bread_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a daily demand for at least 100 loaves of wheat bread, 80 loaves of rye bread, and 50 loaves of sourdough bread.\nmodel.addCons(wheat_loaves >= 100)\nmodel.addCons(rye_loaves >= 80)\nmodel.addCons(sourdough_loaves >= 50)\n## The bakery can produce a maximum of 200 loaves of bread per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 200)\n## The bakery's production capacity is limited by the number of hours available. Each loaf of bread requires 0.1 hours to produce. The bakery can work up to 10 hours a day, including overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) + overtime_hours <= 10)\n## The bakery must ensure that the total production time does not exceed the regular 8 hours plus any overtime.\nmodel.addCons(0.1*(wheat_loaves + rye_loaves + sourdough_loaves) <= 8 + overtime_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of overtime hours: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\n// A + 2*B + 3*C + 4*D <= 150\n\n## Generate Constraint-3:\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\n// 3*A + 2*B + C + 2*D <= 200\n\n## Generate Constraint-4:\nThe market demand for Product A is at least 10 units, and for Product D is at most 20 units.\n// A >= 10\n// D <= 20",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The following table summarizes the resource requirements per unit of each product:\n\n| Product | Resource 1 | Resource 2 | Resource 3 |\n|---------|------------|------------|------------|\n| A       | 2 units    | 1 unit     | 3 units    |\n| B       | 3 units    | 2 units    | 2 units    |\n| C       | 4 units    | 3 units    | 1 unit     |\n| D       | 5 units    | 4 units    | 2 units    |\n\nResource 1 is available in the amount of 100 units, Resource 2 is available in the amount of 150 units, and Resource 3 is available in the amount of 200 units. The market demand for Product A is at least 10 units, and for Product D is at most 20 units.\n\nPlease help the manufacturer to maximize the total profit from the production of these products, subject to the resource constraints and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Resource 1 constraint\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Resource 2 constraint\nmodel.addCons(A + 2*B + 3*C + 4*D <= 150)\n## Resource 3 constraint\nmodel.addCons(3*A + 2*B + C + 2*D <= 200)\n## Market demand for Product A and D\nmodel.addCons(A >= 10)\nmodel.addCons(D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\n// A + 2*B + 3*C + 4*D <= 150\n\n## Generate Constraint-3:\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\n// 3*A + 2*B + C + 2*D <= 200\n\n## Generate Constraint-4:\nThe market demand for Product A is at least 10 units, and for Product D is at most 20 units.\n// A >= 10\n// D <= 20",
        "question": "A manufacturer is planning to produce four types of products (A, B, C, D) using three different resources (Resource 1, Resource 2, Resource 3). The manufacturer needs to determine how many units of each product to produce to optimize profits while considering the availability of resources.\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\nResource 1 is available in the amount of 100 units. Each unit of Product A requires 2 units of Resource 1, Product B requires 3 units, Product C requires 4 units, and Product D requires 5 units.\nResource 2 is available in the amount of 150 units. Each unit of Product A requires 1 unit of Resource 2, Product B requires 2 units, Product C requires 3 units, and Product D requires 4 units.\nResource 3 is available in the amount of 200 units. Each unit of Product A requires 3 units of Resource 3, Product B requires 2 units, Product C requires 1 unit, and Product D requires 2 units.\nThe market demand for Product A is at least 10 units, and for Product D is at most 20 units.\nPlease help the manufacturer to determine the optimal number of units to produce for each product to maximize total profit while adhering to the resource constraints and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Resource 1 constraint\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Resource 2 constraint\nmodel.addCons(A + 2*B + 3*C + 4*D <= 150)\n## Resource 3 constraint\nmodel.addCons(3*A + 2*B + C + 2*D <= 200)\n## Market demand for Product A and D\nmodel.addCons(A >= 10)\nmodel.addCons(D <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively. The selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit.\n// Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $150 for ingredients and labor.\n// 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a special order.\n// rye_loaves >= 20\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 30% of its total production as wheat bread.\n// wheat_loaves >= 0.30 * (wheat_loaves + rye_loaves + sourdough_loaves)",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf. The cost and selling price for each type of bread are given in the following Table.\n\n| Type of Bread | Cost per Loaf | Selling Price per Loaf |\n|---------------|---------------|-------------------------|\n| Wheat         | $1.50         | $3.00                   |\n| Rye           | $2.00         | $4.00                   |\n| Sourdough     | $2.50         | $5.00                   |\n\nThe bakery has a daily budget of $150 for ingredients and labor. The bakery has a limited oven space and can bake a maximum of 100 loaves per day. The bakery must produce at least 20 loaves of rye bread to meet a special order. The bakery has a contract to supply at least 30% of its total production as wheat bread. \n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\nmodel.addCons(obj == (3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves) - (1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves))\n\n# Add constraints\n## The bakery has a daily budget of $150 for ingredients and labor.\nmodel.addCons(1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150)\n## The bakery has a limited oven space and can bake a maximum of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must produce at least 20 loaves of rye bread to meet a special order.\nmodel.addCons(rye_loaves >= 20)\n## The bakery has a contract to supply at least 30% of its total production as wheat bread.\nmodel.addCons(wheat_loaves >= 0.30 * (wheat_loaves + rye_loaves + sourdough_loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively. The selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit.\n// Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n// Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\n// Objective Function: Maximize: Revenue - Cost\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $150 for ingredients and labor.\n// 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150\n\n## Generate Constraint-2:\nThe bakery has a limited oven space and can bake a maximum of 100 loaves per day.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 100\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a special order.\n// rye_loaves >= 20\n\n## Generate Constraint-4:\nThe bakery has a contract to supply at least 30% of its total production as wheat bread.\n// wheat_loaves >= 0.30 * (wheat_loaves + rye_loaves + sourdough_loaves)",
        "question": "A bakery wants to optimize its daily production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to produce based on the cost of ingredients, labor, and the potential profit per loaf. The cost of producing wheat, rye, and sourdough bread is $1.50, $2.00, and $2.50 per loaf respectively, while the selling price for each type of bread is $3.00, $4.00, and $5.00 per loaf respectively. The bakery aims to maximize its daily profit. The bakery has a daily budget of $150 for ingredients and labor. It has a limited oven space and can bake a maximum of 100 loaves per day. The bakery must produce at least 20 loaves of rye bread to meet a special order. Additionally, the bakery has a contract to supply at least 30% of its total production as wheat bread. Please help the bakery determine the optimal number of loaves to produce for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Cost = 1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves\n## Revenue = 3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves\nmodel.addCons(obj == (3.00*wheat_loaves + 4.00*rye_loaves + 5.00*sourdough_loaves) - (1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves))\n\n# Add constraints\n## The bakery has a daily budget of $150 for ingredients and labor.\nmodel.addCons(1.50*wheat_loaves + 2.00*rye_loaves + 2.50*sourdough_loaves <= 150)\n## The bakery has a limited oven space and can bake a maximum of 100 loaves per day.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 100)\n## The bakery must produce at least 20 loaves of rye bread to meet a special order.\nmodel.addCons(rye_loaves >= 20)\n## The bakery has a contract to supply at least 30% of its total production as wheat bread.\nmodel.addCons(wheat_loaves >= 0.30 * (wheat_loaves + rye_loaves + sourdough_loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 15*C + 25*D\n\n## Generate Constraint-1:\nThe total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\n// 5*A + 3*B + 2*C + 4*D <= 200\n\n## Generate Constraint-2:\nThe total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\n// 2*A + 4*B + 3*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-4:\nThe market demand for product B is at most 20 units.\n// B <= 20",
        "question": "A manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours. The profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The following table shows the raw materials and labor hours required for each product.\n\n| Product | Profit per Unit | Raw Materials Required | Labor Hours Required |\n|---------|-----------------|------------------------|----------------------|\n| A       | $30             | 5 units                | 2 hours              |\n| B       | $20             | 3 units                | 4 hours              |\n| C       | $15             | 2 units                | 3 hours              |\n| D       | $25             | 4 units                | 1 hour               |\n\nThe manufacturer has a total of 200 units of raw materials available and 100 labor hours available. The market demand for product A is at least 10 units, and the market demand for product B is at most 20 units. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 15*C + 25*D)\n\n# Add constraints\n## The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\nmodel.addCons(5*A + 3*B + 2*C + 4*D <= 200)\n## The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\nmodel.addCons(2*A + 4*B + 3*C + 1*D <= 100)\n## The market demand for product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for product B is at most 20 units.\nmodel.addCons(B <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The manufacturer needs to determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 15*C + 25*D\n\n## Generate Constraint-1:\nThe total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\n// 5*A + 3*B + 2*C + 4*D <= 200\n\n## Generate Constraint-2:\nThe total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\n// 2*A + 4*B + 3*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-4:\nThe market demand for product B is at most 20 units.\n// B <= 20",
        "question": "A manufacturer is planning to produce four types of products: A, B, C, and D. Each product requires a certain amount of raw materials and labor hours. The profit per unit for products A, B, C, and D is $30, $20, $15, and $25 respectively. The manufacturer wants to maximize the total profit from the production of these products. The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D, with a total of 200 units of raw materials available. The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D, with a total of 100 labor hours available. The market demand for product A is at least 10 units, and the market demand for product B is at most 20 units. Please help the manufacturer determine how many units of each product to produce to maximize profit while considering the availability of raw materials and labor hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 15*C + 25*D)\n\n# Add constraints\n## The total raw materials required for producing one unit of each product are 5 units for A, 3 units for B, 2 units for C, and 4 units for D. The manufacturer has a total of 200 units of raw materials available.\nmodel.addCons(5*A + 3*B + 2*C + 4*D <= 200)\n## The total labor hours required for producing one unit of each product are 2 hours for A, 4 hours for B, 3 hours for C, and 1 hour for D. The manufacturer has a total of 100 labor hours available.\nmodel.addCons(2*A + 4*B + 3*C + 1*D <= 100)\n## The market demand for product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for product B is at most 20 units.\nmodel.addCons(B <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 10*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours.\n// 5*A + 3*B + 2*C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10.\n// 20*A + 15*B + 10*C <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the company must meet this demand.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units in total across all products.\n// A + B + C >= 100",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently. The profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products. The production requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Cost per Unit |\n|---------|-----------------|----------------------|---------------|\n| A       | 30$             | 5 hours              | 20$           |\n| B       | 20$             | 3 hours              | 15$           |\n| C       | 10$             | 2 hours              | 10$           |\n\nThe company has a total of 1000 labor hours available and a budget constraint of $2000 for raw materials. The market demand for product A is at least 50 units, and the company must meet this demand. The company aims to produce at least 100 units in total across all products. Please help the company to maximize its total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 10*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*A + 3*B + 2*C <= 1000)\n## The company has a budget constraint of $2000 for raw materials.\nmodel.addCons(20*A + 15*B + 10*C <= 2000)\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n## The company aims to produce at least 100 units in total across all products.\nmodel.addCons(A + B + C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products.\n// Objective Function: Maximize: 30*A + 20*B + 10*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours.\n// 5*A + 3*B + 2*C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10.\n// 20*A + 15*B + 10*C <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, and the company must meet this demand.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units in total across all products.\n// A + B + C >= 100",
        "question": "A manufacturing company is planning to produce three types of products: A, B, and C. The company needs to decide how many units of each product to produce and how to allocate its limited resources efficiently. The profit per unit for products A, B, and C is $30, $20, and $10 respectively. The company aims to maximize its total profit from the production of these products.\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 5 hours, product B requires 3 hours, and product C requires 2 hours. The company has a budget constraint of $2000 for raw materials. Producing one unit of product A costs $20, product B costs $15, and product C costs $10. The market demand for product A is at least 50 units, and the company must meet this demand. The company aims to produce at least 100 units in total across all products.\nPlease help the company to maximize its total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 20*B + 10*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(5*A + 3*B + 2*C <= 1000)\n## The company has a budget constraint of $2000 for raw materials.\nmodel.addCons(20*A + 15*B + 10*C <= 2000)\n## The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n## The company aims to produce at least 100 units in total across all products.\nmodel.addCons(A + B + C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of Product B per day.\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints. The details of each product are given in the following Table.\n\n| Product | Production Cost | Selling Price | Maximum Daily Production Capacity |\n|---------|-----------------|---------------|-----------------------------------|\n| A       | $50             | $100          | 100 units                         |\n| B       | $70             | $120          | 150 units                         |\n| C       | $60             | $110          | 200 units                         |\n\nThe manufacturer aims to maximize the daily profit. The maximum daily production capacity for each product is as specified in the table. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A and at least 30 units of Product B per day.\n\nPlease help the manufacturer determine the optimal daily production quantities of each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n## The manufacturer must produce at least 30 units of Product B per day.\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of Product B per day.\n// B >= 30",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit. The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A per day and at least 30 units of Product B per day. Please help the manufacturer determine the daily production quantities of each product to maximize profit while considering these production constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n## The manufacturer must produce at least 30 units of Product B per day.\nmodel.addCons(B >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe demand for product C is at least 10 units per day.\n// C >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $5                       |\n| B       | $10                      |\n| C       | $8                       |\n\nThe production capacity of the company is limited to 100 units per day. The demand for product A is at least 20 units per day. The demand for product B is at least 15 units per day. The demand for product C is at least 10 units per day.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce daily to minimize the total daily production cost while meeting the demand and production capacity constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n## The demand for product C is at least 10 units per day.\nmodel.addCons(C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe demand for product C is at least 10 units per day.\n// C >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost. The production capacity of the company is limited to 100 units per day. The demand for product A is at least 20 units per day. The demand for product B is at least 15 units per day. The demand for product C is at least 10 units per day. Please help the company determine the optimal number of units of each product to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n## The demand for product C is at least 10 units per day.\nmodel.addCons(C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs.\n// {\"number of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Prod_C\", \"range\": \"Prod_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*Prod_A + 15*Prod_B + 20*Prod_C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 1000 units per day.\n// Prod_A + Prod_B + Prod_C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 300 units per day.\n// Prod_A >= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 200 units per day.\n// Prod_B >= 200\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of Product C as Product A.\n// Prod_C >= 2*Prod_A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs. The cost of producing one unit of each product is given in the following Table.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $10                      |\n| B       | $15                      |\n| C       | $20                      |\n\nThe production capacity of the company is limited to 1000 units per day. The market demand for Product A is at least 300 units per day, and for Product B is at least 200 units per day. The company has a policy to produce at least twice as many units of Product C as Product A. \n\nPlease help the company to minimize the total production cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # number of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # number of Product B produced\nProd_C = model.addVar(vtype=\"INTEGER\", name=\"Prod_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Prod_A + 15*Prod_B + 20*Prod_C)\n\n# Add constraints\n## The production capacity of the company is limited to 1000 units per day.\nmodel.addCons(Prod_A + Prod_B + Prod_C <= 1000)\n## The market demand for Product A is at least 300 units per day.\nmodel.addCons(Prod_A >= 300)\n## The market demand for Product B is at least 200 units per day.\nmodel.addCons(Prod_B >= 200)\n## The company has a policy to produce at least twice as many units of Product C as Product A.\nmodel.addCons(Prod_C >= 2*Prod_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Prod_A))\n    print(\"Number of Product B produced: \", model.getVal(Prod_B))\n    print(\"Number of Product C produced: \", model.getVal(Prod_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs.\n// {\"number of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Prod_C\", \"range\": \"Prod_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*Prod_A + 15*Prod_B + 20*Prod_C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 1000 units per day.\n// Prod_A + Prod_B + Prod_C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 300 units per day.\n// Prod_A >= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 200 units per day.\n// Prod_B >= 200\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of Product C as Product A.\n// Prod_C >= 2*Prod_A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while minimizing production costs. The cost of producing one unit of Product A, Product B, and Product C is $10, $15, and $20, respectively. The production capacity of the company is limited to 1000 units per day. The market demand for Product A is at least 300 units per day, and for Product B is at least 200 units per day. The company has a policy to produce at least twice as many units of Product C as Product A. Please help the company to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # number of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # number of Product B produced\nProd_C = model.addVar(vtype=\"INTEGER\", name=\"Prod_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Prod_A + 15*Prod_B + 20*Prod_C)\n\n# Add constraints\n## The production capacity of the company is limited to 1000 units per day.\nmodel.addCons(Prod_A + Prod_B + Prod_C <= 1000)\n## The market demand for Product A is at least 300 units per day.\nmodel.addCons(Prod_A >= 300)\n## The market demand for Product B is at least 200 units per day.\nmodel.addCons(Prod_B >= 200)\n## The company has a policy to produce at least twice as many units of Product C as Product A.\nmodel.addCons(Prod_C >= 2*Prod_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Prod_A))\n    print(\"Number of Product B produced: \", model.getVal(Prod_B))\n    print(\"Number of Product C produced: \", model.getVal(Prod_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 666,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 60)*B + (150 - 70)*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at most 200 units per week.\n// B <= 200\n\n## Generate Constraint-4:\nThe manufacturer must produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price |\n|---------|-----------------|---------------|\n| A       | $50             | $100          |\n| B       | $60             | $120          |\n| C       | $70             | $150          |\n\nThe total production capacity is limited to 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at most 200 units per week. The manufacturer must produce at least twice as many units of product C as product A.\n\nPlease help the manufacturer to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 60)*B + (150 - 70)*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per week.\nmodel.addCons(B <= 200)\n## The manufacturer must produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand.\n// {\"number of units of product A to produce\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B to produce\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C to produce\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 60)*B + (150 - 70)*C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at most 200 units per week.\n// B <= 200\n\n## Generate Constraint-4:\nThe manufacturer must produce at least twice as many units of product C as product A.\n// C >= 2*A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $50, $60, and $70 per unit, respectively. The selling price for product A, B, and C is $100, $120, and $150 per unit, respectively. The manufacturer wants to maximize the total profit. The total production capacity is limited to 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at most 200 units per week. The manufacturer must produce at least twice as many units of product C as product A. Please help the manufacturer determine the number of units to produce for each product to maximize profit while considering the available production capacity and market demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A to produce\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B to produce\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 60)*B + (150 - 70)*C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per week.\nmodel.addCons(B <= 200)\n## The manufacturer must produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A to produce: \", model.getVal(A))\n    print(\"Number of units of product B to produce: \", model.getVal(B))\n    print(\"Number of units of product C to produce: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300\n\n## Generate Constraint-4:\nThe demand for product C is at least 100 units per week and at most 400 units per week.\n// C >= 100\n// C <= 400",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand. The profit per unit for product A, B, and C is $50, $70, and $60, respectively. The following table summarizes the demand constraints for each product.\n\n| Product | Demand Minimum | Demand Maximum |\n|---------|----------------|----------------|\n| A       | 200 units      | -              |\n| B       | -              | 300 units      |\n| C       | 100 units      | 400 units      |\n\nThe total production capacity of the factory is 1000 units per week. The manufacturer aims to maximize the total profit from selling all products. Please help the manufacturer determine the optimal production quantity for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n## The demand for product C is at least 100 units per week and at most 400 units per week.\nmodel.addCons(C >= 100)\nmodel.addCons(C <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe total production capacity of the factory is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300\n\n## Generate Constraint-4:\nThe demand for product C is at least 100 units per week and at most 400 units per week.\n// C >= 100\n// C <= 400",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of production capacity and demand.\nThe profit per unit for product A, B, and C is $50, $70, and $60, respectively. The manufacturer aims to maximize the total profit from selling all products.\nThe total production capacity of the factory is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week. The demand for product C is at least 100 units per week and at most 400 units per week.\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the factory is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n## The demand for product C is at least 100 units per week and at most 400 units per week.\nmodel.addCons(C >= 100)\nmodel.addCons(C <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products.\n// Profit_A = (25 - 10) * A\n// Profit_B = (30 - 15) * B\n// Profit_C = (40 - 20) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\n// A <= 300\n// B <= 250\n// C <= 400\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 50 units of product A to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe manufacturer has a policy to produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price | Maximum Daily Demand |\n|---------|-----------------|---------------|----------------------|\n| A       | $10             | $25           | 300 units            |\n| B       | $15             | $30           | 250 units            |\n| C       | $20             | $40           | 400 units            |\n\nThe total production capacity of the manufacturer is 1000 units per day. The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively. The manufacturer must produce at least 50 units of product A to meet contractual obligations. Additionally, the manufacturer has a policy to produce at least twice as many units of product B as product A.\n\nPlease help the manufacturer to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\nmodel.addCons(A <= 300)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 400)\n## The manufacturer must produce at least 50 units of product A to meet contractual obligations.\nmodel.addCons(A >= 50)\n## The manufacturer has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products.\n// Profit_A = (25 - 10) * A\n// Profit_B = (30 - 15) * B\n// Profit_C = (40 - 20) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\n// A <= 300\n// B <= 250\n// C <= 400\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 50 units of product A to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe manufacturer has a policy to produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $10, $15, and $20 respectively, and the selling price is $25, $30, and $40 respectively. The manufacturer aims to maximize the total profit from selling these products. The total production capacity of the manufacturer is 1000 units per day. The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively. The manufacturer must produce at least 50 units of product A to meet contractual obligations. The manufacturer has a policy to produce at least twice as many units of product B as product A. Please help the manufacturer determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n## The maximum daily demand for product A, B, and C is 300, 250, and 400 units respectively.\nmodel.addCons(A <= 300)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 400)\n## The manufacturer must produce at least 50 units of product A to meet contractual obligations.\nmodel.addCons(A >= 50)\n## The manufacturer has a policy to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(A))\n    print(\"Quantity of product B produced: \", model.getVal(B))\n    print(\"Quantity of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (10-5)*A + (15-7)*B + (20-10)*C\n\n## Generate Constraint-1:\nThe total production capacity is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300\n\n## Generate Constraint-4:\nThe demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources.\n// C >= 100\n// C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints. The production cost and selling price for each product are given in the following Table.\n\n| Product | Production Cost | Selling Price |\n|---------|-----------------|---------------|\n| A       | $5              | $10           |\n| B       | $7              | $15           |\n| C       | $10             | $20           |\n\nThe total production capacity is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week. The demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources.\n\nPlease help the manufacturer to maximize the total profit by determining the optimal quantity of each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10-5)*A + (15-7)*B + (20-10)*C)\n\n# Add constraints\n## The total production capacity is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n## The demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources.\nmodel.addCons(C >= 100)\nmodel.addCons(C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the demand constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (10-5)*A + (15-7)*B + (20-10)*C\n\n## Generate Constraint-1:\nThe total production capacity is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for product A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe demand for product B is at most 300 units per week.\n// B <= 300\n\n## Generate Constraint-4:\nThe demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources.\n// C >= 100\n// C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost for product A, B, and C is $5, $7, and $10 respectively, and the selling price is $10, $15, and $20 respectively. The manufacturer wants to maximize the total profit. The total production capacity is 1000 units per week. The demand for product A is at least 200 units per week. The demand for product B is at most 300 units per week. The demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources. Please help the manufacturer determine the quantity of each product to maximize profit while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10-5)*A + (15-7)*B + (20-10)*C)\n\n# Add constraints\n## The total production capacity is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The demand for product A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The demand for product B is at most 300 units per week.\nmodel.addCons(B <= 300)\n## The demand for product C is at least 100 units per week, but the manufacturer can only produce up to 500 units of product C due to limited resources.\nmodel.addCons(C >= 100)\nmodel.addCons(C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 685,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\n// {\"quantity of product A\": \"A\", \"range\": \"0 <= A <= 1000\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"0 <= B <= 1500\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"0 <= C <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (50 - 30)*A + (70 - 40)*B + (60 - 35)*C\n// Objective Function: Maximize: 20*A + 30*B + 25*C\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 3000 units per day.\n// A + B + C <= 3000\n\n## Generate Constraint-2:\nThe maximum demand for product A is 1000 units per day.\n// A <= 1000\n\n## Generate Constraint-3:\nThe maximum demand for product B is 1500 units per day.\n// B <= 1500\n\n## Generate Constraint-4:\nThe maximum demand for product C is 2000 units per day.\n// C <= 2000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity. The selling price and production cost for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost | Maximum Demand |\n|---------|---------------|-----------------|----------------|\n| A       | $50           | $30             | 1000 units     |\n| B       | $70           | $40             | 1500 units     |\n| C       | $60           | $35             | 2000 units     |\n\nThe production capacity of the factory is limited to 3000 units per day. The maximum demand for product A is 1000 units per day, for product B is 1500 units per day, and for product C is 2000 units per day. \nPlease help the manufacturer to maximize the total profit, which is calculated as the difference between the selling price and the production cost for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=2000) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The production capacity of the factory is limited to 3000 units per day.\nmodel.addCons(A + B + C <= 3000)\n## The maximum demand for product A is 1000 units per day.\nmodel.addCons(A <= 1000)\n## The maximum demand for product B is 1500 units per day.\nmodel.addCons(B <= 1500)\n## The maximum demand for product C is 2000 units per day.\nmodel.addCons(C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\n// {\"quantity of product A\": \"A\", \"range\": \"0 <= A <= 1000\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"0 <= B <= 1500\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"0 <= C <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: (50 - 30)*A + (70 - 40)*B + (60 - 35)*C\n// Objective Function: Maximize: 20*A + 30*B + 25*C\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 3000 units per day.\n// A + B + C <= 3000\n\n## Generate Constraint-2:\nThe maximum demand for product A is 1000 units per day.\n// A <= 1000\n\n## Generate Constraint-3:\nThe maximum demand for product B is 1500 units per day.\n// B <= 1500\n\n## Generate Constraint-4:\nThe maximum demand for product C is 2000 units per day.\n// C <= 2000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the quantity of each product to maximize profit while meeting the maximum demand and considering the production capacity.\nThe selling price for product A, B, and C is $50, $70, and $60 respectively, and the production cost is $30 for A, $40 for B, and $35 for C. The manufacturer wants to maximize the total profit.\nThe production capacity of the factory is limited to 3000 units per day. The maximum demand for product A is 1000 units per day. The maximum demand for product B is 1500 units per day. The maximum demand for product C is 2000 units per day.\nPlease help the manufacturer determine the optimal quantity of each product to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=2000) # quantity of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*A + 30*B + 25*C)\n\n# Add constraints\n## The production capacity of the factory is limited to 3000 units per day.\nmodel.addCons(A + B + C <= 3000)\n## The maximum demand for product A is 1000 units per day.\nmodel.addCons(A <= 1000)\n## The maximum demand for product B is 1500 units per day.\nmodel.addCons(B <= 1500)\n## The maximum demand for product C is 2000 units per day.\nmodel.addCons(C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock.\n// {\"area of land for wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 180*Corn + 220*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\n// Soy >= 0.30 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-3:\nThe farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\n// Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-4:\nThe farmer has a contractual obligation to supply at least 10 acres of corn to a local processor.\n// Corn >= 10",
        "question": "A farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock. The profit per acre for each crop is given in the following Table.\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $180            |\n| Soybeans | $220            |\n| Barley   | $150            |\n\nThe total available land for planting is 100 acres. The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock. The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health. Additionally, the farmer has a contractual obligation to supply at least 10 acres of corn to a local processor.\n\nPlease help the farmer to maximize the total profit from these crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The area of land for each crop\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for corn\nSoy = model.addVar(vtype=\"CONTINUOUS\", name=\"Soy\", lb=0) # area of land for soybeans\nBarley = model.addVar(vtype=\"CONTINUOUS\", name=\"Barley\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 180*Corn + 220*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\nmodel.addCons(Soy >= 0.30 * (Wheat + Corn + Soy + Barley))\n## The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\nmodel.addCons(Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley))\n## The farmer has a contractual obligation to supply at least 10 acres of corn to a local processor.\nmodel.addCons(Corn >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for wheat: \", model.getVal(Wheat))\n    print(\"Area of land for corn: \", model.getVal(Corn))\n    print(\"Area of land for soybeans: \", model.getVal(Soy))\n    print(\"Area of land for barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The farmer wants to maximize the profit from these crops while considering the available land and the nutritional needs of the livestock.\n// {\"area of land for wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"Soy\", \"range\": \"Soy >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops.\n// Objective Function: Maximize: 200*Wheat + 180*Corn + 220*Soy + 150*Barley\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// Wheat + Corn + Soy + Barley <= 100\n\n## Generate Constraint-2:\nThe farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\n// Soy >= 0.30 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-3:\nThe farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\n// Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley)\n\n## Generate Constraint-4:\nThe farmer has a contractual obligation to supply at least 10 acres of corn to a local processor.\n// Corn >= 10",
        "question": "A farmer has a limited area of land and needs to decide how much of each of four crops (wheat, corn, soybeans, and barley) to plant. The profit per acre for wheat is $200, for corn is $180, for soybeans is $220, and for barley is $150. The farmer wants to maximize the total profit from these crops. The total available land for planting is 100 acres. The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock. The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health. Additionally, the farmer has a contractual obligation to supply at least 10 acres of corn to a local processor. Please help the farmer determine the optimal allocation of land for each crop to maximize profit while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The area of land for each crop\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for corn\nSoy = model.addVar(vtype=\"CONTINUOUS\", name=\"Soy\", lb=0) # area of land for soybeans\nBarley = model.addVar(vtype=\"CONTINUOUS\", name=\"Barley\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*Wheat + 180*Corn + 220*Soy + 150*Barley)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soy + Barley <= 100)\n## The farmer must ensure that at least 30% of the land is used for growing soybeans to meet the high protein needs of the livestock.\nmodel.addCons(Soy >= 0.30 * (Wheat + Corn + Soy + Barley))\n## The farmer must also ensure that the total area of wheat and barley combined does not exceed 40% of the total land area to maintain soil health.\nmodel.addCons(Wheat + Barley <= 0.40 * (Wheat + Corn + Soy + Barley))\n## The farmer has a contractual obligation to supply at least 10 acres of corn to a local processor.\nmodel.addCons(Corn >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for wheat: \", model.getVal(Wheat))\n    print(\"Area of land for corn: \", model.getVal(Corn))\n    print(\"Area of land for soybeans: \", model.getVal(Soy))\n    print(\"Area of land for barley: \", model.getVal(Barley))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50\n\n## Generate Constraint-4:\nThe demand for smartwatches is limited to 100 units per day.\n// W <= 100",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $80             |\n| Laptops      | $150            |\n| Smartwatches | $50             |\n\nThe company has the following constraints:\n- The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n- The market demand for smartphones and tablets combined should not exceed 300 units.\n- The company has a contract to produce at least 50 laptops per day.\n- The demand for smartwatches is limited to 100 units per day.\n\nPlease help the company to maximize its total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n## The demand for smartwatches is limited to 100 units per day.\nmodel.addCons(W <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50\n\n## Generate Constraint-4:\nThe demand for smartwatches is limited to 100 units per day.\n// W <= 100",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices. The production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units. The company has a contract to produce at least 50 laptops per day. The demand for smartwatches is limited to 100 units per day. Please help the company determine the optimal number of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n## The demand for smartwatches is limited to 100 units per day.\nmodel.addCons(W <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units per day.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50\n\n## Generate Constraint-4:\nThe production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units.\n// W <= (S + T) + 100",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for each device is as follows:\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $80             |\n| Laptops      | $150            |\n| Smartwatches | $50             |\n\nThe company has the following constraints:\n1. The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n2. The market demand for smartphones and tablets combined should not exceed 300 units per day.\n3. The company has a contract to produce at least 50 laptops per day.\n4. The production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units.\n\nPlease help the company to maximize its total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units per day.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n## The production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units.\nmodel.addCons(W <= (S + T) + 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones produced\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The company aims to maximize its total profit from the production of these devices.\n// Objective Function: Maximize: 100*S + 80*T + 150*L + 50*W\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\n// S + T + L + W <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 300 units per day.\n// S + T <= 300\n\n## Generate Constraint-3:\nThe company has a contract to produce at least 50 laptops per day.\n// L >= 50\n\n## Generate Constraint-4:\nThe production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units.\n// W <= (S + T) + 100",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to maximize profit while considering production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $80, for laptops is $150, and for smartwatches is $50. The production capacity of the factory limits the total number of devices that can be produced daily to 500 units. The market demand for smartphones and tablets combined should not exceed 300 units per day. The company has a contract to produce at least 50 laptops per day. The production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units. Please help the company to maximize its total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device produced\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones produced\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets produced\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops produced\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of smartwatches produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 80*T + 150*L + 50*W)\n\n# Add constraints\n## The production capacity of the factory limits the total number of devices that can be produced daily to 500 units.\nmodel.addCons(S + T + L + W <= 500)\n## The market demand for smartphones and tablets combined should not exceed 300 units per day.\nmodel.addCons(S + T <= 300)\n## The company has a contract to produce at least 50 laptops per day.\nmodel.addCons(L >= 50)\n## The production of smartwatches should not exceed the combined production of smartphones and tablets by more than 100 units.\nmodel.addCons(W <= (S + T) + 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced: \", model.getVal(S))\n    print(\"Number of tablets produced: \", model.getVal(T))\n    print(\"Number of laptops produced: \", model.getVal(L))\n    print(\"Number of smartwatches produced: \", model.getVal(W))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 100 units per week.\n// Laptops >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week. The market demand for tablets is at least 150 units per week. The market demand for laptops is at least 100 units per week.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce each week to maximize profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n## The market demand for laptops is at least 100 units per week.\nmodel.addCons(Laptops >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 100 units per week.\n// Laptops >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week. The market demand for tablets is at least 150 units per week. The market demand for laptops is at least 100 units per week. Please help the company to determine the optimal production numbers for each device to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n## The market demand for laptops is at least 100 units per week.\nmodel.addCons(Laptops >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per day.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 100000\n\n## Generate Constraint-4:\nThe labor cost for producing each smartphone is $30, for each tablet is $40, and for each laptop is $50. The total daily labor cost should not exceed $40,000.\n// 30*Smart + 40*Tablets + 50*Laptops <= 40000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The following table summarizes the costs associated with each device:\n\n| Device     | Profit per Unit | Raw Material Cost | Labor Cost |\n|------------|-----------------|-------------------|------------|\n| Smartphones| $100            | $50               | $30        |\n| Tablets    | $150            | $75               | $40        |\n| Laptops    | $200            | $100              | $50        |\n\nThe production capacity of the factory allows for a maximum of 1000 devices per day. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $100,000 per day. The total daily labor cost should not exceed $40,000.\n\nPlease help the company to maximize the total profit from the production of these devices, considering all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per day.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $100,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 100000)\n## The total daily labor cost should not exceed $40,000.\nmodel.addCons(30*Smart + 40*Tablets + 50*Laptops <= 40000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per day.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\n// Smart >= 200\n// Tablets + Laptops <= 500\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 100000\n\n## Generate Constraint-4:\nThe labor cost for producing each smartphone is $30, for each tablet is $40, and for each laptop is $50. The total daily labor cost should not exceed $40,000.\n// 30*Smart + 40*Tablets + 50*Laptops <= 40000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 1000 devices per day. The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day. The company has a limited budget for raw materials, which is $100,000 per day. The cost of raw materials for each smartphone is $50, for each tablet is $75, and for each laptop is $100. The labor cost for producing each smartphone is $30, for each tablet is $40, and for each laptop is $50. The total daily labor cost should not exceed $40,000. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per day.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets and laptops combined should not exceed 500 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets + Laptops <= 500)\n## The company has a limited budget for raw materials, which is $100,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 100000)\n## The total daily labor cost should not exceed $40,000.\nmodel.addCons(30*Smart + 40*Tablets + 50*Laptops <= 40000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap\n\n## Generate Constraint-1:\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n\n## Generate Constraint-2:\nThe total production cannot exceed 800 units per day across all devices.\n// Smart + Tab + Lap <= 800\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 50\n\n## Generate Constraint-4:\nThe availability of a critical component used in all devices is limited to 1200 units per day. Each smartphone requires 1 unit, each tablet requires 2 units, and each laptop requires 3 units of this component.\n// Smart + 2*Tab + 3*Lap <= 1200",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n\n| Device     | Profit per Unit | Production Limit per Day | Component Units Required |\n|------------|-----------------|--------------------------|--------------------------|\n| Smartphones | $100            | 500                      | 1                        |\n| Tablets     | $150            | 300                      | 2                        |\n| Laptops     | $200            | 200                      | 3                        |\n\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops. The total production cannot exceed 800 units per day across all devices. The company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations. The availability of a critical component used in all devices is limited to 1200 units per day. Each smartphone requires 1 unit, each tablet requires 2 units, and each laptop requires 3 units of this component.\n\nPlease help the company to maximize its total profit from selling these devices while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\n## Total production constraint\nmodel.addCons(Smart + Tab + Lap <= 800)\n## Minimum daily production requirements\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 50)\n## Component availability constraint\nmodel.addCons(Smart + 2*Tab + 3*Lap <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1551,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tab\", \"range\": \"Tab >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Lap\", \"range\": \"Lap >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tab + 200*Lap\n\n## Generate Constraint-1:\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops.\n// Smart <= 500\n// Tab <= 300\n// Lap <= 200\n\n## Generate Constraint-2:\nThe total production cannot exceed 800 units per day across all devices.\n// Smart + Tab + Lap <= 800\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations.\n// Smart >= 100\n// Tab >= 50\n// Lap >= 50\n\n## Generate Constraint-4:\nThe availability of a critical component used in all devices is limited to 1200 units per day. Each smartphone requires 1 unit, each tablet requires 2 units, and each laptop requires 3 units of this component.\n// Smart + 2*Tab + 3*Lap <= 1200",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to maximize profit while considering production constraints and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize its total profit from selling these devices.\nThe production capacity is limited to 500 units per day for smartphones, 300 units per day for tablets, and 200 units per day for laptops. The total production cannot exceed 800 units per day across all devices. The company has a minimum daily production requirement of 100 units for smartphones and 50 units for both tablets and laptops to meet contractual obligations. The availability of a critical component used in all devices is limited to 1200 units per day, with each smartphone requiring 1 unit, each tablet requiring 2 units, and each laptop requiring 3 units of this component.\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tab), and laptops (Lap) to maximize profit, ensuring all constraints are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTab = model.addVar(vtype=\"INTEGER\", name=\"Tab\", lb=0) # number of tablets\nLap = model.addVar(vtype=\"INTEGER\", name=\"Lap\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tab + 200*Lap)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(Smart <= 500)\nmodel.addCons(Tab <= 300)\nmodel.addCons(Lap <= 200)\n## Total production constraint\nmodel.addCons(Smart + Tab + Lap <= 800)\n## Minimum daily production requirements\nmodel.addCons(Smart >= 100)\nmodel.addCons(Tab >= 50)\nmodel.addCons(Lap >= 50)\n## Component availability constraint\nmodel.addCons(Smart + 2*Tab + 3*Lap <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tab))\n    print(\"Number of laptops: \", model.getVal(Lap))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 20 units per day.\n// Laptops >= 20",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day. The market demand for tablets is at least 50 units per day. The market demand for laptops is at least 20 units per day.\n\nPlease help the company to determine the optimal number of each device to produce to maximize profit while adhering to these constraints.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $150            |\n| Laptops      | $200            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n## The market demand for laptops is at least 20 units per day.\nmodel.addCons(Laptops >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 20 units per day.\n// Laptops >= 20",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day. The market demand for tablets is at least 50 units per day. The market demand for laptops is at least 20 units per day. Please help the company determine the optimal production quantities for each device to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n## The market demand for laptops is at least 20 units per day.\nmodel.addCons(Laptops >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The total daily supply of flour is 150 kg.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 10 minutes of labor. The bakery has a total of 12 hours of labor available daily.\n// (10/60)*Wheat + (10/60)*Rye <= 12\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance in its product mix. The number of rye bread loaves produced should not exceed twice the number of wheat bread loaves produced.\n// Rye <= 2*Wheat",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Labor Time (minutes) |\n|------------|-----------------|------------------------|----------------------|\n| Wheat      | $3              | 0.5                    | 10                   |\n| Rye        | $4              | 0.6                    | 10                   |\n\nThe bakery has a limited supply of flour, with a total daily supply of 150 kg. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The bakery has a daily demand constraint, requiring it to produce at least 50 loaves of wheat bread and 40 loaves of rye bread. The bakery also has a labor constraint, with a total of 12 hours of labor available daily. Each loaf of bread requires 10 minutes of labor. Additionally, the bakery aims to maintain a balance in its product mix, with the number of rye bread loaves produced not exceeding twice the number of wheat bread loaves produced.\n\nPlease help the bakery maximize its daily profit from bread sales, considering all these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nFlour_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Flour_Wheat\", lb=0) # number of flour used for wheat bread\nFlour_Rye = model.addVar(vtype=\"INTEGER\", name=\"Flour_Rye\", lb=0) # number of flour used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## The bakery has a daily demand constraint.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a labor constraint.\nmodel.addCons((10/60)*Wheat + (10/60)*Rye <= 12)\n## The bakery aims to maintain a balance in its product mix.\nmodel.addCons(Rye <= 2*Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1461,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for wheat bread\": \"Flour_Wheat\", \"range\": \"Flour_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of flour used for rye bread\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour. The total daily supply of flour is 150 kg.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nThe bakery has a daily demand constraint. It must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-3:\nThe bakery has a labor constraint. Each loaf of bread requires 10 minutes of labor. The bakery has a total of 12 hours of labor available daily.\n// (10/60)*Wheat + (10/60)*Rye <= 12\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance in its product mix. The number of rye bread loaves produced should not exceed twice the number of wheat bread loaves produced.\n// Rye <= 2*Wheat",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit, given the constraints of ingredients and demand. The profit from selling each loaf of wheat bread is $3, and the profit from selling each loaf of rye bread is $4. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.6 kg of flour, and a total daily supply of flour is 150 kg. The bakery must produce at least 50 loaves of wheat bread and 40 loaves of rye bread to meet customer demand. Each loaf of bread requires 10 minutes of labor, and the bakery has a total of 12 hours of labor available daily. The bakery aims to maintain a balance in its product mix, where the number of rye bread loaves produced should not exceed twice the number of wheat bread loaves produced. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n## The amount of flour used for each type of bread\nFlour_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Flour_Wheat\", lb=0) # number of flour used for wheat bread\nFlour_Rye = model.addVar(vtype=\"INTEGER\", name=\"Flour_Rye\", lb=0) # number of flour used for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## The bakery has a daily demand constraint.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery has a labor constraint.\nmodel.addCons((10/60)*Wheat + (10/60)*Rye <= 12)\n## The bakery aims to maintain a balance in its product mix.\nmodel.addCons(Rye <= 2*Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donut\", \"range\": \"Donut >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.60*Muffin + 0.70*Donut\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each donut requires 0.3 pounds.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each donut requires 0.15 pounds.\n// 0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.5 hours to prepare, each muffin requires 0.4 hours, and each donut requires 0.6 hours.\n// 0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 units of each type of pastry daily to meet customer demand.\n// Croissant >= 50, Muffin >= 50, Donut >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours. The profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery has a daily limit of 100 pounds of flour, with each croissant requiring 0.1 pounds, each muffin requiring 0.2 pounds, and each donut requiring 0.3 pounds. The bakery also has a daily limit of 50 pounds of sugar, with each croissant requiring 0.05 pounds, each muffin requiring 0.1 pounds, and each donut requiring 0.15 pounds. Additionally, the bakery has a daily limit of 80 labor hours, with each croissant requiring 0.5 hours to prepare, each muffin requiring 0.4 hours, and each donut requiring 0.6 hours. The bakery must produce at least 50 units of each type of pastry daily to meet customer demand.\n\nPlease help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nDonut = model.addVar(vtype=\"INTEGER\", name=\"Donut\", lb=0) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.60*Muffin + 0.70*Donut)\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100)\n## The bakery has a daily limit of 50 pounds of sugar.\nmodel.addCons(0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80)\n## The bakery must produce at least 50 units of each type of pastry daily to meet customer demand.\nmodel.addCons(Croissant >= 50)\nmodel.addCons(Muffin >= 50)\nmodel.addCons(Donut >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of donuts: \", model.getVal(Donut))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Donut\", \"range\": \"Donut >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.60*Muffin + 0.70*Donut\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 100 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, and each donut requires 0.3 pounds.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 50 pounds of sugar. Each croissant requires 0.05 pounds of sugar, each muffin requires 0.1 pounds, and each donut requires 0.15 pounds.\n// 0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily limit of 80 labor hours. Each croissant requires 0.5 hours to prepare, each muffin requires 0.4 hours, and each donut requires 0.6 hours.\n// 0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 units of each type of pastry daily to meet customer demand.\n// Croissant >= 50, Muffin >= 50, Donut >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide the optimal number of each type of pastry to produce daily to maximize profit while considering the limited ingredients and labor hours. The profit per croissant is $0.50, per muffin is $0.60, and per donut is $0.70. The bakery has a daily limit of 100 pounds of flour, with each croissant requiring 0.1 pounds, each muffin requiring 0.2 pounds, and each donut requiring 0.3 pounds. The bakery also has a daily limit of 50 pounds of sugar, with each croissant requiring 0.05 pounds, each muffin requiring 0.1 pounds, and each donut requiring 0.15 pounds. Additionally, the bakery has a daily limit of 80 labor hours, with each croissant requiring 0.5 hours to prepare, each muffin requiring 0.4 hours, and each donut requiring 0.6 hours. The bakery must produce at least 50 units of each type of pastry daily to meet customer demand. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nDonut = model.addVar(vtype=\"INTEGER\", name=\"Donut\", lb=0) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.60*Muffin + 0.70*Donut)\n\n# Add constraints\n## The bakery has a daily limit of 100 pounds of flour.\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Donut <= 100)\n## The bakery has a daily limit of 50 pounds of sugar.\nmodel.addCons(0.05*Croissant + 0.1*Muffin + 0.15*Donut <= 50)\n## The bakery has a daily limit of 80 labor hours.\nmodel.addCons(0.5*Croissant + 0.4*Muffin + 0.6*Donut <= 80)\n## The bakery must produce at least 50 units of each type of pastry daily to meet customer demand.\nmodel.addCons(Croissant >= 50)\nmodel.addCons(Muffin >= 50)\nmodel.addCons(Donut >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of donuts: \", model.getVal(Donut))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\n// 0.2*Wheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-4:\nThe bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff.\n// Labor <= 20",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table outlines the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Flour Required (pounds) | Labor Required (hours) |\n|------------|------------------|-------------------------|-------------------------|\n| Wheat      | $2               | 0.5                     | 0.2                    |\n| Rye        | $3               | 0.6                     | 0.3                    |\n\nThe bakery has a daily supply of 150 pounds of flour and a daily labor capacity of 30 hours. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand. Additionally, the bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of wheat and rye breads to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nLabor = model.addVar(vtype=\"INTEGER\", name=\"Labor\", lb=0) # number of hours of labor\nFlour = model.addVar(vtype=\"INTEGER\", name=\"Flour\", lb=0) # number of pounds of flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 30)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff.\nmodel.addCons(Labor <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of hours of labor: \", model.getVal(Labor))\n    print(\"Number of pounds of flour: \", model.getVal(Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\n// 0.5*Wheat + 0.6*Rye <= 150\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\n// 0.2*Wheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\n// Wheat >= 50\n// Rye >= 40\n\n## Generate Constraint-4:\nThe bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff.\n// Labor <= 20",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour. Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours. The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand. The bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nLabor = model.addVar(vtype=\"INTEGER\", name=\"Labor\", lb=0) # number of hours of labor\nFlour = model.addVar(vtype=\"INTEGER\", name=\"Flour\", lb=0) # number of pounds of flour\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 pounds of flour, and each rye bread requires 0.6 pounds of flour. The bakery has a daily supply of 150 pounds of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 150)\n## Each wheat bread requires 0.2 hours of labor, and each rye bread requires 0.3 hours of labor. The bakery has a daily labor capacity of 30 hours.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 30)\n## The bakery must produce at least 50 wheat breads and 40 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 40)\n## The bakery should not exceed 20 hours of labor per day to ensure quality and avoid overworking staff.\nmodel.addCons(Labor <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of hours of labor: \", model.getVal(Labor))\n    print(\"Number of pounds of flour: \", model.getVal(Flour))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclair\", \"range\": \"Eclair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin + 1.00*Eclair\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 eggs, and each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs.\n// Croissant + 2*Muffin + 3*Eclair <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 1500 pastries.\n// Croissant + Muffin + Eclair <= 1500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 of each type of pastry daily to meet contractual obligations.\n// Croissant >= 100, Muffin >= 100, Eclair >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The following table summarizes the requirements for each type of pastry:\n\n| Pastry   | Profit per Unit | Egg Requirement | Flour Requirement |\n|----------|-----------------|-----------------|------------------|\n| Croissant| $0.50           | 1 egg           | 0.1 kg           |\n| Muffin   | $0.70           | 2 eggs          | 0.2 kg           |\n| Eclair   | $1.00           | 3 eggs          | 0.3 kg           |\n\nThe bakery has a daily limit of 500 eggs and 100 kg of flour. The bakery also has a daily production capacity of 1500 pastries. Additionally, the bakery must produce at least 100 of each type of pastry daily to meet contractual obligations. Please help the bakery maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nEclair = model.addVar(vtype=\"INTEGER\", name=\"Eclair\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin + 1.00*Eclair)\n\n# Add constraints\n## The bakery has a daily limit of 500 eggs\nmodel.addCons(Croissant + 2*Muffin + 3*Eclair <= 500)\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100)\n## The bakery has a daily production capacity of 1500 pastries\nmodel.addCons(Croissant + Muffin + Eclair <= 1500)\n## The bakery must produce at least 100 of each type of pastry daily\nmodel.addCons(Croissant >= 100)\nmodel.addCons(Muffin >= 100)\nmodel.addCons(Eclair >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of eclairs: \", model.getVal(Eclair))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs\": \"Eclair\", \"range\": \"Eclair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin + 1.00*Eclair\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 eggs, and each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs.\n// Croissant + 2*Muffin + 3*Eclair <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 100 kg of flour, and each croissant requires 0.1 kg, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 1500 pastries.\n// Croissant + Muffin + Eclair <= 1500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 of each type of pastry daily to meet contractual obligations.\n// Croissant >= 100, Muffin >= 100, Eclair >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The profit per croissant is $0.50, per muffin is $0.70, and per eclair is $1.00. The bakery has a daily limit of 500 eggs, where each croissant requires 1 egg, each muffin requires 2 eggs, and each eclair requires 3 eggs. The bakery also has a daily limit of 100 kg of flour, with each croissant requiring 0.1 kg, each muffin requiring 0.2 kg, and each eclair requiring 0.3 kg. The bakery's daily production capacity is 1500 pastries. Additionally, the bakery must produce at least 100 of each type of pastry daily to meet contractual obligations. Please help the bakery maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\nEclair = model.addVar(vtype=\"INTEGER\", name=\"Eclair\", lb=0) # number of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin + 1.00*Eclair)\n\n# Add constraints\n## The bakery has a daily limit of 500 eggs\nmodel.addCons(Croissant + 2*Muffin + 3*Eclair <= 500)\n## The bakery has a daily limit of 100 kg of flour\nmodel.addCons(0.1*Croissant + 0.2*Muffin + 0.3*Eclair <= 100)\n## The bakery has a daily production capacity of 1500 pastries\nmodel.addCons(Croissant + Muffin + Eclair <= 1500)\n## The bakery must produce at least 100 of each type of pastry daily\nmodel.addCons(Croissant >= 100)\nmodel.addCons(Muffin >= 100)\nmodel.addCons(Eclair >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Croissant))\n    print(\"Number of muffins: \", model.getVal(Muffin))\n    print(\"Number of eclairs: \", model.getVal(Eclair))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 20*Choc + 18*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\n// 2*Choc + 1.5*Van <= 80\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\n// Choc + 0.8*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\n// Choc >= 10, Van >= 15\n\n## Generate Constraint-4:\nThe total number of cakes produced each day should not exceed 30 to maintain quality standards.\n// Choc + Van <= 30",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor. The selling price for each chocolate cake is $20 and for each vanilla cake is $18. The following table summarizes the labor and sugar requirements for each type of cake.\n\n| Cake Type | Selling Price | Labor per Cake | Sugar per Cake |\n|-----------|---------------|----------------|----------------|\n| Chocolate | $20           | 2 hours        | 1 pound        |\n| Vanilla   | $18           | 1.5 hours      | 0.8 pounds     |\n\nThe bakery has a maximum of 80 hours of labor and 60 pounds of sugar available each day. The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand. Additionally, the total number of cakes produced each day should not exceed 30 to maintain quality standards.\n\nPlease help the bakery to maximize its daily revenue from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*Choc + 18*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\nmodel.addCons(2*Choc + 1.5*Van <= 80)\n## Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\nmodel.addCons(Choc + 0.8*Van <= 60)\n## The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\nmodel.addCons(Choc >= 10)\nmodel.addCons(Van >= 15)\n## The total number of cakes produced each day should not exceed 30 to maintain quality standards.\nmodel.addCons(Choc + Van <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales.\n// Objective Function: Maximize: 20*Choc + 18*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\n// 2*Choc + 1.5*Van <= 80\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\n// Choc + 0.8*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\n// Choc >= 10, Van >= 15\n\n## Generate Constraint-4:\nThe total number of cakes produced each day should not exceed 30 to maintain quality standards.\n// Choc + Van <= 30",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the limited availability of ingredients and labor. Each chocolate cake sells for $20 and each vanilla cake sells for $18. The bakery aims to maximize its daily revenue from cake sales. Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day. Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day. The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand. The total number of cakes produced each day should not exceed 30 to maintain quality standards. Please help the bakery to maximize its daily revenue from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*Choc + 18*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 80 hours of labor available each day.\nmodel.addCons(2*Choc + 1.5*Van <= 80)\n## Each chocolate cake requires 1 pound of sugar and each vanilla cake requires 0.8 pounds of sugar. The bakery has a maximum of 60 pounds of sugar available each day.\nmodel.addCons(Choc + 0.8*Van <= 60)\n## The bakery must produce at least 10 chocolate cakes and 15 vanilla cakes each day to meet minimum customer demand.\nmodel.addCons(Choc >= 10)\nmodel.addCons(Van >= 15)\n## The total number of cakes produced each day should not exceed 30 to maintain quality standards.\nmodel.addCons(Choc + Van <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The total daily supply of flour is 100 kg.\n// 0.5*Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each loaf of bread requires 0.1 hours of oven time. The total daily oven time available is 15 hours.\n// 0.1*Wheat + 0.1*Rye <= 15\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat bread is 50 loaves, and for rye bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe bakery aims to balance its product mix. It has been decided that the number of rye bread loaves should not exceed the number of wheat bread loaves by more than 20.\n// Rye - Wheat <= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand. The profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Oven Time (hours) |\n|------------|-----------------|------------------------|-------------------|\n| Wheat      | $3              | 0.5                    | 0.1               |\n| Rye        | $4              | 0.4                    | 0.1               |\n\nThe bakery has a limited supply of flour, with a total daily supply of 100 kg. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The bakery also has a limited oven capacity, with a total daily oven time available of 15 hours. Each loaf of bread requires 0.1 hours of oven time. The bakery must meet a minimum daily demand for each type of bread: 50 loaves for wheat bread and 30 loaves for rye bread. Additionally, the bakery aims to balance its product mix, ensuring that the number of rye bread loaves does not exceed the number of wheat bread loaves by more than 20.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 100)\n## The bakery has a limited oven capacity.\nmodel.addCons(0.1*Wheat + 0.1*Rye <= 15)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The bakery aims to balance its product mix.\nmodel.addCons(Rye - Wheat <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1452,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.4 kg of flour. The total daily supply of flour is 100 kg.\n// 0.5*Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity. Each loaf of bread requires 0.1 hours of oven time. The total daily oven time available is 15 hours.\n// 0.1*Wheat + 0.1*Rye <= 15\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat bread is 50 loaves, and for rye bread is 30 loaves.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe bakery aims to balance its product mix. It has been decided that the number of rye bread loaves should not exceed the number of wheat bread loaves by more than 20.\n// Rye - Wheat <= 20",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and market demand. The profit from selling a loaf of wheat bread is $3, and the profit from selling a loaf of rye bread is $4. The bakery has a limited supply of flour, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.4 kg of flour, and the total daily supply of flour is 100 kg. The bakery also has a limited oven capacity, with each loaf of bread requiring 0.1 hours of oven time, and the total daily oven time available is 15 hours. The bakery must meet a minimum daily demand for each type of bread, with the minimum demand for wheat bread being 50 loaves and for rye bread being 30 loaves. Additionally, the bakery aims to balance its product mix, ensuring that the number of rye bread loaves does not exceed the number of wheat bread loaves by more than 20. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye <= 100)\n## The bakery has a limited oven capacity.\nmodel.addCons(0.1*Wheat + 0.1*Rye <= 15)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The bakery aims to balance its product mix.\nmodel.addCons(Rye - Wheat <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, and the profit from each muffin is $0.70. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries daily to meet the minimum order requirements.\n// Croissant + Muffin >= 50\n\n## Generate Constraint-4:\nThe bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix.\n// Muffin <= 2*Croissant",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit from each croissant is $0.50, and the profit from each muffin is $0.70. The following table summarizes the requirements for each type of pastry:\n\n| Pastry   | Labor (hours) | Flour (pounds) |\n|----------|---------------|----------------|\n| Croissant| 0.1           | 0.05           |\n| Muffin   | 0.2           | 0.1            |\n\nThe bakery has a maximum of 8 hours of labor and 5 pounds of flour available daily. The bakery must produce at least 50 pastries daily to meet the minimum order requirements. Additionally, the bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix.\n\nPlease help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 5)\n## The bakery must produce at least 50 pastries daily to meet the minimum order requirements.\nmodel.addCons(Croissant + Muffin >= 50)\n## The bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix.\nmodel.addCons(Muffin <= 2*Croissant)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each croissant is $0.50, and the profit from each muffin is $0.70. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries daily to meet the minimum order requirements.\n// Croissant + Muffin >= 50\n\n## Generate Constraint-4:\nThe bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix.\n// Muffin <= 2*Croissant",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and labor. The profit from each croissant is $0.50, and the profit from each muffin is $0.70. Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily. Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily. The bakery must produce at least 50 pastries daily to meet the minimum order requirements. The bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix. Please help the bakery to maximize its daily profit from selling pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor and each muffin requires 0.2 hours of labor. The bakery has a maximum of 8 hours of labor available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant requires 0.05 pounds of flour and each muffin requires 0.1 pounds of flour. The bakery has a maximum of 5 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 5)\n## The bakery must produce at least 50 pastries daily to meet the minimum order requirements.\nmodel.addCons(Croissant + Muffin >= 50)\n## The bakery must ensure that the number of muffins produced does not exceed twice the number of croissants to maintain a balanced product mix.\nmodel.addCons(Muffin <= 2*Croissant)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each donut requires 0.15 kg, and each mixed box requires 0.1 kg of each pastry.\n// 0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each donut requires 0.08 kg, and each mixed box requires 0.05 kg of each pastry.\n// 0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\n// Cro >= 100, Muff >= 80, Don >= 120\n\n## Generate Constraint-4:\nThe bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined.\n// Cro + Muff + Don + Mix <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space. The profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n\n| Pastry/Box | Profit per Unit | Flour Required (kg) | Sugar Required (kg) |\n|------------|-----------------|---------------------|---------------------|\n| Croissant  | $0.50           | 0.1                 | 0.05                |\n| Muffin     | $0.60           | 0.2                 | 0.1                 |\n| Donut      | $0.70           | 0.15                | 0.08                |\n| Mixed Box  | $2.00           | 0.1*(Cro+Muff+Don)  | 0.05*(Cro+Muff+Don) |\n\nThe bakery has a daily supply of 100 kg of flour and 50 kg of sugar. The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts. The bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined.\n\nPlease help the bakery to determine the optimal number of each type of pastry and the mixed box to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry and the mixed box\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100)\n## The bakery has a daily supply of 50 kg of sugar.\nmodel.addCons(0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50)\n## The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 80)\nmodel.addCons(Don >= 120)\n## The bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined.\nmodel.addCons(Cro + Muff + Don + Mix <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muff\", \"range\": \"Muff >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each donut requires 0.15 kg, and each mixed box requires 0.1 kg of each pastry.\n// 0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 50 kg of sugar. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each donut requires 0.08 kg, and each mixed box requires 0.05 kg of each pastry.\n// 0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\n// Cro >= 100, Muff >= 80, Don >= 120\n\n## Generate Constraint-4:\nThe bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined.\n// Cro + Muff + Don + Mix <= 200",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts, and also offers a mixed box containing equal amounts of each pastry. The bakery needs to determine the optimal number of each type of pastry and the mixed box to maximize profit while considering the limited ingredients and storage space. The profit per croissant is $0.50, per muffin is $0.60, per donut is $0.70, and per mixed box is $2.00. The bakery has a daily supply of 100 kg of flour and 50 kg of sugar. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, each donut requires 0.15 kg of flour and 0.08 kg of sugar, and each mixed box requires 0.1 kg of flour and 0.05 kg of sugar for each pastry. The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts. The bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry and the mixed box\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuff = model.addVar(vtype=\"INTEGER\", name=\"Muff\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muff + 0.70*Don + 2.00*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.1*Cro + 0.2*Muff + 0.15*Don + 0.1*(Cro + Muff + Don) <= 100)\n## The bakery has a daily supply of 50 kg of sugar.\nmodel.addCons(0.05*Cro + 0.1*Muff + 0.08*Don + 0.05*(Cro + Muff + Don) <= 50)\n## The bakery has a daily demand for at least 100 croissants, 80 muffins, and 120 donuts.\nmodel.addCons(Cro >= 100)\nmodel.addCons(Muff >= 80)\nmodel.addCons(Don >= 120)\n## The bakery has limited storage space and can only produce a maximum of 200 units of pastries and mixed boxes combined.\nmodel.addCons(Cro + Muff + Don + Mix <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muff))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for whole wheat\": \"Oven_WholeWheat\", \"range\": \"Oven_WholeWheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\n// WholeWheat + 0.8*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread in total.\n// WholeWheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order.\n// Rye >= 20",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour. The profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Space per Loaf | Flour per Loaf |\n|------------|-----------------|---------------------|----------------|\n| Whole Wheat | $2              | 0.5 square feet     | 1 pound        |\n| Rye        | $3              | 0.4 square feet     | 0.8 pounds     |\n\nThe bakery has a total oven space of 100 square feet available daily. The bakery has a daily supply of 150 pounds of flour. The bakery has a minimum daily production requirement of 50 loaves of bread in total. The bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Oven space used for each type of bread\nOven_WholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_WholeWheat\", lb=0) # oven space used for whole wheat\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\nmodel.addCons(WholeWheat + 0.8*Rye <= 150)\n## The bakery has a minimum daily production requirement of 50 loaves of bread in total.\nmodel.addCons(WholeWheat + Rye >= 50)\n## The bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order.\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven space used for whole wheat\": \"Oven_WholeWheat\", \"range\": \"Oven_WholeWheat >= 0\", \"type\": \"real\"}\n// {\"oven space used for rye\": \"Oven_Rye\", \"range\": \"Oven_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\n// WholeWheat + 0.8*Rye <= 150\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread in total.\n// WholeWheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order.\n// Rye >= 20",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited resources such as oven space and flour. The profit from selling each loaf of whole wheat bread is $2, and the profit from selling each loaf of rye bread is $3. Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet. The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour. The bakery has a minimum daily production requirement of 50 loaves of bread in total. The bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Oven space used for each type of bread\nOven_WholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_WholeWheat\", lb=0) # oven space used for whole wheat\nOven_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Rye\", lb=0) # oven space used for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 square feet of oven space, and each loaf of rye bread requires 0.4 square feet of oven space. The total oven space available daily is 100 square feet.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## The bakery has a daily supply of 150 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.8 pounds of flour.\nmodel.addCons(WholeWheat + 0.8*Rye <= 150)\n## The bakery has a minimum daily production requirement of 50 loaves of bread in total.\nmodel.addCons(WholeWheat + Rye >= 50)\n## The bakery must produce at least 20 loaves of rye bread daily to meet a specific customer's order.\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour required for whole wheat\": \"Flour_WW\", \"range\": \"Flour_WW >= 0\", \"type\": \"real\"}\n// {\"flour required for rye\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 1.5*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour.\n// Flour_WW = WholeWheat\n// Flour_Rye = 0.75*Rye\n// Flour_WW + Flour_Rye <= 200\n\n## Generate Constraint-2:\nThe bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing.\n// WholeWheat + Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 50\n// Rye >= 50\n\n## Generate Constraint-4:\nThe bakery has a limited amount of yeast, which is used in both types of bread. Each loaf of bread requires 0.02 pounds of yeast. The total yeast available daily is 3 pounds.\n// 0.02*(WholeWheat + Rye) <= 3",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand. The profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf | Yeast Required per Loaf |\n|------------|-----------------|-------------------------|-------------------------|\n| Whole Wheat | $2              | 1 pound                 | 0.02 pounds             |\n| Rye        | $1.50           | 0.75 pounds             | 0.02 pounds             |\n\nThe bakery has a daily supply of 200 pounds of flour and a total of 3 pounds of yeast. The bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Flour required for each type of bread\nFlour_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_WW\", lb=0) # flour required for whole wheat\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour required for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 1.5*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(Flour_WW == WholeWheat)\nmodel.addCons(Flour_Rye == 0.75*Rye)\nmodel.addCons(Flour_WW + Flour_Rye <= 200)\n## The bakery can only bake a maximum of 150 loaves of bread per day.\nmodel.addCons(WholeWheat + Rye <= 150)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 50)\n## The bakery has a limited amount of yeast.\nmodel.addCons(0.02*(WholeWheat + Rye) <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"flour required for whole wheat\": \"Flour_WW\", \"range\": \"Flour_WW >= 0\", \"type\": \"real\"}\n// {\"flour required for rye\": \"Flour_Rye\", \"range\": \"Flour_Rye >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*WholeWheat + 1.5*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour.\n// Flour_WW = WholeWheat\n// Flour_Rye = 0.75*Rye\n// Flour_WW + Flour_Rye <= 200\n\n## Generate Constraint-2:\nThe bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing.\n// WholeWheat + Rye <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 50\n// Rye >= 50\n\n## Generate Constraint-4:\nThe bakery has a limited amount of yeast, which is used in both types of bread. Each loaf of bread requires 0.02 pounds of yeast. The total yeast available daily is 3 pounds.\n// 0.02*(WholeWheat + Rye) <= 3",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type to produce daily to maximize profit while considering the constraints of ingredients and demand. The profit per loaf of whole wheat bread is $2, and the profit per loaf of rye bread is $1.50. The bakery has a daily supply of 200 pounds of flour. Each loaf of whole wheat bread requires 1 pound of flour, and each loaf of rye bread requires 0.75 pounds of flour. The bakery can only bake a maximum of 150 loaves of bread per day due to oven capacity and staffing. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. The bakery also has a limited amount of yeast, which is used in both types of bread. Each loaf of bread requires 0.02 pounds of yeast, and the total yeast available daily is 3 pounds. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n## Flour required for each type of bread\nFlour_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_WW\", lb=0) # flour required for whole wheat\nFlour_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_Rye\", lb=0) # flour required for rye\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 1.5*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(Flour_WW == WholeWheat)\nmodel.addCons(Flour_Rye == 0.75*Rye)\nmodel.addCons(Flour_WW + Flour_Rye <= 200)\n## The bakery can only bake a maximum of 150 loaves of bread per day.\nmodel.addCons(WholeWheat + Rye <= 150)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WholeWheat >= 50)\nmodel.addCons(Rye >= 50)\n## The bakery has a limited amount of yeast.\nmodel.addCons(0.02*(WholeWheat + Rye) <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*S\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\n// 2*W + 3*C + 1*S <= 200\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to fulfill a contract.\n// W >= 10\n\n## Generate Constraint-4:\nTo maintain crop diversity, the farmer must plant at least 5 acres of each crop.\n// W >= 5, C >= 5, S >= 5",
        "question": "A farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops.\n\n| Crop     | Profit per Acre | Labor Hours per Acre |\n|----------|-----------------|----------------------|\n| Wheat    | $200            | 2                    |\n| Corn     | $300            | 3                    |\n| Soybeans | $150            | 1                    |\n\nThe total available land for planting is 100 acres. The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours. The farmer must plant at least 10 acres of wheat to fulfill a contract. To maintain crop diversity, the farmer must plant at least 5 acres of each crop.\n\nPlease help the farmer determine the optimal allocation of acres to wheat, corn, and soybeans to maximize his total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*S)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\nmodel.addCons(2*W + 3*C + 1*S <= 200)\n## The farmer must plant at least 10 acres of wheat to fulfill a contract.\nmodel.addCons(W >= 10)\n## To maintain crop diversity, the farmer must plant at least 5 acres of each crop.\nmodel.addCons(W >= 5)\nmodel.addCons(C >= 5)\nmodel.addCons(S >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*S\n\n## Generate Constraint-1:\nThe total available land for planting is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\n// 2*W + 3*C + 1*S <= 200\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to fulfill a contract.\n// W >= 10\n\n## Generate Constraint-4:\nTo maintain crop diversity, the farmer must plant at least 5 acres of each crop.\n// W >= 5, C >= 5, S >= 5",
        "question": "A farmer is planning to plant three types of crops (wheat, corn, and soybeans) on his land. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the availability of land and the required labor hours. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The total available land for planting is 100 acres. The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours. The farmer must plant at least 10 acres of wheat to fulfill a contract and must plant at least 5 acres of each crop to maintain crop diversity. Please help the farmer to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*S)\n\n# Add constraints\n## The total available land for planting is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The labor required to maintain each acre of wheat, corn, and soybeans is 2, 3, and 1 hours respectively, and the total available labor hours per season is 200 hours.\nmodel.addCons(2*W + 3*C + 1*S <= 200)\n## The farmer must plant at least 10 acres of wheat to fulfill a contract.\nmodel.addCons(W >= 10)\n## To maintain crop diversity, the farmer must plant at least 5 acres of each crop.\nmodel.addCons(W >= 5)\nmodel.addCons(C >= 5)\nmodel.addCons(S >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Multigrain <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Multigrain >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// Wheat + Rye + Sourdough + Multigrain <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production.\n// Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Multigrain)",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Wheat          | $1.50           |\n| Rye            | $1.75           |\n| Sourdough      | $2.00           |\n| Multigrain     | $2.25           |\n\nThe bakery has a daily production capacity of 500 loaves of bread. The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. The bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 300)\n## The bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production.\nmodel.addCons(Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Multigrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Multigrain <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 100, Rye >= 100, Sourdough >= 100, Multigrain >= 100\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// Wheat + Rye + Sourdough + Multigrain <= 300\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production.\n// Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Multigrain)",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and multigrain bread is $1.50, $1.75, $2.00, and $2.25, respectively. The bakery has a daily production capacity of 500 loaves of bread and must produce at least 100 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. The bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nMultigrain = model.addVar(vtype=\"INTEGER\", name=\"Multigrain\", lb=0) # quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.25*Multigrain)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Multigrain >= 100)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Multigrain <= 300)\n## The bakery wants to ensure that the production of sourdough bread is at least 20% of the total bread production.\nmodel.addCons(Sourdough >= 0.20 * (Wheat + Rye + Sourdough + Multigrain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Gluten_Free >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread.\n// Wheat <= 300\n// Rye <= 200\n// Sourdough <= 150\n// Gluten_Free <= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production.\n// Gluten_Free <= 0.20 * (Wheat + Rye + Sourdough + Gluten_Free)",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | 1.50$           |\n| Rye           | 2.00$           |\n| Sourdough     | 2.50$           |\n| Gluten-Free   | 3.00$           |\n\nThe bakery has a daily production capacity of 500 loaves of bread. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. The bakery has a limited supply of ingredients, specifically flour, which is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread. The bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production.\n\nPlease help the bakery to determine the optimal daily production quantity for each type of bread to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Gluten_Free <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Gluten_Free >= 50)\n## The bakery has a limited supply of ingredients, specifically flour.\nmodel.addCons(Wheat <= 300)\nmodel.addCons(Rye <= 200)\nmodel.addCons(Sourdough <= 150)\nmodel.addCons(Gluten_Free <= 100)\n## The bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production.\nmodel.addCons(Gluten_Free <= 0.20 * (Wheat + Rye + Sourdough + Gluten_Free))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of gluten-free bread\": \"Gluten_Free\", \"range\": \"Gluten_Free >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// Wheat + Rye + Sourdough + Gluten_Free <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Gluten_Free >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread.\n// Wheat <= 300\n// Rye <= 200\n// Sourdough <= 150\n// Gluten_Free <= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production.\n// Gluten_Free <= 0.20 * (Wheat + Rye + Sourdough + Gluten_Free)",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and gluten-free. The bakery needs to determine the daily production quantity for each type of bread to optimize its profit. The profit per loaf for wheat, rye, sourdough, and gluten-free bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales. The bakery has a daily production capacity of 500 loaves of bread. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. The bakery has a limited supply of ingredients, specifically flour, which is enough for 300 loaves of wheat bread, 200 loaves of rye bread, 150 loaves of sourdough bread, and 100 loaves of gluten-free bread. The bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nGluten_Free = model.addVar(vtype=\"INTEGER\", name=\"Gluten_Free\", lb=0) # quantity of gluten-free bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 2.00*Rye + 2.50*Sourdough + 3.00*Gluten_Free)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(Wheat + Rye + Sourdough + Gluten_Free <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Gluten_Free >= 50)\n## The bakery has a limited supply of ingredients, specifically flour.\nmodel.addCons(Wheat <= 300)\nmodel.addCons(Rye <= 200)\nmodel.addCons(Sourdough <= 150)\nmodel.addCons(Gluten_Free <= 100)\n## The bakery wants to ensure that the production of gluten-free bread does not exceed 20% of the total bread production.\nmodel.addCons(Gluten_Free <= 0.20 * (Wheat + Rye + Sourdough + Gluten_Free))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of gluten-free bread: \", model.getVal(Gluten_Free))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints.\n// Wheat + Rye + Sourdough + Whole_Grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Whole_Grain >= 50\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat breads as rye breads to cater to a specific market demand.\n// Wheat >= 2*Rye",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively. The bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. The bakery aims to produce at least twice as many wheat breads as rye breads to cater to a specific market demand.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf |\n|---------------|-----------------|-------------------------|\n| Wheat         | $2              | 0.5 kg                  |\n| Rye           | $3              | 0.7 kg                  |\n| Sourdough     | $4              | 0.6 kg                  |\n| Whole Grain   | $3.50           | 0.8 kg                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 300)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Whole_Grain >= 50)\n## The bakery aims to produce at least twice as many wheat breads as rye breads.\nmodel.addCons(Wheat >= 2*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(Whole_Grain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain breads\": \"Whole_Grain\", \"range\": \"Whole_Grain >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints.\n// Wheat + Rye + Sourdough + Whole_Grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Whole_Grain >= 50\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat breads as rye breads to cater to a specific market demand.\n// Wheat >= 2*Rye",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the limited resources and market demand. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2, $3, $4, and $3.50, respectively. The bakery has a daily flour supply limit of 500 kg. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively. The bakery can produce a maximum of 300 loaves of bread per day due to oven capacity and labor constraints. The bakery must produce at least 50 loaves of each type of bread to meet the minimum order requirements from local stores. The bakery aims to produce at least twice as many wheat breads as rye breads to cater to a specific market demand. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nWhole_Grain = model.addVar(vtype=\"INTEGER\", name=\"Whole_Grain\", lb=0) # number of whole grain breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough + 3.5*Whole_Grain)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*Wheat + 0.7*Rye + 0.6*Sourdough + 0.8*Whole_Grain <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Whole_Grain <= 300)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Whole_Grain >= 50)\n## The bakery aims to produce at least twice as many wheat breads as rye breads.\nmodel.addCons(Wheat >= 2*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of whole grain breads: \", model.getVal(Whole_Grain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively.\n// Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day.\n// Wheat + Rye + Sourdough + Brioche <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Brioche >= 50\n\n## Generate Constraint-4:\nDue to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day.\n// Brioche <= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand. The profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The following table shows the flour requirements for each type of bread.\n\n| Bread Type | Profit per Loaf | Flour per Loaf |\n|------------|-----------------|----------------|\n| Wheat      | $1.50           | 1 pound        |\n| Rye        | $1.75           | 1.5 pounds     |\n| Sourdough  | $2.00           | 1.25 pounds    |\n| Brioche    | $2.50           | 2 pounds       |\n\nThe bakery has a daily limit of 500 pounds of flour. The bakery can produce a maximum of 300 loaves of bread per day. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Due to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # quantity of brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Brioche <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Brioche >= 50)\n## Due to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day.\nmodel.addCons(Brioche <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand.\n// {\"quantity of wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"quantity of brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively.\n// Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 300 loaves of bread per day.\n// Wheat + Rye + Sourdough + Brioche <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// Wheat >= 50, Rye >= 50, Sourdough >= 50, Brioche >= 50\n\n## Generate Constraint-4:\nDue to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day.\n// Brioche <= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and brioche. The bakery needs to determine the daily production quantity of each type of bread to maximize profit while considering the availability of ingredients and demand. The profit per loaf of wheat, rye, sourdough, and brioche bread is $1.50, $1.75, $2.00, and $2.50, respectively. The bakery has a daily limit of 500 pounds of flour. Each loaf of wheat, rye, sourdough, and brioche bread requires 1 pound, 1.5 pounds, 1.25 pounds, and 2 pounds of flour, respectively. The bakery can produce a maximum of 300 loaves of bread per day. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Due to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # quantity of wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # quantity of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # quantity of sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # quantity of brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Wheat + 1.75*Rye + 2.00*Sourdough + 2.50*Brioche)\n\n# Add constraints\n## The bakery has a daily limit of 500 pounds of flour.\nmodel.addCons(Wheat + 1.5*Rye + 1.25*Sourdough + 2*Brioche <= 500)\n## The bakery can produce a maximum of 300 loaves of bread per day.\nmodel.addCons(Wheat + Rye + Sourdough + Brioche <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 50)\nmodel.addCons(Brioche >= 50)\n## Due to equipment limitations, the bakery can only produce up to 100 loaves of brioche per day.\nmodel.addCons(Brioche <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(Wheat))\n    print(\"Quantity of rye bread: \", model.getVal(Rye))\n    print(\"Quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Quantity of brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints.\n// {\"number of loaves of white bread\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheatBread\", \"range\": \"WholeWheatBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughBread\", \"range\": \"SourdoughBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds.\n// WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 500 loaves per day.\n// WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500\n\n## Generate Constraint-3:\nThe bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\n// WhiteBread + WholeWheatBread <= 400\n\n## Generate Constraint-4:\nThe bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours. Each loaf of rye bread requires 0.5 hours of labor, and each loaf of sourdough bread requires 1 hour of labor.\n// 0.5*RyeBread + 1*SourdoughBread <= 300",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread       | Profit per Loaf |\n|---------------------|-----------------|\n| White Bread         | $2              |\n| Whole Wheat Bread   | $3              |\n| Rye Bread           | $2.50           |\n| Sourdough Bread     | $4              |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds. The bakery has a maximum oven capacity of 500 loaves per day. The bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves. Additionally, the bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours, with each loaf of rye bread requiring 0.5 hours of labor and each loaf of sourdough bread requiring 1 hour of labor.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of loaves of white bread\nWholeWheatBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatBread\", lb=0) # number of loaves of whole wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of rye bread\nSourdoughBread = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughBread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000)\n## The bakery has a maximum oven capacity of 500 loaves per day.\nmodel.addCons(WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500)\n## The bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\nmodel.addCons(WhiteBread + WholeWheatBread <= 400)\n## The bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours.\nmodel.addCons(0.5*RyeBread + 1*SourdoughBread <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(WhiteBread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheatBread))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1395,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints.\n// {\"number of loaves of white bread\": \"WhiteBread\", \"range\": \"WhiteBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole wheat bread\": \"WholeWheatBread\", \"range\": \"WholeWheatBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"RyeBread\", \"range\": \"RyeBread >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"SourdoughBread\", \"range\": \"SourdoughBread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 1 pound of flour, whole wheat bread requires 1.5 pounds, rye bread requires 1.2 pounds, and sourdough bread requires 2 pounds.\n// WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 500 loaves per day.\n// WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500\n\n## Generate Constraint-3:\nThe bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\n// WhiteBread + WholeWheatBread <= 400\n\n## Generate Constraint-4:\nThe bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours. Each loaf of rye bread requires 0.5 hours of labor, and each loaf of sourdough bread requires 1 hour of labor.\n// 0.5*RyeBread + 1*SourdoughBread <= 300",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while meeting demand and resource constraints. The profit per loaf for white bread is $2, whole wheat bread is $3, rye bread is $2.50, and sourdough bread is $4. The bakery has a total of 1000 pounds of flour available daily, with each loaf of white bread requiring 1 pound of flour, whole wheat bread requiring 1.5 pounds, rye bread requiring 1.2 pounds, and sourdough bread requiring 2 pounds. The bakery has a maximum oven capacity of 500 loaves per day. The bakery also has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves. Additionally, the bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours, with each loaf of rye bread requiring 0.5 hours of labor and each loaf of sourdough bread requiring 1 hour of labor. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhiteBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WhiteBread\", lb=0) # number of loaves of white bread\nWholeWheatBread = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheatBread\", lb=0) # number of loaves of whole wheat bread\nRyeBread = model.addVar(vtype=\"CONTINUOUS\", name=\"RyeBread\", lb=0) # number of loaves of rye bread\nSourdoughBread = model.addVar(vtype=\"CONTINUOUS\", name=\"SourdoughBread\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WhiteBread + 3*WholeWheatBread + 2.5*RyeBread + 4*SourdoughBread)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(WhiteBread + 1.5*WholeWheatBread + 1.2*RyeBread + 2*SourdoughBread <= 1000)\n## The bakery has a maximum oven capacity of 500 loaves per day.\nmodel.addCons(WhiteBread + WholeWheatBread + RyeBread + SourdoughBread <= 500)\n## The bakery has a daily demand constraint where the total number of white bread and whole wheat bread loaves produced must not exceed 400 loaves.\nmodel.addCons(WhiteBread + WholeWheatBread <= 400)\n## The bakery has a labor constraint where the total time spent on rye bread and sourdough bread production must not exceed 300 hours.\nmodel.addCons(0.5*RyeBread + 1*SourdoughBread <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of white bread: \", model.getVal(WhiteBread))\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WholeWheatBread))\n    print(\"Number of loaves of rye bread: \", model.getVal(RyeBread))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SourdoughBread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. The cost of raw materials for one unit of product A is $50, for product B is $75, for product C is $100, and for product D is $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe warehouse space is limited to 5000 cubic feet. One unit of product A requires 5 cubic feet, product B requires 10 cubic feet, product C requires 15 cubic feet, and product D requires 20 cubic feet.\n// 5*A + 10*B + 15*C + 20*D <= 5000\n\n## Generate Constraint-4:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n// A >= 50\n// B >= 75\n// C >= 100\n// D >= 125",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit, labor hours required, raw material cost, and warehouse space required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours | Raw Material Cost | Warehouse Space |\n|---------|-----------------|-------------|------------------|-----------------|\n| A       | $100            | 2 hours     | $50              | 5 cubic feet    |\n| B       | $150            | 3 hours     | $75              | 10 cubic feet   |\n| C       | $200            | 4 hours     | $100             | 15 cubic feet   |\n| D       | $250            | 5 hours     | $125             | 20 cubic feet   |\n\nThe company has a total of 1000 hours of labor available. The company has a budget of $50,000 for raw materials. The warehouse space is limited to 5000 cubic feet. The market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The warehouse space is limited to 5000 cubic feet.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 5000)\n## The market demand for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 75)\nmodel.addCons(C >= 100)\nmodel.addCons(D >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. The cost of raw materials for one unit of product A is $50, for product B is $75, for product C is $100, and for product D is $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe warehouse space is limited to 5000 cubic feet. One unit of product A requires 5 cubic feet, product B requires 10 cubic feet, product C requires 15 cubic feet, and product D requires 20 cubic feet.\n// 5*A + 10*B + 15*C + 20*D <= 5000\n\n## Generate Constraint-4:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n// A >= 50\n// B >= 75\n// C >= 100\n// D >= 125",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company has a total of 1000 hours of labor available, with each unit of product A requiring 2 hours, product B requiring 3 hours, product C requiring 4 hours, and product D requiring 5 hours. The company also has a budget of $50,000 for raw materials, with the cost of raw materials for one unit of product A being $50, for product B being $75, for product C being $100, and for product D being $125. The warehouse space is limited to 5000 cubic feet, with one unit of product A requiring 5 cubic feet, product B requiring 10 cubic feet, product C requiring 15 cubic feet, and product D requiring 20 cubic feet. The market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n\nPlease help the company to maximize the total profit while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The warehouse space is limited to 5000 cubic feet.\nmodel.addCons(5*A + 10*B + 15*C + 20*D <= 5000)\n## The market demand for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 75)\nmodel.addCons(C >= 100)\nmodel.addCons(D >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs.\n// {\"daily production of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 5000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 5000\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 1000 loaves of each type of bread daily.\n// White >= 1000\n// WholeWheat >= 1000\n// Rye >= 1000\n// Sourdough >= 1000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\n// White + WholeWheat + Rye + Sourdough <= 3000\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of rye bread does not exceed 20% of the total bread production.\n// Rye <= 0.20 * (White + WholeWheat + Rye + Sourdough)",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs. The cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost.\n\n| Bread Type       | Production Cost per Loaf |\n|------------------|--------------------------|\n| White            | $0.50                    |\n| Whole Wheat      | $0.60                    |\n| Rye              | $0.70                    |\n| Sourdough        | $0.80                    |\n\nThe bakery has a daily production capacity of 5000 loaves. The bakery has a contract to supply at least 1000 loaves of each type of bread daily. The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day. The bakery must ensure that the production of rye bread does not exceed 20% of the total bread production.\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to minimize the total production cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough)\n\n# Add constraints\n## The bakery has a daily production capacity of 5000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 5000)\n## The bakery has a contract to supply at least 1000 loaves of each type of bread daily.\nmodel.addCons(White >= 1000)\nmodel.addCons(WholeWheat >= 1000)\nmodel.addCons(Rye >= 1000)\nmodel.addCons(Sourdough >= 1000)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 3000)\n## The bakery must ensure that the production of rye bread does not exceed 20% of the total bread production.\nmodel.addCons(Rye <= 0.20 * (White + WholeWheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of white bread: \", model.getVal(White))\n    print(\"Daily production of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production of rye bread: \", model.getVal(Rye))\n    print(\"Daily production of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs.\n// {\"daily production of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 5000 loaves.\n// White + WholeWheat + Rye + Sourdough <= 5000\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 1000 loaves of each type of bread daily.\n// White >= 1000\n// WholeWheat >= 1000\n// Rye >= 1000\n// Sourdough >= 1000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\n// White + WholeWheat + Rye + Sourdough <= 3000\n\n## Generate Constraint-4:\nThe bakery must ensure that the production of rye bread does not exceed 20% of the total bread production.\n// Rye <= 0.20 * (White + WholeWheat + Rye + Sourdough)",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to meet customer demand while optimizing costs. The cost of producing one loaf of white bread is $0.50, whole wheat bread is $0.60, rye bread is $0.70, and sourdough bread is $0.80. The bakery wants to minimize the total production cost. The bakery has a daily production capacity of 5000 loaves. The bakery has a contract to supply at least 1000 loaves of each type of bread daily. The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day. The bakery must ensure that the production of rye bread does not exceed 20% of the total bread production. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production of white bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*White + 0.60*WholeWheat + 0.70*Rye + 0.80*Sourdough)\n\n# Add constraints\n## The bakery has a daily production capacity of 5000 loaves.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 5000)\n## The bakery has a contract to supply at least 1000 loaves of each type of bread daily.\nmodel.addCons(White >= 1000)\nmodel.addCons(WholeWheat >= 1000)\nmodel.addCons(Rye >= 1000)\nmodel.addCons(Sourdough >= 1000)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 3000 loaves per day.\nmodel.addCons(White + WholeWheat + Rye + Sourdough <= 3000)\n## The bakery must ensure that the production of rye bread does not exceed 20% of the total bread production.\nmodel.addCons(Rye <= 0.20 * (White + WholeWheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of white bread: \", model.getVal(White))\n    print(\"Daily production of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production of rye bread: \", model.getVal(Rye))\n    print(\"Daily production of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500\n\n## Generate Constraint-4:\nThe demand for inductors is at least 500 units per week.\n// Inductors >= 500",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources. The cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n\n| Component | Production Cost per Unit |\n|-----------|---------------------------|\n| Resistors | $0.50                     |\n| Capacitors| $0.75                     |\n| Inductors | $1.00                     |\n| Diodes    | $0.60                     |\n\nThe total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week. The demand for capacitors is at least 1500 units per week. The demand for inductors is at least 500 units per week.\n\nPlease help the company determine the optimal number of units to produce for each component to minimize the total production cost while meeting the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component to produce\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n## The demand for inductors is at least 500 units per week.\nmodel.addCons(Inductors >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500\n\n## Generate Constraint-4:\nThe demand for inductors is at least 500 units per week.\n// Inductors >= 500",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources. The cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost. The total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week. The demand for capacitors is at least 1500 units per week. The demand for inductors is at least 500 units per week. Please help the company determine the optimal number of units to produce for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component to produce\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n## The demand for inductors is at least 500 units per week.\nmodel.addCons(Inductors >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven hours used\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\n// 0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50\n\n## Generate Constraint-4:\nThe bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced.\n// Muffins >= 0.5*Croissants",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The following table shows the time requirements for each type of pastry in terms of oven and labor hours.\n\n| Pastry   | Oven Time (hours) | Labor Time (hours) |\n|----------|-------------------|--------------------|\n| Croissant| 0.1               | 0.2                |\n| Muffin   | 0.2               | 0.3                |\n| Donut    | 0.15              | 0.25               |\n\nThe bakery has a total of 10 hours of oven time and 8 hours of labor available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Additionally, the bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced. Please help the bakery to maximize its daily profit from the sales of these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n## The bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced.\nmodel.addCons(Muffins >= 0.5*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven hours used\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from the sales of these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\n// 0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50\n\n## Generate Constraint-4:\nThe bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced.\n// Muffins >= 0.5*Croissants",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours, with a total of 10 hours of oven time available daily. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours, with a total of 8 hours of labor available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Additionally, the bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced. Please help the bakery to maximize its daily profit from the sales of these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 10 hours of oven time available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.25 hours. The bakery has a total of 8 hours of labor available daily.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.25*Donuts <= 8)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n## The bakery has a promotional deal where the number of muffins produced must be at least half the number of croissants produced.\nmodel.addCons(Muffins >= 0.5*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce.\n// {\"number of Cake A\": \"CA\", \"range\": \"0 <= CA <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B\": \"CB\", \"range\": \"0 <= CB <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C\": \"CC\", \"range\": \"0 <= CC <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D\": \"CD\", \"range\": \"0 <= CD <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*CA + 7*CB + 6*CC + 4*CD\n\n## Generate Constraint-1:\nThe total amount of flour available is 500 kg. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2.5 kg, and cake D requires 1 kg.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 500\n\n## Generate Constraint-2:\nThe total amount of sugar available is 300 kg. Each cake A requires 1 kg of sugar, cake B requires 1.5 kg, cake C requires 1 kg, and cake D requires 0.5 kg.\n// 1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300\n\n## Generate Constraint-3:\nThe total production time available is 400 hours. Each cake A requires 2 hours to produce, cake B requires 3 hours, cake C requires 2.5 hours, and cake D requires 1 hour.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 400\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 cakes in total.\n// CA + CB + CC + CD >= 50",
        "question": "A bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce. The profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. The following table shows the requirements for each cake type:\n\n| Cake Type | Flour (kg) | Sugar (kg) | Production Time (hours) |\n|-----------|------------|------------|-------------------------|\n| A         | 2          | 1          | 2                       |\n| B         | 3          | 1.5        | 3                       |\n| C         | 2.5        | 1          | 2.5                     |\n| D         | 1          | 0.5        | 1                       |\n\nThe total amount of flour available is 500 kg, and the total amount of sugar available is 300 kg. The total production time available is 400 hours. The bakery must produce at least 50 cakes in total. Please help the bakery to determine the optimal number of each cake type to produce in order to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each cake type to produce\nCA = model.addVar(vtype=\"INTEGER\", name=\"CA\", lb=0, ub=100) # number of Cake A\nCB = model.addVar(vtype=\"INTEGER\", name=\"CB\", lb=0, ub=100) # number of Cake B\nCC = model.addVar(vtype=\"INTEGER\", name=\"CC\", lb=0, ub=100) # number of Cake C\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0, ub=100) # number of Cake D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*CA + 7*CB + 6*CC + 4*CD)\n\n# Add constraints\n## The total amount of flour available is 500 kg.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 500)\n## The total amount of sugar available is 300 kg.\nmodel.addCons(1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300)\n## The total production time available is 400 hours.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 400)\n## The bakery must produce at least 50 cakes in total.\nmodel.addCons(CA + CB + CC + CD >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(CA))\n    print(\"Number of Cake B: \", model.getVal(CB))\n    print(\"Number of Cake C: \", model.getVal(CC))\n    print(\"Number of Cake D: \", model.getVal(CD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce.\n// {\"number of Cake A\": \"CA\", \"range\": \"0 <= CA <= 100\", \"type\": \"integer\"}\n// {\"number of Cake B\": \"CB\", \"range\": \"0 <= CB <= 100\", \"type\": \"integer\"}\n// {\"number of Cake C\": \"CC\", \"range\": \"0 <= CC <= 100\", \"type\": \"integer\"}\n// {\"number of Cake D\": \"CD\", \"range\": \"0 <= CD <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*CA + 7*CB + 6*CC + 4*CD\n\n## Generate Constraint-1:\nThe total amount of flour available is 500 kg. Each cake A requires 2 kg of flour, cake B requires 3 kg, cake C requires 2.5 kg, and cake D requires 1 kg.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 500\n\n## Generate Constraint-2:\nThe total amount of sugar available is 300 kg. Each cake A requires 1 kg of sugar, cake B requires 1.5 kg, cake C requires 1 kg, and cake D requires 0.5 kg.\n// 1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300\n\n## Generate Constraint-3:\nThe total production time available is 400 hours. Each cake A requires 2 hours to produce, cake B requires 3 hours, cake C requires 2.5 hours, and cake D requires 1 hour.\n// 2*CA + 3*CB + 2.5*CC + 1*CD <= 400\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 cakes in total.\n// CA + CB + CC + CD >= 50",
        "question": "A bakery wants to produce four types of cakes (cakes A-D) for an upcoming festival. Each cake type requires a different amount of ingredients and time to produce. The bakery needs to decide how many of each cake type to produce. The profit per cake for cakes A-D is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. The total amount of flour available is 500 kg, with each cake A requiring 2 kg of flour, cake B requiring 3 kg, cake C requiring 2.5 kg, and cake D requiring 1 kg. The total amount of sugar available is 300 kg, with each cake A requiring 1 kg of sugar, cake B requiring 1.5 kg, cake C requiring 1 kg, and cake D requiring 0.5 kg. The total production time available is 400 hours, with each cake A requiring 2 hours to produce, cake B requiring 3 hours, cake C requiring 2.5 hours, and cake D requiring 1 hour. The bakery must also produce at least 50 cakes in total. Please help the bakery determine the optimal number of each cake type to produce to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each cake type to produce\nCA = model.addVar(vtype=\"INTEGER\", name=\"CA\", lb=0, ub=100) # number of Cake A\nCB = model.addVar(vtype=\"INTEGER\", name=\"CB\", lb=0, ub=100) # number of Cake B\nCC = model.addVar(vtype=\"INTEGER\", name=\"CC\", lb=0, ub=100) # number of Cake C\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0, ub=100) # number of Cake D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*CA + 7*CB + 6*CC + 4*CD)\n\n# Add constraints\n## The total amount of flour available is 500 kg.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 500)\n## The total amount of sugar available is 300 kg.\nmodel.addCons(1*CA + 1.5*CB + 1*CC + 0.5*CD <= 300)\n## The total production time available is 400 hours.\nmodel.addCons(2*CA + 3*CB + 2.5*CC + 1*CD <= 400)\n## The bakery must produce at least 50 cakes in total.\nmodel.addCons(CA + CB + CC + CD >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(CA))\n    print(\"Number of Cake B: \", model.getVal(CB))\n    print(\"Number of Cake C: \", model.getVal(CC))\n    print(\"Number of Cake D: \", model.getVal(CD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce.\n// {\"number of Pastry A\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry B\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry C\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry D\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each unit of Pastry A, B, C, and D requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each unit of Pastry A, B, C, and D requires 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively.\n// 0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each pastry. The maximum daily demand for Pastry A, B, C, and D is 80, 70, 90, and 60 units respectively.\n// P1 <= 80\n// P2 <= 70\n// P3 <= 90\n// P4 <= 60\n\n## Generate Constraint-4:\nThe bakery should not produce a negative number of pastries.\n// P1 >= 0\n// P2 >= 0\n// P3 >= 0\n// P4 >= 0",
        "question": "A bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce. The profit per unit for each pastry and the required ingredients for each unit are given in the following Table.\n\n| Pastry | Profit per Unit | Flour Required (kg) | Sugar Required (kg) | Maximum Daily Demand |\n|--------|-----------------|---------------------|---------------------|----------------------|\n| A      | $2              | 0.5                 | 0.3                 | 80                   |\n| B      | $3              | 0.7                 | 0.2                 | 70                   |\n| C      | $2.5            | 0.6                 | 0.4                 | 90                   |\n| D      | $1.5            | 0.4                 | 0.5                 | 60                   |\n\nThe bakery has a total of 200 kg of flour and 150 kg of sugar available daily. The bakery should not produce a negative number of pastries. \nPlease help the bakery to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # number of Pastry A\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=100) # number of Pastry B\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # number of Pastry C\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0, ub=100) # number of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150)\n## The bakery has a demand limit for each pastry.\nmodel.addCons(P1 <= 80)\nmodel.addCons(P2 <= 70)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 60)\n## The bakery should not produce a negative number of pastries.\nmodel.addCons(P1 >= 0)\nmodel.addCons(P2 >= 0)\nmodel.addCons(P3 >= 0)\nmodel.addCons(P4 >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(P1))\n    print(\"Number of Pastry B: \", model.getVal(P2))\n    print(\"Number of Pastry C: \", model.getVal(P3))\n    print(\"Number of Pastry D: \", model.getVal(P4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce.\n// {\"number of Pastry A\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry B\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry C\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"integer\"}\n// {\"number of Pastry D\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit.\n// Objective Function: Maximize: 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each unit of Pastry A, B, C, and D requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively.\n// 0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each unit of Pastry A, B, C, and D requires 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively.\n// 0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each pastry. The maximum daily demand for Pastry A, B, C, and D is 80, 70, 90, and 60 units respectively.\n// P1 <= 80\n// P2 <= 70\n// P3 <= 90\n// P4 <= 60\n\n## Generate Constraint-4:\nThe bakery should not produce a negative number of pastries.\n// P1 >= 0\n// P2 >= 0\n// P3 >= 0\n// P4 >= 0",
        "question": "A bakery wants to optimize its daily production of four types of pastries (Pastry A, Pastry B, Pastry C, Pastry D). The bakery needs to decide how many of each pastry to produce. The profit per unit for Pastry A, B, C, and D is $2, $3, $2.5, and $1.5 respectively. The bakery wants to maximize its total daily profit. The bakery has a total of 200 kg of flour available daily, with each unit of Pastry A, B, C, and D requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.4 kg of flour respectively. The bakery also has a total of 150 kg of sugar available daily, with each unit of Pastry A, B, C, and D requiring 0.3 kg, 0.2 kg, 0.4 kg, and 0.5 kg of sugar respectively. The bakery has a demand limit for each pastry, with the maximum daily demand for Pastry A, B, C, and D being 80, 70, 90, and 60 units respectively. The bakery should not produce a negative number of pastries. Please help the bakery determine the optimal number of each pastry to produce to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry to produce\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # number of Pastry A\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=100) # number of Pastry B\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # number of Pastry C\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0, ub=100) # number of Pastry D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*P1 + 3*P2 + 2.5*P3 + 1.5*P4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*P1 + 0.7*P2 + 0.6*P3 + 0.4*P4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.3*P1 + 0.2*P2 + 0.4*P3 + 0.5*P4 <= 150)\n## The bakery has a demand limit for each pastry.\nmodel.addCons(P1 <= 80)\nmodel.addCons(P2 <= 70)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 60)\n## The bakery should not produce a negative number of pastries.\nmodel.addCons(P1 >= 0)\nmodel.addCons(P2 >= 0)\nmodel.addCons(P3 >= 0)\nmodel.addCons(P4 >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(P1))\n    print(\"Number of Pastry B: \", model.getVal(P2))\n    print(\"Number of Pastry C: \", model.getVal(P3))\n    print(\"Number of Pastry D: \", model.getVal(P4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"G\", \"range\": \"0 <= G <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has a total of 250 kg of flour available daily. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively.\n// 0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 150 loaves in total due to oven capacity.\n// W + R + S + G <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\n// R >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread.\n// G >= 0.5*W",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit, with the profit per loaf for wheat, rye, sourdough, and whole grain bread being $2, $3, $2.5, and $2.75 respectively. The bakery has a total of 250 kg of flour available daily, and each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively. The bakery can produce a maximum of 150 loaves in total due to oven capacity. The bakery must produce at least 20 loaves of rye bread to meet a contract obligation. Additionally, the bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread.\n\nPlease help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf |\n|------------------|-----------------|-------------------------|\n| Wheat            | $2              | 0.5 kg                  |\n| Rye              | $3              | 0.7 kg                  |\n| Sourdough        | $2.5            | 0.6 kg                  |\n| Whole Grain      | $2.75           | 0.8 kg                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # quantity of sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 2.75*G)\n\n# Add constraints\n## The bakery has a total of 250 kg of flour available daily.\nmodel.addCons(0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250)\n## The bakery can produce a maximum of 150 loaves in total due to oven capacity.\nmodel.addCons(W + R + S + G <= 150)\n## The bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\nmodel.addCons(R >= 20)\n## The bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread.\nmodel.addCons(G >= 0.5*W)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Quantity of whole grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"G\", \"range\": \"0 <= G <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has a total of 250 kg of flour available daily. Each loaf of wheat, rye, sourdough, and whole grain bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively.\n// 0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 150 loaves in total due to oven capacity.\n// W + R + S + G <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\n// R >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread.\n// G >= 0.5*W",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit, where the profit per loaf for wheat, rye, sourdough, and whole grain bread is $2, $3, $2.5, and $2.75 respectively. The bakery has a total of 250 kg of flour available daily, with each loaf of wheat, rye, sourdough, and whole grain bread requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour respectively. The bakery can produce a maximum of 150 loaves in total due to oven capacity. The bakery must produce at least 20 loaves of rye bread to meet a contract obligation. Additionally, the bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # quantity of sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 2.75*G)\n\n# Add constraints\n## The bakery has a total of 250 kg of flour available daily.\nmodel.addCons(0.5*W + 0.7*R + 0.6*S + 0.8*G <= 250)\n## The bakery can produce a maximum of 150 loaves in total due to oven capacity.\nmodel.addCons(W + R + S + G <= 150)\n## The bakery must produce at least 20 loaves of rye bread to meet a contract obligation.\nmodel.addCons(R >= 20)\n## The bakery wants to ensure that the production of whole grain bread is at least half the production of wheat bread.\nmodel.addCons(G >= 0.5*W)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Quantity of whole grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (products A-D). The company needs to decide how many units of each product to produce to optimize its profits.\n// {\"number of units of Product A\": \"P_A\", \"range\": \"0 <= P_A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"P_B\", \"range\": \"0 <= P_B <= 150\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"P_C\", \"range\": \"0 <= P_C <= 200\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"P_D\", \"range\": \"0 <= P_D <= 120\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*P_A + 15*P_B + 20*P_C + 12*P_D\n\n## Generate Constraint-1:\nThe company has a total of 400 labor hours available. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, Product C requires 4 hours, and Product D requires 2 hours.\n// 2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials. The cost of raw materials per unit for products A-D is $5, $8, $10, and $6 respectively.\n// 5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units, and for Product D is at most 80 units.\n// P_A >= 20\n// P_D <= 80\n\n## Generate Constraint-4:\nThe company aims to produce at least 50 units in total across all products.\n// P_A + P_B + P_C + P_D >= 50",
        "question": "A manufacturing company produces four types of products (products A-D). The company needs to decide how many units of each product to produce to optimize its profits. The profit per unit and the labor and material costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Cost per Unit |\n|---------|-----------------|----------------------|----------------------------|\n| A       | $10             | 2 hours              | $5                         |\n| B       | $15             | 3 hours              | $8                         |\n| C       | $20             | 4 hours              | $10                        |\n| D       | $12             | 2 hours              | $6                         |\n\nThe company has a total of 400 labor hours available and a budget of $5000 for raw materials. The market demand for Product A is at least 20 units, and for Product D is at most 80 units. The company aims to produce at least 50 units in total across all products. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP_A = model.addVar(vtype=\"INTEGER\", name=\"P_A\", lb=0, ub=100) # number of units of Product A\nP_B = model.addVar(vtype=\"INTEGER\", name=\"P_B\", lb=0, ub=150) # number of units of Product B\nP_C = model.addVar(vtype=\"INTEGER\", name=\"P_C\", lb=0, ub=200) # number of units of Product C\nP_D = model.addVar(vtype=\"INTEGER\", name=\"P_D\", lb=0, ub=120) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*P_A + 15*P_B + 20*P_C + 12*P_D)\n\n# Add constraints\n## The company has a total of 400 labor hours available.\nmodel.addCons(2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400)\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000)\n## The market demand for Product A is at least 20 units, and for Product D is at most 80 units.\nmodel.addCons(P_A >= 20)\nmodel.addCons(P_D <= 80)\n## The company aims to produce at least 50 units in total across all products.\nmodel.addCons(P_A + P_B + P_C + P_D >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(P_A))\n    print(\"Number of units of Product B: \", model.getVal(P_B))\n    print(\"Number of units of Product C: \", model.getVal(P_C))\n    print(\"Number of units of Product D: \", model.getVal(P_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (products A-D). The company needs to decide how many units of each product to produce to optimize its profits.\n// {\"number of units of Product A\": \"P_A\", \"range\": \"0 <= P_A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"P_B\", \"range\": \"0 <= P_B <= 150\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"P_C\", \"range\": \"0 <= P_C <= 200\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"P_D\", \"range\": \"0 <= P_D <= 120\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*P_A + 15*P_B + 20*P_C + 12*P_D\n\n## Generate Constraint-1:\nThe company has a total of 400 labor hours available. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, Product C requires 4 hours, and Product D requires 2 hours.\n// 2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials. The cost of raw materials per unit for products A-D is $5, $8, $10, and $6 respectively.\n// 5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 20 units, and for Product D is at most 80 units.\n// P_A >= 20\n// P_D <= 80\n\n## Generate Constraint-4:\nThe company aims to produce at least 50 units in total across all products.\n// P_A + P_B + P_C + P_D >= 50",
        "question": "A manufacturing company produces four types of products (products A-D) and needs to decide how many units of each product to produce to optimize its profits. The profit per unit for products A-D is $10, $15, $20, and $12 respectively. The company has a total of 400 labor hours available, with producing one unit of Product A requiring 2 hours, Product B requiring 3 hours, Product C requiring 4 hours, and Product D requiring 2 hours. The company also has a budget of $5000 for raw materials, with the cost of raw materials per unit for products A-D being $5, $8, $10, and $6 respectively. The market demand for Product A is at least 20 units, and for Product D is at most 80 units. Additionally, the company aims to produce at least 50 units in total across all products. Please help the company maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nP_A = model.addVar(vtype=\"INTEGER\", name=\"P_A\", lb=0, ub=100) # number of units of Product A\nP_B = model.addVar(vtype=\"INTEGER\", name=\"P_B\", lb=0, ub=150) # number of units of Product B\nP_C = model.addVar(vtype=\"INTEGER\", name=\"P_C\", lb=0, ub=200) # number of units of Product C\nP_D = model.addVar(vtype=\"INTEGER\", name=\"P_D\", lb=0, ub=120) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*P_A + 15*P_B + 20*P_C + 12*P_D)\n\n# Add constraints\n## The company has a total of 400 labor hours available.\nmodel.addCons(2*P_A + 3*P_B + 4*P_C + 2*P_D <= 400)\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(5*P_A + 8*P_B + 10*P_C + 6*P_D <= 5000)\n## The market demand for Product A is at least 20 units, and for Product D is at most 80 units.\nmodel.addCons(P_A >= 20)\nmodel.addCons(P_D <= 80)\n## The company aims to produce at least 50 units in total across all products.\nmodel.addCons(P_A + P_B + P_C + P_D >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(P_A))\n    print(\"Number of units of Product B: \", model.getVal(P_B))\n    print(\"Number of units of Product C: \", model.getVal(P_C))\n    print(\"Number of units of Product D: \", model.getVal(P_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake. The maximum number of cake 1 that can be sold is 80, cake 2 is 60, cake 3 is 70, and cake 4 is 90.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 50 cakes in total are produced daily.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery has a demand limit for each cake, with the maximum number of cake 1 that can be sold being 80, cake 2 being 60, cake 3 being 70, and cake 4 being 90. The bakery must also ensure that at least 50 cakes in total are produced daily.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| 1         | $5              | 1                   | 0.5                 |\n| 2         | $7              | 2                   | 0.8                 |\n| 3         | $6              | 1.5                 | 0.6                 |\n| 4         | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 50 cakes in total are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1435,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake. The maximum number of cake 1 that can be sold is 80, cake 2 is 60, cake 3 is 70, and cake 4 is 90.\n// C1 <= 80\n// C2 <= 60\n// C3 <= 70\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 50 cakes in total are produced daily.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery has a demand limit for each cake, with the maximum number of cake 1 that can be sold being 80, cake 2 being 60, cake 3 being 70, and cake 4 being 90. The bakery must also ensure that at least 50 cakes in total are produced daily. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 60)\nmodel.addCons(C3 <= 70)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 50 cakes in total are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours.\n// 2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units.\n// 4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet.\n// 3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations.\n// C1 >= 10\n// C4 >= 15",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce. The profit per cake and the production requirements for each cake are given in the following Table.\n\n| Cake Type | Profit per Cake | Production Time (hours) | Ingredient Units | Storage Space (cubic feet) |\n|-----------|-----------------|-------------------------|------------------|---------------------------|\n| Cake 1    | $5              | 2                       | 4                | 3                         |\n| Cake 2    | $7              | 3                       | 5                | 4                         |\n| Cake 3    | $6              | 2.5                     | 4.5              | 3.5                       |\n| Cake 4    | $4              | 1.5                     | 3                | 2                         |\n\nThe bakery has a total of 100 hours of labor available daily. The total available ingredients are 180 units, and the total storage capacity is 120 cubic feet. The bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations. \n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180)\n## The bakery has a storage capacity limit.\nmodel.addCons(3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120)\n## The bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations.\nmodel.addCons(C1 >= 10)\nmodel.addCons(C4 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours.\n// 2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units.\n// 4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet.\n// 3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations.\n// C1 >= 10\n// C4 >= 15",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery needs to decide how many of each type of cake to produce. Each cake type yields a different profit: Cake 1 yields $5, Cake 2 yields $7, Cake 3 yields $6, and Cake 4 yields $4. The bakery wants to maximize its daily profit. The bakery has a total of 100 hours of labor available daily. Producing Cake 1 requires 2 hours, Cake 2 requires 3 hours, Cake 3 requires 2.5 hours, and Cake 4 requires 1.5 hours. The bakery has a limited supply of ingredients. The ingredient requirements for each cake are as follows: Cake 1 requires 4 units, Cake 2 requires 5 units, Cake 3 requires 4.5 units, and Cake 4 requires 3 units. The total available ingredients are 180 units. The bakery also has a storage capacity limit. Each Cake 1 takes up 3 cubic feet, Cake 2 takes up 4 cubic feet, Cake 3 takes up 3.5 cubic feet, and Cake 4 takes up 2 cubic feet. The total storage capacity is 120 cubic feet. The bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*C1 + 3*C2 + 2.5*C3 + 1.5*C4 <= 100)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(4*C1 + 5*C2 + 4.5*C3 + 3*C4 <= 180)\n## The bakery has a storage capacity limit.\nmodel.addCons(3*C1 + 4*C2 + 3.5*C3 + 2*C4 <= 120)\n## The bakery must produce at least 10 units of Cake 1 and 15 units of Cake 4 to fulfill contractual obligations.\nmodel.addCons(C1 >= 10)\nmodel.addCons(C4 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 30 cakes of any type are produced daily to maintain customer satisfaction.\n// C1 + C2 + C3 + C4 >= 30",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg.\n\nThe bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively. The bakery must also ensure that at least 30 cakes of any type are produced daily to maintain customer satisfaction.\n\nPlease help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Maximum Demand |\n|-----------|-----------------|---------------------|---------------------|----------------|\n| 1         | $5              | 1                   | 0.5                 | 80             |\n| 2         | $7              | 2                   | 0.7                 | 70             |\n| 3         | $6              | 1.5                 | 0.6                 | 60             |\n| 4         | $4              | 1                   | 0.5                 | 90             |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 30 cakes of any type are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1533,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 30 cakes of any type are produced daily to maintain customer satisfaction.\n// C1 + C2 + C3 + C4 >= 30",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery has a demand limit for each cake type, with the maximum demand for cakes 1-4 being 80, 70, 60, and 90 respectively. Additionally, the bakery must ensure that at least 30 cakes of any type are produced daily to maintain customer satisfaction. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 30 cakes of any type are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limit on the oven usage time, which is 8 hours daily. Each loaf of bread requires 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively.\n// (5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively.\n// Q1 <= 1500\n// Q2 <= 1200\n// Q3 <= 1000\n// Q4 <= 800\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread for health-conscious customers.\n// Q1 >= 0.2 * (Q1 + Q2 + Q3 + Q4)",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 1000 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. The bakery also has a limit on the oven usage time, which is 8 hours daily, with each loaf of bread requiring 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively.\n\nThe bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively. Additionally, the bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread for health-conscious customers.\n\nPlease help the bakery determine the optimal daily production quantities of each type of bread to maximize its profit.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf | Oven Time per Loaf |\n|------------------|-----------------|-------------------------|--------------------|\n| Whole Wheat      | $2              | 0.5 kg                  | 5 minutes          |\n| Rye              | $3              | 0.4 kg                  | 7 minutes          |\n| Sourdough        | $2.5            | 0.3 kg                  | 6 minutes          |\n| Brioche          | $4              | 0.6 kg                  | 10 minutes         |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of Whole Wheat bread\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of Rye bread\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of Sourdough bread\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4)\n\n# Add constraints\n## The bakery has a total of 1000 kg of flour available daily.\nmodel.addCons(0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000)\n## The bakery has a limit on the oven usage time, which is 8 hours daily.\nmodel.addCons((5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8)\n## The bakery has a demand constraint for each type of bread.\nmodel.addCons(Q1 <= 1500)\nmodel.addCons(Q2 <= 1200)\nmodel.addCons(Q3 <= 1000)\nmodel.addCons(Q4 <= 800)\n## The bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread.\nmodel.addCons(Q1 >= 0.2 * (Q1 + Q2 + Q3 + Q4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(Q1))\n    print(\"Quantity of Rye bread: \", model.getVal(Q2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(Q3))\n    print(\"Quantity of Brioche bread: \", model.getVal(Q4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1599,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"quantity of Whole Wheat bread\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Rye bread\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sourdough bread\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Brioche bread\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limit on the oven usage time, which is 8 hours daily. Each loaf of bread requires 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively.\n// (5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively.\n// Q1 <= 1500\n// Q2 <= 1200\n// Q3 <= 1000\n// Q4 <= 800\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread for health-conscious customers.\n// Q1 >= 0.2 * (Q1 + Q2 + Q3 + Q4)",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 1000 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. The bakery also has a limit on the oven usage time, which is 8 hours daily, with each loaf of bread requiring 5 minutes, 7 minutes, 6 minutes, and 10 minutes of oven time respectively. The bakery has a demand constraint where the daily demand for Whole Wheat, Rye, Sourdough, and Brioche bread should not exceed 1500, 1200, 1000, and 800 loaves respectively. Additionally, the bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread for health-conscious customers. Please help the bakery determine the optimal daily production quantities for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of Whole Wheat bread\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of Rye bread\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of Sourdough bread\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Q1 + 3*Q2 + 2.5*Q3 + 4*Q4)\n\n# Add constraints\n## The bakery has a total of 1000 kg of flour available daily.\nmodel.addCons(0.5*Q1 + 0.4*Q2 + 0.3*Q3 + 0.6*Q4 <= 1000)\n## The bakery has a limit on the oven usage time, which is 8 hours daily.\nmodel.addCons((5/60)*Q1 + (7/60)*Q2 + (6/60)*Q3 + (10/60)*Q4 <= 8)\n## The bakery has a demand constraint for each type of bread.\nmodel.addCons(Q1 <= 1500)\nmodel.addCons(Q2 <= 1200)\nmodel.addCons(Q3 <= 1000)\nmodel.addCons(Q4 <= 800)\n## The bakery wants to ensure that at least 20% of the total bread produced is Whole Wheat bread.\nmodel.addCons(Q1 >= 0.2 * (Q1 + Q2 + Q3 + Q4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Whole Wheat bread: \", model.getVal(Q1))\n    print(\"Quantity of Rye bread: \", model.getVal(Q2))\n    print(\"Quantity of Sourdough bread: \", model.getVal(Q3))\n    print(\"Quantity of Brioche bread: \", model.getVal(Q4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 0.5 kg.\n// C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.4 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 hours of labor available daily. Each cake 1 requires 1 hour of labor, cake 2 requires 1.5 hours, cake 3 requires 2 hours, and cake 4 requires 1 hour.\n// C1 + 1.5*C2 + 2*C3 + C4 <= 100\n\n## Generate Constraint-4:\nThe bakery must produce at least 30 cakes of any type daily to meet minimum customer demand.\n// C1 + C2 + C3 + C4 >= 30",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The following table summarizes the resource requirements for each type of cake:\n\n| Cake Type | Flour (kg) | Sugar (kg) | Labor (hours) |\n|-----------|------------|------------|---------------|\n| 1         | 1          | 0.5        | 1             |\n| 2         | 2          | 0.7        | 1.5           |\n| 3         | 1.5        | 0.6        | 2             |\n| 4         | 0.5        | 0.4        | 1             |\n\nThe bakery has a total of 200 kg of flour and 150 kg of sugar available daily. It also has a total of 100 hours of labor available daily. The bakery must produce at least 30 cakes of any type daily to meet minimum customer demand. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(C1 + 1.5*C2 + 2*C3 + C4 <= 100)\n## The bakery must produce at least 30 cakes of any type daily to meet minimum customer demand.\nmodel.addCons(C1 + C2 + C3 + C4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 0.5 kg.\n// C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.4 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 hours of labor available daily. Each cake 1 requires 1 hour of labor, cake 2 requires 1.5 hours, cake 3 requires 2 hours, and cake 4 requires 1 hour.\n// C1 + 1.5*C2 + 2*C3 + C4 <= 100\n\n## Generate Constraint-4:\nThe bakery must produce at least 30 cakes of any type daily to meet minimum customer demand.\n// C1 + C2 + C3 + C4 >= 30",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 0.5 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.4 kg. Additionally, the bakery has a total of 100 hours of labor available daily, with each cake 1 requiring 1 hour of labor, cake 2 requiring 1.5 hours, cake 3 requiring 2 hours, and cake 4 requiring 1 hour. The bakery must produce at least 30 cakes of any type daily to meet minimum customer demand. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + 0.5*C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.4*C4 <= 150)\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(C1 + 1.5*C2 + 2*C3 + C4 <= 100)\n## The bakery must produce at least 30 cakes of any type daily to meet minimum customer demand.\nmodel.addCons(C1 + C2 + C3 + C4 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily.\n// {\"number of Whole Wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively.\n// Objective Function: Maximize: 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100\n\n## Generate Constraint-2:\nThe bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20 units of any type of bread are produced daily.\n// Whole_Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 10 Croissants daily.\n// Croissant >= 10",
        "question": "A bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily. The bakery wants to maximize its daily revenue. The selling price and ingredient cost for each type of bread and pastry are given in the following Table.\n\n| Product       | Selling Price | Ingredient Cost | Labor Hours Required |\n|---------------|---------------|-----------------|----------------------|\n| Whole Wheat   | $3            | $1              | 1 hour               |\n| Rye           | $4            | $2              | 2 hours              |\n| Sourdough     | $5            | $3              | 3 hours              |\n| Croissant     | $2            | $1              | 1 hour               |\n\nThe bakery has a total of 100 hours of labor available daily. The bakery has a budget of $200 for daily ingredient purchases. The bakery wants to ensure that at least 20 units of any type of bread are produced daily. The bakery also aims to produce at least 10 Croissants daily.\n\nPlease help the bakery to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough breads\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of Croissants\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100)\n## The bakery has a budget of $200 for daily ingredient purchases.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200)\n## The bakery wants to ensure that at least 20 units of any type of bread are produced daily.\nmodel.addCons(Whole_Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\n## The bakery aims to produce at least 10 Croissants daily.\nmodel.addCons(Croissant >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye breads: \", model.getVal(Rye))\n    print(\"Number of Sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily.\n// {\"number of Whole Wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively.\n// Objective Function: Maximize: 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100\n\n## Generate Constraint-2:\nThe bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively.\n// Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 20 units of any type of bread are produced daily.\n// Whole_Wheat >= 20\n// Rye >= 20\n// Sourdough >= 20\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 10 Croissants daily.\n// Croissant >= 10",
        "question": "A bakery needs to decide how many units of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to produce daily. The bakery wants to maximize its daily revenue. The selling price for Whole Wheat, Rye, Sourdough, and Croissant is $3, $4, $5, and $2, respectively. The bakery has a total of 100 hours of labor available daily. Each Whole Wheat, Rye, Sourdough, and Croissant requires 1, 2, 3, and 1 hour of labor, respectively. The bakery has a budget of $200 for daily ingredient purchases. The cost of ingredients for each Whole Wheat, Rye, Sourdough, and Croissant is $1, $2, $3, and $1, respectively. The bakery wants to ensure that at least 20 units of any type of bread are produced daily and aims to produce at least 10 Croissants daily. Please help the bakery determine the optimal number of each product to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread and pastry to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of Whole Wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of Sourdough breads\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of Croissants\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Whole_Wheat + 4*Rye + 5*Sourdough + 2*Croissant)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 100)\n## The bakery has a budget of $200 for daily ingredient purchases.\nmodel.addCons(Whole_Wheat + 2*Rye + 3*Sourdough + Croissant <= 200)\n## The bakery wants to ensure that at least 20 units of any type of bread are produced daily.\nmodel.addCons(Whole_Wheat >= 20)\nmodel.addCons(Rye >= 20)\nmodel.addCons(Sourdough >= 20)\n## The bakery aims to produce at least 10 Croissants daily.\nmodel.addCons(Croissant >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of Rye breads: \", model.getVal(Rye))\n    print(\"Number of Sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 80 hours of labor available daily. Each whole wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Whole_Wheat + 1.5*Rye <= 80\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 breads.\n// Whole_Wheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n// Rye >= 0.5*Whole_Wheat",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Requirement (kg) | Labor Hours Required |\n|----------------|------------------|------------------------|----------------------|\n| Whole Wheat    | $2               | 0.5                    | 1                    |\n| Rye            | $3               | 0.4                    | 1.5                  |\n\nThe bakery has 100 kg of flour available daily. The bakery has 80 hours of labor available daily. The bakery has a minimum daily production requirement of 50 breads. The bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 80 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 1.5*Rye <= 80)\n## The bakery has a minimum daily production requirement of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n## The bakery aims to maintain a balance between the two types of bread.\nmodel.addCons(Rye >= 0.5*Whole_Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 80 hours of labor available daily. Each whole wheat bread requires 1 hour of labor, and each rye bread requires 1.5 hours of labor.\n// Whole_Wheat + 1.5*Rye <= 80\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 breads.\n// Whole_Wheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n// Rye >= 0.5*Whole_Wheat",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has 100 kg of flour available daily, with each whole wheat bread requiring 0.5 kg of flour and each rye bread requiring 0.4 kg of flour. The bakery also has 80 hours of labor available daily, with each whole wheat bread requiring 1 hour of labor and each rye bread requiring 1.5 hours of labor. The bakery has a minimum daily production requirement of 50 breads. Additionally, the bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 80 hours of labor available daily.\nmodel.addCons(Whole_Wheat + 1.5*Rye <= 80)\n## The bakery has a minimum daily production requirement of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n## The bakery aims to maintain a balance between the two types of bread.\nmodel.addCons(Rye >= 0.5*Whole_Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat breads\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg.\n// 0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each wheat bread requires 0.2 hours of labor, each rye bread requires 0.3 hours, and each sourdough bread requires 0.4 hours.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 breads.\n// Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat breads as rye breads.\n// Wheat_Bread >= 2*Rye_Bread",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4. The bakery has 200 kg of flour available daily, with each wheat bread requiring 0.5 kg of flour, each rye bread requiring 0.4 kg, and each sourdough bread requiring 0.6 kg. The bakery also has 100 hours of labor available daily, with each wheat bread requiring 0.2 hours of labor, each rye bread requiring 0.3 hours, and each sourdough bread requiring 0.4 hours. The bakery has a minimum daily demand of 100 breads and aims to produce at least twice as many wheat breads as rye breads.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads\nSourdough_Bread = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Bread\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100)\n## The bakery has a minimum daily demand of 100 breads.\nmodel.addCons(Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100)\n## The bakery aims to produce at least twice as many wheat breads as rye breads.\nmodel.addCons(Wheat_Bread >= 2*Rye_Bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads: \", model.getVal(Rye_Bread))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat breads\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4.\nThe bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg.\n// 0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each wheat bread requires 0.2 hours of labor, each rye bread requires 0.3 hours, and each sourdough bread requires 0.4 hours.\n// 0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 breads.\n// Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many wheat breads as rye breads.\n// Wheat_Bread >= 2*Rye_Bread",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per wheat bread is $2, the profit per rye bread is $3, and the profit per sourdough bread is $4. The bakery has 200 kg of flour available daily, with each wheat bread requiring 0.5 kg of flour, each rye bread requiring 0.4 kg, and each sourdough bread requiring 0.6 kg. The bakery also has 100 hours of labor available daily, with each wheat bread requiring 0.2 hours of labor, each rye bread requiring 0.3 hours, and each sourdough bread requiring 0.4 hours. The bakery has a minimum daily demand of 100 breads and aims to produce at least twice as many wheat breads as rye breads. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of wheat breads\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of rye breads\nSourdough_Bread = model.addVar(vtype=\"INTEGER\", name=\"Sourdough_Bread\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread + 4*Sourdough_Bread)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Bread + 0.4*Rye_Bread + 0.6*Sourdough_Bread <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Bread + 0.3*Rye_Bread + 0.4*Sourdough_Bread <= 100)\n## The bakery has a minimum daily demand of 100 breads.\nmodel.addCons(Wheat_Bread + Rye_Bread + Sourdough_Bread >= 100)\n## The bakery aims to produce at least twice as many wheat breads as rye breads.\nmodel.addCons(Wheat_Bread >= 2*Rye_Bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat_Bread))\n    print(\"Number of rye breads: \", model.getVal(Rye_Bread))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor.\n// {\"daily production quantity of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of multigrain bread\": \"Multigrain_Bread\", \"range\": \"Multigrain_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat bread requires 0.2 kg of flour, rye bread requires 0.25 kg, sourdough bread requires 0.3 kg, and multigrain bread requires 0.35 kg.\n// 0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily yeast supply limit of 50 kg. Each loaf of wheat bread requires 0.01 kg of yeast, rye bread requires 0.015 kg, sourdough bread requires 0.02 kg, and multigrain bread requires 0.025 kg.\n// 0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily labor limit of 40 hours. Each loaf of wheat bread requires 0.05 hours of labor, rye bread requires 0.06 hours, sourdough bread requires 0.07 hours, and multigrain bread requires 0.08 hours.\n// 0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat_Bread >= 100\n// Rye_Bread >= 100\n// Sourdough_Bread >= 100\n// Multigrain_Bread >= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor. The profit per loaf for each type of bread is as follows: wheat bread at $2, rye bread at $2.5, sourdough bread at $3, and multigrain bread at $3.5.\n\n| Type of Bread | Profit per Loaf | Flour Required per Loaf (kg) | Yeast Required per Loaf (kg) | Labor Required per Loaf (hours) |\n|---------------|-----------------|-------------------------------|------------------------------|--------------------------------|\n| Wheat         | $2              | 0.2                           | 0.01                         | 0.05                           |\n| Rye           | $2.5            | 0.25                          | 0.015                        | 0.06                           |\n| Sourdough     | $3              | 0.3                           | 0.02                         | 0.07                           |\n| Multigrain    | $3.5            | 0.35                          | 0.025                        | 0.08                           |\n\nThe bakery has a daily flour supply limit of 500 kg, a daily yeast supply limit of 50 kg, and a daily labor limit of 40 hours. Additionally, the bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Bread\", lb=0) # daily production quantity of wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # daily production quantity of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # daily production quantity of sourdough bread\nMultigrain_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Bread\", lb=0) # daily production quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500)\n## The bakery has a daily yeast supply limit of 50 kg.\nmodel.addCons(0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50)\n## The bakery has a daily labor limit of 40 hours.\nmodel.addCons(0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 100)\nmodel.addCons(Sourdough_Bread >= 100)\nmodel.addCons(Multigrain_Bread >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Daily production quantity of multigrain bread: \", model.getVal(Multigrain_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1560,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor.\n// {\"daily production quantity of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough_Bread\", \"range\": \"Sourdough_Bread >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of multigrain bread\": \"Multigrain_Bread\", \"range\": \"Multigrain_Bread >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of wheat bread requires 0.2 kg of flour, rye bread requires 0.25 kg, sourdough bread requires 0.3 kg, and multigrain bread requires 0.35 kg.\n// 0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily yeast supply limit of 50 kg. Each loaf of wheat bread requires 0.01 kg of yeast, rye bread requires 0.015 kg, sourdough bread requires 0.02 kg, and multigrain bread requires 0.025 kg.\n// 0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50\n\n## Generate Constraint-3:\nThe bakery has a daily labor limit of 40 hours. Each loaf of wheat bread requires 0.05 hours of labor, rye bread requires 0.06 hours, sourdough bread requires 0.07 hours, and multigrain bread requires 0.08 hours.\n// 0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// Wheat_Bread >= 100\n// Rye_Bread >= 100\n// Sourdough_Bread >= 100\n// Multigrain_Bread >= 100",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and multigrain. The bakery needs to determine the daily production quantity for each type of bread to maximize profit while considering the constraints of raw materials and labor. The profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for sourdough bread is $3, and the profit per loaf for multigrain bread is $3.5. The bakery has a daily flour supply limit of 500 kg, with each loaf of wheat bread requiring 0.2 kg of flour, rye bread requiring 0.25 kg, sourdough bread requiring 0.3 kg, and multigrain bread requiring 0.35 kg. The bakery also has a daily yeast supply limit of 50 kg, with each loaf of wheat bread requiring 0.01 kg of yeast, rye bread requiring 0.015 kg, sourdough bread requiring 0.02 kg, and multigrain bread requiring 0.025 kg. Additionally, the bakery has a daily labor limit of 40 hours, with each loaf of wheat bread requiring 0.05 hours of labor, rye bread requiring 0.06 hours, sourdough bread requiring 0.07 hours, and multigrain bread requiring 0.08 hours. The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWheat_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Bread\", lb=0) # daily production quantity of wheat bread\nRye_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Bread\", lb=0) # daily production quantity of rye bread\nSourdough_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Bread\", lb=0) # daily production quantity of sourdough bread\nMultigrain_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain_Bread\", lb=0) # daily production quantity of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 2.5*Rye_Bread + 3*Sourdough_Bread + 3.5*Multigrain_Bread)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.2*Wheat_Bread + 0.25*Rye_Bread + 0.3*Sourdough_Bread + 0.35*Multigrain_Bread <= 500)\n## The bakery has a daily yeast supply limit of 50 kg.\nmodel.addCons(0.01*Wheat_Bread + 0.015*Rye_Bread + 0.02*Sourdough_Bread + 0.025*Multigrain_Bread <= 50)\n## The bakery has a daily labor limit of 40 hours.\nmodel.addCons(0.05*Wheat_Bread + 0.06*Rye_Bread + 0.07*Sourdough_Bread + 0.08*Multigrain_Bread <= 40)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 100)\nmodel.addCons(Sourdough_Bread >= 100)\nmodel.addCons(Multigrain_Bread >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough_Bread))\n    print(\"Daily production quantity of multigrain bread: \", model.getVal(Multigrain_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1256,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits.\n// {\"daily production quantity of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 500 hours of labor available per day. Each loaf of white bread requires 0.1 hours of labor, whole wheat bread requires 0.2 hours, rye bread requires 0.3 hours, and sourdough bread requires 0.4 hours.\n// 0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $1000 for raw materials. The cost of raw materials for each loaf of white bread is $0.50, for whole wheat bread is $0.75, for rye bread is $1.00, and for sourdough bread is $1.25.\n// 0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of bread in total each day.\n// White + Whole_Wheat + Rye + Sourdough >= 500\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for each type of bread: 100 loaves of white bread, 150 loaves of whole wheat bread, 50 loaves of rye bread, and 200 loaves of sourdough bread.\n// White >= 100\n// Whole_Wheat >= 150\n// Rye >= 50\n// Sourdough >= 200",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits. The profit per loaf and the labor and raw material costs for each type of bread are given in the following Table.\n\n| Bread Type       | Profit per Loaf | Labor per Loaf | Raw Material Cost per Loaf |\n|------------------|-----------------|----------------|----------------------------|\n| White            | $1.50           | 0.1 hours      | $0.50                      |\n| Whole Wheat      | $2.00           | 0.2 hours      | $0.75                      |\n| Rye              | $2.50           | 0.3 hours      | $1.00                      |\n| Sourdough        | $3.00           | 0.4 hours      | $1.25                      |\n\nThe bakery has a total of 500 hours of labor available per day and a daily budget of $1000 for raw materials. The bakery must produce at least 500 loaves of bread in total each day. Additionally, the bakery has a minimum daily demand for each type of bread: 100 loaves of white bread, 150 loaves of whole wheat bread, 50 loaves of rye bread, and 200 loaves of sourdough bread.\n\nPlease help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production quantity of white bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a total of 500 hours of labor available per day.\nmodel.addCons(0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500)\n## The bakery has a daily budget of $1000 for raw materials.\nmodel.addCons(0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000)\n## The bakery must produce at least 500 loaves of bread in total each day.\nmodel.addCons(White + Whole_Wheat + Rye + Sourdough >= 500)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(White >= 100)\nmodel.addCons(Whole_Wheat >= 150)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of white bread: \", model.getVal(White))\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1280,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits.\n// {\"daily production quantity of white bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 500 hours of labor available per day. Each loaf of white bread requires 0.1 hours of labor, whole wheat bread requires 0.2 hours, rye bread requires 0.3 hours, and sourdough bread requires 0.4 hours.\n// 0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily budget of $1000 for raw materials. The cost of raw materials for each loaf of white bread is $0.50, for whole wheat bread is $0.75, for rye bread is $1.00, and for sourdough bread is $1.25.\n// 0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of bread in total each day.\n// White + Whole_Wheat + Rye + Sourdough >= 500\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for each type of bread: 100 loaves of white bread, 150 loaves of whole wheat bread, 50 loaves of rye bread, and 200 loaves of sourdough bread.\n// White >= 100\n// Whole_Wheat >= 150\n// Rye >= 50\n// Sourdough >= 200",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread to optimize its resources and profits. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $2.50, and for sourdough bread is $3.00. The bakery wants to maximize the total daily profit from bread sales.\nThe bakery has a total of 500 hours of labor available per day. Each loaf of white bread requires 0.1 hours of labor, whole wheat bread requires 0.2 hours, rye bread requires 0.3 hours, and sourdough bread requires 0.4 hours.\nThe bakery has a daily budget of $1000 for raw materials. The cost of raw materials for each loaf of white bread is $0.50, for whole wheat bread is $0.75, for rye bread is $1.00, and for sourdough bread is $1.25.\nThe bakery must produce at least 500 loaves of bread in total each day. The bakery also has a minimum daily demand for each type of bread: 100 loaves of white bread, 150 loaves of whole wheat bread, 50 loaves of rye bread, and 200 loaves of sourdough bread.\nPlease help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWhite = model.addVar(vtype=\"CONTINUOUS\", name=\"White\", lb=0) # daily production quantity of white bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*Whole_Wheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a total of 500 hours of labor available per day.\nmodel.addCons(0.1*White + 0.2*Whole_Wheat + 0.3*Rye + 0.4*Sourdough <= 500)\n## The bakery has a daily budget of $1000 for raw materials.\nmodel.addCons(0.50*White + 0.75*Whole_Wheat + 1.00*Rye + 1.25*Sourdough <= 1000)\n## The bakery must produce at least 500 loaves of bread in total each day.\nmodel.addCons(White + Whole_Wheat + Rye + Sourdough >= 500)\n## The bakery has a minimum daily demand for each type of bread.\nmodel.addCons(White >= 100)\nmodel.addCons(Whole_Wheat >= 150)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sourdough >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of white bread: \", model.getVal(White))\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit.\n// {\"number of white bread loaves\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of whole wheat bread loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds.\n// 0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints.\n// White_Bread + Whole_Wheat + Rye + Sourdough <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation.\n// Whole_Wheat >= 500\n\n## Generate Constraint-4:\nThe bakery wants to ensure at least 10% of the total production is sourdough bread to maintain its artisanal reputation.\n// Sourdough >= 0.10 * (White_Bread + Whole_Wheat + Rye + Sourdough)",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| White Bread      | $1.50           |\n| Whole Wheat Bread| $2.00           |\n| Rye Bread        | $1.75           |\n| Sourdough Bread  | $2.50           |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds. The bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints. The bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation. Additionally, the bakery wants to ensure at least 10% of the total production is sourdough bread to maintain its artisanal reputation.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal daily production quantity for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of white bread loaves\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of whole wheat bread loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000)\n## The bakery can produce a maximum of 2000 loaves daily.\nmodel.addCons(White_Bread + Whole_Wheat + Rye + Sourdough <= 2000)\n## The bakery must produce at least 500 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat >= 500)\n## The bakery wants to ensure at least 10% of the total production is sourdough bread.\nmodel.addCons(Sourdough >= 0.10 * (White_Bread + Whole_Wheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white bread loaves: \", model.getVal(White_Bread))\n    print(\"Number of whole wheat bread loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit.\n// {\"number of white bread loaves\": \"White_Bread\", \"range\": \"White_Bread >= 0\", \"type\": \"continuous\"}\n// {\"number of whole wheat bread loaves\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds.\n// 0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints.\n// White_Bread + Whole_Wheat + Rye + Sourdough <= 2000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation.\n// Whole_Wheat >= 500\n\n## Generate Constraint-4:\nThe bakery wants to ensure at least 10% of the total production is sourdough bread to maintain its artisanal reputation.\n// Sourdough >= 0.10 * (White_Bread + Whole_Wheat + Rye + Sourdough)",
        "question": "A bakery produces four types of bread: white bread, whole wheat bread, rye bread, and sourdough bread. The bakery needs to determine the daily production quantity for each type of bread to maximize profit. The profit per loaf for white bread is $1.50, for whole wheat bread is $2.00, for rye bread is $1.75, and for sourdough bread is $2.50. The bakery has a total of 1000 pounds of flour available daily. Each loaf of white bread requires 0.5 pounds of flour, whole wheat bread requires 0.6 pounds, rye bread requires 0.4 pounds, and sourdough bread requires 0.7 pounds. The bakery can produce a maximum of 2000 loaves daily due to oven capacity and labor constraints. The bakery must produce at least 500 loaves of whole wheat bread to meet a contract obligation. The bakery wants to ensure at least 10% of the total production is sourdough bread to maintain its artisanal reputation. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhite_Bread = model.addVar(vtype=\"CONTINUOUS\", name=\"White_Bread\", lb=0) # number of white bread loaves\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of whole wheat bread loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White_Bread + 2.00*Whole_Wheat + 1.75*Rye + 2.50*Sourdough)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(0.5*White_Bread + 0.6*Whole_Wheat + 0.4*Rye + 0.7*Sourdough <= 1000)\n## The bakery can produce a maximum of 2000 loaves daily.\nmodel.addCons(White_Bread + Whole_Wheat + Rye + Sourdough <= 2000)\n## The bakery must produce at least 500 loaves of whole wheat bread.\nmodel.addCons(Whole_Wheat >= 500)\n## The bakery wants to ensure at least 10% of the total production is sourdough bread.\nmodel.addCons(Sourdough >= 0.10 * (White_Bread + Whole_Wheat + Rye + Sourdough))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white bread loaves: \", model.getVal(White_Bread))\n    print(\"Number of whole wheat bread loaves: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WWB + 2.5*RB + 3*SDB\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds.\n// 1.5*WWB + 1.2*RB + 1.8*SDB <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 loaves per day. The bakery can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread.\n// WWB <= 300\n// RB <= 200\n// SDB <= 200\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours.\n// 0.5*WWB + 0.4*RB + 0.6*SDB <= 400\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand.\n// WWB >= 100\n// RB >= 100\n// SDB >= 100",
        "question": "A bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for each type of bread is as follows:\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.5            |\n| Sourdough     | $3              |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds. The bakery has a maximum oven capacity of 600 loaves per day, with a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread. The bakery also has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours. The bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWWB = model.addVar(vtype=\"CONTINUOUS\", name=\"WWB\", lb=0) # daily production quantity of whole wheat bread\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # daily production quantity of rye bread\nSDB = model.addVar(vtype=\"CONTINUOUS\", name=\"SDB\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.5*RB + 3*SDB)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WWB + 1.2*RB + 1.8*SDB <= 1000)\n## The bakery has a maximum oven capacity of 600 loaves per day.\nmodel.addCons(WWB <= 300)\nmodel.addCons(RB <= 200)\nmodel.addCons(SDB <= 200)\n## The bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.6*SDB <= 400)\n## The bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand.\nmodel.addCons(WWB >= 100)\nmodel.addCons(RB >= 100)\nmodel.addCons(SDB >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WWB))\n    print(\"Daily production quantity of rye bread: \", model.getVal(RB))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(SDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1266,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*WWB + 2.5*RB + 3*SDB\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds.\n// 1.5*WWB + 1.2*RB + 1.8*SDB <= 1000\n\n## Generate Constraint-2:\nThe bakery has a maximum oven capacity of 600 loaves per day. The bakery can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread.\n// WWB <= 300\n// RB <= 200\n// SDB <= 200\n\n## Generate Constraint-3:\nThe bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours.\n// 0.5*WWB + 0.4*RB + 0.6*SDB <= 400\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand.\n// WWB >= 100\n// RB >= 100\n// SDB >= 100",
        "question": "A bakery wants to optimize the production of three types of bread: whole wheat, rye, and sourdough. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.5, and the profit per loaf for sourdough bread is $3. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat bread requires 1.5 pounds of flour, each loaf of rye bread requires 1.2 pounds, and each loaf of sourdough bread requires 1.8 pounds. The bakery has a maximum oven capacity of 600 loaves per day and can produce a maximum of 300 loaves of whole wheat bread, 200 loaves of rye bread, and 200 loaves of sourdough bread. The bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours. Each loaf of whole wheat bread requires 0.5 hours, each loaf of rye bread requires 0.4 hours, and each loaf of sourdough bread requires 0.6 hours. The bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand. Please help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWWB = model.addVar(vtype=\"CONTINUOUS\", name=\"WWB\", lb=0) # daily production quantity of whole wheat bread\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # daily production quantity of rye bread\nSDB = model.addVar(vtype=\"CONTINUOUS\", name=\"SDB\", lb=0) # daily production quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.5*RB + 3*SDB)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WWB + 1.2*RB + 1.8*SDB <= 1000)\n## The bakery has a maximum oven capacity of 600 loaves per day.\nmodel.addCons(WWB <= 300)\nmodel.addCons(RB <= 200)\nmodel.addCons(SDB <= 200)\n## The bakery has a labor constraint where the total hours spent on bread production cannot exceed 400 hours.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.6*SDB <= 400)\n## The bakery wants to ensure that at least 100 loaves of each type of bread are produced daily to meet a minimum customer demand.\nmodel.addCons(WWB >= 100)\nmodel.addCons(RB >= 100)\nmodel.addCons(SDB >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WWB))\n    print(\"Daily production quantity of rye bread: \", model.getVal(RB))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(SDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours.\n// 0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// WholeWheat + Rye + Sourdough + Baguette <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// WholeWheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// Baguette >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $1.20           |\n| Rye              | $1.50           |\n| Sourdough        | $2.00           |\n| Baguette         | $1.00           |\n\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds. The bakery has a daily labor limit of 8 hours, with each loaf of whole wheat taking 0.02 hours to make, rye taking 0.01 hours, sourdough taking 0.03 hours, and baguette taking 0.01 hours. The bakery also has a storage capacity limit of 500 loaves. Additionally, the bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # daily production quantity of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Baguette <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Baguette >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread.\n// {\"daily production quantity of whole wheat bread\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of baguette\": \"Baguette\", \"range\": \"Baguette >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds.\n// 1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours.\n// 0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 500 loaves.\n// WholeWheat + Rye + Sourdough + Baguette <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\n// WholeWheat >= 100\n// Rye >= 100\n// Sourdough >= 100\n// Baguette >= 100",
        "question": "A bakery wants to optimize the production of four types of bread: whole wheat, rye, sourdough, and baguette. The bakery needs to determine the daily production quantity for each type of bread. The profit per loaf for whole wheat is $1.20, for rye is $1.50, for sourdough is $2.00, and for baguette is $1.00. The bakery wants to maximize the total daily profit. The bakery has a total of 1000 pounds of flour available daily. Each loaf of whole wheat requires 1.5 pounds of flour, rye requires 1 pound, sourdough requires 2 pounds, and baguette requires 0.5 pounds. The bakery has a daily labor limit of 8 hours. Each loaf of whole wheat takes 0.02 hours to make, rye takes 0.01 hours, sourdough takes 0.03 hours, and baguette takes 0.01 hours. The bakery has a storage capacity limit of 500 loaves. The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations. Please help the bakery determine the optimal daily production quantity for each type of bread to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # daily production quantity of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # daily production quantity of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # daily production quantity of sourdough bread\nBaguette = model.addVar(vtype=\"CONTINUOUS\", name=\"Baguette\", lb=0) # daily production quantity of baguette\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.20*WholeWheat + 1.50*Rye + 2.00*Sourdough + 1.00*Baguette)\n\n# Add constraints\n## The bakery has a total of 1000 pounds of flour available daily.\nmodel.addCons(1.5*WholeWheat + 1*Rye + 2*Sourdough + 0.5*Baguette <= 1000)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.02*WholeWheat + 0.01*Rye + 0.03*Sourdough + 0.01*Baguette <= 8)\n## The bakery has a storage capacity limit of 500 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Baguette <= 500)\n## The bakery must produce at least 100 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\nmodel.addCons(Baguette >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of whole wheat bread: \", model.getVal(WholeWheat))\n    print(\"Daily production quantity of rye bread: \", model.getVal(Rye))\n    print(\"Daily production quantity of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Daily production quantity of baguette: \", model.getVal(Baguette))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in hours\": \"Production_Hours\", \"range\": \"Production_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from selling these pastries.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each croissant requires 50 grams of flour, each muffin requires 80 grams, and each donut requires 60 grams. The daily supply of flour is 10 kilograms.\n// 50*Croissants + 80*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar. Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 25 grams. The daily supply of sugar is 4 kilograms.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 4000\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 100 units of pastries in total each day.\n// Croissants + Muffins + Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours. The bakery has a limited supply of flour and sugar. Each croissant requires 50 grams of flour and 20 grams of sugar, each muffin requires 80 grams of flour and 30 grams of sugar, and each donut requires 60 grams of flour and 25 grams of sugar. The daily supply of flour is 10 kilograms and the daily supply of sugar is 4 kilograms. The bakery aims to produce at least 100 units of pastries in total each day.\n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Sugar Required (grams) | Production Time (hours) |\n|----------|-----------------|------------------------|------------------------|-------------------------|\n| Croissant| $0.50           | 50                     | 20                     | 0.05                    |\n| Muffin   | $0.75           | 80                     | 30                     | 0.10                    |\n| Donut    | $0.60           | 60                     | 25                     | 0.08                    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Production_Hours\", lb=0) # daily production capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours)\nmodel.addCons(Production_Hours == 8)\n## The bakery has a limited supply of flour.\nmodel.addCons(50*Croissants + 80*Muffins + 60*Donuts <= 10000)\n## The bakery has a limited supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 4000)\n## The bakery aims to produce at least 100 units of pastries in total each day.\nmodel.addCons(Croissants + Muffins + Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1523,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity in hours\": \"Production_Hours\", \"range\": \"Production_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from selling these pastries.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours.\n// 0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour. Each croissant requires 50 grams of flour, each muffin requires 80 grams, and each donut requires 60 grams. The daily supply of flour is 10 kilograms.\n// 50*Croissants + 80*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar. Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 25 grams. The daily supply of sugar is 4 kilograms.\n// 20*Croissants + 30*Muffins + 25*Donuts <= 4000\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 100 units of pastries in total each day.\n// Croissants + Muffins + Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has a daily production capacity of 8 hours. Each croissant requires 0.05 hours to produce, each muffin requires 0.10 hours, and each donut requires 0.08 hours. The bakery has a limited supply of flour, with each croissant requiring 50 grams, each muffin requiring 80 grams, and each donut requiring 60 grams, and a daily supply of 10 kilograms. The bakery also has a limited supply of sugar, with each croissant requiring 20 grams, each muffin requiring 30 grams, and each donut requiring 25 grams, and a daily supply of 4 kilograms. The bakery aims to produce at least 100 units of pastries in total each day. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Production_Hours\", lb=0) # daily production capacity in hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 8 hours.\nmodel.addCons(0.05*Croissants + 0.10*Muffins + 0.08*Donuts <= Production_Hours)\nmodel.addCons(Production_Hours == 8)\n## The bakery has a limited supply of flour.\nmodel.addCons(50*Croissants + 80*Muffins + 60*Donuts <= 10000)\n## The bakery has a limited supply of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 25*Donuts <= 4000)\n## The bakery aims to produce at least 100 units of pastries in total each day.\nmodel.addCons(Croissants + Muffins + Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of workers required\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\n// 50*Croissants + 75*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-3:\nThe bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\n// Workers <= 5\n// Croissants + Muffins + Donuts <= 100*Workers\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Labor Time (minutes) |\n|----------|-----------------|------------------------|----------------------|\n| Croissant| $0.50           | 50                     | 10                   |\n| Muffin   | $0.75           | 75                     | 15                   |\n| Donut    | $0.60           | 60                     | 12                   |\n\nThe bakery has 10 kg of flour available daily. Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily. The bakery can hire up to 5 workers, and each worker can produce a maximum of 100 pastries of any type daily. The bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement.\n\nPlease help the bakery to determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers required\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\nmodel.addCons(50*Croissants + 75*Muffins + 60*Donuts <= 10000)\n## Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\nmodel.addCons(Workers <= 5)\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Workers)\n## The bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of workers required: \", model.getVal(Workers))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"number of workers required\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery wants to maximize the total daily profit.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\n// 50*Croissants + 75*Muffins + 60*Donuts <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\n// 10*Croissants + 15*Muffins + 12*Donuts <= 480\n\n## Generate Constraint-3:\nThe bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\n// Workers <= 5\n// Croissants + Muffins + Donuts <= 100*Workers\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement.\n// Croissants + Muffins + Donuts >= 50",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the available ingredients and labor. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery has 10 kg of flour available daily, and each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 8 hours of labor available daily, and each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery can hire up to 5 workers, and each worker can produce a maximum of 100 pastries of any type daily. The bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers required\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 60 grams. The bakery has 10 kg of flour available daily.\nmodel.addCons(50*Croissants + 75*Muffins + 60*Donuts <= 10000)\n## Each croissant requires 10 minutes of labor, each muffin requires 15 minutes, and each donut requires 12 minutes. The bakery has 8 hours of labor available daily.\nmodel.addCons(10*Croissants + 15*Muffins + 12*Donuts <= 480)\n## The bakery can hire up to 5 workers. Each worker can produce a maximum of 100 pastries of any type daily.\nmodel.addCons(Workers <= 5)\nmodel.addCons(Croissants + Muffins + Donuts <= 100*Workers)\n## The bakery must produce at least 50 pastries of any type daily to meet the minimum order requirement.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Number of workers required: \", model.getVal(Workers))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 100 kg available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 50 kg available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50\n\n## Generate Constraint-4:\nThe bakery has a limited amount of butter, with 30 kg available daily. Each croissant requires 0.08 kg of butter, each muffin requires 0.05 kg, and each eclair requires 0.1 kg.\n// 0.08*Croissants + 0.05*Muffins + 0.1*Eclairs <= 30",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery has a daily production capacity of 500 pastries. The bakery has a limited amount of flour, with 100 kg available daily, where each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. The bakery also has a limited amount of sugar, with 50 kg available daily, where each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg. Additionally, the bakery has a limited amount of butter, with 30 kg available daily, where each croissant requires 0.08 kg of butter, each muffin requires 0.05 kg, and each eclair requires 0.1 kg.\n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (kg) | Sugar Required (kg) | Butter Required (kg) |\n|----------|-----------------|---------------------|---------------------|----------------------|\n| Croissant| $0.50           | 0.1                 | 0.05                | 0.08                 |\n| Muffin   | $0.75           | 0.2                 | 0.1                 | 0.05                 |\n| Eclair   | $1.00           | 0.3                 | 0.15                | 0.1                  |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Eclairs <= 500)\n## The bakery has a limited amount of flour, with 100 kg available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100)\n## The bakery has a limited amount of sugar, with 50 kg available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50)\n## The bakery has a limited amount of butter, with 30 kg available daily.\nmodel.addCons(0.08*Croissants + 0.05*Muffins + 0.1*Eclairs <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1523,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 pastries.\n// Croissants + Muffins + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 100 kg available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 50 kg available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50\n\n## Generate Constraint-4:\nThe bakery has a limited amount of butter, with 30 kg available daily. Each croissant requires 0.08 kg of butter, each muffin requires 0.05 kg, and each eclair requires 0.1 kg.\n// 0.08*Croissants + 0.05*Muffins + 0.1*Eclairs <= 30",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.00. The bakery has a daily production capacity of 500 pastries. The bakery has a limited amount of flour, with 100 kg available daily, where each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each eclair requires 0.3 kg. The bakery also has a limited amount of sugar, with 50 kg available daily, where each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each eclair requires 0.15 kg. Additionally, the bakery has a limited amount of butter, with 30 kg available daily, where each croissant requires 0.08 kg of butter, each muffin requires 0.05 kg, and each eclair requires 0.1 kg. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 pastries.\nmodel.addCons(Croissants + Muffins + Eclairs <= 500)\n## The bakery has a limited amount of flour, with 100 kg available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 100)\n## The bakery has a limited amount of sugar, with 50 kg available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Eclairs <= 50)\n## The bakery has a limited amount of butter, with 30 kg available daily.\nmodel.addCons(0.08*Croissants + 0.05*Muffins + 0.1*Eclairs <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of cookies to produce\": \"Cookies\", \"range\": \"Cookies >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\n// 50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\n// 30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 150 pastries.\n// Croissants + Muffins + Cupcakes + Cookies <= 150\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 cookies daily to meet a contract obligation.\n// Cookies >= 20",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per pastry is $0.50 for croissants, $0.75 for muffins, $1.00 for cupcakes, and $0.40 for cookies. The bakery aims to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Sugar Required (grams) |\n|----------|-----------------|------------------------|------------------------|\n| Croissants | $0.50          | 50                     | 30                     |\n| Muffins   | $0.75          | 80                     | 40                     |\n| Cupcakes  | $1.00          | 100                    | 50                     |\n| Cookies   | $0.40          | 30                     | 20                     |\n\nThe bakery has 10 kilograms of flour and 6 kilograms of sugar available daily. The bakery has a daily production capacity of 150 pastries. The bakery must produce at least 20 cookies daily to meet a contract obligation.\n\nPlease help the bakery to determine the optimal number of each type of pastry to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nCookies = model.addVar(vtype=\"INTEGER\", name=\"Cookies\", lb=0) # number of cookies to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\nmodel.addCons(50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000)\n## Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\nmodel.addCons(30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000)\n## The bakery has a daily production capacity of 150 pastries.\nmodel.addCons(Croissants + Muffins + Cupcakes + Cookies <= 150)\n## The bakery must produce at least 20 cookies daily to meet a contract obligation.\nmodel.addCons(Cookies >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of cookies to produce: \", model.getVal(Cookies))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of cookies to produce\": \"Cookies\", \"range\": \"Cookies >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\n// 50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000\n\n## Generate Constraint-2:\nEach croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\n// 30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 150 pastries.\n// Croissants + Muffins + Cupcakes + Cookies <= 150\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 cookies daily to meet a contract obligation.\n// Cookies >= 20",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and cookies. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, per cupcake is $1.00, and per cookie is $0.40. Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily. Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily. The bakery has a daily production capacity of 150 pastries. The bakery must produce at least 20 cookies daily to meet a contract obligation. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nCookies = model.addVar(vtype=\"INTEGER\", name=\"Cookies\", lb=0) # number of cookies to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Cupcakes + 0.40*Cookies)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 80 grams, each cupcake requires 100 grams, and each cookie requires 30 grams. The bakery has 10 kilograms of flour available daily.\nmodel.addCons(50*Croissants + 80*Muffins + 100*Cupcakes + 30*Cookies <= 10000)\n## Each croissant requires 30 grams of sugar, each muffin requires 40 grams, each cupcake requires 50 grams, and each cookie requires 20 grams. The bakery has 6 kilograms of sugar available daily.\nmodel.addCons(30*Croissants + 40*Muffins + 50*Cupcakes + 20*Cookies <= 6000)\n## The bakery has a daily production capacity of 150 pastries.\nmodel.addCons(Croissants + Muffins + Cupcakes + Cookies <= 150)\n## The bakery must produce at least 20 cookies daily to meet a contract obligation.\nmodel.addCons(Cookies >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of cookies to produce: \", model.getVal(Cookies))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven usage time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 100 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a total of 50 kg of yeast available daily. Each loaf of wheat bread requires 0.1 kg of yeast, rye bread requires 0.2 kg, and sourdough bread requires 0.3 kg.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50\n\n## Generate Constraint-3:\nThe bakery's oven can operate for a maximum of 12 hours daily. Each loaf of wheat bread requires 0.1 hours of oven time, rye bread requires 0.2 hours, and sourdough bread requires 0.3 hours.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of bread daily.\n// Wheat + Rye + Sourdough >= 20",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit. The following table summarizes the requirements for each type of bread:\n\n| Bread Type   | Profit per Loaf | Flour Requirement (kg) | Yeast Requirement (kg) | Oven Time (hours) |\n|--------------|-----------------|------------------------|------------------------|-------------------|\n| Wheat        | $2              | 0.5                    | 0.1                    | 0.1               |\n| Rye          | $3              | 0.6                    | 0.2                    | 0.2               |\n| Sourdough    | $4              | 0.7                    | 0.3                    | 0.3               |\n\nThe bakery has a total of 100 kg of flour and 50 kg of yeast available daily. The bakery's oven can operate for a maximum of 12 hours daily. The bakery must produce at least 20 loaves of bread daily. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a total of 100 kg of flour available daily.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100)\n## The bakery has a total of 50 kg of yeast available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50)\n## The bakery's oven can operate for a maximum of 12 hours daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12)\n## The bakery must produce at least 20 loaves of bread daily.\nmodel.addCons(Wheat + Rye + Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven usage time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a total of 100 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg.\n// 0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100\n\n## Generate Constraint-2:\nThe bakery has a total of 50 kg of yeast available daily. Each loaf of wheat bread requires 0.1 kg of yeast, rye bread requires 0.2 kg, and sourdough bread requires 0.3 kg.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50\n\n## Generate Constraint-3:\nThe bakery's oven can operate for a maximum of 12 hours daily. Each loaf of wheat bread requires 0.1 hours of oven time, rye bread requires 0.2 hours, and sourdough bread requires 0.3 hours.\n// 0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of bread daily.\n// Wheat + Rye + Sourdough >= 20",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type to bake daily to maximize profit while considering the availability of ingredients and oven capacity.\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit.\nThe bakery has a total of 100 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, rye bread requires 0.6 kg, and sourdough bread requires 0.7 kg.\nThe bakery has a total of 50 kg of yeast available daily. Each loaf of wheat bread requires 0.1 kg of yeast, rye bread requires 0.2 kg, and sourdough bread requires 0.3 kg.\nThe bakery's oven can operate for a maximum of 12 hours daily. Each loaf of wheat bread requires 0.1 hours of oven time, rye bread requires 0.2 hours, and sourdough bread requires 0.3 hours.\nThe bakery must produce at least 20 loaves of bread daily.\nPlease help the bakery to determine the optimal number of loaves of each type of bread to bake daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a total of 100 kg of flour available daily.\nmodel.addCons(0.5*Wheat + 0.6*Rye + 0.7*Sourdough <= 100)\n## The bakery has a total of 50 kg of yeast available daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 50)\n## The bakery's oven can operate for a maximum of 12 hours daily.\nmodel.addCons(0.1*Wheat + 0.2*Rye + 0.3*Sourdough <= 12)\n## The bakery must produce at least 20 loaves of bread daily.\nmodel.addCons(Wheat + Rye + Sourdough >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost to produce each croissant is $0.50, and the selling price is $1.50.\nThe cost to produce each muffin is $0.40, and the selling price is $1.20.\nThe cost to produce each doughnut is $0.60, and the selling price is $1.80.\nThe cost to produce each eclair is $0.70, and the selling price is $2.00.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n// Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 total pastries due to oven capacity.\n// Croissants + Muffins + Doughnuts + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\n// 0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 of each type of pastry to meet customer expectations.\n// Croissants >= 50, Muffins >= 50, Doughnuts >= 50, Eclairs >= 50\n\n## Generate Constraint-4:\nThe bakery has a budget constraint for ingredients, with a total cost of ingredients not exceeding $250 per day. The cost of ingredients for each croissant is $0.30, for each muffin is $0.20, for each doughnut is $0.35, and for each eclair is $0.40.\n// 0.30*Croissants + 0.20*Muffins + 0.35*Doughnuts + 0.40*Eclairs <= 250",
        "question": "A bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The cost to produce and the selling price for each pastry are given in the following Table.\n\n| Pastry   | Cost to Produce | Selling Price |\n|----------|-----------------|---------------|\n| Croissant| $0.50           | $1.50         |\n| Muffin   | $0.40           | $1.20         |\n| Doughnut | $0.60           | $1.80         |\n| Eclair   | $0.70           | $2.00         |\n\nThe bakery has a daily limit of 500 total pastries due to oven capacity. The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce. The bakery must produce at least 50 of each type of pastry to meet customer expectations. The bakery has a budget constraint for ingredients, with a total cost of ingredients not exceeding $250 per day. The cost of ingredients for each croissant is $0.30, for each muffin is $0.20, for each doughnut is $0.35, and for each eclair is $0.40.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n## Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nTotal_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\nTotal_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 500 total pastries due to oven capacity.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 500)\n## The bakery has a daily labor constraint of 40 hours.\nmodel.addCons(0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40)\n## The bakery must produce at least 50 of each type of pastry.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Doughnuts >= 50)\nmodel.addCons(Eclairs >= 50)\n## The bakery has a budget constraint for ingredients.\nmodel.addCons(0.30*Croissants + 0.20*Muffins + 0.35*Doughnuts + 0.40*Eclairs <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1395,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost to produce each croissant is $0.50, and the selling price is $1.50.\nThe cost to produce each muffin is $0.40, and the selling price is $1.20.\nThe cost to produce each doughnut is $0.60, and the selling price is $1.80.\nThe cost to produce each eclair is $0.70, and the selling price is $2.00.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n// Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 total pastries due to oven capacity.\n// Croissants + Muffins + Doughnuts + Eclairs <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce.\n// 0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 of each type of pastry to meet customer expectations.\n// Croissants >= 50, Muffins >= 50, Doughnuts >= 50, Eclairs >= 50\n\n## Generate Constraint-4:\nThe bakery has a budget constraint for ingredients, with a total cost of ingredients not exceeding $250 per day. The cost of ingredients for each croissant is $0.30, for each muffin is $0.20, for each doughnut is $0.35, and for each eclair is $0.40.\n// 0.30*Croissants + 0.20*Muffins + 0.35*Doughnuts + 0.40*Eclairs <= 250",
        "question": "A bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. Each type of pastry has a different cost to produce and a different selling price. The cost to produce each croissant is $0.50, and the selling price is $1.50. The cost to produce each muffin is $0.40, and the selling price is $1.20. The cost to produce each doughnut is $0.60, and the selling price is $1.80. The cost to produce each eclair is $0.70, and the selling price is $2.00. The bakery wants to maximize the daily profit.\n\nThe bakery has a daily limit of 500 total pastries due to oven capacity. The bakery has a daily labor constraint of 40 hours, with each croissant requiring 0.05 hours, each muffin requiring 0.04 hours, each doughnut requiring 0.06 hours, and each eclair requiring 0.07 hours to produce. The bakery must produce at least 50 of each type of pastry to meet customer expectations. The bakery has a budget constraint for ingredients, with a total cost of ingredients not exceeding $250 per day. The cost of ingredients for each croissant is $0.30, for each muffin is $0.20, for each doughnut is $0.35, and for each eclair is $0.40.\n\nPlease help the bakery determine the optimal number of each type of pastry to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\n## Total_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nTotal_Revenue = 1.50*Croissants + 1.20*Muffins + 1.80*Doughnuts + 2.00*Eclairs\nTotal_Cost = 0.50*Croissants + 0.40*Muffins + 0.60*Doughnuts + 0.70*Eclairs\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has a daily limit of 500 total pastries due to oven capacity.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 500)\n## The bakery has a daily labor constraint of 40 hours.\nmodel.addCons(0.05*Croissants + 0.04*Muffins + 0.06*Doughnuts + 0.07*Eclairs <= 40)\n## The bakery must produce at least 50 of each type of pastry.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Doughnuts >= 50)\nmodel.addCons(Eclairs >= 50)\n## The bakery has a budget constraint for ingredients.\nmodel.addCons(0.30*Croissants + 0.20*Muffins + 0.35*Doughnuts + 0.40*Eclairs <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n// Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50\n\n## Generate Constraint-3:\nThe bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 pastries of each type are produced daily.\n// Croissants >= 50, Muffins >= 50, Cupcakes >= 50, Doughnuts >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The selling price and cost per pastry are given in the following Table.\n\n| Pastry   | Selling Price | Cost |\n|----------|---------------|------|\n| Croissant| 2$            | 1$   |\n| Muffin   | 3$            | 1.5$ |\n| Cupcake  | 4$            | 2$   |\n| Doughnut | 2.5$          | 1.2$ |\n\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg. The bakery also has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg. Additionally, the bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours. The bakery wants to ensure that at least 50 pastries of each type are produced daily.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n## Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\nTotal_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50)\n## The bakery has 8 hours of labor available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8)\n## The bakery wants to ensure that at least 50 pastries of each type are produced daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Cupcakes >= 50)\nmodel.addCons(Doughnuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1356,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of cupcakes to produce\": \"Cupcakes\", \"range\": \"Cupcakes >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery wants to maximize the daily profit.\n// Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n// Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has 100 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, each cupcake requires 0.3 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100\n\n## Generate Constraint-2:\nThe bakery has 50 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, each cupcake requires 0.15 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50\n\n## Generate Constraint-3:\nThe bakery has 8 hours of labor available daily. Each croissant requires 0.05 hours of labor, each muffin requires 0.1 hours, each cupcake requires 0.15 hours, and each doughnut requires 0.08 hours.\n// 0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 pastries of each type are produced daily.\n// Croissants >= 50, Muffins >= 50, Cupcakes >= 50, Doughnuts >= 50",
        "question": "A bakery produces four types of pastries: croissants, muffins, cupcakes, and doughnuts. Each type of pastry requires a specific amount of ingredients and time to produce. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit. The selling price per croissant is $2, per muffin is $3, per cupcake is $4, and per doughnut is $2.5. The cost per croissant is $1, per muffin is $1.5, per cupcake is $2, and per doughnut is $1.2. The bakery has 100 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, each cupcake requiring 0.3 kg, and each doughnut requiring 0.15 kg. The bakery also has 50 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, each cupcake requiring 0.15 kg, and each doughnut requiring 0.08 kg. Additionally, the bakery has 8 hours of labor available daily, with each croissant requiring 0.05 hours of labor, each muffin requiring 0.1 hours, each cupcake requiring 0.15 hours, and each doughnut requiring 0.08 hours. The bakery wants to ensure that at least 50 pastries of each type are produced daily. Please help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nCupcakes = model.addVar(vtype=\"INTEGER\", name=\"Cupcakes\", lb=0) # number of cupcakes to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\n## Total_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nTotal_Revenue = 2*Croissants + 3*Muffins + 4*Cupcakes + 2.5*Doughnuts\nTotal_Cost = 1*Croissants + 1.5*Muffins + 2*Cupcakes + 1.2*Doughnuts\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The bakery has 100 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Cupcakes + 0.15*Doughnuts <= 100)\n## The bakery has 50 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 50)\n## The bakery has 8 hours of labor available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.15*Cupcakes + 0.08*Doughnuts <= 8)\n## The bakery wants to ensure that at least 50 pastries of each type are produced daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\nmodel.addCons(Cupcakes >= 50)\nmodel.addCons(Doughnuts >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of cupcakes to produce: \", model.getVal(Cupcakes))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day. Each loaf of Bread 1-4 requires 1, 1.2, 1.1, and 1.3 oven-hours, respectively.\n// x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\n// x1 >= 20\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3.\n// x2 <= x1 + x3",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, and each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery also has a limited oven capacity, which can bake a maximum of 150 loaves per day, with each loaf of Bread 1-4 requiring 1, 1.2, 1.1, and 1.3 oven-hours, respectively.\n\nThe bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation. Additionally, the bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf | Oven-Hours per Loaf |\n|------------|-----------------|----------------------|---------------------|\n| Bread 1    | $1.50           | 0.5                  | 1                   |\n| Bread 2    | $2.00           | 0.7                  | 1.2                 |\n| Bread 3    | $1.75           | 0.6                  | 1.1                 |\n| Bread 4    | $1.80           | 0.8                  | 1.3                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day.\nmodel.addCons(x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\nmodel.addCons(x1 >= 20)\n## The bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3.\nmodel.addCons(x2 <= x1 + x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1422,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day. Each loaf of Bread 1-4 requires 1, 1.2, 1.1, and 1.3 oven-hours, respectively.\n// x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\n// x1 >= 20\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3.\n// x2 <= x1 + x3",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery's oven capacity is limited to a maximum of 150 loaves per day, with each loaf of Bread 1-4 requiring 1, 1.2, 1.1, and 1.3 oven-hours, respectively. The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation. Additionally, the bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3. Please help the bakery to maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 loaves per day.\nmodel.addCons(x1 + 1.2*x2 + 1.1*x3 + 1.3*x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 per day to meet a contractual obligation.\nmodel.addCons(x1 >= 20)\n## The bakery aims to maintain a balanced product mix, requiring that the number of loaves of Bread 2 should not exceed the combined number of loaves of Bread 1 and Bread 3.\nmodel.addCons(x2 <= x1 + x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\n// x1 >= 20\n\n## Generate Constraint-4:\nDue to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily.\n// x2 <= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The following table summarizes the labor hours required for each type of bread:\n\n| Bread Type | Profit per Loaf | Labor Hours per Loaf |\n|------------|-----------------|----------------------|\n| Bread 1    | $1.50           | 0.5 hours            |\n| Bread 2    | $2.00           | 0.7 hours            |\n| Bread 3    | $1.75           | 0.6 hours            |\n| Bread 4    | $1.80           | 0.8 hours            |\n\nThe bakery has a total of 100 hours of labor available per day. The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily. The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation. Due to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily.\n\nPlease help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(x1 >= 20)\n## Due to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily.\nmodel.addCons(x2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery wants to maximize its daily profit from selling these bread types.\n// Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Bread 1-4 requires 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\n// x1 + x2 + x3 + x4 <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\n// x1 >= 20\n\n## Generate Constraint-4:\nDue to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily.\n// x2 <= 50",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit. The bakery needs to determine the number of loaves of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.80, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Bread 1-4 requiring 0.5, 0.7, 0.6, and 0.8 hours of labor, respectively. The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily. The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation. Due to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily. Please help the bakery maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # number of loaves of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # number of loaves of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # number of loaves of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.80*x4)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited oven capacity, allowing for a maximum of 150 loaves to be baked daily.\nmodel.addCons(x1 + x2 + x3 + x4 <= 150)\n## The bakery must produce at least 20 loaves of Bread 1 daily to meet a contract obligation.\nmodel.addCons(x1 >= 20)\n## Due to market demand, the bakery can sell no more than 50 loaves of Bread 2 daily.\nmodel.addCons(x2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(x1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(x2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(x3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 150 units.\n// prod_B >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B.\n\n| Material/Product | Cost per Unit | Required for Product A | Required for Product B |\n|------------------|---------------|-------------------------|-------------------------|\n| Material X       | $10           | 2 units                 | 1 unit                  |\n| Material Y       | $15           | 1 unit                  | 3 units                 |\n\nThe total amount of Material X available for purchase is limited to 300 units. The total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units. The market demand for Product B is at least 150 units.\n\nPlease help the manufacturer to minimize the total cost of raw materials and production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n## The market demand for Product B is at least 150 units.\nmodel.addCons(prod_B >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products.\n// {\"amount of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X purchased\": \"mat_X\", \"range\": \"mat_X >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y purchased\": \"mat_Y\", \"range\": \"mat_Y >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The manufacturer aims to minimize the total cost of raw materials and production.\n// Objective Function: Minimize: 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B\n\n## Generate Constraint-1:\nThe total amount of Material X available for purchase is limited to 300 units.\n// mat_X <= 300\n\n## Generate Constraint-2:\nThe total amount of Material Y available for purchase is limited to 450 units.\n// mat_Y <= 450\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// prod_A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 150 units.\n// prod_B >= 150",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how much of each raw material to purchase to minimize the total cost while meeting the market demand for both products. The cost of purchasing Material X is $10 per unit, and Material Y is $15 per unit. The production of Product A requires 2 units of Material X and 1 unit of Material Y per unit of Product A. Product B requires 1 unit of Material X and 3 units of Material Y per unit of Product B. The total amount of Material X available for purchase is limited to 300 units, and the total amount of Material Y available for purchase is limited to 450 units. The market demand for Product A is at least 100 units, and the market demand for Product B is at least 150 units. Please help the manufacturer to minimize the total cost of raw materials and production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and each raw material purchased\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # amount of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # amount of Product B produced\nmat_X = model.addVar(vtype=\"INTEGER\", name=\"mat_X\", lb=0) # amount of Material X purchased\nmat_Y = model.addVar(vtype=\"INTEGER\", name=\"mat_Y\", lb=0) # amount of Material Y purchased\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*mat_X + 15*mat_Y + (2*mat_X + mat_Y)*prod_A + (mat_X + 3*mat_Y)*prod_B)\n\n# Add constraints\n## The total amount of Material X available for purchase is limited to 300 units.\nmodel.addCons(mat_X <= 300)\n## The total amount of Material Y available for purchase is limited to 450 units.\nmodel.addCons(mat_Y <= 450)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(prod_A >= 100)\n## The market demand for Product B is at least 150 units.\nmodel.addCons(prod_B >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(prod_B))\n    print(\"Amount of Material X purchased: \", model.getVal(mat_X))\n    print(\"Amount of Material Y purchased: \", model.getVal(mat_Y))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs.\n// {\"amount of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product A\": \"MatX_A\", \"range\": \"MatX_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product B\": \"MatX_B\", \"range\": \"MatX_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product A\": \"MatY_A\", \"range\": \"MatY_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product B\": \"MatY_B\", \"range\": \"MatY_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The manufacturer aims to minimize the total production and material costs.\n// Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n// Production_Cost = 30*Prod_A + 40*Prod_B\n// Objective Function: Minimize: Material_Cost + Production_Cost\n\n## Generate Constraint-1:\nThe total amount of Material X available is 200 units.\n// MatX_A + MatX_B <= 200\n\n## Generate Constraint-2:\nThe total amount of Material Y available is 300 units.\n// MatY_A + MatY_B <= 300\n\n## Generate Constraint-3:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y.\n// MatX_A == 2*Prod_A\n// MatY_A == 3*Prod_A\n\n## Generate Constraint-4:\nEach unit of Product B requires 4 units of Material X and 2 units of Material Y.\n// MatX_B == 4*Prod_B\n// MatY_B == 2*Prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs. The cost of Material X is $10 per unit, the cost of Material Y is $15 per unit, the production cost for Product A is $30 per unit, and for Product B is $40 per unit. The following table summarizes the material requirements for each product:\n\n| Product | Material X Required | Material Y Required |\n|---------|---------------------|---------------------|\n| A       | 2 units             | 3 units             |\n| B       | 4 units             | 2 units             |\n\nThe total amount of Material X available is 200 units, and the total amount of Material Y available is 300 units. Each unit of Product A requires 2 units of Material X and 3 units of Material Y, while each unit of Product B requires 4 units of Material X and 2 units of Material Y. \n\nPlease help the manufacturer to minimize the total production and material costs by determining the optimal amounts of Product A and Product B to produce, and the corresponding allocations of Materials X and Y.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and the amount of each material used\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # amount of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # amount of Product B produced\nMatX_A = model.addVar(vtype=\"INTEGER\", name=\"MatX_A\", lb=0) # amount of Material X used for Product A\nMatX_B = model.addVar(vtype=\"INTEGER\", name=\"MatX_B\", lb=0) # amount of Material X used for Product B\nMatY_A = model.addVar(vtype=\"INTEGER\", name=\"MatY_A\", lb=0) # amount of Material Y used for Product A\nMatY_B = model.addVar(vtype=\"INTEGER\", name=\"MatY_B\", lb=0) # amount of Material Y used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n## Production_Cost = 30*Prod_A + 40*Prod_B\nMaterial_Cost = 10*MatX_A + 10*MatX_B + 15*MatY_A + 15*MatY_B\nProduction_Cost = 30*Prod_A + 40*Prod_B\nmodel.addCons(obj == Material_Cost + Production_Cost)\n\n# Add constraints\n## The total amount of Material X available is 200 units.\nmodel.addCons(MatX_A + MatX_B <= 200)\n## The total amount of Material Y available is 300 units.\nmodel.addCons(MatY_A + MatY_B <= 300)\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\nmodel.addCons(MatX_A == 2*Prod_A)\nmodel.addCons(MatY_A == 3*Prod_A)\n## Each unit of Product B requires 4 units of Material X and 2 units of Material Y.\nmodel.addCons(MatX_B == 4*Prod_B)\nmodel.addCons(MatY_B == 2*Prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(Prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(Prod_B))\n    print(\"Amount of Material X used for Product A: \", model.getVal(MatX_A))\n    print(\"Amount of Material X used for Product B: \", model.getVal(MatX_B))\n    print(\"Amount of Material Y used for Product A: \", model.getVal(MatY_A))\n    print(\"Amount of Material Y used for Product B: \", model.getVal(MatY_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs.\n// {\"amount of Product A produced\": \"Prod_A\", \"range\": \"Prod_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"Prod_B\", \"range\": \"Prod_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product A\": \"MatX_A\", \"range\": \"MatX_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material X used for Product B\": \"MatX_B\", \"range\": \"MatX_B >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product A\": \"MatY_A\", \"range\": \"MatY_A >= 0\", \"type\": \"integer\"}\n// {\"amount of Material Y used for Product B\": \"MatY_B\", \"range\": \"MatY_B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The manufacturer aims to minimize the total production and material costs.\n// Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n// Production_Cost = 30*Prod_A + 40*Prod_B\n// Objective Function: Minimize: Material_Cost + Production_Cost\n\n## Generate Constraint-1:\nThe total amount of Material X available is 200 units.\n// MatX_A + MatX_B <= 200\n\n## Generate Constraint-2:\nThe total amount of Material Y available is 300 units.\n// MatY_A + MatY_B <= 300\n\n## Generate Constraint-3:\nEach unit of Product A requires 2 units of Material X and 3 units of Material Y.\n// MatX_A == 2*Prod_A\n// MatY_A == 3*Prod_A\n\n## Generate Constraint-4:\nEach unit of Product B requires 4 units of Material X and 2 units of Material Y.\n// MatX_B == 4*Prod_B\n// MatY_B == 2*Prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of raw materials: Material X and Material Y. The manufacturer needs to decide how much of each product to produce and how to allocate the raw materials to meet production demands while minimizing costs. The cost of Material X is $10 per unit, and the cost of Material Y is $15 per unit. The production cost for Product A is $30 per unit, and for Product B is $40 per unit. The manufacturer aims to minimize the total production and material costs.\nThe total amount of Material X available is 200 units. The total amount of Material Y available is 300 units. Each unit of Product A requires 2 units of Material X and 3 units of Material Y. Each unit of Product B requires 4 units of Material X and 2 units of Material Y.\nPlease help the manufacturer to determine the optimal production quantities for Product A and Product B, and the allocation of Materials X and Y to minimize the total production and material costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each product produced and the amount of each material used\nProd_A = model.addVar(vtype=\"INTEGER\", name=\"Prod_A\", lb=0) # amount of Product A produced\nProd_B = model.addVar(vtype=\"INTEGER\", name=\"Prod_B\", lb=0) # amount of Product B produced\nMatX_A = model.addVar(vtype=\"INTEGER\", name=\"MatX_A\", lb=0) # amount of Material X used for Product A\nMatX_B = model.addVar(vtype=\"INTEGER\", name=\"MatX_B\", lb=0) # amount of Material X used for Product B\nMatY_A = model.addVar(vtype=\"INTEGER\", name=\"MatY_A\", lb=0) # amount of Material Y used for Product A\nMatY_B = model.addVar(vtype=\"INTEGER\", name=\"MatY_B\", lb=0) # amount of Material Y used for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Material_Cost = 10*(MatX_A + MatX_B) + 15*(MatY_A + MatY_B)\n## Production_Cost = 30*Prod_A + 40*Prod_B\nMaterial_Cost = 10*MatX_A + 10*MatX_B + 15*MatY_A + 15*MatY_B\nProduction_Cost = 30*Prod_A + 40*Prod_B\nmodel.addCons(obj == Material_Cost + Production_Cost)\n\n# Add constraints\n## The total amount of Material X available is 200 units.\nmodel.addCons(MatX_A + MatX_B <= 200)\n## The total amount of Material Y available is 300 units.\nmodel.addCons(MatY_A + MatY_B <= 300)\n## Each unit of Product A requires 2 units of Material X and 3 units of Material Y.\nmodel.addCons(MatX_A == 2*Prod_A)\nmodel.addCons(MatY_A == 3*Prod_A)\n## Each unit of Product B requires 4 units of Material X and 2 units of Material Y.\nmodel.addCons(MatX_B == 4*Prod_B)\nmodel.addCons(MatY_B == 2*Prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(Prod_A))\n    print(\"Amount of Product B produced: \", model.getVal(Prod_B))\n    print(\"Amount of Material X used for Product A: \", model.getVal(MatX_A))\n    print(\"Amount of Material X used for Product B: \", model.getVal(MatX_B))\n    print(\"Amount of Material Y used for Product A: \", model.getVal(MatY_A))\n    print(\"Amount of Material Y used for Product B: \", model.getVal(MatY_B))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120\n\n## Generate Constraint-4:\nThe total time available for Quality Check is 80 hours per week.\n// QC_A + QC_B <= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time. The time requirements for each stage and product are given in the following Table.\n\n| Product | Assembly Time | Quality Check Time | Packaging Time |\n|---------|---------------|--------------------|----------------|\n| A       | 2 hours       | 1 hour             | 1 hour         |\n| B       | 3 hours       | 2 hours            | 1 hour         |\n\nThe company has a total of 120 hours available for Assembly per week and 80 hours for Quality Check per week. Please help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product and time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n## The total time available for Quality Check is 80 hours per week.\nmodel.addCons(QC_A + QC_B <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120\n\n## Generate Constraint-4:\nThe total time available for Quality Check is 80 hours per week.\n// QC_A + QC_B <= 80",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time. Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging. Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging. The total time available for Assembly is 120 hours per week, and the total time available for Quality Check is 80 hours per week. Please help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product and time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n## The total time available for Quality Check is 80 hours per week.\nmodel.addCons(QC_A + QC_B <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total labor hours used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"total raw materials used\": \"Materials\", \"range\": \"Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\n// 5*A + 3*B + 2*C <= 150\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-4:\nThe market demand for product C is at least 5 units per day.\n// C >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table shows the labor and raw material requirements for each product.\n\n| Product | Labor per Unit | Raw Materials per Unit |\n|---------|----------------|-------------------------|\n| A       | 2 hours        | 5 units                 |\n| B       | 3 hours        | 3 units                 |\n| C       | 4 hours        | 2 units                 |\n\nThe total labor available per day is 100 hours, and the total raw materials available per day is 150 units. The market demand for product A is at least 10 units per day, and the market demand for product C is at least 5 units per day. \n\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\nmodel.addCons(5*A + 3*B + 2*C <= 150)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product C is at least 5 units per day.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"total labor hours used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"total raw materials used\": \"Materials\", \"range\": \"Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\n// 5*A + 3*B + 2*C <= 150\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-4:\nThe market demand for product C is at least 5 units per day.\n// C >= 5",
        "question": "A manufacturer produces three types of products: A, B, and C. The production of each product requires different amounts of raw materials and labor. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of raw materials and labor. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor and 5 units of raw materials, each unit of product B requires 3 hours of labor and 3 units of raw materials, and each unit of product C requires 4 hours of labor and 2 units of raw materials. The total labor available per day is 100 hours, and the total raw materials available per day is 150 units. The market demand for product A is at least 10 units per day, and the market demand for product C is at least 5 units per day. Please help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, each unit of product B requires 3 hours, and each unit of product C requires 4 hours. The total labor available per day is 100 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## Each unit of product A requires 5 units of raw materials, each unit of product B requires 3 units, and each unit of product C requires 2 units. The total raw materials available per day is 150 units.\nmodel.addCons(5*A + 3*B + 2*C <= 150)\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The market demand for product C is at least 5 units per day.\nmodel.addCons(C >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced: \", model.getVal(A))\n    print(\"Number of units of product B produced: \", model.getVal(B))\n    print(\"Number of units of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// The total number of units sent to each market must equal the production of each product:\n// A_M1 + A_M2 + A_M3 == A\n// B_M1 + B_M2 + B_M3 == B\n\n## Define Objective Function:\nThe profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\n// Profit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\n// Profit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\n// Objective Function: Maximize: Profit_A + Profit_B\n\n## Generate Constraint-1:\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week.\n// A <= 100\n// B <= 120\n\n## Generate Constraint-2:\nMarket 1 requires at least 40 units of Product A and 50 units of Product B per week.\n// A_M1 >= 40\n// B_M1 >= 50\n\n## Generate Constraint-3:\nMarket 2 requires at least 30 units of Product A and 40 units of Product B per week.\n// A_M2 >= 30\n// B_M2 >= 40\n\n## Generate Constraint-4:\nMarket 3 requires at least 20 units of Product A and 30 units of Product B per week.\n// A_M3 >= 20\n// B_M3 >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3. The profit per unit for each product in each market is given in the following Table.\n\n| Product | Market 1 Profit | Market 2 Profit | Market 3 Profit |\n|---------|-----------------|-----------------|-----------------|\n| A       | 30$             | 25$             | 20$             |\n| B       | 40$             | 35$             | 30$             |\n\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week. Market 1 requires at least 40 units of Product A and 50 units of Product B per week. Market 2 requires at least 30 units of Product A and 40 units of Product B per week. Market 3 requires at least 20 units of Product A and 30 units of Product B per week. The total number of units sent to each market must equal the production of each product.\n\nPlease help the company to maximize its total profit by determining the optimal number of units of Product A and Product B to produce and allocate to each market.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## Number of units of Product A sent to each market\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A sent to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A sent to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A sent to Market 3\n## Number of units of Product B sent to each market\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B sent to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B sent to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B sent to Market 3\n\n# Constraints to ensure the total number of units sent to each market equals the production of each product\nmodel.addCons(A_M1 + A_M2 + A_M3 == A)\nmodel.addCons(B_M1 + B_M2 + B_M3 == B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from selling Product A and Product B in each market\nProfit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\nProfit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\n## Market requirements\nmodel.addCons(A_M1 >= 40)\nmodel.addCons(B_M1 >= 50)\nmodel.addCons(A_M2 >= 30)\nmodel.addCons(B_M2 >= 40)\nmodel.addCons(A_M3 >= 20)\nmodel.addCons(B_M3 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product A sent to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A sent to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A sent to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B sent to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B sent to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B sent to Market 3: \", model.getVal(B_M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sent to Market 3\": \"A_M3\", \"range\": \"A_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 1\": \"B_M1\", \"range\": \"B_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 2\": \"B_M2\", \"range\": \"B_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sent to Market 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// The total number of units sent to each market must equal the production of each product:\n// A_M1 + A_M2 + A_M3 == A\n// B_M1 + B_M2 + B_M3 == B\n\n## Define Objective Function:\nThe profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\n// Profit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\n// Profit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\n// Objective Function: Maximize: Profit_A + Profit_B\n\n## Generate Constraint-1:\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week.\n// A <= 100\n// B <= 120\n\n## Generate Constraint-2:\nMarket 1 requires at least 40 units of Product A and 50 units of Product B per week.\n// A_M1 >= 40\n// B_M1 >= 50\n\n## Generate Constraint-3:\nMarket 2 requires at least 30 units of Product A and 40 units of Product B per week.\n// A_M2 >= 30\n// B_M2 >= 40\n\n## Generate Constraint-4:\nMarket 3 requires at least 20 units of Product A and 30 units of Product B per week.\n// A_M3 >= 20\n// B_M3 >= 30",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how to allocate these products to three different markets: Market 1, Market 2, and Market 3.\nThe profit from selling Product A in Market 1, 2, and 3 is $30, $25, and $20 per unit, respectively. The profit from selling Product B in Market 1, 2, and 3 is $40, $35, and $30 per unit, respectively. The company aims to maximize its total profit.\nThe production capacity for Product A is 100 units per week, and for Product B is 120 units per week. Market 1 requires at least 40 units of Product A and 50 units of Product B per week. Market 2 requires at least 30 units of Product A and 40 units of Product B per week. Market 3 requires at least 20 units of Product A and 30 units of Product B per week.\nPlease help the company to maximize its total profit while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## Number of units of Product A sent to each market\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A sent to Market 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A sent to Market 2\nA_M3 = model.addVar(vtype=\"INTEGER\", name=\"A_M3\", lb=0) # number of units of Product A sent to Market 3\n## Number of units of Product B sent to each market\nB_M1 = model.addVar(vtype=\"INTEGER\", name=\"B_M1\", lb=0) # number of units of Product B sent to Market 1\nB_M2 = model.addVar(vtype=\"INTEGER\", name=\"B_M2\", lb=0) # number of units of Product B sent to Market 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B sent to Market 3\n\n# Constraints to ensure the total number of units sent to each market equals the production of each product\nmodel.addCons(A_M1 + A_M2 + A_M3 == A)\nmodel.addCons(B_M1 + B_M2 + B_M3 == B)\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from selling Product A and Product B in each market\nProfit_A = 30*A_M1 + 25*A_M2 + 20*A_M3\nProfit_B = 40*B_M1 + 35*B_M2 + 30*B_M3\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\n## Production capacity constraints\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 120)\n## Market requirements\nmodel.addCons(A_M1 >= 40)\nmodel.addCons(B_M1 >= 50)\nmodel.addCons(A_M2 >= 30)\nmodel.addCons(B_M2 >= 40)\nmodel.addCons(A_M3 >= 20)\nmodel.addCons(B_M3 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product A sent to Market 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A sent to Market 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product A sent to Market 3: \", model.getVal(A_M3))\n    print(\"Number of units of Product B sent to Market 1: \", model.getVal(B_M1))\n    print(\"Number of units of Product B sent to Market 2: \", model.getVal(B_M2))\n    print(\"Number of units of Product B sent to Market 3: \", model.getVal(B_M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"availability of Resource X\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"availability of Resource Y\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\n// 2*A + 3*B <= 300\n\n## Generate Constraint-2:\nThe production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\n// 4*A + 2*B <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a minimum production requirement for Product A, which is 10 units.\n// A >= 10\n\n## Generate Constraint-4:\nThe manufacturer has a maximum production capacity for Product B, which is 50 units.\n// B <= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources. The profit per unit and resource requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Resource X Required | Resource Y Required |\n|---------|-----------------|---------------------|---------------------|\n| A       | $50             | 2 units             | 4 units             |\n| B       | $70             | 3 units             | 2 units             |\n\nThe total amount of Resource X available is 300 units, and the total amount of Resource Y available is 200 units. The manufacturer has a minimum production requirement for Product A, which is 10 units, and a maximum production capacity for Product B, which is 50 units. \n\nPlease help the manufacturer to maximize the total profit from the production of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\nmodel.addCons(2*A + 3*B <= 300)\n## The production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\nmodel.addCons(4*A + 2*B <= 200)\n## The manufacturer has a minimum production requirement for Product A, which is 10 units.\nmodel.addCons(A >= 10)\n## The manufacturer has a maximum production capacity for Product B, which is 50 units.\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. The manufacturer needs to decide how many units of each product to produce to maximize profit while considering the availability of resources.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"availability of Resource X\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"availability of Resource Y\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nThe production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\n// 2*A + 3*B <= 300\n\n## Generate Constraint-2:\nThe production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\n// 4*A + 2*B <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a minimum production requirement for Product A, which is 10 units.\n// A >= 10\n\n## Generate Constraint-4:\nThe manufacturer has a maximum production capacity for Product B, which is 50 units.\n// B <= 50",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production of each product requires two types of resources: Resource X and Resource Y. Each unit of Product A yields a profit of $50, and each unit of Product B yields a profit of $70. The manufacturer aims to maximize the total profit from the production of both products.\nThe production of each unit of Product A requires 2 units of Resource X and 4 units of Resource Y, while each unit of Product B requires 3 units of Resource X and 2 units of Resource Y. The total amount of Resource X available is 300 units, and the total amount of Resource Y available is 200 units.\nThe manufacturer has a minimum production requirement for Product A, which is 10 units, and a maximum production capacity for Product B, which is 50 units.\nPlease help the manufacturer decide how many units of each product to produce to maximize profit while considering the availability of resources.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## The production of each unit of Product A requires 2 units of Resource X, and each unit of Product B requires 3 units of Resource X. The total amount of Resource X available is 300 units.\nmodel.addCons(2*A + 3*B <= 300)\n## The production of each unit of Product A requires 4 units of Resource Y, and each unit of Product B requires 2 units of Resource Y. The total amount of Resource Y available is 200 units.\nmodel.addCons(4*A + 2*B <= 200)\n## The manufacturer has a minimum production requirement for Product A, which is 10 units.\nmodel.addCons(A >= 10)\n## The manufacturer has a maximum production capacity for Product B, which is 50 units.\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80\n\n## Generate Constraint-4:\nThe market demand for Product B is 90 units per day.\n// B_P1 + B_P2 >= 90",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost. The cost of producing one unit of each product in each plant is given in the following Table.\n\n| Product | Plant 1 Cost | Plant 2 Cost |\n|---------|--------------|--------------|\n| A       | 10$          | 12$          |\n| B       | 8$           | 9$           |\n\nThe total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day, and the market demand for Product B is 90 units per day. \n\nPlease help the manufacturer to minimize the total production cost while meeting the market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n## The market demand for Product B is 90 units per day.\nmodel.addCons(B_P1 + B_P2 >= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\n// {\"number of units of Product A produced in Plant 1\": \"A_P1\", \"range\": \"A_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced in Plant 2\": \"A_P2\", \"range\": \"A_P2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 1\": \"B_P1\", \"range\": \"B_P1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced in Plant 2\": \"B_P2\", \"range\": \"B_P2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The objective is to minimize the total production cost.\n// Objective Function: Minimize: 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2\n\n## Generate Constraint-1:\nThe total production capacity of Plant 1 is 100 units per day.\n// A_P1 + B_P1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of Plant 2 is 120 units per day.\n// A_P2 + B_P2 <= 120\n\n## Generate Constraint-3:\nThe market demand for Product A is 80 units per day.\n// A_P1 + A_P2 >= 80\n\n## Generate Constraint-4:\nThe market demand for Product B is 90 units per day.\n// B_P1 + B_P2 >= 90",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production is carried out in two different plants: Plant 1 and Plant 2. The manufacturer needs to decide how many units of each product to produce in each plant to meet the market demand while minimizing the production cost.\nThe cost of producing one unit of Product A in Plant 1 is $10, and in Plant 2 is $12. The cost of producing one unit of Product B in Plant 1 is $8, and in Plant 2 is $9. The total production capacity of Plant 1 is 100 units per day, and the total production capacity of Plant 2 is 120 units per day. The market demand for Product A is 80 units per day, and the market demand for Product B is 90 units per day.\nPlease help the manufacturer to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced in each plant\nA_P1 = model.addVar(vtype=\"INTEGER\", name=\"A_P1\", lb=0) # number of units of Product A produced in Plant 1\nA_P2 = model.addVar(vtype=\"INTEGER\", name=\"A_P2\", lb=0) # number of units of Product A produced in Plant 2\nB_P1 = model.addVar(vtype=\"INTEGER\", name=\"B_P1\", lb=0) # number of units of Product B produced in Plant 1\nB_P2 = model.addVar(vtype=\"INTEGER\", name=\"B_P2\", lb=0) # number of units of Product B produced in Plant 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_P1 + 12*A_P2 + 8*B_P1 + 9*B_P2)\n\n# Add constraints\n## The total production capacity of Plant 1 is 100 units per day.\nmodel.addCons(A_P1 + B_P1 <= 100)\n## The total production capacity of Plant 2 is 120 units per day.\nmodel.addCons(A_P2 + B_P2 <= 120)\n## The market demand for Product A is 80 units per day.\nmodel.addCons(A_P1 + A_P2 >= 80)\n## The market demand for Product B is 90 units per day.\nmodel.addCons(B_P1 + B_P2 >= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced in Plant 1: \", model.getVal(A_P1))\n    print(\"Number of units of Product A produced in Plant 2: \", model.getVal(A_P2))\n    print(\"Number of units of Product B produced in Plant 1: \", model.getVal(B_P1))\n    print(\"Number of units of Product B produced in Plant 2: \", model.getVal(B_P2))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer.\n// {\"number of units of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 1\": \"sell_A1\", \"range\": \"sell_A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 2\": \"sell_A2\", \"range\": \"sell_A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 1\": \"sell_B1\", \"range\": \"sell_B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 2\": \"sell_B2\", \"range\": \"sell_B2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Revenue_A = 20*sell_A1 + 25*sell_A2\n// Revenue_B = 30*sell_B1 + 35*sell_B2\n// Objective Function: Maximize: Revenue_A + Revenue_B - Production_Cost\n\n## Generate Constraint-1:\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nRetailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\n// sell_A1 >= 50\n// sell_B1 >= 60\n\n## Generate Constraint-3:\nRetailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\n// sell_A2 >= 40\n// sell_B2 >= 50\n\n## Generate Constraint-4:\nThe number of units sold to each retailer must not exceed the production of each product.\n// sell_A1 + sell_A2 <= prod_A\n// sell_B1 + sell_B2 <= prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer. The details are given in the following Table.\n\n| Product | Production Cost | Selling Price to Retailer 1 | Selling Price to Retailer 2 |\n|---------|-----------------|------------------------------|-----------------------------|\n| A       | $10             | $20                          | $25                         |\n| B       | $15             | $30                          | $35                         |\n\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week. Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B. Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B. The number of units sold to each retailer must not exceed the production of each product.\n\nPlease help the company to maximize the profit from selling both products to both retailers, which is defined as the sum of the revenues from selling to both retailers minus the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold to each retailer\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # number of units of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # number of units of Product B produced\nsell_A1 = model.addVar(vtype=\"INTEGER\", name=\"sell_A1\", lb=0) # number of units of Product A sold to Retailer 1\nsell_A2 = model.addVar(vtype=\"INTEGER\", name=\"sell_A2\", lb=0) # number of units of Product A sold to Retailer 2\nsell_B1 = model.addVar(vtype=\"INTEGER\", name=\"sell_B1\", lb=0) # number of units of Product B sold to Retailer 1\nsell_B2 = model.addVar(vtype=\"INTEGER\", name=\"sell_B2\", lb=0) # number of units of Product B sold to Retailer 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Revenue_A = 20*sell_A1 + 25*sell_A2\n## Revenue_B = 30*sell_B1 + 35*sell_B2\nmodel.addCons(obj == (20*sell_A1 + 25*sell_A2 + 30*sell_B1 + 35*sell_B2) - (10*prod_A + 15*prod_B))\n\n# Add constraints\n## The total number of units produced of both products cannot exceed the production capacity of 200 units per week.\nmodel.addCons(prod_A + prod_B <= 200)\n## Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\nmodel.addCons(sell_A1 >= 50)\nmodel.addCons(sell_B1 >= 60)\n## Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\nmodel.addCons(sell_A2 >= 40)\nmodel.addCons(sell_B2 >= 50)\n## The number of units sold to each retailer must not exceed the production of each product.\nmodel.addCons(sell_A1 + sell_A2 <= prod_A)\nmodel.addCons(sell_B1 + sell_B2 <= prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(prod_A))\n    print(\"Number of units of Product B produced: \", model.getVal(prod_B))\n    print(\"Number of units of Product A sold to Retailer 1: \", model.getVal(sell_A1))\n    print(\"Number of units of Product A sold to Retailer 2: \", model.getVal(sell_A2))\n    print(\"Number of units of Product B sold to Retailer 1: \", model.getVal(sell_B1))\n    print(\"Number of units of Product B sold to Retailer 2: \", model.getVal(sell_B2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer.\n// {\"number of units of Product A produced\": \"prod_A\", \"range\": \"prod_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"prod_B\", \"range\": \"prod_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 1\": \"sell_A1\", \"range\": \"sell_A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A sold to Retailer 2\": \"sell_A2\", \"range\": \"sell_A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 1\": \"sell_B1\", \"range\": \"sell_B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B sold to Retailer 2\": \"sell_B2\", \"range\": \"sell_B2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers.\n// Production_Cost = 10*prod_A + 15*prod_B\n// Revenue_A = 20*sell_A1 + 25*sell_A2\n// Revenue_B = 30*sell_B1 + 35*sell_B2\n// Objective Function: Maximize: Revenue_A + Revenue_B - Production_Cost\n\n## Generate Constraint-1:\nThe total number of units produced of both products cannot exceed the production capacity of 200 units per week.\n// prod_A + prod_B <= 200\n\n## Generate Constraint-2:\nRetailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\n// sell_A1 >= 50\n// sell_B1 >= 60\n\n## Generate Constraint-3:\nRetailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\n// sell_A2 >= 40\n// sell_B2 >= 50\n\n## Generate Constraint-4:\nThe number of units sold to each retailer must not exceed the production of each product.\n// sell_A1 + sell_A2 <= prod_A\n// sell_B1 + sell_B2 <= prod_B",
        "question": "A manufacturer produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce and how many units to sell to two different retailers: Retailer 1 and Retailer 2. The production costs and selling prices vary for each product and retailer. The production cost for Product A is $10 per unit, and for Product B is $15 per unit. The selling price for Product A to Retailer 1 is $20 per unit, and to Retailer 2 is $25 per unit. The selling price for Product B to Retailer 1 is $30 per unit, and to Retailer 2 is $35 per unit. The objective is to maximize the profit from selling both products to both retailers. The total number of units produced of both products cannot exceed the production capacity of 200 units per week. Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B. Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B. The number of units sold to each retailer must not exceed the production of each product. Please help the company to maximize the profit from selling both products to both retailers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold to each retailer\nprod_A = model.addVar(vtype=\"INTEGER\", name=\"prod_A\", lb=0) # number of units of Product A produced\nprod_B = model.addVar(vtype=\"INTEGER\", name=\"prod_B\", lb=0) # number of units of Product B produced\nsell_A1 = model.addVar(vtype=\"INTEGER\", name=\"sell_A1\", lb=0) # number of units of Product A sold to Retailer 1\nsell_A2 = model.addVar(vtype=\"INTEGER\", name=\"sell_A2\", lb=0) # number of units of Product A sold to Retailer 2\nsell_B1 = model.addVar(vtype=\"INTEGER\", name=\"sell_B1\", lb=0) # number of units of Product B sold to Retailer 1\nsell_B2 = model.addVar(vtype=\"INTEGER\", name=\"sell_B2\", lb=0) # number of units of Product B sold to Retailer 2\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production_Cost = 10*prod_A + 15*prod_B\n## Revenue_A = 20*sell_A1 + 25*sell_A2\n## Revenue_B = 30*sell_B1 + 35*sell_B2\nmodel.addCons(obj == (20*sell_A1 + 25*sell_A2 + 30*sell_B1 + 35*sell_B2) - (10*prod_A + 15*prod_B))\n\n# Add constraints\n## The total number of units produced of both products cannot exceed the production capacity of 200 units per week.\nmodel.addCons(prod_A + prod_B <= 200)\n## Retailer 1 has a demand for at least 50 units of Product A and 60 units of Product B.\nmodel.addCons(sell_A1 >= 50)\nmodel.addCons(sell_B1 >= 60)\n## Retailer 2 has a demand for at least 40 units of Product A and 50 units of Product B.\nmodel.addCons(sell_A2 >= 40)\nmodel.addCons(sell_B2 >= 50)\n## The number of units sold to each retailer must not exceed the production of each product.\nmodel.addCons(sell_A1 + sell_A2 <= prod_A)\nmodel.addCons(sell_B1 + sell_B2 <= prod_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(prod_A))\n    print(\"Number of units of Product B produced: \", model.getVal(prod_B))\n    print(\"Number of units of Product A sold to Retailer 1: \", model.getVal(sell_A1))\n    print(\"Number of units of Product A sold to Retailer 2: \", model.getVal(sell_A2))\n    print(\"Number of units of Product B sold to Retailer 1: \", model.getVal(sell_B1))\n    print(\"Number of units of Product B sold to Retailer 2: \", model.getVal(sell_B2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units.\n// Wheat + 1.5*Rye + 2*Sourdough <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\n// Wheat >= 30\n// Rye >= 20\n\n## Generate Constraint-4:\nThe bakery aims to use at least 100 units of storage daily to justify the operational costs.\n// Storage >= 100",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity. The profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The following table shows the requirements for each type of bread:\n\n| Bread Type    | Profit per Bread | Flour Requirement (kg) | Storage Units Required |\n|---------------|------------------|------------------------|------------------------|\n| Wheat         | $2               | 0.5                    | 1                      |\n| Rye           | $3               | 0.4                    | 1.5                    |\n| Sourdough     | $4               | 0.6                    | 2                      |\n\nThe bakery has a limited supply of flour, with a total daily supply of 200 kg. The bakery also has a storage capacity of 150 units. The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand. Additionally, the bakery aims to use at least 100 units of storage daily to justify the operational costs.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of wheat, rye, and sourdough breads to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a storage capacity of 150 units.\nmodel.addCons(Wheat + 1.5*Rye + 2*Sourdough <= 150)\n## The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 20)\n## The bakery aims to use at least 100 units of storage daily to justify the operational costs.\nmodel.addCons(Storage >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of storage units used: \", model.getVal(Storage))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Wheat + 3*Rye + 4*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each wheat bread requires 0.5 kg of flour, each rye bread requires 0.4 kg, and each sourdough bread requires 0.6 kg. The total daily supply of flour is 200 kg.\n// 0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200\n\n## Generate Constraint-2:\nThe bakery has a storage capacity of 150 units. Each wheat bread takes up 1 unit, each rye bread takes up 1.5 units, and each sourdough bread takes up 2 units.\n// Wheat + 1.5*Rye + 2*Sourdough <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\n// Wheat >= 30\n// Rye >= 20\n\n## Generate Constraint-4:\nThe bakery aims to use at least 100 units of storage daily to justify the operational costs.\n// Storage >= 100",
        "question": "A bakery produces three types of bread: wheat, rye, and sourdough. The bakery wants to optimize its daily production to maximize profit while considering the limited availability of ingredients and storage capacity. The profit from selling each wheat bread is $2, each rye bread is $3, and each sourdough bread is $4. The bakery has a limited supply of flour, with each wheat bread requiring 0.5 kg of flour, each rye bread requiring 0.4 kg, and each sourdough bread requiring 0.6 kg, and the total daily supply of flour is 200 kg. The bakery also has a storage capacity of 150 units, with each wheat bread taking up 1 unit, each rye bread taking up 1.5 units, and each sourdough bread taking up 2 units. The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand. Additionally, the bakery aims to use at least 100 units of storage daily to justify the operational costs. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread produced\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye + 4*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*Wheat + 0.4*Rye + 0.6*Sourdough <= 200)\n## The bakery has a storage capacity of 150 units.\nmodel.addCons(Wheat + 1.5*Rye + 2*Sourdough <= 150)\n## The bakery must produce at least 30 wheat breads and 20 rye breads daily to meet minimum customer demand.\nmodel.addCons(Wheat >= 30)\nmodel.addCons(Rye >= 20)\n## The bakery aims to use at least 100 units of storage daily to justify the operational costs.\nmodel.addCons(Storage >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Number of storage units used: \", model.getVal(Storage))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily.\n// {\"number of wheat bread batches\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread batches\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling bread. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively.\n// Objective Function: Maximize: 5w + 6r + 7s + 8g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 batches per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 batches of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\n// Constraint-3: s <= 50\n\n## Generate Constraint-4:\nTo maintain variety, the bakery must produce at least one batch of each type of bread daily.\n// Constraint-4: w >= 1, r >= 1, s >= 1, g >= 1",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively. The bakery has a limited oven capacity of 200 batches per day. The bakery has a contract to supply at least 30 batches of rye bread daily. Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily. To maintain variety, the bakery must produce at least one batch of each type of bread daily.\n\nPlease help the bakery to maximize its daily profit from selling bread.\n\n| Type of Bread | Profit per Batch |\n|---------------|------------------|\n| Wheat         | $5               |\n| Rye           | $6               |\n| Sourdough     | $7               |\n| Whole Grain   | $8               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of batches of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread batches\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread batches\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread batches\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread batches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*w + 6*r + 7*s + 8*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 batches per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 batches of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\nmodel.addCons(s <= 50)\n## To maintain variety, the bakery must produce at least one batch of each type of bread daily.\nmodel.addCons(w >= 1)\nmodel.addCons(r >= 1)\nmodel.addCons(s >= 1)\nmodel.addCons(g >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread batches: \", model.getVal(w))\n    print(\"Number of rye bread batches: \", model.getVal(r))\n    print(\"Number of sourdough bread batches: \", model.getVal(s))\n    print(\"Number of whole grain bread batches: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily.\n// {\"number of wheat bread batches\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of whole grain bread batches\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling bread. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively.\n// Objective Function: Maximize: 5w + 6r + 7s + 8g\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 batches per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 batches of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\n// Constraint-3: s <= 50\n\n## Generate Constraint-4:\nTo maintain variety, the bakery must produce at least one batch of each type of bread daily.\n// Constraint-4: w >= 1, r >= 1, s >= 1, g >= 1",
        "question": "A bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery needs to decide how many batches of each type of bread to produce daily. The profit per batch of wheat, rye, sourdough, and whole grain bread is $5, $6, $7, and $8, respectively. The bakery aims to maximize its daily profit. The bakery has a limited oven capacity of 200 batches per day. The bakery has a contract to supply at least 30 batches of rye bread daily. Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily. To maintain variety, the bakery must produce at least one batch of each type of bread daily. Please help the bakery determine the optimal number of batches of each type of bread to produce daily to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of batches of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread batches\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread batches\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread batches\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # number of whole grain bread batches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*w + 6*r + 7*s + 8*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 batches per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 batches of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can produce no more than 50 batches of sourdough bread daily.\nmodel.addCons(s <= 50)\n## To maintain variety, the bakery must produce at least one batch of each type of bread daily.\nmodel.addCons(w >= 1)\nmodel.addCons(r >= 1)\nmodel.addCons(s >= 1)\nmodel.addCons(g >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread batches: \", model.getVal(w))\n    print(\"Number of rye bread batches: \", model.getVal(r))\n    print(\"Number of sourdough bread batches: \", model.getVal(s))\n    print(\"Number of whole grain bread batches: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a market demand constraint for Product C. The maximum number of units of Product C that can be sold is 10 units.\n// Constraint: c <= 10\n\n## Generate Constraint-4:\nThe company aims to produce at least 5 units of Product A to meet a contractual obligation.\n// Constraint: a >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The details of each product's production requirements and profit are given in the following Table.\n\n| Product | Profit per Unit | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------|------------------------|--------------------------|\n| A       | 50$             | 3 units                | 2 hours                  |\n| B       | 30$             | 2 units                | 1 hour                   |\n| C       | 40$             | 4 units                | 3 hours                  |\n| D       | 20$             | 1 unit                 | 1 hour                   |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production capacity is also limited, with a total of 50 hours available per day. The company has a market demand constraint for Product C, with a maximum of 10 units that can be sold. Additionally, the company aims to produce at least 5 units of Product A to meet a contractual obligation.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a market demand constraint for Product C.\nmodel.addCons(c <= 10)\n## The company aims to produce at least 5 units of Product A to meet a contractual obligation.\nmodel.addCons(a >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a market demand constraint for Product C. The maximum number of units of Product C that can be sold is 10 units.\n// Constraint: c <= 10\n\n## Generate Constraint-4:\nThe company aims to produce at least 5 units of Product A to meet a contractual obligation.\n// Constraint: a >= 5",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day are 50 hours. The company has a market demand constraint for Product C, where the maximum number of units of Product C that can be sold is 10 units. Additionally, the company aims to produce at least 5 units of Product A to meet a contractual obligation. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a market demand constraint for Product C.\nmodel.addCons(c <= 10)\n## The company aims to produce at least 5 units of Product A to meet a contractual obligation.\nmodel.addCons(a >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D).\n// {\"number of units of Product A\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 40b + 30c + 20d\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 200 units per day.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nThe raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\n// Constraint-2: 2a + 3b + c + 4d <= 500\n\n## Generate Constraint-3:\nDue to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\n// Constraint-3: a >= 2d\n\n## Generate Constraint-4:\nThe company has a policy to produce at least 10 units of each product to maintain brand presence.\n// Constraint-4: a >= 10, b >= 10, c >= 10, d >= 10",
        "question": "A company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D). The company aims to maximize its total profit from selling these products. The profit per unit for each product is given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 40$             |\n| C       | 30$             |\n| D       | 20$             |\n\nThe production capacity of the company is limited to 200 units per day. The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively, and the daily supply of raw material is limited to 500 units. Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D. The company has a policy to produce at least 10 units of each product to maintain brand presence.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 40*b + 30*c + 20*d)\n\n# Add constraints\n## The production capacity of the company is limited to 200 units per day.\nmodel.addCons(a + b + c + d <= 200)\n## The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\nmodel.addCons(2*a + 3*b + c + 4*d <= 500)\n## Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\nmodel.addCons(a >= 2*d)\n## The company has a policy to produce at least 10 units of each product to maintain brand presence.\nmodel.addCons(a >= 10)\nmodel.addCons(b >= 10)\nmodel.addCons(c >= 10)\nmodel.addCons(d >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D).\n// {\"number of units of Product A\": \"a\", \"range\": \"0 <= a <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"0 <= b <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"0 <= c <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"0 <= d <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from selling these products.\n// Objective Function: Maximize: 50a + 40b + 30c + 20d\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 200 units per day.\n// Constraint-1: a + b + c + d <= 200\n\n## Generate Constraint-2:\nThe raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\n// Constraint-2: 2a + 3b + c + 4d <= 500\n\n## Generate Constraint-3:\nDue to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\n// Constraint-3: a >= 2d\n\n## Generate Constraint-4:\nThe company has a policy to produce at least 10 units of each product to maintain brand presence.\n// Constraint-4: a >= 10, b >= 10, c >= 10, d >= 10",
        "question": "A company needs to decide the number of units to produce for four different products (Product A, Product B, Product C, Product D). The company aims to maximize its total profit from selling these products. The production capacity of the company is limited to 200 units per day. The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively, with a daily supply limited to 500 units. Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D. Additionally, the company has a policy to produce at least 10 units of each product to maintain brand presence. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0, ub=100) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0, ub=100) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=100) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 40*b + 30*c + 20*d)\n\n# Add constraints\n## The production capacity of the company is limited to 200 units per day.\nmodel.addCons(a + b + c + d <= 200)\n## The raw material required for producing each unit of Product A, B, C, and D is 2, 3, 1, and 4 units respectively. The daily supply of raw material is limited to 500 units.\nmodel.addCons(2*a + 3*b + c + 4*d <= 500)\n## Due to market demand, the number of units of Product A produced must be at least twice the number of units of Product D.\nmodel.addCons(a >= 2*d)\n## The company has a policy to produce at least 10 units of each product to maintain brand presence.\nmodel.addCons(a >= 10)\nmodel.addCons(b >= 10)\nmodel.addCons(c >= 10)\nmodel.addCons(d >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 786,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 1000\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 800\", \"type\": \"integer\"}\n// {\"number of cookies\": \"co\", \"range\": \"0 <= co <= 1200\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 900\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling pastries.\n// Objective Function: Maximize: 2c + 3m + 1.5co + 2.5d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 2000 grams. Each croissant requires 50 grams, each muffin requires 60 grams, each cookie requires 30 grams, and each donut requires 40 grams.\n// Constraint: 50c + 60m + 30co + 40d <= 2000\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of sugar, which is 1000 grams. Each croissant requires 20 grams, each muffin requires 15 grams, each cookie requires 10 grams, and each donut requires 25 grams.\n// Constraint: 20c + 15m + 10co + 25d <= 1000\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\n// Constraint: c + m + co + d >= 200\n\n## Generate Constraint-4:\nDue to labor constraints, the total number of pastries produced should not exceed 1500.\n// Constraint: c + m + co + d <= 1500",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts. The bakery aims to maximize its daily revenue from selling pastries. The requirements for flour and sugar for each type of pastry are given in the following Table.\n\n| Pastry   | Flour (grams) | Sugar (grams) |\n|----------|---------------|---------------|\n| Croissant| 50            | 20            |\n| Muffin   | 60            | 15            |\n| Cookie   | 30            | 10            |\n| Donut    | 40            | 25            |\n\nThe bakery has a limited daily supply of flour, which is 2000 grams, and a limited daily supply of sugar, which is 1000 grams. The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand. Due to labor constraints, the total number of pastries produced should not exceed 1500. Please help the bakery to maximize its daily revenue from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=1000) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=800) # number of muffins\nco = model.addVar(vtype=\"INTEGER\", name=\"co\", lb=0, ub=1200) # number of cookies\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=900) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*co + 2.5*d)\n\n# Add constraints\n## The bakery has a limited daily supply of flour, which is 2000 grams.\nmodel.addCons(50*c + 60*m + 30*co + 40*d <= 2000)\n## The bakery also has a limited daily supply of sugar, which is 1000 grams.\nmodel.addCons(20*c + 15*m + 10*co + 25*d <= 1000)\n## The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\nmodel.addCons(c + m + co + d >= 200)\n## Due to labor constraints, the total number of pastries produced should not exceed 1500.\nmodel.addCons(c + m + co + d <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of cookies: \", model.getVal(co))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts.\n// {\"number of croissants\": \"c\", \"range\": \"0 <= c <= 1000\", \"type\": \"integer\"}\n// {\"number of muffins\": \"m\", \"range\": \"0 <= m <= 800\", \"type\": \"integer\"}\n// {\"number of cookies\": \"co\", \"range\": \"0 <= co <= 1200\", \"type\": \"integer\"}\n// {\"number of donuts\": \"d\", \"range\": \"0 <= d <= 900\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily revenue from selling pastries.\n// Objective Function: Maximize: 2c + 3m + 1.5co + 2.5d\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 2000 grams. Each croissant requires 50 grams, each muffin requires 60 grams, each cookie requires 30 grams, and each donut requires 40 grams.\n// Constraint: 50c + 60m + 30co + 40d <= 2000\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of sugar, which is 1000 grams. Each croissant requires 20 grams, each muffin requires 15 grams, each cookie requires 10 grams, and each donut requires 25 grams.\n// Constraint: 20c + 15m + 10co + 25d <= 1000\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\n// Constraint: c + m + co + d >= 200\n\n## Generate Constraint-4:\nDue to labor constraints, the total number of pastries produced should not exceed 1500.\n// Constraint: c + m + co + d <= 1500",
        "question": "A bakery needs to decide the number of each type of pastry to produce daily: croissants, muffins, cookies, and donuts. The bakery aims to maximize its daily revenue from selling pastries. The bakery has a limited daily supply of flour, which is 2000 grams, and sugar, which is 1000 grams. Each croissant requires 50 grams of flour and 20 grams of sugar, each muffin requires 60 grams of flour and 15 grams of sugar, each cookie requires 30 grams of flour and 10 grams of sugar, and each donut requires 40 grams of flour and 25 grams of sugar. The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand, and due to labor constraints, the total number of pastries produced should not exceed 1500. Please help the bakery maximize its daily revenue from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0, ub=1000) # number of croissants\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=800) # number of muffins\nco = model.addVar(vtype=\"INTEGER\", name=\"co\", lb=0, ub=1200) # number of cookies\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0, ub=900) # number of donuts\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*c + 3*m + 1.5*co + 2.5*d)\n\n# Add constraints\n## The bakery has a limited daily supply of flour, which is 2000 grams.\nmodel.addCons(50*c + 60*m + 30*co + 40*d <= 2000)\n## The bakery also has a limited daily supply of sugar, which is 1000 grams.\nmodel.addCons(20*c + 15*m + 10*co + 25*d <= 1000)\n## The bakery must ensure that at least 200 pastries are produced daily to meet the minimum demand.\nmodel.addCons(c + m + co + d >= 200)\n## Due to labor constraints, the total number of pastries produced should not exceed 1500.\nmodel.addCons(c + m + co + d <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(c))\n    print(\"Number of muffins: \", model.getVal(m))\n    print(\"Number of cookies: \", model.getVal(co))\n    print(\"Number of donuts: \", model.getVal(d))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced production. The total number of units produced of Product A and Product B should not exceed twice the number of units produced of Product C and Product D.\n// Constraint: a + b <= 2(c + d)",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The details of each product's production requirements and profit are given in the following Table.\n\n| Product | Profit per Unit | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------|-------------------------|\n| A       | 50$             | 3 units               | 2 hours                 |\n| B       | 30$             | 2 units               | 1 hour                  |\n| C       | 40$             | 4 units               | 3 hours                 |\n| D       | 20$             | 1 unit                | 1 hour                  |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production capacity is also limited, with a total of 50 production hours available per day. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure a balanced production, where the total number of units produced of Product A and Product B should not exceed twice the number of units produced of Product C and Product D.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## The company wants to ensure a balanced production.\nmodel.addCons(a + b <= 2*(c + d))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1401,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 1 hour. The total production hours available per day are 50 hours.\n// Constraint: 2a + b + 3c + d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced production. The total number of units produced of Product A and Product B should not exceed twice the number of units produced of Product C and Product D.\n// Constraint: a + b <= 2(c + d)",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 1 hour to produce. The total raw material available is 100 units, and the total production hours available per day are 50 hours. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure a balanced production, where the total number of units produced of Product A and Product B should not exceed twice the number of units produced of Product C and Product D. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + d <= 50)\n## The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## The company wants to ensure a balanced production.\nmodel.addCons(a + b <= 2*(c + d))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3w + 2r + 4s + 5g (where each coefficient represents the profit per loaf of bread)\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\n// Constraint-3: s <= 50\n\n## Generate Constraint-4:\nThe bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads.\n// Constraint-4: w >= 0.5 * (r + g)",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit from selling these four types of bread, where the profit per loaf is $3 for wheat, $2 for rye, $4 for sourdough, and $5 for whole grain. The bakery has an oven capacity of 200 loaves per day. It also has a contract to supply at least 30 loaves of rye bread daily and can only produce up to 50 loaves of sourdough bread daily. Additionally, the bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $3              |\n| Rye           | $2              |\n| Sourdough     | $4              |\n| Whole Grain   | $5              |\n\nPlease help the bakery determine the optimal daily production quantities of each type of bread to maximize its profit while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # quantity of sourdough bread\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 2*r + 4*s + 5*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\nmodel.addCons(s <= 50)\n## The bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads.\nmodel.addCons(w >= 0.5 * (r + g))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of whole grain bread: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain.\n// {\"quantity of wheat bread\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"quantity of whole grain bread\": \"g\", \"range\": \"0 <= g <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling these four types of bread.\n// Objective Function: Maximize: 3w + 2r + 4s + 5g (where each coefficient represents the profit per loaf of bread)\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + g <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 30 loaves of rye bread daily.\n// Constraint-2: r >= 30\n\n## Generate Constraint-3:\nDue to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\n// Constraint-3: s <= 50\n\n## Generate Constraint-4:\nThe bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads.\n// Constraint-4: w >= 0.5 * (r + g)",
        "question": "A bakery needs to decide the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. The bakery aims to maximize its daily profit from selling these four types of bread, with profits per loaf as follows: wheat bread $3, rye bread $2, sourdough bread $4, and whole grain bread $5. The bakery has a limited oven capacity of 200 loaves per day. It also has a contract to supply at least 30 loaves of rye bread daily. Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily. Additionally, the bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # quantity of wheat bread\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # quantity of rye bread\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # quantity of sourdough bread\ng = model.addVar(vtype=\"INTEGER\", name=\"g\", lb=0, ub=100) # quantity of whole grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*w + 2*r + 4*s + 5*g)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + g <= 200)\n## The bakery has a contract to supply at least 30 loaves of rye bread daily.\nmodel.addCons(r >= 30)\n## Due to ingredient availability, the bakery can only produce up to 50 loaves of sourdough bread daily.\nmodel.addCons(s <= 50)\n## The bakery must maintain a balanced variety, ensuring that the production of wheat bread is at least half the total production of rye and whole grain breads.\nmodel.addCons(w >= 0.5 * (r + g))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(w))\n    print(\"Quantity of rye bread: \", model.getVal(r))\n    print(\"Quantity of sourdough bread: \", model.getVal(s))\n    print(\"Quantity of whole grain bread: \", model.getVal(g))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 2 hours. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + 2d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain product line diversity.\n// Constraint-4: a >= 1, b >= 1, c >= 1, d >= 1",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company aims to maximize its total profit from selling all products. The production requirements and constraints are detailed in the following Table.\n\n| Product | Profit per Unit | Raw Material per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------|-------------------------|\n| A       | 50$             | 3 units               | 2 hours                 |\n| B       | 30$             | 2 units               | 1 hour                  |\n| C       | 40$             | 4 units               | 3 hours                 |\n| D       | 20$             | 1 unit                | 2 hours                 |\n\nThe company has a limited amount of raw material, with a total of 100 units available. The production capacity is also limited, with a total of 50 hours available per day. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure that at least one unit of each product is produced to maintain product line diversity.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its total profit, while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + 2*d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that at least one unit of each product is produced.\nmodel.addCons(a >= 1)\nmodel.addCons(b >= 1)\nmodel.addCons(c >= 1)\nmodel.addCons(d >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1328,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products (products A-D). The company must decide how many units of each product to produce.\n// {\"number of units of Product A\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its total profit from selling all products.\n// Objective Function: Maximize: 50a + 30b + 40c + 20d\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 3 units of raw material, Product B requires 2 units, Product C requires 4 units, and Product D requires 1 unit. The total raw material available is 100 units.\n// Constraint-1: 3a + 2b + 4c + d <= 100\n\n## Generate Constraint-2:\nThe production capacity is limited. Each unit of Product A takes 2 hours to produce, Product B takes 1 hour, Product C takes 3 hours, and Product D takes 2 hours. The total production hours available per day is 50 hours.\n// Constraint-2: 2a + b + 3c + 2d <= 50\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for Product C. At least 5 units of Product C must be produced.\n// Constraint-3: c >= 5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain product line diversity.\n// Constraint-4: a >= 1, b >= 1, c >= 1, d >= 1",
        "question": "A company produces four types of products (products A-D) and must decide how many units of each product to produce. The company wants to maximize its total profit from selling all products. Each unit of Product A requires 3 units of raw material and takes 2 hours to produce, Product B requires 2 units of raw material and takes 1 hour to produce, Product C requires 4 units of raw material and takes 3 hours to produce, and Product D requires 1 unit of raw material and takes 2 hours to produce. The total raw material available is 100 units, and the total production hours available per day is 50 hours. The company has a minimum order requirement for Product C, where at least 5 units of Product C must be produced. Additionally, the company wants to ensure that at least one unit of each product is produced to maintain product line diversity. Please help the company determine the optimal number of units to produce for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of units of Product A\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of units of Product B\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of units of Product C\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*a + 30*b + 40*c + 20*d)\n\n# Add constraints\n## Constraint-1: The company has a limited amount of raw material.\nmodel.addCons(3*a + 2*b + 4*c + d <= 100)\n## Constraint-2: The production capacity is limited.\nmodel.addCons(2*a + b + 3*c + 2*d <= 50)\n## Constraint-3: The company has a minimum order requirement for Product C.\nmodel.addCons(c >= 5)\n## Constraint-4: The company wants to ensure that at least one unit of each product is produced.\nmodel.addCons(a >= 1)\nmodel.addCons(b >= 1)\nmodel.addCons(c >= 1)\nmodel.addCons(d >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(a))\n    print(\"Number of units of Product B: \", model.getVal(b))\n    print(\"Number of units of Product C: \", model.getVal(c))\n    print(\"Number of units of Product D: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries (pastry A, B, C, and D). The bakery needs to decide how many of each type of pastry to produce daily.\n// {\"number of pastry A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of pastry B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of pastry C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of pastry D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling the pastries.\n// Objective Function: Maximize: 3a + 5b + 4c + 2d (where 3, 5, 4, and 2 are the profits per unit of pastry A, B, C, and D respectively)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n- Pastry A requires 2 units of ingredient X.\n- Pastry B requires 3 units of ingredient X.\n- Pastry C requires 4 units of ingredient X.\n- Pastry D requires 1 unit of ingredient X.\nThe total daily supply of ingredient X is 20 units.\n// Constraint: 2a + 3b + 4c + d <= 20\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient Y:\n- Pastry A requires 1 unit of ingredient Y.\n- Pastry B requires 2 units of ingredient Y.\n- Pastry C requires 3 units of ingredient Y.\n- Pastry D requires 2 units of ingredient Y.\nThe total daily supply of ingredient Y is 15 units.\n// Constraint: a + 2b + 3c + 2d <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 units of pastry D daily due to a contractual agreement.\n// Constraint: d >= 5\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\n// Constraint: a + b + c + d <= 10",
        "question": "A bakery produces four types of pastries (pastry A, B, C, and D) and needs to decide how many of each type to produce daily. The bakery aims to maximize its daily profit from selling the pastries. The profit per unit for each pastry type is as follows:\n\n| Pastry | Profit per Unit |\n|--------|-----------------|\n| A      | 3$              |\n| B      | 5$              |\n| C      | 4$              |\n| D      | 2$              |\n\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n\n| Pastry | Ingredient X Required | Ingredient Y Required |\n|--------|-----------------------|----------------------|\n| A      | 2 units               | 1 unit               |\n| B      | 3 units               | 2 units              |\n| C      | 4 units               | 3 units              |\n| D      | 1 unit                | 2 units              |\n\nThe total daily supply of ingredient X is 20 units, and the total daily supply of ingredient Y is 15 units. The bakery must produce at least 5 units of pastry D daily due to a contractual agreement. Additionally, the bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\n\nPlease help the bakery to maximize its daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of pastry A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of pastry B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of pastry C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of pastry D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*a + 5*b + 4*c + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient X.\nmodel.addCons(2*a + 3*b + 4*c + d <= 20)\n## The bakery also has a limited daily supply of ingredient Y.\nmodel.addCons(a + 2*b + 3*c + 2*d <= 15)\n## The bakery must produce at least 5 units of pastry D daily.\nmodel.addCons(d >= 5)\n## The bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\nmodel.addCons(a + b + c + d <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of pastry A produced: \", model.getVal(a))\n    print(\"Number of pastry B produced: \", model.getVal(b))\n    print(\"Number of pastry C produced: \", model.getVal(c))\n    print(\"Number of pastry D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of pastries (pastry A, B, C, and D). The bakery needs to decide how many of each type of pastry to produce daily.\n// {\"number of pastry A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of pastry B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of pastry C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of pastry D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from selling the pastries.\n// Objective Function: Maximize: 3a + 5b + 4c + 2d (where 3, 5, 4, and 2 are the profits per unit of pastry A, B, C, and D respectively)\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of ingredients. The ingredient requirements for each pastry type are as follows:\n- Pastry A requires 2 units of ingredient X.\n- Pastry B requires 3 units of ingredient X.\n- Pastry C requires 4 units of ingredient X.\n- Pastry D requires 1 unit of ingredient X.\nThe total daily supply of ingredient X is 20 units.\n// Constraint: 2a + 3b + 4c + d <= 20\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of ingredient Y:\n- Pastry A requires 1 unit of ingredient Y.\n- Pastry B requires 2 units of ingredient Y.\n- Pastry C requires 3 units of ingredient Y.\n- Pastry D requires 2 units of ingredient Y.\nThe total daily supply of ingredient Y is 15 units.\n// Constraint: a + 2b + 3c + 2d <= 15\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 units of pastry D daily due to a contractual agreement.\n// Constraint: d >= 5\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\n// Constraint: a + b + c + d <= 10",
        "question": "A bakery produces four types of pastries (pastry A, B, C, and D) and needs to decide how many of each type to produce daily. The bakery aims to maximize its daily profit from selling the pastries. The profits per unit of pastry A, B, C, and D are $3, $5, $4, and $2 respectively. The bakery has a limited daily supply of ingredients:\n- Pastry A requires 2 units of ingredient X and 1 unit of ingredient Y.\n- Pastry B requires 3 units of ingredient X and 2 units of ingredient Y.\n- Pastry C requires 4 units of ingredient X and 3 units of ingredient Y.\n- Pastry D requires 1 unit of ingredient X and 2 units of ingredient Y.\nThe total daily supply of ingredient X is 20 units, and the total daily supply of ingredient Y is 15 units. The bakery must produce at least 5 units of pastry D daily due to a contractual agreement. Additionally, the bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\n\nPlease help the bakery to maximize its daily profit from selling the pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry produced daily\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of pastry A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of pastry B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of pastry C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of pastry D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*a + 5*b + 4*c + 2*d)\n\n# Add constraints\n## The bakery has a limited daily supply of ingredient X.\nmodel.addCons(2*a + 3*b + 4*c + d <= 20)\n## The bakery also has a limited daily supply of ingredient Y.\nmodel.addCons(a + 2*b + 3*c + 2*d <= 15)\n## The bakery must produce at least 5 units of pastry D daily.\nmodel.addCons(d >= 5)\n## The bakery wants to ensure that the total number of pastries produced daily does not exceed 10.\nmodel.addCons(a + b + c + d <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of pastry A produced: \", model.getVal(a))\n    print(\"Number of pastry B produced: \", model.getVal(b))\n    print(\"Number of pastry C produced: \", model.getVal(c))\n    print(\"Number of pastry D produced: \", model.getVal(d))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability.\n// {\"number of widgets A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of widgets B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of widgets C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of widgets D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. The raw material requirements per widget are 3 units for A, 4 units for B, 5 units for C, and 6 units for D. The total available raw materials are 100 units.\n// Constraint-1: 3a + 4b + 5c + 6d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The time required to produce each widget is 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D. The total available production time is 20 hours.\n// Constraint-2: 2a + 3b + 2.5c + 3.5d <= 20\n\n## Generate Constraint-3:\nThe company has a contractual obligation to produce at least 2 widgets of type C.\n// Constraint-3: c >= 2\n\n## Generate Constraint-4:\nDue to market demand, the production of widget A must not exceed twice the production of widget B.\n// Constraint-4: a <= 2b",
        "question": "A company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability. The company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D. The raw material requirements per widget and the production time for each widget are given in the following Table.\n\n| Widget | Profit per Widget | Raw Material Requirement | Production Time |\n|--------|-------------------|--------------------------|-----------------|\n| A      | 5$                | 3 units                  | 2 hours         |\n| B      | 7$                | 4 units                  | 3 hours         |\n| C      | 6$                | 5 units                  | 2.5 hours       |\n| D      | 8$                | 6 units                  | 3.5 hours       |\n\nThe company has a limited supply of raw materials, with a total of 100 units available. The production line has a limited capacity, with a total available production time of 20 hours. The company has a contractual obligation to produce at least 2 widgets of type C. Due to market demand, the production of widget A must not exceed twice the production of widget B.\n\nPlease help the company determine the optimal number of widgets A, B, C, and D to produce in order to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of widgets A-D produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of widgets A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of widgets B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of widgets C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of widgets D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(3*a + 4*b + 5*c + 6*d <= 100)\n## The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + 2.5*c + 3.5*d <= 20)\n## The company has a contractual obligation to produce at least 2 widgets of type C.\nmodel.addCons(c >= 2)\n## Due to market demand, the production of widget A must not exceed twice the production of widget B.\nmodel.addCons(a <= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of widgets A produced: \", model.getVal(a))\n    print(\"Number of widgets B produced: \", model.getVal(b))\n    print(\"Number of widgets C produced: \", model.getVal(c))\n    print(\"Number of widgets D produced: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1367,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability.\n// {\"number of widgets A produced\": \"a\", \"range\": \"a >= 0\", \"type\": \"integer\"}\n// {\"number of widgets B produced\": \"b\", \"range\": \"b >= 0\", \"type\": \"integer\"}\n// {\"number of widgets C produced\": \"c\", \"range\": \"c >= 0\", \"type\": \"integer\"}\n// {\"number of widgets D produced\": \"d\", \"range\": \"d >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D.\n// Objective Function: Maximize: 5a + 7b + 6c + 8d\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. The raw material requirements per widget are 3 units for A, 4 units for B, 5 units for C, and 6 units for D. The total available raw materials are 100 units.\n// Constraint-1: 3a + 4b + 5c + 6d <= 100\n\n## Generate Constraint-2:\nThe production line has a limited capacity. The time required to produce each widget is 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D. The total available production time is 20 hours.\n// Constraint-2: 2a + 3b + 2.5c + 3.5d <= 20\n\n## Generate Constraint-3:\nThe company has a contractual obligation to produce at least 2 widgets of type C.\n// Constraint-3: c >= 2\n\n## Generate Constraint-4:\nDue to market demand, the production of widget A must not exceed twice the production of widget B.\n// Constraint-4: a <= 2b",
        "question": "A company produces four types of widgets (widgets A-D). The production of each widget type can be adjusted based on demand and resource availability. The company aims to maximize its total profit from the sale of all widget types. The profit per widget is $5 for A, $7 for B, $6 for C, and $8 for D. The company has a limited supply of raw materials, with the raw material requirements per widget being 3 units for A, 4 units for B, 5 units for C, and 6 units for D, and a total of 100 units available. The production line has a limited capacity, with the time required to produce each widget being 2 hours for A, 3 hours for B, 2.5 hours for C, and 3.5 hours for D, and a total of 20 hours available. The company has a contractual obligation to produce at least 2 widgets of type C. Due to market demand, the production of widget A must not exceed twice the production of widget B. Please help the company determine the optimal number of widgets to produce for each type to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of widgets A-D produced\na = model.addVar(vtype=\"INTEGER\", name=\"a\", lb=0) # number of widgets A produced\nb = model.addVar(vtype=\"INTEGER\", name=\"b\", lb=0) # number of widgets B produced\nc = model.addVar(vtype=\"INTEGER\", name=\"c\", lb=0) # number of widgets C produced\nd = model.addVar(vtype=\"INTEGER\", name=\"d\", lb=0) # number of widgets D produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*a + 7*b + 6*c + 8*d)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(3*a + 4*b + 5*c + 6*d <= 100)\n## The production line has a limited capacity.\nmodel.addCons(2*a + 3*b + 2.5*c + 3.5*d <= 20)\n## The company has a contractual obligation to produce at least 2 widgets of type C.\nmodel.addCons(c >= 2)\n## Due to market demand, the production of widget A must not exceed twice the production of widget B.\nmodel.addCons(a <= 2*b)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of widgets A produced: \", model.getVal(a))\n    print(\"Number of widgets B produced: \", model.getVal(b))\n    print(\"Number of widgets C produced: \", model.getVal(c))\n    print(\"Number of widgets D produced: \", model.getVal(d))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 3b1 + 4b2 + 5b3 + 6b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg.\n// Constraint: 0.5b1 + 0.7b2 + 0.8b3 + 1b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 15 kg. Each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg.\n// Constraint: 0.1b1 + 0.2b2 + 0.3b3 + 0.4b4 <= 15\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\n// Constraint: b1 >= 20\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50.\n// Constraint: b2 + b3 <= 50",
        "question": "A bakery produces four types of bread (Bread 1-4) and must decide how many loaves of each type of bread to produce daily. The bakery aims to maximize its daily profit from selling bread. The requirements for flour and yeast, as well as the profit per loaf, are detailed in the following table:\n\n| Bread Type | Profit per Loaf | Flour Required (kg) | Yeast Required (kg) |\n|------------|-----------------|---------------------|---------------------|\n| Bread 1    | 3$              | 0.5                 | 0.1                 |\n| Bread 2    | 4$              | 0.7                 | 0.2                 |\n| Bread 3    | 5$              | 0.8                 | 0.3                 |\n| Bread 4    | 6$              | 1                   | 0.4                 |\n\nThe bakery has a limited daily supply of 100 kg of flour and 15 kg of yeast. Additionally, the bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement. The bakery must also ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 6*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.8*b3 + 1*b4 <= 100)\n## The bakery has a limited daily supply of yeast\nmodel.addCons(0.1*b1 + 0.2*b2 + 0.3*b3 + 0.4*b4 <= 15)\n## The bakery must ensure that at least 20 loaves of Bread 1 are produced daily\nmodel.addCons(b1 >= 20)\n## The bakery must also ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50\nmodel.addCons(b2 + b3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread (bread 1-4). The bakery must decide how many loaves of each type of bread to produce daily.\n// {\"number of loaves of Bread 1\": \"b1\", \"range\": \"b1 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 2\": \"b2\", \"range\": \"b2 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 3\": \"b3\", \"range\": \"b3 >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of Bread 4\": \"b4\", \"range\": \"b4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 3b1 + 4b2 + 5b3 + 6b4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour, which is 100 kg. Each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg.\n// Constraint: 0.5b1 + 0.7b2 + 0.8b3 + 1b4 <= 100\n\n## Generate Constraint-2:\nThe bakery also has a limited daily supply of yeast, which is 15 kg. Each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg.\n// Constraint: 0.1b1 + 0.2b2 + 0.3b3 + 0.4b4 <= 15\n\n## Generate Constraint-3:\nThe bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement.\n// Constraint: b1 >= 20\n\n## Generate Constraint-4:\nThe bakery must also ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50.\n// Constraint: b2 + b3 <= 50",
        "question": "A bakery produces four types of bread (bread 1-4) and must decide how many loaves of each type of bread to produce daily. The bakery wants to maximize its daily profit from selling bread. The bakery has a limited daily supply of flour, which is 100 kg, and each loaf of Bread 1 requires 0.5 kg of flour, Bread 2 requires 0.7 kg, Bread 3 requires 0.8 kg, and Bread 4 requires 1 kg. The bakery also has a limited daily supply of yeast, which is 15 kg, and each loaf of Bread 1 requires 0.1 kg of yeast, Bread 2 requires 0.2 kg, Bread 3 requires 0.3 kg, and Bread 4 requires 0.4 kg. The bakery must ensure that at least 20 loaves of Bread 1 are produced daily to meet a contract requirement. Additionally, the bakery must ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50. Please help the bakery to maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0) # number of loaves of Bread 1\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0) # number of loaves of Bread 2\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0) # number of loaves of Bread 3\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0) # number of loaves of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*b1 + 4*b2 + 5*b3 + 6*b4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour\nmodel.addCons(0.5*b1 + 0.7*b2 + 0.8*b3 + 1*b4 <= 100)\n## The bakery has a limited daily supply of yeast\nmodel.addCons(0.1*b1 + 0.2*b2 + 0.3*b3 + 0.4*b4 <= 15)\n## The bakery must ensure that at least 20 loaves of Bread 1 are produced daily\nmodel.addCons(b1 >= 20)\n## The bakery must also ensure that the total number of loaves of Bread 2 and Bread 3 does not exceed 50\nmodel.addCons(b2 + b3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of Bread 1: \", model.getVal(b1))\n    print(\"Number of loaves of Bread 2: \", model.getVal(b2))\n    print(\"Number of loaves of Bread 3: \", model.getVal(b3))\n    print(\"Number of loaves of Bread 4: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement of 500 units for each type of device.\n// Smartphones >= 500\n// Tablets >= 500\n// Laptops >= 500\n// Smartwatches >= 500",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $400,000 for production costs. The company has a total of 12,000 hours available for assembly. The company has a minimum order requirement of 500 units for each type of device.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $400,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n## The company has a minimum order requirement of 500 units for each type of device.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 500)\nmodel.addCons(Laptops >= 500)\nmodel.addCons(Smartwatches >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement of 500 units for each type of device.\n// Smartphones >= 500\n// Tablets >= 500\n// Laptops >= 500\n// Smartwatches >= 500",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit.\nThe company has a total production capacity of 5000 units. The production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $400,000 for production costs. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 12,000 hours available for assembly. The company has a minimum order requirement of 500 units for each type of device.\nPlease help the company determine the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $400,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 400000)\n## The company has a total of 12,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 12000)\n## The company has a minimum order requirement of 500 units for each type of device.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 500)\nmodel.addCons(Laptops >= 500)\nmodel.addCons(Smartwatches >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence.\n// Smartphones >= 1000\n// Tablets >= 1000\n// Laptops >= 1000\n// Smartwatches >= 1000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit and production costs for each device are given in the following Table.\n\n| Device       | Profit per Unit | Production Cost per Unit | Assembly Time per Unit |\n|--------------|-----------------|--------------------------|------------------------|\n| Smartphones  | $100            | $60                      | 2 hours                |\n| Tablets      | $150            | $80                      | 3 hours                |\n| Laptops      | $200            | $120                     | 4 hours                |\n| Smartwatches | $50             | $30                      | 1 hour                 |\n\nThe company has a total production capacity of 5000 units. The company has a budget of $250,000 for production costs. The company has a total of 10,000 hours available for assembly. The company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000)\n## The company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence.\nmodel.addCons(Smartphones >= 1000)\nmodel.addCons(Tablets >= 1000)\nmodel.addCons(Laptops >= 1000)\nmodel.addCons(Smartwatches >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production cost per unit for smartphones is $60, the production cost per unit for tablets is $80, the production cost per unit for laptops is $120, and the production cost per unit for smartwatches is $30. The company has a budget of $250,000 for production costs.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000\n\n## Generate Constraint-3:\nThe assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence.\n// Smartphones >= 1000\n// Tablets >= 1000\n// Laptops >= 1000\n// Smartwatches >= 1000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company has a total production capacity of 5000 units and a budget of $250,000 for production costs. The production cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30. The assembly time for smartphones is 2 hours per unit, for tablets is 3 hours per unit, for laptops is 4 hours per unit, and for smartwatches is 1 hour per unit, with a total of 10,000 hours available for assembly. The company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The company has a budget of $250,000 for production costs.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 250000)\n## The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 4*Laptops + 1*Smartwatches <= 10000)\n## The company has a marketing strategy that requires at least 1000 units of each device to be produced to maintain market presence.\nmodel.addCons(Smartphones >= 1000)\nmodel.addCons(Tablets >= 1000)\nmodel.addCons(Laptops >= 1000)\nmodel.addCons(Smartwatches >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smartphones))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Number of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement of 500 units for smartphones and 300 units for tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for each device is as follows: smartphones $100, tablets $150, laptops $200, and smartwatches $50.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $100            |\n| Tablets      | $150            |\n| Laptops      | $200            |\n| Smartwatches | $50             |\n\nThe company has a total production capacity of 5000 units. The manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly. The company has a minimum order requirement of 500 units for smartphones and 300 units for tablets.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000)\n## The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n## The company has a minimum order requirement of 500 units for smartphones and 300 units for tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50.\nThe company wants to maximize the total profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\n// 50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000\n\n## Generate Constraint-3:\nThe assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\n// 2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000\n\n## Generate Constraint-4:\nThe company has a minimum order requirement of 500 units for smartphones and 300 units for tablets.\n// Smartphones >= 500\n// Tablets >= 300",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to decide how many units of each device to produce to optimize their profits and resources. The profit per unit for smartphones is $100, the profit per unit for tablets is $150, the profit per unit for laptops is $200, and the profit per unit for smartwatches is $50. The company wants to maximize the total profit. The company has a total production capacity of 5000 units. The manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs. The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly. The company has a minimum order requirement of 500 units for smartphones and 300 units for tablets. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The manufacturing cost per unit for smartphones is $50, for tablets is $70, for laptops is $100, and for smartwatches is $30. The company has a budget of $200,000 for manufacturing costs.\nmodel.addCons(50*Smartphones + 70*Tablets + 100*Laptops + 30*Smartwatches <= 200000)\n## The assembly time for each smartphone is 2 hours, for each tablet is 3 hours, for each laptop is 5 hours, and for each smartwatch is 1 hour. The company has a total of 10,000 hours available for assembly.\nmodel.addCons(2*Smartphones + 3*Tablets + 5*Laptops + 1*Smartwatches <= 10000)\n## The company has a minimum order requirement of 500 units for smartphones and 300 units for tablets.\nmodel.addCons(Smartphones >= 500)\nmodel.addCons(Tablets >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability.\n// {\"number of dozens of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 dozens of pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\n// Doughnuts + Eclairs <= 120\n\n## Generate Constraint-4:\nThe bakery has a budget constraint on labor costs, which should not exceed $1000 per day. The labor cost for producing a dozen of croissants is $3, muffins is $2, doughnuts is $4, and eclairs is $5.\n// 3*Croissants + 2*Muffins + 4*Doughnuts + 5*Eclairs <= 1000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability. The profit per dozen and the labor cost per dozen for each type of pastry are given in the following Table.\n\n| Pastry    | Profit per Dozen | Labor Cost per Dozen |\n|-----------|------------------|----------------------|\n| Croissants| 10$              | 3$                   |\n| Muffins   | 8$               | 2$                   |\n| Doughnuts | 12$              | 4$                   |\n| Eclairs   | 15$              | 5$                   |\n\nThe bakery has a daily production capacity of 200 dozens of pastries. The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined. The bakery also has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined. Additionally, the bakery has a budget constraint on labor costs, which should not exceed $1000 per day. \n\nPlease help the bakery to maximize its daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of dozens of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of dozens of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of dozens of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of dozens of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of dozens of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 dozens of pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 200)\n## The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\nmodel.addCons(Doughnuts + Eclairs <= 120)\n## The bakery has a budget constraint on labor costs, which should not exceed $1000 per day.\nmodel.addCons(3*Croissants + 2*Muffins + 4*Doughnuts + 5*Eclairs <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of dozens of croissants: \", model.getVal(Croissants))\n    print(\"Number of dozens of muffins: \", model.getVal(Muffins))\n    print(\"Number of dozens of doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of dozens of eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability.\n// {\"number of dozens of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"continuous\"}\n// {\"number of dozens of eclairs\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 dozens of pastries.\n// Croissants + Muffins + Doughnuts + Eclairs <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\n// Croissants + Muffins <= 150\n\n## Generate Constraint-3:\nThe bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\n// Doughnuts + Eclairs <= 120\n\n## Generate Constraint-4:\nThe bakery has a budget constraint on labor costs, which should not exceed $1000 per day. The labor cost for producing a dozen of croissants is $3, muffins is $2, doughnuts is $4, and eclairs is $5.\n// 3*Croissants + 2*Muffins + 4*Doughnuts + 5*Eclairs <= 1000",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and eclairs. The bakery needs to decide how many dozens of each type of pastry to produce daily to maximize profit while considering the constraints of production capacity and ingredient availability. The profit per dozen croissants is $10, the profit per dozen muffins is $8, the profit per dozen doughnuts is $12, and the profit per dozen eclairs is $15. The bakery has a daily production capacity of 200 dozens of pastries. The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined. The bakery also has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined. Additionally, the bakery has a budget constraint on labor costs, which should not exceed $1000 per day. The labor cost for producing a dozen of croissants is $3, muffins is $2, doughnuts is $4, and eclairs is $5. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of dozens of each type of pastry\nCroissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissants\", lb=0) # number of dozens of croissants\nMuffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Muffins\", lb=0) # number of dozens of muffins\nDoughnuts = model.addVar(vtype=\"CONTINUOUS\", name=\"Doughnuts\", lb=0) # number of dozens of doughnuts\nEclairs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eclairs\", lb=0) # number of dozens of eclairs\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Croissants + 8*Muffins + 12*Doughnuts + 15*Eclairs)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 dozens of pastries.\nmodel.addCons(Croissants + Muffins + Doughnuts + Eclairs <= 200)\n## The bakery has a limited supply of flour, which allows for a maximum of 150 dozens of croissants and muffins combined.\nmodel.addCons(Croissants + Muffins <= 150)\n## The bakery has a limited supply of sugar, which allows for a maximum of 120 dozens of doughnuts and eclairs combined.\nmodel.addCons(Doughnuts + Eclairs <= 120)\n## The bakery has a budget constraint on labor costs, which should not exceed $1000 per day.\nmodel.addCons(3*Croissants + 2*Muffins + 4*Doughnuts + 5*Eclairs <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of dozens of croissants: \", model.getVal(Croissants))\n    print(\"Number of dozens of muffins: \", model.getVal(Muffins))\n    print(\"Number of dozens of doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of dozens of eclairs: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Total_Profit = 100*Smartphones + 150*Tablets + 200*Laptops\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops <= 5000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100.\n// 50*Smartphones + 75*Tablets + 100*Laptops <= 600000\n\n## Generate Constraint-3:\nThe company has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40.\n// 20*Smartphones + 30*Tablets + 40*Laptops <= 200000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 1000 units of each device are produced to meet the minimum order requirements from distributors.\n// Smartphones >= 1000\n// Tablets >= 1000\n// Laptops >= 1000",
        "question": "A company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company has a total production capacity of 5000 units. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100, with a total budget for raw materials not exceeding $600,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40, with a maximum labor cost of $200,000. The company wants to ensure that at least 1000 units of each device are produced to meet the minimum order requirements from distributors.\n\nPlease help the company to maximize the total profit from selling these devices.\n\n| Device     | Profit per Unit | Raw Material Cost | Labor Cost |\n|------------|-----------------|-------------------|------------|\n| Smartphones| $100            | $50               | $20        |\n| Tablets    | $150            | $75               | $30        |\n| Laptops    | $200            | $100              | $40        |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to manufacture\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 5000)\n## The company has a limited budget for raw materials, which cannot exceed $600,000.\nmodel.addCons(50*Smartphones + 75*Tablets + 100*Laptops <= 600000)\n## The company has a labor constraint, with a maximum labor cost of $200,000.\nmodel.addCons(20*Smartphones + 30*Tablets + 40*Laptops <= 200000)\n## The company wants to ensure that at least 1000 units of each device are produced.\nmodel.addCons(Smartphones >= 1000)\nmodel.addCons(Tablets >= 1000)\nmodel.addCons(Laptops >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Total_Profit = 100*Smartphones + 150*Tablets + 200*Laptops\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units.\n// Smartphones + Tablets + Laptops <= 5000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100.\n// 50*Smartphones + 75*Tablets + 100*Laptops <= 600000\n\n## Generate Constraint-3:\nThe company has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40.\n// 20*Smartphones + 30*Tablets + 40*Laptops <= 200000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 1000 units of each device are produced to meet the minimum order requirements from distributors.\n// Smartphones >= 1000\n// Tablets >= 1000\n// Laptops >= 1000",
        "question": "A company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to manufacture to maximize profit while considering production capacity and resource constraints. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company has a total production capacity of 5000 units and a limited budget for raw materials, which cannot exceed $600,000. The cost of raw materials per smartphone is $50, per tablet is $75, and per laptop is $100. Additionally, the company has a labor constraint, with a maximum labor cost of $200,000. The labor cost per smartphone is $20, per tablet is $30, and per laptop is $40. The company wants to ensure that at least 1000 units of each device are produced to meet the minimum order requirements from distributors. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to manufacture\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The company has a total production capacity of 5000 units.\nmodel.addCons(Smartphones + Tablets + Laptops <= 5000)\n## The company has a limited budget for raw materials, which cannot exceed $600,000.\nmodel.addCons(50*Smartphones + 75*Tablets + 100*Laptops <= 600000)\n## The company has a labor constraint, with a maximum labor cost of $200,000.\nmodel.addCons(20*Smartphones + 30*Tablets + 40*Laptops <= 200000)\n## The company wants to ensure that at least 1000 units of each device are produced.\nmodel.addCons(Smartphones >= 1000)\nmodel.addCons(Tablets >= 1000)\nmodel.addCons(Laptops >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits.\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50.\nThe cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20.\nThe bakery wants to maximize its daily profit.\n// Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n// Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// Whole_Wheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for daily ingredient costs.\n// Total_Cost <= 2000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\n// Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain)\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the number of multigrain loaves produced is at least 200.\n// Multigrain >= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits. The selling price and cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type       | Selling Price | Cost of Ingredients |\n|------------------|---------------|---------------------|\n| Whole Wheat      | $3            | $1.50               |\n| Rye              | $4            | $2.00               |\n| Sourdough        | $5            | $2.50               |\n| Multigrain       | $4.50         | $2.20               |\n\nThe bakery has a daily production capacity of 1000 loaves. The bakery has a budget of $2000 for daily ingredient costs. The bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced. The bakery also wants to ensure that the number of multigrain loaves produced is at least 200.\n\nPlease help the bakery to maximize its daily profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n## Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\nmodel.addCons(obj == (3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain) - (1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain))\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a budget of $2000 for daily ingredient costs.\nmodel.addCons(1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain <= 2000)\n## The bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain))\n## The bakery wants to ensure that the number of multigrain loaves produced is at least 200.\nmodel.addCons(Multigrain >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits.\n// {\"number of loaves of whole wheat bread\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of multigrain bread\": \"Multigrain\", \"range\": \"Multigrain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50.\nThe cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20.\nThe bakery wants to maximize its daily profit.\n// Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n// Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves.\n// Whole_Wheat + Rye + Sourdough + Multigrain <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for daily ingredient costs.\n// Total_Cost <= 2000\n\n## Generate Constraint-3:\nThe bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\n// Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain)\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the number of multigrain loaves produced is at least 200.\n// Multigrain >= 200",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and multigrain. The bakery needs to decide how many loaves of each type of bread to produce daily to optimize their profits. The selling price per loaf of whole wheat bread is $3, rye bread is $4, sourdough bread is $5, and multigrain bread is $4.50. The cost of ingredients per loaf of whole wheat bread is $1.50, rye bread is $2, sourdough bread is $2.50, and multigrain bread is $2.20. The bakery has a daily production capacity of 1000 loaves and a budget of $2000 for daily ingredient costs. The bakery also has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced. Additionally, the bakery wants to ensure that the number of multigrain loaves produced is at least 200. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nMultigrain = model.addVar(vtype=\"CONTINUOUS\", name=\"Multigrain\", lb=0) # number of loaves of multigrain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain\n## Total_Revenue = 3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain\nmodel.addCons(obj == (3*Whole_Wheat + 4*Rye + 5*Sourdough + 4.50*Multigrain) - (1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain))\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Multigrain <= 1000)\n## The bakery has a budget of $2000 for daily ingredient costs.\nmodel.addCons(1.50*Whole_Wheat + 2*Rye + 2.50*Sourdough + 2.20*Multigrain <= 2000)\n## The bakery has a demand constraint where the number of sourdough loaves produced must be at least 10% of the total loaves produced.\nmodel.addCons(Sourdough >= 0.10 * (Whole_Wheat + Rye + Sourdough + Multigrain))\n## The bakery wants to ensure that the number of multigrain loaves produced is at least 200.\nmodel.addCons(Multigrain >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Whole_Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of multigrain bread: \", model.getVal(Multigrain))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\n// 2*A + 3*B + 2*C + 1*D <= 200\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\n// 4*A + 5*B + 3*C + 2*D <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units.\n// A <= 20\n// D >= 10\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both.\n// B + C >= 10",
        "question": "A manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce. The profit per unit for products A-D is $50, $70, $40, and $30 respectively. The following table shows the raw material and labor hour requirements for each product.\n\n| Product | Raw Material (kg) | Labor Hours |\n|---------|-------------------|-------------|\n| A       | 2                 | 4           |\n| B       | 3                 | 5           |\n| C       | 2                 | 3           |\n| D       | 1                 | 2           |\n\nThe manufacturer has 200 kg of raw materials and 150 labor hours available. The market demand for Product A is at most 20 units, and for Product D is at least 10 units. The manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both. \n\nPlease help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 2*C + 1*D <= 200)\n## Each unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nmodel.addCons(4*A + 5*B + 3*C + 2*D <= 150)\n## The market demand for Product A is at most 20 units, and for Product D is at least 10 units.\nmodel.addCons(A <= 20)\nmodel.addCons(D >= 10)\n## The manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both.\nmodel.addCons(B + C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 50*A + 70*B + 40*C + 30*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\n// 2*A + 3*B + 2*C + 1*D <= 200\n\n## Generate Constraint-2:\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\n// 4*A + 5*B + 3*C + 2*D <= 150\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units.\n// A <= 20\n// D >= 10\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both.\n// B + C >= 10",
        "question": "A manufacturer produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The manufacturer needs to decide how many units of each product to produce. The profit per unit for products A-D is $50, $70, $40, and $30 respectively. The manufacturer wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nEach unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nThe market demand for Product A is at most 20 units, and for Product D is at least 10 units. The manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both.\nPlease help the manufacturer determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 40*C + 30*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 2 kg, and Product D requires 1 kg. The manufacturer has 200 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 2*C + 1*D <= 200)\n## Each unit of Product A requires 4 labor hours, Product B requires 5 hours, Product C requires 3 hours, and Product D requires 2 hours. The manufacturer has 150 labor hours available.\nmodel.addCons(4*A + 5*B + 3*C + 2*D <= 150)\n## The market demand for Product A is at most 20 units, and for Product D is at least 10 units.\nmodel.addCons(A <= 20)\nmodel.addCons(D >= 10)\n## The manufacturer must produce at least 10 units of either Product B or Product C, or a combination of both.\nmodel.addCons(B + C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\n// 5*A + 7*B + 4*C + 6*D <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D\n\n## Generate Constraint-4:\nThe production of Product B cannot exceed the combined production of Products A and C.\n// B <= A + C",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit and production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $10             | $5                       |\n| B       | $15             | $7                       |\n| C       | $8              | $4                       |\n| D       | $12             | $6                       |\n\nThe company has a budget of $1000 for production. The company has a limited workforce that can produce at most 100 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. The production of Product B cannot exceed the combined production of Products A and C.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 1000)\n## The company has a limited workforce that can produce at most 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n## The production of Product B cannot exceed the combined production of Products A and C.\nmodel.addCons(B <= A + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 8*C + 12*D\n\n## Generate Constraint-1:\nThe production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\n// 5*A + 7*B + 4*C + 6*D <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce at most 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of Product A must be at least twice the production of Product D.\n// A >= 2*D\n\n## Generate Constraint-4:\nThe production of Product B cannot exceed the combined production of Products A and C.\n// B <= A + C",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with a different profit margin and production cost. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $8, and $12 respectively. The company wants to maximize the total profit. The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production. The company has a limited workforce that can produce at most 100 units in total. Due to market demand, the production of Product A must be at least twice the production of Product D. The production of Product B cannot exceed the combined production of Products A and C. Please help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 8*C + 12*D)\n\n# Add constraints\n## The production cost per unit for products A-D is $5, $7, $4, and $6 respectively. The company has a budget of $1000 for production.\nmodel.addCons(5*A + 7*B + 4*C + 6*D <= 1000)\n## The company has a limited workforce that can produce at most 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## Due to market demand, the production of Product A must be at least twice the production of Product D.\nmodel.addCons(A >= 2*D)\n## The production of Product B cannot exceed the combined production of Products A and C.\nmodel.addCons(B <= A + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 30*A + 45*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\n// 4*A + 6*B + 2*C + 5*D <= 150\n\n## Generate Constraint-3:\nThe company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\n// A + B + C + D <= 30\n\n## Generate Constraint-4:\nDue to market demand, the production of product B must be at least twice the production of product A.\n// B >= 2*A",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce. The profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The labor and raw material requirements for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Raw Materials per Unit |\n|---------|----------------------|------------------------|\n| A       | 2                    | 4                      |\n| B       | 3                    | 6                      |\n| C       | 1                    | 2                      |\n| D       | 2                    | 5                      |\n\nThe total available labor hours are 100 hours, and the total available raw materials are 150 units. The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products. Due to market demand, the production of product B must be at least twice the production of product A. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 45*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\nmodel.addCons(4*A + 6*B + 2*C + 5*D <= 150)\n## The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\nmodel.addCons(A + B + C + D <= 30)\n## Due to market demand, the production of product B must be at least twice the production of product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit.\n// Objective Function: Maximize: 30*A + 45*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\n// 2*A + 3*B + 1*C + 2*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\n// 4*A + 6*B + 2*C + 5*D <= 150\n\n## Generate Constraint-3:\nThe company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\n// A + B + C + D <= 30\n\n## Generate Constraint-4:\nDue to market demand, the production of product B must be at least twice the production of product A.\n// B >= 2*A",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize profit. Each product requires a certain amount of labor hours and raw materials. The profit per unit for products A, B, C, and D is $30, $45, $20, and $25 respectively. The company aims to maximize the total profit. Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively, with a total available labor hours of 100 hours. The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively, with a total available raw materials of 150 units. The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products. Due to market demand, the production of product B must be at least twice the production of product A. How many units of each product should the company produce to maximize its total profit?",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 45*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 1, and 2 labor hours respectively. The total available labor hours are 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 2*D <= 100)\n## The raw material requirements for each unit of product A, B, C, and D are 4, 6, 2, and 5 units respectively. The total available raw materials are 150 units.\nmodel.addCons(4*A + 6*B + 2*C + 5*D <= 150)\n## The company has a storage capacity limit that allows for a maximum of 30 units of any combination of products.\nmodel.addCons(A + B + C + D <= 30)\n## Due to market demand, the production of product B must be at least twice the production of product A.\nmodel.addCons(B >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units.\n// B + C - A <= 5",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours and raw material, as shown in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | 10$             | 2 hours              | 3 units                     |\n| B       | 15$             | 3 hours              | 2 units                     |\n| C       | 20$             | 4 hours              | 1 unit                      |\n| D       | 25$             | 5 hours              | 4 units                     |\n\nThe company has a total of 100 labor hours and 60 units of raw material available. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. The company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units.\n\nPlease help the company to maximize the total profit by determining the optimal quantity of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n## The company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units.\nmodel.addCons(B + C - A <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1357,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units.\n// 3*A + 2*B + 1*C + 4*D <= 60\n\n## Generate Constraint-3:\nDue to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\n// A <= 10\n// D <= 15\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units.\n// B + C - A <= 5",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production of each product requires a certain amount of labor hours. Product A, B, C, and D require 2, 3, 4, and 5 hours respectively, and the total available labor hours are 100. The company has a limited amount of raw material. Product A, B, C, and D require 3, 2, 1, and 4 units of raw material respectively, and the total available raw material is 60 units. Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D. The company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production of each product requires a certain amount of labor hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The company has a limited amount of raw material.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 60)\n## Due to market demand, the company can produce at most 10 units of Product A and 15 units of Product D.\nmodel.addCons(A <= 10)\nmodel.addCons(D <= 15)\n## The company aims to maintain a balanced production, requiring that the total production of Product B and C does not exceed the production of Product A by more than 5 units.\nmodel.addCons(B + C - A <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\n// 3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2\n\n## Generate Constraint-4:\nThe bakery prefers to produce at least as many cakes of type 1 as any other type.\n// C1 >= C2\n// C1 >= C3\n// C1 >= C4",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The following table summarizes the labor hours and ingredient units required for each cake type.\n\n| Cake Type | Profit per Cake | Labor Hours Required | Ingredient Units Required |\n|-----------|-----------------|----------------------|---------------------------|\n| 1         | $5              | 2                    | 3                         |\n| 2         | $7              | 3                    | 4                         |\n| 3         | $6              | 2                    | 3                         |\n| 4         | $4              | 1                    | 2                         |\n\nThe bakery has a total of 20 labor hours available and 30 units of ingredients. The bakery wants to ensure that at least two types of cakes are produced. Additionally, the bakery prefers to produce at least as many cakes of type 1 as any other type. Please help the bakery maximize the total profit from selling the cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\nmodel.addCons(3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n## The bakery prefers to produce at least as many cakes of type 1 as any other type.\nmodel.addCons(C1 >= C2)\nmodel.addCons(C1 >= C3)\nmodel.addCons(C1 >= C4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce.\n// {\"number of cakes of type 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of cakes of type 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nEach cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\n// 2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\n// 3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least two types of cakes are produced.\n// C1 + C2 + C3 + C4 >= 2\n\n## Generate Constraint-4:\nThe bakery prefers to produce at least as many cakes of type 1 as any other type.\n// C1 >= C2\n// C1 >= C3\n// C1 >= C4",
        "question": "A bakery is planning to produce four types of cakes (1-4) for an upcoming festival. Each cake type requires a specific amount of ingredients and labor hours. The bakery needs to decide how many cakes of each type to produce. The profit per cake for types 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total profit from selling the cakes. Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively, and the bakery has a total of 20 labor hours available. The bakery has a limited supply of ingredients; each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively, with a total of 30 units available. The bakery wants to ensure that at least two types of cakes are produced. Additionally, the bakery prefers to produce at least as many cakes of type 1 as any other type.\nPlease help the bakery determine the optimal number of cakes of each type to produce to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of cakes of type 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of cakes of type 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of cakes of type 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of cakes of type 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## Each cake type 1-4 requires 2, 3, 2, and 1 labor hours respectively. The bakery has a total of 20 labor hours available.\nmodel.addCons(2*C1 + 3*C2 + 2*C3 + 1*C4 <= 20)\n## The bakery has a limited supply of ingredients. Each cake type 1-4 requires 3, 4, 3, and 2 units of ingredients respectively. The total available ingredients are 30 units.\nmodel.addCons(3*C1 + 4*C2 + 3*C3 + 2*C4 <= 30)\n## The bakery wants to ensure that at least two types of cakes are produced.\nmodel.addCons(C1 + C2 + C3 + C4 >= 2)\n## The bakery prefers to produce at least as many cakes of type 1 as any other type.\nmodel.addCons(C1 >= C2)\nmodel.addCons(C1 >= C3)\nmodel.addCons(C1 >= C4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of cakes of type 1: \", model.getVal(C1))\n    print(\"Number of cakes of type 2: \", model.getVal(C2))\n    print(\"Number of cakes of type 3: \", model.getVal(C3))\n    print(\"Number of cakes of type 4: \", model.getVal(C4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 15 units in total.\n// A + B + C + D >= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit. The requirements for raw materials and labor hours for each product are given in the following Table.\n\n| Product | Raw Material (kg) | Labor Hours |\n|---------|-------------------|-------------|\n| A       | 2                 | 1           |\n| B       | 3                 | 2           |\n| C       | 4                 | 3           |\n| D       | 5                 | 4           |\n\nThe company has 100 kg of raw material available and 50 labor hours available. The market demand for Product A is at most 10 units, and for Product D is at least 5 units. The company must produce at least 15 units in total. Please help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n## The company must produce at least 15 units in total.\nmodel.addCons(A + B + C + D >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units.\n// A <= 10\n// D >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 15 units in total.\n// A + B + C + D >= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nThe market demand for Product A is at most 10 units, and for Product D is at least 5 units. The company must produce at least 15 units in total.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The market demand for Product A is at most 10 units, and for Product D is at least 5 units.\nmodel.addCons(A <= 10)\nmodel.addCons(D >= 5)\n## The company must produce at least 15 units in total.\nmodel.addCons(A + B + C + D >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $10             | 2 kg                    | 1 hour               |\n| B       | $15             | 3 kg                    | 2 hours              |\n| C       | $20             | 4 kg                    | 3 hours              |\n| D       | $25             | 5 kg                    | 4 hours              |\n\nThe company has 100 kg of raw materials available and 50 labor hours available. The company must produce at least 5 units of Product A and at least 3 units of Product B.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available. Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available. The company must produce at least 5 units of Product A and at least 3 units of Product B.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw materials, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw materials available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost).\n// Objective Function: Maximize: (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D\n\n## Generate Constraint-1:\nThe total production cost must not exceed $1500.\n// 10*A + 15*B + 12*C + 8*D <= 1500\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 100.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nAt least 20 units of Product A must be produced.\n// A >= 20\n\n## Generate Constraint-4:\nThe number of units of Product B must be at least twice the number of units of Product C.\n// B >= 2*C",
        "question": "A manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit |\n|---------|------------------|--------------------------|\n| A       | $20              | $10                      |\n| B       | $30              | $15                      |\n| C       | $25              | $12                      |\n| D       | $15              | $8                       |\n\nThe company wants to maximize the net profit (revenue minus cost). The total production cost must not exceed $1500. The total number of units produced must not exceed 100. At least 20 units of Product A must be produced. The number of units of Product B must be at least twice the number of units of Product C.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D)\n\n# Add constraints\n## The total production cost must not exceed $1500.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 1500)\n## The total number of units produced must not exceed 100.\nmodel.addCons(A + B + C + D <= 100)\n## At least 20 units of Product A must be produced.\nmodel.addCons(A >= 20)\n## The number of units of Product B must be at least twice the number of units of Product C.\nmodel.addCons(B >= 2*C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"0 <= A <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"0 <= C <= 100\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"0 <= D <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost).\n// Objective Function: Maximize: (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D\n\n## Generate Constraint-1:\nThe total production cost must not exceed $1500.\n// 10*A + 15*B + 12*C + 8*D <= 1500\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 100.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nAt least 20 units of Product A must be produced.\n// A >= 20\n\n## Generate Constraint-4:\nThe number of units of Product B must be at least twice the number of units of Product C.\n// B >= 2*C",
        "question": "A manufacturing company produces four types of products (A-D), each with a different production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit for products A-D is $20, $30, $25, and $15 respectively, and the production cost per unit is $10, $15, $12, and $8 respectively. The company wants to maximize the net profit (revenue minus cost). The total production cost must not exceed $1500. The total number of units produced must not exceed 100. At least 20 units of Product A must be produced. The number of units of Product B must be at least twice the number of units of Product C. Please help the company determine the optimal number of units to produce for each product to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (20-10)*A + (30-15)*B + (25-12)*C + (15-8)*D)\n\n# Add constraints\n## The total production cost must not exceed $1500.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 1500)\n## The total number of units produced must not exceed 100.\nmodel.addCons(A + B + C + D <= 100)\n## At least 20 units of Product A must be produced.\nmodel.addCons(A >= 20)\n## The number of units of Product B must be at least twice the number of units of Product C.\nmodel.addCons(B >= 2*C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 769,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit.\n// {\"amount of resources allocated to Project 1\": \"R1\", \"range\": \"0 <= R1 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 2\": \"R2\", \"range\": \"0 <= R2 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 3\": \"R3\", \"range\": \"0 <= R3 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 4\": \"R4\", \"range\": \"0 <= R4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 20*R1 + 30*R2 + 15*R3 + 25*R4\n\n## Generate Constraint-1:\nThe total resources available for allocation are 200 units.\n// R1 + R2 + R3 + R4 <= 200\n\n## Generate Constraint-2:\nProject 1 and Project 2 cannot receive more than 80 units of resources combined.\n// R1 + R2 <= 80\n\n## Generate Constraint-3:\nAt least 40 units of resources must be allocated to Project 3.\n// R3 >= 40\n\n## Generate Constraint-4:\nThe total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2.\n// R4 <= R1 + R2",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit. The profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit. The following table summarizes the profit per unit of resource for each project.\n\n| Project | Profit per Unit of Resource |\n|---------|-----------------------------|\n| 1       | $20                         |\n| 2       | $30                         |\n| 3       | $15                         |\n| 4       | $25                         |\n\nThe total resources available for allocation are 200 units. Project 1 and Project 2 cannot receive more than 80 units of resources combined. At least 40 units of resources must be allocated to Project 3. The total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2. Please help the company determine the optimal allocation of resources to each project to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of resources allocated to each project\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=100) # amount of resources allocated to Project 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=100) # amount of resources allocated to Project 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=100) # amount of resources allocated to Project 3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0, ub=100) # amount of resources allocated to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*R1 + 30*R2 + 15*R3 + 25*R4)\n\n# Add constraints\n## The total resources available for allocation are 200 units.\nmodel.addCons(R1 + R2 + R3 + R4 <= 200)\n## Project 1 and Project 2 cannot receive more than 80 units of resources combined.\nmodel.addCons(R1 + R2 <= 80)\n## At least 40 units of resources must be allocated to Project 3.\nmodel.addCons(R3 >= 40)\n## The total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2.\nmodel.addCons(R4 <= R1 + R2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of resources allocated to Project 1: \", model.getVal(R1))\n    print(\"Amount of resources allocated to Project 2: \", model.getVal(R2))\n    print(\"Amount of resources allocated to Project 3: \", model.getVal(R3))\n    print(\"Amount of resources allocated to Project 4: \", model.getVal(R4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit.\n// {\"amount of resources allocated to Project 1\": \"R1\", \"range\": \"0 <= R1 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 2\": \"R2\", \"range\": \"0 <= R2 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 3\": \"R3\", \"range\": \"0 <= R3 <= 100\", \"type\": \"integer\"}\n// {\"amount of resources allocated to Project 4\": \"R4\", \"range\": \"0 <= R4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 20*R1 + 30*R2 + 15*R3 + 25*R4\n\n## Generate Constraint-1:\nThe total resources available for allocation are 200 units.\n// R1 + R2 + R3 + R4 <= 200\n\n## Generate Constraint-2:\nProject 1 and Project 2 cannot receive more than 80 units of resources combined.\n// R1 + R2 <= 80\n\n## Generate Constraint-3:\nAt least 40 units of resources must be allocated to Project 3.\n// R3 >= 40\n\n## Generate Constraint-4:\nThe total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2.\n// R4 <= R1 + R2",
        "question": "A company is planning to allocate resources to four different projects (1-4) to maximize its profit. Each project requires a specific amount of resources and has a corresponding profit. The profit per unit of resource for projects 1-4 is $20, $30, $15, and $25 respectively. The company wants to maximize the total profit. The total resources available for allocation are 200 units. Project 1 and Project 2 cannot receive more than 80 units of resources combined. At least 40 units of resources must be allocated to Project 3. The total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2. Please help the company determine the optimal allocation of resources to each project.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of resources allocated to each project\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=100) # amount of resources allocated to Project 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=100) # amount of resources allocated to Project 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=100) # amount of resources allocated to Project 3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0, ub=100) # amount of resources allocated to Project 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20*R1 + 30*R2 + 15*R3 + 25*R4)\n\n# Add constraints\n## The total resources available for allocation are 200 units.\nmodel.addCons(R1 + R2 + R3 + R4 <= 200)\n## Project 1 and Project 2 cannot receive more than 80 units of resources combined.\nmodel.addCons(R1 + R2 <= 80)\n## At least 40 units of resources must be allocated to Project 3.\nmodel.addCons(R3 >= 40)\n## The total resources allocated to Project 4 must not exceed the sum of resources allocated to Project 1 and Project 2.\nmodel.addCons(R4 <= R1 + R2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of resources allocated to Project 1: \", model.getVal(R1))\n    print(\"Amount of resources allocated to Project 2: \", model.getVal(R2))\n    print(\"Amount of resources allocated to Project 3: \", model.getVal(R3))\n    print(\"Amount of resources allocated to Project 4: \", model.getVal(R4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-50)*A + (150-75)*B + (200-100)*C + (250-125)*D\n// Objective Function: Maximize: 50*A + 75*B + 100*C + 125*D\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 50*A + 75*B + 100*C + 125*D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of Product A.\n// A >= 10\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of Product D.\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce. The revenue and production cost for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit |\n|---------|------------------|--------------------------|\n| A       | $100             | $50                      |\n| B       | $150             | $75                      |\n| C       | $200             | $100                     |\n| D       | $250             | $125                     |\n\nThe company has a total production budget of $10,000. The company has a limited workforce that can produce a maximum of 100 units in total. The company must produce at least 10 units of Product A and at least 5 units of Product D. \nPlease help the company to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 75*B + 100*C + 125*D)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 10000)\n## The company has a limited workforce that can produce a maximum of 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## The company must produce at least 10 units of Product A.\nmodel.addCons(A >= 10)\n## The company must produce at least 5 units of Product D.\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-50)*A + (150-75)*B + (200-100)*C + (250-125)*D\n// Objective Function: Maximize: 50*A + 75*B + 100*C + 125*D\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 50*A + 75*B + 100*C + 125*D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 100 units in total.\n// A + B + C + D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of Product A.\n// A >= 10\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of Product D.\n// D >= 5",
        "question": "A manufacturing company produces four types of products (A, B, C, D), each with its own production cost and revenue. The company needs to decide how many units of each product to produce. The revenue for products A, B, C, and D is $100, $150, $200, and $250 per unit respectively, and the production cost is $50, $75, $100, and $125 per unit respectively. The company wants to maximize the net profit. The company has a total production budget of $10,000. The company has a limited workforce that can produce a maximum of 100 units in total. The company must produce at least 10 units of Product A. The company must produce at least 5 units of Product D.\nPlease help the company to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 75*B + 100*C + 125*D)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 10000)\n## The company has a limited workforce that can produce a maximum of 100 units in total.\nmodel.addCons(A + B + C + D <= 100)\n## The company must produce at least 10 units of Product A.\nmodel.addCons(A >= 10)\n## The company must produce at least 5 units of Product D.\nmodel.addCons(D >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 706,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\n// 2*A + 3*B + 4*C + 5*D <= 60\n\n## Generate Constraint-2:\nThe labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\n// A + 2*B + 3*C + 4*D <= 40\n\n## Generate Constraint-3:\nThe company can produce at most 10 units of Product A.\n// A <= 10\n\n## Generate Constraint-4:\nThe company can produce at most 15 units of Product B.\n// B <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The raw materials and labor hours required for each product are given in the following Table.\n\n| Product | Raw Materials (kg) | Labor Hours | Profit per Unit |\n|---------|--------------------|-------------|-----------------|\n| A       | 2                  | 1           | 10$             |\n| B       | 3                  | 2           | 15$             |\n| C       | 4                  | 3           | 20$             |\n| D       | 5                  | 4           | 25$             |\n\nThe total available raw materials are 60 kg, and the total available labor hours are 40 hours. The company can produce at most 10 units of Product A and at most 15 units of Product B. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 60)\n## The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 40)\n## The company can produce at most 10 units of Product A.\nmodel.addCons(A <= 10)\n## The company can produce at most 15 units of Product B.\nmodel.addCons(B <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\n// 2*A + 3*B + 4*C + 5*D <= 60\n\n## Generate Constraint-2:\nThe labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\n// A + 2*B + 3*C + 4*D <= 40\n\n## Generate Constraint-3:\nThe company can produce at most 10 units of Product A.\n// A <= 10\n\n## Generate Constraint-4:\nThe company can produce at most 15 units of Product B.\n// B <= 15",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nThe raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg. The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours. The company can produce at most 10 units of Product A and at most 15 units of Product B.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The raw materials required for products A-D are 2 kg, 3 kg, 4 kg, and 5 kg respectively, and the total available raw materials are 60 kg.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 60)\n## The labor hours required for products A-D are 1 hour, 2 hours, 3 hours, and 4 hours respectively, and the total available labor hours are 40 hours.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 40)\n## The company can produce at most 10 units of Product A.\nmodel.addCons(A <= 10)\n## The company can produce at most 15 units of Product B.\nmodel.addCons(B <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------|----------------------|\n| A       | $10             | 2 kg                  | 1 hour               |\n| B       | $15             | 3 kg                  | 2 hours              |\n| C       | $20             | 4 kg                  | 3 hours              |\n| D       | $25             | 5 kg                  | 4 hours              |\n\nThe company has 100 kg of raw material available and 50 labor hours available. The company must produce at least 5 units of Product A and at least 3 units of Product B.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\n// A + 2*B + 3*C + 4*D <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of Product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company must produce at least 3 units of Product B.\n// B >= 3",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nEach unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nThe company must produce at least 5 units of Product A and at least 3 units of Product B.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of Product A requires 2 kg of raw material, Product B requires 3 kg, Product C requires 4 kg, and Product D requires 5 kg. The company has 100 kg of raw material available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## Each unit of Product A requires 1 labor hour, Product B requires 2 hours, Product C requires 3 hours, and Product D requires 4 hours. The company has 50 labor hours available.\nmodel.addCons(A + 2*B + 3*C + 4*D <= 50)\n## The company must produce at least 5 units of Product A.\nmodel.addCons(A >= 5)\n## The company must produce at least 3 units of Product B.\nmodel.addCons(B >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n// D <= 250\n\n## Generate Constraint-2:\nThe total production time for all products must not exceed 500 hours. The production time per unit for products A, B, C, and D is 2, 3, 4, and 5 hours respectively.\n// 2*A + 3*B + 4*C + 5*D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A.\n// A >= 50\n\n## Generate Constraint-4:\nThe company must produce at least 25 units of product B.\n// B >= 25",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively. The total production time for all products must not exceed 500 hours, with the production time per unit for products A, B, C, and D being 2, 3, 4, and 5 hours respectively. The company must produce at least 50 units of product A and at least 25 units of product B.\n\nPlease help the company to maximize the total profit by determining the optimal quantity of each product to produce.\n\n| Product | Profit per Unit | Production Capacity | Production Time per Unit |\n|---------|-----------------|---------------------|-------------------------|\n| A       | $10             | 100                 | 2 hours                 |\n| B       | $15             | 150                 | 3 hours                 |\n| C       | $20             | 200                 | 4 hours                 |\n| D       | $25             | 250                 | 5 hours                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\nmodel.addCons(D <= 250)\n## The total production time for all products must not exceed 500 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 500)\n## The company must produce at least 50 units of product A.\nmodel.addCons(A >= 50)\n## The company must produce at least 25 units of product B.\nmodel.addCons(B >= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nThe production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n// D <= 250\n\n## Generate Constraint-2:\nThe total production time for all products must not exceed 500 hours. The production time per unit for products A, B, C, and D is 2, 3, 4, and 5 hours respectively.\n// 2*A + 3*B + 4*C + 5*D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A.\n// A >= 50\n\n## Generate Constraint-4:\nThe company must produce at least 25 units of product B.\n// B >= 25",
        "question": "A manufacturing company is planning to produce four different products (A-D) to maximize its profit. The company needs to decide the quantity of each product to produce. The profit per unit for products A, B, C, and D is $10, $15, $20, and $25 respectively. The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively. The total production time for all products must not exceed 500 hours, with the production time per unit for products A, B, C, and D being 2, 3, 4, and 5 hours respectively. The company must produce at least 50 units of product A and at least 25 units of product B. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product to produce\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## The production capacity for products A, B, C, and D is limited to 100, 150, 200, and 250 units respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\nmodel.addCons(D <= 250)\n## The total production time for all products must not exceed 500 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 500)\n## The company must produce at least 50 units of product A.\nmodel.addCons(A >= 50)\n## The company must produce at least 25 units of product B.\nmodel.addCons(B >= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 685,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0).\n// {\"whether to produce Product A\": \"A\", \"range\": \"A = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"B\", \"range\": \"B = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"C\", \"range\": \"C = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"D\", \"range\": \"D = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 100*A + 150*B + 80*C + 90*D\n\n## Generate Constraint-1:\nThe company has a limited budget of $200 for production. The cost per unit for products A, B, C, and D is $30, $40, $20, and $25 respectively.\n// 30*A + 40*B + 20*C + 25*D <= 200\n\n## Generate Constraint-2:\nThe company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy.\n// A + B + C + D <= 2\n\n## Generate Constraint-3:\nThe company must produce at least one product to maintain operational efficiency.\n// A + B + C + D >= 1\n\n## Generate Constraint-4:\nDue to market demand, product A cannot be produced unless product B is also produced.\n// A <= B",
        "question": "A manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0). The profit per unit and cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $100            | $30           |\n| B       | $150            | $40           |\n| C       | $80             | $20           |\n| D       | $90             | $25           |\n\nThe company has a limited budget of $200 for production. The company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy. The company must produce at least one product to maintain operational efficiency. Due to market demand, product A cannot be produced unless product B is also produced.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\nA = model.addVar(vtype=\"BINARY\", name=\"A\") # whether to produce Product A\nB = model.addVar(vtype=\"BINARY\", name=\"B\") # whether to produce Product B\nC = model.addVar(vtype=\"BINARY\", name=\"C\") # whether to produce Product C\nD = model.addVar(vtype=\"BINARY\", name=\"D\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 80*C + 90*D)\n\n# Add constraints\n## The company has a limited budget of $200 for production.\nmodel.addCons(30*A + 40*B + 20*C + 25*D <= 200)\n## The company can only produce a maximum of two different types of products.\nmodel.addCons(A + B + C + D <= 2)\n## The company must produce at least one product.\nmodel.addCons(A + B + C + D >= 1)\n## Product A cannot be produced unless product B is also produced.\nmodel.addCons(A <= B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(A))\n    print(\"Whether to produce Product B: \", model.getVal(B))\n    print(\"Whether to produce Product C: \", model.getVal(C))\n    print(\"Whether to produce Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0).\n// {\"whether to produce Product A\": \"A\", \"range\": \"A = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product B\": \"B\", \"range\": \"B = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product C\": \"C\", \"range\": \"C = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to produce Product D\": \"D\", \"range\": \"D = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 100*A + 150*B + 80*C + 90*D\n\n## Generate Constraint-1:\nThe company has a limited budget of $200 for production. The cost per unit for products A, B, C, and D is $30, $40, $20, and $25 respectively.\n// 30*A + 40*B + 20*C + 25*D <= 200\n\n## Generate Constraint-2:\nThe company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy.\n// A + B + C + D <= 2\n\n## Generate Constraint-3:\nThe company must produce at least one product to maintain operational efficiency.\n// A + B + C + D >= 1\n\n## Generate Constraint-4:\nDue to market demand, product A cannot be produced unless product B is also produced.\n// A <= B",
        "question": "A manufacturing company is planning to produce four types of products (A, B, C, D) to maximize profit. The production decision for each product is binary, either produce (1) or not produce (0). The profit per unit for products A, B, C, and D is $100, $150, $80, and $90 respectively. The company has a limited budget of $200 for production. The cost per unit for products A, B, C, and D is $30, $40, $20, and $25 respectively. The company can only produce a maximum of two different types of products due to limited production capacity and diversification strategy. The company must produce at least one product to maintain operational efficiency. Due to market demand, product A cannot be produced unless product B is also produced. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to produce each product\nA = model.addVar(vtype=\"BINARY\", name=\"A\") # whether to produce Product A\nB = model.addVar(vtype=\"BINARY\", name=\"B\") # whether to produce Product B\nC = model.addVar(vtype=\"BINARY\", name=\"C\") # whether to produce Product C\nD = model.addVar(vtype=\"BINARY\", name=\"D\") # whether to produce Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 80*C + 90*D)\n\n# Add constraints\n## The company has a limited budget of $200 for production.\nmodel.addCons(30*A + 40*B + 20*C + 25*D <= 200)\n## The company can only produce a maximum of two different types of products.\nmodel.addCons(A + B + C + D <= 2)\n## The company must produce at least one product.\nmodel.addCons(A + B + C + D >= 1)\n## Product A cannot be produced unless product B is also produced.\nmodel.addCons(A <= B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to produce Product A: \", model.getVal(A))\n    print(\"Whether to produce Product B: \", model.getVal(B))\n    print(\"Whether to produce Product C: \", model.getVal(C))\n    print(\"Whether to produce Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 805,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce.\n// {\"number of units of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 75*C + 50*D\n\n## Generate Constraint-1:\nThe total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer must produce at least 5 units of Device A.\n// A >= 5\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of either Device B or Device C, but not both.\n// B + C >= 10\n\n## Generate Constraint-4:\nThe total number of units produced cannot exceed 50.\n// A + B + C + D <= 50",
        "question": "A manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce. The profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The production time for each device is as follows:\n\n| Device | Production Time |\n|--------|-----------------|\n| A      | 2 hours         |\n| B      | 3 hours         |\n| C      | 1 hour          |\n| D      | 1 hour          |\n\nThe manufacturer has a total of 100 hours available for production. The manufacturer must produce at least 5 units of Device A. The manufacturer must produce at least 10 units of either Device B or Device C, but not both. The total number of units produced cannot exceed 50.\n\nPlease help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Device D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 75*C + 50*D)\n\n# Add constraints\n## The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The manufacturer must produce at least 5 units of Device A.\nmodel.addCons(A >= 5)\n## The manufacturer must produce at least 10 units of either Device B or Device C, but not both.\nB_or_C = model.addVar(vtype=\"B\", name=\"B_or_C\")\nmodel.addCons(B + C >= 10*B_or_C)\nmodel.addCons(B <= 10*(1-B_or_C))\nmodel.addCons(C <= 10*(1-B_or_C))\n## The total number of units produced cannot exceed 50.\nmodel.addCons(A + B + C + D <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Device A: \", model.getVal(A))\n    print(\"Number of units of Device B: \", model.getVal(B))\n    print(\"Number of units of Device C: \", model.getVal(C))\n    print(\"Number of units of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce.\n// {\"number of units of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 75*C + 50*D\n\n## Generate Constraint-1:\nThe total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-2:\nThe manufacturer must produce at least 5 units of Device A.\n// A >= 5\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of either Device B or Device C, but not both.\n// B + C >= 10\n\n## Generate Constraint-4:\nThe total number of units produced cannot exceed 50.\n// A + B + C + D <= 50",
        "question": "A manufacturer produces four types of electronic devices (A, B, C, D) and needs to decide how many units of each device to produce. The profit per unit for devices A, B, C, D is $100, $150, $75, and $50 respectively. The manufacturer wants to maximize the total profit. The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively, with a total of 100 hours available for production. The manufacturer must produce at least 5 units of Device A and at least 10 units of either Device B or Device C, but not both. Additionally, the total number of units produced cannot exceed 50. Please help the manufacturer determine the optimal number of units to produce for each device to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Device D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 75*C + 50*D)\n\n# Add constraints\n## The total production time for devices A, B, C, D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The manufacturer has a total of 100 hours available for production.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The manufacturer must produce at least 5 units of Device A.\nmodel.addCons(A >= 5)\n## The manufacturer must produce at least 10 units of either Device B or Device C, but not both.\nB_or_C = model.addVar(vtype=\"B\", name=\"B_or_C\")\nmodel.addCons(B + C >= 10*B_or_C)\nmodel.addCons(B <= 10*(1-B_or_C))\nmodel.addCons(C <= 10*(1-B_or_C))\n## The total number of units produced cannot exceed 50.\nmodel.addCons(A + B + C + D <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Device A: \", model.getVal(A))\n    print(\"Number of units of Device B: \", model.getVal(B))\n    print(\"Number of units of Device C: \", model.getVal(C))\n    print(\"Number of units of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 10 units of product D.\n// D <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit |\n|---------|-----------------|----------------------|-----------------------|\n| A       | 10$             | 2 hours              | 3 kg                  |\n| B       | 15$             | 3 hours              | 2 kg                  |\n| C       | 20$             | 4 hours              | 1 kg                  |\n| D       | 25$             | 5 hours              | 4 kg                  |\n\nThe company has a total of 100 labor hours available and 80 kg of raw materials. The company must produce at least 5 units of product A and can produce at most 10 units of product D.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company can produce at most 10 units of product D.\nmodel.addCons(D <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\n// Objective Function: Maximize: 10*A + 15*B + 20*C + 25*D\n\n## Generate Constraint-1:\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\n// 2*A + 3*B + 4*C + 5*D <= 100\n\n## Generate Constraint-2:\nThe raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\n// 3*A + 2*B + 1*C + 4*D <= 80\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product A.\n// A >= 5\n\n## Generate Constraint-4:\nThe company can produce at most 10 units of product D.\n// D <= 10",
        "question": "A manufacturing company produces four types of products (A-D), each requiring a specific amount of raw materials and labor hours. The company needs to decide how many units of each product to produce. The profit per unit for products A-D is $10, $15, $20, and $25 respectively. The company wants to maximize the total profit.\nEach unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively, and the company has a total of 100 labor hours available. The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively, and the company has 80 kg of raw materials available. The company must produce at least 5 units of product A and can produce at most 10 units of product D.\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C + 25*D)\n\n# Add constraints\n## Each unit of product A, B, C, and D requires 2, 3, 4, and 5 labor hours respectively. The company has a total of 100 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 100)\n## The raw material requirement per unit for products A, B, C, and D is 3, 2, 1, and 4 kg respectively. The company has 80 kg of raw materials available.\nmodel.addCons(3*A + 2*B + 1*C + 4*D <= 80)\n## The company must produce at least 5 units of product A.\nmodel.addCons(A >= 5)\n## The company can produce at most 10 units of product D.\nmodel.addCons(D <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $100, $150, $90, and $70 respectively. The production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 40*A + 60*B + 30*C + 20*D <= 10000\n\n## Generate Constraint-2:\nThe total production time for all products should not exceed 100 hours. The production time per unit for products A-D is 2 hours, 3 hours, 1 hour, and 1 hour respectively.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units in total.\n// A + B + C + D >= 50\n\n## Generate Constraint-4:\nThe production of product A should not exceed the production of product B by more than 10 units.\n// A - B <= 10",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit |\n|---------|------------------|--------------------------|\n| A       | $100             | $40                      |\n| B       | $150             | $60                      |\n| C       | $90              | $30                      |\n| D       | $70              | $20                      |\n\nThe company has a total budget of $10,000 for production costs. The total production time for all products should not exceed 100 hours, with the production time per unit for products A-D being 2 hours, 3 hours, 1 hour, and 1 hour respectively. The company must produce at least 50 units in total. The production of product A should not exceed the production of product B by more than 10 units.\n\nPlease help the company to maximize the net profit, which is calculated as the difference between the revenue and the production cost per unit for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D)\n\n# Add constraints\n## The company has a total budget of $10,000 for production costs.\nmodel.addCons(40*A + 60*B + 30*C + 20*D <= 10000)\n## The total production time for all products should not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The company must produce at least 50 units in total.\nmodel.addCons(A + B + C + D >= 50)\n## The production of product A should not exceed the production of product B by more than 10 units.\nmodel.addCons(A - B <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for products A-D is $100, $150, $90, and $70 respectively. The production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit.\n// Objective Function: Maximize: (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 40*A + 60*B + 30*C + 20*D <= 10000\n\n## Generate Constraint-2:\nThe total production time for all products should not exceed 100 hours. The production time per unit for products A-D is 2 hours, 3 hours, 1 hour, and 1 hour respectively.\n// 2*A + 3*B + 1*C + 1*D <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units in total.\n// A + B + C + D >= 50\n\n## Generate Constraint-4:\nThe production of product A should not exceed the production of product B by more than 10 units.\n// A - B <= 10",
        "question": "A manufacturing company is planning to produce four types of products (A-D), each with its own production cost and potential revenue. The company needs to decide how many units of each product to produce. The revenue per unit for products A-D is $100, $150, $90, and $70 respectively. The production cost per unit is $40, $60, $30, and $20 respectively. The company wants to maximize the net profit. The company has a total budget of $10,000 for production costs. The total production time for all products should not exceed 100 hours. The production time per unit for products A-D is 2 hours, 3 hours, 1 hour, and 1 hour respectively. The company must produce at least 50 units in total. The production of product A should not exceed the production of product B by more than 10 units. Please help the company determine the optimal number of units to produce for each product to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100-40)*A + (150-60)*B + (90-30)*C + (70-20)*D)\n\n# Add constraints\n## The company has a total budget of $10,000 for production costs.\nmodel.addCons(40*A + 60*B + 30*C + 20*D <= 10000)\n## The total production time for all products should not exceed 100 hours.\nmodel.addCons(2*A + 3*B + 1*C + 1*D <= 100)\n## The company must produce at least 50 units in total.\nmodel.addCons(A + B + C + D >= 50)\n## The production of product A should not exceed the production of product B by more than 10 units.\nmodel.addCons(A - B <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Number of units of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively.\n// 4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// Product_A >= 10\n\n## Generate Constraint-3:\nThe company can produce a maximum of 50 units of Product B due to limited raw material availability.\n// Product_B <= 50\n\n## Generate Constraint-4:\nThe total production of Product C and Product D should not exceed 80 units.\n// Product_C + Product_D <= 80",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for each product and the labor hours required to produce one unit are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| A       | $50             | 4                    |\n| B       | $30             | 3                    |\n| C       | $40             | 5                    |\n| D       | $20             | 2                    |\n\nThe company has a total of 1000 labor hours available. The market demand for Product A is at least 10 units. The company can produce a maximum of 50 units of Product B due to limited raw material availability. The total production of Product C and Product D should not exceed 80 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(Product_A >= 10)\n## The company can produce a maximum of 50 units of Product B due to limited raw material availability.\nmodel.addCons(Product_B <= 50)\n## The total production of Product C and Product D should not exceed 80 units.\nmodel.addCons(Product_C + Product_D <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product D\": \"Product_D\", \"range\": \"Product_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company aims to maximize the total profit from all products.\n// Objective Function: Maximize: 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively.\n// 4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// Product_A >= 10\n\n## Generate Constraint-3:\nThe company can produce a maximum of 50 units of Product B due to limited raw material availability.\n// Product_B <= 50\n\n## Generate Constraint-4:\nThe total production of Product C and Product D should not exceed 80 units.\n// Product_C + Product_D <= 80",
        "question": "A manufacturing company produces four types of products: Product A, Product B, Product C, and Product D. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for Product A, Product B, Product C, and Product D is $50, $30, $40, and $20, respectively. The company has a total of 1000 labor hours available. Producing one unit of Product A, Product B, Product C, and Product D requires 4, 3, 5, and 2 hours, respectively. The market demand for Product A is at least 10 units. The company can produce a maximum of 50 units of Product B due to limited raw material availability. The total production of Product C and Product D should not exceed 80 units. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of units of Product A\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of units of Product B\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of units of Product C\nProduct_D = model.addVar(vtype=\"INTEGER\", name=\"Product_D\", lb=0) # number of units of Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Product_A + 30*Product_B + 40*Product_C + 20*Product_D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*Product_A + 3*Product_B + 5*Product_C + 2*Product_D <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(Product_A >= 10)\n## The company can produce a maximum of 50 units of Product B due to limited raw material availability.\nmodel.addCons(Product_B <= 50)\n## The total production of Product C and Product D should not exceed 80 units.\nmodel.addCons(Product_C + Product_D <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(Product_A))\n    print(\"Number of units of Product B: \", model.getVal(Product_B))\n    print(\"Number of units of Product C: \", model.getVal(Product_C))\n    print(\"Number of units of Product D: \", model.getVal(Product_D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of additional special loaves\": \"x4\", \"range\": \"0 <= x4 <= 50\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3 + 5*x4\n\n## Generate Constraint-1:\nThe total number of loaves that can be baked daily is limited to 200 due to oven capacity.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\n// x1 >= 30\n// x2 >= 20\n\n## Generate Constraint-3:\nThe bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\n// x4 <= 50\n\n## Generate Constraint-4:\nTo ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily.\n// x3 >= 10",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough, along with a special type of bread. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The following table summarizes the constraints and requirements:\n\n| Bread Type       | Profit per Loaf | Constraints and Requirements |\n|------------------|-----------------|------------------------------|\n| Wheat (x1)       | $2              | 30 <= x1 <= 100              |\n| Rye (x2)         | $3              | 20 <= x2 <= 100              |\n| Sourdough (x3)   | $4              | 10 <= x3 <= 100              |\n| Special (x4)     | $5              | 0 <= x4 <= 50                |\n\nThe bakery aims to maximize the total daily profit from bread sales. The total number of loaves that can be baked daily is limited to 200 due to oven capacity. The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively. The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand. To ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily.\n\nPlease help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=50) # number of additional special loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3 + 5*x4)\n\n# Add constraints\n## The total number of loaves that can be baked daily is limited to 200 due to oven capacity.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\nmodel.addCons(x1 >= 30)\nmodel.addCons(x2 >= 20)\n## The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\nmodel.addCons(x4 <= 50)\n## To ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily.\nmodel.addCons(x3 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of additional special loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of additional special loaves\": \"x4\", \"range\": \"0 <= x4 <= 50\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The bakery aims to maximize the total daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 4*x3 + 5*x4\n\n## Generate Constraint-1:\nThe total number of loaves that can be baked daily is limited to 200 due to oven capacity.\n// x1 + x2 + x3 + x4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\n// x1 >= 30\n// x2 >= 20\n\n## Generate Constraint-3:\nThe bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\n// x4 <= 50\n\n## Generate Constraint-4:\nTo ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily.\n// x3 >= 10",
        "question": "A bakery wants to optimize the production of three types of bread: Wheat, Rye, and Sourdough, as well as a special type of bread. They need to decide how many loaves of each type to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit per loaf for Wheat, Rye, Sourdough, and special bread is $2, $3, $4, and $5, respectively. The bakery has a total daily oven capacity of 200 loaves. The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively. The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand. To ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=50) # number of additional special loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 4*x3 + 5*x4)\n\n# Add constraints\n## The total number of loaves that can be baked daily is limited to 200 due to oven capacity.\nmodel.addCons(x1 + x2 + x3 + x4 <= 200)\n## The bakery has a minimum daily demand for Wheat and Rye bread of 30 and 20 loaves, respectively.\nmodel.addCons(x1 >= 30)\nmodel.addCons(x2 >= 20)\n## The bakery can only produce up to 50 special loaves per day due to the complexity of the recipe and limited customer demand.\nmodel.addCons(x4 <= 50)\n## To ensure variety and customer satisfaction, the bakery must produce at least 10 Sourdough loaves daily.\nmodel.addCons(x3 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of additional special loaves: \", model.getVal(x4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n// x4 is a dummy variable used to simplify the constraint equations.\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 2.5*x3\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// x1 + x2 + x3 <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. Each loaf of Whole Wheat, Rye, and Sourdough bread contains 2 grams, 1 gram, and 1.5 grams of fiber, respectively.\n// 2*x1 + x2 + 1.5*x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\n// x1 >= 150\n// x2 >= 100\n\n## Generate Constraint-4:\nThe bakery must also meet a minimum daily demand of 300 loaves of any type of bread.\n// x1 + x2 + x3 >= 300",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The following table summarizes the fiber content per loaf for each type of bread.\n\n| Bread Type       | Profit per Loaf | Fiber Content per Loaf |\n|------------------|-----------------|------------------------|\n| Whole Wheat      | $2              | 2 grams                |\n| Rye              | $3              | 1 gram                 |\n| Sourdough        | $2.50           | 1.5 grams              |\n\nThe bakery has a daily production capacity of 500 loaves of bread. The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily. Additionally, the bakery must meet a minimum daily demand of 300 loaves of any type of bread.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # dummy variable for simplifying constraints\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(x1 + x2 + x3 <= 500)\n## The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day.\nmodel.addCons(2*x1 + x2 + 1.5*x3 >= 100)\n## The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\nmodel.addCons(x1 >= 150)\nmodel.addCons(x2 >= 100)\n## The bakery must also meet a minimum daily demand of 300 loaves of any type of bread.\nmodel.addCons(x1 + x2 + x3 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production of any bread\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n// x4 is a dummy variable used to simplify the constraint equations.\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 2*x1 + 3*x2 + 2.5*x3\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves of bread.\n// x1 + x2 + x3 <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day. Each loaf of Whole Wheat, Rye, and Sourdough bread contains 2 grams, 1 gram, and 1.5 grams of fiber, respectively.\n// 2*x1 + x2 + 1.5*x3 >= 100\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\n// x1 >= 150\n// x2 >= 100\n\n## Generate Constraint-4:\nThe bakery must also meet a minimum daily demand of 300 loaves of any type of bread.\n// x1 + x2 + x3 >= 300",
        "question": "A bakery wants to optimize the production of three types of bread: Whole Wheat, Rye, and Sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, and Sourdough bread is $2, $3, and $2.50, respectively. The bakery has a daily production capacity of 500 loaves of bread. The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day, with each loaf of Whole Wheat, Rye, and Sourdough bread containing 2 grams, 1 gram, and 1.5 grams of fiber, respectively. The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily. Additionally, the bakery must meet a minimum daily demand of 300 loaves of any type of bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production of Whole Wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production of Rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production of Sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # dummy variable for simplifying constraints\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*x1 + 3*x2 + 2.5*x3)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves of bread.\nmodel.addCons(x1 + x2 + x3 <= 500)\n## The bakery must ensure that the total fiber content of the bread produced meets a minimum requirement of 100 grams per day.\nmodel.addCons(2*x1 + x2 + 1.5*x3 >= 100)\n## The bakery has a contractual obligation to supply at least 150 loaves of Whole Wheat bread and 100 loaves of Rye bread daily.\nmodel.addCons(x1 >= 150)\nmodel.addCons(x2 >= 100)\n## The bakery must also meet a minimum daily demand of 300 loaves of any type of bread.\nmodel.addCons(x1 + x2 + x3 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(x1))\n    print(\"Daily production of Rye bread: \", model.getVal(x2))\n    print(\"Daily production of Sourdough bread: \", model.getVal(x3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of Ciabatta loaves\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Maximize: 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 250 loaves.\n// x1 + x2 + x3 + x4 <= 250\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Rye bread of 30 loaves.\n// x2 >= 30\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread.\n// x3 + x4 <= 120",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity. The profit per loaf for each type of bread is given in the following Table.\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2.50           |\n| Rye          | $3.00           |\n| Sourdough    | $3.50           |\n| Ciabatta     | $4.00           |\n\nThe bakery has a daily production capacity of 250 loaves. The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation. The bakery has a minimum daily demand for Rye bread of 30 loaves. The bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=100) # number of Ciabatta loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 250 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 250)\n## The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery has a minimum daily demand for Rye bread of 30 loaves.\nmodel.addCons(x2 >= 30)\n## The bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread.\nmodel.addCons(x3 + x4 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Ciabatta loaves: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity.\n// {\"number of Whole Wheat loaves\": \"x1\", \"range\": \"0 <= x1 <= 100\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"x2\", \"range\": \"0 <= x2 <= 100\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"x3\", \"range\": \"0 <= x3 <= 100\", \"type\": \"integer\"}\n// {\"number of Ciabatta loaves\": \"x4\", \"range\": \"0 <= x4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Maximize: 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 250 loaves.\n// x1 + x2 + x3 + x4 <= 250\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\n// x1 >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Rye bread of 30 loaves.\n// x2 >= 30\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread.\n// x3 + x4 <= 120",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Ciabatta. The bakery needs to determine the number of loaves of each type of bread to produce to maximize profit while meeting customer demand and considering the production capacity. The profit per loaf for Whole Wheat, Rye, Sourdough, and Ciabatta is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery has a daily production capacity of 250 loaves. The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation. The bakery has a minimum daily demand for Rye bread of 30 loaves. The bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=100) # number of Whole Wheat loaves\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=100) # number of Rye loaves\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=100) # number of Sourdough loaves\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=100) # number of Ciabatta loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*x1 + 3.00*x2 + 3.50*x3 + 4.00*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 250 loaves.\nmodel.addCons(x1 + x2 + x3 + x4 <= 250)\n## The bakery must produce at least 50 loaves of Whole Wheat bread to meet a contract obligation.\nmodel.addCons(x1 >= 50)\n## The bakery has a minimum daily demand for Rye bread of 30 loaves.\nmodel.addCons(x2 >= 30)\n## The bakery must ensure that the total number of Sourdough and Ciabatta loaves does not exceed 120, due to limited oven space dedicated to these types of bread.\nmodel.addCons(x3 + x4 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(x1))\n    print(\"Number of Rye loaves: \", model.getVal(x2))\n    print(\"Number of Sourdough loaves: \", model.getVal(x3))\n    print(\"Number of Ciabatta loaves: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"0 <= x2 <= 800\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 500\", \"type\": \"integer\"}\n// {\"daily production of specialty bread\": \"x4\", \"range\": \"0 <= x4 <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread should not exceed 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 8 hours. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively.\n// 0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat, rye, sourdough, and specialty bread is 200, 150, 100, and 50 loaves, respectively.\n// x1 >= 200\n// x2 >= 150\n// x3 >= 100\n// x4 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced production, aiming to produce at least twice as much wheat bread as rye bread, and at least three times as much rye bread as sourdough bread.\n// x1 >= 2*x2\n// x2 >= 3*x3",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and specialty. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand. The profit per loaf and the resources required for each type of bread are given in the following Table.\n\n| Bread Type       | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|------------------|-----------------|-------------------------|-------------------------|\n| Wheat (x1)       | $1.50           | 0.5 kg                  | 0.01 hours              |\n| Rye (x2)         | $2.00           | 0.7 kg                  | 0.02 hours              |\n| Sourdough (x3)   | $2.50           | 0.6 kg                  | 0.03 hours              |\n| Specialty (x4)   | $3.00           | 0.8 kg                  | 0.04 hours              |\n\nThe bakery has a limited amount of flour available each day, with the total flour usage for all types of bread not exceeding 1500 kg. The bakery also has a daily labor constraint of 8 hours. The bakery must meet a minimum daily demand for each type of bread: 200 loaves of wheat, 150 loaves of rye, 100 loaves of sourdough, and 50 loaves of specialty bread. Additionally, the bakery wants to ensure a balanced production, aiming to produce at least twice as much wheat bread as rye bread, and at least three times as much rye bread as sourdough bread.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=800) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=500) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=300) # daily production of specialty bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4)\n\n# Add constraints\n## The total flour usage for all types of bread should not exceed 1500 kg.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500)\n## The bakery has a daily labor constraint of 8 hours.\nmodel.addCons(0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\nmodel.addCons(x3 >= 100)\nmodel.addCons(x4 >= 50)\n## The bakery wants to ensure a balanced production.\nmodel.addCons(x1 >= 2*x2)\nmodel.addCons(x2 >= 3*x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of specialty bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1542,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand.\n// {\"daily production of wheat bread\": \"x1\", \"range\": \"0 <= x1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production of rye bread\": \"x2\", \"range\": \"0 <= x2 <= 800\", \"type\": \"integer\"}\n// {\"daily production of sourdough bread\": \"x3\", \"range\": \"0 <= x3 <= 500\", \"type\": \"integer\"}\n// {\"daily production of specialty bread\": \"x4\", \"range\": \"0 <= x4 <= 300\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Maximize: 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. The total flour usage for all types of bread should not exceed 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500\n\n## Generate Constraint-2:\nThe bakery has a daily labor constraint of 8 hours. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively.\n// 0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand for each type of bread. The minimum demand for wheat, rye, sourdough, and specialty bread is 200, 150, 100, and 50 loaves, respectively.\n// x1 >= 200\n// x2 >= 150\n// x3 >= 100\n// x4 >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced production, aiming to produce at least twice as much wheat bread as rye bread, and at least three times as much rye bread as sourdough bread.\n// x1 >= 2*x2\n// x2 >= 3*x3",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, sourdough, and specialty. The bakery needs to determine the daily production quantities of each type of bread to maximize profit while considering the available resources and market demand. The profit per loaf of wheat, rye, sourdough, and specialty bread is $1.50, $2.00, $2.50, and $3.00, respectively. The bakery has a limited amount of flour available each day, with the total flour usage for all types of bread not exceeding 1500 kg. Each loaf of wheat, rye, sourdough, and specialty bread requires 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour, respectively. The bakery also has a daily labor constraint of 8 hours, with each loaf of wheat, rye, sourdough, and specialty bread requiring 0.01 hours, 0.02 hours, 0.03 hours, and 0.04 hours of labor, respectively. The bakery must meet a minimum daily demand for each type of bread, with the minimum demand for wheat, rye, sourdough, and specialty bread being 200, 150, 100, and 50 loaves, respectively. Additionally, the bakery wants to ensure a balanced production, aiming to produce at least twice as much wheat bread as rye bread, and at least three times as much rye bread as sourdough bread. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0, ub=1000) # daily production of wheat bread\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0, ub=800) # daily production of rye bread\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0, ub=500) # daily production of sourdough bread\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0, ub=300) # daily production of specialty bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 2.50*x3 + 3.00*x4)\n\n# Add constraints\n## The total flour usage for all types of bread should not exceed 1500 kg.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 1500)\n## The bakery has a daily labor constraint of 8 hours.\nmodel.addCons(0.01*x1 + 0.02*x2 + 0.03*x3 + 0.04*x4 <= 8)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 150)\nmodel.addCons(x3 >= 100)\nmodel.addCons(x4 >= 50)\n## The bakery wants to ensure a balanced production.\nmodel.addCons(x1 >= 2*x2)\nmodel.addCons(x2 >= 3*x3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of wheat bread: \", model.getVal(x1))\n    print(\"Daily production of rye bread: \", model.getVal(x2))\n    print(\"Daily production of sourdough bread: \", model.getVal(x3))\n    print(\"Daily production of specialty bread: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1296,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// W + R + S + G <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\n// W >= 50, R >= 50, S >= 50, G >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\n// W + 1.5*R + 2*S + 1.2*G <= 400\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production.\n// S <= 0.20 * (W + R + S + G)",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Wheat        | $2.50           |\n| Rye          | $3.00           |\n| Sourdough    | $3.50           |\n| Whole Grain  | $2.75           |\n\nThe bakery has an oven capacity of 500 loaves per day. The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand. The bakery has a limited supply of ingredients, specifically flour, which is enough for 400 loaves of bread per day. The bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S + 2.75*G)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(W + R + S + G <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\nmodel.addCons(G >= 50)\n## The bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\nmodel.addCons(W + 1.5*R + 2*S + 1.2*G <= 400)\n## The bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production.\nmodel.addCons(S <= 0.20 * (W + R + S + G))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Number of whole grain bread loaves: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"number of wheat bread loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of whole grain bread loaves\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S + 2.75*G\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// W + R + S + G <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\n// W >= 50, R >= 50, S >= 50, G >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\n// W + 1.5*R + 2*S + 1.2*G <= 400\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production.\n// S <= 0.20 * (W + R + S + G)",
        "question": "A small bakery produces four types of bread: wheat, rye, sourdough, and whole grain. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of wheat, rye, sourdough, and whole grain bread is $2.50, $3.00, $3.50, and $2.75, respectively. The bakery has an oven capacity of 500 loaves per day. The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand. The bakery has a limited supply of ingredients, specifically flour, which is enough for 400 loaves of bread per day. The bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread loaves\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread loaves\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # number of whole grain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S + 2.75*G)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(W + R + S + G <= 500)\n## The bakery must produce at least 50 loaves of each type of bread to meet minimum customer demand.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\nmodel.addCons(G >= 50)\n## The bakery has a limited supply of ingredients, specifically flour. The available flour is enough for 400 loaves of bread per day.\nmodel.addCons(W + 1.5*R + 2*S + 1.2*G <= 400)\n## The bakery wants to ensure that the production of sourdough bread does not exceed 20% of the total bread production.\nmodel.addCons(S <= 0.20 * (W + R + S + G))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(W))\n    print(\"Number of rye bread loaves: \", model.getVal(R))\n    print(\"Number of sourdough bread loaves: \", model.getVal(S))\n    print(\"Number of whole grain bread loaves: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of White bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// WW + Rye + Sourd + White <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White.\n// WW >= 50\n// Rye >= 40\n// Sourd >= 60\n// White >= 70\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// WW + Rye + Sourd + White <= 300\n\n## Generate Constraint-4:\nThe bakery aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined.\n// WW + Rye >= Sourd + White",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $1.50           |\n| Rye            | $1.20           |\n| Sourdough      | $1.30           |\n| White          | $1.00           |\n\nThe bakery has an oven capacity of 500 loaves per day. It must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White. The bakery also has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. Additionally, the bakery aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # daily production of White bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 500)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourd >= 60)\nmodel.addCons(White >= 70)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 300)\n## The bakery aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined.\nmodel.addCons(WW + Rye >= Sourd + White)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of White bread: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of White bread\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White\n\n## Generate Constraint-1:\nThe bakery has an oven capacity of 500 loaves per day.\n// WW + Rye + Sourd + White <= 500\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White.\n// WW >= 50\n// Rye >= 40\n// Sourd >= 60\n// White >= 70\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\n// WW + Rye + Sourd + White <= 300\n\n## Generate Constraint-4:\nThe bakery aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined.\n// WW + Rye >= Sourd + White",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal daily production quantity of each type of bread to maximize profit while meeting customer demand and considering the limited oven capacity. The profit per loaf of Whole Wheat, Rye, Sourdough, and White bread is $1.50, $1.20, $1.30, and $1.00, respectively. The bakery has an oven capacity of 500 loaves per day and a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day. The bakery must meet a minimum daily demand for each type of bread: at least 50 loaves of Whole Wheat, 40 loaves of Rye, 60 loaves of Sourdough, and 70 loaves of White. The bakery also aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # daily production of White bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.00*White)\n\n# Add constraints\n## The bakery has an oven capacity of 500 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 500)\n## The bakery must meet a minimum daily demand for each type of bread.\nmodel.addCons(WW >= 50)\nmodel.addCons(Rye >= 40)\nmodel.addCons(Sourd >= 60)\nmodel.addCons(White >= 70)\n## The bakery has a limited supply of a special ingredient used in all bread types, which is only enough for 300 loaves per day.\nmodel.addCons(WW + Rye + Sourd + White <= 300)\n## The bakery aims to promote healthier options and thus wants to ensure that the production of Whole Wheat and Rye breads combined is at least as much as the production of Sourdough and White breads combined.\nmodel.addCons(WW + Rye >= Sourd + White)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of White bread: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*W + 3*R + 4*SD\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// W + R + SD <= 500\n\n## Generate Constraint-2:\nEach loaf of bread must meet a minimum nutritional requirement. Wheat bread provides 10 units of nutrition, rye bread provides 15 units, and sourdough bread provides 20 units. The total daily nutritional output must be at least 7000 units.\n// 10*W + 15*R + 20*SD >= 7000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all three bread types. The supply is enough for 300 loaves per day.\n// W + R + SD <= 300\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// W >= 50, R >= 50, SD >= 50",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The following table summarizes the nutritional content per loaf of each type of bread.\n\n| Bread Type | Profit per Loaf | Nutritional Units per Loaf |\n|------------|-----------------|----------------------------|\n| Wheat      | $2              | 10                         |\n| Rye        | $3              | 15                         |\n| Sourdough  | $4              | 20                         |\n\nThe bakery has a daily production capacity of 500 loaves. Each loaf of bread must meet a minimum nutritional requirement, and the total daily nutritional output must be at least 7000 units. The bakery has a limited supply of a special ingredient used in all three bread types, which is enough for 300 loaves per day. Additionally, the bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 4*SD)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(W + R + SD <= 500)\n## Each loaf of bread must meet a minimum nutritional requirement.\nmodel.addCons(10*W + 15*R + 20*SD >= 7000)\n## The bakery has a limited supply of a special ingredient used in all three bread types.\nmodel.addCons(W + R + SD <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(SD >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(SD))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints.\n// {\"number of wheat loaves\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*W + 3*R + 4*SD\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// W + R + SD <= 500\n\n## Generate Constraint-2:\nEach loaf of bread must meet a minimum nutritional requirement. Wheat bread provides 10 units of nutrition, rye bread provides 15 units, and sourdough bread provides 20 units. The total daily nutritional output must be at least 7000 units.\n// 10*W + 15*R + 20*SD >= 7000\n\n## Generate Constraint-3:\nThe bakery has a limited supply of a special ingredient used in all three bread types. The supply is enough for 300 loaves per day.\n// W + R + SD <= 300\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// W >= 50, R >= 50, SD >= 50",
        "question": "A bakery specializes in producing three types of bread: wheat, rye, and sourdough. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting certain nutritional and production constraints. The profit per loaf of wheat bread is $2, rye bread is $3, and sourdough bread is $4. The bakery has a daily production capacity of 500 loaves. Each loaf of bread must meet a minimum nutritional requirement, with wheat bread providing 10 units of nutrition, rye bread providing 15 units, and sourdough bread providing 20 units, and the total daily nutritional output must be at least 7000 units. The bakery has a limited supply of a special ingredient used in all three bread types, which is enough for 300 loaves per day. Additionally, the bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat loaves\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of sourdough loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 4*SD)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(W + R + SD <= 500)\n## Each loaf of bread must meet a minimum nutritional requirement.\nmodel.addCons(10*W + 15*R + 20*SD >= 7000)\n## The bakery has a limited supply of a special ingredient used in all three bread types.\nmodel.addCons(W + R + SD <= 300)\n## The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(SD >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(W))\n    print(\"Number of rye loaves: \", model.getVal(R))\n    print(\"Number of sourdough loaves: \", model.getVal(SD))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// WW + Rye + Sour + White <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\n// WW >= 100\n// Rye >= 50\n// Sour >= 50\n// White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients. Specifically, the supply of whole grains is limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds. Each loaf of bread requires 0.5 pounds of its respective ingredient.\n// 0.5 * WW <= 200\n// 0.5 * Rye <= 150\n// 0.5 * Sour <= 100\n// 0.5 * White <= 300\n\n## Generate Constraint-4:\nThe bakery aims to balance the variety of breads offered. Therefore, the number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves.\n// Sour <= WW + Rye",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2.50           |\n| Rye           | $2.00           |\n| Sourdough     | $3.00           |\n| White         | $1.50           |\n\nThe bakery has a daily production capacity of 500 loaves. It must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations. The bakery has a limited supply of ingredients: 200 pounds of whole grains, 150 pounds of rye, 100 pounds of sourdough starter, and 300 pounds of refined flour, with each loaf requiring 0.5 pounds of its respective ingredient. Additionally, the bakery aims to balance the variety of breads offered, so the number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(WW + Rye + Sour + White <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sour >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.5 * WW <= 200)\nmodel.addCons(0.5 * Rye <= 150)\nmodel.addCons(0.5 * Sour <= 100)\nmodel.addCons(0.5 * White <= 300)\n## The number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves.\nmodel.addCons(Sour <= WW + Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"Sour\", \"range\": \"Sour >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 500 loaves.\n// WW + Rye + Sour + White <= 500\n\n## Generate Constraint-2:\nThe bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\n// WW >= 100\n// Rye >= 50\n// Sour >= 50\n// White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of ingredients. Specifically, the supply of whole grains is limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds. Each loaf of bread requires 0.5 pounds of its respective ingredient.\n// 0.5 * WW <= 200\n// 0.5 * Rye <= 150\n// 0.5 * Sour <= 100\n// 0.5 * White <= 300\n\n## Generate Constraint-4:\nThe bakery aims to balance the variety of breads offered. Therefore, the number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves.\n// Sour <= WW + Rye",
        "question": "A small bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering production constraints. The profit per loaf for Whole Wheat, Rye, Sourdough, and White bread is $2.50, $2.00, $3.00, and $1.50, respectively. The bakery has a daily production capacity of 500 loaves. The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations. The bakery has a limited supply of ingredients, with whole grains limited to 200 pounds, rye to 150 pounds, sourdough starter to 100 pounds, and refined flour to 300 pounds, with each loaf requiring 0.5 pounds of its respective ingredient. The bakery also aims to balance the variety of breads offered, so the number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves. Please help the bakery maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nSour = model.addVar(vtype=\"INTEGER\", name=\"Sour\", lb=0) # number of Sourdough loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 2.00*Rye + 3.00*Sour + 1.50*White)\n\n# Add constraints\n## The bakery has a daily production capacity of 500 loaves.\nmodel.addCons(WW + Rye + Sour + White <= 500)\n## The bakery must produce at least 100 loaves of Whole Wheat bread and 50 loaves of each of the other types of bread to meet contractual obligations.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 50)\nmodel.addCons(Sour >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of ingredients.\nmodel.addCons(0.5 * WW <= 200)\nmodel.addCons(0.5 * Rye <= 150)\nmodel.addCons(0.5 * Sour <= 100)\nmodel.addCons(0.5 * White <= 300)\n## The number of Sourdough loaves should not exceed the combined number of Whole Wheat and Rye loaves.\nmodel.addCons(Sour <= WW + Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sour))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively.\n// 0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands.\n// WW >= 0.20 * (WW + Rye + Sourd + Brioche)\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance.\n// Brioche <= 300\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to maintain operational efficiency and meet minimum order quantities from suppliers.\n// WW >= 100, Rye >= 100, Sourd >= 100, Brioche >= 100",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf for each type of bread is as follows: Whole Wheat - $1.50, Rye - $1.20, Sourdough - $1.30, and Brioche - $1.70.\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $1.50           |\n| Rye          | $1.20           |\n| Sourdough    | $1.30           |\n| Brioche      | $1.70           |\n\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively. The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands. The bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance. Additionally, the bakery must produce at least 100 loaves of each type of bread to maintain operational efficiency and meet minimum order quantities from suppliers.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500)\n## The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Sourd + Brioche))\n## The bakery has a daily demand limit for Brioche bread of 300 loaves.\nmodel.addCons(Brioche <= 300)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourd >= 100)\nmodel.addCons(Brioche >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints.\n// {\"daily production of Whole Wheat bread\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"Sourd\", \"range\": \"Sourd >= 0\", \"type\": \"integer\"}\n// {\"daily production of Brioche bread\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively.\n// 0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands.\n// WW >= 0.20 * (WW + Rye + Sourd + Brioche)\n\n## Generate Constraint-3:\nThe bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance.\n// Brioche <= 300\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to maintain operational efficiency and meet minimum order quantities from suppliers.\n// WW >= 100, Rye >= 100, Sourd >= 100, Brioche >= 100",
        "question": "A bakery produces four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery wants to determine the optimal daily production quantities of each type of bread to maximize profit while meeting certain nutritional and demand constraints. The profit per loaf of Whole Wheat, Rye, Sourdough, and Brioche bread is $1.50, $1.20, $1.30, and $1.70, respectively. The bakery has a daily flour supply limit of 500 kg. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche bread requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour, respectively. The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread to meet health-conscious customer demands. The bakery has a daily demand limit for Brioche bread of 300 loaves due to limited market acceptance. The bakery must produce at least 100 loaves of each type of bread to maintain operational efficiency and meet minimum order quantities from suppliers.\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # daily production of Whole Wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # daily production of Rye bread\nSourd = model.addVar(vtype=\"INTEGER\", name=\"Sourd\", lb=0) # daily production of Sourdough bread\nBrioche = model.addVar(vtype=\"INTEGER\", name=\"Brioche\", lb=0) # daily production of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*WW + 1.20*Rye + 1.30*Sourd + 1.70*Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 500 kg.\nmodel.addCons(0.5*WW + 0.4*Rye + 0.3*Sourd + 0.6*Brioche <= 500)\n## The bakery must ensure that at least 20% of the daily bread production is Whole Wheat bread.\nmodel.addCons(WW >= 0.20 * (WW + Rye + Sourd + Brioche))\n## The bakery has a daily demand limit for Brioche bread of 300 loaves.\nmodel.addCons(Brioche <= 300)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(WW >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourd >= 100)\nmodel.addCons(Brioche >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Whole Wheat bread: \", model.getVal(WW))\n    print(\"Daily production of Rye bread: \", model.getVal(Rye))\n    print(\"Daily production of Sourdough bread: \", model.getVal(Sourd))\n    print(\"Daily production of Brioche bread: \", model.getVal(Brioche))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 pounds of flour. Each loaf of Whole Wheat, Sourdough, Rye, and White bread requires 1 pound of flour.\n// WW + SD + Rye + White <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 50 loaves of each type of bread daily.\n// WW >= 50, SD >= 50, Rye >= 50, White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye.\n// SD <= 100, Rye <= 80\n\n## Generate Constraint-4:\nThe bakery aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat.\n// WW >= 0.40 * (WW + SD + Rye + White)",
        "question": "A small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery has a daily limit of 200 pounds of flour, and each loaf of bread requires 1 pound of flour. The bakery has a contract to supply at least 50 loaves of each type of bread daily. The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye. The bakery aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat.\n\nPlease help the bakery to maximize its daily profit.\n\n| Bread Type    | Profit per Loaf | Flour Required per Loaf |\n|---------------|-----------------|-------------------------|\n| Whole Wheat   | $2.50           | 1 pound                 |\n| Sourdough     | $3.00           | 1 pound                 |\n| Rye           | $2.00           | 1 pound                 |\n| White         | $1.50           | 1 pound                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of Sourdough loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White)\n\n# Add constraints\n## The bakery has a daily limit of 200 pounds of flour.\nmodel.addCons(WW + SD + Rye + White <= 200)\n## The bakery has a contract to supply at least 50 loaves of each type of bread daily.\nmodel.addCons(WW >= 50)\nmodel.addCons(SD >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread.\nmodel.addCons(SD <= 100)\nmodel.addCons(Rye <= 80)\n## The bakery aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat.\nmodel.addCons(WW >= 0.40 * (WW + SD + Rye + White))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Sourdough loaves: \", model.getVal(SD))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1316,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients.\n// {\"number of Whole Wheat loaves\": \"WW\", \"range\": \"WW >= 0\", \"type\": \"integer\"}\n// {\"number of Sourdough loaves\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of White loaves\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 200 pounds of flour. Each loaf of Whole Wheat, Sourdough, Rye, and White bread requires 1 pound of flour.\n// WW + SD + Rye + White <= 200\n\n## Generate Constraint-2:\nThe bakery has a contract to supply at least 50 loaves of each type of bread daily.\n// WW >= 50, SD >= 50, Rye >= 50, White >= 50\n\n## Generate Constraint-3:\nThe bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread. The daily yeast supply is enough for 100 loaves of Sourdough and 80 loaves of Rye.\n// SD <= 100, Rye <= 80\n\n## Generate Constraint-4:\nThe bakery aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat.\n// WW >= 0.40 * (WW + SD + Rye + White)",
        "question": "A small bakery produces four types of bread: Whole Wheat, Sourdough, Rye, and White. The bakery needs to determine the optimal number of loaves of each type of bread to maximize profit while meeting customer demand and considering the limited availability of ingredients. The profit per loaf for Whole Wheat, Sourdough, Rye, and White bread is $2.50, $3.00, $2.00, and $1.50, respectively. The bakery has a daily limit of 200 pounds of flour, and each loaf requires 1 pound of flour. The bakery has a contract to supply at least 50 loaves of each type of bread daily. The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread, with the daily yeast supply being enough for 100 loaves of Sourdough and 80 loaves of Rye. The bakery also aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWW = model.addVar(vtype=\"INTEGER\", name=\"WW\", lb=0) # number of Whole Wheat loaves\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of Sourdough loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of Rye loaves\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of White loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*WW + 3.00*SD + 2.00*Rye + 1.50*White)\n\n# Add constraints\n## The bakery has a daily limit of 200 pounds of flour.\nmodel.addCons(WW + SD + Rye + White <= 200)\n## The bakery has a contract to supply at least 50 loaves of each type of bread daily.\nmodel.addCons(WW >= 50)\nmodel.addCons(SD >= 50)\nmodel.addCons(Rye >= 50)\nmodel.addCons(White >= 50)\n## The bakery has a limited supply of yeast, which is critical for making Sourdough and Rye bread.\nmodel.addCons(SD <= 100)\nmodel.addCons(Rye <= 80)\n## The bakery aims to promote healthier options and thus wants to ensure that at least 40% of the total loaves produced are Whole Wheat.\nmodel.addCons(WW >= 0.40 * (WW + SD + Rye + White))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WW))\n    print(\"Number of Sourdough loaves: \", model.getVal(SD))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of White loaves: \", model.getVal(White))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds.\n// 1.5*W + 1.2*R + 1.3*S <= 500\n\n## Generate Constraint-2:\nTo maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\n// W >= 50, R >= 50, S >= 50\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\n// W >= 100\n\n## Generate Constraint-4:\nDue to oven capacity, the total number of loaves baked daily cannot exceed 300.\n// W + R + S <= 300",
        "question": "A small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards. The profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds. To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day. The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day. Due to oven capacity, the total number of loaves baked daily cannot exceed 300.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf |\n|------------|-----------------|-------------------------|\n| Wheat      | $2.50           | 1.5 pounds              |\n| Rye        | $3.00           | 1.2 pounds              |\n| Sourdough  | $3.50           | 1.3 pounds              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(1.5*W + 1.2*R + 1.3*S <= 500)\n## To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\n## The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\nmodel.addCons(W >= 100)\n## Due to oven capacity, the total number of loaves baked daily cannot exceed 300.\nmodel.addCons(W + R + S <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards.\n// {\"quantity of wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"quantity of rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"quantity of sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 3.50*S\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds.\n// 1.5*W + 1.2*R + 1.3*S <= 500\n\n## Generate Constraint-2:\nTo maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\n// W >= 50, R >= 50, S >= 50\n\n## Generate Constraint-3:\nThe bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\n// W >= 100\n\n## Generate Constraint-4:\nDue to oven capacity, the total number of loaves baked daily cannot exceed 300.\n// W + R + S <= 300",
        "question": "A small bakery specializes in making three types of bread: wheat, rye, and sourdough. The bakery wants to optimize the production quantities of each type of bread to maximize profit while ensuring they meet customer demand and maintain quality standards. The profit per loaf of wheat, rye, and sourdough bread is $2.50, $3.00, and $3.50, respectively. The bakery has a limited daily supply of flour. Wheat bread requires 1.5 pounds of flour per loaf, rye bread requires 1.2 pounds, and sourdough requires 1.3 pounds. The total daily flour supply is 500 pounds. To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day. The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day. Due to oven capacity, the total number of loaves baked daily cannot exceed 300. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # quantity of wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # quantity of rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 3.50*S)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(1.5*W + 1.2*R + 1.3*S <= 500)\n## To maintain quality, the bakery must produce at least 50 loaves of each type of bread per day.\nmodel.addCons(W >= 50)\nmodel.addCons(R >= 50)\nmodel.addCons(S >= 50)\n## The bakery has a contractual obligation to supply at least 100 loaves of wheat bread to a local restaurant each day.\nmodel.addCons(W >= 100)\n## Due to oven capacity, the total number of loaves baked daily cannot exceed 300.\nmodel.addCons(W + R + S <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of wheat bread: \", model.getVal(W))\n    print(\"Quantity of rye bread: \", model.getVal(R))\n    print(\"Quantity of sourdough bread: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves of bread.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\n// x1 >= 200\n// x2 >= 300\n\n## Generate Constraint-3:\nDue to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\n// x3 <= 400\n// x4 <= 500\n\n## Generate Constraint-4:\nTo maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves.\n// x1 + x3 <= 600",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery has a daily production capacity of 1000 loaves of bread. The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2. Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day. To maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Bread Type | Profit per Loaf |\n|------------|-----------------|\n| Bread 1    | $1.50           |\n| Bread 2    | $2.00           |\n| Bread 3    | $1.75           |\n| Bread 4    | $1.90           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves of bread.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 300)\n## Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\nmodel.addCons(x3 <= 400)\nmodel.addCons(x4 <= 500)\n## To maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves.\nmodel.addCons(x1 + x3 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery wants to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 loaves of bread.\n// x1 + x2 + x3 + x4 <= 1000\n\n## Generate Constraint-2:\nThe bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\n// x1 >= 200\n// x2 >= 300\n\n## Generate Constraint-3:\nDue to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\n// x3 <= 400\n// x4 <= 500\n\n## Generate Constraint-4:\nTo maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves.\n// x1 + x3 <= 600",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and maintaining quality standards. The bakery needs to determine the daily production quantity of each type of bread. The profit per loaf of Bread 1-4 is $1.50, $2.00, $1.75, and $1.90, respectively. The bakery has a daily production capacity of 1000 loaves of bread. The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2. Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day. To maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*x1 + 2.00*x2 + 1.75*x3 + 1.90*x4)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 loaves of bread.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1000)\n## The bakery must meet a minimum daily demand of 200 loaves for Bread 1 and 300 loaves for Bread 2.\nmodel.addCons(x1 >= 200)\nmodel.addCons(x2 >= 300)\n## Due to limited oven space, the bakery can only produce a maximum of 400 loaves of Bread 3 and 500 loaves of Bread 4 per day.\nmodel.addCons(x3 <= 400)\nmodel.addCons(x4 <= 500)\n## To maintain quality, the bakery must ensure that the total production of Bread 1 and Bread 3 does not exceed 600 loaves.\nmodel.addCons(x1 + x3 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The cost of production per loaf for Bread 1-4 is $2.00, $2.50, $3.00, and $3.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively. The total daily flour supply is 100 kg.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively. The total daily labor capacity is 20 hours.\n// 0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1 to promote a new product.\n// x2 >= 2*x1",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread. The selling price and cost of production per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Selling Price per Loaf | Cost of Production per Loaf |\n|------------|-----------------------|-----------------------------|\n| Bread 1    | $3.50                 | $2.00                       |\n| Bread 2    | $4.00                 | $2.50                       |\n| Bread 3    | $4.50                 | $3.00                       |\n| Bread 4    | $5.00                 | $3.50                       |\n\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively, and the total daily flour supply is 100 kg. The bakery also has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively, and the total daily labor capacity is 20 hours. The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order. Additionally, the bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1 to promote a new product.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited daily labor capacity.\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20)\n## The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily.\nmodel.addCons(x1 >= 50)\n## The bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1.\nmodel.addCons(x2 >= 2*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1482,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread.\n// {\"daily production quantity of Bread 1\": \"x1\", \"range\": \"x1 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"x2\", \"range\": \"x2 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"x3\", \"range\": \"x3 >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"x4\", \"range\": \"x4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively. The cost of production per loaf for Bread 1-4 is $2.00, $2.50, $3.00, and $3.50, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4\n\n## Generate Constraint-1:\nThe bakery has a limited daily supply of flour. Bread 1-4 require 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively. The total daily flour supply is 100 kg.\n// 0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited daily labor capacity. Bread 1-4 require 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively. The total daily labor capacity is 20 hours.\n// 0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20\n\n## Generate Constraint-3:\nThe bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order.\n// x1 >= 50\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1 to promote a new product.\n// x2 >= 2*x1",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit. Each type of bread requires different amounts of ingredients and labor, and each has a different selling price. The bakery needs to determine the daily production quantity of each type of bread. The selling price per loaf for Bread 1-4 is $3.50, $4.00, $4.50, and $5.00, respectively, and the cost of production per loaf for Bread 1-4 is $2.00, $2.50, $3.00, and $3.50, respectively. The bakery has a limited daily supply of flour, with Bread 1-4 requiring 0.5 kg, 0.7 kg, 0.6 kg, and 0.8 kg of flour per loaf, respectively, and the total daily flour supply is 100 kg. The bakery also has a limited daily labor capacity, with Bread 1-4 requiring 0.2 hours, 0.3 hours, 0.4 hours, and 0.5 hours of labor per loaf, respectively, and the total daily labor capacity is 20 hours. The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily to meet a specific customer's order. Additionally, the bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1 to promote a new product. Please help the bakery maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nx1 = model.addVar(vtype=\"INTEGER\", name=\"x1\", lb=0) # daily production quantity of Bread 1\nx2 = model.addVar(vtype=\"INTEGER\", name=\"x2\", lb=0) # daily production quantity of Bread 2\nx3 = model.addVar(vtype=\"INTEGER\", name=\"x3\", lb=0) # daily production quantity of Bread 3\nx4 = model.addVar(vtype=\"INTEGER\", name=\"x4\", lb=0) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (3.50 - 2.00) * x1 + (4.00 - 2.50) * x2 + (4.50 - 3.00) * x3 + (5.00 - 3.50) * x4)\n\n# Add constraints\n## The bakery has a limited daily supply of flour.\nmodel.addCons(0.5*x1 + 0.7*x2 + 0.6*x3 + 0.8*x4 <= 100)\n## The bakery has a limited daily labor capacity.\nmodel.addCons(0.2*x1 + 0.3*x2 + 0.4*x3 + 0.5*x4 <= 20)\n## The bakery wants to ensure that at least 50 loaves of Bread 1 are produced daily.\nmodel.addCons(x1 >= 50)\n## The bakery aims to produce at least twice as many loaves of Bread 2 as Bread 1.\nmodel.addCons(x2 >= 2*x1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(x1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(x2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(x3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(x4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit.\n// WholeWheat + Rye + Sourdough + Brioche <= 5000\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand.\n// WholeWheat >= 1000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type   | Profit per Loaf |\n|--------------|-----------------|\n| Whole Wheat  | $2              |\n| Rye          | $3              |\n| Sourdough    | $2.50           |\n| Brioche      | $4              |\n\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor. The bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The total cost of ingredients should not exceed the budget. The bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit. The bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand.\n\nPlease help the bakery to maximize the total profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a storage capacity limit of 5000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 5000)\n## The bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand.\nmodel.addCons(WholeWheat >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available. Each loaf of Whole Wheat requires 0.5 hours, Rye requires 0.4 hours, Sourdough requires 0.6 hours, and Brioche requires 0.8 hours of labor.\n// 0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients. The cost of ingredients per loaf for Whole Wheat is $0.50, for Rye is $0.70, for Sourdough is $0.60, and for Brioche is $1. The total cost of ingredients should not exceed the budget.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 5000 loaves. The total number of loaves produced should not exceed this limit.\n// WholeWheat + Rye + Sourdough + Brioche <= 5000\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand.\n// WholeWheat >= 1000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available, with each loaf of Whole Wheat requiring 0.5 hours, Rye requiring 0.4 hours, Sourdough requiring 0.6 hours, and Brioche requiring 0.8 hours of labor. The bakery also has a budget of $5000 for ingredients, with the cost of ingredients per loaf for Whole Wheat being $0.50, for Rye being $0.70, for Sourdough being $0.60, and for Brioche being $1. The total cost of ingredients should not exceed the budget. Additionally, the bakery has a storage capacity limit of 5000 loaves, and the total number of loaves produced should not exceed this limit. The bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand. Please help the bakery to maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye + 0.6*Sourdough + 0.8*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 5000)\n## The bakery has a storage capacity limit of 5000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 5000)\n## The bakery aims to produce at least 1000 loaves of Whole Wheat bread to meet the demand.\nmodel.addCons(WholeWheat >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. It takes 0.5 hours to make a loaf of Whole Wheat, 0.7 hours for Rye, 0.6 hours for Sourdough, and 1 hour for Brioche.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients per week. The cost of ingredients for a loaf of Whole Wheat is $1, for Rye is $1.50, for Sourdough is $1.20, and for Brioche is $2.\n// WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\n// WholeWheat >= 500\n\n## Generate Constraint-4:\nThe bakery has a storage capacity limit of 2000 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf and the time and cost of ingredients for each type of bread are given in the following Table.\n\n| Bread Type   | Profit per Loaf | Time per Loaf | Cost of Ingredients per Loaf |\n|--------------|-----------------|---------------|------------------------------|\n| Whole Wheat  | $2              | 0.5 hours     | $1                           |\n| Rye          | $3              | 0.7 hours     | $1.50                        |\n| Sourdough    | $2.50           | 0.6 hours     | $1.20                        |\n| Brioche      | $4              | 1 hour        | $2                           |\n\nThe bakery has a total of 1000 hours of labor available per week. The bakery has a budget of $5000 for ingredients per week. The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations. The bakery has a storage capacity limit of 2000 loaves.\n\nPlease help the bakery to maximize the total profit from selling these bread types by determining the optimal number of loaves to produce for each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients per week.\nmodel.addCons(WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\nmodel.addCons(WholeWheat >= 500)\n## The bakery has a storage capacity limit of 2000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints.\n// {\"number of Whole Wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"continuous\"}\n// {\"number of Rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"number of Sourdough loaves\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"number of Brioche loaves\": \"Brioche\", \"range\": \"Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery wants to maximize the total profit from selling these bread types.\n// Objective Function: Maximize: 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per week. It takes 0.5 hours to make a loaf of Whole Wheat, 0.7 hours for Rye, 0.6 hours for Sourdough, and 1 hour for Brioche.\n// 0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery has a budget of $5000 for ingredients per week. The cost of ingredients for a loaf of Whole Wheat is $1, for Rye is $1.50, for Sourdough is $1.20, and for Brioche is $2.\n// WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\n// WholeWheat >= 500\n\n## Generate Constraint-4:\nThe bakery has a storage capacity limit of 2000 loaves.\n// WholeWheat + Rye + Sourdough + Brioche <= 2000",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while meeting certain constraints. The profit per loaf for Whole Wheat is $2, the profit per loaf for Rye is $3, the profit per loaf for Sourdough is $2.50, and the profit per loaf for Brioche is $4. The bakery has a total of 1000 hours of labor available per week, with varying time requirements for each bread type. The bakery also has a budget of $5000 for ingredients per week and must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations. Additionally, the bakery has a storage capacity limit of 2000 loaves. Please help the bakery maximize the total profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves to produce for each type of bread\nWholeWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"WholeWheat\", lb=0) # number of Whole Wheat loaves\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # number of Rye loaves\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # number of Sourdough loaves\nBrioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Brioche\", lb=0) # number of Brioche loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WholeWheat + 3*Rye + 2.5*Sourdough + 4*Brioche)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per week.\nmodel.addCons(0.5*WholeWheat + 0.7*Rye + 0.6*Sourdough + 1*Brioche <= 1000)\n## The bakery has a budget of $5000 for ingredients per week.\nmodel.addCons(WholeWheat + 1.5*Rye + 1.2*Sourdough + 2*Brioche <= 5000)\n## The bakery must produce at least 500 loaves of Whole Wheat bread per week to meet contractual obligations.\nmodel.addCons(WholeWheat >= 500)\n## The bakery has a storage capacity limit of 2000 loaves.\nmodel.addCons(WholeWheat + Rye + Sourdough + Brioche <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye loaves: \", model.getVal(Rye))\n    print(\"Number of Sourdough loaves: \", model.getVal(Sourdough))\n    print(\"Number of Brioche loaves: \", model.getVal(Brioche))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"Q_WW\", \"range\": \"Q_WW >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Q_Rye\", \"range\": \"Q_Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Q_Sourdough\", \"range\": \"Q_Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Brioche bread\": \"Q_Brioche\", \"range\": \"Q_Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche.\n// 0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints.\n// Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\n// Q_WW >= 500\n\n## Generate Constraint-4:\nThe bakery has a maximum daily demand for Brioche bread of 300 loaves due to market saturation.\n// Q_Brioche <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for each type of bread is as follows:\n\n| Bread Type     | Profit per Loaf |\n|----------------|-----------------|\n| Whole Wheat    | $1.50           |\n| Rye            | $2.00           |\n| Sourdough      | $2.50           |\n| Brioche        | $3.00           |\n\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche. The bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints. The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves and a maximum daily demand for Brioche bread of 300 loaves due to market saturation.\n\nPlease help the bakery to maximize the total daily profit from selling these bread types while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nQ_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_WW\", lb=0) # daily production quantity of Whole Wheat bread\nQ_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Rye\", lb=0) # daily production quantity of Rye bread\nQ_Sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Sourdough\", lb=0) # daily production quantity of Sourdough bread\nQ_Brioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Brioche\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 1000 kg.\nmodel.addCons(0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000)\n## The bakery can produce a maximum of 2000 loaves per day.\nmodel.addCons(Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000)\n## The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\nmodel.addCons(Q_WW >= 500)\n## The bakery has a maximum daily demand for Brioche bread of 300 loaves.\nmodel.addCons(Q_Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Q_WW))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Q_Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Q_Sourdough))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(Q_Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints.\n// {\"daily production quantity of Whole Wheat bread\": \"Q_WW\", \"range\": \"Q_WW >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"Q_Rye\", \"range\": \"Q_Rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"Q_Sourdough\", \"range\": \"Q_Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Brioche bread\": \"Q_Brioche\", \"range\": \"Q_Brioche >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery wants to maximize the total daily profit from selling these bread types.\n// Objective Function: Maximize: 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche\n\n## Generate Constraint-1:\nThe bakery has a daily flour supply limit of 1000 kg. The flour requirement per loaf is 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche.\n// 0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints.\n// Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\n// Q_WW >= 500\n\n## Generate Constraint-4:\nThe bakery has a maximum daily demand for Brioche bread of 300 loaves due to market saturation.\n// Q_Brioche <= 300",
        "question": "A bakery wants to optimize the production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while meeting customer demand and resource constraints. The profit per loaf for Whole Wheat is $1.50, for Rye is $2.00, for Sourdough is $2.50, and for Brioche is $3.00. The bakery has a daily flour supply limit of 1000 kg, with flour requirements per loaf of 0.5 kg for Whole Wheat, 0.6 kg for Rye, 0.4 kg for Sourdough, and 0.7 kg for Brioche. The bakery can produce a maximum of 2000 loaves per day due to oven capacity and labor constraints. The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves and a maximum daily demand for Brioche bread of 300 loaves due to market saturation. Please help the bakery to maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nQ_WW = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_WW\", lb=0) # daily production quantity of Whole Wheat bread\nQ_Rye = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Rye\", lb=0) # daily production quantity of Rye bread\nQ_Sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Sourdough\", lb=0) # daily production quantity of Sourdough bread\nQ_Brioche = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_Brioche\", lb=0) # daily production quantity of Brioche bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Q_WW + 2.00*Q_Rye + 2.50*Q_Sourdough + 3.00*Q_Brioche)\n\n# Add constraints\n## The bakery has a daily flour supply limit of 1000 kg.\nmodel.addCons(0.5*Q_WW + 0.6*Q_Rye + 0.4*Q_Sourdough + 0.7*Q_Brioche <= 1000)\n## The bakery can produce a maximum of 2000 loaves per day.\nmodel.addCons(Q_WW + Q_Rye + Q_Sourdough + Q_Brioche <= 2000)\n## The bakery has a minimum daily demand for Whole Wheat bread of 500 loaves.\nmodel.addCons(Q_WW >= 500)\n## The bakery has a maximum daily demand for Brioche bread of 300 loaves.\nmodel.addCons(Q_Brioche <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Whole Wheat bread: \", model.getVal(Q_WW))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(Q_Rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(Q_Sourdough))\n    print(\"Daily production quantity of Brioche bread: \", model.getVal(Q_Brioche))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"Whole_Grain_Loaves\", \"range\": \"Whole_Grain_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\n// 0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\n// 0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the total bread production is wheat bread.\n// Wheat_Loaves >= 0.2 * (Wheat_Loaves + Rye_Loaves + Whole_Grain_Loaves + Sourdough_Loaves)",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $2.5            |\n| Whole Grain   | $3              |\n| Sourdough     | $3.5            |\n\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\n\nThe bakery also has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\n\nAdditionally, the bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\n\nThe bakery wants to ensure that at least 20% of the total bread production is wheat bread.\n\nPlease help the bakery to maximize the total profit from selling all types of bread while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nWhole_Grain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Grain_Loaves\", lb=0) # number of loaves of whole grain bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200)\n## The bakery wants to ensure that at least 20% of the total bread production is wheat bread.\nmodel.addCons(Wheat_Loaves >= 0.2 * (Wheat_Loaves + Rye_Loaves + Whole_Grain_Loaves + Sourdough_Loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(Whole_Grain_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1767,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of loaves of wheat bread\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of rye bread\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of whole grain bread\": \"Whole_Grain_Loaves\", \"range\": \"Whole_Grain_Loaves >= 0\", \"type\": \"continuous\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough_Loaves\", \"range\": \"Sourdough_Loaves >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery wants to maximize the total profit from selling all types of bread.\n// Objective Function: Maximize: 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\n// 0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15\n\n## Generate Constraint-3:\nThe bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\n// 0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 20% of the total bread production is wheat bread.\n// Wheat_Loaves >= 0.2 * (Wheat_Loaves + Rye_Loaves + Whole_Grain_Loaves + Sourdough_Loaves)",
        "question": "A bakery wants to optimize the production of four types of bread: wheat, rye, whole grain, and sourdough. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of ingredients and labor.\nThe profit per loaf for wheat bread is $2, the profit per loaf for rye bread is $2.5, the profit per loaf for whole grain bread is $3, and the profit per loaf for sourdough bread is $3.5.\nThe bakery has a limited amount of flour available. Each loaf of wheat bread requires 0.5 kg of flour, each loaf of rye bread requires 0.6 kg of flour, each loaf of whole grain bread requires 0.7 kg of flour, and each loaf of sourdough bread requires 0.8 kg of flour. The total amount of flour available is 1000 kg.\nThe bakery also has a limited amount of yeast available. Each loaf of wheat bread requires 0.01 kg of yeast, each loaf of rye bread requires 0.015 kg of yeast, each loaf of whole grain bread requires 0.02 kg of yeast, and each loaf of sourdough bread requires 0.025 kg of yeast. The total amount of yeast available is 15 kg.\nAdditionally, the bakery has a limited amount of labor hours. Each loaf of wheat bread requires 0.2 hours of labor, each loaf of rye bread requires 0.25 hours of labor, each loaf of whole grain bread requires 0.3 hours of labor, and each loaf of sourdough bread requires 0.35 hours of labor. The total labor hours available are 200 hours.\nThe bakery wants to ensure that at least 20% of the total bread production is wheat bread.\nPlease help the bakery to maximize the total profit from selling all types of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat_Loaves\", lb=0) # number of loaves of wheat bread\nRye_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye_Loaves\", lb=0) # number of loaves of rye bread\nWhole_Grain_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Grain_Loaves\", lb=0) # number of loaves of whole grain bread\nSourdough_Loaves = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough_Loaves\", lb=0) # number of loaves of sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 2.5*Rye_Loaves + 3*Whole_Grain_Loaves + 3.5*Sourdough_Loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves + 0.7*Whole_Grain_Loaves + 0.8*Sourdough_Loaves <= 1000)\n## The bakery has a limited amount of yeast available.\nmodel.addCons(0.01*Wheat_Loaves + 0.015*Rye_Loaves + 0.02*Whole_Grain_Loaves + 0.025*Sourdough_Loaves <= 15)\n## The bakery has a limited amount of labor hours.\nmodel.addCons(0.2*Wheat_Loaves + 0.25*Rye_Loaves + 0.3*Whole_Grain_Loaves + 0.35*Sourdough_Loaves <= 200)\n## The bakery wants to ensure that at least 20% of the total bread production is wheat bread.\nmodel.addCons(Wheat_Loaves >= 0.2 * (Wheat_Loaves + Rye_Loaves + Whole_Grain_Loaves + Sourdough_Loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Loaves))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Loaves))\n    print(\"Number of loaves of whole grain bread: \", model.getVal(Whole_Grain_Loaves))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough_Loaves))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1621,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"ingredient cost in dollars\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases.\n// 1*Wheat_Loaves + 1.5*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye.\n// Wheat_Loaves + Rye_Loaves >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 100 loaves of rye bread daily.\n// Rye_Loaves <= 100",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Loaf | Ingredient Cost per Loaf |\n|------------|--------------------|--------------------------|\n| Wheat      | 0.5 hours          | $1                       |\n| Rye        | 0.6 hours          | $1.50                    |\n\nThe bakery has a total of 8 hours of oven time available daily and a budget of $100 for daily ingredient purchases. The bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye. Additionally, the bakery should not produce more than 100 loaves of rye bread daily.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of wheat bread loaves and rye bread loaves\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven time and ingredient cost\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven time in hours\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # ingredient cost in dollars\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves == Oven_Time)\n## The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50.\nmodel.addCons(1*Wheat_Loaves + 1.5*Rye_Loaves == Ingredient_Cost)\n## The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(Oven_Time <= 8)\n## The bakery has a budget of $100 for daily ingredient purchases.\nmodel.addCons(Ingredient_Cost <= 100)\n## The bakery has a minimum daily production requirement of 50 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n## The bakery should not produce more than 100 loaves of rye bread daily.\nmodel.addCons(Rye_Loaves <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Oven Time used: \", model.getVal(Oven_Time))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints.\n// {\"number of wheat bread loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"ingredient cost in dollars\": \"Ingredient_Cost\", \"range\": \"Ingredient_Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost\n\n## Generate Constraint-1:\nEach wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 8\n\n## Generate Constraint-2:\nThe cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases.\n// 1*Wheat_Loaves + 1.5*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye.\n// Wheat_Loaves + Rye_Loaves >= 50\n\n## Generate Constraint-4:\nThe bakery should not produce more than 100 loaves of rye bread daily.\n// Rye_Loaves <= 100",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide on the optimal daily production quantities of each type of bread to maximize profit while considering the available resources such as oven time and ingredient constraints. The profit per wheat bread loaf is $3, and the profit per rye bread loaf is $4. Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time. The bakery has a total of 8 hours of oven time available daily. The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50. The bakery has a budget of $100 for daily ingredient purchases. The bakery has a minimum daily production requirement of 50 loaves of bread, which can be either wheat or rye. The bakery should not produce more than 100 loaves of rye bread daily. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of wheat bread loaves and rye bread loaves\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat bread loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye bread loaves\n## Oven time and ingredient cost\nOven_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Oven_Time\", lb=0) # oven time in hours\nIngredient_Cost = model.addVar(vtype=\"CONTINUOUS\", name=\"Ingredient_Cost\", lb=0) # ingredient cost in dollars\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat_Loaves + 4*Rye_Loaves - Ingredient_Cost)\n\n# Add constraints\n## Each wheat bread loaf requires 0.5 hours of oven time, and each rye bread loaf requires 0.6 hours of oven time.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves == Oven_Time)\n## The cost of ingredients for each wheat bread loaf is $1, and for each rye bread loaf is $1.50.\nmodel.addCons(1*Wheat_Loaves + 1.5*Rye_Loaves == Ingredient_Cost)\n## The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(Oven_Time <= 8)\n## The bakery has a budget of $100 for daily ingredient purchases.\nmodel.addCons(Ingredient_Cost <= 100)\n## The bakery has a minimum daily production requirement of 50 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 50)\n## The bakery should not produce more than 100 loaves of rye bread daily.\nmodel.addCons(Rye_Loaves <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye_Loaves))\n    print(\"Oven Time used: \", model.getVal(Oven_Time))\n    print(\"Ingredient Cost: \", model.getVal(Ingredient_Cost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cupcakes\": \"Chocolate_Cupcakes\", \"range\": \"Chocolate_Cupcakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The bakery aims to maximize its daily profit from selling cakes and cupcakes.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes\n\n## Generate Constraint-1:\nEach cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100\n\n## Generate Constraint-2:\nEach cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\n// 4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 10\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats.\n// Chocolate_Cupcakes >= 2*(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes)",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry, and also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The following table summarizes the labor and oven space requirements for each product:\n\n| Product             | Profit per Unit | Labor Hours per Unit | Oven Space per Unit |\n|---------------------|-----------------|----------------------|---------------------|\n| Chocolate Cake      | $10             | 2 hours              | 4 square feet       |\n| Vanilla Cake        | $8              | 2 hours              | 4 square feet       |\n| Strawberry Cake     | $9              | 2 hours              | 4 square feet       |\n| Chocolate Cupcake   | $3              | 1 hour               | 1 square foot       |\n\nThe bakery has a total of 100 labor hours and 80 square feet of oven space available daily. The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations. Additionally, the bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats.\n\nPlease help the bakery to maximize its daily profit from selling cakes and cupcakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and cupcake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes\nChocolate_Cupcakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cupcakes\", lb=0) # number of chocolate cupcakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes)\n\n# Add constraints\n## Each cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100)\n## Each cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\nmodel.addCons(4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80)\n## The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 10)\n## The bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats.\nmodel.addCons(Chocolate_Cupcakes >= 2*(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of chocolate cupcakes: \", model.getVal(Chocolate_Cupcakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1478,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry. The bakery also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space.\n// {\"number of chocolate cakes\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of chocolate cupcakes\": \"Chocolate_Cupcakes\", \"range\": \"Chocolate_Cupcakes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. The bakery aims to maximize its daily profit from selling cakes and cupcakes.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes\n\n## Generate Constraint-1:\nEach cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\n// 2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100\n\n## Generate Constraint-2:\nEach cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\n// 4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\n// Chocolate_Cakes >= 5\n// Vanilla_Cakes >= 10\n\n## Generate Constraint-4:\nThe bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats.\n// Chocolate_Cupcakes >= 2*(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes)",
        "question": "A bakery specializes in making three types of cakes: chocolate, vanilla, and strawberry, and also produces cupcakes in the same flavors. The manager needs to determine the optimal number of each type of cake and cupcake to produce daily to maximize profit while considering the limited resources such as labor hours and oven space. The profit per chocolate cake is $10, per vanilla cake is $8, per strawberry cake is $9, and per chocolate cupcake is $3. Each cake requires 2 hours of labor and 4 square feet of oven space, while each cupcake requires 1 hour of labor and 1 square foot of oven space. The bakery has a total of 100 labor hours and 80 square feet of oven space available daily. The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations. Additionally, the bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats. Please help the bakery maximize its daily profit from selling cakes and cupcakes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake and cupcake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes\nChocolate_Cupcakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cupcakes\", lb=0) # number of chocolate cupcakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes + 3*Chocolate_Cupcakes)\n\n# Add constraints\n## Each cake requires 2 hours of labor, and each cupcake requires 1 hour of labor. The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 100)\n## Each cake requires 4 square feet of oven space, and each cupcake requires 1 square foot of oven space. The bakery has a total of 80 square feet of oven space available daily.\nmodel.addCons(4*Chocolate_Cakes + 4*Vanilla_Cakes + 4*Strawberry_Cakes + 1*Chocolate_Cupcakes <= 80)\n## The bakery must produce at least 5 chocolate cakes and 10 vanilla cakes daily to meet contractual obligations.\nmodel.addCons(Chocolate_Cakes >= 5)\nmodel.addCons(Vanilla_Cakes >= 10)\n## The bakery aims to produce at least twice as many cupcakes as cakes to cater to the demand for smaller treats.\nmodel.addCons(Chocolate_Cupcakes >= 2*(Chocolate_Cakes + Vanilla_Cakes + Strawberry_Cakes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of chocolate cupcakes: \", model.getVal(Chocolate_Cupcakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Whole Wheat breads\": \"W\", \"range\": \"0 <= W\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"R\", \"range\": \"0 <= R\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"S\", \"range\": \"0 <= S\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"B\", \"range\": \"0 <= B\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 2.75*S + 4.00*B\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of baking time available daily. Each Whole Wheat, Rye, Sourdough, and Brioche loaf requires 1.5, 2, 1.25, and 3 hours respectively to bake.\n// 1.5*W + 2*R + 1.25*S + 3*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Whole Wheat, Rye, Sourdough, and Brioche require 0.5, 0.75, 0.6, and 1.2 pounds of flour per loaf respectively. The total flour available is 80 pounds.\n// 0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\n// W >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\n// W <= 60\n// R <= 60\n// S <= 60\n// B <= 60",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery has a total of 100 hours of baking time available daily, and the required baking time for each type of bread is as follows:\n\n| Bread Type    | Profit per Loaf | Baking Time per Loaf |\n|---------------|-----------------|----------------------|\n| Whole Wheat   | $2.50           | 1.5 hours            |\n| Rye           | $3.00           | 2 hours              |\n| Sourdough     | $2.75           | 1.25 hours           |\n| Brioche       | $4.00           | 3 hours              |\n\nThe bakery has a limited supply of flour and yeast, with a total of 80 pounds available. The required amount of flour for each type of bread is as follows:\n\n| Bread Type    | Flour Required per Loaf |\n|---------------|-------------------------|\n| Whole Wheat   | 0.5 pounds              |\n| Rye           | 0.75 pounds             |\n| Sourdough     | 0.6 pounds              |\n| Brioche       | 1.2 pounds              |\n\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily. Additionally, the bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\n\nPlease help the bakery to maximize its daily profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of Whole Wheat breads\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Rye breads\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sourdough breads\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 2.75*S + 4.00*B)\n\n# Add constraints\n## The bakery has a total of 100 hours of baking time available daily.\nmodel.addCons(1.5*W + 2*R + 1.25*S + 3*B <= 100)\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80)\n## The bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\nmodel.addCons(W >= 50)\n## The bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\nmodel.addCons(W <= 60)\nmodel.addCons(R <= 60)\nmodel.addCons(S <= 60)\nmodel.addCons(B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(W))\n    print(\"Number of Rye breads: \", model.getVal(R))\n    print(\"Number of Sourdough breads: \", model.getVal(S))\n    print(\"Number of Brioche breads: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1627,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily.\n// {\"number of Whole Wheat breads\": \"W\", \"range\": \"0 <= W\", \"type\": \"integer\"}\n// {\"number of Rye breads\": \"R\", \"range\": \"0 <= R\", \"type\": \"integer\"}\n// {\"number of Sourdough breads\": \"S\", \"range\": \"0 <= S\", \"type\": \"integer\"}\n// {\"number of Brioche breads\": \"B\", \"range\": \"0 <= B\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 2.50*W + 3.00*R + 2.75*S + 4.00*B\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of baking time available daily. Each Whole Wheat, Rye, Sourdough, and Brioche loaf requires 1.5, 2, 1.25, and 3 hours respectively to bake.\n// 1.5*W + 2*R + 1.25*S + 3*B <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of flour and yeast. Whole Wheat, Rye, Sourdough, and Brioche require 0.5, 0.75, 0.6, and 1.2 pounds of flour per loaf respectively. The total flour available is 80 pounds.\n// 0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80\n\n## Generate Constraint-3:\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\n// W >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\n// W <= 60\n// R <= 60\n// S <= 60\n// B <= 60",
        "question": "A bakery wants to optimize its daily production of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. Each type of bread requires different amounts of ingredients and time to bake. The bakery needs to determine the optimal number of each type of bread to produce daily.\nThe profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2.50, $3.00, $2.75, and $4.00 respectively. The bakery wants to maximize its daily profit.\nThe bakery has a total of 100 hours of baking time available daily. Each Whole Wheat, Rye, Sourdough, and Brioche loaf requires 1.5, 2, 1.25, and 3 hours respectively to bake.\nThe bakery has a limited supply of flour and yeast. Whole Wheat, Rye, Sourdough, and Brioche require 0.5, 0.75, 0.6, and 1.2 pounds of flour per loaf respectively. The total flour available is 80 pounds.\nThe bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\nThe bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\nPlease help the bakery to determine the optimal number of each type of bread to produce daily to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of Whole Wheat breads\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Rye breads\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sourdough breads\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Brioche breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*W + 3.00*R + 2.75*S + 4.00*B)\n\n# Add constraints\n## The bakery has a total of 100 hours of baking time available daily.\nmodel.addCons(1.5*W + 2*R + 1.25*S + 3*B <= 100)\n## The bakery has a limited supply of flour and yeast.\nmodel.addCons(0.5*W + 0.75*R + 0.6*S + 1.2*B <= 80)\n## The bakery has a demand for at least 50 loaves of Whole Wheat bread daily.\nmodel.addCons(W >= 50)\n## The bakery wants to ensure a balanced variety of breads, so it sets a limit of producing no more than 60 loaves of any single type of bread.\nmodel.addCons(W <= 60)\nmodel.addCons(R <= 60)\nmodel.addCons(S <= 60)\nmodel.addCons(B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat breads: \", model.getVal(W))\n    print(\"Number of Rye breads: \", model.getVal(R))\n    print(\"Number of Sourdough breads: \", model.getVal(S))\n    print(\"Number of Brioche breads: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type.\n// {\"daily production quantity of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 1500\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 800\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 3000 kilograms of flour available daily. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000\n\n## Generate Constraint-2:\nThe bakery can produce at most 2500 loaves of bread in total daily.\n// B1 + B2 + B3 + B4 <= 2500\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\n// B1 >= 500\n\n## Generate Constraint-4:\nDue to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily.\n// B2 <= 1000",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The following table summarizes the flour requirements per loaf for each bread type:\n\n| Bread Type | Profit per Loaf | Flour Requirement per Loaf |\n|------------|-----------------|----------------------------|\n| Bread 1    | $1.50           | 0.5 kg                     |\n| Bread 2    | $2.00           | 0.4 kg                     |\n| Bread 3    | $1.80           | 0.6 kg                     |\n| Bread 4    | $2.20           | 0.3 kg                     |\n\nThe bakery has a total of 3000 kilograms of flour available daily. The bakery can produce at most 2500 loaves of bread in total daily. The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation. Due to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily. Please help the bakery to maximize the total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each bread type\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # daily production quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500) # daily production quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=800) # daily production quantity of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=1200) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4)\n\n# Add constraints\n## The bakery has a total of 3000 kilograms of flour available daily.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000)\n## The bakery can produce at most 2500 loaves of bread in total daily.\nmodel.addCons(B1 + B2 + B3 + B4 <= 2500)\n## The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\nmodel.addCons(B1 >= 500)\n## Due to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily.\nmodel.addCons(B2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(B1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(B2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(B3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type.\n// {\"daily production quantity of Bread 1\": \"B1\", \"range\": \"0 <= B1 <= 1000\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 2\": \"B2\", \"range\": \"0 <= B2 <= 1500\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 3\": \"B3\", \"range\": \"0 <= B3 <= 800\", \"type\": \"integer\"}\n// {\"daily production quantity of Bread 4\": \"B4\", \"range\": \"0 <= B4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize the total daily profit from bread sales.\n// Objective Function: Maximize: 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4\n\n## Generate Constraint-1:\nThe bakery has a total of 3000 kilograms of flour available daily. Each loaf of Bread 1-4 requires 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively.\n// 0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000\n\n## Generate Constraint-2:\nThe bakery can produce at most 2500 loaves of bread in total daily.\n// B1 + B2 + B3 + B4 <= 2500\n\n## Generate Constraint-3:\nThe bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\n// B1 >= 500\n\n## Generate Constraint-4:\nDue to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily.\n// B2 <= 1000",
        "question": "A bakery wants to optimize the production of four types of bread (Bread 1-4) to maximize profit while meeting customer demand and resource constraints. The bakery needs to determine the daily production quantity of each bread type. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery has a total of 3000 kilograms of flour available daily, with each loaf of Bread 1-4 requiring 0.5 kg, 0.4 kg, 0.6 kg, and 0.3 kg of flour respectively. The bakery can produce at most 2500 loaves of bread in total daily. The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation. Due to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily. Please help the bakery to maximize the total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each bread type\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1000) # daily production quantity of Bread 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500) # daily production quantity of Bread 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=800) # daily production quantity of Bread 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=1200) # daily production quantity of Bread 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*B1 + 2.00*B2 + 1.80*B3 + 2.20*B4)\n\n# Add constraints\n## The bakery has a total of 3000 kilograms of flour available daily.\nmodel.addCons(0.5*B1 + 0.4*B2 + 0.6*B3 + 0.3*B4 <= 3000)\n## The bakery can produce at most 2500 loaves of bread in total daily.\nmodel.addCons(B1 + B2 + B3 + B4 <= 2500)\n## The bakery must produce at least 500 loaves of Bread 1 to meet a contract obligation.\nmodel.addCons(B1 >= 500)\n## Due to oven capacity, the bakery can only bake up to 1000 loaves of Bread 2 daily.\nmodel.addCons(B2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Bread 1: \", model.getVal(B1))\n    print(\"Daily production quantity of Bread 2: \", model.getVal(B2))\n    print(\"Daily production quantity of Bread 3: \", model.getVal(B3))\n    print(\"Daily production quantity of Bread 4: \", model.getVal(B4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily.\n// {\"amount of Bread 1 to produce\": \"b1\", \"range\": \"0 <= b1 <= 1000\", \"type\": \"integer\"}\n// {\"amount of Bread 2 to produce\": \"b2\", \"range\": \"0 <= b2 <= 1500\", \"type\": \"integer\"}\n// {\"amount of Bread 3 to produce\": \"b3\", \"range\": \"0 <= b3 <= 800\", \"type\": \"integer\"}\n// {\"amount of Bread 4 to produce\": \"b4\", \"range\": \"0 <= b4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4\n\n## Generate Constraint-1:\nThe total daily production capacity of the bakery is 3000 loaves.\n// b1 + b2 + b3 + b4 <= 3000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\n// 10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000\n\n## Generate Constraint-3:\nThe cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\n// 0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000\n\n## Generate Constraint-4:\nThe bakery must produce at least 500 loaves of Bread 1.\n// b1 >= 500",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily. The profit per loaf and the cost of ingredients per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost of Ingredients per Loaf |\n|------------|-----------------|------------------------------|\n| Bread 1    | $1.50           | $0.50                        |\n| Bread 2    | $2.00           | $0.70                        |\n| Bread 3    | $1.80           | $0.60                        |\n| Bread 4    | $2.20           | $0.80                        |\n\nThe bakery has a total daily production capacity of 3000 loaves. Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g. The bakery has a daily budget of $2000 for ingredients. The bakery must also produce at least 500 loaves of Bread 1.\n\nPlease help the bakery to maximize its daily profit by determining the optimal amount of each type of bread to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0, ub=1000) # amount of Bread 1 to produce\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0, ub=1500) # amount of Bread 2 to produce\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0, ub=800) # amount of Bread 3 to produce\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0, ub=1200) # amount of Bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4)\n\n# Add constraints\n## The total daily production capacity of the bakery is 3000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 3000)\n## The bakery must ensure that the total daily fiber content is at least 40,000g.\nmodel.addCons(10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000)\n## The bakery has a daily budget of $2000 for ingredients.\nmodel.addCons(0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000)\n## The bakery must produce at least 500 loaves of Bread 1.\nmodel.addCons(b1 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 to produce: \", model.getVal(b1))\n    print(\"Amount of Bread 2 to produce: \", model.getVal(b2))\n    print(\"Amount of Bread 3 to produce: \", model.getVal(b3))\n    print(\"Amount of Bread 4 to produce: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily.\n// {\"amount of Bread 1 to produce\": \"b1\", \"range\": \"0 <= b1 <= 1000\", \"type\": \"integer\"}\n// {\"amount of Bread 2 to produce\": \"b2\", \"range\": \"0 <= b2 <= 1500\", \"type\": \"integer\"}\n// {\"amount of Bread 3 to produce\": \"b3\", \"range\": \"0 <= b3 <= 800\", \"type\": \"integer\"}\n// {\"amount of Bread 4 to produce\": \"b4\", \"range\": \"0 <= b4 <= 1200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4\n\n## Generate Constraint-1:\nThe total daily production capacity of the bakery is 3000 loaves.\n// b1 + b2 + b3 + b4 <= 3000\n\n## Generate Constraint-2:\nEach loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively. The bakery must ensure that the total daily fiber content is at least 40,000g.\n// 10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000\n\n## Generate Constraint-3:\nThe cost of ingredients per loaf for Bread 1-4 is $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a daily budget of $2000 for ingredients.\n// 0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000\n\n## Generate Constraint-4:\nThe bakery must produce at least 500 loaves of Bread 1.\n// b1 >= 500",
        "question": "A bakery wants to produce four types of bread (Bread 1-4) to maximize its profit while considering the cost of ingredients and the nutritional content required by health regulations. The bakery needs to determine the amount of each type of bread to produce daily. The profit per loaf for Bread 1-4 is $1.50, $2.00, $1.80, and $2.20 respectively. The bakery has a daily budget of $2000 for ingredients. The total daily production capacity of the bakery is 3000 loaves. Each loaf of Bread 1-4 contains 10g, 15g, 20g, and 12g of fiber respectively, and the bakery must ensure that the total daily fiber content is at least 40,000g. The bakery must also produce at least 500 loaves of Bread 1. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce daily\nb1 = model.addVar(vtype=\"INTEGER\", name=\"b1\", lb=0, ub=1000) # amount of Bread 1 to produce\nb2 = model.addVar(vtype=\"INTEGER\", name=\"b2\", lb=0, ub=1500) # amount of Bread 2 to produce\nb3 = model.addVar(vtype=\"INTEGER\", name=\"b3\", lb=0, ub=800) # amount of Bread 3 to produce\nb4 = model.addVar(vtype=\"INTEGER\", name=\"b4\", lb=0, ub=1200) # amount of Bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*b1 + 2.00*b2 + 1.80*b3 + 2.20*b4)\n\n# Add constraints\n## The total daily production capacity of the bakery is 3000 loaves.\nmodel.addCons(b1 + b2 + b3 + b4 <= 3000)\n## The bakery must ensure that the total daily fiber content is at least 40,000g.\nmodel.addCons(10*b1 + 15*b2 + 20*b3 + 12*b4 >= 40000)\n## The bakery has a daily budget of $2000 for ingredients.\nmodel.addCons(0.50*b1 + 0.70*b2 + 0.60*b3 + 0.80*b4 <= 2000)\n## The bakery must produce at least 500 loaves of Bread 1.\nmodel.addCons(b1 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Bread 1 to produce: \", model.getVal(b1))\n    print(\"Amount of Bread 2 to produce: \", model.getVal(b2))\n    print(\"Amount of Bread 3 to produce: \", model.getVal(b3))\n    print(\"Amount of Bread 4 to produce: \", model.getVal(b4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 742,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints.\n// {\"amount of Whole Wheat bread to produce\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye bread to produce\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Sourdough bread to produce\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"amount of Croissants to produce\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 units.\n// Whole_Wheat + Rye + Sourdough + Croissant <= 1000\n\n## Generate Constraint-2:\nEach type of bread must contribute at least 20% of the total bread production (excluding pastries).\n// Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Whole Wheat bread daily.\n// Whole_Wheat >= 100\n\n## Generate Constraint-4:\nThe total amount of carbohydrates in the products should not exceed 3000 grams. The carbohydrate content per unit of Whole Wheat, Rye, Sourdough, and Croissant is 50, 40, 30, and 60 grams, respectively.\n// 50*Whole_Wheat + 40*Rye + 30*Sourdough + 60*Croissant <= 3000",
        "question": "A bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints. The profit per unit and the carbohydrate content for each product are given in the following Table.\n\n| Product       | Profit per Unit | Carbohydrate Content per Unit |\n|---------------|-----------------|-------------------------------|\n| Whole Wheat   | $2              | 50 grams                      |\n| Rye           | $3              | 40 grams                      |\n| Sourdough     | $2.5            | 30 grams                      |\n| Croissant     | $1.5            | 60 grams                      |\n\nThe bakery has a daily production capacity of 1000 units. Each type of bread must contribute at least 20% of the total bread production (excluding pastries). The bakery must produce at least 100 units of Whole Wheat bread daily. The total amount of carbohydrates in the products should not exceed 3000 grams.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal amount of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry to produce\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # amount of Whole Wheat bread to produce\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye bread to produce\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # amount of Sourdough bread to produce\nCroissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissant\", lb=0) # amount of Croissants to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 units.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Croissant <= 1000)\n## Each type of bread must contribute at least 20% of the total bread production (excluding pastries).\nmodel.addCons(Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough))\n## The bakery must produce at least 100 units of Whole Wheat bread daily.\nmodel.addCons(Whole_Wheat >= 100)\n## The total amount of carbohydrates in the products should not exceed 3000 grams.\nmodel.addCons(50*Whole_Wheat + 40*Rye + 30*Sourdough + 60*Croissant <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat bread to produce: \", model.getVal(Whole_Wheat))\n    print(\"Amount of Rye bread to produce: \", model.getVal(Rye))\n    print(\"Amount of Sourdough bread to produce: \", model.getVal(Sourdough))\n    print(\"Amount of Croissants to produce: \", model.getVal(Croissant))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints.\n// {\"amount of Whole Wheat bread to produce\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"amount of Rye bread to produce\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"continuous\"}\n// {\"amount of Sourdough bread to produce\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"continuous\"}\n// {\"amount of Croissants to produce\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 1000 units.\n// Whole_Wheat + Rye + Sourdough + Croissant <= 1000\n\n## Generate Constraint-2:\nEach type of bread must contribute at least 20% of the total bread production (excluding pastries).\n// Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n// Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough)\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of Whole Wheat bread daily.\n// Whole_Wheat >= 100\n\n## Generate Constraint-4:\nThe total amount of carbohydrates in the products should not exceed 3000 grams. The carbohydrate content per unit of Whole Wheat, Rye, Sourdough, and Croissant is 50, 40, 30, and 60 grams, respectively.\n// 50*Whole_Wheat + 40*Rye + 30*Sourdough + 60*Croissant <= 3000",
        "question": "A bakery wants to optimize the production of three types of bread (Whole Wheat, Rye, and Sourdough) and one type of pastry (Croissant) to maximize profit while meeting certain nutritional and production constraints. The profit per unit of Whole Wheat, Rye, Sourdough, and Croissant is $2, $3, $2.5, and $1.5, respectively. The bakery has a daily production capacity of 1000 units. Each type of bread must contribute at least 20% of the total bread production (excluding pastries). The bakery must produce at least 100 units of Whole Wheat bread daily. The total amount of carbohydrates in the products should not exceed 3000 grams, with the carbohydrate content per unit of Whole Wheat, Rye, Sourdough, and Croissant being 50, 40, 30, and 60 grams, respectively. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread and pastry to produce\nWhole_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Whole_Wheat\", lb=0) # amount of Whole Wheat bread to produce\nRye = model.addVar(vtype=\"CONTINUOUS\", name=\"Rye\", lb=0) # amount of Rye bread to produce\nSourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"Sourdough\", lb=0) # amount of Sourdough bread to produce\nCroissant = model.addVar(vtype=\"CONTINUOUS\", name=\"Croissant\", lb=0) # amount of Croissants to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye + 2.5*Sourdough + 1.5*Croissant)\n\n# Add constraints\n## The bakery has a daily production capacity of 1000 units.\nmodel.addCons(Whole_Wheat + Rye + Sourdough + Croissant <= 1000)\n## Each type of bread must contribute at least 20% of the total bread production (excluding pastries).\nmodel.addCons(Whole_Wheat >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Rye >= 0.2 * (Whole_Wheat + Rye + Sourdough))\nmodel.addCons(Sourdough >= 0.2 * (Whole_Wheat + Rye + Sourdough))\n## The bakery must produce at least 100 units of Whole Wheat bread daily.\nmodel.addCons(Whole_Wheat >= 100)\n## The total amount of carbohydrates in the products should not exceed 3000 grams.\nmodel.addCons(50*Whole_Wheat + 40*Rye + 30*Sourdough + 60*Croissant <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Whole Wheat bread to produce: \", model.getVal(Whole_Wheat))\n    print(\"Amount of Rye bread to produce: \", model.getVal(Rye))\n    print(\"Amount of Sourdough bread to produce: \", model.getVal(Sourdough))\n    print(\"Amount of Croissants to produce: \", model.getVal(Croissant))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"q_wheat\", \"range\": \"q_wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"q_rye\", \"range\": \"q_rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"q_sourdough\", \"range\": \"q_sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Whole Grain bread\": \"q_whole_grain\", \"range\": \"q_whole_grain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily revenue.\n// Objective Function: Maximize: 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\n// q_wheat + q_rye + q_sourdough + q_whole_grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\n// q_whole_grain >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production.\n// q_wheat >= 0.20 * (q_wheat + q_rye + q_sourdough + q_whole_grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for each type of bread is given in the following Table.\n\n| Bread Type       | Selling Price per Loaf |\n|------------------|------------------------|\n| Wheat            | $2.50                  |\n| Rye              | $3.00                  |\n| Sourdough        | $3.50                  |\n| Whole Grain      | $4.00                  |\n\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day. The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations. The bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production.\n\nPlease help the bakery to maximize its daily revenue by determining the optimal daily production quantity of each type of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"q_wheat\", lb=0) # daily production quantity of Wheat bread\nq_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"q_rye\", lb=0) # daily production quantity of Rye bread\nq_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"q_sourdough\", lb=0) # daily production quantity of Sourdough bread\nq_whole_grain = model.addVar(vtype=\"CONTINUOUS\", name=\"q_whole_grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\nmodel.addCons(q_wheat + q_rye + q_sourdough + q_whole_grain <= 300)\n## The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\nmodel.addCons(q_whole_grain >= 50)\n## The bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production.\nmodel.addCons(q_wheat >= 0.20 * (q_wheat + q_rye + q_sourdough + q_whole_grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(q_wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(q_rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(q_sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(q_whole_grain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit.\n// {\"daily production quantity of Wheat bread\": \"q_wheat\", \"range\": \"q_wheat >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Rye bread\": \"q_rye\", \"range\": \"q_rye >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Sourdough bread\": \"q_sourdough\", \"range\": \"q_sourdough >= 0\", \"type\": \"continuous\"}\n// {\"daily production quantity of Whole Grain bread\": \"q_whole_grain\", \"range\": \"q_whole_grain >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery wants to maximize its daily revenue.\n// Objective Function: Maximize: 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available per day. Each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requires 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively.\n// 0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\n// q_wheat + q_rye + q_sourdough + q_whole_grain <= 300\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\n// q_whole_grain >= 50\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production.\n// q_wheat >= 0.20 * (q_wheat + q_rye + q_sourdough + q_whole_grain)",
        "question": "A bakery wants to optimize the production of four types of bread: Wheat, Rye, Sourdough, and Whole Grain. Each type of bread requires different amounts of ingredients and has a different selling price. The bakery needs to determine the daily production quantity of each type of bread to maximize profit. The selling price per loaf for Wheat, Rye, Sourdough, and Whole Grain bread is $2.50, $3.00, $3.50, and $4.00, respectively. The bakery has a total of 100 hours of labor available per day, with each loaf of Wheat, Rye, Sourdough, and Whole Grain bread requiring 0.1, 0.2, 0.3, and 0.4 hours of labor, respectively. The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day. The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations. Additionally, the bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production. Please help the bakery to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each type of bread\nq_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"q_wheat\", lb=0) # daily production quantity of Wheat bread\nq_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"q_rye\", lb=0) # daily production quantity of Rye bread\nq_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"q_sourdough\", lb=0) # daily production quantity of Sourdough bread\nq_whole_grain = model.addVar(vtype=\"CONTINUOUS\", name=\"q_whole_grain\", lb=0) # daily production quantity of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2.50*q_wheat + 3.00*q_rye + 3.50*q_sourdough + 4.00*q_whole_grain)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available per day.\nmodel.addCons(0.1*q_wheat + 0.2*q_rye + 0.3*q_sourdough + 0.4*q_whole_grain <= 100)\n## The bakery has a limited oven capacity, which can bake a maximum of 300 loaves per day.\nmodel.addCons(q_wheat + q_rye + q_sourdough + q_whole_grain <= 300)\n## The bakery must produce at least 50 loaves of Whole Grain bread per day due to contractual obligations.\nmodel.addCons(q_whole_grain >= 50)\n## The bakery wants to ensure that the production of Wheat bread is at least 20% of the total bread production.\nmodel.addCons(q_wheat >= 0.20 * (q_wheat + q_rye + q_sourdough + q_whole_grain))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Wheat bread: \", model.getVal(q_wheat))\n    print(\"Daily production quantity of Rye bread: \", model.getVal(q_rye))\n    print(\"Daily production quantity of Sourdough bread: \", model.getVal(q_sourdough))\n    print(\"Daily production quantity of Whole Grain bread: \", model.getVal(q_whole_grain))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used\": \"Machine_Time\", \"range\": \"Machine_Time >= 0\", \"type\": \"real\"}\n// {\"number of labor hours used\": \"Labor_Time\", \"range\": \"Labor_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from each unit of Product B is $70. The company aims to maximize its daily profit from the production of these two products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\n// A >= 10\n// B >= 5\n\n## Generate Constraint-4:\nThe company has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from each unit of Product B is $70. The requirements for machine time and labor hours for each product are given in the following Table.\n\n| Product | Profit per Unit | Machine Time per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------|----------------------|\n| A       | $50             | 2 hours               | 1 hour               |\n| B       | $70             | 3 hours               | 2 hours              |\n\nThe company has a total of 120 hours of machine time and 80 hours of labor available per day. The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day. The company also has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity.\n\nPlease help the company to maximize its daily profit from the production of these two products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The number of hours of machine time and labor hours used\nMachine_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Time\", lb=0) # number of hours of machine time used\nLabor_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Time\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n## The company has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of hours of machine time used\": \"Machine_Time\", \"range\": \"Machine_Time >= 0\", \"type\": \"real\"}\n// {\"number of labor hours used\": \"Labor_Time\", \"range\": \"Labor_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each unit of Product A is $50, and from each unit of Product B is $70. The company aims to maximize its daily profit from the production of these two products.\n// Objective Function: Maximize: 50*A + 70*B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\n// 2*A + 3*B <= 120\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\n// A + 2*B <= 80\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\n// A >= 10\n// B >= 5\n\n## Generate Constraint-4:\nThe company has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity.\n// A + B <= 50",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit from each unit of Product A is $50, and from each unit of Product B is $70. Each unit of Product A requires 2 hours of machine time and 1 hour of labor, while each unit of Product B requires 3 hours of machine time and 2 hours of labor. The total machine time available per day is 120 hours, and the total labor hours available per day is 80 hours. The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day. The company has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity. Please help the company to maximize its daily profit from the production of these two products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\n## The number of hours of machine time and labor hours used\nMachine_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine_Time\", lb=0) # number of hours of machine time used\nLabor_Time = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Time\", lb=0) # number of labor hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of machine time, and each unit of Product B requires 3 hours of machine time. The total machine time available per day is 120 hours.\nmodel.addCons(2*A + 3*B <= 120)\n## Each unit of Product A requires 1 hour of labor, and each unit of Product B requires 2 hours of labor. The total labor hours available per day is 80 hours.\nmodel.addCons(A + 2*B <= 80)\n## The market demand for Product A is at least 10 units per day, and for Product B is at least 5 units per day.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 5)\n## The company has a policy to not exceed 50 units of both products combined per day to maintain product quality and exclusivity.\nmodel.addCons(A + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units of overproduction\": \"Overproduction\", \"range\": \"Overproduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// Smartphones + Tablets + Laptops + Overproduction <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\n// Smartphones >= 200\n// Tablets >= 150\n// Laptops >= 100\n\n## Generate Constraint-3:\nThe company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\n// Overproduction <= 50\n\n## Generate Constraint-4:\nThe production of laptops cannot exceed twice the production of tablets.\n// Laptops <= 2*Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand. The profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n\n| Device       | Profit per Unit |\n|--------------|-----------------|\n| Smartphones  | $50             |\n| Tablets      | $70             |\n| Laptops      | $100            |\n\nThe production capacity of the factory is limited to 1000 units per day. The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day. The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs. The production of laptops cannot exceed twice the production of tablets.\n\nPlease help the company to maximize the total daily profit from sales and minimize the cost of overproduction.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\nOverproduction = model.addVar(vtype=\"INTEGER\", name=\"Overproduction\", lb=0) # number of units of overproduction\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops + Overproduction <= 1000)\n## The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\nmodel.addCons(Smartphones >= 200)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 100)\n## The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\nmodel.addCons(Overproduction <= 50)\n## The production of laptops cannot exceed twice the production of tablets.\nmodel.addCons(Laptops <= 2*Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Number of units of overproduction: \", model.getVal(Overproduction))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\n// {\"number of smartphones produced daily\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced daily\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced daily\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of units of overproduction\": \"Overproduction\", \"range\": \"Overproduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\n// Objective Function: Maximize: 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// Smartphones + Tablets + Laptops + Overproduction <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\n// Smartphones >= 200\n// Tablets >= 150\n// Laptops >= 100\n\n## Generate Constraint-3:\nThe company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\n// Overproduction <= 50\n\n## Generate Constraint-4:\nThe production of laptops cannot exceed twice the production of tablets.\n// Laptops <= 2*Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce daily to maximize profit while considering the available production capacity and market demand.\nThe profit per unit for smartphones is $50, for tablets is $70, and for laptops is $100. Any overproduction incurs a storage cost of $20 per unit. The goal is to maximize the total daily profit from sales and minimize the cost of overproduction.\nThe production capacity of the factory is limited to 1000 units per day. The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day. The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs. The production of laptops cannot exceed twice the production of tablets.\nPlease help the company to maximize the total daily profit from sales and minimize the cost of overproduction.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each device produced daily\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of smartphones produced daily\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets produced daily\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops produced daily\nOverproduction = model.addVar(vtype=\"INTEGER\", name=\"Overproduction\", lb=0) # number of units of overproduction\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*Smartphones + 70*Tablets + 100*Laptops - 20*Overproduction)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(Smartphones + Tablets + Laptops + Overproduction <= 1000)\n## The market demand for smartphones is at least 200 units per day, for tablets is at least 150 units per day, and for laptops is at least 100 units per day.\nmodel.addCons(Smartphones >= 200)\nmodel.addCons(Tablets >= 150)\nmodel.addCons(Laptops >= 100)\n## The company has a policy to not exceed 50 units of overproduction per day to minimize storage costs.\nmodel.addCons(Overproduction <= 50)\n## The production of laptops cannot exceed twice the production of tablets.\nmodel.addCons(Laptops <= 2*Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones produced daily: \", model.getVal(Smartphones))\n    print(\"Number of tablets produced daily: \", model.getVal(Tablets))\n    print(\"Number of laptops produced daily: \", model.getVal(Laptops))\n    print(\"Number of units of overproduction: \", model.getVal(Overproduction))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by wheat bread\": \"oven_wheat\", \"range\": \"oven_wheat >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by rye bread\": \"oven_rye\", \"range\": \"oven_rye >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by sourdough bread\": \"oven_sourdough\", \"range\": \"oven_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively.\n// oven_wheat = 5*wheat\n// oven_rye = 7*rye\n// oven_sourdough = 10*sourdough\n// Constraint: oven_wheat + oven_rye + oven_sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\n// wheat <= 150\n// rye <= 100\n// sourdough <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\n// wheat >= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of rye bread daily to meet a promotional agreement.\n// rye >= 20",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively. The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively. The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts. The bakery must also produce at least 20 loaves of rye bread daily to meet a promotional agreement.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n\n| Type of Bread | Profit per Loaf | Oven Capacity per Loaf | Daily Demand |\n|---------------|-----------------|------------------------|--------------|\n| Wheat         | $3              | 5 units                | 150 loaves   |\n| Rye           | $4              | 7 units                | 100 loaves   |\n| Sourdough     | $5              | 10 units               | 80 loaves    |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\n## Oven capacity used by each type of bread\noven_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_wheat\", lb=0) # oven capacity used by wheat bread\noven_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_rye\", lb=0) # oven capacity used by rye bread\noven_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_sourdough\", lb=0) # oven capacity used by sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 units.\nmodel.addCons(oven_wheat == 5*wheat)\nmodel.addCons(oven_rye == 7*rye)\nmodel.addCons(oven_sourdough == 10*sourdough)\nmodel.addCons(oven_wheat + oven_rye + oven_sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\nmodel.addCons(wheat <= 150)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 80)\n## The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\nmodel.addCons(wheat >= 50)\n## The bakery must produce at least 20 loaves of rye bread daily to meet a promotional agreement.\nmodel.addCons(rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1296,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"oven capacity used by wheat bread\": \"oven_wheat\", \"range\": \"oven_wheat >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by rye bread\": \"oven_rye\", \"range\": \"oven_rye >= 0\", \"type\": \"real\"}\n// {\"oven capacity used by sourdough bread\": \"oven_sourdough\", \"range\": \"oven_sourdough >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough\n\n## Generate Constraint-1:\nThe bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively.\n// oven_wheat = 5*wheat\n// oven_rye = 7*rye\n// oven_sourdough = 10*sourdough\n// Constraint: oven_wheat + oven_rye + oven_sourdough <= 1000\n\n## Generate Constraint-2:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\n// wheat <= 150\n// rye <= 100\n// sourdough <= 80\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\n// wheat >= 50\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 loaves of rye bread daily to meet a promotional agreement.\n// rye >= 20",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the limited oven capacity and the demand for each type of bread. The profit from selling each loaf of wheat, rye, and sourdough bread is $3, $4, and $5, respectively. The bakery has a total oven capacity of 1000 units. Each loaf of wheat, rye, and sourdough bread requires 5, 7, and 10 units of oven capacity, respectively. The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively. The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts. The bakery must also produce at least 20 loaves of rye bread daily to meet a promotional agreement. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\n## Oven capacity used by each type of bread\noven_wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_wheat\", lb=0) # oven capacity used by wheat bread\noven_rye = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_rye\", lb=0) # oven capacity used by rye bread\noven_sourdough = model.addVar(vtype=\"CONTINUOUS\", name=\"oven_sourdough\", lb=0) # oven capacity used by sourdough bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough)\n\n# Add constraints\n## The bakery has a total oven capacity of 1000 units.\nmodel.addCons(oven_wheat == 5*wheat)\nmodel.addCons(oven_rye == 7*rye)\nmodel.addCons(oven_sourdough == 10*sourdough)\nmodel.addCons(oven_wheat + oven_rye + oven_sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread of 150, 100, and 80 loaves, respectively.\nmodel.addCons(wheat <= 150)\nmodel.addCons(rye <= 100)\nmodel.addCons(sourdough <= 80)\n## The bakery must produce at least 50 loaves of wheat bread daily to maintain its supplier contracts.\nmodel.addCons(wheat >= 50)\n## The bakery must produce at least 20 loaves of rye bread daily to meet a promotional agreement.\nmodel.addCons(rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 200 units per day.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\n// A_sold >= 50\n// B_sold >= 70\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C\n\n## Generate Constraint-4:\nThe raw material availability limits the production of product C to a maximum of 80 units per day.\n// C <= 80",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the constraints:\n\n| Constraint | Description |\n|------------|-------------|\n| Production Capacity | The factory can produce up to 200 units per day. |\n| Market Demand | Product A must be sold at least 50 units per day, and product B must be sold at least 70 units per day. |\n| Production-Sales Link | The company can only sell as many units as it produces for each product. |\n| Raw Material Limit | The production of product C is limited to a maximum of 80 units per day due to raw material availability. |\n\nPlease help the company to maximize the total daily profit from selling these products, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory is limited to 200 units per day.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\nmodel.addCons(A_sold >= 50)\nmodel.addCons(B_sold >= 70)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n## The raw material availability limits the production of product C to a maximum of 80 units per day.\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"A_sold\", \"range\": \"A_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"B_sold\", \"range\": \"B_sold >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"C_sold\", \"range\": \"C_sold >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 50*A_sold + 30*B_sold + 40*C_sold\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 200 units per day.\n// A + B + C <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\n// A_sold >= 50\n// B_sold >= 70\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// A_sold <= A\n// B_sold <= B\n// C_sold <= C\n\n## Generate Constraint-4:\nThe raw material availability limits the production of product C to a maximum of 80 units per day.\n// C <= 80",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory is limited to 200 units per day. The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day. The company can only sell as many units as it produces for each product. The raw material availability limits the production of product C to a maximum of 80 units per day. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nA_sold = model.addVar(vtype=\"INTEGER\", name=\"A_sold\", lb=0) # number of units of product A sold daily\nB_sold = model.addVar(vtype=\"INTEGER\", name=\"B_sold\", lb=0) # number of units of product B sold daily\nC_sold = model.addVar(vtype=\"INTEGER\", name=\"C_sold\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_sold + 30*B_sold + 40*C_sold)\n\n# Add constraints\n## The production capacity of the factory is limited to 200 units per day.\nmodel.addCons(A + B + C <= 200)\n## The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\nmodel.addCons(A_sold >= 50)\nmodel.addCons(B_sold >= 70)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(A_sold <= A)\nmodel.addCons(B_sold <= B)\nmodel.addCons(C_sold <= C)\n## The raw material availability limits the production of product C to a maximum of 80 units per day.\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(A_sold))\n    print(\"Number of units of product B sold daily: \", model.getVal(B_sold))\n    print(\"Number of units of product C sold daily: \", model.getVal(C_sold))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per day.\n// SC >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day, for product B is at least 20 units per day, and for product C is at least 40 units per day.\n\nPlease help the company to maximize the total daily profit from selling these products, considering the production capacity and market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n## The market demand for product C is at least 40 units per day.\nmodel.addCons(SC >= 40)\n\n# Additional constraints to ensure the number of units sold does not exceed the number produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per day.\n// SC >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day. The market demand for product B is at least 20 units per day. The market demand for product C is at least 40 units per day. Please help the company determine the optimal number of units of each product to produce and sell daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n## The market demand for product C is at least 40 units per day.\nmodel.addCons(SC >= 40)\n\n# Additional constraints to ensure the number of units sold does not exceed the number produced\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake.\n// {\"number of chocolate cakes produced\": \"chocolate_cakes\", \"range\": \"chocolate_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes produced\": \"vanilla_cakes\", \"range\": \"vanilla_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes produced\": \"strawberry_cakes\", \"range\": \"strawberry_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours worked\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n// Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n// Labor_Cost = 20*(8 + overtime_hours)\n// Objective Function: Minimize: Production_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a maximum capacity of 100 cakes per day.\n// chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100\n\n## Generate Constraint-2:\nThe demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\n// chocolate_cakes >= 30\n// vanilla_cakes >= 20\n// strawberry_cakes >= 15\n\n## Generate Constraint-3:\nThe bakery can operate for a maximum of 10 hours of overtime per day.\n// overtime_hours <= 10\n\n## Generate Constraint-4:\nThe total labor hours, including overtime, cannot exceed 12 hours per day.\n// 8 + overtime_hours <= 12",
        "question": "A bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake. The cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n\n| Cake Type       | Production Cost |\n|-----------------|-----------------|\n| Chocolate Cakes | $5              |\n| Vanilla Cakes   | $4              |\n| Strawberry Cakes| $6              |\n\nThe bakery has a maximum capacity of 100 cakes per day. The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day. The bakery can operate for a maximum of 10 hours of overtime per day. The total labor hours, including overtime, cannot exceed 12 hours per day.\n\nPlease help the bakery to determine the optimal number of each type of cake to produce and the necessary overtime hours to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced and the overtime hours\nchocolate_cakes = model.addVar(vtype=\"INTEGER\", name=\"chocolate_cakes\", lb=0) # number of chocolate cakes produced\nvanilla_cakes = model.addVar(vtype=\"INTEGER\", name=\"vanilla_cakes\", lb=0) # number of vanilla cakes produced\nstrawberry_cakes = model.addVar(vtype=\"INTEGER\", name=\"strawberry_cakes\", lb=0) # number of strawberry cakes produced\novertime_hours = model.addVar(vtype=\"INTEGER\", name=\"overtime_hours\", lb=0) # number of overtime hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\nProduction_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n## Labor_Cost = 20*(8 + overtime_hours)\nLabor_Cost = 20*(8 + overtime_hours)\nmodel.addCons(obj == Production_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a maximum capacity of 100 cakes per day.\nmodel.addCons(chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100)\n## The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\nmodel.addCons(chocolate_cakes >= 30)\nmodel.addCons(vanilla_cakes >= 20)\nmodel.addCons(strawberry_cakes >= 15)\n## The bakery can operate for a maximum of 10 hours of overtime per day.\nmodel.addCons(overtime_hours <= 10)\n## The total labor hours, including overtime, cannot exceed 12 hours per day.\nmodel.addCons(8 + overtime_hours <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes produced: \", model.getVal(chocolate_cakes))\n    print(\"Number of vanilla cakes produced: \", model.getVal(vanilla_cakes))\n    print(\"Number of strawberry cakes produced: \", model.getVal(strawberry_cakes))\n    print(\"Number of overtime hours worked: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake.\n// {\"number of chocolate cakes produced\": \"chocolate_cakes\", \"range\": \"chocolate_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes produced\": \"vanilla_cakes\", \"range\": \"vanilla_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes produced\": \"strawberry_cakes\", \"range\": \"strawberry_cakes >= 0\", \"type\": \"integer\"}\n// {\"number of overtime hours worked\": \"overtime_hours\", \"range\": \"overtime_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\n// Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n// Labor_Cost = 20*(8 + overtime_hours)\n// Objective Function: Minimize: Production_Cost + Labor_Cost\n\n## Generate Constraint-1:\nThe bakery has a maximum capacity of 100 cakes per day.\n// chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100\n\n## Generate Constraint-2:\nThe demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\n// chocolate_cakes >= 30\n// vanilla_cakes >= 20\n// strawberry_cakes >= 15\n\n## Generate Constraint-3:\nThe bakery can operate for a maximum of 10 hours of overtime per day.\n// overtime_hours <= 10\n\n## Generate Constraint-4:\nThe total labor hours, including overtime, cannot exceed 12 hours per day.\n// 8 + overtime_hours <= 12",
        "question": "A bakery wants to optimize its daily production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce while considering the cost of ingredients, labor, and the demand for each type of cake. The cost of producing one chocolate cake is $5, one vanilla cake is $4, and one strawberry cake is $6. The labor cost is $20 per hour, and any overtime is paid at a rate of $30 per hour. The bakery wants to minimize the total cost of production and labor.\nThe bakery has a maximum capacity of 100 cakes per day. The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day. The bakery can operate for a maximum of 10 hours of overtime per day. The total labor hours, including overtime, cannot exceed 12 hours per day.\nPlease help the bakery determine the optimal number of each type of cake to produce and the necessary overtime hours to minimize the total cost of production and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced and the overtime hours\nchocolate_cakes = model.addVar(vtype=\"INTEGER\", name=\"chocolate_cakes\", lb=0) # number of chocolate cakes produced\nvanilla_cakes = model.addVar(vtype=\"INTEGER\", name=\"vanilla_cakes\", lb=0) # number of vanilla cakes produced\nstrawberry_cakes = model.addVar(vtype=\"INTEGER\", name=\"strawberry_cakes\", lb=0) # number of strawberry cakes produced\novertime_hours = model.addVar(vtype=\"INTEGER\", name=\"overtime_hours\", lb=0) # number of overtime hours worked\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\nProduction_Cost = 5*chocolate_cakes + 4*vanilla_cakes + 6*strawberry_cakes\n## Labor_Cost = 20*(8 + overtime_hours)\nLabor_Cost = 20*(8 + overtime_hours)\nmodel.addCons(obj == Production_Cost + Labor_Cost)\n\n# Add constraints\n## The bakery has a maximum capacity of 100 cakes per day.\nmodel.addCons(chocolate_cakes + vanilla_cakes + strawberry_cakes <= 100)\n## The demand for chocolate cakes is at least 30 per day, for vanilla cakes is at least 20 per day, and for strawberry cakes is at least 15 per day.\nmodel.addCons(chocolate_cakes >= 30)\nmodel.addCons(vanilla_cakes >= 20)\nmodel.addCons(strawberry_cakes >= 15)\n## The bakery can operate for a maximum of 10 hours of overtime per day.\nmodel.addCons(overtime_hours <= 10)\n## The total labor hours, including overtime, cannot exceed 12 hours per day.\nmodel.addCons(8 + overtime_hours <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes produced: \", model.getVal(chocolate_cakes))\n    print(\"Number of vanilla cakes produced: \", model.getVal(vanilla_cakes))\n    print(\"Number of strawberry cakes produced: \", model.getVal(strawberry_cakes))\n    print(\"Number of overtime hours worked: \", model.getVal(overtime_hours))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type is limited.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product A\": \"cap_A\", \"range\": \"cap_A >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product B\": \"cap_B\", \"range\": \"cap_B >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product C\": \"cap_C\", \"range\": \"cap_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer wants to maximize the total weekly profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe weekly production capacity for Product A is 100 units.\n// A <= cap_A\n\n## Generate Constraint-2:\nThe weekly production capacity for Product B is 150 units.\n// B <= cap_B\n\n## Generate Constraint-3:\nThe weekly production capacity for Product C is 200 units.\n// C <= cap_C\n\n## Generate Constraint-4:\nThe total labor hours available for production are limited to 300 hours. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2 hours.\n// 2*A + 3*B + 2*C <= 300",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The production capacity and labor requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Capacity | Labor Hours per Unit |\n|---------|-----------------|---------------------|----------------------|\n| A       | 50$             | 100 units           | 2 hours              |\n| B       | 70$             | 150 units           | 3 hours              |\n| C       | 60$             | 200 units           | 2 hours              |\n\nThe weekly production capacity for each product is limited as specified in the table. The total labor hours available for production are limited to 300 hours. Please help the manufacturer to maximize the total weekly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n## Weekly production capacity for each product\ncap_A = 100 # weekly production capacity for Product A\ncap_B = 150 # weekly production capacity for Product B\ncap_C = 200 # weekly production capacity for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The weekly production capacity for Product A is 100 units.\nmodel.addCons(A <= cap_A)\n## The weekly production capacity for Product B is 150 units.\nmodel.addCons(B <= cap_B)\n## The weekly production capacity for Product C is 200 units.\nmodel.addCons(C <= cap_C)\n## The total labor hours available for production are limited to 300 hours.\nmodel.addCons(2*A + 3*B + 2*C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The production capacity for each product type is limited.\n// {\"number of units of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product A\": \"cap_A\", \"range\": \"cap_A >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product B\": \"cap_B\", \"range\": \"cap_B >= 0\", \"type\": \"integer\"}\n// {\"weekly production capacity for Product C\": \"cap_C\", \"range\": \"cap_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The manufacturer wants to maximize the total weekly profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe weekly production capacity for Product A is 100 units.\n// A <= cap_A\n\n## Generate Constraint-2:\nThe weekly production capacity for Product B is 150 units.\n// B <= cap_B\n\n## Generate Constraint-3:\nThe weekly production capacity for Product C is 200 units.\n// C <= cap_C\n\n## Generate Constraint-4:\nThe total labor hours available for production are limited to 300 hours. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2 hours.\n// 2*A + 3*B + 2*C <= 300",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide how many units of each product to produce weekly to maximize profit. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The weekly production capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units. Producing one unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2 hours. The total labor hours available for production are limited to 300 hours. Please help the manufacturer to maximize the total weekly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C produced\n## Weekly production capacity for each product\ncap_A = 100 # weekly production capacity for Product A\ncap_B = 150 # weekly production capacity for Product B\ncap_C = 200 # weekly production capacity for Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The weekly production capacity for Product A is 100 units.\nmodel.addCons(A <= cap_A)\n## The weekly production capacity for Product B is 150 units.\nmodel.addCons(B <= cap_B)\n## The weekly production capacity for Product C is 200 units.\nmodel.addCons(C <= cap_C)\n## The total labor hours available for production are limited to 300 hours.\nmodel.addCons(2*A + 3*B + 2*C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced: \", model.getVal(A))\n    print(\"Number of units of Product B produced: \", model.getVal(B))\n    print(\"Number of units of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 632,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\n// B <= 20\n\n## Generate Constraint-4:\nTo maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced.\n// C >= 0.5*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Hours per Unit |\n|---------|----------------------|\n| A       | 2                    |\n| B       | 3                    |\n| C       | 4                    |\n\nThe company has 100 hours of labor available daily. The market demand for product A is at least 10 units per day. The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity. To maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced.\n\nPlease help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100) # total labor hours used for production must not exceed the available labor hours\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\nmodel.addCons(B <= 20)\n## To maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced.\nmodel.addCons(C >= 0.5*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available daily\": \"labor_hours\", \"range\": \"labor_hours = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units per day.\n// A >= 10\n\n## Generate Constraint-3:\nThe company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\n// B <= 20\n\n## Generate Constraint-4:\nTo maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced.\n// C >= 0.5*B",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours. The total labor hours used for production must not exceed the available labor hours of 100 hours daily. The market demand for product A is at least 10 units per day. The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity. To maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced. Please help the company to maximize the total daily profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 4 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 100) # total labor hours used for production must not exceed the available labor hours\n## The market demand for product A is at least 10 units per day.\nmodel.addCons(A >= 10)\n## The company can only produce a maximum of 20 units of product B per day due to limited machinery capacity.\nmodel.addCons(B <= 20)\n## To maintain a balanced product portfolio, the number of units of product C produced must be at least half the number of units of product B produced.\nmodel.addCons(C >= 0.5*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra wheat bread loaves if demand exceeds\": \"extra_wheat_loaves\", \"range\": \"extra_wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra rye bread loaves if demand exceeds\": \"extra_rye_loaves\", \"range\": \"extra_rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra sourdough bread loaves if demand exceeds\": \"extra_sourdough_loaves\", \"range\": \"extra_sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 800\n\n## Generate Constraint-3:\nThe bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150\n\n## Generate Constraint-4:\nThe bakery should produce at least the demand for each type of bread to avoid losing potential profit.\n// wheat_loaves >= 300 - extra_wheat_loaves\n// rye_loaves >= 200 - extra_rye_loaves\n// sourdough_loaves >= 150 - extra_sourdough_loaves",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints. The bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread. Additionally, the bakery should produce at least the demand for each type of bread to avoid losing potential profit.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of loaves of wheat, rye, and sourdough bread to produce, as well as the number of extra loaves needed if demand exceeds production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The number of extra loaves if demand exceeds\nextra_wheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_wheat_loaves\", lb=0) # number of extra wheat bread loaves if demand exceeds\nextra_rye_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_rye_loaves\", lb=0) # number of extra rye bread loaves if demand exceeds\nextra_sourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_sourdough_loaves\", lb=0) # number of extra sourdough bread loaves if demand exceeds\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available daily.\nmodel.addCons(0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500)\n## The bakery can produce a maximum of 800 loaves of bread daily.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 800)\n## The bakery has a daily demand for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n## The bakery should produce at least the demand for each type of bread.\nmodel.addCons(wheat_loaves >= 300 - extra_wheat_loaves)\nmodel.addCons(rye_loaves >= 200 - extra_rye_loaves)\nmodel.addCons(sourdough_loaves >= 150 - extra_sourdough_loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra wheat bread loaves: \", model.getVal(extra_wheat_loaves))\n    print(\"Number of extra rye bread loaves: \", model.getVal(extra_rye_loaves))\n    print(\"Number of extra sourdough bread loaves: \", model.getVal(extra_sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1424,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat_loaves\", \"range\": \"wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye_loaves\", \"range\": \"rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough_loaves\", \"range\": \"sourdough_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra wheat bread loaves if demand exceeds\": \"extra_wheat_loaves\", \"range\": \"extra_wheat_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra rye bread loaves if demand exceeds\": \"extra_rye_loaves\", \"range\": \"extra_rye_loaves >= 0\", \"type\": \"integer\"}\n// {\"number of extra sourdough bread loaves if demand exceeds\": \"extra_sourdough_loaves\", \"range\": \"extra_sourdough_loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively.\n// 0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints.\n// wheat_loaves + rye_loaves + sourdough_loaves <= 800\n\n## Generate Constraint-3:\nThe bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread.\n// wheat_loaves <= 300\n// rye_loaves <= 200\n// sourdough_loaves <= 150\n\n## Generate Constraint-4:\nThe bakery should produce at least the demand for each type of bread to avoid losing potential profit.\n// wheat_loaves >= 300 - extra_wheat_loaves\n// rye_loaves >= 200 - extra_rye_loaves\n// sourdough_loaves >= 150 - extra_sourdough_loaves",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit from selling wheat, rye, and sourdough bread is $3, $4, and $5 per loaf, respectively. If the bakery cannot meet the demand and has to turn away customers, it loses potential profit. The bakery aims to maximize its daily profit.\n\nThe bakery has a limited amount of flour available daily. The total amount of flour used for all types of bread cannot exceed 500 kg. Each loaf of wheat, rye, and sourdough bread requires 0.5 kg, 0.6 kg, and 0.7 kg of flour, respectively. The bakery can produce a maximum of 800 loaves of bread daily due to labor and oven capacity constraints. The bakery has a daily demand for each type of bread. The demand for wheat, rye, and sourdough bread is 300, 200, and 150 loaves, respectively. The bakery should not produce more than the demand for each type of bread. The bakery should also produce at least the demand for each type of bread to avoid losing potential profit.\n\nPlease help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nwheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"wheat_loaves\", lb=0) # number of wheat bread loaves\nrye_loaves = model.addVar(vtype=\"INTEGER\", name=\"rye_loaves\", lb=0) # number of rye bread loaves\nsourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"sourdough_loaves\", lb=0) # number of sourdough bread loaves\n## The number of extra loaves if demand exceeds\nextra_wheat_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_wheat_loaves\", lb=0) # number of extra wheat bread loaves if demand exceeds\nextra_rye_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_rye_loaves\", lb=0) # number of extra rye bread loaves if demand exceeds\nextra_sourdough_loaves = model.addVar(vtype=\"INTEGER\", name=\"extra_sourdough_loaves\", lb=0) # number of extra sourdough bread loaves if demand exceeds\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat_loaves + 4*rye_loaves + 5*sourdough_loaves + 3*extra_wheat_loaves + 4*extra_rye_loaves + 5*extra_sourdough_loaves)\n\n# Add constraints\n## The bakery has a limited amount of flour available daily.\nmodel.addCons(0.5*wheat_loaves + 0.6*rye_loaves + 0.7*sourdough_loaves <= 500)\n## The bakery can produce a maximum of 800 loaves of bread daily.\nmodel.addCons(wheat_loaves + rye_loaves + sourdough_loaves <= 800)\n## The bakery has a daily demand for each type of bread.\nmodel.addCons(wheat_loaves <= 300)\nmodel.addCons(rye_loaves <= 200)\nmodel.addCons(sourdough_loaves <= 150)\n## The bakery should produce at least the demand for each type of bread.\nmodel.addCons(wheat_loaves >= 300 - extra_wheat_loaves)\nmodel.addCons(rye_loaves >= 200 - extra_rye_loaves)\nmodel.addCons(sourdough_loaves >= 150 - extra_sourdough_loaves)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat_loaves))\n    print(\"Number of rye bread loaves: \", model.getVal(rye_loaves))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough_loaves))\n    print(\"Number of extra wheat bread loaves: \", model.getVal(extra_wheat_loaves))\n    print(\"Number of extra rye bread loaves: \", model.getVal(extra_rye_loaves))\n    print(\"Number of extra sourdough bread loaves: \", model.getVal(extra_sourdough_loaves))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units produced daily to 100.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\n// SA >= 30\n// SB >= 20\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe total number of units sold daily cannot exceed 80 due to market saturation.\n// SA + SB + SC <= 80",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The following table summarizes the profit per unit for each product.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe production capacity of the factory limits the total number of units produced daily to 100. The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily. The company can only sell as many units as it produces for each product. Additionally, the total number of units sold daily cannot exceed 80 due to market saturation.\n\nPlease help the company to maximize the total daily profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units produced daily to 100.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 20)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The total number of units sold daily cannot exceed 80 due to market saturation.\nmodel.addCons(SA + SB + SC <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory limits the total number of units produced daily to 100.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\n// SA >= 30\n// SB >= 20\n\n## Generate Constraint-3:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C\n\n## Generate Constraint-4:\nThe total number of units sold daily cannot exceed 80 due to market saturation.\n// SA + SB + SC <= 80",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory limits the total number of units produced daily to 100. The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily. The company can only sell as many units as it produces for each product. The total number of units sold daily cannot exceed 80 due to market saturation.\nPlease help the company determine the optimal number of units of each product to produce and sell daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory limits the total number of units produced daily to 100.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units daily, and for product B, it is at least 20 units daily.\nmodel.addCons(SA >= 30)\nmodel.addCons(SB >= 20)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n## The total number of units sold daily cannot exceed 80 due to market saturation.\nmodel.addCons(SA + SB + SC <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"raw_materials\", \"range\": \"raw_materials = 1000 units\", \"type\": \"constant\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours = 800 hours\", \"type\": \"constant\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe production of each unit of Product A, B, and C requires 2 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 2*A + 2*B + 2*C <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*A + 2*B + 4*C <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B and C combined is at least 200 units.\n// B + C >= 200",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours. The profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The following table summarizes the resource requirements for each product:\n\n| Product | Profit per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-------------------------|----------------------|\n| A       | $50             | 2 units                 | 3 hours              |\n| B       | $30             | 2 units                 | 2 hours              |\n| C       | $40             | 2 units                 | 4 hours              |\n\nThe manufacturer has 1000 units of raw materials and 800 labor hours available. The market demand for Product A is at least 100 units, and the combined demand for Product B and C is at least 200 units. The manufacturer aims to maximize the total profit from the production of these products. Please help the manufacturer determine the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The production of each unit of Product A, B, and C requires 2 units of raw materials.\nraw_materials = 1000\nmodel.addCons(2*A + 2*B + 2*C <= raw_materials)\n## Each unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours.\nlabor_hours = 800\nmodel.addCons(3*A + 2*B + 4*C <= labor_hours)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The market demand for Product B and C combined is at least 200 units.\nmodel.addCons(B + C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The production is limited by the availability of raw materials and labor hours.\n// {\"quantity of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"available raw materials\": \"raw_materials\", \"range\": \"raw_materials = 1000 units\", \"type\": \"constant\"}\n// {\"available labor hours\": \"labor_hours\", \"range\": \"labor_hours = 800 hours\", \"type\": \"constant\"}\n\n## Define Objective Function:\nThe profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The manufacturer aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe production of each unit of Product A, B, and C requires 2 units of raw materials. The total raw materials used must not exceed the available raw materials.\n// 2*A + 2*B + 2*C <= raw_materials\n\n## Generate Constraint-2:\nEach unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours. The total labor hours used must not exceed the available labor hours.\n// 3*A + 2*B + 4*C <= labor_hours\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for Product B and C combined is at least 200 units.\n// B + C >= 200",
        "question": "A manufacturer produces three types of products (Product A, Product B, and Product C) and needs to decide the production quantities for each product to maximize profit. The profit per unit of Product A, B, and C is $50, $30, and $40, respectively. The production is limited by the availability of 1000 units of raw materials and 800 labor hours. Each unit of Product A, B, and C requires 2 units of raw materials. Each unit of Product A requires 3 labor hours, Product B requires 2 labor hours, and Product C requires 4 labor hours. The market demand for Product A is at least 100 units, and the market demand for Product B and C combined is at least 200 units.\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The production of each unit of Product A, B, and C requires 2 units of raw materials.\nraw_materials = 1000\nmodel.addCons(2*A + 2*B + 2*C <= raw_materials)\n## Each unit of Product A requires 3 labor hours, each unit of Product B requires 2 labor hours, and each unit of Product C requires 4 labor hours.\nlabor_hours = 800\nmodel.addCons(3*A + 2*B + 4*C <= labor_hours)\n## The market demand for Product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The market demand for Product B and C combined is at least 200 units.\nmodel.addCons(B + C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A produced: \", model.getVal(A))\n    print(\"Quantity of Product B produced: \", model.getVal(B))\n    print(\"Quantity of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 758,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe assembly stage has a capacity of 1000 hours per week. It takes 2 hours to assemble one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe testing stage has a capacity of 800 hours per week. It takes 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C.\n// A + 2*B + C <= 800\n\n## Generate Constraint-3:\nThe packaging stage has a capacity of 700 hours per week. It takes 1 hour to package one unit of product A, 1 hour for product B, and 2 hours for product C.\n// A + B + 2*C <= 700\n\n## Generate Constraint-4:\nThe market demand for product A is at least 100 units per week, for product B is at least 200 units per week, and for product C is at least 150 units per week.\n// A >= 100\n// B >= 200\n// C >= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The following table summarizes the time required for each stage per unit of product:\n\n| Product | Assembly Time | Testing Time | Packaging Time |\n|---------|---------------|--------------|----------------|\n| A       | 2 hours       | 1 hour       | 1 hour         |\n| B       | 3 hours       | 2 hours      | 1 hour         |\n| C       | 4 hours       | 1 hour       | 2 hours        |\n\nThe assembly stage has a capacity of 1000 hours per week. The testing stage has a capacity of 800 hours per week. The packaging stage has a capacity of 700 hours per week. The market demand for product A is at least 100 units per week, for product B is at least 200 units per week, and for product C is at least 150 units per week.\n\nPlease help the manufacturer to maximize the total profit from the production of these products, considering the constraints on each production stage and the market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The assembly stage has a capacity of 1000 hours per week.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The testing stage has a capacity of 800 hours per week.\nmodel.addCons(A + 2*B + C <= 800)\n## The packaging stage has a capacity of 700 hours per week.\nmodel.addCons(A + B + 2*C <= 700)\n## The market demand for each product.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\nmodel.addCons(C >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe assembly stage has a capacity of 1000 hours per week. It takes 2 hours to assemble one unit of product A, 3 hours for product B, and 4 hours for product C.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe testing stage has a capacity of 800 hours per week. It takes 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C.\n// A + 2*B + C <= 800\n\n## Generate Constraint-3:\nThe packaging stage has a capacity of 700 hours per week. It takes 1 hour to package one unit of product A, 1 hour for product B, and 2 hours for product C.\n// A + B + 2*C <= 700\n\n## Generate Constraint-4:\nThe market demand for product A is at least 100 units per week, for product B is at least 200 units per week, and for product C is at least 150 units per week.\n// A >= 100\n// B >= 200\n// C >= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves three stages: assembly, testing, and packaging. The manufacturer needs to determine the number of units of each product to produce to maximize profit while considering the available resources in each stage.\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\nThe assembly stage has a capacity of 1000 hours per week. It takes 2 hours to assemble one unit of product A, 3 hours for product B, and 4 hours for product C.\nThe testing stage has a capacity of 800 hours per week. It takes 1 hour to test one unit of product A, 2 hours for product B, and 1 hour for product C.\nThe packaging stage has a capacity of 700 hours per week. It takes 1 hour to package one unit of product A, 1 hour for product B, and 2 hours for product C.\nThe market demand for product A is at least 100 units per week, for product B is at least 200 units per week, and for product C is at least 150 units per week.\nPlease help the manufacturer determine the optimal number of units of each product to produce to maximize profit while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The assembly stage has a capacity of 1000 hours per week.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The testing stage has a capacity of 800 hours per week.\nmodel.addCons(A + 2*B + C <= 800)\n## The packaging stage has a capacity of 700 hours per week.\nmodel.addCons(A + B + 2*C <= 700)\n## The market demand for each product.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 200)\nmodel.addCons(C >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product B is at most 200 units per day.\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The labor and raw material requirements for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|----------------------|-----------------------------|\n| A       | 2 hours              | 3 units                     |\n| B       | 3 hours              | 4 units                     |\n| C       | 5 hours              | 6 units                     |\n\nThe total labor hours available per day are 1000 hours. The total raw material available per day is 1500 units. The market demand for product A is at least 100 units per day, and the market demand for product B is at most 200 units per day. \n\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per day.\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product B is at most 200 units per day.\n// B <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\nThe market demand for product A is at least 100 units per day.\nThe market demand for product B is at most 200 units per day.\nPlease help the manufacturer determine the optimal number of units of each product to produce to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per day.\nmodel.addCons(B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n// Eggs_Chocolate + Eggs_Vanilla <= 100",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The following table summarizes the requirements for each type of cake:\n\n| Cake Type     | Profit per Cake | Eggs Required |\n|---------------|-----------------|---------------|\n| Chocolate     | $5              | 2             |\n| Vanilla       | $4              | 1             |\n\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n\nPlease help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of eggs required for each type of cake\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## The bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n## The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\nmodel.addCons(Eggs_Chocolate + Eggs_Vanilla <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for chocolate cakes\": \"Eggs_Chocolate\", \"range\": \"Eggs_Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required for vanilla cakes\": \"Eggs_Vanilla\", \"range\": \"Eggs_Vanilla >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Chocolate_Cakes + 4*Vanilla_Cakes\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\n// 2*Chocolate_Cakes + Eggs_Vanilla <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\n// Chocolate_Cakes >= 30\n// Vanilla_Cakes >= 40\n\n## Generate Constraint-3:\nThe bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\n// Chocolate_Cakes + Vanilla_Cakes <= 60\n\n## Generate Constraint-4:\nThe bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\n// Eggs_Chocolate + Eggs_Vanilla <= 100",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and demand constraints. The profit per chocolate cake is $5, and the profit per vanilla cake is $4. The bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes. The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily. The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The number of eggs required for each type of cake\nEggs_Chocolate = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Chocolate\", lb=0) # number of eggs required for chocolate cakes\nEggs_Vanilla = model.addVar(vtype=\"INTEGER\", name=\"Eggs_Vanilla\", lb=0) # number of eggs required for vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate_Cakes + 4*Vanilla_Cakes)\n\n# Add constraints\n## The bakery has a daily supply of 100 eggs. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg.\nmodel.addCons(2*Chocolate_Cakes + Eggs_Vanilla <= 100)\n## The bakery has a daily demand for at least 30 chocolate cakes and 40 vanilla cakes.\nmodel.addCons(Chocolate_Cakes >= 30)\nmodel.addCons(Vanilla_Cakes >= 40)\n## The bakery has a limited oven space, allowing for a maximum of 60 cakes to be baked daily.\nmodel.addCons(Chocolate_Cakes + Vanilla_Cakes <= 60)\n## The bakery must ensure that the total number of eggs used for both types of cakes does not exceed the daily supply.\nmodel.addCons(Eggs_Chocolate + Eggs_Vanilla <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\n// Chocolate_Cakes >= 3\n\n## Generate Constraint-4:\nThe bakery must produce at least 4 vanilla cakes daily to meet customer demand.\n// Vanilla_Cakes >= 4",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The following table summarizes the labor and sugar requirements for each type of cake.\n\n| Cake Type | Labor per Cake | Sugar per Cake |\n|-----------|----------------|----------------|\n| Chocolate | 2 hours        | 0.5 kg         |\n| Vanilla   | 1.5 hours      | 0.4 kg         |\n\nThe bakery has a maximum of 12 hours of labor available daily and a maximum of 4 kg of sugar available daily. The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation and at least 4 vanilla cakes daily to meet customer demand. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\nmodel.addCons(Chocolate_Cakes >= 3)\n## The bakery must produce at least 4 vanilla cakes daily to meet customer demand.\nmodel.addCons(Vanilla_Cakes >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n// {\"amount of sugar used\": \"Sugar_Used\", \"range\": \"Sugar_Used >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each chocolate cake is $10, and from each vanilla cake is $8. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 10*Chocolate_Cakes + 8*Vanilla_Cakes\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\n// 2*Chocolate_Cakes + 1.5*Vanilla_Cakes <= 12\n\n## Generate Constraint-2:\nEach chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\n// 0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\n// Chocolate_Cakes >= 3\n\n## Generate Constraint-4:\nThe bakery must produce at least 4 vanilla cakes daily to meet customer demand.\n// Vanilla_Cakes >= 4",
        "question": "A bakery produces two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the available ingredients and labor. The profit from selling each chocolate cake is $10, and from each vanilla cake is $8. Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily. Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily. The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation. The bakery must also produce at least 4 vanilla cakes daily to meet customer demand. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\n## The resources used\nLabor_Hours = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_Hours\", lb=0) # number of hours of labor used\nSugar_Used = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar_Used\", lb=0) # amount of sugar used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*Chocolate_Cakes + 8*Vanilla_Cakes)\n\n# Add constraints\n## Each chocolate cake requires 2 hours of labor, and each vanilla cake requires 1.5 hours of labor. The bakery has a maximum of 12 hours of labor available daily.\nmodel.addCons(2*Chocolate_Cakes + 1.5*Vanilla_Cakes == Labor_Hours)\nmodel.addCons(Labor_Hours <= 12)\n## Each chocolate cake requires 0.5 kg of sugar, and each vanilla cake requires 0.4 kg of sugar. The bakery has a maximum of 4 kg of sugar available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.4*Vanilla_Cakes == Sugar_Used)\nmodel.addCons(Sugar_Used <= 4)\n## The bakery must produce at least 3 chocolate cakes daily to meet a contractual obligation.\nmodel.addCons(Chocolate_Cakes >= 3)\n## The bakery must produce at least 4 vanilla cakes daily to meet customer demand.\nmodel.addCons(Vanilla_Cakes >= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of hours of labor used: \", model.getVal(Labor_Hours))\n    print(\"Amount of sugar used: \", model.getVal(Sugar_Used))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 pastries per day.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-2:\nThe demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\n// Croissants >= 50\n// Muffins >= 80\n\n## Generate Constraint-3:\nEach oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\n// Croissants/50 + Muffins/50 <= Ovens\n\n## Generate Constraint-4:\nThe bakery has a budget of $150 per day for oven rentals.\n// 50*Ovens <= 150",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity. The revenue and cost details for each pastry are given in the following Table.\n\n| Pastry   | Revenue per Unit | Cost of Ingredients per Unit |\n|----------|------------------|------------------------------|\n| Croissants | $3              | $1                           |\n| Muffins    | $2              | $0.5                         |\n\nThe rental cost per oven per day is $50. The bakery can produce a maximum of 200 pastries per day. The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day. Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity. The bakery has a budget of $150 per day for oven rentals.\n\nPlease help the bakery to maximize the daily profit, which is defined as the total revenue minus the total cost (including the cost of ingredients and oven rentals).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nmodel.addCons(Cost_Croissants == Croissants)\nmodel.addCons(Cost_Muffins == 0.5*Muffins)\nmodel.addCons(obj == 3*Croissants + 2*Muffins - Cost_Croissants - Cost_Muffins - 50*Ovens)\n\n# Add constraints\n## The bakery can produce a maximum of 200 pastries per day.\nmodel.addCons(Croissants + Muffins <= 200)\n## The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 80)\n## Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\nmodel.addCons(Croissants/50 + Muffins/50 <= Ovens)\n## The bakery has a budget of $150 per day for oven rentals.\nmodel.addCons(50*Ovens <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The bakery also needs to determine the optimal number of ovens to rent to meet production needs without exceeding capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent\": \"Ovens\", \"range\": \"Ovens >= 0\", \"type\": \"integer\"}\n// {\"cost of ingredients for croissants\": \"Cost_Croissants\", \"range\": \"Cost_Croissants >= 0\", \"type\": \"real\"}\n// {\"cost of ingredients for muffins\": \"Cost_Muffins\", \"range\": \"Cost_Muffins >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per croissant is $3, and the revenue per muffin is $2. \nThe cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. \nThe rental cost per oven per day is $50.\nThe bakery wants to maximize the daily profit.\n// Total_Revenue = 3*Croissants + 2*Muffins\n// Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery can produce a maximum of 200 pastries per day.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-2:\nThe demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\n// Croissants >= 50\n// Muffins >= 80\n\n## Generate Constraint-3:\nEach oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\n// Croissants/50 + Muffins/50 <= Ovens\n\n## Generate Constraint-4:\nThe bakery has a budget of $150 per day for oven rentals.\n// 50*Ovens <= 150",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide how many of each type of pastry to produce daily, considering the cost of ingredients and the demand from customers. The revenue per croissant is $3, and the revenue per muffin is $2. The cost of ingredients per croissant is $1, and the cost of ingredients per muffin is $0.5. The rental cost per oven per day is $50. The bakery wants to maximize the daily profit.\n\nThe bakery can produce a maximum of 200 pastries per day. The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day. Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity. The bakery has a budget of $150 per day for oven rentals.\n\nPlease help the bakery determine the optimal number of croissants, muffins, and ovens to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce and the number of ovens to rent\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nOvens = model.addVar(vtype=\"INTEGER\", name=\"Ovens\", lb=0) # number of ovens to rent\nCost_Croissants = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Croissants\", lb=0) # cost of ingredients for croissants\nCost_Muffins = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost_Muffins\", lb=0) # cost of ingredients for muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 3*Croissants + 2*Muffins\n## Total_Cost = Cost_Croissants + Cost_Muffins + 50*Ovens\nmodel.addCons(Cost_Croissants == Croissants)\nmodel.addCons(Cost_Muffins == 0.5*Muffins)\nmodel.addCons(obj == 3*Croissants + 2*Muffins - Cost_Croissants - Cost_Muffins - 50*Ovens)\n\n# Add constraints\n## The bakery can produce a maximum of 200 pastries per day.\nmodel.addCons(Croissants + Muffins <= 200)\n## The demand for croissants is at least 50 per day, and the demand for muffins is at least 80 per day.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 80)\n## Each oven can handle the production of 50 pastries per day. The bakery must rent enough ovens to meet production needs without exceeding this capacity.\nmodel.addCons(Croissants/50 + Muffins/50 <= Ovens)\n## The bakery has a budget of $150 per day for oven rentals.\nmodel.addCons(50*Ovens <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of ovens to rent: \", model.getVal(Ovens))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven space used\": \"Oven_Space\", \"range\": \"Oven_Space >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50\n\n## Generate Constraint-4:\nDue to a special promotion, the bakery must produce at least twice as many muffins as croissants.\n// Muffins >= 2*Croissants",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Labor Hours per Unit | Oven Space per Unit |\n|----------|-----------------|----------------------|---------------------|\n| Croissant| $0.50           | 0.1 hours            | 0.05 square meters  |\n| Muffin   | $0.75           | 0.2 hours            | 0.08 square meters  |\n| Donut    | $1.00           | 0.3 hours            | 0.1 square meters   |\n\nThe bakery has a maximum of 10 hours of labor available daily and a maximum of 1.5 square meters of oven space available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Due to a special promotion, the bakery must produce at least twice as many muffins as croissants.\n\nPlease help the bakery to determine the optimal number of croissants, muffins, and donuts to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10)\n## Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n## Due to a special promotion, the bakery must produce at least twice as many muffins as croissants.\nmodel.addCons(Muffins >= 2*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"total oven space used\": \"Oven_Space\", \"range\": \"Oven_Space >= 0\", \"type\": \"real\"}\n// {\"total labor hours used\": \"Labor_Hours\", \"range\": \"Labor_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling these pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10\n\n## Generate Constraint-2:\nEach croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\n// 0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\n// Croissants + Muffins + Donuts >= 50\n\n## Generate Constraint-4:\nDue to a special promotion, the bakery must produce at least twice as many muffins as croissants.\n// Muffins >= 2*Croissants",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited resources such as oven space and labor hours. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours, with a maximum of 10 hours of labor available daily. Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters, with a maximum of 1.5 square meters of oven space available daily. The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes. Due to a special promotion, the bakery must produce at least twice as many muffins as croissants. Please help the bakery to maximize its daily profit from selling these pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 0.1 hours of labor, each muffin requires 0.2 hours, and each donut requires 0.3 hours. The bakery has a maximum of 10 hours of labor available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Donuts <= 10)\n## Each croissant requires 0.05 square meters of oven space, each muffin requires 0.08 square meters, and each donut requires 0.1 square meters. The bakery has a maximum of 1.5 square meters of oven space available daily.\nmodel.addCons(0.05*Croissants + 0.08*Muffins + 0.1*Donuts <= 1.5)\n## The bakery must produce at least 50 pastries in total daily to meet the minimum order requirements from local cafes.\nmodel.addCons(Croissants + Muffins + Donuts >= 50)\n## Due to a special promotion, the bakery must produce at least twice as many muffins as croissants.\nmodel.addCons(Muffins >= 2*Croissants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known.\n// {\"quantity of product A produced\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*QA + 15*QB + 20*QC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-2:\nThe daily demand for products A, B, and C is 300, 200, and 150 units respectively.\n// QA >= 300\n// QB >= 200\n// QC >= 150\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of product A as product B.\n// QA >= 2*QB\n\n## Generate Constraint-4:\nThe total production of products B and C must not exceed the production of product A.\n// QB + QC <= QA",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known. The production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost.\n\n| Product | Production Cost per Unit | Daily Demand |\n|---------|--------------------------|--------------|\n| A       | $10                      | 300 units    |\n| B       | $15                      | 200 units    |\n| C       | $20                      | 150 units    |\n\nThe production capacity of the factory is limited to 1000 units per day. The daily demand for products A, B, and C is 300, 200, and 150 units respectively. The manufacturer has a policy to produce at least twice as many units of product A as product B. The total production of products B and C must not exceed the production of product A.\n\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C to minimize the total production cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of product A produced\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of product B produced\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*QA + 15*QB + 20*QC)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(QA + QB + QC <= 1000)\n## The daily demand for products A, B, and C is 300, 200, and 150 units respectively.\nmodel.addCons(QA >= 300)\nmodel.addCons(QB >= 200)\nmodel.addCons(QC >= 150)\n## The manufacturer has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(QA >= 2*QB)\n## The total production of products B and C must not exceed the production of product A.\nmodel.addCons(QB + QC <= QA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(QA))\n    print(\"Quantity of product B produced: \", model.getVal(QB))\n    print(\"Quantity of product C produced: \", model.getVal(QC))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production costs, demand, and production capacities are known.\n// {\"quantity of product A produced\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost.\n// Objective Function: Minimize: 10*QA + 15*QB + 20*QC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 1000 units per day.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-2:\nThe daily demand for products A, B, and C is 300, 200, and 150 units respectively.\n// QA >= 300\n// QB >= 200\n// QC >= 150\n\n## Generate Constraint-3:\nThe manufacturer has a policy to produce at least twice as many units of product A as product B.\n// QA >= 2*QB\n\n## Generate Constraint-4:\nThe total production of products B and C must not exceed the production of product A.\n// QB + QC <= QA",
        "question": "A manufacturer produces three types of products (A, B, C) and needs to decide the production quantities for each product to meet demand while minimizing costs. The production cost per unit for products A, B, and C is $10, $15, and $20 respectively. The manufacturer aims to minimize the total production cost. The production capacity of the factory is limited to 1000 units per day. The daily demand for products A, B, and C is 300, 200, and 150 units respectively. The manufacturer has a policy to produce at least twice as many units of product A as product B. The total production of products B and C must not exceed the production of product A. Please help the manufacturer determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each product produced\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of product A produced\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of product B produced\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*QA + 15*QB + 20*QC)\n\n# Add constraints\n## The production capacity of the factory is limited to 1000 units per day.\nmodel.addCons(QA + QB + QC <= 1000)\n## The daily demand for products A, B, and C is 300, 200, and 150 units respectively.\nmodel.addCons(QA >= 300)\nmodel.addCons(QB >= 200)\nmodel.addCons(QC >= 150)\n## The manufacturer has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(QA >= 2*QB)\n## The total production of products B and C must not exceed the production of product A.\nmodel.addCons(QB + QC <= QA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A produced: \", model.getVal(QA))\n    print(\"Quantity of product B produced: \", model.getVal(QB))\n    print(\"Quantity of product C produced: \", model.getVal(QC))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 747,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"overtime hours used\": \"OT\", \"range\": \"OT >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\n// Production_Cost = 10*A + 15*B + 20*C\n// Overtime_Cost = 30*OT\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe production capacity for normal hours is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\n// A >= 50\n// B >= 60\n// C >= 40\n\n## Generate Constraint-3:\nThe company can use up to 10 overtime hours per day.\n// OT <= 10\n\n## Generate Constraint-4:\nEach unit of Product A requires 0.5 hours of labor, Product B requires 0.6 hours, and Product C requires 0.7 hours. The total labor hours, including overtime, cannot exceed 120 hours per day.\n// 0.5*A + 0.6*B + 0.7*C + OT <= 120",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs. The cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The following table summarizes the labor requirements for each product:\n\n| Product | Labor Requirement per Unit |\n|---------|----------------------------|\n| A       | 0.5 hours                  |\n| B       | 0.6 hours                  |\n| C       | 0.7 hours                  |\n\nThe production capacity for normal hours is 100 units per day. The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day. The company can use up to 10 overtime hours per day. The total labor hours, including overtime, cannot exceed 120 hours per day.\n\nPlease help the company to minimize the total production and overtime costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and overtime hours\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nOT = model.addVar(vtype=\"CONTINUOUS\", name=\"OT\", lb=0) # overtime hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*A + 15*B + 20*C\nProduction_Cost = 10*A + 15*B + 20*C\n## Overtime_Cost = 30*OT\nOvertime_Cost = 30*OT\nmodel.addCons(obj == Production_Cost + Overtime_Cost)\n\n# Add constraints\n## The production capacity for normal hours is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 60)\nmodel.addCons(C >= 40)\n## The company can use up to 10 overtime hours per day.\nmodel.addCons(OT <= 10)\n## Each unit of Product A requires 0.5 hours of labor, Product B requires 0.6 hours, and Product C requires 0.7 hours. The total labor hours, including overtime, cannot exceed 120 hours per day.\nmodel.addCons(0.5*A + 0.6*B + 0.7*C + OT <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Overtime hours used: \", model.getVal(OT))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"overtime hours used\": \"OT\", \"range\": \"OT >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\n// Production_Cost = 10*A + 15*B + 20*C\n// Overtime_Cost = 30*OT\n// Objective Function: Minimize: Production_Cost + Overtime_Cost\n\n## Generate Constraint-1:\nThe production capacity for normal hours is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\n// A >= 50\n// B >= 60\n// C >= 40\n\n## Generate Constraint-3:\nThe company can use up to 10 overtime hours per day.\n// OT <= 10\n\n## Generate Constraint-4:\nEach unit of Product A requires 0.5 hours of labor, Product B requires 0.6 hours, and Product C requires 0.7 hours. The total labor hours, including overtime, cannot exceed 120 hours per day.\n// 0.5*A + 0.6*B + 0.7*C + OT <= 120",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to meet demand while minimizing production costs. The cost of producing one unit of Product A is $10, Product B is $15, and Product C is $20. Overtime costs are $30 per hour. The company aims to minimize the total production and overtime costs.\nThe production capacity for normal hours is 100 units per day. The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day. The company can use up to 10 overtime hours per day. Each unit of Product A requires 0.5 hours of labor, Product B requires 0.6 hours, and Product C requires 0.7 hours. The total labor hours, including overtime, cannot exceed 120 hours per day.\nPlease help the company determine the optimal number of units of each product to produce and the amount of overtime to use to minimize the total production and overtime costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product and overtime hours\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\nOT = model.addVar(vtype=\"CONTINUOUS\", name=\"OT\", lb=0) # overtime hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production_Cost = 10*A + 15*B + 20*C\nProduction_Cost = 10*A + 15*B + 20*C\n## Overtime_Cost = 30*OT\nOvertime_Cost = 30*OT\nmodel.addCons(obj == Production_Cost + Overtime_Cost)\n\n# Add constraints\n## The production capacity for normal hours is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for Product A is 50 units per day, Product B is 60 units per day, and Product C is 40 units per day.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 60)\nmodel.addCons(C >= 40)\n## The company can use up to 10 overtime hours per day.\nmodel.addCons(OT <= 10)\n## Each unit of Product A requires 0.5 hours of labor, Product B requires 0.6 hours, and Product C requires 0.7 hours. The total labor hours, including overtime, cannot exceed 120 hours per day.\nmodel.addCons(0.5*A + 0.6*B + 0.7*C + OT <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Number of units of Product C: \", model.getVal(C))\n    print(\"Overtime hours used: \", model.getVal(OT))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"number of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used\": \"Machine\", \"range\": \"Machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize the total profit from the sales of both products.\n// Objective Function: Maximize: 50*PA + 30*PB\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\n// 2*PA + 3*PB <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\n// PA + 2*PB <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 15 units per week.\n// PA >= 15\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 10 units per week.\n// PB >= 10",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $30. The following table summarizes the labor and machine hours required for each product.\n\n| Product | Labor Hours per Unit | Machine Hours per Unit |\n|---------|----------------------|------------------------|\n| A       | 2                    | 1                      |\n| B       | 3                    | 2                      |\n\nThe company has a total of 100 hours of labor and 50 machine hours available per week. The market demand for Product A is at least 15 units per week, and for Product B is at least 10 units per week. \n\nPlease help the company to maximize the total profit from the sales of both products, given the constraints on labor, machine hours, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # number of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # number of Product B produced\n## The number of hours of labor and machine hours used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\nMachine = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine\", lb=0) # number of machine hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 30*PB)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor.\nmodel.addCons(2*PA + 3*PB == Labor)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours.\nmodel.addCons(PA + 2*PB == Machine)\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(Labor <= 100)\n## The company has a total of 50 machine hours available per week.\nmodel.addCons(Machine <= 50)\n## The market demand for Product A is at least 15 units per week.\nmodel.addCons(PA >= 15)\n## The market demand for Product B is at least 10 units per week.\nmodel.addCons(PB >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(PA))\n    print(\"Number of Product B produced: \", model.getVal(PB))\n    print(\"Number of hours of labor used: \", model.getVal(Labor))\n    print(\"Number of machine hours used: \", model.getVal(Machine))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"number of Product A produced\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"Labor\", \"range\": \"Labor >= 0\", \"type\": \"real\"}\n// {\"number of machine hours used\": \"Machine\", \"range\": \"Machine >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling one unit of Product A is $50, and from Product B is $30. The company aims to maximize the total profit from the sales of both products.\n// Objective Function: Maximize: 50*PA + 30*PB\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor. The company has a total of 100 hours of labor available per week.\n// 2*PA + 3*PB <= 100\n\n## Generate Constraint-2:\nEach unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours. The company has a total of 50 machine hours available per week.\n// PA + 2*PB <= 50\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 15 units per week.\n// PA >= 15\n\n## Generate Constraint-4:\nThe market demand for Product B is at least 10 units per week.\n// PB >= 10",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to determine the optimal production quantities of each product to maximize profit while considering the available resources and market demand. The profit from selling one unit of Product A is $50, and from Product B is $30. Each unit of Product A requires 2 hours of labor and 1 machine hour, while each unit of Product B requires 3 hours of labor and 2 machine hours. The company has a total of 100 hours of labor and 50 machine hours available per week. The market demand for Product A is at least 15 units per week, and for Product B is at least 10 units per week. Please help the company to maximize the total profit from the sales of both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of Product A and Product B produced\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # number of Product A produced\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # number of Product B produced\n## The number of hours of labor and machine hours used\nLabor = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor\", lb=0) # number of hours of labor used\nMachine = model.addVar(vtype=\"CONTINUOUS\", name=\"Machine\", lb=0) # number of machine hours used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*PA + 30*PB)\n\n# Add constraints\n## Each unit of Product A requires 2 hours of labor, and each unit of Product B requires 3 hours of labor.\nmodel.addCons(2*PA + 3*PB == Labor)\n## Each unit of Product A requires 1 machine hour, and each unit of Product B requires 2 machine hours.\nmodel.addCons(PA + 2*PB == Machine)\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(Labor <= 100)\n## The company has a total of 50 machine hours available per week.\nmodel.addCons(Machine <= 50)\n## The market demand for Product A is at least 15 units per week.\nmodel.addCons(PA >= 15)\n## The market demand for Product B is at least 10 units per week.\nmodel.addCons(PB >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(PA))\n    print(\"Number of Product B produced: \", model.getVal(PB))\n    print(\"Number of hours of labor used: \", model.getVal(Labor))\n    print(\"Number of machine hours used: \", model.getVal(Machine))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs.\n// {\"number of chocolate cakes\": \"chocolate\", \"range\": \"chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"vanilla\", \"range\": \"vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"strawberry\", \"range\": \"strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"lemon\", \"range\": \"lemon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 cakes.\n// chocolate + vanilla + strawberry + lemon <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\n// chocolate >= 50\n// vanilla >= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\n// strawberry >= 20\n// lemon >= 20\n\n## Generate Constraint-4:\nThe total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes.\n// strawberry + lemon <= chocolate + vanilla",
        "question": "A bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs. The cost of producing each type of cake varies as shown in the following Table.\n\n| Cake Type   | Production Cost |\n|-------------|-----------------|\n| Chocolate   | $3              |\n| Vanilla     | $2              |\n| Strawberry  | $4              |\n| Lemon       | $3              |\n\nThe bakery has a daily production capacity of 200 cakes. The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand. Additionally, the bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand. The total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes.\n\nPlease help the bakery to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nchocolate = model.addVar(vtype=\"INTEGER\", name=\"chocolate\", lb=0) # number of chocolate cakes\nvanilla = model.addVar(vtype=\"INTEGER\", name=\"vanilla\", lb=0) # number of vanilla cakes\nstrawberry = model.addVar(vtype=\"INTEGER\", name=\"strawberry\", lb=0) # number of strawberry cakes\nlemon = model.addVar(vtype=\"INTEGER\", name=\"lemon\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 cakes.\nmodel.addCons(chocolate + vanilla + strawberry + lemon <= 200)\n## The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(chocolate >= 50)\nmodel.addCons(vanilla >= 30)\n## The bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\nmodel.addCons(strawberry >= 20)\nmodel.addCons(lemon >= 20)\n## The total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes.\nmodel.addCons(strawberry + lemon <= chocolate + vanilla)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(strawberry))\n    print(\"Number of lemon cakes: \", model.getVal(lemon))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs.\n// {\"number of chocolate cakes\": \"chocolate\", \"range\": \"chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"vanilla\", \"range\": \"vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"strawberry\", \"range\": \"strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of lemon cakes\": \"lemon\", \"range\": \"lemon >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery aims to minimize the total daily production cost.\n// Objective Function: Minimize: 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 cakes.\n// chocolate + vanilla + strawberry + lemon <= 200\n\n## Generate Constraint-2:\nThe bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\n// chocolate >= 50\n// vanilla >= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\n// strawberry >= 20\n// lemon >= 20\n\n## Generate Constraint-4:\nThe total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes.\n// strawberry + lemon <= chocolate + vanilla",
        "question": "A bakery is planning to produce four types of cakes: chocolate, vanilla, strawberry, and lemon. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand while minimizing costs. The cost of producing each type of cake varies: chocolate costs $3, vanilla costs $2, strawberry costs $4, and lemon costs $3. The bakery has a daily production capacity of 200 cakes. The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand. Additionally, the bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand. The total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes. Please help the bakery to minimize the total daily production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nchocolate = model.addVar(vtype=\"INTEGER\", name=\"chocolate\", lb=0) # number of chocolate cakes\nvanilla = model.addVar(vtype=\"INTEGER\", name=\"vanilla\", lb=0) # number of vanilla cakes\nstrawberry = model.addVar(vtype=\"INTEGER\", name=\"strawberry\", lb=0) # number of strawberry cakes\nlemon = model.addVar(vtype=\"INTEGER\", name=\"lemon\", lb=0) # number of lemon cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 3*chocolate + 2*vanilla + 4*strawberry + 3*lemon)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 cakes.\nmodel.addCons(chocolate + vanilla + strawberry + lemon <= 200)\n## The bakery must produce at least 50 chocolate cakes and 30 vanilla cakes daily to meet minimum customer demand.\nmodel.addCons(chocolate >= 50)\nmodel.addCons(vanilla >= 30)\n## The bakery must produce at least 20 strawberry cakes and 20 lemon cakes daily to meet minimum customer demand.\nmodel.addCons(strawberry >= 20)\nmodel.addCons(lemon >= 20)\n## The total number of strawberry and lemon cakes produced must not exceed the total number of chocolate and vanilla cakes.\nmodel.addCons(strawberry + lemon <= chocolate + vanilla)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(chocolate))\n    print(\"Number of vanilla cakes: \", model.getVal(vanilla))\n    print(\"Number of strawberry cakes: \", model.getVal(strawberry))\n    print(\"Number of lemon cakes: \", model.getVal(lemon))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of Product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*PA + 15*PB + 20*PC\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 100 hours. Producing one unit of A, B, and C requires 1, 2, and 3 hours respectively.\n// PA + 2*PB + 3*PC <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\n// PA >= 20\n// PB >= 10\n\n## Generate Constraint-3:\nThe company has a limited raw material supply. Producing one unit of A, B, and C requires 2, 3, and 4 units of raw material respectively. The total raw material available is 150 units.\n// 2*PA + 3*PB + 4*PC <= 150\n\n## Generate Constraint-4:\nThe company aims to produce at least 15 units of product C.\n// PC >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The production time and raw material requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit | Raw Material per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | 10$             | 1 hour                    | 2 units               |\n| B       | 15$             | 2 hours                   | 3 units               |\n| C       | 20$             | 3 hours                   | 4 units               |\n\nThe total production time for all products cannot exceed 100 hours. The market demand for product A is at least 20 units, and the demand for product B is at least 10 units. The company has a limited raw material supply, with a total of 150 units available. The company aims to produce at least 15 units of product C.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of Product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of Product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*PA + 15*PB + 20*PC)\n\n# Add constraints\n## The total production time for all products cannot exceed 100 hours.\nmodel.addCons(PA + 2*PB + 3*PC <= 100)\n## The market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\nmodel.addCons(PA >= 20)\nmodel.addCons(PB >= 10)\n## The company has a limited raw material supply.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 150)\n## The company aims to produce at least 15 units of product C.\nmodel.addCons(PC >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(PA))\n    print(\"Production quantity of Product B: \", model.getVal(PB))\n    print(\"Production quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of Product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20 respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*PA + 15*PB + 20*PC\n\n## Generate Constraint-1:\nThe total production time for all products cannot exceed 100 hours. Producing one unit of A, B, and C requires 1, 2, and 3 hours respectively.\n// PA + 2*PB + 3*PC <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\n// PA >= 20\n// PB >= 10\n\n## Generate Constraint-3:\nThe company has a limited raw material supply. Producing one unit of A, B, and C requires 2, 3, and 4 units of raw material respectively. The total raw material available is 150 units.\n// 2*PA + 3*PB + 4*PC <= 150\n\n## Generate Constraint-4:\nThe company aims to produce at least 15 units of product C.\n// PC >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $10, $15, and $20 respectively. The total production time for all products cannot exceed 100 hours, with producing one unit of A, B, and C requiring 1, 2, and 3 hours respectively. The market demand for product A is at least 20 units, and the demand for product B is at least 10 units. The company has a limited raw material supply, with producing one unit of A, B, and C requiring 2, 3, and 4 units of raw material respectively, and a total of 150 units of raw material available. The company aims to produce at least 15 units of product C. Please help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of Product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of Product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*PA + 15*PB + 20*PC)\n\n# Add constraints\n## The total production time for all products cannot exceed 100 hours.\nmodel.addCons(PA + 2*PB + 3*PC <= 100)\n## The market demand for product A is at least 20 units, and the demand for product B is at least 10 units.\nmodel.addCons(PA >= 20)\nmodel.addCons(PB >= 10)\n## The company has a limited raw material supply.\nmodel.addCons(2*PA + 3*PB + 4*PC <= 150)\n## The company aims to produce at least 15 units of product C.\nmodel.addCons(PC >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of Product A: \", model.getVal(PA))\n    print(\"Production quantity of Product B: \", model.getVal(PB))\n    print(\"Production quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product.\n// {\"number of units of Product A produced by Machine 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced by Machine 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 4\": \"B_M4\", \"range\": \"B_M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4\n\n## Generate Constraint-1:\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units.\n// A_M1 <= 100\n// A_M2 <= 120\n\n## Generate Constraint-2:\nThe daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units.\n// B_M3 <= 80\n// B_M4 <= 90\n\n## Generate Constraint-3:\nThe daily demand for Product A is 150 units, and for Product B is 100 units.\n// A_M1 + A_M2 >= 150\n// B_M3 + B_M4 >= 100\n\n## Generate Constraint-4:\nThe total production of Product A and Product B should not exceed 250 units per day.\n// A_M1 + A_M2 + B_M3 + B_M4 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product. The cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n\n| Machine | Product | Cost per Unit | Daily Capacity |\n|---------|---------|---------------|----------------|\n| 1       | A       | $10           | 100 units      |\n| 2       | A       | $12           | 120 units      |\n| 3       | B       | $8            | 80 units       |\n| 4       | B       | $9            | 90 units       |\n\nThe daily production capacity of each machine is specified in the table. The daily demand for Product A is 150 units, and for Product B is 100 units. The total production of Product A and Product B should not exceed 250 units per day.\n\nPlease help the company determine the optimal number of units of Product A produced by Machine 1 (A_M1), Product A produced by Machine 2 (A_M2), Product B produced by Machine 3 (B_M3), and Product B produced by Machine 4 (B_M4) to minimize the total production cost while meeting the daily demand and capacity constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced by each machine\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A produced by Machine 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A produced by Machine 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B produced by Machine 3\nB_M4 = model.addVar(vtype=\"INTEGER\", name=\"B_M4\", lb=0) # number of units of Product B produced by Machine 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4)\n\n# Add constraints\n## The daily production capacity of Machine 1 and Machine 2\nmodel.addCons(A_M1 <= 100)\nmodel.addCons(A_M2 <= 120)\n## The daily production capacity of Machine 3 and Machine 4\nmodel.addCons(B_M3 <= 80)\nmodel.addCons(B_M4 <= 90)\n## The daily demand for Product A and Product B\nmodel.addCons(A_M1 + A_M2 >= 150)\nmodel.addCons(B_M3 + B_M4 >= 100)\n## The total production of Product A and Product B should not exceed 250 units per day\nmodel.addCons(A_M1 + A_M2 + B_M3 + B_M4 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced by Machine 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A produced by Machine 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product B produced by Machine 3: \", model.getVal(B_M3))\n    print(\"Number of units of Product B produced by Machine 4: \", model.getVal(B_M4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1466,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product.\n// {\"number of units of Product A produced by Machine 1\": \"A_M1\", \"range\": \"A_M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product A produced by Machine 2\": \"A_M2\", \"range\": \"A_M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 3\": \"B_M3\", \"range\": \"B_M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B produced by Machine 4\": \"B_M4\", \"range\": \"B_M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9. The company aims to minimize the total production cost.\n// Objective Function: Minimize: 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4\n\n## Generate Constraint-1:\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units.\n// A_M1 <= 100\n// A_M2 <= 120\n\n## Generate Constraint-2:\nThe daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units.\n// B_M3 <= 80\n// B_M4 <= 90\n\n## Generate Constraint-3:\nThe daily demand for Product A is 150 units, and for Product B is 100 units.\n// A_M1 + A_M2 >= 150\n// B_M3 + B_M4 >= 100\n\n## Generate Constraint-4:\nThe total production of Product A and Product B should not exceed 250 units per day.\n// A_M1 + A_M2 + B_M3 + B_M4 <= 250",
        "question": "A manufacturing company produces two types of products: Product A and Product B. The company needs to decide how many units of each product to produce daily to meet demand while minimizing costs. The production process involves four machines: Machine 1, Machine 2, Machine 3, and Machine 4. Each machine can only produce one type of product. The cost of producing one unit of Product A on Machine 1 is $10, and on Machine 2 is $12. The cost of producing one unit of Product B on Machine 3 is $8, and on Machine 4 is $9.\nThe daily production capacity of Machine 1 is 100 units, and Machine 2 is 120 units. The daily production capacity of Machine 3 is 80 units, and Machine 4 is 90 units. The daily demand for Product A is 150 units, and for Product B is 100 units. The total production of Product A and Product B should not exceed 250 units per day.\nPlease help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced by each machine\nA_M1 = model.addVar(vtype=\"INTEGER\", name=\"A_M1\", lb=0) # number of units of Product A produced by Machine 1\nA_M2 = model.addVar(vtype=\"INTEGER\", name=\"A_M2\", lb=0) # number of units of Product A produced by Machine 2\nB_M3 = model.addVar(vtype=\"INTEGER\", name=\"B_M3\", lb=0) # number of units of Product B produced by Machine 3\nB_M4 = model.addVar(vtype=\"INTEGER\", name=\"B_M4\", lb=0) # number of units of Product B produced by Machine 4\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*A_M1 + 12*A_M2 + 8*B_M3 + 9*B_M4)\n\n# Add constraints\n## The daily production capacity of Machine 1 and Machine 2\nmodel.addCons(A_M1 <= 100)\nmodel.addCons(A_M2 <= 120)\n## The daily production capacity of Machine 3 and Machine 4\nmodel.addCons(B_M3 <= 80)\nmodel.addCons(B_M4 <= 90)\n## The daily demand for Product A and Product B\nmodel.addCons(A_M1 + A_M2 >= 150)\nmodel.addCons(B_M3 + B_M4 >= 100)\n## The total production of Product A and Product B should not exceed 250 units per day\nmodel.addCons(A_M1 + A_M2 + B_M3 + B_M4 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A produced by Machine 1: \", model.getVal(A_M1))\n    print(\"Number of units of Product A produced by Machine 2: \", model.getVal(A_M2))\n    print(\"Number of units of Product B produced by Machine 3: \", model.getVal(B_M3))\n    print(\"Number of units of Product B produced by Machine 4: \", model.getVal(B_M4))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\n// A >= 10\n// C <= 15\n\n## Generate Constraint-3:\nThe production of Product B must be at least twice the production of Product A.\n// B >= 2*A\n\n## Generate Constraint-4:\nThe total production of all products must not exceed 30 units.\n// A + B + C <= 30",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units. The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units. The production of Product B must be at least twice the production of Product A. The total production of all products must not exceed 30 units.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C <= 15)\n## The production of Product B must be at least twice the production of Product A.\nmodel.addCons(B >= 2*A)\n## The total production of all products must not exceed 30 units.\nmodel.addCons(A + B + C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units.\n// 2*A + 3*B + 4*C <= 100\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\n// A >= 10\n// C <= 15\n\n## Generate Constraint-3:\nThe production of Product B must be at least twice the production of Product A.\n// B >= 2*A\n\n## Generate Constraint-4:\nThe total production of all products must not exceed 30 units.\n// A + B + C <= 30",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company has a limited amount of raw material. Each unit of Product A requires 2 units of raw material, Product B requires 3 units, and Product C requires 4 units. The total available raw material is 100 units. The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units. The production of Product B must be at least twice the production of Product A. The total production of all products must not exceed 30 units. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for Product A is at least 10 units, and for Product C, it is at most 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(C <= 15)\n## The production of Product B must be at least twice the production of Product A.\nmodel.addCons(B >= 2*A)\n## The total production of all products must not exceed 30 units.\nmodel.addCons(A + B + C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 1000 kg.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at most 30 units.\n// B <= 30\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of Product C as Product A.\n// C >= 2*A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The following table summarizes the raw material requirements per unit of each product:\n\n| Product | Profit per Unit | Raw Material per Unit |\n|---------|-----------------|-----------------------|\n| A       | $50             | 2 kg                  |\n| B       | $70             | 3 kg                  |\n| C       | $60             | 4 kg                  |\n\nThe company has a limited amount of raw material, with a total of 1000 kg available. The market demand for Product A is at least 10 units, and for Product B, it is at most 30 units. Additionally, the company must produce at least twice as many units of Product C as Product A.\n\nPlease help the company to maximize the total profit from the production of these products, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at most 30 units.\nmodel.addCons(B <= 30)\n## The company must produce at least twice as many units of Product C as Product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"number of Product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 70*B + 60*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 1000 kg.\n// 2*A + 3*B + 4*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-3:\nThe market demand for Product B is at most 30 units.\n// B <= 30\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of Product C as Product A.\n// C >= 2*A",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for Product A, Product B, and Product C is $50, $70, and $60, respectively. The company has a limited amount of raw material. The raw material required to produce one unit of Product A, Product B, and Product C is 2 kg, 3 kg, and 4 kg, respectively, with a total of 1000 kg available. The market demand for Product A is at least 10 units, and for Product B, it is at most 30 units. Additionally, the company must produce at least twice as many units of Product C as Product A. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The market demand for Product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The market demand for Product B is at most 30 units.\nmodel.addCons(B <= 30)\n## The company must produce at least twice as many units of Product C as Product A.\nmodel.addCons(C >= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(A))\n    print(\"Number of Product B produced: \", model.getVal(B))\n    print(\"Number of Product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost.\n// {\"number of Product A produced\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 10*Product_A + 15*Product_B + 20*Product_C\n\n## Generate Constraint-1:\nThe market demand for Product A is at least 50 units.\n// Product_A >= 50\n\n## Generate Constraint-2:\nThe market demand for Product B is at least 75 units.\n// Product_B >= 75\n\n## Generate Constraint-3:\nThe market demand for Product C is at least 100 units.\n// Product_C >= 100\n\n## Generate Constraint-4:\nThe total production capacity of the company is 200 units per week.\n// Product_A + Product_B + Product_C <= 200",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost. The production cost per unit for each product is given in the following Table.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $10                      |\n| B       | $15                      |\n| C       | $20                      |\n\nThe market demand for Product A is at least 50 units, for Product B is at least 75 units, and for Product C is at least 100 units. The total production capacity of the company is 200 units per week. Please help the company to minimize the total production cost while meeting the market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of Product A produced\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of Product B produced\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Product_A + 15*Product_B + 20*Product_C)\n\n# Add constraints\n## The market demand for Product A is at least 50 units.\nmodel.addCons(Product_A >= 50)\n## The market demand for Product B is at least 75 units.\nmodel.addCons(Product_B >= 75)\n## The market demand for Product C is at least 100 units.\nmodel.addCons(Product_C >= 100)\n## The total production capacity of the company is 200 units per week.\nmodel.addCons(Product_A + Product_B + Product_C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Product_A))\n    print(\"Number of Product B produced: \", model.getVal(Product_B))\n    print(\"Number of Product C produced: \", model.getVal(Product_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost.\n// {\"number of Product A produced\": \"Product_A\", \"range\": \"Product_A >= 0\", \"type\": \"integer\"}\n// {\"number of Product B produced\": \"Product_B\", \"range\": \"Product_B >= 0\", \"type\": \"integer\"}\n// {\"number of Product C produced\": \"Product_C\", \"range\": \"Product_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand.\n// Objective Function: Minimize: 10*Product_A + 15*Product_B + 20*Product_C\n\n## Generate Constraint-1:\nThe market demand for Product A is at least 50 units.\n// Product_A >= 50\n\n## Generate Constraint-2:\nThe market demand for Product B is at least 75 units.\n// Product_B >= 75\n\n## Generate Constraint-3:\nThe market demand for Product C is at least 100 units.\n// Product_C >= 100\n\n## Generate Constraint-4:\nThe total production capacity of the company is 200 units per week.\n// Product_A + Product_B + Product_C <= 200",
        "question": "A manufacturing company produces three types of products: Product A, Product B, and Product C. The company needs to determine the number of each product to produce to meet market demand while optimizing its production cost. The production cost per unit for Product A, Product B, and Product C is $10, $15, and $20, respectively. The company aims to minimize the total production cost while meeting the market demand. The market demand for Product A is at least 50 units. The market demand for Product B is at least 75 units. The market demand for Product C is at least 100 units. The total production capacity of the company is 200 units per week. Please help the company determine the optimal number of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nProduct_A = model.addVar(vtype=\"INTEGER\", name=\"Product_A\", lb=0) # number of Product A produced\nProduct_B = model.addVar(vtype=\"INTEGER\", name=\"Product_B\", lb=0) # number of Product B produced\nProduct_C = model.addVar(vtype=\"INTEGER\", name=\"Product_C\", lb=0) # number of Product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 10*Product_A + 15*Product_B + 20*Product_C)\n\n# Add constraints\n## The market demand for Product A is at least 50 units.\nmodel.addCons(Product_A >= 50)\n## The market demand for Product B is at least 75 units.\nmodel.addCons(Product_B >= 75)\n## The market demand for Product C is at least 100 units.\nmodel.addCons(Product_C >= 100)\n## The total production capacity of the company is 200 units per week.\nmodel.addCons(Product_A + Product_B + Product_C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A produced: \", model.getVal(Product_A))\n    print(\"Number of Product B produced: \", model.getVal(Product_B))\n    print(\"Number of Product C produced: \", model.getVal(Product_C))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-3:\nThe total production of products B and C should not exceed 150 units.\n// B + C <= 150\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of product C.\n// C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The production time for each unit of products A, B, and C is 4 hours, 6 hours, and 5 hours, respectively.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 4 hours                  |\n| B       | $30             | 6 hours                  |\n| C       | $40             | 5 hours                  |\n\nThe company has a total of 1000 labor hours available. The market demand for product A is at least 100 units. The total production of products B and C should not exceed 150 units. The company must produce at least 50 units of product C.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The total production of products B and C should not exceed 150 units.\nmodel.addCons(B + C <= 150)\n## The company must produce at least 50 units of product C.\nmodel.addCons(C >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of A, B, and C requires 4, 6, and 5 hours, respectively.\n// 4*A + 6*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-3:\nThe total production of products B and C should not exceed 150 units.\n// B + C <= 150\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of product C.\n// C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products. The company has a total of 1000 labor hours available, with producing one unit of A, B, and C requiring 4, 6, and 5 hours, respectively. The market demand for product A is at least 100 units. The total production of products B and C should not exceed 150 units. The company must also produce at least 50 units of product C. Please help the company determine the number of each product to produce to maximize profit while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(4*A + 6*B + 5*C <= 1000)\n## The market demand for product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The total production of products B and C should not exceed 150 units.\nmodel.addCons(B + C <= 150)\n## The company must produce at least 50 units of product C.\nmodel.addCons(C >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 688,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material, which allows for the production of at most 100 units in total.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\n// 2*A + 3*B + 4*C <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 30 units, and the company must meet this demand.\n// A >= 30\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product B as product C.\n// B >= 2*C",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The following table summarizes the labor hours required for each product:\n\n| Product | Labor Hours Required |\n|---------|----------------------|\n| A       | 2 hours              |\n| B       | 3 hours              |\n| C       | 4 hours              |\n\nThe company has a limited amount of raw material, which allows for the production of at most 100 units in total. The total labor hours available per day are 200. The market demand for product A is at least 30 units, and the company must meet this demand. Additionally, the company has a policy to produce at least twice as many units of product B as product C.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a limited amount of raw material, which allows for the production of at most 100 units in total.\nmodel.addCons(A + B + C <= 100)\n## The production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The market demand for product A is at least 30 units, and the company must meet this demand.\nmodel.addCons(A >= 30)\n## The company has a policy to produce at least twice as many units of product B as product C.\nmodel.addCons(B >= 2*C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company aims to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material, which allows for the production of at most 100 units in total.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\n// 2*A + 3*B + 4*C <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 30 units, and the company must meet this demand.\n// A >= 30\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product B as product C.\n// B >= 2*C",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of each product to produce to maximize profit while considering the available resources and market demand. The profit per unit for products A, B, and C is $50, $30, and $40, respectively. The company has a limited amount of raw material, which allows for the production of at most 100 units in total. The production of each product requires a specific amount of labor hours: Product A requires 2 hours, B requires 3 hours, and C requires 4 hours, with a total of 200 labor hours available per day. The market demand for product A is at least 30 units, and the company must meet this demand. Additionally, the company has a policy to produce at least twice as many units of product B as product C. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each product produced\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of product C produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## The company has a limited amount of raw material, which allows for the production of at most 100 units in total.\nmodel.addCons(A + B + C <= 100)\n## The production of each product requires a specific amount of labor hours. Product A requires 2 hours, B requires 3 hours, and C requires 4 hours. The total labor hours available per day are 200.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The market demand for product A is at least 30 units, and the company must meet this demand.\nmodel.addCons(A >= 30)\n## The company has a policy to produce at least twice as many units of product B as product C.\nmodel.addCons(B >= 2*C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of product A produced: \", model.getVal(A))\n    print(\"Number of product B produced: \", model.getVal(B))\n    print(\"Number of product C produced: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 50 units of product B per week.\n// B >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Maximum Weekly Demand |\n|---------|--------------------------|-------------------------|-----------------------|\n| A       | $20                      | $50                     | 400 units             |\n| B       | $30                      | $70                     | 300 units             |\n| C       | $40                      | $90                     | 200 units             |\n\nThe total production capacity of the manufacturer is 1000 units per week. The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively. The manufacturer must produce at least 100 units of product A per week and at least 50 units of product B per week.\n\nPlease help the manufacturer to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n## The manufacturer must produce at least 50 units of product B per week.\nmodel.addCons(B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 50 units of product B per week.\n// B >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit. The total production capacity of the manufacturer is 1000 units per week. The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively. The manufacturer must produce at least 100 units of product A per week and at least 50 units of product B per week. Please help the manufacturer determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n## The manufacturer must produce at least 50 units of product B per week.\nmodel.addCons(B >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of special mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, each donut requires 0.15 pounds, and each mixed box requires 0.45 pounds.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day. Each type of pastry counts as one unit towards the oven capacity.\n// Cro + Muf + Don + Mix <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40\n\n## Generate Constraint-4:\nThe bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily.\n// Don <= 100",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts, and also sells special mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity. The profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box is $1.50. The bakery has a daily supply of 200 pounds of flour, with each croissant requiring 0.1 pounds, each muffin requiring 0.2 pounds, each donut requiring 0.15 pounds, and each mixed box requiring 0.45 pounds. The bakery's oven capacity allows for a maximum of 150 pastries per day, and each type of pastry counts as one unit towards the oven capacity. The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand. Additionally, the bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day.\nmodel.addCons(Cro + Muf + Don + Mix <= 150)\n## The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\n## The bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily.\nmodel.addCons(Don <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of special mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity.\n// {\"number of croissants\": \"Cro\", \"range\": \"Cro >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muf\", \"range\": \"Muf >= 0\", \"type\": \"integer\"}\n// {\"number of donuts\": \"Don\", \"range\": \"Don >= 0\", \"type\": \"integer\"}\n// {\"number of special mixed boxes\": \"Mix\", \"range\": \"Mix >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box (containing one of each pastry) is $1.50. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 200 pounds of flour. Each croissant requires 0.1 pounds of flour, each muffin requires 0.2 pounds, each donut requires 0.15 pounds, and each mixed box requires 0.45 pounds.\n// 0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day. Each type of pastry counts as one unit towards the oven capacity.\n// Cro + Muf + Don + Mix <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\n// Cro >= 50\n// Muf >= 40\n\n## Generate Constraint-4:\nThe bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily.\n// Don <= 100",
        "question": "A small bakery produces three types of pastries: croissants, muffins, and donuts, and also sells special mixed boxes containing one of each pastry. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the limited ingredients and storage capacity. The profit from selling each croissant is $0.50, each muffin is $0.60, each donut is $0.40, and each mixed box is $1.50. The bakery has a daily supply of 200 pounds of flour, with each croissant requiring 0.1 pounds of flour, each muffin requiring 0.2 pounds, each donut requiring 0.15 pounds, and each mixed box requiring 0.45 pounds. The bakery's oven capacity allows for a maximum of 150 pastries per day, with each type of pastry counting as one unit towards the oven capacity. The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand. Additionally, the bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCro = model.addVar(vtype=\"INTEGER\", name=\"Cro\", lb=0) # number of croissants\nMuf = model.addVar(vtype=\"INTEGER\", name=\"Muf\", lb=0) # number of muffins\nDon = model.addVar(vtype=\"INTEGER\", name=\"Don\", lb=0) # number of donuts\nMix = model.addVar(vtype=\"INTEGER\", name=\"Mix\", lb=0) # number of special mixed boxes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Cro + 0.60*Muf + 0.40*Don + 1.50*Mix)\n\n# Add constraints\n## The bakery has a daily supply of 200 pounds of flour.\nmodel.addCons(0.1*Cro + 0.2*Muf + 0.15*Don + 0.45*Mix <= 200)\n## The bakery has a limited oven capacity, which can bake a maximum of 150 pastries per day.\nmodel.addCons(Cro + Muf + Don + Mix <= 150)\n## The bakery must produce at least 50 croissants and 40 muffins per day to meet the minimum demand.\nmodel.addCons(Cro >= 50)\nmodel.addCons(Muf >= 40)\n## The bakery has a storage constraint that allows for a maximum of 100 donuts to be stored daily.\nmodel.addCons(Don <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants: \", model.getVal(Cro))\n    print(\"Number of muffins: \", model.getVal(Muf))\n    print(\"Number of donuts: \", model.getVal(Don))\n    print(\"Number of special mixed boxes: \", model.getVal(Mix))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of oats\": \"O\", \"range\": \"O >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*B + 100*O\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// W + C + B + O <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer.\n// W + C + 0.5*B + 0.5*O <= 60\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to meet contractual obligations.\n// W >= 10\n\n## Generate Constraint-4:\nTo maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop.\n// C >= 5, B >= 5, O >= 5",
        "question": "A farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources. The profit per acre for each crop is as follows:\n\n| Crop   | Profit per Acre |\n|--------|-----------------|\n| Wheat  | $200            |\n| Corn   | $300            |\n| Barley | $150            |\n| Oats   | $100            |\n\nThe total available land for farming is 100 acres. The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer. The farmer must plant at least 10 acres of wheat to meet contractual obligations. To maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\nO = model.addVar(vtype=\"INTEGER\", name=\"O\", lb=0) # acres of oats\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*B + 100*O)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(W + C + B + O <= 100)\n## The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops.\nmodel.addCons(W + C + 0.5*B + 0.5*O <= 60)\n## The farmer must plant at least 10 acres of wheat to meet contractual obligations.\nmodel.addCons(W >= 10)\n## To maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop.\nmodel.addCons(C >= 5)\nmodel.addCons(B >= 5)\nmodel.addCons(O >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of barley: \", model.getVal(B))\n    print(\"Acres of oats: \", model.getVal(O))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of oats\": \"O\", \"range\": \"O >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The farmer wants to maximize the total profit from all crops.\n// Objective Function: Maximize: 200*W + 300*C + 150*B + 100*O\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// W + C + B + O <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer.\n// W + C + 0.5*B + 0.5*O <= 60\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of wheat to meet contractual obligations.\n// W >= 10\n\n## Generate Constraint-4:\nTo maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop.\n// C >= 5, B >= 5, O >= 5",
        "question": "A farmer has a limited amount of land and resources to grow four types of crops: wheat, corn, barley, and oats. The farmer needs to decide how many acres to allocate to each crop to maximize profit while considering the limitations of land and resources. The profit per acre for wheat is $200, for corn is $300, for barley is $150, and for oats is $100. The total available land for farming is 100 acres. The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops. Each acre of wheat and corn requires 1 unit of fertilizer, while each acre of barley and oats requires 0.5 units of fertilizer. The farmer must plant at least 10 acres of wheat to meet contractual obligations. To maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop. Please help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The acres of each crop\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\nO = model.addVar(vtype=\"INTEGER\", name=\"O\", lb=0) # acres of oats\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 200*W + 300*C + 150*B + 100*O)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(W + C + B + O <= 100)\n## The farmer has a limited amount of fertilizer, which is sufficient for only 60 acres of crops.\nmodel.addCons(W + C + 0.5*B + 0.5*O <= 60)\n## The farmer must plant at least 10 acres of wheat to meet contractual obligations.\nmodel.addCons(W >= 10)\n## To maintain crop diversity and reduce risk, the farmer decides to plant at least 5 acres of each crop.\nmodel.addCons(C >= 5)\nmodel.addCons(B >= 5)\nmodel.addCons(O >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of wheat: \", model.getVal(W))\n    print(\"Acres of corn: \", model.getVal(C))\n    print(\"Acres of barley: \", model.getVal(B))\n    print(\"Acres of oats: \", model.getVal(O))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000\n\n## Generate Constraint-4:\nThe labor cost for producing smartphones is $30 per unit, for tablets is $40 per unit, and for laptops is $50 per unit. The company has a daily labor budget of $45,000.\n// 30*Smart + 40*Tablets + 50*Laptops <= 45000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The following table summarizes the cost of raw materials and labor for each device.\n\n| Device     | Profit per Unit | Raw Material Cost | Labor Cost |\n|------------|-----------------|-------------------|------------|\n| Smartphones| $100            | $50               | $30        |\n| Tablets    | $150            | $75               | $40        |\n| Laptops    | $200            | $100              | $50        |\n\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day. The company has a limited budget for raw materials, which is $120,000 per day, and a daily labor budget of $45,000. \n\nPlease help the company to maximize the total profit from the production of these devices while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n## The labor cost for producing smartphones is $30 per unit, for tablets is $40 per unit, and for laptops is $50 per unit.\nmodel.addCons(30*Smart + 40*Tablets + 50*Laptops <= 45000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $120,000 per day. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000\n\n## Generate Constraint-4:\nThe labor cost for producing smartphones is $30 per unit, for tablets is $40 per unit, and for laptops is $50 per unit. The company has a daily labor budget of $45,000.\n// 30*Smart + 40*Tablets + 50*Laptops <= 45000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 1000 devices to be produced daily. The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day. The company has a limited budget for raw materials, which is $120,000 per day, with costs of $50 per smartphone, $75 per tablet, and $100 per laptop. Additionally, the company has a daily labor budget of $45,000, with labor costs of $30 per smartphone, $40 per tablet, and $50 per laptop. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices to be produced daily.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per day, and the demand for tablets is at least 150 units per day.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## The company has a limited budget for raw materials, which is $120,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n## The labor cost for producing smartphones is $30 per unit, for tablets is $40 per unit, and for laptops is $50 per unit.\nmodel.addCons(30*Smart + 40*Tablets + 50*Laptops <= 45000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// Smart >= 2 * Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\nThe production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. The company has a policy to produce at least twice as many smartphones as tablets.\n\nPlease help the company to determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce to maximize profit, considering the constraints mentioned above.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n## The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(Smart >= 2 * Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// Smart >= 2 * Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices. The production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. The company has a policy to produce at least twice as many smartphones as tablets. Please help the company determine the optimal production quantities for each device to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n## The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(Smart >= 2 * Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// Smart >= 2 * Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\nThe production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. The company has a policy to produce at least twice as many smartphones as tablets.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce to maximize profit, considering the constraints provided.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n## The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(Smart >= 2 * Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 1000 devices per month.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\n// Smart >= 200\n// Tablets >= 150\n\n## Generate Constraint-3:\nDue to limited resources, the production of laptops cannot exceed 300 units per month.\n// Laptops <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// Smart >= 2 * Tablets",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 1000 devices per month. The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month. Due to limited resources, the production of laptops cannot exceed 300 units per month. The company has a policy to produce at least twice as many smartphones as tablets. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 1000 devices per month.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per month, and for tablets, it is at least 150 units per month.\nmodel.addCons(Smart >= 200)\nmodel.addCons(Tablets >= 150)\n## Due to limited resources, the production of laptops cannot exceed 300 units per month.\nmodel.addCons(Laptops <= 300)\n## The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(Smart >= 2 * Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand.\n// {\"number of loaves of whole wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of baguettes\": \"Baguettes\", \"range\": \"Baguettes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\n// Wheat + Rye + Sourdough + Baguettes <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\n// Wheat >= 100, Rye >= 80, Sourdough >= 120, Baguettes >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\n// Wheat + Rye + Sourdough + Baguettes <= 300\n\n## Generate Constraint-4:\nThe bakery has a labor constraint. It can only produce up to 250 loaves per day due to labor availability.\n// Wheat + Rye + Sourdough + Baguettes <= 250",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand. The profit per loaf for each type of bread is as follows:\n\n| Bread Type       | Profit per Loaf |\n|------------------|-----------------|\n| Whole Wheat      | $2              |\n| Rye              | $2.50           |\n| Sourdough        | $3              |\n| Baguettes        | $1.50           |\n\nThe bakery has a limited amount of flour available, with a maximum of 500 pounds per day, and each loaf of bread requires 1 pound of flour. The bakery also faces daily demand constraints: at least 100 loaves of whole wheat bread, 80 loaves of rye bread, 120 loaves of sourdough bread, and 150 loaves of baguettes must be produced. Additionally, the bakery's oven capacity is limited to 300 loaves per day, and labor availability restricts the total production to 250 loaves per day.\n\nPlease help the bakery to maximize the total profit by determining the optimal number of loaves to produce for each type of bread, considering all the constraints mentioned.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nBaguettes = model.addVar(vtype=\"INTEGER\", name=\"Baguettes\", lb=0) # number of loaves of baguettes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes)\n\n# Add constraints\n## The bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 500)\n## The bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 120)\nmodel.addCons(Baguettes >= 150)\n## The bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 300)\n## The bakery has a labor constraint. It can only produce up to 250 loaves per day due to labor availability.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of baguettes: \", model.getVal(Baguettes))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand.\n// {\"number of loaves of whole wheat bread\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of baguettes\": \"Baguettes\", \"range\": \"Baguettes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50.\nThe bakery wants to maximize the total profit.\n// Objective Function: Maximize: 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\n// Wheat + Rye + Sourdough + Baguettes <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\n// Wheat >= 100, Rye >= 80, Sourdough >= 120, Baguettes >= 150\n\n## Generate Constraint-3:\nThe bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\n// Wheat + Rye + Sourdough + Baguettes <= 300\n\n## Generate Constraint-4:\nThe bakery has a labor constraint. It can only produce up to 250 loaves per day due to labor availability.\n// Wheat + Rye + Sourdough + Baguettes <= 250",
        "question": "A bakery produces four types of bread: whole wheat, rye, sourdough, and baguettes. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of raw material availability and demand. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for baguettes is $1.50. The bakery has a limited amount of flour available, with a maximum of 500 pounds per day, and each loaf requires 1 pound of flour. The bakery also faces daily demand constraints: at least 100 loaves of whole wheat bread, 80 loaves of rye bread, 120 loaves of sourdough bread, and 150 loaves of baguettes must be produced. Additionally, the bakery's oven capacity is limited to 300 loaves per day, and labor availability restricts the total production to 250 loaves per day. Please help the bakery maximize the total profit by determining the optimal number of loaves to produce for each type of bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of loaves of whole wheat bread\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of loaves of rye bread\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of loaves of sourdough bread\nBaguettes = model.addVar(vtype=\"INTEGER\", name=\"Baguettes\", lb=0) # number of loaves of baguettes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 2.50*Rye + 3*Sourdough + 1.50*Baguettes)\n\n# Add constraints\n## The bakery has a limited amount of flour available. It can use up to 500 pounds of flour per day. Each loaf of bread requires 1 pound of flour.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 500)\n## The bakery has a daily demand for each type of bread. The demand for whole wheat bread is at least 100 loaves, for rye bread is at least 80 loaves, for sourdough bread is at least 120 loaves, and for baguettes is at least 150 loaves.\nmodel.addCons(Wheat >= 100)\nmodel.addCons(Rye >= 80)\nmodel.addCons(Sourdough >= 120)\nmodel.addCons(Baguettes >= 150)\n## The bakery has a limited oven capacity. The oven can handle up to 300 loaves per day.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 300)\n## The bakery has a labor constraint. It can only produce up to 250 loaves per day due to labor availability.\nmodel.addCons(Wheat + Rye + Sourdough + Baguettes <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(Wheat))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(Sourdough))\n    print(\"Number of loaves of baguettes: \", model.getVal(Baguettes))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of loaves of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of pumpernickel bread\": \"PDB\", \"range\": \"PDB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery aims to maximize its total daily profit from bread sales.\n// Objective Function: Maximize: 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 pounds of yeast. The total daily yeast supply is 1 pound.\n// 0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1\n\n## Generate Constraint-3:\nThe bakery has a limited number of labor hours. Each loaf of bread requires 15 minutes of labor. The total daily labor hours available are 480 minutes.\n// (WWB + RB + SDB + PDB) * 15 <= 480 * 60\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// WWB >= 50, RB >= 50, SDB >= 50, PDB >= 50",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor. The profit per loaf for each type of bread is given in the following Table.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Whole Wheat   | $2              |\n| Rye           | $2.50           |\n| Sourdough     | $3              |\n| Pumpernickel  | $2.75           |\n\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds. The bakery also has a limited supply of yeast, with each loaf of bread requiring 0.01 pounds and a total daily yeast supply of 1 pound. Additionally, each loaf of bread requires 15 minutes of labor, and the total daily labor hours available are 480 minutes. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n\nPlease help the bakery to maximize its total daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWWB = model.addVar(vtype=\"INTEGER\", name=\"WWB\", lb=0) # number of loaves of whole wheat bread\nRB = model.addVar(vtype=\"INTEGER\", name=\"RB\", lb=0) # number of loaves of rye bread\nSDB = model.addVar(vtype=\"INTEGER\", name=\"SDB\", lb=0) # number of loaves of sourdough bread\nPDB = model.addVar(vtype=\"INTEGER\", name=\"PDB\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1)\n## The bakery has a limited number of labor hours.\nmodel.addCons((WWB + RB + SDB + PDB) * 15 <= 480 * 60)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WWB >= 50)\nmodel.addCons(RB >= 50)\nmodel.addCons(SDB >= 50)\nmodel.addCons(PDB >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WWB))\n    print(\"Number of loaves of rye bread: \", model.getVal(RB))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SDB))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(PDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor.\n// {\"number of loaves of whole wheat bread\": \"WWB\", \"range\": \"WWB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of sourdough bread\": \"SDB\", \"range\": \"SDB >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of pumpernickel bread\": \"PDB\", \"range\": \"PDB >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75.\nThe bakery aims to maximize its total daily profit from bread sales.\n// Objective Function: Maximize: 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of whole wheat bread requires 0.5 pounds of flour, each loaf of rye bread requires 0.4 pounds, each loaf of sourdough bread requires 0.3 pounds, and each loaf of pumpernickel bread requires 0.6 pounds. The total daily flour supply is 200 pounds.\n// 0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 pounds of yeast. The total daily yeast supply is 1 pound.\n// 0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1\n\n## Generate Constraint-3:\nThe bakery has a limited number of labor hours. Each loaf of bread requires 15 minutes of labor. The total daily labor hours available are 480 minutes.\n// (WWB + RB + SDB + PDB) * 15 <= 480 * 60\n\n## Generate Constraint-4:\nThe bakery must produce at least 50 loaves of each type of bread to meet contractual obligations.\n// WWB >= 50, RB >= 50, SDB >= 50, PDB >= 50",
        "question": "A small bakery produces four types of bread: whole wheat, rye, sourdough, and pumpernickel. The bakery needs to determine the optimal number of loaves to produce for each type of bread to maximize profit while considering the constraints of available ingredients and labor. The profit per loaf for whole wheat bread is $2, the profit per loaf for rye bread is $2.50, the profit per loaf for sourdough bread is $3, and the profit per loaf for pumpernickel bread is $2.75. The bakery has a limited supply of flour, with each loaf of bread requiring a certain amount of flour, and a total daily flour supply of 200 pounds. The bakery also has a limited supply of yeast, with each loaf requiring 0.01 pounds and a total daily yeast supply of 1 pound. Additionally, the bakery has a limited number of labor hours, with each loaf requiring 15 minutes of labor and a total daily labor hours available of 480 minutes. The bakery must produce at least 50 loaves of each type of bread to meet contractual obligations. Please help the bakery to maximize its total daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWWB = model.addVar(vtype=\"INTEGER\", name=\"WWB\", lb=0) # number of loaves of whole wheat bread\nRB = model.addVar(vtype=\"INTEGER\", name=\"RB\", lb=0) # number of loaves of rye bread\nSDB = model.addVar(vtype=\"INTEGER\", name=\"SDB\", lb=0) # number of loaves of sourdough bread\nPDB = model.addVar(vtype=\"INTEGER\", name=\"PDB\", lb=0) # number of loaves of pumpernickel bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*WWB + 2.50*RB + 3*SDB + 2.75*PDB)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*WWB + 0.4*RB + 0.3*SDB + 0.6*PDB <= 200)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*WWB + 0.01*RB + 0.01*SDB + 0.01*PDB <= 1)\n## The bakery has a limited number of labor hours.\nmodel.addCons((WWB + RB + SDB + PDB) * 15 <= 480 * 60)\n## The bakery must produce at least 50 loaves of each type of bread.\nmodel.addCons(WWB >= 50)\nmodel.addCons(RB >= 50)\nmodel.addCons(SDB >= 50)\nmodel.addCons(PDB >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of whole wheat bread: \", model.getVal(WWB))\n    print(\"Number of loaves of rye bread: \", model.getVal(RB))\n    print(\"Number of loaves of sourdough bread: \", model.getVal(SDB))\n    print(\"Number of loaves of pumpernickel bread: \", model.getVal(PDB))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time.\n// {\"number of white breads\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of white bread requires 0.5 kg of flour, whole wheat bread requires 0.6 kg, rye bread requires 0.7 kg, and sourdough bread requires 0.8 kg. The total daily flour supply is 500 kg.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The total daily yeast supply is 3 kg.\n// 0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3\n\n## Generate Constraint-3:\nThe bakery has a limited oven time. Each loaf of bread requires 15 minutes of oven time. The total daily oven time available is 12 hours.\n// (White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum order requirements from local stores.\n// White >= 100, WholeWheat >= 100, Rye >= 100, Sourdough >= 100",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time. The profit per loaf for each type of bread is as follows: white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| White         | $1.50           |\n| Whole Wheat   | $2.00           |\n| Rye           | $2.50           |\n| Sourdough     | $3.00           |\n\nThe bakery has a limited supply of flour, with each loaf of white bread requiring 0.5 kg of flour, whole wheat bread requiring 0.6 kg, rye bread requiring 0.7 kg, and sourdough bread requiring 0.8 kg. The total daily flour supply is 500 kg. The bakery also has a limited supply of yeast, with each loaf of bread requiring 0.01 kg, and the total daily yeast supply is 3 kg. Additionally, each loaf of bread requires 15 minutes of oven time, and the total daily oven time available is 12 hours.\n\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum order requirements from local stores.\n\nPlease help the bakery to maximize its daily profit from bread sales while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of white breads\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3)\n## The bakery has a limited oven time.\nmodel.addCons((White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(White >= 100)\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white breads: \", model.getVal(White))\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1366,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time.\n// {\"number of white breads\": \"White\", \"range\": \"White >= 0\", \"type\": \"integer\"}\n// {\"number of whole wheat breads\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough breads\": \"Sourdough\", \"range\": \"Sourdough >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour. Each loaf of white bread requires 0.5 kg of flour, whole wheat bread requires 0.6 kg, rye bread requires 0.7 kg, and sourdough bread requires 0.8 kg. The total daily flour supply is 500 kg.\n// 0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery has a limited supply of yeast. Each loaf of bread requires 0.01 kg of yeast. The total daily yeast supply is 3 kg.\n// 0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3\n\n## Generate Constraint-3:\nThe bakery has a limited oven time. Each loaf of bread requires 15 minutes of oven time. The total daily oven time available is 12 hours.\n// (White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 loaves of each type of bread to meet the minimum order requirements from local stores.\n// White >= 100, WholeWheat >= 100, Rye >= 100, Sourdough >= 100",
        "question": "A bakery produces four types of bread: white, whole wheat, rye, and sourdough. The bakery needs to determine the optimal daily production quantity for each type of bread to maximize profit while considering the limited resources such as flour, yeast, and oven time. The profit per loaf of white bread is $1.50, whole wheat bread is $2.00, rye bread is $2.50, and sourdough bread is $3.00. The bakery has a limited supply of flour, with each loaf of white bread requiring 0.5 kg of flour, whole wheat bread requiring 0.6 kg, rye bread requiring 0.7 kg, and sourdough bread requiring 0.8 kg, with a total daily flour supply of 500 kg. The bakery also has a limited supply of yeast, with each loaf of bread requiring 0.01 kg of yeast and a total daily yeast supply of 3 kg. Additionally, the bakery has a limited oven time, with each loaf of bread requiring 15 minutes of oven time and a total daily oven time available of 12 hours. The bakery must produce at least 100 loaves of each type of bread to meet the minimum order requirements from local stores. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread\nWhite = model.addVar(vtype=\"INTEGER\", name=\"White\", lb=0) # number of white breads\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nSourdough = model.addVar(vtype=\"INTEGER\", name=\"Sourdough\", lb=0) # number of sourdough breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*White + 2.00*WholeWheat + 2.50*Rye + 3.00*Sourdough)\n\n# Add constraints\n## The bakery has a limited supply of flour.\nmodel.addCons(0.5*White + 0.6*WholeWheat + 0.7*Rye + 0.8*Sourdough <= 500)\n## The bakery has a limited supply of yeast.\nmodel.addCons(0.01*White + 0.01*WholeWheat + 0.01*Rye + 0.01*Sourdough <= 3)\n## The bakery has a limited oven time.\nmodel.addCons((White + WholeWheat + Rye + Sourdough) * 15 <= 12 * 60)\n## The bakery must produce at least 100 loaves of each type of bread.\nmodel.addCons(White >= 100)\nmodel.addCons(WholeWheat >= 100)\nmodel.addCons(Rye >= 100)\nmodel.addCons(Sourdough >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of white breads: \", model.getVal(White))\n    print(\"Number of whole wheat breads: \", model.getVal(WholeWheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of sourdough breads: \", model.getVal(Sourdough))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\n// Croissant + Muffin >= 100\n\n## Generate Constraint-4:\nThe bakery should not produce more than 200 croissants per day to maintain product quality.\n// Croissant <= 200",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The following table summarizes the requirements for each type of pastry:\n\n| Pastry   | Oven Time per Unit | Flour per Unit |\n|----------|--------------------|----------------|\n| Croissant| 0.1 hours          | 0.05 pounds    |\n| Muffin   | 0.2 hours          | 0.1 pounds     |\n\nThe bakery has a total of 8 hours of oven time and 20 pounds of flour available daily. The bakery must produce at least 100 pastries in total each day to meet minimum customer demand. Additionally, the bakery should not produce more than 200 croissants per day to maintain product quality. \n\nPlease help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 20)\n## The bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissant + Muffin >= 100)\n## The bakery should not produce more than 200 croissants per day to maintain product quality.\nmodel.addCons(Croissant <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity.\n// {\"number of croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. The bakery aims to maximize its daily profit from pastry sales.\n// Objective Function: Maximize: 0.50*Croissant + 0.70*Muffin\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissant + 0.2*Muffin <= 8\n\n## Generate Constraint-2:\nEach croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\n// 0.05*Croissant + 0.1*Muffin <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\n// Croissant + Muffin >= 100\n\n## Generate Constraint-4:\nThe bakery should not produce more than 200 croissants per day to maintain product quality.\n// Croissant <= 200",
        "question": "A bakery specializes in producing two types of pastries: croissants and muffins. The bakery needs to decide on the optimal number of each type of pastry to produce daily to maximize profit while considering the limited availability of ingredients and production capacity. The profit from selling each croissant is $0.50, and the profit from selling each muffin is $0.70. Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time, with a total of 8 hours of oven time available daily. Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour, with a total of 20 pounds of flour available daily. The bakery must produce at least 100 pastries in total each day to meet minimum customer demand. Additionally, the bakery should not produce more than 200 croissants per day to maintain product quality. Please help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # number of croissants\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissant + 0.70*Muffin)\n\n# Add constraints\n## Each croissant requires 0.1 hours of oven time and each muffin requires 0.2 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.1*Croissant + 0.2*Muffin <= 8)\n## Each croissant uses 0.05 pounds of flour and each muffin uses 0.1 pounds of flour. The bakery has a total of 20 pounds of flour available daily.\nmodel.addCons(0.05*Croissant + 0.1*Muffin <= 20)\n## The bakery must produce at least 100 pastries in total each day to meet minimum customer demand.\nmodel.addCons(Croissant + Muffin >= 100)\n## The bakery should not produce more than 200 croissants per day to maintain product quality.\nmodel.addCons(Croissant <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Muffins: \", model.getVal(Muffin))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of sugar required\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, and from each vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Choc + Van <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\n// Choc + 0.5*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\n// Choc >= 20\n// Van >= 30\n\n## Generate Constraint-4:\nThe total number of cakes produced daily should not exceed 50 to maintain quality.\n// Choc + Van <= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement. The profit from each chocolate cake is $5, and from each vanilla cake is $4. The following table shows the ingredients required for each type of cake:\n\n| Cake Type | Eggs Required | Sugar Required |\n|-----------|---------------|----------------|\n| Chocolate | 2             | 1 kg           |\n| Vanilla   | 1             | 0.5 kg         |\n\nThe bakery has a daily supply of 100 eggs and 60 kg of sugar. The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand. The total number of cakes produced daily should not exceed 50 to maintain quality. Please help the bakery to maximize its daily profit from cake sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Choc + Van <= 100)\n## Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\nmodel.addCons(Choc + 0.5*Van <= 60)\n## The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 30)\n## The total number of cakes produced daily should not exceed 50 to maintain quality.\nmodel.addCons(Choc + Van <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement.\n// {\"number of chocolate cakes\": \"Choc\", \"range\": \"Choc >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of eggs required\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"integer\"}\n// {\"number of sugar required\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each chocolate cake is $5, and from each vanilla cake is $4. The bakery aims to maximize its daily profit from cake sales.\n// Objective Function: Maximize: 5*Choc + 4*Van\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\n// 2*Choc + Van <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\n// Choc + 0.5*Van <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\n// Choc >= 20\n// Van >= 30\n\n## Generate Constraint-4:\nThe total number of cakes produced daily should not exceed 50 to maintain quality.\n// Choc + Van <= 50",
        "question": "A bakery specializes in producing two types of cakes: chocolate and vanilla. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and the minimum daily production requirement. The profit from each chocolate cake is $5, and from each vanilla cake is $4. Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs. Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar. The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand. The total number of cakes produced daily should not exceed 50 to maintain quality. Please help the bakery to maximize its daily profit from cake sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce daily\nChoc = model.addVar(vtype=\"INTEGER\", name=\"Choc\", lb=0) # number of chocolate cakes\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of vanilla cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Choc + 4*Van)\n\n# Add constraints\n## Each chocolate cake requires 2 eggs, and each vanilla cake requires 1 egg. The bakery has a daily supply of 100 eggs.\nmodel.addCons(2*Choc + Van <= 100)\n## Each chocolate cake requires 1 kg of sugar, and each vanilla cake requires 0.5 kg of sugar. The bakery has a daily supply of 60 kg of sugar.\nmodel.addCons(Choc + 0.5*Van <= 60)\n## The bakery must produce at least 20 chocolate cakes and 30 vanilla cakes daily to meet customer demand.\nmodel.addCons(Choc >= 20)\nmodel.addCons(Van >= 30)\n## The total number of cakes produced daily should not exceed 50 to maintain quality.\nmodel.addCons(Choc + Van <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes: \", model.getVal(Choc))\n    print(\"Number of vanilla cakes: \", model.getVal(Van))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for wheat bread\": \"Wheat_Oven\", \"range\": \"Wheat_Oven >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for rye bread\": \"Rye_Oven\", \"range\": \"Rye_Oven >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread. The total daily flour supply is 200 kg.\n// Wheat + 1.5*Rye <= 200\n\n## Generate Constraint-2:\nThe bakery's oven can only operate for a maximum of 12 hours per day. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time.\n// 0.2*Wheat + 0.3*Rye <= 12\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread.\n// Wheat_Oven <= Rye_Oven",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Bread | Flour Usage (kg) | Oven Time (hours) |\n|------------|------------------|------------------|-------------------|\n| Wheat      | $2               | 1                | 0.2               |\n| Rye        | $3               | 1.5              | 0.3               |\n\nThe bakery has a limited amount of flour available each day, with a total daily supply of 200 kg. The bakery's oven can only operate for a maximum of 12 hours per day. The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads. Additionally, the bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread.\n\nPlease help the bakery to maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The number of hours of oven use for each type of bread\nWheat_Oven = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven\", lb=0) # number of hours of oven use for wheat bread\nRye_Oven = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven\", lb=0) # number of hours of oven use for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(Wheat + 1.5*Rye <= 200)\n## The bakery's oven can only operate for a maximum of 12 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 12)\n## The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread.\nmodel.addCons(Wheat_Oven <= Rye_Oven)\nmodel.addCons(Wheat_Oven == 0.2*Wheat)\nmodel.addCons(Rye_Oven == 0.3*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of hours of oven use for wheat bread: \", model.getVal(Wheat_Oven))\n    print(\"Number of hours of oven use for rye bread: \", model.getVal(Rye_Oven))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for wheat bread\": \"Wheat_Oven\", \"range\": \"Wheat_Oven >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven use for rye bread\": \"Rye_Oven\", \"range\": \"Rye_Oven >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling bread.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a limited amount of flour available each day. It uses 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread. The total daily flour supply is 200 kg.\n// Wheat + 1.5*Rye <= 200\n\n## Generate Constraint-2:\nThe bakery's oven can only operate for a maximum of 12 hours per day. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time.\n// 0.2*Wheat + 0.3*Rye <= 12\n\n## Generate Constraint-3:\nThe bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread.\n// Wheat_Oven <= Rye_Oven",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The bakery has a limited amount of flour available each day, using 1 kg of flour for each wheat bread and 1.5 kg of flour for each rye bread, with a total daily flour supply of 200 kg. The bakery's oven can only operate for a maximum of 12 hours per day, with each wheat bread requiring 0.2 hours of oven time and each rye bread requiring 0.3 hours of oven time. The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads. Additionally, the bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread. Please help the bakery maximize its daily profit from selling bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n## The number of hours of oven use for each type of bread\nWheat_Oven = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Oven\", lb=0) # number of hours of oven use for wheat bread\nRye_Oven = model.addVar(vtype=\"INTEGER\", name=\"Rye_Oven\", lb=0) # number of hours of oven use for rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a limited amount of flour available each day.\nmodel.addCons(Wheat + 1.5*Rye <= 200)\n## The bakery's oven can only operate for a maximum of 12 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 12)\n## The bakery must meet a minimum daily demand of 50 wheat breads and 30 rye breads.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The bakery must ensure that the total hours of oven use for wheat bread does not exceed the total hours of oven use for rye bread.\nmodel.addCons(Wheat_Oven <= Rye_Oven)\nmodel.addCons(Wheat_Oven == 0.2*Wheat)\nmodel.addCons(Rye_Oven == 0.3*Rye)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Number of hours of oven use for wheat bread: \", model.getVal(Wheat_Oven))\n    print(\"Number of hours of oven use for rye bread: \", model.getVal(Rye_Oven))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 40\n\n## Generate Constraint-2:\nEach loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\n// 0.4*Wheat + 0.5*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\n// Wheat >= 10, Rye >= 15\n\n## Generate Constraint-4:\nThe total number of loaves produced daily should not exceed 50 to maintain quality standards.\n// Wheat + Rye <= 50",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Oven Time per Loaf | Flour per Loaf |\n|------------|-----------------|--------------------|----------------|\n| Wheat      | $3              | 0.5 hours          | 0.4 pounds     |\n| Rye        | $4              | 0.75 hours         | 0.5 pounds     |\n\nThe bakery has a maximum of 40 hours of oven time and 20 pounds of flour available daily. The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand. Additionally, the total number of loaves produced daily should not exceed 50 to maintain quality standards. Please help the bakery to maximize its daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Pounds = model.addVar(vtype=\"INTEGER\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 40)\n## Each loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour.\nmodel.addCons(0.4*Wheat + 0.5*Rye <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of loaves produced daily should not exceed 50.\nmodel.addCons(Wheat + Rye <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand.\n// {\"number of wheat bread loaves\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Pounds\", \"range\": \"Flour_Pounds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. The bakery aims to maximize its daily profit from selling these bread types.\n// Objective Function: Maximize: 3*Wheat + 4*Rye\n\n## Generate Constraint-1:\nEach loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time. The bakery has a maximum of 40 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 40\n\n## Generate Constraint-2:\nEach loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour. The bakery has a maximum of 20 pounds of flour available daily.\n// 0.4*Wheat + 0.5*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand.\n// Wheat >= 10, Rye >= 15\n\n## Generate Constraint-4:\nThe total number of loaves produced daily should not exceed 50 to maintain quality standards.\n// Wheat + Rye <= 50",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw materials and demand. The profit per loaf of wheat bread is $3, and the profit per loaf of rye bread is $4. Each loaf of wheat bread requires 0.5 hours of oven time and uses 0.4 pounds of flour, while each loaf of rye bread requires 0.75 hours of oven time and uses 0.5 pounds of flour. The bakery has a maximum of 40 hours of oven time and 20 pounds of flour available daily. The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily to meet minimum customer demand. Additionally, the total number of loaves produced daily should not exceed 50 to maintain quality standards. Please help the bakery to maximize its daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat bread loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye bread loaves\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Pounds = model.addVar(vtype=\"INTEGER\", name=\"Flour_Pounds\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*Wheat + 4*Rye)\n\n# Add constraints\n## Each loaf of wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.75 hours of oven time.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 40)\n## Each loaf of wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.5 pounds of flour.\nmodel.addCons(0.4*Wheat + 0.5*Rye <= 20)\n## The bakery must produce at least 10 loaves of wheat bread and 15 loaves of rye bread daily.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of loaves produced daily should not exceed 50.\nmodel.addCons(Wheat + Rye <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(Wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"flour in kilograms\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\n// 0.2*Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads.\n// Wheat + Rye <= 200",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table shows the requirements for each type of bread:\n\n| Bread Type | Flour Requirement (kg) | Oven Time (hours) |\n|------------|-----------------------|-------------------|\n| Wheat      | 0.5                   | 0.2               |\n| Rye        | 0.6                   | 0.3               |\n\nThe bakery has a daily supply of 100 kg of flour and its oven can operate for a maximum of 20 hours per day. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores. Additionally, the total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads.\n\nPlease help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads.\nmodel.addCons(Wheat + Rye <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven capacity in hours\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"real\"}\n// {\"flour in kilograms\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\n// 0.5*Wheat + 0.6*Rye <= 100\n\n## Generate Constraint-2:\nEach wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\n// 0.2*Wheat + 0.3*Rye <= 20\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\n// Wheat >= 50\n// Rye >= 30\n\n## Generate Constraint-4:\nThe total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads.\n// Wheat + Rye <= 200",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of ingredients and oven capacity. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour. Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day. The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores. The total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads. Please help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 kg of flour, and each rye bread requires 0.6 kg of flour. The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Wheat + 0.6*Rye <= 100)\n## Each wheat bread requires 0.2 hours of oven time, and each rye bread requires 0.3 hours of oven time. The bakery's oven can operate for a maximum of 20 hours per day.\nmodel.addCons(0.2*Wheat + 0.3*Rye <= 20)\n## The bakery must produce at least 50 wheat breads and 30 rye breads daily to meet the minimum order requirements from local stores.\nmodel.addCons(Wheat >= 50)\nmodel.addCons(Rye >= 30)\n## The total number of breads produced daily should not exceed the bakery's maximum production capacity of 200 breads.\nmodel.addCons(Wheat + Rye <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"FlourUsed\", \"range\": \"FlourUsed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\n// 0.5*WholeWheat + 0.4*Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\n// 0.4*WholeWheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 10, Rye >= 10\n\n## Generate Constraint-4:\nThe total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality.\n// WholeWheat + Rye <= 60",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Loaf | Flour Used per Loaf |\n|------------|---------------------|---------------------|\n| Whole Wheat | 0.5 hours           | 0.4 pounds          |\n| Rye        | 0.4 hours           | 0.3 pounds          |\n\nThe bakery has a maximum of 8 hours of oven time available daily and a total of 30 pounds of flour available daily. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. Additionally, the total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 8)\n## Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\nmodel.addCons(0.4*WholeWheat + 0.3*Rye <= 30)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 10)\n## The total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality.\nmodel.addCons(WholeWheat + Rye <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"real\"}\n// {\"number of pounds of flour used\": \"FlourUsed\", \"range\": \"FlourUsed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\n// 0.5*WholeWheat + 0.4*Rye <= 8\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\n// 0.4*WholeWheat + 0.3*Rye <= 30\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\n// WholeWheat >= 10, Rye >= 10\n\n## Generate Constraint-4:\nThe total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality.\n// WholeWheat + Rye <= 60",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily. Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily. The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores. The total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality. Please help the bakery to maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 hours of oven time, and each loaf of rye bread requires 0.4 hours of oven time. The bakery has a maximum of 8 hours of oven time available daily.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 8)\n## Each loaf of whole wheat bread uses 0.4 pounds of flour, and each loaf of rye bread uses 0.3 pounds of flour. The bakery has a total of 30 pounds of flour available daily.\nmodel.addCons(0.4*WholeWheat + 0.3*Rye <= 30)\n## The bakery must produce at least 10 loaves of each type of bread to meet the minimum order requirements from local stores.\nmodel.addCons(WholeWheat >= 10)\nmodel.addCons(Rye >= 10)\n## The total number of loaves produced (both types combined) should not exceed 60 to maintain freshness and quality.\nmodel.addCons(WholeWheat + Rye <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Whole Wheat Loaves: \", model.getVal(WholeWheat))\n    print(\"Number of Rye Loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"FlourPounds\", \"range\": \"FlourPounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\n// 0.75*WholeWheat + 0.6*Rye <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\n// WholeWheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads.\n// Rye >= 20",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Required (pounds) | Oven Time Required (hours) |\n|------------|-----------------|-------------------------|----------------------------|\n| Whole Wheat | $3              | 0.5                     | 0.75                       |\n| Rye        | $2.50           | 0.4                     | 0.6                        |\n\nThe bakery has a daily supply of 100 pounds of flour and a daily limit of 60 hours of oven usage. The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand. Additionally, the bakery has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads. Please help the bakery maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\nmodel.addCons(0.75*WholeWheat + 0.6*Rye <= 60)\n## The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n## The bakery has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads.\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand.\n// {\"number of whole wheat loaves\": \"WholeWheat\", \"range\": \"WholeWheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"OvenHours\", \"range\": \"OvenHours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"FlourPounds\", \"range\": \"FlourPounds >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 3*WholeWheat + 2.50*Rye\n\n## Generate Constraint-1:\nEach loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\n// 0.5*WholeWheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nEach loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\n// 0.75*WholeWheat + 0.6*Rye <= 60\n\n## Generate Constraint-3:\nThe bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\n// WholeWheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads.\n// Rye >= 20",
        "question": "A bakery specializes in producing two types of bread: whole wheat and rye. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the constraints of available ingredients and demand. The profit from selling a loaf of whole wheat bread is $3, and the profit from selling a loaf of rye bread is $2.50. Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour. Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage. The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand. The bakery also has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads. Please help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWholeWheat = model.addVar(vtype=\"INTEGER\", name=\"WholeWheat\", lb=0) # number of whole wheat loaves\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*WholeWheat + 2.50*Rye)\n\n# Add constraints\n## Each loaf of whole wheat bread requires 0.5 pounds of flour, and each loaf of rye bread requires 0.4 pounds of flour. The bakery has a daily supply of 100 pounds of flour.\nmodel.addCons(0.5*WholeWheat + 0.4*Rye <= 100)\n## Each loaf of whole wheat bread requires 0.75 hours of oven time, and each loaf of rye bread requires 0.6 hours of oven time. The bakery has a daily limit of 60 hours of oven usage.\nmodel.addCons(0.75*WholeWheat + 0.6*Rye <= 60)\n## The bakery must produce at least 50 loaves of bread in total each day to meet minimum customer demand.\nmodel.addCons(WholeWheat + Rye >= 50)\n## The bakery has a policy to produce at least 20 loaves of rye bread each day to maintain its reputation for specialty breads.\nmodel.addCons(Rye >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat loaves: \", model.getVal(WholeWheat))\n    print(\"Number of rye loaves: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"amount of flour in kg\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and from each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\n// 0.4*Wheat + 0.6*Rye <= 6\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15\n\n## Generate Constraint-4:\nThe total number of breads baked daily should not exceed 30 to maintain quality.\n// Wheat + Rye <= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit from selling each wheat bread is $2, and from each rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Bread (hours) | Flour per Bread (kg) |\n|------------|-----------------------------|----------------------|\n| Wheat      | 0.5                         | 0.4                  |\n| Rye        | 0.75                        | 0.6                  |\n\nThe bakery has a total daily oven time available of 8 hours and a total daily flour availability of 6 kg. The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Additionally, the total number of breads baked daily should not exceed 30 to maintain quality.\n\nPlease help the bakery to maximize its daily profit from bread sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 6)\n## The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of breads baked daily should not exceed 30 to maintain quality.\nmodel.addCons(Wheat + Rye <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"oven time in hours\": \"Oven_Time\", \"range\": \"Oven_Time >= 0\", \"type\": \"real\"}\n// {\"amount of flour in kg\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each wheat bread is $2, and from each rye bread is $3. The bakery aims to maximize its daily profit from bread sales.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\n// 0.4*Wheat + 0.6*Rye <= 6\n\n## Generate Constraint-3:\nThe bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15\n\n## Generate Constraint-4:\nThe total number of breads baked daily should not exceed 30 to maintain quality.\n// Wheat + Rye <= 30",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of each type of bread to bake daily to maximize profit while considering the limited resources such as oven time and ingredient availability. The profit from selling each wheat bread is $2, and from each rye bread is $3. Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time, with a total daily oven time available of 8 hours. Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour, with a total daily flour available of 6 kg. The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Additionally, the total number of breads baked daily should not exceed 30 to maintain quality. Please help the bakery maximize its daily profit from bread sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to bake daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time and each rye bread requires 0.75 hours of oven time. The total daily oven time available is 8 hours.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread requires 0.4 kg of flour and each rye bread requires 0.6 kg of flour. The total daily flour available is 6 kg.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 6)\n## The bakery must bake at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of breads baked daily should not exceed 30 to maintain quality.\nmodel.addCons(Wheat + Rye <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\n// 0.4*Wheat + 0.6*Rye <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15\n\n## Generate Constraint-4:\nThe total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality.\n// Wheat + Rye <= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Oven Time per Bread | Flour Used per Bread |\n|------------|---------------------|----------------------|\n| Wheat      | 0.5 hours           | 0.4 pounds           |\n| Rye        | 0.75 hours          | 0.6 pounds           |\n\nThe bakery has a total of 8 hours of oven time and 4 pounds of flour available daily. The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. Additionally, the total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality.\n\nPlease help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 4)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality.\nmodel.addCons(Wheat + Rye <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat breads\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n// {\"number of hours of oven usage\": \"Oven_Hours\", \"range\": \"Oven_Hours >= 0\", \"type\": \"integer\"}\n// {\"number of pounds of flour used\": \"Flour_Used\", \"range\": \"Flour_Used >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per wheat bread is $2, and the profit per rye bread is $3. The bakery aims to maximize its daily profit from selling these breads.\n// Objective Function: Maximize: 2*Wheat + 3*Rye\n\n## Generate Constraint-1:\nEach wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\n// 0.5*Wheat + 0.75*Rye <= 8\n\n## Generate Constraint-2:\nEach wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\n// 0.4*Wheat + 0.6*Rye <= 4\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\n// Wheat >= 10\n// Rye >= 15\n\n## Generate Constraint-4:\nThe total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality.\n// Wheat + Rye <= 30",
        "question": "A bakery specializes in producing two types of bread: wheat bread and rye bread. The bakery needs to decide the optimal number of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per wheat bread is $2, and the profit per rye bread is $3. Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily. Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily. The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand. The total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality. Please help the bakery to maximize its daily profit from selling these breads.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\nOven_Hours = model.addVar(vtype=\"INTEGER\", name=\"Oven_Hours\", lb=0) # number of hours of oven usage\nFlour_Used = model.addVar(vtype=\"INTEGER\", name=\"Flour_Used\", lb=0) # number of pounds of flour used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat + 3*Rye)\n\n# Add constraints\n## Each wheat bread requires 0.5 hours of oven time, and each rye bread requires 0.75 hours of oven time. The bakery has a total of 8 hours of oven time available daily.\nmodel.addCons(0.5*Wheat + 0.75*Rye <= 8)\n## Each wheat bread uses 0.4 pounds of flour, and each rye bread uses 0.6 pounds of flour. The bakery has a total of 4 pounds of flour available daily.\nmodel.addCons(0.4*Wheat + 0.6*Rye <= 4)\n## The bakery must produce at least 10 wheat breads and 15 rye breads daily to meet the minimum customer demand.\nmodel.addCons(Wheat >= 10)\nmodel.addCons(Rye >= 15)\n## The total number of breads produced (wheat and rye) should not exceed 30 to maintain product freshness and quality.\nmodel.addCons(Wheat + Rye <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat breads: \", model.getVal(Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. Producing one unit of product A costs $50 in raw materials, product B costs $75, product C costs $100, and product D costs $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space.\n// A + B + C + D <= 500\n\n## Generate Constraint-4:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n// A >= 50\n// B >= 75\n// C >= 100\n// D >= 125",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit and the resource requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Cost per Unit | Storage Space per Unit |\n|---------|-----------------|----------------------|---------------------------|-----------------------|\n| A       | $100            | 2 hours              | $50                       | 1 unit                |\n| B       | $150            | 3 hours              | $75                       | 1 unit                |\n| C       | $200            | 4 hours              | $100                      | 1 unit                |\n| D       | $250            | 5 hours              | $125                      | 1 unit                |\n\nThe company has a total of 1000 labor hours available and a budget of $50,000 for raw materials. The company also has a storage capacity of 500 units. The market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n\nPlease help the company to maximize the total profit while considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(A + B + C + D <= 500)\n## The market demand for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 75)\nmodel.addCons(C >= 100)\nmodel.addCons(D >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1332,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\n// Objective Function: Maximize: 100*A + 150*B + 200*C + 250*D\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2*A + 3*B + 4*C + 5*D <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for raw materials. Producing one unit of product A costs $50 in raw materials, product B costs $75, product C costs $100, and product D costs $125.\n// 50*A + 75*B + 100*C + 125*D <= 50000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space.\n// A + B + C + D <= 500\n\n## Generate Constraint-4:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\n// A >= 50\n// B >= 75\n// C >= 100\n// D >= 125",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to decide how many units of each product to produce to optimize their profit and resource usage. The profit per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The company wants to maximize the total profit.\nThe company has a total of 1000 labor hours available. Producing one unit of product A requires 2 hours, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours. The company has a budget of $50,000 for raw materials. Producing one unit of product A costs $50 in raw materials, product B costs $75, product C costs $100, and product D costs $125. The company has a storage capacity of 500 units. Each unit of product A, B, C, and D occupies 1 unit of storage space. The market demand for product A is at least 50 units, for product B is at least 75 units, for product C is at least 100 units, and for product D is at least 125 units.\nPlease help the company determine the optimal number of units to produce for each product A, B, C, and D.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*A + 150*B + 200*C + 250*D)\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n## The company has a budget of $50,000 for raw materials.\nmodel.addCons(50*A + 75*B + 100*C + 125*D <= 50000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(A + B + C + D <= 500)\n## The market demand for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 75)\nmodel.addCons(C >= 100)\nmodel.addCons(D >= 125)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Number of units of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. The time required to produce one croissant is 0.5 hours, one muffin is 0.7 hours, one doughnut is 0.6 hours, and one bagel is 0.4 hours.\n// 0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\n// Croissants + Muffins + Doughnuts + Bagels <= 1500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 200 croissants and 300 muffins per day.\n// Croissants >= 200\n// Muffins >= 300\n\n## Generate Constraint-4:\nDue to market demand, the bakery must produce at least twice as many doughnuts as bagels.\n// Doughnuts >= 2*Bagels",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. The profit per pastry and the time required to produce each pastry are given in the following Table.\n\n| Pastry   | Profit per Pastry | Production Time per Pastry |\n|----------|-------------------|----------------------------|\n| Croissants | $0.50            | 0.5 hours                   |\n| Muffins    | $0.75            | 0.7 hours                   |\n| Doughnuts  | $0.60            | 0.6 hours                   |\n| Bagels     | $0.40            | 0.4 hours                   |\n\nThe bakery has a total of 1000 hours of labor available per day. The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day. The bakery has a contract to supply at least 200 croissants and 300 muffins per day. Due to market demand, the bakery must produce at least twice as many doughnuts as bagels.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000)\n## The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\nmodel.addCons(Croissants + Muffins + Doughnuts + Bagels <= 1500)\n## The bakery has a contract to supply at least 200 croissants and 300 muffins per day.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 300)\n## Due to market demand, the bakery must produce at least twice as many doughnuts as bagels.\nmodel.addCons(Doughnuts >= 2*Bagels)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of bagels\": \"Bagels\", \"range\": \"Bagels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels\n\n## Generate Constraint-1:\nThe bakery has a total of 1000 hours of labor available per day. The time required to produce one croissant is 0.5 hours, one muffin is 0.7 hours, one doughnut is 0.6 hours, and one bagel is 0.4 hours.\n// 0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000\n\n## Generate Constraint-2:\nThe bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\n// Croissants + Muffins + Doughnuts + Bagels <= 1500\n\n## Generate Constraint-3:\nThe bakery has a contract to supply at least 200 croissants and 300 muffins per day.\n// Croissants >= 200\n// Muffins >= 300\n\n## Generate Constraint-4:\nDue to market demand, the bakery must produce at least twice as many doughnuts as bagels.\n// Doughnuts >= 2*Bagels",
        "question": "A small bakery produces four types of pastries: croissants, muffins, doughnuts, and bagels. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. The profit per croissant is $0.50, the profit per muffin is $0.75, the profit per doughnut is $0.60, and the profit per bagel is $0.40. The bakery has a total of 1000 hours of labor available per day, with the time required to produce one croissant being 0.5 hours, one muffin being 0.7 hours, one doughnut being 0.6 hours, and one bagel being 0.4 hours. The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day. The bakery has a contract to supply at least 200 croissants and 300 muffins per day. Due to market demand, the bakery must produce at least twice as many doughnuts as bagels. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts\nBagels = model.addVar(vtype=\"INTEGER\", name=\"Bagels\", lb=0) # number of bagels\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Doughnuts + 0.40*Bagels)\n\n# Add constraints\n## The bakery has a total of 1000 hours of labor available per day.\nmodel.addCons(0.5*Croissants + 0.7*Muffins + 0.6*Doughnuts + 0.4*Bagels <= 1000)\n## The bakery has a limited oven space, which can handle a maximum of 1500 pastries per day.\nmodel.addCons(Croissants + Muffins + Doughnuts + Bagels <= 1500)\n## The bakery has a contract to supply at least 200 croissants and 300 muffins per day.\nmodel.addCons(Croissants >= 200)\nmodel.addCons(Muffins >= 300)\n## Due to market demand, the bakery must produce at least twice as many doughnuts as bagels.\nmodel.addCons(Doughnuts >= 2*Bagels)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Number of Doughnuts: \", model.getVal(Doughnuts))\n    print(\"Number of Bagels: \", model.getVal(Bagels))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits.\n// {\"monthly production of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"monthly production of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"monthly production of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"monthly production of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company aims to maximize the total monthly profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production of laptops must be at least half the total production of smartphones and tablets combined.\n// Laptops >= 0.5 * (Smartphones + Tablets)\n\n## Generate Constraint-3:\nThe production of smartwatches cannot exceed 20% of the total production.\n// Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches)\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which cannot exceed $800,000 per month. The cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 800000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits. The profit and cost per unit for each device are given in the following Table.\n\n| Device       | Profit per Unit | Cost per Unit |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $60           |\n| Tablets      | $150            | $80           |\n| Laptops      | $200            | $120          |\n| Smartwatches | $50             | $30           |\n\nThe company has a total production capacity of 5000 units per month. The production of laptops must be at least half the total production of smartphones and tablets combined. The production of smartwatches cannot exceed 20% of the total production. The company has a budget constraint for production costs, which cannot exceed $800,000 per month.\n\nPlease help the company to maximize the total monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The monthly production of each device\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # monthly production of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # monthly production of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # monthly production of laptops\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0) # monthly production of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The production of laptops must be at least half the total production of smartphones and tablets combined.\nmodel.addCons(Laptops >= 0.5 * (Smartphones + Tablets))\n## The production of smartwatches cannot exceed 20% of the total production.\nmodel.addCons(Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches))\n## The company has a budget constraint for production costs, which cannot exceed $800,000 per month.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Monthly production of smartphones: \", model.getVal(Smartphones))\n    print(\"Monthly production of tablets: \", model.getVal(Tablets))\n    print(\"Monthly production of laptops: \", model.getVal(Laptops))\n    print(\"Monthly production of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits.\n// {\"monthly production of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"monthly production of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"monthly production of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"monthly production of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company aims to maximize the total monthly profit.\n// Objective Function: Maximize: 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches <= 5000\n\n## Generate Constraint-2:\nThe production of laptops must be at least half the total production of smartphones and tablets combined.\n// Laptops >= 0.5 * (Smartphones + Tablets)\n\n## Generate Constraint-3:\nThe production of smartwatches cannot exceed 20% of the total production.\n// Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches)\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which cannot exceed $800,000 per month. The cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30.\n// 60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 800000",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The company needs to determine the monthly production quantity for each device to optimize profits. The profit per unit for smartphones is $100, for tablets is $150, for laptops is $200, and for smartwatches is $50. The company has a total production capacity of 5000 units per month. The production of laptops must be at least half the total production of smartphones and tablets combined. The production of smartwatches cannot exceed 20% of the total production. The company has a budget constraint for production costs, which cannot exceed $800,000 per month. The cost per unit for smartphones is $60, for tablets is $80, for laptops is $120, and for smartwatches is $30.\nPlease help the company to maximize the total monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The monthly production of each device\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # monthly production of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # monthly production of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # monthly production of laptops\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0) # monthly production of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smartphones + 150*Tablets + 200*Laptops + 50*Smartwatches)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 5000)\n## The production of laptops must be at least half the total production of smartphones and tablets combined.\nmodel.addCons(Laptops >= 0.5 * (Smartphones + Tablets))\n## The production of smartwatches cannot exceed 20% of the total production.\nmodel.addCons(Smartwatches <= 0.2 * (Smartphones + Tablets + Laptops + Smartwatches))\n## The company has a budget constraint for production costs, which cannot exceed $800,000 per month.\nmodel.addCons(60*Smartphones + 80*Tablets + 120*Laptops + 30*Smartwatches <= 800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Monthly production of smartphones: \", model.getVal(Smartphones))\n    print(\"Monthly production of tablets: \", model.getVal(Tablets))\n    print(\"Monthly production of laptops: \", model.getVal(Laptops))\n    print(\"Monthly production of smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000\n\n## Generate Constraint-3:\nThe labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit.\nThe company has a budget of $120,000 for labor costs.\n// 10*A + 15*B + 12*C + 8*D <= 120000\n\n## Generate Constraint-4:\nThe warehouse space required for product A is 2 cubic meters per unit, for product B is 3 cubic meters per unit, for product C is 2.5 cubic meters per unit, and for product D is 1.5 cubic meters per unit.\nThe company has a maximum warehouse capacity of 25,000 cubic meters.\n// 2*A + 3*B + 2.5*C + 1.5*D <= 25000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit for each product is given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n| D       | $40             |\n\nThe company has a total production capacity of 10,000 units. The raw material cost for producing each product and the company's budget for raw materials are given in the following Table.\n\n| Product | Raw Material Cost per Unit | Company's Raw Material Budget |\n|---------|---------------------------|------------------------------|\n| A       | $20                       | $250,000                     |\n| B       | $30                       | $250,000                     |\n| C       | $25                       | $250,000                     |\n| D       | $15                       | $250,000                     |\n\nThe labor cost for producing each product and the company's budget for labor costs are given in the following Table.\n\n| Product | Labor Cost per Unit | Company's Labor Budget |\n|---------|---------------------|------------------------|\n| A       | $10                 | $120,000               |\n| B       | $15                 | $120,000               |\n| C       | $12                 | $120,000               |\n| D       | $8                  | $120,000               |\n\nThe warehouse space required for each product and the company's maximum warehouse capacity are given in the following Table.\n\n| Product | Warehouse Space per Unit | Company's Maximum Warehouse Capacity |\n|---------|-------------------------|--------------------------------------|\n| A       | 2 cubic meters          | 25,000 cubic meters                 |\n| B       | 3 cubic meters          | 25,000 cubic meters                 |\n| C       | 2.5 cubic meters        | 25,000 cubic meters                 |\n| D       | 1.5 cubic meters        | 25,000 cubic meters                 |\n\nPlease help the company to maximize its total profit by determining the optimal production quantity for each product, considering the constraints on production capacity, raw material costs, labor costs, and warehouse space.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The company has a budget of $120,000 for labor costs.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 120000)\n## The company has a maximum warehouse capacity of 25,000 cubic meters.\nmodel.addCons(2*A + 3*B + 2.5*C + 1.5*D <= 25000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 2305,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"continuous\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40.\nThe company wants to maximize its total profit.\n// Objective Function: Maximize: 50*A + 70*B + 60*C + 40*D\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-2:\nThe raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit.\nThe company has a budget of $250,000 for raw materials.\n// 20*A + 30*B + 25*C + 15*D <= 250000\n\n## Generate Constraint-3:\nThe labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit.\nThe company has a budget of $120,000 for labor costs.\n// 10*A + 15*B + 12*C + 8*D <= 120000\n\n## Generate Constraint-4:\nThe warehouse space required for product A is 2 cubic meters per unit, for product B is 3 cubic meters per unit, for product C is 2.5 cubic meters per unit, and for product D is 1.5 cubic meters per unit.\nThe company has a maximum warehouse capacity of 25,000 cubic meters.\n// 2*A + 3*B + 2.5*C + 1.5*D <= 25000",
        "question": "A company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, for product C is $60, and for product D is $40. The company has a total production capacity of 10,000 units. The raw material cost for producing product A is $20 per unit, for product B is $30 per unit, for product C is $25 per unit, and for product D is $15 per unit, with a budget of $250,000 for raw materials. The labor cost for producing product A is $10 per unit, for product B is $15 per unit, for product C is $12 per unit, and for product D is $8 per unit, with a budget of $120,000 for labor costs. The warehouse space required for product A is 2 cubic meters per unit, for product B is 3 cubic meters per unit, for product C is 2.5 cubic meters per unit, and for product D is 1.5 cubic meters per unit, with a maximum warehouse capacity of 25,000 cubic meters. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity of each product\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # production quantity of product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 70*B + 60*C + 40*D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company has a budget of $250,000 for raw materials.\nmodel.addCons(20*A + 30*B + 25*C + 15*D <= 250000)\n## The company has a budget of $120,000 for labor costs.\nmodel.addCons(10*A + 15*B + 12*C + 8*D <= 120000)\n## The company has a maximum warehouse capacity of 25,000 cubic meters.\nmodel.addCons(2*A + 3*B + 2.5*C + 1.5*D <= 25000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production quantity of product A: \", model.getVal(A))\n    print(\"Production quantity of product B: \", model.getVal(B))\n    print(\"Production quantity of product C: \", model.getVal(C))\n    print(\"Production quantity of product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-4:\nThe bakery has a limited amount of eggs, with 150 units available daily. Each croissant requires 1 unit of eggs, each muffin requires 1 unit, and each donut requires 2 units.\n// Croissants + Muffins + 2*Donuts <= 150",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries. The bakery has a limited amount of flour, with 300 units available daily, where each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units. The bakery also has a limited amount of sugar, with 200 units available daily, where each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit. Additionally, the bakery has a limited amount of eggs, with 150 units available daily, where each croissant requires 1 unit of eggs, each muffin requires 1 unit, and each donut requires 2 units.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of croissants, muffins, and donuts to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = 200 # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n## The bakery has a limited amount of sugar, with 200 units available daily.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a limited amount of eggs, with 150 units available daily.\nmodel.addCons(Croissants + Muffins + 2*Donuts <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"daily production capacity\": \"Production_Capacity\", \"range\": \"Production_Capacity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins + 2.5*Donuts\n\n## Generate Constraint-1:\nThe bakery has a daily production capacity of 200 pastries.\n// Croissants + Muffins + Donuts <= Production_Capacity\n\n## Generate Constraint-2:\nThe bakery has a limited amount of flour, with 300 units available daily. Each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units.\n// 2*Croissants + 3*Muffins + 2*Donuts <= 300\n\n## Generate Constraint-3:\nThe bakery has a limited amount of sugar, with 200 units available daily. Each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit.\n// Croissants + 2*Muffins + Donuts <= 200\n\n## Generate Constraint-4:\nThe bakery has a limited amount of eggs, with 150 units available daily. Each croissant requires 1 unit of eggs, each muffin requires 1 unit, and each donut requires 2 units.\n// Croissants + Muffins + 2*Donuts <= 150",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $2, per muffin is $3, and per donut is $2.5. The bakery has a daily production capacity of 200 pastries. The bakery has a limited amount of flour, with 300 units available daily, where each croissant requires 2 units of flour, each muffin requires 3 units, and each donut requires 2 units. The bakery also has a limited amount of sugar, with 200 units available daily, where each croissant requires 1 unit of sugar, each muffin requires 2 units, and each donut requires 1 unit. Additionally, the bakery has a limited amount of eggs, with 150 units available daily, where each croissant requires 1 unit of eggs, each muffin requires 1 unit, and each donut requires 2 units. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\nProduction_Capacity = 200 # daily production capacity\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins + 2.5*Donuts)\n\n# Add constraints\n## The bakery has a daily production capacity of 200 pastries.\nmodel.addCons(Croissants + Muffins + Donuts <= Production_Capacity)\n## The bakery has a limited amount of flour, with 300 units available daily.\nmodel.addCons(2*Croissants + 3*Muffins + 2*Donuts <= 300)\n## The bakery has a limited amount of sugar, with 200 units available daily.\nmodel.addCons(Croissants + 2*Muffins + Donuts <= 200)\n## The bakery has a limited amount of eggs, with 150 units available daily.\nmodel.addCons(Croissants + Muffins + 2*Donuts <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)\n\n## Generate Constraint-3:\nThe bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\n// 100*Croissants + 100*Muffins + 100*Donuts <= 50000 (in cubic centimeters)\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\n// Croissants + Muffins + Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n\n| Pastry   | Profit per Unit | Flour Required (grams) | Sugar Required (grams) | Storage Required (cubic cm) |\n|----------|-----------------|------------------------|------------------------|-----------------------------|\n| Croissant| $0.50           | 50                     | 20                     | 100                         |\n| Muffin   | $0.75           | 75                     | 30                     | 100                         |\n| Donut    | $1.00           | 100                    | 40                     | 100                         |\n\nThe bakery has a daily supply of 10 kilograms of flour and 5 kilograms of sugar. The bakery has limited storage space, with a total capacity of 50 liters. The bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\n\nPlease help the bakery to maximize its daily profit from selling pastries while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n## The bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\nmodel.addCons(100*Croissants + 100*Muffins + 100*Donuts <= 50000)\n## The bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"storage space used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\n// Objective Function: Maximize: 0.50*Croissants + 0.75*Muffins + 1.00*Donuts\n\n## Generate Constraint-1:\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\n// 50*Croissants + 75*Muffins + 100*Donuts <= 10000 (in grams)\n\n## Generate Constraint-2:\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\n// 20*Croissants + 30*Muffins + 40*Donuts <= 5000 (in grams)\n\n## Generate Constraint-3:\nThe bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\n// 100*Croissants + 100*Muffins + 100*Donuts <= 50000 (in cubic centimeters)\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\n// Croissants + Muffins + Donuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $1.00. The bakery aims to maximize its daily profit from selling pastries.\nEach croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nEach croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nThe bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\nThe bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\nPlease help the bakery to maximize its daily profit from selling pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 1.00*Donuts)\n\n# Add constraints\n## Each croissant requires 50 grams of flour, each muffin requires 75 grams, and each donut requires 100 grams. The bakery has a daily supply of 10 kilograms of flour.\nmodel.addCons(50*Croissants + 75*Muffins + 100*Donuts <= 10000)\n## Each croissant requires 20 grams of sugar, each muffin requires 30 grams, and each donut requires 40 grams. The bakery has a daily supply of 5 kilograms of sugar.\nmodel.addCons(20*Croissants + 30*Muffins + 40*Donuts <= 5000)\n## The bakery has limited storage space. Each croissant, muffin, and donut requires 100 cubic centimeters of storage space. The total storage capacity is 50 liters.\nmodel.addCons(100*Croissants + 100*Muffins + 100*Donuts <= 50000)\n## The bakery must produce at least 100 units of any type of pastry to meet the minimum daily demand.\nmodel.addCons(Croissants + Muffins + Donuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1, Strawberry_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 cakes of each type per week.\n// Chocolate_Cakes >= 10, Vanilla_Cakes >= 10, Strawberry_Cakes >= 10",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. The cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. The rental cost per oven per week is $150. The bakery wants to maximize the weekly profit.\n\n| Cake Type       | Revenue per Cake | Cost per Cake | Oven Rental Cost per Week |\n|------------------|------------------|---------------|---------------------------|\n| Chocolate        | 10$              | 4$            | 150$                      |\n| Vanilla          | 8$               | 3$            | 150$                      |\n| Strawberry       | 9$               | 5$            | 150$                      |\n\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental. The bakery needs to rent at least one oven for each type of cake. The bakery must produce at least 10 cakes of each type per week.\n\nPlease help the bakery determine the optimal number of each type of cake to produce and the number of ovens to rent for each type of cake to maximize the weekly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\nmodel.addCons(Strawberry_Ovens >= 1)\n## The bakery must produce at least 10 cakes of each type per week.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 10)\nmodel.addCons(Strawberry_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1382,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for chocolate cakes\": \"Chocolate_Ovens\", \"range\": \"Chocolate_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for vanilla cakes\": \"Vanilla_Ovens\", \"range\": \"Vanilla_Ovens >= 0\", \"type\": \"integer\"}\n// {\"number of ovens to rent for strawberry cakes\": \"Strawberry_Ovens\", \"range\": \"Strawberry_Ovens >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. \nThe cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. \nThe rental cost per oven per week is $150.\nThe bakery wants to maximize the weekly profit.\n// Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n// Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\n// 2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120\n\n## Generate Constraint-2:\nThe bakery has a budget of $500 per week for oven rental.\n// 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500\n\n## Generate Constraint-3:\nThe bakery needs to rent at least one oven for each type of cake.\n// Chocolate_Ovens >= 1, Vanilla_Ovens >= 1, Strawberry_Ovens >= 1\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 cakes of each type per week.\n// Chocolate_Cakes >= 10, Vanilla_Cakes >= 10, Strawberry_Cakes >= 10",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery also needs to decide on the number of ovens to rent for each type of cake. The revenue per chocolate cake is $10, per vanilla cake is $8, and per strawberry cake is $9. The cost per chocolate cake is $4, per vanilla cake is $3, and per strawberry cake is $5. The rental cost per oven per week is $150. The bakery wants to maximize the weekly profit. The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available. The bakery has a budget of $500 per week for oven rental. The bakery needs to rent at least one oven for each type of cake. The bakery must produce at least 10 cakes of each type per week. Please help the bakery determine the optimal number of cakes to produce and ovens to rent to maximize its weekly profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes to produce and ovens to rent for each type of cake\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\nChocolate_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Ovens\", lb=0) # number of ovens to rent for chocolate cakes\nVanilla_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Ovens\", lb=0) # number of ovens to rent for vanilla cakes\nStrawberry_Ovens = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Ovens\", lb=0) # number of ovens to rent for strawberry cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\nTotal_Revenue = 10*Chocolate_Cakes + 8*Vanilla_Cakes + 9*Strawberry_Cakes\n## Total_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nTotal_Cost = 4*Chocolate_Cakes + 3*Vanilla_Cakes + 5*Strawberry_Cakes + 150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The time required to bake a chocolate cake is 2 hours, a vanilla cake is 1.5 hours, and a strawberry cake is 1 hour. Each week, 120 hours of oven time are available.\nmodel.addCons(2*Chocolate_Cakes*Chocolate_Ovens + 1.5*Vanilla_Cakes*Vanilla_Ovens + 1*Strawberry_Cakes*Strawberry_Ovens <= 120)\n## The bakery has a budget of $500 per week for oven rental.\nmodel.addCons(150*(Chocolate_Ovens + Vanilla_Ovens + Strawberry_Ovens) <= 500)\n## The bakery needs to rent at least one oven for each type of cake.\nmodel.addCons(Chocolate_Ovens >= 1)\nmodel.addCons(Vanilla_Ovens >= 1)\nmodel.addCons(Strawberry_Ovens >= 1)\n## The bakery must produce at least 10 cakes of each type per week.\nmodel.addCons(Chocolate_Cakes >= 10)\nmodel.addCons(Vanilla_Cakes >= 10)\nmodel.addCons(Strawberry_Cakes >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of ovens to rent for chocolate cakes: \", model.getVal(Chocolate_Ovens))\n    print(\"Number of ovens to rent for vanilla cakes: \", model.getVal(Vanilla_Ovens))\n    print(\"Number of ovens to rent for strawberry cakes: \", model.getVal(Strawberry_Ovens))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 500 units. Each croissant requires 1 unit of storage, each muffin requires 1.5 units, and each doughnut requires 1 unit.\n// Croissants + 1.5*Muffins + Doughnuts <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand.\n// Croissants >= 100 or Muffins >= 100 or Doughnuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery has a total of 300 kg of flour and 200 kg of sugar available daily. Each croissant requires 0.1 kg of flour and 0.05 kg of sugar, each muffin requires 0.2 kg of flour and 0.1 kg of sugar, and each doughnut requires 0.15 kg of flour and 0.08 kg of sugar. The bakery also has a storage capacity of 500 units, where each croissant requires 1 unit of storage, each muffin requires 1.5 units, and each doughnut requires 1 unit. The bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand.\n\nPlease help the bakery to maximize its daily profit.\n\n| Pastry   | Profit per Unit | Flour Required (kg) | Sugar Required (kg) | Storage Units Required |\n|----------|-----------------|---------------------|---------------------|------------------------|\n| Croissant| $1.50           | 0.1                 | 0.05                | 1                      |\n| Muffin   | $2.00           | 0.2                 | 0.1                 | 1.5                    |\n| Doughnut | $1.75           | 0.15                | 0.08                | 1                      |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n## The bakery has a storage capacity of 500 units.\nmodel.addCons(Croissants + 1.5*Muffins + Doughnuts <= 500)\n## The bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Doughnuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1425,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of doughnuts to produce\": \"Doughnuts\", \"range\": \"Doughnuts >= 0\", \"type\": \"integer\"}\n// {\"number of storage units used\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery aims to maximize its daily profit.\n// Objective Function: Maximize: 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each doughnut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each doughnut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 500 units. Each croissant requires 1 unit of storage, each muffin requires 1.5 units, and each doughnut requires 1 unit.\n// Croissants + 1.5*Muffins + Doughnuts <= 500\n\n## Generate Constraint-4:\nThe bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand.\n// Croissants >= 100 or Muffins >= 100 or Doughnuts >= 100",
        "question": "A bakery produces three types of pastries: croissants, muffins, and doughnuts. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit while considering the availability of ingredients and storage capacity. The profit per croissant is $1.50, per muffin is $2.00, and per doughnut is $1.75. The bakery has a total of 300 kg of flour available daily, with each croissant requiring 0.1 kg of flour, each muffin requiring 0.2 kg, and each doughnut requiring 0.15 kg. The bakery also has a total of 200 kg of sugar available daily, with each croissant requiring 0.05 kg of sugar, each muffin requiring 0.1 kg, and each doughnut requiring 0.08 kg. The bakery has a storage capacity of 500 units, with each croissant requiring 1 unit of storage, each muffin requiring 1.5 units, and each doughnut requiring 1 unit. The bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDoughnuts = model.addVar(vtype=\"INTEGER\", name=\"Doughnuts\", lb=0) # number of doughnuts to produce\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # number of storage units used\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 1.50*Croissants + 2.00*Muffins + 1.75*Doughnuts)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Doughnuts <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Doughnuts <= 200)\n## The bakery has a storage capacity of 500 units.\nmodel.addCons(Croissants + 1.5*Muffins + Doughnuts <= 500)\n## The bakery must produce at least 100 units of any type of pastry daily to meet the minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Doughnuts >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of doughnuts to produce: \", model.getVal(Doughnuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\n// Croissants >= 100, Muffins >= 100, Donuts >= 100\n\n## Generate Constraint-4:\nThe bakery aims to balance the production of pastries to maintain a diverse product line. The ratio of croissants to muffins to donuts should be at least 1:1:1.\n// Croissants - Muffins >= 0\n// Croissants - Donuts >= 0\n// Muffins - Donuts >= 0",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase. The profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The following table shows the requirements for raw materials and labor for each type of pastry.\n\n| Pastry   | Profit per Unit | Raw Material per Unit | Labor per Unit |\n|----------|-----------------|-----------------------|----------------|\n| Croissant| $1              | 0.5 units             | 0.2 hours      |\n| Muffin   | $1.5            | 0.6 units             | 0.3 hours      |\n| Donut    | $2              | 0.8 units             | 0.4 hours      |\n\nThe bakery has a daily limit of 500 units of raw materials and a labor limit of 200 hours. The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand. The bakery aims to balance the production of pastries to maintain a diverse product line, with the ratio of croissants to muffins to donuts being at least 1:1:1.\n\nPlease help the bakery to maximize its daily profit by determining the optimal number of each type of pastry to produce and the amount of raw materials to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Croissants + 1.5*Muffins + 2*Donuts - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n## The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Donuts >= 100)\n## The bakery aims to balance the production of pastries to maintain a diverse product line.\nmodel.addCons(Croissants - Muffins >= 0)\nmodel.addCons(Croissants - Donuts >= 0)\nmodel.addCons(Muffins - Donuts >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of Raw Materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1433,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials to purchase\": \"Raw_Materials\", \"range\": \"Raw_Materials >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $1, per muffin is $1.5, and per donut is $2. The cost of raw materials per unit of pastry varies based on the type of pastry. The bakery aims to maximize its daily profit.\n// Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n// Total_Cost = Raw_Materials\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units.\n// 0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours.\n// 0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\n// Croissants >= 100, Muffins >= 100, Donuts >= 100\n\n## Generate Constraint-4:\nThe bakery aims to balance the production of pastries to maintain a diverse product line. The ratio of croissants to muffins to donuts should be at least 1:1:1.\n// Croissants - Muffins >= 0\n// Croissants - Donuts >= 0\n// Muffins - Donuts >= 0",
        "question": "A bakery produces three types of pastries: croissants, muffins, and donuts. The bakery needs to decide how many of each type of pastry to produce daily to meet customer demand and optimize profits. Additionally, the bakery must determine the amount of raw materials (flour, sugar, and eggs) to purchase. The profit per croissant is $1, per muffin is $1.5, and per donut is $2. The bakery has a daily limit of 500 units of raw materials. Each croissant requires 0.5 units of raw materials, each muffin requires 0.6 units, and each donut requires 0.8 units. The bakery also has a daily labor limit of 200 hours. Each croissant requires 0.2 hours of labor, each muffin requires 0.3 hours, and each donut requires 0.4 hours. The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand. The bakery aims to balance the production of pastries to maintain a diverse product line. The ratio of croissants to muffins to donuts should be at least 1:1:1. Please help the bakery to maximize its daily profit, which is defined as the total revenue from selling pastries minus the cost of raw materials.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n## The amount of raw materials to purchase\nRaw_Materials = model.addVar(vtype=\"CONTINUOUS\", name=\"Raw_Materials\", lb=0) # amount of raw materials to purchase\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = Croissants + 1.5*Muffins + 2*Donuts\n## Total_Cost = Raw_Materials\nmodel.addCons(obj == Croissants + 1.5*Muffins + 2*Donuts - Raw_Materials)\n\n# Add constraints\n## The bakery has a daily limit of 500 units of raw materials.\nmodel.addCons(0.5*Croissants + 0.6*Muffins + 0.8*Donuts <= 500)\n## The bakery has a daily labor limit of 200 hours.\nmodel.addCons(0.2*Croissants + 0.3*Muffins + 0.4*Donuts <= 200)\n## The bakery must produce at least 100 units of each type of pastry to meet minimum customer demand.\nmodel.addCons(Croissants >= 100)\nmodel.addCons(Muffins >= 100)\nmodel.addCons(Donuts >= 100)\n## The bakery aims to balance the production of pastries to maintain a diverse product line.\nmodel.addCons(Croissants - Muffins >= 0)\nmodel.addCons(Croissants - Donuts >= 0)\nmodel.addCons(Muffins - Donuts >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Amount of Raw Materials to purchase: \", model.getVal(Raw_Materials))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 80 cakes of each type daily.\n// C1 <= 80, C2 <= 80, C3 <= 80, C4 <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 cakes of each type to meet the minimum order requirements.\n// C1 >= 10, C2 >= 10, C3 >= 10, C4 >= 10",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery can only produce a maximum of 80 cakes of each type daily and must produce at least 10 cakes of each type to meet the minimum order requirements.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize the total profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) |\n|-----------|-----------------|---------------------|---------------------|\n| 1         | $5              | 1                   | 0.5                 |\n| 2         | $7              | 2                   | 0.8                 |\n| 3         | $6              | 1.5                 | 0.6                 |\n| 4         | $4              | 1                   | 0.5                 |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery can only produce a maximum of 80 cakes of each type daily.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 80)\nmodel.addCons(C3 <= 80)\nmodel.addCons(C4 <= 80)\n## The bakery must produce at least 10 cakes of each type to meet the minimum order requirements.\nmodel.addCons(C1 >= 10)\nmodel.addCons(C2 >= 10)\nmodel.addCons(C3 >= 10)\nmodel.addCons(C4 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.8 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 80 cakes of each type daily.\n// C1 <= 80, C2 <= 80, C3 <= 80, C4 <= 80\n\n## Generate Constraint-4:\nThe bakery must produce at least 10 cakes of each type to meet the minimum order requirements.\n// C1 >= 10, C2 >= 10, C3 >= 10, C4 >= 10",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.8 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery can only produce a maximum of 80 cakes of each type daily and must produce at least 10 cakes of each type to meet the minimum order requirements. Please help the bakery determine the optimal number of each type of cake to produce to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.8*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery can only produce a maximum of 80 cakes of each type daily.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 80)\nmodel.addCons(C3 <= 80)\nmodel.addCons(C4 <= 80)\n## The bakery must produce at least 10 cakes of each type to meet the minimum order requirements.\nmodel.addCons(C1 >= 10)\nmodel.addCons(C2 >= 10)\nmodel.addCons(C3 >= 10)\nmodel.addCons(C4 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// W >= 20\n// R >= 20\n// S >= 20\n// B >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Brioche does not exceed 50% of the total bread production.\n// B <= 0.5*(W + R + S + B)",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, with the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche being $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. Additionally, the bakery has a limit of 150 hours of labor available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. The bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. The bakery also wants to ensure that the production of Brioche does not exceed 50% of the total bread production.\n\nPlease help the bakery to determine the optimal daily production quantities of each type of bread to maximize its daily profit.\n\n| Bread Type | Profit per Loaf | Flour Required per Loaf | Labor Required per Loaf |\n|------------|-----------------|-------------------------|-------------------------|\n| Whole Wheat | $2              | 0.5 kg                  | 0.2 hours               |\n| Rye        | $3              | 0.4 kg                  | 0.3 hours               |\n| Sourdough  | $2.5            | 0.3 kg                  | 0.15 hours              |\n| Brioche    | $4              | 0.6 kg                  | 0.4 hours               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(B >= 20)\n## The bakery wants to ensure that the production of Brioche does not exceed 50% of the total bread production.\nmodel.addCons(B <= 0.5*(W + R + S + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1557,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche.\n// {\"Whole Wheat bread production\": \"W\", \"range\": \"0 <= W <= 100\", \"type\": \"integer\"}\n// {\"Rye bread production\": \"R\", \"range\": \"0 <= R <= 100\", \"type\": \"integer\"}\n// {\"Sourdough bread production\": \"S\", \"range\": \"0 <= S <= 100\", \"type\": \"integer\"}\n// {\"Brioche bread production\": \"B\", \"range\": \"0 <= B <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit. The profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively.\n// Objective Function: Maximize: 2*W + 3*R + 2.5*S + 4*B\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively.\n// 0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200\n\n## Generate Constraint-2:\nThe bakery has a limit of 150 hours of labor available daily. Each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively.\n// 0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores.\n// W >= 20\n// R >= 20\n// S >= 20\n// B >= 20\n\n## Generate Constraint-4:\nThe bakery wants to ensure that the production of Brioche does not exceed 50% of the total bread production.\n// B <= 0.5*(W + R + S + B)",
        "question": "A bakery wants to decide the daily production quantities of four types of bread: Whole Wheat, Rye, Sourdough, and Brioche. The bakery aims to maximize its daily profit, where the profit per loaf for Whole Wheat, Rye, Sourdough, and Brioche is $2, $3, $2.5, and $4 respectively. The bakery has a total of 200 kg of flour available daily, and each loaf of Whole Wheat, Rye, Sourdough, and Brioche requires 0.5 kg, 0.4 kg, 0.3 kg, and 0.6 kg of flour respectively. The bakery also has a limit of 150 hours of labor available daily, with each loaf of Whole Wheat, Rye, Sourdough, and Brioche requiring 0.2 hours, 0.3 hours, 0.15 hours, and 0.4 hours of labor respectively. The bakery must produce at least 20 loaves of each type of bread to meet the minimum order requirements from local stores. Additionally, the bakery wants to ensure that the production of Brioche does not exceed 50% of the total bread production. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantities of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=100) # Whole Wheat bread production\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=100) # Rye bread production\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # Sourdough bread production\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # Brioche bread production\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*W + 3*R + 2.5*S + 4*B)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(0.5*W + 0.4*R + 0.3*S + 0.6*B <= 200)\n## The bakery has a limit of 150 hours of labor available daily.\nmodel.addCons(0.2*W + 0.3*R + 0.15*S + 0.4*B <= 150)\n## The bakery must produce at least 20 loaves of each type of bread.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(B >= 20)\n## The bakery wants to ensure that the production of Brioche does not exceed 50% of the total bread production.\nmodel.addCons(B <= 0.5*(W + R + S + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whole Wheat bread production: \", model.getVal(W))\n    print(\"Rye bread production: \", model.getVal(R))\n    print(\"Sourdough bread production: \", model.getVal(S))\n    print(\"Brioche bread production: \", model.getVal(B))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\n// W >= 20\n// R >= 20\n// S >= 20\n// G >= 20\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for sourdough bread of 30 loaves.\n// S >= 30",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The bakery wants to maximize its daily profit. The profit per loaf and the cost per loaf for each type of bread are given in the following Table.\n\n| Bread Type | Profit per Loaf | Cost per Loaf |\n|------------|-----------------|---------------|\n| Wheat      | $0.50           | $0.30         |\n| Rye        | $0.70           | $0.40         |\n| Sourdough  | $0.60           | $0.50         |\n| Whole Grain| $0.80           | $0.60         |\n\nThe bakery has a limited daily budget of $100 for production costs. The bakery has a maximum daily oven capacity of 200 loaves. The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a minimum daily demand for sourdough bread of 30 loaves.\n\nPlease help the bakery to determine the optimal daily production quantities of each type of bread to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n## The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(G >= 20)\n## The bakery has a minimum daily demand for sourdough bread of 30 loaves.\nmodel.addCons(S >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin.\n// {\"daily production of Wheat bread\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"daily production of Rye bread\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"daily production of Sourdough bread\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"daily production of Whole Grain bread\": \"G\", \"range\": \"G >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively.\n// Objective Function: Maximize: 0.50*W + 0.70*R + 0.60*S + 0.80*G\n\n## Generate Constraint-1:\nThe bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively.\n// 0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100\n\n## Generate Constraint-2:\nThe bakery has a maximum daily oven capacity of 200 loaves.\n// W + R + S + G <= 200\n\n## Generate Constraint-3:\nThe bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\n// W >= 20\n// R >= 20\n// S >= 20\n// G >= 20\n\n## Generate Constraint-4:\nThe bakery has a minimum daily demand for sourdough bread of 30 loaves.\n// S >= 30",
        "question": "A bakery wants to determine the daily production quantities of four types of bread: wheat, rye, sourdough, and whole grain. Each type of bread has a different cost to produce and a different profit margin. The bakery wants to maximize its daily profit. The profit per loaf for wheat, rye, sourdough, and whole grain breads are $0.50, $0.70, $0.60, and $0.80 respectively. The bakery has a limited daily budget of $100 for production costs. The cost per loaf for wheat, rye, sourdough, and whole grain breads are $0.30, $0.40, $0.50, and $0.60 respectively. The bakery has a maximum daily oven capacity of 200 loaves. The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations. Additionally, the bakery has a minimum daily demand for sourdough bread of 30 loaves. Please help the bakery determine the optimal daily production quantities for each type of bread to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production of each type of bread\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # daily production of Wheat bread\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # daily production of Rye bread\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # daily production of Sourdough bread\nG = model.addVar(vtype=\"INTEGER\", name=\"G\", lb=0) # daily production of Whole Grain bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*W + 0.70*R + 0.60*S + 0.80*G)\n\n# Add constraints\n## The bakery has a limited daily budget of $100 for production costs.\nmodel.addCons(0.30*W + 0.40*R + 0.50*S + 0.60*G <= 100)\n## The bakery has a maximum daily oven capacity of 200 loaves.\nmodel.addCons(W + R + S + G <= 200)\n## The bakery must produce at least 20 loaves of each type of bread to meet contractual obligations.\nmodel.addCons(W >= 20)\nmodel.addCons(R >= 20)\nmodel.addCons(S >= 20)\nmodel.addCons(G >= 20)\n## The bakery has a minimum daily demand for sourdough bread of 30 loaves.\nmodel.addCons(S >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production of Wheat bread: \", model.getVal(W))\n    print(\"Daily production of Rye bread: \", model.getVal(R))\n    print(\"Daily production of Sourdough bread: \", model.getVal(S))\n    print(\"Daily production of Whole Grain bread: \", model.getVal(G))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 kg of eggs available daily. Each cake 1 requires 0.3 kg of eggs, cake 2 requires 0.4 kg, cake 3 requires 0.3 kg, and cake 4 requires 0.2 kg.\n// 0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 cakes are produced daily in total.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Additionally, the bakery has a total of 100 kg of eggs available daily, with each cake 1 requiring 0.3 kg of eggs, cake 2 requiring 0.4 kg, cake 3 requiring 0.3 kg, and cake 4 requiring 0.2 kg. The bakery wants to ensure that at least 50 cakes are produced daily in total.\n\nPlease help the bakery to maximize the total daily profit by determining the optimal number of each type of cake to produce, given the constraints on flour, sugar, and eggs.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Eggs Required (kg) |\n|-----------|-----------------|---------------------|---------------------|--------------------|\n| 1         | $5              | 1                   | 0.5                 | 0.3                |\n| 2         | $7              | 2                   | 0.7                 | 0.4                |\n| 3         | $6              | 1.5                 | 0.6                 | 0.3                |\n| 4         | $4              | 1                   | 0.5                 | 0.2                |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a total of 100 kg of eggs available daily.\nmodel.addCons(0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100)\n## The bakery wants to ensure that at least 50 cakes are produced daily in total.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1638,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 200 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe bakery has a total of 150 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150\n\n## Generate Constraint-3:\nThe bakery has a total of 100 kg of eggs available daily. Each cake 1 requires 0.3 kg of eggs, cake 2 requires 0.4 kg, cake 3 requires 0.3 kg, and cake 4 requires 0.2 kg.\n// 0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 50 cakes are produced daily in total.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 200 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. The bakery also has a total of 150 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. Additionally, the bakery has a total of 100 kg of eggs available daily, with each cake 1 requiring 0.3 kg of eggs, cake 2 requiring 0.4 kg, cake 3 requiring 0.3 kg, and cake 4 requiring 0.2 kg. The bakery wants to ensure that at least 50 cakes are produced daily in total. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 200 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 200)\n## The bakery has a total of 150 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 150)\n## The bakery has a total of 100 kg of eggs available daily.\nmodel.addCons(0.3*C1 + 0.4*C2 + 0.3*C3 + 0.2*C4 <= 100)\n## The bakery wants to ensure that at least 50 cakes are produced daily in total.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\n// B1 >= 20\n// B2 >= 30\n\n## Generate Constraint-4:\nThe bakery has a policy to not produce more than 50 loaves of any single type of bread.\n// B1 <= 50\n// B2 <= 50\n// B3 <= 50\n// B4 <= 50",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively. The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2. The bakery has a policy to not produce more than 50 loaves of any single type of bread.\n\nPlease help the bakery to maximize its total profit by determining the optimal amount of each type of bread to produce.\n\n| Bread Type | Profit Margin per Loaf | Flour Required per Loaf (kg) |\n|------------|-------------------------|------------------------------|\n| Bread 1    | $0.50                   | 0.2                          |\n| Bread 2    | $0.75                   | 0.3                          |\n| Bread 3    | $0.60                   | 0.25                         |\n| Bread 4    | $0.45                   | 0.15                         |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n## Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 30)\n## The bakery has a policy to not produce more than 50 loaves of any single type of bread.\nmodel.addCons(B1 <= 50)\nmodel.addCons(B2 <= 50)\nmodel.addCons(B3 <= 50)\nmodel.addCons(B4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to produce four types of bread (bread 1-4) to maximize its profit. Each type of bread requires a specific amount of flour and has a different profit margin.\n// {\"amount of bread 1 to produce\": \"B1\", \"range\": \"0 <= B1 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 2 to produce\": \"B2\", \"range\": \"0 <= B2 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 3 to produce\": \"B3\", \"range\": \"0 <= B3 <= 100\", \"type\": \"integer\"}\n// {\"amount of bread 4 to produce\": \"B4\", \"range\": \"0 <= B4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. The bakery wants to maximize its total profit.\n// Objective Function: Maximize: 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4\n\n## Generate Constraint-1:\nThe bakery has 50 kg of flour available. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively.\n// 0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50\n\n## Generate Constraint-2:\nThe bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\n// B1 + B2 + B3 + B4 <= 200\n\n## Generate Constraint-3:\nDue to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\n// B1 >= 20\n// B2 >= 30\n\n## Generate Constraint-4:\nThe bakery has a policy to not produce more than 50 loaves of any single type of bread.\n// B1 <= 50\n// B2 <= 50\n// B3 <= 50\n// B4 <= 50",
        "question": "A bakery wants to produce four types of bread (bread 1-4) to maximize its profit. The profit margins for bread 1-4 are $0.50, $0.75, $0.60, and $0.45 per loaf respectively. Each loaf of bread 1-4 requires 0.2 kg, 0.3 kg, 0.25 kg, and 0.15 kg of flour respectively, and the bakery has 50 kg of flour available. The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total. Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2. The bakery has a policy to not produce more than 50 loaves of any single type of bread. Please help the bakery to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each type of bread to produce\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100) # amount of bread 1 to produce\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=100) # amount of bread 2 to produce\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0, ub=100) # amount of bread 3 to produce\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0, ub=100) # amount of bread 4 to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*B1 + 0.75*B2 + 0.60*B3 + 0.45*B4)\n\n# Add constraints\n## The bakery has 50 kg of flour available.\nmodel.addCons(0.2*B1 + 0.3*B2 + 0.25*B3 + 0.15*B4 <= 50)\n## The bakery has a limited oven capacity and can bake at most 200 loaves of bread in total.\nmodel.addCons(B1 + B2 + B3 + B4 <= 200)\n## Due to market demand, the bakery must produce at least 20 loaves of bread 1 and 30 loaves of bread 2.\nmodel.addCons(B1 >= 20)\nmodel.addCons(B2 >= 30)\n## The bakery has a policy to not produce more than 50 loaves of any single type of bread.\nmodel.addCons(B1 <= 50)\nmodel.addCons(B2 <= 50)\nmodel.addCons(B3 <= 50)\nmodel.addCons(B4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of bread 1 to produce: \", model.getVal(B1))\n    print(\"Amount of bread 2 to produce: \", model.getVal(B2))\n    print(\"Amount of bread 3 to produce: \", model.getVal(B3))\n    print(\"Amount of bread 4 to produce: \", model.getVal(B4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 642,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 50 cakes of any type are produced daily to maintain operational efficiency.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n\n| Cake Type | Profit per Cake | Flour Required (kg) | Sugar Required (kg) | Maximum Daily Demand |\n|-----------|-----------------|---------------------|---------------------|----------------------|\n| 1         | $5              | 1                   | 0.5                 | 80                   |\n| 2         | $7              | 2                   | 0.7                 | 70                   |\n| 3         | $6              | 1.5                 | 0.6                 | 60                   |\n| 4         | $4              | 1                   | 0.5                 | 90                   |\n\nThe bakery has a total of 300 kg of flour available daily. The bakery also has a total of 200 kg of sugar available daily. The bakery must ensure that at least 50 cakes of any type are produced daily to maintain operational efficiency.\n\nPlease help the bakery determine the optimal number of each type of cake to produce daily to maximize the total daily profit while adhering to the constraints on flour, sugar, and demand limits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 50 cakes of any type are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce.\n// {\"number of Cake 1 produced\": \"C1\", \"range\": \"0 <= C1 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 2 produced\": \"C2\", \"range\": \"0 <= C2 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 3 produced\": \"C3\", \"range\": \"0 <= C3 <= 100\", \"type\": \"integer\"}\n// {\"number of Cake 4 produced\": \"C4\", \"range\": \"0 <= C4 <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 5*C1 + 7*C2 + 6*C3 + 4*C4\n\n## Generate Constraint-1:\nThe bakery has a total of 300 kg of flour available daily. Each cake 1 requires 1 kg of flour, cake 2 requires 2 kg, cake 3 requires 1.5 kg, and cake 4 requires 1 kg.\n// C1 + 2*C2 + 1.5*C3 + C4 <= 300\n\n## Generate Constraint-2:\nThe bakery has a total of 200 kg of sugar available daily. Each cake 1 requires 0.5 kg of sugar, cake 2 requires 0.7 kg, cake 3 requires 0.6 kg, and cake 4 requires 0.5 kg.\n// 0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200\n\n## Generate Constraint-3:\nThe bakery has a demand limit for each cake type. The maximum daily demand for cakes 1-4 is 80, 70, 60, and 90 respectively.\n// C1 <= 80\n// C2 <= 70\n// C3 <= 60\n// C4 <= 90\n\n## Generate Constraint-4:\nThe bakery must ensure that at least 50 cakes of any type are produced daily to maintain operational efficiency.\n// C1 + C2 + C3 + C4 >= 50",
        "question": "A bakery produces four types of cakes (cakes 1-4) daily. The bakery must decide how many of each type of cake to produce. The profit per cake for cakes 1-4 is $5, $7, $6, and $4 respectively. The bakery wants to maximize the total daily profit. The bakery has a total of 300 kg of flour available daily, with each cake 1 requiring 1 kg of flour, cake 2 requiring 2 kg, cake 3 requiring 1.5 kg, and cake 4 requiring 1 kg. Additionally, the bakery has a total of 200 kg of sugar available daily, with each cake 1 requiring 0.5 kg of sugar, cake 2 requiring 0.7 kg, cake 3 requiring 0.6 kg, and cake 4 requiring 0.5 kg. The bakery has a demand limit for each cake type, with the maximum daily demand for cakes 1-4 being 80, 70, 60, and 90 respectively. The bakery must also ensure that at least 50 cakes of any type are produced daily to maintain operational efficiency. Please help the bakery determine the optimal number of each type of cake to produce to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake produced\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100) # number of Cake 1 produced\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=100) # number of Cake 2 produced\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=100) # number of Cake 3 produced\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=100) # number of Cake 4 produced\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*C1 + 7*C2 + 6*C3 + 4*C4)\n\n# Add constraints\n## The bakery has a total of 300 kg of flour available daily.\nmodel.addCons(C1 + 2*C2 + 1.5*C3 + C4 <= 300)\n## The bakery has a total of 200 kg of sugar available daily.\nmodel.addCons(0.5*C1 + 0.7*C2 + 0.6*C3 + 0.5*C4 <= 200)\n## The bakery has a demand limit for each cake type.\nmodel.addCons(C1 <= 80)\nmodel.addCons(C2 <= 70)\nmodel.addCons(C3 <= 60)\nmodel.addCons(C4 <= 90)\n## The bakery must ensure that at least 50 cakes of any type are produced daily.\nmodel.addCons(C1 + C2 + C3 + C4 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake 1 produced: \", model.getVal(C1))\n    print(\"Number of Cake 2 produced: \", model.getVal(C2))\n    print(\"Number of Cake 3 produced: \", model.getVal(C3))\n    print(\"Number of Cake 4 produced: \", model.getVal(C4))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nProduct A and Product B cannot be launched together due to market overlap.\n// P1 + P2 <= 1\n\n## Generate Constraint-4:\nAt least one of Product C or Product D must be launched to meet a contractual obligation.\n// P3 + P4 >= 1",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively, and the production cost for each product is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products. The company can only allocate resources to at most two products due to limited marketing capabilities. Product A and Product B cannot be launched together due to market overlap. At least one of Product C or Product D must be launched to meet a contractual obligation.\n\nPlease help the company to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"B\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"B\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"B\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"B\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## Product A and Product B cannot be launched together due to market overlap.\nmodel.addCons(P1 + P2 <= 1)\n## At least one of Product C or Product D must be launched to meet a contractual obligation.\nmodel.addCons(P3 + P4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product.\n// {\"whether to launch Product A\": \"P1\", \"range\": \"P1 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product B\": \"P2\", \"range\": \"P2 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product C\": \"P3\", \"range\": \"P3 = 0 or 1\", \"type\": \"binary\"}\n// {\"whether to launch Product D\": \"P4\", \"range\": \"P4 = 0 or 1\", \"type\": \"binary\"}\n\n## Define Objective Function:\nThe expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit.\n// Objective Function: Maximize: 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4\n\n## Generate Constraint-1:\nThe production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\n// 6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000\n\n## Generate Constraint-2:\nThe company can only allocate resources to at most two products due to limited marketing capabilities.\n// P1 + P2 + P3 + P4 <= 2\n\n## Generate Constraint-3:\nProduct A and Product B cannot be launched together due to market overlap.\n// P1 + P2 <= 1\n\n## Generate Constraint-4:\nAt least one of Product C or Product D must be launched to meet a contractual obligation.\n// P3 + P4 >= 1",
        "question": "A company is planning to launch four new products (Products A-D) in the market. The company needs to decide whether to launch each product. The expected profit for Products A-D is $20,000, $30,000, $15,000, and $25,000 respectively. The company wants to maximize the total expected profit. The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products. The company can only allocate resources to at most two products due to limited marketing capabilities. Product A and Product B cannot be launched together due to market overlap. At least one of Product C or Product D must be launched to meet a contractual obligation. Please help the company decide whether to launch each product to maximize the total expected profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Whether to launch each product\nP1 = model.addVar(vtype=\"B\", name=\"P1\") # whether to launch Product A\nP2 = model.addVar(vtype=\"B\", name=\"P2\") # whether to launch Product B\nP3 = model.addVar(vtype=\"B\", name=\"P3\") # whether to launch Product C\nP4 = model.addVar(vtype=\"B\", name=\"P4\") # whether to launch Product D\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20000*P1 + 30000*P2 + 15000*P3 + 25000*P4)\n\n# Add constraints\n## The production cost for Products A-D is $6,000, $8,000, $5,000, and $7,000 respectively. The company has a budget of $18,000 for launching new products.\nmodel.addCons(6000*P1 + 8000*P2 + 5000*P3 + 7000*P4 <= 18000)\n## The company can only allocate resources to at most two products due to limited marketing capabilities.\nmodel.addCons(P1 + P2 + P3 + P4 <= 2)\n## Product A and Product B cannot be launched together due to market overlap.\nmodel.addCons(P1 + P2 <= 1)\n## At least one of Product C or Product D must be launched to meet a contractual obligation.\nmodel.addCons(P3 + P4 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Whether to launch Product A: \", model.getVal(P1))\n    print(\"Whether to launch Product B: \", model.getVal(P2))\n    print(\"Whether to launch Product C: \", model.getVal(P3))\n    print(\"Whether to launch Product D: \", model.getVal(P4))\n    print(\"Maximized Total Expected Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\n// Vanilla >= 10\n// Strawberry >= 15\n\n## Generate Constraint-4:\nThe total number of cakes produced daily must not exceed 120.\n// Chocolate + Vanilla + Strawberry + Carrot <= 120",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for each type and the labor hours required for each cake are given in the following Table.\n\n| Cake Type   | Profit per Cake | Labor Hours Required |\n|-------------|-----------------|----------------------|\n| Chocolate   | $5              | 2                    |\n| Vanilla     | $4              | 1                    |\n| Strawberry  | $3              | 1                    |\n| Carrot      | $6              | 3                    |\n\nThe bakery has a total of 100 hours of labor available daily. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily. The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand. The total number of cakes produced daily must not exceed 120.\n\nPlease help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n## The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\nmodel.addCons(Vanilla >= 10)\nmodel.addCons(Strawberry >= 15)\n## The total number of cakes produced daily must not exceed 120.\nmodel.addCons(Chocolate + Vanilla + Strawberry + Carrot <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"number of Carrot cakes\": \"Carrot\", \"range\": \"Carrot >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery wants to maximize its daily profit.\n// Objective Function: Maximize: 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively.\n// 2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\n// Chocolate <= 50\n// Carrot <= 40\n\n## Generate Constraint-3:\nThe bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\n// Vanilla >= 10\n// Strawberry >= 15\n\n## Generate Constraint-4:\nThe total number of cakes produced daily must not exceed 120.\n// Chocolate + Vanilla + Strawberry + Carrot <= 120",
        "question": "A bakery produces four types of cakes: Chocolate, Vanilla, Strawberry, and Carrot. The bakery needs to decide how many cakes of each type to produce daily to meet customer demand and optimize profits. The profit per cake for Chocolate, Vanilla, Strawberry, and Carrot is $5, $4, $3, and $6, respectively. The bakery has a total of 100 hours of labor available daily. Each Chocolate, Vanilla, Strawberry, and Carrot cake requires 2, 1, 1, and 3 hours of labor, respectively. The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily. The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand. The total number of cakes produced daily must not exceed 120. Please help the bakery to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of cakes of each type to produce daily\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nCarrot = model.addVar(vtype=\"INTEGER\", name=\"Carrot\", lb=0) # number of Carrot cakes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5*Chocolate + 4*Vanilla + 3*Strawberry + 6*Carrot)\n\n# Add constraints\n## The bakery has a total of 100 hours of labor available daily.\nmodel.addCons(2*Chocolate + Vanilla + Strawberry + 3*Carrot <= 100)\n## The bakery has a limited supply of ingredients, allowing for a maximum of 50 Chocolate cakes and 40 Carrot cakes to be produced daily.\nmodel.addCons(Chocolate <= 50)\nmodel.addCons(Carrot <= 40)\n## The bakery must produce at least 10 Vanilla cakes and 15 Strawberry cakes to meet minimum customer demand.\nmodel.addCons(Vanilla >= 10)\nmodel.addCons(Strawberry >= 15)\n## The total number of cakes produced daily must not exceed 120.\nmodel.addCons(Chocolate + Vanilla + Strawberry + Carrot <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Number of Carrot cakes: \", model.getVal(Carrot))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 200 pastries.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 50 croissants and 50 muffins daily to meet the minimum customer demand.\n// Croissants >= 50, Muffins >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The bakery has a daily budget of $100 for ingredients, with each croissant requiring $0.50 worth of ingredients and each muffin requiring $0.75 worth of ingredients. The bakery also has a daily labor limit of 8 hours, with each croissant requiring 0.1 hours of labor and each muffin requiring 0.2 hours of labor. Additionally, the bakery has a storage capacity limit of 200 pastries. The bakery aims to produce at least 50 croissants and 50 muffins daily to meet the minimum customer demand.\n\nPlease help the bakery to maximize the total daily profit.\n\n| Pastry   | Profit per Unit | Cost per Unit (Ingredients) | Labor Time per Unit |\n|----------|-----------------|-----------------------------|---------------------|\n| Croissant| $2              | $0.50                       | 0.1 hours           |\n| Muffin   | $3              | $0.75                       | 0.2 hours           |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a storage capacity limit of 200 pastries.\nmodel.addCons(Croissants + Muffins <= 200)\n## The bakery aims to produce at least 50 croissants and 50 muffins daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor.\n// {\"number of croissants\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per croissant is $2, and the profit per muffin is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Croissants + 3*Muffins\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients. Each croissant requires $0.50 worth of ingredients, and each muffin requires $0.75 worth of ingredients.\n// 0.50*Croissants + 0.75*Muffins <= 100\n\n## Generate Constraint-2:\nThe bakery has a daily labor limit of 8 hours. Each croissant requires 0.1 hours of labor, and each muffin requires 0.2 hours of labor.\n// 0.1*Croissants + 0.2*Muffins <= 8\n\n## Generate Constraint-3:\nThe bakery has a storage capacity limit of 200 pastries.\n// Croissants + Muffins <= 200\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 50 croissants and 50 muffins daily to meet the minimum customer demand.\n// Croissants >= 50, Muffins >= 50",
        "question": "A bakery produces two types of pastries: croissants and muffins. The bakery needs to determine the optimal number of each type of pastry to produce daily to maximize profit while considering the constraints of ingredients and labor. The profit per croissant is $2, and the profit per muffin is $3. The bakery has a daily budget of $100 for ingredients, where each croissant requires $0.50 worth of ingredients and each muffin requires $0.75 worth of ingredients. The bakery has a daily labor limit of 8 hours, with each croissant requiring 0.1 hours of labor and each muffin requiring 0.2 hours of labor. The bakery also has a storage capacity limit of 200 pastries. Additionally, the bakery aims to produce at least 50 croissants and 50 muffins daily to meet the minimum customer demand. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce daily\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Croissants + 3*Muffins)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.50*Croissants + 0.75*Muffins <= 100)\n## The bakery has a daily labor limit of 8 hours.\nmodel.addCons(0.1*Croissants + 0.2*Muffins <= 8)\n## The bakery has a storage capacity limit of 200 pastries.\nmodel.addCons(Croissants + Muffins <= 200)\n## The bakery aims to produce at least 50 croissants and 50 muffins daily.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissants))\n    print(\"Number of Muffins: \", model.getVal(Muffins))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 loaves of bread.\n// Wheat_Loaves + Rye_Loaves >= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread produced is wheat bread.\n// Wheat_Loaves >= 0.3 * (Wheat_Loaves + Rye_Loaves)",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Labor Hours Required |\n|------------|-----------------|------------------------|----------------------|\n| Wheat      | $2              | 0.5                    | 0.2                  |\n| Rye        | $3              | 0.6                    | 0.3                  |\n\nThe bakery has 200 kg of flour available daily. The bakery has 100 hours of labor available daily. The bakery has a minimum daily demand of 100 loaves of bread. The bakery wants to ensure that at least 30% of the total bread produced is wheat bread. Please help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n## The bakery has a minimum daily demand of 100 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 100)\n## The bakery wants to ensure that at least 30% of the total bread produced is wheat bread.\nmodel.addCons(Wheat_Loaves >= 0.3 * (Wheat_Loaves + Rye_Loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of wheat loaves\": \"Wheat_Loaves\", \"range\": \"Wheat_Loaves >= 0\", \"type\": \"integer\"}\n// {\"number of rye loaves\": \"Rye_Loaves\", \"range\": \"Rye_Loaves >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Wheat_Loaves + 3*Rye_Loaves\n\n## Generate Constraint-1:\nThe bakery has 200 kg of flour available daily. Each loaf of wheat bread requires 0.5 kg of flour, and each loaf of rye bread requires 0.6 kg of flour.\n// 0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200\n\n## Generate Constraint-2:\nThe bakery has 100 hours of labor available daily. Each loaf of wheat bread requires 0.2 hours of labor, and each loaf of rye bread requires 0.3 hours of labor.\n// 0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 100 loaves of bread.\n// Wheat_Loaves + Rye_Loaves >= 100\n\n## Generate Constraint-4:\nThe bakery wants to ensure that at least 30% of the total bread produced is wheat bread.\n// Wheat_Loaves >= 0.3 * (Wheat_Loaves + Rye_Loaves)",
        "question": "A bakery produces two types of bread: wheat and rye. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has 200 kg of flour available daily, with each loaf of wheat bread requiring 0.5 kg of flour and each loaf of rye bread requiring 0.6 kg of flour. The bakery also has 100 hours of labor available daily, with each loaf of wheat bread requiring 0.2 hours of labor and each loaf of rye bread requiring 0.3 hours of labor. The bakery has a minimum daily demand of 100 loaves of bread and wants to ensure that at least 30% of the total bread produced is wheat bread. Please help the bakery maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Loaves\", lb=0) # number of wheat loaves\nRye_Loaves = model.addVar(vtype=\"INTEGER\", name=\"Rye_Loaves\", lb=0) # number of rye loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Loaves + 3*Rye_Loaves)\n\n# Add constraints\n## The bakery has 200 kg of flour available daily.\nmodel.addCons(0.5*Wheat_Loaves + 0.6*Rye_Loaves <= 200)\n## The bakery has 100 hours of labor available daily.\nmodel.addCons(0.2*Wheat_Loaves + 0.3*Rye_Loaves <= 100)\n## The bakery has a minimum daily demand of 100 loaves of bread.\nmodel.addCons(Wheat_Loaves + Rye_Loaves >= 100)\n## The bakery wants to ensure that at least 30% of the total bread produced is wheat bread.\nmodel.addCons(Wheat_Loaves >= 0.3 * (Wheat_Loaves + Rye_Loaves))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat loaves: \", model.getVal(Wheat_Loaves))\n    print(\"Number of rye loaves: \", model.getVal(Rye_Loaves))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 50 breads.\n// Whole_Wheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n// Rye >= 0.5*Whole_Wheat",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type     | Profit per Bread | Flour Requirement (kg) | Labor Time (minutes) |\n|----------------|------------------|------------------------|----------------------|\n| Whole Wheat    | $2               | 0.5                    | 15                   |\n| Rye            | $3               | 0.4                    | 20                   |\n\nThe bakery has a daily supply of 100 kg of flour. The bakery has 8 hours of daily labor available. The bakery has a minimum daily demand of 50 breads. The bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n\nPlease help the bakery to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n## The bakery has a minimum daily demand of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n## The bakery aims to maintain a balance between the two types of bread.\nmodel.addCons(Rye >= 0.5*Whole_Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of whole wheat breads\": \"Whole_Wheat\", \"range\": \"Whole_Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye breads\": \"Rye\", \"range\": \"Rye >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery wants to maximize the total daily profit.\n// Objective Function: Maximize: 2*Whole_Wheat + 3*Rye\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour.\n// 0.5*Whole_Wheat + 0.4*Rye <= 100\n\n## Generate Constraint-2:\nThe bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor.\n// (15/60)*Whole_Wheat + (20/60)*Rye <= 8\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand of 50 breads.\n// Whole_Wheat + Rye >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads.\n// Rye >= 0.5*Whole_Wheat",
        "question": "A bakery produces two types of bread: whole wheat and rye. The bakery needs to determine the optimal number of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per whole wheat bread is $2, and the profit per rye bread is $3. The bakery has a daily supply of 100 kg of flour. Each whole wheat bread requires 0.5 kg of flour, and each rye bread requires 0.4 kg of flour. The bakery has 8 hours of daily labor available. Each whole wheat bread requires 15 minutes of labor, and each rye bread requires 20 minutes of labor. The bakery has a minimum daily demand of 50 breads. The bakery aims to maintain a balance between the two types of bread, ensuring that the number of rye breads produced is at least half the number of whole wheat breads. Please help the bakery to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of bread to produce daily\nWhole_Wheat = model.addVar(vtype=\"INTEGER\", name=\"Whole_Wheat\", lb=0) # number of whole wheat breads\nRye = model.addVar(vtype=\"INTEGER\", name=\"Rye\", lb=0) # number of rye breads\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Whole_Wheat + 3*Rye)\n\n# Add constraints\n## The bakery has a daily supply of 100 kg of flour.\nmodel.addCons(0.5*Whole_Wheat + 0.4*Rye <= 100)\n## The bakery has 8 hours of daily labor available.\nmodel.addCons((15/60)*Whole_Wheat + (20/60)*Rye <= 8)\n## The bakery has a minimum daily demand of 50 breads.\nmodel.addCons(Whole_Wheat + Rye >= 50)\n## The bakery aims to maintain a balance between the two types of bread.\nmodel.addCons(Rye >= 0.5*Whole_Wheat)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of whole wheat breads: \", model.getVal(Whole_Wheat))\n    print(\"Number of rye breads: \", model.getVal(Rye))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations.\n// Wheat_Bread >= 100, Rye_Bread >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\n// Rye_Bread <= 2*Wheat_Bread",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours. The profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Required (pounds) | Labor Hours Required |\n|------------|-----------------|-------------------------|----------------------|\n| Wheat      | $2              | 1                       | 0.5                  |\n| Rye        | $3              | 1.5                     | 0.75                 |\n\nThe bakery has a daily supply of 500 pounds of flour. The bakery has a daily limit of 300 labor hours. The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations. The bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\n\nPlease help the bakery to maximize the total daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n## The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 50)\n## The bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\nmodel.addCons(Rye_Bread <= 2*Wheat_Bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 2,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\n// {\"number of loaves of wheat bread\": \"Wheat_Bread\", \"range\": \"Wheat_Bread >= 0\", \"type\": \"integer\"}\n// {\"number of loaves of rye bread\": \"Rye_Bread\", \"range\": \"Rye_Bread >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery wants to maximize the total daily profit from selling both types of bread.\n// Objective Function: Maximize: 2*Wheat_Bread + 3*Rye_Bread\n\n## Generate Constraint-1:\nThe bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour.\n// Wheat_Bread + 1.5*Rye_Bread <= 500\n\n## Generate Constraint-2:\nThe bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor.\n// 0.5*Wheat_Bread + 0.75*Rye_Bread <= 300\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations.\n// Wheat_Bread >= 100, Rye_Bread >= 50\n\n## Generate Constraint-4:\nThe bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\n// Rye_Bread <= 2*Wheat_Bread",
        "question": "A bakery produces two types of bread: wheat bread and rye bread. The bakery needs to determine the optimal number of loaves of each type of bread to produce daily to maximize profit while considering the constraints of raw material availability and labor hours.\nThe profit per loaf of wheat bread is $2, and the profit per loaf of rye bread is $3. The bakery has a daily supply of 500 pounds of flour. Each loaf of wheat bread requires 1 pound of flour, and each loaf of rye bread requires 1.5 pounds of flour. The bakery has a daily limit of 300 labor hours. Each loaf of wheat bread requires 0.5 hours of labor, and each loaf of rye bread requires 0.75 hours of labor. The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread to meet contractual obligations. The bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\nPlease help the bakery to maximize the total daily profit from selling both types of bread.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nWheat_Bread = model.addVar(vtype=\"INTEGER\", name=\"Wheat_Bread\", lb=0) # number of loaves of wheat bread\nRye_Bread = model.addVar(vtype=\"INTEGER\", name=\"Rye_Bread\", lb=0) # number of loaves of rye bread\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*Wheat_Bread + 3*Rye_Bread)\n\n# Add constraints\n## The bakery has a daily supply of 500 pounds of flour.\nmodel.addCons(Wheat_Bread + 1.5*Rye_Bread <= 500)\n## The bakery has a daily limit of 300 labor hours.\nmodel.addCons(0.5*Wheat_Bread + 0.75*Rye_Bread <= 300)\n## The bakery has a minimum daily production requirement of 100 loaves of wheat bread and 50 loaves of rye bread.\nmodel.addCons(Wheat_Bread >= 100)\nmodel.addCons(Rye_Bread >= 50)\n## The bakery aims to maintain a balanced production, ensuring that the number of loaves of rye bread does not exceed twice the number of loaves of wheat bread.\nmodel.addCons(Rye_Bread <= 2*Wheat_Bread)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of loaves of wheat bread: \", model.getVal(Wheat_Bread))\n    print(\"Number of loaves of rye bread: \", model.getVal(Rye_Bread))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 2,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000\n\n## Generate Constraint-3:\nThe demand for laptops must be met, with at least 200 laptops produced.\n// Laptops >= 200\n\n## Generate Constraint-4:\nThe manufacturer must produce at least twice as many smartphones as tablets.\n// Smartphones >= 2*Tablets",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources. The cost and revenue for each device are given in the following Table.\n\n| Device       | Production Cost | Selling Price |\n|--------------|-----------------|---------------|\n| Smartphones  | $100            | $200          |\n| Tablets      | $150            | $300          |\n| Laptops      | $300            | $500          |\n| Smartwatches | $50             | $100          |\n\nThe manufacturer has a production capacity of 1000 units. The budget for production is $200,000. The demand for laptops must be met, with at least 200 laptops produced. The manufacturer must produce at least twice as many smartphones as tablets. \nPlease help the manufacturer to maximize the total profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nTotal_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\nTotal_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(Total_Cost <= 200000)\n## The demand for laptops must be met, with at least 200 laptops produced.\nmodel.addCons(Laptops >= 200)\n## The manufacturer must produce at least twice as many smartphones as tablets.\nmodel.addCons(Smartphones >= 2*Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources.\n// {\"number of smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"continuous\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"continuous\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"continuous\"}\n// {\"number of smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit.\n// Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n// Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe manufacturer has a production capacity of 1000 units.\n// Smartphones + Tablets + Laptops + Smartwatches <= 1000\n\n## Generate Constraint-2:\nThe budget for production is $200,000.\n// Total_Cost <= 200000\n\n## Generate Constraint-3:\nThe demand for laptops must be met, with at least 200 laptops produced.\n// Laptops >= 200\n\n## Generate Constraint-4:\nThe manufacturer must produce at least twice as many smartphones as tablets.\n// Smartphones >= 2*Tablets",
        "question": "A manufacturer produces four types of electronic devices: smartphones, tablets, laptops, and smartwatches. The manufacturer needs to determine the number of each device to produce to meet demand while optimizing costs and resources. The cost to produce one smartphone is $100, one tablet is $150, one laptop is $300, and one smartwatch is $50. The revenue from selling one smartphone is $200, one tablet is $300, one laptop is $500, and one smartwatch is $100. The manufacturer wants to maximize the total profit. The manufacturer has a production capacity of 1000 units and a budget for production of $200,000. The demand for laptops must be met, with at least 200 laptops produced. The manufacturer must also produce at least twice as many smartphones as tablets. Please help the manufacturer determine the optimal number of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmartphones = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartphones\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"CONTINUOUS\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"CONTINUOUS\", name=\"Laptops\", lb=0) # number of laptops\nSmartwatches = model.addVar(vtype=\"CONTINUOUS\", name=\"Smartwatches\", lb=0) # number of smartwatches\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\n## Total_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nTotal_Cost = 100*Smartphones + 150*Tablets + 300*Laptops + 50*Smartwatches\nTotal_Revenue = 200*Smartphones + 300*Tablets + 500*Laptops + 100*Smartwatches\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The manufacturer has a production capacity of 1000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches <= 1000)\n## The budget for production is $200,000.\nmodel.addCons(Total_Cost <= 200000)\n## The demand for laptops must be met, with at least 200 laptops produced.\nmodel.addCons(Laptops >= 200)\n## The manufacturer must produce at least twice as many smartphones as tablets.\nmodel.addCons(Smartphones >= 2*Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80\n\n## Generate Constraint-3:\nEach cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\n// 0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20\n\n## Generate Constraint-4:\nThe bakery must hire at least one worker.\n// Workers >= 1",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The following table summarizes the ingredient requirements per cake type:\n\n| Cake Type       | Sugar (cups) | Eggs | Labor (hours) |\n|-----------------|--------------|------|---------------|\n| Chocolate       | 2            | 3    | 0.5           |\n| Vanilla         | 1            | 2    | 0.5           |\n| Strawberry      | 1            | 2    | 0.5           |\n\nThe bakery has 100 cups of sugar and 80 eggs available daily. The bakery has 20 hours of labor available daily. The bakery must hire at least one worker. Please help the bakery to maximize its daily profit by determining the optimal number of each type of cake to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n## Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20)\n## The bakery must hire at least one worker.\nmodel.addCons(Workers >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor.\n// {\"number of chocolate cakes to produce\": \"Chocolate_Cakes\", \"range\": \"Chocolate_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes to produce\": \"Vanilla_Cakes\", \"range\": \"Vanilla_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes to produce\": \"Strawberry_Cakes\", \"range\": \"Strawberry_Cakes >= 0\", \"type\": \"integer\"}\n// {\"number of workers needed\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. The bakery aims to maximize its daily profit.\n// Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n// Total_Cost = 100*Workers\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nEach chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\n// 2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100\n\n## Generate Constraint-2:\nEach chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\n// 3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80\n\n## Generate Constraint-3:\nEach cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\n// 0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20\n\n## Generate Constraint-4:\nThe bakery must hire at least one worker.\n// Workers >= 1",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many of each type of cake to produce daily to maximize profit while considering the availability of ingredients and labor. The profit per chocolate cake is $5, per vanilla cake is $4, and per strawberry cake is $3. The cost of hiring each worker per day is $100. Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily. Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily. Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily. The bakery must hire at least one worker. Please help the bakery to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of cake to produce\nChocolate_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Chocolate_Cakes\", lb=0) # number of chocolate cakes to produce\nVanilla_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Vanilla_Cakes\", lb=0) # number of vanilla cakes to produce\nStrawberry_Cakes = model.addVar(vtype=\"INTEGER\", name=\"Strawberry_Cakes\", lb=0) # number of strawberry cakes to produce\n## The number of workers needed\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of workers needed\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\nTotal_Revenue = 5*Chocolate_Cakes + 4*Vanilla_Cakes + 3*Strawberry_Cakes\n## Total_Cost = 100*Workers\nTotal_Cost = 100*Workers\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## Each chocolate cake requires 2 cups of sugar, each vanilla cake requires 1 cup, and each strawberry cake requires 1 cup. The bakery has 100 cups of sugar available daily.\nmodel.addCons(2*Chocolate_Cakes + 1*Vanilla_Cakes + 1*Strawberry_Cakes <= 100)\n## Each chocolate cake requires 3 eggs, each vanilla cake requires 2 eggs, and each strawberry cake requires 2 eggs. The bakery has 80 eggs available daily.\nmodel.addCons(3*Chocolate_Cakes + 2*Vanilla_Cakes + 2*Strawberry_Cakes <= 80)\n## Each cake requires 0.5 hours of labor. The bakery has 20 hours of labor available daily.\nmodel.addCons(0.5*Chocolate_Cakes + 0.5*Vanilla_Cakes + 0.5*Strawberry_Cakes <= 20)\n## The bakery must hire at least one worker.\nmodel.addCons(Workers >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of chocolate cakes to produce: \", model.getVal(Chocolate_Cakes))\n    print(\"Number of vanilla cakes to produce: \", model.getVal(Vanilla_Cakes))\n    print(\"Number of strawberry cakes to produce: \", model.getVal(Strawberry_Cakes))\n    print(\"Number of workers needed: \", model.getVal(Workers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs >= 20\n\n## Generate Constraint-4:\nThe bakery aims to balance its product mix to ensure variety. The number of eclairs produced should not exceed the combined number of croissants and muffins by more than 10.\n// Eclairs <= (Croissants + Muffins) + 10",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit and cost per pastry, as well as the baking time and chocolate requirements, are given in the following Table.\n\n| Pastry   | Profit per Unit | Cost per Unit | Baking Time per Unit | Chocolate Required per Unit |\n|----------|-----------------|---------------|----------------------|-----------------------------|\n| Croissant| $0.50           | $0.20         | 0.1 hours            | -                           |\n| Muffin   | $0.75           | $0.30         | 0.2 hours            | 20 grams                    |\n| Eclair   | $1.20           | $0.50         | 0.3 hours            | 50 grams                    |\n\nThe bakery has a total of 8 hours available for baking each day. The daily supply of chocolate is 400 grams. The bakery has a minimum daily production requirement of at least 50 croissants, 30 muffins, and 20 eclairs. The bakery aims to balance its product mix, ensuring that the number of eclairs produced does not exceed the combined number of croissants and muffins by more than 10.\n\nPlease help the bakery to maximize the daily profit by determining the optimal number of each type of pastry to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs >= 20)\n## The bakery aims to balance its product mix to ensure variety. The number of eclairs produced should not exceed the combined number of croissants and muffins by more than 10.\nmodel.addCons(Eclairs <= (Croissants + Muffins) + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1373,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of eclairs to produce\": \"Eclairs\", \"range\": \"Eclairs >= 0\", \"type\": \"integer\"}\n// {\"total baking time in hours\": \"Baking_Time\", \"range\": \"Baking_Time >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The bakery wants to maximize the daily profit.\n// Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n// Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\n// Objective Function: Maximize: Total_Revenue - Total_Cost\n\n## Generate Constraint-1:\nThe baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\n// 0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\n// 20*Muffins + 50*Eclairs <= 400\n\n## Generate Constraint-3:\nThe bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\n// Croissants >= 50\n// Muffins >= 30\n// Eclairs >= 20\n\n## Generate Constraint-4:\nThe bakery aims to balance its product mix to ensure variety. The number of eclairs produced should not exceed the combined number of croissants and muffins by more than 10.\n// Eclairs <= (Croissants + Muffins) + 10",
        "question": "A bakery produces three types of pastries: croissants, muffins, and eclairs. The bakery needs to decide how many of each type of pastry to produce daily to maximize profit, considering the cost of ingredients and the time required for baking. The profit per croissant is $0.50, per muffin is $0.75, and per eclair is $1.20. The cost per croissant is $0.20, per muffin is $0.30, and per eclair is $0.50. The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day. The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams. The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs. The bakery aims to balance its product mix to ensure variety. The number of eclairs produced should not exceed the combined number of croissants and muffins by more than 10.\n\nPlease help the bakery to maximize the daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each type of pastry to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nEclairs = model.addVar(vtype=\"INTEGER\", name=\"Eclairs\", lb=0) # number of eclairs to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total_Revenue = 0.50*Croissants + 0.75*Muffins + 1.20*Eclairs\n## Total_Cost = 0.20*Croissants + 0.30*Muffins + 0.50*Eclairs\nmodel.addCons(obj == (0.50*Croissants + 0.75*Muffins + 1.20*Eclairs) - (0.20*Croissants + 0.30*Muffins + 0.50*Eclairs))\n\n# Add constraints\n## The baking time required for each croissant is 0.1 hours, for each muffin is 0.2 hours, and for each eclair is 0.3 hours. The bakery has a total of 8 hours available for baking each day.\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.3*Eclairs <= 8)\n## The bakery has a limited supply of chocolate, which is used in both muffins and eclairs. Each muffin requires 20 grams of chocolate, and each eclair requires 50 grams. The daily supply of chocolate is 400 grams.\nmodel.addCons(20*Muffins + 50*Eclairs <= 400)\n## The bakery has a minimum daily production requirement for each type of pastry. It must produce at least 50 croissants, 30 muffins, and 20 eclairs.\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Eclairs >= 20)\n## The bakery aims to balance its product mix to ensure variety. The number of eclairs produced should not exceed the combined number of croissants and muffins by more than 10.\nmodel.addCons(Eclairs <= (Croissants + Muffins) + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of eclairs to produce: \", model.getVal(Eclairs))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-3:\nThe bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5\n\n## Generate Constraint-4:\nThe bakery has a minimum daily production requirement for each pastry type. It must produce at least 50 croissants, 30 muffins, and 40 donuts.\n// Croissants >= 50\n// Muffins >= 30\n// Donuts >= 40",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The following table summarizes the requirements for each pastry type:\n\n| Pastry   | Oven Time (hours) | Flour (kg) | Sugar (kg) |\n|----------|-------------------|------------|------------|\n| Croissant| 0.1               | 0.1        | 0.05       |\n| Muffin   | 0.2               | 0.2        | 0.1        |\n| Donut    | 0.15              | 0.15       | 0.08       |\n\nThe bakery has a total of 8 hours of oven time available daily and 10 kg of flour and 5 kg of sugar. The bakery has a minimum daily production requirement for each pastry type: it must produce at least 50 croissants, 30 muffins, and 40 donuts. Please help the bakery to maximize its daily profit from pastry sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry type to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each pastry type requires a certain amount of oven time and ingredients\n## Oven time constraint\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## Flour constraint\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Sugar constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5)\n## Minimum daily production requirements\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Donuts >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity.\n// {\"number of croissants to produce\": \"Croissants\", \"range\": \"Croissants >= 0\", \"type\": \"integer\"}\n// {\"number of muffins to produce\": \"Muffins\", \"range\": \"Muffins >= 0\", \"type\": \"integer\"}\n// {\"number of donuts to produce\": \"Donuts\", \"range\": \"Donuts >= 0\", \"type\": \"integer\"}\n// {\"hours of oven use for croissants\": \"Croissant_Oven_Hours\", \"range\": \"Croissant_Oven_Hours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n// Total_Profit = 0.50*Croissants + 0.75*Muffins + 0.60*Donuts\n// Objective Function: Maximize: Total_Profit\n\n## Generate Constraint-1:\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8\n\n## Generate Constraint-2:\nThe bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg.\n// 0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10\n\n## Generate Constraint-3:\nThe bakery has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n// 0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5\n\n## Generate Constraint-4:\nThe bakery has a minimum daily production requirement for each pastry type. It must produce at least 50 croissants, 30 muffins, and 40 donuts.\n// Croissants >= 50\n// Muffins >= 30\n// Donuts >= 40",
        "question": "A bakery specializes in producing three types of pastries: croissants, muffins, and donuts. The bakery needs to decide on the daily production quantities of each pastry type to maximize profit while considering the availability of ingredients and production capacity. The profit per croissant is $0.50, per muffin is $0.75, and per donut is $0.60. The bakery aims to maximize its daily profit from pastry sales.\n\nEach croissant requires 0.1 hours of oven time, each muffin requires 0.2 hours, and each donut requires 0.15 hours. The bakery has a total of 8 hours of oven time available daily. The bakery has 10 kg of flour available daily. Each croissant requires 0.1 kg of flour, each muffin requires 0.2 kg, and each donut requires 0.15 kg. The bakery also has 5 kg of sugar available daily. Each croissant requires 0.05 kg of sugar, each muffin requires 0.1 kg, and each donut requires 0.08 kg.\n\nThe bakery has a minimum daily production requirement for each pastry type. It must produce at least 50 croissants, 30 muffins, and 40 donuts.\n\nPlease help the bakery to maximize its daily profit from pastry sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each pastry type to produce\nCroissants = model.addVar(vtype=\"INTEGER\", name=\"Croissants\", lb=0) # number of croissants to produce\nMuffins = model.addVar(vtype=\"INTEGER\", name=\"Muffins\", lb=0) # number of muffins to produce\nDonuts = model.addVar(vtype=\"INTEGER\", name=\"Donuts\", lb=0) # number of donuts to produce\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 0.50*Croissants + 0.75*Muffins + 0.60*Donuts)\n\n# Add constraints\n## Each pastry type requires a certain amount of oven time and ingredients\n## Oven time constraint\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 8)\n## Flour constraint\nmodel.addCons(0.1*Croissants + 0.2*Muffins + 0.15*Donuts <= 10)\n## Sugar constraint\nmodel.addCons(0.05*Croissants + 0.1*Muffins + 0.08*Donuts <= 5)\n## Minimum daily production requirements\nmodel.addCons(Croissants >= 50)\nmodel.addCons(Muffins >= 30)\nmodel.addCons(Donuts >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants to produce: \", model.getVal(Croissants))\n    print(\"Number of Muffins to produce: \", model.getVal(Muffins))\n    print(\"Number of Donuts to produce: \", model.getVal(Donuts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe cake should contain at least 10% eggs by weight.\n// x3 >= 0.1 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-5:\nThe cake should contain no more than 40% butter by weight.\n// x4 <= 0.4 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe using four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of each ingredient is as follows:\n\n| Ingredient | Cost per Unit | Unit |\n|------------|---------------|------|\n| Flour      | $0.05/gram    | gram |\n| Sugar      | $0.03/gram    | gram |\n| Eggs       | $0.10/unit    | unit |\n| Butter     | $0.08/gram    | gram |\n\nThe bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight, no more than 20% sugar by weight, at least 10% eggs by weight, and no more than 40% butter by weight.\n\nPlease help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) to use in the cake to minimize the total cost while meeting these quality constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n## The cake should contain at least 10% eggs by weight.\nmodel.addCons(x3 >= 0.1 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 40% butter by weight.\nmodel.addCons(x4 <= 0.4 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1), \"grams\")\n    print(\"Amount of sugar: \", model.getVal(x2), \"grams\")\n    print(\"Amount of eggs: \", model.getVal(x3), \"units\")\n    print(\"Amount of butter: \", model.getVal(x4), \"grams\")\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the ingredients for a new cake recipe. They have four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality.\n// {\"amount of flour\": \"x1\", \"range\": \"0 <= x1 <= 1000 grams\", \"type\": \"continuous\"}\n// {\"amount of sugar\": \"x2\", \"range\": \"0 <= x2 <= 500 grams\", \"type\": \"continuous\"}\n// {\"amount of eggs\": \"x3\", \"range\": \"0 <= x3 <= 10 units\", \"type\": \"continuous\"}\n// {\"amount of butter\": \"x4\", \"range\": \"0 <= x4 <= 750 grams\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake.\n// Minimize: 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4\n\n## Generate Constraint-1:\nThe cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\n// x1 + x2 + x3 + x4 <= 1500\n\n## Generate Constraint-2:\nThe cake should contain at least 30% flour by weight.\n// x1 >= 0.3 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-3:\nThe cake should contain no more than 20% sugar by weight.\n// x2 <= 0.2 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-4:\nThe cake should contain at least 10% eggs by weight.\n// x3 >= 0.1 * (x1 + x2 + x3 + x4)\n\n## Generate Constraint-5:\nThe cake should contain no more than 40% butter by weight.\n// x4 <= 0.4 * (x1 + x2 + x3 + x4)",
        "question": "A bakery wants to optimize the ingredients for a new cake recipe using four main ingredients: flour, sugar, eggs, and butter. The bakery needs to determine the optimal amount of each ingredient to use in the cake to achieve the best balance of cost and quality. The cost of flour, sugar, eggs, and butter is $0.05/gram, $0.03/gram, $0.10/unit, and $0.08/gram, respectively. The bakery wants to minimize the total cost of the ingredients while maintaining the quality of the cake. The cake recipe requires that the total amount of ingredients should not exceed 1500 grams. The cake should contain at least 30% flour by weight, no more than 20% sugar by weight, at least 10% eggs by weight, and no more than 40% butter by weight. Please help the bakery determine the optimal amounts of flour (x1), sugar (x2), eggs (x3), and butter (x4) to use in the cake.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The amount of each ingredient\nx1 = model.addVar(vtype=\"CONTINUOUS\", name=\"x1\", lb=0, ub=1000) # amount of flour\nx2 = model.addVar(vtype=\"CONTINUOUS\", name=\"x2\", lb=0, ub=500) # amount of sugar\nx3 = model.addVar(vtype=\"CONTINUOUS\", name=\"x3\", lb=0, ub=10) # amount of eggs\nx4 = model.addVar(vtype=\"CONTINUOUS\", name=\"x4\", lb=0, ub=750) # amount of butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.05*x1 + 0.03*x2 + 0.10*x3 + 0.08*x4)\n\n# Add constraints\n## The cake recipe requires that the total amount of ingredients should not exceed 1500 grams.\nmodel.addCons(x1 + x2 + x3 + x4 <= 1500)\n## The cake should contain at least 30% flour by weight.\nmodel.addCons(x1 >= 0.3 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 20% sugar by weight.\nmodel.addCons(x2 <= 0.2 * (x1 + x2 + x3 + x4))\n## The cake should contain at least 10% eggs by weight.\nmodel.addCons(x3 >= 0.1 * (x1 + x2 + x3 + x4))\n## The cake should contain no more than 40% butter by weight.\nmodel.addCons(x4 <= 0.4 * (x1 + x2 + x3 + x4))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of flour: \", model.getVal(x1), \"grams\")\n    print(\"Amount of sugar: \", model.getVal(x2), \"grams\")\n    print(\"Amount of eggs: \", model.getVal(x3), \"units\")\n    print(\"Amount of butter: \", model.getVal(x4), \"grams\")\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60\n\n## Generate Constraint-4:\nThe production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\n// A_Assembly = A_units\n// A_Quality = 0.5 * A_units\n// A_Packaging = 0.5 * A_units\n\n## Generate Constraint-5:\nThe production time for each unit of Product B in Assembly, Quality Check, and Packaging is 1.5 hours, 1 hour, and 0.5 hours, respectively.\n// B_Assembly = 1.5 * B_units\n// B_Quality = B_units\n// B_Packaging = 0.5 * B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n\n| Product | Profit per Unit | Assembly Time per Unit | Quality Check Time per Unit | Packaging Time per Unit |\n|---------|-----------------|-------------------------|-----------------------------|-------------------------|\n| A       | 50$             | 1 hour                   | 0.5 hours                    | 0.5 hours               |\n| B       | 70$             | 1.5 hours                | 1 hour                       | 0.5 hours               |\n\nThe total time available for Assembly is 100 hours. The total time available for Quality Check is 80 hours. The total time available for Packaging is 60 hours.\n\nPlease help the manufacturer to determine the optimal number of units of Product A and Product B to produce, and how to allocate the production time across the three stages to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units and time spent on each stage for each product\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n## The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\nmodel.addCons(A_Assembly == A_units)\nmodel.addCons(A_Quality == 0.5 * A_units)\nmodel.addCons(A_Packaging == 0.5 * A_units)\n## The production time for each unit of Product B in Assembly, Quality Check, and Packaging is 1.5 hours, 1 hour, and 0.5 hours, respectively.\nmodel.addCons(B_Assembly == 1.5 * B_units)\nmodel.addCons(B_Quality == B_units)\nmodel.addCons(B_Packaging == 0.5 * B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages.\n// {\"number of Product A units\": \"A_units\", \"range\": \"A_units >= 0\", \"type\": \"integer\"}\n// {\"number of Product B units\": \"B_units\", \"range\": \"B_units >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"A_Assembly\", \"range\": \"A_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"B_Assembly\", \"range\": \"B_Assembly >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"A_Quality\", \"range\": \"A_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"B_Quality\", \"range\": \"B_Quality >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"A_Packaging\", \"range\": \"A_Packaging >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"B_Packaging\", \"range\": \"B_Packaging >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products.\n// Objective Function: Maximize: 50*A_units + 70*B_units\n\n## Generate Constraint-1:\nThe total time available for Assembly is 100 hours.\n// A_Assembly + B_Assembly <= 100\n\n## Generate Constraint-2:\nThe total time available for Quality Check is 80 hours.\n// A_Quality + B_Quality <= 80\n\n## Generate Constraint-3:\nThe total time available for Packaging is 60 hours.\n// A_Packaging + B_Packaging <= 60\n\n## Generate Constraint-4:\nThe production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\n// A_Assembly = A_units\n// A_Quality = 0.5 * A_units\n// A_Packaging = 0.5 * A_units\n\n## Generate Constraint-5:\nThe production time for each unit of Product B in Assembly, Quality Check, and Packaging is 1.5 hours, 1 hour, and 0.5 hours, respectively.\n// B_Assembly = 1.5 * B_units\n// B_Quality = B_units\n// B_Packaging = 0.5 * B_units",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The manufacturer needs to decide how many units of each product to produce and allocate the production time across the three stages. The profit from selling each unit of Product A is $50, and for Product B is $70. The objective is to maximize the total profit from the production of both products. The total time available for Assembly is 100 hours, for Quality Check is 80 hours, and for Packaging is 60 hours. The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively. The production time for each unit of Product B in Assembly, Quality Check, and Packaging is 1.5 hours, 1 hour, and 0.5 hours, respectively. Please help the manufacturer to determine the optimal number of units of Product A and Product B to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units and time spent on each stage for each product\nA_units = model.addVar(vtype=\"INTEGER\", name=\"A_units\", lb=0) # number of Product A units\nB_units = model.addVar(vtype=\"INTEGER\", name=\"B_units\", lb=0) # number of Product B units\nA_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Assembly\", lb=0) # time spent on Assembly for Product A\nB_Assembly = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Assembly\", lb=0) # time spent on Assembly for Product B\nA_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Quality\", lb=0) # time spent on Quality Check for Product A\nB_Quality = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Quality\", lb=0) # time spent on Quality Check for Product B\nA_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"A_Packaging\", lb=0) # time spent on Packaging for Product A\nB_Packaging = model.addVar(vtype=\"CONTINUOUS\", name=\"B_Packaging\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A_units + 70*B_units)\n\n# Add constraints\n## The total time available for Assembly is 100 hours.\nmodel.addCons(A_Assembly + B_Assembly <= 100)\n## The total time available for Quality Check is 80 hours.\nmodel.addCons(A_Quality + B_Quality <= 80)\n## The total time available for Packaging is 60 hours.\nmodel.addCons(A_Packaging + B_Packaging <= 60)\n## The production time for each unit of Product A in Assembly, Quality Check, and Packaging is 1 hour, 0.5 hours, and 0.5 hours, respectively.\nmodel.addCons(A_Assembly == A_units)\nmodel.addCons(A_Quality == 0.5 * A_units)\nmodel.addCons(A_Packaging == 0.5 * A_units)\n## The production time for each unit of Product B in Assembly, Quality Check, and Packaging is 1.5 hours, 1 hour, and 0.5 hours, respectively.\nmodel.addCons(B_Assembly == 1.5 * B_units)\nmodel.addCons(B_Quality == B_units)\nmodel.addCons(B_Packaging == 0.5 * B_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A units: \", model.getVal(A_units))\n    print(\"Number of Product B units: \", model.getVal(B_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30\n\n## Generate Constraint-4:\nThe bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n// Constraint-4: s <= 40\n\n## Generate Constraint-5:\nThe bakery has a minimum demand for multigrain bread, which is 20 loaves per day.\n// Constraint-5: m >= 20",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales, with the profit per loaf being $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. Due to a contractual agreement, the bakery must produce at least 50 loaves of wheat bread daily. The bakery also has a minimum demand for rye bread, which is 30 loaves per day, and for multigrain bread, which is 20 loaves per day. Additionally, the bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n\nPlease help the bakery determine the optimal number of loaves to produce for each type of bread to maximize their daily profit.\n\n| Type of Bread | Profit per Loaf |\n|---------------|-----------------|\n| Wheat         | $2              |\n| Rye           | $3              |\n| Sourdough     | $4              |\n| Multigrain    | $5              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n## The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\nmodel.addCons(s <= 40)\n## The bakery has a minimum demand for multigrain bread, which is 20 loaves per day.\nmodel.addCons(m >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain.\n// {\"number of wheat bread loaves\": \"w\", \"range\": \"0 <= w <= 100\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"r\", \"range\": \"0 <= r <= 100\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"s\", \"range\": \"0 <= s <= 100\", \"type\": \"integer\"}\n// {\"number of multigrain bread loaves\": \"m\", \"range\": \"0 <= m <= 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain.\n// Objective Function: Maximize: 2w + 3r + 4s + 5m\n\n## Generate Constraint-1:\nThe bakery has a limited oven capacity of 200 loaves per day.\n// Constraint-1: w + r + s + m <= 200\n\n## Generate Constraint-2:\nThe bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\n// Constraint-2: w >= 50\n\n## Generate Constraint-3:\nThe bakery has a minimum demand for rye bread, which is 30 loaves per day.\n// Constraint-3: r >= 30\n\n## Generate Constraint-4:\nThe bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\n// Constraint-4: s <= 40\n\n## Generate Constraint-5:\nThe bakery has a minimum demand for multigrain bread, which is 20 loaves per day.\n// Constraint-5: m >= 20",
        "question": "A bakery needs to decide how many loaves of each type of bread to produce daily. They offer four types of bread: wheat, rye, sourdough, and multigrain. The bakery aims to maximize its daily profit from bread sales. The profit per loaf is $2 for wheat, $3 for rye, $4 for sourdough, and $5 for multigrain. The bakery has a limited oven capacity of 200 loaves per day. The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement. The bakery has a minimum demand for rye bread, which is 30 loaves per day. The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day. The bakery has a minimum demand for multigrain bread, which is 20 loaves per day. Please help the bakery determine the optimal number of loaves of each type of bread to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread\nw = model.addVar(vtype=\"INTEGER\", name=\"w\", lb=0, ub=100) # number of wheat bread loaves\nr = model.addVar(vtype=\"INTEGER\", name=\"r\", lb=0, ub=100) # number of rye bread loaves\ns = model.addVar(vtype=\"INTEGER\", name=\"s\", lb=0, ub=100) # number of sourdough bread loaves\nm = model.addVar(vtype=\"INTEGER\", name=\"m\", lb=0, ub=100) # number of multigrain bread loaves\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 2*w + 3*r + 4*s + 5*m)\n\n# Add constraints\n## The bakery has a limited oven capacity of 200 loaves per day.\nmodel.addCons(w + r + s + m <= 200)\n## The bakery must ensure that at least 50 loaves of wheat bread are produced daily due to a contractual agreement.\nmodel.addCons(w >= 50)\n## The bakery has a minimum demand for rye bread, which is 30 loaves per day.\nmodel.addCons(r >= 30)\n## The bakery has a maximum storage capacity for sourdough bread, which is 40 loaves per day.\nmodel.addCons(s <= 40)\n## The bakery has a minimum demand for multigrain bread, which is 20 loaves per day.\nmodel.addCons(m >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(w))\n    print(\"Number of rye bread loaves: \", model.getVal(r))\n    print(\"Number of sourdough bread loaves: \", model.getVal(s))\n    print(\"Number of multigrain bread loaves: \", model.getVal(m))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10\n\n## Generate Constraint-4:\nThe total weight of the cake should not exceed 2000 grams.\n// Flour + Sugar + Eggs + Butter <= 2000\n\n## Generate Constraint-5:\nThe cake should have a minimum of 1000 calories, where each gram of Flour, Sugar, Eggs, and Butter contributes 3, 4, 5, and 7 calories, respectively.\n// 3*Flour + 4*Sugar + 5*Eggs + 7*Butter >= 1000",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake. The cost per unit of each ingredient and their respective calorie contributions are given in the following Table.\n\n| Ingredient | Cost per Unit | Calories per Gram |\n|------------|---------------|-------------------|\n| Flour      | $0.50         | 3 calories        |\n| Sugar      | $0.25         | 4 calories        |\n| Eggs       | $1.00         | 5 calories        |\n| Butter     | $2.00         | 7 calories        |\n\nThe bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour and no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. The total weight of the cake should not exceed 2000 grams. Additionally, the cake should have a minimum of 1000 calories.\n\nPlease help the bakery determine the optimal quantities of Flour, Sugar, Eggs, and Butter to meet these requirements while minimizing the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n## The total weight of the cake should not exceed 2000 grams.\nmodel.addCons(Flour + Sugar + Eggs + Butter <= 2000)\n## The cake should have a minimum of 1000 calories, where each gram of Flour, Sugar, Eggs, and Butter contributes 3, 4, 5, and 7 calories, respectively.\nmodel.addCons(3*Flour + 4*Sugar + 5*Eggs + 7*Butter >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The bakery wants to optimize the cost and nutritional content of the cake.\n// {\"quantity of Flour\": \"Flour\", \"range\": \"Flour >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Sugar\": \"Sugar\", \"range\": \"Sugar >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Eggs\": \"Eggs\", \"range\": \"Eggs >= 0\", \"type\": \"continuous\"}\n// {\"quantity of Butter\": \"Butter\", \"range\": \"Butter >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients.\n// Objective Function: Minimize: 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter\n\n## Generate Constraint-1:\nThe cake must contain at least 500 grams of Flour.\n// Flour >= 500\n\n## Generate Constraint-2:\nThe cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\n// Sugar <= 300\n\n## Generate Constraint-3:\nThe cake must contain exactly 10 eggs.\n// Eggs = 10\n\n## Generate Constraint-4:\nThe total weight of the cake should not exceed 2000 grams.\n// Flour + Sugar + Eggs + Butter <= 2000\n\n## Generate Constraint-5:\nThe cake should have a minimum of 1000 calories, where each gram of Flour, Sugar, Eggs, and Butter contributes 3, 4, 5, and 7 calories, respectively.\n// 3*Flour + 4*Sugar + 5*Eggs + 7*Butter >= 1000",
        "question": "A bakery needs to decide on the quantities of four ingredients (Flour, Sugar, Eggs, and Butter) to use in their new cake recipe. The cost per unit of Flour, Sugar, Eggs, and Butter is $0.50, $0.25, $1.00, and $2.00, respectively. The bakery wants to minimize the total cost of the ingredients. The cake must contain at least 500 grams of Flour. It must contain no more than 300 grams of Sugar to maintain a healthy profile. The cake must contain exactly 10 eggs. The total weight of the cake should not exceed 2000 grams. The cake should have a minimum of 1000 calories, where each gram of Flour, Sugar, Eggs, and Butter contributes 3, 4, 5, and 7 calories, respectively. Please help the bakery optimize the cost and nutritional content of the cake.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The quantity of each ingredient\nFlour = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour\", lb=0) # quantity of Flour\nSugar = model.addVar(vtype=\"CONTINUOUS\", name=\"Sugar\", lb=0) # quantity of Sugar\nEggs = model.addVar(vtype=\"CONTINUOUS\", name=\"Eggs\", lb=0) # quantity of Eggs\nButter = model.addVar(vtype=\"CONTINUOUS\", name=\"Butter\", lb=0) # quantity of Butter\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Flour + 0.25*Sugar + 1.00*Eggs + 2.00*Butter)\n\n# Add constraints\n## The cake must contain at least 500 grams of Flour.\nmodel.addCons(Flour >= 500)\n## The cake must contain no more than 300 grams of Sugar to maintain a healthy profile.\nmodel.addCons(Sugar <= 300)\n## The cake must contain exactly 10 eggs.\nmodel.addCons(Eggs == 10)\n## The total weight of the cake should not exceed 2000 grams.\nmodel.addCons(Flour + Sugar + Eggs + Butter <= 2000)\n## The cake should have a minimum of 1000 calories, where each gram of Flour, Sugar, Eggs, and Butter contributes 3, 4, 5, and 7 calories, respectively.\nmodel.addCons(3*Flour + 4*Sugar + 5*Eggs + 7*Butter >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Flour: \", model.getVal(Flour))\n    print(\"Quantity of Sugar: \", model.getVal(Sugar))\n    print(\"Quantity of Eggs: \", model.getVal(Eggs))\n    print(\"Quantity of Butter: \", model.getVal(Butter))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200\n\n## Generate Constraint-4:\nEach center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\n// A_C1 >= 30\n// B_C1 >= 40\n// C_C1 >= 50\n\n## Generate Constraint-5:\nCenter 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C.\n// A_C2 >= 20\n// B_C2 >= 30\n// C_C2 >= 40",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3. The cost of delivering one unit of each product to each center is given in the following Table.\n\n| Product | Center 1 Cost | Center 2 Cost | Center 3 Cost |\n|---------|---------------|---------------|---------------|\n| A       | 5$            | 6$            | 7$            |\n| B       | 8$            | 9$            | 10$           |\n| C       | 11$           | 12$           | 13$           |\n\nThe company aims to minimize the total delivery cost while meeting the demand at each center. The total number of units of product A that can be delivered is limited to 100 units, and the total number of units of product B and C that can be delivered are limited to 150 units and 200 units respectively. Each center has a specific demand for each product: Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C; Center 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C.\n\nPlease help the company determine the optimal number of units of each product to deliver to each center to minimize the total delivery cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n## Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\nmodel.addCons(A_C1 >= 30)\nmodel.addCons(B_C1 >= 40)\nmodel.addCons(C_C1 >= 50)\n## Center 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C.\nmodel.addCons(A_C2 >= 20)\nmodel.addCons(B_C2 >= 30)\nmodel.addCons(C_C2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1370,
        "var_num": 9,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3.\n// {\"number of units of product A delivered to Center 1\": \"A_C1\", \"range\": \"A_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 2\": \"A_C2\", \"range\": \"A_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A delivered to Center 3\": \"A_C3\", \"range\": \"A_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 1\": \"B_C1\", \"range\": \"B_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 2\": \"B_C2\", \"range\": \"B_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B delivered to Center 3\": \"B_C3\", \"range\": \"B_C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 1\": \"C_C1\", \"range\": \"C_C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 2\": \"C_C2\", \"range\": \"C_C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C delivered to Center 3\": \"C_C3\", \"range\": \"C_C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center.\n// Objective Function: Minimize: 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3\n\n## Generate Constraint-1:\nThe total number of units of product A that can be delivered is limited to 100 units.\n// A_C1 + A_C2 + A_C3 <= 100\n\n## Generate Constraint-2:\nThe total number of units of product B that can be delivered is limited to 150 units.\n// B_C1 + B_C2 + B_C3 <= 150\n\n## Generate Constraint-3:\nThe total number of units of product C that can be delivered is limited to 200 units.\n// C_C1 + C_C2 + C_C3 <= 200\n\n## Generate Constraint-4:\nEach center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\n// A_C1 >= 30\n// B_C1 >= 40\n// C_C1 >= 50\n\n## Generate Constraint-5:\nCenter 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C.\n// A_C2 >= 20\n// B_C2 >= 30\n// C_C2 >= 40",
        "question": "A logistics company is planning to optimize its delivery routes for three different products: A, B, and C. The company needs to decide how many units of each product to deliver from its main warehouse to three regional distribution centers: Center 1, Center 2, and Center 3. The cost of delivering one unit of product A to each center is $5, $6, and $7 respectively. For product B, the costs are $8, $9, and $10 respectively. For product C, the costs are $11, $12, and $13 respectively. The company aims to minimize the total delivery cost while meeting the demand at each center. The total number of units of product A that can be delivered is limited to 100 units. The total number of units of product B that can be delivered is limited to 150 units. The total number of units of product C that can be delivered is limited to 200 units. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C. Center 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C. Please help the company to determine the optimal number of units of each product to deliver to each center to minimize the total delivery cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product delivered to each center\nA_C1 = model.addVar(vtype=\"INTEGER\", name=\"A_C1\", lb=0) # number of units of product A delivered to Center 1\nA_C2 = model.addVar(vtype=\"INTEGER\", name=\"A_C2\", lb=0) # number of units of product A delivered to Center 2\nA_C3 = model.addVar(vtype=\"INTEGER\", name=\"A_C3\", lb=0) # number of units of product A delivered to Center 3\nB_C1 = model.addVar(vtype=\"INTEGER\", name=\"B_C1\", lb=0) # number of units of product B delivered to Center 1\nB_C2 = model.addVar(vtype=\"INTEGER\", name=\"B_C2\", lb=0) # number of units of product B delivered to Center 2\nB_C3 = model.addVar(vtype=\"INTEGER\", name=\"B_C3\", lb=0) # number of units of product B delivered to Center 3\nC_C1 = model.addVar(vtype=\"INTEGER\", name=\"C_C1\", lb=0) # number of units of product C delivered to Center 1\nC_C2 = model.addVar(vtype=\"INTEGER\", name=\"C_C2\", lb=0) # number of units of product C delivered to Center 2\nC_C3 = model.addVar(vtype=\"INTEGER\", name=\"C_C3\", lb=0) # number of units of product C delivered to Center 3\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A_C1 + 6*A_C2 + 7*A_C3 + 8*B_C1 + 9*B_C2 + 10*B_C3 + 11*C_C1 + 12*C_C2 + 13*C_C3)\n\n# Add constraints\n## The total number of units of product A that can be delivered is limited to 100 units.\nmodel.addCons(A_C1 + A_C2 + A_C3 <= 100)\n## The total number of units of product B that can be delivered is limited to 150 units.\nmodel.addCons(B_C1 + B_C2 + B_C3 <= 150)\n## The total number of units of product C that can be delivered is limited to 200 units.\nmodel.addCons(C_C1 + C_C2 + C_C3 <= 200)\n## Each center has a specific demand for each product. Center 1 requires at least 30 units of product A, 40 units of product B, and 50 units of product C.\nmodel.addCons(A_C1 >= 30)\nmodel.addCons(B_C1 >= 40)\nmodel.addCons(C_C1 >= 50)\n## Center 2 requires at least 20 units of product A, 30 units of product B, and 40 units of product C.\nmodel.addCons(A_C2 >= 20)\nmodel.addCons(B_C2 >= 30)\nmodel.addCons(C_C2 >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A delivered to Center 1: \", model.getVal(A_C1))\n    print(\"Number of units of product A delivered to Center 2: \", model.getVal(A_C2))\n    print(\"Number of units of product A delivered to Center 3: \", model.getVal(A_C3))\n    print(\"Number of units of product B delivered to Center 1: \", model.getVal(B_C1))\n    print(\"Number of units of product B delivered to Center 2: \", model.getVal(B_C2))\n    print(\"Number of units of product B delivered to Center 3: \", model.getVal(B_C3))\n    print(\"Number of units of product C delivered to Center 1: \", model.getVal(C_C1))\n    print(\"Number of units of product C delivered to Center 2: \", model.getVal(C_C2))\n    print(\"Number of units of product C delivered to Center 3: \", model.getVal(C_C3))\n    print(\"Minimized Total Delivery Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 9,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200\n\n## Generate Constraint-4:\nThe bakery can hire up to 50 additional staff hours per day.\n// staff_hours <= 50\n\n## Generate Constraint-5:\nThe additional staff hours required to produce each loaf of bread are 0.01 hours for wheat, 0.02 hours for rye, and 0.03 hours for sourdough.\n// 0.01*wheat + 0.02*rye + 0.03*sourdough <= staff_hours",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The following table summarizes the requirements for each type of bread:\n\n| Bread Type | Profit per Loaf | Flour Requirement (kg) | Staff Hours per Loaf |\n|------------|-----------------|-------------------------|----------------------|\n| Wheat      | $3              | 0.5                     | 0.01                 |\n| Rye        | $4              | 0.7                     | 0.02                 |\n| Sourdough  | $5              | 0.6                     | 0.03                 |\n\nThe bakery has a daily limit of 500kg of flour. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. The bakery can hire up to 50 additional staff hours per day. The additional staff hours required to produce each loaf of bread are 0.01 hours for wheat, 0.02 hours for rye, and 0.03 hours for sourdough.\n\nPlease help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n## The bakery can hire up to 50 additional staff hours per day\nmodel.addCons(staff_hours <= 50)\n## The additional staff hours required to produce each loaf of bread\nmodel.addCons(0.01*wheat + 0.02*rye + 0.03*sourdough <= staff_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread.\n// {\"number of wheat bread loaves\": \"wheat\", \"range\": \"wheat >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread loaves\": \"rye\", \"range\": \"rye >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread loaves\": \"sourdough\", \"range\": \"sourdough >= 0\", \"type\": \"integer\"}\n// {\"number of additional staff hours\": \"staff_hours\", \"range\": \"staff_hours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The objective is to maximize the daily profit from bread sales minus the cost of additional staff hours.\n// Objective Function: Maximize: 3*wheat + 4*rye + 5*sourdough - 10*staff_hours\n\n## Generate Constraint-1:\nThe bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively.\n// 0.5*wheat + 0.7*rye + 0.6*sourdough <= 500\n\n## Generate Constraint-2:\nThe bakery can only produce up to 1000 loaves of bread in total per day.\n// wheat + rye + sourdough <= 1000\n\n## Generate Constraint-3:\nThe bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively.\n// wheat <= 400\n// rye <= 300\n// sourdough <= 200\n\n## Generate Constraint-4:\nThe bakery can hire up to 50 additional staff hours per day.\n// staff_hours <= 50\n\n## Generate Constraint-5:\nThe additional staff hours required to produce each loaf of bread are 0.01 hours for wheat, 0.02 hours for rye, and 0.03 hours for sourdough.\n// 0.01*wheat + 0.02*rye + 0.03*sourdough <= staff_hours",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many loaves of each type of bread to produce daily to maximize profit while considering the availability of ingredients and the demand for each type of bread. The profit per loaf of wheat, rye, and sourdough bread is $3, $4, and $5 respectively. The bakery incurs a cost of $10 per hour for additional staff needed to produce more bread. The bakery has a daily limit of 500kg of flour, and each loaf of wheat, rye, and sourdough bread requires 0.5kg, 0.7kg, and 0.6kg of flour respectively. The bakery can only produce up to 1000 loaves of bread in total per day. The bakery has a daily demand for wheat, rye, and sourdough bread of 400, 300, and 200 loaves respectively. The bakery can hire up to 50 additional staff hours per day. The additional staff hours required to produce each loaf of bread are 0.01 hours for wheat, 0.02 hours for rye, and 0.03 hours for sourdough.\n\nPlease help the bakery to maximize the daily profit from bread sales minus the cost of additional staff hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of loaves of each type of bread and the number of additional staff hours\nwheat = model.addVar(vtype=\"INTEGER\", name=\"wheat\", lb=0) # number of wheat bread loaves\nrye = model.addVar(vtype=\"INTEGER\", name=\"rye\", lb=0) # number of rye bread loaves\nsourdough = model.addVar(vtype=\"INTEGER\", name=\"sourdough\", lb=0) # number of sourdough bread loaves\nstaff_hours = model.addVar(vtype=\"INTEGER\", name=\"staff_hours\", lb=0) # number of additional staff hours\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 3*wheat + 4*rye + 5*sourdough - 10*staff_hours)\n\n# Add constraints\n## The bakery has a daily limit of 500kg of flour\nmodel.addCons(0.5*wheat + 0.7*rye + 0.6*sourdough <= 500)\n## The bakery can only produce up to 1000 loaves of bread in total per day\nmodel.addCons(wheat + rye + sourdough <= 1000)\n## The bakery has a daily demand for wheat, rye, and sourdough bread\nmodel.addCons(wheat <= 400)\nmodel.addCons(rye <= 300)\nmodel.addCons(sourdough <= 200)\n## The bakery can hire up to 50 additional staff hours per day\nmodel.addCons(staff_hours <= 50)\n## The additional staff hours required to produce each loaf of bread\nmodel.addCons(0.01*wheat + 0.02*rye + 0.03*sourdough <= staff_hours)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of wheat bread loaves: \", model.getVal(wheat))\n    print(\"Number of rye bread loaves: \", model.getVal(rye))\n    print(\"Number of sourdough bread loaves: \", model.getVal(sourdough))\n    print(\"Number of additional staff hours: \", model.getVal(staff_hours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1\n\n## Generate Constraint-4:\nThe market demand for product B is at least 2 units per day.\n// B >= 2\n\n## Generate Constraint-5:\nThe market demand for product C is at least 1 unit per day.\n// C >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. The following table summarizes the labor and raw material requirements for each product:\n\n| Product | Profit per Unit | Labor per Unit | Raw Material per Unit |\n|---------|-----------------|----------------|-----------------------|\n| A       | $50             | 2 hours        | 5 units               |\n| B       | $30             | 1 hour         | 3 units               |\n| C       | $40             | 3 hours        | 4 units               |\n\nThe company has 8 hours of labor available per day and 100 units of raw material. The market demand for product A is at least 1 unit per day, for product B is at least 2 units per day, and for product C is at least 1 unit per day. \n\nPlease help the company to maximize the total daily profit from the production of these products, considering the constraints on labor and raw material, and the market demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n## The market demand for product B is at least 2 units per day.\nmodel.addCons(B >= 2)\n## The market demand for product C is at least 1 unit per day.\nmodel.addCons(C >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor.\n// {\"number of units of product A produced per day\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced per day\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced per day\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor available per day\": \"labor\", \"range\": \"labor = 8\", \"type\": \"integer\"}\n// {\"amount of raw material available per day\": \"raw_material\", \"range\": \"raw_material = 100\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $30, and product C is $40. The company aims to maximize the total daily profit from the production of these products.\n// Objective Function: Maximize: 50*A + 30*B + 40*C\n\n## Generate Constraint-1:\nEach unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\n// 2*A + B + 3*C <= 8\n\n## Generate Constraint-2:\nEach unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\n// 5*A + 3*B + 4*C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 1 unit per day.\n// A >= 1\n\n## Generate Constraint-4:\nThe market demand for product B is at least 2 units per day.\n// B >= 2\n\n## Generate Constraint-5:\nThe market demand for product C is at least 1 unit per day.\n// C >= 1",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce per day to maximize profit while considering the availability of raw materials and labor. The profit per unit of product A is $50, product B is $30, and product C is $40. Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours. Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units. The market demand for product A is at least 1 unit per day, for product B is at least 2 units per day, and for product C is at least 1 unit per day. Please help the company to maximize the total daily profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced per day\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced per day\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced per day\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced per day\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*A + 30*B + 40*C)\n\n# Add constraints\n## Each unit of product A requires 2 hours of labor, product B requires 1 hour, and product C requires 3 hours. The total labor hours used per day should not exceed 8 hours.\nmodel.addCons(2*A + B + 3*C <= 8)\n## Each unit of product A requires 5 units of raw material, product B requires 3 units, and product C requires 4 units. The total raw material used per day should not exceed 100 units.\nmodel.addCons(5*A + 3*B + 4*C <= 100)\n## The market demand for product A is at least 1 unit per day.\nmodel.addCons(A >= 1)\n## The market demand for product B is at least 2 units per day.\nmodel.addCons(B >= 2)\n## The market demand for product C is at least 1 unit per day.\nmodel.addCons(C >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced per day: \", model.getVal(A))\n    print(\"Number of units of product B produced per day: \", model.getVal(B))\n    print(\"Number of units of product C produced per day: \", model.getVal(C))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of Product B per day.\n// B >= 30\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 40 units of Product C per day.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints. The details of each product are given in the following Table.\n\n| Product | Production Cost | Selling Price | Maximum Daily Production Capacity |\n|---------|-----------------|---------------|-----------------------------------|\n| A       | $50             | $100          | 100 units                         |\n| B       | $70             | $120          | 150 units                         |\n| C       | $60             | $110          | 200 units                         |\n\nThe manufacturer aims to maximize the daily profit. The maximum daily production capacity for each product is as specified in the table. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A, 30 units of Product B, and 40 units of Product C per day.\n\nPlease help the manufacturer determine the optimal daily production quantities of each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n## The manufacturer must produce at least 30 units of Product B per day.\nmodel.addCons(B >= 30)\n## The manufacturer must produce at least 40 units of Product C per day.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\n// {\"daily production quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"daily production quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\n// Objective Function: Maximize: (100 - 50)*A + (120 - 70)*B + (110 - 60)*C\n\n## Generate Constraint-1:\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\n// A <= 100\n// B <= 150\n// C <= 200\n\n## Generate Constraint-2:\nThe total daily production should not exceed 300 units.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 20 units of Product A per day.\n// A >= 20\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of Product B per day.\n// B >= 30\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 40 units of Product C per day.\n// C >= 40",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum production capacity per day vary for each product. The manufacturer needs to determine the daily production quantities of each product to maximize profit while considering the production constraints.\nThe production cost for Product A, B, and C is $50, $70, and $60 per unit, respectively. The selling price for Product A, B, and C is $100, $120, and $110 per unit, respectively. The manufacturer aims to maximize the daily profit.\nThe maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively. The total daily production should not exceed 300 units. The manufacturer must produce at least 20 units of Product A per day, at least 30 units of Product B per day, and at least 40 units of Product C per day.\nPlease help the manufacturer determine the optimal daily production quantities of each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The daily production quantity of each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # daily production quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # daily production quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # daily production quantity of Product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (100 - 50)*A + (120 - 70)*B + (110 - 60)*C)\n\n# Add constraints\n## The maximum daily production capacity for Product A, B, and C is 100, 150, and 200 units, respectively.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\n## The total daily production should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n## The manufacturer must produce at least 20 units of Product A per day.\nmodel.addCons(A >= 20)\n## The manufacturer must produce at least 30 units of Product B per day.\nmodel.addCons(B >= 30)\n## The manufacturer must produce at least 40 units of Product C per day.\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily production quantity of Product A: \", model.getVal(A))\n    print(\"Daily production quantity of Product B: \", model.getVal(B))\n    print(\"Daily production quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe demand for product C is at least 10 units per day.\n// C >= 10\n\n## Generate Constraint-5:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2*B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $5                       |\n| B       | $10                      |\n| C       | $8                       |\n\nThe production capacity of the company is limited to 100 units per day. The demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 10 units per day. Additionally, the company must produce at least twice as many units of product A as product B.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce daily to minimize the total daily production cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n## The demand for product C is at least 10 units per day.\nmodel.addCons(C >= 10)\n## The company must produce at least twice as many units of product A as product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost.\n// Objective Function: Minimize: 5*A + 10*B + 8*C\n\n## Generate Constraint-1:\nThe production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe demand for product C is at least 10 units per day.\n// C >= 10\n\n## Generate Constraint-5:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2*B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to meet demand while optimizing production costs. The cost of producing one unit of product A, B, and C is $5, $10, and $8, respectively. The company aims to minimize the total daily production cost. The production capacity of the company is limited to 100 units per day. The demand for product A is at least 20 units per day. The demand for product B is at least 15 units per day. The demand for product C is at least 10 units per day. The company must produce at least twice as many units of product A as product B. Please help the company determine the optimal number of units of each product to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5*A + 10*B + 8*C)\n\n# Add constraints\n## The production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n## The demand for product C is at least 10 units per day.\nmodel.addCons(C >= 10)\n## The company must produce at least twice as many units of product A as product B.\nmodel.addCons(A >= 2*B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Minimized Total Daily Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 100 units per week.\n// Laptops >= 100\n\n## Generate Constraint-5:\nThe company has a budget constraint for raw materials, which is $120,000 per week. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit | Raw Material Cost per Unit |\n|------------|-----------------|----------------------------|\n| Smartphones| $100            | $50                        |\n| Tablets    | $150            | $75                        |\n| Laptops    | $200            | $100                       |\n\nThe production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week, for tablets is at least 150 units per week, and for laptops is at least 100 units per week. The company has a budget constraint for raw materials, which is $120,000 per week.\n\nPlease help the company to determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce per week to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n## The market demand for laptops is at least 100 units per week.\nmodel.addCons(Laptops >= 100)\n## The company has a budget constraint for raw materials, which is $120,000 per week.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production facility has a maximum capacity of 1000 devices per week.\n// Smart + Tablets + Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 200 units per week.\n// Smart >= 200\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 150 units per week.\n// Tablets >= 150\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 100 units per week.\n// Laptops >= 100\n\n## Generate Constraint-5:\nThe company has a budget constraint for raw materials, which is $120,000 per week. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit.\n// 50*Smart + 75*Tablets + 100*Laptops <= 120000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production facility has a maximum capacity of 1000 devices per week. The market demand for smartphones is at least 200 units per week, for tablets is at least 150 units per week, and for laptops is at least 100 units per week. The company has a budget constraint for raw materials, which is $120,000 per week. The cost of raw materials for smartphones is $50 per unit, for tablets is $75 per unit, and for laptops is $100 per unit. Please help the company to maximize the total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production facility has a maximum capacity of 1000 devices per week.\nmodel.addCons(Smart + Tablets + Laptops <= 1000)\n## The market demand for smartphones is at least 200 units per week.\nmodel.addCons(Smart >= 200)\n## The market demand for tablets is at least 150 units per week.\nmodel.addCons(Tablets >= 150)\n## The market demand for laptops is at least 100 units per week.\nmodel.addCons(Laptops >= 100)\n## The company has a budget constraint for raw materials, which is $120,000 per week.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 873,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 20 units per day.\n// Laptops >= 20\n\n## Generate Constraint-5:\nThe company has a budget constraint for raw materials, which is $50,000 per day. The cost of raw materials for a smartphone is $50, for a tablet is $75, and for a laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 50000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n\n| Device     | Profit per Unit | Raw Material Cost |\n|------------|-----------------|-------------------|\n| Smartphones| $100            | $50               |\n| Tablets    | $150            | $75               |\n| Laptops    | $200            | $100              |\n\nThe production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day, for tablets is at least 50 units per day, and for laptops is at least 20 units per day. The company has a budget constraint for raw materials, which is $50,000 per day.\n\nPlease help the company determine the optimal number of smartphones (Smart), tablets (Tablets), and laptops (Laptops) to produce each day to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n## The market demand for laptops is at least 20 units per day.\nmodel.addCons(Laptops >= 20)\n## The company has a budget constraint for raw materials, which is $50,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand.\n// {\"number of smartphones\": \"Smart\", \"range\": \"Smart >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The company aims to maximize the total profit from the production of these devices.\n// Objective Function: Maximize: 100*Smart + 150*Tablets + 200*Laptops\n\n## Generate Constraint-1:\nThe production capacity of the factory allows for a maximum of 500 units per day.\n// Smart + Tablets + Laptops <= 500\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units per day.\n// Smart >= 100\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 50 units per day.\n// Tablets >= 50\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 20 units per day.\n// Laptops >= 20\n\n## Generate Constraint-5:\nThe company has a budget constraint for raw materials, which is $50,000 per day. The cost of raw materials for a smartphone is $50, for a tablet is $75, and for a laptop is $100.\n// 50*Smart + 75*Tablets + 100*Laptops <= 50000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering production capacity and market demand. The profit per smartphone is $100, the profit per tablet is $150, and the profit per laptop is $200. The production capacity of the factory allows for a maximum of 500 units per day. The market demand for smartphones is at least 100 units per day, for tablets is at least 50 units per day, and for laptops is at least 20 units per day. The company has a budget constraint for raw materials, which is $50,000 per day. The cost of raw materials for a smartphone is $50, for a tablet is $75, and for a laptop is $100. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of each device to produce\nSmart = model.addVar(vtype=\"INTEGER\", name=\"Smart\", lb=0) # number of smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*Smart + 150*Tablets + 200*Laptops)\n\n# Add constraints\n## The production capacity of the factory allows for a maximum of 500 units per day.\nmodel.addCons(Smart + Tablets + Laptops <= 500)\n## The market demand for smartphones is at least 100 units per day.\nmodel.addCons(Smart >= 100)\n## The market demand for tablets is at least 50 units per day.\nmodel.addCons(Tablets >= 50)\n## The market demand for laptops is at least 20 units per day.\nmodel.addCons(Laptops >= 20)\n## The company has a budget constraint for raw materials, which is $50,000 per day.\nmodel.addCons(50*Smart + 75*Tablets + 100*Laptops <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of smartphones: \", model.getVal(Smart))\n    print(\"Number of tablets: \", model.getVal(Tablets))\n    print(\"Number of laptops: \", model.getVal(Laptops))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500\n\n## Generate Constraint-4:\nThe demand for inductors is at least 500 units per week.\n// Inductors >= 500\n\n## Generate Constraint-5:\nThe demand for diodes is at least 3000 units per week.\n// Diodes >= 3000",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources. The cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n\n| Component | Cost per Unit |\n|-----------|---------------|\n| Resistors | $0.50         |\n| Capacitors| $0.75         |\n| Inductors | $1.00         |\n| Diodes    | $0.60         |\n\nThe total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week, for capacitors is at least 1500 units per week, for inductors is at least 500 units per week, and for diodes is at least 3000 units per week.\n\nPlease help the company determine the optimal number of units to produce for each component to minimize the total production cost while meeting the demand and staying within the production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n## The demand for inductors is at least 500 units per week.\nmodel.addCons(Inductors >= 500)\n## The demand for diodes is at least 3000 units per week.\nmodel.addCons(Diodes >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 4,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\n// {\"number of resistors\": \"Resistors\", \"range\": \"Resistors >= 0\", \"type\": \"integer\"}\n// {\"number of capacitors\": \"Capacitors\", \"range\": \"Capacitors >= 0\", \"type\": \"integer\"}\n// {\"number of inductors\": \"Inductors\", \"range\": \"Inductors >= 0\", \"type\": \"integer\"}\n// {\"number of diodes\": \"Diodes\", \"range\": \"Diodes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\n// Objective Function: Minimize: 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes\n\n## Generate Constraint-1:\nThe total production capacity for all components is 10,000 units per week.\n// Resistors + Capacitors + Inductors + Diodes <= 10000\n\n## Generate Constraint-2:\nThe demand for resistors is at least 2000 units per week.\n// Resistors >= 2000\n\n## Generate Constraint-3:\nThe demand for capacitors is at least 1500 units per week.\n// Capacitors >= 1500\n\n## Generate Constraint-4:\nThe demand for inductors is at least 500 units per week.\n// Inductors >= 500\n\n## Generate Constraint-5:\nThe demand for diodes is at least 3000 units per week.\n// Diodes >= 3000",
        "question": "A manufacturer produces four types of electronic components: resistors, capacitors, inductors, and diodes. The company needs to decide how many units of each component to produce to meet demand while optimizing costs and resources.\nThe cost of producing one unit of resistor is $0.50, one unit of capacitor is $0.75, one unit of inductor is $1.00, and one unit of diode is $0.60. The company wants to minimize the total production cost.\nThe total production capacity for all components is 10,000 units per week. The demand for resistors is at least 2000 units per week. The demand for capacitors is at least 1500 units per week. The demand for inductors is at least 500 units per week. The demand for diodes is at least 3000 units per week.\nPlease help the company to determine the optimal number of units of each component to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each component\nResistors = model.addVar(vtype=\"INTEGER\", name=\"Resistors\", lb=0) # number of resistors\nCapacitors = model.addVar(vtype=\"INTEGER\", name=\"Capacitors\", lb=0) # number of capacitors\nInductors = model.addVar(vtype=\"INTEGER\", name=\"Inductors\", lb=0) # number of inductors\nDiodes = model.addVar(vtype=\"INTEGER\", name=\"Diodes\", lb=0) # number of diodes\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 0.50*Resistors + 0.75*Capacitors + 1.00*Inductors + 0.60*Diodes)\n\n# Add constraints\n## The total production capacity for all components is 10,000 units per week.\nmodel.addCons(Resistors + Capacitors + Inductors + Diodes <= 10000)\n## The demand for resistors is at least 2000 units per week.\nmodel.addCons(Resistors >= 2000)\n## The demand for capacitors is at least 1500 units per week.\nmodel.addCons(Capacitors >= 1500)\n## The demand for inductors is at least 500 units per week.\nmodel.addCons(Inductors >= 500)\n## The demand for diodes is at least 3000 units per week.\nmodel.addCons(Diodes >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Resistors: \", model.getVal(Resistors))\n    print(\"Number of Capacitors: \", model.getVal(Capacitors))\n    print(\"Number of Inductors: \", model.getVal(Inductors))\n    print(\"Number of Diodes: \", model.getVal(Diodes))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 4,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120\n\n## Generate Constraint-4:\nThe total time available for Quality Check is 80 hours per week.\n// QC_A + QC_B <= 80\n\n## Generate Constraint-5:\nThe total time available for Packaging is 60 hours per week.\n// Packaging_A + Packaging_B <= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time. The time requirements for each stage and product are given in the following Table.\n\n| Product | Assembly Time | Quality Check Time | Packaging Time |\n|---------|---------------|--------------------|----------------|\n| A       | 2 hours       | 1 hour             | 1 hour         |\n| B       | 3 hours       | 2 hours            | 1 hour         |\n\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging. Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging. The total time available for Assembly is 120 hours per week, for Quality Check is 80 hours per week, and for Packaging is 60 hours per week.\n\nPlease help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product and time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n## The total time available for Quality Check is 80 hours per week.\nmodel.addCons(QC_A + QC_B <= 80)\n## The total time available for Packaging is 60 hours per week.\nmodel.addCons(Packaging_A + Packaging_B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 8,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"time spent on Assembly for Product A\": \"Assembly_A\", \"range\": \"Assembly_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Assembly for Product B\": \"Assembly_B\", \"range\": \"Assembly_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product A\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Quality Check for Product B\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product A\": \"Packaging_A\", \"range\": \"Packaging_A >= 0\", \"type\": \"real\"}\n// {\"time spent on Packaging for Product B\": \"Packaging_B\", \"range\": \"Packaging_B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe objective is to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n// Objective Function: Minimize: Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B\n\n## Generate Constraint-1:\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\n// Assembly_A = 2 * A\n// QC_A = 1 * A\n// Packaging_A = 1 * A\n\n## Generate Constraint-2:\nEach unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\n// Assembly_B = 3 * B\n// QC_B = 2 * B\n// Packaging_B = 1 * B\n\n## Generate Constraint-3:\nThe total time available for Assembly is 120 hours per week.\n// Assembly_A + Assembly_B <= 120\n\n## Generate Constraint-4:\nThe total time available for Quality Check is 80 hours per week.\n// QC_A + QC_B <= 80\n\n## Generate Constraint-5:\nThe total time available for Packaging is 60 hours per week.\n// Packaging_A + Packaging_B <= 60",
        "question": "A manufacturer produces two types of products: Product A and Product B. The production involves three stages: Assembly, Quality Check, and Packaging. The company needs to decide how many units of each product to produce and allocate the workforce efficiently across the three stages to minimize the total production time.\nEach unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging. Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging. The total time available for Assembly is 120 hours per week, for Quality Check is 80 hours per week, and for Packaging is 60 hours per week.\nPlease help the company to minimize the total production time, which includes the time spent on Assembly, Quality Check, and Packaging for both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Number of units of each product and time spent on each stage\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nAssembly_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_A\", lb=0) # time spent on Assembly for Product A\nAssembly_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Assembly_B\", lb=0) # time spent on Assembly for Product B\nQC_A = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_A\", lb=0) # time spent on Quality Check for Product A\nQC_B = model.addVar(vtype=\"CONTINUOUS\", name=\"QC_B\", lb=0) # time spent on Quality Check for Product B\nPackaging_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_A\", lb=0) # time spent on Packaging for Product A\nPackaging_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Packaging_B\", lb=0) # time spent on Packaging for Product B\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Assembly_A + Assembly_B + QC_A + QC_B + Packaging_A + Packaging_B)\n\n# Add constraints\n## Each unit of Product A requires 2 hours for Assembly, 1 hour for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_A == 2 * A)\nmodel.addCons(QC_A == 1 * A)\nmodel.addCons(Packaging_A == 1 * A)\n## Each unit of Product B requires 3 hours for Assembly, 2 hours for Quality Check, and 1 hour for Packaging.\nmodel.addCons(Assembly_B == 3 * B)\nmodel.addCons(QC_B == 2 * B)\nmodel.addCons(Packaging_B == 1 * B)\n## The total time available for Assembly is 120 hours per week.\nmodel.addCons(Assembly_A + Assembly_B <= 120)\n## The total time available for Quality Check is 80 hours per week.\nmodel.addCons(QC_A + QC_B <= 80)\n## The total time available for Packaging is 60 hours per week.\nmodel.addCons(Packaging_A + Packaging_B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of Product A: \", model.getVal(A))\n    print(\"Number of units of Product B: \", model.getVal(B))\n    print(\"Time spent on Assembly for Product A: \", model.getVal(Assembly_A))\n    print(\"Time spent on Assembly for Product B: \", model.getVal(Assembly_B))\n    print(\"Time spent on Quality Check for Product A: \", model.getVal(QC_A))\n    print(\"Time spent on Quality Check for Product B: \", model.getVal(QC_B))\n    print(\"Time spent on Packaging for Product A: \", model.getVal(Packaging_A))\n    print(\"Time spent on Packaging for Product B: \", model.getVal(Packaging_B))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 8,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per day.\n// SC >= 40\n\n## Generate Constraint-5:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day, for product B is at least 20 units per day, and for product C is at least 40 units per day. The company can only sell as many units as it produces for each product.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n## The market demand for product C is at least 40 units per day.\nmodel.addCons(SC >= 40)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 6,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A produced daily\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B produced daily\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C produced daily\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A sold daily\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B sold daily\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C sold daily\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products.\n// Objective Function: Maximize: 10*SA + 15*SB + 20*SC\n\n## Generate Constraint-1:\nThe production capacity of the factory is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day.\n// SA >= 30\n\n## Generate Constraint-3:\nThe market demand for product B is at least 20 units per day.\n// SB >= 20\n\n## Generate Constraint-4:\nThe market demand for product C is at least 40 units per day.\n// SC >= 40\n\n## Generate Constraint-5:\nThe company can only sell as many units as it produces for each product.\n// SA <= A\n// SB <= B\n// SC <= C",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for products A, B, and C is $10, $15, and $20, respectively. The company aims to maximize the total daily profit from selling these products. The production capacity of the factory is limited to 100 units per day. The market demand for product A is at least 30 units per day. The market demand for product B is at least 20 units per day. The market demand for product C is at least 40 units per day. The company can only sell as many units as it produces for each product. Please help the company determine the optimal production and sales quantities for products A, B, and C to maximize their daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units of each product produced and sold daily\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A produced daily\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B produced daily\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C produced daily\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of units of product A sold daily\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of units of product B sold daily\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of units of product C sold daily\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*SA + 15*SB + 20*SC)\n\n# Add constraints\n## The production capacity of the factory is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 30 units per day.\nmodel.addCons(SA >= 30)\n## The market demand for product B is at least 20 units per day.\nmodel.addCons(SB >= 20)\n## The market demand for product C is at least 40 units per day.\nmodel.addCons(SC >= 40)\n## The company can only sell as many units as it produces for each product.\nmodel.addCons(SA <= A)\nmodel.addCons(SB <= B)\nmodel.addCons(SC <= C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A produced daily: \", model.getVal(A))\n    print(\"Number of units of product B produced daily: \", model.getVal(B))\n    print(\"Number of units of product C produced daily: \", model.getVal(C))\n    print(\"Number of units of product A sold daily: \", model.getVal(SA))\n    print(\"Number of units of product B sold daily: \", model.getVal(SB))\n    print(\"Number of units of product C sold daily: \", model.getVal(SC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 6,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product B is at most 200 units per day.\n// B <= 200\n\n## Generate Constraint-5:\nThe ratio of product C to the total of products A and B should be at least 1:4.\n// C >= 0.25*(A + B)",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources. The profit per unit for product A is $10, for product B is $15, and for product C is $20. The following table summarizes the resource requirements for each product:\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $10             | 2 hours              | 3 units                     |\n| B       | $15             | 3 hours              | 4 units                     |\n| C       | $20             | 5 hours              | 6 units                     |\n\nThe total labor hours available per day are 1000 hours. The total raw material available per day is 1500 units. The market demand for product A is at least 100 units per day, and for product B is at most 200 units per day. Additionally, the ratio of product C to the total of products A and B should be at least 1:4.\n\nPlease help the manufacturer to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per day.\nmodel.addCons(B <= 200)\n## The ratio of product C to the total of products A and B should be at least 1:4.\nmodel.addCons(C >= 0.25*(A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\n// Objective Function: Maximize: 10*A + 15*B + 20*C\n\n## Generate Constraint-1:\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\n// 2*A + 3*B + 5*C <= 1000\n\n## Generate Constraint-2:\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\n// 3*A + 4*B + 6*C <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units per day.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product B is at most 200 units per day.\n// B <= 200\n\n## Generate Constraint-5:\nThe ratio of product C to the total of products A and B should be at least 1:4.\n// C >= 0.25*(A + B)",
        "question": "A manufacturer produces three types of products: A, B, and C. The production process involves two main resources: labor and raw materials. The manufacturer needs to determine the optimal number of units to produce for each product to maximize profit while considering the constraints on resources.\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. The manufacturer wants to maximize the total profit from the production of these products.\nThe total labor hours available per day are 1000 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 5 hours.\nThe total raw material available per day is 1500 units. Producing one unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 6 units.\nThe market demand for product A is at least 100 units per day.\nThe market demand for product B is at most 200 units per day.\nThe ratio of product C to the total of products A and B should be at least 1:4.\nPlease help the manufacturer determine the optimal number of units to produce for each product to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C)\n\n# Add constraints\n## The total labor hours available per day are 1000 hours.\nmodel.addCons(2*A + 3*B + 5*C <= 1000)\n## The total raw material available per day is 1500 units.\nmodel.addCons(3*A + 4*B + 6*C <= 1500)\n## The market demand for product A is at least 100 units per day.\nmodel.addCons(A >= 100)\n## The market demand for product B is at most 200 units per day.\nmodel.addCons(B <= 200)\n## The ratio of product C to the total of products A and B should be at least 1:4.\nmodel.addCons(C >= 0.25*(A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 50 units of product B per week.\n// B >= 50\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 50 units of product C per week.\n// C >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Maximum Weekly Demand |\n|---------|--------------------------|------------------------|-----------------------|\n| A       | $20                      | $50                    | 400 units             |\n| B       | $30                      | $70                    | 300 units             |\n| C       | $40                      | $90                    | 200 units             |\n\nThe total production capacity of the manufacturer is 1000 units per week. The manufacturer must produce at least 100 units of product A, 50 units of product B, and 50 units of product C per week. \n\nPlease help the manufacturer to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n## The manufacturer must produce at least 50 units of product B per week.\nmodel.addCons(B >= 50)\n## The manufacturer must produce at least 50 units of product C per week.\nmodel.addCons(C >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 3,
        "type": "linear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production cost, selling price, and maximum demand for each product vary. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer aims to maximize the total profit.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (90 - 40) * C\n// Objective Function: Maximize: Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production capacity of the manufacturer is 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\n// A <= 400\n// B <= 300\n// C <= 200\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A per week.\n// A >= 100\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 50 units of product B per week.\n// B >= 50\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 50 units of product C per week.\n// C >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production cost per unit for products A, B, and C is $20, $30, and $40, respectively. The selling price per unit for products A, B, and C is $50, $70, and $90, respectively. The manufacturer needs to determine the number of units to produce for each product to maximize profit while considering the production capacity and market demand.\nThe total production capacity of the manufacturer is 1000 units per week. The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively. The manufacturer must produce at least 100 units of product A per week, at least 50 units of product B per week, and at least 50 units of product C per week.\nPlease help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The number of units to produce for each product\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Calculate the profit for each product\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the manufacturer is 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The maximum weekly demand for products A, B, and C is 400, 300, and 200 units, respectively.\nmodel.addCons(A <= 400)\nmodel.addCons(B <= 300)\nmodel.addCons(C <= 200)\n## The manufacturer must produce at least 100 units of product A per week.\nmodel.addCons(A >= 100)\n## The manufacturer must produce at least 50 units of product B per week.\nmodel.addCons(B >= 50)\n## The manufacturer must produce at least 50 units of product C per week.\nmodel.addCons(C >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units of product A: \", model.getVal(A))\n    print(\"Number of units of product B: \", model.getVal(B))\n    print(\"Number of units of product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 3,
        "type": "linear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\n// C + D >= 15\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route. The company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined. The company also wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C. Please help the company to maximize the total efficiency of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n# The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\nmodel.addCons(C + D >= 15)\n# The company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product for the next month. Additionally, the company needs to decide on the number of shifts to operate in their factory for each product type.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of operating a shift for ProductA is $2000, for ProductB is $2500, and for ProductC is $3000. The company wants to maximize the total profit minus the shift operating costs.\n// Total profit for ProductA: Profit_A = 50 * ProdA - 2000 * ShiftsA\n// Total profit for ProductB: Profit_B = 70 * ProdB - 2500 * ShiftsB\n// Total profit for ProductC: Profit_C = 60 * ProdC - 3000 * ShiftsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe factory has a total of 20 shifts available for the month.\n// ShiftsA + ShiftsB + ShiftsC <= 20\n\n## Generate Constraint-2:\nDue to production capacity, the total production quantity for all products cannot exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units.\n// ProdA >= 100; ProdC >= 150\n\n## Generate Constraint-4:\nThe production of ProductB must be at least twice the production of ProductA.\n// ProdB >= 2 * ProdA\n\n## Generate Constraint-5:\nThe number of shifts for ProductC must be at least half the number of shifts for ProductA.\n// ShiftsC >= 0.5 * ShiftsA",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product (ProdA, ProdB, ProdC) and the number of shifts to operate in their factory for each product type (ShiftsA, ShiftsB, ShiftsC) for the next month. The profit per unit and the cost of operating a shift for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Shift |\n|---------|-----------------|----------------|\n| ProductA | $50             | $2000          |\n| ProductB | $70             | $2500          |\n| ProductC | $60             | $3000          |\n\nThe company wants to maximize the total profit minus the shift operating costs. The factory has a total of 20 shifts available for the month. The total production quantity for all products cannot exceed 1000 units. The company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units. The production of ProductB must be at least twice the production of ProductA. The number of shifts for ProductC must be at least half the number of shifts for ProductA.\n\nPlease help the company determine the optimal production quantities and shift allocations to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for ProductC\n\n# Define objective function\nProfit_A = 50 * ProdA - 2000 * ShiftsA\nProfit_B = 70 * ProdB - 2500 * ShiftsB\nProfit_C = 60 * ProdC - 3000 * ShiftsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The factory has a total of 20 shifts available for the month.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 20)\n# Due to production capacity, the total production quantity for all products cannot exceed 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n# The company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units.\nmodel.addCons(ProdA >= 100)\nmodel.addCons(ProdC >= 150)\n# The production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProdB >= 2 * ProdA)\n# The number of shifts for ProductC must be at least half the number of shifts for ProductA.\nmodel.addCons(ShiftsC >= 0.5 * ShiftsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"quantity of MaterialX used\": \"MatX\", \"range\": \"MatX >= 0\", \"type\": \"real\"}\n// {\"quantity of MaterialY used\": \"MatY\", \"range\": \"MatY >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = 50 * ProdA\n// Total profit for ProductB: Profit_B = 70 * ProdB\n// Total profit for ProductC: Profit_C = 90 * ProdC\n// Cost of MaterialX: Cost_X = 10 * MatX\n// Cost of MaterialY: Cost_Y = 15 * MatY\n// MaterialX used for ProductA: MatX_A = 0.8 * ProdA\n// MaterialX used for ProductB: MatX_B = 0.9 * ProdB\n// MaterialX used for ProductC: MatX_C = 0.7 * ProdC\n// MaterialY used for ProductA: MatY_A = 0.9 * ProdA\n// MaterialY used for ProductB: MatY_B = 0.8 * ProdB\n// MaterialY used for ProductC: MatY_C = 0.6 * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n## Generate Constraint-1:\nThe total amount of MaterialX available is 100 units.\n// MatX_A + MatX_B + MatX_C <= MatX\n\n## Generate Constraint-2:\nThe total amount of MaterialY available is 100 units.\n// MatY_A + MatY_B + MatY_C <= MatY\n\n## Generate Constraint-3:\nThe company has a minimum production requirement for each product: ProductA must produce at least 50 units, ProductB at least 40 units, and ProductC at least 30 units.\n// ProdA >= 50; ProdB >= 40; ProdC >= 30\n\n## Generate Constraint-4:\nThe total production cost, including material costs, must not exceed $10,000.\n// 10 * MatX + 15 * MatY <= 10,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit. The total amount of MaterialX available is 100 units. The total amount of MaterialY available is 100 units. The company has a minimum production requirement for each product: ProductA must produce at least 50 units, ProductB at least 40 units, and ProductC at least 30 units. The total production cost, including material costs, must not exceed $10,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=50) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=40) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=30) # production quantity for ProductC\nMatX = model.addVar(vtype=\"CONTINUOUS\", name=\"MatX\", lb=0) # quantity of MaterialX used\nMatY = model.addVar(vtype=\"CONTINUOUS\", name=\"MatY\", lb=0) # quantity of MaterialY used\n\n# Define objective function\nProfit_A = 50 * ProdA\nProfit_B = 70 * ProdB\nProfit_C = 90 * ProdC\nCost_X = 10 * MatX\nCost_Y = 15 * MatY\nMatX_A = 0.8 * ProdA\nMatX_B = 0.9 * ProdB\nMatX_C = 0.7 * ProdC\nMatY_A = 0.9 * ProdA\nMatY_B = 0.8 * ProdB\nMatY_C = 0.6 * ProdC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n# Add constraints\nmodel.addCons(MatX_A + MatX_B + MatX_C <= MatX)\nmodel.addCons(MatY_A + MatY_B + MatY_C <= MatY)\nmodel.addCons(10 * MatX + 15 * MatY <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Quantity of MaterialX used: \", model.getVal(MatX))\n    print(\"Quantity of MaterialY used: \", model.getVal(MatY))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general cargo. Additionally, the company needs to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"HeavyMachineryTrucks\", \"range\": \"HeavyMachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general cargo\": \"GeneralCargoTrucks\", \"range\": \"GeneralCargoTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for perishable goods trucks\": \"FuelEfficiencyPerishable\", \"range\": \"FuelEfficiencyPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for heavy machinery trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for general cargo trucks\": \"FuelEfficiencyGeneral\", \"range\": \"FuelEfficiencyGeneral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings are exponentially related to the amount of investment in fuel efficiency for each type of truck. For perishable goods trucks, each $1000 invested reduces fuel costs by 1% per kilometer. For heavy machinery trucks, each $1000 invested reduces fuel costs by 1.5% per kilometer. For general cargo trucks, each $1000 invested reduces fuel costs by 1.2% per kilometer. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for perishable goods trucks: SavingsPerishable = PerishableTrucks * (1 - 0.01 * FuelEfficiencyPerishable)\n// Fuel cost savings for heavy machinery trucks: SavingsHeavy = HeavyMachineryTrucks * (1 - 0.015 * FuelEfficiencyHeavy)\n// Fuel cost savings for general cargo trucks: SavingsGeneral = GeneralCargoTrucks * (1 - 0.012 * FuelEfficiencyGeneral)\n// So, the objective function is: Maximize (SavingsPerishable + SavingsHeavy + SavingsGeneral)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel efficiency upgrades.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks + FuelEfficiencyPerishable + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 50 trucks for perishable goods and 60 trucks for heavy machinery.\n// PerishableTrucks >= 50; HeavyMachineryTrucks >= 60\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for any type of truck cannot exceed 50% of the total budget allocated for that type of truck.\n// FuelEfficiencyPerishable <= 0.5 * PerishableTrucks\n// FuelEfficiencyHeavy <= 0.5 * HeavyMachineryTrucks\n// FuelEfficiencyGeneral <= 0.5 * GeneralCargoTrucks",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general cargo. Additionally, the company needs to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel cost savings are exponentially related to the amount of investment in fuel efficiency for each type of truck. For perishable goods trucks, each $1000 invested reduces fuel costs by 1% per kilometer. For heavy machinery trucks, each $1000 invested reduces fuel costs by 1.5% per kilometer. For general cargo trucks, each $1000 invested reduces fuel costs by 1.2% per kilometer. The company aims to maximize the total fuel cost savings across all trucks.\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel efficiency upgrades. The total number of trucks cannot exceed 200. Due to contractual obligations, the company must have at least 50 trucks for perishable goods and 60 trucks for heavy machinery. The investment in fuel efficiency for any type of truck cannot exceed 50% of the total budget allocated for that type of truck.\n\nPlease help the company to maximize the total fuel cost savings across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=50) # number of trucks for perishable goods\nHeavyMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks\", lb=60) # number of trucks for heavy machinery\nGeneralCargoTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoTrucks\", lb=0) # number of trucks for general cargo\nFuelEfficiencyPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyPerishable\", lb=0) # investment in fuel efficiency for perishable goods trucks\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0) # investment in fuel efficiency for heavy machinery trucks\nFuelEfficiencyGeneral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyGeneral\", lb=0) # investment in fuel efficiency for general cargo trucks\n\n# Define objective function\nSavingsPerishable = PerishableTrucks * (1 - 0.01 * FuelEfficiencyPerishable)\nSavingsHeavy = HeavyMachineryTrucks * (1 - 0.015 * FuelEfficiencyHeavy)\nSavingsGeneral = GeneralCargoTrucks * (1 - 0.012 * FuelEfficiencyGeneral)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == SavingsPerishable + SavingsHeavy + SavingsGeneral)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks + FuelEfficiencyPerishable + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 100000)\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks <= 200)\nmodel.addCons(FuelEfficiencyPerishable <= 0.5 * PerishableTrucks)\nmodel.addCons(FuelEfficiencyHeavy <= 0.5 * HeavyMachineryTrucks)\nmodel.addCons(FuelEfficiencyGeneral <= 0.5 * GeneralCargoTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Goods Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Heavy Machinery Trucks: \", model.getVal(HeavyMachineryTrucks))\n    print(\"Number of General Cargo Trucks: \", model.getVal(GeneralCargoTrucks))\n    print(\"Investment in Fuel Efficiency for Perishable Goods Trucks: \", model.getVal(FuelEfficiencyPerishable))\n    print(\"Investment in Fuel Efficiency for Heavy Machinery Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for General Cargo Trucks: \", model.getVal(FuelEfficiencyGeneral))\n    print(\"Total Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50\n\n## Generate Constraint-2:\nThe demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25.\n// Truck1 >= 5\n// Truck2 >= 10\n// Truck3 >= 15\n// Truck4 >= 20\n// Truck5 >= 25",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate and the operational cost per truck per day for each region are given in the following Table.\n\n| Region   | Fuel Consumption Rate (liters/km) | Operational Cost per Truck per Day |\n|----------|-----------------------------------|------------------------------------|\n| Region1  | 0.5                               | $100                               |\n| Region2  | 0.6                               | $100                               |\n| Region3  | 0.7                               | $100                               |\n| Region4  | 0.8                               | $100                               |\n| Region5  | 0.9                               | $100                               |\n\nThe company has a total of 50 trucks available for allocation. The demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25. \nPlease help the company to minimize the total operational cost plus the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=10) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=15) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=20) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=25) # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n# So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons and has a maintenance cost of $500 per month. Each Truck B can carry 15 tons and has a maintenance cost of $700 per month. Each Truck C can carry 20 tons and has a maintenance cost of $900 per month. Each Van D can carry 5 tons and has a maintenance cost of $300 per month. Each Van E can carry 8 tons and has a maintenance cost of $400 per month. The company aims to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost. The revenue from each ton of cargo is $100.\n// Revenue from Truck A: Revenue_A = 10 * A * 100\n// Revenue from Truck B: Revenue_B = 15 * B * 100\n// Revenue from Truck C: Revenue_C = 20 * C * 100\n// Revenue from Van D: Revenue_D = 5 * D * 100\n// Revenue from Van E: Revenue_E = 8 * E * 100\n// Maintenance cost of Truck A: Cost_A = 500 * A\n// Maintenance cost of Truck B: Cost_B = 700 * B\n// Maintenance cost of Truck C: Cost_C = 900 * C\n// Maintenance cost of Van D: Cost_D = 300 * D\n// Maintenance cost of Van E: Cost_E = 400 * E\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle maintenance for the month.\n// 500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each Truck A can carry 10 tons and has a maintenance cost of $500 per month. Each Truck B can carry 15 tons and has a maintenance cost of $700 per month. Each Truck C can carry 20 tons and has a maintenance cost of $900 per month. Each Van D can carry 5 tons and has a maintenance cost of $300 per month. Each Van E can carry 8 tons and has a maintenance cost of $400 per month. The revenue from each ton of cargo is $100. The company has a total budget of $10,000 for vehicle maintenance for the month.\n\nPlease help the company to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Van E\n\n# Define objective function\nRevenue_A = 10 * A * 100\nRevenue_B = 15 * B * 100\nRevenue_C = 20 * C * 100\nRevenue_D = 5 * D * 100\nRevenue_E = 8 * E * 100\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\nCost_D = 300 * D\nCost_E = 400 * E\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle maintenance for the month.\nmodel.addCons(500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. The company needs to determine the number of each type of truck to maximize its profit while considering operational constraints.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the revenue per trip is $1000, and the operational cost per trip is $500.\nFor TruckB, the revenue per trip is $1500, and the operational cost per trip is $700.\nFor TruckC, the revenue per trip is $2000, and the operational cost per trip is $1000.\nFor TruckD, the revenue per trip is $1200, and the operational cost per trip is $600.\nFor TruckE, the revenue per trip is $1800, and the operational cost per trip is $900.\nThe company wants to maximize the total net profit from all trucks.\n// Total net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckANum\n// Total net profit for TruckB: Profit_TruckB = (1500 - 700) * TruckBNum\n// Total net profit for TruckC: Profit_TruckC = (2000 - 1000) * TruckCNum\n// Total net profit for TruckD: Profit_TruckD = (1200 - 600) * TruckDNum\n// Total net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckENum\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckANum <= 2 * TruckBNum\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for operational costs per day.\n// 500 * TruckANum + 700 * TruckBNum + 1000 * TruckCNum + 600 * TruckDNum + 900 * TruckENum <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one truck of each type is operational.\n// TruckANum >= 1; TruckBNum >= 1; TruckCNum >= 1; TruckDNum >= 1; TruckENum >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. The company needs to determine the number of each type of truck to maximize its profit while considering operational constraints. The revenue per trip and the operational cost per trip for each truck are given in the following Table.\n\n| Truck Type | Revenue per Trip | Operational Cost per Trip |\n|------------|------------------|---------------------------|\n| TruckA     | $1000            | $500                      |\n| TruckB     | $1500            | $700                      |\n| TruckC     | $2000            | $1000                     |\n| TruckD     | $1200            | $600                      |\n| TruckE     | $1800            | $900                      |\n\nThe company has a total of 50 trucks available. Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB. The company has a budget of $30,000 for operational costs per day. The company wants to ensure that at least one truck of each type is operational. \nPlease help the company to maximize the total net profit from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=1)  # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=1)  # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=1)  # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=1)  # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=1)  # number of TruckE\n\n# Define objective function\nProfit_TruckA = (1000 - 500) * TruckANum\nProfit_TruckB = (1500 - 700) * TruckBNum\nProfit_TruckC = (2000 - 1000) * TruckCNum\nProfit_TruckD = (1200 - 600) * TruckDNum\nProfit_TruckE = (1800 - 900) * TruckENum\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\nmodel.addCons(TruckANum <= 2 * TruckBNum)\nmodel.addCons(500 * TruckANum + 700 * TruckBNum + 1000 * TruckCNum + 600 * TruckDNum + 900 * TruckENum <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 1\": \"DistanceRegion1\", \"range\": \"DistanceRegion1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 2\": \"DistanceRegion2\", \"range\": \"DistanceRegion2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions. The fuel consumption is calculated based on the number of trucks, their fuel efficiency, and the distance they travel.\n// FuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\n// FuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n// So, the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\n// DistanceRegion1 + DistanceRegion2 <= 1000\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\n// FuelEfficiency1 >= 1.1 * FuelEfficiency2\n\n## Generate Constraint-4:\nThe demand for transportation in Region 1 requires at least 20 trucks.\n// TrucksRegion1 >= 20",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across two regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region. The following table summarizes the variables involved:\n\n| Variable                     | Description                          | Range/Type       |\n|------------------------------|--------------------------------------|------------------|\n| TrucksRegion1                | Number of trucks for Region 1        | >= 0, integer    |\n| TrucksRegion2                | Number of trucks for Region 2        | >= 0, integer    |\n| FuelEfficiency1              | Fuel efficiency of trucks for Region 1 | > 0, real        |\n| FuelEfficiency2              | Fuel efficiency of trucks for Region 2 | > 0, real        |\n| DistanceRegion1              | Distance traveled by trucks in Region 1 | >= 0, real       |\n| DistanceRegion2              | Distance traveled by trucks in Region 2 | >= 0, real       |\n\nThe company aims to minimize the total fuel consumption across all regions, calculated based on the number of trucks, their fuel efficiency, and the distance they travel. The total number of trucks available in the fleet is limited to 50. The total distance that can be covered by the trucks in a day is limited to 1000 kilometers. The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2. The demand for transportation in Region 1 requires at least 20 trucks.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel consumption while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=20)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nDistanceRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion1\", lb=0)  # distance traveled by trucks in Region 1\nDistanceRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion2\", lb=0)  # distance traveled by trucks in Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\nFuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n## the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n## convert the division to multiplication\nmodel.addCons(obj == FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\nmodel.addCons(DistanceRegion1 + DistanceRegion2 <= 1000)\n## The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\nmodel.addCons(FuelEfficiency1 >= 1.1 * FuelEfficiency2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Distance Traveled by Trucks in Region 1: \", model.getVal(DistanceRegion1))\n    print(\"Distance Traveled by Trucks in Region 2: \", model.getVal(DistanceRegion2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1797,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits.\n// {\"number of units of MachineA\": \"MachineAUnits\", \"range\": \"MachineAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineBUnits\", \"range\": \"MachineBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineCUnits\", \"range\": \"MachineCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineDUnits\", \"range\": \"MachineDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company wants to maximize the total profit.\n// Profit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\n// Profit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\n// Profit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\n// Profit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineA must be at least half the production of MachineB.\n// MachineAUnits >= 0.5 * MachineBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for the month.\n// 2000 * MachineAUnits + 3000 * MachineBUnits + 4000 * MachineCUnits + 5000 * MachineDUnits <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of machine has at least one unit produced.\n// MachineAUnits >= 1; MachineBUnits >= 1; MachineCUnits >= 1; MachineDUnits >= 1\n\n## Generate Constraint-5:\nThe production of MachineD cannot exceed twice the production of MachineC.\n// MachineDUnits <= 2 * MachineCUnits",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits. The profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company has a total production capacity of 100 units for the month. Due to supplier agreements, the production of MachineA must be at least half the production of MachineB. The company has a budget of $50,000 for production costs for the month. The company wants to ensure that each type of machine has at least one unit produced. The production of MachineD cannot exceed twice the production of MachineC. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineAUnits\", lb=1)  # number of units of MachineA\nMachineBUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineBUnits\", lb=1)  # number of units of MachineB\nMachineCUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineCUnits\", lb=1)  # number of units of MachineC\nMachineDUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineDUnits\", lb=0)  # number of units of MachineD\n\n# Define objective function\nProfit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\nProfit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\nProfit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\nProfit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\nmodel.addCons(MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100)  # Total production capacity\nmodel.addCons(MachineAUnits >= 0.5 * MachineBUnits)  # MachineA production must be at least half of MachineB\nmodel.addCons(2000 * MachineAUnits + 3000 * MachineBUnits + 4000 * MachineCUnits + 5000 * MachineDUnits <= 50000)  # Budget constraint\nmodel.addCons(MachineDUnits <= 2 * MachineCUnits)  # MachineD production cannot exceed twice MachineC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineAUnits))\n    print(\"Number of MachineB Units: \", model.getVal(MachineBUnits))\n    print(\"Number of MachineC Units: \", model.getVal(MachineCUnits))\n    print(\"Number of MachineD Units: \", model.getVal(MachineDUnits))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region (North, South, East, West) and the fuel efficiency of each truck type. The company also needs to determine the cost of maintenance per truck and the revenue generated per delivery.\n// {\"number of trucks for North\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency per truck (km/liter) for North\": \"NorthFuelEfficiency\", \"range\": \"NorthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for South\": \"SouthFuelEfficiency\", \"range\": \"SouthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for East\": \"EastFuelEfficiency\", \"range\": \"EastFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for West\": \"WestFuelEfficiency\", \"range\": \"WestFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for North\": \"NorthMaintenanceCost\", \"range\": \"NorthMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for South\": \"SouthMaintenanceCost\", \"range\": \"SouthMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for East\": \"EastMaintenanceCost\", \"range\": \"EastMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for West\": \"WestMaintenanceCost\", \"range\": \"WestMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"revenue per delivery for North\": \"NorthRevenue\", \"range\": \"NorthRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for South\": \"SouthRevenue\", \"range\": \"SouthRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for East\": \"EastRevenue\", \"range\": \"EastRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for West\": \"WestRevenue\", \"range\": \"WestRevenue > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its monthly profit, which is the total revenue from deliveries minus the total cost of fuel and maintenance.\n// Profit_North = NorthTrucks * NorthRevenue - NorthTrucks * (1000 / NorthFuelEfficiency) * 1.5 - NorthTrucks * NorthMaintenanceCost\n// Profit_South = SouthTrucks * SouthRevenue - SouthTrucks * (1000 / SouthFuelEfficiency) * 1.5 - SouthTrucks * SouthMaintenanceCost\n// Profit_East = EastTrucks * EastRevenue - EastTrucks * (1000 / EastFuelEfficiency) * 1.5 - EastTrucks * EastMaintenanceCost\n// Profit_West = WestTrucks * WestRevenue - WestTrucks * (1000 / WestFuelEfficiency) * 1.5 - WestTrucks * WestMaintenanceCost\n// So, the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// NorthTrucks * 20000 + SouthTrucks * 20000 + EastTrucks * 20000 + WestTrucks * 20000 <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region (North, South, East, West) and the fuel efficiency of each truck type. The company also needs to determine the cost of maintenance per truck and the revenue generated per delivery. The company aims to maximize its monthly profit, which is the total revenue from deliveries minus the total cost of fuel and maintenance. The company has a total budget of $100,000 for purchasing trucks.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to maximize the monthly profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_North = NorthTrucks * 100 - NorthTrucks * (1000 / 10) * 1.5 - NorthTrucks * 50\nProfit_South = SouthTrucks * 120 - SouthTrucks * (1000 / 12) * 1.5 - SouthTrucks * 60\nProfit_East = EastTrucks * 110 - EastTrucks * (1000 / 11) * 1.5 - EastTrucks * 55\nProfit_West = WestTrucks * 90 - WestTrucks * (1000 / 9) * 1.5 - WestTrucks * 45\n## the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West)\nmodel.addCons(obj == Profit_North + Profit_South + Profit_East + Profit_West)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(NorthTrucks * 20000 + SouthTrucks * 20000 + EastTrucks * 20000 + WestTrucks * 20000 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West: \", model.getVal(WestTrucks))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 699,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of solar panels of type A\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type B\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type C\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type D\": \"PanelD\", \"range\": \"PanelD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years.\nThe efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years.\nThe efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years.\nThe efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years.\nThe city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n// EnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\n// TotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n// So, the objective function is: Maximize (EnergyOutput / TotalCost)\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000\n\n## Generate Constraint-2:\nThe total number of solar panels installed should not exceed 500.\n// PanelA + PanelB + PanelC + PanelD <= 500\n\n## Generate Constraint-3:\nAt least 20% of the total budget should be spent on the most efficient solar panel (type D).\n// 250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD)\n\n## Generate Constraint-4:\nThe number of solar panels of type A should not exceed the combined number of panels of types B, C, and D.\n// PanelA <= PanelB + PanelC + PanelD",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies, costs, and lifespans. The city needs to determine the number of each type of solar panel to install in each district. The details of each type of solar panel are given in the following Table.\n\n| Solar Panel Type | Efficiency (kWh/day) | Cost ($) | Lifespan (years) |\n|------------------|----------------------|----------|------------------|\n| A                | 0.15                 | 100      | 10               |\n| B                | 0.20                 | 150      | 12               |\n| C                | 0.25                 | 200      | 15               |\n| D                | 0.30                 | 250      | 20               |\n\nThe city has a budget of $50,000 for the installation of solar panels. The total number of solar panels installed should not exceed 500. At least 20% of the total budget should be spent on the most efficient solar panel (type D). The number of solar panels of type A should not exceed the combined number of panels of types B, C, and D.\n\nPlease help the city to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of solar panels of type A\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of solar panels of type B\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of solar panels of type C\nPanelD = model.addVar(vtype=\"INTEGER\", name=\"PanelD\", lb=0) # number of solar panels of type D\n\n# Define objective function\nEnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\nTotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (EnergyOutput / TotalCost)\n# convert the division to multiplication\nmodel.addCons(obj * TotalCost == EnergyOutput)\n\n# Add constraints\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000)\n# The total number of solar panels installed should not exceed 500.\nmodel.addCons(PanelA + PanelB + PanelC + PanelD <= 500)\n# At least 20% of the total budget should be spent on the most efficient solar panel (type D).\nmodel.addCons(250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD))\n# The number of solar panels of type A should not exceed the combined number of panels of types B, C, and D.\nmodel.addCons(PanelA <= PanelB + PanelC + PanelD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels of Type A: \", model.getVal(PanelA))\n    print(\"Number of Solar Panels of Type B: \", model.getVal(PanelB))\n    print(\"Number of Solar Panels of Type C: \", model.getVal(PanelC))\n    print(\"Number of Solar Panels of Type D: \", model.getVal(PanelD))\n    print(\"Maximized Energy Output per Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1315,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints.\n// {\"number of trucks for goods A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The company aims to minimize the total transportation cost.\n// Cost_A = (1000 - 10 * TruckA) * TruckA\n// Cost_B = (1200 - 10 * TruckB) * TruckB\n// Cost_C = (1500 - 10 * TruckC) * TruckC\n// Cost_D = (1800 - 10 * TruckD) * TruckD\n// Cost_E = (2000 - 10 * TruckE) * TruckE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe total number of trucks available for the month is 50.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-2:\nThe demand for goods A requires at least 5 trucks, and the demand for goods E requires at least 3 trucks.\n// TruckA >= 5; TruckE >= 3",
        "question": "A logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints. The cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The total number of trucks available for the month is 50. The demand for goods A requires at least 5 trucks, and the demand for goods E requires at least 3 trucks. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5) # number of trucks for goods A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for goods B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for goods C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for goods D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=3) # number of trucks for goods E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (1000 - 10 * TruckA) * TruckA\nCost_B = (1200 - 10 * TruckB) * TruckB\nCost_C = (1500 - 10 * TruckC) * TruckC\nCost_D = (1800 - 10 * TruckD) * TruckD\nCost_E = (2000 - 10 * TruckE) * TruckE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available for the month is 50.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Goods D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Goods E: \", model.getVal(TruckE))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods depends on the distance and the number of trucks used. The cost function is nonlinear and includes a quadratic term reflecting increased operational complexity with more trucks.\n// The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n// Objective: Minimize C\n// Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\n// T1 >= 15; T2 >= 15; T3 >= 15; T4 >= 15; T5 >= 15; T6 >= 15",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands. The cost of transporting goods depends on the number of trucks used and includes a quadratic term reflecting increased operational complexity with more trucks.\n\n| Warehouse | Number of Trucks |\n|-----------|------------------|\n| 1         | T1               |\n| 2         | T2               |\n| 3         | T3               |\n| 4         | T4               |\n| 5         | T5               |\n| 6         | T6               |\n\nThe cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6). The company aims to minimize this cost.\n\nThe total number of trucks available across all warehouses is 100. Each warehouse can handle a maximum of 20 trucks. The company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\n\nPlease help the company to minimize the transportation cost by optimizing the allocation of trucks to each warehouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=15, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=15, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=15, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=15, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=15, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n# The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n# Objective: Minimize C\n# Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1000 * (T1**2 + T2**2 + T3**2 + T4**2 + T5**2 + T6**2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Add constraints\n# The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Each warehouse can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# The company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\nmodel.addCons(T1 >= 15)\nmodel.addCons(T2 >= 15)\nmodel.addCons(T3 >= 15)\nmodel.addCons(T4 >= 15)\nmodel.addCons(T5 >= 15)\nmodel.addCons(T6 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000\n\n## Generate Constraint-2:\nThe production rate from each machine should not be less than 10 units per hour.\n// Pi >= 10 for i = 1, 2, 3, 4, 5, 6",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The energy consumption of each machine is modeled as a quadratic function of the voltage applied, and the production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour. The total energy consumption should not exceed 15000 units, and the production rate from each machine should not be less than 10 units per hour. Please help the plant manager determine the optimal voltage settings for each machine (V1, V2, V3, V4, V5, V6) within the range of 0 < Vi <= 120 for i = 1, 2, 3, 4, 5, 6.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120)  # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120)  # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120)  # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120)  # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120)  # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120)  # voltage for machine 6\n\n# Define objective function\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\nTotalEnergy = E1 + E2 + E3 + E4 + E5 + E6\n\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\nTotalProduction = P1 + P2 + P3 + P4 + P5 + P6\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalEnergy)\n\n# Add constraints\nmodel.addCons(TotalEnergy <= 15000)\nmodel.addCons(TotalProduction >= 1000)\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\nmodel.addCons(P4 >= 10)\nmodel.addCons(P5 >= 10)\nmodel.addCons(P6 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to invest in solar and wind energy projects. They need to determine the number of solar panels (SolarP) and wind turbines (WindT) to install, as well as the amount of money to invest in research and development (R&D) for each type of energy. The efficiency of both solar panels and wind turbines increases with the investment in R&D.\n// {\"number of solar panels\": \"SolarP\", \"range\": \"SolarP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindT\", \"range\": \"WindT >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for solar\": \"R&DSolar\", \"range\": \"R&DSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for wind\": \"R&DWind\", \"range\": \"R&DWind >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel increases by 5% for every $100,000 invested in R&D for solar. The initial energy output per solar panel is 200 kWh. Similarly, the energy output per wind turbine increases by 8% for every $100,000 invested in R&D for wind. The initial energy output per wind turbine is 500 kWh. The company aims to maximize the total energy output.\n// EnergyOutputSolar = 200 * (1 + 0.05 * (R&DSolar / 100000)) * SolarP\n// EnergyOutputWind = 500 * (1 + 0.08 * (R&DWind / 100000)) * WindT\n// So, the objective function is: Maximize (EnergyOutputSolar + EnergyOutputWind)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for both installations and R&D.\n// 1000 * SolarP + 5000 * WindT + R&DSolar + R&DWind <= 5000000\n\n## Generate Constraint-2:\nThe total area available for installation is 10,000 square meters. Each solar panel requires 2 square meters and each wind turbine requires 10 square meters.\n// 2 * SolarP + 10 * WindT <= 10000",
        "question": "A renewable energy company is planning to invest in solar and wind energy projects. They need to determine the number of solar panels (SolarP) and wind turbines (WindT) to install, as well as the amount of money to invest in research and development (R&D) for each type of energy. The efficiency of both solar panels and wind turbines increases with the investment in R&D. The energy output per solar panel increases by 5% for every $100,000 invested in R&D for solar, with an initial output of 200 kWh per panel. Similarly, the energy output per wind turbine increases by 8% for every $100,000 invested in R&D for wind, with an initial output of 500 kWh per turbine. The company aims to maximize the total energy output.\n\n| Component | Initial Output | R&D Impact per $100,000 | Space Required |\n|-----------|-----------------|-------------------------|----------------|\n| SolarP    | 200 kWh        | 5% increase             | 2 sq. meters   |\n| WindT     | 500 kWh        | 8% increase             | 10 sq. meters  |\n\nThe company has a budget of $5,000,000 for both installations and R&D. The total area available for installation is 10,000 square meters. Each solar panel requires 2 square meters and each wind turbine requires 10 square meters.\n\nPlease help the company determine the optimal number of solar panels and wind turbines to install, as well as the investment in R&D for each type of energy to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarP = model.addVar(vtype=\"INTEGER\", name=\"SolarP\", lb=0) # number of solar panels\nWindT = model.addVar(vtype=\"INTEGER\", name=\"WindT\", lb=0) # number of wind turbines\nR_DSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"R_DSolar\", lb=0) # investment in R&D for solar\nR_DWind = model.addVar(vtype=\"CONTINUOUS\", name=\"R_DWind\", lb=0) # investment in R&D for wind\n\n# Define objective function\nEnergyOutputSolar = 200 * (1 + 0.05 * (R_DSolar / 100000)) * SolarP\nEnergyOutputWind = 500 * (1 + 0.08 * (R_DWind / 100000)) * WindT\n# So, the objective function is: Maximize (EnergyOutputSolar + EnergyOutputWind)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar + EnergyOutputWind)\n\n# Add constraints\n# The company has a budget of $5,000,000 for both installations and R&D.\nmodel.addCons(1000 * SolarP + 5000 * WindT + R_DSolar + R_DWind <= 5000000)\n# The total area available for installation is 10,000 square meters. Each solar panel requires 2 square meters and each wind turbine requires 10 square meters.\nmodel.addCons(2 * SolarP + 10 * WindT <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarP))\n    print(\"Number of Wind Turbines: \", model.getVal(WindT))\n    print(\"Investment in R&D for Solar: \", model.getVal(R_DSolar))\n    print(\"Investment in R&D for Wind: \", model.getVal(R_DWind))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1443,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output during peak demand periods.\n// {\"number of solar panels in RegionA\": \"SolarPanelsA\", \"range\": \"SolarPanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarPanelsB\", \"range\": \"SolarPanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarPanelsC\", \"range\": \"SolarPanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindTurbinesA\", \"range\": \"WindTurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindTurbinesB\", \"range\": \"WindTurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindTurbinesC\", \"range\": \"WindTurbinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines varies with the investment in energy storage systems. For every $10,000 invested in energy storage, the efficiency of both solar panels and wind turbines increases by 1%. The initial energy output per solar panel is 200 kWh, and per wind turbine is 500 kWh. The company aims to maximize the total energy output from all regions.\n// Total energy output for RegionA: OutputA = (200 * SolarPanelsA + 500 * WindTurbinesA) * (1 + 0.0001 * EnergyStorage)\n// Total energy output for RegionB: OutputB = (200 * SolarPanelsB + 500 * WindTurbinesB) * (1 + 0.0001 * EnergyStorage)\n// Total energy output for RegionC: OutputC = (200 * SolarPanelsC + 500 * WindTurbinesC) * (1 + 0.0001 * EnergyStorage)\n// So, the objective function is: Maximize (OutputA + OutputB + OutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for installing solar panels and wind turbines.\n// 2000 * SolarPanelsA + 5000 * WindTurbinesA + 2000 * SolarPanelsB + 5000 * WindTurbinesB + 2000 * SolarPanelsC + 5000 * WindTurbinesC <= 500000\n\n## Generate Constraint-2:\nThe total investment in energy storage systems cannot exceed $100,000.\n// EnergyStorage <= 100000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in each region cannot exceed the number of solar panels by more than 50%.\n// WindTurbinesA <= 1.5 * SolarPanelsA; WindTurbinesB <= 1.5 * SolarPanelsB; WindTurbinesC <= 1.5 * SolarPanelsC\n\n## Generate Constraint-4:\nThe company must ensure that at least 50 solar panels are installed in RegionA and 30 wind turbines in RegionB.\n// SolarPanelsA >= 50; WindTurbinesB >= 30",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output during peak demand periods. The initial energy output per solar panel is 200 kWh, and per wind turbine is 500 kWh. For every $10,000 invested in energy storage, the efficiency of both solar panels and wind turbines increases by 1%. The company aims to maximize the total energy output from all regions.\n\n| Component          | Initial Output | Cost per Unit |\n|--------------------|----------------|---------------|\n| Solar Panel        | 200 kWh        | $2000         |\n| Wind Turbine       | 500 kWh        | $5000         |\n| Energy Storage     | N/A            | N/A           |\n\nThe company has a total budget of $500,000 for installing solar panels and wind turbines. The total investment in energy storage systems cannot exceed $100,000. Due to regional regulations, the number of wind turbines in each region cannot exceed the number of solar panels by more than 50%. The company must ensure that at least 50 solar panels are installed in RegionA and 30 wind turbines in RegionB.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanelsA = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsA\", lb=0)\nSolarPanelsB = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsB\", lb=0)\nSolarPanelsC = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsC\", lb=0)\nWindTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesA\", lb=0)\nWindTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesB\", lb=0)\nWindTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesC\", lb=0)\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)\n\n# Define objective function\nOutputA = (200 * SolarPanelsA + 500 * WindTurbinesA) * (1 + 0.0001 * EnergyStorage)\nOutputB = (200 * SolarPanelsB + 500 * WindTurbinesB) * (1 + 0.0001 * EnergyStorage)\nOutputC = (200 * SolarPanelsC + 500 * WindTurbinesC) * (1 + 0.0001 * EnergyStorage)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == OutputA + OutputB + OutputC)\n\n# Add constraints\nmodel.addCons(2000 * SolarPanelsA + 5000 * WindTurbinesA + 2000 * SolarPanelsB + 5000 * WindTurbinesB + 2000 * SolarPanelsC + 5000 * WindTurbinesC <= 500000)\nmodel.addCons(EnergyStorage <= 100000)\nmodel.addCons(WindTurbinesA <= 1.5 * SolarPanelsA)\nmodel.addCons(WindTurbinesB <= 1.5 * SolarPanelsB)\nmodel.addCons(WindTurbinesC <= 1.5 * SolarPanelsC)\nmodel.addCons(SolarPanelsA >= 50)\nmodel.addCons(WindTurbinesB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarPanelsA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarPanelsB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarPanelsC))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindTurbinesA))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindTurbinesB))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindTurbinesC))\n    print(\"Investment in Energy Storage: \", model.getVal(EnergyStorage))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1520,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels, the number of wind turbines, the size of the battery storage, the energy consumption rate, and the maintenance cost.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"size of battery storage (kWh)\": \"Battery\", \"range\": \"Battery >= 0\", \"type\": \"real\"}\n// {\"energy consumption rate (kWh/day)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"annual maintenance cost ($)\": \"Maintenance\", \"range\": \"Maintenance >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of energy production and maintenance. The cost of installing a solar panel is $1000, a wind turbine is $2000, and the battery storage is $50 per kWh. The annual maintenance cost is $50 per solar panel, $100 per wind turbine, and $10 per kWh of battery storage. The energy production from a solar panel is 0.5 kWh/day, from a wind turbine is 1 kWh/day, and the battery storage efficiency is 90%.\n// Total installation cost: InstallCost = 1000 * Solar + 2000 * Wind + 50 * Battery\n// Total annual maintenance cost: MainCost = 50 * Solar + 100 * Wind + 10 * Battery\n// Total energy production: EnergyProd = 0.5 * Solar + 1 * Wind\n// Total energy storage: EnergyStored = 0.9 * Battery\n// Objective function: Minimize (InstallCost + MainCost) / (EnergyProd + EnergyStored)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for installation.\n// 1000 * Solar + 2000 * Wind + 50 * Battery <= 50000\n\n## Generate Constraint-2:\nThe daily energy consumption must be met, with a minimum requirement of 100 kWh/day.\n// 0.5 * Solar + 1 * Wind + 0.9 * Battery >= 100\n\n## Generate Constraint-3:\nThe company aims to have at least 50% of its energy needs met by renewable sources.\n// (0.5 * Solar + 1 * Wind) / Consumption >= 0.5\n\n## Generate Constraint-4:\nThe maintenance cost should not exceed 10% of the total installation cost.\n// (50 * Solar + 100 * Wind + 10 * Battery) <= 0.1 * (1000 * Solar + 2000 * Wind + 50 * Battery)\n\n## Generate Constraint-5:\nThe battery storage should be sufficient to store at least 50% of the total daily energy production.\n// Battery >= 0.5 * (0.5 * Solar + 1 * Wind) / 0.9",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels, the number of wind turbines, the size of the battery storage, the energy consumption rate, and the annual maintenance cost. The company aims to minimize the total cost of energy production and maintenance. The cost of installing a solar panel is $1000, a wind turbine is $2000, and the battery storage is $50 per kWh. The annual maintenance cost is $50 per solar panel, $100 per wind turbine, and $10 per kWh of battery storage. The energy production from a solar panel is 0.5 kWh/day, from a wind turbine is 1 kWh/day, and the battery storage efficiency is 90%. The company has a budget of $50,000 for installation. The daily energy consumption must be met, with a minimum requirement of 100 kWh/day. The company aims to have at least 50% of its energy needs met by renewable sources. The maintenance cost should not exceed 10% of the total installation cost. The battery storage should be sufficient to store at least 50% of the total daily energy production.\n\nPlease help the company to minimize the total cost of energy production and maintenance, defined as the sum of the installation and maintenance costs divided by the sum of the energy production and stored energy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nBattery = model.addVar(vtype=\"CONTINUOUS\", name=\"Battery\", lb=0)  # size of battery storage (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption rate (kWh/day)\nMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance\", lb=0)  # annual maintenance cost ($)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstallCost = 1000 * Solar + 2000 * Wind + 50 * Battery\nMainCost = 50 * Solar + 100 * Wind + 10 * Battery\nEnergyProd = 0.5 * Solar + 1 * Wind\nEnergyStored = 0.9 * Battery\n## the objective function is: Minimize (InstallCost + MainCost) / (EnergyProd + EnergyStored)\n## convert the division to multiplication\nmodel.addCons(obj * (EnergyProd + EnergyStored) == InstallCost + MainCost)\n\n# Add constraints\n## The company has a budget of $50,000 for installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 50 * Battery <= 50000)\n## The daily energy consumption must be met, with a minimum requirement of 100 kWh/day.\nmodel.addCons(0.5 * Solar + 1 * Wind + 0.9 * Battery >= 100)\n## The company aims to have at least 50% of its energy needs met by renewable sources.\nmodel.addCons((0.5 * Solar + 1 * Wind) / Consumption >= 0.5)\n## The maintenance cost should not exceed 10% of the total installation cost.\nmodel.addCons(50 * Solar + 100 * Wind + 10 * Battery <= 0.1 * (1000 * Solar + 2000 * Wind + 50 * Battery))\n## The battery storage should be sufficient to store at least 50% of the total daily energy production.\nmodel.addCons(Battery >= 0.5 * (0.5 * Solar + 1 * Wind) / 0.9)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Size of Battery Storage: \", model.getVal(Battery))\n    print(\"Energy Consumption Rate: \", model.getVal(Consumption))\n    print(\"Annual Maintenance Cost: \", model.getVal(Maintenance))\n    print(\"Minimized Cost Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours.\n// 10 * T + 8 * V + 2 * B <= 500\n\n## Generate Constraint-3:\nThe company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\n// B <= 0.5 * (T + V)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h). The company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each. The company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours. The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes. The company also wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans. Please help the company to maximize the total daily transport capacity in tons per hour (ton-km/h).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\n# So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n# The company has a total of 500 hours of driver work time available per day.\nmodel.addCons(10 * T + 8 * V + 2 * B <= 500)\n# The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n# The company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\nmodel.addCons(B <= 0.5 * (T + V))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region (Region A, Region B, and Region C) and the number of trips each truck should make per day. The efficiency of each truck varies depending on the region and the type of goods being transported.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $100 per trip, in Region B is $150 per trip, and in Region C is $200 per trip. The revenue generated per trip in Region A is $200, in Region B is $300, and in Region C is $400. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Profit_A = TripsA * TrucksA * (200 - 100)\n// Profit_B = TripsB * TrucksB * (300 - 150)\n// Profit_C = TripsC * TrucksC * (400 - 200)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs per day.\n// 100 * TrucksA * TripsA + 150 * TrucksB * TripsB + 200 * TrucksC * TripsC <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trips per day across all regions.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100\n\n## Generate Constraint-3:\nThe company can only allocate a maximum of 20 trucks in total across all regions.\n// TrucksA + TrucksB + TrucksC <= 20",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions: Region A, Region B, and Region C. The company needs to decide the number of trucks to allocate for each region and the number of trips each truck should make per day. The cost of operating a truck and the revenue generated per trip vary by region as shown in the following Table.\n\n| Region | Operating Cost per Trip | Revenue per Trip |\n|--------|-------------------------|------------------|\n| A      | $100                    | $200             |\n| B      | $150                    | $300             |\n| C      | $200                    | $400             |\n\nThe company has a total budget of $10,000 for operating costs per day. The company has a limit of 100 trips per day across all regions. The company can only allocate a maximum of 20 trucks in total across all regions. \n\nPlease help the company to maximize its net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Region C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Region A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Region B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Region C\n\n# Define objective function\nProfit_A = TripsA * TrucksA * (200 - 100)\nProfit_B = TripsB * TrucksB * (300 - 150)\nProfit_C = TripsC * TrucksC * (400 - 200)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(100 * TrucksA * TripsA + 150 * TrucksB * TripsB + 200 * TrucksC * TripsC <= 10000)\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Region A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Region B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Region C: \", model.getVal(TripsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for trucks in Region 1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck.\n// Total operational cost for Region 1: Cost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Region 2: Cost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Region 3: Cost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type. The company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck. The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n\nPlease help the company to minimize the total operational cost, considering the fuel costs and investments in fuel efficiency upgrades for each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for trucks in Region 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for trucks in Region 2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for trucks in Region 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialFuelCost = 0.1  # assuming initial fuel cost per kilometer\nDistance1 = 1000  # assuming distance for Region 1\nDistance2 = 1500  # assuming distance for Region 2\nDistance3 = 2000  # assuming distance for Region 3\n## Total operational cost for each region\nCost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\nCost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\nCost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region 1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region 2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region 3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for its trucks to minimize fuel consumption and travel time. The company has five different routes (Route1, Route2, Route3, Route4, Route5) that each truck can take, and each route has a different length and traffic condition. Additionally, the company can invest in upgrading the fuel efficiency of each route by improving road conditions.\n// {\"trucks on Route1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"investment in Route1 efficiency\": \"Invest1\", \"range\": \"Invest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route2 efficiency\": \"Invest2\", \"range\": \"Invest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route3 efficiency\": \"Invest3\", \"range\": \"Invest3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route4 efficiency\": \"Invest4\", \"range\": \"Invest4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route5 efficiency\": \"Invest5\", \"range\": \"Invest5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are affected by the investment in road condition improvements. The initial fuel consumption rate for Route1 is 10 liters per truck, but with investment, the rate decreases by 0.1 liters per truck for every $100 invested. Similar effects apply to the other routes with different initial rates and decrease rates. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Route1 = (10 - 0.001 * Invest1) * Truck1\n// Fuel_Route2 = (12 - 0.0012 * Invest2) * Truck2\n// Fuel_Route3 = (11 - 0.0011 * Invest3) * Truck3\n// Fuel_Route4 = (9 - 0.0009 * Invest4) * Truck4\n// Fuel_Route5 = (13 - 0.0013 * Invest5) * Truck5\n// So, the objective function is: Minimize (Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for route improvements and truck operations.\n// 1000 * Truck1 + 1200 * Truck2 + 1100 * Truck3 + 900 * Truck4 + 1300 * Truck5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 500.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trucks must be assigned to Route1 and at least 150 trucks to Route2.\n// Truck1 >= 100; Truck2 >= 150",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for its trucks to minimize fuel consumption and travel time. The company has five different routes (Route1, Route2, Route3, Route4, Route5) that each truck can take, and each route has a different length and traffic condition. Additionally, the company can invest in upgrading the fuel efficiency of each route by improving road conditions. The initial fuel consumption rate and the decrease rate per investment for each route are given in the following Table.\n\n| Route | Initial Fuel Consumption Rate | Decrease Rate per Investment |\n|-------|-------------------------------|------------------------------|\n| 1     | 10 liters per truck           | 0.1 liters per $100 invested |\n| 2     | 12 liters per truck           | 0.12 liters per $100 invested |\n| 3     | 11 liters per truck           | 0.11 liters per $100 invested |\n| 4     | 9 liters per truck            | 0.09 liters per $100 invested |\n| 5     | 13 liters per truck           | 0.13 liters per $100 invested |\n\nThe company has a total budget of $100,000 for route improvements and truck operations. The total number of trucks available for all routes is limited to 500. Due to contractual obligations, at least 100 trucks must be assigned to Route1 and at least 150 trucks to Route2. \n\nPlease help the company to minimize the total fuel consumption across all routes by determining the optimal number of trucks on each route and the investment in each route's efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=100)  # trucks on Route1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=150)  # trucks on Route2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)    # trucks on Route3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)    # trucks on Route4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)    # trucks on Route5\nInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest1\", lb=0)  # investment in Route1 efficiency\nInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest2\", lb=0)  # investment in Route2 efficiency\nInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest3\", lb=0)  # investment in Route3 efficiency\nInvest4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest4\", lb=0)  # investment in Route4 efficiency\nInvest5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest5\", lb=0)  # investment in Route5 efficiency\n\n# Define objective function\nFuel_Route1 = (10 - 0.001 * Invest1) * Truck1\nFuel_Route2 = (12 - 0.0012 * Invest2) * Truck2\nFuel_Route3 = (11 - 0.0011 * Invest3) * Truck3\nFuel_Route4 = (9 - 0.0009 * Invest4) * Truck4\nFuel_Route5 = (13 - 0.0013 * Invest5) * Truck5\n# So, the objective function is: Minimize (Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\n\n# Add constraints\n# The company has a total budget of $100,000 for route improvements and truck operations.\nmodel.addCons(1000 * Truck1 + 1200 * Truck2 + 1100 * Truck3 + 900 * Truck4 + 1300 * Truck5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000)\n# The total number of trucks available for all routes is limited to 500.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks on Route1: \", model.getVal(Truck1))\n    print(\"Trucks on Route2: \", model.getVal(Truck2))\n    print(\"Trucks on Route3: \", model.getVal(Truck3))\n    print(\"Trucks on Route4: \", model.getVal(Truck4))\n    print(\"Trucks on Route5: \", model.getVal(Truck5))\n    print(\"Investment in Route1 Efficiency: \", model.getVal(Invest1))\n    print(\"Investment in Route2 Efficiency: \", model.getVal(Invest2))\n    print(\"Investment in Route3 Efficiency: \", model.getVal(Invest3))\n    print(\"Investment in Route4 Efficiency: \", model.getVal(Invest4))\n    print(\"Investment in Route5 Efficiency: \", model.getVal(Invest5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1518,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops to reduce energy costs and carbon emissions. The city has identified three types of buildings (residential, commercial, and industrial) where solar panels can be installed. The city needs to determine the number of solar panels to install on each type of building and the cost per panel for each type.\n// {\"number of solar panels for residential buildings\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for industrial buildings\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"cost per solar panel for residential buildings\": \"ResidentialCostPerPanel\", \"range\": \"ResidentialCostPerPanel >= 0\", \"type\": \"real\"}\n// {\"cost per solar panel for commercial buildings\": \"CommercialCostPerPanel\", \"range\": \"CommercialCostPerPanel >= 0\", \"type\": \"real\"}\n// {\"cost per solar panel for industrial buildings\": \"IndustrialCostPerPanel\", \"range\": \"IndustrialCostPerPanel >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city aims to minimize the total cost of installing solar panels while maximizing the total energy generated. The energy generated per panel is 100 kWh for residential, 150 kWh for commercial, and 200 kWh for industrial buildings. The city also wants to ensure that the total energy generated is at least 10,000 kWh.\n// TotalCost = ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel\n// TotalEnergy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n// So, the objective function is: Minimize TotalCost subject to TotalEnergy >= 10000\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel <= 50000\n\n## Generate Constraint-2:\nThe city wants to ensure that at least 20% of the budget is spent on residential buildings.\n// ResidentialPanels * ResidentialCostPerPanel >= 0.2 * (ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel)\n\n## Generate Constraint-3:\nThe city has a limit on the number of panels that can be installed on commercial buildings due to space constraints, not more than 100 panels.\n// CommercialPanels <= 100",
        "question": "A city is planning to install solar panels on rooftops to reduce energy costs and carbon emissions. The city has identified three types of buildings (residential, commercial, and industrial) where solar panels can be installed. The city needs to determine the number of solar panels to install on each type of building and the cost per panel for each type. The energy generated per panel is 100 kWh for residential, 150 kWh for commercial, and 200 kWh for industrial buildings. The city aims to minimize the total cost of installing solar panels while maximizing the total energy generated, ensuring that the total energy generated is at least 10,000 kWh.\n\n| Building Type       | Energy Generated per Panel | Cost per Panel |\n|---------------------|----------------------------|----------------|\n| Residential         | 100 kWh                    | ResidentialCostPerPanel |\n| Commercial          | 150 kWh                    | CommercialCostPerPanel |\n| Industrial          | 200 kWh                    | IndustrialCostPerPanel |\n\nThe city has a budget of $50,000 for the installation of solar panels. The city wants to ensure that at least 20% of the budget is spent on residential buildings. Additionally, due to space constraints, the city has a limit on the number of panels that can be installed on commercial buildings, not more than 100 panels.\n\nPlease help the city to determine the optimal number of solar panels to install on each type of building and the cost per panel to minimize the total cost while meeting the energy generation requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nResidentialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"ResidentialCostPerPanel\", lb=0)\nCommercialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialCostPerPanel\", lb=0)\nIndustrialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"IndustrialCostPerPanel\", lb=0)\n\n# Define objective function\nTotalCost = ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel\nTotalEnergy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(TotalCost <= 50000)\n# The city wants to ensure that at least 20% of the budget is spent on residential buildings.\nmodel.addCons(ResidentialPanels * ResidentialCostPerPanel >= 0.2 * TotalCost)\n# The city has a limit on the number of panels that can be installed on commercial buildings due to space constraints, not more than 100 panels.\nmodel.addCons(CommercialPanels <= 100)\n# Ensure that the total energy generated is at least 10,000 kWh.\nmodel.addCons(TotalEnergy >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Residential Buildings: \", model.getVal(ResidentialPanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Number of Solar Panels for Industrial Buildings: \", model.getVal(IndustrialPanels))\n    print(\"Cost per Solar Panel for Residential Buildings: \", model.getVal(ResidentialCostPerPanel))\n    print(\"Cost per Solar Panel for Commercial Buildings: \", model.getVal(CommercialCostPerPanel))\n    print(\"Cost per Solar Panel for Industrial Buildings: \", model.getVal(IndustrialCostPerPanel))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1559,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of M1 machines\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of M2 machines\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of M3 machines\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of M4 machines\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for M1 is $500, for M2 is $700, for M3 is $900, and for M4 is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each machine type is given by: Cost_M1 = 200 + 0.01 * M1^2, Cost_M2 = 300 + 0.015 * M2^2, Cost_M3 = 400 + 0.02 * M3^2, Cost_M4 = 500 + 0.025 * M4^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n// Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n// Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n// Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines for the quarter.\n// M1 + M2 + M3 + M4 <= 500\n\n## Generate Constraint-2:\nThe market demand for M1 and M2 combined should not exceed 300 units.\n// M1 + M2 <= 300\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\n// M3 + M4 <= 200",
        "question": "A manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the production cost function for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost Function |\n|--------------|-----------------|--------------------------|\n| M1           | $500            | 200 + 0.01 * M1^2        |\n| M2           | $700            | 300 + 0.015 * M2^2       |\n| M3           | $900            | 400 + 0.02 * M3^2        |\n| M4           | $1100           | 500 + 0.025 * M4^2       |\n\nThe company has a total production capacity of 500 machines for the quarter. The market demand for M1 and M2 combined should not exceed 300 units. The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of M1 machines\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of M2 machines\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of M3 machines\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of M4 machines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n## Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n## Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n## Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n## So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\nmodel.addCons(obj == ((500 - (200 + 0.01 * M1**2)) * M1 +\n                      (700 - (300 + 0.015 * M2**2)) * M2 +\n                      (900 - (400 + 0.02 * M3**2)) * M3 +\n                      (1100 - (500 + 0.025 * M4**2)) * M4))\n\n# Add constraints\n## The company has a total production capacity of 500 machines for the quarter.\nmodel.addCons(M1 + M2 + M3 + M4 <= 500)\n## The market demand for M1 and M2 combined should not exceed 300 units.\nmodel.addCons(M1 + M2 <= 300)\n## The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\nmodel.addCons(M3 + M4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of M1 Machines: \", model.getVal(M1))\n    print(\"Number of M2 Machines: \", model.getVal(M2))\n    print(\"Number of M3 Machines: \", model.getVal(M3))\n    print(\"Number of M4 Machines: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. \nFor Truck A, the operational cost per mile is $2, and it generates $5 per mile.\nFor Truck B, the operational cost per mile is $3, and it generates $6 per mile.\nFor Truck C, the operational cost per mile is $4, and it generates $7 per mile.\nFor Truck D, the operational cost per mile is $5, and it generates $8 per mile.\nFor Truck E, the operational cost per mile is $6, and it generates $9 per mile.\nThe company aims to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).\n// Net profit per mile of A: Profit_A = (5 - 2) * A\n// Net profit per mile of B: Profit_B = (6 - 3) * B\n// Net profit per mile of C: Profit_C = (7 - 4) * C\n// Net profit per mile of D: Profit_D = (8 - 5) * D\n// Net profit per mile of E: Profit_E = (9 - 6) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs for the month.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to deploy at least 5 trucks of each type for the month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be deployed in total.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B.\n// D <= A + B",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month. Each type of truck has different operational costs and revenue generation capabilities. For Truck A, the operational cost per mile is $2, and it generates $5 per mile. For Truck B, the operational cost per mile is $3, and it generates $6 per mile. For Truck C, the operational cost per mile is $4, and it generates $7 per mile. For Truck D, the operational cost per mile is $5, and it generates $8 per mile. For Truck E, the operational cost per mile is $6, and it generates $9 per mile. The company has a budget of $10,000 for operational costs for the month. The company wants to deploy at least 5 trucks of each type for the month. The company has a limit of 100 trucks that can be deployed in total. The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B. Please help the company to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to deploy at least 5 trucks of each type for the month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (6 - 3) * B\nProfit_C = (7 - 4) * C\nProfit_D = (8 - 5) * D\nProfit_E = (9 - 6) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs for the month.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n\n| Device Type | Profit per Unit | Production Rate per Worker per Day |\n|-------------|-----------------|------------------------------------|\n| Smartphones | $100            | 10                                 |\n| Tablets     | $150            | 5                                  |\n| Laptops     | $200            | 2                                  |\n\nThe firm has a total of 50 workers available. Please help the firm determine the optimal number of workers for each production line to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)  # number of workers for smartphones production\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)  # number of workers for tablets production\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)  # number of workers for laptops production\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\n# So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck will make. The company also needs to consider the fuel efficiency of each truck type and the cost of fuel.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A (km/liter)\": \"EfficiencyA\", \"range\": \"EfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B (km/liter)\": \"EfficiencyB\", \"range\": \"EfficiencyB > 0\", \"type\": \"real\"}\n// {\"cost of fuel per liter\": \"FuelCost\", \"range\": \"FuelCost > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The distance traveled by each truck in Region A is 500 km per trip, and in Region B, it is 700 km per trip.\n// Fuel_Cost_A = TrucksA * TripsA * (500 / EfficiencyA) * FuelCost\n// Fuel_Cost_B = TrucksB * TripsB * (700 / EfficiencyB) * FuelCost\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Cost_A + Fuel_Cost_B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 20 trucks available.\n// TrucksA + TrucksB <= 20\n\n## Generate Constraint-3:\nThe company can make a maximum of 100 trips per day.\n// TrucksA * TripsA + TrucksB * TripsB <= 100\n\n## Generate Constraint-4:\nThe fuel efficiency of trucks in Region A must be at least 5 km/liter, and in Region B, at least 6 km/liter.\n// EfficiencyA >= 5\n// EfficiencyB >= 6",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck will make. The company also needs to consider the fuel efficiency of each truck type and the cost of fuel. The distance traveled by each truck in Region A is 500 km per trip, and in Region B, it is 700 km per trip. The company aims to minimize the total fuel cost per day. The company has a total budget of $10,000 for fuel costs per day. The company has a maximum of 20 trucks available. The company can make a maximum of 100 trips per day. The fuel efficiency of trucks in Region A must be at least 5 km/liter, and in Region B, at least 6 km/liter. Please help the company to determine the optimal allocation of trucks and trips to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Region B\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips per truck for Region A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips per truck for Region B\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=5)  # fuel efficiency of trucks for Region A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=6)  # fuel efficiency of trucks for Region B\nFuelCost = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelCost\", lb=0)  # cost of fuel per liter\n\n# Define objective function\nFuel_Cost_A = TrucksA * TripsA * (500 / EfficiencyA) * FuelCost\nFuel_Cost_B = TrucksB * TripsB * (700 / EfficiencyB) * FuelCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B)\n\n# Add constraints\nmodel.addCons(Fuel_Cost_A + Fuel_Cost_B <= 10000)\nmodel.addCons(TrucksA + TrucksB <= 20)\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trips per Truck for Region A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Region B: \", model.getVal(TripsB))\n    print(\"Fuel Efficiency for Region A: \", model.getVal(EfficiencyA))\n    print(\"Fuel Efficiency for Region B: \", model.getVal(EfficiencyB))\n    print(\"Cost of Fuel per Liter: \", model.getVal(FuelCost))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $10, and the production cost per unit is $5. \nFor Device B, the profit per unit is $15, and the production cost per unit is $7. \nFor Device C, the profit per unit is $20, and the production cost per unit is $9.\nFor Device D, the profit per unit is $25, and the production cost per unit is $11.\nFor Device E, the profit per unit is $30, and the production cost per unit is $13.\nThe company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity.\n// Profit_A = (10 - 5) * A\n// Profit_B = (15 - 7) * B\n// Profit_C = (20 - 9) * C\n// Profit_D = (25 - 11) * D\n// Profit_E = (30 - 13) * E\n// Penalty_Cost = k * (A + B + C + D + E)^2, where k is a constant (e.g., k = 0.001)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for production costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\nFor Device A, the profit per unit is $10, and the production cost per unit is $5. \nFor Device B, the profit per unit is $15, and the production cost per unit is $7. \nFor Device C, the profit per unit is $20, and the production cost per unit is $9.\nFor Device D, the profit per unit is $25, and the production cost per unit is $11.\nFor Device E, the profit per unit is $30, and the production cost per unit is $13.\nThe company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity. The company has a budget of $1000 for production costs.\nPlease help the company to determine the optimal production quantities for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 - 5) * A\nProfit_B = (15 - 7) * B\nProfit_C = (20 - 9) * C\nProfit_D = (25 - 11) * D\nProfit_E = (30 - 13) * E\nTotalProduction = A + B + C + D + E\nPenalty_Cost = 0.001 * TotalProduction**2\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\n## convert the quadratic term to a linear term by introducing a new variable\nTotalProductionSquared = model.addVar(name=\"TotalProductionSquared\")\nmodel.addCons(TotalProductionSquared == TotalProduction**2)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - 0.001 * TotalProductionSquared)\n\n# Add constraints\n## The company has a budget of $1000 for production costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Truck A has a fuel efficiency of 5 km/liter and an operational cost of $100 per day. Truck B has a fuel efficiency of 7 km/liter and an operational cost of $120 per day. Truck C has a fuel efficiency of 10 km/liter and an operational cost of $150 per day. Truck D has a fuel efficiency of 12 km/liter and an operational cost of $180 per day. Truck E has a fuel efficiency of 15 km/liter and an operational cost of $200 per day. The company aims to minimize the total cost per kilometer traveled, which is defined as the sum of the daily operational costs divided by the sum of the kilometers traveled per day.\n// Cost per km for Truck A: Cost_A = (100 * 30) / (5 * A)\n// Cost per km for Truck B: Cost_B = (120 * 30) / (7 * B)\n// Cost per km for Truck C: Cost_C = (150 * 30) / (10 * C)\n// Cost per km for Truck D: Cost_D = (180 * 30) / (12 * D)\n// Cost per km for Truck E: Cost_E = (200 * 30) / (15 * E)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for operational costs for the month.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 15000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available for deployment.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost. Each type of truck has a different fuel efficiency and operational cost. Truck A has a fuel efficiency of 5 km/liter and an operational cost of $100 per day. Truck B has a fuel efficiency of 7 km/liter and an operational cost of $120 per day. Truck C has a fuel efficiency of 10 km/liter and an operational cost of $150 per day. Truck D has a fuel efficiency of 12 km/liter and an operational cost of $180 per day. Truck E has a fuel efficiency of 15 km/liter and an operational cost of $200 per day. The company aims to minimize the total cost per kilometer traveled, which is defined as the sum of the daily operational costs divided by the sum of the kilometers traveled per day. The company has a budget of $15,000 for operational costs for the month. The company has a total of 100 trucks available for deployment. Please help the company to minimize the total cost per kilometer traveled.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 * 30) / (5 * A)\nCost_B = (120 * 30) / (7 * B)\nCost_C = (150 * 30) / (10 * C)\nCost_D = (180 * 30) / (12 * D)\nCost_E = (200 * 30) / (15 * E)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) == 30 * (100 * A + 120 * B + 150 * C + 180 * D + 200 * E))\n\n# Add constraints\n## The company has a budget of $15,000 for operational costs for the month.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 15000)\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each city are given in the following Table.\n\n| City | Fuel Consumption per Truck | Travel Time per Truck |\n|------|---------------------------|-----------------------|\n| A    | 50 liters                 | 4 hours               |\n| B    | 60 liters                 | 5 hours               |\n| C    | 70 liters                 | 6 hours               |\n| D    | 80 liters                 | 7 hours               |\n| E    | 90 liters                 | 8 hours               |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to minimize the total fuel consumption and travel time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for city E\n\n# Define objective function\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for GoodsX trucks\": \"FuelOptX\", \"range\": \"FuelOptX >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsY trucks\": \"FuelOptY\", \"range\": \"FuelOptY >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsZ trucks\": \"FuelOptZ\", \"range\": \"FuelOptZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n// Operational cost for GoodsX: CostX = (1000 - 0.5 * FuelOptX) * TrucksX\n// Operational cost for GoodsY: CostY = (1200 - 0.6 * FuelOptY) * TrucksY\n// Operational cost for GoodsZ: CostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and truck operations.\n// FuelOptX + FuelOptY + FuelOptZ + (1000 * TrucksX) + (1200 * TrucksY) + (1500 * TrucksZ) <= 100000",
        "question": "A logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck. The operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n\n| Goods Type | Operational Cost per Truck | Fuel Optimization Effect |\n|------------|----------------------------|--------------------------|\n| GoodsX     | 1000$                      | -50$ per $100 invested  |\n| GoodsY     | 1200$                      | -60$ per $100 invested  |\n| GoodsZ     | 1500$                      | -70$ per $100 invested  |\n\nThe company has a total budget of $100,000 for fuel optimization and truck operations. Please help the company to minimize the total operational cost while ensuring timely deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nFuelOptX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptX\", lb=0) # fuel optimization for GoodsX trucks\nFuelOptY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptY\", lb=0) # fuel optimization for GoodsY trucks\nFuelOptZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptZ\", lb=0) # fuel optimization for GoodsZ trucks\n\n# Define objective function\nCostX = (1000 - 0.5 * FuelOptX) * TrucksX\nCostY = (1200 - 0.6 * FuelOptY) * TrucksY\nCostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel optimization and truck operations.\nmodel.addCons(FuelOptX + FuelOptY + FuelOptZ + 1000 * TrucksX + 1200 * TrucksY + 1500 * TrucksZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Optimization for GoodsX Trucks: \", model.getVal(FuelOptX))\n    print(\"Fuel Optimization for GoodsY Trucks: \", model.getVal(FuelOptY))\n    print(\"Fuel Optimization for GoodsZ Trucks: \", model.getVal(FuelOptZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using two raw materials (X and Y). The production process involves mixing different proportions of raw materials to produce each product. The manufacturer needs to determine the optimal quantities of products to maximize profit while considering the availability of raw materials and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material X\": \"RawMaterialX\", \"range\": \"RawMaterialX >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Y\": \"RawMaterialY\", \"range\": \"RawMaterialY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe production of product A requires 2 units of raw material X and 1 unit of raw material Y. Product B requires 1 unit of X and 3 units of Y. Product C requires 4 units of X and 2 units of Y. The total available quantities of raw materials X and Y are 100 and 120 units, respectively.\n// 2 * ProductA + 1 * ProductB + 4 * ProductC <= 100 (for RawMaterialX)\n// 1 * ProductA + 3 * ProductB + 2 * ProductC <= 120 (for RawMaterialY)\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 20",
        "question": "A manufacturer produces three types of products (A, B, and C) using two raw materials (X and Y). The production process involves mixing different proportions of raw materials to produce each product. The profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from selling all products. The production of product A requires 2 units of raw material X and 1 unit of raw material Y. Product B requires 1 unit of X and 3 units of Y. Product C requires 4 units of X and 2 units of Y. The total available quantities of raw materials X and Y are 100 and 120 units, respectively. The market demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units. Please help the manufacturer determine the optimal quantities of products to maximize profit while considering the availability of raw materials and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=15) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=20) # quantity of product C\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint for raw material X\nmodel.addCons(2 * ProductA + 1 * ProductB + 4 * ProductC <= 100)\n# Constraint for raw material Y\nmodel.addCons(1 * ProductA + 3 * ProductB + 2 * ProductC <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product. Additionally, the company is considering investing in a new technology that can reduce the production time per unit, but at a cost. The variables include the number of units of each product and the investment in the new technology.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit for ProductA is 5 hours, for ProductB is 7 hours, and for ProductC is 9 hours. The new technology reduces the production time per unit by 0.1 hours for every $1000 invested. The revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The company aims to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// Production time cost for ProductA: TimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\n// Production time cost for ProductB: TimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\n// Production time cost for ProductC: TimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours.\n// (5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// UnitsA >= 50; UnitsB >= 30\n\n## Generate Constraint-4:\nThe total number of units produced should not exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and consider investing in a new technology that can reduce the production time per unit, but at a cost. The production time per unit, revenue per unit, and the effect of the new technology on production time are given in the following Table.\n\n| Product | Production Time per Unit | Revenue per Unit | Reduction in Production Time per $1000 Investment |\n|---------|--------------------------|------------------|-------------------------------------------------|\n| ProductA | 5 hours                  | $100             | 0.1 hours                                       |\n| ProductB | 7 hours                  | $150             | 0.1 hours                                       |\n| ProductC | 9 hours                  | $200             | 0.1 hours                                       |\n\nThe company has a total production capacity of 1000 hours. The total investment in the new technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 30 units of ProductB. The total number of units produced should not exceed 1000. The company aims to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n\nPlease help the company determine the optimal number of units to produce for each product and the appropriate investment in the new technology to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)   # number of units of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\nTimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\nTimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\nTimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n# So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours.\nmodel.addCons((5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000)\n# The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n# The company must produce at least 50 units of ProductA and 30 units of ProductB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 30)\n# The total number of units produced should not exceed 1000.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1520,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 50 vehicles.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle | Revenue per Day | Operational Cost per Day |\n|---------|-----------------|--------------------------|\n| Trucks  | $500            | $200                     |\n| Vans    | $300            | $100                     |\n| Bikes   | $100            | $30                      |\n\nThe company has a total budget of $10,000 for daily operational costs. The company also has a maximum storage capacity of 50 vehicles. Please help the company to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n## the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n## The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n## The company has a maximum storage capacity of 50 vehicles.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate to each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the number of trips each truck should make per day.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $100 per trip, in RegionB is $120 per trip, in RegionC is $150 per trip, in RegionD is $130 per trip, and in RegionE is $140 per trip. The revenue generated per trip in RegionA is $200, in RegionB is $220, in RegionC is $250, in RegionD is $230, and in RegionE is $240. The company wants to maximize the total net profit per day.\n// NetProfit_RegionA = (200 - 100) * TrucksA * TripsA\n// NetProfit_RegionB = (220 - 120) * TrucksB * TripsB\n// NetProfit_RegionC = (250 - 150) * TrucksC * TripsC\n// NetProfit_RegionD = (230 - 130) * TrucksD * TripsD\n// NetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n// So, the objective function is: Maximize (NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nEach truck can make a maximum of 5 trips per day.\n// TripsA <= 5; TripsB <= 5; TripsC <= 5; TripsD <= 5; TripsE <= 5\n\n## Generate Constraint-3:\nThe total daily fuel cost must not exceed $5000.\n// 100 * TrucksA * TripsA + 120 * TrucksB * TripsB + 150 * TrucksC * TripsC + 130 * TrucksD * TripsD + 140 * TrucksE * TripsE <= 5000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. The company needs to determine the number of trucks to allocate to each region and the number of trips each truck should make per day. The cost of operating a truck and the revenue generated per trip for each region are given in the following Table.\n\n| Region | Cost per Trip | Revenue per Trip |\n|--------|---------------|------------------|\n| RegionA | $100          | $200             |\n| RegionB | $120          | $220             |\n| RegionC | $150          | $250             |\n| RegionD | $130          | $230             |\n| RegionE | $140          | $240             |\n\nThe company has a total of 50 trucks available. Each truck can make a maximum of 5 trips per day. The total daily fuel cost must not exceed $5000. The company wants to maximize the total net profit per day. Please help the company determine the optimal allocation of trucks and trips to each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to determine the number of trucks to allocate to each region and the number of trips each truck should make per day.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for RegionA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for RegionB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for RegionC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0) # number of trips per truck for RegionD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0) # number of trips per truck for RegionE\n\n# Define objective function\n## The company wants to maximize the total net profit per day.\nNetProfit_RegionA = (200 - 100) * TrucksA * TripsA\nNetProfit_RegionB = (220 - 120) * TrucksB * TripsB\nNetProfit_RegionC = (250 - 150) * TrucksC * TripsC\nNetProfit_RegionD = (230 - 130) * TrucksD * TripsD\nNetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\nmodel.addCons(obj == NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Each truck can make a maximum of 5 trips per day.\nmodel.addCons(TripsA <= 5)\nmodel.addCons(TripsB <= 5)\nmodel.addCons(TripsC <= 5)\nmodel.addCons(TripsD <= 5)\nmodel.addCons(TripsE <= 5)\n## The total daily fuel cost must not exceed $5000.\nmodel.addCons(100 * TrucksA * TripsA + 120 * TrucksB * TripsB + 150 * TrucksC * TripsC + 130 * TrucksD * TripsD + 140 * TrucksE * TripsE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Number of Trips per Truck for RegionA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for RegionB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for RegionC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for RegionD: \", model.getVal(TripsD))\n    print(\"Number of Trips per Truck for RegionE: \", model.getVal(TripsE))\n    print(\"Maximized Total Net Profit per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\n// E <= 0.2 * (A + B + C + D + E)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed.\n// A + B <= 0.5 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. The operational costs and transport capacities for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Month | Units of Goods Transported |\n|--------------|----------------------------|----------------------------|\n| Truck A      | $1000                      | 1000                       |\n| Truck B      | $1200                      | 1200                       |\n| Truck C      | $1500                      | 1500                       |\n| Truck D      | $1800                      | 1800                       |\n| Truck E      | $2000                      | 2000                       |\n\nThe company has a budget of $100,000 for operational costs for the upcoming month. The company must transport at least 50,000 units of goods. The company has a limit on the number of vehicles it can deploy, specifically, it can deploy at most 50 vehicles in total. The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed. Additionally, the company wants to ensure that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed.\n\nPlease help the company to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n## The company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n## The company wants to ensure that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed.\nmodel.addCons(A + B <= 0.5 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1612,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency.\n// {\"number of goods shipped from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping goods from each warehouse varies with the volume of goods shipped. The cost function is nonlinear and is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.04 * W2^2\n- Cost from warehouse 3: C3 = 0.06 * W3^2\n- Cost from warehouse 4: C4 = 0.03 * W4^2\n- Cost from warehouse 5: C5 = 0.07 * W5^2\nThe company wants to minimize the total shipping cost.\n// The objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\n// Minimize TotalCost = 0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2\n\n## Generate Constraint-1:\nThe total number of goods that can be shipped from all warehouses is limited to 1000 units.\n// W1 + W2 + W3 + W4 + W5 <= 1000\n\n## Generate Constraint-2:\nEach warehouse has a maximum capacity for shipping goods:\n- Warehouse 1: 200 units\n- Warehouse 2: 300 units\n- Warehouse 3: 250 units\n- Warehouse 4: 150 units\n- Warehouse 5: 100 units\n// W1 <= 200\n// W2 <= 300\n// W3 <= 250\n// W4 <= 150\n// W5 <= 100",
        "question": "A company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency. The cost of shipping goods from each warehouse varies with the volume of goods shipped, and the cost function for each warehouse is given in the following Table.\n\n| Warehouse | Cost Function (per unit) | Maximum Capacity |\n|-----------|-------------------------|------------------|\n| 1         | 0.05 * W1^2             | 200 units        |\n| 2         | 0.04 * W2^2             | 300 units        |\n| 3         | 0.06 * W3^2             | 250 units        |\n| 4         | 0.03 * W4^2             | 150 units        |\n| 5         | 0.07 * W5^2             | 100 units        |\n\nThe company wants to minimize the total shipping cost, which is the sum of the costs from each warehouse. The total number of goods that can be shipped from all warehouses is limited to 1000 units. Each warehouse also has a maximum capacity for shipping goods as specified in the Table.\n\nPlease help the company determine the optimal number of goods to be shipped from each warehouse to minimize the total shipping cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=200) # number of goods shipped from warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0, ub=300) # number of goods shipped from warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0, ub=250) # number of goods shipped from warehouse 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0, ub=150) # number of goods shipped from warehouse 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0, ub=100) # number of goods shipped from warehouse 5\n\n# Define objective function\n## The cost of shipping goods from each warehouse varies with the volume of goods shipped.\nC1 = 0.05 * W1**2\nC2 = 0.04 * W2**2\nC3 = 0.06 * W3**2\nC4 = 0.03 * W4**2\nC5 = 0.07 * W5**2\n## The objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\nTotalCost = C1 + C2 + C3 + C4 + C5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total number of goods that can be shipped from all warehouses is limited to 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of goods shipped from warehouse 1: \", model.getVal(W1))\n    print(\"Number of goods shipped from warehouse 2: \", model.getVal(W2))\n    print(\"Number of goods shipped from warehouse 3: \", model.getVal(W3))\n    print(\"Number of goods shipped from warehouse 4: \", model.getVal(W4))\n    print(\"Number of goods shipped from warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The variables include the number of units produced for each device.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceAUnits\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceBUnits\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceCUnits\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units across all devices.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// DeviceAUnits >= 2 * DeviceBUnits",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| DeviceA | $50             | $30                      |\n| DeviceB | $70             | $40                      |\n| DeviceC | $60             | $35                      |\n\nThe company has a monthly production capacity of 1000 units across all devices. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceAUnits\nProfit_DeviceB = (70 - 40) * DeviceBUnits\nProfit_DeviceC = (60 - 35) * DeviceCUnits\n# The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a monthly production capacity of 1000 units across all devices.\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000)\n# Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\nmodel.addCons(DeviceAUnits >= 2 * DeviceBUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar\": \"SolarMaintenance\", \"range\": \"SolarMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind\": \"WindMaintenance\", \"range\": \"WindMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro\": \"HydroMaintenance\", \"range\": \"HydroMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each power plant type increases with the level of maintenance investment. For every $1000 invested in Solar maintenance, efficiency increases by 1%. For Wind, every $1000 investment increases efficiency by 1.5%. For Hydro, every $1000 investment increases efficiency by 1%. The company aims to maximize the total energy output from all power plants.\n// EnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\n// EnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\n// EnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n// So, the objective function is: Maximize (EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both installation and maintenance of all power plants.\n// SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000\n\n## Generate Constraint-2:\nThe total number of power units that can be installed is limited to 100 due to land availability.\n// SolarUnits + WindUnits + HydroUnits <= 100\n\n## Generate Constraint-3:\nDue to environmental regulations, the company must install at least 20 Solar units and 15 Wind units.\n// SolarUnits >= 20; WindUnits >= 15",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant. For every $1000 invested in Solar maintenance, efficiency increases by 1%. For Wind, every $1000 investment increases efficiency by 1.5%. For Hydro, every $1000 investment increases efficiency by 1%. The company aims to maximize the total energy output from all power plants.\nThe company has a total budget of $100,000 for both installation and maintenance of all power plants. The total number of power units that can be installed is limited to 100 due to land availability. Due to environmental regulations, the company must install at least 20 Solar units and 15 Wind units.\nPlease help the company to maximize the total energy output from all power plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=20)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=15)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nSolarMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarMaintenance\", lb=0)  # maintenance investment for Solar\nWindMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"WindMaintenance\", lb=0)  # maintenance investment for Wind\nHydroMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroMaintenance\", lb=0)  # maintenance investment for Hydro\n\n# Define objective function\nEnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\nEnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\nEnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n# So, the objective function is: Maximize (EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for both installation and maintenance of all power plants.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000)\n# The total number of power units that can be installed is limited to 100 due to land availability.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Solar Maintenance Investment: \", model.getVal(SolarMaintenance))\n    print(\"Wind Maintenance Investment: \", model.getVal(WindMaintenance))\n    print(\"Hydro Maintenance Investment: \", model.getVal(HydroMaintenance))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company has a total budget of $5000 for fuel costs. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a limit of 100 trucks in total. Please help the company to minimize the total fuel cost while maximizing the total cargo carried, with the objective function defined as the total fuel cost divided by the total cargo carried.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000)\n## The company has a limit of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter and needs to decide on the number of trucks to allocate for five different routes: Urban, Suburban, Rural, Express, and International. Each route has different operational costs and revenue potentials.\n// {\"number of trucks for Urban route\": \"Urban\", \"range\": \"Urban >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban route\": \"Suburban\", \"range\": \"Suburban >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural route\": \"Rural\", \"range\": \"Rural >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Express route\": \"Express\", \"range\": \"Express >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for International route\": \"International\", \"range\": \"International >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per truck for Urban is $2000 per month, Suburban is $2500 per month, Rural is $3000 per month, Express is $3500 per month, and International is $4000 per month. The revenue per truck for Urban is $5000 per month, Suburban is $6000 per month, Rural is $7000 per month, Express is $8000 per month, and International is $9000 per month. The company wants to maximize the net profit, which is the total revenue minus the total operational cost.\n// Total Revenue = 5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International\n// Total Cost = 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International\n// So, the objective function is: Maximize (Total Revenue - Total Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 per month for operational costs.\n// 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International <= 150000\n\n## Generate Constraint-2:\nThe company has a limit on the total number of trucks it can deploy, which is 50 trucks.\n// Urban + Suburban + Rural + Express + International <= 50\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to the International route to maintain its international service level.\n// International >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total fleet is allocated to any single route.\n// Urban <= 0.4 * 50\n// Suburban <= 0.4 * 50\n// Rural <= 0.4 * 50\n// Express <= 0.4 * 50\n// International <= 0.4 * 50",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of trucks to allocate for five different routes: Urban, Suburban, Rural, Express, and International. Each route has different operational costs and revenue potentials. The operational cost and revenue per truck for each route are given in the following Table.\n\n| Route          | Operational Cost per Truck per Month | Revenue per Truck per Month |\n|----------------|-------------------------------------|-----------------------------|\n| Urban          | $2000                               | $5000                       |\n| Suburban       | $2500                               | $6000                       |\n| Rural          | $3000                               | $7000                       |\n| Express        | $3500                               | $8000                       |\n| International  | $4000                               | $9000                       |\n\nThe company has a total budget of $150,000 per month for operational costs. The company has a limit on the total number of trucks it can deploy, which is 50 trucks. The company must allocate at least 10 trucks to the International route to maintain its international service level. The company wants to ensure that no more than 40% of the total fleet is allocated to any single route. \nPlease help the company to maximize the net profit, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrban = model.addVar(vtype=\"INTEGER\", name=\"Urban\", lb=0)  # number of trucks for Urban route\nSuburban = model.addVar(vtype=\"INTEGER\", name=\"Suburban\", lb=0)  # number of trucks for Suburban route\nRural = model.addVar(vtype=\"INTEGER\", name=\"Rural\", lb=0)  # number of trucks for Rural route\nExpress = model.addVar(vtype=\"INTEGER\", name=\"Express\", lb=0)  # number of trucks for Express route\nInternational = model.addVar(vtype=\"INTEGER\", name=\"International\", lb=10)  # number of trucks for International route\n\n# Define objective function\nTotalRevenue = 5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International\nTotalCost = 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International\n# So, the objective function is: Maximize (Total Revenue - Total Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a total budget of $150,000 per month for operational costs.\nmodel.addCons(2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International <= 150000)\n# The company has a limit on the total number of trucks it can deploy, which is 50 trucks.\nmodel.addCons(Urban + Suburban + Rural + Express + International <= 50)\n# The company must allocate at least 10 trucks to the International route to maintain its international service level.\nmodel.addCons(International >= 10)\n# The company wants to ensure that no more than 40% of the total fleet is allocated to any single route.\nmodel.addCons(Urban <= 0.4 * 50)\nmodel.addCons(Suburban <= 0.4 * 50)\nmodel.addCons(Rural <= 0.4 * 50)\nmodel.addCons(Express <= 0.4 * 50)\nmodel.addCons(International <= 0.4 * 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Urban route: \", model.getVal(Urban))\n    print(\"Number of trucks for Suburban route: \", model.getVal(Suburban))\n    print(\"Number of trucks for Rural route: \", model.getVal(Rural))\n    print(\"Number of trucks for Express route: \", model.getVal(Express))\n    print(\"Number of trucks for International route: \", model.getVal(International))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company wants to maximize its total profit.\n// ProfitA = (100 - 50) * (100 - 0.1 * UnitsA^2) * UnitsA\n// ProfitB = (120 - 70) * (150 - 0.2 * UnitsB^2) * UnitsB\n// ProfitC = (110 - 60) * (120 - 0.15 * UnitsC^2) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company has a total production capacity of 1000 units per month.\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate profits with quadratic demand functions\nProfitA = (100 - 50) * (100 - 0.1 * UnitsA**2) * UnitsA\nProfitB = (120 - 70) * (150 - 0.2 * UnitsB**2) * UnitsB\nProfitC = (110 - 60) * (120 - 0.15 * UnitsC**2) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for cargo A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by cargo type. For cargo A, the cost per truck is $1000. For cargo B, the cost per truck is $1200. For cargo C, the cost per truck is $1500. For cargo D, the cost per truck is $1800. For cargo E, the cost per truck is $2000. The revenue generated by each cargo type also varies. For cargo A, the revenue per truck is $1500. For cargo B, the revenue per truck is $1800. For cargo C, the revenue per truck is $2200. For cargo D, the revenue per truck is $2500. For cargo E, the revenue per truck is $3000. The company wants to maximize the total net profit, which is the total revenue minus the total cost.\n// Total cost: Cost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total revenue: Revenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n// So, the objective function is: Maximize (Revenue_Total - Cost_Total)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50",
        "question": "A logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck varies by cargo type. For cargo A, the cost per truck is $1000 and the revenue per truck is $1500. For cargo B, the cost per truck is $1200 and the revenue per truck is $1800. For cargo C, the cost per truck is $1500 and the revenue per truck is $2200. For cargo D, the cost per truck is $1800 and the revenue per truck is $2500. For cargo E, the cost per truck is $2000 and the revenue per truck is $3000. The company wants to maximize the total net profit, which is the total revenue minus the total cost. The company has a total of 50 trucks available for allocation.\n\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for cargo A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for cargo B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for cargo C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for cargo D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for cargo E\n\n# Define objective function\nCost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nRevenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue_Total - Cost_Total)\nmodel.addCons(obj == Revenue_Total - Cost_Total)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Cargo D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Cargo E: \", model.getVal(TruckE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The goal is to optimize the production schedule to maximize profit while adhering to certain operational constraints.\n// {\"number of units of product A on line 1\": \"A_Line1\", \"range\": \"A_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A on line 2\": \"A_Line2\", \"range\": \"A_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 1\": \"B_Line1\", \"range\": \"B_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 2\": \"B_Line2\", \"range\": \"B_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 1\": \"C_Line1\", \"range\": \"C_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 2\": \"C_Line2\", \"range\": \"C_Line2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production on line 1 is $20 per unit, and on line 2 is $30 per unit. The manufacturer aims to maximize the total profit from all products.\n// Profit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\n// Profit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\n// Profit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of line 1 is 100 units per day.\n// A_Line1 + B_Line1 + C_Line1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of line 2 is 150 units per day.\n// A_Line2 + B_Line2 + C_Line2 <= 150\n\n## Generate Constraint-3:\nThe total daily demand for product A is at least 50 units, for product B is at least 60 units, and for product C is at least 70 units.\n// A_Line1 + A_Line2 >= 50\n// B_Line1 + B_Line2 >= 60\n// C_Line1 + C_Line2 >= 70\n\n## Generate Constraint-4:\nThe total cost of production on both lines should not exceed $5000 per day.\n// 20 * (A_Line1 + B_Line1 + C_Line1) + 30 * (A_Line2 + B_Line2 + C_Line2) <= 5000",
        "question": "A manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The goal is to optimize the production schedule to maximize profit while adhering to certain operational constraints. The profit per unit, cost of production on each line, and daily demand for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost on Line 1 | Cost on Line 2 | Daily Demand |\n|---------|-----------------|----------------|----------------|--------------|\n| A       | $50             | $20            | $30            | 50 units     |\n| B       | $70             | $20            | $30            | 60 units     |\n| C       | $60             | $20            | $30            | 70 units     |\n\nThe total production capacity of line 1 is 100 units per day, and line 2 is 150 units per day. The total daily demand for product A is at least 50 units, for product B is at least 60 units, and for product C is at least 70 units. The total cost of production on both lines should not exceed $5000 per day.\n\nPlease help the manufacturer to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_Line1 = model.addVar(vtype=\"INTEGER\", name=\"A_Line1\", lb=0) # number of units of product A on line 1\nA_Line2 = model.addVar(vtype=\"INTEGER\", name=\"A_Line2\", lb=0) # number of units of product A on line 2\nB_Line1 = model.addVar(vtype=\"INTEGER\", name=\"B_Line1\", lb=0) # number of units of product B on line 1\nB_Line2 = model.addVar(vtype=\"INTEGER\", name=\"B_Line2\", lb=0) # number of units of product B on line 2\nC_Line1 = model.addVar(vtype=\"INTEGER\", name=\"C_Line1\", lb=0) # number of units of product C on line 1\nC_Line2 = model.addVar(vtype=\"INTEGER\", name=\"C_Line2\", lb=0) # number of units of product C on line 2\n\n# Define objective function\nProfit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\nProfit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\nProfit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of line 1 is 100 units per day.\nmodel.addCons(A_Line1 + B_Line1 + C_Line1 <= 100)\n# The total production capacity of line 2 is 150 units per day.\nmodel.addCons(A_Line2 + B_Line2 + C_Line2 <= 150)\n# The total daily demand for product A is at least 50 units, for product B is at least 60 units, and for product C is at least 70 units.\nmodel.addCons(A_Line1 + A_Line2 >= 50)\nmodel.addCons(B_Line1 + B_Line2 >= 60)\nmodel.addCons(C_Line1 + C_Line2 >= 70)\n# The total cost of production on both lines should not exceed $5000 per day.\nmodel.addCons(20 * (A_Line1 + B_Line1 + C_Line1) + 30 * (A_Line2 + B_Line2 + C_Line2) <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A on Line 1: \", model.getVal(A_Line1))\n    print(\"Number of Product A on Line 2: \", model.getVal(A_Line2))\n    print(\"Number of Product B on Line 1: \", model.getVal(B_Line1))\n    print(\"Number of Product B on Line 2: \", model.getVal(B_Line2))\n    print(\"Number of Product C on Line 1: \", model.getVal(C_Line1))\n    print(\"Number of Product C on Line 2: \", model.getVal(C_Line2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company has a maximum operational capacity of 100 trips in total.\n// V1 + V2 + V3 <= 100\n\n## Generate Constraint-4:\nThe market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\n// V1 <= 30",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company has a limited fuel budget of 500 liters and a budget of $10,000 for operational costs. The company has a maximum operational capacity of 100 trips in total. The market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\nPlease help the company to maximize the profit efficiency (profit per liter of fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n## The company has a maximum operational capacity of 100 trips in total.\nmodel.addCons(V1 + V2 + V3 <= 100)\n## The market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\nmodel.addCons(V1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 trips: \", model.getVal(V1))\n    print(\"Number of V2 trips: \", model.getVal(V2))\n    print(\"Number of V3 trips: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $20,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 20000\n\n## Generate Constraint-4:\nThe company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n// QuantityA >= 2000; QuantityB >= 3000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process for each product, and the marketing budget for each product. The level of automation affects the production cost per unit and the production rate, while the marketing budget influences the sales rate. The production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n\nThe total production capacity of the company is 10,000 units. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $20,000. The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $20,000.\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 20000)\n# The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\nmodel.addCons(QuantityA >= 2000)\nmodel.addCons(QuantityB >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation Level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation Level for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The profit per acre and the risk of crop failure for each crop are given in the following Table.\n\n| Crop      | Profit per Acre | Risk of Crop Failure |\n|-----------|-----------------|----------------------|\n| Corn      | $200            | 5%                   |\n| Wheat     | $180            | 3%                   |\n| Soybeans  | $220            | 4%                   |\n| Barley    | $150            | 6%                   |\n| Oats      | $160            | 2%                   |\n\nThe farmer wants to maximize his Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk. The farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. Please help the farmer determine the optimal allocation of acres to each crop to maximize the Profit-Risk ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n## Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\n// {\"number of trucks for G1\": \"TruckG1\", \"range\": \"TruckG1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G2\": \"TruckG2\", \"range\": \"TruckG2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G3\": \"TruckG3\", \"range\": \"TruckG3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G4\": \"TruckG4\", \"range\": \"TruckG4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G5\": \"TruckG5\", \"range\": \"TruckG5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n// Net profit for G1: Profit_G1 = (5000 - 1000 - 500) * TruckG1\n// Net profit for G2: Profit_G2 = (7000 - 1500 - 700) * TruckG2\n// Net profit for G3: Profit_G3 = (9000 - 2000 - 900) * TruckG3\n// Net profit for G4: Profit_G4 = (6000 - 1200 - 600) * TruckG4\n// Net profit for G5: Profit_G5 = (8000 - 1800 - 800) * TruckG5\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / (TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50\n\n## Generate Constraint-2:\nDue to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\n// TruckG3 <= TruckG1 + TruckG2\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs for the month.\n// 1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of good has at least one truck allocated.\n// TruckG1 >= 1; TruckG2 >= 1; TruckG3 >= 1; TruckG4 >= 1; TruckG5 >= 1\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\n// TruckG4 <= 2 * TruckG1",
        "question": "A logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month. The revenue, fuel cost, and maintenance cost per truck for each type of good are given in the following Table.\n\n| Good | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------|-------------------|---------------------|----------------------------|\n| G1   | $5000             | $1000               | $500                       |\n| G2   | $7000             | $1500               | $700                       |\n| G3   | $9000             | $2000               | $900                       |\n| G4   | $6000             | $1200               | $600                       |\n| G5   | $8000             | $1800               | $800                       |\n\nThe company has a total of 50 trucks available for the month. Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2. The company has a budget of $50,000 for fuel costs for the month. The company wants to ensure that each type of good has at least one truck allocated. The company also wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\n\nPlease help the company to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckG1 = model.addVar(vtype=\"INTEGER\", name=\"TruckG1\", lb=1)  # number of trucks for G1\nTruckG2 = model.addVar(vtype=\"INTEGER\", name=\"TruckG2\", lb=1)  # number of trucks for G2\nTruckG3 = model.addVar(vtype=\"INTEGER\", name=\"TruckG3\", lb=1)  # number of trucks for G3\nTruckG4 = model.addVar(vtype=\"INTEGER\", name=\"TruckG4\", lb=1)  # number of trucks for G4\nTruckG5 = model.addVar(vtype=\"INTEGER\", name=\"TruckG5\", lb=1)  # number of trucks for G5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = (5000 - 1000 - 500) * TruckG1\nProfit_G2 = (7000 - 1500 - 700) * TruckG2\nProfit_G3 = (9000 - 2000 - 900) * TruckG3\nProfit_G4 = (6000 - 1200 - 600) * TruckG4\nProfit_G5 = (8000 - 1800 - 800) * TruckG5\nTotalTrucks = TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50)\n## Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\nmodel.addCons(TruckG3 <= TruckG1 + TruckG2)\n## The company has a budget of $50,000 for fuel costs for the month.\nmodel.addCons(1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50000)\n## The company wants to ensure that each type of good has at least one truck allocated.\nmodel.addCons(TruckG1 >= 1)\nmodel.addCons(TruckG2 >= 1)\nmodel.addCons(TruckG3 >= 1)\nmodel.addCons(TruckG4 >= 1)\nmodel.addCons(TruckG5 >= 1)\n## The company wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\nmodel.addCons(TruckG4 <= 2 * TruckG1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for G1: \", model.getVal(TruckG1))\n    print(\"Number of Trucks for G2: \", model.getVal(TruckG2))\n    print(\"Number of Trucks for G3: \", model.getVal(TruckG3))\n    print(\"Number of Trucks for G4: \", model.getVal(TruckG4))\n    print(\"Number of Trucks for G5: \", model.getVal(TruckG5))\n    print(\"Maximized Average Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1549,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company wants to maximize its total profit.\n// ProfitA = (100 - 50) * (100 - 0.1 * UnitsA^2) * UnitsA\n// ProfitB = (120 - 70) * (150 - 0.2 * UnitsB^2) * UnitsB\n// ProfitC = (110 - 60) * (120 - 0.15 * UnitsC^2) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB.\n// UnitsA <= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 60 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// UnitsA >= 1; UnitsB >= 1; UnitsC >= 1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company has a total production capacity of 1000 units per month. Due to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB. The company has a budget of $60,000 for production costs per month. The company wants to ensure that at least one unit of each product is produced to maintain market presence. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with quadratic demand\nProfitA = (100 - 50) * (100 - 0.1 * UnitsA**2) * UnitsA\nProfitB = (120 - 70) * (150 - 0.2 * UnitsB**2) * UnitsB\nProfitC = (110 - 60) * (120 - 0.15 * UnitsC**2) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n## Due to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB.\nmodel.addCons(UnitsA <= 2 * UnitsB)\n\n## The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 60 * UnitsC <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: Type1, Type2, and Type3. Additionally, the company is considering investing in advanced routing software to optimize fuel consumption and delivery times, which varies in effectiveness depending on the type of cargo.\n// {\"number of trucks for Type1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in routing software for Type1\": \"Software1\", \"range\": \"Software1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Type2\": \"Software2\", \"range\": \"Software2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Type3\": \"Software3\", \"range\": \"Software3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel efficiency of each type of truck improves with the investment in routing software, but the relationship is nonlinear. Specifically, for every $1000 invested in software, the fuel efficiency increases by 1% for Type1, 1.5% for Type2, and 2% for Type3. The initial fuel cost per mile for Type1 is $0.8, for Type2 is $0.7, and for Type3 is $0.6.\n// Fuel cost for Type1: Cost1 = 0.8 * (1 - 0.01 * Software1) * Trucks1\n// Fuel cost for Type2: Cost2 = 0.7 * (1 - 0.015 * Software2) * Trucks2\n// Fuel cost for Type3: Cost3 = 0.6 * (1 - 0.02 * Software3) * Trucks3\n// The cost of purchasing trucks is $100,000 per truck for all types.\n// So, the objective function is: Minimize (100000 * (Trucks1 + Trucks2 + Trucks3) + Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for both truck purchases and software investments.\n// 100000 * (Trucks1 + Trucks2 + Trucks3) + Software1 + Software2 + Software3 <= 5000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50 due to parking and maintenance limitations.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: Type1, Type2, and Type3. Additionally, the company is considering investing in advanced routing software to optimize fuel consumption and delivery times, which varies in effectiveness depending on the type of cargo. The company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel efficiency of each type of truck improves with the investment in routing software, but the relationship is nonlinear. Specifically, for every $1000 invested in software, the fuel efficiency increases by 1% for Type1, 1.5% for Type2, and 2% for Type3. The initial fuel cost per mile for Type1 is $0.8, for Type2 is $0.7, and for Type3 is $0.6. The cost of purchasing trucks is $100,000 per truck for all types.\n\n| Cargo Type | Initial Fuel Cost per Mile | Fuel Efficiency Improvement per $1000 Software Investment |\n|------------|----------------------------|----------------------------------------------------------|\n| Type1      | $0.8                       | 1%                                                       |\n| Type2      | $0.7                       | 1.5%                                                     |\n| Type3      | $0.6                       | 2%                                                       |\n\nThe company has a budget of $5,000,000 for both truck purchases and software investments. The total number of trucks cannot exceed 50 due to parking and maintenance limitations.\n\nPlease help the company to determine the optimal number of trucks and the investment in routing software for each type of cargo to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Type1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Type2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Type3\nSoftware1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software1\", lb=0) # investment in routing software for Type1\nSoftware2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software2\", lb=0) # investment in routing software for Type2\nSoftware3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software3\", lb=0) # investment in routing software for Type3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost calculations\nCost1 = 0.8 * (1 - 0.01 * Software1) * Trucks1\nCost2 = 0.7 * (1 - 0.015 * Software2) * Trucks2\nCost3 = 0.6 * (1 - 0.02 * Software3) * Trucks3\n## The cost of purchasing trucks is $100,000 per truck for all types.\nTruckCost = 100000 * (Trucks1 + Trucks2 + Trucks3)\n## the objective function is: Minimize (TruckCost + Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == TruckCost + Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $5,000,000 for both truck purchases and software investments.\nmodel.addCons(TruckCost + Software1 + Software2 + Software3 <= 5000000)\n## The total number of trucks cannot exceed 50 due to parking and maintenance limitations.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Type1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Type2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Type3: \", model.getVal(Trucks3))\n    print(\"Investment in Software for Type1: \", model.getVal(Software1))\n    print(\"Investment in Software for Type2: \", model.getVal(Software2))\n    print(\"Investment in Software for Type3: \", model.getVal(Software3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1791,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy vehicles\": \"Heavy\", \"range\": \"Heavy >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized vehicles\": \"Specialized\", \"range\": \"Specialized >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for Small vehicles is $100, for Medium vehicles is $200, for Large vehicles is $300, for Heavy vehicles is $400, and for Specialized vehicles is $500. The company wants to minimize the total operational cost while ensuring the fleet can handle the required cargo volume.\n// Total operational cost: Cost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\n// The company also wants to consider the environmental impact, which is modeled as a quadratic function of the total operational cost: Environmental Impact = (Cost)^2\n// So, the objective function is: Minimize Environmental Impact + Cost\n\n## Generate Constraint-1:\nThe total cargo volume that needs to be transported is 10,000 cubic meters. Each Small vehicle can carry 100 cubic meters, each Medium vehicle can carry 200 cubic meters, each Large vehicle can carry 300 cubic meters, each Heavy vehicle can carry 400 cubic meters, and each Specialized vehicle can carry 500 cubic meters.\n// 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $15,000 per day for the total operational cost.\n// 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized <= 15000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. The maximum number of Small vehicles is 50, Medium vehicles is 40, Large vehicles is 30, Heavy vehicles is 20, and Specialized vehicles is 10.\n// Small <= 50; Medium <= 40; Large <= 30; Heavy <= 20; Specialized <= 10",
        "question": "A logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities. The company needs to determine the optimal number of each type of vehicle to deploy. The operational cost per day and cargo capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Cargo Capacity |\n|--------------|-------------------------|----------------|\n| Small        | $100                    | 100 cubic meters |\n| Medium       | $200                    | 200 cubic meters |\n| Large        | $300                    | 300 cubic meters |\n| Heavy        | $400                    | 400 cubic meters |\n| Specialized  | $500                    | 500 cubic meters |\n\nThe total cargo volume that needs to be transported is 10,000 cubic meters. The company has a budget constraint of $15,000 per day for the total operational cost. The company also has a limit on the number of vehicles it can deploy: the maximum number of Small vehicles is 50, Medium vehicles is 40, Large vehicles is 30, Heavy vehicles is 20, and Specialized vehicles is 10.\n\nThe company wants to minimize the total operational cost while considering the environmental impact, which is modeled as a quadratic function of the total operational cost: Environmental Impact = (Cost)^2. Please help the company to minimize the sum of the Environmental Impact and the Total Operational Cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of Large vehicles\nHeavy = model.addVar(vtype=\"INTEGER\", name=\"Heavy\", lb=0)  # number of Heavy vehicles\nSpecialized = model.addVar(vtype=\"INTEGER\", name=\"Specialized\", lb=0)  # number of Specialized vehicles\n\n# Define objective function\nCost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\nEnvironmentalImpact = Cost**2\n# So, the objective function is: Minimize Environmental Impact + Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == EnvironmentalImpact + Cost)\n\n# Add constraints\n# The total cargo volume that needs to be transported is 10,000 cubic meters.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000)\n# The company has a budget constraint of $15,000 per day for the total operational cost.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized <= 15000)\n# The company has a limit on the number of vehicles it can deploy.\nmodel.addCons(Small <= 50)\nmodel.addCons(Medium <= 40)\nmodel.addCons(Large <= 30)\nmodel.addCons(Heavy <= 20)\nmodel.addCons(Specialized <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Heavy vehicles: \", model.getVal(Heavy))\n    print(\"Number of Specialized vehicles: \", model.getVal(Specialized))\n    print(\"Minimized Total Cost and Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1511,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company produces 3 types of widgets on the 5 machines. \nOn machine 1, each worker produces 10 units of widget 1, 15 units of widget 2, and 20 units of widget 3 per hour. \nOn machine 2, each worker produces 20 units of widget 1, 25 units of widget 2, and 30 units of widget 3 per hour. \nOn machine 3, each worker produces 30 units of widget 1, 35 units of widget 2, and 40 units of widget 3 per hour. \nOn machine 4, each worker produces 40 units of widget 1, 45 units of widget 2, and 50 units of widget 3 per hour. \nOn machine 5, each worker produces 50 units of widget 1, 55 units of widget 2, and 60 units of widget 3 per hour. \nThe company needs to produce at least 300 units of widget 1, at least 400 units of widget 2, and at least 500 units of widget 3. The five machines can only be opened or closed at the same time. Please determine the minimum production time to meet the daily demand.\n// The production time for widget 1: T1 = 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5)\n// The production time for widget 2: T2 = 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5)\n// The production time for widget 3: T3 = 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5)\n// So, the objective function is: Minimize max(T1, T2, T3)\n// Minimize max(300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5), 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5), 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5))\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 60",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency. The production rates for each worker on each machine are given in the following Table.\n\n| Machine | Widget 1 Units/Hour | Widget 2 Units/Hour | Widget 3 Units/Hour |\n|---------|---------------------|---------------------|---------------------|\n| 1       | 10                  | 15                  | 20                  |\n| 2       | 20                  | 25                  | 30                  |\n| 3       | 30                  | 35                  | 40                  |\n| 4       | 40                  | 45                  | 50                  |\n| 5       | 50                  | 55                  | 60                  |\n\nThe company needs to produce at least 300 units of widget 1, at least 400 units of widget 2, and at least 500 units of widget 3. The five machines can only be opened or closed at the same time. There are total 60 workers available. Please help the company determine the minimum production time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for widget 1: T1 = 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5)\n## The production time for widget 2: T2 = 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5)\n## The production time for widget 3: T3 = 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 == 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5))\nmodel.addCons(T2 == 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5))\nmodel.addCons(T3 == 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5))\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production while considering the varying efficiency of each plant based on weather conditions and maintenance schedules. Additionally, the company needs to decide on the investment in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"investment in upgrading Solar plant efficiency\": \"InvestmentSolar\", \"range\": \"InvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in upgrading Wind plant efficiency\": \"InvestmentWind\", \"range\": \"InvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in upgrading Hydro plant efficiency\": \"InvestmentHydro\", \"range\": \"InvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant is affected by the investment in upgrading its efficiency. The Solar plant initially produces 100 kWh per hour, but with upgrades, it increases by 5 kWh per hour for every $1000 invested. The Wind plant initially produces 120 kWh per hour, increasing by 6 kWh per hour for every $1000 invested. The Hydro plant initially produces 150 kWh per hour, increasing by 7.5 kWh per hour for every $1000 invested. The company aims to maximize the total daily energy production.\n// Total energy from Solar: EnergySolar = (100 + 0.005 * InvestmentSolar) * HoursSolar\n// Total energy from Wind: EnergyWind = (120 + 0.006 * InvestmentWind) * HoursWind\n// Total energy from Hydro: EnergyHydro = (150 + 0.0075 * InvestmentHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational hours and efficiency upgrades.\n// 1000 * (InvestmentSolar + InvestmentWind + InvestmentHydro) + 24 * (HoursSolar + HoursWind + HoursHydro) <= 100000\n\n## Generate Constraint-2:\nDue to maintenance schedules, the total operational hours for all plants cannot exceed 24 hours per day.\n// HoursSolar + HoursWind + HoursHydro <= 24\n\n## Generate Constraint-3:\nThe Solar plant must operate at least 2 hours per day, and the Wind plant must operate at least 3 hours per day.\n// HoursSolar >= 2; HoursWind >= 3",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in upgrading the efficiency of each plant to maximize energy production. The initial energy output per hour and the effect of investment on efficiency for each plant are given in the following Table.\n\n| Plant Type | Initial Energy Output per Hour | Increase in Energy Output per $1000 Investment |\n|------------|--------------------------------|----------------------------------------------|\n| Solar      | 100 kWh                        | 5 kWh                                        |\n| Wind       | 120 kWh                        | 6 kWh                                        |\n| Hydro      | 150 kWh                        | 7.5 kWh                                      |\n\nThe company has a total budget of $100,000 for operational hours and efficiency upgrades. Due to maintenance schedules, the total operational hours for all plants cannot exceed 24 hours per day. The Solar plant must operate at least 2 hours per day, and the Wind plant must operate at least 3 hours per day.\n\nPlease help the company to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSolar\", lb=0)  # investment in upgrading Solar plant efficiency\nInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentWind\", lb=0)  # investment in upgrading Wind plant efficiency\nInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentHydro\", lb=0)  # investment in upgrading Hydro plant efficiency\n\n# Set lower bounds for operational hours\nmodel.addCons(HoursSolar >= 2)\nmodel.addCons(HoursWind >= 3)\n\n# Define objective function\nEnergySolar = (100 + 0.005 * InvestmentSolar) * HoursSolar\nEnergyWind = (120 + 0.006 * InvestmentWind) * HoursWind\nEnergyHydro = (150 + 0.0075 * InvestmentHydro) * HoursHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(1000 * (InvestmentSolar + InvestmentWind + InvestmentHydro) + 24 * (HoursSolar + HoursWind + HoursHydro) <= 100000)\nmodel.addCons(HoursSolar + HoursWind + HoursHydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(HoursSolar))\n    print(\"Number of hours Wind plant operates: \", model.getVal(HoursWind))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HoursHydro))\n    print(\"Investment in upgrading Solar plant efficiency: \", model.getVal(InvestmentSolar))\n    print(\"Investment in upgrading Wind plant efficiency: \", model.getVal(InvestmentWind))\n    print(\"Investment in upgrading Hydro plant efficiency: \", model.getVal(InvestmentHydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Solar1, the cost per unit is $1000, the energy output is 100 kWh, and the maintenance cost is $50 per year.\nFor Solar2, the cost per unit is $1200, the energy output is 120 kWh, and the maintenance cost is $60 per year.\nFor Solar3, the cost per unit is $1500, the energy output is 150 kWh, and the maintenance cost is $75 per year.\nFor Solar4, the cost per unit is $1800, the energy output is 180 kWh, and the maintenance cost is $90 per year.\nFor Solar5, the cost per unit is $2000, the energy output is 200 kWh, and the maintenance cost is $100 per year.\nFor Wind1, the cost per unit is $2500, the energy output is 250 kWh, and the maintenance cost is $125 per year.\nFor Wind2, the cost per unit is $3000, the energy output is 300 kWh, and the maintenance cost is $150 per year.\nFor Wind3, the cost per unit is $3500, the energy output is 350 kWh, and the maintenance cost is $175 per year.\nThe company wants to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output.\n// Initial Investment Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\n// Annual Maintenance Cost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\n// Total Energy Output = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n// So, the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3 <= 100000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3)\n\n## Generate Constraint-3:\nThe company wants to generate at least 10,000 kWh of energy.\n// 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3 >= 10000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\nFor Solar1, the cost per unit is $1000, the energy output is 100 kWh, and the maintenance cost is $50 per year.\nFor Solar2, the cost per unit is $1200, the energy output is 120 kWh, and the maintenance cost is $60 per year.\nFor Solar3, the cost per unit is $1500, the energy output is 150 kWh, and the maintenance cost is $75 per year.\nFor Solar4, the cost per unit is $1800, the energy output is 180 kWh, and the maintenance cost is $90 per year.\nFor Solar5, the cost per unit is $2000, the energy output is 200 kWh, and the maintenance cost is $100 per year.\nFor Wind1, the cost per unit is $2500, the energy output is 250 kWh, and the maintenance cost is $125 per year.\nFor Wind2, the cost per unit is $3000, the energy output is 300 kWh, and the maintenance cost is $150 per year.\nFor Wind3, the cost per unit is $3500, the energy output is 350 kWh, and the maintenance cost is $175 per year.\nThe company has a budget of $100,000 for the initial investment. The company wants to ensure that at least 50% of the budget is spent on solar panels. The company wants to generate at least 10,000 kWh of energy.\nPlease help the company to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialInvestmentCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\nAnnualMaintenanceCost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\nTotalEnergyOutput = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n## the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n## convert the division to multiplication\nmodel.addCons(obj * TotalEnergyOutput == InitialInvestmentCost + AnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for the initial investment.\nmodel.addCons(InitialInvestmentCost <= 100000)\n## The company wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (InitialInvestmentCost))\n## The company wants to generate at least 10,000 kWh of energy.\nmodel.addCons(TotalEnergyOutput >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Minimized TCO: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1561,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons.\n// The total cost function is: 50S + 70M + 90L + 110XL + 130R\n// The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\n// The objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for operational costs.\n// 50S + 70M + 90L + 110XL + 130R <= 5000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can operate. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10.\n// S <= 30; M <= 25; L <= 20; XL <= 15; R <= 10\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements.\n// 0.2 * (10S + 20M + 30L + 40XL + 25R) <= 25R",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons. The company has a budget of $5000 per day for operational costs. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10. The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements. Please help the company to minimize the total daily operational cost while meeting all constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=30) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=25) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=20) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0, ub=15) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=10) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost function is: 50S + 70M + 90L + 110XL + 130R\nmodel.addCons(obj == 50*S + 70*M + 90*L + 110*XL + 130*R)\n\n# Add constraints\n## The company has a budget of $5000 per day for operational costs.\nmodel.addCons(50*S + 70*M + 90*L + 110*XL + 130*R <= 5000)\n## The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\nmodel.addCons(10*S + 20*M + 30*L + 40*XL + 25*R >= 1000)\n## The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements.\nmodel.addCons(0.2 * (10*S + 20*M + 30*L + 40*XL + 25*R) <= 25*R)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region and the number of trips each truck should make per day. The company also needs to consider the fuel efficiency of each type of truck and the distance each truck travels per trip.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A (km/liter)\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B (km/liter)\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"distance per trip for Region A (km)\": \"DistanceA\", \"range\": \"DistanceA > 0\", \"type\": \"real\"}\n// {\"distance per trip for Region B (km)\": \"DistanceB\", \"range\": \"DistanceB > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel cost, considering the fuel price per liter and the total fuel consumption per day.\n// TotalFuelConsumptionA = TrucksA * TripsA * DistanceA / FuelEffA\n// TotalFuelConsumptionB = TrucksB * TripsB * DistanceB / FuelEffB\n// TotalFuelCost = FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB)\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for daily fuel expenses.\n// FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB) <= 1000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 20 trucks in total.\n// TrucksA + TrucksB <= 20",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region and the number of trips each truck should make per day. The company also needs to consider the fuel efficiency of each type of truck and the distance each truck travels per trip. The company aims to minimize the total daily fuel cost, considering the fuel price per liter and the total fuel consumption per day. The company has a total budget of $1000 for daily fuel expenses. The company can only operate a maximum of 20 trucks in total.\n\nPlease help the company to determine the optimal number of trucks and trips per truck for each region to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Region B\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips per truck for Region A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips per truck for Region B\n\n# Define objective function\nFuelPrice = 1.5  # assume fuel price per liter\nFuelEffA = 5  # fuel efficiency of trucks for Region A (km/liter)\nFuelEffB = 6  # fuel efficiency of trucks for Region B (km/liter)\nDistanceA = 100  # distance per trip for Region A (km)\nDistanceB = 120  # distance per trip for Region B (km)\n\nTotalFuelConsumptionA = TrucksA * TripsA * DistanceA / FuelEffA\nTotalFuelConsumptionB = TrucksB * TripsB * DistanceB / FuelEffB\nTotalFuelCost = FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n# The company has a total budget of $1000 for daily fuel expenses.\nmodel.addCons(FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB) <= 1000)\n# The company can only operate a maximum of 20 trucks in total.\nmodel.addCons(TrucksA + TrucksB <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trips per Truck for Region A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Region B: \", model.getVal(TripsB))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in research and development (R&D) for each type of plant to enhance their efficiency.\n// {\"operating hours for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for Solar plant\": \"RnD_Solar\", \"range\": \"RnD_Solar >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Wind plant\": \"RnD_Wind\", \"range\": \"RnD_Wind >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Hydro plant\": \"RnD_Hydro\", \"range\": \"RnD_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants.\n// Energy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\n// Energy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\n// Energy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200.\n// 100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants combined cannot exceed 24 hours per day.\n// Hours_Solar + Hours_Wind + Hours_Hydro <= 24\n\n## Generate Constraint-3:\nDue to maintenance requirements, each plant must operate at least 2 hours per day.\n// Hours_Solar >= 2; Hours_Wind >= 2; Hours_Hydro >= 2\n\n## Generate Constraint-4:\nThe company has a policy to invest at least $5000 in R&D for each type of plant.\n// RnD_Solar >= 5000; RnD_Wind >= 5000; RnD_Hydro >= 5000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in research and development (R&D) for each type of plant to enhance their efficiency. The efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants.\n\n| Plant Type | Initial Output (MWh/hour) | Operating Cost per Hour ($) |\n|------------|---------------------------|-----------------------------|\n| Solar      | 5                         | 100                         |\n| Wind       | 6                         | 150                         |\n| Hydro      | 8                         | 200                         |\n\nThe company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200. The total operating hours for all plants combined cannot exceed 24 hours per day. Due to maintenance requirements, each plant must operate at least 2 hours per day. The company has a policy to invest at least $5000 in R&D for each type of plant.\n\nPlease help the company to maximize the total daily energy output from all plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=2)  # operating hours for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=2)  # operating hours for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=2)  # operating hours for Hydro plant\nRnD_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Solar\", lb=5000)  # R&D investment for Solar plant\nRnD_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Wind\", lb=5000)  # R&D investment for Wind plant\nRnD_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Hydro\", lb=5000)  # R&D investment for Hydro plant\n\n# Define objective function\nEnergy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\nEnergy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\nEnergy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n# So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for operating costs and R&D investments.\nmodel.addCons(100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000)\n# The total operating hours for all plants combined cannot exceed 24 hours per day.\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for Solar Plant: \", model.getVal(Hours_Solar))\n    print(\"Operating Hours for Wind Plant: \", model.getVal(Hours_Wind))\n    print(\"Operating Hours for Hydro Plant: \", model.getVal(Hours_Hydro))\n    print(\"R&D Investment for Solar Plant: \", model.getVal(RnD_Solar))\n    print(\"R&D Investment for Wind Plant: \", model.getVal(RnD_Wind))\n    print(\"R&D Investment for Hydro Plant: \", model.getVal(RnD_Hydro))\n    print(\"Total Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1471,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and labor. Additionally, the company is considering investing in automation technology to reduce labor costs, which will decrease labor costs linearly with the investment amount.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials per unit is $20 for all products. Labor cost per unit decreases by $1 for every $10,000 invested in automation. The initial labor cost per unit is $30 for ProductA, $40 for ProductB, and $50 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 20 - (30 - 0.0001 * Automation)) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 20 - (40 - 0.0001 * Automation)) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 20 - (50 - 0.0001 * Automation)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe company has a total production capacity of 10,000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and labor. Additionally, the company is considering investing in automation technology to reduce labor costs, which will decrease labor costs linearly with the investment amount. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials per unit is $20 for all products. Labor cost per unit decreases by $1 for every $10,000 invested in automation. The initial labor cost per unit is $30 for ProductA, $40 for ProductB, and $50 for ProductC. The total investment in automation technology cannot exceed $50,000. The company has a total production capacity of 10,000 units across all products. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfitA = (100 - 20 - (30 - 0.0001 * Automation)) * QuantityA\nProfitB = (150 - 20 - (40 - 0.0001 * Automation)) * QuantityB\nProfitC = (200 - 20 - (50 - 0.0001 * Automation)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling these products.\n// Profit = 50A + 70B + 60C\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a total production capacity of 100 units per day. The market demand for product A is at least 20 units per day. \n\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n# The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 653,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes.\n// Cost per hour for route A: Cost_A = 100 / 5 * A\n// Cost per hour for route B: Cost_B = 120 / 6 * B\n// Cost per hour for route C: Cost_C = 150 / 7 * C\n// Cost per hour for route D: Cost_D = 180 / 8 * D\n// Cost per hour for route E: Cost_E = 200 / 9 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operational costs.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes. The company has a total budget of $10,000 for operational costs. The company has a maximum of 50 trucks available. Each route must have at least 2 trucks. Please help the company determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 / 5) * A\nCost_B = (120 / 6) * B\nCost_C = (150 / 7) * C\nCost_D = (180 / 8) * D\nCost_E = (200 / 9) * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 for operational costs.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000)\n## The company has a maximum of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. Additionally, the company needs to decide on the investment in renewable energy sources to reduce the carbon footprint of each truck.\n// {\"fuel consumption of Truck1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck1\": \"Renewable1\", \"range\": \"Renewable1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck2\": \"Renewable2\", \"range\": \"Renewable2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck3\": \"Renewable3\", \"range\": \"Renewable3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in renewable energy sources. For every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n// Fuel consumption for Truck1: Fuel1 = 100 - 0.01 * Renewable1\n// Fuel consumption for Truck2: Fuel2 = 100 - 0.01 * Renewable2\n// Fuel consumption for Truck3: Fuel3 = 100 - 0.01 * Renewable3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and renewable energy investments.\n// Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000\n\n## Generate Constraint-2:\nThe total distance each truck can travel is limited to 5000 km.\n// Fuel1 * 50 + Fuel2 * 50 + Fuel3 * 50 <= 5000\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must ensure that at least 20% of the total fuel consumption is offset by renewable energy investments.\n// 0.2 * (Fuel1 + Fuel2 + Fuel3) <= Renewable1 + Renewable2 + Renewable3\n\n## Generate Constraint-4:\nEach truck must have a minimum fuel consumption of 50 liters per 100 km to ensure operational reliability.\n// Fuel1 >= 50; Fuel2 >= 50; Fuel3 >= 50",
        "question": "A logistics company operates a fleet of three trucks (Truck1, Truck2, Truck3) and needs to optimize the fuel consumption and route selection for each truck. The company also needs to decide on the investment in renewable energy sources to reduce the carbon footprint of each truck. The relationship between investment in renewable energy and fuel consumption is such that for every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n\n| Truck | Initial Fuel Consumption (liters/100km) |\n|-------|-----------------------------------------|\n| 1     | 100                                     |\n| 2     | 100                                     |\n| 3     | 100                                     |\n\nThe company has a budget of $100,000 for fuel and renewable energy investments. The total distance each truck can travel is limited to 5000 km. Due to regulatory requirements, the company must ensure that at least 20% of the total fuel consumption is offset by renewable energy investments. Each truck must have a minimum fuel consumption of 50 liters per 100 km to ensure operational reliability.\n\nPlease help the company determine the optimal fuel consumption and investment in renewable energy for each truck to minimize the total fuel consumption while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=50)  # fuel consumption of Truck1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=50)  # fuel consumption of Truck2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=50)  # fuel consumption of Truck3\nRenewable1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable1\", lb=0)  # investment in renewable energy for Truck1\nRenewable2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable2\", lb=0)  # investment in renewable energy for Truck2\nRenewable3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable3\", lb=0)  # investment in renewable energy for Truck3\n\n# Define objective function\nFuel1 = 100 - 0.01 * Renewable1\nFuel2 = 100 - 0.01 * Renewable2\nFuel3 = 100 - 0.01 * Renewable3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000)  # budget constraint\nmodel.addCons(Fuel1 * 50 + Fuel2 * 50 + Fuel3 * 50 <= 5000)  # distance constraint\nmodel.addCons(0.2 * (Fuel1 + Fuel2 + Fuel3) <= Renewable1 + Renewable2 + Renewable3)  # regulatory constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(Fuel2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(Fuel3))\n    print(\"Investment in renewable energy for Truck1: \", model.getVal(Renewable1))\n    print(\"Investment in renewable energy for Truck2: \", model.getVal(Renewable2))\n    print(\"Investment in renewable energy for Truck3: \", model.getVal(Renewable3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1403,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n// Total net profit for RegionA: Profit_A = (100,000 - 50,000) * TrucksA\n// Total net profit for RegionB: Profit_B = (120,000 - 60,000) * TrucksB\n// Total net profit for RegionC: Profit_C = (140,000 - 70,000) * TrucksC\n// Total net profit for RegionD: Profit_D = (160,000 - 80,000) * TrucksD\n// Total net profit for RegionE: Profit_E = (180,000 - 90,000) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regional regulations, RegionA must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $2,000,000 for operating costs for the quarter.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,000,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs. The cost of operating a truck and the revenue generated per truck in each region are given in the following Table.\n\n| Region   | Operating Cost per Truck | Revenue per Truck |\n|----------|--------------------------|-------------------|\n| RegionA  | $50,000                   | $100,000          |\n| RegionB  | $60,000                   | $120,000          |\n| RegionC  | $70,000                   | $140,000          |\n| RegionD  | $80,000                   | $160,000          |\n| RegionE  | $90,000                   | $180,000          |\n\nThe company has a total of 40 trucks available for allocation. Due to regional regulations, RegionA must have at least 10% of the total trucks. The company has a budget of $2,000,000 for operating costs for the quarter. \n\nPlease help the company to maximize the net profit per truck, which is defined as the sum of the total net profit for each region divided by the total number of trucks allocated.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100000 - 50000) * TrucksA\nProfit_B = (120000 - 60000) * TrucksB\nProfit_C = (140000 - 70000) * TrucksC\nProfit_D = (160000 - 80000) * TrucksD\nProfit_E = (180000 - 90000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regional regulations, RegionA must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * TotalTrucks)\n## The company has a budget of $2,000,000 for operating costs for the quarter.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: solar, wind, and hydro. The company needs to determine the optimal number of each type of power plant to maximize energy production while minimizing environmental impact and cost.\n// {\"number of solar power plants\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind power plants\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro power plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production per solar plant is 100 MWh, with a maintenance cost of $5000 per plant. The energy production per wind plant is 150 MWh, with a maintenance cost of $7000 per plant. The energy production per hydro plant is 200 MWh, with a maintenance cost of $10000 per plant. The company aims to maximize the net energy production (total energy produced minus the cost of maintenance per MWh).\n// Energy_Solar = 100 * Solar - 5000 / Solar\n// Energy_Wind = 150 * Wind - 7000 / Wind\n// Energy_Hydro = 200 * Hydro - 10000 / Hydro\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for maintenance costs.\n// 5000 * Solar + 7000 * Wind + 10000 * Hydro <= 1000000\n\n## Generate Constraint-2:\nThe total energy production capacity should not exceed 10,000 MWh.\n// 100 * Solar + 150 * Wind + 200 * Hydro <= 10000\n\n## Generate Constraint-3:\nThe company has a limit of 50 power plants in total.\n// Solar + Wind + Hydro <= 50\n\n## Generate Constraint-4:\nThe environmental impact score (EIS) for each type of plant is 1 for solar, 2 for wind, and 3 for hydro. The total EIS should not exceed 100.\n// Solar + 2 * Wind + 3 * Hydro <= 100\n\n## Generate Constraint-5:\nThe market demand for solar energy requires at least 10 solar power plants.\n// Solar >= 10",
        "question": "A renewable energy company operates three types of power plants: solar, wind, and hydro. The company needs to determine the optimal number of each type of power plant to maximize energy production while minimizing environmental impact and cost. The energy production, maintenance cost, and environmental impact score (EIS) for each type of plant are given in the following Table.\n\n| Type       | Energy Production per Plant | Maintenance Cost per Plant | Environmental Impact Score (EIS) |\n|------------|-----------------------------|----------------------------|----------------------------------|\n| Solar      | 100 MWh                     | $5000                      | 1                                |\n| Wind       | 150 MWh                     | $7000                      | 2                                |\n| Hydro      | 200 MWh                     | $10000                     | 3                                |\n\nThe company has a budget of $1,000,000 for maintenance costs. The total energy production capacity should not exceed 10,000 MWh. The company has a limit of 50 power plants in total. The total EIS should not exceed 100. The market demand for solar energy requires at least 10 solar power plants.\n\nPlease help the company to maximize the net energy production (total energy produced minus the cost of maintenance per MWh).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=10) # number of solar power plants\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind power plants\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro power plants\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Solar = 100 * Solar - 5000 / Solar\nEnergy_Wind = 150 * Wind - 7000 / Wind\nEnergy_Hydro = 200 * Hydro - 10000 / Hydro\n## convert the division to multiplication\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n## The company has a budget of $1,000,000 for maintenance costs.\nmodel.addCons(5000 * Solar + 7000 * Wind + 10000 * Hydro <= 1000000)\n## The total energy production capacity should not exceed 10,000 MWh.\nmodel.addCons(100 * Solar + 150 * Wind + 200 * Hydro <= 10000)\n## The company has a limit of 50 power plants in total.\nmodel.addCons(Solar + Wind + Hydro <= 50)\n## The environmental impact score (EIS) for each type of plant is 1 for solar, 2 for wind, and 3 for hydro. The total EIS should not exceed 100.\nmodel.addCons(Solar + 2 * Wind + 3 * Hydro <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Power Plants: \", model.getVal(Solar))\n    print(\"Number of Wind Power Plants: \", model.getVal(Wind))\n    print(\"Number of Hydro Power Plants: \", model.getVal(Hydro))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency.\n// {\"number of goods shipped from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping goods from each warehouse varies with the volume of goods shipped. The cost function is nonlinear and is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.04 * W2^2\n- Cost from warehouse 3: C3 = 0.06 * W3^2\n- Cost from warehouse 4: C4 = 0.03 * W4^2\n- Cost from warehouse 5: C5 = 0.07 * W5^2\nThe company wants to minimize the total shipping cost.\n// The objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\n// Minimize TotalCost = 0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2\n\n## Generate Constraint-1:\nThe total number of goods that can be shipped from all warehouses is limited to 1000 units.\n// W1 + W2 + W3 + W4 + W5 <= 1000",
        "question": "A company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency. The cost of shipping goods from each warehouse varies with the volume of goods shipped. The cost function is nonlinear and is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.04 * W2^2\n- Cost from warehouse 3: C3 = 0.06 * W3^2\n- Cost from warehouse 4: C4 = 0.03 * W4^2\n- Cost from warehouse 5: C5 = 0.07 * W5^2\nThe company wants to minimize the total shipping cost. The total number of goods that can be shipped from all warehouses is limited to 1000 units.\nPlease help the company to determine the optimal number of goods to be shipped from each warehouse to minimize the total shipping cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of goods shipped from warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of goods shipped from warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of goods shipped from warehouse 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of goods shipped from warehouse 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of goods shipped from warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 0.05 * W1**2\nC2 = 0.04 * W2**2\nC3 = 0.06 * W3**2\nC4 = 0.03 * W4**2\nC5 = 0.07 * W5**2\n## the objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5)\n\n# Add constraints\n## The total number of goods that can be shipped from all warehouses is limited to 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of goods shipped from warehouse 1: \", model.getVal(W1))\n    print(\"Number of goods shipped from warehouse 2: \", model.getVal(W2))\n    print(\"Number of goods shipped from warehouse 3: \", model.getVal(W3))\n    print(\"Number of goods shipped from warehouse 4: \", model.getVal(W4))\n    print(\"Number of goods shipped from warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $2000 per month, and the machine cost per machine is $3000 per month. The company wants to maximize the total monthly profit.\n// Profit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\n// Profit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\n// Profit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product. The profit per unit, labor cost per worker, and machine cost per machine for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker | Machine Cost per Machine |\n|---------|-----------------|-----------------------|--------------------------|\n| ProductA | $50             | $2000                 | $3000                    |\n| ProductB | $70             | $2000                 | $3000                    |\n| ProductC | $60             | $2000                 | $3000                    |\n\nThe company has a total of 50 workers available. The company wants to maximize the total monthly profit. Please help the company determine the optimal production quantity, number of workers, and number of machines for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\n\n# Define objective function\nProfit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\nProfit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\nProfit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons and has a maintenance cost of $500 per month. Each Truck B can carry 15 tons and has a maintenance cost of $700 per month. Each Truck C can carry 20 tons and has a maintenance cost of $900 per month. Each Van D can carry 5 tons and has a maintenance cost of $300 per month. Each Van E can carry 8 tons and has a maintenance cost of $400 per month. The company aims to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost. The revenue from each ton of cargo is $100.\n// Revenue from Truck A: Revenue_A = 10 * A * 100\n// Revenue from Truck B: Revenue_B = 15 * B * 100\n// Revenue from Truck C: Revenue_C = 20 * C * 100\n// Revenue from Van D: Revenue_D = 5 * D * 100\n// Revenue from Van E: Revenue_E = 8 * E * 100\n// Maintenance cost of Truck A: Cost_A = 500 * A\n// Maintenance cost of Truck B: Cost_B = 700 * B\n// Maintenance cost of Truck C: Cost_C = 900 * C\n// Maintenance cost of Van D: Cost_D = 300 * D\n// Maintenance cost of Van E: Cost_E = 400 * E\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle maintenance for the month.\n// 500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of its fleet is composed of Van D and Van E combined.\n// D + E >= 0.1 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe total cargo capacity of the fleet should not exceed 1000 tons.\n// 10 * A + 15 * B + 20 * C + 5 * D + 8 * E <= 1000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations. The carrying capacity and monthly maintenance cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Carrying Capacity (tons) | Monthly Maintenance Cost |\n|--------------|--------------------------|--------------------------|\n| Truck A      | 10                       | $500                     |\n| Truck B      | 15                       | $700                     |\n| Truck C      | 20                       | $900                     |\n| Van D        | 5                        | $300                     |\n| Van E        | 8                        | $400                     |\n\nThe company has a total budget of $10,000 for vehicle maintenance for the month. The company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total. The company must ensure that at least 10% of its fleet is composed of Van D and Van E combined. The total cargo capacity of the fleet should not exceed 1000 tons. The company aims to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost. The revenue from each ton of cargo is $100.\n\nPlease help the company to determine the optimal number of each vehicle type to deploy to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Van E\n\n# Define objective function\nRevenue_A = 10 * A * 100\nRevenue_B = 15 * B * 100\nRevenue_C = 20 * C * 100\nRevenue_D = 5 * D * 100\nRevenue_E = 8 * E * 100\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\nCost_D = 300 * D\nCost_E = 400 * E\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle maintenance for the month.\nmodel.addCons(500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000)\n# The company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n# The company must ensure that at least 10% of its fleet is composed of Van D and Van E combined.\nmodel.addCons(D + E >= 0.1 * (A + B + C + D + E))\n# The total cargo capacity of the fleet should not exceed 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 5 * D + 8 * E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1465,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and wind turbines is 30%. The company aims to maximize the total energy output from all installations.\n// Total energy output from solar panels in RegionA: EnergySolarA = 0.2 * (1 + 0.01 * R&D / 10000) * SolarA\n// Total energy output from wind turbines in RegionA: EnergyWindA = 0.3 * (1 + 0.005 * R&D / 10000) * WindA\n// Total energy output from solar panels in RegionB: EnergySolarB = 0.2 * (1 + 0.01 * R&D / 10000) * SolarB\n// Total energy output from wind turbines in RegionB: EnergyWindB = 0.3 * (1 + 0.005 * R&D / 10000) * WindB\n// Total energy output from solar panels in RegionC: EnergySolarC = 0.2 * (1 + 0.01 * R&D / 10000) * SolarC\n// Total energy output from wind turbines in RegionC: EnergyWindC = 0.3 * (1 + 0.005 * R&D / 10000) * WindC\n// So, the objective function is: Maximize (EnergySolarA + EnergyWindA + EnergySolarB + EnergyWindB + EnergySolarC + EnergyWindC)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation and R&D.\n// 10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC + R&D <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines in each region must not exceed 100.\n// SolarA + WindA <= 100; SolarB + WindB <= 100; SolarC + WindC <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB.\n// SolarA >= 20; WindB >= 30",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies. The efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and wind turbines is 30%. The company aims to maximize the total energy output from all installations. The company has a budget of $500,000 for installation and R&D. The total number of solar panels and wind turbines in each region must not exceed 100. The company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB. Please help the company to maximize the total energy output from all installations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in RegionC\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R_D\", lb=0) # investment in R&D\n\n# Define objective function\nEnergySolarA = 0.2 * (1 + 0.01 * R_D / 10000) * SolarA\nEnergyWindA = 0.3 * (1 + 0.005 * R_D / 10000) * WindA\nEnergySolarB = 0.2 * (1 + 0.01 * R_D / 10000) * SolarB\nEnergyWindB = 0.3 * (1 + 0.005 * R_D / 10000) * WindB\nEnergySolarC = 0.2 * (1 + 0.01 * R_D / 10000) * SolarC\nEnergyWindC = 0.3 * (1 + 0.005 * R_D / 10000) * WindC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolarA + EnergyWindA + EnergySolarB + EnergyWindB + EnergySolarC + EnergyWindC)\n\n# Add constraints\nmodel.addCons(10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC + R_D <= 500000)\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 100)\nmodel.addCons(SolarC + WindC <= 100)\nmodel.addCons(SolarA >= 20)\nmodel.addCons(WindB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the amount of raw materials to be used for each product. The marketing budget affects the sales of each product, and the raw materials usage affects the production cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductA\": \"RawMaterialsA\", \"range\": \"RawMaterialsA >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductB\": \"RawMaterialsB\", \"range\": \"RawMaterialsB >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductC\": \"RawMaterialsC\", \"range\": \"RawMaterialsC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe sales of each product increase by 5% for every $1,000 spent on marketing for that product. The production cost decreases by $2 for every $100 increase in raw materials usage for that product. The initial sales for ProductA is $100 per unit, for ProductB is $150 per unit, and for ProductC is $200 per unit. The initial production cost for ProductA is $50 per unit, for ProductB is $75 per unit, and for ProductC is $100 per unit. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.05 * MarketingBudgetA / 1000) * QuantityA - (50 - 0.02 * RawMaterialsA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 + 0.05 * MarketingBudgetB / 1000) * QuantityB - (75 - 0.02 * RawMaterialsB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 + 0.05 * MarketingBudgetC / 1000) * QuantityC - (100 - 0.02 * RawMaterialsC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity cannot exceed 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000\n\n## Generate Constraint-3:\nThe total raw materials usage must not exceed 50,000 units.\n// RawMaterialsA + RawMaterialsB + RawMaterialsC <= 50000\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the amount of raw materials to be used for each product. The marketing budget affects the sales of each product, and the raw materials usage affects the production cost. The initial sales and production costs for each product are given in the following Table.\n\n| Product | Initial Sales per Unit | Initial Production Cost per Unit |\n|---------|------------------------|---------------------------------|\n| ProductA | $100                   | $50                             |\n| ProductB | $150                   | $75                             |\n| ProductC | $200                   | $100                            |\n\nThe sales of each product increase by 5% for every $1,000 spent on marketing for that product. The production cost decreases by $2 for every $100 increase in raw materials usage for that product. The company aims to maximize the total profit from all products. The total production quantity cannot exceed 10,000 units. The total marketing budget cannot exceed $100,000. The total raw materials usage must not exceed 50,000 units. The company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n\nPlease help the company to determine the optimal production quantity, marketing budget, and raw materials usage for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=2000)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nRawMaterialsA = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsA\", lb=0)  # raw materials usage for ProductA\nRawMaterialsB = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsB\", lb=0)  # raw materials usage for ProductB\nRawMaterialsC = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsC\", lb=0)  # raw materials usage for ProductC\n\n# Define objective function\nProfitA = (100 + 0.05 * MarketingBudgetA / 1000) * QuantityA - (50 - 0.02 * RawMaterialsA / 100) * QuantityA\nProfitB = (150 + 0.05 * MarketingBudgetB / 1000) * QuantityB - (75 - 0.02 * RawMaterialsB / 100) * QuantityB\nProfitC = (200 + 0.05 * MarketingBudgetC / 1000) * QuantityC - (100 - 0.02 * RawMaterialsC / 100) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\nmodel.addCons(RawMaterialsA + RawMaterialsB + RawMaterialsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Raw Materials Usage for ProductA: \", model.getVal(RawMaterialsA))\n    print(\"Raw Materials Usage for ProductB: \", model.getVal(RawMaterialsB))\n    print(\"Raw Materials Usage for ProductC: \", model.getVal(RawMaterialsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1501,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility.\n// {\"number of solar facilities\": \"SolarFacilities\", \"range\": \"SolarFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"WindFacilities\", \"range\": \"WindFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"HydroFacilities\", \"range\": \"HydroFacilities >= 0\", \"type\": \"integer\"}\n// {\"land required for each solar facility (in acres)\": \"LandPerSolarFacility\", \"range\": \"LandPerSolarFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each wind facility (in acres)\": \"LandPerWindFacility\", \"range\": \"LandPerWindFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each hydro facility (in acres)\": \"LandPerHydroFacility\", \"range\": \"LandPerHydroFacility >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to maximize the total annual energy output from these facilities. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe objective is to maximize the total energy output, which is a nonlinear function of the number of facilities and the land required.\n// TotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\n// So, the objective function is: Maximize TotalEnergyOutput\n\n## Generate Constraint-1:\nThe city has a total of 1000 acres of land available for these facilities.\n// SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000",
        "question": "A city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe city has a total of 1000 acres of land available for these facilities. The city wants to maximize the total annual energy output from these facilities. Please help the city to determine the optimal number of each type of facility to build and the amount of land required for each facility.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarFacilities = model.addVar(vtype=\"INTEGER\", name=\"SolarFacilities\", lb=0)\nWindFacilities = model.addVar(vtype=\"INTEGER\", name=\"WindFacilities\", lb=0)\nHydroFacilities = model.addVar(vtype=\"INTEGER\", name=\"HydroFacilities\", lb=0)\nLandPerSolarFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerSolarFacility\", lb=0)\nLandPerWindFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerWindFacility\", lb=0)\nLandPerHydroFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerHydroFacility\", lb=0)\n\n# Define objective function\nTotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalEnergyOutput)\n\n# Add constraints\nmodel.addCons(SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(SolarFacilities))\n    print(\"Number of Wind Facilities: \", model.getVal(WindFacilities))\n    print(\"Number of Hydro Facilities: \", model.getVal(HydroFacilities))\n    print(\"Land Required for Each Solar Facility: \", model.getVal(LandPerSolarFacility))\n    print(\"Land Required for Each Wind Facility: \", model.getVal(LandPerWindFacility))\n    print(\"Land Required for Each Hydro Facility: \", model.getVal(LandPerHydroFacility))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 678,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for furniture\": \"FurnitureSpeed\", \"range\": \"FurnitureSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Furniture = FurnitureTrucks * FurnitureSpeed^2\n// Fuel_Perishables = PerishablesTrucks * PerishablesSpeed^2\n// Time_Electronics = ElectronicsTrucks / ElectronicsSpeed\n// Time_Furniture = FurnitureTrucks / FurnitureSpeed\n// Time_Perishables = PerishablesTrucks / PerishablesSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 hours available for all trucks to be on the road per day.\n// Time_Electronics + Time_Furniture + Time_Perishables <= 50\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 20 trucks in total.\n// ElectronicsTrucks + FurnitureTrucks + PerishablesTrucks <= 20\n\n## Generate Constraint-4:\nThe average speed of trucks carrying perishables must be at least 50 km/h to ensure timely delivery.\n// PerishablesSpeed >= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company has a total budget of $10,000 for fuel costs per day and a maximum of 50 hours available for all trucks to be on the road per day. The company can only operate a maximum of 20 trucks in total. Additionally, the average speed of trucks carrying perishables must be at least 50 km/h to ensure timely delivery. Please help the company to minimize the total fuel consumption and time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nFurnitureSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FurnitureSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=50)\n\n# Define objective function\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Furniture = FurnitureTrucks * FurnitureSpeed**2\nFuel_Perishables = PerishablesTrucks * PerishablesSpeed**2\nTime_Electronics = ElectronicsTrucks / ElectronicsSpeed\nTime_Furniture = FurnitureTrucks / FurnitureSpeed\nTime_Perishables = PerishablesTrucks / PerishablesSpeed\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n# Add constraints\nmodel.addCons(Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000)\nmodel.addCons(Time_Electronics + Time_Furniture + Time_Perishables <= 50)\nmodel.addCons(ElectronicsTrucks + FurnitureTrucks + PerishablesTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Furniture: \", model.getVal(FurnitureSpeed))\n    print(\"Average Speed of Trucks for Perishables: \", model.getVal(PerishablesSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to small trucks\": \"RoutesSmall\", \"range\": \"RoutesSmall >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to medium trucks\": \"RoutesMedium\", \"range\": \"RoutesMedium >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to large trucks\": \"RoutesLarge\", \"range\": \"RoutesLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company aims to minimize the total daily operational and fuel costs.\n// FuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\n// OperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n// So, the objective function is: Minimize (FuelCost + OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs. The fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company has a total budget of $50,000 for purchasing new trucks. Please help the company to minimize the total daily operational and fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of large trucks\nRoutesSmall = model.addVar(vtype=\"INTEGER\", name=\"RoutesSmall\", lb=0) # number of routes assigned to small trucks\nRoutesMedium = model.addVar(vtype=\"INTEGER\", name=\"RoutesMedium\", lb=0) # number of routes assigned to medium trucks\nRoutesLarge = model.addVar(vtype=\"INTEGER\", name=\"RoutesLarge\", lb=0) # number of routes assigned to large trucks\n\n# Define objective function\nFuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\nOperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n# So, the objective function is: Minimize (FuelCost + OperationalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + OperationalCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Routes Assigned to Small Trucks: \", model.getVal(RoutesSmall))\n    print(\"Number of Routes Assigned to Medium Trucks: \", model.getVal(RoutesMedium))\n    print(\"Number of Routes Assigned to Large Trucks: \", model.getVal(RoutesLarge))\n    print(\"Minimized Total Daily Operational and Fuel Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 757,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the marketing budget allocated to each product. The marketing budget affects the sales volume of each product, and the price also influences the demand. The company aims to maximize its total revenue.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe sales volume of each product is affected by its price and marketing budget. The relationship is modeled as SalesVolume = BaseDemand - 0.01 * Price + 0.0002 * MarketingBudget. The base demand for ProductA is 1000 units, for ProductB is 1500 units, and for ProductC is 2000 units. The company aims to maximize the total revenue, which is the sum of the revenue from each product.\n// Revenue from ProductA: RevenueA = QuantityA * (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA)\n// Revenue from ProductB: RevenueB = QuantityB * (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB)\n// Revenue from ProductC: RevenueC = QuantityC * (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $50,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint where the total quantity of all products cannot exceed 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-3:\nDue to market saturation, the sales volume of each product cannot exceed its base demand.\n// (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA) >= QuantityA\n// (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB) >= QuantityB\n// (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC) >= QuantityC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the marketing budget allocated to each product. The marketing budget affects the sales volume of each product, and the price also influences the demand. The company aims to maximize its total revenue. The base demand for each product is as follows:\n\n| Product | Base Demand |\n|---------|-------------|\n| ProductA | 1000 units |\n| ProductB | 1500 units |\n| ProductC | 2000 units |\n\nThe sales volume of each product is modeled as SalesVolume = BaseDemand - 0.01 * Price + 0.0002 * MarketingBudget. The company has a total marketing budget of $50,000. The company's production capacity constraint states that the total quantity of all products cannot exceed 5000 units. Due to market saturation, the sales volume of each product cannot exceed its base demand.\n\nPlease help the company to maximize its total revenue, which is the sum of the revenue from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0) # price of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA)\nRevenueB = QuantityB * (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB)\nRevenueC = QuantityC * (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000) # total marketing budget constraint\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000) # production capacity constraint\nmodel.addCons(1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA >= QuantityA) # sales volume constraint for ProductA\nmodel.addCons(1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB >= QuantityB) # sales volume constraint for ProductB\nmodel.addCons(2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC >= QuantityC) # sales volume constraint for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor Truck B, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 20 tons.\nFor Truck C, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 30 tons.\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints.\n// Cost_TruckA = (0.5 + 0.3) * TruckA\n// Cost_TruckB = (0.6 + 0.4) * TruckB\n// Cost_TruckC = (0.7 + 0.5) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must not exceed 100 tons.\n// 10 * TruckA + 20 * TruckB + 30 * TruckC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\n// (0.5 + 0.3) * TruckA + (0.6 + 0.4) * TruckB + (0.7 + 0.5) * TruckC <= 5000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost.\nFor Truck A, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor Truck B, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 20 tons.\nFor Truck C, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 30 tons.\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints.\nThe total capacity of all trucks must not exceed 100 tons.\nThe company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\nPlease help the company determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nCost_TruckA = (0.5 + 0.3) * TruckA\nCost_TruckB = (0.6 + 0.4) * TruckB\nCost_TruckC = (0.7 + 0.5) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The total capacity of all trucks must not exceed 100 tons.\nmodel.addCons(10 * TruckA + 20 * TruckB + 30 * TruckC <= 100)\n# The company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\nmodel.addCons((0.5 + 0.3) * TruckA + (0.6 + 0.4) * TruckB + (0.7 + 0.5) * TruckC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies and capacities.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per km, the delivery speed is 50 km/h, and the cost per truck is $50,000.\nFor T2, the fuel consumption rate is 0.4 liters per km, the delivery speed is 60 km/h, and the cost per truck is $60,000.\nFor T3, the fuel consumption rate is 0.3 liters per km, the delivery speed is 70 km/h, and the cost per truck is $70,000.\nFor T4, the fuel consumption rate is 0.25 liters per km, the delivery speed is 80 km/h, and the cost per truck is $80,000.\nFor T5, the fuel consumption rate is 0.2 liters per km, the delivery speed is 90 km/h, and the cost per truck is $90,000.\nThe company wants to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).\n// Total_Cost_T1 = 50000 * T1 / 50\n// Total_Cost_T2 = 60000 * T2 / 60\n// Total_Cost_T3 = 70000 * T3 / 70\n// Total_Cost_T4 = 80000 * T4 / 80\n// Total_Cost_T5 = 90000 * T5 / 90\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000\n\n## Generate Constraint-2:\nThe total fuel consumption must not exceed 10,000 liters per day.\n// 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks in total.\n// T1 + T2 + T3 + T4 + T5 >= 10",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies, delivery speeds, and costs per truck. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Delivery Speed (km/h) | Cost per Truck ($) |\n|------------|-----------------------------------|-----------------------|--------------------|\n| T1         | 0.5                               | 50                    | 50,000             |\n| T2         | 0.4                               | 60                    | 60,000             |\n| T3         | 0.3                               | 70                    | 70,000             |\n| T4         | 0.25                              | 80                    | 80,000             |\n| T5         | 0.2                               | 90                    | 90,000             |\n\nThe company has a budget of $1,000,000 for purchasing trucks. The total fuel consumption must not exceed 10,000 liters per day. The company must have at least 10 trucks in total. \n\nPlease help the company to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 50000 * T1 / 50\nTotal_Cost_T2 = 60000 * T2 / 60\nTotal_Cost_T3 = 70000 * T3 / 70\nTotal_Cost_T4 = 80000 * T4 / 80\nTotal_Cost_T5 = 90000 * T5 / 90\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000)\n## The total fuel consumption must not exceed 10,000 liters per day.\nmodel.addCons(0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000)\n## The company must have at least 10 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone1\": \"Zone1\", \"range\": \"Zone1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone2\": \"Zone2\", \"range\": \"Zone2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone3\": \"Zone3\", \"range\": \"Zone3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone4\": \"Zone4\", \"range\": \"Zone4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone5\": \"Zone5\", \"range\": \"Zone5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone1 is 80%, with a cost of $100 per panel.\nIn Zone2, the efficiency is 85%, with a cost of $120 per panel.\nIn Zone3, the efficiency is 90%, with a cost of $140 per panel.\nIn Zone4, the efficiency is 95%, with a cost of $160 per panel.\nIn Zone5, the efficiency is 100%, with a cost of $180 per panel.\nThe city aims to maximize the energy production per dollar spent.\n// Energy_Production = 80% * Zone1 * 100 + 85% * Zone2 * 120 + 90% * Zone3 * 140 + 95% * Zone4 * 160 + 100% * Zone5 * 180\n// Total_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n// So, the objective function is: Maximize Energy_Production / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs. The efficiency and cost per panel for each zone are given in the following Table.\n\n| Zone    | Efficiency | Cost per Panel |\n|---------|------------|----------------|\n| Zone1   | 80%        | $100           |\n| Zone2   | 85%        | $120           |\n| Zone3   | 90%        | $140           |\n| Zone4   | 95%        | $160           |\n| Zone5   | 100%       | $180           |\n\nThe city has a budget of $100,000 for the installation of solar panels. The city aims to maximize the energy production per dollar spent. Please help the city determine the optimal number of solar panels to install in each zone.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZone1 = model.addVar(vtype=\"INTEGER\", name=\"Zone1\", lb=0) # number of solar panels in Zone1\nZone2 = model.addVar(vtype=\"INTEGER\", name=\"Zone2\", lb=0) # number of solar panels in Zone2\nZone3 = model.addVar(vtype=\"INTEGER\", name=\"Zone3\", lb=0) # number of solar panels in Zone3\nZone4 = model.addVar(vtype=\"INTEGER\", name=\"Zone4\", lb=0) # number of solar panels in Zone4\nZone5 = model.addVar(vtype=\"INTEGER\", name=\"Zone5\", lb=0) # number of solar panels in Zone5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Production = 0.8 * Zone1 * 100 + 0.85 * Zone2 * 120 + 0.9 * Zone3 * 140 + 0.95 * Zone4 * 160 + 1 * Zone5 * 180\nTotal_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n## the objective function is: Maximize Energy_Production / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Energy_Production)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone1: \", model.getVal(Zone1))\n    print(\"Number of Solar Panels in Zone2: \", model.getVal(Zone2))\n    print(\"Number of Solar Panels in Zone3: \", model.getVal(Zone3))\n    print(\"Number of Solar Panels in Zone4: \", model.getVal(Zone4))\n    print(\"Number of Solar Panels in Zone5: \", model.getVal(Zone5))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAWorkers\", \"range\": \"ProductAWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBWorkers\", \"range\": \"ProductBWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCWorkers\", \"range\": \"ProductCWorkers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company wants to maximize the total daily profit.\n// Profit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\n// Profit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\n// Profit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company has a total of 50 workers available. The company wants to maximize the total daily profit. Please help the company optimize its production strategy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nProductAWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductAWorkers\", lb=0)  # number of workers for ProductA\nProductBWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductBWorkers\", lb=0)  # number of workers for ProductB\nProductCWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductCWorkers\", lb=0)  # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\nProfit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\nProfit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAWorkers))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBWorkers))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCWorkers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 506,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Trucks\": \"FuelTruck\", \"range\": \"FuelTruck > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Vans\": \"FuelVan\", \"range\": \"FuelVan > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Bikes\": \"FuelBike\", \"range\": \"FuelBike > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Trucks\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Vans\": \"MaintenanceVan\", \"range\": \"MaintenanceVan > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Bikes\": \"MaintenanceBike\", \"range\": \"MaintenanceBike > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes.\n// Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe number of Trucks must be at least half the number of Vans.\n// Trucks >= 0.5 * Vans\n\n## Generate Constraint-4:\nThe number of Bikes must be at least twice the number of Trucks.\n// Bikes >= 2 * Trucks",
        "question": "A logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The number of Trucks must be at least half the number of Vans. The number of Bikes must be at least twice the number of Trucks. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to meet these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuelTruck = model.addVar(name=\"FuelTruck\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Trucks\nFuelVan = model.addVar(name=\"FuelVan\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Vans\nFuelBike = model.addVar(name=\"FuelBike\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Bikes\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Trucks\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Vans\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Bikes\n\n# Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000)\n# The total number of vehicles cannot exceed 50.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n# The number of Trucks must be at least half the number of Vans.\nmodel.addCons(Trucks >= 0.5 * Vans)\n# The number of Bikes must be at least twice the number of Trucks.\nmodel.addCons(Bikes >= 2 * Trucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company aims to minimize the total daily fuel cost across all trucks.\n// FuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\n// FuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\n// FuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\n// TotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel efficiency upgrades.\n// FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the company must ensure that at least 10 trucks of each type are deployed.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10\n\n## Generate Constraint-4:\nThe total daily mileage for all trucks must not exceed 30,000 km.\n// TruckA * 500 + TruckB * 600 + TruckC * 700 <= 30000",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the investment in fuel efficiency upgrades for each type of truck. The fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. The initial fuel cost and the rate of decrease in fuel cost per kilometer for each $100 invested in fuel efficiency are given in the following Table.\n\n| Truck Type | Initial Fuel Cost per km | Decrease in Fuel Cost per km for $100 Investment |\n|------------|--------------------------|-------------------------------------------------|\n| TruckA     | $0.5                     | $0.01                                           |\n| TruckB     | $0.6                     | $0.012                                          |\n| TruckC     | $0.7                     | $0.014                                          |\n\nThe company has a total budget of $10,000 for fuel efficiency upgrades. The total number of trucks that can be deployed is limited to 50. The company must ensure that at least 10 trucks of each type are deployed. The total daily mileage for all trucks must not exceed 30,000 km. \n\nPlease help the company to minimize the total daily fuel cost across all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10) # number of TruckC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0) # investment in fuel efficiency for TruckA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0) # investment in fuel efficiency for TruckB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0) # investment in fuel efficiency for TruckC\n\n# Define objective function\nFuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\nFuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\nFuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\nTotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\nmodel.addCons(FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000) # total budget for fuel efficiency upgrades\nmodel.addCons(TruckA + TruckB + TruckC <= 50) # total number of trucks\nmodel.addCons(TruckA >= 10) # at least 10 trucks of each type\nmodel.addCons(TruckB >= 10)\nmodel.addCons(TruckC >= 10)\nmodel.addCons(TruckA * 500 + TruckB * 600 + TruckC * 700 <= 30000) # total daily mileage\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(FuelEfficiencyC))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a fuel cost of $50 per day, each Van can deliver 50 packages per day with a fuel cost of $30 per day, and each Bike can deliver 20 packages per day with a fuel cost of $10 per day. The company aims to maximize the total number of packages delivered per dollar spent on fuel.\n// Total packages delivered by Trucks: Packages_T = 100 * T\n// Total packages delivered by Vans: Packages_V = 50 * V\n// Total packages delivered by Bikes: Packages_B = 20 * B\n// Total fuel cost: Fuel_Cost = 50 * T + 30 * V + 10 * B\n// So, the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / (Fuel_Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for fuel costs.\n// 50 * T + 30 * V + 10 * B <= 1000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. Each Truck can deliver 100 packages per day with a fuel cost of $50 per day, each Van can deliver 50 packages per day with a fuel cost of $30 per day, and each Bike can deliver 20 packages per day with a fuel cost of $10 per day. The company aims to maximize the total number of packages delivered per dollar spent on fuel. The company has a budget of $1000 per day for fuel costs. Please help the company determine the optimal number of Trucks, Vans, and Bikes to maximize the total number of packages delivered per dollar spent on fuel.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nPackages_T = 100 * T\nPackages_V = 50 * V\nPackages_B = 20 * B\nFuel_Cost = 50 * T + 30 * V + 10 * B\n## the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Cost == Packages_T + Packages_V + Packages_B)\n\n# Add constraints\n## The company has a budget of $1000 per day for fuel costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in new machinery for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in new machinery cannot exceed $100,000.\n// InvestmentA + InvestmentB + InvestmentC <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA cannot exceed 500 units, and ProductB cannot exceed 400 units.\n// QuantityA <= 500; QuantityB <= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product. The cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 10,000 labor hours available for the month. The total capital investment in new machinery cannot exceed $100,000. Due to market demand, the production of ProductA cannot exceed 500 units, and ProductB cannot exceed 400 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nLaborA = model.addVar(vtype=\"INTEGER\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"INTEGER\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"INTEGER\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # capital investment in new machinery for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # capital investment in new machinery for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # capital investment in new machinery for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\nProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\nProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 10000)\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 100000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in Machinery for ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in Machinery for ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in Machinery for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for Good A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks.\n// Fuel_Consumption_A = kA * (SpeedA^2) * TrucksA * Hours_Operated\n// Fuel_Consumption_B = kB * (SpeedB^2) * TrucksB * Hours_Operated\n// Fuel_Consumption_C = kC * (SpeedC^2) * TrucksC * Hours_Operated\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel expenses.\n// kA * (SpeedA^2) * TrucksA * Hours_Operated + kB * (SpeedB^2) * TrucksB * Hours_Operated + kC * (SpeedC^2) * TrucksC * Hours_Operated <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks.\n\n| Type of Good | Number of Trucks | Average Speed (km/h) |\n|--------------|------------------|---------------------|\n| A            | TrucksA          | SpeedA              |\n| B            | TrucksB          | SpeedB              |\n| C            | TrucksC          | SpeedC              |\n\nThe company has a total budget of $10,000 per day for fuel expenses. The total number of trucks available is limited to 50.\n\nPlease help the company determine the optimal number of trucks for each type of good and their respective average speeds to minimize the total daily fuel consumption while adhering to the budget and truck availability constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # average speed of trucks for Good A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # average speed of trucks for Good B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # average speed of trucks for Good C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nkA = 0.01  # example constant for Good A\nkB = 0.02  # example constant for Good B\nkC = 0.03  # example constant for Good C\nHours_Operated = 8  # example hours operated per day\nFuel_Consumption_A = kA * (SpeedA**2) * TrucksA * Hours_Operated\nFuel_Consumption_B = kB * (SpeedB**2) * TrucksB * Hours_Operated\nFuel_Consumption_C = kC * (SpeedC**2) * TrucksC * Hours_Operated\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for fuel expenses.\nmodel.addCons(kA * (SpeedA**2) * TrucksA * Hours_Operated + kB * (SpeedB**2) * TrucksB * Hours_Operated + kC * (SpeedC**2) * TrucksC * Hours_Operated <= 10000)\n## The total number of trucks available is limited to 50.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Average Speed of Trucks for Good A: \", model.getVal(SpeedA))\n    print(\"Average Speed of Trucks for Good B: \", model.getVal(SpeedB))\n    print(\"Average Speed of Trucks for Good C: \", model.getVal(SpeedC))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n// Fuel cost per trip for TruckA: CostA = (50 - 0.02 * UpgradeA) * TripsA\n// Fuel cost per trip for TruckB: CostB = (60 - 0.03 * UpgradeB) * TripsB\n// Fuel cost per trip for TruckC: CostC = (70 - 0.04 * UpgradeC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for transportation and upgrades.\n// 50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2,000.\n// TripsA + TripsB + TripsC <= 2000\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n// TripsA >= 200; TripsB >= 300",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter and how much to invest in fuel-efficient upgrades for each vehicle type to optimize its operations. The fuel efficiency of each vehicle improves with the investment in upgrades, reducing the fuel cost per trip. The company aims to minimize the total fuel cost for all vehicles. The company has a total budget of $30,000 for transportation and upgrades. The total number of trips across all vehicles must not exceed 2,000. Due to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n\nPlease help the company determine the optimal number of trips for each vehicle and the amount to invest in fuel-efficient upgrades to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=200)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=300)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # investment in fuel-efficient upgrades for TruckA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # investment in fuel-efficient upgrades for TruckB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # investment in fuel-efficient upgrades for TruckC\n\n# Define objective function\nCostA = (50 - 0.02 * UpgradeA) * TripsA\nCostB = (60 - 0.03 * UpgradeB) * TripsB\nCostC = (70 - 0.04 * UpgradeC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $30,000 for transportation and upgrades.\nmodel.addCons(50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000)\n# The total number of trips across all vehicles must not exceed 2,000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Investment in Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Investment in Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced, as well as the amount of raw material R1 and R2 used in the production of each product.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material R1 used for ProductA\": \"R1A\", \"range\": \"R1A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductB\": \"R1B\", \"range\": \"R1B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductC\": \"R1C\", \"range\": \"R1C >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductA\": \"R2A\", \"range\": \"R2A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductB\": \"R2B\", \"range\": \"R2B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductC\": \"R2C\", \"range\": \"R2C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is determined by the selling price minus the cost of raw materials and production. The selling price for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of raw material R1 is $5 per unit, and R2 is $10 per unit. The production cost for each unit of ProductA is $30, for ProductB is $40, and for ProductC is $50. The company aims to maximize the total profit.\n// Profit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\n// Profit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\n// Profit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material R1 available.\n// R1A + R1B + R1C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material R2 available.\n// R2A + R2B + R2C <= 1500\n\n## Generate Constraint-3:\nThe production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\n// R1A >= 2 * R2A\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductB.\n// UnitsB >= 50\n\n## Generate Constraint-5:\nThe total production cost should not exceed $10,000.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The selling price for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of raw material R1 is $5 per unit, and R2 is $10 per unit. The production cost for each unit of ProductA is $30, for ProductB is $40, and for ProductC is $50. The company has a total of 1000 units of raw material R1 available and 1500 units of raw material R2 available. The production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA. The company must produce at least 50 units of ProductB. The total production cost should not exceed $10,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nR1A = model.addVar(vtype=\"CONTINUOUS\", name=\"R1A\", lb=0) # amount of raw material R1 used for ProductA\nR1B = model.addVar(vtype=\"CONTINUOUS\", name=\"R1B\", lb=0) # amount of raw material R1 used for ProductB\nR1C = model.addVar(vtype=\"CONTINUOUS\", name=\"R1C\", lb=0) # amount of raw material R1 used for ProductC\nR2A = model.addVar(vtype=\"CONTINUOUS\", name=\"R2A\", lb=0) # amount of raw material R2 used for ProductA\nR2B = model.addVar(vtype=\"CONTINUOUS\", name=\"R2B\", lb=0) # amount of raw material R2 used for ProductB\nR2C = model.addVar(vtype=\"CONTINUOUS\", name=\"R2C\", lb=0) # amount of raw material R2 used for ProductC\n\n# Define objective function\nProfit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\nProfit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\nProfit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n# The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 units of raw material R1 available.\nmodel.addCons(R1A + R1B + R1C <= 1000)\n# The company has a total of 1500 units of raw material R2 available.\nmodel.addCons(R2A + R2B + R2C <= 1500)\n# The production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\nmodel.addCons(R1A >= 2 * R2A)\n# The company must produce at least 50 units of ProductB.\nmodel.addCons(UnitsB >= 50)\n# The total production cost should not exceed $10,000.\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Amount of R1 used for ProductA: \", model.getVal(R1A))\n    print(\"Amount of R1 used for ProductB: \", model.getVal(R1B))\n    print(\"Amount of R1 used for ProductC: \", model.getVal(R1C))\n    print(\"Amount of R2 used for ProductA: \", model.getVal(R2A))\n    print(\"Amount of R2 used for ProductB: \", model.getVal(R2B))\n    print(\"Amount of R2 used for ProductC: \", model.getVal(R2C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used\": \"RawMaterial\", \"range\": \"RawMaterial >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company wants to maximize the total profit from selling all devices.\n// Total profit: Profit = (50 * DeviceA + 70 * DeviceB + 60 * DeviceC) - (20 * LaborHours + 10 * RawMaterial)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for the quarter.\n// LaborHours <= 1000\n\n## Generate Constraint-2:\nThe production of each device requires a certain amount of labor and raw material: DeviceA requires 2 hours of labor and 3 units of raw material, DeviceB requires 4 hours of labor and 2 units of raw material, and DeviceC requires 3 hours of labor and 4 units of raw material.\n// 2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours\n// 3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial\n\n## Generate Constraint-3:\nThe company has a budget of $15,000 for labor and raw material costs for the quarter.\n// 20 * LaborHours + 10 * RawMaterial <= 15,000\n\n## Generate Constraint-4:\nThe market demand for DeviceA is at least 50 units, for DeviceB is at least 70 units, and for DeviceC is at least 60 units.\n// DeviceA >= 50\n// DeviceB >= 70\n// DeviceC >= 60",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company has a total of 1000 hours of labor available for the quarter. The production of each device requires a certain amount of labor and raw material: DeviceA requires 2 hours of labor and 3 units of raw material, DeviceB requires 4 hours of labor and 2 units of raw material, and DeviceC requires 3 hours of labor and 4 units of raw material. The company has a budget of $15,000 for labor and raw material costs for the quarter. The market demand for DeviceA is at least 50 units, for DeviceB is at least 70 units, and for DeviceC is at least 60 units. Please help the company to maximize the total profit from selling all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=50)  # number of DeviceA produced\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=70)  # number of DeviceB produced\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=60)  # number of DeviceC produced\nLaborHours = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHours\")  # number of hours of labor used\nRawMaterial = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterial\")  # number of units of raw material used\n\n# Define objective function\nProfit = 50 * DeviceA + 70 * DeviceB + 60 * DeviceC - 20 * LaborHours - 10 * RawMaterial\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a total of 1000 hours of labor available for the quarter.\nmodel.addCons(LaborHours <= 1000)\n# The production of each device requires a certain amount of labor and raw material\nmodel.addCons(2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours)\nmodel.addCons(3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial)\n# The company has a budget of $15,000 for labor and raw material costs for the quarter.\nmodel.addCons(20 * LaborHours + 10 * RawMaterial <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceC))\n    print(\"Number of hours of labor used: \", model.getVal(LaborHours))\n    print(\"Number of units of raw material used: \", model.getVal(RawMaterial))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone A\": \"ZoneA\", \"range\": \"ZoneA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"ZoneB\", \"range\": \"ZoneB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"ZoneC\", \"range\": \"ZoneC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"ZoneD\", \"range\": \"ZoneD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"ZoneE\", \"range\": \"ZoneE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost.\n// Total energy production: Energy = 80% * ZoneA + 75% * ZoneB + 70% * ZoneC + 65% * ZoneD + 60% * ZoneE\n// Total installation cost: Cost = $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE <= $100000\n\n## Generate Constraint-2:\nThere is a maximum capacity of 100 panels that can be installed in each zone.\n// ZoneA <= 100\n// ZoneB <= 100\n// ZoneC <= 100\n// ZoneD <= 100\n// ZoneE <= 100",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs. The efficiency of solar panels and the cost per panel installation in each zone are given in the following Table.\n\n| Zone   | Efficiency | Cost per Panel Installation |\n|--------|------------|-----------------------------|\n| Zone A | 80%        | $1000                       |\n| Zone B | 75%        | $1200                       |\n| Zone C | 70%        | $1400                       |\n| Zone D | 65%        | $1600                       |\n| Zone E | 60%        | $1800                       |\n\nThe city has a budget of $100,000 for the installation of solar panels. There is a maximum capacity of 100 panels that can be installed in each zone. Please help the city to maximize the total energy production while minimizing the total installation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA = model.addVar(vtype=\"INTEGER\", name=\"ZoneA\", lb=0) # number of solar panels in Zone A\nZoneB = model.addVar(vtype=\"INTEGER\", name=\"ZoneB\", lb=0) # number of solar panels in Zone B\nZoneC = model.addVar(vtype=\"INTEGER\", name=\"ZoneC\", lb=0) # number of solar panels in Zone C\nZoneD = model.addVar(vtype=\"INTEGER\", name=\"ZoneD\", lb=0) # number of solar panels in Zone D\nZoneE = model.addVar(vtype=\"INTEGER\", name=\"ZoneE\", lb=0) # number of solar panels in Zone E\n\n# Define objective function\n## Total energy production\nEnergy = 0.8 * ZoneA + 0.75 * ZoneB + 0.7 * ZoneC + 0.65 * ZoneD + 0.6 * ZoneE\n## Total installation cost\nCost = 1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Energy - Cost\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE <= 100000)\n## There is a maximum capacity of 100 panels that can be installed in each zone.\nmodel.addCons(ZoneA <= 100)\nmodel.addCons(ZoneB <= 100)\nmodel.addCons(ZoneC <= 100)\nmodel.addCons(ZoneD <= 100)\nmodel.addCons(ZoneE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(ZoneA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(ZoneB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(ZoneC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(ZoneD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(ZoneE))\n    print(\"Maximized Energy Production - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: CostA = 20 + 0.05 * UnitsA^2, CostB = 30 + 0.03 * UnitsB^2, CostC = 40 + 0.02 * UnitsC^2, CostD = 50 + 0.01 * UnitsD^2. The company wants to maximize its total net profit.\n// Total net profit for DeviceA: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * UnitsA^2)) * UnitsA\n// Total net profit for DeviceB: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * UnitsB^2)) * UnitsB\n// Total net profit for DeviceC: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * UnitsC^2)) * UnitsC\n// Total net profit for DeviceD: ProfitD = (110 - CostD) * UnitsD = (110 - (50 + 0.01 * UnitsD^2)) * UnitsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs per month.\n// (20 + 0.05 * UnitsA^2) * UnitsA + (30 + 0.03 * UnitsB^2) * UnitsB + (40 + 0.02 * UnitsC^2) * UnitsC + (50 + 0.01 * UnitsD^2) * UnitsD <= 50,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for each device and the production cost function for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|--------------------------|\n| DeviceA | $50 | 20 + 0.05 * UnitsA^2 |\n| DeviceB | $70 | 30 + 0.03 * UnitsB^2 |\n| DeviceC | $90 | 40 + 0.02 * UnitsC^2 |\n| DeviceD | $110 | 50 + 0.01 * UnitsD^2 |\n\nThe company has a total production capacity of 1000 units per month. Due to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units. The company has a budget of $50,000 for production costs per month.\n\nPlease help the company to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## Total net profit for DeviceA: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * UnitsA^2)) * UnitsA\n## Total net profit for DeviceB: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * UnitsB^2)) * UnitsB\n## Total net profit for DeviceC: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * UnitsC^2)) * UnitsC\n## Total net profit for DeviceD: ProfitD = (110 - CostD) * UnitsD = (110 - (50 + 0.01 * UnitsD^2)) * UnitsD\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nCostA = 20 + 0.05 * UnitsA**2\nCostB = 30 + 0.03 * UnitsB**2\nCostC = 40 + 0.02 * UnitsC**2\nCostD = 50 + 0.01 * UnitsD**2\nProfitA = (50 - CostA) * UnitsA\nProfitB = (70 - CostB) * UnitsB\nProfitC = (90 - CostC) * UnitsC\nProfitD = (110 - CostD) * UnitsD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD <= 1000)\n## Due to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget of $50,000 for production costs per month.\nmodel.addCons((20 + 0.05 * UnitsA**2) * UnitsA + (30 + 0.03 * UnitsB**2) * UnitsB + (40 + 0.02 * UnitsC**2) * UnitsC + (50 + 0.01 * UnitsD**2) * UnitsD <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different plants that produce electronic components. The company needs to determine the optimal number of workers to assign to each plant to maximize efficiency.\n// {\"number of workers at plant 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach plant has a different efficiency rate based on the number of workers assigned. The efficiency is modeled as a nonlinear function of the number of workers, where efficiency increases with more workers but at a decreasing rate. The company aims to maximize the total efficiency across all plants.\n// Efficiency at plant 1: E1 = W1 / (1 + 0.01 * W1^2)\n// Efficiency at plant 2: E2 = W2 / (1 + 0.01 * W2^2)\n// Efficiency at plant 3: E3 = W3 / (1 + 0.01 * W3^2)\n// Efficiency at plant 4: E4 = W4 / (1 + 0.01 * W4^2)\n// Efficiency at plant 5: E5 = W5 / (1 + 0.01 * W5^2)\n// Objective function: Maximize E = E1 + E2 + E3 + E4 + E5\n// Maximize E = W1 / (1 + 0.01 * W1^2) + W2 / (1 + 0.01 * W2^2) + W3 / (1 + 0.01 * W3^2) + W4 / (1 + 0.01 * W4^2) + W5 / (1 + 0.01 * W5^2)\n\n## Generate Constraint-1:\nThe total number of workers available across all plants is limited to 100.\n// W1 + W2 + W3 + W4 + W5 <= 100",
        "question": "A manufacturing company has 5 different plants that produce electronic components. The company needs to determine the optimal number of workers to assign to each plant to maximize efficiency. Each plant has a different efficiency rate based on the number of workers assigned, where efficiency increases with more workers but at a decreasing rate. The efficiency at each plant is modeled as a nonlinear function of the number of workers. The company aims to maximize the total efficiency across all plants. The total number of workers available across all plants is limited to 100.\nPlease help the company to maximize the total efficiency, which is defined as the sum of the efficiencies at each plant, where the efficiency at plant i is given by Ei = Wi / (1 + 0.01 * Wi^2) for i = 1 to 5.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers at plant 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers at plant 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers at plant 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers at plant 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers at plant 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Efficiency functions\nE1 = W1 / (1 + 0.01 * W1**2)\nE2 = W2 / (1 + 0.01 * W2**2)\nE3 = W3 / (1 + 0.01 * W3**2)\nE4 = W4 / (1 + 0.01 * W4**2)\nE5 = W5 / (1 + 0.01 * W5**2)\n\n## Convert division to multiplication\nmodel.addCons(obj * (1 + 0.01 * W1**2) == W1)\nmodel.addCons(obj * (1 + 0.01 * W2**2) == W2)\nmodel.addCons(obj * (1 + 0.01 * W3**2) == W3)\nmodel.addCons(obj * (1 + 0.01 * W4**2) == W4)\nmodel.addCons(obj * (1 + 0.01 * W5**2) == W5)\n\n# Add constraints\n## The total number of workers available across all plants is limited to 100.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers at Plant 1: \", model.getVal(W1))\n    print(\"Number of Workers at Plant 2: \", model.getVal(W2))\n    print(\"Number of Workers at Plant 3: \", model.getVal(W3))\n    print(\"Number of Workers at Plant 4: \", model.getVal(W4))\n    print(\"Number of Workers at Plant 5: \", model.getVal(W5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel usage per truck in Region1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter varies by region, and the efficiency of trucks also differs. The cost of fuel in Region1 is $1.20/liter, in Region2 is $1.30/liter, in Region3 is $1.40/liter, in Region4 is $1.50/liter, and in Region5 is $1.60/liter. The efficiency of trucks in each region is inversely proportional to the fuel cost. The company aims to minimize the total cost of fuel and truck deployment.\n// Total fuel cost in Region1: Cost1 = 1.20 * Trucks1 * Fuel1\n// Total fuel cost in Region2: Cost2 = 1.30 * Trucks2 * Fuel2\n// Total fuel cost in Region3: Cost3 = 1.40 * Trucks3 * Fuel3\n// Total fuel cost in Region4: Cost4 = 1.50 * Trucks4 * Fuel4\n// Total fuel cost in Region5: Cost5 = 1.60 * Trucks5 * Fuel5\n// Total cost of truck deployment: DeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and truck deployment.\n// 1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000",
        "question": "A logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck. The cost of fuel per liter and the efficiency of trucks vary by region, as shown in the following Table.\n\n| Region   | Fuel Cost per Liter | Efficiency of Trucks |\n|----------|---------------------|----------------------|\n| Region1  | $1.20/liter         | Inversely proportional to cost |\n| Region2  | $1.30/liter         | Inversely proportional to cost |\n| Region3  | $1.40/liter         | Inversely proportional to cost |\n| Region4  | $1.50/liter         | Inversely proportional to cost |\n| Region5  | $1.60/liter         | Inversely proportional to cost |\n\nThe company has a total budget of $50,000 for fuel and truck deployment. The total cost of fuel in each region is calculated by multiplying the number of trucks by the fuel usage per truck and the fuel cost per liter. The total cost of truck deployment is calculated by multiplying the total number of trucks by $1000.\n\nPlease help the company to minimize the total cost of fuel and truck deployment.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks in Region5\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel usage per truck in Region1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel usage per truck in Region2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0) # fuel usage per truck in Region3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0) # fuel usage per truck in Region4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0) # fuel usage per truck in Region5\n\n# Define objective function\nCost1 = 1.20 * Trucks1 * Fuel1\nCost2 = 1.30 * Trucks2 * Fuel2\nCost3 = 1.40 * Trucks3 * Fuel3\nCost4 = 1.50 * Trucks4 * Fuel4\nCost5 = 1.60 * Trucks5 * Fuel5\nDeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel and truck deployment.\nmodel.addCons(1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Usage per Truck in Region1: \", model.getVal(Fuel1))\n    print(\"Fuel Usage per Truck in Region2: \", model.getVal(Fuel2))\n    print(\"Fuel Usage per Truck in Region3: \", model.getVal(Fuel3))\n    print(\"Fuel Usage per Truck in Region4: \", model.getVal(Fuel4))\n    print(\"Fuel Usage per Truck in Region5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company has identified four major regions (North, South, East, West) and needs to determine the number of trucks to allocate to each region, as well as the fuel efficiency of each truck type.\n// {\"number of trucks for North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for North region (km/liter)\": \"NorthEfficiency\", \"range\": \"NorthEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for South region (km/liter)\": \"SouthEfficiency\", \"range\": \"SouthEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for East region (km/liter)\": \"EastEfficiency\", \"range\": \"EastEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for West region (km/liter)\": \"WestEfficiency\", \"range\": \"WestEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day. The cost of fuel is $1 per liter, and each truck travels an average of 500 km per day.\n// FuelCost_North = 500 * NorthTrucks / NorthEfficiency\n// FuelCost_South = 500 * SouthTrucks / SouthEfficiency\n// FuelCost_East = 500 * EastTrucks / EastEfficiency\n// FuelCost_West = 500 * WestTrucks / WestEfficiency\n// So, the objective function is: Minimize (FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for fuel costs per day.\n// 500 * NorthTrucks / NorthEfficiency + 500 * SouthTrucks / SouthEfficiency + 500 * EastTrucks / EastEfficiency + 500 * WestTrucks / WestEfficiency <= 3000",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company has identified four major regions (North, South, East, West) and needs to determine the number of trucks to allocate to each region, as well as the fuel efficiency of each truck type. The company wants to minimize the total fuel cost per day, where the cost of fuel is $1 per liter and each truck travels an average of 500 km per day. The company has a total of 50 trucks available and a budget of $3000 for fuel costs per day. Please help the company optimize its allocation of trucks and fuel efficiency to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)  # number of trucks for North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)  # number of trucks for South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)  # number of trucks for East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)  # number of trucks for West region\nNorthEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"NorthEfficiency\", lb=0)  # fuel efficiency of trucks for North region\nSouthEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SouthEfficiency\", lb=0)  # fuel efficiency of trucks for South region\nEastEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EastEfficiency\", lb=0)  # fuel efficiency of trucks for East region\nWestEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"WestEfficiency\", lb=0)  # fuel efficiency of trucks for West region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_North = 500 * NorthTrucks / NorthEfficiency\nFuelCost_South = 500 * SouthTrucks / SouthEfficiency\nFuelCost_East = 500 * EastTrucks / EastEfficiency\nFuelCost_West = 500 * WestTrucks / WestEfficiency\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50)\n## The company has a budget of $3000 for fuel costs per day.\nmodel.addCons(500 * NorthTrucks * NorthEfficiency + 500 * SouthTrucks * SouthEfficiency + 500 * EastTrucks * EastEfficiency + 500 * WestTrucks * WestEfficiency <= 3000 * (NorthEfficiency + SouthEfficiency + EastEfficiency + WestEfficiency))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West Region: \", model.getVal(WestTrucks))\n    print(\"Fuel Efficiency for North Region: \", model.getVal(NorthEfficiency))\n    print(\"Fuel Efficiency for South Region: \", model.getVal(SouthEfficiency))\n    print(\"Fuel Efficiency for East Region: \", model.getVal(EastEfficiency))\n    print(\"Fuel Efficiency for West Region: \", model.getVal(WestEfficiency))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 625,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3.\n// {\"number of Type1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Type1 trucks\": \"FEU1\", \"range\": \"FEU1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type2 trucks\": \"FEU2\", \"range\": \"FEU2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type3 trucks\": \"FEU3\", \"range\": \"FEU3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n// Fuel cost for Type1 trucks: FC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\n// Fuel cost for Type2 trucks: FC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\n// Fuel cost for Type3 trucks: FC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\n// Upgrade cost: UC = 100 * (FEU1 + FEU2 + FEU3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency upgrades.\n// 100 * (FEU1 + FEU2 + FEU3) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month. The company has a budget of $50,000 for fuel efficiency upgrades. The total number of trucks available is 100.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and upgrade costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of Type1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of Type2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Type3 trucks\nFEU1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU1\", lb=0) # fuel efficiency upgrade for Type1 trucks\nFEU2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU2\", lb=0) # fuel efficiency upgrade for Type2 trucks\nFEU3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU3\", lb=0) # fuel efficiency upgrade for Type3 trucks\n\n# Define objective function\nFC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\nFC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\nFC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\nUC = 100 * (FEU1 + FEU2 + FEU3)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\nmodel.addCons(obj == FC1 + FC2 + FC3 + UC)\n\n# Add constraints\n# The company has a budget of $50,000 for fuel efficiency upgrades.\nmodel.addCons(100 * (FEU1 + FEU2 + FEU3) <= 50000)\n# The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type3 Trucks: \", model.getVal(T3))\n    print(\"Fuel Efficiency Upgrade for Type1: \", model.getVal(FEU1))\n    print(\"Fuel Efficiency Upgrade for Type2: \", model.getVal(FEU2))\n    print(\"Fuel Efficiency Upgrade for Type3: \", model.getVal(FEU3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost for Trucks is $100 per day, for Vans is $70 per day, and for Bikes is $30 per day. The delivery efficiency (measured in deliveries per day) for Trucks is 10, for Vans is 15, and for Bikes is 20. The company aims to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n// Efficiency_Trucks = 10 * Trucks / 100\n// Efficiency_Vans = 15 * Vans / 70\n// Efficiency_Bikes = 20 * Bikes / 30\n// So, the objective function is: Maximize (Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $3000 per day for fuel and maintenance costs.\n// 100 * Trucks + 70 * Vans + 30 * Bikes <= 3000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost per day, as well as the delivery efficiency (measured in deliveries per day) for each vehicle type, are given in the following Table.\n\n| Vehicle Type | Fuel & Maintenance Cost per Day | Delivery Efficiency (deliveries/day) |\n|--------------|--------------------------------|--------------------------------------|\n| Trucks       | $100                           | 10                                   |\n| Vans         | $70                            | 15                                   |\n| Bikes        | $30                            | 20                                   |\n\nThe company has a budget of $3000 per day for fuel and maintenance costs. Please help the company to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Trucks = 10 * Trucks / 100\nEfficiency_Vans = 15 * Vans / 70\nEfficiency_Bikes = 20 * Bikes / 30\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n# Add constraints\n## The company has a budget of $3000 per day for fuel and maintenance costs.\nmodel.addCons(100 * Trucks + 70 * Vans + 30 * Bikes <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Delivery Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialized truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are met.\n// Fuel_Consumption_Small = (S * 20) / (S * 5)\n// Fuel_Consumption_Medium = (M * 15) / (M * 10)\n// Fuel_Consumption_Large = (L * 10) / (L * 15)\n// Fuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\n// Fuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n## Generate Constraint-1:\nThe total capacity required for all deliveries is 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase a maximum of 30 trucks in total.\n// S + M + L + XL + Sp <= 30",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. Each type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialized truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are met. The total capacity required for all deliveries is 500 tons. The company has a budget to purchase a maximum of 30 trucks in total. Please help the company to minimize the total fuel consumption while meeting all delivery requirements.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Small = (S * 20) / (S * 5)\nFuel_Consumption_Medium = (M * 15) / (M * 10)\nFuel_Consumption_Large = (L * 10) / (L * 15)\nFuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\nFuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n# Add constraints\n## The total capacity required for all deliveries is 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500)\n## The company has a budget to purchase a maximum of 30 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Specialized Trucks: \", model.getVal(Sp))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a fuel cost of $50 per day, each Van can deliver 50 packages per day with a fuel cost of $30 per day, and each Bike can deliver 20 packages per day with a fuel cost of $10 per day. The company aims to maximize the total number of packages delivered per dollar spent on fuel.\n// Total packages delivered by Trucks: Packages_T = 100 * T\n// Total packages delivered by Vans: Packages_V = 50 * V\n// Total packages delivered by Bikes: Packages_B = 20 * B\n// Total fuel cost: Fuel_Cost = 50 * T + 30 * V + 10 * B\n// So, the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / (Fuel_Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for fuel costs.\n// 50 * T + 30 * V + 10 * B <= 1000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The delivery capacity and fuel cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity | Fuel Cost per Day |\n|--------------|-------------------|-------------------|\n| Trucks       | 100 packages      | $50               |\n| Vans         | 50 packages       | $30               |\n| Bikes        | 20 packages       | $10               |\n\nThe company has a budget of $1000 per day for fuel costs. The company aims to maximize the total number of packages delivered per dollar spent on fuel. Please help the company determine the optimal number of Trucks (T), Vans (V), and Bikes (B) to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nPackages_T = 100 * T\nPackages_V = 50 * V\nPackages_B = 20 * B\nFuel_Cost = 50 * T + 30 * V + 10 * B\n## the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Cost == Packages_T + Packages_V + Packages_B)\n\n# Add constraints\n## The company has a budget of $1000 per day for fuel costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load. For T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer. For T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer. For T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer. For T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer. For T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer. The company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity. The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter. The company has a total of 100 trucks available. Please help the company determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production costs and automation investments.\n// (100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// Automation <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n// ProdA <= 500; ProdB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductC are produced.\n// ProdC >= 100\n\n## Generate Constraint-5:\nThe total production quantity of all products must not exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| ProductA | $100                            | $150                   |\n| ProductB | $150                            | $200                   |\n| ProductC | $200                            | $250                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The company has a total budget of $100,000 for production costs and automation investments. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units. The company must ensure that at least 100 units of ProductC are produced. The total production quantity of all products must not exceed 1000 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\nProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\nProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons((100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000)\nmodel.addCons(Automation <= 20000)\nmodel.addCons(ProdA <= 500)\nmodel.addCons(ProdB <= 400)\nmodel.addCons(ProdC >= 100)\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1470,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The goal is to optimize the production schedule to maximize profit while adhering to certain operational constraints.\n// {\"number of units of product A on line 1\": \"A_Line1\", \"range\": \"A_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A on line 2\": \"A_Line2\", \"range\": \"A_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 1\": \"B_Line1\", \"range\": \"B_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 2\": \"B_Line2\", \"range\": \"B_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 1\": \"C_Line1\", \"range\": \"C_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 2\": \"C_Line2\", \"range\": \"C_Line2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production on line 1 is $20 per unit, and on line 2 is $30 per unit. The manufacturer aims to maximize the total profit from all products.\n// Profit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\n// Profit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\n// Profit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of line 1 is 100 units per day.\n// A_Line1 + B_Line1 + C_Line1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity of line 2 is 150 units per day.\n// A_Line2 + B_Line2 + C_Line2 <= 150\n\n## Generate Constraint-3:\nThe total daily demand for product A is at least 50 units, for product B is at least 60 units, and for product C is at least 70 units.\n// A_Line1 + A_Line2 >= 50\n// B_Line1 + B_Line2 >= 60\n// C_Line1 + C_Line2 >= 70",
        "question": "A manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The goal is to optimize the production schedule to maximize profit while adhering to certain operational constraints. The profit per unit and the cost of production on each line are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit on Line 1 | Cost per Unit on Line 2 |\n|---------|-----------------|-------------------------|-------------------------|\n| A       | $50             | $20                     | $30                     |\n| B       | $70             | $20                     | $30                     |\n| C       | $60             | $20                     | $30                     |\n\nThe total production capacity of line 1 is 100 units per day, and the total production capacity of line 2 is 150 units per day. The total daily demand for product A is at least 50 units, for product B is at least 60 units, and for product C is at least 70 units.\n\nPlease help the manufacturer to maximize the total profit from all products while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_Line1 = model.addVar(vtype=\"INTEGER\", name=\"A_Line1\", lb=0) # number of units of product A on line 1\nA_Line2 = model.addVar(vtype=\"INTEGER\", name=\"A_Line2\", lb=0) # number of units of product A on line 2\nB_Line1 = model.addVar(vtype=\"INTEGER\", name=\"B_Line1\", lb=0) # number of units of product B on line 1\nB_Line2 = model.addVar(vtype=\"INTEGER\", name=\"B_Line2\", lb=0) # number of units of product B on line 2\nC_Line1 = model.addVar(vtype=\"INTEGER\", name=\"C_Line1\", lb=0) # number of units of product C on line 1\nC_Line2 = model.addVar(vtype=\"INTEGER\", name=\"C_Line2\", lb=0) # number of units of product C on line 2\n\n# Define objective function\nProfit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\nProfit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\nProfit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A_Line1 + B_Line1 + C_Line1 <= 100) # Total production capacity of line 1\nmodel.addCons(A_Line2 + B_Line2 + C_Line2 <= 150) # Total production capacity of line 2\nmodel.addCons(A_Line1 + A_Line2 >= 50) # Total daily demand for product A\nmodel.addCons(B_Line1 + B_Line2 >= 60) # Total daily demand for product B\nmodel.addCons(C_Line1 + C_Line2 >= 70) # Total daily demand for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A on Line 1: \", model.getVal(A_Line1))\n    print(\"Number of Product A on Line 2: \", model.getVal(A_Line2))\n    print(\"Number of Product B on Line 1: \", model.getVal(B_Line1))\n    print(\"Number of Product B on Line 2: \", model.getVal(B_Line2))\n    print(\"Number of Product C on Line 1: \", model.getVal(C_Line1))\n    print(\"Number of Product C on Line 2: \", model.getVal(C_Line2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): compact, mid-size, and luxury. The company needs to decide on the production quantities of each type of EV to maximize profit while considering various constraints.\n// {\"quantity of compact EVs\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of mid-size EVs\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"quantity of luxury EVs\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for compact EVs is $10,000, for mid-size EVs is $15,000, and for luxury EVs is $20,000. The production cost per unit for compact EVs is $5,000, for mid-size EVs is $10,000, and for luxury EVs is $15,000. The company aims to maximize the total profit.\n// Profit_C = (10000 - 5000) * C = 5000 * C\n// Profit_M = (15000 - 10000) * M = 5000 * M\n// Profit_L = (20000 - 15000) * L = 5000 * L\n// So, the objective function is: Maximize (5000 * C + 5000 * M + 5000 * L)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1500 hours. The production time for compact EVs is 10 hours, for mid-size EVs is 15 hours, and for luxury EVs is 20 hours.\n// 10 * C + 15 * M + 20 * L <= 1500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for production costs.\n// 5000 * C + 10000 * M + 15000 * L <= 1000000\n\n## Generate Constraint-3:\nThe market demand for compact EVs is 50 units, for mid-size EVs is 75 units, and for luxury EVs is 100 units.\n// C <= 50\n// M <= 75\n// L <= 100\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, ensuring that the ratio of compact to mid-size to luxury EVs does not exceed 2:1.5:2.\n// C / M <= 2 / 1.5\n// M / L <= 1.5 / 2",
        "question": "A manufacturer produces three types of electric vehicles (EVs): compact, mid-size, and luxury. The company needs to decide on the production quantities of each type of EV to maximize profit while considering various constraints. The profit and production cost per unit for each type of EV are given in the following Table.\n\n| Type        | Profit per Unit | Production Cost per Unit |\n|-------------|-----------------|--------------------------|\n| Compact EVs | $10,000         | $5,000                   |\n| Mid-size EVs| $15,000         | $10,000                  |\n| Luxury EVs  | $20,000         | $15,000                  |\n\nThe company has a limited production capacity of 1500 hours. The production time for compact EVs is 10 hours, for mid-size EVs is 15 hours, and for luxury EVs is 20 hours. The company has a budget of $1,000,000 for production costs. The market demand for compact EVs is 50 units, for mid-size EVs is 75 units, and for luxury EVs is 100 units. The company aims to maintain a balanced production, ensuring that the ratio of compact to mid-size to luxury EVs does not exceed 2:1.5:2.\n\nPlease help the company to maximize the total profit by determining the optimal production quantities of compact (C), mid-size (M), and luxury (L) EVs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of compact EVs\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # quantity of mid-size EVs\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # quantity of luxury EVs\n\n# Define objective function\nProfit_C = 5000 * C\nProfit_M = 5000 * M\nProfit_L = 5000 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_C + Profit_M + Profit_L)\n\n# Add constraints\n## Constraint-1: Production capacity\nmodel.addCons(10 * C + 15 * M + 20 * L <= 1500)\n## Constraint-2: Budget for production costs\nmodel.addCons(5000 * C + 10000 * M + 15000 * L <= 1000000)\n## Constraint-3: Market demand\nmodel.addCons(C <= 50)\nmodel.addCons(M <= 75)\nmodel.addCons(L <= 100)\n## Constraint-4: Balanced production ratio\nmodel.addCons(C / M <= 2 / 1.5)\nmodel.addCons(M / L <= 1.5 / 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Compact EVs: \", model.getVal(C))\n    print(\"Quantity of Mid-size EVs: \", model.getVal(M))\n    print(\"Quantity of Luxury EVs: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceA_Units\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceB_Units\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceC_Units\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 400 units per month.\n// DeviceA_Units <= 400\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 200 units of DeviceB to be produced per month.\n// DeviceB_Units >= 200\n\n## Generate Constraint-4:\nThe production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\n// DeviceC_Units <= 300\n\n## Generate Constraint-5:\nTo maintain a balanced product portfolio, the company wants to ensure that the ratio of DeviceA to DeviceC does not exceed 2:1.\n// DeviceA_Units <= 2 * DeviceC_Units",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from selling all devices.\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month. Due to market saturation, the production of DeviceA should not exceed 400 units per month. The company has a contract that requires at least 200 units of DeviceB to be produced per month. The production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month. To maintain a balanced product portfolio, the company wants to ensure that the ratio of DeviceA to DeviceC does not exceed 2:1.\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)  # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceA_Units\nProfit_DeviceB = (70 - 40) * DeviceB_Units\nProfit_DeviceC = (60 - 35) * DeviceC_Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)  # Constraint-1\nmodel.addCons(DeviceA_Units <= 400)  # Constraint-2\nmodel.addCons(DeviceB_Units >= 200)  # Constraint-3\nmodel.addCons(DeviceC_Units <= 300)  # Constraint-4\nmodel.addCons(DeviceA_Units <= 2 * DeviceC_Units)  # Constraint-5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company has 4 different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each type of device. The efficiency is measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota.\n// Efficiency for device 1: E1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\n// Efficiency for device 2: E2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\n// Efficiency for device 3: E3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n// The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3.\n// Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for assignment.\n// P1 + P2 + P3 + P4 <= 50",
        "question": "A manufacturing company produces 3 types of electronic devices and has 4 different production lines. The company needs to determine the number of workers to assign to each line to optimize production efficiency. Each production line has a different efficiency in producing each type of device, measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota: at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3. There are a total of 50 workers available for assignment.\nPlease help the company maximize the minimum production rate of the three devices, which is defined as the minimum of (1000 divided by the efficiency of device 1, 1500 divided by the efficiency of device 2, and 2000 divided by the efficiency of device 3).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of workers on production line 4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Efficiency for device 1: E1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\n## Efficiency for device 2: E2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\n## Efficiency for device 3: E3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\nE1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\nE2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\nE3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n\n## The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3.\n## Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n## Convert the division to multiplication\nmodel.addCons(obj * E1 >= 1000)\nmodel.addCons(obj * E2 >= 1500)\nmodel.addCons(obj * E3 >= 2000)\n\n# Add constraints\n## There are a total of 50 workers available for assignment.\nmodel.addCons(P1 + P2 + P3 + P4 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Number of Workers on Production Line 4: \", model.getVal(P4))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\n// TruckC <= TruckA + 10\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the total trucks are TruckE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. Each type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company has a total budget of $150,000 for operational costs for the month. The company has a limit of 100 trucks that can be deployed in total. Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10. The company wants to ensure that at least 20% of the total trucks are TruckE. \n\nPlease help the company to maximize the total daily net profit (revenue minus operational cost) per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\nmodel.addCons(TruckC <= TruckA + 10)\n## The company wants to ensure that at least 20% of the total trucks are TruckE.\nmodel.addCons(TruckE >= 0.2 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and technology investments.\n// FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to Route1 and invest at least $10,000 in fuel-efficient technologies for Route2.\n// Trucks1 >= 100; TechInvest2 >= 10000\n\n## Generate Constraint-4:\nThe fuel optimization for each route must not exceed the maximum capacity of the fuel systems, which is 20 units for Route1 and 25 units for Route2.\n// FuelOpt1 <= 20; FuelOpt2 <= 25",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\nThe company has a total budget of $100,000 for fuel optimization and technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to Route1 and invest at least $10,000 in fuel-efficient technologies for Route2. The fuel optimization for each route must not exceed the maximum capacity of the fuel systems, which is 20 units for Route1 and 25 units for Route2.\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Route1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Route2\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technology for Route1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=10000)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\nConsumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\nConsumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\nmodel.addCons(FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 <= 500)\nmodel.addCons(Trucks1 >= 100)\nmodel.addCons(FuelOpt1 <= 20)\nmodel.addCons(FuelOpt2 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3.\n// {\"number of Type1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Type1 trucks\": \"FEU1\", \"range\": \"FEU1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type2 trucks\": \"FEU2\", \"range\": \"FEU2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type3 trucks\": \"FEU3\", \"range\": \"FEU3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n// Fuel cost for Type1 trucks: FC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\n// Fuel cost for Type2 trucks: FC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\n// Fuel cost for Type3 trucks: FC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\n// Upgrade cost: UC = 100 * (FEU1 + FEU2 + FEU3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency upgrades.\n// 100 * (FEU1 + FEU2 + FEU3) <= 50000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3. The fuel cost per kilometer and the effect of fuel efficiency upgrades are given in the following Table.\n\n| Truck Type | Fuel Cost per Kilometer | Fuel Efficiency Upgrade Effect |\n|------------|-------------------------|--------------------------------|\n| Type1      | $0.50                   | 0.01 liters/km per $100       |\n| Type2      | $0.60                   | 0.01 liters/km per $100       |\n| Type3      | $0.70                   | 0.01 liters/km per $100       |\n\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The company operates a total of 10,000 kilometers per month. The company has a budget of $50,000 for fuel efficiency upgrades.\n\nPlease help the company to determine the optimal number of trucks of each type and the appropriate fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of Type1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of Type2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Type3 trucks\nFEU1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU1\", lb=0) # fuel efficiency upgrade for Type1 trucks\nFEU2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU2\", lb=0) # fuel efficiency upgrade for Type2 trucks\nFEU3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU3\", lb=0) # fuel efficiency upgrade for Type3 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\nFC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\nFC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\nUC = 100 * (FEU1 + FEU2 + FEU3)\n## the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\nmodel.addCons(obj == FC1 + FC2 + FC3 + UC)\n\n# Add constraints\n## The company has a budget of $50,000 for fuel efficiency upgrades.\nmodel.addCons(100 * (FEU1 + FEU2 + FEU3) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type3 Trucks: \", model.getVal(T3))\n    print(\"Fuel Efficiency Upgrade for Type1: \", model.getVal(FEU1))\n    print(\"Fuel Efficiency Upgrade for Type2: \", model.getVal(FEU2))\n    print(\"Fuel Efficiency Upgrade for Type3: \", model.getVal(FEU3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation.\n// {\"production quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvest\", \"range\": \"AutomationInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n// Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n// Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvest <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation. The production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units for the quarter. The total investment in automation technology cannot exceed $50,000. Please help the company to determine the optimal production quantities and investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity of DeviceC\nAutomationInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvest\", lb=0) # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n## Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n## Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\nProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\nProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\nProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Investment in Automation: \", model.getVal(AutomationInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Trucks\": \"FuelEffTrucks\", \"range\": \"FuelEffTrucks >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Vans\": \"FuelEffVans\", \"range\": \"FuelEffVans >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Bikes\": \"FuelEffBikes\", \"range\": \"FuelEffBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies.\n// DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n// OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n// The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1.\n// 3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and management constraints.\n// Trucks + Vans + Bikes <= 100\n\n## Generate Constraint-3:\nThe company must maintain a minimum fleet of 10 Trucks and 20 Vans to meet contractual obligations.\n// Trucks >= 10; Vans >= 20\n\n## Generate Constraint-4:\nThe fuel efficiency of each type of vehicle must be at least 5 units per gallon.\n// FuelEffTrucks >= 5; FuelEffVans >= 5; FuelEffBikes >= 5",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities. The company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies, defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies. The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The total number of vehicles cannot exceed 100 due to parking and management constraints. The company must maintain a minimum fleet of 10 Trucks and 20 Vans to meet contractual obligations. The fuel efficiency of each type of vehicle must be at least 5 units per gallon. Please help the company to maximize the objective function, which is the difference between the delivery efficiency and the operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=10)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=20)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nFuelEffTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffTrucks\", lb=5)  # fuel efficiency of Trucks\nFuelEffVans = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffVans\", lb=5)  # fuel efficiency of Vans\nFuelEffBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffBikes\", lb=5)  # fuel efficiency of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n## OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n## The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * (Trucks**2 + Vans**2 + Bikes**2) == Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes)\nmodel.addCons(obj * (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) == Trucks * FuelEffTrucks**2 + Vans * FuelEffVans**2 + Bikes * FuelEffBikes**2)\n\n# Add constraints\n## The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance.\nmodel.addCons(3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000)\n## The total number of vehicles cannot exceed 100 due to parking and management constraints.\nmodel.addCons(Trucks + Vans + Bikes <= 100)\n## The company must maintain a minimum fleet of 10 Trucks and 20 Vans to meet contractual obligations.\nmodel.addCons(Trucks >= 10)\nmodel.addCons(Vans >= 20)\n## The fuel efficiency of each type of vehicle must be at least 5 units per gallon.\nmodel.addCons(FuelEffTrucks >= 5)\nmodel.addCons(FuelEffVans >= 5)\nmodel.addCons(FuelEffBikes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Fuel Efficiency of Trucks: \", model.getVal(FuelEffTrucks))\n    print(\"Fuel Efficiency of Vans: \", model.getVal(FuelEffVans))\n    print(\"Fuel Efficiency of Bikes: \", model.getVal(FuelEffBikes))\n    print(\"Maximized Efficiency - Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\n// B >= 0.1 * (T + V + B)\n\n## Generate Constraint-4:\nThe company has a daily revenue target of $20,000.\n// 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. The details of each vehicle type are given in the following Table.\n\n| Vehicle | Revenue per Trip | Fuel Consumption per Trip | Number of Trips per Day |\n|---------|------------------|---------------------------|--------------------------|\n| Trucks  | $1000            | 50 liters                 | 2                        |\n| Vans    | $500             | 20 liters                 | 3                        |\n| Bikes   | $100             | 1 liter                   | 5                        |\n\nThe company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery. The company has a daily revenue target of $20,000. \nPlease help the company to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\nmodel.addCons(B >= 0.1 * (T + V + B))\n## The company has a daily revenue target of $20,000.\nmodel.addCons(1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Daily Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for route 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for route 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The cost decreases as the fuel allocation increases, but at a decreasing rate. The company aims to minimize the total fuel cost for all routes.\n// Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n// Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n// Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total fuel budget for the company is $10,000.\n// Fuel1 + Fuel2 + Fuel3 <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// Truck1 + Truck2 + Truck3 <= 50\n\n## Generate Constraint-3:\nEach route must be completed with at least 5 trucks.\n// Truck1 >= 5; Truck2 >= 5; Truck3 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The company aims to minimize the total fuel cost for all routes. The total fuel budget for the company is $10,000. The company has a maximum of 50 trucks available. Each route must be completed with at least 5 trucks. Please help the company to determine the optimal number of trucks and fuel allocation for each route to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5)  # number of trucks for route 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=5)  # number of trucks for route 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=5)  # number of trucks for route 3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for route 1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for route 2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for route 3\n\n# Define objective function\n# Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n# Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n# Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = model.addVar(name=\"Cost1\")\nCost2 = model.addVar(name=\"Cost2\")\nCost3 = model.addVar(name=\"Cost3\")\nmodel.addCons(Cost1 == (1000 / (1 + 1 / (1 + Fuel1 * 0.05))) * Truck1)\nmodel.addCons(Cost2 == (1200 / (1 + 1 / (1 + Fuel2 * 0.05))) * Truck2)\nmodel.addCons(Cost3 == (1100 / (1 + 1 / (1 + Fuel3 * 0.05))) * Truck3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 <= 10000)\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Truck3))\n    print(\"Fuel Allocation for Route 1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route 2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route 3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different fuel efficiency and capacity. The company needs to decide how many trips each vehicle should make to optimize its logistics operations.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each vehicle is a nonlinear function of the number of trips due to varying fuel costs and maintenance expenses. The cost per trip for Truck1 is $100 + $5 * (Trips1)^2. The cost per trip for Truck2 is $150 + $4 * (Trips2)^2. The cost per trip for Truck3 is $200 + $3 * (Trips3)^2. The cost per trip for Truck4 is $250 + $2 * (Trips4)^2. The cost per trip for Truck5 is $300 + $1 * (Trips5)^2. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost: Cost = (100 + 5 * (Trips1)^2) * Trips1 + (150 + 4 * (Trips2)^2) * Trips2 + (200 + 3 * (Trips3)^2) * Trips3 + (250 + 2 * (Trips4)^2) * Trips4 + (300 + 1 * (Trips5)^2) * Trips5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500",
        "question": "A logistics company is planning its routes for the next quarter and operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different fuel efficiency and capacity. The company needs to decide how many trips each vehicle should make to optimize its logistics operations. The cost of operating each vehicle per trip is a nonlinear function of the number of trips due to varying fuel costs and maintenance expenses, as shown in the following Table.\n\n| Vehicle  | Cost per Trip Formula                  |\n|----------|----------------------------------------|\n| Truck1   | $100 + $5 * (Trips1)^2                 |\n| Truck2   | $150 + $4 * (Trips2)^2                 |\n| Truck3   | $200 + $3 * (Trips3)^2                 |\n| Truck4   | $250 + $2 * (Trips4)^2                 |\n| Truck5   | $300 + $1 * (Trips5)^2                 |\n\nThe company aims to minimize the total operational cost of all vehicles. The total number of trips across all vehicles must not exceed 500. Please help the company determine the optimal number of trips for each vehicle to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Truck5\n\n# Define objective function\n## The cost of operating each vehicle is a nonlinear function of the number of trips\nCost1 = (100 + 5 * Trips1**2) * Trips1\nCost2 = (150 + 4 * Trips2**2) * Trips2\nCost3 = (200 + 3 * Trips3**2) * Trips3\nCost4 = (250 + 2 * Trips4**2) * Trips4\nCost5 = (300 + 1 * Trips5**2) * Trips5\n## Total operational cost\nCost = Cost1 + Cost2 + Cost3 + Cost4 + Cost5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total number of trips across all vehicles must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of trips for Truck5: \", model.getVal(Trips5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for E1 is $30,000, with a production cost per unit of $20,000 and a carbon footprint per unit of 100 kg CO2. \nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the carbon footprint per unit is 150 kg CO2. \nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the carbon footprint per unit is 200 kg CO2.\nThe manufacturer aims to maximize the net revenue per unit of carbon footprint.\n// Profit_E1 = (30000 * E1 - 20000 * E1) / 100\n// Profit_E2 = (40000 * E2 - 25000 * E2) / 150\n// Profit_E3 = (50000 * E3 - 30000 * E3) / 200\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50\n\n## Generate Constraint-2:\nThe total carbon footprint allowed for all vehicles is 8000 kg CO2.\n// 100 * E1 + 150 * E2 + 200 * E3 <= 8000\n\n## Generate Constraint-3:\nThe manufacturer has a budget of $1,200,000 for production costs.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1200000\n\n## Generate Constraint-4:\nThe market demand for E1 is 20 units. So, the manufacturer can only sell a maximum of 20 units of E1.\n// E1 <= 20\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 5 units of E2 to meet contractual obligations.\n// E2 >= 5",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and carbon footprint per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Carbon Footprint per Unit |\n|--------------|------------------|--------------------------|---------------------------|\n| E1           | $30,000          | $20,000                  | 100 kg CO2                |\n| E2           | $40,000          | $25,000                  | 150 kg CO2                |\n| E3           | $50,000          | $30,000                  | 200 kg CO2                |\n\nThe manufacturer has a total production capacity of 50 vehicles. The total carbon footprint allowed for all vehicles is 8000 kg CO2. The manufacturer has a budget of $1,200,000 for production costs. The market demand for E1 is 20 units, so the manufacturer can only sell a maximum of 20 units of E1. The manufacturer must produce at least 5 units of E2 to meet contractual obligations.\n\nPlease help the manufacturer to maximize the net revenue per unit of carbon footprint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=20)  # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=5, ub=50)  # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0, ub=50)  # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30000 * E1 - 20000 * E1) / 100\nProfit_E2 = (40000 * E2 - 25000 * E2) / 150\nProfit_E3 = (50000 * E3 - 30000 * E3) / 200\n## convert the division to multiplication\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a total production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n## The total carbon footprint allowed for all vehicles is 8000 kg CO2.\nmodel.addCons(100 * E1 + 150 * E2 + 200 * E3 <= 8000)\n## The manufacturer has a budget of $1,200,000 for production costs.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1200000)\n## The market demand for E1 is 20 units. So, the manufacturer can only sell a maximum of 20 units of E1.\nmodel.addCons(E1 <= 20)\n## The manufacturer must produce at least 5 units of E2 to meet contractual obligations.\nmodel.addCons(E2 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Unit of Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Buses\": \"Buses\", \"range\": \"Buses >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"Sedans\", \"range\": \"Sedans >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of vehicle varies, as does the revenue generated per vehicle. The cost of Trucks is $100,000 with a maintenance cost of $10,000 per year, and they generate $50,000 per year. Vans cost $50,000 with a maintenance cost of $5,000 per year, and they generate $30,000 per year. Buses cost $80,000 with a maintenance cost of $8,000 per year, and they generate $40,000 per year. Sedans cost $30,000 with a maintenance cost of $3,000 per year, and they generate $20,000 per year. Motorcycles cost $10,000 with a maintenance cost of $1,000 per year, and they generate $10,000 per year. The company wants to maximize the net profit per vehicle.\n// Total net profit for Trucks: Profit_Trucks = 50,000 * Trucks - (100,000 * Trucks + 10,000 * Trucks)\n// Total net profit for Vans: Profit_Vans = 30,000 * Vans - (50,000 * Vans + 5,000 * Vans)\n// Total net profit for Buses: Profit_Buses = 40,000 * Buses - (80,000 * Buses + 8,000 * Buses)\n// Total net profit for Sedans: Profit_Sedans = 20,000 * Sedans - (30,000 * Sedans + 3,000 * Sedans)\n// Total net profit for Motorcycles: Profit_Motorcycles = 10,000 * Motorcycles - (10,000 * Motorcycles + 1,000 * Motorcycles)\n// So, the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / (Trucks + Vans + Buses + Sedans + Motorcycles))\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing vehicles.\n// 100,000 * Trucks + 50,000 * Vans + 80,000 * Buses + 30,000 * Sedans + 10,000 * Motorcycles <= 5,000,000",
        "question": "A logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation. The cost of purchasing and maintaining each type of vehicle, as well as the revenue generated per vehicle, are given in the following Table.\n\n| Vehicle Type | Purchase Cost | Maintenance Cost per Year | Annual Revenue |\n|--------------|---------------|---------------------------|----------------|\n| Trucks       | $100,000      | $10,000                   | $50,000        |\n| Vans         | $50,000       | $5,000                    | $30,000        |\n| Buses        | $80,000       | $8,000                    | $40,000        |\n| Sedans       | $30,000       | $3,000                    | $20,000        |\n| Motorcycles  | $10,000       | $1,000                    | $10,000        |\n\nThe company has a budget of $5,000,000 for purchasing vehicles. The company wants to maximize the net profit per vehicle. Please help the company determine the optimal number of each type of vehicle to purchase and maintain.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBuses = model.addVar(vtype=\"INTEGER\", name=\"Buses\", lb=0) # number of Buses\nSedans = model.addVar(vtype=\"INTEGER\", name=\"Sedans\", lb=0) # number of Sedans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0) # number of Motorcycles\n\n# Define objective function\n## Total net profit for Trucks: Profit_Trucks = 50,000 * Trucks - (100,000 * Trucks + 10,000 * Trucks)\n## Total net profit for Vans: Profit_Vans = 30,000 * Vans - (50,000 * Vans + 5,000 * Vans)\n## Total net profit for Buses: Profit_Buses = 40,000 * Buses - (80,000 * Buses + 8,000 * Buses)\n## Total net profit for Sedans: Profit_Sedans = 20,000 * Sedans - (30,000 * Sedans + 3,000 * Sedans)\n## Total net profit for Motorcycles: Profit_Motorcycles = 10,000 * Motorcycles - (10,000 * Motorcycles + 1,000 * Motorcycles)\nProfit_Trucks = 50000 * Trucks - (100000 * Trucks + 10000 * Trucks)\nProfit_Vans = 30000 * Vans - (50000 * Vans + 5000 * Vans)\nProfit_Buses = 40000 * Buses - (80000 * Buses + 8000 * Buses)\nProfit_Sedans = 20000 * Sedans - (30000 * Sedans + 3000 * Sedans)\nProfit_Motorcycles = 10000 * Motorcycles - (10000 * Motorcycles + 1000 * Motorcycles)\nTotal_Vehicles = Trucks + Vans + Buses + Sedans + Motorcycles\n## So, the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / Total_Vehicles)\n## convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Total_Vehicles == Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing vehicles.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 80000 * Buses + 30000 * Sedans + 10000 * Motorcycles <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Buses: \", model.getVal(Buses))\n    print(\"Number of Sedans: \", model.getVal(Sedans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Maximized Net Profit per Vehicle: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck, Van, and Motorcycle, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize operational costs. Additionally, the company must decide on the fuel efficiency upgrades for each vehicle type, which will affect the operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycles\": \"MotorcycleCount\", \"range\": \"MotorcycleCount >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Trucks\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Vans\": \"VanUpgrade\", \"range\": \"VanUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Motorcycles\": \"MotorcycleUpgrade\", \"range\": \"MotorcycleUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per vehicle is affected by the fuel efficiency upgrades. For Trucks, the base operational cost is $100 per day, and each $1000 invested in upgrades reduces the daily cost by $5. For Vans, the base operational cost is $70 per day, and each $1000 invested in upgrades reduces the daily cost by $3. For Motorcycles, the base operational cost is $30 per day, and each $1000 invested in upgrades reduces the daily cost by $2. The company aims to minimize the total daily operational cost of all vehicles.\n// Total cost for Trucks: CostTruck = 100 - 0.005 * TruckUpgrade * TruckCount\n// Total cost for Vans: CostVan = 70 - 0.003 * VanUpgrade * VanCount\n// Total cost for Motorcycles: CostMotorcycle = 30 - 0.002 * MotorcycleUpgrade * MotorcycleCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostMotorcycle)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle purchases and upgrades.\n// TruckCount + VanCount + MotorcycleCount + TruckUpgrade + VanUpgrade + MotorcycleUpgrade <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 500.\n// TruckCount + VanCount + MotorcycleCount <= 500",
        "question": "A logistics company operates three types of vehicles: Truck, Van, and Motorcycle, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type and the fuel efficiency upgrades for each to maximize efficiency and minimize operational costs. The operational cost per vehicle is affected by the fuel efficiency upgrades. The base operational costs and the effect of upgrades on these costs are given in the following Table.\n\n| Vehicle Type | Base Operational Cost | Effect of $1000 Upgrade on Daily Cost |\n|--------------|-----------------------|---------------------------------------|\n| Truck        | $100 per day          | Reduces daily cost by $5              |\n| Van          | $70 per day           | Reduces daily cost by $3              |\n| Motorcycle   | $30 per day           | Reduces daily cost by $2              |\n\nThe company has a total budget of $100,000 for vehicle purchases and upgrades. The total number of vehicles cannot exceed 500. Please help the company to minimize the total daily operational cost of all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nMotorcycleCount = model.addVar(vtype=\"INTEGER\", name=\"MotorcycleCount\", lb=0)  # number of Motorcycles\nTruckUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckUpgrade\", lb=0)  # fuel efficiency upgrade for Trucks\nVanUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"VanUpgrade\", lb=0)  # fuel efficiency upgrade for Vans\nMotorcycleUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"MotorcycleUpgrade\", lb=0)  # fuel efficiency upgrade for Motorcycles\n\n# Define objective function\nCostTruck = 100 - 0.005 * TruckUpgrade * TruckCount\nCostVan = 70 - 0.003 * VanUpgrade * VanCount\nCostMotorcycle = 30 - 0.002 * MotorcycleUpgrade * MotorcycleCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostMotorcycle)\n\n# Add constraints\nmodel.addCons(TruckCount + VanCount + MotorcycleCount + TruckUpgrade + VanUpgrade + MotorcycleUpgrade <= 100000)\nmodel.addCons(TruckCount + VanCount + MotorcycleCount <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Motorcycles: \", model.getVal(MotorcycleCount))\n    print(\"Truck Upgrade: \", model.getVal(TruckUpgrade))\n    print(\"Van Upgrade: \", model.getVal(VanUpgrade))\n    print(\"Motorcycle Upgrade: \", model.getVal(MotorcycleUpgrade))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000\n\n## Generate Constraint-2:\nThe total production of Component B must be at least 1500 units.\n// H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500\n\n## Generate Constraint-3:\nThe total production of Component C must be at least 2000 units.\n// H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000\n\n## Generate Constraint-4:\nEach facility has a maximum operational limit of 100 hours per week.\n// H1A + H1B + H1C <= 100\n// H2A + H2B + H2C <= 100\n// H3A + H3B + H3C <= 100\n// H4A + H4B + H4C <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated.\nThe total production of Component A must be at least 1000 units. The total production of Component B must be at least 1500 units. The total production of Component C must be at least 2000 units. Each facility has a maximum operational limit of 100 hours per week.\nPlease help the company to minimize the total cost of operation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0)  # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0)  # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0)  # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0)  # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0)  # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0)  # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0)  # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0)  # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0)  # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0)  # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0)  # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0)  # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000)  # Constraint-1\nmodel.addCons(H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500)  # Constraint-2\nmodel.addCons(H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000)  # Constraint-3\nmodel.addCons(H1A + H1B + H1C <= 100)  # Constraint-4\nmodel.addCons(H2A + H2B + H2C <= 100)  # Constraint-4\nmodel.addCons(H3A + H3B + H3C <= 100)  # Constraint-4\nmodel.addCons(H4A + H4B + H4C <= 100)  # Constraint-4\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"H1A: \", model.getVal(H1A))\n    print(\"H1B: \", model.getVal(H1B))\n    print(\"H1C: \", model.getVal(H1C))\n    print(\"H2A: \", model.getVal(H2A))\n    print(\"H2B: \", model.getVal(H2B))\n    print(\"H2C: \", model.getVal(H2C))\n    print(\"H3A: \", model.getVal(H3A))\n    print(\"H3B: \", model.getVal(H3B))\n    print(\"H3C: \", model.getVal(H3C))\n    print(\"H4A: \", model.getVal(H4A))\n    print(\"H4B: \", model.getVal(H4B))\n    print(\"H4C: \", model.getVal(H4C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different fuel consumption rate per kilometer and a varying distance. The company aims to minimize the total fuel consumption while ensuring all deliveries are made on time. The fuel consumption rate for each route is as follows:\n- Route 1: 0.5 liters/km\n- Route 2: 0.6 liters/km\n- Route 3: 0.4 liters/km\n- Route 4: 0.7 liters/km\n- Route 5: 0.55 liters/km\n- Route 6: 0.65 liters/km\nThe distances for each route are:\n- Route 1: 100 km\n- Route 2: 150 km\n- Route 3: 200 km\n- Route 4: 120 km\n- Route 5: 180 km\n- Route 6: 220 km\nThe objective is to minimize the total fuel consumption, which is a nonlinear function of the number of trucks and the fuel consumption rates.\n// Objective function: Minimize (0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe total delivery time for all routes must not exceed 8 hours. The time taken for each route is inversely proportional to the number of trucks allocated.\n// 100 / T1 + 150 / T2 + 200 / T3 + 120 / T4 + 180 / T5 + 220 / T6 <= 8 * 60 (converted to minutes)",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has a different fuel consumption rate per kilometer and a varying distance. The fuel consumption rate for each route is as follows:\n- Route 1: 0.5 liters/km\n- Route 2: 0.6 liters/km\n- Route 3: 0.4 liters/km\n- Route 4: 0.7 liters/km\n- Route 5: 0.55 liters/km\n- Route 6: 0.65 liters/km\nThe distances for each route are:\n- Route 1: 100 km\n- Route 2: 150 km\n- Route 3: 200 km\n- Route 4: 120 km\n- Route 5: 180 km\n- Route 6: 220 km\nThe company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks. The total delivery time for all routes must not exceed 8 hours. The time taken for each route is inversely proportional to the number of trucks allocated.\nPlease help the company to minimize the total fuel consumption, which is a nonlinear function of the number of trucks and the fuel consumption rates.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\nmodel.addCons(obj == 0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each route can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n## The total delivery time for all routes must not exceed 8 hours.\nmodel.addCons(100 / T1 + 150 / T2 + 200 / T3 + 120 / T4 + 180 / T5 + 220 / T6 <= 8 * 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each.\nThe medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each.\nThe large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each.\nThe company wants to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost.\n// TotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\n// TotalFuelConsumption = (10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks) / TotalCarryingCapacity\n// TotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n// So, the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has space to park a maximum of 20 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each. The medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each. The large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each. The company has a budget of $1,000,000 for purchasing new trucks and has space to park a maximum of 20 trucks. The company wants to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost. Please help the company to determine how many of each type of truck to purchase to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\nTotalFuelConsumption = 10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks\nTotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n## the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n## convert the division to multiplication\nmodel.addCons(obj * (TotalFuelConsumption + TotalPurchaseCost) == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n## The company has space to park a maximum of 20 trucks.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n// Total operational cost for Solar: CostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\n// Total operational cost for Wind: CostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\n// Total operational cost for Hydro: CostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\n// 50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000\n\n## Generate Constraint-2:\nThe total number of power units that can be installed is limited to 20 units.\n// SolarUnits + WindUnits + HydroUnits <= 20\n\n## Generate Constraint-3:\nDue to environmental regulations, the company must install at least 5 units of Hydro power plants.\n// HydroUnits >= 5",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced. The operational cost per unit of energy decreases with the investment in advanced technology as shown in the following Table.\n\n| Power Plant | Initial Cost per Unit | Reduction in Cost per $100 Tech Investment |\n|-------------|-----------------------|--------------------------------------------|\n| Solar       | $50                   | $2                                         |\n| Wind        | $60                   | $3                                         |\n| Hydro       | $40                   | $1.5                                       |\n\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology. The total number of power units that can be installed is limited to 20 units. Due to environmental regulations, the company must install at least 5 units of Hydro power plants.\n\nPlease help the company to minimize the total operational cost of all power plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=5)  # number of Hydro power units\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nCostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\nCostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\nCostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n# So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\nmodel.addCons(50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000)\n# The total number of power units that can be installed is limited to 20 units.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(TechInvestmentHydro))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n// Profit_ProductA = 50 * ProductAQty\n// Profit_ProductB = 70 * ProductBQty\n// Profit_ProductC = 60 * ProductCQty\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\n// (50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts. The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day. Please help the company to maximize the total profit from product sales minus the cost of additional shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProductAQty\nProfit_ProductB = 70 * ProductBQty\nProfit_ProductC = 60 * ProductCQty\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\nmodel.addCons((50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 693,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability.\n// {\"number of Small wind farms\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"investment in Small wind farms\": \"Investment_Small\", \"range\": \"Investment_Small >= 0\", \"type\": \"continuous\"}\n// {\"investment in Medium wind farms\": \"Investment_Medium\", \"range\": \"Investment_Medium >= 0\", \"type\": \"continuous\"}\n// {\"investment in Large wind farms\": \"Investment_Large\", \"range\": \"Investment_Large >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n// Energy_Small = 10 * Small + 0.001 * Investment_Small * Small\n// Energy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\n// Energy_Large = 30 * Large + 0.002 * Investment_Large * Large\n// So, the objective function is: Maximize (Energy_Small + Energy_Medium + Energy_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for construction and investment in wind farms.\n// 10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability. The energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n\n| Wind Farm Type | Base Energy Output (MWh) | Additional Energy Output per $1000 Investment (MWh) |\n|----------------|--------------------------|-----------------------------------------------------|\n| Small          | 10                       | 0.001                                               |\n| Medium         | 20                       | 0.0015                                              |\n| Large          | 30                       | 0.002                                               |\n\nThe company has a total budget of $1,000,000 for construction and investment in wind farms. The company wants to ensure that the total investment and construction costs do not exceed this budget.\n\nPlease help the company to maximize the total energy output from the wind farms.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of Small wind farms\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of Medium wind farms\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of Large wind farms\nInvestment_Small = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Small\", lb=0)  # investment in Small wind farms\nInvestment_Medium = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Medium\", lb=0)  # investment in Medium wind farms\nInvestment_Large = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Large\", lb=0)  # investment in Large wind farms\n\n# Define objective function\nEnergy_Small = 10 * Small + 0.001 * Investment_Small * Small\nEnergy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\nEnergy_Large = 30 * Large + 0.002 * Investment_Large * Large\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_Small + Energy_Medium + Energy_Large)\nmodel.addCons(obj == Energy_Small + Energy_Medium + Energy_Large)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for construction and investment in wind farms.\nmodel.addCons(10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small wind farms: \", model.getVal(Small))\n    print(\"Number of Medium wind farms: \", model.getVal(Medium))\n    print(\"Number of Large wind farms: \", model.getVal(Large))\n    print(\"Investment in Small wind farms: \", model.getVal(Investment_Small))\n    print(\"Investment in Medium wind farms: \", model.getVal(Investment_Medium))\n    print(\"Investment in Large wind farms: \", model.getVal(Investment_Large))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1511,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the cost per solar panel is $1000, the energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor D2, the cost per solar panel is $1200, the energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor D3, the cost per solar panel is $1100, the energy output per panel is 210 kWh, and the environmental impact score is 7.\nFor D4, the cost per solar panel is $900, the energy output per panel is 190 kWh, and the environmental impact score is 4.\nFor D5, the cost per solar panel is $1300, the energy output per panel is 230 kWh, and the environmental impact score is 8.\nThe city wants to minimize the Cost-Environmental Impact ratio of the installation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n// Total environmental impact score: Impact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\nFor D1, the cost per solar panel is $1000, the energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor D2, the cost per solar panel is $1200, the energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor D3, the cost per solar panel is $1100, the energy output per panel is 210 kWh, and the environmental impact score is 7.\nFor D4, the cost per solar panel is $900, the energy output per panel is 190 kWh, and the environmental impact score is 4.\nFor D5, the cost per solar panel is $1300, the energy output per panel is 230 kWh, and the environmental impact score is 8.\nThe city has a budget of $100,000 for the installation of solar panels.\nPlease help the city to minimize the Cost-Environmental Impact ratio of the installation (defined as the total cost divided by the total environmental impact score).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\nImpact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The production cost per unit of each component is a nonlinear function of the quantity produced, given by: Cost_A = 100 - 0.1 * A^2, Cost_B = 120 - 0.15 * B^2, Cost_C = 110 - 0.12 * C^2, Cost_D = 130 - 0.18 * D^2, Cost_E = 140 - 0.2 * E^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Total revenue = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total cost = (100 - 0.1 * A^2) * A + (120 - 0.15 * B^2) * B + (110 - 0.12 * C^2) * C + (130 - 0.18 * D^2) * D + (140 - 0.2 * E^2) * E\n// So, the objective function is: Maximize (Total revenue - Total cost)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe demand for component A must be met, which is at least 200 units.\n// A >= 200\n\n## Generate Constraint-3:\nThe production of component E should not exceed 30% of the total production.\n// E <= 0.3 * (A + B + C + D + E)",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints. The profit per unit and the production cost per unit of each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|---------------------------|\n| A         | $50             | 100 - 0.1 * A^2          |\n| B         | $70             | 120 - 0.15 * B^2         |\n| C         | $60             | 110 - 0.12 * C^2         |\n| D         | $80             | 130 - 0.18 * D^2         |\n| E         | $90             | 140 - 0.2 * E^2          |\n\nThe company has a total production capacity of 1000 units across all components. The demand for component A must be met, which is at least 200 units. The production of component E should not exceed 30% of the total production.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)    # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # quantity of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0)    # quantity of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)    # quantity of component E\n\n# Define objective function\n## Total revenue and cost calculation\nTotal_revenue = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost_A = (100 - 0.1 * A**2) * A\nCost_B = (120 - 0.15 * B**2) * B\nCost_C = (110 - 0.12 * C**2) * C\nCost_D = (130 - 0.18 * D**2) * D\nCost_E = (140 - 0.2 * E**2) * E\nTotal_cost = Cost_A + Cost_B + Cost_C + Cost_D + Cost_E\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Total revenue - Total cost)\nmodel.addCons(obj == Total_revenue - Total_cost)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The demand for component A must be met, which is at least 200 units.\nmodel.addCons(A >= 200)\n## The production of component E should not exceed 30% of the total production.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Quantity of Component D: \", model.getVal(D))\n    print(\"Quantity of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"capacity of the battery storage system\": \"Battery\", \"range\": \"Battery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing one solar panel at each site is $1000, and the expected energy generation per panel is 100 kWh. The cost of installing one wind turbine at each site is $2000, and the expected energy generation per turbine is 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n// Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n// Total energy generation = 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC)\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n// 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for the installation.\n// 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery <= 500000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy. The cost of installing one solar panel at each site is $1000, and the expected energy generation per panel is 100 kWh. The cost of installing one wind turbine at each site is $2000, and the expected energy generation per turbine is 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n\n| Equipment | Cost per Unit | Energy Generation per Unit |\n|-----------|---------------|-----------------------------|\n| Solar Panel (Site A, B, C) | $1000 | 100 kWh |\n| Wind Turbine (Site A, B, C) | $2000 | 200 kWh |\n| Battery Storage | $50 per kWh | - |\n\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh. The company has a budget of $500,000 for the installation.\n\nPlease help the company to minimize the total cost of installation while meeting the energy demand and budget constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Site A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Site B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Site C\nBattery = model.addVar(vtype=\"CONTINUOUS\", name=\"Battery\", lb=0) # capacity of the battery storage system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\nTotalCost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\nmodel.addCons(100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000)\n## The company has a budget of $500,000 for the installation.\nmodel.addCons(1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Site B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Site C: \", model.getVal(WindC))\n    print(\"Capacity of Battery Storage System: \", model.getVal(Battery))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each DeviceB produced. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each DeviceA produced. The profit per unit for DeviceC is $60, but it decreases by $0.2 for each DeviceD produced. The profit per unit for DeviceD is $80, but it decreases by $0.15 for each DeviceC produced. The profit per unit for DeviceE is $90, but it decreases by $0.1 for each DeviceA and DeviceB produced. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n// Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n// Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n// Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n// Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\n// DeviceA >= 2 * DeviceB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40.\n// 20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each device type has at least some minimal production to maintain market presence.\n// DeviceA >= 10; DeviceB >= 5; DeviceC >= 15; DeviceD >= 20; DeviceE >= 25",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each DeviceB produced. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each DeviceA produced. The profit per unit for DeviceC is $60, but it decreases by $0.2 for each DeviceD produced. The profit per unit for DeviceD is $80, but it decreases by $0.15 for each DeviceC produced. The profit per unit for DeviceE is $90, but it decreases by $0.1 for each DeviceA and DeviceB produced. The company has a total production capacity of 1000 units for all devices combined. Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB. The company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40. The company wants to ensure that each device type has at least some minimal production to maintain market presence, with DeviceA at least 10 units, DeviceB at least 5 units, DeviceC at least 15 units, DeviceD at least 20 units, and DeviceE at least 25 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=10) # number of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=5) # number of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=15) # number of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=20) # number of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=25) # number of DeviceE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n## Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n## Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n## Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n## Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\nProfit_A = (50 - 0.1 * DeviceB) * DeviceA\nProfit_B = (70 - 0.05 * DeviceA) * DeviceB\nProfit_C = (60 - 0.2 * DeviceD) * DeviceC\nProfit_D = (80 - 0.15 * DeviceC) * DeviceD\nProfit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000)\n## Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\nmodel.addCons(DeviceA >= 2 * DeviceB)\n## The company has a budget of $50,000 for production costs for all devices.\nmodel.addCons(20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1402,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantity of each product and the amount of money to be invested in enhancing the production efficiency, which will reduce the production cost per unit. The production cost reduction is nonlinear and depends on the investment.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The investment in production efficiency reduces the production cost per unit by $0.01 for every $1000 invested. The selling price per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.0001 * EfficiencyInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.0001 * EfficiencyInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.0001 * EfficiencyInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity for all products cannot exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in production efficiency cannot exceed $50,000.\n// EfficiencyInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantity of each product and the amount of money to be invested in enhancing the production efficiency, which will reduce the production cost per unit. The production cost reduction is nonlinear and depends on the investment. The production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The investment in production efficiency reduces the production cost per unit by $0.01 for every $1000 invested. The selling price per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Production Cost per Unit |\n|---------|---------------|--------------------------|\n| ProductA | $100          | $50                      |\n| ProductB | $120          | $70                      |\n| ProductC | $150          | $90                      |\n\nThe total production quantity for all products cannot exceed 1000 units. The total investment in production efficiency cannot exceed $50,000. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - (50 - 0.0001 * EfficiencyInvestment)) * QuantityA\nProfitB = (120 - (70 - 0.0001 * EfficiencyInvestment)) * QuantityB\nProfitC = (150 - (90 - 0.0001 * EfficiencyInvestment)) * QuantityC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production quantity for all products cannot exceed 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n## The total investment in production efficiency cannot exceed $50,000.\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n// Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n// Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n// Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n// Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n// Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n// So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trucks of each type are deployed.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 100 drivers available for the upcoming month.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month. The company wants to ensure that at least 5 trucks of each type are deployed. The company has a total of 100 drivers available for the upcoming month. The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C. The company also wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nPlease help the company to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks E\n\n# Define objective function\n## Ton-kilometers per liter for each truck type\nTkm_A = 10 * 5 * A\nTkm_B = 15 * 7 * B\nTkm_C = 20 * 9 * C\nTkm_D = 25 * 11 * D\nTkm_E = 30 * 13 * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\nmodel.addCons(obj == Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing fuel for the upcoming month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50000)\n## The company has a total of 100 drivers available for the upcoming month.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Ton-kilometers per liter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit from each device is calculated based on the selling price minus the production cost, which varies per device and is affected by the quantity produced due to economies of scale. The profit per unit for each device is given in the following Table.\n\n| Device       | Profit per Unit Formula                |\n|--------------|----------------------------------------|\n| Smartphones  | $100 - 0.1 * Smartphones               |\n| Tablets      | $150 - 0.2 * Tablets                   |\n| Laptops      | $200 - 0.3 * Laptops                   |\n| Smartwatches | $50 - 0.05 * Smartwatches              |\n| Cameras      | $300 - 0.4 * Cameras                   |\n\nThe company has a total production capacity of 10,000 units per month. The market demand for smartphones is at least 2,000 units per month. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)  # number of smartwatches produced\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)  # number of cameras produced\n\n# Define objective function\n## calculate profit per unit for each device\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras)\n\n# Add constraints\n## The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in research and development (R&D) for each type of plant to enhance their efficiency.\n// {\"operating hours for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for Solar plant\": \"RnD_Solar\", \"range\": \"RnD_Solar >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Wind plant\": \"RnD_Wind\", \"range\": \"RnD_Wind >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Hydro plant\": \"RnD_Hydro\", \"range\": \"RnD_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants.\n// Energy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\n// Energy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\n// Energy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200.\n// 100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in research and development (R&D) for each type of plant to enhance their efficiency. The efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants. The company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200. Please help the company to maximize the total daily energy output from all plants.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=0) # operating hours for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=0) # operating hours for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=0) # operating hours for Hydro plant\nRnD_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Solar\", lb=0) # R&D investment for Solar plant\nRnD_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Wind\", lb=0) # R&D investment for Wind plant\nRnD_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Hydro\", lb=0) # R&D investment for Hydro plant\n\n# Define objective function\nEnergy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\nEnergy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\nEnergy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n# So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for operating costs and R&D investments.\nmodel.addCons(100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for Solar Plant: \", model.getVal(Hours_Solar))\n    print(\"Operating Hours for Wind Plant: \", model.getVal(Hours_Wind))\n    print(\"Operating Hours for Hydro Plant: \", model.getVal(Hours_Hydro))\n    print(\"R&D Investment for Solar Plant: \", model.getVal(RnD_Solar))\n    print(\"R&D Investment for Wind Plant: \", model.getVal(RnD_Wind))\n    print(\"R&D Investment for Hydro Plant: \", model.getVal(RnD_Hydro))\n    print(\"Total Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit and the production rate. Additionally, the company needs to determine the marketing budget to increase the sales of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * Automation) * QuantityA + 0.001 * MarketingBudget * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.005 * Automation) * QuantityB + 0.001 * MarketingBudget * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.005 * Automation) * QuantityC + 0.001 * MarketingBudget * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $20,000.\n// MarketingBudget <= 20000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 2000\n\n## Generate Constraint-5:\nThe level of automation must not reduce the production rate below 500 units per day.\n// Automation >= 500 / (QuantityA + QuantityB + QuantityC)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process, and the marketing budget to increase the sales of each product. The level of automation affects the production cost per unit and the production rate, and the marketing budget increases sales by 1% for every $1,000 spent. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Initial Production Cost |\n|---------|---------------|--------------------------|\n| ProductA | $150         | $100                     |\n| ProductB | $200         | $150                     |\n| ProductC | $250         | $200                     |\n\nThe company has a total production capacity of 10,000 units per month. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $20,000. Due to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB. The level of automation must not reduce the production rate below 500 units per day.\n\nPlease help the company to determine the optimal production quantities, level of automation, and marketing budget to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=2000) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0) # marketing budget\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * Automation) * QuantityA + 0.001 * MarketingBudget * QuantityA\n## Total profit for ProductB: ProfitB = (200 - 150 + 0.005 * Automation) * QuantityB + 0.001 * MarketingBudget * QuantityB\n## Total profit for ProductC: ProfitC = (250 - 200 + 0.005 * Automation) * QuantityC + 0.001 * MarketingBudget * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (150 - 100 + 0.005 * Automation) * QuantityA + 0.001 * MarketingBudget * QuantityA\nProfitB = (200 - 150 + 0.005 * Automation) * QuantityB + 0.001 * MarketingBudget * QuantityB\nProfitC = (250 - 200 + 0.005 * Automation) * QuantityC + 0.001 * MarketingBudget * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The total marketing budget cannot exceed $20,000.\nmodel.addCons(MarketingBudget <= 20000)\n## Due to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\nmodel.addCons(QuantityA >= 1000)\nmodel.addCons(QuantityB >= 2000)\n## The level of automation must not reduce the production rate below 500 units per day.\nmodel.addCons(Automation >= 500 / (QuantityA + QuantityB + QuantityC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1507,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"units of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"units of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company wants to maximize the total profit from all products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 hours. Producing one unit of A requires 2 hours, B requires 3 hours, C requires 2.5 hours, D requires 4 hours, and E requires 3.5 hours.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500\n\n## Generate Constraint-2:\nThe market demand for each product is limited. The maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100.\n// A <= 200\n// B <= 300\n// C <= 250\n// D <= 150\n// E <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of each product to maintain customer relationships.\n// A >= 50\n// B >= 50\n// C >= 50\n// D >= 50\n// E >= 50",
        "question": "A company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit for each product and the production time required for each unit are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 2.5 hours                |\n| D       | $80             | 4 hours                  |\n| E       | $90             | 3.5 hours                |\n\nThe company has a total production capacity of 1500 hours. The market demand for each product is limited: the maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100. The company must also produce at least 50 units of each product to maintain customer relationships.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=200) # units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=300) # units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=250) # units of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50, ub=150) # units of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50, ub=100) # units of product E produced\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A: \", model.getVal(A))\n    print(\"Units of Product B: \", model.getVal(B))\n    print(\"Units of Product C: \", model.getVal(C))\n    print(\"Units of Product D: \", model.getVal(D))\n    print(\"Units of Product E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductA\": \"AdvertisingA\", \"range\": \"AdvertisingA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdvertisingB\", \"range\": \"AdvertisingB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdvertisingC\", \"range\": \"AdvertisingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2. The demand for ProductB is modeled as DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2. The demand for ProductC is modeled as DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = PriceA * DemandA\n// Total revenue for ProductB: RevenueB = PriceB * DemandB\n// Total revenue for ProductC: RevenueC = PriceC * DemandC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 3000 units.\n// QuantityA + QuantityB + QuantityC <= 3000\n\n## Generate Constraint-2:\nThe total advertising budget for all products cannot exceed $50,000.\n// AdvertisingA + AdvertisingB + AdvertisingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $50.\n// PriceA >= 50; PriceB >= 50; PriceC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear. The demand for each product is modeled as follows:\n\n- Demand for ProductA: DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2\n- Demand for ProductB: DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2\n- Demand for ProductC: DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2\n\nThe company aims to maximize the total revenue from all products. The total revenue for each product is calculated as the product of the price and the demand.\n\nThe company has the following constraints:\n\n1. The total production capacity of the company is 3000 units.\n2. The total advertising budget for all products cannot exceed $50,000.\n3. The price of each product must be at least $50.\n\nPlease help the company to determine the optimal production quantity, price, and advertising budget for each product to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=50)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=50)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=50)  # price of ProductC\nAdvertisingA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingA\", lb=0)  # advertising budget for ProductA\nAdvertisingB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingB\", lb=0)  # advertising budget for ProductB\nAdvertisingC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingC\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA**2\nDemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB**2\nDemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC**2\nRevenueA = PriceA * DemandA\nRevenueB = PriceB * DemandB\nRevenueC = PriceC * DemandC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 3000)\nmodel.addCons(AdvertisingA + AdvertisingB + AdvertisingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdvertisingA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdvertisingB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdvertisingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $20, and the storage cost per unit is $5.\nFor Product B, the profit per unit is $30, and the storage cost per unit is $7.\nFor Product C, the profit per unit is $40, and the storage cost per unit is $9.\nFor Product D, the profit per unit is $50, and the storage cost per unit is $11.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Net profit of A: Net_Profit_A = (20 - 5) * A\n// Net profit of B: Net_Profit_B = (30 - 7) * B\n// Net profit of C: Net_Profit_C = (40 - 9) * C\n// Net profit of D: Net_Profit_D = (50 - 11) * D\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 1000 units.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 1000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit and the storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit |\n|---------|-----------------|-----------------------|\n| A       | $20             | $5                    |\n| B       | $30             | $7                    |\n| C       | $40             | $9                    |\n| D       | $50             | $11                   |\n\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost. The company has a total storage capacity of 1000 units. Please help the company determine the optimal number of units to distribute for each product to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_A = (20 - 5) * A\nNet_Profit_B = (30 - 7) * B\nNet_Profit_C = (40 - 9) * C\nNet_Profit_D = (50 - 11) * D\n## the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n# Add constraints\n## The company has a total storage capacity of 1000 units.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4).\n// {\"number of TruckType1 in Region1\": \"Truck1_R1\", \"range\": \"Truck1_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region2\": \"Truck1_R2\", \"range\": \"Truck1_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region3\": \"Truck1_R3\", \"range\": \"Truck1_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region4\": \"Truck1_R4\", \"range\": \"Truck1_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region1\": \"Truck2_R1\", \"range\": \"Truck2_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region2\": \"Truck2_R2\", \"range\": \"Truck2_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region3\": \"Truck2_R3\", \"range\": \"Truck2_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region4\": \"Truck2_R4\", \"range\": \"Truck2_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region1\": \"Truck3_R1\", \"range\": \"Truck3_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region2\": \"Truck3_R2\", \"range\": \"Truck3_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region3\": \"Truck3_R3\", \"range\": \"Truck3_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region4\": \"Truck3_R4\", \"range\": \"Truck3_R4 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckType1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The profit function is nonlinear due to the interaction between the number of trucks and the upgrade costs.\n// Profit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\n// Profit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\n// Profit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\n// So, the objective function is: Maximize (Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all regions and types must not exceed 500.\n// Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4 + Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4 + Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4 <= 500\n\n## Generate Constraint-3:\nEach region must have at least 10 trucks of any type.\n// Truck1_R1 + Truck2_R1 + Truck3_R1 >= 10\n// Truck1_R2 + Truck2_R2 + Truck3_R2 >= 10\n// Truck1_R3 + Truck2_R3 + Truck3_R3 >= 10\n// Truck1_R4 + Truck2_R4 + Truck3_R4 >= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4). The company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The profit function is nonlinear due to the interaction between the number of trucks and the upgrade costs.\n\nThe company has a total budget of $100,000 for fuel efficiency upgrades. The total number of trucks across all regions and types must not exceed 500. Each region must have at least 10 trucks of any type.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks of each type to allocate to each region and the appropriate fuel efficiency upgrades.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R1\", lb=0)\nTruck1_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R2\", lb=0)\nTruck1_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R3\", lb=0)\nTruck1_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R4\", lb=0)\nTruck2_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R1\", lb=0)\nTruck2_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R2\", lb=0)\nTruck2_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R3\", lb=0)\nTruck2_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R4\", lb=0)\nTruck3_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R1\", lb=0)\nTruck3_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R2\", lb=0)\nTruck3_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R3\", lb=0)\nTruck3_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R4\", lb=0)\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\nProfit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\nProfit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\n## the objective function is: Maximize (Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\nmodel.addCons(obj == Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n# Add constraints\n## The total budget for fuel efficiency upgrades is $100,000.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 100000)\n## The total number of trucks across all regions and types must not exceed 500.\nmodel.addCons(Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4 + Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4 + Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4 <= 500)\n## Each region must have at least 10 trucks of any type.\nmodel.addCons(Truck1_R1 + Truck2_R1 + Truck3_R1 >= 10)\nmodel.addCons(Truck1_R2 + Truck2_R2 + Truck3_R2 >= 10)\nmodel.addCons(Truck1_R3 + Truck2_R3 + Truck3_R3 >= 10)\nmodel.addCons(Truck1_R4 + Truck2_R4 + Truck3_R4 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckType1 in Region1: \", model.getVal(Truck1_R1))\n    print(\"Number of TruckType1 in Region2: \", model.getVal(Truck1_R2))\n    print(\"Number of TruckType1 in Region3: \", model.getVal(Truck1_R3))\n    print(\"Number of TruckType1 in Region4: \", model.getVal(Truck1_R4))\n    print(\"Number of TruckType2 in Region1: \", model.getVal(Truck2_R1))\n    print(\"Number of TruckType2 in Region2: \", model.getVal(Truck2_R2))\n    print(\"Number of TruckType2 in Region3: \", model.getVal(Truck2_R3))\n    print(\"Number of TruckType2 in Region4: \", model.getVal(Truck2_R4))\n    print(\"Number of TruckType3 in Region1: \", model.getVal(Truck3_R1))\n    print(\"Number of TruckType3 in Region2: \", model.getVal(Truck3_R2))\n    print(\"Number of TruckType3 in Region3: \", model.getVal(Truck3_R3))\n    print(\"Number of TruckType3 in Region4: \", model.getVal(Truck3_R4))\n    print(\"Fuel Efficiency Upgrade for TruckType1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for TruckType2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for TruckType3: \", model.getVal(Upgrade3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,800,000\n\n## Generate Constraint-4:\nTo ensure service quality, each route must have at least one truck.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for each route are given in the following Table.\n\n| Route   | Cost per Truck |\n|---------|----------------|\n| RouteA  | $50,000        |\n| RouteB  | $60,000        |\n| RouteC  | $70,000        |\n| RouteD  | $80,000        |\n| RouteE  | $90,000        |\n\nThe company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The company has a budget of $2,800,000 for total fuel and maintenance costs for the year. To ensure service quality, each route must have at least one truck.\n\nPlease help the company to minimize the total cost of fuel and maintenance by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours.\n// 10 * T + 8 * V + 2 * B <= 500\n\n## Generate Constraint-3:\nThe company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\n// B <= 0.5 * (T + V)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by its speed and capacity, as shown in the following Table.\n\n| Vehicle | Speed (km/h) | Capacity (tons) |\n|---------|--------------|-----------------|\n| Truck   | 60           | 20              |\n| Van     | 40           | 10              |\n| Bike    | 20           | 1               |\n\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each. The company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours. The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes. Additionally, the company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\n\nPlease help the company to maximize the total daily transport capacity in tons per hour (ton-km/h).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\n# So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n# The company has a total of 500 hours of driver work time available per day.\nmodel.addCons(10 * T + 8 * V + 2 * B <= 500)\n# The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n# The company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\nmodel.addCons(B <= 0.5 * (T + V))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The company also needs to decide on the budget for advertising each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from ProductA is $100 per unit, but it decreases by $0.5 for every $100 spent on advertising. The profit from ProductB is $150 per unit, decreasing by $0.7 for every $100 spent on advertising. The profit from ProductC is $200 per unit, decreasing by $1 for every $100 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total budget for advertising cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 300 units.\n// QuantityA >= 200; QuantityB >= 300\n\n## Generate Constraint-4:\nThe company must allocate at least $10,000 to advertising for ProductC.\n// BudgetC >= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The profit per unit for each product decreases with the increase in advertising budget as follows:\n\n| Product | Profit per Unit | Decrease in Profit per $100 Spent on Advertising |\n|---------|-----------------|-------------------------------------------------|\n| ProductA | $100            | $0.5                                            |\n| ProductB | $150            | $0.7                                            |\n| ProductC | $200            | $1                                              |\n\nThe company has a total budget for advertising of $50,000. The company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC. Due to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 300 units. The company must allocate at least $10,000 to advertising for ProductC.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200, ub=1000)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300, ub=1500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=2000)  # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # advertising budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # advertising budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=10000)  # advertising budget for ProductC\n\n# Define objective function\nProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\nProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\nProfitC = (200 - 1 * BudgetC / 100) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1500)\nmodel.addCons(QuantityC <= 2000)\nmodel.addCons(QuantityA >= 200)\nmodel.addCons(QuantityB >= 300)\nmodel.addCons(BudgetC >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in miles per gallon (mpg).\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"SmallTruckFuelEfficiency\", \"range\": \"SmallTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"MediumTruckFuelEfficiency\", \"range\": \"MediumTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"LargeTruckFuelEfficiency\", \"range\": \"LargeTruckFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year.\n// FuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\n// FuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\n// FuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs.\n// LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks)\n\n## Generate Constraint-4:\nThe fuel efficiency of medium trucks must be at least 10% better than that of small trucks.\n// MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency\n\n## Generate Constraint-5:\nThe fuel efficiency of large trucks must be at least 20% better than that of medium trucks.\n// LargeTruckFuelEfficiency >= 1.2 * MediumTruckFuelEfficiency",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in miles per gallon (mpg). The company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year.\n\n| Truck Type       | Purchase Cost |\n|------------------|---------------|\n| Small Trucks     | $50,000       |\n| Medium Trucks    | $75,000       |\n| Large Trucks     | $100,000      |\n\nThe company has a budget of $1,000,000 for purchasing trucks. The total number of trucks cannot exceed 20. The company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs. The fuel efficiency of medium trucks must be at least 10% better than that of small trucks. The fuel efficiency of large trucks must be at least 20% better than that of medium trucks.\n\nPlease help the company to determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallTruckFuelEfficiency\", lb=0.001)\nMediumTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTruckFuelEfficiency\", lb=0.001)\nLargeTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeTruckFuelEfficiency\", lb=0.001)\n\n# Define objective function\nFuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\nFuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\nFuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n# Add constraints\nmodel.addCons(SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\nmodel.addCons(LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks))\nmodel.addCons(MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency)\nmodel.addCons(LargeTruckFuelEfficiency >= 1.2 * MediumTruckFuelEfficiency)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeTruckFuelEfficiency))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store.\n// {\"number of units shipped from warehouse A to store 1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 4\": \"A4\", \"range\": \"A4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store.\n// Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\n// So, the objective function is: Minimize Total shipping cost\n\n## Generate Constraint-1:\nEach store must receive at least 100 units of the product.\n// A1 + B1 + C1 >= 100\n// A2 + B2 + C2 >= 100\n// A3 + B3 + C3 >= 100\n// A4 + B4 + C4 >= 100\n\n## Generate Constraint-2:\nWarehouse A has a total of 200 units available for shipping.\n// A1 + A2 + A3 + A4 <= 200\n\n## Generate Constraint-3:\nWarehouse B has a total of 300 units available for shipping.\n// B1 + B2 + B3 + B4 <= 300\n\n## Generate Constraint-4:\nWarehouse C has a total of 400 units available for shipping.\n// C1 + C2 + C3 + C4 <= 400\n\n## Generate Constraint-5:\nThe total units shipped from all warehouses to store 1 must not exceed 150.\n// A1 + B1 + C1 <= 150",
        "question": "A logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store. The cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store.\n\n| Warehouse | Cost per Unit |\n|-----------|---------------|\n| A         | 5$            |\n| B         | 6$            |\n| C         | 7$            |\n\nEach store must receive at least 100 units of the product. Warehouse A has a total of 200 units available for shipping, Warehouse B has a total of 300 units, and Warehouse C has a total of 400 units. The total units shipped from all warehouses to store 1 must not exceed 150.\n\nPlease help the company to minimize the total shipping cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # number of units shipped from warehouse A to store 1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # number of units shipped from warehouse A to store 2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # number of units shipped from warehouse A to store 3\nA4 = model.addVar(vtype=\"INTEGER\", name=\"A4\", lb=0) # number of units shipped from warehouse A to store 4\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units shipped from warehouse B to store 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units shipped from warehouse B to store 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units shipped from warehouse B to store 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units shipped from warehouse B to store 4\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of units shipped from warehouse C to store 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of units shipped from warehouse C to store 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of units shipped from warehouse C to store 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of units shipped from warehouse C to store 4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nTotalShippingCost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nmodel.addCons(obj == TotalShippingCost)\n\n# Add constraints\n## Each store must receive at least 100 units of the product.\nmodel.addCons(A1 + B1 + C1 >= 100)\nmodel.addCons(A2 + B2 + C2 >= 100)\nmodel.addCons(A3 + B3 + C3 >= 100)\nmodel.addCons(A4 + B4 + C4 >= 100)\n## Warehouse A has a total of 200 units available for shipping.\nmodel.addCons(A1 + A2 + A3 + A4 <= 200)\n## Warehouse B has a total of 300 units available for shipping.\nmodel.addCons(B1 + B2 + B3 + B4 <= 300)\n## Warehouse C has a total of 400 units available for shipping.\nmodel.addCons(C1 + C2 + C3 + C4 <= 400)\n## The total units shipped from all warehouses to store 1 must not exceed 150.\nmodel.addCons(A1 + B1 + C1 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units shipped from warehouse A to store 1: \", model.getVal(A1))\n    print(\"Number of units shipped from warehouse A to store 2: \", model.getVal(A2))\n    print(\"Number of units shipped from warehouse A to store 3: \", model.getVal(A3))\n    print(\"Number of units shipped from warehouse A to store 4: \", model.getVal(A4))\n    print(\"Number of units shipped from warehouse B to store 1: \", model.getVal(B1))\n    print(\"Number of units shipped from warehouse B to store 2: \", model.getVal(B2))\n    print(\"Number of units shipped from warehouse B to store 3: \", model.getVal(B3))\n    print(\"Number of units shipped from warehouse B to store 4: \", model.getVal(B4))\n    print(\"Number of units shipped from warehouse C to store 1: \", model.getVal(C1))\n    print(\"Number of units shipped from warehouse C to store 2: \", model.getVal(C2))\n    print(\"Number of units shipped from warehouse C to store 3: \", model.getVal(C3))\n    print(\"Number of units shipped from warehouse C to store 4: \", model.getVal(C4))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will improve the product quality and potentially increase the selling price.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductA\": \"RnD_InvestmentA\", \"range\": \"RnD_InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductB\": \"RnD_InvestmentB\", \"range\": \"RnD_InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductC\": \"RnD_InvestmentC\", \"range\": \"RnD_InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 + 0.01 * RnD_InvestmentA - 100 + 5 * AutomationA) * UnitsA\n// Total profit for ProductB: ProfitB = (180 + 0.01 * RnD_InvestmentB - 120 + 5 * AutomationB) * UnitsB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * RnD_InvestmentC - 150 + 5 * AutomationC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will improve the product quality and potentially increase the selling price. The production cost per unit decreases by $5 for every unit increase in the level of automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units per month.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for ProductC\nRnD_InvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentA\", lb=0)  # investment in R&D for ProductA\nRnD_InvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentB\", lb=0)  # investment in R&D for ProductB\nRnD_InvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentC\", lb=0)  # investment in R&D for ProductC\n\n# Define objective function\nProfitA = (150 + 0.01 * RnD_InvestmentA - 100 + 5 * AutomationA) * UnitsA\nProfitB = (180 + 0.01 * RnD_InvestmentB - 120 + 5 * AutomationB) * UnitsB\nProfitC = (200 + 0.01 * RnD_InvestmentC - 150 + 5 * AutomationC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"R&D Investment for ProductA: \", model.getVal(RnD_InvestmentA))\n    print(\"R&D Investment for ProductB: \", model.getVal(RnD_InvestmentB))\n    print(\"R&D Investment for ProductC: \", model.getVal(RnD_InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of distributing each product varies with the number of units distributed. For product A, the cost per unit is 5$, for product B, it's 7$, for product C, it's 9$, and for product D, it's 11$. The company aims to minimize the total distribution cost, which is a nonlinear function due to economies of scale.\n// Distribution cost of A: Cost_A = 5 * A^2\n// Distribution cost of B: Cost_B = 7 * B^2\n// Distribution cost of C: Cost_C = 9 * C^2\n// Distribution cost of D: Cost_D = 11 * D^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for distribution costs.\n// 5 * A^2 + 7 * B^2 + 9 * C^2 + 11 * D^2 <= 10000\n\n## Generate Constraint-2:\nThe company must distribute at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe total number of units distributed must not exceed 500.\n// A + B + C + D <= 500",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints.\nThe cost of distributing each product varies with the number of units distributed. For product A, the cost per unit is 5$, for product B, it's 7$, for product C, it's 9$, and for product D, it's 11$. The company aims to minimize the total distribution cost, which is a nonlinear function due to economies of scale.\nThe company has a budget of $10,000 for distribution costs. The company must distribute at least 50 units of each product. The total number of units distributed must not exceed 500.\nPlease help the company to minimize the total distribution cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must distribute at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Distribution cost of A: Cost_A = 5 * A^2\n## Distribution cost of B: Cost_B = 7 * B^2\n## Distribution cost of C: Cost_C = 9 * C^2\n## Distribution cost of D: Cost_D = 11 * D^2\n## So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\nmodel.addCons(obj == 5 * A**2 + 7 * B**2 + 9 * C**2 + 11 * D**2)\n\n# Add constraints\n## The company has a budget of $10,000 for distribution costs.\nmodel.addCons(5 * A**2 + 7 * B**2 + 9 * C**2 + 11 * D**2 <= 10000)\n## The total number of units distributed must not exceed 500.\nmodel.addCons(A + B + C + D <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Minimized Distribution Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs.\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology investment for heavy trucks\": \"TechInvestHeavy\", \"range\": \"TechInvestHeavy >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for medium trucks\": \"TechInvestMedium\", \"range\": \"TechInvestMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for light trucks\": \"TechInvestLight\", \"range\": \"TechInvestLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n// Total profit for heavy trucks: ProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\n// Total profit for medium trucks: ProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\n// Total profit for light trucks: ProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n// So, the objective function is: Maximize (ProfitHeavy + ProfitMedium + ProfitLight)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments.\n// HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs. The company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology. The company has a budget of $2,000,000 for purchasing trucks and technology investments.\n\nPlease help the company to maximize its annual profit from the truck fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nTechInvestHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestHeavy\", lb=0)  # technology investment for heavy trucks\nTechInvestMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestMedium\", lb=0)  # technology investment for medium trucks\nTechInvestLight = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestLight\", lb=0)  # technology investment for light trucks\n\n# Define objective function\nProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\nProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\nProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHeavy + ProfitMedium + ProfitLight)\n\n# Add constraints\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Technology Investment for Heavy Trucks: \", model.getVal(TechInvestHeavy))\n    print(\"Technology Investment for Medium Trucks: \", model.getVal(TechInvestMedium))\n    print(\"Technology Investment for Light Trucks: \", model.getVal(TechInvestLight))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the level of investment in green technology for each vehicle type to reduce emissions and improve fuel efficiency.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for TruckA\": \"GreenTechA\", \"range\": \"GreenTechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckB\": \"GreenTechB\", \"range\": \"GreenTechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckC\": \"GreenTechC\", \"range\": \"GreenTechC >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckD\": \"GreenTechD\", \"range\": \"GreenTechD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the investment in green technology. For every $1000 invested in green technology, the fuel efficiency of TruckA increases by 1%, TruckB by 1.5%, TruckC by 2%, and TruckD by 2.5%. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for TruckA: FuelCostA = (BaseFuelCostA * (1 - 0.001 * GreenTechA)) * TruckA\n// Fuel cost for TruckB: FuelCostB = (BaseFuelCostB * (1 - 0.0015 * GreenTechB)) * TruckB\n// Fuel cost for TruckC: FuelCostC = (BaseFuelCostC * (1 - 0.002 * GreenTechC)) * TruckC\n// Fuel cost for TruckD: FuelCostD = (BaseFuelCostD * (1 - 0.0025 * GreenTechD)) * TruckD\n// Maintenance cost for all trucks: MaintenanceCost = (MaintenanceCostA * TruckA) + (MaintenanceCostB * TruckB) + (MaintenanceCostC * TruckC) + (MaintenanceCostD * TruckD)\n// Total operational cost: OperationalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for vehicle acquisition and green technology investments.\n// TruckA + TruckB + TruckC + TruckD + GreenTechA + GreenTechB + GreenTechC + GreenTechD <= 200000",
        "question": "A logistics company is planning its fleet for the next quarter and operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the level of investment in green technology for each vehicle type to reduce emissions and improve fuel efficiency. The fuel efficiency of each truck type improves with the investment in green technology. For every $1000 invested in green technology, the fuel efficiency of TruckA increases by 1%, TruckB by 1.5%, TruckC by 2%, and TruckD by 2.5%. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The company has a budget of $200,000 for vehicle acquisition and green technology investments.\n\nPlease help the company to determine the optimal number of each type of truck and the investment in green technology to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)\nGreenTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechA\", lb=0)\nGreenTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechB\", lb=0)\nGreenTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechC\", lb=0)\nGreenTechD = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechD\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel costs\nBaseFuelCostA = 10  # Example base fuel cost for TruckA\nBaseFuelCostB = 12  # Example base fuel cost for TruckB\nBaseFuelCostC = 15  # Example base fuel cost for TruckC\nBaseFuelCostD = 20  # Example base fuel cost for TruckD\nFuelCostA = (BaseFuelCostA * (1 - 0.001 * GreenTechA)) * TruckA\nFuelCostB = (BaseFuelCostB * (1 - 0.0015 * GreenTechB)) * TruckB\nFuelCostC = (BaseFuelCostC * (1 - 0.002 * GreenTechC)) * TruckC\nFuelCostD = (BaseFuelCostD * (1 - 0.0025 * GreenTechD)) * TruckD\n\n## Calculate maintenance costs\nMaintenanceCostA = 500  # Example maintenance cost for TruckA\nMaintenanceCostB = 600  # Example maintenance cost for TruckB\nMaintenanceCostC = 700  # Example maintenance cost for TruckC\nMaintenanceCostD = 800  # Example maintenance cost for TruckD\nMaintenanceCost = (MaintenanceCostA * TruckA) + (MaintenanceCostB * TruckB) + (MaintenanceCostC * TruckC) + (MaintenanceCostD * TruckD)\n\n## Total operational cost\nOperationalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The company has a budget of $200,000 for vehicle acquisition and green technology investments.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + GreenTechA + GreenTechB + GreenTechC + GreenTechD <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Investment in GreenTechA: \", model.getVal(GreenTechA))\n    print(\"Investment in GreenTechB: \", model.getVal(GreenTechB))\n    print(\"Investment in GreenTechC: \", model.getVal(GreenTechC))\n    print(\"Investment in GreenTechD: \", model.getVal(GreenTechD))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks.\n// {\"fuel consumption of Truck1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel consumption rate and maintenance cost per kilometer. The rates are as follows:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost.\n// Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n// Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n// So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\n\n## Generate Constraint-1:\nThe total distance covered by all trucks should not exceed 10,000 km.\n// F1 + F2 + F3 + F4 + F5 <= 10000",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks. The fuel consumption rate and maintenance cost per kilometer for each truck are given in the following Table.\n\n| Truck | Fuel Consumption Rate (liters/km) | Maintenance Cost/km |\n|-------|-----------------------------------|---------------------|\n| Truck1 | 0.15                             | $2                 |\n| Truck2 | 0.20                             | $3                 |\n| Truck3 | 0.18                             | $2.5               |\n| Truck4 | 0.22                             | $3.5               |\n| Truck5 | 0.25                             | $4                 |\n\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost. The total distance covered by all trucks should not exceed 10,000 km. Please help the company determine the optimal distance each truck should travel to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of Truck1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of Truck2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of Truck3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of Truck4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n## Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n## So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\nTotalFuelCost = 0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5\nTotalMaintenanceCost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The total distance covered by all trucks should not exceed 10,000 km.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(F1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(F2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(F3))\n    print(\"Fuel consumption of Truck4: \", model.getVal(F4))\n    print(\"Fuel consumption of Truck5: \", model.getVal(F5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available per week.\n// DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE <= 1500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// DeviceA >= 100; DeviceB >= 100; DeviceC >= 100; DeviceD >= 100; DeviceE >= 100\n\n## Generate Constraint-4:\nThe company has a budget of $100,000 for production costs, which includes labor and raw material costs.\n// (2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE) * 10 + (DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE) * 5 <= 100000",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company has a total of 1000 labor hours available per week and 1500 units of raw material available per week. The company wants to ensure that at least 100 units of each device are produced to maintain market presence. The company has a budget of $100,000 for production costs, which includes labor and raw material costs.\nPlease help the company to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency, defined as the total profit minus 0.01 times the sum of the squares of labor hours and raw material usage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=100) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=100) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=100) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=100) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Convert the nonlinear term to a linear constraint\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\nLabor_squared = model.addVar(name=\"Labor_squared\")\nRawMaterial_squared = model.addVar(name=\"RawMaterial_squared\")\nmodel.addCons(Labor_squared == Labor**2)\nmodel.addCons(RawMaterial_squared == RawMaterial**2)\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - 0.01 * (Labor_squared + RawMaterial_squared))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n## The company has a total of 1500 units of raw material available per week.\nmodel.addCons(RawMaterial <= 1500)\n## The company has a budget of $100,000 for production costs, which includes labor and raw material costs.\nmodel.addCons((2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE) * 10 + (DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE) * 5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to maintain service levels.\n// TrucksNorth >= 10; TrucksSouth >= 10; TrucksEast >= 10; TrucksWest >= 10; TrucksCentral >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, and the company aims to minimize the total fuel cost across all regions. The total fuel budget across all regions must not exceed $100,000. Each region must have at least 10 trucks to maintain service levels, and the total number of trucks across all regions must not exceed 100.\n\nPlease help the company to determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=10)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=10)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=10)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=10)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=10)\nFuelBudgetNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetNorth\", lb=0)\nFuelBudgetSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetSouth\", lb=0)\nFuelBudgetEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetEast\", lb=0)\nFuelBudgetWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetWest\", lb=0)\nFuelBudgetCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetCentral\", lb=0)\n\n# Define objective function\n# The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\n# Cost = a * (FuelBudget)^(-b) + c\n# FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n# FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n# FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n# FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n# FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n# So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Add constraints\n# The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n# Each region must have at least 10 trucks to maintain service levels.\nmodel.addCons(TrucksNorth >= 10)\nmodel.addCons(TrucksSouth >= 10)\nmodel.addCons(TrucksEast >= 10)\nmodel.addCons(TrucksWest >= 10)\nmodel.addCons(TrucksCentral >= 10)\n# The total number of trucks across all regions must not exceed 100.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South Region: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East Region: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West Region: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central Region: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget for North Region: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget for South Region: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget for East Region: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget for West Region: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget for Central Region: \", model.getVal(FuelBudgetCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company wants to maximize its total profit.\n// ProfitA = (100 - 50) * (100 - 0.1 * UnitsA^2) * UnitsA\n// ProfitB = (120 - 70) * (150 - 0.2 * UnitsB^2) * UnitsB\n// ProfitC = (110 - 60) * (120 - 0.15 * UnitsC^2) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB.\n// UnitsA <= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 60 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// UnitsA >= 1; UnitsB >= 1; UnitsC >= 1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary. The following table summarizes the relevant information for each product:\n\n| Product | Production Cost per Unit | Selling Price per Unit | Demand Function |\n|---------|--------------------------|------------------------|-----------------|\n| ProductA | $50                      | $100                   | 100 - 0.1 * UnitsA^2 |\n| ProductB | $70                      | $120                   | 150 - 0.2 * UnitsB^2 |\n| ProductC | $60                      | $110                   | 120 - 0.15 * UnitsC^2 |\n\nThe company has a total production capacity of 1000 units per month. Due to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB. The company has a budget of $60,000 for production costs per month. The company wants to ensure that at least one unit of each product is produced to maintain market presence.\n\nPlease help the company to maximize its total profit, which is calculated as the difference between the selling price and the production cost, multiplied by the demand for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with quadratic demand\nProfitA = (100 - 50) * (100 - 0.1 * UnitsA**2) * UnitsA\nProfitB = (120 - 70) * (150 - 0.2 * UnitsB**2) * UnitsB\nProfitC = (110 - 60) * (120 - 0.15 * UnitsC**2) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n## Due to market research, the company knows that the production of ProductA should not exceed twice the production of ProductB.\nmodel.addCons(UnitsA <= 2 * UnitsB)\n\n## The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 60 * UnitsC <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 hours of assembly time and 1 hour of testing time. \nThe profit per unit of E2 is $150, requiring 3 hours of assembly time and 2 hours of testing time. \nThe profit per unit of E3 is $200, requiring 4 hours of assembly time and 3 hours of testing time. \nThe company aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// Total_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\n// Total_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time), where C is a cost coefficient for time.\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours available for assembly.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for testing.\n// 1 * Q1 + 2 * Q2 + 3 * Q3 <= 500\n\n## Generate Constraint-3:\nThe market demand for E1 is limited to 50 units.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe company has a budget constraint for raw materials, which limits the production of E2 to 30 units.\n// Q2 <= 30",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints. The profit per unit and the required assembly and testing times for each device are given in the following Table.\n\n| Device | Profit per Unit | Assembly Time per Unit | Testing Time per Unit |\n|--------|-----------------|-------------------------|-----------------------|\n| E1     | $100            | 2 hours                 | 1 hour                |\n| E2     | $150            | 3 hours                 | 2 hours               |\n| E3     | $200            | 4 hours                 | 3 hours               |\n\nThe company has a total of 1000 hours available for assembly and 500 hours available for testing. The market demand for E1 is limited to 50 units, and the company has a budget constraint for raw materials, which limits the production of E2 to 30 units. \nPlease help the company to maximize the total profit, considering a cost coefficient for time in the objective function.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=50) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0, ub=30) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\nTotal_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\nTotal_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\nC = 1  # Cost coefficient for time, assuming C = 1 for simplicity\n# The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 - C * (Total_Assembly_Time + Total_Testing_Time))\n\n# Add constraints\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000)  # Assembly time constraint\nmodel.addCons(1 * Q1 + 2 * Q2 + 3 * Q3 <= 500)  # Testing time constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company operates in a region with five major cities (City1, City2, City3, City4, City5) and needs to determine the number of trips to each city to optimize its operational efficiency and profit. Additionally, the company is considering investing in fuel-efficient vehicles to reduce fuel costs, which is a significant factor in the total operational cost.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient vehicles\": \"FuelEfficiencyInvestment\", \"range\": \"FuelEfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each trip is affected by the fuel efficiency of the vehicles. The initial cost per trip to City1 is $1000, City2 is $1200, City3 is $1500, City4 is $1300, and City5 is $1400. With the investment in fuel-efficient vehicles, the cost per trip decreases by 1% for every $1000 invested. The company aims to minimize the total operational cost while considering the investment in fuel-efficient vehicles.\n// Total cost for City1: Cost1 = (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1\n// Total cost for City2: Cost2 = (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2\n// Total cost for City3: Cost3 = (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3\n// Total cost for City4: Cost4 = (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4\n// Total cost for City5: Cost5 = (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles.\n// (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1 + (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2 + (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3 + (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4 + (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5 + FuelEfficiencyInvestment <= 500000\n\n## Generate Constraint-2:\nThe company must make at least 50 trips to City1 and 30 trips to City3.\n// Trips1 >= 50; Trips3 >= 30",
        "question": "A logistics company is planning its delivery routes for the next quarter in a region with five major cities (City1, City2, City3, City4, City5). The company needs to determine the number of trips to each city and the investment in fuel-efficient vehicles to optimize its operational efficiency and profit. The initial cost per trip varies by city, with City1 at $1000, City2 at $1200, City3 at $1500, City4 at $1300, and City5 at $1400. Investing in fuel-efficient vehicles reduces the cost per trip by 1% for every $1000 invested. The company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles. Additionally, the company must make at least 50 trips to City1 and 30 trips to City3. \n\nPlease help the company to minimize the total operational cost while considering the investment in fuel-efficient vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=30)  # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to City5\nFuelEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyInvestment\", lb=0)  # investment in fuel-efficient vehicles\n\n# Define objective function\nCost1 = (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1\nCost2 = (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2\nCost3 = (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3\nCost4 = (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4\nCost5 = (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles.\nmodel.addCons(\n    (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1 +\n    (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2 +\n    (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3 +\n    (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4 +\n    (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5 +\n    FuelEfficiencyInvestment <= 500000\n)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel-efficient vehicles: \", model.getVal(FuelEfficiencyInvestment))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of three types of goods: T1, T2, and T3, using two types of vehicles: V1 and V2. The company needs to determine the optimal number of each type of vehicle to use and the quantity of each type of goods to transport.\n// {\"number of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating V1 is $100 per day, and it can transport 10 units of T1, 5 units of T2, and 5 units of T3. The cost of operating V2 is $150 per day, and it can transport 5 units of T1, 10 units of T2, and 10 units of T3. The revenue generated from transporting T1 is $20 per unit, T2 is $30 per unit, and T3 is $40 per unit. The company wants to maximize the net profit (revenue minus operating costs).\n// Revenue_T1 = 20 * T1\n// Revenue_T2 = 30 * T2\n// Revenue_T3 = 40 * T3\n// Cost_V1 = 100 * V1\n// Cost_V2 = 150 * V2\n// So, the objective function is: Maximize (Revenue_T1 + Revenue_T2 + Revenue_T3) - (Cost_V1 + Cost_V2)\n\n## Generate Constraint-1:\nThe total capacity of V1 and V2 in terms of goods transportation is limited to 200 units.\n// 10 * V1 + 5 * V1 + 5 * V1 + 5 * V2 + 10 * V2 + 10 * V2 >= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for operating costs.\n// 100 * V1 + 150 * V2 <= 3000\n\n## Generate Constraint-3:\nThe market demand for T1 is 30 units. So, the company can only sell a maximum of 30 units of T1.\n// T1 <= 30\n\n## Generate Constraint-4:\nThe total number of vehicles available is limited to 20.\n// V1 + V2 <= 20\n\n## Generate Constraint-5:\nThe company must transport at least 50 units of T2.\n// T2 >= 50",
        "question": "A logistics company manages the transportation of three types of goods: T1, T2, and T3, using two types of vehicles: V1 and V2. The company needs to determine the optimal number of each type of vehicle to use and the quantity of each type of goods to transport. The cost of operating V1 is $100 per day, and it can transport 10 units of T1, 5 units of T2, and 5 units of T3. The cost of operating V2 is $150 per day, and it can transport 5 units of T1, 10 units of T2, and 10 units of T3. The revenue generated from transporting T1 is $20 per unit, T2 is $30 per unit, and T3 is $40 per unit. The company wants to maximize the net profit (revenue minus operating costs).\n\n| Vehicle | Operating Cost | Capacity (T1) | Capacity (T2) | Capacity (T3) |\n|---------|----------------|---------------|---------------|---------------|\n| V1      | 100$           | 10 units      | 5 units       | 5 units       |\n| V2      | 150$           | 5 units       | 10 units      | 10 units      |\n\nThe total capacity of V1 and V2 in terms of goods transportation is limited to 200 units. The company has a budget of $3000 for operating costs. The market demand for T1 is 30 units. So, the company can only sell a maximum of 30 units of T1. The total number of vehicles available is limited to 20. The company must transport at least 50 units of T2.\n\nPlease help the company to maximize the net profit (revenue minus operating costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=30) # quantity of T1 goods\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=50) # quantity of T2 goods\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # quantity of T3 goods\n\n# Define objective function\nRevenue_T1 = 20 * T1\nRevenue_T2 = 30 * T2\nRevenue_T3 = 40 * T3\nCost_V1 = 100 * V1\nCost_V2 = 150 * V2\n# So, the objective function is: Maximize (Revenue_T1 + Revenue_T2 + Revenue_T3) - (Cost_V1 + Cost_V2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_T1 + Revenue_T2 + Revenue_T3 - Cost_V1 - Cost_V2)\n\n# Add constraints\n# The total capacity of V1 and V2 in terms of goods transportation is limited to 200 units.\nmodel.addCons(10 * V1 + 5 * V1 + 5 * V1 + 5 * V2 + 10 * V2 + 10 * V2 >= 200)\n# The company has a budget of $3000 for operating costs.\nmodel.addCons(100 * V1 + 150 * V2 <= 3000)\n# The market demand for T1 is 30 units. So, the company can only sell a maximum of 30 units of T1.\nmodel.addCons(T1 <= 30)\n# The total number of vehicles available is limited to 20.\nmodel.addCons(V1 + V2 <= 20)\n# The company must transport at least 50 units of T2.\nmodel.addCons(T2 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Quantity of T1 Goods: \", model.getVal(T1))\n    print(\"Quantity of T2 Goods: \", model.getVal(T2))\n    print(\"Quantity of T3 Goods: \", model.getVal(T3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1416,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct.\n// {\"number of CondoA\": \"CondoA\", \"range\": \"CondoA >= 0\", \"type\": \"integer\"}\n// {\"number of CondoB\": \"CondoB\", \"range\": \"CondoB >= 0\", \"type\": \"integer\"}\n// {\"number of HouseC\": \"HouseC\", \"range\": \"HouseC >= 0\", \"type\": \"integer\"}\n// {\"number of HouseD\": \"HouseD\", \"range\": \"HouseD >= 0\", \"type\": \"integer\"}\n// {\"number of VillaE\": \"VillaE\", \"range\": \"VillaE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoA, the profit per unit is $100,000, the construction cost per unit is $70,000, and the land cost per unit is $20,000. \nFor CondoB, the profit per unit is $120,000, the construction cost per unit is $80,000, and the land cost per unit is $25,000. \nFor HouseC, the profit per unit is $150,000, the construction cost per unit is $100,000, and the land cost per unit is $30,000.\nFor HouseD, the profit per unit is $180,000, the construction cost per unit is $110,000, and the land cost per unit is $35,000.\nFor VillaE, the profit per unit is $200,000, the construction cost per unit is $120,000, and the land cost per unit is $40,000.\nThe developer wants to maximize the total profit while considering the efficiency of land use (profit per unit of land).\n// Profit_CondoA = (100,000 - 70,000 - 20,000) * CondoA\n// Profit_CondoB = (120,000 - 80,000 - 25,000) * CondoB\n// Profit_HouseC = (150,000 - 100,000 - 30,000) * HouseC\n// Profit_HouseD = (180,000 - 110,000 - 35,000) * HouseD\n// Profit_VillaE = (200,000 - 120,000 - 40,000) * VillaE\n// So, the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / (20,000 * CondoA + 25,000 * CondoB + 30,000 * HouseC + 35,000 * HouseD + 40,000 * VillaE)\n\n## Generate Constraint-1:\nThe developer has a total budget of $5,000,000 for construction costs.\n// 70,000 * CondoA + 80,000 * CondoB + 100,000 * HouseC + 110,000 * HouseD + 120,000 * VillaE <= 5,000,000\n\n## Generate Constraint-2:\nThe developer has a limited amount of land available, which can accommodate a maximum of 100 units.\n// CondoA + CondoB + HouseC + HouseD + VillaE <= 100\n\n## Generate Constraint-3:\nDue to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units.\n// CondoA <= 2 * CondoB",
        "question": "A real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct. The profit per unit, construction cost per unit, and land cost per unit for each type of property are given in the following Table.\n\n| Property Type | Profit per Unit | Construction Cost per Unit | Land Cost per Unit |\n|---------------|-----------------|----------------------------|--------------------|\n| CondoA        | $100,000        | $70,000                    | $20,000            |\n| CondoB        | $120,000        | $80,000                    | $25,000            |\n| HouseC        | $150,000        | $100,000                   | $30,000            |\n| HouseD        | $180,000        | $110,000                   | $35,000            |\n| VillaE        | $200,000        | $120,000                   | $40,000            |\n\nThe developer has a total budget of $5,000,000 for construction costs. The developer has a limited amount of land available, which can accommodate a maximum of 100 units. Due to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units. \n\nPlease help the developer to maximize the total profit while considering the efficiency of land use (profit per unit of land).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCondoA = model.addVar(vtype=\"INTEGER\", name=\"CondoA\", lb=0)  # number of CondoA\nCondoB = model.addVar(vtype=\"INTEGER\", name=\"CondoB\", lb=0)  # number of CondoB\nHouseC = model.addVar(vtype=\"INTEGER\", name=\"HouseC\", lb=0)  # number of HouseC\nHouseD = model.addVar(vtype=\"INTEGER\", name=\"HouseD\", lb=0)  # number of HouseD\nVillaE = model.addVar(vtype=\"INTEGER\", name=\"VillaE\", lb=0)  # number of VillaE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoA = (100000 - 70000 - 20000) * CondoA\nProfit_CondoB = (120000 - 80000 - 25000) * CondoB\nProfit_HouseC = (150000 - 100000 - 30000) * HouseC\nProfit_HouseD = (180000 - 110000 - 35000) * HouseD\nProfit_VillaE = (200000 - 120000 - 40000) * VillaE\nLandCost = 20000 * CondoA + 25000 * CondoB + 30000 * HouseC + 35000 * HouseD + 40000 * VillaE\n## the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / LandCost\n## convert the division to multiplication\nmodel.addCons(obj * LandCost == Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE)\n\n# Add constraints\n## The developer has a total budget of $5,000,000 for construction costs.\nmodel.addCons(70000 * CondoA + 80000 * CondoB + 100000 * HouseC + 110000 * HouseD + 120000 * VillaE <= 5000000)\n## The developer has a limited amount of land available, which can accommodate a maximum of 100 units.\nmodel.addCons(CondoA + CondoB + HouseC + HouseD + VillaE <= 100)\n## Due to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units.\nmodel.addCons(CondoA <= 2 * CondoB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoA: \", model.getVal(CondoA))\n    print(\"Number of CondoB: \", model.getVal(CondoB))\n    print(\"Number of HouseC: \", model.getVal(HouseC))\n    print(\"Number of HouseD: \", model.getVal(HouseD))\n    print(\"Number of VillaE: \", model.getVal(VillaE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\n// Total profit for ProductB: ProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $30,000.\n// MarketingA + MarketingB + MarketingC <= 30000\n\n## Generate Constraint-3:\nDue to production capacity, the total number of units produced cannot exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume. The production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n\n| Product | Initial Production Cost per Unit | Sales Price per Unit |\n|---------|----------------------------------|----------------------|\n| ProductA | $100                             | $200                 |\n| ProductB | $120                             | $220                 |\n| ProductC | $150                             | $250                 |\n\nThe total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $30,000. Due to production capacity, the total number of units produced cannot exceed 1000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 30000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1593,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000\n\n## Generate Constraint-2:\nThe maintenance budget for the year is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones <= 500,000\n\n## Generate Constraint-3:\nThe company needs to ensure a minimum total capacity of 50,000 units.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50,000",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities. The operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000. The operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000. The operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000. The operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500. The operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000. The company has a budget of $2,000,000 for purchasing vehicles and a maintenance budget of $500,000 for the year. The company needs to ensure a minimum total capacity of 50,000 units. Please help the company to minimize the total operational and maintenance costs while maximizing the total capacity, considering the objective function as the ratio of total costs to total capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=0)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n## The maintenance budget for the year is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones <= 500000)\n## The company needs to ensure a minimum total capacity of 50,000 units.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each truck to reduce fuel costs and increase the number of trips possible per day.\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost for Truck 1: Cost1 = (100 - 0.05 * Upgrade1) * Trips1\n// Fuel cost for Truck 2: Cost2 = (120 - 0.06 * Upgrade2) * Trips2\n// Fuel cost for Truck 3: Cost3 = (150 - 0.075 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and upgrades.\n// (100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nEach truck can make at most 50 trips per day.\n// Trips1 <= 50; Trips2 <= 50; Trips3 <= 50\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips.\n// Trips1 >= 20; Trips2 >= 25\n\n## Generate Constraint-4:\nThe total number of trips across all trucks must not exceed 120 trips per day.\n// Trips1 + Trips2 + Trips3 <= 120",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities and the investment in fuel-efficient upgrades for each truck to optimize its operations. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips. The company has a budget of $10,000 for fuel and upgrades. Each truck can make at most 50 trips per day. Due to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips. The total number of trips across all trucks must not exceed 120 trips per day.\n\nPlease help the company to determine the optimal number of trips for each truck and the investment in fuel-efficient upgrades to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=20, ub=50)  # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=25, ub=50)  # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0, ub=50)    # number of trips for Truck 3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)   # investment in fuel-efficient upgrades for Truck 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)   # investment in fuel-efficient upgrades for Truck 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)   # investment in fuel-efficient upgrades for Truck 3\n\n# Define objective function\nCost1 = (100 - 0.05 * Upgrade1) * Trips1\nCost2 = (120 - 0.06 * Upgrade2) * Trips2\nCost3 = (150 - 0.075 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel and upgrades.\nmodel.addCons((100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# Each truck can make at most 50 trips per day.\nmodel.addCons(Trips1 <= 50)\nmodel.addCons(Trips2 <= 50)\nmodel.addCons(Trips3 <= 50)\n# Due to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips.\nmodel.addCons(Trips1 >= 20)\nmodel.addCons(Trips2 >= 25)\n# The total number of trips across all trucks must not exceed 120 trips per day.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrades for Truck 1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck 2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck 3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations.\n// {\"number of trucks allocated to region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in region A is $500 per day, with a delivery efficiency of 10 deliveries per day.\nIn region B, the cost is $600 per day, with an efficiency of 12 deliveries per day.\nIn region C, the cost is $700 per day, with an efficiency of 14 deliveries per day.\nIn region D, the cost is $800 per day, with an efficiency of 16 deliveries per day.\nIn region E, the cost is $900 per day, with an efficiency of 18 deliveries per day.\nThe company aims to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).\n// Total operating cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Total number of deliveries: Deliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n// So, the objective function is: Minimize Cost / Deliveries\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operating costs.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000\n\n## Generate Constraint-2:\nThe company must ensure that at least 100 deliveries are made each day.\n// 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100\n\n## Generate Constraint-3:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C.\n// TruckA <= TruckB + TruckC\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\n// TruckE <= TruckA + TruckB + TruckC + TruckD",
        "question": "A logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations.\nThe cost of operating a truck in region A is $500 per day, with a delivery efficiency of 10 deliveries per day.\nIn region B, the cost is $600 per day, with an efficiency of 12 deliveries per day.\nIn region C, the cost is $700 per day, with an efficiency of 14 deliveries per day.\nIn region D, the cost is $800 per day, with an efficiency of 16 deliveries per day.\nIn region E, the cost is $900 per day, with an efficiency of 18 deliveries per day.\nThe company has a budget of $10,000 per day for operating costs. The company must ensure that at least 100 deliveries are made each day. The company can allocate a maximum of 20 trucks in total across all regions. The company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C. The company also wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\nPlease help the company to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nDeliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n## the objective function is: Minimize Cost / Deliveries\n## convert the division to multiplication\nmodel.addCons(obj * Deliveries == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for operating costs.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000)\n## The company must ensure that at least 100 deliveries are made each day.\nmodel.addCons(10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 20)\n## The company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C.\nmodel.addCons(TruckA <= TruckB + TruckC)\n## The company wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\nmodel.addCons(TruckE <= TruckA + TruckB + TruckC + TruckD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Minimized Cost-Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to determine the production quantity for each device to optimize its operations.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100. \nFor DeviceB, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150. \nFor DeviceC, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nFor DeviceD, the profit per unit is $60, the storage cost per unit is $6, and the production setup cost is $120.\nFor DeviceE, the profit per unit is $80, the storage cost per unit is $8, and the production setup cost is $160.\nThe company aims to maximize the total net profit, which is the sum of the profit per unit minus the storage cost per unit, minus the production setup cost per unit times the square root of the production quantity.\n// Net profit for DeviceA: Profit_A = (50 - 5) * A - 100 * sqrt(A)\n// Net profit for DeviceB: Profit_B = (70 - 7) * B - 150 * sqrt(B)\n// Net profit for DeviceC: Profit_C = (90 - 9) * C - 200 * sqrt(C)\n// Net profit for DeviceD: Profit_D = (60 - 6) * D - 120 * sqrt(D)\n// Net profit for DeviceE: Profit_E = (80 - 8) * E - 160 * sqrt(E)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production setup costs.\n// 100 * A + 150 * B + 200 * C + 120 * D + 160 * E <= 5000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 500 units across all devices.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20 units of each device are produced.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-4:\nThe production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB.\n// D <= 0.5 * (A + B)",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to determine the production quantity for each device to optimize its operations.\nFor DeviceA, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100. \nFor DeviceB, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150. \nFor DeviceC, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nFor DeviceD, the profit per unit is $60, the storage cost per unit is $6, and the production setup cost is $120.\nFor DeviceE, the profit per unit is $80, the storage cost per unit is $8, and the production setup cost is $160.\nThe company has a budget of $5000 for production setup costs. The company has a storage capacity of 500 units across all devices. The company wants to ensure that at least 20 units of each device are produced. The production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB.\nPlease help the company to maximize the total net profit, which is the sum of the profit per unit minus the storage cost per unit, minus the production setup cost per unit times the square root of the production quantity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of DeviceD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of DeviceE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit for DeviceA: Profit_A = (50 - 5) * A - 100 * sqrt(A)\n## Net profit for DeviceB: Profit_B = (70 - 7) * B - 150 * sqrt(B)\n## Net profit for DeviceC: Profit_C = (90 - 9) * C - 200 * sqrt(C)\n## Net profit for DeviceD: Profit_D = (60 - 6) * D - 120 * sqrt(D)\n## Net profit for DeviceE: Profit_E = (80 - 8) * E - 160 * sqrt(E)\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n## Convert square root to a variable to handle non-linearity\nsqrt_A = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_A\")\nsqrt_B = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_B\")\nsqrt_C = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_C\")\nsqrt_D = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_D\")\nsqrt_E = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_E\")\nmodel.addCons(sqrt_A * sqrt_A == A)\nmodel.addCons(sqrt_B * sqrt_B == B)\nmodel.addCons(sqrt_C * sqrt_C == C)\nmodel.addCons(sqrt_D * sqrt_D == D)\nmodel.addCons(sqrt_E * sqrt_E == E)\nProfit_A = (50 - 5) * A - 100 * sqrt_A\nProfit_B = (70 - 7) * B - 150 * sqrt_B\nProfit_C = (90 - 9) * C - 200 * sqrt_C\nProfit_D = (60 - 6) * D - 120 * sqrt_D\nProfit_E = (80 - 8) * E - 160 * sqrt_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $5000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C + 120 * D + 160 * E <= 5000)\n## The company has a storage capacity of 500 units across all devices.\nmodel.addCons(A + B + C + D + E <= 500)\n## The production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB.\nmodel.addCons(D <= 0.5 * (A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of DeviceE: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods through three different modes: air, sea, and land. The company needs to determine the number of trips to schedule for each mode of transportation in the next quarter. Additionally, the company needs to decide on the investment amount ($) in technology upgrades for each mode to enhance efficiency and reduce fuel consumption, which directly impacts the operational cost per trip.\n// {\"number of trips by air\": \"TripsAir\", \"range\": \"TripsAir >= 0\", \"type\": \"integer\"}\n// {\"number of trips by sea\": \"TripsSea\", \"range\": \"TripsSea >= 0\", \"type\": \"integer\"}\n// {\"number of trips by land\": \"TripsLand\", \"range\": \"TripsLand >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for air\": \"TechAir\", \"range\": \"TechAir >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for sea\": \"TechSea\", \"range\": \"TechSea >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for land\": \"TechLand\", \"range\": \"TechLand >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in technology upgrades. For every $1000 invested in technology, the operational cost per trip reduces by $5 for air, $3 for sea, and $2 for land. The company aims to minimize the total operational cost of all trips.\nThe initial operational cost per trip for air is $1000, for sea is $800, and for land is $500.\n// Operational cost for air: CostAir = (1000 - 0.005 * TechAir) * TripsAir\n// Operational cost for sea: CostSea = (800 - 0.003 * TechSea) * TripsSea\n// Operational cost for land: CostLand = (500 - 0.002 * TechLand) * TripsLand\n// So, the objective function is: Minimize (CostAir + CostSea + CostLand)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational expenses and technology investments.\n// (1000 - 0.005 * TechAir) * TripsAir + (800 - 0.003 * TechSea) * TripsSea + (500 - 0.002 * TechLand) * TripsLand + TechAir + TechSea + TechLand <= 100000",
        "question": "A logistics company manages the transportation of goods through three different modes: air, sea, and land. The company needs to determine the number of trips to schedule for each mode of transportation in the next quarter and the investment amount ($) in technology upgrades for each mode to enhance efficiency and reduce fuel consumption, which directly impacts the operational cost per trip. The operational cost per trip decreases with the investment in technology upgrades. For every $1000 invested in technology, the operational cost per trip reduces by $5 for air, $3 for sea, and $2 for land. The initial operational cost per trip for air is $1000, for sea is $800, and for land is $500. The company aims to minimize the total operational cost of all trips. The company has a total budget of $100,000 for operational expenses and technology investments. Please help the company to determine the optimal number of trips and technology investments for each mode of transportation to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsAir = model.addVar(vtype=\"INTEGER\", name=\"TripsAir\", lb=0)  # number of trips by air\nTripsSea = model.addVar(vtype=\"INTEGER\", name=\"TripsSea\", lb=0)  # number of trips by sea\nTripsLand = model.addVar(vtype=\"INTEGER\", name=\"TripsLand\", lb=0)  # number of trips by land\nTechAir = model.addVar(vtype=\"CONTINUOUS\", name=\"TechAir\", lb=0)  # investment in technology for air\nTechSea = model.addVar(vtype=\"CONTINUOUS\", name=\"TechSea\", lb=0)  # investment in technology for sea\nTechLand = model.addVar(vtype=\"CONTINUOUS\", name=\"TechLand\", lb=0)  # investment in technology for land\n\n# Define objective function\nCostAir = (1000 - 0.005 * TechAir) * TripsAir\nCostSea = (800 - 0.003 * TechSea) * TripsSea\nCostLand = (500 - 0.002 * TechLand) * TripsLand\n# So, the objective function is: Minimize (CostAir + CostSea + CostLand)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostAir + CostSea + CostLand)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational expenses and technology investments.\nmodel.addCons((1000 - 0.005 * TechAir) * TripsAir + (800 - 0.003 * TechSea) * TripsSea + (500 - 0.002 * TechLand) * TripsLand + TechAir + TechSea + TechLand <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Trips: \", model.getVal(TripsAir))\n    print(\"Number of Sea Trips: \", model.getVal(TripsSea))\n    print(\"Number of Land Trips: \", model.getVal(TripsLand))\n    print(\"Investment in Air Technology: $\", model.getVal(TechAir))\n    print(\"Investment in Sea Technology: $\", model.getVal(TechSea))\n    print(\"Investment in Land Technology: $\", model.getVal(TechLand))\n    print(\"Total Operational Cost: $\", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"HydroPlants\", \"range\": \"HydroPlants >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"BiomassGenerators\", \"range\": \"BiomassGenerators >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal stations\": \"GeothermalStations\", \"range\": \"GeothermalStations >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city wants to minimize the cost per unit of energy produced.\n// Total cost: Cost = 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations\n// Total energy produced: Energy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for installing renewable energy sources.\n// 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations <= 1,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 30,000 MWh of energy annually.\n// 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations >= 30,000",
        "question": "A city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost. The cost per unit and annual energy production for each type of energy source are given in the following Table.\n\n| Energy Source          | Cost per Unit | Annual Energy Production |\n|------------------------|---------------|--------------------------|\n| Solar Panels           | $10,000       | 20 MWh                   |\n| Wind Turbines          | $15,000       | 30 MWh                   |\n| Hydroelectric Plants   | $20,000       | 40 MWh                   |\n| Biomass Generators     | $12,000       | 25 MWh                   |\n| Geothermal Stations    | $25,000       | 50 MWh                   |\n\nThe city has a budget of $1,000,000 for installing renewable energy sources. The city aims to produce at least 30,000 MWh of energy annually. Please help the city to minimize the cost per unit of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)\nHydroPlants = model.addVar(vtype=\"INTEGER\", name=\"HydroPlants\", lb=0)\nBiomassGenerators = model.addVar(vtype=\"INTEGER\", name=\"BiomassGenerators\", lb=0)\nGeothermalStations = model.addVar(vtype=\"INTEGER\", name=\"GeothermalStations\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 10000 * SolarPanels + 15000 * WindTurbines + 20000 * HydroPlants + 12000 * BiomassGenerators + 25000 * GeothermalStations\nEnergy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for installing renewable energy sources.\nmodel.addCons(Cost <= 1000000)\n## The city aims to produce at least 30,000 MWh of energy annually.\nmodel.addCons(Energy >= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(HydroPlants))\n    print(\"Number of Biomass Generators: \", model.getVal(BiomassGenerators))\n    print(\"Number of Geothermal Stations: \", model.getVal(GeothermalStations))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"available units of resource X\": \"ResourceX\", \"range\": \"ResourceX >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Y\": \"ResourceY\", \"range\": \"ResourceY >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Z\": \"ResourceZ\", \"range\": \"ResourceZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nEach unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively.\n// 2 * ProductA <= ResourceX\n// 3 * ProductB <= ResourceY\n// 4 * ProductC <= ResourceZ\n// ResourceX <= 100\n// ResourceY <= 150\n// ResourceZ <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units.\n// ProductA >= 10\n// ProductB >= 20\n// ProductC >= 15\n\n## Generate Constraint-3:\nThe manufacturer has a limit on the total production capacity of 50 units across all products.\n// ProductA + ProductB + ProductC <= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that at least 30% of the total production is of product A.\n// ProductA >= 0.3 * (ProductA + ProductB + ProductC)\n\n## Generate Constraint-5:\nThe cost of production for product A is $20 per unit, for product B is $30 per unit, and for product C is $25 per unit. The total production cost should not exceed $1500.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 1500",
        "question": "A manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the resource requirements and production costs for each product.\n\n| Product | Profit per Unit | Resource X Required | Resource Y Required | Resource Z Required | Production Cost per Unit |\n|---------|-----------------|---------------------|---------------------|---------------------|-------------------------|\n| A       | 50$             | 2 units             | 0 units             | 0 units             | 20$                     |\n| B       | 70$             | 0 units             | 3 units             | 0 units             | 30$                     |\n| C       | 60$             | 0 units             | 0 units             | 4 units             | 25$                     |\n\nThe total available units of resource X, Y, and Z are 100, 150, and 200, respectively. The market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units. The manufacturer has a limit on the total production capacity of 50 units across all products. The manufacturer wants to ensure that at least 30% of the total production is of product A. The total production cost should not exceed $1500.\n\nPlease help the manufacturer to maximize the total profit from selling all products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=15)  # quantity of product C\nResourceX = model.addVar(vtype=\"INTEGER\", name=\"ResourceX\", lb=0, ub=100)  # available units of resource X\nResourceY = model.addVar(vtype=\"INTEGER\", name=\"ResourceY\", lb=0, ub=150)  # available units of resource Y\nResourceZ = model.addVar(vtype=\"INTEGER\", name=\"ResourceZ\", lb=0, ub=200)  # available units of resource Z\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint-1: Resource constraints\nmodel.addCons(2 * ProductA <= ResourceX)\nmodel.addCons(3 * ProductB <= ResourceY)\nmodel.addCons(4 * ProductC <= ResourceZ)\nmodel.addCons(ResourceX <= 100)\nmodel.addCons(ResourceY <= 150)\nmodel.addCons(ResourceZ <= 200)\n\n# Constraint-2: Market demand\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 20)\nmodel.addCons(ProductC >= 15)\n\n# Constraint-3: Total production capacity\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\n\n# Constraint-4: At least 30% of total production is product A\nmodel.addCons(ProductA >= 0.3 * (ProductA + ProductB + ProductC))\n\n# Constraint-5: Total production cost\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1657,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// TotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500",
        "question": "A manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the resource requirements for each product:\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit (kg) |\n|---------|-----------------|----------------------|----------------------------|\n| A       | $50             | 5                    | 10                         |\n| B       | $70             | 8                    | 15                         |\n| C       | $60             | 6                    | 12                         |\n\nThe total available labor hours per week are 1000, and the total available raw material per week is 1500 kg. Please help the company to maximize the total profit from all products while adhering to these resource constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\nTotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total available labor hours per week are 1000.\nmodel.addCons(5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000)\n# The total available raw material per week is 1500 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor Truck B, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 20 tons.\nFor Truck C, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 30 tons.\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints.\n// Cost_TruckA = (0.5 + 0.3) * TruckA\n// Cost_TruckB = (0.6 + 0.4) * TruckB\n// Cost_TruckC = (0.7 + 0.5) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must not exceed 100 tons.\n// 10 * TruckA + 20 * TruckB + 30 * TruckC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\n// (0.5 + 0.3) * TruckA + (0.6 + 0.4) * TruckB + (0.7 + 0.5) * TruckC <= 5000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost. The fuel cost per kilometer, maintenance cost per kilometer, and capacity for each truck are given in the following Table.\n\n| Truck Type | Fuel Cost per Kilometer | Maintenance Cost per Kilometer | Capacity |\n|------------|-------------------------|--------------------------------|----------|\n| Truck A    | $0.5                    | $0.3                           | 10 tons  |\n| Truck B    | $0.6                    | $0.4                           | 20 tons  |\n| Truck C    | $0.7                    | $0.5                           | 30 tons  |\n\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints. The total capacity of all trucks must not exceed 100 tons. The company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\n\nPlease help the company to determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nCost_TruckA = (0.5 + 0.3) * TruckA\nCost_TruckB = (0.6 + 0.4) * TruckB\nCost_TruckC = (0.7 + 0.5) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The total capacity of all trucks must not exceed 100 tons.\nmodel.addCons(10 * TruckA + 20 * TruckB + 30 * TruckC <= 100)\n# The company has a budget of $5000 for total operational costs (fuel and maintenance) per month.\nmodel.addCons((0.5 + 0.3) * TruckA + (0.6 + 0.4) * TruckB + (0.7 + 0.5) * TruckC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. \nOn route 1, each additional truck improves fuel efficiency by 0.5% per mile. \nOn route 2, each additional truck improves fuel efficiency by 0.7% per mile. \nOn route 3, each additional truck improves fuel efficiency by 0.6% per mile. \nOn route 4, each additional truck improves fuel efficiency by 0.8% per mile. \nOn route 5, each additional truck improves fuel efficiency by 0.4% per mile. \nThe company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time.\n// Fuel_Consumption_Route_1 = (1 - 0.005 * T1) * D1\n// Fuel_Consumption_Route_2 = (1 - 0.007 * T2) * D2\n// Fuel_Consumption_Route_3 = (1 - 0.006 * T3) * D3\n// Fuel_Consumption_Route_4 = (1 - 0.008 * T4) * D4\n// Fuel_Consumption_Route_5 = (1 - 0.004 * T5) * D5\n// So, the objective function is: Minimize (Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. On route 1, each additional truck improves fuel efficiency by 0.5% per mile. On route 2, each additional truck improves fuel efficiency by 0.7% per mile. On route 3, each additional truck improves fuel efficiency by 0.6% per mile. On route 4, each additional truck improves fuel efficiency by 0.8% per mile. On route 5, each additional truck improves fuel efficiency by 0.4% per mile. The company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time. The total number of trucks available is 100. Please help the company to determine the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Define fuel consumption for each route\nD1 = 1000  # Distance for route 1, placeholder value\nD2 = 1500  # Distance for route 2, placeholder value\nD3 = 1200  # Distance for route 3, placeholder value\nD4 = 1800  # Distance for route 4, placeholder value\nD5 = 2000  # Distance for route 5, placeholder value\n\nFuel_Consumption_Route_1 = (1 - 0.005 * T1) * D1\nFuel_Consumption_Route_2 = (1 - 0.007 * T2) * D2\nFuel_Consumption_Route_3 = (1 - 0.006 * T3) * D3\nFuel_Consumption_Route_4 = (1 - 0.008 * T4) * D4\nFuel_Consumption_Route_5 = (1 - 0.004 * T5) * D5\n\n## the objective function is: Minimize (Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\nmodel.addCons(obj == Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost.\n// Total cargo capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total operational cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n// So, the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations. The operational costs and capacities for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Month | Capacity (tons) |\n|------------|----------------------------|-----------------|\n| Truck A    | $1000                      | 10              |\n| Truck B    | $1500                      | 15              |\n| Truck C    | $2000                      | 20              |\n| Truck D    | $2500                      | 25              |\n| Truck E    | $3000                      | 30              |\n\nThe company has a budget of $100,000 for operational costs for the month. The company has a limit on the number of trucks it can deploy, with a maximum of 50 trucks in total. \n\nPlease help the company to maximize its total cargo capacity while minimizing the total operational cost, by optimizing the ratio of total cargo capacity to total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCargoCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nTotalOperationalCost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n## the objective function is: Maximize (TotalCargoCapacity) / (TotalOperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * TotalOperationalCost == TotalCargoCapacity)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000)\n## The company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Operational Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company needs to decide the number of trucks to purchase for three different types of trucks: TruckA, TruckB, and TruckC. Additionally, the company is considering investing in advanced navigation systems for each type of truck to improve fuel efficiency and reduce delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in navigation system for TruckA\": \"NavA\", \"range\": \"NavA >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckB\": \"NavB\", \"range\": \"NavB >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckC\": \"NavC\", \"range\": \"NavC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel cost is affected by the navigation system investment, reducing the fuel consumption per kilometer by a certain percentage based on the investment.\nThe operational cost per kilometer for TruckA is $0.50, but with the navigation system, it decreases by 0.01% for every $100 invested.\nThe operational cost per kilometer for TruckB is $0.60, and with the navigation system, it decreases by 0.015% for every $100 invested.\nThe operational cost per kilometer for TruckC is $0.70, and with the navigation system, it decreases by 0.02% for every $100 invested.\nThe company operates each truck for 100,000 kilometers per year.\n// Operational cost for TruckA: CostA = (0.50 - 0.0001 * NavA) * 100000 * TruckA\n// Operational cost for TruckB: CostB = (0.60 - 0.00015 * NavB) * 100000 * TruckB\n// Operational cost for TruckC: CostC = (0.70 - 0.0002 * NavC) * 100000 * TruckC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in navigation systems.\n// TruckA * 100000 + TruckB * 120000 + TruckC * 150000 + NavA + NavB + NavC <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 10.\n// TruckA + TruckB + TruckC <= 10",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company needs to decide the number of trucks to purchase for three different types of trucks: TruckA, TruckB, and TruckC. Additionally, the company is considering investing in advanced navigation systems for each type of truck to improve fuel efficiency and reduce delivery times. The operational cost per kilometer and the impact of the navigation system investment on fuel efficiency are given in the following Table.\n\n| Truck Type | Operational Cost per Kilometer | Navigation System Impact |\n|------------|--------------------------------|-------------------------|\n| TruckA     | $0.50                          | 0.01% decrease per $100 |\n| TruckB     | $0.60                          | 0.015% decrease per $100|\n| TruckC     | $0.70                          | 0.02% decrease per $100 |\n\nThe company operates each truck for 100,000 kilometers per year. The company has a budget of $1,000,000 for purchasing trucks and investing in navigation systems. The total number of trucks cannot exceed 10.\n\nPlease help the company to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel, considering the impact of the navigation system investment on fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nNavA = model.addVar(vtype=\"CONTINUOUS\", name=\"NavA\", lb=0)\nNavB = model.addVar(vtype=\"CONTINUOUS\", name=\"NavB\", lb=0)\nNavC = model.addVar(vtype=\"CONTINUOUS\", name=\"NavC\", lb=0)\n\n# Define objective function\nCostA = (0.50 - 0.0001 * NavA) * 100000 * TruckA\nCostB = (0.60 - 0.00015 * NavB) * 100000 * TruckB\nCostC = (0.70 - 0.0002 * NavC) * 100000 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(TruckA * 100000 + TruckB * 120000 + TruckC * 150000 + NavA + NavB + NavC <= 1000000)\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Navigation System for TruckA: \", model.getVal(NavA))\n    print(\"Investment in Navigation System for TruckB: \", model.getVal(NavB))\n    print(\"Investment in Navigation System for TruckC: \", model.getVal(NavC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1300,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost is a nonlinear function of the fuel optimization level and the number of trucks. The fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region 1: Cost1 = Trucks1 * (100 - 0.5 * Fuel1^2)\n// Fuel cost for Region 2: Cost2 = Trucks2 * (120 - 0.6 * Fuel2^2)\n// Fuel cost for Region 3: Cost3 = Trucks3 * (110 - 0.4 * Fuel3^2)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-2:\nThe maximum fuel optimization level for each region is capped at 10 units.\n// Fuel1 <= 10; Fuel2 <= 10; Fuel3 <= 10\n\n## Generate Constraint-3:\nDue to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines. The fuel cost is a nonlinear function of the fuel optimization level and the number of trucks, where the fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions. The total number of trucks available is 100. The maximum fuel optimization level for each region is capped at 10 units. Due to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2. Please help the company to determine the optimal allocation of trucks and fuel optimization levels.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0, ub=10)  # fuel optimization for Region 1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0, ub=10)  # fuel optimization for Region 2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0, ub=10)  # fuel optimization for Region 3\n\n# Define objective function\nCost1 = Trucks1 * (100 - 0.5 * Fuel1**2)\nCost2 = Trucks2 * (120 - 0.6 * Fuel2**2)\nCost3 = Trucks3 * (110 - 0.4 * Fuel3**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region 1: \", model.getVal(Fuel1))\n    print(\"Fuel Optimization for Region 2: \", model.getVal(Fuel2))\n    print(\"Fuel Optimization for Region 3: \", model.getVal(Fuel3))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\n// TrucksC + TrucksD >= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for each route are given in the following Table.\n\n| Route   | Cost per Truck |\n|---------|----------------|\n| RouteA  | $50,000        |\n| RouteB  | $60,000        |\n| RouteC  | $70,000        |\n| RouteD  | $80,000        |\n| RouteE  | $90,000        |\n\nThe company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks. The company wants to ensure that each route has at least one truck allocated.\n\nPlease help the company to minimize the total cost of fuel and maintenance by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\nmodel.addCons(TrucksC + TrucksD >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Profit_A = (20 - 10) * A\n// Profit_B = (30 - 20) * B\n// Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 50 units, and for device B is at least 40 units.\n// A >= 50; B >= 40\n\n## Generate Constraint-3:\nThe company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit.\n// 5 * A + 10 * B + 15 * C <= 15000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit, production cost per unit, and production time for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Production Time |\n|--------|-----------------|--------------------------|-----------------|\n| A      | $20             | $10                      | 2 hours         |\n| B      | $30             | $20                      | 3 hours         |\n| C      | $40             | $30                      | 4 hours         |\n\nThe company has a total production capacity of 1000 hours. The market demand for device A is at least 50 units, and for device B is at least 40 units. The company has a budget of $15000 for raw materials, and the cost of raw materials for each device is also given in the Table.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The market demand for device A is at least 50 units, and for device B is at least 40 units.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 40)\n## The company has a budget of $15000 for raw materials\nmodel.addCons(5 * A + 10 * B + 15 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Trucks\": \"EfficiencyT\", \"range\": \"EfficiencyT >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Vans\": \"EfficiencyV\", \"range\": \"EfficiencyV >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Bikes\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n// Total annual fuel cost for Trucks: CostT = (100 - 0.01 * EfficiencyT) * Trucks\n// Total annual fuel cost for Vans: CostV = (100 - 0.015 * EfficiencyV) * Vans\n// Total annual fuel cost for Bikes: CostB = (100 - 0.02 * EfficiencyB) * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\n// Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000\n\n## Generate Constraint-2:\nThe company must have at least 50 Trucks and 100 Vans to meet contractual obligations.\n// Trucks >= 50; Vans >= 100\n\n## Generate Constraint-3:\nDue to storage limitations, the total number of vehicles cannot exceed 200.\n// Trucks + Vans + Bikes <= 200\n\n## Generate Constraint-4:\nThe company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\n// Bikes >= 0.20 * (Trucks + Vans + Bikes)",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle. The fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n\n| Vehicle Type | Cost Reduction per Unit of Fuel Saved | Fuel Efficiency Improvement per $1000 Invested |\n|--------------|---------------------------------------|-----------------------------------------------|\n| Trucks       | $0.50                                 | 1%                                            |\n| Vans         | $0.30                                 | 1.5%                                          |\n| Bikes        | $0.10                                 | 2%                                            |\n\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades. The company must have at least 50 Trucks and 100 Vans to meet contractual obligations. Due to storage limitations, the total number of vehicles cannot exceed 200. The company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\n\nPlease help the company to determine the optimal number of each type of vehicle to purchase and the investment in fuel efficiency to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nEfficiencyT = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyT\", lb=0)  # investment in fuel efficiency for Trucks\nEfficiencyV = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyV\", lb=0)  # investment in fuel efficiency for Vans\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for Bikes\n\n# Define objective function\nCostT = (100 - 0.01 * EfficiencyT) * Trucks\nCostV = (100 - 0.015 * EfficiencyV) * Vans\nCostB = (100 - 0.02 * EfficiencyB) * Bikes\n# So, the objective function is: Minimize (CostT + CostV + CostB)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\n# The company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\nmodel.addCons(Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000)\n# Due to storage limitations, the total number of vehicles cannot exceed 200.\nmodel.addCons(Trucks + Vans + Bikes <= 200)\n# The company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\nmodel.addCons(Bikes >= 0.20 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Fuel Efficiency for Trucks: \", model.getVal(EfficiencyT))\n    print(\"Investment in Fuel Efficiency for Vans: \", model.getVal(EfficiencyV))\n    print(\"Investment in Fuel Efficiency for Bikes: \", model.getVal(EfficiencyB))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1806,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company wants to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n// Total_Cost_T1 = 1.5 * T1\n// Total_Cost_T2 = 2 * T2\n// Total_Cost_T3 = 2.5 * T3\n// Total_Cost_T4 = 3 * T4\n// Total_Cost_T5 = 3.5 * T5\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations.\n// 1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company has a budget of $10,000 for truck operations. The total number of trucks cannot exceed 100.\nPlease help the company to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 1.5 * T1\nTotal_Cost_T2 = 2 * T2\nTotal_Cost_T3 = 2.5 * T3\nTotal_Cost_T4 = 3 * T4\nTotal_Cost_T5 = 3.5 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations.\nmodel.addCons(1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is 0.05 * A^2, for product B is 0.07 * B^2, and for product C is 0.09 * C^2. The company aims to maximize its total profit.\n// Profit_A = 20 * A - 0.05 * A^2\n// Profit_B = 30 * B - 0.07 * B^2\n// Profit_C = 40 * C - 0.09 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for production costs.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Formula |\n|---------|-----------------|--------------------------|\n| A       | $20             | 0.05 * A^2               |\n| B       | $30             | 0.07 * B^2               |\n| C       | $40             | 0.09 * C^2               |\n\nThe company has a total budget of $1000 for production costs. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 20 * A - 0.05 * A**2\nProfit_B = 30 * B - 0.07 * B**2\nProfit_C = 40 * C - 0.09 * C**2\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $1000 for production costs.\nmodel.addCons(0.05 * A**2 + 0.07 * B**2 + 0.09 * C**2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of constructing a solar facility is $500,000, a wind facility is $600,000, a hydro facility is $700,000, a biomass facility is $400,000, and a geothermal facility is $800,000. The energy output per facility is 1.5 MW for solar, 2 MW for wind, 1.8 MW for hydro, 1.2 MW for biomass, and 2.5 MW for geothermal. The city wants to minimize the cost per MW of energy produced.\n// Total cost: Cost = 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal\n// Total energy output: Energy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of these facilities.\n// 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal <= 10,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 50 MW of renewable energy.\n// 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50\n\n## Generate Constraint-3:\nDue to geographical limitations, the city can only build a maximum of 10 hydro facilities.\n// Hydro <= 10",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently. The cost of constructing a solar facility is $500,000, a wind facility is $600,000, a hydro facility is $700,000, a biomass facility is $400,000, and a geothermal facility is $800,000. The energy output per facility is 1.5 MW for solar, 2 MW for wind, 1.8 MW for hydro, 1.2 MW for biomass, and 2.5 MW for geothermal. The city has a budget of $10 million for the construction of these facilities and aims to produce at least 50 MW of renewable energy. Due to geographical limitations, the city can only build a maximum of 10 hydro facilities. Please help the city to minimize the cost per MW of energy produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0, ub=10)  # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0)  # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0)  # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal\nEnergy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of these facilities.\nmodel.addCons(500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal <= 10000000)\n## The city aims to produce at least 50 MW of renewable energy.\nmodel.addCons(1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per MW: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total delivery time, considering the nonlinear relationship between the number of trucks and the delivery time. The delivery time for each warehouse is modeled as a quadratic function of the number of trucks allocated:\n- For WarehouseA, the delivery time is given by: TimeA = 100 / (TrucksA^2 + 1)\n- For WarehouseB, the delivery time is given by: TimeB = 120 / (TrucksB^2 + 1)\n- For WarehouseC, the delivery time is given by: TimeC = 150 / (TrucksC^2 + 1)\n- For WarehouseD, the delivery time is given by: TimeD = 130 / (TrucksD^2 + 1)\n- For WarehouseE, the delivery time is given by: TimeE = 140 / (TrucksE^2 + 1)\nThe company wants to minimize the total delivery time across all warehouses.\n// So, the objective function is: Minimize (TimeA + TimeB + TimeC + TimeD + TimeE)\n// Minimize (100 / (TrucksA^2 + 1) + 120 / (TrucksB^2 + 1) + 150 / (TrucksC^2 + 1) + 130 / (TrucksD^2 + 1) + 140 / (TrucksE^2 + 1))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nWarehouseC requires at least 10 trucks to operate efficiently.\n// TrucksC >= 10\n\n## Generate Constraint-4:\nThe company aims to ensure that each warehouse has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency. The delivery time for each warehouse is modeled as a quadratic function of the number of trucks allocated, as shown in the following Table.\n\n| Warehouse | Delivery Time Function |\n|-----------|------------------------|\n| WarehouseA | TimeA = 100 / (TrucksA^2 + 1) |\n| WarehouseB | TimeB = 120 / (TrucksB^2 + 1) |\n| WarehouseC | TimeC = 150 / (TrucksC^2 + 1) |\n| WarehouseD | TimeD = 130 / (TrucksD^2 + 1) |\n| WarehouseE | TimeE = 140 / (TrucksE^2 + 1) |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB. WarehouseC requires at least 10 trucks to operate efficiently. The company aims to ensure that each warehouse has at least one truck allocated. \n\nPlease help the company to minimize the total delivery time across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=10)  # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for WarehouseE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTimeA = 100 / (TrucksA**2 + 1)\nTimeB = 120 / (TrucksB**2 + 1)\nTimeC = 150 / (TrucksC**2 + 1)\nTimeD = 130 / (TrucksD**2 + 1)\nTimeE = 140 / (TrucksE**2 + 1)\n## the objective function is: Minimize (TimeA + TimeB + TimeC + TimeD + TimeE)\n## convert the division to multiplication\nmodel.addCons(obj == TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost per unit of product A\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product B\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product C\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product A\": \"RevenueA\", \"range\": \"RevenueA >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product B\": \"RevenueB\", \"range\": \"RevenueB >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product C\": \"RevenueC\", \"range\": \"RevenueC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, and the revenue per unit is $100.\nThe cost of producing each unit of product B is $70, and the revenue per unit is $140.\nThe cost of producing each unit of product C is $60, and the revenue per unit is $120.\nThe company wants to maximize the total profit.\n// Profit_A = UnitsA * (RevenueA - CostA)\n// Profit_B = UnitsB * (RevenueB - CostB)\n// Profit_C = UnitsC * (RevenueC - CostC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the machines is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines. The cost and revenue per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| A       | $50           | $100             |\n| B       | $70           | $140             |\n| C       | $60           | $120             |\n\nThe total production capacity of the machines is 100 units per day. The company wants to maximize the total profit, which is calculated as the sum of the profits from each product (profit = revenue - cost). Please help the company determine the optimal number of units to produce for each product (A, B, and C) to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * (100 - 50) # Profit per unit of product A\nProfit_B = UnitsB * (140 - 70) # Profit per unit of product B\nProfit_C = UnitsC * (120 - 60) # Profit per unit of product C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C) # Objective function\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100) # Total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. Product A is valued at $20 per unit and Product B is valued at $30 per unit. The company aims to maximize the total production value. The total operating hours for all machines must not exceed 120 hours per week.\nPlease help the company to determine the optimal number of hours each machine should operate to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (VA + VB)\nmodel.addCons(obj == VA + VB)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 120 hours per week.\nmodel.addCons(M1 + M2 + M3 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA_Quantity\", \"range\": \"MachineA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB_Quantity\", \"range\": \"MachineB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC_Quantity\", \"range\": \"MachineC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD_Quantity\", \"range\": \"MachineD_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n// Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\n// MachineB_Quantity >= 0.5 * MachineA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage limit of 600 machines at any given time.\n// MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 600",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company has a total production capacity of 1000 machines per month. Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA. The company also has a storage limit of 600 machines at any given time. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Quantity\", lb=0)\nMachineB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Quantity\", lb=0)\nMachineC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Quantity\", lb=0)\nMachineD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineD_Quantity\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n## Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineA_Quantity\")\nsqrt_MachineB_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineB_Quantity\")\nsqrt_MachineC_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineC_Quantity\")\nsqrt_MachineD_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineD_Quantity\")\n\nmodel.addCons(sqrt_MachineA_Quantity**2 == MachineA_Quantity)\nmodel.addCons(sqrt_MachineB_Quantity**2 == MachineB_Quantity)\nmodel.addCons(sqrt_MachineC_Quantity**2 == MachineC_Quantity)\nmodel.addCons(sqrt_MachineD_Quantity**2 == MachineD_Quantity)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Quantity) * MachineA_Quantity\nProfit_B = (700 - 300 * sqrt_MachineB_Quantity) * MachineB_Quantity\nProfit_C = (900 - 400 * sqrt_MachineC_Quantity) * MachineC_Quantity\nProfit_D = (1100 - 500 * sqrt_MachineD_Quantity) * MachineD_Quantity\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000)\n\n## Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\nmodel.addCons(MachineB_Quantity >= 0.5 * MachineA_Quantity)\n\n## The company has a storage limit of 600 machines at any given time.\nmodel.addCons(MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA_Quantity))\n    print(\"Number of MachineB: \", model.getVal(MachineB_Quantity))\n    print(\"Number of MachineC: \", model.getVal(MachineC_Quantity))\n    print(\"Number of MachineD: \", model.getVal(MachineD_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: A, B, C, D, and E. Each vehicle has a different fuel efficiency, maintenance cost, and capacity. The company needs to decide how many units of each vehicle to deploy for the upcoming month to optimize its operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a capacity of 1 ton.\nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a capacity of 2 tons.\nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a capacity of 3 tons.\nVehicle D has a fuel efficiency of 25 km/l, a maintenance cost of $500 per month, and a capacity of 4 tons.\nVehicle E has a fuel efficiency of 30 km/l, a maintenance cost of $600 per month, and a capacity of 5 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of the maintenance costs divided by the product of the capacity and the fuel efficiency of each vehicle).\n// Maintenance cost of A: Cost_A = 200 * A\n// Maintenance cost of B: Cost_B = 300 * B\n// Maintenance cost of C: Cost_C = 400 * C\n// Maintenance cost of D: Cost_D = 500 * D\n// Maintenance cost of E: Cost_E = 600 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / ((1 * 10) * A + (2 * 15) * B + (3 * 20) * C + (4 * 25) * D + (5 * 30) * E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C + 500 * D + 600 * E <= 15000\n\n## Generate Constraint-2:\nThe company wants to deploy at least 5 units of each vehicle next month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 100 tons of cargo to transport next month.\n// A + 2 * B + 3 * C + 4 * D + 5 * E >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Vehicle E does not exceed the combined number of Vehicles A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of Vehicle D does not exceed the combined number of Vehicles A, B, C, and E.\n// D <= A + B + C + E",
        "question": "A logistics company operates five different types of vehicles: A, B, C, D, and E. Each vehicle has a different fuel efficiency, maintenance cost, and capacity. The company needs to decide how many units of each vehicle to deploy for the upcoming month to optimize its operations. The details of each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Capacity (tons) |\n|---------|-----------------------|---------------------------|-----------------|\n| A       | 10                    | 200                       | 1               |\n| B       | 15                    | 300                       | 2               |\n| C       | 20                    | 400                       | 3               |\n| D       | 25                    | 500                       | 4               |\n| E       | 30                    | 600                       | 5               |\n\nThe company has a budget of $15,000 for vehicle maintenance next month. The company wants to deploy at least 5 units of each vehicle next month. The company has a total of 100 tons of cargo to transport next month. The company wants to ensure that the total number of Vehicle E does not exceed the combined number of Vehicles A, B, and C. Additionally, the company wants to ensure that the total number of Vehicle D does not exceed the combined number of Vehicles A, B, C, and E. \n\nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of the maintenance costs divided by the product of the capacity and the fuel efficiency of each vehicle).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to deploy at least 5 units of each vehicle next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of vehicles C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of vehicles D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of vehicles E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 * A\nCost_B = 300 * B\nCost_C = 400 * C\nCost_D = 500 * D\nCost_E = 600 * E\nCapacity_A = 1 * 10 * A\nCapacity_B = 2 * 15 * B\nCapacity_C = 3 * 20 * C\nCapacity_D = 4 * 25 * D\nCapacity_E = 5 * 30 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Capacity_A + Capacity_B + Capacity_C + Capacity_D + Capacity_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Capacity_A + Capacity_B + Capacity_C + Capacity_D + Capacity_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $15,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C + 500 * D + 600 * E <= 15000)\n## The company has a total of 100 tons of cargo to transport next month.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E >= 100)\n## The company wants to ensure that the total number of Vehicle E does not exceed the combined number of Vehicles A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The company wants to ensure that the total number of Vehicle D does not exceed the combined number of Vehicles A, B, C, and E.\nmodel.addCons(D <= A + B + C + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicle A: \", model.getVal(A))\n    print(\"Number of Vehicle B: \", model.getVal(B))\n    print(\"Number of Vehicle C: \", model.getVal(C))\n    print(\"Number of Vehicle D: \", model.getVal(D))\n    print(\"Number of Vehicle E: \", model.getVal(E))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1596,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years.\nType C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output.\n// EnergyOutput = 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20\n// TotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n// So, the objective function is: Minimize (TotalCost - EnergyOutput)\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of solar panels.\n// 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. Type A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years. Type B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years. Type C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years. The city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output. The city has a budget of $1,000,000 for the installation of solar panels. Please help the city determine the number of each type of solar panel to install in each district.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergyOutput = 0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20\nTotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n# So, the objective function is: Minimize (TotalCost - EnergyOutput)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost - EnergyOutput)\n\n# Add constraints\n# The city has a budget of $1,000,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck varies with the number of trips it makes. For Truck1, the fuel efficiency is 0.5 + 0.01 * T1 (in gallons per mile). For Truck2, it's 0.6 + 0.01 * T2. For Truck3, it's 0.7 + 0.01 * T3. For Truck4, it's 0.8 + 0.01 * T4. For Truck5, it's 0.9 + 0.01 * T5. The operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost.\n// Fuel efficiency for Truck1: FE1 = 0.5 + 0.01 * T1\n// Fuel efficiency for Truck2: FE2 = 0.6 + 0.01 * T2\n// Fuel efficiency for Truck3: FE3 = 0.7 + 0.01 * T3\n// Fuel efficiency for Truck4: FE4 = 0.8 + 0.01 * T4\n// Fuel efficiency for Truck5: FE5 = 0.9 + 0.01 * T5\n// Total operational cost: Cost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach truck can make at most 30 trips.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nAt least 10 trips must be made by Truck1 and Truck2 combined.\n// T1 + T2 >= 10",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs. The fuel efficiency of each truck varies with the number of trips it makes. For Truck1, the fuel efficiency is 0.5 + 0.01 * T1 (in gallons per mile). For Truck2, it's 0.6 + 0.01 * T2. For Truck3, it's 0.7 + 0.01 * T3. For Truck4, it's 0.8 + 0.01 * T4. For Truck5, it's 0.9 + 0.01 * T5. The operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost. The total number of trips across all trucks must not exceed 100. Each truck can make at most 30 trips. At least 10 trips must be made by Truck1 and Truck2 combined. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=30) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=30) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=30) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=30) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=30) # number of trips for Truck5\n\n# Define objective function\nFE1 = 0.5 + 0.01 * T1\nFE2 = 0.6 + 0.01 * T2\nFE3 = 0.7 + 0.01 * T3\nFE4 = 0.8 + 0.01 * T4\nFE5 = 0.9 + 0.01 * T5\nCost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 + T2 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\n// Corn <= Wheat + Soybeans",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The profit per acre and the risk of crop failure for each crop are given in the following Table.\n\n| Crop      | Profit per Acre | Risk of Crop Failure |\n|-----------|-----------------|----------------------|\n| Corn      | $200            | 5%                   |\n| Wheat     | $180            | 3%                   |\n| Soybeans  | $220            | 4%                   |\n| Barley    | $150            | 6%                   |\n| Oats      | $160            | 2%                   |\n\nThe farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans. \n\nPlease help the farmer to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n## Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\nmodel.addCons(Corn <= Wheat + Soybeans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the average daily energy production per panel is 1.5 kWh, the installation cost per panel is $500, and the maintenance cost per panel is $50 per year.\nFor D2, the average daily energy production per panel is 1.2 kWh, the installation cost per panel is $450, and the maintenance cost per panel is $45 per year.\nFor D3, the average daily energy production per panel is 1.8 kWh, the installation cost per panel is $550, and the maintenance cost per panel is $55 per year.\nFor D4, the average daily energy production per panel is 1.6 kWh, the installation cost per panel is $600, and the maintenance cost per panel is $60 per year.\nFor D5, the average daily energy production per panel is 1.4 kWh, the installation cost per panel is $400, and the maintenance cost per panel is $40 per year.\nThe city wants to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost.\n// Total annual energy production: Energy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\n// Total annual maintenance cost: Maintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\n// Total installation cost: Installation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n// So, the objective function is: Maximize (Energy - Maintenance) / Installation\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed. The city wants to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost. The average daily energy production per panel, installation cost per panel, and maintenance cost per panel for each district are given in the following Table.\n\n| District | Average Daily Energy Production (kWh) | Installation Cost per Panel ($) | Maintenance Cost per Panel per Year ($) |\n|----------|--------------------------------------|---------------------------------|----------------------------------------|\n| D1       | 1.5                                  | 500                             | 50                                     |\n| D2       | 1.2                                  | 450                             | 45                                     |\n| D3       | 1.8                                  | 550                             | 55                                     |\n| D4       | 1.6                                  | 600                             | 60                                     |\n| D5       | 1.4                                  | 400                             | 40                                     |\n\nThe city has a budget of $100,000 for the installation of solar panels. Please help the city determine the optimal number of solar panels to install in each district to maximize the NEY per dollar invested.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\nMaintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\nInstallation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n## the objective function is: Maximize (Energy - Maintenance) / Installation\n## convert the division to multiplication\nmodel.addCons(obj * Installation == Energy - Maintenance)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Net Energy Yield per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1676,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company also needs to decide on the number of trucks to allocate to each zone. Additionally, the company is considering investing in a new fleet management software that can reduce fuel consumption and maintenance costs, depending on the amount invested.\n// {\"number of trucks in Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software\": \"SoftwareInvestment\", \"range\": \"SoftwareInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost savings from the fleet management software are nonlinear and increase with the investment, but at a decreasing rate. The cost savings per truck per zone are modeled as a quadratic function of the investment. The company aims to minimize the total operational cost, which includes fuel, maintenance, and software investment costs.\n// Cost_Zone1 = (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment^2) * Trucks1\n// Cost_Zone2 = (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment^2) * Trucks2\n// Cost_Zone3 = (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment^2) * Trucks3\n// Cost_Zone4 = (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment^2) * Trucks4\n// Cost_Zone5 = (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment^2) * Trucks5\n// So, the objective function is: Minimize (Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and software investment.\n// (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment^2) * Trucks1 +\n// (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment^2) * Trucks2 +\n// (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment^2) * Trucks3 +\n// (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment^2) * Trucks4 +\n// (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment^2) * Trucks5 +\n// SoftwareInvestment <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available in the fleet is 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company also needs to decide on the number of trucks to allocate to each zone and consider investing in a new fleet management software that can reduce fuel consumption and maintenance costs, depending on the amount invested. The cost savings from the fleet management software are nonlinear and increase with the investment, but at a decreasing rate. The cost savings per truck per zone are modeled as a quadratic function of the investment. The company aims to minimize the total operational cost, which includes fuel, maintenance, and software investment costs.\n\nThe operational costs for each zone, including the effects of the software investment, are given in the following Table:\n\n| Zone       | Base Operational Cost | Software Investment Effect |\n|------------|-----------------------|----------------------------|\n| Zone1      | 1000$                 | 0.01 - 0.0002 * Investment |\n| Zone2      | 1200$                 | 0.012 - 0.00024 * Investment |\n| Zone3      | 1100$                 | 0.011 - 0.00022 * Investment |\n| Zone4      | 900$                  | 0.009 - 0.00018 * Investment |\n| Zone5      | 1300$                 | 0.013 - 0.00026 * Investment |\n\nThe company has a total budget of $100,000 for operational costs and software investment. The total number of trucks available in the fleet is 100.\n\nPlease help the company to determine the optimal number of trucks to allocate to each zone and the amount to invest in the fleet management software to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks in Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks in Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks in Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks in Zone5\nSoftwareInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareInvestment\", lb=0) # investment in fleet management software\n\n# Define objective function\nCost_Zone1 = (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment**2) * Trucks1\nCost_Zone2 = (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment**2) * Trucks2\nCost_Zone3 = (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment**2) * Trucks3\nCost_Zone4 = (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment**2) * Trucks4\nCost_Zone5 = (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment**2) * Trucks5\n# So, the objective function is: Minimize (Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and software investment.\nmodel.addCons((1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment**2) * Trucks1 +\n              (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment**2) * Trucks2 +\n              (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment**2) * Trucks3 +\n              (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment**2) * Trucks4 +\n              (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment**2) * Trucks5 +\n              SoftwareInvestment <= 100000)\n# The total number of trucks available in the fleet is 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Zone5: \", model.getVal(Trucks5))\n    print(\"Investment in Fleet Management Software: \", model.getVal(SoftwareInvestment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1668,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in machine efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $5,000 invested in machine efficiency upgrades. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades.\n// Total revenue for ProductA: RevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductB: RevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductC: RevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 20 machines available for the production of all products.\n// MachinesA + MachinesB + MachinesC <= 20\n\n## Generate Constraint-2:\nThe total investment in machine efficiency upgrades cannot exceed $100,000.\n// EfficiencyInvestment <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units.\n// QuantityA >= 500; QuantityB >= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit. The production time per unit decreases by 1 minute for every $5,000 invested in machine efficiency upgrades. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company has a total of 20 machines available for the production of all products. The total investment in machine efficiency upgrades cannot exceed $100,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units. The company aims to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades. Please help the company determine the optimal production quantities, number of machines, and investment in machine efficiency to maximize total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=400)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in machine efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\nRevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\nRevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n## convert the division to multiplication\nmodel.addCons(obj * (30 - 0.0002 * EfficiencyInvestment) == 100 * QuantityA)\nmodel.addCons(obj * (25 - 0.0002 * EfficiencyInvestment) == 120 * QuantityB)\nmodel.addCons(obj * (20 - 0.0002 * EfficiencyInvestment) == 150 * QuantityC)\n\n# Add constraints\n## The company has a total of 20 machines available for the production of all products.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 20)\n## The total investment in machine efficiency upgrades cannot exceed $100,000.\nmodel.addCons(EfficiencyInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Machine Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n// Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n// Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of all machines combined is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum daily production requirement of 200 units for component A.\n// A >= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E does not exceed 30% of the total production.\n// E <= 0.3 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe total cost of maintenance should not exceed $15,000 per day.\n// 10A + 15B + 20C + 25D + 30E <= 15000\n\n## Generate Constraint-5:\nThe production of component B should be at least twice the production of component A.\n// B >= 2A",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n\nThe total production capacity of all machines combined is 1000 units per day. The company has a minimum daily production requirement of 200 units for component A. The company wants to ensure that the production of component E does not exceed 30% of the total production. The total cost of maintenance should not exceed $15,000 per day. The production of component B should be at least twice the production of component A.\n\nPlease help the company to maximize the net profit, which is the difference between the total profit and the total maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n## Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity of all machines combined is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a minimum daily production requirement of 200 units for component A.\nmodel.addCons(A >= 200)\n## The company wants to ensure that the production of component E does not exceed 30% of the total production.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n## The total cost of maintenance should not exceed $15,000 per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n## The production of component B should be at least twice the production of component A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit. Additionally, the company is considering outsourcing some of the production to external contractors.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"OutsourceA\", \"range\": \"OutsourceA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"OutsourceB\", \"range\": \"OutsourceB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"OutsourceC\", \"range\": \"OutsourceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nThe company aims to maximize the total profit, considering both in-house production and outsourcing.\n// Profit from DeviceA: Profit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\n// Profit from DeviceB: Profit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\n// Profit from DeviceC: Profit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units for all devices combined.\n// DeviceA + DeviceB + DeviceC <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $30,000 for outsourcing costs.\n// 80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30,000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is outsourced.\n// OutsourceA >= 0.1 * (DeviceA + OutsourceA)\n// OutsourceB >= 0.1 * (DeviceB + OutsourceB)\n// OutsourceC >= 0.1 * (DeviceC + OutsourceC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit. Additionally, the company is considering outsourcing some of the production to external contractors.\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nThe company has a production capacity of 500 units for all devices combined. The company has a budget of $30,000 for outsourcing costs. The company wants to ensure that at least 10% of each device's production is outsourced.\nPlease help the company to maximize the total profit, considering both in-house production and outsourcing.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0)  # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0)  # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0)  # number of units of DeviceC\nOutsourceA = model.addVar(vtype=\"INTEGER\", name=\"OutsourceA\", lb=0)  # number of units outsourced for DeviceA\nOutsourceB = model.addVar(vtype=\"INTEGER\", name=\"OutsourceB\", lb=0)  # number of units outsourced for DeviceB\nOutsourceC = model.addVar(vtype=\"INTEGER\", name=\"OutsourceC\", lb=0)  # number of units outsourced for DeviceC\n\n# Define objective function\nProfit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\nProfit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\nProfit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\nmodel.addCons(80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30000)\nmodel.addCons(OutsourceA >= 0.1 * (DeviceA + OutsourceA))\nmodel.addCons(OutsourceB >= 0.1 * (DeviceB + OutsourceB))\nmodel.addCons(OutsourceC >= 0.1 * (DeviceC + OutsourceC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of OutsourceA: \", model.getVal(OutsourceA))\n    print(\"Number of OutsourceB: \", model.getVal(OutsourceB))\n    print(\"Number of OutsourceC: \", model.getVal(OutsourceC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal number of workers to assign to each machine to maximize efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate based on the number of workers assigned. The efficiency is defined as the number of widgets produced per hour. \nOn machine 1, each worker contributes to an efficiency of 10 + 2 * M1 widgets per hour. \nOn machine 2, each worker contributes to an efficiency of 15 + 1.5 * M2 widgets per hour. \nOn machine 3, each worker contributes to an efficiency of 20 + 1 * M3 widgets per hour. \nOn machine 4, each worker contributes to an efficiency of 25 + 0.5 * M4 widgets per hour. \nOn machine 5, each worker contributes to an efficiency of 30 + 0.2 * M5 widgets per hour. \nThe objective is to maximize the total efficiency of all machines.\n// The objective function is: Maximize (10 + 2 * M1) * M1 + (15 + 1.5 * M2) * M2 + (20 + 1 * M3) * M3 + (25 + 0.5 * M4) * M4 + (30 + 0.2 * M5) * M5\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 60\n\n## Generate Constraint-2:\nEach machine can be operated by up to 12 workers at a time.\n// M1 <= 12; M2 <= 12; M3 <= 12; M4 <= 12; M5 <= 12",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal number of workers to assign to each machine to maximize efficiency. The efficiency of each machine, based on the number of workers assigned, is given in the following Table.\n\n| Machine | Efficiency per Worker (Widgets per Hour) |\n|---------|------------------------------------------|\n| 1       | 10 + 2 * M1                              |\n| 2       | 15 + 1.5 * M2                            |\n| 3       | 20 + 1 * M3                              |\n| 4       | 25 + 0.5 * M4                            |\n| 5       | 30 + 0.2 * M5                            |\n\nThe company has a total of 60 workers available. Each machine can be operated by up to 12 workers at a time. Please help the manager to maximize the total efficiency of all machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=12) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0, ub=12) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0, ub=12) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0, ub=12) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0, ub=12) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_M1 = (10 + 2 * M1) * M1\nEfficiency_M2 = (15 + 1.5 * M2) * M2\nEfficiency_M3 = (20 + 1 * M3) * M3\nEfficiency_M4 = (25 + 0.5 * M4) * M4\nEfficiency_M5 = (30 + 0.2 * M5) * M5\n## the objective function is: Maximize (10 + 2 * M1) * M1 + (15 + 1.5 * M2) * M2 + (20 + 1 * M3) * M3 + (25 + 0.5 * M4) * M4 + (30 + 0.2 * M5) * M5\nmodel.addCons(obj == Efficiency_M1 + Efficiency_M2 + Efficiency_M3 + Efficiency_M4 + Efficiency_M5)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints.\n// {\"number of trucks for goods A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The company aims to minimize the total transportation cost.\n// Cost_A = (1000 - 10 * TruckA) * TruckA\n// Cost_B = (1200 - 10 * TruckB) * TruckB\n// Cost_C = (1500 - 10 * TruckC) * TruckC\n// Cost_D = (1800 - 10 * TruckD) * TruckD\n// Cost_E = (2000 - 10 * TruckE) * TruckE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe total number of trucks available for the month is 50.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints. The cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The company aims to minimize the total transportation cost. The total number of trucks available for the month is 50. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for goods A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for goods B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for goods C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for goods D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for goods E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (1000 - 10 * TruckA) * TruckA\nCost_B = (1200 - 10 * TruckB) * TruckB\nCost_C = (1500 - 10 * TruckC) * TruckC\nCost_D = (1800 - 10 * TruckD) * TruckD\nCost_E = (2000 - 10 * TruckE) * TruckE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available for the month is 50.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Goods D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Goods E: \", model.getVal(TruckE))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n// Total fuel cost per km: FuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) / (T1 + T2 + T3 + T4 + T5)\n// Total maintenance cost per km: MaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5) / (T1 + T2 + T3 + T4 + T5)\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 to purchase trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nAt least 10% of the fleet must be type 5 trucks for long-distance routes.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nNo more than 30% of the fleet can be type 1 trucks due to their high maintenance costs.\n// T1 <= 0.3 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n\nThe company has a budget of $500,000 to purchase trucks. The total number of trucks cannot exceed 50. At least 10% of the fleet must be type 5 trucks for long-distance routes. No more than 30% of the fleet can be type 1 trucks due to their high maintenance costs.\n\nPlease help the company to minimize the total cost of fuel and maintenance per kilometer across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5)\nMaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5)\nTotalTrucks = T1 + T2 + T3 + T4 + T5\n## the objective function is: Minimize (FuelCost + MaintCost) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $500,000 to purchase trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## At least 10% of the fleet must be type 5 trucks for long-distance routes.\nmodel.addCons(T5 >= 0.1 * TotalTrucks)\n## No more than 30% of the fleet can be type 1 trucks due to their high maintenance costs.\nmodel.addCons(T1 <= 0.3 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region1\": \"FuelEfficiencyRegion1\", \"range\": \"FuelEfficiencyRegion1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region2\": \"FuelEfficiencyRegion2\", \"range\": \"FuelEfficiencyRegion2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region3\": \"FuelEfficiencyRegion3\", \"range\": \"FuelEfficiencyRegion3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region4\": \"FuelEfficiencyRegion4\", \"range\": \"FuelEfficiencyRegion4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region5\": \"FuelEfficiencyRegion5\", \"range\": \"FuelEfficiencyRegion5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per delivery. The fuel cost is calculated based on the distance traveled by each truck and its fuel efficiency. The distance for each region is different and is known.\n// TotalFuelCost = DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 + DistanceRegion2 * TrucksRegion2 / FuelEfficiencyRegion2 + DistanceRegion3 * TrucksRegion3 / FuelEfficiencyRegion3 + DistanceRegion4 * TrucksRegion4 / FuelEfficiencyRegion4 + DistanceRegion5 * TrucksRegion5 / FuelEfficiencyRegion5\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs per delivery.\n// DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 + DistanceRegion2 * TrucksRegion2 / FuelEfficiencyRegion2 + DistanceRegion3 * TrucksRegion3 / FuelEfficiencyRegion3 + DistanceRegion4 * TrucksRegion4 / FuelEfficiencyRegion4 + DistanceRegion5 * TrucksRegion5 / FuelEfficiencyRegion5 <= 10000\n\n## Generate Constraint-3:\nThe company must deliver at least 1000 units of goods to each region.\n// TrucksRegion1 >= 1000 / CapacityPerTruck\n// TrucksRegion2 >= 1000 / CapacityPerTruck\n// TrucksRegion3 >= 1000 / CapacityPerTruck\n// TrucksRegion4 >= 1000 / CapacityPerTruck\n// TrucksRegion5 >= 1000 / CapacityPerTruck",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The distance for each region is different and is known. The company wants to minimize the total fuel cost per delivery, which is calculated based on the distance traveled by each truck and its fuel efficiency.\n\n| Region       | Distance | Fuel Efficiency |\n|--------------|----------|-----------------|\n| Region1      | ?        | ?               |\n| Region2      | ?        | ?               |\n| Region3      | ?        | ?               |\n| Region4      | ?        | ?               |\n| Region5      | ?        | ?               |\n\nThe company has a total of 50 trucks available. The company has a budget of $10,000 for fuel costs per delivery. The company must deliver at least 1000 units of goods to each region, with each truck having a known capacity.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel cost per delivery.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0)\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0)\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceRegion1 = 100  # Example distance for Region1\nDistanceRegion2 = 150  # Example distance for Region2\nDistanceRegion3 = 200  # Example distance for Region3\nDistanceRegion4 = 250  # Example distance for Region4\nDistanceRegion5 = 300  # Example distance for Region5\nFuelEfficiencyRegion1 = 5  # Example fuel efficiency for Region1\nFuelEfficiencyRegion2 = 6  # Example fuel efficiency for Region2\nFuelEfficiencyRegion3 = 7  # Example fuel efficiency for Region3\nFuelEfficiencyRegion4 = 8  # Example fuel efficiency for Region4\nFuelEfficiencyRegion5 = 9  # Example fuel efficiency for Region5\nCapacityPerTruck = 100  # Example capacity per truck\n\n## TotalFuelCost = DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 + ...\n## convert the division to multiplication\nmodel.addCons(obj == DistanceRegion1 * TrucksRegion1 * FuelEfficiencyRegion1 +\n              DistanceRegion2 * TrucksRegion2 * FuelEfficiencyRegion2 +\n              DistanceRegion3 * TrucksRegion3 * FuelEfficiencyRegion3 +\n              DistanceRegion4 * TrucksRegion4 * FuelEfficiencyRegion4 +\n              DistanceRegion5 * TrucksRegion5 * FuelEfficiencyRegion5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 50)\n## The company has a budget of $10,000 for fuel costs per delivery.\nmodel.addCons(DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 +\n              DistanceRegion2 * TrucksRegion2 / FuelEfficiencyRegion2 +\n              DistanceRegion3 * TrucksRegion3 / FuelEfficiencyRegion3 +\n              DistanceRegion4 * TrucksRegion4 / FuelEfficiencyRegion4 +\n              DistanceRegion5 * TrucksRegion5 / FuelEfficiencyRegion5 <= 10000)\n## The company must deliver at least 1000 units of goods to each region.\nmodel.addCons(TrucksRegion1 >= 1000 / CapacityPerTruck)\nmodel.addCons(TrucksRegion2 >= 1000 / CapacityPerTruck)\nmodel.addCons(TrucksRegion3 >= 1000 / CapacityPerTruck)\nmodel.addCons(TrucksRegion4 >= 1000 / CapacityPerTruck)\nmodel.addCons(TrucksRegion5 >= 1000 / CapacityPerTruck)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by its speed and capacity, as shown in the following Table.\n\n| Vehicle | Speed (km/h) | Capacity (tons) |\n|---------|--------------|-----------------|\n| Truck   | 60           | 20              |\n| Van     | 40           | 10              |\n| Bike    | 20           | 1               |\n\nThe company aims to maximize the total daily transport capacity in tons per hour (ton-km/h). The company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\nPlease help the company to maximize the total daily transport capacity in tons per hour (ton-km/h) while staying within the maintenance budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for CargoA is $1000 per day, for CargoB is $1200 per day, for CargoC is $1500 per day, for CargoD is $1800 per day, and for CargoE is $2000 per day. The revenue generated by each truck for CargoA is $2000 per day, for CargoB is $2500 per day, for CargoC is $3000 per day, for CargoD is $3500 per day, and for CargoE is $4000 per day. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\n// Total net revenue for CargoA: Revenue_A = (2000 - 1000) * TrucksA\n// Total net revenue for CargoB: Revenue_B = (2500 - 1200) * TrucksB\n// Total net revenue for CargoC: Revenue_C = (3000 - 1500) * TrucksC\n// Total net revenue for CargoD: Revenue_D = (3500 - 1800) * TrucksD\n// Total net revenue for CargoE: Revenue_E = (4000 - 2000) * TrucksE\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, CargoA must be transported by at least 10 trucks.\n// TrucksA >= 10\n\n## Generate Constraint-3:\nThe company has a fuel budget of $50,000 per day. The fuel cost per truck for CargoA is $100, for CargoB is $150, for CargoC is $200, for CargoD is $250, and for CargoE is $300.\n// 100 * TrucksA + 150 * TrucksB + 200 * TrucksC + 250 * TrucksD + 300 * TrucksE <= 50000\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA.\n// TrucksB >= 0.5 * TrucksA",
        "question": "A logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck for CargoA is $1000 per day, for CargoB is $1200 per day, for CargoC is $1500 per day, for CargoD is $1800 per day, and for CargoE is $2000 per day. The revenue generated by each truck for CargoA is $2000 per day, for CargoB is $2500 per day, for CargoC is $3000 per day, for CargoD is $3500 per day, and for CargoE is $4000 per day. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost. The company has a total of 50 trucks available for distribution. Due to contractual agreements, CargoA must be transported by at least 10 trucks. The company has a fuel budget of $50,000 per day. The fuel cost per truck for CargoA is $100, for CargoB is $150, for CargoC is $200, for CargoD is $250, and for CargoE is $300. The company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA. Please help the company to maximize the total net revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for CargoA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CargoB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CargoC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CargoD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for CargoE\n\n# Define objective function\nRevenue_A = (2000 - 1000) * TrucksA\nRevenue_B = (2500 - 1200) * TrucksB\nRevenue_C = (3000 - 1500) * TrucksC\nRevenue_D = (3500 - 1800) * TrucksD\nRevenue_E = (4000 - 2000) * TrucksE\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n# Add constraints\n# The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to contractual agreements, CargoA must be transported by at least 10 trucks.\nmodel.addCons(TrucksA >= 10)\n# The company has a fuel budget of $50,000 per day.\nmodel.addCons(100 * TrucksA + 150 * TrucksB + 200 * TrucksC + 250 * TrucksD + 300 * TrucksE <= 50000)\n# The company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA.\nmodel.addCons(TrucksB >= 0.5 * TrucksA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CargoB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CargoC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CargoD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for CargoE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1247,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel.\n// {\"number of solar panels for Apartments\": \"ApartmentPanels\", \"range\": \"ApartmentPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Houses\": \"HousePanels\", \"range\": \"HousePanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"efficiency of solar panels for Apartments\": \"ApartmentEfficiency\", \"range\": \"ApartmentEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Houses\": \"HouseEfficiency\", \"range\": \"HouseEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Commercial buildings\": \"CommercialEfficiency\", \"range\": \"CommercialEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh.\n// Cost_Apartments = 1000 * ApartmentPanels\n// Cost_Houses = 1500 * HousePanels\n// Cost_Commercial = 2000 * CommercialPanels\n// Energy_Apartments = ApartmentEfficiency * ApartmentPanels\n// Energy_Houses = HouseEfficiency * HousePanels\n// Energy_Commercial = CommercialEfficiency * CommercialPanels\n// So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n## Generate Constraint-1:\nThe total daily energy generated must be at least 1000 kWh.\n// Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000\n\n## Generate Constraint-3:\nThe number of solar panels for Apartments must not exceed 500.\n// ApartmentPanels <= 500",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel. The cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh. The city has a budget of $500,000 for the installation of solar panels. The number of solar panels for Apartments must not exceed 500. Please help the city to determine the optimal number of solar panels and their efficiencies to meet these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartmentPanels = model.addVar(vtype=\"INTEGER\", name=\"ApartmentPanels\", lb=0)  # number of solar panels for Apartments\nHousePanels = model.addVar(vtype=\"INTEGER\", name=\"HousePanels\", lb=0)  # number of solar panels for Houses\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)  # number of solar panels for Commercial buildings\nApartmentEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"ApartmentEfficiency\", lb=0)  # efficiency of solar panels for Apartments\nHouseEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HouseEfficiency\", lb=0)  # efficiency of solar panels for Houses\nCommercialEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialEfficiency\", lb=0)  # efficiency of solar panels for Commercial buildings\n\n# Define objective function\nCost_Apartments = 1000 * ApartmentPanels\nCost_Houses = 1500 * HousePanels\nCost_Commercial = 2000 * CommercialPanels\nEnergy_Apartments = ApartmentEfficiency * ApartmentPanels\nEnergy_Houses = HouseEfficiency * HousePanels\nEnergy_Commercial = CommercialEfficiency * CommercialPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n# Add constraints\n# The total daily energy generated must be at least 1000 kWh.\nmodel.addCons(Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000)\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000)\n# The number of solar panels for Apartments must not exceed 500.\nmodel.addCons(ApartmentPanels <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Apartments: \", model.getVal(ApartmentPanels))\n    print(\"Number of Solar Panels for Houses: \", model.getVal(HousePanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Efficiency of Solar Panels for Apartments: \", model.getVal(ApartmentEfficiency))\n    print(\"Efficiency of Solar Panels for Houses: \", model.getVal(HouseEfficiency))\n    print(\"Efficiency of Solar Panels for Commercial Buildings: \", model.getVal(CommercialEfficiency))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can handle is limited to 500 per day.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500\n\n## Generate Constraint-3:\nEach Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day.\n// SmallTrips <= 3; MediumTrips <= 4; LargeTrips <= 5\n\n## Generate Constraint-4:\nThe company must operate at least 5 Small trucks, 10 Medium trucks, and 8 Large trucks.\n// SmallTrucks >= 5; MediumTrucks >= 10; LargeTrucks >= 8",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip. The operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks. The company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades. The total number of trips the company can handle is limited to 500 per day. Each Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day. The company must operate at least 5 Small trucks, 10 Medium trucks, and 8 Large trucks. Please help the company to minimize the total operational cost of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=5)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=10)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=8)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0, ub=3)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0, ub=4)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0, ub=5)\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500)\nmodel.addCons(SmallTrips <= 3)\nmodel.addCons(MediumTrips <= 4)\nmodel.addCons(LargeTrips <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $50, the cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the revenue per unit is $70, the cost per unit is $40, and the storage cost per unit is $7.\nFor ProductC, the revenue per unit is $90, the cost per unit is $50, and the storage cost per unit is $9.\nFor ProductD, the revenue per unit is $110, the cost per unit is $60, and the storage cost per unit is $11.\nThe company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - 30 - 5) * ProdA\n// Total net profit for ProductB: Profit_B = (70 - 40 - 7) * ProdB\n// Total net profit for ProductC: Profit_C = (90 - 50 - 9) * ProdC\n// Total net profit for ProductD: Profit_D = (110 - 60 - 11) * ProdD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProdA + ProdB + ProdC + ProdD <= 1000\n\n## Generate Constraint-2:\nDue to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA\n\n## Generate Constraint-3:\nThe company has a storage constraint where the total storage cost cannot exceed $8000 per month.\n// 5 * ProdA + 7 * ProdB + 9 * ProdC + 11 * ProdD <= 8000\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to meet contractual obligations.\n// ProdC >= 50",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\nThe revenue per unit for ProductA is $50, the cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the revenue per unit is $70, the cost per unit is $40, and the storage cost per unit is $7.\nFor ProductC, the revenue per unit is $90, the cost per unit is $50, and the storage cost per unit is $9.\nFor ProductD, the revenue per unit is $110, the cost per unit is $60, and the storage cost per unit is $11.\nThe company has a total production capacity of 1000 units per month. Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA. The company has a storage constraint where the total storage cost cannot exceed $8000 per month. The company must produce at least 50 units of ProductC to meet contractual obligations.\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=0) # production quantity for ProductD\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * ProdA\nProfit_B = (70 - 40 - 7) * ProdB\nProfit_C = (90 - 50 - 9) * ProdC\nProfit_D = (110 - 60 - 11) * ProdD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(ProdA + ProdB + ProdC + ProdD <= 1000)\n# Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProdB <= 2 * ProdA)\n# The company has a storage constraint where the total storage cost cannot exceed $8000 per month.\nmodel.addCons(5 * ProdA + 7 * ProdB + 9 * ProdC + 11 * ProdD <= 8000)\n# The company must produce at least 50 units of ProductC to meet contractual obligations.\nmodel.addCons(ProdC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $20, and the storage cost per unit is $5.\nFor Product B, the profit per unit is $30, and the storage cost per unit is $7.\nFor Product C, the profit per unit is $40, and the storage cost per unit is $9.\nFor Product D, the profit per unit is $50, and the storage cost per unit is $11.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Net profit of A: Net_Profit_A = (20 - 5) * A\n// Net profit of B: Net_Profit_B = (30 - 7) * B\n// Net profit of C: Net_Profit_C = (40 - 9) * C\n// Net profit of D: Net_Profit_D = (50 - 11) * D\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 1000 units.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 1000\n\n## Generate Constraint-2:\nThe company has a transportation budget that allows for the distribution of at most 200 units.\n// A + B + C + D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\n// C <= A + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company has a minimum distribution requirement for each product: at least 10 units of each product must be distributed.\n// A >= 10; B >= 10; C >= 10; D >= 10",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit |\n|---------|-----------------|-----------------------|\n| A       | $20             | $5                    |\n| B       | $30             | $7                    |\n| C       | $40             | $9                    |\n| D       | $50             | $11                   |\n\nThe company has a total storage capacity of 1000 units. The company has a transportation budget that allows for the distribution of at most 200 units. The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B, and the distribution of Product D does not exceed the combined distribution of Products A, B, and C. The company also has a minimum distribution requirement for each product: at least 10 units of each product must be distributed.\n\nPlease help the company to maximize the net profit, which is the total profit minus the total storage cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company has a minimum distribution requirement for each product: at least 10 units of each product must be distributed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of product D\n\n# Define objective function\n## Net profit of A: Net_Profit_A = (20 - 5) * A\n## Net profit of B: Net_Profit_B = (30 - 7) * B\n## Net profit of C: Net_Profit_C = (40 - 9) * C\n## Net profit of D: Net_Profit_D = (50 - 11) * D\n## So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\nNet_Profit_A = (20 - 5) * A\nNet_Profit_B = (30 - 7) * B\nNet_Profit_C = (40 - 9) * C\nNet_Profit_D = (50 - 11) * D\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n# Add constraints\n## The company has a total storage capacity of 1000 units.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 1000)\n## The company has a transportation budget that allows for the distribution of at most 200 units.\nmodel.addCons(A + B + C + D <= 200)\n## The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\nmodel.addCons(C <= A + B)\n## The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while considering the efficiency of each plant. The efficiency of each plant is affected by the investment in maintenance and upgrades, which can be different for each type of plant.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in maintenance for Solar\": \"SolarInvestment\", \"range\": \"SolarInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Wind\": \"WindInvestment\", \"range\": \"WindInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Hydro\": \"HydroInvestment\", \"range\": \"HydroInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company aims to maximize the total daily energy production.\n// Energy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\n// Energy_Wind = (150 + 0.015 * WindInvestment) * WindHours\n// Energy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance and upgrades across all plants.\n// SolarInvestment + WindInvestment + HydroInvestment <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24\n\n## Generate Constraint-3:\nDue to environmental regulations, the Hydro plant can operate at most 8 hours per day.\n// HydroHours <= 8\n\n## Generate Constraint-4:\nThe Solar plant must operate at least 2 hours per day to ensure the stability of the energy grid.\n// SolarHours >= 2",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily and the investment in maintenance and upgrades for each plant to maximize energy production. The energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company has a total budget of $100,000 for maintenance and upgrades across all plants. The total operating hours for all plants must not exceed 24 hours per day. Due to environmental regulations, the Hydro plant can operate at most 8 hours per day. The Solar plant must operate at least 2 hours per day to ensure the stability of the energy grid. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=2)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of operating hours for Hydro\nSolarInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarInvestment\", lb=0)  # investment in maintenance for Solar\nWindInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindInvestment\", lb=0)  # investment in maintenance for Wind\nHydroInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroInvestment\", lb=0)  # investment in maintenance for Hydro\n\n# Define objective function\nEnergy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\nEnergy_Wind = (150 + 0.015 * WindInvestment) * WindHours\nEnergy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\nmodel.addCons(SolarInvestment + WindInvestment + HydroInvestment <= 100000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\nmodel.addCons(HydroHours <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Maintenance for Solar: \", model.getVal(SolarInvestment))\n    print(\"Investment in Maintenance for Wind: \", model.getVal(WindInvestment))\n    print(\"Investment in Maintenance for Hydro: \", model.getVal(HydroInvestment))\n    print(\"Total Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Heavy trucks\": \"HeavyUpgrade\", \"range\": \"HeavyUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"MediumUpgrade\", \"range\": \"MediumUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Light trucks\": \"LightUpgrade\", \"range\": \"LightUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n// Revenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\n// Revenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\n// Revenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\n// So, the objective function is: Maximize (Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades.\n// HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks the company can manage is limited to 20.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 20\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must have at least 5 Heavy trucks and cannot have more than 10 Light trucks.\n// HeavyTrucks >= 5; LightTrucks <= 10",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck. The revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n\n| Type       | Base Revenue per Month | Cost Reduction per $1000 Upgrade |\n|------------|------------------------|----------------------------------|\n| Heavy      | $5000                  | $100 per month                   |\n| Medium     | $3000                  | $150 per month                   |\n| Light      | $2000                  | $200 per month                   |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades. The total number of trucks the company can manage is limited to 20. Due to regulatory requirements, the company must have at least 5 Heavy trucks and cannot have more than 10 Light trucks.\n\nPlease help the company to maximize the total monthly revenue from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=5)  # number of Heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0, ub=10)  # number of Light trucks\nHeavyUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyUpgrade\", lb=0)  # fuel efficiency upgrade for Heavy trucks\nMediumUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumUpgrade\", lb=0)  # fuel efficiency upgrade for Medium trucks\nLightUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"LightUpgrade\", lb=0)  # fuel efficiency upgrade for Light trucks\n\n# Define objective function\nRevenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\nRevenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\nRevenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n# Add constraints\nmodel.addCons(HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000)\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Fuel Efficiency Upgrade for Heavy Trucks: \", model.getVal(HeavyUpgrade))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(MediumUpgrade))\n    print(\"Fuel Efficiency Upgrade for Light Trucks: \", model.getVal(LightUpgrade))\n    print(\"Maximized Total Monthly Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1563,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the level of maintenance investment for each type of truck to optimize their lifespan and operational efficiency.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Refrigerated trucks\": \"RefrigeratedMaintenance\", \"range\": \"RefrigeratedMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Heavy trucks\": \"HeavyMaintenance\", \"range\": \"HeavyMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Standard trucks\": \"StandardMaintenance\", \"range\": \"StandardMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each type of truck is affected by the maintenance investment. For every $1,000 invested in maintenance, the operational efficiency (measured in revenue per truck per year) increases by 5% for Refrigerated trucks, 4% for Heavy trucks, and 3% for Standard trucks. The base revenue per Refrigerated truck is $100,000, for Heavy trucks is $120,000, and for Standard trucks is $80,000. The company aims to maximize the total annual revenue from all trucks.\n// Total annual revenue for Refrigerated trucks: RevenueRefrigerated = (100000 * (1 + 0.05 * RefrigeratedMaintenance / 1000)) * RefrigeratedTrucks\n// Total annual revenue for Heavy trucks: RevenueHeavy = (120000 * (1 + 0.04 * HeavyMaintenance / 1000)) * HeavyTrucks\n// Total annual revenue for Standard trucks: RevenueStandard = (80000 * (1 + 0.03 * StandardMaintenance / 1000)) * StandardTrucks\n// So, the objective function is: Maximize (RevenueRefrigerated + RevenueHeavy + RevenueStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing trucks and maintenance investments.\n// 100000 * RefrigeratedTrucks + 120000 * HeavyTrucks + 80000 * StandardTrucks + RefrigeratedMaintenance + HeavyMaintenance + StandardMaintenance <= 5000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the level of maintenance investment for each type of truck to optimize their lifespan and operational efficiency. The operational efficiency of each type of truck is affected by the maintenance investment. For every $1,000 invested in maintenance, the operational efficiency (measured in revenue per truck per year) increases by 5% for Refrigerated trucks, 4% for Heavy trucks, and 3% for Standard trucks. The base revenue per Refrigerated truck is $100,000, for Heavy trucks is $120,000, and for Standard trucks is $80,000. The company aims to maximize the total annual revenue from all trucks. The company has a budget of $5,000,000 for purchasing trucks and maintenance investments. Please help the company to determine the optimal number of each type of truck and the corresponding maintenance investment to maximize the total annual revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedMaintenance = model.addVar(name=\"RefrigeratedMaintenance\", lb=0)\nHeavyMaintenance = model.addVar(name=\"HeavyMaintenance\", lb=0)\nStandardMaintenance = model.addVar(name=\"StandardMaintenance\", lb=0)\n\n# Define objective function\nRevenueRefrigerated = (100000 * (1 + 0.05 * RefrigeratedMaintenance / 1000)) * RefrigeratedTrucks\nRevenueHeavy = (120000 * (1 + 0.04 * HeavyMaintenance / 1000)) * HeavyTrucks\nRevenueStandard = (80000 * (1 + 0.03 * StandardMaintenance / 1000)) * StandardTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueRefrigerated + RevenueHeavy + RevenueStandard)\n\n# Add constraints\nmodel.addCons(100000 * RefrigeratedTrucks + 120000 * HeavyTrucks + 80000 * StandardTrucks + RefrigeratedMaintenance + HeavyMaintenance + StandardMaintenance <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Investment for Refrigerated Trucks: \", model.getVal(RefrigeratedMaintenance))\n    print(\"Maintenance Investment for Heavy Trucks: \", model.getVal(HeavyMaintenance))\n    print(\"Maintenance Investment for Standard Trucks: \", model.getVal(StandardMaintenance))\n    print(\"Total Annual Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in advanced machinery that can improve the production efficiency of each product, reducing the resource cost per unit. The investment in advanced machinery for each product is a continuous variable.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 units of resources available for the month.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $20,000.\n// MachineryA + MachineryB + MachineryC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC.\n// UnitsA <= 500; UnitsB <= 600; UnitsC <= 700",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the amount of resources (labor and materials) allocated to each product, and the investment in advanced machinery for each product. The investment in advanced machinery can improve the production efficiency of each product, reducing the resource cost per unit. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product.\n\n| Product | Selling Price per Unit | Initial Resource Cost per Unit |\n|---------|------------------------|--------------------------------|\n| ProductA | $200                   | $100                            |\n| ProductB | $250                   | $150                            |\n| ProductC | $300                   | $200                            |\n\nThe company has a total of 10,000 units of resources available for the month. The total investment in advanced machinery cannot exceed $20,000. Due to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0, ub=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0, ub=600)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=700)  # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # investment in advanced machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # investment in advanced machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # investment in advanced machinery for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\nProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\nProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1445,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000\n\n## Generate Constraint-2:\nThe company has a total of 500 drivers available.\n// RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\n// RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company has a budget of $10 million for purchasing trucks. The company has a total of 500 drivers available. The company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\nPlease help the company to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n# The company has a total of 500 drivers available.\nmodel.addCons(RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500)\n# The company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\nmodel.addCons(RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n// NetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\n// NetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\n// NetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n// So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all wind farms is $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limit of 100 turbines that can be installed across all types.\n// Turbines1 + Turbines2 + Turbines3 <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\n// Turbines1 >= 20; Turbines2 >= 30",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales. The total maintenance budget for all wind farms is $100,000. The company has a limit of 100 turbines that can be installed across all types. Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2. Please help the company to maximize the net profit from energy sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=0)  # number of turbines for Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=0)  # number of turbines for Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)  # number of turbines for Type3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance investment for Type2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance investment for Type3\n\n# Define objective function\nNetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\nNetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\nNetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit1 + NetProfit2 + NetProfit3)\n\n# Add constraints\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)  # total maintenance budget\nmodel.addCons(Turbines1 + Turbines2 + Turbines3 <= 100)  # limit of turbines\nmodel.addCons(Turbines1 >= 20)  # at least 20 turbines of Type1\nmodel.addCons(Turbines2 >= 30)  # at least 30 turbines of Type2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines for Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines for Type3: \", model.getVal(Turbines3))\n    print(\"Maintenance Investment for Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment for Type2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Investment for Type3: \", model.getVal(Maintenance3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy trucks\": \"HeavyTech\", \"range\": \"HeavyTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Light trucks\": \"LightTech\", \"range\": \"LightTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n// Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n// Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n// So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000.\n// 50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50\n\n## Generate Constraint-3:\nDue to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\n// HeavyTrucks >= 10; LightTrucks <= 20\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\n// HeavyTech <= 0.5 * 50000 * HeavyTrucks\n// MediumTech <= 0.5 * 30000 * MediumTrucks\n// LightTech <= 0.5 * 20000 * LightTrucks",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested.\n\n| Type       | Truck Cost | Fuel Cost Savings per Mile |\n|------------|------------|---------------------------|\n| Heavy      | $50,000    | $0.50                     |\n| Medium     | $30,000    | $0.30                     |\n| Light      | $20,000    | $0.20                     |\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks cannot exceed 50. The company must have at least 10 Heavy trucks and no more than 20 Light trucks. The investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\n\nPlease help the company to maximize the total fuel cost savings across all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)\nHeavyTech = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyTech\", lb=0)\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)\nLightTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LightTech\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nMilesHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesHeavy\")\nMilesMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesMedium\")\nMilesLight = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesLight\")\n## Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n## Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n## Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\nmodel.addCons(obj == (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy + \n              (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium + \n              (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + \n              HeavyTech + MediumTech + LightTech <= 200000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n## Due to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\nmodel.addCons(HeavyTrucks >= 10)\nmodel.addCons(LightTrucks <= 20)\n## The investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\nmodel.addCons(HeavyTech <= 0.5 * 50000 * HeavyTrucks)\nmodel.addCons(MediumTech <= 0.5 * 30000 * MediumTrucks)\nmodel.addCons(LightTech <= 0.5 * 20000 * LightTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Heavy Tech: \", model.getVal(HeavyTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Light Tech: \", model.getVal(LightTech))\n    print(\"Maximized Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel.\n// {\"number of solar panels for Apartments\": \"ApartmentPanels\", \"range\": \"ApartmentPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Houses\": \"HousePanels\", \"range\": \"HousePanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"efficiency of solar panels for Apartments\": \"ApartmentEfficiency\", \"range\": \"ApartmentEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Houses\": \"HouseEfficiency\", \"range\": \"HouseEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Commercial buildings\": \"CommercialEfficiency\", \"range\": \"CommercialEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh.\n// Cost_Apartments = 1000 * ApartmentPanels\n// Cost_Houses = 1500 * HousePanels\n// Cost_Commercial = 2000 * CommercialPanels\n// Energy_Apartments = ApartmentEfficiency * ApartmentPanels\n// Energy_Houses = HouseEfficiency * HousePanels\n// Energy_Commercial = CommercialEfficiency * CommercialPanels\n// So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n## Generate Constraint-1:\nThe total daily energy generated must be at least 1000 kWh.\n// Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000\n\n## Generate Constraint-3:\nThe number of solar panels for Apartments must not exceed 500.\n// ApartmentPanels <= 500",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel. The cost of installation per solar panel and the energy generated per panel per day are given in the following Table.\n\n| Building Type | Installation Cost per Panel | Energy Generated per Panel per Day |\n|---------------|-----------------------------|------------------------------------|\n| Apartments    | $1000                       | ApartmentEfficiency                |\n| Houses        | $1500                       | HouseEfficiency                    |\n| Commercial    | $2000                       | CommercialEfficiency               |\n\nThe city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh. The city has a budget of $500,000 for the installation of solar panels. The number of solar panels for Apartments must not exceed 500.\nPlease help the city to determine the optimal number of solar panels and their efficiencies to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartmentPanels = model.addVar(vtype=\"INTEGER\", name=\"ApartmentPanels\", lb=0)  # number of solar panels for Apartments\nHousePanels = model.addVar(vtype=\"INTEGER\", name=\"HousePanels\", lb=0)  # number of solar panels for Houses\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)  # number of solar panels for Commercial buildings\nApartmentEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"ApartmentEfficiency\", lb=0)  # efficiency of solar panels for Apartments\nHouseEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HouseEfficiency\", lb=0)  # efficiency of solar panels for Houses\nCommercialEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialEfficiency\", lb=0)  # efficiency of solar panels for Commercial buildings\n\n# Define objective function\nCost_Apartments = 1000 * ApartmentPanels\nCost_Houses = 1500 * HousePanels\nCost_Commercial = 2000 * CommercialPanels\nEnergy_Apartments = ApartmentEfficiency * ApartmentPanels\nEnergy_Houses = HouseEfficiency * HousePanels\nEnergy_Commercial = CommercialEfficiency * CommercialPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n# Add constraints\n# The total daily energy generated must be at least 1000 kWh.\nmodel.addCons(Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000)\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000)\n# The number of solar panels for Apartments must not exceed 500.\nmodel.addCons(ApartmentPanels <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Apartments: \", model.getVal(ApartmentPanels))\n    print(\"Number of Solar Panels for Houses: \", model.getVal(HousePanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Efficiency of Solar Panels for Apartments: \", model.getVal(ApartmentEfficiency))\n    print(\"Efficiency of Solar Panels for Houses: \", model.getVal(HouseEfficiency))\n    print(\"Efficiency of Solar Panels for Commercial Buildings: \", model.getVal(CommercialEfficiency))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck is $100,000, the fuel cost per truck is $20,000, and the maintenance cost per truck is $10,000. \nFor T2, the revenue per truck is $120,000, the fuel cost per truck is $25,000, and the maintenance cost per truck is $12,000. \nFor T3, the revenue per truck is $150,000, the fuel cost per truck is $30,000, and the maintenance cost per truck is $15,000.\nFor T4, the revenue per truck is $180,000, the fuel cost per truck is $35,000, and the maintenance cost per truck is $18,000.\nFor T5, the revenue per truck is $200,000, the fuel cost per truck is $40,000, and the maintenance cost per truck is $20,000.\nThe company wants to maximize the total net profit.\n// Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n// Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n// Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n// Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n// Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 100,000 * T1 + 120,000 * T2 + 150,000 * T3 + 180,000 * T4 + 200,000 * T5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total fuel cost for all trucks must not exceed $200,000.\n// 20,000 * T1 + 25,000 * T2 + 30,000 * T3 + 35,000 * T4 + 40,000 * T5 <= 200,000\n\n## Generate Constraint-3:\nThe total maintenance cost for all trucks must not exceed $150,000.\n// 10,000 * T1 + 12,000 * T2 + 15,000 * T3 + 18,000 * T4 + 20,000 * T5 <= 150,000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\nFor T1, the revenue per truck is $100,000, the fuel cost per truck is $20,000, and the maintenance cost per truck is $10,000. \nFor T2, the revenue per truck is $120,000, the fuel cost per truck is $25,000, and the maintenance cost per truck is $12,000. \nFor T3, the revenue per truck is $150,000, the fuel cost per truck is $30,000, and the maintenance cost per truck is $15,000.\nFor T4, the revenue per truck is $180,000, the fuel cost per truck is $35,000, and the maintenance cost per truck is $18,000.\nFor T5, the revenue per truck is $200,000, the fuel cost per truck is $40,000, and the maintenance cost per truck is $20,000.\nThe company has a total budget of $1,000,000 for purchasing trucks. The total fuel cost for all trucks must not exceed $200,000. The total maintenance cost for all trucks must not exceed $150,000.\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n## Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n## Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n## Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n## Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\nProfit_T1 = (100000 - 20000 - 10000) * T1\nProfit_T2 = (120000 - 25000 - 12000) * T2\nProfit_T3 = (150000 - 30000 - 15000) * T3\nProfit_T4 = (180000 - 35000 - 18000) * T4\nProfit_T5 = (200000 - 40000 - 20000) * T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\n## The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 1000000)\n## The total fuel cost for all trucks must not exceed $200,000.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 200000)\n## The total maintenance cost for all trucks must not exceed $150,000.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit from each device is calculated based on the selling price minus the production cost, which varies per device and is affected by the quantity produced due to economies of scale. The profit per unit for each device is given in the following Table.\n\n| Device       | Profit per Unit Formula                  |\n|--------------|------------------------------------------|\n| Smartphones  | $100 - 0.1 * Smartphones                 |\n| Tablets      | $150 - 0.2 * Tablets                     |\n| Laptops      | $200 - 0.3 * Laptops                     |\n| Smartwatches | $50 - 0.05 * Smartwatches                |\n| Cameras      | $300 - 0.4 * Cameras                     |\n\nThe company wants to maximize the total profit from all devices. The total production capacity of the company is 10,000 units per month. Please help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate profit per unit for each device\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras)\n\n# Add constraints\n## The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1210,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit.\n// Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n// Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n// Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n// Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n// Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// A >= 2 * B\n\n## Generate Constraint-3:\nThe company has a budget constraint of $50,000 for total production costs.\n// 2000 + 10A^2 + 3000 + 15B^2 + 4000 + 20C^2 + 5000 + 25D^2 + 6000 + 30E^2 <= 50,000",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints. The profit per unit and the production cost function for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50             | 2000 + 10A^2             |\n| ComponentB | $70             | 3000 + 15B^2             |\n| ComponentC | $90             | 4000 + 20C^2             |\n| ComponentD | $110            | 5000 + 25D^2             |\n| ComponentE | $130            | 6000 + 30E^2             |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint of $50,000 for total production costs.\n\nPlease help the company to maximize the total net profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n## Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n## Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n## Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n## Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nProfit_A = 50 * A - (2000 + 10 * A**2)\nProfit_B = 70 * B - (3000 + 15 * B**2)\nProfit_C = 90 * C - (4000 + 20 * C**2)\nProfit_D = 110 * D - (5000 + 25 * D**2)\nProfit_E = 130 * E - (6000 + 30 * E**2)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(A >= 2 * B)\n## The company has a budget constraint of $50,000 for total production costs.\nmodel.addCons(2000 + 10 * A**2 + 3000 + 15 * B**2 + 4000 + 20 * C**2 + 5000 + 25 * D**2 + 6000 + 30 * E**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials (X, Y, and Z). The manufacturer needs to determine the optimal quantities of each product to maximize profit while considering the availability and cost of raw materials.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material X\": \"RawMaterialX\", \"range\": \"RawMaterialX >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Y\": \"RawMaterialY\", \"range\": \"RawMaterialY >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Z\": \"RawMaterialZ\", \"range\": \"RawMaterialZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The cost of raw material X per unit is $2, Y is $3, and Z is $4. The production of each product requires a specific combination of raw materials: Product A requires 1 unit of X and 2 units of Y, Product B requires 2 units of X, 1 unit of Y, and 1 unit of Z, and Product C requires 1 unit of X and 3 units of Z. The manufacturer wants to maximize the total profit.\n// Profit_A = 10 * ProductA\n// Profit_B = 15 * ProductB\n// Profit_C = 20 * ProductC\n// Cost_X = 2 * (ProductA + 2 * ProductB + ProductC)\n// Cost_Y = 3 * (2 * ProductA + ProductB)\n// Cost_Z = 4 * (ProductB + 3 * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials: 100 units of X, 80 units of Y, and 90 units of Z.\n// ProductA + 2 * ProductB + ProductC <= 100 (for X)\n// 2 * ProductA + ProductB <= 80 (for Y)\n// ProductB + 3 * ProductC <= 90 (for Z)\n\n## Generate Constraint-2:\nThe manufacturer wants to ensure that at least 20 units of each product are produced.\n// ProductA >= 20\n// ProductB >= 20\n// ProductC >= 20\n\n## Generate Constraint-3:\nThe total cost of raw materials should not exceed $500.\n// 2 * (ProductA + 2 * ProductB + ProductC) + 3 * (2 * ProductA + ProductB) + 4 * (ProductB + 3 * ProductC) <= 500",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials (X, Y, and Z). The manufacturer needs to determine the optimal quantities of each product to maximize profit while considering the availability and cost of raw materials. The profit per unit of product A is $10, product B is $15, and product C is $20. The cost of raw material X per unit is $2, Y is $3, and Z is $4. The production of each product requires a specific combination of raw materials: Product A requires 1 unit of X and 2 units of Y, Product B requires 2 units of X, 1 unit of Y, and 1 unit of Z, and Product C requires 1 unit of X and 3 units of Z. The manufacturer has a limited supply of raw materials: 100 units of X, 80 units of Y, and 90 units of Z. The manufacturer wants to ensure that at least 20 units of each product are produced. The total cost of raw materials should not exceed $500. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=20) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=20) # quantity of product C\n\n# Define objective function\nProfit_A = 10 * ProductA\nProfit_B = 15 * ProductB\nProfit_C = 20 * ProductC\nCost_X = 2 * (ProductA + 2 * ProductB + ProductC)\nCost_Y = 3 * (2 * ProductA + ProductB)\nCost_Z = 4 * (ProductB + 3 * ProductC)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n# Add constraints\n# The manufacturer has a limited supply of raw materials: 100 units of X, 80 units of Y, and 90 units of Z.\nmodel.addCons(ProductA + 2 * ProductB + ProductC <= 100) # for X\nmodel.addCons(2 * ProductA + ProductB <= 80) # for Y\nmodel.addCons(ProductB + 3 * ProductC <= 90) # for Z\n\n# The total cost of raw materials should not exceed $500.\nmodel.addCons(2 * (ProductA + 2 * ProductB + ProductC) + 3 * (2 * ProductA + ProductB) + 4 * (ProductB + 3 * ProductC) <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and production cost. The profit margin for product A is 10%, for B is 15%, for C is 20%, and for D is 25%. The production cost for each unit of product A is $50, for B is $70, for C is $90, and for D is $110. The company aims to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n// Profit of A: Profit_A = 0.10 * 50 * A = 5 * A\n// Profit of B: Profit_B = 0.15 * 70 * B = 10.5 * B\n// Profit of C: Profit_C = 0.20 * 90 * C = 18 * C\n// Profit of D: Profit_D = 0.25 * 110 * D = 27.5 * D\n// So, the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / (50 * A + 70 * B + 90 * C + 110 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C + 110 * D <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations. The profit margin and production cost for each product are given in the following Table.\n\n| Product | Profit Margin | Production Cost per Unit |\n|---------|---------------|---------------------------|\n| A       | 10%           | $50                       |\n| B       | 15%           | $70                       |\n| C       | 20%           | $90                       |\n| D       | 25%           | $110                      |\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each product. Please help the company to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10.5 * B\nProfit_C = 18 * C\nProfit_D = 27.5 * D\nProductionCost = 50 * A + 70 * B + 90 * C + 110 * D\n## the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / ProductionCost\n## convert the division to multiplication\nmodel.addCons(obj * ProductionCost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of cars\": \"Cars\", \"range\": \"Cars >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\n// Profit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\n// FuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n// So, the objective function is: Maximize (Profit - FuelCost)\n// Maximize (0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars) - (50 * Trucks + 30 * Vans + 10 * Cars) * 5)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet or exceed the required 100,000 kg.\n// 5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// (50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000\n\n## Generate Constraint-3:\nThe company can only acquire a maximum of 20 vehicles in total.\n// Trucks + Vans + Cars <= 20\n\n## Generate Constraint-4:\nThe number of trucks cannot exceed 10.\n// Trucks <= 10\n\n## Generate Constraint-5:\nThe number of vans must be at least 5.\n// Vans >= 5",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Cargo Capacity | Fuel Consumption per 100 km |\n|--------------|----------------|-----------------------------|\n| Trucks       | 5000 kg        | 50 liters                   |\n| Vans         | 2000 kg        | 30 liters                   |\n| Cars         | 500 kg         | 10 liters                   |\n\nThe company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The company has a budget of $10,000 for fuel costs. The company can only acquire a maximum of 20 vehicles in total. The number of trucks cannot exceed 10, and the number of vans must be at least 5.\n\nPlease help the company to maximize the total profit while minimizing the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=5)  # number of vans\nCars = model.addVar(vtype=\"INTEGER\", name=\"Cars\", lb=0)  # number of cars\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\nFuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n## the objective function is: Maximize (Profit - FuelCost)\nmodel.addCons(obj == Profit - FuelCost)\n\n# Add constraints\n## The total cargo capacity must meet or exceed the required 100,000 kg.\nmodel.addCons(5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000)\n## The company has a budget of $10,000 for fuel costs.\nmodel.addCons((50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000)\n## The company can only acquire a maximum of 20 vehicles in total.\nmodel.addCons(Trucks + Vans + Cars <= 20)\n## The number of trucks cannot exceed 10.\nmodel.addCons(Trucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Cars: \", model.getVal(Cars))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n// Fuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * Distance1 / 100\n// Fuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * Distance2 / 100\n// Fuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * Distance3 / 100\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1200 * Trucks2\n// Revenue_Route3 = 1500 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200\n\n## Generate Constraint-3:\nThe distance for Route1 is 500 kilometers, for Route2 is 600 kilometers, and for Route3 is 700 kilometers.\n// Distance1 = 500; Distance2 = 600; Distance3 = 700\n\n## Generate Constraint-4:\nDue to regulatory requirements, at least 50 trucks must be allocated to Route1.\n// Trucks1 >= 50\n\n## Generate Constraint-5:\nThe investment in fuel efficiency for each route must not exceed $20,000.\n// Efficiency1 <= 20000; Efficiency2 <= 20000; Efficiency3 <= 20000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies. The fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n\n| Route | Revenue per Truck | Distance |\n|-------|-------------------|----------|\n| Route1 | $1000            | 500 km   |\n| Route2 | $1200            | 600 km   |\n| Route3 | $1500            | 700 km   |\n\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency. The total number of trucks available is limited to 200. Due to regulatory requirements, at least 50 trucks must be allocated to Route1. The investment in fuel efficiency for each route must not exceed $20,000.\n\nPlease help the company to maximize the net profit (revenue minus fuel cost) across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\nFuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * 500 / 100  # Fuel cost for Route1\nFuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * 600 / 100  # Fuel cost for Route2\nFuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * 700 / 100  # Fuel cost for Route3\nRevenue_Route1 = 1000 * Trucks1  # Revenue for Route1\nRevenue_Route2 = 1200 * Trucks2  # Revenue for Route2\nRevenue_Route3 = 1500 * Trucks3  # Revenue for Route3\n\n# Objective function: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n# The total number of trucks available is limited to 200.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n# Due to regulatory requirements, at least 50 trucks must be allocated to Route1.\nmodel.addCons(Trucks1 >= 50)\n# The investment in fuel efficiency for each route must not exceed $20,000.\nmodel.addCons(Efficiency1 <= 20000)\nmodel.addCons(Efficiency2 <= 20000)\nmodel.addCons(Efficiency3 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n// Net profit of M1: Profit_M1 = (5000 - 3000 - 500) * M1\n// Net profit of M2: Profit_M2 = (7000 - 4000 - 700) * M2\n// Net profit of M3: Profit_M3 = (9000 - 5000 - 900) * M3\n// Net profit of M4: Profit_M4 = (11000 - 6000 - 1100) * M4\n// Net profit of M5: Profit_M5 = (13000 - 7000 - 1300) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (M1 + M2 + M3 + M4 + M5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for production costs next month.\n// 3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine next month.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a maintenance budget of $50,000 for next month.\n// 500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\n// M4 <= M1 + M2\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3.\n// M5 <= M1 + M2 + M3",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company has a budget of $500,000 for production costs next month. The company wants to produce at least 5 units of each machine next month. The company has a maintenance budget of $50,000 for next month. The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2. The company also wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3.\nPlease help the company to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine next month.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (5000 - 3000 - 500) * M1\nProfit_M2 = (7000 - 4000 - 700) * M2\nProfit_M3 = (9000 - 5000 - 900) * M3\nProfit_M4 = (11000 - 6000 - 1100) * M4\nProfit_M5 = (13000 - 7000 - 1300) * M5\nTotalProduction = M1 + M2 + M3 + M4 + M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $500,000 for production costs next month.\nmodel.addCons(3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500000)\n## The company has a maintenance budget of $50,000 for next month.\nmodel.addCons(500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50000)\n## The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\nmodel.addCons(M4 <= M1 + M2)\n## The company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3.\nmodel.addCons(M5 <= M1 + M2 + M3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Net Profit per Unit of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1439,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\n// {\"number of company-owned trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteA\": \"LeaseA\", \"range\": \"LeaseA >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteB\": \"LeaseB\", \"range\": \"LeaseB >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteC\": \"LeaseC\", \"range\": \"LeaseC >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteD\": \"LeaseD\", \"range\": \"LeaseD >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteE\": \"LeaseE\", \"range\": \"LeaseE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company wants to maximize the total profit minus the total leasing cost.\n// Total profit for RouteA: Profit_A = 50,000 * TruckA - 15,000 * LeaseA\n// Total profit for RouteB: Profit_B = 60,000 * TruckB - 18,000 * LeaseB\n// Total profit for RouteC: Profit_C = 70,000 * TruckC - 20,000 * LeaseC\n// Total profit for RouteD: Profit_D = 55,000 * TruckD - 16,000 * LeaseD\n// Total profit for RouteE: Profit_E = 65,000 * TruckE - 19,000 * LeaseE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 company-owned trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company has a total of 100 company-owned trucks available.\nPlease help the company to maximize the total profit minus the total leasing cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of company-owned trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of company-owned trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of company-owned trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of company-owned trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of company-owned trucks for RouteE\nLeaseA = model.addVar(vtype=\"INTEGER\", name=\"LeaseA\", lb=0) # number of leased trucks for RouteA\nLeaseB = model.addVar(vtype=\"INTEGER\", name=\"LeaseB\", lb=0) # number of leased trucks for RouteB\nLeaseC = model.addVar(vtype=\"INTEGER\", name=\"LeaseC\", lb=0) # number of leased trucks for RouteC\nLeaseD = model.addVar(vtype=\"INTEGER\", name=\"LeaseD\", lb=0) # number of leased trucks for RouteD\nLeaseE = model.addVar(vtype=\"INTEGER\", name=\"LeaseE\", lb=0) # number of leased trucks for RouteE\n\n# Define objective function\nProfit_A = 50000 * TruckA - 15000 * LeaseA\nProfit_B = 60000 * TruckB - 18000 * LeaseB\nProfit_C = 70000 * TruckC - 20000 * LeaseC\nProfit_D = 55000 * TruckD - 16000 * LeaseD\nProfit_E = 65000 * TruckE - 19000 * LeaseE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of company-owned trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of company-owned trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of company-owned trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of company-owned trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of company-owned trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of leased trucks for RouteA: \", model.getVal(LeaseA))\n    print(\"Number of leased trucks for RouteB: \", model.getVal(LeaseB))\n    print(\"Number of leased trucks for RouteC: \", model.getVal(LeaseC))\n    print(\"Number of leased trucks for RouteD: \", model.getVal(LeaseD))\n    print(\"Number of leased trucks for RouteE: \", model.getVal(LeaseE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and the environmental impact per unit is 2 kg of CO2.\nThe profit per unit of Product B is $70, and the environmental impact per unit is 3 kg of CO2.\nThe profit per unit of Product C is $60, and the environmental impact per unit is 2.5 kg of CO2.\nThe profit per unit of Product D is $80, and the environmental impact per unit is 4 kg of CO2.\nThe profit per unit of Product E is $90, and the environmental impact per unit is 5 kg of CO2.\nThe company wants to maximize the Profit-Environmental Impact ratio. (The Profit-Environmental Impact ratio is defined as the total profit divided by the total environmental impact.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total environmental impact: Impact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n// So, the objective function is: Maximize Profit / Impact\n\n## Generate Constraint-1:\nThe company has a total production capacity of 2000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 2000\n\n## Generate Constraint-2:\nThe company must produce at least 500 units of Product A.\n// ProductA >= 500",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit of Product A is $50 with an environmental impact of 2 kg of CO2, Product B is $70 with an impact of 3 kg of CO2, Product C is $60 with an impact of 2.5 kg of CO2, Product D is $80 with an impact of 4 kg of CO2, and Product E is $90 with an impact of 5 kg of CO2. The company wants to maximize the Profit-Environmental Impact ratio, which is defined as the total profit divided by the total environmental impact. The company has a total production capacity of 2000 units across all products and must produce at least 500 units of Product A. Please help the company determine the optimal production amounts for each product to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=500) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nImpact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n## the objective function is: Maximize Profit / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Profit)\n\n# Add constraints\n## The company has a total production capacity of 2000 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold.\n// Cost of route A: Cost_A = 2 * A\n// Cost of route B: Cost_B = 3 * B\n// Cost of route C: Cost_C = 4 * C\n// Cost of route D: Cost_D = 5 * D\n// Cost of route E: Cost_E = 6 * E\n// Time spent on route A: Time_A = 1 / 30 * A\n// Time spent on route B: Time_B = 1 / 40 * B\n// Time spent on route C: Time_C = 1 / 50 * C\n// Time spent on route D: Time_D = 1 / 60 * D\n// Time spent on route E: Time_E = 1 / 70 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to the constraint that Time_A + Time_B + Time_C + Time_D + Time_E <= T_max\n\n## Generate Constraint-1:\nThe total time spent on all routes must not exceed 100 hours.\n// (1 / 30 * A) + (1 / 40 * B) + (1 / 50 * C) + (1 / 60 * D) + (1 / 70 * E) <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000\n\n## Generate Constraint-3:\nThe number of trucks allocated to each route must not exceed 10.\n// A <= 10; B <= 10; C <= 10; D <= 10; E <= 10",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold. The total time spent on all routes must not exceed 100 hours. The company has a budget of $2000 for operational costs. The number of trucks allocated to each route must not exceed 10. Please help the company to minimize the total cost of operations (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=10) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=10) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=10) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=10) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=10) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * A\nCost_B = 3 * B\nCost_C = 4 * C\nCost_D = 5 * D\nCost_E = 6 * E\nTime_A = 1 / 30 * A\nTime_B = 1 / 40 * B\nTime_C = 1 / 50 * C\nTime_D = 1 / 60 * D\nTime_E = 1 / 70 * E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(Time_A + Time_B + Time_C + Time_D + Time_E <= 100)\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in engine upgrades for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\n// Fuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\n// Fuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\n// Fuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\n// Fuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency. The fuel consumption per truck on each route is affected by the route's distance and traffic conditions, and investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Fuel Consumption per Truck (without upgrades) | Upgrade Effectiveness |\n|-------|----------------------------------------------|-----------------------|\n| Route1 | 100 units | 0.1 units reduction per $1 investment |\n| Route2 | 120 units | 0.12 units reduction per $1 investment |\n| Route3 | 110 units | 0.11 units reduction per $1 investment |\n| Route4 | 90 units | 0.09 units reduction per $1 investment |\n| Route5 | 130 units | 0.13 units reduction per $1 investment |\n\nThe company has a budget of $100,000 for engine upgrades and operational costs. The total number of trucks available for all routes is limited to 50.\n\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in engine upgrades for each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks on Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in engine upgrades for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in engine upgrades for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in engine upgrades for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in engine upgrades for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in engine upgrades for Route5\n\n# Define objective function\nFuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\nFuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\nFuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\nFuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\nFuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n# Add constraints\n# The company has a budget of $100,000 for engine upgrades and operational costs.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000)\n# The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Engine Upgrades for Route1: \", model.getVal(Upgrade1))\n    print(\"Investment in Engine Upgrades for Route2: \", model.getVal(Upgrade2))\n    print(\"Investment in Engine Upgrades for Route3: \", model.getVal(Upgrade3))\n    print(\"Investment in Engine Upgrades for Route4: \", model.getVal(Upgrade4))\n    print(\"Investment in Engine Upgrades for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1543,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The variables include the number of trucks for each route (Route A, Route B, Route C, Route D, and Route D) and the average speed at which each truck should travel on its respective route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n// {\"average speed for Route A\": \"Speed_A\", \"range\": \"Speed_A > 0\", \"type\": \"real\"}\n// {\"average speed for Route B\": \"Speed_B\", \"range\": \"Speed_B > 0\", \"type\": \"real\"}\n// {\"average speed for Route C\": \"Speed_C\", \"range\": \"Speed_C > 0\", \"type\": \"real\"}\n// {\"average speed for Route D\": \"Speed_D\", \"range\": \"Speed_D > 0\", \"type\": \"real\"}\n// {\"average speed for Route E\": \"Speed_E\", \"range\": \"Speed_E > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are modeled as a nonlinear function of the number of trucks and their average speeds. The company aims to minimize the total cost of operation, which includes fuel and maintenance costs. The cost function is given by:\n// Cost_A = Trucks_A * (Speed_A^2 + 0.1 * Speed_A)\n// Cost_B = Trucks_B * (Speed_B^2 + 0.1 * Speed_B)\n// Cost_C = Trucks_C * (Speed_C^2 + 0.1 * Speed_C)\n// Cost_D = Trucks_D * (Speed_D^2 + 0.1 * Speed_D)\n// Cost_E = Trucks_E * (Speed_E^2 + 0.1 * Speed_E)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across all routes.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to determine the optimal number of trucks to allocate to each route (Route A, Route B, Route C, Route D, and Route E) and the average speed at which each truck should travel on its respective route. The fuel consumption and maintenance costs are modeled as a nonlinear function of the number of trucks and their average speeds. The company aims to minimize the total cost of operation, which includes fuel and maintenance costs. The company has a total of 50 trucks available for allocation across all routes.\n\nPlease help the company to minimize the total cost of operation while ensuring timely delivery of goods.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0)\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0)\nSpeed_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_A\", lb=0)\nSpeed_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_B\", lb=0)\nSpeed_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_C\", lb=0)\nSpeed_D = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_D\", lb=0)\nSpeed_E = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_E\", lb=0)\n\n# Define objective function\nCost_A = Trucks_A * (Speed_A**2 + 0.1 * Speed_A)\nCost_B = Trucks_B * (Speed_B**2 + 0.1 * Speed_B)\nCost_C = Trucks_C * (Speed_C**2 + 0.1 * Speed_C)\nCost_D = Trucks_D * (Speed_D**2 + 0.1 * Speed_D)\nCost_E = Trucks_E * (Speed_E**2 + 0.1 * Speed_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Route E: \", model.getVal(Trucks_E))\n    print(\"Speed for Route A: \", model.getVal(Speed_A))\n    print(\"Speed for Route B: \", model.getVal(Speed_B))\n    print(\"Speed for Route C: \", model.getVal(Speed_C))\n    print(\"Speed for Route D: \", model.getVal(Speed_D))\n    print(\"Speed for Route E: \", model.getVal(Speed_E))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Refrigerated trucks\": \"MaintenanceRefrigerated\", \"range\": \"MaintenanceRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Heavy trucks\": \"MaintenanceHeavy\", \"range\": \"MaintenanceHeavy >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Standard trucks\": \"MaintenanceStandard\", \"range\": \"MaintenanceStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Refrigerated trucks: CostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\n// Total operational cost for Heavy trucks: CostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\n// Total operational cost for Standard trucks: CostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and maintenance.\n// 1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 50 Refrigerated trucks and 70 Heavy trucks.\n// RefrigeratedTrucks >= 50; HeavyTrucks >= 70",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. They also need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks. The operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company has a budget of $200,000 for purchasing trucks and maintenance. The total number of trucks in the fleet must not exceed 200. Due to contractual obligations, the company must have at least 50 Refrigerated trucks and 70 Heavy trucks. The company aims to minimize the total operational cost of the fleet. Please help the company determine the optimal number of each type of truck and the appropriate level of maintenance to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=50)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=70)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nMaintenanceRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceRefrigerated\", lb=0)\nMaintenanceHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHeavy\", lb=0)\nMaintenanceStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\nCostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\nCostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Level for Refrigerated Trucks: \", model.getVal(MaintenanceRefrigerated))\n    print(\"Maintenance Level for Heavy Trucks: \", model.getVal(MaintenanceHeavy))\n    print(\"Maintenance Level for Standard Trucks: \", model.getVal(MaintenanceStandard))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs.\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology investment for heavy trucks\": \"TechInvestHeavy\", \"range\": \"TechInvestHeavy >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for medium trucks\": \"TechInvestMedium\", \"range\": \"TechInvestMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for light trucks\": \"TechInvestLight\", \"range\": \"TechInvestLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n// Total profit for heavy trucks: ProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\n// Total profit for medium trucks: ProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\n// Total profit for light trucks: ProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n// So, the objective function is: Maximize (ProfitHeavy + ProfitMedium + ProfitLight)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments.\n// HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50 due to operational constraints.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs. The company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology. The company has a budget of $2,000,000 for purchasing trucks and technology investments. The total number of trucks cannot exceed 50 due to operational constraints. Please help the company to maximize its annual profit from the truck fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nTechInvestHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestHeavy\", lb=0)  # technology investment for heavy trucks\nTechInvestMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestMedium\", lb=0)  # technology investment for medium trucks\nTechInvestLight = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestLight\", lb=0)  # technology investment for light trucks\n\n# Define objective function\nProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\nProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\nProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHeavy + ProfitMedium + ProfitLight)\n\n# Add constraints\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000)\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Technology Investment for Heavy Trucks: \", model.getVal(TechInvestHeavy))\n    print(\"Technology Investment for Medium Trucks: \", model.getVal(TechInvestMedium))\n    print(\"Technology Investment for Light Trucks: \", model.getVal(TechInvestLight))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"operational cost per truck\": \"CostPerTruck\", \"range\": \"CostPerTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per van\": \"CostPerVan\", \"range\": \"CostPerVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per motorcycle\": \"CostPerMotorcycle\", \"range\": \"CostPerMotorcycle >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company aims to maximize the net daily profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\n// TotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks + Vans + Motorcycles <= 100000\n\n## Generate Constraint-2:\nThe total operational cost should not exceed $50,000 per day.\n// 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000",
        "question": "A logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs. Each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company has a budget of $100,000 for purchasing vehicles and aims to keep the total operational cost below $50,000 per day. The company's goal is to maximize the net daily profit, which is the total revenue minus the total operational costs.\nPlease help the company determine the optimal number of trucks, vans, and motorcycles to purchase and their respective operational costs to maximize their net daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nCostPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck\", lb=0)  # operational cost per truck\nCostPerVan = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerVan\", lb=0)  # operational cost per van\nCostPerMotorcycle = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerMotorcycle\", lb=0)  # operational cost per motorcycle\n\n# Define objective function\nTotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\nTotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks + Vans + Motorcycles <= 100000)\n# The total operational cost should not exceed $50,000 per day.\nmodel.addCons(1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Operational Cost per Truck: \", model.getVal(CostPerTruck))\n    print(\"Operational Cost per Van: \", model.getVal(CostPerVan))\n    print(\"Operational Cost per Motorcycle: \", model.getVal(CostPerMotorcycle))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage.\n// {\"number of Device A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Device B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Device C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Device D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Device E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n// Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity for all devices is 1000 units per day.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage. The profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity for all devices is 1000 units per day. Please help the company determine the optimal number of each device to produce daily to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Device A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Device B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Device C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Device D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Device E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 80 * C + 90 * D + 100 * E\nStorage = 2 * A + 3 * B + 4 * C + 5 * D + 6 * E\n## the objective function is: Maximize (Profit - Storage)\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity for all devices is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in improving the production efficiency of each product line. The efficiency improvement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in efficiency improvements for each product line. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * EfficiencyA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * EfficiencyB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * EfficiencyC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for efficiency improvements.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 50000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 150 units.\n// QuantityA >= 200; QuantityB >= 150",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in improving the production efficiency of each product line. The efficiency improvement directly reduces the production cost per unit. The production cost per unit decreases by $5 for every $1000 invested in efficiency improvements for each product line. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $50,000 for efficiency improvements. The total production quantity for all products must not exceed 1000 units. Due to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 150 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=150) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * EfficiencyA) * QuantityA\nProfitB = (250 - 150 + 0.005 * EfficiencyB) * QuantityB\nProfitC = (300 - 200 + 0.005 * EfficiencyC) * QuantityC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $50,000 for efficiency improvements.\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 50000)\n# The total production quantity for all products must not exceed 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost for Trucks is $100 per day, for Vans is $70 per day, and for Bikes is $30 per day. The delivery efficiency (measured in deliveries per day) for Trucks is 10, for Vans is 15, and for Bikes is 20. The company aims to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n// Efficiency_Trucks = 10 * Trucks / 100\n// Efficiency_Vans = 15 * Vans / 70\n// Efficiency_Bikes = 20 * Bikes / 30\n// So, the objective function is: Maximize (Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $3000 per day for fuel and maintenance costs.\n// 100 * Trucks + 70 * Vans + 30 * Bikes <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// Trucks <= Vans + Bikes\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of vehicles does not exceed 60.\n// Trucks + Vans + Bikes <= 60",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost, as well as the delivery efficiency for each vehicle type, are given in the following Table.\n\n| Vehicle Type | Fuel & Maintenance Cost per Day | Delivery Efficiency (deliveries per day) |\n|--------------|--------------------------------|------------------------------------------|\n| Trucks       | $100                           | 10                                       |\n| Vans         | $70                            | 15                                       |\n| Bikes        | $30                            | 20                                       |\n\nThe company has a budget of $3000 per day for fuel and maintenance costs. The company has a total of 50 drivers available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. Additionally, the company wants to ensure that the total number of vehicles does not exceed 60.\n\nPlease help the company to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Trucks = 10 * Trucks / 100\nEfficiency_Vans = 15 * Vans / 70\nEfficiency_Bikes = 20 * Bikes / 30\n## convert the division to multiplication\nmodel.addCons(obj * (100 * Trucks + 70 * Vans + 30 * Bikes) == 10 * Trucks + 15 * Vans + 20 * Bikes)\n\n# Add constraints\n## The company has a budget of $3000 per day for fuel and maintenance costs.\nmodel.addCons(100 * Trucks + 70 * Vans + 30 * Bikes <= 3000)\n## The company has a total of 50 drivers available.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(Trucks <= Vans + Bikes)\n## The company wants to ensure that the total number of vehicles does not exceed 60.\nmodel.addCons(Trucks + Vans + Bikes <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1308,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in advanced technology for each plant, which enhances the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company aims to maximize the total energy production.\n// Energy_Solar = (SolarHours * (1 + 0.01 * SolarTechInvestment / 1000))\n// Energy_Wind = (WindHours * (1 + 0.01 * WindTechInvestment / 1000))\n// Energy_Hydro = (HydroHours * (1 + 0.01 * HydroTechInvestment / 1000))\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000\n\n## Generate Constraint-2:\nThe total operational hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%.\n\n| Plant Type | Efficiency Increase per $1000 Investment |\n|------------|------------------------------------------|\n| Solar      | 10%                                      |\n| Wind       | 8%                                       |\n| Hydro      | 12%                                      |\n\nThe company has a total budget of $50,000 for technology investments and operational costs. The total operational hours for all plants must not exceed 24 hours per day.\n\nPlease help the company to maximize the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of hours Solar plant operates\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of hours Wind plant operates\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of hours Hydro plant operates\nSolarTechInvestment = model.addVar(name=\"SolarTechInvestment\", lb=0)  # investment in advanced technology for Solar\nWindTechInvestment = model.addVar(name=\"WindTechInvestment\", lb=0)  # investment in advanced technology for Wind\nHydroTechInvestment = model.addVar(name=\"HydroTechInvestment\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nEnergy_Solar = SolarHours * (1 + 0.01 * SolarTechInvestment / 1000)\nEnergy_Wind = WindHours * (1 + 0.01 * WindTechInvestment / 1000)\nEnergy_Hydro = HydroHours * (1 + 0.01 * HydroTechInvestment / 1000)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\nmodel.addCons(SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(SolarHours))\n    print(\"Number of hours Wind plant operates: \", model.getVal(WindHours))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(WindTechInvestment))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(HydroTechInvestment))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Profit_A = A * (50 - (100 - 0.5A^2))\n// Profit_B = B * (70 - (120 - 0.4B^2))\n// Profit_C = C * (60 - (110 - 0.3C^2))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 500 units per month.\n// A <= 500\n\n## Generate Constraint-3:\nThe market demand for product B is at most 400 units per month.\n// B <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost. The total production capacity of the company is limited to 1000 units per month. The market demand for product A is at most 500 units per month. The market demand for product B is at most 400 units per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=500) # production quantity for product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # production quantity for product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with non-linear cost\nCost_A = 100 - 0.5 * A**2\nCost_B = 120 - 0.4 * B**2\nCost_C = 110 - 0.3 * C**2\n\nProfit_A = A * (50 - Cost_A)\nProfit_B = B * (70 - Cost_B)\nProfit_C = C * (60 - Cost_C)\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n## The market demand for product A is at most 500 units per month.\nmodel.addCons(A <= 500)\n\n## The market demand for product B is at most 400 units per month.\nmodel.addCons(B <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A))\n    print(\"Production Quantity for Product B: \", model.getVal(B))\n    print(\"Production Quantity for Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a revenue per trip of $1000, a fuel cost per trip of $200, and a maintenance cost per trip of $100.\nTruck B has a revenue per trip of $1500, a fuel cost per trip of $300, and a maintenance cost per trip of $150.\nTruck C has a revenue per trip of $2000, a fuel cost per trip of $400, and a maintenance cost per trip of $200.\nThe company wants to maximize the net profit per trip across all vehicles.\n// Profit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\n// Profit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\n// Profit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total budget of $5000 for maintenance costs per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-3:\nThe company has a limited fleet size of 50 vehicles in total.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different revenue per trip, fuel cost per trip, and maintenance cost per trip. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The details of each vehicle are given in the following Table.\n\n| Vehicle | Revenue per Trip | Fuel Cost per Trip | Maintenance Cost per Trip |\n|---------|------------------|--------------------|---------------------------|\n| Truck A | $1000            | $200               | $100                      |\n| Truck B | $1500            | $300               | $150                      |\n| Truck C | $2000            | $400               | $200                      |\n\nThe company has a total budget of $10,000 for fuel costs per day and a total budget of $5000 for maintenance costs per day. The company also has a limited fleet size of 50 vehicles in total. Please help the company to maximize the net profit per trip across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = (1000 - 200 - 100) * TruckA\nProfit_TruckB = (1500 - 300 - 150) * TruckB\nProfit_TruckC = (2000 - 400 - 200) * TruckC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\nmodel.addCons(200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000) # Fuel cost constraint\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000) # Maintenance cost constraint\nmodel.addCons(TruckA + TruckB + TruckC <= 50) # Fleet size constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Net Profit per Trip: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to produce daily, as well as the number of hours each machine type should operate. The machines are categorized into three types: X, Y, and Z, each suitable for different products.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours machine X operates\": \"HoursX\", \"range\": \"HoursX >= 0\", \"type\": \"real\"}\n// {\"hours machine Y operates\": \"HoursY\", \"range\": \"HoursY >= 0\", \"type\": \"real\"}\n// {\"hours machine Z operates\": \"HoursZ\", \"range\": \"HoursZ >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating machine X per hour is $10, machine Y is $15, and machine Z is $20. The manufacturer aims to maximize the daily profit from product sales minus the operating costs of the machines.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// Cost_X = HoursX * 10\n// Cost_Y = HoursY * 15\n// Cost_Z = HoursZ * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n## Generate Constraint-1:\nMachine X can produce only product A and has a daily operational limit of 8 hours.\n// HoursX = UnitsA / 10 (assuming 10 units of A can be produced per hour by machine X)\n\n## Generate Constraint-2:\nMachine Y can produce only product B and has a daily operational limit of 10 hours.\n// HoursY = UnitsB / 8 (assuming 8 units of B can be produced per hour by machine Y)",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to produce daily, as well as the number of hours each machine type should operate. The machines are categorized into three types: X, Y, and Z, each suitable for different products. The profit per unit and the operating costs of each machine are given in the following Table.\n\n| Product | Profit per Unit | Machine | Operating Cost per Hour |\n|---------|-----------------|---------|------------------------|\n| A       | $50             | X       | $10                    |\n| B       | $70             | Y       | $15                    |\n| C       | $60             | Z       | $20                    |\n\nMachine X can produce only product A and has a daily operational limit of 8 hours. Machine Y can produce only product B and has a daily operational limit of 10 hours. The manufacturer aims to maximize the daily profit from product sales minus the operating costs of the machines. Please help the manufacturer determine the optimal number of units of each product to produce and the optimal number of hours each machine should operate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nHoursX = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursX\", lb=0)  # hours machine X operates\nHoursY = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursY\", lb=0)  # hours machine Y operates\nHoursZ = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursZ\", lb=0)  # hours machine Z operates\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nCost_X = HoursX * 10\nCost_Y = HoursY * 15\nCost_Z = HoursZ * 20\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n# Add constraints\n# Machine X can produce only product A and has a daily operational limit of 8 hours.\nmodel.addCons(HoursX == UnitsA / 10)\nmodel.addCons(HoursX <= 8)\n\n# Machine Y can produce only product B and has a daily operational limit of 10 hours.\nmodel.addCons(HoursY == UnitsB / 8)\nmodel.addCons(HoursY <= 10)\n\n# Machine Z can produce only product C and has a daily operational limit of 12 hours.\n# Assuming 12 units of C can be produced per hour by machine Z\nmodel.addCons(HoursZ == UnitsC / 12)\nmodel.addCons(HoursZ <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours Machine X Operates: \", model.getVal(HoursX))\n    print(\"Hours Machine Y Operates: \", model.getVal(HoursY))\n    print(\"Hours Machine Z Operates: \", model.getVal(HoursZ))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The initial cost per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation technology.\n// AutomationInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 10,000 units per month.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units.\n// QuantityA <= 4000; QuantityB <= 3000\n\n## Generate Constraint-4:\nThe company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations.\n// QuantityC >= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the investment in automation technology to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology. The profit per unit and the initial cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $100            | $50                   |\n| ProductB | $150            | $70                   |\n| ProductC | $200            | $90                   |\n\nThe cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The company has a budget of $100,000 for investment in automation technology. The total production capacity of the company is 10,000 units per month. Due to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units. The company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\nProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\nProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $100,000 for investment in automation technology.\nmodel.addCons(AutomationInvestment <= 100000)\n# The total production capacity of the company is 10,000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# Due to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units.\nmodel.addCons(QuantityA <= 4000)\nmodel.addCons(QuantityB <= 3000)\n# The company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations.\nmodel.addCons(QuantityC >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. \nEach truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. \nEach truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. \nEach truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. \nEach truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. \nThe company aims to minimize the total fuel consumption per package delivered.\n// Fuel consumption of route 1: FC1 = 10 * T1\n// Fuel consumption of route 2: FC2 = 15 * T2\n// Fuel consumption of route 3: FC3 = 20 * T3\n// Fuel consumption of route 4: FC4 = 25 * T4\n// Fuel consumption of route 5: FC5 = 30 * T5\n// Total packages delivered: TP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. Each truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. Each truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. Each truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. Each truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. The company aims to minimize the total fuel consumption per package delivered. The company has a total of 100 trucks available. Please help the company to minimize the total fuel consumption per package delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC1 = 10 * T1\nFC2 = 15 * T2\nFC3 = 20 * T3\nFC4 = 25 * T4\nFC5 = 30 * T5\nTP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n## the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n## convert the division to multiplication\nmodel.addCons(obj * TP == FC1 + FC2 + FC3 + FC4 + FC5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit.\n// {\"quantity of MachineA\": \"MachineA_qty\", \"range\": \"MachineA_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineB\": \"MachineB_qty\", \"range\": \"MachineB_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineC\": \"MachineC_qty\", \"range\": \"MachineC_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineD\": \"MachineD_qty\", \"range\": \"MachineD_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n// Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n// Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n// Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of MachineC must be at least twice the production of MachineB.\n// MachineC_qty >= 2 * MachineB_qty\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials per month.\n// (0.01 * (MachineA_qty^2) + 20 * MachineA_qty) * MachineA_qty + (0.015 * (MachineB_qty^2) + 25 * MachineB_qty) * MachineB_qty + (0.02 * (MachineC_qty^2) + 30 * MachineC_qty) * MachineC_qty + (0.025 * (MachineD_qty^2) + 35 * MachineD_qty) * MachineD_qty <= 500,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each machine type has at least some minimal production to maintain market presence.\n// MachineA_qty >= 10; MachineB_qty >= 10; MachineC_qty >= 10; MachineD_qty >= 10",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit. The profit per unit and the production cost for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost Function |\n|--------------|-----------------|---------------------------|\n| MachineA     | $500            | 0.01 * (MachineA_qty^2) + 20 * MachineA_qty |\n| MachineB     | $700            | 0.015 * (MachineB_qty^2) + 25 * MachineB_qty |\n| MachineC     | $900            | 0.02 * (MachineC_qty^2) + 30 * MachineC_qty |\n| MachineD     | $1100           | 0.025 * (MachineD_qty^2) + 35 * MachineD_qty |\n\nThe company has a total production capacity of 1000 machines per month. Due to market demand, the production of MachineC must be at least twice the production of MachineB. The company has a budget of $500,000 for raw materials per month. The company wants to ensure that each machine type has at least some minimal production to maintain market presence, with a minimum production of 10 units for each machine type.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each machine type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_qty\", lb=0)\nMachineB_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_qty\", lb=0)\nMachineC_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_qty\", lb=0)\nMachineD_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineD_qty\", lb=0)\n\n# Define objective function\n## Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n## Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n## Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n## Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n## So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\nProfit_MachineA = (500 - (0.01 * MachineA_qty**2 + 20 * MachineA_qty)) * MachineA_qty\nProfit_MachineB = (700 - (0.015 * MachineB_qty**2 + 25 * MachineB_qty)) * MachineB_qty\nProfit_MachineC = (900 - (0.02 * MachineC_qty**2 + 30 * MachineC_qty)) * MachineC_qty\nProfit_MachineD = (1100 - (0.025 * MachineD_qty**2 + 35 * MachineD_qty)) * MachineD_qty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000)\n## Due to market demand, the production of MachineC must be at least twice the production of MachineB.\nmodel.addCons(MachineC_qty >= 2 * MachineB_qty)\n## The company has a budget of $500,000 for raw materials per month.\nmodel.addCons((0.01 * MachineA_qty**2 + 20 * MachineA_qty) * MachineA_qty + \n              (0.015 * MachineB_qty**2 + 25 * MachineB_qty) * MachineB_qty + \n              (0.02 * MachineC_qty**2 + 30 * MachineC_qty) * MachineC_qty + \n              (0.025 * MachineD_qty**2 + 35 * MachineD_qty) * MachineD_qty <= 500000)\n## The company wants to ensure that each machine type has at least some minimal production to maintain market presence.\nmodel.addCons(MachineA_qty >= 10)\nmodel.addCons(MachineB_qty >= 10)\nmodel.addCons(MachineC_qty >= 10)\nmodel.addCons(MachineD_qty >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of MachineA: \", model.getVal(MachineA_qty))\n    print(\"Quantity of MachineB: \", model.getVal(MachineB_qty))\n    print(\"Quantity of MachineC: \", model.getVal(MachineC_qty))\n    print(\"Quantity of MachineD: \", model.getVal(MachineD_qty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1288,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. Higher levels of automation reduce the cost per unit but increase the initial investment required.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of ProductA decreases by $2 for every $1000 invested in automation for ProductA. Similarly, the cost per unit of ProductB decreases by $3 for every $1000 invested in automation for ProductB, and the cost per unit of ProductC decreases by $4 for every $1000 invested in automation for ProductC. The selling price per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - (10 - 0.002 * AutomationA)) * QuantityA\n// Total profit for ProductB: ProfitB = (60 - (15 - 0.003 * AutomationB)) * QuantityB\n// Total profit for ProductC: ProfitC = (70 - (20 - 0.004 * AutomationC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 1000 units for each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. Higher levels of automation reduce the cost per unit but increase the initial investment required. The cost per unit of ProductA decreases by $2 for every $1000 invested in automation for ProductA. Similarly, the cost per unit of ProductB decreases by $3 for every $1000 invested in automation for ProductB, and the cost per unit of ProductC decreases by $4 for every $1000 invested in automation for ProductC. The selling price per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products. The total investment in automation cannot exceed $50,000. The company has a production capacity limit of 1000 units for each product.\nPlease help the company to determine the optimal production quantity and level of automation for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfitA = (50 - (10 - 0.002 * AutomationA)) * QuantityA\nProfitB = (60 - (15 - 0.003 * AutomationB)) * QuantityB\nProfitC = (70 - (20 - 0.004 * AutomationC)) * QuantityC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The company has a production capacity limit of 1000 units for each product.\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker to meet the production demands. The production rate per worker varies by product and overtime hours.\n// {\"production quantity of ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"overtime hours per worker\": \"OvertimeHours\", \"range\": \"OvertimeHours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of labor per worker for ProductA is $200 per day, for ProductB is $250 per day, and for ProductC is $300 per day. Overtime hours increase the labor cost by $50 per hour. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = 50 * ProductA_Quantity - (200 + 50 * OvertimeHours) * WorkersA\n// Total profit for ProductB: ProfitB = 70 * ProductB_Quantity - (250 + 50 * OvertimeHours) * WorkersB\n// Total profit for ProductC: ProfitC = 90 * ProductC_Quantity - (300 + 50 * OvertimeHours) * WorkersC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total overtime hours allowed per day cannot exceed 20 hours.\n// OvertimeHours <= 20\n\n## Generate Constraint-3:\nThe production capacity for ProductA is 500 units per day, for ProductB is 600 units per day, and for ProductC is 700 units per day.\n// ProductA_Quantity <= 500; ProductB_Quantity <= 600; ProductC_Quantity <= 700\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n// WorkersA >= 20; WorkersB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker to meet the production demands. The production rate per worker varies by product and overtime hours. The profit per unit and the cost of labor per worker for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker |\n|---------|-----------------|-----------------------|\n| ProductA | $50            | $200 + $50 * OvertimeHours |\n| ProductB | $70            | $250 + $50 * OvertimeHours |\n| ProductC | $90            | $300 + $50 * OvertimeHours |\n\nThe company has a total of 100 workers available. The total overtime hours allowed per day cannot exceed 20 hours. The production capacity for ProductA is 500 units per day, for ProductB is 600 units per day, and for ProductC is 700 units per day. The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=20)\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=30)\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)\nOvertimeHours = model.addVar(vtype=\"CONTINUOUS\", name=\"OvertimeHours\", lb=0)\n\n# Define objective function\nProfitA = 50 * ProductA_Quantity - (200 + 50 * OvertimeHours) * WorkersA\nProfitB = 70 * ProductB_Quantity - (250 + 50 * OvertimeHours) * WorkersB\nProfitC = 90 * ProductC_Quantity - (300 + 50 * OvertimeHours) * WorkersC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(OvertimeHours <= 20)\nmodel.addCons(ProductA_Quantity <= 500)\nmodel.addCons(ProductB_Quantity <= 600)\nmodel.addCons(ProductC_Quantity <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Overtime Hours: \", model.getVal(OvertimeHours))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 50 trucks in total.\n// Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks for each type of cargo.\n// Food >= 10\n// Electronics >= 10\n// Textiles >= 10\n// Chemicals >= 10\n// HeavyMachinery >= 10\n\n## Generate Constraint-4:\nThe environmental impact of the fleet should not exceed a certain threshold, which is calculated as the sum of the environmental impact of each type of truck.\n// 0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2 <= 1000\n\n## Generate Constraint-5:\nThe company wants to ensure that no more than 30% of the total budget is spent on any single type of truck.\n// 5000 * Food <= 0.3 * 500000\n// 7000 * Electronics <= 0.3 * 500000\n// 4000 * Textiles <= 0.3 * 500000\n// 6000 * Chemicals <= 0.3 * 500000\n// 8000 * HeavyMachinery <= 0.3 * 500000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company aims to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact also affects the company's taxes.\n\n| Type of Cargo | Profit per Truck | Operational Cost Function | Environmental Impact Function |\n|---------------|------------------|---------------------------|-------------------------------|\n| Food          | 5000$            | 0.01 * Food^2             | 0.005 * Food^2                |\n| Electronics   | 7000$            | 0.015 * Electronics^2     | 0.007 * Electronics^2          |\n| Textiles      | 4000$            | 0.008 * Textiles^2        | 0.004 * Textiles^2            |\n| Chemicals     | 6000$            | 0.02 * Chemicals^2        | 0.01 * Chemicals^2            |\n| Heavy Machinery | 8000$          | 0.025 * HeavyMachinery^2  | 0.012 * HeavyMachinery^2      |\n\nThe company has a budget of $500,000 for purchasing trucks. The company must have at least 50 trucks in total and at least 10 trucks for each type of cargo. The environmental impact of the fleet should not exceed a certain threshold, which is calculated as the sum of the environmental impact of each type of truck. Additionally, the company wants to ensure that no more than 30% of the total budget is spent on any single type of truck.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks for each type of cargo, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=10)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=10)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=10)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=10)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=10)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and costs calculation\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (Profit - Cost - EnvImpact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n## The company must have at least 50 trucks in total.\nmodel.addCons(Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50)\n\n## The environmental impact of the fleet should not exceed a certain threshold.\nmodel.addCons(0.005 * Food**2 + 0.007 * Electronics**2 + 0.004 * Textiles**2 + 0.01 * Chemicals**2 + 0.012 * HeavyMachinery**2 <= 1000)\n\n## The company wants to ensure that no more than 30% of the total budget is spent on any single type of truck.\nmodel.addCons(5000 * Food <= 0.3 * 500000)\nmodel.addCons(7000 * Electronics <= 0.3 * 500000)\nmodel.addCons(4000 * Textiles <= 0.3 * 500000)\nmodel.addCons(6000 * Chemicals <= 0.3 * 500000)\nmodel.addCons(8000 * HeavyMachinery <= 0.3 * 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1770,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteX\": \"UpgradeX\", \"range\": \"UpgradeX >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteY\": \"UpgradeY\", \"range\": \"UpgradeY >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteZ\": \"UpgradeZ\", \"range\": \"UpgradeZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route decreases nonlinearly with the investment in fuel efficiency upgrades. The cost reduction is modeled as a quadratic function where the cost per kilometer decreases by a factor proportional to the square of the upgrade investment.\nThe initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ.\nThe company aims to minimize the total operational cost across all routes.\n// Operational cost for RouteX: CostX = 10 * TrucksX - 0.01 * UpgradeX^2 * TrucksX\n// Operational cost for RouteY: CostY = 12 * TrucksY - 0.015 * UpgradeY^2 * TrucksY\n// Operational cost for RouteZ: CostZ = 15 * TrucksZ - 0.02 * UpgradeZ^2 * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\n// TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all routes must not exceed 500.\n// TrucksX + TrucksY + TrucksZ <= 500",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency. The operational cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades, modeled as a quadratic function where the cost per kilometer decreases by a factor proportional to the square of the upgrade investment. The initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ.\n\n| Route | Initial Operational Cost per Kilometer | Cost Reduction per $1000 Invested |\n|-------|----------------------------------------|-----------------------------------|\n| RouteX | $10                                   | 0.01 * UpgradeX^2                 |\n| RouteY | $12                                   | 0.015 * UpgradeY^2                |\n| RouteZ | $15                                   | 0.02 * UpgradeZ^2                 |\n\nThe company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks across all routes must not exceed 500. Please help the company to minimize the total operational cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for RouteZ\nUpgradeX = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeX\", lb=0) # fuel efficiency upgrade for RouteX\nUpgradeY = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeY\", lb=0) # fuel efficiency upgrade for RouteY\nUpgradeZ = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeZ\", lb=0) # fuel efficiency upgrade for RouteZ\n\n# Define objective function\nCostX = 10 * TrucksX - 0.01 * UpgradeX**2 * TrucksX\nCostY = 12 * TrucksY - 0.015 * UpgradeY**2 * TrucksY\nCostZ = 15 * TrucksZ - 0.02 * UpgradeZ**2 * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000)\n# The total number of trucks across all routes must not exceed 500.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Efficiency Upgrade for RouteX: \", model.getVal(UpgradeX))\n    print(\"Fuel Efficiency Upgrade for RouteY: \", model.getVal(UpgradeY))\n    print(\"Fuel Efficiency Upgrade for RouteZ: \", model.getVal(UpgradeZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1538,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. They need to determine the production quantity for each product to optimize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductE\": \"ProdE\", \"range\": \"ProdE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, for ProductD is $60, and for ProductE is $80. The company wants to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = 50 * ProdA\n// Total profit for ProductB: Profit_B = 70 * ProdB\n// Total profit for ProductC: Profit_C = 90 * ProdC\n// Total profit for ProductD: Profit_D = 60 * ProdD\n// Total profit for ProductE: Profit_E = 80 * ProdE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProdA + ProdB + ProdC + ProdD + ProdE <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA",
        "question": "A manufacturing company is planning to produce five different types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. They need to determine the production quantity for each product to optimize their profit. The profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, for ProductD is $60, and for ProductE is $80. The company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=0) # production quantity for ProductD\nProdE = model.addVar(vtype=\"INTEGER\", name=\"ProdE\", lb=0) # production quantity for ProductE\n\n# Define objective function\nProfit_A = 50 * ProdA\nProfit_B = 70 * ProdB\nProfit_C = 90 * ProdC\nProfit_D = 60 * ProdD\nProfit_E = 80 * ProdE\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n# The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(ProdA + ProdB + ProdC + ProdD + ProdE <= 1000)\n# Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProdB <= 2 * ProdA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Production Quantity for ProductE: \", model.getVal(ProdE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 614,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region.\n// {\"number of trucks allocated to region 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 6\": \"Truck6\", \"range\": \"Truck6 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 1\": \"Driver1\", \"range\": \"Driver1 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 2\": \"Driver2\", \"range\": \"Driver2 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 3\": \"Driver3\", \"range\": \"Driver3 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 4\": \"Driver4\", \"range\": \"Driver4 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 5\": \"Driver5\", \"range\": \"Driver5 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 6\": \"Driver6\", \"range\": \"Driver6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n// Total profit for region 1: Profit1 = (50,000 - 20,000 * Driver1) * Truck1\n// Total profit for region 2: Profit2 = (60,000 - 20,000 * Driver2) * Truck2\n// Total profit for region 3: Profit3 = (70,000 - 20,000 * Driver3) * Truck3\n// Total profit for region 4: Profit4 = (80,000 - 20,000 * Driver4) * Truck4\n// Total profit for region 5: Profit5 = (90,000 - 20,000 * Driver5) * Truck5\n// Total profit for region 6: Profit6 = (100,000 - 20,000 * Driver6) * Truck6\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region. The profit per truck varies by region: $50,000 for region 1, $60,000 for region 2, $70,000 for region 3, $80,000 for region 4, $90,000 for region 5, and $100,000 for region 6. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver. The company has a total of 50 trucks available for allocation.\n\nPlease help the company to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks allocated to region 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks allocated to region 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks allocated to region 3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks allocated to region 4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks allocated to region 5\nTruck6 = model.addVar(vtype=\"INTEGER\", name=\"Truck6\", lb=0) # number of trucks allocated to region 6\nDriver1 = model.addVar(vtype=\"INTEGER\", name=\"Driver1\", lb=0) # number of additional drivers hired for region 1\nDriver2 = model.addVar(vtype=\"INTEGER\", name=\"Driver2\", lb=0) # number of additional drivers hired for region 2\nDriver3 = model.addVar(vtype=\"INTEGER\", name=\"Driver3\", lb=0) # number of additional drivers hired for region 3\nDriver4 = model.addVar(vtype=\"INTEGER\", name=\"Driver4\", lb=0) # number of additional drivers hired for region 4\nDriver5 = model.addVar(vtype=\"INTEGER\", name=\"Driver5\", lb=0) # number of additional drivers hired for region 5\nDriver6 = model.addVar(vtype=\"INTEGER\", name=\"Driver6\", lb=0) # number of additional drivers hired for region 6\n\n# Define objective function\nProfit1 = (50000 - 20000 * Driver1) * Truck1\nProfit2 = (60000 - 20000 * Driver2) * Truck2\nProfit3 = (70000 - 20000 * Driver3) * Truck3\nProfit4 = (80000 - 20000 * Driver4) * Truck4\nProfit5 = (90000 - 20000 * Driver5) * Truck5\nProfit6 = (100000 - 20000 * Driver6) * Truck6\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(Truck5))\n    print(\"Number of Trucks in Region 6: \", model.getVal(Truck6))\n    print(\"Number of Drivers in Region 1: \", model.getVal(Driver1))\n    print(\"Number of Drivers in Region 2: \", model.getVal(Driver2))\n    print(\"Number of Drivers in Region 3: \", model.getVal(Driver3))\n    print(\"Number of Drivers in Region 4: \", model.getVal(Driver4))\n    print(\"Number of Drivers in Region 5: \", model.getVal(Driver5))\n    print(\"Number of Drivers in Region 6: \", model.getVal(Driver6))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 736,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\n// {\"number of trucks for G1\": \"TruckG1\", \"range\": \"TruckG1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G2\": \"TruckG2\", \"range\": \"TruckG2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G3\": \"TruckG3\", \"range\": \"TruckG3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G4\": \"TruckG4\", \"range\": \"TruckG4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G5\": \"TruckG5\", \"range\": \"TruckG5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n// Net profit for G1: Profit_G1 = (5000 - 1000 - 500) * TruckG1\n// Net profit for G2: Profit_G2 = (7000 - 1500 - 700) * TruckG2\n// Net profit for G3: Profit_G3 = (9000 - 2000 - 900) * TruckG3\n// Net profit for G4: Profit_G4 = (6000 - 1200 - 600) * TruckG4\n// Net profit for G5: Profit_G5 = (8000 - 1800 - 800) * TruckG5\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / (TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50\n\n## Generate Constraint-2:\nDue to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\n// TruckG3 <= TruckG1 + TruckG2\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs for the month.\n// 1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of good has at least one truck allocated.\n// TruckG1 >= 1; TruckG2 >= 1; TruckG3 >= 1; TruckG4 >= 1; TruckG5 >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company has a total of 50 trucks available for the month. Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2. The company has a budget of $50,000 for fuel costs for the month. The company wants to ensure that each type of good has at least one truck allocated.\nPlease help the company to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckG1 = model.addVar(vtype=\"INTEGER\", name=\"TruckG1\", lb=1)  # number of trucks for G1\nTruckG2 = model.addVar(vtype=\"INTEGER\", name=\"TruckG2\", lb=1)  # number of trucks for G2\nTruckG3 = model.addVar(vtype=\"INTEGER\", name=\"TruckG3\", lb=1)  # number of trucks for G3\nTruckG4 = model.addVar(vtype=\"INTEGER\", name=\"TruckG4\", lb=1)  # number of trucks for G4\nTruckG5 = model.addVar(vtype=\"INTEGER\", name=\"TruckG5\", lb=1)  # number of trucks for G5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = (5000 - 1000 - 500) * TruckG1\nProfit_G2 = (7000 - 1500 - 700) * TruckG2\nProfit_G3 = (9000 - 2000 - 900) * TruckG3\nProfit_G4 = (6000 - 1200 - 600) * TruckG4\nProfit_G5 = (8000 - 1800 - 800) * TruckG5\nTotalTrucks = TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50)\n## Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\nmodel.addCons(TruckG3 <= TruckG1 + TruckG2)\n## The company has a budget of $50,000 for fuel costs for the month.\nmodel.addCons(1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for G1: \", model.getVal(TruckG1))\n    print(\"Number of Trucks for G2: \", model.getVal(TruckG2))\n    print(\"Number of Trucks for G3: \", model.getVal(TruckG3))\n    print(\"Number of Trucks for G4: \", model.getVal(TruckG4))\n    print(\"Number of Trucks for G5: \", model.getVal(TruckG5))\n    print(\"Maximized Average Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.\n// Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n// Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n// Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n// Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n// Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for annual maintenance costs.\n// 5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1,000,000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be operated.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met. The total cargo capacity required is 500 tons. The company has a budget of $1,000,000 for annual maintenance costs. The company has a limit of 100 trucks that can be operated.\nPlease help the company to determine the optimal number of each truck type to minimize the total annual operational and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance to be traveled, assumed constant for simplicity\nCost_T1 = 2 * Distance * T1 + 5000 * T1\nCost_T2 = 1.5 * Distance * T2 + 6000 * T2\nCost_T3 = 1.2 * Distance * T3 + 7000 * T3\nCost_T4 = 1 * Distance * T4 + 8000 * T4\nCost_T5 = 0.8 * Distance * T5 + 9000 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500)\n## The company has a budget of $1,000,000 for annual maintenance costs.\nmodel.addCons(5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1000000)\n## The company has a limit of 100 trucks that can be operated.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades. The maintenance cost is linearly proportional to the number of trucks.\n// Fuel cost for Route1: FuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\n// Fuel cost for Route2: FuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\n// Fuel cost for Route3: FuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\n// Fuel cost for Route4: FuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\n// Fuel cost for Route5: FuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\n// Maintenance cost: MaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nAt least 10 trucks must be assigned to Route1 and Route2 combined.\n// Trucks1 + Trucks2 >= 10\n\n## Generate Constraint-4:\nThe fuel efficiency upgrade for any route cannot exceed 30%.\n// Upgrade1 <= 30; Upgrade2 <= 30; Upgrade3 <= 30; Upgrade4 <= 30; Upgrade5 <= 30\n\n## Generate Constraint-5:\nThe total operational cost must not exceed $200,000.\n// (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost) <= 200000",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades, and the maintenance cost is linearly proportional to the number of trucks.\n\n| Route | Fuel Cost Function | Maintenance Cost |\n|-------|--------------------|------------------|\n| Route1 | (1000 / (1 + Upgrade1/100)) * Trucks1 | 500 * Trucks1 |\n| Route2 | (1200 / (1 + Upgrade2/100)) * Trucks2 | 500 * Trucks2 |\n| Route3 | (1500 / (1 + Upgrade3/100)) * Trucks3 | 500 * Trucks3 |\n| Route4 | (1300 / (1 + Upgrade4/100)) * Trucks4 | 500 * Trucks4 |\n| Route5 | (1100 / (1 + Upgrade5/100)) * Trucks5 | 500 * Trucks5 |\n\nThe company has a budget of $100,000 for fuel efficiency upgrades. The total number of trucks available is limited to 50. At least 10 trucks must be assigned to Route1 and Route2 combined. The fuel efficiency upgrade for any route cannot exceed 30%. The total operational cost must not exceed $200,000.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and maintenance costs, while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Route5\n\n# Define objective function\nFuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\nFuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\nFuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\nFuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\nFuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\nMaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)  # budget for upgrades\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)  # total trucks\nmodel.addCons(Trucks1 + Trucks2 >= 10)  # at least 10 trucks for Route1 and Route2\nmodel.addCons(Upgrade1 <= 30)  # upgrade limit for Route1\nmodel.addCons(Upgrade2 <= 30)  # upgrade limit for Route2\nmodel.addCons(Upgrade3 <= 30)  # upgrade limit for Route3\nmodel.addCons(Upgrade4 <= 30)  # upgrade limit for Route4\nmodel.addCons(Upgrade5 <= 30)  # upgrade limit for Route5\nmodel.addCons(obj <= 200000)  # total operational cost limit\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1493,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&DInvestment\", \"range\": \"R&DInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of ProductA is initially $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The market price of ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. For every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products cannot exceed $50,000 per month.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total investment in R&D cannot exceed $100,000 per month.\n// R&DInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment. The initial production costs and market prices for each product are given in the following Table.\n\n| Product | Initial Production Cost | Market Price |\n|---------|-------------------------|--------------|\n| ProductA | $100 per unit          | $150 per unit|\n| ProductB | $150 per unit          | $200 per unit|\n| ProductC | $200 per unit          | $250 per unit|\n\nFor every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products. The total production capacity of the company is 1000 units per month. The total marketing budget for all products cannot exceed $50,000 per month. The total investment in R&D cannot exceed $100,000 per month.\n\nPlease help the company to determine the optimal production quantities, marketing budgets, and R&D investment to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nR_DInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"R&DInvestment\", lb=0)  # investment in R&D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ((150 - (100 - 0.0005 * R_DInvestment)) * QuantityA - MarketingA) +\n                   ((200 - (150 - 0.0005 * R_DInvestment)) * QuantityB - MarketingB) +\n                   ((250 - (200 - 0.0005 * R_DInvestment)) * QuantityC - MarketingC))\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n## The total marketing budget for all products cannot exceed $50,000 per month.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n## The total investment in R&D cannot exceed $100,000 per month.\nmodel.addCons(R_DInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Investment in R&D: \", model.getVal(R_DInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and wind turbines is 30%. The company aims to maximize the total energy output from all installations.\n// Total energy output from solar panels in RegionA: EnergySolarA = 0.2 * (1 + 0.01 * R&D / 10000) * SolarA\n// Total energy output from wind turbines in RegionA: EnergyWindA = 0.3 * (1 + 0.005 * R&D / 10000) * WindA\n// Total energy output from solar panels in RegionB: EnergySolarB = 0.2 * (1 + 0.01 * R&D / 10000) * SolarB\n// Total energy output from wind turbines in RegionB: EnergyWindB = 0.3 * (1 + 0.005 * R&D / 10000) * WindB\n// Total energy output from solar panels in RegionC: EnergySolarC = 0.2 * (1 + 0.01 * R&D / 10000) * SolarC\n// Total energy output from wind turbines in RegionC: EnergyWindC = 0.3 * (1 + 0.005 * R&D / 10000) * WindC\n// So, the objective function is: Maximize (EnergySolarA + EnergyWindA + EnergySolarB + EnergyWindB + EnergySolarC + EnergyWindC)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation and R&D.\n// 10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC + R&D <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines in each region must not exceed 100.\n// SolarA + WindA <= 100; SolarB + WindB <= 100; SolarC + WindC <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB.\n// SolarA >= 20; WindB >= 30\n\n## Generate Constraint-4:\nThe total investment in R&D must not exceed 20% of the total installation cost.\n// R&D <= 0.2 * (10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies. The efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and wind turbines is 30%. The company aims to maximize the total energy output from all installations.\n\n| Region | Technology | Installation Cost |\n|--------|------------|------------------|\n| RegionA | Solar Panels | $10,000 per unit |\n| RegionA | Wind Turbines | $15,000 per unit |\n| RegionB | Solar Panels | $10,000 per unit |\n| RegionB | Wind Turbines | $15,000 per unit |\n| RegionC | Solar Panels | $10,000 per unit |\n| RegionC | Wind Turbines | $15,000 per unit |\n\nThe company has a budget of $500,000 for installation and R&D. The total number of solar panels and wind turbines in each region must not exceed 100. The company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB. The total investment in R&D must not exceed 20% of the total installation cost.\n\nPlease help the company to maximize the total energy output from all installations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0)  # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0)    # number of wind turbines in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0)  # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0)    # number of wind turbines in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0)  # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0)    # number of wind turbines in RegionC\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0)    # investment in R&D\n\n# Define objective function\nEnergySolarA = 0.2 * (1 + 0.01 * R_D / 10000) * SolarA\nEnergyWindA = 0.3 * (1 + 0.005 * R_D / 10000) * WindA\nEnergySolarB = 0.2 * (1 + 0.01 * R_D / 10000) * SolarB\nEnergyWindB = 0.3 * (1 + 0.005 * R_D / 10000) * WindB\nEnergySolarC = 0.2 * (1 + 0.01 * R_D / 10000) * SolarC\nEnergyWindC = 0.3 * (1 + 0.005 * R_D / 10000) * WindC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolarA + EnergyWindA + EnergySolarB + EnergyWindB + EnergySolarC + EnergyWindC)\n\n# Add constraints\nmodel.addCons(10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC + R_D <= 500000)\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 100)\nmodel.addCons(SolarC + WindC <= 100)\nmodel.addCons(SolarA >= 20)\nmodel.addCons(WindB >= 30)\nmodel.addCons(R_D <= 0.2 * (10000 * SolarA + 15000 * WindA + 10000 * SolarB + 15000 * WindB + 10000 * SolarC + 15000 * WindC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"SpecialtyTrucks\", \"range\": \"SpecialtyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type varies with the number of trucks in operation. Small trucks have a base fuel efficiency of 20 km/l, Medium trucks 15 km/l, Large trucks 10 km/l, Extra-Large trucks 8 km/l, and Specialty trucks 5 km/l. The fuel efficiency improves by 0.1 km/l for each additional truck of the same type beyond the first 10 trucks. The company wants to minimize the total fuel consumption while meeting customer demand.\n// Fuel_Small = (20 + 0.1 * max(SmallTrucks - 10, 0)) * SmallTrucks\n// Fuel_Medium = (15 + 0.1 * max(MediumTrucks - 10, 0)) * MediumTrucks\n// Fuel_Large = (10 + 0.1 * max(LargeTrucks - 10, 0)) * LargeTrucks\n// Fuel_ExtraLarge = (8 + 0.1 * max(ExtraLargeTrucks - 10, 0)) * ExtraLargeTrucks\n// Fuel_Specialty = (5 + 0.1 * max(SpecialtyTrucks - 10, 0)) * SpecialtyTrucks\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand. The fuel efficiency of each truck type varies with the number of trucks in operation. Small trucks have a base fuel efficiency of 20 km/l, Medium trucks 15 km/l, Large trucks 10 km/l, Extra-Large trucks 8 km/l, and Specialty trucks 5 km/l. The fuel efficiency improves by 0.1 km/l for each additional truck of the same type beyond the first 10 trucks. The company wants to minimize the total fuel consumption while meeting customer demand. The company has a total fleet size of 100 trucks. Please help the company to determine the optimal number of each type of truck to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nSpecialtyTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_Small = (20 + 0.1 * max(SmallTrucks - 10, 0)) * SmallTrucks\nSmallTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks1\", lb=0, ub=10)\nSmallTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks2\", lb=10, ub=100)\nSmall_b1 = model.addVar(vtype=\"B\", name=\"Small_b1\")\nSmall_b2 = model.addVar(vtype=\"B\", name=\"Small_b2\")\nmodel.addCons(Small_b1 + Small_b2 == 1)\nmodel.addCons(SmallTrucks == SmallTrucks1*Small_b1 + SmallTrucks2*Small_b2)\nFuel_Small = (20 + 0.1 * (SmallTrucks2 - 10)) * SmallTrucks2 * Small_b2\n\n## create piecewise variables for piecewise function: Fuel_Medium = (15 + 0.1 * max(MediumTrucks - 10, 0)) * MediumTrucks\nMediumTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks1\", lb=0, ub=10)\nMediumTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks2\", lb=10, ub=100)\nMedium_b1 = model.addVar(vtype=\"B\", name=\"Medium_b1\")\nMedium_b2 = model.addVar(vtype=\"B\", name=\"Medium_b2\")\nmodel.addCons(Medium_b1 + Medium_b2 == 1)\nmodel.addCons(MediumTrucks == MediumTrucks1*Medium_b1 + MediumTrucks2*Medium_b2)\nFuel_Medium = (15 + 0.1 * (MediumTrucks2 - 10)) * MediumTrucks2 * Medium_b2\n\n## create piecewise variables for piecewise function: Fuel_Large = (10 + 0.1 * max(LargeTrucks - 10, 0)) * LargeTrucks\nLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks1\", lb=0, ub=10)\nLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks2\", lb=10, ub=100)\nLarge_b1 = model.addVar(vtype=\"B\", name=\"Large_b1\")\nLarge_b2 = model.addVar(vtype=\"B\", name=\"Large_b2\")\nmodel.addCons(Large_b1 + Large_b2 == 1)\nmodel.addCons(LargeTrucks == LargeTrucks1*Large_b1 + LargeTrucks2*Large_b2)\nFuel_Large = (10 + 0.1 * (LargeTrucks2 - 10)) * LargeTrucks2 * Large_b2\n\n## create piecewise variables for piecewise function: Fuel_ExtraLarge = (8 + 0.1 * max(ExtraLargeTrucks - 10, 0)) * ExtraLargeTrucks\nExtraLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks1\", lb=0, ub=10)\nExtraLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks2\", lb=10, ub=100)\nExtraLarge_b1 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b1\")\nExtraLarge_b2 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b2\")\nmodel.addCons(ExtraLarge_b1 + ExtraLarge_b2 == 1)\nmodel.addCons(ExtraLargeTrucks == ExtraLargeTrucks1*ExtraLarge_b1 + ExtraLargeTrucks2*ExtraLarge_b2)\nFuel_ExtraLarge = (8 + 0.1 * (ExtraLargeTrucks2 - 10)) * ExtraLargeTrucks2 * ExtraLarge_b2\n\n## create piecewise variables for piecewise function: Fuel_Specialty = (5 + 0.1 * max(SpecialtyTrucks - 10, 0)) * SpecialtyTrucks\nSpecialtyTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks1\", lb=0, ub=10)\nSpecialtyTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks2\", lb=10, ub=100)\nSpecialty_b1 = model.addVar(vtype=\"B\", name=\"Specialty_b1\")\nSpecialty_b2 = model.addVar(vtype=\"B\", name=\"Specialty_b2\")\nmodel.addCons(Specialty_b1 + Specialty_b2 == 1)\nmodel.addCons(SpecialtyTrucks == SpecialtyTrucks1*Specialty_b1 + SpecialtyTrucks2*Specialty_b2)\nFuel_Specialty = (5 + 0.1 * (SpecialtyTrucks2 - 10)) * SpecialtyTrucks2 * Specialty_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The company has a total fleet size of 100 trucks.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Specialty Trucks: \", model.getVal(SpecialtyTrucks))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be used across all regions.\n// T1 + T2 + T3 + T4 + T5 <= 5\n\n## Generate Constraint-3:\nThe demand for trucks in R1 is at least 1, and in R5 is at most 2.\n// T1 >= 1\n// T5 <= 2\n\n## Generate Constraint-4:\nThe company aims to balance the distribution of trucks across regions, ensuring that no region has more than twice the number of trucks as any other region.\n// T1 <= 2 * T2\n// T1 <= 2 * T3\n// T1 <= 2 * T4\n// T2 <= 2 * T1\n// T2 <= 2 * T3\n// T2 <= 2 * T4\n// T3 <= 2 * T1\n// T3 <= 2 * T2\n// T3 <= 2 * T4\n// T4 <= 2 * T1\n// T4 <= 2 * T2\n// T4 <= 2 * T3\n// T5 <= 2 * T1\n// T5 <= 2 * T2\n// T5 <= 2 * T3\n// T5 <= 2 * T4",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day. The company has a total budget of $10,000 per day for operating costs. The company has a limit of 5 trucks that can be used across all regions. The demand for trucks in R1 is at least 1, and in R5 is at most 2. The company aims to balance the distribution of trucks across regions, ensuring that no region has more than twice the number of trucks as any other region. Please help the company to maximize the net profit per truck per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_R1 = (1500 - 1000)\nProfit_R2 = (1800 - 1200)\nProfit_R3 = (2100 - 1500)\nProfit_R4 = (2400 - 1800)\nProfit_R5 = (2700 - 2000)\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be used across all regions.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n## The demand for trucks in R1 is at least 1, and in R5 is at most 2.\nmodel.addCons(T1 >= 1)\nmodel.addCons(T5 <= 2)\n## The company aims to balance the distribution of trucks across regions, ensuring that no region has more than twice the number of trucks as any other region.\nmodel.addCons(T1 <= 2 * T2)\nmodel.addCons(T1 <= 2 * T3)\nmodel.addCons(T1 <= 2 * T4)\nmodel.addCons(T2 <= 2 * T1)\nmodel.addCons(T2 <= 2 * T3)\nmodel.addCons(T2 <= 2 * T4)\nmodel.addCons(T3 <= 2 * T1)\nmodel.addCons(T3 <= 2 * T2)\nmodel.addCons(T3 <= 2 * T4)\nmodel.addCons(T4 <= 2 * T1)\nmodel.addCons(T4 <= 2 * T2)\nmodel.addCons(T4 <= 2 * T3)\nmodel.addCons(T5 <= 2 * T1)\nmodel.addCons(T5 <= 2 * T2)\nmodel.addCons(T5 <= 2 * T3)\nmodel.addCons(T5 <= 2 * T4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, with a carbon emission of 10 kg per unit.\nThe profit per unit of Product B is $70, with a carbon emission of 15 kg per unit.\nThe profit per unit of Product C is $60, with a carbon emission of 12 kg per unit.\nThe profit per unit of Product D is $80, with a carbon emission of 20 kg per unit.\nThe profit per unit of Product E is $90, with a carbon emission of 25 kg per unit.\nThe company wants to maximize the Profit-Carbon ratio of the production. (The Profit-Carbon ratio is defined as the total profit divided by the total carbon emissions.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total carbon emissions: Carbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n// So, the objective function is: Maximize Profit / Carbon\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1500",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit and the carbon emission per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Carbon Emission per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 10 kg                    |\n| B       | $70             | 15 kg                    |\n| C       | $60             | 12 kg                    |\n| D       | $80             | 20 kg                    |\n| E       | $90             | 25 kg                    |\n\nThe company wants to maximize the Profit-Carbon ratio of the production, which is defined as the total profit divided by the total carbon emissions. The company has a total production capacity of 1500 units across all products. Please help the company determine the optimal amount of each product to produce to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCarbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n## the objective function is: Maximize Profit / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"distance from depot to warehouse 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 6\": \"D6\", \"range\": \"D6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe transportation cost is calculated based on the number of trucks and the distance each truck travels. The cost per kilometer is $2. The company aims to minimize the total transportation cost.\n// Total_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n// So, the objective function is: Minimize Total_Cost\n// Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nEach warehouse must have at least 2 trucks.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2; T6 >= 2",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined. The transportation cost is calculated based on the number of trucks and the distance each truck travels, with a cost of $2 per kilometer. The company aims to minimize the total transportation cost. The total number of trucks available is 50, and each warehouse must have at least 2 trucks. Please help the company determine the optimal allocation of trucks and the distances to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=2) # number of trucks at warehouse 6\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance from depot to warehouse 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance from depot to warehouse 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance from depot to warehouse 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance from depot to warehouse 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance from depot to warehouse 5\nD6 = model.addVar(vtype=\"CONTINUOUS\", name=\"D6\", lb=0) # distance from depot to warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nTotal_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Distance from Depot to Warehouse 1: \", model.getVal(D1))\n    print(\"Distance from Depot to Warehouse 2: \", model.getVal(D2))\n    print(\"Distance from Depot to Warehouse 3: \", model.getVal(D3))\n    print(\"Distance from Depot to Warehouse 4: \", model.getVal(D4))\n    print(\"Distance from Depot to Warehouse 5: \", model.getVal(D5))\n    print(\"Distance from Depot to Warehouse 6: \", model.getVal(D6))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has a fixed cost of $100 per day and can carry 500 kg. \nEach Medium truck has a fixed cost of $150 per day and can carry 1000 kg. \nEach Large truck has a fixed cost of $200 per day and can carry 1500 kg. \nEach Extra-Large truck has a fixed cost of $250 per day and can carry 2000 kg. \nEach Specialized truck has a fixed cost of $300 per day and can carry 2500 kg. \nThe company needs to transport at least 10,000 kg of goods daily. The objective is to minimize the total daily cost of operating the trucks while meeting the required transport capacity.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp\n// Total capacity = 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp\n// So, the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n## Generate Constraint-1:\nThe total daily transport capacity must be at least 10,000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operating all trucks.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000\n\n## Generate Constraint-3:\nThere is a limit on the number of trucks of each type that can be operated. The company can operate at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 3 Specialized trucks.\n// S <= 10; M <= 8; L <= 6; XL <= 4; Sp <= 3",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs. The fixed daily cost and carrying capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fixed Cost per Day | Carrying Capacity |\n|------------------|--------------------|-------------------|\n| Small            | $100               | 500 kg            |\n| Medium           | $150               | 1000 kg           |\n| Large            | $200               | 1500 kg           |\n| Extra-Large      | $250               | 2000 kg           |\n| Specialized      | $300               | 2500 kg           |\n\nThe company needs to transport at least 10,000 kg of goods daily. The company has a budget constraint of $10,000 per day for operating all trucks. There is also a limit on the number of trucks of each type that can be operated: at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 3 Specialized trucks.\n\nPlease help the company to minimize the total daily cost of operating the trucks while meeting the required transport capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n# Add constraints\n## The total daily transport capacity must be at least 10,000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000)\n## The company has a budget constraint of $10,000 per day for operating all trucks.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000)\n## There is a limit on the number of trucks of each type that can be operated.\nmodel.addCons(S <= 10)\nmodel.addCons(M <= 8)\nmodel.addCons(L <= 6)\nmodel.addCons(XL <= 4)\nmodel.addCons(Sp <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialized trucks: \", model.getVal(Sp))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company needs to deliver at least 5000 kg of goods per day. Each Small truck can carry 500 kg, each Medium truck can carry 1000 kg, each Large truck can carry 1500 kg, each Extra-Large truck can carry 2000 kg, and each Refrigerated truck can carry 1000 kg. The company aims to minimize the total daily operational cost, considering the distance traveled by each type of truck.\n// Total_Cost = 2 * S * D_S + 3 * M * D_M + 4 * L * D_L + 5 * XL * D_XL + 6 * R * D_R\n// where D_S, D_M, D_L, D_XL, D_R are the distances traveled by each type of truck.\n// The objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000\n\n## Generate Constraint-2:\nThe company has a budget constraint for the number of trucks it can operate. The total number of trucks cannot exceed 10.\n// S + M + L + XL + R <= 10",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements. The operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company needs to deliver at least 5000 kg of goods per day. Each Small truck can carry 500 kg, each Medium truck can carry 1000 kg, each Large truck can carry 1500 kg, each Extra-Large truck can carry 2000 kg, and each Refrigerated truck can carry 1000 kg. The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg. The company has a budget constraint for the number of trucks it can operate, where the total number of trucks cannot exceed 10. Please help the company to minimize the total daily operational cost, considering the distance traveled by each type of truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize Total_Cost\nTotal_Cost = 2 * S + 3 * M + 4 * L + 5 * XL + 6 * R\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000)\n## The company has a budget constraint for the number of trucks it can operate. The total number of trucks cannot exceed 10.\nmodel.addCons(S + M + L + XL + R <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo.\n// {\"trips for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"trips for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"trips for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"trips for C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"trips for C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per trip is $1000, the fuel cost per trip is $200, and the time per trip is 5 hours.\nFor C2, the profit per trip is $1200, the fuel cost per trip is $250, and the time per trip is 6 hours.\nFor C3, the profit per trip is $1400, the fuel cost per trip is $300, and the time per trip is 7 hours.\nFor C4, the profit per trip is $1600, the fuel cost per trip is $350, and the time per trip is 8 hours.\nFor C5, the profit per trip is $1800, the fuel cost per trip is $400, and the time per trip is 9 hours.\nThe company wants to maximize the profit efficiency (profit per hour of operation).\n// Profit_C1 = 1000 * C1 - 200 * C1\n// Profit_C2 = 1200 * C2 - 250 * C2\n// Profit_C3 = 1400 * C3 - 300 * C3\n// Profit_C4 = 1600 * C4 - 350 * C4\n// Profit_C5 = 1800 * C5 - 400 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5)\n\n## Generate Constraint-1:\nThe company has a total operational time of 500 hours.\n// 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $20000 for fuel costs.\n// 200 * C1 + 250 * C2 + 300 * C3 + 350 * C4 + 400 * C5 <= 20000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trips across all types of cargo.\n// C1 + C2 + C3 + C4 + C5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo.\nFor C1, the profit per trip is $1000, the fuel cost per trip is $200, and the time per trip is 5 hours.\nFor C2, the profit per trip is $1200, the fuel cost per trip is $250, and the time per trip is 6 hours.\nFor C3, the profit per trip is $1400, the fuel cost per trip is $300, and the time per trip is 7 hours.\nFor C4, the profit per trip is $1600, the fuel cost per trip is $350, and the time per trip is 8 hours.\nFor C5, the profit per trip is $1800, the fuel cost per trip is $400, and the time per trip is 9 hours.\nThe company has a total operational time of 500 hours and a budget of $20000 for fuel costs. The company has a limit of 100 trips across all types of cargo.\nPlease help the company to maximize the profit efficiency (profit per hour of operation).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # trips for C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # trips for C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # trips for C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # trips for C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # trips for C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 - 200) * C1\nProfit_C2 = (1200 - 250) * C2\nProfit_C3 = (1400 - 300) * C3\nProfit_C4 = (1600 - 350) * C4\nProfit_C5 = (1800 - 400) * C5\nOperationTime = 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / OperationTime\n## convert the division to multiplication\nmodel.addCons(obj * OperationTime == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total operational time of 500 hours.\nmodel.addCons(5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500)\n## The company has a budget of $20000 for fuel costs.\nmodel.addCons(200 * C1 + 250 * C2 + 300 * C3 + 350 * C4 + 400 * C5 <= 20000)\n## The company has a limit of 100 trips across all types of cargo.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips for C1: \", model.getVal(C1))\n    print(\"Trips for C2: \", model.getVal(C2))\n    print(\"Trips for C3: \", model.getVal(C3))\n    print(\"Trips for C4: \", model.getVal(C4))\n    print(\"Trips for C5: \", model.getVal(C5))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck.\n// {\"speed of each truck\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"number of trips per truck\": \"Trips\", \"range\": \"Trips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost per trip\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2. The maintenance cost per trip also depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips.\n// Total operational cost per truck: Cost = FuelRate * Trips * Speed + MaintenanceCost * Trips\n// So, the objective function is: Minimize \u03a3(Cost) for all trucks\n\n## Generate Constraint-1:\nThe total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\n// \u03a3(Investment) <= 100,000\n\n## Generate Constraint-2:\nThe maximum allowable speed for any truck is 60 mph.\n// Speed <= 60\n\n## Generate Constraint-3:\nEach truck must make at least 10 trips per month.\n// Trips >= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck. The fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2, and the maintenance cost per trip depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips. The total investment in fuel-efficient technologies across all trucks must not exceed $100,000. The maximum allowable speed for any truck is 60 mph. Each truck must make at least 10 trips per month. Please help the company to minimize the total monthly operational cost for all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)  # speed of each truck\nTrips = model.addVar(vtype=\"INTEGER\", name=\"Trips\", lb=10)  # number of trips per truck\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0)  # investment in fuel-efficient technologies\n\n# Define objective function\nFuelRate = 0.005 * Speed**2  # fuel consumption rate per trip\nMaintenanceCost = 0.001 * Speed**3  # maintenance cost per trip\nCost = FuelRate * Trips * Speed + MaintenanceCost * Trips  # total operational cost per truck\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)  # the objective function is: Minimize \u03a3(Cost) for all trucks\n\n# Add constraints\n# The total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\nmodel.addCons(Investment <= 100000)\n# The maximum allowable speed for any truck is 60 mph.\nmodel.addCons(Speed <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trips per truck: \", model.getVal(Trips))\n    print(\"Investment in fuel-efficient technologies: \", model.getVal(Investment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3\n\n## Generate Constraint-2:\nThe company has a total fleet size of 50 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $3000.\n// 1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000\n\n## Generate Constraint-4:\nDue to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 15 trucks to Route2.\n// Trucks1 >= 10; Trucks2 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The cost of fuel per liter is $1.5. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n\n| Route | Distance | Fuel Efficiency |\n|-------|----------|-----------------|\n| 1     | 500 km   | 10 km/liter     |\n| 2     | 600 km   | 12 km/liter     |\n| 3     | 400 km   | 8 km/liter      |\n\nEach route has a specific distance that must be covered. Each truck must have enough fuel to cover the entire distance of its route. The company has a total fleet size of 50 trucks. The total fuel budget for the company is $3000. Due to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 15 trucks to Route2.\n\nPlease help the company to minimize the total fuel cost while meeting all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)    # fuel allocation for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)    # fuel allocation for Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)    # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n# The company has a total fleet size of 50 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n# The total fuel budget for the company is $3000.\nmodel.addCons(1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints.\n// {\"production quantity for ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company wants to maximize the total profit.\n// Profit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity = (50 - (20 + 0.05 * (ProductA_Quantity)^2)) * ProductA_Quantity\n// Profit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity = (70 - (30 + 0.03 * (ProductB_Quantity)^2)) * ProductB_Quantity\n// Profit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity = (60 - (25 + 0.04 * (ProductC_Quantity)^2)) * ProductC_Quantity\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductB_Quantity <= 2 * ProductA_Quantity",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints. The profit per unit for each product and their respective production cost functions are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| ProductA | $50             | 20 + 0.05 * (ProductA_Quantity)^2 |\n| ProductB | $70             | 30 + 0.03 * (ProductB_Quantity)^2 |\n| ProductC | $60             | 25 + 0.04 * (ProductC_Quantity)^2 |\n\nThe company has a total production capacity of 1000 units per month. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA. The company wants to maximize the total profit.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\n\n# Define objective function\n## Calculate the profit for each product\nCost_ProductA = 20 + 0.05 * (ProductA_Quantity**2)\nCost_ProductB = 30 + 0.03 * (ProductB_Quantity**2)\nCost_ProductC = 25 + 0.04 * (ProductC_Quantity**2)\n\nProfit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity\nProfit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity\nProfit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000)\n## Raw material availability constraint\nmodel.addCons(ProductB_Quantity <= 2 * ProductA_Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Cargo carried by TruckA: Cargo_A = 10 * TruckA\n// Cargo carried by TruckB: Cargo_B = 15 * TruckB\n// Cargo carried by TruckC: Cargo_C = 20 * TruckC\n// Cargo carried by TruckD: Cargo_D = 25 * TruckD\n// Fuel consumed by all trucks: Fuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs per month.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50,000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 50 trucks in total.\n// TruckA + TruckB + TruckC + TruckD <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB\n\n## Generate Constraint-4:\nThe company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads.\n// TruckD >= 0.1 * (TruckA + TruckB + TruckC + TruckD)\n\n## Generate Constraint-5:\nThe company aims to have at least 20 TruckA for local deliveries.\n// TruckA >= 20",
        "question": "A logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints. Each TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed. The company has a total budget of $50,000 for fuel costs per month. The company can only operate a maximum of 50 trucks in total. Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB. The company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads. The company aims to have at least 20 TruckA for local deliveries. Please help the company to determine the optimal number of each type of truck to maximize the total cargo carried per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=20)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)   # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)   # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)   # number of TruckD\n\n# Define objective function\nCargo_A = 10 * TruckA\nCargo_B = 15 * TruckB\nCargo_C = 20 * TruckC\nCargo_D = 25 * TruckD\nFuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n# So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Fuel_Total == Cargo_A + Cargo_B + Cargo_C + Cargo_D)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel costs per month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50000)\n# The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 50)\n# Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nmodel.addCons(TruckC <= TruckA + TruckB)\n# The company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads.\nmodel.addCons(TruckD >= 0.1 * (TruckA + TruckB + TruckC + TruckD))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"daily operating cost for small trucks\": \"SmallCost\", \"range\": \"SmallCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for medium trucks\": \"MediumCost\", \"range\": \"MediumCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for large trucks\": \"LargeCost\", \"range\": \"LargeCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units.\n// TotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\n// 1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 per day for operating costs.\n// SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units. The company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The company has a budget of $5000 per day for operating costs.\nPlease help the company determine the optimal number of each type of truck and their respective daily operating costs to meet the daily demand while staying within the budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nSmallCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallCost\", lb=0)  # daily operating cost for small trucks\nMediumCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumCost\", lb=0)  # daily operating cost for medium trucks\nLargeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeCost\", lb=0)  # daily operating cost for large trucks\n\n# Define objective function\nTotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000)  # total volume capacity constraint\nmodel.addCons(SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000)  # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Daily Operating Cost for Small Trucks: \", model.getVal(SmallCost))\n    print(\"Daily Operating Cost for Medium Trucks: \", model.getVal(MediumCost))\n    print(\"Daily Operating Cost for Large Trucks: \", model.getVal(LargeCost))\n    print(\"Total Daily Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n// Profit_ProductA = 50 * ProductAQty\n// Profit_ProductB = 70 * ProductBQty\n// Profit_ProductC = 60 * ProductCQty\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\n// (50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit. The profit per unit and the cost of operating an additional shift are given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| ProductA | $50            |\n| ProductB | $70            |\n| ProductC | $60            |\n\nThe cost of operating an additional shift is $1000.\n\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts. The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\n\nPlease help the company to maximize the total profit from product sales minus the cost of additional shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProductAQty\nProfit_ProductB = 70 * ProductBQty\nProfit_ProductC = 60 * ProductCQty\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\nmodel.addCons((50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters.\n// 5 * S + 10 * W <= 1000\n\n## Generate Constraint-3:\nThe company must ensure that at least 50 solar panels and 20 wind turbines are installed.\n// S >= 50\n// W >= 20",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production. The energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n\n| Component          | Energy Output | Area Required |\n|--------------------|---------------|---------------|\n| Solar Panels (S)   | 100 kWh/panel | 5 sq. meters  |\n| Wind Turbines (W)  | 200 kWh/turbine | 10 sq. meters |\n\nThe company has a budget of $500,000 for investments in energy storage systems. The total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters. The company must ensure that at least 50 solar panels and 20 wind turbines are installed.\n\nPlease help the company to maximize the total energy output stored efficiently.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20)  # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # investment in energy storage systems\n\n# Define objective function\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n# So, the objective function is: Maximize (Energy_output * Storage_efficiency)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output * Storage_efficiency)\n\n# Add constraints\n# The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n# The total area available for installation is limited to 1000 square meters.\nmodel.addCons(5 * S + 10 * W <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000\n\n## Generate Constraint-3:\nThe company has a distribution capacity of 100 units in terms of the number of units it can distribute.\n// P1 + P2 + P3 <= 100",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit and the required storage space for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| P1      | $30             | 2 square meters       |\n| P2      | $40             | 3 square meters       |\n| P3      | $50             | 4 square meters       |\n\nThe company has a limited storage space of 200 square meters. The company has a budget of $3000 for purchasing the products. The company has a distribution capacity of 100 units in terms of the number of units it can distribute. \nPlease help the company to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n## The company has a distribution capacity of 100 units in terms of the number of units it can distribute.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption.\n// {\"number of trips to D1\": \"TripsD1\", \"range\": \"TripsD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D2\": \"TripsD2\", \"range\": \"TripsD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D3\": \"TripsD3\", \"range\": \"TripsD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D4\": \"TripsD4\", \"range\": \"TripsD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D5\": \"TripsD5\", \"range\": \"TripsD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for D1\": \"FuelBudgetD1\", \"range\": \"FuelBudgetD1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D2\": \"FuelBudgetD2\", \"range\": \"FuelBudgetD2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D3\": \"FuelBudgetD3\", \"range\": \"FuelBudgetD3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D4\": \"FuelBudgetD4\", \"range\": \"FuelBudgetD4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D5\": \"FuelBudgetD5\", \"range\": \"FuelBudgetD5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumptionD1 = (TripsD1 * FuelBudgetD1^0.7)\n// FuelConsumptionD2 = (TripsD2 * FuelBudgetD2^0.7)\n// FuelConsumptionD3 = (TripsD3 * FuelBudgetD3^0.7)\n// FuelConsumptionD4 = (TripsD4 * FuelBudgetD4^0.7)\n// FuelConsumptionD5 = (TripsD5 * FuelBudgetD5^0.7)\n// So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel across all routes.\n// FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all destinations must not exceed 500.\n// TripsD1 + TripsD2 + TripsD3 + TripsD4 + TripsD5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption. The fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company has a total budget of $100,000 for fuel across all routes. The total number of trips across all destinations must not exceed 500. Please help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsD1 = model.addVar(vtype=\"INTEGER\", name=\"TripsD1\", lb=0)\nTripsD2 = model.addVar(vtype=\"INTEGER\", name=\"TripsD2\", lb=0)\nTripsD3 = model.addVar(vtype=\"INTEGER\", name=\"TripsD3\", lb=0)\nTripsD4 = model.addVar(vtype=\"INTEGER\", name=\"TripsD4\", lb=0)\nTripsD5 = model.addVar(vtype=\"INTEGER\", name=\"TripsD5\", lb=0)\nFuelBudgetD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD1\", lb=0)\nFuelBudgetD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD2\", lb=0)\nFuelBudgetD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD3\", lb=0)\nFuelBudgetD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD4\", lb=0)\nFuelBudgetD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD5\", lb=0)\n\n# Define objective function\nFuelConsumptionD1 = TripsD1 * FuelBudgetD1**0.7\nFuelConsumptionD2 = TripsD2 * FuelBudgetD2**0.7\nFuelConsumptionD3 = TripsD3 * FuelBudgetD3**0.7\nFuelConsumptionD4 = TripsD4 * FuelBudgetD4**0.7\nFuelConsumptionD5 = TripsD5 * FuelBudgetD5**0.7\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n# Add constraints\nmodel.addCons(FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000)\nmodel.addCons(TripsD1 + TripsD2 + TripsD3 + TripsD4 + TripsD5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to D1: \", model.getVal(TripsD1))\n    print(\"Number of Trips to D2: \", model.getVal(TripsD2))\n    print(\"Number of Trips to D3: \", model.getVal(TripsD3))\n    print(\"Number of Trips to D4: \", model.getVal(TripsD4))\n    print(\"Number of Trips to D5: \", model.getVal(TripsD5))\n    print(\"Fuel Budget for D1: \", model.getVal(FuelBudgetD1))\n    print(\"Fuel Budget for D2: \", model.getVal(FuelBudgetD2))\n    print(\"Fuel Budget for D3: \", model.getVal(FuelBudgetD3))\n    print(\"Fuel Budget for D4: \", model.getVal(FuelBudgetD4))\n    print(\"Fuel Budget for D5: \", model.getVal(FuelBudgetD5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 635,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000\n\n## Generate Constraint-2:\nThe total production hours available in the Testing department is 800 hours.\n// TestingHours <= 800\n\n## Generate Constraint-3:\nThe total production hours available in the Packaging department is 600 hours.\n// PackagingHours <= 600\n\n## Generate Constraint-4:\nThe company has a constraint that the number of units of DeviceA produced must be at least twice the number of units of DeviceB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production. The total production hours available in the Assembly department is 1000 hours, in the Testing department is 800 hours, and in the Packaging department is 600 hours. Additionally, the company has a constraint that the number of units of DeviceA produced must be at least twice the number of units of DeviceB. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0)  # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0)  # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0)  # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(AssemblyHours <= 1000)  # Total production hours available in the Assembly department\nmodel.addCons(TestingHours <= 800)    # Total production hours available in the Testing department\nmodel.addCons(PackagingHours <= 600)  # Total production hours available in the Packaging department\nmodel.addCons(UnitsA >= 2 * UnitsB)    # UnitsA must be at least twice the number of UnitsB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n// Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n// Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 machines available.\n// MachinesA + MachinesB + MachinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in technology upgrades cannot exceed $50,000.\n// TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n// QuantityA >= 500; QuantityB >= 600\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB.\n// MachinesA >= 10; MachinesB >= 15\n\n## Generate Constraint-5:\nThe production quantity of each product cannot exceed the number of machines dedicated to that product times 200.\n// QuantityA <= 200 * MachinesA; QuantityB <= 200 * MachinesB; QuantityC <= 200 * MachinesC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 40 machines available. The total investment in technology upgrades cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units. The company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB. The production quantity of each product cannot exceed the number of machines dedicated to that product times 200.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=600)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=10)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=15)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0)  # technology upgrade for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # technology upgrade for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0)  # technology upgrade for ProductC\n\n# Define objective function\nProfitA = 50 * (100 + 0.05 * TechUpgradeA) * MachinesA  # Total profit for ProductA\nProfitB = 60 * (120 + 0.05 * TechUpgradeB) * MachinesB  # Total profit for ProductB\nProfitC = 70 * (150 + 0.05 * TechUpgradeC) * MachinesC  # Total profit for ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)  # Maximize (ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 40)  # Total of 40 machines available\nmodel.addCons(TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000)  # Total investment in technology upgrades cannot exceed $50,000\nmodel.addCons(QuantityA <= 200 * MachinesA)  # QuantityA <= 200 * MachinesA\nmodel.addCons(QuantityB <= 200 * MachinesB)  # QuantityB <= 200 * MachinesB\nmodel.addCons(QuantityC <= 200 * MachinesC)  # QuantityC <= 200 * MachinesC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Technology Upgrade for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Technology Upgrade for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Technology Upgrade for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes.\n// Cost per hour for route A: Cost_A = 100 / 5 * A\n// Cost per hour for route B: Cost_B = 120 / 6 * B\n// Cost per hour for route C: Cost_C = 150 / 7 * C\n// Cost per hour for route D: Cost_D = 180 / 8 * D\n// Cost per hour for route E: Cost_E = 200 / 9 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operational costs.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-4:\nThe total number of trucks on routes A and B combined must not exceed the total number of trucks on routes C, D, and E combined.\n// A + B <= C + D + E",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and delivery times for each route are given in the following Table.\n\n| Route | Operational Cost per Truck | Delivery Time |\n|-------|----------------------------|---------------|\n| A     | $100                       | 5 hours       |\n| B     | $120                       | 6 hours       |\n| C     | $150                       | 7 hours       |\n| D     | $180                       | 8 hours       |\n| E     | $200                       | 9 hours       |\n\nThe company has a total budget of $10,000 for operational costs. The company has a maximum of 50 trucks available. Each route must have at least 2 trucks. The total number of trucks on routes A and B combined must not exceed the total number of trucks on routes C, D, and E combined. \n\nPlease help the company to minimize the total cost per hour of operation across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 / 5) * A\nCost_B = (120 / 6) * B\nCost_C = (150 / 7) * C\nCost_D = (180 / 8) * D\nCost_E = (200 / 9) * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 for operational costs.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000)\n## The company has a maximum of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n## The total number of trucks on routes A and B combined must not exceed the total number of trucks on routes C, D, and E combined.\nmodel.addCons(A + B <= C + D + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck per trip is $1000, the fuel cost per trip is $200, and the maintenance cost per truck per year is $1000. \nFor T2, the revenue per truck per trip is $1200, the fuel cost per trip is $250, and the maintenance cost per truck per year is $1200. \nFor T3, the revenue per truck per trip is $1400, the fuel cost per trip is $300, and the maintenance cost per truck per year is $1400.\nFor T4, the revenue per truck per trip is $1600, the fuel cost per trip is $350, and the maintenance cost per truck per year is $1600.\nFor T5, the revenue per truck per trip is $1800, the fuel cost per trip is $400, and the maintenance cost per truck per year is $1800.\nThe company wants to maximize the net profit per truck per year.\n// Profit_T1 = (1000 - 200) * T1 - 1000 * T1\n// Profit_T2 = (1200 - 250) * T2 - 1200 * T2\n// Profit_T3 = (1400 - 300) * T3 - 1400 * T3\n// Profit_T4 = (1600 - 350) * T4 - 1600 * T4\n// Profit_T5 = (1800 - 400) * T5 - 1800 * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different revenue per trip, fuel cost per trip, and maintenance cost per year. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints. The details for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Truck per Trip | Fuel Cost per Trip | Maintenance Cost per Truck per Year |\n|------------|----------------------------|--------------------|-------------------------------------|\n| T1         | $1000                      | $200               | $1000                               |\n| T2         | $1200                      | $250               | $1200                               |\n| T3         | $1400                      | $300               | $1400                               |\n| T4         | $1600                      | $350               | $1600                               |\n| T5         | $1800                      | $400               | $1800                               |\n\nThe company wants to maximize the net profit per truck per year. The company has a total budget of $50,000 for purchasing new trucks. Please help the company determine the optimal number of each type of truck to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nProfit_T1 = (1000 - 200) * T1 - 1000 * T1\nProfit_T2 = (1200 - 250) * T2 - 1200 * T2\nProfit_T3 = (1400 - 300) * T3 - 1400 * T3\nProfit_T4 = (1600 - 350) * T4 - 1600 * T4\nProfit_T5 = (1800 - 400) * T5 - 1800 * T5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\n// TruckC <= TruckA + 10",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. Each type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck. The company has a total budget of $150,000 for operational costs for the month. The company has a limit of 100 trucks that can be deployed in total. Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10. Please help the company to maximize the total daily net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\nmodel.addCons(TruckC <= TruckA + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Daily Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component. The company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The total production of Component A must be at least 1000 units. Please help the company to minimize the total cost of operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0) # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0) # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0) # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0) # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0) # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0) # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0) # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0) # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0) # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0) # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0) # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0) # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 operates for Component A: \", model.getVal(H1A))\n    print(\"Hours Facility 1 operates for Component B: \", model.getVal(H1B))\n    print(\"Hours Facility 1 operates for Component C: \", model.getVal(H1C))\n    print(\"Hours Facility 2 operates for Component A: \", model.getVal(H2A))\n    print(\"Hours Facility 2 operates for Component B: \", model.getVal(H2B))\n    print(\"Hours Facility 2 operates for Component C: \", model.getVal(H2C))\n    print(\"Hours Facility 3 operates for Component A: \", model.getVal(H3A))\n    print(\"Hours Facility 3 operates for Component B: \", model.getVal(H3B))\n    print(\"Hours Facility 3 operates for Component C: \", model.getVal(H3C))\n    print(\"Hours Facility 4 operates for Component A: \", model.getVal(H4A))\n    print(\"Hours Facility 4 operates for Component B: \", model.getVal(H4B))\n    print(\"Hours Facility 4 operates for Component C: \", model.getVal(H4C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 633,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city and the speed at which the trucks travel. Additionally, the company is considering investing in hybrid technology for some of its trucks to reduce fuel consumption.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks (mph)\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of the trucks is a nonlinear function of their speed and the number of trips. The fuel efficiency improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for City1: Fuel1 = (Trips1 * (0.05 * Speed^2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1^2))\n// Fuel consumption for City2: Fuel2 = (Trips2 * (0.05 * Speed^2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2^2))\n// Fuel consumption for City3: Fuel3 = (Trips3 * (0.05 * Speed^2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3^2))\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in hybrid technology and operational costs.\n// Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city (City1: Trips1, City2: Trips2, City3: Trips3), the speed at which the trucks travel (Speed), and the investment in hybrid technology for each city (City1: Hybrid1, City2: Hybrid2, City3: Hybrid3). The fuel consumption of the trucks is a nonlinear function of their speed and the number of trips, and it improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips. The company has a total budget of $100,000 for investments in hybrid technology and operational costs. Please help the company determine the optimal number of trips, truck speed, and investment in hybrid technology to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to City3\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)  # speed of trucks (mph)\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for City1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for City2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for City3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel1 = Trips1 * (0.05 * Speed**2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1**2)\nFuel2 = Trips2 * (0.05 * Speed**2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2**2)\nFuel3 = Trips3 * (0.05 * Speed**2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3**2)\n## the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## The company has a total budget of $100,000 for investments in hybrid technology and operational costs.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Speed of Trucks: \", model.getVal(Speed))\n    print(\"Investment in Hybrid Technology for City1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for City2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for City3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine type should be operated in the production process.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for machine A\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine B\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine C\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine D\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the material cost is $2000, and the operational cost per hour is $100.\nFor machine B, the selling price is $7000, the material cost is $3000, and the operational cost per hour is $150.\nFor machine C, the selling price is $9000, the material cost is $4000, and the operational cost per hour is $200.\nFor machine D, the selling price is $11000, the material cost is $5000, and the operational cost per hour is $250.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost.\n// Profit of A: Profit_A = (5000 - 2000) * A - 100 * HoursA\n// Profit of B: Profit_B = (7000 - 3000) * B - 150 * HoursB\n// Profit of C: Profit_C = (9000 - 4000) * C - 200 * HoursC\n// Profit of D: Profit_D = (11000 - 5000) * D - 250 * HoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for material costs next month.\n// 2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150,000\n\n## Generate Constraint-2:\nThe total operational hours across all machines must not exceed 1000 hours.\n// HoursA + HoursB + HoursC + HoursD <= 1000\n\n## Generate Constraint-3:\nThe company wants to produce at least 5 units of each machine next month.\n// A >= 5; B >= 5; C >= 5; D >= 5\n\n## Generate Constraint-4:\nThe operational cost for machine D should not exceed the combined operational cost of machines A, B, and C.\n// 250 * HoursD <= 100 * HoursA + 150 * HoursB + 200 * HoursC",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine type should be operated in the production process. The selling price, material cost, and operational cost per hour for each machine are given in the following Table.\n\n| Machine | Selling Price | Material Cost | Operational Cost per Hour |\n|---------|---------------|---------------|---------------------------|\n| A       | $5000         | $2000         | $100                      |\n| B       | $7000         | $3000         | $150                      |\n| C       | $9000         | $4000         | $200                      |\n| D       | $11000        | $5000         | $250                      |\n\nThe company has a total budget of $150,000 for material costs next month. The total operational hours across all machines must not exceed 1000 hours. The company wants to produce at least 5 units of each machine next month. The operational cost for machine D should not exceed the combined operational cost of machines A, B, and C.\n\nPlease help the company to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of units of machine D\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # hours of operation for machine A\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # hours of operation for machine B\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # hours of operation for machine C\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # hours of operation for machine D\n\n# Define objective function\nProfit_A = (5000 - 2000) * A - 100 * HoursA\nProfit_B = (7000 - 3000) * B - 150 * HoursB\nProfit_C = (9000 - 4000) * C - 200 * HoursC\nProfit_D = (11000 - 5000) * D - 250 * HoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for material costs next month.\nmodel.addCons(2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150000)\n# The total operational hours across all machines must not exceed 1000 hours.\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 1000)\n# The company wants to produce at least 5 units of each machine next month.\nmodel.addCons(A >= 5)\nmodel.addCons(B >= 5)\nmodel.addCons(C >= 5)\nmodel.addCons(D >= 5)\n# The operational cost for machine D should not exceed the combined operational cost of machines A, B, and C.\nmodel.addCons(250 * HoursD <= 100 * HoursA + 150 * HoursB + 200 * HoursC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Hours of Operation for Machine A: \", model.getVal(HoursA))\n    print(\"Hours of Operation for Machine B: \", model.getVal(HoursB))\n    print(\"Hours of Operation for Machine C: \", model.getVal(HoursC))\n    print(\"Hours of Operation for Machine D: \", model.getVal(HoursD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost_A = 20A^2, Cost_B = 30B^2, Cost_C = 40C^2, Cost_D = 50D^2, Cost_E = 60E^2. The company aims to maximize its total profit.\n// Profit of A: Profit_A = 50A - 20A^2\n// Profit of B: Profit_B = 70B - 30B^2\n// Profit of C: Profit_C = 90C - 40C^2\n// Profit of D: Profit_D = 110D - 50D^2\n// Profit of E: Profit_E = 130E - 60E^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20A^2 + 30B^2 + 40C^2 + 50D^2 + 60E^2 <= 10000",
        "question": "A manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin. The profit per unit for each device and the production cost function, which increases nonlinearly with the quantity produced, are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|---------------------------|\n| A      | $50             | 20A^2                     |\n| B      | $70             | 30B^2                     |\n| C      | $90             | 40C^2                     |\n| D      | $110            | 50D^2                     |\n| E      | $130            | 60E^2                     |\n\nThe company has a budget of $10,000 for production costs. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nProfit_A = 50 * A - 20 * A**2\nProfit_B = 70 * B - 30 * B**2\nProfit_C = 90 * C - 40 * C**2\nProfit_D = 110 * D - 50 * D**2\nProfit_E = 130 * E - 60 * E**2\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * A**2 + 30 * B**2 + 40 * C**2 + 50 * D**2 + 60 * E**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck is affected by the fuel optimization, where the cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions. The company has a total budget of $100,000 for deploying trucks and optimizing fuel. The total number of trucks that can be deployed is limited to 500. Please help the company to determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\n# The total number of trucks that can be deployed is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe production capacity of DeviceA is limited to 2000 units.\n// UnitsA <= 2000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line. The profit per unit and the cost of production per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Hour | Production Rate Function |\n|--------|-----------------|---------------|--------------------------|\n| DeviceA | $50 | $30 | 0.5 * HoursA^2 |\n| DeviceB | $70 | $40 | 0.6 * HoursB^2 |\n| DeviceC | $90 | $50 | 0.7 * HoursC^2 |\n\nThe company has a total of 1000 hours available for all production lines. The production capacity of DeviceA is limited to 2000 units. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. Please help the company determine the optimal number of units and hours to allocate for each device to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # hours allocated to DeviceC production line\n\n# Define objective function\n## Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n## Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n## Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 50 * UnitsA - 30 * HoursA\nProfit_B = 70 * UnitsB - 40 * HoursB\nProfit_C = 90 * UnitsC - 50 * HoursC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available hours for all production lines is 1000 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n## The production capacity of DeviceA is limited to 2000 units.\nmodel.addCons(UnitsA <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"HeavyMachineryTrucks\", \"range\": \"HeavyMachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general merchandise\": \"GeneralMerchandiseTrucks\", \"range\": \"GeneralMerchandiseTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per truck for perishable goods is $50,000 per year, and the revenue generated per truck is $100,000 per year.\nFor heavy machinery, the operational cost per truck is $70,000 per year, and the revenue generated per truck is $150,000 per year.\nFor general merchandise, the operational cost per truck is $60,000 per year, and the revenue generated per truck is $120,000 per year.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\n// TotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials. The operational costs and revenues per truck for each type are given in the following Table.\n\n| Type of Cargo       | Operational Cost per Truck | Revenue per Truck |\n|---------------------|----------------------------|-------------------|\n| Perishable Goods    | $50,000                    | $100,000          |\n| Heavy Machinery     | $70,000                    | $150,000          |\n| General Merchandise | $60,000                    | $120,000          |\n\nThe company has a budget of $2,000,000 for purchasing trucks. The company wants to maximize the net profit, which is the total revenue minus the total operational costs. Please help the company determine the optimal number of trucks for each type of cargo to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0) # number of trucks for perishable goods\nHeavyMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks\", lb=0) # number of trucks for heavy machinery\nGeneralMerchandiseTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralMerchandiseTrucks\", lb=0) # number of trucks for general merchandise\n\n# Define objective function\nTotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\nTotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(HeavyMachineryTrucks))\n    print(\"Number of Trucks for General Merchandise: \", model.getVal(GeneralMerchandiseTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials.\n// {\"number of trucks for Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel.\nFor Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel.\nFor Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel.\nFor Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel.\nFor Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel.\nThe company wants to maximize the revenue-to-fuel ratio for the entire fleet.\n// Total Revenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total Fuel Consumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n// So, the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000\n\n## Generate Constraint-3:\nRoute A requires at least 10 trucks to be operational.\n// TruckA >= 10",
        "question": "A logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials. The details for each route are given in the following Table.\n\n| Route | Revenue per Truck | Fuel Consumption per Truck |\n|-------|-------------------|----------------------------|\n| A     | $1000             | 50 liters                   |\n| B     | $1200             | 60 liters                   |\n| C     | $1500             | 70 liters                   |\n| D     | $1800             | 80 liters                   |\n| E     | $2000             | 90 liters                   |\n\nThe company has a total of 100 trucks available. The company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters. Route A requires at least 10 trucks to be operational. \n\nPlease help the company to maximize the revenue-to-fuel ratio for the entire fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for Route E\n\n# Define objective function\nTotalRevenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nTotalFuelConsumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n# The company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters.\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TruckE))\n    print(\"Maximized Revenue-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide the number of trips each truck will make to each region. Additionally, the company is considering investing in fuel-efficient upgrades for each region's fleet, which will affect the fuel consumption and operational costs.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Region1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the number of trips and the level of fuel-efficient upgrades. The initial fuel cost per trip is $100 for all regions. With upgrades, the fuel cost decreases by $1 for every $10 invested in upgrades. The company aims to minimize the total fuel cost across all regions.\n// Fuel_Cost1 = (100 - 0.1 * Upgrade1) * Trips1\n// Fuel_Cost2 = (100 - 0.1 * Upgrade2) * Trips2\n// Fuel_Cost3 = (100 - 0.1 * Upgrade3) * Trips3\n// Fuel_Cost4 = (100 - 0.1 * Upgrade4) * Trips4\n// Fuel_Cost5 = (100 - 0.1 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for all operational costs and upgrades.\n// 100 * (Trips1 + Trips2 + Trips3 + Trips4 + Trips5) + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide the number of trips each truck will make to each region and consider investing in fuel-efficient upgrades for each region's fleet, which will affect the fuel consumption and operational costs. The initial fuel cost per trip is $100 for all regions, and with upgrades, the fuel cost decreases by $1 for every $10 invested in upgrades. The company aims to minimize the total fuel cost across all regions.\n\nThe company has a total budget of $100,000 for all operational costs and upgrades. Please help the company determine the optimal number of trips and the investment in fuel-efficient upgrades for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Region1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Region2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Region3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # investment in fuel-efficient upgrades for Region4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # investment in fuel-efficient upgrades for Region5\n\n# Define objective function\nFuel_Cost1 = (100 - 0.1 * Upgrade1) * Trips1\nFuel_Cost2 = (100 - 0.1 * Upgrade2) * Trips2\nFuel_Cost3 = (100 - 0.1 * Upgrade3) * Trips3\nFuel_Cost4 = (100 - 0.1 * Upgrade4) * Trips4\nFuel_Cost5 = (100 - 0.1 * Upgrade5) * Trips5\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n# Add constraints\n# The company has a total budget of $100,000 for all operational costs and upgrades.\nmodel.addCons(100 * (Trips1 + Trips2 + Trips3 + Trips4 + Trips5) + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips to Region5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrade1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrade2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrade3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrade4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrade5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit, considering the costs of raw materials, labor, and storage.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The storage cost per unit is $5 for all products. The company wants to maximize the total profit, which includes the revenue from selling the products minus the production and storage costs.\n// Total profit for ProductA: Profit_A = (50 - 30 - 5) * QuantityA\n// Total profit for ProductB: Profit_B = (70 - 40 - 5) * QuantityB\n// Total profit for ProductC: Profit_C = (90 - 50 - 5) * QuantityC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for raw materials and labor.\n// 30 * QuantityA + 40 * QuantityB + 50 * QuantityC <= 10,000\n\n## Generate Constraint-2:\nThe available storage space limits the total production to 200 units.\n// QuantityA + QuantityB + QuantityC <= 200\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit, considering the costs of raw materials, labor, and storage. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The storage cost per unit is $5 for all products. The company has a total budget of $10,000 for raw materials and labor. The available storage space limits the total production to 200 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. Please help the company to maximize the total profit, which includes the revenue from selling the products minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * QuantityA\nProfit_B = (70 - 40 - 5) * QuantityB\nProfit_C = (90 - 50 - 5) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(30 * QuantityA + 40 * QuantityB + 50 * QuantityC <= 10000) # total budget constraint\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 200) # storage space constraint\nmodel.addCons(QuantityA >= 2 * QuantityB) # market demand constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs, while considering the varying fuel efficiency of trucks in different regions and the demand for goods in each region.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks varies by region due to different terrains and weather conditions. In Region 1, each truck consumes fuel at a rate of 0.5 gallons per mile, which increases by 0.01 gallons per mile for every additional truck allocated. In Region 2, the rate is 0.6 gallons per mile, increasing by 0.015 gallons per mile per additional truck. In Region 3, the rate is 0.45 gallons per mile, increasing by 0.008 gallons per mile per additional truck. In Region 4, the rate is 0.55 gallons per mile, increasing by 0.012 gallons per mile per additional truck. In Region 5, the rate is 0.65 gallons per mile, increasing by 0.018 gallons per mile per additional truck. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption in Region 1: Fuel1 = 0.5 * Trucks1 + 0.01 * Trucks1^2\n// Fuel consumption in Region 2: Fuel2 = 0.6 * Trucks2 + 0.015 * Trucks2^2\n// Fuel consumption in Region 3: Fuel3 = 0.45 * Trucks3 + 0.008 * Trucks3^2\n// Fuel consumption in Region 4: Fuel4 = 0.55 * Trucks4 + 0.012 * Trucks4^2\n// Fuel consumption in Region 5: Fuel5 = 0.65 * Trucks5 + 0.018 * Trucks5^2\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nThe demand for goods in each region requires a minimum number of trucks. Region 1 requires at least 10 trucks, Region 2 requires at least 15 trucks, Region 3 requires at least 20 trucks, Region 4 requires at least 25 trucks, and Region 5 requires at least 30 trucks.\n// Trucks1 >= 10; Trucks2 >= 15; Trucks3 >= 20; Trucks4 >= 25; Trucks5 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs, while considering the varying fuel efficiency of trucks in different regions and the demand for goods in each region. The fuel efficiency of trucks varies by region due to different terrains and weather conditions, as shown in the following Table.\n\n| Region | Fuel Efficiency (gallons per mile) | Additional Fuel per Truck (gallons per mile) |\n|--------|------------------------------------|---------------------------------------------|\n| 1      | 0.5                                | 0.01                                       |\n| 2      | 0.6                                | 0.015                                      |\n| 3      | 0.45                               | 0.008                                      |\n| 4      | 0.55                               | 0.012                                      |\n| 5      | 0.65                               | 0.018                                      |\n\nThe total number of trucks available in the fleet is 100. The demand for goods in each region requires a minimum number of trucks. Region 1 requires at least 10 trucks, Region 2 requires at least 15 trucks, Region 3 requires at least 20 trucks, Region 4 requires at least 25 trucks, and Region 5 requires at least 30 trucks.\n\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The demand for goods in each region requires a minimum number of trucks.\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10) # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15) # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=20) # number of trucks in Region 3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=25) # number of trucks in Region 4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=30) # number of trucks in Region 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel consumption in Region 1: Fuel1 = 0.5 * Trucks1 + 0.01 * Trucks1^2\n## Fuel consumption in Region 2: Fuel2 = 0.6 * Trucks2 + 0.015 * Trucks2^2\n## Fuel consumption in Region 3: Fuel3 = 0.45 * Trucks3 + 0.008 * Trucks3^2\n## Fuel consumption in Region 4: Fuel4 = 0.55 * Trucks4 + 0.012 * Trucks4^2\n## Fuel consumption in Region 5: Fuel5 = 0.65 * Trucks5 + 0.018 * Trucks5^2\n## So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\nmodel.addCons(obj == 0.5 * Trucks1 + 0.01 * Trucks1**2 + 0.6 * Trucks2 + 0.015 * Trucks2**2 + 0.45 * Trucks3 + 0.008 * Trucks3**2 + 0.55 * Trucks4 + 0.012 * Trucks4**2 + 0.65 * Trucks5 + 0.018 * Trucks5**2)\n\n# Add constraints\n## The total number of trucks available in the fleet is 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(Trucks5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1543,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices using 5 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating hours of each machine.\n// {\"operating hours for machine 1\": \"M1\", \"range\": \"0 <= M1 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 2\": \"M2\", \"range\": \"0 <= M2 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 3\": \"M3\", \"range\": \"0 <= M3 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 4\": \"M4\", \"range\": \"0 <= M4 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 5\": \"M5\", \"range\": \"0 <= M5 <= 24\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different energy efficiency and production rate. Machine 1 consumes 10 units of energy per hour and produces 5 units of product. Machine 2 consumes 12 units of energy per hour and produces 6 units of product. Machine 3 consumes 15 units of energy per hour and produces 7 units of product. Machine 4 consumes 18 units of energy per hour and produces 8 units of product. Machine 5 consumes 20 units of energy per hour and produces 9 units of product. The plant aims to maximize the total production while keeping the total energy consumption below a certain threshold.\n// Total energy consumption: E = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\n// Total production: P = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\n// Objective function: Maximize P - E^2 (to introduce nonlinearity)\n\n## Generate Constraint-1:\nThe total energy consumption must not exceed 1000 units per day.\n// 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5 <= 1000\n\n## Generate Constraint-2:\nThe total operating hours for all machines must not exceed 80 hours per day.\n// M1 + M2 + M3 + M4 + M5 <= 80",
        "question": "A manufacturing plant produces electronic devices using 5 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating hours of each machine. The energy consumption and production rate for each machine are given in the following Table.\n\n| Machine | Energy Consumption (units/hour) | Production Rate (units/hour) |\n|---------|---------------------------------|------------------------------|\n| 1       | 10                              | 5                            |\n| 2       | 12                              | 6                            |\n| 3       | 15                              | 7                            |\n| 4       | 18                              | 8                            |\n| 5       | 20                              | 9                            |\n\nThe total energy consumption must not exceed 1000 units per day. The total operating hours for all machines must not exceed 80 hours per day. Please help the plant manager to maximize the total production while keeping the total energy consumption below the threshold, considering the objective function as the total production minus the square of the total energy consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0, ub=24) # operating hours for machine 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0, ub=24) # operating hours for machine 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0, ub=24) # operating hours for machine 3\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0, ub=24) # operating hours for machine 4\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0, ub=24) # operating hours for machine 5\n\n# Define objective function\n## Total energy consumption: E = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\n## Total production: P = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\n## Objective function: Maximize P - E^2 (to introduce nonlinearity)\nE = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\nP = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - E**2)\n\n# Add constraints\n## The total energy consumption must not exceed 1000 units per day.\nmodel.addCons(E <= 1000)\n## The total operating hours for all machines must not exceed 80 hours per day.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Machine 1: \", model.getVal(M1))\n    print(\"Operating hours for Machine 2: \", model.getVal(M2))\n    print(\"Operating hours for Machine 3: \", model.getVal(M3))\n    print(\"Operating hours for Machine 4: \", model.getVal(M4))\n    print(\"Operating hours for Machine 5: \", model.getVal(M5))\n    print(\"Maximized Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of machines to allocate to each component type to maximize efficiency.\n// {\"number of machines for component 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate for producing each component. The efficiency rates are as follows:\n- For component 1, each machine produces 10 units per hour.\n- For component 2, each machine produces 15 units per hour.\n- For component 3, each machine produces 20 units per hour.\n- For component 4, each machine produces 25 units per hour.\n- For component 5, each machine produces 30 units per hour.\nThe company aims to maximize the total production rate of all components.\n// The total production rate for component 1: P1 = 10 * M1\n// The total production rate for component 2: P2 = 15 * M2\n// The total production rate for component 3: P3 = 20 * M3\n// The total production rate for component 4: P4 = 25 * M4\n// The total production rate for component 5: P5 = 30 * M5\n// So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available.\n// M1 + M2 + M3 + M4 + M5 <= 50\n\n## Generate Constraint-2:\nEach component type has a maximum capacity for machines:\n- Component 1 can handle up to 10 machines.\n- Component 2 can handle up to 12 machines.\n- Component 3 can handle up to 15 machines.\n- Component 4 can handle up to 18 machines.\n- Component 5 can handle up to 20 machines.\n// M1 <= 10; M2 <= 12; M3 <= 15; M4 <= 18; M5 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of component 1, 750 units of component 2, 1000 units of component 3, 1250 units of component 4, and 1500 units of component 5 per day.\n// 10 * M1 >= 500\n// 15 * M2 >= 750\n// 20 * M3 >= 1000\n// 25 * M4 >= 1250\n// 30 * M5 >= 1500",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of machines to allocate to each component type to maximize efficiency. The efficiency rate of each machine for producing each component is given in the following Table.\n\n| Component | Efficiency Rate (units per hour) |\n|-----------|----------------------------------|\n| 1         | 10                               |\n| 2         | 15                               |\n| 3         | 20                               |\n| 4         | 25                               |\n| 5         | 30                               |\n\nThe company has a total of 50 machines available. Each component type has a maximum capacity for machines as follows:\n- Component 1 can handle up to 10 machines.\n- Component 2 can handle up to 12 machines.\n- Component 3 can handle up to 15 machines.\n- Component 4 can handle up to 18 machines.\n- Component 5 can handle up to 20 machines.\n\nAdditionally, the company must produce at least 500 units of component 1, 750 units of component 2, 1000 units of component 3, 1250 units of component 4, and 1500 units of component 5 per day.\n\nPlease help the company to maximize the total production rate of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of machines for component 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of machines for component 5\n\n# Define objective function\nP1 = 10 * M1 # total production rate for component 1\nP2 = 15 * M2 # total production rate for component 2\nP3 = 20 * M3 # total production rate for component 3\nP4 = 25 * M4 # total production rate for component 4\nP5 = 30 * M5 # total production rate for component 5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 50) # total of 50 machines available\nmodel.addCons(M1 <= 10) # component 1 can handle up to 10 machines\nmodel.addCons(M2 <= 12) # component 2 can handle up to 12 machines\nmodel.addCons(M3 <= 15) # component 3 can handle up to 15 machines\nmodel.addCons(M4 <= 18) # component 4 can handle up to 18 machines\nmodel.addCons(M5 <= 20) # component 5 can handle up to 20 machines\nmodel.addCons(10 * M1 >= 500) # at least 500 units of component 1\nmodel.addCons(15 * M2 >= 750) # at least 750 units of component 2\nmodel.addCons(20 * M3 >= 1000) # at least 1000 units of component 3\nmodel.addCons(25 * M4 >= 1250) # at least 1250 units of component 4\nmodel.addCons(30 * M5 >= 1500) # at least 1500 units of component 5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component 1: \", model.getVal(M1))\n    print(\"Number of Machines for Component 2: \", model.getVal(M2))\n    print(\"Number of Machines for Component 3: \", model.getVal(M3))\n    print(\"Number of Machines for Component 4: \", model.getVal(M4))\n    print(\"Number of Machines for Component 5: \", model.getVal(M5))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. Additionally, the company is considering investing in hybrid technology for some vehicles to reduce fuel consumption, which varies based on the type of vehicle and the level of hybridization.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Trucks\": \"HybridTruck\", \"range\": \"HybridTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Vans\": \"HybridVan\", \"range\": \"HybridVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Bikes\": \"HybridBike\", \"range\": \"HybridBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter.\n// FuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\n// FuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\n// FuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\n// TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and operational constraints.\n// TruckCount + VanCount + BikeCount <= 100\n\n## Generate Constraint-3:\nThe company must maintain at least 10 Trucks and 20 Vans for critical delivery services.\n// TruckCount >= 10; VanCount >= 20\n\n## Generate Constraint-4:\nThe investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\n// HybridTruck <= 0.5 * TruckCount\n// HybridVan <= 0.5 * VanCount\n// HybridBike <= 0.5 * BikeCount",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. Additionally, the company is considering investing in hybrid technology for some vehicles to reduce fuel consumption, which varies based on the type of vehicle and the level of hybridization. The fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter.\n\n| Vehicle Type | Fuel Consumption (liters/km) | Hybrid Tech Reduction (liters/km per $1000) |\n|--------------|-------------------------------|-------------------------------------------|\n| Trucks       | 0.5                           | 0.1                                       |\n| Vans         | 0.3                           | 0.08                                      |\n| Bikes        | 0.1                           | 0.01                                      |\n\nThe company has a budget of $100,000 for vehicle purchases and hybrid technology investments. The total number of vehicles cannot exceed 100 due to parking and operational constraints. The company must maintain at least 10 Trucks and 20 Vans for critical delivery services. The investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\n\nPlease help the company to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=10)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=20)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nHybridTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridTruck\", lb=0)  # investment in hybrid technology for Trucks\nHybridVan = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridVan\", lb=0)  # investment in hybrid technology for Vans\nHybridBike = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridBike\", lb=0)  # investment in hybrid technology for Bikes\n\n# Define objective function\nDailyDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DailyDistance\", lb=0)  # daily distance for each vehicle\nFuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\nFuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\nFuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n# So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n# Add constraints\n# The company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\nmodel.addCons(TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000)\n# The total number of vehicles cannot exceed 100 due to parking and operational constraints.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 100)\n# The company must maintain at least 10 Trucks and 20 Vans for critical delivery services.\nmodel.addCons(TruckCount >= 10)\nmodel.addCons(VanCount >= 20)\n# The investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\nmodel.addCons(HybridTruck <= 0.5 * TruckCount)\nmodel.addCons(HybridVan <= 0.5 * VanCount)\nmodel.addCons(HybridBike <= 0.5 * BikeCount)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Hybrid Technology for Trucks: \", model.getVal(HybridTruck))\n    print(\"Investment in Hybrid Technology for Vans: \", model.getVal(HybridVan))\n    print(\"Investment in Hybrid Technology for Bikes: \", model.getVal(HybridBike))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1972,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The production cost and selling price per unit vary for each product. Additionally, the company has constraints on the total production capacity and the availability of raw materials.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"raw material usage for product A\": \"RawMaterialA\", \"range\": \"RawMaterialA >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product B\": \"RawMaterialB\", \"range\": \"RawMaterialB >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product C\": \"RawMaterialC\", \"range\": \"RawMaterialC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $30, product B is $40, and product C is $35. The company aims to maximize its total profit.\n// Profit_A = ProductA * (50 - 30)\n// Profit_B = ProductB * (70 - 40)\n// Profit_C = ProductC * (60 - 35)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductA + ProductB + ProductC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $30, product B is $40, and product C is $35. The company has a total production capacity of 1000 units per day. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = ProductA * (50 - 30)\nProfit_B = ProductB * (70 - 40)\nProfit_C = ProductC * (60 - 35)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 464,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal number of workers to assign to each machine to maximize efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate based on the number of workers assigned. The efficiency is defined as the number of widgets produced per hour. \nOn machine 1, each worker contributes to an efficiency of 10 + 2 * M1 widgets per hour. \nOn machine 2, each worker contributes to an efficiency of 15 + 1.5 * M2 widgets per hour. \nOn machine 3, each worker contributes to an efficiency of 20 + 1 * M3 widgets per hour. \nOn machine 4, each worker contributes to an efficiency of 25 + 0.5 * M4 widgets per hour. \nOn machine 5, each worker contributes to an efficiency of 30 + 0.2 * M5 widgets per hour. \nThe objective is to maximize the total efficiency of all machines.\n// The objective function is: Maximize (10 + 2 * M1) * M1 + (15 + 1.5 * M2) * M2 + (20 + 1 * M3) * M3 + (25 + 0.5 * M4) * M4 + (30 + 0.2 * M5) * M5\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 60",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal number of workers to assign to each machine to maximize efficiency. Each machine has a different efficiency rate based on the number of workers assigned. On machine 1, each worker contributes to an efficiency of 10 + 2 * M1 widgets per hour. On machine 2, each worker contributes to an efficiency of 15 + 1.5 * M2 widgets per hour. On machine 3, each worker contributes to an efficiency of 20 + 1 * M3 widgets per hour. On machine 4, each worker contributes to an efficiency of 25 + 0.5 * M4 widgets per hour. On machine 5, each worker contributes to an efficiency of 30 + 0.2 * M5 widgets per hour. The objective is to maximize the total efficiency of all machines. There are a total of 60 workers available. Please help the manager determine the optimal number of workers to assign to each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_M1 = (10 + 2 * M1) * M1\nEfficiency_M2 = (15 + 1.5 * M2) * M2\nEfficiency_M3 = (20 + 1 * M3) * M3\nEfficiency_M4 = (25 + 0.5 * M4) * M4\nEfficiency_M5 = (30 + 0.2 * M5) * M5\n## the objective function is: Maximize (10 + 2 * M1) * M1 + (15 + 1.5 * M2) * M2 + (20 + 1 * M3) * M3 + (25 + 0.5 * M4) * M4 + (30 + 0.2 * M5) * M5\nmodel.addCons(obj == Efficiency_M1 + Efficiency_M2 + Efficiency_M3 + Efficiency_M4 + Efficiency_M5)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint that limits the total production to no more than 800 units.\n// ProdA + ProdB + ProdC <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to meet a contractual obligation.\n// ProdC >= 50",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50            | $30                      |\n| ProductB | $70            | $40                      |\n| ProductC | $60            | $35                      |\n\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a storage capacity constraint that limits the total production to no more than 800 units. The company must produce at least 50 units of ProductC to meet a contractual obligation.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=50) # production quantity for ProductC\n\n# Define objective function\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC <= 1000) # limited raw material supply\nmodel.addCons(ProdA >= 2 * ProdB) # market demand constraint for ProductA\nmodel.addCons(ProdA + ProdB + ProdC <= 800) # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency profile. Route 1 has a cost of $100 per truck and an efficiency of 50 units of goods per trip. Route 2 has a cost of $120 per truck and an efficiency of 60 units of goods per trip. Route 3 has a cost of $110 per truck and an efficiency of 55 units of goods per trip. Route 4 has a cost of $90 per truck and an efficiency of 45 units of goods per trip. Route 5 has a cost of $130 per truck and an efficiency of 70 units of goods per trip. The company wants to maximize the total units of goods transported while minimizing the total cost.\n// Total cost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\n// Total goods transported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n// The objective function is: Minimize (Total cost / Total goods transported)\n// Minimize (100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5) / (50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 15; T5 <= 10\n\n## Generate Constraint-3:\nThe company aims to transport at least 3000 units of goods.\n// 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5 >= 3000",
        "question": "A logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck and the efficiency (units of goods per trip) for each route are given in the following Table.\n\n| Route | Cost per Truck | Efficiency (Units per Trip) |\n|-------|----------------|-----------------------------|\n| 1     | $100           | 50                          |\n| 2     | $120           | 60                          |\n| 3     | $110           | 55                          |\n| 4     | $90            | 45                          |\n| 5     | $130           | 70                          |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks. The company aims to transport at least 3000 units of goods.\n\nPlease help the company to minimize the ratio of total cost to total goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\nTotalGoodsTransported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n## The objective function is: Minimize (Total cost / Total goods transported)\n## convert the division to multiplication\nmodel.addCons(obj * TotalGoodsTransported == TotalCost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 10)\n## The company aims to transport at least 3000 units of goods.\nmodel.addCons(50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Unit of Goods: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceEUnits\", \"range\": \"DeviceEUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the Selling Price per Unit is $200, the Production Cost per Unit is $120, and the Storage Cost per Unit is $10. \nFor DeviceB, the Selling Price per Unit is $250, the Production Cost per Unit is $150, and the Storage Cost per Unit is $15. \nFor DeviceC, the Selling Price per Unit is $300, the Production Cost per Unit is $180, and the Storage Cost per Unit is $20.\nFor DeviceD, the Selling Price per Unit is $220, the Production Cost per Unit is $130, and the Storage Cost per Unit is $12.\nFor DeviceE, the Selling Price per Unit is $280, the Production Cost per Unit is $160, and the Storage Cost per Unit is $18.\nThe company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (200 - 120 - 10) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (250 - 150 - 15) * DeviceBUnits\n// Total net profit for DeviceC: Profit_DeviceC = (300 - 180 - 20) * DeviceCUnits\n// Total net profit for DeviceD: Profit_DeviceD = (220 - 130 - 12) * DeviceDUnits\n// Total net profit for DeviceE: Profit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the quarter.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\n// DeviceAUnits >= 1.5 * DeviceBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $150,000 for production costs for the quarter.\n// 120 * DeviceAUnits + 150 * DeviceBUnits + 180 * DeviceCUnits + 130 * DeviceDUnits + 160 * DeviceEUnits <= 150,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit. The selling price per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Selling Price per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|------------------------|--------------------------|-----------------------|\n| DeviceA | $200                  | $120                     | $10                   |\n| DeviceB | $250                  | $150                     | $15                   |\n| DeviceC | $300                  | $180                     | $20                   |\n| DeviceD | $220                  | $130                     | $12                   |\n| DeviceE | $280                  | $160                     | $18                   |\n\nThe company has a total production capacity of 1000 units for the quarter. Due to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB. The company has a budget of $150,000 for production costs for the quarter. \n\nPlease help the company to maximize the total net profit, which is calculated as the selling price per unit minus the production cost per unit and the storage cost per unit, for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=0) # number of units of DeviceD\nDeviceEUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceEUnits\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_DeviceA = (200 - 120 - 10) * DeviceAUnits\nProfit_DeviceB = (250 - 150 - 15) * DeviceBUnits\nProfit_DeviceC = (300 - 180 - 20) * DeviceCUnits\nProfit_DeviceD = (220 - 130 - 12) * DeviceDUnits\nProfit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n## the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the quarter.\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000)\n## Due to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\nmodel.addCons(DeviceAUnits >= 1.5 * DeviceBUnits)\n## The company has a budget of $150,000 for production costs for the quarter.\nmodel.addCons(120 * DeviceAUnits + 150 * DeviceBUnits + 180 * DeviceCUnits + 130 * DeviceDUnits + 160 * DeviceEUnits <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Number of DeviceE Units: \", model.getVal(DeviceEUnits))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates five different factories that produce a certain product. The company needs to optimize the production levels of each factory to maximize profit while considering various constraints.\n// {\"production level of factory 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different cost function and revenue function. The profit function for each factory is the difference between the revenue and the cost.\nFor factory 1, the cost function is C1 = 0.05 * F1^2 + 10 * F1 + 500, and the revenue function is R1 = 20 * F1.\nFor factory 2, the cost function is C2 = 0.03 * F2^2 + 15 * F2 + 600, and the revenue function is R2 = 25 * F2.\nFor factory 3, the cost function is C3 = 0.07 * F3^2 + 20 * F3 + 700, and the revenue function is R3 = 30 * F3.\nFor factory 4, the cost function is C4 = 0.04 * F4^2 + 12 * F4 + 550, and the revenue function is R4 = 28 * F4.\nFor factory 5, the cost function is C5 = 0.06 * F5^2 + 18 * F5 + 650, and the revenue function is R5 = 32 * F5.\nThe objective is to maximize the total profit across all factories.\n// Profit = (R1 - C1) + (R2 - C2) + (R3 - C3) + (R4 - C4) + (R5 - C5)\n// So, the objective function is: Maximize Profit = (20 * F1 - (0.05 * F1^2 + 10 * F1 + 500)) + (25 * F2 - (0.03 * F2^2 + 15 * F2 + 600)) + (30 * F3 - (0.07 * F3^2 + 20 * F3 + 700)) + (28 * F4 - (0.04 * F4^2 + 12 * F4 + 550)) + (32 * F5 - (0.06 * F5^2 + 18 * F5 + 650))\n\n## Generate Constraint-1:\nThe total production capacity across all factories should not exceed 1000 units.\n// F1 + F2 + F3 + F4 + F5 <= 1000\n\n## Generate Constraint-2:\nThe production level of each factory should not exceed 250 units.\n// F1 <= 250; F2 <= 250; F3 <= 250; F4 <= 250; F5 <= 250\n\n## Generate Constraint-3:\nThe production level of factory 1 should be at least half of the production level of factory 2.\n// F1 >= 0.5 * F2\n\n## Generate Constraint-4:\nThe total cost of production across all factories should not exceed $50,000.\n// (0.05 * F1^2 + 10 * F1 + 500) + (0.03 * F2^2 + 15 * F2 + 600) + (0.07 * F3^2 + 20 * F3 + 700) + (0.04 * F4^2 + 12 * F4 + 550) + (0.06 * F5^2 + 18 * F5 + 650) <= 50000",
        "question": "A company operates five different factories that produce a certain product. The company needs to optimize the production levels of each factory to maximize profit while considering various constraints.\nFor factory 1, the cost function is C1 = 0.05 * F1^2 + 10 * F1 + 500, and the revenue function is R1 = 20 * F1.\nFor factory 2, the cost function is C2 = 0.03 * F2^2 + 15 * F2 + 600, and the revenue function is R2 = 25 * F2.\nFor factory 3, the cost function is C3 = 0.07 * F3^2 + 20 * F3 + 700, and the revenue function is R3 = 30 * F3.\nFor factory 4, the cost function is C4 = 0.04 * F4^2 + 12 * F4 + 550, and the revenue function is R4 = 28 * F4.\nFor factory 5, the cost function is C5 = 0.06 * F5^2 + 18 * F5 + 650, and the revenue function is R5 = 32 * F5.\nThe objective is to maximize the total profit across all factories.\nThe total production capacity across all factories should not exceed 1000 units. The production level of each factory should not exceed 250 units. The production level of factory 1 should be at least half of the production level of factory 2. The total cost of production across all factories should not exceed $50,000.\nPlease help the company to maximize the total profit across all factories.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # production level of factory 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # production level of factory 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # production level of factory 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # production level of factory 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # production level of factory 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate profit for each factory\nC1 = 0.05 * F1**2 + 10 * F1 + 500\nR1 = 20 * F1\nProfit_F1 = R1 - C1\n\nC2 = 0.03 * F2**2 + 15 * F2 + 600\nR2 = 25 * F2\nProfit_F2 = R2 - C2\n\nC3 = 0.07 * F3**2 + 20 * F3 + 700\nR3 = 30 * F3\nProfit_F3 = R3 - C3\n\nC4 = 0.04 * F4**2 + 12 * F4 + 550\nR4 = 28 * F4\nProfit_F4 = R4 - C4\n\nC5 = 0.06 * F5**2 + 18 * F5 + 650\nR5 = 32 * F5\nProfit_F5 = R5 - C5\n\n## the objective function is: Maximize Profit = Profit_F1 + Profit_F2 + Profit_F3 + Profit_F4 + Profit_F5\nmodel.addCons(obj == Profit_F1 + Profit_F2 + Profit_F3 + Profit_F4 + Profit_F5)\n\n# Add constraints\n## The total production capacity across all factories should not exceed 1000 units.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 1000)\n\n## The production level of each factory should not exceed 250 units.\nmodel.addCons(F1 <= 250)\nmodel.addCons(F2 <= 250)\nmodel.addCons(F3 <= 250)\nmodel.addCons(F4 <= 250)\nmodel.addCons(F5 <= 250)\n\n## The production level of factory 1 should be at least half of the production level of factory 2.\nmodel.addCons(F1 >= 0.5 * F2)\n\n## The total cost of production across all factories should not exceed $50,000.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of Factory 1: \", model.getVal(F1))\n    print(\"Production level of Factory 2: \", model.getVal(F2))\n    print(\"Production level of Factory 3: \", model.getVal(F3))\n    print(\"Production level of Factory 4: \", model.getVal(F4))\n    print(\"Production level of Factory 5: \", model.getVal(F5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes.\n// FuelCost_A = 1 * (RouteDistance / 10) * TruckA\n// FuelCost_B = 1 * (RouteDistance / 15) * TruckB\n// FuelCost_C = 1 * (RouteDistance / 20) * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 km.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for fuel costs.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption. The fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes. The total distance to be covered by all trucks is 5000 km. The company has a budget of $3000 for fuel costs. Please help the company to determine the optimal number of each type of truck to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nRouteDistance = model.addVar(name=\"RouteDistance\") # RouteDistance variable to handle division in constraints\nFuelCost_A = 1 * (RouteDistance / 10) * TruckA\nFuelCost_B = 1 * (RouteDistance / 15) * TruckB\nFuelCost_C = 1 * (RouteDistance / 20) * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\nmodel.addCons(obj == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 km.\nmodel.addCons(RouteDistance == 5000)\n## The company has a budget of $3000 for fuel costs.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 644,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and also how much to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Small Trucks\": \"FuelTechSmall\", \"range\": \"FuelTechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Medium Trucks\": \"FuelTechMedium\", \"range\": \"FuelTechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Large Trucks\": \"FuelTechLarge\", \"range\": \"FuelTechLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the fleet operations. The profit per Small Truck is $30,000, which increases by $1,000 for every $5,000 invested in fuel-efficient technologies. The profit per Medium Truck is $40,000, which increases by $1,200 for every $5,000 invested in fuel-efficient technologies. The profit per Large Truck is $50,000, which increases by $1,500 for every $5,000 invested in fuel-efficient technologies.\n// Profit from Small Trucks: ProfitSmall = (30000 + 0.2 * FuelTechSmall) * SmallTrucks\n// Profit from Medium Trucks: ProfitMedium = (40000 + 0.24 * FuelTechMedium) * MediumTrucks\n// Profit from Large Trucks: ProfitLarge = (50000 + 0.3 * FuelTechLarge) * LargeTrucks\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and investing in fuel-efficient technologies.\n// Cost of Small Trucks + Cost of Medium Trucks + Cost of Large Trucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000\n// Assuming the cost of a Small Truck is $50,000, a Medium Truck is $70,000, and a Large Truck is $100,000.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 100000 * LargeTrucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and also how much to invest in fuel-efficient technologies for each type of truck. The company aims to maximize its annual profit from the fleet operations. The profit per Small Truck is $30,000, which increases by $1,000 for every $5,000 invested in fuel-efficient technologies. The profit per Medium Truck is $40,000, which increases by $1,200 for every $5,000 invested in fuel-efficient technologies. The profit per Large Truck is $50,000, which increases by $1,500 for every $5,000 invested in fuel-efficient technologies. The company has a budget of $2,000,000 for purchasing new trucks and investing in fuel-efficient technologies. The total number of trucks cannot exceed 50. Please help the company to maximize its annual profit from the fleet operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small Trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium Trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large Trucks\nFuelTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechSmall\", lb=0)  # investment in fuel-efficient technologies for Small Trucks\nFuelTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechMedium\", lb=0)  # investment in fuel-efficient technologies for Medium Trucks\nFuelTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechLarge\", lb=0)  # investment in fuel-efficient technologies for Large Trucks\n\n# Define objective function\nProfitSmall = (30000 + 0.2 * FuelTechSmall) * SmallTrucks\nProfitMedium = (40000 + 0.24 * FuelTechMedium) * MediumTrucks\nProfitLarge = (50000 + 0.3 * FuelTechLarge) * LargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 100000 * LargeTrucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel-Efficient Technologies for Small Trucks: \", model.getVal(FuelTechSmall))\n    print(\"Investment in Fuel-Efficient Technologies for Medium Trucks: \", model.getVal(FuelTechMedium))\n    print(\"Investment in Fuel-Efficient Technologies for Large Trucks: \", model.getVal(FuelTechLarge))\n    print(\"Maximized Annual Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, the selling price per unit is $100, and the demand is modeled as a quadratic function: 100 - 0.1 * UnitsA^2. For ProductB, the production cost per unit is $70, the selling price per unit is $120, and the demand is modeled as a quadratic function: 150 - 0.2 * UnitsB^2. For ProductC, the production cost per unit is $60, the selling price per unit is $110, and the demand is modeled as a quadratic function: 120 - 0.15 * UnitsC^2. The company wants to maximize its total profit.\n// ProfitA = (100 - 50) * (100 - 0.1 * UnitsA^2) * UnitsA\n// ProfitB = (120 - 70) * (150 - 0.2 * UnitsB^2) * UnitsB\n// ProfitC = (110 - 60) * (120 - 0.15 * UnitsC^2) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. The production cost, selling price, and demand for each product vary as shown in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Demand Function |\n|---------|--------------------------|-------------------------|-----------------|\n| ProductA | $50                      | $100                    | 100 - 0.1 * UnitsA^2 |\n| ProductB | $70                      | $120                    | 150 - 0.2 * UnitsB^2 |\n| ProductC | $60                      | $110                    | 120 - 0.15 * UnitsC^2 |\n\nThe company has a total production capacity of 1000 units per month. Please help the company to maximize its total profit, considering the given production costs, selling prices, and demand functions for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate profits with quadratic demand functions\nProfitA = (100 - 50) * (100 - 0.1 * UnitsA**2) * UnitsA\nProfitB = (120 - 70) * (150 - 0.2 * UnitsB**2) * UnitsB\nProfitC = (110 - 60) * (120 - 0.15 * UnitsC**2) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Operating cost of A: CostA = 200 * TrucksA\n// Operating cost of B: CostB = 250 * TrucksB\n// Operating cost of C: CostC = 300 * TrucksC\n// Operating cost of D: CostD = 350 * TrucksD\n// Operating cost of E: CostE = 400 * TrucksE\n// Revenue of A: RevenueA = 500 * TrucksA\n// Revenue of B: RevenueB = 600 * TrucksB\n// Revenue of C: RevenueC = 700 * TrucksC\n// Revenue of D: RevenueD = 800 * TrucksD\n// Revenue of E: RevenueE = 900 * TrucksE\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 30 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of the total trucks are allocated to each route.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations. The cost of operating a truck and the revenue generated per truck on each route are given in the following Table.\n\n| Route | Operating Cost per Truck | Revenue per Truck |\n|-------|--------------------------|-------------------|\n| A     | $200                     | $500              |\n| B     | $250                     | $600              |\n| C     | $300                     | $700              |\n| D     | $350                     | $800              |\n| E     | $400                     | $900              |\n\nThe company has a total budget of $10,000 for operating costs. The company has a maximum of 30 trucks available for allocation. The company wants to ensure that at least 10% of the total trucks are allocated to each route. Please help the company to maximize its net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for route E\n\n# Define objective function\nCostA = 200 * TrucksA\nCostB = 250 * TrucksB\nCostC = 300 * TrucksC\nCostD = 350 * TrucksD\nCostE = 400 * TrucksE\nRevenueA = 500 * TrucksA\nRevenueB = 600 * TrucksB\nRevenueC = 700 * TrucksC\nRevenueD = 800 * TrucksD\nRevenueE = 900 * TrucksE\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n# Add constraints\n# The company has a total budget of $10,000 for operating costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000)\n# The company has a maximum of 30 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30)\n# The company wants to ensure that at least 10% of the total trucks are allocated to each route.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output per unit.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n// Total energy output from solar panels in Region1: EnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\n// Total energy output from solar panels in Region2: EnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\n// Total energy output from solar panels in Region3: EnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\n// Total energy output from wind turbines in Region1: EnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\n// Total energy output from wind turbines in Region2: EnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\n// Total energy output from wind turbines in Region3: EnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n// So, the objective function is: Maximize (EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n## Generate Constraint-1:\nThe total investment in R&D cannot exceed $100,000.\n// RnDInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $2,000,000 for the installation of all solar panels and wind turbines.\n// (SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000\n\n## Generate Constraint-3:\nDue to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region.\n// SolarPanels1 <= WindTurbines1; SolarPanels2 <= WindTurbines2; SolarPanels3 <= WindTurbines3\n\n## Generate Constraint-4:\nThe company must ensure that at least 50 solar panels and 30 wind turbines are installed in total across all regions.\n// SolarPanels1 + SolarPanels2 + SolarPanels3 >= 50; WindTurbines1 + WindTurbines2 + WindTurbines3 >= 30",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n\nThe total investment in R&D cannot exceed $100,000. The company has a budget of $2,000,000 for the installation of all solar panels and wind turbines. Due to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region. The company must ensure that at least 50 solar panels and 30 wind turbines are installed in total across all regions.\n\nPlease help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)\n\n# Define objective function\nEnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\nEnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\nEnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\nEnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\nEnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\nEnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n# Add constraints\nmodel.addCons(RnDInvestment <= 100000)\nmodel.addCons((SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000)\nmodel.addCons(SolarPanels1 <= WindTurbines1)\nmodel.addCons(SolarPanels2 <= WindTurbines2)\nmodel.addCons(SolarPanels3 <= WindTurbines3)\nmodel.addCons(SolarPanels1 + SolarPanels2 + SolarPanels3 >= 50)\nmodel.addCons(WindTurbines1 + WindTurbines2 + WindTurbines3 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"R&D Investment: \", model.getVal(RnDInvestment))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1259,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck varies by region due to different road conditions and distances. In Region A, each truck can deliver 100 packages per day with a fuel cost of $50 per day. In Region B, each truck can deliver 120 packages per day with a fuel cost of $60 per day. In Region C, each truck can deliver 150 packages per day with a fuel cost of $70 per day. In Region D, each truck can deliver 130 packages per day with a fuel cost of $65 per day. In Region E, each truck can deliver 110 packages per day with a fuel cost of $55 per day. The company wants to maximize the total daily delivery volume while minimizing the total daily fuel cost.\n// Total daily delivery volume: Volume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\n// Total daily fuel cost: Cost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n// So, the objective function is: Maximize (Volume - Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $3000 per day for fuel.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30\n\n## Generate Constraint-3:\nEach region must have at least 2 trucks.\n// TruckA >= 2; TruckB >= 2; TruckC >= 2; TruckD >= 2; TruckE >= 2",
        "question": "A logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency. The efficiency of each truck varies by region due to different road conditions and distances. The following table shows the delivery capacity and fuel cost per truck per day for each region.\n\n| Region | Delivery Capacity (packages/day) | Fuel Cost ($/day) |\n|--------|----------------------------------|-------------------|\n| A      | 100                              | 50                |\n| B      | 120                              | 60                |\n| C      | 150                              | 70                |\n| D      | 130                              | 65                |\n| E      | 110                              | 55                |\n\nThe company has a total budget of $3000 per day for fuel. The company has a total of 30 trucks available. Each region must have at least 2 trucks. Please help the company to maximize the total daily delivery volume while minimizing the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 2 trucks.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=2) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=2) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=2) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=2) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=2) # number of trucks in Region E\n\n# Define objective function\n## Total daily delivery volume: Volume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\n## Total daily fuel cost: Cost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n## So, the objective function is: Maximize (Volume - Cost)\nVolume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\nCost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Volume - Cost)\n\n# Add constraints\n## The company has a total budget of $3000 per day for fuel.\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000)\n## The company has a total of 30 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each device, which affects the sales rate.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for DeviceA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\n// Total profit for DeviceB: ProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\n// Total profit for DeviceC: ProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n// UnitsA >= 1000; UnitsB >= 1500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device, the level of automation to implement in the production process, and the marketing budget for each device. The level of automation affects the production cost per unit and the production rate, while the marketing budget affects the sales rate. The selling price per unit for each device is as follows:\n\n| Device | Selling Price |\n|--------|---------------|\n| DeviceA | $200 |\n| DeviceB | $220 |\n| DeviceC | $250 |\n\nThe production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing.\n\nThe company has a total production capacity of 10,000 units across all devices. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $100,000. Due to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1000) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1500) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for DeviceA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for DeviceB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for DeviceC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for DeviceA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for DeviceB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for DeviceC\n\n# Define objective function\nProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $100,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Automation Level for DeviceA: \", model.getVal(AutomationA))\n    print(\"Automation Level for DeviceB: \", model.getVal(AutomationB))\n    print(\"Automation Level for DeviceC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for DeviceA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for DeviceB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for DeviceC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The production cost and selling price per unit vary for each product. Additionally, the company has constraints on the total production capacity and the availability of raw materials.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"raw material usage for product A\": \"RawMaterialA\", \"range\": \"RawMaterialA >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product B\": \"RawMaterialB\", \"range\": \"RawMaterialB >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product C\": \"RawMaterialC\", \"range\": \"RawMaterialC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $30, product B is $40, and product C is $35. The company aims to maximize its total profit.\n// Profit_A = ProductA * (50 - 30)\n// Profit_B = ProductB * (70 - 40)\n// Profit_C = ProductC * (60 - 35)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 2500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The production cost and selling price per unit vary for each product. The following table provides the selling price and production cost per unit for each product.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| A       | $50           | $30             |\n| B       | $70           | $40             |\n| C       | $60           | $35             |\n\nThe company has a total production capacity of 1000 units per day. Additionally, the company has a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units.\n\nPlease help the company to maximize its total profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = ProductA * (50 - 30)\nProfit_B = ProductB * (70 - 40)\nProfit_C = ProductC * (60 - 35)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The company has a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 2500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints.\n// {\"production quantity for ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company wants to maximize the total profit.\n// Profit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity = (50 - (20 + 0.05 * (ProductA_Quantity)^2)) * ProductA_Quantity\n// Profit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity = (70 - (30 + 0.03 * (ProductB_Quantity)^2)) * ProductB_Quantity\n// Profit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity = (60 - (25 + 0.04 * (ProductC_Quantity)^2)) * ProductC_Quantity\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductB_Quantity <= 2 * ProductA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage constraint that limits the total inventory to 500 units.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 500\n\n## Generate Constraint-4:\nThe production of ProductC must be at least 10% of the total production.\n// ProductC_Quantity >= 0.1 * (ProductA_Quantity + ProductB_Quantity + ProductC_Quantity)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company has a total production capacity of 1000 units per month. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA. The company has a storage constraint that limits the total inventory to 500 units. The production of ProductC must be at least 10% of the total production.\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\n\n# Define objective function\nCost_ProductA = 20 + 0.05 * (ProductA_Quantity**2)\nCost_ProductB = 30 + 0.03 * (ProductB_Quantity**2)\nCost_ProductC = 25 + 0.04 * (ProductC_Quantity**2)\nProfit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity\nProfit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity\nProfit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000)\nmodel.addCons(ProductB_Quantity <= 2 * ProductA_Quantity)\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 500)\nmodel.addCons(ProductC_Quantity >= 0.1 * (ProductA_Quantity + ProductB_Quantity + ProductC_Quantity))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe total load capacity required is at least 1500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the trucks are T1 or T2 types.\n// T1 + T2 >= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-5:\nThe maximum number of T5 trucks should not exceed 30% of the total number of trucks.\n// T5 <= 0.3 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate, load capacity, and emission rate. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Load Capacity (tons) | Emission Rate (kg CO2/km) |\n|------------|-----------------------------------|----------------------|---------------------------|\n| T1         | 0.5                               | 10                   | 1.2                       |\n| T2         | 0.6                               | 15                   | 1.4                       |\n| T3         | 0.7                               | 20                   | 1.6                       |\n| T4         | 0.8                               | 25                   | 1.8                       |\n| T5         | 0.9                               | 30                   | 2.0                       |\n\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter. The company has a total of 100 trucks available. The total load capacity required is at least 1500 tons. The company wants to ensure that at least 20% of the trucks are T1 or T2 types. The maximum number of T5 trucks should not exceed 30% of the total number of trucks.\n\nPlease help the company to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total load capacity required is at least 1500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500)\n## The company wants to ensure that at least 20% of the trucks are T1 or T2 types.\nmodel.addCons(T1 + T2 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n## The maximum number of T5 trucks should not exceed 30% of the total number of trucks.\nmodel.addCons(T5 <= 0.3 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1547,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, and for product C is $200. The production cost per unit for product A is $50, for product B is $75, and for product C is $100. The company aims to maximize the total profit, which is the difference between the revenue and the cost.\n// Profit_A = (100 - 50) * A = 50 * A\n// Profit_B = (150 - 75) * B = 75 * B\n// Profit_C = (200 - 100) * C = 100 * C\n// So, the objective function is: Maximize (50 * A + 75 * B + 100 * C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for production costs.\n// 50 * A + 75 * B + 100 * C <= 5000\n\n## Generate Constraint-2:\nThe production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units.\n// A >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints. The profit per unit for product A is $100, for product B is $150, and for product C is $200. The production cost per unit for product A is $50, for product B is $75, and for product C is $100. The company has a total budget of $5000 for production costs. The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production. The market demand for product A is at least 50 units. Please help the company to maximize the total profit, which is the difference between the revenue and the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 75 * B\nProfit_C = 100 * C\n## the objective function is: Maximize (50 * A + 75 * B + 100 * C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $5000 for production costs.\nmodel.addCons(50 * A + 75 * B + 100 * C <= 5000)\n## The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region A, Region B, and Region C. They need to determine the number of solar panels and wind turbines to install in each region to maximize energy output while considering the cost and space constraints.\n// {\"number of solar panels in Region A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6. The company wants to maximize the total energy output from all regions.\n// Total energy output for Region A: E_A = 100 * (SolarA^0.7) + 150 * (WindA^0.6)\n// Total energy output for Region B: E_B = 100 * (SolarB^0.7) + 150 * (WindB^0.6)\n// Total energy output for Region C: E_C = 100 * (SolarC^0.7) + 150 * (WindC^0.6)\n// So, the objective function is: Maximize E_total = E_A + E_B + E_C\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for installation costs. The cost of installing a solar panel is $5,000, and a wind turbine is $10,000.\n// 5000 * (SolarA + SolarB + SolarC) + 10000 * (WindA + WindB + WindC) <= 1,000,000\n\n## Generate Constraint-2:\nEach region has a limited space for installation. Region A has space for 100 units, Region B for 150 units, and Region C for 200 units.\n// SolarA + WindA <= 100\n// SolarB + WindB <= 150\n// SolarC + WindC <= 200\n\n## Generate Constraint-3:\nThe company aims to have at least 20% of the total installations as wind turbines to ensure a diversified energy source.\n// (WindA + WindB + WindC) >= 0.2 * (SolarA + SolarB + SolarC + WindA + WindB + WindC)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region A, Region B, and Region C. They need to determine the number of solar panels and wind turbines to install in each region to maximize energy output while considering the cost and space constraints.\nThe energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6. The company wants to maximize the total energy output from all regions.\nThe company has a budget of $1,000,000 for installation costs. The cost of installing a solar panel is $5,000, and a wind turbine is $10,000. Each region has a limited space for installation. Region A has space for 100 units, Region B for 150 units, and Region C for 200 units. The company aims to have at least 20% of the total installations as wind turbines to ensure a diversified energy source.\nPlease help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in Region A\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in Region A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in Region B\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in Region B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in Region C\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in Region C\n\n# Define objective function\n## The energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6.\n## The company wants to maximize the total energy output from all regions.\nE_A = 100 * (SolarA**0.7) + 150 * (WindA**0.6)\nE_B = 100 * (SolarB**0.7) + 150 * (WindB**0.6)\nE_C = 100 * (SolarC**0.7) + 150 * (WindC**0.6)\nE_total = E_A + E_B + E_C\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## The company has a budget of $1,000,000 for installation costs.\nmodel.addCons(5000 * (SolarA + SolarB + SolarC) + 10000 * (WindA + WindB + WindC) <= 1000000)\n## Each region has a limited space for installation.\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 150)\nmodel.addCons(SolarC + WindC <= 200)\n## The company aims to have at least 20% of the total installations as wind turbines.\nmodel.addCons((WindA + WindB + WindC) >= 0.2 * (SolarA + SolarB + SolarC + WindA + WindB + WindC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindC))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Truck A has a fuel efficiency of 5 km/liter and a capacity of 10 tons. Truck B has a fuel efficiency of 7 km/liter and a capacity of 12 tons. Truck C has a fuel efficiency of 9 km/liter and a capacity of 15 tons. Truck D has a fuel efficiency of 11 km/liter and a capacity of 18 tons. Truck E has a fuel efficiency of 13 km/liter and a capacity of 20 tons. The company aims to minimize the total fuel consumption while ensuring all trucks are utilized to their full capacity. The objective function is to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies.\n// Fuel_Consumption_A = A / 5\n// Fuel_Consumption_B = B / 7\n// Fuel_Consumption_C = C / 9\n// Fuel_Consumption_D = D / 11\n// Fuel_Consumption_E = E / 13\n// So, the objective function is: Minimize Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D + Fuel_Consumption_E\n\n## Generate Constraint-1:\nThe total cargo capacity required for the upcoming month is 1000 tons.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km.\n// A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can deploy, which is 100 trucks.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Capacity (tons) |\n|------------|---------------------------|-----------------|\n| Truck A    | 5                         | 10              |\n| Truck B    | 7                         | 12              |\n| Truck C    | 9                         | 15              |\n| Truck D    | 11                        | 18              |\n| Truck E    | 13                        | 20              |\n\nThe total cargo capacity required for the upcoming month is 1000 tons. The company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km. The company also has a limit on the total number of trucks it can deploy, which is 100 trucks.\n\nPlease help the company to minimize the total fuel consumption while ensuring all trucks are utilized to their full capacity. The objective function is to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_A = A / 5\nFuel_Consumption_B = B / 7\nFuel_Consumption_C = C / 9\nFuel_Consumption_D = D / 11\nFuel_Consumption_E = E / 13\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption_A * 5 + Fuel_Consumption_B * 7 + Fuel_Consumption_C * 9 + Fuel_Consumption_D * 11 + Fuel_Consumption_E * 13)\n\n# Add constraints\n## The total cargo capacity required for the upcoming month is 1000 tons.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000)\n## The company has a budget constraint of $50,000 for purchasing fuel.\nmodel.addCons(A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000)\n## The company has a limit on the total number of trucks it can deploy, which is 100 trucks.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1472,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can handle is limited to 500 per day.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\nFor Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades. The total number of trips the company can handle is limited to 500 per day.\nPlease help the company to determine the optimal number of each type of truck to purchase, the number of trips each truck should make, and the level of fuel efficiency upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0)\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of product. The profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products.\n// Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n// Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n// Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours.\n// M1 + M2 + M3 + M4 <= 100\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 30 hours due to maintenance constraints.\n// M1 <= 30; M2 <= 30; M3 <= 30; M4 <= 30\n\n## Generate Constraint-3:\nThe production of product 1 must be at least 500 units.\n// (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2 >= 500\n\n## Generate Constraint-4:\nThe production of product 2 must be at least 600 units.\n// (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4 >= 600\n\n## Generate Constraint-5:\nThe production of product 3 must be at least 700 units.\n// (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4 >= 700",
        "question": "A manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency of each machine in producing each type of product varies, and the profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products. The profit functions for each product are as follows:\n\n| Product | Profit Function |\n|---------|-----------------|\n| 1       | P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2 |\n| 2       | P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4 |\n| 3       | P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4 |\n\nThe company has the following constraints:\n- The total operating hours for all machines must not exceed 100 hours.\n- Each machine can operate for a maximum of 30 hours due to maintenance constraints.\n- The production of product 1 must be at least 500 units.\n- The production of product 2 must be at least 600 units.\n- The production of product 3 must be at least 700 units.\n\nPlease help the company to maximize the total profit from all products by determining the optimal number of hours each machine should operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\n\n# Define objective function\n## Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n## Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n## Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\nP1 = (100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2\nP2 = (110 - 0.15 * M3**2) * M3 + (130 - 0.25 * M4**2) * M4\nP3 = (120 - 0.3 * M1**2) * M1 + (140 - 0.4 * M2**2) * M2 + (150 - 0.5 * M3**2) * M3 + (160 - 0.6 * M4**2) * M4\n## The objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total operating hours for all machines must not exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 + M4 <= 100)\n## Each machine can operate for a maximum of 30 hours due to maintenance constraints.\nmodel.addCons(M1 <= 30)\nmodel.addCons(M2 <= 30)\nmodel.addCons(M3 <= 30)\nmodel.addCons(M4 <= 30)\n## The production of product 1 must be at least 500 units.\nmodel.addCons((100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2 >= 500)\n## The production of product 2 must be at least 600 units.\nmodel.addCons((110 - 0.15 * M3**2) * M3 + (130 - 0.25 * M4**2) * M4 >= 600)\n## The production of product 3 must be at least 700 units.\nmodel.addCons((120 - 0.3 * M1**2) * M1 + (140 - 0.4 * M2**2) * M2 + (150 - 0.5 * M3**2) * M3 + (160 - 0.6 * M4**2) * M4 >= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1326,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is limited to 10,000 units across all products.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 1,500 units of product B.\n// A >= 1000; B >= 1500\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe total energy cost for all products must not exceed $600,000.\n// (50 - 0.0002 * EnergyEfficiencyA) * A + (60 - 0.0002 * EnergyEfficiencyB) * B + (70 - 0.0002 * EnergyEfficiencyC) * C + (80 - 0.0002 * EnergyEfficiencyD) * D <= 600000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient upgrades for their production lines. The energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company has a total budget of $50,000 for energy efficiency upgrades and a total production capacity for the next quarter limited to 10,000 units across all products. The company must produce at least 1,000 units of product A and 1,500 units of product B. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. Additionally, the total energy cost for all products must not exceed $600,000.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0) # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $50,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000)\n# The total production capacity for the next quarter is limited to 10,000 units across all products.\nmodel.addCons(A + B + C + D <= 10000)\n# The company must produce at least 1,000 units of product A and 1,500 units of product B.\nmodel.addCons(A >= 1000)\nmodel.addCons(B >= 1500)\n# The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n# The total energy cost for all products must not exceed $600,000.\nmodel.addCons((50 - 0.0002 * EnergyEfficiencyA) * A + (60 - 0.0002 * EnergyEfficiencyB) * B + (70 - 0.0002 * EnergyEfficiencyC) * C + (80 - 0.0002 * EnergyEfficiencyD) * D <= 600000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Trucks\": \"FuelEffTrucks\", \"range\": \"FuelEffTrucks >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Vans\": \"FuelEffVans\", \"range\": \"FuelEffVans >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Bikes\": \"FuelEffBikes\", \"range\": \"FuelEffBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies.\n// DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n// OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n// The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1.\n// 3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and management constraints.\n// Trucks + Vans + Bikes <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities. The company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies, defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies. The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1. The total number of vehicles cannot exceed 100 due to parking and management constraints. Please help the company to maximize the difference between its delivery efficiency and operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nFuelEffTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffTrucks\", lb=0)  # fuel efficiency of Trucks\nFuelEffVans = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffVans\", lb=0)  # fuel efficiency of Vans\nFuelEffBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffBikes\", lb=0)  # fuel efficiency of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n## OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n## The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n## convert the division to multiplication\nDeliveryEfficiency = Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes\nOperationalCost = Trucks * FuelEffTrucks**2 + Vans * FuelEffVans**2 + Bikes * FuelEffBikes**2\nDenominator = Trucks**2 + Vans**2 + Bikes**2\nmodel.addCons(obj * Denominator == DeliveryEfficiency * Denominator - OperationalCost * Denominator)\n\n# Add constraints\n## The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance.\nmodel.addCons(3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000)\n## The total number of vehicles cannot exceed 100 due to parking and management constraints.\nmodel.addCons(Trucks + Vans + Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Fuel Efficiency of Trucks: \", model.getVal(FuelEffTrucks))\n    print(\"Fuel Efficiency of Vans: \", model.getVal(FuelEffVans))\n    print(\"Fuel Efficiency of Bikes: \", model.getVal(FuelEffBikes))\n    print(\"Maximized Efficiency - Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit, considering the cost of raw materials, labor, and storage. Additionally, the company must decide on the advertising budget for each product to enhance sales.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"ProductAAdBudget\", \"range\": \"ProductAAdBudget >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductB\": \"ProductBAdBudget\", \"range\": \"ProductBAdBudget >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductC\": \"ProductCAdBudget\", \"range\": \"ProductCAdBudget >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, with a production cost of $30 and an advertising cost of $0.1 per dollar spent. The profit per unit of ProductB is $70, with a production cost of $40 and an advertising cost of $0.15 per dollar spent. The profit per unit of ProductC is $60, with a production cost of $35 and an advertising cost of $0.12 per dollar spent. The company wants to maximize the total net profit.\n// Profit_ProductA = (50 - 30) * ProductAQty - 0.1 * ProductAAdBudget\n// Profit_ProductB = (70 - 40) * ProductBQty - 0.15 * ProductBAdBudget\n// Profit_ProductC = (60 - 35) * ProductCQty - 0.12 * ProductCAdBudget\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production and advertising.\n// 30 * ProductAQty + 40 * ProductBQty + 35 * ProductCQty + ProductAAdBudget + ProductBAdBudget + ProductCAdBudget <= 10,000\n\n## Generate Constraint-2:\nThe storage capacity allows for a maximum of 200 units of each product.\n// ProductAQty <= 200; ProductBQty <= 200; ProductCQty <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize profit, considering the cost of raw materials, labor, and storage. The profit per unit of ProductA is $50, with a production cost of $30 and an advertising cost of $0.1 per dollar spent. The profit per unit of ProductB is $70, with a production cost of $40 and an advertising cost of $0.15 per dollar spent. The profit per unit of ProductC is $60, with a production cost of $35 and an advertising cost of $0.12 per dollar spent. The company has a total budget of $10,000 for production and advertising. The storage capacity allows for a maximum of 200 units of each product. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nProductAAdBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductAAdBudget\", lb=0)  # advertising budget for ProductA\nProductBAdBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductBAdBudget\", lb=0)  # advertising budget for ProductB\nProductCAdBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductCAdBudget\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 30) * ProductAQty - 0.1 * ProductAAdBudget\nProfit_ProductB = (70 - 40) * ProductBQty - 0.15 * ProductBAdBudget\nProfit_ProductC = (60 - 35) * ProductCQty - 0.12 * ProductCAdBudget\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(30 * ProductAQty + 40 * ProductBQty + 35 * ProductCQty + ProductAAdBudget + ProductBAdBudget + ProductCAdBudget <= 10000)\nmodel.addCons(ProductAQty <= 200)\nmodel.addCons(ProductBQty <= 200)\nmodel.addCons(ProductCQty <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Advertising Budget for ProductA: \", model.getVal(ProductAAdBudget))\n    print(\"Advertising Budget for ProductB: \", model.getVal(ProductBAdBudget))\n    print(\"Advertising Budget for ProductC: \", model.getVal(ProductCAdBudget))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company has 5 different locations where they can install solar panels. They need to decide how many solar panels to install at each location to maximize energy production while minimizing costs.\n// {\"number of solar panels at location 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies by location due to differences in sunlight exposure and efficiency. \nAt location 1, each panel produces 15 kWh of energy per day.\nAt location 2, each panel produces 20 kWh of energy per day.\nAt location 3, each panel produces 18 kWh of energy per day.\nAt location 4, each panel produces 22 kWh of energy per day.\nAt location 5, each panel produces 16 kWh of energy per day.\nThe cost of installing each panel also varies by location.\nThe cost per panel at location 1 is $1000.\nThe cost per panel at location 2 is $1200.\nThe cost per panel at location 3 is $1100.\nThe cost per panel at location 4 is $1300.\nThe cost per panel at location 5 is $1050.\nThe objective is to maximize the total daily energy production while keeping the total installation cost below a certain budget.\n// The total daily energy production: E = 15 * S1 + 20 * S2 + 18 * S3 + 22 * S4 + 16 * S5\n// The total installation cost: C = 1000 * S1 + 1200 * S2 + 1100 * S3 + 1300 * S4 + 1050 * S5\n// So, the objective function is: Maximize E - (C / 1000)^2\n// Maximize (15 * S1 + 20 * S2 + 18 * S3 + 22 * S4 + 16 * S5) - ((1000 * S1 + 1200 * S2 + 1100 * S3 + 1300 * S4 + 1050 * S5) / 1000)^2\n\n## Generate Constraint-1:\nThe total budget for installing solar panels is $50,000.\n// 1000 * S1 + 1200 * S2 + 1100 * S3 + 1300 * S4 + 1050 * S5 <= 50000\n\n## Generate Constraint-2:\nThe maximum number of panels that can be installed at each location is limited.\n// S1 <= 50; S2 <= 60; S3 <= 55; S4 <= 65; S5 <= 45",
        "question": "A solar energy company has 5 different locations where they can install solar panels. They need to decide how many solar panels to install at each location to maximize energy production while minimizing costs.\nAt location 1, each panel produces 15 kWh of energy per day and costs $1000 to install.\nAt location 2, each panel produces 20 kWh of energy per day and costs $1200 to install.\nAt location 3, each panel produces 18 kWh of energy per day and costs $1100 to install.\nAt location 4, each panel produces 22 kWh of energy per day and costs $1300 to install.\nAt location 5, each panel produces 16 kWh of energy per day and costs $1050 to install.\nThe total budget for installing solar panels is $50,000. The maximum number of panels that can be installed at each location is limited to 50 at location 1, 60 at location 2, 55 at location 3, 65 at location 4, and 45 at location 5.\nPlease help the company to maximize the total daily energy production while keeping the total installation cost below the budget, aiming to maximize the objective function which is the total daily energy production minus the square of the total installation cost divided by 1000.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # number of solar panels at location 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0, ub=60)  # number of solar panels at location 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0, ub=55)  # number of solar panels at location 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0, ub=65)  # number of solar panels at location 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0, ub=45)  # number of solar panels at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE = 15 * S1 + 20 * S2 + 18 * S3 + 22 * S4 + 16 * S5  # total daily energy production\nC = 1000 * S1 + 1200 * S2 + 1100 * S3 + 1300 * S4 + 1050 * S5  # total installation cost\n## the objective function is: Maximize E - (C / 1000)^2\n## convert the division to multiplication\nmodel.addCons(obj == E - (C / 1000)**2)\n\n# Add constraints\n## The total budget for installing solar panels is $50,000.\nmodel.addCons(1000 * S1 + 1200 * S2 + 1100 * S3 + 1300 * S4 + 1050 * S5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(S1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(S2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(S3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(S4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(S5))\n    print(\"Maximized Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The company also needs to decide on the budget for advertising each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from ProductA is $100 per unit, but it decreases by $0.5 for every $100 spent on advertising. The profit from ProductB is $150 per unit, decreasing by $0.7 for every $100 spent on advertising. The profit from ProductC is $200 per unit, decreasing by $1 for every $100 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total budget for advertising cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 300 units.\n// QuantityA >= 200; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The profit per unit for each product decreases with the increase in advertising budget as shown in the following Table.\n\n| Product | Profit per Unit | Advertising Effect |\n|---------|-----------------|--------------------|\n| ProductA | $100            | $0.5 per $100      |\n| ProductB | $150            | $0.7 per $100      |\n| ProductC | $200            | $1 per $100        |\n\nThe company has a total budget of $50,000 for advertising. The company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC. Due to market demand, the production of ProductA must be at least 200 units, and ProductB must be at least 300 units.\n\nPlease help the company to maximize the total profit from all products by determining the optimal production quantities and advertising budgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200, ub=1000)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300, ub=1500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=2000)  # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # advertising budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # advertising budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\nProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\nProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and operating cost. The company needs to determine the optimal number of each type of truck to minimize the total operating cost while meeting the delivery requirements.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operating cost for truck A is $50 per day, for truck B is $70 per day, for truck C is $90 per day, for truck D is $110 per day, and for truck E is $130 per day. The company wants to minimize the total daily operating cost.\n// Total operating cost: Cost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total daily delivery capacity required is 1000 units. Truck A can carry 10 units, truck B can carry 20 units, truck C can carry 30 units, truck D can carry 40 units, and truck E can carry 50 units.\n// 10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 per day for truck operations.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and operating cost. The company needs to determine the optimal number of each type of truck to minimize the total operating cost while meeting the delivery requirements. The operating cost and capacity for each truck are given in the following Table.\n\n| Truck Type | Operating Cost per Day | Capacity (Units) |\n|------------|------------------------|------------------|\n| A          | $50                    | 10               |\n| B          | $70                    | 20               |\n| C          | $90                    | 30               |\n| D          | $110                   | 40               |\n| E          | $130                   | 50               |\n\nThe total daily delivery capacity required is 1000 units. The company has a budget of $10,000 per day for truck operations. Please help the company to minimize the total daily operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\nCost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The total daily delivery capacity required is 1000 units.\nmodel.addCons(10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000)\n# The company has a budget of $10,000 per day for truck operations.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Minimized Total Daily Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production. The energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently. The company has a budget of $500,000 for investments in energy storage systems.\n\nPlease help the company to maximize the total energy output stored efficiently, given the following parameters:\n\n| Component                | Output per Unit | Efficiency Increase per $100,000 Investment |\n|--------------------------|-----------------|-------------------------------------------|\n| Solar Panels (S)         | 100 kWh         | N/A                                       |\n| Wind Turbines (W)        | 200 kWh         | N/A                                       |\n| Energy Storage Systems (E)| N/A             | 5%                                        |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n## the objective function is: Maximize (Energy_output * Storage_efficiency)\n## convert the multiplication to addition\nmodel.addCons(obj == Energy_output + Storage_efficiency)\n\n# Add constraints\n## The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift.\n// {\"production quantity for product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product A\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product B\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product C\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the production cost per unit is $50, and the revenue per unit is $100. Each shift increases the production capacity by 100 units.\nFor product B, the production cost per unit is $70, and the revenue per unit is $140. Each shift increases the production capacity by 120 units.\nFor product C, the production cost per unit is $60, and the revenue per unit is $120. Each shift increases the production capacity by 110 units.\nThe company wants to maximize the total net profit.\n// NetProfit_A = (100 - 50) * ProdA\n// NetProfit_B = (140 - 70) * ProdB\n// NetProfit_C = (120 - 60) * ProdC\n// TotalProduction_A = ShiftA * 100\n// TotalProduction_B = ShiftB * 120\n// TotalProduction_C = ShiftC * 110\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) subject to the production constraints.\n\n## Generate Constraint-1:\nThe company has a total of 500 units of raw materials available.\n// ProdA + ProdB + ProdC <= 500\n\n## Generate Constraint-2:\nThe company can operate a maximum of 5 shifts in total.\n// ShiftA + ShiftB + ShiftC <= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift. The details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit | Production Capacity Increase per Shift |\n|---------|--------------------------|------------------|----------------------------------------|\n| A       | $50                      | $100             | 100 units                              |\n| B       | $70                      | $140             | 120 units                              |\n| C       | $60                      | $120             | 110 units                              |\n\nThe company has a total of 500 units of raw materials available. The company can operate a maximum of 5 shifts in total. The company wants to maximize the total net profit.\n\nPlease help the company determine the optimal production quantity for each product and the number of shifts to operate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for product C\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0) # number of shifts for product A\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0) # number of shifts for product B\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0) # number of shifts for product C\n\n# Define objective function\nNetProfit_A = (100 - 50) * ProdA\nNetProfit_B = (140 - 70) * ProdB\nNetProfit_C = (120 - 60) * ProdC\nTotalProduction_A = ShiftA * 100\nTotalProduction_B = ShiftB * 120\nTotalProduction_C = ShiftC * 110\nmodel.addCons(ProdA <= TotalProduction_A)\nmodel.addCons(ProdB <= TotalProduction_B)\nmodel.addCons(ProdC <= TotalProduction_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n# The company has a total of 500 units of raw materials available.\nmodel.addCons(ProdA + ProdB + ProdC <= 500)\n# The company can operate a maximum of 5 shifts in total.\nmodel.addCons(ShiftA + ShiftB + ShiftC <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts for Product A: \", model.getVal(ShiftA))\n    print(\"Number of Shifts for Product B: \", model.getVal(ShiftB))\n    print(\"Number of Shifts for Product C: \", model.getVal(ShiftC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\n// LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks)",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type, and the maintenance cost is a fixed percentage of the fuel cost.\n\n| Truck Type             | Fuel Efficiency (km/liter) |\n|------------------------|---------------------------|\n| Short-distance trucks  | ShortFuelEfficiency       |\n| Medium-distance trucks | MediumFuelEfficiency      |\n| Long-distance trucks   | LongFuelEfficiency        |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\n\nPlease help the company determine the optimal number of short-distance trucks (ShortDistanceTrucks), medium-distance trucks (MediumDistanceTrucks), and long-distance trucks (LongDistanceTrucks) to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nShortDistance = model.addVar(name=\"ShortDistance\")\nMediumDistance = model.addVar(name=\"MediumDistance\")\nLongDistance = model.addVar(name=\"LongDistance\")\nShortFuelEfficiency = model.addVar(name=\"ShortFuelEfficiency\")\nMediumFuelEfficiency = model.addVar(name=\"MediumFuelEfficiency\")\nLongFuelEfficiency = model.addVar(name=\"LongFuelEfficiency\")\nShortTruckCost = model.addVar(name=\"ShortTruckCost\")\nMediumTruckCost = model.addVar(name=\"MediumTruckCost\")\nLongTruckCost = model.addVar(name=\"LongTruckCost\")\n\n## TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n## TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n## So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\nTotalMaintenanceCost = 0.1 * TotalFuelCost\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100)\n## The company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\nmodel.addCons(LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1248,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\n// Total revenue for ProductB: RevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\n// Total revenue for ProductC: RevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $100,000.\n// MachineryA + MachineryB + MachineryC <= 100000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume.\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\nThe company has a total of 10,000 labor hours available for the month. The total capital investment in advanced machinery cannot exceed $100,000. The total marketing budget cannot exceed $50,000.\nPlease help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours per unit of ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours per unit of ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours per unit of ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in machinery for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nRevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\nRevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\nRevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 100000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n\n# Additional constraints for labor hours reduction due to machinery investment\nmodel.addCons(LaborA == 10 - (MachineryA / 10000))\nmodel.addCons(LaborB == 15 - (MachineryB / 10000))\nmodel.addCons(LaborC == 20 - (MachineryC / 10000))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type.\n// {\"number of trucks from City A to City B\": \"TrucksAB\", \"range\": \"TrucksAB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City A to City C\": \"TrucksAC\", \"range\": \"TrucksAC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City B to City C\": \"TrucksBC\", \"range\": \"TrucksBC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks from City A to City B\": \"FuelEfficiencyAB\", \"range\": \"FuelEfficiencyAB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City A to City C\": \"FuelEfficiencyAC\", \"range\": \"FuelEfficiencyAC > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City B to City C\": \"FuelEfficiencyBC\", \"range\": \"FuelEfficiencyBC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day. The fuel cost is calculated based on the distance between cities, the number of trucks, and their fuel efficiency. The distance from City A to City B is 500 km, from City A to City C is 700 km, and from City B to City C is 600 km. The fuel cost is $1 per liter.\n// FuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\n// FuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\n// FuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n// So, the objective function is: Minimize (FuelCostAB + FuelCostAC + FuelCostBC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// FuelCostAB + FuelCostAC + FuelCostBC <= 1000\n\n## Generate Constraint-2:\nThe company can only allocate a maximum of 50 trucks in total across all routes.\n// TrucksAB + TrucksAC + TrucksBC <= 50\n\n## Generate Constraint-3:\nThe fuel efficiency of the trucks must be at least 5 km/liter for each route.\n// FuelEfficiencyAB >= 5\n// FuelEfficiencyAC >= 5\n// FuelEfficiencyBC >= 5\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 trucks are allocated to the City A to City B route.\n// TrucksAB >= 10\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced distribution of trucks, requiring that the difference in the number of trucks between any two routes does not exceed 10.\n// |TrucksAB - TrucksAC| <= 10\n// |TrucksAB - TrucksBC| <= 10\n// |TrucksAC - TrucksBC| <= 10",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type. The company wants to minimize the total fuel cost per day, which is calculated based on the distance between cities, the number of trucks, and their fuel efficiency. The distance from City A to City B is 500 km, from City A to City C is 700 km, and from City B to City C is 600 km. The fuel cost is $1 per liter. The company has a total budget of $1000 for fuel costs per day and can only allocate a maximum of 50 trucks in total across all routes. The fuel efficiency of the trucks must be at least 5 km/liter for each route. The company must ensure that at least 10 trucks are allocated to the City A to City B route. Additionally, the company aims to maintain a balanced distribution of trucks, requiring that the difference in the number of trucks between any two routes does not exceed 10. Please help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksAB = model.addVar(vtype=\"INTEGER\", name=\"TrucksAB\", lb=10)  # number of trucks from City A to City B\nTrucksAC = model.addVar(vtype=\"INTEGER\", name=\"TrucksAC\", lb=0)  # number of trucks from City A to City C\nTrucksBC = model.addVar(vtype=\"INTEGER\", name=\"TrucksBC\", lb=0)  # number of trucks from City B to City C\nFuelEfficiencyAB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAB\", lb=5)  # fuel efficiency of trucks from City A to City B\nFuelEfficiencyAC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAC\", lb=5)  # fuel efficiency of trucks from City A to City C\nFuelEfficiencyBC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyBC\", lb=5)  # fuel efficiency of trucks from City B to City C\n\n# Define objective function\nFuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\nFuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\nFuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n# So, the objective function is: Minimize (FuelCostAB + FuelCostAC + FuelCostBC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostAB + FuelCostAC + FuelCostBC)\n\n# Add constraints\n# The company has a total budget of $1000 for fuel costs per day.\nmodel.addCons(FuelCostAB + FuelCostAC + FuelCostBC <= 1000)\n# The company can only allocate a maximum of 50 trucks in total across all routes.\nmodel.addCons(TrucksAB + TrucksAC + TrucksBC <= 50)\n# The fuel efficiency of the trucks must be at least 5 km/liter for each route.\nmodel.addCons(FuelEfficiencyAB >= 5)\nmodel.addCons(FuelEfficiencyAC >= 5)\nmodel.addCons(FuelEfficiencyBC >= 5)\n# The company must ensure that at least 10 trucks are allocated to the City A to City B route.\nmodel.addCons(TrucksAB >= 10)\n# The company aims to maintain a balanced distribution of trucks, requiring that the difference in the number of trucks between any two routes does not exceed 10.\nmodel.addCons(abs(TrucksAB - TrucksAC) <= 10)\nmodel.addCons(abs(TrucksAB - TrucksBC) <= 10)\nmodel.addCons(abs(TrucksAC - TrucksBC) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks from City A to City B: \", model.getVal(TrucksAB))\n    print(\"Number of Trucks from City A to City C: \", model.getVal(TrucksAC))\n    print(\"Number of Trucks from City B to City C: \", model.getVal(TrucksBC))\n    print(\"Fuel Efficiency from City A to City B: \", model.getVal(FuelEfficiencyAB))\n    print(\"Fuel Efficiency from City A to City C: \", model.getVal(FuelEfficiencyAC))\n    print(\"Fuel Efficiency from City B to City C: \", model.getVal(FuelEfficiencyBC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large vehicles\": \"ExtraLarge\", \"range\": \"ExtraLarge >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer.\n// Profit_Small = (1.20 - 0.50) * Small\n// Profit_Medium = (1.50 - 0.70) * Medium\n// Profit_Large = (1.80 - 0.90) * Large\n// Profit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\n// Profit_Electric = (1.00 - 0.30) * Electric\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\n\n## Generate Constraint-1:\nThe total number of vehicles the company can operate is limited to 200.\n// Small + Medium + Large + ExtraLarge + Electric <= 200\n\n## Generate Constraint-2:\nThe company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n// 2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000\n\n## Generate Constraint-3:\nThe cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n// Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300\n\n## Generate Constraint-4:\nThe company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n// Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric)",
        "question": "A logistics company is planning its fleet usage for the next quarter and has five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer.\n\nThe total number of vehicles the company can operate is limited to 200. The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500. The cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons. The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n\nPlease help the company to maximize the profit per kilometer by determining the optimal number of each type of vehicle to operate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of Large vehicles\nExtraLarge = model.addVar(vtype=\"INTEGER\", name=\"ExtraLarge\", lb=0) # number of Extra-Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0) # number of Electric vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Small = (1.20 - 0.50) * Small\nProfit_Medium = (1.50 - 0.70) * Medium\nProfit_Large = (1.80 - 0.90) * Large\nProfit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\nProfit_Electric = (1.00 - 0.30) * Electric\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric)\n\n# Add constraints\n## The total number of vehicles the company can operate is limited to 200.\nmodel.addCons(Small + Medium + Large + ExtraLarge + Electric <= 200)\n## The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000.\nmodel.addCons(2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000)\n## The cargo capacity constraint is as follows:\nmodel.addCons(Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300)\n## The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\nmodel.addCons(Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Number of Extra-Large Vehicles: \", model.getVal(ExtraLarge))\n    print(\"Number of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Maximized Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1593,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to optimize efficiency and cost.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and maintenance cost per trip. \nFor truck 1, the fuel efficiency is 10 km/l, and the maintenance cost per trip is $100.\nFor truck 2, the fuel efficiency is 12 km/l, and the maintenance cost per trip is $120.\nFor truck 3, the fuel efficiency is 15 km/l, and the maintenance cost per trip is $150.\nFor truck 4, the fuel efficiency is 18 km/l, and the maintenance cost per trip is $180.\nFor truck 5, the fuel efficiency is 20 km/l, and the maintenance cost per trip is $200.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Fuel cost per kilometer for truck 1: F1 = 100 / (10 * T1)\n// Fuel cost per kilometer for truck 2: F2 = 120 / (12 * T2)\n// Fuel cost per kilometer for truck 3: F3 = 150 / (15 * T3)\n// Fuel cost per kilometer for truck 4: F4 = 180 / (18 * T4)\n// Fuel cost per kilometer for truck 5: F5 = 200 / (20 * T5)\n// Total cost per kilometer: Cost = F1 + F2 + F3 + F4 + F5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach truck can make a maximum of 20 trips.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20\n\n## Generate Constraint-3:\nThe company must transport at least 5000 km worth of goods.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 >= 5000",
        "question": "A logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to optimize efficiency and cost. Each truck has a different fuel efficiency and maintenance cost per trip. For truck 1, the fuel efficiency is 10 km/l, and the maintenance cost per trip is $100. For truck 2, the fuel efficiency is 12 km/l, and the maintenance cost per trip is $120. For truck 3, the fuel efficiency is 15 km/l, and the maintenance cost per trip is $150. For truck 4, the fuel efficiency is 18 km/l, and the maintenance cost per trip is $180. For truck 5, the fuel efficiency is 20 km/l, and the maintenance cost per trip is $200. The company wants to minimize the total cost of fuel and maintenance per kilometer. The total number of trips across all trucks must not exceed 100. Each truck can make a maximum of 20 trips. The company must transport at least 5000 km worth of goods. Please help the company to minimize the total cost of fuel and maintenance per kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trips for truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nF1 = 100 / (10 * T1)\nF2 = 120 / (12 * T2)\nF3 = 150 / (15 * T3)\nF4 = 180 / (18 * T4)\nF5 = 200 / (20 * T5)\n## convert the division to multiplication\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5)\n\n# Add constraints\n## The total number of trips across all trucks must not exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The company must transport at least 5000 km worth of goods.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries. The revenue generated and fuel consumed per trip for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Trip | Fuel Cost per Trip |\n|------------|------------------|--------------------|\n| T1         | $500             | $100               |\n| T2         | $600             | $120               |\n| T3         | $700             | $140               |\n| T4         | $800             | $160               |\n| T5         | $900             | $180               |\n\nThe company has a budget of $50,000 for purchasing trucks. The total number of trucks cannot exceed 50. Please help the company to maximize the net profit, which is the total revenue minus the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000, per Hybrid vehicle is $8,000, and per Hydrogen vehicle is $12,000. Due to economies of scale, the profit per vehicle increases nonlinearly with the quantity produced. Specifically, the profit per vehicle increases by an additional $10 for every 100 vehicles produced beyond the first 100 for each type. The company aims to maximize the total profit from vehicle sales.\n// Profit_E = (10000 + (E - 100) / 100 * 10) * E\n// Profit_H = (8000 + (H - 100) / 100 * 10) * H\n// Profit_Hy = (12000 + (Hy - 100) / 100 * 10) * Hy\n// So, the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 vehicles in total.\n// E + H + Hy <= 500\n\n## Generate Constraint-2:\nThe company has a budget constraint for production costs, which is $4,000,000. The cost per Electric vehicle is $5,000, per Hybrid vehicle is $4,500, and per Hydrogen vehicle is $6,000.\n// 5000 * E + 4500 * H + 6000 * Hy <= 4000000\n\n## Generate Constraint-3:\nThe market demand for Electric vehicles is at least 150 units, and for Hydrogen vehicles is at most 100 units.\n// E >= 150\n// Hy <= 100\n\n## Generate Constraint-4:\nThe company must produce at least twice as many Hybrid vehicles as Hydrogen vehicles.\n// H >= 2 * Hy\n\n## Generate Constraint-5:\nThe total number of vehicles produced must not exceed the total number of vehicles sold last year, which was 450.\n// E + H + Hy <= 450",
        "question": "A company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints. The profit per vehicle and additional profit scaling are given in the following Table.\n\n| Vehicle Type | Profit per Vehicle (first 100) | Additional Profit per 100 Vehicles |\n|--------------|--------------------------------|-------------------------------------|\n| Electric     | $10,000                         | $10                                 |\n| Hybrid       | $8,000                          | $10                                 |\n| Hydrogen     | $12,000                         | $10                                 |\n\nThe company has a limited production capacity of 500 vehicles in total. The company has a budget constraint for production costs, which is $4,000,000. The cost per Electric vehicle is $5,000, per Hybrid vehicle is $4,500, and per Hydrogen vehicle is $6,000. The market demand for Electric vehicles is at least 150 units, and for Hydrogen vehicles is at most 100 units. The company must produce at least twice as many Hybrid vehicles as Hydrogen vehicles. The total number of vehicles produced must not exceed the total number of vehicles sold last year, which was 450.\n\nPlease help the company to maximize the total profit from vehicle sales, considering the nonlinear increase in profit per vehicle with the quantity produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150)  # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0)  # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0, ub=100)  # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with piecewise linear function\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = (10000 + (E2 - 100) / 100 * 10) * E2 * E_b2\n\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0, ub=100)\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=100, ub=500)\nH_b1 = model.addVar(vtype=\"B\", name=\"H_b1\")\nH_b2 = model.addVar(vtype=\"B\", name=\"H_b2\")\nmodel.addCons(H_b1 + H_b2 == 1)\nmodel.addCons(H == H1*H_b1 + H2*H_b2)\nProfit_H = (8000 + (H2 - 100) / 100 * 10) * H2 * H_b2\n\nHy1 = model.addVar(vtype=\"INTEGER\", name=\"Hy1\", lb=0, ub=100)\nHy2 = model.addVar(vtype=\"INTEGER\", name=\"Hy2\", lb=100, ub=500)\nHy_b1 = model.addVar(vtype=\"B\", name=\"Hy_b1\")\nHy_b2 = model.addVar(vtype=\"B\", name=\"Hy_b2\")\nmodel.addCons(Hy_b1 + Hy_b2 == 1)\nmodel.addCons(Hy == Hy1*Hy_b1 + Hy2*Hy_b2)\nProfit_Hy = (12000 + (Hy2 - 100) / 100 * 10) * Hy2 * Hy_b2\n\n## the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\nmodel.addCons(obj == Profit_E + Profit_H + Profit_Hy)\n\n# Add constraints\nmodel.addCons(E + H + Hy <= 500)\nmodel.addCons(5000 * E + 4500 * H + 6000 * Hy <= 4000000)\nmodel.addCons(H >= 2 * Hy)\nmodel.addCons(E + H + Hy <= 450)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1510,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Each product requires a specific amount of raw materials and labor hours. Additionally, the company is considering investing in automation technology for each product, which will reduce the labor hours required per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for product A\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product B\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product C\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product D\": \"AutomationD\", \"range\": \"AutomationD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per unit for each product decreases by 1 hour for every $10,000 invested in automation for that product. The initial labor cost per unit for product A is 5 hours, for product B is 6 hours, for product C is 7 hours, and for product D is 8 hours. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\n// Total profit for product B: ProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\n// Total profit for product C: ProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\n// Total profit for product D: ProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for automation investments.\n// AutomationA + AutomationB + AutomationC + AutomationD <= 100000\n\n## Generate Constraint-2:\nThe total labor hours available for the quarter are 10,000 hours.\n// 5 * A + 6 * B + 7 * C + 8 * D <= 10000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter, considering the potential investment in automation technology for each product. The initial labor cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Selling Price per Unit | Initial Labor Cost per Unit |\n|---------|------------------------|-----------------------------|\n| A       | $100                   | 5 hours                     |\n| B       | $120                   | 6 hours                     |\n| C       | $140                   | 7 hours                     |\n| D       | $160                   | 8 hours                     |\n\nThe cost of labor per unit for each product decreases by 1 hour for every $10,000 invested in automation for that product. The company has a total budget of $100,000 for automation investments. The total labor hours available for the quarter are 10,000 hours. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for product A\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for product B\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for product C\nAutomationD = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationD\", lb=0) # investment in automation for product D\n\n# Define objective function\n## Total profit for product A: ProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\n## Total profit for product B: ProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\n## Total profit for product C: ProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\n## Total profit for product D: ProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\nProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\nProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\nProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total budget of $100,000 for automation investments.\nmodel.addCons(AutomationA + AutomationB + AutomationC + AutomationD <= 100000)\n## The total labor hours available for the quarter are 10,000 hours.\nmodel.addCons(5 * A + 6 * B + 7 * C + 8 * D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Automation for Product A: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for Product B: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for Product C: \", model.getVal(AutomationC))\n    print(\"Investment in Automation for Product D: \", model.getVal(AutomationD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck type, and the average speed of each truck type. The goal is to minimize the total fuel consumption while ensuring timely deliveries.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region C\": \"FuelEffC\", \"range\": \"FuelEffC > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions, considering the distance traveled and the fuel efficiency of each truck type.\n// FuelConsumption_A = TrucksA * DistanceA / FuelEffA\n// FuelConsumption_B = TrucksB * DistanceB / FuelEffB\n// FuelConsumption_C = TrucksC * DistanceC / FuelEffC\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// TrucksA * CostA + TrucksB * CostB + TrucksC * CostC <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck type, and the average speed of each truck type. The goal is to minimize the total fuel consumption while ensuring timely deliveries. The company aims to minimize the total fuel consumption across all regions, considering the distance traveled and the fuel efficiency of each truck type. The company has a total budget of $100,000 for purchasing trucks.\n\nPlease help the company to determine the optimal number of trucks for each region (Region A, Region B, and Region C) and their respective fuel efficiencies and average speeds to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Region C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceA = 1000 # Assuming distance for Region A\nDistanceB = 1500 # Assuming distance for Region B\nDistanceC = 2000 # Assuming distance for Region C\nFuelEffA = 5 # Assuming fuel efficiency for Region A\nFuelEffB = 6 # Assuming fuel efficiency for Region B\nFuelEffC = 7 # Assuming fuel efficiency for Region C\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n## convert the division to multiplication\nmodel.addCons(obj == TrucksA * DistanceA * FuelEffA + TrucksB * DistanceB * FuelEffB + TrucksC * DistanceC * FuelEffC)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nCostA = 20000 # Assuming cost per truck for Region A\nCostB = 25000 # Assuming cost per truck for Region B\nCostC = 30000 # Assuming cost per truck for Region C\nmodel.addCons(TrucksA * CostA + TrucksB * CostB + TrucksC * CostC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n// Total operational cost for Solar: CostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\n// Total operational cost for Wind: CostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\n// Total operational cost for Hydro: CostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\n// 50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000\n\n## Generate Constraint-2:\nThe total number of power units that can be installed is limited to 20 units.\n// SolarUnits + WindUnits + HydroUnits <= 20",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced. The operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n\n| Power Plant Type | Initial Cost per Unit | Decrease in Cost per $100 Tech Investment |\n|------------------|-----------------------|------------------------------------------|\n| Solar            | $50                   | $2                                       |\n| Wind             | $60                   | $3                                       |\n| Hydro            | $40                   | $1.5                                     |\n\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology. The total number of power units that can be installed is limited to 20 units.\n\nPlease help the company to determine the optimal number of units to install for each type of power plant and the level of investment in advanced technology to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)    # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)    # investment in advanced technology for Wind\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nCostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\nCostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\nCostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n# So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\nmodel.addCons(50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000)\n# The total number of power units that can be installed is limited to 20 units.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(TechInvestmentHydro))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1742,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city and the speed at which the trucks travel. Additionally, the company is considering investing in hybrid technology for some of its trucks to reduce fuel consumption.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks (mph)\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of the trucks is a nonlinear function of their speed and the number of trips. The fuel efficiency improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for City1: Fuel1 = (Trips1 * (0.05 * Speed^2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1^2))\n// Fuel consumption for City2: Fuel2 = (Trips2 * (0.05 * Speed^2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2^2))\n// Fuel consumption for City3: Fuel3 = (Trips3 * (0.05 * Speed^2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3^2))\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in hybrid technology and operational costs.\n// Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city, the speed at which the trucks travel, and the investment in hybrid technology for each city. The fuel consumption of the trucks is a nonlinear function of their speed and the number of trips, and it improves with the investment in hybrid technology.\n\n| Variable                     | Description                          | Range/Type       |\n|------------------------------|--------------------------------------|------------------|\n| Number of trips to City1     | Trips1                               | Trips1 >= 0, integer |\n| Number of trips to City2     | Trips2                               | Trips2 >= 0, integer |\n| Number of trips to City3     | Trips3                               | Trips3 >= 0, integer |\n| Speed of trucks (mph)        | Speed                                | Speed >= 0, continuous |\n| Investment in hybrid for City1 | Hybrid1                              | Hybrid1 >= 0, continuous |\n| Investment in hybrid for City2 | Hybrid2                              | Hybrid2 >= 0, continuous |\n| Investment in hybrid for City3 | Hybrid3                              | Hybrid3 >= 0, continuous |\n\nThe company aims to minimize the total fuel consumption across all trips. The company has a total budget of $100,000 for investments in hybrid technology and operational costs.\n\nPlease help the company determine the optimal number of trips, truck speed, and investment in hybrid technology to minimize the total fuel consumption while staying within the budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to City3\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)  # speed of trucks (mph)\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for City1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for City2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for City3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel1 = Trips1 * (0.05 * Speed**2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1**2)\nFuel2 = Trips2 * (0.05 * Speed**2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2**2)\nFuel3 = Trips3 * (0.05 * Speed**2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3**2)\n## the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## The company has a total budget of $100,000 for investments in hybrid technology and operational costs.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Speed of Trucks: \", model.getVal(Speed))\n    print(\"Investment in Hybrid Technology for City1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for City2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for City3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1758,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include three types of vehicles: small, medium, and large trucks. The company needs to determine the number of each type of truck to purchase and the associated operational costs and revenue per trip.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"operational cost per trip for small trucks\": \"CostSmall\", \"range\": \"CostSmall >= 0\", \"type\": \"real\"}\n// {\"operational cost per trip for medium trucks\": \"CostMedium\", \"range\": \"CostMedium >= 0\", \"type\": \"real\"}\n// {\"operational cost per trip for large trucks\": \"CostLarge\", \"range\": \"CostLarge >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for small trucks\": \"RevenueSmall\", \"range\": \"RevenueSmall >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for medium trucks\": \"RevenueMedium\", \"range\": \"RevenueMedium >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for large trucks\": \"RevenueLarge\", \"range\": \"RevenueLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit, which is the total revenue from all trips minus the total operational costs.\n// TotalRevenue = RevenueSmall * SmallTrucks + RevenueMedium * MediumTrucks + RevenueLarge * LargeTrucks\n// TotalCost = CostSmall * SmallTrucks + CostMedium * MediumTrucks + CostLarge * LargeTrucks\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-3:\nThe company must have at least 20 large trucks to fulfill a contract.\n// LargeTrucks >= 20",
        "question": "A logistics company is planning its fleet expansion to include three types of vehicles: small, medium, and large trucks. The company needs to determine the number of each type of truck to purchase and the associated operational costs and revenue per trip. The operational costs and revenues per trip for each type of truck are given in the following Table.\n\n| Vehicle Type | Operational Cost per Trip | Revenue per Trip |\n|--------------|--------------------------|------------------|\n| Small Trucks | CostSmall                 | RevenueSmall     |\n| Medium Trucks| CostMedium                | RevenueMedium    |\n| Large Trucks | CostLarge                 | RevenueLarge     |\n\nThe company has a budget of $200,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The company must have at least 20 large trucks to fulfill a contract. \nPlease help the company to maximize its net profit, which is the total revenue from all trips minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=20)  # number of large trucks\n\n# Define objective function\nTotalRevenue = SmallTrucks * model.addVar(name=\"RevenueSmall\") + MediumTrucks * model.addVar(name=\"RevenueMedium\") + LargeTrucks * model.addVar(name=\"RevenueLarge\")\nTotalCost = SmallTrucks * model.addVar(name=\"CostSmall\") + MediumTrucks * model.addVar(name=\"CostMedium\") + LargeTrucks * model.addVar(name=\"CostLarge\")\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\nmodel.addCons(SmallTrucks * model.addVar(name=\"PriceSmall\") + MediumTrucks * model.addVar(name=\"PriceMedium\") + LargeTrucks * model.addVar(name=\"PriceLarge\") <= 200000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"GoodATrucks\", \"range\": \"GoodATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"GoodBTrucks\", \"range\": \"GoodBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"GoodCTrucks\", \"range\": \"GoodCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"GoodDTrucks\", \"range\": \"GoodDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"GoodETrucks\", \"range\": \"GoodETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated per truck is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net revenue per day.\n// Net revenue for GoodA: Revenue_GoodA = (1000 - 500) * GoodATrucks\n// Net revenue for GoodB: Revenue_GoodB = (1200 - 600) * GoodBTrucks\n// Net revenue for GoodC: Revenue_GoodC = (1400 - 700) * GoodCTrucks\n// Net revenue for GoodD: Revenue_GoodD = (1600 - 800) * GoodDTrucks\n// Net revenue for GoodE: Revenue_GoodE = (1800 - 900) * GoodETrucks\n// So, the objective function is: Maximize (Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50\n\n## Generate Constraint-2:\nDue to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB.\n// GoodATrucks <= 2 * GoodBTrucks\n\n## Generate Constraint-3:\nThe company has a daily budget of $30,000 for operating costs.\n// 500 * GoodATrucks + 600 * GoodBTrucks + 700 * GoodCTrucks + 800 * GoodDTrucks + 900 * GoodETrucks <= 30,000\n\n## Generate Constraint-4:\nTo ensure balanced distribution, the company wants at least one truck for each type of good.\n// GoodATrucks >= 1; GoodBTrucks >= 1; GoodCTrucks >= 1; GoodDTrucks >= 1; GoodETrucks >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network. The operating cost and revenue generated per truck for each type of good are given in the following Table.\n\n| Good | Operating Cost per Truck per Day | Revenue per Truck per Day |\n|------|----------------------------------|---------------------------|\n| GoodA | $500                             | $1000                     |\n| GoodB | $600                             | $1200                     |\n| GoodC | $700                             | $1400                     |\n| GoodD | $800                             | $1600                     |\n| GoodE | $900                             | $1800                     |\n\nThe company has a total of 50 trucks available for distribution. Due to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB. The company has a daily budget of $30,000 for operating costs. To ensure balanced distribution, the company wants at least one truck for each type of good.\n\nPlease help the company to maximize the total net revenue per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nGoodATrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodATrucks\", lb=1)  # number of trucks for GoodA\nGoodBTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodBTrucks\", lb=1)  # number of trucks for GoodB\nGoodCTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodCTrucks\", lb=1)  # number of trucks for GoodC\nGoodDTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodDTrucks\", lb=1)  # number of trucks for GoodD\nGoodETrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodETrucks\", lb=1)  # number of trucks for GoodE\n\n# Define objective function\nRevenue_GoodA = (1000 - 500) * GoodATrucks\nRevenue_GoodB = (1200 - 600) * GoodBTrucks\nRevenue_GoodC = (1400 - 700) * GoodCTrucks\nRevenue_GoodD = (1600 - 800) * GoodDTrucks\nRevenue_GoodE = (1800 - 900) * GoodETrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n# Add constraints\nmodel.addCons(GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50)\nmodel.addCons(GoodATrucks <= 2 * GoodBTrucks)\nmodel.addCons(500 * GoodATrucks + 600 * GoodBTrucks + 700 * GoodCTrucks + 800 * GoodDTrucks + 900 * GoodETrucks <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(GoodATrucks))\n    print(\"Number of Trucks for GoodB: \", model.getVal(GoodBTrucks))\n    print(\"Number of Trucks for GoodC: \", model.getVal(GoodCTrucks))\n    print(\"Number of Trucks for GoodD: \", model.getVal(GoodDTrucks))\n    print(\"Number of Trucks for GoodE: \", model.getVal(GoodETrucks))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route R1 is $1000, and the revenue per truck is $1500. On route R2, the cost is $1200, and the revenue is $1800. On route R3, the cost is $1400, and the revenue is $2100. On route R4, the cost is $1600, and the revenue is $2400. On route R5, the cost is $1800, and the revenue is $2700. The company aims to maximize the total net revenue (revenue minus cost) per total operational cost.\n// Net_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\n// Net_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\n// Net_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\n// Net_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\n// Net_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n// So, the objective function is: Maximize (Net_Revenue_R1 + Net_Revenue_R2 + Net_Revenue_R3 + Net_Revenue_R4 + Net_Revenue_R5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe minimum number of trucks required on route R1 is 10.\n// T1 >= 10",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has different operational costs and revenue potentials. The cost per truck on route R1 is $1000, and the revenue per truck is $1500. On route R2, the cost is $1200, and the revenue is $1800. On route R3, the cost is $1400, and the revenue is $2100. On route R4, the cost is $1600, and the revenue is $2400. On route R5, the cost is $1800, and the revenue is $2700. The company aims to maximize the total net revenue (revenue minus cost) per total operational cost. The company has a total budget of $100,000 for operational costs. The total number of trucks available is 100. The minimum number of trucks required on route R1 is 10. Please help the company to maximize the total net revenue per total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\nNet_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\nNet_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\nNet_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\nNet_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * (1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5) == (1500 * T1 - 1000 * T1) + (1800 * T2 - 1200 * T2) + (2100 * T3 - 1400 * T3) + (2400 * T4 - 1600 * T4) + (2700 * T5 - 1800 * T5))\n\n# Add constraints\n## The company has a total budget of $100,000 for operational costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000)\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Net Revenue per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-3:\nThe total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\n// 250 * D <= (100 * A) + (150 * B) + (200 * C)\n\n## Generate Constraint-4:\nThe total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\n// 6 * 300 * E <= (2 * 100 * A) + (3 * 150 * B) + (4 * 200 * C) + (5 * 250 * D)",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and distance for each route are given in the following Table.\n\n| Route | Cost per Mile | Distance |\n|-------|---------------|----------|\n| A     | $2            | 100 miles|\n| B     | $3            | 150 miles|\n| C     | $4            | 200 miles|\n| D     | $5            | 250 miles|\n| E     | $6            | 300 miles|\n\nThe company has a total of 50 trucks available. Each route must have at least 2 trucks. The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined. The total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\nPlease help the company to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n## The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\nmodel.addCons(250 * D <= 100 * A + 150 * B + 200 * C)\n## The total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\nmodel.addCons(6 * 300 * E <= 2 * 100 * A + 3 * 150 * B + 4 * 200 * C + 5 * 250 * D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) to transport goods. The company needs to decide how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route is influenced by the number of trucks on that route and the total number of trucks across all routes. Specifically, the cost function is defined as:\nCost_A = 1000 + 50 * TruckA + 0.1 * (TruckA^2) + 0.01 * (TruckA * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_B = 1200 + 60 * TruckB + 0.12 * (TruckB^2) + 0.01 * (TruckB * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_C = 1100 + 55 * TruckC + 0.11 * (TruckC^2) + 0.01 * (TruckC * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_D = 900 + 45 * TruckD + 0.09 * (TruckD^2) + 0.01 * (TruckD * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_E = 1300 + 65 * TruckE + 0.13 * (TruckE^2) + 0.01 * (TruckE * (TruckA + TruckB + TruckC + TruckD + TruckE))\nThe company aims to minimize the total cost of operating all trucks across all routes.\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 to allocate for truck operations.\n// 1000 * TruckA + 1200 * TruckB + 1100 * TruckC + 900 * TruckD + 1300 * TruckE <= 50000\n\n## Generate Constraint-2:\nThe company must allocate at least 10 trucks to each route.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10; TruckD >= 10; TruckE >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all routes must not exceed 50.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) to transport goods. The company needs to decide how many trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route is influenced by the number of trucks on that route and the total number of trucks across all routes. The company has a total budget of $50,000 to allocate for truck operations. The company must allocate at least 10 trucks to each route. The total number of trucks across all routes must not exceed 50.\n\nPlease help the company to minimize the total cost of operating all trucks across all routes, where the cost functions are defined as:\nCost_A = 1000 + 50 * TruckA + 0.1 * (TruckA^2) + 0.01 * (TruckA * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_B = 1200 + 60 * TruckB + 0.12 * (TruckB^2) + 0.01 * (TruckB * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_C = 1100 + 55 * TruckC + 0.11 * (TruckC^2) + 0.01 * (TruckC * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_D = 900 + 45 * TruckD + 0.09 * (TruckD^2) + 0.01 * (TruckD * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_E = 1300 + 65 * TruckE + 0.13 * (TruckE^2) + 0.01 * (TruckE * (TruckA + TruckB + TruckC + TruckD + TruckE))",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10) # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10) # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=10) # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=10) # number of trucks on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Cost functions with quadratic terms and interaction terms\nCost_A = 1000 * TruckA + 50 * TruckA**2 + 0.1 * TruckA**3 + 0.01 * TruckA * (TruckA + TruckB + TruckC + TruckD + TruckE)\nCost_B = 1200 * TruckB + 60 * TruckB**2 + 0.12 * TruckB**3 + 0.01 * TruckB * (TruckA + TruckB + TruckC + TruckD + TruckE)\nCost_C = 1100 * TruckC + 55 * TruckC**2 + 0.11 * TruckC**3 + 0.01 * TruckC * (TruckA + TruckB + TruckC + TruckD + TruckE)\nCost_D = 900 * TruckD + 45 * TruckD**2 + 0.09 * TruckD**3 + 0.01 * TruckD * (TruckA + TruckB + TruckC + TruckD + TruckE)\nCost_E = 1300 * TruckE + 65 * TruckE**2 + 0.13 * TruckE**3 + 0.01 * TruckE * (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $50,000 to allocate for truck operations.\nmodel.addCons(1000 * TruckA + 1200 * TruckB + 1100 * TruckC + 900 * TruckD + 1300 * TruckE <= 50000)\n## The total number of trucks across all routes must not exceed 50.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons.\nFor V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons.\nFor V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons.\nFor V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons.\nFor V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons.\nThe company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance).\n// Cargo_V1 = 10 * V1\n// Cargo_V2 = 15 * V2\n// Cargo_V3 = 20 * V3\n// Cargo_V4 = 25 * V4\n// Cargo_V5 = 30 * V5\n// Maintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n// So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for maintenance costs.\n// 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100.\n// V1 + V2 + V3 + V4 + V5 <= 100\n\n## Generate Constraint-3:\nThe company must transport at least 1500 tons of cargo.\n// 10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1500\n\n## Generate Constraint-4:\nThe company must have at least 5 V1 vehicles due to specific contractual obligations.\n// V1 >= 5",
        "question": "A logistics company is planning its fleet for the next quarter and has five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost per Quarter ($) | Cargo Capacity (tons) |\n|--------------|-----------------------|----------------------------------|-----------------------|\n| V1           | 10                    | 500                              | 10                    |\n| V2           | 15                    | 600                              | 15                    |\n| V3           | 20                    | 700                              | 20                    |\n| V4           | 25                    | 800                              | 25                    |\n| V5           | 30                    | 900                              | 30                    |\n\nThe company has a budget of $50,000 for maintenance costs. The total number of vehicles cannot exceed 100. The company must transport at least 1500 tons of cargo. Additionally, due to specific contractual obligations, the company must have at least 5 V1 vehicles. \n\nPlease help the company to maximize the operational efficiency, which is defined as the total cargo transported divided by the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=5)  # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0)  # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0)  # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0)  # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0)  # number of V5 vehicles\n\n# Define objective function\nCargo_V1 = 10 * V1\nCargo_V2 = 15 * V2\nCargo_V3 = 20 * V3\nCargo_V4 = 25 * V4\nCargo_V5 = 30 * V5\nMaintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n# So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Maintenance_Cost == Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5)\n\n# Add constraints\n# The company has a budget of $50,000 for maintenance costs.\nmodel.addCons(500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000)\n# The total number of vehicles cannot exceed 100.\nmodel.addCons(V1 + V2 + V3 + V4 + V5 <= 100)\n# The company must transport at least 1500 tons of cargo.\nmodel.addCons(10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1416,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\n// C + D >= 15\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5.\n// D <= E + 5",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route. The company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined. The company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C. The company also wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5. Please help the company to maximize the total efficiency of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n# The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\nmodel.addCons(C + D >= 15)\n# The company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n# The company wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5.\nmodel.addCons(D <= E + 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n// Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n// Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 machines available.\n// MachinesA + MachinesB + MachinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in technology upgrades cannot exceed $50,000.\n// TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n// QuantityA >= 500; QuantityB >= 600\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB.\n// MachinesA >= 10; MachinesB >= 15\n\n## Generate Constraint-5:\nThe production quantity of each product cannot exceed the number of machines dedicated to that product times 200.\n// QuantityA <= 200 * MachinesA; QuantityB <= 200 * MachinesB; QuantityC <= 200 * MachinesC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate. The base production rate and profit per unit for each product are given in the following Table.\n\n| Product | Base Production Rate (units/machine/day) | Profit per Unit |\n|---------|------------------------------------------|-----------------|\n| ProductA | 100                                      | $50             |\n| ProductB | 120                                      | $60             |\n| ProductC | 150                                      | $70             |\n\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The company has a total of 40 machines available. The total investment in technology upgrades cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units. The company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB. The production quantity of each product cannot exceed the number of machines dedicated to that product times 200. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=600)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=10)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=15)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0)  # technology upgrade for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # technology upgrade for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0)  # technology upgrade for ProductC\n\n# Define objective function\nProfitA = 50 * (100 + 0.05 * TechUpgradeA) * MachinesA  # Total profit for ProductA\nProfitB = 60 * (120 + 0.05 * TechUpgradeB) * MachinesB  # Total profit for ProductB\nProfitC = 70 * (150 + 0.05 * TechUpgradeC) * MachinesC  # Total profit for ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)  # Maximize (ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 40)  # Total of 40 machines available\nmodel.addCons(TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000)  # Total investment in technology upgrades cannot exceed $50,000\nmodel.addCons(QuantityA <= 200 * MachinesA)  # QuantityA <= 200 * MachinesA\nmodel.addCons(QuantityB <= 200 * MachinesB)  # QuantityB <= 200 * MachinesB\nmodel.addCons(QuantityC <= 200 * MachinesC)  # QuantityC <= 200 * MachinesC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Technology Upgrade for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Technology Upgrade for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Technology Upgrade for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1505,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions. The company needs to determine the number of trucks to allocate to each region and the number of trips each truck will make. The company also needs to decide on the fuel consumption rate for each truck, which can vary depending on the region and the load.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Region1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit, which is the total revenue from all regions minus the total fuel cost. The revenue per region is calculated as the number of trips per truck multiplied by the number of trucks in that region. The fuel cost is calculated as the product of the fuel consumption rate, the number of trips, and the number of trucks in each region.\n// Revenue_Region1 = Trips1 * Trucks1\n// Revenue_Region2 = Trips2 * Trucks2\n// Revenue_Region3 = Trips3 * Trucks3\n// Revenue_Region4 = Trips4 * Trucks4\n// Revenue_Region5 = Trips5 * Trucks5\n// FuelCost_Region1 = FuelRate1 * Trips1 * Trucks1\n// FuelCost_Region2 = FuelRate2 * Trips2 * Trucks2\n// FuelCost_Region3 = FuelRate3 * Trips3 * Trucks3\n// FuelCost_Region4 = FuelRate4 * Trips4 * Trucks4\n// FuelCost_Region5 = FuelRate5 * Trips5 * Trucks5\n// So, the objective function is: Maximize (Revenue_Region1 + Revenue_Region2 + Revenue_Region3 + Revenue_Region4 + Revenue_Region5 - FuelCost_Region1 - FuelCost_Region2 - FuelCost_Region3 - FuelCost_Region4 - FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available across all regions.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nThe total number of trips across all regions should not exceed 500.\n// Trips1 * Trucks1 + Trips2 * Trucks2 + Trips3 * Trucks3 + Trips4 * Trucks4 + Trips5 * Trucks5 <= 500",
        "question": "A logistics company is planning its routes for delivering goods to five different regions. The company needs to determine the number of trucks to allocate to each region and the number of trips each truck will make. The company also needs to decide on the fuel consumption rate for each truck, which can vary depending on the region and the load. The company aims to maximize its profit, which is the total revenue from all regions minus the total fuel cost. The revenue per region is calculated as the number of trips per truck multiplied by the number of trucks in that region. The fuel cost is calculated as the product of the fuel consumption rate, the number of trips, and the number of trucks in each region.\n\nThe company has a total of 50 trucks available across all regions. The total number of trips across all regions should not exceed 500.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks and trips for each region, as well as the fuel consumption rate for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Region5\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips per truck for Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips per truck for Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips per truck for Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips per truck for Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips per truck for Region5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0)  # fuel consumption rate for Region1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate for Region2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate for Region3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0)  # fuel consumption rate for Region4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0)  # fuel consumption rate for Region5\n\n# Define objective function\nRevenue_Region1 = Trips1 * Trucks1\nRevenue_Region2 = Trips2 * Trucks2\nRevenue_Region3 = Trips3 * Trucks3\nRevenue_Region4 = Trips4 * Trucks4\nRevenue_Region5 = Trips5 * Trucks5\nFuelCost_Region1 = FuelRate1 * Trips1 * Trucks1\nFuelCost_Region2 = FuelRate2 * Trips2 * Trucks2\nFuelCost_Region3 = FuelRate3 * Trips3 * Trucks3\nFuelCost_Region4 = FuelRate4 * Trips4 * Trucks4\nFuelCost_Region5 = FuelRate5 * Trips5 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Region1 + Revenue_Region2 + Revenue_Region3 + Revenue_Region4 + Revenue_Region5 - FuelCost_Region1 - FuelCost_Region2 - FuelCost_Region3 - FuelCost_Region4 - FuelCost_Region5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)  # total trucks constraint\nmodel.addCons(Trips1 * Trucks1 + Trips2 * Trucks2 + Trips3 * Trucks3 + Trips4 * Trucks4 + Trips5 * Trucks5 <= 500)  # total trips constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Number of Trips per Truck for Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips per Truck for Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips per Truck for Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips per Truck for Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips per Truck for Region5: \", model.getVal(Trips5))\n    print(\"Fuel Consumption Rate for Region1: \", model.getVal(FuelRate1))\n    print(\"Fuel Consumption Rate for Region2: \", model.getVal(FuelRate2))\n    print(\"Fuel Consumption Rate for Region3: \", model.getVal(FuelRate3))\n    print(\"Fuel Consumption Rate for Region4: \", model.getVal(FuelRate4))\n    print(\"Fuel Consumption Rate for Region5: \", model.getVal(FuelRate5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000\n\n## Generate Constraint-2:\nDue to space limitations, the total number of trucks cannot exceed 60.\n// SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60\n\n## Generate Constraint-3:\nThe company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations.\n// RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks)\n\n## Generate Constraint-4:\nThe company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts.\n// HeavyDutyTrucks >= 20\n\n## Generate Constraint-5:\nTo maintain a balanced fleet, the number of Large trucks should not exceed the combined number of Small and Medium trucks by more than 5.\n// LargeTrucks <= (SmallTrucks + MediumTrucks) + 5",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost and revenue per truck for each type are given in the following Table.\n\n| Truck Type         | Operational Cost | Revenue |\n|--------------------|------------------|---------|\n| Small              | $50,000          | $70,000 |\n| Medium             | $75,000          | $100,000|\n| Large              | $100,000         | $130,000|\n| Refrigerated       | $120,000         | $150,000|\n| Heavy-Duty         | $150,000         | $180,000|\n\nThe company has a budget of $5,000,000 for purchasing new trucks. Due to space limitations, the total number of trucks cannot exceed 60. The company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations. The company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts. To maintain a balanced fleet, the number of Large trucks should not exceed the combined number of Small and Medium trucks by more than 5.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60)\nmodel.addCons(RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks))\nmodel.addCons(HeavyDutyTrucks >= 20)\nmodel.addCons(LargeTrucks <= (SmallTrucks + MediumTrucks) + 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks for RouteA\": \"RouteATrucks\", \"range\": \"RouteATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"RouteBTrucks\", \"range\": \"RouteBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"RouteCTrucks\", \"range\": \"RouteCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"RouteDTrucks\", \"range\": \"RouteDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"RouteETrucks\", \"range\": \"RouteETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Consumption per Truck is 500 liters per month, and the Maintenance Cost per Truck is $1000 per month.\nFor RouteB, the Fuel Consumption per Truck is 600 liters per month, and the Maintenance Cost per Truck is $1200 per month.\nFor RouteC, the Fuel Consumption per Truck is 700 liters per month, and the Maintenance Cost per Truck is $1400 per month.\nFor RouteD, the Fuel Consumption per Truck is 800 liters per month, and the Maintenance Cost per Truck is $1600 per month.\nFor RouteE, the Fuel Consumption per Truck is 900 liters per month, and the Maintenance Cost per Truck is $1800 per month.\nThe company wants to minimize the total cost per truck, which includes both fuel and maintenance costs.\n// Total cost for RouteA: Cost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\n// Total cost for RouteB: Cost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\n// Total cost for RouteC: Cost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\n// Total cost for RouteD: Cost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\n// Total cost for RouteE: Cost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40\n\n## Generate Constraint-2:\nDue to route complexities, RouteA must have at least half as many trucks as RouteB.\n// RouteATrucks <= 0.5 * RouteBTrucks\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for maintenance costs for the month.\n// 1000 * RouteATrucks + 1200 * RouteBTrucks + 1400 * RouteCTrucks + 1600 * RouteDTrucks + 1800 * RouteETrucks <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck assigned.\n// RouteATrucks >= 1; RouteBTrucks >= 1; RouteCTrucks >= 1; RouteDTrucks >= 1; RouteETrucks >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance costs per truck for each route are given in the following Table.\n\n| Route    | Fuel Consumption per Truck (liters/month) | Maintenance Cost per Truck ($/month) |\n|----------|------------------------------------------|-------------------------------------|\n| RouteA   | 500                                      | 1000                                |\n| RouteB   | 600                                      | 1200                                |\n| RouteC   | 700                                      | 1400                                |\n| RouteD   | 800                                      | 1600                                |\n| RouteE   | 900                                      | 1800                                |\n\nThe company has a total of 40 trucks available for allocation. Due to route complexities, RouteA must have at least half as many trucks as RouteB. The company has a budget of $50,000 for maintenance costs for the month. The company wants to ensure that each route has at least one truck assigned.\n\nPlease help the company to minimize the total cost per truck, which includes both fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteATrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteATrucks\", lb=1)\nRouteBTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteBTrucks\", lb=1)\nRouteCTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteCTrucks\", lb=1)\nRouteDTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteDTrucks\", lb=1)\nRouteETrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteETrucks\", lb=1)\n\n# Define objective function\nFuelPrice = 1.5  # Assuming fuel price per liter\nCost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\nCost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\nCost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\nCost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\nCost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\nTotalCost = Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE\nTotalTrucks = RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj * TotalTrucks == TotalCost)\n\n# Add constraints\nmodel.addCons(RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40)\nmodel.addCons(RouteATrucks <= 0.5 * RouteBTrucks)\nmodel.addCons(1000 * RouteATrucks + 1200 * RouteBTrucks + 1400 * RouteCTrucks + 1600 * RouteDTrucks + 1800 * RouteETrucks <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(RouteATrucks))\n    print(\"Number of Trucks for RouteB: \", model.getVal(RouteBTrucks))\n    print(\"Number of Trucks for RouteC: \", model.getVal(RouteCTrucks))\n    print(\"Number of Trucks for RouteD: \", model.getVal(RouteDTrucks))\n    print(\"Number of Trucks for RouteE: \", model.getVal(RouteETrucks))\n    print(\"Minimized Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1451,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company wants to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// Total ton-kilometers: TonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n// So, the objective function is: Minimize Cost / TonKm\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for operational costs next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000\n\n## Generate Constraint-2:\nThe company needs to transport at least 1000 tons next month.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000\n\n## Generate Constraint-3:\nThe company can operate a maximum of 50 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-4:\nThe number of Truck E should not exceed 20% of the total number of trucks.\n// TruckE <= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-5:\nThe total capacity of Truck D and Truck E should not exceed the combined capacity of Truck A, Truck B, and Truck C.\n// (25 * TruckD + 30 * TruckE) <= (10 * TruckA + 15 * TruckB + 20 * TruckC)",
        "question": "A logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company has a total budget of $30,000 for operational costs next month. The company needs to transport at least 1000 tons next month. The company can operate a maximum of 50 trucks in total. The number of Truck E should not exceed 20% of the total number of trucks. The total capacity of Truck D and Truck E should not exceed the combined capacity of Truck A, Truck B, and Truck C.\nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of Truck D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nTonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n## the objective function is: Minimize Cost / TonKm\n## convert the division to multiplication\nmodel.addCons(obj * TonKm == Cost)\n\n# Add constraints\n## The company has a total budget of $30,000 for operational costs next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000)\n## The company needs to transport at least 1000 tons next month.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000)\n## The company can operate a maximum of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n## The number of Truck E should not exceed 20% of the total number of trucks.\nmodel.addCons(TruckE <= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n## The total capacity of Truck D and Truck E should not exceed the combined capacity of Truck A, Truck B, and Truck C.\nmodel.addCons((25 * TruckD + 30 * TruckE) <= (10 * TruckA + 15 * TruckB + 20 * TruckC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Number of Truck E: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Trucks\": \"TechUpgradeT\", \"range\": \"TechUpgradeT >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Vans\": \"TechUpgradeV\", \"range\": \"TechUpgradeV >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Bikes\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet.\n// Total efficiency for Trucks: EfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\n// Total efficiency for Vans: EfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\n// Total efficiency for Bikes: EfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n// So, the objective function is: Maximize (EfficiencyT + EfficiencyV + EfficiencyB)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle purchases and technology upgrades.\n// Cost of Trucks + Cost of Vans + Cost of Bikes + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000\n\n## Generate Constraint-2:\nThe total number of vehicles to be purchased cannot exceed 1,000.\n// Trucks + Vans + Bikes <= 1000\n\n## Generate Constraint-3:\nThe company must purchase at least 100 Trucks and 200 Vans.\n// Trucks >= 100; Vans >= 200\n\n## Generate Constraint-4:\nThe technology upgrade for any vehicle type should not exceed $50,000.\n// TechUpgradeT <= 50000\n// TechUpgradeV <= 50000\n// TechUpgradeB <= 50000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs. The operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet.\n\n| Vehicle Type | Efficiency Increase per $1,000 Tech Upgrade |\n|--------------|---------------------------------------------|\n| Trucks       | 3%                                          |\n| Vans         | 2%                                          |\n| Bikes        | 5%                                          |\n\nThe company has a budget of $500,000 for vehicle purchases and technology upgrades. The total number of vehicles to be purchased cannot exceed 1,000. The company must purchase at least 100 Trucks and 200 Vans. The technology upgrade for any vehicle type should not exceed $50,000.\n\nPlease help the company to maximize the total operational efficiency of its fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=100)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=200)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechUpgradeT = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeT\", lb=0)  # technology upgrade for Trucks\nTechUpgradeV = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeV\", lb=0)  # technology upgrade for Vans\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # technology upgrade for Bikes\n\n# Define objective function\nEfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\nEfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\nEfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EfficiencyT + EfficiencyV + EfficiencyB)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes <= 1000)\nmodel.addCons(Trucks >= 100)\nmodel.addCons(Vans >= 200)\nmodel.addCons(TechUpgradeT <= 50000)\nmodel.addCons(TechUpgradeV <= 50000)\nmodel.addCons(TechUpgradeB <= 50000)\nmodel.addCons(Trucks * 10000 + Vans * 8000 + Bikes * 500 + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Technology Upgrade for Trucks: \", model.getVal(TechUpgradeT))\n    print(\"Technology Upgrade for Vans: \", model.getVal(TechUpgradeV))\n    print(\"Technology Upgrade for Bikes: \", model.getVal(TechUpgradeB))\n    print(\"Maximized Total Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The company aims to maximize the total profit, but due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company wants to maximize the total profit from selling these devices.\n// Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\n// Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\n// Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\n// Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\n// Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for device A is $5, for device B is $7, for device C is $9, for device D is $11, and for device E is $13.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 units in total.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units.\n// A >= 50; B >= 75; C >= 100; D >= 125; E >= 150\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D.\n// E <= A + B + C + D\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of device D does not exceed twice the production of device A.\n// D <= 2 * A",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit and the cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Unit |\n|--------|-----------------|---------------|\n| A      | $10             | $5            |\n| B      | $15             | $7            |\n| C      | $20             | $9            |\n| D      | $25             | $11           |\n| E      | $30             | $13           |\n\nThe company has a budget of $10,000 for production costs. The company has a production capacity of 500 units in total. The market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units. The company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D, and that the production of device D does not exceed twice the production of device A. Due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. \n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=125) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150) # quantity of device E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.01 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.01 * (C2 - 100)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=500)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.01 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.01 * (E2 - 100)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000)\nmodel.addCons(A + B + C + D + E <= 500)\nmodel.addCons(E <= A + B + C + D)\nmodel.addCons(D <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1336,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000.\nFor wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000.\nThe company wants to minimize the Cost-Energy ratio of the installation. (The Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production.)\n// total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\n// total energy production: Energy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five identified locations: Location1, Location2, Location3, Location4, and Location5. The company needs to determine the number of solar panels and wind turbines to install at each location. The estimated energy production and cost for each type of installation are given in the following Table.\n\n| Installation Type | Energy Production per Unit | Cost per Unit |\n|-------------------|----------------------------|---------------|\n| Solar Panel       | 200 kWh                    | $1000         |\n| Wind Turbine      | 1000 kWh                   | $5000         |\n\nThe company has a budget of $100,000 for the installations. Please help the company to minimize the Cost-Energy ratio of the installation, which is defined as the total cost of the installations divided by the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of solar panels at Location4\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\nEnergy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations.\nmodel.addCons(1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Solar Panels at Location4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind))\n    print(\"Minimized Cost-Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different operational cost and efficiency. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1500 per month and can transport 1500 units of goods. Truck C has an operational cost of $2000 per month and can transport 2000 units of goods. Truck D has an operational cost of $2500 per month and can transport 2500 units of goods. Truck E has an operational cost of $3000 per month and can transport 3000 units of goods. The company aims to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks.\n// Efficiency of Truck A: Eff_A = 1000 * A / 1000\n// Efficiency of Truck B: Eff_B = 1500 * B / 1500\n// Efficiency of Truck C: Eff_C = 2000 * C / 2000\n// Efficiency of Truck D: Eff_D = 2500 * D / 2500\n// Efficiency of Truck E: Eff_E = 3000 * E / 3000\n// So, the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations next month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 10 trucks available for deployment.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 2 trucks of each type are deployed.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month. Each type of truck has a different operational cost and efficiency. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1500 per month and can transport 1500 units of goods. Truck C has an operational cost of $2000 per month and can transport 2000 units of goods. Truck D has an operational cost of $2500 per month and can transport 2500 units of goods. Truck E has an operational cost of $3000 per month and can transport 3000 units of goods. The company has a budget of $10,000 for truck operations next month and a total of 10 trucks available for deployment. The company wants to ensure that at least 2 trucks of each type are deployed. Please help the company to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2)  # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2)  # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2)  # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2)  # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2)  # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEff_A = 1000 * A / 1000\nEff_B = 1500 * B / 1500\nEff_C = 2000 * C / 2000\nEff_D = 2500 * D / 2500\nEff_E = 3000 * E / 3000\n## the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n## convert the division to multiplication\nmodel.addCons(obj == Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations next month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000)\n## The company has a total of 10 trucks available for deployment.\nmodel.addCons(A + B + C + D + E <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Transport Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons.\nTruck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons.\nTruck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons.\nThe revenue per ton-km is $0.5. The company wants to maximize the net profit per day.\n// Profit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\n// Profit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\n// Profit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a daily fuel budget of $1000.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000\n\n## Generate Constraint-2:\nThe company has a daily maintenance budget of $3000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000\n\n## Generate Constraint-3:\nThe total cargo capacity of all vehicles must not exceed 500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 500",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints. The characteristics of each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/day) | Cargo Capacity (tons) |\n|---------|-----------------------|--------------------------|-----------------------|\n| Truck A | 5                     | 100                      | 10                    |\n| Truck B | 7                     | 150                      | 15                    |\n| Truck C | 10                    | 200                      | 20                    |\n\nThe revenue per ton-km is $0.5. The company has a daily fuel budget of $1000 and a daily maintenance budget of $3000. The total cargo capacity of all vehicles must not exceed 500 tons. Please help the company to maximize the net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\nProfit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\nProfit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n# So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a daily fuel budget of $1000.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000)\n# The company has a daily maintenance budget of $3000.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000)\n# The total cargo capacity of all vehicles must not exceed 500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route. The company has a total of 50 trucks available. Please help the company to minimize the total cost of operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000\n\n## Generate Constraint-2:\nThe company has a total of 500 drivers available.\n// RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\n// RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)\n\n## Generate Constraint-4:\nThe company has a fuel budget of $50,000 per month.\n// 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company has a budget of $10 million for purchasing trucks. The company has a total of 500 drivers available. The company wants to ensure that at least 20% of the fleet is Refrigerated trucks. The company has a fuel budget of $50,000 per month.\nPlease help the company to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n## the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n## The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n## The company has a total of 500 drivers available.\nmodel.addCons(RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500)\n## The company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\nmodel.addCons(RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n## The company has a fuel budget of $50,000 per month.\nmodel.addCons(100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Heavy trucks\": \"HeavyUpgrade\", \"range\": \"HeavyUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"MediumUpgrade\", \"range\": \"MediumUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Light trucks\": \"LightUpgrade\", \"range\": \"LightUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n// Revenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\n// Revenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\n// Revenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\n// So, the objective function is: Maximize (Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades.\n// HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck. The revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n\n| Type       | Base Revenue per Month | Cost Reduction per $1000 Upgrade |\n|------------|------------------------|---------------------------------|\n| Heavy      | $5000                  | $100                           |\n| Medium     | $3000                  | $150                           |\n| Light      | $2000                  | $200                           |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades. Please help the company to maximize the total monthly revenue from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of Heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of Light trucks\nHeavyUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyUpgrade\", lb=0)  # fuel efficiency upgrade for Heavy trucks\nMediumUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumUpgrade\", lb=0)  # fuel efficiency upgrade for Medium trucks\nLightUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"LightUpgrade\", lb=0)  # fuel efficiency upgrade for Light trucks\n\n# Define objective function\nRevenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\nRevenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\nRevenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n# Add constraints\nmodel.addCons(HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Fuel Efficiency Upgrade for Heavy Trucks: \", model.getVal(HeavyUpgrade))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(MediumUpgrade))\n    print(\"Fuel Efficiency Upgrade for Light Trucks: \", model.getVal(LightUpgrade))\n    print(\"Maximized Total Monthly Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1366,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month to optimize fuel efficiency and reduce carbon emissions. Additionally, the company is considering investing in hybrid technology upgrades for each vehicle type to further improve fuel efficiency.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for TruckA\": \"HybridA\", \"range\": \"HybridA >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckB\": \"HybridB\", \"range\": \"HybridB >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckC\": \"HybridC\", \"range\": \"HybridC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for TruckA, the fuel consumption per trip decreases by 0.1 liters. For TruckB, the decrease is 0.15 liters per $1000, and for TruckC, it's 0.2 liters per $1000. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (5 - 0.0001 * HybridA) * TripsA\n// Fuel consumption for TruckB: ConsumptionB = (6 - 0.00015 * HybridB) * TripsB\n// Fuel consumption for TruckC: ConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\n// 1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2000.\n// TripsA + TripsB + TripsC <= 2000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month to optimize fuel efficiency and reduce carbon emissions. Additionally, the company is considering investing in hybrid technology upgrades for each vehicle type to further improve fuel efficiency. The fuel consumption per trip decreases by investing in hybrid technology as shown in the following Table.\n\n| Vehicle | Fuel Consumption Reduction per $1000 Investment |\n|---------|-----------------------------------------------|\n| TruckA  | 0.1 liters                                    |\n| TruckB  | 0.15 liters                                   |\n| TruckC  | 0.2 liters                                    |\n\nThe company has a total budget of $100,000 for hybrid technology upgrades and operational costs. The total number of trips across all vehicles must not exceed 2000. \n\nPlease help the company to minimize the total fuel consumption across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nHybridA = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridA\", lb=0) # investment in hybrid technology for TruckA\nHybridB = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridB\", lb=0) # investment in hybrid technology for TruckB\nHybridC = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridC\", lb=0) # investment in hybrid technology for TruckC\n\n# Define objective function\nConsumptionA = (5 - 0.0001 * HybridA) * TripsA\nConsumptionB = (6 - 0.00015 * HybridB) * TripsB\nConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n# So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n# The company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\nmodel.addCons(1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000)\n# The total number of trips across all vehicles must not exceed 2000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Hybrid Technology for TruckA: \", model.getVal(HybridA))\n    print(\"Investment in Hybrid Technology for TruckB: \", model.getVal(HybridB))\n    print(\"Investment in Hybrid Technology for TruckC: \", model.getVal(HybridC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of trucks to allocate for each type of goods and the number of trips each truck should make per day to maximize efficiency and profit.\n// {\"number of trucks for Type A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for Type A goods is $200, for Type B goods is $300, and for Type C goods is $400. The company aims to maximize the total daily profit from all types of goods.\n// Profit_A = 200 * TrucksA * TripsA\n// Profit_B = 300 * TrucksB * TripsB\n// Profit_C = 400 * TrucksC * TripsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total number of trips per day across all types of goods must not exceed 100.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of trucks to allocate for each type of goods and the number of trips each truck should make per day to maximize efficiency and profit. The profit per trip for each type of goods is given in the following Table.\n\n| Type of Goods | Profit per Trip |\n|---------------|-----------------|\n| Type A        | $200            |\n| Type B        | $300            |\n| Type C        | $400            |\n\nThe company has a total of 50 trucks available. The total number of trips per day across all types of goods must not exceed 100. Please help the company to maximize the total daily profit from all types of goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Type A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Type B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Type C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Type A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Type B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Type C\n\n# Define objective function\nProfit_A = 200 * TrucksA * TripsA\nProfit_B = 300 * TrucksB * TripsB\nProfit_C = 400 * TrucksC * TripsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The total number of trips per day across all types of goods must not exceed 100.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Type A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Type B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Type C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Type A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Type B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Type C: \", model.getVal(TripsC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency and maintenance costs associated with each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks (km/liter)\": \"SmallFuelEfficiency\", \"range\": \"SmallFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks (km/liter)\": \"LargeFuelEfficiency\", \"range\": \"LargeFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"maintenance cost per truck per month for small trucks ($)\": \"SmallMaintenanceCost\", \"range\": \"SmallMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per truck per month for medium trucks ($)\": \"MediumMaintenanceCost\", \"range\": \"MediumMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per truck per month for large trucks ($)\": \"LargeMaintenanceCost\", \"range\": \"LargeMaintenanceCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The operational cost per truck is the product of its fuel efficiency and maintenance cost.\n// OperationalCost_Small = SmallTrucks * SmallFuelEfficiency * SmallMaintenanceCost\n// OperationalCost_Medium = MediumTrucks * MediumFuelEfficiency * MediumMaintenanceCost\n// OperationalCost_Large = LargeTrucks * LargeFuelEfficiency * LargeMaintenanceCost\n// So, the objective function is: Minimize (OperationalCost_Small + OperationalCost_Medium + OperationalCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-2:\nThe total monthly maintenance cost must not exceed $50,000.\n// SmallMaintenanceCost * SmallTrucks + MediumMaintenanceCost * MediumTrucks + LargeMaintenanceCost * LargeTrucks <= 50000\n\n## Generate Constraint-3:\nThe total fuel consumption per month must not exceed 10,000 liters.\n// (1 / SmallFuelEfficiency) * SmallTrucks + (1 / MediumFuelEfficiency) * MediumTrucks + (1 / LargeFuelEfficiency) * LargeTrucks <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency and maintenance costs associated with each type of truck. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The operational cost per truck is the product of its fuel efficiency and maintenance cost. The company has a budget of $100,000 for purchasing trucks. The total monthly maintenance cost must not exceed $50,000. The total fuel consumption per month must not exceed 10,000 liters.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks to purchase, along with their respective fuel efficiencies and maintenance costs, to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallFuelEfficiency\", lb=0)\nMediumFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumFuelEfficiency\", lb=0)\nLargeFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeFuelEfficiency\", lb=0)\nSmallMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallMaintenanceCost\", lb=0)\nMediumMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumMaintenanceCost\", lb=0)\nLargeMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeMaintenanceCost\", lb=0)\n\n# Define objective function\nOperationalCost_Small = SmallTrucks * SmallFuelEfficiency * SmallMaintenanceCost\nOperationalCost_Medium = MediumTrucks * MediumFuelEfficiency * MediumMaintenanceCost\nOperationalCost_Large = LargeTrucks * LargeFuelEfficiency * LargeMaintenanceCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == OperationalCost_Small + OperationalCost_Medium + OperationalCost_Large)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\nmodel.addCons(SmallMaintenanceCost * SmallTrucks + MediumMaintenanceCost * MediumTrucks + LargeMaintenanceCost * LargeTrucks <= 50000)\nmodel.addCons((1 / SmallFuelEfficiency) * SmallTrucks + (1 / MediumFuelEfficiency) * MediumTrucks + (1 / LargeFuelEfficiency) * LargeTrucks <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallFuelEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumFuelEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeFuelEfficiency))\n    print(\"Maintenance Cost of Small Trucks: \", model.getVal(SmallMaintenanceCost))\n    print(\"Maintenance Cost of Medium Trucks: \", model.getVal(MediumMaintenanceCost))\n    print(\"Maintenance Cost of Large Trucks: \", model.getVal(LargeMaintenanceCost))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials, labor, and storage. The company also needs to decide on the number of shifts to operate in the factory to meet production demands.\n// {\"production quantity of product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of raw materials per unit for product A is $20, product B is $30, and product C is $25. The labor cost per shift is $1000. The storage cost per unit per day is $5 for all products. The company wants to maximize the total daily profit.\n// Profit_A = (50 - 20 - 5) * ProdA\n// Profit_B = (70 - 30 - 5) * ProdB\n// Profit_C = (60 - 25 - 5) * ProdC\n// Total_Labor_Cost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day for all products combined.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials, labor, and storage. The company also needs to decide on the number of shifts to operate in the factory to meet production demands. The profit per unit, cost of raw materials per unit, and storage cost per unit per day for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit | Storage Cost per Unit per Day |\n|---------|-----------------|--------------------------------|-------------------------------|\n| A       | $50             | $20                            | $5                            |\n| B       | $70             | $30                            | $5                            |\n| C       | $60             | $25                            | $5                            |\n\nThe labor cost per shift is $1000. The factory has a maximum capacity of 1000 units per day for all products combined. Please help the company to maximize the total daily profit, considering the labor cost and the constraint on the factory's production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_A = (50 - 20 - 5) * ProdA\nProfit_B = (70 - 30 - 5) * ProdB\nProfit_C = (60 - 25 - 5) * ProdC\nTotal_Labor_Cost = 1000 * NumShifts\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day for all products combined.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000\n\n## Generate Constraint-2:\nThe company aims to have at least 10 vehicles in total.\n// Trucks + Vans + Bikes + Drones >= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\n// Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones)\n\n## Generate Constraint-4:\nThe operational cost per day should not exceed $20,000.\n// Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone <= 20000\n\n## Generate Constraint-5:\nThe company needs at least 3 Drones for specialized deliveries.\n// Drones >= 3",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company has a budget of $100,000 for purchasing vehicles and aims to have at least 10 vehicles in total. The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles, and the operational cost per day should not exceed $20,000. Additionally, the company needs at least 3 Drones for specialized deliveries. Please help the company to minimize the total operational cost while ensuring efficient delivery coverage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=3)  # Drones >= 3\n\n# Define operational costs\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\n\n# Define objective function\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n# The company aims to have at least 10 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes + Drones >= 10)\n# The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\nmodel.addCons(Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones))\n# The operational cost per day should not exceed $20,000.\nmodel.addCons(Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce.\n// {\"quantity of Compact EV\": \"Compact\", \"range\": \"Compact >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sedan EV\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n// {\"quantity of SUV EV\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Compact, the profit per unit is $10,000, the production cost per unit is $20,000, and the environmental impact per unit is 10 points.\nFor Sedan, the profit per unit is $15,000, the production cost per unit is $25,000, and the environmental impact per unit is 15 points.\nFor SUV, the profit per unit is $20,000, the production cost per unit is $30,000, and the environmental impact per unit is 20 points.\nThe manufacturer wants to maximize the net profit while considering the environmental impact. The environmental impact is inversely proportional to the net profit, with a weight factor of 0.001.\n// Net_Profit_Compact = 10000 * Compact - 20000 * Compact\n// Net_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\n// Net_Profit_SUV = 20000 * SUV - 30000 * SUV\n// Environmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n// So, the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $1,000,000 for production costs.\n// 20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 50 units in terms of the number of units it can produce.\n// Compact + Sedan + SUV <= 50",
        "question": "A manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce.\nFor Compact, the profit per unit is $10,000, the production cost per unit is $20,000, and the environmental impact per unit is 10 points.\nFor Sedan, the profit per unit is $15,000, the production cost per unit is $25,000, and the environmental impact per unit is 15 points.\nFor SUV, the profit per unit is $20,000, the production cost per unit is $30,000, and the environmental impact per unit is 20 points.\nThe manufacturer wants to maximize the net profit while considering the environmental impact. The environmental impact is inversely proportional to the net profit, with a weight factor of 0.001.\nThe manufacturer has a limited production budget of $1,000,000 for production costs. The manufacturer has a production capacity of 50 units in terms of the number of units it can produce.\nPlease help the manufacturer to maximize the net profit while considering the environmental impact.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCompact = model.addVar(vtype=\"INTEGER\", name=\"Compact\", lb=0) # quantity of Compact EV\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0) # quantity of Sedan EV\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # quantity of SUV EV\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_Compact = 10000 * Compact - 20000 * Compact\nNet_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\nNet_Profit_SUV = 20000 * SUV - 30000 * SUV\nEnvironmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n## the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n## convert the subtraction to addition\nmodel.addCons(obj == Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV + 0.001 * Environmental_Impact)\n\n# Add constraints\n## The manufacturer has a limited production budget of $1,000,000 for production costs.\nmodel.addCons(20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000)\n## The manufacturer has a production capacity of 50 units in terms of the number of units it can produce.\nmodel.addCons(Compact + Sedan + SUV <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Compact EV: \", model.getVal(Compact))\n    print(\"Quantity of Sedan EV: \", model.getVal(Sedan))\n    print(\"Quantity of SUV EV: \", model.getVal(SUV))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $100, but it requires 2 units of a rare material M. For E2, the profit per unit is $150, requiring 3 units of material M. For E3, the profit per unit is $200, requiring 4 units of material M. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * E1 - 2 * E1 * M_cost\n// Profit_E2 = 150 * E2 - 3 * E2 * M_cost\n// Profit_E3 = 200 * E3 - 4 * E3 * M_cost\n// Objective function: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 200 units available.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 200\n\n## Generate Constraint-2:\nThe production line has a total available time of 150 hours. Producing E1 takes 1 hour, E2 takes 2 hours, and E3 takes 3 hours.\n// E1 + 2 * E2 + 3 * E3 <= 150",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the requirements for a rare material M and production time for each device are given in the following Table.\n\n| Device | Profit per Unit | Material M Required | Production Time |\n|--------|-----------------|---------------------|-----------------|\n| E1     | $100            | 2 units             | 1 hour          |\n| E2     | $150            | 3 units             | 2 hours         |\n| E3     | $200            | 4 units             | 3 hours         |\n\nThe manufacturer has a limited supply of material M, with only 200 units available. The production line has a total available time of 150 hours. \n\nPlease help the manufacturer to maximize the total profit, considering the constraints on material M and production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * E1 - 2 * E1 * 1 # assuming M_cost is $1 per unit\nProfit_E2 = 150 * E2 - 3 * E2 * 1 # assuming M_cost is $1 per unit\nProfit_E3 = 200 * E3 - 4 * E3 * 1 # assuming M_cost is $1 per unit\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 200) # Constraint-1: Limited supply of material M\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 150) # Constraint-2: Production time constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3\n\n## Generate Constraint-2:\nThe company has a total fleet size of 50 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $3000.\n// 1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. Each route has a specific distance that must be covered: Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route. The company has a total fleet size of 50 trucks and a total fuel budget of $3000. \n\nPlease help the company to minimize the total fuel cost while ensuring all deliveries are made.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel allocation for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel allocation for Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n# The company has a total fleet size of 50 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n# The total fuel budget for the company is $3000.\nmodel.addCons(1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n// Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck allocations and technology investments.\n// Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\n// Trucks1 >= 100; Trucks2 >= 150\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology cannot exceed 50% of the total budget allocated for each route.\n// Tech1 <= 0.5 * (Trucks1 + Tech1); Tech2 <= 0.5 * (Trucks2 + Tech2)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands.\nThe operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\nThe company has a total budget of $100,000 for both truck allocations and technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual agreements, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2. The investment in fuel-efficient technology cannot exceed 50% of the total budget allocated for each route.\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=100)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=150)  # number of trucks for Route2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n# Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n# Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n# So, the objective function is: Minimize (Cost1 + Cost2)\nCost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * model.addVar(name=\"Distance1\")\nCost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * model.addVar(name=\"Distance2\")\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n# The company has a total budget of $100,000 for both truck allocations and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000)\n# The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 <= 500)\n# Due to contractual agreements, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\nmodel.addCons(Trucks1 >= 100)\nmodel.addCons(Trucks2 >= 150)\n# The investment in fuel-efficient technology cannot exceed 50% of the total budget allocated for each route.\nmodel.addCons(Tech1 <= 0.5 * (Trucks1 + Tech1))\nmodel.addCons(Tech2 <= 0.5 * (Trucks2 + Tech2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and profit.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck generates a profit of $100 per trip, each Medium truck generates $150 per trip, each Large truck generates $200 per trip, each Extra-Large truck generates $250 per trip, and each Refrigerated truck generates $300 per trip. Due to varying operational efficiencies, the profit per trip for each type of truck decreases nonlinearly as the number of trucks of that type increases. Specifically, the profit per trip decreases by 0.1% for every additional truck of the same type. The company aims to maximize the total profit from all truck operations.\n// Profit_S = (100 - 0.1 * S) * S\n// Profit_M = (150 - 0.1 * M) * M\n// Profit_L = (200 - 0.1 * L) * L\n// Profit_XL = (250 - 0.1 * XL) * XL\n// Profit_R = (300 - 0.1 * R) * R\n// So, the objective function is: Maximize Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $500,000. The cost of each Small truck is $20,000, each Medium truck is $30,000, each Large truck is $40,000, each Extra-Large truck is $50,000, and each Refrigerated truck is $60,000.\n// 20000 * S + 30000 * M + 40000 * L + 50000 * XL + 60000 * R <= 500000\n\n## Generate Constraint-2:\nThere is a limit on the number of trucks that can be operated simultaneously due to driver availability. The company can operate at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 2 Refrigerated trucks.\n// S <= 10; M <= 8; L <= 6; XL <= 4; R <= 2",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and profit. Each Small truck generates a profit of $100 per trip, each Medium truck generates $150 per trip, each Large truck generates $200 per trip, each Extra-Large truck generates $250 per trip, and each Refrigerated truck generates $300 per trip. Due to varying operational efficiencies, the profit per trip for each type of truck decreases nonlinearly as the number of trucks of that type increases. Specifically, the profit per trip decreases by 0.1% for every additional truck of the same type. The company has a total fleet budget of $500,000. The cost of each Small truck is $20,000, each Medium truck is $30,000, each Large truck is $40,000, each Extra-Large truck is $50,000, and each Refrigerated truck is $60,000. There is a limit on the number of trucks that can be operated simultaneously due to driver availability. The company can operate at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 2 Refrigerated trucks.\n\nPlease help the company to maximize the total profit from all truck operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=10) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=8) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=6) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0, ub=4) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=2) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R\n## convert the non-linear profit function to a linear one\nProfit_S = (100 - 0.1 * S) * S\nProfit_M = (150 - 0.1 * M) * M\nProfit_L = (200 - 0.1 * L) * L\nProfit_XL = (250 - 0.1 * XL) * XL\nProfit_R = (300 - 0.1 * R) * R\nmodel.addCons(obj == Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R)\n\n# Add constraints\n## The company has a total fleet budget of $500,000.\nmodel.addCons(20000 * S + 30000 * M + 40000 * L + 50000 * XL + 60000 * R <= 500000)\n## There is a limit on the number of trucks that can be operated simultaneously due to driver availability.\nmodel.addCons(S <= 10)\nmodel.addCons(M <= 8)\nmodel.addCons(L <= 6)\nmodel.addCons(XL <= 4)\nmodel.addCons(R <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages.\n// Cost of route A: Cost_A = 100 * A\n// Cost of route B: Cost_B = 120 * B\n// Cost of route C: Cost_C = 150 * C\n// Cost of route D: Cost_D = 180 * D\n// Cost of route E: Cost_E = 200 * E\n// Delivery volume of route A: Vol_A = 50 * A\n// Delivery volume of route B: Vol_B = 60 * B\n// Delivery volume of route C: Vol_C = 70 * C\n// Delivery volume of route D: Vol_D = 80 * D\n// Delivery volume of route E: Vol_E = 90 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n\n## Generate Constraint-1:\nThe total number of trucks available is 10.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-2:\nThe total delivery volume must meet or exceed 1000 packages.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and delivery volumes for each route are given in the following Table.\n\n| Route | Operational Cost per Truck | Delivery Volume per Truck |\n|-------|----------------------------|---------------------------|\n| A     | $100                       | 50 packages               |\n| B     | $120                       | 60 packages               |\n| C     | $150                       | 70 packages               |\n| D     | $180                       | 80 packages               |\n| E     | $200                       | 90 packages               |\n\nThe company has a total of 10 trucks available. The total delivery volume must meet or exceed 1000 packages. Please help the company to minimize the total operational cost while ensuring that the total delivery volume meets or exceeds the target of 1000 packages.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 120 * B\nCost_C = 150 * C\nCost_D = 180 * D\nCost_E = 200 * E\nVol_A = 50 * A\nVol_B = 60 * B\nVol_C = 70 * C\nVol_D = 80 * D\nVol_E = 90 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available is 10.\nmodel.addCons(A + B + C + D + E <= 10)\n## The total delivery volume must meet or exceed 1000 packages.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Delivery Volume: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\n// {\"number of solar panels in Region A\": \"SolarPanels_A\", \"range\": \"SolarPanels_A >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindTurbines_A\", \"range\": \"WindTurbines_A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarPanels_B\", \"range\": \"SolarPanels_B >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindTurbines_B\", \"range\": \"WindTurbines_B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarPanels_C\", \"range\": \"SolarPanels_C >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindTurbines_C\", \"range\": \"WindTurbines_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n// Total cost in Region A: Cost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\n// Total cost in Region B: Cost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\n// Total cost in Region C: Cost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\n// Total energy production in Region A: Energy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\n// Total energy production in Region B: Energy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\n// Total energy production in Region C: Energy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total daily energy production in each region must be at least 1000 kWh.\n// Energy_A >= 1000; Energy_B >= 1000; Energy_C >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for installation costs across all regions.\n// Cost_A + Cost_B + Cost_C <= 500,000\n\n## Generate Constraint-3:\nDue to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines.\n// SolarPanels_A <= 500; WindTurbines_A <= 200\n\n## Generate Constraint-4:\nRegion B has a higher wind potential, so the number of wind turbines must be at least twice the number of solar panels.\n// WindTurbines_B >= 2 * SolarPanels_B",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\nThe total daily energy production in each region must be at least 1000 kWh. The company has a budget of $500,000 for installation costs across all regions. Due to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines. Region B has a higher wind potential, so the number of wind turbines must be at least twice the number of solar panels.\nPlease help the company to minimize the total cost of installation (Cost_A + Cost_B + Cost_C).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels_A = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_A\", lb=0)\nWindTurbines_A = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_A\", lb=0)\nSolarPanels_B = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_B\", lb=0)\nWindTurbines_B = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_B\", lb=0)\nSolarPanels_C = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_C\", lb=0)\nWindTurbines_C = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_C\", lb=0)\n\n# Define objective function\nCost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\nCost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\nCost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nEnergy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\nEnergy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\nEnergy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\nmodel.addCons(Energy_A >= 1000)\nmodel.addCons(Energy_B >= 1000)\nmodel.addCons(Energy_C >= 1000)\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 500000)\nmodel.addCons(SolarPanels_A <= 500)\nmodel.addCons(WindTurbines_A <= 200)\nmodel.addCons(WindTurbines_B >= 2 * SolarPanels_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarPanels_A))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindTurbines_A))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarPanels_B))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindTurbines_B))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarPanels_C))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindTurbines_C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"cost per kilometer for small vehicles\": \"CostPerKmSmall\", \"range\": \"CostPerKmSmall >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for medium vehicles\": \"CostPerKmMedium\", \"range\": \"CostPerKmMedium >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for large vehicles\": \"CostPerKmLarge\", \"range\": \"CostPerKmLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer.\n// Revenue_Small = 10 * SmallVehicles\n// Revenue_Medium = 15 * MediumVehicles\n// Revenue_Large = 20 * LargeVehicles\n// Operational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads.\n// LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles)",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints. The revenue generated per kilometer and the cost per kilometer for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Revenue per Kilometer | Cost per Kilometer |\n|--------------|-----------------------|--------------------|\n| Small        | $10                   | CostPerKmSmall     |\n| Medium       | $15                   | CostPerKmMedium    |\n| Large        | $20                   | CostPerKmLarge     |\n\nThe company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads. \n\nPlease help the company to maximize the total revenue minus the total operational cost per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)  # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)  # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)  # number of large vehicles\n\n# Define objective function\nRevenue_Small = 10 * SmallVehicles\nRevenue_Medium = 15 * MediumVehicles\nRevenue_Large = 20 * LargeVehicles\nOperational_Cost = SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles  # simplified operational cost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n# Add constraints\nmodel.addCons(SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles <= 10000)  # total budget constraint\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 50)  # total number of vehicles constraint\nmodel.addCons(LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles))  # large vehicles composition constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the material cost is $20, and the production time is 1 hour.\nFor Device B, the selling price is $70, the material cost is $30, and the production time is 2 hours.\nFor Device C, the selling price is $90, the material cost is $40, and the production time is 3 hours.\nFor Device D, the selling price is $110, the material cost is $50, and the production time is 4 hours.\nThe manufacturer aims to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $15,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 15000\n\n## Generate Constraint-2:\nThe manufacturer wants to produce at least 50 units of each device for the next quarter.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe manufacturer has a maximum of 1000 hours available for production in the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 1000",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Material Cost | Production Time |\n|--------|---------------|---------------|-----------------|\n| A      | 50$           | 20$           | 1 hour          |\n| B      | 70$           | 30$           | 2 hours         |\n| C      | 90$           | 40$           | 3 hours         |\n| D      | 110$          | 50$           | 4 hours         |\n\nThe manufacturer has a budget of $15,000 for material costs for the next quarter. The manufacturer wants to produce at least 50 units of each device for the next quarter. The manufacturer has a maximum of 1000 hours available for production in the next quarter. \nPlease help the manufacturer to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The manufacturer has a budget of $15,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 15000)\n## The manufacturer has a maximum of 1000 hours available for production in the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel efficiencies and maintenance costs. \nFor WarehouseA, the cost per truck is $500 per day.\nFor WarehouseB, the cost per truck is $600 per day.\nFor WarehouseC, the cost per truck is $700 per day.\nFor WarehouseD, the cost per truck is $800 per day.\nFor WarehouseE, the cost per truck is $900 per day.\nThe company wants to minimize the total daily cost of operating all trucks.\n// Total cost for WarehouseA: CostA = 500 * TrucksA\n// Total cost for WarehouseB: CostB = 600 * TrucksB\n// Total cost for WarehouseC: CostC = 700 * TrucksC\n// Total cost for WarehouseD: CostD = 800 * TrucksD\n// Total cost for WarehouseE: CostE = 900 * TrucksE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| WarehouseA | $500                  |\n| WarehouseB | $600                  | |\n| WarehouseC | $700                  |\n| WarehouseD | $800                  |\n| WarehouseE | $900                  |\n\nThe company has a total of 40 trucks available for allocation. Please help the company to minimize the total daily cost of operating all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for WarehouseE\n\n# Define objective function\nCostA = 500 * TrucksA\nCostB = 600 * TrucksB\nCostC = 700 * TrucksC\nCostD = 800 * TrucksD\nCostE = 900 * TrucksE\n# So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices.\n// Profit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R&D)) * DeviceA\n// Profit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R&D)) * DeviceB\n// Profit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R&D)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation and R&D cannot exceed $50,000.\n// Automation + R&D <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit. The production cost per unit, selling price per unit, and the impact of automation and R&D on the production cost are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Impact of Automation on Cost | Impact of R&D on Cost |\n|--------|--------------------------|------------------------|------------------------------|-----------------------|\n| DeviceA | $100                     | $200                   | $0.5 per unit of automation | $0.0001 per $1,000 R&D |\n| DeviceB | $150                     | $250                   | $0.5 per unit of automation | $0.0001 per $1,000 R&D |\n| DeviceC | $200                     | $300                   | $0.5 per unit of automation | $0.0001 per $1,000 R&D |\n\nThe company has a total production capacity of 1000 units. The total investment in automation and R&D cannot exceed $50,000. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0) # investment in R&D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R_D)) * DeviceA\nProfit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R_D)) * DeviceB\nProfit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R_D)) * DeviceC\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n## The total investment in automation and R&D cannot exceed $50,000.\nmodel.addCons(Automation + R_D <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination.\n// {\"number of trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck to D1 is $1000, to D2 is $1200, to D3 is $1500, to D4 is $1800, and to D5 is $2000. The revenue generated by sending a truck to D1 is $1500, to D2 is $1800, to D3 is $2200, to D4 is $2500, and to D5 is $2800. The company wants to maximize the profit (revenue minus cost) per truck sent.\n// Profit_D1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_D2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_D3 = (2200 * T3 - 1500 * T3) / T3\n// Profit_D4 = (2500 * T4 - 1800 * T4) / T4\n// Profit_D5 = (2800 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for sending trucks.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe company has a maximum of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe demand at D1 requires at least 5 trucks.\n// T1 >= 5\n\n## Generate Constraint-4:\nThe company must send at least twice as many trucks to D3 as to D2.\n// T3 >= 2 * T2",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination. The cost and revenue for sending a truck to each destination are given in the following Table.\n\n| Destination | Cost per Truck | Revenue per Truck |\n|-------------|----------------|-------------------|\n| D1          | $1000          | $1500             |\n| D2          | $1200          | $1800             |\n| D3          | $1500          | $2200             |\n| D4          | $1800          | $2500             |\n| D5          | $2000          | $2800             |\n\nThe company has a total budget of $100,000 for sending trucks. The company has a maximum of 100 trucks available. The demand at D1 requires at least 5 trucks. The company must send at least twice as many trucks to D3 as to D2. \nPlease help the company to maximize the profit (revenue minus cost) per truck sent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5)  # number of trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0)  # number of trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0)  # number of trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0)  # number of trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0)  # number of trucks to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_D1 = (1500 * T1 - 1000 * T1)\nProfit_D2 = (1800 * T2 - 1200 * T2)\nProfit_D3 = (2200 * T3 - 1500 * T3)\nProfit_D4 = (2500 * T4 - 1800 * T4)\nProfit_D5 = (2800 * T5 - 2000 * T5)\n## the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\n\n# Add constraints\n## The company has a total budget of $100,000 for sending trucks.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000)\n## The company has a maximum of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The demand at D1 requires at least 5 trucks.\nmodel.addCons(T1 >= 5)\n## The company must send at least twice as many trucks to D3 as to D2.\nmodel.addCons(T3 >= 2 * T2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. Route 1 has a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 has 12 - 0.12 * T2, Route 3 has 15 - 0.15 * T3, Route 4 has 11 - 0.11 * T4, and Route 5 has 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time.\n// Fuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n// Time_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n// So, the objective function is: Minimize (Fuel_Cost + Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 10 trucks.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe minimum fuel efficiency for any route must be at least 5 km/liter.\n// 10 - 0.1 * T1 >= 5; 12 - 0.12 * T2 >= 5; 15 - 0.15 * T3 >= 5; 11 - 0.11 * T4 >= 5; 9 - 0.09 * T5 >= 5\n\n## Generate Constraint-4:\nThe delivery time for any route must not exceed 20 hours.\n// 500 / T1 <= 20; 450 / T2 <= 20; 400 / T3 <= 20; 350 / T4 <= 20; 300 / T5 <= 20",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route varies with the number of trucks assigned, with Route 1 having a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 having 12 - 0.12 * T2, Route 3 having 15 - 0.15 * T3, Route 4 having 11 - 0.11 * T4, and Route 5 having 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time. The company has a total of 50 trucks available. Each route can handle a maximum of 10 trucks. The minimum fuel efficiency for any route must be at least 5 km/liter. The delivery time for any route must not exceed 20 hours.\n\nPlease help the company to minimize the total cost of fuel and time, which is defined as the sum of the fuel cost and the time cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate Fuel_Cost\nFuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n## convert the division to multiplication\nFuel_Cost = T1 * (1000 / (10 - 0.1 * T1)) + T2 * (1000 / (12 - 0.12 * T2)) + T3 * (1000 / (15 - 0.15 * T3)) + T4 * (1000 / (11 - 0.11 * T4)) + T5 * (1000 / (9 - 0.09 * T5))\n\n## calculate Time_Cost\nTime_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n## convert the division to multiplication\nTime_Cost = 500 * (1 / T1) + 450 * (1 / T2) + 400 * (1 / T3) + 350 * (1 / T4) + 300 * (1 / T5)\n\n## the objective function is: Minimize (Fuel_Cost + Time_Cost)\nmodel.addCons(obj == Fuel_Cost + Time_Cost)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## Each route can handle a maximum of 10 trucks.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n## The minimum fuel efficiency for any route must be at least 5 km/liter.\nmodel.addCons(10 - 0.1 * T1 >= 5)\nmodel.addCons(12 - 0.12 * T2 >= 5)\nmodel.addCons(15 - 0.15 * T3 >= 5)\nmodel.addCons(11 - 0.11 * T4 >= 5)\nmodel.addCons(9 - 0.09 * T5 >= 5)\n## The delivery time for any route must not exceed 20 hours.\nmodel.addCons(500 / T1 <= 20)\nmodel.addCons(450 / T2 <= 20)\nmodel.addCons(400 / T3 <= 20)\nmodel.addCons(350 / T4 <= 20)\nmodel.addCons(300 / T5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine how many units of each component to produce in the next month.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost of component A is $10 per unit, B is $15 per unit, C is $20 per unit, D is $25 per unit, and E is $30 per unit. The selling price of each component is twice its production cost. The company aims to maximize its profit, which is the difference between the total selling price and the total production cost.\n// Production cost of A: Cost_A = 10 * A\n// Production cost of B: Cost_B = 15 * B\n// Production cost of C: Cost_C = 20 * C\n// Production cost of D: Cost_D = 25 * D\n// Production cost of E: Cost_E = 30 * E\n// Selling price of A: Sell_A = 20 * A\n// Selling price of B: Sell_B = 30 * B\n// Selling price of C: Sell_C = 40 * C\n// Selling price of D: Sell_D = 50 * D\n// Selling price of E: Sell_E = 60 * E\n// Objective function: Maximize (Sell_A + Sell_B + Sell_C + Sell_D + Sell_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs next month.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine how many units of each component to produce in the next month.\nThe production cost of component A is $10 per unit, B is $15 per unit, C is $20 per unit, D is $25 per unit, and E is $30 per unit. The selling price of each component is twice its production cost. The company aims to maximize its profit, which is the difference between the total selling price and the total production cost.\nThe company has a budget of $10,000 for production costs next month.\nPlease help the company to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nCost_D = 25 * D\nCost_E = 30 * E\nSell_A = 20 * A\nSell_B = 30 * B\nSell_C = 40 * C\nSell_D = 50 * D\nSell_E = 60 * E\n# Objective function: Maximize (Sell_A + Sell_B + Sell_C + Sell_D + Sell_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Sell_A + Sell_B + Sell_C + Sell_D + Sell_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n# The company has a budget of $10,000 for production costs next month.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 625,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter.\n// Fuel_Cost_A = (0.1 - 0.001 * FuelA) * Distance_A * TruckA\n// Fuel_Cost_B = (0.12 - 0.001 * FuelB) * Distance_B * TruckB\n// Fuel_Cost_C = (0.15 - 0.001 * FuelC) * Distance_C * TruckC\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 kilometers.\n// (0.1 - 0.001 * FuelA) * Distance_A * TruckA + (0.12 - 0.001 * FuelB) * Distance_B * TruckB + (0.15 - 0.001 * FuelC) * Distance_C * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for purchasing trucks and allocating fuel.\n// TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\n// TruckA >= 10; TruckB >= 5",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands. The fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter. The total distance to be covered by all trucks is 5000 kilometers. The company has a budget of $10,000 for purchasing trucks and allocating fuel. The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)\n\n# Define objective function\nFuel_Cost_A = (0.1 - 0.001 * FuelA) * TruckA\nFuel_Cost_B = (0.12 - 0.001 * FuelB) * TruckB\nFuel_Cost_C = (0.15 - 0.001 * FuelC) * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n# Add constraints\n# The total distance to be covered by all trucks is 5000 kilometers.\nmodel.addCons((0.1 - 0.001 * FuelA) * TruckA + (0.12 - 0.001 * FuelB) * TruckB + (0.15 - 0.001 * FuelC) * TruckC == 5000)\n# The company has a budget of $10,000 for purchasing trucks and allocating fuel.\nmodel.addCons(TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000)\n# The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel efficiencies and maintenance costs. \nFor WarehouseA, the cost per truck is $500 per day.\nFor WarehouseB, the cost per truck is $600 per day.\nFor WarehouseC, the cost per truck is $700 per day.\nFor WarehouseD, the cost per truck is $800 per day.\nFor WarehouseE, the cost per truck is $900 per day.\nThe company wants to minimize the total daily cost of operating all trucks.\n// Total cost for WarehouseA: CostA = 500 * TrucksA\n// Total cost for WarehouseB: CostB = 600 * TrucksB\n// Total cost for WarehouseC: CostC = 700 * TrucksC\n// Total cost for WarehouseD: CostD = 800 * TrucksD\n// Total cost for WarehouseE: CostE = 900 * TrucksE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nEach warehouse must have at least one truck to ensure basic operations.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-3:\nDue to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA.\n// TrucksB >= 2 * TrucksA\n\n## Generate Constraint-4:\nThe total daily demand for deliveries from WarehouseC and WarehouseD combined must be met, which is 100 deliveries. Each truck can make 5 deliveries per day.\n// 5 * TrucksC + 5 * TrucksD >= 100\n\n## Generate Constraint-5:\nThe company aims to reduce carbon emissions by ensuring that the total number of trucks in WarehouseE does not exceed the combined number of trucks in WarehouseA and WarehouseB.\n// TrucksE <= TrucksA + TrucksB",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| WarehouseA | $500                   |\n| WarehouseB | $600                   |\n| WarehouseC | $700                   |\n| WarehouseD | $800                   |\n| WarehouseE | $900                   |\n\nThe company has a total of 40 trucks available for allocation. Each warehouse must have at least one truck to ensure basic operations. Due to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA. The total daily demand for deliveries from WarehouseC and WarehouseD combined must be met, which is 100 deliveries, with each truck capable of making 5 deliveries per day. The company aims to reduce carbon emissions by ensuring that the total number of trucks in WarehouseE does not exceed the combined number of trucks in WarehouseA and WarehouseB.\n\nPlease help the company to minimize the total daily cost of operating all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least one truck to ensure basic operations.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for WarehouseE\n\n# Define objective function\n## The company wants to minimize the total daily cost of operating all trucks.\nCostA = 500 * TrucksA\nCostB = 600 * TrucksB\nCostC = 700 * TrucksC\nCostD = 800 * TrucksD\nCostE = 900 * TrucksE\n## So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA.\nmodel.addCons(TrucksB >= 2 * TrucksA)\n## The total daily demand for deliveries from WarehouseC and WarehouseD combined must be met, which is 100 deliveries. Each truck can make 5 deliveries per day.\nmodel.addCons(5 * TrucksC + 5 * TrucksD >= 100)\n## The company aims to reduce carbon emissions by ensuring that the total number of trucks in WarehouseE does not exceed the combined number of trucks in WarehouseA and WarehouseB.\nmodel.addCons(TrucksE <= TrucksA + TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines, as well as determining the capacity of energy storage systems. The decision variables include the number of solar panels, wind turbines, and the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n\n| Component          | Efficiency |\n|--------------------|------------|\n| Solar Panels       | SolarEfficiency |\n| Wind Turbines      | WindEfficiency |\n\nThe total energy cost is calculated as: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n\nThe company has the following constraints:\n1. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n2. The number of solar panels and wind turbines must be non-negative integers.\n3. The capacity of energy storage systems must be non-negative.\n4. The energy consumption and energy cost per kWh must be non-negative.\n\nPlease help the company to minimize the total energy cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # efficiency of solar panels\nWindEfficiency = 0.3  # efficiency of wind turbines\nTotalEnergyDemand = 1000  # total energy demand of the company\nPricePerKWh = 0.15  # price per kWh\n## the objective function is: Minimize Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Minimized Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints.\n// {\"quantity of device 1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 4\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 5\": \"Q5\", \"range\": \"Q5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is determined by a nonlinear function of its quantity. The profit function for each device is as follows:\n- Device 1: P1 = 100 * Q1 - 0.5 * Q1^2\n- Device 2: P2 = 150 * Q2 - 0.7 * Q2^2\n- Device 3: P3 = 120 * Q3 - 0.6 * Q3^2\n- Device 4: P4 = 130 * Q4 - 0.8 * Q4^2\n- Device 5: P5 = 140 * Q5 - 0.9 * Q5^2\nThe objective is to maximize the total profit from all devices.\n// Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * Q1 - 0.5 * Q1^2) + (150 * Q2 - 0.7 * Q2^2) + (120 * Q3 - 0.6 * Q3^2) + (130 * Q4 - 0.8 * Q4^2) + (140 * Q5 - 0.9 * Q5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// Q1 + Q2 + Q3 + Q4 + Q5 <= 1000\n\n## Generate Constraint-2:\nThe production of each device must not exceed 200 units.\n// Q1 <= 200; Q2 <= 200; Q3 <= 200; Q4 <= 200; Q5 <= 200",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints. The profit from each device is determined by a nonlinear function of its quantity, as shown in the following Table.\n\n| Device | Profit Function                |\n|--------|--------------------------------|\n| 1      | P1 = 100 * Q1 - 0.5 * Q1^2     |\n| 2      | P2 = 150 * Q2 - 0.7 * Q2^2     |\n| 3      | P3 = 120 * Q3 - 0.6 * Q3^2     |\n| 4      | P4 = 130 * Q4 - 0.8 * Q4^2     |\n| 5      | P5 = 140 * Q5 - 0.9 * Q5^2     |\n\nThe objective is to maximize the total profit from all devices. The total production capacity is limited to 1000 units across all devices. Additionally, the production of each device must not exceed 200 units. Please help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=200) # quantity of device 1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0, ub=200) # quantity of device 2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0, ub=200) # quantity of device 3\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0, ub=200) # quantity of device 4\nQ5 = model.addVar(vtype=\"INTEGER\", name=\"Q5\", lb=0, ub=200) # quantity of device 5\n\n# Define objective function\n## The profit from each device is determined by a nonlinear function of its quantity.\nP1 = 100 * Q1 - 0.5 * Q1**2\nP2 = 150 * Q2 - 0.7 * Q2**2\nP3 = 120 * Q3 - 0.6 * Q3**2\nP4 = 130 * Q4 - 0.8 * Q4**2\nP5 = 140 * Q5 - 0.9 * Q5**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(Q1 + Q2 + Q3 + Q4 + Q5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device 1: \", model.getVal(Q1))\n    print(\"Quantity of Device 2: \", model.getVal(Q2))\n    print(\"Quantity of Device 3: \", model.getVal(Q3))\n    print(\"Quantity of Device 4: \", model.getVal(Q4))\n    print(\"Quantity of Device 5: \", model.getVal(Q5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years.\nType C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output.\n// EnergyOutput = 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20\n// TotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n// So, the objective function is: Minimize (TotalCost - EnergyOutput)\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of solar panels.\n// 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000\n\n## Generate Constraint-2:\nThe total energy output from the solar panels must be at least 1,000,000 kWh per year.\n// 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20 >= 1000000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. Type A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years. Type B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years. Type C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years. The city has a budget of $1,000,000 for the installation of solar panels. The total energy output from the solar panels must be at least 1,000,000 kWh per year. The city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output. Please help the city determine the number of each type of solar panel to install in each district.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergyOutput = 0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20\nTotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n## the objective function is: Minimize (TotalCost - EnergyOutput)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * EnergyOutput)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000)\n## The total energy output from the solar panels must be at least 1,000,000 kWh per year.\nmodel.addCons(0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20 >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel.\n// {\"number of solar panels for Type A\": \"PanelsA\", \"range\": \"PanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type B\": \"PanelsB\", \"range\": \"PanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type C\": \"PanelsC\", \"range\": \"PanelsC >= 0\", \"type\": \"integer\"}\n// {\"efficiency level of solar panels for Type A\": \"EfficiencyA\", \"range\": \"0 < EfficiencyA < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type B\": \"EfficiencyB\", \"range\": \"0 < EfficiencyB < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type C\": \"EfficiencyC\", \"range\": \"0 < EfficiencyC < 1\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings.\n// Cost = 1000 * (PanelsA + PanelsB + PanelsC)\n// Energy_A = 100 * PanelsA * EfficiencyA\n// Energy_B = 150 * PanelsB * EfficiencyB\n// Energy_C = 200 * PanelsC * EfficiencyC\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated must meet or exceed the total energy consumption of all buildings.\n// Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC)\n\n## Generate Constraint-2:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 1000 * (PanelsA + PanelsB + PanelsC) <= 50000\n\n## Generate Constraint-3:\nThe city has a limit on the total number of solar panels that can be installed, which is 50.\n// PanelsA + PanelsB + PanelsC <= 50\n\n## Generate Constraint-4:\nThe efficiency of solar panels must be at least 0.8 for Type A buildings.\n// EfficiencyA >= 0.8\n\n## Generate Constraint-5:\nThe efficiency of solar panels must be at least 0.7 for Type B buildings.\n// EfficiencyB >= 0.7",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel. The cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings.\n\n| Building Type | Energy Consumption per Day |\n|---------------|----------------------------|\n| Type A        | 100 kWh                    |\n| Type B        | 150 kWh                    |\n| Type C        | 200 kWh                    |\n\nThe city has a budget of $50,000 for the installation of solar panels. The city has a limit on the total number of solar panels that can be installed, which is 50. The efficiency of solar panels must be at least 0.8 for Type A buildings and at least 0.7 for Type B buildings. Please help the city to determine the optimal number of solar panels and their efficiency levels to meet these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelsA = model.addVar(vtype=\"INTEGER\", name=\"PanelsA\", lb=0) # number of solar panels for Type A\nPanelsB = model.addVar(vtype=\"INTEGER\", name=\"PanelsB\", lb=0) # number of solar panels for Type B\nPanelsC = model.addVar(vtype=\"INTEGER\", name=\"PanelsC\", lb=0) # number of solar panels for Type C\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0.8, ub=1) # efficiency level of solar panels for Type A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0.7, ub=1) # efficiency level of solar panels for Type B\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0, ub=1) # efficiency level of solar panels for Type C\n\n# Define objective function\nCost = 1000 * (PanelsA + PanelsB + PanelsC)\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n## The total energy generated must meet or exceed the total energy consumption of all buildings.\nEnergy_A = 100 * PanelsA * EfficiencyA\nEnergy_B = 150 * PanelsB * EfficiencyB\nEnergy_C = 200 * PanelsC * EfficiencyC\nmodel.addCons(Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC))\n\n## The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(1000 * (PanelsA + PanelsB + PanelsC) <= 50000)\n\n## The city has a limit on the total number of solar panels that can be installed, which is 50.\nmodel.addCons(PanelsA + PanelsB + PanelsC <= 50)\n\n## The efficiency of solar panels must be at least 0.8 for Type A buildings.\nmodel.addCons(EfficiencyA >= 0.8)\n\n## The efficiency of solar panels must be at least 0.7 for Type B buildings.\nmodel.addCons(EfficiencyB >= 0.7)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Type A: \", model.getVal(PanelsA))\n    print(\"Number of Solar Panels for Type B: \", model.getVal(PanelsB))\n    print(\"Number of Solar Panels for Type C: \", model.getVal(PanelsC))\n    print(\"Efficiency of Solar Panels for Type A: \", model.getVal(EfficiencyA))\n    print(\"Efficiency of Solar Panels for Type B: \", model.getVal(EfficiencyB))\n    print(\"Efficiency of Solar Panels for Type C: \", model.getVal(EfficiencyC))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1423,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit and the required storage space for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| P1      | $30             | 2 square meters       |\n| P2      | $40             | 3 square meters       |\n| P3      | $50             | 4 square meters       |\n\nThe company has a limited storage space of 200 square meters. Please help the company to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel efficiencies and maintenance costs. \nFor WarehouseA, the cost per truck is $500 per day.\nFor WarehouseB, the cost per truck is $600 per day.\nFor WarehouseC, the cost per truck is $700 per day.\nFor WarehouseD, the cost per truck is $800 per day.\nFor WarehouseE, the cost per truck is $900 per day.\nThe company wants to minimize the total daily cost of operating all trucks.\n// Total cost for WarehouseA: CostA = 500 * TrucksA\n// Total cost for WarehouseB: CostB = 600 * TrucksB\n// Total cost for WarehouseC: CostC = 700 * TrucksC\n// Total cost for WarehouseD: CostD = 800 * TrucksD\n// Total cost for WarehouseE: CostE = 900 * TrucksE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nEach warehouse must have at least one truck to ensure basic operations.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-3:\nDue to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA.\n// TrucksB >= 2 * TrucksA",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse, as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| WarehouseA | $500                  |\n| WarehouseB | $600                  |\n| WarehouseC | $700                  |\n| WarehouseD | $800                  |\n| WarehouseE | $900                  |\n\nThe company has a total of 40 trucks available for allocation. Each warehouse must have at least one truck to ensure basic operations. Due to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA. Please help the company to minimize the total daily cost of operating all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least one truck to ensure basic operations.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1) # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1) # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1) # number of trucks for WarehouseE\n\n# Define objective function\n## The company wants to minimize the total daily cost of operating all trucks.\nCostA = 500 * TrucksA\nCostB = 600 * TrucksB\nCostC = 700 * TrucksC\nCostD = 800 * TrucksD\nCostE = 900 * TrucksE\n## So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to contractual agreements, WarehouseB must have twice as many trucks as WarehouseA.\nmodel.addCons(TrucksB >= 2 * TrucksA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product and the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAW\", \"range\": \"ProductAW >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBW\", \"range\": \"ProductBW >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCW\", \"range\": \"ProductCW >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The labor cost per worker is $200 per day. The company wants to maximize the total daily profit.\n// Profit_ProductA = ProductAQty * 50 - ProductAW * 200\n// Profit_ProductB = ProductBQty * 70 - ProductBW * 200\n// Profit_ProductC = ProductCQty * 60 - ProductCW * 200\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAW + ProductBW + ProductCW <= 50\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductAQty >= 2 * ProductBQty\n\n## Generate Constraint-4:\nThe company has a daily operational budget of $10,000 for labor costs.\n// 200 * ProductAW + 200 * ProductBW + 200 * ProductCW <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product and the number of workers assigned to each product line. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The labor cost per worker is $200 per day. The company has a total of 50 workers available and a daily operational budget of $10,000 for labor costs. The production capacity for each product is limited: ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company wants to maximize the total daily profit. Please help the company determine the optimal production quantities and worker assignments for each product line.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\nProductAW = model.addVar(vtype=\"INTEGER\", name=\"ProductAW\", lb=0) # number of workers for ProductA\nProductBW = model.addVar(vtype=\"INTEGER\", name=\"ProductBW\", lb=0) # number of workers for ProductB\nProductCW = model.addVar(vtype=\"INTEGER\", name=\"ProductCW\", lb=0) # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - ProductAW * 200\nProfit_ProductB = ProductBQty * 70 - ProductBW * 200\nProfit_ProductC = ProductCQty * 60 - ProductCW * 200\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(ProductAW + ProductBW + ProductCW <= 50)\n# The production capacity for each product is limited.\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductAQty >= 2 * ProductBQty)\n# The company has a daily operational budget of $10,000 for labor costs.\nmodel.addCons(200 * ProductAW + 200 * ProductBW + 200 * ProductCW <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAW))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBW))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCW))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in advanced technology to enhance the efficiency of each type of installation.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region1\": \"TechInvestmentSolar1\", \"range\": \"TechInvestmentSolar1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region1\": \"TechInvestmentWind1\", \"range\": \"TechInvestmentWind1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region2\": \"TechInvestmentSolar2\", \"range\": \"TechInvestmentSolar2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region2\": \"TechInvestmentWind2\", \"range\": \"TechInvestmentWind2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region3\": \"TechInvestmentSolar3\", \"range\": \"TechInvestmentSolar3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region3\": \"TechInvestmentWind3\", \"range\": \"TechInvestmentWind3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels and wind turbines increases with the investment in advanced technology. For every $1000 invested in technology for solar panels, the energy output increases by 5 MWh. For every $1000 invested in technology for wind turbines, the energy output increases by 8 MWh. The company aims to maximize the total energy output from all regions.\n// EnergyOutputSolar1 = SolarPanels1 * (10 + 0.005 * TechInvestmentSolar1)\n// EnergyOutputWind1 = WindTurbines1 * (15 + 0.008 * TechInvestmentWind1)\n// EnergyOutputSolar2 = SolarPanels2 * (10 + 0.005 * TechInvestmentSolar2)\n// EnergyOutputWind2 = WindTurbines2 * (15 + 0.008 * TechInvestmentWind2)\n// EnergyOutputSolar3 = SolarPanels3 * (10 + 0.005 * TechInvestmentSolar3)\n// EnergyOutputWind3 = WindTurbines3 * (15 + 0.008 * TechInvestmentWind3)\n// So, the objective function is: Maximize (EnergyOutputSolar1 + EnergyOutputWind1 + EnergyOutputSolar2 + EnergyOutputWind2 + EnergyOutputSolar3 + EnergyOutputWind3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for installation and technology investments.\n// 1000 * (SolarPanels1 + WindTurbines1 + SolarPanels2 + WindTurbines2 + SolarPanels3 + WindTurbines3) + TechInvestmentSolar1 + TechInvestmentWind1 + TechInvestmentSolar2 + TechInvestmentWind2 + TechInvestmentSolar3 + TechInvestmentWind3 <= 100000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) in each region must not exceed 100.\n// SolarPanels1 + WindTurbines1 <= 100\n// SolarPanels2 + WindTurbines2 <= 100\n// SolarPanels3 + WindTurbines3 <= 100",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in advanced technology to enhance the efficiency of each type of installation. The efficiency of solar panels and wind turbines increases with the investment in advanced technology. For every $1000 invested in technology for solar panels, the energy output increases by 5 MWh. For every $1000 invested in technology for wind turbines, the energy output increases by 8 MWh. The company aims to maximize the total energy output from all regions.\n\nThe company has a total budget of $100,000 for installation and technology investments. The total number of installations (solar panels and wind turbines) in each region must not exceed 100.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to install in each region, as well as the investment in advanced technology to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nTechInvestmentSolar1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar1\", lb=0)\nTechInvestmentWind1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind1\", lb=0)\n\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nTechInvestmentSolar2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar2\", lb=0)\nTechInvestmentWind2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind2\", lb=0)\n\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nTechInvestmentSolar3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar3\", lb=0)\nTechInvestmentWind3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind3\", lb=0)\n\n# Define objective function\nEnergyOutputSolar1 = SolarPanels1 * (10 + 0.005 * TechInvestmentSolar1)\nEnergyOutputWind1 = WindTurbines1 * (15 + 0.008 * TechInvestmentWind1)\nEnergyOutputSolar2 = SolarPanels2 * (10 + 0.005 * TechInvestmentSolar2)\nEnergyOutputWind2 = WindTurbines2 * (15 + 0.008 * TechInvestmentWind2)\nEnergyOutputSolar3 = SolarPanels3 * (10 + 0.005 * TechInvestmentSolar3)\nEnergyOutputWind3 = WindTurbines3 * (15 + 0.008 * TechInvestmentWind3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar1 + EnergyOutputWind1 + EnergyOutputSolar2 + EnergyOutputWind2 + EnergyOutputSolar3 + EnergyOutputWind3)\n\n# Add constraints\nmodel.addCons(1000 * (SolarPanels1 + WindTurbines1 + SolarPanels2 + WindTurbines2 + SolarPanels3 + WindTurbines3) + TechInvestmentSolar1 + TechInvestmentWind1 + TechInvestmentSolar2 + TechInvestmentWind2 + TechInvestmentSolar3 + TechInvestmentWind3 <= 100000)\nmodel.addCons(SolarPanels1 + WindTurbines1 <= 100)\nmodel.addCons(SolarPanels2 + WindTurbines2 <= 100)\nmodel.addCons(SolarPanels3 + WindTurbines3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Tech Investment for Solar in Region1: \", model.getVal(TechInvestmentSolar1))\n    print(\"Tech Investment for Wind in Region1: \", model.getVal(TechInvestmentWind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Tech Investment for Solar in Region2: \", model.getVal(TechInvestmentSolar2))\n    print(\"Tech Investment for Wind in Region2: \", model.getVal(TechInvestmentWind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Tech Investment for Solar in Region3: \", model.getVal(TechInvestmentSolar3))\n    print(\"Tech Investment for Wind in Region3: \", model.getVal(TechInvestmentWind3))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate to each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the number of trips each truck should make per day.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $100 per trip, in RegionB is $120 per trip, in RegionC is $150 per trip, in RegionD is $130 per trip, and in RegionE is $140 per trip. The revenue generated per trip in RegionA is $200, in RegionB is $220, in RegionC is $250, in RegionD is $230, and in RegionE is $240. The company wants to maximize the total net profit per day.\n// NetProfit_RegionA = (200 - 100) * TrucksA * TripsA\n// NetProfit_RegionB = (220 - 120) * TrucksB * TripsB\n// NetProfit_RegionC = (250 - 150) * TrucksC * TripsC\n// NetProfit_RegionD = (230 - 130) * TrucksD * TripsD\n// NetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n// So, the objective function is: Maximize (NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nEach truck can make a maximum of 5 trips per day.\n// TripsA <= 5; TripsB <= 5; TripsC <= 5; TripsD <= 5; TripsE <= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate to each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the number of trips each truck should make per day. The cost of operating a truck and the revenue generated per trip for each region are given in the following Table.\n\n| Region | Cost per Trip | Revenue per Trip |\n|--------|---------------|------------------|\n| RegionA | $100         | $200             |\n| RegionB | $120         | $220             |\n| RegionC | $150         | $250             |\n| RegionD | $130         | $230             |\n| RegionE | $140         | $240             |\n\nThe company has a total of 50 trucks available. Each truck can make a maximum of 5 trips per day. The company wants to maximize the total net profit per day. Please help the company determine the optimal allocation of trucks and trips to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=5) # number of trips per truck for RegionA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=5) # number of trips per truck for RegionB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=5) # number of trips per truck for RegionC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=5) # number of trips per truck for RegionD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0, ub=5) # number of trips per truck for RegionE\n\n# Define objective function\nNetProfit_RegionA = (200 - 100) * TrucksA * TripsA\nNetProfit_RegionB = (220 - 120) * TrucksB * TripsB\nNetProfit_RegionC = (250 - 150) * TrucksC * TripsC\nNetProfit_RegionD = (230 - 130) * TrucksD * TripsD\nNetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n# So, the objective function is: Maximize (NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Each truck can make a maximum of 5 trips per day.\nmodel.addCons(TripsA <= 5)\nmodel.addCons(TripsB <= 5)\nmodel.addCons(TripsC <= 5)\nmodel.addCons(TripsD <= 5)\nmodel.addCons(TripsE <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Number of Trips per Truck for RegionA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for RegionB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for RegionC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for RegionD: \", model.getVal(TripsD))\n    print(\"Number of Trips per Truck for RegionE: \", model.getVal(TripsE))\n    print(\"Maximized Total Net Profit per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of shifts per day for each production line, and the investment in automation technology to improve production efficiency. The efficiency improvement from automation is nonlinear and varies by product type.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by 5% for every $10,000 invested in automation for ProductA, by 7% for ProductB, and by 10% for ProductC. The initial production cost per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.05 * Automation / 10000) * UnitsA) * ShiftsA\n// Total profit for ProductB: ProfitB = (225 - (150 - 0.07 * Automation / 10000) * UnitsB) * ShiftsB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.1 * Automation / 10000) * UnitsC) * ShiftsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 shifts available per day across all production lines.\n// ShiftsA + ShiftsB + ShiftsC <= 100\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nEach production line can operate for a maximum of 5 shifts per day.\n// ShiftsA <= 5; ShiftsB <= 5; ShiftsC <= 5\n\n## Generate Constraint-5:\nThe total number of units produced cannot exceed the company's storage capacity of 2000 units.\n// UnitsA + UnitsB + UnitsC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of shifts per day for each production line, and the investment in automation technology to improve production efficiency. The efficiency improvement from automation is nonlinear and varies by product type. The cost of production per unit decreases by 5% for every $10,000 invested in automation for ProductA, by 7% for ProductB, and by 10% for ProductC. The initial production cost per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n\nThe total investment in automation cannot exceed $50,000. The company has a total of 100 shifts available per day across all production lines. Due to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB. Each production line can operate for a maximum of 5 shifts per day. The total number of units produced cannot exceed the company's storage capacity of 2000 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.05 * Automation / 10000) * UnitsA) * ShiftsA\n## Total profit for ProductB: ProfitB = (225 - (150 - 0.07 * Automation / 10000) * UnitsB) * ShiftsB\n## Total profit for ProductC: ProfitC = (300 - (200 - 0.1 * Automation / 10000) * UnitsC) * ShiftsC\nProfitA = (150 - (100 - 0.05 * Automation / 10000) * UnitsA) * ShiftsA\nProfitB = (225 - (150 - 0.07 * Automation / 10000) * UnitsB) * ShiftsB\nProfitC = (300 - (200 - 0.1 * Automation / 10000) * UnitsC) * ShiftsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The company has a total of 100 shifts available per day across all production lines.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 100)\n## Each production line can operate for a maximum of 5 shifts per day.\nmodel.addCons(ShiftsA <= 5)\nmodel.addCons(ShiftsB <= 5)\nmodel.addCons(ShiftsC <= 5)\n## The total number of units produced cannot exceed the company's storage capacity of 2000 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods.\n// {\"number of trucks at Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck varies with the number of trucks at each warehouse due to congestion and route optimization. The fuel consumption per truck at Warehouse A is 0.5 + 0.01 * TrucksA liters per km, at Warehouse B is 0.45 + 0.01 * TrucksB liters per km, at Warehouse C is 0.4 + 0.01 * TrucksC liters per km, at Warehouse D is 0.35 + 0.01 * TrucksD liters per km, and at Warehouse E is 0.3 + 0.01 * TrucksE liters per km. The company wants to minimize the total daily fuel consumption across all warehouses.\n// Total fuel consumption at Warehouse A: Fuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\n// Total fuel consumption at Warehouse B: Fuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\n// Total fuel consumption at Warehouse C: Fuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\n// Total fuel consumption at Warehouse D: Fuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\n// Total fuel consumption at Warehouse E: Fuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods. The fuel consumption per truck at each warehouse varies with the number of trucks present due to congestion and route optimization. The fuel consumption per truck at each warehouse is given in the following Table.\n\n| Warehouse | Fuel Consumption per Truck (liters per km) |\n|-----------|-------------------------------------------|\n| A         | 0.5 + 0.01 * TrucksA                      |\n| B         | 0.45 + 0.01 * TrucksB                     |\n| C         | 0.4 + 0.01 * TrucksC                      |\n| D         | 0.35 + 0.01 * TrucksD                     |\n| E         | 0.3 + 0.01 * TrucksE                      |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to minimize the total daily fuel consumption across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks at Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks at Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks at Warehouse C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks at Warehouse D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks at Warehouse E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\nFuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\nFuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\nFuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\nFuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks at Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks at Warehouse C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks at Warehouse D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks at Warehouse E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to optimize its operations. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each mode of transportation, which affects the fuel consumption and operational costs.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for trains\": \"TrainTech\", \"range\": \"TrainTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for ships\": \"ShipTech\", \"range\": \"ShipTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each mode of transportation improves with the investment in fuel-efficient technologies. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost per truck trip: FuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\n// Fuel cost per train trip: FuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\n// Fuel cost per ship trip: FuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes of transportation must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500\n\n## Generate Constraint-3:\nDue to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50.\n// TruckTrips >= 100; TrainTrips >= 50\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each mode of transportation must not exceed $20,000.\n// TruckTech <= 20000; TrainTech <= 20000; ShipTech <= 20000",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the investment in fuel-efficient technologies for each mode to optimize its operations. The fuel efficiency of each mode improves with the investment in fuel-efficient technologies, reducing the fuel cost per trip. The company aims to minimize the total fuel cost of all trips.\n\nThe company has a total budget of $100,000 for transportation and technology investments. The total number of trips across all modes of transportation must not exceed 500 trips. Due to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50. The investment in fuel-efficient technology for each mode of transportation must not exceed $20,000.\n\nPlease help the company to minimize the total fuel cost of all trips, considering the constraints and the impact of investments in fuel-efficient technologies on fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=100)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=50)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for trucks\nTrainTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TrainTech\", lb=0)  # investment in fuel-efficient technology for trains\nShipTech = model.addVar(vtype=\"CONTINUOUS\", name=\"ShipTech\", lb=0)  # investment in fuel-efficient technology for ships\n\n# Define objective function\nFuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\nFuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\nFuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n# Add constraints\nmodel.addCons(100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\nmodel.addCons(TruckTech <= 20000)\nmodel.addCons(TrainTech <= 20000)\nmodel.addCons(ShipTech <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Train Tech: \", model.getVal(TrainTech))\n    print(\"Investment in Ship Tech: \", model.getVal(ShipTech))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters.\n// 5 * S + 10 * W <= 1000\n\n## Generate Constraint-3:\nThe company must ensure that at least 50 solar panels and 20 wind turbines are installed.\n// S >= 50\n// W >= 20\n\n## Generate Constraint-4:\nDue to local regulations, the number of wind turbines cannot exceed twice the number of solar panels.\n// W <= 2 * S",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production. The energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n\n| Component          | Energy Output per Unit | Space Required per Unit |\n|--------------------|------------------------|-------------------------|\n| Solar Panels (S)   | 100 kWh                | 5 square meters         |\n| Wind Turbines (W)  | 200 kWh                | 10 square meters        |\n\nThe company has a budget of $500,000 for investments in energy storage systems. The total area available for installation is limited to 1000 square meters. The company must ensure that at least 50 solar panels and 20 wind turbines are installed. Due to local regulations, the number of wind turbines cannot exceed twice the number of solar panels.\n\nPlease help the company to maximize the total energy output stored efficiently, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n## the objective function is: Maximize (Energy_output * Storage_efficiency)\n## convert the multiplication to addition\nmodel.addCons(obj == Energy_output + Storage_efficiency)\n\n# Add constraints\n## The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n## The total area available for installation is limited to 1000 square meters.\nmodel.addCons(5 * S + 10 * W <= 1000)\n## The company must ensure that at least 50 solar panels and 20 wind turbines are installed.\nmodel.addCons(S >= 50)\nmodel.addCons(W >= 20)\n## Due to local regulations, the number of wind turbines cannot exceed twice the number of solar panels.\nmodel.addCons(W <= 2 * S)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA_Quantity\", \"range\": \"MachineA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB_Quantity\", \"range\": \"MachineB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC_Quantity\", \"range\": \"MachineC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD_Quantity\", \"range\": \"MachineD_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n// Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\n// MachineB_Quantity >= 0.5 * MachineA_Quantity",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company has a total production capacity of 1000 machines per month. Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA. The company wants to maximize the total net profit. Please help the company determine the optimal production quantities for each type of machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Quantity\", lb=0)\nMachineB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Quantity\", lb=0)\nMachineC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Quantity\", lb=0)\nMachineD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineD_Quantity\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n## Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineA_Quantity\")\nsqrt_MachineB_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineB_Quantity\")\nsqrt_MachineC_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineC_Quantity\")\nsqrt_MachineD_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineD_Quantity\")\n\nmodel.addCons(sqrt_MachineA_Quantity**2 == MachineA_Quantity)\nmodel.addCons(sqrt_MachineB_Quantity**2 == MachineB_Quantity)\nmodel.addCons(sqrt_MachineC_Quantity**2 == MachineC_Quantity)\nmodel.addCons(sqrt_MachineD_Quantity**2 == MachineD_Quantity)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Quantity) * MachineA_Quantity\nProfit_B = (700 - 300 * sqrt_MachineB_Quantity) * MachineB_Quantity\nProfit_C = (900 - 400 * sqrt_MachineC_Quantity) * MachineC_Quantity\nProfit_D = (1100 - 500 * sqrt_MachineD_Quantity) * MachineD_Quantity\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000)\n\n## Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\nmodel.addCons(MachineB_Quantity >= 0.5 * MachineA_Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA_Quantity))\n    print(\"Number of MachineB: \", model.getVal(MachineB_Quantity))\n    print(\"Number of MachineC: \", model.getVal(MachineC_Quantity))\n    print(\"Number of MachineD: \", model.getVal(MachineD_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of machines to allocate to each component type to maximize efficiency.\n// {\"number of machines for component 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate for producing each component. The efficiency rates are as follows:\n- For component 1, each machine produces 10 units per hour.\n- For component 2, each machine produces 15 units per hour.\n- For component 3, each machine produces 20 units per hour.\n- For component 4, each machine produces 25 units per hour.\n- For component 5, each machine produces 30 units per hour.\nThe company aims to maximize the total production rate of all components.\n// The total production rate for component 1: P1 = 10 * M1\n// The total production rate for component 2: P2 = 15 * M2\n// The total production rate for component 3: P3 = 20 * M3\n// The total production rate for component 4: P4 = 25 * M4\n// The total production rate for component 5: P5 = 30 * M5\n// So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available.\n// M1 + M2 + M3 + M4 + M5 <= 50",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of machines to allocate to each component type to maximize efficiency. The efficiency rate of each machine for producing each component is given in the following Table.\n\n| Component | Efficiency Rate (units per hour) |\n|-----------|----------------------------------|\n| 1         | 10                               |\n| 2         | 15                               |\n| 3         | 20                               |\n| 4         | 25                               |\n| 5         | 30                               |\n\nThe company has a total of 50 machines available. Please help the company to maximize the total production rate of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of machines for component 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of machines for component 5\n\n# Define objective function\nP1 = 10 * M1 # total production rate for component 1\nP2 = 15 * M2 # total production rate for component 2\nP3 = 20 * M3 # total production rate for component 3\nP4 = 25 * M4 # total production rate for component 4\nP5 = 30 * M5 # total production rate for component 5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component 1: \", model.getVal(M1))\n    print(\"Number of Machines for Component 2: \", model.getVal(M2))\n    print(\"Number of Machines for Component 3: \", model.getVal(M3))\n    print(\"Number of Machines for Component 4: \", model.getVal(M4))\n    print(\"Number of Machines for Component 5: \", model.getVal(M5))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region (North, South, East, West) and the fuel efficiency of each truck type. The company also needs to determine the cost of maintenance per truck and the revenue generated per delivery.\n// {\"number of trucks for North\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency per truck (km/liter) for North\": \"NorthFuelEfficiency\", \"range\": \"NorthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for South\": \"SouthFuelEfficiency\", \"range\": \"SouthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for East\": \"EastFuelEfficiency\", \"range\": \"EastFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency per truck (km/liter) for West\": \"WestFuelEfficiency\", \"range\": \"WestFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for North\": \"NorthMaintenanceCost\", \"range\": \"NorthMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for South\": \"SouthMaintenanceCost\", \"range\": \"SouthMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for East\": \"EastMaintenanceCost\", \"range\": \"EastMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"cost of maintenance per truck per month for West\": \"WestMaintenanceCost\", \"range\": \"WestMaintenanceCost >= 0\", \"type\": \"real\"}\n// {\"revenue per delivery for North\": \"NorthRevenue\", \"range\": \"NorthRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for South\": \"SouthRevenue\", \"range\": \"SouthRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for East\": \"EastRevenue\", \"range\": \"EastRevenue > 0\", \"type\": \"real\"}\n// {\"revenue per delivery for West\": \"WestRevenue\", \"range\": \"WestRevenue > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its monthly profit, which is the total revenue from deliveries minus the total cost of fuel and maintenance.\n// Profit_North = NorthTrucks * NorthRevenue - NorthTrucks * (1000 / NorthFuelEfficiency) * 1.5 - NorthTrucks * NorthMaintenanceCost\n// Profit_South = SouthTrucks * SouthRevenue - SouthTrucks * (1000 / SouthFuelEfficiency) * 1.5 - SouthTrucks * SouthMaintenanceCost\n// Profit_East = EastTrucks * EastRevenue - EastTrucks * (1000 / EastFuelEfficiency) * 1.5 - EastTrucks * EastMaintenanceCost\n// Profit_West = WestTrucks * WestRevenue - WestTrucks * (1000 / WestFuelEfficiency) * 1.5 - WestTrucks * WestMaintenanceCost\n// So, the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// NorthTrucks * 20000 + SouthTrucks * 20000 + EastTrucks * 20000 + WestTrucks * 20000 <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions: North, South, East, and West. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type, as well as determine the cost of maintenance per truck and the revenue generated per delivery. The details for each region are provided in the following Table.\n\n| Region | Number of Trucks | Fuel Efficiency (km/liter) | Cost of Maintenance per Truck per Month | Revenue per Delivery |\n|--------|------------------|----------------------------|----------------------------------------|----------------------|\n| North  | NorthTrucks     | NorthFuelEfficiency        | NorthMaintenanceCost                   | NorthRevenue         |\n| South  | SouthTrucks     | SouthFuelEfficiency        | SouthMaintenanceCost                   | SouthRevenue         |\n| East   | EastTrucks      | EastFuelEfficiency         | EastMaintenanceCost                    | EastRevenue          |\n| West   | WestTrucks      | WestFuelEfficiency         | WestMaintenanceCost                    | WestRevenue          |\n\nThe company aims to maximize its monthly profit, which is the total revenue from deliveries minus the total cost of fuel and maintenance. The company has a total budget of $100,000 for purchasing trucks.\n\nPlease help the company determine the optimal number of trucks and fuel efficiency for each region to maximize its monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_North = NorthTrucks * 100 - NorthTrucks * (1000 / 10) * 1.5 - NorthTrucks * 50\nProfit_South = SouthTrucks * 120 - SouthTrucks * (1000 / 12) * 1.5 - SouthTrucks * 60\nProfit_East = EastTrucks * 110 - EastTrucks * (1000 / 11) * 1.5 - EastTrucks * 55\nProfit_West = WestTrucks * 90 - WestTrucks * (1000 / 9) * 1.5 - WestTrucks * 45\n## the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West)\nmodel.addCons(obj == Profit_North + Profit_South + Profit_East + Profit_West)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(NorthTrucks * 20000 + SouthTrucks * 20000 + EastTrucks * 20000 + WestTrucks * 20000 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West: \", model.getVal(WestTrucks))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1494,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $100, but it requires 2 units of a rare material M. For E2, the profit per unit is $150, requiring 3 units of material M. For E3, the profit per unit is $200, requiring 4 units of material M. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * E1 - 2 * E1 * M_cost\n// Profit_E2 = 150 * E2 - 3 * E2 * M_cost\n// Profit_E3 = 200 * E3 - 4 * E3 * M_cost\n// Objective function: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 200 units available.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 200\n\n## Generate Constraint-2:\nThe production line has a total available time of 150 hours. Producing E1 takes 1 hour, E2 takes 2 hours, and E3 takes 3 hours.\n// E1 + 2 * E2 + 3 * E3 <= 150\n\n## Generate Constraint-3:\nThe market demand for E1 is 50 units, and the manufacturer can only sell a maximum of 50 units of E1.\n// E1 <= 50\n\n## Generate Constraint-4:\nThe total production capacity is limited to 80 units across all devices.\n// E1 + E2 + E3 <= 80\n\n## Generate Constraint-5:\nThe manufacturer must produce at least 10 units of E2 to fulfill a contractual obligation.\n// E2 >= 10",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for E1 is $100, but it requires 2 units of a rare material M. For E2, the profit per unit is $150, requiring 3 units of material M. For E3, the profit per unit is $200, requiring 4 units of material M. The manufacturer has a limited supply of material M, with only 200 units available. The production line has a total available time of 150 hours. Producing E1 takes 1 hour, E2 takes 2 hours, and E3 takes 3 hours. The market demand for E1 is 50 units, and the manufacturer can only sell a maximum of 50 units of E1. The total production capacity is limited to 80 units across all devices. The manufacturer must produce at least 10 units of E2 to fulfill a contractual obligation.\nPlease help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=50)  # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=10, ub=80)  # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0, ub=80)  # quantity of E3\n\n# Define objective function\nM_cost = model.addVar(name=\"M_cost\")  # cost of material M\nProfit_E1 = 100 * E1 - 2 * E1 * M_cost\nProfit_E2 = 150 * E2 - 3 * E2 * M_cost\nProfit_E3 = 200 * E3 - 4 * E3 * M_cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 200)  # Constraint-1: Material M availability\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 150)  # Constraint-2: Production time\nmodel.addCons(E1 <= 50)  # Constraint-3: Market demand for E1\nmodel.addCons(E1 + E2 + E3 <= 80)  # Constraint-4: Total production capacity\nmodel.addCons(E2 >= 10)  # Constraint-5: Contractual obligation for E2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of workers to assign to each component production line to maximize efficiency and meet demand.\n// {\"number of workers on component 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on component 1 produces 10 units per hour, on component 2 produces 12 units per hour, on component 3 produces 15 units per hour, on component 4 produces 18 units per hour, and on component 5 produces 20 units per hour. The company needs to produce at least 1000 units of each component daily. The goal is to minimize the total production time while meeting the daily demand.\n// The production time for component 1: T1 = 1000 / (10 * W1)\n// The production time for component 2: T2 = 1000 / (12 * W2)\n// The production time for component 3: T3 = 1000 / (15 * W3)\n// The production time for component 4: T4 = 1000 / (18 * W4)\n// The production time for component 5: T5 = 1000 / (20 * W5)\n// So, the objective function is: Minimize max(T1, T2, T3, T4, T5)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 12 workers at a time.\n// W1 <= 12; W2 <= 12; W3 <= 12; W4 <= 12; W5 <= 12",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to determine the optimal number of workers to assign to each component production line to maximize efficiency and meet demand. The production rate of each worker on different components is given in the following Table.\n\n| Component | Units Produced per Hour by Each Worker |\n|-----------|----------------------------------------|\n| 1         | 10                                     |\n| 2         | 12                                     |\n| 3         | 15                                     |\n| 4         | 18                                     |\n| 5         | 20                                     |\n\nThe company needs to produce at least 1000 units of each component daily. The goal is to minimize the total production time while meeting the daily demand. There are a total of 50 workers available. Each production line can be staffed by up to 12 workers at a time.\n\nPlease help the company to minimize the maximum production time for any component (which is defined as the daily demand divided by the production rate per worker times the number of workers on that component).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on component 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on component 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on component 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on component 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on component 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT1 = 1000 / (10 * W1)\nT2 = 1000 / (12 * W2)\nT3 = 1000 / (15 * W3)\nT4 = 1000 / (18 * W4)\nT5 = 1000 / (20 * W5)\n## the objective function is: Minimize max(T1, T2, T3, T4, T5)\n## convert the max function to a constraint\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\nmodel.addCons(obj >= T4)\nmodel.addCons(obj >= T5)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\n## Each production line can be staffed by up to 12 workers at a time.\nmodel.addCons(W1 <= 12)\nmodel.addCons(W2 <= 12)\nmodel.addCons(W3 <= 12)\nmodel.addCons(W4 <= 12)\nmodel.addCons(W5 <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Component 1: \", model.getVal(W1))\n    print(\"Number of Workers on Component 2: \", model.getVal(W2))\n    print(\"Number of Workers on Component 3: \", model.getVal(W3))\n    print(\"Number of Workers on Component 4: \", model.getVal(W4))\n    print(\"Number of Workers on Component 5: \", model.getVal(W5))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1177,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks is 0.5 liters per kilometer, for vans is 0.3 liters per kilometer, and for motorcycles is 0.1 liters per kilometer. The total distance traveled by each type of vehicle is proportional to the number of vehicles. The company aims to minimize the total fuel consumption.\n// Total fuel consumption = 0.5 * T + 0.3 * V + 0.1 * M\n// So, the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each.\n// 2000 * T + 1500 * V + 500 * M <= 10000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands. The fuel consumption rate for each type of vehicle and their respective costs are given in the following Table.\n\n| Vehicle Type | Fuel Consumption Rate (liters/km) | Cost Each ($) |\n|--------------|-----------------------------------|---------------|\n| Trucks       | 0.5                               | 2000          |\n| Vans         | 0.3                               | 1500          |\n| Motorcycles  | 0.1                               | 500           |\n\nThe company has a budget of $10,000 to purchase vehicles. Please help the company to minimize the total fuel consumption, which is calculated as the sum of the product of the number of each type of vehicle and their respective fuel consumption rates.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\nmodel.addCons(obj == 0.5 * T + 0.3 * V + 0.1 * M)\n\n# Add constraints\n## The company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each.\nmodel.addCons(2000 * T + 1500 * V + 500 * M <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Motorcycles: \", model.getVal(M))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.\n// Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n// Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n// Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n// Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n// Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements. The operational cost per truck per kilometer, maintenance cost per truck per year, and cargo capacity for each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per km | Maintenance Cost per Year | Cargo Capacity |\n|------------|-------------------------|---------------------------|----------------|\n| T1         | $2                      | $5000                     | 10 tons        |\n| T2         | $1.5                    | $6000                     | 15 tons        |\n| T3         | $1.2                    | $7000                     | 20 tons        |\n| T4         | $1                      | $8000                     | 25 tons        |\n| T5         | $0.8                    | $9000                     | 30 tons        |\n\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met. The total cargo capacity required is 500 tons. Please help the company to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance traveled by each truck, assumed to be the same for all types\n## Total operational cost for each truck type\nCost_T1 = 2 * Distance * T1 + 5000 * T1\nCost_T2 = 1.5 * Distance * T2 + 6000 * T2\nCost_T3 = 1.2 * Distance * T3 + 7000 * T3\nCost_T4 = 1 * Distance * T4 + 8000 * T4\nCost_T5 = 0.8 * Distance * T5 + 9000 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1417,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n\n| Device | Profit per Unit | Decrease in Profit per Unit Beyond Threshold | Threshold |\n|--------|-----------------|---------------------------------------------|-----------|\n| DeviceA | $50             | $0.1                                        | 100 units  |\n| DeviceB | $70             | $0.05                                       | 200 units  |\n| DeviceC | $90             | $0.02                                       | 300 units  |\n\nThe company has a production capacity of 500 units in total. Please help the company determine the optimal number of units to produce for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1256,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (Component A, Component B, Component C, Component D, and Component E). The company wants to optimize the production process to maximize profit.\n// {\"number of units of Component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Component A is $50, for Component B is $70, for Component C is $90, for Component D is $110, and for Component E is $130. The production cost per unit for each component is a percentage of its selling price, with Component A having a cost of 40%, Component B 35%, Component C 30%, Component D 25%, and Component E 20%. The company aims to maximize the net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n// Total cost: Cost = 40% * 50A + 35% * 70B + 30% * 90C + 25% * 110D + 20% * 130E\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe raw material required for Component A is limited to 500 units, and each unit of Component A requires 1 unit of raw material.\n// A <= 500\n\n## Generate Constraint-3:\nThe production of Component E cannot exceed 20% of the total production.\n// E <= 0.2 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe company must produce at least 100 units of Component C.\n// C >= 100",
        "question": "A manufacturing company produces five different types of electronic components (Component A, Component B, Component C, Component D, and Component E). The company wants to optimize the production process to maximize profit. The profit per unit for Component A is $50, for Component B is $70, for Component C is $90, for Component D is $110, and for Component E is $130. The production cost per unit for each component is a percentage of its selling price, with Component A having a cost of 40%, Component B 35%, Component C 30%, Component D 25%, and Component E 20%. The company has a total production capacity of 1000 units across all components. The raw material required for Component A is limited to 500 units, and each unit of Component A requires 1 unit of raw material. The production of Component E cannot exceed 20% of the total production. The company must produce at least 100 units of Component C.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of Component E\n\n# Define objective function\nRevenue = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nCost = 0.4 * 50 * A + 0.35 * 70 * B + 0.3 * 90 * C + 0.25 * 110 * D + 0.2 * 130 * E\nNetProfit = Revenue - Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(A + B + C + D + E <= 1000) # Total production capacity\nmodel.addCons(A <= 500) # Raw material constraint for Component A\nmodel.addCons(E <= 0.2 * (A + B + C + D + E)) # Component E production constraint\nmodel.addCons(C >= 100) # Minimum production of Component C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route R1 is $1000, and the revenue per truck is $1500. On route R2, the cost is $1200, and the revenue is $1800. On route R3, the cost is $1400, and the revenue is $2100. On route R4, the cost is $1600, and the revenue is $2400. On route R5, the cost is $1800, and the revenue is $2700. The company aims to maximize the total net revenue (revenue minus cost) per total operational cost.\n// Net_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\n// Net_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\n// Net_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\n// Net_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\n// Net_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n// So, the objective function is: Maximize (Net_Revenue_R1 + Net_Revenue_R2 + Net_Revenue_R3 + Net_Revenue_R4 + Net_Revenue_R5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe minimum number of trucks required on route R1 is 10.\n// T1 >= 10\n\n## Generate Constraint-4:\nThe maximum number of trucks that can be efficiently managed on route R2 is 20.\n// T2 <= 20\n\n## Generate Constraint-5:\nThe company has a policy to ensure that at least 15% of the total trucks are allocated to route R3.\n// T3 >= 0.15 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and revenue potentials per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| R1    | $1000          | $1500             |\n| R2    | $1200          | $1800             |\n| R3    | $1400          | $2100             |\n| R4    | $1600          | $2400             |\n| R5    | $1800          | $2700             |\n\nThe company has a total budget of $100,000 for operational costs. The total number of trucks available is 100. The minimum number of trucks required on route R1 is 10. The maximum number of trucks that can be efficiently managed on route R2 is 20. The company has a policy to ensure that at least 15% of the total trucks are allocated to route R3. \n\nPlease help the company to maximize the total net revenue (revenue minus cost) per total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\nNet_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\nNet_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\nNet_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\nNet_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * (1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5) == (1500 * T1 - 1000 * T1) + (1800 * T2 - 1200 * T2) + (2100 * T3 - 1400 * T3) + (2400 * T4 - 1600 * T4) + (2700 * T5 - 1800 * T5))\n\n# Add constraints\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000)\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 >= 10)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 >= 0.15 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Net Revenue per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-4:\nThe production of ComponentB should be at least twice the production of ComponentA.\n// B >= 2 * A",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit. The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week. The company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit. The production of ComponentB should be at least twice the production of ComponentA. Please help the company to maximize the total profit from the production of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n# The company has a limited budget for raw materials, which is $5000 per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n# The production of ComponentB should be at least twice the production of ComponentA.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances.\nIn region 1, each truck consumes 5 liters per km.\nIn region 2, each truck consumes 7 liters per km.\nIn region 3, each truck consumes 9 liters per km.\nIn region 4, each truck consumes 11 liters per km.\nIn region 5, each truck consumes 13 liters per km.\nThe company aims to minimize the total fuel consumption while ensuring timely deliveries.\n// Fuel consumption in region 1: FC1 = 5 * T1\n// Fuel consumption in region 2: FC2 = 7 * T2\n// Fuel consumption in region 3: FC3 = 9 * T3\n// Fuel consumption in region 4: FC4 = 11 * T4\n// Fuel consumption in region 5: FC5 = 13 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs.\n// 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company must ensure that at least 10 trucks are allocated to each region.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. Each truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances. In region 1, each truck consumes 5 liters per km. In region 2, each truck consumes 7 liters per km. In region 3, each truck consumes 9 liters per km. In region 4, each truck consumes 11 liters per km. In region 5, each truck consumes 13 liters per km. The company aims to minimize the total fuel consumption while ensuring timely deliveries. The company has a total budget of $50,000 for fuel costs. The company must ensure that at least 10 trucks are allocated to each region. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each region.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks in region 5\n\n# Define objective function\n## Fuel consumption in region 1: FC1 = 5 * T1\n## Fuel consumption in region 2: FC2 = 7 * T2\n## Fuel consumption in region 3: FC3 = 9 * T3\n## Fuel consumption in region 4: FC4 = 11 * T4\n## Fuel consumption in region 5: FC5 = 13 * T5\n## So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs.\nmodel.addCons(5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company aims to maximize the total daily deliveries while minimizing the total cost.\n// TotalCost = 100 * T + 50 * V + 10 * B\n// TotalDeliveries = 100 * T + 75 * V + 20 * B\n// So, the objective function is: Minimize (TotalCost - TotalDeliveries)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for vehicle operations.\n// 100 * T + 50 * V + 10 * B <= 5000\n\n## Generate Constraint-2:\nThere is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total.\n// T + V + B <= 100\n\n## Generate Constraint-3:\nThe company has a daily delivery target of 5000 deliveries.\n// 100 * T + 75 * V + 20 * B >= 5000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company has a budget of $5000 per day for vehicle operations. There is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total. The company has a daily delivery target of 5000 deliveries. Please help the company to minimize the difference between the total cost and the total daily deliveries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T + 50 * V + 10 * B\nTotalDeliveries = 100 * T + 75 * V + 20 * B\n## the objective function is: Minimize (TotalCost - TotalDeliveries)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * TotalDeliveries)\n\n# Add constraints\n## The company has a budget of $5000 per day for vehicle operations.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 5000)\n## There is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total.\nmodel.addCons(T + V + B <= 100)\n## The company has a daily delivery target of 5000 deliveries.\nmodel.addCons(100 * T + 75 * V + 20 * B >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Cost-Efficiency Difference: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\n// Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\n// Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed half of the total production.\n// UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company has a monthly production capacity of 500 units in total. Due to market saturation, the production of DeviceA should not exceed half of the total production. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with min function\n## create piecewise variables for piecewise function: Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=1000)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nmodel.addCons(A1 <= 1000 - 5 * UnitsA)\nmodel.addCons(A2 <= UnitsA)\nProfit_A = (100 - 50) * A1 * A_b1 + (100 - 50) * A2 * A_b2\n\n## create piecewise variables for piecewise function: Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nmodel.addCons(B1 <= 1500 - 10 * UnitsB)\nmodel.addCons(B2 <= UnitsB)\nProfit_B = (120 - 70) * B1 * B_b1 + (120 - 70) * B2 * B_b2\n\n## create piecewise variables for piecewise function: Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=2000)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=2000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nmodel.addCons(C1 <= 2000 - 15 * UnitsC)\nmodel.addCons(C2 <= UnitsC)\nProfit_C = (150 - 80) * C1 * C_b1 + (150 - 80) * C2 * C_b2\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company wants to maximize the total profit per liter of fuel consumed.\n// Profit_TruckA = (2 - 0.5) * Distance_TruckA / 10\n// Profit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\n// Profit_TruckC = (3 - 0.7) * Distance_TruckC / 15\n// Profit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\n// Profit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n// Distance_TruckA = TruckA * Average_Distance\n// Distance_TruckB = TruckB * Average_Distance\n// Distance_TruckC = TruckC * Average_Distance\n// Distance_TruckD = TruckD * Average_Distance\n// Distance_TruckE = TruckE * Average_Distance\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season. The fuel efficiency, maintenance cost per km, and revenue per km for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/l) | Maintenance Cost per km | Revenue per km |\n|-------|-----------------------|-------------------------|----------------|\n| TruckA | 10 | $0.5 | $2 |\n| TruckB | 12 | $0.6 | $2.5 |\n| TruckC | 15 | $0.7 | $3 |\n| TruckD | 18 | $0.8 | $3.5 |\n| TruckE | 20 | $0.9 | $4 |\n\nThe company wants to maximize the total profit per liter of fuel consumed. The company has a total of 100 trucks available for deployment. Please help the company determine the optimal number of each type of truck to deploy to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define distances and profits\nAverage_Distance = model.addVar(vtype=\"CONTINUOUS\", name=\"Average_Distance\")\nDistance_TruckA = TruckA * Average_Distance\nDistance_TruckB = TruckB * Average_Distance\nDistance_TruckC = TruckC * Average_Distance\nDistance_TruckD = TruckD * Average_Distance\nDistance_TruckE = TruckE * Average_Distance\n\nProfit_TruckA = (2 - 0.5) * Distance_TruckA / 10\nProfit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\nProfit_TruckC = (3 - 0.7) * Distance_TruckC / 15\nProfit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\nProfit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TruckA + TruckB + TruckC + TruckD + TruckE) == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of truck varies. T1 costs $100,000 with a fuel efficiency of 5 km/l, T2 costs $120,000 with a fuel efficiency of 6 km/l, T3 costs $150,000 with a fuel efficiency of 7 km/l, T4 costs $180,000 with a fuel efficiency of 8 km/l, and T5 costs $200,000 with a fuel efficiency of 9 km/l. The company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost.\n// Total purchase cost: PurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\n// Total annual fuel cost: FuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n// AnnualDistance is the total distance the company expects to cover in a year, and FuelPrice is the cost per liter of fuel.\n// So, the objective function is: Minimize (PurchaseCost + FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000",
        "question": "A logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase. The cost of purchasing and maintaining each type of truck varies, as shown in the following Table.\n\n| Truck Type | Purchase Cost | Fuel Efficiency |\n|------------|---------------|-----------------|\n| T1         | $100,000      | 5 km/l          |\n| T2         | $120,000      | 6 km/l          |\n| T3         | $150,000      | 7 km/l          |\n| T4         | $180,000      | 8 km/l          |\n| T5         | $200,000      | 9 km/l          |\n\nThe company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost. The annual fuel cost is calculated based on the fuel efficiency of each truck type and the total distance the company expects to cover in a year, divided by the cost per liter of fuel. The company has a budget of $10 million for purchasing trucks.\n\nPlease help the company determine the optimal number of each type of truck to purchase to minimize the total cost of ownership.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nPurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\nAnnualDistance = 100000  # Assuming a fixed annual distance for simplicity\nFuelPrice = 1.5  # Assuming a fixed fuel price per liter\nFuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n## the objective function is: Minimize (PurchaseCost + FuelCost)\nmodel.addCons(obj == PurchaseCost + FuelCost)\n\n# Add constraints\n## The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company operates in a region with five major cities (City1, City2, City3, City4, City5) and needs to determine the number of trips to each city to optimize its operational efficiency and profit. Additionally, the company is considering investing in fuel-efficient vehicles to reduce fuel costs, which is a significant factor in the total operational cost.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient vehicles\": \"FuelEfficiencyInvestment\", \"range\": \"FuelEfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each trip is affected by the fuel efficiency of the vehicles. The initial cost per trip to City1 is $1000, City2 is $1200, City3 is $1500, City4 is $1300, and City5 is $1400. With the investment in fuel-efficient vehicles, the cost per trip decreases by 1% for every $1000 invested. The company aims to minimize the total operational cost while considering the investment in fuel-efficient vehicles.\n// Total cost for City1: Cost1 = (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1\n// Total cost for City2: Cost2 = (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2\n// Total cost for City3: Cost3 = (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3\n// Total cost for City4: Cost4 = (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4\n// Total cost for City5: Cost5 = (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles.\n// (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1 + (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2 + (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3 + (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4 + (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5 + FuelEfficiencyInvestment <= 500000\n\n## Generate Constraint-2:\nThe company must make at least 50 trips to City1 and 30 trips to City3.\n// Trips1 >= 50; Trips3 >= 30\n\n## Generate Constraint-3:\nThe total number of trips across all cities must not exceed 200.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 200",
        "question": "A logistics company is planning its delivery routes for the next quarter in a region with five major cities (City1, City2, City3, City4, City5). The company needs to determine the number of trips to each city and the investment in fuel-efficient vehicles to optimize its operational efficiency and profit. The initial cost per trip and the impact of fuel-efficient vehicles on these costs are detailed in the following Table.\n\n| City | Initial Cost per Trip | Impact of Fuel-Efficient Vehicles |\n|------|----------------------|-----------------------------------|\n| City1 | $1000               | 1% decrease per $1000 invested    |\n| City2 | $1200               | 1% decrease per $1000 invested    |\n| City3 | $1500               | 1% decrease per $1000 invested    |\n| City4 | $1300               | 1% decrease per $1000 invested    |\n| City5 | $1400               | 1% decrease per $1000 invested    |\n\nThe company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles. The company must make at least 50 trips to City1 and 30 trips to City3. The total number of trips across all cities must not exceed 200. \n\nPlease help the company to minimize the total operational cost while considering the investment in fuel-efficient vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nFuelEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyInvestment\", lb=0) # investment in fuel-efficient vehicles\n\n# Define objective function\nCost1 = (1000 - 0.001 * FuelEfficiencyInvestment) * Trips1\nCost2 = (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2\nCost3 = (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3\nCost4 = (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4\nCost5 = (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a budget of $500,000 for operational costs and investments in fuel-efficient vehicles.\nmodel.addCons((1000 - 0.001 * FuelEfficiencyInvestment) * Trips1 + \n              (1200 - 0.001 * FuelEfficiencyInvestment) * Trips2 + \n              (1500 - 0.001 * FuelEfficiencyInvestment) * Trips3 + \n              (1300 - 0.001 * FuelEfficiencyInvestment) * Trips4 + \n              (1400 - 0.001 * FuelEfficiencyInvestment) * Trips5 + \n              FuelEfficiencyInvestment <= 500000)\n\n# The company must make at least 50 trips to City1 and 30 trips to City3.\nmodel.addCons(Trips1 >= 50)\nmodel.addCons(Trips3 >= 30)\n\n# The total number of trips across all cities must not exceed 200.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Number of Trips to City4: \", model.getVal(Trips4))\n    print(\"Number of Trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in Fuel-Efficient Vehicles: \", model.getVal(FuelEfficiencyInvestment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"HydroPlants\", \"range\": \"HydroPlants >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"BiomassGenerators\", \"range\": \"BiomassGenerators >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal stations\": \"GeothermalStations\", \"range\": \"GeothermalStations >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city wants to minimize the cost per unit of energy produced.\n// Total cost: Cost = 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations\n// Total energy produced: Energy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for installing renewable energy sources.\n// 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations <= 1,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 30,000 MWh of energy annually.\n// 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations >= 30,000",
        "question": "A city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city has a budget of $1,000,000 for installing renewable energy sources. The city aims to produce at least 30,000 MWh of energy annually.\nPlease help the city to minimize the cost per unit of energy produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)\nHydroPlants = model.addVar(vtype=\"INTEGER\", name=\"HydroPlants\", lb=0)\nBiomassGenerators = model.addVar(vtype=\"INTEGER\", name=\"BiomassGenerators\", lb=0)\nGeothermalStations = model.addVar(vtype=\"INTEGER\", name=\"GeothermalStations\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 10000 * SolarPanels + 15000 * WindTurbines + 20000 * HydroPlants + 12000 * BiomassGenerators + 25000 * GeothermalStations\nEnergy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for installing renewable energy sources.\nmodel.addCons(Cost <= 1000000)\n## The city aims to produce at least 30,000 MWh of energy annually.\nmodel.addCons(Energy >= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(HydroPlants))\n    print(\"Number of Biomass Generators: \", model.getVal(BiomassGenerators))\n    print(\"Number of Geothermal Stations: \", model.getVal(GeothermalStations))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EffA\", \"range\": \"EffA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EffB\", \"range\": \"EffB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EffC\", \"range\": \"EffC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency enhancements. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - 100 + 0.001 * EffA) * QA\n// ProfitB = (200 - 150 + 0.0015 * EffB) * QB\n// ProfitC = (250 - 200 + 0.002 * EffC) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// EffA + EffB + EffC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA.\n// QA <= 1000\n\n## Generate Constraint-4:\nDue to resource limitations, the production of ProductB cannot exceed 2000 units.\n// QB <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit. The production cost per unit, selling price per unit, and the effect of efficiency investment on the production cost are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Efficiency Investment Effect |\n|---------|--------------------------|------------------------|------------------------------|\n| ProductA | $100                    | $150                   | $1 decrease per $1000 invested |\n| ProductB | $150                    | $200                   | $1.5 decrease per $1000 invested |\n| ProductC | $200                    | $250                   | $2 decrease per $1000 invested |\n\nThe company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. The market demand for ProductA is 1000 units, and the production of ProductB cannot exceed 2000 units. \nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=1000) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=2000) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nEffA = model.addVar(vtype=\"CONTINUOUS\", name=\"EffA\", lb=0) # investment in efficiency for ProductA\nEffB = model.addVar(vtype=\"CONTINUOUS\", name=\"EffB\", lb=0) # investment in efficiency for ProductB\nEffC = model.addVar(vtype=\"CONTINUOUS\", name=\"EffC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.001 * EffA) * QA\nProfitB = (200 - 150 + 0.0015 * EffB) * QB\nProfitC = (250 - 200 + 0.002 * EffC) * QC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EffA + EffB + EffC <= 100000) # total budget for efficiency enhancements\nmodel.addCons(QA + QB + QC <= 5000) # total production capacity\nmodel.addCons(QA <= 1000) # market demand for ProductA\nmodel.addCons(QB <= 2000) # resource limitation for ProductB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EffA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EffB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EffC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city to maximize profit. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck, which affects the fuel cost per trip.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for each truck\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The company aims to maximize the total profit from all trips.\n// Total profit for City1: Profit1 = (1000 - 0.05 * TechInvestment) * Trips1\n// Total profit for City2: Profit2 = (1200 - 0.05 * TechInvestment) * Trips2\n// Total profit for City3: Profit3 = (1500 - 0.05 * TechInvestment) * Trips3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and technology investments.\n// 0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000\n\n## Generate Constraint-2:\nThe company's fleet can make a maximum of 500 trips in total.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2.\n// Trips1 >= 100; Trips2 >= 150\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology should not exceed $10,000 per truck.\n// TechInvestment <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city and the investment in fuel-efficient technologies for each truck to maximize profit. The profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The following table summarizes the profit per trip and the impact of technology investment on fuel cost.\n\n| City       | Profit per Trip | Impact of Tech Investment on Fuel Cost |\n|------------|-----------------|---------------------------------------|\n| City1      | $1000           | $50 decrease per $1000 invested       |\n| City2      | $1200           | $50 decrease per $1000 invested       |\n| City3      | $1500           | $50 decrease per $1000 invested       |\n\nThe company has a total budget of $50,000 for fuel and technology investments. The company's fleet can make a maximum of 500 trips in total. Due to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2. The investment in fuel-efficient technology should not exceed $10,000 per truck.\n\nPlease help the company to maximize the total profit from all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to City3\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in fuel-efficient technology\n\n# Define objective function\nProfit1 = (1000 - 0.05 * TechInvestment) * Trips1\nProfit2 = (1200 - 0.05 * TechInvestment) * Trips2\nProfit3 = (1500 - 0.05 * TechInvestment) * Trips3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\nmodel.addCons(0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\nmodel.addCons(Trips1 >= 100)\nmodel.addCons(Trips2 >= 150)\nmodel.addCons(TechInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Investment in fuel-efficient technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance.\n// {\"number of solar panels in Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"SE\", \"range\": \"SE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city aims to maximize the total energy production while minimizing the total cost of installation and maintenance.\n// Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n// Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n// So, the objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all zones is limited to 200.\n// SA + SB + SC + SD + SE <= 200",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance. The efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city has a budget of $100,000 for the installation and maintenance of solar panels. The total number of solar panels that can be installed across all zones is limited to 200. Please help the city to maximize the total energy production while minimizing the total cost of installation and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of solar panels in Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of solar panels in Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of solar panels in Zone C\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of solar panels in Zone D\nSE = model.addVar(vtype=\"INTEGER\", name=\"SE\", lb=0) # number of solar panels in Zone E\n\n# Define objective function\n## Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n## Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n## So, the objective function is: Maximize (Energy - Cost)\nEnergy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\nCost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000)\n## The total number of solar panels that can be installed across all zones is limited to 200.\nmodel.addCons(SA + SB + SC + SD + SE <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(SA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(SB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(SC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(SD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(SE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the operating cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the purchase cost is $50,000.\nFor TruckB, the operating cost per mile is $3, the fuel efficiency is 7 miles per gallon, and the purchase cost is $60,000.\nFor TruckC, the operating cost per mile is $4, the fuel efficiency is 6 miles per gallon, and the purchase cost is $70,000.\nFor TruckD, the operating cost per mile is $5, the fuel efficiency is 8 miles per gallon, and the purchase cost is $80,000.\nFor TruckE, the operating cost per mile is $6, the fuel efficiency is 10 miles per gallon, and the purchase cost is $90,000.\nThe company wants to minimize the total cost per mile, which includes both the operating and the depreciation cost (calculated as purchase cost divided by the expected lifetime mileage of 200,000 miles).\n// Total cost per mile for TruckA: Cost_TruckA = (2 + 50000 / 200000) * TruckA\n// Total cost per mile for TruckB: Cost_TruckB = (3 + 60000 / 200000) * TruckB\n// Total cost per mile for TruckC: Cost_TruckC = (4 + 70000 / 200000) * TruckC\n// Total cost per mile for TruckD: Cost_TruckD = (5 + 80000 / 200000) * TruckD\n// Total cost per mile for TruckE: Cost_TruckE = (6 + 90000 / 200000) * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 5000000\n\n## Generate Constraint-2:\nThe company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month.\n// 5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE >= 1000000\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\nFor TruckA, the operating cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the purchase cost is $50,000.\nFor TruckB, the operating cost per mile is $3, the fuel efficiency is 7 miles per gallon, and the purchase cost is $60,000.\nFor TruckC, the operating cost per mile is $4, the fuel efficiency is 6 miles per gallon, and the purchase cost is $70,000.\nFor TruckD, the operating cost per mile is $5, the fuel efficiency is 8 miles per gallon, and the purchase cost is $80,000.\nFor TruckE, the operating cost per mile is $6, the fuel efficiency is 10 miles per gallon, and the purchase cost is $90,000.\nThe company has a budget of $5,000,000 for purchasing new trucks. The company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month. Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nPlease help the company to minimize the total cost per mile, which includes both the operating and the depreciation cost (calculated as purchase cost divided by the expected lifetime mileage of 200,000 miles).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (2 + 50000 / 200000) * TruckA\nCost_TruckB = (3 + 60000 / 200000) * TruckB\nCost_TruckC = (4 + 70000 / 200000) * TruckC\nCost_TruckD = (5 + 80000 / 200000) * TruckD\nCost_TruckE = (6 + 90000 / 200000) * TruckE\nFleetEfficiency = 5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / FleetEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * FleetEfficiency == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing new trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 5000000)\n## The company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE >= 1000000)\n## Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nmodel.addCons(TruckC <= TruckA + TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1314,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TypeA trucks\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeB trucks\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeC trucks\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck type decreases with the investment in fuel efficiency technologies. The fuel consumption reduction is nonlinear, with diminishing returns as more investment is made. The initial fuel consumption for TypeA trucks is 50 liters per 100 km, for TypeB trucks is 60 liters per 100 km, and for TypeC trucks is 70 liters per 100 km. For every $1000 invested in efficiency, TypeA trucks reduce consumption by 1 liter per 100 km, TypeB by 1.5 liters per 100 km, and TypeC by 2 liters per 100 km. The company aims to minimize the total fuel consumption across all truck types.\n// Fuel consumption for TypeA: ConsumptionA = 50 - 0.001 * EfficiencyA\n// Fuel consumption for TypeB: ConsumptionB = 60 - 0.0015 * EfficiencyB\n// Fuel consumption for TypeC: ConsumptionC = 70 - 0.002 * EfficiencyC\n// Total fuel consumption: TotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n// So, the objective function is: Minimize TotalConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments.\n// TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 500.\n// TrucksA + TrucksB + TrucksC <= 500\n\n## Generate Constraint-3:\nDue to regional demand, the company must allocate at least 50 TypeA trucks and 100 TypeB trucks.\n// TrucksA >= 50; TrucksB >= 100\n\n## Generate Constraint-4:\nThe maximum investment in fuel efficiency for any truck type cannot exceed $20,000.\n// EfficiencyA <= 20000; EfficiencyB <= 20000; EfficiencyC <= 20000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs. The initial fuel consumption and the reduction in consumption per $1000 invested in efficiency for each truck type are given in the following Table.\n\n| Truck Type | Initial Fuel Consumption (liters/100 km) | Reduction in Consumption per $1000 (liters/100 km) |\n|------------|------------------------------------------|-----------------------------------------------------|\n| TypeA      | 50                                       | 1                                                   |\n| TypeB      | 60                                       | 1.5                                                 |\n| TypeC      | 70                                       | 2                                                   |\n\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 500. Due to regional demand, the company must allocate at least 50 TypeA trucks and 100 TypeB trucks. The maximum investment in fuel efficiency for any truck type cannot exceed $20,000. \n\nPlease help the company to minimize the total fuel consumption across all truck types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=50)  # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=100)  # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of TypeC trucks\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for TypeA trucks\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for TypeB trucks\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for TypeC trucks\n\n# Define objective function\nConsumptionA = 50 - 0.001 * EfficiencyA  # Fuel consumption for TypeA\nConsumptionB = 60 - 0.0015 * EfficiencyB  # Fuel consumption for TypeB\nConsumptionC = 70 - 0.002 * EfficiencyC  # Fuel consumption for TypeC\nTotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalConsumption)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000)  # Budget constraint\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 500)  # Total trucks constraint\nmodel.addCons(TrucksA >= 50)  # Minimum TypeA trucks\nmodel.addCons(TrucksB >= 100)  # Minimum TypeB trucks\nmodel.addCons(EfficiencyA <= 20000)  # Maximum investment in TypeA\nmodel.addCons(EfficiencyB <= 20000)  # Maximum investment in TypeB\nmodel.addCons(EfficiencyC <= 20000)  # Maximum investment in TypeC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Investment in Efficiency for TypeA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for TypeB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for TypeC: \", model.getVal(EfficiencyC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1558,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-3:\nThe total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\n// 250 * D <= (100 * A) + (150 * B) + (200 * C)\n\n## Generate Constraint-4:\nThe total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\n// 6 * 300 * E <= (2 * 100 * A) + (3 * 150 * B) + (4 * 200 * C) + (5 * 250 * D)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and distance for each route are given in the following Table.\n\n| Route | Cost per Mile | Distance |\n|-------|---------------|----------|\n| A     | $2            | 100 miles|\n| B     | $3            | 150 miles|\n| C     | $4            | 200 miles|\n| D     | $5            | 250 miles|\n| E     | $6            | 300 miles|\n\nThe company has a total of 50 trucks available. Each route must have at least 2 trucks. The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined. The total cost of route E must not exceed the combined total cost of routes A, B, C, and D. The company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\nPlease help the company to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n## The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\nmodel.addCons(250 * D <= (100 * A) + (150 * B) + (200 * C))\n## The total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\nmodel.addCons(6 * 300 * E <= (2 * 100 * A) + (3 * 150 * B) + (4 * 200 * C) + (5 * 250 * D))\n## The company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs.\n// {\"speed of each truck\": \"Speed\", \"range\": \"5 <= Speed <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for RouteA\": \"GreenTechA\", \"range\": \"GreenTechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for RouteB\": \"GreenTechB\", \"range\": \"GreenTechB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are affected by the speed of the trucks and the investment in green technology. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for RouteA: FuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\n// Fuel cost for RouteB: FuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\n// Maintenance cost for RouteA: MaintCostA = (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA\n// Maintenance cost for RouteB: MaintCostB = (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and green technology investments.\n// (100 - Speed + 0.01 * GreenTechA) * TrucksA + (100 - Speed + 0.01 * GreenTechB) * TrucksB + (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA + (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB + GreenTechA + GreenTechB <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is limited to 50.\n// TrucksA + TrucksB <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must deploy at least 10 trucks for RouteA and 15 trucks for RouteB.\n// TrucksA >= 10; TrucksB >= 15\n\n## Generate Constraint-4:\nThe investment in green technology for each route must not exceed $10,000.\n// GreenTechA <= 10000; GreenTechB <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n\nThe company has a total budget of $100,000 for operational costs and green technology investments. The total number of trucks available for deployment is limited to 50. Due to contractual obligations, the company must deploy at least 10 trucks for RouteA and 15 trucks for RouteB. The investment in green technology for each route must not exceed $10,000.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=5, ub=100) # speed of each truck\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=15) # number of trucks for RouteB\nGreenTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechA\", lb=0, ub=10000) # investment in green technology for RouteA\nGreenTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechB\", lb=0, ub=10000) # investment in green technology for RouteB\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\nFuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\nMaintCostA = (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA\nMaintCostB = (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB\n## the objective function is: Minimize (FuelCostA + FuelCostB + MaintCostA + MaintCostB)\nmodel.addCons(obj == FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n# Add constraints\n## The company has a total budget of $100,000 for operational costs and green technology investments.\nmodel.addCons((100 - Speed + 0.01 * GreenTechA) * TrucksA + (100 - Speed + 0.01 * GreenTechB) * TrucksB + (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA + (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB + GreenTechA + GreenTechB <= 100000)\n## The total number of trucks available for deployment is limited to 50.\nmodel.addCons(TrucksA + TrucksB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Investment in green technology for RouteA: \", model.getVal(GreenTechA))\n    print(\"Investment in green technology for RouteB: \", model.getVal(GreenTechB))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"daily operating cost for small trucks\": \"SmallCost\", \"range\": \"SmallCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for medium trucks\": \"MediumCost\", \"range\": \"MediumCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for large trucks\": \"LargeCost\", \"range\": \"LargeCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units.\n// TotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\n// 1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 per day for operating costs.\n// SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000\n\n## Generate Constraint-3:\nThe company can only purchase up to 5 small trucks due to limited storage space.\n// SmallTrucks <= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck. The company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units. The total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units. The company has a budget of $5000 per day for operating costs. The company can only purchase up to 5 small trucks due to limited storage space. Please help the company to determine the optimal number of each type of truck to purchase and their respective daily operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of large trucks\nSmallCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallCost\", lb=0) # daily operating cost for small trucks\nMediumCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumCost\", lb=0) # daily operating cost for medium trucks\nLargeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeCost\", lb=0) # daily operating cost for large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize TotalCost\nTotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\nmodel.addCons(1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000)\n## The company has a budget of $5000 per day for operating costs.\nmodel.addCons(SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000)\n## The company can only purchase up to 5 small trucks due to limited storage space.\nmodel.addCons(SmallTrucks <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Daily Operating Cost for Small Trucks: \", model.getVal(SmallCost))\n    print(\"Daily Operating Cost for Medium Trucks: \", model.getVal(MediumCost))\n    print(\"Daily Operating Cost for Large Trucks: \", model.getVal(LargeCost))\n    print(\"Minimized Total Daily Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system\": \"FleetManagement\", \"range\": \"FleetManagement >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in the fleet management system, reducing the operational cost per truck. The operational cost per truck for GoodsX is $2000, for GoodsY is $2500, for GoodsZ is $3000, and for GoodsW is $3500. The fleet management system reduces these costs by $50 for every $1000 invested. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for GoodsX: CostX = (2000 - 0.05 * FleetManagement) * TrucksX\n// Operational cost for GoodsY: CostY = (2500 - 0.05 * FleetManagement) * TrucksY\n// Operational cost for GoodsZ: CostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\n// Operational cost for GoodsW: CostW = (3500 - 0.05 * FleetManagement) * TrucksW\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nDue to contractual obligations, GoodsX must be transported by at least 10 trucks and GoodsY by at least 15 trucks.\n// TrucksX >= 10; TrucksY >= 15",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks. The operational cost per truck for each type of goods and the impact of the fleet management system on these costs are given in the following Table.\n\n| Goods | Operational Cost per Truck | Impact of Fleet Management System |\n|-------|---------------------------|------------------------------------|\n| GoodsX | $2000                     | Reduces cost by $50 per $1000 invested |\n| GoodsY | $2500                     | Reduces cost by $50 per $1000 invested |\n| GoodsZ | $3000                     | Reduces cost by $50 per $1000 invested |\n| GoodsW | $3500                     | Reduces cost by $50 per $1000 invested |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual obligations, GoodsX must be transported by at least 10 trucks and GoodsY by at least 15 trucks. The company aims to minimize the total operational cost of all trucks. Please help the company determine the optimal number of trucks for each type of goods and the investment in the fleet management system.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=10) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=15) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=0) # number of trucks for GoodsW\nFleetManagement = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetManagement\", lb=0) # investment in fleet management system\n\n# Define objective function\nCostX = (2000 - 0.05 * FleetManagement) * TrucksX\nCostY = (2500 - 0.05 * FleetManagement) * TrucksY\nCostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\nCostW = (3500 - 0.05 * FleetManagement) * TrucksW\n# So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Fleet Management System: \", model.getVal(FleetManagement))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1389,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\n// {\"number of trucks for G1\": \"TruckG1\", \"range\": \"TruckG1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G2\": \"TruckG2\", \"range\": \"TruckG2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G3\": \"TruckG3\", \"range\": \"TruckG3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G4\": \"TruckG4\", \"range\": \"TruckG4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G5\": \"TruckG5\", \"range\": \"TruckG5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n// Net profit for G1: Profit_G1 = (5000 - 1000 - 500) * TruckG1\n// Net profit for G2: Profit_G2 = (7000 - 1500 - 700) * TruckG2\n// Net profit for G3: Profit_G3 = (9000 - 2000 - 900) * TruckG3\n// Net profit for G4: Profit_G4 = (6000 - 1200 - 600) * TruckG4\n// Net profit for G5: Profit_G5 = (8000 - 1800 - 800) * TruckG5\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / (TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month. The revenue, fuel cost, and maintenance cost per truck for each type of good are given in the following Table.\n\n| Good | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------|-------------------|---------------------|----------------------------|\n| G1   | $5000             | $1000               | $500                       |\n| G2   | $7000             | $1500               | $700                       |\n| G3   | $9000             | $2000               | $900                       |\n| G4   | $6000             | $1200               | $600                       |\n| G5   | $8000             | $1800               | $800                       |\n\nThe company has a total of 50 trucks available for the month. The company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks). Please help the company determine the optimal allocation of trucks for each type of good to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckG1 = model.addVar(vtype=\"INTEGER\", name=\"TruckG1\", lb=0) # number of trucks for G1\nTruckG2 = model.addVar(vtype=\"INTEGER\", name=\"TruckG2\", lb=0) # number of trucks for G2\nTruckG3 = model.addVar(vtype=\"INTEGER\", name=\"TruckG3\", lb=0) # number of trucks for G3\nTruckG4 = model.addVar(vtype=\"INTEGER\", name=\"TruckG4\", lb=0) # number of trucks for G4\nTruckG5 = model.addVar(vtype=\"INTEGER\", name=\"TruckG5\", lb=0) # number of trucks for G5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = (5000 - 1000 - 500) * TruckG1\nProfit_G2 = (7000 - 1500 - 700) * TruckG2\nProfit_G3 = (9000 - 2000 - 900) * TruckG3\nProfit_G4 = (6000 - 1200 - 600) * TruckG4\nProfit_G5 = (8000 - 1800 - 800) * TruckG5\nTotalTrucks = TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for G1: \", model.getVal(TruckG1))\n    print(\"Number of Trucks for G2: \", model.getVal(TruckG2))\n    print(\"Number of Trucks for G3: \", model.getVal(TruckG3))\n    print(\"Number of Trucks for G4: \", model.getVal(TruckG4))\n    print(\"Number of Trucks for G5: \", model.getVal(TruckG5))\n    print(\"Maximized Average Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 6 different delivery zones. The company must decide how many trucks to allocate to each zone and the average speed at which these trucks should travel to minimize fuel consumption and delivery time.\n// {\"number of trucks for zone 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks in zone 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 6\": \"S6\", \"range\": \"S6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function of speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption across all zones while ensuring timely deliveries.\n// Total fuel consumption in zone 1: FC1 = T1 * (S1^2 + 0.1 * S1^3)\n// Total fuel consumption in zone 2: FC2 = T2 * (S2^2 + 0.1 * S2^3)\n// Total fuel consumption in zone 3: FC3 = T3 * (S3^2 + 0.1 * S3^3)\n// Total fuel consumption in zone 4: FC4 = T4 * (S4^2 + 0.1 * S4^3)\n// Total fuel consumption in zone 5: FC5 = T5 * (S5^2 + 0.1 * S5^3)\n// Total fuel consumption in zone 6: FC6 = T6 * (S6^2 + 0.1 * S6^3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nEach zone must have at least 2 trucks.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2; T6 >= 2\n\n## Generate Constraint-3:\nThe maximum speed for any truck in any zone is 60 km/h.\n// S1 <= 60; S2 <= 60; S3 <= 60; S4 <= 60; S5 <= 60; S6 <= 60",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for 6 different delivery zones. The company must decide how many trucks to allocate to each zone and the average speed at which these trucks should travel to minimize fuel consumption and delivery time. The fuel consumption of each truck is modeled by a nonlinear function of speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption across all zones while ensuring timely deliveries.\n\nThe company has a total of 50 trucks available. Each zone must have at least 2 trucks. The maximum speed for any truck in any zone is 60 km/h.\n\nPlease help the company to minimize the total fuel consumption across all zones.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## number of trucks for each zone\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks for zone 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks for zone 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks for zone 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks for zone 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks for zone 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=2) # number of trucks for zone 6\n\n## average speed of trucks in each zone\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=60) # average speed of trucks in zone 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0, ub=60) # average speed of trucks in zone 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0, ub=60) # average speed of trucks in zone 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0, ub=60) # average speed of trucks in zone 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0, ub=60) # average speed of trucks in zone 5\nS6 = model.addVar(vtype=\"CONTINUOUS\", name=\"S6\", lb=0, ub=60) # average speed of trucks in zone 6\n\n# Define objective function\n## Total fuel consumption in each zone\nFC1 = T1 * (S1**2 + 0.1 * S1**3)\nFC2 = T2 * (S2**2 + 0.1 * S2**3)\nFC3 = T3 * (S3**2 + 0.1 * S3**3)\nFC4 = T4 * (S4**2 + 0.1 * S4**3)\nFC5 = T5 * (S5**2 + 0.1 * S5**3)\nFC6 = T6 * (S6**2 + 0.1 * S6**3)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6)\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5 + FC6)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n\n## The maximum speed for any truck in any zone is 60 km/h.\nmodel.addCons(S1 <= 60)\nmodel.addCons(S2 <= 60)\nmodel.addCons(S3 <= 60)\nmodel.addCons(S4 <= 60)\nmodel.addCons(S5 <= 60)\nmodel.addCons(S6 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Zone 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Zone 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Zone 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Zone 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Zone 5: \", model.getVal(T5))\n    print(\"Number of Trucks in Zone 6: \", model.getVal(T6))\n    print(\"Average Speed in Zone 1: \", model.getVal(S1))\n    print(\"Average Speed in Zone 2: \", model.getVal(S2))\n    print(\"Average Speed in Zone 3: \", model.getVal(S3))\n    print(\"Average Speed in Zone 4: \", model.getVal(S4))\n    print(\"Average Speed in Zone 5: \", model.getVal(S5))\n    print(\"Average Speed in Zone 6: \", model.getVal(S6))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints.\n// {\"number of solar panels on building A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building A generates 10 kWh per day, costs $100, and requires 1 square meter of roof space.\nEach solar panel on building B generates 15 kWh per day, costs $150, and requires 1.5 square meters of roof space.\nEach solar panel on building C generates 20 kWh per day, costs $200, and requires 2 square meters of roof space.\nEach solar panel on building D generates 25 kWh per day, costs $250, and requires 2.5 square meters of roof space.\nEach solar panel on building E generates 30 kWh per day, costs $300, and requires 3 square meters of roof space.\nThe city aims to maximize the total daily energy generation (kWh) while minimizing the total cost of installation.\n// Daily energy generation from A: Energy_A = 10 * A\n// Daily energy generation from B: Energy_B = 15 * B\n// Daily energy generation from C: Energy_C = 20 * C\n// Daily energy generation from D: Energy_D = 25 * D\n// Daily energy generation from E: Energy_E = 30 * E\n// Total cost of installation: Cost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n// So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n\n## Generate Constraint-1:\nThe total budget for the solar panel installation is $10,000.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000\n\n## Generate Constraint-2:\nThe total available roof space for installation across all buildings is 500 square meters.\n// A + 1.5 * B + 2 * C + 2.5 * D + 3 * E <= 500\n\n## Generate Constraint-3:\nThe city requires at least 1000 kWh of daily energy generation.\n// Energy_A + Energy_B + Energy_C + Energy_D + Energy_E >= 1000\n\n## Generate Constraint-4:\nThe number of solar panels on building E must not exceed the combined number of panels on buildings A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe number of solar panels on building D must not exceed the number of panels on building E.\n// D <= E",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. Each solar panel on building A generates 10 kWh per day, costs $100, and requires 1 square meter of roof space. Each solar panel on building B generates 15 kWh per day, costs $150, and requires 1.5 square meters of roof space. Each solar panel on building C generates 20 kWh per day, costs $200, and requires 2 square meters of roof space. Each solar panel on building D generates 25 kWh per day, costs $250, and requires 2.5 square meters of roof space. Each solar panel on building E generates 30 kWh per day, costs $300, and requires 3 square meters of roof space. The city aims to maximize the total daily energy generation (kWh) while minimizing the total cost of installation. The total budget for the solar panel installation is $10,000. The total available roof space for installation across all buildings is 500 square meters. The city requires at least 1000 kWh of daily energy generation. The number of solar panels on building E must not exceed the combined number of panels on buildings A, B, and C. The number of solar panels on building D must not exceed the number of panels on building E. Please help the city determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels on building A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels on building B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels on building C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels on building D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels on building E\n\n# Define objective function\nEnergy_A = 10 * A\nEnergy_B = 15 * B\nEnergy_C = 20 * C\nEnergy_D = 25 * D\nEnergy_E = 30 * E\nCost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n# So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_A + Energy_B + Energy_C + Energy_D + Energy_E - Cost / 1000)\n\n# Add constraints\n# The total budget for the solar panel installation is $10,000.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n# The total available roof space for installation across all buildings is 500 square meters.\nmodel.addCons(A + 1.5 * B + 2 * C + 2.5 * D + 3 * E <= 500)\n# The city requires at least 1000 kWh of daily energy generation.\nmodel.addCons(Energy_A + Energy_B + Energy_C + Energy_D + Energy_E >= 1000)\n# The number of solar panels on building E must not exceed the combined number of panels on buildings A, B, and C.\nmodel.addCons(E <= A + B + C)\n# The number of solar panels on building D must not exceed the number of panels on building E.\nmodel.addCons(D <= E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building A: \", model.getVal(A))\n    print(\"Number of Solar Panels on Building B: \", model.getVal(B))\n    print(\"Number of Solar Panels on Building C: \", model.getVal(C))\n    print(\"Number of Solar Panels on Building D: \", model.getVal(D))\n    print(\"Number of Solar Panels on Building E: \", model.getVal(E))\n    print(\"Maximized Daily Energy Generation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1533,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. Component A has a profit of $5 per unit and a production cost of $2 per unit. Component B has a profit of $7 per unit and a production cost of $3 per unit. Component C has a profit of $9 per unit and a production cost of $4 per unit. Component D has a profit of $11 per unit and a production cost of $5 per unit. The firm aims to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n// Profit of A: Profit_A = (5 - 2) * A\n// Profit of B: Profit_B = (7 - 3) * B\n// Profit of C: Profit_C = (9 - 4) * C\n// Profit of D: Profit_D = (11 - 5) * D\n// Production time for A: Time_A = 0.5 * A\n// Production time for B: Time_B = 0.7 * B\n// Production time for C: Time_C = 0.9 * C\n// Production time for D: Time_D = 1.1 * D\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n\n## Generate Constraint-1:\nThe firm has a budget of $1000 for production costs in the upcoming quarter.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe firm must produce at least 20 units of each component in the upcoming quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20\n\n## Generate Constraint-3:\nThe firm has a maximum of 150 hours available for production in the upcoming quarter.\n// 0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150\n\n## Generate Constraint-4:\nThe firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations. The profit margin, production cost, and production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|-------------------------|\n| A         | $5              | $2                       | 0.5 hours               |\n| B         | $7              | $3                       | 0.7 hours               |\n| C         | $9              | $4                       | 0.9 hours               |\n| D         | $11             | $5                       | 1.1 hours               |\n\nThe firm has a budget of $1000 for production costs in the upcoming quarter. The firm must produce at least 20 units of each component in the upcoming quarter. The firm has a maximum of 150 hours available for production in the upcoming quarter. The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C. \nPlease help the firm to maximize the total profit per unit of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm must produce at least 20 units of each component in the upcoming quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (7 - 3) * B\nProfit_C = (9 - 4) * C\nProfit_D = (11 - 5) * D\nTime_A = 0.5 * A\nTime_B = 0.7 * B\nTime_C = 0.9 * C\nTime_D = 1.1 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n## convert the division to multiplication\nmodel.addCons(obj * (Time_A + Time_B + Time_C + Time_D) == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $1000 for production costs in the upcoming quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n## The firm has a maximum of 150 hours available for production in the upcoming quarter.\nmodel.addCons(0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150)\n## The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for daily operational costs.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon. The cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon. The cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The company has a total budget of $5000 for daily operational costs. The company has a total of 50 drivers available. Please help the company to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")  # Assuming fuel price is a variable\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000)\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Fuel Price: \", model.getVal(FuelPrice))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"amount of resources for ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"amount of resources for ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"amount of resources for ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue from selling each unit of ProductA is $100, ProductB is $140, and ProductC is $180. The investment in automation reduces the cost of production by $2 for every $1000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.002 * Automation) * UnitsA - ResourcesA\n// Total profit for ProductB: ProfitB = (140 - 70 + 0.002 * Automation) * UnitsB - ResourcesB\n// Total profit for ProductC: ProfitC = (180 - 90 + 0.002 * Automation) * UnitsC - ResourcesC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total amount of resources available for all products is 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue from selling each unit of ProductA is $100, ProductB is $140, and ProductC is $180. The investment in automation reduces the cost of production by $2 for every $1000 invested. The company aims to maximize the total profit from all products.\nThe total amount of resources available for all products is 1000 units.\nPlease help the company determine the optimal number of units to produce for each product, the amount of resources to allocate, and the investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # amount of resources for ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # amount of resources for ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # amount of resources for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.002 * Automation) * UnitsA - ResourcesA\nProfitB = (140 - 70 + 0.002 * Automation) * UnitsB - ResourcesB\nProfitC = (180 - 90 + 0.002 * Automation) * UnitsC - ResourcesC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total amount of resources available for all products is 1000 units.\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Amount of Resources for ProductA: \", model.getVal(ResourcesA))\n    print(\"Amount of Resources for ProductB: \", model.getVal(ResourcesB))\n    print(\"Amount of Resources for ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed.\n// {\"number of trips for Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A consumes 5 liters of fuel per hour and travels at 60 km/h.\nTruck B consumes 7 liters of fuel per hour and travels at 50 km/h.\nTruck C consumes 6 liters of fuel per hour and travels at 40 km/h.\nVan D consumes 3 liters of fuel per hour and travels at 80 km/h.\nVan E consumes 4 liters of fuel per hour and travels at 70 km/h.\nThe company wants to minimize the total fuel consumption while ensuring timely deliveries.\n// TotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\n// TotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n// The objective function is: Minimize TotalFuelConsumption * TotalDeliveryTime\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000\n\n## Generate Constraint-2:\nThe company must complete at least 1000 km of deliveries per day.\n// 60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000\n\n## Generate Constraint-3:\nThe number of trips for each vehicle must not exceed 20 per day.\n// TruckA <= 20\n// TruckB <= 20\n// TruckC <= 20\n// VanD <= 20\n// VanE <= 20\n\n## Generate Constraint-4:\nThe company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E).\n// VanD + VanE >= 0.3 * (TruckA + TruckB + TruckC + VanD + VanE)",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed. Truck A consumes 5 liters of fuel per hour and travels at 60 km/h. Truck B consumes 7 liters of fuel per hour and travels at 50 km/h. Truck C consumes 6 liters of fuel per hour and travels at 40 km/h. Van D consumes 3 liters of fuel per hour and travels at 80 km/h. Van E consumes 4 liters of fuel per hour and travels at 70 km/h. The company has a total fuel budget of 1000 liters per day. The company must complete at least 1000 km of deliveries per day. The number of trips for each vehicle must not exceed 20 per day. The company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E). Please help the company to minimize the total fuel consumption while ensuring timely deliveries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trips for Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trips for Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trips for Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of trips for Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of trips for Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\nTotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n## convert the division to multiplication\nmodel.addCons(obj == TotalFuelConsumption * TotalDeliveryTime)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000)\n## The company must complete at least 1000 km of deliveries per day.\nmodel.addCons(60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000)\n## The number of trips for each vehicle must not exceed 20 per day.\nmodel.addCons(TruckA <= 20)\nmodel.addCons(TruckB <= 20)\nmodel.addCons(TruckC <= 20)\nmodel.addCons(VanD <= 20)\nmodel.addCons(VanE <= 20)\n## The company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E).\nmodel.addCons(VanD + VanE >= 0.3 * (TruckA + TruckB + TruckC + VanD + VanE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(TruckA))\n    print(\"Number of trips for Truck B: \", model.getVal(TruckB))\n    print(\"Number of trips for Truck C: \", model.getVal(TruckC))\n    print(\"Number of trips for Van D: \", model.getVal(VanD))\n    print(\"Number of trips for Van E: \", model.getVal(VanE))\n    print(\"Minimized Fuel Consumption * Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has a different operational cost and revenue generation capability. The operational cost decreases nonlinearly with the number of vehicles deployed due to economies of scale. Specifically, the operational cost per vehicle decreases by 0.1% for each additional vehicle deployed beyond the first 10 vehicles. The revenue generated per vehicle also increases nonlinearly with the number of vehicles deployed due to increased market penetration. Specifically, the revenue per vehicle increases by 0.2% for each additional vehicle deployed beyond the first 10 vehicles. The company aims to maximize its net profit, which is the difference between the total revenue and the total operational cost.\n// Operational cost of A: Cost_A = (1000 - 0.001 * (A - 10) * (A - 10)) * A\n// Operational cost of B: Cost_B = (1200 - 0.001 * (B - 10) * (B - 10)) * B\n// Operational cost of C: Cost_C = (1500 - 0.001 * (C - 10) * (C - 10)) * C\n// Operational cost of D: Cost_D = (800 - 0.001 * (D - 10) * (D - 10)) * D\n// Operational cost of E: Cost_E = (900 - 0.001 * (E - 10) * (E - 10)) * E\n// Revenue of A: Rev_A = (2000 + 0.002 * (A - 10) * (A - 10)) * A\n// Revenue of B: Rev_B = (2500 + 0.002 * (B - 10) * (B - 10)) * B\n// Revenue of C: Rev_C = (3000 + 0.002 * (C - 10) * (C - 10)) * C\n// Revenue of D: Rev_D = (1500 + 0.002 * (D - 10) * (D - 10)) * D\n// Revenue of E: Rev_E = (1800 + 0.002 * (E - 10) * (E - 10)) * E\n// So, the objective function is: Maximize (Rev_A - Cost_A) + (Rev_B - Cost_B) + (Rev_C - Cost_C) + (Rev_D - Cost_D) + (Rev_E - Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget constraint of $500,000 for vehicle maintenance and operational costs.\n// (1000 - 0.001 * (A - 10) * (A - 10)) * A + (1200 - 0.001 * (B - 10) * (B - 10)) * B + (1500 - 0.001 * (C - 10) * (C - 10)) * C + (800 - 0.001 * (D - 10) * (D - 10)) * D + (900 - 0.001 * (E - 10) * (E - 10)) * E <= 500000\n\n## Generate Constraint-2:\nThe company has a limit on the number of vehicles it can deploy, with a maximum of 100 vehicles in total.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10 vehicles of each type are deployed to maintain a basic level of service.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month. Each vehicle type has a different operational cost and revenue generation capability. The operational cost per vehicle decreases by 0.1% for each additional vehicle deployed beyond the first 10 vehicles, and the revenue per vehicle increases by 0.2% for each additional vehicle deployed beyond the first 10 vehicles. The company aims to maximize its net profit, which is the difference between the total revenue and the total operational cost.\n\nThe company has a budget constraint of $500,000 for vehicle maintenance and operational costs. The company has a limit on the number of vehicles it can deploy, with a maximum of 100 vehicles in total. The company wants to ensure that at least 10 vehicles of each type are deployed to maintain a basic level of service.\n\nPlease help the company to determine the optimal number of each vehicle type to deploy in order to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Operational cost and revenue calculations with piecewise linear functions\nCost_A = (1000 - 0.001 * (A - 10) * (A - 10)) * A\nCost_B = (1200 - 0.001 * (B - 10) * (B - 10)) * B\nCost_C = (1500 - 0.001 * (C - 10) * (C - 10)) * C\nCost_D = (800 - 0.001 * (D - 10) * (D - 10)) * D\nCost_E = (900 - 0.001 * (E - 10) * (E - 10)) * E\n\nRev_A = (2000 + 0.002 * (A - 10) * (A - 10)) * A\nRev_B = (2500 + 0.002 * (B - 10) * (B - 10)) * B\nRev_C = (3000 + 0.002 * (C - 10) * (C - 10)) * C\nRev_D = (1500 + 0.002 * (D - 10) * (D - 10)) * D\nRev_E = (1800 + 0.002 * (E - 10) * (E - 10)) * E\n\n## the objective function is: Maximize (Rev_A - Cost_A) + (Rev_B - Cost_B) + (Rev_C - Cost_C) + (Rev_D - Cost_D) + (Rev_E - Cost_E)\nmodel.addCons(obj == (Rev_A - Cost_A) + (Rev_B - Cost_B) + (Rev_C - Cost_C) + (Rev_D - Cost_D) + (Rev_E - Cost_E))\n\n# Add constraints\n## The company has a budget constraint of $500,000 for vehicle maintenance and operational costs.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 500000)\n## The company has a limit on the number of vehicles it can deploy, with a maximum of 100 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\nThe company has a total production capacity of 10,000 units for all devices combined.\nPlease help the company determine the optimal production quantity for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 649,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $2000 per month, and the machine cost per machine is $3000 per month. The company wants to maximize the total monthly profit.\n// Profit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\n// Profit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\n// Profit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe company has a total of 30 machines available.\n// MachinesA + MachinesB + MachinesC <= 30\n\n## Generate Constraint-3:\nThe production capacity for ProductA is limited to 1000 units per month, ProductB to 1500 units per month, and ProductC to 1200 units per month.\n// ProdA <= 1000; ProdB <= 1500; ProdC <= 1200\n\n## Generate Constraint-4:\nThe number of workers required for each unit of ProductA is 0.01, for ProductB is 0.02, and for ProductC is 0.015.\n// WorkersA >= 0.01 * ProdA; WorkersB >= 0.02 * ProdB; WorkersC >= 0.015 * ProdC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $2000 per month, and the machine cost per machine is $3000 per month. The company wants to maximize the total monthly profit. The company has a total of 50 workers available and a total of 30 machines available. The production capacity for ProductA is limited to 1000 units per month, ProductB to 1500 units per month, and ProductC to 1200 units per month. The number of workers required for each unit of ProductA is 0.01, for ProductB is 0.02, and for ProductC is 0.015.\nPlease help the company to maximize the total monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\n\n# Define objective function\nProfit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\nProfit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\nProfit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50) # total workers constraint\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 30) # total machines constraint\nmodel.addCons(ProdA <= 1000) # production capacity for ProductA\nmodel.addCons(ProdB <= 1500) # production capacity for ProductB\nmodel.addCons(ProdC <= 1200) # production capacity for ProductC\nmodel.addCons(WorkersA >= 0.01 * ProdA) # workers required for ProductA\nmodel.addCons(WorkersB >= 0.02 * ProdB) # workers required for ProductB\nmodel.addCons(WorkersC >= 0.015 * ProdC) # workers required for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate for each truck in that region.\n// {\"number of trucks for North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for North region\": \"FuelRateNorth\", \"range\": \"FuelRateNorth >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for South region\": \"FuelRateSouth\", \"range\": \"FuelRateSouth >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for East region\": \"FuelRateEast\", \"range\": \"FuelRateEast >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for West region\": \"FuelRateWest\", \"range\": \"FuelRateWest >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Central region\": \"FuelRateCentral\", \"range\": \"FuelRateCentral >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate in each region. The fuel cost per gallon is $3.50, and the total fuel consumption is the product of the number of trucks and the fuel consumption rate in each region.\n// TotalFuelCostNorth = 3.50 * TrucksNorth * FuelRateNorth\n// TotalFuelCostSouth = 3.50 * TrucksSouth * FuelRateSouth\n// TotalFuelCostEast = 3.50 * TrucksEast * FuelRateEast\n// TotalFuelCostWest = 3.50 * TrucksWest * FuelRateWest\n// TotalFuelCostCentral = 3.50 * TrucksCentral * FuelRateCentral\n// So, the objective function is: Minimize TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation across all regions.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100\n\n## Generate Constraint-2:\nDue to environmental regulations, the average fuel consumption rate across all regions must not exceed 10 gallons per truck per day.\n// (FuelRateNorth * TrucksNorth + FuelRateSouth * TrucksSouth + FuelRateEast * TrucksEast + FuelRateWest * TrucksWest + FuelRateCentral * TrucksCentral) / (TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral) <= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate for each truck in that region. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate in each region. The fuel cost per gallon is $3.50, and the total fuel consumption is the product of the number of trucks and the fuel consumption rate in each region. The company has a total of 100 trucks available for allocation across all regions. Due to environmental regulations, the average fuel consumption rate across all regions must not exceed 10 gallons per truck per day. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0)\nFuelRateNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateNorth\", lb=0)\nFuelRateSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateSouth\", lb=0)\nFuelRateEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateEast\", lb=0)\nFuelRateWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateWest\", lb=0)\nFuelRateCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateCentral\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelCostNorth = 3.50 * TrucksNorth * FuelRateNorth\nTotalFuelCostSouth = 3.50 * TrucksSouth * FuelRateSouth\nTotalFuelCostEast = 3.50 * TrucksEast * FuelRateEast\nTotalFuelCostWest = 3.50 * TrucksWest * FuelRateWest\nTotalFuelCostCentral = 3.50 * TrucksCentral * FuelRateCentral\n## the objective function is: Minimize TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral\nmodel.addCons(obj == TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation across all regions.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n## Due to environmental regulations, the average fuel consumption rate across all regions must not exceed 10 gallons per truck per day.\nmodel.addCons((FuelRateNorth * TrucksNorth + FuelRateSouth * TrucksSouth + FuelRateEast * TrucksEast + FuelRateWest * TrucksWest + FuelRateCentral * TrucksCentral) <= 10 * (TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks for South Region: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks for East Region: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks for West Region: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks for Central Region: \", model.getVal(TrucksCentral))\n    print(\"Fuel Consumption Rate for North Region: \", model.getVal(FuelRateNorth))\n    print(\"Fuel Consumption Rate for South Region: \", model.getVal(FuelRateSouth))\n    print(\"Fuel Consumption Rate for East Region: \", model.getVal(FuelRateEast))\n    print(\"Fuel Consumption Rate for West Region: \", model.getVal(FuelRateWest))\n    print(\"Fuel Consumption Rate for Central Region: \", model.getVal(FuelRateCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is inversely proportional to the square of its speed. The faster a truck travels, the less fuel it consumes per kilometer, but the more it costs in terms of maintenance and wear. The revenue per route is directly proportional to the number of trucks used. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs.\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1500 * Trucks2\n// Revenue_Route3 = 2000 * Trucks3\n// FuelCost_Route1 = (1 / (Speed1^2)) * Trucks1\n// FuelCost_Route2 = (1 / (Speed2^2)) * Trucks2\n// FuelCost_Route3 = (1 / (Speed3^2)) * Trucks3\n// MaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\n// MaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\n// MaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 + Revenue_Route2 + Revenue_Route3) - (FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel and maintenance costs.\n// (1 / (Speed1^2)) * Trucks1 + (1 / (Speed2^2)) * Trucks2 + (1 / (Speed3^2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to safety regulations, the average speed of all trucks across all routes must not exceed 50 km/h.\n// (Trucks1 * Speed1 + Trucks2 * Speed2 + Trucks3 * Speed3) / (Trucks1 + Trucks2 + Trucks3) <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route. The fuel cost per kilometer for each truck is inversely proportional to the square of its speed. The faster a truck travels, the less fuel it consumes per kilometer, but the more it costs in terms of maintenance and wear. The revenue per route is directly proportional to the number of trucks used. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs. The company has a total budget of $100,000 for fuel and maintenance costs. The total number of trucks available is limited to 100. Due to safety regulations, the average speed of all trucks across all routes must not exceed 50 km/h.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0.1, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0.1, ub=60)  # speed of trucks for Route2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0.1, ub=60)  # speed of trucks for Route3\n\n# Define objective function\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1500 * Trucks2\nRevenue_Route3 = 2000 * Trucks3\nFuelCost_Route1 = (1 / (Speed1**2)) * Trucks1\nFuelCost_Route2 = (1 / (Speed2**2)) * Trucks2\nFuelCost_Route3 = (1 / (Speed3**2)) * Trucks3\nMaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\nMaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\nMaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\nTotalCost = FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3\nNetProfit = Revenue_Route1 + Revenue_Route2 + Revenue_Route3 - TotalCost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons((1 / (Speed1**2)) * Trucks1 + (1 / (Speed2**2)) * Trucks2 + (1 / (Speed3**2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\nmodel.addCons((Trucks1 * Speed1 + Trucks2 * Speed2 + Trucks3 * Speed3) / (Trucks1 + Trucks2 + Trucks3) <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks for Route3: \", model.getVal(Speed3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company wants to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n// Delivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\n// Delivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\n// Delivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\n// Delivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\n// Delivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n// So, the objective function is: Maximize (Delivery_Efficiency_TruckA + Delivery_Efficiency_TruckB + Delivery_Efficiency_TruckC + Delivery_Efficiency_TruckD + Delivery_Efficiency_TruckE)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the month.\n// 5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10,000\n\n## Generate Constraint-2:\nThe company has a total operating budget of $30,000 for the month.\n// 2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30,000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company has a total fuel budget of 10,000 liters for the month. The company also has a total operating budget of $30,000 for the month.\nPlease help the company to maximize the delivery efficiency (total delivery capacity per liter of fuel).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDelivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\nDelivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\nDelivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\nDelivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\nDelivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE) == 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 2500 * TruckD + 3000 * TruckE)\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the month.\nmodel.addCons(5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10000)\n## The company has a total operating budget of $30,000 for the month.\nmodel.addCons(2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks dedicated to each region (Region1, Region2, Region3) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades are investments that reduce fuel consumption per kilometer, which directly impacts operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and depreciation based on the number of trucks and their fuel efficiency. The fuel cost per kilometer decreases by $0.02 for every $100 invested in fuel efficiency upgrades. The initial fuel cost per kilometer is $0.50 for all regions.\n// Total operational cost for Region1: Cost1 = (0.50 - 0.0002 * Efficiency1) * Trucks1\n// Total operational cost for Region2: Cost2 = (0.50 - 0.0002 * Efficiency2) * Trucks2\n// Total operational cost for Region3: Cost3 = (0.50 - 0.0002 * Efficiency3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck purchases and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all regions must not exceed 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 50 trucks in Region1 and 100 trucks in Region2.\n// Trucks1 >= 50; Trucks2 >= 100\n\n## Generate Constraint-4:\nThe fuel efficiency upgrades for each region must not exceed $20,000.\n// Efficiency1 <= 20000; Efficiency2 <= 20000; Efficiency3 <= 20000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions (Region1, Region2, Region3). The company needs to optimize the number of trucks dedicated to each region and the investments in fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades reduce fuel consumption per kilometer, impacting operational costs. The company aims to minimize the total operational cost, which includes fuel costs and depreciation based on the number of trucks and their fuel efficiency. The fuel cost per kilometer decreases by $0.02 for every $100 invested in fuel efficiency upgrades, with an initial fuel cost per kilometer of $0.50 for all regions.\n\n| Region | Initial Fuel Cost per Kilometer |\n|--------|---------------------------------|\n| Region1 | $0.50                           |\n| Region2 | $0.50                           |\n| Region3 | $0.50                           |\n\nThe company has a total budget of $100,000 for truck purchases and fuel efficiency upgrades. The total number of trucks across all regions must not exceed 500. Due to contractual obligations, the company must operate at least 50 trucks in Region1 and 100 trucks in Region2. The fuel efficiency upgrades for each region must not exceed $20,000.\n\nPlease help the company to determine the optimal number of trucks and the appropriate investments in fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Region3\n\n# Define objective function\nCost1 = (0.50 - 0.0002 * Efficiency1) * Trucks1\nCost2 = (0.50 - 0.0002 * Efficiency2) * Trucks2\nCost3 = (0.50 - 0.0002 * Efficiency3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 100)\nmodel.addCons(Efficiency1 <= 20000)\nmodel.addCons(Efficiency2 <= 20000)\nmodel.addCons(Efficiency3 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1428,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations.\n// {\"trips of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for Truck A is $1000, and it can carry 10 tons of goods. For Truck B, the cost per trip is $1500, and it can carry 15 tons of goods. For Truck C, the cost per trip is $2000, and it can carry 20 tons of goods. The company wants to minimize the total cost of transportation while ensuring all goods are delivered.\n// Cost_A = 1000 * A\n// Cost_B = 1500 * B\n// Cost_C = 2000 * C\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total weight of goods to be transported is 600 tons.\n// 10 * A + 15 * B + 20 * C >= 600\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for transportation costs.\n// 1000 * A + 1500 * B + 2000 * C <= 100000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations. The cost per trip and the carrying capacity for each truck are given in the following Table.\n\n| Vehicle | Cost per Trip | Carrying Capacity |\n|---------|---------------|-------------------|\n| Truck A | $1000         | 10 tons           |\n| Truck B | $1500         | 15 tons           |\n| Truck C | $2000         | 20 tons           |\n\nThe total weight of goods to be transported is 600 tons. The company has a budget of $100,000 for transportation costs. Please help the company to minimize the total cost of transportation while ensuring all goods are delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # trips of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # trips of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # trips of Truck C\n\n# Define objective function\nCost_A = 1000 * A\nCost_B = 1500 * B\nCost_C = 2000 * C\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total weight of goods to be transported is 600 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 600)\n# The company has a budget of $100,000 for transportation costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips of Truck A: \", model.getVal(A))\n    print(\"Trips of Truck B: \", model.getVal(B))\n    print(\"Trips of Truck C: \", model.getVal(C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while minimizing operational costs. Additionally, the company needs to decide on the level of investment in technology upgrades for each plant, which affects the efficiency and cost of energy production.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Solar\": \"TechUpgradeSolar\", \"range\": \"TechUpgradeSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Wind\": \"TechUpgradeWind\", \"range\": \"TechUpgradeWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Hydro\": \"TechUpgradeHydro\", \"range\": \"TechUpgradeHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each plant increases with technology upgrades. For every $1000 invested in Solar, the efficiency increases by 1 kWh per hour. For Wind, every $1000 investment increases efficiency by 1.5 kWh per hour. For Hydro, every $1000 investment increases efficiency by 1.2 kWh per hour. The operational cost per hour for Solar is $50, for Wind is $60, and for Hydro is $70. The company aims to maximize the net energy output (energy produced minus operational costs).\n// EnergyOutputSolar = (10 + 0.001 * TechUpgradeSolar) * HoursSolar - 50 * HoursSolar\n// EnergyOutputWind = (15 + 0.0015 * TechUpgradeWind) * HoursWind - 60 * HoursWind\n// EnergyOutputHydro = (12 + 0.0012 * TechUpgradeHydro) * HoursHydro - 70 * HoursHydro\n// So, the objective function is: Maximize (EnergyOutputSolar + EnergyOutputWind + EnergyOutputHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and technology upgrades.\n// 50 * HoursSolar + 60 * HoursWind + 70 * HoursHydro + TechUpgradeSolar + TechUpgradeWind + TechUpgradeHydro <= 100000\n\n## Generate Constraint-2:\nThe total operational hours for all plants must not exceed 24 hours per day.\n// HoursSolar + HoursWind + HoursHydro <= 24\n\n## Generate Constraint-3:\nDue to maintenance schedules, the Solar plant must operate at least 2 hours per day, the Wind plant at least 3 hours per day, and the Hydro plant at least 4 hours per day.\n// HoursSolar >= 2; HoursWind >= 3; HoursHydro >= 4",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily and the level of investment in technology upgrades for each plant to maximize energy production while minimizing operational costs. The energy production efficiency of each plant increases with technology upgrades. For every $1000 invested in Solar, the efficiency increases by 1 kWh per hour. For Wind, every $1000 investment increases efficiency by 1.5 kWh per hour. For Hydro, every $1000 investment increases efficiency by 1.2 kWh per hour. The operational cost per hour for Solar is $50, for Wind is $60, and for Hydro is $70. The company aims to maximize the net energy output (energy produced minus operational costs). The company has a total budget of $100,000 for operational costs and technology upgrades. The total operational hours for all plants must not exceed 24 hours per day. Due to maintenance schedules, the Solar plant must operate at least 2 hours per day, the Wind plant at least 3 hours per day, and the Hydro plant at least 4 hours per day.\n\nPlease help the company to maximize the net energy output (energy produced minus operational costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=2)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=3)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=4)  # number of hours Hydro plant operates\nTechUpgradeSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSolar\", lb=0)  # investment in technology upgrades for Solar\nTechUpgradeWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeWind\", lb=0)  # investment in technology upgrades for Wind\nTechUpgradeHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeHydro\", lb=0)  # investment in technology upgrades for Hydro\n\n# Define objective function\nEnergyOutputSolar = (10 + 0.001 * TechUpgradeSolar) * HoursSolar - 50 * HoursSolar\nEnergyOutputWind = (15 + 0.0015 * TechUpgradeWind) * HoursWind - 60 * HoursWind\nEnergyOutputHydro = (12 + 0.0012 * TechUpgradeHydro) * HoursHydro - 70 * HoursHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar + EnergyOutputWind + EnergyOutputHydro)\n\n# Add constraints\nmodel.addCons(50 * HoursSolar + 60 * HoursWind + 70 * HoursHydro + TechUpgradeSolar + TechUpgradeWind + TechUpgradeHydro <= 100000)\nmodel.addCons(HoursSolar + HoursWind + HoursHydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hours Solar Plant Operates: \", model.getVal(HoursSolar))\n    print(\"Number of Hours Wind Plant Operates: \", model.getVal(HoursWind))\n    print(\"Number of Hours Hydro Plant Operates: \", model.getVal(HoursHydro))\n    print(\"Investment in Technology Upgrades for Solar: \", model.getVal(TechUpgradeSolar))\n    print(\"Investment in Technology Upgrades for Wind: \", model.getVal(TechUpgradeWind))\n    print(\"Investment in Technology Upgrades for Hydro: \", model.getVal(TechUpgradeHydro))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor costs.\n// LaborA * ProductA + LaborB * ProductB + LaborC * ProductC <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $10,000 for raw materials and a budget of $5,000 for labor costs. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)  # Budget for raw materials\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 5000)   # Budget for labor costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost, selling price, and demand for each device vary and are influenced by market conditions.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price per unit is $100, and the demand is capped at 500 units. For DeviceB, the production cost per unit is $70, the selling price per unit is $120, and the demand is capped at 400 units. For DeviceC, the production cost per unit is $80, the selling price per unit is $150, and the demand is capped at 300 units. The company wants to maximize the total profit from selling these devices.\n// Total profit for DeviceA: ProfitA = (100 - 50) * UnitsA\n// Total profit for DeviceB: ProfitB = (120 - 70) * UnitsB\n// Total profit for DeviceC: ProfitC = (150 - 80) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity for the company is limited to 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB.\n// UnitsA <= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost per unit for DeviceA is $50, the selling price per unit is $100, and the demand is capped at 500 units. For DeviceB, the production cost per unit is $70, the selling price per unit is $120, and the demand is capped at 400 units. For DeviceC, the production cost per unit is $80, the selling price per unit is $150, and the demand is capped at 300 units. The company wants to maximize the total profit from selling these devices.\nThe total production capacity for the company is limited to 1000 units per month. Due to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB. The company has a budget of $60,000 for production costs per month.\nPlease help the company determine the optimal number of units to produce for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA\nProfitB = (120 - 70) * UnitsB\nProfitC = (150 - 80) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000) # Total production capacity constraint\nmodel.addCons(UnitsA <= 2 * UnitsB) # Production of DeviceA should not exceed twice the production of DeviceB\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000) # Budget constraint for production costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor Truck B, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 20 tons.\nFor Truck C, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 30 tons.\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints.\n// Cost_TruckA = (0.5 + 0.3) * TruckA\n// Cost_TruckB = (0.6 + 0.4) * TruckB\n// Cost_TruckC = (0.7 + 0.5) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must not exceed 100 tons.\n// 10 * TruckA + 20 * TruckB + 30 * TruckC <= 100",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for a specific route to optimize fuel efficiency and cost.\nFor Truck A, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor Truck B, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 20 tons.\nFor Truck C, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 30 tons.\nThe company wants to minimize the total cost per kilometer (fuel cost + maintenance cost) while considering the capacity constraints. The total capacity of all trucks must not exceed 100 tons.\nPlease help the company to determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nCost_TruckA = (0.5 + 0.3) * TruckA\nCost_TruckB = (0.6 + 0.4) * TruckB\nCost_TruckC = (0.7 + 0.5) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The total capacity of all trucks must not exceed 100 tons.\nmodel.addCons(10 * TruckA + 20 * TruckB + 30 * TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Region1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2\n// Fuel cost for Region2: Cost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2\n// Fuel cost for Region3: Cost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all regions must not exceed $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 10 trucks must be allocated to Region1 and 15 trucks to Region2.\n// Trucks1 >= 10; Trucks2 >= 15\n\n## Generate Constraint-4:\nThe minimum maintenance budget for each region should be at least 10% of the total trucks allocated to that region.\n// Maintenance1 >= 0.1 * Trucks1; Maintenance2 >= 0.1 * Trucks2; Maintenance3 >= 0.1 * Trucks3",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region. The efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Number of Trucks | Maintenance Budget |\n|--------|------------------|--------------------|\n| Region1 | Trucks1 | Maintenance1 |\n| Region2 | Trucks2 | Maintenance2 |\n| Region3 | Trucks3 | Maintenance3 |\n\nThe total maintenance budget for all regions must not exceed $100,000. The company has a total of 50 trucks available for allocation. Due to contractual obligations, at least 10 trucks must be allocated to Region1 and 15 trucks to Region2. The minimum maintenance budget for each region should be at least 10% of the total trucks allocated to that region.\n\nPlease help the company to minimize the total fuel cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance budget for Region1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance budget for Region2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance budget for Region3\n\n# Define objective function\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# Fuel cost for Region1: Cost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2\n# Fuel cost for Region2: Cost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2\n# Fuel cost for Region3: Cost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2\n# convert the division to multiplication\nCost1 = 1000 * Trucks1 * (1 + 0.001 * Maintenance1)**2\nCost2 = 1200 * Trucks2 * (1 + 0.001 * Maintenance2)**2\nCost3 = 1500 * Trucks3 * (1 + 0.001 * Maintenance3)**2\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The total maintenance budget for all regions must not exceed $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n# Due to contractual obligations, at least 10 trucks must be allocated to Region1 and 15 trucks to Region2.\nmodel.addCons(Trucks1 >= 10)\nmodel.addCons(Trucks2 >= 15)\n# The minimum maintenance budget for each region should be at least 10% of the total trucks allocated to that region.\nmodel.addCons(Maintenance1 >= 0.1 * Trucks1)\nmodel.addCons(Maintenance2 >= 0.1 * Trucks2)\nmodel.addCons(Maintenance3 >= 0.1 * Trucks3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Maintenance Budget for Region1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Budget for Region2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Budget for Region3: \", model.getVal(Maintenance3))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Small Trucks\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Medium Trucks\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Large Trucks\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n// Operational cost for Small Trucks: CostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\n// Operational cost for Medium Trucks: CostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\n// Operational cost for Large Trucks: CostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for fleet expansion and technology upgrades.\n// 100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks to be added to the fleet should not exceed 10.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 10\n\n## Generate Constraint-3:\nAt least 3 trucks of each type must be purchased.\n// SmallTrucks >= 3; MediumTrucks >= 3; LargeTrucks >= 3",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs. The fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n\n| Truck Type       | Initial Purchase Cost | Cost Savings per Kilometer per $100 Tech Upgrade |\n|------------------|-----------------------|--------------------------------------------------|\n| Small Trucks     | $100,000              | $0.10                                            |\n| Medium Trucks    | $150,000              | $0.15                                            |\n| Large Trucks     | $200,000              | $0.20                                            |\n\nThe company has a budget of $1,000,000 for fleet expansion and technology upgrades. The total number of trucks to be added to the fleet should not exceed 10. At least 3 trucks of each type must be purchased.\n\nPlease help the company to determine the optimal number of each type of truck to purchase and the level of technology upgrade to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=3)  # number of Small Trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=3)  # number of Medium Trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=3)  # number of Large Trucks\nTechUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSmall\", lb=0)  # technology upgrade for Small Trucks\nTechUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeMedium\", lb=0)  # technology upgrade for Medium Trucks\nTechUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeLarge\", lb=0)  # technology upgrade for Large Trucks\n\n# Define objective function\nCostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\nCostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\nCostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Technology Upgrade for Small Trucks: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade for Medium Trucks: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade for Large Trucks: \", model.getVal(TechUpgradeLarge))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1659,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total net profit.\n// NetProfit_A = A * (50 - 20)\n// NetProfit_B = B * (70 - 30)\n// NetProfit_C = C * (60 - 25)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\n// A >= 200\n// B >= 300\n\n## Generate Constraint-3:\nThe production process is such that the production of product C is dependent on the production of product A and B. Specifically, for every unit of product A produced, 0.5 units of product C can be produced, and for every unit of product B produced, 0.3 units of product C can be produced.\n// C <= 0.5 * A + 0.3 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total net profit.\nThe total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month. The production process is such that the production of product C is dependent on the production of product A and B. Specifically, for every unit of product A produced, 0.5 units of product C can be produced, and for every unit of product B produced, 0.3 units of product C can be produced.\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nNetProfit_A = A * (50 - 20)\nNetProfit_B = B * (70 - 30)\nNetProfit_C = C * (60 - 25)\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n# The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 300)\n# The production process is such that the production of product C is dependent on the production of product A and B.\nmodel.addCons(C <= 0.5 * A + 0.3 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product in the next production cycle. Additionally, the company can outsource production to external contractors.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductA\": \"OutsourcedA\", \"range\": \"OutsourcedA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductB\": \"OutsourcedB\", \"range\": \"OutsourcedB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductC\": \"OutsourcedC\", \"range\": \"OutsourcedC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50 if produced internally and $40 if outsourced. For ProductB, the profit per unit is $70 internally and $55 if outsourced. For ProductC, the profit per unit is $90 internally and $70 if outsourced. The production cost per unit for ProductA is $20 internally and $30 if outsourced. For ProductB, the production cost is $30 internally and $40 if outsourced. For ProductC, the production cost is $40 internally and $50 if outsourced. The company aims to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20) * UnitsA + (40 - 30) * OutsourcedA\n// Total profit for ProductB: Profit_B = (70 - 30) * UnitsB + (55 - 40) * OutsourcedB\n// Total profit for ProductC: Profit_C = (90 - 40) * UnitsC + (70 - 50) * OutsourcedC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units internally.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of units of ProductA produced must be at least twice the number of units of ProductB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for outsourcing costs.\n// 30 * OutsourcedA + 40 * OutsourcedB + 50 * OutsourcedC <= 50,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product in the next production cycle and can also outsource production to external contractors. The profit per unit for ProductA is $50 if produced internally and $40 if outsourced, with a production cost of $20 internally and $30 if outsourced. For ProductB, the profit per unit is $70 internally and $55 if outsourced, with a production cost of $30 internally and $40 if outsourced. For ProductC, the profit per unit is $90 internally and $70 if outsourced, with a production cost of $40 internally and $50 if outsourced. The company aims to maximize the total profit.\n\nThe company has a total production capacity of 1000 units internally. Due to market demand, the number of units of ProductA produced must be at least twice the number of units of ProductB. The company has a budget of $50,000 for outsourcing costs.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nOutsourcedA = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedA\", lb=0)  # number of units outsourced for ProductA\nOutsourcedB = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedB\", lb=0)  # number of units outsourced for ProductB\nOutsourcedC = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedC\", lb=0)  # number of units outsourced for ProductC\n\n# Define objective function\nProfit_A = (50 - 20) * UnitsA + (40 - 30) * OutsourcedA\nProfit_B = (70 - 30) * UnitsB + (55 - 40) * OutsourcedB\nProfit_C = (90 - 40) * UnitsC + (70 - 50) * OutsourcedC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # Total production capacity of 1000 units internally\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Units of ProductA must be at least twice the units of ProductB\nmodel.addCons(30 * OutsourcedA + 40 * OutsourcedB + 50 * OutsourcedC <= 50000)  # Budget constraint for outsourcing costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of ProductA outsourced: \", model.getVal(OutsourcedA))\n    print(\"Number of ProductB outsourced: \", model.getVal(OutsourcedB))\n    print(\"Number of ProductC outsourced: \", model.getVal(OutsourcedC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"quantity of MaterialX used\": \"MatX\", \"range\": \"MatX >= 0\", \"type\": \"real\"}\n// {\"quantity of MaterialY used\": \"MatY\", \"range\": \"MatY >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = 50 * ProdA\n// Total profit for ProductB: Profit_B = 70 * ProdB\n// Total profit for ProductC: Profit_C = 90 * ProdC\n// Cost of MaterialX: Cost_X = 10 * MatX\n// Cost of MaterialY: Cost_Y = 15 * MatY\n// MaterialX used for ProductA: MatX_A = 0.8 * ProdA\n// MaterialX used for ProductB: MatX_B = 0.9 * ProdB\n// MaterialX used for ProductC: MatX_C = 0.7 * ProdC\n// MaterialY used for ProductA: MatY_A = 0.9 * ProdA\n// MaterialY used for ProductB: MatY_B = 0.8 * ProdB\n// MaterialY used for ProductC: MatY_C = 0.6 * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n## Generate Constraint-1:\nThe total amount of MaterialX available is 100 units.\n// MatX_A + MatX_B + MatX_C <= MatX",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit. The total amount of MaterialX available is 100 units.\n\nPlease help the company to maximize the total profit, considering the constraints on the use of MaterialX.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMatX = model.addVar(vtype=\"CONTINUOUS\", name=\"MatX\", lb=0) # quantity of MaterialX used\nMatY = model.addVar(vtype=\"CONTINUOUS\", name=\"MatY\", lb=0) # quantity of MaterialY used\n\n# Define objective function\nProfit_A = 50 * ProdA\nProfit_B = 70 * ProdB\nProfit_C = 90 * ProdC\nCost_X = 10 * MatX\nCost_Y = 15 * MatY\nMatX_A = 0.8 * ProdA\nMatX_B = 0.9 * ProdB\nMatX_C = 0.7 * ProdC\nMatY_A = 0.9 * ProdA\nMatY_B = 0.8 * ProdB\nMatY_C = 0.6 * ProdC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n# Add constraints\nmodel.addCons(MatX_A + MatX_B + MatX_C <= MatX)\nmodel.addCons(MatX <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Quantity of MaterialX Used: \", model.getVal(MatX))\n    print(\"Quantity of MaterialY Used: \", model.getVal(MatY))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n// Delivery efficiency of Trucks: Efficiency_T = 10 * T / 100\n// Delivery efficiency of Vans: Efficiency_V = 5 * V / 50\n// Delivery efficiency of Bikes: Efficiency_B = 2 * B / 20\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B) = Maximize (10 * T / 100 + 5 * V / 50 + 2 * B / 20)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for operational costs.\n// 100 * T + 50 * V + 20 * B <= 1000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints. The operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs. The company has a budget of $1000 per day for operational costs. Please help the company to maximize the delivery efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = 10 * T / 100\nEfficiency_V = 5 * V / 50\nEfficiency_B = 2 * B / 20\n## convert the division to multiplication\nmodel.addCons(obj * (100 * T + 50 * V + 20 * B) == 10 * T + 5 * V + 2 * B)\n\n# Add constraints\n## The company has a budget of $1000 per day for operational costs.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in the factory. The production cost, revenue, and resource consumption vary for each product and shift.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ProductAShifts\", \"range\": \"ProductAShifts >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ProductBShifts\", \"range\": \"ProductBShifts >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ProductCShifts\", \"range\": \"ProductCShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, and the revenue per unit is $100. For ProductB, the production cost per unit is $60, and the revenue per unit is $120. For ProductC, the production cost per unit is $70, and the revenue per unit is $140. The cost of operating a shift is $1000. The company wants to maximize the total net profit.\n// Profit_ProductA = (100 - 50) * ProductAQty - 1000 * ProductAShifts\n// Profit_ProductB = (120 - 60) * ProductBQty - 1000 * ProductBShifts\n// Profit_ProductC = (140 - 70) * ProductCQty - 1000 * ProductCShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 shifts available per week.\n// ProductAShifts + ProductBShifts + ProductCShifts <= 50\n\n## Generate Constraint-2:\nThe total production quantity for all products cannot exceed 1000 units per week.\n// ProductAQty + ProductBQty + ProductCQty <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in the factory. The production cost, revenue, and resource consumption vary for each product and shift.\nThe production cost per unit for ProductA is $50, and the revenue per unit is $100. For ProductB, the production cost per unit is $60, and the revenue per unit is $120. For ProductC, the production cost per unit is $70, and the revenue per unit is $140. The cost of operating a shift is $1000. The company wants to maximize the total net profit.\nThe company has a total of 50 shifts available per week. The total production quantity for all products cannot exceed 1000 units per week.\nPlease help the company to determine the optimal production quantity for each product and the number of shifts to operate in order to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nProductAShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductAShifts\", lb=0) # number of shifts for ProductA\nProductBShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductBShifts\", lb=0) # number of shifts for ProductB\nProductCShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductCShifts\", lb=0) # number of shifts for ProductC\n\n# Define objective function\nProfit_ProductA = (100 - 50) * ProductAQty - 1000 * ProductAShifts\nProfit_ProductB = (120 - 60) * ProductBQty - 1000 * ProductBShifts\nProfit_ProductC = (140 - 70) * ProductCQty - 1000 * ProductCShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 shifts available per week.\nmodel.addCons(ProductAShifts + ProductBShifts + ProductCShifts <= 50)\n# The total production quantity for all products cannot exceed 1000 units per week.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ProductAShifts))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ProductBShifts))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ProductCShifts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-3:\nThe total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\n// 250 * D <= (100 * A) + (150 * B) + (200 * C)\n\n## Generate Constraint-4:\nThe total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\n// 6 * 300 * E <= (2 * 100 * A) + (3 * 150 * B) + (4 * 200 * C) + (5 * 250 * D)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n\nThe company has a total of 50 trucks available. Each route must have at least 2 trucks. The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined. The total cost of route E must not exceed the combined total cost of routes A, B, C, and D. The company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\n\nPlease help the company to minimize the total cost of operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n## The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\nmodel.addCons(250 * D <= (100 * A) + (150 * B) + (200 * C))\n## The total cost of route E must not exceed the combined total cost of routes A, B, C, and D.\nmodel.addCons(6 * 300 * E <= (2 * 100 * A) + (3 * 150 * B) + (4 * 200 * C) + (5 * 250 * D))\n## The company wants to ensure that the number of trucks on route E does not exceed the combined number of trucks on routes A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company has 5 different solar farms and needs to optimize the number of solar panels to install at each farm to maximize energy output while minimizing costs.\n// {\"number of solar panels at farm 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output of each solar panel varies by farm due to differences in sunlight exposure and efficiency. \nAt farm 1, each panel produces 10 kWh of energy per day. \nAt farm 2, each panel produces 12 kWh of energy per day. \nAt farm 3, each panel produces 15 kWh of energy per day. \nAt farm 4, each panel produces 14 kWh of energy per day. \nAt farm 5, each panel produces 11 kWh of energy per day. \nThe cost of installing each panel also varies by farm. \nThe cost per panel at farm 1 is $500, at farm 2 is $550, at farm 3 is $600, at farm 4 is $580, and at farm 5 is $520. \nThe company aims to maximize the total energy output while keeping the total installation cost below $1,000,000.\n// The total energy output: E = 10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5\n// The total installation cost: C = 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5\n// So, the objective function is: Maximize E - C\n// Maximize (10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5) - (500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5)\n\n## Generate Constraint-1:\nThe total installation cost must not exceed $1,000,000.\n// 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5 <= 1,000,000\n\n## Generate Constraint-2:\nEach farm has a limited area for installation, allowing for a maximum of 2000 panels.\n// S1 <= 2000; S2 <= 2000; S3 <= 2000; S4 <= 2000; S5 <= 2000",
        "question": "A solar energy company has 5 different solar farms and needs to optimize the number of solar panels to install at each farm to maximize energy output while minimizing costs. The energy output per panel and the cost per panel vary by farm as shown in the following Table.\n\n| Farm | Energy Output per Panel (kWh/day) | Cost per Panel ($) |\n|------|----------------------------------|-------------------|\n| 1    | 10                               | 500               |\n| 2    | 12                               | 550               |\n| 3    | 15                               | 600               |\n| 4    | 14                               | 580               |\n| 5    | 11                               | 520               |\n\nThe company aims to maximize the total energy output while keeping the total installation cost below $1,000,000. Each farm has a limited area for installation, allowing for a maximum of 2000 panels. Please help the company determine the optimal number of solar panels to install at each farm to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at farm 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at farm 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at farm 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at farm 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at farm 5\n\n# Define objective function\n## The total energy output: E = 10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5\n## The total installation cost: C = 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5\n## So, the objective function is: Maximize E - C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5) - (500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5))\n\n# Add constraints\n## The total installation cost must not exceed $1,000,000.\nmodel.addCons(500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5 <= 1000000)\n## Each farm has a limited area for installation, allowing for a maximum of 2000 panels.\nmodel.addCons(S1 <= 2000)\nmodel.addCons(S2 <= 2000)\nmodel.addCons(S3 <= 2000)\nmodel.addCons(S4 <= 2000)\nmodel.addCons(S5 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Farm 1: \", model.getVal(S1))\n    print(\"Number of Solar Panels at Farm 2: \", model.getVal(S2))\n    print(\"Number of Solar Panels at Farm 3: \", model.getVal(S3))\n    print(\"Number of Solar Panels at Farm 4: \", model.getVal(S4))\n    print(\"Number of Solar Panels at Farm 5: \", model.getVal(S5))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. Component A has a profit of $5 per unit and a production cost of $2 per unit. Component B has a profit of $7 per unit and a production cost of $3 per unit. Component C has a profit of $9 per unit and a production cost of $4 per unit. Component D has a profit of $11 per unit and a production cost of $5 per unit. The firm aims to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n// Profit of A: Profit_A = (5 - 2) * A\n// Profit of B: Profit_B = (7 - 3) * B\n// Profit of C: Profit_C = (9 - 4) * C\n// Profit of D: Profit_D = (11 - 5) * D\n// Production time for A: Time_A = 0.5 * A\n// Production time for B: Time_B = 0.7 * B\n// Production time for C: Time_C = 0.9 * C\n// Production time for D: Time_D = 1.1 * D\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n\n## Generate Constraint-1:\nThe firm has a budget of $1000 for production costs in the upcoming quarter.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe firm must produce at least 20 units of each component in the upcoming quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20\n\n## Generate Constraint-3:\nThe firm has a maximum of 150 hours available for production in the upcoming quarter.\n// 0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations. The profit margin, production cost, and production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|---------------------------|--------------------------|\n| A         | $5              | $2                        | 0.5 hours                |\n| B         | $7              | $3                        | 0.7 hours                |\n| C         | $9              | $4                        | 0.9 hours                |\n| D         | $11             | $5                        | 1.1 hours                |\n\nThe firm has a budget of $1000 for production costs in the upcoming quarter. The firm must produce at least 20 units of each component in the upcoming quarter. The firm has a maximum of 150 hours available for production in the upcoming quarter. \nPlease help the firm to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm must produce at least 20 units of each component in the upcoming quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (7 - 3) * B\nProfit_C = (9 - 4) * C\nProfit_D = (11 - 5) * D\nTime_A = 0.5 * A\nTime_B = 0.7 * B\nTime_C = 0.9 * C\nTime_D = 1.1 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n## convert the division to multiplication\nmodel.addCons(obj * (Time_A + Time_B + Time_C + Time_D) == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $1000 for production costs in the upcoming quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n## The firm has a maximum of 150 hours available for production in the upcoming quarter.\nmodel.addCons(0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for CargoA is $1000 per day, for CargoB is $1200 per day, for CargoC is $1500 per day, for CargoD is $1800 per day, and for CargoE is $2000 per day. The revenue generated by each truck for CargoA is $2000 per day, for CargoB is $2500 per day, for CargoC is $3000 per day, for CargoD is $3500 per day, and for CargoE is $4000 per day. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\n// Total net revenue for CargoA: Revenue_A = (2000 - 1000) * TrucksA\n// Total net revenue for CargoB: Revenue_B = (2500 - 1200) * TrucksB\n// Total net revenue for CargoC: Revenue_C = (3000 - 1500) * TrucksC\n// Total net revenue for CargoD: Revenue_D = (3500 - 1800) * TrucksD\n// Total net revenue for CargoE: Revenue_E = (4000 - 2000) * TrucksE\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, CargoA must be transported by at least 10 trucks.\n// TrucksA >= 10",
        "question": "A logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck and the revenue generated per day for each type of cargo are given in the following Table.\n\n| Cargo Type | Operating Cost per Truck per Day | Revenue per Truck per Day |\n|------------|----------------------------------|---------------------------|\n| CargoA     | $1000                            | $2000                     |\n| CargoB     | $1200                            | $2500                     |\n| CargoC     | $1500                            | $3000                     |\n| CargoD     | $1800                            | $3500                     |\n| CargoE     | $2000                            | $4000                     |\n\nThe company has a total of 50 trucks available for distribution. Due to contractual agreements, CargoA must be transported by at least 10 trucks. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\n\nPlease help the company determine the optimal allocation of trucks to each type of cargo to maximize their total net revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company has a total of 50 trucks available for distribution.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for CargoA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CargoB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CargoC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CargoD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for CargoE\n\n# Define objective function\n## The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\nRevenue_A = (2000 - 1000) * TrucksA\nRevenue_B = (2500 - 1200) * TrucksB\nRevenue_C = (3000 - 1500) * TrucksC\nRevenue_D = (3500 - 1800) * TrucksD\nRevenue_E = (4000 - 2000) * TrucksE\n## So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to contractual agreements, CargoA must be transported by at least 10 trucks.\nmodel.addCons(TrucksA >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CargoB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CargoC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CargoD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for CargoE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (A, B, C, D, E) across three warehouses (Warehouse1, Warehouse2, Warehouse3). Each package type has a different size and weight, affecting the cost and efficiency of storage and transportation.\n// {\"number of packages of type A in Warehouse1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type A in Warehouse2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type A in Warehouse3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of storing and transporting each package type varies with the warehouse. The cost for type A is $5 in Warehouse1, $6 in Warehouse2, and $7 in Warehouse3. For type B, the costs are $7, $8, and $9, respectively. For type C, the costs are $9, $10, and $11. For type D, the costs are $11, $12, and $13. For type E, the costs are $13, $14, and $15. The company aims to minimize the total cost of storage and transportation across all warehouses.\n// Total cost = 5 * A1 + 6 * A2 + 7 * A3 + 7 * B1 + 8 * B2 + 9 * B3 + 9 * C1 + 10 * C2 + 11 * C3 + 11 * D1 + 12 * D2 + 13 * D3 + 13 * E1 + 14 * E2 + 15 * E3\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of type A packages distributed across all warehouses must be 100.\n// A1 + A2 + A3 = 100\n\n## Generate Constraint-2:\nThe total number of type B packages distributed across all warehouses must be 150.\n// B1 + B2 + B3 = 150\n\n## Generate Constraint-3:\nThe total number of type C packages distributed across all warehouses must be 200.\n// C1 + C2 + C3 = 200\n\n## Generate Constraint-4:\nThe total number of type D packages distributed across all warehouses must be 250.\n// D1 + D2 + D3 = 250",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (A, B, C, D, E) across three warehouses (Warehouse1, Warehouse2, Warehouse3). Each package type has a different size and weight, affecting the cost and efficiency of storage and transportation. The cost of storing and transporting each package type varies with the warehouse. For type A, the costs are $5 in Warehouse1, $6 in Warehouse2, and $7 in Warehouse3. For type B, the costs are $7, $8, and $9, respectively. For type C, the costs are $9, $10, and $11. For type D, the costs are $11, $12, and $13. For type E, the costs are $13, $14, and $15. The company aims to minimize the total cost of storage and transportation across all warehouses. The total number of type A packages distributed across all warehouses must be 100. The total number of type B packages distributed across all warehouses must be 150. The total number of type C packages distributed across all warehouses must be 200. The total number of type D packages distributed across all warehouses must be 250.\n\nPlease help the company determine the optimal distribution of packages across the warehouses to minimize the total cost of storage and transportation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # number of packages of type A in Warehouse1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # number of packages of type A in Warehouse2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # number of packages of type A in Warehouse3\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of packages of type B in Warehouse1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of packages of type B in Warehouse2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of packages of type B in Warehouse3\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of packages of type C in Warehouse1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of packages of type C in Warehouse2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of packages of type C in Warehouse3\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of packages of type D in Warehouse1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of packages of type D in Warehouse2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of packages of type D in Warehouse3\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of packages of type E in Warehouse1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of packages of type E in Warehouse2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of packages of type E in Warehouse3\n\n# Define objective function\nTotal_cost = 5 * A1 + 6 * A2 + 7 * A3 + 7 * B1 + 8 * B2 + 9 * B3 + 9 * C1 + 10 * C2 + 11 * C3 + 11 * D1 + 12 * D2 + 13 * D3 + 13 * E1 + 14 * E2 + 15 * E3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_cost)\n\n# Add constraints\nmodel.addCons(A1 + A2 + A3 == 100) # total number of type A packages must be 100\nmodel.addCons(B1 + B2 + B3 == 150) # total number of type B packages must be 150\nmodel.addCons(C1 + C2 + C3 == 200) # total number of type C packages must be 200\nmodel.addCons(D1 + D2 + D3 == 250) # total number of type D packages must be 250\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of packages of type A in Warehouse1: \", model.getVal(A1))\n    print(\"Number of packages of type A in Warehouse2: \", model.getVal(A2))\n    print(\"Number of packages of type A in Warehouse3: \", model.getVal(A3))\n    print(\"Number of packages of type B in Warehouse1: \", model.getVal(B1))\n    print(\"Number of packages of type B in Warehouse2: \", model.getVal(B2))\n    print(\"Number of packages of type B in Warehouse3: \", model.getVal(B3))\n    print(\"Number of packages of type C in Warehouse1: \", model.getVal(C1))\n    print(\"Number of packages of type C in Warehouse2: \", model.getVal(C2))\n    print(\"Number of packages of type C in Warehouse3: \", model.getVal(C3))\n    print(\"Number of packages of type D in Warehouse1: \", model.getVal(D1))\n    print(\"Number of packages of type D in Warehouse2: \", model.getVal(D2))\n    print(\"Number of packages of type D in Warehouse3: \", model.getVal(D3))\n    print(\"Number of packages of type E in Warehouse1: \", model.getVal(E1))\n    print(\"Number of packages of type E in Warehouse2: \", model.getVal(E2))\n    print(\"Number of packages of type E in Warehouse3: \", model.getVal(E3))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited.\n// {\"production quantity for Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product A\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product B\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product C\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit for Product A is $30, Product B is $40, and Product C is $20. The company aims to maximize the total profit from the production of all three products.\n// Profit_ProductA = ProductA * (50 - 30)\n// Profit_ProductB = ProductB * (70 - 40)\n// Profit_ProductC = ProductC * (60 - 20)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\n// ProductA <= StorageA\n// ProductB <= StorageB\n// ProductC <= StorageC\n\n## Generate Constraint-2:\nThe total production capacity for all products combined is 300 units.\n// ProductA + ProductB + ProductC <= 300\n\n## Generate Constraint-3:\nThe demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units.\n// ProductA >= 50\n// ProductB >= 70\n// ProductC >= 60\n\n## Generate Constraint-4:\nThe cost of production for all products combined should not exceed $10,000.\n// 30 * ProductA + 40 * ProductB + 20 * ProductC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited. The profit per unit and the cost of production per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $30                         |\n| B       | $70             | $40                         |\n| C       | $60             | $20                         |\n\nThe total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units. The total production capacity for all products combined is 300 units. The demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units. The cost of production for all products combined should not exceed $10,000.\n\nPlease help the company to maximize the total profit from the production of all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=50) # production quantity for Product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=70) # production quantity for Product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=60) # production quantity for Product C\nStorageA = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageA\", lb=100) # storage capacity for Product A\nStorageB = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageB\", lb=150) # storage capacity for Product B\nStorageC = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageC\", lb=200) # storage capacity for Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 30)\nProfit_ProductB = ProductB * (70 - 40)\nProfit_ProductC = ProductC * (60 - 20)\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\nmodel.addCons(ProductA <= StorageA)\nmodel.addCons(ProductB <= StorageB)\nmodel.addCons(ProductC <= StorageC)\n# The total production capacity for all products combined is 300 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 300)\n# The demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units.\nmodel.addCons(ProductA >= 50)\nmodel.addCons(ProductB >= 70)\nmodel.addCons(ProductC >= 60)\n# The cost of production for all products combined should not exceed $10,000.\nmodel.addCons(30 * ProductA + 40 * ProductB + 20 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can handle is limited to 500 per day.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500\n\n## Generate Constraint-3:\nEach Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day.\n// SmallTrips <= 3; MediumTrips <= 4; LargeTrips <= 5",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\nFor Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades. The total number of trips the company can handle is limited to 500 per day. Each Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day.\nPlease help the company to minimize the total operational cost of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0)  # number of trips per Small truck\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0)  # number of trips per Medium truck\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0)  # number of trips per Large truck\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)  # fuel efficiency upgrade for Small trucks\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)  # fuel efficiency upgrade for Medium trucks\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)  # fuel efficiency upgrade for Large trucks\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500)\nmodel.addCons(SmallTrips <= 3)\nmodel.addCons(MediumTrips <= 4)\nmodel.addCons(LargeTrips <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter and a maintenance cost of $100 per month.\nTruck B has a fuel efficiency of 7 km/liter and a maintenance cost of $120 per month.\nTruck C has a fuel efficiency of 9 km/liter and a maintenance cost of $140 per month.\nTruck D has a fuel efficiency of 11 km/liter and a maintenance cost of $160 per month.\nTruck E has a fuel efficiency of 13 km/liter and a maintenance cost of $180 per month.\nThe company aims to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).\n// Total maintenance cost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\n// Total kilometers driven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Minimize (100 * A + 120 * B + 140 * C + 160 * D + 180 * E) / (5 * A + 7 * B + 9 * C + 11 * D + 13 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for maintenance costs for the upcoming month.\n// 100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\nTruck A has a fuel efficiency of 5 km/liter and a maintenance cost of $100 per month.\nTruck B has a fuel efficiency of 7 km/liter and a maintenance cost of $120 per month.\nTruck C has a fuel efficiency of 9 km/liter and a maintenance cost of $140 per month.\nTruck D has a fuel efficiency of 11 km/liter and a maintenance cost of $160 per month.\nTruck E has a fuel efficiency of 13 km/liter and a maintenance cost of $180 per month.\nThe company has a budget of $5000 for maintenance costs for the upcoming month. The company has a limit of 100 trucks that can be deployed in total.\nPlease help the company to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalMaintenanceCost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\nTotalKilometersDriven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Minimize (TotalMaintenanceCost) / (TotalKilometersDriven)\n## convert the division to multiplication\nmodel.addCons(obj * TotalKilometersDriven == TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $5000 for maintenance costs for the upcoming month.\nmodel.addCons(100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\n// B >= 0.1 * (T + V + B)\n\n## Generate Constraint-4:\nThe company has a daily revenue target of $20,000.\n// 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed. The company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery. The company has a daily revenue target of $20,000. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to meet these constraints and maximize their daily efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\nmodel.addCons(B >= 0.1 * (T + V + B))\n## The company has a daily revenue target of $20,000.\nmodel.addCons(1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Daily Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate for production and marketing for each device.\n// {\"number of units for DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units for DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units for DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursProdA\", \"range\": \"HoursProdA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursProdB\", \"range\": \"HoursProdB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursProdC\", \"range\": \"HoursProdC >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceA\": \"HoursMarketA\", \"range\": \"HoursMarketA >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceB\": \"HoursMarketB\", \"range\": \"HoursMarketB >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceC\": \"HoursMarketC\", \"range\": \"HoursMarketC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per hour is $20, and the marketing cost per hour is $30. The company wants to maximize the total profit, considering both production and marketing costs.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (20 * HoursProdA) - (30 * HoursMarketA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (20 * HoursProdB) - (30 * HoursMarketB)\n// Total profit for DeviceC: Profit_C = (60 * UnitsC) - (20 * HoursProdC) - (30 * HoursMarketC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 500 production hours available for the quarter.\n// HoursProdA + HoursProdB + HoursProdC <= 500\n\n## Generate Constraint-2:\nThe company has a total of 300 marketing hours available for the quarter.\n// HoursMarketA + HoursMarketB + HoursMarketC <= 300\n\n## Generate Constraint-3:\nDue to production capacity, the number of units produced for DeviceA cannot exceed twice the number of units produced for DeviceB.\n// UnitsA <= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate for production and marketing for each device. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per hour is $20, and the marketing cost per hour is $30. The company wants to maximize the total profit, considering both production and marketing costs.\n\n| Device | Profit per Unit | Production Cost per Hour | Marketing Cost per Hour |\n|--------|-----------------|--------------------------|-------------------------|\n| DeviceA | $50             | $20                      | $30                     |\n| DeviceB | $70             | $20                      | $30                     |\n| DeviceC | $60             | $20                      | $30                     |\n\nThe company has a total of 500 production hours available for the quarter. The company also has a total of 300 marketing hours available for the quarter. Due to production capacity, the number of units produced for DeviceA cannot exceed twice the number of units produced for DeviceB.\n\nPlease help the company to maximize the total profit, considering both production and marketing costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units for DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units for DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units for DeviceC\nHoursProdA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdA\", lb=0)  # production hours for DeviceA\nHoursProdB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdB\", lb=0)  # production hours for DeviceB\nHoursProdC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdC\", lb=0)  # production hours for DeviceC\nHoursMarketA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketA\", lb=0)  # marketing hours for DeviceA\nHoursMarketB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketB\", lb=0)  # marketing hours for DeviceB\nHoursMarketC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketC\", lb=0)  # marketing hours for DeviceC\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (20 * HoursProdA) - (30 * HoursMarketA)\nProfit_B = (70 * UnitsB) - (20 * HoursProdB) - (30 * HoursMarketB)\nProfit_C = (60 * UnitsC) - (20 * HoursProdC) - (30 * HoursMarketC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursProdA + HoursProdB + HoursProdC <= 500)  # Total production hours constraint\nmodel.addCons(HoursMarketA + HoursMarketB + HoursMarketC <= 300)  # Total marketing hours constraint\nmodel.addCons(UnitsA <= 2 * UnitsB)  # Production capacity constraint for DeviceA\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units for DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units for DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units for DeviceC: \", model.getVal(UnitsC))\n    print(\"Production Hours for DeviceA: \", model.getVal(HoursProdA))\n    print(\"Production Hours for DeviceB: \", model.getVal(HoursProdB))\n    print(\"Production Hours for DeviceC: \", model.getVal(HoursProdC))\n    print(\"Marketing Hours for DeviceA: \", model.getVal(HoursMarketA))\n    print(\"Marketing Hours for DeviceB: \", model.getVal(HoursMarketB))\n    print(\"Marketing Hours for DeviceC: \", model.getVal(HoursMarketC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product and the level of automation to be implemented in the production process. Higher levels of automation reduce the labor cost per unit but increase the initial investment cost.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by $5 for every $1000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investments.\n// AutomationLevel <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product (QuantityA, QuantityB, QuantityC) and the level of automation to be implemented in the production process (AutomationLevel). Higher levels of automation reduce the labor cost per unit but increase the initial investment cost. The labor cost per unit decreases by $5 for every $1000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for automation investments. The total production capacity for all products is 5000 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0) # level of automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\nProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\nProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationLevel <= 100000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost is $500 per month, and the rental cost is $1000 per month. \nFor TruckB, the fuel efficiency is 15 km/l, the maintenance cost is $700 per month, and the rental cost is $1200 per month. \nFor TruckC, the fuel efficiency is 20 km/l, the maintenance cost is $900 per month, and the rental cost is $1400 per month.\nFor TruckD, the fuel efficiency is 25 km/l, the maintenance cost is $1100 per month, and the rental cost is $1600 per month.\nFor TruckE, the fuel efficiency is 30 km/l, the maintenance cost is $1300 per month, and the rental cost is $1800 per month.\nThe company aims to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance).\n// Total cost for TruckA: Cost_TruckA = (1000 + 500) * TruckA\n// Total cost for TruckB: Cost_TruckB = (1200 + 700) * TruckB\n// Total cost for TruckC: Cost_TruckC = (1400 + 900) * TruckC\n// Total cost for TruckD: Cost_TruckD = (1600 + 1100) * TruckD\n// Total cost for TruckE: Cost_TruckE = (1800 + 1300) * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month.\n// (1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150,000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and rental cost for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/l) | Maintenance Cost per Month | Rental Cost per Month |\n|-------|-----------------------|----------------------------|----------------------|\n| TruckA | 10 | $500 | $1000 |\n| TruckB | 15 | $700 | $1200 |\n| TruckC | 20 | $900 | $1400 |\n| TruckD | 25 | $1100 | $1600 |\n| TruckE | 30 | $1300 | $1800 |\n\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month. The company aims to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance). Please help the company determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (1000 + 500) * TruckA\nCost_TruckB = (1200 + 700) * TruckB\nCost_TruckC = (1400 + 900) * TruckC\nCost_TruckD = (1600 + 1100) * TruckD\nCost_TruckE = (1800 + 1300) * TruckE\nDistance = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Distance\n## convert the division to multiplication\nmodel.addCons(obj * Distance == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $150,000 for truck rentals and maintenance for the next month.\nmodel.addCons((1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (Truck_Region1, Truck_Region2, Truck_Region3), the speed at which each truck travels (Speed_Region1, Speed_Region2, Speed_Region3), and the fuel efficiency investment per region (Efficiency_Investment_Region1, Efficiency_Investment_Region2, Efficiency_Investment_Region3).\n// {\"number of trucks in Region1\": \"Truck_Region1\", \"range\": \"Truck_Region1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck_Region2\", \"range\": \"Truck_Region2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck_Region3\", \"range\": \"Truck_Region3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed_Region1\", \"range\": \"0 < Speed_Region1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed_Region2\", \"range\": \"0 < Speed_Region2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed_Region3\", \"range\": \"0 < Speed_Region3 <= 60\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region1\": \"Efficiency_Investment_Region1\", \"range\": \"Efficiency_Investment_Region1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region2\": \"Efficiency_Investment_Region2\", \"range\": \"Efficiency_Investment_Region2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region3\": \"Efficiency_Investment_Region3\", \"range\": \"Efficiency_Investment_Region3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed and the investment in fuel efficiency. The faster the truck, the more fuel it consumes, but the investment in fuel efficiency reduces the fuel consumption per mile. The company aims to minimize the total fuel cost across all regions.\n// Fuel_Cost_Region1 = (1 + 0.005 * Speed_Region1^2) * Truck_Region1 * (1 - 0.01 * Efficiency_Investment_Region1)\n// Fuel_Cost_Region2 = (1 + 0.005 * Speed_Region2^2) * Truck_Region2 * (1 - 0.01 * Efficiency_Investment_Region2)\n// Fuel_Cost_Region3 = (1 + 0.005 * Speed_Region3^2) * Truck_Region3 * (1 - 0.01 * Efficiency_Investment_Region3)\n// So, the objective function is: Minimize (Fuel_Cost_Region1 + Fuel_Cost_Region2 + Fuel_Cost_Region3)\n\n## Generate Constraint-1:\nThe total investment in fuel efficiency across all regions must not exceed $100,000.\n// Efficiency_Investment_Region1 + Efficiency_Investment_Region2 + Efficiency_Investment_Region3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all regions must not exceed 100.\n// Truck_Region1 + Truck_Region2 + Truck_Region3 <= 100\n\n## Generate Constraint-3:\nThe minimum speed requirement for trucks in each region is 20 mph.\n// Speed_Region1 >= 20; Speed_Region2 >= 20; Speed_Region3 >= 20",
        "question": "A logistics company operates a fleet of trucks that transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (Truck_Region1, Truck_Region2, Truck_Region3), the speed at which each truck travels (Speed_Region1, Speed_Region2, Speed_Region3), and the fuel efficiency investment per region (Efficiency_Investment_Region1, Efficiency_Investment_Region2, Efficiency_Investment_Region3). The fuel consumption of each truck is a nonlinear function of its speed and the investment in fuel efficiency. The faster the truck, the more fuel it consumes, but the investment in fuel efficiency reduces the fuel consumption per mile. The company aims to minimize the total fuel cost across all regions.\n\n| Variable                          | Range/Requirement                  |\n|-----------------------------------|------------------------------------|\n| Number of trucks in Region1       | Truck_Region1 >= 0                 |\n| Number of trucks in Region2       | Truck_Region2 >= 0                 |\n| Number of trucks in Region3       | Truck_Region3 >= 0                 |\n| Speed of trucks in Region1        | 0 < Speed_Region1 <= 60            |\n| Speed of trucks in Region2        | 0 < Speed_Region2 <= 60            |\n| Speed of trucks in Region3        | 0 < Speed_Region3 <= 60            |\n| Fuel efficiency investment in Region1 | Efficiency_Investment_Region1 >= 0 |\n| Fuel efficiency investment in Region2 | Efficiency_Investment_Region2 >= 0 |\n| Fuel efficiency investment in Region3 | Efficiency_Investment_Region3 >= 0 |\n\nThe total investment in fuel efficiency across all regions must not exceed $100,000. The total number of trucks across all regions must not exceed 100. The minimum speed requirement for trucks in each region is 20 mph.\n\nPlease help the company to minimize the total fuel cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_Region1 = model.addVar(vtype=\"INTEGER\", name=\"Truck_Region1\", lb=0)  # number of trucks in Region1\nTruck_Region2 = model.addVar(vtype=\"INTEGER\", name=\"Truck_Region2\", lb=0)  # number of trucks in Region2\nTruck_Region3 = model.addVar(vtype=\"INTEGER\", name=\"Truck_Region3\", lb=0)  # number of trucks in Region3\nSpeed_Region1 = model.addVar(name=\"Speed_Region1\", lb=20, ub=60)  # speed of trucks in Region1\nSpeed_Region2 = model.addVar(name=\"Speed_Region2\", lb=20, ub=60)  # speed of trucks in Region2\nSpeed_Region3 = model.addVar(name=\"Speed_Region3\", lb=20, ub=60)  # speed of trucks in Region3\nEfficiency_Investment_Region1 = model.addVar(name=\"Efficiency_Investment_Region1\", lb=0)  # fuel efficiency investment in Region1\nEfficiency_Investment_Region2 = model.addVar(name=\"Efficiency_Investment_Region2\", lb=0)  # fuel efficiency investment in Region2\nEfficiency_Investment_Region3 = model.addVar(name=\"Efficiency_Investment_Region3\", lb=0)  # fuel efficiency investment in Region3\n\n# Define objective function\nFuel_Cost_Region1 = (1 + 0.005 * Speed_Region1**2) * Truck_Region1 * (1 - 0.01 * Efficiency_Investment_Region1)\nFuel_Cost_Region2 = (1 + 0.005 * Speed_Region2**2) * Truck_Region2 * (1 - 0.01 * Efficiency_Investment_Region2)\nFuel_Cost_Region3 = (1 + 0.005 * Speed_Region3**2) * Truck_Region3 * (1 - 0.01 * Efficiency_Investment_Region3)\n# So, the objective function is: Minimize (Fuel_Cost_Region1 + Fuel_Cost_Region2 + Fuel_Cost_Region3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_Region1 + Fuel_Cost_Region2 + Fuel_Cost_Region3)\n\n# Add constraints\n# The total investment in fuel efficiency across all regions must not exceed $100,000.\nmodel.addCons(Efficiency_Investment_Region1 + Efficiency_Investment_Region2 + Efficiency_Investment_Region3 <= 100000)\n# The total number of trucks across all regions must not exceed 100.\nmodel.addCons(Truck_Region1 + Truck_Region2 + Truck_Region3 <= 100)\n# The minimum speed requirement for trucks in each region is 20 mph.\nmodel.addCons(Speed_Region1 >= 20)\nmodel.addCons(Speed_Region2 >= 20)\nmodel.addCons(Speed_Region3 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck_Region1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck_Region2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck_Region3))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed_Region1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed_Region2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed_Region3))\n    print(\"Fuel Efficiency Investment in Region1: \", model.getVal(Efficiency_Investment_Region1))\n    print(\"Fuel Efficiency Investment in Region2: \", model.getVal(Efficiency_Investment_Region2))\n    print(\"Fuel Efficiency Investment in Region3: \", model.getVal(Efficiency_Investment_Region3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1962,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer.\n// {\"number of kilometers driven by Truck1\": \"Truck1Km\", \"range\": \"Truck1Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck2\": \"Truck2Km\", \"range\": \"Truck2Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck3\": \"Truck3Km\", \"range\": \"Truck3Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck4\": \"Truck4Km\", \"range\": \"Truck4Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck5\": \"Truck5Km\", \"range\": \"Truck5Km >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km.\nThe fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km.\nThe fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km.\nThe fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km.\nThe fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km.\nThe company wants to minimize the total cost of fuel and maintenance.\n// FuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\n// MaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe total distance that all trucks can cover is limited to 10,000 km.\n// Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs.\n// (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer. The fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km. The fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km. The fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km. The fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km. The fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km. The company wants to minimize the total cost of fuel and maintenance. The total distance that all trucks can cover is limited to 10,000 km. The company has a budget of $5000 for fuel costs. Please help the company to determine the optimal number of kilometers each truck should drive to minimize the total cost of fuel and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1Km\", lb=0) # number of kilometers driven by Truck1\nTruck2Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2Km\", lb=0) # number of kilometers driven by Truck2\nTruck3Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3Km\", lb=0) # number of kilometers driven by Truck3\nTruck4Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4Km\", lb=0) # number of kilometers driven by Truck4\nTruck5Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5Km\", lb=0) # number of kilometers driven by Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPrice = 1  # Assuming fuel price is $1 per liter for simplicity\nFuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\nMaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n## the objective function is: Minimize (FuelCost + MaintenanceCost)\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The total distance that all trucks can cover is limited to 10,000 km.\nmodel.addCons(Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000)\n## The company has a budget of $5000 for fuel costs.\nmodel.addCons((Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of kilometers driven by Truck1: \", model.getVal(Truck1Km))\n    print(\"Number of kilometers driven by Truck2: \", model.getVal(Truck2Km))\n    print(\"Number of kilometers driven by Truck3: \", model.getVal(Truck3Km))\n    print(\"Number of kilometers driven by Truck4: \", model.getVal(Truck4Km))\n    print(\"Number of kilometers driven by Truck5: \", model.getVal(Truck5Km))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency rate based on the number of trucks allocated. The efficiency is calculated as the square root of the number of trucks, which represents the optimal balance between utilization and congestion. The company aims to maximize the total efficiency across all routes.\n// Efficiency of route 1: E1 = sqrt(T1)\n// Efficiency of route 2: E2 = sqrt(T2)\n// Efficiency of route 3: E3 = sqrt(T3)\n// Efficiency of route 4: E4 = sqrt(T4)\n// Efficiency of route 5: E5 = sqrt(T5)\n// Efficiency of route 6: E6 = sqrt(T6)\n// The objective function is: Maximize E1 + E2 + E3 + E4 + E5 + E6\n// Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route's efficiency is calculated as the square root of the number of trucks allocated, which represents the optimal balance between utilization and congestion. The company aims to maximize the total efficiency across all routes.\n\nThe company has a total of 100 trucks available. Please help the company determine the optimal allocation of trucks to each route to maximize the total efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\n# The objective function is: Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n# Convert square root to a variable to handle non-linearity\nE1 = model.addVar(name=\"E1\")\nE2 = model.addVar(name=\"E2\")\nE3 = model.addVar(name=\"E3\")\nE4 = model.addVar(name=\"E4\")\nE5 = model.addVar(name=\"E5\")\nE6 = model.addVar(name=\"E6\")\n\n# Constraints to link square root variables with original variables\nmodel.addCons(E1**2 == T1)\nmodel.addCons(E2**2 == T2)\nmodel.addCons(E3**2 == T3)\nmodel.addCons(E4**2 == T4)\nmodel.addCons(E5**2 == T5)\nmodel.addCons(E6**2 == T6)\n\n# Set objective as a variable\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 579,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of truck varies. T1 costs $100,000 with a fuel efficiency of 5 km/l, T2 costs $120,000 with a fuel efficiency of 6 km/l, T3 costs $150,000 with a fuel efficiency of 7 km/l, T4 costs $180,000 with a fuel efficiency of 8 km/l, and T5 costs $200,000 with a fuel efficiency of 9 km/l. The company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost.\n// Total purchase cost: PurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\n// Total annual fuel cost: FuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n// AnnualDistance is the total distance the company expects to cover in a year, and FuelPrice is the cost per liter of fuel.\n// So, the objective function is: Minimize (PurchaseCost + FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000\n\n## Generate Constraint-2:\nThe total number of trucks should not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nAt least 20% of the fleet should be T3 or T4 trucks for their superior fuel efficiency.\n// T3 + T4 >= 0.2 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase. T1 costs $100,000 with a fuel efficiency of 5 km/l, T2 costs $120,000 with a fuel efficiency of 6 km/l, T3 costs $150,000 with a fuel efficiency of 7 km/l, T4 costs $180,000 with a fuel efficiency of 8 km/l, and T5 costs $200,000 with a fuel efficiency of 9 km/l. The company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost. The company has a budget of $10 million for purchasing trucks. The total number of trucks should not exceed 100. At least 20% of the fleet should be T3 or T4 trucks for their superior fuel efficiency.\n\nPlease help the company to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost, given the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## Total purchase cost\nPurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\n## Total annual fuel cost\nAnnualDistance = 100000  # Assuming a fixed annual distance\nFuelPrice = 1.5  # Assuming a fixed fuel price per liter\nFuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n## Objective function: Minimize (PurchaseCost + FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == PurchaseCost + FuelCost)\n\n# Add constraints\n## The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000)\n## The total number of trucks should not exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## At least 20% of the fleet should be T3 or T4 trucks for their superior fuel efficiency.\nmodel.addCons(T3 + T4 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 trucks: \", model.getVal(T1))\n    print(\"Number of T2 trucks: \", model.getVal(T2))\n    print(\"Number of T3 trucks: \", model.getVal(T3))\n    print(\"Number of T4 trucks: \", model.getVal(T4))\n    print(\"Number of T5 trucks: \", model.getVal(T5))\n    print(\"Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel usage per truck in Region1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter varies by region, and the efficiency of trucks also differs. The cost of fuel in Region1 is $1.20/liter, in Region2 is $1.30/liter, in Region3 is $1.40/liter, in Region4 is $1.50/liter, and in Region5 is $1.60/liter. The efficiency of trucks in each region is inversely proportional to the fuel cost. The company aims to minimize the total cost of fuel and truck deployment.\n// Total fuel cost in Region1: Cost1 = 1.20 * Trucks1 * Fuel1\n// Total fuel cost in Region2: Cost2 = 1.30 * Trucks2 * Fuel2\n// Total fuel cost in Region3: Cost3 = 1.40 * Trucks3 * Fuel3\n// Total fuel cost in Region4: Cost4 = 1.50 * Trucks4 * Fuel4\n// Total fuel cost in Region5: Cost5 = 1.60 * Trucks5 * Fuel5\n// Total cost of truck deployment: DeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and truck deployment.\n// 1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nDue to regional regulations, the fuel usage per truck must not exceed 1000 liters in any region.\n// Fuel1 <= 1000; Fuel2 <= 1000; Fuel3 <= 1000; Fuel4 <= 1000; Fuel5 <= 1000",
        "question": "A logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck. The cost of fuel per liter varies by region, and the efficiency of trucks also differs. The cost of fuel in Region1 is $1.20/liter, in Region2 is $1.30/liter, in Region3 is $1.40/liter, in Region4 is $1.50/liter, and in Region5 is $1.60/liter. The efficiency of trucks in each region is inversely proportional to the fuel cost. The company aims to minimize the total cost of fuel and truck deployment.\n\n| Region   | Fuel Cost per Liter |\n|----------|---------------------|\n| Region1  | 1.20$               |\n| Region2  | 1.30$               |\n| Region3  | 1.40$               |\n| Region4  | 1.50$               |\n| Region5  | 1.60$               |\n\nThe company has a total budget of $50,000 for fuel and truck deployment. The total number of trucks available for deployment is 50. Due to regional regulations, the fuel usage per truck must not exceed 1000 liters in any region.\n\nPlease help the company to minimize the total cost of fuel and truck deployment, considering the constraints on budget, number of trucks, and fuel usage per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel usage per truck in Region1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel usage per truck in Region2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel usage per truck in Region3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)  # fuel usage per truck in Region4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)  # fuel usage per truck in Region5\n\n# Define objective function\nCost1 = 1.20 * Trucks1 * Fuel1\nCost2 = 1.30 * Trucks2 * Fuel2\nCost3 = 1.40 * Trucks3 * Fuel3\nCost4 = 1.50 * Trucks4 * Fuel4\nCost5 = 1.60 * Trucks5 * Fuel5\nDeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n# Add constraints\nmodel.addCons(1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Fuel1 <= 1000)\nmodel.addCons(Fuel2 <= 1000)\nmodel.addCons(Fuel3 <= 1000)\nmodel.addCons(Fuel4 <= 1000)\nmodel.addCons(Fuel5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Usage per Truck in Region1: \", model.getVal(Fuel1))\n    print(\"Fuel Usage per Truck in Region2: \", model.getVal(Fuel2))\n    print(\"Fuel Usage per Truck in Region3: \", model.getVal(Fuel3))\n    print(\"Fuel Usage per Truck in Region4: \", model.getVal(Fuel4))\n    print(\"Fuel Usage per Truck in Region5: \", model.getVal(Fuel5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each route is determined by the number of packages delivered per hour, which is influenced by the number of trucks allocated. \nFor route A, each truck can deliver 10 packages per hour.\nFor route B, each truck can deliver 15 packages per hour.\nFor route C, each truck can deliver 20 packages per hour.\nFor route D, each truck can deliver 25 packages per hour.\nFor route E, each truck can deliver 30 packages per hour.\nThe company aims to maximize the total number of packages delivered per hour across all routes.\n// Total packages delivered on route A: P_A = 10 * A\n// Total packages delivered on route B: P_B = 15 * B\n// Total packages delivered on route C: P_C = 20 * C\n// Total packages delivered on route D: P_D = 25 * D\n// Total packages delivered on route E: P_E = 30 * E\n// So, the objective function is: Maximize (P_A + P_B + P_C + P_D + P_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be allocated to any single route.\n// A <= 25; B <= 25; C <= 25; D <= 25; E <= 25",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize delivery efficiency. For route A, each truck can deliver 10 packages per hour. For route B, each truck can deliver 15 packages per hour. For route C, each truck can deliver 20 packages per hour. For route D, each truck can deliver 25 packages per hour. For route E, each truck can deliver 30 packages per hour. The company aims to maximize the total number of packages delivered per hour across all routes. The company has a total of 100 trucks available. Due to maintenance constraints, no more than 25 trucks can be allocated to any single route. Please help the company to maximize the total number of packages delivered per hour across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nP_A = 10 * A\nP_B = 15 * B\nP_C = 20 * C\nP_D = 25 * D\nP_E = 30 * E\n# So, the objective function is: Maximize (P_A + P_B + P_C + P_D + P_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C + P_D + P_E)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance constraints, no more than 25 trucks can be allocated to any single route.\nmodel.addCons(A <= 25)\nmodel.addCons(B <= 25)\nmodel.addCons(C <= 25)\nmodel.addCons(D <= 25)\nmodel.addCons(E <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase, the number of drivers to hire, and the amount of fuel to stockpile for each type of truck. Additionally, the company must determine the investment in maintenance and technology upgrades for each truck type to optimize fuel efficiency and reduce downtime.\n// {\"number of trucks of Type1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of Type2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Type1\": \"Drivers1\", \"range\": \"Drivers1 >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Type2\": \"Drivers2\", \"range\": \"Drivers2 >= 0\", \"type\": \"integer\"}\n// {\"fuel stock for Type1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel stock for Type2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade investment for Type1\": \"TechUpgrade1\", \"range\": \"TechUpgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade investment for Type2\": \"TechUpgrade2\", \"range\": \"TechUpgrade2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit, which is affected by the number of trips each truck can make, the efficiency of fuel usage, and the cost of maintenance and technology upgrades. The profit per trip for Type1 trucks is $1000, and for Type2 trucks is $1500. The fuel efficiency of Type1 trucks improves by 0.5% for every $1000 spent on technology upgrades, and Type2 trucks improve by 0.7% for every $1000 spent. Maintenance costs decrease by $500 for every $1000 spent on maintenance.\n// Profit per trip for Type1: Profit1 = 1000 * (Trucks1 * (Drivers1 / Trucks1)) * (1 + 0.005 * (TechUpgrade1 / 1000))\n// Profit per trip for Type2: Profit2 = 1500 * (Trucks2 * (Drivers2 / Trucks2)) * (1 + 0.007 * (TechUpgrade2 / 1000))\n// Maintenance cost reduction for Type1: CostReduction1 = 500 * (Maintenance1 / 1000)\n// Maintenance cost reduction for Type2: CostReduction2 = 500 * (Maintenance2 / 1000)\n// So, the objective function is: Maximize (Profit1 - CostReduction1 + Profit2 - CostReduction2)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks, hiring drivers, stockpiling fuel, and investing in maintenance and technology upgrades.\n// Trucks1 + Trucks2 + Drivers1 + Drivers2 + Fuel1 + Fuel2 + Maintenance1 + Maintenance2 + TechUpgrade1 + TechUpgrade2 <= 1000000\n\n## Generate Constraint-2:\nThe total number of drivers available is limited to 500.\n// Drivers1 + Drivers2 <= 500\n\n## Generate Constraint-3:\nDue to regulatory requirements, each type of truck must have at least one driver for every two trucks.\n// Drivers1 >= Trucks1 / 2; Drivers2 >= Trucks2 / 2",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase, the number of drivers to hire, and the amount of fuel to stockpile for each type of truck. Additionally, the company must determine the investment in maintenance and technology upgrades for each truck type to optimize fuel efficiency and reduce downtime. The company aims to maximize its quarterly profit, which is affected by the number of trips each truck can make, the efficiency of fuel usage, and the cost of maintenance and technology upgrades. The profit per trip for Type1 trucks is $1000, and for Type2 trucks is $1500. The fuel efficiency of Type1 trucks improves by 0.5% for every $1000 spent on technology upgrades, and Type2 trucks improve by 0.7% for every $1000 spent. Maintenance costs decrease by $500 for every $1000 spent on maintenance.\n\nThe company has a total budget of $1,000,000 for purchasing trucks, hiring drivers, stockpiling fuel, and investing in maintenance and technology upgrades. The total number of drivers available is limited to 500. Due to regulatory requirements, each type of truck must have at least one driver for every two trucks.\n\nPlease help the company to maximize its quarterly profit by determining the optimal number of trucks, drivers, fuel stock, and investments in maintenance and technology upgrades for each truck type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks of Type1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks of Type2\nDrivers1 = model.addVar(vtype=\"INTEGER\", name=\"Drivers1\", lb=0)  # number of drivers for Type1\nDrivers2 = model.addVar(vtype=\"INTEGER\", name=\"Drivers2\", lb=0)  # number of drivers for Type2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel stock for Type1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel stock for Type2\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance investment for Type2\nTechUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgrade1\", lb=0)  # technology upgrade investment for Type1\nTechUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgrade2\", lb=0)  # technology upgrade investment for Type2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit per trip for Type1: Profit1 = 1000 * (Trucks1 * (Drivers1 / Trucks1)) * (1 + 0.005 * (TechUpgrade1 / 1000))\n## Profit per trip for Type2: Profit2 = 1500 * (Trucks2 * (Drivers2 / Trucks2)) * (1 + 0.007 * (TechUpgrade2 / 1000))\n## Maintenance cost reduction for Type1: CostReduction1 = 500 * (Maintenance1 / 1000)\n## Maintenance cost reduction for Type2: CostReduction2 = 500 * (Maintenance2 / 1000)\n## So, the objective function is: Maximize (Profit1 - CostReduction1 + Profit2 - CostReduction2)\nProfit1 = 1000 * Trucks1 * (1 + 0.005 * (TechUpgrade1 / 1000))\nProfit2 = 1500 * Trucks2 * (1 + 0.007 * (TechUpgrade2 / 1000))\nCostReduction1 = 500 * (Maintenance1 / 1000)\nCostReduction2 = 500 * (Maintenance2 / 1000)\nmodel.addCons(obj == Profit1 - CostReduction1 + Profit2 - CostReduction2)\n\n# Add constraints\n## The company has a total budget of $1,000,000 for purchasing trucks, hiring drivers, stockpiling fuel, and investing in maintenance and technology upgrades.\nmodel.addCons(Trucks1 + Trucks2 + Drivers1 + Drivers2 + Fuel1 + Fuel2 + Maintenance1 + Maintenance2 + TechUpgrade1 + TechUpgrade2 <= 1000000)\n## The total number of drivers available is limited to 500.\nmodel.addCons(Drivers1 + Drivers2 <= 500)\n## Due to regulatory requirements, each type of truck must have at least one driver for every two trucks.\nmodel.addCons(Drivers1 >= Trucks1 / 2)\nmodel.addCons(Drivers2 >= Trucks2 / 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Type1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks Type2: \", model.getVal(Trucks2))\n    print(\"Number of Drivers Type1: \", model.getVal(Drivers1))\n    print(\"Number of Drivers Type2: \", model.getVal(Drivers2))\n    print(\"Fuel Stock Type1: \", model.getVal(Fuel1))\n    print(\"Fuel Stock Type2: \", model.getVal(Fuel2))\n    print(\"Maintenance Investment Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment Type2: \", model.getVal(Maintenance2))\n    print(\"Tech Upgrade Investment Type1: \", model.getVal(TechUpgrade1))\n    print(\"Tech Upgrade Investment Type2: \", model.getVal(TechUpgrade2))\n    print(\"Maximized Quarterly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1399,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is limited to 10,000 units across all products.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 1,500 units of product B.\n// A >= 1000; B >= 1500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient upgrades for their production lines. The energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $50,000 for energy efficiency upgrades. The total production capacity for the next quarter is limited to 10,000 units across all products. The company must produce at least 1,000 units of product A and 1,500 units of product B.\n\nPlease help the company to determine the optimal production quantity for each product and the appropriate investment in energy efficiency upgrades to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0) # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $50,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000)\n# The total production capacity for the next quarter is limited to 10,000 units across all products.\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n// Net profit of M1: Profit_M1 = (5000 - 3000 - 500) * M1\n// Net profit of M2: Profit_M2 = (7000 - 4000 - 700) * M2\n// Net profit of M3: Profit_M3 = (9000 - 5000 - 900) * M3\n// Net profit of M4: Profit_M4 = (11000 - 6000 - 1100) * M4\n// Net profit of M5: Profit_M5 = (13000 - 7000 - 1300) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (M1 + M2 + M3 + M4 + M5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for production costs next month.\n// 3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500,000",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy. The selling price, production cost, and maintenance cost per unit for each machine are given in the following Table.\n\n| Machine | Selling Price | Production Cost | Maintenance Cost per Unit |\n|---------|---------------|-----------------|---------------------------|\n| M1      | $5000         | $3000           | $500                      |\n| M2      | $7000         | $4000           | $700                      |\n| M3      | $9000         | $5000           | $900                      |\n| M4      | $11000        | $6000           | $1100                     |\n| M5      | $13000        | $7000           | $1300                     |\n\nThe company has a budget of $500,000 for production costs next month. The company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost. Please help the company to determine the optimal number of units to produce for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (5000 - 3000 - 500) * M1\nProfit_M2 = (7000 - 4000 - 700) * M2\nProfit_M3 = (9000 - 5000 - 900) * M3\nProfit_M4 = (11000 - 6000 - 1100) * M4\nProfit_M5 = (13000 - 7000 - 1300) * M5\nProductionUnits = M1 + M2 + M3 + M4 + M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / ProductionUnits\n## convert the division to multiplication\nmodel.addCons(obj * ProductionUnits == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $500,000 for production costs next month.\nmodel.addCons(3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Net Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of delivery vehicles. They have identified three types of vehicles (Small, Medium, and Large) that can be used for different delivery routes. The company needs to decide how many vehicles of each type to purchase and how many routes each vehicle type will cover.\n// {\"number of Small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Small vehicles\": \"RoutesPerSmallVehicle\", \"range\": \"RoutesPerSmallVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Medium vehicles\": \"RoutesPerMediumVehicle\", \"range\": \"RoutesPerMediumVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Large vehicles\": \"RoutesPerLargeVehicle\", \"range\": \"RoutesPerLargeVehicle >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Small vehicle is $20,000, a Medium vehicle is $30,000, and a Large vehicle is $40,000. The revenue generated per route covered by a Small vehicle is $500, by a Medium vehicle is $700, and by a Large vehicle is $1000. The company wants to maximize the total revenue minus the total cost of vehicles.\n// TotalCost = 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles\n// TotalRevenue = 500 * SmallVehicles * RoutesPerSmallVehicle + 700 * MediumVehicles * RoutesPerMediumVehicle + 1000 * LargeVehicles * RoutesPerLargeVehicle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing vehicles.\n// 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles <= 500000\n\n## Generate Constraint-2:\nEach vehicle type must cover at least 10 routes per day.\n// RoutesPerSmallVehicle >= 10\n// RoutesPerMediumVehicle >= 10\n// RoutesPerLargeVehicle >= 10\n\n## Generate Constraint-3:\nThe total number of routes that can be covered daily is limited to 500.\n// SmallVehicles * RoutesPerSmallVehicle + MediumVehicles * RoutesPerMediumVehicle + LargeVehicles * RoutesPerLargeVehicle <= 500\n\n## Generate Constraint-4:\nThe company must have at least 10 vehicles in total.\n// SmallVehicles + MediumVehicles + LargeVehicles >= 10\n\n## Generate Constraint-5:\nNo more than 50% of the total vehicles can be of the Small type.\n// SmallVehicles <= 0.5 * (SmallVehicles + MediumVehicles + LargeVehicles)",
        "question": "A logistics company is planning its fleet of delivery vehicles. They have identified three types of vehicles (Small, Medium, and Large) that can be used for different delivery routes. The company needs to decide how many vehicles of each type to purchase and how many routes each vehicle type will cover. The cost of a Small vehicle is $20,000, a Medium vehicle is $30,000, and a Large vehicle is $40,000. The revenue generated per route covered by a Small vehicle is $500, by a Medium vehicle is $700, and by a Large vehicle is $1000. The company has a budget of $500,000 for purchasing vehicles. Each vehicle type must cover at least 10 routes per day. The total number of routes that can be covered daily is limited to 500. The company must have at least 10 vehicles in total. No more than 50% of the total vehicles can be of the Small type. Please help the company to maximize the total revenue minus the total cost of vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)\nRoutesPerSmallVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerSmallVehicle\", lb=10)\nRoutesPerMediumVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerMediumVehicle\", lb=10)\nRoutesPerLargeVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerLargeVehicle\", lb=10)\n\n# Define objective function\nTotalCost = 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles\nTotalRevenue = 500 * SmallVehicles * RoutesPerSmallVehicle + 700 * MediumVehicles * RoutesPerMediumVehicle + 1000 * LargeVehicles * RoutesPerLargeVehicle\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\nmodel.addCons(20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles <= 500000)\nmodel.addCons(SmallVehicles * RoutesPerSmallVehicle + MediumVehicles * RoutesPerMediumVehicle + LargeVehicles * RoutesPerLargeVehicle <= 500)\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles >= 10)\nmodel.addCons(SmallVehicles <= 0.5 * (SmallVehicles + MediumVehicles + LargeVehicles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Routes per Small Vehicle: \", model.getVal(RoutesPerSmallVehicle))\n    print(\"Routes per Medium Vehicle: \", model.getVal(RoutesPerMediumVehicle))\n    print(\"Routes per Large Vehicle: \", model.getVal(RoutesPerLargeVehicle))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company aims to minimize the total daily fuel cost across all trucks.\n// FuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\n// FuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\n// FuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\n// TotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel efficiency upgrades.\n// FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the investment in fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines. The initial fuel cost per kilometer and the rate at which it decreases with investment in fuel efficiency upgrades for each truck type are given in the following Table.\n\n| Truck Type | Initial Fuel Cost per km | Rate of Decrease per $100 Investment |\n|------------|--------------------------|--------------------------------------|\n| TruckA     | $0.5                     | $0.01                                |\n| TruckB     | $0.6                     | $0.012                               |\n| TruckC     | $0.7                     | $0.014                               |\n\nThe company has a total budget of $10,000 for fuel efficiency upgrades. The company aims to minimize the total daily fuel cost across all trucks, considering that each TruckA travels 500 km, each TruckB travels 600 km, and each TruckC travels 700 km.\n\nPlease help the company determine the optimal number of each type of truck and the investment in fuel efficiency upgrades to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nFuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\nFuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\nFuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\nTotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\nmodel.addCons(FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)  # total budget for fuel efficiency upgrades\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(FuelEfficiencyC))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production efficiency of each product increases with the investment in new machinery.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The revenue generated per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total capital investment in new machinery cannot exceed $100,000.\n// MachineryInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production cost per unit decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The revenue generated per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe total production capacity of the company is limited to 10,000 units. The total marketing budget cannot exceed $50,000. The total capital investment in new machinery cannot exceed $100,000.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0)  # capital investment in new machinery\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\nProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\nProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)  # total production capacity constraint\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)  # total marketing budget constraint\nmodel.addCons(MachineryInvestment <= 100000)  # total capital investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Machinery Investment: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n// Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck allocations and technology investments.\n// Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands. The operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n\n| Route | Initial Fuel Cost per Kilometer | Decrease in Fuel Cost per $1000 Investment |\n|-------|---------------------------------|-------------------------------------------|\n| Route1 | $0.50                           | $0.05                                     |\n| Route2 | $0.40                           | $0.03                                     |\n\nThe company has a total budget of $100,000 for both truck allocations and technology investments. Please help the company determine the optimal number of trucks for each route and the investment in fuel-efficient technology to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n## Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n## Assume Distance1 and Distance2 are constants\nCost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * 1000  # Assuming Distance1 is 1000 km\nCost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * 1000  # Assuming Distance2 is 1000 km\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n## The company has a total budget of $100,000 for both truck allocations and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic components: Processor, Memory, Storage, Display, and Power Supply. The company needs to determine the optimal production quantities for each component to maximize profit while meeting market demands and resource constraints.\n// {\"quantity of Processor\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n// {\"quantity of Memory\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"quantity of Storage\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Display\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of Power Supply\": \"PS\", \"range\": \"PS >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Processor is $100, for Memory is $80, for Storage is $60, for Display is $70, and for Power Supply is $50. Due to economies of scale, the profit per unit increases by $0.10 for each component produced beyond 100 units. The company aims to maximize the total profit from the production of these components.\n// Profit_P = max(100 + 0.10 * (P - 100), 100) * P\n// Profit_M = max(80 + 0.10 * (M - 100), 80) * M\n// Profit_S = max(60 + 0.10 * (S - 100), 60) * S\n// Profit_D = max(70 + 0.10 * (D - 100), 70) * D\n// Profit_PS = max(50 + 0.10 * (PS - 100), 50) * PS\n// So, the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical material used in all components, with a total of 5000 units available. Each Processor requires 5 units, each Memory requires 4 units, each Storage requires 3 units, each Display requires 6 units, and each Power Supply requires 2 units of this material.\n// 5 * P + 4 * M + 3 * S + 6 * D + 2 * PS <= 5000\n\n## Generate Constraint-2:\nThe market demand for each component is limited. The demand for Processor is 200 units, for Memory is 300 units, for Storage is 400 units, for Display is 250 units, and for Power Supply is 150 units.\n// P <= 200; M <= 300; S <= 400; D <= 250; PS <= 150\n\n## Generate Constraint-3:\nThe company has a total production capacity of 800 units across all components.\n// P + M + S + D + PS <= 800\n\n## Generate Constraint-4:\nTo ensure product quality, the production of Processors and Displays must be balanced. The ratio of Processors to Displays should not exceed 2:1.\n// P / D <= 2",
        "question": "A manufacturer produces five types of electronic components: Processor, Memory, Storage, Display, and Power Supply. The company needs to determine the optimal production quantities for each component to maximize profit while meeting market demands and resource constraints. The profit per unit for Processor is $100, for Memory is $80, for Storage is $60, for Display is $70, and for Power Supply is $50. Due to economies of scale, the profit per unit increases by $0.10 for each component produced beyond 100 units. The company has a limited supply of a critical material used in all components, with a total of 5000 units available. Each Processor requires 5 units, each Memory requires 4 units, each Storage requires 3 units, each Display requires 6 units, and each Power Supply requires 2 units of this material. The market demand for each component is limited. The demand for Processor is 200 units, for Memory is 300 units, for Storage is 400 units, for Display is 250 units, and for Power Supply is 150 units. The company has a total production capacity of 800 units across all components. To ensure product quality, the production of Processors and Displays must be balanced. The ratio of Processors to Displays should not exceed 2:1. Please help the company to maximize the total profit from the production of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0, ub=200) # quantity of Processor\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=300) # quantity of Memory\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=400) # quantity of Storage\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=250) # quantity of Display\nPS = model.addVar(vtype=\"INTEGER\", name=\"PS\", lb=0, ub=150) # quantity of Power Supply\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_P = max(100 + 0.10 * (P - 100), 100) * P\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100)\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=100, ub=200)\nP_b1 = model.addVar(vtype=\"B\", name=\"P_b1\")\nP_b2 = model.addVar(vtype=\"B\", name=\"P_b2\")\nmodel.addCons(P_b1 + P_b2 == 1)\nmodel.addCons(P == P1*P_b1 + P2*P_b2)\nProfit_P = 100 * P1 * P_b1 + (100 + 0.10 * (P2 - 100)) * P2 * P_b2\n\n## create piecewise variables for piecewise function: Profit_M = max(80 + 0.10 * (M - 100), 80) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=100)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=100, ub=300)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nProfit_M = 80 * M1 * M_b1 + (80 + 0.10 * (M2 - 100)) * M2 * M_b2\n\n## create piecewise variables for piecewise function: Profit_S = max(60 + 0.10 * (S - 100), 60) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=400)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 60 * S1 * S_b1 + (60 + 0.10 * (S2 - 100)) * S2 * S_b2\n\n## create piecewise variables for piecewise function: Profit_D = max(70 + 0.10 * (D - 100), 70) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=250)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 70 * D1 * D_b1 + (70 + 0.10 * (D2 - 100)) * D2 * D_b2\n\n## create piecewise variables for piecewise function: Profit_PS = max(50 + 0.10 * (PS - 100), 50) * PS\nPS1 = model.addVar(vtype=\"INTEGER\", name=\"PS1\", lb=0, ub=100)\nPS2 = model.addVar(vtype=\"INTEGER\", name=\"PS2\", lb=100, ub=150)\nPS_b1 = model.addVar(vtype=\"B\", name=\"PS_b1\")\nPS_b2 = model.addVar(vtype=\"B\", name=\"PS_b2\")\nmodel.addCons(PS_b1 + PS_b2 == 1)\nmodel.addCons(PS == PS1*PS_b1 + PS2*PS_b2)\nProfit_PS = 50 * PS1 * PS_b1 + (50 + 0.10 * (PS2 - 100)) * PS2 * PS_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS\nmodel.addCons(obj == Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS)\n\n# Add constraints\nmodel.addCons(5 * P + 4 * M + 3 * S + 6 * D + 2 * PS <= 5000)\nmodel.addCons(P + M + S + D + PS <= 800)\nmodel.addCons(P / D <= 2) # Ensure the ratio of Processors to Displays does not exceed 2:1\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Processor: \", model.getVal(P))\n    print(\"Quantity of Memory: \", model.getVal(M))\n    print(\"Quantity of Storage: \", model.getVal(S))\n    print(\"Quantity of Display: \", model.getVal(D))\n    print(\"Quantity of Power Supply: \", model.getVal(PS))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1336,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\n// Total fuel cost for Small trucks: Cost_Small = 0.8 * (1000 / 10) * SmallTrucks\n// Total fuel cost for Medium trucks: Cost_Medium = 0.7 * (1000 / 8) * MediumTrucks\n// Total fuel cost for Large trucks: Cost_Large = 0.6 * (1000 / 6) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: Cost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\n// Total fuel cost for Hybrid trucks: Cost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the day.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, at least 10% of the fleet must be Hybrid trucks.\n// HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks)",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\nThe company has a total of 50 trucks available for the day. Due to maintenance schedules, at least 10% of the fleet must be Hybrid trucks.\nPlease help the company to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\n\n# Define objective function\nCost_Small = 0.8 * (1000 / 10) * SmallTrucks\nCost_Medium = 0.7 * (1000 / 8) * MediumTrucks\nCost_Large = 0.6 * (1000 / 6) * LargeTrucks\nCost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\nCost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50)\nmodel.addCons(HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone A\": \"ZoneA\", \"range\": \"ZoneA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"ZoneB\", \"range\": \"ZoneB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"ZoneC\", \"range\": \"ZoneC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"ZoneD\", \"range\": \"ZoneD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"ZoneE\", \"range\": \"ZoneE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost.\n// Total energy production: Energy = 80% * ZoneA + 75% * ZoneB + 70% * ZoneC + 65% * ZoneD + 60% * ZoneE\n// Total installation cost: Cost = $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE <= $100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs. The efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost. The city has a budget of $100,000 for the installation of solar panels. Please help the city determine the optimal number of solar panels to install in each zone to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA = model.addVar(vtype=\"INTEGER\", name=\"ZoneA\", lb=0) # number of solar panels in Zone A\nZoneB = model.addVar(vtype=\"INTEGER\", name=\"ZoneB\", lb=0) # number of solar panels in Zone B\nZoneC = model.addVar(vtype=\"INTEGER\", name=\"ZoneC\", lb=0) # number of solar panels in Zone C\nZoneD = model.addVar(vtype=\"INTEGER\", name=\"ZoneD\", lb=0) # number of solar panels in Zone D\nZoneE = model.addVar(vtype=\"INTEGER\", name=\"ZoneE\", lb=0) # number of solar panels in Zone E\n\n# Define objective function\n## Total energy production\nEnergy = 0.8 * ZoneA + 0.75 * ZoneB + 0.7 * ZoneC + 0.65 * ZoneD + 0.6 * ZoneE\n## Total installation cost\nCost = 1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Energy - Cost\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(ZoneA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(ZoneB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(ZoneC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(ZoneD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(ZoneE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 717,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter. Additionally, the company needs to decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery.\n// {\"number of units of GoodsX\": \"UnitsX\", \"range\": \"UnitsX >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsY\": \"UnitsY\", \"range\": \"UnitsY >= 0\", \"type\": \"integer\"}\n// {\"investment in transportation technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in transportation technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of transportation is exponentially related to the amount of technology investment for each type of good.\nThe initial cost per unit of GoodsX is $100, but with technology, the cost decreases by 1% for every $100 invested in technology.\nThe initial cost per unit of GoodsY is $150, and with technology, the cost decreases by 1.5% for every $100 invested in technology.\nThe company aims to minimize the total transportation cost for all goods.\n// Total cost for GoodsX: CostX = 100 * UnitsX * (1 - 0.0001 * TechX)\n// Total cost for GoodsY: CostY = 150 * UnitsY * (1 - 0.00015 * TechY)\n// So, the objective function is: Minimize (CostX + CostY)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000\n\n## Generate Constraint-2:\nThe total transportation capacity for the next quarter is limited to 2,000 units.\n// UnitsX + UnitsY <= 2,000\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must transport at least 500 units of GoodsX and 600 units of GoodsY.\n// UnitsX >= 500; UnitsY >= 600",
        "question": "A logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter and decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery. The efficiency of transportation is exponentially related to the amount of technology investment for each type of good. The initial cost per unit of GoodsX is $100, but with technology, the cost decreases by 1% for every $100 invested in technology. The initial cost per unit of GoodsY is $150, and with technology, the cost decreases by 1.5% for every $100 invested in technology. The company aims to minimize the total transportation cost for all goods. The company has a total budget of $100,000 for transportation and technology investments. The total transportation capacity for the next quarter is limited to 2,000 units. Due to contractual agreements, the company must transport at least 500 units of GoodsX and 600 units of GoodsY. Please help the company to minimize the total transportation cost for all goods.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsX = model.addVar(vtype=\"INTEGER\", name=\"UnitsX\", lb=500) # number of units of GoodsX\nUnitsY = model.addVar(vtype=\"INTEGER\", name=\"UnitsY\", lb=600) # number of units of GoodsY\nTechX = model.addVar(name=\"TechX\", lb=0) # investment in transportation technology for GoodsX\nTechY = model.addVar(name=\"TechY\", lb=0) # investment in transportation technology for GoodsY\n\n# Define objective function\nCostX = 100 * UnitsX * (1 - 0.0001 * TechX)\nCostY = 150 * UnitsY * (1 - 0.00015 * TechY)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY)\n\n# Add constraints\nmodel.addCons(100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000)\nmodel.addCons(UnitsX + UnitsY <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsX: \", model.getVal(UnitsX))\n    print(\"Number of Units of GoodsY: \", model.getVal(UnitsY))\n    print(\"Investment in Technology for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Technology for GoodsY: \", model.getVal(TechY))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. The company aims to maximize the total profit per unit of fuel consumed.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\n// So, the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per week.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trips are made by each type of truck per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E. The profit per trip and fuel consumption for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Consumption |\n|------------|-----------------|------------------|\n| A          | $500            | 10 liters        |\n| B          | $700            | 15 liters        |\n| C          | $900            | 20 liters        |\n| D          | $1100           | 25 liters        |\n| E          | $1300           | 30 liters        |\n\nThe company has a budget of $10,000 for fuel costs per week. The company wants to ensure that at least 5 trips are made by each type of truck per week. Please help the company to maximize the total profit per unit of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trips are made by each type of truck per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\nFuelConsumption = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n## the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate for each truck in that region.\n// {\"number of trucks for North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for North region\": \"FuelRateNorth\", \"range\": \"FuelRateNorth >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for South region\": \"FuelRateSouth\", \"range\": \"FuelRateSouth >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for East region\": \"FuelRateEast\", \"range\": \"FuelRateEast >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for West region\": \"FuelRateWest\", \"range\": \"FuelRateWest >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Central region\": \"FuelRateCentral\", \"range\": \"FuelRateCentral >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate in each region. The fuel cost per gallon is $3.50, and the total fuel consumption is the product of the number of trucks and the fuel consumption rate in each region.\n// TotalFuelCostNorth = 3.50 * TrucksNorth * FuelRateNorth\n// TotalFuelCostSouth = 3.50 * TrucksSouth * FuelRateSouth\n// TotalFuelCostEast = 3.50 * TrucksEast * FuelRateEast\n// TotalFuelCostWest = 3.50 * TrucksWest * FuelRateWest\n// TotalFuelCostCentral = 3.50 * TrucksCentral * FuelRateCentral\n// So, the objective function is: Minimize TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation across all regions.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate for each truck in that region. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate in each region. The fuel cost per gallon is $3.50, and the total fuel consumption is the product of the number of trucks and the fuel consumption rate in each region. The company has a total of 100 trucks available for allocation across all regions. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0)\nFuelRateNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateNorth\", lb=0)\nFuelRateSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateSouth\", lb=0)\nFuelRateEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateEast\", lb=0)\nFuelRateWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateWest\", lb=0)\nFuelRateCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateCentral\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelCostNorth = 3.50 * TrucksNorth * FuelRateNorth\nTotalFuelCostSouth = 3.50 * TrucksSouth * FuelRateSouth\nTotalFuelCostEast = 3.50 * TrucksEast * FuelRateEast\nTotalFuelCostWest = 3.50 * TrucksWest * FuelRateWest\nTotalFuelCostCentral = 3.50 * TrucksCentral * FuelRateCentral\n## the objective function is: Minimize TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral\nmodel.addCons(obj == TotalFuelCostNorth + TotalFuelCostSouth + TotalFuelCostEast + TotalFuelCostWest + TotalFuelCostCentral)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation across all regions.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks for South Region: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks for East Region: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks for West Region: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks for Central Region: \", model.getVal(TrucksCentral))\n    print(\"Fuel Consumption Rate for North Region: \", model.getVal(FuelRateNorth))\n    print(\"Fuel Consumption Rate for South Region: \", model.getVal(FuelRateSouth))\n    print(\"Fuel Consumption Rate for East Region: \", model.getVal(FuelRateEast))\n    print(\"Fuel Consumption Rate for West Region: \", model.getVal(FuelRateWest))\n    print(\"Fuel Consumption Rate for Central Region: \", model.getVal(FuelRateCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"acres of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"acres of C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $100, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $150, requiring 3 units of water per acre. \nFor C3, the profit per acre is $200, requiring 4 units of water per acre.\nFor C4, the profit per acre is $250, requiring 5 units of water per acre.\nFor C5, the profit per acre is $300, requiring 6 units of water per acre.\nThe farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n// Profit_C1 = 100 * C1\n// Profit_C2 = 150 * C2\n// Profit_C3 = 200 * C3\n// Profit_C4 = 250 * C4\n// Profit_C5 = 300 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 + C4 + C5 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500 units.\n// 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to C1 due to contractual obligations.\n// C1 >= 10",
        "question": "A farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| C1   | $100            | 2 units                 |\n| C2   | $150            | 3 units                 |\n| C3   | $200            | 4 units                 |\n| C4   | $250            | 5 units                 |\n| C5   | $300            | 6 units                 |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a limited water supply of 500 units. The farm must allocate at least 10 acres to C1 due to contractual obligations. \nPlease help the farm to maximize the profit per unit of water used to ensure sustainable water management.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to C1 due to contractual obligations.\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=10) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # acres of C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # acres of C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * C1\nProfit_C2 = 150 * C2\nProfit_C3 = 200 * C3\nProfit_C4 = 250 * C4\nProfit_C5 = 300 * C5\nWaterUsage = 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n## The farm has a limited water supply of 500 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Acres of C4: \", model.getVal(C4))\n    print(\"Acres of C5: \", model.getVal(C5))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company aims to maximize the total profit from the production of these three products.\n// Profit_A = A * (50 - 20)\n// Profit_B = B * (70 - 30)\n// Profit_C = C * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 20 * A + 30 * B + 25 * C <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe production of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 2.5 hours. The total labor hours available per day are 1200 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company has a total budget of $10,000 for production costs. The total production capacity of the company is limited to 500 units per day. The production of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 2.5 hours. The total labor hours available per day are 1200 hours. Please help the company to maximize the total profit from the production of these three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = A * (50 - 20)\nProfit_B = B * (70 - 30)\nProfit_C = C * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C <= 10000) # Total budget constraint\nmodel.addCons(A + B + C <= 500) # Total production capacity constraint\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1200) # Total labor hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the level of maintenance investment for each type of truck to optimize their lifespan and operational efficiency.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Refrigerated trucks\": \"RefrigeratedMaintenance\", \"range\": \"RefrigeratedMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Heavy trucks\": \"HeavyMaintenance\", \"range\": \"HeavyMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Standard trucks\": \"StandardMaintenance\", \"range\": \"StandardMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each type of truck is affected by the maintenance investment. For every $1,000 invested in maintenance, the operational efficiency (measured in revenue per truck per year) increases by 5% for Refrigerated trucks, 4% for Heavy trucks, and 3% for Standard trucks. The base revenue per Refrigerated truck is $100,000, for Heavy trucks is $120,000, and for Standard trucks is $80,000. The company aims to maximize the total annual revenue from all trucks.\n// Total annual revenue for Refrigerated trucks: RevenueRefrigerated = (100000 * (1 + 0.05 * RefrigeratedMaintenance / 1000)) * RefrigeratedTrucks\n// Total annual revenue for Heavy trucks: RevenueHeavy = (120000 * (1 + 0.04 * HeavyMaintenance / 1000)) * HeavyTrucks\n// Total annual revenue for Standard trucks: RevenueStandard = (80000 * (1 + 0.03 * StandardMaintenance / 1000)) * StandardTrucks\n// So, the objective function is: Maximize (RevenueRefrigerated + RevenueHeavy + RevenueStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing trucks and maintenance investments.\n// 100000 * RefrigeratedTrucks + 120000 * HeavyTrucks + 80000 * StandardTrucks + RefrigeratedMaintenance + HeavyMaintenance + StandardMaintenance <= 5000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50\n\n## Generate Constraint-3:\nAt least 10 Refrigerated trucks and 15 Heavy trucks must be purchased due to contractual obligations.\n// RefrigeratedTrucks >= 10; HeavyTrucks >= 15",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the level of maintenance investment for each type of truck to optimize their lifespan and operational efficiency. The operational efficiency of each type of truck is affected by the maintenance investment. For every $1,000 invested in maintenance, the operational efficiency (measured in revenue per truck per year) increases by 5% for Refrigerated trucks, 4% for Heavy trucks, and 3% for Standard trucks. The base revenue per Refrigerated truck is $100,000, for Heavy trucks is $120,000, and for Standard trucks is $80,000. The company aims to maximize the total annual revenue from all trucks.\n\n| Type of Truck | Base Revenue per Truck | Maintenance Efficiency Increase per $1000 |\n|---------------|------------------------|------------------------------------------|\n| Refrigerated   | $100,000               | 5%                                       |\n| Heavy         | $120,000               | 4%                                       |\n| Standard      | $80,000                | 3%                                       |\n\nThe company has a budget of $5,000,000 for purchasing trucks and maintenance investments. The total number of trucks cannot exceed 50. At least 10 Refrigerated trucks and 15 Heavy trucks must be purchased due to contractual obligations.\n\nPlease help the company to maximize the total annual revenue from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=10)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=15)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"RefrigeratedMaintenance\", lb=0)\nHeavyMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyMaintenance\", lb=0)\nStandardMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"StandardMaintenance\", lb=0)\n\n# Define objective function\nRevenueRefrigerated = (100000 * (1 + 0.05 * RefrigeratedMaintenance / 1000)) * RefrigeratedTrucks\nRevenueHeavy = (120000 * (1 + 0.04 * HeavyMaintenance / 1000)) * HeavyTrucks\nRevenueStandard = (80000 * (1 + 0.03 * StandardMaintenance / 1000)) * StandardTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueRefrigerated + RevenueHeavy + RevenueStandard)\n\n# Add constraints\nmodel.addCons(100000 * RefrigeratedTrucks + 120000 * HeavyTrucks + 80000 * StandardTrucks + RefrigeratedMaintenance + HeavyMaintenance + StandardMaintenance <= 5000000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Investment for Refrigerated Trucks: \", model.getVal(RefrigeratedMaintenance))\n    print(\"Maintenance Investment for Heavy Trucks: \", model.getVal(HeavyMaintenance))\n    print(\"Maintenance Investment for Standard Trucks: \", model.getVal(StandardMaintenance))\n    print(\"Total Annual Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1592,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the investment in a new fuel-efficient technology that can be applied to each type of truck to reduce fuel consumption and maintenance costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small trucks\": \"TechSmall\", \"range\": \"TechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"TechMedium\", \"range\": \"TechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large trucks\": \"TechLarge\", \"range\": \"TechLarge >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Extra-Large trucks\": \"TechExtraLarge\", \"range\": \"TechExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves by 1% for every $1,000 invested in the fuel-efficient technology. The company aims to minimize the total annual operating cost, which includes fuel and maintenance costs. The initial fuel cost per mile for Small trucks is $0.50, for Medium trucks is $0.60, for Large trucks is $0.70, and for Extra-Large trucks is $0.80. The initial maintenance cost per year for each type of truck is $5,000, $6,000, $7,000, and $8,000 respectively.\n// Total fuel cost for Small trucks: FuelSmall = 0.50 * (1 - 0.001 * TechSmall) * SmallTrucks\n// Total fuel cost for Medium trucks: FuelMedium = 0.60 * (1 - 0.001 * TechMedium) * MediumTrucks\n// Total fuel cost for Large trucks: FuelLarge = 0.70 * (1 - 0.001 * TechLarge) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: FuelExtraLarge = 0.80 * (1 - 0.001 * TechExtraLarge) * ExtraLargeTrucks\n// Total maintenance cost for Small trucks: MaintSmall = 5000 * (1 - 0.01 * TechSmall) * SmallTrucks\n// Total maintenance cost for Medium trucks: MaintMedium = 6000 * (1 - 0.01 * TechMedium) * MediumTrucks\n// Total maintenance cost for Large trucks: MaintLarge = 7000 * (1 - 0.01 * TechLarge) * LargeTrucks\n// Total maintenance cost for Extra-Large trucks: MaintExtraLarge = 8000 * (1 - 0.01 * TechExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Minimize (FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + MaintSmall + MaintMedium + MaintLarge + MaintExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks and investing in fuel-efficient technology.\n// SmallTrucks * 50000 + MediumTrucks * 60000 + LargeTrucks * 70000 + ExtraLargeTrucks * 80000 + TechSmall + TechMedium + TechLarge + TechExtraLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the investment in a new fuel-efficient technology that can be applied to each type of truck to reduce fuel consumption and maintenance costs. The fuel efficiency of each truck type improves by 1% for every $1,000 invested in the fuel-efficient technology. The company aims to minimize the total annual operating cost, which includes fuel and maintenance costs. The initial fuel cost per mile and maintenance cost per year for each type of truck are given in the following Table.\n\n| Truck Type       | Initial Fuel Cost per Mile | Initial Maintenance Cost per Year |\n|------------------|---------------------------|----------------------------------|\n| Small            | $0.50                     | $5,000                           |\n| Medium           | $0.60                     | $6,000                           |\n| Large            | $0.70                     | $7,000                           |\n| Extra-Large      | $0.80                     | $8,000                           |\n\nThe company has a budget of $1,000,000 for purchasing new trucks and investing in fuel-efficient technology. The total number of trucks cannot exceed 100. Please help the company to determine the optimal number of each type of truck and the investment in fuel-efficient technology to minimize the total annual operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechSmall\", lb=0)\nTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechMedium\", lb=0)\nTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechLarge\", lb=0)\nTechExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechExtraLarge\", lb=0)\n\n# Define objective function\nFuelSmall = 0.50 * (1 - 0.001 * TechSmall) * SmallTrucks\nFuelMedium = 0.60 * (1 - 0.001 * TechMedium) * MediumTrucks\nFuelLarge = 0.70 * (1 - 0.001 * TechLarge) * LargeTrucks\nFuelExtraLarge = 0.80 * (1 - 0.001 * TechExtraLarge) * ExtraLargeTrucks\nMaintSmall = 5000 * (1 - 0.01 * TechSmall) * SmallTrucks\nMaintMedium = 6000 * (1 - 0.01 * TechMedium) * MediumTrucks\nMaintLarge = 7000 * (1 - 0.01 * TechLarge) * LargeTrucks\nMaintExtraLarge = 8000 * (1 - 0.01 * TechExtraLarge) * ExtraLargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + MaintSmall + MaintMedium + MaintLarge + MaintExtraLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks * 50000 + MediumTrucks * 60000 + LargeTrucks * 70000 + ExtraLargeTrucks * 80000 + TechSmall + TechMedium + TechLarge + TechExtraLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Tech for Small Trucks: \", model.getVal(TechSmall))\n    print(\"Investment in Tech for Medium Trucks: \", model.getVal(TechMedium))\n    print(\"Investment in Tech for Large Trucks: \", model.getVal(TechLarge))\n    print(\"Investment in Tech for Extra-Large Trucks: \", model.getVal(TechExtraLarge))\n    print(\"Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1621,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"available units of resource X\": \"ResourceX\", \"range\": \"ResourceX >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Y\": \"ResourceY\", \"range\": \"ResourceY >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Z\": \"ResourceZ\", \"range\": \"ResourceZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nEach unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively.\n// 2 * ProductA <= ResourceX\n// 3 * ProductB <= ResourceY\n// 4 * ProductC <= ResourceZ\n// ResourceX <= 100\n// ResourceY <= 150\n// ResourceZ <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units.\n// ProductA >= 10\n// ProductB >= 20\n// ProductC >= 15",
        "question": "A manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the resource requirements per unit of each product and the available resources.\n\n| Product | Profit per Unit | Resource X Required | Resource Y Required | Resource Z Required |\n|---------|-----------------|---------------------|---------------------|---------------------|\n| A       | $50             | 2 units             | 0 units             | 0 units             |\n| B       | $70             | 0 units             | 3 units             | 0 units             |\n| C       | $60             | 0 units             | 0 units             | 4 units             |\n\nThe total available units of resource X, Y, and Z are 100, 150, and 200, respectively. The market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units. \n\nPlease help the manufacturer to maximize the total profit from selling all products while adhering to the constraints on resource availability and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=15) # quantity of product C\nResourceX = model.addVar(vtype=\"INTEGER\", name=\"ResourceX\", lb=0, ub=100) # available units of resource X\nResourceY = model.addVar(vtype=\"INTEGER\", name=\"ResourceY\", lb=0, ub=150) # available units of resource Y\nResourceZ = model.addVar(vtype=\"INTEGER\", name=\"ResourceZ\", lb=0, ub=200) # available units of resource Z\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * ProductA <= ResourceX)\nmodel.addCons(3 * ProductB <= ResourceY)\nmodel.addCons(4 * ProductC <= ResourceZ)\nmodel.addCons(ResourceX <= 100)\nmodel.addCons(ResourceY <= 150)\nmodel.addCons(ResourceZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1345,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.\n// Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n// Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n// Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n// Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n// Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for annual maintenance costs.\n// 5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1,000,000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be operated.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-4:\nDue to environmental regulations, the number of T1 trucks cannot exceed 10.\n// T1 <= 10\n\n## Generate Constraint-5:\nThe company must ensure at least 5 trucks of each type are operational to maintain service levels.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe total cargo capacity required is 500 tons. The company has a budget of $1,000,000 for annual maintenance costs. The company has a limit of 100 trucks that can be operated. Due to environmental regulations, the number of T1 trucks cannot exceed 10. The company must ensure at least 5 trucks of each type are operational to maintain service levels.\nPlease help the company to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=10) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the operational cost per kilometer\nCost_T1 = 2 * Distance * T1 + 5000 * T1\nCost_T2 = 1.5 * Distance * T2 + 6000 * T2\nCost_T3 = 1.2 * Distance * T3 + 7000 * T3\nCost_T4 = 1 * Distance * T4 + 8000 * T4\nCost_T5 = 0.8 * Distance * T5 + 9000 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500)\n## The company has a budget of $1,000,000 for annual maintenance costs.\nmodel.addCons(5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1000000)\n## The company has a limit of 100 trucks that can be operated.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Due to environmental regulations, the number of T1 trucks cannot exceed 10.\nmodel.addCons(T1 <= 10)\n## The company must ensure at least 5 trucks of each type are operational to maintain service levels.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 5)\nmodel.addCons(T3 >= 5)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1537,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good to optimize delivery efficiency. Additionally, the company is considering investing in a new fleet management system that can reduce the operational costs per truck, depending on the level of investment.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system for GoodsX\": \"FleetX\", \"range\": \"FleetX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsY\": \"FleetY\", \"range\": \"FleetY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsZ\": \"FleetZ\", \"range\": \"FleetZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for GoodsX: CostX = (1000 - 0.1 * FleetX) * TrucksX\n// Total operational cost for GoodsY: CostY = (1200 - 0.12 * FleetY) * TrucksY\n// Total operational cost for GoodsZ: CostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and fleet management system investments.\n// (1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the level of investment in a fleet management system to optimize delivery efficiency. The operational cost per truck decreases with the investment in the fleet management system. The initial cost per truck and the reduction in cost per $100 invested for each type of good are given in the following Table.\n\n| Type of Good | Initial Cost per Truck | Reduction in Cost per $100 Invested |\n|--------------|------------------------|-------------------------------------|\n| GoodsX       | $1000                  | $10                                 |\n| GoodsY       | $1200                  | $12                                 |\n| GoodsZ       | $1500                  | $15                                 |\n\nThe company has a total budget of $100,000 for truck operations and fleet management system investments. Please help the company to minimize the total operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFleetX = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetX\", lb=0)  # investment in fleet management system for GoodsX\nFleetY = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetY\", lb=0)  # investment in fleet management system for GoodsY\nFleetZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetZ\", lb=0)  # investment in fleet management system for GoodsZ\n\n# Define objective function\nCostX = (1000 - 0.1 * FleetX) * TrucksX\nCostY = (1200 - 0.12 * FleetY) * TrucksY\nCostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons((1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Investment in FleetX: \", model.getVal(FleetX))\n    print(\"Investment in FleetY: \", model.getVal(FleetY))\n    print(\"Investment in FleetZ: \", model.getVal(FleetZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel.\n// {\"number of solar panels for Type A\": \"PanelsA\", \"range\": \"PanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type B\": \"PanelsB\", \"range\": \"PanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type C\": \"PanelsC\", \"range\": \"PanelsC >= 0\", \"type\": \"integer\"}\n// {\"efficiency level of solar panels for Type A\": \"EfficiencyA\", \"range\": \"0 < EfficiencyA < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type B\": \"EfficiencyB\", \"range\": \"0 < EfficiencyB < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type C\": \"EfficiencyC\", \"range\": \"0 < EfficiencyC < 1\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings.\n// Cost = 1000 * (PanelsA + PanelsB + PanelsC)\n// Energy_A = 100 * PanelsA * EfficiencyA\n// Energy_B = 150 * PanelsB * EfficiencyB\n// Energy_C = 200 * PanelsC * EfficiencyC\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated must meet or exceed the total energy consumption of all buildings.\n// Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC)",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel. The cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings. Please help the city to determine the optimal number of solar panels and their efficiency levels to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelsA = model.addVar(vtype=\"INTEGER\", name=\"PanelsA\", lb=0) # number of solar panels for Type A\nPanelsB = model.addVar(vtype=\"INTEGER\", name=\"PanelsB\", lb=0) # number of solar panels for Type B\nPanelsC = model.addVar(vtype=\"INTEGER\", name=\"PanelsC\", lb=0) # number of solar panels for Type C\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0, ub=1) # efficiency level of solar panels for Type A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0, ub=1) # efficiency level of solar panels for Type B\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0, ub=1) # efficiency level of solar panels for Type C\n\n# Define objective function\nCost = 1000 * (PanelsA + PanelsB + PanelsC)\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n## The total energy generated must meet or exceed the total energy consumption of all buildings.\nEnergy_A = 100 * PanelsA * EfficiencyA\nEnergy_B = 150 * PanelsB * EfficiencyB\nEnergy_C = 200 * PanelsC * EfficiencyC\nmodel.addCons(Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Type A: \", model.getVal(PanelsA))\n    print(\"Number of Solar Panels for Type B: \", model.getVal(PanelsB))\n    print(\"Number of Solar Panels for Type C: \", model.getVal(PanelsC))\n    print(\"Efficiency Level for Type A: \", model.getVal(EfficiencyA))\n    print(\"Efficiency Level for Type B: \", model.getVal(EfficiencyB))\n    print(\"Efficiency Level for Type C: \", model.getVal(EfficiencyC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its delivery routes for multiple destinations. The company needs to determine the number of trucks to allocate for each route and the speed at which each truck should travel to minimize fuel consumption. The fuel efficiency of a truck is affected by its speed, following a nonlinear relationship.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of a truck is modeled by a quadratic function of its speed, where lower speeds result in less fuel consumption but too low speeds increase consumption due to engine inefficiency. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Fuel1 = Trucks1 * (0.005 * Speed1^2 + 0.1 * Speed1 + 10)\n// Fuel consumption for Route2: Fuel2 = Trucks2 * (0.005 * Speed2^2 + 0.1 * Speed2 + 10)\n// So, the objective function is: Minimize (Fuel1 + Fuel2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel and operational costs. The cost of fuel per kilometer for each truck is $0.5, and the total distance covered by all trucks must not exceed the budget.\n// 0.5 * (Trucks1 * Speed1 + Trucks2 * Speed2) <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-3:\nDue to traffic regulations, the speed of trucks on Route1 must not exceed 50 km/h, and on Route2, it must not exceed 60 km/h.\n// Speed1 <= 50; Speed2 <= 60",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its delivery routes for multiple destinations. The company needs to determine the number of trucks to allocate for each route and the speed at which each truck should travel to minimize fuel consumption. The fuel efficiency of a truck is affected by its speed, following a nonlinear relationship. The fuel consumption of a truck is modeled by a quadratic function of its speed, where lower speeds result in less fuel consumption but too low speeds increase consumption due to engine inefficiency. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total budget of $10,000 for fuel and operational costs. The cost of fuel per kilometer for each truck is $0.5, and the total distance covered by all trucks must not exceed the budget. The total number of trucks available for allocation is limited to 50. Due to traffic regulations, the speed of trucks on Route1 must not exceed 50 km/h, and on Route2, it must not exceed 60 km/h.\n\nPlease help the company to determine the optimal number of trucks and their speeds for each route to minimize the total fuel consumption.\n\n| Variable       | Description                     | Range/Constraints                  |\n|----------------|---------------------------------|------------------------------------|\n| Trucks1        | Number of trucks for Route1     | Trucks1 >= 0, integer             |\n| Trucks2        | Number of trucks for Route2     | Trucks2 >= 0, integer             |\n| Speed1         | Speed of trucks for Route1      | 0 < Speed1 <= 50, continuous      |\n| Speed2         | Speed of trucks for Route2      | 0 < Speed2 <= 60, continuous      |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\n\n# Define objective function\nFuel1 = Trucks1 * (0.005 * Speed1**2 + 0.1 * Speed1 + 10)\nFuel2 = Trucks2 * (0.005 * Speed2**2 + 0.1 * Speed2 + 10)\n# So, the objective function is: Minimize (Fuel1 + Fuel2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel and operational costs.\nmodel.addCons(0.5 * (Trucks1 * Speed1 + Trucks2 * Speed2) <= 10000)\n# The total number of trucks available for allocation is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n# Due to traffic regulations, the speed of trucks on Route1 must not exceed 50 km/h, and on Route2, it must not exceed 60 km/h.\nmodel.addCons(Speed1 <= 50)\nmodel.addCons(Speed2 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1714,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin.\n// {\"number of C1 cargo\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of C2 cargo\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of C3 cargo\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of C4 cargo\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of C5 cargo\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per unit is $100, the space required per unit is 5 cubic meters, and the handling cost per unit is $20.\nFor C2, the profit per unit is $150, the space required per unit is 7 cubic meters, and the handling cost per unit is $30.\nFor C3, the profit per unit is $200, the space required per unit is 10 cubic meters, and the handling cost per unit is $40.\nFor C4, the profit per unit is $250, the space required per unit is 12 cubic meters, and the handling cost per unit is $50.\nFor C5, the profit per unit is $300, the space required per unit is 15 cubic meters, and the handling cost per unit is $60.\nThe company wants to maximize the profit per cubic meter of space used.\n// Profit_C1 = 100 * C1 - 20 * C1\n// Profit_C2 = 150 * C2 - 30 * C2\n// Profit_C3 = 200 * C3 - 40 * C3\n// Profit_C4 = 250 * C4 - 50 * C4\n// Profit_C5 = 300 * C5 - 60 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5)\n\n## Generate Constraint-1:\nThe company has a total storage space of 1000 cubic meters.\n// 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10000 for handling costs.\n// 20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000\n\n## Generate Constraint-3:\nThe company can handle a maximum of 200 units of cargo in total.\n// C1 + C2 + C3 + C4 + C5 <= 200",
        "question": "A logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin.\nFor C1, the profit per unit is $100, the space required per unit is 5 cubic meters, and the handling cost per unit is $20.\nFor C2, the profit per unit is $150, the space required per unit is 7 cubic meters, and the handling cost per unit is $30.\nFor C3, the profit per unit is $200, the space required per unit is 10 cubic meters, and the handling cost per unit is $40.\nFor C4, the profit per unit is $250, the space required per unit is 12 cubic meters, and the handling cost per unit is $50.\nFor C5, the profit per unit is $300, the space required per unit is 15 cubic meters, and the handling cost per unit is $60.\nThe company has a total storage space of 1000 cubic meters and a budget of $10000 for handling costs. The company can handle a maximum of 200 units of cargo in total.\nPlease help the company to maximize the profit per cubic meter of space used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of C1 cargo\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of C2 cargo\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of C3 cargo\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of C4 cargo\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # number of C5 cargo\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (100 - 20) * C1\nProfit_C2 = (150 - 30) * C2\nProfit_C3 = (200 - 40) * C3\nProfit_C4 = (250 - 50) * C4\nProfit_C5 = (300 - 60) * C5\nSpaceUsed = 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / SpaceUsed\n## convert the division to multiplication\nmodel.addCons(obj * SpaceUsed == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total storage space of 1000 cubic meters.\nmodel.addCons(5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000)\n## The company has a budget of $10000 for handling costs.\nmodel.addCons(20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000)\n## The company can handle a maximum of 200 units of cargo in total.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of C1 Cargo: \", model.getVal(C1))\n    print(\"Number of C2 Cargo: \", model.getVal(C2))\n    print(\"Number of C3 Cargo: \", model.getVal(C3))\n    print(\"Number of C4 Cargo: \", model.getVal(C4))\n    print(\"Number of C5 Cargo: \", model.getVal(C5))\n    print(\"Maximized Profit per Cubic Meter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost.\n// Total cargo capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n// Total maintenance cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck maintenance next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100,000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. The cargo capacity and monthly maintenance cost for each type of truck are given in the following Table.\n\n| Truck Type | Cargo Capacity (tons) | Monthly Maintenance Cost ($) |\n|------------|-----------------------|------------------------------|\n| TruckA     | 10                    | 500                          |\n| TruckB     | 15                    | 700                          |\n| TruckC     | 20                    | 900                          |\n| TruckD     | 25                    | 1100                         |\n| TruckE     | 30                    | 1300                         |\n\nThe company has a budget of $100,000 for truck maintenance next month. Please help the company to maximize the total cargo capacity while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## Total cargo capacity and total maintenance cost\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Capacity - Cost)\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for truck maintenance next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Cargo Capacity - Maintenance Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand.\n// {\"number of trucks for product P1\": \"TruckP1\", \"range\": \"TruckP1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P2\": \"TruckP2\", \"range\": \"TruckP2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P3\": \"TruckP3\", \"range\": \"TruckP3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P4\": \"TruckP4\", \"range\": \"TruckP4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P5\": \"TruckP5\", \"range\": \"TruckP5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each product varies with the number of trucks used and the distance traveled. The cost function is nonlinear due to economies of scale in truck usage.\nFor product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck.\nFor product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck.\nFor product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck.\nFor product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck.\nFor product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck.\nThe company aims to minimize the total transportation cost.\n// Total cost for P1: Cost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\n// Total cost for P2: Cost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\n// Total cost for P3: Cost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\n// Total cost for P4: Cost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\n// Total cost for P5: Cost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n// So, the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50\n\n## Generate Constraint-2:\nThe demand for each product requires at least a certain number of trucks. Specifically, P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks.\n// TruckP1 >= 5; TruckP2 >= 6; TruckP3 >= 7; TruckP4 >= 8; TruckP5 >= 9\n\n## Generate Constraint-3:\nDue to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1.\n// TruckP3 >= 2 * TruckP1",
        "question": "A logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand.\nThe cost of transporting each product varies with the number of trucks used and the distance traveled. For product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck. For product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck. For product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck. For product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck. For product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck.\nThe company has a total of 50 trucks available for distribution. The demand for each product requires at least a certain number of trucks: P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks. Due to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1.\nPlease help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckP1 = model.addVar(vtype=\"INTEGER\", name=\"TruckP1\", lb=5)  # number of trucks for product P1\nTruckP2 = model.addVar(vtype=\"INTEGER\", name=\"TruckP2\", lb=6)  # number of trucks for product P2\nTruckP3 = model.addVar(vtype=\"INTEGER\", name=\"TruckP3\", lb=7)  # number of trucks for product P3\nTruckP4 = model.addVar(vtype=\"INTEGER\", name=\"TruckP4\", lb=8)  # number of trucks for product P4\nTruckP5 = model.addVar(vtype=\"INTEGER\", name=\"TruckP5\", lb=9)  # number of trucks for product P5\n\n# Define objective function\n# For each product, the cost per truck increases with the number of trucks used\nCost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\nCost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\nCost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\nCost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\nCost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n# Add constraints\n# Total trucks available\nmodel.addCons(TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50)\n# Demand constraints\nmodel.addCons(TruckP1 >= 5)\nmodel.addCons(TruckP2 >= 6)\nmodel.addCons(TruckP3 >= 7)\nmodel.addCons(TruckP4 >= 8)\nmodel.addCons(TruckP5 >= 9)\n# Strategic partnership constraint\nmodel.addCons(TruckP3 >= 2 * TruckP1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for P1: \", model.getVal(TruckP1))\n    print(\"Number of Trucks for P2: \", model.getVal(TruckP2))\n    print(\"Number of Trucks for P3: \", model.getVal(TruckP3))\n    print(\"Number of Trucks for P4: \", model.getVal(TruckP4))\n    print(\"Number of Trucks for P5: \", model.getVal(TruckP5))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1336,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant. Additionally, the company needs to decide on the level of investment in research and development (R&D) for each type of power plant to improve efficiency and reduce operational costs.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for Solar\": \"SolarRnD\", \"range\": \"SolarRnD >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for Wind\": \"WindRnD\", \"range\": \"WindRnD >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for Hydro\": \"HydroRnD\", \"range\": \"HydroRnD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each power plant unit decreases with increased investment in R&D. For Solar, the operational cost per unit is $100,000, but it decreases by $1,000 for every $10,000 invested in R&D. For Wind, the operational cost per unit is $120,000, and it decreases by $1,200 for every $10,000 invested in R&D. For Hydro, the operational cost per unit is $80,000, and it decreases by $800 for every $10,000 invested in R&D. The company aims to minimize the total operational cost of all power plants.\n// Operational cost for Solar: CostSolar = (100000 - 0.1 * SolarRnD) * SolarUnits\n// Operational cost for Wind: CostWind = (120000 - 0.12 * WindRnD) * WindUnits\n// Operational cost for Hydro: CostHydro = (80000 - 0.08 * HydroRnD) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power plant units and R&D investments.\n// 100000 * SolarUnits + SolarRnD + 120000 * WindUnits + WindRnD + 80000 * HydroUnits + HydroRnD <= 1000000\n\n## Generate Constraint-2:\nThe total number of power plant units that can be installed is limited to 10.\n// SolarUnits + WindUnits + HydroUnits <= 10\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must install at least 2 Solar power units and 3 Wind power units.\n// SolarUnits >= 2; WindUnits >= 3",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in research and development (R&D) for each type to improve efficiency and reduce operational costs. The operational cost per unit and the impact of R&D investment on operational cost for each type of power plant are given in the following Table.\n\n| Power Plant Type | Operational Cost per Unit | Reduction in Cost per $10,000 R&D Investment |\n|------------------|---------------------------|----------------------------------------------|\n| Solar            | $100,000                  | $1,000                                       |\n| Wind             | $120,000                  | $1,200                                       |\n| Hydro            | $80,000                   | $800                                         |\n\nThe company has a total budget of $1,000,000 for both the installation of power plant units and R&D investments. The total number of power plant units that can be installed is limited to 10. Due to regulatory requirements, the company must install at least 2 Solar power units and 3 Wind power units.\n\nPlease help the company to minimize the total operational cost of all power plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nSolarRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarRnD\", lb=0)\nWindRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"WindRnD\", lb=0)\nHydroRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroRnD\", lb=0)\n\n# Set additional constraints for minimum units\nmodel.addCons(SolarUnits >= 2)\nmodel.addCons(WindUnits >= 3)\n\n# Define objective function\nCostSolar = (100000 - 0.1 * SolarRnD) * SolarUnits\nCostWind = (120000 - 0.12 * WindRnD) * WindUnits\nCostHydro = (80000 - 0.08 * HydroRnD) * HydroUnits\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\nmodel.addCons(100000 * SolarUnits + SolarRnD + 120000 * WindUnits + WindRnD + 80000 * HydroUnits + HydroRnD <= 1000000)\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in R&D for Solar: \", model.getVal(SolarRnD))\n    print(\"Investment in R&D for Wind: \", model.getVal(WindRnD))\n    print(\"Investment in R&D for Hydro: \", model.getVal(HydroRnD))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for daily operational costs.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50\n\n## Generate Constraint-3:\nThe company has a daily delivery capacity of 1000 miles.\n// 10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon. The cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon. The cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The company has a total budget of $5000 for daily operational costs. The company has a total of 50 drivers available. The company has a daily delivery capacity of 1000 miles. Please help the company to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")  # Assuming fuel price is a variable\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000)\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\nmodel.addCons(10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Fuel Price: \", model.getVal(FuelPrice))\n    print(\"Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"FuelEff_A\", \"range\": \"FuelEff_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"FuelEff_B\", \"range\": \"FuelEff_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"FuelEff_C\", \"range\": \"FuelEff_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// FuelConsumption_A = Trucks_A / FuelEff_A\n// FuelConsumption_B = Trucks_B / FuelEff_B\n// FuelConsumption_C = Trucks_C / FuelEff_C\n// Profit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\n// Profit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\n// Profit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 1000 units.\n// FuelConsumption_A + FuelConsumption_B + FuelConsumption_C <= 1000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n\n| Route | Number of Trucks | Fuel Efficiency |\n|-------|------------------|-----------------|\n| A     | Trucks_A         | FuelEff_A       |\n| B     | Trucks_B         | FuelEff_B       |\n| C     | Trucks_C         | FuelEff_C       |\n\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency. The company has a total of 50 trucks available. The total fuel consumption across all routes must not exceed 1000 units.\n\nPlease help the company to minimize the total fuel consumption (defined as the sum of the fuel consumption for each route) and maximize the total profit (defined as the sum of the profit from each route).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nFuelEff_A = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_A\", lb=0) # fuel efficiency of trucks for Route A\nFuelEff_B = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_B\", lb=0) # fuel efficiency of trucks for Route B\nFuelEff_C = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_C\", lb=0) # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_fuel = model.addVar('obj_fuel')\nobj_profit = model.addVar('obj_profit')\nmodel.setObjective(obj_fuel, \"minimize\")\nmodel.setObjective(obj_profit, \"maximize\")\n\n## convert the division to multiplication\nFuelConsumption_A = Trucks_A * FuelEff_A\nFuelConsumption_B = Trucks_B * FuelEff_B\nFuelConsumption_C = Trucks_C * FuelEff_C\nProfit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\nProfit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\nProfit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_fuel == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\nmodel.addCons(obj_profit == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n## The total fuel consumption across all routes must not exceed 1000 units.\nmodel.addCons(FuelConsumption_A + FuelConsumption_B + FuelConsumption_C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(FuelEff_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(FuelEff_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(FuelEff_C))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_fuel))\n    print(\"Maximized Profit: \", model.getVal(obj_profit))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n// 5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50,000\n\n## Generate Constraint-4:\nTo maintain market presence, the company must produce at least 50 units of each product per month.\n// ProductAQty >= 50; ProductBQty >= 50; ProductCQty >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for each product is influenced by the production quantities of all products due to market saturation effects. The profit functions for each product are as follows:\n\n- Profit for ProductA: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\n- Profit for ProductB: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\n- Profit for ProductC: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nThe company wants to maximize the total profit from all products. The company faces the following constraints:\n\n1. The total production capacity of the company is limited to 1000 units per month.\n2. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n3. The company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n4. To maintain market presence, the company must produce at least 50 units of each product per month.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=50)  # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=50)  # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=50)  # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)  # Total production capacity constraint\nmodel.addCons(ProductBQty <= 2 * ProductAQty)  # Raw material availability constraint\nmodel.addCons(5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50000)  # Budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, for ComponentD is $60, and for ComponentE is $80. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is as follows:\n- CostA(UnitsA) = 1000 + 20 * UnitsA + 0.1 * UnitsA^2\n- CostB(UnitsB) = 1500 + 25 * UnitsB + 0.15 * UnitsB^2\n- CostC(UnitsC) = 2000 + 30 * UnitsC + 0.2 * UnitsC^2\n- CostD(UnitsD) = 1200 + 22 * UnitsD + 0.12 * UnitsD^2\n- CostE(UnitsE) = 1800 + 28 * UnitsE + 0.18 * UnitsE^2\nThe company wants to maximize its total net profit.\n// NetProfitA = (50 * UnitsA) - CostA(UnitsA)\n// NetProfitB = (70 * UnitsB) - CostB(UnitsB)\n// NetProfitC = (90 * UnitsC) - CostC(UnitsC)\n// NetProfitD = (60 * UnitsD) - CostD(UnitsD)\n// NetProfitE = (80 * UnitsE) - CostE(UnitsE)\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget constraint of $50,000 for total production costs.\n// CostA(UnitsA) + CostB(UnitsB) + CostC(UnitsC) + CostD(UnitsD) + CostE(UnitsE) <= 50,000\n\n## Generate Constraint-4:\nTo ensure a minimum market presence, the company must produce at least 50 units of each component.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50; UnitsD >= 50; UnitsE >= 50",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit. The profit per unit and the production cost function for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|---------------------------|\n| ComponentA | $50             | 1000 + 20 * UnitsA + 0.1 * UnitsA^2 |\n| ComponentB | $70             | 1500 + 25 * UnitsB + 0.15 * UnitsB^2 |\n| ComponentC | $90             | 2000 + 30 * UnitsC + 0.2 * UnitsC^2 |\n| ComponentD | $60             | 1200 + 22 * UnitsD + 0.12 * UnitsD^2 |\n| ComponentE | $80             | 1800 + 28 * UnitsE + 0.18 * UnitsE^2 |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint of $50,000 for total production costs. To ensure a minimum market presence, the company must produce at least 50 units of each component.\n\nPlease help the company to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50)  # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=50)  # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=50)  # number of units of ComponentE\n\n# Define objective function\n# Calculate the cost functions\nCostA = 1000 + 20 * UnitsA + 0.1 * UnitsA**2\nCostB = 1500 + 25 * UnitsB + 0.15 * UnitsB**2\nCostC = 2000 + 30 * UnitsC + 0.2 * UnitsC**2\nCostD = 1200 + 22 * UnitsD + 0.12 * UnitsD**2\nCostE = 1800 + 28 * UnitsE + 0.18 * UnitsE**2\n\n# Calculate the net profits\nNetProfitA = 50 * UnitsA - CostA\nNetProfitB = 70 * UnitsB - CostB\nNetProfitC = 90 * UnitsC - CostC\nNetProfitD = 60 * UnitsD - CostD\nNetProfitE = 80 * UnitsE - CostE\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n# Add constraints\n# Total production capacity constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\n# ComponentA production must be at least twice ComponentB\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# Budget constraint for total production costs\nmodel.addCons(CostA + CostB + CostC + CostD + CostE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\n// E <= 0.2 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. The operational costs and the units of goods each vehicle type can transport are given in the following Table.\n\n| Vehicle Type | Operational Cost per Month | Units of Goods Transported |\n|--------------|----------------------------|----------------------------|\n| Truck A      | $1000                      | 1000                       |\n| Truck B      | $1200                      | 1200                       |\n| Truck C      | $1500                      | 1500                       |\n| Truck D      | $1800                      | 1800                       |\n| Truck E      | $2000                      | 2000                       |\n\nThe company has a budget of $100,000 for operational costs for the upcoming month. The company must transport at least 50,000 units of goods. The company has a limit on the number of vehicles it can deploy, specifically, it can deploy at most 50 vehicles in total. The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\n\nPlease help the company to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n## The company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1468,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer aims to maximize the total profit while considering the efficiency of battery usage.\n// Profit_E1 = 3000 * E1 - 2000 * E1\n// Profit_E2 = 4000 * E2 - 2500 * E2\n// Profit_E3 = 5000 * E3 - 3000 * E3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (2 * E1 + 3 * E2 + 4 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited battery supply of 500 kWh.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a production budget of $1,000,000 for production costs.\n// 2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000",
        "question": "A manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer has a limited battery supply of 500 kWh and a production budget of $1,000,000 for production costs.\nPlease help the manufacturer to maximize the total profit while considering the efficiency of battery usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (3000 - 2000) * E1\nProfit_E2 = (4000 - 2500) * E2\nProfit_E3 = (5000 - 3000) * E3\nBatteryUsage = 2 * E1 + 3 * E2 + 4 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / BatteryUsage\n## convert the division to multiplication\nmodel.addCons(obj * BatteryUsage == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited battery supply of 500 kWh.\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 500)\n## The manufacturer has a production budget of $1,000,000 for production costs.\nmodel.addCons(2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck, and the average speed at which each truck travels. The goal is to minimize the total fuel cost while ensuring timely deliveries.\n// {\"number of trucks in Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in Region A (km/liter)\": \"EfficiencyA\", \"range\": \"EfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in Region B (km/liter)\": \"EfficiencyB\", \"range\": \"EfficiencyB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in Region A (km/h)\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in Region B (km/h)\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per liter is $1.20. The total distance traveled by trucks in Region A is 500 * TrucksA km, and in Region B is 700 * TrucksB km. The company aims to minimize the total fuel cost.\n// FuelCostA = (500 * TrucksA) / EfficiencyA * 1.20\n// FuelCostB = (700 * TrucksB) / EfficiencyB * 1.20\n// So, the objective function is: Minimize (FuelCostA + FuelCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per month.\n// FuelCostA + FuelCostB <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck, and the average speed at which each truck travels. The goal is to minimize the total fuel cost while ensuring timely deliveries. The fuel cost per liter is $1.20. The total distance traveled by trucks in Region A is 500 * TrucksA km, and in Region B is 700 * TrucksB km. The company has a total budget of $10,000 for fuel costs per month. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks in Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks in Region B\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # fuel efficiency of trucks in Region A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # fuel efficiency of trucks in Region B\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # average speed of trucks in Region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # average speed of trucks in Region B\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostA = (500 * TrucksA) / EfficiencyA * 1.20\nFuelCostB = (700 * TrucksB) / EfficiencyB * 1.20\n## the objective function is: Minimize (FuelCostA + FuelCostB)\nmodel.addCons(obj == FuelCostA + FuelCostB)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per month.\nmodel.addCons(FuelCostA + FuelCostB <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TrucksB))\n    print(\"Fuel Efficiency of Trucks in Region A: \", model.getVal(EfficiencyA))\n    print(\"Fuel Efficiency of Trucks in Region B: \", model.getVal(EfficiencyB))\n    print(\"Average Speed of Trucks in Region A: \", model.getVal(SpeedA))\n    print(\"Average Speed of Trucks in Region B: \", model.getVal(SpeedB))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 620,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on residential buildings\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on commercial buildings\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on industrial buildings\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on government buildings\": \"Government\", \"range\": \"Government >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on educational buildings\": \"Educational\", \"range\": \"Educational >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type. Residential buildings have an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels.\n// Total energy output: Energy = 80% * Residential + 85% * Commercial + 90% * Industrial + 95% * Government + 100% * Educational\n// The objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 to spend on solar panel installations. The cost per panel is $1,000 for residential, $1,200 for commercial, $1,500 for industrial, $1,800 for government, and $2,000 for educational buildings.\n// 1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000",
        "question": "A city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building. The efficiency of solar panels varies by building type, with residential buildings having an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels.\n\n| Building Type | Efficiency | Cost per Panel |\n|---------------|------------|----------------|\n| Residential   | 80%        | $1,000         |\n| Commercial    | 85%        | $1,200         |\n| Industrial    | 90%        | $1,500         |\n| Government    | 95%        | $1,800         |\n| Educational   | 100%       | $2,000         |\n\nThe city has a budget of $500,000 to spend on solar panel installations. Please help the city to maximize the total energy output from the solar panels.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0)  # number of solar panels on residential buildings\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0)  # number of solar panels on commercial buildings\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0)  # number of solar panels on industrial buildings\nGovernment = model.addVar(vtype=\"INTEGER\", name=\"Government\", lb=0)  # number of solar panels on government buildings\nEducational = model.addVar(vtype=\"INTEGER\", name=\"Educational\", lb=0)  # number of solar panels on educational buildings\n\n# Define objective function\nEnergy = 0.8 * Residential + 0.85 * Commercial + 0.9 * Industrial + 0.95 * Government + 1 * Educational\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\nmodel.addCons(1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Residential Buildings: \", model.getVal(Residential))\n    print(\"Number of Solar Panels on Commercial Buildings: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels on Industrial Buildings: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels on Government Buildings: \", model.getVal(Government))\n    print(\"Number of Solar Panels on Educational Buildings: \", model.getVal(Educational))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region.\n// {\"number of trucks allocated to region 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 6\": \"Truck6\", \"range\": \"Truck6 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 1\": \"Driver1\", \"range\": \"Driver1 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 2\": \"Driver2\", \"range\": \"Driver2 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 3\": \"Driver3\", \"range\": \"Driver3 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 4\": \"Driver4\", \"range\": \"Driver4 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 5\": \"Driver5\", \"range\": \"Driver5 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 6\": \"Driver6\", \"range\": \"Driver6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n// Total profit for region 1: Profit1 = (50,000 - 20,000 * Driver1) * Truck1\n// Total profit for region 2: Profit2 = (60,000 - 20,000 * Driver2) * Truck2\n// Total profit for region 3: Profit3 = (70,000 - 20,000 * Driver3) * Truck3\n// Total profit for region 4: Profit4 = (80,000 - 20,000 * Driver4) * Truck4\n// Total profit for region 5: Profit5 = (90,000 - 20,000 * Driver5) * Truck5\n// Total profit for region 6: Profit6 = (100,000 - 20,000 * Driver6) * Truck6\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks in region 1 must not exceed 10.\n// Truck1 <= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n\n| Region | Profit per Truck | Additional Driver Cost |\n|--------|------------------|------------------------|\n| 1      | $50,000          | $20,000                |\n| 2      | $60,000          | $20,000                |\n| 3      | $70,000          | $20,000                |\n| 4      | $80,000          | $20,000                |\n| 5      | $90,000          | $20,000                |\n| 6      | $100,000         | $20,000                |\n\nThe company has a total of 50 trucks available for allocation. Due to regional regulations, the number of trucks in region 1 must not exceed 10. The company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired.\n\nPlease help the company to maximize its total profit by determining the optimal number of trucks to allocate to each region and the number of additional drivers to hire for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks allocated to region 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks allocated to region 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks allocated to region 3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks allocated to region 4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks allocated to region 5\nTruck6 = model.addVar(vtype=\"INTEGER\", name=\"Truck6\", lb=0) # number of trucks allocated to region 6\nDriver1 = model.addVar(vtype=\"INTEGER\", name=\"Driver1\", lb=0) # number of additional drivers hired for region 1\nDriver2 = model.addVar(vtype=\"INTEGER\", name=\"Driver2\", lb=0) # number of additional drivers hired for region 2\nDriver3 = model.addVar(vtype=\"INTEGER\", name=\"Driver3\", lb=0) # number of additional drivers hired for region 3\nDriver4 = model.addVar(vtype=\"INTEGER\", name=\"Driver4\", lb=0) # number of additional drivers hired for region 4\nDriver5 = model.addVar(vtype=\"INTEGER\", name=\"Driver5\", lb=0) # number of additional drivers hired for region 5\nDriver6 = model.addVar(vtype=\"INTEGER\", name=\"Driver6\", lb=0) # number of additional drivers hired for region 6\n\n# Define objective function\nProfit1 = (50000 - 20000 * Driver1) * Truck1\nProfit2 = (60000 - 20000 * Driver2) * Truck2\nProfit3 = (70000 - 20000 * Driver3) * Truck3\nProfit4 = (80000 - 20000 * Driver4) * Truck4\nProfit5 = (90000 - 20000 * Driver5) * Truck5\nProfit6 = (100000 - 20000 * Driver6) * Truck6\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50)\n# Due to regional regulations, the number of trucks in region 1 must not exceed 10.\nmodel.addCons(Truck1 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(Truck5))\n    print(\"Number of Trucks in Region 6: \", model.getVal(Truck6))\n    print(\"Number of Drivers in Region 1: \", model.getVal(Driver1))\n    print(\"Number of Drivers in Region 2: \", model.getVal(Driver2))\n    print(\"Number of Drivers in Region 3: \", model.getVal(Driver3))\n    print(\"Number of Drivers in Region 4: \", model.getVal(Driver4))\n    print(\"Number of Drivers in Region 5: \", model.getVal(Driver5))\n    print(\"Number of Drivers in Region 6: \", model.getVal(Driver6))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1530,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD\", \"range\": \"MachineD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total profit for MachineA: Profit_A = (500 - CostA) * MachineA = (500 - (200 + 0.01 * MachineA^2)) * MachineA\n// Total profit for MachineB: Profit_B = (700 - CostB) * MachineB = (700 - (300 + 0.02 * MachineB^2)) * MachineB\n// Total profit for MachineC: Profit_C = (900 - CostC) * MachineC = (900 - (400 + 0.03 * MachineC^2)) * MachineC\n// Total profit for MachineD: Profit_D = (1100 - CostD) * MachineD = (1100 - (500 + 0.04 * MachineD^2)) * MachineD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines next month.\n// MachineA + MachineB + MachineC + MachineD <= 500\n\n## Generate Constraint-2:\nDue to market demand, the number of MachineD produced should not exceed twice the number of MachineA.\n// MachineD <= 2 * MachineA",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for each machine and the production cost function for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| MachineA | $500 | CostA = 200 + 0.01 * MachineA^2 |\n| MachineB | $700 | CostB = 300 + 0.02 * MachineB^2 |\n| MachineC | $900 | CostC = 400 + 0.03 * MachineC^2 |\n| MachineD | $1100 | CostD = 500 + 0.04 * MachineD^2 |\n\nThe company has a total production capacity of 500 machines next month. Due to market demand, the number of MachineD produced should not exceed twice the number of MachineA. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n\nPlease help the company to determine the optimal number of each machine to produce next month to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0) # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0) # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0) # number of MachineC\nMachineD = model.addVar(vtype=\"INTEGER\", name=\"MachineD\", lb=0) # number of MachineD\n\n# Define objective function\n## calculate the cost for each machine\nCostA = 200 + 0.01 * MachineA**2\nCostB = 300 + 0.02 * MachineB**2\nCostC = 400 + 0.03 * MachineC**2\nCostD = 500 + 0.04 * MachineD**2\n## calculate the profit for each machine\nProfit_A = (500 - CostA) * MachineA\nProfit_B = (700 - CostB) * MachineB\nProfit_C = (900 - CostC) * MachineC\nProfit_D = (1100 - CostD) * MachineD\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 500 machines next month.\nmodel.addCons(MachineA + MachineB + MachineC + MachineD <= 500)\n## Due to market demand, the number of MachineD produced should not exceed twice the number of MachineA.\nmodel.addCons(MachineD <= 2 * MachineA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Number of MachineD: \", model.getVal(MachineD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n// Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000\n// where Cost_Small = $20000, Cost_Medium = $30000, Cost_Large = $40000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability. The operational costs, capacities, and revenue generation for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Day | Capacity (tons) | Revenue per Day | Purchase Cost |\n|------------|--------------------------|-----------------|-----------------|---------------|\n| Small      | $200                     | 10              | $500            | $20,000       |\n| Medium     | $300                     | 20              | $700            | $30,000       |\n| Large      | $400                     | 30              | $900            | $40,000       |\n\nThe company has a budget of $100,000 for purchasing new trucks. The company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs. Please help the company determine the optimal number of small, medium, and large trucks to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nProfit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nCost_Small = 20000\nCost_Medium = 30000\nCost_Large = 40000\nmodel.addCons(Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space, which can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of M1 must be at least twice the production of M2.\n// M1 >= 2 * M2",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints. The revenue per unit, production cost per unit, and storage cost per unit for each machine type are given in the following Table.\n\n| Machine Type | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------------|------------------|--------------------------|-----------------------|\n| M1           | $1000            | $600                     | $50                   |\n| M2           | $1500            | $800                     | $75                   |\n| M3           | $2000            | $1200                    | $100                  |\n\nThe company has a total production budget of $100,000. The company has a limited storage space, which can hold a maximum of 100 units in total. Due to market demand, the production of M1 must be at least twice the production of M2. \nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n# So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n# The company has a total production budget of $100,000.\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n# The company has a limited storage space, which can hold a maximum of 100 units in total.\nmodel.addCons(M1 + M2 + M3 <= 100)\n# Due to market demand, the production of M1 must be at least twice the production of M2.\nmodel.addCons(M1 >= 2 * M2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource usage varies with the level of investment in automation technology. The company also needs to decide on the investment amount in automation to optimize production efficiency.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductA\": \"MaterialsA\", \"range\": \"MaterialsA >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductB\": \"MaterialsB\", \"range\": \"MaterialsB >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductC\": \"MaterialsC\", \"range\": \"MaterialsC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor and raw materials decreases by 1% for every $10,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The initial raw material cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The revenue per unit for ProductA is $100, for ProductB is $120, and for ProductC is $140. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 + 0.01 * AutomationInvestment) * LaborA - (30 + 0.01 * AutomationInvestment) * MaterialsA) * UnitsA\n// Total profit for ProductB: ProfitB = (120 - (60 + 0.01 * AutomationInvestment) * LaborB - (40 + 0.01 * AutomationInvestment) * MaterialsB) * UnitsB\n// Total profit for ProductC: ProfitC = (140 - (70 + 0.01 * AutomationInvestment) * LaborC - (50 + 0.01 * AutomationInvestment) * MaterialsC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 800 units of raw materials available.\n// MaterialsA * UnitsA + MaterialsB * UnitsB + MaterialsC * UnitsC <= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource usage varies with the level of investment in automation technology. The company also needs to decide on the investment amount in automation to optimize production efficiency.\nThe cost of labor and raw materials decreases by 1% for every $10,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The initial raw material cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The revenue per unit for ProductA is $100, for ProductB is $120, and for ProductC is $140. The company aims to maximize the total profit from all products.\nThe company has a total of 1000 labor hours available. The company also has a total of 800 units of raw materials available.\nPlease help the company to maximize the total profit from all products by determining the optimal number of units to produce for each product, the allocation of labor hours and raw materials to each product, and the investment in automation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for ProductA: ProfitA = (100 - (50 + 0.01 * AutomationInvestment) * LaborA - (30 + 0.01 * AutomationInvestment) * MaterialsA) * UnitsA\n## Total profit for ProductB: ProfitB = (120 - (60 + 0.01 * AutomationInvestment) * LaborB - (40 + 0.01 * AutomationInvestment) * MaterialsB) * UnitsB\n## Total profit for ProductC: ProfitC = (140 - (70 + 0.01 * AutomationInvestment) * LaborC - (50 + 0.01 * AutomationInvestment) * MaterialsC) * UnitsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == (100 - (50 + 0.01 * AutomationInvestment) * UnitsA - (30 + 0.01 * AutomationInvestment) * UnitsA +\n                     120 - (60 + 0.01 * AutomationInvestment) * UnitsB - (40 + 0.01 * AutomationInvestment) * UnitsB +\n                     140 - (70 + 0.01 * AutomationInvestment) * UnitsC - (50 + 0.01 * AutomationInvestment) * UnitsC) * (UnitsA + UnitsB + UnitsC))\n\n# Add constraints\n## The company has a total of 1000 labor hours available.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## The company has a total of 800 units of raw materials available.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks.\n// {\"fuel consumption of Truck1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel consumption rate and maintenance cost per kilometer. The rates are as follows:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost.\n// Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n// Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n// So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\n\n## Generate Constraint-1:\nThe total distance covered by all trucks should not exceed 10,000 km.\n// F1 + F2 + F3 + F4 + F5 <= 10000\n\n## Generate Constraint-2:\nTruck1 and Truck2 combined should cover at least 3000 km.\n// F1 + F2 >= 3000",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks. The fuel consumption rate and maintenance cost per kilometer for each truck are given in the following Table.\n\n| Truck  | Fuel Consumption Rate (liters/km) | Maintenance Cost/km |\n|--------|----------------------------------|---------------------|\n| Truck1 | 0.15                             | $2                  |\n| Truck2 | 0.20                             | $3                  |\n| Truck3 | 0.18                             | $2.5                |\n| Truck4 | 0.22                             | $3.5                |\n| Truck5 | 0.25                             | $4                  |\n\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost. The total distance covered by all trucks should not exceed 10,000 km. Additionally, Truck1 and Truck2 combined should cover at least 3000 km.\n\nPlease help the company to minimize the total cost of fuel consumption and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of Truck1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of Truck2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of Truck3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of Truck4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of Truck5\n\n# Define objective function\n## Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n## Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n## So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\nTotalFuelCost = 0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5\nTotalMaintenanceCost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\nTotalCost = TotalFuelCost + TotalMaintenanceCost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total distance covered by all trucks should not exceed 10,000 km.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 10000)\n## Truck1 and Truck2 combined should cover at least 3000 km.\nmodel.addCons(F1 + F2 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(F1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(F2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(F3))\n    print(\"Fuel consumption of Truck4: \", model.getVal(F4))\n    print(\"Fuel consumption of Truck5: \", model.getVal(F5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck at warehouse 1 incurs a cost of $50 per km and can travel 100 km per day.\nEach truck at warehouse 2 incurs a cost of $60 per km and can travel 90 km per day.\nEach truck at warehouse 3 incurs a cost of $70 per km and can travel 80 km per day.\nEach truck at warehouse 4 incurs a cost of $80 per km and can travel 70 km per day.\nEach truck at warehouse 5 incurs a cost of $90 per km and can travel 60 km per day.\nThe company needs to deliver at least 5000 km worth of goods per day. The objective is to minimize the total daily transportation cost.\n// Total daily cost: Cost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\n// Total daily distance: Distance = 100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost per km and daily travel distance for each warehouse are given in the following Table.\n\n| Warehouse | Cost per km | Daily Travel Distance |\n|-----------|-------------|-----------------------|\n| 1         | $50         | 100 km                |\n| 2         | $60         | 90 km                 |\n| 3         | $70         | 80 km                 |\n| 4         | $80         | 70 km                 |\n| 5         | $90         | 60 km                 |\n\nThe company needs to deliver at least 5000 km worth of goods per day. The company has a total of 100 trucks available. Each warehouse can handle a maximum of 30 trucks. Please help the company to minimize the total daily transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\nCost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100) # Total of 100 trucks available\nmodel.addCons(T1 <= 30) # Each warehouse can handle a maximum of 30 trucks\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons.\nTruck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons.\nTruck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons.\nThe revenue per ton-km is $0.5. The company wants to maximize the net profit per day.\n// Profit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\n// Profit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\n// Profit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a daily fuel budget of $1000.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000\n\n## Generate Constraint-2:\nThe company has a daily maintenance budget of $3000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000\n\n## Generate Constraint-3:\nThe total cargo capacity of all vehicles must not exceed 500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 500\n\n## Generate Constraint-4:\nThe number of Truck A must not exceed 50.\n// TruckA <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. Truck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons. Truck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons. Truck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons. The revenue per ton-km is $0.5. The company has a daily fuel budget of $1000 and a daily maintenance budget of $3000. The total cargo capacity of all vehicles must not exceed 500 tons, and the number of Truck A must not exceed 50. The company wants to maximize the net profit per day. Please help the company determine the optimal number of each type of vehicle to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\nProfit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\nProfit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n# So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a daily fuel budget of $1000.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000)\n# The company has a daily maintenance budget of $3000.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000)\n# The total cargo capacity of all vehicles must not exceed 500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 500)\n# The number of Truck A must not exceed 50.\nmodel.addCons(TruckA <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations.\n// {\"number of trucks allocated to the North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor the North region, the average fuel consumption per truck is 50 liters per day, the average delivery cost per truck is $300 per day, and the average revenue per truck is $500 per day.\nFor the South region, the average fuel consumption per truck is 45 liters per day, the average delivery cost per truck is $280 per day, and the average revenue per truck is $480 per day.\nFor the East region, the average fuel consumption per truck is 55 liters per day, the average delivery cost per truck is $320 per day, and the average revenue per truck is $520 per day.\nFor the West region, the average fuel consumption per truck is 60 liters per day, the average delivery cost per truck is $350 per day, and the average revenue per truck is $550 per day.\nFor the Central region, the average fuel consumption per truck is 40 liters per day, the average delivery cost per truck is $250 per day, and the average revenue per truck is $450 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for North: Profit_North = (500 - 300) * NorthTrucks\n// Total net profit for South: Profit_South = (480 - 280) * SouthTrucks\n// Total net profit for East: Profit_East = (520 - 320) * EastTrucks\n// Total net profit for West: Profit_West = (550 - 350) * WestTrucks\n// Total net profit for Central: Profit_Central = (450 - 250) * CentralTrucks\n// Total fuel consumption: Fuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n// So, the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\n// NorthTrucks - SouthTrucks <= 10\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 per day for delivery costs across all regions.\n// 300 * NorthTrucks + 280 * SouthTrucks + 320 * EastTrucks + 350 * WestTrucks + 250 * CentralTrucks <= 30000",
        "question": "A logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations. The average fuel consumption per truck, delivery cost per truck, and revenue per truck for each region are given in the following Table.\n\n| Region    | Fuel Consumption (liters/day) | Delivery Cost ($/day) | Revenue ($/day) |\n|-----------|-------------------------------|-----------------------|-----------------|\n| North     | 50                            | 300                   | 500             |\n| South     | 45                            | 280                   | 480             |\n| East      | 55                            | 320                   | 520             |\n| West      | 60                            | 350                   | 550             |\n| Central   | 40                            | 250                   | 450             |\n\nThe company has a total of 100 trucks available for allocation. Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10. The company has a budget of $30,000 per day for delivery costs across all regions. \n\nPlease help the company to maximize the net profit per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)  # number of trucks allocated to the North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)  # number of trucks allocated to the South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)  # number of trucks allocated to the East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)  # number of trucks allocated to the West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=0)  # number of trucks allocated to the Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_North = (500 - 300) * NorthTrucks\nProfit_South = (480 - 280) * SouthTrucks\nProfit_East = (520 - 320) * EastTrucks\nProfit_West = (550 - 350) * WestTrucks\nProfit_Central = (450 - 250) * CentralTrucks\nFuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n## the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100)\n## Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\nmodel.addCons(NorthTrucks - SouthTrucks <= 10)\n## The company has a budget of $30,000 per day for delivery costs across all regions.\nmodel.addCons(300 * NorthTrucks + 280 * SouthTrucks + 320 * EastTrucks + 350 * WestTrucks + 250 * CentralTrucks <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1334,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of public facilities: a library, a sports center, a community garden, a museum, and a theater. The city council needs to decide how many of each facility to build to maximize community satisfaction and usage.\n// {\"number of libraries\": \"Libraries\", \"range\": \"Libraries >= 0\", \"type\": \"integer\"}\n// {\"number of sports centers\": \"SportsCenters\", \"range\": \"SportsCenters >= 0\", \"type\": \"integer\"}\n// {\"number of community gardens\": \"CommunityGardens\", \"range\": \"CommunityGardens >= 0\", \"type\": \"integer\"}\n// {\"number of museums\": \"Museums\", \"range\": \"Museums >= 0\", \"type\": \"integer\"}\n// {\"number of theaters\": \"Theaters\", \"range\": \"Theaters >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe satisfaction and usage of each facility are estimated as follows:\n- Library: Satisfaction = 50 * Libraries, Usage = 100 * Libraries\n- Sports Center: Satisfaction = 100 * SportsCenters, Usage = 200 * SportsCenters\n- Community Garden: Satisfaction = 30 * CommunityGardens, Usage = 50 * CommunityGardens\n- Museum: Satisfaction = 80 * Museums, Usage = 150 * Museums\n- Theater: Satisfaction = 120 * Theaters, Usage = 250 * Theaters\nThe city council wants to maximize the total satisfaction per usage, which is defined as the total satisfaction divided by the total usage.\n// Total Satisfaction = 50 * Libraries + 100 * SportsCenters + 30 * CommunityGardens + 80 * Museums + 120 * Theaters\n// Total Usage = 100 * Libraries + 200 * SportsCenters + 50 * CommunityGardens + 150 * Museums + 250 * Theaters\n// So, the objective function is: Maximize (Total Satisfaction / Total Usage)\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 to spend on these facilities.\n// 100000 * Libraries + 200000 * SportsCenters + 50000 * CommunityGardens + 150000 * Museums + 250000 * Theaters <= 5000000\n\n## Generate Constraint-2:\nThe city council wants to ensure that at least 3 different types of facilities are built.\n// Libraries + SportsCenters + CommunityGardens + Museums + Theaters >= 3\n\n## Generate Constraint-3:\nDue to space limitations, the total number of facilities cannot exceed 20.\n// Libraries + SportsCenters + CommunityGardens + Museums + Theaters <= 20\n\n## Generate Constraint-4:\nThe city council wants to ensure that each facility type has at least one facility built.\n// Libraries >= 1; SportsCenters >= 1; CommunityGardens >= 1; Museums >= 1; Theaters >= 1\n\n## Generate Constraint-5:\nThe city council prefers to have at least twice as many community gardens as museums.\n// CommunityGardens >= 2 * Museums",
        "question": "A city is planning to build five different types of public facilities: a library, a sports center, a community garden, a museum, and a theater. The city council needs to decide how many of each facility to build to maximize community satisfaction and usage. The satisfaction and usage of each facility are estimated as follows:\n\n| Facility       | Satisfaction | Usage       |\n|----------------|--------------|-------------|\n| Library        | 50 * Libraries | 100 * Libraries |\n| Sports Center  | 100 * SportsCenters | 200 * SportsCenters |\n| Community Garden | 30 * CommunityGardens | 50 * CommunityGardens |\n| Museum         | 80 * Museums | 150 * Museums |\n| Theater        | 120 * Theaters | 250 * Theaters |\n\nThe city has a budget of $5,000,000 to spend on these facilities. The city council wants to ensure that at least 3 different types of facilities are built. Due to space limitations, the total number of facilities cannot exceed 20. The city council wants to ensure that each facility type has at least one facility built. The city council prefers to have at least twice as many community gardens as museums.\n\nPlease help the city council to maximize the total satisfaction per usage, which is defined as the total satisfaction divided by the total usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLibraries = model.addVar(vtype=\"INTEGER\", name=\"Libraries\", lb=1)\nSportsCenters = model.addVar(vtype=\"INTEGER\", name=\"SportsCenters\", lb=1)\nCommunityGardens = model.addVar(vtype=\"INTEGER\", name=\"CommunityGardens\", lb=1)\nMuseums = model.addVar(vtype=\"INTEGER\", name=\"Museums\", lb=1)\nTheaters = model.addVar(vtype=\"INTEGER\", name=\"Theaters\", lb=1)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalSatisfaction = 50 * Libraries + 100 * SportsCenters + 30 * CommunityGardens + 80 * Museums + 120 * Theaters\nTotalUsage = 100 * Libraries + 200 * SportsCenters + 50 * CommunityGardens + 150 * Museums + 250 * Theaters\n## convert the division to multiplication\nmodel.addCons(obj * TotalUsage == TotalSatisfaction)\n\n# Add constraints\n## The city has a budget of $5,000,000 to spend on these facilities.\nmodel.addCons(100000 * Libraries + 200000 * SportsCenters + 50000 * CommunityGardens + 150000 * Museums + 250000 * Theaters <= 5000000)\n## The city council wants to ensure that at least 3 different types of facilities are built.\nmodel.addCons(Libraries + SportsCenters + CommunityGardens + Museums + Theaters >= 3)\n## Due to space limitations, the total number of facilities cannot exceed 20.\nmodel.addCons(Libraries + SportsCenters + CommunityGardens + Museums + Theaters <= 20)\n## The city council prefers to have at least twice as many community gardens as museums.\nmodel.addCons(CommunityGardens >= 2 * Museums)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Libraries: \", model.getVal(Libraries))\n    print(\"Number of Sports Centers: \", model.getVal(SportsCenters))\n    print(\"Number of Community Gardens: \", model.getVal(CommunityGardens))\n    print(\"Number of Museums: \", model.getVal(Museums))\n    print(\"Number of Theaters: \", model.getVal(Theaters))\n    print(\"Maximized Satisfaction per Usage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate to each route (Route1, Route2, Route3) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software which can reduce fuel consumption and improve efficiency, but at a cost.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for Route3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software\": \"SoftwareInvest\", \"range\": \"SoftwareInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in fuel optimization and route optimization software. The initial fuel cost per truck for Route1 is $1000, for Route2 is $1200, and for Route3 is $1500. The fuel cost decreases by $10 for every $100 invested in fuel optimization and by an additional $5 for every $1000 invested in route optimization software. The company aims to minimize the total fuel cost across all routes.\n// Total fuel cost for Route1: Cost1 = (1000 - 0.1 * FuelOpt1 - 0.005 * SoftwareInvest) * Trucks1\n// Total fuel cost for Route2: Cost2 = (1200 - 0.1 * FuelOpt2 - 0.005 * SoftwareInvest) * Trucks2\n// Total fuel cost for Route3: Cost3 = (1500 - 0.1 * FuelOpt3 - 0.005 * SoftwareInvest) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and software investments.\n// FuelOpt1 + FuelOpt2 + FuelOpt3 + SoftwareInvest <= 100000",
        "question": "A logistics company is planning its routes for the next quarter and needs to decide the number of trucks to allocate to each route (Route1, Route2, Route3) and the amount of fuel to optimize for each route. The company is also considering investing in route optimization software to reduce fuel consumption and improve efficiency, but at a cost. The initial fuel cost per truck for each route and the effects of fuel optimization and software investment on fuel costs are detailed in the following table:\n\n| Route | Initial Fuel Cost per Truck | Fuel Optimization Effect | Software Investment Effect |\n|-------|-----------------------------|-------------------------|----------------------------|\n| Route1 | $1000                      | $10 savings per $100 invested | $5 savings per $1000 invested |\n| Route2 | $1200                      | $10 savings per $100 invested | $5 savings per $1000 invested |\n| Route3 | $1500                      | $10 savings per $100 invested | $5 savings per $1000 invested |\n\nThe company has a total budget of $100,000 for fuel optimization and software investments. The objective is to minimize the total fuel cost across all routes. Please help the company determine the optimal number of trucks for each route, the amount of fuel optimization for each route, and the investment in route optimization software.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuelOpt1 = model.addVar(name=\"FuelOpt1\", lb=0)  # amount of fuel optimization for Route1\nFuelOpt2 = model.addVar(name=\"FuelOpt2\", lb=0)  # amount of fuel optimization for Route2\nFuelOpt3 = model.addVar(name=\"FuelOpt3\", lb=0)  # amount of fuel optimization for Route3\nSoftwareInvest = model.addVar(name=\"SoftwareInvest\", lb=0)  # investment in route optimization software\n\n# Define objective function\nCost1 = (1000 - 0.1 * FuelOpt1 - 0.005 * SoftwareInvest) * Trucks1\nCost2 = (1200 - 0.1 * FuelOpt2 - 0.005 * SoftwareInvest) * Trucks2\nCost3 = (1500 - 0.1 * FuelOpt3 - 0.005 * SoftwareInvest) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(FuelOpt1 + FuelOpt2 + FuelOpt3 + SoftwareInvest <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Amount of Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Amount of Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Amount of Fuel Optimization for Route3: \", model.getVal(FuelOpt3))\n    print(\"Investment in Route Optimization Software: \", model.getVal(SoftwareInvest))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles.\n// Annual operating cost for TruckA: CostA = 10000 - 0.2 * EfficiencyA\n// Annual operating cost for TruckB: CostB = 15000 - 0.3 * EfficiencyB\n// Annual operating cost for TruckC: CostC = 20000 - 0.4 * EfficiencyC\n// So, the objective function is: Minimize (CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year and decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle. The operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles. The company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades. Please help the company to determine the optimal number of each type of vehicle and the appropriate level of fuel efficiency upgrades to minimize the total annual operating cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # fuel efficiency upgrade for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # fuel efficiency upgrade for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # fuel efficiency upgrade for TruckC\n\n# Define objective function\nCostA = 10000 - 0.2 * EfficiencyA\nCostB = 15000 - 0.3 * EfficiencyB\nCostC = 20000 - 0.4 * EfficiencyC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == (CostA * TruckA + CostB * TruckB + CostC * TruckC))\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Efficiency Upgrade for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Efficiency Upgrade for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Efficiency Upgrade for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. The company aims to minimize the total transportation cost while meeting specific constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per unit for each package type varies with the warehouse and the package type. The costs are as follows:\n- Warehouse 1: Cost_P1 = $10, Cost_P2 = $12, Cost_P3 = $15, Cost_P4 = $20, Cost_P5 = $25\n- Warehouse 2: Cost_P1 = $15, Cost_P2 = $18, Cost_P3 = $22, Cost_P4 = $27, Cost_P5 = $32\n- Warehouse 3: Cost_P1 = $20, Cost_P2 = $24, Cost_P3 = $28, Cost_P4 = $33, Cost_P5 = $38\nThe company wants to minimize the total transportation cost.\n// Total_Cost = (Cost_P1 * P1) + (Cost_P2 * P2) + (Cost_P3 * P3) + (Cost_P4 * P4) + (Cost_P5 * P5)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nEach warehouse has a limited storage capacity. Warehouse 1 can store up to 100 units, Warehouse 2 up to 150 units, and Warehouse 3 up to 200 units.\n// P1 + P2 + P3 + P4 + P5 <= 100 (for Warehouse 1)\n// P1 + P2 + P3 + P4 + P5 <= 150 (for Warehouse 2)\n// P1 + P2 + P3 + P4 + P5 <= 200 (for Warehouse 3)\n\n## Generate Constraint-2:\nThe total demand for each package type must be met. The demands are: D_P1 = 50, D_P2 = 75, D_P3 = 100, D_P4 = 125, D_P5 = 150.\n// P1 >= 50\n// P2 >= 75\n// P3 >= 100\n// P4 >= 125\n// P5 >= 150\n\n## Generate Constraint-3:\nThe company has a budget constraint for transportation costs, which is $5000.\n// (Cost_P1 * P1) + (Cost_P2 * P2) + (Cost_P3 * P3) + (Cost_P4 * P4) + (Cost_P5 * P5) <= 5000\n\n## Generate Constraint-4:\nThe transportation cost for each package type increases nonlinearly with the quantity transported due to economies of scale. The cost function is: Cost_Pi = a_i * P_i^2 + b_i * P_i, where a_i and b_i are constants.\n// Cost_P1 = a_1 * P1^2 + b_1 * P1\n// Cost_P2 = a_2 * P2^2 + b_2 * P2\n// Cost_P3 = a_3 * P3^2 + b_3 * P3\n// Cost_P4 = a_4 * P4^2 + b_4 * P4\n// Cost_P5 = a_5 * P5^2 + b_5 * P5\n// Ensure these nonlinear cost functions are incorporated into the objective function.",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. The company aims to minimize the total transportation cost while meeting specific constraints. The transportation cost per unit for each package type varies with the warehouse and the package type, as shown in the following Table.\n\n| Warehouse | Cost_P1 | Cost_P2 | Cost_P3 | Cost_P4 | Cost_P5 |\n|-----------|---------|---------|---------|---------|---------|\n| 1         | $10     | $12     | $15     | $20     | $25     |\n| 2         | $15     | $18     | $22     | $27     | $32     |\n| 3         | $20     | $24     | $28     | $33     | $38     |\n\nEach warehouse has a limited storage capacity. Warehouse 1 can store up to 100 units, Warehouse 2 up to 150 units, and Warehouse 3 up to 200 units. The total demand for each package type must be met, with demands as follows: D_P1 = 50, D_P2 = 75, D_P3 = 100, D_P4 = 125, D_P5 = 150. The company has a budget constraint for transportation costs, which is $5000. Additionally, the transportation cost for each package type increases nonlinearly with the quantity transported due to economies of scale, following the cost function: Cost_Pi = a_i * P_i^2 + b_i * P_i, where a_i and b_i are constants.\n\nPlease help the company to minimize the total transportation cost while satisfying all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=50)  # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=75)  # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=100)  # quantity of P3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=125)  # quantity of P4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=150)  # quantity of P5\n\n# Define objective function\n# Nonlinear cost functions\na1, b1 = 0.01, 10  # example values for P1\na2, b2 = 0.02, 12  # example values for P2\na3, b3 = 0.03, 15  # example values for P3\na4, b4 = 0.04, 20  # example values for P4\na5, b5 = 0.05, 25  # example values for P5\n\nCost_P1 = a1 * P1**2 + b1 * P1\nCost_P2 = a2 * P2**2 + b2 * P2\nCost_P3 = a3 * P3**2 + b3 * P3\nCost_P4 = a4 * P4**2 + b4 * P4\nCost_P5 = a5 * P5**2 + b5 * P5\n\nTotal_Cost = Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n# Warehouse capacity constraints\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 100)  # Warehouse 1\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 150)  # Warehouse 2\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 200)  # Warehouse 3\n\n# Demand constraints\nmodel.addCons(P1 >= 50)\nmodel.addCons(P2 >= 75)\nmodel.addCons(P3 >= 100)\nmodel.addCons(P4 >= 125)\nmodel.addCons(P5 >= 150)\n\n# Budget constraint\nmodel.addCons(Total_Cost <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Quantity of P4: \", model.getVal(P4))\n    print(\"Quantity of P5: \", model.getVal(P5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1387,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations.\n// {\"number of trips to city A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies nonlinearly with the distance traveled and the load carried. The cost function for each city is given by: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips.\n// So, the objective function is: Minimize (0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for fuel costs this month.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2 <= 5000\n\n## Generate Constraint-2:\nThe company must make at least 5 trips to each city this month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations. The cost of fuel per trip varies nonlinearly with the distance traveled and the load carried, and is given by the following cost functions for each city: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips.\n\nThe company has a budget of $5000 for fuel costs this month. The company must make at least 5 trips to each city this month.\n\nPlease help the company to determine the optimal number of trips to each city to minimize the total fuel cost while adhering to the budget and trip requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must make at least 5 trips to each city this month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips to city A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips to city B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips to city C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips to city D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips to city E\n\n# Define objective function\n## The cost of fuel per trip varies nonlinearly with the distance traveled and the load carried.\nCost_A = 0.05 * A**2\nCost_B = 0.07 * B**2\nCost_C = 0.09 * C**2\nCost_D = 0.11 * D**2\nCost_E = 0.13 * E**2\n## The company aims to minimize the total fuel cost across all trips.\n## So, the objective function is: Minimize (0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $5000 for fuel costs this month.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to city A: \", model.getVal(A))\n    print(\"Number of trips to city B: \", model.getVal(B))\n    print(\"Number of trips to city C: \", model.getVal(C))\n    print(\"Number of trips to city D: \", model.getVal(D))\n    print(\"Number of trips to city E: \", model.getVal(E))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\n// NetProfit_Small = (200 - 50) * SmallVehicles\n// NetProfit_Medium = (300 - 75) * MediumVehicles\n// NetProfit_Large = (400 - 100) * LargeVehicles\n// So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs.\n// 50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000\n\n## Generate Constraint-2:\nThe company has a limited parking space that can accommodate a maximum of 100 vehicles.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 100",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company has a total budget of $5000 per day for vehicle maintenance and operational costs. Additionally, the company has a limited parking space that can accommodate a maximum of 100 vehicles. Please help the company to maximize the net daily profit from all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nNetProfit_Small = (200 - 50) * SmallVehicles\nNetProfit_Medium = (300 - 75) * MediumVehicles\nNetProfit_Large = (400 - 100) * LargeVehicles\n# So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n# Add constraints\n# The company has a total budget of $5000 per day for vehicle maintenance and operational costs.\nmodel.addCons(50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000)\n# The company has a limited parking space that can accommodate a maximum of 100 vehicles.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n// Fuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * Distance1 / 100\n// Fuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * Distance2 / 100\n// Fuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * Distance3 / 100\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1200 * Trucks2\n// Revenue_Route3 = 1500 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies. The fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n\n| Route | Revenue per Truck | Initial Fuel Consumption | Investment Impact |\n|-------|-------------------|--------------------------|-------------------|\n| 1     | $1000             | 50 liters/100km          | -1 liter/100km per $100 |\n| 2     | $1200             | 50 liters/100km          | -1 liter/100km per $100 |\n| 3     | $1500             | 50 liters/100km          | -1 liter/100km per $100 |\n\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency. Please help the company determine the optimal number of trucks to allocate to each route and the amount to invest in fuel efficiency for each route to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate fuel costs and revenues\nFuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * 1000 / 100  # assuming Distance1 is 1000 km\nFuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * 1000 / 100  # assuming Distance2 is 1000 km\nFuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * 1000 / 100  # assuming Distance3 is 1000 km\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1200 * Trucks2\nRevenue_Route3 = 1500 * Trucks3\n\n## the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\nmodel.addCons(obj == Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1384,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines.\n// {\"cargo load on truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency (in liters per kilometer) and a maximum capacity. Truck 1 has a fuel efficiency of 5 + 0.01 * T1 liters/km, Truck 2 has 6 + 0.015 * T2 liters/km, Truck 3 has 7 + 0.02 * T3 liters/km, Truck 4 has 8 + 0.025 * T4 liters/km, and Truck 5 has 9 + 0.03 * T5 liters/km. The total distance to be covered by all trucks is 1000 km. The company wants to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = (5 + 0.01 * T1) * 1000 + (6 + 0.015 * T2) * 1000 + (7 + 0.02 * T3) * 1000 + (8 + 0.025 * T4) * 1000 + (9 + 0.03 * T5) * 1000\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 500 tons.\n// T1 + T2 + T3 + T4 + T5 = 500",
        "question": "A logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines. The fuel efficiency of each truck (in liters per kilometer) varies with the load it carries, as shown in the following Table.\n\n| Truck | Fuel Efficiency (liters/km) |\n|-------|-----------------------------|\n| 1     | 5 + 0.01 * T1               |\n| 2     | 6 + 0.015 * T2              |\n| 3     | 7 + 0.02 * T3               |\n| 4     | 8 + 0.025 * T4              |\n| 5     | 9 + 0.03 * T5               |\n\nEach truck will cover a total distance of 1000 km. The total cargo to be delivered is 500 tons. The company aims to minimize the total fuel consumption. Please help the company determine the optimal cargo loads (T1, T2, T3, T4, T5) for each truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # cargo load on truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0) # cargo load on truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0) # cargo load on truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0) # cargo load on truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0) # cargo load on truck 5\n\n# Define objective function\n## calculate fuel consumption for each truck\nFuel_T1 = (5 + 0.01 * T1) * 1000\nFuel_T2 = (6 + 0.015 * T2) * 1000\nFuel_T3 = (7 + 0.02 * T3) * 1000\nFuel_T4 = (8 + 0.025 * T4) * 1000\nFuel_T5 = (9 + 0.03 * T5) * 1000\n## total fuel consumption\nFuel = Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total cargo to be delivered is 500 tons.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo Load on Truck 1: \", model.getVal(T1))\n    print(\"Cargo Load on Truck 2: \", model.getVal(T2))\n    print(\"Cargo Load on Truck 3: \", model.getVal(T3))\n    print(\"Cargo Load on Truck 4: \", model.getVal(T4))\n    print(\"Cargo Load on Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The production process involves a nonlinear relationship between the quantity produced and the cost.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\nThe profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\nThe profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs per day.\n// 0.5 * ProductA^2 + 0.4 * ProductB^2 + 0.3 * ProductC^2 <= 10000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// ProductA >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The profit for each product is given by the following functions:\n\n- Profit for product A: Profit_A = 100 * ProductA - 0.5 * ProductA^2\n- Profit for product B: Profit_B = 150 * ProductB - 0.4 * ProductB^2\n- Profit for product C: Profit_C = 200 * ProductC - 0.3 * ProductC^2\n\nThe company wants to maximize the total profit from all products. The company has a total production capacity of 100 units per day and a budget of $10,000 for production costs per day. The market demand for product A is at least 20 units per day.\n\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=20) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nProfit_A = 100 * ProductA - 0.5 * ProductA**2\nProfit_B = 150 * ProductB - 0.4 * ProductB**2\nProfit_C = 200 * ProductC - 0.3 * ProductC**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 100)\n## The company has a budget of $10,000 for production costs per day.\nmodel.addCons(0.5 * ProductA**2 + 0.4 * ProductB**2 + 0.3 * ProductC**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery demands.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nT1 has a fuel efficiency of 5 km/liter, T2 has 6 km/liter, T3 has 7 km/liter, T4 has 8 km/liter, and T5 has 9 km/liter. The company wants to minimize the total fuel consumption for all trips. The total distance to be covered by each type of truck is proportional to its number and its individual distance factor (T1: 100 km, T2: 120 km, T3: 140 km, T4: 160 km, T5: 180 km).\n// Fuel_T1 = (100 * T1) / 5\n// Fuel_T2 = (120 * T2) / 6\n// Fuel_T3 = (140 * T3) / 7\n// Fuel_T4 = (160 * T4) / 8\n// Fuel_T5 = (180 * T5) / 9\n// So, the objective function is: Minimize Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can operate, which is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery demands. The fuel efficiency and the individual distance factor for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Individual Distance Factor (km) |\n|------------|---------------------------|---------------------------------|\n| T1         | 5                         | 100                             |\n| T2         | 6                         | 120                             |\n| T3         | 7                         | 140                             |\n| T4         | 8                         | 160                             |\n| T5         | 9                         | 180                             |\n\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000. The company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters. The company has a limit on the total number of trucks it can operate, which is 100.\n\nPlease help the company to minimize the total fuel consumption for all trips (which is defined as the sum of the total distance for each type of truck divided by its fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_T1 = (100 * T1) / 5\nFuel_T2 = (120 * T2) / 6\nFuel_T3 = (140 * T3) / 7\nFuel_T4 = (160 * T4) / 8\nFuel_T5 = (180 * T5) / 9\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5)\n\n# Add constraints\n## The company has a total budget of $500,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000)\n## The company must meet a minimum delivery capacity of 10,000 cubic meters.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000)\n## The company has a limit on the total number of trucks it can operate, which is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1571,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\n// Profit_D1 = 100 * D1\n// Profit_D2 = 150 * D2\n// Profit_D3 = 200 * D3\n// The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 500 units available.\n// 2 * D1 + 3 * D2 + 4 * D3 <= 500",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer has a limited supply of material M, with only 500 units available. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 100 * D1\nProfit_D2 = 150 * D2\nProfit_D3 = 200 * D3\n# The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited supply of material M, with only 500 units available.\nmodel.addCons(2 * D1 + 3 * D2 + 4 * D3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 705,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company wants to minimize the total operational cost per ton-kilometer.\n// Operational cost for TruckA: Cost_TruckA = (0.5 + 0.3) * TruckANum\n// Operational cost for TruckB: Cost_TruckB = (0.6 + 0.4) * TruckBNum\n// Operational cost for TruckC: Cost_TruckC = (0.7 + 0.5) * TruckCNum\n// Operational cost for TruckD: Cost_TruckD = (0.8 + 0.6) * TruckDNum\n// Operational cost for TruckE: Cost_TruckE = (0.9 + 0.7) * TruckENum\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// 10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company has a total budget of $100,000 for purchasing trucks. The company has a total of 50 drivers available.\nPlease help the company to minimize the total operational cost per ton-kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (0.5 + 0.3) * TruckANum\nCost_TruckB = (0.6 + 0.4) * TruckBNum\nCost_TruckC = (0.7 + 0.5) * TruckCNum\nCost_TruckD = (0.8 + 0.6) * TruckDNum\nCost_TruckE = (0.9 + 0.7) * TruckENum\nCapacity = 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000)\n## The company has a total of 50 drivers available.\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Minimized Operational Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck is affected by the fuel optimization, where the cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n\n| Region       | Number of Trucks | Fuel Optimization |\n|--------------|-----------------|-------------------|\n| Region1      | Trucks1         | FuelOpt1          |\n| Region2      | Trucks2         | FuelOpt2          |\n| Region3      | Trucks3         | FuelOpt3          |\n\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel. Please help the company to determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"SP1\", \"range\": \"SP1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"WT1\", \"range\": \"WT1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"SP2\", \"range\": \"SP2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"WT2\", \"range\": \"WT2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"SP3\", \"range\": \"SP3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"WT3\", \"range\": \"WT3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"SP4\", \"range\": \"SP4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"WT4\", \"range\": \"WT4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"SP5\", \"range\": \"SP5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"WT5\", \"range\": \"WT5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation. The energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations.\n// Total cost: Cost = 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2)\n// Total energy output: Energy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n// So, the objective function is: Minimize (Cost / Energy)\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2) <= 500000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function and energy output are nonlinear due to economies of scale in production and installation, and varying efficiencies of solar panels and wind turbines at different locations.\n\n| Location | Solar Panels (SP) | Wind Turbines (WT) |\n|----------|-------------------|--------------------|\n| 1        | SP1               | WT1                |\n| 2        | SP2               | WT2                |\n| 3        | SP3               | WT3                |\n| 4        | SP4               | WT4                |\n| 5        | SP5               | WT5                |\n\nThe total budget for the project is $500,000. The objective function is to minimize the ratio of the total cost to the total energy output. Please help the company determine the optimal number of solar panels and wind turbines to install at each location to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP1 = model.addVar(vtype=\"INTEGER\", name=\"SP1\", lb=0) # number of solar panels at location 1\nWT1 = model.addVar(vtype=\"INTEGER\", name=\"WT1\", lb=0) # number of wind turbines at location 1\nSP2 = model.addVar(vtype=\"INTEGER\", name=\"SP2\", lb=0) # number of solar panels at location 2\nWT2 = model.addVar(vtype=\"INTEGER\", name=\"WT2\", lb=0) # number of wind turbines at location 2\nSP3 = model.addVar(vtype=\"INTEGER\", name=\"SP3\", lb=0) # number of solar panels at location 3\nWT3 = model.addVar(vtype=\"INTEGER\", name=\"WT3\", lb=0) # number of wind turbines at location 3\nSP4 = model.addVar(vtype=\"INTEGER\", name=\"SP4\", lb=0) # number of solar panels at location 4\nWT4 = model.addVar(vtype=\"INTEGER\", name=\"WT4\", lb=0) # number of wind turbines at location 4\nSP5 = model.addVar(vtype=\"INTEGER\", name=\"SP5\", lb=0) # number of solar panels at location 5\nWT5 = model.addVar(vtype=\"INTEGER\", name=\"WT5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (SP1**2 + WT1**2 + SP2**2 + WT2**2 + SP3**2 + WT3**2 + SP4**2 + WT4**2 + SP5**2 + WT5**2)\nEnergy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n## the objective function is: Minimize (Cost / Energy)\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(Cost <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(SP1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(WT1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(SP2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(WT2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(SP3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(WT3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(SP4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(WT4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(SP5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(WT5))\n    print(\"Minimized Cost/Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials, labor, and storage. The company also needs to decide on the number of shifts to operate in the factory to meet production demands.\n// {\"production quantity of product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of raw materials per unit for product A is $20, product B is $30, and product C is $25. The labor cost per shift is $1000. The storage cost per unit per day is $5 for all products. The company wants to maximize the total daily profit.\n// Profit_A = (50 - 20 - 5) * ProdA\n// Profit_B = (70 - 30 - 5) * ProdB\n// Profit_C = (60 - 25 - 5) * ProdC\n// Total_Labor_Cost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day for all products combined.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials per day.\n// 20 * ProdA + 30 * ProdB + 25 * ProdC <= 5000\n\n## Generate Constraint-3:\nThe total storage space available is limited to 800 units.\n// ProdA + ProdB + ProdC <= 800\n\n## Generate Constraint-4:\nDue to labor regulations, the number of shifts cannot exceed 3 per day.\n// NumShifts <= 3\n\n## Generate Constraint-5:\nThe company has a policy to produce at least 10 units of product A and 20 units of product B per day.\n// ProdA >= 10\n// ProdB >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product and the number of shifts to operate in the factory to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit, cost of raw materials per unit, and storage cost per unit per day for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Storage Cost per Unit per Day |\n|---------|-----------------|----------------------------|-------------------------------|\n| A       | $50             | $20                        | $5                            |\n| B       | $70             | $30                        | $5                            |\n| C       | $60             | $25                        | $5                            |\n\nThe company has a budget of $5000 for raw materials per day. The factory has a maximum capacity of 1000 units per day for all products combined. The total storage space available is limited to 800 units. Due to labor regulations, the number of shifts cannot exceed 3 per day. The company has a policy to produce at least 10 units of product A and 20 units of product B per day. The labor cost per shift is $1000.\n\nPlease help the company to maximize the total daily profit, which is defined as the sum of the profits from each product minus the total labor cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=10) # production quantity of product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=20) # production quantity of product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_A = (50 - 20 - 5) * ProdA\nProfit_B = (70 - 30 - 5) * ProdB\nProfit_C = (60 - 25 - 5) * ProdC\nTotal_Labor_Cost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day for all products combined.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n# The company has a budget of $5000 for raw materials per day.\nmodel.addCons(20 * ProdA + 30 * ProdB + 25 * ProdC <= 5000)\n# The total storage space available is limited to 800 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 800)\n# Due to labor regulations, the number of shifts cannot exceed 3 per day.\nmodel.addCons(NumShifts <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1434,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wearables\": \"Wearables\", \"range\": \"Wearables >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company wants to maximize the total profit from selling these devices.\n// Profit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\n// Profit_Tablets = (150 - 0.05 * Tablets) * Tablets\n// Profit_Laptops = (200 - 0.08 * Laptops) * Laptops\n// Profit_Wearables = (50 - 0.03 * Wearables) * Wearables\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n// 5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\n// Smartphones <= 500; Tablets <= 300; Laptops <= 200; Wearables <= 400\n\n## Generate Constraint-3:\nThe company has a production capacity of 800 units in terms of the total number of devices it can produce.\n// Smartphones + Tablets + Laptops + Wearables <= 800",
        "question": "A manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints. The profit per unit of each device decreases as more units are produced, as shown in the following Table.\n\n| Device       | Profit per Unit | Decrease in Profit per Additional Unit |\n|--------------|-----------------|---------------------------------------|\n| Smartphones  | $100            | $0.1 per additional Smartphone        |\n| Tablets      | $150            | $0.05 per additional Tablet           |\n| Laptops      | $200            | $0.08 per additional Laptop           |\n| Wearables    | $50             | $0.03 per additional Wearable         |\n\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000. The market has a demand limit for each device: 500 units for Smartphones, 300 units for Tablets, 200 units for Laptops, and 400 units for Wearables. The company also has a production capacity of 800 units in terms of the total number of devices it can produce.\n\nPlease help the company to maximize the total profit from selling these devices, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0, ub=500)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0, ub=300)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0, ub=200)\nWearables = model.addVar(vtype=\"INTEGER\", name=\"Wearables\", lb=0, ub=400)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.05 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.08 * Laptops) * Laptops\nProfit_Wearables = (50 - 0.03 * Wearables) * Wearables\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices.\nmodel.addCons(5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000)\n## The market has a demand limit for each device.\nmodel.addCons(Smartphones <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Wearables <= 400)\n## The company has a production capacity of 800 units in terms of the total number of devices it can produce.\nmodel.addCons(Smartphones + Tablets + Laptops + Wearables <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Wearables: \", model.getVal(Wearables))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for Small trucks\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Medium trucks\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Large trucks\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Extra-Large trucks\": \"MaintenanceExtraLarge\", \"range\": \"MaintenanceExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n// Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n// Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n// Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n// Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Maximize (RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance. The revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n\n| Truck Type        | Cost of Truck | Maintenance Cost per Hour |\n|-------------------|---------------|---------------------------|\n| Small             | $50,000       | $100                      |\n| Medium            | $70,000       | $100                      |\n| Large             | $90,000       | $100                      |\n| Extra-Large       | $110,000      | $100                      |\n\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The total number of trucks cannot exceed 20. Please help the company determine the optimal number of each type of truck and the maintenance hours to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)  # maintenance hours for Small trucks\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)  # maintenance hours for Medium trucks\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)  # maintenance hours for Large trucks\nMaintenanceExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceExtraLarge\", lb=0)  # maintenance hours for Extra-Large trucks\n\n# Define objective function\n# Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n# Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n# Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n# Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\nRevenueSmall = (5000 + 0.02 * MaintenanceSmall) * SmallTrucks  # assuming BaseRevenueSmall = 5000\nRevenueMedium = (7000 + 0.03 * MaintenanceMedium) * MediumTrucks  # assuming BaseRevenueMedium = 7000\nRevenueLarge = (9000 + 0.04 * MaintenanceLarge) * LargeTrucks  # assuming BaseRevenueLarge = 9000\nRevenueExtraLarge = (11000 + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks  # assuming BaseRevenueExtraLarge = 11000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing new trucks and maintenance.\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000)\n# The total number of trucks cannot exceed 20.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Maintenance Hours for Small Trucks: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Hours for Medium Trucks: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Hours for Large Trucks: \", model.getVal(MaintenanceLarge))\n    print(\"Maintenance Hours for Extra-Large Trucks: \", model.getVal(MaintenanceExtraLarge))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities (City1, City2, City3, City4, City5) and the fuel efficiency of each truck, which can be improved with an investment in fuel-efficient technologies.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for each truck\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. The fuel efficiency of the trucks can be improved with an investment, reducing the fuel cost per trip. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company aims to maximize the total profit from all trips.\n// Profit per trip to City1: Profit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\n// Profit per trip to City2: Profit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\n// Profit per trip to City3: Profit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\n// Profit per trip to City4: Profit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\n// Profit per trip to City5: Profit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency investments.\n// EfficiencyInvestment <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n// Trips1 >= 50; Trips2 >= 75",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities: City1, City2, City3, City4, and City5. The company needs to determine the number of trips each truck should make to these cities and the investment in fuel efficiency for each truck. The base profit per trip and the impact of fuel efficiency investment on the profit are given in the following Table.\n\n| City | Base Profit per Trip | Impact of Fuel Efficiency Investment |\n|------|----------------------|--------------------------------------|\n| City1 | $100                | $10 decrease per $1000 invested     |\n| City2 | $150                | $10 decrease per $1000 invested     |\n| City3 | $200                | $10 decrease per $1000 invested     |\n| City4 | $250                | $10 decrease per $1000 invested     |\n| City5 | $300                | $10 decrease per $1000 invested     |\n\nThe company has a budget of $10,000 for fuel efficiency investments. The total number of trips across all cities must not exceed 500. Due to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n\nPlease help the company to maximize the total profit from all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)    # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)    # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)    # number of trips to City5\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in fuel efficiency\n\n# Define objective function\nProfit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\nProfit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\nProfit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\nProfit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\nProfit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 10000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"investment in landscaping\": \"Landscaping\", \"range\": \"Landscaping >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer aims to maximize the total value of all properties.\n// Value_LV = 500000 + 10 * Landscaping * LV\n// Value_MA = 300000 + 5 * Landscaping * MA\n// Value_AH = 150000 + 2 * Landscaping * AH\n// So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\n\n## Generate Constraint-1:\nThe developer has a budget of $1,000,000 for construction and landscaping.\n// 500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000\n\n## Generate Constraint-2:\nThe total area available for construction is limited to 100,000 square meters. Each Luxury Villa requires 1,000 square meters, each Mid-Range Apartment requires 500 square meters, and each Affordable Home requires 200 square meters.\n// 1000 * LV + 500 * MA + 200 * AH <= 100000\n\n## Generate Constraint-3:\nThe developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n// LV >= 5; MA >= 10\n\n## Generate Constraint-4:\nDue to market demand, the number of Affordable Homes cannot exceed 50.\n// AH <= 50\n\n## Generate Constraint-5:\nThe investment in landscaping cannot exceed 20% of the total construction budget.\n// Landscaping <= 0.2 * (500000 * LV + 300000 * MA + 150000 * AH)",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH), and invest in landscaping to enhance the property values. The developer needs to determine the number of each type of property to build and the amount of money to invest in landscaping. The value increase per $1,000 invested in landscaping for each type of property is given in the following Table.\n\n| Property Type | Initial Value per Unit | Value Increase per $1,000 Invested in Landscaping |\n|---------------|-------------------------|--------------------------------------------------|\n| Luxury Villas | $500,000                | $10,000                                          |\n| Mid-Range Apartments | $300,000          | $5,000                                           |\n| Affordable Homes | $150,000              | $2,000                                           |\n\nThe developer has a budget of $1,000,000 for construction and landscaping. The total area available for construction is limited to 100,000 square meters, with each Luxury Villa requiring 1,000 square meters, each Mid-Range Apartment requiring 500 square meters, and each Affordable Home requiring 200 square meters. The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments. Due to market demand, the number of Affordable Homes cannot exceed 50. The investment in landscaping cannot exceed 20% of the total construction budget.\n\nPlease help the developer maximize the total value of all properties.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=5)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0, ub=50)  # number of Affordable Homes\nLandscaping = model.addVar(vtype=\"CONTINUOUS\", name=\"Landscaping\", lb=0)  # investment in landscaping\n\n# Define objective function\nValue_LV = 500000 + 10 * Landscaping * LV\nValue_MA = 300000 + 5 * Landscaping * MA\nValue_AH = 150000 + 2 * Landscaping * AH\n# So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value_LV + Value_MA + Value_AH)\n\n# Add constraints\n# The developer has a budget of $1,000,000 for construction and landscaping.\nmodel.addCons(500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000)\n# The total area available for construction is limited to 100,000 square meters.\nmodel.addCons(1000 * LV + 500 * MA + 200 * AH <= 100000)\n# The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\nmodel.addCons(LV >= 5)\nmodel.addCons(MA >= 10)\n# Due to market demand, the number of Affordable Homes cannot exceed 50.\nmodel.addCons(AH <= 50)\n# The investment in landscaping cannot exceed 20% of the total construction budget.\nmodel.addCons(Landscaping <= 0.2 * (500000 * LV + 300000 * MA + 150000 * AH))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Investment in Landscaping: \", model.getVal(Landscaping))\n    print(\"Total Property Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1554,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and the initial efficiency of wind turbines is 30%. The cost of energy storage is $100 per unit, and the storage efficiency is 95%. The company aims to maximize the total energy output (in kWh) from the renewable energy system.\n// Energy_output_solar = 0.2 * (1 + 0.0001 * R) * S\n// Energy_output_wind = 0.3 * (1 + 0.00005 * R) * W\n// Energy_output_storage = 0.95 * E\n// So, the objective function is: Maximize (Energy_output_solar + Energy_output_wind + Energy_output_storage)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of a solar panel is $500, a wind turbine is $1,000, and energy storage is $100 per unit.\n// 500 * S + 1000 * W + 100 * E <= 1000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $100,000.\n// R <= 100000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), the amount of energy storage (E), and the investment in research and development (R) to maximize the efficiency of the renewable energy system. The efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and the initial efficiency of wind turbines is 30%. The cost of energy storage is $100 per unit, and the storage efficiency is 95%. The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of a solar panel is $500, a wind turbine is $1,000, and energy storage is $100 per unit. The total investment in R&D cannot exceed $100,000. Please help the company to maximize the total energy output (in kWh) from the renewable energy system.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # amount of energy storage\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # investment in R&D\n\n# Define objective function\nEnergy_output_solar = 0.2 * (1 + 0.0001 * R) * S\nEnergy_output_wind = 0.3 * (1 + 0.00005 * R) * W\nEnergy_output_storage = 0.95 * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Energy_output_solar + Energy_output_wind + Energy_output_storage)\nmodel.addCons(obj == Energy_output_solar + Energy_output_wind + Energy_output_storage)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage.\nmodel.addCons(500 * S + 1000 * W + 100 * E <= 1000000)\n## The total investment in R&D cannot exceed $100,000.\nmodel.addCons(R <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Investment in R&D: \", model.getVal(R))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover.\n// {\"number of refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of dry goods trucks\": \"DryGoodsTrucks\", \"range\": \"DryGoodsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average daily distance for refrigerated trucks\": \"RefrigeratedDistance\", \"range\": \"RefrigeratedDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for dry goods trucks\": \"DryGoodsDistance\", \"range\": \"DryGoodsDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for hazardous material trucks\": \"HazardousDistance\", \"range\": \"HazardousDistance >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company wants to maximize the net profit from the fleet expansion.\n// OperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\n// OperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\n// OperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\n// Revenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\n// Revenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\n// Revenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n// So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for the initial purchase of new trucks.\n// RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover. The cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company wants to maximize the net profit from the fleet expansion. The company has a budget of $10,000 for the initial purchase of new trucks.\n\nPlease help the company to maximize the net profit from the fleet expansion, which is defined as the sum of the revenues from all types of trucks minus the sum of the operating costs for all types of trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nDryGoodsTrucks = model.addVar(vtype=\"INTEGER\", name=\"DryGoodsTrucks\", lb=0)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)\nRefrigeratedDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"RefrigeratedDistance\", lb=0)\nDryGoodsDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DryGoodsDistance\", lb=0)\nHazardousDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousDistance\", lb=0)\n\n# Define objective function\nOperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\nOperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\nOperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\nRevenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\nRevenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\nRevenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\nmodel.addCons(obj == (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous))\n\n# Add constraints\n# The company has a budget of $10,000 for the initial purchase of new trucks.\nmodel.addCons(RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Dry Goods Trucks: \", model.getVal(DryGoodsTrucks))\n    print(\"Number of Hazardous Material Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Average Daily Distance for Refrigerated Trucks: \", model.getVal(RefrigeratedDistance))\n    print(\"Average Daily Distance for Dry Goods Trucks: \", model.getVal(DryGoodsDistance))\n    print(\"Average Daily Distance for Hazardous Material Trucks: \", model.getVal(HazardousDistance))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is optimizing its fleet of trucks to transport goods across different regions. The company needs to determine the number of small, medium, and large trucks to purchase, as well as the number of drivers to hire for each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for small trucks\": \"SmallDrivers\", \"range\": \"SmallDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for medium trucks\": \"MediumDrivers\", \"range\": \"MediumDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for large trucks\": \"LargeDrivers\", \"range\": \"LargeDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing a small truck is $50,000, a medium truck is $75,000, and a large truck is $100,000. The operating cost per mile for a small truck is $0.50, a medium truck is $0.70, and a large truck is $1.00. The revenue per mile for a small truck is $1.00, a medium truck is $1.50, and a large truck is $2.00. The company wants to maximize the total net profit per mile considering both the purchase and operating costs.\n// Total cost for small trucks: Cost_Small = 50,000 * SmallTrucks + 0.50 * SmallDrivers\n// Total cost for medium trucks: Cost_Medium = 75,000 * MediumTrucks + 0.70 * MediumDrivers\n// Total cost for large trucks: Cost_Large = 100,000 * LargeTrucks + 1.00 * LargeDrivers\n// Total revenue for small trucks: Revenue_Small = 1.00 * SmallDrivers\n// Total revenue for medium trucks: Revenue_Medium = 1.50 * MediumDrivers\n// Total revenue for large trucks: Revenue_Large = 2.00 * LargeDrivers\n// So, the objective function is: Maximize ((Revenue_Small - Cost_Small) + (Revenue_Medium - Cost_Medium) + (Revenue_Large - Cost_Large))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks <= 1,000,000\n\n## Generate Constraint-2:\nThe company can hire a maximum of 50 drivers.\n// SmallDrivers + MediumDrivers + LargeDrivers <= 50",
        "question": "A logistics company is optimizing its fleet of trucks to transport goods across different regions. The company needs to determine the number of small, medium, and large trucks to purchase, as well as the number of drivers to hire for each type of truck. The cost of purchasing a small truck is $50,000, a medium truck is $75,000, and a large truck is $100,000. The operating cost per mile for a small truck is $0.50, a medium truck is $0.70, and a large truck is $1.00. The revenue per mile for a small truck is $1.00, a medium truck is $1.50, and a large truck is $2.00. The company has a budget of $1,000,000 for purchasing trucks and can hire a maximum of 50 drivers. The company wants to maximize the total net profit per mile considering both the purchase and operating costs. Please help the company to determine the optimal number of each type of truck and drivers to maximize their net profit per mile.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallDrivers = model.addVar(vtype=\"INTEGER\", name=\"SmallDrivers\", lb=0)\nMediumDrivers = model.addVar(vtype=\"INTEGER\", name=\"MediumDrivers\", lb=0)\nLargeDrivers = model.addVar(vtype=\"INTEGER\", name=\"LargeDrivers\", lb=0)\n\n# Define objective function\nCost_Small = 50000 * SmallTrucks + 0.50 * SmallDrivers\nCost_Medium = 75000 * MediumTrucks + 0.70 * MediumDrivers\nCost_Large = 100000 * LargeTrucks + 1.00 * LargeDrivers\nRevenue_Small = 1.00 * SmallDrivers\nRevenue_Medium = 1.50 * MediumDrivers\nRevenue_Large = 2.00 * LargeDrivers\n# Objective function: Maximize ((Revenue_Small - Cost_Small) + (Revenue_Medium - Cost_Medium) + (Revenue_Large - Cost_Large))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_Small - Cost_Small) + (Revenue_Medium - Cost_Medium) + (Revenue_Large - Cost_Large))\n\n# Add constraints\n# The company has a budget of $1,000,000 for purchasing trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n# The company can hire a maximum of 50 drivers.\nmodel.addCons(SmallDrivers + MediumDrivers + LargeDrivers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers for Small Trucks: \", model.getVal(SmallDrivers))\n    print(\"Number of Drivers for Medium Trucks: \", model.getVal(MediumDrivers))\n    print(\"Number of Drivers for Large Trucks: \", model.getVal(LargeDrivers))\n    print(\"Maximized Net Profit per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the level of investment in green technology for each vehicle type to reduce emissions and improve fuel efficiency.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for TruckA\": \"GreenTechA\", \"range\": \"GreenTechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckB\": \"GreenTechB\", \"range\": \"GreenTechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckC\": \"GreenTechC\", \"range\": \"GreenTechC >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for TruckD\": \"GreenTechD\", \"range\": \"GreenTechD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the investment in green technology. For every $1000 invested in green technology, the fuel efficiency of TruckA increases by 1%, TruckB by 1.5%, TruckC by 2%, and TruckD by 2.5%. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for TruckA: FuelCostA = (BaseFuelCostA * (1 - 0.001 * GreenTechA)) * TruckA\n// Fuel cost for TruckB: FuelCostB = (BaseFuelCostB * (1 - 0.0015 * GreenTechB)) * TruckB\n// Fuel cost for TruckC: FuelCostC = (BaseFuelCostC * (1 - 0.002 * GreenTechC)) * TruckC\n// Fuel cost for TruckD: FuelCostD = (BaseFuelCostD * (1 - 0.0025 * GreenTechD)) * TruckD\n// Maintenance cost for all trucks: MaintenanceCost = (MaintenanceCostA * TruckA) + (MaintenanceCostB * TruckB) + (MaintenanceCostC * TruckC) + (MaintenanceCostD * TruckD)\n// Total operational cost: OperationalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for vehicle acquisition and green technology investments.\n// TruckA + TruckB + TruckC + TruckD + GreenTechA + GreenTechB + GreenTechC + GreenTechD <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks must not exceed 100.\n// TruckA + TruckB + TruckC + TruckD <= 100",
        "question": "A logistics company is planning its fleet for the next quarter and operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the level of investment in green technology for each vehicle type to reduce emissions and improve fuel efficiency. The fuel efficiency of each truck type improves with the investment in green technology. For every $1000 invested in green technology, the fuel efficiency of TruckA increases by 1%, TruckB by 1.5%, TruckC by 2%, and TruckD by 2.5%. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The company has a budget of $200,000 for vehicle acquisition and green technology investments. The total number of trucks must not exceed 100.\n\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nGreenTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechA\", lb=0) # investment in green technology for TruckA\nGreenTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechB\", lb=0) # investment in green technology for TruckB\nGreenTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechC\", lb=0) # investment in green technology for TruckC\nGreenTechD = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechD\", lb=0) # investment in green technology for TruckD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nBaseFuelCostA = 100  # Example base fuel cost for TruckA\nBaseFuelCostB = 120  # Example base fuel cost for TruckB\nBaseFuelCostC = 150  # Example base fuel cost for TruckC\nBaseFuelCostD = 200  # Example base fuel cost for TruckD\nMaintenanceCostA = 500  # Example maintenance cost for TruckA\nMaintenanceCostB = 600  # Example maintenance cost for TruckB\nMaintenanceCostC = 700  # Example maintenance cost for TruckC\nMaintenanceCostD = 800  # Example maintenance cost for TruckD\n\nFuelCostA = (BaseFuelCostA * (1 - 0.001 * GreenTechA)) * TruckA\nFuelCostB = (BaseFuelCostB * (1 - 0.0015 * GreenTechB)) * TruckB\nFuelCostC = (BaseFuelCostC * (1 - 0.002 * GreenTechC)) * TruckC\nFuelCostD = (BaseFuelCostD * (1 - 0.0025 * GreenTechD)) * TruckD\nMaintenanceCost = (MaintenanceCostA * TruckA) + (MaintenanceCostB * TruckB) + (MaintenanceCostC * TruckC) + (MaintenanceCostD * TruckD)\nOperationalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The company has a budget of $200,000 for vehicle acquisition and green technology investments.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + GreenTechA + GreenTechB + GreenTechC + GreenTechD <= 200000)\n## The total number of trucks must not exceed 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Investment in GreenTechA: \", model.getVal(GreenTechA))\n    print(\"Investment in GreenTechB: \", model.getVal(GreenTechB))\n    print(\"Investment in GreenTechC: \", model.getVal(GreenTechC))\n    print(\"Investment in GreenTechD: \", model.getVal(GreenTechD))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is inversely proportional to the square of its speed. The faster a truck travels, the less fuel it consumes per kilometer, but the more it costs in terms of maintenance and wear. The revenue per route is directly proportional to the number of trucks used. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs.\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1500 * Trucks2\n// Revenue_Route3 = 2000 * Trucks3\n// FuelCost_Route1 = (1 / (Speed1^2)) * Trucks1\n// FuelCost_Route2 = (1 / (Speed2^2)) * Trucks2\n// FuelCost_Route3 = (1 / (Speed3^2)) * Trucks3\n// MaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\n// MaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\n// MaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 + Revenue_Route2 + Revenue_Route3) - (FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel and maintenance costs.\n// (1 / (Speed1^2)) * Trucks1 + (1 / (Speed2^2)) * Trucks2 + (1 / (Speed3^2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs. The following table summarizes the revenue per route and the relationship between speed and fuel cost.\n\n| Route | Revenue per Truck | Speed Range |\n|-------|-------------------|-------------|\n| 1     | 1000$             | 0 < Speed1 <= 60 |\n| 2     | 1500$             | 0 < Speed2 <= 60 |\n| 3     | 2000$             | 0 < Speed3 <= 60 |\n\nThe fuel cost per kilometer for each truck is inversely proportional to the square of its speed. The faster a truck travels, the less fuel it consumes per kilometer, but the more it costs in terms of maintenance and wear. The company has a total budget of $100,000 for fuel and maintenance costs. The total number of trucks available is limited to 100.\n\nPlease help the company determine the optimal number of trucks and their speeds for each route to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0.01, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0.01, ub=60)  # speed of trucks for Route2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0.01, ub=60)  # speed of trucks for Route3\n\n# Define objective function\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1500 * Trucks2\nRevenue_Route3 = 2000 * Trucks3\nFuelCost_Route1 = (1 / (Speed1**2)) * Trucks1\nFuelCost_Route2 = (1 / (Speed2**2)) * Trucks2\nFuelCost_Route3 = (1 / (Speed3**2)) * Trucks3\nMaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\nMaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\nMaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\n# So, the objective function is: Maximize (Revenue_Route1 + Revenue_Route2 + Revenue_Route3) - (FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Route1 + Revenue_Route2 + Revenue_Route3 - FuelCost_Route1 - FuelCost_Route2 - FuelCost_Route3 - MaintenanceCost_Route1 - MaintenanceCost_Route2 - MaintenanceCost_Route3)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel and maintenance costs.\nmodel.addCons((1 / (Speed1**2)) * Trucks1 + (1 / (Speed2**2)) * Trucks2 + (1 / (Speed3**2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000)\n# The total number of trucks available is limited to 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks for Route3: \", model.getVal(Speed3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Truck A is $20, for Truck B is $30, and for Truck C is $40. The company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The objective function is to minimize the total operational cost, which is given by:\n// Operational cost of A: Cost_A = 20 * A\n// Operational cost of B: Cost_B = 30 * B\n// Operational cost of C: Cost_C = 40 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\n// Capacity of A: 100 * A\n// Capacity of B: 200 * B\n// Capacity of C: 300 * C\n// Constraint: 100 * A + 200 * B + 300 * C >= 5000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for purchasing new trucks.\n// Cost of A: 1000 * A\n// Cost of B: 2000 * B\n// Cost of C: 3000 * C\n// Constraint: 1000 * A + 2000 * B + 3000 * C <= 10000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 20 trucks in total.\n// Constraint: A + B + C <= 20\n\n## Generate Constraint-4:\nThe number of Truck C cannot exceed the combined number of Trucks A and B.\n// Constraint: C <= A + B\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck B is at least half the number of Truck A.\n// Constraint: B >= 0.5 * A",
        "question": "A logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities, operational costs, and purchase costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations. The details of each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per Kilometer | Capacity (cubic meters) | Purchase Cost |\n|------------|--------------------------------|-------------------------|---------------|\n| A          | $20                             | 100                     | $1000         |\n| B          | $30                             | 200                     | $2000         |\n| C          | $40                             | 300                     | $3000         |\n\nThe company has a budget constraint of $10,000 for purchasing new trucks. The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters. The company can only operate a maximum of 20 trucks in total. The number of Truck C cannot exceed the combined number of Trucks A and B. The company wants to ensure that the number of Truck B is at least half the number of Truck A.\n\nPlease help the company to minimize the total operational cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\nmodel.addCons(100 * A + 200 * B + 300 * C >= 5000)\n## The company has a budget constraint of $10,000 for purchasing new trucks.\nmodel.addCons(1000 * A + 2000 * B + 3000 * C <= 10000)\n## The company can only operate a maximum of 20 trucks in total.\nmodel.addCons(A + B + C <= 20)\n## The number of Truck C cannot exceed the combined number of Trucks A and B.\nmodel.addCons(C <= A + B)\n## The company wants to ensure that the number of Truck B is at least half the number of Truck A.\nmodel.addCons(B >= 0.5 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1314,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Type1 trucks\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Type1 trucks\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type2 trucks\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type3 trucks\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n// Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n// Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n// Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 500.\n// Truck1 + Truck2 + Truck3 <= 500\n\n## Generate Constraint-3:\nAt least 100 Type1 trucks and 150 Type2 trucks must be purchased.\n// Truck1 >= 100; Truck2 >= 150\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for each type of truck must not exceed the cost of purchasing 50 trucks of that type.\n// Efficiency1 <= 50 * Truck1\n// Efficiency2 <= 50 * Truck2\n// Efficiency3 <= 50 * Truck3",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n\n| Type of Truck | Fuel Cost per Mile | Fuel Efficiency Improvement per $1000 |\n|---------------|--------------------|--------------------------------------|\n| Type1         | $0.8               | 1.5%                                 |\n| Type2         | $0.7               | 2%                                   |\n| Type3         | $0.6               | 1%                                   |\n\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks in the fleet must not exceed 500. At least 100 Type1 trucks and 150 Type2 trucks must be purchased. The investment in fuel efficiency for each type of truck must not exceed the cost of purchasing 50 trucks of that type.\n\nPlease help the company to determine the optimal number of trucks to purchase and the investment in fuel efficiency to minimize the total fuel cost for the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=100)  # number of Type1 trucks\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=150)  # number of Type2 trucks\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)  # number of Type3 trucks\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Type1 trucks\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Type2 trucks\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Type3 trucks\n\n# Define objective function\nCost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\nCost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\nCost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000)\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 500)\nmodel.addCons(Truck1 >= 100)\nmodel.addCons(Truck2 >= 150)\nmodel.addCons(Efficiency1 <= 50 * Truck1)\nmodel.addCons(Efficiency2 <= 50 * Truck2)\nmodel.addCons(Efficiency3 <= 50 * Truck3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(Truck1))\n    print(\"Number of Type2 Trucks: \", model.getVal(Truck2))\n    print(\"Number of Type3 Trucks: \", model.getVal(Truck3))\n    print(\"Investment in Fuel Efficiency for Type1 Trucks: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Type2 Trucks: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Type3 Trucks: \", model.getVal(Efficiency3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1485,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n// Total net profit for RegionA: Profit_A = (100,000 - 50,000) * TrucksA\n// Total net profit for RegionB: Profit_B = (120,000 - 60,000) * TrucksB\n// Total net profit for RegionC: Profit_C = (140,000 - 70,000) * TrucksC\n// Total net profit for RegionD: Profit_D = (160,000 - 80,000) * TrucksD\n// Total net profit for RegionE: Profit_E = (180,000 - 90,000) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regional regulations, RegionA must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs. The cost of operating a truck and the revenue generated per truck in each region are given in the following Table.\n\n| Region   | Operating Cost | Revenue per Truck |\n|----------|----------------|-------------------|\n| RegionA  | $50,000        | $100,000          |\n| RegionB  | $60,000        | $120,000          |\n| RegionC  | $70,000        | $140,000          |\n| RegionD  | $80,000        | $160,000          |\n| RegionE  | $90,000        | $180,000          |\n\nThe company has a total of 40 trucks available for allocation. Due to regional regulations, RegionA must have at least 10% of the total trucks. The company wants to maximize the net profit per truck. Please help the company determine the optimal allocation of trucks to each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100000 - 50000) * TrucksA\nProfit_B = (120000 - 60000) * TrucksB\nProfit_C = (140000 - 70000) * TrucksC\nProfit_D = (160000 - 80000) * TrucksD\nProfit_E = (180000 - 90000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regional regulations, RegionA must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in warehouse upgrades\": \"WarehouseInvestment\", \"range\": \"WarehouseInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of the trucks and the warehouse is affected by the warehouse upgrades. For each $1,000 invested in warehouse upgrades, the operational cost per truck decreases by $100. \nThe operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for both truck purchases and warehouse upgrades.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-3:\nThe company must purchase at least 10 Small trucks and 20 Medium trucks.\n// SmallTrucks >= 10; MediumTrucks >= 20\n\n## Generate Constraint-4:\nThe investment in warehouse upgrades must not exceed 20% of the total budget.\n// WarehouseInvestment <= 0.2 * 1000000",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs. The operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. For each $1,000 invested in warehouse upgrades, the operational cost per truck decreases by $100.\n\nThe company has a budget of $1,000,000 for both truck purchases and warehouse upgrades. The total number of trucks cannot exceed 100. The company must purchase at least 10 Small trucks and 20 Medium trucks. The investment in warehouse upgrades must not exceed 20% of the total budget.\n\nPlease help the company to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=10)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=20)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nWarehouseInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WarehouseInvestment\", lb=0)  # investment in warehouse upgrades\n\n# Define objective function\nCostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\nCostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\nCostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\nmodel.addCons(WarehouseInvestment <= 0.2 * 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Warehouse Investment: \", model.getVal(WarehouseInvestment))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 691,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel.\n// {\"number of trucks for Route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route 1: Fuel1 = 0.002 * Speed1^2 * Trucks1 * Distance1\n// Fuel consumption for Route 2: Fuel2 = 0.003 * Speed2^2 * Trucks2 * Distance2\n// Fuel consumption for Route 3: Fuel3 = 0.004 * Speed3^2 * Trucks3 * Distance3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe total number of trucks available for all routes is 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by all trucks should not exceed 10,000 kilometers.\n// Speed1 * Trucks1 * Distance1 + Speed2 * Trucks2 * Distance2 + Speed3 * Trucks3 * Distance3 <= 10000\n\n## Generate Constraint-3:\nDue to maintenance schedules, at least 10 trucks must be assigned to Route 1.\n// Trucks1 >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes. The total number of trucks available for all routes is 50. The total distance that can be covered by all trucks should not exceed 10,000 kilometers. Due to maintenance schedules, at least 10 trucks must be assigned to Route 1. Please help the company determine the optimal number of trucks and their speeds for each route to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)   # number of trucks for Route 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)   # number of trucks for Route 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=60)  # speed of trucks on Route 3\n\n# Define objective function\nFuel1 = 0.002 * Speed1**2 * Trucks1 * model.addVar(name=\"Distance1\")  # Fuel consumption for Route 1\nFuel2 = 0.003 * Speed2**2 * Trucks2 * model.addVar(name=\"Distance2\")  # Fuel consumption for Route 2\nFuel3 = 0.004 * Speed3**2 * Trucks3 * model.addVar(name=\"Distance3\")  # Fuel consumption for Route 3\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)  # Objective function\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)  # Total number of trucks available\nmodel.addCons(Speed1 * Trucks1 * model.addVar(name=\"Distance1\") + \n              Speed2 * Trucks2 * model.addVar(name=\"Distance2\") + \n              Speed3 * Trucks3 * model.addVar(name=\"Distance3\") <= 10000)  # Total distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks on Route 1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route 2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks on Route 3: \", model.getVal(Speed3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct.\n// {\"number of CondoA\": \"CondoA\", \"range\": \"CondoA >= 0\", \"type\": \"integer\"}\n// {\"number of CondoB\": \"CondoB\", \"range\": \"CondoB >= 0\", \"type\": \"integer\"}\n// {\"number of HouseC\": \"HouseC\", \"range\": \"HouseC >= 0\", \"type\": \"integer\"}\n// {\"number of HouseD\": \"HouseD\", \"range\": \"HouseD >= 0\", \"type\": \"integer\"}\n// {\"number of VillaE\": \"VillaE\", \"range\": \"VillaE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoA, the profit per unit is $100,000, the construction cost per unit is $70,000, and the land cost per unit is $20,000. \nFor CondoB, the profit per unit is $120,000, the construction cost per unit is $80,000, and the land cost per unit is $25,000. \nFor HouseC, the profit per unit is $150,000, the construction cost per unit is $100,000, and the land cost per unit is $30,000.\nFor HouseD, the profit per unit is $180,000, the construction cost per unit is $110,000, and the land cost per unit is $35,000.\nFor VillaE, the profit per unit is $200,000, the construction cost per unit is $120,000, and the land cost per unit is $40,000.\nThe developer wants to maximize the total profit while considering the efficiency of land use (profit per unit of land).\n// Profit_CondoA = (100,000 - 70,000 - 20,000) * CondoA\n// Profit_CondoB = (120,000 - 80,000 - 25,000) * CondoB\n// Profit_HouseC = (150,000 - 100,000 - 30,000) * HouseC\n// Profit_HouseD = (180,000 - 110,000 - 35,000) * HouseD\n// Profit_VillaE = (200,000 - 120,000 - 40,000) * VillaE\n// So, the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / (20,000 * CondoA + 25,000 * CondoB + 30,000 * HouseC + 35,000 * HouseD + 40,000 * VillaE)\n\n## Generate Constraint-1:\nThe developer has a total budget of $5,000,000 for construction costs.\n// 70,000 * CondoA + 80,000 * CondoB + 100,000 * HouseC + 110,000 * HouseD + 120,000 * VillaE <= 5,000,000\n\n## Generate Constraint-2:\nThe developer has a limited amount of land available, which can accommodate a maximum of 100 units.\n// CondoA + CondoB + HouseC + HouseD + VillaE <= 100\n\n## Generate Constraint-3:\nDue to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units.\n// CondoA <= 2 * CondoB\n\n## Generate Constraint-4:\nThe developer has a minimum requirement to build at least 5 units of each type of property.\n// CondoA >= 5; CondoB >= 5; HouseC >= 5; HouseD >= 5; VillaE >= 5",
        "question": "A real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct. The profit per unit, construction cost per unit, and land cost per unit for each type of property are given in the following Table.\n\n| Property Type | Profit per Unit | Construction Cost per Unit | Land Cost per Unit |\n|---------------|-----------------|----------------------------|--------------------|\n| CondoA        | $100,000        | $70,000                    | $20,000            |\n| CondoB        | $120,000        | $80,000                    | $25,000            |\n| HouseC        | $150,000        | $100,000                   | $30,000            |\n| HouseD        | $180,000        | $110,000                   | $35,000            |\n| VillaE        | $200,000        | $120,000                   | $40,000            |\n\nThe developer has a total budget of $5,000,000 for construction costs. The developer has a limited amount of land available, which can accommodate a maximum of 100 units. Due to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units. The developer has a minimum requirement to build at least 5 units of each type of property.\n\nPlease help the developer to maximize the total profit while considering the efficiency of land use (profit per unit of land).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCondoA = model.addVar(vtype=\"INTEGER\", name=\"CondoA\", lb=5)  # number of CondoA\nCondoB = model.addVar(vtype=\"INTEGER\", name=\"CondoB\", lb=5)  # number of CondoB\nHouseC = model.addVar(vtype=\"INTEGER\", name=\"HouseC\", lb=5)  # number of HouseC\nHouseD = model.addVar(vtype=\"INTEGER\", name=\"HouseD\", lb=5)  # number of HouseD\nVillaE = model.addVar(vtype=\"INTEGER\", name=\"VillaE\", lb=5)  # number of VillaE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoA = (100000 - 70000 - 20000) * CondoA\nProfit_CondoB = (120000 - 80000 - 25000) * CondoB\nProfit_HouseC = (150000 - 100000 - 30000) * HouseC\nProfit_HouseD = (180000 - 110000 - 35000) * HouseD\nProfit_VillaE = (200000 - 120000 - 40000) * VillaE\nLandCost = 20000 * CondoA + 25000 * CondoB + 30000 * HouseC + 35000 * HouseD + 40000 * VillaE\n## the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / LandCost\n## convert the division to multiplication\nmodel.addCons(obj * LandCost == Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE)\n\n# Add constraints\n## The developer has a total budget of $5,000,000 for construction costs.\nmodel.addCons(70000 * CondoA + 80000 * CondoB + 100000 * HouseC + 110000 * HouseD + 120000 * VillaE <= 5000000)\n## The developer has a limited amount of land available, which can accommodate a maximum of 100 units.\nmodel.addCons(CondoA + CondoB + HouseC + HouseD + VillaE <= 100)\n## Due to zoning regulations, the number of CondoA units must not exceed twice the number of CondoB units.\nmodel.addCons(CondoA <= 2 * CondoB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoA: \", model.getVal(CondoA))\n    print(\"Number of CondoB: \", model.getVal(CondoB))\n    print(\"Number of HouseC: \", model.getVal(HouseC))\n    print(\"Number of HouseD: \", model.getVal(HouseD))\n    print(\"Number of VillaE: \", model.getVal(VillaE))\n    print(\"Maximized Profit per Unit of Land: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost includes fuel cost and depreciation cost. The fuel cost is directly proportional to the amount of fuel purchased and the speed of the trucks. The depreciation cost increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes.\n// Fuel cost for Route1: FuelCost1 = Fuel1 * Speed1\n// Fuel cost for Route2: FuelCost2 = Fuel2 * Speed2\n// Depreciation cost for Route1: Depreciation1 = 0.01 * Speed1^2 * Trucks1\n// Depreciation cost for Route2: Depreciation2 = 0.01 * Speed2^2 * Trucks2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n## Generate Constraint-1:\nThe total budget for fuel purchases is $10,000.\n// Fuel1 + Fuel2 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks. The operational cost includes fuel cost, which is directly proportional to the amount of fuel purchased and the speed of the trucks, and depreciation cost, which increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes. The total budget for fuel purchases is $10,000, and the total number of trucks available is 50. Please help the company determine the optimal number of trucks, their speeds, and the amount of fuel to purchase to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel purchased for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel purchased for Route2\n\n# Define objective function\nFuelCost1 = Fuel1 * Speed1\nFuelCost2 = Fuel2 * Speed2\nDepreciation1 = 0.01 * Speed1**2 * Trucks1\nDepreciation2 = 0.01 * Speed2**2 * Trucks2\n# So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n# Add constraints\n# The total budget for fuel purchases is $10,000.\nmodel.addCons(Fuel1 + Fuel2 <= 10000)\n# The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Fuel Purchased for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Purchased for Route2: \", model.getVal(Fuel2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using two raw materials (X and Y). The production process involves mixing different proportions of raw materials to produce each product. The manufacturer needs to determine the optimal quantities of products to maximize profit while considering the availability of raw materials and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material X\": \"RawMaterialX\", \"range\": \"RawMaterialX >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Y\": \"RawMaterialY\", \"range\": \"RawMaterialY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe production of product A requires 2 units of raw material X and 1 unit of raw material Y. Product B requires 1 unit of X and 3 units of Y. Product C requires 4 units of X and 2 units of Y. The total available quantities of raw materials X and Y are 100 and 120 units, respectively.\n// 2 * ProductA + 1 * ProductB + 4 * ProductC <= 100 (for RawMaterialX)\n// 1 * ProductA + 3 * ProductB + 2 * ProductC <= 120 (for RawMaterialY)\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 20\n\n## Generate Constraint-3:\nThe manufacturer has a storage capacity limit of 50 units for all products combined.\n// ProductA + ProductB + ProductC <= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that at least 30% of the total production is of product B.\n// ProductB >= 0.3 * (ProductA + ProductB + ProductC)",
        "question": "A manufacturer produces three types of products (A, B, and C) using two raw materials (X and Y). The production process involves mixing different proportions of raw materials to produce each product. The manufacturer needs to determine the optimal quantities of products to maximize profit while considering the availability of raw materials and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The following table summarizes the raw material requirements for each product.\n\n| Product | Raw Material X | Raw Material Y |\n|---------|----------------|----------------|\n| A       | 2 units        | 1 unit         |\n| B       | 1 unit         | 3 units        |\n| C       | 4 units        | 2 units        |\n\nThe total available quantities of raw materials X and Y are 100 and 120 units, respectively. The market demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units. The manufacturer has a storage capacity limit of 50 units for all products combined. The manufacturer wants to ensure that at least 30% of the total production is of product B.\n\nPlease help the manufacturer to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of product C\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint-1: Raw material availability\nmodel.addCons(2 * ProductA + 1 * ProductB + 4 * ProductC <= 100)  # for RawMaterialX\nmodel.addCons(1 * ProductA + 3 * ProductB + 2 * ProductC <= 120)  # for RawMaterialY\n\n# Constraint-2: Market demand\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 15)\nmodel.addCons(ProductC >= 20)\n\n# Constraint-3: Storage capacity\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\n\n# Constraint-4: Product B proportion\nmodel.addCons(ProductB >= 0.3 * (ProductA + ProductB + ProductC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\n// Profit_ProductA = ProductAQty * 50 - WorkersA * 100\n// Profit_ProductB = ProductBQty * 70 - WorkersB * 100\n// Profit_ProductC = ProductCQty * 60 - WorkersC * 100\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company has a total of 50 workers available and the production capacity for each product is limited as shown in the following table:\n\n| Product | Profit per Unit | Production Capacity |\n|---------|-----------------|---------------------|\n| ProductA | $50             | 100 units           |\n| ProductB | $70             | 150 units           |\n| ProductC | $60             | 120 units           |\n\nThe company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs. Please help the company optimize its production strategy by determining the optimal number of workers and production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - WorkersA * 100\nProfit_ProductB = ProductBQty * 70 - WorkersB * 100\nProfit_ProductC = ProductCQty * 60 - WorkersC * 100\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n# The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is affected by the fuel efficiency upgrades. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for RouteA: CostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\n// Fuel cost for RouteB: CostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\n// Fuel cost for RouteC: CostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades and truck purchases.\n// 2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes must not exceed 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB.\n// TrucksA >= 10; TrucksB >= 20",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement. The cost of fuel per kilometer is affected by the fuel efficiency upgrades. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes. The company has a budget of $100,000 for fuel efficiency upgrades and truck purchases. The total number of trucks available for all routes must not exceed 100. Due to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB. Please help the company to determine the optimal number of trucks and fuel efficiency upgrades to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=20)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)    # number of trucks for RouteC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # fuel efficiency upgrade for RouteA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # fuel efficiency upgrade for RouteB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # fuel efficiency upgrade for RouteC\n\n# Define objective function\nCostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\nCostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\nCostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Fuel Efficiency Upgrade for RouteA: \", model.getVal(UpgradeA))\n    print(\"Fuel Efficiency Upgrade for RouteB: \", model.getVal(UpgradeB))\n    print(\"Fuel Efficiency Upgrade for RouteC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company aims to maximize the total profit, considering both the selling profit and the storage costs over a week.\n// Selling profit of A: Profit_A = (50 - 20) * A - A\n// Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n// Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n// Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 5000",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin. The selling price, production cost, and storage cost per unit per week for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Storage Cost per Unit per Week |\n|--------|---------------|-----------------|--------------------------------|\n| A      | $50           | $20             | $1                             |\n| B      | $70           | $30             | $2                             |\n| C      | $90           | $40             | $3                             |\n| D      | $110          | $50             | $4                             |\n\nThe company has a budget of $5000 for production costs. The company aims to maximize the total profit, considering both the selling profit and the storage costs over a week. Please help the company determine the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\n## Selling profit of A: Profit_A = (50 - 20) * A - A\n## Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n## Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n## Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\nProfit_A = (50 - 20 - 1) * A\nProfit_B = (70 - 30 - 2) * B\nProfit_C = (90 - 40 - 3) * C\nProfit_D = (110 - 50 - 4) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The decision variables include the number of trucks assigned to each route.\n// {\"number of trucks on Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different profit per truck, fuel cost per truck, and toll fee per truck. The company aims to maximize the total profit, which is the difference between the revenue and the total costs (fuel and tolls).\n// Profit_A = Revenue_A - (FuelCost_A + TollFee_A) * Trucks_A\n// Profit_B = Revenue_B - (FuelCost_B + TollFee_B) * Trucks_B\n// Profit_C = Revenue_C - (FuelCost_C + TollFee_C) * Trucks_C\n// Profit_D = Revenue_D - (FuelCost_D + TollFee_D) * Trucks_D\n// Profit_E = Revenue_E - (FuelCost_E + TollFee_E) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nThe total fuel cost across all routes must not exceed $10,000.\n// FuelCost_A * Trucks_A + FuelCost_B * Trucks_B + FuelCost_C * Trucks_C + FuelCost_D * Trucks_D + FuelCost_E * Trucks_E <= 10000\n\n## Generate Constraint-3:\nThe total toll fees across all routes must not exceed $5,000.\n// TollFee_A * Trucks_A + TollFee_B * Trucks_B + TollFee_C * Trucks_C + TollFee_D * Trucks_D + TollFee_E * Trucks_E <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the trucks are allocated to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The decision variables include the number of trucks assigned to each route. Each route has a different profit per truck, fuel cost per truck, and toll fee per truck. The company aims to maximize the total profit, which is the difference between the revenue and the total costs (fuel and tolls). The company has a total of 50 trucks available. The total fuel cost across all routes must not exceed $10,000. The total toll fees across all routes must not exceed $5,000. The company wants to ensure that at least 10% of the trucks are allocated to Route A. Please help the company determine the optimal number of trucks to assign to each route to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0)\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0)\n\n# Define objective function\nRevenue_A = model.addVar(name=\"Revenue_A\")\nFuelCost_A = model.addVar(name=\"FuelCost_A\")\nTollFee_A = model.addVar(name=\"TollFee_A\")\nProfit_A = model.addVar(name=\"Profit_A\")\nmodel.addCons(Profit_A == Revenue_A - (FuelCost_A + TollFee_A) * Trucks_A)\n\nRevenue_B = model.addVar(name=\"Revenue_B\")\nFuelCost_B = model.addVar(name=\"FuelCost_B\")\nTollFee_B = model.addVar(name=\"TollFee_B\")\nProfit_B = model.addVar(name=\"Profit_B\")\nmodel.addCons(Profit_B == Revenue_B - (FuelCost_B + TollFee_B) * Trucks_B)\n\nRevenue_C = model.addVar(name=\"Revenue_C\")\nFuelCost_C = model.addVar(name=\"FuelCost_C\")\nTollFee_C = model.addVar(name=\"TollFee_C\")\nProfit_C = model.addVar(name=\"Profit_C\")\nmodel.addCons(Profit_C == Revenue_C - (FuelCost_C + TollFee_C) * Trucks_C)\n\nRevenue_D = model.addVar(name=\"Revenue_D\")\nFuelCost_D = model.addVar(name=\"FuelCost_D\")\nTollFee_D = model.addVar(name=\"TollFee_D\")\nProfit_D = model.addVar(name=\"Profit_D\")\nmodel.addCons(Profit_D == Revenue_D - (FuelCost_D + TollFee_D) * Trucks_D)\n\nRevenue_E = model.addVar(name=\"Revenue_E\")\nFuelCost_E = model.addVar(name=\"FuelCost_E\")\nTollFee_E = model.addVar(name=\"TollFee_E\")\nProfit_E = model.addVar(name=\"Profit_E\")\nmodel.addCons(Profit_E == Revenue_E - (FuelCost_E + TollFee_E) * Trucks_E)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\nmodel.addCons(FuelCost_A * Trucks_A + FuelCost_B * Trucks_B + FuelCost_C * Trucks_C + FuelCost_D * Trucks_D + FuelCost_E * Trucks_E <= 10000)\nmodel.addCons(TollFee_A * Trucks_A + TollFee_B * Trucks_B + TollFee_C * Trucks_C + TollFee_D * Trucks_D + TollFee_E * Trucks_E <= 5000)\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks on Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks on Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks on Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks on Route E: \", model.getVal(Trucks_E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor hours.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, for product D is $80, and for product E is $90. The production cost per unit for product A is $20, for product B is $30, for product C is $25, for product D is $40, and for product E is $50. The company wants to maximize the net profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// Total cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for raw materials and labor.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE <= 50000\n\n## Generate Constraint-2:\nThe company must produce at least 500 units in total across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE >= 500\n\n## Generate Constraint-3:\nThe company has a limited supply of a critical raw material that allows for the production of at most 1000 units of product A.\n// ProductA <= 1000",
        "question": "A manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor hours. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n| D       | $80             | $40                      |\n| E       | $90             | $50                      |\n\nThe company has a total budget of $50,000 for raw materials and labor. The company must produce at least 500 units in total across all products. The company has a limited supply of a critical raw material that allows for the production of at most 1000 units of product A. \n\nPlease help the company to maximize the net profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of product D\nProductE = model.addVar(vtype=\"INTEGER\", name=\"ProductE\", lb=0) # number of units of product E\n\n# Define objective function\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a total budget of $50,000 for raw materials and labor.\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE <= 50000)\n# The company must produce at least 500 units in total across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE >= 500)\n# The company has a limited supply of a critical raw material that allows for the production of at most 1000 units of product A.\nmodel.addCons(ProductA <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Number of Product D: \", model.getVal(ProductD))\n    print(\"Number of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the average fuel consumption per truck is 50 liters per day, the average revenue per truck is $1000 per day, and the maintenance cost per truck is $200 per day.\nFor RouteB, the average fuel consumption per truck is 60 liters per day, the average revenue per truck is $1200 per day, and the maintenance cost per truck is $250 per day.\nFor RouteC, the average fuel consumption per truck is 70 liters per day, the average revenue per truck is $1400 per day, and the maintenance cost per truck is $300 per day.\nFor RouteD, the average fuel consumption per truck is 80 liters per day, the average revenue per truck is $1600 per day, and the maintenance cost per truck is $350 per day.\nFor RouteE, the average fuel consumption per truck is 90 liters per day, the average revenue per truck is $1800 per day, and the maintenance cost per truck is $400 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for RouteA: Profit_A = (1000 - 200) * TrucksA - 50 * TrucksA\n// Total net profit for RouteB: Profit_B = (1200 - 250) * TrucksB - 60 * TrucksB\n// Total net profit for RouteC: Profit_C = (1400 - 300) * TrucksC - 70 * TrucksC\n// Total net profit for RouteD: Profit_D = (1600 - 350) * TrucksD - 80 * TrucksD\n// Total net profit for RouteE: Profit_E = (1800 - 400) * TrucksE - 90 * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for deployment.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regulatory requirements, RouteC must have at least 10% of the total trucks.\n// TrucksC >= 0.10 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $15,000 per day for maintenance costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 15000",
        "question": "A logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations. The average fuel consumption per truck, average revenue per truck, and maintenance cost per truck for each route are given in the following Table.\n\n| Route   | Fuel Consumption (liters/day) | Revenue (per day) | Maintenance Cost (per day) |\n|---------|-------------------------------|-------------------|----------------------------|\n| RouteA  | 50                            | $1000             | $200                       |\n| RouteB  | 60                            | $1200             | $250                       |\n| RouteC  | 70                            | $1400             | $300                       |\n| RouteD  | 80                            | $1600             | $350                       |\n| RouteE  | 90                            | $1800             | $400                       |\n\nThe company has a total of 50 trucks available for deployment. Due to regulatory requirements, RouteC must have at least 10% of the total trucks. The company has a budget of $15,000 per day for maintenance costs. \n\nPlease help the company to maximize the net profit per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * TrucksA - 50 * TrucksA\nProfit_B = (1200 - 250) * TrucksB - 60 * TrucksB\nProfit_C = (1400 - 300) * TrucksC - 70 * TrucksC\nProfit_D = (1600 - 350) * TrucksD - 80 * TrucksD\nProfit_E = (1800 - 400) * TrucksE - 90 * TrucksE\nFuelConsumption = 50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for deployment.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to regulatory requirements, RouteC must have at least 10% of the total trucks.\nmodel.addCons(TrucksC >= 0.10 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n## The company has a budget of $15,000 per day for maintenance costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and textiles. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries and the number of trips it makes.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishables\": \"PerishablesTrips\", \"range\": \"PerishablesTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for textiles\": \"TextilesTrips\", \"range\": \"TextilesTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for electronics is $100, for perishables is $70, and for textiles is $50. The fuel cost per trip for electronics is $20, for perishables is $15, and for textiles is $10. The company aims to maximize its daily net profit from all trips.\n// Profit_Electronics = ElectronicsTrucks * ElectronicsTrips * (100 - 20)\n// Profit_Perishables = PerishablesTrucks * PerishablesTrips * (70 - 15)\n// Profit_Textiles = TextilesTrucks * TextilesTrips * (50 - 10)\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Perishables + Profit_Textiles)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * ElectronicsTrucks * ElectronicsTrips + 15 * PerishablesTrucks * PerishablesTrips + 10 * TextilesTrucks * TextilesTrips <= 1000\n\n## Generate Constraint-3:\nThe company has a daily operational limit of 100 trips.\n// ElectronicsTrucks * ElectronicsTrips + PerishablesTrucks * PerishablesTrips + TextilesTrucks * TextilesTrips <= 100",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and textiles. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The profit per trip for electronics is $100, for perishables is $70, and for textiles is $50. The fuel cost per trip for electronics is $20, for perishables is $15, and for textiles is $10. The company aims to maximize its daily net profit from all trips. The company has a total of 50 trucks available. The company has a daily fuel budget of $1000. The company has a daily operational limit of 100 trips. Please help the company to determine the optimal number of trucks and trips for each type of goods to maximize its daily net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nPerishablesTrips = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrips\", lb=0)\nTextilesTrips = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrips\", lb=0)\n\n# Define objective function\nProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (100 - 20)\nProfit_Perishables = PerishablesTrucks * PerishablesTrips * (70 - 15)\nProfit_Textiles = TextilesTrucks * TextilesTrips * (50 - 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Perishables + Profit_Textiles)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTrips + 15 * PerishablesTrucks * PerishablesTrips + 10 * TextilesTrucks * TextilesTrips <= 1000)\nmodel.addCons(ElectronicsTrucks * ElectronicsTrips + PerishablesTrucks * PerishablesTrips + TextilesTrucks * TextilesTrips <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Trucks for Textiles: \", model.getVal(TextilesTrucks))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Perishables: \", model.getVal(PerishablesTrips))\n    print(\"Number of Trips per Truck for Textiles: \", model.getVal(TextilesTrips))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output per unit.\n// {\"number of solar panels in Region1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnD\", \"range\": \"RnD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel and wind turbine increases with the investment in R&D. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in R&D. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in R&D. The company aims to maximize the total energy output from all regions.\n// Total energy output for Region1: Energy1 = (200 + 0.005 * RnD) * Solar1 + (500 + 0.01 * RnD) * Wind1\n// Total energy output for Region2: Energy2 = (200 + 0.005 * RnD) * Solar2 + (500 + 0.01 * RnD) * Wind2\n// Total energy output for Region3: Energy3 = (200 + 0.005 * RnD) * Solar3 + (500 + 0.01 * RnD) * Wind3\n// So, the objective function is: Maximize (Energy1 + Energy2 + Energy3)\n\n## Generate Constraint-1:\nThe total budget for installation and R&D is $1,000,000.\n// 1000 * Solar1 + 2000 * Wind1 + 1000 * Solar2 + 2000 * Wind2 + 1000 * Solar3 + 2000 * Wind3 + RnD <= 1000000\n\n## Generate Constraint-2:\nThe total area available for installation in each region is limited. Region1 can install up to 500 units in total, Region2 up to 600 units, and Region3 up to 700 units.\n// Solar1 + Wind1 <= 500; Solar2 + Wind2 <= 600; Solar3 + Wind3 <= 700\n\n## Generate Constraint-3:\nDue to local regulations, the company must install at least 100 solar panels and 50 wind turbines in each region.\n// Solar1 >= 100; Wind1 >= 50; Solar2 >= 100; Wind2 >= 50; Solar3 >= 100; Wind3 >= 50",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in R&D. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in R&D. The company aims to maximize the total energy output from all regions.\n\nThe total budget for installation and R&D is $1,000,000. The total area available for installation in each region is limited: Region1 can install up to 500 units in total, Region2 up to 600 units, and Region3 up to 700 units. Due to local regulations, the company must install at least 100 solar panels and 50 wind turbines in each region.\n\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=100) # number of solar panels in Region1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=50) # number of wind turbines in Region1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=100) # number of solar panels in Region2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=50) # number of wind turbines in Region2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=100) # number of solar panels in Region3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=50) # number of wind turbines in Region3\nRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD\", lb=0) # investment in R&D\n\n# Define objective function\nEnergy1 = (200 + 0.005 * RnD) * Solar1 + (500 + 0.01 * RnD) * Wind1\nEnergy2 = (200 + 0.005 * RnD) * Solar2 + (500 + 0.01 * RnD) * Wind2\nEnergy3 = (200 + 0.005 * RnD) * Solar3 + (500 + 0.01 * RnD) * Wind3\n# So, the objective function is: Maximize (Energy1 + Energy2 + Energy3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy1 + Energy2 + Energy3)\n\n# Add constraints\n# The total budget for installation and R&D is $1,000,000.\nmodel.addCons(1000 * Solar1 + 2000 * Wind1 + 1000 * Solar2 + 2000 * Wind2 + 1000 * Solar3 + 2000 * Wind3 + RnD <= 1000000)\n# The total area available for installation in each region is limited.\nmodel.addCons(Solar1 + Wind1 <= 500)\nmodel.addCons(Solar2 + Wind2 <= 600)\nmodel.addCons(Solar3 + Wind3 <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(Wind3))\n    print(\"Investment in R&D: \", model.getVal(RnD))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 hectares of Corn.\n// Corn >= 5\n\n## Generate Constraint-5:\nThe farmer must plant at least 15 hectares of Soybeans.\n// Soybeans >= 15",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer has 100 hectares of land available and a total of 50,000 liters of water for irrigation. The farmer must plant at least 10 hectares of Wheat, at least 5 hectares of Corn, and at least 15 hectares of Soybeans. The farmer wants to maximize the profit per liter of water used. Please help the farmer determine the optimal area of land to allocate to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\n## The farmer must plant at least 5 hectares of Corn.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5) # area of land for Corn\n## The farmer must plant at least 15 hectares of Soybeans.\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=15) # area of land for Soybeans\n## The area of land for Barley and Oats should be non-negative.\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit Rate per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of technology upgrade for each type to maximize energy output and minimize operational costs.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade level for Small wind farms\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade level for Medium wind farms\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade level for Large wind farms\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output and operational cost of each wind farm type are affected by the technology upgrade level. The energy output increases and the operational cost decreases with higher technology upgrades. The company aims to maximize the net energy output (energy output minus operational cost) from all wind farms.\n// Net energy output for Small wind farms: NetOutputSmall = (1000 + 50 * TechUpgradeSmall) * SmallWindFarms - (100 + 10 * TechUpgradeSmall) * SmallWindFarms\n// Net energy output for Medium wind farms: NetOutputMedium = (2000 + 70 * TechUpgradeMedium) * MediumWindFarms - (150 + 15 * TechUpgradeMedium) * MediumWindFarms\n// Net energy output for Large wind farms: NetOutputLarge = (3000 + 100 * TechUpgradeLarge) * LargeWindFarms - (200 + 20 * TechUpgradeLarge) * LargeWindFarms\n// So, the objective function is: Maximize (NetOutputSmall + NetOutputMedium + NetOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for building and upgrading wind farms.\n// (100000 * SmallWindFarms + 150000 * MediumWindFarms + 200000 * LargeWindFarms) + (5000 * TechUpgradeSmall + 7000 * TechUpgradeMedium + 10000 * TechUpgradeLarge) <= 1000000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of technology upgrade for each type to maximize energy output and minimize operational costs. The energy output and operational cost of each wind farm type are affected by the technology upgrade level, with higher upgrades increasing energy output and decreasing operational costs. The company aims to maximize the net energy output (energy output minus operational cost) from all wind farms. The company has a total budget of $1,000,000 for building and upgrading wind farms. Please help the company to determine the optimal number of each type of wind farm and the appropriate technology upgrade levels to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nTechUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSmall\", lb=0)\nTechUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeMedium\", lb=0)\nTechUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeLarge\", lb=0)\n\n# Define objective function\nNetOutputSmall = (1000 + 50 * TechUpgradeSmall) * SmallWindFarms - (100 + 10 * TechUpgradeSmall) * SmallWindFarms\nNetOutputMedium = (2000 + 70 * TechUpgradeMedium) * MediumWindFarms - (150 + 15 * TechUpgradeMedium) * MediumWindFarms\nNetOutputLarge = (3000 + 100 * TechUpgradeLarge) * LargeWindFarms - (200 + 20 * TechUpgradeLarge) * LargeWindFarms\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetOutputSmall + NetOutputMedium + NetOutputLarge)\n\n# Add constraints\nmodel.addCons((100000 * SmallWindFarms + 150000 * MediumWindFarms + 200000 * LargeWindFarms) + \n              (5000 * TechUpgradeSmall + 7000 * TechUpgradeMedium + 10000 * TechUpgradeLarge) <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Technology Upgrade Level for Small Wind Farms: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade Level for Medium Wind Farms: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade Level for Large Wind Farms: \", model.getVal(TechUpgradeLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\n// Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\n// Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units per month.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceAUnits <= 2 * DeviceBUnits",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit. The profit per unit for each device decreases as more units are produced beyond certain thresholds. The details of the profit structure and production constraints are given in the following Table.\n\n| Device | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|--------|----------------------------------|------------------------------------|-----------|\n| DeviceA | $50                             | $0.1                               | 100 units  |\n| DeviceB | $70                             | $0.05                              | 200 units  |\n| DeviceC | $60                             | $0.08                              | 150 units  |\n| DeviceD | $80                             | $0.12                              | 250 units  |\n\nThe company has a production capacity of 1000 units per month. Due to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * DeviceA2) * DeviceA2 * DeviceA_b2 + 50 * DeviceA1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.05 * DeviceB2) * DeviceB2 * DeviceB_b2 + 70 * DeviceB1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=150)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=150, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (60 - 0.08 * DeviceC2) * DeviceC2 * DeviceC_b2 + 60 * DeviceC1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\nDeviceD1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD1\", lb=0, ub=250)\nDeviceD2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD2\", lb=250, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceDUnits == DeviceD1*DeviceD_b1 + DeviceD2*DeviceD_b2)\nProfit_DeviceD = (80 - 0.12 * DeviceD2) * DeviceD2 * DeviceD_b2 + 80 * DeviceD1 * DeviceD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000)\nmodel.addCons(DeviceAUnits <= 2 * DeviceBUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_A = 50 * ProductA\n// Profit_B = 70 * ProductB\n// Profit_C = 60 * ProductC\n// ShiftCost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n// ProductA + ProductB + ProductC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n\nPlease help the company to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nProfit_A = 50 * ProductA\nProfit_B = 70 * ProductB\nProfit_C = 60 * ProductC\nShiftCost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - ShiftCost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output while considering the cost and efficiency of each type.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8.\nThe energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9.\nThe energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0.\nThe manufacturer wants to maximize the total energy output per dollar spent.\n// Energy_S1 = 100 * S1 * 0.8\n// Energy_S2 = 120 * S2 * 0.9\n// Energy_S3 = 140 * S3 * 1.0\n// Cost_S1 = 50 * S1\n// Cost_S2 = 60 * S2\n// Cost_S3 = 70 * S3\n// So, the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * S1 + 60 * S2 + 70 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 200 units in total.\n// S1 + S2 + S3 <= 200\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output while considering the cost and efficiency of each type. The energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8. The energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9. The energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0. The manufacturer wants to maximize the total energy output per dollar spent. The manufacturer has a budget of $10,000 for production costs. The manufacturer has a limited production capacity of 200 units in total. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1. Please help the manufacturer to determine the optimal production quantities of each type of solar panel to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_S1 = 100 * S1 * 0.8\nEnergy_S2 = 120 * S2 * 0.9\nEnergy_S3 = 140 * S3 * 1.0\nCost_S1 = 50 * S1\nCost_S2 = 60 * S2\nCost_S3 = 70 * S3\n## the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_S1 + Cost_S2 + Cost_S3) == Energy_S1 + Energy_S2 + Energy_S3)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(50 * S1 + 60 * S2 + 70 * S3 <= 10000)\n## The manufacturer has a limited production capacity of 200 units in total.\nmodel.addCons(S1 + S2 + S3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n// {\"technicians assigned to machine 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components.\n// Production rate of machine 1: P1 = 100 * (1 + 0.05 * T1) * M1\n// Production rate of machine 2: P2 = 120 * (1 + 0.04 * T2) * M2\n// Production rate of machine 3: P3 = 140 * (1 + 0.03 * T3) * M3\n// Production rate of machine 4: P4 = 160 * (1 + 0.02 * T4) * M4\n// Production rate of machine 5: P5 = 180 * (1 + 0.01 * T5) * M5\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThere are a total of 30 technicians available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 10 hours per day.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10\n\n## Generate Constraint-3:\nThe number of technicians assigned to each machine must not exceed 10.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-4:\nThe total hours of operation for all machines must not exceed 40 hours.\n// M1 + M2 + M3 + M4 + M5 <= 40",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine. The production rate of each machine is influenced by the number of technicians assigned and is given by a nonlinear function. The objective is to maximize the total production of all components. The production rates for each machine are as follows:\n\n| Machine | Production Rate (components/hour) |\n|---------|------------------------------------|\n| 1       | 100 * (1 + 0.05 * T1)              |\n| 2       | 120 * (1 + 0.04 * T2)              |\n| 3       | 140 * (1 + 0.03 * T3)              |\n| 4       | 160 * (1 + 0.02 * T4)              |\n| 5       | 180 * (1 + 0.01 * T5)              |\n\nThe plant has a total of 30 technicians available. Each machine can operate for a maximum of 10 hours per day, and the number of technicians assigned to each machine must not exceed 10. The total hours of operation for all machines must not exceed 40 hours.\n\nPlease help the plant manager to maximize the total production of all components by determining the optimal number of hours each machine should operate and the number of technicians assigned to each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # technicians assigned to machine 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # technicians assigned to machine 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # technicians assigned to machine 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # technicians assigned to machine 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # technicians assigned to machine 5\n\n# Define objective function\nP1 = 100 * (1 + 0.05 * T1) * M1\nP2 = 120 * (1 + 0.04 * T2) * M2\nP3 = 140 * (1 + 0.03 * T3) * M3\nP4 = 160 * (1 + 0.02 * T4) * M4\nP5 = 180 * (1 + 0.01 * T5) * M5\n# The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# There are a total of 30 technicians available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n# Each machine can operate for a maximum of 10 hours per day.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n# The number of technicians assigned to each machine must not exceed 10.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n# The total hours of operation for all machines must not exceed 40 hours.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Technicians Assigned to Machine 1: \", model.getVal(T1))\n    print(\"Technicians Assigned to Machine 2: \", model.getVal(T2))\n    print(\"Technicians Assigned to Machine 3: \", model.getVal(T3))\n    print(\"Technicians Assigned to Machine 4: \", model.getVal(T4))\n    print(\"Technicians Assigned to Machine 5: \", model.getVal(T5))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"ProductA_Units\", \"range\": \"ProductA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB_Units\", \"range\": \"ProductB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC_Units\", \"range\": \"ProductC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD_Units\", \"range\": \"ProductD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $110. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.01 * ProductA_Units^2) * ProductA_Units\n// Profit_ProductB = (70 - 0.02 * ProductB_Units^2) * ProductB_Units\n// Profit_ProductC = (90 - 0.03 * ProductC_Units^2) * ProductC_Units\n// Profit_ProductD = (110 - 0.04 * ProductD_Units^2) * ProductD_Units\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductA_Units >= 2 * ProductB_Units",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $110. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The company has a total production capacity of 1000 units for all products combined. Due to market demand, the production of ProductA must be at least twice the production of ProductB. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Units\", lb=0)\nProductB_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Units\", lb=0)\nProductC_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Units\", lb=0)\nProductD_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductD_Units\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit for each product\nProfit_ProductA = (50 - 0.01 * ProductA_Units**2) * ProductA_Units\nProfit_ProductB = (70 - 0.02 * ProductB_Units**2) * ProductB_Units\nProfit_ProductC = (90 - 0.03 * ProductC_Units**2) * ProductC_Units\nProfit_ProductD = (110 - 0.04 * ProductD_Units**2) * ProductD_Units\n\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000)\n\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductA_Units >= 2 * ProductB_Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductA_Units))\n    print(\"Number of ProductB Units: \", model.getVal(ProductB_Units))\n    print(\"Number of ProductC Units: \", model.getVal(ProductC_Units))\n    print(\"Number of ProductD Units: \", model.getVal(ProductD_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 722,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe total load capacity required is at least 1500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the trucks are T1 or T2 types.\n// T1 + T2 >= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-5:\nThe maximum number of T5 trucks should not exceed 30% of the total number of trucks.\n// T5 <= 0.3 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter. The company has a total of 100 trucks available. The total load capacity required is at least 1500 tons. The company wants to ensure that at least 20% of the trucks are T1 or T2 types. The maximum number of T5 trucks should not exceed 30% of the total number of trucks.\nPlease help the company to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total load capacity required is at least 1500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500)\n## The company wants to ensure that at least 20% of the trucks are T1 or T2 types.\nmodel.addCons(T1 + T2 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n## The maximum number of T5 trucks should not exceed 30% of the total number of trucks.\nmodel.addCons(T5 <= 0.3 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1478,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Refrigerated trucks\": \"TechUpgradeRefrigerated\", \"range\": \"TechUpgradeRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Heavy-Duty trucks\": \"TechUpgradeHeavyDuty\", \"range\": \"TechUpgradeHeavyDuty >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Standard trucks\": \"TechUpgradeStandard\", \"range\": \"TechUpgradeStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs.\n// Fuel cost per Refrigerated truck: FuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\n// Maintenance cost per Refrigerated truck: MaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\n// Similar calculations for Heavy-Duty and Standard trucks.\n// Total annual operating cost: OperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n// So, the objective function is: Minimize OperatingCost\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades.\n// RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs. The fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades, improving by 1% for each $1000 invested in technology upgrades and reducing maintenance costs by 0.5% for each $1000 invested.\n\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades. The total number of trucks cannot exceed 200. Please help the company to determine the optimal number of each type of truck and the corresponding investment in technology upgrades to minimize the total annual operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nTechUpgradeRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeRefrigerated\", lb=0)\nTechUpgradeHeavyDuty = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeHeavyDuty\", lb=0)\nTechUpgradeStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeStandard\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel and maintenance cost calculations\nBaseFuelCost = 10000  # Example base fuel cost per truck\nBaseMaintenanceCost = 2000  # Example base maintenance cost per truck\n\nFuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\nMaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\nFuelCostHeavyDuty = (BaseFuelCost * HeavyDutyTrucks) / (1 + 0.01 * TechUpgradeHeavyDuty)\nMaintenanceCostHeavyDuty = (BaseMaintenanceCost * HeavyDutyTrucks) * (1 - 0.005 * TechUpgradeHeavyDuty)\nFuelCostStandard = (BaseFuelCost * StandardTrucks) / (1 + 0.01 * TechUpgradeStandard)\nMaintenanceCostStandard = (BaseMaintenanceCost * StandardTrucks) * (1 - 0.005 * TechUpgradeStandard)\n\n## Total annual operating cost\nOperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n\n## Objective function constraint\nmodel.addCons(obj == OperatingCost)\n\n# Add constraints\n## Budget constraint\nTruckCostRefrigerated = 50000  # Example cost of Refrigerated truck\nTruckCostHeavyDuty = 70000  # Example cost of Heavy-Duty truck\nTruckCostStandard = 30000  # Example cost of Standard truck\nmodel.addCons(RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000)\n\n## Total number of trucks constraint\nmodel.addCons(RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Tech Upgrades for Refrigerated Trucks: \", model.getVal(TechUpgradeRefrigerated))\n    print(\"Investment in Tech Upgrades for Heavy-Duty Trucks: \", model.getVal(TechUpgradeHeavyDuty))\n    print(\"Investment in Tech Upgrades for Standard Trucks: \", model.getVal(TechUpgradeStandard))\n    print(\"Minimized Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects. The efficiency of wind turbines also decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage.\n// Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\n// Installation_cost = 1000 * S + 1500 * W + 2000 * E\n// Storage_cost = 50 * E^2\n// So, the objective function is: Maximize (Energy_output - Installation_cost - Storage_cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for installation and storage costs.\n// 1000 * S + 1500 * W + 2000 * E + 50 * E^2 <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 5000 square meters.\n// S + 2 * W <= 5000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation. The efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects, and the efficiency of wind turbines decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage.\n\nThe company has a budget of $100,000 for installation and storage costs. The total area available for installation is limited to 5000 square meters.\n\nPlease help the company to maximize the total energy output minus the total cost of installation and storage, given the following constraints:\n- The company has a budget of $100,000 for installation and storage costs.\n- The total area available for installation is limited to 5000 square meters.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # amount of energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\nEnergy_output = S * (1 - 0.01 * S**2) + W * (1 - 0.02 * W**2)\n## Installation_cost = 1000 * S + 1500 * W + 2000 * E\n## Storage_cost = 50 * E^2\n## So, the objective function is: Maximize (Energy_output - Installation_cost - Storage_cost)\nmodel.addCons(obj == Energy_output - (1000 * S + 1500 * W + 2000 * E) - (50 * E**2))\n\n# Add constraints\n## The company has a budget of $100,000 for installation and storage costs.\nmodel.addCons(1000 * S + 1500 * W + 2000 * E + 50 * E**2 <= 100000)\n## The total area available for installation is limited to 5000 square meters.\nmodel.addCons(S + 2 * W <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in miles per gallon (mpg).\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"SmallTruckFuelEfficiency\", \"range\": \"SmallTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"MediumTruckFuelEfficiency\", \"range\": \"MediumTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"LargeTruckFuelEfficiency\", \"range\": \"LargeTruckFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year.\n// FuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\n// FuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\n// FuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs.\n// LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks)\n\n## Generate Constraint-4:\nThe fuel efficiency of medium trucks must be at least 10% better than that of small trucks.\n// MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck, measured in miles per gallon (mpg). The company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year.\n\n| Truck Type | Purchase Cost | Fuel Efficiency (mpg) |\n|------------|---------------|-----------------------|\n| Small      | $50,000       | SmallTruckFuelEfficiency |\n| Medium     | $75,000       | MediumTruckFuelEfficiency |\n| Large      | $100,000      | LargeTruckFuelEfficiency |\n\nThe company has a budget of $1,000,000 for purchasing trucks. The total number of trucks cannot exceed 20. The company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs. Additionally, the fuel efficiency of medium trucks must be at least 10% better than that of small trucks.\n\nPlease help the company determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nSmallTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallTruckFuelEfficiency\", lb=0.01)  # fuel efficiency of small trucks\nMediumTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTruckFuelEfficiency\", lb=0.01)  # fuel efficiency of medium trucks\nLargeTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeTruckFuelEfficiency\", lb=0.01)  # fuel efficiency of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\nFuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\nFuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\n## the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\nmodel.addCons(obj == FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing trucks.\nmodel.addCons(SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000)\n## The total number of trucks cannot exceed 20.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs.\nmodel.addCons(LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks))\n## The fuel efficiency of medium trucks must be at least 10% better than that of small trucks.\nmodel.addCons(MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeTruckFuelEfficiency))\n    print(\"Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Quantity\", \"range\": \"DeviceD_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceE_Quantity\", \"range\": \"DeviceE_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. \nThe profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units.\nThe profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units.\nThe profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all devices.\n// Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\n// Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\n// Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\n// Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\n// Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units. The profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units. The profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units. The company has a total production capacity of 1000 units for all devices combined. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\nDeviceD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity\", lb=0)\nDeviceE_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\nDeviceA_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity1\", lb=0, ub=100)\nDeviceA_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA_Quantity == DeviceA_Quantity1*DeviceA_b1 + DeviceA_Quantity2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * DeviceA_Quantity2) * DeviceA_Quantity2 * DeviceA_b2 + 50 * DeviceA_Quantity1 * DeviceA_b1\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\nDeviceB_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity1\", lb=0, ub=200)\nDeviceB_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB_Quantity == DeviceB_Quantity1*DeviceB_b1 + DeviceB_Quantity2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.2 * DeviceB_Quantity2) * DeviceB_Quantity2 * DeviceB_b2 + 70 * DeviceB_Quantity1 * DeviceB_b1\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\nDeviceC_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity1\", lb=0, ub=300)\nDeviceC_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity2\", lb=300, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC_Quantity == DeviceC_Quantity1*DeviceC_b1 + DeviceC_Quantity2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.3 * DeviceC_Quantity2) * DeviceC_Quantity2 * DeviceC_b2 + 90 * DeviceC_Quantity1 * DeviceC_b1\n\n## create piecewise variables for piecewise function: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\nDeviceD_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity1\", lb=0, ub=150)\nDeviceD_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity2\", lb=150, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceD_Quantity == DeviceD_Quantity1*DeviceD_b1 + DeviceD_Quantity2*DeviceD_b2)\nProfit_DeviceD = (60 - 0.15 * DeviceD_Quantity2) * DeviceD_Quantity2 * DeviceD_b2 + 60 * DeviceD_Quantity1 * DeviceD_b1\n\n## create piecewise variables for piecewise function: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\nDeviceE_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity1\", lb=0, ub=250)\nDeviceE_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity2\", lb=250, ub=1000)\nDeviceE_b1 = model.addVar(vtype=\"B\", name=\"DeviceE_b1\")\nDeviceE_b2 = model.addVar(vtype=\"B\", name=\"DeviceE_b2\")\nmodel.addCons(DeviceE_b1 + DeviceE_b2 == 1)\nmodel.addCons(DeviceE_Quantity == DeviceE_Quantity1*DeviceE_b1 + DeviceE_Quantity2*DeviceE_b2)\nProfit_DeviceE = (80 - 0.25 * DeviceE_Quantity2) * DeviceE_Quantity2 * DeviceE_b2 + 80 * DeviceE_Quantity1 * DeviceE_b1\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"DeviceA Quantity: \", model.getVal(DeviceA_Quantity))\n    print(\"DeviceB Quantity: \", model.getVal(DeviceB_Quantity))\n    print(\"DeviceC Quantity: \", model.getVal(DeviceC_Quantity))\n    print(\"DeviceD Quantity: \", model.getVal(DeviceD_Quantity))\n    print(\"DeviceE Quantity: \", model.getVal(DeviceE_Quantity))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The company aims to maximize the total profit from distributing these products. However, the profit rate is affected by the storage and transportation costs, which are nonlinear functions of the number of units. The storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Storage cost of A: Storage_A = 0.1 * A^2\n// Storage cost of B: Storage_B = 0.1 * B^2\n// Storage cost of C: Storage_C = 0.1 * C^2\n// Storage cost of D: Storage_D = 0.1 * D^2\n// Transportation cost of A: Trans_A = 0.01 * A^3\n// Transportation cost of B: Trans_B = 0.01 * B^3\n// Transportation cost of C: Trans_C = 0.01 * C^3\n// Transportation cost of D: Trans_D = 0.01 * D^3\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\n\n## Generate Constraint-1:\nThe total storage space available for all products is limited to 1000 square units.\n// 0.1 * A^2 + 0.1 * B^2 + 0.1 * C^2 + 0.1 * D^2 <= 1000\n\n## Generate Constraint-2:\nThe total transportation capacity is limited to 5000 cubic units.\n// 0.01 * A^3 + 0.01 * B^3 + 0.01 * C^3 + 0.01 * D^3 <= 5000\n\n## Generate Constraint-3:\nThe company has a minimum distribution requirement of 50 units for each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A.\n// C <= 2 * A",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs. The total storage space available for all products is limited to 1000 square units. The total transportation capacity is limited to 5000 cubic units. The company has a minimum distribution requirement of 50 units for each product. The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C. Additionally, the company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A. Please help the company to determine the optimal number of units to distribute for each product to maximize the net profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nStorage_A = 0.1 * A**2\nStorage_B = 0.1 * B**2\nStorage_C = 0.1 * C**2\nStorage_D = 0.1 * D**2\nTrans_A = 0.01 * A**3\nTrans_B = 0.01 * B**3\nTrans_C = 0.01 * C**3\nTrans_D = 0.01 * D**3\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D))\n\n# Add constraints\n## The total storage space available for all products is limited to 1000 square units.\nmodel.addCons(0.1 * A**2 + 0.1 * B**2 + 0.1 * C**2 + 0.1 * D**2 <= 1000)\n## The total transportation capacity is limited to 5000 cubic units.\nmodel.addCons(0.01 * A**3 + 0.01 * B**3 + 0.01 * C**3 + 0.01 * D**3 <= 5000)\n## The company has a minimum distribution requirement of 50 units for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 50)\nmodel.addCons(C >= 50)\nmodel.addCons(D >= 50)\n## The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n// Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n// Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n// Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n// Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n// Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n// So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trucks of each type are deployed.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 100 drivers available for the upcoming month.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month. The capacity and fuel efficiency for each truck are given in the following Table.\n\n| Truck | Capacity (tons) | Fuel Efficiency (km/liter) |\n|-------|-----------------|----------------------------|\n| A     | 10              | 5                          |\n| B     | 15              | 7                          |\n| C     | 20              | 9                          |\n| D     | 25              | 11                         |\n| E     | 30              | 13                         |\n\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month. The company wants to ensure that at least 5 trucks of each type are deployed. The company has a total of 100 drivers available for the upcoming month. \nPlease help the company to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trucks of each type are deployed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks E\n\n# Define objective function\n## Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n## Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n## Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n## Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n## Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\nTkm_A = 10 * 5 * A\nTkm_B = 15 * 7 * B\nTkm_C = 20 * 9 * C\nTkm_D = 25 * 11 * D\nTkm_E = 30 * 13 * E\n## So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing fuel for the upcoming month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50000)\n## The company has a total of 100 drivers available for the upcoming month.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Number of Trucks D: \", model.getVal(D))\n    print(\"Number of Trucks E: \", model.getVal(E))\n    print(\"Maximized Ton-Kilometers per Liter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for each truck\": \"Upgrade\", \"range\": \"Upgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company aims to minimize the total operational cost of all trips.\n// Operational cost per trip to Region1: Cost1 = (10 - 0.001 * Upgrade) * Trips1\n// Operational cost per trip to Region2: Cost2 = (10 - 0.001 * Upgrade) * Trips2\n// Operational cost per trip to Region3: Cost3 = (10 - 0.001 * Upgrade) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\n// Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 100 trips to Region1 and 150 trips to Region2.\n// Trips1 >= 100; Trips2 >= 150\n\n## Generate Constraint-4:\nThe company wants to ensure that the total trips to Region3 do not exceed the combined trips to Region1 and Region2.\n// Trips3 <= Trips1 + Trips2",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip. The fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company has a budget of $100,000 for fuel-efficient upgrades and operational costs. The total number of trips across all regions must not exceed 500. Due to contractual obligations, the company must make at least 100 trips to Region1 and 150 trips to Region2. The company wants to ensure that the total trips to Region3 do not exceed the combined trips to Region1 and Region2. Please help the company to minimize the total operational cost of all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=150)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade\", lb=0)  # investment in fuel-efficient upgrades\n\n# Define objective function\nCost1 = (10 - 0.001 * Upgrade) * Trips1\nCost2 = (10 - 0.001 * Upgrade) * Trips2\nCost3 = (10 - 0.001 * Upgrade) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\nmodel.addCons(Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n# Due to contractual obligations, the company must make at least 100 trips to Region1 and 150 trips to Region2.\nmodel.addCons(Trips1 >= 100)\nmodel.addCons(Trips2 >= 150)\n# The company wants to ensure that the total trips to Region3 do not exceed the combined trips to Region1 and Region2.\nmodel.addCons(Trips3 <= Trips1 + Trips2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips to Region3: \", model.getVal(Trips3))\n    print(\"Investment in Fuel-Efficient Upgrades: \", model.getVal(Upgrade))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for GoodA is $0.5, for GoodB is $0.6, for GoodC is $0.7, for GoodD is $0.8, and for GoodE is $0.9. The revenue per kilometer for GoodA is $1.5, for GoodB is $1.8, for GoodC is $2.1, for GoodD is $2.4, and for GoodE is $2.7. The company wants to maximize the total net profit per kilometer across all goods.\n// NetProfit_GoodA = (1.5 - 0.5) * TrucksA\n// NetProfit_GoodB = (1.8 - 0.6) * TrucksB\n// NetProfit_GoodC = (2.1 - 0.7) * TrucksC\n// NetProfit_GoodD = (2.4 - 0.8) * TrucksD\n// NetProfit_GoodE = (2.7 - 0.9) * TrucksE\n// So, the objective function is: Maximize (NetProfit_GoodA + NetProfit_GoodB + NetProfit_GoodC + NetProfit_GoodD + NetProfit_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network. The cost of fuel per kilometer and the revenue per kilometer for each type of good are given in the following Table.\n\n| Good    | Fuel Cost per Kilometer | Revenue per Kilometer |\n|---------|-------------------------|-----------------------|\n| GoodA   | $0.5                    | $1.5                  |\n| GoodB   | $0.6                    | $1.8                  |\n| GoodC   | $0.7                    | $2.1                  |\n| GoodD   | $0.8                    | $2.4                  |\n| GoodE   | $0.9                    | $2.7                  |\n\nThe company has a total of 50 trucks available for distribution. The company wants to maximize the total net profit per kilometer across all goods. Please help the company determine the optimal allocation of trucks to each type of good.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nNetProfit_GoodA = (1.5 - 0.5) * TrucksA\nNetProfit_GoodB = (1.8 - 0.6) * TrucksB\nNetProfit_GoodC = (2.1 - 0.7) * TrucksC\nNetProfit_GoodD = (2.4 - 0.8) * TrucksD\nNetProfit_GoodE = (2.7 - 0.9) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (NetProfit_GoodA + NetProfit_GoodB + NetProfit_GoodC + NetProfit_GoodD + NetProfit_GoodE)\nmodel.addCons(obj == NetProfit_GoodA + NetProfit_GoodB + NetProfit_GoodC + NetProfit_GoodD + NetProfit_GoodE)\n\n# Add constraints\n# The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced, as well as the amount of raw material R1 and R2 used in the production of each product.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material R1 used for ProductA\": \"R1A\", \"range\": \"R1A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductB\": \"R1B\", \"range\": \"R1B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductC\": \"R1C\", \"range\": \"R1C >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductA\": \"R2A\", \"range\": \"R2A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductB\": \"R2B\", \"range\": \"R2B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductC\": \"R2C\", \"range\": \"R2C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is determined by the selling price minus the cost of raw materials and production. The selling price for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of raw material R1 is $5 per unit, and R2 is $10 per unit. The production cost for each unit of ProductA is $30, for ProductB is $40, and for ProductC is $50. The company aims to maximize the total profit.\n// Profit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\n// Profit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\n// Profit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material R1 available.\n// R1A + R1B + R1C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material R2 available.\n// R2A + R2B + R2C <= 1500\n\n## Generate Constraint-3:\nThe production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\n// R1A >= 2 * R2A",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced, as well as the amount of raw material R1 and R2 used in the production of each product.\nThe profit from each product is determined by the selling price minus the cost of raw materials and production. The selling price for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of raw material R1 is $5 per unit, and R2 is $10 per unit. The production cost for each unit of ProductA is $30, for ProductB is $40, and for ProductC is $50. The company aims to maximize the total profit.\nThe company has a total of 1000 units of raw material R1 available. The company also has a total of 1500 units of raw material R2 available. Additionally, the production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nR1A = model.addVar(vtype=\"CONTINUOUS\", name=\"R1A\", lb=0)  # amount of raw material R1 used for ProductA\nR1B = model.addVar(vtype=\"CONTINUOUS\", name=\"R1B\", lb=0)  # amount of raw material R1 used for ProductB\nR1C = model.addVar(vtype=\"CONTINUOUS\", name=\"R1C\", lb=0)  # amount of raw material R1 used for ProductC\nR2A = model.addVar(vtype=\"CONTINUOUS\", name=\"R2A\", lb=0)  # amount of raw material R2 used for ProductA\nR2B = model.addVar(vtype=\"CONTINUOUS\", name=\"R2B\", lb=0)  # amount of raw material R2 used for ProductB\nR2C = model.addVar(vtype=\"CONTINUOUS\", name=\"R2C\", lb=0)  # amount of raw material R2 used for ProductC\n\n# Define objective function\nProfit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\nProfit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\nProfit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n# The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 units of raw material R1 available.\nmodel.addCons(R1A + R1B + R1C <= 1000)\n# The company has a total of 1500 units of raw material R2 available.\nmodel.addCons(R2A + R2B + R2C <= 1500)\n# The production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\nmodel.addCons(R1A >= 2 * R2A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Amount of R1 used for ProductA: \", model.getVal(R1A))\n    print(\"Amount of R1 used for ProductB: \", model.getVal(R1B))\n    print(\"Amount of R1 used for ProductC: \", model.getVal(R1C))\n    print(\"Amount of R2 used for ProductA: \", model.getVal(R2A))\n    print(\"Amount of R2 used for ProductB: \", model.getVal(R2B))\n    print(\"Amount of R2 used for ProductC: \", model.getVal(R2C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate.\n// {\"number of trips for RouteX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for RouteX: ConsumptionX = 50 - 0.005 * TechX * TripsX\n// Fuel consumption for RouteY: ConsumptionY = 60 - 0.006 * TechY * TripsY\n// Fuel consumption for RouteZ: ConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operations and technology investments.\n// 50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all routes must not exceed 2,000.\n// TripsX + TripsY + TripsZ <= 2,000\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 500 trips on RouteX and 300 trips on RouteY.\n// TripsX >= 500; TripsY >= 300\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each route must not exceed $20,000.\n// TechX <= 20000; TechY <= 20000; TechZ <= 20000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate. The initial fuel consumption rate for RouteX is 50 liters per trip, decreasing by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total budget of $100,000 for operations and technology investments. The total number of trips across all routes must not exceed 2,000. Due to contractual obligations, the company must make at least 500 trips on RouteX and 300 trips on RouteY. The investment in fuel-efficient technology for each route must not exceed $20,000.\n\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=500)  # number of trips for RouteX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=300)  # number of trips for RouteY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0)     # number of trips for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)   # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)   # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)   # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nConsumptionX = 50 - 0.005 * TechX * TripsX\nConsumptionY = 60 - 0.006 * TechY * TripsY\nConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n# So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for operations and technology investments.\nmodel.addCons(50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000)\n# The total number of trips across all routes must not exceed 2,000.\nmodel.addCons(TripsX + TripsY + TripsZ <= 2000)\n# The investment in fuel-efficient technology for each route must not exceed $20,000.\nmodel.addCons(TechX <= 20000)\nmodel.addCons(TechY <= 20000)\nmodel.addCons(TechZ <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for RouteX: \", model.getVal(TripsX))\n    print(\"Number of Trips for RouteY: \", model.getVal(TripsY))\n    print(\"Number of Trips for RouteZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and thus the operational costs of each truck.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades. The initial fuel consumption rate for Truck1 is 5 liters per trip, but with upgrades, it decreases by 0.5 liters per trip for every $100 invested. The initial fuel consumption rate for Truck2 is 6 liters per trip, and it decreases by 0.6 liters per trip for every $100 invested. The initial fuel consumption rate for Truck3 is 7 liters per trip, and it decreases by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all trucks.\n// Fuel consumption for Truck1: Consumption1 = (5 - 0.005 * Upgrade1) * Trips1\n// Fuel consumption for Truck2: Consumption2 = (6 - 0.006 * Upgrade2) * Trips2\n// Fuel consumption for Truck3: Consumption3 = (7 - 0.007 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1.\n// 1 * (5 * Trips1 + 6 * Trips2 + 7 * Trips3) + Upgrade1 + Upgrade2 + Upgrade3 <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 500 trips.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company is planning its routes for the next quarter and needs to determine the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. The company is also considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and thus the operational costs of each truck. The initial fuel consumption rates and the impact of upgrades on fuel consumption are given in the following Table.\n\n| Truck | Initial Fuel Consumption (liters/trip) | Decrease in Fuel Consumption per $100 Invested (liters/trip) |\n|-------|---------------------------------------|----------------------------------------------------------------|\n| Truck1 | 5                                    | 0.5                                                            |\n| Truck2 | 6                                    | 0.6                                                            |\n| Truck3 | 7                                    | 0.7                                                            |\n\nThe company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1. The total number of trips across all trucks must not exceed 500 trips. \n\nPlease help the company to minimize the total fuel consumption across all trucks by determining the optimal number of trips for each truck and the investment in fuel-efficient upgrades.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck3\n\n# Define objective function\nConsumption1 = (5 - 0.005 * Upgrade1) * Trips1\nConsumption2 = (6 - 0.006 * Upgrade2) * Trips2\nConsumption3 = (7 - 0.007 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1.\nmodel.addCons(1 * (5 * Trips1 + 6 * Trips2 + 7 * Trips3) + Upgrade1 + Upgrade2 + Upgrade3 <= 20000)\n# The total number of trips across all trucks must not exceed 500 trips.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrades for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1384,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\n// RevenueA = 100 * ProductA\n// RevenueB = 150 * ProductB\n// RevenueC = 200 * ProductC\n// LaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\n// LaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\n// LaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\n// RawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n// So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe raw material supply is limited to 500 units.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials). The company has a total of 1000 labor hours available. The total investment in automation cannot exceed $50,000. The raw material supply is limited to 500 units. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nRevenueA = 100 * ProductA\nRevenueB = 150 * ProductB\nRevenueC = 200 * ProductC\nLaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\nLaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\nLaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\nRawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n# So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n# Add constraints\n# The company has a total of 1000 labor hours available.\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The raw material supply is limited to 500 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Labor hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount of R&D investment for each device to optimize its profit. The profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices. The company has a total budget of $500,000 for R&D investments. The production capacity for the quarter is limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. Please help the company determine the optimal number of units to produce for each device and the appropriate R&D investments to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $500,000 for R&D investments.\nmodel.addCons(RDA + RDB + RDC <= 500000)\n# The production capacity for the quarter is limited to 10,000 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements.\n// Fuel_Small = (S * 20) / 5\n// Fuel_Medium = (M * 15) / 10\n// Fuel_Large = (L * 10) / 15\n// Fuel_ExtraLarge = (XL * 8) / 20\n// Fuel_Specialty = (Sp * 5) / 25\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe total weight of all deliveries must not exceed 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fuel Efficiency (km/l) | Capacity (tons) |\n|-------------------|------------------------|-----------------|\n| Small             | 20                     | 5               |\n| Medium            | 15                     | 10              |\n| Large             | 10                     | 15              |\n| Extra-Large       | 8                      | 20              |\n| Specialty         | 5                      | 25              |\n\nThe total weight of all deliveries must not exceed 500 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements. Please help the company to determine the optimal number of each type of truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialty trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Small = (S * 20) / 5\nFuel_Medium = (M * 15) / 10\nFuel_Large = (L * 10) / 15\nFuel_ExtraLarge = (XL * 8) / 20\nFuel_Specialty = (Sp * 5) / 25\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The total weight of all deliveries must not exceed 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialty trucks: \", model.getVal(Sp))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make.\n// {\"number of trucks for CityA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company wants to maximize the total net profit from all routes.\n// NetProfit_CityA = (1500 - 500) * TrucksA * TripsA\n// NetProfit_CityB = (1800 - 600) * TrucksB * TripsB\n// NetProfit_CityC = (2100 - 700) * TrucksC * TripsC\n// NetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n// So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\n// TripsA <= 20; TripsB <= 20; TripsC <= 20; TripsD <= 20\n\n## Generate Constraint-3:\nThe company has a budget of $200,000 for operational costs per quarter.\n// 500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200,000\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 trips are made to each city per quarter.\n// TrucksA * TripsA >= 10; TrucksB * TripsB >= 10; TrucksC * TripsC >= 10; TrucksD * TripsD >= 10\n\n## Generate Constraint-5:\nDue to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD <= 1000",
        "question": "A logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make. The cost of operating a truck per trip and the revenue generated per trip for each city are given in the following Table.\n\n| City    | Cost per Trip | Revenue per Trip |\n|---------|---------------|------------------|\n| CityA   | $500          | $1500            |\n| CityB   | $600          | $1800            |\n| CityC   | $700          | $2100            |\n| CityD   | $800          | $2400            |\n\nThe company has a total of 50 trucks available. Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter. The company has a budget of $200,000 for operational costs per quarter. The company must ensure that at least 10 trips are made to each city per quarter. Due to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter.\n\nPlease help the company to maximize the total net profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CityA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CityB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CityC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CityD\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=20) # number of trips per truck for CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=20) # number of trips per truck for CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=20) # number of trips per truck for CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=20) # number of trips per truck for CityD\n\n# Define objective function\nNetProfit_CityA = (1500 - 500) * TrucksA * TripsA\nNetProfit_CityB = (1800 - 600) * TrucksB * TripsB\nNetProfit_CityC = (2100 - 700) * TrucksC * TripsC\nNetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n# So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\nmodel.addCons(TripsA <= 20)\nmodel.addCons(TripsB <= 20)\nmodel.addCons(TripsC <= 20)\nmodel.addCons(TripsD <= 20)\n# The company has a budget of $200,000 for operational costs per quarter.\nmodel.addCons(500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200000)\n# The company must ensure that at least 10 trips are made to each city per quarter.\nmodel.addCons(TrucksA * TripsA >= 10)\nmodel.addCons(TrucksB * TripsB >= 10)\nmodel.addCons(TrucksC * TripsC >= 10)\nmodel.addCons(TrucksD * TripsD >= 10)\n# Due to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CityB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CityC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CityD: \", model.getVal(TrucksD))\n    print(\"Number of Trips per Truck for CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for CityD: \", model.getVal(TripsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"average daily mileage for trucks\": \"TruckMileage\", \"range\": \"TruckMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for vans\": \"VanMileage\", \"range\": \"VanMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for motorcycles\": \"MotorcycleMileage\", \"range\": \"MotorcycleMileage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost for trucks is $0.5 per mile, for vans is $0.3 per mile, and for motorcycles is $0.1 per mile. The company aims to minimize the total daily fuel cost.\n// FuelCost_Trucks = Trucks * TruckMileage * 0.5\n// FuelCost_Vans = Vans * VanMileage * 0.3\n// FuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 per day for vehicle maintenance and fuel.\n// 0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle. The fuel cost for trucks is $0.5 per mile, for vans is $0.3 per mile, and for motorcycles is $0.1 per mile. The company aims to minimize the total daily fuel cost. The company has a total budget of $1000 per day for vehicle maintenance and fuel. Please help the company determine the optimal number of each type of vehicle and their average daily mileage to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nTruckMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckMileage\", lb=0)  # average daily mileage for trucks\nVanMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"VanMileage\", lb=0)  # average daily mileage for vans\nMotorcycleMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"MotorcycleMileage\", lb=0)  # average daily mileage for motorcycles\n\n# Define objective function\nFuelCost_Trucks = Trucks * TruckMileage * 0.5\nFuelCost_Vans = Vans * VanMileage * 0.3\nFuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n# So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n# Add constraints\n# The company has a total budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Truck Mileage: \", model.getVal(TruckMileage))\n    print(\"Van Mileage: \", model.getVal(VanMileage))\n    print(\"Motorcycle Mileage: \", model.getVal(MotorcycleMileage))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region4\": \"Efficiency4\", \"range\": \"Efficiency4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region5\": \"Efficiency5\", \"range\": \"Efficiency5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies. The fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions. The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n\nPlease help the company determine the optimal number of trucks and the investment in fuel efficiency for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks for Region5\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0) # investment in fuel efficiency for Region3\nEfficiency4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency4\", lb=0) # investment in fuel efficiency for Region4\nEfficiency5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency5\", lb=0) # investment in fuel efficiency for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\nCost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\nCost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\nCost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\nCost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Investment in Fuel Efficiency for Region4: \", model.getVal(Efficiency4))\n    print(\"Investment in Fuel Efficiency for Region5: \", model.getVal(Efficiency5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n// Total energy output: Energy = 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3\n// Total cost: Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for this project.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000\n\n## Generate Constraint-3:\nThe total number of wind turbines must not exceed 20.\n// Wind1 + Wind2 + Wind3 <= 20",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). Each solar panel type has a different efficiency and cost, and each wind turbine type also has different characteristics. The company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n\nThe company has a budget of $100,000 for this project. At least 30% of the budget must be spent on solar panels. The total number of wind turbines must not exceed 20.\n\nPlease help the company determine the optimal number of each type of solar panel and wind turbine to install to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\nEnergy = 0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3\nCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy / Cost)\n# convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n# The company has a budget of $100,000 for this project.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000)\n# At least 30% of the budget must be spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000)\n# The total number of wind turbines must not exceed 20.\nmodel.addCons(Wind1 + Wind2 + Wind3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\n// Profit_ProductA = ProductAQty * 50 - WorkersA * 100\n// Profit_ProductB = ProductBQty * 70 - WorkersB * 100\n// Profit_ProductC = ProductCQty * 60 - WorkersC * 100\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company has a total of 50 workers available. The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day. The company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\nPlease help the company to determine the optimal production quantity and worker allocation to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - WorkersA * 100\nProfit_ProductB = ProductBQty * 70 - WorkersB * 100\nProfit_ProductC = ProductCQty * 60 - WorkersC * 100\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n# The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\n// {\"number of solar panels in Region A\": \"SolarPanels_A\", \"range\": \"SolarPanels_A >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindTurbines_A\", \"range\": \"WindTurbines_A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarPanels_B\", \"range\": \"SolarPanels_B >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindTurbines_B\", \"range\": \"WindTurbines_B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarPanels_C\", \"range\": \"SolarPanels_C >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindTurbines_C\", \"range\": \"WindTurbines_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n// Total cost in Region A: Cost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\n// Total cost in Region B: Cost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\n// Total cost in Region C: Cost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\n// Total energy production in Region A: Energy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\n// Total energy production in Region B: Energy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\n// Total energy production in Region C: Energy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total daily energy production in each region must be at least 1000 kWh.\n// Energy_A >= 1000; Energy_B >= 1000; Energy_C >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for installation costs across all regions.\n// Cost_A + Cost_B + Cost_C <= 500,000\n\n## Generate Constraint-3:\nDue to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines.\n// SolarPanels_A <= 500; WindTurbines_A <= 200",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs. The cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The following table summarizes the costs and energy production per unit.\n\n| Equipment | Cost per Unit | Energy Production per Unit |\n|-----------|---------------|----------------------------|\n| Solar Panel | $500         | 100 kWh/day                |\n| Wind Turbine | $1000       | 200 kWh/day                |\n\nThe company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region. The total daily energy production in each region must be at least 1000 kWh. The company has a budget of $500,000 for installation costs across all regions. Due to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines. Please help the company determine the optimal number of solar panels and wind turbines to install in each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels_A = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_A\", lb=0)\nWindTurbines_A = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_A\", lb=0)\nSolarPanels_B = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_B\", lb=0)\nWindTurbines_B = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_B\", lb=0)\nSolarPanels_C = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_C\", lb=0)\nWindTurbines_C = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_C\", lb=0)\n\n# Define objective function\nCost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\nCost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\nCost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nEnergy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\nEnergy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\nEnergy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\nmodel.addCons(Energy_A >= 1000)\nmodel.addCons(Energy_B >= 1000)\nmodel.addCons(Energy_C >= 1000)\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 500000)\nmodel.addCons(SolarPanels_A <= 500)\nmodel.addCons(WindTurbines_A <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarPanels_A))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindTurbines_A))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarPanels_B))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindTurbines_B))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarPanels_C))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindTurbines_C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route.\n// {\"number of trucks for D1\": \"TrucksD1\", \"range\": \"TrucksD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D2\": \"TrucksD2\", \"range\": \"TrucksD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D3\": \"TrucksD3\", \"range\": \"TrucksD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D4\": \"TrucksD4\", \"range\": \"TrucksD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D5\": \"TrucksD5\", \"range\": \"TrucksD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for D1\": \"FuelD1\", \"range\": \"FuelD1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D2\": \"FuelD2\", \"range\": \"FuelD2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D3\": \"FuelD3\", \"range\": \"FuelD3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D4\": \"FuelD4\", \"range\": \"FuelD4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D5\": \"FuelD5\", \"range\": \"FuelD5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company earns a revenue of $1000 per truck per route. The fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed.\n// RevenueD1 = 1000 * TrucksD1\n// RevenueD2 = 1000 * TrucksD2\n// RevenueD3 = 1000 * TrucksD3\n// RevenueD4 = 1000 * TrucksD4\n// RevenueD5 = 1000 * TrucksD5\n// FuelCostD1 = 3 * FuelD1 * TrucksD1\n// FuelCostD2 = 3 * FuelD2 * TrucksD2\n// FuelCostD3 = 3 * FuelD3 * TrucksD3\n// FuelCostD4 = 3 * FuelD4 * TrucksD4\n// FuelCostD5 = 3 * FuelD5 * TrucksD5\n// So, the objective function is: Maximize ((RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)) / (FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 1000 gallons.\n// FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5 <= 1000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route. The company earns a revenue of $1000 per truck per route, and the fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed.\n\n| Destination | Revenue per Truck | Fuel Cost per Gallon |\n|-------------|-------------------|----------------------|\n| D1          | $1000             | $3                   |\n| D2          | $1000             | $3                   |\n| D3          | $1000             | $3                   |\n| D4          | $1000             | $3                   |\n| D5          | $1000             | $3                   |\n\nThe company has a total of 50 trucks available. The total fuel consumption across all routes must not exceed 1000 gallons. Please help the company to maximize the net profit per gallon of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksD1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD1\", lb=0)\nTrucksD2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD2\", lb=0)\nTrucksD3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD3\", lb=0)\nTrucksD4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD4\", lb=0)\nTrucksD5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD5\", lb=0)\nFuelD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD1\", lb=0)\nFuelD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD2\", lb=0)\nFuelD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD3\", lb=0)\nFuelD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD4\", lb=0)\nFuelD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD5\", lb=0)\n\n# Define objective function\nRevenueD1 = 1000 * TrucksD1\nRevenueD2 = 1000 * TrucksD2\nRevenueD3 = 1000 * TrucksD3\nRevenueD4 = 1000 * TrucksD4\nRevenueD5 = 1000 * TrucksD5\nFuelCostD1 = 3 * FuelD1 * TrucksD1\nFuelCostD2 = 3 * FuelD2 * TrucksD2\nFuelCostD3 = 3 * FuelD3 * TrucksD3\nFuelCostD4 = 3 * FuelD4 * TrucksD4\nFuelCostD5 = 3 * FuelD5 * TrucksD5\nTotalFuelConsumption = FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5\nNetProfit = (RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalFuelConsumption == NetProfit)\n\n# Add constraints\nmodel.addCons(TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50)\nmodel.addCons(FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for D1: \", model.getVal(TrucksD1))\n    print(\"Number of Trucks for D2: \", model.getVal(TrucksD2))\n    print(\"Number of Trucks for D3: \", model.getVal(TrucksD3))\n    print(\"Number of Trucks for D4: \", model.getVal(TrucksD4))\n    print(\"Number of Trucks for D5: \", model.getVal(TrucksD5))\n    print(\"Fuel Consumption Rate for D1: \", model.getVal(FuelD1))\n    print(\"Fuel Consumption Rate for D2: \", model.getVal(FuelD2))\n    print(\"Fuel Consumption Rate for D3: \", model.getVal(FuelD3))\n    print(\"Fuel Consumption Rate for D4: \", model.getVal(FuelD4))\n    print(\"Fuel Consumption Rate for D5: \", model.getVal(FuelD5))\n    print(\"Maximized Net Profit per Gallon: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n// Profit_ProductA = 50 * ProductAQty\n// Profit_ProductB = 70 * ProductBQty\n// Profit_ProductC = 60 * ProductCQty\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\n// ProductAQty + ProductBQty + ProductCQty <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| ProductA | $50             |\n| ProductB | $70             |\n| ProductC | $60             |\n\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts. Please help the company determine the optimal production quantity for each product and the number of shifts to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProductAQty\nProfit_ProductB = 70 * ProductBQty\nProfit_ProductC = 60 * ProductCQty\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineD_units\", \"range\": \"MachineD_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 + 0.01 * (MachineA_units)^2, Cost_B = 300 + 0.015 * (MachineB_units)^2, Cost_C = 400 + 0.02 * (MachineC_units)^2, Cost_D = 500 + 0.025 * (MachineD_units)^2. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_A = (500 - Cost_A) * MachineA_units = (500 - (200 + 0.01 * (MachineA_units)^2)) * MachineA_units\n// Total profit for MachineB: Profit_B = (700 - Cost_B) * MachineB_units = (700 - (300 + 0.015 * (MachineB_units)^2)) * MachineB_units\n// Total profit for MachineC: Profit_C = (900 - Cost_C) * MachineC_units = (900 - (400 + 0.02 * (MachineC_units)^2)) * MachineC_units\n// Total profit for MachineD: Profit_D = (1100 - Cost_D) * MachineD_units = (1100 - (500 + 0.025 * (MachineD_units)^2)) * MachineD_units\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit. The profit per unit for each machine and the production cost function, which increases non-linearly with the number of units produced, are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| MachineA | $500           | 200 + 0.01 * (MachineA_units)^2 |\n| MachineB | $700           | 300 + 0.015 * (MachineB_units)^2 |\n| MachineC | $900           | 400 + 0.02 * (MachineC_units)^2 |\n| MachineD | $1100          | 500 + 0.025 * (MachineD_units)^2 |\n\nThe company has a total production capacity of 100 units for the month. Please help the company to maximize the total profit, considering the non-linear production cost functions for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0)\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0)\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0)\nMachineD_units = model.addVar(vtype=\"INTEGER\", name=\"MachineD_units\", lb=0)\n\n# Define objective function\n## Calculate the cost for each machine\nCost_A = 200 + 0.01 * MachineA_units**2\nCost_B = 300 + 0.015 * MachineB_units**2\nCost_C = 400 + 0.02 * MachineC_units**2\nCost_D = 500 + 0.025 * MachineD_units**2\n\n## Calculate the profit for each machine\nProfit_A = (500 - Cost_A) * MachineA_units\nProfit_B = (700 - Cost_B) * MachineB_units\nProfit_C = (900 - Cost_C) * MachineC_units\nProfit_D = (1100 - Cost_D) * MachineD_units\n\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 100 units for the month.\nmodel.addCons(MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Number of MachineD units: \", model.getVal(MachineD_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The company also needs to decide on the budget for advertising each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from ProductA is $100 per unit, but it decreases by $0.5 for every $100 spent on advertising. The profit from ProductB is $150 per unit, decreasing by $0.7 for every $100 spent on advertising. The profit from ProductC is $200 per unit, decreasing by $1 for every $100 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total budget for advertising cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The profit per unit for each product decreases with the increase in advertising budget as shown in the following Table.\n\n| Product | Profit per Unit | Decrease in Profit per $100 of Advertising |\n|---------|-----------------|-------------------------------------------|\n| ProductA | $100            | $0.5                                      |\n| ProductB | $150            | $0.7                                      |\n| ProductC | $200            | $1                                        |\n\nThe total budget for advertising cannot exceed $50,000. The company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0) # advertising budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0) # advertising budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\n## Total profit for ProductB: ProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\n## Total profit for ProductC: ProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\nProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\nProfitC = (200 - 1 * BudgetC / 100) * QuantityC\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total budget for advertising cannot exceed $50,000.\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\n## The company has a maximum production capacity of 1000 units for ProductA, 1500 units for ProductB, and 2000 units for ProductC.\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1500)\nmodel.addCons(QuantityC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120\n\n## Generate Constraint-2:\nMachine 1 can operate for a maximum of 50 hours per week.\n// M1 <= 50\n\n## Generate Constraint-3:\nMachine 2 can operate for a maximum of 60 hours per week.\n// M2 <= 60\n\n## Generate Constraint-4:\nMachine 3 can operate for a maximum of 40 hours per week.\n// M3 <= 40\n\n## Generate Constraint-5:\nThe company must produce at least 1000 units of Product A and 1500 units of Product B per week.\n// 10 * M1 + 8 * M2 + 6 * M3 >= 1000\n// 5 * M1 + 12 * M2 + 15 * M3 >= 1500",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. Product A is valued at $20 per unit and Product B is valued at $30 per unit. The company aims to maximize the total production value. The total operating hours for all machines must not exceed 120 hours per week. Machine 1 can operate for a maximum of 50 hours per week. Machine 2 can operate for a maximum of 60 hours per week. Machine 3 can operate for a maximum of 40 hours per week. The company must produce at least 1000 units of Product A and 1500 units of Product B per week. Please help the company determine the optimal operating hours for each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB) # objective function\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 120) # total operating hours for all machines must not exceed 120 hours per week\nmodel.addCons(M1 <= 50) # Machine 1 can operate for a maximum of 50 hours per week\nmodel.addCons(M2 <= 60) # Machine 2 can operate for a maximum of 60 hours per week\nmodel.addCons(M3 <= 40) # Machine 3 can operate for a maximum of 40 hours per week\nmodel.addCons(10 * M1 + 8 * M2 + 6 * M3 >= 1000) # the company must produce at least 1000 units of Product A per week\nmodel.addCons(5 * M1 + 12 * M2 + 15 * M3 >= 1500) # the company must produce at least 1500 units of Product B per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n// Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\n// Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\n// Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per day.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products. The company has a total production capacity of 500 units per day. Please help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 20 * A1 * A_b1 + (20 + 0.05 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 30 * B1 * B_b1 + (30 + 0.05 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 40 * C1 * C_b1 + (40 + 0.05 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport goods across different routes. The company needs to decide the number of trucks to allocate to each route and the speed at which each truck should travel to minimize fuel consumption and time.\n// {\"number of trucks for Route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks for Route B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of trucks on Route A is modeled as 0.05 * SpeedA^2 liters per kilometer, and on Route B as 0.07 * SpeedB^2 liters per kilometer. The total distance for Route A is 500 km, and for Route B is 700 km. The company aims to minimize the total fuel consumption and the total time spent on both routes.\n// Fuel_Consumption_A = 0.05 * SpeedA^2 * 500 * TrucksA\n// Fuel_Consumption_B = 0.07 * SpeedB^2 * 700 * TrucksB\n// Time_A = 500 / SpeedA * TrucksA\n// Time_B = 700 / SpeedB * TrucksB\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Time_A + Time_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 0.05 * SpeedA^2 * 500 * TrucksA + 0.07 * SpeedB^2 * 700 * TrucksB <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 20 trucks available.\n// TrucksA + TrucksB <= 20\n\n## Generate Constraint-3:\nThe total time spent on both routes should not exceed 100 hours.\n// 500 / SpeedA * TrucksA + 700 / SpeedB * TrucksB <= 100\n\n## Generate Constraint-4:\nThe speed of trucks on Route A must be at least 40 km/h.\n// SpeedA >= 40",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport goods across different routes. The company needs to decide the number of trucks to allocate to each route and the speed at which each truck should travel to minimize fuel consumption and time. The fuel consumption of trucks on Route A is modeled as 0.05 * SpeedA^2 liters per kilometer, and on Route B as 0.07 * SpeedB^2 liters per kilometer. The total distance for Route A is 500 km, and for Route B is 700 km. The company has a total budget of $10,000 for fuel costs. The company has a maximum of 20 trucks available. The total time spent on both routes should not exceed 100 hours. The speed of trucks on Route A must be at least 40 km/h.\nPlease help the company to minimize the total fuel consumption and the total time spent on both routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Route B\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=40)  # speed of trucks for Route A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for Route B\n\n# Define objective function\nFuel_Consumption_A = 0.05 * SpeedA**2 * 500 * TrucksA\nFuel_Consumption_B = 0.07 * SpeedB**2 * 700 * TrucksB\nTime_A = 500 / SpeedA * TrucksA\nTime_B = 700 / SpeedB * TrucksB\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Time_A + Time_B)\n\n# Add constraints\nmodel.addCons(0.05 * SpeedA**2 * 500 * TrucksA + 0.07 * SpeedB**2 * 700 * TrucksB <= 10000)  # Budget constraint\nmodel.addCons(TrucksA + TrucksB <= 20)  # Maximum trucks constraint\nmodel.addCons(500 / SpeedA * TrucksA + 700 / SpeedB * TrucksB <= 100)  # Time constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Speed of Trucks for Route A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for Route B: \", model.getVal(SpeedB))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck in Region A is $100, and it decreases by $0.10 for each additional truck allocated. \nThe fuel cost per truck in Region B is $120, and it decreases by $0.15 for each additional truck allocated. \nThe fuel cost per truck in Region C is $90, and it decreases by $0.08 for each additional truck allocated.\nThe fuel cost per truck in Region D is $110, and it decreases by $0.12 for each additional truck allocated.\nThe fuel cost per truck in Region E is $130, and it decreases by $0.20 for each additional truck allocated.\nThe company wants to minimize the total fuel cost across all regions.\n// Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\n// Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\n// Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\n// Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\n// Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\n// So, the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nEach region has a minimum requirement for trucks. Region A requires at least 10 trucks, Region B requires at least 15 trucks, Region C requires at least 8 trucks, Region D requires at least 12 trucks, and Region E requires at least 20 trucks.\n// TruckA >= 10; TruckB >= 15; TruckC >= 8; TruckD >= 12; TruckE >= 20",
        "question": "A logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. The fuel cost per truck in each region decreases as more trucks are allocated, as shown in the following Table.\n\n| Region | Initial Fuel Cost per Truck | Decrease in Cost per Additional Truck |\n|--------|-----------------------------|---------------------------------------|\n| A      | $100                        | $0.10                                |\n| B      | $120                        | $0.15                                |\n| C      | $90                         | $0.08                                |\n| D      | $110                        | $0.12                                |\n| E      | $130                        | $0.20                                |\n\nThe company has a total of 100 trucks available for allocation. Each region has a minimum requirement for trucks: Region A requires at least 10 trucks, Region B requires at least 15 trucks, Region C requires at least 8 trucks, Region D requires at least 12 trucks, and Region E requires at least 20 trucks. The company wants to minimize the total fuel cost across all regions.\n\nPlease help the company determine the optimal allocation of trucks to each region to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=15) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=8) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=12) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=20) # number of trucks in Region E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=10, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=10, ub=100)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TruckA == A1*A_b1 + A2*A_b2)\nFuel_Cost_A = 100 * A1 * A_b1 + (100 - 0.10 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=15, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=15, ub=100)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TruckB == B1*B_b1 + B2*B_b2)\nFuel_Cost_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=8, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=8, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TruckC == C1*C_b1 + C2*C_b2)\nFuel_Cost_C = 90 * C1 * C_b1 + (90 - 0.08 * (C2 - 1)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=12, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=12, ub=100)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TruckD == D1*D_b1 + D2*D_b2)\nFuel_Cost_D = 110 * D1 * D_b1 + (110 - 0.12 * (D2 - 1)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=20, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=20, ub=100)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TruckE == E1*E_b1 + E2*E_b2)\nFuel_Cost_E = 130 * E1 * E_b1 + (130 - 0.20 * (E2 - 1)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_A = 50 * ProductA\n// Profit_B = 70 * ProductB\n// Profit_C = 60 * ProductC\n// ShiftCost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n// ProductA + ProductB + ProductC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts. Please help the company to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nProfit_A = 50 * ProductA\nProfit_B = 70 * ProductB\nProfit_C = 60 * ProductC\nShiftCost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - ShiftCost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances.\nIn region 1, each truck consumes 5 liters per km.\nIn region 2, each truck consumes 7 liters per km.\nIn region 3, each truck consumes 9 liters per km.\nIn region 4, each truck consumes 11 liters per km.\nIn region 5, each truck consumes 13 liters per km.\nThe company aims to minimize the total fuel consumption while ensuring timely deliveries.\n// Fuel consumption in region 1: FC1 = 5 * T1\n// Fuel consumption in region 2: FC2 = 7 * T2\n// Fuel consumption in region 3: FC3 = 9 * T3\n// Fuel consumption in region 4: FC4 = 11 * T4\n// Fuel consumption in region 5: FC5 = 13 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs.\n// 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000",
        "question": "A logistics company operates a fleet of trucks to transport goods across five different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. The fuel consumption rate for each region is different due to varying road conditions and distances.\n\n| Region | Fuel Consumption Rate (liters per km) |\n|--------|--------------------------------------|\n| 1      | 5                                    |\n| 2      | 7                                    |\n| 3      | 9                                    |\n| 4      | 11                                   |\n| 5      | 13                                   |\n\nThe company has a total budget of $50,000 for fuel costs. Please help the company to minimize the total fuel consumption while ensuring timely deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks in region 5\n\n# Define objective function\nFC1 = 5 * T1\nFC2 = 7 * T2\nFC3 = 9 * T3\nFC4 = 11 * T4\nFC5 = 13 * T5\n# So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel costs.\nmodel.addCons(5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R\", \"range\": \"R >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and the initial efficiency of wind turbines is 30%. The cost of energy storage is $100 per unit, and the storage efficiency is 95%. The company aims to maximize the total energy output (in kWh) from the renewable energy system.\n// Energy_output_solar = 0.2 * (1 + 0.0001 * R) * S\n// Energy_output_wind = 0.3 * (1 + 0.00005 * R) * W\n// Energy_output_storage = 0.95 * E\n// So, the objective function is: Maximize (Energy_output_solar + Energy_output_wind + Energy_output_storage)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of a solar panel is $500, a wind turbine is $1,000, and energy storage is $100 per unit.\n// 500 * S + 1000 * W + 100 * E <= 1000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $100,000.\n// R <= 100000\n\n## Generate Constraint-3:\nDue to land constraints, the total number of solar panels and wind turbines cannot exceed 2,000 units.\n// S + W <= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 500 solar panels are installed.\n// S >= 500",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), the amount of energy storage (E), and the investment in research and development (R) to maximize the efficiency of the renewable energy system. The efficiency of solar panels increases by 1% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 0.5% for every $10,000 invested in R&D. The initial efficiency of solar panels is 20%, and the initial efficiency of wind turbines is 30%. The cost of energy storage is $100 per unit, and the storage efficiency is 95%. The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of a solar panel is $500, a wind turbine is $1,000, and energy storage is $100 per unit. The total investment in R&D cannot exceed $100,000. Due to land constraints, the total number of solar panels and wind turbines cannot exceed 2,000 units. The company must ensure that at least 500 solar panels are installed. Please help the company to maximize the total energy output (in kWh) from the renewable energy system.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=500)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0)    # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # amount of energy storage\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0)  # investment in R&D\n\n# Define objective function\nEnergy_output_solar = 0.2 * (1 + 0.0001 * R) * S\nEnergy_output_wind = 0.3 * (1 + 0.00005 * R) * W\nEnergy_output_storage = 0.95 * E\n# So, the objective function is: Maximize (Energy_output_solar + Energy_output_wind + Energy_output_storage)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output_solar + Energy_output_wind + Energy_output_storage)\n\n# Add constraints\n# The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage.\nmodel.addCons(500 * S + 1000 * W + 100 * E <= 1000000)\n# The total investment in R&D cannot exceed $100,000.\nmodel.addCons(R <= 100000)\n# Due to land constraints, the total number of solar panels and wind turbines cannot exceed 2,000 units.\nmodel.addCons(S + W <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Investment in R&D: \", model.getVal(R))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"ProductA_Units\", \"range\": \"ProductA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB_Units\", \"range\": \"ProductB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC_Units\", \"range\": \"ProductC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD_Units\", \"range\": \"ProductD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $110. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.01 * ProductA_Units^2) * ProductA_Units\n// Profit_ProductB = (70 - 0.02 * ProductB_Units^2) * ProductB_Units\n// Profit_ProductC = (90 - 0.03 * ProductC_Units^2) * ProductC_Units\n// Profit_ProductD = (110 - 0.04 * ProductD_Units^2) * ProductD_Units\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductA_Units >= 2 * ProductB_Units\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $50,000. The cost of raw materials per unit for ProductA is $10, for ProductB is $20, for ProductC is $30, and for ProductD is $40.\n// 10 * ProductA_Units + 20 * ProductB_Units + 30 * ProductC_Units + 40 * ProductD_Units <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each product has at least some minimal production to meet market presence.\n// ProductA_Units >= 10; ProductB_Units >= 5; ProductC_Units >= 15; ProductD_Units >= 20",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit |\n|---------|-----------------|----------------------------|\n| ProductA | $50 - 0.01 * (ProductA_Units^2) | $10 |\n| ProductB | $70 - 0.02 * (ProductB_Units^2) | $20 |\n| ProductC | $90 - 0.03 * (ProductC_Units^2) | $30 |\n| ProductD | $110 - 0.04 * (ProductD_Units^2) | $40 |\n\nThe company has a total production capacity of 1000 units for all products combined. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a budget constraint for raw materials, which is $50,000. The company wants to ensure that each product has at least some minimal production to meet market presence, with ProductA_Units >= 10, ProductB_Units >= 5, ProductC_Units >= 15, and ProductD_Units >= 20.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Units\", lb=10)\nProductB_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Units\", lb=5)\nProductC_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Units\", lb=15)\nProductD_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductD_Units\", lb=20)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculations with quadratic cost\nProfit_ProductA = (50 - 0.01 * ProductA_Units**2) * ProductA_Units\nProfit_ProductB = (70 - 0.02 * ProductB_Units**2) * ProductB_Units\nProfit_ProductC = (90 - 0.03 * ProductC_Units**2) * ProductC_Units\nProfit_ProductD = (110 - 0.04 * ProductD_Units**2) * ProductD_Units\n\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000)\n\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductA_Units >= 2 * ProductB_Units)\n\n## The company has a budget constraint for raw materials, which is $50,000.\nmodel.addCons(10 * ProductA_Units + 20 * ProductB_Units + 30 * ProductC_Units + 40 * ProductD_Units <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductA_Units))\n    print(\"Number of ProductB Units: \", model.getVal(ProductB_Units))\n    print(\"Number of ProductC Units: \", model.getVal(ProductC_Units))\n    print(\"Number of ProductD Units: \", model.getVal(ProductD_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductA\": \"QualityControlA\", \"range\": \"QualityControlA >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductB\": \"QualityControlB\", \"range\": \"QualityControlB >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductC\": \"QualityControlC\", \"range\": \"QualityControlC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n// Total revenue for ProductA: RevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\n// Total cost for ProductA: CostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\n// Total cost for ProductB: CostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\n// Total cost for ProductC: CostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total budget for marketing and quality control cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 1000 units of each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000\n\n## Generate Constraint-3:\nThe company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB.\n// MarketingBudgetA >= 10000; MarketingBudgetB >= 15000\n\n## Generate Constraint-4:\nThe total quality control investment for all products must be at least $20,000.\n// QualityControlA + QualityControlB + QualityControlC >= 20000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit, production cost, and initial defect rate for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost | Initial Defect Rate |\n|---------|------------------|-----------------|---------------------|\n| ProductA | $100             | $50             | 5%                  |\n| ProductB | $150             | $75             | 5%                  |\n| ProductC | $200             | $100            | 5%                  |\n\nThe company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control). The marketing budget increases the sales linearly at a rate of $5 per $1000 spent, and the quality control investment reduces the defect rate by 1% for every $1000 invested.\n\nThe company has the following constraints:\n1. The total budget for marketing and quality control cannot exceed $100,000.\n2. The company can produce a maximum of 1000 units of each product.\n3. The company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB.\n4. The total quality control investment for all products must be at least $20,000.\n\nPlease help the company determine the optimal production quantity, marketing budget, and quality control investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nQualityControlA = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlA\", lb=0) # quality control investment for ProductA\nQualityControlB = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlB\", lb=0) # quality control investment for ProductB\nQualityControlC = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlC\", lb=0) # quality control investment for ProductC\n\n# Define objective function\nRevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\nRevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\nRevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\nCostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\nCostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\nCostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\nTotalProfit = RevenueA - CostA + RevenueB - CostB + RevenueC - CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\nmodel.addCons(MarketingBudgetA >= 10000)\nmodel.addCons(MarketingBudgetB >= 15000)\nmodel.addCons(QualityControlA + QualityControlB + QualityControlC >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Quality Control Investment for ProductA: \", model.getVal(QualityControlA))\n    print(\"Quality Control Investment for ProductB: \", model.getVal(QualityControlB))\n    print(\"Quality Control Investment for ProductC: \", model.getVal(QualityControlC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1704,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations.\n// {\"number of trips to city A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies nonlinearly with the distance traveled and the load carried. The cost function for each city is given by: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips.\n// So, the objective function is: Minimize (0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for fuel costs this month.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2 <= 5000\n\n## Generate Constraint-2:\nThe company must make at least 5 trips to each city this month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trips across all cities must not exceed 100.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe number of trips to city D must not exceed the combined number of trips to cities A and B.\n// D <= A + B",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations. The cost of fuel per trip varies nonlinearly with the distance traveled and the load carried. The cost function for each city is given by: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips. The company has a budget of $5000 for fuel costs this month. The company must make at least 5 trips to each city this month. The total number of trips across all cities must not exceed 100. The number of trips to city D must not exceed the combined number of trips to cities A and B. Please help the company to minimize the total fuel cost across all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of trips to city A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5)  # number of trips to city B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5)  # number of trips to city C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5)  # number of trips to city D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5)  # number of trips to city E\n\n# Define objective function\nCost_A = 0.05 * A**2\nCost_B = 0.07 * B**2\nCost_C = 0.09 * C**2\nCost_D = 0.11 * D**2\nCost_E = 0.13 * E**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a budget of $5000 for fuel costs this month.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 5000)\n# The total number of trips across all cities must not exceed 100.\nmodel.addCons(A + B + C + D + E <= 100)\n# The number of trips to city D must not exceed the combined number of trips to cities A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to city A: \", model.getVal(A))\n    print(\"Number of trips to city B: \", model.getVal(B))\n    print(\"Number of trips to city C: \", model.getVal(C))\n    print(\"Number of trips to city D: \", model.getVal(D))\n    print(\"Number of trips to city E: \", model.getVal(E))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company wants to maximize the energy output while minimizing the carbon footprint.\n// Energy Output = 15% * 1000 * Solar1 + 20% * 1500 * Solar2 + 25% * 2000 * Solar3 + 30% * 2500 * Solar4 + 35% * 3000 * Solar5 + 20% * 2000 * Wind1 + 25% * 2500 * Wind2 + 30% * 3000 * Wind3\n// Carbon Footprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n// So, the objective function is: Maximize Energy Output / Carbon Footprint\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000\n\n## Generate Constraint-3:\nThe total number of solar panels and wind turbines must not exceed 1000.\n// Solar1 + Solar2 + Solar3 + Solar4 + Solar5 + Wind1 + Wind2 + Wind3 <= 1000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). Each solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company has a budget of $1,000,000 for the installation. At least 30% of the budget must be spent on solar panels. The total number of solar panels and wind turbines must not exceed 1000.\nPlease help the company to maximize the energy output while minimizing the carbon footprint.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput = 0.15 * 1000 * Solar1 + 0.20 * 1500 * Solar2 + 0.25 * 2000 * Solar3 + 0.30 * 2500 * Solar4 + 0.35 * 3000 * Solar5 + 0.20 * 2000 * Wind1 + 0.25 * 2500 * Wind2 + 0.30 * 3000 * Wind3\nCarbonFootprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n## the objective function is: Maximize Energy Output / Carbon Footprint\n## convert the division to multiplication\nmodel.addCons(obj * CarbonFootprint == EnergyOutput)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000)\n## At least 30% of the budget must be spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000)\n## The total number of solar panels and wind turbines must not exceed 1000.\nmodel.addCons(Solar1 + Solar2 + Solar3 + Solar4 + Solar5 + Wind1 + Wind2 + Wind3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output / Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the number of trips each truck should make to maximize profit. The profit per trip varies with the truck size and the number of trips made.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for a Small truck is $200, for a Medium truck is $300, and for a Large truck is $400. However, the cost of operation per trip increases nonlinearly with the number of trips due to wear and tear. The cost function is quadratic, with the cost per trip for a Small truck being $100 + 0.1 * SmallTrips^2, for a Medium truck being $150 + 0.15 * MediumTrips^2, and for a Large truck being $200 + 0.2 * LargeTrips^2. The company aims to maximize the total daily profit from all trucks.\n// Profit_Small = SmallTrucks * SmallTrips * (200 - (100 + 0.1 * SmallTrips^2))\n// Profit_Medium = MediumTrucks * MediumTrips * (300 - (150 + 0.15 * MediumTrips^2))\n// Profit_Large = LargeTrucks * LargeTrips * (400 - (200 + 0.2 * LargeTrips^2))\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to purchase trucks. The cost of a Small truck is $500, a Medium truck is $1000, and a Large truck is $1500.\n// 500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks <= 10000\n\n## Generate Constraint-2:\nThe company has a daily operational capacity of 200 trips in total.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 200",
        "question": "A logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the number of trips each truck should make to maximize profit. The profit per trip varies with the truck size and the number of trips made. The profit and cost per trip for each type of truck are given in the following Table.\n\n| Truck Type | Profit per Trip | Cost per Trip (including wear and tear) |\n|------------|-----------------|-----------------------------------------|\n| Small      | $200            | $100 + 0.1 * SmallTrips^2               |\n| Medium     | $300            | $150 + 0.15 * MediumTrips^2             |\n| Large      | $400            | $200 + 0.2 * LargeTrips^2               |\n\nThe company has a budget of $10,000 to purchase trucks. The cost of a Small truck is $500, a Medium truck is $1000, and a Large truck is $1500. The company has a daily operational capacity of 200 trips in total. \n\nPlease help the company to maximize the total daily profit from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit calculation with quadratic cost\nProfit_Small = SmallTrucks * SmallTrips * (200 - (100 + 0.1 * SmallTrips**2))\nProfit_Medium = MediumTrucks * MediumTrips * (300 - (150 + 0.15 * MediumTrips**2))\nProfit_Large = LargeTrucks * LargeTrips * (400 - (200 + 0.2 * LargeTrips**2))\n## the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n## The company has a budget of $10,000 to purchase trucks.\nmodel.addCons(500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks <= 10000)\n## The company has a daily operational capacity of 200 trips in total.\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\nFor city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city.\nPlease help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each city.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\n## The company aims to minimize the total fuel consumption and travel time.\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n## So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck depends on the route it takes. For route A, each truck consumes 100 liters of fuel per trip. For route B, each truck consumes 120 liters of fuel per trip. For route C, each truck consumes 150 liters of fuel per trip. For route D, each truck consumes 200 liters of fuel per trip. The company aims to minimize the total fuel consumption per day.\n// Fuel_Consumption_A = 100 * TrucksA\n// Fuel_Consumption_B = 120 * TrucksB\n// Fuel_Consumption_C = 150 * TrucksC\n// Fuel_Consumption_D = 200 * TrucksD\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $5000 for fuel costs.\n// 100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000\n\n## Generate Constraint-3:\nThe demand for goods transportation on route A is at least 10 trips per day.\n// TrucksA >= 10",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route. The fuel consumption of each truck per trip for each route is given in the following Table.\n\n| Route | Fuel Consumption per Trip |\n|-------|---------------------------|\n| A     | 100 liters                |\n| B     | 120 liters                |\n| C     | 150 liters                |\n| D     | 200 liters                |\n\nThe company has a total of 50 trucks available. The company has a daily budget of $5000 for fuel costs. The demand for goods transportation on route A is at least 10 trips per day. Please help the company to minimize the total fuel consumption per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\n\n# Define objective function\nFuel_Consumption_A = 100 * TrucksA\nFuel_Consumption_B = 120 * TrucksB\nFuel_Consumption_C = 150 * TrucksC\nFuel_Consumption_D = 200 * TrucksD\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# The company has a daily budget of $5000 for fuel costs.\nmodel.addCons(100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost.\n// Total cargo capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total operational cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n// So, the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive.\n// E >= 0.1 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations. The operational costs and capacities for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Month | Capacity (tons) |\n|------------|----------------------------|-----------------|\n| Truck A    | $1000                      | 10              |\n| Truck B    | $1500                      | 15              |\n| Truck C    | $2000                      | 20              |\n| Truck D    | $2500                      | 25              |\n| Truck E    | $3000                      | 30              |\n\nThe company has a budget of $100,000 for operational costs for the month. The company can deploy at most 50 trucks in total. The company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive. \nPlease help the company to maximize its total cargo capacity while minimizing the total operational cost by maximizing the ratio of total cargo capacity to total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCargoCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nTotalOperationalCost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n## the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n## convert the division to multiplication\nmodel.addCons(obj * TotalOperationalCost == TotalCargoCapacity)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000)\n## The company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive.\nmodel.addCons(E >= 0.1 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Operational Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has a different fuel efficiency and maintenance cost. The company also needs to decide on the investment in a new fuel-efficient technology that can be applied to each vehicle type to reduce fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TechTrucks\", \"range\": \"TechTrucks >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"TechVans\", \"range\": \"TechVans >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"TechBikes\", \"range\": \"TechBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in the new technology. For Trucks, the fuel efficiency increases by 0.5% for every $100 invested in technology. For Vans, the increase is 0.7% per $100, and for Bikes, it's 1% per $100. The maintenance cost decreases by $2 for Trucks, $1.5 for Vans, and $1 for Bikes for every $100 invested in technology. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for Trucks: FuelTrucks = (BaseFuelCost * Trucks) / (1 + 0.005 * TechTrucks / 100)\n// Fuel cost for Vans: FuelVans = (BaseFuelCost * Vans) / (1 + 0.007 * TechVans / 100)\n// Fuel cost for Bikes: FuelBikes = (BaseFuelCost * Bikes) / (1 + 0.01 * TechBikes / 100)\n// Maintenance cost for Trucks: MaintTrucks = (BaseMaintCost * Trucks) - (2 * TechTrucks)\n// Maintenance cost for Vans: MaintVans = (BaseMaintCost * Vans) - (1.5 * TechVans)\n// Maintenance cost for Bikes: MaintBikes = (BaseMaintCost * Bikes) - (1 * TechBikes)\n// So, the objective function is: Minimize (FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and technology investments.\n// Trucks + Vans + Bikes + TechTrucks + TechVans + TechBikes <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles must not exceed 500.\n// Trucks + Vans + Bikes <= 500\n\n## Generate Constraint-3:\nThe company must have at least 100 Trucks and 50 Vans.\n// Trucks >= 100; Vans >= 50",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of Trucks, Vans, and Bikes, as well as the investment in a new fuel-efficient technology for each vehicle type. The investment in technology improves fuel efficiency and reduces maintenance costs. The details of the fuel efficiency improvement and maintenance cost reduction per $100 invested in technology are as follows:\n\n| Vehicle Type | Fuel Efficiency Improvement | Maintenance Cost Reduction |\n|--------------|-----------------------------|----------------------------|\n| Trucks       | 0.5% per $100               | $2                        |\n| Vans         | 0.7% per $100               | $1.5                      |\n| Bikes        | 1% per $100                 | $1                        |\n\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The company has a budget of $100,000 for vehicle purchases and technology investments. The total number of vehicles must not exceed 500. The company must have at least 100 Trucks and 50 Vans.\n\nPlease help the company determine the optimal number of each vehicle type and the investment in fuel-efficient technology to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=100)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=50)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"TechTrucks\", lb=0)  # investment in fuel-efficient technology for Trucks\nTechVans = model.addVar(vtype=\"CONTINUOUS\", name=\"TechVans\", lb=0)  # investment in fuel-efficient technology for Vans\nTechBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"TechBikes\", lb=0)  # investment in fuel-efficient technology for Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate fuel and maintenance costs\nBaseFuelCost = 100  # placeholder for base fuel cost per vehicle\nBaseMaintCost = 50   # placeholder for base maintenance cost per vehicle\nFuelTrucks = (BaseFuelCost * Trucks) / (1 + 0.005 * TechTrucks / 100)\nFuelVans = (BaseFuelCost * Vans) / (1 + 0.007 * TechVans / 100)\nFuelBikes = (BaseFuelCost * Bikes) / (1 + 0.01 * TechBikes / 100)\nMaintTrucks = (BaseMaintCost * Trucks) - (2 * TechTrucks)\nMaintVans = (BaseMaintCost * Vans) - (1.5 * TechVans)\nMaintBikes = (BaseMaintCost * Bikes) - (1 * TechBikes)\n\n## the objective function is: Minimize (FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\nmodel.addCons(obj == FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and technology investments.\nmodel.addCons(Trucks + Vans + Bikes + TechTrucks + TechVans + TechBikes <= 100000)\n## The total number of vehicles must not exceed 500.\nmodel.addCons(Trucks + Vans + Bikes <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Tech for Trucks: \", model.getVal(TechTrucks))\n    print(\"Investment in Tech for Vans: \", model.getVal(TechVans))\n    print(\"Investment in Tech for Bikes: \", model.getVal(TechBikes))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a new location. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install, as well as the investment amount ($) in energy storage systems (StorageInvestment) to optimize the energy output and storage. The energy storage system affects the efficiency and capacity of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"StorageInvestment\", \"range\": \"StorageInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of both solar panels and wind turbines increases with the investment in energy storage systems. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from both sources.\n// Total energy output from solar panels: EnergySolar = (200 + 0.005 * StorageInvestment) * SolarPanels\n// Total energy output from wind turbines: EnergyWind = (500 + 0.01 * StorageInvestment) * WindTurbines\n// So, the objective function is: Maximize (EnergySolar + EnergyWind)\n\n## Generate Constraint-1:\nThe total budget for the installation and storage investment is $1,000,000.\n// SolarPanels + WindTurbines + StorageInvestment <= 1,000,000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a new location. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install, as well as the investment amount ($) in energy storage systems (StorageInvestment) to optimize the energy output and storage. The energy storage system affects the efficiency and capacity of both solar panels and wind turbines. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from both sources.\n\n| Component                | Initial Output | Increase per $1,000 Storage Investment |\n|--------------------------|----------------|----------------------------------------|\n| Solar Panels (per unit)  | 200 kWh        | 5 kWh                                  |\n| Wind Turbines (per unit) | 500 kWh        | 10 kWh                                 |\n\nThe total budget for the installation and storage investment is $1,000,000. Please help the company to maximize the total energy output from both solar panels and wind turbines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0) # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0) # number of wind turbines\nStorageInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageInvestment\", lb=0) # investment in energy storage systems\n\n# Define objective function\nEnergySolar = (200 + 0.005 * StorageInvestment) * SolarPanels\nEnergyWind = (500 + 0.01 * StorageInvestment) * WindTurbines\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind)\n\n# Add constraints\nmodel.addCons(SolarPanels + WindTurbines + StorageInvestment <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(StorageInvestment))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1282,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"SpecialtyTrucks\", \"range\": \"SpecialtyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type varies with the number of trucks in operation. Small trucks have a base fuel efficiency of 20 km/l, Medium trucks 15 km/l, Large trucks 10 km/l, Extra-Large trucks 8 km/l, and Specialty trucks 5 km/l. The fuel efficiency improves by 0.1 km/l for each additional truck of the same type beyond the first 10 trucks. The company wants to minimize the total fuel consumption while meeting customer demand.\n// Fuel_Small = (20 + 0.1 * max(SmallTrucks - 10, 0)) * SmallTrucks\n// Fuel_Medium = (15 + 0.1 * max(MediumTrucks - 10, 0)) * MediumTrucks\n// Fuel_Large = (10 + 0.1 * max(LargeTrucks - 10, 0)) * LargeTrucks\n// Fuel_ExtraLarge = (8 + 0.1 * max(ExtraLargeTrucks - 10, 0)) * ExtraLargeTrucks\n// Fuel_Specialty = (5 + 0.1 * max(SpecialtyTrucks - 10, 0)) * SpecialtyTrucks\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must have at least 5 Small trucks and 3 Specialty trucks.\n// SmallTrucks >= 5; SpecialtyTrucks >= 3",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand. The fuel efficiency of each truck type varies with the number of trucks in operation. Small trucks have a base fuel efficiency of 20 km/l, Medium trucks 15 km/l, Large trucks 10 km/l, Extra-Large trucks 8 km/l, and Specialty trucks 5 km/l. The fuel efficiency improves by 0.1 km/l for each additional truck of the same type beyond the first 10 trucks. The company wants to minimize the total fuel consumption while meeting customer demand. The company has a total fleet size of 100 trucks. Due to contractual agreements, the company must have at least 5 Small trucks and 3 Specialty trucks. Please help the company to minimize the total fuel consumption (which is defined as the sum of the fuel consumption for each type of truck).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=5)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nSpecialtyTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks\", lb=3)  # number of Specialty trucks\n\n# Define objective function\n# Create piecewise variables for fuel efficiency\nSmallTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks1\", lb=0, ub=10)\nSmallTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks2\", lb=10, ub=100)\nSmall_b1 = model.addVar(vtype=\"B\", name=\"Small_b1\")\nSmall_b2 = model.addVar(vtype=\"B\", name=\"Small_b2\")\nmodel.addCons(Small_b1 + Small_b2 == 1)\nmodel.addCons(SmallTrucks == SmallTrucks1*Small_b1 + SmallTrucks2*Small_b2)\nFuel_Small = (20 + 0.1 * (SmallTrucks2 - 10)) * SmallTrucks2 * Small_b2 + 20 * SmallTrucks1 * Small_b1\n\nMediumTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks1\", lb=0, ub=10)\nMediumTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks2\", lb=10, ub=100)\nMedium_b1 = model.addVar(vtype=\"B\", name=\"Medium_b1\")\nMedium_b2 = model.addVar(vtype=\"B\", name=\"Medium_b2\")\nmodel.addCons(Medium_b1 + Medium_b2 == 1)\nmodel.addCons(MediumTrucks == MediumTrucks1*Medium_b1 + MediumTrucks2*Medium_b2)\nFuel_Medium = (15 + 0.1 * (MediumTrucks2 - 10)) * MediumTrucks2 * Medium_b2 + 15 * MediumTrucks1 * Medium_b1\n\nLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks1\", lb=0, ub=10)\nLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks2\", lb=10, ub=100)\nLarge_b1 = model.addVar(vtype=\"B\", name=\"Large_b1\")\nLarge_b2 = model.addVar(vtype=\"B\", name=\"Large_b2\")\nmodel.addCons(Large_b1 + Large_b2 == 1)\nmodel.addCons(LargeTrucks == LargeTrucks1*Large_b1 + LargeTrucks2*Large_b2)\nFuel_Large = (10 + 0.1 * (LargeTrucks2 - 10)) * LargeTrucks2 * Large_b2 + 10 * LargeTrucks1 * Large_b1\n\nExtraLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks1\", lb=0, ub=10)\nExtraLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks2\", lb=10, ub=100)\nExtraLarge_b1 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b1\")\nExtraLarge_b2 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b2\")\nmodel.addCons(ExtraLarge_b1 + ExtraLarge_b2 == 1)\nmodel.addCons(ExtraLargeTrucks == ExtraLargeTrucks1*ExtraLarge_b1 + ExtraLargeTrucks2*ExtraLarge_b2)\nFuel_ExtraLarge = (8 + 0.1 * (ExtraLargeTrucks2 - 10)) * ExtraLargeTrucks2 * ExtraLarge_b2 + 8 * ExtraLargeTrucks1 * ExtraLarge_b1\n\nSpecialtyTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks1\", lb=0, ub=10)\nSpecialtyTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks2\", lb=10, ub=100)\nSpecialty_b1 = model.addVar(vtype=\"B\", name=\"Specialty_b1\")\nSpecialty_b2 = model.addVar(vtype=\"B\", name=\"Specialty_b2\")\nmodel.addCons(Specialty_b1 + Specialty_b2 == 1)\nmodel.addCons(SpecialtyTrucks == SpecialtyTrucks1*Specialty_b1 + SpecialtyTrucks2*Specialty_b2)\nFuel_Specialty = (5 + 0.1 * (SpecialtyTrucks2 - 10)) * SpecialtyTrucks2 * Specialty_b2 + 5 * SpecialtyTrucks1 * Specialty_b1\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Specialty Trucks: \", model.getVal(SpecialtyTrucks))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks.\n// Objective function: Minimize C_S + C_M + C_L + C_XL + C_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\n// 5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000\n\n## Generate Constraint-2:\nThere is a limit on the number of trucks that can be operated due to licensing and maintenance constraints. The maximum number of each type of truck is:\n- Small truck: 10\n- Medium truck: 8\n- Large truck: 6\n- Extra-Large truck: 4\n- Refrigerated truck: 2\n// S <= 10; M <= 8; L <= 6; XL <= 4; R <= 2\n\n## Generate Constraint-3:\nThe total number of trucks in the fleet must not exceed 20 due to parking and operational constraints.\n// S + M + L + XL + R <= 20",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks.\n\nThe company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\n\nThere is a limit on the number of trucks that can be operated due to licensing and maintenance constraints. The maximum number of each type of truck is:\n- Small truck: 10\n- Medium truck: 8\n- Large truck: 6\n- Extra-Large truck: 4\n- Refrigerated truck: 2\n\nThe total number of trucks in the fleet must not exceed 20 due to parking and operational constraints.\n\nPlease help the company to determine the optimal number of each type of truck to minimize the total operating cost while adhering to the budget and operational constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=10)  # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=8)   # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=6)   # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0, ub=4) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=2)   # number of Refrigerated trucks\n\n# Define objective function\n# Cost functions are nonlinear, so we need to approximate them using piecewise linear functions\n# Define helper variables for piecewise linear approximation\nS_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"S_helper_{i}\") for i in range(11)]\nM_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"M_helper_{i}\") for i in range(9)]\nL_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"L_helper_{i}\") for i in range(7)]\nXL_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"XL_helper_{i}\") for i in range(5)]\nR_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"R_helper_{i}\") for i in range(3)]\n\n# Connect helper variables to main variables\nfor i in range(10):\n    model.addCons(S_helper[i] <= S)\nfor i in range(8):\n    model.addCons(M_helper[i] <= M)\nfor i in range(6):\n    model.addCons(L_helper[i] <= L)\nfor i in range(4):\n    model.addCons(XL_helper[i] <= XL)\nfor i in range(2):\n    model.addCons(R_helper[i] <= R)\n\n# Define cost functions using helper variables\nC_S = sum(1000 * (S_helper[i]**0.7) for i in range(10))\nC_M = sum(1500 * (M_helper[i]**0.6) for i in range(8))\nC_L = sum(2000 * (L_helper[i]**0.5) for i in range(6))\nC_XL = sum(2500 * (XL_helper[i]**0.4) for i in range(4))\nC_R = sum(3000 * (R_helper[i]**0.3) for i in range(2))\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C_S + C_M + C_L + C_XL + C_R)\n\n# Add constraints\nmodel.addCons(5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000)\nmodel.addCons(S + M + L + XL + R <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1484,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"quantity of goods to City1\": \"City1\", \"range\": \"City1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City2\": \"City2\", \"range\": \"City2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City3\": \"City3\", \"range\": \"City3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City4\": \"City4\", \"range\": \"City4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City5\": \"City5\", \"range\": \"City5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered. The fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time.\n// Fuel_Cost_City1 = (Fuel1^2) * City1\n// Fuel_Cost_City2 = (Fuel2^2) * City2\n// Fuel_Cost_City3 = (Fuel3^2) * City3\n// Fuel_Cost_City4 = (Fuel4^2) * City4\n// Fuel_Cost_City5 = (Fuel5^2) * City5\n// So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n## Generate Constraint-1:\nThe total fuel budget across all cities must not exceed $10,000.\n// Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000\n\n## Generate Constraint-2:\nThe company must deliver at least 500 units of goods to each city.\n// City1 >= 500; City2 >= 500; City3 >= 500; City4 >= 500; City5 >= 500\n\n## Generate Constraint-3:\nThe total quantity of goods delivered across all cities must not exceed 3000 units.\n// City1 + City2 + City3 + City4 + City5 <= 3000\n\n## Generate Constraint-4:\nThe fuel budget for each city must be sufficient to cover the fuel consumption based on the quantity of goods delivered. The fuel consumption rate is 0.1 liters per unit of goods.\n// Fuel1 >= 0.1 * City1; Fuel2 >= 0.1 * City2; Fuel3 >= 0.1 * City3; Fuel4 >= 0.1 * City4; Fuel5 >= 0.1 * City5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered, where the fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time.\n\n| City | Quantity of Goods | Fuel Consumption Rate |\n|------|-------------------|-----------------------|\n| City1 | City1 (City1 >= 0) | 0.1 liters per unit |\n| City2 | City2 (City2 >= 0) | 0.1 liters per unit |\n| City3 | City3 (City3 >= 0) | 0.1 liters per unit |\n| City4 | City4 (City4 >= 0) | 0.1 liters per unit |\n| City5 | City5 (City5 >= 0) | 0.1 liters per unit |\n\nThe total fuel budget across all cities must not exceed $10,000. The company must deliver at least 500 units of goods to each city. The total quantity of goods delivered across all cities must not exceed 3000 units. The fuel budget for each city must be sufficient to cover the fuel consumption based on the quantity of goods delivered.\n\nPlease help the company to minimize the total fuel cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deliver at least 500 units of goods to each city.\nCity1 = model.addVar(vtype=\"INTEGER\", name=\"City1\", lb=500) # quantity of goods to City1\nCity2 = model.addVar(vtype=\"INTEGER\", name=\"City2\", lb=500) # quantity of goods to City2\nCity3 = model.addVar(vtype=\"INTEGER\", name=\"City3\", lb=500) # quantity of goods to City3\nCity4 = model.addVar(vtype=\"INTEGER\", name=\"City4\", lb=500) # quantity of goods to City4\nCity5 = model.addVar(vtype=\"INTEGER\", name=\"City5\", lb=500) # quantity of goods to City5\n## fuel budget for each city\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel budget for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel budget for City2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0) # fuel budget for City3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0) # fuel budget for City4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0) # fuel budget for City5\n\n# Define objective function\n## The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered.\nFuel_Cost_City1 = (Fuel1**2) * City1\nFuel_Cost_City2 = (Fuel2**2) * City2\nFuel_Cost_City3 = (Fuel3**2) * City3\nFuel_Cost_City4 = (Fuel4**2) * City4\nFuel_Cost_City5 = (Fuel5**2) * City5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\nmodel.addCons(obj == Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n# Add constraints\n## The total fuel budget across all cities must not exceed $10,000.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000)\n## The total quantity of goods delivered across all cities must not exceed 3000 units.\nmodel.addCons(City1 + City2 + City3 + City4 + City5 <= 3000)\n## The fuel budget for each city must be sufficient to cover the fuel consumption based on the quantity of goods delivered.\nmodel.addCons(Fuel1 >= 0.1 * City1)\nmodel.addCons(Fuel2 >= 0.1 * City2)\nmodel.addCons(Fuel3 >= 0.1 * City3)\nmodel.addCons(Fuel4 >= 0.1 * City4)\nmodel.addCons(Fuel5 >= 0.1 * City5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of goods to City1: \", model.getVal(City1))\n    print(\"Quantity of goods to City2: \", model.getVal(City2))\n    print(\"Quantity of goods to City3: \", model.getVal(City3))\n    print(\"Quantity of goods to City4: \", model.getVal(City4))\n    print(\"Quantity of goods to City5: \", model.getVal(City5))\n    print(\"Fuel budget for City1: \", model.getVal(Fuel1))\n    print(\"Fuel budget for City2: \", model.getVal(Fuel2))\n    print(\"Fuel budget for City3: \", model.getVal(Fuel3))\n    print(\"Fuel budget for City4: \", model.getVal(Fuel4))\n    print(\"Fuel budget for City5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1400,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for trucks is 50 liters per 100 km, for vans is 30 liters per 100 km, and for motorcycles is 10 liters per 100 km. The company needs to deliver goods over a total distance of 5000 km. The objective is to minimize the total fuel consumption.\n// Fuel_Consumption_Trucks = 50 * T * 5000 / 100\n// Fuel_Consumption_Vans = 30 * V * 5000 / 100\n// Fuel_Consumption_Motorcycles = 10 * M * 5000 / 100\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\n// Minimize (250 * T + 150 * V + 50 * M)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles. Trucks cost $50,000 each, vans cost $30,000 each, and motorcycles cost $10,000 each.\n// 50000 * T + 30000 * V + 10000 * M <= 100000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands. The fuel consumption for each type of vehicle per 100 km and their respective costs are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/100 km) | Cost (USD) |\n|---------|----------------------------------|------------|\n| Trucks  | 50                               | 50,000     |\n| Vans    | 30                               | 30,000     |\n| Motorcycles | 10                            | 10,000     |\n\nThe company needs to deliver goods over a total distance of 5000 km. The company has a budget of $100,000 for purchasing vehicles. Please help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Trucks = 250 * T\nFuel_Consumption_Vans = 150 * V\nFuel_Consumption_Motorcycles = 50 * M\n## the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(50000 * T + 30000 * V + 10000 * M <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Motorcycles: \", model.getVal(M))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\n// {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes.\nThe fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nThe total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 50.\n// \u03a3(Trucks_j) <= 50 for all j",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency. The fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes. The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\n\nThe total number of trucks available is limited to 50.\n\nPlease help the company to minimize the total fuel cost across all routes, considering the constraints and the nonlinear fuel consumption function.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\nSpeed_i = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_i\", lb=0, ub=100)\n## {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\nTrucks_j = model.addVar(vtype=\"INTEGER\", name=\"Trucks_j\", lb=0)\n## {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\nAdditive_j = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive_j\", lb=0)\n\n# Define objective function\n## The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nFuel_Consumption_i = (Speed_i**2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i\n## The total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n## So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_i * Trucks_j)\n\n# Add constraints\n## The total number of trucks available is limited to 50.\nmodel.addCons(Trucks_j <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck i: \", model.getVal(Speed_i))\n    print(\"Number of Trucks on Route j: \", model.getVal(Trucks_j))\n    print(\"Amount of Fuel Additive for Route j: \", model.getVal(Additive_j))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company has 5 different solar farms and needs to optimize the number of solar panels to install at each farm to maximize energy output while minimizing costs.\n// {\"number of solar panels at farm 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at farm 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output of each solar panel varies by farm due to differences in sunlight exposure and efficiency. \nAt farm 1, each panel produces 10 kWh of energy per day. \nAt farm 2, each panel produces 12 kWh of energy per day. \nAt farm 3, each panel produces 15 kWh of energy per day. \nAt farm 4, each panel produces 14 kWh of energy per day. \nAt farm 5, each panel produces 11 kWh of energy per day. \nThe cost of installing each panel also varies by farm. \nThe cost per panel at farm 1 is $500, at farm 2 is $550, at farm 3 is $600, at farm 4 is $580, and at farm 5 is $520. \nThe company aims to maximize the total energy output while keeping the total installation cost below $1,000,000.\n// The total energy output: E = 10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5\n// The total installation cost: C = 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5\n// So, the objective function is: Maximize E - C\n// Maximize (10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5) - (500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5)\n\n## Generate Constraint-1:\nThe total installation cost must not exceed $1,000,000.\n// 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5 <= 1,000,000\n\n## Generate Constraint-2:\nEach farm has a limited area for installation, allowing for a maximum of 2000 panels.\n// S1 <= 2000; S2 <= 2000; S3 <= 2000; S4 <= 2000; S5 <= 2000",
        "question": "A solar energy company has 5 different solar farms and needs to optimize the number of solar panels to install at each farm to maximize energy output while minimizing costs. The energy output of each solar panel varies by farm due to differences in sunlight exposure and efficiency. At farm 1, each panel produces 10 kWh of energy per day, at farm 2, 12 kWh, at farm 3, 15 kWh, at farm 4, 14 kWh, and at farm 5, 11 kWh. The cost of installing each panel also varies by farm: $500 per panel at farm 1, $550 at farm 2, $600 at farm 3, $580 at farm 4, and $520 at farm 5. The company aims to maximize the total energy output while keeping the total installation cost below $1,000,000. Each farm has a limited area for installation, allowing for a maximum of 2000 panels. Please help the company to maximize the total energy output while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at farm 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at farm 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at farm 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at farm 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at farm 5\n\n# Define objective function\n## The total energy output: E = 10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5\n## The total installation cost: C = 500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5\n## So, the objective function is: Maximize E - C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (10 * S1 + 12 * S2 + 15 * S3 + 14 * S4 + 11 * S5) - (500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5))\n\n# Add constraints\n## The total installation cost must not exceed $1,000,000.\nmodel.addCons(500 * S1 + 550 * S2 + 600 * S3 + 580 * S4 + 520 * S5 <= 1000000)\n## Each farm has a limited area for installation, allowing for a maximum of 2000 panels.\nmodel.addCons(S1 <= 2000)\nmodel.addCons(S2 <= 2000)\nmodel.addCons(S3 <= 2000)\nmodel.addCons(S4 <= 2000)\nmodel.addCons(S5 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Farm 1: \", model.getVal(S1))\n    print(\"Number of Solar Panels at Farm 2: \", model.getVal(S2))\n    print(\"Number of Solar Panels at Farm 3: \", model.getVal(S3))\n    print(\"Number of Solar Panels at Farm 4: \", model.getVal(S4))\n    print(\"Number of Solar Panels at Farm 5: \", model.getVal(S5))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 1,500 units per month.\n// Tablets >= 1500\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 1,000 units per month.\n// Laptops >= 1000\n\n## Generate Constraint-5:\nThe market demand for smartwatches is at least 3,000 units per month.\n// Smartwatches >= 3000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit from each device is calculated based on the selling price minus the production cost, which varies per device and is affected by the quantity produced due to economies of scale. The profit per unit for each device is given in the following Table.\n\n| Device       | Profit per Unit Formula                  |\n|--------------|------------------------------------------|\n| Smartphones  | $100 - 0.1 * Smartphones                |\n| Tablets      | $150 - 0.2 * Tablets                    |\n| Laptops      | $200 - 0.3 * Laptops                    |\n| Smartwatches | $50 - 0.05 * Smartwatches               |\n| Cameras      | $300 - 0.4 * Cameras                    |\n\nThe company wants to maximize the total profit from all devices. The total production capacity of the company is 10,000 units per month. The market demand for smartphones is at least 2,000 units per month, for tablets is at least 1,500 units per month, for laptops is at least 1,000 units per month, and for smartwatches is at least 3,000 units per month.\n\nPlease help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1500)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=1000)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=3000)\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit per unit and total profit for each device\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras)\n\n# Add constraints\n## The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1425,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh.\n// Total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// Total energy generation: Energy = 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total annual energy generation must be at least 100,000 kWh.\n// 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh. The total annual energy generation must be at least 100,000 kWh. Please help the company to minimize the total cost of installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at location 1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of wind turbines at location 1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at location 2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of wind turbines at location 2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at location 3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of wind turbines at location 3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of solar panels at location 4\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at location 4\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0) # number of solar panels at location 5\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total annual energy generation must be at least 100,000 kWh.\n## 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000\nmodel.addCons(100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(Wind3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(Wind4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(Solar5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(Wind5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 681,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg of cargo and consumes 50 liters of fuel per day, with a daily maintenance cost of $100.\nEach Van can carry 500 kg of cargo and consumes 30 liters of fuel per day, with a daily maintenance cost of $70.\nEach Bike can carry 100 kg of cargo and consumes 5 liters of fuel per day, with a daily maintenance cost of $20.\nThe company aims to minimize the total cost of fuel and maintenance per kg of cargo carried.\n// Fuel and maintenance cost of Trucks: Cost_T = (50 * 30 + 100) * T\n// Fuel and maintenance cost of Vans: Cost_V = (30 * 30 + 70) * V\n// Fuel and maintenance cost of Bikes: Cost_B = (5 * 30 + 20) * B\n// Total cargo carried: Cargo = 1000 * T + 500 * V + 100 * B\n// So, the objective function is: Minimize (Cost_T + Cost_V + Cost_B) / Cargo\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and maintenance costs for the month.\n// (50 * 30 + 100) * T + (30 * 30 + 70) * V + (5 * 30 + 20) * B <= 10000\n\n## Generate Constraint-2:\nThe company can only handle a maximum of 500,000 kg of cargo for the month.\n// 1000 * T + 500 * V + 100 * B <= 500000\n\n## Generate Constraint-3:\nThe company has a limit of 100 vehicles in total.\n// T + V + B <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations. Each Truck can carry 1000 kg of cargo and consumes 50 liters of fuel per day, with a daily maintenance cost of $100. Each Van can carry 500 kg of cargo and consumes 30 liters of fuel per day, with a daily maintenance cost of $70. Each Bike can carry 100 kg of cargo and consumes 5 liters of fuel per day, with a daily maintenance cost of $20. The company aims to minimize the total cost of fuel and maintenance per kg of cargo carried. The company has a budget of $10,000 for fuel and maintenance costs for the month. The company can only handle a maximum of 500,000 kg of cargo for the month. The company has a limit of 100 vehicles in total. Please help the company to minimize the total cost of fuel and maintenance per kg of cargo carried.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T = (50 * 30 + 100) * T\nCost_V = (30 * 30 + 70) * V\nCost_B = (5 * 30 + 20) * B\nCargo = 1000 * T + 500 * V + 100 * B\n## the objective function is: Minimize (Cost_T + Cost_V + Cost_B) / Cargo\n## convert the division to multiplication\nmodel.addCons(obj * Cargo == Cost_T + Cost_V + Cost_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel and maintenance costs for the month.\nmodel.addCons((50 * 30 + 100) * T + (30 * 30 + 70) * V + (5 * 30 + 20) * B <= 10000)\n## The company can only handle a maximum of 500,000 kg of cargo for the month.\nmodel.addCons(1000 * T + 500 * V + 100 * B <= 500000)\n## The company has a limit of 100 vehicles in total.\nmodel.addCons(T + V + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Cost per kg of Cargo: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit while considering various constraints such as material costs, production capacity, and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale in production costs. The production cost per unit decreases as the production quantity increases. The cost function for each product is given by: Cost_A = 20 - 0.01 * A^2, Cost_B = 30 - 0.01 * B^2, Cost_C = 40 - 0.01 * C^2. The company aims to maximize its total profit.\n// Profit_A = (50 - Cost_A) * A = (50 - (20 - 0.01 * A^2)) * A\n// Profit_B = (70 - Cost_B) * B = (70 - (30 - 0.01 * B^2)) * B\n// Profit_C = (90 - Cost_C) * C = (90 - (40 - 0.01 * C^2)) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for total material costs.\n// (20 - 0.01 * A^2) * A + (30 - 0.01 * B^2) * B + (40 - 0.01 * C^2) * C <= 10000\n\n## Generate Constraint-2:\nThe production capacity is limited to 200 hours per week. The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units per week, and for product B is at least 30 units per week.\n// A >= 50; B >= 30\n\n## Generate Constraint-4:\nThe total production of product C should not exceed the combined production of products A and B.\n// C <= A + B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit while considering various constraints such as material costs, production capacity, and market demand. The profit per unit and the nonlinear cost function for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost Function | Production Time per Unit |\n|---------|-----------------|---------------|-------------------------|\n| A       | $50             | 20 - 0.01 * A^2 | 2 hours                 |\n| B       | $70             | 30 - 0.01 * B^2 | 3 hours                 |\n| C       | $90             | 40 - 0.01 * C^2 | 4 hours                 |\n\nThe company has a budget of $10,000 for total material costs. The production capacity is limited to 200 hours per week. The market demand for product A is at least 50 units per week, and for product B is at least 30 units per week. The total production of product C should not exceed the combined production of products A and B.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)   # number of units of product C\n\n# Define objective function\n# Calculate the cost functions\nCost_A = 20 - 0.01 * A**2\nCost_B = 30 - 0.01 * B**2\nCost_C = 40 - 0.01 * C**2\n\n# Calculate the profit functions\nProfit_A = (50 - Cost_A) * A\nProfit_B = (70 - Cost_B) * B\nProfit_C = (90 - Cost_C) * C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# Constraint-1: Total material costs budget\nmodel.addCons((20 - 0.01 * A**2) * A + (30 - 0.01 * B**2) * B + (40 - 0.01 * C**2) * C <= 10000)\n\n# Constraint-2: Production capacity\nmodel.addCons(2 * A + 3 * B + 4 * C <= 200)\n\n# Constraint-3: Market demand\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 30)\n\n# Constraint-4: Production of C should not exceed A + B\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination.\n// {\"number of trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck to D1 is $1000, to D2 is $1200, to D3 is $1500, to D4 is $1800, and to D5 is $2000. The revenue generated by sending a truck to D1 is $1500, to D2 is $1800, to D3 is $2100, to D4 is $2400, and to D5 is $2700. The company wants to maximize the net profit (revenue minus cost) per dollar spent on fuel, which is a nonlinear function of the number of trucks sent.\n// Cost_D1 = 1000 * T1\n// Cost_D2 = 1200 * T2\n// Cost_D3 = 1500 * T3\n// Cost_D4 = 1800 * T4\n// Cost_D5 = 2000 * T5\n// Revenue_D1 = 1500 * T1\n// Revenue_D2 = 1800 * T2\n// Revenue_D3 = 2100 * T3\n// Revenue_D4 = 2400 * T4\n// Revenue_D5 = 2700 * T5\n// Fuel_Cost = (T1^2 + T2^2 + T3^2 + T4^2 + T5^2) * 10\n// So, the objective function is: Maximize (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5) / Fuel_Cost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for sending trucks.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be dispatched.\n// T1 + T2 + T3 + T4 + T5 <= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination. The cost and revenue for sending a truck to each destination are given in the following Table.\n\n| Destination | Cost per Truck | Revenue per Truck |\n|-------------|----------------|-------------------|\n| D1          | $1000          | $1500             |\n| D2          | $1200          | $1800             |\n| D3          | $1500          | $2100             |\n| D4          | $1800          | $2400             |\n| D5          | $2000          | $2700             |\n\nThe company has a total budget of $10,000 for sending trucks. The company has a limit of 5 trucks that can be dispatched. The company wants to maximize the net profit (revenue minus cost) per dollar spent on fuel, which is a nonlinear function of the number of trucks sent. Please help the company determine the optimal number of trucks to send to each destination.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_D1 = 1000 * T1\nCost_D2 = 1200 * T2\nCost_D3 = 1500 * T3\nCost_D4 = 1800 * T4\nCost_D5 = 2000 * T5\nRevenue_D1 = 1500 * T1\nRevenue_D2 = 1800 * T2\nRevenue_D3 = 2100 * T3\nRevenue_D4 = 2400 * T4\nRevenue_D5 = 2700 * T5\nFuel_Cost = (T1**2 + T2**2 + T3**2 + T4**2 + T5**2) * 10\n## the objective function is: Maximize (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5) / Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Cost == (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5))\n\n# Add constraints\n## The company has a total budget of $10,000 for sending trucks.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be dispatched.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Maximized Net Profit per Dollar Spent on Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar\": \"SolarMaintenance\", \"range\": \"SolarMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind\": \"WindMaintenance\", \"range\": \"WindMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro\": \"HydroMaintenance\", \"range\": \"HydroMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each power plant type increases with the level of maintenance investment. For every $1000 invested in Solar maintenance, efficiency increases by 1%. For Wind, every $1000 investment increases efficiency by 1.5%. For Hydro, every $1000 investment increases efficiency by 1%. The company aims to maximize the total energy output from all power plants.\n// EnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\n// EnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\n// EnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n// So, the objective function is: Maximize (EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both installation and maintenance of all power plants.\n// SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant. The operational efficiency of each power plant type increases with the level of maintenance investment. For every $1000 invested in Solar maintenance, efficiency increases by 1%. For Wind, every $1000 investment increases efficiency by 1.5%. For Hydro, every $1000 investment increases efficiency by 1%. The company aims to maximize the total energy output from all power plants. The company has a total budget of $100,000 for both installation and maintenance of all power plants. Please help the company to determine the optimal number of units and maintenance investments for each type of power plant to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nSolarMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarMaintenance\", lb=0)  # maintenance investment for Solar\nWindMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"WindMaintenance\", lb=0)  # maintenance investment for Wind\nHydroMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroMaintenance\", lb=0)  # maintenance investment for Hydro\n\n# Define objective function\nEnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\nEnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\nEnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n# Add constraints\nmodel.addCons(SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Maintenance investment for Solar: \", model.getVal(SolarMaintenance))\n    print(\"Maintenance investment for Wind: \", model.getVal(WindMaintenance))\n    print(\"Maintenance investment for Hydro: \", model.getVal(HydroMaintenance))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel consumption and time. The fuel consumption rate (in gallons per hour) and average speed (in miles per hour) vary by route.\n- Route 1: Fuel rate = 5 + 0.1 * T1^2, Speed = 40 - 0.5 * T1\n- Route 2: Fuel rate = 6 + 0.15 * T2^2, Speed = 45 - 0.5 * T2\n- Route 3: Fuel rate = 7 + 0.2 * T3^2, Speed = 50 - 0.5 * T3\n- Route 4: Fuel rate = 8 + 0.25 * T4^2, Speed = 55 - 0.5 * T4\n- Route 5: Fuel rate = 9 + 0.3 * T5^2, Speed = 60 - 0.5 * T5\n- Route 6: Fuel rate = 10 + 0.35 * T6^2, Speed = 65 - 0.5 * T6\nThe objective is to minimize the total cost, which is the sum of fuel cost and time cost (assuming a constant rate of $100 per hour of operation).\n// Objective function: Minimize (5 + 0.1 * T1^2) * (distance/speed) + 100 * (distance/speed) + ... + (10 + 0.35 * T6^2) * (distance/speed) + 100 * (distance/speed)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. The company aims to minimize the total operational cost, which is a function of fuel consumption and time. The fuel consumption rate (in gallons per hour) and average speed (in miles per hour) vary by route:\n- Route 1: Fuel rate = 5 + 0.1 * T1^2, Speed = 40 - 0.5 * T1\n- Route 2: Fuel rate = 6 + 0.15 * T2^2, Speed = 45 - 0.5 * T2\n- Route 3: Fuel rate = 7 + 0.2 * T3^2, Speed = 50 - 0.5 * T3\n- Route 4: Fuel rate = 8 + 0.25 * T4^2, Speed = 55 - 0.5 * T4\n- Route 5: Fuel rate = 9 + 0.3 * T5^2, Speed = 60 - 0.5 * T5\n- Route 6: Fuel rate = 10 + 0.35 * T6^2, Speed = 65 - 0.5 * T6\nThe objective is to minimize the total cost, which is the sum of fuel cost and time cost (assuming a constant rate of $100 per hour of operation). The company has a total of 100 trucks available.\nPlease help the company to determine the optimal number of trucks to allocate to each route to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel rate and speed for each route\nFuelRate1 = 5 + 0.1 * T1**2\nSpeed1 = 40 - 0.5 * T1\nFuelRate2 = 6 + 0.15 * T2**2\nSpeed2 = 45 - 0.5 * T2\nFuelRate3 = 7 + 0.2 * T3**2\nSpeed3 = 50 - 0.5 * T3\nFuelRate4 = 8 + 0.25 * T4**2\nSpeed4 = 55 - 0.5 * T4\nFuelRate5 = 9 + 0.3 * T5**2\nSpeed5 = 60 - 0.5 * T5\nFuelRate6 = 10 + 0.35 * T6**2\nSpeed6 = 65 - 0.5 * T6\n\n## Objective function: Minimize (FuelRate1 * (distance/Speed1) + 100 * (distance/Speed1)) + ... + (FuelRate6 * (distance/Speed6) + 100 * (distance/Speed6))\n## Assuming distance is constant, we can simplify the objective function to: Minimize (FuelRate1/Speed1 + 100/Speed1) + ... + (FuelRate6/Speed6 + 100/Speed6)\nmodel.addCons(obj == (FuelRate1/Speed1 + 100/Speed1) + (FuelRate2/Speed2 + 100/Speed2) + (FuelRate3/Speed3 + 100/Speed3) + (FuelRate4/Speed4 + 100/Speed4) + (FuelRate5/Speed5 + 100/Speed5) + (FuelRate6/Speed6 + 100/Speed6))\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Number of trucks on route 6: \", model.getVal(T6))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering operational constraints.\n// {\"number of trucks for Type A\": \"TypeATrucks\", \"range\": \"TypeATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type B\": \"TypeBTrucks\", \"range\": \"TypeBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type C\": \"TypeCTrucks\", \"range\": \"TypeCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type A\": \"TripsPerTypeATruck\", \"range\": \"TripsPerTypeATruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type B\": \"TripsPerTypeBTruck\", \"range\": \"TripsPerTypeBTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Type C\": \"TripsPerTypeCTruck\", \"range\": \"TripsPerTypeCTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated per trip for Type A goods is $100, for Type B goods is $150, and for Type C goods is $200. The company aims to maximize the total daily revenue from all types of goods.\n// Revenue_TypeA = 100 * TypeATrucks * TripsPerTypeATruck\n// Revenue_TypeB = 150 * TypeBTrucks * TripsPerTypeBTruck\n// Revenue_TypeC = 200 * TypeCTrucks * TripsPerTypeCTruck\n// So, the objective function is: Maximize (Revenue_TypeA + Revenue_TypeB + Revenue_TypeC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TypeATrucks + TypeBTrucks + TypeCTrucks <= 50\n\n## Generate Constraint-2:\nEach truck can make a maximum of 5 trips per day.\n// TripsPerTypeATruck + TripsPerTypeBTruck + TripsPerTypeCTruck <= 5\n\n## Generate Constraint-3:\nThe total daily fuel cost must not exceed $1000. The fuel cost per trip for Type A trucks is $5, for Type B trucks is $7, and for Type C trucks is $9.\n// 5 * TypeATrucks * TripsPerTypeATruck + 7 * TypeBTrucks * TripsPerTypeBTruck + 9 * TypeCTrucks * TripsPerTypeCTruck <= 1000\n\n## Generate Constraint-4:\nThe company has a daily maintenance budget of $2000. The maintenance cost per truck per day for Type A is $20, for Type B is $30, and for Type C is $40.\n// 20 * TypeATrucks + 30 * TypeBTrucks + 40 * TypeCTrucks <= 2000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering operational constraints. The revenue generated per trip for Type A goods is $100, for Type B goods is $150, and for Type C goods is $200. The company aims to maximize the total daily revenue from all types of goods. The company has a total of 50 trucks available. Each truck can make a maximum of 5 trips per day. The total daily fuel cost must not exceed $1000. The fuel cost per trip for Type A trucks is $5, for Type B trucks is $7, and for Type C trucks is $9. The company has a daily maintenance budget of $2000. The maintenance cost per truck per day for Type A is $20, for Type B is $30, and for Type C is $40. Please help the company to maximize the total daily revenue from all types of goods.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeATrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeATrucks\", lb=0)  # number of trucks for Type A\nTypeBTrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeBTrucks\", lb=0)  # number of trucks for Type B\nTypeCTrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeCTrucks\", lb=0)  # number of trucks for Type C\nTripsPerTypeATruck = model.addVar(vtype=\"INTEGER\", name=\"TripsPerTypeATruck\", lb=0)  # number of trips per truck for Type A\nTripsPerTypeBTruck = model.addVar(vtype=\"INTEGER\", name=\"TripsPerTypeBTruck\", lb=0)  # number of trips per truck for Type B\nTripsPerTypeCTruck = model.addVar(vtype=\"INTEGER\", name=\"TripsPerTypeCTruck\", lb=0)  # number of trips per truck for Type C\n\n# Define objective function\nRevenue_TypeA = 100 * TypeATrucks * TripsPerTypeATruck\nRevenue_TypeB = 150 * TypeBTrucks * TripsPerTypeBTruck\nRevenue_TypeC = 200 * TypeCTrucks * TripsPerTypeCTruck\n# So, the objective function is: Maximize (Revenue_TypeA + Revenue_TypeB + Revenue_TypeC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_TypeA + Revenue_TypeB + Revenue_TypeC)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TypeATrucks + TypeBTrucks + TypeCTrucks <= 50)\n# Each truck can make a maximum of 5 trips per day.\nmodel.addCons(TripsPerTypeATruck + TripsPerTypeBTruck + TripsPerTypeCTruck <= 5)\n# The total daily fuel cost must not exceed $1000.\nmodel.addCons(5 * TypeATrucks * TripsPerTypeATruck + 7 * TypeBTrucks * TripsPerTypeBTruck + 9 * TypeCTrucks * TripsPerTypeCTruck <= 1000)\n# The company has a daily maintenance budget of $2000.\nmodel.addCons(20 * TypeATrucks + 30 * TypeBTrucks + 40 * TypeCTrucks <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Type A: \", model.getVal(TypeATrucks))\n    print(\"Number of Trucks for Type B: \", model.getVal(TypeBTrucks))\n    print(\"Number of Trucks for Type C: \", model.getVal(TypeCTrucks))\n    print(\"Trips per Truck for Type A: \", model.getVal(TripsPerTypeATruck))\n    print(\"Trips per Truck for Type B: \", model.getVal(TripsPerTypeBTruck))\n    print(\"Trips per Truck for Type C: \", model.getVal(TripsPerTypeCTruck))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of component C1, with only 500 units available.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 500\n\n## Generate Constraint-2:\nThe supply of component C2 is also limited, with only 200 units available.\n// Q2 + 2 * Q3 <= 200\n\n## Generate Constraint-3:\nThe production capacity for E1 is limited to 100 units due to specific machinery constraints.\n// Q1 <= 100\n\n## Generate Constraint-4:\nThe market demand for E3 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E3.\n// Q3 <= 50\n\n## Generate Constraint-5:\nThe total production quantity of all devices must not exceed 200 units.\n// Q1 + Q2 + Q3 <= 200",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints. The profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer has a limited supply of component C1, with only 500 units available, and a limited supply of component C2, with only 200 units available. The production capacity for E1 is limited to 100 units due to specific machinery constraints, and the market demand for E3 is 50 units. The total production quantity of all devices must not exceed 200 units. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\n# So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n# The manufacturer has a limited supply of component C1, with only 500 units available.\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 500)\n# The supply of component C2 is also limited, with only 200 units available.\nmodel.addCons(Q2 + 2 * Q3 <= 200)\n# The production capacity for E1 is limited to 100 units due to specific machinery constraints.\nmodel.addCons(Q1 <= 100)\n# The market demand for E3 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E3.\nmodel.addCons(Q3 <= 50)\n# The total production quantity of all devices must not exceed 200 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000\n\n## Generate Constraint-2:\nThe total fuel allocation must not exceed 5000 liters.\n// FuelA + FuelB + FuelC <= 5000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n\n| Vehicle Type | Fuel Efficiency Improvement per $1000 Software Investment |\n|--------------|--------------------------------------------------------------|\n| TruckA       | 0.5 km/liter                                                 |\n| TruckB       | 0.7 km/liter                                                 |\n| TruckC       | 0.6 km/liter                                                 |\n\nThe company has a budget of $100,000 for vehicle purchases and software investments. The total fuel allocation must not exceed 5000 liters. Please help the company to minimize the total fuel consumption while ensuring all delivery routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)  # investment in routing software\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitial_efficiency_A = 10  # example initial efficiency for TruckA\nInitial_efficiency_B = 12  # example initial efficiency for TruckB\nInitial_efficiency_C = 15  # example initial efficiency for TruckC\nDistance_A = 1000  # example distance for TruckA\nDistance_B = 1500  # example distance for TruckB\nDistance_C = 2000  # example distance for TruckC\n## the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n## convert the division to multiplication\nFuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\nFuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\nFuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\nmodel.addCons(obj == Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nCost_A = 20000  # example cost for TruckA\nCost_B = 30000  # example cost for TruckB\nCost_C = 40000  # example cost for TruckC\nmodel.addCons(TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000)\n## The total fuel allocation must not exceed 5000 liters.\nmodel.addCons(FuelA + FuelB + FuelC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1376,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury, Mid-range, and Affordable. The developer needs to determine the number of units to build for each property type. Additionally, the developer needs to decide on the level of eco-friendly features to incorporate into each property type, which affects the construction cost and potential selling price.\n// {\"number of Luxury units\": \"LuxuryUnits\", \"range\": \"LuxuryUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-range units\": \"MidRangeUnits\", \"range\": \"MidRangeUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable units\": \"AffordableUnits\", \"range\": \"AffordableUnits >= 0\", \"type\": \"integer\"}\n// {\"eco-friendly features for Luxury\": \"EcoLuxury\", \"range\": \"EcoLuxury >= 0\", \"type\": \"continuous\"}\n// {\"eco-friendly features for Mid-range\": \"EcoMidRange\", \"range\": \"EcoMidRange >= 0\", \"type\": \"continuous\"}\n// {\"eco-friendly features for Affordable\": \"EcoAffordable\", \"range\": \"EcoAffordable >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of each unit is influenced by the level of eco-friendly features. For Luxury units, the base price is $500,000, and for every $10,000 invested in eco-features, the price increases by $15,000 per unit. For Mid-range units, the base price is $300,000, and for every $10,000 invested in eco-features, the price increases by $10,000 per unit. For Affordable units, the base price is $150,000, and for every $10,000 invested in eco-features, the price increases by $5,000 per unit. The developer aims to maximize the total revenue from selling all units.\n// Revenue_Luxury = (500000 + 1.5 * EcoLuxury) * LuxuryUnits\n// Revenue_MidRange = (300000 + 1.0 * EcoMidRange) * MidRangeUnits\n// Revenue_Affordable = (150000 + 0.5 * EcoAffordable) * AffordableUnits\n// So, the objective function is: Maximize (Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\n\n## Generate Constraint-1:\nThe total construction budget is $20,000,000. The construction cost for Luxury units is $300,000 per unit, for Mid-range units is $200,000 per unit, and for Affordable units is $100,000 per unit. The cost of eco-friendly features for Luxury is $10,000 per unit, for Mid-range is $5,000 per unit, and for Affordable is $2,000 per unit.\n// 300000 * LuxuryUnits + 10000 * EcoLuxury + 200000 * MidRangeUnits + 5000 * EcoMidRange + 100000 * AffordableUnits + 2000 * EcoAffordable <= 20000000",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury, Mid-range, and Affordable. The developer needs to determine the number of units to build for each property type and the level of eco-friendly features to incorporate into each property type, which affects the construction cost and potential selling price. The base selling price and the impact of eco-friendly features on the selling price for each property type are given in the following Table.\n\n| Property Type | Base Selling Price | Eco-friendly Feature Impact |\n|---------------|--------------------|-----------------------------|\n| Luxury        | $500,000           | $15,000 per $10,000 invested |\n| Mid-range     | $300,000           | $10,000 per $10,000 invested |\n| Affordable    | $150,000           | $5,000 per $10,000 invested |\n\nThe total construction budget is $20,000,000. The construction cost for Luxury units is $300,000 per unit, for Mid-range units is $200,000 per unit, and for Affordable units is $100,000 per unit. The cost of eco-friendly features for Luxury is $10,000 per unit, for Mid-range is $5,000 per unit, and for Affordable is $2,000 per unit.\n\nPlease help the developer to maximize the total revenue from selling all units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLuxuryUnits = model.addVar(vtype=\"INTEGER\", name=\"LuxuryUnits\", lb=0)  # number of Luxury units\nMidRangeUnits = model.addVar(vtype=\"INTEGER\", name=\"MidRangeUnits\", lb=0)  # number of Mid-range units\nAffordableUnits = model.addVar(vtype=\"INTEGER\", name=\"AffordableUnits\", lb=0)  # number of Affordable units\nEcoLuxury = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoLuxury\", lb=0)  # eco-friendly features for Luxury\nEcoMidRange = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoMidRange\", lb=0)  # eco-friendly features for Mid-range\nEcoAffordable = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoAffordable\", lb=0)  # eco-friendly features for Affordable\n\n# Define objective function\nRevenue_Luxury = (500000 + 1.5 * EcoLuxury) * LuxuryUnits\nRevenue_MidRange = (300000 + 1.0 * EcoMidRange) * MidRangeUnits\nRevenue_Affordable = (150000 + 0.5 * EcoAffordable) * AffordableUnits\n# So, the objective function is: Maximize (Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\n\n# Add constraints\n# The total construction budget is $20,000,000.\nmodel.addCons(300000 * LuxuryUnits + 10000 * EcoLuxury + 200000 * MidRangeUnits + 5000 * EcoMidRange + 100000 * AffordableUnits + 2000 * EcoAffordable <= 20000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Units: \", model.getVal(LuxuryUnits))\n    print(\"Number of Mid-range Units: \", model.getVal(MidRangeUnits))\n    print(\"Number of Affordable Units: \", model.getVal(AffordableUnits))\n    print(\"Eco-friendly features for Luxury: \", model.getVal(EcoLuxury))\n    print(\"Eco-friendly features for Mid-range: \", model.getVal(EcoMidRange))\n    print(\"Eco-friendly features for Affordable: \", model.getVal(EcoAffordable))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost of materials for DeviceA\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceB\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceC\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price of DeviceA is $200, DeviceB is $300, and DeviceC is $400. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost of materials.\n// Total revenue: Revenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\n// Total cost of materials: Cost = CostA * UnitsA + CostB * UnitsB + CostC * UnitsC\n// The objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units in total.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe market demand for DeviceA is at least 200 units per month.\n// UnitsA >= 200\n\n## Generate Constraint-3:\nThe cost of materials for DeviceA is $50 per unit, for DeviceB is $70 per unit, and for DeviceC is $90 per unit. The company has a budget of $70,000 for materials per month.\n// 50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs. The selling price and cost of materials for each device are given in the following Table.\n\n| Device | Selling Price | Cost of Materials per Unit |\n|--------|---------------|----------------------------|\n| DeviceA | $200          | $50                        |\n| DeviceB | $300          | $70                        |\n| DeviceC | $400          | $90                        |\n\nThe company has a monthly production capacity of 1000 units in total. The market demand for DeviceA is at least 200 units per month. The company has a budget of $70,000 for materials per month. \n\nPlease help the company to maximize its total profit, which is the difference between the total revenue and the total cost of materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\nRevenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\nCost = 50 * UnitsA + 70 * UnitsB + 90 * UnitsC\n# The objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a monthly production capacity of 1000 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The market demand for DeviceA is at least 200 units per month.\nmodel.addCons(UnitsA >= 200)\n# The company has a budget of $70,000 for materials per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the advertising budget for each product to enhance market penetration.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10. The storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n// Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n// Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\n// ProdA <= 2000; ProdB <= 3000; ProdC <= 2500\n\n## Generate Constraint-3:\nThe total advertising budget is limited to $15,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 15,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the advertising budget for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10. The storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company has a total budget of $100,000 for raw materials and labor. The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units. The total advertising budget is limited to $15,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n## Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n## Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\nProfit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\nProfit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100000)\n## The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\nmodel.addCons(ProdA <= 2000)\nmodel.addCons(ProdB <= 3000)\nmodel.addCons(ProdC <= 2500)\n## The total advertising budget is limited to $15,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon.\nFor T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon.\nFor T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon.\nFor T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon.\nFor T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// Total capacity: Capacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5\n\n## Generate Constraint-4:\nThe total number of trucks must not exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities, operational costs per mile, and fuel efficiencies. The details for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Capacity | Fuel Efficiency |\n|------------|---------------------------|----------|-----------------|\n| T1         | $2                        | 10 tons  | 5 miles per gallon |\n| T2         | $3                        | 15 tons  | 4 miles per gallon |\n| T3         | $4                        | 20 tons  | 3 miles per gallon |\n| T4         | $5                        | 25 tons  | 2 miles per gallon |\n| T5         | $6                        | 30 tons  | 1 mile per gallon |\n\nThe company has a budget of $500,000 for purchasing trucks. The total capacity of all trucks must be at least 1000 tons. The company must have at least 5 trucks of each type. The total number of trucks must not exceed 50.\n\nPlease help the company to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5)  # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5)  # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5)  # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5)  # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5)  # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nCapacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000)\n## The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company must have at least 5 trucks of each type.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 5)\nmodel.addCons(T3 >= 5)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 5)\n## The total number of trucks must not exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1288,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit.\n// {\"hours machine 1 works on product 1\": \"M1P1\", \"range\": \"M1P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 1\": \"M2P1\", \"range\": \"M2P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 1\": \"M3P1\", \"range\": \"M3P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 1\": \"M4P1\", \"range\": \"M4P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 2\": \"M1P2\", \"range\": \"M1P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 2\": \"M2P2\", \"range\": \"M2P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 2\": \"M3P2\", \"range\": \"M3P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 2\": \"M4P2\", \"range\": \"M4P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 3\": \"M1P3\", \"range\": \"M1P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 3\": \"M2P3\", \"range\": \"M2P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 3\": \"M3P3\", \"range\": \"M3P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 3\": \"M4P3\", \"range\": \"M4P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per hour for each product. The profit per hour for product 1 on machine 1 is $100, on machine 2 is $120, on machine 3 is $110, and on machine 4 is $130. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. The objective is to maximize the total profit from all products.\n// The objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n## Generate Constraint-1:\nEach machine can operate a maximum of 100 hours per week.\n// M1P1 + M1P2 + M1P3 <= 100; M2P1 + M2P2 + M2P3 <= 100; M3P1 + M3P2 + M3P3 <= 100; M4P1 + M4P2 + M4P3 <= 100\n\n## Generate Constraint-2:\nThe total production hours for product 1 must not exceed 150 hours.\n// M1P1 + M2P1 + M3P1 + M4P1 <= 150",
        "question": "A manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit. The profit per hour for each product on each machine is given in the following Table.\n\n| Machine | Product 1 Profit/Hour | Product 2 Profit/Hour | Product 3 Profit/Hour |\n|---------|-----------------------|-----------------------|-----------------------|\n| 1       | $100                  | $150                  | $200                  |\n| 2       | $120                  | $160                  | $210                  |\n| 3       | $110                  | $140                  | $190                  |\n| 4       | $130                  | $170                  | $220                  |\n\nEach machine can operate a maximum of 100 hours per week. The total production hours for product 1 must not exceed 150 hours. Please help the plant manager to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P1\", lb=0) # hours machine 1 works on product 1\nM2P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P1\", lb=0) # hours machine 2 works on product 1\nM3P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P1\", lb=0) # hours machine 3 works on product 1\nM4P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P1\", lb=0) # hours machine 4 works on product 1\nM1P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P2\", lb=0) # hours machine 1 works on product 2\nM2P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P2\", lb=0) # hours machine 2 works on product 2\nM3P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P2\", lb=0) # hours machine 3 works on product 2\nM4P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P2\", lb=0) # hours machine 4 works on product 2\nM1P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P3\", lb=0) # hours machine 1 works on product 3\nM2P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P3\", lb=0) # hours machine 2 works on product 3\nM3P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P3\", lb=0) # hours machine 3 works on product 3\nM4P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P3\", lb=0) # hours machine 4 works on product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\nmodel.addCons(obj == 100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1 + 150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2 + 200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n# Add constraints\n## Each machine can operate a maximum of 100 hours per week.\nmodel.addCons(M1P1 + M1P2 + M1P3 <= 100)\nmodel.addCons(M2P1 + M2P2 + M2P3 <= 100)\nmodel.addCons(M3P1 + M3P2 + M3P3 <= 100)\nmodel.addCons(M4P1 + M4P2 + M4P3 <= 100)\n## The total production hours for product 1 must not exceed 150 hours.\nmodel.addCons(M1P1 + M2P1 + M3P1 + M4P1 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 works on Product 1: \", model.getVal(M1P1))\n    print(\"Hours Machine 2 works on Product 1: \", model.getVal(M2P1))\n    print(\"Hours Machine 3 works on Product 1: \", model.getVal(M3P1))\n    print(\"Hours Machine 4 works on Product 1: \", model.getVal(M4P1))\n    print(\"Hours Machine 1 works on Product 2: \", model.getVal(M1P2))\n    print(\"Hours Machine 2 works on Product 2: \", model.getVal(M2P2))\n    print(\"Hours Machine 3 works on Product 2: \", model.getVal(M3P2))\n    print(\"Hours Machine 4 works on Product 2: \", model.getVal(M4P2))\n    print(\"Hours Machine 1 works on Product 3: \", model.getVal(M1P3))\n    print(\"Hours Machine 2 works on Product 3: \", model.getVal(M2P3))\n    print(\"Hours Machine 3 works on Product 3: \", model.getVal(M3P3))\n    print(\"Hours Machine 4 works on Product 3: \", model.getVal(M4P3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for transporting goods across different regions. The company has identified five regions (Region A, Region B, Region C, Region D, and Region E) where they need to optimize the number of trucks.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a fixed cost of operation and a variable cost that depends on the distance traveled. The fixed cost for each region is as follows: Region A - $500, Region B - $600, Region C - $700, Region D - $800, Region E - $900. The variable cost per kilometer is $1 for all regions. The average distance each truck travels in a region is: Region A - 500 km, Region B - 600 km, Region C - 700 km, Region D - 800 km, Region E - 900 km. The company aims to minimize the total cost of operation.\n// Fixed costs: FC = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Variable costs: VC = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Total cost: TC = FC + VC\n// So, the objective function is: Minimize TC\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck operations.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nAt least 20 trucks must be allocated to Region A.\n// TruckA >= 20\n\n## Generate Constraint-4:\nNo more than 30% of the total trucks can be allocated to any single region.\n// TruckA <= 0.3 * 100\n// TruckB <= 0.3 * 100\n// TruckC <= 0.3 * 100\n// TruckD <= 0.3 * 100\n// TruckE <= 0.3 * 100",
        "question": "A logistics company is planning its fleet of trucks for transporting goods across five regions: Region A, Region B, Region C, Region D, and Region E. The company needs to optimize the number of trucks in each region. Each truck incurs a fixed cost of operation and a variable cost that depends on the distance traveled. The fixed cost for each region is as follows: Region A - $500, Region B - $600, Region C - $700, Region D - $800, Region E - $900. The variable cost per kilometer is $1 for all regions, and the average distance each truck travels in a region is: Region A - 500 km, Region B - 600 km, Region C - 700 km, Region D - 800 km, Region E - 900 km. The company aims to minimize the total cost of operation.\n\nThe company has a budget of $100,000 for truck operations. The total number of trucks available is 100. At least 20 trucks must be allocated to Region A. No more than 30% of the total trucks can be allocated to any single region.\n\nPlease help the company determine the optimal number of trucks to allocate to each region to minimize the total cost of operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=20) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks in Region E\n\n# Define objective function\nFixedCosts = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nVariableCosts = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nTotalCost = FixedCosts + VariableCosts\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 100000) # Budget constraint\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100) # Total trucks constraint\nmodel.addCons(TruckA <= 30) # No more than 30% of total trucks in Region A\nmodel.addCons(TruckB <= 30) # No more than 30% of total trucks in Region B\nmodel.addCons(TruckC <= 30) # No more than 30% of total trucks in Region C\nmodel.addCons(TruckD <= 30) # No more than 30% of total trucks in Region D\nmodel.addCons(TruckE <= 30) # No more than 30% of total trucks in Region E\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&DInvestment\", \"range\": \"R&DInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of ProductA is initially $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The market price of ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. For every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products cannot exceed $50,000 per month.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total investment in R&D cannot exceed $100,000 per month.\n// R&DInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment. The production cost of ProductA is initially $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The market price of ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. For every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products. The total production capacity of the company is 1000 units per month. The total marketing budget for all products cannot exceed $50,000 per month. The total investment in R&D cannot exceed $100,000 per month.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nR_DInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"R&DInvestment\", lb=0)  # investment in R&D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ((150 - (100 - 0.0005 * R_DInvestment)) * QuantityA - MarketingA) +\n                   ((200 - (150 - 0.0005 * R_DInvestment)) * QuantityB - MarketingB) +\n                   ((250 - (200 - 0.0005 * R_DInvestment)) * QuantityC - MarketingC))\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n## The total marketing budget for all products cannot exceed $50,000 per month.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n## The total investment in R&D cannot exceed $100,000 per month.\nmodel.addCons(R_DInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Investment in R&D: \", model.getVal(R_DInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to decide the number of trucks to allocate to each region, the speed at which each truck travels, and the fuel consumption rate of each truck. The goal is to optimize the delivery efficiency while considering various operational constraints.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Region A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks for Region B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region A\": \"FuelConsumptionA\", \"range\": \"FuelConsumptionA > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region B\": \"FuelConsumptionB\", \"range\": \"FuelConsumptionB > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and depreciation costs based on the speed of the trucks. The cost function is nonlinear due to the relationship between speed and fuel consumption.\n// OperationalCost_A = TrucksA * (SpeedA^2 * FuelConsumptionA + 0.1 * SpeedA)\n// OperationalCost_B = TrucksB * (SpeedB^2 * FuelConsumptionB + 0.1 * SpeedB)\n// So, the objective function is: Minimize (OperationalCost_A + OperationalCost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// TrucksA * SpeedA * FuelConsumptionA + TrucksB * SpeedB * FuelConsumptionB <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// TrucksA + TrucksB <= 50\n\n## Generate Constraint-3:\nThe maximum speed limit for trucks in both regions is 60 km/h.\n// SpeedA <= 60\n// SpeedB <= 60\n\n## Generate Constraint-4:\nThe minimum required delivery capacity for Region A is 1000 units per day.\n// TrucksA * SpeedA >= 1000",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to decide the number of trucks to allocate to each region, the speed at which each truck travels, and the fuel consumption rate of each truck. The goal is to optimize the delivery efficiency while considering various operational constraints. The company aims to minimize the total operational cost, which includes fuel costs and depreciation costs based on the speed of the trucks. The company has a total budget of $10,000 for fuel costs per day. The total number of trucks available is limited to 50. The maximum speed limit for trucks in both regions is 60 km/h. The minimum required delivery capacity for Region A is 1000 units per day. Please help the company to determine the optimal allocation of trucks and their speeds to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Region B\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks for Region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for Region B\nFuelConsumptionA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelConsumptionA\", lb=0)  # fuel consumption rate for Region A\nFuelConsumptionB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelConsumptionB\", lb=0)  # fuel consumption rate for Region B\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost_A = TrucksA * (SpeedA**2 * FuelConsumptionA + 0.1 * SpeedA)\nOperationalCost_B = TrucksB * (SpeedB**2 * FuelConsumptionB + 0.1 * SpeedB)\n## the objective function is: Minimize (OperationalCost_A + OperationalCost_B)\nmodel.addCons(obj == OperationalCost_A + OperationalCost_B)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(TrucksA * SpeedA * FuelConsumptionA + TrucksB * SpeedB * FuelConsumptionB <= 10000)\n## The total number of trucks available is limited to 50.\nmodel.addCons(TrucksA + TrucksB <= 50)\n## The maximum speed limit for trucks in both regions is 60 km/h.\nmodel.addCons(SpeedA <= 60)\nmodel.addCons(SpeedB <= 60)\n## The minimum required delivery capacity for Region A is 1000 units per day.\nmodel.addCons(TrucksA * SpeedA >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Speed of Trucks for Region A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for Region B: \", model.getVal(SpeedB))\n    print(\"Fuel Consumption Rate for Region A: \", model.getVal(FuelConsumptionA))\n    print(\"Fuel Consumption Rate for Region B: \", model.getVal(FuelConsumptionB))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost and revenue per truck for each type are given in the following Table.\n\n| Truck Type         | Operational Cost | Revenue |\n|--------------------|------------------|---------|\n| Small              | $50,000          | $70,000 |\n| Medium             | $75,000          | $100,000|\n| Large              | $100,000         | $130,000|\n| Refrigerated       | $120,000         | $150,000|\n| Heavy-Duty         | $150,000         | $180,000|\n\nThe company has a budget of $5,000,000 for purchasing new trucks. The company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n\nPlease help the company determine the optimal number of each type of truck to purchase to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region. Additionally, the company needs to decide on the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels in RegionA\": \"SolarPanelsA\", \"range\": \"SolarPanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarPanelsB\", \"range\": \"SolarPanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarPanelsC\", \"range\": \"SolarPanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindTurbinesA\", \"range\": \"WindTurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindTurbinesB\", \"range\": \"WindTurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindTurbinesC\", \"range\": \"WindTurbinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&DInvestment\", \"range\": \"R&DInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The revenue generated per unit of energy is $100 for solar panels and $150 for wind turbines. The company aims to maximize the total revenue from all regions.\n// Total revenue from solar panels in RegionA: Revenue_SolarA = (100 * 0.15 + 0.005 * R&DInvestment) * SolarPanelsA\n// Total revenue from solar panels in RegionB: Revenue_SolarB = (100 * 0.15 + 0.005 * R&DInvestment) * SolarPanelsB\n// Total revenue from solar panels in RegionC: Revenue_SolarC = (100 * 0.15 + 0.005 * R&DInvestment) * SolarPanelsC\n// Total revenue from wind turbines in RegionA: Revenue_WindA = (150 * 0.25 + 0.007 * R&DInvestment) * WindTurbinesA\n// Total revenue from wind turbines in RegionB: Revenue_WindB = (150 * 0.25 + 0.007 * R&DInvestment) * WindTurbinesB\n// Total revenue from wind turbines in RegionC: Revenue_WindC = (150 * 0.25 + 0.007 * R&DInvestment) * WindTurbinesC\n// So, the objective function is: Maximize (Revenue_SolarA + Revenue_SolarB + Revenue_SolarC + Revenue_WindA + Revenue_WindB + Revenue_WindC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5,000,000 for installation and R&D.\n// SolarPanelsA + SolarPanelsB + SolarPanelsC + WindTurbinesA + WindTurbinesB + WindTurbinesC + R&DInvestment <= 5000000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines cannot exceed 1000 units.\n// SolarPanelsA + SolarPanelsB + SolarPanelsC + WindTurbinesA + WindTurbinesB + WindTurbinesC <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The revenue generated per unit of energy is $100 for solar panels and $150 for wind turbines.\n\n| Component       | Initial Efficiency | Revenue per Unit |\n|-----------------|--------------------|------------------|\n| Solar Panels    | 15%                | $100             |\n| Wind Turbines   | 25%                | $150             |\n\nThe company has a total budget of $5,000,000 for installation and R&D. The total number of solar panels and wind turbines cannot exceed 1000 units.\n\nPlease help the company to maximize the total revenue from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanelsA = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsA\", lb=0) # number of solar panels in RegionA\nSolarPanelsB = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsB\", lb=0) # number of solar panels in RegionB\nSolarPanelsC = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsC\", lb=0) # number of solar panels in RegionC\nWindTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesA\", lb=0) # number of wind turbines in RegionA\nWindTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesB\", lb=0) # number of wind turbines in RegionB\nWindTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesC\", lb=0) # number of wind turbines in RegionC\nR_DInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"R_DInvestment\", lb=0) # investment in R&D\n\n# Define objective function\nRevenue_SolarA = (100 * 0.15 + 0.005 * R_DInvestment) * SolarPanelsA\nRevenue_SolarB = (100 * 0.15 + 0.005 * R_DInvestment) * SolarPanelsB\nRevenue_SolarC = (100 * 0.15 + 0.005 * R_DInvestment) * SolarPanelsC\nRevenue_WindA = (150 * 0.25 + 0.007 * R_DInvestment) * WindTurbinesA\nRevenue_WindB = (150 * 0.25 + 0.007 * R_DInvestment) * WindTurbinesB\nRevenue_WindC = (150 * 0.25 + 0.007 * R_DInvestment) * WindTurbinesC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_SolarA + Revenue_SolarB + Revenue_SolarC + Revenue_WindA + Revenue_WindB + Revenue_WindC)\n\n# Add constraints\nmodel.addCons(SolarPanelsA + SolarPanelsB + SolarPanelsC + WindTurbinesA + WindTurbinesB + WindTurbinesC + R_DInvestment <= 5000000)\nmodel.addCons(SolarPanelsA + SolarPanelsB + SolarPanelsC + WindTurbinesA + WindTurbinesB + WindTurbinesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarPanelsA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarPanelsB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarPanelsC))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindTurbinesA))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindTurbinesB))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindTurbinesC))\n    print(\"Investment in R&D: \", model.getVal(R_DInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"Efficiency_A\", \"range\": \"Efficiency_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"Efficiency_B\", \"range\": \"Efficiency_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"Efficiency_C\", \"range\": \"Efficiency_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// Fuel_Consumption_A = Trucks_A / Efficiency_A\n// Fuel_Consumption_B = Trucks_B / Efficiency_B\n// Fuel_Consumption_C = Trucks_C / Efficiency_C\n// Profit_A = 1000 * Trucks_A - Fuel_Consumption_A^2\n// Profit_B = 1500 * Trucks_B - Fuel_Consumption_B^2\n// Profit_C = 2000 * Trucks_C - Fuel_Consumption_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total fuel budget for all routes is $10,000.\n// Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type. The company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency. The company has a total of 50 trucks available. The total fuel budget for all routes is $10,000.\n\nPlease help the company to minimize the total fuel consumption (defined as the sum of the fuel consumption for each route) and maximize the total profit (defined as the sum of the profits from each route).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nEfficiency_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_A\", lb=0)  # fuel efficiency of trucks for Route A\nEfficiency_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_B\", lb=0)  # fuel efficiency of trucks for Route B\nEfficiency_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_C\", lb=0)  # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_fuel = model.addVar('obj_fuel')\nobj_profit = model.addVar('obj_profit')\nmodel.setObjective(obj_fuel, \"minimize\")\nmodel.setObjective(obj_profit, \"maximize\")\n\n## convert the division to multiplication\nFuel_Consumption_A = Trucks_A * Efficiency_A\nFuel_Consumption_B = Trucks_B * Efficiency_B\nFuel_Consumption_C = Trucks_C * Efficiency_C\nProfit_A = 1000 * Trucks_A - Fuel_Consumption_A**2\nProfit_B = 1500 * Trucks_B - Fuel_Consumption_B**2\nProfit_C = 2000 * Trucks_C - Fuel_Consumption_C**2\n\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_fuel == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj_profit == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n## The total fuel budget for all routes is $10,000.\nmodel.addCons(Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(Efficiency_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(Efficiency_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(Efficiency_C))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_fuel))\n    print(\"Maximized Profit: \", model.getVal(obj_profit))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2. The company aims to maximize the total profit. The total available hours for all production lines is 1000 hours.\nPlease help the company determine the optimal number of units and hours to allocate to each device to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours allocated to DeviceC production line\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (30 * HoursA)\nProfit_B = (70 * UnitsB) - (40 * HoursB)\nProfit_C = (90 * UnitsC) - (50 * HoursC)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company wants to maximize the total profit per day.\n// Profit_GoodA = (1000 - 500) * TrucksA\n// Profit_GoodB = (1200 - 600) * TrucksB\n// Profit_GoodC = (1400 - 700) * TrucksC\n// Profit_GoodD = (1600 - 800) * TrucksD\n// Profit_GoodE = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $30,000.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000\n\n## Generate Constraint-4:\nTo ensure balanced distribution, the company wants to ensure that each type of good has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company has a total of 50 trucks available for distribution. Due to regional regulations, the number of trucks for GoodA must be at least half the number of trucks for GoodB. The company has a daily fuel budget of $30,000. To ensure balanced distribution, the company wants to ensure that each type of good has at least one truck allocated.\nPlease help the company to maximize the total profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for GoodE\n\n# Define objective function\nProfit_GoodA = (1000 - 500) * TrucksA\nProfit_GoodB = (1200 - 600) * TrucksB\nProfit_GoodC = (1400 - 700) * TrucksC\nProfit_GoodD = (1600 - 800) * TrucksD\nProfit_GoodE = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n# Add constraints\n# The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to regional regulations, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n# The company has a daily fuel budget of $30,000.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different fuel consumption rate per kilometer and a different average delivery time per truck. \nRoute 1: 0.5 liters/km, 2 hours/truck\nRoute 2: 0.6 liters/km, 1.5 hours/truck\nRoute 3: 0.4 liters/km, 2.5 hours/truck\nRoute 4: 0.7 liters/km, 1 hour/truck\nRoute 5: 0.3 liters/km, 3 hours/truck\nThe company aims to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time. The fuel cost is $1 per liter, and the opportunity cost of time is $50 per hour. The objective is to minimize the total cost of operations.\n// Fuel_Cost_1 = 0.5 * T1 * Distance_1 * 1\n// Fuel_Cost_2 = 0.6 * T2 * Distance_2 * 1\n// Fuel_Cost_3 = 0.4 * T3 * Distance_3 * 1\n// Fuel_Cost_4 = 0.7 * T4 * Distance_4 * 1\n// Fuel_Cost_5 = 0.3 * T5 * Distance_5 * 1\n// Time_Cost_1 = 2 * T1 * 50\n// Time_Cost_2 = 1.5 * T2 * 50\n// Time_Cost_3 = 2.5 * T3 * 50\n// Time_Cost_4 = 1 * T4 * 50\n// Time_Cost_5 = 3 * T5 * 50\n// Total_Cost = Fuel_Cost_1 + Fuel_Cost_2 + Fuel_Cost_3 + Fuel_Cost_4 + Fuel_Cost_5 + Time_Cost_1 + Time_Cost_2 + Time_Cost_3 + Time_Cost_4 + Time_Cost_5\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel consumption rate per kilometer, average delivery time per truck, and the cost of fuel and time for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/km) | Delivery Time (hours/truck) | Fuel Cost ($/liter) | Time Cost ($/hour) |\n|-------|-------------------------------|-----------------------------|---------------------|--------------------|\n| 1     | 0.5                           | 2                           | 1                   | 50                 |\n| 2     | 0.6                           | 1.5                         | 1                   | 50                 |\n| 3     | 0.4                           | 2.5                         | 1                   | 50                 |\n| 4     | 0.7                           | 1                           | 1                   | 50                 |\n| 5     | 0.3                           | 3                           | 1                   | 50                 |\n\nThe company aims to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time. The company has a total of 100 trucks available for allocation.\n\nPlease help the company to minimize the total cost of operations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_1 = 0.5 * T1 * 1 # assuming Distance_1 is 1 km for simplicity\nFuel_Cost_2 = 0.6 * T2 * 1 # assuming Distance_2 is 1 km for simplicity\nFuel_Cost_3 = 0.4 * T3 * 1 # assuming Distance_3 is 1 km for simplicity\nFuel_Cost_4 = 0.7 * T4 * 1 # assuming Distance_4 is 1 km for simplicity\nFuel_Cost_5 = 0.3 * T5 * 1 # assuming Distance_5 is 1 km for simplicity\nTime_Cost_1 = 2 * T1 * 50\nTime_Cost_2 = 1.5 * T2 * 50\nTime_Cost_3 = 2.5 * T3 * 50\nTime_Cost_4 = 1 * T4 * 50\nTime_Cost_5 = 3 * T5 * 50\nTotal_Cost = Fuel_Cost_1 + Fuel_Cost_2 + Fuel_Cost_3 + Fuel_Cost_4 + Fuel_Cost_5 + Time_Cost_1 + Time_Cost_2 + Time_Cost_3 + Time_Cost_4 + Time_Cost_5\n## the objective function is: Minimize Total_Cost\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1401,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. The company needs to decide how many trips each type of truck should make to optimize its operations.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $100 per trip, and it can carry 10 tons of goods. Truck B costs $150 per trip and can carry 15 tons. Truck C costs $200 per trip and can carry 20 tons. The company aims to minimize the total cost of operations while maximizing the total tonnage transported. The objective is to minimize the ratio of total cost to total tonnage.\n// Cost of operating Truck A: Cost_A = 100 * A\n// Cost of operating Truck B: Cost_B = 150 * B\n// Cost of operating Truck C: Cost_C = 200 * C\n// Total tonnage transported: Tonnage = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (10 * A + 15 * B + 20 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 100 * A + 150 * B + 200 * C <= 5000\n\n## Generate Constraint-2:\nThe company must transport at least 300 tons of goods.\n// 10 * A + 15 * B + 20 * C >= 300\n\n## Generate Constraint-3:\nThe company can only make a maximum of 50 trips in total.\n// A + B + C <= 50",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. The company needs to decide how many trips each type of truck should make to optimize its operations. The cost of operating each truck and the tonnage it can carry are given in the following Table.\n\n| Vehicle | Cost per Trip | Tonnage per Trip |\n|---------|---------------|------------------|\n| Truck A | $100          | 10 tons          |\n| Truck B | $150          | 15 tons          |\n| Truck C | $200          | 20 tons          |\n\nThe company has a budget of $5000 for transportation costs. The company must transport at least 300 tons of goods. The company can only make a maximum of 50 trips in total. \nPlease help the company to minimize the ratio of total cost to total tonnage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 150 * B\nCost_C = 200 * C\nTonnage = 10 * A + 15 * B + 20 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / Tonnage\n## convert the division to multiplication\nmodel.addCons(obj * Tonnage == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 5000)\n## The company must transport at least 300 tons of goods.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 300)\n## The company can only make a maximum of 50 trips in total.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Minimized Cost per Tonnage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per month. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating each shift is $1000. The company aims to maximize its total monthly profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_ProductA = 50 * ProdA\n// Profit_ProductB = 70 * ProdB\n// Profit_ProductC = 60 * ProdC\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a limited production capacity of 10,000 units per month.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-3:\nThe company has a budget of $5000 for shift operations per month.\n// 1000 * NumShifts <= 5000\n\n## Generate Constraint-4:\nThe production of ProductC cannot exceed 3000 units per month.\n// ProdC <= 3000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per month and the number of shifts to operate in its factory to meet production demands. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating each shift is $1000. The company aims to maximize its total monthly profit, considering both the revenue from product sales and the cost of operating shifts.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| ProductA | $50            |\n| ProductB | $70            |\n| ProductC | $60            |\n\nThe factory has a limited production capacity of 10,000 units per month. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a budget of $5000 for shift operations per month. The production of ProductC cannot exceed 3000 units per month.\n\nPlease help the company to maximize its total monthly profit by determining the optimal production quantities for ProductA, ProductB, and ProductC, and the number of shifts to operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProdA\nProfit_ProductB = 70 * ProdB\nProfit_ProductC = 60 * ProdC\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a limited production capacity of 10,000 units per month.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n# The company has a budget of $5000 for shift operations per month.\nmodel.addCons(1000 * NumShifts <= 5000)\n# The production of ProductC cannot exceed 3000 units per month.\nmodel.addCons(ProdC <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50            | $30                      |\n| ProductB | $70            | $40                      |\n| ProductC | $60            | $35                      |\n\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductA must be at least twice the production of ProductB. \n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutoA\", \"range\": \"AutoA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutoB\", \"range\": \"AutoB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutoC\", \"range\": \"AutoC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 5 * AutoA)) * QA\n// Total profit for ProductB: ProfitB = (180 - (120 - 5 * AutoB)) * QB\n// Total profit for ProductC: ProfitC = (200 - (150 - 5 * AutoC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation across all products.\n// AutoA * QA + AutoB * QB + AutoC * QC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// QA + QB + QC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product (ProductA, ProductB, ProductC) and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for implementing automation across all products. The total production capacity of the company is 2000 units. Please help the company to determine the optimal production quantities and levels of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutoA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoA\", lb=0) # level of automation for ProductA\nAutoB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoB\", lb=0) # level of automation for ProductB\nAutoC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoC\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 5 * AutoA)) * QA\nProfitB = (180 - (120 - 5 * AutoB)) * QB\nProfitC = (200 - (150 - 5 * AutoC)) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation across all products.\nmodel.addCons(AutoA * QA + AutoB * QB + AutoC * QC <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(QA + QB + QC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutoA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutoB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutoC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit for ProductA\": \"MaterialA\", \"range\": \"MaterialA >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit for ProductB\": \"MaterialB\", \"range\": \"MaterialB >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit for ProductC\": \"MaterialC\", \"range\": \"MaterialC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor and raw materials decreases linearly with the investment in new technology. The initial labor cost per hour is $20, and the initial cost of raw materials per unit is $10. The revenue per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - (20 * LaborA + 10 * MaterialA)) * UnitsA\n// Total profit for ProductB: ProfitB = (60 - (20 * LaborB + 10 * MaterialB)) * UnitsB\n// Total profit for ProductC: ProfitC = (70 - (20 * LaborC + 10 * MaterialC)) * UnitsC\n// Labor and material costs decrease by 0.01% for every $100 invested in technology.\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw materials available.\n// MaterialA * UnitsA + MaterialB * UnitsB + MaterialC * UnitsC <= 1500\n\n## Generate Constraint-3:\nThe total investment in new technology cannot exceed $50,000.\n// TechInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product. The initial labor cost per hour is $20, and the initial cost of raw materials per unit is $10. The revenue per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit |\n|---------|------------------|\n| ProductA | $50             |\n| ProductB | $60             |\n| ProductC | $70             |\n\nThe company has a total of 1000 labor hours available. The company has a total of 1500 units of raw materials available. The total investment in new technology cannot exceed $50,000.\n\nPlease help the company determine the optimal number of units to produce for each product, the allocation of labor hours and raw materials per unit, and the investment in new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define labor and material costs based on technology investment\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours per unit for ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours per unit for ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours per unit for ProductC\nMaterialA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialA\", lb=0)  # raw materials per unit for ProductA\nMaterialB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialB\", lb=0)  # raw materials per unit for ProductB\nMaterialC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialC\", lb=0)  # raw materials per unit for ProductC\n\n# Define the effect of technology investment on costs\nmodel.addCons(LaborA == 20 * (1 - 0.0001 * TechInvestment / 100))\nmodel.addCons(LaborB == 20 * (1 - 0.0001 * TechInvestment / 100))\nmodel.addCons(LaborC == 20 * (1 - 0.0001 * TechInvestment / 100))\nmodel.addCons(MaterialA == 10 * (1 - 0.0001 * TechInvestment / 100))\nmodel.addCons(MaterialB == 10 * (1 - 0.0001 * TechInvestment / 100))\nmodel.addCons(MaterialC == 10 * (1 - 0.0001 * TechInvestment / 100))\n\n# Define objective function\nProfitA = (50 - (20 * LaborA + 10 * MaterialA)) * UnitsA\nProfitB = (60 - (20 * LaborB + 10 * MaterialB)) * UnitsB\nProfitC = (70 - (20 * LaborC + 10 * MaterialC)) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 1000)\nmodel.addCons(MaterialA * UnitsA + MaterialB * UnitsB + MaterialC * UnitsC <= 1500)\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Technology Investment: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years.\nType C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output.\n// EnergyOutput = 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20\n// TotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n// So, the objective function is: Minimize (TotalCost - EnergyOutput)\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of solar panels.\n// 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000\n\n## Generate Constraint-2:\nThe total energy output from the solar panels must be at least 1,000,000 kWh per year.\n// 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20 >= 1000000\n\n## Generate Constraint-3:\nThe number of Type C solar panels must not exceed 50% of the total number of solar panels.\n// TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)\n\n## Generate Constraint-4:\nThe city aims to install at least 100 solar panels in total.\n// TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels >= 100",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies, costs, and lifespans. The city needs to determine the number of each type of solar panel to install in each district. The details of each type of solar panel are given in the following Table.\n\n| Type of Solar Panel | Efficiency | Cost per Panel | Lifespan |\n|---------------------|------------|----------------|----------|\n| Type A              | 15%        | $1000          | 10 years |\n| Type B              | 20%        | $1500          | 15 years |\n| Type C              | 25%        | $2000          | 20 years |\n\nThe city has a budget of $1,000,000 for the installation of solar panels. The total energy output from the solar panels must be at least 1,000,000 kWh per year. The number of Type C solar panels must not exceed 50% of the total number of solar panels. The city aims to install at least 100 solar panels in total.\n\nPlease help the city to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergyOutput = 0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20\nTotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n# So, the objective function is: Minimize (TotalCost - EnergyOutput)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost - EnergyOutput)\n\n# Add constraints\n# The city has a budget of $1,000,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000)\n# The total energy output from the solar panels must be at least 1,000,000 kWh per year.\nmodel.addCons(0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20 >= 1000000)\n# The number of Type C solar panels must not exceed 50% of the total number of solar panels.\nmodel.addCons(TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\n# The city aims to install at least 100 solar panels in total.\nmodel.addCons(TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1222,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck maintenance\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van maintenance\": \"MaintenanceVan\", \"range\": \"MaintenanceVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike maintenance\": \"MaintenanceBike\", \"range\": \"MaintenanceBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year.\n// Total operational cost for Trucks: CostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)^2\n// Total operational cost for Vans: CostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)^2\n// Total operational cost for Bikes: CostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)^2\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and maintenance.\n// Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs. The operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year.\n\n| Vehicle Type | Operational Cost per Month | Reduction Rate per $100 Maintenance |\n|--------------|----------------------------|-------------------------------------|\n| Trucks       | $1000                      | 1%                                  |\n| Vans         | $500                       | 2%                                  |\n| Bikes        | $100                       | 5%                                  |\n\nThe company has a budget of $1,000,000 for vehicle purchases and maintenance. Please help the company to determine the optimal number of each type of vehicle to purchase and the optimal investment in maintenance to minimize the total operational cost over the next year.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", lb=0)  # investment in Truck maintenance\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", lb=0)  # investment in Van maintenance\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", lb=0)  # investment in Bike maintenance\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total operational cost for Trucks: CostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nCostTruck = model.addVar(name=\"CostTruck\")\nmodel.addCons(CostTruck == 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)**2)\n\n## Total operational cost for Vans: CostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)^2\nCostVan = model.addVar(name=\"CostVan\")\nmodel.addCons(CostVan == 6000 * Vans * (1 - 0.0002 * MaintenanceVan)**2)\n\n## Total operational cost for Bikes: CostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)^2\nCostBike = model.addVar(name=\"CostBike\")\nmodel.addCons(CostBike == 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)**2)\n\n## the objective function is: Minimize (CostTruck + CostVan + CostBike)\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases and maintenance.\nmodel.addCons(Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Truck maintenance: \", model.getVal(MaintenanceTruck))\n    print(\"Investment in Van maintenance: \", model.getVal(MaintenanceVan))\n    print(\"Investment in Bike maintenance: \", model.getVal(MaintenanceBike))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1530,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Trucks\": \"FuelEffTrucks\", \"range\": \"FuelEffTrucks >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Vans\": \"FuelEffVans\", \"range\": \"FuelEffVans >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Bikes\": \"FuelEffBikes\", \"range\": \"FuelEffBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies.\n// DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n// OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n// The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1.\n// 3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and management constraints.\n// Trucks + Vans + Bikes <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities. The company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies.\n\n| Vehicle Type | Cost per Unit of Fuel |\n|--------------|-----------------------|\n| Trucks       | $3                    |\n| Vans         | $2                    |\n| Bikes        | $1                    |\n\nThe company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The total number of vehicles cannot exceed 100 due to parking and management constraints.\n\nPlease help the company to maximize the objective function: Maximize (DeliveryEfficiency - OperationalCost), where DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2) and OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nFuelEffTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffTrucks\", lb=0)  # fuel efficiency of Trucks\nFuelEffVans = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffVans\", lb=0)  # fuel efficiency of Vans\nFuelEffBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffBikes\", lb=0)  # fuel efficiency of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n## OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n## The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n## convert the division to multiplication\nDeliveryEfficiency = Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes\nOperationalCost = Trucks * FuelEffTrucks**2 + Vans * FuelEffVans**2 + Bikes * FuelEffBikes**2\nDenominator = Trucks**2 + Vans**2 + Bikes**2\nmodel.addCons(obj * Denominator == DeliveryEfficiency * Denominator - OperationalCost * Denominator)\n\n# Add constraints\n## The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance.\nmodel.addCons(3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000)\n## The total number of vehicles cannot exceed 100 due to parking and management constraints.\nmodel.addCons(Trucks + Vans + Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Fuel Efficiency of Trucks: \", model.getVal(FuelEffTrucks))\n    print(\"Fuel Efficiency of Vans: \", model.getVal(FuelEffVans))\n    print(\"Fuel Efficiency of Bikes: \", model.getVal(FuelEffBikes))\n    print(\"Maximized Efficiency - Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1406,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines.\n// {\"cargo load on truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency (in liters per kilometer) and a maximum capacity. Truck 1 has a fuel efficiency of 5 + 0.01 * T1 liters/km, Truck 2 has 6 + 0.015 * T2 liters/km, Truck 3 has 7 + 0.02 * T3 liters/km, Truck 4 has 8 + 0.025 * T4 liters/km, and Truck 5 has 9 + 0.03 * T5 liters/km. The total distance to be covered by all trucks is 1000 km. The company wants to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = (5 + 0.01 * T1) * 1000 + (6 + 0.015 * T2) * 1000 + (7 + 0.02 * T3) * 1000 + (8 + 0.025 * T4) * 1000 + (9 + 0.03 * T5) * 1000\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 500 tons.\n// T1 + T2 + T3 + T4 + T5 = 500",
        "question": "A logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines. Each truck has a different fuel efficiency (in liters per kilometer) and a maximum capacity. Truck 1 has a fuel efficiency of 5 + 0.01 * T1 liters/km, Truck 2 has 6 + 0.015 * T2 liters/km, Truck 3 has 7 + 0.02 * T3 liters/km, Truck 4 has 8 + 0.025 * T4 liters/km, and Truck 5 has 9 + 0.03 * T5 liters/km. The total distance to be covered by all trucks is 1000 km. The total cargo to be delivered is 500 tons. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # cargo load on truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0) # cargo load on truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0) # cargo load on truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0) # cargo load on truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0) # cargo load on truck 5\n\n# Define objective function\n## calculate fuel consumption for each truck\nFuel_T1 = (5 + 0.01 * T1) * 1000\nFuel_T2 = (6 + 0.015 * T2) * 1000\nFuel_T3 = (7 + 0.02 * T3) * 1000\nFuel_T4 = (8 + 0.025 * T4) * 1000\nFuel_T5 = (9 + 0.03 * T5) * 1000\n## total fuel consumption\nFuel = Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total cargo to be delivered is 500 tons.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo Load on Truck 1: \", model.getVal(T1))\n    print(\"Cargo Load on Truck 2: \", model.getVal(T2))\n    print(\"Cargo Load on Truck 3: \", model.getVal(T3))\n    print(\"Cargo Load on Truck 4: \", model.getVal(T4))\n    print(\"Cargo Load on Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with different capacities and fuel efficiencies. The company needs to determine the optimal number of trips each truck should make to transport goods from one city to another.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and capacity. Truck 1 consumes 10 liters per trip and has a capacity of 20 tons. Truck 2 consumes 12 liters per trip and has a capacity of 25 tons. Truck 3 consumes 15 liters per trip and has a capacity of 30 tons. Truck 4 consumes 18 liters per trip and has a capacity of 35 tons. Truck 5 consumes 20 liters per trip and has a capacity of 40 tons. The company wants to minimize the total fuel consumption while ensuring all goods are transported.\n// Total fuel consumption: Fuel = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n// Total transported goods: Goods = 20 * T1 + 25 * T2 + 30 * T3 + 35 * T4 + 40 * T5\n// The objective function is: Minimize Fuel subject to the constraint that Goods >= Total required goods\n\n## Generate Constraint-1:\nThe company needs to transport a total of 500 tons of goods.\n// 20 * T1 + 25 * T2 + 30 * T3 + 35 * T4 + 40 * T5 >= 500\n\n## Generate Constraint-2:\nEach truck can make a maximum of 20 trips.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20",
        "question": "A logistics company operates a fleet of 5 trucks with different capacities and fuel efficiencies. The company needs to determine the optimal number of trips each truck should make to transport goods from one city to another. The fuel consumption and capacity for each truck are given in the following Table.\n\n| Truck | Fuel Consumption (liters/trip) | Capacity (tons) |\n|-------|-------------------------------|-----------------|\n| 1     | 10                            | 20              |\n| 2     | 12                            | 25              |\n| 3     | 15                            | 30              |\n| 4     | 18                            | 35              |\n| 5     | 20                            | 40              |\n\nThe company needs to transport a total of 500 tons of goods. Each truck can make a maximum of 20 trips. Please help the company to minimize the total fuel consumption while ensuring all goods are transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for truck 5\n\n# Define objective function\nFuel = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\nmodel.setObjective(Fuel, \"minimize\")\n\n# Add constraints\n## The company needs to transport a total of 500 tons of goods.\nmodel.addCons(20 * T1 + 25 * T2 + 30 * T3 + 35 * T4 + 40 * T5 >= 500)\n## Each truck can make a maximum of 20 trips.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company wants to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n// Delivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\n// Delivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\n// Delivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\n// Delivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\n// Delivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n// So, the objective function is: Maximize (Delivery_Efficiency_TruckA + Delivery_Efficiency_TruckB + Delivery_Efficiency_TruckC + Delivery_Efficiency_TruckD + Delivery_Efficiency_TruckE)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the month.\n// 5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10,000\n\n## Generate Constraint-2:\nThe company has a total operating budget of $30,000 for the month.\n// 2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30,000\n\n## Generate Constraint-3:\nThe company has a total fleet size of 500 trucks.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 500\n\n## Generate Constraint-4:\nDue to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\n// TruckA + TruckB <= 200",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company has a total fuel budget of 10,000 liters for the month. The company has a total operating budget of $30,000 for the month. The company has a total fleet size of 500 trucks. Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\nPlease help the company to maximize the delivery efficiency (total delivery capacity per liter of fuel).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDelivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\nDelivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\nDelivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\nDelivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\nDelivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE) == 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 2500 * TruckD + 3000 * TruckE)\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the month.\nmodel.addCons(5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10000)\n## The company has a total operating budget of $30,000 for the month.\nmodel.addCons(2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30000)\n## The company has a total fleet size of 500 trucks.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 500)\n## Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\nmodel.addCons(TruckA + TruckB <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\n// Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\n// Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units per month.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceAUnits <= 2 * DeviceBUnits",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company has a production capacity of 1000 units per month. Due to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * DeviceA2) * DeviceA2 * DeviceA_b2 + 50 * DeviceA1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.05 * DeviceB2) * DeviceB2 * DeviceB_b2 + 70 * DeviceB1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=150)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=150, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (60 - 0.08 * DeviceC2) * DeviceC2 * DeviceC_b2 + 60 * DeviceC1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\nDeviceD1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD1\", lb=0, ub=250)\nDeviceD2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD2\", lb=250, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceDUnits == DeviceD1*DeviceD_b1 + DeviceD2*DeviceD_b2)\nProfit_DeviceD = (80 - 0.12 * DeviceD2) * DeviceD2 * DeviceD_b2 + 80 * DeviceD1 * DeviceD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000)\nmodel.addCons(DeviceAUnits <= 2 * DeviceBUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily to maximize energy production. Additionally, the company is considering investing in energy storage systems for each type of power plant to enhance efficiency and stability of power output.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Solar\": \"SolarStorage\", \"range\": \"SolarStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Wind\": \"WindStorage\", \"range\": \"WindStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Hydro\": \"HydroStorage\", \"range\": \"HydroStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company aims to maximize the total daily energy production.\n// Total energy for Solar: EnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\n// Total energy for Wind: EnergyWind = (120 + 0.0008 * WindStorage) * WindHours\n// Total energy for Hydro: EnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and energy storage investments.\n// 1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all power plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily and the investment in energy storage systems for each type to maximize energy production. The energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company aims to maximize the total daily energy production.\n\n| Power Plant | Energy Output Increase per $1000 Investment |\n|-------------|---------------------------------------------|\n| Solar       | 1 MWh per hour of operation                 |\n| Wind        | 0.8 MWh per hour of operation               |\n| Hydro       | 1.2 MWh per hour of operation               |\n\nThe company has a total budget of $100,000 for operating costs and energy storage investments. The total operating hours for all power plants must not exceed 24 hours per day.\n\nPlease help the company determine the optimal number of operating hours for each power plant and the investment in energy storage to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of operating hours for Hydro\nSolarStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarStorage\", lb=0)  # investment in energy storage for Solar\nWindStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"WindStorage\", lb=0)  # investment in energy storage for Wind\nHydroStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroStorage\", lb=0)  # investment in energy storage for Hydro\n\n# Define objective function\nEnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\nEnergyWind = (120 + 0.0008 * WindStorage) * WindHours\nEnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n# So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for operating costs and energy storage investments.\nmodel.addCons(1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000)\n# The total operating hours for all power plants must not exceed 24 hours per day.\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Solar Storage: \", model.getVal(SolarStorage))\n    print(\"Investment in Wind Storage: \", model.getVal(WindStorage))\n    print(\"Investment in Hydro Storage: \", model.getVal(HydroStorage))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company also needs to consider the maintenance cost per kilometer for each truck type.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency for trucks in Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency for trucks in Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"maintenance cost per km for trucks in Region 1\": \"MaintenanceCost1\", \"range\": \"MaintenanceCost1 >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per km for trucks in Region 2\": \"MaintenanceCost2\", \"range\": \"MaintenanceCost2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The cost of fuel per liter is $1.5, and each truck travels an average of 500 km per day.\n// FuelCostRegion1 = 500 * TrucksRegion1 * (1.5 / FuelEfficiency1)\n// FuelCostRegion2 = 500 * TrucksRegion2 * (1.5 / FuelEfficiency2)\n// MaintenanceCostRegion1 = 500 * TrucksRegion1 * MaintenanceCost1\n// MaintenanceCostRegion2 = 500 * TrucksRegion2 * MaintenanceCost2\n// So, the objective function is: Minimize (FuelCostRegion1 + FuelCostRegion2 + MaintenanceCostRegion1 + MaintenanceCostRegion2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for truck maintenance per day.\n// MaintenanceCostRegion1 + MaintenanceCostRegion2 <= 10000\n\n## Generate Constraint-2:\nThe company can only allocate a maximum of 20 trucks in total across both regions.\n// TrucksRegion1 + TrucksRegion2 <= 20",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company also needs to consider the maintenance cost per kilometer for each truck type. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The cost of fuel per liter is $1.5, and each truck travels an average of 500 km per day. The company has a total budget of $10,000 for truck maintenance per day. The company can only allocate a maximum of 20 trucks in total across both regions.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0.001)  # fuel efficiency for trucks in Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0.001)  # fuel efficiency for trucks in Region 2\nMaintenanceCost1 = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost1\", lb=0)  # maintenance cost per km for trucks in Region 1\nMaintenanceCost2 = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost2\", lb=0)  # maintenance cost per km for trucks in Region 2\n\n# Define objective function\nFuelCostRegion1 = 500 * TrucksRegion1 * (1.5 / FuelEfficiency1)\nFuelCostRegion2 = 500 * TrucksRegion2 * (1.5 / FuelEfficiency2)\nMaintenanceCostRegion1 = 500 * TrucksRegion1 * MaintenanceCost1\nMaintenanceCostRegion2 = 500 * TrucksRegion2 * MaintenanceCost2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostRegion1 + FuelCostRegion2 + MaintenanceCostRegion1 + MaintenanceCostRegion2)\n\n# Add constraints\nmodel.addCons(MaintenanceCostRegion1 + MaintenanceCostRegion2 <= 10000)\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Maintenance Cost per km for Region 1: \", model.getVal(MaintenanceCost1))\n    print(\"Maintenance Cost per km for Region 2: \", model.getVal(MaintenanceCost2))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of constructing a solar facility is $500,000, a wind facility is $600,000, a hydro facility is $700,000, a biomass facility is $400,000, and a geothermal facility is $800,000. The energy output per facility is 1.5 MW for solar, 2 MW for wind, 1.8 MW for hydro, 1.2 MW for biomass, and 2.5 MW for geothermal. The city wants to minimize the cost per MW of energy produced.\n// Total cost: Cost = 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal\n// Total energy output: Energy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of these facilities.\n// 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal <= 10,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 50 MW of renewable energy.\n// 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently. The cost of constructing a solar facility is $500,000, a wind facility is $600,000, a hydro facility is $700,000, a biomass facility is $400,000, and a geothermal facility is $800,000. The energy output per facility is 1.5 MW for solar, 2 MW for wind, 1.8 MW for hydro, 1.2 MW for biomass, and 2.5 MW for geothermal. The city has a budget of $10 million for the construction of these facilities and aims to produce at least 50 MW of renewable energy. The city wants to minimize the cost per MW of energy produced. Please help the city determine the optimal number of each type of facility to construct.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal\nEnergy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of these facilities.\nmodel.addCons(500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal <= 10000000)\n## The city aims to produce at least 50 MW of renewable energy.\nmodel.addCons(1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per MW: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large vehicles\": \"ExtraLarge\", \"range\": \"ExtraLarge >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer.\n// Profit_Small = (1.20 - 0.50) * Small\n// Profit_Medium = (1.50 - 0.70) * Medium\n// Profit_Large = (1.80 - 0.90) * Large\n// Profit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\n// Profit_Electric = (1.00 - 0.30) * Electric\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\n\n## Generate Constraint-1:\nThe total number of vehicles the company can operate is limited to 200.\n// Small + Medium + Large + ExtraLarge + Electric <= 200\n\n## Generate Constraint-2:\nThe company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n// 2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000\n\n## Generate Constraint-3:\nThe cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n// Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300\n\n## Generate Constraint-4:\nThe company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n// Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric)",
        "question": "A logistics company is planning its fleet usage for the next quarter and has five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer. The cost and revenue per kilometer for each vehicle type are given in the following Table.\n\n| Vehicle Type   | Cost per Kilometer | Revenue per Kilometer |\n|----------------|--------------------|-----------------------|\n| Small          | $0.50              | $1.20                 |\n| Medium         | $0.70              | $1.50                 |\n| Large          | $0.90              | $1.80                 |\n| Extra-Large    | $1.10              | $2.10                 |\n| Electric       | $0.30              | $1.00                 |\n\nThe company has several constraints:\n1. The total number of vehicles the company can operate is limited to 200.\n2. The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n3. The cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n4. The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n\nPlease help the company determine the optimal number of each type of vehicle to maximize the profit per kilometer while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of Large vehicles\nExtraLarge = model.addVar(vtype=\"INTEGER\", name=\"ExtraLarge\", lb=0) # number of Extra-Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0) # number of Electric vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Small = (1.20 - 0.50) * Small\nProfit_Medium = (1.50 - 0.70) * Medium\nProfit_Large = (1.80 - 0.90) * Large\nProfit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\nProfit_Electric = (1.00 - 0.30) * Electric\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric)\n\n# Add constraints\n## The total number of vehicles the company can operate is limited to 200.\nmodel.addCons(Small + Medium + Large + ExtraLarge + Electric <= 200)\n## The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000.\nmodel.addCons(2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000)\n## The cargo capacity constraint is as follows:\nmodel.addCons(Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300)\n## The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\nmodel.addCons(Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Number of Extra-Large Vehicles: \", model.getVal(ExtraLarge))\n    print(\"Number of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Maximized Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1831,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Buses\": \"Buses\", \"range\": \"Buses >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"Sedans\", \"range\": \"Sedans >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of vehicle varies, as does the revenue generated per vehicle. The cost of Trucks is $100,000 with a maintenance cost of $10,000 per year, and they generate $50,000 per year. Vans cost $50,000 with a maintenance cost of $5,000 per year, and they generate $30,000 per year. Buses cost $80,000 with a maintenance cost of $8,000 per year, and they generate $40,000 per year. Sedans cost $30,000 with a maintenance cost of $3,000 per year, and they generate $20,000 per year. Motorcycles cost $10,000 with a maintenance cost of $1,000 per year, and they generate $10,000 per year. The company wants to maximize the net profit per vehicle.\n// Total net profit for Trucks: Profit_Trucks = 50,000 * Trucks - (100,000 * Trucks + 10,000 * Trucks)\n// Total net profit for Vans: Profit_Vans = 30,000 * Vans - (50,000 * Vans + 5,000 * Vans)\n// Total net profit for Buses: Profit_Buses = 40,000 * Buses - (80,000 * Buses + 8,000 * Buses)\n// Total net profit for Sedans: Profit_Sedans = 20,000 * Sedans - (30,000 * Sedans + 3,000 * Sedans)\n// Total net profit for Motorcycles: Profit_Motorcycles = 10,000 * Motorcycles - (10,000 * Motorcycles + 1,000 * Motorcycles)\n// So, the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / (Trucks + Vans + Buses + Sedans + Motorcycles))\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing vehicles.\n// 100,000 * Trucks + 50,000 * Vans + 80,000 * Buses + 30,000 * Sedans + 10,000 * Motorcycles <= 5,000,000\n\n## Generate Constraint-2:\nThe annual maintenance budget is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 8,000 * Buses + 3,000 * Sedans + 1,000 * Motorcycles <= 500,000\n\n## Generate Constraint-3:\nThe company must have at least 10 different vehicles in total.\n// Trucks + Vans + Buses + Sedans + Motorcycles >= 10\n\n## Generate Constraint-4:\nThe number of Trucks must be at least twice the number of Sedans.\n// Trucks >= 2 * Sedans\n\n## Generate Constraint-5:\nThe number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans.\n// Motorcycles <= 0.5 * (Trucks + Vans)",
        "question": "A logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation. The cost of purchasing and maintaining each type of vehicle varies, as does the revenue generated per vehicle. The company wants to maximize the net profit per vehicle. The company has a budget of $5,000,000 for purchasing vehicles and an annual maintenance budget of $500,000. The company must have at least 10 different vehicles in total. The number of Trucks must be at least twice the number of Sedans. The number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans.\n\nPlease help the company determine the optimal number of each type of vehicle to purchase and maintain to maximize the net profit per vehicle.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBuses = model.addVar(vtype=\"INTEGER\", name=\"Buses\", lb=0)  # number of Buses\nSedans = model.addVar(vtype=\"INTEGER\", name=\"Sedans\", lb=0)  # number of Sedans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of Motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Trucks = 50000 * Trucks - (100000 * Trucks + 10000 * Trucks)\nProfit_Vans = 30000 * Vans - (50000 * Vans + 5000 * Vans)\nProfit_Buses = 40000 * Buses - (80000 * Buses + 8000 * Buses)\nProfit_Sedans = 20000 * Sedans - (30000 * Sedans + 3000 * Sedans)\nProfit_Motorcycles = 10000 * Motorcycles - (10000 * Motorcycles + 1000 * Motorcycles)\nTotal_Vehicles = Trucks + Vans + Buses + Sedans + Motorcycles\n## the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / Total_Vehicles)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Vehicles == Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing vehicles.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 80000 * Buses + 30000 * Sedans + 10000 * Motorcycles <= 5000000)\n## The annual maintenance budget is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 8000 * Buses + 3000 * Sedans + 1000 * Motorcycles <= 500000)\n## The company must have at least 10 different vehicles in total.\nmodel.addCons(Trucks + Vans + Buses + Sedans + Motorcycles >= 10)\n## The number of Trucks must be at least twice the number of Sedans.\nmodel.addCons(Trucks >= 2 * Sedans)\n## The number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans.\nmodel.addCons(Motorcycles <= 0.5 * (Trucks + Vans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Buses: \", model.getVal(Buses))\n    print(\"Number of Sedans: \", model.getVal(Sedans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Maximized Net Profit per Vehicle: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet. The variables include the number of trucks assigned to each region (TruckA, TruckB, TruckC, TruckD, TruckE) and the speed at which each truck operates (SpeedA, SpeedB, SpeedC, SpeedD, SpeedE).\n// {\"number of trucks in region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in region A\": \"SpeedA\", \"range\": \"0 < SpeedA < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region B\": \"SpeedB\", \"range\": \"0 < SpeedB < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region C\": \"SpeedC\", \"range\": \"0 < SpeedC < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region D\": \"SpeedD\", \"range\": \"0 < SpeedD < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region E\": \"SpeedE\", \"range\": \"0 < SpeedE < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. The cost function for each region is given by a quadratic function where the cost increases at a faster rate as the speed increases. The company aims to minimize the total cost of fuel and maintenance across all regions.\n// Total cost for region A: CostA = TruckA * (0.1 * SpeedA^2 + 5 * SpeedA + 100)\n// Total cost for region B: CostB = TruckB * (0.1 * SpeedB^2 + 5 * SpeedB + 100)\n// Total cost for region C: CostC = TruckC * (0.1 * SpeedC^2 + 5 * SpeedC + 100)\n// Total cost for region D: CostD = TruckD * (0.1 * SpeedD^2 + 5 * SpeedD + 100)\n// Total cost for region E: CostE = TruckE * (0.1 * SpeedE^2 + 5 * SpeedE + 100)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nDue to regional regulations, the maximum number of trucks allowed in each region is limited: 30 trucks in region A, 25 trucks in region B, 20 trucks in region C, 15 trucks in region D, and 10 trucks in region E.\n// TruckA <= 30; TruckB <= 25; TruckC <= 20; TruckD <= 15; TruckE <= 10\n\n## Generate Constraint-3:\nThe minimum speed requirement for each region is 20 km/h to ensure timely deliveries.\n// SpeedA >= 20; SpeedB >= 20; SpeedC >= 20; SpeedD >= 20; SpeedE >= 20",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet. The variables include the number of trucks assigned to each region (TruckA, TruckB, TruckC, TruckD, TruckE) and the speed at which each truck operates (SpeedA, SpeedB, SpeedC, SpeedD, SpeedE). The cost of fuel and maintenance for each region is given by a quadratic function where the cost increases at a faster rate as the speed increases. The company aims to minimize the total cost of fuel and maintenance across all regions.\n\n| Region | Number of Trucks | Speed Range |\n|--------|------------------|-------------|\n| A      | TruckA           | 0 < SpeedA < 100 |\n| B      | TruckB           | 0 < SpeedB < 100 |\n| C      | TruckC           | 0 < SpeedC < 100 |\n| D      | TruckD           | 0 < SpeedD < 100 |\n| E      | TruckE           | 0 < SpeedE < 100 |\n\nThe total number of trucks available in the fleet is 100. Due to regional regulations, the maximum number of trucks allowed in each region is limited: 30 trucks in region A, 25 trucks in region B, 20 trucks in region C, 15 trucks in region D, and 10 trucks in region E. The minimum speed requirement for each region is 20 km/h to ensure timely deliveries.\n\nPlease help the company to minimize the total cost of fuel and maintenance across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of trucks in region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of trucks in region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of trucks in region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of trucks in region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)  # number of trucks in region E\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0, ub=100)  # speed of trucks in region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0, ub=100)  # speed of trucks in region B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0, ub=100)  # speed of trucks in region C\nSpeedD = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedD\", lb=0, ub=100)  # speed of trucks in region D\nSpeedE = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedE\", lb=0, ub=100)  # speed of trucks in region E\n\n# Define objective function\nCostA = TruckA * (0.1 * SpeedA**2 + 5 * SpeedA + 100)\nCostB = TruckB * (0.1 * SpeedB**2 + 5 * SpeedB + 100)\nCostC = TruckC * (0.1 * SpeedC**2 + 5 * SpeedC + 100)\nCostD = TruckD * (0.1 * SpeedD**2 + 5 * SpeedD + 100)\nCostE = TruckE * (0.1 * SpeedE**2 + 5 * SpeedE + 100)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(TruckA <= 30)\nmodel.addCons(TruckB <= 25)\nmodel.addCons(TruckC <= 20)\nmodel.addCons(TruckD <= 15)\nmodel.addCons(TruckE <= 10)\nmodel.addCons(SpeedA >= 20)\nmodel.addCons(SpeedB >= 20)\nmodel.addCons(SpeedC >= 20)\nmodel.addCons(SpeedD >= 20)\nmodel.addCons(SpeedE >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Speed of Trucks in Region A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks in Region B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks in Region C: \", model.getVal(SpeedC))\n    print(\"Speed of Trucks in Region D: \", model.getVal(SpeedD))\n    print(\"Speed of Trucks in Region E: \", model.getVal(SpeedE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1394,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the amount of raw materials to be used for each product. The marketing budget affects the sales of each product, and the raw materials usage affects the production cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductA\": \"RawMaterialsA\", \"range\": \"RawMaterialsA >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductB\": \"RawMaterialsB\", \"range\": \"RawMaterialsB >= 0\", \"type\": \"continuous\"}\n// {\"raw materials usage for ProductC\": \"RawMaterialsC\", \"range\": \"RawMaterialsC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe sales of each product increase by 5% for every $1,000 spent on marketing for that product. The production cost decreases by $2 for every $100 increase in raw materials usage for that product. The initial sales for ProductA is $100 per unit, for ProductB is $150 per unit, and for ProductC is $200 per unit. The initial production cost for ProductA is $50 per unit, for ProductB is $75 per unit, and for ProductC is $100 per unit. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.05 * MarketingBudgetA / 1000) * QuantityA - (50 - 0.02 * RawMaterialsA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 + 0.05 * MarketingBudgetB / 1000) * QuantityB - (75 - 0.02 * RawMaterialsB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 + 0.05 * MarketingBudgetC / 1000) * QuantityC - (100 - 0.02 * RawMaterialsC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity cannot exceed 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000\n\n## Generate Constraint-3:\nThe total raw materials usage must not exceed 50,000 units.\n// RawMaterialsA + RawMaterialsB + RawMaterialsC <= 50000\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 2000\n\n## Generate Constraint-5:\nThe marketing budget for ProductC must be at least 20% of the total marketing budget.\n// MarketingBudgetC >= 0.2 * (MarketingBudgetA + MarketingBudgetB + MarketingBudgetC)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the amount of raw materials to be used for each product. The sales of each product increase by 5% for every $1,000 spent on marketing for that product. The production cost decreases by $2 for every $100 increase in raw materials usage for that product. The initial sales for ProductA is $100 per unit, for ProductB is $150 per unit, and for ProductC is $200 per unit. The initial production cost for ProductA is $50 per unit, for ProductB is $75 per unit, and for ProductC is $100 per unit. The company aims to maximize the total profit from all products.\n\nThe total production quantity cannot exceed 10,000 units. The total marketing budget cannot exceed $100,000. The total raw materials usage must not exceed 50,000 units. The company must produce at least 1,000 units of ProductA and 2,000 units of ProductB. The marketing budget for ProductC must be at least 20% of the total marketing budget.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nRawMaterialsA = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsA\", lb=0)  # raw materials usage for ProductA\nRawMaterialsB = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsB\", lb=0)  # raw materials usage for ProductB\nRawMaterialsC = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialsC\", lb=0)  # raw materials usage for ProductC\n\n# Set lower bounds for QuantityA and QuantityB\nmodel.addCons(QuantityA >= 1000)\nmodel.addCons(QuantityB >= 2000)\n\n# Define objective function\nProfitA = (100 + 0.05 * MarketingBudgetA / 1000) * QuantityA - (50 - 0.02 * RawMaterialsA / 100) * QuantityA\nProfitB = (150 + 0.05 * MarketingBudgetB / 1000) * QuantityB - (75 - 0.02 * RawMaterialsB / 100) * QuantityB\nProfitC = (200 + 0.05 * MarketingBudgetC / 1000) * QuantityC - (100 - 0.02 * RawMaterialsC / 100) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\nmodel.addCons(RawMaterialsA + RawMaterialsB + RawMaterialsC <= 50000)\nmodel.addCons(MarketingBudgetC >= 0.2 * (MarketingBudgetA + MarketingBudgetB + MarketingBudgetC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Raw Materials Usage for ProductA: \", model.getVal(RawMaterialsA))\n    print(\"Raw Materials Usage for ProductB: \", model.getVal(RawMaterialsB))\n    print(\"Raw Materials Usage for ProductC: \", model.getVal(RawMaterialsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 * MachineA_units) - 10,000\n// Total profit for MachineB: Profit_MachineB = (700 * MachineB_units) - 15,000\n// Total profit for MachineC: Profit_MachineC = (900 * MachineC_units) - 20,000\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for setup costs.\n// 10,000 * MachineA_units + 15,000 * MachineB_units + 20,000 * MachineC_units <= 100,000\n\n## Generate Constraint-2:\nThe production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\n// MachineA_units <= 100\n// MachineB_units <= 80\n// MachineC_units <= 60",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type. The profit per unit and setup costs for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| MachineA | $500            | $10,000    |\n| MachineB | $700            | $15,000    |\n| MachineC | $900            | $20,000    |\n\nThe company has a total budget of $100,000 for setup costs. The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units. Please help the company to maximize the total profit, which is calculated as the sum of the profits from each machine type minus their respective setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0) # number of units of MachineA\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0) # number of units of MachineB\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0) # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 * MachineA_units) - 10000\nProfit_MachineB = (700 * MachineB_units) - 15000\nProfit_MachineC = (900 * MachineC_units) - 20000\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total budget of $100,000 for setup costs.\nmodel.addCons(10000 * MachineA_units + 15000 * MachineB_units + 20000 * MachineC_units <= 100000)\n# The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\nmodel.addCons(MachineA_units <= 100)\nmodel.addCons(MachineB_units <= 80)\nmodel.addCons(MachineC_units <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city and the speed at which the trucks travel. Additionally, the company is considering investing in hybrid technology for some of its trucks to reduce fuel consumption.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks (mph)\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of the trucks is a nonlinear function of their speed and the number of trips. The fuel efficiency improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for City1: Fuel1 = (Trips1 * (0.05 * Speed^2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1^2))\n// Fuel consumption for City2: Fuel2 = (Trips2 * (0.05 * Speed^2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2^2))\n// Fuel consumption for City3: Fuel3 = (Trips3 * (0.05 * Speed^2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3^2))\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in hybrid technology and operational costs.\n// Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n// Trips1 >= 50; Trips2 >= 75",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city, the speed at which the trucks travel, and the investment in hybrid technology for some of its trucks to reduce fuel consumption. The fuel consumption of the trucks is a nonlinear function of their speed and the number of trips, and the fuel efficiency improves with the investment in hybrid technology.\n\nThe company aims to minimize the total fuel consumption across all trips. The company has a total budget of $100,000 for investments in hybrid technology and operational costs. The total number of trips across all cities must not exceed 500. Due to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n\nPlease help the company to determine the optimal number of trips to each city, the speed of the trucks, and the investment in hybrid technology to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)    # number of trips to City3\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)   # speed of trucks (mph)\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for City1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for City2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for City3\n\n# Define objective function\nFuel1 = Trips1 * (0.05 * Speed**2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1**2)\nFuel2 = Trips2 * (0.05 * Speed**2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2**2)\nFuel3 = Trips3 * (0.05 * Speed**2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3**2)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\nmodel.addCons(Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)  # total budget constraint\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)  # total trips constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Speed of trucks: \", model.getVal(Speed))\n    print(\"Investment in hybrid technology for City1: \", model.getVal(Hybrid1))\n    print(\"Investment in hybrid technology for City2: \", model.getVal(Hybrid2))\n    print(\"Investment in hybrid technology for City3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production efficiency of each product increases with the investment in new machinery.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The revenue generated per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total capital investment in new machinery cannot exceed $100,000.\n// MachineryInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production efficiency of each product increases with the investment in new machinery. The initial production cost per unit and the revenue generated per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Revenue per Unit |\n|---------|---------------------------------|------------------|\n| ProductA | $100                            | $150             |\n| ProductB | $150                            | $200             |\n| ProductC | $200                            | $250             |\n\nThe production cost per unit decreases by $5 for every $10,000 invested in new machinery. The company aims to maximize the total profit from all products. The total production capacity of the company is limited to 10,000 units. The total marketing budget cannot exceed $50,000. The total capital investment in new machinery cannot exceed $100,000.\n\nPlease help the company to determine the optimal production quantities, marketing budgets, and capital investment in new machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0)  # capital investment in new machinery\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\nProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\nProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)  # total production capacity constraint\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)  # total marketing budget constraint\nmodel.addCons(MachineryInvestment <= 100000)  # total capital investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Machinery Investment: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1379,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"ComponentA_Qty\", \"range\": \"ComponentA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"ComponentB_Qty\", \"range\": \"ComponentB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"ComponentC_Qty\", \"range\": \"ComponentC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentD\": \"ComponentD_Qty\", \"range\": \"ComponentD_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentE\": \"ComponentE_Qty\", \"range\": \"ComponentE_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function for each component is given by:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentA must be at least twice the production of ComponentB.\n// ComponentA_Qty >= 2 * ComponentB_Qty\n\n## Generate Constraint-3:\nThe company has a budget of $1,000,000 for raw materials per month.\n// 100 * ComponentA_Qty + 120 * ComponentB_Qty + 110 * ComponentC_Qty + 130 * ComponentD_Qty + 140 * ComponentE_Qty <= 1,000,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each component has at least some minimum production to meet market demand.\n// ComponentA_Qty >= 100; ComponentB_Qty >= 50; ComponentC_Qty >= 75; ComponentD_Qty >= 150; ComponentE_Qty >= 200",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit. The profit from each component depends on its production quantity and market demand, with the profit function for each component as follows:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components. The company has a total production capacity of 5000 units per month. Due to resource limitations, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget of $1,000,000 for raw materials per month. Additionally, the company wants to ensure that each component has at least some minimum production to meet market demand, with ComponentA_Qty >= 100, ComponentB_Qty >= 50, ComponentC_Qty >= 75, ComponentD_Qty >= 150, and ComponentE_Qty >= 200.\nPlease help the company determine the optimal production quantities for each component to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentA_Qty\", lb=100)\nComponentB_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentB_Qty\", lb=50)\nComponentC_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentC_Qty\", lb=75)\nComponentD_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentD_Qty\", lb=150)\nComponentE_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentE_Qty\", lb=200)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with division converted to multiplication\nProfit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\nProfit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\nProfit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\nProfit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\nProfit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000)\n\n## Due to resource limitations, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(ComponentA_Qty >= 2 * ComponentB_Qty)\n\n## The company has a budget of $1,000,000 for raw materials per month.\nmodel.addCons(100 * ComponentA_Qty + 120 * ComponentB_Qty + 110 * ComponentC_Qty + 130 * ComponentD_Qty + 140 * ComponentE_Qty <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"ComponentA_Qty: \", model.getVal(ComponentA_Qty))\n    print(\"ComponentB_Qty: \", model.getVal(ComponentB_Qty))\n    print(\"ComponentC_Qty: \", model.getVal(ComponentC_Qty))\n    print(\"ComponentD_Qty: \", model.getVal(ComponentD_Qty))\n    print(\"ComponentE_Qty: \", model.getVal(ComponentE_Qty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1440,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n// Fuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * Distance1 / 100\n// Fuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * Distance2 / 100\n// Fuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * Distance3 / 100\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1200 * Trucks2\n// Revenue_Route3 = 1500 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200\n\n## Generate Constraint-3:\nThe distance for Route1 is 500 kilometers, for Route2 is 600 kilometers, and for Route3 is 700 kilometers.\n// Distance1 = 500; Distance2 = 600; Distance3 = 700\n\n## Generate Constraint-4:\nDue to regulatory requirements, at least 50 trucks must be allocated to Route1.\n// Trucks1 >= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the investment in fuel-efficient technologies. The initial fuel consumption rate of each truck is 50 liters per 100 kilometers, which can be reduced by 1 liter per 100 kilometers for every $100 invested in fuel efficiency technologies. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n\n| Route | Revenue per Truck | Distance |\n|-------|-------------------|----------|\n| 1     | $1000             | 500 km   |\n| 2     | $1200             | 600 km   |\n| 3     | $1500             | 700 km   |\n\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency. The total number of trucks available is limited to 200. Due to regulatory requirements, at least 50 trucks must be allocated to Route1. The distances for each route are given in the table above.\n\nPlease help the company to maximize the net profit by determining the optimal number of trucks to allocate to each route and the appropriate investment in fuel efficiency technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)    # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\nFuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * 500 / 100\nFuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * 600 / 100\nFuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * 700 / 100\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1200 * Trucks2\nRevenue_Route3 = 1500 * Trucks3\n# So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n# The total number of trucks available is limited to 200.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5.\nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4.\nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3.\nThe manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_E1 = 30000 * E1 - 20000 * E1\n// NetRevenue_E2 = 40000 * E2 - 25000 * E2\n// NetRevenue_E3 = 50000 * E3 - 30000 * E3\n// So, the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / (5 * E1 + 4 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50\n\n## Generate Constraint-3:\nThe market demand for E1 is 20 vehicles. So, the manufacturer can only sell a maximum of 20 units of E1.\n// E1 <= 20",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and environmental impact score per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Environmental Impact Score per Unit |\n|--------------|------------------|--------------------------|--------------------------------------|\n| E1           | $30,000          | $20,000                  | 5                                    |\n| E2           | $40,000          | $25,000                  | 4                                    |\n| E3           | $50,000          | $30,000                  | 3                                    |\n\nThe manufacturer has a total production budget of $1,000,000. The manufacturer has a limited production capacity of 50 vehicles. The market demand for E1 is 20 vehicles. So, the manufacturer can only sell a maximum of 20 units of E1.\n\nPlease help the manufacturer to maximize the net revenue per environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=20) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_E1 = 30000 * E1 - 20000 * E1\nNetRevenue_E2 = 40000 * E2 - 25000 * E2\nNetRevenue_E3 = 50000 * E3 - 30000 * E3\nEnvironmentalImpact = 5 * E1 + 4 * E2 + 3 * E3\n## the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000)\n## The manufacturer has a limited production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Environmental Impact Score: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network.\n// {\"number of trips to CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for each truck is $0.5, and the distance from CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips.\n// Fuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\n// Fuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\n// Fuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\n// Fuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\n// Fuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\n// Fuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\n// Fuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\n// Fuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\n// Fuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\n// Fuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\n// Fuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\n// Fuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\n// Fuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\n// Fuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\n// Fuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\n// Fuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\n// Fuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\n// Fuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\n// Fuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\n// Fuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n// So, the objective function is: Minimize (Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n## Generate Constraint-1:\nThe company has a total of 1000 trips available per week.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 1000\n\n## Generate Constraint-2:\nDue to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB.\n// TripsA <= 2 * TripsB",
        "question": "A logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network. The cost of fuel per kilometer for each truck is $0.5, and the distance from CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips. The company has a total of 1000 trips available per week. Due to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB. Please help the company to determine the optimal number of trips to each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips to CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips to CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)  # number of trips to CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0)  # number of trips to CityD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0)  # number of trips to CityE\n\n# Define objective function\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Calculate fuel costs\nFuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\nFuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\nFuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\nFuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\nFuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\nFuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\nFuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\nFuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\nFuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\nFuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\nFuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\nFuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\nFuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\nFuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\nFuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\nFuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\nFuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\nFuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\nFuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\nFuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n\n# Objective function\nmodel.addCons(obj == Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n# Add constraints\n# The company has a total of 1000 trips available per week.\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 1000)\n# Due to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB.\nmodel.addCons(TripsA <= 2 * TripsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to CityA: \", model.getVal(TripsA))\n    print(\"Number of trips to CityB: \", model.getVal(TripsB))\n    print(\"Number of trips to CityC: \", model.getVal(TripsC))\n    print(\"Number of trips to CityD: \", model.getVal(TripsD))\n    print(\"Number of trips to CityE: \", model.getVal(TripsE))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for next month. They have identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck1, the cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the maintenance cost is $1000 per month.\nFor Truck2, the cost per mile is $3, the fuel efficiency is 4 miles per gallon, and the maintenance cost is $1500 per month.\nFor Truck3, the cost per mile is $4, the fuel efficiency is 3 miles per gallon, and the maintenance cost is $2000 per month.\nFor Van1, the cost per mile is $1.5, the fuel efficiency is 6 miles per gallon, and the maintenance cost is $800 per month.\nFor Van2, the cost per mile is $1, the fuel efficiency is 7 miles per gallon, and the maintenance cost is $500 per month.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the total costs (cost per mile * miles + maintenance) divided by the total miles covered.\n// Total cost for Truck1: Cost_Truck1 = 2 * Miles_Truck1 + 1000\n// Total cost for Truck2: Cost_Truck2 = 3 * Miles_Truck2 + 1500\n// Total cost for Truck3: Cost_Truck3 = 4 * Miles_Truck3 + 2000\n// Total cost for Van1: Cost_Van1 = 1.5 * Miles_Van1 + 800\n// Total cost for Van2: Cost_Van2 = 1 * Miles_Van2 + 500\n// Total miles for Truck1: Miles_Truck1 = 5 * Truck1\n// Total miles for Truck2: Miles_Truck2 = 4 * Truck2\n// Total miles for Truck3: Miles_Truck3 = 3 * Truck3\n// Total miles for Van1: Miles_Van1 = 6 * Van1\n// Total miles for Van2: Miles_Van2 = 7 * Van2\n// So, the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2) / (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for vehicle maintenance next month.\n// 1000 * Truck1 + 1500 * Truck2 + 2000 * Truck3 + 800 * Van1 + 500 * Van2 <= 50000\n\n## Generate Constraint-2:\nThe company can only afford to operate a maximum of 20 vehicles in total.\n// Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 20\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2).\n// Van1 + Van2 >= 0.3 * (Truck1 + Truck2 + Truck3 + Van1 + Van2)",
        "question": "A logistics company is planning its fleet for next month. They have identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes.\nFor Truck1, the cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the maintenance cost is $1000 per month.\nFor Truck2, the cost per mile is $3, the fuel efficiency is 4 miles per gallon, and the maintenance cost is $1500 per month.\nFor Truck3, the cost per mile is $4, the fuel efficiency is 3 miles per gallon, and the maintenance cost is $2000 per month.\nFor Van1, the cost per mile is $1.5, the fuel efficiency is 6 miles per gallon, and the maintenance cost is $800 per month.\nFor Van2, the cost per mile is $1, the fuel efficiency is 7 miles per gallon, and the maintenance cost is $500 per month.\nThe company has a budget of $50,000 for vehicle maintenance next month. The company can only afford to operate a maximum of 20 vehicles in total. The company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2).\nPlease help the company to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the total costs (cost per mile * miles + maintenance) divided by the total miles covered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_Truck1 = 2 * (5 * Truck1) + 1000\nCost_Truck2 = 3 * (4 * Truck2) + 1500\nCost_Truck3 = 4 * (3 * Truck3) + 2000\nCost_Van1 = 1.5 * (6 * Van1) + 800\nCost_Van2 = 1 * (7 * Van2) + 500\nMiles_Truck1 = 5 * Truck1\nMiles_Truck2 = 4 * Truck2\nMiles_Truck3 = 3 * Truck3\nMiles_Van1 = 6 * Van1\nMiles_Van2 = 7 * Van2\n## the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2) / (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2)\n## convert the division to multiplication\nmodel.addCons(obj * (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2) == Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2)\n\n# Add constraints\n## The company has a budget of $50,000 for vehicle maintenance next month.\nmodel.addCons(1000 * Truck1 + 1500 * Truck2 + 2000 * Truck3 + 800 * Van1 + 500 * Van2 <= 50000)\n## The company can only afford to operate a maximum of 20 vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 20)\n## The company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2).\nmodel.addCons(Van1 + Van2 >= 0.3 * (Truck1 + Truck2 + Truck3 + Van1 + Van2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide the number of trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type to reduce fuel consumption and operational costs.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for TruckA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel consumption per trip decreases by 0.5 liters for TruckA, 0.7 liters for TruckB, and 0.6 liters for TruckC. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption per trip for TruckA: ConsumptionA = 10 - 0.0005 * TechA\n// Fuel consumption per trip for TruckB: ConsumptionB = 12 - 0.0007 * TechB\n// Fuel consumption per trip for TruckC: ConsumptionC = 15 - 0.0006 * TechC\n// Total fuel consumption: FuelConsumption = ConsumptionA * TripsA + ConsumptionB * TripsB + ConsumptionC * TripsC\n// So, the objective function is: Minimize FuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs. Each trip of TruckA costs $500, TruckB costs $600, and TruckC costs $700.\n// 500 * TripsA + 600 * TripsB + 700 * TripsC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2000.\n// TripsA + TripsB + TripsC <= 2000\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n// TripsA >= 200; TripsB >= 300",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide the number of trips each vehicle should make in the next quarter and how much to invest in fuel-efficient technologies for each vehicle type to reduce fuel consumption and operational costs. The relationship between investment in technology and fuel consumption per trip for each vehicle type is given in the following Table.\n\n| Vehicle | Fuel Consumption per Trip (liters) | Investment Impact (liters/1000$) |\n|---------|-----------------------------------|---------------------------------|\n| TruckA  | 10 - 0.0005 * TechA               | 0.5                             |\n| TruckB  | 12 - 0.0007 * TechB               | 0.7                             |\n| TruckC  | 15 - 0.0006 * TechC               | 0.6                             |\n\nThe company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs. Each trip of TruckA costs $500, TruckB costs $600, and TruckC costs $700. The total number of trips across all vehicles must not exceed 2000. Due to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n\nPlease help the company to minimize the total fuel consumption across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=200)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=300)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)   # investment in fuel-efficient technology for TruckA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)   # investment in fuel-efficient technology for TruckB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)   # investment in fuel-efficient technology for TruckC\n\n# Define objective function\nConsumptionA = 10 - 0.0005 * TechA  # Fuel consumption per trip for TruckA\nConsumptionB = 12 - 0.0007 * TechB  # Fuel consumption per trip for TruckB\nConsumptionC = 15 - 0.0006 * TechC  # Fuel consumption per trip for TruckC\nFuelConsumption = ConsumptionA * TripsA + ConsumptionB * TripsB + ConsumptionC * TripsC\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption)\n\n# Add constraints\n# The company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(500 * TripsA + 600 * TripsB + 700 * TripsC + TechA + TechB + TechC <= 100000)\n# The total number of trips across all vehicles must not exceed 2000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Tech for TruckA: \", model.getVal(TechA))\n    print(\"Investment in Tech for TruckB: \", model.getVal(TechB))\n    print(\"Investment in Tech for TruckC: \", model.getVal(TechC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements.\n// Fuel_Small = (S * 20) / 5\n// Fuel_Medium = (M * 15) / 10\n// Fuel_Large = (L * 10) / 15\n// Fuel_ExtraLarge = (XL * 8) / 20\n// Fuel_Specialty = (Sp * 5) / 25\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe total weight of all deliveries must not exceed 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase up to 100 trucks in total.\n// S + M + L + XL + Sp <= 100\n\n## Generate Constraint-3:\nThe number of Specialty trucks cannot exceed 10% of the total number of trucks.\n// Sp <= 0.1 * (S + M + L + XL + Sp)\n\n## Generate Constraint-4:\nThe number of Small trucks must be at least 20% of the total number of trucks.\n// S >= 0.2 * (S + M + L + XL + Sp)",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fuel Efficiency (km/l) | Capacity (tons) |\n|------------------|-----------------------|-----------------|\n| Small            | 20                    | 5               |\n| Medium           | 15                    | 10              |\n| Large            | 10                    | 15              |\n| Extra-Large      | 8                     | 20              |\n| Specialty        | 5                     | 25              |\n\nThe company wants to minimize the total fuel consumption while meeting the delivery requirements. The total weight of all deliveries must not exceed 500 tons. The company has a budget to purchase up to 100 trucks in total. The number of Specialty trucks cannot exceed 10% of the total number of trucks. The number of Small trucks must be at least 20% of the total number of trucks.\n\nPlease help the company to determine the optimal number of each type of truck to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialty trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Small = (S * 20) / 5\nFuel_Medium = (M * 15) / 10\nFuel_Large = (L * 10) / 15\nFuel_ExtraLarge = (XL * 8) / 20\nFuel_Specialty = (Sp * 5) / 25\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The total weight of all deliveries must not exceed 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500)\n## The company has a budget to purchase up to 100 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 100)\n## The number of Specialty trucks cannot exceed 10% of the total number of trucks.\nmodel.addCons(Sp <= 0.1 * (S + M + L + XL + Sp))\n## The number of Small trucks must be at least 20% of the total number of trucks.\nmodel.addCons(S >= 0.2 * (S + M + L + XL + Sp))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialty trucks: \", model.getVal(Sp))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1277,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A consumes 10 liters per 100 km and can carry 10 tons.\n- Truck B consumes 15 liters per 100 km and can carry 15 tons.\n- Truck C consumes 20 liters per 100 km and can carry 20 tons.\n- Truck D consumes 25 liters per 100 km and can carry 25 tons.\n- Truck E consumes 30 liters per 100 km and can carry 30 tons.\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons.\n// Fuel consumption of A: FC_A = 10 * A\n// Fuel consumption of B: FC_B = 15 * B\n// Fuel consumption of C: FC_C = 20 * C\n// Fuel consumption of D: FC_D = 25 * D\n// Fuel consumption of E: FC_E = 30 * E\n// So, the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet the demand of 1000 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to maintain at most 50 trucks.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. Each type of truck has a different fuel efficiency and cargo capacity. \n- Truck A consumes 10 liters per 100 km and can carry 10 tons.\n- Truck B consumes 15 liters per 100 km and can carry 15 tons.\n- Truck C consumes 20 liters per 100 km and can carry 20 tons.\n- Truck D consumes 25 liters per 100 km and can carry 25 tons.\n- Truck E consumes 30 liters per 100 km and can carry 30 tons.\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons. The company has a budget to maintain at most 50 trucks. The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\nPlease help the company to minimize the total fuel consumption while meeting the cargo capacity demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC_A = 10 * A\nFC_B = 15 * B\nFC_C = 20 * C\nFC_D = 25 * D\nFC_E = 30 * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FC_A + FC_B + FC_C + FC_D + FC_E)\n\n# Add constraints\n## The total cargo capacity must meet the demand of 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n## The company has a budget to maintain at most 50 trucks.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Van C\": \"VanC\", \"range\": \"VanC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle E\": \"MotorcycleE\", \"range\": \"MotorcycleE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $50,000 per year, and it can carry 20 tons. Truck B costs $40,000 per year, carrying 15 tons. Van C costs $30,000 per year, carrying 5 tons. Van D costs $25,000 per year, carrying 3 tons. Motorcycle E costs $10,000 per year, carrying 1 ton. The company wants to minimize the total operating cost while maximizing the total carrying capacity. The objective is to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost.\n// Total carrying capacity: Capacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\n// Total operating cost: Cost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n// So, the objective function is: Maximize Capacity / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle operations.\n// 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 1000 tons.\n// 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE >= 1000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes. The cost of operating Truck A is $50,000 per year, and it can carry 20 tons. Truck B costs $40,000 per year, carrying 15 tons. Van C costs $30,000 per year, carrying 5 tons. Van D costs $25,000 per year, carrying 3 tons. Motorcycle E costs $10,000 per year, carrying 1 ton. The company wants to minimize the total operating cost while maximizing the total carrying capacity. The objective is to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost. The company has a budget of $1,000,000 for vehicle operations, and the total carrying capacity must be at least 1000 tons.\n\nPlease help the company determine the optimal number of each type of vehicle to maximize the cost efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nVanC = model.addVar(vtype=\"INTEGER\", name=\"VanC\", lb=0) # number of Van C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of Van D\nMotorcycleE = model.addVar(vtype=\"INTEGER\", name=\"MotorcycleE\", lb=0) # number of Motorcycle E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\nCost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n## the objective function is: Maximize Capacity / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Capacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle operations.\nmodel.addCons(50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000)\n## The total carrying capacity must be at least 1000 tons.\nmodel.addCons(20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Van C: \", model.getVal(VanC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Motorcycle E: \", model.getVal(MotorcycleE))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The company also needs to decide on the budget for advertising each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from ProductA is $100 per unit, but it decreases by $0.5 for every $100 spent on advertising. The profit from ProductB is $150 per unit, decreasing by $0.7 for every $100 spent on advertising. The profit from ProductC is $200 per unit, decreasing by $1 for every $100 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total budget for advertising cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize profit, considering the cost of raw materials, labor, and the effect of advertising on sales. The profit from ProductA is $100 per unit, but it decreases by $0.5 for every $100 spent on advertising. The profit from ProductB is $150 per unit, decreasing by $0.7 for every $100 spent on advertising. The profit from ProductC is $200 per unit, decreasing by $1 for every $100 spent on advertising. The total budget for advertising cannot exceed $50,000.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # advertising budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # advertising budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nProfitA = (100 - 0.5 * BudgetA / 100) * QuantityA\nProfitB = (150 - 0.7 * BudgetB / 100) * QuantityB\nProfitC = (200 - 1 * BudgetC / 100) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials.\n// {\"number of trucks for Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel.\nFor Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel.\nFor Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel.\nFor Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel.\nFor Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel.\nThe company wants to maximize the revenue-to-fuel ratio for the entire fleet.\n// Total Revenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total Fuel Consumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n// So, the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000\n\n## Generate Constraint-3:\nRoute A requires at least 10 trucks to be operational.\n// TruckA >= 10\n\n## Generate Constraint-4:\nNo more than 30% of the trucks can be allocated to Route E due to market saturation.\n// TruckE <= 0.30 * 100",
        "question": "A logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials. For Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel. For Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel. For Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel. For Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel. For Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel. The company wants to maximize the revenue-to-fuel ratio for the entire fleet. The company has a total of 100 trucks available. The company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters. Route A requires at least 10 trucks to be operational. No more than 30% of the trucks can be allocated to Route E due to market saturation. Please help the company determine the optimal number of trucks to allocate to each route to maximize the revenue-to-fuel ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0, ub=30) # number of trucks for Route E\n\n# Define objective function\nTotalRevenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nTotalFuelConsumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TruckE))\n    print(\"Maximized Revenue-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1141,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * Q1 = 20 * Q1\n// Profit_P2 = (40 - 20) * Q2 = 20 * Q2\n// Profit_P3 = (50 - 30) * Q3 = 20 * Q3\n// The objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units.\n// Q1 <= 100\n// Q2 <= 150\n// Q3 <= 200\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\n// Q1 >= 50\n// Q2 >= 75\n\n## Generate Constraint-4:\nThe market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units.\n// If Q3 <= 100, Profit_P3 = 20 * Q3\n// If Q3 > 100, Profit_P3 = 20 * Q3 * (1 - 0.1 * (Q3 - 100) / 50)\n\n## Generate Constraint-5:\nThe company has a policy to ensure that the total production does not exceed 300 units across all products.\n// Q1 + Q2 + Q3 <= 300",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints. The profit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| P1      | $30             | $10                      |\n| P2      | $40             | $20                      |\n| P3      | $50             | $30                      |\n\nThe company has a limited budget of $5000 for production costs. The production capacity for each product is limited: the maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units. The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced. The market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units. The company also has a policy to ensure that the total production does not exceed 300 units across all products.\n\nPlease help the company to maximize the total profit by determining the optimal production quantities for P1, P2, and P3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=75) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * Q1\nProfit_P2 = 20 * Q2\n## handle nonlinear profit for P3\nQ3_1 = model.addVar(vtype=\"INTEGER\", name=\"Q3_1\", lb=0, ub=100)\nQ3_2 = model.addVar(vtype=\"INTEGER\", name=\"Q3_2\", lb=0)\nQ3_b1 = model.addVar(vtype=\"B\", name=\"Q3_b1\")\nQ3_b2 = model.addVar(vtype=\"B\", name=\"Q3_b2\")\nmodel.addCons(Q3_b1 + Q3_b2 == 1)\nmodel.addCons(Q3 == Q3_1*Q3_b1 + Q3_2*Q3_b2)\nProfit_P3_1 = 20 * Q3_1 * Q3_b1\nProfit_P3_2 = 20 * Q3_2 * Q3_b2 * (1 - 0.1 * (Q3_2 - 100) / 50)\nProfit_P3 = Profit_P3_1 + Profit_P3_2\n## the objective function is: Maximize (20 * Q1 + 20 * Q2 + Profit_P3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000)\n## The production capacity for each product is limited.\nmodel.addCons(Q1 <= 100)\nmodel.addCons(Q2 <= 150)\nmodel.addCons(Q3 <= 200)\n## The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\nmodel.addCons(Q1 >= 50)\nmodel.addCons(Q2 >= 75)\n## The company has a policy to ensure that the total production does not exceed 300 units across all products.\nmodel.addCons(Q1 + Q2 + Q3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1391,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit. The profit per unit, labor hours required, and raw material units required for each device are given in the following Table.\n\n| Device | Profit per Unit | Labor Hours Required | Raw Material Units Required |\n|--------|-----------------|----------------------|-----------------------------|\n| DeviceA | $100            | 2                    | 1                           |\n| DeviceB | $150            | 3                    | 2                           |\n| DeviceC | $200            | 4                    | 3                           |\n| DeviceD | $120            | 2.5                  | 1.5                         |\n| DeviceE | $180            | 3.5                  | 2.5                         |\n\nThe company has a total of 1000 labor hours available per week. The company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency. The objective function to be maximized is the total profit minus a penalty term that accounts for the square of labor hours and the square of raw material usage. Please help the company determine the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## Convert the nonlinear term to a constraint\nmodel.addCons(obj == Profit - 0.01 * (Labor**2 + RawMaterial**2))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of public facilities: a library, a park, a community center, a sports complex, and a museum. The city council needs to decide how much to invest in each facility to maximize the overall utility while adhering to budget constraints and other requirements.\n// {\"investment in the library\": \"LibraryInvestment\", \"range\": \"LibraryInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the park\": \"ParkInvestment\", \"range\": \"ParkInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the community center\": \"CommunityCenterInvestment\", \"range\": \"CommunityCenterInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the sports complex\": \"SportsComplexInvestment\", \"range\": \"SportsComplexInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the museum\": \"MuseumInvestment\", \"range\": \"MuseumInvestment >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe utility of each facility is modeled as a nonlinear function of investment:\n- Library: Utility = 100 * sqrt(LibraryInvestment)\n- Park: Utility = 150 * sqrt(ParkInvestment)\n- Community Center: Utility = 200 * sqrt(CommunityCenterInvestment)\n- Sports Complex: Utility = 250 * sqrt(SportsComplexInvestment)\n- Museum: Utility = 300 * sqrt(MuseumInvestment)\nThe city council wants to maximize the total utility of all facilities.\n// So, the objective function is: Maximize (100 * sqrt(LibraryInvestment) + 150 * sqrt(ParkInvestment) + 200 * sqrt(CommunityCenterInvestment) + 250 * sqrt(SportsComplexInvestment) + 300 * sqrt(MuseumInvestment))\n\n## Generate Constraint-1:\nThe total budget for all facilities is $500,000.\n// LibraryInvestment + ParkInvestment + CommunityCenterInvestment + SportsComplexInvestment + MuseumInvestment <= 500000\n\n## Generate Constraint-2:\nAt least $50,000 must be invested in the library.\n// LibraryInvestment >= 50000\n\n## Generate Constraint-3:\nThe investment in the park must be at least twice the investment in the museum.\n// ParkInvestment >= 2 * MuseumInvestment",
        "question": "A city is planning to build five different types of public facilities: a library, a park, a community center, a sports complex, and a museum. The city council needs to decide how much to invest in each facility to maximize the overall utility while adhering to budget constraints and other requirements. The utility of each facility is modeled as a nonlinear function of investment, as shown in the following Table.\n\n| Facility          | Utility Function                          |\n|-------------------|-------------------------------------------|\n| Library           | 100 * sqrt(LibraryInvestment)              |\n| Park              | 150 * sqrt(ParkInvestment)                |\n| Community Center  | 200 * sqrt(CommunityCenterInvestment)      |\n| Sports Complex    | 250 * sqrt(SportsComplexInvestment)        |\n| Museum            | 300 * sqrt(MuseumInvestment)              |\n\nThe total budget for all facilities is $500,000. At least $50,000 must be invested in the library. The investment in the park must be at least twice the investment in the museum. Please help the city council to maximize the total utility of all facilities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLibraryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"LibraryInvestment\", lb=50000)\nParkInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"ParkInvestment\", lb=0)\nCommunityCenterInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"CommunityCenterInvestment\", lb=0)\nSportsComplexInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsComplexInvestment\", lb=0)\nMuseumInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MuseumInvestment\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * sqrt(LibraryInvestment) + 150 * sqrt(ParkInvestment) + 200 * sqrt(CommunityCenterInvestment) + 250 * sqrt(SportsComplexInvestment) + 300 * sqrt(MuseumInvestment))\n## convert the square root to a variable\nsqrt_LibraryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_LibraryInvestment\")\nsqrt_ParkInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_ParkInvestment\")\nsqrt_CommunityCenterInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_CommunityCenterInvestment\")\nsqrt_SportsComplexInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_SportsComplexInvestment\")\nsqrt_MuseumInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MuseumInvestment\")\nmodel.addCons(sqrt_LibraryInvestment**2 == LibraryInvestment)\nmodel.addCons(sqrt_ParkInvestment**2 == ParkInvestment)\nmodel.addCons(sqrt_CommunityCenterInvestment**2 == CommunityCenterInvestment)\nmodel.addCons(sqrt_SportsComplexInvestment**2 == SportsComplexInvestment)\nmodel.addCons(sqrt_MuseumInvestment**2 == MuseumInvestment)\nmodel.addCons(obj == 100 * sqrt_LibraryInvestment + 150 * sqrt_ParkInvestment + 200 * sqrt_CommunityCenterInvestment + 250 * sqrt_SportsComplexInvestment + 300 * sqrt_MuseumInvestment)\n\n# Add constraints\nmodel.addCons(LibraryInvestment + ParkInvestment + CommunityCenterInvestment + SportsComplexInvestment + MuseumInvestment <= 500000)\nmodel.addCons(ParkInvestment >= 2 * MuseumInvestment)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in the Library: \", model.getVal(LibraryInvestment))\n    print(\"Investment in the Park: \", model.getVal(ParkInvestment))\n    print(\"Investment in the Community Center: \", model.getVal(CommunityCenterInvestment))\n    print(\"Investment in the Sports Complex: \", model.getVal(SportsComplexInvestment))\n    print(\"Investment in the Museum: \", model.getVal(MuseumInvestment))\n    print(\"Maximized Total Utility: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for RouteA\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"continuous\"}\n// {\"speed of trucks for RouteB\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks.\n// Fuel cost for RouteA: FuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\n// Fuel cost for RouteB: FuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\n// Depreciation cost for RouteA: DepreciationCostA = 0.01 * TrucksA * SpeedA^2\n// Depreciation cost for RouteB: DepreciationCostB = 0.01 * TrucksB * SpeedB^2\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs.\n// TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is 50.\n// TrucksA + TrucksB <= 50\n\n## Generate Constraint-3:\nThe maximum speed allowed for any truck is 60 km/h.\n// SpeedA <= 60; SpeedB <= 60\n\n## Generate Constraint-4:\nThe minimum fuel efficiency required for any truck is 5 km/L.\n// FuelEfficiencyA >= 5; FuelEfficiencyB >= 5",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route. The company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks. The company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs. The total number of trucks available for allocation is 50. The maximum speed allowed for any truck is 60 km/h. The minimum fuel efficiency required for any truck is 5 km/L.\n\nPlease help the company to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for RouteB\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks for RouteA\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for RouteB\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=5)  # fuel efficiency of trucks for RouteA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=5)  # fuel efficiency of trucks for RouteB\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0)  # investment in fuel efficiency technology for RouteA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0)  # investment in fuel efficiency technology for RouteB\n\n# Define objective function\nFuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\nFuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\nDepreciationCostA = 0.01 * TrucksA * SpeedA**2\nDepreciationCostB = 0.01 * TrucksB * SpeedB**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000)\nmodel.addCons(TrucksA + TrucksB <= 50)\nmodel.addCons(SpeedA <= 60)\nmodel.addCons(SpeedB <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Speed of Trucks for RouteA: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for RouteB: \", model.getVal(SpeedB))\n    print(\"Fuel Efficiency of Trucks for RouteA: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency of Trucks for RouteB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Tech for RouteA: \", model.getVal(TechInvestA))\n    print(\"Investment in Tech for RouteB: \", model.getVal(TechInvestB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Onshore, Offshore, and High-Altitude. The company needs to determine the number of turbines to install for each type of wind farm and the investment in advanced technology for each type to enhance energy output. The advanced technology investment affects the efficiency and energy production of each turbine.\n// {\"number of turbines for Onshore\": \"OnshoreTurbines\", \"range\": \"OnshoreTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Offshore\": \"OffshoreTurbines\", \"range\": \"OffshoreTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for High-Altitude\": \"HighAltitudeTurbines\", \"range\": \"HighAltitudeTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Onshore\": \"OnshoreTechInvestment\", \"range\": \"OnshoreTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Offshore\": \"OffshoreTechInvestment\", \"range\": \"OffshoreTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for High-Altitude\": \"HighAltitudeTechInvestment\", \"range\": \"HighAltitudeTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine is affected by the investment in advanced technology. For every $1000 invested in Onshore technology, the energy output increases by 1 MWh per turbine. For Offshore, every $1000 investment increases the output by 1.5 MWh per turbine. For High-Altitude, every $1000 investment increases the output by 2 MWh per turbine. The company aims to maximize the total energy output from all wind farms.\n// Total energy output for Onshore: OutputOnshore = OnshoreTurbines * (5 + 0.001 * OnshoreTechInvestment)\n// Total energy output for Offshore: OutputOffshore = OffshoreTurbines * (7 + 0.0015 * OffshoreTechInvestment)\n// Total energy output for High-Altitude: OutputHighAltitude = HighAltitudeTurbines * (10 + 0.002 * HighAltitudeTechInvestment)\n// So, the objective function is: Maximize (OutputOnshore + OutputOffshore + OutputHighAltitude)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both turbine installation and technology investments.\n// OnshoreTurbines + OffshoreTurbines + HighAltitudeTurbines + OnshoreTechInvestment + OffshoreTechInvestment + HighAltitudeTechInvestment <= 1000000",
        "question": "A renewable energy company operates three types of wind farms: Onshore, Offshore, and High-Altitude. The company needs to determine the number of turbines to install for each type of wind farm and the investment in advanced technology for each type to enhance energy output. The advanced technology investment affects the efficiency and energy production of each turbine. For every $1000 invested in Onshore technology, the energy output increases by 1 MWh per turbine. For Offshore, every $1000 investment increases the output by 1.5 MWh per turbine. For High-Altitude, every $1000 investment increases the output by 2 MWh per turbine. The company aims to maximize the total energy output from all wind farms. The company has a total budget of $1,000,000 for both turbine installation and technology investments. Please help the company determine the optimal number of turbines and the investment in advanced technology for each type of wind farm to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nOnshoreTurbines = model.addVar(vtype=\"INTEGER\", name=\"OnshoreTurbines\", lb=0)\nOffshoreTurbines = model.addVar(vtype=\"INTEGER\", name=\"OffshoreTurbines\", lb=0)\nHighAltitudeTurbines = model.addVar(vtype=\"INTEGER\", name=\"HighAltitudeTurbines\", lb=0)\nOnshoreTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OnshoreTechInvestment\", lb=0)\nOffshoreTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OffshoreTechInvestment\", lb=0)\nHighAltitudeTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HighAltitudeTechInvestment\", lb=0)\n\n# Define objective function\nOutputOnshore = OnshoreTurbines * (5 + 0.001 * OnshoreTechInvestment)\nOutputOffshore = OffshoreTurbines * (7 + 0.0015 * OffshoreTechInvestment)\nOutputHighAltitude = HighAltitudeTurbines * (10 + 0.002 * HighAltitudeTechInvestment)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == OutputOnshore + OutputOffshore + OutputHighAltitude)\n\n# Add constraints\nmodel.addCons(OnshoreTurbines + OffshoreTurbines + HighAltitudeTurbines + OnshoreTechInvestment + OffshoreTechInvestment + HighAltitudeTechInvestment <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Onshore Turbines: \", model.getVal(OnshoreTurbines))\n    print(\"Number of Offshore Turbines: \", model.getVal(OffshoreTurbines))\n    print(\"Number of High-Altitude Turbines: \", model.getVal(HighAltitudeTurbines))\n    print(\"Onshore Technology Investment: \", model.getVal(OnshoreTechInvestment))\n    print(\"Offshore Technology Investment: \", model.getVal(OffshoreTechInvestment))\n    print(\"High-Altitude Technology Investment: \", model.getVal(HighAltitudeTechInvestment))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours allocated to ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\n// Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n// Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n// Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available production hours for the company is 100 hours.\n// HoursA + HoursB + HoursC <= 100\n\n## Generate Constraint-2:\nThe company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB.\n// UnitsA >= 10; UnitsB >= 15",
        "question": "A manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit. The total available production hours for the company is 100 hours. The company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB. Please help the company determine the optimal number of units and hours to allocate to each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of hours allocated to ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of hours allocated to ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of hours allocated to ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n## convert the division to multiplication\nProfitA = (50 - (20 * HoursA * 1/5)) * UnitsA\n## Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n## convert the division to multiplication\nProfitB = (70 - (25 * HoursB * 1/4)) * UnitsB\n## Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n## convert the division to multiplication\nProfitC = (60 - (30 * HoursC * 1/3)) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total available production hours for the company is 100 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Hours Allocated to ProductA: \", model.getVal(HoursA))\n    print(\"Number of Hours Allocated to ProductB: \", model.getVal(HoursB))\n    print(\"Number of Hours Allocated to ProductC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\n// Total environmental impact: Impact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation.\n// 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 1,000,000 kWh.\n// 200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000",
        "question": "A city is planning to install solar panels and wind turbines to generate renewable energy at five potential sites (Site A, Site B, Site C, Site D, and Site E). The city needs to determine the number of solar panels and wind turbines to install at each site.\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city has a budget of $1,000,000 for the installation. The total annual energy output must be at least 1,000,000 kWh.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation (defined as the total cost divided by the total environmental impact score).\nPlease help the city determine the optimal number of solar panels and wind turbines to install at each site to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Site D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Site E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\nImpact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation.\nmodel.addCons(Cost <= 1000000)\n## The total annual energy output must be at least 1,000,000 kWh.\nmodel.addCons(200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Site E: \", model.getVal(WindE))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1358,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y).\n// {\"number of solar panels A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines X\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines Y\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company wants to minimize the total cost while maximizing the total energy output.\n// Total energy output: Energy = 15% * SolarA + 20% * SolarB + 25% * SolarC + 30% * WindX + 35% * WindY\n// Total cost: Cost = $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y). The efficiency and cost per unit for each type of equipment are given in the following Table.\n\n| Equipment | Efficiency | Cost per Unit |\n|-----------|------------|---------------|\n| Solar A   | 15%        | $1000         |\n| Solar B   | 20%        | $1500         |\n| Solar C   | 25%        | $2000         |\n| Wind X    | 30%        | $2500         |\n| Wind Y    | 35%        | $3000         |\n\nThe company has a budget of $50,000 for the installation. The company wants to minimize the total cost while maximizing the total energy output. Please help the company to determine the optimal number of each type of equipment to install, aiming to minimize the ratio of total cost to total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels C\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=0) # number of wind turbines X\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=0) # number of wind turbines Y\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.15 * SolarA + 0.20 * SolarB + 0.25 * SolarC + 0.30 * WindX + 0.35 * WindY\nCost = 1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines X: \", model.getVal(WindX))\n    print(\"Number of Wind Turbines Y: \", model.getVal(WindY))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large, each with different fuel efficiency and capacity. Additionally, the company is considering investing in a new fuel-efficient technology for each type of vehicle, which will affect the operational costs and the number of trips required.\n// {\"number of Small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small vehicles\": \"SmallTech\", \"range\": \"SmallTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium vehicles\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large vehicles\": \"LargeTech\", \"range\": \"LargeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in technology. For Small vehicles, the fuel efficiency increases by 0.5 km/liter for every $1,000 invested. For Medium vehicles, the increase is 0.8 km/liter per $1,000, and for Large vehicles, it's 1.0 km/liter per $1,000. The operational cost is inversely proportional to the fuel efficiency. The company aims to minimize the total operational cost, which includes fuel and maintenance.\n// Operational cost for Small vehicles: CostSmall = (1 / (initial_efficiency_small + 0.0005 * SmallTech)) * SmallVehicles\n// Operational cost for Medium vehicles: CostMedium = (1 / (initial_efficiency_medium + 0.0008 * MediumTech)) * MediumVehicles\n// Operational cost for Large vehicles: CostLarge = (1 / (initial_efficiency_large + 0.001 * LargeTech)) * LargeVehicles\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle investments and technology upgrades.\n// SmallVehicles + MediumVehicles + LargeVehicles + SmallTech + MediumTech + LargeTech <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 200",
        "question": "A logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large, each with different fuel efficiency and capacity. Additionally, the company is considering investing in a new fuel-efficient technology for each type of vehicle, which will affect the operational costs and the number of trips required. The fuel efficiency of each vehicle type improves with the investment in technology. For Small vehicles, the fuel efficiency increases by 0.5 km/liter for every $1,000 invested. For Medium vehicles, the increase is 0.8 km/liter per $1,000, and for Large vehicles, it's 1.0 km/liter per $1,000. The operational cost is inversely proportional to the fuel efficiency.\n\nThe company has a budget of $100,000 for vehicle investments and technology upgrades. The total number of vehicles cannot exceed 200. The company aims to minimize the total operational cost, which includes fuel and maintenance.\n\nPlease help the company determine the optimal number of each type of vehicle and the investment in fuel-efficient technology to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)  # number of Small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)  # number of Medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)  # number of Large vehicles\nSmallTech = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallTech\", lb=0)  # investment in fuel-efficient technology for Small vehicles\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)  # investment in fuel-efficient technology for Medium vehicles\nLargeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeTech\", lb=0)  # investment in fuel-efficient technology for Large vehicles\n\n# Define objective function\n# Operational cost for Small vehicles: CostSmall = (1 / (initial_efficiency_small + 0.0005 * SmallTech)) * SmallVehicles\n# Operational cost for Medium vehicles: CostMedium = (1 / (initial_efficiency_medium + 0.0008 * MediumTech)) * MediumVehicles\n# Operational cost for Large vehicles: CostLarge = (1 / (initial_efficiency_large + 0.001 * LargeTech)) * LargeVehicles\n# So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nCostSmall = model.addVar(name=\"CostSmall\")\nCostMedium = model.addVar(name=\"CostMedium\")\nCostLarge = model.addVar(name=\"CostLarge\")\nmodel.setObjective(CostSmall + CostMedium + CostLarge, \"minimize\")\n\nmodel.addCons(CostSmall == (1 / (0.0005 * SmallTech + 1)) * SmallVehicles)  # Assuming initial_efficiency_small is 1 km/liter\nmodel.addCons(CostMedium == (1 / (0.0008 * MediumTech + 1)) * MediumVehicles)  # Assuming initial_efficiency_medium is 1 km/liter\nmodel.addCons(CostLarge == (1 / (0.001 * LargeTech + 1)) * LargeVehicles)  # Assuming initial_efficiency_large is 1 km/liter\n\n# Add constraints\n# The company has a budget of $100,000 for vehicle investments and technology upgrades.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles + SmallTech + MediumTech + LargeTech <= 100000)\n# The total number of vehicles cannot exceed 200.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Investment in Small Tech: \", model.getVal(SmallTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Large Tech: \", model.getVal(LargeTech))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. The capacity and fuel consumption for each truck are given in the following Table.\n\n| Truck Type | Cargo Capacity | Fuel Consumption per Trip |\n|------------|----------------|---------------------------|\n| Truck A    | 10 tons        | 5 liters                  |\n| Truck B    | 15 tons        | 7 liters                  |\n| Truck C    | 20 tons        | 9 liters                  |\n\nThe cost of fuel per liter is $2. The company has a total budget of $5000 for fuel costs. The total cargo capacity of all trucks should not exceed 1000 tons. \nPlease help the company to minimize the total fuel cost while maximizing the total cargo carried, expressed as the ratio of total fuel cost to total cargo carried.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons((5 * TruckA + 7 * TruckB + 9 * TruckC) * 2 <= 5000)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Type1 trucks\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Type1 trucks\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type2 trucks\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type3 trucks\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n// Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n// Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n// Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n\n| Truck Type | Fuel Cost per Mile | Fuel Efficiency Improvement per $1000 |\n|------------|--------------------|--------------------------------------|\n| Type1      | $0.8               | 1.5%                                 |\n| Type2      | $0.7               | 2%                                   |\n| Type3      | $0.6               | 1%                                   |\n\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. Please help the company determine the optimal number of trucks to purchase and the amount to invest in fuel efficiency upgrades to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Type1 trucks\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Type2 trucks\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Type3 trucks\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # investment in fuel efficiency for Type1 trucks\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # investment in fuel efficiency for Type2 trucks\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0) # investment in fuel efficiency for Type3 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n## Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n## Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n## So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\nCost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\nCost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(Truck1))\n    print(\"Number of Type2 Trucks: \", model.getVal(Truck2))\n    print(\"Number of Type3 Trucks: \", model.getVal(Truck3))\n    print(\"Investment in Fuel Efficiency for Type1 Trucks: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Type2 Trucks: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Type3 Trucks: \", model.getVal(Efficiency3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost.\n// Efficiency_Truck = 100 * T / (5 * T)\n// Efficiency_Van = 70 * V / (3 * V)\n// Efficiency_Bike = 30 * B / (0 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for fuel costs per day.\n// 5 * T + 3 * V <= 1000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\nThe efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost.\nThe company has a budget of $1000 for fuel costs per day.\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their total efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = 100 * T / (5 * T)\nEfficiency_Van = 70 * V / (3 * V)\nEfficiency_Bike = 30 * B / (0 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * T + 3 * V) == 100 * T + 70 * V + 30 * B)\n\n# Add constraints\n## The company has a budget of $1000 for fuel costs per day.\nmodel.addCons(5 * T + 3 * V <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost of Raw Materials per Unit |\n|--------|-----------------|--------------------------------|\n| DeviceA | $50             | $20                            |\n| DeviceB | $70             | $30                            |\n| DeviceC | $90             | $40                            |\n| DeviceD | $60             | $25                            |\n| DeviceE | $80             | $35                            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The company has a budget constraint for raw materials, which is $500,000.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, given by:\nCost_A = 1000 + 0.01 * (ProductA^2)\nCost_B = 1500 + 0.015 * (ProductB^2)\nCost_C = 1200 + 0.012 * (ProductC^2)\nCost_D = 1800 + 0.018 * (ProductD^2)\nCost_E = 2000 + 0.02 * (ProductE^2)\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\n// Total Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 12\n// ProductD >= 20\n// ProductE >= 25",
        "question": "A manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| A       | $50             | 1000 + 0.01 * (ProductA^2) |\n| B       | $70             | 1500 + 0.015 * (ProductB^2) |\n| C       | $60             | 1200 + 0.012 * (ProductC^2) |\n| D       | $80             | 1800 + 0.018 * (ProductD^2) |\n| E       | $90             | 2000 + 0.02 * (ProductE^2) |\n\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs. The total production capacity of the factory is limited to 1000 units across all products. The company also has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E.\n\nPlease help the company determine the optimal amount of each product to produce in order to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=10) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=15) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=12) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=20) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=25) # amount of Product E produced\n\n# Define objective function\nCost_A = 1000 + 0.01 * (ProductA**2)\nCost_B = 1500 + 0.015 * (ProductB**2)\nCost_C = 1200 + 0.012 * (ProductC**2)\nCost_D = 1800 + 0.018 * (ProductD**2)\nCost_E = 2000 + 0.02 * (ProductE**2)\nTotalProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1193,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Region1\": \"FuelTech1\", \"range\": \"FuelTech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region2\": \"FuelTech2\", \"range\": \"FuelTech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region3\": \"FuelTech3\", \"range\": \"FuelTech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n// Total profit for Region1: Profit1 = (1000 + 0.1 * FuelTech1) * Trucks1\n// Total profit for Region2: Profit2 = (1200 + 0.12 * FuelTech2) * Trucks2\n// Total profit for Region3: Profit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact. The profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n\n| Region | Profit per Truck | Increase in Profit per $1000 Investment |\n|--------|------------------|-----------------------------------------|\n| Region1 | $1000            | $100                                    |\n| Region2 | $1200            | $120                                    |\n| Region3 | $1100            | $110                                    |\n\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies. Please help the company to maximize the total profit from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech1\", lb=0)  # investment in alternative fuel technology for Region1\nFuelTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech2\", lb=0)  # investment in alternative fuel technology for Region2\nFuelTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech3\", lb=0)  # investment in alternative fuel technology for Region3\n\n# Define objective function\nProfit1 = (1000 + 0.1 * FuelTech1) * Trucks1\nProfit2 = (1200 + 0.12 * FuelTech2) * Trucks2\nProfit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n# So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Tech for Region1: \", model.getVal(FuelTech1))\n    print(\"Investment in Fuel Tech for Region2: \", model.getVal(FuelTech2))\n    print(\"Investment in Fuel Tech for Region3: \", model.getVal(FuelTech3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1548,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed.\n// {\"speed of truck 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of truck 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = Distance / FuelEfficiency. The fuel efficiency decreases nonlinearly with increasing speed due to aerodynamic drag. The company aims to minimize the total fuel consumption across all trucks and routes.\n// FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n// FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n// TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\n// Speed1 <= 80; Speed2 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed. The fuel consumption of each truck is a nonlinear function of its speed, and the company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is 50. The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120) # speed of truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120) # speed of truck 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on route 2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # fuel efficiency of truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # fuel efficiency of truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n## FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n## TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n## convert the division to multiplication\nmodel.addCons(obj == Trucks1 * Efficiency1 * (1 - 0.005 * (Speed1 - 60)**2) + Trucks2 * Efficiency2 * (1 - 0.005 * (Speed2 - 60)**2))\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n## The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"amount of resources for ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"amount of resources for ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"amount of resources for ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue from selling each unit of ProductA is $100, ProductB is $140, and ProductC is $180. The investment in automation reduces the cost of production by $2 for every $1000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.002 * Automation) * UnitsA - ResourcesA\n// Total profit for ProductB: ProfitB = (140 - 70 + 0.002 * Automation) * UnitsB - ResourcesB\n// Total profit for ProductC: ProfitC = (180 - 90 + 0.002 * Automation) * UnitsC - ResourcesC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total amount of resources available for all products is 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// UnitsA >= 50; UnitsB >= 30\n\n## Generate Constraint-4:\nDue to market demand, the total number of units produced for all products cannot exceed 200.\n// UnitsA + UnitsB + UnitsC <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue from selling each unit of ProductA is $100, ProductB is $140, and ProductC is $180. The investment in automation reduces the cost of production by $2 for every $1000 invested. The company aims to maximize the total profit from all products. The total amount of resources available for all products is 1000 units. The investment in automation technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 30 units of ProductB. Due to market demand, the total number of units produced for all products cannot exceed 200. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)    # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # amount of resources for ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # amount of resources for ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # amount of resources for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.002 * Automation) * UnitsA - ResourcesA\nProfitB = (140 - 70 + 0.002 * Automation) * UnitsB - ResourcesB\nProfitC = (180 - 90 + 0.002 * Automation) * UnitsC - ResourcesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\nmodel.addCons(Automation <= 50000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resources for ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources for ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources for ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Truck A has a fuel efficiency of 5 km/liter and a capacity of 10 tons. Truck B has a fuel efficiency of 7 km/liter and a capacity of 12 tons. Truck C has a fuel efficiency of 9 km/liter and a capacity of 15 tons. Truck D has a fuel efficiency of 11 km/liter and a capacity of 18 tons. Truck E has a fuel efficiency of 13 km/liter and a capacity of 20 tons. The company aims to minimize the total fuel consumption while ensuring all trucks are utilized to their full capacity. The objective function is to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies.\n// Fuel_Consumption_A = A / 5\n// Fuel_Consumption_B = B / 7\n// Fuel_Consumption_C = C / 9\n// Fuel_Consumption_D = D / 11\n// Fuel_Consumption_E = E / 13\n// So, the objective function is: Minimize Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D + Fuel_Consumption_E\n\n## Generate Constraint-1:\nThe total cargo capacity required for the upcoming month is 1000 tons.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km.\n// A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can deploy, which is 100 trucks.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Capacity (tons) |\n|------------|---------------------------|-----------------|\n| A          | 5                         | 10              |\n| B          | 7                         | 12              |\n| C          | 9                         | 15              |\n| D          | 11                        | 18              |\n| E          | 13                        | 20              |\n\nThe total cargo capacity required for the upcoming month is 1000 tons. The company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km. The company has a limit on the total number of trucks it can deploy, which is 100 trucks. The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n\nPlease help the company to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies, while ensuring all trucks are utilized to their full capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_A = A / 5\nFuel_Consumption_B = B / 7\nFuel_Consumption_C = C / 9\nFuel_Consumption_D = D / 11\nFuel_Consumption_E = E / 13\n## convert the division to multiplication\nmodel.addCons(obj == 5 * Fuel_Consumption_A + 7 * Fuel_Consumption_B + 9 * Fuel_Consumption_C + 11 * Fuel_Consumption_D + 13 * Fuel_Consumption_E)\n\n# Add constraints\n## The total cargo capacity required for the upcoming month is 1000 tons.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000)\n## The company has a budget constraint of $50,000 for purchasing fuel.\nmodel.addCons(A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000)\n## The company has a limit on the total number of trucks it can deploy, which is 100 trucks.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1516,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Region1\": \"FuelTech1\", \"range\": \"FuelTech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region2\": \"FuelTech2\", \"range\": \"FuelTech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region3\": \"FuelTech3\", \"range\": \"FuelTech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n// Total profit for Region1: Profit1 = (1000 + 0.1 * FuelTech1) * Trucks1\n// Total profit for Region2: Profit2 = (1200 + 0.12 * FuelTech2) * Trucks2\n// Total profit for Region3: Profit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed across all regions is limited to 100 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\n// Trucks1 >= 20; Trucks2 >= 30\n\n## Generate Constraint-4:\nThe investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\n// FuelTech1 <= 0.5 * (1000 * Trucks1)\n// FuelTech2 <= 0.5 * (1200 * Trucks2)\n// FuelTech3 <= 0.5 * (1100 * Trucks3)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact. The profit per truck in each region is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110.\n\n| Region | Profit per Truck | Additional Profit per $1000 Investment |\n|--------|------------------|----------------------------------------|\n| Region1| $1000            | $100                                   |\n| Region2| $1200            | $120                                   |\n| Region3| $1100            | $110                                   |\n\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies. The total number of trucks that can be deployed across all regions is limited to 100 trucks. Due to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2. The investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\n\nPlease help the company to maximize the total profit from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20) # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30) # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Region3\nFuelTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech1\", lb=0) # investment in alternative fuel technology for Region1\nFuelTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech2\", lb=0) # investment in alternative fuel technology for Region2\nFuelTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech3\", lb=0) # investment in alternative fuel technology for Region3\n\n# Define objective function\n## The profit per truck is affected by the investment in alternative fuel technologies\nProfit1 = (1000 + 0.1 * FuelTech1) * Trucks1\nProfit2 = (1200 + 0.12 * FuelTech2) * Trucks2\nProfit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000)\n## The total number of trucks that can be deployed across all regions is limited to 100 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n## Due to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 30)\n## The investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\nmodel.addCons(FuelTech1 <= 0.5 * (1000 * Trucks1))\nmodel.addCons(FuelTech2 <= 0.5 * (1200 * Trucks2))\nmodel.addCons(FuelTech3 <= 0.5 * (1100 * Trucks3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Alternative Fuel Technology for Region1: \", model.getVal(FuelTech1))\n    print(\"Investment in Alternative Fuel Technology for Region2: \", model.getVal(FuelTech2))\n    print(\"Investment in Alternative Fuel Technology for Region3: \", model.getVal(FuelTech3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1805,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Truck A has a fuel efficiency of 5 km/liter and an operational cost of $100 per day. Truck B has a fuel efficiency of 7 km/liter and an operational cost of $120 per day. Truck C has a fuel efficiency of 10 km/liter and an operational cost of $150 per day. Truck D has a fuel efficiency of 12 km/liter and an operational cost of $180 per day. Truck E has a fuel efficiency of 15 km/liter and an operational cost of $200 per day. The company aims to minimize the total cost per kilometer traveled, which is defined as the sum of the daily operational costs divided by the sum of the kilometers traveled per day.\n// Cost per km for Truck A: Cost_A = (100 * 30) / (5 * A)\n// Cost per km for Truck B: Cost_B = (120 * 30) / (7 * B)\n// Cost per km for Truck C: Cost_C = (150 * 30) / (10 * C)\n// Cost per km for Truck D: Cost_D = (180 * 30) / (12 * D)\n// Cost per km for Truck E: Cost_E = (200 * 30) / (15 * E)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for operational costs for the month.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 15000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available for deployment.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 20% of the fleet is composed of the most fuel-efficient trucks (Truck E).\n// E >= 0.2 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe company has a minimum requirement to deploy at least 10 trucks of each type.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-5:\nThe total kilometers traveled by all trucks should not exceed 150,000 km per month.\n// 5 * A + 7 * B + 10 * C + 12 * D + 15 * E <= 150000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost. Each type of truck has a different fuel efficiency and operational cost. Truck A has a fuel efficiency of 5 km/liter and an operational cost of $100 per day. Truck B has a fuel efficiency of 7 km/liter and an operational cost of $120 per day. Truck C has a fuel efficiency of 10 km/liter and an operational cost of $150 per day. Truck D has a fuel efficiency of 12 km/liter and an operational cost of $180 per day. Truck E has a fuel efficiency of 15 km/liter and an operational cost of $200 per day. The company aims to minimize the total cost per kilometer traveled, which is defined as the sum of the daily operational costs divided by the sum of the kilometers traveled per day.\n\nThe company has a budget of $15,000 for operational costs for the month. The company has a total of 100 trucks available for deployment. The company needs to ensure that at least 20% of the fleet is composed of the most fuel-efficient trucks (Truck E). The company has a minimum requirement to deploy at least 10 trucks of each type. The total kilometers traveled by all trucks should not exceed 150,000 km per month.\n\nPlease help the company to minimize the total cost per kilometer traveled.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 * 30) / (5 * A)\nCost_B = (120 * 30) / (7 * B)\nCost_C = (150 * 30) / (10 * C)\nCost_D = (180 * 30) / (12 * D)\nCost_E = (200 * 30) / (15 * E)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $15,000 for operational costs for the month.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 15000)\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company needs to ensure that at least 20% of the fleet is composed of the most fuel-efficient trucks (Truck E).\nmodel.addCons(E >= 0.2 * (A + B + C + D + E))\n## The total kilometers traveled by all trucks should not exceed 150,000 km per month.\nmodel.addCons(5 * A + 7 * B + 10 * C + 12 * D + 15 * E <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1419,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Trucks\": \"EfficiencyT\", \"range\": \"EfficiencyT >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Vans\": \"EfficiencyV\", \"range\": \"EfficiencyV >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Bikes\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n// Total annual fuel cost for Trucks: CostT = (100 - 0.01 * EfficiencyT) * Trucks\n// Total annual fuel cost for Vans: CostV = (100 - 0.015 * EfficiencyV) * Vans\n// Total annual fuel cost for Bikes: CostB = (100 - 0.02 * EfficiencyB) * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\n// Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle. The fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost. The company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\n\nPlease help the company to determine the optimal number of each type of vehicle to purchase and the amount to invest in fuel efficiency upgrades to minimize the total annual fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nEfficiencyT = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyT\", lb=0)  # investment in fuel efficiency for Trucks\nEfficiencyV = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyV\", lb=0)  # investment in fuel efficiency for Vans\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for Bikes\n\n# Define objective function\nCostT = (100 - 0.01 * EfficiencyT) * Trucks\nCostV = (100 - 0.015 * EfficiencyV) * Vans\nCostB = (100 - 0.02 * EfficiencyB) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Fuel Efficiency for Trucks: \", model.getVal(EfficiencyT))\n    print(\"Investment in Fuel Efficiency for Vans: \", model.getVal(EfficiencyV))\n    print(\"Investment in Fuel Efficiency for Bikes: \", model.getVal(EfficiencyB))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The efficiency of each route, measured in deliveries per hour, is 20 for route 1, 25 for route 2, 30 for route 3, 28 for route 4, and 22 for route 5. The company wants to maximize the total deliveries per dollar spent.\n// Efficiency_Route1 = 20 * T1 / 1000\n// Efficiency_Route2 = 25 * T2 / 1200\n// Efficiency_Route3 = 30 * T3 / 1500\n// Efficiency_Route4 = 28 * T4 / 1300\n// Efficiency_Route5 = 22 * T5 / 1400\n// So, the objective function is: Maximize Efficiency_Route1 + Efficiency_Route2 + Efficiency_Route3 + Efficiency_Route4 + Efficiency_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck and efficiency of each route are given in the following Table.\n\n| Route | Cost per Truck | Efficiency (Deliveries per Hour) |\n|-------|----------------|---------------------------------|\n| 1     | $1000          | 20                              |\n| 2     | $1200          | 25                              |\n| 3     | $1500          | 30                              |\n| 4     | $1300          | 28                              |\n| 5     | $1400          | 22                              |\n\nThe company has a total of 100 trucks available for allocation. Please help the company to maximize the total deliveries per dollar spent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Route1 = 20 * T1 / 1000\nEfficiency_Route2 = 25 * T2 / 1200\nEfficiency_Route3 = 30 * T3 / 1500\nEfficiency_Route4 = 28 * T4 / 1300\nEfficiency_Route5 = 22 * T5 / 1400\n## convert the division to multiplication\nmodel.addCons(obj * 1000 == 20 * T1)\nmodel.addCons(obj * 1200 == 25 * T2)\nmodel.addCons(obj * 1500 == 30 * T3)\nmodel.addCons(obj * 1300 == 28 * T4)\nmodel.addCons(obj * 1400 == 22 * T5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Deliveries per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// TotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units per week.\n// ProductA >= 50",
        "question": "A manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the resource requirements for each product:\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit (kg) |\n|---------|-----------------|----------------------|---------------------------|\n| A       | 50$             | 5 hours              | 10 kg                     |\n| B       | 70$             | 8 hours              | 15 kg                     |\n| C       | 60$             | 6 hours              | 12 kg                     |\n\nThe total available labor hours per week are 1000. The total available raw material per week is 1500 kg. The market demand for product A is at least 50 units per week. \n\nPlease help the company to maximize the total profit from all products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\nTotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total available labor hours per week are 1000.\nmodel.addCons(5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000)\n# The total available raw material per week is 1500 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of resources per unit for ProductA is $40, ProductB is $60, and ProductC is $80. The investment in automation reduces the resource cost per unit by $2 for every $1000 invested. The company aims to maximize the total profit from all products.\n// Profit_ProductA = (100 - 40 + 0.002 * Automation) * ProductA\n// Profit_ProductB = (150 - 60 + 0.002 * Automation) * ProductB\n// Profit_ProductC = (200 - 80 + 0.002 * Automation) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of resources per unit for ProductA is $40, ProductB is $60, and ProductC is $80. The investment in automation reduces the resource cost per unit by $2 for every $1000 invested. The company aims to maximize the total profit from all products. The total resources available for production are limited to 1000 units. Please help the company determine the optimal production quantities, resource allocations, and the investment in automation to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resources allocated to ProductA\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resources allocated to ProductB\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resources allocated to ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfit_ProductA = (100 - 40 + 0.002 * Automation) * ProductA\nProfit_ProductB = (150 - 60 + 0.002 * Automation) * ProductB\nProfit_ProductC = (200 - 80 + 0.002 * Automation) * ProductC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Resources allocated to ProductA: \", model.getVal(ResourceA))\n    print(\"Resources allocated to ProductB: \", model.getVal(ResourceB))\n    print(\"Resources allocated to ProductC: \", model.getVal(ResourceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment\": \"QualityControl\", \"range\": \"QualityControl >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each product is affected by the marketing budget and the quality control investment. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by $5 for every $1000 spent, and the quality control investment reduces the defect rate by 1% for every $1000 invested. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (100 + 0.005 * MarketingA - 0.001 * QualityControl) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 + 0.005 * MarketingB - 0.001 * QualityControl) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 + 0.005 * MarketingC - 0.001 * QualityControl) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-2:\nThe total quality control investment cannot exceed $50,000.\n// QualityControl <= 50000\n\n## Generate Constraint-3:\nDue to production capacity constraints, the total production quantity of all products must not exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n// QuantityA >= 100; QuantityB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by $5 for every $1000 spent, and the quality control investment reduces the defect rate by 1% for every $1000 invested. The company aims to maximize the total revenue from all products.\n\n| Product | Revenue per Unit | Marketing Effect per $1000 | Quality Control Effect per $1000 |\n|---------|------------------|-----------------------------|----------------------------------|\n| ProductA | $100             | $5                          | 1% reduction in defect rate      |\n| ProductB | $150             | $5                          | 1% reduction in defect rate      |\n| ProductC | $200             | $5                          | 1% reduction in defect rate      |\n\nThe total marketing budget for all products cannot exceed $100,000. The total quality control investment cannot exceed $50,000. Due to production capacity constraints, the total production quantity of all products must not exceed 1000 units. The company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n\nPlease help the company to maximize the total revenue from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=100) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=200) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\nQualityControl = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControl\", lb=0) # quality control investment\n\n# Define objective function\nRevenueA = (100 + 0.005 * MarketingA - 0.001 * QualityControl) * QuantityA\nRevenueB = (150 + 0.005 * MarketingB - 0.001 * QualityControl) * QuantityB\nRevenueC = (200 + 0.005 * MarketingC - 0.001 * QualityControl) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)\nmodel.addCons(QualityControl <= 50000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Quality Control Investment: \", model.getVal(QualityControl))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1562,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks allocated to Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region A: Fuel consumption rate is 0.5 liters per km, and travel time is 0.1 hours per km.\n- Region B: Fuel consumption rate is 0.6 liters per km, and travel time is 0.12 hours per km.\n- Region C: Fuel consumption rate is 0.7 liters per km, and travel time is 0.14 hours per km.\n- Region D: Fuel consumption rate is 0.8 liters per km, and travel time is 0.16 hours per km.\n- Region E: Fuel consumption rate is 0.9 liters per km, and travel time is 0.18 hours per km.\nThe company wants to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck).\n// Fuel cost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * TotalDistance\n// Time cost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * TotalDistance * HourlyRate\n// So, the objective function is: Minimize (Fuel cost + Time cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total distance covered by all trucks should not exceed 5000 km.\n// (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 5000",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\nThe fuel consumption and travel time for each region are as follows:\n- Region A: Fuel consumption rate is 0.5 liters per km, and travel time is 0.1 hours per km.\n- Region B: Fuel consumption rate is 0.6 liters per km, and travel time is 0.12 hours per km.\n- Region C: Fuel consumption rate is 0.7 liters per km, and travel time is 0.14 hours per km.\n- Region D: Fuel consumption rate is 0.8 liters per km, and travel time is 0.16 hours per km.\n- Region E: Fuel consumption rate is 0.9 liters per km, and travel time is 0.18 hours per km.\nThe company wants to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck). The company has a total of 100 trucks available. The total distance covered by all trucks should not exceed 5000 km.\nPlease help the company to minimize the total cost, which is the sum of the fuel cost and the time cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel cost and Time cost calculation\nFuelCost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * 5000\nTimeCost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * 5000 * 20 # assuming HourlyRate = 20\n\n## the objective function is: Minimize (Fuel cost + Time cost)\nmodel.addCons(obj == FuelCost + TimeCost)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## The total distance covered by all trucks should not exceed 5000 km.\nmodel.addCons(0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-2:\nThe total fuel budget per day is $5000.\n// 0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000\n\n## Generate Constraint-3:\nThe total maintenance budget per day is $10000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route. The profit per trip, fuel cost per kilometer, and maintenance cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Cost per Kilometer | Maintenance Cost per Trip |\n|------------|-----------------|-------------------------|---------------------------|\n| A          | $500            | $0.5                    | $100                      |\n| B          | $700            | $0.7                    | $150                      |\n| C          | $900            | $0.9                    | $200                      |\n| D          | $1100           | $1.1                    | $250                      |\n\nThe company aims to maximize the total profit from all trips, considering the costs. The total number of trucks available is 100. The total fuel budget per day is $5000. The total maintenance budget per day is $10000. Please help the company optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the fuel cost per kilometer\n## Profit and cost calculations\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n## The total fuel budget per day is $5000.\nmodel.addCons(0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000)\n## The total maintenance budget per day is $10000.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"production quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\n// DeviceB_Quantity >= 2 * DeviceA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint of 800 units.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA. The company also has a storage capacity constraint of 800 units. Please help the company to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0) # production quantity of DeviceA\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0) # production quantity of DeviceB\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0) # production quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\nProfit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\nProfit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n# Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\nmodel.addCons(DeviceB_Quantity >= 2 * DeviceA_Quantity)\n# The company has a storage capacity constraint of 800 units.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the nonlinear relationship between production quantity and market saturation, which affects the selling price. The objective function is to maximize the total profit, considering a nonlinear decrease in selling price with increased production:\n// Profit_A = (20 - 10 - 0.01 * A^2) * A\n// Profit_B = (30 - 15 - 0.01 * B^2) * B\n// Profit_C = (40 - 20 - 0.01 * C^2) * C\n// Profit_D = (50 - 25 - 0.01 * D^2) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours, with product A requiring 2 hours per unit, product B requiring 3 hours per unit, product C requiring 4 hours per unit, and product D requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations. The profit per unit, production cost per unit, and production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|--------------------------|\n| A       | $20             | $10                      | 2 hours                  |\n| B       | $30             | $15                      | 3 hours                  |\n| C       | $40             | $20                      | 4 hours                  |\n| D       | $50             | $25                      | 5 hours                  |\n\nThe company has a budget of $5000 for production costs. The company has a limited production capacity of 200 hours. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. \nPlease help the company to maximize the total profit, considering a nonlinear decrease in selling price with increased production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## convert the quadratic terms to linear terms by introducing new variables\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nmodel.addCons(D_sq == D**2)\nProfit_A = (20 - 10 - 0.01 * A_sq) * A\nProfit_B = (30 - 15 - 0.01 * B_sq) * B\nProfit_C = (40 - 20 - 0.01 * C_sq) * C\nProfit_D = (50 - 25 - 0.01 * D_sq) * D\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n## The company has a limited production capacity of 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 200)\n## The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting the required cargo capacity. Additionally, the company can invest in fuel-saving technologies for each type of vehicle, which will reduce fuel consumption per kilometer but at a cost.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-saving technology for TruckA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for TruckB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for TruckC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per kilometer for TruckA is 0.3 liters, which decreases by 0.01 liters for every $100 invested in fuel-saving technology.\nThe fuel consumption per kilometer for TruckB is 0.25 liters, which decreases by 0.008 liters for every $100 invested in fuel-saving technology.\nThe fuel consumption per kilometer for TruckC is 0.2 liters, which decreases by 0.005 liters for every $100 invested in fuel-saving technology.\nThe total route distance is 1000 kilometers. The company aims to minimize the total fuel consumption.\n// Fuel_TruckA = 1000 * (0.3 - 0.0001 * TechA) * TruckA\n// Fuel_TruckB = 1000 * (0.25 - 0.00008 * TechB) * TruckB\n// Fuel_TruckC = 1000 * (0.2 - 0.00005 * TechC) * TruckC\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons. TruckA has a capacity of 10 tons, TruckB has a capacity of 15 tons, and TruckC has a capacity of 20 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investments in fuel-saving technologies.\n// TechA + TechB + TechC <= 10000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting the required cargo capacity. Additionally, the company can invest in fuel-saving technologies for each type of vehicle, which will reduce fuel consumption per kilometer but at a cost. The fuel consumption per kilometer and the capacity of each vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/km) | Capacity (tons) |\n|---------|------------------------------|-----------------|\n| TruckA  | 0.3 - 0.0001 * TechA         | 10              |\n| TruckB  | 0.25 - 0.00008 * TechB       | 15              |\n| TruckC  | 0.2 - 0.00005 * TechC         | 20              |\n\nThe total route distance is 1000 kilometers. The company aims to minimize the total fuel consumption. The total cargo capacity required is 500 tons. The company has a budget of $10,000 for investments in fuel-saving technologies.\n\nPlease help the company to determine the optimal number of each type of vehicle and the amount to invest in fuel-saving technologies to minimize the total fuel consumption while meeting the cargo capacity requirement.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)  # investment in fuel-saving technology for TruckA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)  # investment in fuel-saving technology for TruckB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)  # investment in fuel-saving technology for TruckC\n\n# Define objective function\nFuel_TruckA = 1000 * (0.3 - 0.0001 * TechA) * TruckA\nFuel_TruckB = 1000 * (0.25 - 0.00008 * TechB) * TruckB\nFuel_TruckC = 1000 * (0.2 - 0.00005 * TechC) * TruckC\n# So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)\n\n# Add constraints\n# The total cargo capacity required is 500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 500)\n# The company has a budget of $10,000 for investments in fuel-saving technologies.\nmodel.addCons(TechA + TechB + TechC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in TechA: \", model.getVal(TechA))\n    print(\"Investment in TechB: \", model.getVal(TechB))\n    print(\"Investment in TechC: \", model.getVal(TechC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1314,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"cost per kilometer for small vehicles\": \"CostPerKmSmall\", \"range\": \"CostPerKmSmall >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for medium vehicles\": \"CostPerKmMedium\", \"range\": \"CostPerKmMedium >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for large vehicles\": \"CostPerKmLarge\", \"range\": \"CostPerKmLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer.\n// Revenue_Small = 10 * SmallVehicles\n// Revenue_Medium = 15 * MediumVehicles\n// Revenue_Large = 20 * LargeVehicles\n// Operational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads.\n// LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles)",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints. The revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads. Please help the company to determine the optimal number of each type of vehicle to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)  # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)  # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)  # number of large vehicles\n\n# Define objective function\nRevenue_Small = 10 * SmallVehicles\nRevenue_Medium = 15 * MediumVehicles\nRevenue_Large = 20 * LargeVehicles\nOperational_Cost = SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles  # simplified operational cost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n# Add constraints\nmodel.addCons(SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles <= 10000)  # total budget constraint\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 50)  # total number of vehicles constraint\nmodel.addCons(LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles))  # large vehicles composition constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: CargoA, CargoB, and CargoC. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will affect the operational costs and fuel efficiency.\n// {\"number of trucks for CargoA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for CargoA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CargoB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CargoC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost decreases by $50 per truck per month. The operational cost of a truck without technology is $1000 per month for CargoA, $1200 for CargoB, and $1500 for CargoC. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for CargoA: CostA = (1000 - 0.05 * TechA) * TrucksA\n// Operational cost for CargoB: CostB = (1200 - 0.05 * TechB) * TrucksB\n// Operational cost for CargoC: CostC = (1500 - 0.05 * TechC) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\n// TrucksA + TrucksB + TrucksC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// TrucksA + TrucksB + TrucksC <= 200",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide the number of trucks to purchase for three different types of cargo: CargoA, CargoB, and CargoC. The company is also considering investing in fuel-efficient technologies for each type of truck, which will affect the operational costs and fuel efficiency. The operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost decreases by $50 per truck per month. The operational cost of a truck without technology is $1000 per month for CargoA, $1200 for CargoB, and $1500 for CargoC. The company aims to minimize the total operational cost of the fleet.\n\n| Cargo Type | Operational Cost Without Tech | Tech Investment Impact |\n|------------|-------------------------------|------------------------|\n| CargoA     | $1000 per month               | $50 decrease per $1000 |\n| CargoB     | $1200 per month               | $50 decrease per $1000 |\n| CargoC     | $1500 per month               | $50 decrease per $1000 |\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks in the fleet must not exceed 200.\n\nPlease help the company determine the optimal number of trucks for each cargo type and the appropriate investment in fuel-efficient technologies to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CargoA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CargoB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CargoC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0) # investment in fuel-efficient technology for CargoA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0) # investment in fuel-efficient technology for CargoB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0) # investment in fuel-efficient technology for CargoC\n\n# Define objective function\nCostA = (1000 - 0.05 * TechA) * TrucksA\nCostB = (1200 - 0.05 * TechB) * TrucksB\nCostC = (1500 - 0.05 * TechC) * TrucksC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TechA + TechB + TechC <= 100000)\n# The total number of trucks in the fleet must not exceed 200.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CargoB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CargoC: \", model.getVal(TrucksC))\n    print(\"Investment in Tech for CargoA: \", model.getVal(TechA))\n    print(\"Investment in Tech for CargoB: \", model.getVal(TechB))\n    print(\"Investment in Tech for CargoC: \", model.getVal(TechC))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost.\n// Total cargo capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total operational cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n// So, the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive.\n// E >= 0.1 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations. Each type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost. The company has a budget of $100,000 for operational costs for the month. It can deploy at most 50 trucks in total. The company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive. Please help the company determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCargoCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nTotalOperationalCost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n## the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n## convert the division to multiplication\nmodel.addCons(obj * TotalOperationalCost == TotalCargoCapacity)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000)\n## The company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Truck E, which is the most efficient but also the most expensive.\nmodel.addCons(E >= 0.1 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Operational Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for device A is 0.01 * A^2, for device B is 0.02 * B^2, and for device C is 0.03 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs next month.\n// 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2 <= 5000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin. The profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for device A is 0.01 * A^2, for device B is 0.02 * B^2, and for device C is 0.03 * C^2. The company has a budget of $5000 for production costs next month. Please help the company to maximize its total profit, which is the difference between the revenue and the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## The company has a budget of $5000 for production costs next month.\nmodel.addCons(0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\n// {\"trips to D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs).\n// NetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1^2\n// NetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2^2\n// NetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3^2\n// NetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4^2\n// NetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5^2\n// So, the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10000.\n// 200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget that cannot exceed $2000.\n// 0.01 * D1^2 + 0.015 * D2^2 + 0.02 * D3^2 + 0.025 * D4^2 + 0.03 * D5^2 <= 2000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs). The company has a total fuel budget of $10000. The company also has a maintenance budget that cannot exceed $2000.\nPlease help the company to maximize the net profit (total profit minus total costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # trips to D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # trips to D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # trips to D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # trips to D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # trips to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate net profit for each destination\nNetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1**2\nNetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2**2\nNetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3**2\nNetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4**2\nNetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5**2\n\n## the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\nmodel.addCons(obj == NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n# Add constraints\n## The company has a total fuel budget of $10000.\nmodel.addCons(200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000)\n## The company has a maintenance budget that cannot exceed $2000.\nmodel.addCons(0.01 * D1**2 + 0.015 * D2**2 + 0.02 * D3**2 + 0.025 * D4**2 + 0.03 * D5**2 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(D1))\n    print(\"Trips to D2: \", model.getVal(D2))\n    print(\"Trips to D3: \", model.getVal(D3))\n    print(\"Trips to D4: \", model.getVal(D4))\n    print(\"Trips to D5: \", model.getVal(D5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company needs to minimize the total daily operational cost and fuel consumption.\n// Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n// Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (Cost + Fuel)\n\n## Generate Constraint-1:\nThe company has a daily demand of 1000 km of transportation.\n// 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation. Each type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company has a daily demand of 1000 km of transportation. Please help the company to minimize the total daily operational cost and fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption and operational cost\nFuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\nCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost + Fuel)\nmodel.addCons(obj == Cost + Fuel)\n\n# Add constraints\n## The company has a daily demand of 1000 km of transportation.\nmodel.addCons(5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Daily Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\nThe company has a budget of $500,000 for investments in energy storage systems.\nPlease help the company to maximize the total energy output stored efficiently.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n## the objective function is: Maximize (Energy_output * Storage_efficiency)\n## convert the multiplication to addition\nmodel.addCons(obj == Energy_output + Storage_efficiency)\n\n# Add constraints\n## The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of vehicles to allocate for each type of good and the number of trips each vehicle will make per day.\n// {\"number of vehicles for Type A\": \"TypeAVehicles\", \"range\": \"TypeAVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles for Type B\": \"TypeBVehicles\", \"range\": \"TypeBVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles for Type C\": \"TypeCVehicles\", \"range\": \"TypeCVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Type A\": \"TypeATrips\", \"range\": \"TypeATrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Type B\": \"TypeBTrips\", \"range\": \"TypeBTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Type C\": \"TypeCTrips\", \"range\": \"TypeCTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for Type A goods is $100, for Type B goods is $150, and for Type C goods is $200. The fuel cost per trip for Type A vehicles is $20, for Type B vehicles is $30, and for Type C vehicles is $40. The company aims to maximize its daily net profit.\n// Profit_TypeA = TypeATrips * TypeAVehicles * (100 - 20)\n// Profit_TypeB = TypeBTrips * TypeBVehicles * (150 - 30)\n// Profit_TypeC = TypeCTrips * TypeCVehicles * (200 - 40)\n// So, the objective function is: Maximize (Profit_TypeA + Profit_TypeB + Profit_TypeC)\n\n## Generate Constraint-1:\nThe company has a total of 50 vehicles available.\n// TypeAVehicles + TypeBVehicles + TypeCVehicles <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * TypeATrips * TypeAVehicles + 30 * TypeBTrips * TypeBVehicles + 40 * TypeCTrips * TypeCVehicles <= 1000\n\n## Generate Constraint-3:\nThe company has a daily operational limit of 100 trips.\n// TypeATrips * TypeAVehicles + TypeBTrips * TypeBVehicles + TypeCTrips * TypeCVehicles <= 100\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the total trips are for Type C goods to meet a contractual obligation.\n// TypeCTrips * TypeCVehicles >= 0.2 * (TypeATrips * TypeAVehicles + TypeBTrips * TypeBVehicles + TypeCTrips * TypeCVehicles)",
        "question": "A logistics company is planning to optimize its fleet of vehicles to transport three different types of goods (Type A, Type B, and Type C) across different routes. The company needs to decide the number of vehicles to allocate for each type of good and the number of trips each vehicle will make per day. The profit per trip and fuel cost per trip for each type of good are given in the following Table.\n\n| Type of Good | Profit per Trip | Fuel Cost per Trip |\n|--------------|-----------------|--------------------|\n| Type A       | $100            | $20                |\n| Type B       | $150            | $30                |\n| Type C       | $200            | $40                |\n\nThe company has a total of 50 vehicles available. The company has a daily fuel budget of $1000. The company has a daily operational limit of 100 trips. The company must ensure that at least 20% of the total trips are for Type C goods to meet a contractual obligation. \nPlease help the company to maximize its daily net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeAVehicles = model.addVar(vtype=\"INTEGER\", name=\"TypeAVehicles\", lb=0)\nTypeBVehicles = model.addVar(vtype=\"INTEGER\", name=\"TypeBVehicles\", lb=0)\nTypeCVehicles = model.addVar(vtype=\"INTEGER\", name=\"TypeCVehicles\", lb=0)\nTypeATrips = model.addVar(vtype=\"INTEGER\", name=\"TypeATrips\", lb=0)\nTypeBTrips = model.addVar(vtype=\"INTEGER\", name=\"TypeBTrips\", lb=0)\nTypeCTrips = model.addVar(vtype=\"INTEGER\", name=\"TypeCTrips\", lb=0)\n\n# Define objective function\nProfit_TypeA = TypeATrips * TypeAVehicles * (100 - 20)\nProfit_TypeB = TypeBTrips * TypeBVehicles * (150 - 30)\nProfit_TypeC = TypeCTrips * TypeCVehicles * (200 - 40)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TypeA + Profit_TypeB + Profit_TypeC)\n\n# Add constraints\nmodel.addCons(TypeAVehicles + TypeBVehicles + TypeCVehicles <= 50)\nmodel.addCons(20 * TypeATrips * TypeAVehicles + 30 * TypeBTrips * TypeBVehicles + 40 * TypeCTrips * TypeCVehicles <= 1000)\nmodel.addCons(TypeATrips * TypeAVehicles + TypeBTrips * TypeBVehicles + TypeCTrips * TypeCVehicles <= 100)\nmodel.addCons(TypeCTrips * TypeCVehicles >= 0.2 * (TypeATrips * TypeAVehicles + TypeBTrips * TypeBVehicles + TypeCTrips * TypeCVehicles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles for Type A: \", model.getVal(TypeAVehicles))\n    print(\"Number of Vehicles for Type B: \", model.getVal(TypeBVehicles))\n    print(\"Number of Vehicles for Type C: \", model.getVal(TypeCVehicles))\n    print(\"Number of Trips per Vehicle for Type A: \", model.getVal(TypeATrips))\n    print(\"Number of Trips per Vehicle for Type B: \", model.getVal(TypeBTrips))\n    print(\"Number of Trips per Vehicle for Type C: \", model.getVal(TypeCTrips))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-4:\nThe production of ComponentB should be at least twice the production of ComponentA.\n// B >= 2 * A\n\n## Generate Constraint-5:\nThe total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB.\n// C + D <= A + B",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50             | 2 hours                  |\n| ComponentB | $70             | 3 hours                  |\n| ComponentC | $90             | 4 hours                  |\n| ComponentD | $110            | 5 hours                  |\n\nThe company has a total production capacity of 1000 hours per week. The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week. The company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for each component is as follows: ComponentA - $10 per unit, ComponentB - $15 per unit, ComponentC - $20 per unit, ComponentD - $25 per unit. The production of ComponentB should be at least twice the production of ComponentA. The total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB.\n\nPlease help the company to maximize the total profit from the production of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n# The company has a limited budget for raw materials, which is $5000 per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n# The production of ComponentB should be at least twice the production of ComponentA.\nmodel.addCons(B >= 2 * A)\n# The total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB.\nmodel.addCons(C + D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1526,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on R1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes.\n// So, the objective function is: Minimize (100 * R1^2 + 120 * R2^2 + 140 * R3^2 + 160 * R4^2 + 180 * R5^2)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// R1 + R2 + R3 + R4 + R5 <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel and maintenance costs. The cost per truck per route is linearly related to the number of trucks on that route.\n// 100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000\n\n## Generate Constraint-3:\nThe demand for transportation on route R1 is at least 5 trucks.\n// R1 >= 5",
        "question": "A logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes.\n\nThe company has a total of 50 trucks available for allocation. The company has a budget of $10,000 for fuel and maintenance costs. The cost per truck per route is linearly related to the number of trucks on that route. The demand for transportation on route R1 is at least 5 trucks.\n\nPlease help the company to determine the optimal allocation of trucks to minimize the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=5) # number of trucks on R1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0) # number of trucks on R2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0) # number of trucks on R3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0) # number of trucks on R4\nR5 = model.addVar(vtype=\"INTEGER\", name=\"R5\", lb=0) # number of trucks on R5\n\n# Define objective function\nCost_R1 = 100 * R1**2\nCost_R2 = 120 * R2**2\nCost_R3 = 140 * R3**2\nCost_R4 = 160 * R4**2\nCost_R5 = 180 * R5**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 50)\nmodel.addCons(100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on R1: \", model.getVal(R1))\n    print(\"Number of Trucks on R2: \", model.getVal(R2))\n    print(\"Number of Trucks on R3: \", model.getVal(R3))\n    print(\"Number of Trucks on R4: \", model.getVal(R4))\n    print(\"Number of Trucks on R5: \", model.getVal(R5))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and heavy machinery. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should operate to minimize fuel consumption and maximize delivery efficiency.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"MachineryTrucks\", \"range\": \"MachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for heavy machinery\": \"MachinerySpeed\", \"range\": \"MachinerySpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for electronics trucks is 0.1 liters per kilometer, for perishables trucks is 0.15 liters per kilometer, and for heavy machinery trucks is 0.2 liters per kilometer. The company wants to minimize the total daily fuel consumption while ensuring efficient delivery times.\n// Fuel_Electronics = 0.1 * ElectronicsTrucks * ElectronicsSpeed\n// Fuel_Perishables = 0.15 * PerishablesTrucks * PerishablesSpeed\n// Fuel_Machinery = 0.2 * MachineryTrucks * MachinerySpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Perishables + Fuel_Machinery)\n\n## Generate Constraint-1:\nThe company has a total fleet size of 50 trucks.\n// ElectronicsTrucks + PerishablesTrucks + MachineryTrucks <= 50\n\n## Generate Constraint-2:\nThe total daily distance that all trucks can cover is limited to 5000 kilometers.\n// ElectronicsTrucks * ElectronicsSpeed + PerishablesTrucks * PerishablesSpeed + MachineryTrucks * MachinerySpeed <= 5000\n\n## Generate Constraint-3:\nThe company has a budget of $2000 for daily fuel costs.\n// 0.1 * ElectronicsTrucks * ElectronicsSpeed + 0.15 * PerishablesTrucks * PerishablesSpeed + 0.2 * MachineryTrucks * MachinerySpeed <= 2000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and heavy machinery. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should operate to minimize fuel consumption and maximize delivery efficiency. The fuel consumption rate for electronics trucks is 0.1 liters per kilometer, for perishables trucks is 0.15 liters per kilometer, and for heavy machinery trucks is 0.2 liters per kilometer. The company has a total fleet size of 50 trucks and a budget of $2000 for daily fuel costs. The total daily distance that all trucks can cover is limited to 5000 kilometers. Please help the company to minimize the total daily fuel consumption while ensuring efficient delivery times.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"MachineryTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=0)\nMachinerySpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"MachinerySpeed\", lb=0)\n\n# Define objective function\nFuel_Electronics = 0.1 * ElectronicsTrucks * ElectronicsSpeed\nFuel_Perishables = 0.15 * PerishablesTrucks * PerishablesSpeed\nFuel_Machinery = 0.2 * MachineryTrucks * MachinerySpeed\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Electronics + Fuel_Perishables + Fuel_Machinery)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + MachineryTrucks <= 50)\nmodel.addCons(ElectronicsTrucks * ElectronicsSpeed + PerishablesTrucks * PerishablesSpeed + MachineryTrucks * MachinerySpeed <= 5000)\nmodel.addCons(0.1 * ElectronicsTrucks * ElectronicsSpeed + 0.15 * PerishablesTrucks * PerishablesSpeed + 0.2 * MachineryTrucks * MachinerySpeed <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(MachineryTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Perishables: \", model.getVal(PerishablesSpeed))\n    print(\"Average Speed of Trucks for Heavy Machinery: \", model.getVal(MachinerySpeed))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\n// UnitsA <= 8 * RateA\n// UnitsB <= 8 * RateB\n// UnitsC <= 8 * RateC",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit. The total production capacity of the factory is limited to 100 units per day. The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day. Please help the manufacturer determine the optimal number of units of each product to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100) # total production capacity constraint\nmodel.addCons(UnitsA <= 8 * 2) # assuming RateA = 2 units per hour\nmodel.addCons(UnitsB <= 8 * 3) # assuming RateB = 3 units per hour\nmodel.addCons(UnitsC <= 8 * 2.5) # assuming RateC = 2.5 units per hour\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-2:\nThe total fuel budget per day is $5000.\n// 0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000\n\n## Generate Constraint-3:\nThe total maintenance budget per day is $10000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000\n\n## Generate Constraint-4:\nEach truck type has a different capacity. Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck D does not exceed the combined number of Truck A and Truck B.\n// TruckD <= TruckA + TruckB",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route. The profit per trip, fuel cost per kilometer, and maintenance cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Cost per Kilometer | Maintenance Cost per Trip |\n|------------|-----------------|-------------------------|---------------------------|\n| A          | $500            | $0.5                    | $100                      |\n| B          | $700            | $0.7                    | $150                      |\n| C          | $900            | $0.9                    | $200                      |\n| D          | $1100           | $1.1                    | $250                      |\n\nThe company has a total of 100 trucks available. The total fuel budget per day is $5000, and the total maintenance budget per day is $10000. Each truck type has a different capacity: Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons. The company wants to ensure that the number of Truck D does not exceed the combined number of Truck A and Truck B.\n\nPlease help the company to maximize the total profit from all trips, considering the costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the fuel cost per kilometer\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100) # total number of trucks available is 100\nmodel.addCons(0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000) # total fuel budget per day is $5000\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000) # total maintenance budget per day is $10000\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500) # total cargo to be transported is 1500 tons\nmodel.addCons(TruckD <= TruckA + TruckB) # number of Truck D does not exceed the combined number of Truck A and Truck B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1424,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. Additionally, the company is considering investing in hybrid technology for some vehicles to reduce fuel consumption, which varies based on the type of vehicle and the level of hybridization.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Trucks\": \"HybridTruck\", \"range\": \"HybridTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Vans\": \"HybridVan\", \"range\": \"HybridVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Bikes\": \"HybridBike\", \"range\": \"HybridBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter.\n// FuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\n// FuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\n// FuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\n// TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and operational constraints.\n// TruckCount + VanCount + BikeCount <= 100\n\n## Generate Constraint-3:\nThe company must maintain at least 10 Trucks and 20 Vans for critical delivery services.\n// TruckCount >= 10; VanCount >= 20\n\n## Generate Constraint-4:\nThe investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\n// HybridTruck <= 0.5 * TruckCount\n// HybridVan <= 0.5 * VanCount\n// HybridBike <= 0.5 * BikeCount",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. The fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter.\n\nThe company has a budget of $100,000 for vehicle purchases and hybrid technology investments. The total number of vehicles cannot exceed 100 due to parking and operational constraints. The company must maintain at least 10 Trucks and 20 Vans for critical delivery services. The investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\n\nPlease help the company to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=10)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=20)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nHybridTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridTruck\", lb=0)  # investment in hybrid technology for Trucks\nHybridVan = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridVan\", lb=0)  # investment in hybrid technology for Vans\nHybridBike = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridBike\", lb=0)  # investment in hybrid technology for Bikes\n\n# Define objective function\nDailyDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DailyDistance\", lb=0)  # daily distance for each vehicle\nFuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\nFuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\nFuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n# So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n# Add constraints\n# The company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\nmodel.addCons(TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000)\n# The total number of vehicles cannot exceed 100 due to parking and operational constraints.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 100)\n# The company must maintain at least 10 Trucks and 20 Vans for critical delivery services.\nmodel.addCons(TruckCount >= 10)\nmodel.addCons(VanCount >= 20)\n# The investment in hybrid technology for each type of vehicle cannot exceed 50% of the total cost of the vehicle.\nmodel.addCons(HybridTruck <= 0.5 * TruckCount)\nmodel.addCons(HybridVan <= 0.5 * VanCount)\nmodel.addCons(HybridBike <= 0.5 * BikeCount)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Hybrid Technology for Trucks: \", model.getVal(HybridTruck))\n    print(\"Investment in Hybrid Technology for Vans: \", model.getVal(HybridVan))\n    print(\"Investment in Hybrid Technology for Bikes: \", model.getVal(HybridBike))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city to maximize profit. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck, which affects the fuel cost per trip.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for each truck\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The company aims to maximize the total profit from all trips.\n// Total profit for City1: Profit1 = (1000 - 0.05 * TechInvestment) * Trips1\n// Total profit for City2: Profit2 = (1200 - 0.05 * TechInvestment) * Trips2\n// Total profit for City3: Profit3 = (1500 - 0.05 * TechInvestment) * Trips3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and technology investments.\n// 0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000\n\n## Generate Constraint-2:\nThe company's fleet can make a maximum of 500 trips in total.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2.\n// Trips1 >= 100; Trips2 >= 150\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology should not exceed $10,000 per truck.\n// TechInvestment <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city and the investment in fuel-efficient technologies for each truck to maximize profit. The profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The company has a total budget of $50,000 for fuel and technology investments. The company's fleet can make a maximum of 500 trips in total. Due to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2. The investment in fuel-efficient technology should not exceed $10,000 per truck. Please help the company to maximize the total profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to City3\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in fuel-efficient technology\n\n# Define objective function\nProfit1 = (1000 - 0.05 * TechInvestment) * Trips1\nProfit2 = (1200 - 0.05 * TechInvestment) * Trips2\nProfit3 = (1500 - 0.05 * TechInvestment) * Trips3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\nmodel.addCons(0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\nmodel.addCons(Trips1 >= 100)\nmodel.addCons(Trips2 >= 150)\nmodel.addCons(TechInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Investment in fuel-efficient technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses.\n// {\"number of warehouses at Location A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each location to the distribution centers is as follows:\n- From Location A: $5 per unit\n- From Location B: $7 per unit\n- From Location C: $6 per unit\n- From Location D: $8 per unit\n- From Location E: $9 per unit\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location.\n// Total transportation cost: Cost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 to build warehouses.\n// Construction cost per warehouse at A: $1000, at B: $1500, at C: $1200, at D: $1800, at E: $2000\n// 1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000\n\n## Generate Constraint-2:\nThe total number of warehouses should not exceed 30.\n// A + B + C + D + E <= 30",
        "question": "A logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses. The transportation cost from each location to the distribution centers is as follows:\n- From Location A: $5 per unit\n- From Location B: $7 per unit\n- From Location C: $6 per unit\n- From Location D: $8 per unit\n- From Location E: $9 per unit\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location. The company has a budget of $50,000 to build warehouses. The total number of warehouses should not exceed 30.\nPlease help the company to determine the optimal number of warehouses to be built at each location to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of warehouses at Location A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of warehouses at Location B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of warehouses at Location C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of warehouses at Location D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of warehouses at Location E\n\n# Define objective function\n## Total transportation cost: Cost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\nCost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\n## So, the objective function is: Minimize Cost\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n## The company has a budget of $50,000 to build warehouses.\nmodel.addCons(1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000)\n## The total number of warehouses should not exceed 30.\nmodel.addCons(A + B + C + D + E <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Warehouses at Location A: \", model.getVal(A))\n    print(\"Number of Warehouses at Location B: \", model.getVal(B))\n    print(\"Number of Warehouses at Location C: \", model.getVal(C))\n    print(\"Number of Warehouses at Location D: \", model.getVal(D))\n    print(\"Number of Warehouses at Location E: \", model.getVal(E))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the revenue per unit is $30, the production time per unit is 1 hour, and the material cost per unit is $10. \nFor product B, the revenue per unit is $40, the production time per unit is 2 hours, and the material cost per unit is $15. \nFor product C, the revenue per unit is $50, the production time per unit is 3 hours, and the material cost per unit is $20.\nFor product D, the revenue per unit is $60, the production time per unit is 4 hours, and the material cost per unit is $25.\nThe company only has one production line and can only produce one product at a time. The company wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_A = 30 * A - 10 * A\n// Profit_B = 40 * B - 15 * B\n// Profit_C = 50 * C - 20 * C\n// Profit_D = 60 * D - 25 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe company has a limited production time of 200 hours.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce. The revenue per unit, production time per unit, and material cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Time per Unit | Material Cost per Unit |\n|---------|------------------|--------------------------|------------------------|\n| A       | $30              | 1 hour                   | $10                    |\n| B       | $40              | 2 hours                  | $15                    |\n| C       | $50              | 3 hours                  | $20                    |\n| D       | $60              | 4 hours                  | $25                    |\n\nThe company only has one production line and can only produce one product at a time. The company has a limited production time of 200 hours. \nPlease help the company to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProfit_D = (60 - 25) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a limited production time of 200 hours.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance.\n// Distance_TruckA = 10 * TruckA\n// Distance_TruckB = 15 * TruckB\n// Distance_TruckC = 20 * TruckC\n// So, the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / (100 * TruckA + 150 * TruckB + 200 * TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for maintenance per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks in total.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints. The fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance. The company has a total budget of $5000 for maintenance per day and a limit of 50 trucks in total. Please help the company determine the optimal number of each type of truck to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance_TruckA = 10 * TruckA\nDistance_TruckB = 15 * TruckB\nDistance_TruckC = 20 * TruckC\nMaintenanceCost = 100 * TruckA + 150 * TruckB + 200 * TruckC\n## the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / MaintenanceCost\n## convert the division to multiplication\nmodel.addCons(obj * MaintenanceCost == Distance_TruckA + Distance_TruckB + Distance_TruckC)\n\n# Add constraints\n## The company has a total budget of $5000 for maintenance per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n## The company has a limit of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Distance per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage.\n// {\"number of Device A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Device B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Device C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Device D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Device E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n// Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity for all devices is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70.\n// 30A + 40B + 50C + 60D + 70E <= 50000\n\n## Generate Constraint-3:\nThe demand for Device A must be met, which is at least 100 units.\n// A >= 100",
        "question": "A manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage. The profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity for all devices is 1000 units per day. The company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70. The demand for Device A must be met, which is at least 100 units. Please help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of Device A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Device B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Device C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Device D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Device E produced\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n## Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 80 * C + 90 * D + 100 * E\nStorage = 2 * A + 3 * B + 4 * C + 5 * D + 6 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity for all devices is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a budget constraint of $50,000 for production costs.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D + 70 * E <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified range.\n// {\"dosage level of DrugA\": \"DA\", \"range\": \"0 <= DA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DB\", \"range\": \"0 <= DB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DC\", \"range\": \"0 <= DC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of each drug is modeled as a nonlinear function of the dosage level. The side effects are also modeled as a nonlinear function of the dosage level. The company aims to maximize the total therapeutic effect while minimizing the total side effects.\n// Therapeutic effect of DrugA: TE_A = 100 * (DA / (DA + 50))^2\n// Therapeutic effect of DrugB: TE_B = 150 * (DB / (DB + 75))^2\n// Therapeutic effect of DrugC: TE_C = 200 * (DC / (DC + 100))^2\n// Side effect of DrugA: SE_A = 50 * (DA / (DA + 25))^2\n// Side effect of DrugB: SE_B = 75 * (DB / (DB + 37.5))^2\n// Side effect of DrugC: SE_C = 100 * (DC / (DC + 50))^2\n// The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DA + DB + DC <= 300\n\n## Generate Constraint-2:\nThe dosage of DrugA must be at least half of the dosage of DrugB.\n// DA >= 0.5 * DB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least twice the dosage of DrugA.\n// DC >= 2 * DA",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within specified ranges: 0 <= DA <= 100 for DrugA, 0 <= DB <= 150 for DrugB, and 0 <= DC <= 200 for DrugC. The therapeutic effect of each drug is modeled as a nonlinear function of the dosage level, and the side effects are also modeled as a nonlinear function of the dosage level. The company aims to maximize the total therapeutic effect (TE_A + TE_B + TE_C) while minimizing the total side effects (SE_A + SE_B + SE_C). The total dosage across all drugs must not exceed 300 units. The dosage of DrugA must be at least half of the dosage of DrugB, and the dosage of DrugC must be at least twice the dosage of DrugA. Please help the company to determine the optimal dosage levels for each drug.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDA = model.addVar(vtype=\"CONTINUOUS\", name=\"DA\", lb=0, ub=100) # dosage level of DrugA\nDB = model.addVar(vtype=\"CONTINUOUS\", name=\"DB\", lb=0, ub=150) # dosage level of DrugB\nDC = model.addVar(vtype=\"CONTINUOUS\", name=\"DC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\n## Therapeutic effect and side effect functions\nTE_A = 100 * (DA / (DA + 50))**2\nTE_B = 150 * (DB / (DB + 75))**2\nTE_C = 200 * (DC / (DC + 100))**2\nSE_A = 50 * (DA / (DA + 25))**2\nSE_B = 75 * (DB / (DB + 37.5))**2\nSE_C = 100 * (DC / (DC + 50))**2\n## The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n## Combine the maximization and minimization into a single maximization problem\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TE_A + TE_B + TE_C - SE_A - SE_B - SE_C)\n\n# Add constraints\n## The total dosage across all drugs must not exceed 300 units.\nmodel.addCons(DA + DB + DC <= 300)\n## The dosage of DrugA must be at least half of the dosage of DrugB.\nmodel.addCons(DA >= 0.5 * DB)\n## The dosage of DrugC must be at least twice the dosage of DrugA.\nmodel.addCons(DC >= 2 * DA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DC))\n    print(\"Maximized Therapeutic Effect Minimized Side Effects: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\n// {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes.\nThe fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nThe total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 50.\n// \u03a3(Trucks_j) <= 50 for all j\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 80 km/h.\n// Speed_i <= 80 for all i\n\n## Generate Constraint-3:\nDue to safety regulations, the minimum speed of any truck must be at least 40 km/h.\n// Speed_i >= 40 for all i\n\n## Generate Constraint-4:\nThe budget for fuel additives is limited to $10,000.\n// \u03a3(Additive_j * Cost_per_Unit_Additive) <= 10000 for all j",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i. The company aims to minimize the total fuel cost across all routes.\nThe total number of trucks available is limited to 50. The maximum speed limit for any truck is 80 km/h. Due to safety regulations, the minimum speed of any truck must be at least 40 km/h. The budget for fuel additives is limited to $10,000.\nPlease help the company to minimize the total fuel cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define speed of each truck\nSpeed = {}\nfor i in range(1, 51):  # Assuming a maximum of 50 trucks\n    Speed[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=40, ub=80)\n\n## Define number of trucks on each route\nTrucks = {}\nfor j in range(1, 11):  # Assuming a maximum of 10 routes\n    Trucks[j] = model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0)\n\n## Define amount of fuel additive for each route\nAdditive = {}\nfor j in range(1, 11):\n    Additive[j] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Additive_{j}\", lb=0)\n\n# Define objective function\n## Calculate fuel consumption for each truck\nFuel_Consumption = {}\nfor i in range(1, 51):\n    Fuel_Consumption[i] = (Speed[i]**2) / (100 - Speed[i]) + 0.01 * Additive[1] * Speed[i]  # Assuming Additive_j is the same for all routes for simplicity\n\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Fuel_Consumption[i] * 3 for i in range(1, 51)))  # Assuming cost per unit fuel is $3\n\n# Add constraints\n## Total number of trucks available is limited to 50\nmodel.addCons(sum(Trucks[j] for j in range(1, 11)) <= 50)\n\n## Maximum speed limit for any truck is 80 km/h\nfor i in range(1, 51):\n    model.addCons(Speed[i] <= 80)\n\n## Minimum speed of any truck must be at least 40 km/h\nfor i in range(1, 51):\n    model.addCons(Speed[i] >= 40)\n\n## Budget for fuel additives is limited to $10,000\nmodel.addCons(sum(Additive[j] * 100 for j in range(1, 11)) <= 10000)  # Assuming cost per unit additive is $100\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(1, 51):\n        print(f\"Speed of Truck {i}: {model.getVal(Speed[i])}\")\n    for j in range(1, 11):\n        print(f\"Number of Trucks on Route {j}: {model.getVal(Trucks[j])}\")\n        print(f\"Amount of Fuel Additive for Route {j}: {model.getVal(Additive[j])}\")\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.1 for each unit produced after the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.05 for each unit produced after the first 200 units. The profit per unit for ComponentC is $80, but it decreases by $0.08 for each unit produced after the first 150 units. The profit per unit for ComponentD is $60, but it decreases by $0.06 for each unit produced after the first 120 units. The profit per unit for ComponentE is $90, but it decreases by $0.1 for each unit produced after the first 180 units. The company wants to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\n// Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\n// Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB.\n// UnitsA >= 0.5 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50,000",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit. The profit per unit for ComponentA is $50, but it decreases by $0.1 for each unit produced after the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.05 for each unit produced after the first 200 units. The profit per unit for ComponentC is $80, but it decreases by $0.08 for each unit produced after the first 150 units. The profit per unit for ComponentD is $60, but it decreases by $0.06 for each unit produced after the first 120 units. The profit per unit for ComponentE is $90, but it decreases by $0.1 for each unit produced after the first 180 units. The company has a total production capacity of 1000 units per month. Due to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB. The company has a budget of $50,000 for raw materials per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0)  # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0)  # number of units of ComponentE\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=1000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=150)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=150, ub=1000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (80 - 0.08 * C2) * C2 * C_b2 + 80 * C1 * C_b1\n## create piecewise variables for piecewise function: Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=120)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=120, ub=1000)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(UnitsD == D1*D_b1 + D2*D_b2)\nProfit_D = (60 - 0.06 * D2) * D2 * D_b2 + 60 * D1 * D_b1\n## create piecewise variables for piecewise function: Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=180)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=180, ub=1000)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(UnitsE == E1*E_b1 + E2*E_b2)\nProfit_E = (90 - 0.1 * E2) * E2 * E_b2 + 90 * E1 * E_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\nmodel.addCons(UnitsA >= 0.5 * UnitsB)\nmodel.addCons(10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region: North, South, East, West, and Central.\n// {\"number of trucks in North region\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck generates revenue based on the distance traveled and the load capacity. The revenue function is nonlinear due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions.\n// Revenue in North: R_N = 0.05 * N^2\n// Revenue in South: R_S = 0.06 * S^2\n// Revenue in East: R_E = 0.07 * E^2\n// Revenue in West: R_W = 0.08 * W^2\n// Revenue in Central: R_C = 0.09 * C^2\n// So, the objective function is: Maximize (R_N + R_S + R_E + R_W + R_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck maintenance and fuel costs.\n// 1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each region.\n// N >= 5; S >= 5; E >= 5; W >= 5; C >= 5\n\n## Generate Constraint-3:\nThe total number of trucks cannot exceed 100.\n// N + S + E + W + C <= 100\n\n## Generate Constraint-4:\nThe number of trucks in the North region must not exceed the combined number of trucks in the South and East regions.\n// N <= S + E",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region. Each truck generates revenue based on the distance traveled and the load capacity, with a nonlinear revenue function due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions. The company has a total budget of $500,000 for truck maintenance and fuel costs. The company must allocate at least 5 trucks to each region. The total number of trucks cannot exceed 100. The number of trucks in the North region must not exceed the combined number of trucks in the South and East regions. Please help the company determine the optimal allocation of trucks to maximize total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=5)  # number of trucks in North region\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5)  # number of trucks in South region\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5)  # number of trucks in East region\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=5)  # number of trucks in West region\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5)  # number of trucks in Central region\n\n# Define objective function\nR_N = 0.05 * N**2\nR_S = 0.06 * S**2\nR_E = 0.07 * E**2\nR_W = 0.08 * W**2\nR_C = 0.09 * C**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_N + R_S + R_E + R_W + R_C)\n\n# Add constraints\nmodel.addCons(1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000)\nmodel.addCons(N + S + E + W + C <= 100)\nmodel.addCons(N <= S + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(N))\n    print(\"Number of Trucks in South: \", model.getVal(S))\n    print(\"Number of Trucks in East: \", model.getVal(E))\n    print(\"Number of Trucks in West: \", model.getVal(W))\n    print(\"Number of Trucks in Central: \", model.getVal(C))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. The efficiency factors for each route are given in the following Table.\n\n| Route | Efficiency Factor |\n|-------|-------------------|\n| A     | 0.8               |\n| B     | 0.9               |\n| C     | 1.1               |\n| D     | 1.2               |\n| E     | 1.3               |\n\nThe company has a total of 100 trucks available for allocation. Please help the company to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200\n\n## Generate Constraint-3:\nThe company wants to produce at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15; E >= 15",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. The profit margin and production time for each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Production Time per Unit |\n|---------|------------------------|--------------------------|\n| A       | $5                     | 1 hour                   |\n| B       | $7                     | 2 hours                  |\n| C       | $9                     | 3 hours                  |\n| D       | $11                    | 4 hours                  |\n| E       | $13                    | 5 hours                  |\n\nThe company has a budget of $1500 for raw materials. The company has a production capacity of 200 hours. The company wants to produce at least 15 units of each product. \nPlease help the company to maximize the total profit per unit of time (profit rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 15 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=15) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4).\n// {\"number of TruckType1 in Region1\": \"Truck1_R1\", \"range\": \"Truck1_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region2\": \"Truck1_R2\", \"range\": \"Truck1_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region3\": \"Truck1_R3\", \"range\": \"Truck1_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region4\": \"Truck1_R4\", \"range\": \"Truck1_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region1\": \"Truck2_R1\", \"range\": \"Truck2_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region2\": \"Truck2_R2\", \"range\": \"Truck2_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region3\": \"Truck2_R3\", \"range\": \"Truck2_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region4\": \"Truck2_R4\", \"range\": \"Truck2_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region1\": \"Truck3_R1\", \"range\": \"Truck3_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region2\": \"Truck3_R2\", \"range\": \"Truck3_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region3\": \"Truck3_R3\", \"range\": \"Truck3_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region4\": \"Truck3_R4\", \"range\": \"Truck3_R4 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckType1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The profit function is nonlinear due to the interaction between the number of trucks and the upgrade costs.\n// Profit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\n// Profit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\n// Profit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\n// So, the objective function is: Maximize (Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all regions and types must not exceed 500.\n// Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4 + Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4 + Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4 <= 500\n\n## Generate Constraint-3:\nEach region must have at least 10 trucks of any type.\n// Truck1_R1 + Truck2_R1 + Truck3_R1 >= 10\n// Truck1_R2 + Truck2_R2 + Truck3_R2 >= 10\n// Truck1_R3 + Truck2_R3 + Truck3_R3 >= 10\n// Truck1_R4 + Truck2_R4 + Truck3_R4 >= 10\n\n## Generate Constraint-4:\nThe total fuel consumption across all trucks must not exceed 10,000 gallons per day, considering the fuel efficiency upgrades.\n// (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4) / (1 + 0.05 * Upgrade1) + (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4) / (1 + 0.05 * Upgrade2) + (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4) / (1 + 0.05 * Upgrade3) <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4). The company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The total budget for fuel efficiency upgrades is $100,000. The total number of trucks across all regions and types must not exceed 500. Each region must have at least 10 trucks of any type. The total fuel consumption across all trucks must not exceed 10,000 gallons per day, considering the fuel efficiency upgrades. Please help the company to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R1\", lb=0)\nTruck1_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R2\", lb=0)\nTruck1_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R3\", lb=0)\nTruck1_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R4\", lb=0)\nTruck2_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R1\", lb=0)\nTruck2_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R2\", lb=0)\nTruck2_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R3\", lb=0)\nTruck2_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R4\", lb=0)\nTruck3_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R1\", lb=0)\nTruck3_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R2\", lb=0)\nTruck3_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R3\", lb=0)\nTruck3_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R4\", lb=0)\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)\n\n# Define objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\nProfit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\nProfit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\nmodel.addCons(obj == Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 100000)\nmodel.addCons(Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4 + Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4 + Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4 <= 500)\nmodel.addCons(Truck1_R1 + Truck2_R1 + Truck3_R1 >= 10)\nmodel.addCons(Truck1_R2 + Truck2_R2 + Truck3_R2 >= 10)\nmodel.addCons(Truck1_R3 + Truck2_R3 + Truck3_R3 >= 10)\nmodel.addCons(Truck1_R4 + Truck2_R4 + Truck3_R4 >= 10)\nmodel.addCons((Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4) / (1 + 0.05 * Upgrade1) + (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4) / (1 + 0.05 * Upgrade2) + (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4) / (1 + 0.05 * Upgrade3) <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckType1 in Region1: \", model.getVal(Truck1_R1))\n    print(\"Number of TruckType1 in Region2: \", model.getVal(Truck1_R2))\n    print(\"Number of TruckType1 in Region3: \", model.getVal(Truck1_R3))\n    print(\"Number of TruckType1 in Region4: \", model.getVal(Truck1_R4))\n    print(\"Number of TruckType2 in Region1: \", model.getVal(Truck2_R1))\n    print(\"Number of TruckType2 in Region2: \", model.getVal(Truck2_R2))\n    print(\"Number of TruckType2 in Region3: \", model.getVal(Truck2_R3))\n    print(\"Number of TruckType2 in Region4: \", model.getVal(Truck2_R4))\n    print(\"Number of TruckType3 in Region1: \", model.getVal(Truck3_R1))\n    print(\"Number of TruckType3 in Region2: \", model.getVal(Truck3_R2))\n    print(\"Number of TruckType3 in Region3: \", model.getVal(Truck3_R3))\n    print(\"Number of TruckType3 in Region4: \", model.getVal(Truck3_R4))\n    print(\"Fuel efficiency upgrade for TruckType1: \", model.getVal(Upgrade1))\n    print(\"Fuel efficiency upgrade for TruckType2: \", model.getVal(Upgrade2))\n    print(\"Fuel efficiency upgrade for TruckType3: \", model.getVal(Upgrade3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. Additionally, the company needs to decide on the fuel consumption rate for each route, which is influenced by the number of trucks and the route's specific conditions.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for route 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel is a nonlinear function of the number of trucks and the fuel consumption rate. The company aims to minimize the total fuel cost across all routes. The fuel cost per route is given by the product of the number of trucks, the fuel consumption rate, and the average fuel price per liter.\n// Fuel cost for route 1: Cost1 = Trucks1 * Fuel1 * FuelPrice\n// Fuel cost for route 2: Cost2 = Trucks2 * Fuel2 * FuelPrice\n// Fuel cost for route 3: Cost3 = Trucks3 * Fuel3 * FuelPrice\n// Fuel cost for route 4: Cost4 = Trucks4 * Fuel4 * FuelPrice\n// Fuel cost for route 5: Cost5 = Trucks5 * Fuel5 * FuelPrice\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity of 30 trucks.\n// Trucks1 <= 30; Trucks2 <= 30; Trucks3 <= 30; Trucks4 <= 30; Trucks5 <= 30",
        "question": "A logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each route to optimize delivery efficiency and cost. The fuel consumption rate is influenced by the number of trucks and the route's specific conditions. The fuel cost per route is given by the product of the number of trucks, the fuel consumption rate, and the average fuel price per liter.\n\n| Route | Number of Trucks | Fuel Consumption Rate |\n|-------|------------------|-----------------------|\n| 1     | Trucks1          | Fuel1                 |\n| 2     | Trucks2          | Fuel2                 |\n| 3     | Trucks3          | Fuel3                 |\n| 4     | Trucks4          | Fuel4                 |\n| 5     | Trucks5          | Fuel5                 |\n\nThe total number of trucks available is 100. Each route has a maximum capacity of 30 trucks. The company aims to minimize the total fuel cost across all routes. Please help the company determine the optimal allocation of trucks and fuel consumption rates for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)\n\n# Define objective function\nFuelPrice = 1.5  # Assuming a constant fuel price per liter\nCost1 = Trucks1 * Fuel1 * FuelPrice\nCost2 = Trucks2 * Fuel2 * FuelPrice\nCost3 = Trucks3 * Fuel3 * FuelPrice\nCost4 = Trucks4 * Fuel4 * FuelPrice\nCost5 = Trucks5 * Fuel5 * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\nmodel.addCons(Trucks1 <= 30)\nmodel.addCons(Trucks2 <= 30)\nmodel.addCons(Trucks3 <= 30)\nmodel.addCons(Trucks4 <= 30)\nmodel.addCons(Trucks5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(Trucks5))\n    print(\"Fuel Consumption Rate for Route 1: \", model.getVal(Fuel1))\n    print(\"Fuel Consumption Rate for Route 2: \", model.getVal(Fuel2))\n    print(\"Fuel Consumption Rate for Route 3: \", model.getVal(Fuel3))\n    print(\"Fuel Consumption Rate for Route 4: \", model.getVal(Fuel4))\n    print(\"Fuel Consumption Rate for Route 5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy vehicles\": \"Heavy\", \"range\": \"Heavy >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized vehicles\": \"Specialized\", \"range\": \"Specialized >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for Small vehicles is $100, for Medium vehicles is $200, for Large vehicles is $300, for Heavy vehicles is $400, and for Specialized vehicles is $500. The company wants to minimize the total operational cost while ensuring the fleet can handle the required cargo volume.\n// Total operational cost: Cost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\n// The company also wants to consider the environmental impact, which is modeled as a quadratic function of the total operational cost: Environmental Impact = (Cost)^2\n// So, the objective function is: Minimize Environmental Impact + Cost\n\n## Generate Constraint-1:\nThe total cargo volume that needs to be transported is 10,000 cubic meters. Each Small vehicle can carry 100 cubic meters, each Medium vehicle can carry 200 cubic meters, each Large vehicle can carry 300 cubic meters, each Heavy vehicle can carry 400 cubic meters, and each Specialized vehicle can carry 500 cubic meters.\n// 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000",
        "question": "A logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities. The company needs to determine the number of each type of vehicle to deploy. The operational cost per day and cargo capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Cargo Capacity |\n|--------------|--------------------------|----------------|\n| Small        | $100                     | 100 cubic meters |\n| Medium       | $200                     | 200 cubic meters |\n| Large        | $300                     | 300 cubic meters |\n| Heavy        | $400                     | 400 cubic meters |\n| Specialized  | $500                     | 500 cubic meters |\n\nThe company wants to minimize the total operational cost while ensuring the fleet can handle the required cargo volume. The total cargo volume that needs to be transported is 10,000 cubic meters. The company also wants to consider the environmental impact, which is modeled as a quadratic function of the total operational cost. Please help the company to minimize the sum of the environmental impact and the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of Large vehicles\nHeavy = model.addVar(vtype=\"INTEGER\", name=\"Heavy\", lb=0) # number of Heavy vehicles\nSpecialized = model.addVar(vtype=\"INTEGER\", name=\"Specialized\", lb=0) # number of Specialized vehicles\n\n# Define objective function\n## Total operational cost: Cost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\nCost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\n## Environmental Impact = (Cost)^2\nEnvironmentalImpact = Cost**2\n## So, the objective function is: Minimize Environmental Impact + Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == EnvironmentalImpact + Cost)\n\n# Add constraints\n## The total cargo volume that needs to be transported is 10,000 cubic meters.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Heavy vehicles: \", model.getVal(Heavy))\n    print(\"Number of Specialized vehicles: \", model.getVal(Specialized))\n    print(\"Minimized Total Cost and Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAWorkers\", \"range\": \"ProductAWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBWorkers\", \"range\": \"ProductBWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCWorkers\", \"range\": \"ProductCWorkers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company wants to maximize the total daily profit.\n// Profit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\n// Profit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\n// Profit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductAQty >= 2 * ProductBQty\n\n## Generate Constraint-4:\nThe company has a budget constraint for the total labor cost, which should not exceed $10,000 per day.\n// 300 * ProductAWorkers + 300 * ProductBWorkers + 300 * ProductCWorkers <= 10,000\n\n## Generate Constraint-5:\nTo ensure balanced production, the number of workers assigned to ProductC should be at least half the number of workers assigned to ProductA.\n// ProductCWorkers >= 0.5 * ProductAWorkers",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company has a total of 50 workers available and a budget constraint for the total labor cost, which should not exceed $10,000 per day. The production capacity for each product is limited: ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. To ensure balanced production, the number of workers assigned to ProductC should be at least half the number of workers assigned to ProductA. The company wants to maximize the total daily profit. Please help the company optimize its production strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nProductAWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductAWorkers\", lb=0)  # number of workers for ProductA\nProductBWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductBWorkers\", lb=0)  # number of workers for ProductB\nProductCWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductCWorkers\", lb=0)  # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\nProfit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\nProfit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50)  # Total workers constraint\nmodel.addCons(ProductAQty <= 100)  # Production capacity constraint for ProductA\nmodel.addCons(ProductBQty <= 150)  # Production capacity constraint for ProductB\nmodel.addCons(ProductCQty <= 120)  # Production capacity constraint for ProductC\nmodel.addCons(ProductAQty >= 2 * ProductBQty)  # Market demand constraint\nmodel.addCons(300 * ProductAWorkers + 300 * ProductBWorkers + 300 * ProductCWorkers <= 10000)  # Budget constraint\nmodel.addCons(ProductCWorkers >= 0.5 * ProductAWorkers)  # Balanced production constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAWorkers))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBWorkers))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCWorkers))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 5 different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency while minimizing energy consumption.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different production rate and energy consumption rate per worker. The production rate (units per hour) and energy consumption (kWh per hour) are as follows:\n- Machine 1: 10 units/hour, 5 kWh/hour\n- Machine 2: 15 units/hour, 7 kWh/hour\n- Machine 3: 20 units/hour, 9 kWh/hour\n- Machine 4: 25 units/hour, 11 kWh/hour\n- Machine 5: 30 units/hour, 13 kWh/hour\nThe objective is to maximize the total production while keeping the total energy consumption below a certain threshold.\n// Total production: P = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Total energy consumption: E = 5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5\n// Objective function: Maximize P - (E^2 / 1000)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 50\n\n## Generate Constraint-2:\nEach machine can be operated by up to 10 workers at a time.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10",
        "question": "A manufacturing plant produces electronic components using 5 different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency while minimizing energy consumption. Each machine has a different production rate and energy consumption rate per worker:\n- Machine 1: 10 units/hour, 5 kWh/hour\n- Machine 2: 15 units/hour, 7 kWh/hour\n- Machine 3: 20 units/hour, 9 kWh/hour\n- Machine 4: 25 units/hour, 11 kWh/hour\n- Machine 5: 30 units/hour, 13 kWh/hour\nThe objective is to maximize the total production while keeping the total energy consumption below a certain threshold. There are a total of 50 workers available, and each machine can be operated by up to 10 workers at a time. Please help the plant manager to maximize the total production while minimizing the energy consumption, considering the constraint that the total energy consumption should be minimized by considering the square of the energy consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=10) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0, ub=10) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0, ub=10) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0, ub=10) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0, ub=10) # number of workers on machine 5\n\n# Define objective function\n## Total production: P = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n## Total energy consumption: E = 5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5\n## Objective function: Maximize P - (E^2 / 1000)\n## Convert the square term to a multiplication\nE_squared = model.addVar(name=\"E_squared\")\nmodel.addCons(E_squared == (5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5)**2)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 - E_squared / 1000)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 50)\n## Each machine can be operated by up to 10 workers at a time.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(M1))\n    print(\"Number of workers on machine 2: \", model.getVal(M2))\n    print(\"Number of workers on machine 3: \", model.getVal(M3))\n    print(\"Number of workers on machine 4: \", model.getVal(M4))\n    print(\"Number of workers on machine 5: \", model.getVal(M5))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"ProductA_Units\", \"range\": \"ProductA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB_Units\", \"range\": \"ProductB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC_Units\", \"range\": \"ProductC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD_Units\", \"range\": \"ProductD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $110. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.01 * ProductA_Units^2) * ProductA_Units\n// Profit_ProductB = (70 - 0.02 * ProductB_Units^2) * ProductB_Units\n// Profit_ProductC = (90 - 0.03 * ProductC_Units^2) * ProductC_Units\n// Profit_ProductD = (110 - 0.04 * ProductD_Units^2) * ProductD_Units\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductA_Units >= 2 * ProductB_Units\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $50,000. The cost of raw materials per unit for ProductA is $10, for ProductB is $20, for ProductC is $30, and for ProductD is $40.\n// 10 * ProductA_Units + 20 * ProductB_Units + 30 * ProductC_Units + 40 * ProductD_Units <= 50,000",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit |\n|---------|-----------------|----------------------------|\n| ProductA | $50 - 0.01 * (ProductA_Units^2) | $10 |\n| ProductB | $70 - 0.02 * (ProductB_Units^2) | $20 |\n| ProductC | $90 - 0.03 * (ProductC_Units^2) | $30 |\n| ProductD | $110 - 0.04 * (ProductD_Units^2) | $40 |\n\nThe company has a total production capacity of 1000 units for all products combined. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a budget constraint for raw materials, which is $50,000.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Units\", lb=0)\nProductB_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Units\", lb=0)\nProductC_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Units\", lb=0)\nProductD_Units = model.addVar(vtype=\"INTEGER\", name=\"ProductD_Units\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculations with quadratic cost\nProfit_ProductA = (50 - 0.01 * ProductA_Units**2) * ProductA_Units\nProfit_ProductB = (70 - 0.02 * ProductB_Units**2) * ProductB_Units\nProfit_ProductC = (90 - 0.03 * ProductC_Units**2) * ProductC_Units\nProfit_ProductD = (110 - 0.04 * ProductD_Units**2) * ProductD_Units\n\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(ProductA_Units + ProductB_Units + ProductC_Units + ProductD_Units <= 1000)\n\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductA_Units >= 2 * ProductB_Units)\n\n## The company has a budget constraint for raw materials, which is $50,000.\nmodel.addCons(10 * ProductA_Units + 20 * ProductB_Units + 30 * ProductC_Units + 40 * ProductD_Units <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductA_Units))\n    print(\"Number of ProductB Units: \", model.getVal(ProductB_Units))\n    print(\"Number of ProductC Units: \", model.getVal(ProductC_Units))\n    print(\"Number of ProductD Units: \", model.getVal(ProductD_Units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational requirements.\n// {\"number of Compact vehicles\": \"Compact\", \"range\": \"Compact >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan vehicles\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n// {\"number of SUV vehicles\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Truck vehicles\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per vehicle varies and is influenced by the number of vehicles of each type. For Compact, the base cost is $10,000, and it decreases by $0.001 for each additional Compact vehicle. For Sedan, the base cost is $15,000, and it decreases by $0.0015 for each additional Sedan vehicle. For SUV, the base cost is $20,000, and it decreases by $0.002 for each additional SUV vehicle. For Van, the base cost is $25,000, and it decreases by $0.0025 for each additional Van vehicle. For Truck, the base cost is $30,000, and it decreases by $0.003 for each additional Truck vehicle. The company wants to minimize the total operational cost of the fleet.\n// Cost_Compact = max(10000 - 0.001 * (Compact - 1), 10000) * Compact\n// Cost_Sedan = max(15000 - 0.0015 * (Sedan - 1), 15000) * Sedan\n// Cost_SUV = max(20000 - 0.002 * (SUV - 1), 20000) * SUV\n// Cost_Van = max(25000 - 0.0025 * (Van - 1), 25000) * Van\n// Cost_Truck = max(30000 - 0.003 * (Truck - 1), 30000) * Truck\n// So, the objective function is: Minimize Cost_Compact + Cost_Sedan + Cost_SUV + Cost_Van + Cost_Truck\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 to spend on vehicle operations.\n// (10000 - 0.001 * (Compact - 1)) * Compact + (15000 - 0.0015 * (Sedan - 1)) * Sedan + (20000 - 0.002 * (SUV - 1)) * SUV + (25000 - 0.0025 * (Van - 1)) * Van + (30000 - 0.003 * (Truck - 1)) * Truck <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 Compact vehicles and 5 of each of the other types.\n// Compact >= 10\n// Sedan >= 5\n// SUV >= 5\n// Van >= 5\n// Truck >= 5\n\n## Generate Constraint-3:\nThe total number of vehicles cannot exceed 100.\n// Compact + Sedan + SUV + Van + Truck <= 100",
        "question": "A logistics company operates a fleet of five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational requirements. The operational cost per vehicle varies and is influenced by the number of vehicles of each type. For Compact, the base cost is $10,000, and it decreases by $0.001 for each additional Compact vehicle. For Sedan, the base cost is $15,000, and it decreases by $0.0015 for each additional Sedan vehicle. For SUV, the base cost is $20,000, and it decreases by $0.002 for each additional SUV vehicle. For Van, the base cost is $25,000, and it decreases by $0.0025 for each additional Van vehicle. For Truck, the base cost is $30,000, and it decreases by $0.003 for each additional Truck vehicle. The company has a budget of $500,000 to spend on vehicle operations. The company must have at least 10 Compact vehicles and 5 of each of the other types. The total number of vehicles cannot exceed 100. Please help the company to minimize the total operational cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCompact = model.addVar(vtype=\"INTEGER\", name=\"Compact\", lb=0) # number of Compact vehicles\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0) # number of Sedan vehicles\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # number of SUV vehicles\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of Van vehicles\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0) # number of Truck vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_Compact = max(10000 - 0.001 * (Compact - 1), 10000) * Compact\nCompact1 = model.addVar(vtype=\"INTEGER\", name=\"Compact1\", lb=0, ub=1)\nCompact2 = model.addVar(vtype=\"INTEGER\", name=\"Compact2\", lb=1, ub=100000)\nCompact_b1 = model.addVar(vtype=\"B\", name=\"Compact_b1\")\nCompact_b2 = model.addVar(vtype=\"B\", name=\"Compact_b2\")\nmodel.addCons(Compact_b1 + Compact_b2 == 1)\nmodel.addCons(Compact == Compact1*Compact_b1 + Compact2*Compact_b2)\nCost_Compact = 10000 * Compact1 * Compact_b1 + (10000 - 0.001 * (Compact2 - 1)) * Compact2 * Compact_b2\n## create piecewise variables for piecewise function: Cost_Sedan = max(15000 - 0.0015 * (Sedan - 1), 15000) * Sedan\nSedan1 = model.addVar(vtype=\"INTEGER\", name=\"Sedan1\", lb=0, ub=1)\nSedan2 = model.addVar(vtype=\"INTEGER\", name=\"Sedan2\", lb=1, ub=100000)\nSedan_b1 = model.addVar(vtype=\"B\", name=\"Sedan_b1\")\nSedan_b2 = model.addVar(vtype=\"B\", name=\"Sedan_b2\")\nmodel.addCons(Sedan_b1 + Sedan_b2 == 1)\nmodel.addCons(Sedan == Sedan1*Sedan_b1 + Sedan2*Sedan_b2)\nCost_Sedan = 15000 * Sedan1 * Sedan_b1 + (15000 - 0.0015 * (Sedan2 - 1)) * Sedan2 * Sedan_b2\n## create piecewise variables for piecewise function: Cost_SUV = max(20000 - 0.002 * (SUV - 1), 20000) * SUV\nSUV1 = model.addVar(vtype=\"INTEGER\", name=\"SUV1\", lb=0, ub=1)\nSUV2 = model.addVar(vtype=\"INTEGER\", name=\"SUV2\", lb=1, ub=100000)\nSUV_b1 = model.addVar(vtype=\"B\", name=\"SUV_b1\")\nSUV_b2 = model.addVar(vtype=\"B\", name=\"SUV_b2\")\nmodel.addCons(SUV_b1 + SUV_b2 == 1)\nmodel.addCons(SUV == SUV1*SUV_b1 + SUV2*SUV_b2)\nCost_SUV = 20000 * SUV1 * SUV_b1 + (20000 - 0.002 * (SUV2 - 1)) * SUV2 * SUV_b2\n## create piecewise variables for piecewise function: Cost_Van = max(25000 - 0.0025 * (Van - 1), 25000) * Van\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0, ub=1)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=1, ub=100000)\nVan_b1 = model.addVar(vtype=\"B\", name=\"Van_b1\")\nVan_b2 = model.addVar(vtype=\"B\", name=\"Van_b2\")\nmodel.addCons(Van_b1 + Van_b2 == 1)\nmodel.addCons(Van == Van1*Van_b1 + Van2*Van_b2)\nCost_Van = 25000 * Van1 * Van_b1 + (25000 - 0.0025 * (Van2 - 1)) * Van2 * Van_b2\n## create piecewise variables for piecewise function: Cost_Truck = max(30000 - 0.003 * (Truck - 1), 30000) * Truck\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0, ub=1)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=1, ub=100000)\nTruck_b1 = model.addVar(vtype=\"B\", name=\"Truck_b1\")\nTruck_b2 = model.addVar(vtype=\"B\", name=\"Truck_b2\")\nmodel.addCons(Truck_b1 + Truck_b2 == 1)\nmodel.addCons(Truck == Truck1*Truck_b1 + Truck2*Truck_b2)\nCost_Truck = 30000 * Truck1 * Truck_b1 + (30000 - 0.003 * (Truck2 - 1)) * Truck2 * Truck_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_Compact + Cost_Sedan + Cost_SUV + Cost_Van + Cost_Truck\nmodel.addCons(obj == Cost_Compact + Cost_Sedan + Cost_SUV + Cost_Van + Cost_Truck)\n\n# Add constraints\nmodel.addCons((10000 - 0.001 * (Compact - 1)) * Compact + (15000 - 0.0015 * (Sedan - 1)) * Sedan + (20000 - 0.002 * (SUV - 1)) * SUV + (25000 - 0.0025 * (Van - 1)) * Van + (30000 - 0.003 * (Truck - 1)) * Truck <= 500000)\nmodel.addCons(Compact >= 10)\nmodel.addCons(Sedan >= 5)\nmodel.addCons(SUV >= 5)\nmodel.addCons(Van >= 5)\nmodel.addCons(Truck >= 5)\nmodel.addCons(Compact + Sedan + SUV + Van + Truck <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Compact vehicles: \", model.getVal(Compact))\n    print(\"Number of Sedan vehicles: \", model.getVal(Sedan))\n    print(\"Number of SUV vehicles: \", model.getVal(SUV))\n    print(\"Number of Van vehicles: \", model.getVal(Van))\n    print(\"Number of Truck vehicles: \", model.getVal(Truck))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour. However, the production of laptops incurs an additional maintenance cost of $50 per hour due to complex machinery. The objective is to maximize the total daily profit.\n// The objective function is: Maximize P = 100S + 150T + (200L - 50L) = 100S + 150T + 150L\n\n## Generate Constraint-1:\nThe total available production hours per day across all lines is 24 hours.\n// S + T + L <= 24\n\n## Generate Constraint-2:\nDue to labor regulations, the tablet production line cannot operate more than 10 hours a day.\n// T <= 10\n\n## Generate Constraint-3:\nThe demand for smartphones requires at least 5 hours of production per day.\n// S >= 5\n\n## Generate Constraint-4:\nThe company has a contract that requires the production of at least 3 laptops per day. Given that each laptop takes 2 hours to produce, the laptop production line must operate at least 6 hours per day.\n// L >= 6 / 2 = 3",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour, with an additional maintenance cost of $50 per hour for laptops. The company aims to maximize its daily profit. The total available production hours per day across all lines is 24 hours. Due to labor regulations, the tablet production line cannot operate more than 10 hours a day. The demand for smartphones requires at least 5 hours of production per day. The company has a contract that requires the production of at least 3 laptops per day, which takes 2 hours each to produce. Please help the company determine the optimal number of hours each production line should operate to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 100S + 150T + 150L\nmodel.addCons(obj == 100 * S + 150 * T + 150 * L)\n\n# Add constraints\n## The total available production hours per day across all lines is 24 hours.\nmodel.addCons(S + T + L <= 24)\n## Due to labor regulations, the tablet production line cannot operate more than 10 hours a day.\nmodel.addCons(T <= 10)\n## The demand for smartphones requires at least 5 hours of production per day.\nmodel.addCons(S >= 5)\n## The company has a contract that requires the production of at least 3 laptops per day. Given that each laptop takes 2 hours to produce, the laptop production line must operate at least 6 hours per day.\nmodel.addCons(L >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover.\n// {\"number of refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of dry goods trucks\": \"DryGoodsTrucks\", \"range\": \"DryGoodsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average daily distance for refrigerated trucks\": \"RefrigeratedDistance\", \"range\": \"RefrigeratedDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for dry goods trucks\": \"DryGoodsDistance\", \"range\": \"DryGoodsDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for hazardous material trucks\": \"HazardousDistance\", \"range\": \"HazardousDistance >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company wants to maximize the net profit from the fleet expansion.\n// OperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\n// OperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\n// OperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\n// Revenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\n// Revenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\n// Revenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n// So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for the initial purchase of new trucks.\n// RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000\n\n## Generate Constraint-2:\nThe total daily distance all trucks can cover is limited to 5000 miles.\n// RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// RefrigeratedTrucks >= 5\n// DryGoodsTrucks >= 5\n// HazardousTrucks >= 5\n\n## Generate Constraint-4:\nThe total number of trucks cannot exceed 20.\n// RefrigeratedTrucks + DryGoodsTrucks + HazardousTrucks <= 20\n\n## Generate Constraint-5:\nThe average daily distance for hazardous material trucks must not exceed 200 miles due to safety regulations.\n// HazardousDistance <= 200",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover. The cost of operating a truck and the revenue generated per mile for each type of truck are given in the following Table.\n\n| Type of Truck          | Operating Cost per Mile | Revenue per Mile |\n|------------------------|-------------------------|------------------|\n| Refrigerated Trucks    | $0.5                    | $1.2             |\n| Dry Goods Trucks       | $0.3                    | $0.8             |\n| Hazardous Material Trucks | $0.7                  | $1.5             |\n\nThe company has a budget of $10,000 for the initial purchase of new trucks. The total daily distance all trucks can cover is limited to 5000 miles. The company must have at least 5 trucks of each type. The total number of trucks cannot exceed 20. The average daily distance for hazardous material trucks must not exceed 200 miles due to safety regulations.\n\nPlease help the company to maximize the net profit from the fleet expansion, which is defined as the sum of the revenue generated by each type of truck minus the operating costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nDryGoodsTrucks = model.addVar(vtype=\"INTEGER\", name=\"DryGoodsTrucks\", lb=0)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)\nRefrigeratedDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"RefrigeratedDistance\", lb=0)\nDryGoodsDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DryGoodsDistance\", lb=0)\nHazardousDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousDistance\", lb=0)\n\n# Define objective function\nOperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\nOperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\nOperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\nRevenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\nRevenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\nRevenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n# So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous))\n\n# Add constraints\n# The company has a budget of $10,000 for the initial purchase of new trucks.\nmodel.addCons(RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000)\n# The total daily distance all trucks can cover is limited to 5000 miles.\nmodel.addCons(RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000)\n# The company must have at least 5 trucks of each type.\nmodel.addCons(RefrigeratedTrucks >= 5)\nmodel.addCons(DryGoodsTrucks >= 5)\nmodel.addCons(HazardousTrucks >= 5)\n# The total number of trucks cannot exceed 20.\nmodel.addCons(RefrigeratedTrucks + DryGoodsTrucks + HazardousTrucks <= 20)\n# The average daily distance for hazardous material trucks must not exceed 200 miles due to safety regulations.\nmodel.addCons(HazardousDistance <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Dry Goods Trucks: \", model.getVal(DryGoodsTrucks))\n    print(\"Number of Hazardous Material Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Average Daily Distance for Refrigerated Trucks: \", model.getVal(RefrigeratedDistance))\n    print(\"Average Daily Distance for Dry Goods Trucks: \", model.getVal(DryGoodsDistance))\n    print(\"Average Daily Distance for Hazardous Material Trucks: \", model.getVal(HazardousDistance))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Profit_A = (20 - 10) * A\n// Profit_B = (30 - 20) * B\n// Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 50 units, and for device B is at least 40 units.\n// A >= 50; B >= 40\n\n## Generate Constraint-3:\nThe company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit.\n// 5 * A + 10 * B + 15 * C <= 15000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\n// C <= A + B\n\n## Generate Constraint-5:\nThe company has a constraint on the total number of devices produced, which should not exceed 300 units.\n// A + B + C <= 300",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit, production cost per unit, and production time for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Production Time |\n|--------|-----------------|--------------------------|-----------------|\n| A      | $20             | $10                      | 2 hours         |\n| B      | $30             | $20                      | 3 hours         |\n| C      | $40             | $30                      | 4 hours         |\n\nThe company has a total production capacity of 1000 hours. The market demand for device A is at least 50 units, and for device B is at least 40 units. The company has a budget of $15000 for raw materials. The company wants to ensure that the production of device C does not exceed the combined production of devices A and B. The company also has a constraint on the total number of devices produced, which should not exceed 300 units.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n# The market demand for device A is at least 50 units, and for device B is at least 40 units.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 40)\n# The company has a budget of $15000 for raw materials\nmodel.addCons(5 * A + 10 * B + 15 * C <= 15000)\n# The company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\nmodel.addCons(C <= A + B)\n# The company has a constraint on the total number of devices produced, which should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n// SpecialTrucks >= 0.5 * LargeTrucks\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to Small and Medium packages combined.\n// SmallTrucks + MediumTrucks >= 10\n\n## Generate Constraint-4:\nThe demand for X-Large packages requires at least 5 trucks dedicated to them.\n// XL_Trucks >= 5",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting each package type per truck is given in the following Table.\n\n| Package Type | Cost per Truck |\n|--------------|----------------|\n| Small        | $1000          |\n| Medium       | $1500          |\n| Large        | $2000          |\n| X-Large      | $2500          |\n| Special      | $3000          |\n\nThe cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages. The company must ensure that at least 10 trucks are allocated to Small and Medium packages combined. The demand for X-Large packages requires at least 5 trucks dedicated to them.\n\nPlease help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=5)  # Constraint-4: XL_Trucks >= 5\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\n# Cost per truck decreases by $10 for every additional truck allocated to the same package type\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\n# Constraint-1: Total of 50 trucks available\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\n# Constraint-2: SpecialTrucks must be at least half of LargeTrucks\nmodel.addCons(SpecialTrucks >= 0.5 * LargeTrucks)\n# Constraint-3: At least 10 trucks for Small and Medium combined\nmodel.addCons(SmallTrucks + MediumTrucks >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of X-Large Trucks: \", model.getVal(XL_Trucks))\n    print(\"Number of Special Trucks: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n// Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000\n// where Cost_Small = $20000, Cost_Medium = $30000, Cost_Large = $40000\n\n## Generate Constraint-2:\nThe total capacity of the new trucks should not exceed 1000 tons.\n// Capacity_Small * SmallTrucks + Capacity_Medium * MediumTrucks + Capacity_Large * LargeTrucks <= 1000\n// where Capacity_Small = 10, Capacity_Medium = 20, Capacity_Large = 30\n\n## Generate Constraint-3:\nThe company must purchase at least 5 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks >= 5",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n\nThe company has a budget of $100,000 for purchasing new trucks. The total capacity of the new trucks should not exceed 1000 tons. The company must purchase at least 5 trucks in total.\n\nPlease help the company to maximize its daily net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nProfit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The total capacity of the new trucks should not exceed 1000 tons.\nmodel.addCons(10 * SmallTrucks + 20 * MediumTrucks + 30 * LargeTrucks <= 1000)\n## The company must purchase at least 5 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination.\n// {\"trips to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies with the destination due to distance and terrain. For D1, the fuel cost per trip is $100, for D2 it is $120, for D3 it is $140, for D4 it is $160, and for D5 it is $180. The company wants to minimize the total fuel cost while ensuring efficient service.\n// Fuel_Cost_D1 = 100 * T1\n// Fuel_Cost_D2 = 120 * T2\n// Fuel_Cost_D3 = 140 * T3\n// Fuel_Cost_D4 = 160 * T4\n// Fuel_Cost_D5 = 180 * T5\n// So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-2:\nEach truck can make a maximum of 50 trips in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company has a contractual obligation to make at least 10 trips to D3.\n// T3 >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination. The fuel cost per trip varies with the destination as shown in the following Table.\n\n| Destination | Fuel Cost per Trip |\n|-------------|--------------------|\n| D1          | $100               |\n| D2          | $120               |\n| D3          | $140               |\n| D4          | $160               |\n| D5          | $180               |\n\nThe company has a total budget of $10,000 for fuel costs. Each truck can make a maximum of 50 trips in total. The company has a contractual obligation to make at least 10 trips to D3. \nPlease help the company to minimize the total fuel cost while ensuring efficient service.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # trips to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips to D5\n\n# Define objective function\nFuel_Cost_D1 = 100 * T1\nFuel_Cost_D2 = 120 * T2\nFuel_Cost_D3 = 140 * T3\nFuel_Cost_D4 = 160 * T4\nFuel_Cost_D5 = 180 * T5\n# So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\n# Each truck can make a maximum of 50 trips in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(T1))\n    print(\"Trips to D2: \", model.getVal(T2))\n    print(\"Trips to D3: \", model.getVal(T3))\n    print(\"Trips to D4: \", model.getVal(T4))\n    print(\"Trips to D5: \", model.getVal(T5))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks dedicated to each region (Region1, Region2, Region3) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades are investments that reduce fuel consumption per kilometer, which directly impacts operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and depreciation based on the number of trucks and their fuel efficiency. The fuel cost per kilometer decreases by $0.02 for every $100 invested in fuel efficiency upgrades. The initial fuel cost per kilometer is $0.50 for all regions.\n// Total operational cost for Region1: Cost1 = (0.50 - 0.0002 * Efficiency1) * Trucks1\n// Total operational cost for Region2: Cost2 = (0.50 - 0.0002 * Efficiency2) * Trucks2\n// Total operational cost for Region3: Cost3 = (0.50 - 0.0002 * Efficiency3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck purchases and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all regions must not exceed 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 50 trucks in Region1 and 100 trucks in Region2.\n// Trucks1 >= 50; Trucks2 >= 100\n\n## Generate Constraint-4:\nThe fuel efficiency upgrades for each region must not exceed $20,000.\n// Efficiency1 <= 20000; Efficiency2 <= 20000; Efficiency3 <= 20000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks dedicated to each region (Region1, Region2, Region3) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades are investments that reduce fuel consumption per kilometer, which directly impacts operational costs. The company aims to minimize the total operational cost, which includes fuel costs and depreciation based on the number of trucks and their fuel efficiency. The fuel cost per kilometer decreases by $0.02 for every $100 invested in fuel efficiency upgrades. The initial fuel cost per kilometer is $0.50 for all regions.\n\nThe company has a total budget of $100,000 for truck purchases and fuel efficiency upgrades. The total number of trucks across all regions must not exceed 500. Due to contractual obligations, the company must operate at least 50 trucks in Region1 and 100 trucks in Region2. The fuel efficiency upgrades for each region must not exceed $20,000.\n\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Region3\n\n# Define objective function\nCost1 = (0.50 - 0.0002 * Efficiency1) * Trucks1\nCost2 = (0.50 - 0.0002 * Efficiency2) * Trucks2\nCost3 = (0.50 - 0.0002 * Efficiency3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 100)\nmodel.addCons(Efficiency1 <= 20000)\nmodel.addCons(Efficiency2 <= 20000)\nmodel.addCons(Efficiency3 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n// Efficiency of Trucks: E_T = 100 * T / 50\n// Efficiency of Vans: E_V = 50 * V / 30\n// Efficiency of Bikes: E_B = 10 * B / 10\n// So, the objective function is: Maximize (E_T + E_V + E_B)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 per day for operational costs.\n// 50 * T + 30 * V + 10 * B <= 1500\n\n## Generate Constraint-2:\nThe company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\n// 100 * T + 50 * V + 10 * B <= 2000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company has a minimum requirement of 5 Trucks and 10 Vans to maintain basic operational coverage.\n// T >= 5; V >= 10\n\n## Generate Constraint-5:\nThe company wants to limit the total number of vehicles to 50 to manage maintenance and operational complexity.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n\nThe company has a budget of $1500 per day for operational costs. The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company has a minimum requirement of 5 Trucks and 10 Vans to maintain basic operational coverage. The company wants to limit the total number of vehicles to 50 to manage maintenance and operational complexity.\n\nPlease help the company to maximize the total efficiency (defined as the sum of the delivery capacities divided by the sum of the operational costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=10) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE_T = 100 * T / 50\nE_V = 50 * V / 30\nE_B = 10 * B / 10\n## the objective function is: Maximize (E_T + E_V + E_B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * T + 30 * V + 10 * B) == 100 * T + 50 * V + 10 * B)\n\n# Add constraints\n## The company has a budget of $1500 per day for operational costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1500)\n## The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 2000)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company has a minimum requirement of 5 Trucks and 10 Vans to maintain basic operational coverage.\nmodel.addCons(T >= 5)\nmodel.addCons(V >= 10)\n## The company wants to limit the total number of vehicles to 50 to manage maintenance and operational complexity.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TypeA trucks\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeB trucks\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeC trucks\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck type decreases with the investment in fuel efficiency technologies. The fuel consumption reduction is nonlinear, with diminishing returns as more investment is made. The initial fuel consumption for TypeA trucks is 50 liters per 100 km, for TypeB trucks is 60 liters per 100 km, and for TypeC trucks is 70 liters per 100 km. For every $1000 invested in efficiency, TypeA trucks reduce consumption by 1 liter per 100 km, TypeB by 1.5 liters per 100 km, and TypeC by 2 liters per 100 km. The company aims to minimize the total fuel consumption across all truck types.\n// Fuel consumption for TypeA: ConsumptionA = 50 - 0.001 * EfficiencyA\n// Fuel consumption for TypeB: ConsumptionB = 60 - 0.0015 * EfficiencyB\n// Fuel consumption for TypeC: ConsumptionC = 70 - 0.002 * EfficiencyC\n// Total fuel consumption: TotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n// So, the objective function is: Minimize TotalConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments.\n// TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 500.\n// TrucksA + TrucksB + TrucksC <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs.\nThe fuel consumption of each truck type decreases with the investment in fuel efficiency technologies. The fuel consumption reduction is nonlinear, with diminishing returns as more investment is made. The initial fuel consumption for TypeA trucks is 50 liters per 100 km, for TypeB trucks is 60 liters per 100 km, and for TypeC trucks is 70 liters per 100 km. For every $1000 invested in efficiency, TypeA trucks reduce consumption by 1 liter per 100 km, TypeB by 1.5 liters per 100 km, and TypeC by 2 liters per 100 km. The company aims to minimize the total fuel consumption across all truck types.\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 500.\nPlease help the company to minimize the total fuel consumption across all truck types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of TypeC trucks\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for TypeA trucks\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for TypeB trucks\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for TypeC trucks\n\n# Define objective function\nConsumptionA = 50 - 0.001 * EfficiencyA\nConsumptionB = 60 - 0.0015 * EfficiencyB\nConsumptionC = 70 - 0.002 * EfficiencyC\nTotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalConsumption)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Investment in Efficiency for TypeA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for TypeB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for TypeC: \", model.getVal(EfficiencyC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1266,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good to optimize delivery efficiency. Additionally, the company is considering investing in a new fleet management system that can reduce the operational costs per truck, depending on the level of investment.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system for GoodsX\": \"FleetX\", \"range\": \"FleetX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsY\": \"FleetY\", \"range\": \"FleetY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsZ\": \"FleetZ\", \"range\": \"FleetZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for GoodsX: CostX = (1000 - 0.1 * FleetX) * TrucksX\n// Total operational cost for GoodsY: CostY = (1200 - 0.12 * FleetY) * TrucksY\n// Total operational cost for GoodsZ: CostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and fleet management system investments.\n// (1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 500.\n// TrucksX + TrucksY + TrucksZ <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 50 trucks for GoodsX and 100 trucks for GoodsY.\n// TrucksX >= 50; TrucksY >= 100\n\n## Generate Constraint-4:\nThe investment in the fleet management system for each type of good cannot exceed $10,000.\n// FleetX <= 10000; FleetY <= 10000; FleetZ <= 10000",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the level of investment in a new fleet management system to optimize delivery efficiency. The operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n\nThe company has a total budget of $100,000 for truck operations and fleet management system investments. The total number of trucks available for distribution is limited to 500. Due to contractual obligations, the company must allocate at least 50 trucks for GoodsX and 100 trucks for GoodsY. The investment in the fleet management system for each type of good cannot exceed $10,000.\n\nPlease help the company to minimize the total operational cost of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=50)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=100)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFleetX = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetX\", lb=0)  # investment in fleet management system for GoodsX\nFleetY = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetY\", lb=0)  # investment in fleet management system for GoodsY\nFleetZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetZ\", lb=0)  # investment in fleet management system for GoodsZ\n\n# Define objective function\nCostX = (1000 - 0.1 * FleetX) * TrucksX\nCostY = (1200 - 0.12 * FleetY) * TrucksY\nCostZ = (1500 - 0.15 * FleetZ) * TrucksZ\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons((1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000)\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\nmodel.addCons(TrucksX >= 50)\nmodel.addCons(TrucksY >= 100)\nmodel.addCons(FleetX <= 10000)\nmodel.addCons(FleetY <= 10000)\nmodel.addCons(FleetZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Investment in FleetX: \", model.getVal(FleetX))\n    print(\"Investment in FleetY: \", model.getVal(FleetY))\n    print(\"Investment in FleetZ: \", model.getVal(FleetZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles.\n// Annual operating cost for TruckA: CostA = 10000 - 0.2 * EfficiencyA\n// Annual operating cost for TruckB: CostB = 15000 - 0.3 * EfficiencyB\n// Annual operating cost for TruckC: CostC = 20000 - 0.4 * EfficiencyC\n// So, the objective function is: Minimize (CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year and decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle. The operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades as shown in the following Table.\n\n| Vehicle Type | Initial Operating Cost | Cost Reduction per $1,000 Investment |\n|--------------|------------------------|--------------------------------------|\n| TruckA       | $10,000                | $200 per year                        |\n| TruckB       | $15,000                | $300 per year                        |\n| TruckC       | $20,000                | $400 per year                        |\n\nThe company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades. The company aims to minimize the total annual operating cost of all vehicles. Please help the company determine the optimal number of each type of vehicle to purchase and the appropriate level of fuel efficiency upgrades to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # fuel efficiency upgrade for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # fuel efficiency upgrade for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # fuel efficiency upgrade for TruckC\n\n# Define objective function\nCostA = 10000 - 0.2 * EfficiencyA\nCostB = 15000 - 0.3 * EfficiencyB\nCostC = 20000 - 0.4 * EfficiencyC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == (CostA * TruckA + CostB * TruckB + CostC * TruckC))\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Efficiency Upgrade for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Efficiency Upgrade for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Efficiency Upgrade for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1206,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location A, Location B, Location C, Location D, and Location E) for installation.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local weather conditions. The efficiency of wind turbines also varies based on wind patterns. The company wants to maximize the total energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe objective is to maximize the total daily energy output while minimizing the total cost of installation.\n// Total energy output: Energy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\n// Total cost: Cost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on renewable energy installations.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE >= 25000\n\n## Generate Constraint-3:\nThe company wants to install at least 20 solar panels in total.\n// SolarA + SolarB + SolarC >= 20",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations: Location A, Location B, Location C, Location D, and Location E. The company wants to maximize the total daily energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe company has a budget of $50,000 for the installation. The company wants to ensure that at least 50% of the budget is spent on renewable energy installations. The company also wants to install at least 20 solar panels in total.\nPlease help the company to maximize the total daily energy output while minimizing the total cost of installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Location E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\nCost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n## the objective function is: Maximize Energy - Cost\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000)\n## The company wants to ensure that at least 50% of the budget is spent on renewable energy installations.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE >= 25000)\n## The company wants to install at least 20 solar panels in total.\nmodel.addCons(SolarA + SolarB + SolarC >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost, sales price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, the sales price is $100, and the demand is 500 units. For ProductB, the production cost is $70, the sales price is $120, and the demand is 300 units. For ProductC, the production cost is $80, the sales price is $150, and the demand is 200 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\n// Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\n// Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 800 units in total.\n// UnitsA + UnitsB + UnitsC <= 800\n\n## Generate Constraint-2:\nDue to resource allocation, the production of ProductA must be at least twice the production of ProductB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost per unit of ProductA is $50, the sales price is $100, and the demand is 500 units. For ProductB, the production cost is $70, the sales price is $120, and the demand is 300 units. For ProductC, the production cost is $80, the sales price is $150, and the demand is 200 units. The company has a monthly production capacity of 800 units in total. Due to resource allocation, the production of ProductA must be at least twice the production of ProductB. The company has a budget of $50,000 for raw materials per month. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\nUnitsA_over = model.addVar(vtype=\"INTEGER\", name=\"UnitsA_over\", lb=0)\nmodel.addCons(UnitsA_over >= UnitsA - 500)\nProfit_A = (100 - 50) * UnitsA - 10 * UnitsA_over\n## Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\nUnitsB_over = model.addVar(vtype=\"INTEGER\", name=\"UnitsB_over\", lb=0)\nmodel.addCons(UnitsB_over >= UnitsB - 300)\nProfit_B = (120 - 70) * UnitsB - 20 * UnitsB_over\n## Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\nUnitsC_over = model.addVar(vtype=\"INTEGER\", name=\"UnitsC_over\", lb=0)\nmodel.addCons(UnitsC_over >= UnitsC - 200)\nProfit_C = (150 - 80) * UnitsC - 30 * UnitsC_over\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a monthly production capacity of 800 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 800)\n## Due to resource allocation, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget of $50,000 for raw materials per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of hours each machine will operate for each product, and the investment in maintenance to optimize machine efficiency. The efficiency of each machine increases by 1% for every $1,000 invested in maintenance. The company aims to maximize its total revenue while considering the costs of production and maintenance.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"integer\"}\n// {\"investment in maintenance for ProductA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for ProductB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for ProductC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by 0.1% for every $1,000 invested in maintenance. The initial cost of production per unit for ProductA is $70, for ProductB is $80, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 70 + 0.0001 * MaintenanceA) * QuantityA * HoursA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.0001 * MaintenanceB) * QuantityB * HoursB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * MaintenanceC) * QuantityC * HoursC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total machine hours available for all products cannot exceed 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe total investment in maintenance cannot exceed $50,000.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 50000\n\n## Generate Constraint-3:\nDue to operational constraints, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 hours are allocated to ProductA and 200 hours to ProductB.\n// HoursA >= 100; HoursB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of hours each machine will operate for each product, and the investment in maintenance to optimize machine efficiency. The efficiency of each machine increases by 1% for every $1,000 invested in maintenance. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by 0.1% for every $1,000 invested in maintenance. The initial cost of production per unit for ProductA is $70, for ProductB is $80, and for ProductC is $90. The company aims to maximize the total profit from all products.\n\nThe total machine hours available for all products cannot exceed 1000 hours. The total investment in maintenance cannot exceed $50,000. Due to operational constraints, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 100 hours are allocated to ProductA and 200 hours to ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)  # production quantity of ProductC\nHoursA = model.addVar(vtype=\"INTEGER\", name=\"HoursA\", lb=0)  # machine hours for ProductA\nHoursB = model.addVar(vtype=\"INTEGER\", name=\"HoursB\", lb=0)  # machine hours for ProductB\nHoursC = model.addVar(vtype=\"INTEGER\", name=\"HoursC\", lb=0)  # machine hours for ProductC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # investment in maintenance for ProductA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # investment in maintenance for ProductB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # investment in maintenance for ProductC\n\n# Define objective function\nProfitA = (100 - 70 + 0.0001 * MaintenanceA) * QuantityA * HoursA\nProfitB = (150 - 80 + 0.0001 * MaintenanceB) * QuantityB * HoursB\nProfitC = (200 - 90 + 0.0001 * MaintenanceC) * QuantityC * HoursC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 50000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\nmodel.addCons(HoursA >= 100)\nmodel.addCons(HoursB >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Machine Hours for ProductA: \", model.getVal(HoursA))\n    print(\"Machine Hours for ProductB: \", model.getVal(HoursB))\n    print(\"Machine Hours for ProductC: \", model.getVal(HoursC))\n    print(\"Investment in Maintenance for ProductA: \", model.getVal(MaintenanceA))\n    print(\"Investment in Maintenance for ProductB: \", model.getVal(MaintenanceB))\n    print(\"Investment in Maintenance for ProductC: \", model.getVal(MaintenanceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology to reduce labor costs. The labor cost per hour decreases by $5 for every $100,000 invested in automation. The company also needs to determine the marketing budget for each product to increase sales.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per hour for ProductA is $30, for ProductB is $40, and for ProductC is $50. The sales revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales revenue by $10 per unit for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.01 * MarketingA - (30 - 0.00005 * Automation) * LaborA) * QuantityA\n// Total profit for ProductB: ProfitB = (150 + 0.01 * MarketingB - (40 - 0.00005 * Automation) * LaborB) * QuantityB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * MarketingC - (50 - 0.00005 * Automation) * LaborC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total labor hours available for the month are 10,000 hours.\n// LaborA + LaborB + LaborC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $500,000.\n// Automation <= 500000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology to reduce labor costs. The labor cost per hour decreases by $5 for every $100,000 invested in automation. The company also needs to determine the marketing budget for each product to increase sales. The labor cost per hour, sales revenue per unit, and the effect of marketing budget on sales revenue are given in the following Table.\n\n| Product | Labor Cost per Hour | Sales Revenue per Unit | Effect of Marketing Budget on Sales Revenue |\n|---------|---------------------|------------------------|--------------------------------------------|\n| ProductA | $30 | $100 | $10 per $1,000 spent |\n| ProductB | $40 | $150 | $10 per $1,000 spent |\n| ProductC | $50 | $200 | $10 per $1,000 spent |\n\nThe company aims to maximize the total profit from all products. The total labor hours available for the month are 10,000 hours. The total investment in automation cannot exceed $500,000. Please help the company determine the optimal production quantity, labor hours, investment in automation, and marketing budget for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nLaborA = model.addVar(vtype=\"INTEGER\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"INTEGER\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"INTEGER\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (100 + 0.01 * MarketingA - (30 - 0.00005 * Automation) * LaborA) * QuantityA\nProfitB = (150 + 0.01 * MarketingB - (40 - 0.00005 * Automation) * LaborB) * QuantityB\nProfitC = (200 + 0.01 * MarketingC - (50 - 0.00005 * Automation) * LaborC) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 10000)\nmodel.addCons(Automation <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line.\n// {\"number of production lines for DeviceA\": \"LineA\", \"range\": \"LineA >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceB\": \"LineB\", \"range\": \"LineB >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceC\": \"LineC\", \"range\": \"LineC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceA lines\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceB lines\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceC lines\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost per production line per shift is $1000 for DeviceA, $1200 for DeviceB, and $1500 for DeviceC. The company aims to maximize its total daily profit.\n// Total daily profit for DeviceA: ProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\n// Total daily profit for DeviceB: ProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\n// Total daily profit for DeviceC: ProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10 production lines available.\n// LineA + LineB + LineC <= 10\n\n## Generate Constraint-2:\nEach production line can operate up to 3 shifts per day.\n// ShiftA <= 3; ShiftB <= 3; ShiftC <= 3",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line. The profit per unit and the cost per production line per shift for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Line per Shift |\n|--------|-----------------|-------------------------|\n| DeviceA | $50             | $1000                   |\n| DeviceB | $70             | $1200                   |\n| DeviceC | $90             | $1500                   |\n\nThe company has a total of 10 production lines available. Each production line can operate up to 3 shifts per day. The company aims to maximize its total daily profit. Please help the company determine the optimal allocation of production lines and shifts to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLineA = model.addVar(vtype=\"INTEGER\", name=\"LineA\", lb=0) # number of production lines for DeviceA\nLineB = model.addVar(vtype=\"INTEGER\", name=\"LineB\", lb=0) # number of production lines for DeviceB\nLineC = model.addVar(vtype=\"INTEGER\", name=\"LineC\", lb=0) # number of production lines for DeviceC\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0, ub=3) # number of shifts per day for DeviceA lines\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0, ub=3) # number of shifts per day for DeviceB lines\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0, ub=3) # number of shifts per day for DeviceC lines\n\n# Define objective function\nProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\nProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\nProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LineA + LineB + LineC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of production lines for DeviceA: \", model.getVal(LineA))\n    print(\"Number of production lines for DeviceB: \", model.getVal(LineB))\n    print(\"Number of production lines for DeviceC: \", model.getVal(LineC))\n    print(\"Number of shifts per day for DeviceA lines: \", model.getVal(ShiftA))\n    print(\"Number of shifts per day for DeviceB lines: \", model.getVal(ShiftB))\n    print(\"Number of shifts per day for DeviceC lines: \", model.getVal(ShiftC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip decreases by $2 for every $100 invested in upgrades. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips.\n// Operational cost for Truck1: Cost1 = (100 - 0.02 * Upgrade1) * Trips1\n// Operational cost for Truck2: Cost2 = (120 - 0.02 * Upgrade2) * Trips2\n// Operational cost for Truck3: Cost3 = (110 - 0.02 * Upgrade3) * Trips3\n// Operational cost for Truck4: Cost4 = (90 - 0.02 * Upgrade4) * Trips4\n// Operational cost for Truck5: Cost5 = (130 - 0.02 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for both trip operations and upgrades.\n// (100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000",
        "question": "A logistics company is planning its routes for the next quarter and needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip. The fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip by $2 for every $100 invested. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips. The company has a budget of $20,000 for both trip operations and upgrades.\n\nPlease help the company determine the optimal number of trips for each truck and the amount to invest in fuel-efficient upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Truck5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in fuel-efficient upgrades for Truck3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in fuel-efficient upgrades for Truck4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in fuel-efficient upgrades for Truck5\n\n# Define objective function\nCost1 = (100 - 0.02 * Upgrade1) * Trips1\nCost2 = (120 - 0.02 * Upgrade2) * Trips2\nCost3 = (110 - 0.02 * Upgrade3) * Trips3\nCost4 = (90 - 0.02 * Upgrade4) * Trips4\nCost5 = (130 - 0.02 * Upgrade5) * Trips5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a budget of $20,000 for both trip operations and upgrades.\nmodel.addCons((100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + \n              (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + \n              (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Truck5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrades for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrades for Truck4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrades for Truck5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $60.\n// PriceA >= 60; PriceB >= 60; PriceC >= 60",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products. The total production capacity of the company is 5000 units. The total marketing budget is $50,000. The price of each product must be at least $60.\nPlease help the company to determine the optimal production quantity, selling price, and marketing investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=60)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=60)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=60)  # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company needs to deliver at least 5000 kg of goods per day. Each Small truck can carry 500 kg, each Medium truck can carry 1000 kg, each Large truck can carry 1500 kg, each Extra-Large truck can carry 2000 kg, and each Refrigerated truck can carry 1000 kg. The company aims to minimize the total daily operational cost, considering the distance traveled by each type of truck.\n// Total_Cost = 2 * S * D_S + 3 * M * D_M + 4 * L * D_L + 5 * XL * D_XL + 6 * R * D_R\n// where D_S, D_M, D_L, D_XL, D_R are the distances traveled by each type of truck.\n// The objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements. The operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. Each Small truck can carry 500 kg, each Medium truck can carry 1000 kg, each Large truck can carry 1500 kg, each Extra-Large truck can carry 2000 kg, and each Refrigerated truck can carry 1000 kg. The company needs to deliver at least 5000 kg of goods per day. The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg. Please help the company to minimize the total daily operational cost, considering the distance traveled by each type of truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize Total_Cost\n## Assuming all trucks travel the same distance for simplicity\nD = model.addVar(name=\"D\") # distance traveled by each truck\nTotal_Cost = 2 * S * D + 3 * M * D + 4 * L * D + 5 * XL * D + 6 * R * D\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe production capacity of DeviceA is limited to 2000 units.\n// UnitsA <= 2000\n\n## Generate Constraint-3:\nThe production capacity of DeviceB is limited to 1500 units.\n// UnitsB <= 1500\n\n## Generate Constraint-4:\nThe production capacity of DeviceC is limited to 1000 units.\n// UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2. The company aims to maximize the total profit.\nThe total available hours for all production lines is 1000 hours. The production capacity of DeviceA is limited to 2000 units. The production capacity of DeviceB is limited to 1500 units. The production capacity of DeviceC is limited to 1000 units.\nPlease help the company determine the optimal number of units and hours to allocate to each device to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours allocated to DeviceC production line\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (30 * HoursA)\nProfit_B = (70 * UnitsB) - (40 * HoursB)\nProfit_C = (90 * UnitsC) - (50 * HoursC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\nmodel.addCons(UnitsA <= 2000)\nmodel.addCons(UnitsB <= 1500)\nmodel.addCons(UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type, which will affect the fuel consumption and operational costs.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Truck1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel_Consumption_Truck1 = (Initial_Consumption - 0.0001 * Tech1) * Distance_Per_Trip * Trips1\n// Fuel_Consumption_Truck2 = (Initial_Consumption - 0.0002 * Tech2) * Distance_Per_Trip * Trips2\n// Fuel_Consumption_Truck3 = (Initial_Consumption - 0.0003 * Tech3) * Distance_Per_Trip * Trips3\n// So, the objective function is: Minimize (Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make and the amount to invest in fuel-efficient technologies for each vehicle type to optimize its operations. The fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles. The company has a budget of $100,000 for investments in fuel-efficient technologies. The total number of trips across all vehicles must not exceed 500. Please help the company determine the optimal number of trips and investments to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Truck1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Truck2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for Truck3\n\n# Define objective function\nFuel_Consumption_Truck1 = (model.addVar(name=\"Initial_Consumption\") - 0.0001 * Tech1) * model.addVar(name=\"Distance_Per_Trip\") * Trips1\nFuel_Consumption_Truck2 = (model.addVar(name=\"Initial_Consumption\") - 0.0002 * Tech2) * model.addVar(name=\"Distance_Per_Trip\") * Trips2\nFuel_Consumption_Truck3 = (model.addVar(name=\"Initial_Consumption\") - 0.0003 * Tech3) * model.addVar(name=\"Distance_Per_Trip\") * Trips3\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 <= 100000)  # The company has a budget of $100,000 for investments in fuel-efficient technologies.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)  # The total number of trips across all vehicles must not exceed 500.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Tech for Truck1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Truck2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Truck3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company wants to ensure that each device has at least 100 units produced.\n// DeviceAProduction >= 100; DeviceBProduction >= 100; DeviceCProduction >= 100; DeviceDProduction >= 100; DeviceEProduction >= 100\n\n## Generate Constraint-5:\nThe production of DeviceC cannot exceed 20% of the total production.\n// DeviceCProduction <= 0.2 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $500,000 for raw materials. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35. To ensure market presence, the company wants to ensure that each device has at least 100 units produced. The production of DeviceC cannot exceed 20% of the total production. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=100)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=100)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=100)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=100)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=100)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\nmodel.addCons(DeviceCProduction <= 0.2 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for material costs for the next quarter.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each component in the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company has a maximum of 400 hours available for production in the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each component are given in the following Table.\n\n| Component | Selling Price | Material Cost | Production Time |\n|-----------|---------------|---------------|-----------------|\n| A         | 20$           | 10$           | 1 hour          |\n| B         | 25$           | 12$           | 2 hours         |\n| C         | 30$           | 15$           | 3 hours         |\n| D         | 35$           | 18$           | 4 hours         |\n| E         | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $2000 for material costs for the next quarter. The company wants to produce at least 20 units of each component in the next quarter. The company has a maximum of 400 hours available for production in the next quarter. The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D. \nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each component in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $2000 for material costs for the next quarter.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000)\n## The company has a maximum of 400 hours available for production in the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n## The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 1\": \"DistanceRegion1\", \"range\": \"DistanceRegion1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 2\": \"DistanceRegion2\", \"range\": \"DistanceRegion2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions. The fuel consumption is calculated based on the number of trucks, their fuel efficiency, and the distance they travel.\n// FuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\n// FuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n// So, the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\n// DistanceRegion1 + DistanceRegion2 <= 1000\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\n// FuelEfficiency1 >= 1.1 * FuelEfficiency2\n\n## Generate Constraint-4:\nThe demand for transportation in Region 1 requires at least 20 trucks.\n// TrucksRegion1 >= 20",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region.\nThe company aims to minimize the total fuel consumption across all regions. The fuel consumption is calculated based on the number of trucks, their fuel efficiency, and the distance they travel.\nThe total number of trucks available in the fleet is limited to 50. The total distance that can be covered by the trucks in a day is limited to 1000 kilometers. The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2. The demand for transportation in Region 1 requires at least 20 trucks.\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=20)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nDistanceRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion1\", lb=0)  # distance traveled by trucks in Region 1\nDistanceRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion2\", lb=0)  # distance traveled by trucks in Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\nFuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n## the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n## convert the division to multiplication\nmodel.addCons(obj == FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\nmodel.addCons(DistanceRegion1 + DistanceRegion2 <= 1000)\n## The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\nmodel.addCons(FuelEfficiency1 >= 1.1 * FuelEfficiency2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Distance Traveled by Trucks in Region 1: \", model.getVal(DistanceRegion1))\n    print(\"Distance Traveled by Trucks in Region 2: \", model.getVal(DistanceRegion2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Residential\": \"ResidentialStorage\", \"range\": \"ResidentialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Commercial\": \"CommercialStorage\", \"range\": \"CommercialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Industrial\": \"IndustrialStorage\", \"range\": \"IndustrialStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling energy is affected by the amount of energy storage. For Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms.\n// Total revenue for Residential: Revenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\n// Total revenue for Commercial: Revenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\n// Total revenue for Industrial: Revenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n// So, the objective function is: Maximize (Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for solar panel installations and energy storage investments.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold. The revenue from selling energy is affected by the amount of energy storage. For Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms.\n\n| Farm Type       | Revenue per Panel | Storage Impact per $1000 |\n|-----------------|-------------------|--------------------------|\n| Residential     | $200              | $50                      |\n| Commercial      | $300              | $75                      |\n| Industrial      | $500              | $100                     |\n\nThe company has a total budget of $1,000,000 for solar panel installations and energy storage investments. Please help the company to maximize the total annual revenue from all solar farms.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nResidentialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"ResidentialStorage\", lb=0)\nCommercialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialStorage\", lb=0)\nIndustrialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"IndustrialStorage\", lb=0)\n\n# Define objective function\nRevenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\nRevenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\nRevenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Investment in Residential Storage: \", model.getVal(ResidentialStorage))\n    print(\"Investment in Commercial Storage: \", model.getVal(CommercialStorage))\n    print(\"Investment in Industrial Storage: \", model.getVal(IndustrialStorage))\n    print(\"Total Annual Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1482,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in region 1\": \"FE1\", \"range\": \"FE1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 2\": \"FE2\", \"range\": \"FE2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 3\": \"FE3\", \"range\": \"FE3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 4\": \"FE4\", \"range\": \"FE4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 5\": \"FE5\", \"range\": \"FE5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n// Total fuel cost for region 1: Cost1 = (3.50 * (D / FE1)) * T1\n// Total fuel cost for region 2: Cost2 = (3.50 * (D / FE2)) * T2\n// Total fuel cost for region 3: Cost3 = (3.50 * (D / FE3)) * T3\n// Total fuel cost for region 4: Cost4 = (3.50 * (D / FE4)) * T4\n// Total fuel cost for region 5: Cost5 = (3.50 * (D / FE5)) * T5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe fuel efficiency of trucks in each region must be at least 10 miles per gallon.\n// FE1 >= 10; FE2 >= 10; FE3 >= 10; FE4 >= 10; FE5 >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region. The company aims to minimize the total fuel cost across all regions, where the cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n\n| Region | Number of Trucks | Fuel Efficiency |\n|--------|------------------|-----------------|\n| 1      | T1               | FE1             |\n| 2      | T2               | FE2             |\n| 3      | T3               | FE3             |\n| 4      | T4               | FE4             |\n| 5      | T5               | FE5             |\n\nThe company has a total of 100 trucks available. The fuel efficiency of trucks in each region must be at least 10 miles per gallon.\n\nPlease help the company to determine the optimal number of trucks to allocate to each region and the minimum fuel efficiency required to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks in region 5\nFE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE1\", lb=10) # fuel efficiency of trucks in region 1\nFE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE2\", lb=10) # fuel efficiency of trucks in region 2\nFE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE3\", lb=10) # fuel efficiency of trucks in region 3\nFE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE4\", lb=10) # fuel efficiency of trucks in region 4\nFE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE5\", lb=10) # fuel efficiency of trucks in region 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\") # distance each truck travels, assumed constant for simplicity\nCost1 = 3.50 * (D / FE1) * T1\nCost2 = 3.50 * (D / FE2) * T2\nCost3 = 3.50 * (D / FE3) * T3\nCost4 = 3.50 * (D / FE4) * T4\nCost5 = 3.50 * (D / FE5) * T5\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Fuel Efficiency in Region 1: \", model.getVal(FE1))\n    print(\"Fuel Efficiency in Region 2: \", model.getVal(FE2))\n    print(\"Fuel Efficiency in Region 3: \", model.getVal(FE3))\n    print(\"Fuel Efficiency in Region 4: \", model.getVal(FE4))\n    print(\"Fuel Efficiency in Region 5: \", model.getVal(FE5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes.\n// Cost per hour for route A: Cost_A = 2 * A * 60\n// Cost per hour for route B: Cost_B = 3 * B * 50\n// Cost per hour for route C: Cost_C = 4 * C * 40\n// Cost per hour for route D: Cost_D = 5 * D * 30\n// Cost per hour for route E: Cost_E = 6 * E * 20\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for all routes.\n// 2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks available is 50.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe number of trucks on route D must not exceed the total number of trucks on routes A and B.\n// D <= A + B",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes. The company has a total budget of $10,000 per day for all routes. The company must allocate at least 5 trucks to each route. The total number of trucks available is 50. The number of trucks on route D must not exceed the total number of trucks on routes A and B. Please help the company to minimize the total cost of transportation per hour across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## Cost per hour for each route\nCost_A = 2 * A * 60\nCost_B = 3 * B * 50\nCost_C = 4 * C * 40\nCost_D = 5 * D * 30\nCost_E = 6 * E * 20\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for all routes.\nmodel.addCons(2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000)\n## The total number of trucks available is 50.\nmodel.addCons(A + B + C + D + E <= 50)\n## The number of trucks on route D must not exceed the total number of trucks on routes A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in new machinery for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in new machinery cannot exceed $100,000.\n// InvestmentA + InvestmentB + InvestmentC <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA cannot exceed 500 units, and ProductB cannot exceed 400 units.\n// QuantityA <= 500; QuantityB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductC are produced.\n// QuantityC >= 200\n\n## Generate Constraint-5:\nThe labor hours required for each unit of ProductA, ProductB, and ProductC are 2 hours, 3 hours, and 4 hours respectively.\n// LaborA = 2 * QuantityA; LaborB = 3 * QuantityB; LaborC = 4 * QuantityC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product. The cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 10,000 labor hours available for the month. The total capital investment in new machinery cannot exceed $100,000. Due to market demand, the production of ProductA cannot exceed 500 units, and ProductB cannot exceed 400 units. The company must ensure that at least 200 units of ProductC are produced. The labor hours required for each unit of ProductA, ProductB, and ProductC are 2 hours, 3 hours, and 4 hours respectively.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=400) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=200, ub=model.infinity()) # quantity of ProductC\nLaborA = model.addVar(vtype=\"INTEGER\", name=\"LaborA\", lb=0) # labor hours for ProductA\nLaborB = model.addVar(vtype=\"INTEGER\", name=\"LaborB\", lb=0) # labor hours for ProductB\nLaborC = model.addVar(vtype=\"INTEGER\", name=\"LaborC\", lb=0) # labor hours for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0) # capital investment in new machinery for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0) # capital investment in new machinery for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0) # capital investment in new machinery for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\nProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\nProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA == 2 * QuantityA)\nmodel.addCons(LaborB == 3 * QuantityB)\nmodel.addCons(LaborC == 4 * QuantityC)\nmodel.addCons(LaborA + LaborB + LaborC <= 10000)\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in New Machinery for ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in New Machinery for ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in New Machinery for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1354,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to decide how many trucks of each type to purchase to optimize their operations.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a maintenance cost of $500 per month, and a cargo capacity of 5 tons.\nThe medium trucks have a fuel efficiency of 8 km/l, a maintenance cost of $700 per month, and a cargo capacity of 10 tons.\nThe large trucks have a fuel efficiency of 6 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 15 tons.\nThe company wants to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity.\n// FuelCost_Small = 100 / 10 * SmallTrucks * 500\n// FuelCost_Medium = 100 / 8 * MediumTrucks * 700\n// FuelCost_Large = 100 / 6 * LargeTrucks * 1000\n// MaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\n// TotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// SmallTrucks * 20000 + MediumTrucks * 30000 + LargeTrucks * 40000 <= 100000\n\n## Generate Constraint-2:\nThe total cargo capacity of the new fleet must be at least 500 tons.\n// 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nThe company can only accommodate a maximum of 20 new trucks in their current facilities.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads.\n// MediumTrucks + LargeTrucks >= 0.5 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to decide how many trucks of each type to purchase to optimize their operations. The details of each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|------------|-----------------------|----------------------------|-----------------------|\n| Small      | 10                    | 500                        | 5                     |\n| Medium     | 8                     | 700                        | 10                    |\n| Large      | 6                     | 1000                       | 15                    |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total cargo capacity of the new fleet must be at least 500 tons. The company can only accommodate a maximum of 20 new trucks in their current facilities. The company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads.\n\nPlease help the company to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = (100 / 10) * SmallTrucks * 500\nFuelCost_Medium = (100 / 8) * MediumTrucks * 700\nFuelCost_Large = (100 / 6) * LargeTrucks * 1000\nMaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\nTotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n## convert the division to multiplication\nmodel.addCons(obj * 100 == FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The total cargo capacity of the new fleet must be at least 500 tons.\nmodel.addCons(5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500)\n## The company can only accommodate a maximum of 20 new trucks in their current facilities.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads.\nmodel.addCons(MediumTrucks + LargeTrucks >= 0.5 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost Per Km: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1331,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type D solar panels\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $200 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $300 per panel, and a lifespan of 12 years.\nType C solar panels have an efficiency of 25%, a cost of $400 per panel, and a lifespan of 15 years.\nType D solar panels have an efficiency of 30%, a cost of $500 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.\n// TotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\n// EnergyProduced = 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar\n// So, the objective function is: Minimize (TotalCost - EnergyProduced)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the initial installation of solar panels.\n// 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000\n\n## Generate Constraint-2:\nThe total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\n// 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar >= 0.8 * 500000\n\n## Generate Constraint-3:\nThe city aims to install at least 200 solar panels in total.\n// TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar >= 200",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies, costs, and lifespans. The city needs to determine the number of each type of solar panel to install in each district. The details of each type of solar panel are given in the following Table.\n\n| Type of Solar Panel | Efficiency | Cost per Panel | Lifespan |\n|---------------------|------------|----------------|----------|\n| Type A              | 15%        | $200           | 10 years |\n| Type B              | 20%        | $300           | 12 years |\n| Type C              | 25%        | $400           | 15 years |\n| Type D              | 30%        | $500           | 20 years |\n\nThe city has a budget of $100,000 for the initial installation of solar panels. The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year. The city aims to install at least 200 solar panels in total.\n\nPlease help the city to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0)  # number of Type A solar panels\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0)  # number of Type B solar panels\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0)  # number of Type C solar panels\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0)  # number of Type D solar panels\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\nEnergyProduced = 0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar\n## the objective function is: Minimize (TotalCost - EnergyProduced)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * EnergyProduced)\n\n# Add constraints\n## The city has a budget of $100,000 for the initial installation of solar panels.\nmodel.addCons(200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000)\n## The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\nmodel.addCons(0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar >= 0.8 * 500000)\n## The city aims to install at least 200 solar panels in total.\nmodel.addCons(TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolar))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolar))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolar))\n    print(\"Number of Type D Solar Panels: \", model.getVal(TypeDSolar))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel consumption and time. The fuel consumption rate per truck varies by route and is given by a nonlinear function: F(x) = x^2/1000, where x is the number of trucks on a route. The time taken to complete a route also varies with the number of trucks and is given by another nonlinear function: T(x) = 1000 / (50 + x), where x is the number of trucks on a route. The operational cost is the sum of the product of fuel consumption and time for each route.\n// Objective function: Minimize \u03a3[F(Ti) * T(Ti)] for i = 1 to 6\n// Minimize \u03a3[(Ti^2/1000) * (1000 / (50 + Ti))] for i = 1 to 6\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks at a time.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe minimum number of trucks required on any route is 5 to ensure adequate coverage.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5; T6 >= 5",
        "question": "A logistics company operates 6 different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The company aims to minimize the total operational cost, which is a function of fuel consumption and time. The fuel consumption rate per truck varies by route and is given by a nonlinear function: F(x) = x^2/1000, where x is the number of trucks on a route. The time taken to complete a route also varies with the number of trucks and is given by another nonlinear function: T(x) = 1000 / (50 + x), where x is the number of trucks on a route. The operational cost is the sum of the product of fuel consumption and time for each route. The company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks at a time. The minimum number of trucks required on any route is 5 to ensure adequate coverage. Please help the company to minimize the total operational cost by determining the optimal number of trucks to allocate to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=5, ub=20) # number of trucks on route 6\n\n# Define objective function\n# Objective function: Minimize \u03a3[F(Ti) * T(Ti)] for i = 1 to 6\n# Minimize \u03a3[(Ti^2/1000) * (1000 / (50 + Ti))] for i = 1 to 6\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nF1 = T1**2 / 1000\nT1_time = 1000 / (50 + T1)\nF2 = T2**2 / 1000\nT2_time = 1000 / (50 + T2)\nF3 = T3**2 / 1000\nT3_time = 1000 / (50 + T3)\nF4 = T4**2 / 1000\nT4_time = 1000 / (50 + T4)\nF5 = T5**2 / 1000\nT5_time = 1000 / (50 + T5)\nF6 = T6**2 / 1000\nT6_time = 1000 / (50 + T6)\nmodel.addCons(obj == F1 * T1_time + F2 * T2_time + F3 * T3_time + F4 * T4_time + F5 * T5_time + F6 * T6_time)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Number of trucks on route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (SolarP) and wind turbines (WindT) to install in each region, as well as the investment in energy storage systems (Storage) for each type of installation. The efficiency of both solar panels and wind turbines is affected by the investment in storage systems, which enhances the overall energy output.\n// {\"number of solar panels\": \"SolarP\", \"range\": \"SolarP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindT\", \"range\": \"WindT >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for solar\": \"StorageS\", \"range\": \"StorageS >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for wind\": \"StorageW\", \"range\": \"StorageW >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel increases by 5% for every $10,000 invested in storage systems for solar installations. Similarly, the energy output per wind turbine increases by 3% for every $10,000 invested in storage systems for wind installations. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all installations.\n// Total energy output from solar: EnergyS = (200 * 1.05^(StorageS/10000)) * SolarP\n// Total energy output from wind: EnergyW = (300 * 1.03^(StorageW/10000)) * WindT\n// So, the objective function is: Maximize (EnergyS + EnergyW)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for investments in energy storage systems.\n// StorageS + StorageW <= 1000000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) cannot exceed 500.\n// SolarP + WindT <= 500\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines must not exceed the number of solar panels by more than 50.\n// WindT - SolarP <= 50",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (SolarP) and wind turbines (WindT) to install in each region, as well as the investment in energy storage systems (Storage) for each type of installation. The efficiency of both solar panels and wind turbines is affected by the investment in storage systems, which enhances the overall energy output. The energy output per solar panel increases by 5% for every $10,000 invested in storage systems for solar installations, and the energy output per wind turbine increases by 3% for every $10,000 invested in storage systems for wind installations. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company has a budget of $1,000,000 for investments in energy storage systems. The total number of installations (solar panels and wind turbines) cannot exceed 500. Due to regional regulations, the number of wind turbines must not exceed the number of solar panels by more than 50. The company aims to maximize the total energy output from all installations. Please help the company determine the optimal number of solar panels, wind turbines, and investments in energy storage systems to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarP = model.addVar(vtype=\"INTEGER\", name=\"SolarP\", lb=0)  # number of solar panels\nWindT = model.addVar(vtype=\"INTEGER\", name=\"WindT\", lb=0)  # number of wind turbines\nStorageS = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageS\", lb=0)  # investment in energy storage for solar\nStorageW = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageW\", lb=0)  # investment in energy storage for wind\n\n# Define objective function\n# Total energy output from solar: EnergyS = (200 * 1.05^(StorageS/10000)) * SolarP\n# Total energy output from wind: EnergyW = (300 * 1.03^(StorageW/10000)) * WindT\n# To handle the exponential growth, we can use a piecewise linear approximation\n# However, for simplicity, we will use a linear approximation for small values of StorageS and StorageW\nEnergyS = (200 * (1 + 0.05 * (StorageS / 10000))) * SolarP\nEnergyW = (300 * (1 + 0.03 * (StorageW / 10000))) * WindT\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyS + EnergyW)\n\n# Add constraints\n# The company has a budget of $1,000,000 for investments in energy storage systems.\nmodel.addCons(StorageS + StorageW <= 1000000)\n# The total number of installations (solar panels and wind turbines) cannot exceed 500.\nmodel.addCons(SolarP + WindT <= 500)\n# Due to regional regulations, the number of wind turbines must not exceed the number of solar panels by more than 50.\nmodel.addCons(WindT - SolarP <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarP))\n    print(\"Number of Wind Turbines: \", model.getVal(WindT))\n    print(\"Investment in Energy Storage for Solar: \", model.getVal(StorageS))\n    print(\"Investment in Energy Storage for Wind: \", model.getVal(StorageW))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1305,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Trucks\": \"TechUpgradeT\", \"range\": \"TechUpgradeT >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Vans\": \"TechUpgradeV\", \"range\": \"TechUpgradeV >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Bikes\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet.\n// Total efficiency for Trucks: EfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\n// Total efficiency for Vans: EfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\n// Total efficiency for Bikes: EfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n// So, the objective function is: Maximize (EfficiencyT + EfficiencyV + EfficiencyB)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle purchases and technology upgrades.\n// Cost of Trucks + Cost of Vans + Cost of Bikes + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000\n\n## Generate Constraint-2:\nThe total number of vehicles to be purchased cannot exceed 1,000.\n// Trucks + Vans + Bikes <= 1000\n\n## Generate Constraint-3:\nThe company must purchase at least 100 Trucks and 200 Vans.\n// Trucks >= 100; Vans >= 200\n\n## Generate Constraint-4:\nThe technology upgrade for any vehicle type should not exceed $50,000.\n// TechUpgradeT <= 50000\n// TechUpgradeV <= 50000\n// TechUpgradeB <= 50000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs.\nThe operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet.\nThe company has a budget of $500,000 for vehicle purchases and technology upgrades. The total number of vehicles to be purchased cannot exceed 1,000. The company must purchase at least 100 Trucks and 200 Vans. The technology upgrade for any vehicle type should not exceed $50,000.\nPlease help the company to determine the optimal number of each type of vehicle to purchase and the appropriate level of technology upgrade to maximize the total operational efficiency of its fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=100)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=200)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechUpgradeT = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeT\", lb=0)  # technology upgrade for Trucks\nTechUpgradeV = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeV\", lb=0)  # technology upgrade for Vans\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # technology upgrade for Bikes\n\n# Define objective function\nEfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\nEfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\nEfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EfficiencyT + EfficiencyV + EfficiencyB)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes <= 1000)\nmodel.addCons(Trucks >= 100)\nmodel.addCons(Vans >= 200)\nmodel.addCons(TechUpgradeT <= 50000)\nmodel.addCons(TechUpgradeV <= 50000)\nmodel.addCons(TechUpgradeB <= 50000)\nmodel.addCons(Trucks * 10000 + Vans * 8000 + Bikes * 500 + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Technology Upgrade for Trucks: \", model.getVal(TechUpgradeT))\n    print(\"Technology Upgrade for Vans: \", model.getVal(TechUpgradeV))\n    print(\"Technology Upgrade for Bikes: \", model.getVal(TechUpgradeB))\n    print(\"Maximized Total Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBProduction <= 2 * DeviceAProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 500 units of each device.\n// DeviceAProduction >= 500; DeviceBProduction >= 500; DeviceCProduction >= 500; DeviceDProduction >= 500; DeviceEProduction >= 500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit and the cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Unit |\n|--------|-----------------|---------------|\n| DeviceA | $50            | $20           |\n| DeviceB | $70            | $30           |\n| DeviceC | $90            | $40           |\n| DeviceD | $60            | $25           |\n| DeviceE | $80            | $35           |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget constraint for raw materials, which is $500,000. To ensure market presence, the company must produce at least 500 units of each device.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=500) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=500) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=500) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=500) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=500) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBProduction <= 2 * DeviceAProduction)\n# The company has a budget constraint for raw materials, which is $500,000.\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,800,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for each route are given in the following Table.\n\n| Route   | Cost per Truck |\n|---------|----------------|\n| RouteA  | $50,000        |\n| RouteB  | $60,000        |\n| RouteC  | $70,000        |\n| RouteD  | $80,000        |\n| RouteE  | $90,000        |\n\nThe company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\n\nPlease help the company to minimize the total cost of fuel and maintenance by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for textiles\": \"TextilesSpeed\", \"range\": \"TextilesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n// FuelConsumption_Electronics = k1 * ElectronicsSpeed^3 * ElectronicsTrucks\n// FuelConsumption_Perishables = k2 * PerishablesSpeed^3 * PerishablesTrucks\n// FuelConsumption_Textiles = k3 * TextilesSpeed^3 * TextilesTrucks\n// So, the objective function is: Minimize (FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel costs.\n// k1 * ElectronicsSpeed^3 * ElectronicsTrucks + k2 * PerishablesSpeed^3 * PerishablesTrucks + k3 * TextilesSpeed^3 * TextilesTrucks <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum fleet size of 50 trucks.\n// ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50\n\n## Generate Constraint-3:\nThe total daily travel time for all trucks must not exceed 12 hours.\n// (8 / ElectronicsSpeed) * ElectronicsTrucks + (8 / PerishablesSpeed) * PerishablesTrucks + (8 / TextilesSpeed) * TextilesTrucks <= 12\n\n## Generate Constraint-4:\nThe average speed of trucks transporting perishables must be at least 50 km/h to ensure freshness.\n// PerishablesSpeed >= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n\n| Type of Goods | Number of Trucks | Average Speed |\n|---------------|------------------|---------------|\n| Electronics   | ElectronicsTrucks | ElectronicsSpeed |\n| Perishables   | PerishablesTrucks | PerishablesSpeed |\n| Textiles      | TextilesTrucks | TextilesSpeed |\n\nThe company has a total budget of $10,000 per day for fuel costs. The company has a maximum fleet size of 50 trucks. The total daily travel time for all trucks must not exceed 12 hours. The average speed of trucks transporting perishables must be at least 50 km/h to ensure freshness.\n\nPlease help the company to determine the optimal number of trucks and their average speeds to minimize the total daily fuel consumption while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=50)\nTextilesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"TextilesSpeed\", lb=0)\n\n# Define objective function\nFuelConsumption_Electronics = model.addVar(name=\"FuelConsumption_Electronics\")\nFuelConsumption_Perishables = model.addVar(name=\"FuelConsumption_Perishables\")\nFuelConsumption_Textiles = model.addVar(name=\"FuelConsumption_Textiles\")\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\n\nmodel.addCons(FuelConsumption_Electronics == ElectronicsTrucks * ElectronicsSpeed**3)\nmodel.addCons(FuelConsumption_Perishables == PerishablesTrucks * PerishablesSpeed**3)\nmodel.addCons(FuelConsumption_Textiles == TextilesTrucks * TextilesSpeed**3)\nmodel.addCons(obj == FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks * ElectronicsSpeed**3 + PerishablesTrucks * PerishablesSpeed**3 + TextilesTrucks * TextilesSpeed**3 <= 10000)\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50)\nmodel.addCons((8 / ElectronicsSpeed) * ElectronicsTrucks + (8 / PerishablesSpeed) * PerishablesTrucks + (8 / TextilesSpeed) * TextilesTrucks <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Electronics Trucks: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Perishables Trucks: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Textiles Trucks: \", model.getVal(TextilesTrucks))\n    print(\"Electronics Speed: \", model.getVal(ElectronicsSpeed))\n    print(\"Perishables Speed: \", model.getVal(PerishablesSpeed))\n    print(\"Textiles Speed: \", model.getVal(TextilesSpeed))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1356,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy facilities: solar, wind, hydro, geothermal, and biomass. The city needs to determine how many units of each type of facility to install to meet energy demands efficiently.\n// {\"number of solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"GeothermalUnits\", \"range\": \"GeothermalUnits >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"BiomassUnits\", \"range\": \"BiomassUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit for solar is $50,000, wind is $60,000, hydro is $70,000, geothermal is $80,000, and biomass is $40,000. The energy output per unit for solar is 100 MWh, wind is 120 MWh, hydro is 150 MWh, geothermal is 180 MWh, and biomass is 90 MWh. The city wants to minimize the cost per MWh of energy produced.\n// Total cost: Cost = 50,000 * SolarUnits + 60,000 * WindUnits + 70,000 * HydroUnits + 80,000 * GeothermalUnits + 40,000 * BiomassUnits\n// Total energy output: Energy = 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $3,000,000 for the installation of these facilities.\n// 50,000 * SolarUnits + 60,000 * WindUnits + 70,000 * HydroUnits + 80,000 * GeothermalUnits + 40,000 * BiomassUnits <= 3,000,000\n\n## Generate Constraint-2:\nThe total energy output must meet at least 50,000 MWh to cover the city's energy needs.\n// 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits >= 50,000\n\n## Generate Constraint-3:\nDue to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed.\n// HydroUnits <= 0.5 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits)\n\n## Generate Constraint-4:\nThe city wants to ensure that at least 20% of the total units are solar units to promote solar energy.\n// SolarUnits >= 0.2 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits)",
        "question": "A city is planning to install five different types of renewable energy facilities: solar, wind, hydro, geothermal, and biomass. The city needs to determine how many units of each type of facility to install to meet energy demands efficiently. The cost per unit and energy output per unit for each type of facility are given in the following Table.\n\n| Facility Type | Cost per Unit | Energy Output per Unit |\n|---------------|---------------|-------------------------|\n| Solar         | $50,000       | 100 MWh                 |\n| Wind          | $60,000       | 120 MWh                 |\n| Hydro         | $70,000       | 150 MWh                 |\n| Geothermal    | $80,000       | 180 MWh                 |\n| Biomass       | $40,000       | 90 MWh                  |\n\nThe city has a budget of $3,000,000 for the installation of these facilities. The total energy output must meet at least 50,000 MWh to cover the city's energy needs. Due to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed. The city wants to ensure that at least 20% of the total units are solar units to promote solar energy.\n\nPlease help the city to minimize the cost per MWh of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nGeothermalUnits = model.addVar(vtype=\"INTEGER\", name=\"GeothermalUnits\", lb=0)\nBiomassUnits = model.addVar(vtype=\"INTEGER\", name=\"BiomassUnits\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * SolarUnits + 60000 * WindUnits + 70000 * HydroUnits + 80000 * GeothermalUnits + 40000 * BiomassUnits\nEnergy = 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $3,000,000 for the installation of these facilities.\nmodel.addCons(Cost <= 3000000)\n## The total energy output must meet at least 50,000 MWh to cover the city's energy needs.\nmodel.addCons(Energy >= 50000)\n## Due to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed.\nmodel.addCons(HydroUnits <= 0.5 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits))\n## The city wants to ensure that at least 20% of the total units are solar units to promote solar energy.\nmodel.addCons(SolarUnits >= 0.2 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Number of Geothermal Units: \", model.getVal(GeothermalUnits))\n    print(\"Number of Biomass Units: \", model.getVal(BiomassUnits))\n    print(\"Minimized Cost per MWh: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The cost function is defined as Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2). The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost.\n// Maximize Profit = (20A + 30B + 40C + 50D) - (10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2))\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs in the next quarter.\n// 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2) <= 5000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each product are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2A + 3B + 4C + 5D <= 1000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin. The profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The company has a budget of $5000 for production costs in the next quarter. The company wants to ensure that at least 50 units of each product are produced in the next quarter. The company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours. Please help the company to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost, where Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost\n## where Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2)\nCost = 10*A + 15*B + 20*C + 25*D - 0.01*(A**2 + B**2 + C**2 + D**2)\nProfit = 20*A + 30*B + 40*C + 50*D - Cost\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $5000 for production costs in the next quarter.\nmodel.addCons(Cost <= 5000)\n## The company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $50 per unit and requires 2 hours of labor and 3 units of raw material.\nProduct B has a profit margin of $70 per unit and requires 3 hours of labor and 4 units of raw material.\nProduct C has a profit margin of $60 per unit and requires 2.5 hours of labor and 3.5 units of raw material.\nProduct D has a profit margin of $80 per unit and requires 4 hours of labor and 5 units of raw material.\nProduct E has a profit margin of $90 per unit and requires 5 hours of labor and 6 units of raw material.\nThe company wants to maximize the total profit while considering the efficiency of resource use. The efficiency is defined as the total profit divided by the total hours of labor and raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total labor hours: Labor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\n// Total raw material: RawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n// So, the objective function is: Maximize Profit / (Labor + RawMaterial)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available.\n// 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500",
        "question": "A manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit. Product A has a profit margin of $50 per unit and requires 2 hours of labor and 3 units of raw material. Product B has a profit margin of $70 per unit and requires 3 hours of labor and 4 units of raw material. Product C has a profit margin of $60 per unit and requires 2.5 hours of labor and 3.5 units of raw material. Product D has a profit margin of $80 per unit and requires 4 hours of labor and 5 units of raw material. Product E has a profit margin of $90 per unit and requires 5 hours of labor and 6 units of raw material. The company has a total of 1000 hours of labor available and 1500 units of raw material available. The company wants to maximize the total profit while considering the efficiency of resource use, which is defined as the total profit divided by the total hours of labor and raw material used. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nLabor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\nRawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n## the objective function is: Maximize Profit / (Labor + RawMaterial)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor + RawMaterial) == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000)\n## The company has a total of 1500 units of raw material available.\nmodel.addCons(3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel efficiency upgrades for each truck, which will affect the fuel consumption and thus the overall cost of the routes.\n// {\"number of trips to destination A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for trips to destination A\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination B\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination C\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination D\": \"UpgradeD\", \"range\": \"UpgradeD >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination E\": \"UpgradeE\", \"range\": \"UpgradeE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of each trip is affected by the fuel consumption, which is inversely proportional to the amount of fuel efficiency upgrade. The base fuel cost per trip to destination A is $100, and for each $100 spent on upgrades, the cost decreases by $5. The same pattern applies to destinations B, C, D, and E with base costs of $120, $110, $130, and $140 respectively, and upgrade effects of $6, $7, $8, and $9 per $100 spent. The company aims to minimize the total cost of all trips.\n// Total cost for trips to destination A: CostA = (100 - 0.05 * UpgradeA) * TripsA\n// Total cost for trips to destination B: CostB = (120 - 0.06 * UpgradeB) * TripsB\n// Total cost for trips to destination C: CostC = (110 - 0.07 * UpgradeC) * TripsC\n// Total cost for trips to destination D: CostD = (130 - 0.08 * UpgradeD) * TripsD\n// Total cost for trips to destination E: CostE = (140 - 0.09 * UpgradeE) * TripsE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades.\n// UpgradeA + UpgradeB + UpgradeC + UpgradeD + UpgradeE <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel efficiency upgrades for each truck, which will affect the fuel consumption and thus the overall cost of the routes. The cost of each trip is affected by the fuel consumption, which is inversely proportional to the amount of fuel efficiency upgrade. The base fuel cost per trip and the effect of upgrades on the cost for each destination are given in the following Table.\n\n| Destination | Base Fuel Cost per Trip | Upgrade Effect per $100 Spent |\n|-------------|-------------------------|-------------------------------|\n| A           | $100                    | $5                           |\n| B           | $120                    | $6                           |\n| C           | $110                    | $7                           |\n| D           | $130                    | $8                           |\n| E           | $140                    | $9                           |\n\nThe company has a budget of $10,000 for fuel efficiency upgrades. The company aims to minimize the total cost of all trips. Please help the company determine the optimal number of trips to each destination and the appropriate fuel efficiency upgrades to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0)\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0)\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)\nUpgradeD = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeD\", lb=0)\nUpgradeE = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeE\", lb=0)\n\n# Define objective function\nCostA = (100 - 0.05 * UpgradeA) * TripsA\nCostB = (120 - 0.06 * UpgradeB) * TripsB\nCostC = (110 - 0.07 * UpgradeC) * TripsC\nCostD = (130 - 0.08 * UpgradeD) * TripsD\nCostE = (140 - 0.09 * UpgradeE) * TripsE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC + UpgradeD + UpgradeE <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Destination A: \", model.getVal(TripsA))\n    print(\"Number of Trips to Destination B: \", model.getVal(TripsB))\n    print(\"Number of Trips to Destination C: \", model.getVal(TripsC))\n    print(\"Number of Trips to Destination D: \", model.getVal(TripsD))\n    print(\"Number of Trips to Destination E: \", model.getVal(TripsE))\n    print(\"Fuel Efficiency Upgrade for Destination A: \", model.getVal(UpgradeA))\n    print(\"Fuel Efficiency Upgrade for Destination B: \", model.getVal(UpgradeB))\n    print(\"Fuel Efficiency Upgrade for Destination C: \", model.getVal(UpgradeC))\n    print(\"Fuel Efficiency Upgrade for Destination D: \", model.getVal(UpgradeD))\n    print(\"Fuel Efficiency Upgrade for Destination E: \", model.getVal(UpgradeE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to optimize its operations. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each mode of transportation, which affects the fuel consumption and operational costs.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for trains\": \"TrainTech\", \"range\": \"TrainTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for ships\": \"ShipTech\", \"range\": \"ShipTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each mode of transportation improves with the investment in fuel-efficient technologies. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost per truck trip: FuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\n// Fuel cost per train trip: FuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\n// Fuel cost per ship trip: FuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes of transportation must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500\n\n## Generate Constraint-3:\nDue to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50.\n// TruckTrips >= 100; TrainTrips >= 50\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each mode of transportation must not exceed $20,000.\n// TruckTech <= 20000; TrainTech <= 20000; ShipTech <= 20000",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the investment in fuel-efficient technologies for each mode to optimize its operations. The investment in fuel-efficient technologies affects the fuel consumption and operational costs. The following table summarizes the initial fuel cost per trip for each mode of transportation:\n\n| Mode of Transportation | Initial Fuel Cost per Trip |\n|------------------------|----------------------------|\n| Truck                  | 100$                       |\n| Train                  | 80$                        |\n| Ship                   | 120$                       |\n\nThe company has a total budget of $100,000 for transportation and technology investments. The total number of trips across all modes of transportation must not exceed 500 trips. Due to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50. The investment in fuel-efficient technology for each mode of transportation must not exceed $20,000.\n\nPlease help the company to minimize the total fuel cost of all trips by determining the optimal number of trips for each mode of transportation and the appropriate investment in fuel-efficient technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=100)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=50)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for trucks\nTrainTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TrainTech\", lb=0)  # investment in fuel-efficient technology for trains\nShipTech = model.addVar(vtype=\"CONTINUOUS\", name=\"ShipTech\", lb=0)  # investment in fuel-efficient technology for ships\n\n# Define objective function\nFuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\nFuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\nFuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n# Add constraints\nmodel.addCons(100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\nmodel.addCons(TruckTech <= 20000)\nmodel.addCons(TrainTech <= 20000)\nmodel.addCons(ShipTech <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Train Tech: \", model.getVal(TrainTech))\n    print(\"Investment in Ship Tech: \", model.getVal(ShipTech))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1356,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand.\n// {\"number of trucks for product P1\": \"TruckP1\", \"range\": \"TruckP1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P2\": \"TruckP2\", \"range\": \"TruckP2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P3\": \"TruckP3\", \"range\": \"TruckP3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P4\": \"TruckP4\", \"range\": \"TruckP4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P5\": \"TruckP5\", \"range\": \"TruckP5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each product varies with the number of trucks used and the distance traveled. The cost function is nonlinear due to economies of scale in truck usage.\nFor product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck.\nFor product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck.\nFor product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck.\nFor product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck.\nFor product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck.\nThe company aims to minimize the total transportation cost.\n// Total cost for P1: Cost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\n// Total cost for P2: Cost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\n// Total cost for P3: Cost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\n// Total cost for P4: Cost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\n// Total cost for P5: Cost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n// So, the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50\n\n## Generate Constraint-2:\nThe demand for each product requires at least a certain number of trucks. Specifically, P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks.\n// TruckP1 >= 5; TruckP2 >= 6; TruckP3 >= 7; TruckP4 >= 8; TruckP5 >= 9\n\n## Generate Constraint-3:\nDue to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1.\n// TruckP3 >= 2 * TruckP1\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trucks allocated to P4 and P5 does not exceed the combined number allocated to P1, P2, and P3.\n// TruckP4 + TruckP5 <= TruckP1 + TruckP2 + TruckP3\n\n## Generate Constraint-5:\nThe company has a budget constraint that limits the total cost of transportation to $500,000.\n// 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1)) + 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1)) + 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1)) + 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1)) + 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1)) <= 500,000",
        "question": "A logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand. The cost of transporting each product varies with the number of trucks used and the distance traveled. For product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck. For product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck. For product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck. For product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck. For product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck. The company has a total of 50 trucks available for distribution. The demand for each product requires at least a certain number of trucks: P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks. Due to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1. The company wants to ensure that the total number of trucks allocated to P4 and P5 does not exceed the combined number allocated to P1, P2, and P3. Additionally, the company has a budget constraint that limits the total cost of transportation to $500,000. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckP1 = model.addVar(vtype=\"INTEGER\", name=\"TruckP1\", lb=5)  # number of trucks for product P1\nTruckP2 = model.addVar(vtype=\"INTEGER\", name=\"TruckP2\", lb=6)  # number of trucks for product P2\nTruckP3 = model.addVar(vtype=\"INTEGER\", name=\"TruckP3\", lb=7)  # number of trucks for product P3\nTruckP4 = model.addVar(vtype=\"INTEGER\", name=\"TruckP4\", lb=8)  # number of trucks for product P4\nTruckP5 = model.addVar(vtype=\"INTEGER\", name=\"TruckP5\", lb=9)  # number of trucks for product P5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost for P1: Cost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\n## Total cost for P2: Cost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\n## Total cost for P3: Cost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\n## Total cost for P4: Cost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\n## Total cost for P5: Cost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\nCost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\nCost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\nCost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\nCost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\nCost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n\n## the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\nmodel.addCons(obj == Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n# Add constraints\n## The company has a total of 50 trucks available for distribution.\nmodel.addCons(TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50)\n\n## Due to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1.\nmodel.addCons(TruckP3 >= 2 * TruckP1)\n\n## The company wants to ensure that the total number of trucks allocated to P4 and P5 does not exceed the combined number allocated to P1, P2, and P3.\nmodel.addCons(TruckP4 + TruckP5 <= TruckP1 + TruckP2 + TruckP3)\n\n## The company has a budget constraint that limits the total cost of transportation to $500,000.\nmodel.addCons(Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for P1: \", model.getVal(TruckP1))\n    print(\"Number of Trucks for P2: \", model.getVal(TruckP2))\n    print(\"Number of Trucks for P3: \", model.getVal(TruckP3))\n    print(\"Number of Trucks for P4: \", model.getVal(TruckP4))\n    print(\"Number of Trucks for P5: \", model.getVal(TruckP5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1592,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes.\n// Cost per hour for route A: Cost_A = 100 / 5 * A\n// Cost per hour for route B: Cost_B = 120 / 6 * B\n// Cost per hour for route C: Cost_C = 150 / 7 * C\n// Cost per hour for route D: Cost_D = 180 / 8 * D\n// Cost per hour for route E: Cost_E = 200 / 9 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operational costs.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes. The company has a total budget of $10,000 for operational costs and a maximum of 50 trucks available. Please help the company to determine the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 / 5) * A\nCost_B = (120 / 6) * B\nCost_C = (150 / 7) * C\nCost_D = (180 / 8) * D\nCost_E = (200 / 9) * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 for operational costs.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000)\n## The company has a maximum of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods.\n// {\"number of trucks at Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck varies with the number of trucks at each warehouse due to congestion and route optimization. The fuel consumption per truck at Warehouse A is 0.5 + 0.01 * TrucksA liters per km, at Warehouse B is 0.45 + 0.01 * TrucksB liters per km, at Warehouse C is 0.4 + 0.01 * TrucksC liters per km, at Warehouse D is 0.35 + 0.01 * TrucksD liters per km, and at Warehouse E is 0.3 + 0.01 * TrucksE liters per km. The company wants to minimize the total daily fuel consumption across all warehouses.\n// Total fuel consumption at Warehouse A: Fuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\n// Total fuel consumption at Warehouse B: Fuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\n// Total fuel consumption at Warehouse C: Fuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\n// Total fuel consumption at Warehouse D: Fuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\n// Total fuel consumption at Warehouse E: Fuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nEach warehouse must have at least 2 trucks to ensure operational efficiency.\n// TrucksA >= 2; TrucksB >= 2; TrucksC >= 2; TrucksD >= 2; TrucksE >= 2\n\n## Generate Constraint-3:\nDue to local regulations, the number of trucks at Warehouse A cannot exceed twice the number at Warehouse B.\n// TrucksA <= 2 * TrucksB",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods. The fuel consumption per truck at each warehouse varies with the number of trucks present due to congestion and route optimization. The fuel consumption per truck at Warehouse A is 0.5 + 0.01 * TrucksA liters per km, at Warehouse B is 0.45 + 0.01 * TrucksB liters per km, at Warehouse C is 0.4 + 0.01 * TrucksC liters per km, at Warehouse D is 0.35 + 0.01 * TrucksD liters per km, and at Warehouse E is 0.3 + 0.01 * TrucksE liters per km. The company wants to minimize the total daily fuel consumption across all warehouses.\n\n| Warehouse | Fuel Consumption per Truck |\n|-----------|----------------------------|\n| A         | 0.5 + 0.01 * TrucksA       |\n| B         | 0.45 + 0.01 * TrucksB       |\n| C         | 0.4 + 0.01 * TrucksC        |\n| D         | 0.35 + 0.01 * TrucksD       |\n| E         | 0.3 + 0.01 * TrucksE        |\n\nThe company has a total of 50 trucks available for allocation. Each warehouse must have at least 2 trucks to ensure operational efficiency. Due to local regulations, the number of trucks at Warehouse A cannot exceed twice the number at Warehouse B.\n\nPlease help the company to minimize the total daily fuel consumption across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least 2 trucks to ensure operational efficiency.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=2) # number of trucks at Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=2) # number of trucks at Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=2) # number of trucks at Warehouse C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=2) # number of trucks at Warehouse D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=2) # number of trucks at Warehouse E\n\n# Define objective function\n## The fuel consumption of each truck varies with the number of trucks at each warehouse.\nFuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\nFuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\nFuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\nFuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\nFuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to local regulations, the number of trucks at Warehouse A cannot exceed twice the number at Warehouse B.\nmodel.addCons(TrucksA <= 2 * TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks at Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks at Warehouse C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks at Warehouse D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks at Warehouse E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1398,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints.\n// {\"quantity of device 1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 4\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 5\": \"Q5\", \"range\": \"Q5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is determined by a nonlinear function of its quantity. The profit function for each device is as follows:\n- Device 1: P1 = 100 * Q1 - 0.5 * Q1^2\n- Device 2: P2 = 150 * Q2 - 0.7 * Q2^2\n- Device 3: P3 = 120 * Q3 - 0.6 * Q3^2\n- Device 4: P4 = 130 * Q4 - 0.8 * Q4^2\n- Device 5: P5 = 140 * Q5 - 0.9 * Q5^2\nThe objective is to maximize the total profit from all devices.\n// Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * Q1 - 0.5 * Q1^2) + (150 * Q2 - 0.7 * Q2^2) + (120 * Q3 - 0.6 * Q3^2) + (130 * Q4 - 0.8 * Q4^2) + (140 * Q5 - 0.9 * Q5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// Q1 + Q2 + Q3 + Q4 + Q5 <= 1000",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints. The profit from each device is determined by a nonlinear function of its quantity:\n- Device 1: P1 = 100 * Q1 - 0.5 * Q1^2\n- Device 2: P2 = 150 * Q2 - 0.7 * Q2^2\n- Device 3: P3 = 120 * Q3 - 0.6 * Q3^2\n- Device 4: P4 = 130 * Q4 - 0.8 * Q4^2\n- Device 5: P5 = 140 * Q5 - 0.9 * Q5^2\nThe objective is to maximize the total profit from all devices. The total production capacity is limited to 1000 units across all devices.\nPlease help the company to determine the optimal production quantities for each device (Q1, Q2, Q3, Q4, Q5) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of device 1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of device 2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of device 3\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of device 4\nQ5 = model.addVar(vtype=\"INTEGER\", name=\"Q5\", lb=0) # quantity of device 5\n\n# Define objective function\nP1 = 100 * Q1 - 0.5 * Q1**2\nP2 = 150 * Q2 - 0.7 * Q2**2\nP3 = 120 * Q3 - 0.6 * Q3**2\nP4 = 130 * Q4 - 0.8 * Q4**2\nP5 = 140 * Q5 - 0.9 * Q5**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(Q1 + Q2 + Q3 + Q4 + Q5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device 1: \", model.getVal(Q1))\n    print(\"Quantity of Device 2: \", model.getVal(Q2))\n    print(\"Quantity of Device 3: \", model.getVal(Q3))\n    print(\"Quantity of Device 4: \", model.getVal(Q4))\n    print(\"Quantity of Device 5: \", model.getVal(Q5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 756,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of truck varies. T1 costs $100,000 with a fuel efficiency of 5 km/l, T2 costs $120,000 with a fuel efficiency of 6 km/l, T3 costs $150,000 with a fuel efficiency of 7 km/l, T4 costs $180,000 with a fuel efficiency of 8 km/l, and T5 costs $200,000 with a fuel efficiency of 9 km/l. The company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost.\n// Total purchase cost: PurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\n// Total annual fuel cost: FuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n// AnnualDistance is the total distance the company expects to cover in a year, and FuelPrice is the cost per liter of fuel.\n// So, the objective function is: Minimize (PurchaseCost + FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000",
        "question": "A logistics company is planning its fleet of trucks for the next quarter. They have identified five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to purchase. T1 costs $100,000 with a fuel efficiency of 5 km/l, T2 costs $120,000 with a fuel efficiency of 6 km/l, T3 costs $150,000 with a fuel efficiency of 7 km/l, T4 costs $180,000 with a fuel efficiency of 8 km/l, and T5 costs $200,000 with a fuel efficiency of 9 km/l. The company wants to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost. The company has a budget of $10 million for purchasing trucks.\n\nPlease help the company to minimize the total cost of ownership, which includes the purchase cost and the annual fuel cost, given the budget constraint.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nPurchaseCost = 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5\nAnnualDistance = 100000  # Assuming a fixed annual distance for simplicity\nFuelPrice = 1.5  # Assuming a fixed fuel price per liter\nFuelCost = (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) * AnnualDistance / FuelPrice\n## the objective function is: Minimize (PurchaseCost + FuelCost)\nmodel.addCons(obj == PurchaseCost + FuelCost)\n\n# Add constraints\n## The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the advertising budget for each product to enhance market penetration.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10. The storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n// Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n// Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\n// ProdA <= 2000; ProdB <= 3000; ProdC <= 2500\n\n## Generate Constraint-3:\nThe total advertising budget is limited to $15,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 15,000\n\n## Generate Constraint-4:\nDue to market research, the company knows that the production of ProductB must be at least twice the production of ProductA.\n// ProdB >= 2 * ProdA\n\n## Generate Constraint-5:\nThe company wants to ensure that at least 500 units of each product are produced to maintain market presence.\n// ProdA >= 500; ProdB >= 500; ProdC >= 500",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the advertising budget for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit, cost of raw materials per unit, labor cost per unit, storage cost per unit, and advertising effectiveness for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit | Storage Cost per Unit | Advertising Effectiveness |\n|---------|-----------------|----------------------------|---------------------|-----------------------|---------------------------|\n| ProductA | $50             | $20                        | $10                 | $5                    | 0.1                       |\n| ProductB | $70             | $30                        | $10                 | $7                    | 0.15                      |\n| ProductC | $60             | $25                        | $10                 | $6                    | 0.12                      |\n\nThe company has a total budget of $100,000 for raw materials and labor. The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units. The total advertising budget is limited to $15,000. Due to market research, the company knows that the production of ProductB must be at least twice the production of ProductA. The company wants to ensure that at least 500 units of each product are produced to maintain market presence.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product and the advertising budget for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=500) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=500) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=500) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\nProfit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\nProfit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100000)\n# The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\nmodel.addCons(ProdA <= 2000)\nmodel.addCons(ProdB <= 3000)\nmodel.addCons(ProdC <= 2500)\n# The total advertising budget is limited to $15,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 15000)\n# Due to market research, the company knows that the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProdB >= 2 * ProdA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1787,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $20,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 20000\n\n## Generate Constraint-4:\nThe company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n// QuantityA >= 2000; QuantityB >= 3000\n\n## Generate Constraint-5:\nDue to market saturation, the sales rate of ProductC cannot exceed 50% of the production rate.\n// QuantityC * (1 - 0.001 * MarketingBudgetC) <= 0.5 * QuantityC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process for each product, and the marketing budget for each product. The production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n\nThe total production capacity of the company is 10,000 units. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $20,000. The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced. Due to market saturation, the sales rate of ProductC cannot exceed 50% of the production rate.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $20,000.\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 20000)\n# The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\nmodel.addCons(QuantityA >= 2000)\nmodel.addCons(QuantityB >= 3000)\n# Due to market saturation, the sales rate of ProductC cannot exceed 50% of the production rate.\nmodel.addCons(QuantityC * (1 - 0.001 * MarketingBudgetC) <= 0.5 * QuantityC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation Level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation Level for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductA\": \"AdvertisingA\", \"range\": \"AdvertisingA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdvertisingB\", \"range\": \"AdvertisingB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdvertisingC\", \"range\": \"AdvertisingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2. The demand for ProductB is modeled as DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2. The demand for ProductC is modeled as DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = PriceA * DemandA\n// Total revenue for ProductB: RevenueB = PriceB * DemandB\n// Total revenue for ProductC: RevenueC = PriceC * DemandC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 3000 units.\n// QuantityA + QuantityB + QuantityC <= 3000\n\n## Generate Constraint-2:\nThe total advertising budget for all products cannot exceed $50,000.\n// AdvertisingA + AdvertisingB + AdvertisingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $50.\n// PriceA >= 50; PriceB >= 50; PriceC >= 50\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of ProductA and 700 units of ProductB.\n// QuantityA >= 500; QuantityB >= 700",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2. The demand for ProductB is modeled as DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2. The demand for ProductC is modeled as DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2. The company aims to maximize the total revenue from all products. The total production capacity of the company is 3000 units. The total advertising budget for all products cannot exceed $50,000. The price of each product must be at least $50. The company must produce at least 500 units of ProductA and 700 units of ProductB. Please help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=50)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=50)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=50)  # price of ProductC\nAdvertisingA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingA\", lb=0)  # advertising budget for ProductA\nAdvertisingB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingB\", lb=0)  # advertising budget for ProductB\nAdvertisingC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingC\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA**2\nDemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB**2\nDemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC**2\nRevenueA = PriceA * DemandA\nRevenueB = PriceB * DemandB\nRevenueC = PriceC * DemandC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 3000)  # total production capacity\nmodel.addCons(AdvertisingA + AdvertisingB + AdvertisingC <= 50000)  # total advertising budget\nmodel.addCons(QuantityA >= 500)  # minimum production of ProductA\nmodel.addCons(QuantityB >= 700)  # minimum production of ProductB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdvertisingA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdvertisingB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdvertisingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while considering the efficiency of each plant. The efficiency of each plant is affected by the investment in maintenance and upgrades, which can be different for each type of plant.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in maintenance for Solar\": \"SolarInvestment\", \"range\": \"SolarInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Wind\": \"WindInvestment\", \"range\": \"WindInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Hydro\": \"HydroInvestment\", \"range\": \"HydroInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company aims to maximize the total daily energy production.\n// Energy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\n// Energy_Wind = (150 + 0.015 * WindInvestment) * WindHours\n// Energy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance and upgrades across all plants.\n// SolarInvestment + WindInvestment + HydroInvestment <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while considering the efficiency of each plant. The efficiency of each plant is affected by the investment in maintenance and upgrades, which can be different for each type of plant. The energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company aims to maximize the total daily energy production.\n\n| Plant Type | Base Energy Output per Hour | Investment Impact per $1000 |\n|------------|-----------------------------|-----------------------------|\n| Solar      | 100 units                   | 1% increase                 |\n| Wind       | 150 units                   | 1.5% increase               |\n| Hydro      | 200 units                   | 0.8% increase               |\n\nThe company has a total budget of $100,000 for maintenance and upgrades across all plants. The total operating hours for all plants must not exceed 24 hours per day.\n\nPlease help the company determine the optimal number of operating hours for each plant and the appropriate investment in maintenance and upgrades to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of operating hours for Hydro\nSolarInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarInvestment\", lb=0)  # investment in maintenance for Solar\nWindInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindInvestment\", lb=0)  # investment in maintenance for Wind\nHydroInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroInvestment\", lb=0)  # investment in maintenance for Hydro\n\n# Define objective function\nEnergy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\nEnergy_Wind = (150 + 0.015 * WindInvestment) * WindHours\nEnergy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n# So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for maintenance and upgrades across all plants.\nmodel.addCons(SolarInvestment + WindInvestment + HydroInvestment <= 100000)\n# The total operating hours for all plants must not exceed 24 hours per day.\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Maintenance for Solar: \", model.getVal(SolarInvestment))\n    print(\"Investment in Maintenance for Wind: \", model.getVal(WindInvestment))\n    print(\"Investment in Maintenance for Hydro: \", model.getVal(HydroInvestment))\n    print(\"Total Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1534,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and delivery routes. The company must decide the number of trucks to use for each route and the speed at which each truck should travel.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on route 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on route 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function that increases non-linearly with speed. The fuel consumption per kilometer for route 1 is given by FC1 = 0.05 * Speed1^2 + 0.001 * Speed1^3, and for route 2 it is FC2 = 0.04 * Speed2^2 + 0.0008 * Speed2^3. The company aims to minimize the total fuel consumption across both routes.\n// Total fuel consumption for route 1: FC1 = (0.05 * Speed1^2 + 0.001 * Speed1^3) * Trucks1\n// Total fuel consumption for route 2: FC2 = (0.04 * Speed2^2 + 0.0008 * Speed2^3) * Trucks2\n// So, the objective function is: Minimize (FC1 + FC2)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe total distance to be covered on route 1 is 1000 km and on route 2 is 1500 km. The total travel time should not exceed 20 hours.\n// (1000 / Speed1) * Trucks1 + (1500 / Speed2) * Trucks2 <= 20\n\n## Generate Constraint-3:\nDue to safety regulations, the number of trucks on route 1 must not exceed 30, and on route 2 must not exceed 40.\n// Trucks1 <= 30; Trucks2 <= 40",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and delivery routes. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The fuel consumption per kilometer for each route is modeled by a nonlinear function that increases non-linearly with speed. For route 1, the fuel consumption is given by FC1 = 0.05 * Speed1^2 + 0.001 * Speed1^3, and for route 2, it is FC2 = 0.04 * Speed2^2 + 0.0008 * Speed2^3. The company aims to minimize the total fuel consumption across both routes.\n\n| Route | Fuel Consumption Formula |\n|-------|--------------------------|\n| 1     | FC1 = 0.05 * Speed1^2 + 0.001 * Speed1^3 |\n| 2     | FC2 = 0.04 * Speed2^2 + 0.0008 * Speed2^3 |\n\nThe total number of trucks available is 50. The total distance to be covered on route 1 is 1000 km and on route 2 is 1500 km. The total travel time should not exceed 20 hours. Due to safety regulations, the number of trucks on route 1 must not exceed 30, and on route 2 must not exceed 40.\n\nPlease help the company to determine the optimal number of trucks and their speeds to minimize the total fuel consumption while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks on route 2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on route 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on route 2\n\n# Define objective function\nFC1 = (0.05 * Speed1**2 + 0.001 * Speed1**3) * Trucks1\nFC2 = (0.04 * Speed2**2 + 0.0008 * Speed2**3) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons((1000 / Speed1) * Trucks1 + (1500 / Speed2) * Trucks2 <= 20)\nmodel.addCons(Trucks1 <= 30)\nmodel.addCons(Trucks2 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks on Route 1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route 2: \", model.getVal(Speed2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1210,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed.\n// {\"number of trips for Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A consumes 5 liters of fuel per hour and travels at 60 km/h.\nTruck B consumes 7 liters of fuel per hour and travels at 50 km/h.\nTruck C consumes 6 liters of fuel per hour and travels at 40 km/h.\nVan D consumes 3 liters of fuel per hour and travels at 80 km/h.\nVan E consumes 4 liters of fuel per hour and travels at 70 km/h.\nThe company wants to minimize the total fuel consumption while ensuring timely deliveries.\n// TotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\n// TotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n// The objective function is: Minimize TotalFuelConsumption * TotalDeliveryTime\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000\n\n## Generate Constraint-2:\nThe company must complete at least 1000 km of deliveries per day.\n// 60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000\n\n## Generate Constraint-3:\nThe number of trips for each vehicle must not exceed 20 per day.\n// TruckA <= 20\n// TruckB <= 20\n// TruckC <= 20\n// VanD <= 20\n// VanE <= 20\n\n## Generate Constraint-4:\nThe company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E).\n// VanD + VanE >= 0.3 * (TruckA + TruckB + TruckC + VanD + VanE)",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed, as shown in the following Table.\n\n| Vehicle | Fuel Consumption (liters/hour) | Speed (km/h) |\n|---------|--------------------------------|--------------|\n| Truck A | 5                              | 60           |\n| Truck B | 7                              | 50           |\n| Truck C | 6                              | 40           |\n| Van D   | 3                              | 80           |\n| Van E   | 4                              | 70           |\n\nThe company has a total fuel budget of 1000 liters per day. The company must complete at least 1000 km of deliveries per day. The number of trips for each vehicle must not exceed 20 per day. The company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E).\n\nPlease help the company to minimize the total fuel consumption while ensuring timely deliveries, by minimizing the product of total fuel consumption and total delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trips for Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trips for Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trips for Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of trips for Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of trips for Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\nTotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n## convert the division to multiplication\nmodel.addCons(obj == TotalFuelConsumption * TotalDeliveryTime)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000)\n## The company must complete at least 1000 km of deliveries per day.\nmodel.addCons(60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000)\n## The number of trips for each vehicle must not exceed 20 per day.\nmodel.addCons(TruckA <= 20)\nmodel.addCons(TruckB <= 20)\nmodel.addCons(TruckC <= 20)\nmodel.addCons(VanD <= 20)\nmodel.addCons(VanE <= 20)\n## The company must ensure that at least 30% of the total trips are made by fuel-efficient vehicles (Van D and Van E).\nmodel.addCons(VanD + VanE >= 0.3 * (TruckA + TruckB + TruckC + VanD + VanE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(TruckA))\n    print(\"Number of trips for Truck B: \", model.getVal(TruckB))\n    print(\"Number of trips for Truck C: \", model.getVal(TruckC))\n    print(\"Number of trips for Van D: \", model.getVal(VanD))\n    print(\"Number of trips for Van E: \", model.getVal(VanE))\n    print(\"Minimized Fuel Consumption * Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\n// Total profit for ProductB: ProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $30,000.\n// MarketingA + MarketingB + MarketingC <= 30000\n\n## Generate Constraint-3:\nDue to production capacity, the total number of units produced cannot exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\n// UnitsA >= 200; UnitsB >= 300\n\n## Generate Constraint-5:\nThe company has a limited workforce that can handle a maximum of 500 units of production.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n\nThe total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $30,000. Due to production capacity, the total number of units produced cannot exceed 1000. The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced. The company has a limited workforce that can handle a maximum of 500 units of production.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $30,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 30000)\n# Due to production capacity, the total number of units produced cannot exceed 1000.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\nmodel.addCons(UnitsA >= 200)\nmodel.addCons(UnitsB >= 300)\n# The company has a limited workforce that can handle a maximum of 500 units of production.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1430,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $50 per unit and requires 2 hours of labor and 3 units of raw material.\nProduct B has a profit margin of $70 per unit and requires 3 hours of labor and 4 units of raw material.\nProduct C has a profit margin of $60 per unit and requires 2.5 hours of labor and 3.5 units of raw material.\nProduct D has a profit margin of $80 per unit and requires 4 hours of labor and 5 units of raw material.\nProduct E has a profit margin of $90 per unit and requires 5 hours of labor and 6 units of raw material.\nThe company wants to maximize the total profit while considering the efficiency of resource use. The efficiency is defined as the total profit divided by the total hours of labor and raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total labor hours: Labor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\n// Total raw material: RawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n// So, the objective function is: Maximize Profit / (Labor + RawMaterial)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available.\n// 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n// D >= 10\n// E >= 10",
        "question": "A manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit. Product A has a profit margin of $50 per unit and requires 2 hours of labor and 3 units of raw material. Product B has a profit margin of $70 per unit and requires 3 hours of labor and 4 units of raw material. Product C has a profit margin of $60 per unit and requires 2.5 hours of labor and 3.5 units of raw material. Product D has a profit margin of $80 per unit and requires 4 hours of labor and 5 units of raw material. Product E has a profit margin of $90 per unit and requires 5 hours of labor and 6 units of raw material. The company has a total of 1000 hours of labor available and 1500 units of raw material available. The company must produce at least 10 units of each product to meet contractual obligations. The company wants to maximize the total profit while considering the efficiency of resource use, which is defined as the total profit divided by the total hours of labor and raw material used. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nLabor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\nRawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n## the objective function is: Maximize Profit / (Labor + RawMaterial)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor + RawMaterial) == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000)\n## The company has a total of 1500 units of raw material available.\nmodel.addCons(3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to deploy for the next month to maximize efficiency while meeting operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry a load of 10 tons and consumes 5 liters of fuel per 100 km. Each TruckB can carry a load of 15 tons and consumes 7 liters of fuel per 100 km. Each TruckC can carry a load of 20 tons and consumes 9 liters of fuel per 100 km. Each TruckD can carry a load of 25 tons and consumes 11 liters of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The objective is to maximize the ratio of total carrying capacity to total fuel consumption.\n// Total carrying capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD\n// Total fuel consumption: Fuel = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n// So, the objective function is: Maximize (Capacity / Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel costs for the next month.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50,000",
        "question": "A logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to deploy for the next month to maximize efficiency while meeting operational constraints. The carrying capacity and fuel consumption per 100 km for each type of truck are given in the following Table.\n\n| Vehicle | Carrying Capacity (tons) | Fuel Consumption (liters/100 km) |\n|---------|--------------------------|---------------------------------|\n| TruckA  | 10                       | 5                               |\n| TruckB  | 15                       | 7                               |\n| TruckC  | 20                       | 9                               |\n| TruckD  | 25                       | 11                              |\n\nThe company has a budget of $50,000 for fuel costs for the next month. Please help the company to maximize the ratio of total carrying capacity to total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD\nFuel = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n## the objective function is: Maximize (Capacity / Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Capacity)\n\n# Add constraints\n## The company has a budget of $50,000 for fuel costs for the next month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm is planning to optimize its production of three different products: Widget A, Widget B, and Widget C. The firm needs to decide on the number of production lines for each widget and the number of workers assigned to each line to maximize profit while adhering to certain constraints related to labor, budget, and production capacity.\n// {\"number of production lines for Widget A\": \"WidgetALines\", \"range\": \"WidgetALines >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for Widget B\": \"WidgetBLines\", \"range\": \"WidgetBLines >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for Widget C\": \"WidgetCLines\", \"range\": \"WidgetCLines >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget A\": \"WidgetAWokersPerLine\", \"range\": \"WidgetAWokersPerLine >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget B\": \"WidgetBWokersPerLine\", \"range\": \"WidgetBWokersPerLine >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget C\": \"WidgetCWokersPerLine\", \"range\": \"WidgetCWokersPerLine >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of materials for Widget A is $3 per unit, and it sells for $8 per unit, with each worker producing 120 units per day.\nThe cost of materials for Widget B is $4 per unit, and it sells for $10 per unit, with each worker producing 100 units per day.\nThe cost of materials for Widget C is $5 per unit, and it sells for $12 per unit, with each worker producing 80 units per day.\nThe firm aims to maximize the total daily profit from all widgets.\n// Profit_WidgetA = 120 * WidgetALines * WidgetAWokersPerLine * (8 - 3)\n// Profit_WidgetB = 100 * WidgetBLines * WidgetBWokersPerLine * (10 - 4)\n// Profit_WidgetC = 80 * WidgetCLines * WidgetCWokersPerLine * (12 - 5)\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe firm has a total of 150 workers available.\n// WidgetALines * WidgetAWokersPerLine + WidgetBLines * WidgetBWokersPerLine + WidgetCLines * WidgetCWokersPerLine <= 150",
        "question": "A manufacturing firm is planning to optimize its production of three different products: Widget A, Widget B, and Widget C. The firm needs to decide on the number of production lines for each widget and the number of workers assigned to each line to maximize profit while adhering to certain constraints related to labor, budget, and production capacity.\nThe cost of materials for Widget A is $3 per unit, and it sells for $8 per unit, with each worker producing 120 units per day.\nThe cost of materials for Widget B is $4 per unit, and it sells for $10 per unit, with each worker producing 100 units per day.\nThe cost of materials for Widget C is $5 per unit, and it sells for $12 per unit, with each worker producing 80 units per day.\nThe firm has a total of 150 workers available.\nPlease help the firm to maximize the total daily profit from all widgets.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetALines = model.addVar(vtype=\"INTEGER\", name=\"WidgetALines\", lb=0)\nWidgetBLines = model.addVar(vtype=\"INTEGER\", name=\"WidgetBLines\", lb=0)\nWidgetCLines = model.addVar(vtype=\"INTEGER\", name=\"WidgetCLines\", lb=0)\nWidgetAWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetAWokersPerLine\", lb=0)\nWidgetBWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetBWokersPerLine\", lb=0)\nWidgetCWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetCWokersPerLine\", lb=0)\n\n# Define objective function\nProfit_WidgetA = 120 * WidgetALines * WidgetAWokersPerLine * (8 - 3)\nProfit_WidgetB = 100 * WidgetBLines * WidgetBWokersPerLine * (10 - 4)\nProfit_WidgetC = 80 * WidgetCLines * WidgetCWokersPerLine * (12 - 5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetALines * WidgetAWokersPerLine + WidgetBLines * WidgetBWokersPerLine + WidgetCLines * WidgetCWokersPerLine <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines for Widget A: \", model.getVal(WidgetALines))\n    print(\"Number of Production Lines for Widget B: \", model.getVal(WidgetBLines))\n    print(\"Number of Production Lines for Widget C: \", model.getVal(WidgetCLines))\n    print(\"Number of Workers per Production Line for Widget A: \", model.getVal(WidgetAWokersPerLine))\n    print(\"Number of Workers per Production Line for Widget B: \", model.getVal(WidgetBWokersPerLine))\n    print(\"Number of Workers per Production Line for Widget C: \", model.getVal(WidgetCWokersPerLine))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip decreases by $2 for every $100 invested in upgrades. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips.\n// Operational cost for Truck1: Cost1 = (100 - 0.02 * Upgrade1) * Trips1\n// Operational cost for Truck2: Cost2 = (120 - 0.02 * Upgrade2) * Trips2\n// Operational cost for Truck3: Cost3 = (110 - 0.02 * Upgrade3) * Trips3\n// Operational cost for Truck4: Cost4 = (90 - 0.02 * Upgrade4) * Trips4\n// Operational cost for Truck5: Cost5 = (130 - 0.02 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for both trip operations and upgrades.\n// (100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 500 trips.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, each truck can make at most 120 trips.\n// Trips1 <= 120; Trips2 <= 120; Trips3 <= 120; Trips4 <= 120; Trips5 <= 120",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip. The fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip decreases by $2 for every $100 invested in upgrades. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips. The company has a budget of $20,000 for both trip operations and upgrades. The total number of trips across all trucks must not exceed 500 trips. Due to maintenance schedules, each truck can make at most 120 trips. Please help the company to determine the optimal number of trips and the amount to invest in fuel-efficient upgrades for each truck to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips for Truck5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # investment in fuel-efficient upgrades for Truck4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # investment in fuel-efficient upgrades for Truck5\n\n# Define objective function\nCost1 = (100 - 0.02 * Upgrade1) * Trips1\nCost2 = (120 - 0.02 * Upgrade2) * Trips2\nCost3 = (110 - 0.02 * Upgrade3) * Trips3\nCost4 = (90 - 0.02 * Upgrade4) * Trips4\nCost5 = (130 - 0.02 * Upgrade5) * Trips5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons((100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + \n              (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + \n              (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(Trips1 <= 120)\nmodel.addCons(Trips2 <= 120)\nmodel.addCons(Trips3 <= 120)\nmodel.addCons(Trips4 <= 120)\nmodel.addCons(Trips5 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Truck5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrades for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrades for Truck4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrades for Truck5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations.\n// {\"number of trucks allocated to the North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor the North region, the average fuel consumption per truck is 50 liters per day, the average delivery cost per truck is $300 per day, and the average revenue per truck is $500 per day.\nFor the South region, the average fuel consumption per truck is 45 liters per day, the average delivery cost per truck is $280 per day, and the average revenue per truck is $480 per day.\nFor the East region, the average fuel consumption per truck is 55 liters per day, the average delivery cost per truck is $320 per day, and the average revenue per truck is $520 per day.\nFor the West region, the average fuel consumption per truck is 60 liters per day, the average delivery cost per truck is $350 per day, and the average revenue per truck is $550 per day.\nFor the Central region, the average fuel consumption per truck is 40 liters per day, the average delivery cost per truck is $250 per day, and the average revenue per truck is $450 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for North: Profit_North = (500 - 300) * NorthTrucks\n// Total net profit for South: Profit_South = (480 - 280) * SouthTrucks\n// Total net profit for East: Profit_East = (520 - 320) * EastTrucks\n// Total net profit for West: Profit_West = (550 - 350) * WestTrucks\n// Total net profit for Central: Profit_Central = (450 - 250) * CentralTrucks\n// Total fuel consumption: Fuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n// So, the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\n// NorthTrucks - SouthTrucks <= 10",
        "question": "A logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations.\nFor the North region, the average fuel consumption per truck is 50 liters per day, the average delivery cost per truck is $300 per day, and the average revenue per truck is $500 per day.\nFor the South region, the average fuel consumption per truck is 45 liters per day, the average delivery cost per truck is $280 per day, and the average revenue per truck is $480 per day.\nFor the East region, the average fuel consumption per truck is 55 liters per day, the average delivery cost per truck is $320 per day, and the average revenue per truck is $520 per day.\nFor the West region, the average fuel consumption per truck is 60 liters per day, the average delivery cost per truck is $350 per day, and the average revenue per truck is $550 per day.\nFor the Central region, the average fuel consumption per truck is 40 liters per day, the average delivery cost per truck is $250 per day, and the average revenue per truck is $450 per day.\nThe company has a total of 100 trucks available for allocation. Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\nThe company wants to maximize the net profit per liter of fuel consumed. Please help the company determine the optimal allocation of trucks to each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)  # number of trucks allocated to the North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)  # number of trucks allocated to the South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)  # number of trucks allocated to the East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)  # number of trucks allocated to the West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=0)  # number of trucks allocated to the Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_North = (500 - 300) * NorthTrucks\nProfit_South = (480 - 280) * SouthTrucks\nProfit_East = (520 - 320) * EastTrucks\nProfit_West = (550 - 350) * WestTrucks\nProfit_Central = (450 - 250) * CentralTrucks\nFuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n## the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100)\n## Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\nmodel.addCons(NorthTrucks - SouthTrucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1506,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product line. The advanced machinery reduces the production time per unit and thus increases the production capacity.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in advanced machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The advanced machinery reduces the production time per unit by 10 minutes for every $10,000 invested. The initial production time per unit for ProductA is 60 minutes, for ProductB is 50 minutes, and for ProductC is 40 minutes. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = 50 * ProductAQty - (60 - 0.01 * MachineryA) * WorkersA\n// Total profit for ProductB: ProfitB = 70 * ProductBQty - (50 - 0.01 * MachineryB) * WorkersB\n// Total profit for ProductC: ProfitC = 90 * ProductCQty - (40 - 0.01 * MachineryC) * WorkersC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product line. The advanced machinery reduces the production time per unit and thus increases the production capacity. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The advanced machinery reduces the production time per unit by 10 minutes for every $10,000 invested. The initial production time per unit for ProductA is 60 minutes, for ProductB is 50 minutes, and for ProductC is 40 minutes. The company aims to maximize the total profit from all products. The company has a total of 100 workers available.\n\nPlease help the company to determine the optimal production quantity, number of workers, and capital investment in advanced machinery for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in advanced machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in advanced machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in advanced machinery for ProductC\n\n# Define objective function\nProfitA = 50 * ProductAQty - (60 - 0.01 * MachineryA) * WorkersA\nProfitB = 70 * ProductBQty - (50 - 0.01 * MachineryB) * WorkersB\nProfitC = 90 * ProductCQty - (40 - 0.01 * MachineryC) * WorkersC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)  # total workers constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company has 5 different locations where it can install solar panels. The company needs to decide how many solar panels to install at each location to maximize energy production while minimizing costs.\n// {\"number of solar panels at location 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies by location due to different solar irradiance levels and efficiency of the panels. The cost of installation also varies by location. \n- At location 1, each panel produces 150 kWh and costs $1000 to install.\n- At location 2, each panel produces 120 kWh and costs $900 to install.\n- At location 3, each panel produces 180 kWh and costs $1100 to install.\n- At location 4, each panel produces 160 kWh and costs $1000 to install.\n- At location 5, each panel produces 140 kWh and costs $950 to install.\nThe company wants to maximize the total energy production while keeping the total installation cost below $100,000.\n// The total energy production: E = 150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5\n// The total installation cost: C = 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5\n// The objective function is: Maximize E - 0.01 * C\n// Maximize (150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5) - 0.01 * (1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5)\n\n## Generate Constraint-1:\nThe total installation cost must not exceed $100,000.\n// 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5 <= 100000\n\n## Generate Constraint-2:\nEach location has a maximum capacity for solar panels:\n// P1 <= 100; P2 <= 120; P3 <= 90; P4 <= 110; P5 <= 130",
        "question": "A solar energy company has 5 different locations where it can install solar panels. The company needs to decide how many solar panels to install at each location to maximize energy production while minimizing costs.\n- At location 1, each panel produces 150 kWh and costs $1000 to install.\n- At location 2, each panel produces 120 kWh and costs $900 to install.\n- At location 3, each panel produces 180 kWh and costs $1100 to install.\n- At location 4, each panel produces 160 kWh and costs $1000 to install.\n- At location 5, each panel produces 140 kWh and costs $950 to install.\nThe company wants to maximize the total energy production while keeping the total installation cost below $100,000. Each location has a maximum capacity for solar panels: P1 <= 100; P2 <= 120; P3 <= 90; P4 <= 110; P5 <= 130.\nPlease help the company to maximize the total energy production while considering the total installation cost and the maximum capacity at each location.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels at location 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels at location 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels at location 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of solar panels at location 4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # number of solar panels at location 5\n\n# Define objective function\n## The objective function is: Maximize E - 0.01 * C\nE = 150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5\nC = 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E - 0.01 * C)\n\n# Add constraints\n## The total installation cost must not exceed $100,000.\nmodel.addCons(1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5 <= 100000)\n## Each location has a maximum capacity for solar panels:\nmodel.addCons(P1 <= 100)\nmodel.addCons(P2 <= 120)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 110)\nmodel.addCons(P5 <= 130)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(P3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(P4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(P5))\n    print(\"Maximized Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance costs combined.\n// (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to Route A.\n// RouteA >= 5\n\n## Generate Constraint-4:\nNo more than 20% of the total trucks can be allocated to any single route.\n// RouteA <= 0.2 * 50\n// RouteB <= 0.2 * 50\n// RouteC <= 0.2 * 50\n// RouteD <= 0.2 * 50\n// RouteE <= 0.2 * 50",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route. The profit per truck, fuel cost per truck, and maintenance cost per truck for each route are given in the following Table.\n\n| Route | Profit per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|-------|------------------|---------------------|----------------------------|\n| A     | $10,000          | $2,000              | $1,500                     |\n| B     | $12,000          | $2,500              | $1,800                     |\n| C     | $15,000          | $3,000              | $2,000                     |\n| D     | $18,000          | $3,500              | $2,500                     |\n| E     | $20,000          | $4,000              | $3,000                     |\n\nThe company has a total of 50 trucks available for allocation. The company has a budget of $100,000 for fuel and maintenance costs combined. The company must allocate at least 5 trucks to Route A. No more than 20% of the total trucks can be allocated to any single route. \n\nPlease help the company to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=5)  # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0)  # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0)  # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0)  # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0)  # number of trucks for Route E\n\n# Define objective function\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\nmodel.addCons((2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000)\nmodel.addCons(RouteA <= 0.2 * 50)\nmodel.addCons(RouteB <= 0.2 * 50)\nmodel.addCons(RouteC <= 0.2 * 50)\nmodel.addCons(RouteD <= 0.2 * 50)\nmodel.addCons(RouteE <= 0.2 * 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each truck on Route A\": \"Distance_A\", \"range\": \"Distance_A >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route B\": \"Distance_B\", \"range\": \"Distance_B >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route C\": \"Distance_C\", \"range\": \"Distance_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = Trucks_A * Distance_A^2\n// Fuel_Consumption_B = Trucks_B * Distance_B^2\n// Fuel_Consumption_C = Trucks_C * Distance_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for all routes.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total distance traveled by all trucks should not exceed 10,000 kilometers.\n// Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total of 50 trucks available for all routes. The total distance traveled by all trucks should not exceed 10,000 kilometers.\n\nPlease help the company to determine the optimal number of trucks for each route and the distance each truck should travel to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nDistance_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_A\", lb=0)  # distance traveled by each truck on Route A\nDistance_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_B\", lb=0)  # distance traveled by each truck on Route B\nDistance_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_C\", lb=0)  # distance traveled by each truck on Route C\n\n# Define objective function\nFuel_Consumption_A = Trucks_A * Distance_A**2\nFuel_Consumption_B = Trucks_B * Distance_B**2\nFuel_Consumption_C = Trucks_C * Distance_C**2\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for all routes.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n# The total distance traveled by all trucks should not exceed 10,000 kilometers.\nmodel.addCons(Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Distance on Route A: \", model.getVal(Distance_A))\n    print(\"Distance on Route B: \", model.getVal(Distance_B))\n    print(\"Distance on Route C: \", model.getVal(Distance_C))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels, wind turbines, and hydroelectric plants to generate renewable energy. The city needs to determine the optimal number of each type of installation to minimize the total cost while meeting the energy demand.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $5000, a wind turbine is $10000, and a hydroelectric plant is $20000. The energy output per unit for solar is 1000 kWh, for wind is 2000 kWh, and for hydro is 3000 kWh. The city aims to minimize the total installation cost.\n// Total installation cost: Cost = 5000 * Solar + 10000 * Wind + 20000 * Hydro\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of renewable energy sources.\n// 5000 * Solar + 10000 * Wind + 20000 * Hydro <= 500000\n\n## Generate Constraint-2:\nThe city needs to generate at least 1,000,000 kWh of energy.\n// 1000 * Solar + 2000 * Wind + 3000 * Hydro >= 1000000\n\n## Generate Constraint-3:\nThe city has space to install a maximum of 100 solar panels and 50 wind turbines.\n// Solar <= 100\n// Wind <= 50\n\n## Generate Constraint-4:\nThe city wants to ensure that the total number of hydroelectric plants does not exceed 20% of the total number of solar panels and wind turbines combined.\n// Hydro <= 0.2 * (Solar + Wind)",
        "question": "A city is planning to install solar panels, wind turbines, and hydroelectric plants to generate renewable energy. The city needs to determine the optimal number of each type of installation to minimize the total cost while meeting the energy demand. The cost of installing a solar panel is $5000, a wind turbine is $10000, and a hydroelectric plant is $20000. The energy output per unit for solar is 1000 kWh, for wind is 2000 kWh, and for hydro is 3000 kWh. The city has a budget of $500,000 for the installation of renewable energy sources and needs to generate at least 1,000,000 kWh of energy. The city has space to install a maximum of 100 solar panels and 50 wind turbines. Additionally, the city wants to ensure that the total number of hydroelectric plants does not exceed 20% of the total number of solar panels and wind turbines combined. Please help the city to minimize the total installation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric plants\n\n# Define objective function\nCost = 5000 * Solar + 10000 * Wind + 20000 * Hydro\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The city has a budget of $500,000 for the installation of renewable energy sources.\nmodel.addCons(5000 * Solar + 10000 * Wind + 20000 * Hydro <= 500000)\n# The city needs to generate at least 1,000,000 kWh of energy.\nmodel.addCons(1000 * Solar + 2000 * Wind + 3000 * Hydro >= 1000000)\n# The city has space to install a maximum of 100 solar panels and 50 wind turbines.\nmodel.addCons(Solar <= 100)\nmodel.addCons(Wind <= 50)\n# The city wants to ensure that the total number of hydroelectric plants does not exceed 20% of the total number of solar panels and wind turbines combined.\nmodel.addCons(Hydro <= 0.2 * (Solar + Wind))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(Hydro))\n    print(\"Minimized Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons and has a maintenance cost of $500 per month. Each Truck B can carry 15 tons and has a maintenance cost of $700 per month. Each Truck C can carry 20 tons and has a maintenance cost of $900 per month. Each Van D can carry 5 tons and has a maintenance cost of $300 per month. Each Van E can carry 8 tons and has a maintenance cost of $400 per month. The company aims to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost. The revenue from each ton of cargo is $100.\n// Revenue from Truck A: Revenue_A = 10 * A * 100\n// Revenue from Truck B: Revenue_B = 15 * B * 100\n// Revenue from Truck C: Revenue_C = 20 * C * 100\n// Revenue from Van D: Revenue_D = 5 * D * 100\n// Revenue from Van E: Revenue_E = 8 * E * 100\n// Maintenance cost of Truck A: Cost_A = 500 * A\n// Maintenance cost of Truck B: Cost_B = 700 * B\n// Maintenance cost of Truck C: Cost_C = 900 * C\n// Maintenance cost of Van D: Cost_D = 300 * D\n// Maintenance cost of Van E: Cost_E = 400 * E\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle maintenance for the month.\n// 500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of its fleet is composed of Van D and Van E combined.\n// D + E >= 0.1 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe total cargo capacity of the fleet should not exceed 1000 tons.\n// 10 * A + 15 * B + 20 * C + 5 * D + 8 * E <= 1000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each Truck A can carry 10 tons and has a maintenance cost of $500 per month. Each Truck B can carry 15 tons and has a maintenance cost of $700 per month. Each Truck C can carry 20 tons and has a maintenance cost of $900 per month. Each Van D can carry 5 tons and has a maintenance cost of $300 per month. Each Van E can carry 8 tons and has a maintenance cost of $400 per month. The revenue from each ton of cargo is $100. The company has a total budget of $10,000 for vehicle maintenance for the month. The company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total. The company must ensure that at least 10% of its fleet is composed of Van D and Van E combined. The total cargo capacity of the fleet should not exceed 1000 tons.\n\nPlease help the company to maximize its profit, which is the total revenue from cargo transportation minus the total maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Van E\n\n# Define objective function\nRevenue_A = 10 * A * 100\nRevenue_B = 15 * B * 100\nRevenue_C = 20 * C * 100\nRevenue_D = 5 * D * 100\nRevenue_E = 8 * E * 100\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\nCost_D = 300 * D\nCost_E = 400 * E\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle maintenance for the month.\nmodel.addCons(500 * A + 700 * B + 900 * C + 300 * D + 400 * E <= 10000)\n# The company has a limit on the number of vehicles it can deploy, with a maximum of 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n# The company must ensure that at least 10% of its fleet is composed of Van D and Van E combined.\nmodel.addCons(D + E >= 0.1 * (A + B + C + D + E))\n# The total cargo capacity of the fleet should not exceed 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 5 * D + 8 * E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $60.\n// PriceA >= 60; PriceB >= 60; PriceC >= 60\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of ProductA and 800 units of ProductB.\n// QuantityA >= 500; QuantityB >= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| ProductA | $50                     |\n| ProductB | $70                     |\n| ProductC | $90                     |\n\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC.\n\nThe company has the following constraints:\n1. The total production capacity of the company is 5000 units.\n2. The total marketing budget is $50,000.\n3. The price of each product must be at least $60.\n4. The company must produce at least 500 units of ProductA and 800 units of ProductB.\n\nPlease help the company to determine the optimal production quantity, selling price, and marketing investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=60) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=60) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=60) # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\n# The total marketing budget is $50,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n# The company must produce at least 500 units of ProductA and 800 units of ProductB.\nmodel.addCons(QuantityA >= 500)\nmodel.addCons(QuantityB >= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1403,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of workers to each production line to maximize efficiency while meeting production targets.\n// {\"number of workers on production line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate per worker. \nOn production line 1, each worker can produce 10 units of component 1 per hour. \nOn production line 2, each worker can produce 15 units of component 2 per hour. \nOn production line 3, each worker can produce 20 units of component 3 per hour. \nOn production line 4, each worker can produce 25 units of component 4 per hour.\nOn production line 5, each worker can produce 30 units of component 5 per hour.\nThe plant needs to produce at least 1000 units of each component daily. The goal is to minimize the total working hours required to meet these targets.\n// The total hours required for component 1: H1 = 1000 / (10 * W1)\n// The total hours required for component 2: H2 = 1000 / (15 * W2)\n// The total hours required for component 3: H3 = 1000 / (20 * W3)\n// The total hours required for component 4: H4 = 1000 / (25 * W4)\n// The total hours required for component 5: H5 = 1000 / (30 * W5)\n// So, the objective function is: Minimize max(H1, H2, H3, H4, H5)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 12 workers at a time.\n// W1 <= 12; W2 <= 12; W3 <= 12; W4 <= 12; W5 <= 12",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of workers to each production line to maximize efficiency while meeting production targets. Each production line has a different efficiency rate per worker: 10 units of component 1 per hour on line 1, 15 units of component 2 per hour on line 2, 20 units of component 3 per hour on line 3, 25 units of component 4 per hour on line 4, and 30 units of component 5 per hour on line 5. The plant needs to produce at least 1000 units of each component daily. The goal is to minimize the total working hours required to meet these targets. There are a total of 50 workers available, and each production line can be staffed by up to 12 workers at a time. Please help the plant manager to minimize the maximum of the total hours required for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production line 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on production line 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on production line 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nH1 = 1000 / (10 * W1)\nH2 = 1000 / (15 * W2)\nH3 = 1000 / (20 * W3)\nH4 = 1000 / (25 * W4)\nH5 = 1000 / (30 * W5)\n## the objective function is: Minimize max(H1, H2, H3, H4, H5)\n## convert the max function to a constraint\nmodel.addCons(obj >= H1)\nmodel.addCons(obj >= H2)\nmodel.addCons(obj >= H3)\nmodel.addCons(obj >= H4)\nmodel.addCons(obj >= H5)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\n## Each production line can be staffed by up to 12 workers at a time.\nmodel.addCons(W1 <= 12)\nmodel.addCons(W2 <= 12)\nmodel.addCons(W3 <= 12)\nmodel.addCons(W4 <= 12)\nmodel.addCons(W5 <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(W3))\n    print(\"Number of Workers on Production Line 4: \", model.getVal(W4))\n    print(\"Number of Workers on Production Line 5: \", model.getVal(W5))\n    print(\"Minimum Total Working Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device to optimize its profit. Additionally, the company must decide on the number of quality control checks to perform for each device type.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceA\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceB\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceC\": \"QC_C\", \"range\": \"QC_C >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceD\": \"QC_D\", \"range\": \"QC_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\nThe company aims to maximize the total profit per unit of production, considering both the production and quality control costs.\n// Profit of DeviceA: Profit_A = (100 - 60) * A - 5 * QC_A\n// Profit of DeviceB: Profit_B = (150 - 90) * B - 7 * QC_B\n// Profit of DeviceC: Profit_C = (200 - 120) * C - 9 * QC_C\n// Profit of DeviceD: Profit_D = (250 - 150) * D - 11 * QC_D\n// So, the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / (A + B + C + D))\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for quality control checks.\n// 5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device and the number of quality control checks to perform for each device type to optimize its profit. For DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5. For DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7. For DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9. For DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11. The company aims to maximize the total profit per unit of production, considering both the production and quality control costs. The company has a total budget of $10,000 for quality control checks. Please help the company to maximize the total profit per unit of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\nQC_A = model.addVar(vtype=\"INTEGER\", name=\"QC_A\", lb=0) # number of quality control checks for DeviceA\nQC_B = model.addVar(vtype=\"INTEGER\", name=\"QC_B\", lb=0) # number of quality control checks for DeviceB\nQC_C = model.addVar(vtype=\"INTEGER\", name=\"QC_C\", lb=0) # number of quality control checks for DeviceC\nQC_D = model.addVar(vtype=\"INTEGER\", name=\"QC_D\", lb=0) # number of quality control checks for DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * QC_A\nProfit_B = (150 - 90) * B - 7 * QC_B\nProfit_C = (200 - 120) * C - 9 * QC_C\nProfit_D = (250 - 150) * D - 11 * QC_D\nTotalProduction = A + B + C + D\n## the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / TotalProduction)\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for quality control checks.\nmodel.addCons(5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of QC checks for DeviceA: \", model.getVal(QC_A))\n    print(\"Number of QC checks for DeviceB: \", model.getVal(QC_B))\n    print(\"Number of QC checks for DeviceC: \", model.getVal(QC_C))\n    print(\"Number of QC checks for DeviceD: \", model.getVal(QC_D))\n    print(\"Maximized Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the cost per solar panel is $1000, the energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor D2, the cost per solar panel is $1200, the energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor D3, the cost per solar panel is $1100, the energy output per panel is 210 kWh, and the environmental impact score is 7.\nFor D4, the cost per solar panel is $900, the energy output per panel is 190 kWh, and the environmental impact score is 4.\nFor D5, the cost per solar panel is $1300, the energy output per panel is 230 kWh, and the environmental impact score is 8.\nThe city wants to minimize the Cost-Environmental Impact ratio of the installation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n// Total environmental impact score: Impact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000\n\n## Generate Constraint-2:\nThe city aims to generate at least 50,000 kWh of energy from the solar panels.\n// 200 * D1 + 220 * D2 + 210 * D3 + 190 * D4 + 230 * D5 >= 50000\n\n## Generate Constraint-3:\nEach district must have at least 10 solar panels installed.\n// D1 >= 10\n// D2 >= 10\n// D3 >= 10\n// D4 >= 10\n// D5 >= 10",
        "question": "A city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\nFor D1, the cost per solar panel is $1000, the energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor D2, the cost per solar panel is $1200, the energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor D3, the cost per solar panel is $1100, the energy output per panel is 210 kWh, and the environmental impact score is 7.\nFor D4, the cost per solar panel is $900, the energy output per panel is 190 kWh, and the environmental impact score is 4.\nFor D5, the cost per solar panel is $1300, the energy output per panel is 230 kWh, and the environmental impact score is 8.\nThe city has a budget of $100,000 for the installation of solar panels. The city aims to generate at least 50,000 kWh of energy from the solar panels. Each district must have at least 10 solar panels installed.\nPlease help the city to minimize the Cost-Environmental Impact ratio of the installation (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=10) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=10) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=10) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=10) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=10) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\nImpact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000)\n## The city aims to generate at least 50,000 kWh of energy from the solar panels.\nmodel.addCons(200 * D1 + 220 * D2 + 210 * D3 + 190 * D4 + 230 * D5 >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by small trucks per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by medium trucks per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by large trucks per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for small trucks is $0.5, medium trucks is $0.7, and large trucks is $0.9. The maintenance cost per day for small trucks is $100, medium trucks is $150, and large trucks is $200. The company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs.\n// FuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\n// FuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\n// FuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\n// MaintenanceCostSmall = 100 * SmallTrucks\n// MaintenanceCostMedium = 150 * MediumTrucks\n// MaintenanceCostLarge = 200 * LargeTrucks\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n## Generate Constraint-1:\nThe total distance traveled by all trucks must not exceed 5000 kilometers per day.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 per day for fuel costs.\n// 0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000\n\n## Generate Constraint-3:\nThe company can only afford to maintain a maximum of 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50\n\n## Generate Constraint-4:\nThe company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks >= 2000\n\n## Generate Constraint-5:\nThe company prefers to use more fuel-efficient trucks if possible.\n// DistanceSmall * SmallTrucks >= DistanceMedium * MediumTrucks\n// DistanceMedium * MediumTrucks >= DistanceLarge * LargeTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs.\nThe fuel cost per kilometer for small trucks is $0.5, medium trucks is $0.7, and large trucks is $0.9. The maintenance cost per day for small trucks is $100, medium trucks is $150, and large trucks is $200. The company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs.\nThe total distance traveled by all trucks must not exceed 5000 kilometers per day. The company has a budget of $2000 per day for fuel costs. The company can only afford to maintain a maximum of 50 trucks in total. The company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements. The company prefers to use more fuel-efficient trucks if possible.\nPlease help the company to minimize the total daily operational cost, which includes both fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nDistanceSmall = model.addVar(name=\"DistanceSmall\", lb=0)  # distance traveled by small trucks per day\nDistanceMedium = model.addVar(name=\"DistanceMedium\", lb=0)  # distance traveled by medium trucks per day\nDistanceLarge = model.addVar(name=\"DistanceLarge\", lb=0)  # distance traveled by large trucks per day\n\n# Define objective function\nFuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\nFuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\nFuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\nMaintenanceCostSmall = 100 * SmallTrucks\nMaintenanceCostMedium = 150 * MediumTrucks\nMaintenanceCostLarge = 200 * LargeTrucks\n# So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n# Add constraints\n# The total distance traveled by all trucks must not exceed 5000 kilometers per day.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000)\n# The company has a budget of $2000 per day for fuel costs.\nmodel.addCons(0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000)\n# The company can only afford to maintain a maximum of 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n# The company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks >= 2000)\n# The company prefers to use more fuel-efficient trucks if possible.\nmodel.addCons(DistanceSmall * SmallTrucks >= DistanceMedium * MediumTrucks)\nmodel.addCons(DistanceMedium * MediumTrucks >= DistanceLarge * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Distance Traveled by Small Trucks: \", model.getVal(DistanceSmall))\n    print(\"Distance Traveled by Medium Trucks: \", model.getVal(DistanceMedium))\n    print(\"Distance Traveled by Large Trucks: \", model.getVal(DistanceLarge))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1257,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Region 1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in fuel-efficient technology. The more invested, the less fuel each truck consumes per kilometer. The relationship is nonlinear, with diminishing returns as more technology is applied. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region 1: Fuel1 = (100 - 0.05 * Tech1^2) * Trucks1\n// Fuel consumption for Region 2: Fuel2 = (120 - 0.06 * Tech2^2) * Trucks2\n// Fuel consumption for Region 3: Fuel3 = (110 - 0.04 * Tech3^2) * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region and the investment in fuel-efficient technologies for each region to minimize fuel consumption and operational costs. The fuel consumption of each truck is affected by the investment in fuel-efficient technology, with a nonlinear relationship where more investment leads to less fuel consumption per kilometer, but with diminishing returns. The company aims to minimize the total fuel consumption across all regions. The company has a total budget of $100,000 for truck allocation and technology investments.\n\nPlease help the company to determine the optimal allocation of trucks and investments in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Region 1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Region 2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for Region 3\n\n# Define objective function\nFuel1 = (100 - 0.05 * Tech1**2) * Trucks1\nFuel2 = (120 - 0.06 * Tech2**2) * Trucks2\nFuel3 = (110 - 0.04 * Tech3**2) * Trucks3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech1: \", model.getVal(Tech1))\n    print(\"Investment in Tech2: \", model.getVal(Tech2))\n    print(\"Investment in Tech3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Van C\": \"VanC\", \"range\": \"VanC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle E\": \"MotorcycleE\", \"range\": \"MotorcycleE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $50,000 per year, and it can carry 20 tons. Truck B costs $40,000 per year, carrying 15 tons. Van C costs $30,000 per year, carrying 5 tons. Van D costs $25,000 per year, carrying 3 tons. Motorcycle E costs $10,000 per year, carrying 1 ton. The company wants to minimize the total operating cost while maximizing the total carrying capacity. The objective is to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost.\n// Total carrying capacity: Capacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\n// Total operating cost: Cost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n// So, the objective function is: Maximize Capacity / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle operations.\n// 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 1000 tons.\n// 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE >= 1000\n\n## Generate Constraint-3:\nThe company must have at least 10 vehicles in total.\n// TruckA + TruckB + VanC + VanD + MotorcycleE >= 10\n\n## Generate Constraint-4:\nThe number of Truck A cannot exceed 10.\n// TruckA <= 10",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes. The operating cost and carrying capacity for each vehicle are given in the following Table.\n\n| Vehicle     | Operating Cost per Year | Carrying Capacity |\n|-------------|------------------------|-------------------|\n| Truck A     | $50,000                 | 20 tons           |\n| Truck B     | $40,000                 | 15 tons           |\n| Van C       | $30,000                 | 5 tons            |\n| Van D       | $25,000                 | 3 tons            |\n| Motorcycle E| $10,000                 | 1 ton             |\n\nThe company has a budget of $1,000,000 for vehicle operations. The total carrying capacity must be at least 1000 tons. The company must have at least 10 vehicles in total. The number of Truck A cannot exceed 10.\n\nPlease help the company to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nVanC = model.addVar(vtype=\"INTEGER\", name=\"VanC\", lb=0)\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0)\nMotorcycleE = model.addVar(vtype=\"INTEGER\", name=\"MotorcycleE\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\nCost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n## the objective function is: Maximize Capacity / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Capacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle operations.\nmodel.addCons(50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000)\n## The total carrying capacity must be at least 1000 tons.\nmodel.addCons(20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE >= 1000)\n## The company must have at least 10 vehicles in total.\nmodel.addCons(TruckA + TruckB + VanC + VanD + MotorcycleE >= 10)\n## The number of Truck A cannot exceed 10.\nmodel.addCons(TruckA <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Van C: \", model.getVal(VanC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Motorcycle E: \", model.getVal(MotorcycleE))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineD_units\", \"range\": \"MachineD_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 + 0.01 * (MachineA_units)^2, Cost_B = 300 + 0.015 * (MachineB_units)^2, Cost_C = 400 + 0.02 * (MachineC_units)^2, Cost_D = 500 + 0.025 * (MachineD_units)^2. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_A = (500 - Cost_A) * MachineA_units = (500 - (200 + 0.01 * (MachineA_units)^2)) * MachineA_units\n// Total profit for MachineB: Profit_B = (700 - Cost_B) * MachineB_units = (700 - (300 + 0.015 * (MachineB_units)^2)) * MachineB_units\n// Total profit for MachineC: Profit_C = (900 - Cost_C) * MachineC_units = (900 - (400 + 0.02 * (MachineC_units)^2)) * MachineC_units\n// Total profit for MachineD: Profit_D = (1100 - Cost_D) * MachineD_units = (1100 - (500 + 0.025 * (MachineD_units)^2)) * MachineD_units\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\n// MachineB_units >= 0.5 * MachineA_units",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit. The profit per unit for each machine and the production cost function for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| MachineA | $500           | 200 + 0.01 * (MachineA_units)^2 |\n| MachineB | $700           | 300 + 0.015 * (MachineB_units)^2 |\n| MachineC | $900           | 400 + 0.02 * (MachineC_units)^2 |\n| MachineD | $1100          | 500 + 0.025 * (MachineD_units)^2 |\n\nThe company has a total production capacity of 100 units for the month. Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA. The company wants to maximize the total profit.\n\nPlease help the company determine the optimal number of units to produce for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0)\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0)\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0)\nMachineD_units = model.addVar(vtype=\"INTEGER\", name=\"MachineD_units\", lb=0)\n\n# Define objective function\nCost_A = 200 + 0.01 * MachineA_units**2\nCost_B = 300 + 0.015 * MachineB_units**2\nCost_C = 400 + 0.02 * MachineC_units**2\nCost_D = 500 + 0.025 * MachineD_units**2\n\nProfit_A = (500 - Cost_A) * MachineA_units\nProfit_B = (700 - Cost_B) * MachineB_units\nProfit_C = (900 - Cost_C) * MachineC_units\nProfit_D = (1100 - Cost_D) * MachineD_units\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100)\nmodel.addCons(MachineB_units >= 0.5 * MachineA_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Number of MachineD units: \", model.getVal(MachineD_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. \nFor S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. \nFor S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60.\nFor S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70.\nThe manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_S1 = 100 * S1 - 40 * S1\n// Profit_S2 = 120 * S2 - 50 * S2\n// Profit_S3 = 140 * S3 - 60 * S3\n// Profit_S4 = 160 * S4 - 70 * S4\n// So, the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / (1 * S1 + 2 * S2 + 3 * S3 + 4 * S4)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production time of 200 hours.\n// 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $10000 for material costs.\n// 40 * S1 + 50 * S2 + 60 * S3 + 70 * S4 <= 10000",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce.\nFor S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. \nFor S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. \nFor S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60.\nFor S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70.\nThe manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer has a limited production time of 200 hours and a budget of $10000 for material costs.\nPlease help the manufacturer to maximize the profit efficiency (profit per hour of production time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # quantity of S3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # quantity of S4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S1 = (100 - 40) * S1\nProfit_S2 = (120 - 50) * S2\nProfit_S3 = (140 - 60) * S3\nProfit_S4 = (160 - 70) * S4\nProductionTime = 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4\n## the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4)\n\n# Add constraints\n## The manufacturer has a limited production time of 200 hours.\nmodel.addCons(1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200)\n## The manufacturer has a budget of $10000 for material costs.\nmodel.addCons(40 * S1 + 50 * S2 + 60 * S3 + 70 * S4 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Quantity of S4: \", model.getVal(S4))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone A\": \"ZoneA\", \"range\": \"ZoneA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"ZoneB\", \"range\": \"ZoneB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"ZoneC\", \"range\": \"ZoneC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"ZoneD\", \"range\": \"ZoneD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"ZoneE\", \"range\": \"ZoneE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost.\n// Total energy production: Energy = 80% * ZoneA + 75% * ZoneB + 70% * ZoneC + 65% * ZoneD + 60% * ZoneE\n// Total installation cost: Cost = $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE <= $100000\n\n## Generate Constraint-2:\nThere is a maximum capacity of 100 panels that can be installed in each zone.\n// ZoneA <= 100\n// ZoneB <= 100\n// ZoneC <= 100\n// ZoneD <= 100\n// ZoneE <= 100\n\n## Generate Constraint-3:\nThe city requires at least 300 panels to be installed across all zones.\n// ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300\n\n## Generate Constraint-4:\nThe city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone A.\n// $1000 * ZoneA >= 0.2 * $100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs. The efficiency of solar panels and the cost per panel installation in each zone are given in the following Table.\n\n| Zone   | Efficiency | Cost per Panel Installation |\n|--------|------------|-----------------------------|\n| Zone A | 80%        | $1000                       |\n| Zone B | 75%        | $1200                       |\n| Zone C | 70%        | $1400                       |\n| Zone D | 65%        | $1600                       |\n| Zone E | 60%        | $1800                       |\n\nThe city has a budget of $100,000 for the installation of solar panels. There is a maximum capacity of 100 panels that can be installed in each zone. The city requires at least 300 panels to be installed across all zones. The city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone A.\n\nPlease help the city to maximize the total energy production while minimizing the total installation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA = model.addVar(vtype=\"INTEGER\", name=\"ZoneA\", lb=0)\nZoneB = model.addVar(vtype=\"INTEGER\", name=\"ZoneB\", lb=0)\nZoneC = model.addVar(vtype=\"INTEGER\", name=\"ZoneC\", lb=0)\nZoneD = model.addVar(vtype=\"INTEGER\", name=\"ZoneD\", lb=0)\nZoneE = model.addVar(vtype=\"INTEGER\", name=\"ZoneE\", lb=0)\n\n# Define objective function\nEnergy = 0.8 * ZoneA + 0.75 * ZoneB + 0.7 * ZoneC + 0.65 * ZoneD + 0.6 * ZoneE\nCost = 1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\nmodel.addCons(1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE <= 100000)\nmodel.addCons(ZoneA <= 100)\nmodel.addCons(ZoneB <= 100)\nmodel.addCons(ZoneC <= 100)\nmodel.addCons(ZoneD <= 100)\nmodel.addCons(ZoneE <= 100)\nmodel.addCons(ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300)\nmodel.addCons(1000 * ZoneA >= 0.2 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(ZoneA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(ZoneB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(ZoneC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(ZoneD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(ZoneE))\n    print(\"Maximized Energy - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different vehicles (V1, V2, V3, V4, V5) to minimize fuel consumption and travel time. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption of V1\": \"FuelV1\", \"range\": \"FuelV1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V2\": \"FuelV2\", \"range\": \"FuelV2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V3\": \"FuelV3\", \"range\": \"FuelV3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V4\": \"FuelV4\", \"range\": \"FuelV4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V5\": \"FuelV5\", \"range\": \"FuelV5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nVehicle V1 consumes fuel at a rate of 0.1 liters per kilometer and travels at a speed of 60 km/h.\nVehicle V2 consumes fuel at a rate of 0.12 liters per kilometer and travels at a speed of 55 km/h.\nVehicle V3 consumes fuel at a rate of 0.15 liters per kilometer and travels at a speed of 50 km/h.\nVehicle V4 consumes fuel at a rate of 0.18 liters per kilometer and travels at a speed of 45 km/h.\nVehicle V5 consumes fuel at a rate of 0.2 liters per kilometer and travels at a speed of 40 km/h.\nThe company wants to minimize the total fuel consumption and travel time for all vehicles.\n// Total fuel consumption: Fuel = 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5\n// Total travel time: Time = FuelV1 / 60 + FuelV2 / 55 + FuelV3 / 50 + FuelV4 / 45 + FuelV5 / 40\n// So, the objective function is: Minimize (Fuel + Time)\n\n## Generate Constraint-1:\nThe total distance covered by all vehicles must not exceed 5000 kilometers.\n// FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5 <= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs. The cost of fuel is $1 per liter.\n// 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5 <= 10000",
        "question": "A logistics company is planning its routes for five different vehicles (V1, V2, V3, V4, V5) to minimize fuel consumption and travel time. Each vehicle has a different fuel efficiency and speed. Vehicle V1 consumes fuel at a rate of 0.1 liters per kilometer and travels at a speed of 60 km/h. Vehicle V2 consumes fuel at a rate of 0.12 liters per kilometer and travels at a speed of 55 km/h. Vehicle V3 consumes fuel at a rate of 0.15 liters per kilometer and travels at a speed of 50 km/h. Vehicle V4 consumes fuel at a rate of 0.18 liters per kilometer and travels at a speed of 45 km/h. Vehicle V5 consumes fuel at a rate of 0.2 liters per kilometer and travels at a speed of 40 km/h. The company wants to minimize the total fuel consumption and travel time for all vehicles. The total distance covered by all vehicles must not exceed 5000 kilometers. The company has a budget of $10,000 for fuel costs, with the cost of fuel being $1 per liter. Please help the company to minimize the total fuel consumption and travel time for all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFuelV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV1\", lb=0) # fuel consumption of V1\nFuelV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV2\", lb=0) # fuel consumption of V2\nFuelV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV3\", lb=0) # fuel consumption of V3\nFuelV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV4\", lb=0) # fuel consumption of V4\nFuelV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV5\", lb=0) # fuel consumption of V5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel = 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5\nTime = FuelV1 / 60 + FuelV2 / 55 + FuelV3 / 50 + FuelV4 / 45 + FuelV5 / 40\n## the objective function is: Minimize (Fuel + Time)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel + Time)\n\n# Add constraints\n## The total distance covered by all vehicles must not exceed 5000 kilometers.\nmodel.addCons(FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5 <= 5000)\n## The company has a budget of $10,000 for fuel costs. The cost of fuel is $1 per liter.\nmodel.addCons(0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption of V1: \", model.getVal(FuelV1))\n    print(\"Fuel Consumption of V2: \", model.getVal(FuelV2))\n    print(\"Fuel Consumption of V3: \", model.getVal(FuelV3))\n    print(\"Fuel Consumption of V4: \", model.getVal(FuelV4))\n    print(\"Fuel Consumption of V5: \", model.getVal(FuelV5))\n    print(\"Minimized Fuel and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Truck Type 1\": \"Efficiency_1\", \"range\": \"Efficiency_1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of Truck Type 2\": \"Efficiency_2\", \"range\": \"Efficiency_2 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency of the trucks used.\n// Fuel_Consumption = (Trucks_A / Efficiency_1)^2 + (Trucks_B / Efficiency_2)^2 + (Trucks_C / Efficiency_1)^2\n// Profit_A = 1000 * Trucks_A - Fuel_Consumption_A\n// Profit_B = 1500 * Trucks_B - Fuel_Consumption_B\n// Profit_C = 2000 * Trucks_C - Fuel_Consumption_C\n// So, the objective function is: Minimize Fuel_Consumption and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n\n| Variable                | Description                          |\n|-------------------------|--------------------------------------|\n| Trucks_A                | Number of trucks for Route A         |\n| Trucks_B                | Number of trucks for Route B         |\n| Trucks_C                | Number of trucks for Route C         |\n| Efficiency_1            | Fuel efficiency of Truck Type 1      |\n| Efficiency_2            | Fuel efficiency of Truck Type 2      |\n\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency of the trucks used. The company has a total of 50 trucks available.\n\nPlease help the company to minimize the total fuel consumption and maximize the sum of profits from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nEfficiency_1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_1\", lb=0.0001)  # fuel efficiency of Truck Type 1\nEfficiency_2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_2\", lb=0.0001)  # fuel efficiency of Truck Type 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption = (Trucks_A / Efficiency_1)**2 + (Trucks_B / Efficiency_2)**2 + (Trucks_C / Efficiency_1)**2\nProfit_A = 1000 * Trucks_A - Fuel_Consumption\nProfit_B = 1500 * Trucks_B - Fuel_Consumption\nProfit_C = 2000 * Trucks_C - Fuel_Consumption\n## the objective function is: Minimize Fuel_Consumption and Maximize (Profit_A + Profit_B + Profit_C)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption - (Profit_A + Profit_B + Profit_C))\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency of Truck Type 1: \", model.getVal(Efficiency_1))\n    print(\"Fuel Efficiency of Truck Type 2: \", model.getVal(Efficiency_2))\n    print(\"Minimized Fuel Consumption and Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"units of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"units of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company wants to maximize the total profit from all products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 hours. Producing one unit of A requires 2 hours, B requires 3 hours, C requires 2.5 hours, D requires 4 hours, and E requires 3.5 hours.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500\n\n## Generate Constraint-2:\nThe market demand for each product is limited. The maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100.\n// A <= 200\n// B <= 300\n// C <= 250\n// D <= 150\n// E <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of each product to maintain customer relationships.\n// A >= 50\n// B >= 50\n// C >= 50\n// D >= 50\n// E >= 50",
        "question": "A company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company has a total production capacity of 1500 hours. Producing one unit of A requires 2 hours, B requires 3 hours, C requires 2.5 hours, D requires 4 hours, and E requires 3.5 hours. The market demand for each product is limited. The maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100. The company must produce at least 50 units of each product to maintain customer relationships. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=200) # units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=300) # units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=250) # units of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50, ub=150) # units of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50, ub=100) # units of product E produced\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A: \", model.getVal(A))\n    print(\"Units of Product B: \", model.getVal(B))\n    print(\"Units of Product C: \", model.getVal(C))\n    print(\"Units of Product D: \", model.getVal(D))\n    print(\"Units of Product E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in miles per gallon (mpg).\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"SmallTruckFuelEfficiency\", \"range\": \"SmallTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"MediumTruckFuelEfficiency\", \"range\": \"MediumTruckFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"LargeTruckFuelEfficiency\", \"range\": \"LargeTruckFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year.\n// FuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\n// FuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\n// FuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs.\n// LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks)\n\n## Generate Constraint-4:\nThe fuel efficiency of medium trucks must be at least 10% better than that of small trucks.\n// MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency\n\n## Generate Constraint-5:\nThe fuel efficiency of large trucks must be at least 20% better than that of medium trucks.\n// LargeTruckFuelEfficiency >= 1.2 * MediumTruckFuelEfficiency",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in miles per gallon (mpg). The company aims to minimize the total annual fuel cost, which is dependent on the number of trucks and their respective fuel efficiencies. The cost of fuel is $3 per gallon, and each truck travels an average of 10,000 miles per year. The company has a budget of $1,000,000 for purchasing trucks. The total number of trucks cannot exceed 20. The company must ensure that at least 30% of the fleet is composed of large trucks for heavy-duty transport needs. The fuel efficiency of medium trucks must be at least 10% better than that of small trucks. The fuel efficiency of large trucks must be at least 20% better than that of medium trucks.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks to purchase, as well as their respective fuel efficiencies, to minimize the total annual fuel cost while meeting all the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallTruckFuelEfficiency\", lb=0.001)\nMediumTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTruckFuelEfficiency\", lb=0.001)\nLargeTruckFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeTruckFuelEfficiency\", lb=0.001)\n\n# Define objective function\nFuelCost_Small = (10000 / SmallTruckFuelEfficiency) * SmallTrucks * 3\nFuelCost_Medium = (10000 / MediumTruckFuelEfficiency) * MediumTrucks * 3\nFuelCost_Large = (10000 / LargeTruckFuelEfficiency) * LargeTrucks * 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n# Add constraints\nmodel.addCons(SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\nmodel.addCons(LargeTrucks >= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks))\nmodel.addCons(MediumTruckFuelEfficiency >= 1.1 * SmallTruckFuelEfficiency)\nmodel.addCons(LargeTruckFuelEfficiency >= 1.2 * MediumTruckFuelEfficiency)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumTruckFuelEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeTruckFuelEfficiency))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route 1 has a cost of $2 per km and an average speed of 60 km/h. Route 2 has a cost of $3 per km and an average speed of 50 km/h. Route 3 has a cost of $2.5 per km and an average speed of 55 km/h. Route 4 has a cost of $3.5 per km and an average speed of 45 km/h. Route 5 has a cost of $4 per km and an average speed of 40 km/h. The company aims to minimize the total cost of operations while ensuring that the total delivery time does not exceed 10 hours.\n// Total cost = 2 * T1 * D1 + 3 * T2 * D2 + 2.5 * T3 * D3 + 3.5 * T4 * D4 + 4 * T5 * D5\n// Total time = (D1 / 60) * T1 + (D2 / 50) * T2 + (D3 / 55) * T3 + (D4 / 45) * T4 + (D5 / 40) * T5\n// Objective function: Minimize Total cost + (Total time - 10)^2\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe total distance covered by all trucks should not exceed 5000 km.\n// D1 * T1 + D2 * T2 + D3 * T3 + D4 * T4 + D5 * T5 <= 5000",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. Each route has a different cost per kilometer and a different average speed. Route 1 has a cost of $2 per km and an average speed of 60 km/h. Route 2 has a cost of $3 per km and an average speed of 50 km/h. Route 3 has a cost of $2.5 per km and an average speed of 55 km/h. Route 4 has a cost of $3.5 per km and an average speed of 45 km/h. Route 5 has a cost of $4 per km and an average speed of 40 km/h. The company aims to minimize the total cost of operations while ensuring that the total delivery time does not exceed 10 hours. The company has a total of 100 trucks available for allocation, and each route can handle a maximum of 30 trucks. The total distance covered by all trucks should not exceed 5000 km. Please help the company to minimize the total cost of operations while ensuring that the total delivery time does not exceed 10 hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance for route 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance for route 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance for route 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance for route 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance for route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_cost = 2 * T1 * D1 + 3 * T2 * D2 + 2.5 * T3 * D3 + 3.5 * T4 * D4 + 4 * T5 * D5\nTotal_time = (D1 / 60) * T1 + (D2 / 50) * T2 + (D3 / 55) * T3 + (D4 / 45) * T4 + (D5 / 40) * T5\n## the objective function is: Minimize Total_cost + (Total_time - 10)^2\n## convert the square to multiplication\nmodel.addCons(obj == Total_cost + (Total_time - 10) * (Total_time - 10))\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route can handle a maximum of 30 trucks.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n## The total distance covered by all trucks should not exceed 5000 km.\nmodel.addCons(D1 * T1 + D2 * T2 + D3 * T3 + D4 * T4 + D5 * T5 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit and the required storage space for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| P1      | $30             | 2 square meters       |\n| P2      | $40             | 3 square meters       |\n| P3      | $50             | 4 square meters       |\n\nThe company has a limited storage space of 200 square meters. The company also has a budget of $3000 for purchasing the products. Please help the company to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost for Trucks is $100 per day, for Vans is $70 per day, and for Bikes is $30 per day. The delivery efficiency (measured in deliveries per day) for Trucks is 10, for Vans is 15, and for Bikes is 20. The company aims to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n// Efficiency_Trucks = 10 * Trucks / 100\n// Efficiency_Vans = 15 * Vans / 70\n// Efficiency_Bikes = 20 * Bikes / 30\n// So, the objective function is: Maximize (Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $3000 per day for fuel and maintenance costs.\n// 100 * Trucks + 70 * Vans + 30 * Bikes <= 3000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost for Trucks is $100 per day, for Vans is $70 per day, and for Bikes is $30 per day. The delivery efficiency (measured in deliveries per day) for Trucks is 10, for Vans is 15, and for Bikes is 20. The company aims to maximize the delivery efficiency per dollar spent on fuel and maintenance. The company has a budget of $3000 per day for fuel and maintenance costs. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize the delivery efficiency per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Trucks = 10 * Trucks / 100\nEfficiency_Vans = 15 * Vans / 70\nEfficiency_Bikes = 20 * Bikes / 30\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n# Add constraints\n## The company has a budget of $3000 per day for fuel and maintenance costs.\nmodel.addCons(100 * Trucks + 70 * Vans + 30 * Bikes <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Delivery Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. \nEach truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. \nEach truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. \nEach truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. \nEach truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. \nThe company aims to minimize the total fuel consumption per package delivered.\n// Fuel consumption of route 1: FC1 = 10 * T1\n// Fuel consumption of route 2: FC2 = 15 * T2\n// Fuel consumption of route 3: FC3 = 20 * T3\n// Fuel consumption of route 4: FC4 = 25 * T4\n// Fuel consumption of route 5: FC5 = 30 * T5\n// Total packages delivered: TP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. Each truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. Each truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. Each truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. Each truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. The company aims to minimize the total fuel consumption per package delivered. The company has a total of 100 trucks available. Each route must have at least 5 trucks. Please help the company to minimize the total fuel consumption per package delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 5 trucks.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC1 = 10 * T1\nFC2 = 15 * T2\nFC3 = 20 * T3\nFC4 = 25 * T4\nFC5 = 30 * T5\nTP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n## the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n## convert the division to multiplication\nmodel.addCons(obj * TP == FC1 + FC2 + FC3 + FC4 + FC5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs, but the investment cost is significant.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost for ProductA is $100, for ProductB is $150, for ProductC is $200, and for ProductD is $250. The selling price for each product is $200 for ProductA, $250 for ProductB, $300 for ProductC, and $350 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n// Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvestment <= 100000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and whether to invest in a new technology that could reduce production costs. The investment cost for the new technology is significant. The production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost and selling price for each product are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| ProductA | $100                    | $200          |\n| ProductB | $150                    | $250          |\n| ProductC | $200                    | $300          |\n| ProductD | $250                    | $350          |\n\nThe company has a budget of $100,000 for the investment in the new technology. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities for each product and the amount to invest in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of ProductD\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n## Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n## Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n## Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\nProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\nProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\nProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\nProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Quantity of ProductD: \", model.getVal(D))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit. The company has a total production capacity of 1000 units per month. Please help the company determine the optimal number of units of each product to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 630,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The efficiency of each route, measured in deliveries per hour, is 20 for route 1, 25 for route 2, 30 for route 3, 28 for route 4, and 22 for route 5. The company wants to maximize the total deliveries per dollar spent.\n// Efficiency_Route1 = 20 * T1 / 1000\n// Efficiency_Route2 = 25 * T2 / 1200\n// Efficiency_Route3 = 30 * T3 / 1500\n// Efficiency_Route4 = 28 * T4 / 1300\n// Efficiency_Route5 = 22 * T5 / 1400\n// So, the objective function is: Maximize Efficiency_Route1 + Efficiency_Route2 + Efficiency_Route3 + Efficiency_Route4 + Efficiency_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 28 trucks, and route 5 up to 22 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 28; T5 <= 22",
        "question": "A logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and efficiency. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The efficiency of each route, measured in deliveries per hour, is 20 for route 1, 25 for route 2, 30 for route 3, 28 for route 4, and 22 for route 5. The company wants to maximize the total deliveries per dollar spent. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 28 trucks, and route 5 up to 22 trucks. Please help the company to maximize the total deliveries per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Route1 = 20 * T1 / 1000\nEfficiency_Route2 = 25 * T2 / 1200\nEfficiency_Route3 = 30 * T3 / 1500\nEfficiency_Route4 = 28 * T4 / 1300\nEfficiency_Route5 = 22 * T5 / 1400\n## convert the division to multiplication\nmodel.addCons(obj * 1000 == 20 * T1)\nmodel.addCons(obj * 1200 == 25 * T2)\nmodel.addCons(obj * 1500 == 30 * T3)\nmodel.addCons(obj * 1300 == 28 * T4)\nmodel.addCons(obj * 1400 == 22 * T5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 28)\nmodel.addCons(T5 <= 22)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type.\n// {\"number of trucks for Goods A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Goods A (km/liter)\": \"EfficiencyA\", \"range\": \"EfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods B (km/liter)\": \"EfficiencyB\", \"range\": \"EfficiencyB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods C (km/liter)\": \"EfficiencyC\", \"range\": \"EfficiencyC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency.\n// FuelCostA = 3 * (DistanceA / EfficiencyA) * TrucksA\n// FuelCostB = 3 * (DistanceB / EfficiencyB) * TrucksB\n// FuelCostC = 3 * (DistanceC / EfficiencyC) * TrucksC\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $2000 for daily fuel expenses.\n// (DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks that can be used daily.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-3:\nThe total distance that can be covered by all trucks daily is limited to 10000 km.\n// DistanceA * TrucksA / EfficiencyA + DistanceB * TrucksB / EfficiencyB + DistanceC * TrucksC / EfficiencyC <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type. The cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency. The company has a total budget of $2000 for daily fuel expenses. The company has a limit of 50 trucks that can be used daily. The total distance that can be covered by all trucks daily is limited to 10000 km.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total fuel cost per day.\n\n| Goods | Number of Trucks | Fuel Efficiency (km/liter) | Distance Traveled (km) |\n|-------|------------------|----------------------------|-------------------------|\n| A     | TrucksA          | EfficiencyA                | DistanceA               |\n| B     | TrucksB          | EfficiencyB                | DistanceB               |\n| C     | TrucksC          | EfficiencyC                | DistanceC               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Goods A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Goods B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Goods C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceA = model.addVar(name=\"DistanceA\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods A\nDistanceB = model.addVar(name=\"DistanceB\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods B\nDistanceC = model.addVar(name=\"DistanceC\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods C\nEfficiencyA = model.addVar(name=\"EfficiencyA\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods A\nEfficiencyB = model.addVar(name=\"EfficiencyB\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods B\nEfficiencyC = model.addVar(name=\"EfficiencyC\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods C\n\n## the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n## convert the division to multiplication\nmodel.addCons(obj == 3 * (DistanceA / EfficiencyA) * TrucksA + 3 * (DistanceB / EfficiencyB) * TrucksB + 3 * (DistanceC / EfficiencyC) * TrucksC)\n\n# Add constraints\n## The company has a total budget of $2000 for daily fuel expenses.\nmodel.addCons((DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3)\n## The company has a limit of 50 trucks that can be used daily.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## The total distance that can be covered by all trucks daily is limited to 10000 km.\nmodel.addCons(DistanceA * TrucksA / EfficiencyA + DistanceB * TrucksB / EfficiencyB + DistanceC * TrucksC / EfficiencyC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for TypeA\": \"TurbinesA\", \"range\": \"TurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeB\": \"TurbinesB\", \"range\": \"TurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeC\": \"TurbinesC\", \"range\": \"TurbinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TypeA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms.\n// EnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\n// EnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\n// EnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n// So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for turbine installation and maintenance investments.\n// 10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000\n\n## Generate Constraint-2:\nThe total number of turbines that can be installed is limited to 100.\n// TurbinesA + TurbinesB + TurbinesC <= 100",
        "question": "A renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment, with each $1000 investment for TypeA increasing the output by 1 MWh, for TypeB by 1.5 MWh, and for TypeC by 1.2 MWh. The company aims to maximize the total energy output from all wind farms.\n\n| Wind Farm Type | Energy Output per $1000 Investment |\n|----------------|-----------------------------------|\n| TypeA          | 1 MWh                             |\n| TypeB          | 1.5 MWh                           |\n| TypeC          | 1.2 MWh                           |\n\nThe company has a total budget of $100,000 for turbine installation and maintenance investments. The total number of turbines that can be installed is limited to 100.\n\nPlease help the company to maximize the total energy output from all wind farms while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"TurbinesA\", lb=0)  # number of turbines for TypeA\nTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"TurbinesB\", lb=0)  # number of turbines for TypeB\nTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"TurbinesC\", lb=0)  # number of turbines for TypeC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance investment for TypeA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance investment for TypeB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance investment for TypeC\n\n# Define objective function\nEnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\nEnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\nEnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n# So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n# Add constraints\n# The company has a total budget of $100,000 for turbine installation and maintenance investments.\nmodel.addCons(10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000)\n# The total number of turbines that can be installed is limited to 100.\nmodel.addCons(TurbinesA + TurbinesB + TurbinesC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for TypeA: \", model.getVal(TurbinesA))\n    print(\"Number of Turbines for TypeB: \", model.getVal(TurbinesB))\n    print(\"Number of Turbines for TypeC: \", model.getVal(TurbinesC))\n    print(\"Maintenance Investment for TypeA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TypeB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TypeC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and drones. The company needs to optimize its production to maximize profit while considering various constraints.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of drones produced\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets $150, laptops $200, smartwatches $50, and drones $300. The company wants to maximize the total profit from all devices.\n// Total profit: Profit = 100 * Smartphones + 150 * Tablets + 200 * Laptops + 50 * Smartwatches + 300 * Drones\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000. The cost to produce each smartphone is $50, tablet $75, laptop $100, smartwatch $25, and drone $150.\n// 50 * Smartphones + 75 * Tablets + 100 * Laptops + 25 * Smartwatches + 150 * Drones <= 100000\n\n## Generate Constraint-2:\nThe company has a limited supply of a critical component used in all devices. The supply is enough for 1000 devices in total.\n// Smartphones + Tablets + Laptops + Smartwatches + Drones <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 200 units of each device are produced to meet the minimum market demand.\n// Smartphones >= 200\n// Tablets >= 200\n// Laptops >= 200\n// Smartwatches >= 200\n// Drones >= 200",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and drones. The company needs to optimize its production to maximize profit while considering various constraints. The profit per unit and the cost to produce each device are given in the following Table.\n\n| Device       | Profit per Unit | Cost to Produce |\n|--------------|-----------------|-----------------|\n| Smartphones  | $100            | $50             |\n| Tablets      | $150            | $75             |\n| Laptops      | $200            | $100            |\n| Smartwatches | $50             | $25             |\n| Drones       | $300            | $150            |\n\nThe company has a total production budget of $100,000. The company also has a limited supply of a critical component used in all devices, which is enough for 1000 devices in total. The company wants to ensure that at least 200 units of each device are produced to meet the minimum market demand.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=200)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=200)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=200)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=200)  # number of smartwatches produced\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=200)  # number of drones produced\n\n# Define objective function\nProfit = 100 * Smartphones + 150 * Tablets + 200 * Laptops + 50 * Smartwatches + 300 * Drones\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(50 * Smartphones + 75 * Tablets + 100 * Laptops + 25 * Smartwatches + 150 * Drones <= 100000)\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Drones <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential.\n// {\"number of solar panels in Urban zone\": \"Urban\", \"range\": \"Urban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Suburban zone\": \"Suburban\", \"range\": \"Suburban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Industrial zone\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Commercial zone\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Residential zone\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sun exposure and building heights. In Urban, the efficiency is 80%, in Suburban it's 90%, in Industrial it's 75%, in Commercial it's 85%, and in Residential it's 95%. The cost of installation per panel also varies: $1000 in Urban, $900 in Suburban, $1100 in Industrial, $1050 in Commercial, and $850 in Residential. The city aims to maximize the energy output per dollar spent.\n// Energy_Urban = 0.8 * Urban\n// Energy_Suburban = 0.9 * Suburban\n// Energy_Industrial = 0.75 * Industrial\n// Energy_Commercial = 0.85 * Commercial\n// Energy_Residential = 0.95 * Residential\n// Cost_Urban = 1000 * Urban\n// Cost_Suburban = 900 * Suburban\n// Cost_Industrial = 1100 * Industrial\n// Cost_Commercial = 1050 * Commercial\n// Cost_Residential = 850 * Residential\n// So, the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000\n\n## Generate Constraint-2:\nThere is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\n// Urban <= 500\n// Suburban <= 600\n// Industrial <= 400\n// Commercial <= 550\n// Residential <= 700",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential. The efficiency of solar panels and the cost of installation per panel vary by district due to different sun exposure and building heights. The details are given in the following Table.\n\n| Zone         | Efficiency | Installation Cost per Panel |\n|--------------|------------|----------------------------|\n| Urban        | 80%        | $1000                      |\n| Suburban     | 90%        | $900                       |\n| Industrial   | 75%        | $1100                      |\n| Commercial   | 85%        | $1050                      |\n| Residential  | 95%        | $850                       |\n\nThe city has a budget of $500,000 for the installation of solar panels. There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential. The city aims to maximize the energy output per dollar spent.\n\nPlease help the city determine the optimal number of solar panels to install in each zone to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrban = model.addVar(vtype=\"INTEGER\", name=\"Urban\", lb=0) # number of solar panels in Urban zone\nSuburban = model.addVar(vtype=\"INTEGER\", name=\"Suburban\", lb=0) # number of solar panels in Suburban zone\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0) # number of solar panels in Industrial zone\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0) # number of solar panels in Commercial zone\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0) # number of solar panels in Residential zone\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Urban = 0.8 * Urban\nEnergy_Suburban = 0.9 * Suburban\nEnergy_Industrial = 0.75 * Industrial\nEnergy_Commercial = 0.85 * Commercial\nEnergy_Residential = 0.95 * Residential\nCost_Urban = 1000 * Urban\nCost_Suburban = 900 * Suburban\nCost_Industrial = 1100 * Industrial\nCost_Commercial = 1050 * Commercial\nCost_Residential = 850 * Residential\n## the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential) == Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000)\n## There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\nmodel.addCons(Urban <= 500)\nmodel.addCons(Suburban <= 600)\nmodel.addCons(Industrial <= 400)\nmodel.addCons(Commercial <= 550)\nmodel.addCons(Residential <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Urban Zone: \", model.getVal(Urban))\n    print(\"Number of Solar Panels in Suburban Zone: \", model.getVal(Suburban))\n    print(\"Number of Solar Panels in Industrial Zone: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels in Commercial Zone: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels in Residential Zone: \", model.getVal(Residential))\n    print(\"Maximized Energy Output per Dollar Spent: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery demands.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nT1 has a fuel efficiency of 5 km/liter, T2 has 6 km/liter, T3 has 7 km/liter, T4 has 8 km/liter, and T5 has 9 km/liter. The company wants to minimize the total fuel consumption for all trips. The total distance to be covered by each type of truck is proportional to its number and its individual distance factor (T1: 100 km, T2: 120 km, T3: 140 km, T4: 160 km, T5: 180 km).\n// Fuel_T1 = (100 * T1) / 5\n// Fuel_T2 = (120 * T2) / 6\n// Fuel_T3 = (140 * T3) / 7\n// Fuel_T4 = (160 * T4) / 8\n// Fuel_T5 = (180 * T5) / 9\n// So, the objective function is: Minimize Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can operate, which is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. T1 has a fuel efficiency of 5 km/liter and covers 100 km per trip, T2 has 6 km/liter and covers 120 km, T3 has 7 km/liter and covers 140 km, T4 has 8 km/liter and covers 160 km, and T5 has 9 km/liter and covers 180 km. The company wants to minimize the total fuel consumption for all trips.\n\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000. The company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters. The company also has a limit on the total number of trucks it can operate, which is 100.\n\nPlease help the company determine the optimal number of each type of truck to minimize fuel consumption while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_T1 = (100 * T1) / 5\nFuel_T2 = (120 * T2) / 6\nFuel_T3 = (140 * T3) / 7\nFuel_T4 = (160 * T4) / 8\nFuel_T5 = (180 * T5) / 9\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5)\n\n# Add constraints\n## The company has a total budget of $500,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000)\n## The company must meet a minimum delivery capacity of 10,000 cubic meters.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000)\n## The company has a limit on the total number of trucks it can operate, which is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits.\n// {\"number of units of MachineA\": \"MachineAUnits\", \"range\": \"MachineAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineBUnits\", \"range\": \"MachineBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineCUnits\", \"range\": \"MachineCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineDUnits\", \"range\": \"MachineDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company wants to maximize the total profit.\n// Profit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\n// Profit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\n// Profit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\n// Profit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits. The profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company has a total production capacity of 100 units for the month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineAUnits\", lb=0) # number of units of MachineA\nMachineBUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineBUnits\", lb=0) # number of units of MachineB\nMachineCUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineCUnits\", lb=0) # number of units of MachineC\nMachineDUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineDUnits\", lb=0) # number of units of MachineD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\nProfit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\nProfit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\nProfit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n## the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\n## The company has a total production capacity of 100 units for the month.\nmodel.addCons(MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineAUnits))\n    print(\"Number of MachineB Units: \", model.getVal(MachineBUnits))\n    print(\"Number of MachineC Units: \", model.getVal(MachineCUnits))\n    print(\"Number of MachineD Units: \", model.getVal(MachineDUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company aims to minimize the total daily fuel cost across all trucks.\n// FuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\n// FuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\n// FuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\n// TotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel efficiency upgrades.\n// FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines. The fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company has a total budget of $10,000 for fuel efficiency upgrades. The total number of trucks that can be deployed is limited to 50. The company aims to minimize the total daily fuel cost across all trucks. Please help the company determine the optimal number of trucks and the appropriate investments in fuel efficiency upgrades to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nFuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\nFuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\nFuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\nTotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\nmodel.addCons(FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)  # Total budget for fuel efficiency upgrades\nmodel.addCons(TruckA + TruckB + TruckC <= 50)  # Total number of trucks that can be deployed\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(FuelEfficiencyC))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1243,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters.\n// 5 * S + 10 * W <= 1000\n\n## Generate Constraint-3:\nThe company must ensure that at least 50 solar panels and 20 wind turbines are installed.\n// S >= 50\n// W >= 20\n\n## Generate Constraint-4:\nDue to local regulations, the number of wind turbines cannot exceed twice the number of solar panels.\n// W <= 2 * S",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production. The energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently. The company has a budget of $500,000 for investments in energy storage systems. The total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters. The company must ensure that at least 50 solar panels and 20 wind turbines are installed. Due to local regulations, the number of wind turbines cannot exceed twice the number of solar panels. Please help the company to maximize the total energy output stored efficiently.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n## the objective function is: Maximize (Energy_output * Storage_efficiency)\n## convert the multiplication to addition\nmodel.addCons(obj == Energy_output + Storage_efficiency)\n\n# Add constraints\n## The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n## The total area available for installation is limited to 1000 square meters.\nmodel.addCons(5 * S + 10 * W <= 1000)\n## The company must ensure that at least 50 solar panels and 20 wind turbines are installed.\nmodel.addCons(S >= 50)\nmodel.addCons(W >= 20)\n## Due to local regulations, the number of wind turbines cannot exceed twice the number of solar panels.\nmodel.addCons(W <= 2 * S)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location A, Location B, Location C, Location D, and Location E) for installation.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local weather conditions. The efficiency of wind turbines also varies based on wind patterns. The company wants to maximize the total energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe objective is to maximize the total daily energy output while minimizing the total cost of installation.\n// Total energy output: Energy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\n// Total cost: Cost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on renewable energy installations.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE >= 25000\n\n## Generate Constraint-3:\nThe company wants to install at least 20 solar panels in total.\n// SolarA + SolarB + SolarC >= 20\n\n## Generate Constraint-4:\nNo more than 30 wind turbines should be installed in total.\n// WindD + WindE <= 30",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations: Location A, Location B, Location C, Location D, and Location E. The company needs to determine the number of solar panels and wind turbines to install at each location. The energy generation and cost per unit for each type of installation are given in the following Table.\n\n| Location | Installation Type | Energy Generation (kWh/day) | Cost per Unit ($) |\n|----------|-------------------|------------------------------|-------------------|\n| A        | Solar Panel       | 100                          | 500               |\n| B        | Solar Panel       | 120                          | 600               |\n| C        | Solar Panel       | 110                          | 550               |\n| D        | Wind Turbine      | 200                          | 1000              |\n| E        | Wind Turbine      | 180                          | 900               |\n\nThe company has a budget of $50,000 for the installation. The company wants to ensure that at least 50% of the budget is spent on renewable energy installations. The company wants to install at least 20 solar panels in total and no more than 30 wind turbines. \n\nPlease help the company to maximize the total daily energy output while minimizing the total cost of installation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Location E\n\n# Define objective function\nEnergy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\nCost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n# So, the objective function is: Maximize Energy - Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000)\n# The company wants to ensure that at least 50% of the budget is spent on renewable energy installations.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE >= 25000)\n# The company wants to install at least 20 solar panels in total.\nmodel.addCons(SolarA + SolarB + SolarC >= 20)\n# No more than 30 wind turbines should be installed in total.\nmodel.addCons(WindD + WindE <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, each panel generates 150 kWh annually with a cost of $100 per panel and a carbon offset of 0.5 tons. In D2, each panel generates 120 kWh annually with a cost of $120 per panel and a carbon offset of 0.4 tons. In D3, each panel generates 180 kWh annually with a cost of $110 per panel and a carbon offset of 0.6 tons. In D4, each panel generates 160 kWh annually with a cost of $130 per panel and a carbon offset of 0.5 tons. In D5, each panel generates 140 kWh annually with a cost of $140 per panel and a carbon offset of 0.4 tons. The city aims to maximize the energy production efficiency (total energy generated per total cost).\n// Total_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\n// Total_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n// So, the objective function is: Maximize Total_Energy / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total carbon offset should be at least 200 tons.\n// 0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed in D1 and D2 combined is 500.\n// D1 + D2 <= 500\n\n## Generate Constraint-4:\nThe minimum number of panels that must be installed in D3 and D4 combined is 300.\n// D3 + D4 >= 300\n\n## Generate Constraint-5:\nNo more than 30% of the total budget can be spent on solar panels in D5.\n// 140 * D5 <= 0.3 * 100000",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. The annual energy generation, cost per panel, and carbon offset for each district are given in the following Table.\n\n| District | Annual Energy Generation (kWh) | Cost per Panel ($) | Carbon Offset (tons) |\n|----------|--------------------------------|--------------------|----------------------|\n| D1       | 150                             | 100                | 0.5                  |\n| D2       | 120                             | 120                | 0.4                  |\n| D3       | 180                             | 110                | 0.6                  |\n| D4       | 160                             | 130                | 0.5                  |\n| D5       | 140                             | 140                | 0.4                  |\n\nThe city has a budget of $100,000 for the installation of solar panels. The total carbon offset should be at least 200 tons. The maximum number of panels that can be installed in D1 and D2 combined is 500. The minimum number of panels that must be installed in D3 and D4 combined is 300. No more than 30% of the total budget can be spent on solar panels in D5.\n\nPlease help the city to maximize the energy production efficiency (total energy generated per total cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\nTotal_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n## the objective function is: Maximize Total_Energy / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Energy)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000)\n## The total carbon offset should be at least 200 tons.\nmodel.addCons(0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200)\n## The maximum number of panels that can be installed in D1 and D2 combined is 500.\nmodel.addCons(D1 + D2 <= 500)\n## The minimum number of panels that must be installed in D3 and D4 combined is 300.\nmodel.addCons(D3 + D4 >= 300)\n## No more than 30% of the total budget can be spent on solar panels in D5.\nmodel.addCons(140 * D5 <= 0.3 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1576,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering the purchase of different types of vehicles (Trucks, Vans, and Bikes) to optimize its delivery network. The company needs to decide on the number of each type of vehicle to buy and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"CostTruck\", \"range\": \"CostTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"CostVan\", \"range\": \"CostVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"CostBike\", \"range\": \"CostBike >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that Trucks can handle 100 deliveries per day with an operational cost of $200 per day, Vans can handle 50 deliveries per day with an operational cost of $100 per day, and Bikes can handle 20 deliveries per day with an operational cost of $50 per day. The company aims to minimize the total operational cost while ensuring a certain level of delivery capacity.\n// Total operational cost: Cost = Trucks * CostTruck + Vans * CostVan + Bikes * CostBike\n// Total delivery capacity: Capacity = Trucks * 100 + Vans * 50 + Bikes * 20\n// The objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for purchasing vehicles.\n// Trucks * CostTruck + Vans * CostVan + Bikes * CostBike <= 10000\n\n## Generate Constraint-2:\nThe company must ensure a daily delivery capacity of at least 5000 deliveries.\n// Trucks * 100 + Vans * 50 + Bikes * 20 >= 5000\n\n## Generate Constraint-3:\nThe company cannot have more than 50 Trucks.\n// Trucks <= 50\n\n## Generate Constraint-4:\nThe operational cost for each type of vehicle must not exceed $150 per day.\n// CostTruck <= 150\n// CostVan <= 150\n// CostBike <= 150",
        "question": "A logistics company is planning its fleet expansion by considering the purchase of different types of vehicles (Trucks, Vans, and Bikes) to optimize its delivery network. The company needs to decide on the number of each type of vehicle to buy and the associated operational costs. Trucks can handle 100 deliveries per day with an operational cost of $200 per day, Vans can handle 50 deliveries per day with an operational cost of $100 per day, and Bikes can handle 20 deliveries per day with an operational cost of $50 per day. The company has a budget of $10,000 for purchasing vehicles and must ensure a daily delivery capacity of at least 5000 deliveries. The company cannot have more than 50 Trucks, and the operational cost for each type of vehicle must not exceed $150 per day. Please help the company to minimize the total operational cost while ensuring a certain level of delivery capacity, by minimizing the ratio of total operational cost to total delivery capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\nCostTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"CostTruck\", lb=0) # operational cost per Truck\nCostVan = model.addVar(vtype=\"CONTINUOUS\", name=\"CostVan\", lb=0) # operational cost per Van\nCostBike = model.addVar(vtype=\"CONTINUOUS\", name=\"CostBike\", lb=0) # operational cost per Bike\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = Trucks * CostTruck + Vans * CostVan + Bikes * CostBike\nCapacity = Trucks * 100 + Vans * 50 + Bikes * 20\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for purchasing vehicles.\nmodel.addCons(Trucks * CostTruck + Vans * CostVan + Bikes * CostBike <= 10000)\n## The company must ensure a daily delivery capacity of at least 5000 deliveries.\nmodel.addCons(Trucks * 100 + Vans * 50 + Bikes * 20 >= 5000)\n## The company cannot have more than 50 Trucks.\nmodel.addCons(Trucks <= 50)\n## The operational cost for each type of vehicle must not exceed $150 per day.\nmodel.addCons(CostTruck <= 150)\nmodel.addCons(CostVan <= 150)\nmodel.addCons(CostBike <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Operational Cost per Truck: \", model.getVal(CostTruck))\n    print(\"Operational Cost per Van: \", model.getVal(CostVan))\n    print(\"Operational Cost per Bike: \", model.getVal(CostBike))\n    print(\"Minimized Cost per Delivery: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Profit_A = A * (50 - (100 - 0.5A^2))\n// Profit_B = B * (70 - (120 - 0.4B^2))\n// Profit_C = C * (60 - (110 - 0.3C^2))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 500 units per month.\n// A <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| A       | $50             | 100 - 0.5A^2            |\n| B       | $70             | 120 - 0.4B^2            |\n| C       | $60             | 110 - 0.3C^2            |\n\nThe total production capacity of the company is limited to 1000 units per month. The market demand for product A is at most 500 units per month. Please help the company determine the optimal production quantities for products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=500) # production quantity for product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity for product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = A * (50 - (100 - 0.5A^2))\n## Profit_B = B * (70 - (120 - 0.4B^2))\n## Profit_C = C * (60 - (110 - 0.3C^2))\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == A * (50 - (100 - 0.5 * A**2)) + B * (70 - (120 - 0.4 * B**2)) + C * (60 - (110 - 0.3 * C**2)))\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A))\n    print(\"Production Quantity for Product B: \", model.getVal(B))\n    print(\"Production Quantity for Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1243,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility.\n// {\"number of solar facilities\": \"SolarFacilities\", \"range\": \"SolarFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"WindFacilities\", \"range\": \"WindFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"HydroFacilities\", \"range\": \"HydroFacilities >= 0\", \"type\": \"integer\"}\n// {\"land required for each solar facility (in acres)\": \"LandPerSolarFacility\", \"range\": \"LandPerSolarFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each wind facility (in acres)\": \"LandPerWindFacility\", \"range\": \"LandPerWindFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each hydro facility (in acres)\": \"LandPerHydroFacility\", \"range\": \"LandPerHydroFacility >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to maximize the total annual energy output from these facilities. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe objective is to maximize the total energy output, which is a nonlinear function of the number of facilities and the land required.\n// TotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\n// So, the objective function is: Maximize TotalEnergyOutput\n\n## Generate Constraint-1:\nThe city has a total of 1000 acres of land available for these facilities.\n// SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $5 million for construction costs, with costs per facility as follows:\n- Solar: $1 million\n- Wind: $1.5 million\n- Hydro: $2 million\n// 1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000",
        "question": "A city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility. The energy output per facility and the construction costs are given in the following Table.\n\n| Facility Type | Energy Output per Facility (MWh/year) | Construction Cost per Facility ($) |\n|---------------|--------------------------------------|------------------------------------|\n| Solar         | 1000                                 | 1,000,000                          |\n| Wind          | 1500                                 | 1,500,000                          |\n| Hydro         | 2000                                 | 2,000,000                          |\n\nThe city has a total of 1000 acres of land available for these facilities. The city has a budget of $5 million for construction costs. Please help the city to maximize the total annual energy output from these facilities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarFacilities = model.addVar(vtype=\"INTEGER\", name=\"SolarFacilities\", lb=0)\nWindFacilities = model.addVar(vtype=\"INTEGER\", name=\"WindFacilities\", lb=0)\nHydroFacilities = model.addVar(vtype=\"INTEGER\", name=\"HydroFacilities\", lb=0)\nLandPerSolarFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerSolarFacility\", lb=0)\nLandPerWindFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerWindFacility\", lb=0)\nLandPerHydroFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerHydroFacility\", lb=0)\n\n# Define objective function\nTotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalEnergyOutput)\n\n# Add constraints\nmodel.addCons(SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000)\nmodel.addCons(1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(SolarFacilities))\n    print(\"Number of Wind Facilities: \", model.getVal(WindFacilities))\n    print(\"Number of Hydro Facilities: \", model.getVal(HydroFacilities))\n    print(\"Land Required for Each Solar Facility: \", model.getVal(LandPerSolarFacility))\n    print(\"Land Required for Each Wind Facility: \", model.getVal(LandPerWindFacility))\n    print(\"Land Required for Each Hydro Facility: \", model.getVal(LandPerHydroFacility))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company can only use a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe number of large trucks cannot exceed half the number of small trucks.\n// LargeTrucks <= SmallTrucks / 2\n\n## Generate Constraint-5:\nThe number of medium trucks must be at least twice the number of small trucks.\n// MediumTrucks >= 2 * SmallTrucks",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity, daily operational cost, and fuel efficiency. The details for each type of truck are given in the following Table.\n\n| Truck Type | Capacity (units) | Daily Operational Cost | Fuel Efficiency (km/L) |\n|------------|------------------|------------------------|-----------------------|\n| Small      | 100              | $200                   | 5                     |\n| Medium     | 200              | $300                   | 8                     |\n| Large      | 300              | $400                   | 10                    |\n\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs. The company has a budget constraint of $10,000 for the total operational costs. The company can only use a maximum of 20 trucks in total. The number of large trucks cannot exceed half the number of small trucks. The number of medium trucks must be at least twice the number of small trucks.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks to minimize the total cost of operations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n## The company can only use a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The number of large trucks cannot exceed half the number of small trucks.\nmodel.addCons(LargeTrucks <= SmallTrucks / 2)\n## The number of medium trucks must be at least twice the number of small trucks.\nmodel.addCons(MediumTrucks >= 2 * SmallTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1338,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is affected by the fuel efficiency upgrades. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for RouteA: CostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\n// Fuel cost for RouteB: CostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\n// Fuel cost for RouteC: CostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades and truck purchases.\n// 2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes must not exceed 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB.\n// TrucksA >= 10; TrucksB >= 20\n\n## Generate Constraint-4:\nThe maximum fuel efficiency upgrade for any route is capped at 20%.\n// UpgradeA <= 20; UpgradeB <= 20; UpgradeC <= 20",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes.\n\n| Route | Base Cost per Kilometer |\n|-------|-------------------------|\n| RouteA | 2$                     |\n| RouteB | 3$                     |\n| RouteC | 4$                     |\n\nThe company has a budget of $100,000 for fuel efficiency upgrades and truck purchases. The total number of trucks available for all routes must not exceed 100. Due to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB. The maximum fuel efficiency upgrade for any route is capped at 20%.\n\nPlease help the company to determine the optimal number of trucks and fuel efficiency upgrades for each route to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=20)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)    # number of trucks for RouteC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0, ub=20)  # fuel efficiency upgrade for RouteA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0, ub=20)  # fuel efficiency upgrade for RouteB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0, ub=20)  # fuel efficiency upgrade for RouteC\n\n# Define objective function\nCostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\nCostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\nCostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Fuel Efficiency Upgrade for RouteA: \", model.getVal(UpgradeA))\n    print(\"Fuel Efficiency Upgrade for RouteB: \", model.getVal(UpgradeB))\n    print(\"Fuel Efficiency Upgrade for RouteC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food) across different regions. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should travel to minimize fuel consumption and time.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for Electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Clothing\": \"ClothingSpeed\", \"range\": \"ClothingSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Food\": \"FoodSpeed\", \"range\": \"FoodSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of a truck is modeled by a nonlinear function that increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Clothing = ClothingTrucks * ClothingSpeed^2\n// Fuel_Food = FoodTrucks * FoodSpeed^2\n// Time_Electronics = Distance / ElectronicsSpeed\n// Time_Clothing = Distance / ClothingSpeed\n// Time_Food = Distance / FoodSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Clothing + Fuel_Food + Time_Electronics + Time_Clothing + Time_Food)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics * ElectronicsTrucks + Fuel_Clothing * ClothingTrucks + Fuel_Food * FoodTrucks <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available in total.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50\n\n## Generate Constraint-3:\nThe total time spent on the road should not exceed 100 hours per day.\n// Time_Electronics + Time_Clothing + Time_Food <= 100\n\n## Generate Constraint-4:\nThe average speed of each type of truck should not exceed 60 miles per hour.\n// ElectronicsSpeed <= 60\n// ClothingSpeed <= 60\n// FoodSpeed <= 60",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food) across different regions. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should travel to minimize fuel consumption and time. The fuel consumption of a truck is modeled by a nonlinear function that increases nonlinearly with speed. The company has a total budget of $10,000 for fuel costs per day and a maximum of 50 trucks available in total. The total time spent on the road should not exceed 100 hours per day, and the average speed of each type of truck should not exceed 60 miles per hour. Please help the company to minimize the total fuel consumption and time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsSpeed = model.addVar(name=\"ElectronicsSpeed\", lb=0.001)\nClothingSpeed = model.addVar(name=\"ClothingSpeed\", lb=0.001)\nFoodSpeed = model.addVar(name=\"FoodSpeed\", lb=0.001)\n\n# Define objective function\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Clothing = ClothingTrucks * ClothingSpeed**2\nFuel_Food = FoodTrucks * FoodSpeed**2\nTime_Electronics = 1 / ElectronicsSpeed  # Assuming Distance is 1 for simplicity\nTime_Clothing = 1 / ClothingSpeed\nTime_Food = 1 / FoodSpeed\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Electronics + Fuel_Clothing + Fuel_Food + Time_Electronics + Time_Clothing + Time_Food)\n\n# Add constraints\nmodel.addCons(Fuel_Electronics * ElectronicsTrucks + Fuel_Clothing * ClothingTrucks + Fuel_Food * FoodTrucks <= 10000)\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50)\nmodel.addCons(Time_Electronics + Time_Clothing + Time_Food <= 100)\nmodel.addCons(ElectronicsSpeed <= 60)\nmodel.addCons(ClothingSpeed <= 60)\nmodel.addCons(FoodSpeed <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Clothing: \", model.getVal(ClothingSpeed))\n    print(\"Average Speed of Trucks for Food: \", model.getVal(FoodSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in advanced technology for each plant, which enhances the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company aims to maximize the total energy production.\n// Energy_Solar = (SolarHours * (1 + 0.01 * SolarTechInvestment / 1000))\n// Energy_Wind = (WindHours * (1 + 0.01 * WindTechInvestment / 1000))\n// Energy_Hydro = (HydroHours * (1 + 0.01 * HydroTechInvestment / 1000))\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000\n\n## Generate Constraint-2:\nThe total operational hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24\n\n## Generate Constraint-3:\nDue to maintenance requirements, each plant must operate at least 2 hours per day.\n// SolarHours >= 2; WindHours >= 2; HydroHours >= 2",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company has a total budget of $50,000 for technology investments and operational costs. The total operational hours for all plants must not exceed 24 hours per day. Due to maintenance requirements, each plant must operate at least 2 hours per day. Please help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=2)  # number of hours Solar plant operates\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=2)  # number of hours Wind plant operates\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=2)  # number of hours Hydro plant operates\nSolarTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarTechInvestment\", lb=0)  # investment in advanced technology for Solar\nWindTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindTechInvestment\", lb=0)  # investment in advanced technology for Wind\nHydroTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroTechInvestment\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nEnergy_Solar = SolarHours * (1 + 0.01 * SolarTechInvestment / 1000)\nEnergy_Wind = WindHours * (1 + 0.01 * WindTechInvestment / 1000)\nEnergy_Hydro = HydroHours * (1 + 0.01 * HydroTechInvestment / 1000)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\nmodel.addCons(SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(SolarHours))\n    print(\"Number of hours Wind plant operates: \", model.getVal(WindHours))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(WindTechInvestment))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(HydroTechInvestment))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made.\n// Fuel consumption for Route1: Consumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\n// Fuel consumption for Route2: Consumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and technology investments.\n// Fuel1 + Fuel2 + Investment <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-3:\nEach route must be completed with a minimum of 5 trucks.\n// Trucks1 >= 5; Trucks2 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet. The fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made.\n\nThe company has a budget of $100,000 for fuel and technology investments. The total number of trucks available for all routes is limited to 50. Each route must be completed with a minimum of 5 trucks.\n\nPlease help the company to determine the optimal number of trucks for each route, the amount of fuel for each route, and the investment in the fuel-efficient technology to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # amount of fuel for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # amount of fuel for Route2\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0)  # investment in fuel-efficient technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\nConsumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n## the objective function is: Minimize (Consumption1 + Consumption2)\n## convert the division to multiplication\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and technology investments.\nmodel.addCons(Fuel1 + Fuel2 + Investment <= 100000)\n## The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Amount of Fuel for Route1: \", model.getVal(Fuel1))\n    print(\"Amount of Fuel for Route2: \", model.getVal(Fuel2))\n    print(\"Investment in Fuel-Efficient Technology: \", model.getVal(Investment))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours.\n// 8 * ProductA + 10 * ProductB + 9 * ProductC <= 800",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55. The company also has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours. Please help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000) # Budget constraint for raw materials\nmodel.addCons(8 * ProductA + 10 * ProductB + 9 * ProductC <= 800) # Labor hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and maintenance costs. Additionally, the company is considering investing in hybrid technology for some of its trucks to further reduce costs and environmental impact.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Region 1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region 2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region 3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs of the trucks are affected by the number of trucks and the level of hybrid technology investment. The cost per truck decreases nonlinearly with the investment in hybrid technology. Specifically, the cost per truck in Region 1 is $1000 - 0.01 * Hybrid1^2, in Region 2 is $1200 - 0.012 * Hybrid2^2, and in Region 3 is $1100 - 0.011 * Hybrid3^2. The company aims to minimize the total operational cost across all regions.\n// Total operational cost for Region 1: Cost1 = (1000 - 0.01 * Hybrid1^2) * Trucks1\n// Total operational cost for Region 2: Cost2 = (1200 - 0.012 * Hybrid2^2) * Trucks2\n// Total operational cost for Region 3: Cost3 = (1100 - 0.011 * Hybrid3^2) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional demand, the company must allocate at least 20 trucks to Region 1 and 30 trucks to Region 2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the investment in hybrid technology for each region to minimize fuel consumption and maintenance costs. The cost per truck decreases nonlinearly with the investment in hybrid technology. The cost per truck in Region 1 is $1000 - 0.01 * Hybrid1^2, in Region 2 is $1200 - 0.012 * Hybrid2^2, and in Region 3 is $1100 - 0.011 * Hybrid3^2. The company aims to minimize the total operational cost across all regions.\n\n| Region | Cost per Truck | Hybrid Technology Investment |\n|--------|----------------|-------------------------------|\n| 1      | 1000 - 0.01 * Hybrid1^2 | Hybrid1 |\n| 2      | 1200 - 0.012 * Hybrid2^2 | Hybrid2 |\n| 3      | 1100 - 0.011 * Hybrid3^2 | Hybrid3 |\n\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments. The total number of trucks available is limited to 100. Due to regional demand, the company must allocate at least 20 trucks to Region 1 and 30 trucks to Region 2.\n\nPlease help the company to minimize the total operational cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region 3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0) # investment in hybrid technology for Region 1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0) # investment in hybrid technology for Region 2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0) # investment in hybrid technology for Region 3\n\n# Define objective function\nCost1 = (1000 - 0.01 * Hybrid1**2) * Trucks1\nCost2 = (1200 - 0.012 * Hybrid2**2) * Trucks2\nCost3 = (1100 - 0.011 * Hybrid3**2) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Hybrid Technology for Region 1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Region 2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Region 3: \", model.getVal(Hybrid3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large vehicles\": \"ExtraLarge\", \"range\": \"ExtraLarge >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer.\n// Profit_Small = (1.20 - 0.50) * Small\n// Profit_Medium = (1.50 - 0.70) * Medium\n// Profit_Large = (1.80 - 0.90) * Large\n// Profit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\n// Profit_Electric = (1.00 - 0.30) * Electric\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\n\n## Generate Constraint-1:\nThe total number of vehicles the company can operate is limited to 200.\n// Small + Medium + Large + ExtraLarge + Electric <= 200\n\n## Generate Constraint-2:\nThe company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n// 2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000\n\n## Generate Constraint-3:\nThe cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n// Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300\n\n## Generate Constraint-4:\nThe company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n// Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric)\n\n## Generate Constraint-5:\nThe company wants to ensure that no more than 30% of its fleet is Extra-Large vehicles due to operational constraints.\n// ExtraLarge <= 0.30 * (Small + Medium + Large + ExtraLarge + Electric)",
        "question": "A logistics company is planning its fleet usage for the next quarter and has five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each vehicle type to maximize profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer. The cost and revenue per kilometer for each vehicle type are given in the following Table.\n\n| Vehicle Type | Cost per Kilometer | Revenue per Kilometer |\n|--------------|--------------------|-----------------------|\n| Small        | $0.50              | $1.20                 |\n| Medium       | $0.70              | $1.50                 |\n| Large        | $0.90              | $1.80                 |\n| Extra-Large  | $1.10              | $2.10                 |\n| Electric     | $0.30              | $1.00                 |\n\nThe company has several constraints:\n1. The total number of vehicles the company can operate is limited to 200.\n2. The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n3. The cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n4. The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\n5. The company wants to ensure that no more than 30% of its fleet is Extra-Large vehicles due to operational constraints.\n\nPlease help the company to determine the optimal number of each vehicle type to maximize the profit per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of Large vehicles\nExtraLarge = model.addVar(vtype=\"INTEGER\", name=\"ExtraLarge\", lb=0) # number of Extra-Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0) # number of Electric vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Small = (1.20 - 0.50) * Small\nProfit_Medium = (1.50 - 0.70) * Medium\nProfit_Large = (1.80 - 0.90) * Large\nProfit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\nProfit_Electric = (1.00 - 0.30) * Electric\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric)\n\n# Add constraints\n## The total number of vehicles the company can operate is limited to 200.\nmodel.addCons(Small + Medium + Large + ExtraLarge + Electric <= 200)\n## The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000.\nmodel.addCons(2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000)\n## The cargo capacity constraint is as follows:\nmodel.addCons(Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300)\n## The company aims to have at least 10% of its fleet be Electric vehicles to meet environmental standards.\nmodel.addCons(Electric >= 0.10 * (Small + Medium + Large + ExtraLarge + Electric))\n## The company wants to ensure that no more than 30% of its fleet is Extra-Large vehicles due to operational constraints.\nmodel.addCons(ExtraLarge <= 0.30 * (Small + Medium + Large + ExtraLarge + Electric))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Number of Extra-Large Vehicles: \", model.getVal(ExtraLarge))\n    print(\"Number of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Maximized Profit Per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1956,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Region 1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in fuel-efficient technology. The more invested, the less fuel each truck consumes per kilometer. The relationship is nonlinear, with diminishing returns as more technology is applied. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region 1: Fuel1 = (100 - 0.05 * Tech1^2) * Trucks1\n// Fuel consumption for Region 2: Fuel2 = (120 - 0.06 * Tech2^2) * Trucks2\n// Fuel consumption for Region 3: Fuel3 = (110 - 0.04 * Tech3^2) * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nDue to regional demand, the company must allocate at least 50 trucks to Region 1 and 70 trucks to Region 2.\n// Trucks1 >= 50; Trucks2 >= 70\n\n## Generate Constraint-3:\nThe maximum number of trucks that can be allocated to each region is limited by the regional infrastructure. Region 1 can handle up to 150 trucks, Region 2 up to 200 trucks, and Region 3 up to 100 trucks.\n// Trucks1 <= 150; Trucks2 <= 200; Trucks3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the investment in fuel-efficient technologies to minimize fuel consumption and operational costs. The relationship between investment in technology and fuel consumption is nonlinear, with diminishing returns as more technology is applied. The company aims to minimize the total fuel consumption across all regions.\n\n| Region | Fuel Consumption per Truck (without tech) | Max Trucks Allowed |\n|--------|------------------------------------------|--------------------|\n| 1      | 100                                      | 150                |\n| 2      | 120                                      | 200                |\n| 3      | 110                                      | 100                |\n\nThe company has a total budget of $100,000 for truck allocation and technology investments. Due to regional demand, the company must allocate at least 50 trucks to Region 1 and 70 trucks to Region 2. The maximum number of trucks that can be allocated to each region is limited by the regional infrastructure. \n\nPlease help the company to determine the optimal number of trucks to allocate to each region and the investment in fuel-efficient technologies to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50, ub=150)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=70, ub=200)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0, ub=100)  # number of trucks in Region 3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Region 1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Region 2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for Region 3\n\n# Define objective function\nFuel1 = (100 - 0.05 * Tech1**2) * Trucks1\nFuel2 = (120 - 0.06 * Tech2**2) * Trucks2\nFuel3 = (110 - 0.04 * Tech3**2) * Trucks3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech1: \", model.getVal(Tech1))\n    print(\"Investment in Tech2: \", model.getVal(Tech2))\n    print(\"Investment in Tech3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n// Fuel consumption on route A: Fuel_A = 10 * A\n// Fuel consumption on route B: Fuel_B = 15 * B\n// Fuel consumption on route C: Fuel_C = 20 * C\n// Fuel consumption on route D: Fuel_D = 25 * D\n// Fuel consumption on route E: Fuel_E = 30 * E\n// Total capacity of goods transported: Capacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nEach route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks.\n// A >= 5; B >= 10; C >= 15; D >= 20; E >= 25\n\n## Generate Constraint-3:\nThe total fuel consumption must not exceed 2000 liters per day.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000\n\n## Generate Constraint-4:\nThe total capacity of goods transported must be at least 30000 units per day.\n// 100 * (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) >= 30000\n\n## Generate Constraint-5:\nThe number of trucks on route E must not exceed the combined number of trucks on routes A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n\nThe company has a total of 100 trucks available. Each route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks. The total fuel consumption must not exceed 2000 liters per day. The total capacity of goods transported must be at least 30000 units per day. The number of trucks on route E must not exceed the combined number of trucks on routes A, B, and C.\n\nPlease help the company to minimize the total fuel consumption while maximizing the total capacity of goods transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10)  # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15)  # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20)  # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=25)  # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\nCapacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n## The total fuel consumption must not exceed 2000 liters per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000)\n## The total capacity of goods transported must be at least 30000 units per day.\nmodel.addCons(100 * (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) >= 30000)\n## The number of trucks on route E must not exceed the combined number of trucks on routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1318,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows:\n\n| Device    | Profit per Unit |\n|-----------|-----------------|\n| DeviceA   | $50             |\n| DeviceB   | $70             |\n| DeviceC   | $90             |\n| DeviceD   | $60             |\n| DeviceE   | $80             |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The production of DeviceA must be at least twice the production of DeviceB.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes.\n// FuelCost_A = 1 * (RouteDistance / 10) * TruckA\n// FuelCost_B = 1 * (RouteDistance / 15) * TruckB\n// FuelCost_C = 1 * (RouteDistance / 20) * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 km.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for fuel costs.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption. The fuel efficiency of each truck is given in the following Table.\n\n| Vehicle | Fuel Efficiency |\n|---------|-----------------|\n| Truck A | 10 km/liter     |\n| Truck B | 15 km/liter     |\n| Truck C | 20 km/liter     |\n\nThe cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes. The total distance to be covered by all trucks is 5000 km. The company has a budget of $3000 for fuel costs. The company can only operate a maximum of 100 trucks in total.\n\nPlease help the company to determine the optimal number of each type of truck to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nRouteDistance = model.addVar(name=\"RouteDistance\") # variable for route distance\nFuelCost_A = 1 * (RouteDistance / 10) * TruckA\nFuelCost_B = 1 * (RouteDistance / 15) * TruckB\nFuelCost_C = 1 * (RouteDistance / 20) * TruckC\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 km.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC == 5000)\n## The company has a budget of $3000 for fuel costs.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000)\n## The company can only operate a maximum of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company must decide on the optimal fuel mix for each vehicle type to reduce carbon emissions.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"fuel mix for Trucks (as a percentage of renewable fuel)\": \"TruckFuelMix\", \"range\": \"0 <= TruckFuelMix <= 100\", \"type\": \"continuous\"}\n// {\"fuel mix for Vans (as a percentage of renewable fuel)\": \"VanFuelMix\", \"range\": \"0 <= VanFuelMix <= 100\", \"type\": \"continuous\"}\n// {\"fuel mix for Bikes (as a percentage of renewable fuel)\": \"BikeFuelMix\", \"range\": \"0 <= BikeFuelMix <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.5.\nThe operational cost per Van is $70 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.4.\nThe operational cost per Bike is $30 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.2.\nThe company aims to minimize the total operational cost while considering the fuel mix for each vehicle type.\n// OperationalCost_Truck = 100 * TruckCount * (1 - 0.005 * TruckFuelMix)\n// OperationalCost_Van = 70 * VanCount * (1 - 0.004 * VanFuelMix)\n// OperationalCost_Bike = 30 * BikeCount * (1 - 0.002 * BikeFuelMix)\n// So, the objective function is: Minimize (OperationalCost_Truck + OperationalCost_Van + OperationalCost_Bike)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for all operational costs.\n// OperationalCost_Truck + OperationalCost_Van + OperationalCost_Bike <= 5000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle and the optimal fuel mix for each vehicle type to maximize efficiency and minimize operational costs. The operational cost per Truck is $100 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.5. The operational cost per Van is $70 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.4. The operational cost per Bike is $30 per day, and each percentage point increase in renewable fuel mix reduces the cost by $0.2. The company has a total budget of $5000 per day for all operational costs. Please help the company to minimize the total operational cost while considering the fuel mix for each vehicle type.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckFuelMix = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckFuelMix\", lb=0, ub=100)  # fuel mix for Trucks\nVanFuelMix = model.addVar(vtype=\"CONTINUOUS\", name=\"VanFuelMix\", lb=0, ub=100)  # fuel mix for Vans\nBikeFuelMix = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeFuelMix\", lb=0, ub=100)  # fuel mix for Bikes\n\n# Define objective function\nOperationalCost_Truck = 100 * TruckCount * (1 - 0.005 * TruckFuelMix)\nOperationalCost_Van = 70 * VanCount * (1 - 0.004 * VanFuelMix)\nOperationalCost_Bike = 30 * BikeCount * (1 - 0.002 * BikeFuelMix)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == OperationalCost_Truck + OperationalCost_Van + OperationalCost_Bike)\n\n# Add constraints\nmodel.addCons(OperationalCost_Truck + OperationalCost_Van + OperationalCost_Bike <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Fuel Mix for Trucks: \", model.getVal(TruckFuelMix))\n    print(\"Fuel Mix for Vans: \", model.getVal(VanFuelMix))\n    print(\"Fuel Mix for Bikes: \", model.getVal(BikeFuelMix))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type.\n// {\"number of trucks from City A to City B\": \"TrucksAB\", \"range\": \"TrucksAB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City A to City C\": \"TrucksAC\", \"range\": \"TrucksAC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City B to City C\": \"TrucksBC\", \"range\": \"TrucksBC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks from City A to City B\": \"FuelEfficiencyAB\", \"range\": \"FuelEfficiencyAB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City A to City C\": \"FuelEfficiencyAC\", \"range\": \"FuelEfficiencyAC > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City B to City C\": \"FuelEfficiencyBC\", \"range\": \"FuelEfficiencyBC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day. The fuel cost is calculated based on the distance between cities, the number of trucks, and their fuel efficiency. The distance from City A to City B is 500 km, from City A to City C is 700 km, and from City B to City C is 600 km. The fuel cost is $1 per liter.\n// FuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\n// FuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\n// FuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n// So, the objective function is: Minimize (FuelCostAB + FuelCostAC + FuelCostBC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// FuelCostAB + FuelCostAC + FuelCostBC <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type. The company wants to minimize the total fuel cost per day. The fuel cost is calculated based on the distance between cities, the number of trucks, and their fuel efficiency. The distance from City A to City B is 500 km, from City A to City C is 700 km, and from City B to City C is 600 km. The fuel cost is $1 per liter. The company has a total budget of $1000 for fuel costs per day. Please help the company to determine the optimal number of trucks and their fuel efficiency to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksAB = model.addVar(vtype=\"INTEGER\", name=\"TrucksAB\", lb=0) # number of trucks from City A to City B\nTrucksAC = model.addVar(vtype=\"INTEGER\", name=\"TrucksAC\", lb=0) # number of trucks from City A to City C\nTrucksBC = model.addVar(vtype=\"INTEGER\", name=\"TrucksBC\", lb=0) # number of trucks from City B to City C\nFuelEfficiencyAB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAB\", lb=0.001) # fuel efficiency of trucks from City A to City B\nFuelEfficiencyAC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAC\", lb=0.001) # fuel efficiency of trucks from City A to City C\nFuelEfficiencyBC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyBC\", lb=0.001) # fuel efficiency of trucks from City B to City C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\nFuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\nFuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n## convert the division to multiplication\nmodel.addCons(obj * (FuelEfficiencyAB * FuelEfficiencyAC * FuelEfficiencyBC) == FuelCostAB * FuelEfficiencyAC * FuelEfficiencyBC + FuelCostAC * FuelEfficiencyAB * FuelEfficiencyBC + FuelCostBC * FuelEfficiencyAB * FuelEfficiencyAC)\n\n# Add constraints\n## The company has a total budget of $1000 for fuel costs per day.\nmodel.addCons(FuelCostAB + FuelCostAC + FuelCostBC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks from City A to City B: \", model.getVal(TrucksAB))\n    print(\"Number of Trucks from City A to City C: \", model.getVal(TrucksAC))\n    print(\"Number of Trucks from City B to City C: \", model.getVal(TrucksBC))\n    print(\"Fuel Efficiency of Trucks from City A to City B: \", model.getVal(FuelEfficiencyAB))\n    print(\"Fuel Efficiency of Trucks from City A to City C: \", model.getVal(FuelEfficiencyAC))\n    print(\"Fuel Efficiency of Trucks from City B to City C: \", model.getVal(FuelEfficiencyBC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product, which will reduce the labor hours required per unit of product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit of ProductA is 2 hours, ProductB is 3 hours, and ProductC is 4 hours. Investing $10,000 in automation reduces the labor hours per unit by 1 hour for that product. The company aims to maximize the total profit while considering the efficiency of resource use.\n// ProfitA = 100 * ProductA - AutomationA * 10000 / 10000\n// ProfitB = 150 * ProductB - AutomationB * 10000 / 10000\n// ProfitC = 200 * ProductC - AutomationC * 10000 / 10000\n// LaborEfficiencyA = (2 - AutomationA / 10000) * ProductA\n// LaborEfficiencyB = (3 - AutomationB / 10000) * ProductB\n// LaborEfficiencyC = (4 - AutomationC / 10000) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC) / (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// (2 - AutomationA / 10000) * ProductA + (3 - AutomationB / 10000) * ProductB + (4 - AutomationC / 10000) * ProductC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the amount of resources (labor and materials) allocated to each product, and the investment in automation technology for each product. The profit per unit and the labor hours required per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit |\n|---------|-----------------|----------------------|\n| ProductA | $100            | 2 hours              |\n| ProductB | $150            | 3 hours              |\n| ProductC | $200            | 4 hours              |\n\nInvesting $10,000 in automation reduces the labor hours per unit by 1 hour for that product. The company has a total of 1000 labor hours available for the month. The company aims to maximize the total profit while considering the efficiency of resource use.\n\nPlease help the company to maximize the total profit while considering the efficiency of resource use, defined as the sum of the profits divided by the sum of the labor hours adjusted for automation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = 100 * ProductA - AutomationA * 10000 / 10000\nProfitB = 150 * ProductB - AutomationB * 10000 / 10000\nProfitC = 200 * ProductC - AutomationC * 10000 / 10000\nLaborEfficiencyA = (2 - AutomationA / 10000) * ProductA\nLaborEfficiencyB = (3 - AutomationB / 10000) * ProductB\nLaborEfficiencyC = (4 - AutomationC / 10000) * ProductC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC) / (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC)\n# convert the division to multiplication\nmodel.addCons(obj * (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC) == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total of 1000 labor hours available for the month.\nmodel.addCons((2 - AutomationA / 10000) * ProductA + (3 - AutomationB / 10000) * ProductB + (4 - AutomationC / 10000) * ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"SP1\", \"range\": \"SP1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"WT1\", \"range\": \"WT1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"SP2\", \"range\": \"SP2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"WT2\", \"range\": \"WT2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"SP3\", \"range\": \"SP3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"WT3\", \"range\": \"WT3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"SP4\", \"range\": \"SP4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"WT4\", \"range\": \"WT4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"SP5\", \"range\": \"SP5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"WT5\", \"range\": \"WT5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation. The energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations.\n// Total cost: Cost = 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2)\n// Total energy output: Energy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n// So, the objective function is: Minimize (Cost / Energy)\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all locations must not exceed 1000.\n// SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000\n\n## Generate Constraint-3:\nAt each location, the number of solar panels must be at least half the number of wind turbines.\n// SP1 >= 0.5 * WT1; SP2 >= 0.5 * WT2; SP3 >= 0.5 * WT3; SP4 >= 0.5 * WT4; SP5 >= 0.5 * WT5\n\n## Generate Constraint-4:\nThe maximum number of solar panels or wind turbines at any single location is 200.\n// SP1 <= 200; WT1 <= 200; SP2 <= 200; WT2 <= 200; SP3 <= 200; WT3 <= 200; SP4 <= 200; WT4 <= 200; SP5 <= 200; WT5 <= 200",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation, and the energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations. The total budget for the project is $500,000. The total number of solar panels and wind turbines across all locations must not exceed 1000. At each location, the number of solar panels must be at least half the number of wind turbines. The maximum number of solar panels or wind turbines at any single location is 200. Please help the company to minimize the ratio of total cost to total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP1 = model.addVar(vtype=\"INTEGER\", name=\"SP1\", lb=0) # number of solar panels at location 1\nWT1 = model.addVar(vtype=\"INTEGER\", name=\"WT1\", lb=0) # number of wind turbines at location 1\nSP2 = model.addVar(vtype=\"INTEGER\", name=\"SP2\", lb=0) # number of solar panels at location 2\nWT2 = model.addVar(vtype=\"INTEGER\", name=\"WT2\", lb=0) # number of wind turbines at location 2\nSP3 = model.addVar(vtype=\"INTEGER\", name=\"SP3\", lb=0) # number of solar panels at location 3\nWT3 = model.addVar(vtype=\"INTEGER\", name=\"WT3\", lb=0) # number of wind turbines at location 3\nSP4 = model.addVar(vtype=\"INTEGER\", name=\"SP4\", lb=0) # number of solar panels at location 4\nWT4 = model.addVar(vtype=\"INTEGER\", name=\"WT4\", lb=0) # number of wind turbines at location 4\nSP5 = model.addVar(vtype=\"INTEGER\", name=\"SP5\", lb=0) # number of solar panels at location 5\nWT5 = model.addVar(vtype=\"INTEGER\", name=\"WT5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (SP1**2 + WT1**2 + SP2**2 + WT2**2 + SP3**2 + WT3**2 + SP4**2 + WT4**2 + SP5**2 + WT5**2)\nEnergy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(Cost <= 500000)\n## The total number of solar panels and wind turbines across all locations must not exceed 1000.\nmodel.addCons(SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000)\n## At each location, the number of solar panels must be at least half the number of wind turbines.\nmodel.addCons(SP1 >= 0.5 * WT1)\nmodel.addCons(SP2 >= 0.5 * WT2)\nmodel.addCons(SP3 >= 0.5 * WT3)\nmodel.addCons(SP4 >= 0.5 * WT4)\nmodel.addCons(SP5 >= 0.5 * WT5)\n## The maximum number of solar panels or wind turbines at any single location is 200.\nmodel.addCons(SP1 <= 200)\nmodel.addCons(WT1 <= 200)\nmodel.addCons(SP2 <= 200)\nmodel.addCons(WT2 <= 200)\nmodel.addCons(SP3 <= 200)\nmodel.addCons(WT3 <= 200)\nmodel.addCons(SP4 <= 200)\nmodel.addCons(WT4 <= 200)\nmodel.addCons(SP5 <= 200)\nmodel.addCons(WT5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(SP1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(WT1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(SP2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(WT2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(SP3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(WT3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(SP4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(WT4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(SP5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(WT5))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"available units of resource X\": \"ResourceX\", \"range\": \"ResourceX >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Y\": \"ResourceY\", \"range\": \"ResourceY >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Z\": \"ResourceZ\", \"range\": \"ResourceZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nEach unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively.\n// 2 * ProductA <= ResourceX\n// 3 * ProductB <= ResourceY\n// 4 * ProductC <= ResourceZ\n// ResourceX <= 100\n// ResourceY <= 150\n// ResourceZ <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units.\n// ProductA >= 10\n// ProductB >= 20\n// ProductC >= 15\n\n## Generate Constraint-3:\nThe manufacturer has a limit on the total production capacity of 50 units across all products.\n// ProductA + ProductB + ProductC <= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that at least 30% of the total production is of product A.\n// ProductA >= 0.3 * (ProductA + ProductB + ProductC)\n\n## Generate Constraint-5:\nThe cost of production for product A is $20 per unit, for product B is $30 per unit, and for product C is $25 per unit. The total production cost should not exceed $1500.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 1500",
        "question": "A manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. Each unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively. The market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units. The manufacturer has a limit on the total production capacity of 50 units across all products. The manufacturer wants to ensure that at least 30% of the total production is of product A. The cost of production for product A is $20 per unit, for product B is $30 per unit, and for product C is $25 per unit. The total production cost should not exceed $1500.\n\nPlease help the manufacturer to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=15)  # quantity of product C\nResourceX = model.addVar(vtype=\"INTEGER\", name=\"ResourceX\", lb=0, ub=100)  # available units of resource X\nResourceY = model.addVar(vtype=\"INTEGER\", name=\"ResourceY\", lb=0, ub=150)  # available units of resource Y\nResourceZ = model.addVar(vtype=\"INTEGER\", name=\"ResourceZ\", lb=0, ub=200)  # available units of resource Z\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint-1: Resource constraints\nmodel.addCons(2 * ProductA <= ResourceX)\nmodel.addCons(3 * ProductB <= ResourceY)\nmodel.addCons(4 * ProductC <= ResourceZ)\nmodel.addCons(ResourceX <= 100)\nmodel.addCons(ResourceY <= 150)\nmodel.addCons(ResourceZ <= 200)\n\n# Constraint-2: Market demand\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 20)\nmodel.addCons(ProductC >= 15)\n\n# Constraint-3: Total production capacity\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\n\n# Constraint-4: At least 30% of total production is product A\nmodel.addCons(ProductA >= 0.3 * (ProductA + ProductB + ProductC))\n\n# Constraint-5: Total production cost\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has a different operational cost and revenue generation capability. Truck A has an operational cost of $1000 per month and generates a revenue of $1500 per month. Truck B has an operational cost of $1200 per month and generates a revenue of $1800 per month. Truck C has an operational cost of $1400 per month and generates a revenue of $2000 per month. Van D has an operational cost of $800 per month and generates a revenue of $1200 per month. Van E has an operational cost of $600 per month and generates a revenue of $900 per month. The company aims to maximize its net profit, which is the total revenue minus the total operational cost. However, due to economies of scale, the operational cost per vehicle decreases by 0.1% for each additional vehicle of the same type deployed.\n// Operational cost of A: Cost_A = 1000 * (1 - 0.001 * (A - 1)) * A\n// Operational cost of B: Cost_B = 1200 * (1 - 0.001 * (B - 1)) * B\n// Operational cost of C: Cost_C = 1400 * (1 - 0.001 * (C - 1)) * C\n// Operational cost of D: Cost_D = 800 * (1 - 0.001 * (D - 1)) * D\n// Operational cost of E: Cost_E = 600 * (1 - 0.001 * (E - 1)) * E\n// Revenue of A: Revenue_A = 1500 * A\n// Revenue of B: Revenue_B = 1800 * B\n// Revenue of C: Revenue_C = 2000 * C\n// Revenue of D: Revenue_D = 1200 * D\n// Revenue of E: Revenue_E = 900 * E\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle operational costs for the month.\n// 1000 * (1 - 0.001 * (A - 1)) * A + 1200 * (1 - 0.001 * (B - 1)) * B + 1400 * (1 - 0.001 * (C - 1)) * C + 800 * (1 - 0.001 * (D - 1)) * D + 600 * (1 - 0.001 * (E - 1)) * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the total number of vehicles it can deploy, which is 100.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Truck A cannot exceed the number of Truck B by more than 10.\n// A <= B + 10\n\n## Generate Constraint-4:\nThe number of Van D must be at least twice the number of Van E.\n// D >= 2 * E",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each vehicle type has a different operational cost and revenue generation capability, as shown in the following Table.\n\n| Vehicle Type | Operational Cost per Month | Revenue per Month |\n|--------------|----------------------------|-------------------|\n| Truck A      | $1000                      | $1500             |\n| Truck B      | $1200                      | $1800             |\n| Truck C      | $1400                      | $2000             |\n| Van D        | $800                       | $1200             |\n| Van E        | $600                       | $900              |\n\nThe company aims to maximize its net profit, which is the total revenue minus the total operational cost. Due to economies of scale, the operational cost per vehicle decreases by 0.1% for each additional vehicle of the same type deployed. The company has a budget of $100,000 for vehicle operational costs for the month. The company has a limit on the total number of vehicles it can deploy, which is 100. Due to maintenance constraints, the number of Truck A cannot exceed the number of Truck B by more than 10. The number of Van D must be at least twice the number of Van E.\n\nPlease help the company to determine the optimal number of each vehicle type to deploy to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Operational cost and revenue calculations with economies of scale\nCost_A = 1000 * (1 - 0.001 * (A - 1)) * A\nCost_B = 1200 * (1 - 0.001 * (B - 1)) * B\nCost_C = 1400 * (1 - 0.001 * (C - 1)) * C\nCost_D = 800 * (1 - 0.001 * (D - 1)) * D\nCost_E = 600 * (1 - 0.001 * (E - 1)) * E\n\nRevenue_A = 1500 * A\nRevenue_B = 1800 * B\nRevenue_C = 2000 * C\nRevenue_D = 1200 * D\nRevenue_E = 900 * E\n\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E))\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle operational costs for the month.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 100000)\n## The company has a limit on the total number of vehicles it can deploy, which is 100.\nmodel.addCons(A + B + C + D + E <= 100)\n## Due to maintenance constraints, the number of Truck A cannot exceed the number of Truck B by more than 10.\nmodel.addCons(A <= B + 10)\n## The number of Van D must be at least twice the number of Van E.\nmodel.addCons(D >= 2 * E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1502,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"FuelEff_A\", \"range\": \"FuelEff_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"FuelEff_B\", \"range\": \"FuelEff_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"FuelEff_C\", \"range\": \"FuelEff_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// FuelConsumption_A = Trucks_A / FuelEff_A\n// FuelConsumption_B = Trucks_B / FuelEff_B\n// FuelConsumption_C = Trucks_C / FuelEff_C\n// Profit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\n// Profit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\n// Profit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 1000 units.\n// FuelConsumption_A + FuelConsumption_B + FuelConsumption_C <= 1000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type. The company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency. The company has a total of 50 trucks available. The total fuel consumption across all routes must not exceed 1000 units. Please help the company to minimize the total fuel consumption (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and maximize the total profit (Profit_A + Profit_B + Profit_C).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nFuelEff_A = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_A\", lb=0) # fuel efficiency of trucks for Route A\nFuelEff_B = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_B\", lb=0) # fuel efficiency of trucks for Route B\nFuelEff_C = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_C\", lb=0) # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_fuel = model.addVar('obj_fuel')\nobj_profit = model.addVar('obj_profit')\nmodel.setObjective(obj_fuel, \"minimize\")\nmodel.setObjective(obj_profit, \"maximize\")\n\n## convert the division to multiplication\nFuelConsumption_A = Trucks_A * FuelEff_A\nFuelConsumption_B = Trucks_B * FuelEff_B\nFuelConsumption_C = Trucks_C * FuelEff_C\nProfit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\nProfit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\nProfit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_fuel == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\nmodel.addCons(obj_profit == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n## The total fuel consumption across all routes must not exceed 1000 units.\nmodel.addCons(FuelConsumption_A + FuelConsumption_B + FuelConsumption_C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(FuelEff_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(FuelEff_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(FuelEff_C))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_fuel))\n    print(\"Maximized Profit: \", model.getVal(obj_profit))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer.\n// {\"number of kilometers driven by Truck1\": \"Truck1Km\", \"range\": \"Truck1Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck2\": \"Truck2Km\", \"range\": \"Truck2Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck3\": \"Truck3Km\", \"range\": \"Truck3Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck4\": \"Truck4Km\", \"range\": \"Truck4Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck5\": \"Truck5Km\", \"range\": \"Truck5Km >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km.\nThe fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km.\nThe fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km.\nThe fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km.\nThe fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km.\nThe company wants to minimize the total cost of fuel and maintenance.\n// FuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\n// MaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe total distance that all trucks can cover is limited to 10,000 km.\n// Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs.\n// (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000\n\n## Generate Constraint-3:\nEach truck must cover at least 1000 km.\n// Truck1Km >= 1000\n// Truck2Km >= 1000\n// Truck3Km >= 1000\n// Truck4Km >= 1000\n// Truck5Km >= 1000\n\n## Generate Constraint-4:\nThe total maintenance cost must not exceed $3000.\n// 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km <= 3000\n\n## Generate Constraint-5:\nThe company aims to balance the workload, ensuring that no more than 40% of the total distance is covered by any single truck.\n// Truck1Km <= 0.4 * 10000\n// Truck2Km <= 0.4 * 10000\n// Truck3Km <= 0.4 * 10000\n// Truck4Km <= 0.4 * 10000\n// Truck5Km <= 0.4 * 10000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer. The fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km. The fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km. The fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km. The fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km. The fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km. The company wants to minimize the total cost of fuel and maintenance.\nThe total distance that all trucks can cover is limited to 10,000 km. The company has a budget of $5000 for fuel costs. Each truck must cover at least 1000 km. The total maintenance cost must not exceed $3000. The company aims to balance the workload, ensuring that no more than 40% of the total distance is covered by any single truck.\nPlease help the company to determine the optimal number of kilometers each truck should drive to minimize the total cost of fuel and maintenance while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1Km\", lb=1000)\nTruck2Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2Km\", lb=1000)\nTruck3Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3Km\", lb=1000)\nTruck4Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4Km\", lb=1000)\nTruck5Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5Km\", lb=1000)\n\n# Define objective function\nFuelPrice = 1  # Assuming fuel price is $1 per liter for simplicity\nFuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\nMaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\nmodel.addCons(Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000)\nmodel.addCons((Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000)\nmodel.addCons(0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km <= 3000)\nmodel.addCons(Truck1Km <= 0.4 * 10000)\nmodel.addCons(Truck2Km <= 0.4 * 10000)\nmodel.addCons(Truck3Km <= 0.4 * 10000)\nmodel.addCons(Truck4Km <= 0.4 * 10000)\nmodel.addCons(Truck5Km <= 0.4 * 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of kilometers driven by Truck1: \", model.getVal(Truck1Km))\n    print(\"Number of kilometers driven by Truck2: \", model.getVal(Truck2Km))\n    print(\"Number of kilometers driven by Truck3: \", model.getVal(Truck3Km))\n    print(\"Number of kilometers driven by Truck4: \", model.getVal(Truck4Km))\n    print(\"Number of kilometers driven by Truck5: \", model.getVal(Truck5Km))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n// Fuel cost = (total distance / fuel efficiency) * fuel price\n// Maintenance cost = number of trucks * maintenance cost per truck\n// Objective function: Minimize (Fuel cost + Maintenance cost)\n\n## Generate Constraint-1:\nThe total budget for purchasing new trucks is $500,000.\n// 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 trucks in total.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes. Each type of truck has different fuel efficiency and maintenance costs, as shown in the following Table.\n\n| Vehicle  | Fuel Efficiency (km/l) | Maintenance Cost per Year |\n|----------|-----------------------|--------------------------|\n| Truck1   | 5                     | $10,000                   |\n| Truck2   | 10                    | $15,000                   |\n| Truck3   | 15                    | $20,000                   |\n| Truck4   | 20                    | $25,000                   |\n| Truck5   | 25                    | $30,000                   |\n\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered. The total budget for purchasing new trucks is $500,000. The company must have at least 10 trucks in total. \n\nPlease help the company determine the optimal number of each type of truck to purchase to minimize the total cost of fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Calculate fuel and maintenance costs\nFuelCost = (model.addVar(name=\"TotalDistance\") / 5 * Truck1 + model.addVar(name=\"TotalDistance\") / 10 * Truck2 + model.addVar(name=\"TotalDistance\") / 15 * Truck3 + model.addVar(name=\"TotalDistance\") / 20 * Truck4 + model.addVar(name=\"TotalDistance\") / 25 * Truck5) * model.addVar(name=\"FuelPrice\")\nMaintenanceCost = 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5\n\n# Objective function: Minimize (Fuel cost + Maintenance cost)\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The total budget for purchasing new trucks is $500,000.\nmodel.addCons(10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000)\n## The company must have at least 10 trucks in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Truck4: \", model.getVal(Truck4))\n    print(\"Number of Truck5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooter\", \"range\": \"Scooter >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drone\", \"range\": \"Drone >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $1000, maintenance cost is $200, and capacity is 1000 units.\nThe operational cost per Van is $500, maintenance cost is $100, and capacity is 500 units.\nThe operational cost per Bike is $100, maintenance cost is $20, and capacity is 100 units.\nThe operational cost per Scooter is $50, maintenance cost is $10, and capacity is 50 units.\nThe operational cost per Drone is $200, maintenance cost is $50, and capacity is 200 units.\nThe company wants to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized.\n// Total operational cost: OperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// Total maintenance cost: MaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\n// Total capacity utilized: Capacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// So, the objective function is: Minimize (OperCost + MaintCost) / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational and maintenance costs.\n// 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter and operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities. The company aims to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized. The operational and maintenance costs, as well as the capacities for each vehicle type, are given in the following Table.\n\n| Vehicle Type | Operational Cost | Maintenance Cost | Capacity |\n|--------------|------------------|------------------|----------|\n| Truck        | $1000            | $200             | 1000 units |\n| Van          | $500             | $100             | 500 units |\n| Bike         | $100             | $20              | 100 units |\n| Scooter      | $50              | $10              | 50 units |\n| Drone        | $200             | $50              | 200 units |\n\nThe company has a budget of $100,000 for operational and maintenance costs. Please help the company determine the optimal number of each vehicle type to minimize the Total Cost per Unit Shipped.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\nScooter = model.addVar(vtype=\"INTEGER\", name=\"Scooter\", lb=0)  # number of Scooters\nDrone = model.addVar(vtype=\"INTEGER\", name=\"Drone\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\nMaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\nCapacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n## the objective function is: Minimize (OperCost + MaintCost) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == OperCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $100,000 for operational and maintenance costs.\nmodel.addCons(1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Number of Scooters: \", model.getVal(Scooter))\n    print(\"Number of Drones: \", model.getVal(Drone))\n    print(\"Minimized Cost per Unit Shipped: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n// Packages delivered by Trucks per hour: Packages_Trucks = 100 * Trucks * 50\n// Packages delivered by Vans per hour: Packages_Vans = 50 * Vans * 40\n// Packages delivered by Bikes per hour: Packages_Bikes = 10 * Bikes * 20\n// So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\n// 100 * Trucks + 50 * Vans + 20 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers.\n// 2 * Trucks + Vans + 0.5 * Bikes <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle. Each Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle. The company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20. The company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers. Please help the company to maximize the total number of packages delivered per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nPackages_Trucks = 100 * Trucks * 50\nPackages_Vans = 50 * Vans * 40\nPackages_Bikes = 10 * Bikes * 20\n# So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n# Add constraints\n# The company has a budget of $10,000 per day for vehicle maintenance.\nmodel.addCons(100 * Trucks + 50 * Vans + 20 * Bikes <= 10000)\n# The company has a total of 100 drivers available.\nmodel.addCons(2 * Trucks + Vans + 0.5 * Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\n// Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\n// Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed half of the total production.\n// UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC)\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30,000\n\n## Generate Constraint-4:\nTo maintain a diversified product line, at least one unit of each device must be produced each month.\n// UnitsA >= 1; UnitsB >= 1; UnitsC >= 1",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary. The details are as follows:\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand Model |\n|--------|--------------------------|------------------------|--------------|\n| DeviceA | $50                     | $100                   | 1000 - 5 * UnitsA |\n| DeviceB | $70                     | $120                   | 1500 - 10 * UnitsB |\n| DeviceC | $80                     | $150                   | 2000 - 15 * UnitsC |\n\nThe company has a monthly production capacity of 500 units in total. Due to market saturation, the production of DeviceA should not exceed half of the total production. The company has a budget of $30,000 for production costs per month. To maintain a diversified product line, at least one unit of each device must be produced each month.\n\nPlease help the company to maximize its total profit, which is calculated as the sum of the profits from each device, where the profit for each device is the difference between the selling price and the production cost, multiplied by the minimum of the units produced and the demand for that device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with min function\n# DeviceA\nProfit_A = model.addVar(name=\"Profit_A\")\nmodel.addCons(Profit_A <= (100 - 50) * UnitsA)\nmodel.addCons(Profit_A <= (100 - 50) * (1000 - 5 * UnitsA))\n# DeviceB\nProfit_B = model.addVar(name=\"Profit_B\")\nmodel.addCons(Profit_B <= (120 - 70) * UnitsB)\nmodel.addCons(Profit_B <= (120 - 70) * (1500 - 10 * UnitsB))\n# DeviceC\nProfit_C = model.addVar(name=\"Profit_C\")\nmodel.addCons(Profit_C <= (150 - 80) * UnitsC)\nmodel.addCons(Profit_C <= (150 - 80) * (2000 - 15 * UnitsC))\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a monthly production capacity of 500 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n## Due to market saturation, the production of DeviceA should not exceed half of the total production.\nmodel.addCons(UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC))\n## The company has a budget of $30,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"capacity of the battery storage system\": \"Battery\", \"range\": \"Battery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing one solar panel at each site is $1000, and the expected energy generation per panel is 100 kWh. The cost of installing one wind turbine at each site is $2000, and the expected energy generation per turbine is 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n// Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n// Total energy generation = 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC)\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n// 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for the installation.\n// 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery <= 500000\n\n## Generate Constraint-3:\nThe battery storage system must be able to store at least 20% of the total energy generated.\n// Battery >= 0.2 * (100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC))\n\n## Generate Constraint-4:\nThe number of solar panels at each site must not exceed the number of wind turbines at the same site.\n// SolarA <= WindA\n// SolarB <= WindB\n// SolarC <= WindC",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C), and also considering using a battery storage system to store excess energy. The cost of installing one solar panel at each site is $1000, with an expected energy generation of 100 kWh per panel. The cost of installing one wind turbine at each site is $2000, with an expected energy generation of 200 kWh per turbine. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n\n| Component       | Cost per Unit | Energy Generation per Unit |\n|-----------------|---------------|----------------------------|\n| Solar Panel at A| $1000         | 100 kWh                    |\n| Solar Panel at B| $1000         | 100 kWh                    |\n| Solar Panel at C| $1000         | 100 kWh                    |\n| Wind Turbine at A| $2000 | 200 kWh                    |\n| Wind Turbine at B| $2000 | 200 kWh                    |\n| Wind Turbine at C| $2000 | 200 kWh                    |\n| Battery Storage | $50 per kWh   | -                          |\n\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh. The company has a budget of $500,000 for the installation. The battery storage system must be able to store at least 20% of the total energy generated. The number of solar panels at each site must not exceed the number of wind turbines at the same site.\n\nPlease help the company to minimize the total cost of installation while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Site A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Site B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Site C\nBattery = model.addVar(vtype=\"CONTINUOUS\", name=\"Battery\", lb=0) # capacity of the battery storage system\n\n# Define objective function\n## Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\nTotalCost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n## Objective function: Minimize Total cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\nmodel.addCons(100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000)\n## The company has a budget of $500,000 for the installation.\nmodel.addCons(1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery <= 500000)\n## The battery storage system must be able to store at least 20% of the total energy generated.\nmodel.addCons(Battery >= 0.2 * (100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC)))\n## The number of solar panels at each site must not exceed the number of wind turbines at the same site.\nmodel.addCons(SolarA <= WindA)\nmodel.addCons(SolarB <= WindB)\nmodel.addCons(SolarC <= WindC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Site B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Site C: \", model.getVal(WindC))\n    print(\"Capacity of Battery Storage System: \", model.getVal(Battery))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1683,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize the total cargo transported while minimizing fuel costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A can carry 10 tons per trip and consumes 5 liters of fuel per trip.\nTruck B can carry 15 tons per trip and consumes 7 liters of fuel per trip.\nTruck C can carry 20 tons per trip and consumes 9 liters of fuel per trip.\nThe company wants to maximize the total cargo transported while minimizing the total fuel consumption.\n// Cargo_TruckA = 10 * TruckA\n// Cargo_TruckB = 15 * TruckB\n// Cargo_TruckC = 20 * TruckC\n// Fuel_TruckA = 5 * TruckA\n// Fuel_TruckB = 7 * TruckB\n// Fuel_TruckC = 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 trips available.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500\n\n## Generate Constraint-4:\nThe number of Truck A must be at least 10.\n// TruckA >= 10\n\n## Generate Constraint-5:\nThe number of Truck C must not exceed twice the number of Truck B.\n// TruckC <= 2 * TruckB",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize the total cargo transported while minimizing fuel costs. The capacities and fuel consumption for each truck are given in the following Table.\n\n| Truck Type | Cargo Capacity (tons/trip) | Fuel Consumption (liters/trip) |\n|------------|----------------------------|--------------------------------|\n| Truck A    | 10                         | 5                              |\n| Truck B    | 15                         | 7                              |\n| Truck C    | 20                         | 9                              |\n\nThe company has a total budget of $10,000 for fuel costs. The company has a total of 100 trips available. The total cargo capacity of all trucks must not exceed 1500 tons. The number of Truck A must be at least 10. The number of Truck C must not exceed twice the number of Truck B.\n\nPlease help the company to maximize the total cargo transported while minimizing the total fuel consumption, considering the objective function is the sum of the cargo transported minus the square of the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_TruckA = 5 * TruckA\nFuel_TruckB = 7 * TruckB\nFuel_TruckC = 9 * TruckC\n# So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n# Convert the square term to a multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC) * (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC))\n\n# Add constraints\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000) # Total budget for fuel costs\nmodel.addCons(TruckA + TruckB + TruckC <= 100) # Total trips available\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500) # Total cargo capacity\nmodel.addCons(TruckA >= 10) # Minimum number of Truck A\nmodel.addCons(TruckC <= 2 * TruckB) # Truck C must not exceed twice the number of Truck B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Cargo Transported Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is affected by the fuel efficiency upgrades. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for RouteA: CostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\n// Fuel cost for RouteB: CostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\n// Fuel cost for RouteC: CostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades and truck purchases.\n// 2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes must not exceed 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB.\n// TrucksA >= 10; TrucksB >= 20\n\n## Generate Constraint-4:\nThe maximum fuel efficiency upgrade for any route is capped at 20%.\n// UpgradeA <= 20; UpgradeB <= 20; UpgradeC <= 20",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (RouteA, RouteB, RouteC) and the fuel efficiency upgrades for each type of truck. The fuel efficiency upgrades can be varied and are measured in percentage improvement. The base cost per kilometer for RouteA is $2, for RouteB is $3, and for RouteC is $4. Each percentage point of upgrade reduces the cost per kilometer by 0.1%. The company aims to minimize the total fuel cost across all routes. The company has a budget of $100,000 for fuel efficiency upgrades and truck purchases. The total number of trucks available for all routes must not exceed 100. Due to contractual obligations, the company must operate at least 10 trucks on RouteA and 20 trucks on RouteB. The maximum fuel efficiency upgrade for any route is capped at 20%. Please help the company to determine the optimal number of trucks and fuel efficiency upgrades for each route to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=20)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)    # number of trucks for RouteC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0, ub=20)  # fuel efficiency upgrade for RouteA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0, ub=20)  # fuel efficiency upgrade for RouteB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0, ub=20)  # fuel efficiency upgrade for RouteC\n\n# Define objective function\nCostA = 2 * (1 - 0.001 * UpgradeA) * TrucksA\nCostB = 3 * (1 - 0.001 * UpgradeB) * TrucksB\nCostC = 4 * (1 - 0.001 * UpgradeC) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(2000 * TrucksA + 3000 * TrucksB + 4000 * TrucksC + 100 * UpgradeA + 100 * UpgradeB + 100 * UpgradeC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Fuel Efficiency Upgrade for RouteA: \", model.getVal(UpgradeA))\n    print(\"Fuel Efficiency Upgrade for RouteB: \", model.getVal(UpgradeB))\n    print(\"Fuel Efficiency Upgrade for RouteC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $500,000 for raw materials. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n# The company has a budget of $500,000 for raw materials.\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in advanced machinery that can improve the production efficiency of each product, reducing the resource cost per unit. The investment in advanced machinery for each product is a continuous variable.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 units of resources available for the month.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $20,000.\n// MachineryA + MachineryB + MachineryC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC.\n// UnitsA <= 500; UnitsB <= 600; UnitsC <= 700",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in advanced machinery that can improve the production efficiency of each product, reducing the resource cost per unit. The investment in advanced machinery for each product is a continuous variable.\nThe cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\nThe company has a total of 10,000 units of resources available for the month. The total investment in advanced machinery cannot exceed $20,000. Due to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC.\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0, ub=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0, ub=600)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=700)  # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # investment in advanced machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # investment in advanced machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # investment in advanced machinery for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\nProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\nProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1216,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 2,000 units of product B.\n// A >= 1000; B >= 2000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient upgrades for their production lines. The energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for energy efficiency upgrades. The total production capacity for the next quarter is 10,000 units. The company must produce at least 1,000 units of product A and 2,000 units of product B.\n\nPlease help the company to determine the optimal production quantity for each product and the appropriate investment in energy efficiency upgrades to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2000)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)     # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0)     # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0)  # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0)  # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0)  # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0)  # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000)\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in engine upgrades for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\n// Fuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\n// Fuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\n// Fuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\n// Fuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in engine upgrades for each route to minimize the total fuel consumption while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks on Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in engine upgrades for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in engine upgrades for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in engine upgrades for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in engine upgrades for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in engine upgrades for Route5\n\n# Define objective function\nFuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\nFuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\nFuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\nFuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\nFuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n# Add constraints\n# The company has a budget of $100,000 for engine upgrades and operational costs.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Engine Upgrades for Route1: \", model.getVal(Upgrade1))\n    print(\"Investment in Engine Upgrades for Route2: \", model.getVal(Upgrade2))\n    print(\"Investment in Engine Upgrades for Route3: \", model.getVal(Upgrade3))\n    print(\"Investment in Engine Upgrades for Route4: \", model.getVal(Upgrade4))\n    print(\"Investment in Engine Upgrades for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different fuel efficiency and capacity. The company needs to decide how many trips each vehicle should make to optimize its logistics operations.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each vehicle is a nonlinear function of the number of trips due to varying fuel costs and maintenance expenses. The cost per trip for Truck1 is $100 + $5 * (Trips1)^2. The cost per trip for Truck2 is $150 + $4 * (Trips2)^2. The cost per trip for Truck3 is $200 + $3 * (Trips3)^2. The cost per trip for Truck4 is $250 + $2 * (Trips4)^2. The cost per trip for Truck5 is $300 + $1 * (Trips5)^2. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost: Cost = (100 + 5 * (Trips1)^2) * Trips1 + (150 + 4 * (Trips2)^2) * Trips2 + (200 + 3 * (Trips3)^2) * Trips3 + (250 + 2 * (Trips4)^2) * Trips4 + (300 + 1 * (Trips5)^2) * Trips5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500",
        "question": "A logistics company is planning its routes for the next quarter and operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different fuel efficiency and capacity, and the company needs to decide how many trips each vehicle should make to optimize its logistics operations. The cost of operating each vehicle is a nonlinear function of the number of trips due to varying fuel costs and maintenance expenses. The cost per trip for Truck1 is $100 + $5 * (Trips1)^2. The cost per trip for Truck2 is $150 + $4 * (Trips2)^2. The cost per trip for Truck3 is $200 + $3 * (Trips3)^2. The cost per trip for Truck4 is $250 + $2 * (Trips4)^2. The cost per trip for Truck5 is $300 + $1 * (Trips5)^2. The company aims to minimize the total operational cost of all vehicles. Additionally, the total number of trips across all vehicles must not exceed 500. Please help the company determine the optimal number of trips for each vehicle to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Truck5\n\n# Define objective function\n## The cost of operating each vehicle is a nonlinear function of the number of trips\nCost1 = (100 + 5 * Trips1**2) * Trips1\nCost2 = (150 + 4 * Trips2**2) * Trips2\nCost3 = (200 + 3 * Trips3**2) * Trips3\nCost4 = (250 + 2 * Trips4**2) * Trips4\nCost5 = (300 + 1 * Trips5**2) * Trips5\n## Total operational cost\nCost = Cost1 + Cost2 + Cost3 + Cost4 + Cost5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total number of trips across all vehicles must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of trips for Truck5: \", model.getVal(Trips5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"number of batteries for energy storage\": \"Batteries\", \"range\": \"Batteries >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to geographical and weather conditions. The efficiency is 20% for Location A, 25% for Location B, and 18% for Location C. The wind turbines have an efficiency of 30% at Location A, 28% at Location B, and 32% at Location C. Each battery has a capacity of 100 kWh. The company aims to minimize the total cost of energy generation and storage, which is a nonlinear function of the number of installations and batteries.\n// Total energy generated: Energy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\n// Total cost: Cost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations and batteries.\n// (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries. The efficiency of solar panels and wind turbines at each location varies due to geographical and weather conditions, and each battery has a capacity of 100 kWh. The company aims to minimize the total cost of energy generation and storage.\n\n| Component       | Location A Efficiency | Location B Efficiency | Location C Efficiency | Cost per Unit |\n|-----------------|-----------------------|-----------------------|-----------------------|---------------|\n| Solar Panels    | 20%                   | 25%                   | 18%                   | $1000         |\n| Wind Turbines   | 30%                   | 28%                   | 32%                   | $1500         |\n| Batteries       | -                     | -                     | -                     | $500          |\n\nThe company has a budget of $100,000 for the installations and batteries. Please help the company determine the optimal number of solar panels, wind turbines, and batteries to install at each location to minimize the total cost of energy generation and storage, which is a nonlinear function of the number of installations and batteries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Location A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Location B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Location C\nBatteries = model.addVar(vtype=\"INTEGER\", name=\"Batteries\", lb=0) # number of batteries for energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\nCost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations and batteries.\nmodel.addCons((SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Location B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Location C: \", model.getVal(WindC))\n    print(\"Number of Batteries: \", model.getVal(Batteries))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1418,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 2000 units for all components combined.\n// E1 + E2 + E3 + E4 + E5 <= 2000\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\n// E4 <= E1 + E2",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company has a budget of $50,000 for production costs next month. The company has a storage capacity of 2000 units for all components combined. The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\nPlease help the company to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (20 - 10 - 1) * E1\nProfit_E2 = (25 - 15 - 1.5) * E2\nProfit_E3 = (30 - 20 - 2) * E3\nProfit_E4 = (35 - 25 - 2.5) * E4\nProfit_E5 = (40 - 30 - 3) * E5\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n## The company has a storage capacity of 2000 units for all components combined.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 <= 2000)\n## The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\nmodel.addCons(E4 <= E1 + E2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1327,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of delivery vehicles. The company has five types of vehicles: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Small vehicle has a fuel efficiency of 20 km/l, a maintenance cost of $500 per month, and a capacity of 500 kg.\nThe Medium vehicle has a fuel efficiency of 15 km/l, a maintenance cost of $700 per month, and a capacity of 1000 kg.\nThe Large vehicle has a fuel efficiency of 10 km/l, a maintenance cost of $1000 per month, and a capacity of 1500 kg.\nThe Electric vehicle has a fuel efficiency equivalent to 30 km/l, a maintenance cost of $800 per month, and a capacity of 750 kg.\nThe Hybrid vehicle has a fuel efficiency of 25 km/l, a maintenance cost of $600 per month, and a capacity of 1250 kg.\nThe company aims to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities.\n// Monthly maintenance costs: Costs = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\n// Sum of vehicle capacities: Capacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n// So, the objective function is: Minimize Costs / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle maintenance.\n// 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid <= 15000\n\n## Generate Constraint-2:\nThe company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\n// 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid >= 10000\n\n## Generate Constraint-3:\nThe company wants to have at least 5 vehicles of each type.\n// Small >= 5; Medium >= 5; Large >= 5; Electric >= 5; Hybrid >= 5\n\n## Generate Constraint-4:\nThe company aims to have no more than 20% of its fleet as Electric vehicles due to charging infrastructure limitations.\n// Electric <= 0.2 * (Small + Medium + Large + Electric + Hybrid)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Hybrid vehicles does not exceed the combined number of Small and Medium vehicles.\n// Hybrid <= Small + Medium",
        "question": "A logistics company needs to optimize its fleet of delivery vehicles, which includes five types: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost per Month ($) | Capacity (kg) |\n|--------------|-----------------------|--------------------------------|---------------|\n| Small        | 20                    | 500                            | 500           |\n| Medium       | 15                    | 700                            | 1000          |\n| Large        | 10                    | 1000                           | 1500          |\n| Electric     | 30                    | 800                            | 750           |\n| Hybrid       | 25                    | 600                            | 1250          |\n\nThe company has a budget of $15,000 per month for vehicle maintenance. The company needs to ensure that the total capacity of the fleet is at least 10,000 kg. The company wants to have at least 5 vehicles of each type. Due to charging infrastructure limitations, the company aims to have no more than 20% of its fleet as Electric vehicles. The company also wants to ensure that the number of Hybrid vehicles does not exceed the combined number of Small and Medium vehicles.\n\nPlease help the company to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=5)  # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=5)  # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=5)  # number of Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=5)  # number of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=5)  # number of Hybrid vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCosts = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\nCapacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n## the objective function is: Minimize Costs / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Costs)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle maintenance.\nmodel.addCons(Costs <= 15000)\n## The company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\nmodel.addCons(Capacity >= 10000)\n## The company wants to have at least 5 vehicles of each type.\nmodel.addCons(Small >= 5)\nmodel.addCons(Medium >= 5)\nmodel.addCons(Large >= 5)\nmodel.addCons(Electric >= 5)\nmodel.addCons(Hybrid >= 5)\n## The company aims to have no more than 20% of its fleet as Electric vehicles due to charging infrastructure limitations.\nmodel.addCons(Electric <= 0.2 * (Small + Medium + Large + Electric + Hybrid))\n## The company wants to ensure that the number of Hybrid vehicles does not exceed the combined number of Small and Medium vehicles.\nmodel.addCons(Hybrid <= Small + Medium)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Electric vehicles: \", model.getVal(Electric))\n    print(\"Number of Hybrid vehicles: \", model.getVal(Hybrid))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1574,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different production methods: Method1 and Method2.\n// {\"production quantity for ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductA using Method1\": \"ProductAMethod1\", \"range\": \"ProductAMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB using Method1\": \"ProductBMethod1\", \"range\": \"ProductBMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC using Method1\": \"ProductCMethod1\", \"range\": \"ProductCMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductA using Method2\": \"ProductAMethod2\", \"range\": \"ProductAMethod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB using Method2\": \"ProductBMethod2\", \"range\": \"ProductBMethod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC using Method2\": \"ProductCMethod2\", \"range\": \"ProductCMethod2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of using Method1 is $20 per unit, and the cost of using Method2 is $30 per unit. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_ProductA = (50 - 20) * ProductAMethod1 + (50 - 30) * ProductAMethod2\n// Total profit for ProductB: Profit_ProductB = (70 - 20) * ProductBMethod1 + (70 - 30) * ProductBMethod2\n// Total profit for ProductC: Profit_ProductC = (90 - 20) * ProductCMethod1 + (90 - 30) * ProductCMethod2\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total production capacity for all products using Method1 is 100 units.\n// ProductAMethod1 + ProductBMethod1 + ProductCMethod1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity for all products using Method2 is 150 units.\n// ProductAMethod2 + ProductBMethod2 + ProductCMethod2 <= 150\n\n## Generate Constraint-3:\nThe company has a budget constraint of $5000 for the total cost of production methods.\n// 20 * (ProductAMethod1 + ProductBMethod1 + ProductCMethod1) + 30 * (ProductAMethod2 + ProductBMethod2 + ProductCMethod2) <= 5000\n\n## Generate Constraint-4:\nThe demand for ProductA is at least 50 units, and the demand for ProductB is at least 60 units.\n// ProductA >= 50; ProductB >= 60",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different production methods: Method1 and Method2. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of using Method1 is $20 per unit, and the cost of using Method2 is $30 per unit. The company wants to maximize the total profit. The total production capacity for all products using Method1 is 100 units, and for Method2 is 150 units. The company has a budget constraint of $5000 for the total cost of production methods. The demand for ProductA is at least 50 units, and the demand for ProductB is at least 60 units.\n\nPlease help the company determine the optimal production quantities for each product using both methods to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50)  # production quantity for ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=60)  # production quantity for ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)    # production quantity for ProductC\nProductAMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductAMethod1\", lb=0)  # production quantity for ProductA using Method1\nProductBMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductBMethod1\", lb=0)  # production quantity for ProductB using Method1\nProductCMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductCMethod1\", lb=0)  # production quantity for ProductC using Method1\nProductAMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductAMethod2\", lb=0)  # production quantity for ProductA using Method2\nProductBMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductBMethod2\", lb=0)  # production quantity for ProductB using Method2\nProductCMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductCMethod2\", lb=0)  # production quantity for ProductC using Method2\n\n# Define objective function\nProfit_ProductA = (50 - 20) * ProductAMethod1 + (50 - 30) * ProductAMethod2\nProfit_ProductB = (70 - 20) * ProductBMethod1 + (70 - 30) * ProductBMethod2\nProfit_ProductC = (90 - 20) * ProductCMethod1 + (90 - 30) * ProductCMethod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAMethod1 + ProductBMethod1 + ProductCMethod1 <= 100)  # total production capacity for Method1\nmodel.addCons(ProductAMethod2 + ProductBMethod2 + ProductCMethod2 <= 150)  # total production capacity for Method2\nmodel.addCons(20 * (ProductAMethod1 + ProductBMethod1 + ProductCMethod1) + 30 * (ProductAMethod2 + ProductBMethod2 + ProductCMethod2) <= 5000)  # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC))\n    print(\"Production Quantity for ProductA using Method1: \", model.getVal(ProductAMethod1))\n    print(\"Production Quantity for ProductB using Method1: \", model.getVal(ProductBMethod1))\n    print(\"Production Quantity for ProductC using Method1: \", model.getVal(ProductCMethod1))\n    print(\"Production Quantity for ProductA using Method2: \", model.getVal(ProductAMethod2))\n    print(\"Production Quantity for ProductB using Method2: \", model.getVal(ProductBMethod2))\n    print(\"Production Quantity for ProductC using Method2: \", model.getVal(ProductCMethod2))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare and water usage per hectare for each crop are given in the following Table.\n\n| Crop       | Profit per Hectare | Water Usage per Hectare |\n|------------|--------------------|-------------------------|\n| Wheat      | $300               | 500 liters              |\n| Corn       | $400               | 600 liters              |\n| Soybeans   | $500               | 400 liters              |\n| Barley     | $200               | 300 liters              |\n| Oats       | $150               | 200 liters              |\n\nThe farmer has 100 hectares of land available. The total water available for irrigation is 50,000 liters. The farmer must plant at least 10 hectares of Wheat. \nPlease help the farmer to maximize the profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # area of land for Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # area of land for Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit Rate per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"investment per Small wind farm\": \"InvestmentSmall\", \"range\": \"InvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment per Medium wind farm\": \"InvestmentMedium\", \"range\": \"InvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment per Large wind farm\": \"InvestmentLarge\", \"range\": \"InvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n// EnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\n// EnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\n// EnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\n// OperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for investment in all wind farms.\n// InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10,000,000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm. The energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n\n| Wind Farm Type | Energy Output Increase per $100,000 Investment |\n|----------------|------------------------------------------------|\n| Small          | 10 MWh                                         |\n| Medium         | 15 MWh                                         |\n| Large          | 20 MWh                                         |\n\nThe company has a total budget of $10 million for investment in all wind farms. Please help the company to determine the optimal number of each type of wind farm and the investment per farm to maximize the net energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSmall\", lb=0)\nInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentMedium\", lb=0)\nInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentLarge\", lb=0)\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\nEnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\nEnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\nOperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\nNetEnergyOutput = EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetEnergyOutput)\n\n# Add constraints\nmodel.addCons(InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Investment per Small Wind Farm: \", model.getVal(InvestmentSmall))\n    print(\"Investment per Medium Wind Farm: \", model.getVal(InvestmentMedium))\n    print(\"Investment per Large Wind Farm: \", model.getVal(InvestmentLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1441,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n// LaborA = 2 * UnitsA\n// LaborB = 3 * UnitsB\n// LaborC = 4 * UnitsC",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n\n| Device | Profit per Unit | Labor Hours per Unit |\n|--------|-----------------|----------------------|\n| DeviceA | $100            | 2 hours              |\n| DeviceB | $150            | 3 hours              |\n| DeviceC | $200            | 4 hours              |\n\nThe company has a total of 1000 labor hours available for the month. The production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n\nPlease help the company to maximize the total profit, considering the constraints on labor hours and the relationship between labor hours and production units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)  # Total labor hours constraint\nmodel.addCons(LaborA == 2 * UnitsA)  # Labor hours per unit for DeviceA\nmodel.addCons(LaborB == 3 * UnitsB)  # Labor hours per unit for DeviceB\nmodel.addCons(LaborC == 4 * UnitsC)  # Labor hours per unit for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor Hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor Hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1235,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies and capacities.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per km, the delivery speed is 50 km/h, and the cost per truck is $50,000.\nFor T2, the fuel consumption rate is 0.4 liters per km, the delivery speed is 60 km/h, and the cost per truck is $60,000.\nFor T3, the fuel consumption rate is 0.3 liters per km, the delivery speed is 70 km/h, and the cost per truck is $70,000.\nFor T4, the fuel consumption rate is 0.25 liters per km, the delivery speed is 80 km/h, and the cost per truck is $80,000.\nFor T5, the fuel consumption rate is 0.2 liters per km, the delivery speed is 90 km/h, and the cost per truck is $90,000.\nThe company wants to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).\n// Total_Cost_T1 = 50000 * T1 / 50\n// Total_Cost_T2 = 60000 * T2 / 60\n// Total_Cost_T3 = 70000 * T3 / 70\n// Total_Cost_T4 = 80000 * T4 / 80\n// Total_Cost_T5 = 90000 * T5 / 90\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000\n\n## Generate Constraint-2:\nThe total fuel consumption must not exceed 10,000 liters per day.\n// 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks in total.\n// T1 + T2 + T3 + T4 + T5 >= 10",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies and capacities.\nFor T1, the fuel consumption rate is 0.5 liters per km, the delivery speed is 50 km/h, and the cost per truck is $50,000.\nFor T2, the fuel consumption rate is 0.4 liters per km, the delivery speed is 60 km/h, and the cost per truck is $60,000.\nFor T3, the fuel consumption rate is 0.3 liters per km, the delivery speed is 70 km/h, and the cost per truck is $70,000.\nFor T4, the fuel consumption rate is 0.25 liters per km, the delivery speed is 80 km/h, and the cost per truck is $80,000.\nFor T5, the fuel consumption rate is 0.2 liters per km, the delivery speed is 90 km/h, and the cost per truck is $90,000.\nThe company has a budget of $1,000,000 for purchasing trucks. The total fuel consumption must not exceed 10,000 liters per day. The company must have at least 10 trucks in total.\nPlease help the company to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 50000 * T1 / 50\nTotal_Cost_T2 = 60000 * T2 / 60\nTotal_Cost_T3 = 70000 * T3 / 70\nTotal_Cost_T4 = 80000 * T4 / 80\nTotal_Cost_T5 = 90000 * T5 / 90\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000)\n## The total fuel consumption must not exceed 10,000 liters per day.\nmodel.addCons(0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000)\n## The company must have at least 10 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3, and a new type of device E4. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the revenue per unit is $100, the production cost per unit is $40, and the energy consumption per unit is 5 kWh.\nFor E2, the revenue per unit is $120, the production cost per unit is $50, and the energy consumption per unit is 6 kWh.\nFor E3, the revenue per unit is $140, the production cost per unit is $60, and the energy consumption per unit is 7 kWh.\nFor E4, the revenue per unit is $160, the production cost per unit is $70, and the energy consumption per unit is 8 kWh.\nThe manufacturer aims to maximize the net profit per unit of energy consumed.\n// Profit_E1 = (100 * E1 - 40 * E1) / (5 * E1)\n// Profit_E2 = (120 * E2 - 50 * E2) / (6 * E2)\n// Profit_E3 = (140 * E3 - 60 * E3) / (7 * E3)\n// Profit_E4 = (160 * E4 - 70 * E4) / (8 * E4)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4)\n\n## Generate Constraint-1:\nThe manufacturer has a total energy budget of 500 kWh.\n// 5 * E1 + 6 * E2 + 7 * E3 + 8 * E4 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a total production cost budget of $15000.\n// 40 * E1 + 50 * E2 + 60 * E3 + 70 * E4 <= 15000\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 200 units in total.\n// E1 + E2 + E3 + E4 <= 200\n\n## Generate Constraint-4:\nThe market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1.\n// E1 <= 50",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3, and a new type of device E4. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints. The revenue per unit, production cost per unit, and energy consumption per unit for each device are given in the following Table.\n\n| Device | Revenue per Unit | Production Cost per Unit | Energy Consumption per Unit |\n|--------|------------------|--------------------------|-----------------------------|\n| E1     | $100             | $40                      | 5 kWh                       |\n| E2     | $120             | $50                      | 6 kWh                       |\n| E3     | $140             | $60                      | 7 kWh                       |\n| E4     | $160             | $70                      | 8 kWh                       |\n\nThe manufacturer has a total energy budget of 500 kWh. The manufacturer has a total production cost budget of $15000. The manufacturer has a production capacity of 200 units in total. The market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1. \nPlease help the manufacturer to maximize the net profit per unit of energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=50)  # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0)  # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0)  # quantity of E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0)  # quantity of E4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (100 * E1 - 40 * E1)\nProfit_E2 = (120 * E2 - 50 * E2)\nProfit_E3 = (140 * E3 - 60 * E3)\nProfit_E4 = (160 * E4 - 70 * E4)\nEnergy_Consumption = 5 * E1 + 6 * E2 + 7 * E3 + 8 * E4\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4) / Energy_Consumption\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Consumption == Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4)\n\n# Add constraints\n## The manufacturer has a total energy budget of 500 kWh.\nmodel.addCons(5 * E1 + 6 * E2 + 7 * E3 + 8 * E4 <= 500)\n## The manufacturer has a total production cost budget of $15000.\nmodel.addCons(40 * E1 + 50 * E2 + 60 * E3 + 70 * E4 <= 15000)\n## The manufacturer has a production capacity of 200 units in total.\nmodel.addCons(E1 + E2 + E3 + E4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Quantity of E4: \", model.getVal(E4))\n    print(\"Maximized Net Profit per Unit of Energy Consumed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1266,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: CostA = 20 + 0.05 * UnitsA^2, CostB = 30 + 0.03 * UnitsB^2, CostC = 40 + 0.02 * UnitsC^2, CostD = 50 + 0.01 * UnitsD^2. The company wants to maximize its total net profit.\n// Total net profit for DeviceA: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * UnitsA^2)) * UnitsA\n// Total net profit for DeviceB: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * UnitsB^2)) * UnitsB\n// Total net profit for DeviceC: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * UnitsC^2)) * UnitsC\n// Total net profit for DeviceD: ProfitD = (110 - CostD) * UnitsD = (110 - (50 + 0.01 * UnitsD^2)) * UnitsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs per month.\n// (20 + 0.05 * UnitsA^2) * UnitsA + (30 + 0.03 * UnitsB^2) * UnitsB + (40 + 0.02 * UnitsC^2) * UnitsC + (50 + 0.01 * UnitsD^2) * UnitsD <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// UnitsA >= 100; UnitsB >= 100; UnitsC >= 100; UnitsD >= 100",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit and the production cost function for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|---------------------------|\n| DeviceA | $50 | 20 + 0.05 * UnitsA^2 |\n| DeviceB | $70 | 30 + 0.03 * UnitsB^2 |\n| DeviceC | $90 | 40 + 0.02 * UnitsC^2 |\n| DeviceD | $110 | 50 + 0.01 * UnitsD^2 |\n\nThe company has a total production capacity of 1000 units per month. Due to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units. The company has a budget of $50,000 for production costs per month. The company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n\nPlease help the company to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=100) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=100) # number of units of DeviceD\n\n# Define objective function\n## Total net profit for DeviceA: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * UnitsA^2)) * UnitsA\n## Total net profit for DeviceB: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * UnitsB^2)) * UnitsB\n## Total net profit for DeviceC: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * UnitsC^2)) * UnitsC\n## Total net profit for DeviceD: ProfitD = (110 - CostD) * UnitsD = (110 - (50 + 0.01 * UnitsD^2)) * UnitsD\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nProfitA = (50 - (20 + 0.05 * UnitsA**2)) * UnitsA\nProfitB = (70 - (30 + 0.03 * UnitsB**2)) * UnitsB\nProfitC = (90 - (40 + 0.02 * UnitsC**2)) * UnitsC\nProfitD = (110 - (50 + 0.01 * UnitsD**2)) * UnitsD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD <= 1000)\n## Due to market demand, the number of DeviceA units produced must be at least twice the number of DeviceB units.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget of $50,000 for production costs per month.\nmodel.addCons((20 + 0.05 * UnitsA**2) * UnitsA + (30 + 0.03 * UnitsB**2) * UnitsB + (40 + 0.02 * UnitsC**2) * UnitsC + (50 + 0.01 * UnitsD**2) * UnitsD <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit. The profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\n// Total profit for Route1: Profit1 = (1000 + 0.2 * Upgrade1) * Trucks1\n// Total profit for Route2: Profit2 = (1200 + 0.24 * Upgrade2) * Trucks2\n// Total profit for Route3: Profit3 = (900 + 0.18 * Upgrade3) * Trucks3\n// Additional profit from advertising: AdvertisingProfit = 5 * Advertising\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n## Generate Constraint-1:\nThe total budget for trucks, upgrades, and advertising is $100,000.\n// Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000",
        "question": "A logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\nThe profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\nThe total budget for trucks, upgrades, and advertising is $100,000.\nPlease help the company to maximize its quarterly profit, which is defined as the sum of the profits from each route and the additional profit from advertising.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\n\n# Define objective function\nProfit1 = (1000 + 0.2 * Upgrade1) * Trucks1\nProfit2 = (1200 + 0.24 * Upgrade2) * Trucks2\nProfit3 = (900 + 0.18 * Upgrade3) * Trucks3\nAdvertisingProfit = 5 * Advertising\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each component varies with the quantity produced. For component A, the cost is 10$ per unit for the first 100 units and 8$ per unit thereafter. For component B, the cost is 15$ per unit for the first 50 units and 12$ per unit thereafter. For component C, the cost is 20$ per unit for the first 100 units and 15$ per unit thereafter. For component D, the cost is 25$ per unit for the first 50 units and 20$ per unit thereafter. For component E, the cost is 30$ per unit for the first 100 units and 25$ per unit thereafter. The company aims to minimize the total production cost.\n// Cost of A: if A <= 100 then Cost_A = 10 * A else Cost_A = 10 * 100 + 8 * (A - 100)\n// Cost of B: if B <= 50 then Cost_B = 15 * B else Cost_B = 15 * 50 + 12 * (B - 50)\n// Cost of C: if C <= 100 then Cost_C = 20 * C else Cost_C = 20 * 100 + 15 * (C - 100)\n// Cost of D: if D <= 50 then Cost_D = 25 * D else Cost_D = 25 * 50 + 20 * (D - 50)\n// Cost of E: if E <= 100 then Cost_E = 30 * E else Cost_E = 30 * 100 + 25 * (E - 100)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) <= 5000\n\n## Generate Constraint-2:\nThe company must produce at least 50 units of each component.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize its operations. The cost of producing each component varies with the quantity produced. For component A, the cost is 10$ per unit for the first 100 units and 8$ per unit thereafter. For component B, the cost is 15$ per unit for the first 50 units and 12$ per unit thereafter. For component C, the cost is 20$ per unit for the first 100 units and 15$ per unit thereafter. For component D, the cost is 25$ per unit for the first 50 units and 20$ per unit thereafter. For component E, the cost is 30$ per unit for the first 100 units and 25$ per unit thereafter. The company has a budget of $5000 for production costs. The company must produce at least 50 units of each component. Please help the company to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 50 units of each component.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of component E\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = if A <= 100 then 10 * A else 10 * 100 + 8 * (A - 100)\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 10 * A1 * A_b1 + (10 * 100 + 8 * (A2 - 100)) * A2 * A_b2\n\n## create piecewise variables for piecewise function: Cost_B = if B <= 50 then 15 * B else 15 * 50 + 12 * (B - 50)\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=50, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=50, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 15 * B1 * B_b1 + (15 * 50 + 12 * (B2 - 50)) * B2 * B_b2\n\n## create piecewise variables for piecewise function: Cost_C = if C <= 100 then 20 * C else 20 * 100 + 15 * (C - 100)\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 20 * C1 * C_b1 + (20 * 100 + 15 * (C2 - 100)) * C2 * C_b2\n\n## create piecewise variables for piecewise function: Cost_D = if D <= 50 then 25 * D else 25 * 50 + 20 * (D - 50)\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=50, ub=50)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=50, ub=math.inf)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nCost_D = 25 * D1 * D_b1 + (25 * 50 + 20 * (D2 - 50)) * D2 * D_b2\n\n## create piecewise variables for piecewise function: Cost_E = if E <= 100 then 30 * E else 30 * 100 + 25 * (E - 100)\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=50, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=math.inf)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nCost_E = 30 * E1 * E_b1 + (30 * 100 + 25 * (E2 - 100)) * E2 * E_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n// Revenue_A = 50 * A\n// Revenue_B = 70 * B\n// Revenue_C = 60 * C\n// Cost_A = 0.01 * A^2\n// Cost_B = 0.015 * B^2\n// Cost_C = 0.012 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\n// A <= 1000\n// B <= 800\n// C <= 900\n\n## Generate Constraint-2:\nThe market demand for product A is at least 500 units, for product B is at least 400 units, and for product C is at least 600 units.\n// A >= 500\n// B >= 400\n// C >= 600\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 2000 units across all products.\n// A + B + C <= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C. The market demand for product A is at least 500 units, for product B is at least 400 units, and for product C is at least 600 units. The total production capacity of the company is limited to 2000 units across all products. Please help the company to maximize the total profit, which is the revenue minus the production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500, ub=1000) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=400, ub=800) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=600, ub=900) # production quantity of product C\n\n# Define objective function\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nTotalProfit = Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has an operational cost of $100 per day and can carry 10 tons of cargo. Each Medium truck costs $150 per day and carries 20 tons. Each Large truck costs $200 per day and carries 30 tons. Each Extra-Large truck costs $250 per day and carries 40 tons. Each Refrigerated truck costs $300 per day and carries 25 tons. The company needs to transport at least 500 tons of cargo daily. The objective is to minimize the total daily operational cost while meeting the cargo requirement.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\n// Total capacity = 10 * S + 20 * M + 30 * L + 40 * XL + 25 * R\n// The objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * R) subject to the constraint that Total capacity >= 500\n\n## Generate Constraint-1:\nThe company has a budget constraint of $5000 per day for all truck operations.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs. Each Small truck has an operational cost of $100 per day and can carry 10 tons of cargo. Each Medium truck costs $150 per day and carries 20 tons. Each Large truck costs $200 per day and carries 30 tons. Each Extra-Large truck costs $250 per day and carries 40 tons. Each Refrigerated truck costs $300 per day and carries 25 tons. The company needs to transport at least 500 tons of cargo daily. The company has a budget constraint of $5000 per day for all truck operations. Please help the company to minimize the total daily operational cost while meeting the cargo requirement.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R)\n\n# Add constraints\n## Total capacity = 10 * S + 20 * M + 30 * L + 40 * XL + 25 * R\n## The company needs to transport at least 500 tons of cargo daily.\nmodel.addCons(10 * S + 20 * M + 30 * L + 40 * XL + 25 * R >= 500)\n## The company has a budget constraint of $5000 per day for all truck operations.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n// Packages delivered by Trucks per hour: Packages_Trucks = 100 * Trucks * 50\n// Packages delivered by Vans per hour: Packages_Vans = 50 * Vans * 40\n// Packages delivered by Bikes per hour: Packages_Bikes = 10 * Bikes * 20\n// So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\n// 100 * Trucks + 50 * Vans + 20 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers.\n// 2 * Trucks + Vans + 0.5 * Bikes <= 100\n\n## Generate Constraint-3:\nThe company has a storage capacity limitation of 5000 packages. Each Truck can carry 100 packages, each Van can carry 50 packages, and each Bike can carry 10 packages.\n// 100 * Trucks + 50 * Vans + 10 * Bikes <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans.\n// Bikes <= Trucks + Vans",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle. Each Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour. The company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20. The company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers. The company has a storage capacity limitation of 5000 packages. Each Truck can carry 100 packages, each Van can carry 50 packages, and each Bike can carry 10 packages. The company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans. Please help the company to maximize the total number of packages delivered per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nPackages_Trucks = 100 * Trucks * 50\nPackages_Vans = 50 * Vans * 40\nPackages_Bikes = 10 * Bikes * 20\n# So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n# Add constraints\n# The company has a budget of $10,000 per day for vehicle maintenance.\nmodel.addCons(100 * Trucks + 50 * Vans + 20 * Bikes <= 10000)\n# The company has a total of 100 drivers available.\nmodel.addCons(2 * Trucks + Vans + 0.5 * Bikes <= 100)\n# The company has a storage capacity limitation of 5000 packages.\nmodel.addCons(100 * Trucks + 50 * Vans + 10 * Bikes <= 5000)\n# The company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans.\nmodel.addCons(Bikes <= Trucks + Vans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource X used for product A\": \"ResourceXA\", \"range\": \"ResourceXA >= 0\", \"type\": \"real\"}\n// {\"resource X used for product B\": \"ResourceXB\", \"range\": \"ResourceXB >= 0\", \"type\": \"real\"}\n// {\"resource X used for product C\": \"ResourceXC\", \"range\": \"ResourceXC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 100 units of resource X available. The usage of resource X per unit of product A is 0.5, for product B is 0.6, and for product C is 0.4.\n// ResourceXA + ResourceXB + ResourceXC <= 100\n// UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units.\n// UnitsA <= 150\n// UnitsB <= 120\n// UnitsC <= 100\n\n## Generate Constraint-3:\nThe production capacity of the company is limited to 300 units in total.\n// UnitsA + UnitsB + UnitsC <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product A as product B.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. The company has a total of 100 units of resource X available, with the usage of resource X per unit of product A being 0.5, for product B being 0.6, and for product C being 0.4. The market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units. The production capacity of the company is limited to 300 units in total. The company has a policy to produce at least twice as many units of product A as product B. Please help the company to maximize the total profit from the sales of all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 100 units of resource X available.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100)\n# The market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units.\nmodel.addCons(UnitsA <= 150)\nmodel.addCons(UnitsB <= 120)\nmodel.addCons(UnitsC <= 100)\n# The production capacity of the company is limited to 300 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 300)\n# The company has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is 5$, for B it is 7$, for C it is 9$, for D it is 11$, and for E it is 13$. The company aims to minimize the total shipping cost while maintaining a certain profit margin. The profit margin is defined as the difference between the selling price and the shipping cost per unit. The selling price for each product is 10$ for A, 15$ for B, 20$ for C, 25$ for D, and 30$ for E. The objective is to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price.\n// Shipping cost of A: Cost_A = 5 * A\n// Shipping cost of B: Cost_B = 7 * B\n// Shipping cost of C: Cost_C = 9 * C\n// Shipping cost of D: Cost_D = 11 * D\n// Shipping cost of E: Cost_E = 13 * E\n// Profit margin of A: Profit_A = (10 - 5) * A\n// Profit margin of B: Profit_B = (15 - 7) * B\n// Profit margin of C: Profit_C = (20 - 9) * C\n// Profit margin of D: Profit_D = (25 - 11) * D\n// Profit margin of E: Profit_E = (30 - 13) * E\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for shipping costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company must ship at least 20 units of each product to meet customer demands.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints. The cost of shipping each product varies with the quantity shipped, and the selling price for each product is also provided in the following Table.\n\n| Product | Selling Price | Shipping Cost per Unit |\n|---------|---------------|------------------------|\n| A       | 10$           | 5$                     |\n| B       | 15$           | 7$                     |\n| C       | 20$           | 9$                     |\n| D       | 25$           | 11$                    |\n| E       | 30$           | 13$                    |\n\nThe company has a budget of $1500 for shipping costs. The company must ship at least 20 units of each product to meet customer demands. The company aims to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price. Please help the company to determine the optimal number of units of each product to ship.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ship at least 20 units of each product to meet customer demands.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## Shipping cost of A: Cost_A = 5 * A\n## Shipping cost of B: Cost_B = 7 * B\n## Shipping cost of C: Cost_C = 9 * C\n## Shipping cost of D: Cost_D = 11 * D\n## Shipping cost of E: Cost_E = 13 * E\nCost_A = 5 * A\nCost_B = 7 * B\nCost_C = 9 * C\nCost_D = 11 * D\nCost_E = 13 * E\n## Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $1500 for shipping costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Minimized Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and distance for each route are given in the following Table.\n\n| Route | Cost per Mile | Distance |\n|-------|---------------|----------|\n| A     | $2            | 100 miles|\n| B     | $3            | 150 miles|\n| C     | $4            | 200 miles|\n| D     | $5            | 250 miles|\n| E     | $6            | 300 miles|\n\nThe company has a total of 50 trucks available. Each route must have at least 2 trucks. Please help the company to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a revenue per trip of $1000, a fuel cost per trip of $200, and a maintenance cost per trip of $100.\nTruck B has a revenue per trip of $1500, a fuel cost per trip of $300, and a maintenance cost per trip of $150.\nTruck C has a revenue per trip of $2000, a fuel cost per trip of $400, and a maintenance cost per trip of $200.\nThe company wants to maximize the net profit per trip across all vehicles.\n// Profit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\n// Profit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\n// Profit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total budget of $5000 for maintenance costs per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-3:\nThe company has a limited fleet size of 50 vehicles in total.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-4:\nThe company has a daily operational limit of 100 trips.\n// TruckA + 1.5 * TruckB + 2 * TruckC <= 100\n\n## Generate Constraint-5:\nThe market demand for Truck A trips is 30. So, the company can only operate a maximum of 30 Truck A vehicles.\n// TruckA <= 30",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\nTruck A has a revenue per trip of $1000, a fuel cost per trip of $200, and a maintenance cost per trip of $100.\nTruck B has a revenue per trip of $1500, a fuel cost per trip of $300, and a maintenance cost per trip of $150.\nTruck C has a revenue per trip of $2000, a fuel cost per trip of $400, and a maintenance cost per trip of $200.\nThe company has a total budget of $10,000 for fuel costs per day and a total budget of $5000 for maintenance costs per day. The company has a limited fleet size of 50 vehicles in total and a daily operational limit of 100 trips. The market demand for Truck A trips is 30, so the company can only operate a maximum of 30 Truck A vehicles.\nPlease help the company to maximize the net profit per trip across all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\nProfit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\nProfit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n# So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000)\n# The company has a total budget of $5000 for maintenance costs per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n# The company has a limited fleet size of 50 vehicles in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# The company has a daily operational limit of 100 trips.\nmodel.addCons(TruckA + 1.5 * TruckB + 2 * TruckC <= 100)\n# The market demand for Truck A trips is 30. So, the company can only operate a maximum of 30 Truck A vehicles.\nmodel.addCons(TruckA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Net Profit per Trip: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for each vehicle type per day are given in the following Table.\n\n| Vehicle | Operational Cost per Day |\n|---------|--------------------------|\n| Trucks  | $500                     |\n| Vans    | $300                     |\n| Bikes   | $100                     |\n| Drones  | $200                     |\n\nThe company has a budget of $100,000 for purchasing vehicles. The cost of purchasing each type of vehicle is as follows: Trucks cost $20,000 each, Vans cost $15,000 each, Bikes cost $5,000 each, and Drones cost $10,000 each. \n\nPlease help the company to minimize the total operational cost while ensuring efficient delivery coverage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities (City1, City2, City3, City4, City5) and the fuel efficiency of each truck, which can be improved with an investment in fuel-efficient technologies.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for each truck\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. The fuel efficiency of the trucks can be improved with an investment, reducing the fuel cost per trip. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company aims to maximize the total profit from all trips.\n// Profit per trip to City1: Profit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\n// Profit per trip to City2: Profit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\n// Profit per trip to City3: Profit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\n// Profit per trip to City4: Profit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\n// Profit per trip to City5: Profit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency investments.\n// EfficiencyInvestment <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n// Trips1 >= 50; Trips2 >= 75\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trips to City5 does not exceed the combined number of trips to City1, City2, and City3.\n// Trips5 <= Trips1 + Trips2 + Trips3",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities (City1, City2, City3, City4, City5). The company needs to determine the number of trips each truck should make to different cities and the investment in fuel-efficient technologies to improve the fuel efficiency of each truck. The profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company has a budget of $10,000 for fuel efficiency investments. The total number of trips across all cities must not exceed 500. Due to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2. The company wants to ensure that the number of trips to City5 does not exceed the combined number of trips to City1, City2, and City3.\n\nPlease help the company to maximize the total profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)    # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)    # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)    # number of trips to City5\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in fuel efficiency\n\n# Define objective function\nProfit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\nProfit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\nProfit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\nProfit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\nProfit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 10000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(Trips5 <= Trips1 + Trips2 + Trips3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost. The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\n// Profit_Route1 = Revenue_Route1 - FuelCost_Route1 = 1000 * T1 - 0.1 * T1^2\n// Profit_Route2 = Revenue_Route2 - FuelCost_Route2 = 1200 * T2 - 0.12 * T2^2\n// Profit_Route3 = Revenue_Route3 - FuelCost_Route3 = 1500 * T3 - 0.15 * T3^2\n// Profit_Route4 = Revenue_Route4 - FuelCost_Route4 = 1300 * T4 - 0.13 * T4^2\n// Profit_Route5 = Revenue_Route5 - FuelCost_Route5 = 1100 * T5 - 0.11 * T5^2\n// The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks due to road restrictions and operational efficiency.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 22; T5 <= 18\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10",
        "question": "A logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost, with the fuel cost being a nonlinear function of the number of trucks due to economies of scale in fuel purchasing. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks due to road restrictions and operational efficiency. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n\nPlease help the company to maximize its total profit across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks on route 5\n\n# Define objective function\n## The profit per route is calculated as the revenue from deliveries minus the fuel cost.\n## The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\nProfit_Route1 = 1000 * T1 - 0.1 * T1**2\nProfit_Route2 = 1200 * T2 - 0.12 * T2**2\nProfit_Route3 = 1500 * T3 - 0.15 * T3**2\nProfit_Route4 = 1300 * T4 - 0.13 * T4**2\nProfit_Route5 = 1100 * T5 - 0.11 * T5**2\n## The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks due to road restrictions and operational efficiency.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 22)\nmodel.addCons(T5 <= 18)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery demands.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nT1 has a fuel efficiency of 5 km/liter, T2 has 6 km/liter, T3 has 7 km/liter, T4 has 8 km/liter, and T5 has 9 km/liter. The company wants to minimize the total fuel consumption for all trips. The total distance to be covered by each type of truck is proportional to its number and its individual distance factor (T1: 100 km, T2: 120 km, T3: 140 km, T4: 160 km, T5: 180 km).\n// Fuel_T1 = (100 * T1) / 5\n// Fuel_T2 = (120 * T2) / 6\n// Fuel_T3 = (140 * T3) / 7\n// Fuel_T4 = (160 * T4) / 8\n// Fuel_T5 = (180 * T5) / 9\n// So, the objective function is: Minimize Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery demands. The fuel efficiency and the individual distance factor for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Individual Distance Factor (km) |\n|------------|---------------------------|---------------------------------|\n| T1         | 5                         | 100                             |\n| T2         | 6                         | 120                             |\n| T3         | 7                         | 140                             |\n| T4         | 8                         | 160                             |\n| T5         | 9                         | 180                             |\n\nThe company has a total budget of $500,000 for purchasing trucks. The cost of T1 is $50,000, T2 is $60,000, T3 is $70,000, T4 is $80,000, and T5 is $90,000. The company must meet a minimum delivery capacity of 10,000 cubic meters. T1 has a capacity of 100 cubic meters, T2 has 120 cubic meters, T3 has 140 cubic meters, T4 has 160 cubic meters, and T5 has 180 cubic meters.\n\nPlease help the company to minimize the total fuel consumption for all trips, which is calculated as the total distance to be covered by each type of truck divided by its fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_T1 = (100 * T1) / 5\nFuel_T2 = (120 * T2) / 6\nFuel_T3 = (140 * T3) / 7\nFuel_T4 = (160 * T4) / 8\nFuel_T5 = (180 * T5) / 9\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_T1 + Fuel_T2 + Fuel_T3 + Fuel_T4 + Fuel_T5)\n\n# Add constraints\n## The company has a total budget of $500,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 500000)\n## The company must meet a minimum delivery capacity of 10,000 cubic meters.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1491,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for ProductA\": \"RawMaterialACost\", \"range\": \"RawMaterialACost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductB\": \"RawMaterialBCost\", \"range\": \"RawMaterialBCost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductC\": \"RawMaterialCCost\", \"range\": \"RawMaterialCCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductA\": \"LaborACost\", \"range\": \"LaborACost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductB\": \"LaborBCost\", \"range\": \"LaborBCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductC\": \"LaborCCost\", \"range\": \"LaborCCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductA\": \"StorageACost\", \"range\": \"StorageACost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductB\": \"StorageBCost\", \"range\": \"StorageBCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductC\": \"StorageCCost\", \"range\": \"StorageCCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60.\n// Total profit for ProductA: Profit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\n// Total profit for ProductB: Profit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\n// Total profit for ProductC: Profit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for raw materials.\n// RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100,000\n\n## Generate Constraint-2:\nThe total labor cost should not exceed $50,000.\n// LaborACost * ProductAQty + LaborBCost * ProductBQty + LaborCCost * ProductCQty <= 50,000\n\n## Generate Constraint-3:\nThe total storage cost should not exceed $30,000.\n// StorageACost * ProductAQty + StorageBCost * ProductBQty + StorageCCost * ProductCQty <= 30,000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA should be at least twice the production of ProductB.\n// ProductAQty >= 2 * ProductBQty\n\n## Generate Constraint-5:\nThe company must produce at least 100 units of ProductC.\n// ProductCQty >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The company has a budget of $100,000 for raw materials. The total labor cost should not exceed $50,000. The total storage cost should not exceed $30,000. Due to market demand, the production of ProductA should be at least twice the production of ProductB. The company must produce at least 100 units of ProductC.\n\nPlease help the company to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # quantity of ProductC\nRawMaterialACost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialACost\", lb=0)  # cost of raw materials for ProductA\nRawMaterialBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialBCost\", lb=0)  # cost of raw materials for ProductB\nRawMaterialCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialCCost\", lb=0)  # cost of raw materials for ProductC\nLaborACost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborACost\", lb=0)  # labor cost per unit for ProductA\nLaborBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborBCost\", lb=0)  # labor cost per unit for ProductB\nLaborCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborCCost\", lb=0)  # labor cost per unit for ProductC\nStorageACost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageACost\", lb=0)  # storage cost per unit for ProductA\nStorageBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageBCost\", lb=0)  # storage cost per unit for ProductB\nStorageCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageCCost\", lb=0)  # storage cost per unit for ProductC\n\n# Define objective function\nProfit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\nProfit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\nProfit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100000)\nmodel.addCons(LaborACost * ProductAQty + LaborBCost * ProductBQty + LaborCCost * ProductCQty <= 50000)\nmodel.addCons(StorageACost * ProductAQty + StorageBCost * ProductBQty + StorageCCost * ProductCQty <= 30000)\nmodel.addCons(ProductAQty >= 2 * ProductBQty)\nmodel.addCons(ProductCQty >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\n// Total revenue for ProductB: RevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\n// Total revenue for ProductC: RevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $100,000.\n// MachineryA + MachineryB + MachineryC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume. The initial labor hours per unit and the revenue per unit for each product are given in the following Table.\n\n| Product | Initial Labor Hours per Unit | Revenue per Unit |\n|---------|------------------------------|------------------|\n| ProductA | 10 hours                     | $100             |\n| ProductB | 15 hours                     | $150             |\n| ProductC | 20 hours                     | $200             |\n\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products. The company has a total of 10,000 labor hours available for the month. The total capital investment in advanced machinery cannot exceed $100,000.\n\nPlease help the company to determine the optimal number of units to produce, labor hours allocated, capital investment in machinery, and marketing budget for each product to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours per unit of ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours per unit of ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours per unit of ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in machinery for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nRevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\nRevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\nRevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product.\nmodel.addCons(LaborA == 10 - MachineryA / 10000)\nmodel.addCons(LaborB == 15 - MachineryB / 10000)\nmodel.addCons(LaborC == 20 - MachineryC / 10000)\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000)\n# The total capital investment in advanced machinery cannot exceed $100,000.\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1502,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints.\n// {\"quantity of M1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company aims to maximize its total profit.\n// Profit_M1 = 100 * Q1 - 0.01 * Q1^2\n// Profit_M2 = 150 * Q2 - 0.02 * Q2^2\n// Profit_M3 = 200 * Q3 - 0.03 * Q3^2\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production costs.\n// 0.01 * Q1^2 + 0.02 * Q2^2 + 0.03 * Q3^2 <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 200 units.\n// Q1 + Q2 + Q3 <= 200\n\n## Generate Constraint-3:\nThe market demand for M1 is at least 50 units.\n// Q1 >= 50",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints. The profit per unit and the production cost for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost Model |\n|--------------|-----------------|-----------------------|\n| M1           | $100            | 0.01 * Q1^2           |\n| M2           | $150            | 0.02 * Q2^2           |\n| M3           | $200            | 0.03 * Q3^2           |\n\nThe company has a limited budget of $10,000 for production costs. The total production capacity of the company is 200 units. The market demand for M1 is at least 50 units. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50) # quantity of M1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of M2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of M3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = 100 * Q1 - 0.01 * Q1**2\nProfit_M2 = 150 * Q2 - 0.02 * Q2**2\nProfit_M3 = 200 * Q3 - 0.03 * Q3**2\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production costs.\nmodel.addCons(0.01 * Q1**2 + 0.02 * Q2**2 + 0.03 * Q3**2 <= 10000)\n## The total production capacity of the company is 200 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(Q1))\n    print(\"Quantity of M2: \", model.getVal(Q2))\n    print(\"Quantity of M3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential.\n// {\"number of solar panels in Urban zone\": \"Urban\", \"range\": \"Urban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Suburban zone\": \"Suburban\", \"range\": \"Suburban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Industrial zone\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Commercial zone\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Residential zone\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sun exposure and building heights. In Urban, the efficiency is 80%, in Suburban it's 90%, in Industrial it's 75%, in Commercial it's 85%, and in Residential it's 95%. The cost of installation per panel also varies: $1000 in Urban, $900 in Suburban, $1100 in Industrial, $1050 in Commercial, and $850 in Residential. The city aims to maximize the energy output per dollar spent.\n// Energy_Urban = 0.8 * Urban\n// Energy_Suburban = 0.9 * Suburban\n// Energy_Industrial = 0.75 * Industrial\n// Energy_Commercial = 0.85 * Commercial\n// Energy_Residential = 0.95 * Residential\n// Cost_Urban = 1000 * Urban\n// Cost_Suburban = 900 * Suburban\n// Cost_Industrial = 1100 * Industrial\n// Cost_Commercial = 1050 * Commercial\n// Cost_Residential = 850 * Residential\n// So, the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000\n\n## Generate Constraint-2:\nThere is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\n// Urban <= 500\n// Suburban <= 600\n// Industrial <= 400\n// Commercial <= 550\n// Residential <= 700\n\n## Generate Constraint-3:\nThe city aims to install at least 1000 total panels across all zones.\n// Urban + Suburban + Industrial + Commercial + Residential >= 1000\n\n## Generate Constraint-4:\nThe city wants to ensure a balanced distribution of solar panels, with no more than 40% of the total panels in any single zone.\n// Urban <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential)\n// Suburban <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential)\n// Industrial <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential)\n// Commercial <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential)\n// Residential <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential)",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential. The efficiency of solar panels and the cost of installation per panel vary by district due to different sun exposure and building heights. The details are given in the following Table.\n\n| Zone         | Efficiency | Installation Cost per Panel |\n|--------------|------------|----------------------------|\n| Urban        | 80%        | $1000                      |\n| Suburban     | 90%        | $900                       |\n| Industrial   | 75%        | $1100                      |\n| Commercial   | 85%        | $1050                      |\n| Residential  | 95%        | $850                       |\n\nThe city has a budget of $500,000 for the installation of solar panels. There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential. The city aims to install at least 1000 total panels across all zones. Additionally, the city wants to ensure a balanced distribution of solar panels, with no more than 40% of the total panels in any single zone.\n\nPlease help the city to maximize the energy output per dollar spent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrban = model.addVar(vtype=\"INTEGER\", name=\"Urban\", lb=0) # number of solar panels in Urban zone\nSuburban = model.addVar(vtype=\"INTEGER\", name=\"Suburban\", lb=0) # number of solar panels in Suburban zone\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0) # number of solar panels in Industrial zone\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0) # number of solar panels in Commercial zone\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0) # number of solar panels in Residential zone\n\n# Define objective function\nEnergy_Urban = 0.8 * Urban\nEnergy_Suburban = 0.9 * Suburban\nEnergy_Industrial = 0.75 * Industrial\nEnergy_Commercial = 0.85 * Commercial\nEnergy_Residential = 0.95 * Residential\nCost_Urban = 1000 * Urban\nCost_Suburban = 900 * Suburban\nCost_Industrial = 1100 * Industrial\nCost_Commercial = 1050 * Commercial\nCost_Residential = 850 * Residential\n# So, the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential) == Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential)\n\n# Add constraints\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000)\n# There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\nmodel.addCons(Urban <= 500)\nmodel.addCons(Suburban <= 600)\nmodel.addCons(Industrial <= 400)\nmodel.addCons(Commercial <= 550)\nmodel.addCons(Residential <= 700)\n# The city aims to install at least 1000 total panels across all zones.\nmodel.addCons(Urban + Suburban + Industrial + Commercial + Residential >= 1000)\n# The city wants to ensure a balanced distribution of solar panels, with no more than 40% of the total panels in any single zone.\nmodel.addCons(Urban <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential))\nmodel.addCons(Suburban <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential))\nmodel.addCons(Industrial <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential))\nmodel.addCons(Commercial <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential))\nmodel.addCons(Residential <= 0.4 * (Urban + Suburban + Industrial + Commercial + Residential))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Urban: \", model.getVal(Urban))\n    print(\"Number of Solar Panels in Suburban: \", model.getVal(Suburban))\n    print(\"Number of Solar Panels in Industrial: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels in Commercial: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels in Residential: \", model.getVal(Residential))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1340,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. \nAt warehouse 1, the cost per truck is $500 per day.\nAt warehouse 2, the cost per truck is $600 per day.\nAt warehouse 3, the cost per truck is $700 per day.\nAt warehouse 4, the cost per truck is $800 per day.\nAt warehouse 5, the cost per truck is $900 per day.\nThe company aims to minimize the total daily operational cost of all trucks.\n// Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs, as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| 1         | $500                   |\n| 2         | $600                   |\n| 3         | $700                   |\n| 4         | $800                   |\n| 5         | $900                   |\n\nThe total number of trucks available is 100. Each warehouse must have at least 5 trucks. Please help the company to minimize the total daily operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks at warehouse 5\n\n# Define objective function\n## The company aims to minimize the total daily operational cost of all trucks.\nTotal_cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n## Objective function: Minimize Total cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_cost)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Van C\": \"VanC\", \"range\": \"VanC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle E\": \"MotorcycleE\", \"range\": \"MotorcycleE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $50,000 per year, and it can carry 20 tons. Truck B costs $40,000 per year, carrying 15 tons. Van C costs $30,000 per year, carrying 5 tons. Van D costs $25,000 per year, carrying 3 tons. Motorcycle E costs $10,000 per year, carrying 1 ton. The company wants to minimize the total operating cost while maximizing the total carrying capacity. The objective is to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost.\n// Total carrying capacity: Capacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\n// Total operating cost: Cost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n// So, the objective function is: Maximize Capacity / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle operations.\n// 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes. The cost of operating Truck A is $50,000 per year, and it can carry 20 tons. Truck B costs $40,000 per year, carrying 15 tons. Van C costs $30,000 per year, carrying 5 tons. Van D costs $25,000 per year, carrying 3 tons. Motorcycle E costs $10,000 per year, carrying 1 ton. The company wants to minimize the total operating cost while maximizing the total carrying capacity. The objective is to maximize the cost efficiency, defined as the total carrying capacity divided by the total operating cost. The company has a budget of $1,000,000 for vehicle operations. Please help the company determine the optimal number of each type of vehicle to achieve this objective.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nVanC = model.addVar(vtype=\"INTEGER\", name=\"VanC\", lb=0) # number of Van C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of Van D\nMotorcycleE = model.addVar(vtype=\"INTEGER\", name=\"MotorcycleE\", lb=0) # number of Motorcycle E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 20 * TruckA + 15 * TruckB + 5 * VanC + 3 * VanD + 1 * MotorcycleE\nCost = 50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE\n## the objective function is: Maximize Capacity / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Capacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle operations.\nmodel.addCons(50000 * TruckA + 40000 * TruckB + 30000 * VanC + 25000 * VanD + 10000 * MotorcycleE <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Van C: \", model.getVal(VanC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Motorcycle E: \", model.getVal(MotorcycleE))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500\n\n## Generate Constraint-2:\nDue to storage limitations, the number of container C cannot exceed twice the number of container A.\n// ContainerC <= 2 * ContainerA",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping each container type is given in the following Table.\n\n| Container Type | Cost per Unit |\n|----------------|---------------|\n| A              | $100          |\n| B              | $150          |\n| C              | $200          |\n| D              | $250          |\n| E              | $300          |\n\nThe company has a fixed cost of $5000 for the shipping operation. The company has a total shipping capacity of 500 containers. Due to storage limitations, the number of container C cannot exceed twice the number of container A. \n\nPlease help the company to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=0) # number of container A\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=0) # number of container B\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=0) # number of container C\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=0) # number of container D\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=0) # number of container E\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n# Due to storage limitations, the number of container C cannot exceed twice the number of container A.\nmodel.addCons(ContainerC <= 2 * ContainerA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation.\n// {\"number of trucks for cargo A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for cargo A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels.\n// FuelCostA = TrucksA * SpeedA * 2\n// FuelCostB = TrucksB * SpeedB * 3\n// FuelCostC = TrucksC * SpeedC * 4\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// 2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation. The cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels. The company has a total budget of $1000 for fuel costs per day.\nPlease help the company to determine the optimal number of trucks and their speeds to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for cargo A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for cargo B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for cargo C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # speed of trucks for cargo A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # speed of trucks for cargo B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # speed of trucks for cargo C\n\n# Define objective function\nFuelCostA = TrucksA * SpeedA * 2\nFuelCostB = TrucksB * SpeedB * 3\nFuelCostC = TrucksC * SpeedC * 4\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\nmodel.addCons(2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks for Cargo A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for Cargo B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks for Cargo C: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 718,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for production efficiency upgrades.\n// EfficiencyInvestment <= 1000000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally. The production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company has a total budget of $1,000,000 for production efficiency upgrades.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in production efficiency\n\n# Define objective function\nProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\nProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\nProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 786,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of cars\": \"Cars\", \"range\": \"Cars >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\n// Profit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\n// FuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n// So, the objective function is: Maximize (Profit - FuelCost)\n// Maximize (0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars) - (50 * Trucks + 30 * Vans + 10 * Cars) * 5)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet or exceed the required 100,000 kg.\n// 5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Cargo Capacity | Fuel Consumption per 100 km |\n|--------------|----------------|-----------------------------|\n| Trucks       | 5000 kg        | 50 liters                   |\n| Vans         | 2000 kg        | 30 liters                   |\n| Cars         | 500 kg         | 10 liters                   |\n\nThe company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost. The total cargo capacity must meet or exceed the required 100,000 kg.\n\nPlease help the company to maximize the total profit while minimizing the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of vans\nCars = model.addVar(vtype=\"INTEGER\", name=\"Cars\", lb=0) # number of cars\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\nFuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n## the objective function is: Maximize (Profit - FuelCost)\nmodel.addCons(obj == Profit - FuelCost)\n\n# Add constraints\n## The total cargo capacity must meet or exceed the required 100,000 kg.\nmodel.addCons(5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Cars: \", model.getVal(Cars))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor costs.\n// LaborA * ProductA + LaborB * ProductB + LaborC * ProductC <= 5000\n\n## Generate Constraint-3:\nThe total storage space for all products is limited to 200 cubic meters. Product A requires 1 cubic meter per unit, product B requires 2 cubic meters per unit, and product C requires 3 cubic meters per unit.\n// ProductA + 2 * ProductB + 3 * ProductC <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $10,000 for raw materials and $5,000 for labor costs. The total storage space for all products is limited to 200 cubic meters, with product A requiring 1 cubic meter per unit, product B requiring 2 cubic meters per unit, and product C requiring 3 cubic meters per unit. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000) # Budget for raw materials\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 5000) # Budget for labor costs\nmodel.addCons(ProductA + 2 * ProductB + 3 * ProductC <= 200) # Storage space constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product A\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product B\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product C\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkersA * 100\n// Profit_B = UnitsB * 70 - WorkersB * 120\n// Profit_C = UnitsC * 60 - WorkersC * 110\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C.\n// UnitsA <= 100\n// UnitsB <= 150\n// UnitsC <= 120\n\n## Generate Constraint-3:\nThe efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\n// UnitsA <= 2 * WorkersA\n// UnitsB <= 3 * WorkersB\n// UnitsC <= 2.5 * WorkersC\n\n## Generate Constraint-4:\nThe company has a budget of $5000 for labor costs per day.\n// WorkersA * 100 + WorkersB * 120 + WorkersC * 110 <= 5000\n\n## Generate Constraint-5:\nTo ensure product quality, the company must produce at least 20 units of each product per day.\n// UnitsA >= 20\n// UnitsB >= 20\n// UnitsC >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company has a total of 50 workers available and a budget of $5000 for labor costs per day. The production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C. Each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day. To ensure product quality, the company must produce at least 20 units of each product per day.\n\nPlease help the company to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=20)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=20)  # number of units of product C\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for product A\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for product B\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkersA * 100\nProfit_B = UnitsB * 70 - WorkersB * 120\nProfit_C = UnitsC * 60 - WorkersC * 110\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n# The production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C.\nmodel.addCons(UnitsA <= 100)\nmodel.addCons(UnitsB <= 150)\nmodel.addCons(UnitsC <= 120)\n# The efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\nmodel.addCons(UnitsA <= 2 * WorkersA)\nmodel.addCons(UnitsB <= 3 * WorkersB)\nmodel.addCons(UnitsC <= 2.5 * WorkersC)\n# The company has a budget of $5000 for labor costs per day.\nmodel.addCons(WorkersA * 100 + WorkersB * 120 + WorkersC * 110 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Workers for Product A: \", model.getVal(WorkersA))\n    print(\"Number of Workers for Product B: \", model.getVal(WorkersB))\n    print(\"Number of Workers for Product C: \", model.getVal(WorkersC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The variables include the number of units produced for each device.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceAUnits\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceBUnits\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceCUnits\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units across all devices.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// DeviceAUnits >= 2 * DeviceBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $40,000 for raw materials and labor costs. The cost of raw materials and labor per unit for DeviceA is $10, for DeviceB is $15, and for DeviceC is $12.\n// 10 * DeviceAUnits + 15 * DeviceBUnits + 12 * DeviceCUnits <= 40,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each device is produced to maintain market presence.\n// DeviceAUnits >= 1; DeviceBUnits >= 1; DeviceCUnits >= 1\n\n## Generate Constraint-5:\nDue to environmental regulations, the company should not produce more than 300 units of DeviceA per month.\n// DeviceAUnits <= 300",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The variables include the number of units produced for each device. The profit per unit, production cost per unit, and the cost of raw materials and labor per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Cost of Raw Materials and Labor per Unit |\n|--------|-----------------|--------------------------|-----------------------------------------|\n| DeviceA | $50            | $30                      | $10                                     |\n| DeviceB | $70            | $40                      | $15                                     |\n| DeviceC | $60            | $35                      | $12                                     |\n\nThe company has a monthly production capacity of 1000 units across all devices. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. The company has a budget of $40,000 for raw materials and labor costs. The company wants to ensure that at least one unit of each device is produced to maintain market presence. Due to environmental regulations, the company should not produce more than 300 units of DeviceA per month.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=1, ub=300) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=1) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=1) # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceAUnits\nProfit_DeviceB = (70 - 40) * DeviceBUnits\nProfit_DeviceC = (60 - 35) * DeviceCUnits\n# The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a monthly production capacity of 1000 units across all devices.\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000)\n# Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\nmodel.addCons(DeviceAUnits >= 2 * DeviceBUnits)\n# The company has a budget of $40,000 for raw materials and labor costs.\nmodel.addCons(10 * DeviceAUnits + 15 * DeviceBUnits + 12 * DeviceCUnits <= 40000)\n# The company wants to ensure that at least one unit of each device is produced to maintain market presence.\nmodel.addCons(DeviceAUnits >= 1)\nmodel.addCons(DeviceBUnits >= 1)\nmodel.addCons(DeviceCUnits >= 1)\n# Due to environmental regulations, the company should not produce more than 300 units of DeviceA per month.\nmodel.addCons(DeviceAUnits <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1522,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, D5) to optimize energy production and minimize environmental impact.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, the efficiency is 80%, in D2 it's 75%, in D3 it's 70%, in D4 it's 85%, and in D5 it's 90%. The cost of installation per panel also varies: $1000 in D1, $1200 in D2, $1100 in D3, $900 in D4, and $1300 in D5. The city aims to maximize the energy production efficiency per dollar spent.\n// Energy_D1 = 0.8 * D1\n// Energy_D2 = 0.75 * D2\n// Energy_D3 = 0.7 * D3\n// Energy_D4 = 0.85 * D4\n// Energy_D5 = 0.9 * D5\n// Total_Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n// So, the objective function is: Maximize (Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5) / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, D5) to optimize energy production and minimize environmental impact. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, the efficiency is 80%, in D2 it's 75%, in D3 it's 70%, in D4 it's 85%, and in D5 it's 90%. The cost of installation per panel also varies: $1000 in D1, $1200 in D2, $1100 in D3, $900 in D4, and $1300 in D5. The city has a budget of $100,000 for the installation of solar panels.\n\nPlease help the city to maximize the energy production efficiency per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\nEnergy_D1 = 0.8 * D1\nEnergy_D2 = 0.75 * D2\nEnergy_D3 = 0.7 * D3\nEnergy_D4 = 0.85 * D4\nEnergy_D5 = 0.9 * D5\nTotal_Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5) / Total_Cost\n# convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 643,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company also needs to decide on the maintenance budget for each vehicle type to optimize their performance and longevity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Trucks\": \"MaintenanceT\", \"range\": \"MaintenanceT >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Vans\": \"MaintenanceV\", \"range\": \"MaintenanceV >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Bikes\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of Trucks is $100 per day, and with additional maintenance, the cost decreases by $1 for every $100 spent on maintenance.\nThe operational cost of Vans is $70 per day, and with additional maintenance, the cost decreases by $0.7 for every $100 spent on maintenance.\nThe operational cost of Bikes is $30 per day, and with additional maintenance, the cost decreases by $0.3 for every $100 spent on maintenance.\nThe company aims to minimize the total daily operational cost of all vehicles.\n// Total daily cost for Trucks: CostT = 100 - 0.01 * MaintenanceT\n// Total daily cost for Vans: CostV = 70 - 0.007 * MaintenanceV\n// Total daily cost for Bikes: CostB = 30 - 0.003 * MaintenanceB\n// So, the objective function is: Minimize (CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle purchases and maintenance.\n// 100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter and operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The operational cost of Trucks is $100 per day, which decreases by $1 for every $100 spent on maintenance. The operational cost of Vans is $70 per day, decreasing by $0.7 for every $100 spent on maintenance. The operational cost of Bikes is $30 per day, decreasing by $0.3 for every $100 spent on maintenance. The company aims to minimize the total daily operational cost of all vehicles. The company has a total budget of $100,000 for vehicle purchases and maintenance.\n\nPlease help the company determine the optimal number of each vehicle type and their respective maintenance budgets to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\nMaintenanceT = model.addVar(name=\"MaintenanceT\", lb=0) # maintenance budget for Trucks\nMaintenanceV = model.addVar(name=\"MaintenanceV\", lb=0) # maintenance budget for Vans\nMaintenanceB = model.addVar(name=\"MaintenanceB\", lb=0) # maintenance budget for Bikes\n\n# Define objective function\nCostT = 100 - 0.01 * MaintenanceT\nCostV = 70 - 0.007 * MaintenanceV\nCostB = 30 - 0.003 * MaintenanceB\n# So, the objective function is: Minimize (CostT * Trucks + CostV * Vans + CostB * Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n# Add constraints\n# The company has a total budget of $100,000 for vehicle purchases and maintenance.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maintenance Budget for Trucks: \", model.getVal(MaintenanceT))\n    print(\"Maintenance Budget for Vans: \", model.getVal(MaintenanceV))\n    print(\"Maintenance Budget for Bikes: \", model.getVal(MaintenanceB))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large. The company needs to decide the number of each type of vehicle to purchase and the number of drivers to assign to each vehicle type. The cost of operation and maintenance varies by vehicle type, and the revenue generated per trip also differs.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small vehicle\": \"DriversPerSmallVehicle\", \"range\": \"DriversPerSmallVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium vehicle\": \"DriversPerMediumVehicle\", \"range\": \"DriversPerMediumVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large vehicle\": \"DriversPerLargeVehicle\", \"range\": \"DriversPerLargeVehicle >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a small vehicle is $100 per day, a medium vehicle is $200 per day, and a large vehicle is $300 per day. The revenue generated by a small vehicle is $200 per day, a medium vehicle is $400 per day, and a large vehicle is $600 per day. The company wants to maximize the net daily profit from all vehicles.\n// Profit_Small = 200 * SmallVehicles * DriversPerSmallVehicle - 100 * SmallVehicles * DriversPerSmallVehicle\n// Profit_Medium = 400 * MediumVehicles * DriversPerMediumVehicle - 200 * MediumVehicles * DriversPerMediumVehicle\n// Profit_Large = 600 * LargeVehicles * DriversPerLargeVehicle - 300 * LargeVehicles * DriversPerLargeVehicle\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing new vehicles.\n// 1000 * SmallVehicles + 2000 * MediumVehicles + 3000 * LargeVehicles <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallVehicles * DriversPerSmallVehicle + MediumVehicles * DriversPerMediumVehicle + LargeVehicles * DriversPerLargeVehicle <= 50",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large. The company needs to decide the number of each type of vehicle to purchase and the number of drivers to assign to each vehicle type. The cost of operation and maintenance varies by vehicle type, and the revenue generated per trip also differs. The company wants to maximize the net daily profit from all vehicles.\n\n| Vehicle Type | Operating Cost per Day | Revenue per Day | Purchase Cost |\n|--------------|------------------------|-----------------|---------------|\n| Small        | $100                   | $200            | $1000         |\n| Medium       | $200                   | $400            | $2000         |\n| Large        | $300                   | $600            | $3000         |\n\nThe company has a total budget of $10,000 for purchasing new vehicles. The company has a total of 50 drivers available. Please help the company determine the optimal number of each type of vehicle to purchase and the number of drivers to assign to each vehicle type to maximize the net daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)\nDriversPerSmallVehicle = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallVehicle\", lb=0)\nDriversPerMediumVehicle = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumVehicle\", lb=0)\nDriversPerLargeVehicle = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeVehicle\", lb=0)\n\n# Define objective function\nProfit_Small = 200 * SmallVehicles * DriversPerSmallVehicle - 100 * SmallVehicles * DriversPerSmallVehicle\nProfit_Medium = 400 * MediumVehicles * DriversPerMediumVehicle - 200 * MediumVehicles * DriversPerMediumVehicle\nProfit_Large = 600 * LargeVehicles * DriversPerLargeVehicle - 300 * LargeVehicles * DriversPerLargeVehicle\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\nmodel.addCons(1000 * SmallVehicles + 2000 * MediumVehicles + 3000 * LargeVehicles <= 10000)\nmodel.addCons(SmallVehicles * DriversPerSmallVehicle + MediumVehicles * DriversPerMediumVehicle + LargeVehicles * DriversPerLargeVehicle <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Drivers per Small Vehicle: \", model.getVal(DriversPerSmallVehicle))\n    print(\"Drivers per Medium Vehicle: \", model.getVal(DriversPerMediumVehicle))\n    print(\"Drivers per Large Vehicle: \", model.getVal(DriversPerLargeVehicle))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine how many of each type of truck to purchase.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue potentials. TruckA has an annual operational cost of $50,000 and generates $80,000 in revenue. TruckB has an annual operational cost of $60,000 and generates $90,000 in revenue. TruckC has an annual operational cost of $70,000 and generates $100,000 in revenue. TruckD has an annual operational cost of $80,000 and generates $110,000 in revenue. TruckE has an annual operational cost of $90,000 and generates $120,000 in revenue. The company wants to maximize the total net profit from all trucks.\n// Total net profit for TruckA: Profit_TruckA = (80,000 - 50,000) * TruckANum\n// Total net profit for TruckB: Profit_TruckB = (90,000 - 60,000) * TruckBNum\n// Total net profit for TruckC: Profit_TruckC = (100,000 - 70,000) * TruckCNum\n// Total net profit for TruckD: Profit_TruckD = (110,000 - 80,000) * TruckDNum\n// Total net profit for TruckE: Profit_TruckE = (120,000 - 90,000) * TruckENum\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks.\n// 100,000 * TruckANum + 120,000 * TruckBNum + 150,000 * TruckCNum + 180,000 * TruckDNum + 200,000 * TruckENum <= 2,000,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of trucks cannot exceed 20.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 20\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 30% of the fleet is composed of environmentally friendly trucks (TruckC and TruckE).\n// TruckCNum + TruckENum >= 0.3 * (TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum)\n\n## Generate Constraint-4:\nTo maintain a balanced fleet, the number of TruckA must be at least 10% of the total number of TruckB and TruckC combined.\n// TruckANum >= 0.1 * (TruckBNum + TruckCNum)",
        "question": "A logistics company is planning its fleet for the next year, considering five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine how many of each type of truck to purchase. Each type of truck has different operational costs and revenue potentials. TruckA has an annual operational cost of $50,000 and generates $80,000 in revenue. TruckB has an annual operational cost of $60,000 and generates $90,000 in revenue. TruckC has an annual operational cost of $70,000 and generates $100,000 in revenue. TruckD has an annual operational cost of $80,000 and generates $110,000 in revenue. TruckE has an annual operational cost of $90,000 and generates $120,000 in revenue. The company wants to maximize the total net profit from all trucks. The company has a budget of $2,000,000 for purchasing new trucks. Due to maintenance constraints, the total number of trucks cannot exceed 20. The company has a policy to ensure that at least 30% of the fleet is composed of environmentally friendly trucks (TruckC and TruckE). To maintain a balanced fleet, the number of TruckA must be at least 10% of the total number of TruckB and TruckC combined. Please help the company to determine the optimal number of each type of truck to purchase to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\nProfit_TruckA = (80000 - 50000) * TruckANum\nProfit_TruckB = (90000 - 60000) * TruckBNum\nProfit_TruckC = (100000 - 70000) * TruckCNum\nProfit_TruckD = (110000 - 80000) * TruckDNum\nProfit_TruckE = (120000 - 90000) * TruckENum\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n# The company has a budget of $2,000,000 for purchasing new trucks.\nmodel.addCons(100000 * TruckANum + 120000 * TruckBNum + 150000 * TruckCNum + 180000 * TruckDNum + 200000 * TruckENum <= 2000000)\n# Due to maintenance constraints, the total number of trucks cannot exceed 20.\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 20)\n# The company has a policy to ensure that at least 30% of the fleet is composed of environmentally friendly trucks (TruckC and TruckE).\nmodel.addCons(TruckCNum + TruckENum >= 0.3 * (TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum))\n# To maintain a balanced fleet, the number of TruckA must be at least 10% of the total number of TruckB and TruckC combined.\nmodel.addCons(TruckANum >= 0.1 * (TruckBNum + TruckCNum))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteX\": \"UpgradeX\", \"range\": \"UpgradeX >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteY\": \"UpgradeY\", \"range\": \"UpgradeY >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteZ\": \"UpgradeZ\", \"range\": \"UpgradeZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route decreases nonlinearly with the investment in fuel efficiency upgrades. The cost reduction is modeled as a quadratic function where the cost per kilometer decreases by a factor proportional to the square of the upgrade investment.\nThe initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ.\nThe company aims to minimize the total operational cost across all routes.\n// Operational cost for RouteX: CostX = 10 * TrucksX - 0.01 * UpgradeX^2 * TrucksX\n// Operational cost for RouteY: CostY = 12 * TrucksY - 0.015 * UpgradeY^2 * TrucksY\n// Operational cost for RouteZ: CostZ = 15 * TrucksZ - 0.02 * UpgradeZ^2 * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\n// TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all routes must not exceed 500.\n// TrucksX + TrucksY + TrucksZ <= 500",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency. The operational cost of each route decreases nonlinearly with the investment in fuel efficiency upgrades. The cost reduction is modeled as a quadratic function where the cost per kilometer decreases by a factor proportional to the square of the upgrade investment. The initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ. The company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks across all routes must not exceed 500. The company aims to minimize the total operational cost across all routes. Please help the company determine the optimal number of trucks and fuel efficiency upgrades for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for RouteZ\nUpgradeX = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeX\", lb=0) # fuel efficiency upgrade for RouteX\nUpgradeY = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeY\", lb=0) # fuel efficiency upgrade for RouteY\nUpgradeZ = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeZ\", lb=0) # fuel efficiency upgrade for RouteZ\n\n# Define objective function\nCostX = 10 * TrucksX - 0.01 * UpgradeX**2 * TrucksX\nCostY = 12 * TrucksY - 0.015 * UpgradeY**2 * TrucksY\nCostZ = 15 * TrucksZ - 0.02 * UpgradeZ**2 * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000)\n# The total number of trucks across all routes must not exceed 500.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Efficiency Upgrade for RouteX: \", model.getVal(UpgradeX))\n    print(\"Fuel Efficiency Upgrade for RouteY: \", model.getVal(UpgradeY))\n    print(\"Fuel Efficiency Upgrade for RouteZ: \", model.getVal(UpgradeZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company has a maximum operational capacity of 100 trips in total.\n// V1 + V2 + V3 <= 100\n\n## Generate Constraint-4:\nThe market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\n// V1 <= 30",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations. The cost per trip, fuel consumption per trip, and revenue per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Fuel Consumption per Trip | Revenue per Trip |\n|---------|---------------|---------------------------|------------------|\n| V1      | $100          | 5 liters                  | $150             |\n| V2      | $120          | 6 liters                  | $180             |\n| V3      | $140          | 7 liters                  | $210             |\n\nThe company has a limited fuel budget of 500 liters. The company has a budget of $10,000 for operational costs. The company has a maximum operational capacity of 100 trips in total. The market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\nPlease help the company to maximize the profit efficiency (profit per liter of fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n## The company has a maximum operational capacity of 100 trips in total.\nmodel.addCons(V1 + V2 + V3 <= 100)\n## The market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\nmodel.addCons(V1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 trips: \", model.getVal(V1))\n    print(\"Number of V2 trips: \", model.getVal(V2))\n    print(\"Number of V3 trips: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology to reduce labor costs. The labor cost per hour decreases by $5 for every $100,000 invested in automation. The company also needs to determine the marketing budget for each product to increase sales.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per hour for ProductA is $30, for ProductB is $40, and for ProductC is $50. The sales revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales revenue by $10 per unit for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.01 * MarketingA - (30 - 0.00005 * Automation) * LaborA) * QuantityA\n// Total profit for ProductB: ProfitB = (150 + 0.01 * MarketingB - (40 - 0.00005 * Automation) * LaborB) * QuantityB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * MarketingC - (50 - 0.00005 * Automation) * LaborC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total labor hours available for the month are 10,000 hours.\n// LaborA + LaborB + LaborC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $500,000.\n// Automation <= 500000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology to reduce labor costs. The labor cost per hour decreases by $5 for every $100,000 invested in automation. The company also needs to determine the marketing budget for each product to increase sales. The labor cost per hour for ProductA is $30, for ProductB is $40, and for ProductC is $50. The sales revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales revenue by $10 per unit for every $1,000 spent. The company aims to maximize the total profit from all products. The total labor hours available for the month are 10,000 hours. The total investment in automation cannot exceed $500,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nLaborA = model.addVar(vtype=\"INTEGER\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"INTEGER\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"INTEGER\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (100 + 0.01 * MarketingA - (30 - 0.00005 * Automation) * LaborA) * QuantityA\nProfitB = (150 + 0.01 * MarketingB - (40 - 0.00005 * Automation) * LaborB) * QuantityB\nProfitC = (200 + 0.01 * MarketingC - (50 - 0.00005 * Automation) * LaborC) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 10000)\nmodel.addCons(Automation <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: Electronics, Clothing, and Food. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Clothing\": \"ClothingTrips\", \"range\": \"ClothingTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Food\": \"FoodTrips\", \"range\": \"FoodTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Electronics, the revenue per trip is $500, and the fuel cost per trip is $100.\nFor Clothing, the revenue per trip is $300, and the fuel cost per trip is $70.\nFor Food, the revenue per trip is $200, and the fuel cost per trip is $50.\nThe company wants to maximize the total net profit per day.\n// NetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (500 - 100)\n// NetProfit_Clothing = ClothingTrucks * ClothingTrips * (300 - 70)\n// NetProfit_Food = FoodTrucks * FoodTrips * (200 - 50)\n// So, the objective function is: Maximize (NetProfit_Electronics + NetProfit_Clothing + NetProfit_Food)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 20\n\n## Generate Constraint-2:\nDue to safety regulations, each truck can make a maximum of 5 trips per day.\n// ElectronicsTrips <= 5; ClothingTrips <= 5; FoodTrips <= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: Electronics, Clothing, and Food. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day. The revenue per trip and the fuel cost per trip for each type of goods are given in the following Table.\n\n| Type of Goods | Revenue per Trip | Fuel Cost per Trip |\n|---------------|------------------|--------------------|\n| Electronics   | $500             | $100               |\n| Clothing      | $300             | $70                |\n| Food          | $200             | $50                |\n\nThe company has a total of 20 trucks available. Due to safety regulations, each truck can make a maximum of 5 trips per day. The company wants to maximize the total net profit per day. Please help the company determine the optimal allocation of trucks and trips to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nClothingTrips = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrips\", lb=0)\nFoodTrips = model.addVar(vtype=\"INTEGER\", name=\"FoodTrips\", lb=0)\n\n# Define objective function\nNetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (500 - 100)\nNetProfit_Clothing = ClothingTrucks * ClothingTrips * (300 - 70)\nNetProfit_Food = FoodTrucks * FoodTrips * (200 - 50)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Electronics + NetProfit_Clothing + NetProfit_Food)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 20)\nmodel.addCons(ElectronicsTrips <= 5)\nmodel.addCons(ClothingTrips <= 5)\nmodel.addCons(FoodTrips <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Clothing: \", model.getVal(ClothingTrips))\n    print(\"Number of Trips per Truck for Food: \", model.getVal(FoodTrips))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"investment per Small wind farm\": \"InvestmentSmall\", \"range\": \"InvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment per Medium wind farm\": \"InvestmentMedium\", \"range\": \"InvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment per Large wind farm\": \"InvestmentLarge\", \"range\": \"InvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n// EnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\n// EnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\n// EnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\n// OperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for investment in all wind farms.\n// InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10,000,000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm. The energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms. The company has a total budget of $10 million for investment in all wind farms. Please help the company to determine the optimal number and investment levels for each type of wind farm.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSmall\", lb=0)\nInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentMedium\", lb=0)\nInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentLarge\", lb=0)\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\nEnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\nEnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\nOperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\nNetEnergyOutput = EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetEnergyOutput)\n\n# Add constraints\nmodel.addCons(InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Investment per Small Wind Farm: \", model.getVal(InvestmentSmall))\n    print(\"Investment per Medium Wind Farm: \", model.getVal(InvestmentMedium))\n    print(\"Investment per Large Wind Farm: \", model.getVal(InvestmentLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n// Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n// Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of all machines combined is 1000 units per day.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine. The profit per unit and the cost of machine maintenance per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Maintenance Cost per Unit |\n|-----------|-----------------|---------------------------|\n| A         | $50             | $10                       |\n| B         | $70             | $15                       |\n| C         | $60             | $20                       |\n| D         | $80             | $25                       |\n| E         | $90             | $30                       |\n\nThe total production capacity of all machines combined is 1000 units per day. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost. Please help the company determine the optimal number of units of each component to produce daily to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n## Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity of all machines combined is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to deploy for the next month to maximize efficiency while meeting operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry a load of 10 tons and consumes 5 liters of fuel per 100 km. Each TruckB can carry a load of 15 tons and consumes 7 liters of fuel per 100 km. Each TruckC can carry a load of 20 tons and consumes 9 liters of fuel per 100 km. Each TruckD can carry a load of 25 tons and consumes 11 liters of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The objective is to maximize the ratio of total carrying capacity to total fuel consumption.\n// Total carrying capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD\n// Total fuel consumption: Fuel = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n// So, the objective function is: Maximize (Capacity / Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel costs for the next month.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50,000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet consists of TruckD due to contractual obligations.\n// TruckD >= 0.2 * (TruckA + TruckB + TruckC + TruckD)\n\n## Generate Constraint-4:\nThe company wants to ensure that the total carrying capacity of TruckC does not exceed the combined carrying capacity of TruckA and TruckB.\n// 20 * TruckC <= (10 * TruckA + 15 * TruckB)",
        "question": "A logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to deploy for the next month to maximize efficiency while meeting operational constraints. Each TruckA can carry a load of 10 tons and consumes 5 liters of fuel per 100 km. Each TruckB can carry a load of 15 tons and consumes 7 liters of fuel per 100 km. Each TruckC can carry a load of 20 tons and consumes 9 liters of fuel per 100 km. Each TruckD can carry a load of 25 tons and consumes 11 liters of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The objective is to maximize the ratio of total carrying capacity to total fuel consumption. The company has a budget of $50,000 for fuel costs for the next month. The total number of trucks cannot exceed 100. The company must ensure that at least 20% of the fleet consists of TruckD due to contractual obligations. The company wants to ensure that the total carrying capacity of TruckC does not exceed the combined carrying capacity of TruckA and TruckB. Please help the company to determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of TruckD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD\nFuel = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n## the objective function is: Maximize (Capacity / Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Capacity)\n\n# Add constraints\n## The company has a budget of $50,000 for fuel costs for the next month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n## The company must ensure that at least 20% of the fleet consists of TruckD due to contractual obligations.\nmodel.addCons(TruckD >= 0.2 * (TruckA + TruckB + TruckC + TruckD))\n## The company wants to ensure that the total carrying capacity of TruckC does not exceed the combined carrying capacity of TruckA and TruckB.\nmodel.addCons(20 * TruckC <= 10 * TruckA + 15 * TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day.\nThe medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day.\nThe large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 200 * Small + 300 * Medium + 400 * Large\n// Total fuel cost: FuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n// So, the objective function is: Minimize (VehicleCost + FuelCost)\n\n## Generate Constraint-1:\nThe total capacity of vehicles must meet or exceed the required delivery of 1000 units.\n// 50 * Small + 100 * Medium + 150 * Large >= 1000",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency. The small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day. The medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day. The large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day. The company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel. The total capacity of vehicles must meet or exceed the required delivery of 1000 units. Please help the company determine the optimal number of each type of vehicle to minimize the total cost of vehicles and fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nVehicleCost = 200 * Small + 300 * Medium + 400 * Large\nFuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n## the objective function is: Minimize (VehicleCost + FuelCost)\nmodel.addCons(obj == VehicleCost + FuelCost)\n\n# Add constraints\n## The total capacity of vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(50 * Small + 100 * Medium + 150 * Large >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the investment in fuel-efficient technologies for each type of truck, which can improve fuel efficiency and reduce operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small trucks\": \"SmallTech\", \"range\": \"SmallTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large trucks\": \"LargeTech\", \"range\": \"LargeTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Extra-Large trucks\": \"ExtraLargeTech\", \"range\": \"ExtraLargeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves by a certain percentage for every $1,000 invested in fuel-efficient technology. The improvement rates are 5% for Small trucks, 4% for Medium trucks, 3% for Large trucks, and 2% for Extra-Large trucks. The operational cost of each truck is inversely proportional to its fuel efficiency. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (1 / (0.1 + 0.005 * SmallTech)) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (1 / (0.15 + 0.004 * MediumTech)) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (1 / (0.2 + 0.003 * LargeTech)) * LargeTrucks\n// Operational cost for Extra-Large trucks: CostExtraLarge = (1 / (0.25 + 0.002 * ExtraLargeTech)) * ExtraLargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge + CostExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks and investing in fuel-efficient technologies. The purchase costs are $50,000 for Small trucks, $70,000 for Medium trucks, $90,000 for Large trucks, and $110,000 for Extra-Large trucks.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + SmallTech + MediumTech + LargeTech + ExtraLargeTech <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100\n\n## Generate Constraint-3:\nThe company must purchase at least 10 Small trucks and 15 Medium trucks to meet specific contract requirements.\n// SmallTrucks >= 10; MediumTrucks >= 15",
        "question": "A logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the investment in fuel-efficient technologies for each type of truck, which can improve fuel efficiency and reduce operational costs. The fuel efficiency of each truck type improves by a certain percentage for every $1,000 invested in fuel-efficient technology. The improvement rates are 5% for Small trucks, 4% for Medium trucks, 3% for Large trucks, and 2% for Extra-Large trucks. The operational cost of each truck is inversely proportional to its fuel efficiency. The company aims to minimize the total operational cost of the fleet.\n\n| Truck Type       | Purchase Cost | Fuel Efficiency Improvement Rate per $1,000 |\n|------------------|---------------|-------------------------------------------|\n| Small            | $50,000       | 5%                                        |\n| Medium           | $70,000       | 4%                                        |\n| Large            | $90,000       | 3%                                        |\n| Extra-Large      | $110,000      | 2%                                        |\n\nThe company has a budget of $500,000 for purchasing new trucks and investing in fuel-efficient technologies. The total number of trucks in the fleet must not exceed 100. The company must purchase at least 10 Small trucks and 15 Medium trucks to meet specific contract requirements.\n\nPlease help the company to determine the optimal number of each type of truck to purchase and the investment in fuel-efficient technologies to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nSmallTech = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallTech\", lb=0)\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)\nLargeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeTech\", lb=0)\nExtraLargeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"ExtraLargeTech\", lb=0)\n\n# Define objective function\nCostSmall = (1 / (0.1 + 0.005 * SmallTech)) * SmallTrucks\nCostMedium = (1 / (0.15 + 0.004 * MediumTech)) * MediumTrucks\nCostLarge = (1 / (0.2 + 0.003 * LargeTech)) * LargeTrucks\nCostExtraLarge = (1 / (0.25 + 0.002 * ExtraLargeTech)) * ExtraLargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge + CostExtraLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + SmallTech + MediumTech + LargeTech + ExtraLargeTech <= 500000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100)\nmodel.addCons(SmallTrucks >= 10)\nmodel.addCons(MediumTrucks >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Small Tech: \", model.getVal(SmallTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Large Tech: \", model.getVal(LargeTech))\n    print(\"Investment in Extra-Large Tech: \", model.getVal(ExtraLargeTech))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1790,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductA\": \"QualityControlA\", \"range\": \"QualityControlA >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductB\": \"QualityControlB\", \"range\": \"QualityControlB >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductC\": \"QualityControlC\", \"range\": \"QualityControlC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n// Total revenue for ProductA: RevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\n// Total cost for ProductA: CostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\n// Total cost for ProductB: CostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\n// Total cost for ProductC: CostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total budget for marketing and quality control cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 1000 units of each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000\n\n## Generate Constraint-3:\nThe company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB.\n// MarketingBudgetA >= 10000; MarketingBudgetB >= 15000\n\n## Generate Constraint-4:\nThe total quality control investment for all products must be at least $20,000.\n// QualityControlA + QualityControlB + QualityControlC >= 20000\n\n## Generate Constraint-5:\nThe company aims to ensure that the production of ProductC is at least half of the combined production of ProductA and ProductB.\n// QuantityC >= 0.5 * (QuantityA + QuantityB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n\nThe total budget for marketing and quality control cannot exceed $100,000. The company can produce a maximum of 1000 units of each product. The company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB. The total quality control investment for all products must be at least $20,000. The company aims to ensure that the production of ProductC is at least half of the combined production of ProductA and ProductB.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nQualityControlA = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlA\", lb=0)  # quality control investment for ProductA\nQualityControlB = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlB\", lb=0)  # quality control investment for ProductB\nQualityControlC = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlC\", lb=0)  # quality control investment for ProductC\n\n# Define objective function\nRevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\nRevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\nRevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\nCostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\nCostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\nCostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\nmodel.addCons(MarketingBudgetA >= 10000)\nmodel.addCons(MarketingBudgetB >= 15000)\nmodel.addCons(QualityControlA + QualityControlB + QualityControlC >= 20000)\nmodel.addCons(QuantityC >= 0.5 * (QuantityA + QuantityB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Quality Control Investment for ProductA: \", model.getVal(QualityControlA))\n    print(\"Quality Control Investment for ProductB: \", model.getVal(QualityControlB))\n    print(\"Quality Control Investment for ProductC: \", model.getVal(QualityControlC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each product for the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company wants to spend at most 400 hours on production for the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 1 hour          |\n| B       | 30$           | 15$           | 2 hours         |\n| C       | 40$           | 20$           | 3 hours         |\n| D       | 50$           | 25$           | 4 hours         |\n| E       | 60$           | 30$           | 5 hours         |\n\nThe company has $1500 available for material costs for the next quarter. The company wants to produce at least 20 units of each product for the next quarter. The company wants to spend at most 400 hours on production for the next quarter. \nPlease help the company to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n## The company wants to spend at most 400 hours on production for the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (A, B, C, D, E) across three warehouses (Warehouse1, Warehouse2, Warehouse3). Each package type has a different size and weight, affecting the cost and efficiency of storage and transportation.\n// {\"number of packages of type A in Warehouse1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type A in Warehouse2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type A in Warehouse3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type B in Warehouse3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type C in Warehouse3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type D in Warehouse3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of packages of type E in Warehouse3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of storing and transporting each package type varies with the warehouse. The cost for type A is $5 in Warehouse1, $6 in Warehouse2, and $7 in Warehouse3. For type B, the costs are $7, $8, and $9, respectively. For type C, the costs are $9, $10, and $11. For type D, the costs are $11, $12, and $13. For type E, the costs are $13, $14, and $15. The company aims to minimize the total cost of storage and transportation across all warehouses.\n// Total cost = 5 * A1 + 6 * A2 + 7 * A3 + 7 * B1 + 8 * B2 + 9 * B3 + 9 * C1 + 10 * C2 + 11 * C3 + 11 * D1 + 12 * D2 + 13 * D3 + 13 * E1 + 14 * E2 + 15 * E3\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of type A packages distributed across all warehouses must be 100.\n// A1 + A2 + A3 = 100\n\n## Generate Constraint-2:\nThe total number of type B packages distributed across all warehouses must be 150.\n// B1 + B2 + B3 = 150",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (A, B, C, D, E) across three warehouses (Warehouse1, Warehouse2, Warehouse3). Each package type has a different size and weight, affecting the cost and efficiency of storage and transportation. The cost of storing and transporting each package type varies with the warehouse as shown in the following Table.\n\n| Package Type | Warehouse1 Cost | Warehouse2 Cost | Warehouse3 Cost |\n|--------------|-----------------|-----------------|-----------------|\n| A            | 5$              | 6$              | 7$              |\n| B            | 7$              | 8$              | 9$              |\n| C            | 9$              | 10$             | 11$             |\n| D            | 11$             | 12$             | 13$             |\n| E            | 13$             | 14$             | 15$             |\n\nThe company aims to minimize the total cost of storage and transportation across all warehouses. The total number of type A packages distributed across all warehouses must be 100, and the total number of type B packages distributed across all warehouses must be 150. Please help the company determine the optimal distribution of packages to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # number of packages of type A in Warehouse1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # number of packages of type A in Warehouse2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # number of packages of type A in Warehouse3\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of packages of type B in Warehouse1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of packages of type B in Warehouse2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of packages of type B in Warehouse3\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of packages of type C in Warehouse1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of packages of type C in Warehouse2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of packages of type C in Warehouse3\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of packages of type D in Warehouse1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of packages of type D in Warehouse2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of packages of type D in Warehouse3\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of packages of type E in Warehouse1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of packages of type E in Warehouse2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of packages of type E in Warehouse3\n\n# Define objective function\nTotal_cost = 5 * A1 + 6 * A2 + 7 * A3 + 7 * B1 + 8 * B2 + 9 * B3 + 9 * C1 + 10 * C2 + 11 * C3 + 11 * D1 + 12 * D2 + 13 * D3 + 13 * E1 + 14 * E2 + 15 * E3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_cost)\n\n# Add constraints\nmodel.addCons(A1 + A2 + A3 == 100) # The total number of type A packages distributed across all warehouses must be 100.\nmodel.addCons(B1 + B2 + B3 == 150) # The total number of type B packages distributed across all warehouses must be 150.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of packages of type A in Warehouse1: \", model.getVal(A1))\n    print(\"Number of packages of type A in Warehouse2: \", model.getVal(A2))\n    print(\"Number of packages of type A in Warehouse3: \", model.getVal(A3))\n    print(\"Number of packages of type B in Warehouse1: \", model.getVal(B1))\n    print(\"Number of packages of type B in Warehouse2: \", model.getVal(B2))\n    print(\"Number of packages of type B in Warehouse3: \", model.getVal(B3))\n    print(\"Number of packages of type C in Warehouse1: \", model.getVal(C1))\n    print(\"Number of packages of type C in Warehouse2: \", model.getVal(C2))\n    print(\"Number of packages of type C in Warehouse3: \", model.getVal(C3))\n    print(\"Number of packages of type D in Warehouse1: \", model.getVal(D1))\n    print(\"Number of packages of type D in Warehouse2: \", model.getVal(D2))\n    print(\"Number of packages of type D in Warehouse3: \", model.getVal(D3))\n    print(\"Number of packages of type E in Warehouse1: \", model.getVal(E1))\n    print(\"Number of packages of type E in Warehouse2: \", model.getVal(E2))\n    print(\"Number of packages of type E in Warehouse3: \", model.getVal(E3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 15,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different fuel efficiency and capacity. The company needs to decide how many trips each vehicle should make to optimize its logistics operations.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each vehicle is a nonlinear function of the number of trips due to varying fuel costs and maintenance expenses. The cost per trip for Truck1 is $100 + $5 * (Trips1)^2. The cost per trip for Truck2 is $150 + $4 * (Trips2)^2. The cost per trip for Truck3 is $200 + $3 * (Trips3)^2. The cost per trip for Truck4 is $250 + $2 * (Trips4)^2. The cost per trip for Truck5 is $300 + $1 * (Trips5)^2. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost: Cost = (100 + 5 * (Trips1)^2) * Trips1 + (150 + 4 * (Trips2)^2) * Trips2 + (200 + 3 * (Trips3)^2) * Trips3 + (250 + 2 * (Trips4)^2) * Trips4 + (300 + 1 * (Trips5)^2) * Trips5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-2:\nDue to maintenance schedules, Truck1 and Truck2 combined can make at most 200 trips.\n// Trips1 + Trips2 <= 200\n\n## Generate Constraint-3:\nThe company must ensure that at least 100 trips are made by Truck3 and Truck4 combined.\n// Trips3 + Trips4 >= 100\n\n## Generate Constraint-4:\nThe number of trips for Truck5 must be at least half the number of trips made by Truck1.\n// Trips5 >= 0.5 * Trips1",
        "question": "A logistics company is planning its routes for the next quarter and operates five different types of vehicles: Truck1, Truck2, Truck3, Truck4, and Truck5. Each vehicle has a different cost per trip due to varying fuel costs and maintenance expenses, as shown in the following Table.\n\n| Vehicle | Cost per Trip Formula |\n|---------|-----------------------|\n| Truck1  | $100 + $5 * (Trips1)^2 |\n| Truck2  | $150 + $4 * (Trips2)^2 |\n| Truck3  | $200 + $3 * (Trips3)^2 |\n| Truck4  | $250 + $2 * (Trips4)^2 |\n| Truck5  | $300 + $1 * (Trips5)^2 |\n\nThe company needs to decide how many trips each vehicle should make to minimize the total operational cost of all vehicles. The total number of trips across all vehicles must not exceed 500. Due to maintenance schedules, Truck1 and Truck2 combined can make at most 200 trips. The company must ensure that at least 100 trips are made by Truck3 and Truck4 combined. The number of trips for Truck5 must be at least half the number of trips made by Truck1.\n\nPlease help the company to determine the optimal number of trips for each vehicle to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Truck5\n\n# Define objective function\n## The cost of operating each vehicle is a nonlinear function of the number of trips\nCost1 = (100 + 5 * Trips1**2) * Trips1\nCost2 = (150 + 4 * Trips2**2) * Trips2\nCost3 = (200 + 3 * Trips3**2) * Trips3\nCost4 = (250 + 2 * Trips4**2) * Trips4\nCost5 = (300 + 1 * Trips5**2) * Trips5\n## Total operational cost\nCost = Cost1 + Cost2 + Cost3 + Cost4 + Cost5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total number of trips across all vehicles must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n## Due to maintenance schedules, Truck1 and Truck2 combined can make at most 200 trips.\nmodel.addCons(Trips1 + Trips2 <= 200)\n## The company must ensure that at least 100 trips are made by Truck3 and Truck4 combined.\nmodel.addCons(Trips3 + Trips4 >= 100)\n## The number of trips for Truck5 must be at least half the number of trips made by Truck1.\nmodel.addCons(Trips5 >= 0.5 * Trips1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Truck5: \", model.getVal(Trips5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1500, on route 2 is $1800, on route 3 is $2000, on route 4 is $1900, and on route 5 is $2100. The company aims to maximize the total net revenue (revenue minus cost) from all routes.\n// Net_Revenue_1 = (1500 - 1000) * T1\n// Net_Revenue_2 = (1800 - 1200) * T2\n// Net_Revenue_3 = (2000 - 1500) * T3\n// Net_Revenue_4 = (1900 - 1300) * T4\n// Net_Revenue_5 = (2100 - 1400) * T5\n// So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all trucks must not exceed a certain limit. Each truck on route 1 emits 5 units of emissions, on route 2 emits 6 units, on route 3 emits 7 units, on route 4 emits 5 units, and on route 5 emits 4 units. The total emissions must not exceed 500 units.\n// 5 * T1 + 6 * T2 + 7 * T3 + 5 * T4 + 4 * T5 <= 500\n\n## Generate Constraint-4:\nThe company also aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 requires at least 8 trucks, route 3 requires at least 10 trucks, route 4 requires at least 5 trucks, and route 5 requires at least 3 trucks.\n// T1 >= 5; T2 >= 8; T3 >= 10; T4 >= 5; T5 >= 3",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1500, on route 2 is $1800, on route 3 is $2000, on route 4 is $1900, and on route 5 is $2100. The company aims to maximize the total net revenue (revenue minus cost) from all routes. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks. Due to environmental regulations, the total emissions from all trucks must not exceed a certain limit. Each truck on route 1 emits 5 units of emissions, on route 2 emits 6 units, on route 3 emits 7 units, on route 4 emits 5 units, and on route 5 emits 4 units. The total emissions must not exceed 500 units. The company also aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 requires at least 8 trucks, route 3 requires at least 10 trucks, route 4 requires at least 5 trucks, and route 5 requires at least 3 trucks. Please help the company to maximize the total net revenue from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nNet_Revenue_1 = (1500 - 1000) * T1\nNet_Revenue_2 = (1800 - 1200) * T2\nNet_Revenue_3 = (2000 - 1500) * T3\nNet_Revenue_4 = (1900 - 1300) * T4\nNet_Revenue_5 = (2100 - 1400) * T5\n# So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n# Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 15)\n# Due to environmental regulations, the total emissions from all trucks must not exceed a certain limit.\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 5 * T4 + 4 * T5 <= 500)\n# The company also aims to maintain a minimum service level on each route.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 8)\nmodel.addCons(T3 >= 10)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1466,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruckA has a capacity of 20 tons and consumes 10 liters of fuel per 100 km.\nTruckB has a capacity of 30 tons and consumes 12 liters of fuel per 100 km.\nTruckC has a capacity of 40 tons and consumes 15 liters of fuel per 100 km.\nTruckD has a capacity of 50 tons and consumes 18 liters of fuel per 100 km.\nTruckE has a capacity of 60 tons and consumes 20 liters of fuel per 100 km.\nThe company wants to minimize the total fuel consumption while ensuring all delivery requirements are met.\n// Total fuel consumption for TruckA: Fuel_TruckA = 10 * TruckANum * Distance\n// Total fuel consumption for TruckB: Fuel_TruckB = 12 * TruckBNum * Distance\n// Total fuel consumption for TruckC: Fuel_TruckC = 15 * TruckCNum * Distance\n// Total fuel consumption for TruckD: Fuel_TruckD = 18 * TruckDNum * Distance\n// Total fuel consumption for TruckE: Fuel_TruckE = 20 * TruckENum * Distance\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required delivery capacity of 1000 tons.\n// 20 * TruckANum + 30 * TruckBNum + 40 * TruckCNum + 50 * TruckDNum + 60 * TruckENum >= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for purchasing new trucks.\n// Cost_TruckA * TruckANum + Cost_TruckB * TruckBNum + Cost_TruckC * TruckCNum + Cost_TruckD * TruckDNum + Cost_TruckE * TruckENum <= 50000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize efficiency while meeting delivery requirements.\nTruckA has a capacity of 20 tons and consumes 10 liters of fuel per 100 km.\nTruckB has a capacity of 30 tons and consumes 12 liters of fuel per 100 km.\nTruckC has a capacity of 40 tons and consumes 15 liters of fuel per 100 km.\nTruckD has a capacity of 50 tons and consumes 18 liters of fuel per 100 km.\nTruckE has a capacity of 60 tons and consumes 20 liters of fuel per 100 km.\nThe company wants to minimize the total fuel consumption while ensuring all delivery requirements are met. The total capacity of all trucks must meet or exceed the required delivery capacity of 1000 tons. The company has a budget constraint of $50,000 for purchasing new trucks.\nPlease help the company to minimize the total fuel consumption (which is defined as the sum of the fuel consumption for each type of truck multiplied by the distance).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance to be traveled, assumed constant for simplicity\nFuel_TruckA = 10 * TruckANum * Distance\nFuel_TruckB = 12 * TruckBNum * Distance\nFuel_TruckC = 15 * TruckCNum * Distance\nFuel_TruckD = 18 * TruckDNum * Distance\nFuel_TruckE = 20 * TruckENum * Distance\n## the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required delivery capacity of 1000 tons.\nmodel.addCons(20 * TruckANum + 30 * TruckBNum + 40 * TruckCNum + 50 * TruckDNum + 60 * TruckENum >= 1000)\n## The company has a budget constraint of $50,000 for purchasing new trucks.\n# Assuming costs for each truck type are as follows:\nCost_TruckA = 10000 # example cost\nCost_TruckB = 15000 # example cost\nCost_TruckC = 20000 # example cost\nCost_TruckD = 25000 # example cost\nCost_TruckE = 30000 # example cost\nmodel.addCons(Cost_TruckA * TruckANum + Cost_TruckB * TruckBNum + Cost_TruckC * TruckCNum + Cost_TruckD * TruckDNum + Cost_TruckE * TruckENum <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. \nTruck A has a fuel efficiency of 10 km/l and an operational cost of $50 per day.\nTruck B has a fuel efficiency of 15 km/l and an operational cost of $60 per day.\nTruck C has a fuel efficiency of 20 km/l and an operational cost of $70 per day.\nTruck D has a fuel efficiency of 25 km/l and an operational cost of $80 per day.\nTruck E has a fuel efficiency of 30 km/l and an operational cost of $90 per day.\nThe company aims to minimize the total operational cost while maintaining a certain level of fuel efficiency (defined as the total distance traveled divided by the total fuel consumed).\n// Total operational cost: Cost = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\n// Total distance traveled: Distance = 1000 * (A + B + C + D + E)\n// Total fuel consumed: Fuel = 1000 * (A / 10 + B / 15 + C / 20 + D / 25 + E / 30)\n// So, the objective function is: Minimize Cost / (Distance / Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per month for operational costs.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000\n\n## Generate Constraint-2:\nThe company must deploy at least 10 trucks of each type.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost. Each type of truck has a different fuel efficiency and operational cost. Truck A has a fuel efficiency of 10 km/l and an operational cost of $50 per day. Truck B has a fuel efficiency of 15 km/l and an operational cost of $60 per day. Truck C has a fuel efficiency of 20 km/l and an operational cost of $70 per day. Truck D has a fuel efficiency of 25 km/l and an operational cost of $80 per day. Truck E has a fuel efficiency of 30 km/l and an operational cost of $90 per day. The company has a budget of $10,000 per month for operational costs. The company must deploy at least 10 trucks of each type. The company aims to minimize the total operational cost while maintaining a certain level of fuel efficiency (defined as the total distance traveled divided by the total fuel consumed). Please help the company to determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deploy at least 10 trucks of each type.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of trucks E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\nDistance = 1000 * (A + B + C + D + E)\nFuel = 1000 * (A / 10 + B / 15 + C / 20 + D / 25 + E / 30)\n## the objective function is: Minimize Cost / (Distance / Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * (Distance / Fuel) == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per month for operational costs.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Number of Trucks D: \", model.getVal(D))\n    print(\"Number of Trucks E: \", model.getVal(E))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a Truck is $100 per day, a Van is $70 per day, and a Bike is $30 per day. The revenue generated by a Truck is $200 per day, a Van is $150 per day, and a Bike is $100 per day. The company aims to maximize the profit rate, which is defined as the total revenue divided by the total operating cost.\n// Operating cost of Trucks: Cost_T = 100 * T\n// Operating cost of Vans: Cost_V = 70 * V\n// Operating cost of Bikes: Cost_B = 30 * B\n// Revenue from Trucks: Revenue_T = 200 * T\n// Revenue from Vans: Revenue_V = 150 * V\n// Revenue from Bikes: Revenue_B = 100 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle operating costs for the month.\n// 100 * T + 70 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 vehicles available.\n// T + V + B <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Vans does not exceed twice the number of Bikes.\n// V <= 2 * B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations. The cost of operating and the revenue generated per day for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operating Cost per Day | Revenue per Day |\n|--------------|------------------------|-----------------|\n| Trucks       | $100                   | $200            |\n| Vans         | $70                    | $150            |\n| Bikes        | $30                    | $100            |\n\nThe company has a budget of $10,000 for vehicle operating costs for the month. The company has a total of 100 vehicles available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company also wants to ensure that the total number of Vans does not exceed twice the number of Bikes. \n\nPlease help the company to maximize the profit rate, which is defined as the total revenue divided by the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_T = 100 * T\nCost_V = 70 * V\nCost_B = 30 * B\nRevenue_T = 200 * T\nRevenue_V = 150 * V\nRevenue_B = 100 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_T + Cost_V + Cost_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle operating costs for the month.\nmodel.addCons(100 * T + 70 * V + 30 * B <= 10000)\n## The company has a total of 100 vehicles available.\nmodel.addCons(T + V + B <= 100)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company wants to ensure that the total number of Vans does not exceed twice the number of Bikes.\nmodel.addCons(V <= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceA_Units\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceB_Units\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceC_Units\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 400 units per month.\n// DeviceA_Units <= 400\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 200 units of DeviceB to be produced per month.\n// DeviceB_Units >= 200\n\n## Generate Constraint-4:\nThe production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\n// DeviceC_Units <= 300",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from selling all devices.\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month. Due to market saturation, the production of DeviceA should not exceed 400 units per month. The company has a contract that requires at least 200 units of DeviceB to be produced per month. The production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\nPlease help the company to determine the optimal number of units to produce for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)  # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceA_Units\nProfit_DeviceB = (70 - 40) * DeviceB_Units\nProfit_DeviceC = (60 - 35) * DeviceC_Units\n# The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)\n# Due to market saturation, the production of DeviceA should not exceed 400 units per month.\nmodel.addCons(DeviceA_Units <= 400)\n# The company has a contract that requires at least 200 units of DeviceB to be produced per month.\nmodel.addCons(DeviceB_Units >= 200)\n# The production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\nmodel.addCons(DeviceC_Units <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to ensure adequate coverage.\n// Trucks1 >= 10; Trucks2 >= 10; Trucks3 >= 10; Trucks4 >= 10; Trucks5 >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Trucks Required | Fuel Budget |\n|--------|-----------------|-------------|\n| Region1 | Trucks1 >= 10 | FuelBudget1 |\n| Region2 | Trucks2 >= 10 | FuelBudget2 |\n| Region3 | Trucks3 >= 10 | FuelBudget3 |\n| Region4 | Trucks4 >= 10 | FuelBudget4 |\n| Region5 | Trucks5 >= 10 | FuelBudget5 |\n\nThe total fuel budget across all regions must not exceed $100,000. The total number of trucks across all regions must not exceed 100.\n\nPlease help the company to determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 10 trucks to ensure adequate coverage.\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10) # trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10) # trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=10) # trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=10) # trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=10) # trucks in Region5\n\n## Define fuel budget for each region\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0) # fuel budget for Region1\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0) # fuel budget for Region2\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0) # fuel budget for Region3\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0) # fuel budget for Region4\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0) # fuel budget for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\nFuelCost1 = (FuelBudget1 / Trucks1)**2\nFuelCost2 = (FuelBudget2 / Trucks2)**2\nFuelCost3 = (FuelBudget3 / Trucks3)**2\nFuelCost4 = (FuelBudget4 / Trucks4)**2\nFuelCost5 = (FuelBudget5 / Trucks5)**2\n\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\n\n## The total number of trucks across all regions must not exceed 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD\", \"range\": \"MachineD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total profit for MachineA: Profit_A = (500 - CostA) * MachineA = (500 - (200 + 0.01 * MachineA^2)) * MachineA\n// Total profit for MachineB: Profit_B = (700 - CostB) * MachineB = (700 - (300 + 0.02 * MachineB^2)) * MachineB\n// Total profit for MachineC: Profit_C = (900 - CostC) * MachineC = (900 - (400 + 0.03 * MachineC^2)) * MachineC\n// Total profit for MachineD: Profit_D = (1100 - CostD) * MachineD = (1100 - (500 + 0.04 * MachineD^2)) * MachineD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines next month.\n// MachineA + MachineB + MachineC + MachineD <= 500",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost. The company has a total production capacity of 500 machines next month. Please help the company to determine the optimal number of each machine to produce to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0)\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0)\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0)\nMachineD = model.addVar(vtype=\"INTEGER\", name=\"MachineD\", lb=0)\n\n# Define objective function\nCostA = 200 + 0.01 * MachineA**2\nCostB = 300 + 0.02 * MachineB**2\nCostC = 400 + 0.03 * MachineC**2\nCostD = 500 + 0.04 * MachineD**2\n\nProfit_A = (500 - CostA) * MachineA\nProfit_B = (700 - CostB) * MachineB\nProfit_C = (900 - CostC) * MachineC\nProfit_D = (1100 - CostD) * MachineD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(MachineA + MachineB + MachineC + MachineD <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Number of MachineD: \", model.getVal(MachineD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of trips each vehicle should make to maximize profit while considering the varying costs and revenues associated with each vehicle type. Additionally, the company must decide on the level of maintenance investment for each vehicle type to improve fuel efficiency and reduce operational costs.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip for each vehicle type is affected by the maintenance investment, which improves fuel efficiency and reduces operational costs.\nFor TruckA, the initial profit per trip is $1000, and with maintenance, the profit increases by $10 per trip for every $100 invested in maintenance.\nFor TruckB, the initial profit per trip is $1500, and with maintenance, the profit increases by $15 per trip for every $100 invested in maintenance.\nFor TruckC, the initial profit per trip is $2000, and with maintenance, the profit increases by $20 per trip for every $100 invested in maintenance.\nThe company aims to maximize the total profit from all vehicle types.\n// Total profit for TruckA: ProfitA = (1000 + 0.1 * MaintenanceA) * TripsA\n// Total profit for TruckB: ProfitB = (1500 + 0.15 * MaintenanceB) * TripsB\n// Total profit for TruckC: ProfitC = (2000 + 0.2 * MaintenanceC) * TripsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance and operational costs.\n// MaintenanceA + MaintenanceB + MaintenanceC + (1000 * TripsA) + (1500 * TripsB) + (2000 * TripsC) <= 100000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of trips each vehicle should make (TripsA, TripsB, TripsC) and the level of maintenance investment for each vehicle type (MaintenanceA, MaintenanceB, MaintenanceC) to maximize profit while considering the varying costs and revenues associated with each vehicle type. The profit per trip for each vehicle type is affected by the maintenance investment, which improves fuel efficiency and reduces operational costs. For TruckA, the initial profit per trip is $1000, and with maintenance, the profit increases by $10 per trip for every $100 invested in maintenance. For TruckB, the initial profit per trip is $1500, and with maintenance, the profit increases by $15 per trip for every $100 invested in maintenance. For TruckC, the initial profit per trip is $2000, and with maintenance, the profit increases by $20 per trip for every $100 invested in maintenance. The company has a total budget of $100,000 for maintenance and operational costs. Please help the company to maximize the total profit from all vehicle types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)  # number of trips for TruckC\nMaintenanceA = model.addVar(name=\"MaintenanceA\", lb=0)  # maintenance investment for TruckA\nMaintenanceB = model.addVar(name=\"MaintenanceB\", lb=0)  # maintenance investment for TruckB\nMaintenanceC = model.addVar(name=\"MaintenanceC\", lb=0)  # maintenance investment for TruckC\n\n# Define objective function\nProfitA = (1000 + 0.1 * MaintenanceA) * TripsA\nProfitB = (1500 + 0.15 * MaintenanceB) * TripsB\nProfitC = (2000 + 0.2 * MaintenanceC) * TripsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC + 1000 * TripsA + 1500 * TripsB + 2000 * TripsC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Maintenance Investment for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting delivery demands and considering the initial investment cost for each truck type.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"initial cost per truck for Region 1\": \"CostPerTruck1\", \"range\": \"CostPerTruck1 >= 0\", \"type\": \"real\"}\n// {\"initial cost per truck for Region 2\": \"CostPerTruck2\", \"range\": \"CostPerTruck2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational and initial investment costs. The operational cost is the product of the number of trucks, their fuel efficiency, and the average daily distance traveled. The initial investment cost is the product of the number of trucks and the cost per truck.\n// OperationalCost1 = TrucksRegion1 * (1 / FuelEfficiency1) * DailyDistance1\n// OperationalCost2 = TrucksRegion2 * (1 / FuelEfficiency2) * DailyDistance2\n// InitialInvestmentCost = TrucksRegion1 * CostPerTruck1 + TrucksRegion2 * CostPerTruck2\n// So, the objective function is: Minimize (OperationalCost1 + OperationalCost2 + InitialInvestmentCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for initial truck investments.\n// TrucksRegion1 * CostPerTruck1 + TrucksRegion2 * CostPerTruck2 <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting delivery demands and considering the initial investment cost for each truck type. The following table provides the details of the trucks and their costs:\n\n| Parameter                     | Region 1 | Region 2 |\n|-------------------------------|----------|----------|\n| Number of Trucks              | TrucksRegion1 | TrucksRegion2 |\n| Fuel Efficiency (per gallon)  | FuelEfficiency1 | FuelEfficiency2 |\n| Initial Cost per Truck        | CostPerTruck1 | CostPerTruck2 |\n\nThe company wants to minimize the total operational and initial investment costs. The operational cost is the product of the number of trucks, their fuel efficiency, and the average daily distance traveled. The initial investment cost is the product of the number of trucks and the cost per truck. The company has a total budget of $100,000 for initial truck investments.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total operational and initial investment costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0.01)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0.01)  # fuel efficiency of trucks for Region 2\nCostPerTruck1 = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck1\", lb=0)  # initial cost per truck for Region 1\nCostPerTruck2 = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck2\", lb=0)  # initial cost per truck for Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDailyDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DailyDistance1\", lb=0)  # average daily distance traveled for Region 1\nDailyDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DailyDistance2\", lb=0)  # average daily distance traveled for Region 2\nOperationalCost1 = TrucksRegion1 * (1 / FuelEfficiency1) * DailyDistance1\nOperationalCost2 = TrucksRegion2 * (1 / FuelEfficiency2) * DailyDistance2\nInitialInvestmentCost = TrucksRegion1 * CostPerTruck1 + TrucksRegion2 * CostPerTruck2\n## the objective function is: Minimize (OperationalCost1 + OperationalCost2 + InitialInvestmentCost)\nmodel.addCons(obj == OperationalCost1 + OperationalCost2 + InitialInvestmentCost)\n\n# Add constraints\n## The company has a total budget of $100,000 for initial truck investments.\nmodel.addCons(TrucksRegion1 * CostPerTruck1 + TrucksRegion2 * CostPerTruck2 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Cost per Truck for Region 1: \", model.getVal(CostPerTruck1))\n    print(\"Cost per Truck for Region 2: \", model.getVal(CostPerTruck2))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks.\n// {\"number of trucks for Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Zone1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones.\n// Operational cost for Zone1: Cost1 = (500 - 0.1 * Upgrade1) * Trucks1\n// Operational cost for Zone2: Cost2 = (500 - 0.1 * Upgrade2) * Trucks2\n// Operational cost for Zone3: Cost3 = (500 - 0.1 * Upgrade3) * Trucks3\n// Operational cost for Zone4: Cost4 = (500 - 0.1 * Upgrade4) * Trucks4\n// Operational cost for Zone5: Cost5 = (500 - 0.1 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-3:\nDue to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\n// Trucks1 >= 20; Trucks2 >= 15\n\n## Generate Constraint-4:\nThe company aims to ensure that at least 50% of the total trucks are allocated to Zone3 and Zone4 combined.\n// Trucks3 + Trucks4 >= 0.5 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks. The operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones.\n\nThe company has a total of 100 trucks available for allocation. The total budget for fuel efficiency upgrades is $100,000. Due to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks. The company aims to ensure that at least 50% of the total trucks are allocated to Zone3 and Zone4 combined.\n\nPlease help the company to minimize the total operational cost across all zones.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Zone5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Zone1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Zone2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Zone3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Zone4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Zone5\n\n# Define objective function\nCost1 = (500 - 0.1 * Upgrade1) * Trucks1\nCost2 = (500 - 0.1 * Upgrade2) * Trucks2\nCost3 = (500 - 0.1 * Upgrade3) * Trucks3\nCost4 = (500 - 0.1 * Upgrade4) * Trucks4\nCost5 = (500 - 0.1 * Upgrade5) * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)  # total trucks constraint\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)  # budget constraint\nmodel.addCons(Trucks1 >= 20)  # minimum trucks for Zone1\nmodel.addCons(Trucks2 >= 15)  # minimum trucks for Zone2\nmodel.addCons(Trucks3 + Trucks4 >= 0.5 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5))  # allocation constraint for Zone3 and Zone4\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Zone5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Zone1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Zone2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Zone3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Zone4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Zone5: \", model.getVal(Upgrade5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route.\n// {\"number of trucks for D1\": \"TrucksD1\", \"range\": \"TrucksD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D2\": \"TrucksD2\", \"range\": \"TrucksD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D3\": \"TrucksD3\", \"range\": \"TrucksD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D4\": \"TrucksD4\", \"range\": \"TrucksD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D5\": \"TrucksD5\", \"range\": \"TrucksD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for D1\": \"FuelD1\", \"range\": \"FuelD1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D2\": \"FuelD2\", \"range\": \"FuelD2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D3\": \"FuelD3\", \"range\": \"FuelD3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D4\": \"FuelD4\", \"range\": \"FuelD4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D5\": \"FuelD5\", \"range\": \"FuelD5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company earns a revenue of $1000 per truck per route. The fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed.\n// RevenueD1 = 1000 * TrucksD1\n// RevenueD2 = 1000 * TrucksD2\n// RevenueD3 = 1000 * TrucksD3\n// RevenueD4 = 1000 * TrucksD4\n// RevenueD5 = 1000 * TrucksD5\n// FuelCostD1 = 3 * FuelD1 * TrucksD1\n// FuelCostD2 = 3 * FuelD2 * TrucksD2\n// FuelCostD3 = 3 * FuelD3 * TrucksD3\n// FuelCostD4 = 3 * FuelD4 * TrucksD4\n// FuelCostD5 = 3 * FuelD5 * TrucksD5\n// So, the objective function is: Maximize ((RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)) / (FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route. The company earns a revenue of $1000 per truck per route, and the fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed.\n\n| Destination | Revenue per Truck | Fuel Cost per Gallon |\n|-------------|-------------------|----------------------|\n| D1          | $1000             | $3                   |\n| D2          | $1000             | $3                   |\n| D3          | $1000             | $3                   |\n| D4          | $1000             | $3                   |\n| D5          | $1000             | $3                   |\n\nThe company has a total of 50 trucks available. Please help the company to maximize the net profit per gallon of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksD1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD1\", lb=0)  # number of trucks for D1\nTrucksD2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD2\", lb=0)  # number of trucks for D2\nTrucksD3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD3\", lb=0)  # number of trucks for D3\nTrucksD4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD4\", lb=0)  # number of trucks for D4\nTrucksD5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD5\", lb=0)  # number of trucks for D5\nFuelD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD1\", lb=0)  # fuel consumption rate for D1\nFuelD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD2\", lb=0)  # fuel consumption rate for D2\nFuelD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD3\", lb=0)  # fuel consumption rate for D3\nFuelD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD4\", lb=0)  # fuel consumption rate for D4\nFuelD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD5\", lb=0)  # fuel consumption rate for D5\n\n# Define objective function\nRevenueD1 = 1000 * TrucksD1\nRevenueD2 = 1000 * TrucksD2\nRevenueD3 = 1000 * TrucksD3\nRevenueD4 = 1000 * TrucksD4\nRevenueD5 = 1000 * TrucksD5\nFuelCostD1 = 3 * FuelD1 * TrucksD1\nFuelCostD2 = 3 * FuelD2 * TrucksD2\nFuelCostD3 = 3 * FuelD3 * TrucksD3\nFuelCostD4 = 3 * FuelD4 * TrucksD4\nFuelCostD5 = 3 * FuelD5 * TrucksD5\nTotalFuelConsumption = FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5\nNetProfit = (RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalFuelConsumption == NetProfit)\n\n# Add constraints\nmodel.addCons(TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for D1: \", model.getVal(TrucksD1))\n    print(\"Number of Trucks for D2: \", model.getVal(TrucksD2))\n    print(\"Number of Trucks for D3: \", model.getVal(TrucksD3))\n    print(\"Number of Trucks for D4: \", model.getVal(TrucksD4))\n    print(\"Number of Trucks for D5: \", model.getVal(TrucksD5))\n    print(\"Fuel Consumption Rate for D1: \", model.getVal(FuelD1))\n    print(\"Fuel Consumption Rate for D2: \", model.getVal(FuelD2))\n    print(\"Fuel Consumption Rate for D3: \", model.getVal(FuelD3))\n    print(\"Fuel Consumption Rate for D4: \", model.getVal(FuelD4))\n    print(\"Fuel Consumption Rate for D5: \", model.getVal(FuelD5))\n    print(\"Maximized Net Profit per Gallon of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced manufacturing technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n// Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n// Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n// Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\n// DeviceA <= 500; DeviceB <= 400; DeviceC <= 300\n\n## Generate Constraint-3:\nThe total production quantity of all devices must not exceed 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\n// DeviceA >= 100; DeviceB >= 150",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device. The production cost per unit, selling price per unit, and production capacity for each device are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Production Capacity |\n|--------|--------------------------|------------------------|---------------------|\n| DeviceA | $100                     | $150                   | 500 units            |\n| DeviceB | $150                     | $200                   | 400 units            |\n| DeviceC | $200                     | $250                   | 300 units            |\n\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology. The production capacity for each device is limited as shown in the table. The total production quantity of all devices must not exceed 1000 units. The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. \n\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100, ub=500) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=150, ub=400) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=300) # quantity of DeviceC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in advanced manufacturing technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate profit for each device\nProfit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\nProfit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\nProfit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in advanced manufacturing technology.\nmodel.addCons(TechInvestment <= 100000)\n## The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\nmodel.addCons(DeviceC <= 300)\n## The total production quantity of all devices must not exceed 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n## The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\nmodel.addCons(DeviceA >= 100)\nmodel.addCons(DeviceB >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Investment in Technology: \", model.getVal(TechInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1464,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 2000 units for all components combined.\n// E1 + E2 + E3 + E4 + E5 <= 2000",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company has a budget of $50,000 for production costs next month and a storage capacity of 2000 units for all components combined.\nPlease help the company to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n## Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n## Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n## Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n## Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n## So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nmodel.addCons(obj == (20 - 10 - E1) * E1 + (25 - 15 - 1.5 * E2) * E2 + (30 - 20 - 2 * E3) * E3 + (35 - 25 - 2.5 * E4) * E4 + (40 - 30 - 3 * E5) * E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n## The company has a storage capacity of 2000 units for all components combined.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the nonlinear relationship between production quantity and market saturation, which affects the selling price. The objective function is to maximize the total profit, considering a nonlinear decrease in selling price with increased production:\n// Profit_A = (20 - 10 - 0.01 * A^2) * A\n// Profit_B = (30 - 15 - 0.01 * B^2) * B\n// Profit_C = (40 - 20 - 0.01 * C^2) * C\n// Profit_D = (50 - 25 - 0.01 * D^2) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations. The profit per unit and the production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $15                      |\n| C       | $40             | $20                      |\n| D       | $50             | $25                      |\n\nThe company aims to maximize the total profit while considering a nonlinear decrease in selling price with increased production, which is represented by a decrease of 0.01 times the square of the production quantity for each product. The company has a budget of $5000 for production costs.\n\nPlease help the company to maximize the total profit, considering the nonlinear relationship between production quantity and market saturation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\nmodel.addCons(D_sq == D * D)\nProfit_A = (20 - 10 - 0.01 * A_sq) * A\nProfit_B = (30 - 15 - 0.01 * B_sq) * B\nProfit_C = (40 - 20 - 0.01 * C_sq) * C\nProfit_D = (50 - 25 - 0.01 * D_sq) * D\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of ProductA: ProfitA = (100 - 40) * QuantityA\n// Profit of ProductB: ProfitB = (120 - 50) * QuantityB\n// Profit of ProductC: ProfitC = (150 - 60) * QuantityC\n// Profit of ProductD: ProfitD = (200 - 80) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / (5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000\n\n## Generate Constraint-2:\nThe company has a total production capacity of 1000 hours.\n// 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// QuantityA >= 50; QuantityB >= 30",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production. The selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time. The company has a budget of $10,000 for raw materials and a total production capacity of 1000 hours. Additionally, the company must produce at least 50 units of ProductA and 30 units of ProductB. Please help the company determine the optimal production quantities for each product to maximize the profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=30) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 40) * QuantityA\nProfitB = (120 - 50) * QuantityB\nProfitC = (150 - 60) * QuantityC\nProfitD = (200 - 80) * QuantityD\nProductionTime = 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000)\n## The company has a total production capacity of 1000 hours.\nmodel.addCons(5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Production Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: Destination1, Destination2, Destination3, Destination4, and Destination5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies.\n// {\"number of trucks to Destination1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Destination1\": \"FuelEff1\", \"range\": \"FuelEff1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination2\": \"FuelEff2\", \"range\": \"FuelEff2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination3\": \"FuelEff3\", \"range\": \"FuelEff3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination4\": \"FuelEff4\", \"range\": \"FuelEff4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination5\": \"FuelEff5\", \"range\": \"FuelEff5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each route decreases with the investment in fuel-efficient technologies. The initial fuel consumption rate for each destination is 100 liters per truck, but with investment, the rate decreases by 1 liter per truck for every $100 invested in fuel efficiency. The company aims to minimize the total fuel consumption while considering the investments in fuel efficiency.\n// Fuel consumption for Destination1: Fuel1 = (100 - 0.01 * FuelEff1) * Trucks1\n// Fuel consumption for Destination2: Fuel2 = (100 - 0.01 * FuelEff2) * Trucks2\n// Fuel consumption for Destination3: Fuel3 = (100 - 0.01 * FuelEff3) * Trucks3\n// Fuel consumption for Destination4: Fuel4 = (100 - 0.01 * FuelEff4) * Trucks4\n// Fuel consumption for Destination5: Fuel5 = (100 - 0.01 * FuelEff5) * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel efficiency and operational costs.\n// FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 + 100 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks dispatched should not exceed 500.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 50 trucks must be dispatched to Destination1 and 100 trucks to Destination2.\n// Trucks1 >= 50; Trucks2 >= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: Destination1, Destination2, Destination3, Destination4, and Destination5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies. The initial fuel consumption rate for each destination is 100 liters per truck, but with investment, the rate decreases by 1 liter per truck for every $100 invested in fuel efficiency. The company aims to minimize the total fuel consumption while considering the investments in fuel efficiency.\n\n| Destination | Initial Fuel Consumption Rate | Investment Impact |\n|-------------|-------------------------------|-------------------|\n| Destination1| 100 liters per truck          | -1 liter per $100 |\n| Destination2| 100 liters per truck          | -1 liter per $100 |\n| Destination3| 100 liters per truck          | -1 liter per $100 |\n| Destination4| 100 liters per truck          | -1 liter per $100 |\n| Destination5| 100 liters per truck          | -1 liter per $100 |\n\nThe company has a budget of $100,000 for investments in fuel efficiency and operational costs. The total number of trucks dispatched should not exceed 500. Due to contractual obligations, at least 50 trucks must be dispatched to Destination1 and 100 trucks to Destination2.\n\nPlease help the company to minimize the total fuel consumption by determining the optimal number of trucks to each destination and the appropriate investment in fuel efficiency for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks to Destination1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks to Destination2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks to Destination3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks to Destination4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks to Destination5\nFuelEff1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff1\", lb=0)  # investment in fuel efficiency for Destination1\nFuelEff2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff2\", lb=0)  # investment in fuel efficiency for Destination2\nFuelEff3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff3\", lb=0)  # investment in fuel efficiency for Destination3\nFuelEff4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff4\", lb=0)  # investment in fuel efficiency for Destination4\nFuelEff5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff5\", lb=0)  # investment in fuel efficiency for Destination5\n\n# Define objective function\nFuel1 = (100 - 0.01 * FuelEff1) * Trucks1\nFuel2 = (100 - 0.01 * FuelEff2) * Trucks2\nFuel3 = (100 - 0.01 * FuelEff3) * Trucks3\nFuel4 = (100 - 0.01 * FuelEff4) * Trucks4\nFuel5 = (100 - 0.01 * FuelEff5) * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 + 100 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to Destination1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks to Destination2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks to Destination3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks to Destination4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks to Destination5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Destination1: \", model.getVal(FuelEff1))\n    print(\"Investment in Fuel Efficiency for Destination2: \", model.getVal(FuelEff2))\n    print(\"Investment in Fuel Efficiency for Destination3: \", model.getVal(FuelEff3))\n    print(\"Investment in Fuel Efficiency for Destination4: \", model.getVal(FuelEff4))\n    print(\"Investment in Fuel Efficiency for Destination5: \", model.getVal(FuelEff5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1572,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck i at speed x\": \"Efficiency_i(x)\", \"range\": \"Efficiency_i(x) > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n// Fuel consumption for truck i on route j: Consumption_ij = Distance_j / Efficiency_i(Speed_i) * Trucks_j\n// Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\n// Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 100.\n// \u03a3(Trucks_j) for all j <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n\n| Variable                | Description                                                                 | Range/Type       |\n|-------------------------|-----------------------------------------------------------------------------|------------------|\n| Speed_i                 | Speed of truck i (in km/h)                                                  | 0 < Speed_i < 120, Continuous |\n| Trucks_j                | Number of trucks on route j                                                 | Trucks_j >= 0, Integer |\n| Efficiency_i(x)         | Fuel efficiency of truck i at speed x (in km/l)                             | Efficiency_i(x) > 0, Continuous |\n\nThe company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is limited to 100.\n\nPlease help the company determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption, considering the nonlinear relationship between speed and fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed = {}\nfor i in range(1, 11):  # Assuming 10 trucks for simplicity\n    Speed[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=0, ub=120)\n\n## Number of trucks on each route\nTrucks = {}\nfor j in range(1, 6):  # Assuming 5 routes for simplicity\n    Trucks[j] = model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0)\n\n# Define objective function\n## Fuel efficiency of each truck at speed x\nEfficiency = {}\nfor i in range(1, 11):\n    Efficiency[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Efficiency_{i}\", lb=0)\n    model.addCons(Efficiency[i] == 0.01 * Speed[i]**2 + 0.5 * Speed[i] + 10)  # Example quadratic function\n\n## Fuel consumption for each truck on each route\nConsumption = {}\nfor i in range(1, 11):\n    for j in range(1, 6):\n        Consumption[i, j] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Consumption_{i}_{j}\", lb=0)\n        model.addCons(Consumption[i, j] == 100 / Efficiency[i] * Trucks[j])  # Assuming distance 100 km for simplicity\n\n## Total fuel consumption\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Consumption[i, j] for i in range(1, 11) for j in range(1, 6)))\n\n# Add constraints\n## Total number of trucks available is limited to 100\nmodel.addCons(sum(Trucks[j] for j in range(1, 6)) <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(1, 11):\n        print(f\"Speed of truck {i}: {model.getVal(Speed[i])} km/h\")\n    for j in range(1, 6):\n        print(f\"Number of trucks on route {j}: {model.getVal(Trucks[j])}\")\n    print(f\"Total fuel consumption: {model.getObjVal()} liters\")\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1701,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity, daily operational cost, and fuel efficiency. The company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs. The details of each truck type are given in the following Table.\n\n| Truck Type | Capacity (units) | Daily Operational Cost | Fuel Efficiency (km/L) |\n|------------|------------------|------------------------|------------------------|\n| Small      | 100              | $200                   | 5                      |\n| Medium     | 200              | $300                   | 8                      |\n| Large      | 300              | $400                   | 10                     |\n\nThe company has a budget constraint of $10,000 for the total operational costs. The total capacity of all trucks must meet the delivery requirement of 1500 units. Please help the company to minimize the total cost of operations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and travel time of the fleet while considering the varying fuel efficiency of trucks based on their load and speed. The company also needs to decide on the optimal speed for each truck to minimize fuel consumption and travel time.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"load per truck (in tons)\": \"Load\", \"range\": \"Load >= 0\", \"type\": \"continuous\"}\n// {\"speed of trucks (in km/h)\": \"Speed\", \"range\": \"0 < Speed <= 100\", \"type\": \"continuous\"}\n// {\"fuel efficiency (in km/liter)\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n// {\"total travel time (in hours)\": \"TravelTime\", \"range\": \"TravelTime >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks decreases nonlinearly with an increase in load and speed. The company aims to minimize the total fuel consumption and travel time. The fuel consumption is given by the formula: FuelConsumption = (Load / Efficiency) * TravelTime. The travel time is directly proportional to the distance traveled and inversely proportional to the speed.\n// The objective function is: Minimize (FuelConsumption + TravelTime)\n\n## Generate Constraint-1:\nThe total load capacity of all trucks combined must not exceed 500 tons.\n// Trucks * Load <= 500",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and travel time of the fleet while considering the varying fuel efficiency of trucks based on their load and speed. The company also needs to decide on the optimal speed for each truck to minimize fuel consumption and travel time. The fuel efficiency of the trucks decreases nonlinearly with an increase in load and speed. The fuel consumption is given by the formula: FuelConsumption = (Load / Efficiency) * TravelTime. The travel time is directly proportional to the distance traveled and inversely proportional to the speed. The total load capacity of all trucks combined must not exceed 500 tons.\nPlease help the company to minimize the total fuel consumption and travel time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nLoad = model.addVar(vtype=\"CONTINUOUS\", name=\"Load\", lb=0)  # load per truck (in tons)\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0, ub=100)  # speed of trucks (in km/h)\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # fuel efficiency (in km/liter)\nTravelTime = model.addVar(vtype=\"CONTINUOUS\", name=\"TravelTime\", lb=0)  # total travel time (in hours)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsumption = (Load / Efficiency) * TravelTime\n## The objective function is: Minimize (FuelConsumption + TravelTime)\nmodel.addCons(obj == FuelConsumption + TravelTime)\n\n# Add constraints\n## The total load capacity of all trucks combined must not exceed 500 tons.\nmodel.addCons(Trucks * Load <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Load per Truck: \", model.getVal(Load))\n    print(\"Speed of Trucks: \", model.getVal(Speed))\n    print(\"Fuel Efficiency: \", model.getVal(Efficiency))\n    print(\"Total Travel Time: \", model.getVal(TravelTime))\n    print(\"Minimized Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the overall operational cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of each truck type is a nonlinear function of the number of trucks and drivers. The cost includes fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is linearly dependent on the number of drivers, at $3000 per driver. The company aims to minimize the total operational cost.\n// Total operational cost: Cost = (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for vehicle operations and driver salaries.\n// (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers <= 150000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 500 tons. Each Small truck carries 1 ton, each Medium truck carries 2 tons, and each Large truck carries 3 tons.\n// SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500",
        "question": "A logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the overall operational cost.\nThe operational cost of each truck type is a nonlinear function of the number of trucks and drivers. The cost includes fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is linearly dependent on the number of drivers, at $3000 per driver. The company has a budget of $150,000 for vehicle operations and driver salaries. The total cargo capacity of the fleet must be at least 500 tons. Each Small truck carries 1 ton, each Medium truck carries 2 tons, and each Large truck carries 3 tons.\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)\n\n# Define objective function\n# The operational cost of each truck type is a nonlinear function of the number of trucks and drivers.\nCost_Small = (0.5 + 0.001 * SmallTrucks**2) * (SmallTrucks * Drivers)\nCost_Medium = (0.7 + 0.0015 * MediumTrucks**2) * (MediumTrucks * Drivers)\nCost_Large = (1 + 0.002 * LargeTrucks**2) * (LargeTrucks * Drivers)\nCost_Drivers = 3000 * Drivers\n\n# Total operational cost\nCost = Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The company has a budget of $150,000 for vehicle operations and driver salaries.\nmodel.addCons(Cost <= 150000)\n\n# The total cargo capacity of the fleet must be at least 500 tons.\nmodel.addCons(SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine how many units of each device to produce in the next quarter to optimize its resource usage and profitability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and requires a different amount of raw materials and labor hours. The profit per unit for A is $50, for B is $70, for C is $90, and for D is $110. The raw material cost per unit for A is $20, for B is $30, for C is $40, and for D is $50. The labor hours required per unit for A is 3 hours, for B is 4 hours, for C is 5 hours, and for D is 6 hours. The company aims to maximize the total profit per labor hour used.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (3 * A + 4 * B + 5 * C + 6 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 15000\n\n## Generate Constraint-2:\nThe company has a maximum of 1000 labor hours available for the next quarter.\n// 3 * A + 4 * B + 5 * C + 6 * D <= 1000",
        "question": "A manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine how many units of each device to produce in the next quarter to optimize its resource usage and profitability.\nEach device has a different profit margin and requires a different amount of raw materials and labor hours. The profit per unit for A is $50, for B is $70, for C is $90, and for D is $110. The raw material cost per unit for A is $20, for B is $30, for C is $40, and for D is $50. The labor hours required per unit for A is 3 hours, for B is 4 hours, for C is 5 hours, and for D is 6 hours. The company aims to maximize the total profit per labor hour used.\nThe company has a budget of $15,000 for raw materials for the next quarter. The company has a maximum of 1000 labor hours available for the next quarter.\nPlease help the company to maximize the total profit per labor hour used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\nLaborHours = 3 * A + 4 * B + 5 * C + 6 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $15,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 15000)\n## The company has a maximum of 1000 labor hours available for the next quarter.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The production process involves a nonlinear relationship between the quantity produced and the cost.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\nThe profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\nThe profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs per day.\n// 0.5 * ProductA^2 + 0.4 * ProductB^2 + 0.3 * ProductC^2 <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The profit for each product is given by the following functions:\n\n- Profit for product A: Profit_A = 100 * ProductA - 0.5 * ProductA^2\n- Profit for product B: Profit_B = 150 * ProductB - 0.4 * ProductB^2\n- Profit for product C: Profit_C = 200 * ProductC - 0.3 * ProductC^2\n\nThe company wants to maximize the total profit from all products. The total production capacity of the company is 100 units per day. The company has a budget of $10,000 for production costs per day.\n\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## The profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\n## The profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\n## The profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\n## The company wants to maximize the total profit from all products.\nProfit_A = 100 * ProductA - 0.5 * ProductA**2\nProfit_B = 150 * ProductB - 0.4 * ProductB**2\nProfit_C = 200 * ProductC - 0.3 * ProductC**2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 100)\n## The company has a budget of $10,000 for production costs per day.\nmodel.addCons(0.5 * ProductA**2 + 0.4 * ProductB**2 + 0.3 * ProductC**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs, but the investment cost is significant.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost for ProductA is $100, for ProductB is $150, for ProductC is $200, and for ProductD is $250. The selling price for each product is $200 for ProductA, $250 for ProductB, $300 for ProductC, and $350 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n// Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of ProductA and 1,500 units of ProductB.\n// A >= 1000; B >= 1500\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of ProductD does not exceed the combined production of ProductA and ProductB.\n// D <= A + B\n\n## Generate Constraint-5:\nThe company has a storage constraint that limits the combined production of ProductC and ProductD to 4,000 units.\n// C + D <= 4000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and consider investing in a new technology that could reduce production costs, but with a significant investment cost. The production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost for ProductA is $100, for ProductB is $150, for ProductC is $200, and for ProductD is $250. The selling price for each product is $200 for ProductA, $250 for ProductB, $300 for ProductC, and $350 for ProductD. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for the investment in the new technology. The total production quantity for all products must not exceed 10,000 units. The company must produce at least 1,000 units of ProductA and 1,500 units of ProductB. The company wants to ensure that the production of ProductD does not exceed the combined production of ProductA and ProductB. Additionally, the company has a storage constraint that limits the combined production of ProductC and ProductD to 4,000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of ProductD\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n## Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n## Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n## Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\nProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\nProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\nProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n## The total production quantity for all products must not exceed 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company must produce at least 1,000 units of ProductA and 1,500 units of ProductB.\n## The company wants to ensure that the production of ProductD does not exceed the combined production of ProductA and ProductB.\nmodel.addCons(D <= A + B)\n## The company has a storage constraint that limits the combined production of ProductC and ProductD to 4,000 units.\nmodel.addCons(C + D <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Quantity of ProductD: \", model.getVal(D))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different fuel consumption rate per kilometer and a different average delivery time per truck. \nRoute 1: 0.5 liters/km, 2 hours/truck\nRoute 2: 0.6 liters/km, 1.5 hours/truck\nRoute 3: 0.4 liters/km, 2.5 hours/truck\nRoute 4: 0.7 liters/km, 1 hour/truck\nRoute 5: 0.3 liters/km, 3 hours/truck\nThe company aims to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time. The fuel cost is $1 per liter, and the opportunity cost of time is $50 per hour. The objective is to minimize the total cost of operations.\n// Fuel_Cost_1 = 0.5 * T1 * Distance_1 * 1\n// Fuel_Cost_2 = 0.6 * T2 * Distance_2 * 1\n// Fuel_Cost_3 = 0.4 * T3 * Distance_3 * 1\n// Fuel_Cost_4 = 0.7 * T4 * Distance_4 * 1\n// Fuel_Cost_5 = 0.3 * T5 * Distance_5 * 1\n// Time_Cost_1 = 2 * T1 * 50\n// Time_Cost_2 = 1.5 * T2 * 50\n// Time_Cost_3 = 2.5 * T3 * 50\n// Time_Cost_4 = 1 * T4 * 50\n// Time_Cost_5 = 3 * T5 * 50\n// Total_Cost = Fuel_Cost_1 + Fuel_Cost_2 + Fuel_Cost_3 + Fuel_Cost_4 + Fuel_Cost_5 + Time_Cost_1 + Time_Cost_2 + Time_Cost_3 + Time_Cost_4 + Time_Cost_5\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has a different fuel consumption rate per kilometer and a different average delivery time per truck. Route 1 consumes 0.5 liters/km and takes 2 hours/truck, Route 2 consumes 0.6 liters/km and takes 1.5 hours/truck, Route 3 consumes 0.4 liters/km and takes 2.5 hours/truck, Route 4 consumes 0.7 liters/km and takes 1 hour/truck, and Route 5 consumes 0.3 liters/km and takes 3 hours/truck. The company aims to minimize the total cost, which includes the fuel cost at $1 per liter and the opportunity cost of time at $50 per hour. The company has a total of 100 trucks available for allocation. Please help the company to minimize the total cost of operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_1 = 0.5 * T1 * 1 # assuming Distance_1 is 1 km for simplicity\nFuel_Cost_2 = 0.6 * T2 * 1 # assuming Distance_2 is 1 km for simplicity\nFuel_Cost_3 = 0.4 * T3 * 1 # assuming Distance_3 is 1 km for simplicity\nFuel_Cost_4 = 0.7 * T4 * 1 # assuming Distance_4 is 1 km for simplicity\nFuel_Cost_5 = 0.3 * T5 * 1 # assuming Distance_5 is 1 km for simplicity\nTime_Cost_1 = 2 * T1 * 50\nTime_Cost_2 = 1.5 * T2 * 50\nTime_Cost_3 = 2.5 * T3 * 50\nTime_Cost_4 = 1 * T4 * 50\nTime_Cost_5 = 3 * T5 * 50\nTotal_Cost = Fuel_Cost_1 + Fuel_Cost_2 + Fuel_Cost_3 + Fuel_Cost_4 + Fuel_Cost_5 + Time_Cost_1 + Time_Cost_2 + Time_Cost_3 + Time_Cost_4 + Time_Cost_5\n## the objective function is: Minimize Total_Cost\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, heavy machinery, and hazardous materials. The company needs to decide on the number of trucks to purchase for each type of cargo and the fuel efficiency of each truck type.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"MachineryTrucks\", \"range\": \"MachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for perishable goods (miles per gallon)\": \"PerishableEfficiency\", \"range\": \"PerishableEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for heavy machinery (miles per gallon)\": \"MachineryEfficiency\", \"range\": \"MachineryEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for hazardous materials (miles per gallon)\": \"HazardousEfficiency\", \"range\": \"HazardousEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3. The company estimates that each truck for perishable goods will travel 5000 miles per month, for heavy machinery 3000 miles per month, and for hazardous materials 2000 miles per month. The company aims to minimize the total monthly fuel cost.\n// FuelCost_Perishable = 5000 * PerishableTrucks / PerishableEfficiency * 3\n// FuelCost_Machinery = 3000 * MachineryTrucks / MachineryEfficiency * 3\n// FuelCost_Hazardous = 2000 * HazardousTrucks / HazardousEfficiency * 3\n// So, the objective function is: Minimize (FuelCost_Perishable + FuelCost_Machinery + FuelCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// PerishableTrucks * 20000 + MachineryTrucks * 30000 + HazardousTrucks * 40000 <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, heavy machinery, and hazardous materials. The company needs to decide on the number of trucks to purchase for each type of cargo and the fuel efficiency of each truck type. The cost of fuel per gallon is $3. The company estimates that each truck for perishable goods will travel 5000 miles per month, for heavy machinery 3000 miles per month, and for hazardous materials 2000 miles per month. The company aims to minimize the total monthly fuel cost. The company has a budget of $100,000 for purchasing new trucks.\n\nPlease help the company determine the optimal number of trucks and their fuel efficiencies to minimize the total monthly fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"MachineryTrucks\", lb=0)  # number of trucks for heavy machinery\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)  # number of trucks for hazardous materials\nPerishableEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableEfficiency\", lb=0)  # fuel efficiency of trucks for perishable goods\nMachineryEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryEfficiency\", lb=0)  # fuel efficiency of trucks for heavy machinery\nHazardousEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousEfficiency\", lb=0)  # fuel efficiency of trucks for hazardous materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Perishable = 5000 * PerishableTrucks / PerishableEfficiency * 3\nFuelCost_Machinery = 3000 * MachineryTrucks / MachineryEfficiency * 3\nFuelCost_Hazardous = 2000 * HazardousTrucks / HazardousEfficiency * 3\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_Perishable + FuelCost_Machinery + FuelCost_Hazardous)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(PerishableTrucks * 20000 + MachineryTrucks * 30000 + HazardousTrucks * 40000 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(MachineryTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousTrucks))\n    print(\"Fuel Efficiency for Perishable Goods: \", model.getVal(PerishableEfficiency))\n    print(\"Fuel Efficiency for Heavy Machinery: \", model.getVal(MachineryEfficiency))\n    print(\"Fuel Efficiency for Hazardous Materials: \", model.getVal(HazardousEfficiency))\n    print(\"Minimized Monthly Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the amount of money to invest in retrofitting each type of truck to improve their fuel efficiency.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in retrofitting for Small trucks\": \"RetrofitSmall\", \"range\": \"RetrofitSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Medium trucks\": \"RetrofitMedium\", \"range\": \"RetrofitMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Large trucks\": \"RetrofitLarge\", \"range\": \"RetrofitLarge >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Extra-Large trucks\": \"RetrofitExtraLarge\", \"range\": \"RetrofitExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type can be improved by investing in retrofitting. For every $1,000 invested in retrofitting, the fuel efficiency of Small trucks increases by 1%, Medium trucks by 0.8%, Large trucks by 0.6%, and Extra-Large trucks by 0.5%. The company aims to minimize the total annual fuel cost, which is a nonlinear function of the number of trucks and their fuel efficiency.\n// Total fuel cost for Small trucks: FuelCostSmall = (10000 * SmallTrucks) / (1 + 0.001 * RetrofitSmall)\n// Total fuel cost for Medium trucks: FuelCostMedium = (12000 * MediumTrucks) / (1 + 0.0008 * RetrofitMedium)\n// Total fuel cost for Large trucks: FuelCostLarge = (15000 * LargeTrucks) / (1 + 0.0006 * RetrofitLarge)\n// Total fuel cost for Extra-Large trucks: FuelCostExtraLarge = (20000 * ExtraLargeTrucks) / (1 + 0.0005 * RetrofitExtraLarge)\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing and retrofitting trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 150000 * ExtraLargeTrucks + RetrofitSmall + RetrofitMedium + RetrofitLarge + RetrofitExtraLarge <= 2000000",
        "question": "A logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the amount of money to invest in retrofitting each type of truck to improve their fuel efficiency. The fuel efficiency of each truck type can be improved by investing in retrofitting. For every $1,000 invested in retrofitting, the fuel efficiency of Small trucks increases by 1%, Medium trucks by 0.8%, Large trucks by 0.6%, and Extra-Large trucks by 0.5%. The company aims to minimize the total annual fuel cost, which is a nonlinear function of the number of trucks and their fuel efficiency. The company has a budget of $2,000,000 for purchasing and retrofitting trucks.\n\nPlease help the company to minimize the total annual fuel cost, which includes the costs for Small trucks: FuelCostSmall = (10000 * SmallTrucks) / (1 + 0.001 * RetrofitSmall), Medium trucks: FuelCostMedium = (12000 * MediumTrucks) / (1 + 0.0008 * RetrofitMedium), Large trucks: FuelCostLarge = (15000 * LargeTrucks) / (1 + 0.0006 * RetrofitLarge), and Extra-Large trucks: FuelCostExtraLarge = (20000 * ExtraLargeTrucks) / (1 + 0.0005 * RetrofitExtraLarge).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nRetrofitSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitSmall\", lb=0)\nRetrofitMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitMedium\", lb=0)\nRetrofitLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitLarge\", lb=0)\nRetrofitExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitExtraLarge\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostSmall = (10000 * SmallTrucks) / (1 + 0.001 * RetrofitSmall)\nFuelCostMedium = (12000 * MediumTrucks) / (1 + 0.0008 * RetrofitMedium)\nFuelCostLarge = (15000 * LargeTrucks) / (1 + 0.0006 * RetrofitLarge)\nFuelCostExtraLarge = (20000 * ExtraLargeTrucks) / (1 + 0.0005 * RetrofitExtraLarge)\n## convert the division to multiplication\nmodel.addCons(obj * (1 + 0.001 * RetrofitSmall) * (1 + 0.0008 * RetrofitMedium) * (1 + 0.0006 * RetrofitLarge) * (1 + 0.0005 * RetrofitExtraLarge) == FuelCostSmall * (1 + 0.001 * RetrofitSmall) + FuelCostMedium * (1 + 0.0008 * RetrofitMedium) + FuelCostLarge * (1 + 0.0006 * RetrofitLarge) + FuelCostExtraLarge * (1 + 0.0005 * RetrofitExtraLarge))\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing and retrofitting trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 150000 * ExtraLargeTrucks + RetrofitSmall + RetrofitMedium + RetrofitLarge + RetrofitExtraLarge <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Retrofitting for Small Trucks: \", model.getVal(RetrofitSmall))\n    print(\"Investment in Retrofitting for Medium Trucks: \", model.getVal(RetrofitMedium))\n    print(\"Investment in Retrofitting for Large Trucks: \", model.getVal(RetrofitLarge))\n    print(\"Investment in Retrofitting for Extra-Large Trucks: \", model.getVal(RetrofitExtraLarge))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1318,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-4:\nThe production of ComponentB should be at least twice the production of ComponentA.\n// B >= 2 * A\n\n## Generate Constraint-5:\nThe total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB.\n// C + D <= A + B",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit. The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week. The company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit. The production of ComponentB should be at least twice the production of ComponentA. The total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB. Please help the company to maximize the total profit from the production of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n# The company has a limited budget for raw materials, which is $5000 per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n# The production of ComponentB should be at least twice the production of ComponentA.\nmodel.addCons(B >= 2 * A)\n# The total production of ComponentC and ComponentD should not exceed the combined production of ComponentA and ComponentB.\nmodel.addCons(C + D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in kilometers per liter (km/L).\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"SmallEfficiency\", \"range\": \"SmallEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"MediumEfficiency\", \"range\": \"MediumEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"LargeEfficiency\", \"range\": \"LargeEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, considering the distance traveled by each type of truck and the fuel price per liter. The fuel price is $1.50 per liter, and the annual distance traveled by each small, medium, and large truck is 100,000 km, 120,000 km, and 150,000 km respectively.\n// FuelCost_Small = 100000 * SmallTrucks / SmallEfficiency * 1.50\n// FuelCost_Medium = 120000 * MediumTrucks / MediumEfficiency * 1.50\n// FuelCost_Large = 150000 * LargeTrucks / LargeEfficiency * 1.50\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 2000000\n\n## Generate Constraint-2:\nThe total weight capacity of all trucks must not exceed 500,000 kg.\n// SmallTrucks * 10000 + MediumTrucks * 15000 + LargeTrucks * 20000 <= 500000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in kilometers per liter (km/L). The company aims to minimize the total annual fuel cost, considering the distance traveled by each type of truck and the fuel price per liter. The fuel price is $1.50 per liter, and the annual distance traveled by each small, medium, and large truck is 100,000 km, 120,000 km, and 150,000 km respectively. The company has a budget of $2,000,000 for purchasing trucks. The total weight capacity of all trucks must not exceed 500,000 kg. Please help the company to determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total annual fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nSmallEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallEfficiency\", lb=0)  # fuel efficiency of small trucks\nMediumEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumEfficiency\", lb=0)  # fuel efficiency of medium trucks\nLargeEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeEfficiency\", lb=0)  # fuel efficiency of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = 100000 * SmallTrucks / SmallEfficiency * 1.50\nFuelCost_Medium = 120000 * MediumTrucks / MediumEfficiency * 1.50\nFuelCost_Large = 150000 * LargeTrucks / LargeEfficiency * 1.50\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 2000000)\n## The total weight capacity of all trucks must not exceed 500,000 kg.\nmodel.addCons(10000 * SmallTrucks + 15000 * MediumTrucks + 20000 * LargeTrucks <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeEfficiency))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: R1, R2, R3, R4, and R5. The company needs to determine the number of trips each truck should make to each region to minimize fuel consumption and time spent on the road.\n// {\"trips to R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips to R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips to R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips to R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips to R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and time spent on the road for each trip vary by region. For R1, the fuel consumption per trip is 50 liters and the time spent is 4 hours. For R2, the fuel consumption per trip is 60 liters and the time spent is 5 hours. For R3, the fuel consumption per trip is 70 liters and the time spent is 6 hours. For R4, the fuel consumption per trip is 80 liters and the time spent is 7 hours. For R5, the fuel consumption per trip is 90 liters and the time spent is 8 hours. The company wants to minimize the total cost of fuel and the total time spent on the road.\n// Cost_R1 = 50 * T1\n// Cost_R2 = 60 * T2\n// Cost_R3 = 70 * T3\n// Cost_R4 = 80 * T4\n// Cost_R5 = 90 * T5\n// Time_R1 = 4 * T1\n// Time_R2 = 5 * T2\n// Time_R3 = 6 * T3\n// Time_R4 = 7 * T4\n// Time_R5 = 8 * T5\n// So, the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) + (Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $5000.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000\n\n## Generate Constraint-2:\nThe company has a total available time for trips of 500 hours.\n// 4 * T1 + 5 * T2 + 6 * T3 + 7 * T4 + 8 * T5 <= 500\n\n## Generate Constraint-3:\nThe company has a limit on the number of trips that can be made due to maintenance constraints. The limit is 100 trips in total.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: R1, R2, R3, R4, and R5. The company needs to determine the number of trips each truck should make to each region to minimize fuel consumption and time spent on the road. The fuel consumption per trip and the time spent for each region are given in the following Table.\n\n| Region | Fuel Consumption per Trip | Time Spent per Trip |\n|--------|---------------------------|----------------------|\n| R1     | 50 liters                 | 4 hours              |\n| R2     | 60 liters                 | 5 hours              |\n| R3     | 70 liters                 | 6 hours              |\n| R4     | 80 liters                 | 7 hours              |\n| R5     | 90 liters                 | 8 hours              |\n\nThe company has a total fuel budget of $5000. The company has a total available time for trips of 500 hours. The company has a limit on the number of trips that can be made due to maintenance constraints, which is 100 trips in total. Please help the company to minimize the total cost of fuel and the total time spent on the road.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips to R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips to R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trips to R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips to R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips to R5\n\n# Define objective function\nCost_R1 = 50 * T1\nCost_R2 = 60 * T2\nCost_R3 = 70 * T3\nCost_R4 = 80 * T4\nCost_R5 = 90 * T5\nTime_R1 = 4 * T1\nTime_R2 = 5 * T2\nTime_R3 = 6 * T3\nTime_R4 = 7 * T4\nTime_R5 = 8 * T5\n# So, the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) + (Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5 + Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\n\n# Add constraints\n# The company has a total fuel budget of $5000.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000)\n# The company has a total available time for trips of 500 hours.\nmodel.addCons(4 * T1 + 5 * T2 + 6 * T3 + 7 * T4 + 8 * T5 <= 500)\n# The company has a limit on the number of trips that can be made due to maintenance constraints. The limit is 100 trips in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to R1: \", model.getVal(T1))\n    print(\"Trips to R2: \", model.getVal(T2))\n    print(\"Trips to R3: \", model.getVal(T3))\n    print(\"Trips to R4: \", model.getVal(T4))\n    print(\"Trips to R5: \", model.getVal(T5))\n    print(\"Minimized Total Cost and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint that limits the total production to no more than 800 units.\n// ProdA + ProdB + ProdC <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to meet a contractual obligation.\n// ProdC >= 50\n\n## Generate Constraint-5:\nThe total production cost must not exceed $30,000.\n// 30 * ProdA + 40 * ProdB + 35 * ProdC <= 30,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a storage capacity constraint that limits the total production to no more than 800 units. The company must produce at least 50 units of ProductC to meet a contractual obligation. The total production cost must not exceed $30,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=50) # production quantity for ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n## So, the objective function is: Maximize Profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n## The company has a storage capacity constraint that limits the total production to no more than 800 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 800)\n## The company must produce at least 50 units of ProductC to meet a contractual obligation.\nmodel.addCons(ProdC >= 50)\n## The total production cost must not exceed $30,000.\nmodel.addCons(30 * ProdA + 40 * ProdB + 35 * ProdC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines.\n// {\"cargo load on truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"real\"}\n// {\"cargo load on truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency (in liters per kilometer) and a maximum capacity. Truck 1 has a fuel efficiency of 5 + 0.01 * T1 liters/km, Truck 2 has 6 + 0.015 * T2 liters/km, Truck 3 has 7 + 0.02 * T3 liters/km, Truck 4 has 8 + 0.025 * T4 liters/km, and Truck 5 has 9 + 0.03 * T5 liters/km. The total distance to be covered by all trucks is 1000 km. The company wants to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = (5 + 0.01 * T1) * 1000 + (6 + 0.015 * T2) * 1000 + (7 + 0.02 * T3) * 1000 + (8 + 0.025 * T4) * 1000 + (9 + 0.03 * T5) * 1000\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 500 tons.\n// T1 + T2 + T3 + T4 + T5 = 500\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck 1 can carry up to 100 tons, Truck 2 up to 120 tons, Truck 3 up to 150 tons, Truck 4 up to 130 tons, and Truck 5 up to 100 tons.\n// T1 <= 100\n// T2 <= 120\n// T3 <= 150\n// T4 <= 130\n// T5 <= 100",
        "question": "A logistics company operates a fleet of 5 trucks with different fuel efficiencies and capacities. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel consumption while meeting delivery deadlines. Each truck has a different fuel efficiency (in liters per kilometer) and a maximum capacity. Truck 1 has a fuel efficiency of 5 + 0.01 * T1 liters/km, Truck 2 has 6 + 0.015 * T2 liters/km, Truck 3 has 7 + 0.02 * T3 liters/km, Truck 4 has 8 + 0.025 * T4 liters/km, and Truck 5 has 9 + 0.03 * T5 liters/km. The total distance to be covered by all trucks is 1000 km. The total cargo to be delivered is 500 tons. Each truck has a maximum capacity: Truck 1 can carry up to 100 tons, Truck 2 up to 120 tons, Truck 3 up to 150 tons, Truck 4 up to 130 tons, and Truck 5 up to 100 tons. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # cargo load on truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0) # cargo load on truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0) # cargo load on truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0) # cargo load on truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0) # cargo load on truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel consumption: Fuel = (5 + 0.01 * T1) * 1000 + (6 + 0.015 * T2) * 1000 + (7 + 0.02 * T3) * 1000 + (8 + 0.025 * T4) * 1000 + (9 + 0.03 * T5) * 1000\nFuel = (5 + 0.01 * T1) * 1000 + (6 + 0.015 * T2) * 1000 + (7 + 0.02 * T3) * 1000 + (8 + 0.025 * T4) * 1000 + (9 + 0.03 * T5) * 1000\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total cargo to be delivered is 500 tons.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 500)\n## Each truck has a maximum capacity: Truck 1 can carry up to 100 tons, Truck 2 up to 120 tons, Truck 3 up to 150 tons, Truck 4 up to 130 tons, and Truck 5 up to 100 tons.\nmodel.addCons(T1 <= 100)\nmodel.addCons(T2 <= 120)\nmodel.addCons(T3 <= 150)\nmodel.addCons(T4 <= 130)\nmodel.addCons(T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo Load on Truck 1: \", model.getVal(T1))\n    print(\"Cargo Load on Truck 2: \", model.getVal(T2))\n    print(\"Cargo Load on Truck 3: \", model.getVal(T3))\n    print(\"Cargo Load on Truck 4: \", model.getVal(T4))\n    print(\"Cargo Load on Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company has identified four regions (North, South, East, West) and needs to decide the number of trucks to allocate to each region. Additionally, the company must determine the fuel efficiency (in miles per gallon) of each truck type used in each region.\n// {\"number of trucks for North\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for North\": \"FuelEfficiencyNorth\", \"range\": \"FuelEfficiencyNorth > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for South\": \"FuelEfficiencySouth\", \"range\": \"FuelEfficiencySouth > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for East\": \"FuelEfficiencyEast\", \"range\": \"FuelEfficiencyEast > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for West\": \"FuelEfficiencyWest\", \"range\": \"FuelEfficiencyWest > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The cost of fuel is $3 per gallon. Each truck in the North region travels 500 miles per day, in the South region 400 miles per day, in the East region 600 miles per day, and in the West region 550 miles per day.\n// FuelCostNorth = (500 * TrucksNorth) / FuelEfficiencyNorth * 3\n// FuelCostSouth = (400 * TrucksSouth) / FuelEfficiencySouth * 3\n// FuelCostEast = (600 * TrucksEast) / FuelEfficiencyEast * 3\n// FuelCostWest = (550 * TrucksWest) / FuelEfficiencyWest * 3\n// So, the objective function is: Minimize (FuelCostNorth + FuelCostSouth + FuelCostEast + FuelCostWest)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// (500 * TrucksNorth) / FuelEfficiencyNorth * 3 + (400 * TrucksSouth) / FuelEfficiencySouth * 3 + (600 * TrucksEast) / FuelEfficiencyEast * 3 + (550 * TrucksWest) / FuelEfficiencyWest * 3 <= 10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 20\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in any region must not exceed 15 miles per gallon.\n// FuelEfficiencyNorth <= 15\n// FuelEfficiencySouth <= 15\n// FuelEfficiencyEast <= 15\n// FuelEfficiencyWest <= 15",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company has identified four regions (North, South, East, West) and needs to decide the number of trucks to allocate to each region. Additionally, the company must determine the fuel efficiency (in miles per gallon) of each truck type used in each region. Each truck in the North region travels 500 miles per day, in the South region 400 miles per day, in the East region 600 miles per day, and in the West region 550 miles per day. The company aims to minimize the total fuel cost per day, with the cost of fuel being $3 per gallon. The company has a total budget of $10,000 for fuel costs per day and can allocate a maximum of 20 trucks in total across all regions. The fuel efficiency of trucks in any region must not exceed 15 miles per gallon. Please help the company to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nFuelEfficiencyNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyNorth\", lb=0)\nFuelEfficiencySouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencySouth\", lb=0)\nFuelEfficiencyEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyEast\", lb=0)\nFuelEfficiencyWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyWest\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostNorth = (500 * TrucksNorth) / FuelEfficiencyNorth * 3\nFuelCostSouth = (400 * TrucksSouth) / FuelEfficiencySouth * 3\nFuelCostEast = (600 * TrucksEast) / FuelEfficiencyEast * 3\nFuelCostWest = (550 * TrucksWest) / FuelEfficiencyWest * 3\n## the objective function is: Minimize (FuelCostNorth + FuelCostSouth + FuelCostEast + FuelCostWest)\nmodel.addCons(obj == FuelCostNorth + FuelCostSouth + FuelCostEast + FuelCostWest)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons((500 * TrucksNorth) / FuelEfficiencyNorth * 3 + (400 * TrucksSouth) / FuelEfficiencySouth * 3 + (600 * TrucksEast) / FuelEfficiencyEast * 3 + (550 * TrucksWest) / FuelEfficiencyWest * 3 <= 10000)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 20)\n## The fuel efficiency of trucks in any region must not exceed 15 miles per gallon.\nmodel.addCons(FuelEfficiencyNorth <= 15)\nmodel.addCons(FuelEfficiencySouth <= 15)\nmodel.addCons(FuelEfficiencyEast <= 15)\nmodel.addCons(FuelEfficiencyWest <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks for South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks for East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks for West: \", model.getVal(TrucksWest))\n    print(\"Fuel Efficiency for North: \", model.getVal(FuelEfficiencyNorth))\n    print(\"Fuel Efficiency for South: \", model.getVal(FuelEfficiencySouth))\n    print(\"Fuel Efficiency for East: \", model.getVal(FuelEfficiencyEast))\n    print(\"Fuel Efficiency for West: \", model.getVal(FuelEfficiencyWest))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be used per trip. The goal is to minimize the total fuel cost while meeting delivery deadlines and maintaining safety standards.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"speed of Truck1 (km/h)\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck2 (km/h)\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"fuel consumption per trip for Truck1 (liters)\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption per trip for Truck2 (liters)\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, following the formula: Fuel = a * Speed^3 + b * Speed^2 + c * Speed, where a, b, and c are constants. The company aims to minimize the total fuel cost, which is the sum of the fuel consumed by each truck multiplied by the number of trips and the cost per liter of fuel.\n// Fuel consumption for Truck1: Fuel1 = a1 * Speed1^3 + b1 * Speed1^2 + c1 * Speed1\n// Fuel consumption for Truck2: Fuel2 = a2 * Speed2^3 + b2 * Speed2^2 + c2 * Speed2\n// Total fuel cost: Cost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nEach truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips.\n// Trips1 >= 50; Trips2 >= 75\n\n## Generate Constraint-2:\nThe total time spent on the road by all trucks must not exceed 1000 hours. The time per trip is distance divided by speed.\n// (Distance1 / Speed1) * Trips1 + (Distance2 / Speed2) * Trips2 <= 1000\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5.\n// (Fuel1 * Trips1 + Fuel2 * Trips2) * 1.5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be used per trip. The goal is to minimize the total fuel cost while meeting delivery deadlines and maintaining safety standards. The fuel consumption of each truck is a nonlinear function of its speed, following the formula: Fuel = a * Speed^3 + b * Speed^2 + c * Speed, where a, b, and c are constants. Each truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips. The total time spent on the road by all trucks must not exceed 1000 hours. The total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips.\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75) # number of trips for Truck2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100) # speed of Truck1 (km/h)\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100) # speed of Truck2 (km/h)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel consumption per trip for Truck1 (liters)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel consumption per trip for Truck2 (liters)\n\n# Define objective function\n## Fuel consumption for Truck1: Fuel1 = a1 * Speed1^3 + b1 * Speed1^2 + c1 * Speed1\n## Fuel consumption for Truck2: Fuel2 = a2 * Speed2^3 + b2 * Speed2^2 + c2 * Speed2\n## Total fuel cost: Cost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\n## So, the objective function is: Minimize Cost\na1, b1, c1, a2, b2, c2, CostPerLiter = 0.001, 0.01, 1, 0.001, 0.01, 1, 1.5\nFuel1 = a1 * Speed1**3 + b1 * Speed1**2 + c1 * Speed1\nFuel2 = a2 * Speed2**3 + b2 * Speed2**2 + c2 * Speed2\nCost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total time spent on the road by all trucks must not exceed 1000 hours. The time per trip is distance divided by speed.\nDistance1, Distance2 = 500, 600 # example distances\nmodel.addCons((Distance1 / Speed1) * Trips1 + (Distance2 / Speed2) * Trips2 <= 1000)\n## The total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5.\nmodel.addCons((Fuel1 * Trips1 + Fuel2 * Trips2) * 1.5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Fuel Consumption per Trip for Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel Consumption per Trip for Truck2: \", model.getVal(Fuel2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\n// Profit_D1 = 100 * D1\n// Profit_D2 = 150 * D2\n// Profit_D3 = 200 * D3\n// The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 500 units available.\n// 2 * D1 + 3 * D2 + 4 * D3 <= 500\n\n## Generate Constraint-2:\nThe supply of material N is also limited, with only 200 units available.\n// D2 + 2 * D3 <= 200\n\n## Generate Constraint-3:\nThe production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively.\n// D1 + 2 * D2 + 3 * D3 <= 150\n\n## Generate Constraint-4:\nThe market demand for D1 is 50 units. Therefore, the manufacturer can only sell a maximum of 50 units of D1.\n// D1 <= 50\n\n## Generate Constraint-5:\nThe manufacturer has a policy to produce at least 20 units of D2 to maintain a presence in that market segment.\n// D2 >= 20",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer has a limited supply of material M, with only 500 units available, and the supply of material N is also limited, with only 200 units available. The production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively. The market demand for D1 is 50 units, and the manufacturer has a policy to produce at least 20 units of D2 to maintain a presence in that market segment. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=50)  # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=20, ub=math.inf)  # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0, ub=math.inf)  # quantity of D3\n\n# Define objective function\nProfit_D1 = 100 * D1\nProfit_D2 = 150 * D2\nProfit_D3 = 200 * D3\n# The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited supply of material M, with only 500 units available.\nmodel.addCons(2 * D1 + 3 * D2 + 4 * D3 <= 500)\n# The supply of material N is also limited, with only 200 units available.\nmodel.addCons(D2 + 2 * D3 <= 200)\n# The production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively.\nmodel.addCons(D1 + 2 * D2 + 3 * D3 <= 150)\n# The market demand for D1 is 50 units. Therefore, the manufacturer can only sell a maximum of 50 units of D1.\nmodel.addCons(D1 <= 50)\n# The manufacturer has a policy to produce at least 20 units of D2 to maintain a presence in that market segment.\nmodel.addCons(D2 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000\n\n## Generate Constraint-2:\nThe company aims to have at least 10 vehicles in total.\n// Trucks + Vans + Bikes + Drones >= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\n// Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones)",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for each vehicle type per day are as follows:\n\n| Vehicle Type | Operational Cost per Day |\n|--------------|--------------------------|\n| Trucks       | $500                     |\n| Vans         | $300                     |\n| Bikes        | $100                     |\n| Drones       | $200                     |\n\nThe company has a budget of $100,000 for purchasing vehicles. The company aims to have at least 10 vehicles in total. Additionally, the company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles. \n\nPlease help the company to minimize the total operational cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)\n\n# Define objective function\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n# The company aims to have at least 10 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes + Drones >= 10)\n# The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\nmodel.addCons(Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Refrigerated trucks\": \"MaintenanceRefrigerated\", \"range\": \"MaintenanceRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Heavy trucks\": \"MaintenanceHeavy\", \"range\": \"MaintenanceHeavy >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Standard trucks\": \"MaintenanceStandard\", \"range\": \"MaintenanceStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Refrigerated trucks: CostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\n// Total operational cost for Heavy trucks: CostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\n// Total operational cost for Standard trucks: CostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and maintenance.\n// 1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 50 Refrigerated trucks and 70 Heavy trucks.\n// RefrigeratedTrucks >= 50; HeavyTrucks >= 70",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. They also need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks. The operational cost of each type of truck decreases with increased maintenance. The details are as follows:\n\n| Type of Truck | Operational Cost per Truck per Month | Decrease in Cost per $500 Spent on Maintenance |\n|---------------|--------------------------------------|------------------------------------------------|\n| Refrigerated  | $1000                                | $100                                           |\n| Heavy         | $1500                                | $150                                           |\n| Standard      | $800                                 | $80                                            |\n\nThe company has a budget of $200,000 for purchasing trucks and maintenance. The total number of trucks in the fleet must not exceed 200. Due to contractual obligations, the company must have at least 50 Refrigerated trucks and 70 Heavy trucks.\n\nPlease help the company to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=50)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=70)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nMaintenanceRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceRefrigerated\", lb=0)\nMaintenanceHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHeavy\", lb=0)\nMaintenanceStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\nCostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\nCostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Level for Refrigerated Trucks: \", model.getVal(MaintenanceRefrigerated))\n    print(\"Maintenance Level for Heavy Trucks: \", model.getVal(MaintenanceHeavy))\n    print(\"Maintenance Level for Standard Trucks: \", model.getVal(MaintenanceStandard))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is 0.05 * A^2, for product B is 0.07 * B^2, and for product C is 0.09 * C^2. The company aims to maximize its total profit.\n// Profit_A = 20 * A - 0.05 * A^2\n// Profit_B = 30 * B - 0.07 * B^2\n// Profit_C = 40 * C - 0.09 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for production costs.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 <= 1000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 50 hours per week. The production time for product A is 1 hour per unit, for product B is 2 hours per unit, and for product C is 3 hours per unit.\n// A + 2 * B + 3 * C <= 50\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of each product to meet the minimum order requirements from suppliers.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin. The profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is 0.05 * A^2, for product B is 0.07 * B^2, and for product C is 0.09 * C^2. The company aims to maximize its total profit.\n\nThe company has a total budget of $1000 for production costs. The company has a limited production capacity of 50 hours per week. The production time for product A is 1 hour per unit, for product B is 2 hours per unit, and for product C is 3 hours per unit. The company must produce at least 5 units of each product to meet the minimum order requirements from suppliers.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A - 0.05 * A**2\nProfit_B = 30 * B - 0.07 * B**2\nProfit_C = 40 * C - 0.09 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $1000 for production costs.\nmodel.addCons(0.05 * A**2 + 0.07 * B**2 + 0.09 * C**2 <= 1000)\n## The company has a limited production capacity of 50 hours per week.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $20, and the storage cost per unit is $5.\nFor Product B, the profit per unit is $30, and the storage cost per unit is $7.\nFor Product C, the profit per unit is $40, and the storage cost per unit is $9.\nFor Product D, the profit per unit is $50, and the storage cost per unit is $11.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Net profit of A: Net_Profit_A = (20 - 5) * A\n// Net profit of B: Net_Profit_B = (30 - 7) * B\n// Net profit of C: Net_Profit_C = (40 - 9) * C\n// Net profit of D: Net_Profit_D = (50 - 11) * D\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 1000 units.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 1000\n\n## Generate Constraint-2:\nThe company has a transportation budget that allows for the distribution of at most 200 units.\n// A + B + C + D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\n// C <= A + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit |\n|---------|-----------------|-----------------------|\n| A       | $20             | $5                    |\n| B       | $30             | $7                    |\n| C       | $40             | $9                    |\n| D       | $50             | $11                   |\n\nThe company has a total storage capacity of 1000 units. The company has a transportation budget that allows for the distribution of at most 200 units. The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B. The company also wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\n\nPlease help the company to maximize the net profit, which is the total profit minus the total storage cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## Net profit of A: Net_Profit_A = (20 - 5) * A\n## Net profit of B: Net_Profit_B = (30 - 7) * B\n## Net profit of C: Net_Profit_C = (40 - 9) * C\n## Net profit of D: Net_Profit_D = (50 - 11) * D\n## So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\nNet_Profit_A = (20 - 5) * A\nNet_Profit_B = (30 - 7) * B\nNet_Profit_C = (40 - 9) * C\nNet_Profit_D = (50 - 11) * D\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n# Add constraints\n## The company has a total storage capacity of 1000 units.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 1000)\n## The company has a transportation budget that allows for the distribution of at most 200 units.\nmodel.addCons(A + B + C + D <= 200)\n## The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\nmodel.addCons(C <= A + B)\n## The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates.\n// {\"amount of diesel\": \"Diesel\", \"range\": \"Diesel >= 0\", \"type\": \"continuous\"}\n// {\"amount of gasoline\": \"Gasoline\", \"range\": \"Gasoline >= 0\", \"type\": \"continuous\"}\n// {\"amount of natural gas\": \"NaturalGas\", \"range\": \"NaturalGas >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of diesel is $3 per gallon, gasoline is $2.5 per gallon, and natural gas is $1.8 per gallon. The fuel-efficient technologies reduce the consumption rate of each fuel type by a certain percentage based on the investment. The company aims to minimize the total cost of fuel consumption while considering the investment in technologies.\n// Total cost of diesel: CostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\n// Total cost of gasoline: CostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\n// Total cost of natural gas: CostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n// So, the objective function is: Minimize (CostDiesel + CostGasoline + CostNaturalGas)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel purchases and technology investments.\n// 3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000",
        "question": "A logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates. The cost of diesel is $3 per gallon, gasoline is $2.5 per gallon, and natural gas is $1.8 per gallon. The fuel-efficient technologies reduce the consumption rate of each fuel type by a certain percentage based on the investment.\n\n| Fuel Type     | Cost per Gallon |\n|---------------|-----------------|\n| Diesel        | $3              |\n| Gasoline      | $2.5            |\n| Natural Gas   | $1.8            |\n\nThe company has a budget of $100,000 for fuel purchases and technology investments. The company aims to minimize the total cost of fuel consumption while considering the investment in technologies. Please help the company determine the optimal amounts of each fuel type and the investment in fuel-efficient technologies to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDiesel = model.addVar(vtype=\"CONTINUOUS\", name=\"Diesel\", lb=0)  # amount of diesel\nGasoline = model.addVar(vtype=\"CONTINUOUS\", name=\"Gasoline\", lb=0)  # amount of gasoline\nNaturalGas = model.addVar(vtype=\"CONTINUOUS\", name=\"NaturalGas\", lb=0)  # amount of natural gas\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in fuel-efficient technologies\n\n# Define objective function\nCostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\nCostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\nCostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostDiesel + CostGasoline + CostNaturalGas)\n\n# Add constraints\nmodel.addCons(3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Diesel: \", model.getVal(Diesel))\n    print(\"Amount of Gasoline: \", model.getVal(Gasoline))\n    print(\"Amount of Natural Gas: \", model.getVal(NaturalGas))\n    print(\"Investment in Tech: \", model.getVal(TechInvestment))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the operating cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the purchase cost is $50,000.\nFor TruckB, the operating cost per mile is $3, the fuel efficiency is 7 miles per gallon, and the purchase cost is $60,000.\nFor TruckC, the operating cost per mile is $4, the fuel efficiency is 6 miles per gallon, and the purchase cost is $70,000.\nFor TruckD, the operating cost per mile is $5, the fuel efficiency is 8 miles per gallon, and the purchase cost is $80,000.\nFor TruckE, the operating cost per mile is $6, the fuel efficiency is 10 miles per gallon, and the purchase cost is $90,000.\nThe company wants to minimize the total cost per mile, which includes both the operating and the depreciation cost (calculated as purchase cost divided by the expected lifetime mileage of 200,000 miles).\n// Total cost per mile for TruckA: Cost_TruckA = (2 + 50000 / 200000) * TruckA\n// Total cost per mile for TruckB: Cost_TruckB = (3 + 60000 / 200000) * TruckB\n// Total cost per mile for TruckC: Cost_TruckC = (4 + 70000 / 200000) * TruckC\n// Total cost per mile for TruckD: Cost_TruckD = (5 + 80000 / 200000) * TruckD\n// Total cost per mile for TruckE: Cost_TruckE = (6 + 90000 / 200000) * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 5000000\n\n## Generate Constraint-2:\nThe company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month.\n// 5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE >= 1000000\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes. The operating cost per mile, fuel efficiency, and purchase cost for each truck are given in the following Table.\n\n| Truck | Operating Cost per Mile | Fuel Efficiency | Purchase Cost |\n|-------|-------------------------|-----------------|---------------|\n| TruckA | $2                     | 5 miles/gallon  | $50,000       |\n| TruckB | $3                     | 7 miles/gallon  | $60,000       |\n| TruckC | $4                     | 6 miles/gallon  | $70,000       |\n| TruckD | $5                     | 8 miles/gallon  | $80,000       |\n| TruckE | $6                     | 10 miles/gallon | $90,000       |\n\nThe company has a budget of $5,000,000 for purchasing new trucks. The company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month. Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB. \n\nPlease help the company to minimize the total cost per mile, which includes both the operating and the depreciation cost (calculated as purchase cost divided by the expected lifetime mileage of 200,000 miles).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (2 + 50000 / 200000) * TruckA\nCost_TruckB = (3 + 60000 / 200000) * TruckB\nCost_TruckC = (4 + 70000 / 200000) * TruckC\nCost_TruckD = (5 + 80000 / 200000) * TruckD\nCost_TruckE = (6 + 90000 / 200000) * TruckE\nFleetEfficiency = 5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / FleetEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * FleetEfficiency == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing new trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 5000000)\n## The company needs to ensure that the total fleet capacity (in terms of fuel efficiency) is at least 1,000,000 miles per month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 6 * TruckC + 8 * TruckD + 10 * TruckE >= 1000000)\n## Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nmodel.addCons(TruckC <= TruckA + TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1300,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each device has at least some minimal production to meet market demands.\n// DeviceAProduction >= 100; DeviceBProduction >= 50; DeviceCProduction >= 200; DeviceDProduction >= 150; DeviceEProduction >= 75\n\n## Generate Constraint-5:\nThe production of DeviceC is limited by the availability of a specific component, which allows for a maximum of 1,500 units of DeviceC to be produced.\n// DeviceCProduction <= 1,500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost of Raw Materials per Unit |\n|--------|-----------------|--------------------------------|\n| DeviceA | $50             | $20                            |\n| DeviceB | $70             | $30                            |\n| DeviceC | $90             | $40                            |\n| DeviceD | $60             | $25                            |\n| DeviceE | $80             | $35                            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $500,000 for raw materials. The company wants to ensure that each device has at least some minimal production to meet market demands: DeviceAProduction >= 100, DeviceBProduction >= 50, DeviceCProduction >= 200, DeviceDProduction >= 150, DeviceEProduction >= 75. Additionally, the production of DeviceC is limited by the availability of a specific component, which allows for a maximum of 1,500 units of DeviceC to be produced.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Set lower bounds for production quantities\nmodel.addCons(DeviceAProduction >= 100)\nmodel.addCons(DeviceBProduction >= 50)\nmodel.addCons(DeviceCProduction >= 200)\nmodel.addCons(DeviceDProduction >= 150)\nmodel.addCons(DeviceEProduction >= 75)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\nmodel.addCons(DeviceCProduction <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1528,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision involves choosing the number of solar panels and wind turbines at each site.\n// {\"number of solar panels at site 1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 5\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation while maximizing the energy output. The cost function is nonlinear due to economies of scale and varying efficiency rates. The energy output is also nonlinear due to varying weather conditions and equipment efficiencies.\n// Total cost: Cost = (1000 * Solar1^0.8 + 2000 * Wind1^0.7) + (1000 * Solar2^0.8 + 2000 * Wind2^0.7) + (1000 * Solar3^0.8 + 2000 * Wind3^0.7) + (1000 * Solar4^0.8 + 2000 * Wind4^0.7) + (1000 * Solar5^0.8 + 2000 * Wind5^0.7)\n// Total energy output: Energy = (50 * Solar1 + 100 * Wind1) + (50 * Solar2 + 100 * Wind2) + (50 * Solar3 + 100 * Wind3) + (50 * Solar4 + 100 * Wind4) + (50 * Solar5 + 100 * Wind5)\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// (1000 * Solar1^0.8 + 2000 * Wind1^0.7) + (1000 * Solar2^0.8 + 2000 * Wind2^0.7) + (1000 * Solar3^0.8 + 2000 * Wind3^0.7) + (1000 * Solar4^0.8 + 2000 * Wind4^0.7) + (1000 * Solar5^0.8 + 2000 * Wind5^0.7) <= 500000\n\n## Generate Constraint-2:\nEach site must have at least one type of renewable energy source.\n// Solar1 + Wind1 >= 1\n// Solar2 + Wind2 >= 1\n// Solar3 + Wind3 >= 1\n// Solar4 + Wind4 >= 1\n// Solar5 + Wind5 >= 1",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision involves choosing the number of solar panels and wind turbines at each site. The company aims to minimize the total cost of installation and operation while maximizing the energy output. The cost function is nonlinear due to economies of scale and varying efficiency rates. The energy output is also nonlinear due to varying weather conditions and equipment efficiencies. The total budget for the project is $500,000. Each site must have at least one type of renewable energy source. Please help the company to minimize the total cost of installation and operation while maximizing the energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost and energy output\nCost = (1000 * Solar1**0.8 + 2000 * Wind1**0.7) + (1000 * Solar2**0.8 + 2000 * Wind2**0.7) + (1000 * Solar3**0.8 + 2000 * Wind3**0.7) + (1000 * Solar4**0.8 + 2000 * Wind4**0.7) + (1000 * Solar5**0.8 + 2000 * Wind5**0.7)\nEnergy = (50 * Solar1 + 100 * Wind1) + (50 * Solar2 + 100 * Wind2) + (50 * Solar3 + 100 * Wind3) + (50 * Solar4 + 100 * Wind4) + (50 * Solar5 + 100 * Wind5)\n\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(Cost <= 500000)\n\n## Each site must have at least one type of renewable energy source.\nmodel.addCons(Solar1 + Wind1 >= 1)\nmodel.addCons(Solar2 + Wind2 >= 1)\nmodel.addCons(Solar3 + Wind3 >= 1)\nmodel.addCons(Solar4 + Wind4 >= 1)\nmodel.addCons(Solar5 + Wind5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site 1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines at Site 1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels at Site 2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines at Site 2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels at Site 3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Site 3: \", model.getVal(Wind3))\n    print(\"Number of Solar Panels at Site 4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Site 4: \", model.getVal(Wind4))\n    print(\"Number of Solar Panels at Site 5: \", model.getVal(Solar5))\n    print(\"Number of Wind Turbines at Site 5: \", model.getVal(Wind5))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles (Small, Medium, and Large) across five different regions. The company needs to determine the number of vehicles of each type to allocate to each region to minimize fuel consumption and operational costs.\n// {\"number of Small vehicles in Region 1\": \"Small1\", \"range\": \"Small1 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 1\": \"Medium1\", \"range\": \"Medium1 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 1\": \"Large1\", \"range\": \"Large1 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 2\": \"Small2\", \"range\": \"Small2 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 2\": \"Medium2\", \"range\": \"Medium2 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 2\": \"Large2\", \"range\": \"Large2 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 3\": \"Small3\", \"range\": \"Small3 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 3\": \"Medium3\", \"range\": \"Medium3 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 3\": \"Large3\", \"range\": \"Large3 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 4\": \"Small4\", \"range\": \"Small4 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 4\": \"Medium4\", \"range\": \"Medium4 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 4\": \"Large4\", \"range\": \"Large4 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 5\": \"Small5\", \"range\": \"Small5 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 5\": \"Medium5\", \"range\": \"Medium5 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 5\": \"Large5\", \"range\": \"Large5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Small vehicles is 10 liters per 100 km, for Medium vehicles is 15 liters per 100 km, and for Large vehicles is 20 liters per 100 km. The operational cost per day for Small vehicles is $50, for Medium vehicles is $75, and for Large vehicles is $100. The company wants to minimize the total operational and fuel costs.\n// Fuel_Cost = 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5)\n// Operational_Cost = 50 * (Small1 + Small2 + Small3 + Small4 + Small5) + 75 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 100 * (Large1 + Large2 + Large3 + Large4 + Large5)\n// So, the objective function is: Minimize (Fuel_Cost + Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 vehicles available.\n// Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5 <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs per day.\n// 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5) <= 5000\n\n## Generate Constraint-3:\nEach region must have at least one type of vehicle.\n// Small1 + Medium1 + Large1 >= 1\n// Small2 + Medium2 + Large2 >= 1\n// Small3 + Medium3 + Large3 >= 1\n// Small4 + Medium4 + Large4 >= 1\n// Small5 + Medium5 + Large5 >= 1\n\n## Generate Constraint-4:\nThe total number of Large vehicles cannot exceed 30% of the total fleet.\n// Large1 + Large2 + Large3 + Large4 + Large5 <= 0.3 * (Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5)",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles (Small, Medium, and Large) across five different regions. The company needs to determine the number of vehicles of each type to allocate to each region to minimize fuel consumption and operational costs.\nThe fuel consumption for Small vehicles is 10 liters per 100 km, for Medium vehicles is 15 liters per 100 km, and for Large vehicles is 20 liters per 100 km. The operational cost per day for Small vehicles is $50, for Medium vehicles is $75, and for Large vehicles is $100. The company wants to minimize the total operational and fuel costs.\nThe company has a total of 100 vehicles available. The company has a budget of $5000 for fuel costs per day. Each region must have at least one type of vehicle. The total number of Large vehicles cannot exceed 30% of the total fleet.\nPlease help the company to minimize the total operational and fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall1 = model.addVar(vtype=\"INTEGER\", name=\"Small1\", lb=0)\nMedium1 = model.addVar(vtype=\"INTEGER\", name=\"Medium1\", lb=0)\nLarge1 = model.addVar(vtype=\"INTEGER\", name=\"Large1\", lb=0)\nSmall2 = model.addVar(vtype=\"INTEGER\", name=\"Small2\", lb=0)\nMedium2 = model.addVar(vtype=\"INTEGER\", name=\"Medium2\", lb=0)\nLarge2 = model.addVar(vtype=\"INTEGER\", name=\"Large2\", lb=0)\nSmall3 = model.addVar(vtype=\"INTEGER\", name=\"Small3\", lb=0)\nMedium3 = model.addVar(vtype=\"INTEGER\", name=\"Medium3\", lb=0)\nLarge3 = model.addVar(vtype=\"INTEGER\", name=\"Large3\", lb=0)\nSmall4 = model.addVar(vtype=\"INTEGER\", name=\"Small4\", lb=0)\nMedium4 = model.addVar(vtype=\"INTEGER\", name=\"Medium4\", lb=0)\nLarge4 = model.addVar(vtype=\"INTEGER\", name=\"Large4\", lb=0)\nSmall5 = model.addVar(vtype=\"INTEGER\", name=\"Small5\", lb=0)\nMedium5 = model.addVar(vtype=\"INTEGER\", name=\"Medium5\", lb=0)\nLarge5 = model.addVar(vtype=\"INTEGER\", name=\"Large5\", lb=0)\n\n# Define objective function\nFuel_Cost = 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5)\nOperational_Cost = 50 * (Small1 + Small2 + Small3 + Small4 + Small5) + 75 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 100 * (Large1 + Large2 + Large3 + Large4 + Large5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Operational_Cost)\n\n# Add constraints\nmodel.addCons(Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5 <= 100)\nmodel.addCons(10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5) <= 5000)\nmodel.addCons(Small1 + Medium1 + Large1 >= 1)\nmodel.addCons(Small2 + Medium2 + Large2 >= 1)\nmodel.addCons(Small3 + Medium3 + Large3 >= 1)\nmodel.addCons(Small4 + Medium4 + Large4 >= 1)\nmodel.addCons(Small5 + Medium5 + Large5 >= 1)\nmodel.addCons(Large1 + Large2 + Large3 + Large4 + Large5 <= 0.3 * (Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles in Region 1: \", model.getVal(Small1))\n    print(\"Number of Medium vehicles in Region 1: \", model.getVal(Medium1))\n    print(\"Number of Large vehicles in Region 1: \", model.getVal(Large1))\n    print(\"Number of Small vehicles in Region 2: \", model.getVal(Small2))\n    print(\"Number of Medium vehicles in Region 2: \", model.getVal(Medium2))\n    print(\"Number of Large vehicles in Region 2: \", model.getVal(Large2))\n    print(\"Number of Small vehicles in Region 3: \", model.getVal(Small3))\n    print(\"Number of Medium vehicles in Region 3: \", model.getVal(Medium3))\n    print(\"Number of Large vehicles in Region 3: \", model.getVal(Large3))\n    print(\"Number of Small vehicles in Region 4: \", model.getVal(Small4))\n    print(\"Number of Medium vehicles in Region 4: \", model.getVal(Medium4))\n    print(\"Number of Large vehicles in Region 4: \", model.getVal(Large4))\n    print(\"Number of Small vehicles in Region 5: \", model.getVal(Small5))\n    print(\"Number of Medium vehicles in Region 5: \", model.getVal(Medium5))\n    print(\"Number of Large vehicles in Region 5: \", model.getVal(Large5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost.\n// The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n// Minimize (0.05 * T1^2 + 0.07 * T2^2 + 0.06 * T3^2 + 0.08 * T4^2 + 0.04 * T5^2 + 0.09 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse. The transportation cost per truck varies depending on the warehouse location and the distance to the delivery points, and is given by the following nonlinear cost functions:\n\n| Warehouse | Cost Function          |\n|-----------|------------------------|\n| 1         | 0.05 * T1^2           |\n| 2         | 0.07 * T2^2           |\n| 3         | 0.06 * T3^2           |\n| 4         | 0.08 * T4^2           |\n| 5         | 0.04 * T5^2           |\n| 6         | 0.09 * T6^2           |\n\nThe company aims to minimize the total transportation cost. The company has a total of 100 trucks available. Please help the company determine the optimal number of trucks to allocate to each warehouse to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks at warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_1 = 0.05 * T1**2\nCost_2 = 0.07 * T2**2\nCost_3 = 0.06 * T3**2\nCost_4 = 0.08 * T4**2\nCost_5 = 0.04 * T5**2\nCost_6 = 0.09 * T6**2\n## the objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\nmodel.addCons(obj == Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles (Small, Medium, and Large) across five different regions. The company needs to determine the number of vehicles of each type to allocate to each region to minimize fuel consumption and operational costs.\n// {\"number of Small vehicles in Region 1\": \"Small1\", \"range\": \"Small1 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 1\": \"Medium1\", \"range\": \"Medium1 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 1\": \"Large1\", \"range\": \"Large1 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 2\": \"Small2\", \"range\": \"Small2 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 2\": \"Medium2\", \"range\": \"Medium2 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 2\": \"Large2\", \"range\": \"Large2 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 3\": \"Small3\", \"range\": \"Small3 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 3\": \"Medium3\", \"range\": \"Medium3 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 3\": \"Large3\", \"range\": \"Large3 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 4\": \"Small4\", \"range\": \"Small4 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 4\": \"Medium4\", \"range\": \"Medium4 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 4\": \"Large4\", \"range\": \"Large4 >= 0\", \"type\": \"integer\"}\n// {\"number of Small vehicles in Region 5\": \"Small5\", \"range\": \"Small5 >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles in Region 5\": \"Medium5\", \"range\": \"Medium5 >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles in Region 5\": \"Large5\", \"range\": \"Large5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Small vehicles is 10 liters per 100 km, for Medium vehicles is 15 liters per 100 km, and for Large vehicles is 20 liters per 100 km. The operational cost per day for Small vehicles is $50, for Medium vehicles is $75, and for Large vehicles is $100. The company wants to minimize the total operational and fuel costs.\n// Fuel_Cost = 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5)\n// Operational_Cost = 50 * (Small1 + Small2 + Small3 + Small4 + Small5) + 75 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 100 * (Large1 + Large2 + Large3 + Large4 + Large5)\n// So, the objective function is: Minimize (Fuel_Cost + Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 vehicles available.\n// Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5 <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs per day.\n// 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5) <= 5000\n\n## Generate Constraint-3:\nEach region must have at least one type of vehicle.\n// Small1 + Medium1 + Large1 >= 1\n// Small2 + Medium2 + Large2 >= 1\n// Small3 + Medium3 + Large3 >= 1\n// Small4 + Medium4 + Large4 >= 1\n// Small5 + Medium5 + Large5 >= 1",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles (Small, Medium, and Large) across five different regions. The company needs to determine the number of vehicles of each type to allocate to each region to minimize fuel consumption and operational costs. The fuel consumption and operational costs for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Consumption (liters/100 km) | Operational Cost per Day |\n|--------------|----------------------------------|--------------------------|\n| Small        | 10                               | $50                      |\n| Medium       | 15                               | $75                      |\n| Large        | 20                               | $100                     |\n\nThe company has a total of 100 vehicles available. The company has a budget of $5000 for fuel costs per day. Each region must have at least one type of vehicle. Please help the company to minimize the total operational and fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall1 = model.addVar(vtype=\"INTEGER\", name=\"Small1\", lb=0)\nMedium1 = model.addVar(vtype=\"INTEGER\", name=\"Medium1\", lb=0)\nLarge1 = model.addVar(vtype=\"INTEGER\", name=\"Large1\", lb=0)\nSmall2 = model.addVar(vtype=\"INTEGER\", name=\"Small2\", lb=0)\nMedium2 = model.addVar(vtype=\"INTEGER\", name=\"Medium2\", lb=0)\nLarge2 = model.addVar(vtype=\"INTEGER\", name=\"Large2\", lb=0)\nSmall3 = model.addVar(vtype=\"INTEGER\", name=\"Small3\", lb=0)\nMedium3 = model.addVar(vtype=\"INTEGER\", name=\"Medium3\", lb=0)\nLarge3 = model.addVar(vtype=\"INTEGER\", name=\"Large3\", lb=0)\nSmall4 = model.addVar(vtype=\"INTEGER\", name=\"Small4\", lb=0)\nMedium4 = model.addVar(vtype=\"INTEGER\", name=\"Medium4\", lb=0)\nLarge4 = model.addVar(vtype=\"INTEGER\", name=\"Large4\", lb=0)\nSmall5 = model.addVar(vtype=\"INTEGER\", name=\"Small5\", lb=0)\nMedium5 = model.addVar(vtype=\"INTEGER\", name=\"Medium5\", lb=0)\nLarge5 = model.addVar(vtype=\"INTEGER\", name=\"Large5\", lb=0)\n\n# Define objective function\nFuel_Cost = 10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5)\nOperational_Cost = 50 * (Small1 + Small2 + Small3 + Small4 + Small5) + 75 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 100 * (Large1 + Large2 + Large3 + Large4 + Large5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Operational_Cost)\n\n# Add constraints\nmodel.addCons(Small1 + Medium1 + Large1 + Small2 + Medium2 + Large2 + Small3 + Medium3 + Large3 + Small4 + Medium4 + Large4 + Small5 + Medium5 + Large5 <= 100)\nmodel.addCons(10 * (Small1 + Small2 + Small3 + Small4 + Small5) + 15 * (Medium1 + Medium2 + Medium3 + Medium4 + Medium5) + 20 * (Large1 + Large2 + Large3 + Large4 + Large5) <= 5000)\nmodel.addCons(Small1 + Medium1 + Large1 >= 1)\nmodel.addCons(Small2 + Medium2 + Large2 >= 1)\nmodel.addCons(Small3 + Medium3 + Large3 >= 1)\nmodel.addCons(Small4 + Medium4 + Large4 >= 1)\nmodel.addCons(Small5 + Medium5 + Large5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles in Region 1: \", model.getVal(Small1))\n    print(\"Number of Medium vehicles in Region 1: \", model.getVal(Medium1))\n    print(\"Number of Large vehicles in Region 1: \", model.getVal(Large1))\n    print(\"Number of Small vehicles in Region 2: \", model.getVal(Small2))\n    print(\"Number of Medium vehicles in Region 2: \", model.getVal(Medium2))\n    print(\"Number of Large vehicles in Region 2: \", model.getVal(Large2))\n    print(\"Number of Small vehicles in Region 3: \", model.getVal(Small3))\n    print(\"Number of Medium vehicles in Region 3: \", model.getVal(Medium3))\n    print(\"Number of Large vehicles in Region 3: \", model.getVal(Large3))\n    print(\"Number of Small vehicles in Region 4: \", model.getVal(Small4))\n    print(\"Number of Medium vehicles in Region 4: \", model.getVal(Medium4))\n    print(\"Number of Large vehicles in Region 4: \", model.getVal(Large4))\n    print(\"Number of Small vehicles in Region 5: \", model.getVal(Small5))\n    print(\"Number of Medium vehicles in Region 5: \", model.getVal(Medium5))\n    print(\"Number of Large vehicles in Region 5: \", model.getVal(Large5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 15,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency profile. \nOn route 1, each truck incurs a cost of $1000 per day and delivers 500 units of goods. \nOn route 2, each truck incurs a cost of $1200 per day and delivers 600 units of goods. \nOn route 3, each truck incurs a cost of $1100 per day and delivers 550 units of goods. \nOn route 4, each truck incurs a cost of $900 per day and delivers 450 units of goods. \nOn route 5, each truck incurs a cost of $1300 per day and delivers 650 units of goods. \nThe company aims to maximize the total delivery of goods while minimizing the total cost. The objective is to find the optimal allocation of trucks that maximizes the total delivery units minus the total cost.\n// TotalCost = 1000 * T1 + 1200 * T2 + 1100 * T3 + 900 * T4 + 1300 * T5\n// TotalDelivery = 500 * T1 + 600 * T2 + 550 * T3 + 450 * T4 + 650 * T5\n// So, the objective function is: Maximize TotalDelivery - TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck per day and the number of units delivered per truck per day for each route are given in the following Table.\n\n| Route | Cost per Truck per Day | Units Delivered per Truck per Day |\n|-------|------------------------|----------------------------------|\n| 1     | $1000                  | 500                              |\n| 2     | $1200                  | 600                              |\n| 3     | $1100                  | 550                              |\n| 4     | $900                   | 450                              |\n| 5     | $1300                  | 650                              |\n\nThe company aims to maximize the total delivery of goods while minimizing the total cost. The objective is to find the optimal allocation of trucks that maximizes the total delivery units minus the total cost. The company has a total of 100 trucks available for allocation.\n\nPlease help the company determine the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nTotalCost = 1000 * T1 + 1200 * T2 + 1100 * T3 + 900 * T4 + 1300 * T5\nTotalDelivery = 500 * T1 + 600 * T2 + 550 * T3 + 450 * T4 + 650 * T5\n# So, the objective function is: Maximize TotalDelivery - TotalCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalDelivery - TotalCost)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Maximized Total Delivery - Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries across different cities. The company must decide the number of trucks to deploy for each city, the amount of fuel to allocate per truck, and the investment in fuel-efficient technologies for each type of truck.\n// {\"number of trucks for City1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for City2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation per truck for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation per truck for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for City1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for City2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks is improved by investing in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption decreases by 5 liters per 100 km for City1 and 7 liters per 100 km for City2. The company aims to minimize the total fuel consumption across all trucks.\n// Fuel consumption for City1: Consumption1 = (100 - 0.05 * Tech1) * Trucks1 * Fuel1\n// Fuel consumption for City2: Consumption2 = (100 - 0.07 * Tech2) * Trucks2 * Fuel2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and technology investments.\n// Fuel1 * Trucks1 + Fuel2 * Trucks2 + Tech1 + Tech2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is limited to 50.\n// Trucks1 + Trucks2 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries across different cities. The company must decide the number of trucks to deploy for each city, the amount of fuel to allocate per truck, and the investment in fuel-efficient technologies for each type of truck. The fuel efficiency of the trucks is improved by investing in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption decreases by 5 liters per 100 km for City1 and 7 liters per 100 km for City2. The company aims to minimize the total fuel consumption across all trucks. The company has a budget of $100,000 for fuel and technology investments. The total number of trucks available for deployment is limited to 50. Please help the company to determine the optimal number of trucks, fuel allocation, and investment in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for City1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for City2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel allocation per truck for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel allocation per truck for City2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technologies for City1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technologies for City2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = (100 - 0.05 * Tech1) * Trucks1 * Fuel1\nConsumption2 = (100 - 0.07 * Tech2) * Trucks2 * Fuel2\n## the objective function is: Minimize (Consumption1 + Consumption2)\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and technology investments.\nmodel.addCons(Fuel1 * Trucks1 + Fuel2 * Trucks2 + Tech1 + Tech2 <= 100000)\n## The total number of trucks available for deployment is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for City2: \", model.getVal(Trucks2))\n    print(\"Fuel Allocation per Truck for City1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation per Truck for City2: \", model.getVal(Fuel2))\n    print(\"Investment in Tech for City1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for City2: \", model.getVal(Tech2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times. The company needs to determine the optimal speed for each truck to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck and the number of trips each truck makes.\n// {\"speed of Truck 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 100\", \"type\": \"continuous\"}\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The faster the truck, the more fuel it consumes, but the fewer trips it needs to make to cover the same distance. The company aims to minimize the total fuel consumption across all trucks.\n// Fuel consumption for Truck 1: Fuel1 = (0.005 * Speed1^2) * Trips1\n// Fuel consumption for Truck 2: Fuel2 = (0.005 * Speed2^2) * Trips2\n// Fuel consumption for Truck 3: Fuel3 = (0.005 * Speed3^2) * Trips3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nEach truck must complete at least 50 trips per week.\n// Trips1 >= 50; Trips2 >= 50; Trips3 >= 50",
        "question": "A logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times. The company needs to determine the optimal speed for each truck to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck and the number of trips each truck makes. The fuel consumption of each truck is modeled by a quadratic function of its speed, where the faster the truck, the more fuel it consumes, but the fewer trips it needs to make to cover the same distance. The company aims to minimize the total fuel consumption across all trucks.\n\n| Truck | Speed Range | Number of Trips |\n|-------|-------------|-----------------|\n| 1     | 0 < Speed1 <= 100 | Trips1 >= 0 |\n| 2     | 0 < Speed2 <= 100 | Trips2 >= 0 |\n| 3     | 0 < Speed3 <= 100 | Trips3 >= 0 |\n\nEach truck must complete at least 50 trips per week. Please help the company determine the optimal speeds and number of trips for each truck to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each truck must complete at least 50 trips per week.\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100) # speed of Truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100) # speed of Truck 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100) # speed of Truck 3\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50) # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=50) # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=50) # number of trips for Truck 3\n\n# Define objective function\n## Fuel consumption for Truck 1: Fuel1 = (0.005 * Speed1^2) * Trips1\n## Fuel consumption for Truck 2: Fuel2 = (0.005 * Speed2^2) * Trips2\n## Fuel consumption for Truck 3: Fuel3 = (0.005 * Speed3^2) * Trips3\n## So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nFuel1 = (0.005 * Speed1**2) * Trips1\nFuel2 = (0.005 * Speed2**2) * Trips2\nFuel3 = (0.005 * Speed3**2) * Trips3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## No additional constraints are provided in the scenario\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Speed of Truck 3: \", model.getVal(Speed3))\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * Q1 = 20 * Q1\n// Profit_P2 = (40 - 20) * Q2 = 20 * Q2\n// Profit_P3 = (50 - 30) * Q3 = 20 * Q3\n// The objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units.\n// Q1 <= 100\n// Q2 <= 150\n// Q3 <= 200\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\n// Q1 >= 50\n// Q2 >= 75",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company has a limited budget of $5000 for production costs. The production capacity for each product is limited. The maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units. The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=75) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * Q1\nProfit_P2 = 20 * Q2\nProfit_P3 = 20 * Q3\n## the objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000)\n## The production capacity for each product is limited.\nmodel.addCons(Q1 <= 100)\nmodel.addCons(Q2 <= 150)\nmodel.addCons(Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 710,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. The company wants to minimize the total cost of purchasing trucks and fuel expenses per year, given that each truck travels an average of 50,000 miles per year.\n// Cost_SmallTrucks = 30000 * SmallTrucks\n// Cost_MediumTrucks = 50000 * MediumTrucks\n// Cost_LargeTrucks = 80000 * LargeTrucks\n// Fuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\n// Fuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\n// Fuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n// So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary. The cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. Each truck travels an average of 50,000 miles per year. The company has a total budget of $1,000,000 for purchasing trucks and a total of 100 drivers available.\n\nPlease help the company to minimize the total cost of purchasing trucks and fuel expenses per year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nCost_SmallTrucks = 30000 * SmallTrucks\nCost_MediumTrucks = 50000 * MediumTrucks\nCost_LargeTrucks = 80000 * LargeTrucks\nFuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\nFuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\nFuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n# Add constraints\nmodel.addCons(30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000)\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Number of Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Number of Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"FuelEff_A\", \"range\": \"FuelEff_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"FuelEff_B\", \"range\": \"FuelEff_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"FuelEff_C\", \"range\": \"FuelEff_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// FuelConsumption_A = Trucks_A / FuelEff_A\n// FuelConsumption_B = Trucks_B / FuelEff_B\n// FuelConsumption_C = Trucks_C / FuelEff_C\n// Profit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\n// Profit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\n// Profit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type. The company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency. The company has a total of 50 trucks available.\n\nPlease help the company to minimize the total fuel consumption and maximize the profit from each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nFuelEff_A = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_A\", lb=0)  # fuel efficiency of trucks for Route A\nFuelEff_B = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_B\", lb=0)  # fuel efficiency of trucks for Route B\nFuelEff_C = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_C\", lb=0)  # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_profit = model.addVar('obj_profit')\nobj_fuel = model.addVar('obj_fuel')\nmodel.setObjective(obj_profit, \"maximize\")\nmodel.setObjective(obj_fuel, \"minimize\")\n\n## convert the division to multiplication\nFuelConsumption_A = Trucks_A * (1 / FuelEff_A)\nFuelConsumption_B = Trucks_B * (1 / FuelEff_B)\nFuelConsumption_C = Trucks_C * (1 / FuelEff_C)\nProfit_A = 1000 * Trucks_A * (1 - 0.01 * FuelConsumption_A)\nProfit_B = 1500 * Trucks_B * (1 - 0.01 * FuelConsumption_B)\nProfit_C = 2000 * Trucks_C * (1 - 0.01 * FuelConsumption_C)\n\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_profit == Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_fuel == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(FuelEff_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(FuelEff_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(FuelEff_C))\n    print(\"Maximized Profit: \", model.getVal(obj_profit))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_fuel))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 672,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods across different distances. The company needs to determine the number of trips each vehicle should make to optimize fuel efficiency and minimize carbon emissions. Additionally, the company is considering investing in hybrid technology for each vehicle type, which affects fuel consumption and emissions.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Truck1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Truck2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Truck3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for Truck1, fuel consumption decreases by 0.1 liters per kilometer. For Truck2, it decreases by 0.15 liters per kilometer, and for Truck3, it decreases by 0.2 liters per kilometer. The company aims to minimize total fuel consumption and carbon emissions, which are proportional to fuel consumption.\n// Fuel_Consumption_Truck1 = (Initial_Consumption - 0.0001 * Hybrid1) * Distance * Trips1\n// Fuel_Consumption_Truck2 = (Initial_Consumption - 0.00015 * Hybrid2) * Distance * Trips2\n// Fuel_Consumption_Truck3 = (Initial_Consumption - 0.0002 * Hybrid3) * Distance * Trips3\n// Total_Fuel_Consumption = Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3\n// So, the objective function is: Minimize Total_Fuel_Consumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for hybrid technology investments.\n// Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods across different distances. The company needs to determine the number of trips each vehicle should make and the investment in hybrid technology for each vehicle type to optimize fuel efficiency and minimize carbon emissions. The relationship between investment in hybrid technology and fuel consumption reduction for each vehicle is given in the following Table.\n\n| Vehicle | Fuel Consumption Reduction per $1000 Investment |\n|---------|------------------------------------------------|\n| Truck1  | 0.1 liters per kilometer                        |\n| Truck2  | 0.15 liters per kilometer                       |\n| Truck3  | 0.2 liters per kilometer                        |\n\nThe company has a budget of $100,000 for hybrid technology investments. The total number of trips across all vehicles must not exceed 500. The company aims to minimize total fuel consumption and carbon emissions, which are proportional to fuel consumption.\n\nPlease help the company to determine the optimal number of trips for each vehicle and the investment in hybrid technology to achieve the minimum total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for Truck1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for Truck2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for Truck3\n\n# Define objective function\nFuel_Consumption_Truck1 = (model.addVar(name=\"Initial_Consumption\") - 0.0001 * Hybrid1) * model.addVar(name=\"Distance\") * Trips1\nFuel_Consumption_Truck2 = (model.addVar(name=\"Initial_Consumption\") - 0.00015 * Hybrid2) * model.addVar(name=\"Distance\") * Trips2\nFuel_Consumption_Truck3 = (model.addVar(name=\"Initial_Consumption\") - 0.0002 * Hybrid3) * model.addVar(name=\"Distance\") * Trips3\nTotal_Fuel_Consumption = Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption)\n\n# Add constraints\nmodel.addCons(Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Hybrid Technology for Truck1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Truck2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Truck3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the cost per kilometer is $2, the fuel efficiency is 5 km/liter, and the maintenance cost is $1000 per quarter.\nFor Truck B, the cost per kilometer is $3, the fuel efficiency is 4 km/liter, and the maintenance cost is $1500 per quarter.\nFor Truck C, the cost per kilometer is $4, the fuel efficiency is 3 km/liter, and the maintenance cost is $2000 per quarter.\nFor Van D, the cost per kilometer is $1.5, the fuel efficiency is 6 km/liter, and the maintenance cost is $800 per quarter.\nFor Van E, the cost per kilometer is $1, the fuel efficiency is 7 km/liter, and the maintenance cost is $500 per quarter.\nThe company wants to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies.\n// Total cost for Truck A: Cost_A = 2 * (5 * TruckA) + 1000\n// Total cost for Truck B: Cost_B = 3 * (4 * TruckB) + 1500\n// Total cost for Truck C: Cost_C = 4 * (3 * TruckC) + 2000\n// Total cost for Van D: Cost_D = 1.5 * (6 * VanD) + 800\n// Total cost for Van E: Cost_E = 1 * (7 * VanE) + 500\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter.\n// 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes. The cost per kilometer, fuel efficiency, and maintenance cost for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Kilometer | Fuel Efficiency (km/liter) | Maintenance Cost per Quarter |\n|---------|--------------------|----------------------------|------------------------------|\n| Truck A | $2                 | 5                          | $1000                        |\n| Truck B | $3                 | 4                          | $1500                        |\n| Truck C | $4                 | 3                          | $2000                        |\n| Van D   | $1.5               | 6                          | $800                         |\n| Van E   | $1                 | 7                          | $500                         |\n\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter. The company wants to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies. Please help the company determine the optimal number of each type of vehicle to include in their fleet for the next quarter.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0)\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * (5 * TruckA) + 1000\nCost_B = 3 * (4 * TruckB) + 1500\nCost_C = 4 * (3 * TruckC) + 2000\nCost_D = 1.5 * (6 * VanD) + 800\nCost_E = 1 * (7 * VanE) + 500\nFuelEfficiency = 5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / FuelEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * FuelEfficiency == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle maintenance for the next quarter.\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Van E: \", model.getVal(VanE))\n    print(\"Minimized Total Cost Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1380,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system\": \"FleetManagement\", \"range\": \"FleetManagement >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in the fleet management system, reducing the operational cost per truck. The operational cost per truck for GoodsX is $2000, for GoodsY is $2500, for GoodsZ is $3000, and for GoodsW is $3500. The fleet management system reduces these costs by $50 for every $1000 invested. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for GoodsX: CostX = (2000 - 0.05 * FleetManagement) * TrucksX\n// Operational cost for GoodsY: CostY = (2500 - 0.05 * FleetManagement) * TrucksY\n// Operational cost for GoodsZ: CostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\n// Operational cost for GoodsW: CostW = (3500 - 0.05 * FleetManagement) * TrucksW\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nDue to contractual obligations, GoodsX must be transported by at least 10 trucks and GoodsY by at least 15 trucks.\n// TrucksX >= 10; TrucksY >= 15",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks.\nThe fuel efficiency of the trucks improves with the investment in the fleet management system, reducing the operational cost per truck. The operational cost per truck for GoodsX is $2000, for GoodsY is $2500, for GoodsZ is $3000, and for GoodsW is $3500. The fleet management system reduces these costs by $50 for every $1000 invested. The company aims to minimize the total operational cost of all trucks.\nThe company has a total of 50 trucks available for allocation. Due to contractual obligations, GoodsX must be transported by at least 10 trucks and GoodsY by at least 15 trucks.\nPlease help the company to determine the optimal number of trucks for each type of goods and the investment in the fleet management system to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=10) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=15) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=0) # number of trucks for GoodsW\nFleetManagement = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetManagement\", lb=0) # investment in fleet management system\n\n# Define objective function\nCostX = (2000 - 0.05 * FleetManagement) * TrucksX\nCostY = (2500 - 0.05 * FleetManagement) * TrucksY\nCostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\nCostW = (3500 - 0.05 * FleetManagement) * TrucksW\n# So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Fleet Management System: \", model.getVal(FleetManagement))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphones = 100 * Smartphones\n// Profit_Tablets = 150 * Tablets\n// Profit_Laptops = 200 * Laptops\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. The production time for Smartphones is 2 hours per unit, for Tablets is 3 hours per unit, and for Laptops is 4 hours per unit.\n// 2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for Smartphones is at least 20 units per week, for Tablets is at least 15 units per week, and for Laptops is at least 10 units per week.\n// Smartphones >= 20\n// Tablets >= 15\n// Laptops >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint of $5000 per week for raw materials. The cost of raw materials for Smartphones is $50 per unit, for Tablets is $70 per unit, and for Laptops is $90 per unit.\n// 50 * Smartphones + 70 * Tablets + 90 * Laptops <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of Laptops does not exceed the combined production of Smartphones and Tablets.\n// Laptops <= Smartphones + Tablets",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company has a limited production capacity of 1000 hours per week. The production time for Smartphones is 2 hours per unit, for Tablets is 3 hours per unit, and for Laptops is 4 hours per unit. The market demand for Smartphones is at least 20 units per week, for Tablets is at least 15 units per week, and for Laptops is at least 10 units per week. The company has a budget constraint of $5000 per week for raw materials. The cost of raw materials for Smartphones is $50 per unit, for Tablets is $70 per unit, and for Laptops is $90 per unit. The company wants to ensure that the production of Laptops does not exceed the combined production of Smartphones and Tablets.\nPlease help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\n\n# Define objective function\nProfit_Smartphones = 100 * Smartphones\nProfit_Tablets = 150 * Tablets\nProfit_Laptops = 200 * Laptops\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# Constraint-1: Production capacity\nmodel.addCons(2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000)\n# Constraint-2: Market demand\nmodel.addCons(Smartphones >= 20)\nmodel.addCons(Tablets >= 15)\nmodel.addCons(Laptops >= 10)\n# Constraint-3: Budget for raw materials\nmodel.addCons(50 * Smartphones + 70 * Tablets + 90 * Laptops <= 5000)\n# Constraint-4: Laptop production limit\nmodel.addCons(Laptops <= Smartphones + Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery efficiency is measured by the total delivery time per route, which is affected by the number of trucks and the congestion level of each route. The congestion level increases nonlinearly with the number of trucks on the same route. The company aims to minimize the total delivery time across all routes.\n// Delivery_time_1 = C1 * (T1^2) / (T1 + 1)\n// Delivery_time_2 = C2 * (T2^2) / (T2 + 1)\n// Delivery_time_3 = C3 * (T3^2) / (T3 + 1)\n// Delivery_time_4 = C4 * (T4^2) / (T4 + 1)\n// Delivery_time_5 = C5 * (T5^2) / (T5 + 1)\n// Where C1, C2, C3, C4, C5 are constants representing the congestion levels of routes 1 to 5 respectively.\n// So, the objective function is: Minimize (Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks.\n// T1 <= 15; T2 <= 15; T3 <= 15; T4 <= 15; T5 <= 15",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. The delivery efficiency is measured by the total delivery time per route, which is affected by the number of trucks and the congestion level of each route. The congestion level increases nonlinearly with the number of trucks on the same route. The company aims to minimize the total delivery time across all routes. The delivery time for each route is calculated as a function of the number of trucks and a constant representing the congestion level of the route.\n\nThe company has a total of 50 trucks available and each route can handle a maximum of 15 trucks. Please help the company to minimize the total delivery time across all routes.\n\n| Route | Congestion Level (Constant) | Maximum Trucks |\n|-------|------------------------------|----------------|\n| 1     | C1                           | 15             |\n| 2     | C2                           | 15             |\n| 3     | C3                           | 15             |\n| 4     | C4                           | 15             |\n| 5     | C5                           | 15             |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=15) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=15) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=15) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=15) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=15) # number of trucks on route 5\n\n# Define objective function\n# Set constants for congestion levels\nC1, C2, C3, C4, C5 = 1.0, 1.2, 1.3, 1.1, 1.4\n\n# Calculate delivery times\nDelivery_time_1 = C1 * (T1**2) / (T1 + 1)\nDelivery_time_2 = C2 * (T2**2) / (T2 + 1)\nDelivery_time_3 = C3 * (T3**2) / (T3 + 1)\nDelivery_time_4 = C4 * (T4**2) / (T4 + 1)\nDelivery_time_5 = C5 * (T5**2) / (T5 + 1)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# Objective function: Minimize (Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\nmodel.addCons(obj == Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Truck1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Truck2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Truck3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip for Truck1 is $200, but with upgrades, it decreases by $2 for every $100 invested in efficiency. \nThe operational cost per trip for Truck2 is $250, and with upgrades, it decreases by $2.5 for every $100 invested in efficiency. \nThe operational cost per trip for Truck3 is $300, and with upgrades, it decreases by $3 for every $100 invested in efficiency. \nThe company aims to minimize the total operational cost for all trucks.\n// Total operational cost for Truck1: Cost1 = (200 - 0.02 * Efficiency1) * Trips1\n// Total operational cost for Truck2: Cost2 = (250 - 0.025 * Efficiency2) * Trips2\n// Total operational cost for Truck3: Cost3 = (300 - 0.03 * Efficiency3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for operational costs and efficiency investments.\n// (200 * Trips1 + 250 * Trips2 + 300 * Trips3) + Efficiency1 + Efficiency2 + Efficiency3 <= 30000\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to decide the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs. The fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip for Truck1 is $200, but with upgrades, it decreases by $2 for every $100 invested in efficiency. The operational cost per trip for Truck2 is $250, and with upgrades, it decreases by $2.5 for every $100 invested in efficiency. The operational cost per trip for Truck3 is $300, and with upgrades, it decreases by $3 for every $100 invested in efficiency. The company aims to minimize the total operational cost for all trucks. The company has a total budget of $30,000 for operational costs and efficiency investments. The total number of trips across all trucks must not exceed 500. Please help the company to determine the optimal number of trips and the investment in fuel efficiency for each truck to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # investment in fuel efficiency for Truck1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # investment in fuel efficiency for Truck2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0) # investment in fuel efficiency for Truck3\n\n# Define objective function\nCost1 = (200 - 0.02 * Efficiency1) * Trips1\nCost2 = (250 - 0.025 * Efficiency2) * Trips2\nCost3 = (300 - 0.03 * Efficiency3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $30,000 for operational costs and efficiency investments.\nmodel.addCons((200 * Trips1 + 250 * Trips2 + 300 * Trips3) + Efficiency1 + Efficiency2 + Efficiency3 <= 30000)\n# The total number of trips across all trucks must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Efficiency for Truck1: \", model.getVal(Efficiency1))\n    print(\"Investment in Efficiency for Truck2: \", model.getVal(Efficiency2))\n    print(\"Investment in Efficiency for Truck3: \", model.getVal(Efficiency3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the material cost is $20, and the production time is 1 hour.\nFor Device B, the selling price is $70, the material cost is $30, and the production time is 2 hours.\nFor Device C, the selling price is $90, the material cost is $40, and the production time is 3 hours.\nFor Device D, the selling price is $110, the material cost is $50, and the production time is 4 hours.\nThe manufacturer aims to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $15,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 15000\n\n## Generate Constraint-2:\nThe manufacturer wants to produce at least 50 units of each device for the next quarter.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Material Cost | Production Time |\n|--------|---------------|---------------|-----------------|\n| A      | 50$           | 20$           | 1 hour          |\n| B      | 70$           | 30$           | 2 hours         |\n| C      | 90$           | 40$           | 3 hours         |\n| D      | 110$          | 50$           | 4 hours         |\n\nThe manufacturer has a budget of $15,000 for material costs for the next quarter. The manufacturer wants to produce at least 50 units of each device for the next quarter. Please help the manufacturer to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The manufacturer has a budget of $15,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The company needs to minimize the total operational cost of the fleet.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the daily demand of 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation. The operational cost per kilometer for each type of truck is given in the following Table.\n\n| Truck Type | Operational Cost per Kilometer |\n|------------|--------------------------------|\n| Type 1     | $2                             |\n| Type 2     | $3                             |\n| Type 3     | $4                             |\n| Type 4     | $5                             |\n| Type 5     | $6                             |\n\nThe total capacity of all trucks must meet the daily demand of 1000 tons. The company has a budget to purchase at most 50 trucks in total. Please help the company to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nmodel.addCons(obj == 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5)\n\n# Add constraints\n## The total capacity of all trucks must meet the daily demand of 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of hours each product is processed on a specific machine, and the amount of investment in enhancing the machine's efficiency. The efficiency enhancement directly reduces the processing time per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"processing hours per unit of ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"continuous\"}\n// {\"processing hours per unit of ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"continuous\"}\n// {\"processing hours per unit of ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe processing time per unit of each product decreases by 1 hour for every $5,000 invested in enhancing the machine's efficiency for that product. The initial processing time for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced processing time due to efficiency enhancements.\n// Total revenue for ProductA: RevenueA = (100 - 5 + 0.0002 * EfficiencyA) * QuantityA\n// Total revenue for ProductB: RevenueB = (120 - 6 + 0.0002 * EfficiencyB) * QuantityB\n// Total revenue for ProductC: RevenueC = (150 - 7 + 0.0002 * EfficiencyC) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total processing hours available on the machine for all products cannot exceed 1000 hours.\n// (5 - 0.0002 * EfficiencyA) * QuantityA + (6 - 0.0002 * EfficiencyB) * QuantityB + (7 - 0.0002 * EfficiencyC) * QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in machine efficiency enhancements cannot exceed $30,000.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 30000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units.\n// QuantityA >= 50; QuantityB >= 70\n\n## Generate Constraint-4:\nThe company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements.\n// HoursA >= 3; HoursB >= 3; HoursC >= 3\n// This translates to: 5 - 0.0002 * EfficiencyA >= 3; 6 - 0.0002 * EfficiencyB >= 3; 7 - 0.0002 * EfficiencyC >= 3",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of hours each product is processed on a specific machine, and the amount of investment in enhancing the machine's efficiency. The efficiency enhancement directly reduces the processing time per unit of product. The processing time per unit of each product decreases by 1 hour for every $5,000 invested in enhancing the machine's efficiency for that product. The initial processing time for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced processing time due to efficiency enhancements. The total processing hours available on the machine for all products cannot exceed 1000 hours. The total investment in machine efficiency enhancements cannot exceed $30,000. Due to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units. The company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements. Please help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=70)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)    # production quantity of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)      # processing hours per unit of ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)      # processing hours per unit of ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)      # processing hours per unit of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in machine efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in machine efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in machine efficiency for ProductC\n\n# Define objective function\nRevenueA = (100 - 5 + 0.0002 * EfficiencyA) * QuantityA\nRevenueB = (120 - 6 + 0.0002 * EfficiencyB) * QuantityB\nRevenueC = (150 - 7 + 0.0002 * EfficiencyC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The total processing hours available on the machine for all products cannot exceed 1000 hours.\nmodel.addCons((5 - 0.0002 * EfficiencyA) * QuantityA + (6 - 0.0002 * EfficiencyB) * QuantityB + (7 - 0.0002 * EfficiencyC) * QuantityC <= 1000)\n# The total investment in machine efficiency enhancements cannot exceed $30,000.\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 30000)\n# Due to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units.\nmodel.addCons(QuantityA >= 50)\nmodel.addCons(QuantityB >= 70)\n# The company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements.\nmodel.addCons(5 - 0.0002 * EfficiencyA >= 3)\nmodel.addCons(6 - 0.0002 * EfficiencyB >= 3)\nmodel.addCons(7 - 0.0002 * EfficiencyC >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1374,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product, which will reduce the labor hours required per unit of product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit of ProductA is 2 hours, ProductB is 3 hours, and ProductC is 4 hours. Investing $10,000 in automation reduces the labor hours per unit by 1 hour for that product. The company aims to maximize the total profit while considering the efficiency of resource use.\n// ProfitA = 100 * ProductA - AutomationA * 10000 / 10000\n// ProfitB = 150 * ProductB - AutomationB * 10000 / 10000\n// ProfitC = 200 * ProductC - AutomationC * 10000 / 10000\n// LaborEfficiencyA = (2 - AutomationA / 10000) * ProductA\n// LaborEfficiencyB = (3 - AutomationB / 10000) * ProductB\n// LaborEfficiencyC = (4 - AutomationC / 10000) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC) / (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// (2 - AutomationA / 10000) * ProductA + (3 - AutomationB / 10000) * ProductB + (4 - AutomationC / 10000) * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $100,000.\n// AutomationA + AutomationB + AutomationC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the amount of resources (labor and materials) allocated to each product, and the investment in automation technology for each product. The profit per unit and the labor hours required per unit for each product, along with the effect of automation on labor hours, are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Effect of $10,000 Automation Investment |\n|---------|-----------------|----------------------|-----------------------------------------|\n| ProductA | $100            | 2 hours              | Reduces labor hours by 1 hour           |\n| ProductB | $150            | 3 hours              | Reduces labor hours by 1 hour           |\n| ProductC | $200            | 4 hours              | Reduces labor hours by 1 hour           |\n\nThe company has a total of 1000 labor hours available for the month. The total investment in automation cannot exceed $100,000. The company aims to maximize the total profit while considering the efficiency of resource use. Please help the company determine the optimal production quantities, resource allocations, and automation investments to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = 100 * ProductA - AutomationA * 10000 / 10000\nProfitB = 150 * ProductB - AutomationB * 10000 / 10000\nProfitC = 200 * ProductC - AutomationC * 10000 / 10000\nLaborEfficiencyA = (2 - AutomationA / 10000) * ProductA\nLaborEfficiencyB = (3 - AutomationB / 10000) * ProductB\nLaborEfficiencyC = (4 - AutomationC / 10000) * ProductC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC) / (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC)\n# convert the division to multiplication\nmodel.addCons(obj * (LaborEfficiencyA + LaborEfficiencyB + LaborEfficiencyC) == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total of 1000 labor hours available for the month.\nmodel.addCons((2 - AutomationA / 10000) * ProductA + (3 - AutomationB / 10000) * ProductB + (4 - AutomationC / 10000) * ProductC <= 1000)\n# The total investment in automation cannot exceed $100,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\n// E <= 0.2 * (A + B + C + D + E)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed.\n// A + B <= 0.5 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. Each vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company has a budget of $100,000 for operational costs for the upcoming month and must transport at least 50,000 units of goods. The company has a limit on the number of vehicles it can deploy, specifically, it can deploy at most 50 vehicles in total. The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed and that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed. \n\nPlease help the company to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n## The company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n## The company wants to ensure that the number of Truck A and Truck B combined does not exceed 50% of the total number of vehicles deployed.\nmodel.addCons(A + B <= 0.5 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1453,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region (North, South, East, West, and Central) to optimize their operations.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Net Profit = (200 * NorthTrucks + 220 * SouthTrucks + 230 * EastTrucks + 210 * WestTrucks + 190 * CentralTrucks) - (100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks)\n// So, the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 trucks are allocated to each region.\n// NorthTrucks >= 10; SouthTrucks >= 10; EastTrucks >= 10; WestTrucks >= 10; CentralTrucks >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\n// 100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost. The company has a total of 50 trucks available for allocation. The company wants to ensure that at least 10 trucks are allocated to each region. The company also has a budget constraint on the total operating cost, which should not exceed $5000 per day. Please help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 10 trucks are allocated to each region.\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=10) # number of trucks in North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=10) # number of trucks in South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=10) # number of trucks in East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=10) # number of trucks in West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=10) # number of trucks in Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\nmodel.addCons(obj == 100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n## The company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\nmodel.addCons(100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: TruckA, TruckB, TruckC, and TruckD. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the number of drivers to hire, which affects the operational costs and efficiency.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profitability of each truck type is influenced by its fuel efficiency, maintenance costs, and cargo capacity. TruckA has a profit per trip of $1000, TruckB $1500, TruckC $2000, and TruckD $2500. The operational cost per driver is $500 per month. The company aims to maximize the total monthly profit from all trucks minus the cost of drivers.\n// Total profit from TruckA: ProfitA = 1000 * TruckA\n// Total profit from TruckB: ProfitB = 1500 * TruckB\n// Total profit from TruckC: ProfitC = 2000 * TruckC\n// Total profit from TruckD: ProfitD = 2500 * TruckD\n// Total cost of drivers: DriverCost = 500 * Drivers\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks. The cost of TruckA is $20,000, TruckB is $30,000, TruckC is $40,000, and TruckD is $50,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC + 50000 * TruckD <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 5 due to limited parking space.\n// TruckA + TruckB + TruckC + TruckD <= 5\n\n## Generate Constraint-3:\nThe number of drivers must be at least equal to the total number of trucks to ensure full operational capacity.\n// Drivers >= TruckA + TruckB + TruckC + TruckD",
        "question": "A logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: TruckA, TruckB, TruckC, and TruckD. Each type of truck has different profitability per trip, which is influenced by its fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the number of drivers to hire, which affects the operational costs and efficiency. The profitability per trip and the cost of each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Cost |\n|------------|-----------------|------|\n| TruckA     | $1000           | $20,000 |\n| TruckB     | $1500           | $30,000 |\n| TruckC     | $2000           | $40,000 |\n| TruckD     | $2500           | $50,000 |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total number of trucks cannot exceed 5 due to limited parking space. The number of drivers must be at least equal to the total number of trucks to ensure full operational capacity. The operational cost per driver is $500 per month.\n\nPlease help the company to maximize the total monthly profit from all trucks minus the cost of drivers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of TruckD\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)  # number of drivers\n\n# Define objective function\nProfitA = 1000 * TruckA\nProfitB = 1500 * TruckB\nProfitC = 2000 * TruckC\nProfitD = 2500 * TruckD\nDriverCost = 500 * Drivers\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC + 50000 * TruckD <= 100000)\n# The total number of trucks cannot exceed 5 due to limited parking space.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 5)\n# The number of drivers must be at least equal to the total number of trucks to ensure full operational capacity.\nmodel.addCons(Drivers >= TruckA + TruckB + TruckC + TruckD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n// Total profit from Small trucks: ProfitSmall = 50000 * SmallTrucks\n// Total profit from Medium trucks: ProfitMedium = 75000 * MediumTrucks\n// Total profit from Large trucks: ProfitLarge = 100000 * LargeTrucks\n// Total profit from Extra-Large trucks: ProfitExtraLarge = 125000 * ExtraLargeTrucks\n// Operational cost: OperationalCost = 50000 * Drivers\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large, each with different profit contributions based on their cargo capacity and operational efficiency. The company also needs to decide on the number of drivers to hire, which affects the operational costs. The details of each truck type and the operational cost per driver are given in the following Table.\n\n| Truck Type        | Profit per Truck |\n|-------------------|------------------|\n| Small             | $50,000          |\n| Medium            | $75,000          |\n| Large             | $100,000         |\n| Extra-Large       | $125,000         |\n| Drivers (Operational Cost) | $50,000 per driver |\n\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n\nPlease help the company determine the optimal number of each type of truck and the number of drivers to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)  # number of drivers\n\n# Define objective function\nProfitSmall = 50000 * SmallTrucks\nProfitMedium = 75000 * MediumTrucks\nProfitLarge = 100000 * LargeTrucks\nProfitExtraLarge = 125000 * ExtraLargeTrucks\nOperationalCost = 50000 * Drivers\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, storage limitations, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"storage space required for product A\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"real\"}\n// {\"storage space required for product B\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"real\"}\n// {\"storage space required for product C\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling all three products.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, storage limitations, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling all three products. The total production capacity of the company is 100 units per day.\nPlease help the company determine the optimal number of units to produce for each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 584,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output while considering the cost and efficiency of each type.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8.\nThe energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9.\nThe energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0.\nThe manufacturer wants to maximize the total energy output per dollar spent.\n// Energy_S1 = 100 * S1 * 0.8\n// Energy_S2 = 120 * S2 * 0.9\n// Energy_S3 = 140 * S3 * 1.0\n// Cost_S1 = 50 * S1\n// Cost_S2 = 60 * S2\n// Cost_S3 = 70 * S3\n// So, the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * S1 + 60 * S2 + 70 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 200 units in total.\n// S1 + S2 + S3 <= 200\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of S2 to fulfill a contract.\n// S2 >= 30",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output while considering the cost and efficiency of each type. The energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8. The energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9. The energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0. The manufacturer wants to maximize the total energy output per dollar spent. The manufacturer has a budget of $10,000 for production costs. The manufacturer has a limited production capacity of 200 units in total. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1. The manufacturer must produce at least 30 units of S2 to fulfill a contract. Please help the manufacturer to determine the optimal production quantities of each type of solar panel to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=30, ub=200) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0, ub=200) # quantity of S3\n\n# Define objective function\nEnergy_S1 = 100 * S1 * 0.8\nEnergy_S2 = 120 * S2 * 0.9\nEnergy_S3 = 140 * S3 * 1.0\nCost_S1 = 50 * S1\nCost_S2 = 60 * S2\nCost_S3 = 70 * S3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n# convert the division to multiplication\nmodel.addCons(obj * (Cost_S1 + Cost_S2 + Cost_S3) == Energy_S1 + Energy_S2 + Energy_S3)\n\n# Add constraints\nmodel.addCons(50 * S1 + 60 * S2 + 70 * S3 <= 10000) # budget constraint\nmodel.addCons(S1 + S2 + S3 <= 200) # production capacity constraint\nmodel.addCons(S1 <= 50) # market demand constraint for S1\nmodel.addCons(S2 >= 30) # contract requirement for S2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"SP1\", \"range\": \"SP1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"WT1\", \"range\": \"WT1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"SP2\", \"range\": \"SP2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"WT2\", \"range\": \"WT2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"SP3\", \"range\": \"SP3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"WT3\", \"range\": \"WT3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"SP4\", \"range\": \"SP4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"WT4\", \"range\": \"WT4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"SP5\", \"range\": \"SP5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"WT5\", \"range\": \"WT5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation. The energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations.\n// Total cost: Cost = 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2)\n// Total energy output: Energy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n// So, the objective function is: Minimize (Cost / Energy)\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all locations must not exceed 1000.\n// SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function and energy output are nonlinear due to economies of scale in production and installation, and varying efficiencies of solar panels and wind turbines at different locations.\n\nThe company has a total budget of $500,000 for the project. The total number of solar panels and wind turbines across all locations must not exceed 1000.\n\nPlease help the company to minimize the ratio of the total cost to the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP1 = model.addVar(vtype=\"INTEGER\", name=\"SP1\", lb=0) # number of solar panels at location 1\nWT1 = model.addVar(vtype=\"INTEGER\", name=\"WT1\", lb=0) # number of wind turbines at location 1\nSP2 = model.addVar(vtype=\"INTEGER\", name=\"SP2\", lb=0) # number of solar panels at location 2\nWT2 = model.addVar(vtype=\"INTEGER\", name=\"WT2\", lb=0) # number of wind turbines at location 2\nSP3 = model.addVar(vtype=\"INTEGER\", name=\"SP3\", lb=0) # number of solar panels at location 3\nWT3 = model.addVar(vtype=\"INTEGER\", name=\"WT3\", lb=0) # number of wind turbines at location 3\nSP4 = model.addVar(vtype=\"INTEGER\", name=\"SP4\", lb=0) # number of solar panels at location 4\nWT4 = model.addVar(vtype=\"INTEGER\", name=\"WT4\", lb=0) # number of wind turbines at location 4\nSP5 = model.addVar(vtype=\"INTEGER\", name=\"SP5\", lb=0) # number of solar panels at location 5\nWT5 = model.addVar(vtype=\"INTEGER\", name=\"WT5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (SP1**2 + WT1**2 + SP2**2 + WT2**2 + SP3**2 + WT3**2 + SP4**2 + WT4**2 + SP5**2 + WT5**2)\nEnergy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n## the objective function is: Minimize (Cost / Energy)\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(1000 * (SP1**2 + WT1**2 + SP2**2 + WT2**2 + SP3**2 + WT3**2 + SP4**2 + WT4**2 + SP5**2 + WT5**2) <= 500000)\n## The total number of solar panels and wind turbines across all locations must not exceed 1000.\nmodel.addCons(SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(SP1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(WT1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(SP2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(WT2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(SP3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(WT3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(SP4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(WT4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(SP5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(WT5))\n    print(\"Minimized Cost to Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs.\n// {\"number of containers for air transport\": \"AirContainers\", \"range\": \"AirContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for sea transport\": \"SeaContainers\", \"range\": \"SeaContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for rail transport\": \"RailContainers\", \"range\": \"RailContainers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting a container via air is $500, via sea is $200, and via rail is $300. The efficiency of transportation is measured by the time taken to deliver goods, with air taking 1 day, sea taking 5 days, and rail taking 3 days. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n// Total cost: Cost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\n// Average delivery time: Time = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n// So, the objective function is: Minimize (Cost + Time)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for transportation costs.\n// 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10,000\n\n## Generate Constraint-2:\nThe total number of containers that can be transported is limited to 50.\n// AirContainers + SeaContainers + RailContainers <= 50\n\n## Generate Constraint-3:\nDue to safety regulations, the number of containers transported by air must not exceed 10.\n// AirContainers <= 10",
        "question": "A logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs. The cost and delivery time for each mode of transportation are given in the following Table.\n\n| Mode        | Cost per Container | Delivery Time |\n|-------------|--------------------|---------------|\n| Air         | $500               | 1 day         |\n| Sea         | $200               | 5 days        |\n| Rail        | $300               | 3 days        |\n\nThe company has a budget of $10,000 for transportation costs. The total number of containers that can be transported is limited to 50. Due to safety regulations, the number of containers transported by air must not exceed 10. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n\nPlease help the company to minimize the total cost and average delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAirContainers = model.addVar(vtype=\"INTEGER\", name=\"AirContainers\", lb=0, ub=10)  # number of containers for air transport\nSeaContainers = model.addVar(vtype=\"INTEGER\", name=\"SeaContainers\", lb=0)  # number of containers for sea transport\nRailContainers = model.addVar(vtype=\"INTEGER\", name=\"RailContainers\", lb=0)  # number of containers for rail transport\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\nTime = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n## convert the division to multiplication\nmodel.addCons(obj * (AirContainers + SeaContainers + RailContainers) == Cost * (AirContainers + SeaContainers + RailContainers) + Time)\n\n# Add constraints\n## The company has a budget of $10,000 for transportation costs.\nmodel.addCons(500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10000)\n## The total number of containers that can be transported is limited to 50.\nmodel.addCons(AirContainers + SeaContainers + RailContainers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Containers: \", model.getVal(AirContainers))\n    print(\"Number of Sea Containers: \", model.getVal(SeaContainers))\n    print(\"Number of Rail Containers: \", model.getVal(RailContainers))\n    print(\"Minimized Cost + Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The regions are categorized into three types: Urban, Suburban, and Rural. The company also needs to consider the fuel efficiency of trucks in different regions, which varies due to traffic conditions and road types.\n// {\"number of trucks for Urban\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Urban\": \"UrbanTripsPerTruck\", \"range\": \"UrbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Suburban\": \"SuburbanTripsPerTruck\", \"range\": \"SuburbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Rural\": \"RuralTripsPerTruck\", \"range\": \"RuralTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency for Urban trucks is 5 km/liter, for Suburban trucks is 8 km/liter, and for Rural trucks is 10 km/liter. The average distance per trip in Urban is 20 km, in Suburban is 40 km, and in Rural is 60 km. The company aims to minimize the total daily fuel cost.\n// FuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\n// FuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\n// FuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n// So, the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $1000 for fuel costs.\n// (20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000\n\n## Generate Constraint-3:\nThe company has a daily operational limit of 1000 trips across all regions.\n// UrbanTrucks * UrbanTripsPerTruck + SuburbanTrucks * SuburbanTripsPerTruck + RuralTrucks * RuralTripsPerTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions categorized into Urban, Suburban, and Rural. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The fuel efficiency of trucks varies by region: 5 km/liter for Urban, 8 km/liter for Suburban, and 10 km/liter for Rural. The average distance per trip is 20 km for Urban, 40 km for Suburban, and 60 km for Rural. The cost of fuel per liter is $1.5.\n\n| Region     | Fuel Efficiency (km/liter) | Average Distance per Trip (km) |\n|------------|---------------------------|--------------------------------|\n| Urban      | 5                         | 20                             |\n| Suburban   | 8                         | 40                             |\n| Rural      | 10                        | 60                             |\n\nThe company has a total of 50 trucks available. The company has a daily budget of $1000 for fuel costs. The company also has a daily operational limit of 1000 trips across all regions.\n\nPlease help the company to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)\nUrbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"UrbanTripsPerTruck\", lb=0)\nSuburbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTripsPerTruck\", lb=0)\nRuralTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RuralTripsPerTruck\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\nFuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\nFuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n## the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\nmodel.addCons(obj == FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50)\n## The company has a daily budget of $1000 for fuel costs.\nmodel.addCons((20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000)\n## The company has a daily operational limit of 1000 trips across all regions.\nmodel.addCons(UrbanTrucks * UrbanTripsPerTruck + SuburbanTrucks * SuburbanTripsPerTruck + RuralTrucks * RuralTripsPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Urban Trucks: \", model.getVal(UrbanTrucks))\n    print(\"Number of Suburban Trucks: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Rural Trucks: \", model.getVal(RuralTrucks))\n    print(\"Number of Urban Trips per Truck: \", model.getVal(UrbanTripsPerTruck))\n    print(\"Number of Suburban Trips per Truck: \", model.getVal(SuburbanTripsPerTruck))\n    print(\"Number of Rural Trips per Truck: \", model.getVal(RuralTripsPerTruck))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\n// {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes.\nThe fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nThe total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 50.\n// \u03a3(Trucks_j) <= 50 for all j\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 80 km/h.\n// Speed_i <= 80 for all i\n\n## Generate Constraint-3:\nDue to safety regulations, the minimum speed of any truck must be at least 40 km/h.\n// Speed_i >= 40 for all i\n\n## Generate Constraint-4:\nThe budget for fuel additives is limited to $10,000.\n// \u03a3(Additive_j * Cost_per_Unit_Additive) <= 10000 for all j\n\n## Generate Constraint-5:\nThe demand for goods on Route k requires at least 5 trucks.\n// Trucks_k >= 5 for specific k",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency. The fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes. The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\n\nThe company has the following constraints:\n1. The total number of trucks available is limited to 50.\n2. The maximum speed limit for any truck is 80 km/h.\n3. Due to safety regulations, the minimum speed of any truck must be at least 40 km/h.\n4. The budget for fuel additives is limited to $10,000.\n5. The demand for goods on Route k requires at least 5 trucks.\n\nPlease help the company to minimize the total fuel cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\nSpeed_i = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_i\", lb=0, ub=100)\n## {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\nTrucks_j = model.addVar(vtype=\"INTEGER\", name=\"Trucks_j\", lb=0)\n## {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\nAdditive_j = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive_j\", lb=0)\n\n# Define objective function\n## The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nFuel_Consumption_i = (Speed_i**2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i\n## The total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n## So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_i)\n\n# Add constraints\n## The total number of trucks available is limited to 50.\nmodel.addCons(Trucks_j <= 50)\n## The maximum speed limit for any truck is 80 km/h.\nmodel.addCons(Speed_i <= 80)\n## Due to safety regulations, the minimum speed of any truck must be at least 40 km/h.\nmodel.addCons(Speed_i >= 40)\n## The budget for fuel additives is limited to $10,000.\nmodel.addCons(Additive_j <= 10000)\n## The demand for goods on Route k requires at least 5 trucks.\nmodel.addCons(Trucks_j >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck i: \", model.getVal(Speed_i))\n    print(\"Number of Trucks on Route j: \", model.getVal(Trucks_j))\n    print(\"Amount of Fuel Additive for Route j: \", model.getVal(Additive_j))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost function is given by: Cost = a * (FuelBudget)^(-b) + c, and a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions. The total fuel budget across all regions must not exceed $100,000. Please help the company determine the optimal number of trucks and fuel budgets for each region to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0)\nFuelBudgetNorth = model.addVar(name=\"FuelBudgetNorth\", lb=0)\nFuelBudgetSouth = model.addVar(name=\"FuelBudgetSouth\", lb=0)\nFuelBudgetEast = model.addVar(name=\"FuelBudgetEast\", lb=0)\nFuelBudgetWest = model.addVar(name=\"FuelBudgetWest\", lb=0)\nFuelBudgetCentral = model.addVar(name=\"FuelBudgetCentral\", lb=0)\n\n# Define objective function\n# Set constants for the fuel cost function\na_North, b_North, c_North = 100, 0.5, 5\na_South, b_South, c_South = 120, 0.4, 6\na_East, b_East, c_East = 110, 0.6, 7\na_West, b_West, c_West = 90, 0.7, 8\na_Central, b_Central, c_Central = 80, 0.8, 9\n\n# Calculate fuel costs\nFuelCostNorth = a_North * (FuelBudgetNorth**(-b_North)) + c_North\nFuelCostSouth = a_South * (FuelBudgetSouth**(-b_South)) + c_South\nFuelCostEast = a_East * (FuelBudgetEast**(-b_East)) + c_East\nFuelCostWest = a_West * (FuelBudgetWest**(-b_West)) + c_West\nFuelCostCentral = a_Central * (FuelBudgetCentral**(-b_Central)) + c_Central\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Add constraints\n# The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget in North: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget in South: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget in East: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget in West: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget in Central: \", model.getVal(FuelBudgetCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit.\n// Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n// Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n// Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n// Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n// Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints. The profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit. The company has a total production capacity of 1000 units across all components. Please help the company determine the optimal number of units to produce for each component to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## Total net profit for each component\nProfit_A = 50 * A - (2000 + 10 * A**2)\nProfit_B = 70 * B - (3000 + 15 * B**2)\nProfit_C = 90 * C - (4000 + 20 * C**2)\nProfit_D = 110 * D - (5000 + 25 * D**2)\nProfit_E = 130 * E - (6000 + 30 * E**2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. \n- Truck A consumes 5 liters per km and carries 10 tons.\n- Truck B consumes 7 liters per km and carries 15 tons.\n- Truck C consumes 9 liters per km and carries 20 tons.\n- Truck D consumes 11 liters per km and carries 25 tons.\n- Truck E consumes 13 liters per km and carries 30 tons.\nThe company aims to maximize the total cargo carried per liter of fuel consumed.\n// Fuel efficiency of A: FE_A = 10 / 5 = 2 tons/liter\n// Fuel efficiency of B: FE_B = 15 / 7 = 2.14 tons/liter\n// Fuel efficiency of C: FE_C = 20 / 9 = 2.22 tons/liter\n// Fuel efficiency of D: FE_D = 25 / 11 = 2.27 tons/liter\n// Fuel efficiency of E: FE_E = 30 / 13 = 2.31 tons/liter\n// Objective function: Maximize (FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel for the month. The cost of fuel is $1 per liter.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 100,000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. Each truck type has different fuel efficiency and cargo capacity:\n- Truck A consumes 5 liters per km and carries 10 tons.\n- Truck B consumes 7 liters per km and carries 15 tons.\n- Truck C consumes 9 liters per km and carries 20 tons.\n- Truck D consumes 11 liters per km and carries 25 tons.\n- Truck E consumes 13 liters per km and carries 30 tons.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The company has a budget of $100,000 for fuel for the month, with the cost of fuel being $1 per liter. The company also has a total of 100 trucks available.\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks E\n\n# Define objective function\nFE_A = 2  # Fuel efficiency of A\nFE_B = 2.14  # Fuel efficiency of B\nFE_C = 2.22  # Fuel efficiency of C\nFE_D = 2.27  # Fuel efficiency of D\nFE_E = 2.31  # Fuel efficiency of E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# Objective function: Maximize (FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\nmodel.addCons(obj == FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel for the month. The cost of fuel is $1 per liter.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 100000)\n# The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Number of Trucks D: \", model.getVal(D))\n    print(\"Number of Trucks E: \", model.getVal(E))\n    print(\"Maximized Cargo per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities (City1, City2, City3, City4, City5) and the fuel efficiency of each truck, which can be improved with an investment in fuel-efficient technologies.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for each truck\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. The fuel efficiency of the trucks can be improved with an investment, reducing the fuel cost per trip. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company aims to maximize the total profit from all trips.\n// Profit per trip to City1: Profit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\n// Profit per trip to City2: Profit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\n// Profit per trip to City3: Profit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\n// Profit per trip to City4: Profit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\n// Profit per trip to City5: Profit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency investments.\n// EfficiencyInvestment <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities: City1, City2, City3, City4, and City5. The company needs to determine the number of trips each truck should make to these cities and the investment in fuel efficiency for each truck. The base profit per trip and the impact of fuel efficiency on the profit are given in the following Table.\n\n| City | Base Profit per Trip | Impact of Fuel Efficiency Investment |\n|------|----------------------|--------------------------------------|\n| City1 | $100                | $10 decrease per $1000 investment   |\n| City2 | $150                | $10 decrease per $1000 investment   |\n| City3 | $200                | $10 decrease per $1000 investment   |\n| City4 | $250                | $10 decrease per $1000 investment   |\n| City5 | $300                | $10 decrease per $1000 investment   |\n\nThe company has a budget of $10,000 for fuel efficiency investments. The company aims to maximize the total profit from all trips. Please help the company determine the optimal number of trips to each city and the investment in fuel efficiency to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in fuel efficiency for each truck\n\n# Define objective function\nProfit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\nProfit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\nProfit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\nProfit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\nProfit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n// Fuel cost = (total distance / fuel efficiency) * fuel price\n// Maintenance cost = number of trucks * maintenance cost per truck\n// Objective function: Minimize (Fuel cost + Maintenance cost)\n\n## Generate Constraint-1:\nThe total budget for purchasing new trucks is $500,000.\n// 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes. Each type of truck has different fuel efficiency and maintenance costs:\n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered. The total budget for purchasing new trucks is $500,000.\nPlease help the company determine the optimal number of each type of truck to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Truck1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Truck2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Truck3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of Truck4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel and maintenance costs\nfuel_cost_Truck1 = (5000 / 5) * Truck1  # Assuming total distance is 5000 km\nfuel_cost_Truck2 = (5000 / 10) * Truck2\nfuel_cost_Truck3 = (5000 / 15) * Truck3\nfuel_cost_Truck4 = (5000 / 20) * Truck4\nfuel_cost_Truck5 = (5000 / 25) * Truck5\n\nmaintenance_cost_Truck1 = 10000 * Truck1\nmaintenance_cost_Truck2 = 15000 * Truck2\nmaintenance_cost_Truck3 = 20000 * Truck3\nmaintenance_cost_Truck4 = 25000 * Truck4\nmaintenance_cost_Truck5 = 30000 * Truck5\n\n## Objective function: Minimize (Fuel cost + Maintenance cost)\nmodel.addCons(obj == fuel_cost_Truck1 + fuel_cost_Truck2 + fuel_cost_Truck3 + fuel_cost_Truck4 + fuel_cost_Truck5 +\n              maintenance_cost_Truck1 + maintenance_cost_Truck2 + maintenance_cost_Truck3 + maintenance_cost_Truck4 + maintenance_cost_Truck5)\n\n# Add constraints\n## The total budget for purchasing new trucks is $500,000.\nmodel.addCons(10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Truck4: \", model.getVal(Truck4))\n    print(\"Number of Truck5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The company aims to maximize its total revenue from all products.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe market share of each product increases by 1% for every $10,000 spent on marketing for that product. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The company aims to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production.\n// Total revenue for ProductA: RevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\n// Total revenue for ProductB: RevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\n// Total revenue for ProductC: RevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-3:\nDue to market saturation, the price of each product cannot exceed $200.\n// PriceA <= 200; PriceB <= 200; PriceC <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The company aims to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production. The company has a total production capacity of 10,000 units across all products. The total marketing budget cannot exceed $100,000. Due to market saturation, the price of each product cannot exceed $200. Please help the company to maximize its total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0) # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nRevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\nRevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\nRevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# The total marketing budget cannot exceed $100,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)\n# Due to market saturation, the price of each product cannot exceed $200.\nmodel.addCons(PriceA <= 200)\nmodel.addCons(PriceB <= 200)\nmodel.addCons(PriceC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(UnitsA))\n    print(\"Number of ProductB Units: \", model.getVal(UnitsB))\n    print(\"Number of ProductC Units: \", model.getVal(UnitsC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\n// Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\n// Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units per month.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceAUnits <= 2 * DeviceBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for the month. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, and for DeviceD is $40.\n// 20 * DeviceAUnits + 30 * DeviceBUnits + 25 * DeviceCUnits + 40 * DeviceDUnits <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each device are produced to meet minimum market demand.\n// DeviceAUnits >= 50; DeviceBUnits >= 50; DeviceCUnits >= 50; DeviceDUnits >= 50",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company has a production capacity of 1000 units per month. The production of DeviceA must not exceed twice the production of DeviceB. The company has a budget of $50,000 for production costs for the month, with costs per unit for DeviceA at $20, DeviceB at $30, DeviceC at $25, and DeviceD at $40. The company wants to ensure that at least 50 units of each device are produced to meet minimum market demand. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=50)\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=50)\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=50)\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=50)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2 + 50 * DeviceA1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2 + 70 * DeviceB1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=150)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=150, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (60 - 0.08 * (DeviceC2 - 150)) * DeviceC2 * DeviceC_b2 + 60 * DeviceC1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\nDeviceD1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD1\", lb=0, ub=250)\nDeviceD2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD2\", lb=250, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceDUnits == DeviceD1*DeviceD_b1 + DeviceD2*DeviceD_b2)\nProfit_DeviceD = (80 - 0.12 * (DeviceD2 - 250)) * DeviceD2 * DeviceD_b2 + 80 * DeviceD1 * DeviceD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000)\nmodel.addCons(DeviceAUnits <= 2 * DeviceBUnits)\nmodel.addCons(20 * DeviceAUnits + 30 * DeviceBUnits + 25 * DeviceCUnits + 40 * DeviceDUnits <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAWorkers\", \"range\": \"ProductAWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBWorkers\", \"range\": \"ProductBWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCWorkers\", \"range\": \"ProductCWorkers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company wants to maximize the total daily profit.\n// Profit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\n// Profit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\n// Profit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost for each worker is $300 per day. The company has a total of 50 workers available and aims to maximize the total daily profit. The production capacity for each product is limited: ProductA can produce at most 100 units, ProductB at most 150 units, and ProductC at most 120 units. Please help the company optimize its production strategy to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nProductAWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductAWorkers\", lb=0)  # number of workers for ProductA\nProductBWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductBWorkers\", lb=0)  # number of workers for ProductB\nProductCWorkers = model.addVar(vtype=\"INTEGER\", name=\"ProductCWorkers\", lb=0)  # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - ProductAWorkers * 300\nProfit_ProductB = ProductBQty * 70 - ProductBWorkers * 300\nProfit_ProductC = ProductCQty * 60 - ProductCWorkers * 300\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAWorkers + ProductBWorkers + ProductCWorkers <= 50)\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAWorkers))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBWorkers))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCWorkers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 684,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device to optimize its profit. Additionally, the company must decide on the number of quality control checks to perform for each device type.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceA\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceB\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceC\": \"QC_C\", \"range\": \"QC_C >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceD\": \"QC_D\", \"range\": \"QC_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\nThe company aims to maximize the total profit per unit of production, considering both the production and quality control costs.\n// Profit of DeviceA: Profit_A = (100 - 60) * A - 5 * QC_A\n// Profit of DeviceB: Profit_B = (150 - 90) * B - 7 * QC_B\n// Profit of DeviceC: Profit_C = (200 - 120) * C - 9 * QC_C\n// Profit of DeviceD: Profit_D = (250 - 150) * D - 11 * QC_D\n// So, the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / (A + B + C + D))\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for quality control checks.\n// 5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10,000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 100 units of each device.\n// A <= 100; B <= 100; C <= 100; D <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is checked for quality.\n// QC_A >= 0.1 * A; QC_B >= 0.1 * B; QC_C >= 0.1 * C; QC_D >= 0.1 * D",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device and the number of quality control checks to perform for each device type to optimize its profit.\n\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\n\nThe company has a total budget of $10,000 for quality control checks. The company can produce a maximum of 100 units of each device. The company wants to ensure that at least 10% of each device's production is checked for quality.\n\nPlease help the company to maximize the total profit per unit of production, considering both the production and quality control costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of DeviceD\nQC_A = model.addVar(vtype=\"INTEGER\", name=\"QC_A\", lb=0) # number of quality control checks for DeviceA\nQC_B = model.addVar(vtype=\"INTEGER\", name=\"QC_B\", lb=0) # number of quality control checks for DeviceB\nQC_C = model.addVar(vtype=\"INTEGER\", name=\"QC_C\", lb=0) # number of quality control checks for DeviceC\nQC_D = model.addVar(vtype=\"INTEGER\", name=\"QC_D\", lb=0) # number of quality control checks for DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * QC_A\nProfit_B = (150 - 90) * B - 7 * QC_B\nProfit_C = (200 - 120) * C - 9 * QC_C\nProfit_D = (250 - 150) * D - 11 * QC_D\nTotalProduction = A + B + C + D\n## the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / TotalProduction)\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for quality control checks.\nmodel.addCons(5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10000)\n## The company wants to ensure that at least 10% of each device's production is checked for quality.\nmodel.addCons(QC_A >= 0.1 * A)\nmodel.addCons(QC_B >= 0.1 * B)\nmodel.addCons(QC_C >= 0.1 * C)\nmodel.addCons(QC_D >= 0.1 * D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of QC checks for DeviceA: \", model.getVal(QC_A))\n    print(\"Number of QC checks for DeviceB: \", model.getVal(QC_B))\n    print(\"Number of QC checks for DeviceC: \", model.getVal(QC_C))\n    print(\"Number of QC checks for DeviceD: \", model.getVal(QC_D))\n    print(\"Maximized Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe storage facility can hold a maximum of 500 units at any given time.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nMarket demand for product A is at least 100 units per month.\n// UnitsA >= 100\n\n## Generate Constraint-4:\nDue to labor constraints, the production of product B cannot exceed twice the production of product A.\n// UnitsB <= 2 * UnitsA\n\n## Generate Constraint-5:\nThe company has a contractual obligation to produce at least 50 units of product C per month.\n// UnitsC >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company has a total production capacity of 1000 units per month and the storage facility can hold a maximum of 500 units at any given time. Market demand for product A is at least 100 units per month. Due to labor constraints, the production of product B cannot exceed twice the production of product A. The company also has a contractual obligation to produce at least 50 units of product C per month. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\n# So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The storage facility can hold a maximum of 500 units at any given time.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n# Market demand for product A is at least 100 units per month.\nmodel.addCons(UnitsA >= 100)\n# Due to labor constraints, the production of product B cannot exceed twice the production of product A.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n# The company has a contractual obligation to produce at least 50 units of product C per month.\nmodel.addCons(UnitsC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route decreases with the investment in fuel-efficient technology. Specifically, for every $1000 invested, the fuel consumption decreases by 10 liters per truck per route. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Fuel1 = (1000 - 0.01 * Tech1) * Trucks1\n// Fuel consumption for Route2: Fuel2 = (1000 - 0.01 * Tech2) * Trucks2\n// Fuel consumption for Route3: Fuel3 = (1000 - 0.01 * Tech3) * Trucks3\n// Fuel consumption for Route4: Fuel4 = (1000 - 0.01 * Tech4) * Trucks4\n// Fuel consumption for Route5: Fuel5 = (1000 - 0.01 * Tech5) * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is 500.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500",
        "question": "A logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route. The fuel consumption per truck on each route decreases with the investment in fuel-efficient technology. Specifically, for every $1000 invested, the fuel consumption decreases by 10 liters per truck per route. The company aims to minimize the total fuel consumption across all routes. The company has a budget of $100,000 for investments in fuel-efficient technologies. The total number of trucks available for allocation is 500.\n\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in fuel-efficient technologies for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks for Route5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Route3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for Route4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for Route5\n\n# Define objective function\nFuel1 = (1000 - 0.01 * Tech1) * Trucks1\nFuel2 = (1000 - 0.01 * Tech2) * Trucks2\nFuel3 = (1000 - 0.01 * Tech3) * Trucks3\nFuel4 = (1000 - 0.01 * Tech4) * Trucks4\nFuel5 = (1000 - 0.01 * Tech5) * Trucks5\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\n# The company has a budget of $100,000 for investments in fuel-efficient technologies.\nmodel.addCons(Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n# The total number of trucks available for allocation is 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Route4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Route5: \", model.getVal(Tech5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n// 5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty. The profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty. The profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty. The company wants to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per month. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA. The company has a fixed budget for production costs, which cannot exceed $50,000 per month. Please help the company determine the optimal production quantities for ProductA, ProductB, and ProductC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProductBQty <= 2 * ProductAQty)\n# The company has a fixed budget for production costs, which cannot exceed $50,000 per month.\nmodel.addCons(5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-saving technology for product A\": \"EnergyInvestA\", \"range\": \"EnergyInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product B\": \"EnergyInvestB\", \"range\": \"EnergyInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product C\": \"EnergyInvestC\", \"range\": \"EnergyInvestC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product D\": \"EnergyInvestD\", \"range\": \"EnergyInvestD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n// Profit of product A: ProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\n// Profit of product B: ProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\n// Profit of product C: ProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\n// Profit of product D: ProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for energy-saving technology investments.\n// EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000\n\n## Generate Constraint-2:\nThe total raw material cost must not exceed $50,000.\n// 30 * A + 40 * B + 50 * C + 60 * D <= 50000\n\n## Generate Constraint-3:\nThe total labor cost must not exceed $30,000.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 30000\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of product A and 300 units of product B.\n// A >= 500; B >= 300\n\n## Generate Constraint-5:\nThe total energy cost must not exceed $20,000.\n// (10 - 0.001 * EnergyInvestA) * A + (15 - 0.001 * EnergyInvestB) * B + (20 - 0.001 * EnergyInvestC) * C + (25 - 0.001 * EnergyInvestD) * D <= 20000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product and the investment in energy-saving technologies for each product line to optimize its profit while considering the costs of raw materials, labor, and energy. The selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company has a budget of $100,000 for energy-saving technology investments. The total raw material cost must not exceed $50,000. The total labor cost must not exceed $30,000. The company must produce at least 500 units of product A and 300 units of product B. The total energy cost must not exceed $20,000. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # production quantity of product D\nEnergyInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestA\", lb=0) # investment in energy-saving technology for product A\nEnergyInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestB\", lb=0) # investment in energy-saving technology for product B\nEnergyInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestC\", lb=0) # investment in energy-saving technology for product C\nEnergyInvestD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestD\", lb=0) # investment in energy-saving technology for product D\n\n# Define objective function\nProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\nProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\nProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\nProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for energy-saving technology investments.\nmodel.addCons(EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000)\n# The total raw material cost must not exceed $50,000.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D <= 50000)\n# The total labor cost must not exceed $30,000.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 30000)\n# The total energy cost must not exceed $20,000.\nmodel.addCons((10 - 0.001 * EnergyInvestA) * A + (15 - 0.001 * EnergyInvestB) * B + (20 - 0.001 * EnergyInvestC) * C + (25 - 0.001 * EnergyInvestD) * D <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Production Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Energy-Saving Technology for Product A: \", model.getVal(EnergyInvestA))\n    print(\"Investment in Energy-Saving Technology for Product B: \", model.getVal(EnergyInvestB))\n    print(\"Investment in Energy-Saving Technology for Product C: \", model.getVal(EnergyInvestC))\n    print(\"Investment in Energy-Saving Technology for Product D: \", model.getVal(EnergyInvestD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse. At warehouse 1, the cost per truck is $1000, increasing by $10 for each additional truck beyond the first. At warehouse 2, the cost per truck is $1200, increasing by $12 for each additional truck beyond the first. At warehouse 3, the cost per truck is $1100, increasing by $11 for each additional truck beyond the first. At warehouse 4, the cost per truck is $1300, increasing by $13 for each additional truck beyond the first. At warehouse 5, the cost per truck is $1400, increasing by $14 for each additional truck beyond the first. The company aims to minimize the total operating cost of all trucks.\n// Cost_T1 = 1000 + 10 * (T1 - 1) * T1\n// Cost_T2 = 1200 + 12 * (T2 - 1) * T2\n// Cost_T3 = 1100 + 11 * (T3 - 1) * T3\n// Cost_T4 = 1300 + 13 * (T4 - 1) * T4\n// Cost_T5 = 1400 + 14 * (T5 - 1) * T5\n// So, the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse. At warehouse 1, the cost per truck is $1000, increasing by $10 for each additional truck beyond the first. At warehouse 2, the cost per truck is $1200, increasing by $12 for each additional truck beyond the first. At warehouse 3, the cost per truck is $1100, increasing by $11 for each additional truck beyond the first. At warehouse 4, the cost per truck is $1300, increasing by $13 for each additional truck beyond the first. At warehouse 5, the cost per truck is $1400, increasing by $14 for each additional truck beyond the first. The company aims to minimize the total operating cost of all trucks. The total number of trucks available across all warehouses is limited to 100. Please help the company determine the optimal number of trucks to allocate to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Cost functions\nCost_T1 = 1000 + 10 * (T1 - 1) * T1\nCost_T2 = 1200 + 12 * (T2 - 1) * T2\nCost_T3 = 1100 + 11 * (T3 - 1) * T3\nCost_T4 = 1300 + 13 * (T4 - 1) * T4\nCost_T5 = 1400 + 14 * (T5 - 1) * T5\n## the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency.\n// {\"amount of raw material in reactor 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of each reactor varies with the amount of raw material fed into it. The efficiency is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors.\n// The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited to 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nEach reactor has a maximum capacity for raw material:\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200",
        "question": "A chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency. The efficiency of each reactor varies with the amount of raw material fed into it and is defined as the ratio of the chemical produced to the raw material used. The efficiency functions for each reactor are given in the following Table.\n\n| Reactor | Efficiency Function |\n|---------|---------------------|\n| 1       | 0.5 * R1^0.7        |\n| 2       | 0.6 * R2^0.6        |\n| 3       | 0.7 * R3^0.5        |\n| 4       | 0.8 * R4^0.4        |\n| 5       | 0.9 * R5^0.3        |\n\nThe total amount of raw material available is limited to 1000 units. Each reactor has a maximum capacity for raw material of 200 units. The company wants to maximize the total efficiency of all reactors. Please help the company determine the optimal amount of raw material to feed into each reactor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material in reactor 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material in reactor 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material in reactor 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # amount of raw material in reactor 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # amount of raw material in reactor 5\n\n# Define objective function\n## The efficiency functions are nonlinear and are given by:\nEfficiency_R1 = 0.5 * R1**0.7\nEfficiency_R2 = 0.6 * R2**0.6\nEfficiency_R3 = 0.7 * R3**0.5\nEfficiency_R4 = 0.8 * R4**0.4\nEfficiency_R5 = 0.9 * R5**0.3\n## The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n# Add constraints\n## The total amount of raw material available is limited to 1000 units.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000)\n## Each reactor has a maximum capacity for raw material:\nmodel.addCons(R1 <= 200)\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material in Reactor 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material in Reactor 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material in Reactor 3: \", model.getVal(R3))\n    print(\"Amount of Raw Material in Reactor 4: \", model.getVal(R4))\n    print(\"Amount of Raw Material in Reactor 5: \", model.getVal(R5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total marketing budget available for all products is $100,000.\n// MA + MB + MC <= 100000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC.\n// QA <= 500; QB <= 400; QC <= 300\n\n## Generate Constraint-3:\nThe company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB.\n// MA >= 20000; MB >= 30000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product and the marketing budgets to maximize profit. The profit from each product is influenced by the production quantity and the marketing budget, with a nonlinear profit function given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\n\nThe company aims to maximize the total profit from all products. The following constraints apply:\n- The total marketing budget available for all products is $100,000.\n- The production capacity for each product is limited to 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC.\n- The company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB.\n\nPlease help the company determine the optimal production quantities (QA, QB, QC) and marketing budgets (MA, MB, MC) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=400) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=300) # quantity of ProductC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=20000) # marketing budget for ProductA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=30000) # marketing budget for ProductB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## The profit function is nonlinear and is given by:\nProfit_A = (100 * QA - 0.01 * QA**2 + 0.1 * MA) * QA\nProfit_B = (120 * QB - 0.02 * QB**2 + 0.15 * MB) * QB\nProfit_C = (150 * QC - 0.03 * QC**2 + 0.2 * MC) * QC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total marketing budget available for all products is $100,000.\nmodel.addCons(MA + MB + MC <= 100000)\n## The production capacity for each product is limited.\nmodel.addCons(QA <= 500)\nmodel.addCons(QB <= 400)\nmodel.addCons(QC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new energy-efficient technology that will reduce the energy cost per unit produced.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-efficient technology\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The selling price of ProductA is $100, ProductB is $120, and ProductC is $140. The energy cost per unit decreases by $1 for every $10,000 invested in energy-efficient technology. The company aims to maximize its profit, which is the total revenue minus the total cost, including the cost of the energy-efficient technology.\n// Total cost of ProductA: CostA = (50 - 0.0001 * EnergyInvestment) * UnitsA\n// Total cost of ProductB: CostB = (70 - 0.0001 * EnergyInvestment) * UnitsB\n// Total cost of ProductC: CostC = (90 - 0.0001 * EnergyInvestment) * UnitsC\n// Total revenue: Revenue = 100 * UnitsA + 120 * UnitsB + 140 * UnitsC\n// Total cost including technology investment: TotalCost = CostA + CostB + CostC + EnergyInvestment\n// So, the objective function is: Maximize (Revenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the energy-efficient technology investment.\n// EnergyInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the quarter is 2000 units.\n// UnitsA + UnitsB + UnitsC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new energy-efficient technology that will reduce the energy cost per unit produced. The cost of producing each unit, the selling price, and the impact of the energy-efficient technology on the cost are given in the following Table.\n\n| Product | Production Cost | Selling Price | Reduction in Cost per $10,000 Energy Investment |\n|---------|-----------------|---------------|------------------------------------------------|\n| ProductA | $50             | $100          | $1                                             |\n| ProductB | $70             | $120          | $1                                             |\n| ProductC | $90             | $140          | $1                                             |\n\nThe company has a budget of $100,000 for the energy-efficient technology investment. The total production capacity for the quarter is 2000 units. The company aims to maximize its profit, which is the total revenue minus the total cost, including the cost of the energy-efficient technology.\n\nPlease help the company determine the optimal production quantities for each product and the amount to invest in the energy-efficient technology to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0) # investment in energy-efficient technology\n\n# Define objective function\n## Total cost of ProductA: CostA = (50 - 0.0001 * EnergyInvestment) * UnitsA\n## Total cost of ProductB: CostB = (70 - 0.0001 * EnergyInvestment) * UnitsB\n## Total cost of ProductC: CostC = (90 - 0.0001 * EnergyInvestment) * UnitsC\nCostA = (50 - 0.0001 * EnergyInvestment) * UnitsA\nCostB = (70 - 0.0001 * EnergyInvestment) * UnitsB\nCostC = (90 - 0.0001 * EnergyInvestment) * UnitsC\n## Total revenue: Revenue = 100 * UnitsA + 120 * UnitsB + 140 * UnitsC\nRevenue = 100 * UnitsA + 120 * UnitsB + 140 * UnitsC\n## Total cost including technology investment: TotalCost = CostA + CostB + CostC + EnergyInvestment\nTotalCost = CostA + CostB + CostC + EnergyInvestment\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Revenue - TotalCost)\nmodel.addCons(obj == Revenue - TotalCost)\n\n# Add constraints\n## The company has a budget of $100,000 for the energy-efficient technology investment.\nmodel.addCons(EnergyInvestment <= 100000)\n## The total production capacity for the quarter is 2000 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Energy-Efficient Technology: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1387,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost is a nonlinear function of the fuel optimization level and the number of trucks. The fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region 1: Cost1 = Trucks1 * (100 - 0.5 * Fuel1^2)\n// Fuel cost for Region 2: Cost2 = Trucks2 * (120 - 0.6 * Fuel2^2)\n// Fuel cost for Region 3: Cost3 = Trucks3 * (110 - 0.4 * Fuel3^2)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-2:\nThe maximum fuel optimization level for each region is capped at 10 units.\n// Fuel1 <= 10; Fuel2 <= 10; Fuel3 <= 10\n\n## Generate Constraint-3:\nDue to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n// Trucks1 >= 20; Trucks2 >= 30\n\n## Generate Constraint-4:\nThe total fuel budget for all regions is $50,000.\n// Cost1 + Cost2 + Cost3 <= 50000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines. The fuel cost is a nonlinear function of the fuel optimization level and the number of trucks, where the fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions. The total number of trucks available is 100. The maximum fuel optimization level for each region is capped at 10 units. Due to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2. The total fuel budget for all regions is $50,000. Please help the company to determine the optimal allocation of trucks and fuel optimization levels to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region 3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0, ub=10)  # fuel optimization for Region 1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0, ub=10)  # fuel optimization for Region 2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0, ub=10)  # fuel optimization for Region 3\n\n# Define objective function\nCost1 = Trucks1 * (100 - 0.5 * Fuel1**2)\nCost2 = Trucks2 * (120 - 0.6 * Fuel2**2)\nCost3 = Trucks3 * (110 - 0.4 * Fuel3**2)\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The total number of trucks available is 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n# Due to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 30)\n# The total fuel budget for all regions is $50,000.\nmodel.addCons(Cost1 + Cost2 + Cost3 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region 1: \", model.getVal(Fuel1))\n    print(\"Fuel Optimization for Region 2: \", model.getVal(Fuel2))\n    print(\"Fuel Optimization for Region 3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n// Total energy production: Energy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\n// Total environmental impact: Impact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 for the construction of these facilities.\n// Cost of solar facilities: 100,000 * Solar\n// Cost of wind facilities: 150,000 * Wind\n// Cost of hydro facilities: 200,000 * Hydro\n// Cost of biomass facilities: 80,000 * Biomass\n// Cost of geothermal facilities: 250,000 * Geothermal\n// Total cost: 100,000 * Solar + 150,000 * Wind + 200,000 * Hydro + 80,000 * Biomass + 250,000 * Geothermal <= 5,000,000\n\n## Generate Constraint-2:\nThe city has a land area constraint that limits the total number of facilities to 50.\n// Solar + Wind + Hydro + Biomass + Geothermal <= 50",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city has a budget of $5,000,000 for the construction of these facilities. The city also has a land area constraint that limits the total number of facilities to 50.\nPlease help the city to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\nImpact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $5,000,000 for the construction of these facilities.\nmodel.addCons(100000 * Solar + 150000 * Wind + 200000 * Hydro + 80000 * Biomass + 250000 * Geothermal <= 5000000)\n## The city has a land area constraint that limits the total number of facilities to 50.\nmodel.addCons(Solar + Wind + Hydro + Biomass + Geothermal <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Maximized Energy-Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company can only use a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe number of large trucks cannot exceed half the number of small trucks.\n// LargeTrucks <= SmallTrucks / 2",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost. The small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L. The medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L. The large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L. The company needs to deliver a total of 1500 units over a distance of 500 km. The company has a budget constraint of $10,000 for the total operational costs and can only use a maximum of 20 trucks in total. The number of large trucks cannot exceed half the number of small trucks. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs. Please help the company determine the optimal number of small, medium, and large trucks to use.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n## The company can only use a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The number of large trucks cannot exceed half the number of small trucks.\nmodel.addCons(LargeTrucks <= SmallTrucks / 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the average fuel consumption per truck is 50 liters per day, the average revenue per truck is $1000 per day, and the maintenance cost per truck is $200 per day.\nFor RouteB, the average fuel consumption per truck is 60 liters per day, the average revenue per truck is $1200 per day, and the maintenance cost per truck is $250 per day.\nFor RouteC, the average fuel consumption per truck is 70 liters per day, the average revenue per truck is $1400 per day, and the maintenance cost per truck is $300 per day.\nFor RouteD, the average fuel consumption per truck is 80 liters per day, the average revenue per truck is $1600 per day, and the maintenance cost per truck is $350 per day.\nFor RouteE, the average fuel consumption per truck is 90 liters per day, the average revenue per truck is $1800 per day, and the maintenance cost per truck is $400 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for RouteA: Profit_A = (1000 - 200) * TrucksA - 50 * TrucksA\n// Total net profit for RouteB: Profit_B = (1200 - 250) * TrucksB - 60 * TrucksB\n// Total net profit for RouteC: Profit_C = (1400 - 300) * TrucksC - 70 * TrucksC\n// Total net profit for RouteD: Profit_D = (1600 - 350) * TrucksD - 80 * TrucksD\n// Total net profit for RouteE: Profit_E = (1800 - 400) * TrucksE - 90 * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for deployment.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regulatory requirements, RouteC must have at least 10% of the total trucks.\n// TrucksC >= 0.10 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $15,000 per day for maintenance costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 15000\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck assigned.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations.\nFor RouteA, the average fuel consumption per truck is 50 liters per day, the average revenue per truck is $1000 per day, and the maintenance cost per truck is $200 per day.\nFor RouteB, the average fuel consumption per truck is 60 liters per day, the average revenue per truck is $1200 per day, and the maintenance cost per truck is $250 per day.\nFor RouteC, the average fuel consumption per truck is 70 liters per day, the average revenue per truck is $1400 per day, and the maintenance cost per truck is $300 per day.\nFor RouteD, the average fuel consumption per truck is 80 liters per day, the average revenue per truck is $1600 per day, and the maintenance cost per truck is $350 per day.\nFor RouteE, the average fuel consumption per truck is 90 liters per day, the average revenue per truck is $1800 per day, and the maintenance cost per truck is $400 per day.\nThe company has a total of 50 trucks available for deployment. Due to regulatory requirements, RouteC must have at least 10% of the total trucks. The company has a budget of $15,000 per day for maintenance costs. The company wants to ensure that each route has at least one truck assigned.\nPlease help the company to maximize the net profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * TrucksA - 50 * TrucksA\nProfit_B = (1200 - 250) * TrucksB - 60 * TrucksB\nProfit_C = (1400 - 300) * TrucksC - 70 * TrucksC\nProfit_D = (1600 - 350) * TrucksD - 80 * TrucksD\nProfit_E = (1800 - 400) * TrucksE - 90 * TrucksE\nFuelConsumption = 50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for deployment.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to regulatory requirements, RouteC must have at least 10% of the total trucks.\nmodel.addCons(TrucksC >= 0.10 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n## The company has a budget of $15,000 per day for maintenance costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Liter of Fuel Consumed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1453,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 500 units.\n// UnitsA <= 500\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit, considering that the profit for each device includes a quadratic term due to increasing marginal costs. The company has a total production capacity of 1000 units per month. Due to market saturation, the production of DeviceA should not exceed 500 units. Additionally, the company has a budget of $60,000 for production costs per month. Please help the company determine the optimal number of units to produce for each device to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with quadratic terms\nProfit_A = (100 - 50) * UnitsA - 0.01 * UnitsA**2\nProfit_B = (120 - 70) * UnitsB - 0.02 * UnitsB**2\nProfit_C = (150 - 80) * UnitsC - 0.03 * UnitsC**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market saturation, the production of DeviceA should not exceed 500 units.\nmodel.addCons(UnitsA <= 500)\n## The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is 5$, for B it is 7$, for C it is 9$, for D it is 11$, and for E it is 13$. The company aims to minimize the total shipping cost while maintaining a certain profit margin. The profit margin is defined as the difference between the selling price and the shipping cost per unit. The selling price for each product is 10$ for A, 15$ for B, 20$ for C, 25$ for D, and 30$ for E. The objective is to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price.\n// Shipping cost of A: Cost_A = 5 * A\n// Shipping cost of B: Cost_B = 7 * B\n// Shipping cost of C: Cost_C = 9 * C\n// Shipping cost of D: Cost_D = 11 * D\n// Shipping cost of E: Cost_E = 13 * E\n// Profit margin of A: Profit_A = (10 - 5) * A\n// Profit margin of B: Profit_B = (15 - 7) * B\n// Profit margin of C: Profit_C = (20 - 9) * C\n// Profit margin of D: Profit_D = (25 - 11) * D\n// Profit margin of E: Profit_E = (30 - 13) * E\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for shipping costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company must ship at least 20 units of each product to meet customer demands.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe total profit margin must be at least 20% of the total selling price.\n// (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-4:\nThe company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D.\n// E <= A + B + C + D\n\n## Generate Constraint-5:\nThe company wants to ensure that the total units of product D shipped does not exceed twice the units of product A.\n// D <= 2 * A",
        "question": "A logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints. The cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is $5, for B it is $7, for C it is $9, for D it is $11, and for E it is $13. The selling price for each product is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to minimize the total shipping cost while maintaining a profit margin of at least 20% of the selling price. The company has a budget of $1500 for shipping costs. The company must ship at least 20 units of each product to meet customer demands. The total profit margin must be at least 20% of the total selling price. The company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D. Additionally, the company wants to ensure that the total units of product D shipped does not exceed twice the units of product A. Please help the company to minimize the total shipping cost while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ship at least 20 units of each product to meet customer demands.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## Shipping cost of A: Cost_A = 5 * A\n## Shipping cost of B: Cost_B = 7 * B\n## Shipping cost of C: Cost_C = 9 * C\n## Shipping cost of D: Cost_D = 11 * D\n## Shipping cost of E: Cost_E = 13 * E\nCost_A = 5 * A\nCost_B = 7 * B\nCost_C = 9 * C\nCost_D = 11 * D\nCost_E = 13 * E\n## Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $1500 for shipping costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The total profit margin must be at least 20% of the total selling price.\nmodel.addCons((10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= (10 * A - 5 * A + 15 * B - 7 * B + 20 * C - 9 * C + 25 * D - 11 * D + 30 * E - 13 * E))\n## The company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n## The company wants to ensure that the total units of product D shipped does not exceed twice the units of product A.\nmodel.addCons(D <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food). The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Clothing\": \"ClothingTripsPerTruck\", \"range\": \"ClothingTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Food\": \"FoodTripsPerTruck\", \"range\": \"FoodTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for Electronics is $100, for Clothing is $70, and for Food is $50. The fuel cost per trip for Electronics is $20, for Clothing is $15, and for Food is $10. The company aims to maximize its net daily profit.\n// Profit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\n// Profit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\n// Profit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Clothing + Profit_Food)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000\n\n## Generate Constraint-3:\nThe company can handle a maximum of 200 trips per day.\n// ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck <= 200",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food). The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The profit per trip for Electronics is $100, for Clothing is $70, and for Food is $50. The fuel cost per trip for Electronics is $20, for Clothing is $15, and for Food is $10. The company has a total of 50 trucks available and a daily fuel budget of $1000. The company can handle a maximum of 200 trips per day. Please help the company to maximize its net daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nClothingTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ClothingTripsPerTruck\", lb=0)\nFoodTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FoodTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\nProfit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\nProfit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Clothing + Profit_Food)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000)\nmodel.addCons(ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Clothing: \", model.getVal(ClothingTripsPerTruck))\n    print(\"Trips per Truck for Food: \", model.getVal(FoodTripsPerTruck))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 639,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel efficiency upgrade. The base fuel consumption for Route1 is 50 liters per 100 km, which decreases by 1 liter per 100 km for every $100 invested in upgrades. For Route2, the base consumption is 60 liters per 100 km, decreasing by 1.2 liters per 100 km for every $100 invested. For Route3, the base consumption is 70 liters per 100 km, decreasing by 1.4 liters per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (50 - 0.01 * Upgrade1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (60 - 0.012 * Upgrade2) * Trucks2\n// Fuel consumption for Route3: Consumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 10000",
        "question": "A logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades. The base fuel consumption and the effect of upgrades on fuel consumption for each route are given in the following Table.\n\n| Route | Base Fuel Consumption (liters/100 km) | Decrease in Consumption per $100 Upgrade |\n|-------|---------------------------------------|------------------------------------------|\n| 1     | 50                                    | 1 liter                                  |\n| 2     | 60                                    | 1.2 liters                               |\n| 3     | 70                                    | 1.4 liters                               |\n\nThe company has a budget of $10,000 for fuel efficiency upgrades. Please help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\n\n# Define objective function\nConsumption1 = (50 - 0.01 * Upgrade1) * Trucks1\nConsumption2 = (60 - 0.012 * Upgrade2) * Trucks2\nConsumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel efficiency upgrades.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new energy-efficient technology that will reduce the energy cost per unit produced.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-efficient technology\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The selling price of ProductA is $100, ProductB is $120, and ProductC is $140. The energy cost per unit decreases by $1 for every $10,000 invested in energy-efficient technology. The company aims to maximize its profit, which is the total revenue minus the total cost, including the cost of the energy-efficient technology.\n// Total cost of ProductA: CostA = (50 - 0.0001 * EnergyInvestment) * UnitsA\n// Total cost of ProductB: CostB = (70 - 0.0001 * EnergyInvestment) * UnitsB\n// Total cost of ProductC: CostC = (90 - 0.0001 * EnergyInvestment) * UnitsC\n// Total revenue: Revenue = 100 * UnitsA + 120 * UnitsB + 140 * UnitsC\n// Total cost including technology investment: TotalCost = CostA + CostB + CostC + EnergyInvestment\n// So, the objective function is: Maximize (Revenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the energy-efficient technology investment.\n// EnergyInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the quarter is 2000 units.\n// UnitsA + UnitsB + UnitsC <= 2000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nThe energy consumption for the quarter must not exceed 15,000 units of energy.\n// (50 - 0.0001 * EnergyInvestment) * UnitsA + (70 - 0.0001 * EnergyInvestment) * UnitsB + (90 - 0.0001 * EnergyInvestment) * UnitsC <= 15000\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of ProductC does not exceed the combined production of ProductA and ProductB.\n// UnitsC <= UnitsA + UnitsB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new energy-efficient technology that will reduce the energy cost per unit produced. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The selling price of ProductA is $100, ProductB is $120, and ProductC is $140. The energy cost per unit decreases by $1 for every $10,000 invested in energy-efficient technology. The company aims to maximize its profit, which is the total revenue minus the total cost, including the cost of the energy-efficient technology.\n\nThe company has a budget of $100,000 for the energy-efficient technology investment. The total production capacity for the quarter is 2000 units. The company must produce at least 500 units of ProductA and 300 units of ProductB. The energy consumption for the quarter must not exceed 15,000 units of energy. The company wants to ensure that the production of ProductC does not exceed the combined production of ProductA and ProductB.\n\nPlease help the company to maximize its profit, which is the total revenue minus the total cost, including the cost of the energy-efficient technology.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0) # investment in energy-efficient technology\n\n# Define objective function\nCostA = (50 - 0.0001 * EnergyInvestment) * UnitsA\nCostB = (70 - 0.0001 * EnergyInvestment) * UnitsB\nCostC = (90 - 0.0001 * EnergyInvestment) * UnitsC\nRevenue = 100 * UnitsA + 120 * UnitsB + 140 * UnitsC\nTotalCost = CostA + CostB + CostC + EnergyInvestment\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - TotalCost)\n\n# Add constraints\nmodel.addCons(EnergyInvestment <= 100000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\nmodel.addCons((50 - 0.0001 * EnergyInvestment) * UnitsA + (70 - 0.0001 * EnergyInvestment) * UnitsB + (90 - 0.0001 * EnergyInvestment) * UnitsC <= 15000)\nmodel.addCons(UnitsC <= UnitsA + UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Energy-Efficient Technology: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1303,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck in Region A is $100, and it decreases by $0.10 for each additional truck allocated. \nThe fuel cost per truck in Region B is $120, and it decreases by $0.15 for each additional truck allocated. \nThe fuel cost per truck in Region C is $90, and it decreases by $0.08 for each additional truck allocated.\nThe fuel cost per truck in Region D is $110, and it decreases by $0.12 for each additional truck allocated.\nThe fuel cost per truck in Region E is $130, and it decreases by $0.20 for each additional truck allocated.\nThe company wants to minimize the total fuel cost across all regions.\n// Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\n// Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\n// Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\n// Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\n// Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\n// So, the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nEach region has a minimum requirement for trucks. Region A requires at least 10 trucks, Region B requires at least 15 trucks, Region C requires at least 8 trucks, Region D requires at least 12 trucks, and Region E requires at least 20 trucks.\n// TruckA >= 10; TruckB >= 15; TruckC >= 8; TruckD >= 12; TruckE >= 20\n\n## Generate Constraint-3:\nThe delivery time for each region is affected by the number of trucks. If the number of trucks in a region exceeds 30, the delivery time starts to increase exponentially. Therefore, the company wants to limit the number of trucks in each region to 30 or less.\n// TruckA <= 30; TruckB <= 30; TruckC <= 30; TruckD <= 30; TruckE <= 30\n\n## Generate Constraint-4:\nThe company aims to balance the distribution of trucks across regions to ensure equal service levels. The difference in the number of trucks between any two regions should not exceed 5.\n// |TruckA - TruckB| <= 5; |TruckA - TruckC| <= 5; |TruckA - TruckD| <= 5; |TruckA - TruckE| <= 5\n// |TruckB - TruckC| <= 5; |TruckB - TruckD| <= 5; |TruckB - TruckE| <= 5\n// |TruckC - TruckD| <= 5; |TruckC - TruckE| <= 5\n// |TruckD - TruckE| <= 5",
        "question": "A logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. The fuel cost per truck in each region decreases as more trucks are allocated, as shown in the following Table.\n\n| Region | Fuel Cost per Truck | Decrease in Cost per Additional Truck |\n|--------|---------------------|---------------------------------------|\n| A      | $100                | $0.10                                |\n| B      | $120                | $0.15                                |\n| C      | $90                 | $0.08                                |\n| D      | $110                | $0.12                                |\n| E      | $130                | $0.20                                |\n\nThe company has a total of 100 trucks available for allocation. Each region has a minimum requirement for trucks: Region A requires at least 10 trucks, Region B requires at least 15 trucks, Region C requires at least 8 trucks, Region D requires at least 12 trucks, and Region E requires at least 20 trucks. The company wants to limit the number of trucks in each region to 30 or less to avoid increasing delivery times exponentially. Additionally, the company aims to balance the distribution of trucks across regions, ensuring that the difference in the number of trucks between any two regions does not exceed 5.\n\nPlease help the company to minimize the total fuel cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10)  # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=15)  # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=8)   # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=12)  # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=20)  # number of trucks in Region E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=1)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=1, ub=30)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TruckA == A1*A_b1 + A2*A_b2)\nFuel_Cost_A = 100 * A1 * A_b1 + (100 - 0.10 * (A2 - 1)) * A2 * A_b2\n\n## create piecewise variables for piecewise function: Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=1, ub=30)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TruckB == B1*B_b1 + B2*B_b2)\nFuel_Cost_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 1)) * B2 * B_b2\n\n## create piecewise variables for piecewise function: Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=1)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1, ub=30)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TruckC == C1*C_b1 + C2*C_b2)\nFuel_Cost_C = 90 * C1 * C_b1 + (90 - 0.08 * (C2 - 1)) * C2 * C_b2\n\n## create piecewise variables for piecewise function: Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=1)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=1, ub=30)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TruckD == D1*D_b1 + D2*D_b2)\nFuel_Cost_D = 110 * D1 * D_b1 + (110 - 0.12 * (D2 - 1)) * D2 * D_b2\n\n## create piecewise variables for piecewise function: Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=1)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=1, ub=30)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TruckE == E1*E_b1 + E2*E_b2)\nFuel_Cost_E = 130 * E1 * E_b1 + (130 - 0.20 * (E2 - 1)) * E2 * E_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(TruckA <= 30)\nmodel.addCons(TruckB <= 30)\nmodel.addCons(TruckC <= 30)\nmodel.addCons(TruckD <= 30)\nmodel.addCons(TruckE <= 30)\n\n# Constraint for the difference in the number of trucks between any two regions\nmodel.addCons(abs(TruckA - TruckB) <= 5)\nmodel.addCons(abs(TruckA - TruckC) <= 5)\nmodel.addCons(abs(TruckA - TruckD) <= 5)\nmodel.addCons(abs(TruckA - TruckE) <= 5)\nmodel.addCons(abs(TruckB - TruckC) <= 5)\nmodel.addCons(abs(TruckB - TruckD) <= 5)\nmodel.addCons(abs(TruckB - TruckE) <= 5)\nmodel.addCons(abs(TruckC - TruckD) <= 5)\nmodel.addCons(abs(TruckC - TruckE) <= 5)\nmodel.addCons(abs(TruckD - TruckE) <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1516,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost, selling price, and demand for each device vary and are influenced by market conditions.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price per unit is $100, and the demand is capped at 500 units. For DeviceB, the production cost per unit is $70, the selling price per unit is $120, and the demand is capped at 400 units. For DeviceC, the production cost per unit is $80, the selling price per unit is $150, and the demand is capped at 300 units. The company wants to maximize the total profit from selling these devices.\n// Total profit for DeviceA: ProfitA = (100 - 50) * UnitsA\n// Total profit for DeviceB: ProfitB = (120 - 70) * UnitsB\n// Total profit for DeviceC: ProfitC = (150 - 80) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity for the company is limited to 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB.\n// UnitsA <= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nThe demand for each device must be met or exceeded.\n// UnitsA >= 500; UnitsB >= 400; UnitsC >= 300\n\n## Generate Constraint-5:\nDue to a strategic partnership, the company must produce at least 200 units of DeviceC.\n// UnitsC >= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost, selling price, and demand for each device vary and are influenced by market conditions. The details for each device are as follows:\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand |\n|--------|--------------------------|------------------------|--------|\n| DeviceA | $50 | $100 | 500 units |\n| DeviceB | $70 | $120 | 400 units |\n| DeviceC | $80 | $150 | 300 units |\n\nThe company has several constraints:\n1. The total production capacity for the company is limited to 1000 units per month.\n2. The production of DeviceA should not exceed twice the production of DeviceB.\n3. The company has a budget of $60,000 for production costs per month.\n4. The demand for each device must be met or exceeded.\n5. Due to a strategic partnership, the company must produce at least 200 units of DeviceC.\n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=200) # number of units of DeviceC\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA\nProfitB = (120 - 70) * UnitsB\nProfitC = (150 - 80) * UnitsC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity for the company is limited to 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# Due to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB.\nmodel.addCons(UnitsA <= 2 * UnitsB)\n# The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n# The demand for each device must be met or exceeded.\nmodel.addCons(UnitsA >= 500)\nmodel.addCons(UnitsB >= 400)\nmodel.addCons(UnitsC >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital invested in automation\": \"AutomationCapital\", \"range\": \"AutomationCapital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for the production of all products.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital available for investment in automation is $100,000.\n// AutomationCapital <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\n// QuantityA <= 500; QuantityB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n// WorkersA >= 20; WorkersB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested. The production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 100 workers available for the production of all products. The total capital available for investment in automation is $100,000. Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units. The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationCapital\", lb=0)  # capital invested in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA +\n                (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB +\n                (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC)\n\n# Add constraints\n## The company has a total of 100 workers available for the production of all products.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital available for investment in automation is $100,000.\nmodel.addCons(AutomationCapital <= 100000)\n## Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 400)\n## The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\nmodel.addCons(WorkersA >= 20)\nmodel.addCons(WorkersB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Invested in Automation: \", model.getVal(AutomationCapital))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times by determining the optimal speed for each truck.\n// {\"speed of truck 1\": \"T1\", \"range\": \"0 <= T1 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"T2\", \"range\": \"0 <= T2 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"T3\", \"range\": \"0 <= T3 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"T4\", \"range\": \"0 <= T4 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"T5\", \"range\": \"0 <= T5 <= 60\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed. The fuel consumption rate (in liters per kilometer) for each truck is given by:\n- Truck 1: F1 = 0.05 * T1^2\n- Truck 2: F2 = 0.06 * T2^2\n- Truck 3: F3 = 0.07 * T3^2\n- Truck 4: F4 = 0.08 * T4^2\n- Truck 5: F5 = 0.09 * T5^2\nThe total delivery time for each truck is inversely proportional to its speed:\n- Truck 1: D1 = 500 / T1\n- Truck 2: D2 = 450 / T2\n- Truck 3: D3 = 400 / T3\n- Truck 4: D4 = 350 / T4\n- Truck 5: D5 = 300 / T5\nThe company aims to minimize the total cost, which is the sum of the total fuel consumption and the total delivery time multiplied by a cost factor of $10 per hour.\n// Total fuel consumption: Fuel = 500 * F1 + 450 * F2 + 400 * F3 + 350 * F4 + 300 * F5\n// Total delivery time: Time = D1 + D2 + D3 + D4 + D5\n// Objective function: Minimize (Fuel + 10 * Time)\n\n## Generate Constraint-1:\nThe total time for all trucks to complete their deliveries must not exceed 10 hours.\n// D1 + D2 + D3 + D4 + D5 <= 10\n\n## Generate Constraint-2:\nThe speed of each truck must be within the legal limit of 60 km/h.\n// T1 <= 60; T2 <= 60; T3 <= 60; T4 <= 60; T5 <= 60",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times by determining the optimal speed for each truck. The fuel consumption rate (in liters per kilometer) for each truck is modeled as a nonlinear function of its speed, and the total delivery time for each truck is inversely proportional to its speed. The company aims to minimize the total cost, which is the sum of the total fuel consumption and the total delivery time multiplied by a cost factor of $10 per hour. The total time for all trucks to complete their deliveries must not exceed 10 hours, and the speed of each truck must be within the legal limit of 60 km/h.\n\nPlease help the company to determine the optimal speeds for each truck (T1, T2, T3, T4, T5) to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0, ub=60) # speed of truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0, ub=60) # speed of truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0, ub=60) # speed of truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0, ub=60) # speed of truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0, ub=60) # speed of truck 5\n\n# Define objective function\nF1 = 0.05 * T1**2\nF2 = 0.06 * T2**2\nF3 = 0.07 * T3**2\nF4 = 0.08 * T4**2\nF5 = 0.09 * T5**2\nD1 = 500 / T1\nD2 = 450 / T2\nD3 = 400 / T3\nD4 = 350 / T4\nD5 = 300 / T5\nFuel = 500 * F1 + 450 * F2 + 400 * F3 + 350 * F4 + 300 * F5\nTime = D1 + D2 + D3 + D4 + D5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel + 10 * Time)\n\n# Add constraints\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 10)\nmodel.addCons(T1 <= 60)\nmodel.addCons(T2 <= 60)\nmodel.addCons(T3 <= 60)\nmodel.addCons(T4 <= 60)\nmodel.addCons(T5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(T1))\n    print(\"Speed of Truck 2: \", model.getVal(T2))\n    print(\"Speed of Truck 3: \", model.getVal(T3))\n    print(\"Speed of Truck 4: \", model.getVal(T4))\n    print(\"Speed of Truck 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different profitability and operational costs. The profit per truck on route R1 is $1000, with an operational cost of $500 per truck. For route R2, the profit is $1200 with a cost of $600. For route R3, the profit is $1500 with a cost of $750. For route R4, the profit is $1800 with a cost of $900. For route R5, the profit is $2000 with a cost of $1000. The company aims to maximize the total net profit while considering the operational costs.\n// Net_Profit_R1 = (1000 - 500) * T1 = 500 * T1\n// Net_Profit_R2 = (1200 - 600) * T2 = 600 * T2\n// Net_Profit_R3 = (1500 - 750) * T3 = 750 * T3\n// Net_Profit_R4 = (1800 - 900) * T4 = 900 * T4\n// Net_Profit_R5 = (2000 - 1000) * T5 = 1000 * T5\n// So, the objective function is: Maximize (500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks.\n// T1 <= 20; T2 <= 15; T3 <= 25; T4 <= 10; T5 <= 30",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability. Each route has different profitability and operational costs. The profit per truck on route R1 is $1000, with an operational cost of $500 per truck. For route R2, the profit is $1200 with a cost of $600. For route R3, the profit is $1500 with a cost of $750. For route R4, the profit is $1800 with a cost of $900. For route R5, the profit is $2000 with a cost of $1000. The company has a total of 100 trucks available for allocation. Each route also has a maximum capacity for trucks: Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks. Please help the company to maximize the total net profit while considering the operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\nmodel.addCons(obj == 500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 25)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"0 <= Automation <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost per unit by $0.5 for every unit of automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize the total profit.\n// CostA = (100 - 0.5 * Automation) * QA\n// CostB = (150 - 0.5 * Automation) * QB\n// CostC = (200 - 0.5 * Automation) * QC\n// RevenueA = 150 * QA\n// RevenueB = 200 * QB\n// RevenueC = 250 * QC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for implementing automation.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 1000 units.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 100 units and for ProductB is at least 150 units.\n// QA >= 100; QB >= 150",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost per unit by $0.5 for every unit of automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize the total profit.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| ProductA | 100$          | 150$             |\n| ProductB | 150$          | 200$             |\n| ProductC | 200$          | 250$             |\n\nThe company has a budget of $50,000 for implementing automation. The total production capacity for all products is 1000 units. The market demand for ProductA is at least 100 units and for ProductB is at least 150 units.\n\nPlease help the company to maximize the total profit, considering the constraints on automation budget, production capacity, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=100) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=150) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nCostA = (100 - 0.5 * Automation) * QA\nCostB = (150 - 0.5 * Automation) * QB\nCostC = (200 - 0.5 * Automation) * QC\nRevenueA = 150 * QA\nRevenueB = 200 * QB\nRevenueC = 250 * QC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(QA + QB + QC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks for route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times per truck. \nRoute 1: 50 liters of fuel per trip, 10 hours per trip.\nRoute 2: 60 liters of fuel per trip, 8 hours per trip.\nRoute 3: 70 liters of fuel per trip, 6 hours per trip.\nRoute 4: 80 liters of fuel per trip, 5 hours per trip.\nRoute 5: 90 liters of fuel per trip, 4 hours per trip.\nRoute 6: 100 liters of fuel per trip, 3 hours per trip.\nThe company wants to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time.\n// Total fuel cost for route 1: FC1 = 50 * T1\n// Total fuel cost for route 2: FC2 = 60 * T2\n// Total fuel cost for route 3: FC3 = 70 * T3\n// Total fuel cost for route 4: FC4 = 80 * T4\n// Total fuel cost for route 5: FC5 = 90 * T5\n// Total fuel cost for route 6: FC6 = 100 * T6\n// Total time cost for route 1: TC1 = 10 * T1\n// Total time cost for route 2: TC2 = 8 * T2\n// Total time cost for route 3: TC3 = 6 * T3\n// Total time cost for route 4: TC4 = 5 * T4\n// Total time cost for route 5: TC5 = 4 * T5\n// Total time cost for route 6: TC6 = 3 * T6\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2.\n// T1 <= 10; T2 <= 10",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has different fuel consumption rates and delivery times per truck. \nRoute 1: 50 liters of fuel per trip, 10 hours per trip.\nRoute 2: 60 liters of fuel per trip, 8 hours per trip.\nRoute 3: 70 liters of fuel per trip, 6 hours per trip.\nRoute 4: 80 liters of fuel per trip, 5 hours per trip.\nRoute 5: 90 liters of fuel per trip, 4 hours per trip.\nRoute 6: 100 liters of fuel per trip, 3 hours per trip.\nThe company wants to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time. The company has a total of 50 trucks available. Due to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2.\nPlease help the company to minimize the total operational cost, which includes both fuel costs and the opportunity costs of time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks for route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks for route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks for route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks for route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks for route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks for route 6\n\n# Define objective function\nFC1 = 50 * T1 # Total fuel cost for route 1\nFC2 = 60 * T2 # Total fuel cost for route 2\nFC3 = 70 * T3 # Total fuel cost for route 3\nFC4 = 80 * T4 # Total fuel cost for route 4\nFC5 = 90 * T5 # Total fuel cost for route 5\nFC6 = 100 * T6 # Total fuel cost for route 6\nTC1 = 10 * T1 # Total time cost for route 1\nTC2 = 8 * T2 # Total time cost for route 2\nTC3 = 6 * T3 # Total time cost for route 3\nTC4 = 5 * T4 # Total time cost for route 4\nTC5 = 4 * T5 # Total time cost for route 5\nTC6 = 3 * T6 # Total time cost for route 6\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50) # Total of 50 trucks available\nmodel.addCons(T1 <= 10) # No more than 10 trucks for Route 1\nmodel.addCons(T2 <= 10) # No more than 10 trucks for Route 2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Route 1: \", model.getVal(T1))\n    print(\"Number of trucks for Route 2: \", model.getVal(T2))\n    print(\"Number of trucks for Route 3: \", model.getVal(T3))\n    print(\"Number of trucks for Route 4: \", model.getVal(T4))\n    print(\"Number of trucks for Route 5: \", model.getVal(T5))\n    print(\"Number of trucks for Route 6: \", model.getVal(T6))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 50 trucks in total.\n// Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact also affects the company's taxes.\n\nThe company has a budget of $500,000 for purchasing trucks and must have at least 50 trucks in total.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks for each type of cargo, considering the operational costs and environmental impact.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=0)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=0)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=0)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=0)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=0)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and cost calculations\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (total profit) - (total operational cost) - (total environmental impact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n## The company must have at least 50 trucks in total.\nmodel.addCons(Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine type should be operated in the production process.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for machine A\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine B\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine C\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine D\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the material cost is $2000, and the operational cost per hour is $100.\nFor machine B, the selling price is $7000, the material cost is $3000, and the operational cost per hour is $150.\nFor machine C, the selling price is $9000, the material cost is $4000, and the operational cost per hour is $200.\nFor machine D, the selling price is $11000, the material cost is $5000, and the operational cost per hour is $250.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost.\n// Profit of A: Profit_A = (5000 - 2000) * A - 100 * HoursA\n// Profit of B: Profit_B = (7000 - 3000) * B - 150 * HoursB\n// Profit of C: Profit_C = (9000 - 4000) * C - 200 * HoursC\n// Profit of D: Profit_D = (11000 - 5000) * D - 250 * HoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for material costs next month.\n// 2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150,000\n\n## Generate Constraint-2:\nThe total operational hours across all machines must not exceed 1000 hours.\n// HoursA + HoursB + HoursC + HoursD <= 1000",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine type should be operated in the production process.\nFor machine A, the selling price is $5000, the material cost is $2000, and the operational cost per hour is $100.\nFor machine B, the selling price is $7000, the material cost is $3000, and the operational cost per hour is $150.\nFor machine C, the selling price is $9000, the material cost is $4000, and the operational cost per hour is $200.\nFor machine D, the selling price is $11000, the material cost is $5000, and the operational cost per hour is $250.\nThe company has a total budget of $150,000 for material costs next month. The total operational hours across all machines must not exceed 1000 hours.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost.\nPlease help the company to determine the optimal production and operational hours for each machine type to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of machine D\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # hours of operation for machine A\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # hours of operation for machine B\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # hours of operation for machine C\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # hours of operation for machine D\n\n# Define objective function\nProfit_A = (5000 - 2000) * A - 100 * HoursA\nProfit_B = (7000 - 3000) * B - 150 * HoursB\nProfit_C = (9000 - 4000) * C - 200 * HoursC\nProfit_D = (11000 - 5000) * D - 250 * HoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for material costs next month.\nmodel.addCons(2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150000)\n# The total operational hours across all machines must not exceed 1000 hours.\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Hours of Operation for Machine A: \", model.getVal(HoursA))\n    print(\"Hours of Operation for Machine B: \", model.getVal(HoursB))\n    print(\"Hours of Operation for Machine C: \", model.getVal(HoursC))\n    print(\"Hours of Operation for Machine D: \", model.getVal(HoursD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to small trucks\": \"RoutesSmall\", \"range\": \"RoutesSmall >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to medium trucks\": \"RoutesMedium\", \"range\": \"RoutesMedium >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to large trucks\": \"RoutesLarge\", \"range\": \"RoutesLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company aims to minimize the total daily operational and fuel costs.\n// FuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\n// OperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n// So, the objective function is: Minimize (FuelCost + OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000\n\n## Generate Constraint-2:\nThe total number of routes available is 1000.\n// RoutesSmall + RoutesMedium + RoutesLarge <= 1000\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads.\n// RoutesMedium + RoutesLarge >= 0.3 * 1000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs. The fuel consumption and operational costs for each type of truck are given in the following Table.\n\n| Vehicle Type | Fuel Consumption per Route | Operational Cost per Day |\n|--------------|---------------------------|--------------------------|\n| Small Trucks | 10 liters                 | $500                     |\n| Medium Trucks| 15 liters                 | $750                     |\n| Large Trucks | 20 liters                 | $1000                    |\n\nThe company has a total budget of $50,000 for purchasing new trucks. The total number of routes available is 1000. The company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads. Please help the company to minimize the total daily operational and fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nRoutesSmall = model.addVar(vtype=\"INTEGER\", name=\"RoutesSmall\", lb=0)  # number of routes assigned to small trucks\nRoutesMedium = model.addVar(vtype=\"INTEGER\", name=\"RoutesMedium\", lb=0)  # number of routes assigned to medium trucks\nRoutesLarge = model.addVar(vtype=\"INTEGER\", name=\"RoutesLarge\", lb=0)  # number of routes assigned to large trucks\n\n# Define objective function\nFuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\nOperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n# So, the objective function is: Minimize (FuelCost + OperationalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + OperationalCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000)\n# The total number of routes available is 1000.\nmodel.addCons(RoutesSmall + RoutesMedium + RoutesLarge <= 1000)\n# The company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads.\nmodel.addCons(RoutesMedium + RoutesLarge >= 0.3 * 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Routes Assigned to Small Trucks: \", model.getVal(RoutesSmall))\n    print(\"Routes Assigned to Medium Trucks: \", model.getVal(RoutesMedium))\n    print(\"Routes Assigned to Large Trucks: \", model.getVal(RoutesLarge))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines.\n// The total production per hour: P = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach machine has a maximum capacity for workers. Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\n// W1 <= 10; W2 <= 12; W3 <= 15; W4 <= 18; W5 <= 20\n\n## Generate Constraint-3:\nThe plant must produce at least 500 units of component 1, 600 units of component 2, and 700 units of component 3. The production rates of components 1, 2, and 3 are proportional to the number of workers on each machine.\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 500 (for component 1)\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 600 (for component 2)\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 700 (for component 3)\n\n## Generate Constraint-4:\nThe total production must not exceed the plant's daily capacity of 1000 units.\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 <= 1000",
        "question": "A manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines. There are a total of 50 workers available. Each machine has a maximum capacity for workers: Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers. The plant must produce at least 500 units of component 1, 600 units of component 2, and 700 units of component 3. The total production must not exceed the plant's daily capacity of 1000 units. Please help the plant manager determine the optimal number of workers to allocate to each machine to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n# There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\n# Each machine has a maximum capacity for workers.\nmodel.addCons(W1 <= 10)\nmodel.addCons(W2 <= 12)\nmodel.addCons(W3 <= 15)\nmodel.addCons(W4 <= 18)\nmodel.addCons(W5 <= 20)\n# The plant must produce at least 500 units of component 1, 600 units of component 2, and 700 units of component 3.\nmodel.addCons(P >= 500)\nmodel.addCons(P >= 600)\nmodel.addCons(P >= 700)\n# The total production must not exceed the plant's daily capacity of 1000 units.\nmodel.addCons(P <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(W4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(W5))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in research and development (R&D) for each type of plant to enhance their efficiency.\n// {\"operating hours for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"operating hours for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for Solar plant\": \"RnD_Solar\", \"range\": \"RnD_Solar >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Wind plant\": \"RnD_Wind\", \"range\": \"RnD_Wind >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Hydro plant\": \"RnD_Hydro\", \"range\": \"RnD_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants.\n// Energy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\n// Energy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\n// Energy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200.\n// 100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants combined cannot exceed 24 hours per day.\n// Hours_Solar + Hours_Wind + Hours_Hydro <= 24\n\n## Generate Constraint-3:\nDue to maintenance requirements, each plant must operate at least 2 hours per day.\n// Hours_Solar >= 2; Hours_Wind >= 2; Hours_Hydro >= 2\n\n## Generate Constraint-4:\nThe company has a policy to invest at least $5000 in R&D for each type of plant.\n// RnD_Solar >= 5000; RnD_Wind >= 5000; RnD_Hydro >= 5000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in research and development (R&D) for each type of plant to enhance their efficiency. The efficiency of each plant increases with R&D investment. For every $1000 invested in R&D, the energy output per hour of operation increases by 1 MWh. The initial output for Solar is 5 MWh/hour, for Wind is 6 MWh/hour, and for Hydro is 8 MWh/hour. The company aims to maximize the total daily energy output from all plants. The company has a total budget of $100,000 for operating costs and R&D investments. The operating cost per hour for Solar is $100, for Wind is $150, and for Hydro is $200. The total operating hours for all plants combined cannot exceed 24 hours per day. Due to maintenance requirements, each plant must operate at least 2 hours per day. The company has a policy to invest at least $5000 in R&D for each type of plant. Please help the company to determine the optimal operating hours and R&D investments for each type of plant to maximize the total daily energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=2)  # operating hours for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=2)  # operating hours for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=2)  # operating hours for Hydro plant\nRnD_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Solar\", lb=5000)  # R&D investment for Solar plant\nRnD_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Wind\", lb=5000)  # R&D investment for Wind plant\nRnD_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_Hydro\", lb=5000)  # R&D investment for Hydro plant\n\n# Define objective function\nEnergy_Solar = (5 + 0.001 * RnD_Solar) * Hours_Solar\nEnergy_Wind = (6 + 0.001 * RnD_Wind) * Hours_Wind\nEnergy_Hydro = (8 + 0.001 * RnD_Hydro) * Hours_Hydro\n# So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for operating costs and R&D investments.\nmodel.addCons(100 * Hours_Solar + 150 * Hours_Wind + 200 * Hours_Hydro + RnD_Solar + RnD_Wind + RnD_Hydro <= 100000)\n# The total operating hours for all plants combined cannot exceed 24 hours per day.\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for Solar Plant: \", model.getVal(Hours_Solar))\n    print(\"Operating Hours for Wind Plant: \", model.getVal(Hours_Wind))\n    print(\"Operating Hours for Hydro Plant: \", model.getVal(Hours_Hydro))\n    print(\"R&D Investment for Solar Plant: \", model.getVal(RnD_Solar))\n    print(\"R&D Investment for Wind Plant: \", model.getVal(RnD_Wind))\n    print(\"R&D Investment for Hydro Plant: \", model.getVal(RnD_Hydro))\n    print(\"Total Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1171,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost. The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\n// Profit_Route1 = Revenue_Route1 - FuelCost_Route1 = 1000 * T1 - 0.1 * T1^2\n// Profit_Route2 = Revenue_Route2 - FuelCost_Route2 = 1200 * T2 - 0.12 * T2^2\n// Profit_Route3 = Revenue_Route3 - FuelCost_Route3 = 1500 * T3 - 0.15 * T3^2\n// Profit_Route4 = Revenue_Route4 - FuelCost_Route4 = 1300 * T4 - 0.13 * T4^2\n// Profit_Route5 = Revenue_Route5 - FuelCost_Route5 = 1100 * T5 - 0.11 * T5^2\n// The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks due to road restrictions and operational efficiency.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 22; T5 <= 18\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10\n\n## Generate Constraint-4:\nThe total fuel cost should not exceed a budget of $5000 per day.\n// 0.1 * T1^2 + 0.12 * T2^2 + 0.15 * T3^2 + 0.13 * T4^2 + 0.11 * T5^2 <= 5000",
        "question": "A logistics company operates 5 different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The profit per route is calculated as the revenue from deliveries minus the fuel cost, where the fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing. The company aims to maximize its total profit. The revenue and fuel cost parameters for each route are given in the following Table.\n\n| Route | Revenue per Truck | Fuel Cost Coefficient |\n|-------|-------------------|-----------------------|\n| 1     | 1000$             | 0.1$ per truck^2     |\n| 2     | 1200$             | 0.12$ per truck^2    |\n| 3     | 1500$             | 0.15$ per truck^2    |\n| 4     | 1300$             | 0.13$ per truck^2    |\n| 5     | 1100$             | 0.11$ per truck^2    |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks due to road restrictions and operational efficiency: Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 22 trucks, and Route 5 up to 18 trucks. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels. Additionally, the total fuel cost should not exceed a budget of $5000 per day.\n\nPlease help the company to maximize its total profit by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks on route 5\n\n# Define objective function\n## The profit per route is calculated as the revenue from deliveries minus the fuel cost.\nProfit_Route1 = 1000 * T1 - 0.1 * T1**2\nProfit_Route2 = 1200 * T2 - 0.12 * T2**2\nProfit_Route3 = 1500 * T3 - 0.15 * T3**2\nProfit_Route4 = 1300 * T4 - 0.13 * T4**2\nProfit_Route5 = 1100 * T5 - 0.11 * T5**2\n## The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks due to road restrictions and operational efficiency.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 22)\nmodel.addCons(T5 <= 18)\n## The total fuel cost should not exceed a budget of $5000 per day.\nmodel.addCons(0.1 * T1**2 + 0.12 * T2**2 + 0.15 * T3**2 + 0.13 * T4**2 + 0.11 * T5**2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1487,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"investment per Small wind farm\": \"InvestmentSmall\", \"range\": \"InvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment per Medium wind farm\": \"InvestmentMedium\", \"range\": \"InvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment per Large wind farm\": \"InvestmentLarge\", \"range\": \"InvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n// EnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\n// EnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\n// EnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\n// OperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for investment in all wind farms.\n// InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10,000,000\n\n## Generate Constraint-2:\nThe total number of wind farms cannot exceed 100.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 100\n\n## Generate Constraint-3:\nDue to environmental regulations, the number of Large wind farms must not exceed half the number of Medium wind farms.\n// LargeWindFarms <= 0.5 * MediumWindFarms\n\n## Generate Constraint-4:\nThe minimum energy output requirement is 10,000 MWh.\n// EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge >= 10,000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm. The energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms. The company has a total budget of $10 million for investment in all wind farms. The total number of wind farms cannot exceed 100. Due to environmental regulations, the number of Large wind farms must not exceed half the number of Medium wind farms. The minimum energy output requirement is 10,000 MWh. Please help the company to maximize the net energy output (energy output - operational cost) across all wind farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSmall\", lb=0)\nInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentMedium\", lb=0)\nInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentLarge\", lb=0)\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\nEnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\nEnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\nOperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10000000)\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 100)\nmodel.addCons(LargeWindFarms <= 0.5 * MediumWindFarms)\nmodel.addCons(EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Investment per Small Wind Farm: \", model.getVal(InvestmentSmall))\n    print(\"Investment per Medium Wind Farm: \", model.getVal(InvestmentMedium))\n    print(\"Investment per Large Wind Farm: \", model.getVal(InvestmentLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1292,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (Component A, Component B, Component C, Component D, and Component E). The company wants to optimize the production process to maximize profit.\n// {\"number of units of Component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of Component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Component A is $50, for Component B is $70, for Component C is $90, for Component D is $110, and for Component E is $130. The production cost per unit for each component is a percentage of its selling price, with Component A having a cost of 40%, Component B 35%, Component C 30%, Component D 25%, and Component E 20%. The company aims to maximize the net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n// Total cost: Cost = 40% * 50A + 35% * 70B + 30% * 90C + 25% * 110D + 20% * 130E\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five different types of electronic components (Component A, Component B, Component C, Component D, and Component E). The company wants to optimize the production process to maximize profit. The profit per unit for Component A is $50, for Component B is $70, for Component C is $90, for Component D is $110, and for Component E is $130. The production cost per unit for each component is a percentage of its selling price, with Component A having a cost of 40%, Component B 35%, Component C 30%, Component D 25%, and Component E 20%. The company aims to maximize the net profit, which is the total revenue minus the total cost. The company has a total production capacity of 1000 units across all components.\nPlease help the company determine the optimal number of units to produce for each component to maximize net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of Component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of Component E\n\n# Define objective function\n## Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n## Total cost: Cost = 40% * 50A + 35% * 70B + 30% * 90C + 25% * 110D + 20% * 130E\n## Net profit: Profit = Revenue - Cost\nRevenue = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nCost = 0.4 * 50 * A + 0.35 * 70 * B + 0.3 * 90 * C + 0.25 * 110 * D + 0.2 * 130 * E\nProfit = Revenue - Cost\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n// Packages delivered by Trucks per hour: Packages_Trucks = 100 * Trucks * 50\n// Packages delivered by Vans per hour: Packages_Vans = 50 * Vans * 40\n// Packages delivered by Bikes per hour: Packages_Bikes = 10 * Bikes * 20\n// So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\n// 100 * Trucks + 50 * Vans + 20 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers.\n// 2 * Trucks + Vans + 0.5 * Bikes <= 100\n\n## Generate Constraint-3:\nThe company has a storage capacity limitation of 5000 packages. Each Truck can carry 100 packages, each Van can carry 50 packages, and each Bike can carry 10 packages.\n// 100 * Trucks + 50 * Vans + 10 * Bikes <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans.\n// Bikes <= Trucks + Vans\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of vehicles does not exceed 100.\n// Trucks + Vans + Bikes <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle. Each Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour.\n\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20. The company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers. The company has a storage capacity limitation of 5000 packages. Each Truck can carry 100 packages, each Van can carry 50 packages, and each Bike can carry 10 packages. The company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans. Additionally, the company wants to ensure that the total number of vehicles does not exceed 100.\n\nPlease help the company to maximize the total number of packages delivered per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nPackages_Trucks = 100 * Trucks * 50\nPackages_Vans = 50 * Vans * 40\nPackages_Bikes = 10 * Bikes * 20\n# So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n# Add constraints\n# The company has a budget of $10,000 per day for vehicle maintenance.\nmodel.addCons(100 * Trucks + 50 * Vans + 20 * Bikes <= 10000)\n# The company has a total of 100 drivers available.\nmodel.addCons(2 * Trucks + Vans + 0.5 * Bikes <= 100)\n# The company has a storage capacity limitation of 5000 packages.\nmodel.addCons(100 * Trucks + 50 * Vans + 10 * Bikes <= 5000)\n# The company wants to ensure that the number of Bikes does not exceed the combined number of Trucks and Vans.\nmodel.addCons(Bikes <= Trucks + Vans)\n# The company wants to ensure that the total number of vehicles does not exceed 100.\nmodel.addCons(Trucks + Vans + Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1273,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck, which can be improved with an investment in fuel-saving technology.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-saving technology for Region1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck can be improved by investing in fuel-saving technology. For every $1000 invested, the fuel efficiency increases by 1%. The company aims to minimize the total fuel cost across all regions. The fuel cost per kilometer for each truck is $0.5, and the average distance traveled by each truck in a region is 1000 kilometers.\n// Fuel cost for Region1: Cost1 = 0.5 * (1000 * (1 + Tech1/1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.5 * (1000 * (1 + Tech2/1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.5 * (1000 * (1 + Tech3/1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.5 * (1000 * (1 + Tech4/1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.5 * (1000 * (1 + Tech5/1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel-saving technology investments.\n// Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nDue to regional regulations, at least 5 trucks must be allocated to each region.\n// Trucks1 >= 5; Trucks2 >= 5; Trucks3 >= 5; Trucks4 >= 5; Trucks5 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck, which can be improved with an investment in fuel-saving technology. The fuel efficiency of each truck can be improved by investing in fuel-saving technology. For every $1000 invested, the fuel efficiency increases by 1%. The company aims to minimize the total fuel cost across all regions. The fuel cost per kilometer for each truck is $0.5, and the average distance traveled by each truck in a region is 1000 kilometers. The company has a total budget of $100,000 for fuel-saving technology investments. The company has a total of 50 trucks available for allocation. Due to regional regulations, at least 5 trucks must be allocated to each region. Please help the company to minimize the total fuel cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=5)  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=5)  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks for Region5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-saving technology for Region1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-saving technology for Region2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-saving technology for Region3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0)  # investment in fuel-saving technology for Region4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0)  # investment in fuel-saving technology for Region5\n\n# Define objective function\nCost1 = 0.5 * (1000 * (1 + Tech1/1000)) * Trucks1\nCost2 = 0.5 * (1000 * (1 + Tech2/1000)) * Trucks2\nCost3 = 0.5 * (1000 * (1 + Tech3/1000)) * Trucks3\nCost4 = 0.5 * (1000 * (1 + Tech4/1000)) * Trucks4\nCost5 = 0.5 * (1000 * (1 + Tech5/1000)) * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)  # total budget for fuel-saving technology investments\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)  # total trucks available\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Tech for Region1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Region2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Region3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Region4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Region5: \", model.getVal(Tech5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and the environmental impact per unit is 2 kg of CO2.\nThe profit per unit of Product B is $70, and the environmental impact per unit is 3 kg of CO2.\nThe profit per unit of Product C is $60, and the environmental impact per unit is 2.5 kg of CO2.\nThe profit per unit of Product D is $80, and the environmental impact per unit is 4 kg of CO2.\nThe profit per unit of Product E is $90, and the environmental impact per unit is 5 kg of CO2.\nThe company wants to maximize the Profit-Environmental Impact ratio. (The Profit-Environmental Impact ratio is defined as the total profit divided by the total environmental impact.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total environmental impact: Impact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n// So, the objective function is: Maximize Profit / Impact\n\n## Generate Constraint-1:\nThe company has a total production capacity of 2000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 2000",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit of Product A is $50, and the environmental impact per unit is 2 kg of CO2. The profit per unit of Product B is $70, and the environmental impact per unit is 3 kg of CO2. The profit per unit of Product C is $60, and the environmental impact per unit is 2.5 kg of CO2. The profit per unit of Product D is $80, and the environmental impact per unit is 4 kg of CO2. The profit per unit of Product E is $90, and the environmental impact per unit is 5 kg of CO2. The company wants to maximize the Profit-Environmental Impact ratio, which is defined as the total profit divided by the total environmental impact. The company has a total production capacity of 2000 units across all products. Please help the company determine the optimal amount of each product to produce to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nImpact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n## the objective function is: Maximize Profit / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Profit)\n\n# Add constraints\n## The company has a total production capacity of 2000 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 2000 units for all components combined.\n// E1 + E2 + E3 + E4 + E5 <= 2000",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations. The production cost, selling price, and storage cost per unit for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Storage Cost per Unit per Month |\n|-----------|-----------------|---------------|--------------------------------|\n| E1        | $10             | $20           | $1                             |\n| E2        | $15             | $25           | $1.5                           |\n| E3        | $20             | $30           | $2                             |\n| E4        | $25             | $35           | $2.5                           |\n| E5        | $30             | $40           | $3                             |\n\nThe company has a budget of $50,000 for production costs next month. The company also has a storage capacity of 2000 units for all components combined. The company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n\nPlease help the company determine the optimal production quantity for each component to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n## Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n## Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n## Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n## Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n## So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nmodel.addCons(obj == (20 - 10 - E1) * E1 + (25 - 15 - 1.5 * E2) * E2 + (30 - 20 - 2 * E3) * E3 + (35 - 25 - 2.5 * E4) * E4 + (40 - 30 - 3 * E5) * E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n## The company has a storage capacity of 2000 units for all components combined.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while considering the efficiency of each plant. The efficiency of each plant is affected by the investment in maintenance and upgrades, which can be different for each type of plant.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in maintenance for Solar\": \"SolarInvestment\", \"range\": \"SolarInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Wind\": \"WindInvestment\", \"range\": \"WindInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for Hydro\": \"HydroInvestment\", \"range\": \"HydroInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company aims to maximize the total daily energy production.\n// Energy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\n// Energy_Wind = (150 + 0.015 * WindInvestment) * WindHours\n// Energy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance and upgrades across all plants.\n// SolarInvestment + WindInvestment + HydroInvestment <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily and the investment in maintenance and upgrades for each plant to maximize energy production. The energy production of each plant increases nonlinearly with the investment in maintenance and upgrades. For Solar, each $1000 investment increases the energy output by 1% per hour. For Wind, each $1000 investment increases the energy output by 1.5% per hour. For Hydro, each $1000 investment increases the energy output by 0.8% per hour. The company has a total budget of $100,000 for maintenance and upgrades across all plants. The total operating hours for all plants must not exceed 24 hours per day. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of operating hours for Hydro\nSolarInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarInvestment\", lb=0)  # investment in maintenance for Solar\nWindInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindInvestment\", lb=0)  # investment in maintenance for Wind\nHydroInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroInvestment\", lb=0)  # investment in maintenance for Hydro\n\n# Define objective function\nEnergy_Solar = (100 + 0.01 * SolarInvestment) * SolarHours\nEnergy_Wind = (150 + 0.015 * WindInvestment) * WindHours\nEnergy_Hydro = (200 + 0.008 * HydroInvestment) * HydroHours\n# So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for maintenance and upgrades across all plants.\nmodel.addCons(SolarInvestment + WindInvestment + HydroInvestment <= 100000)\n# The total operating hours for all plants must not exceed 24 hours per day.\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Maintenance for Solar: \", model.getVal(SolarInvestment))\n    print(\"Investment in Maintenance for Wind: \", model.getVal(WindInvestment))\n    print(\"Investment in Maintenance for Hydro: \", model.getVal(HydroInvestment))\n    print(\"Total Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Each product requires a specific amount of raw materials and labor hours. Additionally, the company is considering investing in automation technology for each product, which will reduce the labor hours required per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for product A\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product B\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product C\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product D\": \"AutomationD\", \"range\": \"AutomationD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per unit for each product decreases by 1 hour for every $10,000 invested in automation for that product. The initial labor cost per unit for product A is 5 hours, for product B is 6 hours, for product C is 7 hours, and for product D is 8 hours. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\n// Total profit for product B: ProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\n// Total profit for product C: ProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\n// Total profit for product D: ProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for automation investments.\n// AutomationA + AutomationB + AutomationC + AutomationD <= 100000\n\n## Generate Constraint-2:\nThe total labor hours available for the quarter are 10,000 hours.\n// 5 * A + 6 * B + 7 * C + 8 * D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product A and 300 units of product B.\n// A >= 500; B >= 300\n\n## Generate Constraint-4:\nThe total raw materials cost for producing product C and D cannot exceed $20,000.\n// (Cost per unit of C * C) + (Cost per unit of D * D) <= 20000\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter, considering the investment in automation technology for each product which reduces the labor hours required per unit. The initial labor cost per unit for product A is 5 hours, for product B is 6 hours, for product C is 7 hours, and for product D is 8 hours. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for automation investments. The total labor hours available for the quarter are 10,000 hours. The company must produce at least 500 units of product A and 300 units of product B. The total raw materials cost for producing product C and D cannot exceed $20,000. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. Please help the company to determine the optimal production quantities and automation investments to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for product A\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for product B\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for product C\nAutomationD = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationD\", lb=0) # investment in automation for product D\n\n# Define objective function\nProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\nProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\nProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\nProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $100,000 for automation investments.\nmodel.addCons(AutomationA + AutomationB + AutomationC + AutomationD <= 100000)\n# The total labor hours available for the quarter are 10,000 hours.\nmodel.addCons(5 * A + 6 * B + 7 * C + 8 * D <= 10000)\n# The company must produce at least 500 units of product A and 300 units of product B.\n# The total raw materials cost for producing product C and D cannot exceed $20,000.\n# Assuming cost per unit of C and D are constants, denoted as CostC and CostD\nCostC = model.addVar(vtype=\"CONTINUOUS\", name=\"CostC\")\nCostD = model.addVar(vtype=\"CONTINUOUS\", name=\"CostD\")\nmodel.addCons(CostC * C + CostD * D <= 20000)\n# The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Automation for Product A: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for Product B: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for Product C: \", model.getVal(AutomationC))\n    print(\"Investment in Automation for Product D: \", model.getVal(AutomationD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and delivery speed. \n- Truck 1 consumes 10 liters per trip and delivers in 2 hours.\n- Truck 2 consumes 12 liters per trip and delivers in 1.5 hours.\n- Truck 3 consumes 15 liters per trip and delivers in 1 hour.\n- Truck 4 consumes 18 liters per trip and delivers in 1.2 hours.\n- Truck 5 consumes 20 liters per trip and delivers in 0.8 hours.\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour.\n// Total fuel cost: FuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n// Total delay time: DelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\n// Total operational cost: OperationalCost = FuelCost + DelayTime * $50\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe total number of trips required across all trucks must be at least 100.\n// T1 + T2 + T3 + T4 + T5 >= 100\n\n## Generate Constraint-2:\nEach truck can make a maximum of 30 trips due to maintenance and driver availability.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes. Each truck has a different fuel efficiency and delivery speed:\n- Truck 1 consumes 10 liters per trip and delivers in 2 hours.\n- Truck 2 consumes 12 liters per trip and delivers in 1.5 hours.\n- Truck 3 consumes 15 liters per trip and delivers in 1 hour.\n- Truck 4 consumes 18 liters per trip and delivers in 1.2 hours.\n- Truck 5 consumes 20 liters per trip and delivers in 0.8 hours.\nThe company aims to minimize the total operational cost, which includes the sum of fuel costs and the cost of delayed deliveries, calculated as the product of the total delay time and a fixed rate of $50 per hour.\nThe total number of trips required across all trucks must be at least 100. Each truck can make a maximum of 30 trips due to maintenance and driver availability. The company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters.\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=30) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=30) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=30) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=30) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=30) # number of trips for truck 5\n\n# Define objective function\n## Total fuel cost\nFuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n## Total delay time\nDelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\n## Total operational cost\nOperationalCost = FuelCost + DelayTime * 50\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize OperationalCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The total number of trips required across all trucks must be at least 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 100)\n## The company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported.\n// Revenue_A = 1000 * TrucksA * TripsA\n// Revenue_B = 1500 * TrucksB * TripsB\n// Revenue_C = 2000 * TrucksC * TripsC\n// Cost_A = 200 * TrucksA * TripsA\n// Cost_B = 300 * TrucksB * TripsB\n// Cost_C = 400 * TrucksC * TripsC\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total number of trips per day across all goods must not exceed 100.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $15000.\n// 200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000\n\n## Generate Constraint-4:\nThe total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 12",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints. The revenue generated per trip and the fuel cost per trip for each type of good are given in the following Table.\n\n| Good | Revenue per Trip | Fuel Cost per Trip |\n|------|------------------|--------------------|\n| A    | $1000            | $200               |\n| B    | $1500            | $300               |\n| C    | $2000            | $400               |\n\nThe company has a total of 50 trucks available. The total number of trips per day across all goods must not exceed 100. The company has a daily fuel budget of $15000. The total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour. \nPlease help the company to maximize the net daily revenue from all goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Good A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Good B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Good C\n\n# Define objective function\nRevenue_A = 1000 * TrucksA * TripsA\nRevenue_B = 1500 * TrucksB * TripsB\nRevenue_C = 2000 * TrucksC * TripsC\nCost_A = 200 * TrucksA * TripsA\nCost_B = 300 * TrucksB * TripsB\nCost_C = 400 * TrucksC * TripsC\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The total number of trips per day across all goods must not exceed 100.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\n# The company has a daily fuel budget of $15000.\nmodel.addCons(200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000)\n# The total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Good A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Good B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Good C: \", model.getVal(TripsC))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each route is determined by the number of packages delivered per fuel consumption. \nOn route 1, each truck delivers 100 packages and consumes 10 liters of fuel. \nOn route 2, each truck delivers 120 packages and consumes 12 liters of fuel. \nOn route 3, each truck delivers 150 packages and consumes 15 liters of fuel. \nOn route 4, each truck delivers 180 packages and consumes 18 liters of fuel. \nOn route 5, each truck delivers 200 packages and consumes 20 liters of fuel. \nThe company wants to maximize the total delivery efficiency (total packages delivered per total fuel consumed).\n// Efficiency_R1 = 100 * T1 / (10 * T1)\n// Efficiency_R2 = 120 * T2 / (12 * T2)\n// Efficiency_R3 = 150 * T3 / (15 * T3)\n// Efficiency_R4 = 180 * T4 / (18 * T4)\n// Efficiency_R5 = 200 * T5 / (20 * T5)\n// So, the objective function is: Maximize (Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n// Maximize (100 * T1 / (10 * T1) + 120 * T2 / (12 * T2) + 150 * T3 / (15 * T3) + 180 * T4 / (18 * T4) + 200 * T5 / (20 * T5))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 10 trucks.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe total fuel consumption across all routes must not exceed 800 liters.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 800",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. The efficiency of each route is determined by the number of packages delivered per fuel consumption. The details of each route are given in the following Table.\n\n| Route | Packages Delivered per Truck | Fuel Consumed per Truck |\n|-------|------------------------------|-------------------------|\n| 1     | 100                          | 10 liters               |\n| 2     | 120                          | 12 liters               |\n| 3     | 150                          | 15 liters               |\n| 4     | 180                          | 18 liters               |\n| 5     | 200                          | 20 liters               |\n\nThe company has a total of 50 trucks available. Each route can handle a maximum of 10 trucks. The total fuel consumption across all routes must not exceed 800 liters. \n\nPlease help the company to maximize the total delivery efficiency (total packages delivered per total fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * T1 / (10 * T1) + 120 * T2 / (12 * T2) + 150 * T3 / (15 * T3) + 180 * T4 / (18 * T4) + 200 * T5 / (20 * T5))\n## convert the division to multiplication\nmodel.addCons(obj * (10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5) == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## Each route can handle a maximum of 10 trucks.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n## The total fuel consumption across all routes must not exceed 800 liters.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable, non-perishable, and hazardous materials. The company needs to determine the number of trucks to allocate for each type of goods to maximize efficiency and minimize costs.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"cost per mile for perishable goods\": \"CostPerishable\", \"range\": \"CostPerishable >= 0\", \"type\": \"real\"}\n// {\"cost per mile for non-perishable goods\": \"CostNonPerishable\", \"range\": \"CostNonPerishable >= 0\", \"type\": \"real\"}\n// {\"cost per mile for hazardous materials\": \"CostHazardous\", \"range\": \"CostHazardous >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost per mile for transporting perishable goods is $2, for non-perishable goods is $1.5, and for hazardous materials is $3. The company wants to minimize the total cost of transportation per mile.\n// Total cost for perishable goods: Cost_Perishable = CostPerishable * PerishableTrucks\n// Total cost for non-perishable goods: Cost_NonPerishable = CostNonPerishable * NonPerishableTrucks\n// Total cost for hazardous materials: Cost_Hazardous = CostHazardous * HazardousTrucks\n// So, the objective function is: Minimize (Cost_Perishable + Cost_NonPerishable + Cost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable, non-perishable, and hazardous materials. The company needs to determine the number of trucks to allocate for each type of goods to maximize efficiency and minimize costs. The cost per mile for transporting each type of goods is given in the following Table.\n\n| Type of Goods       | Cost per Mile |\n|---------------------|--------------|\n| Perishable Goods    | $2           |\n| Non-Perishable Goods| $1.5         |\n| Hazardous Materials | $3           |\n\nThe company has a total of 50 trucks available. Please help the company to minimize the total cost of transportation per mile.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0) # number of trucks for perishable goods\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0) # number of trucks for non-perishable goods\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0) # number of trucks for hazardous materials\n\n# Define objective function\nCost_Perishable = 2 * PerishableTrucks\nCost_NonPerishable = 1.5 * NonPerishableTrucks\nCost_Hazardous = 3 * HazardousTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Perishable + Cost_NonPerishable + Cost_Hazardous)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Non-Perishable Goods: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 693,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone A\": \"ZoneA\", \"range\": \"ZoneA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"ZoneB\", \"range\": \"ZoneB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"ZoneC\", \"range\": \"ZoneC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"ZoneD\", \"range\": \"ZoneD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"ZoneE\", \"range\": \"ZoneE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost.\n// Total energy production: Energy = 80% * ZoneA + 75% * ZoneB + 70% * ZoneC + 65% * ZoneD + 60% * ZoneE\n// Total installation cost: Cost = $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE <= $100000\n\n## Generate Constraint-2:\nThere is a maximum capacity of 100 panels that can be installed in each zone.\n// ZoneA <= 100\n// ZoneB <= 100\n// ZoneC <= 100\n// ZoneD <= 100\n// ZoneE <= 100\n\n## Generate Constraint-3:\nThe city requires at least 300 panels to be installed across all zones.\n// ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300\n\n## Generate Constraint-4:\nThe city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone A.\n// $1000 * ZoneA >= 0.2 * $100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs. The efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city has a budget of $100,000 for the installation of solar panels and a maximum capacity of 100 panels that can be installed in each zone. The city requires at least 300 panels to be installed across all zones and wants to ensure that at least 20% of the total budget is spent on solar panels in Zone A.\n\nPlease help the city to maximize the total energy production while minimizing the total installation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA = model.addVar(vtype=\"INTEGER\", name=\"ZoneA\", lb=0)\nZoneB = model.addVar(vtype=\"INTEGER\", name=\"ZoneB\", lb=0)\nZoneC = model.addVar(vtype=\"INTEGER\", name=\"ZoneC\", lb=0)\nZoneD = model.addVar(vtype=\"INTEGER\", name=\"ZoneD\", lb=0)\nZoneE = model.addVar(vtype=\"INTEGER\", name=\"ZoneE\", lb=0)\n\n# Define objective function\nEnergy = 0.8 * ZoneA + 0.75 * ZoneB + 0.7 * ZoneC + 0.65 * ZoneD + 0.6 * ZoneE\nCost = 1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\nmodel.addCons(1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE <= 100000)\nmodel.addCons(ZoneA <= 100)\nmodel.addCons(ZoneB <= 100)\nmodel.addCons(ZoneC <= 100)\nmodel.addCons(ZoneD <= 100)\nmodel.addCons(ZoneE <= 100)\nmodel.addCons(ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300)\nmodel.addCons(1000 * ZoneA >= 0.2 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(ZoneA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(ZoneB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(ZoneC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(ZoneD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(ZoneE))\n    print(\"Maximized Energy - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed1\", \"range\": \"0 < Speed1 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed2\", \"range\": \"0 < Speed2 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed3\", \"range\": \"0 < Speed3 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region4\": \"Speed4\", \"range\": \"0 < Speed4 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region5\": \"Speed5\", \"range\": \"0 < Speed5 < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions.\n// Total fuel consumption in Region1: Fuel1 = 0.05 * Speed1^2 * Trucks1\n// Total fuel consumption in Region2: Fuel2 = 0.055 * Speed2^2 * Trucks2\n// Total fuel consumption in Region3: Fuel3 = 0.06 * Speed3^2 * Trucks3\n// Total fuel consumption in Region4: Fuel4 = 0.065 * Speed4^2 * Trucks4\n// Total fuel consumption in Region5: Fuel5 = 0.07 * Speed5^2 * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the speed of trucks in each region must not exceed 80 km/h.\n// Speed1 <= 80; Speed2 <= 80; Speed3 <= 80; Speed4 <= 80; Speed5 <= 80",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the optimal number of trucks to allocate to each region and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs. The fuel consumption rate (in gallons per hour) for a truck in each region is modeled by a quadratic function of its speed, as shown in the following Table.\n\n| Region   | Fuel Consumption Rate (gallons/hour) |\n|----------|-------------------------------------|\n| Region1  | 0.05 * Speed1^2                    |\n| Region2  | 0.055 * Speed2^2                   |\n| Region3  | 0.06 * Speed3^2                    |\n| Region4  | 0.065 * Speed4^2                   |\n| Region5  | 0.07 * Speed5^2                    |\n\nThe company has a total of 50 trucks available for allocation. Due to regional regulations, the speed of trucks in each region must not exceed 80 km/h. Please help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of trucks in Region1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of trucks in Region2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of trucks in Region3\nSpeed4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed4\", lb=0, ub=100)  # speed of trucks in Region4\nSpeed5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed5\", lb=0, ub=100)  # speed of trucks in Region5\n\n# Define objective function\nFuel1 = 0.05 * Speed1**2 * Trucks1\nFuel2 = 0.055 * Speed2**2 * Trucks2\nFuel3 = 0.06 * Speed3**2 * Trucks3\nFuel4 = 0.065 * Speed4**2 * Trucks4\nFuel5 = 0.07 * Speed5**2 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 80)\nmodel.addCons(Speed3 <= 80)\nmodel.addCons(Speed4 <= 80)\nmodel.addCons(Speed5 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed3))\n    print(\"Speed of Trucks in Region4: \", model.getVal(Speed4))\n    print(\"Speed of Trucks in Region5: \", model.getVal(Speed5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n// LaborA = 2 * UnitsA\n// LaborB = 3 * UnitsB\n// LaborC = 4 * UnitsC\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// UnitsA >= 50\n// UnitsB >= 30\n\n## Generate Constraint-4:\nThe company has a storage capacity limit that allows for a maximum of 200 units in total across all devices.\n// UnitsA + UnitsB + UnitsC <= 200\n\n## Generate Constraint-5:\nTo maintain a balanced product portfolio, the company aims to produce at least twice as many units of DeviceC as DeviceA.\n// UnitsC >= 2 * UnitsA",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n\n| Device | Profit per Unit | Labor Hours per Unit |\n|--------|-----------------|----------------------|\n| DeviceA | $100            | 2 hours              |\n| DeviceB | $150            | 3 hours              |\n| DeviceC | $200            | 4 hours              |\n\nThe company has a total of 1000 labor hours available for the month. The production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit. Due to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB. The company has a storage capacity limit that allows for a maximum of 200 units in total across all devices. To maintain a balanced product portfolio, the company aims to produce at least twice as many units of DeviceC as DeviceA.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device and the corresponding labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)    # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0) # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0) # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0) # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 labor hours available for the month.\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n# The production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\nmodel.addCons(LaborA == 2 * UnitsA)\nmodel.addCons(LaborB == 3 * UnitsB)\nmodel.addCons(LaborC == 4 * UnitsC)\n# Due to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 30)\n# The company has a storage capacity limit that allows for a maximum of 200 units in total across all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 200)\n# To maintain a balanced product portfolio, the company aims to produce at least twice as many units of DeviceC as DeviceA.\nmodel.addCons(UnitsC >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor Hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor Hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1565,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a cost per trip based on fuel and maintenance. The costs are as follows: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported.\n// Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// The objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trips must be at least 50 to meet the demand.\n// T1 + T2 + T3 + T4 + T5 >= 50\n\n## Generate Constraint-2:\nEach truck has a maximum capacity for trips per month. Truck1 can make up to 10 trips, Truck2 up to 12 trips, Truck3 up to 15 trips, Truck4 up to 18 trips, and Truck5 up to 20 trips.\n// T1 <= 10; T2 <= 12; T3 <= 15; T4 <= 18; T5 <= 20",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations. Each truck incurs a cost per trip based on fuel and maintenance: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported. The total number of trips must be at least 50 to meet the demand. Each truck has a maximum capacity for trips per month: Truck1 can make up to 10 trips, Truck2 up to 12 trips, Truck3 up to 15 trips, Truck4 up to 18 trips, and Truck5 up to 20 trips. Please help the company determine the optimal number of trips for each truck to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=10) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=12) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=15) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=18) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trips for Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize Total cost\nTotal_cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\nmodel.addCons(obj == Total_cost)\n\n# Add constraints\n## The total number of trips must be at least 50 to meet the demand.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the annual operating cost is $50,000, the fuel efficiency is 5 km/l, and the capacity is 10 tons.\nFor TruckB, the annual operating cost is $60,000, the fuel efficiency is 6 km/l, and the capacity is 12 tons.\nFor TruckC, the annual operating cost is $70,000, the fuel efficiency is 7 km/l, and the capacity is 14 tons.\nFor TruckD, the annual operating cost is $80,000, the fuel efficiency is 8 km/l, and the capacity is 16 tons.\nFor TruckE, the annual operating cost is $90,000, the fuel efficiency is 9 km/l, and the capacity is 18 tons.\nThe company wants to minimize the total cost per ton-kilometer.\n// Total cost for TruckA: Cost_TruckA = 50,000 * TruckA\n// Total cost for TruckB: Cost_TruckB = 60,000 * TruckB\n// Total cost for TruckC: Cost_TruckC = 70,000 * TruckC\n// Total cost for TruckD: Cost_TruckD = 80,000 * TruckD\n// Total cost for TruckE: Cost_TruckE = 90,000 * TruckE\n// Total ton-kilometers for TruckA: TonKm_TruckA = 10 * 5 * TruckA\n// Total ton-kilometers for TruckB: TonKm_TruckB = 12 * 6 * TruckB\n// Total ton-kilometers for TruckC: TonKm_TruckC = 14 * 7 * TruckC\n// Total ton-kilometers for TruckD: TonKm_TruckD = 16 * 8 * TruckD\n// Total ton-kilometers for TruckE: TonKm_TruckE = 18 * 9 * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $1,500,000 for purchasing new trucks.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD + 90,000 * TruckE <= 1,500,000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 1000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes. The annual operating cost, fuel efficiency, and capacity for each truck are given in the following Table.\n\n| Vehicle | Annual Operating Cost | Fuel Efficiency | Capacity |\n|---------|-----------------------|-----------------|----------|\n| TruckA  | $50,000               | 5 km/l          | 10 tons  |\n| TruckB  | $60,000               | 6 km/l          | 12 tons  |\n| TruckC  | $70,000               | 7 km/l          | 14 tons  |\n| TruckD  | $80,000               | 8 km/l          | 16 tons  |\n| TruckE  | $90,000               | 9 km/l          | 18 tons  |\n\nThe company has a budget of $1,500,000 for purchasing new trucks. The total capacity of all trucks must be at least 1000 tons. The company wants to minimize the total cost per ton-kilometer.\n\nPlease help the company determine the optimal number of each type of truck to purchase to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = 50000 * TruckA\nCost_TruckB = 60000 * TruckB\nCost_TruckC = 70000 * TruckC\nCost_TruckD = 80000 * TruckD\nCost_TruckE = 90000 * TruckE\nTonKm_TruckA = 10 * 5 * TruckA\nTonKm_TruckB = 12 * 6 * TruckB\nTonKm_TruckC = 14 * 7 * TruckC\nTonKm_TruckD = 16 * 8 * TruckD\nTonKm_TruckE = 18 * 9 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE) == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $1,500,000 for purchasing new trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 1500000)\n## The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. The resource allocation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each product, which influences the sales rate.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * ResourcesA, for ProductB is $60 - 0.01 * ResourcesB, and for ProductC is $70 - 0.01 * ResourcesC. The sales price per unit is $100 for all products. The sales rate per unit is 1 + 0.005 * MarketingA for ProductA, 1 + 0.005 * MarketingB for ProductB, and 1 + 0.005 * MarketingC for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 * (1 + 0.005 * MarketingA) - (50 - 0.01 * ResourcesA)) * UnitsA\n// Total profit for ProductB: ProfitB = (100 * (1 + 0.005 * MarketingB) - (60 - 0.01 * ResourcesB)) * UnitsB\n// Total profit for ProductC: ProfitC = (100 * (1 + 0.005 * MarketingC) - (70 - 0.01 * ResourcesC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource allocation across all products cannot exceed 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products cannot exceed $5000.\n// MarketingA + MarketingB + MarketingC <= 5000\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC.\n// UnitsA <= 500; UnitsB <= 400; UnitsC <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 150 units of ProductB are produced.\n// UnitsA >= 100; UnitsB >= 150\n\n## Generate Constraint-5:\nThe production rate of each product is limited by the resource allocation, with a maximum production rate of 10 units per unit of resource for ProductA, 8 units per unit of resource for ProductB, and 12 units per unit of resource for ProductC.\n// UnitsA <= 10 * ResourcesA; UnitsB <= 8 * ResourcesB; UnitsC <= 12 * ResourcesC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. The resource allocation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each product, which influences the sales rate. The production cost per unit, sales price per unit, and sales rate per unit for each product are given in the following Table.\n\n| Product | Production Cost Per Unit | Sales Price Per Unit | Sales Rate Per Unit |\n|---------|--------------------------|----------------------|---------------------|\n| ProductA | $50 - 0.01 * ResourcesA | $100                 | 1 + 0.005 * MarketingA |\n| ProductB | $60 - 0.01 * ResourcesB | $100                 | 1 + 0.005 * MarketingB |\n| ProductC | $70 - 0.01 * ResourcesC | $100                 | 1 + 0.005 * MarketingC |\n\nThe company aims to maximize the total profit from all products. The total resource allocation across all products cannot exceed 1000 units. The total marketing budget for all products cannot exceed $5000. The company has a production capacity limit of 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC. The company must ensure that at least 100 units of ProductA and 150 units of ProductB are produced. The production rate of each product is limited by the resource allocation, with a maximum production rate of 10 units per unit of resource for ProductA, 8 units per unit of resource for ProductB, and 12 units per unit of resource for ProductC.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100, ub=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=150, ub=400)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=300)  # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resource allocation for ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resource allocation for ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resource allocation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (100 * (1 + 0.005 * MarketingA) - (50 - 0.01 * ResourcesA)) * UnitsA\nProfitB = (100 * (1 + 0.005 * MarketingB) - (60 - 0.01 * ResourcesB)) * UnitsB\nProfitC = (100 * (1 + 0.005 * MarketingC) - (70 - 0.01 * ResourcesC)) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 5000)\nmodel.addCons(UnitsA <= 10 * ResourcesA)\nmodel.addCons(UnitsB <= 8 * ResourcesB)\nmodel.addCons(UnitsC <= 12 * ResourcesC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resource Allocation for ProductA: \", model.getVal(ResourcesA))\n    print(\"Resource Allocation for ProductB: \", model.getVal(ResourcesB))\n    print(\"Resource Allocation for ProductC: \", model.getVal(ResourcesC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1745,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and production cost. The profit margin for product A is 10%, for B is 15%, for C is 20%, and for D is 25%. The production cost for each unit of product A is $50, for B is $70, for C is $90, and for D is $110. The company aims to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n// Profit of A: Profit_A = 0.10 * 50 * A = 5 * A\n// Profit of B: Profit_B = 0.15 * 70 * B = 10.5 * B\n// Profit of C: Profit_C = 0.20 * 90 * C = 18 * C\n// Profit of D: Profit_D = 0.25 * 110 * D = 27.5 * D\n// So, the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / (50 * A + 70 * B + 90 * C + 110 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C + 110 * D <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a limited production capacity of 150 hours. The production time for each unit of product A is 1 hour, for B is 2 hours, for C is 3 hours, and for D is 4 hours.\n// A + 2 * B + 3 * C + 4 * D <= 150",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations. The profit margin and production cost for each product are given in the following Table.\n\n| Product | Profit Margin | Production Cost per Unit | Production Time per Unit |\n|---------|---------------|--------------------------|--------------------------|\n| A       | 10%           | $50                      | 1 hour                   |\n| B       | 15%           | $70                      | 2 hours                  |\n| C       | 20%           | $90                      | 3 hours                  |\n| D       | 25%           | $110                     | 4 hours                  |\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each product. The company has a limited production capacity of 150 hours. \n\nPlease help the company to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10.5 * B\nProfit_C = 18 * C\nProfit_D = 27.5 * D\nProductionCost = 50 * A + 70 * B + 90 * C + 110 * D\n## the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / ProductionCost\n## convert the division to multiplication\nmodel.addCons(obj * ProductionCost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D <= 10000)\n## The company has a limited production capacity of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints.\n// {\"number of DeviceA\": \"DeviceANum\", \"range\": \"DeviceANum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceBNum\", \"range\": \"DeviceBNum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceCNum\", \"range\": \"DeviceCNum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company aims to maximize the total profit.\n// Profit_DeviceA = (100 - 50) * DeviceANum\n// Profit_DeviceB = (150 - 75) * DeviceBNum\n// Profit_DeviceC = (200 - 100) * DeviceCNum\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// DeviceANum + DeviceBNum + DeviceCNum <= 500\n\n## Generate Constraint-2:\nDue to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBNum <= 2 * DeviceANum\n\n## Generate Constraint-3:\nThe market demand for DeviceC is limited to 150 units per month.\n// DeviceCNum <= 150\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceA to fulfill a contract.\n// DeviceANum >= 50\n\n## Generate Constraint-5:\nThe total production cost must not exceed $25,000 per month.\n// 50 * DeviceANum + 75 * DeviceBNum + 100 * DeviceCNum <= 25000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints. The profit per unit, production cost per unit, and market demand for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Market Demand |\n|--------|-----------------|--------------------------|---------------|\n| DeviceA | $100            | $50                      | No limit      |\n| DeviceB | $150            | $75                      | No limit      |\n| DeviceC | $200            | $100                     | 150 units     |\n\nThe company has a total production capacity of 500 units per month. Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA. The company must produce at least 50 units of DeviceA to fulfill a contract. The total production cost must not exceed $25,000 per month.\n\nPlease help the company to maximize the total profit by determining the optimal number of each device to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceANum = model.addVar(vtype=\"INTEGER\", name=\"DeviceANum\", lb=50) # number of DeviceA\nDeviceBNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceBNum\", lb=0) # number of DeviceB\nDeviceCNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceCNum\", lb=0, ub=150) # number of DeviceC\n\n# Define objective function\nProfit_DeviceA = (100 - 50) * DeviceANum\nProfit_DeviceB = (150 - 75) * DeviceBNum\nProfit_DeviceC = (200 - 100) * DeviceCNum\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 500 units per month.\nmodel.addCons(DeviceANum + DeviceBNum + DeviceCNum <= 500)\n# Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBNum <= 2 * DeviceANum)\n# The market demand for DeviceC is limited to 150 units per month.\nmodel.addCons(DeviceCNum <= 150)\n# The company must produce at least 50 units of DeviceA to fulfill a contract.\nmodel.addCons(DeviceANum >= 50)\n# The total production cost must not exceed $25,000 per month.\nmodel.addCons(50 * DeviceANum + 75 * DeviceBNum + 100 * DeviceCNum <= 25000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceANum))\n    print(\"Number of DeviceB: \", model.getVal(DeviceBNum))\n    print(\"Number of DeviceC: \", model.getVal(DeviceCNum))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The production process involves a nonlinear relationship between the quantity produced and the cost.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\nThe profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\nThe profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// ProductA + ProductB + ProductC <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The profit for each product is given by the following functions:\n\n- Profit for product A: Profit_A = 100 * ProductA - 0.5 * ProductA^2\n- Profit for product B: Profit_B = 150 * ProductB - 0.4 * ProductB^2\n- Profit for product C: Profit_C = 200 * ProductC - 0.3 * ProductC^2\n\nThe company wants to maximize the total profit from all products. The total production capacity of the company is 100 units per day.\n\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## The profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\n## The profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\n## The profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\nProfit_A = 100 * ProductA - 0.5 * ProductA**2\nProfit_B = 150 * ProductB - 0.4 * ProductB**2\nProfit_C = 200 * ProductC - 0.3 * ProductC**2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also considers investing in fuel-efficient technologies for each type of truck.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for City1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from the trips. The profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $120, and to City5 is $180. The investment in fuel-efficient technology reduces the fuel cost per trip by $5 for every $100 invested. The company wants to maximize the total profit from all trips.\n// Profit_City1 = (100 - 0.05 * Tech1) * Trips1\n// Profit_City2 = (150 - 0.05 * Tech2) * Trips2\n// Profit_City3 = (200 - 0.05 * Tech3) * Trips3\n// Profit_City4 = (120 - 0.05 * Tech4) * Trips4\n// Profit_City5 = (180 - 0.05 * Tech5) * Trips5\n// So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The operational cost per trip to City1 is $30, to City2 is $40, to City3 is $50, to City4 is $35, and to City5 is $45.\n// 30 * Trips1 + 40 * Trips2 + 50 * Trips3 + 35 * Trips4 + 45 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also considers investing in fuel-efficient technologies for each type of truck. The profit per trip and the operational cost per trip for each city are given in the following Table.\n\n| Destination | Profit per Trip | Operational Cost per Trip |\n|-------------|-----------------|---------------------------|\n| City1       | $100            | $30                       |\n| City2       | $150            | $40                       |\n| City3       | $200            | $50                       |\n| City4       | $120            | $35                       |\n| City5       | $180            | $45                       |\n\nThe investment in fuel-efficient technology reduces the fuel cost per trip by $5 for every $100 invested. The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. \n\nPlease help the company to maximize its profit from the trips by determining the optimal number of trips to each city and the investment in fuel-efficient technology for each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for City1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for City2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for City3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for City4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for City5\n\n# Define objective function\nProfit_City1 = (100 - 0.05 * Tech1) * Trips1\nProfit_City2 = (150 - 0.05 * Tech2) * Trips2\nProfit_City3 = (200 - 0.05 * Tech3) * Trips3\nProfit_City4 = (120 - 0.05 * Tech4) * Trips4\nProfit_City5 = (180 - 0.05 * Tech5) * Trips5\n# So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n# Add constraints\n# The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(30 * Trips1 + 40 * Trips2 + 50 * Trips3 + 35 * Trips4 + 45 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Number of Trips to City4: \", model.getVal(Trips4))\n    print(\"Number of Trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in Tech for City1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for City2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for City3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for City4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for City5: \", model.getVal(Tech5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company also needs to decide on the maintenance budget for each vehicle type to optimize their performance and longevity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Trucks\": \"MaintenanceT\", \"range\": \"MaintenanceT >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Vans\": \"MaintenanceV\", \"range\": \"MaintenanceV >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Bikes\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of Trucks is $100 per day, and with additional maintenance, the cost decreases by $1 for every $100 spent on maintenance.\nThe operational cost of Vans is $70 per day, and with additional maintenance, the cost decreases by $0.7 for every $100 spent on maintenance.\nThe operational cost of Bikes is $30 per day, and with additional maintenance, the cost decreases by $0.3 for every $100 spent on maintenance.\nThe company aims to minimize the total daily operational cost of all vehicles.\n// Total daily cost for Trucks: CostT = 100 - 0.01 * MaintenanceT\n// Total daily cost for Vans: CostV = 70 - 0.007 * MaintenanceV\n// Total daily cost for Bikes: CostB = 30 - 0.003 * MaintenanceB\n// So, the objective function is: Minimize (CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle purchases and maintenance.\n// 100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 500.\n// Trucks + Vans + Bikes <= 500",
        "question": "A logistics company is planning its fleet for the next quarter and operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities, and the company needs to decide on the maintenance budget for each vehicle type to optimize their performance and longevity. The operational cost of Trucks is $100 per day, which decreases by $1 for every $100 spent on maintenance. The operational cost of Vans is $70 per day, which decreases by $0.7 for every $100 spent on maintenance. The operational cost of Bikes is $30 per day, which decreases by $0.3 for every $100 spent on maintenance. The company aims to minimize the total daily operational cost of all vehicles. The company has a total budget of $100,000 for vehicle purchases and maintenance, and the total number of vehicles cannot exceed 500. Please help the company to determine the optimal number of each vehicle type and their respective maintenance budgets to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nMaintenanceT = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceT\", lb=0)  # maintenance budget for Trucks\nMaintenanceV = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceV\", lb=0)  # maintenance budget for Vans\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance budget for Bikes\n\n# Define objective function\nCostT = 100 - 0.01 * MaintenanceT\nCostV = 70 - 0.007 * MaintenanceV\nCostB = 30 - 0.003 * MaintenanceB\n# So, the objective function is: Minimize (CostT * Trucks + CostV * Vans + CostB * Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n# Add constraints\n# The company has a total budget of $100,000 for vehicle purchases and maintenance.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000)\n# The total number of vehicles cannot exceed 500.\nmodel.addCons(Trucks + Vans + Bikes <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maintenance Budget for Trucks: \", model.getVal(MaintenanceT))\n    print(\"Maintenance Budget for Vans: \", model.getVal(MaintenanceV))\n    print(\"Maintenance Budget for Bikes: \", model.getVal(MaintenanceB))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints.\n// {\"production quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_ProductA = (50 - 10) * ProductA\n// Total net profit for ProductB: Profit_ProductB = (70 - 15) * ProductB\n// Total net profit for ProductC: Profit_ProductC = (90 - 20) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40.\n// 20 * ProductA + 30 * ProductB + 40 * ProductC <= 20,000\n\n## Generate Constraint-4:\nTo maintain market presence, the company must produce at least 50 units of each product.\n// ProductA >= 50; ProductB >= 50; ProductC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints. The profit per unit, storage cost per unit, and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit | Production Cost per Unit |\n|---------|-----------------|-----------------------|--------------------------|\n| ProductA | $50             | $10                   | $20                      |\n| ProductB | $70             | $15                   | $30                      |\n| ProductC | $90             | $20                   | $40                      |\n\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total. Due to market demand, the production of ProductB must be at least twice the production of ProductA. The company has a fixed budget for production costs, which is $20,000. To maintain market presence, the company must produce at least 50 units of each product.\n\nPlease help the company to maximize the total net profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50) # production quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50) # production quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50) # production quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 10) * ProductA\nProfit_ProductB = (70 - 15) * ProductB\nProfit_ProductC = (90 - 20) * ProductC\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited warehouse space, which can store a maximum of 1000 units in total.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# Due to market demand, the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductB >= 2 * ProductA)\n# The company has a fixed budget for production costs, which is $20,000.\nmodel.addCons(20 * ProductA + 30 * ProductB + 40 * ProductC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a specific amount of raw materials and labor hours. The company needs to determine the optimal production quantities for each product to maximize profit while considering the constraints on raw materials and labor hours.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, due to market saturation, the profit per unit decreases by $0.10 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sales of these products.\n// Profit_A = max(50 - 0.10 * (ProductA - 100), 50) * ProductA\n// Profit_B = max(70 - 0.10 * (ProductB - 100), 70) * ProductB\n// Profit_C = max(90 - 0.10 * (ProductC - 100), 90) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Each unit of product A requires 2 kg of raw materials, product B requires 3 kg, and product C requires 4 kg. The total available raw materials are 1000 kg.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited number of labor hours available. Each unit of product A requires 5 hours of labor, product B requires 6 hours, and product C requires 8 hours. The total available labor hours are 1500 hours.\n// 5 * ProductA + 6 * ProductB + 8 * ProductC <= 1500\n\n## Generate Constraint-3:\nThe market has a demand limit for each product. The demand limit for product A is 200 units, for product B is 300 units, and for product C is 250 units.\n// ProductA <= 200; ProductB <= 300; ProductC <= 250\n\n## Generate Constraint-4:\nThe company has a total production capacity of 500 units.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a specific amount of raw materials and labor hours. The company needs to determine the optimal production quantities for each product to maximize profit while considering the constraints on raw materials and labor hours. The profit per unit of each product decreases by $0.10 for each additional unit produced beyond 100 units for each product. The details of the products are given in the following Table.\n\n| Product | Profit per Unit (beyond 100 units) | Raw Material per Unit | Labor Hours per Unit |\n|---------|------------------------------------|-----------------------|----------------------|\n| A       | $50 - $0.10 * (ProductA - 100)     | 2 kg                  | 5 hours              |\n| B       | $70 - $0.10 * (ProductB - 100)     | 3 kg                  | 6 hours              |\n| C       | $90 - $0.10 * (ProductC - 100)     | 4 kg                  | 8 hours              |\n\nThe company has a limited supply of raw materials totaling 1000 kg. The company also has a limited number of labor hours available, totaling 1500 hours. The market has a demand limit for each product: 200 units for product A, 300 units for product B, and 250 units for product C. The company has a total production capacity of 500 units.\n\nPlease help the company to maximize the total profit from the sales of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=300) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=250) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(50 - 0.10 * (ProductA - 100), 50) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 50 * A1 * A_b1 + (50 - 0.10 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(70 - 0.10 * (ProductB - 100), 70) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 70 * B1 * B_b1 + (70 - 0.10 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(90 - 0.10 * (ProductC - 100), 90) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=250)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 90 * C1 * C_b1 + (90 - 0.10 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000) # raw materials constraint\nmodel.addCons(5 * ProductA + 6 * ProductB + 8 * ProductC <= 1500) # labor hours constraint\nmodel.addCons(ProductA + ProductB + ProductC <= 500) # total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route (RouteA, RouteB, RouteC) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software, which will affect the fuel efficiency and operational costs of each route.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel optimization for RouteA\": \"FuelOptA\", \"range\": \"FuelOptA >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for RouteB\": \"FuelOptB\", \"range\": \"FuelOptB >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for RouteC\": \"FuelOptC\", \"range\": \"FuelOptC >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software\": \"SoftwareInvest\", \"range\": \"SoftwareInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in fuel optimization and route optimization software. The company aims to minimize the total operational cost, which includes fuel costs and software investment.\nThe operational cost per truck for RouteA is $1000, but with fuel optimization and software, it decreases by $10 per truck for every $100 invested in fuel optimization and $5 per truck for every $100 invested in software.\nThe operational cost per truck for RouteB is $1200, and with fuel optimization and software, it decreases by $12 per truck for every $100 invested in fuel optimization and $6 per truck for every $100 invested in software.\nThe operational cost per truck for RouteC is $900, and with fuel optimization and software, it decreases by $9 per truck for every $100 invested in fuel optimization and $4.5 per truck for every $100 invested in software.\n// Operational cost for RouteA: CostA = (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA\n// Operational cost for RouteB: CostB = (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB\n// Operational cost for RouteC: CostC = (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and software investments.\n// (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA + (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB + (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC + SoftwareInvest <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 500.\n// TrucksA + TrucksB + TrucksC <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to RouteA and 150 trucks to RouteB.\n// TrucksA >= 100; TrucksB >= 150\n\n## Generate Constraint-4:\nThe investment in route optimization software should not exceed $10,000.\n// SoftwareInvest <= 10000",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route (RouteA, RouteB, RouteC) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software, which will affect the fuel efficiency and operational costs of each route.\nThe operational cost per truck for RouteA is $1000, but with fuel optimization and software, it decreases by $10 per truck for every $100 invested in fuel optimization and $5 per truck for every $100 invested in software.\nThe operational cost per truck for RouteB is $1200, and with fuel optimization and software, it decreases by $12 per truck for every $100 invested in fuel optimization and $6 per truck for every $100 invested in software.\nThe operational cost per truck for RouteC is $900, and with fuel optimization and software, it decreases by $9 per truck for every $100 invested in fuel optimization and $4.5 per truck for every $100 invested in software.\nThe company has a total budget of $100,000 for operational costs and software investments. The total number of trucks available for all routes is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to RouteA and 150 trucks to RouteB. The investment in route optimization software should not exceed $10,000.\nPlease help the company to minimize the total operational cost, which includes fuel costs and software investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for RouteC\nFuelOptA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptA\", lb=0)  # amount of fuel optimization for RouteA\nFuelOptB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptB\", lb=0)  # amount of fuel optimization for RouteB\nFuelOptC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptC\", lb=0)  # amount of fuel optimization for RouteC\nSoftwareInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareInvest\", lb=0)  # investment in route optimization software\n\n# Define objective function\nCostA = (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA\nCostB = (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB\nCostC = (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and software investments.\nmodel.addCons(CostA + CostB + CostC + SoftwareInvest <= 100000)\n# The total number of trucks available for all routes is limited to 500.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 500)\n# Due to contractual obligations, the company must allocate at least 100 trucks to RouteA and 150 trucks to RouteB.\nmodel.addCons(TrucksA >= 100)\nmodel.addCons(TrucksB >= 150)\n# The investment in route optimization software should not exceed $10,000.\nmodel.addCons(SoftwareInvest <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Fuel Optimization for RouteA: \", model.getVal(FuelOptA))\n    print(\"Fuel Optimization for RouteB: \", model.getVal(FuelOptB))\n    print(\"Fuel Optimization for RouteC: \", model.getVal(FuelOptC))\n    print(\"Software Investment: \", model.getVal(SoftwareInvest))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1504,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each.\nThe medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each.\nThe large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each.\nThe company wants to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost.\n// TotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\n// TotalFuelConsumption = (10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks) / TotalCarryingCapacity\n// TotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n// So, the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has space to park a maximum of 20 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-3:\nThe total carrying capacity of all trucks must exceed 100 tons.\n// 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 100",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints. The characteristics of each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Carrying Capacity (tons) | Purchase Cost ($) |\n|------------|-----------------------|--------------------------|-------------------|\n| Small      | 10                    | 5                        | 50,000            |\n| Medium     | 15                    | 10                       | 75,000            |\n| Large      | 20                    | 15                       | 100,000           |\n\nThe company has a budget of $1,000,000 for purchasing new trucks. The company has space to park a maximum of 20 trucks. The total carrying capacity of all trucks must exceed 100 tons. \nPlease help the company to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost, defined as the ratio of the total carrying capacity to the sum of the total fuel consumption and total purchase cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\nTotalFuelConsumption = 10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks\nTotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n## the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n## convert the division to multiplication\nmodel.addCons(obj * (TotalFuelConsumption + TotalPurchaseCost) == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n## The company has space to park a maximum of 20 trucks.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The total carrying capacity of all trucks must exceed 100 tons.\nmodel.addCons(5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy facilities: solar, wind, hydro, geothermal, and biomass. The city needs to determine how many units of each type of facility to install to meet energy demands efficiently.\n// {\"number of solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"GeothermalUnits\", \"range\": \"GeothermalUnits >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"BiomassUnits\", \"range\": \"BiomassUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit for solar is $50,000, wind is $60,000, hydro is $70,000, geothermal is $80,000, and biomass is $40,000. The energy output per unit for solar is 100 MWh, wind is 120 MWh, hydro is 150 MWh, geothermal is 180 MWh, and biomass is 90 MWh. The city wants to minimize the cost per MWh of energy produced.\n// Total cost: Cost = 50,000 * SolarUnits + 60,000 * WindUnits + 70,000 * HydroUnits + 80,000 * GeothermalUnits + 40,000 * BiomassUnits\n// Total energy output: Energy = 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $3,000,000 for the installation of these facilities.\n// 50,000 * SolarUnits + 60,000 * WindUnits + 70,000 * HydroUnits + 80,000 * GeothermalUnits + 40,000 * BiomassUnits <= 3,000,000\n\n## Generate Constraint-2:\nThe total energy output must meet at least 50,000 MWh to cover the city's energy needs.\n// 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits >= 50,000\n\n## Generate Constraint-3:\nDue to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed.\n// HydroUnits <= 0.5 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits)",
        "question": "A city is planning to install five different types of renewable energy facilities: solar, wind, hydro, geothermal, and biomass. The city needs to determine how many units of each type of facility to install to meet energy demands efficiently. The cost per unit for solar is $50,000, wind is $60,000, hydro is $70,000, geothermal is $80,000, and biomass is $40,000. The energy output per unit for solar is 100 MWh, wind is 120 MWh, hydro is 150 MWh, geothermal is 180 MWh, and biomass is 90 MWh. The city has a budget of $3,000,000 for the installation of these facilities. The total energy output must meet at least 50,000 MWh to cover the city's energy needs. Due to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed. Please help the city to minimize the cost per MWh of energy produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nGeothermalUnits = model.addVar(vtype=\"INTEGER\", name=\"GeothermalUnits\", lb=0)\nBiomassUnits = model.addVar(vtype=\"INTEGER\", name=\"BiomassUnits\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * SolarUnits + 60000 * WindUnits + 70000 * HydroUnits + 80000 * GeothermalUnits + 40000 * BiomassUnits\nEnergy = 100 * SolarUnits + 120 * WindUnits + 150 * HydroUnits + 180 * GeothermalUnits + 90 * BiomassUnits\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $3,000,000 for the installation of these facilities.\nmodel.addCons(Cost <= 3000000)\n## The total energy output must meet at least 50,000 MWh to cover the city's energy needs.\nmodel.addCons(Energy >= 50000)\n## Due to geographical limitations, the number of hydro units cannot exceed 50% of the total units installed.\nmodel.addCons(HydroUnits <= 0.5 * (SolarUnits + WindUnits + HydroUnits + GeothermalUnits + BiomassUnits))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Number of Geothermal Units: \", model.getVal(GeothermalUnits))\n    print(\"Number of Biomass Units: \", model.getVal(BiomassUnits))\n    print(\"Minimized Cost per MWh: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit, which is the difference between the revenue and the production cost.\n// Total profit: Profit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint that limits the total production to no more than 800 units.\n// ProductA + ProductB + ProductC <= 800",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductB must be at least twice the production of ProductA. Additionally, the company has a storage capacity constraint that limits the total production to no more than 800 units. Please help the company to maximize the total profit, which is the difference between the revenue and the production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\nProfit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n## Due to market demand, the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductB >= 2 * ProductA)\n## The company has a storage capacity constraint that limits the total production to no more than 800 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $100, the water requirement is 5 units, and the labor requirement is 2 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 7 units, and the labor requirement is 3 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 9 units, and the labor requirement is 4 hours.\nFor Crop D, the expected profit per acre is $250, the water requirement is 11 units, and the labor requirement is 5 hours.\nFor Crop E, the expected profit per acre is $300, the water requirement is 13 units, and the labor requirement is 6 hours.\nThe farm aims to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).\n// Expected profit of A: Profit_A = 100 * A\n// Expected profit of B: Profit_B = 150 * B\n// Expected profit of C: Profit_C = 200 * C\n// Expected profit of D: Profit_D = 250 * D\n// Expected profit of E: Profit_E = 300 * E\n// Resource usage of A: Resource_A = 5 * A + 2 * A\n// Resource usage of B: Resource_B = 7 * B + 3 * B\n// Resource usage of C: Resource_C = 9 * C + 4 * C\n// Resource usage of D: Resource_D = 11 * D + 5 * D\n// Resource usage of E: Resource_E = 13 * E + 6 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n\n## Generate Constraint-1:\nThe farm has a total of 1000 units of water available for the season.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000\n\n## Generate Constraint-2:\nThe farm has a total of 400 hours of labor available for the season.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\nFor Crop A, the expected profit per acre is $100, the water requirement is 5 units, and the labor requirement is 2 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 7 units, and the labor requirement is 3 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 9 units, and the labor requirement is 4 hours.\nFor Crop D, the expected profit per acre is $250, the water requirement is 11 units, and the labor requirement is 5 hours.\nFor Crop E, the expected profit per acre is $300, the water requirement is 13 units, and the labor requirement is 6 hours.\nThe farm has a total of 1000 units of water available for the season. The farm also has a total of 400 hours of labor available for the season.\nPlease help the farm to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of acres for crop D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of acres for crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nProfit_D = 250 * D\nProfit_E = 300 * E\nResource_A = 5 * A + 2 * A\nResource_B = 7 * B + 3 * B\nResource_C = 9 * C + 4 * C\nResource_D = 11 * D + 5 * D\nResource_E = 13 * E + 6 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has a total of 1000 units of water available for the season.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n## The farm has a total of 400 hours of labor available for the season.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Number of Acres for Crop D: \", model.getVal(D))\n    print(\"Number of Acres for Crop E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA cannot exceed 200 units.\n// UnitsA <= 200\n\n## Generate Constraint-3:\nMarket research indicates that the demand for DeviceB is at least twice the demand for DeviceA.\n// UnitsB >= 2 * UnitsA",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of each device decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit of DeviceA decreases by $0.1 for each unit produced beyond the first 100 units, the profit per unit of DeviceB decreases by $0.05 for each unit produced beyond the first 200 units, and the profit per unit of DeviceC decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n\n| Device | Profit per Unit (First Threshold) | Decrease per Unit Beyond Threshold | Threshold |\n|--------|----------------------------------|-----------------------------------|-----------|\n| DeviceA | $50                             | $0.1                              | 100 units  |\n| DeviceB | $70                             | $0.05                             | 200 units  |\n| DeviceC | $90                             | $0.02                             | 300 units  |\n\nThe company has a production capacity of 500 units in total. Due to raw material availability, the production of DeviceA cannot exceed 200 units. Market research indicates that the demand for DeviceB is at least twice the demand for DeviceA.\n\nPlease help the company determine the optimal number of units to produce for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (90 - 0.02 * C2) * C2 * C_b2 + 90 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 200)\nmodel.addCons(UnitsB >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1543,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs.\n// {\"speed of each truck\": \"Speed\", \"range\": \"5 <= Speed <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for RouteA\": \"GreenTechA\", \"range\": \"GreenTechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for RouteB\": \"GreenTechB\", \"range\": \"GreenTechB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are affected by the speed of the trucks and the investment in green technology. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for RouteA: FuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\n// Fuel cost for RouteB: FuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\n// Maintenance cost for RouteA: MaintCostA = (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA\n// Maintenance cost for RouteB: MaintCostB = (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and green technology investments.\n// (100 - Speed + 0.01 * GreenTechA) * TrucksA + (100 - Speed + 0.01 * GreenTechB) * TrucksB + (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA + (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB + GreenTechA + GreenTechB <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is limited to 50.\n// TrucksA + TrucksB <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n\nThe company has a total budget of $100,000 for operational costs and green technology investments. The total number of trucks available for deployment is limited to 50.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs, by determining the optimal speed for each truck and the number of trucks to deploy for each route, as well as the investment in green technology for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed = model.addVar(lb=5, ub=100, name=\"Speed\")  # speed of each truck\nTrucksA = model.addVar(vtype=\"INTEGER\", lb=0, name=\"TrucksA\")  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", lb=0, name=\"TrucksB\")  # number of trucks for RouteB\nGreenTechA = model.addVar(lb=0, name=\"GreenTechA\")  # investment in green technology for RouteA\nGreenTechB = model.addVar(lb=0, name=\"GreenTechB\")  # investment in green technology for RouteB\n\n# Define objective function\nFuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\nFuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\nMaintCostA = (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA\nMaintCostB = (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and green technology investments.\nmodel.addCons(\n    (100 - Speed + 0.01 * GreenTechA) * TrucksA +\n    (100 - Speed + 0.01 * GreenTechB) * TrucksB +\n    (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA +\n    (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB +\n    GreenTechA + GreenTechB <= 100000\n)\n\n# The total number of trucks available for deployment is limited to 50.\nmodel.addCons(TrucksA + TrucksB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Investment in green technology for RouteA: \", model.getVal(GreenTechA))\n    print(\"Investment in green technology for RouteB: \", model.getVal(GreenTechB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"daily operational cost per Truck\": \"TruckCost\", \"range\": \"TruckCost >= 0\", \"type\": \"continuous\"}\n// {\"daily operational cost per Van\": \"VanCost\", \"range\": \"VanCost >= 0\", \"type\": \"continuous\"}\n// {\"daily operational cost per Bike\": \"BikeCost\", \"range\": \"BikeCost >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type depends on the number of deliveries and the distance traveled, which is influenced by the operational cost and fuel efficiency. Trucks generate $100 per delivery, Vans generate $70 per delivery, and Bikes generate $30 per delivery. The operational cost of Trucks is $50 per day, Vans is $30 per day, and Bikes is $10 per day. The company aims to maximize the total daily profit.\n// Profit_Truck = 100 * TruckCount - TruckCost\n// Profit_Van = 70 * VanCount - VanCost\n// Profit_Bike = 30 * BikeCount - BikeCost\n// So, the objective function is: Maximize (Profit_Truck + Profit_Van + Profit_Bike)\n\n## Generate Constraint-1:\nThe total daily operational budget for all vehicles is $10,000.\n// TruckCost * TruckCount + VanCost * VanCount + BikeCost * BikeCount <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// TruckCount + VanCount + BikeCount <= 200",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and vehicle capacities. Trucks generate $100 per delivery, Vans generate $70 per delivery, and Bikes generate $30 per delivery. The operational cost of Trucks is $50 per day, Vans is $30 per day, and Bikes is $10 per day. The total daily operational budget for all vehicles is $10,000. The total number of vehicles cannot exceed 200. Please help the company to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckCost = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckCost\", lb=0)  # daily operational cost per Truck\nVanCost = model.addVar(vtype=\"CONTINUOUS\", name=\"VanCost\", lb=0)  # daily operational cost per Van\nBikeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeCost\", lb=0)  # daily operational cost per Bike\n\n# Define objective function\nProfit_Truck = 100 * TruckCount - TruckCost\nProfit_Van = 70 * VanCount - VanCost\nProfit_Bike = 30 * BikeCount - BikeCost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Truck + Profit_Van + Profit_Bike)\n\n# Add constraints\n# The total daily operational budget for all vehicles is $10,000.\nmodel.addCons(TruckCost * TruckCount + VanCost * VanCount + BikeCost * BikeCount <= 10000)\n# The total number of vehicles cannot exceed 200.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Daily Operational Cost per Truck: \", model.getVal(TruckCost))\n    print(\"Daily Operational Cost per Van: \", model.getVal(VanCost))\n    print(\"Daily Operational Cost per Bike: \", model.getVal(BikeCost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for each component is as follows:\n\n| Component | Profit per Unit |\n|-----------|-----------------|\n| ComponentA | $50             |\n| ComponentB | $70             |\n| ComponentC | $90             |\n| ComponentD | $110            |\n\nThe company has a total production capacity of 1000 hours per week. The production time for each component is as follows:\n\n| Component | Production Time per Unit |\n|-----------|-------------------------|\n| ComponentA | 2 hours                 |\n| ComponentB | 3 hours                 |\n| ComponentC | 4 hours                 |\n| ComponentD | 5 hours                 |\n\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n\nPlease help the company to maximize the total profit from the production of these components while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and cost structure. The efficiency of producing component 1 on line 1 is 10 units per hour, and the cost is $5 per hour. On line 2, it's 15 units per hour at a cost of $7 per hour. On line 3, it's 20 units per hour at a cost of $9 per hour. On line 4, it's 25 units per hour at a cost of $11 per hour. On line 5, it's 30 units per hour at a cost of $13 per hour. The company aims to maximize the total production of component 1 while minimizing the total cost.\n// The total production of component 1: Q1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5\n// The total cost: C = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5\n// So, the objective function is: Maximize (Q1 - C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 100 hours.\n// P1 + P2 + P3 + P4 + P5 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 30 hours.\n// P1 <= 30; P2 <= 30; P3 <= 30; P4 <= 30; P5 <= 30",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production. Each production line has a different efficiency and cost structure for producing component 1. On line 1, the efficiency is 10 units per hour, and the cost is $5 per hour. On line 2, it's 15 units per hour at a cost of $7 per hour. On line 3, it's 20 units per hour at a cost of $9 per hour. On line 4, it's 25 units per hour at a cost of $11 per hour. On line 5, it's 30 units per hour at a cost of $13 per hour. The company aims to maximize the total production of component 1 while minimizing the total cost. The total available hours for all production lines is 100 hours, and each production line can operate for a maximum of 30 hours. Please help the company to maximize the objective function (total production of component 1 minus total cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=0) # hours for production line 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=0) # hours for production line 5\n\n# Define objective function\nQ1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5 # total production of component 1\nC = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5 # total cost\n# So, the objective function is: Maximize (Q1 - C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Q1 - C)\n\n# Add constraints\n# The total available hours for all production lines is 100 hours.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 100)\n# Each production line can operate for a maximum of 30 hours.\nmodel.addCons(P1 <= 30)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 30)\nmodel.addCons(P4 <= 30)\nmodel.addCons(P5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Hours for Production Line 4: \", model.getVal(P4))\n    print(\"Hours for Production Line 5: \", model.getVal(P5))\n    print(\"Maximized Production of Component 1: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3\n\n## Generate Constraint-2:\nThe company has a total fleet size of 50 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $3000.\n// 1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000\n\n## Generate Constraint-4:\nDue to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 15 trucks to Route2.\n// Trucks1 >= 10; Trucks2 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. Each route has a specific distance that must be covered: Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route. The company has a total fleet size of 50 trucks and a total fuel budget of $3000. Due to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 15 trucks to Route2. Please help the company to minimize the total fuel cost while ensuring all deliveries are made.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)    # fuel allocation for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)    # fuel allocation for Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)    # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n# The company has a total fleet size of 50 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n# The total fuel budget for the company is $3000.\nmodel.addCons(1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of ProductA: ProfitA = (100 - 40) * QuantityA\n// Profit of ProductB: ProfitB = (120 - 50) * QuantityB\n// Profit of ProductC: ProfitC = (150 - 60) * QuantityC\n// Profit of ProductD: ProfitD = (200 - 80) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / (5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000\n\n## Generate Constraint-2:\nThe company has a total production capacity of 1000 hours.\n// 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// QuantityA >= 50; QuantityB >= 30\n\n## Generate Constraint-4:\nThe production of ProductC must not exceed the combined production of ProductA and ProductB.\n// QuantityC <= QuantityA + QuantityB",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\nThe company has a budget of $10,000 for raw materials. The company has a total production capacity of 1000 hours. The company must produce at least 50 units of ProductA and 30 units of ProductB. The production of ProductC must not exceed the combined production of ProductA and ProductB.\nPlease help the company to determine the optimal production quantities of ProductA, ProductB, ProductC, and ProductD to maximize the profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=30) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 40) * QuantityA\nProfitB = (120 - 50) * QuantityB\nProfitC = (150 - 60) * QuantityC\nProfitD = (200 - 80) * QuantityD\nProductionTime = 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000)\n## The company has a total production capacity of 1000 hours.\nmodel.addCons(5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000)\n## The company must produce at least 50 units of ProductA and 30 units of ProductB.\nmodel.addCons(QuantityA >= 50)\nmodel.addCons(QuantityB >= 30)\n## The production of ProductC must not exceed the combined production of ProductA and ProductB.\nmodel.addCons(QuantityC <= QuantityA + QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 500 units.\n// UnitsA <= 500\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nTo maintain market share, the company must produce at least 100 units of DeviceB.\n// UnitsB >= 100\n\n## Generate Constraint-5:\nDue to a supplier agreement, the production of DeviceC must be at least twice the production of DeviceA.\n// UnitsC >= 2 * UnitsA",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary. The details are as follows:\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand |\n|--------|--------------------------|------------------------|--------|\n| DeviceA | $50                     | $100                   | 500 units |\n| DeviceB | $70                     | $120                   | 400 units |\n| DeviceC | $80                     | $150                   | 300 units |\n\nThe company wants to maximize its total profit, considering that the profit for each device also depends on increasing marginal costs as follows:\n- Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2\n- Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2\n- Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2\n\nThe company has the following constraints:\n1. The total production capacity per month is 1000 units.\n2. The production of DeviceA should not exceed 500 units due to market saturation.\n3. The company has a budget of $60,000 for production costs per month.\n4. To maintain market share, the company must produce at least 100 units of DeviceB.\n5. Due to a supplier agreement, the production of DeviceC must be at least twice the production of DeviceA.\n\nPlease help the company determine the optimal number of units to produce for each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\n\n# Define objective function\n# Due to increasing marginal costs, quadratic terms are introduced\nProfit_A = (100 - 50) * UnitsA - 0.01 * UnitsA**2\nProfit_B = (120 - 70) * UnitsB - 0.02 * UnitsB**2\nProfit_C = (150 - 80) * UnitsC - 0.03 * UnitsC**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# Total production capacity constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# Market saturation constraint for DeviceA\nmodel.addCons(UnitsA <= 500)\n# Budget constraint for production costs\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n# Market share maintenance for DeviceB\nmodel.addCons(UnitsB >= 100)\n# Supplier agreement constraint for DeviceC\nmodel.addCons(UnitsC >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1537,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements.\n// {\"cargo in truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"cargo in truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"real\"}\n// {\"cargo in truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"real\"}\n// {\"cargo in truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"real\"}\n// {\"cargo in truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of the cargo weight it carries. Specifically, the fuel consumption (in liters) for each truck is given by:\n- Truck 1: F1 = 0.05 * T1^2\n- Truck 2: F2 = 0.04 * T2^2\n- Truck 3: F3 = 0.03 * T3^2\n- Truck 4: F4 = 0.06 * T4^2\n- Truck 5: F5 = 0.07 * T5^2\nThe company aims to minimize the total fuel consumption across all trucks.\n// So, the objective function is: Minimize F = F1 + F2 + F3 + F4 + F5 = 0.05 * T1^2 + 0.04 * T2^2 + 0.03 * T3^2 + 0.06 * T4^2 + 0.07 * T5^2\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 100 tons.\n// T1 + T2 + T3 + T4 + T5 = 100",
        "question": "A logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements. The fuel consumption (in liters) for each truck is a nonlinear function of the cargo weight it carries, as shown in the following Table:\n\n| Truck | Fuel Consumption Function |\n|-------|---------------------------|\n| 1     | F1 = 0.05 * T1^2         |\n| 2     | F2 = 0.04 * T2^2         |\n| 3     | F3 = 0.03 * T3^2         |\n| 4     | F4 = 0.06 * T4^2         |\n| 5     | F5 = 0.07 * T5^2         |\n\nThe company aims to minimize the total fuel consumption across all trucks. The total cargo to be delivered is 100 tons. Please help the company determine the optimal distribution of cargo (T1, T2, T3, T4, T5) to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # cargo in truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0) # cargo in truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0) # cargo in truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0) # cargo in truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0) # cargo in truck 5\n\n# Define objective function\n# The fuel consumption of each truck is a nonlinear function of the cargo weight it carries.\nF1 = 0.05 * T1**2\nF2 = 0.04 * T2**2\nF3 = 0.03 * T3**2\nF4 = 0.06 * T4**2\nF5 = 0.07 * T5**2\n# The company aims to minimize the total fuel consumption across all trucks.\n# So, the objective function is: Minimize F = F1 + F2 + F3 + F4 + F5 = 0.05 * T1^2 + 0.04 * T2^2 + 0.03 * T3^2 + 0.06 * T4^2 + 0.07 * T5^2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5)\n\n# Add constraints\n# The total cargo to be delivered is 100 tons.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo in Truck 1: \", model.getVal(T1))\n    print(\"Cargo in Truck 2: \", model.getVal(T2))\n    print(\"Cargo in Truck 3: \", model.getVal(T3))\n    print(\"Cargo in Truck 4: \", model.getVal(T4))\n    print(\"Cargo in Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe production capacity of DeviceA is limited to 2000 units.\n// UnitsA <= 2000\n\n## Generate Constraint-3:\nThe production capacity of DeviceB is limited to 1500 units.\n// UnitsB <= 1500\n\n## Generate Constraint-4:\nThe production capacity of DeviceC is limited to 1000 units.\n// UnitsC <= 1000\n\n## Generate Constraint-5:\nDue to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB.\n// UnitsA >= 500; UnitsB >= 300",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the number of hours to allocate to each production line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2. The company aims to maximize the total profit.\n\nThe total available hours for all production lines is 1000 hours. The production capacity of DeviceA is limited to 2000 units, DeviceB to 1500 units, and DeviceC to 1000 units. Due to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500, ub=2000)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300, ub=1500)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=1000)  # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours allocated to DeviceC production line\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (30 * HoursA)\nProfit_B = (70 * UnitsB) - (40 * HoursB)\nProfit_C = (90 * UnitsC) - (50 * HoursC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\nmodel.addCons(UnitsA <= 2000)\nmodel.addCons(UnitsB <= 1500)\nmodel.addCons(UnitsC <= 1000)\nmodel.addCons(UnitsA >= 500)\nmodel.addCons(UnitsB >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nThe market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\n// TruckA <= 50\n\n## Generate Constraint-5:\nThe company must operate at least 20 units of Truck B to fulfill a contract.\n// TruckB >= 20",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company has a total budget of $5000 for fuel costs. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a limit of 100 trucks in total. The market demand for Truck A is 50 units. The company must operate at least 20 units of Truck B to fulfill a contract.\nPlease help the company to minimize the total fuel cost while maximizing the total cargo carried, considering the objective function as the ratio of the total fuel cost to the total cargo carried.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0, ub=50)  # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=20, ub=100)  # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0, ub=100)  # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000)\n## The company has a limit of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\nmodel.addCons(TruckA <= 50)\n## The company must operate at least 20 units of Truck B to fulfill a contract.\nmodel.addCons(TruckB >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n// Packages delivered by Trucks per hour: Packages_Trucks = 100 * Trucks * 50\n// Packages delivered by Vans per hour: Packages_Vans = 50 * Vans * 40\n// Packages delivered by Bikes per hour: Packages_Bikes = 10 * Bikes * 20\n// So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\n// 100 * Trucks + 50 * Vans + 20 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers.\n// 2 * Trucks + Vans + 0.5 * Bikes <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle. The details of each vehicle type are given in the following Table.\n\n| Vehicle | Packages Delivered | Speed (km/h) | Maintenance Cost | Drivers Required |\n|---------|--------------------|--------------|------------------|------------------|\n| Trucks  | 100                | 50           | $100             | 2                |\n| Vans    | 50                 | 40           | $50              | 1                |\n| Bikes   | 10                 | 20           | $20              | 0.5              |\n\nThe company has a budget of $10,000 per day for vehicle maintenance. The company has a total of 100 drivers available. Each Truck requires 2 drivers, each Van requires 1 driver, and each Bike requires 0.5 drivers.\nPlease help the company to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nPackages_Trucks = 100 * Trucks * 50\nPackages_Vans = 50 * Vans * 40\nPackages_Bikes = 10 * Bikes * 20\n# So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n# Add constraints\n# The company has a budget of $10,000 per day for vehicle maintenance.\nmodel.addCons(100 * Trucks + 50 * Vans + 20 * Bikes <= 10000)\n# The company has a total of 100 drivers available.\nmodel.addCons(2 * Trucks + Vans + 0.5 * Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"TA\", \"range\": \"TA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TB\", \"range\": \"TB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TC\", \"range\": \"TC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TD\", \"range\": \"TD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TE\", \"range\": \"TE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck A has a fuel efficiency of 10 km/l and a maintenance cost of $500 per month.\n- Truck B has a fuel efficiency of 12 km/l and a maintenance cost of $600 per month.\n- Truck C has a fuel efficiency of 15 km/l and a maintenance cost of $700 per month.\n- Truck D has a fuel efficiency of 18 km/l and a maintenance cost of $800 per month.\n- Truck E has a fuel efficiency of 20 km/l and a maintenance cost of $900 per month.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Total fuel cost: FuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / FuelEfficiency)\n// Total maintenance cost: MaintenanceCost = (500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE)\n// Total cost per kilometer: TotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for all trucks combined.\n// 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000",
        "question": "A logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs. The fuel efficiency and maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost per Month |\n|------------|-----------------------|---------------------------|\n| Truck A    | 10                    | $500                      |\n| Truck B    | 12                    | $600                      |\n| Truck C    | 15                    | $700                      |\n| Truck D    | 18                    | $800                      |\n| Truck E    | 20                    | $900                      |\n\nThe company has a budget of $50,000 per month for all trucks combined. The company wants to minimize the total cost of fuel and maintenance per kilometer. Please help the company to determine the optimal number of each type of truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTA = model.addVar(vtype=\"INTEGER\", name=\"TA\", lb=0) # number of Truck A\nTB = model.addVar(vtype=\"INTEGER\", name=\"TB\", lb=0) # number of Truck B\nTC = model.addVar(vtype=\"INTEGER\", name=\"TC\", lb=0) # number of Truck C\nTD = model.addVar(vtype=\"INTEGER\", name=\"TD\", lb=0) # number of Truck D\nTE = model.addVar(vtype=\"INTEGER\", name=\"TE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPricePerLiter = 1.5  # Assuming fuel price per liter\nFuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / 1000)  # Convert to km/l\nMaintenanceCost = 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE\nTotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n## convert the division to multiplication\nmodel.addCons(obj * (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $50,000 per month for all trucks combined.\nmodel.addCons(500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TA))\n    print(\"Number of Truck B: \", model.getVal(TB))\n    print(\"Number of Truck C: \", model.getVal(TC))\n    print(\"Number of Truck D: \", model.getVal(TD))\n    print(\"Number of Truck E: \", model.getVal(TE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $20, with a production cost of $10 and a resource usage of 3 units.\nFor component B, the profit per unit is $25, with a production cost of $12 and a resource usage of 4 units.\nFor component C, the profit per unit is $30, with a production cost of $15 and a resource usage of 5 units.\nFor component D, the profit per unit is $35, with a production cost of $18 and a resource usage of 6 units.\nFor component E, the profit per unit is $40, with a production cost of $20 and a resource usage of 7 units.\nThe company aims to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (3 * A + 4 * B + 5 * C + 6 * D + 7 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each component.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe company has a total resource capacity of 1500 units.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 1500",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage.\nThe profit per unit of component A is $20, with a production cost of $10 and a resource usage of 3 units.\nFor component B, the profit per unit is $25, with a production cost of $12 and a resource usage of 4 units.\nFor component C, the profit per unit is $30, with a production cost of $15 and a resource usage of 5 units.\nFor component D, the profit per unit is $35, with a production cost of $18 and a resource usage of 6 units.\nFor component E, the profit per unit is $40, with a production cost of $20 and a resource usage of 7 units.\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each component. The company has a total resource capacity of 1500 units.\nPlease help the company to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each component.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nResourceUsage = 3 * A + 4 * B + 5 * C + 6 * D + 7 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000)\n## The company has a total resource capacity of 1500 units.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Profit_A = (20 - 10) * A\n// Profit_B = (30 - 20) * B\n// Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost. The company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours. Please help the company to determine the optimal production quantity for each device to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general cargo. Additionally, the company needs to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"HeavyMachineryTrucks\", \"range\": \"HeavyMachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general cargo\": \"GeneralCargoTrucks\", \"range\": \"GeneralCargoTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for perishable goods trucks\": \"FuelEfficiencyPerishable\", \"range\": \"FuelEfficiencyPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for heavy machinery trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for general cargo trucks\": \"FuelEfficiencyGeneral\", \"range\": \"FuelEfficiencyGeneral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings are exponentially related to the amount of investment in fuel efficiency for each type of truck. For perishable goods trucks, each $1000 invested reduces fuel costs by 1% per kilometer. For heavy machinery trucks, each $1000 invested reduces fuel costs by 1.5% per kilometer. For general cargo trucks, each $1000 invested reduces fuel costs by 1.2% per kilometer. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for perishable goods trucks: SavingsPerishable = PerishableTrucks * (1 - 0.01 * FuelEfficiencyPerishable)\n// Fuel cost savings for heavy machinery trucks: SavingsHeavy = HeavyMachineryTrucks * (1 - 0.015 * FuelEfficiencyHeavy)\n// Fuel cost savings for general cargo trucks: SavingsGeneral = GeneralCargoTrucks * (1 - 0.012 * FuelEfficiencyGeneral)\n// So, the objective function is: Maximize (SavingsPerishable + SavingsHeavy + SavingsGeneral)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel efficiency upgrades.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks + FuelEfficiencyPerishable + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks <= 200",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general cargo. Additionally, the company needs to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel cost savings are exponentially related to the amount of investment in fuel efficiency for each type of truck. For perishable goods trucks, each $1000 invested reduces fuel costs by 1% per kilometer. For heavy machinery trucks, each $1000 invested reduces fuel costs by 1.5% per kilometer. For general cargo trucks, each $1000 invested reduces fuel costs by 1.2% per kilometer. The company aims to maximize the total fuel cost savings across all trucks.\n\n| Type of Cargo | Fuel Cost Savings per $1000 Investment |\n|---------------|-----------------------------------------|\n| Perishable Goods | 1% per kilometer |\n| Heavy Machinery | 1.5% per kilometer |\n| General Cargo | 1.2% per kilometer |\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel efficiency upgrades. The total number of trucks cannot exceed 200.\n\nPlease help the company determine the optimal number of trucks for each type of cargo and the amount to invest in fuel efficiency to maximize the total fuel cost savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nHeavyMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks\", lb=0)  # number of trucks for heavy machinery\nGeneralCargoTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoTrucks\", lb=0)  # number of trucks for general cargo\nFuelEfficiencyPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyPerishable\", lb=0)  # investment in fuel efficiency for perishable goods trucks\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)  # investment in fuel efficiency for heavy machinery trucks\nFuelEfficiencyGeneral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyGeneral\", lb=0)  # investment in fuel efficiency for general cargo trucks\n\n# Define objective function\nSavingsPerishable = PerishableTrucks * (1 - 0.01 * FuelEfficiencyPerishable)\nSavingsHeavy = HeavyMachineryTrucks * (1 - 0.015 * FuelEfficiencyHeavy)\nSavingsGeneral = GeneralCargoTrucks * (1 - 0.012 * FuelEfficiencyGeneral)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == SavingsPerishable + SavingsHeavy + SavingsGeneral)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks + FuelEfficiencyPerishable + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 100000)\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralCargoTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Goods Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Heavy Machinery Trucks: \", model.getVal(HeavyMachineryTrucks))\n    print(\"Number of General Cargo Trucks: \", model.getVal(GeneralCargoTrucks))\n    print(\"Investment in Fuel Efficiency for Perishable Goods Trucks: \", model.getVal(FuelEfficiencyPerishable))\n    print(\"Investment in Fuel Efficiency for Heavy Machinery Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for General Cargo Trucks: \", model.getVal(FuelEfficiencyGeneral))\n    print(\"Total Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for truck i\": \"Fuel_Rate_i\", \"range\": \"Fuel_Rate_i >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Total fuel consumption for truck i: Fuel_Consumption_i = Fuel_Rate_i * Distance_j * Trucks_j\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// \u03a3(Trucks_j) for all j <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for each route is 100 km/h.\n// Speed_i <= 100 for all i\n\n## Generate Constraint-3:\nEach route has a minimum required number of trucks to ensure service quality. Route A requires at least 5 trucks, Route B requires at least 10 trucks, and Route C requires at least 7 trucks.\n// Trucks_A >= 5; Trucks_B >= 10; Trucks_C >= 7\n\n## Generate Constraint-4:\nThe total distance covered by all trucks on each route must not exceed the maximum allowable distance. Route A has a limit of 5000 km, Route B has a limit of 7000 km, and Route C has a limit of 6000 km.\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route A <= 5000\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route B <= 7000\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route C <= 6000\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced distribution of trucks across routes to optimize overall efficiency. The ratio of trucks on Route A to Route B should be at least 1:2, and the ratio of trucks on Route B to Route C should be at least 2:1.\n// Trucks_A / Trucks_B >= 1/2\n// Trucks_B / Trucks_C >= 2/1",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed. The fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3. The company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is 50. The maximum speed limit for each route is 100 km/h. Each route has a minimum required number of trucks to ensure service quality. Route A requires at least 5 trucks, Route B requires at least 10 trucks, and Route C requires at least 7 trucks. The total distance covered by all trucks on each route must not exceed the maximum allowable distance. Route A has a limit of 5000 km, Route B has a limit of 7000 km, and Route C has a limit of 6000 km. The company aims to maintain a balanced distribution of trucks across routes to optimize overall efficiency. The ratio of trucks on Route A to Route B should be at least 1:2, and the ratio of trucks on Route B to Route C should be at least 2:1. Please help the company to determine the optimal speed and number of trucks for each route to minimize the total fuel consumption while meeting all constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_A\", lb=0, ub=100)\nSpeed_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_B\", lb=0, ub=100)\nSpeed_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_C\", lb=0, ub=100)\n\n## Number of trucks on each route\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=5)\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=10)\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=7)\n\n## Fuel consumption rate for each truck\nFuel_Rate_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_A\")\nFuel_Rate_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_B\")\nFuel_Rate_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_C\")\n\n# Define objective function\n## Fuel consumption rate for each truck is modeled as a nonlinear function of its speed\nmodel.addCons(Fuel_Rate_A == 0.05 * Speed_A**2 + 0.001 * Speed_A**3)\nmodel.addCons(Fuel_Rate_B == 0.05 * Speed_B**2 + 0.001 * Speed_B**3)\nmodel.addCons(Fuel_Rate_C == 0.05 * Speed_C**2 + 0.001 * Speed_C**3)\n\n## Total fuel consumption for each route\nFuel_Consumption_A = Fuel_Rate_A * 5000 * Trucks_A\nFuel_Consumption_B = Fuel_Rate_B * 7000 * Trucks_B\nFuel_Consumption_C = Fuel_Rate_C * 6000 * Trucks_C\n\n## Objective function: Minimize \u03a3(Fuel_Consumption_i) for all i and j\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n## Total number of trucks available is 50\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n## Maximum speed limit for each route\nmodel.addCons(Speed_A <= 100)\nmodel.addCons(Speed_B <= 100)\nmodel.addCons(Speed_C <= 100)\n\n## Minimum required number of trucks for each route\nmodel.addCons(Trucks_A >= 5)\nmodel.addCons(Trucks_B >= 10)\nmodel.addCons(Trucks_C >= 7)\n\n## Total distance covered by all trucks on each route\nmodel.addCons(Speed_A * Trucks_A <= 5000)\nmodel.addCons(Speed_B * Trucks_B <= 7000)\nmodel.addCons(Speed_C * Trucks_C <= 6000)\n\n## Balanced distribution of trucks across routes\nmodel.addCons(Trucks_A / Trucks_B >= 1/2)\nmodel.addCons(Trucks_B / Trucks_C >= 2/1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck A: \", model.getVal(Speed_A))\n    print(\"Speed of Truck B: \", model.getVal(Speed_B))\n    print(\"Speed of Truck C: \", model.getVal(Speed_C))\n    print(\"Number of Trucks on Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks on Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks on Route C: \", model.getVal(Trucks_C))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1500,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for next month. They have identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck1, the cost per mile is $2, the fuel efficiency is 5 miles per gallon, and the maintenance cost is $1000 per month.\nFor Truck2, the cost per mile is $3, the fuel efficiency is 4 miles per gallon, and the maintenance cost is $1500 per month.\nFor Truck3, the cost per mile is $4, the fuel efficiency is 3 miles per gallon, and the maintenance cost is $2000 per month.\nFor Van1, the cost per mile is $1.5, the fuel efficiency is 6 miles per gallon, and the maintenance cost is $800 per month.\nFor Van2, the cost per mile is $1, the fuel efficiency is 7 miles per gallon, and the maintenance cost is $500 per month.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the total costs (cost per mile * miles + maintenance) divided by the total miles covered.\n// Total cost for Truck1: Cost_Truck1 = 2 * Miles_Truck1 + 1000\n// Total cost for Truck2: Cost_Truck2 = 3 * Miles_Truck2 + 1500\n// Total cost for Truck3: Cost_Truck3 = 4 * Miles_Truck3 + 2000\n// Total cost for Van1: Cost_Van1 = 1.5 * Miles_Van1 + 800\n// Total cost for Van2: Cost_Van2 = 1 * Miles_Van2 + 500\n// Total miles for Truck1: Miles_Truck1 = 5 * Truck1\n// Total miles for Truck2: Miles_Truck2 = 4 * Truck2\n// Total miles for Truck3: Miles_Truck3 = 3 * Truck3\n// Total miles for Van1: Miles_Van1 = 6 * Van1\n// Total miles for Van2: Miles_Van2 = 7 * Van2\n// So, the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2) / (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for vehicle maintenance next month.\n// 1000 * Truck1 + 1500 * Truck2 + 2000 * Truck3 + 800 * Van1 + 500 * Van2 <= 50000\n\n## Generate Constraint-2:\nThe company can only afford to operate a maximum of 20 vehicles in total.\n// Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 20\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2).\n// Van1 + Van2 >= 0.3 * (Truck1 + Truck2 + Truck3 + Van1 + Van2)\n\n## Generate Constraint-4:\nThe company wants to ensure that the total miles covered by Truck3 does not exceed the combined miles covered by Truck1 and Truck2.\n// 3 * Truck3 <= 5 * Truck1 + 4 * Truck2",
        "question": "A logistics company is planning its fleet for next month and has identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes. The cost per mile, fuel efficiency, and monthly maintenance cost for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Mile | Fuel Efficiency | Monthly Maintenance Cost |\n|---------|---------------|-----------------|--------------------------|\n| Truck1  | $2            | 5 miles/gallon  | $1000                    |\n| Truck2  | $3            | 4 miles/gallon  | $1500                    |\n| Truck3  | $4            | 3 miles/gallon  | $2000                    |\n| Van1    | $1.5          | 6 miles/gallon  | $800                     |\n| Van2    | $1            | 7 miles/gallon  | $500                     |\n\nThe company has a budget of $50,000 for vehicle maintenance next month. The company can only afford to operate a maximum of 20 vehicles in total. The company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2). The company also wants to ensure that the total miles covered by Truck3 does not exceed the combined miles covered by Truck1 and Truck2.\n\nPlease help the company to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the total costs (cost per mile * miles + maintenance) divided by the total miles covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_Truck1 = 2 * (5 * Truck1) + 1000\nCost_Truck2 = 3 * (4 * Truck2) + 1500\nCost_Truck3 = 4 * (3 * Truck3) + 2000\nCost_Van1 = 1.5 * (6 * Van1) + 800\nCost_Van2 = 1 * (7 * Van2) + 500\nMiles_Truck1 = 5 * Truck1\nMiles_Truck2 = 4 * Truck2\nMiles_Truck3 = 3 * Truck3\nMiles_Van1 = 6 * Van1\nMiles_Van2 = 7 * Van2\n## the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2) / (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2)\n## convert the division to multiplication\nmodel.addCons(obj * (Miles_Truck1 + Miles_Truck2 + Miles_Truck3 + Miles_Van1 + Miles_Van2) == Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Van1 + Cost_Van2)\n\n# Add constraints\n## The company has a budget of $50,000 for vehicle maintenance next month.\nmodel.addCons(1000 * Truck1 + 1500 * Truck2 + 2000 * Truck3 + 800 * Van1 + 500 * Van2 <= 50000)\n## The company can only afford to operate a maximum of 20 vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 20)\n## The company needs to ensure that at least 30% of the fleet is composed of fuel-efficient vehicles (Van1 and Van2).\nmodel.addCons(Van1 + Van2 >= 0.3 * (Truck1 + Truck2 + Truck3 + Van1 + Van2))\n## The company wants to ensure that the total miles covered by Truck3 does not exceed the combined miles covered by Truck1 and Truck2.\nmodel.addCons(3 * Truck3 <= 5 * Truck1 + 4 * Truck2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1392,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km.\n// Fuel_Consumption_Trucks = 20 * Trucks\n// Fuel_Consumption_Vans = 15 * Vans\n// Fuel_Consumption_Bikes = 1 * Bikes\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of vehicles it can operate, which is 20.\n// Trucks + Vans + Bikes <= 20",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands. The fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100. The total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg. The company has a limit on the total number of vehicles it can operate, which is 20. Please help the company to minimize the total fuel consumption per 100 km.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuel_Consumption_Trucks = 20 * Trucks\nFuel_Consumption_Vans = 15 * Vans\nFuel_Consumption_Bikes = 1 * Bikes\n# So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for purchasing vehicles.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 10000)\n# The total cargo capacity required is 5000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000)\n# The company has a limit on the total number of vehicles it can operate, which is 20.\nmodel.addCons(Trucks + Vans + Bikes <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the marketing budget allocated to each product. The marketing budget affects the sales volume of each product, and the price also influences the demand. The company aims to maximize its total revenue.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe sales volume of each product is affected by its price and marketing budget. The relationship is modeled as SalesVolume = BaseDemand - 0.01 * Price + 0.0002 * MarketingBudget. The base demand for ProductA is 1000 units, for ProductB is 1500 units, and for ProductC is 2000 units. The company aims to maximize the total revenue, which is the sum of the revenue from each product.\n// Revenue from ProductA: RevenueA = QuantityA * (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA)\n// Revenue from ProductB: RevenueB = QuantityB * (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB)\n// Revenue from ProductC: RevenueC = QuantityC * (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $50,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint where the total quantity of all products cannot exceed 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-3:\nDue to market saturation, the sales volume of each product cannot exceed its base demand.\n// (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA) >= QuantityA\n// (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB) >= QuantityB\n// (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC) >= QuantityC\n\n## Generate Constraint-4:\nThe company must ensure that at least 1000 units of ProductA and 1500 units of ProductB are produced.\n// QuantityA >= 1000; QuantityB >= 1500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the marketing budget allocated to each product. The marketing budget affects the sales volume of each product, and the price also influences the demand. The company aims to maximize its total revenue. The base demand for ProductA is 1000 units, for ProductB is 1500 units, and for ProductC is 2000 units. The relationship between sales volume, price, and marketing budget is modeled as SalesVolume = BaseDemand - 0.01 * Price + 0.0002 * MarketingBudget.\n\nThe company has a total marketing budget of $50,000. The company has a production capacity constraint where the total quantity of all products cannot exceed 5000 units. Due to market saturation, the sales volume of each product cannot exceed its base demand. The company must ensure that at least 1000 units of ProductA and 1500 units of ProductB are produced.\n\nPlease help the company to maximize the total revenue, which is the sum of the revenue from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0) # price of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA)\nRevenueB = QuantityB * (1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB)\nRevenueC = QuantityC * (2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The total marketing budget for all products cannot exceed $50,000.\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000)\n# The company has a production capacity constraint where the total quantity of all products cannot exceed 5000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\n# Due to market saturation, the sales volume of each product cannot exceed its base demand.\nmodel.addCons(1000 - 0.01 * PriceA + 0.0002 * MarketingBudgetA >= QuantityA)\nmodel.addCons(1500 - 0.01 * PriceB + 0.0002 * MarketingBudgetB >= QuantityB)\nmodel.addCons(2000 - 0.01 * PriceC + 0.0002 * MarketingBudgetC >= QuantityC)\n# The company must ensure that at least 1000 units of ProductA and 1500 units of ProductB are produced.\nmodel.addCons(QuantityA >= 1000)\nmodel.addCons(QuantityB >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\n// B >= 0.1 * (T + V + B)\n\n## Generate Constraint-4:\nThe company has a daily revenue target of $20,000.\n// 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000\n\n## Generate Constraint-5:\nThe company wants to limit the number of Trucks to no more than twice the number of Vans.\n// T <= 2 * V",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed. The company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery. The company has a daily revenue target of $20,000. The company wants to limit the number of Trucks to no more than twice the number of Vans. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to meet these constraints and maximize efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\nmodel.addCons(B >= 0.1 * (T + V + B))\n## The company has a daily revenue target of $20,000.\nmodel.addCons(1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000)\n## The company wants to limit the number of Trucks to no more than twice the number of Vans.\nmodel.addCons(T <= 2 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities and fuel efficiencies.\n// {\"number of vehicle 1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 4\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 5\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle 1 has a capacity of 100 units, a fuel efficiency of 5 km/liter, and a cost of $100 per day.\nVehicle 2 has a capacity of 150 units, a fuel efficiency of 7 km/liter, and a cost of $150 per day.\nVehicle 3 has a capacity of 200 units, a fuel efficiency of 10 km/liter, and a cost of $200 per day.\nVehicle 4 has a capacity of 250 units, a fuel efficiency of 12 km/liter, and a cost of $250 per day.\nVehicle 5 has a capacity of 300 units, a fuel efficiency of 15 km/liter, and a cost of $300 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\n// Total fuel consumption: FuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n// So, the objective function is: Minimize (VehicleCost + FuelConsumption)\n\n## Generate Constraint-1:\nThe total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 10000",
        "question": "A logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities and fuel efficiencies. Vehicle 1 has a capacity of 100 units, a fuel efficiency of 5 km/liter, and a cost of $100 per day. Vehicle 2 has a capacity of 150 units, a fuel efficiency of 7 km/liter, and a cost of $150 per day. Vehicle 3 has a capacity of 200 units, a fuel efficiency of 10 km/liter, and a cost of $200 per day. Vehicle 4 has a capacity of 250 units, a fuel efficiency of 12 km/liter, and a cost of $250 per day. Vehicle 5 has a capacity of 300 units, a fuel efficiency of 15 km/liter, and a cost of $300 per day. The company needs to deliver at least 1000 units of goods over a distance of 500 km. The total capacity of the vehicles must meet or exceed the required delivery of 1000 units. The company has a budget of $10,000 for vehicle rental. Please help the company to minimize the total cost of vehicles and fuel.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of vehicle 1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of vehicle 2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of vehicle 3\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of vehicle 4\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of vehicle 5\n\n# Define objective function\n## Total cost of vehicles: VehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\n## Total fuel consumption: FuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n## So, the objective function is: Minimize (VehicleCost + FuelConsumption)\nVehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\nFuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == VehicleCost + FuelConsumption)\n\n# Add constraints\n## The total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000)\n## The company has a budget of $10,000 for vehicle rental.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicle 1: \", model.getVal(V1))\n    print(\"Number of Vehicle 2: \", model.getVal(V2))\n    print(\"Number of Vehicle 3: \", model.getVal(V3))\n    print(\"Number of Vehicle 4: \", model.getVal(V4))\n    print(\"Number of Vehicle 5: \", model.getVal(V5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has a different operational cost and revenue generation capability. Truck A has an operational cost of $1000 per month and generates a revenue of $1500 per month. Truck B has an operational cost of $1200 per month and generates a revenue of $1800 per month. Truck C has an operational cost of $1400 per month and generates a revenue of $2000 per month. Van D has an operational cost of $800 per month and generates a revenue of $1200 per month. Van E has an operational cost of $600 per month and generates a revenue of $900 per month. The company aims to maximize its net profit, which is the total revenue minus the total operational cost. However, due to economies of scale, the operational cost per vehicle decreases by 0.1% for each additional vehicle of the same type deployed.\n// Operational cost of A: Cost_A = 1000 * (1 - 0.001 * (A - 1)) * A\n// Operational cost of B: Cost_B = 1200 * (1 - 0.001 * (B - 1)) * B\n// Operational cost of C: Cost_C = 1400 * (1 - 0.001 * (C - 1)) * C\n// Operational cost of D: Cost_D = 800 * (1 - 0.001 * (D - 1)) * D\n// Operational cost of E: Cost_E = 600 * (1 - 0.001 * (E - 1)) * E\n// Revenue of A: Revenue_A = 1500 * A\n// Revenue of B: Revenue_B = 1800 * B\n// Revenue of C: Revenue_C = 2000 * C\n// Revenue of D: Revenue_D = 1200 * D\n// Revenue of E: Revenue_E = 900 * E\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle operational costs for the month.\n// 1000 * (1 - 0.001 * (A - 1)) * A + 1200 * (1 - 0.001 * (B - 1)) * B + 1400 * (1 - 0.001 * (C - 1)) * C + 800 * (1 - 0.001 * (D - 1)) * D + 600 * (1 - 0.001 * (E - 1)) * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the total number of vehicles it can deploy, which is 100.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Van D, and Van E. The company needs to decide how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each vehicle type has a different operational cost and revenue generation capability. Truck A has an operational cost of $1000 per month and generates a revenue of $1500 per month. Truck B has an operational cost of $1200 per month and generates a revenue of $1800 per month. Truck C has an operational cost of $1400 per month and generates a revenue of $2000 per month. Van D has an operational cost of $800 per month and generates a revenue of $1200 per month. Van E has an operational cost of $600 per month and generates a revenue of $900 per month. Due to economies of scale, the operational cost per vehicle decreases by 0.1% for each additional vehicle of the same type deployed. The company has a budget of $100,000 for vehicle operational costs for the month. The company also has a limit on the total number of vehicles it can deploy, which is 100. The company aims to maximize its net profit, which is the total revenue minus the total operational cost. Please help the company determine the optimal number of each vehicle type to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Van D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Operational cost and revenue calculations with economies of scale\nCost_A = 1000 * (1 - 0.001 * (A - 1)) * A\nCost_B = 1200 * (1 - 0.001 * (B - 1)) * B\nCost_C = 1400 * (1 - 0.001 * (C - 1)) * C\nCost_D = 800 * (1 - 0.001 * (D - 1)) * D\nCost_E = 600 * (1 - 0.001 * (E - 1)) * E\n\nRevenue_A = 1500 * A\nRevenue_B = 1800 * B\nRevenue_C = 2000 * C\nRevenue_D = 1200 * D\nRevenue_E = 900 * E\n\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C) + (Revenue_D - Cost_D) + (Revenue_E - Cost_E))\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle operational costs for the month.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 100000)\n## The company has a limit on the total number of vehicles it can deploy, which is 100.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Van D: \", model.getVal(D))\n    print(\"Number of Van E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in machine efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $5,000 invested in machine efficiency upgrades. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades.\n// Total revenue for ProductA: RevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductB: RevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductC: RevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 20 machines available for the production of all products.\n// MachinesA + MachinesB + MachinesC <= 20\n\n## Generate Constraint-2:\nThe total investment in machine efficiency upgrades cannot exceed $100,000.\n// EfficiencyInvestment <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units.\n// QuantityA >= 500; QuantityB >= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades.\n\n| Product | Initial Production Time (minutes) | Revenue per Unit |\n|---------|-----------------------------------|------------------|\n| ProductA | 30                                | $100             |\n| ProductB | 25                                | $120             |\n| ProductC | 20                                | $150             |\n\nThe company has a total of 20 machines available for the production of all products. The total investment in machine efficiency upgrades cannot exceed $100,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units.\n\nPlease help the company to maximize the total revenue from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=400)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in machine efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\nRevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\nRevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n## convert the division to multiplication\nmodel.addCons(obj * (30 - 0.0002 * EfficiencyInvestment) == 100 * QuantityA)\nmodel.addCons(obj * (25 - 0.0002 * EfficiencyInvestment) == 120 * QuantityB)\nmodel.addCons(obj * (20 - 0.0002 * EfficiencyInvestment) == 150 * QuantityC)\n\n# Add constraints\n## The company has a total of 20 machines available for the production of all products.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 20)\n## The total investment in machine efficiency upgrades cannot exceed $100,000.\nmodel.addCons(EfficiencyInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Machine Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1445,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer aims to maximize the total profit while considering the efficiency of battery usage.\n// Profit_E1 = 3000 * E1 - 2000 * E1\n// Profit_E2 = 4000 * E2 - 2500 * E2\n// Profit_E3 = 5000 * E3 - 3000 * E3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (2 * E1 + 3 * E2 + 4 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited battery supply of 500 kWh.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a production budget of $1,000,000 for production costs.\n// 2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 500 units in total.\n// E1 + E2 + E3 <= 500\n\n## Generate Constraint-4:\nThe market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1.\n// E1 <= 50",
        "question": "A manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit, production cost, and battery requirement for each EV type are given in the following Table.\n\n| EV Type | Profit per Unit | Production Cost | Battery Requirement (kWh) |\n|---------|-----------------|-----------------|--------------------------|\n| E1      | $3000           | $2000           | 2                        |\n| E2      | $4000           | $2500           | 3                        |\n| E3      | $5000           | $3000           | 4                        |\n\nThe manufacturer has a limited battery supply of 500 kWh. The manufacturer has a production budget of $1,000,000 for production costs. The manufacturer has a production capacity of 500 units in total. The market demand for E1 is 50 units, so the manufacturer can only sell a maximum of 50 units of E1. \n\nPlease help the manufacturer to maximize the total profit while considering the efficiency of battery usage, which is defined as the sum of the profit per unit minus the production cost per unit, divided by the sum of the battery requirements for each EV type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=50)  # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0)  # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0)  # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (3000 - 2000) * E1\nProfit_E2 = (4000 - 2500) * E2\nProfit_E3 = (5000 - 3000) * E3\nBatteryUsage = 2 * E1 + 3 * E2 + 4 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / BatteryUsage\n## convert the division to multiplication\nmodel.addCons(obj * BatteryUsage == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited battery supply of 500 kWh.\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 500)\n## The manufacturer has a production budget of $1,000,000 for production costs.\nmodel.addCons(2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000)\n## The manufacturer has a production capacity of 500 units in total.\nmodel.addCons(E1 + E2 + E3 <= 500)\n## The market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1.\nmodel.addCons(E1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1334,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks for route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times per truck. \nRoute 1: 50 liters of fuel per trip, 10 hours per trip.\nRoute 2: 60 liters of fuel per trip, 8 hours per trip.\nRoute 3: 70 liters of fuel per trip, 6 hours per trip.\nRoute 4: 80 liters of fuel per trip, 5 hours per trip.\nRoute 5: 90 liters of fuel per trip, 4 hours per trip.\nRoute 6: 100 liters of fuel per trip, 3 hours per trip.\nThe company wants to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time.\n// Total fuel cost for route 1: FC1 = 50 * T1\n// Total fuel cost for route 2: FC2 = 60 * T2\n// Total fuel cost for route 3: FC3 = 70 * T3\n// Total fuel cost for route 4: FC4 = 80 * T4\n// Total fuel cost for route 5: FC5 = 90 * T5\n// Total fuel cost for route 6: FC6 = 100 * T6\n// Total time cost for route 1: TC1 = 10 * T1\n// Total time cost for route 2: TC2 = 8 * T2\n// Total time cost for route 3: TC3 = 6 * T3\n// Total time cost for route 4: TC4 = 5 * T4\n// Total time cost for route 5: TC5 = 4 * T5\n// Total time cost for route 6: TC6 = 3 * T6\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2.\n// T1 <= 10; T2 <= 10\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 <= 50,000\n\n## Generate Constraint-4:\nEach route must have at least one truck assigned.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1; T6 >= 1\n\n## Generate Constraint-5:\nDue to safety regulations, the number of trucks on Route 3 and Route 4 combined cannot exceed 15.\n// T3 + T4 <= 15",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has different fuel consumption rates and delivery times per truck. \nRoute 1: 50 liters of fuel per trip, 10 hours per trip.\nRoute 2: 60 liters of fuel per trip, 8 hours per trip.\nRoute 3: 70 liters of fuel per trip, 6 hours per trip.\nRoute 4: 80 liters of fuel per trip, 5 hours per trip.\nRoute 5: 90 liters of fuel per trip, 4 hours per trip.\nRoute 6: 100 liters of fuel per trip, 3 hours per trip.\nThe company has a total of 50 trucks available. Due to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2. The company has a budget of $50,000 for fuel costs. Each route must have at least one truck assigned. Due to safety regulations, the number of trucks on Route 3 and Route 4 combined cannot exceed 15.\nPlease help the company to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks for route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1, ub=10) # number of trucks for route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks for route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks for route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks for route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=1) # number of trucks for route 6\n\n# Define objective function\nFC1 = 50 * T1\nFC2 = 60 * T2\nFC3 = 70 * T3\nFC4 = 80 * T4\nFC5 = 90 * T5\nFC6 = 100 * T6\nTC1 = 10 * T1\nTC2 = 8 * T2\nTC3 = 6 * T3\nTC4 = 5 * T4\nTC5 = 4 * T5\nTC6 = 3 * T6\n# So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\nmodel.addCons(T1 <= 10)\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 <= 50000)\nmodel.addCons(T3 + T4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks for Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks for Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks for Route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product. The production efficiency varies per product and per worker.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnts\", \"range\": \"ProductBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnts\", \"range\": \"ProductCUnts >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAWokers\", \"range\": \"ProductAWokers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBWokers\", \"range\": \"ProductBWokers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCWokers\", \"range\": \"ProductCWokers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company aims to maximize its daily net profit.\n// Profit_ProductA = 50 * ProductAUnits - 100 * ProductAWokers\n// Profit_ProductB = 70 * ProductBUnts - 100 * ProductBWokers\n// Profit_ProductC = 60 * ProductCUnts - 100 * ProductCWokers\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAWokers + ProductBWokers + ProductCWokers <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product. The production efficiency varies per product and per worker. The profit per unit and labor cost per worker for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $100                  |\n| ProductB | $70             | $100                  |\n| ProductC | $60             | $100                  |\n\nThe company has a total of 50 workers available. The company aims to maximize its daily net profit. Please help the company determine the optimal number of units to produce for each product and the number of workers to assign to each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0)  # number of units of ProductA\nProductBUnts = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnts\", lb=0)  # number of units of ProductB\nProductCUnts = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnts\", lb=0)  # number of units of ProductC\nProductAWokers = model.addVar(vtype=\"INTEGER\", name=\"ProductAWokers\", lb=0)  # number of workers for ProductA\nProductBWokers = model.addVar(vtype=\"INTEGER\", name=\"ProductBWokers\", lb=0)  # number of workers for ProductB\nProductCWokers = model.addVar(vtype=\"INTEGER\", name=\"ProductCWokers\", lb=0)  # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = 50 * ProductAUnits - 100 * ProductAWokers\nProfit_ProductB = 70 * ProductBUnts - 100 * ProductBWokers\nProfit_ProductC = 60 * ProductCUnts - 100 * ProductCWokers\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAWokers + ProductBWokers + ProductCWokers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnts))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnts))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAWokers))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBWokers))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCWokers))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. \nOn route 1, the cost per truck is $1000 per day.\nOn route 2, the cost per truck is $1200 per day.\nOn route 3, the cost per truck is $1500 per day.\nOn route 4, the cost per truck is $1300 per day.\nOn route 5, the cost per truck is $1100 per day.\nThe company aims to minimize the total cost while ensuring all routes are covered.\n// Cost_T1 = 1000 * T1\n// Cost_T2 = 1200 * T2\n// Cost_T3 = 1500 * T3\n// Cost_T4 = 1300 * T4\n// Cost_T5 = 1100 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe company has a total fleet of 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route must be covered by at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1\n\n## Generate Constraint-3:\nThe total daily budget for all routes is $50,000.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1300 * T4 + 1100 * T5 <= 50000\n\n## Generate Constraint-4:\nThe company has a policy that no more than 15 trucks can be assigned to any single route.\n// T1 <= 15; T2 <= 15; T3 <= 15; T4 <= 15; T5 <= 15",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. On route 1, the cost per truck is $1000 per day. On route 2, the cost per truck is $1200 per day. On route 3, the cost per truck is $1500 per day. On route 4, the cost per truck is $1300 per day. On route 5, the cost per truck is $1100 per day. The company has a total fleet of 50 trucks and a total daily budget for all routes of $50,000. Each route must be covered by at least one truck, and no more than 15 trucks can be assigned to any single route. Please help the company to minimize the total cost while ensuring all routes are covered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must be covered by at least one truck.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 1000 * T1\nCost_T2 = 1200 * T2\nCost_T3 = 1500 * T3\nCost_T4 = 1300 * T4\nCost_T5 = 1100 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The company has a total fleet of 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The total daily budget for all routes is $50,000.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1300 * T4 + 1100 * T5 <= 50000)\n## The company has a policy that no more than 15 trucks can be assigned to any single route.\nmodel.addCons(T1 <= 15)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 15)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational cost while considering the efficiency of each vehicle type. The operational cost per vehicle is a nonlinear function of the number of vehicles, given by:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\nThe objective is to minimize the total operational cost.\n// Total operational cost = 10000 + 50 * Truck1^2 + 12000 + 40 * Truck2^2 + 8000 + 60 * Van1^2 + 9000 + 55 * Van2^2 + 5000 + 70 * Sedan^2\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle acquisition.\n// 10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs. The company wants to minimize the total operational cost, which is a nonlinear function of the number of vehicles:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\nThe company has a budget of $500,000 for vehicle acquisition. Please help the company determine the optimal number of each type of vehicle to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The operational cost per vehicle is a nonlinear function of the number of vehicles\nCost_Truck1 = 10000 + 50 * Truck1**2\nCost_Truck2 = 12000 + 40 * Truck2**2\nCost_Van1 = 8000 + 60 * Van1**2\nCost_Van2 = 9000 + 55 * Van2**2\nCost_Sedan = 5000 + 70 * Sedan**2\n## The objective is to minimize the total operational cost\nmodel.addCons(obj == Cost_Truck1 + Cost_Truck2 + Cost_Van1 + Cost_Van2 + Cost_Sedan)\n\n# Add constraints\n## The company has a budget of $500,000 for vehicle acquisition.\nmodel.addCons(10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Number of Sedan: \", model.getVal(Sedan))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region A, Region B, and Region C. They need to determine the number of solar panels and wind turbines to install in each region to maximize energy output while considering the cost and space constraints.\n// {\"number of solar panels in Region A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6. The company wants to maximize the total energy output from all regions.\n// Total energy output for Region A: E_A = 100 * (SolarA^0.7) + 150 * (WindA^0.6)\n// Total energy output for Region B: E_B = 100 * (SolarB^0.7) + 150 * (WindB^0.6)\n// Total energy output for Region C: E_C = 100 * (SolarC^0.7) + 150 * (WindC^0.6)\n// So, the objective function is: Maximize E_total = E_A + E_B + E_C\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for installation costs. The cost of installing a solar panel is $5,000, and a wind turbine is $10,000.\n// 5000 * (SolarA + SolarB + SolarC) + 10000 * (WindA + WindB + WindC) <= 1,000,000\n\n## Generate Constraint-2:\nEach region has a limited space for installation. Region A has space for 100 units, Region B for 150 units, and Region C for 200 units.\n// SolarA + WindA <= 100\n// SolarB + WindB <= 150\n// SolarC + WindC <= 200\n\n## Generate Constraint-3:\nThe company aims to have at least 20% of the total installations as wind turbines to ensure a diversified energy source.\n// (WindA + WindB + WindC) >= 0.2 * (SolarA + SolarB + SolarC + WindA + WindB + WindC)\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 solar panels are installed across all regions.\n// SolarA + SolarB + SolarC >= 50\n\n## Generate Constraint-5:\nDue to local regulations, the number of wind turbines in Region A cannot exceed the number of solar panels in that region.\n// WindA <= SolarA",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region A, Region B, and Region C. They need to determine the number of solar panels and wind turbines to install in each region to maximize energy output while considering the cost and space constraints.\nThe energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6. The company wants to maximize the total energy output from all regions.\nThe company has a budget of $1,000,000 for installation costs. The cost of installing a solar panel is $5,000, and a wind turbine is $10,000. Each region has a limited space for installation. Region A has space for 100 units, Region B for 150 units, and Region C for 200 units. The company aims to have at least 20% of the total installations as wind turbines to ensure a diversified energy source. The company wants to ensure that at least 50 solar panels are installed across all regions. Due to local regulations, the number of wind turbines in Region A cannot exceed the number of solar panels in that region.\nPlease help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in Region A\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in Region A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in Region B\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in Region B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in Region C\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in Region C\n\n# Define objective function\n## The energy output of a solar panel is modeled as E_solar = 100 * Solar^0.7, and for a wind turbine, E_wind = 150 * Wind^0.6.\nE_A = 100 * (SolarA**0.7) + 150 * (WindA**0.6)\nE_B = 100 * (SolarB**0.7) + 150 * (WindB**0.6)\nE_C = 100 * (SolarC**0.7) + 150 * (WindC**0.6)\nE_total = E_A + E_B + E_C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## The company has a budget of $1,000,000 for installation costs.\nmodel.addCons(5000 * (SolarA + SolarB + SolarC) + 10000 * (WindA + WindB + WindC) <= 1000000)\n## Each region has a limited space for installation.\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 150)\nmodel.addCons(SolarC + WindC <= 200)\n## The company aims to have at least 20% of the total installations as wind turbines.\nmodel.addCons((WindA + WindB + WindC) >= 0.2 * (SolarA + SolarB + SolarC + WindA + WindB + WindC))\n## The company wants to ensure that at least 50 solar panels are installed across all regions.\nmodel.addCons(SolarA + SolarB + SolarC >= 50)\n## Due to local regulations, the number of wind turbines in Region A cannot exceed the number of solar panels in that region.\nmodel.addCons(WindA <= SolarA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindC))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. These investments will reduce the production cost per unit for each product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced tech for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced tech for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced tech for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is initially $100, for ProductB is $150, and for ProductC is $200. Every $10,000 invested in advanced technologies reduces the production cost per unit by $5 for ProductA, $7 for ProductB, and $9 for ProductC. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0007 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0009 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in advanced technologies.\n// InvestmentA + InvestmentB + InvestmentC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. These investments will reduce the production cost per unit for each product. The initial production cost per unit, selling price per unit, and the effect of investment on production cost are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price | Investment Effect on Cost |\n|---------|-------------------------|---------------|---------------------------|\n| ProductA | $100                    | $150          | $5 per $10,000 invested  |\n| ProductB | $150                    | $200          | $7 per $10,000 invested  |\n| ProductC | $200                    | $250          | $9 per $10,000 invested  |\n\nThe company has a total budget of $100,000 for investments in advanced technologies. The total production capacity of the company is 5000 units. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities and investments to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # investment in advanced tech for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # investment in advanced tech for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # investment in advanced tech for ProductC\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * InvestmentA)) * QuantityA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0007 * InvestmentB)) * QuantityB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0009 * InvestmentC)) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (150 - (100 - 0.0005 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0007 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0009 * InvestmentC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investments in advanced technologies.\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 100000)\n## The total production capacity of the company is 5000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in ProductC: \", model.getVal(InvestmentC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency.\n// {\"quantity of Drug A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Drug A is $10, but it decreases by $0.02 for every unit produced above 100. The profit per unit of Drug B is $15, but it decreases by $0.03 for every unit produced above 150. The profit per unit of Drug C is $20, but it decreases by $0.04 for every unit produced above 200. The profit per unit of Drug D is $25, but it decreases by $0.05 for every unit produced above 250. The profit per unit of Drug E is $30, but it decreases by $0.06 for every unit produced above 300. The company wants to maximize the total profit from selling the drugs.\n// Profit_A = max(10 - 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 - 0.03 * (B - 150), 15) * B\n// Profit_C = max(20 - 0.04 * (C - 200), 20) * C\n// Profit_D = max(25 - 0.05 * (D - 250), 25) * D\n// Profit_E = max(30 - 0.06 * (E - 300), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe cost of raw materials for Drug A is $3 per unit, for Drug B is $4 per unit, for Drug C is $5 per unit, for Drug D is $6 per unit, and for Drug E is $7 per unit. The company has a budget of $2000 for raw materials.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000\n\n## Generate Constraint-2:\nThe production capacity for each drug is limited. The maximum production capacity for Drug A is 300 units, for Drug B is 250 units, for Drug C is 200 units, for Drug D is 150 units, and for Drug E is 100 units.\n// A <= 300; B <= 250; C <= 200; D <= 150; E <= 100\n\n## Generate Constraint-3:\nThe total production capacity of the company is 600 units.\n// A + B + C + D + E <= 600",
        "question": "A pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency. The profit per unit of each drug decreases as more units are produced above certain thresholds, as shown in the following Table.\n\n| Drug   | Profit per Unit (above threshold) | Decrease per Unit (above threshold) | Threshold |\n|--------|----------------------------------|------------------------------------|-----------|\n| A      | $10                              | $0.02                              | 100       |\n| B      | $15                              | $0.03                              | 150       |\n| C      | $20                              | $0.04                              | 200       |\n| D      | $25                              | $0.05                              | 250       |\n| E      | $30                              | $0.06                              | 300       |\n\nThe cost of raw materials for Drug A is $3 per unit, for Drug B is $4 per unit, for Drug C is $5 per unit, for Drug D is $6 per unit, and for Drug E is $7 per unit. The company has a budget of $2000 for raw materials. The production capacity for each drug is limited: the maximum production capacity for Drug A is 300 units, for Drug B is 250 units, for Drug C is 200 units, for Drug D is 150 units, and for Drug E is 100 units. The total production capacity of the company is 600 units.\n\nPlease help the company to maximize the total profit from selling the drugs, considering the constraints on raw material costs and production capacities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Drug A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of Drug B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of Drug C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=150) # quantity of Drug D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=100) # quantity of Drug E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.03 * (B - 150), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.03 * (B2 - 150)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.04 * (C - 200), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.04 * (C2 - 200)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.05 * (D - 250), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=250)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=250, ub=150)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.05 * (D2 - 250)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.06 * (E - 300), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=300)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=300, ub=100)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.06 * (E2 - 300)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000)\nmodel.addCons(A + B + C + D + E <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Drug A: \", model.getVal(A))\n    print(\"Quantity of Drug B: \", model.getVal(B))\n    print(\"Quantity of Drug C: \", model.getVal(C))\n    print(\"Quantity of Drug D: \", model.getVal(D))\n    print(\"Quantity of Drug E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1698,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels, wind turbines, and hydroelectric plants to generate renewable energy. The city needs to determine the optimal number of each type of installation to minimize the total cost while meeting the energy demand.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $5000, a wind turbine is $10000, and a hydroelectric plant is $20000. The energy output per unit for solar is 1000 kWh, for wind is 2000 kWh, and for hydro is 3000 kWh. The city aims to minimize the total installation cost.\n// Total installation cost: Cost = 5000 * Solar + 10000 * Wind + 20000 * Hydro\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of renewable energy sources.\n// 5000 * Solar + 10000 * Wind + 20000 * Hydro <= 500000\n\n## Generate Constraint-2:\nThe city needs to generate at least 1,000,000 kWh of energy.\n// 1000 * Solar + 2000 * Wind + 3000 * Hydro >= 1000000",
        "question": "A city is planning to install solar panels, wind turbines, and hydroelectric plants to generate renewable energy. The city needs to determine the optimal number of each type of installation to minimize the total cost while meeting the energy demand. The cost of installing a solar panel is $5000, a wind turbine is $10000, and a hydroelectric plant is $20000. The energy output per unit for solar is 1000 kWh, for wind is 2000 kWh, and for hydro is 3000 kWh. The city has a budget of $500,000 for the installation of renewable energy sources. The city needs to generate at least 1,000,000 kWh of energy.\n\nPlease help the city to minimize the total installation cost.\n\n| Installation Type | Cost per Unit | Energy Output per Unit |\n|-------------------|---------------|-------------------------|\n| Solar Panel       | $5000         | 1000 kWh                |\n| Wind Turbine      | $10000        | 2000 kWh                |\n| Hydroelectric Plant | $20000       | 3000 kWh                |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric plants\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total installation cost: Cost = 5000 * Solar + 10000 * Wind + 20000 * Hydro\nCost = 5000 * Solar + 10000 * Wind + 20000 * Hydro\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of renewable energy sources.\nmodel.addCons(5000 * Solar + 10000 * Wind + 20000 * Hydro <= 500000)\n## The city needs to generate at least 1,000,000 kWh of energy.\nmodel.addCons(1000 * Solar + 2000 * Wind + 3000 * Hydro >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(Hydro))\n    print(\"Minimized Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons.\n// The total cost function is: 50S + 70M + 90L + 110XL + 130R\n// The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\n// The objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for operational costs.\n// 50S + 70M + 90L + 110XL + 130R <= 5000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can operate. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10.\n// S <= 30; M <= 25; L <= 20; XL <= 15; R <= 10",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons. The company has a budget of $5000 per day for operational costs. The company also has a limit on the number of trucks it can operate: the maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10.\n\nPlease help the company to minimize the total daily operational cost (which is defined as the sum of the daily costs of each type of truck) while ensuring all cargo is delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=30) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=25) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=20) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0, ub=15) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=10) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost function is: 50S + 70M + 90L + 110XL + 130R\nmodel.addCons(obj == 50*S + 70*M + 90*L + 110*XL + 130*R)\n\n# Add constraints\n## The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\nmodel.addCons(10*S + 20*M + 30*L + 40*XL + 25*R >= 1000)\n## The company has a budget of $5000 per day for operational costs.\nmodel.addCons(50*S + 70*M + 90*L + 110*XL + 130*R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy trucks\": \"HeavyTech\", \"range\": \"HeavyTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Light trucks\": \"LightTech\", \"range\": \"LightTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n// Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n// Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n// So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000.\n// 50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50\n\n## Generate Constraint-3:\nDue to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\n// HeavyTrucks >= 10; LightTrucks <= 20\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\n// HeavyTech <= 0.5 * 50000 * HeavyTrucks\n// MediumTech <= 0.5 * 30000 * MediumTrucks\n// LightTech <= 0.5 * 20000 * LightTrucks",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks.\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000. The total number of trucks cannot exceed 50. Due to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks. The investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\n\nPlease help the company to maximize the total fuel cost savings across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)\nHeavyTech = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyTech\", lb=0)\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)\nLightTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LightTech\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nMilesHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesHeavy\")\nMilesMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesMedium\")\nMilesLight = model.addVar(vtype=\"CONTINUOUS\", name=\"MilesLight\")\n## Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n## Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n## Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\nmodel.addCons(obj == (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy + \n              (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium + \n              (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + \n              HeavyTech + MediumTech + LightTech <= 200000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n## Due to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\nmodel.addCons(HeavyTrucks >= 10)\nmodel.addCons(LightTrucks <= 20)\n## The investment in fuel-efficient technology for each type of truck must not exceed 50% of the total cost of that type of truck.\nmodel.addCons(HeavyTech <= 0.5 * 50000 * HeavyTrucks)\nmodel.addCons(MediumTech <= 0.5 * 30000 * MediumTrucks)\nmodel.addCons(LightTech <= 0.5 * 20000 * LightTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Heavy Tech: \", model.getVal(HeavyTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Light Tech: \", model.getVal(LightTech))\n    print(\"Maximized Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n// Delivery efficiency of Trucks: Efficiency_T = 10 * T / 100\n// Delivery efficiency of Vans: Efficiency_V = 5 * V / 50\n// Delivery efficiency of Bikes: Efficiency_B = 2 * B / 20\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B) = Maximize (10 * T / 100 + 5 * V / 50 + 2 * B / 20)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for operational costs.\n// 100 * T + 50 * V + 20 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints. The operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs. The company has a budget of $1000 per day for operational costs. Additionally, the company has a total of 50 drivers available. Please help the company to maximize the delivery efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = 10 * T / 100\nEfficiency_V = 5 * V / 50\nEfficiency_B = 2 * B / 20\n## convert the division to multiplication\nmodel.addCons(obj * (100 * T + 50 * V + 20 * B) == 10 * T + 5 * V + 2 * B)\n\n# Add constraints\n## The company has a budget of $1000 per day for operational costs.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost.\n// Total cargo capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n// Total maintenance cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck maintenance next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100,000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\nEach TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost.\nThe company has a budget of $100,000 for truck maintenance next month.\nPlease help the company to maximize the total cargo capacity minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## Total cargo capacity and total maintenance cost\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Capacity - Cost)\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for truck maintenance next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Cargo Capacity - Maintenance Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to decide how many trucks of each type to purchase to optimize their operations.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a maintenance cost of $500 per month, and a cargo capacity of 5 tons.\nThe medium trucks have a fuel efficiency of 8 km/l, a maintenance cost of $700 per month, and a cargo capacity of 10 tons.\nThe large trucks have a fuel efficiency of 6 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 15 tons.\nThe company wants to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity.\n// FuelCost_Small = 100 / 10 * SmallTrucks * 500\n// FuelCost_Medium = 100 / 8 * MediumTrucks * 700\n// FuelCost_Large = 100 / 6 * LargeTrucks * 1000\n// MaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\n// TotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// SmallTrucks * 20000 + MediumTrucks * 30000 + LargeTrucks * 40000 <= 100000\n\n## Generate Constraint-2:\nThe total cargo capacity of the new fleet must be at least 500 tons.\n// 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nThe company can only accommodate a maximum of 20 new trucks in their current facilities.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads.\n// MediumTrucks + LargeTrucks >= 0.5 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The small trucks have a fuel efficiency of 10 km/l, a maintenance cost of $500 per month, and a cargo capacity of 5 tons. The medium trucks have a fuel efficiency of 8 km/l, a maintenance cost of $700 per month, and a cargo capacity of 10 tons. The large trucks have a fuel efficiency of 6 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 15 tons. The company has a budget of $100,000 for purchasing new trucks. The total cargo capacity of the new fleet must be at least 500 tons. The company can only accommodate a maximum of 20 new trucks in their current facilities. The company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads. Please help the company to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = (100 / 10) * SmallTrucks * 500\nFuelCost_Medium = (100 / 8) * MediumTrucks * 700\nFuelCost_Large = (100 / 6) * LargeTrucks * 1000\nMaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\nTotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n## convert the division to multiplication\nmodel.addCons(obj * 100 == FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The total cargo capacity of the new fleet must be at least 500 tons.\nmodel.addCons(5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500)\n## The company can only accommodate a maximum of 20 new trucks in their current facilities.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The company aims to have at least 50% of the new fleet be medium or large trucks to handle heavier loads.\nmodel.addCons(MediumTrucks + LargeTrucks >= 0.5 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost Per Km: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company wants to maximize the energy output while minimizing the carbon footprint.\n// Energy Output = 15% * 1000 * Solar1 + 20% * 1500 * Solar2 + 25% * 2000 * Solar3 + 30% * 2500 * Solar4 + 35% * 3000 * Solar5 + 20% * 2000 * Wind1 + 25% * 2500 * Wind2 + 30% * 3000 * Wind3\n// Carbon Footprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n// So, the objective function is: Maximize Energy Output / Carbon Footprint\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000\n\n## Generate Constraint-3:\nThe total number of solar panels and wind turbines must not exceed 1000.\n// Solar1 + Solar2 + Solar3 + Solar4 + Solar5 + Wind1 + Wind2 + Wind3 <= 1000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). The efficiency, cost, and carbon footprint for each type of solar panel and wind turbine are given in the following Table.\n\n| Type       | Efficiency | Cost | Carbon Footprint |\n|------------|------------|------|------------------|\n| Solar1     | 15%        | $1000| 50 kg            |\n| Solar2     | 20%        | $1500| 70 kg            |\n| Solar3     | 25%        | $2000| 90 kg            |\n| Solar4     | 30%        | $2500| 110 kg           |\n| Solar5     | 35%        | $3000| 130 kg           |\n| Wind1      | 20%        | $2000| 100 kg           |\n| Wind2      | 25%        | $2500| 120 kg           |\n| Wind3      | 30%        | $3000| 140 kg           |\n\nThe company has a budget of $1,000,000 for the installation. At least 30% of the budget must be spent on solar panels. The total number of solar panels and wind turbines must not exceed 1000. The company wants to maximize the energy output while minimizing the carbon footprint.\n\nPlease help the company determine the optimal number of each type of solar panel and wind turbine to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput = 0.15 * 1000 * Solar1 + 0.20 * 1500 * Solar2 + 0.25 * 2000 * Solar3 + 0.30 * 2500 * Solar4 + 0.35 * 3000 * Solar5 + 0.20 * 2000 * Wind1 + 0.25 * 2500 * Wind2 + 0.30 * 3000 * Wind3\nCarbonFootprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n## the objective function is: Maximize Energy Output / Carbon Footprint\n## convert the division to multiplication\nmodel.addCons(obj * CarbonFootprint == EnergyOutput)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000)\n## At least 30% of the budget must be spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000)\n## The total number of solar panels and wind turbines must not exceed 1000.\nmodel.addCons(Solar1 + Solar2 + Solar3 + Solar4 + Solar5 + Wind1 + Wind2 + Wind3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output / Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (S) and wind turbines (W) to install in each region, as well as the investment in energy storage systems (E) to maximize the efficiency of the renewable energy sources.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases by 5% for every additional 100 solar panels installed, and the efficiency of wind turbines decreases by 3% for every additional 50 wind turbines installed. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The energy storage system improves the overall efficiency by 1% for every $10,000 invested. The company aims to maximize the total energy output.\n// EnergyOutput_S = 0.2 * S * (1 - 0.05 * (S / 100))\n// EnergyOutput_W = 0.3 * W * (1 - 0.03 * (W / 50))\n// EnergyOutput_E = (EnergyOutput_S + EnergyOutput_W) * (1 + 0.01 * (E / 10000))\n// So, the objective function is: Maximize EnergyOutput_E\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// S * 5000 + W * 10000 <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage systems cannot exceed $200,000.\n// E <= 200000\n\n## Generate Constraint-3:\nThe total number of installations (solar panels and wind turbines) must not exceed 500 units.\n// S + W <= 500\n\n## Generate Constraint-4:\nAt least 100 solar panels must be installed to meet the minimum solar energy requirement.\n// S >= 100\n\n## Generate Constraint-5:\nThe company must ensure that the number of wind turbines does not exceed twice the number of solar panels.\n// W <= 2 * S",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (S) and wind turbines (W) to install in each region, as well as the investment in energy storage systems (E) to maximize the efficiency of the renewable energy sources. The efficiency of solar panels decreases by 5% for every additional 100 solar panels installed, and the efficiency of wind turbines decreases by 3% for every additional 50 wind turbines installed. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The energy storage system improves the overall efficiency by 1% for every $10,000 invested. The company aims to maximize the total energy output.\n\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage systems cannot exceed $200,000. The total number of installations (solar panels and wind turbines) must not exceed 500 units. At least 100 solar panels must be installed to meet the minimum solar energy requirement. The company must ensure that the number of wind turbines does not exceed twice the number of solar panels.\n\nPlease help the company to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput_S = 0.2 * S * (1 - 0.05 * (S / 100))\nEnergyOutput_W = 0.3 * W * (1 - 0.03 * (W / 50))\nEnergyOutput_E = (EnergyOutput_S + EnergyOutput_W) * (1 + 0.01 * (E / 10000))\n## the objective function is: Maximize EnergyOutput_E\nmodel.addCons(obj == EnergyOutput_E)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\nmodel.addCons(S * 5000 + W * 10000 <= 1000000)\n## The total investment in energy storage systems cannot exceed $200,000.\nmodel.addCons(E <= 200000)\n## The total number of installations (solar panels and wind turbines) must not exceed 500 units.\nmodel.addCons(S + W <= 500)\n## At least 100 solar panels must be installed to meet the minimum solar energy requirement.\nmodel.addCons(S >= 100)\n## The company must ensure that the number of wind turbines does not exceed twice the number of solar panels.\nmodel.addCons(W <= 2 * S)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_A = 50 * ProductA\n// Profit_B = 70 * ProductB\n// Profit_C = 60 * ProductC\n// ShiftCost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can only support up to 3 shifts per day.\n// NumShifts <= 3\n\n## Generate Constraint-3:\nDue to market demand, the production of product A must be at least twice the production of product B.\n// ProductA >= 2 * ProductB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts. The company has a limited workforce that can only support up to 3 shifts per day. Due to market demand, the production of product A must be at least twice the production of product B. Please help the company to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nProfit_A = 50 * ProductA\nProfit_B = 70 * ProductB\nProfit_C = 60 * ProductC\nShiftCost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - ShiftCost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The company has a limited workforce that can only support up to 3 shifts per day.\nmodel.addCons(NumShifts <= 3)\n# Due to market demand, the production of product A must be at least twice the production of product B.\nmodel.addCons(ProductA >= 2 * ProductB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities of each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. Due to economies of scale, the profit per unit increases by $0.10 for each type of device as the production quantity exceeds 100 units. The company aims to maximize the total profit from the production of these devices.\n// Profit_DeviceA = max(100 + 0.10 * (DeviceA - 100), 100) * DeviceA\n// Profit_DeviceB = max(150 + 0.10 * (DeviceB - 100), 150) * DeviceB\n// Profit_DeviceC = max(200 + 0.10 * (DeviceC - 100), 200) * DeviceC\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceA + DeviceB + DeviceC <= 500\n\n## Generate Constraint-2:\nThe market demand for DeviceA is limited to 300 units, for DeviceB to 250 units, and for DeviceC to 200 units.\n// DeviceA <= 300; DeviceB <= 250; DeviceC <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities of each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for each device and the market demand limits are given in the following Table.\n\n| Device | Profit per Unit | Market Demand Limit |\n|--------|-----------------|---------------------|\n| DeviceA | $100, increasing by $0.10 per unit after 100 units | 300 units |\n| DeviceB | $150, increasing by $0.10 per unit after 100 units | 250 units |\n| DeviceC | $200, increasing by $0.10 per unit after 100 units | 200 units |\n\nThe company has a total production capacity of 500 units. The market demand for each device must also be respected. Please help the company to maximize the total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for DeviceA is limited to 300 units, for DeviceB to 250 units, and for DeviceC to 200 units.\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0, ub=300) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0, ub=250) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=200) # quantity of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = max(100 + 0.10 * (DeviceA - 100), 100) * DeviceA\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=300)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 100 * DeviceA1 * DeviceA_b1 + (100 + 0.10 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = max(150 + 0.10 * (DeviceB - 100), 150) * DeviceB\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=100)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=100, ub=250)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 150 * DeviceB1 * DeviceB_b1 + (150 + 0.10 * (DeviceB2 - 100)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = max(200 + 0.10 * (DeviceC - 100), 200) * DeviceC\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=100)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=100, ub=200)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 200 * DeviceC1 * DeviceC_b1 + (200 + 0.10 * (DeviceC2 - 100)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\n// UnitsA <= 8 * RateA\n// UnitsB <= 8 * RateB\n// UnitsC <= 8 * RateC\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\n// UnitsA >= 20\n// UnitsB >= 15\n// UnitsC >= 25\n\n## Generate Constraint-4:\nThe manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day. The cost of raw materials per unit for product A is $20, for product B is $30, and for product C is $25.\n// 20 * UnitsA + 30 * UnitsB + 25 * UnitsC <= 5000\n\n## Generate Constraint-5:\nThe production process is subject to a nonlinear efficiency factor that decreases the production rate as more units are produced. The efficiency factor for product A is 1/(1 + UnitsA), for product B is 1/(1 + UnitsB), and for product C is 1/(1 + UnitsC).\n// UnitsA <= 8 * RateA * (1 / (1 + UnitsA))\n// UnitsB <= 8 * RateB * (1 / (1 + UnitsB))\n// UnitsC <= 8 * RateC * (1 / (1 + UnitsC))",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The total production capacity of the factory is limited to 100 units per day. The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day. The market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day. The manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day. The cost of raw materials per unit for product A is $20, for product B is $30, and for product C is $25. The production process is subject to a nonlinear efficiency factor that decreases the production rate as more units are produced. The efficiency factor for product A is 1/(1 + UnitsA), for product B is 1/(1 + UnitsB), and for product C is 1/(1 + UnitsC).\n\nPlease help the manufacturer to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=25)  # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the factory is limited to 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n\n# The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\nmodel.addCons(UnitsA <= 8 * 2)  # Assuming RateA = 2\nmodel.addCons(UnitsB <= 8 * 3)  # Assuming RateB = 3\nmodel.addCons(UnitsC <= 8 * 2.5)  # Assuming RateC = 2.5\n\n# The market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\nmodel.addCons(UnitsA >= 20)\nmodel.addCons(UnitsB >= 15)\nmodel.addCons(UnitsC >= 25)\n\n# The manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day. The cost of raw materials per unit for product A is $20, for product B is $30, and for product C is $25.\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 25 * UnitsC <= 5000)\n\n# The production process is subject to a nonlinear efficiency factor that decreases the production rate as more units are produced.\n# UnitsA <= 8 * RateA * (1 / (1 + UnitsA))\n# UnitsB <= 8 * RateB * (1 / (1 + UnitsB))\n# UnitsC <= 8 * RateC * (1 / (1 + UnitsC))\n# These constraints are nonlinear and cannot be directly modeled in SCIP. They require a more complex mathematical formulation or approximation.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the level of maintenance investment for each plant, which affects the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar plant\": \"MaintenanceSolar\", \"range\": \"MaintenanceSolar >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind plant\": \"MaintenanceWind\", \"range\": \"MaintenanceWind >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro plant\": \"MaintenanceHydro\", \"range\": \"MaintenanceHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company aims to maximize the total daily energy production.\n// EnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\n// EnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\n// EnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance investments and operational costs.\n// 1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000\n\n## Generate Constraint-2:\nEach plant has a maximum operational capacity of 24 hours per day.\n// HoursSolar <= 24; HoursWind <= 24; HoursHydro <= 24\n\n## Generate Constraint-3:\nDue to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours.\n// HoursHydro >= 8; HoursWind + HoursSolar <= 40\n\n## Generate Constraint-4:\nThe company must produce at least 1000 kWh of energy per day.\n// EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro >= 1000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the level of maintenance investment for each plant to maximize energy production. The efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company has a total budget of $100,000 for maintenance investments and operational costs. Each plant has a maximum operational capacity of 24 hours per day. Due to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours. The company must produce at least 1000 kWh of energy per day. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0) # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0) # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0) # number of hours Hydro plant operates\nMaintenanceSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSolar\", lb=0) # maintenance investment for Solar plant\nMaintenanceWind = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceWind\", lb=0) # maintenance investment for Wind plant\nMaintenanceHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHydro\", lb=0) # maintenance investment for Hydro plant\n\n# Define objective function\nEnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\nEnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\nEnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n# So, the objective function is: Maximize (EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for maintenance investments and operational costs.\nmodel.addCons(1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000)\n# Each plant has a maximum operational capacity of 24 hours per day.\nmodel.addCons(HoursSolar <= 24)\nmodel.addCons(HoursWind <= 24)\nmodel.addCons(HoursHydro <= 24)\n# Due to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours.\nmodel.addCons(HoursHydro >= 8)\nmodel.addCons(HoursWind + HoursSolar <= 40)\n# The company must produce at least 1000 kWh of energy per day.\nmodel.addCons(EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Solar plant: \", model.getVal(HoursSolar))\n    print(\"Hours of Wind plant: \", model.getVal(HoursWind))\n    print(\"Hours of Hydro plant: \", model.getVal(HoursHydro))\n    print(\"Maintenance investment for Solar plant: \", model.getVal(MaintenanceSolar))\n    print(\"Maintenance investment for Wind plant: \", model.getVal(MaintenanceWind))\n    print(\"Maintenance investment for Hydro plant: \", model.getVal(MaintenanceHydro))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantity of each product and the amount of money to be invested in enhancing the production efficiency, which will reduce the production cost per unit. The production cost reduction is nonlinear and depends on the investment.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The investment in production efficiency reduces the production cost per unit by $0.01 for every $1000 invested. The selling price per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.0001 * EfficiencyInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.0001 * EfficiencyInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.0001 * EfficiencyInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity for all products cannot exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in production efficiency cannot exceed $50,000.\n// EfficiencyInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 200 units, and ProductB must be at least 150 units.\n// QuantityA >= 200; QuantityB >= 150\n\n## Generate Constraint-4:\nThe company must ensure that the production quantity of ProductC does not exceed 300 units.\n// QuantityC <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantity of each product and the amount of money to be invested in enhancing the production efficiency, which will reduce the production cost per unit. The production cost reduction is nonlinear and depends on the investment. The production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The investment in production efficiency reduces the production cost per unit by $0.01 for every $1000 invested. The selling price per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Initial Production Cost |\n|---------|---------------|--------------------------|\n| ProductA | $100         | $50                      |\n| ProductB | $120         | $70                      |\n| ProductC | $150         | $90                      |\n\nThe total production quantity for all products cannot exceed 1000 units. The total investment in production efficiency cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 200 units, and ProductB must be at least 150 units. The company must ensure that the production quantity of ProductC does not exceed 300 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=150)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=300)  # quantity of ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in production efficiency\n\n# Define objective function\nProfitA = (100 - (50 - 0.0001 * EfficiencyInvestment)) * QuantityA\nProfitB = (120 - (70 - 0.0001 * EfficiencyInvestment)) * QuantityB\nProfitC = (150 - (90 - 0.0001 * EfficiencyInvestment)) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1425,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n// Efficiency of Trucks: E_T = 100 * T / 50\n// Efficiency of Vans: E_V = 50 * V / 30\n// Efficiency of Bikes: E_B = 10 * B / 10\n// So, the objective function is: Maximize (E_T + E_V + E_B)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 per day for operational costs.\n// 50 * T + 30 * V + 10 * B <= 1500\n\n## Generate Constraint-2:\nThe company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\n// 100 * T + 50 * V + 10 * B <= 2000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints. The efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity | Operational Cost per Day |\n|--------------|-------------------|--------------------------|\n| Trucks       | 100 units         | $50                      |\n| Vans         | 50 units          | $30                      |\n| Bikes        | 10 units          | $10                      |\n\nThe company has a budget of $1500 per day for operational costs. The company also has a storage capacity constraint that limits the total delivery capacity to 2000 units per day. Please help the company to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE_T = 100 * T / 50\nE_V = 50 * V / 30\nE_B = 10 * B / 10\n## the objective function is: Maximize (E_T + E_V + E_B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * T + 30 * V + 10 * B) == 100 * T + 50 * V + 10 * B)\n\n# Add constraints\n## The company has a budget of $1500 per day for operational costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1500)\n## The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is limited to 10,000 units across all products.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 1,500 units of product B.\n// A >= 1000; B >= 1500\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe total energy cost for all products must not exceed $600,000.\n// (50 - 0.0002 * EnergyEfficiencyA) * A + (60 - 0.0002 * EnergyEfficiencyB) * B + (70 - 0.0002 * EnergyEfficiencyC) * C + (80 - 0.0002 * EnergyEfficiencyD) * D <= 600000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient upgrades for their production lines. The selling price per unit and the initial energy cost per unit for each product are given in the following Table.\n\n| Product | Selling Price per Unit | Initial Energy Cost per Unit |\n|---------|------------------------|------------------------------|\n| A       | $100                   | $50                          |\n| B       | $120                   | $60                          |\n| C       | $140                   | $70                          |\n| D       | $160                   | $80                          |\n\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The company has a total budget of $50,000 for energy efficiency upgrades. The total production capacity for the next quarter is limited to 10,000 units across all products. The company must produce at least 1,000 units of product A and 1,500 units of product B. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. The total energy cost for all products must not exceed $600,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0) # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $50,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 50000)\n# The total production capacity for the next quarter is limited to 10,000 units across all products.\nmodel.addCons(A + B + C + D <= 10000)\n# The company must produce at least 1,000 units of product A and 1,500 units of product B.\nmodel.addCons(A >= 1000)\nmodel.addCons(B >= 1500)\n# The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n# The total energy cost for all products must not exceed $600,000.\nmodel.addCons((50 - 0.0002 * EnergyEfficiencyA) * A + (60 - 0.0002 * EnergyEfficiencyB) * B + (70 - 0.0002 * EnergyEfficiencyC) * C + (80 - 0.0002 * EnergyEfficiencyD) * D <= 600000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1434,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency profile. \nOn route 1, each truck incurs a cost of $1000 per day and delivers 500 units of goods. \nOn route 2, each truck incurs a cost of $1200 per day and delivers 600 units of goods. \nOn route 3, each truck incurs a cost of $1100 per day and delivers 550 units of goods. \nOn route 4, each truck incurs a cost of $900 per day and delivers 450 units of goods. \nOn route 5, each truck incurs a cost of $1300 per day and delivers 650 units of goods. \nThe company aims to maximize the total delivery of goods while minimizing the total cost. The objective is to find the optimal allocation of trucks that maximizes the total delivery units minus the total cost.\n// TotalCost = 1000 * T1 + 1200 * T2 + 1100 * T3 + 900 * T4 + 1300 * T5\n// TotalDelivery = 500 * T1 + 600 * T2 + 550 * T3 + 450 * T4 + 650 * T5\n// So, the objective function is: Maximize TotalDelivery - TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and efficiency profile. On route 1, each truck incurs a cost of $1000 per day and delivers 500 units of goods. On route 2, each truck incurs a cost of $1200 per day and delivers 600 units of goods. On route 3, each truck incurs a cost of $1100 per day and delivers 550 units of goods. On route 4, each truck incurs a cost of $900 per day and delivers 450 units of goods. On route 5, each truck incurs a cost of $1300 per day and delivers 650 units of goods. The company aims to maximize the total delivery of goods while minimizing the total cost. The company has a total of 100 trucks available for allocation. Please help the company find the optimal allocation of trucks that maximizes the total delivery units minus the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nTotalCost = 1000 * T1 + 1200 * T2 + 1100 * T3 + 900 * T4 + 1300 * T5\nTotalDelivery = 500 * T1 + 600 * T2 + 550 * T3 + 450 * T4 + 650 * T5\n# So, the objective function is: Maximize TotalDelivery - TotalCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalDelivery - TotalCost)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Maximized Total Delivery - Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate to each city route and the fuel efficiency of each truck type.\n// {\"number of trucks for City A\": \"TrucksACity\", \"range\": \"TrucksACity >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for City B\": \"TrucksBCity\", \"range\": \"TrucksBCity >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for City C\": \"TrucksCCity\", \"range\": \"TrucksCCity >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for City A\": \"FuelEfficiencyACity\", \"range\": \"FuelEfficiencyACity > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for City B\": \"FuelEfficiencyBCity\", \"range\": \"FuelEfficiencyBCity > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for City C\": \"FuelEfficiencyCCity\", \"range\": \"FuelEfficiencyCCity > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The fuel cost per liter is $3, and the distance traveled by each truck between cities is 500 km.\n// FuelCostACity = 500 * TrucksACity / FuelEfficiencyACity * 3\n// FuelCostBCity = 500 * TrucksBCity / FuelEfficiencyBCity * 3\n// FuelCostCCity = 500 * TrucksCCity / FuelEfficiencyCCity * 3\n// So, the objective function is: Minimize (FuelCostACity + FuelCostBCity + FuelCostCCity)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing trucks.\n// TrucksACity * 20000 + TrucksBCity * 25000 + TrucksCCity * 30000 <= 10000\n\n## Generate Constraint-2:\nThe company can only allocate a maximum of 20 trucks in total.\n// TrucksACity + TrucksBCity + TrucksCCity <= 20\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks must be at least 5 km/liter for City A, 6 km/liter for City B, and 7 km/liter for City C.\n// FuelEfficiencyACity >= 5\n// FuelEfficiencyBCity >= 6\n// FuelEfficiencyCCity >= 7",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate to each city route and the fuel efficiency of each truck type. The fuel cost per liter is $3, and the distance traveled by each truck between cities is 500 km. The company aims to minimize the total fuel cost per day.\n\n| City | Number of Trucks | Fuel Efficiency |\n|------|------------------|-----------------|\n| A    | TrucksACity     | FuelEfficiencyACity |\n| B    | TrucksBCity     | FuelEfficiencyBCity |\n| C    | TrucksCCity     | FuelEfficiencyCCity |\n\nThe company has a total budget of $10,000 for purchasing trucks. The company can only allocate a maximum of 20 trucks in total. The fuel efficiency of trucks must be at least 5 km/liter for City A, 6 km/liter for City B, and 7 km/liter for City C.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksACity = model.addVar(vtype=\"INTEGER\", name=\"TrucksACity\", lb=0)  # number of trucks for City A\nTrucksBCity = model.addVar(vtype=\"INTEGER\", name=\"TrucksBCity\", lb=0)  # number of trucks for City B\nTrucksCCity = model.addVar(vtype=\"INTEGER\", name=\"TrucksCCity\", lb=0)  # number of trucks for City C\nFuelEfficiencyACity = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyACity\", lb=5)  # fuel efficiency of trucks for City A\nFuelEfficiencyBCity = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyBCity\", lb=6)  # fuel efficiency of trucks for City B\nFuelEfficiencyCCity = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyCCity\", lb=7)  # fuel efficiency of trucks for City C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostACity = 500 * TrucksACity / FuelEfficiencyACity * 3\nFuelCostBCity = 500 * TrucksBCity / FuelEfficiencyBCity * 3\nFuelCostCCity = 500 * TrucksCCity / FuelEfficiencyCCity * 3\n## convert the division to multiplication\nmodel.addCons(obj * FuelEfficiencyACity * FuelEfficiencyBCity * FuelEfficiencyCCity == FuelCostACity * FuelEfficiencyBCity * FuelEfficiencyCCity + FuelCostBCity * FuelEfficiencyACity * FuelEfficiencyCCity + FuelCostCCity * FuelEfficiencyACity * FuelEfficiencyBCity)\n\n# Add constraints\n## The company has a total budget of $10,000 for purchasing trucks.\nmodel.addCons(TrucksACity * 20000 + TrucksBCity * 25000 + TrucksCCity * 30000 <= 10000)\n## The company can only allocate a maximum of 20 trucks in total.\nmodel.addCons(TrucksACity + TrucksBCity + TrucksCCity <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksACity))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksBCity))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksCCity))\n    print(\"Fuel Efficiency for City A: \", model.getVal(FuelEfficiencyACity))\n    print(\"Fuel Efficiency for City B: \", model.getVal(FuelEfficiencyBCity))\n    print(\"Fuel Efficiency for City C: \", model.getVal(FuelEfficiencyCCity))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small, Medium, and Large trucks. The company needs to decide how many of each type of truck to purchase and also the amount to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Small trucks\": \"FuelEfficiencySmall\", \"range\": \"FuelEfficiencySmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"FuelEfficiencyMedium\", \"range\": \"FuelEfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Large trucks\": \"FuelEfficiencyLarge\", \"range\": \"FuelEfficiencyLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from transportation services. The profit per truck type is affected by the number of trucks and the fuel efficiency, which is improved by the investment. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The fuel efficiency improvement is such that for every $1,000 invested, the fuel cost per mile decreases by $0.01 for Small trucks, $0.02 for Medium trucks, and $0.03 for Large trucks.\n// Profit from Small trucks: ProfitSmall = (0.50 - 0.00001 * FuelEfficiencySmall) * Miles * SmallTrucks\n// Profit from Medium trucks: ProfitMedium = (0.70 - 0.00002 * FuelEfficiencyMedium) * Miles * MediumTrucks\n// Profit from Large trucks: ProfitLarge = (1.00 - 0.00003 * FuelEfficiencyLarge) * Miles * LargeTrucks\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks and investing in fuel efficiency upgrades.\n// Cost of Small trucks * SmallTrucks + Cost of Medium trucks * MediumTrucks + Cost of Large trucks * LargeTrucks + FuelEfficiencySmall + FuelEfficiencyMedium + FuelEfficiencyLarge <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 200\n\n## Generate Constraint-3:\nAt least 50 Medium trucks must be purchased.\n// MediumTrucks >= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small, Medium, and Large trucks. The company needs to decide how many of each type of truck to purchase and also the amount to invest in upgrading the fuel efficiency of each type of truck. The company aims to maximize its annual profit from transportation services. The profit per truck type is affected by the number of trucks and the fuel efficiency, which is improved by the investment. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The fuel efficiency improvement is such that for every $1,000 invested, the fuel cost per mile decreases by $0.01 for Small trucks, $0.02 for Medium trucks, and $0.03 for Large trucks. The company has a budget of $500,000 for purchasing new trucks and investing in fuel efficiency upgrades. The total number of trucks in the fleet must not exceed 200. At least 50 Medium trucks must be purchased. Please help the company to maximize its annual profit from transportation services.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nFuelEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencySmall\", lb=0)  # investment in fuel efficiency for Small trucks\nFuelEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyMedium\", lb=0)  # investment in fuel efficiency for Medium trucks\nFuelEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyLarge\", lb=0)  # investment in fuel efficiency for Large trucks\n\n# Define objective function\nMiles = model.addVar(vtype=\"CONTINUOUS\", name=\"Miles\", lb=0)  # total miles driven\nProfitSmall = (0.50 - 0.00001 * FuelEfficiencySmall) * Miles * SmallTrucks\nProfitMedium = (0.70 - 0.00002 * FuelEfficiencyMedium) * Miles * MediumTrucks\nProfitLarge = (1.00 - 0.00003 * FuelEfficiencyLarge) * Miles * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge)\n\n# Add constraints\n# The company has a budget of $500,000 for purchasing new trucks and investing in fuel efficiency upgrades.\nmodel.addCons(10000 * SmallTrucks + 15000 * MediumTrucks + 20000 * LargeTrucks + FuelEfficiencySmall + FuelEfficiencyMedium + FuelEfficiencyLarge <= 500000)\n# The total number of trucks in the fleet must not exceed 200.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 200)\n# At least 50 Medium trucks must be purchased.\nmodel.addCons(MediumTrucks >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel Efficiency for Small Trucks: \", model.getVal(FuelEfficiencySmall))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(FuelEfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Large Trucks: \", model.getVal(FuelEfficiencyLarge))\n    print(\"Maximized Annual Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000.\nFor wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000.\nThe company wants to minimize the Cost-Energy ratio of the installation. (The Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production.)\n// total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\n// total energy production: Energy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000\n\n## Generate Constraint-2:\nThe company wants to produce at least 150,000 kWh of energy.\n// 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five locations: Location1, Location2, Location3, Location4, and Location5. The company wants to minimize the Cost-Energy ratio of the installation, where the Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production. For solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000. For wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000. The company has a budget of $100,000 for the installations and aims to produce at least 150,000 kWh of energy.\nPlease help the company determine the optimal number of solar panels and wind turbines to install at each location to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of solar panels at Location4\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\nEnergy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations.\nmodel.addCons(1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000)\n## The company wants to produce at least 150,000 kWh of energy.\nmodel.addCons(200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Solar Panels at Location4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind))\n    print(\"Minimized Cost-Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepsA\", \"range\": \"SalesRepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepsB\", \"range\": \"SalesRepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepsC\", \"range\": \"SalesRepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\n// Total revenue for ProductB: RevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\n// Total revenue for ProductC: RevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 sales representatives available.\n// SalesRepsA + SalesRepsB + SalesRepsC <= 50\n\n## Generate Constraint-3:\nThe production capacity for each product is limited. ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n// QuantityA >= 100; QuantityB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives, and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n\nThe total marketing budget for all products cannot exceed $100,000. The company has a total of 50 sales representatives available. The production capacity for each product is limited: ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units. The company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n\nPlease help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=100) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=200) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nSalesRepsA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsA\", lb=0) # number of sales representatives for ProductA\nSalesRepsB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsB\", lb=0) # number of sales representatives for ProductB\nSalesRepsC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsC\", lb=0) # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\nRevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\nRevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\nmodel.addCons(SalesRepsA + SalesRepsB + SalesRepsC <= 50)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1500)\nmodel.addCons(QuantityC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Sales Reps for ProductA: \", model.getVal(SalesRepsA))\n    print(\"Number of Sales Reps for ProductB: \", model.getVal(SalesRepsB))\n    print(\"Number of Sales Reps for ProductC: \", model.getVal(SalesRepsC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000\n\n## Generate Constraint-2:\nDue to space limitations, the total number of trucks cannot exceed 60.\n// SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost and revenue per truck for each type are given in the following Table.\n\n| Truck Type         | Operational Cost | Revenue |\n|--------------------|------------------|---------|\n| Small              | $50,000          | $70,000 |\n| Medium             | $75,000          | $100,000|\n| Large              | $100,000         | $130,000|\n| Refrigerated       | $120,000         | $150,000|\n| Heavy-Duty         | $150,000         | $180,000|\n\nThe company has a budget of $5,000,000 for purchasing new trucks. Due to space limitations, the total number of trucks cannot exceed 60. The company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n\nPlease help the company determine the optimal number of each type of truck to purchase to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + ...\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\n## Due to space limitations, the total number of trucks cannot exceed 60.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. Additionally, the company can invest in route optimization software for each city, which affects the fuel efficiency and travel time.\n// {\"number of trips from City1 to City2\": \"Trips12\", \"range\": \"Trips12 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City3\": \"Trips13\", \"range\": \"Trips13 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City4\": \"Trips14\", \"range\": \"Trips14 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City5\": \"Trips15\", \"range\": \"Trips15 >= 0\", \"type\": \"integer\"}\n// {\"investment in route optimization software for City1\": \"Software1\", \"range\": \"Software1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City2\": \"Software2\", \"range\": \"Software2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City3\": \"Software3\", \"range\": \"Software3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City4\": \"Software4\", \"range\": \"Software4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City5\": \"Software5\", \"range\": \"Software5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is affected by the investment in route optimization software. For each $1,000 invested in software, the fuel consumption per trip decreases by 0.1 liters. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for trips from City1 to City2: Fuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\n// Fuel consumption for trips from City1 to City3: Fuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\n// Fuel consumption for trips from City1 to City4: Fuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\n// Fuel consumption for trips from City1 to City5: Fuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n// So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investing in route optimization software.\n// Software1 + Software2 + Software3 + Software4 + Software5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips that can be made in a month is limited to 500.\n// Trips12 + Trips13 + Trips14 + Trips15 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3.\n// Trips12 >= 100; Trips13 >= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities and the investment in route optimization software for each city to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. For each $1,000 invested in software, the fuel consumption per trip decreases by 0.1 liters.\n\n| Route | Initial Fuel Consumption |\n|-------|--------------------------|\n| City1 to City2 | 50 liters per trip |\n| City1 to City3 | 60 liters per trip |\n| City1 to City4 | 70 liters per trip |\n| City1 to City5 | 80 liters per trip |\n\nThe company has a total budget of $100,000 for investing in route optimization software. The total number of trips that can be made in a month is limited to 500. Due to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3.\n\nPlease help the company to minimize the total fuel consumption across all trips by determining the optimal number of trips and the investment in route optimization software for each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips12 = model.addVar(vtype=\"INTEGER\", name=\"Trips12\", lb=100) # number of trips from City1 to City2\nTrips13 = model.addVar(vtype=\"INTEGER\", name=\"Trips13\", lb=50) # number of trips from City1 to City3\nTrips14 = model.addVar(vtype=\"INTEGER\", name=\"Trips14\", lb=0) # number of trips from City1 to City4\nTrips15 = model.addVar(vtype=\"INTEGER\", name=\"Trips15\", lb=0) # number of trips from City1 to City5\nSoftware1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software1\", lb=0) # investment in route optimization software for City1\nSoftware2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software2\", lb=0) # investment in route optimization software for City2\nSoftware3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software3\", lb=0) # investment in route optimization software for City3\nSoftware4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software4\", lb=0) # investment in route optimization software for City4\nSoftware5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software5\", lb=0) # investment in route optimization software for City5\n\n# Define objective function\nFuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\nFuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\nFuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\nFuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n# So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n# Add constraints\nmodel.addCons(Software1 + Software2 + Software3 + Software4 + Software5 <= 100000)\nmodel.addCons(Trips12 + Trips13 + Trips14 + Trips15 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips from City1 to City2: \", model.getVal(Trips12))\n    print(\"Number of trips from City1 to City3: \", model.getVal(Trips13))\n    print(\"Number of trips from City1 to City4: \", model.getVal(Trips14))\n    print(\"Number of trips from City1 to City5: \", model.getVal(Trips15))\n    print(\"Investment in software for City1: \", model.getVal(Software1))\n    print(\"Investment in software for City2: \", model.getVal(Software2))\n    print(\"Investment in software for City3: \", model.getVal(Software3))\n    print(\"Investment in software for City4: \", model.getVal(Software4))\n    print(\"Investment in software for City5: \", model.getVal(Software5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1426,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel cost per truck per km\": \"FuelCostTruck\", \"range\": \"FuelCostTruck >= 0\", \"type\": \"real\"}\n// {\"fuel cost per van per km\": \"FuelCostVan\", \"range\": \"FuelCostVan >= 0\", \"type\": \"real\"}\n// {\"fuel cost per bike per km\": \"FuelCostBike\", \"range\": \"FuelCostBike >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day, given that each vehicle type covers a different distance per day. Trucks cover 200 km, vans cover 150 km, and bikes cover 50 km. The fuel cost per km for trucks is $0.5, for vans is $0.3, and for bikes is $0.1.\n// TotalFuelCost = Trucks * 200 * FuelCostTruck + Vans * 150 * FuelCostVan + Bikes * 50 * FuelCostBike\n// So, the objective function is: Minimize TotalFuelCost\n// Minimize (Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for vehicle maintenance and fuel.\n// Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1 <= 1000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels. Trucks cover 200 km per day, vans cover 150 km per day, and bikes cover 50 km per day. The fuel cost per km for trucks is $0.5, for vans is $0.3, and for bikes is $0.1. The company has a budget of $1000 per day for vehicle maintenance and fuel.\n\nPlease help the company to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize TotalFuelCost\nTotalFuelCost = Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n## The company has a budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 591,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of cars\": \"Cars\", \"range\": \"Cars >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\n// Profit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\n// FuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n// So, the objective function is: Maximize (Profit - FuelCost)\n// Maximize (0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars) - (50 * Trucks + 30 * Vans + 10 * Cars) * 5)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet or exceed the required 100,000 kg.\n// 5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// (50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000\n\n## Generate Constraint-3:\nThe company can only acquire a maximum of 20 vehicles in total.\n// Trucks + Vans + Cars <= 20",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\nThe total cargo capacity must meet or exceed the required 100,000 kg. The company has a budget of $10,000 for fuel costs. The company can only acquire a maximum of 20 vehicles in total.\nPlease help the company to maximize the total profit while minimizing the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nCars = model.addVar(vtype=\"INTEGER\", name=\"Cars\", lb=0)  # number of cars\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\nFuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n## the objective function is: Maximize (Profit - FuelCost)\nmodel.addCons(obj == Profit - FuelCost)\n\n# Add constraints\n## The total cargo capacity must meet or exceed the required 100,000 kg.\nmodel.addCons(5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000)\n## The company has a budget of $10,000 for fuel costs.\nmodel.addCons((50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000)\n## The company can only acquire a maximum of 20 vehicles in total.\nmodel.addCons(Trucks + Vans + Cars <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Cars: \", model.getVal(Cars))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in routing software for Trucks\": \"SoftwareT\", \"range\": \"SoftwareT >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Vans\": \"SoftwareV\", \"range\": \"SoftwareV >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Bikes\": \"SoftwareB\", \"range\": \"SoftwareB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost for Trucks: CostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\n// Total operational cost for Vans: CostV = 500 * Vans - 0.3 * SoftwareV * Vans\n// Total operational cost for Bikes: CostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and software investments.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times. The operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\n\n| Vehicle Type | Operational Cost Without Software | Decrease in Cost per $100 of Software Investment |\n|--------------|-----------------------------------|-------------------------------------------------|\n| Trucks       | $1000                             | $50                                             |\n| Vans         | $500                              | $30                                             |\n| Bikes        | $100                              | $10                                             |\n\nThe company has a budget of $1,000,000 for vehicle purchases and software investments. Please help the company to determine the optimal number of each vehicle type to purchase and the investment in routing software to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nSoftwareT = model.addVar(name=\"SoftwareT\", lb=0)  # investment in routing software for Trucks\nSoftwareV = model.addVar(name=\"SoftwareV\", lb=0)  # investment in routing software for Vans\nSoftwareB = model.addVar(name=\"SoftwareB\", lb=0)  # investment in routing software for Bikes\n\n# Define objective function\nCostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\nCostV = 500 * Vans - 0.3 * SoftwareV * Vans\nCostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Routing Software for Trucks: \", model.getVal(SoftwareT))\n    print(\"Investment in Routing Software for Vans: \", model.getVal(SoftwareV))\n    print(\"Investment in Routing Software for Bikes: \", model.getVal(SoftwareB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1711,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trucks for destination A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for destination A\": \"FuelBudgetA\", \"range\": \"FuelBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination B\": \"FuelBudgetB\", \"range\": \"FuelBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination C\": \"FuelBudgetC\", \"range\": \"FuelBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination D\": \"FuelBudgetD\", \"range\": \"FuelBudgetD >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination E\": \"FuelBudgetE\", \"range\": \"FuelBudgetE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks. The cost increases at a decreasing rate as the fuel budget increases, reflecting economies of scale in fuel purchasing. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for destination A: CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2)\n// Fuel cost for destination B: CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2)\n// Fuel cost for destination C: CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2)\n// Fuel cost for destination D: CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2)\n// Fuel cost for destination E: CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total fuel budget across all destinations must not exceed $100,000.\n// FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000\n\n## Generate Constraint-2:\nThe company must ensure that at least 50 trucks are dispatched to each destination.\n// TrucksA >= 50; TrucksB >= 50; TrucksC >= 50; TrucksD >= 50; TrucksE >= 50\n\n## Generate Constraint-3:\nThe total number of trucks dispatched across all destinations must not exceed 300.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300\n\n## Generate Constraint-4:\nThe fuel budget for destination A must be at least twice the fuel budget for destination B.\n// FuelBudgetA >= 2 * FuelBudgetB",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks, where the cost increases at a decreasing rate as the fuel budget increases. The company aims to minimize the total fuel cost across all routes.\n\n| Destination | Fuel Cost Function |\n|-------------|--------------------|\n| A           | CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2) |\n| B           | CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2) |\n| C           | CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2) |\n| D           | CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2) |\n| E           | CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2) |\n\nThe total fuel budget across all destinations must not exceed $100,000. The company must ensure that at least 50 trucks are dispatched to each destination. The total number of trucks dispatched across all destinations must not exceed 300. Additionally, the fuel budget for destination A must be at least twice the fuel budget for destination B.\n\nPlease help the company to minimize the total fuel cost across all routes while satisfying these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=50)  # number of trucks for destination A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=50)  # number of trucks for destination B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=50)  # number of trucks for destination C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=50)  # number of trucks for destination D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=50)  # number of trucks for destination E\nFuelBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetA\", lb=0)  # fuel budget for destination A\nFuelBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetB\", lb=0)  # fuel budget for destination B\nFuelBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetC\", lb=0)  # fuel budget for destination C\nFuelBudgetD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD\", lb=0)  # fuel budget for destination D\nFuelBudgetE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetE\", lb=0)  # fuel budget for destination E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)**2)\nCostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)**2)\nCostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)**2)\nCostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)**2)\nCostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)**2)\n## the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The total fuel budget across all destinations must not exceed $100,000.\nmodel.addCons(FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000)\n## The total number of trucks dispatched across all destinations must not exceed 300.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300)\n## The fuel budget for destination A must be at least twice the fuel budget for destination B.\nmodel.addCons(FuelBudgetA >= 2 * FuelBudgetB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Destination A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Destination B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Destination C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Destination D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Destination E: \", model.getVal(TrucksE))\n    print(\"Fuel Budget for Destination A: \", model.getVal(FuelBudgetA))\n    print(\"Fuel Budget for Destination B: \", model.getVal(FuelBudgetB))\n    print(\"Fuel Budget for Destination C: \", model.getVal(FuelBudgetC))\n    print(\"Fuel Budget for Destination D: \", model.getVal(FuelBudgetD))\n    print(\"Fuel Budget for Destination E: \", model.getVal(FuelBudgetE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1479,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product A\": \"InventoryA\", \"range\": \"InventoryA >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product B\": \"InventoryB\", \"range\": \"InventoryB >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product C\": \"InventoryC\", \"range\": \"InventoryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\n// Profit_ProductA = (ProductA - InventoryA) * (50 - 30)\n// Profit_ProductB = (ProductB - InventoryB) * (70 - 40)\n// Profit_ProductC = (ProductC - InventoryC) * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 50 units for each product.\n// InventoryA <= 50\n// InventoryB <= 50\n// InventoryC <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity. The revenue per unit and cost for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost per Unit |\n|---------|------------------|---------------|\n| A       | $50              | $30           |\n| B       | $70              | $40           |\n| C       | $60              | $35           |\n\nThe company has a total production capacity of 100 units per day. The company also has a storage capacity limit of 50 units for each product. The company wants to maximize the total profit, considering both the production and the inventory levels. Please help the company determine the optimal production and inventory levels for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nInventoryA = model.addVar(vtype=\"INTEGER\", name=\"InventoryA\", lb=0)  # inventory level of product A\nInventoryB = model.addVar(vtype=\"INTEGER\", name=\"InventoryB\", lb=0)  # inventory level of product B\nInventoryC = model.addVar(vtype=\"INTEGER\", name=\"InventoryC\", lb=0)  # inventory level of product C\n\n# Define objective function\nProfit_ProductA = (ProductA - InventoryA) * (50 - 30)\nProfit_ProductB = (ProductB - InventoryB) * (70 - 40)\nProfit_ProductC = (ProductC - InventoryC) * (60 - 35)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 100)  # total production capacity constraint\nmodel.addCons(InventoryA <= 50)  # storage capacity limit for product A\nmodel.addCons(InventoryB <= 50)  # storage capacity limit for product B\nmodel.addCons(InventoryC <= 50)  # storage capacity limit for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Inventory Level of Product A: \", model.getVal(InventoryA))\n    print(\"Inventory Level of Product B: \", model.getVal(InventoryB))\n    print(\"Inventory Level of Product C: \", model.getVal(InventoryC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials.\n// {\"labor hours on line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours on line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours.\n// Profit from device 1 on line 1: P1_L1 = 100 * (5 * L1 + 10 * M1)\n// Profit from device 1 on line 2: P1_L2 = 100 * (7 * L2 + 12 * M2)\n// Profit from device 2 on line 1: P2_L1 = 150 * (8 * L1 + 15 * M1)\n// Profit from device 2 on line 2: P2_L2 = 150 * (10 * L2 + 18 * M2)\n// Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L1 + L2 <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 1500 hours.\n// M1 + M2 <= 1500",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials. The plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours. The total labor hours available are 1000 hours. The total machine hours available are 1500 hours. Please help the plant to maximize its total profit from both devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours on line 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # machine hours on line 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials on line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours on line 2\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # machine hours on line 2\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials on line 2\n\n# Define objective function\nP1_L1 = 100 * (5 * L1 + 10 * M1) # Profit from device 1 on line 1\nP1_L2 = 100 * (7 * L2 + 12 * M2) # Profit from device 1 on line 2\nP2_L1 = 150 * (8 * L1 + 15 * M1) # Profit from device 2 on line 1\nP2_L2 = 150 * (10 * L2 + 18 * M2) # Profit from device 2 on line 2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\nmodel.addCons(obj == P1_L1 + P1_L2 + P2_L1 + P2_L2)\n\n# Add constraints\n# The total labor hours available are 1000 hours.\nmodel.addCons(L1 + L2 <= 1000)\n# The total machine hours available are 1500 hours.\nmodel.addCons(M1 + M2 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours on line 1: \", model.getVal(L1))\n    print(\"Machine hours on line 1: \", model.getVal(M1))\n    print(\"Raw materials on line 1: \", model.getVal(R1))\n    print(\"Labor hours on line 2: \", model.getVal(L2))\n    print(\"Machine hours on line 2: \", model.getVal(M2))\n    print(\"Raw materials on line 2: \", model.getVal(R2))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type, and the maintenance cost is a fixed percentage of the fuel cost.\n\n| Truck Type            | Fuel Efficiency (km/liter) |\n|-----------------------|----------------------------|\n| Short-distance trucks | ShortFuelEfficiency        |\n| Medium-distance trucks| MediumFuelEfficiency       |\n| Long-distance trucks  | LongFuelEfficiency         |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total number of trucks cannot exceed 100. Please help the company determine the optimal number of short-distance, medium-distance, and long-distance trucks to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nShortDistance = model.addVar(name=\"ShortDistance\")\nMediumDistance = model.addVar(name=\"MediumDistance\")\nLongDistance = model.addVar(name=\"LongDistance\")\nShortFuelEfficiency = model.addVar(name=\"ShortFuelEfficiency\")\nMediumFuelEfficiency = model.addVar(name=\"MediumFuelEfficiency\")\nLongFuelEfficiency = model.addVar(name=\"LongFuelEfficiency\")\nShortTruckCost = model.addVar(name=\"ShortTruckCost\")\nMediumTruckCost = model.addVar(name=\"MediumTruckCost\")\nLongTruckCost = model.addVar(name=\"LongTruckCost\")\n\n## TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n## TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n## So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n## convert the division to multiplication\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks * ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks * MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks * LongFuelEfficiency)\nTotalMaintenanceCost = 0.1 * TotalFuelCost\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\n// Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\n// Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\n// Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\n// So, the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 units in total.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\n// 5 * C1 + 7 * C2 + 9 * C3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for C1 is at least 50 units and at most 200 units.\n// 50 <= C1 <= 200\n\n## Generate Constraint-4:\nThe market demand for C2 is at least 100 units and at most 300 units.\n// 100 <= C2 <= 300",
        "question": "A manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints. The profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company has a limited production capacity of 500 units in total. The company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3, with a total budget of $3000. The market demand for C1 is at least 50 units and at most 200 units. The market demand for C2 is at least 100 units and at most 300 units. Please help the company to maximize the total profit from selling these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\nC1_1 = model.addVar(vtype=\"INTEGER\", name=\"C1_1\", lb=50, ub=100)\nC1_2 = model.addVar(vtype=\"INTEGER\", name=\"C1_2\", lb=100, ub=200)\nC1_b1 = model.addVar(vtype=\"B\", name=\"C1_b1\")\nC1_b2 = model.addVar(vtype=\"B\", name=\"C1_b2\")\nmodel.addCons(C1_b1 + C1_b2 == 1)\nmodel.addCons(C1 == C1_1*C1_b1 + C1_2*C1_b2)\nProfit_C1 = (10 - 0.02 * (C1_2 - 100)) * C1_2 * C1_b2 + 10 * C1_1 * C1_b1\n## create piecewise variables for piecewise function: Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\nC2_1 = model.addVar(vtype=\"INTEGER\", name=\"C2_1\", lb=100, ub=200)\nC2_2 = model.addVar(vtype=\"INTEGER\", name=\"C2_2\", lb=200, ub=300)\nC2_b1 = model.addVar(vtype=\"B\", name=\"C2_b1\")\nC2_b2 = model.addVar(vtype=\"B\", name=\"C2_b2\")\nmodel.addCons(C2_b1 + C2_b2 == 1)\nmodel.addCons(C2 == C2_1*C2_b1 + C2_2*C2_b2)\nProfit_C2 = (15 - 0.03 * (C2_2 - 200)) * C2_2 * C2_b2 + 15 * C2_1 * C2_b1\n## create piecewise variables for piecewise function: Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\nC3_1 = model.addVar(vtype=\"INTEGER\", name=\"C3_1\", lb=0, ub=300)\nC3_b1 = model.addVar(vtype=\"B\", name=\"C3_b1\")\nmodel.addCons(C3_b1 == 1)\nmodel.addCons(C3 == C3_1)\nProfit_C3 = 20 * C3_1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 <= 500)\nmodel.addCons(5 * C1 + 7 * C2 + 9 * C3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. Each product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate). The company has a budget of $1500 for raw materials and a production capacity of 200 hours. Please help the company determine the optimal production quantities for each product to maximize its profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for the next quarter. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) and need to decide how many trucks to allocate to each route. Additionally, they need to determine the number of drivers to hire for each route.\n// {\"number of trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteA\": \"DriverA\", \"range\": \"DriverA >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteB\": \"DriverB\", \"range\": \"DriverB >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteC\": \"DriverC\", \"range\": \"DriverC >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteD\": \"DriverD\", \"range\": \"DriverD >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteE\": \"DriverE\", \"range\": \"DriverE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the estimated profit per truck is $5,000, the operational cost per driver is $3,000, and the maintenance cost per truck is $1,000.\nFor RouteB, the estimated profit per truck is $6,000, the operational cost per driver is $3,500, and the maintenance cost per truck is $1,200.\nFor RouteC, the estimated profit per truck is $7,000, the operational cost per driver is $4,000, and the maintenance cost per truck is $1,500.\nFor RouteD, the estimated profit per truck is $8,000, the operational cost per driver is $4,500, and the maintenance cost per truck is $1,800.\nFor RouteE, the estimated profit per truck is $9,000, the operational cost per driver is $5,000, and the maintenance cost per truck is $2,000.\nThe company wants to maximize the net profit per truck.\n// Total net profit for RouteA: Profit_RouteA = 5000 * TruckA - 3000 * DriverA - 1000 * TruckA\n// Total net profit for RouteB: Profit_RouteB = 6000 * TruckB - 3500 * DriverB - 1200 * TruckB\n// Total net profit for RouteC: Profit_RouteC = 7000 * TruckC - 4000 * DriverC - 1500 * TruckC\n// Total net profit for RouteD: Profit_RouteD = 8000 * TruckD - 4500 * DriverD - 1800 * TruckD\n// Total net profit for RouteE: Profit_RouteE = 9000 * TruckE - 5000 * DriverE - 2000 * TruckE\n// So, the objective function is: Maximize ((Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE) / (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for the quarter.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $300,000 for driver salaries for the quarter.\n// 3000 * DriverA + 3500 * DriverB + 4000 * DriverC + 4500 * DriverD + 5000 * DriverE <= 300000\n\n## Generate Constraint-3:\nEach route must have at least one truck and one driver.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1\n// DriverA >= 1; DriverB >= 1; DriverC >= 1; DriverD >= 1; DriverE >= 1\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total trucks are allocated to any single route.\n// TruckA <= 0.4 * 100\n// TruckB <= 0.4 * 100\n// TruckC <= 0.4 * 100\n// TruckD <= 0.4 * 100\n// TruckE <= 0.4 * 100",
        "question": "A logistics company is planning its fleet deployment for the next quarter. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) and need to decide how many trucks to allocate to each route and how many drivers to hire for each route. The estimated profit per truck, operational cost per driver, and maintenance cost per truck for each route are given in the following Table.\n\n| Route | Estimated Profit per Truck | Operational Cost per Driver | Maintenance Cost per Truck |\n|-------|----------------------------|-----------------------------|----------------------------|\n| A     | $5,000                     | $3,000                      | $1,000                     |\n| B     | $6,000                     | $3,500                      | $1,200                     |\n| C     | $7,000                     | $4,000                      | $1,500                     |\n| D     | $8,000                     | $4,500                      | $1,800                     |\n| E     | $9,000                     | $5,000                      | $2,000                     |\n\nThe company has a total of 100 trucks available for the quarter. The company has a budget of $300,000 for driver salaries for the quarter. Each route must have at least one truck and one driver. The company wants to ensure that no more than 40% of the total trucks are allocated to any single route. \n\nPlease help the company to maximize the net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of trucks for RouteE\nDriverA = model.addVar(vtype=\"INTEGER\", name=\"DriverA\", lb=1)  # number of drivers for RouteA\nDriverB = model.addVar(vtype=\"INTEGER\", name=\"DriverB\", lb=1)  # number of drivers for RouteB\nDriverC = model.addVar(vtype=\"INTEGER\", name=\"DriverC\", lb=1)  # number of drivers for RouteC\nDriverD = model.addVar(vtype=\"INTEGER\", name=\"DriverD\", lb=1)  # number of drivers for RouteD\nDriverE = model.addVar(vtype=\"INTEGER\", name=\"DriverE\", lb=1)  # number of drivers for RouteE\n\n# Define objective function\nProfit_RouteA = 5000 * TruckA - 3000 * DriverA - 1000 * TruckA\nProfit_RouteB = 6000 * TruckB - 3500 * DriverB - 1200 * TruckB\nProfit_RouteC = 7000 * TruckC - 4000 * DriverC - 1500 * TruckC\nProfit_RouteD = 8000 * TruckD - 4500 * DriverD - 1800 * TruckD\nProfit_RouteE = 9000 * TruckE - 5000 * DriverE - 2000 * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize ((Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE) / TotalTrucks)\n# convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)  # total trucks constraint\nmodel.addCons(3000 * DriverA + 3500 * DriverB + 4000 * DriverC + 4500 * DriverD + 5000 * DriverE <= 300000)  # driver salary budget constraint\nmodel.addCons(TruckA <= 0.4 * 100)  # route allocation constraint for RouteA\nmodel.addCons(TruckB <= 0.4 * 100)  # route allocation constraint for RouteB\nmodel.addCons(TruckC <= 0.4 * 100)  # route allocation constraint for RouteC\nmodel.addCons(TruckD <= 0.4 * 100)  # route allocation constraint for RouteD\nmodel.addCons(TruckE <= 0.4 * 100)  # route allocation constraint for RouteE\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of Drivers for RouteA: \", model.getVal(DriverA))\n    print(\"Number of Drivers for RouteB: \", model.getVal(DriverB))\n    print(\"Number of Drivers for RouteC: \", model.getVal(DriverC))\n    print(\"Number of Drivers for RouteD: \", model.getVal(DriverD))\n    print(\"Number of Drivers for RouteE: \", model.getVal(DriverE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1457,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter and a maintenance cost of $100 per month.\nTruck B has a fuel efficiency of 7 km/liter and a maintenance cost of $120 per month.\nTruck C has a fuel efficiency of 9 km/liter and a maintenance cost of $140 per month.\nTruck D has a fuel efficiency of 11 km/liter and a maintenance cost of $160 per month.\nTruck E has a fuel efficiency of 13 km/liter and a maintenance cost of $180 per month.\nThe company aims to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).\n// Total maintenance cost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\n// Total kilometers driven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Minimize (100 * A + 120 * B + 140 * C + 160 * D + 180 * E) / (5 * A + 7 * B + 9 * C + 11 * D + 13 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for maintenance costs for the upcoming month.\n// 100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-3:\nThe company must deploy at least 10 trucks of each type.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-4:\nThe number of Truck E must not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe total number of kilometers driven by Truck D must not exceed the total number of kilometers driven by Trucks A and B combined.\n// 11 * D <= (5 * A + 7 * B)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\nTruck A has a fuel efficiency of 5 km/liter and a maintenance cost of $100 per month.\nTruck B has a fuel efficiency of 7 km/liter and a maintenance cost of $120 per month.\nTruck C has a fuel efficiency of 9 km/liter and a maintenance cost of $140 per month.\nTruck D has a fuel efficiency of 11 km/liter and a maintenance cost of $160 per month.\nTruck E has a fuel efficiency of 13 km/liter and a maintenance cost of $180 per month.\nThe company has a budget of $5000 for maintenance costs for the upcoming month. The company has a limit of 100 trucks that can be deployed in total. The company must deploy at least 10 trucks of each type. The number of Truck E must not exceed the combined number of Trucks A, B, and C. The total number of kilometers driven by Truck D must not exceed the total number of kilometers driven by Trucks A and B combined.\nPlease help the company to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalMaintenanceCost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\nTotalKilometersDriven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Minimize (100 * A + 120 * B + 140 * C + 160 * D + 180 * E) / (5 * A + 7 * B + 9 * C + 11 * D + 13 * E)\n## convert the division to multiplication\nmodel.addCons(obj * TotalKilometersDriven == TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $5000 for maintenance costs for the upcoming month.\nmodel.addCons(100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company must deploy at least 10 trucks of each type.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\nmodel.addCons(D >= 10)\nmodel.addCons(E >= 10)\n## The number of Truck E must not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The total number of kilometers driven by Truck D must not exceed the total number of kilometers driven by Trucks A and B combined.\nmodel.addCons(11 * D <= 5 * A + 7 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each product for the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company has $1500 available for material costs for the next quarter. The company wants to produce at least 20 units of each product for the next quarter.\nPlease help the company to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and technology investments.\n// FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption. The fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $100,000 for fuel optimization and technology investments.\n\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nFuelOpt1 = model.addVar(name=\"FuelOpt1\", lb=0)  # fuel optimization for Route1\nFuelOpt2 = model.addVar(name=\"FuelOpt2\", lb=0)  # fuel optimization for Route2\nTechInvest1 = model.addVar(name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technology for Route1\nTechInvest2 = model.addVar(name=\"TechInvest2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\nConsumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n## the objective function is: Minimize (Consumption1 + Consumption2)\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\n## The company has a total budget of $100,000 for fuel optimization and technology investments.\nmodel.addCons(FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 50 vehicles.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\n// T <= 0.5 * (V + B)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. Each Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost. The company has a total budget of $10,000 for daily operational costs. The company has a maximum storage capacity of 50 vehicles. The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined. Please help the company to maximize its net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## Revenue and cost calculations\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n## Objective function: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n## The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n## The company has a maximum storage capacity of 50 vehicles.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\nmodel.addCons(T <= 0.5 * (V + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 500 units.\n// UnitsA <= 500\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nTo maintain market share, the company must produce at least 100 units of DeviceB.\n// UnitsB >= 100",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary. The details are as follows:\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand |\n|--------|--------------------------|-------------------------|--------|\n| DeviceA | $50                     | $100                    | 500 units |\n| DeviceB | $70                     | $120                    | 400 units |\n| DeviceC | $80                     | $150                    | 300 units |\n\nThe company wants to maximize its total profit, considering that the profit for each device includes a quadratic term due to increasing marginal costs:\n- Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2\n- Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2\n- Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2\n\nThe company has the following constraints:\n- Total production capacity per month is 1000 units.\n- Production of DeviceA should not exceed 500 units due to market saturation.\n- The company has a budget of $60,000 for production costs per month.\n- To maintain market share, the company must produce at least 100 units of DeviceB.\n\nPlease help the company determine the optimal number of units of each device to produce per month to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2\n## Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2\n## Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2\n## Convert quadratic terms to linear by introducing new variables\nUnitsA_sq = model.addVar(vtype=\"INTEGER\", name=\"UnitsA_sq\")\nUnitsB_sq = model.addVar(vtype=\"INTEGER\", name=\"UnitsB_sq\")\nUnitsC_sq = model.addVar(vtype=\"INTEGER\", name=\"UnitsC_sq\")\nmodel.addCons(UnitsA_sq == UnitsA * UnitsA)\nmodel.addCons(UnitsB_sq == UnitsB * UnitsB)\nmodel.addCons(UnitsC_sq == UnitsC * UnitsC)\nProfit_A = (100 - 50) * UnitsA - 0.01 * UnitsA_sq\nProfit_B = (120 - 70) * UnitsB - 0.02 * UnitsB_sq\nProfit_C = (150 - 80) * UnitsC - 0.03 * UnitsC_sq\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market saturation, the production of DeviceA should not exceed 500 units.\nmodel.addCons(UnitsA <= 500)\n## The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1436,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours.\n// Fuel_Consumption_Route_1 = 10 * T1\n// Fuel_Consumption_Route_2 = 12 * T2\n// Fuel_Consumption_Route_3 = 15 * T3\n// Fuel_Consumption_Route_4 = 18 * T4\n// Fuel_Consumption_Route_5 = 20 * T5\n// Delivery_Time_Route_1 = K1 / T1\n// Delivery_Time_Route_2 = K2 / T2\n// Delivery_Time_Route_3 = K3 / T3\n// Delivery_Time_Route_4 = K4 / T4\n// Delivery_Time_Route_5 = K5 / T5\n// Total_Delivery_Time = Delivery_Time_Route_1 + Delivery_Time_Route_2 + Delivery_Time_Route_3 + Delivery_Time_Route_4 + Delivery_Time_Route_5\n// Objective function: Minimize Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5, subject to Total_Delivery_Time <= 500\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1\n\n## Generate Constraint-3:\nThe total delivery time across all routes must not exceed 500 hours.\n// K1 / T1 + K2 / T2 + K3 / T3 + K4 / T4 + K5 / T5 <= 500",
        "question": "A logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours. The total number of trucks available is 100, and each route must have at least one truck. Please help the company to minimize the total fuel consumption while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\nFuel_Consumption_Route_1 = 10 * T1\nFuel_Consumption_Route_2 = 12 * T2\nFuel_Consumption_Route_3 = 15 * T3\nFuel_Consumption_Route_4 = 18 * T4\nFuel_Consumption_Route_5 = 20 * T5\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100) # Total number of trucks available is 100\n\n# Constraint for total delivery time\n# Assuming K1, K2, K3, K4, K5 are constants representing the delivery time coefficients\nK1 = model.addVar(vtype=\"CONTINUOUS\", name=\"K1\")\nK2 = model.addVar(vtype=\"CONTINUOUS\", name=\"K2\")\nK3 = model.addVar(vtype=\"CONTINUOUS\", name=\"K3\")\nK4 = model.addVar(vtype=\"CONTINUOUS\", name=\"K4\")\nK5 = model.addVar(vtype=\"CONTINUOUS\", name=\"K5\")\nmodel.addCons(K1 / T1 + K2 / T2 + K3 / T3 + K4 / T4 + K5 / T5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and the revenue generated per Truck is $150 per day. The operational cost per Van is $70 per day, and the revenue generated per Van is $120 per day. The operational cost per Bike is $30 per day, and the revenue generated per Bike is $60 per day. The company wants to maximize the total daily profit from all vehicles.\n// Profit_Trucks = (150 - 100) * Trucks\n// Profit_Vans = (120 - 70) * Vans\n// Profit_Bikes = (60 - 30) * Bikes\n// So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n## Generate Constraint-1:\nThe company has a limited budget for vehicle maintenance, which is $2000 per day. The maintenance cost per Truck is $150, per Van is $100, and per Bike is $50.\n// 150 * Trucks + 100 * Vans + 50 * Bikes <= 2000\n\n## Generate Constraint-2:\nThe company has a limited number of parking spaces, which is 20. Each Truck requires 3 spaces, each Van requires 2 spaces, and each Bike requires 1 space.\n// 3 * Trucks + 2 * Vans + 1 * Bikes <= 20\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. Each Truck emits 50 units, each Van emits 30 units, and each Bike emits 10 units.\n// 50 * Trucks + 30 * Vans + 10 * Bikes <= 500",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs. The operational cost, revenue generated, maintenance cost, parking space requirement, and emission units for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Revenue Generated per Day | Maintenance Cost per Day | Parking Spaces Required | Emission Units per Day |\n|--------------|--------------------------|---------------------------|--------------------------|-------------------------|------------------------|\n| Trucks       | $100                     | $150                      | $150                     | 3                       | 50                     |\n| Vans         | $70                      | $120                      | $100                     | 2                       | 30                     |\n| Bikes        | $30                      | $60                       | $50                      | 1                       | 10                     |\n\nThe company has a limited budget for vehicle maintenance, which is $2000 per day. The company has a limited number of parking spaces, which is 20. Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. \n\nPlease help the company to maximize the total daily profit from all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nProfit_Trucks = (150 - 100) * Trucks\nProfit_Vans = (120 - 70) * Vans\nProfit_Bikes = (60 - 30) * Bikes\n# So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n# Add constraints\n# The company has a limited budget for vehicle maintenance, which is $2000 per day.\nmodel.addCons(150 * Trucks + 100 * Vans + 50 * Bikes <= 2000)\n# The company has a limited number of parking spaces, which is 20.\nmodel.addCons(3 * Trucks + 2 * Vans + 1 * Bikes <= 20)\n# Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day.\nmodel.addCons(50 * Trucks + 30 * Vans + 10 * Bikes <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1500,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and consumes 5 liters of fuel per 100 km. Each Van can carry 500 kg and consumes 3 liters of fuel per 100 km. Each Bike can carry 100 kg and consumes 1 liter of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The efficiency is defined as the ratio of total carrying capacity to total fuel consumption.\n// Total carrying capacity = 1000 * T + 500 * V + 100 * B\n// Total fuel consumption = 5 * T + 3 * V + 1 * B\n// So, the objective function is: Maximize (1000 * T + 500 * V + 100 * B) / (5 * T + 3 * V + 1 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for purchasing vehicles. The cost of a Truck is $5000, a Van is $3000, and a Bike is $1000.\n// 5000 * T + 3000 * V + 1000 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 15000 kg.\n// 1000 * T + 500 * V + 100 * B <= 15000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\nEach Truck can carry 1000 kg and consumes 5 liters of fuel per 100 km. Each Van can carry 500 kg and consumes 3 liters of fuel per 100 km. Each Bike can carry 100 kg and consumes 1 liter of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The efficiency is defined as the ratio of total carrying capacity to total fuel consumption.\nThe company has a budget of $10,000 for purchasing vehicles. The cost of a Truck is $5000, a Van is $3000, and a Bike is $1000. The company also has a storage capacity of 15000 kg. Additionally, the company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nPlease help the company to maximize the efficiency, which is defined as the ratio of the total carrying capacity to the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 1000 * T + 500 * V + 100 * B\nTotalFuelConsumption = 5 * T + 3 * V + 1 * B\n## the objective function is: Maximize (1000 * T + 500 * V + 100 * B) / (5 * T + 3 * V + 1 * B)\n## convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $10,000 for purchasing vehicles.\nmodel.addCons(5000 * T + 3000 * V + 1000 * B <= 10000)\n## The company has a storage capacity of 15000 kg.\nmodel.addCons(1000 * T + 500 * V + 100 * B <= 15000)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company has 4 different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each type of device. The efficiency is measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota.\n// Efficiency for device 1: E1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\n// Efficiency for device 2: E2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\n// Efficiency for device 3: E3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n// The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3.\n// Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for assignment.\n// P1 + P2 + P3 + P4 <= 50\n\n## Generate Constraint-2:\nEach production line can handle up to 12 workers at a time.\n// P1 <= 12; P2 <= 12; P3 <= 12; P4 <= 12\n\n## Generate Constraint-3:\nThe company has a policy that at least 2 production lines must be operational.\n// P1 + P2 + P3 + P4 >= 2",
        "question": "A manufacturing company produces 3 types of electronic devices and has 4 different production lines. The company needs to determine the number of workers to assign to each line to optimize production efficiency. Each production line has a different efficiency in producing each type of device, measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota: at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3. There are a total of 50 workers available for assignment, and each production line can handle up to 12 workers at a time. Additionally, the company has a policy that at least 2 production lines must be operational. Please help the company maximize the minimum of the ratios of the required production quotas to the efficiencies of each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of workers on production line 4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\nE2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\nE3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n## Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n## convert the division to multiplication\nmodel.addCons(obj * E1 >= 1000)\nmodel.addCons(obj * E2 >= 1500)\nmodel.addCons(obj * E3 >= 2000)\n\n# Add constraints\n## There are a total of 50 workers available for assignment.\nmodel.addCons(P1 + P2 + P3 + P4 <= 50)\n## Each production line can handle up to 12 workers at a time.\nmodel.addCons(P1 <= 12)\nmodel.addCons(P2 <= 12)\nmodel.addCons(P3 <= 12)\nmodel.addCons(P4 <= 12)\n## The company has a policy that at least 2 production lines must be operational.\nmodel.addCons(P1 + P2 + P3 + P4 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Number of Workers on Production Line 4: \", model.getVal(P4))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"real\"}\n// {\"resource allocation for product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"real\"}\n// {\"resource allocation for product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of these products.\n// Profit_A = ProductA * 50\n// Profit_B = ProductB * 70\n// Profit_C = ProductC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total resource allocation for all products must not exceed 100 units. The resource usage for producing one unit of product A is 2 units, for product B is 3 units, and for product C is 2.5 units.\n// ResourceA + ResourceB + ResourceC <= 100\n\n## Generate Constraint-2:\nThe production of each product must meet the market demand. The demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 20\n\n## Generate Constraint-3:\nThe production capacity of the company limits the total production to 50 units per day.\n// ProductA + ProductB + ProductC <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage for producing one unit of product A is 2 units, for product B is 3 units, and for product C is 2.5 units.\n\n| Product | Profit per Unit | Resource Usage per Unit |\n|---------|-----------------|-------------------------|\n| A       | $50             | 2 units                 |\n| B       | $70             | 3 units                 |\n| C       | $60             | 2.5 units               |\n\nThe total resource allocation for all products must not exceed 100 units. The demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units. The production capacity of the company limits the total production to 50 units per day.\n\nPlease help the company to maximize the total profit from the sales of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=15) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=20) # production quantity of product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\") # resource allocation for product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\") # resource allocation for product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\") # resource allocation for product C\n\n# Define objective function\nProfit_A = ProductA * 50\nProfit_B = ProductB * 70\nProfit_C = ProductC * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 100)\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\nmodel.addCons(ResourceA == 2 * ProductA)\nmodel.addCons(ResourceB == 3 * ProductB)\nmodel.addCons(ResourceC == 2.5 * ProductC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in automation technology for each product line to reduce production costs.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductD\": \"AutomationD\", \"range\": \"AutomationD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for each product. The initial production cost per unit for ProductA is $50, for ProductB is $60, for ProductC is $70, and for ProductD is $80. The selling price per unit is $100 for ProductA, $110 for ProductB, $120 for ProductC, and $130 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.005 * AutomationA) * QuantityA\n// Total profit for ProductB: ProfitB = (110 - 60 + 0.005 * AutomationB) * QuantityB\n// Total profit for ProductC: ProfitC = (120 - 70 + 0.005 * AutomationC) * QuantityC\n// Total profit for ProductD: ProfitD = (130 - 80 + 0.005 * AutomationD) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investments.\n// AutomationA + AutomationB + AutomationC + AutomationD <= 100000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 5000 units.\n// QuantityA + QuantityB + QuantityC + QuantityD <= 5000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and is also considering investing in automation technology for each product line to reduce production costs. The production cost per unit decreases by $5 for every $1000 invested in automation for each product. The initial production cost per unit for ProductA is $50, for ProductB is $60, for ProductC is $70, and for ProductD is $80. The selling price per unit is $100 for ProductA, $110 for ProductB, $120 for ProductC, and $130 for ProductD. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for automation investments. The total production quantity for all products must not exceed 5000 units. Please help the company determine the optimal production quantities and automation investments to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\nAutomationD = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationD\", lb=0) # investment in automation for ProductD\n\n# Define objective function\nProfitA = (100 - 50 + 0.005 * AutomationA) * QuantityA\nProfitB = (110 - 60 + 0.005 * AutomationB) * QuantityB\nProfitC = (120 - 70 + 0.005 * AutomationC) * QuantityC\nProfitD = (130 - 80 + 0.005 * AutomationD) * QuantityD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for automation investments.\nmodel.addCons(AutomationA + AutomationB + AutomationC + AutomationD <= 100000)\n# The total production quantity for all products must not exceed 5000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC + QuantityD <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Investment in Automation for ProductD: \", model.getVal(AutomationD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the limited resources such as labor hours and raw materials. The variables include the number of units of product A, product B, and product C to be produced.\n// {\"number of units of product A\": \"Units_A\", \"range\": \"Units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"Units_B\", \"range\": \"Units_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"Units_C\", \"range\": \"Units_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// Profit_A = 50 * Units_A\n// Profit_B = 70 * Units_B\n// Profit_C = 60 * Units_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Each unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * Units_A + 8 * Units_B + 6 * Units_C <= 1000\n\n## Generate Constraint-2:\nThe company has a limited supply of raw materials. Each unit of product A requires 3 units of raw material, product B requires 4 units, and product C requires 5 units. The total raw material available is 2000 units.\n// 3 * Units_A + 4 * Units_B + 5 * Units_C <= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the limited resources such as labor hours and raw materials. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company has a total of 1000 labor hours available, with each unit of product A requiring 5 hours, product B requiring 8 hours, and product C requiring 6 hours. Additionally, the company has a limited supply of raw materials, with each unit of product A requiring 3 units, product B requiring 4 units, and product C requiring 5 units, and a total of 2000 units of raw material available.\n\nPlease help the company to maximize the total profit from all products.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit |\n|---------|-----------------|----------------------|-----------------------|\n| A       | $50             | 5 hours              | 3 units               |\n| B       | $70             | 8 hours              | 4 units               |\n| C       | $60             | 6 hours              | 5 units               |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits_A = model.addVar(vtype=\"INTEGER\", name=\"Units_A\", lb=0) # number of units of product A\nUnits_B = model.addVar(vtype=\"INTEGER\", name=\"Units_B\", lb=0) # number of units of product B\nUnits_C = model.addVar(vtype=\"INTEGER\", name=\"Units_C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = 50 * Units_A\nProfit_B = 70 * Units_B\nProfit_C = 60 * Units_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 labor hours available.\nmodel.addCons(5 * Units_A + 8 * Units_B + 6 * Units_C <= 1000)\n# The company has a limited supply of raw materials.\nmodel.addCons(3 * Units_A + 4 * Units_B + 5 * Units_C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(Units_A))\n    print(\"Number of Product B: \", model.getVal(Units_B))\n    print(\"Number of Product C: \", model.getVal(Units_C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1179,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space that can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of M1 must be at least twice the production of M2.\n// M1 >= 2 * M2",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company has a total production budget of $100,000. The company has a limited storage space that can hold a maximum of 100 units in total. Due to market demand, the production of M1 must be at least twice the production of M2.\nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # quantity of M3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n## The company has a total production budget of $100,000.\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n## The company has a limited storage space that can hold a maximum of 100 units in total.\nmodel.addCons(M1 + M2 + M3 <= 100)\n## Due to market demand, the production of M1 must be at least twice the production of M2.\nmodel.addCons(M1 >= 2 * M2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 in production costs. Product B yields a profit of $70 per unit with a production cost of $30. Product C yields a profit of $100 per unit with a production cost of $40. The company aims to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (100 - 40) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units, and for product B is at least 150 units.\n// A >= 100; B >= 150\n\n## Generate Constraint-3:\nThe total production of product C should not exceed the combined production of products A and B.\n// C <= A + B\n\n## Generate Constraint-4:\nThe company has a production capacity constraint where the total production time for all products should not exceed 500 hours. Product A requires 2 hours per unit, product B requires 3 hours per unit, and product C requires 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand.\nThe profit per unit of product A is $50, but it requires $20 in production costs. Product B yields a profit of $70 per unit with a production cost of $30. Product C yields a profit of $100 per unit with a production cost of $40. The company has a total production budget of $10,000. The market demand for product A is at least 100 units, and for product B is at least 150 units. The total production of product C should not exceed the combined production of products A and B. The company has a production capacity constraint where the total production time for all products should not exceed 500 hours. Product A requires 2 hours per unit, product B requires 3 hours per unit, and product C requires 4 hours per unit.\nPlease help the company to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (100 - 40) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The market demand for product A is at least 100 units, and for product B is at least 150 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 150)\n## The total production of product C should not exceed the combined production of products A and B.\nmodel.addCons(C <= A + B)\n## The company has a production capacity constraint where the total production time for all products should not exceed 500 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of facilities: a hospital, a school, a park, a library, and a community center. The city needs to determine the optimal number of each facility to maximize the overall utility while considering budget and space constraints.\n// {\"number of hospitals\": \"Hospital\", \"range\": \"Hospital >= 0\", \"type\": \"integer\"}\n// {\"number of schools\": \"School\", \"range\": \"School >= 0\", \"type\": \"integer\"}\n// {\"number of parks\": \"Park\", \"range\": \"Park >= 0\", \"type\": \"integer\"}\n// {\"number of libraries\": \"Library\", \"range\": \"Library >= 0\", \"type\": \"integer\"}\n// {\"number of community centers\": \"CommunityCenter\", \"range\": \"CommunityCenter >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe utility of each facility is estimated as follows:\n- Hospital: $100,000 per facility, with a utility factor of 1.2.\n- School: $80,000 per facility, with a utility factor of 1.5.\n- Park: $50,000 per facility, with a utility factor of 0.8.\n- Library: $60,000 per facility, with a utility factor of 1.0.\n- Community Center: $70,000 per facility, with a utility factor of 1.1.\nThe city wants to maximize the total utility of all facilities, which is the sum of the utility factors multiplied by the number of each type of facility.\n// TotalUtility = 1.2 * 100000 * Hospital + 1.5 * 80000 * School + 0.8 * 50000 * Park + 1.0 * 60000 * Library + 1.1 * 70000 * CommunityCenter\n// So, the objective function is: Maximize TotalUtility\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for all facilities.\n// 100000 * Hospital + 80000 * School + 50000 * Park + 60000 * Library + 70000 * CommunityCenter <= 1000000\n\n## Generate Constraint-2:\nThe city has a limited space for construction, with a maximum of 10 facilities in total.\n// Hospital + School + Park + Library + CommunityCenter <= 10",
        "question": "A city is planning to build five different types of facilities: a hospital, a school, a park, a library, and a community center. The city needs to determine the optimal number of each facility to maximize the overall utility while considering budget and space constraints. The utility of each facility and the cost per facility are given in the following Table.\n\n| Facility         | Utility Factor | Cost per Facility |\n|------------------|----------------|-------------------|\n| Hospital         | 1.2            | $100,000          |\n| School           | 1.5            | $80,000           |\n| Park             | 0.8            | $50,000           |\n| Library          | 1.0            | $60,000           |\n| Community Center | 1.1            | $70,000           |\n\nThe city has a budget of $1,000,000 for all facilities. The city also has a limited space for construction, with a maximum of 10 facilities in total. Please help the city to maximize the total utility of all facilities, which is the sum of the utility factors multiplied by the number of each type of facility.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHospital = model.addVar(vtype=\"INTEGER\", name=\"Hospital\", lb=0)  # number of hospitals\nSchool = model.addVar(vtype=\"INTEGER\", name=\"School\", lb=0)  # number of schools\nPark = model.addVar(vtype=\"INTEGER\", name=\"Park\", lb=0)  # number of parks\nLibrary = model.addVar(vtype=\"INTEGER\", name=\"Library\", lb=0)  # number of libraries\nCommunityCenter = model.addVar(vtype=\"INTEGER\", name=\"CommunityCenter\", lb=0)  # number of community centers\n\n# Define objective function\nTotalUtility = 1.2 * 100000 * Hospital + 1.5 * 80000 * School + 0.8 * 50000 * Park + 1.0 * 60000 * Library + 1.1 * 70000 * CommunityCenter\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalUtility)\n\n# Add constraints\n# The city has a budget of $1,000,000 for all facilities.\nmodel.addCons(100000 * Hospital + 80000 * School + 50000 * Park + 60000 * Library + 70000 * CommunityCenter <= 1000000)\n# The city has a limited space for construction, with a maximum of 10 facilities in total.\nmodel.addCons(Hospital + School + Park + Library + CommunityCenter <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hospitals: \", model.getVal(Hospital))\n    print(\"Number of Schools: \", model.getVal(School))\n    print(\"Number of Parks: \", model.getVal(Park))\n    print(\"Number of Libraries: \", model.getVal(Library))\n    print(\"Number of Community Centers: \", model.getVal(CommunityCenter))\n    print(\"Maximized Total Utility: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost per unit of product A\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product B\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product C\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product A\": \"RevenueA\", \"range\": \"RevenueA >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product B\": \"RevenueB\", \"range\": \"RevenueB >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product C\": \"RevenueC\", \"range\": \"RevenueC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, and the revenue per unit is $100.\nThe cost of producing each unit of product B is $70, and the revenue per unit is $140.\nThe cost of producing each unit of product C is $60, and the revenue per unit is $120.\nThe company wants to maximize the total profit.\n// Profit_A = UnitsA * (RevenueA - CostA)\n// Profit_B = UnitsB * (RevenueB - CostB)\n// Profit_C = UnitsC * (RevenueC - CostC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the machines is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for production costs per day.\n// UnitsA * CostA + UnitsB * CostB + UnitsC * CostC <= 5000\n\n## Generate Constraint-3:\nThe storage capacity for product A is limited to 50 units, for product B is 60 units, and for product C is 40 units.\n// UnitsA <= 50\n// UnitsB <= 60\n// UnitsC <= 40",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The cost of producing each unit of product A is $50, and the revenue per unit is $100. The cost of producing each unit of product B is $70, and the revenue per unit is $140. The cost of producing each unit of product C is $60, and the revenue per unit is $120. The total production capacity of the machines is 100 units per day. The company has a budget of $5000 for production costs per day. The storage capacity for product A is limited to 50 units, for product B is 60 units, and for product C is 40 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * (100 - 50) # Profit per unit of product A\nProfit_B = UnitsB * (140 - 70) # Profit per unit of product B\nProfit_C = UnitsC * (120 - 60) # Profit per unit of product C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C) # the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100) # The total production capacity of the machines is 100 units per day.\nmodel.addCons(UnitsA * 50 + UnitsB * 70 + UnitsC * 60 <= 5000) # The company has a budget of $5000 for production costs per day.\nmodel.addCons(UnitsA <= 50) # The storage capacity for product A is limited to 50 units.\nmodel.addCons(UnitsB <= 60) # The storage capacity for product B is limited to 60 units.\nmodel.addCons(UnitsC <= 40) # The storage capacity for product C is limited to 40 units.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be invested in upgrading the fuel efficiency of each truck.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"speed of Truck1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of Truck2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Truck1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Truck2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by its speed and the investment in fuel efficiency upgrades. The fuel consumption per trip for Truck1 is modeled as \\(F1 = 0.05 \\times Speed1^2 - 0.01 \\times Efficiency1 \\times Speed1 + 0.1 \\times Efficiency1\\). Similarly, for Truck2, \\(F2 = 0.05 \\times Speed2^2 - 0.01 \\times Efficiency2 \\times Speed2 + 0.1 \\times Efficiency2\\). The company aims to minimize the total fuel consumption across all trucks.\n// Total fuel consumption for Truck1: Consumption1 = F1 * Trips1\n// Total fuel consumption for Truck2: Consumption2 = F2 * Trips2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel and efficiency upgrades.\n// Efficiency1 + Efficiency2 <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across both trucks must not exceed 500.\n// Trips1 + Trips2 <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck1 must make at least 50 trips and Truck2 must make at least 75 trips.\n// Trips1 >= 50; Trips2 >= 75\n\n## Generate Constraint-4:\nThe speed of each truck must be optimized to balance fuel consumption and delivery times, with an upper limit of 60 km/h.\n// 0 < Speed1 <= 60; 0 < Speed2 <= 60",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be invested in upgrading the fuel efficiency of each truck. The fuel consumption of each truck is affected by its speed and the investment in fuel efficiency upgrades. The company aims to minimize the total fuel consumption across all trucks. The company has a total budget of $10,000 for fuel and efficiency upgrades. The total number of trips across both trucks must not exceed 500. Due to maintenance schedules, Truck1 must make at least 50 trips and Truck2 must make at least 75 trips. The speed of each truck must be optimized to balance fuel consumption and delivery times, with an upper limit of 60 km/h. Please help the company to determine the optimal number of trips, speeds, and investments in fuel efficiency to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips for Truck2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of Truck2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Truck1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Truck2\n\n# Define objective function\nF1 = 0.05 * Speed1**2 - 0.01 * Efficiency1 * Speed1 + 0.1 * Efficiency1\nF2 = 0.05 * Speed2**2 - 0.01 * Efficiency2 * Speed2 + 0.1 * Efficiency2\nConsumption1 = F1 * Trips1\nConsumption2 = F2 * Trips2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\nmodel.addCons(Efficiency1 + Efficiency2 <= 10000)  # total budget constraint\nmodel.addCons(Trips1 + Trips2 <= 500)  # total trips constraint\nmodel.addCons(Trips1 >= 50)  # minimum trips for Truck1\nmodel.addCons(Trips2 >= 75)  # minimum trips for Truck2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Investment in Fuel Efficiency for Truck1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Truck2: \", model.getVal(Efficiency2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the costs and market demand. The production process involves both fixed and variable costs, and the demand for each product varies with its price.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"price of product A\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"real\"}\n// {\"price of product B\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"real\"}\n// {\"price of product C\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit for product A is given by (PriceA * ProductA) - (10 * ProductA + 500).\nThe profit for product B is given by (PriceB * ProductB) - (15 * ProductB + 1000).\nThe profit for product C is given by (PriceC * ProductC) - (20 * ProductC + 1500).\nThe company wants to maximize the total profit from all products.\n// TotalProfit = (PriceA * ProductA - 10 * ProductA - 500) + (PriceB * ProductB - 15 * ProductB - 1000) + (PriceC * ProductC - 20 * ProductC - 1500)\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $5000 per month.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC + 500 + 1000 + 1500 <= 5000\n\n## Generate Constraint-2:\nThe market demand for product A is PriceA^2 - 20*PriceA + 100 units.\nThe market demand for product B is PriceB^2 - 30*PriceB + 200 units.\nThe market demand for product C is PriceC^2 - 40*PriceC + 300 units.\nThe production quantities must meet or exceed the market demands.\n// ProductA >= PriceA^2 - 20*PriceA + 100\n// ProductB >= PriceB^2 - 30*PriceB + 200\n// ProductC >= PriceC^2 - 40*PriceC + 300\n\n## Generate Constraint-3:\nThe company has a maximum production capacity of 200 units per month.\n// ProductA + ProductB + ProductC <= 200\n\n## Generate Constraint-4:\nThe prices of the products must be set within a certain range to remain competitive:\n// 5 <= PriceA <= 20\n// 10 <= PriceB <= 30\n// 15 <= PriceC <= 40",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the costs and market demand. The production process involves both fixed and variable costs, and the demand for each product varies with its price.\n\nThe profit for product A is given by (PriceA * ProductA) - (10 * ProductA + 500).\nThe profit for product B is given by (PriceB * ProductB) - (15 * ProductB + 1000).\nThe profit for product C is given by (PriceC * ProductC) - (20 * ProductC + 1500).\n\nThe total production cost must not exceed $5000 per month. The market demand for product A is PriceA^2 - 20*PriceA + 100 units. The market demand for product B is PriceB^2 - 30*PriceB + 200 units. The market demand for product C is PriceC^2 - 40*PriceC + 300 units. The production quantities must meet or exceed the market demands. The company has a maximum production capacity of 200 units per month. The prices of the products must be set within a certain range to remain competitive: 5 <= PriceA <= 20, 10 <= PriceB <= 30, and 15 <= PriceC <= 40.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=5, ub=20)  # price of product A\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=10, ub=30)  # price of product B\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=15, ub=40)  # price of product C\n\n# Define objective function\nTotalProfit = (PriceA * ProductA - 10 * ProductA - 500) + (PriceB * ProductB - 15 * ProductB - 1000) + (PriceC * ProductC - 20 * ProductC - 1500)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total production cost must not exceed $5000 per month.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC + 500 + 1000 + 1500 <= 5000)\n\n# The production quantities must meet or exceed the market demands.\nmodel.addCons(ProductA >= PriceA**2 - 20*PriceA + 100)\nmodel.addCons(ProductB >= PriceB**2 - 30*PriceB + 200)\nmodel.addCons(ProductC >= PriceC**2 - 40*PriceC + 300)\n\n# The company has a maximum production capacity of 200 units per month.\nmodel.addCons(ProductA + ProductB + ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Price of Product A: \", model.getVal(PriceA))\n    print(\"Price of Product B: \", model.getVal(PriceB))\n    print(\"Price of Product C: \", model.getVal(PriceC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5\n\n## Generate Constraint-3:\nThe total travel time for all routes must not exceed 200 hours.\n// TimeA + TimeB + TimeC + TimeD + TimeE <= 200\n\n## Generate Constraint-4:\nThe total fuel consumption for all routes must not exceed 3000 liters.\n// FuelA + FuelB + FuelC + FuelD + FuelE <= 3000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\nFor city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours.\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city. The total travel time for all routes must not exceed 200 hours. The total fuel consumption for all routes must not exceed 3000 liters.\nPlease help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TimeA + TimeB + TimeC + TimeD + TimeE <= 200)\nmodel.addCons(FuelA + FuelB + FuelC + FuelD + FuelE <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"maintenance cost per Truck\": \"TruckMaintenance\", \"range\": \"TruckMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Van\": \"VanMaintenance\", \"range\": \"VanMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Bike\": \"BikeMaintenance\", \"range\": \"BikeMaintenance >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Truck\": \"TruckCapacity\", \"range\": \"TruckCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Van\": \"VanCapacity\", \"range\": \"VanCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Bike\": \"BikeCapacity\", \"range\": \"BikeCapacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total delivery capacity while minimizing the total maintenance cost. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles.\n// TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n// TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n// So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance.\n// TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2 <= 10000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles. The company wants to maximize the total delivery capacity while minimizing the total maintenance cost. The company has a budget of $10,000 for vehicle maintenance. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n## TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n## So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\nTotalMaintenanceCost = TruckCount * TruckCount + VanCount * VanCount + BikeCount * BikeCount  # Simplified as TruckMaintenance^2 = TruckCount, etc.\nTotalDeliveryCapacity = TruckCount + VanCount + BikeCount\nmodel.addCons(obj == TotalDeliveryCapacity - TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(TruckCount * TruckCount + VanCount * VanCount + BikeCount * BikeCount <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company aims to minimize the total operational cost per liter of fuel consumed.\n// Operational cost of A: Cost_A = 50 * A\n// Operational cost of B: Cost_B = 70 * B\n// Operational cost of C: Cost_C = 90 * C\n// Operational cost of D: Cost_D = 110 * D\n// Operational cost of E: Cost_E = 130 * E\n// Fuel consumption of A: Fuel_A = 10 * A\n// Fuel consumption of B: Fuel_B = 15 * B\n// Fuel consumption of C: Fuel_C = 20 * C\n// Fuel consumption of D: Fuel_D = 25 * D\n// Fuel consumption of E: Fuel_E = 30 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs this month.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery demand of 500 trips this month.\n// A + B + C + D + E >= 500\n\n## Generate Constraint-3:\nThe total fuel consumption must not exceed 15,000 liters this month.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000\n\n## Generate Constraint-4:\nThe number of trips for Truck D must not exceed the combined trips of Trucks A and B.\n// D <= A + B\n\n## Generate Constraint-5:\nThe number of trips for Truck E must not exceed the combined trips of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption and operational cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/trip) | Operational Cost ($/trip) |\n|------------|-------------------------------|---------------------------|\n| A          | 10                            | 50                        |\n| B          | 15                            | 70                        |\n| C          | 20                            | 90                        |\n| D          | 25                            | 110                       |\n| E          | 30                            | 130                       |\n\nThe company has a budget of $10,000 for operational costs this month. The company must meet a minimum delivery demand of 500 trips this month. The total fuel consumption must not exceed 15,000 liters this month. The number of trips for Truck D must not exceed the combined trips of Trucks A and B. The number of trips for Truck E must not exceed the combined trips of Trucks A, B, C, and D.\n\nPlease help the company to minimize the total operational cost per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trips for Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trips for Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 50 * A\nCost_B = 70 * B\nCost_C = 90 * C\nCost_D = 110 * D\nCost_E = 130 * E\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs this month.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n## The company must meet a minimum delivery demand of 500 trips this month.\nmodel.addCons(A + B + C + D + E >= 500)\n## The total fuel consumption must not exceed 15,000 liters this month.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n## The number of trips for Truck D must not exceed the combined trips of Trucks A and B.\nmodel.addCons(D <= A + B)\n## The number of trips for Truck E must not exceed the combined trips of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Minimized Operational Cost per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1373,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day. The company has a total budget of $10,000 per day for operating costs. Please help the company to maximize the total net profit across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit per truck per day\nProfit_R1 = 1500 - 1000\nProfit_R2 = 1800 - 1200\nProfit_R3 = 2100 - 1500\nProfit_R4 = 2400 - 1800\nProfit_R5 = 2700 - 2000\n\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 742,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations. The cost per trip, fuel consumption per trip, and revenue per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Fuel Consumption per Trip | Revenue per Trip |\n|---------|---------------|--------------------------|------------------|\n| V1      | $100          | 5 liters                 | $150             |\n| V2      | $120          | 6 liters                 | $180             |\n| V3      | $140          | 7 liters                 | $210             |\n\nThe company has a limited fuel budget of 500 liters. Please help the company to maximize the profit efficiency (profit per liter of fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for V1: \", model.getVal(V1))\n    print(\"Number of Trips for V2: \", model.getVal(V2))\n    print(\"Number of Trips for V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different routes (Route A, Route B, Route C, Route D, and Route E) that require different numbers of trucks.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per truck and a different revenue per truck. The cost per truck on Route A is $5000, and the revenue per truck is $10000. On Route B, the cost is $6000, and the revenue is $12000. On Route C, the cost is $7000, and the revenue is $14000. On Route D, the cost is $8000, and the revenue is $16000. On Route E, the cost is $9000, and the revenue is $18000. The company wants to maximize its profit, which is defined as the total revenue minus the total cost.\n// Total cost: Cost = 5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE\n// Total revenue: Revenue = 10000 * TruckA + 12000 * TruckB + 14000 * TruckC + 16000 * TruckD + 18000 * TruckE\n// So, the objective function is: Maximize (Revenue - Cost)\n// Maximize (10000 * TruckA + 12000 * TruckB + 14000 * TruckC + 16000 * TruckD + 18000 * TruckE - 5000 * TruckA - 6000 * TruckB - 7000 * TruckC - 8000 * TruckD - 9000 * TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different routes (Route A, Route B, Route C, Route D, and Route E) that require different numbers of trucks. The company wants to determine the optimal number of trucks to allocate to each route to maximize its profit, which is defined as the total revenue minus the total cost. The cost per truck and revenue per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| A     | $5000          | $10000            |\n| B     | $6000          | $12000            |\n| C     | $7000          | $14000            |\n| D     | $8000          | $16000            |\n| E     | $9000          | $18000            |\n\nThe company has a total of 100 trucks available. Please help the company to maximize its profit by determining the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost = 5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE\nRevenue = 10000 * TruckA + 12000 * TruckB + 14000 * TruckC + 16000 * TruckD + 18000 * TruckE\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different production cost, selling price, and requires a specific amount of labor hours. The firm aims to maximize its profit rate, which is defined as the total profit divided by the total labor hours.\nFor Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours.\nFor Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours.\nFor Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours.\nFor Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours.\n// Profit of A: Profit_A = (30 - 20) * A\n// Profit of B: Profit_B = (35 - 25) * B\n// Profit of C: Profit_C = (40 - 30) * C\n// Profit of D: Profit_D = (45 - 35) * D\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (3 * A + 4 * B + 5 * C + 6 * D)\n\n## Generate Constraint-1:\nThe firm has a budget of $10,000 for production costs next month.\n// 20 * A + 25 * B + 30 * C + 35 * D <= 10000",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations.\nFor Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours.\nFor Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours.\nFor Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours.\nFor Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours.\nThe firm has a budget of $10,000 for production costs next month.\nThe firm aims to maximize its profit rate, which is defined as the total profit divided by the total labor hours.\nPlease help the firm determine the optimal number of units to manufacture for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 20) * A\nProfit_B = (35 - 25) * B\nProfit_C = (40 - 30) * C\nProfit_D = (45 - 35) * D\nLaborHours = 3 * A + 4 * B + 5 * C + 6 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $10,000 for production costs next month.\nmodel.addCons(20 * A + 25 * B + 30 * C + 35 * D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net profit per day.\n// NetProfit_A = (1000 - 500) * TrucksA\n// NetProfit_B = (1200 - 600) * TrucksB\n// NetProfit_C = (1400 - 700) * TrucksC\n// NetProfit_D = (1600 - 800) * TrucksD\n// NetProfit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a daily budget of $30,000 for operating costs.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000\n\n## Generate Constraint-4:\nTo ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\n// |TrucksA - TrucksB| <= 10\n// |TrucksA - TrucksC| <= 10\n// |TrucksA - TrucksD| <= 10\n// |TrucksA - TrucksE| <= 10\n// |TrucksB - TrucksC| <= 10\n// |TrucksB - TrucksD| <= 10\n// |TrucksB - TrucksE| <= 10\n// |TrucksC - TrucksD| <= 10\n// |TrucksC - TrucksE| <= 10\n// |TrucksD - TrucksE| <= 10\n\n## Generate Constraint-5:\nEach type of good must have at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network. The operating cost and revenue for each type of good are given in the following Table.\n\n| Good    | Operating Cost per Day | Revenue per Day |\n|---------|------------------------|-----------------|\n| GoodA   | $500                   | $1000           |\n| GoodB   | $600                   | $1200           |\n| GoodC   | $700                   | $1400           |\n| GoodD   | $800                   | $1600           |\n| GoodE   | $900                   | $1800           |\n\nThe company has a total of 50 trucks available. Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB. The company has a daily budget of $30,000 for operating costs. To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10. Each type of good must have at least one truck allocated.\n\nPlease help the company to maximize the total net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for GoodE\n\n# Define objective function\nNetProfit_A = (1000 - 500) * TrucksA\nNetProfit_B = (1200 - 600) * TrucksB\nNetProfit_C = (1400 - 700) * TrucksC\nNetProfit_D = (1600 - 800) * TrucksD\nNetProfit_E = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n# The company has a daily budget of $30,000 for operating costs.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n\n# To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\nmodel.addCons(abs(TrucksA - TrucksB) <= 10)\nmodel.addCons(abs(TrucksA - TrucksC) <= 10)\nmodel.addCons(abs(TrucksA - TrucksD) <= 10)\nmodel.addCons(abs(TrucksA - TrucksE) <= 10)\nmodel.addCons(abs(TrucksB - TrucksC) <= 10)\nmodel.addCons(abs(TrucksB - TrucksD) <= 10)\nmodel.addCons(abs(TrucksB - TrucksE) <= 10)\nmodel.addCons(abs(TrucksC - TrucksD) <= 10)\nmodel.addCons(abs(TrucksC - TrucksE) <= 10)\nmodel.addCons(abs(TrucksD - TrucksE) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1231,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5.\nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4.\nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3.\nThe manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_E1 = 30000 * E1 - 20000 * E1\n// NetRevenue_E2 = 40000 * E2 - 25000 * E2\n// NetRevenue_E3 = 50000 * E3 - 30000 * E3\n// So, the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / (5 * E1 + 4 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\nFor E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5.\nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4.\nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3.\nThe manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score.\nThe manufacturer has a total production budget of $1,000,000.\nPlease help the manufacturer determine the optimal production quantities for each vehicle type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_E1 = 30000 * E1 - 20000 * E1\nNetRevenue_E2 = 40000 * E2 - 25000 * E2\nNetRevenue_E3 = 50000 * E3 - 30000 * E3\nEnvironmentalImpact = 5 * E1 + 4 * E2 + 3 * E3\n## the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Environmental Impact Score: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for ProductA\": \"RawMaterialACost\", \"range\": \"RawMaterialACost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductB\": \"RawMaterialBCost\", \"range\": \"RawMaterialBCost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductC\": \"RawMaterialCCost\", \"range\": \"RawMaterialCCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductA\": \"LaborACost\", \"range\": \"LaborACost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductB\": \"LaborBCost\", \"range\": \"LaborBCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductC\": \"LaborCCost\", \"range\": \"LaborCCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductA\": \"StorageACost\", \"range\": \"StorageACost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductB\": \"StorageBCost\", \"range\": \"StorageBCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductC\": \"StorageCCost\", \"range\": \"StorageCCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60.\n// Total profit for ProductA: Profit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\n// Total profit for ProductB: Profit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\n// Total profit for ProductC: Profit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for raw materials.\n// RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100,000\n\n## Generate Constraint-2:\nThe total labor cost should not exceed $50,000.\n// LaborACost * ProductAQty + LaborBCost * ProductBQty + LaborCCost * ProductCQty <= 50,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The company has a budget of $100,000 for raw materials. The total labor cost should not exceed $50,000. Please help the company to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # quantity of ProductC\nRawMaterialACost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialACost\", lb=0) # cost of raw materials for ProductA\nRawMaterialBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialBCost\", lb=0) # cost of raw materials for ProductB\nRawMaterialCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialCCost\", lb=0) # cost of raw materials for ProductC\nLaborACost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborACost\", lb=0) # labor cost per unit for ProductA\nLaborBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborBCost\", lb=0) # labor cost per unit for ProductB\nLaborCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborCCost\", lb=0) # labor cost per unit for ProductC\nStorageACost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageACost\", lb=0) # storage cost per unit for ProductA\nStorageBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageBCost\", lb=0) # storage cost per unit for ProductB\nStorageCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageCCost\", lb=0) # storage cost per unit for ProductC\n\n# Define objective function\nProfit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\nProfit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\nProfit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100000)\nmodel.addCons(LaborACost * ProductAQty + LaborBCost * ProductBQty + LaborCCost * ProductCQty <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 612,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for ProductA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechInvestC\", \"range\": \"TechInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total investment budget of $50,000 for advanced manufacturing technologies.\n// TechInvestA + TechInvestB + TechInvestC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units.\n// QuantityA <= 400; QuantityB <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductC are produced.\n// QuantityC >= 100\n\n## Generate Constraint-5:\nThe investment in technology for ProductA must not exceed $20,000, and for ProductB must not exceed $15,000.\n// TechInvestA <= 20000; TechInvestB <= 15000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $250                   |\n| ProductC | $200                             | $300                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The company has a total investment budget of $50,000 for advanced manufacturing technologies. The total production capacity of the company is limited to 1000 units. Due to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units. The company must ensure that at least 100 units of ProductC are produced. The investment in technology for ProductA must not exceed $20,000, and for ProductB must not exceed $15,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=100)  # quantity of ProductC\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0)  # investment in technology for ProductA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0)  # investment in technology for ProductB\nTechInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestC\", lb=0)  # investment in technology for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\nProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\nProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + TechInvestC <= 50000)  # total investment budget\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)  # total production capacity\nmodel.addCons(QuantityA <= 400)  # production limit for ProductA\nmodel.addCons(QuantityB <= 300)  # production limit for ProductB\nmodel.addCons(QuantityC >= 100)  # minimum production for ProductC\nmodel.addCons(TechInvestA <= 20000)  # investment limit for ProductA\nmodel.addCons(TechInvestB <= 15000)  # investment limit for ProductB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechInvestA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechInvestB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechInvestC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1535,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology to reduce labor costs. The automation technology reduces the number of workers needed per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The automation technology reduces the labor cost per unit by $2 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA * WageRate\n// Total profit for ProductB: ProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB * WageRate\n// Total profit for ProductC: ProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC * WageRate\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n// QuantityA >= 500; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology to reduce labor costs. The automation technology reduces the number of workers needed per unit of product. The cost and revenue per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| ProductA | $50           | $100             |\n| ProductB | $70           | $120             |\n| ProductC | $90           | $150             |\n\nThe automation technology reduces the labor cost per unit by $2 for every $10,000 invested. The company has a total of 100 workers available. The total capital investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # capital investment in automation\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA * WageRate\n## Total profit for ProductB: ProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB * WageRate\n## Total profit for ProductC: ProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC * WageRate\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA\nProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB\nProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed.\n// Revenue from Trucks: Revenue_T = 1000 * T\n// Revenue from Vans: Revenue_V = 700 * V\n// Revenue from Bikes: Revenue_B = 300 * B\n// Fuel consumed by Trucks: Fuel_T = 50 * T\n// Fuel consumed by Vans: Fuel_V = 30 * V\n// Fuel consumed by Bikes: Fuel_B = 5 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel consumption.\n// 50 * T + 30 * V + 5 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Bikes does not exceed 20.\n// B <= 20",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed. The company has a budget of $10,000 for fuel consumption. The company has a total of 50 drivers available. The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company wants to ensure that the total number of Bikes does not exceed 20. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_T = 1000 * T\nRevenue_V = 700 * V\nRevenue_B = 300 * B\nFuel_T = 50 * T\nFuel_V = 30 * V\nFuel_B = 5 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_T + Fuel_V + Fuel_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel consumption.\nmodel.addCons(50 * T + 30 * V + 5 * B <= 10000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company wants to ensure that the total number of Bikes does not exceed 20.\nmodel.addCons(B <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance costs combined.\n// (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route. The profit per truck, fuel cost per truck, and maintenance cost per truck for each route are given in the following Table.\n\n| Route | Profit per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|-------|------------------|---------------------|----------------------------|\n| A     | $10,000          | $2,000              | $1,500                     |\n| B     | $12,000          | $2,500              | $1,800                     |\n| C     | $15,000          | $3,000              | $2,000                     |\n| D     | $18,000          | $3,500              | $2,500                     |\n| E     | $20,000          | $4,000              | $3,000                     |\n\nThe company has a total of 50 trucks available for allocation. The company has a budget of $100,000 for fuel and maintenance costs combined. The company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs). Please help the company determine the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trucks for Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\n## The company has a budget of $100,000 for fuel and maintenance costs combined.\nmodel.addCons((2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products.\n// {\"number of hours machine M1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine M1 produces 10 units of product A, 20 units of product B, and 30 units of product C per hour, with a cost of $50 per hour. Machine M2 produces 15 units of product A, 25 units of product B, and 35 units of product C per hour, with a cost of $60 per hour. Machine M3 produces 20 units of product A, 30 units of product B, and 40 units of product C per hour, with a cost of $70 per hour. Machine M4 produces 25 units of product A, 35 units of product B, and 45 units of product C per hour, with a cost of $80 per hour. Machine M5 produces 30 units of product A, 40 units of product B, and 50 units of product C per hour, with a cost of $90 per hour. The company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets.\n// Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n// Production of product A: A = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Production of product B: B = 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5\n// Production of product C: C = 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total production of product A must be at least 1000 units.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000\n\n## Generate Constraint-2:\nThe total production of product B must be at least 1500 units.\n// 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour, as shown in the following Table.\n\n| Machine | Units of A Produced per Hour | Units of B Produced per Hour | Units of C Produced per Hour | Cost per Hour |\n|---------|------------------------------|------------------------------|------------------------------|---------------|\n| M1      | 10                           | 20                           | 30                           | $50           |\n| M2      | 15                           | 25                           | 35                           | $60           |\n| M3      | 20                           | 30                           | 40                           | $70           |\n| M4      | 25                           | 35                           | 45                           | $80           |\n| M5      | 30                           | 40                           | 50                           | $90           |\n\nThe company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets. The total production of product A must be at least 1000 units, and the total production of product B must be at least 1500 units.\n\nPlease help the company determine the optimal number of hours each machine should operate to minimize the total cost of production while meeting the production targets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of hours machine M1 operates\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of hours machine M2 operates\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of hours machine M3 operates\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of hours machine M4 operates\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of hours machine M5 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\nmodel.addCons(obj == 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5)\n\n# Add constraints\n## The total production of product A must be at least 1000 units.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000)\n## The total production of product B must be at least 1500 units.\nmodel.addCons(20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500)\n## The total production of product C must be at least 2000 units.\nmodel.addCons(30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours machine M1 operates: \", model.getVal(M1))\n    print(\"Number of hours machine M2 operates: \", model.getVal(M2))\n    print(\"Number of hours machine M3 operates: \", model.getVal(M3))\n    print(\"Number of hours machine M4 operates: \", model.getVal(M4))\n    print(\"Number of hours machine M5 operates: \", model.getVal(M5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1629,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering the cost of fuel, maintenance, and the number of deliveries each vehicle can handle per day. Additionally, the company must decide on the level of investment in vehicle upgrades, which can improve fuel efficiency and delivery capacity.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck upgrades\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van upgrades\": \"VanUpgrade\", \"range\": \"VanUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike upgrades\": \"BikeUpgrade\", \"range\": \"BikeUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is affected by the investment in upgrades. Trucks have an initial efficiency of 10 deliveries per day, which increases by 1 delivery for every $100 invested in upgrades. Vans have an initial efficiency of 15 deliveries per day, increasing by 1.5 deliveries for every $100 invested in upgrades. Bikes have an initial efficiency of 20 deliveries per day, increasing by 2 deliveries for every $100 invested in upgrades. The cost of operating each vehicle type is also affected by the upgrades, with Trucks costing $100 per day, Vans costing $70 per day, and Bikes costing $50 per day, all decreasing by 1% for every $100 invested in upgrades. The company aims to maximize the net daily profit from deliveries.\n// NetProfit_Trucks = (10 + 0.01 * TruckUpgrade) * TruckCount * (DeliveryPrice - (100 - 0.01 * TruckUpgrade))\n// NetProfit_Vans = (15 + 0.015 * VanUpgrade) * VanCount * (DeliveryPrice - (70 - 0.01 * VanUpgrade))\n// NetProfit_Bikes = (20 + 0.02 * BikeUpgrade) * BikeCount * (DeliveryPrice - (50 - 0.01 * BikeUpgrade))\n// So, the objective function is: Maximize (NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations and upgrades.\n// 100 * TruckCount + 70 * VanCount + 50 * BikeCount + TruckUpgrade + VanUpgrade + BikeUpgrade <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type and the level of investment in vehicle upgrades to maximize net daily profit from deliveries. The efficiency and operating cost of each vehicle type are affected by the investment in upgrades, as shown in the following Table.\n\n| Vehicle Type | Initial Efficiency | Cost per Day | Efficiency Increase per $100 Upgrade | Cost Decrease per $100 Upgrade |\n|--------------|--------------------|--------------|-------------------------------------|-------------------------------|\n| Trucks       | 10 deliveries      | $100         | 1 delivery                          | 1%                            |\n| Vans         | 15 deliveries      | $70          | 1.5 deliveries                     | 1%                            |\n| Bikes        | 20 deliveries      | $50          | 2 deliveries                       | 1%                            |\n\nThe company has a total budget of $10,000 for vehicle operations and upgrades. Please help the company to maximize the net daily profit from deliveries, considering the constraints on the budget and the effects of upgrades on vehicle efficiency and operating costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nTruckUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckUpgrade\", lb=0)\nVanUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"VanUpgrade\", lb=0)\nBikeUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeUpgrade\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDeliveryPrice = 20  # Assuming a constant delivery price for simplicity\nNetProfit_Trucks = (10 + 0.01 * TruckUpgrade) * TruckCount * (DeliveryPrice - (100 - 0.01 * TruckUpgrade))\nNetProfit_Vans = (15 + 0.015 * VanUpgrade) * VanCount * (DeliveryPrice - (70 - 0.01 * VanUpgrade))\nNetProfit_Bikes = (20 + 0.02 * BikeUpgrade) * BikeCount * (DeliveryPrice - (50 - 0.01 * BikeUpgrade))\n## the objective function is: Maximize (NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\nmodel.addCons(obj == NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\n\n# Add constraints\n## The company has a total budget of $10,000 for vehicle operations and upgrades.\nmodel.addCons(100 * TruckCount + 70 * VanCount + 50 * BikeCount + TruckUpgrade + VanUpgrade + BikeUpgrade <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Upgrades: \", model.getVal(TruckUpgrade))\n    print(\"Investment in Van Upgrades: \", model.getVal(VanUpgrade))\n    print(\"Investment in Bike Upgrades: \", model.getVal(BikeUpgrade))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1303,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency.\n// {\"number of Small solar plants\": \"SmallPlants\", \"range\": \"SmallPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Medium solar plants\": \"MediumPlants\", \"range\": \"MediumPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Large solar plants\": \"LargePlants\", \"range\": \"LargePlants >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Small plants\": \"TechInvestmentSmall\", \"range\": \"TechInvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Medium plants\": \"TechInvestmentMedium\", \"range\": \"TechInvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Large plants\": \"TechInvestmentLarge\", \"range\": \"TechInvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n// EnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\n// EnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\n// EnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for building new plants and investing in technology.\n// 1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000",
        "question": "A renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency. The energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants. The company has a total budget of $10 million for building new plants and investing in technology. Please help the company to determine the optimal number of each type of plant and the investment in advanced solar technology to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallPlants = model.addVar(vtype=\"INTEGER\", name=\"SmallPlants\", lb=0)  # number of Small solar plants\nMediumPlants = model.addVar(vtype=\"INTEGER\", name=\"MediumPlants\", lb=0)  # number of Medium solar plants\nLargePlants = model.addVar(vtype=\"INTEGER\", name=\"LargePlants\", lb=0)  # number of Large solar plants\nTechInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSmall\", lb=0)  # investment in advanced technology for Small plants\nTechInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentMedium\", lb=0)  # investment in advanced technology for Medium plants\nTechInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentLarge\", lb=0)  # investment in advanced technology for Large plants\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\nEnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\nEnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n# So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# Add constraints\n# The company has a total budget of $10 million for building new plants and investing in technology.\nmodel.addCons(1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small solar plants: \", model.getVal(SmallPlants))\n    print(\"Number of Medium solar plants: \", model.getVal(MediumPlants))\n    print(\"Number of Large solar plants: \", model.getVal(LargePlants))\n    print(\"Investment in advanced technology for Small plants: \", model.getVal(TechInvestmentSmall))\n    print(\"Investment in advanced technology for Medium plants: \", model.getVal(TechInvestmentMedium))\n    print(\"Investment in advanced technology for Large plants: \", model.getVal(TechInvestmentLarge))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month. Additionally, the company must decide on the number of hours to allocate for production and maintenance for each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceD\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n// Profit from DeviceA: ProfitA = (100 - 40) * UnitsA - 20 * HoursA\n// Profit from DeviceB: ProfitB = (150 - 60) * UnitsB - 30 * HoursB\n// Profit from DeviceC: ProfitC = (200 - 80) * UnitsC - 40 * HoursC\n// Profit from DeviceD: ProfitD = (250 - 100) * UnitsD - 50 * HoursD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs next month.\n// 40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10,000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for production and maintenance next month.\n// HoursA + HoursB + HoursC + HoursD <= 500",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month and the number of hours to allocate for production and maintenance for each device.\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company has a total budget of $10,000 for material costs next month and a total of 500 hours available for production and maintenance next month.\nPlease help the company to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of DeviceD\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # production hours for DeviceA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # production hours for DeviceB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # production hours for DeviceC\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # production hours for DeviceD\n\n# Define objective function\nProfitA = (100 - 40) * UnitsA - 20 * HoursA\nProfitB = (150 - 60) * UnitsB - 30 * HoursB\nProfitC = (200 - 80) * UnitsC - 40 * HoursC\nProfitD = (250 - 100) * UnitsD - 50 * HoursD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10000)\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Hours for DeviceA: \", model.getVal(HoursA))\n    print(\"Hours for DeviceB: \", model.getVal(HoursB))\n    print(\"Hours for DeviceC: \", model.getVal(HoursC))\n    print(\"Hours for DeviceD: \", model.getVal(HoursD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption\n\n## Generate Constraint-3:\nThe company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n// CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000\n\n## Generate Constraint-4:\nThe company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n// Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage\n\n## Generate Constraint-5:\nThe number of solar panels must not exceed the number of available suitable roof spaces.\n// Solar <= NumberOfSuitableRoofSpaces",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption. The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems. The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems. The number of solar panels must not exceed the number of available suitable roof spaces. Please help the company to minimize the total energy cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # efficiency of solar panels\nWindEfficiency = 0.3  # efficiency of wind turbines\nTotalEnergyDemand = 10000  # total energy demand of the company\nPricePerKWh = 0.15  # price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**-1) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 400  # average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n## The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\nCostOfSolarPanel = 1000  # cost of a solar panel\nCostOfWindTurbine = 2000  # cost of a wind turbine\nCostOfStorage = 100  # cost of storage per kWh\nmodel.addCons(CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000)\n## The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\nmodel.addCons(Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage)\n## The number of solar panels must not exceed the number of available suitable roof spaces.\nNumberOfSuitableRoofSpaces = 50  # number of suitable roof spaces\nmodel.addCons(Solar <= NumberOfSuitableRoofSpaces)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Total Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency rate based on the number of trucks allocated. The efficiency rate is defined as the number of packages delivered per hour. \nOn route 1, each truck delivers 100 packages per hour. \nOn route 2, each truck delivers 120 packages per hour. \nOn route 3, each truck delivers 150 packages per hour. \nOn route 4, each truck delivers 130 packages per hour. \nOn route 5, each truck delivers 110 packages per hour. \nThe company aims to maximize the total number of packages delivered per hour across all routes.\n// The total delivery rate for route 1: R1 = 100 * T1\n// The total delivery rate for route 2: R2 = 120 * T2\n// The total delivery rate for route 3: R3 = 150 * T3\n// The total delivery rate for route 4: R4 = 130 * T4\n// The total delivery rate for route 5: R5 = 110 * T5\n// So, the objective function is: Maximize (R1 + R2 + R3 + R4 + R5)\n// Maximize (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 25 trucks.\n// T1 <= 25; T2 <= 25; T3 <= 25; T4 <= 25; T5 <= 25",
        "question": "A logistics company operates 5 different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. The efficiency rate of each route, defined as the number of packages delivered per hour, varies as shown in the following Table.\n\n| Route | Efficiency Rate (Packages per Hour) |\n|-------|-------------------------------------|\n| 1     | 100                                 |\n| 2     | 120                                 |\n| 3     | 150                                 |\n| 4     | 130                                 |\n| 5     | 110                                 |\n\nThe company aims to maximize the total number of packages delivered per hour across all routes. The company has a total of 100 trucks available and each route can handle a maximum of 25 trucks.\n\nPlease help the company to maximize the total number of packages delivered per hour by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nR1 = 100 * T1\nR2 = 120 * T2\nR3 = 150 * T3\nR4 = 130 * T4\nR5 = 110 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3 + R4 + R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 <= 25)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 25)\nmodel.addCons(T4 <= 25)\nmodel.addCons(T5 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Delivery Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company wants to minimize the total operational cost per ton-kilometer.\n// Operational cost for TruckA: Cost_TruckA = (0.5 + 0.3) * TruckANum\n// Operational cost for TruckB: Cost_TruckB = (0.6 + 0.4) * TruckBNum\n// Operational cost for TruckC: Cost_TruckC = (0.7 + 0.5) * TruckCNum\n// Operational cost for TruckD: Cost_TruckD = (0.8 + 0.6) * TruckDNum\n// Operational cost for TruckE: Cost_TruckE = (0.9 + 0.7) * TruckENum\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// 10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50\n\n## Generate Constraint-3:\nThe total capacity of all trucks must exceed 1000 tons.\n// 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum >= 1000\n\n## Generate Constraint-4:\nDue to environmental regulations, the total fuel consumption must not exceed 5000 liters per day.\n// 0.5 * TruckANum + 0.6 * TruckBNum + 0.7 * TruckCNum + 0.8 * TruckDNum + 0.9 * TruckENum <= 5000\n\n## Generate Constraint-5:\nThe company wants to ensure that each type of truck is represented in the fleet.\n// TruckANum >= 1; TruckBNum >= 1; TruckCNum >= 1; TruckDNum >= 1; TruckENum >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company has a total budget of $100,000 for purchasing trucks. The company has a total of 50 drivers available. The total capacity of all trucks must exceed 1000 tons. Due to environmental regulations, the total fuel consumption must not exceed 5000 liters per day. The company wants to ensure that each type of truck is represented in the fleet.\nPlease help the company to minimize the total operational cost per ton-kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (0.5 + 0.3) * TruckANum\nCost_TruckB = (0.6 + 0.4) * TruckBNum\nCost_TruckC = (0.7 + 0.5) * TruckCNum\nCost_TruckD = (0.8 + 0.6) * TruckDNum\nCost_TruckE = (0.9 + 0.7) * TruckENum\nCapacity = 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000)\n## The company has a total of 50 drivers available.\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\n## The total capacity of all trucks must exceed 1000 tons.\nmodel.addCons(10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum >= 1000)\n## Due to environmental regulations, the total fuel consumption must not exceed 5000 liters per day.\nmodel.addCons(0.5 * TruckANum + 0.6 * TruckBNum + 0.7 * TruckCNum + 0.8 * TruckDNum + 0.9 * TruckENum <= 5000)\n## The company wants to ensure that each type of truck is represented in the fleet.\nmodel.addCons(TruckANum >= 1)\nmodel.addCons(TruckBNum >= 1)\nmodel.addCons(TruckCNum >= 1)\nmodel.addCons(TruckDNum >= 1)\nmodel.addCons(TruckENum >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Minimized Operational Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1380,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported.\n// Revenue_A = 1000 * TrucksA * TripsA\n// Revenue_B = 1500 * TrucksB * TripsB\n// Revenue_C = 2000 * TrucksC * TripsC\n// Cost_A = 200 * TrucksA * TripsA\n// Cost_B = 300 * TrucksB * TripsB\n// Cost_C = 400 * TrucksC * TripsC\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total number of trips per day across all goods must not exceed 100.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints. The revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported. The company has a total of 50 trucks available. The total number of trips per day across all goods must not exceed 100. Please help the company to determine the optimal allocation of trucks and trips to maximize the net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Good A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Good B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Good C\n\n# Define objective function\nRevenue_A = 1000 * TrucksA * TripsA\nRevenue_B = 1500 * TrucksB * TripsB\nRevenue_C = 2000 * TrucksC * TripsC\nCost_A = 200 * TrucksA * TripsA\nCost_B = 300 * TrucksB * TripsB\nCost_C = 400 * TrucksC * TripsC\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The total number of trips per day across all goods must not exceed 100.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Good A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Good B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Good C: \", model.getVal(TripsC))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also considers investing in fuel-efficient technologies for each type of truck.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for City1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for City5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from the trips. The profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $120, and to City5 is $180. The investment in fuel-efficient technology reduces the fuel cost per trip by $5 for every $100 invested. The company wants to maximize the total profit from all trips.\n// Profit_City1 = (100 - 0.05 * Tech1) * Trips1\n// Profit_City2 = (150 - 0.05 * Tech2) * Trips2\n// Profit_City3 = (200 - 0.05 * Tech3) * Trips3\n// Profit_City4 = (120 - 0.05 * Tech4) * Trips4\n// Profit_City5 = (180 - 0.05 * Tech5) * Trips5\n// So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The operational cost per trip to City1 is $30, to City2 is $40, to City3 is $50, to City4 is $35, and to City5 is $45.\n// 30 * Trips1 + 40 * Trips2 + 50 * Trips3 + 35 * Trips4 + 45 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000\n\n## Generate Constraint-2:\nThe company has a limited number of trucks available for trips, totaling 500 trips across all destinations.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also considers investing in fuel-efficient technologies for each type of truck. The profit per trip and the operational cost per trip for each destination are given in the following Table.\n\n| Destination | Profit per Trip | Operational Cost per Trip |\n|-------------|-----------------|---------------------------|\n| City1       | $100            | $30                       |\n| City2       | $150            | $40                       |\n| City3       | $200            | $50                       |\n| City4       | $120            | $35                       |\n| City5       | $180            | $45                       |\n\nThe investment in fuel-efficient technology reduces the fuel cost per trip by $5 for every $100 invested. The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The company has a limited number of trucks available for trips, totaling 500 trips across all destinations.\n\nPlease help the company to maximize its profit from the trips by determining the optimal number of trips to each city and the investment in fuel-efficient technology for each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for City1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for City2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for City3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for City4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for City5\n\n# Define objective function\nProfit_City1 = (100 - 0.05 * Tech1) * Trips1\nProfit_City2 = (150 - 0.05 * Tech2) * Trips2\nProfit_City3 = (200 - 0.05 * Tech3) * Trips3\nProfit_City4 = (120 - 0.05 * Tech4) * Trips4\nProfit_City5 = (180 - 0.05 * Tech5) * Trips5\n# So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n# Add constraints\n# The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(30 * Trips1 + 40 * Trips2 + 50 * Trips3 + 35 * Trips4 + 45 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n# The company has a limited number of trucks available for trips, totaling 500 trips across all destinations.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Number of Trips to City4: \", model.getVal(Trips4))\n    print(\"Number of Trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in Tech for City1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for City2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for City3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for City4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for City5: \", model.getVal(Tech5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Residential\": \"TechUpgradeResidential\", \"range\": \"TechUpgradeResidential >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Commercial\": \"TechUpgradeCommercial\", \"range\": \"TechUpgradeCommercial >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Industrial\": \"TechUpgradeIndustrial\", \"range\": \"TechUpgradeIndustrial >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output efficiency of solar panels increases with technology upgrades. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. The company aims to maximize the total energy output from all farms.\n// EnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\n// EnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\n// EnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n// So, the objective function is: Maximize (EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The company aims to maximize the total energy output from all farms.\n\n| Farm Type       | Initial Energy Output per Panel |\n|-----------------|---------------------------------|\n| Residential     | 200 kWh                         |\n| Commercial      | 300 kWh                         |\n| Industrial      | 400 kWh                         |\n\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades. Please help the company determine the optimal number of solar panels and technology upgrades for each type of farm to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nTechUpgradeResidential = model.addVar(name=\"TechUpgradeResidential\", lb=0)\nTechUpgradeCommercial = model.addVar(name=\"TechUpgradeCommercial\", lb=0)\nTechUpgradeIndustrial = model.addVar(name=\"TechUpgradeIndustrial\", lb=0)\n\n# Define objective function\nEnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\nEnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\nEnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Technology Upgrade for Residential: \", model.getVal(TechUpgradeResidential))\n    print(\"Technology Upgrade for Commercial: \", model.getVal(TechUpgradeCommercial))\n    print(\"Technology Upgrade for Industrial: \", model.getVal(TechUpgradeIndustrial))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region to optimize fuel efficiency and reduce operational costs. Additionally, the company is considering investing in hybrid technology for some of its trucks to further enhance fuel efficiency.\n// {\"number of trucks allocated to Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Region1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks increases with the investment in hybrid technology. For every $1000 invested in hybrid technology, the fuel efficiency of a truck improves by 1%. The company aims to minimize the total fuel consumption across all regions.\nThe fuel consumption of a non-hybrid truck in Region1 is 100 liters per 1000 km, in Region2 is 120 liters per 1000 km, and in Region3 is 110 liters per 1000 km.\n// Fuel consumption for Region1: Consumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\n// Fuel consumption for Region2: Consumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\n// Fuel consumption for Region3: Consumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to Region1 and 150 trucks to Region2.\n// Trucks1 >= 100; Trucks2 >= 150\n\n## Generate Constraint-4:\nThe investment in hybrid technology for each region cannot exceed 20% of the total budget allocated to that region.\n// Hybrid1 <= 0.2 * (Trucks1 + Hybrid1); Hybrid2 <= 0.2 * (Trucks2 + Hybrid2); Hybrid3 <= 0.2 * (Trucks3 + Hybrid3)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the investment in hybrid technology for each region to optimize fuel efficiency and reduce operational costs. The fuel consumption of a non-hybrid truck in each region is given in the following Table.\n\n| Region | Fuel Consumption (liters per 1000 km) |\n|--------|--------------------------------------|\n| Region1 | 100                                 |\n| Region2 | 120                                 |\n| Region3 | 110                                 |\n\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to Region1 and 150 trucks to Region2. The investment in hybrid technology for each region cannot exceed 20% of the total budget allocated to that region. \n\nPlease help the company to minimize the total fuel consumption across all regions, considering that for every $1000 invested in hybrid technology, the fuel efficiency of a truck improves by 1%.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=100)  # number of trucks allocated to Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=150)  # number of trucks allocated to Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)     # number of trucks allocated to Region3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0) # investment in hybrid technology for Region1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0) # investment in hybrid technology for Region2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0) # investment in hybrid technology for Region3\n\n# Define objective function\nConsumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\nConsumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\nConsumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)  # Total budget constraint\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)  # Total trucks constraint\nmodel.addCons(Trucks1 >= 100)  # Minimum trucks for Region1\nmodel.addCons(Trucks2 >= 150)  # Minimum trucks for Region2\nmodel.addCons(Hybrid1 <= 0.2 * (Trucks1 + Hybrid1))  # Hybrid investment constraint for Region1\nmodel.addCons(Hybrid2 <= 0.2 * (Trucks2 + Hybrid2))  # Hybrid investment constraint for Region2\nmodel.addCons(Hybrid3 <= 0.2 * (Trucks3 + Hybrid3))  # Hybrid investment constraint for Region3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Hybrid for Region1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid for Region2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid for Region3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. The company needs to determine the number of each type of truck to maximize its profit while considering operational constraints.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the revenue per trip is $1000, and the operational cost per trip is $500.\nFor TruckB, the revenue per trip is $1500, and the operational cost per trip is $700.\nFor TruckC, the revenue per trip is $2000, and the operational cost per trip is $1000.\nFor TruckD, the revenue per trip is $1200, and the operational cost per trip is $600.\nFor TruckE, the revenue per trip is $1800, and the operational cost per trip is $900.\nThe company wants to maximize the total net profit from all trucks.\n// Total net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckANum\n// Total net profit for TruckB: Profit_TruckB = (1500 - 700) * TruckBNum\n// Total net profit for TruckC: Profit_TruckC = (2000 - 1000) * TruckCNum\n// Total net profit for TruckD: Profit_TruckD = (1200 - 600) * TruckDNum\n// Total net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckENum\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckANum <= 2 * TruckBNum\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for operational costs per day.\n// 500 * TruckANum + 700 * TruckBNum + 1000 * TruckCNum + 600 * TruckDNum + 900 * TruckENum <= 30,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. The company needs to determine the number of each type of truck to maximize its profit while considering operational constraints. The revenue per trip and the operational cost per trip for each truck are given in the following Table.\n\n| Truck Type | Revenue per Trip | Operational Cost per Trip |\n|------------|------------------|---------------------------|\n| TruckA     | $1000            | $500                      |\n| TruckB     | $1500            | $700                      |\n| TruckC     | $2000            | $1000                     |\n| TruckD     | $1200            | $600                      |\n| TruckE     | $1800            | $900                      |\n\nThe company has a total of 50 trucks available. Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB. The company has a budget of $30,000 for operational costs per day.\nPlease help the company to maximize the total net profit from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\nProfit_TruckA = (1000 - 500) * TruckANum\nProfit_TruckB = (1500 - 700) * TruckBNum\nProfit_TruckC = (2000 - 1000) * TruckCNum\nProfit_TruckD = (1200 - 600) * TruckDNum\nProfit_TruckE = (1800 - 900) * TruckENum\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\nmodel.addCons(TruckANum <= 2 * TruckBNum)\nmodel.addCons(500 * TruckANum + 700 * TruckBNum + 1000 * TruckCNum + 600 * TruckDNum + 900 * TruckENum <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost.\n// Cost_1 = 1000 * T1; Cost_2 = 1200 * T2; Cost_3 = 1500 * T3; Cost_4 = 1300 * T4; Cost_5 = 1400 * T5\n// Revenue_1 = 1800 * T1; Revenue_2 = 2000 * T2; Revenue_3 = 2200 * T3; Revenue_4 = 2100 * T4; Revenue_5 = 2300 * T5\n// Net_Profit_1 = Revenue_1 - Cost_1; Net_Profit_2 = Revenue_2 - Cost_2; Net_Profit_3 = Revenue_3 - Cost_3; Net_Profit_4 = Revenue_4 - Cost_4; Net_Profit_5 = Revenue_5 - Cost_5\n// So, the objective function is: Maximize (Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15\n\n## Generate Constraint-3:\nThe company aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 at least 10 trucks, route 3 at least 15 trucks, route 4 at least 5 trucks, and route 5 at least 3 trucks.\n// T1 >= 5; T2 >= 10; T3 >= 15; T4 >= 5; T5 >= 3",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks. The company aims to maintain a minimum service level on each route: Route 1 requires at least 5 trucks, route 2 at least 10 trucks, route 3 at least 15 trucks, route 4 at least 5 trucks, and route 5 at least 3 trucks. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost. Please help the company determine the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=3, ub=15) # number of trucks on route 5\n\n# Define objective function\nCost_1 = 1000 * T1\nCost_2 = 1200 * T2\nCost_3 = 1500 * T3\nCost_4 = 1300 * T4\nCost_5 = 1400 * T5\nRevenue_1 = 1800 * T1\nRevenue_2 = 2000 * T2\nRevenue_3 = 2200 * T3\nRevenue_4 = 2100 * T4\nRevenue_5 = 2300 * T5\nNet_Profit_1 = Revenue_1 - Cost_1\nNet_Profit_2 = Revenue_2 - Cost_2\nNet_Profit_3 = Revenue_3 - Cost_3\nNet_Profit_4 = Revenue_4 - Cost_4\nNet_Profit_5 = Revenue_5 - Cost_5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost for Trucks is $100 per day, for Vans is $70 per day, and for Bikes is $30 per day. The delivery efficiency (measured in deliveries per day) for Trucks is 10, for Vans is 15, and for Bikes is 20. The company aims to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n// Efficiency_Trucks = 10 * Trucks / 100\n// Efficiency_Vans = 15 * Vans / 70\n// Efficiency_Bikes = 20 * Bikes / 30\n// So, the objective function is: Maximize (Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $3000 per day for fuel and maintenance costs.\n// 100 * Trucks + 70 * Vans + 30 * Bikes <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// Trucks <= Vans + Bikes\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of vehicles does not exceed 60.\n// Trucks + Vans + Bikes <= 60\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Bikes is at least half the number of Vans.\n// Bikes >= 0.5 * Vans",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost, as well as the delivery efficiency for each vehicle type, are given in the following Table.\n\n| Vehicle Type | Fuel & Maintenance Cost per Day | Delivery Efficiency (deliveries per day) |\n|--------------|--------------------------------|-----------------------------------------|\n| Trucks       | $100                           | 10                                      |\n| Vans         | $70                            | 15                                      |\n| Bikes        | $30                            | 20                                      |\n\nThe company has a budget of $3000 per day for fuel and maintenance costs. The company has a total of 50 drivers available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company also wants to ensure that the total number of vehicles does not exceed 60. Additionally, the company wants to ensure that the number of Bikes is at least half the number of Vans.\n\nPlease help the company to maximize the delivery efficiency per dollar spent on fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Trucks = 10 * Trucks / 100\nEfficiency_Vans = 15 * Vans / 70\nEfficiency_Bikes = 20 * Bikes / 30\n## the objective function is: Maximize (Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_Trucks + Efficiency_Vans + Efficiency_Bikes)\n\n# Add constraints\n## The company has a budget of $3000 per day for fuel and maintenance costs.\nmodel.addCons(100 * Trucks + 70 * Vans + 30 * Bikes <= 3000)\n## The company has a total of 50 drivers available.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(Trucks <= Vans + Bikes)\n## The company wants to ensure that the total number of vehicles does not exceed 60.\nmodel.addCons(Trucks + Vans + Bikes <= 60)\n## The company wants to ensure that the number of Bikes is at least half the number of Vans.\nmodel.addCons(Bikes >= 0.5 * Vans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Delivery Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1399,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods depends on the distance and the number of trucks used. The cost function is nonlinear and includes a quadratic term reflecting increased operational complexity with more trucks.\n// The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n// Objective: Minimize C\n// Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\n// T1 >= 15; T2 >= 15; T3 >= 15; T4 >= 15; T5 >= 15; T6 >= 15",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands. The cost of transporting goods depends on the distance and the number of trucks used, with a cost function that includes a quadratic term reflecting increased operational complexity with more trucks. The total number of trucks available across all warehouses is 100. Each warehouse can handle a maximum of 20 trucks. The company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\n\nPlease help the company to minimize the total transportation cost, which is given by the function: 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6), where T1, T2, T3, T4, T5, and T6 are the number of trucks at each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=15, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=15, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=15, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=15, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=15, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n# The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n# Objective: Minimize C\n# Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1000 * (T1**2 + T2**2 + T3**2 + T4**2 + T5**2 + T6**2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Add constraints\n# The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Each warehouse can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# The company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\nmodel.addCons(T1 >= 15)\nmodel.addCons(T2 >= 15)\nmodel.addCons(T3 >= 15)\nmodel.addCons(T4 >= 15)\nmodel.addCons(T5 >= 15)\nmodel.addCons(T6 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * Q1 = 20 * Q1\n// Profit_P2 = (40 - 20) * Q2 = 20 * Q2\n// Profit_P3 = (50 - 30) * Q3 = 20 * Q3\n// The objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company has a limited budget of $5000 for production costs.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * Q1\nProfit_P2 = 20 * Q2\nProfit_P3 = 20 * Q3\n## the objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 458,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints.\n// {\"number of solar units\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar unit is $5000 with an annual maintenance cost of $500, and it generates 10 MWh of energy per year.\nThe cost of installing each wind unit is $8000 with an annual maintenance cost of $800, and it generates 15 MWh of energy per year.\nThe cost of installing each hydro unit is $10000 with an annual maintenance cost of $1000, and it generates 20 MWh of energy per year.\nThe cost of installing each geothermal unit is $12000 with an annual maintenance cost of $1200, and it generates 25 MWh of energy per year.\nThe cost of installing each biomass unit is $6000 with an annual maintenance cost of $600, and it generates 12 MWh of energy per year.\nThe company wants to minimize the total cost of installation and maintenance.\n// Total installation cost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n// Total annual maintenance cost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n// So, the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for installation.\n// 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000\n\n## Generate Constraint-2:\nThe company needs to generate at least 1000 MWh of energy per year.\n// 10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000",
        "question": "A company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints. The cost of installation, annual maintenance cost, and energy generation for each system are given in the following Table.\n\n| System       | Installation Cost | Annual Maintenance Cost | Energy Generation (MWh/year) |\n|--------------|-------------------|-------------------------|------------------------------|\n| Solar        | $5000             | $500                    | 10                           |\n| Wind         | $8000             | $800                    | 15                           |\n| Hydro        | $10000            | $1000                   | 20                           |\n| Geothermal   | $12000            | $1200                   | 25                           |\n| Biomass      | $6000             | $600                    | 12                           |\n\nThe company has a budget of $200,000 for installation. The company needs to generate at least 1000 MWh of energy per year. Please help the company to minimize the total cost of installation and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar units\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind units\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro units\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal units\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass units\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total installation cost\nTotalInstallationCost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n## Total annual maintenance cost\nTotalAnnualMaintenanceCost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n## the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\nmodel.addCons(obj == TotalInstallationCost + TotalAnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $200,000 for installation.\nmodel.addCons(5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000)\n## The company needs to generate at least 1000 MWh of energy per year.\nmodel.addCons(10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(Solar))\n    print(\"Number of Wind Units: \", model.getVal(Wind))\n    print(\"Number of Hydro Units: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Units: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Units: \", model.getVal(Biomass))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each truck on Route A\": \"Distance_A\", \"range\": \"Distance_A >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route B\": \"Distance_B\", \"range\": \"Distance_B >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route C\": \"Distance_C\", \"range\": \"Distance_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = Trucks_A * Distance_A^2\n// Fuel_Consumption_B = Trucks_B * Distance_B^2\n// Fuel_Consumption_C = Trucks_C * Distance_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for all routes.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total distance traveled by all trucks should not exceed 10,000 kilometers.\n// Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the total available trucks are assigned to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C)\n\n## Generate Constraint-4:\nThe distance traveled by each truck on Route B must be at least 50% more than the distance traveled on Route A.\n// Distance_B >= 1.5 * Distance_A\n\n## Generate Constraint-5:\nThe total fuel consumption on Route C should not exceed the combined fuel consumption of Routes A and B.\n// Fuel_Consumption_C <= Fuel_Consumption_A + Fuel_Consumption_B",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n\n| Route | Number of Trucks | Distance Traveled |\n|-------|------------------|-------------------|\n| A     | Trucks_A         | Distance_A        |\n| B     | Trucks_B         | Distance_B        |\n| C     | Trucks_C         | Distance_C        |\n\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total of 50 trucks available for all routes. The total distance traveled by all trucks should not exceed 10,000 kilometers. The company must ensure that at least 10% of the total available trucks are assigned to Route A. The distance traveled by each truck on Route B must be at least 50% more than the distance traveled on Route A. The total fuel consumption on Route C should not exceed the combined fuel consumption of Routes A and B.\n\nPlease help the company to determine the optimal number of trucks and distances for each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)\nDistance_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_A\", lb=0)\nDistance_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_B\", lb=0)\nDistance_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_C\", lb=0)\n\n# Define objective function\nFuel_Consumption_A = Trucks_A * Distance_A**2\nFuel_Consumption_B = Trucks_B * Distance_B**2\nFuel_Consumption_C = Trucks_C * Distance_C**2\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\nmodel.addCons(Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000)\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C))\nmodel.addCons(Distance_B >= 1.5 * Distance_A)\nmodel.addCons(Fuel_Consumption_C <= Fuel_Consumption_A + Fuel_Consumption_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Distance on Route A: \", model.getVal(Distance_A))\n    print(\"Distance on Route B: \", model.getVal(Distance_B))\n    print(\"Distance on Route C: \", model.getVal(Distance_C))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1469,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of production per unit of ProductA is $30, ProductB is $40, and ProductC is $35. The fixed operational cost per shift is $1000. The company aims to maximize the net profit per day.\n// Revenue_ProductA = ProductAQty * 50\n// Revenue_ProductB = ProductBQty * 70\n// Revenue_ProductC = ProductCQty * 60\n// Cost_ProductA = ProductAQty * 30\n// Cost_ProductB = ProductBQty * 40\n// Cost_ProductC = ProductCQty * 35\n// FixedCost = NumShifts * 1000\n// NetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n// So, the objective function is: Maximize (NetProfit)\n\n## Generate Constraint-1:\nThe company has a daily production capacity of 1000 units in total.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe total number of shifts cannot exceed 5 due to labor regulations.\n// NumShifts <= 5\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement for each product: ProductA must produce at least 100 units, ProductB at least 150 units, and ProductC at least 200 units.\n// ProductAQty >= 100\n// ProductBQty >= 150\n// ProductCQty >= 200\n\n## Generate Constraint-4:\nThe company must maintain a production ratio of 1:2:1 for ProductA, ProductB, and ProductC respectively.\n// ProductBQty >= 2 * (ProductAQty + ProductCQty)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product. The revenue and cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost per Unit |\n|---------|------------------|---------------|\n| ProductA | $50             | $30           |\n| ProductB | $70             | $40           |\n| ProductC | $60             | $35           |\n\nThe fixed operational cost per shift is $1000. The company has a daily production capacity of 1000 units in total. The total number of shifts cannot exceed 5 due to labor regulations. The company has a minimum daily production requirement for each product: ProductA must produce at least 100 units, ProductB at least 150 units, and ProductC at least 200 units. The company must maintain a production ratio of 1:2:1 for ProductA, ProductB, and ProductC respectively.\n\nPlease help the company to maximize the net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0)  # number of shifts\n\n# Set minimum production requirements\nmodel.addCons(ProductAQty >= 100)\nmodel.addCons(ProductBQty >= 150)\nmodel.addCons(ProductCQty >= 200)\n\n# Define objective function\nRevenue_ProductA = ProductAQty * 50\nRevenue_ProductB = ProductBQty * 70\nRevenue_ProductC = ProductCQty * 60\nCost_ProductA = ProductAQty * 30\nCost_ProductB = ProductBQty * 40\nCost_ProductC = ProductCQty * 35\nFixedCost = NumShifts * 1000\nNetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)  # daily production capacity\nmodel.addCons(NumShifts <= 5)  # maximum number of shifts\nmodel.addCons(ProductBQty >= 2 * (ProductAQty + ProductCQty))  # production ratio constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n// Cost_A = (100 - 5 * Automation) * A\n// Cost_B = (150 - 5 * Automation) * B\n// Cost_C = (200 - 5 * Automation) * C\n// Revenue_A = 150 * A\n// Revenue_B = 200 * B\n// Revenue_C = 250 * C\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for implementing automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// A + B + C <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 500 units.\n// A >= 500\n\n## Generate Constraint-4:\nThe company must ensure that the production of ProductB does not exceed 800 units.\n// B <= 800\n\n## Generate Constraint-5:\nThe level of automation must be at least 200 units to start the automation process.\n// Automation >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost and revenue for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| ProductA | $100 - $5 * Automation | $150 |\n| ProductB | $150 - $5 * Automation | $200 |\n| ProductC | $200 - $5 * Automation | $250 |\n\nThe company has a budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units. The market demand for ProductA is at least 500 units. The company must ensure that the production of ProductB does not exceed 800 units. The level of automation must be at least 200 units to start the automation process.\n\nPlease help the company to maximize its net profit, which is calculated as the sum of the revenues minus the sum of the costs for all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=200) # level of automation\n\n# Define objective function\nCost_A = (100 - 5 * Automation) * A\nCost_B = (150 - 5 * Automation) * B\nCost_C = (200 - 5 * Automation) * C\nRevenue_A = 150 * A\nRevenue_B = 200 * B\nRevenue_C = 250 * C\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\nmodel.addCons(A + B + C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company needs to decide on the optimal speed for each truck type to minimize fuel consumption per kilometer.\n// {\"number of small truck trips\": \"TripsS\", \"range\": \"TripsS >= 0\", \"type\": \"integer\"}\n// {\"number of medium truck trips\": \"TripsM\", \"range\": \"TripsM >= 0\", \"type\": \"integer\"}\n// {\"number of large truck trips\": \"TripsL\", \"range\": \"TripsL >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for small trucks (km/h)\": \"SpeedS\", \"range\": \"SpeedS >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for medium trucks (km/h)\": \"SpeedM\", \"range\": \"SpeedM >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for large trucks (km/h)\": \"SpeedL\", \"range\": \"SpeedL >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip for each truck type is affected by the speed at which the trucks travel. The faster the trucks travel, the more trips they can make, but the fuel consumption per kilometer increases nonlinearly. The profit per trip for small trucks is $1000 - 0.1 * SpeedS^2, for medium trucks is $1500 - 0.15 * SpeedM^2, and for large trucks is $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types.\n// Total profit for small trucks: ProfitS = (1000 - 0.1 * SpeedS^2) * TripsS\n// Total profit for medium trucks: ProfitM = (1500 - 0.15 * SpeedM^2) * TripsM\n// Total profit for large trucks: ProfitL = (2000 - 0.2 * SpeedL^2) * TripsL\n// So, the objective function is: Maximize (ProfitS + ProfitM + ProfitL)\n\n## Generate Constraint-1:\nThe total number of trips across all truck types must not exceed 500.\n// TripsS + TripsM + TripsL <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance. The fuel cost per kilometer for small trucks is 0.1 * SpeedS, for medium trucks is 0.15 * SpeedM, and for large trucks is 0.2 * SpeedL. The maintenance cost per trip is $50 for small trucks, $75 for medium trucks, and $100 for large trucks.\n// (0.1 * SpeedS * TripsS + 50 * TripsS) + (0.15 * SpeedM * TripsM + 75 * TripsM) + (0.2 * SpeedL * TripsL + 100 * TripsL) <= 100000\n\n## Generate Constraint-3:\nDue to driver availability, the total number of trips for small and medium trucks must not exceed 300.\n// TripsS + TripsM <= 300\n\n## Generate Constraint-4:\nThe optimal speed for each truck type must be within the legal speed limit: 60 km/h for small trucks, 80 km/h for medium trucks, and 100 km/h for large trucks.\n// SpeedS <= 60; SpeedM <= 80; SpeedL <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) and the optimal speed for each truck type to maximize profit while considering the cost of fuel, maintenance, and driver wages. The profit per trip for small trucks is $1000 - 0.1 * SpeedS^2, for medium trucks is $1500 - 0.15 * SpeedM^2, and for large trucks is $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types. The total number of trips across all truck types must not exceed 500. The company has a budget of $100,000 for fuel and maintenance. Due to driver availability, the total number of trips for small and medium trucks must not exceed 300. The optimal speed for each truck type must be within the legal speed limit: 60 km/h for small trucks, 80 km/h for medium trucks, and 100 km/h for large trucks. Please help the company to determine the optimal number of trips and speeds for each truck type to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsS = model.addVar(vtype=\"INTEGER\", name=\"TripsS\", lb=0) # number of small truck trips\nTripsM = model.addVar(vtype=\"INTEGER\", name=\"TripsM\", lb=0) # number of medium truck trips\nTripsL = model.addVar(vtype=\"INTEGER\", name=\"TripsL\", lb=0) # number of large truck trips\nSpeedS = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedS\", lb=0) # optimal speed for small trucks\nSpeedM = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedM\", lb=0) # optimal speed for medium trucks\nSpeedL = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedL\", lb=0) # optimal speed for large trucks\n\n# Define objective function\n## The profit per trip for each truck type is affected by the speed at which the trucks travel.\nProfitS = (1000 - 0.1 * SpeedS**2) * TripsS\nProfitM = (1500 - 0.15 * SpeedM**2) * TripsM\nProfitL = (2000 - 0.2 * SpeedL**2) * TripsL\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitS + ProfitM + ProfitL)\nmodel.addCons(obj == ProfitS + ProfitM + ProfitL)\n\n# Add constraints\n## The total number of trips across all truck types must not exceed 500.\nmodel.addCons(TripsS + TripsM + TripsL <= 500)\n## The company has a budget of $100,000 for fuel and maintenance.\nmodel.addCons((0.1 * SpeedS * TripsS + 50 * TripsS) + (0.15 * SpeedM * TripsM + 75 * TripsM) + (0.2 * SpeedL * TripsL + 100 * TripsL) <= 100000)\n## Due to driver availability, the total number of trips for small and medium trucks must not exceed 300.\nmodel.addCons(TripsS + TripsM <= 300)\n## The optimal speed for each truck type must be within the legal speed limit.\nmodel.addCons(SpeedS <= 60)\nmodel.addCons(SpeedM <= 80)\nmodel.addCons(SpeedL <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Truck Trips: \", model.getVal(TripsS))\n    print(\"Number of Medium Truck Trips: \", model.getVal(TripsM))\n    print(\"Number of Large Truck Trips: \", model.getVal(TripsL))\n    print(\"Optimal Speed for Small Trucks: \", model.getVal(SpeedS))\n    print(\"Optimal Speed for Medium Trucks: \", model.getVal(SpeedM))\n    print(\"Optimal Speed for Large Trucks: \", model.getVal(SpeedL))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate, load capacity, and emission rate. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Load Capacity (tons) | Emission Rate (kg CO2/km) |\n|------------|-----------------------------------|----------------------|---------------------------|\n| T1         | 0.5                               | 10                   | 1.2                       |\n| T2         | 0.6                               | 15                   | 1.4                       |\n| T3         | 0.7                               | 20                   | 1.6                       |\n| T4         | 0.8                               | 25                   | 1.8                       |\n| T5         | 0.9                               | 30                   | 2.0                       |\n\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter. The company has a total of 100 trucks available. The company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n\nPlease help the company determine the optimal number of each type of truck to deploy to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1427,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Small trucks\": \"FuelSmall\", \"range\": \"FuelSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Medium trucks\": \"FuelMedium\", \"range\": \"FuelMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Large trucks\": \"FuelLarge\", \"range\": \"FuelLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Extra-Large trucks\": \"FuelExtraLarge\", \"range\": \"FuelExtraLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Hybrid trucks\": \"FuelHybrid\", \"range\": \"FuelHybrid >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel for each type of truck is different. The cost per gallon for Small trucks is $3, for Medium trucks is $4, for Large trucks is $5, for Extra-Large trucks is $6, and for Hybrid trucks is $2. The fuel efficiency of each truck also varies, with Small trucks consuming 10 gallons per 100 miles, Medium trucks consuming 15 gallons per 100 miles, Large trucks consuming 20 gallons per 100 miles, Extra-Large trucks consuming 25 gallons per 100 miles, and Hybrid trucks consuming 5 gallons per 100 miles. The company wants to minimize the total fuel cost for all deliveries.\n// FuelCostSmall = 3 * (10 * SmallTrucks * Distance / 100)\n// FuelCostMedium = 4 * (15 * MediumTrucks * Distance / 100)\n// FuelCostLarge = 5 * (20 * LargeTrucks * Distance / 100)\n// FuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * Distance / 100)\n// FuelCostHybrid = 2 * (5 * HybridTrucks * Distance / 100)\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n## Generate Constraint-1:\nThe total fuel available for all trucks is limited to 5000 gallons.\n// FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000\n\n## Generate Constraint-2:\nThe total number of trucks available for use is limited to 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck. The cost of fuel for each type of truck is different, and the fuel efficiency of each truck also varies. The company wants to minimize the total fuel cost for all deliveries. The total fuel available for all trucks is limited to 5000 gallons, and the total number of trucks available for use is limited to 100.\n\nPlease help the company to determine the optimal number of each type of truck to use and the amount of fuel to allocate to each truck to minimize the total fuel cost for all deliveries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\nFuelSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelSmall\", lb=0)\nFuelMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelMedium\", lb=0)\nFuelLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelLarge\", lb=0)\nFuelExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelExtraLarge\", lb=0)\nFuelHybrid = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelHybrid\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance\", lb=0)\nFuelCostSmall = 3 * (10 * SmallTrucks * Distance / 100)\nFuelCostMedium = 4 * (15 * MediumTrucks * Distance / 100)\nFuelCostLarge = 5 * (20 * LargeTrucks * Distance / 100)\nFuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * Distance / 100)\nFuelCostHybrid = 2 * (5 * HybridTrucks * Distance / 100)\n## the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n# Add constraints\n## The total fuel available for all trucks is limited to 5000 gallons.\nmodel.addCons(FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000)\n## The total number of trucks available for use is limited to 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Fuel Allocation for Small Trucks: \", model.getVal(FuelSmall))\n    print(\"Fuel Allocation for Medium Trucks: \", model.getVal(FuelMedium))\n    print(\"Fuel Allocation for Large Trucks: \", model.getVal(FuelLarge))\n    print(\"Fuel Allocation for Extra-Large Trucks: \", model.getVal(FuelExtraLarge))\n    print(\"Fuel Allocation for Hybrid Trucks: \", model.getVal(FuelHybrid))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutoA\", \"range\": \"AutoA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutoB\", \"range\": \"AutoB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutoC\", \"range\": \"AutoC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 5 * AutoA)) * QA\n// Total profit for ProductB: ProfitB = (180 - (120 - 5 * AutoB)) * QB\n// Total profit for ProductC: ProfitC = (200 - (150 - 5 * AutoC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation across all products.\n// AutoA * QA + AutoB * QB + AutoC * QC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// QA + QB + QC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency. The initial production cost per unit, selling price per unit, and the effect of automation on production cost for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit | Effect of Automation on Production Cost |\n|---------|----------------------------------|------------------------|----------------------------------------|\n| ProductA | $100                             | $150                   | $5 decrease per unit increase in automation |\n| ProductB | $120                             | $180                   | $5 decrease per unit increase in automation |\n| ProductC | $150                             | $200                   | $5 decrease per unit increase in automation |\n\nThe company has a total budget of $100,000 for implementing automation across all products. The total production capacity of the company is 2000 units. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities and levels of automation for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutoA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoA\", lb=0) # level of automation for ProductA\nAutoB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoB\", lb=0) # level of automation for ProductB\nAutoC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutoC\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 5 * AutoA)) * QA\nProfitB = (180 - (120 - 5 * AutoB)) * QB\nProfitC = (200 - (150 - 5 * AutoC)) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation across all products.\nmodel.addCons(AutoA * QA + AutoB * QB + AutoC * QC <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(QA + QB + QC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutoA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutoB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutoC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1397,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of vehicles to allocate for each service type and the number of trips each vehicle will make per day. The company also needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operational cost per trip.\n// {\"number of vehicles for Express\": \"ExpressVehicles\", \"range\": \"ExpressVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles for Standard\": \"StandardVehicles\", \"range\": \"StandardVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles for Economy\": \"EconomyVehicles\", \"range\": \"EconomyVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Express\": \"ExpressTripsPerVehicle\", \"range\": \"ExpressTripsPerVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Standard\": \"StandardTripsPerVehicle\", \"range\": \"StandardTripsPerVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of trips per vehicle for Economy\": \"EconomyTripsPerVehicle\", \"range\": \"EconomyTripsPerVehicle >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Express\": \"FuelUpgradeExpress\", \"range\": \"FuelUpgradeExpress >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Standard\": \"FuelUpgradeStandard\", \"range\": \"FuelUpgradeStandard >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Economy\": \"FuelUpgradeEconomy\", \"range\": \"FuelUpgradeEconomy >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Express, the initial cost per trip is $150, and with upgrades, it decreases by $5 for every $100 invested. For Standard, the initial cost per trip is $100, and it decreases by $3 for every $100 invested. For Economy, the initial cost per trip is $70, and it decreases by $2 for every $100 invested. The company aims to maximize the total daily profit from all services.\n// Profit_Express = ExpressVehicles * ExpressTripsPerVehicle * (300 - (150 - 0.05 * FuelUpgradeExpress))\n// Profit_Standard = StandardVehicles * StandardTripsPerVehicle * (200 - (100 - 0.03 * FuelUpgradeStandard))\n// Profit_Economy = EconomyVehicles * EconomyTripsPerVehicle * (150 - (70 - 0.02 * FuelUpgradeEconomy))\n// So, the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy)\n\n## Generate Constraint-1:\nThe company has a total of 30 vehicles available.\n// ExpressVehicles + StandardVehicles + EconomyVehicles <= 30\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for fuel efficiency upgrades and operational costs per day.\n// 150 * ExpressVehicles * ExpressTripsPerVehicle + 100 * StandardVehicles * StandardTripsPerVehicle + 70 * EconomyVehicles * EconomyTripsPerVehicle + FuelUpgradeExpress + FuelUpgradeStandard + FuelUpgradeEconomy <= 2000\n\n## Generate Constraint-3:\nThe company has a daily operational capacity of 200 trips in terms of the number of trips it can handle per day.\n// 6 * ExpressVehicles * ExpressTripsPerVehicle + 5 * StandardVehicles * StandardTripsPerVehicle + 4 * EconomyVehicles * EconomyTripsPerVehicle <= 200\n\n## Generate Constraint-4:\nFor Express, each vehicle can make at most 6 trips per day. For Standard, each vehicle can make at most 5 trips per day. For Economy, each vehicle can make at most 4 trips per day.\n// ExpressTripsPerVehicle <= 6; StandardTripsPerVehicle <= 5; EconomyTripsPerVehicle <= 4",
        "question": "A logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of vehicles to allocate for each service type and the number of trips each vehicle will make per day. The company also needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operational cost per trip. The operational cost per trip decreases with the investment in fuel efficiency upgrades. For Express, the initial cost per trip is $150, and with upgrades, it decreases by $5 for every $100 invested. For Standard, the initial cost per trip is $100, and it decreases by $3 for every $100 invested. For Economy, the initial cost per trip is $70, and it decreases by $2 for every $100 invested. The company aims to maximize the total daily profit from all services. The company has a total of 30 vehicles available. The company has a budget of $2000 for fuel efficiency upgrades and operational costs per day. The company has a daily operational capacity of 200 trips in terms of the number of trips it can handle per day. For Express, each vehicle can make at most 6 trips per day. For Standard, each vehicle can make at most 5 trips per day. For Economy, each vehicle can make at most 4 trips per day. Please help the company to maximize the total daily profit from all services.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nExpressVehicles = model.addVar(vtype=\"INTEGER\", name=\"ExpressVehicles\", lb=0)\nStandardVehicles = model.addVar(vtype=\"INTEGER\", name=\"StandardVehicles\", lb=0)\nEconomyVehicles = model.addVar(vtype=\"INTEGER\", name=\"EconomyVehicles\", lb=0)\nExpressTripsPerVehicle = model.addVar(vtype=\"INTEGER\", name=\"ExpressTripsPerVehicle\", lb=0)\nStandardTripsPerVehicle = model.addVar(vtype=\"INTEGER\", name=\"StandardTripsPerVehicle\", lb=0)\nEconomyTripsPerVehicle = model.addVar(vtype=\"INTEGER\", name=\"EconomyTripsPerVehicle\", lb=0)\nFuelUpgradeExpress = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeExpress\", lb=0)\nFuelUpgradeStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeStandard\", lb=0)\nFuelUpgradeEconomy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeEconomy\", lb=0)\n\n# Define objective function\nProfit_Express = ExpressVehicles * ExpressTripsPerVehicle * (300 - (150 - 0.05 * FuelUpgradeExpress))\nProfit_Standard = StandardVehicles * StandardTripsPerVehicle * (200 - (100 - 0.03 * FuelUpgradeStandard))\nProfit_Economy = EconomyVehicles * EconomyTripsPerVehicle * (150 - (70 - 0.02 * FuelUpgradeEconomy))\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Express + Profit_Standard + Profit_Economy)\n\n# Add constraints\nmodel.addCons(ExpressVehicles + StandardVehicles + EconomyVehicles <= 30)\nmodel.addCons(150 * ExpressVehicles * ExpressTripsPerVehicle + 100 * StandardVehicles * StandardTripsPerVehicle + 70 * EconomyVehicles * EconomyTripsPerVehicle + FuelUpgradeExpress + FuelUpgradeStandard + FuelUpgradeEconomy <= 2000)\nmodel.addCons(6 * ExpressVehicles * ExpressTripsPerVehicle + 5 * StandardVehicles * StandardTripsPerVehicle + 4 * EconomyVehicles * EconomyTripsPerVehicle <= 200)\nmodel.addCons(ExpressTripsPerVehicle <= 6)\nmodel.addCons(StandardTripsPerVehicle <= 5)\nmodel.addCons(EconomyTripsPerVehicle <= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Express Vehicles: \", model.getVal(ExpressVehicles))\n    print(\"Number of Standard Vehicles: \", model.getVal(StandardVehicles))\n    print(\"Number of Economy Vehicles: \", model.getVal(EconomyVehicles))\n    print(\"Number of Express Trips per Vehicle: \", model.getVal(ExpressTripsPerVehicle))\n    print(\"Number of Standard Trips per Vehicle: \", model.getVal(StandardTripsPerVehicle))\n    print(\"Number of Economy Trips per Vehicle: \", model.getVal(EconomyTripsPerVehicle))\n    print(\"Fuel Upgrade for Express: \", model.getVal(FuelUpgradeExpress))\n    print(\"Fuel Upgrade for Standard: \", model.getVal(FuelUpgradeStandard))\n    print(\"Fuel Upgrade for Economy: \", model.getVal(FuelUpgradeEconomy))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1359,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck consumes 20 liters of fuel per 100 km, each Medium truck consumes 30 liters, each Large truck consumes 40 liters, each Extra-Large truck consumes 50 liters, and each Refrigerated truck consumes 60 liters. The company aims to minimize the total fuel consumption for a specific route of 500 km. However, due to the nature of the cargo, the fuel consumption increases nonlinearly with the number of trucks. Specifically, for each type of truck, the fuel consumption per kilometer increases by 0.01 liters for every additional truck of that type.\n// Fuel_S = (20 + 0.01 * S) * 500 * S\n// Fuel_M = (30 + 0.01 * M) * 500 * M\n// Fuel_L = (40 + 0.01 * L) * 500 * L\n// Fuel_XL = (50 + 0.01 * XL) * 500 * XL\n// Fuel_R = (60 + 0.01 * R) * 500 * R\n// So, the objective function is: Minimize Fuel_S + Fuel_M + Fuel_L + Fuel_XL + Fuel_R\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 trucks.\n// S + M + L + XL + R <= 100",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting delivery requirements. The fuel consumption per 100 km for each type of truck is given in the following Table.\n\n| Truck Type       | Fuel Consumption per 100 km |\n|------------------|-----------------------------|\n| Small            | 20 liters                   |\n| Medium           | 30 liters                   |\n| Large            | 40 liters                   |\n| Extra-Large      | 50 liters                   |\n| Refrigerated     | 60 liters                   |\n\nThe company aims to minimize the total fuel consumption for a specific route of 500 km. However, due to the nature of the cargo, the fuel consumption per kilometer increases by 0.01 liters for every additional truck of that type. The company has a total fleet size of 100 trucks.\nPlease help the company to minimize the total fuel consumption for the route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_S = (20 + 0.01 * S) * 500 * S\nFuel_M = (30 + 0.01 * M) * 500 * M\nFuel_L = (40 + 0.01 * L) * 500 * L\nFuel_XL = (50 + 0.01 * XL) * 500 * XL\nFuel_R = (60 + 0.01 * R) * 500 * R\n## the objective function is: Minimize Fuel_S + Fuel_M + Fuel_L + Fuel_XL + Fuel_R\nmodel.addCons(obj == Fuel_S + Fuel_M + Fuel_L + Fuel_XL + Fuel_R)\n\n# Add constraints\n## The company has a total fleet size of 100 trucks.\nmodel.addCons(S + M + L + XL + R <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(R))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for small trucks per km\": \"FuelRateSmall\", \"range\": \"FuelRateSmall > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for medium trucks per km\": \"FuelRateMedium\", \"range\": \"FuelRateMedium > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for large trucks per km\": \"FuelRateLarge\", \"range\": \"FuelRateLarge > 0\", \"type\": \"real\"}\n// {\"distance traveled by each small truck per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each medium truck per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each large truck per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel consumption across all trucks.\n// TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000\n\n## Generate Constraint-2:\nThe total daily distance traveled by all trucks must not exceed 10,000 km.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company must ensure at least 50% of the total daily demand is met. The demand is 8000 kg, and small trucks carry 500 kg, medium trucks carry 1000 kg, and large trucks carry 1500 kg.\n// 500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency. The fuel consumption rates and the carrying capacities of each truck size are given in the following Table.\n\n| Truck Size | Fuel Consumption Rate per km | Carrying Capacity | Cost per Truck |\n|------------|------------------------------|-------------------|----------------|\n| Small      | FuelRateSmall                | 500 kg            | $20,000        |\n| Medium     | FuelRateMedium               | 1000 kg           | $30,000        |\n| Large      | FuelRateLarge                | 1500 kg           | $40,000        |\n\nThe company has a budget of $100,000 for purchasing trucks. The total daily distance traveled by all trucks must not exceed 10,000 km. The company must ensure at least 50% of the total daily demand, which is 8000 kg, is met. \n\nPlease help the company to minimize the total daily fuel consumption across all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\nFuelRateSmall = model.addVar(name=\"FuelRateSmall\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for small trucks per km\nFuelRateMedium = model.addVar(name=\"FuelRateMedium\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for medium trucks per km\nFuelRateLarge = model.addVar(name=\"FuelRateLarge\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for large trucks per km\nDistanceSmall = model.addVar(name=\"DistanceSmall\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each small truck per day\nDistanceMedium = model.addVar(name=\"DistanceMedium\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each medium truck per day\nDistanceLarge = model.addVar(name=\"DistanceLarge\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each large truck per day\n\nTotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelConsumption)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n\n# The total daily distance traveled by all trucks must not exceed 10,000 km.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 10000)\n\n# The company must ensure at least 50% of the total daily demand is met.\nmodel.addCons(500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\n// {\"number of trucks for WarehouseA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by warehouse due to different operational costs and delivery distances. \nFor WarehouseA, the operating cost per truck is $5,000, and the delivery efficiency (packages delivered per hour) is 100.\nFor WarehouseB, the operating cost per truck is $6,000, and the delivery efficiency is 120.\nFor WarehouseC, the operating cost per truck is $7,000, and the delivery efficiency is 130.\nFor WarehouseD, the operating cost per truck is $8,000, and the delivery efficiency is 140.\nFor WarehouseE, the operating cost per truck is $9,000, and the delivery efficiency is 150.\nThe company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold.\n// Total operating cost for WarehouseA: Cost_A = 5000 * TruckA\n// Total operating cost for WarehouseB: Cost_B = 6000 * TruckB\n// Total operating cost for WarehouseC: Cost_C = 7000 * TruckC\n// Total operating cost for WarehouseD: Cost_D = 8000 * TruckD\n// Total operating cost for WarehouseE: Cost_E = 9000 * TruckE\n// Total delivery efficiency: Efficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to Efficiency >= 130\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 40",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\nThe cost of operating a truck varies by warehouse due to different operational costs and delivery distances. \nFor WarehouseA, the operating cost per truck is $5,000, and the delivery efficiency (packages delivered per hour) is 100.\nFor WarehouseB, the operating cost per truck is $6,000, and the delivery efficiency is 120.\nFor WarehouseC, the operating cost per truck is $7,000, and the delivery efficiency is 130.\nFor WarehouseD, the operating cost per truck is $8,000, and the delivery efficiency is 140.\nFor WarehouseE, the operating cost per truck is $9,000, and the delivery efficiency is 150.\nThe company has a total of 40 trucks available for allocation. The company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold of 130 packages delivered per hour.\nPlease help the company to determine the optimal allocation of trucks to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for WarehouseA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for WarehouseB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for WarehouseC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for WarehouseD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for WarehouseE\n\n# Define objective function\nCost_A = 5000 * TruckA\nCost_B = 6000 * TruckB\nCost_C = 7000 * TruckC\nCost_D = 8000 * TruckD\nCost_E = 9000 * TruckE\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Define delivery efficiency\nEfficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\nmodel.addCons(Efficiency >= 130)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TruckE))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Small trucks\": \"EfficiencySmall\", \"range\": \"EfficiencySmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"EfficiencyMedium\", \"range\": \"EfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Large trucks\": \"EfficiencyLarge\", \"range\": \"EfficiencyLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Small trucks, the operational cost per mile is initially $0.50, and it decreases by $0.01 for every $100 invested in efficiency. For Medium trucks, the initial cost is $0.70, decreasing by $0.015 per $100 invested. For Large trucks, the initial cost is $0.90, decreasing by $0.02 per $100 invested. The company aims to minimize the total annual operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = 0.50 - 0.0001 * EfficiencySmall\n// Total operational cost for Medium trucks: CostMedium = 0.70 - 0.00015 * EfficiencyMedium\n// Total operational cost for Large trucks: CostLarge = 0.90 - 0.0002 * EfficiencyLarge\n// Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n// So, the objective function is: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 200\n\n## Generate Constraint-3:\nDue to market demand, the company must have at least 50 Small trucks and 30 Large trucks.\n// SmallTrucks >= 50; LargeTrucks >= 30\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck.\n// EfficiencySmall <= 0.20 * (SmallTrucks * PriceSmall)\n// EfficiencyMedium <= 0.20 * (MediumTrucks * PriceMedium)\n// EfficiencyLarge <= 0.20 * (LargeTrucks * PriceLarge)",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large, and also determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Small trucks, the operational cost per mile is initially $0.50, and it decreases by $0.01 for every $100 invested in efficiency. For Medium trucks, the initial cost is $0.70, decreasing by $0.015 per $100 invested. For Large trucks, the initial cost is $0.90, decreasing by $0.02 per $100 invested. The company aims to minimize the total annual operational cost of the fleet. The company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency. The total number of trucks cannot exceed 200. Due to market demand, the company must have at least 50 Small trucks and 30 Large trucks. The investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck. Please help the company to minimize the total annual operational cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=50)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=30)  # number of Large trucks\nEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySmall\", lb=0)  # investment in fuel efficiency for Small trucks\nEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyMedium\", lb=0)  # investment in fuel efficiency for Medium trucks\nEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyLarge\", lb=0)  # investment in fuel efficiency for Large trucks\n\n# Define objective function\nCostSmall = 0.50 - 0.0001 * EfficiencySmall  # Total operational cost for Small trucks\nCostMedium = 0.70 - 0.00015 * EfficiencyMedium  # Total operational cost for Medium trucks\nCostLarge = 0.90 - 0.0002 * EfficiencyLarge  # Total operational cost for Large trucks\n# Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n# Objective function: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000)\n# The total number of trucks cannot exceed 200.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 200)\n# Due to market demand, the company must have at least 50 Small trucks and 30 Large trucks.\nmodel.addCons(SmallTrucks >= 50)\nmodel.addCons(LargeTrucks >= 30)\n# The investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck.\nmodel.addCons(EfficiencySmall <= 0.20 * SmallTrucks)\nmodel.addCons(EfficiencyMedium <= 0.20 * MediumTrucks)\nmodel.addCons(EfficiencyLarge <= 0.20 * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel Efficiency for Small Trucks: \", model.getVal(EfficiencySmall))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(EfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Large Trucks: \", model.getVal(EfficiencyLarge))\n    print(\"Minimized Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"production quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\n// DeviceB_Quantity >= 2 * DeviceA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint of 800 units.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceC to fulfill a contractual obligation.\n// DeviceC_Quantity >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|-----------------|--------------------------|-----------------------|\n| DeviceA | $50 | $20 | $5 |\n| DeviceB | $70 | $30 | $7 |\n| DeviceC | $90 | $40 | $9 |\n\nThe company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA. The company has a storage capacity constraint of 800 units. The company must produce at least 50 units of DeviceC to fulfill a contractual obligation.\n\nPlease help the company to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0) # production quantity of DeviceA\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0) # production quantity of DeviceB\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=50) # production quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\nProfit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\nProfit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n# Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\nmodel.addCons(DeviceB_Quantity >= 2 * DeviceA_Quantity)\n# The company has a storage capacity constraint of 800 units.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for Good A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks.\n// Fuel_Consumption_A = kA * (SpeedA^2) * TrucksA * Hours_Operated\n// Fuel_Consumption_B = kB * (SpeedB^2) * TrucksB * Hours_Operated\n// Fuel_Consumption_C = kC * (SpeedC^2) * TrucksC * Hours_Operated\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel expenses.\n// kA * (SpeedA^2) * TrucksA * Hours_Operated + kB * (SpeedB^2) * TrucksB * Hours_Operated + kC * (SpeedC^2) * TrucksC * Hours_Operated <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-3:\nThe total daily delivery capacity is 1000 tons.\n// (Tons_Delivered_A / SpeedA) * TrucksA + (Tons_Delivered_B / SpeedB) * TrucksB + (Tons_Delivered_C / SpeedC) * TrucksC <= 1000\n\n## Generate Constraint-4:\nThe average speed of trucks must be within a safe operational range, between 40 and 80 km/h.\n// 40 <= SpeedA <= 80\n// 40 <= SpeedB <= 80\n// 40 <= SpeedC <= 80",
        "question": "A logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks. The company has a total budget of $10,000 per day for fuel expenses. The total number of trucks available is limited to 50. The total daily delivery capacity is 1000 tons. The average speed of trucks must be within a safe operational range, between 40 and 80 km/h.\n\nPlease help the company to determine the optimal number of trucks for each type of good and their respective average speeds to minimize the total daily fuel consumption while adhering to the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for Good C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=40, ub=80)  # average speed of trucks for Good A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=40, ub=80)  # average speed of trucks for Good B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=40, ub=80)  # average speed of trucks for Good C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nkA = 0.01  # constant for Good A\nkB = 0.02  # constant for Good B\nkC = 0.03  # constant for Good C\nHours_Operated = 10  # hours per day\nFuel_Consumption_A = kA * (SpeedA**2) * TrucksA * Hours_Operated\nFuel_Consumption_B = kB * (SpeedB**2) * TrucksB * Hours_Operated\nFuel_Consumption_C = kC * (SpeedC**2) * TrucksC * Hours_Operated\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for fuel expenses.\nmodel.addCons(kA * (SpeedA**2) * TrucksA * Hours_Operated + kB * (SpeedB**2) * TrucksB * Hours_Operated + kC * (SpeedC**2) * TrucksC * Hours_Operated <= 10000)\n## The total number of trucks available is limited to 50.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## The total daily delivery capacity is 1000 tons.\nTons_Delivered_A = 100  # tons per truck for Good A\nTons_Delivered_B = 200  # tons per truck for Good B\nTons_Delivered_C = 300  # tons per truck for Good C\nmodel.addCons((Tons_Delivered_A / SpeedA) * TrucksA + (Tons_Delivered_B / SpeedB) * TrucksB + (Tons_Delivered_C / SpeedC) * TrucksC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Average Speed of Trucks for Good A: \", model.getVal(SpeedA))\n    print(\"Average Speed of Trucks for Good B: \", model.getVal(SpeedB))\n    print(\"Average Speed of Trucks for Good C: \", model.getVal(SpeedC))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and also how much to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Small Trucks\": \"FuelTechSmall\", \"range\": \"FuelTechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Medium Trucks\": \"FuelTechMedium\", \"range\": \"FuelTechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Large Trucks\": \"FuelTechLarge\", \"range\": \"FuelTechLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the fleet operations. The profit per Small Truck is $30,000, which increases by $1,000 for every $5,000 invested in fuel-efficient technologies. The profit per Medium Truck is $40,000, which increases by $1,200 for every $5,000 invested in fuel-efficient technologies. The profit per Large Truck is $50,000, which increases by $1,500 for every $5,000 invested in fuel-efficient technologies.\n// Profit from Small Trucks: ProfitSmall = (30000 + 0.2 * FuelTechSmall) * SmallTrucks\n// Profit from Medium Trucks: ProfitMedium = (40000 + 0.24 * FuelTechMedium) * MediumTrucks\n// Profit from Large Trucks: ProfitLarge = (50000 + 0.3 * FuelTechLarge) * LargeTrucks\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and investing in fuel-efficient technologies.\n// Cost of Small Trucks + Cost of Medium Trucks + Cost of Large Trucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000\n// Assuming the cost of a Small Truck is $50,000, a Medium Truck is $70,000, and a Large Truck is $100,000.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 100000 * LargeTrucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50\n\n## Generate Constraint-3:\nAt least 10 Medium Trucks must be purchased.\n// MediumTrucks >= 10",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and also how much to invest in fuel-efficient technologies for each type of truck. The company aims to maximize its annual profit from the fleet operations. The profit per Small Truck is $30,000, which increases by $1,000 for every $5,000 invested in fuel-efficient technologies. The profit per Medium Truck is $40,000, which increases by $1,200 for every $5,000 invested in fuel-efficient technologies. The profit per Large Truck is $50,000, which increases by $1,500 for every $5,000 invested in fuel-efficient technologies.\n\nThe company has a budget of $2,000,000 for purchasing new trucks and investing in fuel-efficient technologies. The total number of trucks cannot exceed 50. At least 10 Medium Trucks must be purchased. Assuming the cost of a Small Truck is $50,000, a Medium Truck is $70,000, and a Large Truck is $100,000.\n\nPlease help the company to maximize its annual profit from the fleet operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small Trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium Trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large Trucks\nFuelTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechSmall\", lb=0)  # investment in fuel-efficient technologies for Small Trucks\nFuelTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechMedium\", lb=0)  # investment in fuel-efficient technologies for Medium Trucks\nFuelTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechLarge\", lb=0)  # investment in fuel-efficient technologies for Large Trucks\n\n# Define objective function\nProfitSmall = (30000 + 0.2 * FuelTechSmall) * SmallTrucks\nProfitMedium = (40000 + 0.24 * FuelTechMedium) * MediumTrucks\nProfitLarge = (50000 + 0.3 * FuelTechLarge) * LargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 100000 * LargeTrucks + FuelTechSmall + FuelTechMedium + FuelTechLarge <= 2000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\nmodel.addCons(MediumTrucks >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel-Efficient Technologies for Small Trucks: \", model.getVal(FuelTechSmall))\n    print(\"Investment in Fuel-Efficient Technologies for Medium Trucks: \", model.getVal(FuelTechMedium))\n    print(\"Investment in Fuel-Efficient Technologies for Large Trucks: \", model.getVal(FuelTechLarge))\n    print(\"Maximized Annual Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck, which can be improved with an investment in fuel-saving technology.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-saving technology for Region1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for Region5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck can be improved by investing in fuel-saving technology. For every $1000 invested, the fuel efficiency increases by 1%. The company aims to minimize the total fuel cost across all regions. The fuel cost per kilometer for each truck is $0.5, and the average distance traveled by each truck in a region is 1000 kilometers.\n// Fuel cost for Region1: Cost1 = 0.5 * (1000 * (1 + Tech1/1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.5 * (1000 * (1 + Tech2/1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.5 * (1000 * (1 + Tech3/1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.5 * (1000 * (1 + Tech4/1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.5 * (1000 * (1 + Tech5/1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel-saving technology investments.\n// Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck, which can be improved with an investment in fuel-saving technology. The fuel cost per kilometer for each truck is $0.5, and the average distance traveled by each truck in a region is 1000 kilometers.\n\n| Region | Number of Trucks | Investment in Fuel-Saving Technology |\n|--------|------------------|--------------------------------------|\n| Region1 | Trucks1         | Tech1                                |\n| Region2 | Trucks2         | Tech2                                |\n| Region3 | Trucks3         | Tech3                                |\n| Region4 | Trucks4         | Tech4                                |\n| Region5 | Trucks5         | Tech5                                |\n\nFor every $1000 invested in fuel-saving technology, the fuel efficiency increases by 1%. The company has a total budget of $100,000 for fuel-saving technology investments.\n\nPlease help the company to minimize the total fuel cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Region5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-saving technology for Region1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-saving technology for Region2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-saving technology for Region3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0)  # investment in fuel-saving technology for Region4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0)  # investment in fuel-saving technology for Region5\n\n# Define objective function\nCost1 = 0.5 * (1000 * (1 + Tech1/1000)) * Trucks1\nCost2 = 0.5 * (1000 * (1 + Tech2/1000)) * Trucks2\nCost3 = 0.5 * (1000 * (1 + Tech3/1000)) * Trucks3\nCost4 = 0.5 * (1000 * (1 + Tech4/1000)) * Trucks4\nCost5 = 0.5 * (1000 * (1 + Tech5/1000)) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Tech for Region1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Region2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Region3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Region4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Region5: \", model.getVal(Tech5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1216,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment in energy storage systems for each region. The energy storage system investment will affect the efficiency of energy collection and distribution.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionA\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionB\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionC\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of energy collection increases with the investment in energy storage systems. For every $100,000 invested in storage, the efficiency of energy collection increases by 1%. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The revenue generated per unit of energy collected is $100 for solar and $150 for wind. The company aims to maximize the total revenue from all regions.\n// Revenue_RegionA = (0.20 + 0.0001 * StorageA) * SolarA * 100 + (0.30 + 0.0001 * StorageA) * WindA * 150\n// Revenue_RegionB = (0.20 + 0.0001 * StorageB) * SolarB * 100 + (0.30 + 0.0001 * StorageB) * WindB * 150\n// Revenue_RegionC = (0.20 + 0.0001 * StorageC) * SolarC * 100 + (0.30 + 0.0001 * StorageC) * WindC * 150\n// So, the objective function is: Maximize (Revenue_RegionA + Revenue_RegionB + Revenue_RegionC)\n\n## Generate Constraint-1:\nThe total investment in energy storage systems across all regions cannot exceed $300,000.\n// StorageA + StorageB + StorageC <= 300000\n\n## Generate Constraint-2:\nThe company has a limited budget for installing renewable energy infrastructure. The cost of installing one solar panel is $500 and one wind turbine is $1000. The total installation cost across all regions must not exceed $500,000.\n// 500 * (SolarA + SolarB + SolarC) + 1000 * (WindA + WindB + WindC) <= 500000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment in energy storage systems for each region. The energy storage system investment will affect the efficiency of energy collection and distribution. The efficiency of energy collection increases with the investment in energy storage systems. For every $100,000 invested in storage, the efficiency of energy collection increases by 1%. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The revenue generated per unit of energy collected is $100 for solar and $150 for wind.\n\n| Component       | Efficiency (Initial) | Revenue per Unit | Installation Cost |\n|-----------------|----------------------|------------------|-------------------|\n| Solar Panel     | 20%                  | $100             | $500              |\n| Wind Turbine    | 30%                  | $150             | $1000             |\n\nThe company aims to maximize the total revenue from all regions. The total investment in energy storage systems across all regions cannot exceed $300,000. The company has a limited budget for installing renewable energy infrastructure. The cost of installing one solar panel is $500 and one wind turbine is $1000. The total installation cost across all regions must not exceed $500,000.\n\nPlease help the company to determine the optimal number of solar panels, wind turbines, and investment in energy storage systems for each region to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in RegionA\nStorageA = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageA\", lb=0) # investment in energy storage in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in RegionB\nStorageB = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageB\", lb=0) # investment in energy storage in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in RegionC\nStorageC = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageC\", lb=0) # investment in energy storage in RegionC\n\n# Define objective function\nRevenue_RegionA = (0.20 + 0.0001 * StorageA) * SolarA * 100 + (0.30 + 0.0001 * StorageA) * WindA * 150\nRevenue_RegionB = (0.20 + 0.0001 * StorageB) * SolarB * 100 + (0.30 + 0.0001 * StorageB) * WindB * 150\nRevenue_RegionC = (0.20 + 0.0001 * StorageC) * SolarC * 100 + (0.30 + 0.0001 * StorageC) * WindC * 150\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_RegionA + Revenue_RegionB + Revenue_RegionC)\n\n# Add constraints\n# The total investment in energy storage systems across all regions cannot exceed $300,000.\nmodel.addCons(StorageA + StorageB + StorageC <= 300000)\n# The company has a limited budget for installing renewable energy infrastructure.\nmodel.addCons(500 * (SolarA + SolarB + SolarC) + 1000 * (WindA + WindB + WindC) <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Investment in Storage in RegionA: \", model.getVal(StorageA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Investment in Storage in RegionB: \", model.getVal(StorageB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in Storage in RegionC: \", model.getVal(StorageC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1662,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. \nOn route 1, the cost per truck is $1000 per day.\nOn route 2, the cost per truck is $1200 per day.\nOn route 3, the cost per truck is $1500 per day.\nOn route 4, the cost per truck is $1300 per day.\nOn route 5, the cost per truck is $1100 per day.\nThe company aims to minimize the total cost while ensuring all routes are covered.\n// Cost_T1 = 1000 * T1\n// Cost_T2 = 1200 * T2\n// Cost_T3 = 1500 * T3\n// Cost_T4 = 1300 * T4\n// Cost_T5 = 1100 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe company has a total fleet of 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs, as shown in the following Table.\n\n| Route | Cost per Truck per Day |\n|-------|-------------------------|\n| 1     | $1000                   |\n| 2     | $1200                   |\n| 3     | $1500                   |\n| 4     | $1300                   |\n| 5     | $1100                   |\n\nThe company aims to minimize the total cost while ensuring all routes are covered. The company has a total fleet of 50 trucks. Please help the company determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nCost_T1 = 1000 * T1\nCost_T2 = 1200 * T2\nCost_T3 = 1500 * T3\nCost_T4 = 1300 * T4\nCost_T5 = 1100 * T5\n# So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n# The company has a total fleet of 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh.\n// Total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// Total energy generation: Energy = 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total annual energy generation must be at least 100,000 kWh.\n// 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for installation.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) <= 100000\n\n## Generate Constraint-3:\nThe number of solar panels at any location should not exceed the number of wind turbines by more than 5.\n// Solar1 - Wind1 <= 5\n// Solar2 - Wind2 <= 5\n// Solar3 - Wind3 <= 5\n// Solar4 - Wind4 <= 5\n// Solar5 - Wind5 <= 5\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced distribution of energy sources, so the difference in the number of installations between any two locations should not exceed 10.\n// |(Solar1 + Wind1) - (Solar2 + Wind2)| <= 10\n// |(Solar1 + Wind1) - (Solar3 + Wind3)| <= 10\n// |(Solar1 + Wind1) - (Solar4 + Wind4)| <= 10\n// |(Solar1 + Wind1) - (Solar5 + Wind5)| <= 10\n// |(Solar2 + Wind2) - (Solar3 + Wind3)| <= 10\n// |(Solar2 + Wind2) - (Solar4 + Wind4)| <= 10\n// |(Solar2 + Wind2) - (Solar5 + Wind5)| <= 10\n// |(Solar3 + Wind3) - (Solar4 + Wind4)| <= 10\n// |(Solar3 + Wind3) - (Solar5 + Wind5)| <= 10\n// |(Solar4 + Wind4) - (Solar5 + Wind5)| <= 10",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh. The company has a budget of $100,000 for installation. The number of solar panels at any location should not exceed the number of wind turbines by more than 5. The company wants to ensure a balanced distribution of energy sources, so the difference in the number of installations between any two locations should not exceed 10.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to be installed at each location to minimize the total cost of installation while meeting all the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0)\n\n# Define objective function\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n# Constraint-1: Total annual energy generation must be at least 100,000 kWh.\nEnergy = 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\nmodel.addCons(Energy >= 100000)\n\n# Constraint-2: The company has a budget of $100,000 for installation.\nmodel.addCons(Cost <= 100000)\n\n# Constraint-3: The number of solar panels at any location should not exceed the number of wind turbines by more than 5.\nmodel.addCons(Solar1 - Wind1 <= 5)\nmodel.addCons(Solar2 - Wind2 <= 5)\nmodel.addCons(Solar3 - Wind3 <= 5)\nmodel.addCons(Solar4 - Wind4 <= 5)\nmodel.addCons(Solar5 - Wind5 <= 5)\n\n# Constraint-4: The company wants to ensure a balanced distribution of energy sources, so the difference in the number of installations between any two locations should not exceed 10.\nmodel.addCons(abs((Solar1 + Wind1) - (Solar2 + Wind2)) <= 10)\nmodel.addCons(abs((Solar1 + Wind1) - (Solar3 + Wind3)) <= 10)\nmodel.addCons(abs((Solar1 + Wind1) - (Solar4 + Wind4)) <= 10)\nmodel.addCons(abs((Solar1 + Wind1) - (Solar5 + Wind5)) <= 10)\nmodel.addCons(abs((Solar2 + Wind2) - (Solar3 + Wind3)) <= 10)\nmodel.addCons(abs((Solar2 + Wind2) - (Solar4 + Wind4)) <= 10)\nmodel.addCons(abs((Solar2 + Wind2) - (Solar5 + Wind5)) <= 10)\nmodel.addCons(abs((Solar3 + Wind3) - (Solar4 + Wind4)) <= 10)\nmodel.addCons(abs((Solar3 + Wind3) - (Solar5 + Wind5)) <= 10)\nmodel.addCons(abs((Solar4 + Wind4) - (Solar5 + Wind5)) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(Wind3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(Wind4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(Solar5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(Wind5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost reduction per unit of product is affected by the investment in automation.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkA\", \"range\": \"WorkA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkB\", \"range\": \"WorkB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkC\", \"range\": \"WorkC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The investment in automation reduces the labor cost per unit by $0.01 for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce size across all products must not exceed 100 employees.\n// WorkA + WorkB + WorkC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The investment in automation reduces the labor cost per unit by $0.01 for every $1,000 invested. The company aims to maximize the total profit from all products. The total workforce size across all products must not exceed 100 employees.\n\nPlease help the company to determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity of ProductC\nWorkA = model.addVar(vtype=\"INTEGER\", name=\"WorkA\", lb=0)  # workforce size for ProductA\nWorkB = model.addVar(vtype=\"INTEGER\", name=\"WorkB\", lb=0)  # workforce size for ProductB\nWorkC = model.addVar(vtype=\"INTEGER\", name=\"WorkC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\nProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\nProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkA + WorkB + WorkC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 in production costs. Product B yields a profit of $70 per unit with a production cost of $30. Product C yields a profit of $100 per unit with a production cost of $40. The company aims to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (100 - 40) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units, and for product B is at least 150 units.\n// A >= 100; B >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand.\nThe profit per unit of product A is $50, but it requires $20 in production costs. Product B yields a profit of $70 per unit with a production cost of $30. Product C yields a profit of $100 per unit with a production cost of $40. The company aims to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs.\nThe company has a total production budget of $10,000. The market demand for product A is at least 100 units, and for product B is at least 150 units.\nPlease help the company determine the optimal number of units to produce for each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for product A is at least 100 units, and for product B is at least 150 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (100 - 40) * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"TA\", \"range\": \"TA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TB\", \"range\": \"TB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TC\", \"range\": \"TC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TD\", \"range\": \"TD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TE\", \"range\": \"TE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck A has a fuel efficiency of 10 km/l and a maintenance cost of $500 per month.\n- Truck B has a fuel efficiency of 12 km/l and a maintenance cost of $600 per month.\n- Truck C has a fuel efficiency of 15 km/l and a maintenance cost of $700 per month.\n- Truck D has a fuel efficiency of 18 km/l and a maintenance cost of $800 per month.\n- Truck E has a fuel efficiency of 20 km/l and a maintenance cost of $900 per month.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Total fuel cost: FuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / FuelEfficiency)\n// Total maintenance cost: MaintenanceCost = (500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE)\n// Total cost per kilometer: TotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for all trucks combined.\n// 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// TA + TB + TC + TD + TE <= 50",
        "question": "A logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs. The fuel efficiency and maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) |\n|------------|-----------------------|----------------------------|\n| Truck A    | 10                    | 500                        |\n| Truck B    | 12                    | 600                        |\n| Truck C    | 15                    | 700                        |\n| Truck D    | 18                    | 800                        |\n| Truck E    | 20                    | 900                        |\n\nThe company has a budget of $50,000 per month for all trucks combined. The total number of trucks cannot exceed 50. \nPlease help the company to minimize the total cost of fuel and maintenance per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTA = model.addVar(vtype=\"INTEGER\", name=\"TA\", lb=0) # number of Truck A\nTB = model.addVar(vtype=\"INTEGER\", name=\"TB\", lb=0) # number of Truck B\nTC = model.addVar(vtype=\"INTEGER\", name=\"TC\", lb=0) # number of Truck C\nTD = model.addVar(vtype=\"INTEGER\", name=\"TD\", lb=0) # number of Truck D\nTE = model.addVar(vtype=\"INTEGER\", name=\"TE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPricePerLiter = 1.5  # Assuming fuel price per liter\nFuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / 1000)  # Convert to km/l\nMaintenanceCost = 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE\nTotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n## convert the division to multiplication\nmodel.addCons(obj * (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $50,000 per month for all trucks combined.\nmodel.addCons(500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(TA + TB + TC + TD + TE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TA))\n    print(\"Number of Truck B: \", model.getVal(TB))\n    print(\"Number of Truck C: \", model.getVal(TC))\n    print(\"Number of Truck D: \", model.getVal(TD))\n    print(\"Number of Truck E: \", model.getVal(TE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance.\n// Distance_TruckA = 10 * TruckA\n// Distance_TruckB = 15 * TruckB\n// Distance_TruckC = 20 * TruckC\n// So, the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / (100 * TruckA + 150 * TruckB + 200 * TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for maintenance per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks in total.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints. The fuel efficiency and maintenance cost per day for each type of truck are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost per Day ($) |\n|---------|-----------------------|------------------------------|\n| Truck A | 10                    | 100                          |\n| Truck B | 15                    | 150                          |\n| Truck C | 20                    | 200                          |\n\nThe company has a total budget of $5000 for maintenance per day. The company also has a limit of 50 trucks in total. Please help the company to maximize the total distance covered per dollar spent on maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance_TruckA = 10 * TruckA\nDistance_TruckB = 15 * TruckB\nDistance_TruckC = 20 * TruckC\nMaintenanceCost = 100 * TruckA + 150 * TruckB + 200 * TruckC\n## the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / MaintenanceCost\n## convert the division to multiplication\nmodel.addCons(obj * MaintenanceCost == Distance_TruckA + Distance_TruckB + Distance_TruckC)\n\n# Add constraints\n## The company has a total budget of $5000 for maintenance per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n## The company has a limit of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Distance per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, and the production cost per unit is $50. For ProductB, the profit per unit is $120, and the production cost per unit is $60. For ProductC, the profit per unit is $150, and the production cost per unit is $75. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\n// ProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\n// ProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe demand for ProductA is at least 1000 units.\n// QA >= 1000\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of ProductB as ProductC.\n// QB >= 2 * QC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products. The profit per unit of ProductA is $100, and the production cost per unit is $50. For ProductB, the profit per unit is $120, and the production cost per unit is $60. For ProductC, the profit per unit is $150, and the production cost per unit is $75. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The company has a budget of $100,000 for the investment in new technology. The total production capacity of the company is 5000 units. The demand for ProductA is at least 1000 units. The company must produce at least twice as many units of ProductB as ProductC. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=1000) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\nProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\nProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $100,000 for the investment in new technology.\nmodel.addCons(TechInvestment <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QA + QB + QC <= 5000)\n# The demand for ProductA is at least 1000 units.\nmodel.addCons(QA >= 1000)\n# The company must produce at least twice as many units of ProductB as ProductC.\nmodel.addCons(QB >= 2 * QC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each truck to reduce fuel costs and increase the number of trips possible per day.\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost for Truck 1: Cost1 = (100 - 0.05 * Upgrade1) * Trips1\n// Fuel cost for Truck 2: Cost2 = (120 - 0.06 * Upgrade2) * Trips2\n// Fuel cost for Truck 3: Cost3 = (150 - 0.075 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and upgrades.\n// (100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nEach truck can make at most 50 trips per day.\n// Trips1 <= 50; Trips2 <= 50; Trips3 <= 50\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips.\n// Trips1 >= 20; Trips2 >= 25",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities and the investment in fuel-efficient upgrades for each truck to optimize its operations. The fuel cost per trip and the impact of upgrades on fuel cost for each truck are given in the following Table.\n\n| Truck | Fuel Cost per Trip | Reduction in Fuel Cost per $100 Invested |\n|-------|--------------------|-----------------------------------------|\n| 1     | $100               | $5                                      |\n| 2     | $120               | $6                                      |\n| 3     | $150               | $7.5                                    |\n\nThe company has a budget of $10,000 for fuel and upgrades. Each truck can make at most 50 trips per day. Due to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips. The company aims to minimize the total fuel cost of all trips.\n\nPlease help the company determine the optimal number of trips for each truck and the investment in fuel-efficient upgrades to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=20, ub=50)  # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=25, ub=50)  # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0, ub=50)    # number of trips for Truck 3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)   # investment in fuel-efficient upgrades for Truck 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)   # investment in fuel-efficient upgrades for Truck 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)   # investment in fuel-efficient upgrades for Truck 3\n\n# Define objective function\nCost1 = (100 - 0.05 * Upgrade1) * Trips1\nCost2 = (120 - 0.06 * Upgrade2) * Trips2\nCost3 = (150 - 0.075 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel and upgrades.\nmodel.addCons((100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# Each truck can make at most 50 trips per day.\nmodel.addCons(Trips1 <= 50)\nmodel.addCons(Trips2 <= 50)\nmodel.addCons(Trips3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrades for Truck 1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck 2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck 3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the constraints of raw material availability, production capacity, and market demand.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"raw material cost per unit of Product A\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"raw material cost per unit of Product B\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"raw material cost per unit of Product C\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit, which is the difference between the total revenue and the total raw material cost.\n// RevenueA = 50 * ProductA\n// RevenueB = 70 * ProductB\n// RevenueC = 60 * ProductC\n// TotalRevenue = RevenueA + RevenueB + RevenueC\n// TotalCost = CostA * ProductA + CostB * ProductB + CostC * ProductC\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a total raw material budget of $1000 per day.\n// CostA * ProductA + CostB * ProductB + CostC * ProductC <= 1000\n\n## Generate Constraint-2:\nThe production capacity is limited to 20 units per day for all products combined.\n// ProductA + ProductB + ProductC <= 20\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 5 units per day, and for Product B and C combined, it is at least 10 units per day.\n// ProductA >= 5\n// ProductB + ProductC >= 10\n\n## Generate Constraint-4:\nThe raw material cost per unit of Product A is twice that of Product C, and the cost per unit of Product B is 1.5 times that of Product C.\n// CostA = 2 * CostC\n// CostB = 1.5 * CostC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the constraints of raw material availability, production capacity, and market demand. The revenue per unit for each product is as follows:\n\n| Product | Revenue per Unit |\n|---------|------------------|\n| A       | $50              |\n| B       | $70              |\n| C       | $60              |\n\nThe company has a total raw material budget of $1000 per day. The production capacity is limited to 20 units per day for all products combined. The market demand for Product A is at least 5 units per day, and for Product B and C combined, it is at least 10 units per day. The raw material cost per unit of Product A is twice that of Product C, and the cost per unit of Product B is 1.5 times that of Product C.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total raw material cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # number of units of Product C\nCostA = model.addVar(vtype=\"CONTINUOUS\", name=\"CostA\", lb=0)  # raw material cost per unit of Product A\nCostB = model.addVar(vtype=\"CONTINUOUS\", name=\"CostB\", lb=0)  # raw material cost per unit of Product B\nCostC = model.addVar(vtype=\"CONTINUOUS\", name=\"CostC\", lb=0)  # raw material cost per unit of Product C\n\n# Define objective function\nRevenueA = 50 * ProductA\nRevenueB = 70 * ProductB\nRevenueC = 60 * ProductC\nTotalRevenue = RevenueA + RevenueB + RevenueC\nTotalCost = CostA * ProductA + CostB * ProductB + CostC * ProductC\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a total raw material budget of $1000 per day.\nmodel.addCons(CostA * ProductA + CostB * ProductB + CostC * ProductC <= 1000)\n# The production capacity is limited to 20 units per day for all products combined.\nmodel.addCons(ProductA + ProductB + ProductC <= 20)\n# The market demand for Product A is at least 5 units per day, and for Product B and C combined, it is at least 10 units per day.\nmodel.addCons(ProductA >= 5)\nmodel.addCons(ProductB + ProductC >= 10)\n# The raw material cost per unit of Product A is twice that of Product C, and the cost per unit of Product B is 1.5 times that of Product C.\nmodel.addCons(CostA == 2 * CostC)\nmodel.addCons(CostB == 1.5 * CostC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Optimal Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of ProductA: ProfitA = (100 - 40) * QuantityA\n// Profit of ProductB: ProfitB = (120 - 50) * QuantityB\n// Profit of ProductC: ProfitC = (150 - 60) * QuantityC\n// Profit of ProductD: ProfitD = (200 - 80) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / (5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000\n\n## Generate Constraint-2:\nThe company has a total production capacity of 1000 hours.\n// 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production. The selling price, raw material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Production Time |\n|---------|---------------|-------------------|-----------------|\n| ProductA | $100         | $40               | 5 hours         |\n| ProductB | $120         | $50               | 6 hours         |\n| ProductC | $150         | $60               | 7 hours         |\n| ProductD | $200         | $80               | 8 hours         |\n\nThe company has a budget of $10,000 for raw materials. The company has a total production capacity of 1000 hours. \nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 40) * QuantityA\nProfitB = (120 - 50) * QuantityB\nProfitC = (150 - 60) * QuantityC\nProfitD = (200 - 80) * QuantityD\nProductionTime = 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000)\n## The company has a total production capacity of 1000 hours.\nmodel.addCons(5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Production Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n// Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000\n// where Cost_Small = $20000, Cost_Medium = $30000, Cost_Large = $40000\n\n## Generate Constraint-2:\nThe total capacity of the new trucks should not exceed 1000 tons.\n// Capacity_Small * SmallTrucks + Capacity_Medium * MediumTrucks + Capacity_Large * LargeTrucks <= 1000\n// where Capacity_Small = 10, Capacity_Medium = 20, Capacity_Large = 30",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability. The operational costs, capacities, and revenue generation per day for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Day | Capacity | Revenue Generation per Day |\n|------------|--------------------------|----------|----------------------------|\n| Small      | $200                     | 10 tons  | $500                       |\n| Medium     | $300                     | 20 tons  | $700                       |\n| Large      | $400                     | 30 tons  | $900                       |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total capacity of the new trucks should not exceed 1000 tons. Please help the company to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\nProfit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nCost_Small = 20000\nCost_Medium = 30000\nCost_Large = 40000\nmodel.addCons(Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000)\n\nCapacity_Small = 10\nCapacity_Medium = 20\nCapacity_Large = 30\nmodel.addCons(Capacity_Small * SmallTrucks + Capacity_Medium * MediumTrucks + Capacity_Large * LargeTrucks <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for textiles\": \"TextilesSpeed\", \"range\": \"TextilesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n// FuelConsumption_Electronics = k1 * ElectronicsSpeed^3 * ElectronicsTrucks\n// FuelConsumption_Perishables = k2 * PerishablesSpeed^3 * PerishablesTrucks\n// FuelConsumption_Textiles = k3 * TextilesSpeed^3 * TextilesTrucks\n// So, the objective function is: Minimize (FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel costs.\n// k1 * ElectronicsSpeed^3 * ElectronicsTrucks + k2 * PerishablesSpeed^3 * PerishablesTrucks + k3 * TextilesSpeed^3 * TextilesTrucks <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum fleet size of 50 trucks.\n// ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n\n| Type of Goods | Number of Trucks | Average Speed |\n|---------------|------------------|---------------|\n| Electronics   | ElectronicsTrucks | ElectronicsSpeed |\n| Perishables   | PerishablesTrucks | PerishablesSpeed |\n| Textiles      | TextilesTrucks | TextilesSpeed |\n\nThe company has a total budget of $10,000 per day for fuel costs. The company has a maximum fleet size of 50 trucks. Please help the company to determine the optimal number of trucks and their average speeds to minimize the total daily fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(name=\"ElectronicsSpeed\", lb=0)\nPerishablesSpeed = model.addVar(name=\"PerishablesSpeed\", lb=0)\nTextilesSpeed = model.addVar(name=\"TextilesSpeed\", lb=0)\n\n# Define objective function\nFuelConsumption_Electronics = model.addVar(name=\"FuelConsumption_Electronics\")\nFuelConsumption_Perishables = model.addVar(name=\"FuelConsumption_Perishables\")\nFuelConsumption_Textiles = model.addVar(name=\"FuelConsumption_Textiles\")\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\n\n# Constraints for fuel consumption calculations\nmodel.addCons(FuelConsumption_Electronics == ElectronicsTrucks * ElectronicsSpeed**3)\nmodel.addCons(FuelConsumption_Perishables == PerishablesTrucks * PerishablesSpeed**3)\nmodel.addCons(FuelConsumption_Textiles == TextilesTrucks * TextilesSpeed**3)\nmodel.addCons(obj == FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks * ElectronicsSpeed**3 + PerishablesTrucks * PerishablesSpeed**3 + TextilesTrucks * TextilesSpeed**3 <= 10000)\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Electronics Trucks: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Perishables Trucks: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Textiles Trucks: \", model.getVal(TextilesTrucks))\n    print(\"Electronics Speed: \", model.getVal(ElectronicsSpeed))\n    print(\"Perishables Speed: \", model.getVal(PerishablesSpeed))\n    print(\"Textiles Speed: \", model.getVal(TextilesSpeed))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space, which can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of M1 must be at least twice the production of M2.\n// M1 >= 2 * M2\n\n## Generate Constraint-4:\nThe company has a contract that requires them to produce at least 10 units of M3.\n// M3 >= 10",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company has a total production budget of $100,000. The company has a limited storage space, which can hold a maximum of 100 units in total. Due to market demand, the production of M1 must be at least twice the production of M2. The company has a contract that requires them to produce at least 10 units of M3.\nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=10) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000) # Production budget constraint\nmodel.addCons(M1 + M2 + M3 <= 100) # Storage space constraint\nmodel.addCons(M1 >= 2 * M2) # Market demand constraint for M1\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (in hours) allocated to each product to optimize production efficiency. Additionally, the company needs to decide on the investment in automation technology for each product, which will reduce the required resource hours per unit of product.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resource hours per unit for ProductA\": \"ResourceHoursA\", \"range\": \"ResourceHoursA >= 0\", \"type\": \"continuous\"}\n// {\"resource hours per unit for ProductB\": \"ResourceHoursB\", \"range\": \"ResourceHoursB >= 0\", \"type\": \"continuous\"}\n// {\"resource hours per unit for ProductC\": \"ResourceHoursC\", \"range\": \"ResourceHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product. The initial resource hours per unit for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The profit per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - ResourceHoursA * 20) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - ResourceHoursB * 20) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - ResourceHoursC * 20) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource hours available for the month are 10,000 hours.\n// ResourceHoursA * QuantityA + ResourceHoursB * QuantityB + ResourceHoursC * QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 300 units of ProductB.\n// QuantityA >= 500; QuantityB >= 300\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductC cannot exceed 400 units.\n// QuantityC <= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the amount of resources (in hours) allocated to each product, and the investment in automation technology for each product to optimize production efficiency. The initial resource hours per unit and the profit per unit for each product are given in the following Table.\n\n| Product | Initial Resource Hours per Unit | Profit per Unit |\n|---------|---------------------------------|-----------------|\n| ProductA | 5 hours                         | $100            |\n| ProductB | 6 hours                         | $120            |\n| ProductC | 7 hours                         | $150            |\n\nThe resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product. The total resource hours available for the month are 10,000 hours. The total investment in automation cannot exceed $50,000. The company must produce at least 500 units of ProductA and 300 units of ProductB. Due to market demand, the production of ProductC cannot exceed 400 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=400) # production quantity for ProductC\nResourceHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursA\", lb=0) # resource hours per unit for ProductA\nResourceHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursB\", lb=0) # resource hours per unit for ProductB\nResourceHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursC\", lb=0) # resource hours per unit for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\n## The resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product.\nmodel.addCons(ResourceHoursA == 5 - 0.1 * AutomationA / 1000)\nmodel.addCons(ResourceHoursB == 6 - 0.1 * AutomationB / 1000)\nmodel.addCons(ResourceHoursC == 7 - 0.1 * AutomationC / 1000)\n## Total profit for ProductA: ProfitA = (100 - ResourceHoursA * 20) * QuantityA\n## Total profit for ProductB: ProfitB = (120 - ResourceHoursB * 20) * QuantityB\n## Total profit for ProductC: ProfitC = (150 - ResourceHoursC * 20) * QuantityC\nProfitA = (100 - ResourceHoursA * 20) * QuantityA\nProfitB = (120 - ResourceHoursB * 20) * QuantityB\nProfitC = (150 - ResourceHoursC * 20) * QuantityC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total resource hours available for the month are 10,000 hours.\nmodel.addCons(ResourceHoursA * QuantityA + ResourceHoursB * QuantityB + ResourceHoursC * QuantityC <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Resource Hours per Unit for ProductA: \", model.getVal(ResourceHoursA))\n    print(\"Resource Hours per Unit for ProductB: \", model.getVal(ResourceHoursB))\n    print(\"Resource Hours per Unit for ProductC: \", model.getVal(ResourceHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours.\n// Fuel_Consumption_Route_1 = 10 * T1\n// Fuel_Consumption_Route_2 = 12 * T2\n// Fuel_Consumption_Route_3 = 15 * T3\n// Fuel_Consumption_Route_4 = 18 * T4\n// Fuel_Consumption_Route_5 = 20 * T5\n// Delivery_Time_Route_1 = K1 / T1\n// Delivery_Time_Route_2 = K2 / T2\n// Delivery_Time_Route_3 = K3 / T3\n// Delivery_Time_Route_4 = K4 / T4\n// Delivery_Time_Route_5 = K5 / T5\n// Total_Delivery_Time = Delivery_Time_Route_1 + Delivery_Time_Route_2 + Delivery_Time_Route_3 + Delivery_Time_Route_4 + Delivery_Time_Route_5\n// Objective function: Minimize Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5, subject to Total_Delivery_Time <= 500\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1",
        "question": "A logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours.\n\n| Route | Fuel Consumption per Truck (liters/hour) |\n|-------|------------------------------------------|\n| 1     | 10                                       |\n| 2     | 12                                       |\n| 3     | 15                                       |\n| 4     | 18                                       |\n| 5     | 20                                       |\n\nThe total number of trucks available is 100. Each route must have at least one truck. Please help the company to minimize the total fuel consumption while meeting the delivery time constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least one truck.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Route_1 = 10 * T1\nFuel_Consumption_Route_2 = 12 * T2\nFuel_Consumption_Route_3 = 15 * T3\nFuel_Consumption_Route_4 = 18 * T4\nFuel_Consumption_Route_5 = 20 * T5\n## the objective function is: Minimize Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5\nmodel.addCons(obj == Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route must have at least one truck.\nmodel.addCons(T1 >= 1)\nmodel.addCons(T2 >= 1)\nmodel.addCons(T3 >= 1)\nmodel.addCons(T4 >= 1)\nmodel.addCons(T5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes. The company has a budget of $500,000 for purchasing trucks.\n\nPlease help the company to maximize the following objective function: (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=0)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=0)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=0)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=0)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=0)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and costs calculation\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (Profit - Cost - EnvImpact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route R1 is $1000, and the revenue per truck is $1500. On route R2, the cost is $1200, and the revenue is $1800. On route R3, the cost is $1400, and the revenue is $2100. On route R4, the cost is $1600, and the revenue is $2400. On route R5, the cost is $1800, and the revenue is $2700. The company aims to maximize the total net revenue (revenue minus cost) per total operational cost.\n// Net_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\n// Net_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\n// Net_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\n// Net_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\n// Net_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n// So, the objective function is: Maximize (Net_Revenue_R1 + Net_Revenue_R2 + Net_Revenue_R3 + Net_Revenue_R4 + Net_Revenue_R5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe minimum number of trucks required on route R1 is 10.\n// T1 >= 10",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and revenue potentials per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| R1    | $1000          | $1500             |\n| R2    | $1200          | $1800             |\n| R3    | $1400          | $2100             |\n| R4    | $1600          | $2400             |\n| R5    | $1800          | $2700             |\n\nThe company has a total budget of $100,000 for operational costs. The total number of trucks available is 100. The minimum number of trucks required on route R1 is 10. \nPlease help the company to maximize the total net revenue (revenue minus cost) per total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_R1 = (1500 * T1 - 1000 * T1) / (1000 * T1)\nNet_Revenue_R2 = (1800 * T2 - 1200 * T2) / (1200 * T2)\nNet_Revenue_R3 = (2100 * T3 - 1400 * T3) / (1400 * T3)\nNet_Revenue_R4 = (2400 * T4 - 1600 * T4) / (1600 * T4)\nNet_Revenue_R5 = (2700 * T5 - 1800 * T5) / (1800 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * (1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5) == (1500 * T1 - 1000 * T1) + (1800 * T2 - 1200 * T2) + (2100 * T3 - 1400 * T3) + (2400 * T4 - 1600 * T4) + (2700 * T5 - 1800 * T5))\n\n# Add constraints\n## The company has a total budget of $100,000 for operational costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000)\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Net Revenue per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route selection for a set of deliveries. The company has five different types of trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Each truck has a different fuel efficiency and capacity. The company also needs to decide on the amount of fuel to purchase for each truck type.\n// {\"quantity of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"fuel for Truck1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel for Truck2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel for Truck3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel for Truck4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel for Truck5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter for Truck1 is $1.5, for Truck2 is $1.3, for Truck3 is $1.2, for Truck4 is $1.1, and for Truck5 is $1.0. The fuel efficiency of Truck1 is 10 km/liter, Truck2 is 12 km/liter, Truck3 is 15 km/liter, Truck4 is 18 km/liter, and Truck5 is 20 km/liter. The company wants to minimize the total cost of fuel and the total distance traveled.\n// Cost_Truck1 = 1.5 * Fuel1\n// Cost_Truck2 = 1.3 * Fuel2\n// Cost_Truck3 = 1.2 * Fuel3\n// Cost_Truck4 = 1.1 * Fuel4\n// Cost_Truck5 = 1.0 * Fuel5\n// Distance_Truck1 = 10 * Fuel1 * Truck1\n// Distance_Truck2 = 12 * Fuel2 * Truck2\n// Distance_Truck3 = 15 * Fuel3 * Truck3\n// Distance_Truck4 = 18 * Fuel4 * Truck4\n// Distance_Truck5 = 20 * Fuel5 * Truck5\n// So, the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Truck4 + Cost_Truck5 + Distance_Truck1 + Distance_Truck2 + Distance_Truck3 + Distance_Truck4 + Distance_Truck5)\n\n## Generate Constraint-1:\nThe total fuel budget for the company is $10,000.\n// 1.5 * Fuel1 + 1.3 * Fuel2 + 1.2 * Fuel3 + 1.1 * Fuel4 + 1.0 * Fuel5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route selection for a set of deliveries. The company has five different types of trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Each truck has a different fuel efficiency and capacity. The company also needs to decide on the amount of fuel to purchase for each truck type.\nThe cost of fuel per liter for Truck1 is $1.5, for Truck2 is $1.3, for Truck3 is $1.2, for Truck4 is $1.1, and for Truck5 is $1.0. The fuel efficiency of Truck1 is 10 km/liter, Truck2 is 12 km/liter, Truck3 is 15 km/liter, Truck4 is 18 km/liter, and Truck5 is 20 km/liter. The company wants to minimize the total cost of fuel and the total distance traveled. The total fuel budget for the company is $10,000.\nPlease help the company to minimize the total cost of fuel and the total distance traveled.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)\n\n# Define objective function\nCost_Truck1 = 1.5 * Fuel1\nCost_Truck2 = 1.3 * Fuel2\nCost_Truck3 = 1.2 * Fuel3\nCost_Truck4 = 1.1 * Fuel4\nCost_Truck5 = 1.0 * Fuel5\nDistance_Truck1 = 10 * Fuel1 * Truck1\nDistance_Truck2 = 12 * Fuel2 * Truck2\nDistance_Truck3 = 15 * Fuel3 * Truck3\nDistance_Truck4 = 18 * Fuel4 * Truck4\nDistance_Truck5 = 20 * Fuel5 * Truck5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Truck4 + Cost_Truck5 + Distance_Truck1 + Distance_Truck2 + Distance_Truck3 + Distance_Truck4 + Distance_Truck5)\n\n# Add constraints\nmodel.addCons(1.5 * Fuel1 + 1.3 * Fuel2 + 1.2 * Fuel3 + 1.1 * Fuel4 + 1.0 * Fuel5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Truck1: \", model.getVal(Truck1))\n    print(\"Quantity of Truck2: \", model.getVal(Truck2))\n    print(\"Quantity of Truck3: \", model.getVal(Truck3))\n    print(\"Quantity of Truck4: \", model.getVal(Truck4))\n    print(\"Quantity of Truck5: \", model.getVal(Truck5))\n    print(\"Fuel for Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel for Truck2: \", model.getVal(Fuel2))\n    print(\"Fuel for Truck3: \", model.getVal(Fuel3))\n    print(\"Fuel for Truck4: \", model.getVal(Fuel4))\n    print(\"Fuel for Truck5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Cost and Distance: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Trucks\": \"TruckHours\", \"range\": \"TruckHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Vans\": \"VanHours\", \"range\": \"VanHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Bikes\": \"BikeHours\", \"range\": \"BikeHours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type is a function of operational hours and the number of vehicles. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company aims to maximize the net daily revenue.\n// Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\n// Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\n// Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n// So, the objective function is: Maximize (Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n## Generate Constraint-1:\nThe company has a total of 200 operational hours available per day across all vehicle types.\n// TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for daily operational costs including fuel and maintenance.\n// 50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000\n\n## Generate Constraint-3:\nDue to driver availability, the total number of vehicles cannot exceed 50.\n// TruckCount + VanCount + BikeCount <= 50\n\n## Generate Constraint-4:\nThe company must ensure at least 10 hours of operation for Trucks and 15 hours for Vans to meet critical delivery schedules.\n// TruckHours >= 10; VanHours >= 15",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company has a total of 200 operational hours available per day across all vehicle types. The company has a budget of $10,000 for daily operational costs including fuel and maintenance. Due to driver availability, the total number of vehicles cannot exceed 50. The company must ensure at least 10 hours of operation for Trucks and 15 hours for Vans to meet critical delivery schedules. Please help the company to maximize the net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckHours = model.addVar(vtype=\"INTEGER\", name=\"TruckHours\", lb=10)  # operational hours for Trucks\nVanHours = model.addVar(vtype=\"INTEGER\", name=\"VanHours\", lb=15)  # operational hours for Vans\nBikeHours = model.addVar(vtype=\"INTEGER\", name=\"BikeHours\", lb=0)  # operational hours for Bikes\n\n# Define objective function\nRevenue_Trucks = (100 - 50) * TruckHours * TruckCount  # Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\nRevenue_Vans = (70 - 30) * VanHours * VanCount  # Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\nRevenue_Bikes = (30 - 10) * BikeHours * BikeCount  # Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n# Add constraints\nmodel.addCons(TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200)  # Total operational hours constraint\nmodel.addCons(50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000)  # Operational cost budget constraint\nmodel.addCons(TruckCount + VanCount + BikeCount <= 50)  # Total number of vehicles constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Operational Hours for Trucks: \", model.getVal(TruckHours))\n    print(\"Operational Hours for Vans: \", model.getVal(VanHours))\n    print(\"Operational Hours for Bikes: \", model.getVal(BikeHours))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. The production cost, revenue, and required machine hours vary for each product.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product A\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a production cost of $50 per unit, a revenue of $100 per unit, and requires 2 machine hours per unit.\nProduct B has a production cost of $70 per unit, a revenue of $140 per unit, and requires 3 machine hours per unit.\nProduct C has a production cost of $90 per unit, a revenue of $180 per unit, and requires 4 machine hours per unit.\nThe company wants to maximize the total daily profit.\n// Profit_A = (100 - 50) * UnitsA - 2000 * MachinesA\n// Profit_B = (140 - 70) * UnitsB - 3000 * MachinesB\n// Profit_C = (180 - 90) * UnitsC - 4000 * MachinesC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nThe total production capacity per day is limited to 100 units across all products.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily operational budget of $5000 for machine maintenance.\n// 2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000\n\n## Generate Constraint-4:\nTo ensure product diversity, the company must produce at least 10 units of each product per day.\n// UnitsA >= 10; UnitsB >= 10; UnitsC >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. Product A has a production cost of $50 per unit, a revenue of $100 per unit, and requires 2 machine hours per unit. Product B has a production cost of $70 per unit, a revenue of $140 per unit, and requires 3 machine hours per unit. Product C has a production cost of $90 per unit, a revenue of $180 per unit, and requires 4 machine hours per unit. The company wants to maximize the total daily profit.\n\nThe company has a total of 50 machines available. The total production capacity per day is limited to 100 units across all products. The company has a daily operational budget of $5000 for machine maintenance. To ensure product diversity, the company must produce at least 10 units of each product per day.\n\nPlease help the company to determine the optimal production quantity and machine allocation to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=10)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=10)  # number of units of product C\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for product A\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for product B\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for product C\n\n# Define objective function\nProfit_A = (100 - 50) * UnitsA - 2000 * MachinesA\nProfit_B = (140 - 70) * UnitsB - 3000 * MachinesB\nProfit_C = (180 - 90) * UnitsC - 4000 * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)  # Total machines constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)  # Total production capacity constraint\nmodel.addCons(2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000)  # Operational budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Machines for Product A: \", model.getVal(MachinesA))\n    print(\"Number of Machines for Product B: \", model.getVal(MachinesB))\n    print(\"Number of Machines for Product C: \", model.getVal(MachinesC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Trucks\": \"FuelTruck\", \"range\": \"FuelTruck > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Vans\": \"FuelVan\", \"range\": \"FuelVan > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Bikes\": \"FuelBike\", \"range\": \"FuelBike > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Trucks\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Vans\": \"MaintenanceVan\", \"range\": \"MaintenanceVan > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Bikes\": \"MaintenanceBike\", \"range\": \"MaintenanceBike > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes.\n// Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe number of Trucks must be at least half the number of Vans.\n// Trucks >= 0.5 * Vans",
        "question": "A logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The number of Trucks must be at least half the number of Vans. Please help the company to determine the optimal number of each type of vehicle to meet these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuelTruck = model.addVar(name=\"FuelTruck\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Trucks\nFuelVan = model.addVar(name=\"FuelVan\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Vans\nFuelBike = model.addVar(name=\"FuelBike\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Bikes\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Trucks\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Vans\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Bikes\n\n# Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000)\n# The total number of vehicles cannot exceed 50.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n# The number of Trucks must be at least half the number of Vans.\nmodel.addCons(Trucks >= 0.5 * Vans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide on the number of trucks for five different types of cargo (Refrigerated, Heavy, Standard, Light, and Hazardous).\n// {\"number of refrigerated trucks\": \"Refrigerated\", \"range\": \"Refrigerated >= 0\", \"type\": \"integer\"}\n// {\"number of heavy trucks\": \"Heavy\", \"range\": \"Heavy >= 0\", \"type\": \"integer\"}\n// {\"number of standard trucks\": \"Standard\", \"range\": \"Standard >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"Light\", \"range\": \"Light >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"Hazardous\", \"range\": \"Hazardous >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational cost, which includes fuel, maintenance, and driver salaries. The operational cost per truck is different for each type: $50,000 for Refrigerated, $40,000 for Heavy, $30,000 for Standard, $20,000 for Light, and $60,000 for Hazardous. The cost function is nonlinear due to economies of scale in maintenance and fuel efficiency.\n// Total operational cost: Cost = 50000 * Refrigerated^0.9 + 40000 * Heavy^0.9 + 30000 * Standard^0.9 + 20000 * Light^0.9 + 60000 * Hazardous^0.9\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// 50000 * Refrigerated + 40000 * Heavy + 30000 * Standard + 20000 * Light + 60000 * Hazardous <= 2000000\n\n## Generate Constraint-2:\nAt least 10 trucks of each type must be purchased.\n// Refrigerated >= 10\n// Heavy >= 10\n// Standard >= 10\n// Light >= 10\n// Hazardous >= 10\n\n## Generate Constraint-3:\nThe total number of trucks must not exceed 100.\n// Refrigerated + Heavy + Standard + Light + Hazardous <= 100\n\n## Generate Constraint-4:\nThe number of Hazardous trucks must not exceed 20% of the total fleet.\n// Hazardous <= 0.2 * (Refrigerated + Heavy + Standard + Light + Hazardous)",
        "question": "A logistics company is planning its fleet for the next year and needs to decide on the number of trucks for five different types of cargo: Refrigerated, Heavy, Standard, Light, and Hazardous. The company wants to minimize the total operational cost, which includes fuel, maintenance, and driver salaries. The operational cost per truck is different for each type: $50,000 for Refrigerated, $40,000 for Heavy, $30,000 for Standard, $20,000 for Light, and $60,000 for Hazardous. The cost function is nonlinear due to economies of scale in maintenance and fuel efficiency.\n\nThe company has a budget of $2,000,000 for purchasing trucks. At least 10 trucks of each type must be purchased. The total number of trucks must not exceed 100. Additionally, the number of Hazardous trucks must not exceed 20% of the total fleet.\n\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigerated = model.addVar(vtype=\"INTEGER\", name=\"Refrigerated\", lb=10)  # number of refrigerated trucks\nHeavy = model.addVar(vtype=\"INTEGER\", name=\"Heavy\", lb=10)  # number of heavy trucks\nStandard = model.addVar(vtype=\"INTEGER\", name=\"Standard\", lb=10)  # number of standard trucks\nLight = model.addVar(vtype=\"INTEGER\", name=\"Light\", lb=10)  # number of light trucks\nHazardous = model.addVar(vtype=\"INTEGER\", name=\"Hazardous\", lb=10)  # number of hazardous material trucks\n\n# Define objective function\n# The objective function is: Minimize Cost\n# Total operational cost: Cost = 50000 * Refrigerated^0.9 + 40000 * Heavy^0.9 + 30000 * Standard^0.9 + 20000 * Light^0.9 + 60000 * Hazardous^0.9\n# Convert the nonlinear objective to a linear one by introducing new variables and constraints\nRefrigerated_power = model.addVar(name=\"Refrigerated_power\")\nHeavy_power = model.addVar(name=\"Heavy_power\")\nStandard_power = model.addVar(name=\"Standard_power\")\nLight_power = model.addVar(name=\"Light_power\")\nHazardous_power = model.addVar(name=\"Hazardous_power\")\n\nmodel.addCons(Refrigerated_power == Refrigerated**0.9)\nmodel.addCons(Heavy_power == Heavy**0.9)\nmodel.addCons(Standard_power == Standard**0.9)\nmodel.addCons(Light_power == Light**0.9)\nmodel.addCons(Hazardous_power == Hazardous**0.9)\n\nCost = 50000 * Refrigerated_power + 40000 * Heavy_power + 30000 * Standard_power + 20000 * Light_power + 60000 * Hazardous_power\n\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * Refrigerated + 40000 * Heavy + 30000 * Standard + 20000 * Light + 60000 * Hazardous <= 2000000)\n\n# The total number of trucks must not exceed 100.\nmodel.addCons(Refrigerated + Heavy + Standard + Light + Hazardous <= 100)\n\n# The number of Hazardous trucks must not exceed 20% of the total fleet.\nmodel.addCons(Hazardous <= 0.2 * (Refrigerated + Heavy + Standard + Light + Hazardous))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(Refrigerated))\n    print(\"Number of Heavy Trucks: \", model.getVal(Heavy))\n    print(\"Number of Standard Trucks: \", model.getVal(Standard))\n    print(\"Number of Light Trucks: \", model.getVal(Light))\n    print(\"Number of Hazardous Trucks: \", model.getVal(Hazardous))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies.\n// {\"number of solar panels in RegionA\": \"SolarPanelsA\", \"range\": \"SolarPanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarPanelsB\", \"range\": \"SolarPanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarPanelsC\", \"range\": \"SolarPanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindTurbinesA\", \"range\": \"WindTurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindTurbinesB\", \"range\": \"WindTurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindTurbinesC\", \"range\": \"WindTurbinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The cost of electricity generated per unit decreases as efficiency increases. The company aims to minimize the total cost of electricity generation across all regions.\n// Total cost of electricity for solar panels in RegionA: Cost_SolarA = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsA\n// Total cost of electricity for solar panels in RegionB: Cost_SolarB = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsB\n// Total cost of electricity for solar panels in RegionC: Cost_SolarC = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsC\n// Total cost of electricity for wind turbines in RegionA: Cost_WindA = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesA\n// Total cost of electricity for wind turbines in RegionB: Cost_WindB = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesB\n// Total cost of electricity for wind turbines in RegionC: Cost_WindC = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesC\n// So, the objective function is: Minimize (Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for installation in each region.\n// SolarPanelsA + WindTurbinesA <= 1000\n// SolarPanelsB + WindTurbinesB <= 1000\n// SolarPanelsC + WindTurbinesC <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The cost of electricity generated per unit decreases as efficiency increases. The company aims to minimize the total cost of electricity generation across all regions. The company has a total budget of $1,000,000 for installation in each region. Please help the company to determine the optimal number of solar panels and wind turbines to install in each region and the appropriate investment in R&D to minimize the total cost of electricity generation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanelsA = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsA\", lb=0)\nSolarPanelsB = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsB\", lb=0)\nSolarPanelsC = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsC\", lb=0)\nWindTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesA\", lb=0)\nWindTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesB\", lb=0)\nWindTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesC\", lb=0)\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate costs with efficiency improvements\nEfficiency_Solar = 0.15 + 0.005 * RnDInvestment\nEfficiency_Wind = 0.25 + 0.007 * RnDInvestment\n\nCost_SolarA = (1 / Efficiency_Solar) * SolarPanelsA\nCost_SolarB = (1 / Efficiency_Solar) * SolarPanelsB\nCost_SolarC = (1 / Efficiency_Solar) * SolarPanelsC\nCost_WindA = (1 / Efficiency_Wind) * WindTurbinesA\nCost_WindB = (1 / Efficiency_Wind) * WindTurbinesB\nCost_WindC = (1 / Efficiency_Wind) * WindTurbinesC\n\n## the objective function is: Minimize (Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\nmodel.addCons(obj == Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\n\n# Add constraints\nmodel.addCons(SolarPanelsA + WindTurbinesA <= 1000)\nmodel.addCons(SolarPanelsB + WindTurbinesB <= 1000)\nmodel.addCons(SolarPanelsC + WindTurbinesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarPanelsA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarPanelsB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarPanelsC))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindTurbinesA))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindTurbinesB))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindTurbinesC))\n    print(\"Investment in R&D: \", model.getVal(RnDInvestment))\n    print(\"Minimized Total Cost of Electricity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the marketing budget for each product to enhance sales.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgA\", \"range\": \"MktgA >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductB\": \"MktgB\", \"range\": \"MktgB >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductC\": \"MktgC\", \"range\": \"MktgC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n// Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n// Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 2000 units across all products.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe total marketing budget must not exceed $20,000.\n// MktgA + MktgB + MktgC <= 20,000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA must be at least 20% of the total production.\n// ProdA >= 0.2 * (ProdA + ProdB + ProdC)\n\n## Generate Constraint-5:\nThe company aims to produce at least 500 units of ProductB.\n// ProdB >= 500",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the marketing budget for each product to maximize profit. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC.\n\nThe company has a total budget of $100,000 for raw materials and labor. The storage capacity is limited to 2000 units across all products. The total marketing budget must not exceed $20,000. Due to market demand, the production of ProductA must be at least 20% of the total production. The company aims to produce at least 500 units of ProductB.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMktgA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgA\", lb=0) # marketing budget for ProductA\nMktgB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgB\", lb=0) # marketing budget for ProductB\nMktgC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n## Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n## Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\nProfit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\nProfit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100000)\n## The storage capacity is limited to 2000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n## The total marketing budget must not exceed $20,000.\nmodel.addCons(MktgA + MktgB + MktgC <= 20000)\n## Due to market demand, the production of ProductA must be at least 20% of the total production.\nmodel.addCons(ProdA >= 0.2 * (ProdA + ProdB + ProdC))\n## The company aims to produce at least 500 units of ProductB.\nmodel.addCons(ProdB >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and wants to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company needs to decide how many trucks to allocate to each route to maximize efficiency and minimize fuel consumption.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks varies by route due to different road conditions and distances. On RouteA, each truck consumes 100 liters of fuel per trip. On RouteB, each truck consumes 120 liters of fuel per trip. On RouteC, each truck consumes 150 liters of fuel per trip. The company aims to minimize the total fuel consumption while ensuring that all routes are adequately serviced.\n// Total fuel consumption on RouteA: FuelA = 100 * TrucksA\n// Total fuel consumption on RouteB: FuelB = 120 * TrucksB\n// Total fuel consumption on RouteC: FuelC = 150 * TrucksC\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual obligations, RouteA must have at least 10 trucks.\n// TrucksA >= 10\n\n## Generate Constraint-3:\nThe company has a policy to ensure that RouteB has no more than twice the number of trucks as RouteA.\n// TrucksB <= 2 * TrucksA\n\n## Generate Constraint-4:\nTo maintain a balanced service level, RouteC should have at least half the number of trucks as RouteA.\n// TrucksC >= 0.5 * TrucksA",
        "question": "A logistics company operates a fleet of trucks and wants to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company needs to decide how many trucks to allocate to each route to maximize efficiency and minimize fuel consumption. The fuel consumption per truck varies by route as shown in the following Table.\n\n| Route   | Fuel Consumption per Truck (liters) |\n|---------|------------------------------------|\n| RouteA  | 100                                |\n| RouteB  | 120                                |\n| RouteC  | 150                                |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual obligations, RouteA must have at least 10 trucks. The company has a policy to ensure that RouteB has no more than twice the number of trucks as RouteA. To maintain a balanced service level, RouteC should have at least half the number of trucks as RouteA.\n\nPlease help the company to minimize the total fuel consumption while ensuring that all routes are adequately serviced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\nFuelA = 100 * TrucksA\nFuelB = 120 * TrucksB\nFuelC = 150 * TrucksC\n# So, the objective function is: Minimize (FuelA + FuelB + FuelC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The company has a policy to ensure that RouteB has no more than twice the number of trucks as RouteA.\nmodel.addCons(TrucksB <= 2 * TrucksA)\n# To maintain a balanced service level, RouteC should have at least half the number of trucks as RouteA.\nmodel.addCons(TrucksC >= 0.5 * TrucksA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $50, the cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the revenue per unit is $70, the cost per unit is $40, and the storage cost per unit is $7.\nFor ProductC, the revenue per unit is $90, the cost per unit is $50, and the storage cost per unit is $9.\nFor ProductD, the revenue per unit is $110, the cost per unit is $60, and the storage cost per unit is $11.\nThe company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - 30 - 5) * ProdA\n// Total net profit for ProductB: Profit_B = (70 - 40 - 7) * ProdB\n// Total net profit for ProductC: Profit_C = (90 - 50 - 9) * ProdC\n// Total net profit for ProductD: Profit_D = (110 - 60 - 11) * ProdD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProdA + ProdB + ProdC + ProdD <= 1000\n\n## Generate Constraint-2:\nDue to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA\n\n## Generate Constraint-3:\nThe company has a storage constraint where the total storage cost cannot exceed $8000 per month.\n// 5 * ProdA + 7 * ProdB + 9 * ProdC + 11 * ProdD <= 8000\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to meet contractual obligations.\n// ProdC >= 50\n\n## Generate Constraint-5:\nThe production of ProductD is limited by a special equipment that can only handle up to 100 units per month.\n// ProdD <= 100",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\nThe revenue per unit for ProductA is $50, the cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the revenue per unit is $70, the cost per unit is $40, and the storage cost per unit is $7.\nFor ProductC, the revenue per unit is $90, the cost per unit is $50, and the storage cost per unit is $9.\nFor ProductD, the revenue per unit is $110, the cost per unit is $60, and the storage cost per unit is $11.\nThe company has a total production capacity of 1000 units per month. Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA. The company has a storage constraint where the total storage cost cannot exceed $8000 per month. The company must produce at least 50 units of ProductC to meet contractual obligations. The production of ProductD is limited by a special equipment that can only handle up to 100 units per month.\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=0) # production quantity for ProductD\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * ProdA\nProfit_B = (70 - 40 - 7) * ProdB\nProfit_C = (90 - 50 - 9) * ProdC\nProfit_D = (110 - 60 - 11) * ProdD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(ProdA + ProdB + ProdC + ProdD <= 1000)\n# Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProdB <= 2 * ProdA)\n# The company has a storage constraint where the total storage cost cannot exceed $8000 per month.\nmodel.addCons(5 * ProdA + 7 * ProdB + 9 * ProdC + 11 * ProdD <= 8000)\n# The company must produce at least 50 units of ProductC to meet contractual obligations.\nmodel.addCons(ProdC >= 50)\n# The production of ProductD is limited by a special equipment that can only handle up to 100 units per month.\nmodel.addCons(ProdD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in routing software for Trucks\": \"SoftwareT\", \"range\": \"SoftwareT >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Vans\": \"SoftwareV\", \"range\": \"SoftwareV >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Bikes\": \"SoftwareB\", \"range\": \"SoftwareB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost for Trucks: CostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\n// Total operational cost for Vans: CostV = 500 * Vans - 0.3 * SoftwareV * Vans\n// Total operational cost for Bikes: CostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and software investments.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times.\nThe operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\nThe company has a budget of $1,000,000 for vehicle purchases and software investments.\nPlease help the company to determine the optimal number of each vehicle type to purchase and the investment in routing software to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nSoftwareT = model.addVar(name=\"SoftwareT\", lb=0)  # investment in routing software for Trucks\nSoftwareV = model.addVar(name=\"SoftwareV\", lb=0)  # investment in routing software for Vans\nSoftwareB = model.addVar(name=\"SoftwareB\", lb=0)  # investment in routing software for Bikes\n\n# Define objective function\nCostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\nCostV = 500 * Vans - 0.3 * SoftwareV * Vans\nCostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Routing Software for Trucks: \", model.getVal(SoftwareT))\n    print(\"Investment in Routing Software for Vans: \", model.getVal(SoftwareV))\n    print(\"Investment in Routing Software for Bikes: \", model.getVal(SoftwareB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1193,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck on Route A is $1000, minus a fuel cost of $200 and a maintenance cost of $100.\nThe profit per truck on Route B is $1200, minus a fuel cost of $250 and a maintenance cost of $150.\nThe profit per truck on Route C is $1500, minus a fuel cost of $300 and a maintenance cost of $200.\nThe profit per truck on Route D is $1800, minus a fuel cost of $350 and a maintenance cost of $250.\nThe profit per truck on Route E is $2000, minus a fuel cost of $400 and a maintenance cost of $300.\nThe company aims to maximize the total net profit from all routes.\n// Net_Profit_A = (1000 - 200 - 100) * Trucks_A\n// Net_Profit_B = (1200 - 250 - 150) * Trucks_B\n// Net_Profit_C = (1500 - 300 - 200) * Trucks_C\n// Net_Profit_D = (1800 - 350 - 250) * Trucks_D\n// Net_Profit_E = (2000 - 400 - 300) * Trucks_E\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nThe total fuel cost across all routes must not exceed $10,000.\n// 200 * Trucks_A + 250 * Trucks_B + 300 * Trucks_C + 350 * Trucks_D + 400 * Trucks_E <= 10000\n\n## Generate Constraint-3:\nThe total maintenance cost across all routes must not exceed $5000.\n// 100 * Trucks_A + 150 * Trucks_B + 200 * Trucks_C + 250 * Trucks_D + 300 * Trucks_E <= 5000\n\n## Generate Constraint-4:\nThe demand for Route A is at least 5 trucks.\n// Trucks_A >= 5",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route. The profit per truck, fuel cost, and maintenance cost for each route are given in the following Table.\n\n| Route | Profit per Truck | Fuel Cost | Maintenance Cost |\n|-------|------------------|-----------|------------------|\n| A     | $1000            | $200      | $100             |\n| B     | $1200            | $250      | $150             |\n| C     | $1500            | $300      | $200             |\n| D     | $1800            | $350      | $250             |\n| E     | $2000            | $400      | $300             |\n\nThe company has a total of 50 trucks available. The total fuel cost across all routes must not exceed $10,000. The total maintenance cost across all routes must not exceed $5000. The demand for Route A is at least 5 trucks. Please help the company to maximize the total net profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=5) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\") # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\") # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\") # number of trucks for Route D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\") # number of trucks for Route E\n\n# Define objective function\nNet_Profit_A = (1000 - 200 - 100) * Trucks_A\nNet_Profit_B = (1200 - 250 - 150) * Trucks_B\nNet_Profit_C = (1500 - 300 - 200) * Trucks_C\nNet_Profit_D = (1800 - 350 - 250) * Trucks_D\nNet_Profit_E = (2000 - 400 - 300) * Trucks_E\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n# The total fuel cost across all routes must not exceed $10,000.\nmodel.addCons(200 * Trucks_A + 250 * Trucks_B + 300 * Trucks_C + 350 * Trucks_D + 400 * Trucks_E <= 10000)\n# The total maintenance cost across all routes must not exceed $5000.\nmodel.addCons(100 * Trucks_A + 150 * Trucks_B + 200 * Trucks_C + 250 * Trucks_D + 300 * Trucks_E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Route E: \", model.getVal(Trucks_E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products (A, B, C, D, and E). The company needs to decide on the production quantities for each product to optimize its profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company wants to maximize the total profit from all products. However, the production process is nonlinear due to economies of scale and varying production efficiencies. The profit function is given by:\n// Profit = 50 * A^0.8 + 70 * B^0.7 + 60 * C^0.6 + 80 * D^0.5 + 90 * E^0.4\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 hours. The time required to produce one unit of A is 2 hours, of B is 3 hours, of C is 2.5 hours, of D is 4 hours, and of E is 3.5 hours.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500\n\n## Generate Constraint-2:\nThe company must produce at least 100 units of product A.\n// A >= 100\n\n## Generate Constraint-3:\nThe demand for product E is limited, and the company can only sell up to 200 units.\n// E <= 200",
        "question": "A manufacturing company produces five different products (A, B, C, D, and E). The company needs to decide on the production quantities for each product to optimize its profit while considering various constraints. The profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company wants to maximize the total profit from all products, which is given by the profit function: Profit = 50 * A^0.8 + 70 * B^0.7 + 60 * C^0.6 + 80 * D^0.5 + 90 * E^0.4. The company has a total production capacity of 1500 hours. The time required to produce one unit of A is 2 hours, of B is 3 hours, of C is 2.5 hours, of D is 4 hours, and of E is 3.5 hours. The company must produce at least 100 units of product A. The demand for product E is limited, and the company can only sell up to 200 units. Please help the company determine the optimal production quantities for each product to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of product E\n\n# Define objective function\n## The profit function is given by: Profit = 50 * A^0.8 + 70 * B^0.7 + 60 * C^0.6 + 80 * D^0.5 + 90 * E^0.4\n## Convert the nonlinear terms to linear terms using additional variables and constraints\nA_power = model.addVar(vtype=\"INTEGER\", name=\"A_power\")\nB_power = model.addVar(vtype=\"INTEGER\", name=\"B_power\")\nC_power = model.addVar(vtype=\"INTEGER\", name=\"C_power\")\nD_power = model.addVar(vtype=\"INTEGER\", name=\"D_power\")\nE_power = model.addVar(vtype=\"INTEGER\", name=\"E_power\")\nmodel.addCons(A_power == A**0.8)\nmodel.addCons(B_power == B**0.7)\nmodel.addCons(C_power == C**0.6)\nmodel.addCons(D_power == D**0.5)\nmodel.addCons(E_power == E**0.4)\n\nProfit = 50 * A_power + 70 * B_power + 60 * C_power + 80 * D_power + 90 * E_power\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500)\n## The company must produce at least 100 units of product A.\nmodel.addCons(A >= 100)\n## The demand for product E is limited, and the company can only sell up to 200 units.\nmodel.addCons(E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for device A is 0.01 * A^2, for device B is 0.02 * B^2, and for device C is 0.03 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs next month.\n// 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2 <= 5000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours per month. The production time for device A is 2 hours per unit, for device B is 3 hours per unit, and for device C is 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 200",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin. The profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for device A is 0.01 * A^2, for device B is 0.02 * B^2, and for device C is 0.03 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the production cost. The company has a budget of $5000 for production costs next month. The company also has a limited production capacity of 200 hours per month, with the production time for device A being 2 hours per unit, for device B being 3 hours per unit, and for device C being 4 hours per unit. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## Revenue and cost calculation\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## Objective function: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## The company has a budget of $5000 for production costs next month.\nmodel.addCons(0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2 <= 5000)\n## The company has a limited production capacity of 200 hours per month.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production costs and automation investments.\n// (100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// Automation <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n// ProdA <= 500; ProdB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductC are produced.\n// ProdC >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| ProductA | $100                            | $150                   |\n| ProductB | $150                            | $200                   |\n| ProductC | $200                            | $250                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The company has a total budget of $100,000 for production costs and automation investments. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units. The company must ensure that at least 100 units of ProductC are produced.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\nProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\nProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for production costs and automation investments.\nmodel.addCons((100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000)\n# The total investment in automation technology cannot exceed $20,000.\nmodel.addCons(Automation <= 20000)\n# Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\nmodel.addCons(ProdA <= 500)\nmodel.addCons(ProdB <= 400)\n# The company must ensure that at least 100 units of ProductC are produced.\nmodel.addCons(ProdC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1396,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency.\n// {\"deliveries of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor each delivery, the company incurs a fuel cost and time cost. The fuel consumption per delivery for P1 is 5 liters, for P2 is 6 liters, for P3 is 7 liters, for P4 is 8 liters, and for P5 is 9 liters. The time taken per delivery for P1 is 1 hour, for P2 is 2 hours, for P3 is 3 hours, for P4 is 4 hours, and for P5 is 5 hours. The company wants to minimize the total fuel consumption and time cost.\n// Fuel_Cost_P1 = 5 * P1\n// Fuel_Cost_P2 = 6 * P2\n// Fuel_Cost_P3 = 7 * P3\n// Fuel_Cost_P4 = 8 * P4\n// Fuel_Cost_P5 = 9 * P5\n// Time_Cost_P1 = 1 * P1\n// Time_Cost_P2 = 2 * P2\n// Time_Cost_P3 = 3 * P3\n// Time_Cost_P4 = 4 * P4\n// Time_Cost_P5 = 5 * P5\n// So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters.\n// 5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000\n\n## Generate Constraint-2:\nThe company has a total time budget of 500 hours.\n// P1 + 2 * P2 + 3 * P3 + 4 * P4 + 5 * P5 <= 500",
        "question": "A logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency. For each delivery, the company incurs a fuel cost and time cost. The fuel consumption per delivery for P1 is 5 liters, for P2 is 6 liters, for P3 is 7 liters, for P4 is 8 liters, and for P5 is 9 liters. The time taken per delivery for P1 is 1 hour, for P2 is 2 hours, for P3 is 3 hours, for P4 is 4 hours, and for P5 is 5 hours. The company has a total fuel budget of 1000 liters and a total time budget of 500 hours. Please help the company to minimize the total fuel consumption and time cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # deliveries of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # deliveries of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # deliveries of P3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # deliveries of P4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # deliveries of P5\n\n# Define objective function\nFuel_Cost_P1 = 5 * P1\nFuel_Cost_P2 = 6 * P2\nFuel_Cost_P3 = 7 * P3\nFuel_Cost_P4 = 8 * P4\nFuel_Cost_P5 = 9 * P5\nTime_Cost_P1 = 1 * P1\nTime_Cost_P2 = 2 * P2\nTime_Cost_P3 = 3 * P3\nTime_Cost_P4 = 4 * P4\nTime_Cost_P5 = 5 * P5\n# So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5 + Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n# Add constraints\n# The company has a total fuel budget of 1000 liters.\nmodel.addCons(5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000)\n# The company has a total time budget of 500 hours.\nmodel.addCons(P1 + 2 * P2 + 3 * P3 + 4 * P4 + 5 * P5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Deliveries of P1: \", model.getVal(P1))\n    print(\"Deliveries of P2: \", model.getVal(P2))\n    print(\"Deliveries of P3: \", model.getVal(P3))\n    print(\"Deliveries of P4: \", model.getVal(P4))\n    print(\"Deliveries of P5: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include three types of vehicles: small, medium, and large trucks. The company needs to determine the number of each type of truck to purchase and the associated operational costs and revenue per trip.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"operational cost per trip for small trucks\": \"CostSmall\", \"range\": \"CostSmall >= 0\", \"type\": \"real\"}\n// {\"operational cost per trip for medium trucks\": \"CostMedium\", \"range\": \"CostMedium >= 0\", \"type\": \"real\"}\n// {\"operational cost per trip for large trucks\": \"CostLarge\", \"range\": \"CostLarge >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for small trucks\": \"RevenueSmall\", \"range\": \"RevenueSmall >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for medium trucks\": \"RevenueMedium\", \"range\": \"RevenueMedium >= 0\", \"type\": \"real\"}\n// {\"revenue per trip for large trucks\": \"RevenueLarge\", \"range\": \"RevenueLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit, which is the total revenue from all trips minus the total operational costs.\n// TotalRevenue = RevenueSmall * SmallTrucks + RevenueMedium * MediumTrucks + RevenueLarge * LargeTrucks\n// TotalCost = CostSmall * SmallTrucks + CostMedium * MediumTrucks + CostLarge * LargeTrucks\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-3:\nThe company must have at least 20 large trucks to fulfill a contract.\n// LargeTrucks >= 20\n\n## Generate Constraint-4:\nThe operational cost per trip for each type of truck is a nonlinear function of the number of trucks of that type.\n// CostSmall = a * (SmallTrucks)^2 + b * SmallTrucks + c\n// CostMedium = d * (MediumTrucks)^2 + e * MediumTrucks + f\n// CostLarge = g * (LargeTrucks)^2 + h * LargeTrucks + i\n\n## Generate Constraint-5:\nThe revenue per trip for each type of truck is also a nonlinear function of the number of trucks of that type.\n// RevenueSmall = j * (SmallTrucks)^2 + k * SmallTrucks + l\n// RevenueMedium = m * (MediumTrucks)^2 + n * MediumTrucks + o\n// RevenueLarge = p * (LargeTrucks)^2 + q * LargeTrucks + r",
        "question": "A logistics company is planning its fleet expansion to include three types of vehicles: small, medium, and large trucks. The company needs to determine the number of each type of truck to purchase and the associated operational costs and revenue per trip. The operational cost and revenue per trip for each type of truck are nonlinear functions of the number of trucks of that type, as shown in the following Table.\n\n| Vehicle Type | Operational Cost Function | Revenue Function |\n|--------------|---------------------------|------------------|\n| Small Trucks | CostSmall = a * (SmallTrucks)^2 + b * SmallTrucks + c | RevenueSmall = j * (SmallTrucks)^2 + k * SmallTrucks + l |\n| Medium Trucks | CostMedium = d * (MediumTrucks)^2 + e * MediumTrucks + f | RevenueMedium = m * (MediumTrucks)^2 + n * MediumTrucks + o |\n| Large Trucks | CostLarge = g * (LargeTrucks)^2 + h * LargeTrucks + i | RevenueLarge = p * (LargeTrucks)^2 + q * LargeTrucks + r |\n\nThe company has a budget of $200,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The company must have at least 20 large trucks to fulfill a contract. The company aims to maximize its net profit, which is the total revenue from all trips minus the total operational costs.\n\nPlease help the company determine the optimal number of small, medium, and large trucks to purchase to maximize net profit while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=20)  # At least 20 large trucks\n\n# Define nonlinear functions for operational costs and revenues\na, b, c = model.addVar(name=\"a\"), model.addVar(name=\"b\"), model.addVar(name=\"c\")\nd, e, f = model.addVar(name=\"d\"), model.addVar(name=\"e\"), model.addVar(name=\"f\")\ng, h, i = model.addVar(name=\"g\"), model.addVar(name=\"h\"), model.addVar(name=\"i\")\nj, k, l = model.addVar(name=\"j\"), model.addVar(name=\"k\"), model.addVar(name=\"l\")\nm, n, o = model.addVar(name=\"m\"), model.addVar(name=\"n\"), model.addVar(name=\"o\")\np, q, r = model.addVar(name=\"p\"), model.addVar(name=\"q\"), model.addVar(name=\"r\")\n\n# Define objective function\nTotalRevenue = j * SmallTrucks**2 + k * SmallTrucks + l + m * MediumTrucks**2 + n * MediumTrucks + o + p * LargeTrucks**2 + q * LargeTrucks + r\nTotalCost = a * SmallTrucks**2 + b * SmallTrucks + c + d * MediumTrucks**2 + e * MediumTrucks + f + g * LargeTrucks**2 + h * LargeTrucks + i\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\nPriceSmall, PriceMedium, PriceLarge = model.addVar(name=\"PriceSmall\"), model.addVar(name=\"PriceMedium\"), model.addVar(name=\"PriceLarge\")\nmodel.addCons(SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge <= 200000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1409,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily to maximize energy production. Additionally, the company is considering investing in energy storage systems for each type of power plant to enhance efficiency and stability of power output.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Solar\": \"SolarStorage\", \"range\": \"SolarStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Wind\": \"WindStorage\", \"range\": \"WindStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Hydro\": \"HydroStorage\", \"range\": \"HydroStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company aims to maximize the total daily energy production.\n// Total energy for Solar: EnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\n// Total energy for Wind: EnergyWind = (120 + 0.0008 * WindStorage) * WindHours\n// Total energy for Hydro: EnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and energy storage investments.\n// 1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all power plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24\n\n## Generate Constraint-3:\nDue to maintenance schedules, the Solar power plant must operate at least 2 hours per day, the Wind power plant at least 3 hours, and the Hydro power plant at least 4 hours.\n// SolarHours >= 2; WindHours >= 3; HydroHours >= 4",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily and the investment in energy storage systems for each type to maximize energy production. The relationship between investment in energy storage and energy output for each power plant is given in the following Table.\n\n| Power Plant | Energy Output Increase per $1000 Investment |\n|-------------|--------------------------------------------|\n| Solar       | 1 MWh per hour of operation                |\n| Wind        | 0.8 MWh per hour of operation              |\n| Hydro       | 1.2 MWh per hour of operation              |\n\nThe company has a total budget of $100,000 for operating costs and energy storage investments. The total operating hours for all power plants must not exceed 24 hours per day. Due to maintenance schedules, the Solar power plant must operate at least 2 hours per day, the Wind power plant at least 3 hours, and the Hydro power plant at least 4 hours.\n\nPlease help the company to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=2)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=3)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=4)  # number of operating hours for Hydro\nSolarStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarStorage\", lb=0)  # investment in energy storage for Solar\nWindStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"WindStorage\", lb=0)  # investment in energy storage for Wind\nHydroStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroStorage\", lb=0)  # investment in energy storage for Hydro\n\n# Define objective function\nEnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\nEnergyWind = (120 + 0.0008 * WindStorage) * WindHours\nEnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Solar Storage: \", model.getVal(SolarStorage))\n    print(\"Investment in Wind Storage: \", model.getVal(WindStorage))\n    print(\"Investment in Hydro Storage: \", model.getVal(HydroStorage))\n    print(\"Total Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): compact, mid-size, and luxury. The company needs to decide on the production quantities of each type of EV to maximize profit while considering various constraints.\n// {\"quantity of compact EVs\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of mid-size EVs\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"quantity of luxury EVs\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for compact EVs is $10,000, for mid-size EVs is $15,000, and for luxury EVs is $20,000. The production cost per unit for compact EVs is $5,000, for mid-size EVs is $10,000, and for luxury EVs is $15,000. The company aims to maximize the total profit.\n// Profit_C = (10000 - 5000) * C = 5000 * C\n// Profit_M = (15000 - 10000) * M = 5000 * M\n// Profit_L = (20000 - 15000) * L = 5000 * L\n// So, the objective function is: Maximize (5000 * C + 5000 * M + 5000 * L)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1500 hours. The production time for compact EVs is 10 hours, for mid-size EVs is 15 hours, and for luxury EVs is 20 hours.\n// 10 * C + 15 * M + 20 * L <= 1500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for production costs.\n// 5000 * C + 10000 * M + 15000 * L <= 1000000\n\n## Generate Constraint-3:\nThe market demand for compact EVs is 50 units, for mid-size EVs is 75 units, and for luxury EVs is 100 units.\n// C <= 50\n// M <= 75\n// L <= 100",
        "question": "A manufacturer produces three types of electric vehicles (EVs): compact, mid-size, and luxury. The company needs to decide on the production quantities of each type of EV to maximize profit while considering various constraints. The profit per unit for compact EVs is $10,000, for mid-size EVs is $15,000, and for luxury EVs is $20,000. The production cost per unit for compact EVs is $5,000, for mid-size EVs is $10,000, and for luxury EVs is $15,000. The company has a limited production capacity of 1500 hours. The production time for compact EVs is 10 hours, for mid-size EVs is 15 hours, and for luxury EVs is 20 hours. The company has a budget of $1,000,000 for production costs. The market demand for compact EVs is 50 units, for mid-size EVs is 75 units, and for luxury EVs is 100 units.\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of compact EVs\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # quantity of mid-size EVs\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # quantity of luxury EVs\n\n# Define objective function\nProfit_C = 5000 * C\nProfit_M = 5000 * M\nProfit_L = 5000 * L\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (5000 * C + 5000 * M + 5000 * L)\nmodel.addCons(obj == Profit_C + Profit_M + Profit_L)\n\n# Add constraints\n## The company has a limited production capacity of 1500 hours.\nmodel.addCons(10 * C + 15 * M + 20 * L <= 1500)\n## The company has a budget of $1,000,000 for production costs.\nmodel.addCons(5000 * C + 10000 * M + 15000 * L <= 1000000)\n## The market demand for compact EVs is 50 units, for mid-size EVs is 75 units, and for luxury EVs is 100 units.\nmodel.addCons(C <= 50)\nmodel.addCons(M <= 75)\nmodel.addCons(L <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Compact EVs: \", model.getVal(C))\n    print(\"Quantity of Mid-size EVs: \", model.getVal(M))\n    print(\"Quantity of Luxury EVs: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, the number of workers to allocate for each device, and the amount of investment in automation technology to reduce labor costs. The labor cost reduction per unit is affected by the investment in automation technology.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit for DeviceA is $50, for DeviceB is $60, and for DeviceC is $70. The revenue per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $140. The investment in automation technology reduces the labor cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (100 - 50 + 0.0001 * Automation) * UnitsA - WorkersA * 20\n// Total profit for DeviceB: ProfitB = (120 - 60 + 0.0001 * Automation) * UnitsB - WorkersB * 20\n// Total profit for DeviceC: ProfitC = (140 - 70 + 0.0001 * Automation) * UnitsC - WorkersC * 20\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nThe number of workers allocated to each device must not exceed the number of units produced by that device.\n// WorkersA <= UnitsA; WorkersB <= UnitsB; WorkersC <= UnitsC",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, the number of workers to allocate for each device, and the amount of investment in automation technology to reduce labor costs. The labor cost per unit for DeviceA is $50, for DeviceB is $60, and for DeviceC is $70. The revenue per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $140. The investment in automation technology reduces the labor cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all devices.\n\nThe company has a total of 100 workers available. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB. The number of workers allocated to each device must not exceed the number of units produced by that device.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for DeviceA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for DeviceB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * Automation) * UnitsA - WorkersA * 20\nProfitB = (120 - 60 + 0.0001 * Automation) * UnitsB - WorkersB * 20\nProfitC = (140 - 70 + 0.0001 * Automation) * UnitsC - WorkersC * 20\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)  # total workers constraint\nmodel.addCons(Automation <= 50000)  # investment constraint\nmodel.addCons(WorkersA <= UnitsA)  # workers for DeviceA constraint\nmodel.addCons(WorkersB <= UnitsB)  # workers for DeviceB constraint\nmodel.addCons(WorkersC <= UnitsC)  # workers for DeviceC constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for DeviceA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for DeviceB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for DeviceC: \", model.getVal(WorkersC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. Each product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate). The company has a budget of $1500 for raw materials.\nPlease help the company to determine the optimal production quantities for products A, B, C, D, and E to maximize the total profit per unit of time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install a network of electric vehicle charging stations across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E). The city needs to determine the number of charging stations to install in each zone and the cost of installation per station.\n// {\"number of charging stations in Zone A\": \"ZoneA_Stations\", \"range\": \"ZoneA_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone B\": \"ZoneB_Stations\", \"range\": \"ZoneB_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone C\": \"ZoneC_Stations\", \"range\": \"ZoneC_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone D\": \"ZoneD_Stations\", \"range\": \"ZoneD_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone E\": \"ZoneE_Stations\", \"range\": \"ZoneE_Stations >= 0\", \"type\": \"integer\"}\n// {\"cost of installation per station in each zone\": \"InstallationCost\", \"range\": \"InstallationCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city aims to minimize the total cost of installation while ensuring adequate coverage. The cost of installation per station varies by zone and is influenced by the complexity of electrical infrastructure required. The total installation cost is the sum of the product of the number of stations and the installation cost per station in each zone.\n// Total_Cost = ZoneA_Stations * InstallationCost + ZoneB_Stations * InstallationCost + ZoneC_Stations * InstallationCost + ZoneD_Stations * InstallationCost + ZoneE_Stations * InstallationCost\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the entire installation project.\n// ZoneA_Stations * InstallationCost + ZoneB_Stations * InstallationCost + ZoneC_Stations * InstallationCost + ZoneD_Stations * InstallationCost + ZoneE_Stations * InstallationCost <= 1000000\n\n## Generate Constraint-2:\nEach zone must have at least 10 charging stations.\n// ZoneA_Stations >= 10\n// ZoneB_Stations >= 10\n// ZoneC_Stations >= 10\n// ZoneD_Stations >= 10\n// ZoneE_Stations >= 10\n\n## Generate Constraint-3:\nThe total number of charging stations across all zones should not exceed 100.\n// ZoneA_Stations + ZoneB_Stations + ZoneC_Stations + ZoneD_Stations + ZoneE_Stations <= 100\n\n## Generate Constraint-4:\nThe installation cost per station in Zone A is twice that of Zone B, Zone C is 1.5 times that of Zone B, Zone D is the same as Zone B, and Zone E is 0.8 times that of Zone B.\n// InstallationCost_ZoneA = 2 * InstallationCost_ZoneB\n// InstallationCost_ZoneC = 1.5 * InstallationCost_ZoneB\n// InstallationCost_ZoneD = InstallationCost_ZoneB\n// InstallationCost_ZoneE = 0.8 * InstallationCost_ZoneB\n// This constraint ensures that the installation costs are consistent with the specified ratios.",
        "question": "A city is planning to install a network of electric vehicle charging stations across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E). The city needs to determine the number of charging stations to install in each zone and the cost of installation per station. The cost of installation per station varies by zone and is influenced by the complexity of electrical infrastructure required. The city aims to minimize the total cost of installation while ensuring adequate coverage. The total installation cost is the sum of the product of the number of stations and the installation cost per station in each zone.\n\nThe city has a budget of $1,000,000 for the entire installation project. Each zone must have at least 10 charging stations. The total number of charging stations across all zones should not exceed 100. The installation cost per station in Zone A is twice that of Zone B, Zone C is 1.5 times that of Zone B, Zone D is the same as Zone B, and Zone E is 0.8 times that of Zone B.\n\nPlease help the city to minimize the total cost of installation while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneA_Stations\", lb=10)\nZoneB_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneB_Stations\", lb=10)\nZoneC_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneC_Stations\", lb=10)\nZoneD_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneD_Stations\", lb=10)\nZoneE_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneE_Stations\", lb=10)\nInstallationCost_ZoneB = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneB\", lb=0)\nInstallationCost_ZoneA = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneA\")\nInstallationCost_ZoneC = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneC\")\nInstallationCost_ZoneD = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneD\")\nInstallationCost_ZoneE = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneE\")\n\n# Define objective function\nTotal_Cost = ZoneA_Stations * InstallationCost_ZoneA + ZoneB_Stations * InstallationCost_ZoneB + ZoneC_Stations * InstallationCost_ZoneC + ZoneD_Stations * InstallationCost_ZoneD + ZoneE_Stations * InstallationCost_ZoneE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\nmodel.addCons(ZoneA_Stations * InstallationCost_ZoneA + ZoneB_Stations * InstallationCost_ZoneB + ZoneC_Stations * InstallationCost_ZoneC + ZoneD_Stations * InstallationCost_ZoneD + ZoneE_Stations * InstallationCost_ZoneE <= 1000000)\nmodel.addCons(ZoneA_Stations + ZoneB_Stations + ZoneC_Stations + ZoneD_Stations + ZoneE_Stations <= 100)\nmodel.addCons(InstallationCost_ZoneA == 2 * InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneC == 1.5 * InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneD == InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneE == 0.8 * InstallationCost_ZoneB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Charging Stations in Zone A: \", model.getVal(ZoneA_Stations))\n    print(\"Number of Charging Stations in Zone B: \", model.getVal(ZoneB_Stations))\n    print(\"Number of Charging Stations in Zone C: \", model.getVal(ZoneC_Stations))\n    print(\"Number of Charging Stations in Zone D: \", model.getVal(ZoneD_Stations))\n    print(\"Number of Charging Stations in Zone E: \", model.getVal(ZoneE_Stations))\n    print(\"Installation Cost per Station in Zone B: \", model.getVal(InstallationCost_ZoneB))\n    print(\"Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The variables include the number of trucks for each route (Route A, Route B, Route C, Route D, and Route D) and the average speed at which each truck should travel on its respective route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n// {\"average speed for Route A\": \"Speed_A\", \"range\": \"Speed_A > 0\", \"type\": \"real\"}\n// {\"average speed for Route B\": \"Speed_B\", \"range\": \"Speed_B > 0\", \"type\": \"real\"}\n// {\"average speed for Route C\": \"Speed_C\", \"range\": \"Speed_C > 0\", \"type\": \"real\"}\n// {\"average speed for Route D\": \"Speed_D\", \"range\": \"Speed_D > 0\", \"type\": \"real\"}\n// {\"average speed for Route E\": \"Speed_E\", \"range\": \"Speed_E > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are modeled as a nonlinear function of the number of trucks and their average speeds. The company aims to minimize the total cost of operation, which includes fuel and maintenance costs. The cost function is given by:\n// Cost_A = Trucks_A * (Speed_A^2 + 0.1 * Speed_A)\n// Cost_B = Trucks_B * (Speed_B^2 + 0.1 * Speed_B)\n// Cost_C = Trucks_C * (Speed_C^2 + 0.1 * Speed_C)\n// Cost_D = Trucks_D * (Speed_D^2 + 0.1 * Speed_D)\n// Cost_E = Trucks_E * (Speed_E^2 + 0.1 * Speed_E)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across all routes.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nEach route must be covered by at least one truck.\n// Trucks_A >= 1; Trucks_B >= 1; Trucks_C >= 1; Trucks_D >= 1; Trucks_E >= 1",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to determine the optimal number of trucks to allocate to each route (Route A, Route B, Route C, Route D, and Route E) and the average speed at which each truck should travel on its respective route to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The fuel consumption and maintenance costs are modeled as a nonlinear function of the number of trucks and their average speeds. The company aims to minimize the total cost of operation, which includes fuel and maintenance costs. The company has a total of 50 trucks available for allocation across all routes, and each route must be covered by at least one truck. Please help the company to minimize the total cost of operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=1)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=1)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=1)  # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=1)  # number of trucks for Route D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=1)  # number of trucks for Route E\nSpeed_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_A\", lb=0)  # average speed for Route A\nSpeed_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_B\", lb=0)  # average speed for Route B\nSpeed_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_C\", lb=0)  # average speed for Route C\nSpeed_D = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_D\", lb=0)  # average speed for Route D\nSpeed_E = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_E\", lb=0)  # average speed for Route E\n\n# Define objective function\nCost_A = Trucks_A * (Speed_A**2 + 0.1 * Speed_A)\nCost_B = Trucks_B * (Speed_B**2 + 0.1 * Speed_B)\nCost_C = Trucks_C * (Speed_C**2 + 0.1 * Speed_C)\nCost_D = Trucks_D * (Speed_D**2 + 0.1 * Speed_D)\nCost_E = Trucks_E * (Speed_E**2 + 0.1 * Speed_E)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Route E: \", model.getVal(Trucks_E))\n    print(\"Average Speed for Route A: \", model.getVal(Speed_A))\n    print(\"Average Speed for Route B: \", model.getVal(Speed_B))\n    print(\"Average Speed for Route C: \", model.getVal(Speed_C))\n    print(\"Average Speed for Route D: \", model.getVal(Speed_D))\n    print(\"Average Speed for Route E: \", model.getVal(Speed_E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company wants to maximize the total profit per day.\n// Profit_GoodA = (1000 - 500) * TrucksA\n// Profit_GoodB = (1200 - 600) * TrucksB\n// Profit_GoodC = (1400 - 700) * TrucksC\n// Profit_GoodD = (1600 - 800) * TrucksD\n// Profit_GoodE = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company wants to maximize the total profit per day.\nThe company has a total of 50 trucks available for distribution. Due to regional regulations, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nPlease help the company to determine the optimal allocation of trucks to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nProfit_GoodA = (1000 - 500) * TrucksA\nProfit_GoodB = (1200 - 600) * TrucksB\nProfit_GoodC = (1400 - 700) * TrucksC\nProfit_GoodD = (1600 - 800) * TrucksD\nProfit_GoodE = (1800 - 900) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility.\n// {\"number of solar facilities\": \"SolarFacilities\", \"range\": \"SolarFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"WindFacilities\", \"range\": \"WindFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"HydroFacilities\", \"range\": \"HydroFacilities >= 0\", \"type\": \"integer\"}\n// {\"land required for each solar facility (in acres)\": \"LandPerSolarFacility\", \"range\": \"LandPerSolarFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each wind facility (in acres)\": \"LandPerWindFacility\", \"range\": \"LandPerWindFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each hydro facility (in acres)\": \"LandPerHydroFacility\", \"range\": \"LandPerHydroFacility >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to maximize the total annual energy output from these facilities. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe objective is to maximize the total energy output, which is a nonlinear function of the number of facilities and the land required.\n// TotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\n// So, the objective function is: Maximize TotalEnergyOutput\n\n## Generate Constraint-1:\nThe city has a total of 1000 acres of land available for these facilities.\n// SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $5 million for construction costs, with costs per facility as follows:\n- Solar: $1 million\n- Wind: $1.5 million\n- Hydro: $2 million\n// 1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000\n\n## Generate Constraint-3:\nThe city aims to have at least 50% of its energy needs met by these renewable sources. The city's total annual energy consumption is 10,000 MWh.\n// (1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities) >= 0.5 * 10000",
        "question": "A city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility. The energy output per facility and the construction costs are given in the following Table.\n\n| Facility Type | Energy Output per Facility (MWh/year) | Construction Cost per Facility ($) |\n|---------------|--------------------------------------|------------------------------------|\n| Solar         | 1000                                 | 1,000,000                          |\n| Wind          | 1500                                 | 1,500,000                          |\n| Hydro         | 2000                                 | 2,000,000                          |\n\nThe city has a total of 1000 acres of land available for these facilities. The city has a budget of $5 million for construction costs. The city aims to have at least 50% of its energy needs met by these renewable sources, with a total annual energy consumption of 10,000 MWh.\n\nPlease help the city to maximize the total annual energy output from these facilities, considering the constraints on land and budget, and ensuring that at least 50% of the city's energy needs are met by renewable sources.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarFacilities = model.addVar(vtype=\"INTEGER\", name=\"SolarFacilities\", lb=0)\nWindFacilities = model.addVar(vtype=\"INTEGER\", name=\"WindFacilities\", lb=0)\nHydroFacilities = model.addVar(vtype=\"INTEGER\", name=\"HydroFacilities\", lb=0)\nLandPerSolarFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerSolarFacility\", lb=0)\nLandPerWindFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerWindFacility\", lb=0)\nLandPerHydroFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerHydroFacility\", lb=0)\n\n# Define objective function\nTotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalEnergyOutput)\n\n# Add constraints\n# The city has a total of 1000 acres of land available for these facilities.\nmodel.addCons(SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000)\n# The city has a budget of $5 million for construction costs, with costs per facility as follows:\nmodel.addCons(1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000)\n# The city aims to have at least 50% of its energy needs met by these renewable sources.\nmodel.addCons(1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities >= 0.5 * 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(SolarFacilities))\n    print(\"Number of Wind Facilities: \", model.getVal(WindFacilities))\n    print(\"Number of Hydro Facilities: \", model.getVal(HydroFacilities))\n    print(\"Land Required for Each Solar Facility: \", model.getVal(LandPerSolarFacility))\n    print(\"Land Required for Each Wind Facility: \", model.getVal(LandPerWindFacility))\n    print(\"Land Required for Each Hydro Facility: \", model.getVal(LandPerHydroFacility))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and consumes 5 liters of fuel per 100 km. Each Van can carry 500 kg and consumes 3 liters of fuel per 100 km. Each Bike can carry 100 kg and consumes 1 liter of fuel per 100 km. The company aims to maximize the total carrying capacity while minimizing the total fuel consumption. The efficiency is defined as the ratio of total carrying capacity to total fuel consumption.\n// Total carrying capacity = 1000 * T + 500 * V + 100 * B\n// Total fuel consumption = 5 * T + 3 * V + 1 * B\n// So, the objective function is: Maximize (1000 * T + 500 * V + 100 * B) / (5 * T + 3 * V + 1 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for purchasing vehicles. The cost of a Truck is $5000, a Van is $3000, and a Bike is $1000.\n// 5000 * T + 3000 * V + 1000 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 15000 kg.\n// 1000 * T + 500 * V + 100 * B <= 15000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The carrying capacity and fuel consumption per 100 km for each vehicle type are given in the following Table.\n\n| Vehicle | Carrying Capacity (kg) | Fuel Consumption (liters/100 km) |\n|---------|------------------------|---------------------------------|\n| Truck   | 1000                   | 5                               |\n| Van     | 500                    | 3                               |\n| Bike    | 100                    | 1                               |\n\nThe company has a budget of $10,000 for purchasing vehicles. The cost of a Truck is $5000, a Van is $3000, and a Bike is $1000. The company has a storage capacity of 15000 kg. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. \nPlease help the company to maximize the efficiency, which is defined as the ratio of the total carrying capacity to the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 1000 * T + 500 * V + 100 * B\nTotalFuelConsumption = 5 * T + 3 * V + 1 * B\n## the objective function is: Maximize (1000 * T + 500 * V + 100 * B) / (5 * T + 3 * V + 1 * B)\n## convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $10,000 for purchasing vehicles.\nmodel.addCons(5000 * T + 3000 * V + 1000 * B <= 10000)\n## The company has a storage capacity of 15000 kg.\nmodel.addCons(1000 * T + 500 * V + 100 * B <= 15000)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"VanTech\", \"range\": \"VanTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"BikeTech\", \"range\": \"BikeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in fuel-efficient technology. The cost reduction is nonlinear, with diminishing returns as more technology is invested.\nThe operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology.\nThe operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology.\nThe operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology.\nThe company aims to minimize the total operational cost of all vehicles.\n// Total cost for Trucks: CostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\n// Total cost for Vans: CostVan = 70 * VanCount - 0.07 * VanTech * VanCount\n// Total cost for Bikes: CostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle purchases and technology investments.\n// TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs. The operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology. The operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology. The operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology. The company aims to minimize the total operational cost of all vehicles. The company has a total budget of $10,000 for vehicle purchases and technology investments. Please help the company to determine the optimal number of each type of vehicle and the appropriate investment in fuel-efficient technologies to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for Trucks\nVanTech = model.addVar(vtype=\"CONTINUOUS\", name=\"VanTech\", lb=0)  # investment in fuel-efficient technology for Vans\nBikeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeTech\", lb=0)  # investment in fuel-efficient technology for Bikes\n\n# Define objective function\nCostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\nCostVan = 70 * VanCount - 0.07 * VanTech * VanCount\nCostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Van Tech: \", model.getVal(VanTech))\n    print(\"Investment in Bike Tech: \", model.getVal(BikeTech))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1064,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency upgrades for each truck type.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for each truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost.\n// Fuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\n// Fuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\n// Fuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\n// Fuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\n// Fuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $10,000.\n// FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) <= 10,000\n\n## Generate Constraint-3:\nDue to regional regulations, Region A must have at least 20% of the total trucks.\n// Trucks_A >= 0.2 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-4:\nThe company aims to ensure that each region has at least one truck.\n// Trucks_A >= 1; Trucks_B >= 1; Trucks_C >= 1; Trucks_D >= 1; Trucks_E >= 1\n\n## Generate Constraint-5:\nThe fuel efficiency upgrade cost per truck is $100.\n// FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) * 100 <= 10,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency upgrades for each truck type. The cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost. The company has a total of 100 trucks available. The total budget for fuel efficiency upgrades is $10,000. Due to regional regulations, Region A must have at least 20% of the total trucks. The company aims to ensure that each region has at least one truck. The fuel efficiency upgrade cost per truck is $100. Please help the company to determine the optimal allocation of trucks and the appropriate fuel efficiency upgrades to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=1)  # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=1)  # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=1)  # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=1)  # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=1)  # number of trucks for Region E\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0)  # fuel efficiency upgrade for each truck\n\n# Define objective function\nFuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\nFuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\nFuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\nFuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\nFuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n# So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100)\n# The total budget for fuel efficiency upgrades is $10,000.\nmodel.addCons(FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) <= 10000)\n# Due to regional regulations, Region A must have at least 20% of the total trucks.\nmodel.addCons(Trucks_A >= 0.2 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E))\n# The fuel efficiency upgrade cost per truck is $100.\nmodel.addCons(FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) * 100 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Fuel Efficiency Upgrade: \", model.getVal(FuelUpgrade))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day.\nThe medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day.\nThe large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day.\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries.\n// Profit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily budget for vehicle operations is $3000.\n// 100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 20 vehicles available.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 20",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand. The characteristics of each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Capacity (kg) | Operational Cost ($/day) |\n|--------------|-----------------------|---------------|--------------------------|\n| Small        | 20                    | 500           | 100                      |\n| Medium       | 15                    | 1000          | 150                      |\n| Large        | 10                    | 2000          | 200                      |\n\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries. The total daily budget for vehicle operations is $3000. The company has a total of 20 vehicles available. Please help the company to determine the optimal number of each vehicle type to deploy for maximizing daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nProfit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total daily budget for vehicle operations is $3000.\nmodel.addCons(100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000)\n## The company has a total of 20 vehicles available.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods (GoodA, GoodB, and GoodC) across five regions. The company needs to determine the number of trucks to allocate for each type of good in each region. The company also needs to decide on the fuel efficiency (in miles per gallon) of each truck type.\n// {\"number of trucks for GoodA in Region1\": \"TruckA_R1\", \"range\": \"TruckA_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region2\": \"TruckA_R2\", \"range\": \"TruckA_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region3\": \"TruckA_R3\", \"range\": \"TruckA_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region4\": \"TruckA_R4\", \"range\": \"TruckA_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region5\": \"TruckA_R5\", \"range\": \"TruckA_R5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region1\": \"TruckB_R1\", \"range\": \"TruckB_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region2\": \"TruckB_R2\", \"range\": \"TruckB_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region3\": \"TruckB_R3\", \"range\": \"TruckB_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region4\": \"TruckB_R4\", \"range\": \"TruckB_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region5\": \"TruckB_R5\", \"range\": \"TruckB_R5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region1\": \"TruckC_R1\", \"range\": \"TruckC_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region2\": \"TruckC_R2\", \"range\": \"TruckC_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region3\": \"TruckC_R3\", \"range\": \"TruckC_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region4\": \"TruckC_R4\", \"range\": \"TruckC_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region5\": \"TruckC_R5\", \"range\": \"TruckC_R5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency for trucks carrying GoodA\": \"EffA\", \"range\": \"EffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency for trucks carrying GoodB\": \"EffB\", \"range\": \"EffB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency for trucks carrying GoodC\": \"EffC\", \"range\": \"EffC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3. The company wants to minimize the total fuel cost across all regions and goods.\n// Fuel_Cost_A = 3 * (Distance_R1 / EffA) * TruckA_R1 + (Distance_R2 / EffA) * TruckA_R2 + (Distance_R3 / EffA) * TruckA_R3 + (Distance_R4 / EffA) * TruckA_R4 + (Distance_R5 / EffA) * TruckA_R5\n// Fuel_Cost_B = 3 * (Distance_R1 / EffB) * TruckB_R1 + (Distance_R2 / EffB) * TruckB_R2 + (Distance_R3 / EffB) * TruckB_R3 + (Distance_R4 / EffB) * TruckB_R4 + (Distance_R5 / EffB) * TruckB_R5\n// Fuel_Cost_C = 3 * (Distance_R1 / EffC) * TruckC_R1 + (Distance_R2 / EffC) * TruckC_R2 + (Distance_R3 / EffC) * TruckC_R3 + (Distance_R4 / EffC) * TruckC_R4 + (Distance_R5 / EffC) * TruckC_R5\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available across all regions and goods.\n// TruckA_R1 + TruckA_R2 + TruckA_R3 + TruckA_R4 + TruckA_R5 + TruckB_R1 + TruckB_R2 + TruckB_R3 + TruckB_R4 + TruckB_R5 + TruckC_R1 + TruckC_R2 + TruckC_R3 + TruckC_R4 + TruckC_R5 <= 50",
        "question": "A logistics company is managing the distribution of three types of goods (GoodA, GoodB, and GoodC) across five regions. The company needs to determine the number of trucks to allocate for each type of good in each region and decide on the fuel efficiency (in miles per gallon) of each truck type. The cost of fuel per gallon is $3, and the company aims to minimize the total fuel cost across all regions and goods.\n\n| Good | Region | Number of Trucks | Fuel Efficiency |\n|------|--------|------------------|-----------------|\n| GoodA | Region1 | TruckA_R1 | EffA |\n| GoodA | Region2 | TruckA_R2 | EffA |\n| GoodA | Region3 | TruckA_R3 | EffA |\n| GoodA | Region4 | TruckA_R4 | EffA |\n| GoodA | Region5 | TruckA_R5 | EffA |\n| GoodB | Region1 | TruckB_R1 | EffB |\n| GoodB | Region2 | TruckB_R2 | EffB |\n| GoodB | Region3 | TruckB_R3 | EffB |\n| GoodB | Region4 | TruckB_R4 | EffB |\n| GoodB | Region5 | TruckB_R5 | EffB |\n| GoodC | Region1 | TruckC_R1 | EffC |\n| GoodC | Region2 | TruckC_R2 | EffC |\n| GoodC | Region3 | TruckC_R3 | EffC |\n| GoodC | Region4 | TruckC_R4 | EffC |\n| GoodC | Region5 | TruckC_R5 | EffC |\n\nThe company has a total of 50 trucks available across all regions and goods. Please help the company to minimize the total fuel cost across all regions and goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA_R1 = model.addVar(vtype=\"INTEGER\", name=\"TruckA_R1\", lb=0)\nTruckA_R2 = model.addVar(vtype=\"INTEGER\", name=\"TruckA_R2\", lb=0)\nTruckA_R3 = model.addVar(vtype=\"INTEGER\", name=\"TruckA_R3\", lb=0)\nTruckA_R4 = model.addVar(vtype=\"INTEGER\", name=\"TruckA_R4\", lb=0)\nTruckA_R5 = model.addVar(vtype=\"INTEGER\", name=\"TruckA_R5\", lb=0)\nTruckB_R1 = model.addVar(vtype=\"INTEGER\", name=\"TruckB_R1\", lb=0)\nTruckB_R2 = model.addVar(vtype=\"INTEGER\", name=\"TruckB_R2\", lb=0)\nTruckB_R3 = model.addVar(vtype=\"INTEGER\", name=\"TruckB_R3\", lb=0)\nTruckB_R4 = model.addVar(vtype=\"INTEGER\", name=\"TruckB_R4\", lb=0)\nTruckB_R5 = model.addVar(vtype=\"INTEGER\", name=\"TruckB_R5\", lb=0)\nTruckC_R1 = model.addVar(vtype=\"INTEGER\", name=\"TruckC_R1\", lb=0)\nTruckC_R2 = model.addVar(vtype=\"INTEGER\", name=\"TruckC_R2\", lb=0)\nTruckC_R3 = model.addVar(vtype=\"INTEGER\", name=\"TruckC_R3\", lb=0)\nTruckC_R4 = model.addVar(vtype=\"INTEGER\", name=\"TruckC_R4\", lb=0)\nTruckC_R5 = model.addVar(vtype=\"INTEGER\", name=\"TruckC_R5\", lb=0)\nEffA = model.addVar(vtype=\"CONTINUOUS\", name=\"EffA\", lb=0)\nEffB = model.addVar(vtype=\"CONTINUOUS\", name=\"EffB\", lb=0)\nEffC = model.addVar(vtype=\"CONTINUOUS\", name=\"EffC\", lb=0)\n\n# Define objective function\nFuel_Cost_A = 3 * (TruckA_R1 / EffA) + (TruckA_R2 / EffA) + (TruckA_R3 / EffA) + (TruckA_R4 / EffA) + (TruckA_R5 / EffA)\nFuel_Cost_B = 3 * (TruckB_R1 / EffB) + (TruckB_R2 / EffB) + (TruckB_R3 / EffB) + (TruckB_R4 / EffB) + (TruckB_R5 / EffB)\nFuel_Cost_C = 3 * (TruckC_R1 / EffC) + (TruckC_R2 / EffC) + (TruckC_R3 / EffC) + (TruckC_R4 / EffC) + (TruckC_R5 / EffC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n# Add constraints\nmodel.addCons(TruckA_R1 + TruckA_R2 + TruckA_R3 + TruckA_R4 + TruckA_R5 + TruckB_R1 + TruckB_R2 + TruckB_R3 + TruckB_R4 + TruckB_R5 + TruckC_R1 + TruckC_R2 + TruckC_R3 + TruckC_R4 + TruckC_R5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA in Region1: \", model.getVal(TruckA_R1))\n    print(\"Number of Trucks for GoodA in Region2: \", model.getVal(TruckA_R2))\n    print(\"Number of Trucks for GoodA in Region3: \", model.getVal(TruckA_R3))\n    print(\"Number of Trucks for GoodA in Region4: \", model.getVal(TruckA_R4))\n    print(\"Number of Trucks for GoodA in Region5: \", model.getVal(TruckA_R5))\n    print(\"Number of Trucks for GoodB in Region1: \", model.getVal(TruckB_R1))\n    print(\"Number of Trucks for GoodB in Region2: \", model.getVal(TruckB_R2))\n    print(\"Number of Trucks for GoodB in Region3: \", model.getVal(TruckB_R3))\n    print(\"Number of Trucks for GoodB in Region4: \", model.getVal(TruckB_R4))\n    print(\"Number of Trucks for GoodB in Region5: \", model.getVal(TruckB_R5))\n    print(\"Number of Trucks for GoodC in Region1: \", model.getVal(TruckC_R1))\n    print(\"Number of Trucks for GoodC in Region2: \", model.getVal(TruckC_R2))\n    print(\"Number of Trucks for GoodC in Region3: \", model.getVal(TruckC_R3))\n    print(\"Number of Trucks for GoodC in Region4: \", model.getVal(TruckC_R4))\n    print(\"Number of Trucks for GoodC in Region5: \", model.getVal(TruckC_R5))\n    print(\"Fuel Efficiency for Trucks Carrying GoodA: \", model.getVal(EffA))\n    print(\"Fuel Efficiency for Trucks Carrying GoodB: \", model.getVal(EffB))\n    print(\"Fuel Efficiency for Trucks Carrying GoodC: \", model.getVal(EffC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 18,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of goods from three warehouses to five retail stores. The company must decide how many trucks to allocate from each warehouse to each store.\n// {\"number of trucks from warehouse 1 to store 1\": \"T11\", \"range\": \"T11 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 1 to store 2\": \"T12\", \"range\": \"T12 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 1 to store 3\": \"T13\", \"range\": \"T13 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 1 to store 4\": \"T14\", \"range\": \"T14 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 1 to store 5\": \"T15\", \"range\": \"T15 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 2 to store 1\": \"T21\", \"range\": \"T21 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 2 to store 2\": \"T22\", \"range\": \"T22 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 2 to store 3\": \"T23\", \"range\": \"T23 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 2 to store 4\": \"T24\", \"range\": \"T24 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 2 to store 5\": \"T25\", \"range\": \"T25 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 3 to store 1\": \"T31\", \"range\": \"T31 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 3 to store 2\": \"T32\", \"range\": \"T32 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 3 to store 3\": \"T33\", \"range\": \"T33 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 3 to store 4\": \"T34\", \"range\": \"T34 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from warehouse 3 to store 5\": \"T35\", \"range\": \"T35 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods varies based on the distance and the number of trucks used. The cost function is nonlinear and includes a discount for using more trucks from the same warehouse.\n// Cost from warehouse 1: C1 = 100 * (T11^2 + T12^2 + T13^2 + T14^2 + T15^2)\n// Cost from warehouse 2: C2 = 120 * (T21^2 + T22^2 + T23^2 + T24^2 + T25^2)\n// Cost from warehouse 3: C3 = 110 * (T31^2 + T32^2 + T33^2 + T34^2 + T35^2)\n// Total cost: TotalCost = C1 + C2 + C3\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nEach warehouse has a limited number of trucks available. Warehouse 1 has 20 trucks, Warehouse 2 has 15 trucks, and Warehouse 3 has 18 trucks.\n// T11 + T12 + T13 + T14 + T15 <= 20\n// T21 + T22 + T23 + T24 + T25 <= 15\n// T31 + T32 + T33 + T34 + T35 <= 18",
        "question": "A logistics company needs to optimize the distribution of goods from three warehouses to five retail stores. The company must decide how many trucks to allocate from each warehouse to each store. The cost of transporting goods varies based on the distance and the number of trucks used, with a nonlinear cost function that includes a discount for using more trucks from the same warehouse. The cost from each warehouse is given in the following Table.\n\n| Warehouse | Cost Function (per truck) |\n|-----------|--------------------------|\n| 1         | 100 * (T11^2 + T12^2 + T13^2 + T14^2 + T15^2) |\n| 2         | 120 * (T21^2 + T22^2 + T23^2 + T24^2 + T25^2) |\n| 3         | 110 * (T31^2 + T32^2 + T33^2 + T34^2 + T35^2) |\n\nEach warehouse has a limited number of trucks available. Warehouse 1 has 20 trucks, Warehouse 2 has 15 trucks, and Warehouse 3 has 18 trucks. The total cost is the sum of the costs from each warehouse.\n\nPlease help the company to minimize the total cost of transportation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT11 = model.addVar(vtype=\"INTEGER\", name=\"T11\", lb=0) # number of trucks from warehouse 1 to store 1\nT12 = model.addVar(vtype=\"INTEGER\", name=\"T12\", lb=0) # number of trucks from warehouse 1 to store 2\nT13 = model.addVar(vtype=\"INTEGER\", name=\"T13\", lb=0) # number of trucks from warehouse 1 to store 3\nT14 = model.addVar(vtype=\"INTEGER\", name=\"T14\", lb=0) # number of trucks from warehouse 1 to store 4\nT15 = model.addVar(vtype=\"INTEGER\", name=\"T15\", lb=0) # number of trucks from warehouse 1 to store 5\nT21 = model.addVar(vtype=\"INTEGER\", name=\"T21\", lb=0) # number of trucks from warehouse 2 to store 1\nT22 = model.addVar(vtype=\"INTEGER\", name=\"T22\", lb=0) # number of trucks from warehouse 2 to store 2\nT23 = model.addVar(vtype=\"INTEGER\", name=\"T23\", lb=0) # number of trucks from warehouse 2 to store 3\nT24 = model.addVar(vtype=\"INTEGER\", name=\"T24\", lb=0) # number of trucks from warehouse 2 to store 4\nT25 = model.addVar(vtype=\"INTEGER\", name=\"T25\", lb=0) # number of trucks from warehouse 2 to store 5\nT31 = model.addVar(vtype=\"INTEGER\", name=\"T31\", lb=0) # number of trucks from warehouse 3 to store 1\nT32 = model.addVar(vtype=\"INTEGER\", name=\"T32\", lb=0) # number of trucks from warehouse 3 to store 2\nT33 = model.addVar(vtype=\"INTEGER\", name=\"T33\", lb=0) # number of trucks from warehouse 3 to store 3\nT34 = model.addVar(vtype=\"INTEGER\", name=\"T34\", lb=0) # number of trucks from warehouse 3 to store 4\nT35 = model.addVar(vtype=\"INTEGER\", name=\"T35\", lb=0) # number of trucks from warehouse 3 to store 5\n\n# Define objective function\nC1 = 100 * (T11**2 + T12**2 + T13**2 + T14**2 + T15**2)\nC2 = 120 * (T21**2 + T22**2 + T23**2 + T24**2 + T25**2)\nC3 = 110 * (T31**2 + T32**2 + T33**2 + T34**2 + T35**2)\nTotalCost = C1 + C2 + C3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(T11 + T12 + T13 + T14 + T15 <= 20)\nmodel.addCons(T21 + T22 + T23 + T24 + T25 <= 15)\nmodel.addCons(T31 + T32 + T33 + T34 + T35 <= 18)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks from warehouse 1 to store 1: \", model.getVal(T11))\n    print(\"Number of trucks from warehouse 1 to store 2: \", model.getVal(T12))\n    print(\"Number of trucks from warehouse 1 to store 3: \", model.getVal(T13))\n    print(\"Number of trucks from warehouse 1 to store 4: \", model.getVal(T14))\n    print(\"Number of trucks from warehouse 1 to store 5: \", model.getVal(T15))\n    print(\"Number of trucks from warehouse 2 to store 1: \", model.getVal(T21))\n    print(\"Number of trucks from warehouse 2 to store 2: \", model.getVal(T22))\n    print(\"Number of trucks from warehouse 2 to store 3: \", model.getVal(T23))\n    print(\"Number of trucks from warehouse 2 to store 4: \", model.getVal(T24))\n    print(\"Number of trucks from warehouse 2 to store 5: \", model.getVal(T25))\n    print(\"Number of trucks from warehouse 3 to store 1: \", model.getVal(T31))\n    print(\"Number of trucks from warehouse 3 to store 2: \", model.getVal(T32))\n    print(\"Number of trucks from warehouse 3 to store 3: \", model.getVal(T33))\n    print(\"Number of trucks from warehouse 3 to store 4: \", model.getVal(T34))\n    print(\"Number of trucks from warehouse 3 to store 5: \", model.getVal(T35))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 15,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store.\n// {\"number of units shipped from warehouse A to store 1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 4\": \"A4\", \"range\": \"A4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store.\n// Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\n// So, the objective function is: Minimize Total shipping cost\n\n## Generate Constraint-1:\nEach store must receive at least 100 units of the product.\n// A1 + B1 + C1 >= 100\n// A2 + B2 + C2 >= 100\n// A3 + B3 + C3 >= 100\n// A4 + B4 + C4 >= 100\n\n## Generate Constraint-2:\nWarehouse A has a total of 200 units available for shipping.\n// A1 + A2 + A3 + A4 <= 200\n\n## Generate Constraint-3:\nWarehouse B has a total of 300 units available for shipping.\n// B1 + B2 + B3 + B4 <= 300\n\n## Generate Constraint-4:\nWarehouse C has a total of 400 units available for shipping.\n// C1 + C2 + C3 + C4 <= 400",
        "question": "A logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store. The cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store. Each store must receive at least 100 units of the product. Warehouse A has a total of 200 units available for shipping. Warehouse B has a total of 300 units available for shipping. Warehouse C has a total of 400 units available for shipping. Please help the company to minimize the total shipping cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # number of units shipped from warehouse A to store 1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # number of units shipped from warehouse A to store 2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # number of units shipped from warehouse A to store 3\nA4 = model.addVar(vtype=\"INTEGER\", name=\"A4\", lb=0) # number of units shipped from warehouse A to store 4\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units shipped from warehouse B to store 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units shipped from warehouse B to store 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units shipped from warehouse B to store 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units shipped from warehouse B to store 4\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of units shipped from warehouse C to store 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of units shipped from warehouse C to store 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of units shipped from warehouse C to store 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of units shipped from warehouse C to store 4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nTotalShippingCost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nmodel.addCons(obj == TotalShippingCost)\n\n# Add constraints\n## Each store must receive at least 100 units of the product.\nmodel.addCons(A1 + B1 + C1 >= 100)\nmodel.addCons(A2 + B2 + C2 >= 100)\nmodel.addCons(A3 + B3 + C3 >= 100)\nmodel.addCons(A4 + B4 + C4 >= 100)\n## Warehouse A has a total of 200 units available for shipping.\nmodel.addCons(A1 + A2 + A3 + A4 <= 200)\n## Warehouse B has a total of 300 units available for shipping.\nmodel.addCons(B1 + B2 + B3 + B4 <= 300)\n## Warehouse C has a total of 400 units available for shipping.\nmodel.addCons(C1 + C2 + C3 + C4 <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units shipped from warehouse A to store 1: \", model.getVal(A1))\n    print(\"Number of units shipped from warehouse A to store 2: \", model.getVal(A2))\n    print(\"Number of units shipped from warehouse A to store 3: \", model.getVal(A3))\n    print(\"Number of units shipped from warehouse A to store 4: \", model.getVal(A4))\n    print(\"Number of units shipped from warehouse B to store 1: \", model.getVal(B1))\n    print(\"Number of units shipped from warehouse B to store 2: \", model.getVal(B2))\n    print(\"Number of units shipped from warehouse B to store 3: \", model.getVal(B3))\n    print(\"Number of units shipped from warehouse B to store 4: \", model.getVal(B4))\n    print(\"Number of units shipped from warehouse C to store 1: \", model.getVal(C1))\n    print(\"Number of units shipped from warehouse C to store 2: \", model.getVal(C2))\n    print(\"Number of units shipped from warehouse C to store 3: \", model.getVal(C3))\n    print(\"Number of units shipped from warehouse C to store 4: \", model.getVal(C4))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 742,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to maximize the efficiency of the renewable energy production.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"StorageInvestment\", \"range\": \"StorageInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. The efficiency of wind turbines increases by 0.5% for every $10,000 invested in energy storage systems. The initial efficiency of solar panels is 15%, and the initial efficiency of wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar panels in RegionA: EnergyA_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarA\n// Total energy production from wind turbines in RegionA: EnergyA_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindA\n// Total energy production from solar panels in RegionB: EnergyB_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarB\n// Total energy production from wind turbines in RegionB: EnergyB_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindB\n// Total energy production from solar panels in RegionC: EnergyC_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarC\n// Total energy production from wind turbines in RegionC: EnergyC_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindC\n// So, the objective function is: Maximize (EnergyA_Solar + EnergyA_Wind + EnergyB_Solar + EnergyB_Wind + EnergyC_Solar + EnergyC_Wind)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarA + 2000 * WindA + 1000 * SolarB + 2000 * WindB + 1000 * SolarC + 2000 * WindC <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage systems cannot exceed $50,000.\n// StorageInvestment <= 50000\n\n## Generate Constraint-3:\nThe total number of solar panels and wind turbines in each region cannot exceed 100.\n// SolarA + WindA <= 100; SolarB + WindB <= 100; SolarC + WindC <= 100\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB.\n// SolarA >= 20; WindB >= 30",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to maximize the efficiency of the renewable energy production. The efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. The efficiency of wind turbines increases by 0.5% for every $10,000 invested in energy storage systems. The initial efficiency of solar panels is 15%, and the initial efficiency of wind turbines is 30%. The company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage systems cannot exceed $50,000. The total number of solar panels and wind turbines in each region cannot exceed 100. The company must ensure that at least 20 solar panels are installed in RegionA and at least 30 wind turbines are installed in RegionB. Please help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0)  # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0)    # number of wind turbines in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0)  # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0)    # number of wind turbines in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0)  # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0)    # number of wind turbines in RegionC\nStorageInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageInvestment\", lb=0)  # investment in energy storage systems\n\n# Define objective function\nEnergyA_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarA\nEnergyA_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindA\nEnergyB_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarB\nEnergyB_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindB\nEnergyC_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarC\nEnergyC_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyA_Solar + EnergyA_Wind + EnergyB_Solar + EnergyB_Wind + EnergyC_Solar + EnergyC_Wind)\n\n# Add constraints\nmodel.addCons(1000 * SolarA + 2000 * WindA + 1000 * SolarB + 2000 * WindB + 1000 * SolarC + 2000 * WindC <= 1000000)\nmodel.addCons(StorageInvestment <= 50000)\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 100)\nmodel.addCons(SolarC + WindC <= 100)\nmodel.addCons(SolarA >= 20)\nmodel.addCons(WindB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(StorageInvestment))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption while meeting delivery demands. The regions are categorized into three types: Urban, Suburban, and Rural. Each type of region has different fuel consumption rates per kilometer driven by a truck.\n// {\"number of trucks allocated to Urban regions\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Suburban regions\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Rural regions\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"average daily kilometers driven by a truck in Urban regions\": \"UrbanKmPerTruck\", \"range\": \"UrbanKmPerTruck >= 0\", \"type\": \"real\"}\n// {\"average daily kilometers driven by a truck in Suburban regions\": \"SuburbanKmPerTruck\", \"range\": \"SuburbanKmPerTruck >= 0\", \"type\": \"real\"}\n// {\"average daily kilometers driven by a truck in Rural regions\": \"RuralKmPerTruck\", \"range\": \"RuralKmPerTruck >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Urban regions is 0.2 liters per kilometer, in Suburban regions is 0.15 liters per kilometer, and in Rural regions is 0.1 liters per kilometer. The company aims to minimize the total daily fuel consumption across all regions.\n// Fuel_Urban = 0.2 * UrbanTrucks * UrbanKmPerTruck\n// Fuel_Suburban = 0.15 * SuburbanTrucks * SuburbanKmPerTruck\n// Fuel_Rural = 0.1 * RuralTrucks * RuralKmPerTruck\n// So, the objective function is: Minimize (Fuel_Urban + Fuel_Suburban + Fuel_Rural)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions categorized into Urban, Suburban, and Rural. Each type of region has different fuel consumption rates per kilometer driven by a truck. The fuel consumption rate for trucks in Urban regions is 0.2 liters per kilometer, in Suburban regions is 0.15 liters per kilometer, and in Rural regions is 0.1 liters per kilometer. The company aims to minimize the total daily fuel consumption across all regions. The company has a total of 100 trucks available for allocation.\n\nPlease help the company determine the optimal number of trucks to allocate to each region (UrbanTrucks, SuburbanTrucks, RuralTrucks) and the average daily kilometers driven by a truck in each region (UrbanKmPerTruck, SuburbanKmPerTruck, RuralKmPerTruck) to meet delivery demands while minimizing fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)  # number of trucks allocated to Urban regions\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)  # number of trucks allocated to Suburban regions\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)  # number of trucks allocated to Rural regions\nUrbanKmPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"UrbanKmPerTruck\", lb=0)  # average daily kilometers driven by a truck in Urban regions\nSuburbanKmPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"SuburbanKmPerTruck\", lb=0)  # average daily kilometers driven by a truck in Suburban regions\nRuralKmPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"RuralKmPerTruck\", lb=0)  # average daily kilometers driven by a truck in Rural regions\n\n# Define objective function\nFuel_Urban = 0.2 * UrbanTrucks * UrbanKmPerTruck\nFuel_Suburban = 0.15 * SuburbanTrucks * SuburbanKmPerTruck\nFuel_Rural = 0.1 * RuralTrucks * RuralKmPerTruck\n# So, the objective function is: Minimize (Fuel_Urban + Fuel_Suburban + Fuel_Rural)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Urban + Fuel_Suburban + Fuel_Rural)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Urban Regions: \", model.getVal(UrbanTrucks))\n    print(\"Number of Trucks Allocated to Suburban Regions: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Trucks Allocated to Rural Regions: \", model.getVal(RuralTrucks))\n    print(\"Average Daily Kilometers Driven by a Truck in Urban Regions: \", model.getVal(UrbanKmPerTruck))\n    print(\"Average Daily Kilometers Driven by a Truck in Suburban Regions: \", model.getVal(SuburbanKmPerTruck))\n    print(\"Average Daily Kilometers Driven by a Truck in Rural Regions: \", model.getVal(RuralKmPerTruck))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck (Truck1, Truck2, Truck3) to maximize efficiency while minimizing fuel consumption and maintenance costs. Additionally, the company needs to decide on the optimal speed for each truck type to balance between trip duration and fuel efficiency.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for Truck1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"optimal speed for Truck2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"optimal speed for Truck3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. For Truck1, the fuel consumption rate is 0.1 * Speed1^2 liters per kilometer, and the maintenance cost is 0.005 * Speed1^3 dollars per kilometer. \nFor Truck2, the fuel consumption rate is 0.12 * Speed2^2 liters per kilometer, and the maintenance cost is 0.006 * Speed2^3 dollars per kilometer. \nFor Truck3, the fuel consumption rate is 0.15 * Speed3^2 liters per kilometer, and the maintenance cost is 0.007 * Speed3^3 dollars per kilometer. \nThe company aims to minimize the total cost of fuel and maintenance per trip.\n// Total cost for Truck1: Cost1 = (0.1 * Speed1^2 * Trips1) + (0.005 * Speed1^3 * Trips1)\n// Total cost for Truck2: Cost2 = (0.12 * Speed2^2 * Trips2) + (0.006 * Speed2^3 * Trips2)\n// Total cost for Truck3: Cost3 = (0.15 * Speed3^2 * Trips3) + (0.007 * Speed3^3 * Trips3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel and maintenance costs for the next month.\n// (0.1 * Speed1^2 * Trips1 + 0.005 * Speed1^3 * Trips1) + (0.12 * Speed2^2 * Trips2 + 0.006 * Speed2^3 * Trips2) + (0.15 * Speed3^2 * Trips3 + 0.007 * Speed3^3 * Trips3) <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck (Truck1, Truck2, Truck3) and the optimal speed for each truck type to balance between trip duration and fuel efficiency. The fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. For Truck1, the fuel consumption rate is 0.1 * Speed1^2 liters per kilometer, and the maintenance cost is 0.005 * Speed1^3 dollars per kilometer. For Truck2, the fuel consumption rate is 0.12 * Speed2^2 liters per kilometer, and the maintenance cost is 0.006 * Speed2^3 dollars per kilometer. For Truck3, the fuel consumption rate is 0.15 * Speed3^2 liters per kilometer, and the maintenance cost is 0.007 * Speed3^3 dollars per kilometer. The company aims to minimize the total cost of fuel and maintenance per trip. The company has a total budget of $10,000 for fuel and maintenance costs for the next month.\n\nPlease help the company to determine the optimal number of trips for each truck type and the optimal speed for each truck type to minimize the total cost of fuel and maintenance per trip while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # optimal speed for Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # optimal speed for Truck2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=60)  # optimal speed for Truck3\n\n# Define objective function\nCost1 = (0.1 * Speed1**2 * Trips1) + (0.005 * Speed1**3 * Trips1)\nCost2 = (0.12 * Speed2**2 * Trips2) + (0.006 * Speed2**3 * Trips2)\nCost3 = (0.15 * Speed3**2 * Trips3) + (0.007 * Speed3**3 * Trips3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(\n    (0.1 * Speed1**2 * Trips1 + 0.005 * Speed1**3 * Trips1) +\n    (0.12 * Speed2**2 * Trips2 + 0.006 * Speed2**3 * Trips2) +\n    (0.15 * Speed3**2 * Trips3 + 0.007 * Speed3**3 * Trips3) <= 10000\n)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Optimal Speed for Truck1: \", model.getVal(Speed1))\n    print(\"Optimal Speed for Truck2: \", model.getVal(Speed2))\n    print(\"Optimal Speed for Truck3: \", model.getVal(Speed3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (in hours) allocated to each product to optimize production efficiency. Additionally, the company needs to decide on the investment in automation technology for each product, which will reduce the required resource hours per unit of product.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resource hours per unit for ProductA\": \"ResourceHoursA\", \"range\": \"ResourceHoursA >= 0\", \"type\": \"continuous\"}\n// {\"resource hours per unit for ProductB\": \"ResourceHoursB\", \"range\": \"ResourceHoursB >= 0\", \"type\": \"continuous\"}\n// {\"resource hours per unit for ProductC\": \"ResourceHoursC\", \"range\": \"ResourceHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product. The initial resource hours per unit for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The profit per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - ResourceHoursA * 20) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - ResourceHoursB * 20) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - ResourceHoursC * 20) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource hours available for the month are 10,000 hours.\n// ResourceHoursA * QuantityA + ResourceHoursB * QuantityB + ResourceHoursC * QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 300 units of ProductB.\n// QuantityA >= 500; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the amount of resources (in hours) allocated to each product, and the investment in automation technology for each product to optimize production efficiency. The initial resource hours per unit and the profit per unit for each product are given in the following Table.\n\n| Product | Initial Resource Hours per Unit | Profit per Unit |\n|---------|---------------------------------|-----------------|\n| ProductA | 5 hours                         | $100            |\n| ProductB | 6 hours                         | $120            |\n| ProductC | 7 hours                         | $150            |\n\nThe resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product. The total resource hours available for the month are 10,000 hours. The total investment in automation cannot exceed $50,000. The company must produce at least 500 units of ProductA and 300 units of ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)     # production quantity for ProductC\nResourceHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursA\", lb=0)  # resource hours per unit for ProductA\nResourceHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursB\", lb=0)  # resource hours per unit for ProductB\nResourceHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceHoursC\", lb=0)  # resource hours per unit for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\n## The resource hours per unit for each product decrease by 0.1 hours for every $1,000 invested in automation for that product.\nmodel.addCons(ResourceHoursA == 5 - 0.1 * AutomationA / 1000)\nmodel.addCons(ResourceHoursB == 6 - 0.1 * AutomationB / 1000)\nmodel.addCons(ResourceHoursC == 7 - 0.1 * AutomationC / 1000)\n\n## Total profit for ProductA: ProfitA = (100 - ResourceHoursA * 20) * QuantityA\n## Total profit for ProductB: ProfitB = (120 - ResourceHoursB * 20) * QuantityB\n## Total profit for ProductC: ProfitC = (150 - ResourceHoursC * 20) * QuantityC\nProfitA = (100 - ResourceHoursA * 20) * QuantityA\nProfitB = (120 - ResourceHoursB * 20) * QuantityB\nProfitC = (150 - ResourceHoursC * 20) * QuantityC\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total resource hours available for the month are 10,000 hours.\nmodel.addCons(ResourceHoursA * QuantityA + ResourceHoursB * QuantityB + ResourceHoursC * QuantityC <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resource Hours per Unit for ProductA: \", model.getVal(ResourceHoursA))\n    print(\"Resource Hours per Unit for ProductB: \", model.getVal(ResourceHoursB))\n    print(\"Resource Hours per Unit for ProductC: \", model.getVal(ResourceHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\n// {\"number of trucks for GoodsA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor GoodsA, the transportation cost per truck is $10,000, the revenue per truck is $15,000, and the storage cost per truck is $2,000. \nFor GoodsB, the transportation cost per truck is $12,000, the revenue per truck is $18,000, and the storage cost per truck is $2,500. \nFor GoodsC, the transportation cost per truck is $14,000, the revenue per truck is $21,000, and the storage cost per truck is $3,000.\nFor GoodsD, the transportation cost per truck is $16,000, the revenue per truck is $24,000, and the storage cost per truck is $3,500.\nFor GoodsE, the transportation cost per truck is $18,000, the revenue per truck is $27,000, and the storage cost per truck is $4,000.\nThe company wants to maximize the net profit per truck.\n// Net profit for GoodsA: Profit_GoodsA = (15,000 - 10,000 - 2,000) * TrucksA\n// Net profit for GoodsB: Profit_GoodsB = (18,000 - 12,000 - 2,500) * TrucksB\n// Net profit for GoodsC: Profit_GoodsC = (21,000 - 14,000 - 3,000) * TrucksC\n// Net profit for GoodsD: Profit_GoodsD = (24,000 - 16,000 - 3,500) * TrucksD\n// Net profit for GoodsE: Profit_GoodsE = (27,000 - 18,000 - 4,000) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20\n\n## Generate Constraint-2:\nDue to contractual agreements, GoodsA must be transported by at least 3 trucks.\n// TrucksA >= 3\n\n## Generate Constraint-3:\nThe company has a budget of $300,000 for transportation costs.\n// 10,000 * TrucksA + 12,000 * TrucksB + 14,000 * TrucksC + 16,000 * TrucksD + 18,000 * TrucksE <= 300,000\n\n## Generate Constraint-4:\nThe storage capacity of the company is limited to 50 truckloads.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-5:\nThe market demand for GoodsE is limited to 5 truckloads.\n// TrucksE <= 5",
        "question": "A logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\nFor GoodsA, the transportation cost per truck is $10,000, the revenue per truck is $15,000, and the storage cost per truck is $2,000. \nFor GoodsB, the transportation cost per truck is $12,000, the revenue per truck is $18,000, and the storage cost per truck is $2,500. \nFor GoodsC, the transportation cost per truck is $14,000, the revenue per truck is $21,000, and the storage cost per truck is $3,000.\nFor GoodsD, the transportation cost per truck is $16,000, the revenue per truck is $24,000, and the storage cost per truck is $3,500.\nFor GoodsE, the transportation cost per truck is $18,000, the revenue per truck is $27,000, and the storage cost per truck is $4,000.\nThe company has a total of 20 trucks available for distribution. Due to contractual agreements, GoodsA must be transported by at least 3 trucks. The company has a budget of $300,000 for transportation costs. The storage capacity of the company is limited to 50 truckloads. The market demand for GoodsE is limited to 5 truckloads.\nPlease help the company to maximize the net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodsA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodsB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodsC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodsD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodsE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_GoodsA = (15000 - 10000 - 2000) * TrucksA\nProfit_GoodsB = (18000 - 12000 - 2500) * TrucksB\nProfit_GoodsC = (21000 - 14000 - 3000) * TrucksC\nProfit_GoodsD = (24000 - 16000 - 3500) * TrucksD\nProfit_GoodsE = (27000 - 18000 - 4000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE)\n\n# Add constraints\n## The company has a total of 20 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20)\n## Due to contractual agreements, GoodsA must be transported by at least 3 trucks.\nmodel.addCons(TrucksA >= 3)\n## The company has a budget of $300,000 for transportation costs.\nmodel.addCons(10000 * TrucksA + 12000 * TrucksB + 14000 * TrucksC + 16000 * TrucksD + 18000 * TrucksE <= 300000)\n## The storage capacity of the company is limited to 50 truckloads.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## The market demand for GoodsE is limited to 5 truckloads.\nmodel.addCons(TrucksE <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodsB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodsC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodsD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodsE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n// Fuel cost = (total distance / fuel efficiency) * fuel price\n// Maintenance cost = number of trucks * maintenance cost per truck\n// Objective function: Minimize (Fuel cost + Maintenance cost)\n\n## Generate Constraint-1:\nThe total budget for purchasing new trucks is $500,000.\n// 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes. The fuel efficiency and annual maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Annual Maintenance Cost |\n|------------|-----------------------|-------------------------|\n| Truck1     | 5                     | $10,000                 |\n| Truck2     | 10                    | $15,000                 |\n| Truck3     | 15                    | $20,000                 |\n| Truck4     | 20                    | $25,000                 |\n| Truck5     | 25                    | $30,000                 |\n\nThe company has a total budget of $500,000 for purchasing new trucks. The company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered. Please help the company determine the optimal number of each type of truck to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Truck1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Truck2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Truck3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of Truck4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel and maintenance costs\nfuel_cost_Truck1 = (5000 / 5) * Truck1  # Assuming total distance is 5000 km\nfuel_cost_Truck2 = (5000 / 10) * Truck2\nfuel_cost_Truck3 = (5000 / 15) * Truck3\nfuel_cost_Truck4 = (5000 / 20) * Truck4\nfuel_cost_Truck5 = (5000 / 25) * Truck5\n\nmaintenance_cost_Truck1 = 10000 * Truck1\nmaintenance_cost_Truck2 = 15000 * Truck2\nmaintenance_cost_Truck3 = 20000 * Truck3\nmaintenance_cost_Truck4 = 25000 * Truck4\nmaintenance_cost_Truck5 = 30000 * Truck5\n\n## Objective function: Minimize (Fuel cost + Maintenance cost)\nmodel.addCons(obj == fuel_cost_Truck1 + fuel_cost_Truck2 + fuel_cost_Truck3 + fuel_cost_Truck4 + fuel_cost_Truck5 +\n              maintenance_cost_Truck1 + maintenance_cost_Truck2 + maintenance_cost_Truck3 + maintenance_cost_Truck4 + maintenance_cost_Truck5)\n\n# Add constraints\n## The total budget for purchasing new trucks is $500,000.\nmodel.addCons(10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Truck4: \", model.getVal(Truck4))\n    print(\"Number of Truck5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product A\": \"InventoryA\", \"range\": \"InventoryA >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product B\": \"InventoryB\", \"range\": \"InventoryB >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product C\": \"InventoryC\", \"range\": \"InventoryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\n// Profit_ProductA = (ProductA - InventoryA) * (50 - 30)\n// Profit_ProductB = (ProductB - InventoryB) * (70 - 40)\n// Profit_ProductC = (ProductC - InventoryC) * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 50 units for each product.\n// InventoryA <= 50\n// InventoryB <= 50\n// InventoryC <= 50\n\n## Generate Constraint-3:\nThe total cost of production and inventory maintenance must not exceed $4000 per day.\n// 30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000\n\n## Generate Constraint-4:\nThe demand for product A is at least 20 units per day, and for product B and C, it is at least 15 units per day.\n// ProductA >= 20\n// ProductB >= 15\n// ProductC >= 15\n\n## Generate Constraint-5:\nThe inventory levels must be sufficient to meet the demand for the next day, with a safety stock of 10 units for each product.\n// InventoryA + ProductA >= 20 + 10\n// InventoryB + ProductB >= 15 + 10\n// InventoryC + ProductC >= 15 + 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity. The revenue per unit, cost per unit, and the daily demand for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost per Unit | Daily Demand |\n|---------|------------------|---------------|--------------|\n| A       | $50              | $30           | 20 units     |\n| B       | $70              | $40           | 15 units     |\n| C       | $60              | $35           | 15 units     |\n\nThe company has a total production capacity of 100 units per day. The company has a storage capacity limit of 50 units for each product. The total cost of production and inventory maintenance must not exceed $4000 per day. The inventory levels must be sufficient to meet the demand for the next day, with a safety stock of 10 units for each product. \n\nPlease help the company to maximize the total profit, considering both the production and the inventory levels.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)\nInventoryA = model.addVar(vtype=\"INTEGER\", name=\"InventoryA\", lb=0)\nInventoryB = model.addVar(vtype=\"INTEGER\", name=\"InventoryB\", lb=0)\nInventoryC = model.addVar(vtype=\"INTEGER\", name=\"InventoryC\", lb=0)\n\n# Define objective function\nProfit_ProductA = (ProductA - InventoryA) * (50 - 30)\nProfit_ProductB = (ProductB - InventoryB) * (70 - 40)\nProfit_ProductC = (ProductC - InventoryC) * (60 - 35)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total production capacity of 100 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 100)\n# The company has a storage capacity limit of 50 units for each product.\nmodel.addCons(InventoryA <= 50)\nmodel.addCons(InventoryB <= 50)\nmodel.addCons(InventoryC <= 50)\n# The total cost of production and inventory maintenance must not exceed $4000 per day.\nmodel.addCons(30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000)\n# The demand for product A is at least 20 units per day, and for product B and C, it is at least 15 units per day.\nmodel.addCons(ProductA >= 20)\nmodel.addCons(ProductB >= 15)\nmodel.addCons(ProductC >= 15)\n# The inventory levels must be sufficient to meet the demand for the next day, with a safety stock of 10 units for each product.\nmodel.addCons(InventoryA + ProductA >= 20 + 10)\nmodel.addCons(InventoryB + ProductB >= 15 + 10)\nmodel.addCons(InventoryC + ProductC >= 15 + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Inventory Level of Product A: \", model.getVal(InventoryA))\n    print(\"Inventory Level of Product B: \", model.getVal(InventoryB))\n    print(\"Inventory Level of Product C: \", model.getVal(InventoryC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120\n\n## Generate Constraint-2:\nMachine 1 can operate for a maximum of 50 hours per week.\n// M1 <= 50\n\n## Generate Constraint-3:\nMachine 2 can operate for a maximum of 60 hours per week.\n// M2 <= 60\n\n## Generate Constraint-4:\nMachine 3 can operate for a maximum of 40 hours per week.\n// M3 <= 40",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit. The total operating hours for all machines must not exceed 120 hours per week. Machine 1 can operate for a maximum of 50 hours per week. Machine 2 can operate for a maximum of 60 hours per week. Machine 3 can operate for a maximum of 40 hours per week. Please help the company to maximize the total production value of both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB) # objective function: Maximize (VA + VB)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 120) # total operating hours for all machines must not exceed 120 hours per week\nmodel.addCons(M1 <= 50) # Machine 1 can operate for a maximum of 50 hours per week\nmodel.addCons(M2 <= 60) # Machine 2 can operate for a maximum of 60 hours per week\nmodel.addCons(M3 <= 40) # Machine 3 can operate for a maximum of 40 hours per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will enhance the product quality and potentially increase the selling price.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductA\": \"RnD_A\", \"range\": \"RnD_A >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductB\": \"RnD_B\", \"range\": \"RnD_B >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductC\": \"RnD_C\", \"range\": \"RnD_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in automation level for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 + 0.01 * RnD_A - (100 - 5 * AutomationA)) * UnitsA\n// Total profit for ProductB: ProfitB = (180 + 0.01 * RnD_B - (120 - 5 * AutomationB)) * UnitsB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * RnD_C - (150 - 5 * AutomationC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for automation and R&D investments.\n// AutomationA + AutomationB + AutomationC + RnD_A + RnD_B + RnD_C <= 100000\n\n## Generate Constraint-2:\nThe total number of units produced cannot exceed 10,000 units.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1000 units of ProductA and 2000 units of ProductB.\n// UnitsA >= 1000; UnitsB >= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will enhance the product quality and potentially increase the selling price. The initial production cost per unit and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Initial Selling Price per Unit |\n|---------|----------------------------------|--------------------------------|\n| ProductA | $100                             | $150                           |\n| ProductB | $120                             | $180                           |\n| ProductC | $150                             | $200                           |\n\nThe production cost per unit decreases by $5 for every unit increase in automation level for that product. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The company has a total budget of $100,000 for automation and R&D investments. The total number of units produced cannot exceed 10,000 units. Due to market demand, the company must produce at least 1000 units of ProductA and 2000 units of ProductB. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nRnD_A = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_A\", lb=0) # investment in R&D for ProductA\nRnD_B = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_B\", lb=0) # investment in R&D for ProductB\nRnD_C = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_C\", lb=0) # investment in R&D for ProductC\n\n# Define objective function\nProfitA = (150 + 0.01 * RnD_A - (100 - 5 * AutomationA)) * UnitsA\nProfitB = (180 + 0.01 * RnD_B - (120 - 5 * AutomationB)) * UnitsB\nProfitC = (200 + 0.01 * RnD_C - (150 - 5 * AutomationC)) * UnitsC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for automation and R&D investments.\nmodel.addCons(AutomationA + AutomationB + AutomationC + RnD_A + RnD_B + RnD_C <= 100000)\n# The total number of units produced cannot exceed 10,000 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# Due to market demand, the company must produce at least 1000 units of ProductA and 2000 units of ProductB.\nmodel.addCons(UnitsA >= 1000)\nmodel.addCons(UnitsB >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(UnitsA))\n    print(\"Number of ProductB Units: \", model.getVal(UnitsB))\n    print(\"Number of ProductC Units: \", model.getVal(UnitsC))\n    print(\"Automation Level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation Level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation Level for ProductC: \", model.getVal(AutomationC))\n    print(\"R&D Investment for ProductA: \", model.getVal(RnD_A))\n    print(\"R&D Investment for ProductB: \", model.getVal(RnD_B))\n    print(\"R&D Investment for ProductC: \", model.getVal(RnD_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1551,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net profit per day.\n// NetProfit_A = (1000 - 500) * TrucksA\n// NetProfit_B = (1200 - 600) * TrucksB\n// NetProfit_C = (1400 - 700) * TrucksC\n// NetProfit_D = (1600 - 800) * TrucksD\n// NetProfit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a daily budget of $30,000 for operating costs.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000\n\n## Generate Constraint-4:\nTo ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\n// |TrucksA - TrucksB| <= 10\n// |TrucksA - TrucksC| <= 10\n// |TrucksA - TrucksD| <= 10\n// |TrucksA - TrucksE| <= 10\n// |TrucksB - TrucksC| <= 10\n// |TrucksB - TrucksD| <= 10\n// |TrucksB - TrucksE| <= 10\n// |TrucksC - TrucksD| <= 10\n// |TrucksC - TrucksE| <= 10\n// |TrucksD - TrucksE| <= 10\n\n## Generate Constraint-5:\nEach type of good must have at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net profit per day.\nThe company has a total of 50 trucks available. Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB. The company has a daily budget of $30,000 for operating costs. To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10. Each type of good must have at least one truck allocated.\nPlease help the company to determine the optimal allocation of trucks to maximize their total net profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for GoodE\n\n# Define objective function\nNetProfit_A = (1000 - 500) * TrucksA\nNetProfit_B = (1200 - 600) * TrucksB\nNetProfit_C = (1400 - 700) * TrucksC\nNetProfit_D = (1600 - 800) * TrucksD\nNetProfit_E = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n# The company has a daily budget of $30,000 for operating costs.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n\n# To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\nmodel.addCons(abs(TrucksA - TrucksB) <= 10)\nmodel.addCons(abs(TrucksA - TrucksC) <= 10)\nmodel.addCons(abs(TrucksA - TrucksD) <= 10)\nmodel.addCons(abs(TrucksA - TrucksE) <= 10)\nmodel.addCons(abs(TrucksB - TrucksC) <= 10)\nmodel.addCons(abs(TrucksB - TrucksD) <= 10)\nmodel.addCons(abs(TrucksB - TrucksE) <= 10)\nmodel.addCons(abs(TrucksC - TrucksD) <= 10)\nmodel.addCons(abs(TrucksC - TrucksE) <= 10)\nmodel.addCons(abs(TrucksD - TrucksE) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000\n\n## Generate Constraint-2:\nThe total fuel allocation must not exceed 5000 liters.\n// FuelA + FuelB + FuelC <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\n// TruckA >= 10; TruckB >= 15\n\n## Generate Constraint-4:\nThe total distance covered by TruckC must be at least 5000 km.\n// (Initial_efficiency_C + 0.0006 * Software) * FuelC >= 5000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered. The company has a budget of $100,000 for vehicle purchases and software investments. The total fuel allocation must not exceed 5000 liters. The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements. The total distance covered by TruckC must be at least 5000 km. Please help the company to determine the optimal number of each type of vehicle to purchase, the amount of fuel to allocate to each vehicle, and the investment in the routing software.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\nFuel_consumption_A = (model.addVar(name=\"Distance_A\") / (model.addVar(name=\"Initial_efficiency_A\") + 0.0005 * Software)) * FuelA\nFuel_consumption_B = (model.addVar(name=\"Distance_B\") / (model.addVar(name=\"Initial_efficiency_B\") + 0.0007 * Software)) * FuelB\nFuel_consumption_C = (model.addVar(name=\"Distance_C\") / (model.addVar(name=\"Initial_efficiency_C\") + 0.0006 * Software)) * FuelC\nmodel.addCons(obj == Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nmodel.addCons(TruckA * model.addVar(name=\"Cost_A\") + TruckB * model.addVar(name=\"Cost_B\") + TruckC * model.addVar(name=\"Cost_C\") + Software <= 100000)\n## The total fuel allocation must not exceed 5000 liters.\nmodel.addCons(FuelA + FuelB + FuelC <= 5000)\n## The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 15)\n## The total distance covered by TruckC must be at least 5000 km.\nmodel.addCons((model.addVar(name=\"Initial_efficiency_C\") + 0.0006 * Software) * FuelC >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity, and the company needs to determine the optimal number of trips each truck should make to minimize fuel consumption while meeting delivery requirements.\n// {\"trips for T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips for T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips for T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips for T4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips for T5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for T1 per trip is 100 liters, for T2 is 120 liters, for T3 is 140 liters, for T4 is 160 liters, and for T5 is 180 liters. The company aims to minimize the total fuel consumption.\n// Fuel_Consumption_T1 = 100 * T1\n// Fuel_Consumption_T2 = 120 * T2\n// Fuel_Consumption_T3 = 140 * T3\n// Fuel_Consumption_T4 = 160 * T4\n// Fuel_Consumption_T5 = 180 * T5\n// So, the objective function is: Minimize (Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 50 trips.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nThe company has a limited fuel budget of 6000 liters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 6000\n\n## Generate Constraint-3:\nEach truck must make at least one trip.\n// T1 >= 1\n// T2 >= 1\n// T3 >= 1\n// T4 >= 1\n// T5 >= 1",
        "question": "A logistics company is planning its routes for five different trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, and the company needs to determine the optimal number of trips each truck should make to minimize fuel consumption while meeting delivery requirements. The fuel consumption per trip for each truck is given in the following Table.\n\n| Truck | Fuel Consumption per Trip |\n|-------|--------------------------|\n| T1    | 100 liters               |\n| T2    | 120 liters               |\n| T3    | 140 liters               |\n| T4    | 160 liters               |\n| T5    | 180 liters               |\n\nThe company has a limited fuel budget of 6000 liters. The total number of trips across all trucks must not exceed 50 trips. Each truck must make at least one trip. Please help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each truck must make at least one trip.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # trips for T1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # trips for T2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # trips for T3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # trips for T4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # trips for T5\n\n# Define objective function\n## The company aims to minimize the total fuel consumption.\nFuel_Consumption_T1 = 100 * T1\nFuel_Consumption_T2 = 120 * T2\nFuel_Consumption_T3 = 140 * T3\nFuel_Consumption_T4 = 160 * T4\nFuel_Consumption_T5 = 180 * T5\n## So, the objective function is: Minimize (Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\n\n# Add constraints\n## The total number of trips across all trucks must not exceed 50 trips.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The company has a limited fuel budget of 6000 liters.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 6000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips for T1: \", model.getVal(T1))\n    print(\"Trips for T2: \", model.getVal(T2))\n    print(\"Trips for T3: \", model.getVal(T3))\n    print(\"Trips for T4: \", model.getVal(T4))\n    print(\"Trips for T5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel.\n// {\"number of solar panels for Apartments\": \"ApartmentPanels\", \"range\": \"ApartmentPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Houses\": \"HousePanels\", \"range\": \"HousePanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"efficiency of solar panels for Apartments\": \"ApartmentEfficiency\", \"range\": \"ApartmentEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Houses\": \"HouseEfficiency\", \"range\": \"HouseEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Commercial buildings\": \"CommercialEfficiency\", \"range\": \"CommercialEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh.\n// Cost_Apartments = 1000 * ApartmentPanels\n// Cost_Houses = 1500 * HousePanels\n// Cost_Commercial = 2000 * CommercialPanels\n// Energy_Apartments = ApartmentEfficiency * ApartmentPanels\n// Energy_Houses = HouseEfficiency * HousePanels\n// Energy_Commercial = CommercialEfficiency * CommercialPanels\n// So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n## Generate Constraint-1:\nThe total daily energy generated must be at least 1000 kWh.\n// Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000\n\n## Generate Constraint-3:\nThe number of solar panels for Apartments must not exceed 500.\n// ApartmentPanels <= 500\n\n## Generate Constraint-4:\nThe efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments.\n// HouseEfficiency >= 1.2 * ApartmentEfficiency",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel. The cost of installation per solar panel and the energy generated per panel per day are given in the following Table.\n\n| Building Type | Installation Cost per Panel | Energy Generated per Panel per Day |\n|---------------|-----------------------------|------------------------------------|\n| Apartments    | $1000                       | ApartmentEfficiency * ApartmentPanels |\n| Houses        | $1500                       | HouseEfficiency * HousePanels       |\n| Commercial    | $2000                       | CommercialEfficiency * CommercialPanels |\n\nThe city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh. The city has a budget of $500,000 for the installation of solar panels. The number of solar panels for Apartments must not exceed 500. The efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments.\n\nPlease help the city to determine the optimal number of solar panels and their efficiencies to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartmentPanels = model.addVar(vtype=\"INTEGER\", name=\"ApartmentPanels\", lb=0)  # number of solar panels for Apartments\nHousePanels = model.addVar(vtype=\"INTEGER\", name=\"HousePanels\", lb=0)  # number of solar panels for Houses\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)  # number of solar panels for Commercial buildings\nApartmentEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"ApartmentEfficiency\", lb=0)  # efficiency of solar panels for Apartments\nHouseEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HouseEfficiency\", lb=0)  # efficiency of solar panels for Houses\nCommercialEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialEfficiency\", lb=0)  # efficiency of solar panels for Commercial buildings\n\n# Define objective function\nCost_Apartments = 1000 * ApartmentPanels\nCost_Houses = 1500 * HousePanels\nCost_Commercial = 2000 * CommercialPanels\n# So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n# Add constraints\n# The total daily energy generated must be at least 1000 kWh.\nEnergy_Apartments = ApartmentEfficiency * ApartmentPanels\nEnergy_Houses = HouseEfficiency * HousePanels\nEnergy_Commercial = CommercialEfficiency * CommercialPanels\nmodel.addCons(Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000)\n\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000)\n\n# The number of solar panels for Apartments must not exceed 500.\nmodel.addCons(ApartmentPanels <= 500)\n\n# The efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments.\nmodel.addCons(HouseEfficiency >= 1.2 * ApartmentEfficiency)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Apartments: \", model.getVal(ApartmentPanels))\n    print(\"Number of Solar Panels for Houses: \", model.getVal(HousePanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Efficiency of Solar Panels for Apartments: \", model.getVal(ApartmentEfficiency))\n    print(\"Efficiency of Solar Panels for Houses: \", model.getVal(HouseEfficiency))\n    print(\"Efficiency of Solar Panels for Commercial Buildings: \", model.getVal(CommercialEfficiency))\n    print(\"Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1439,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of DeviceC to fulfill a contract.\n// UnitsC >= 1,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount of research and development (R&D) investment for each device to optimize its profit. The profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n\n| Device | Profit per Unit | R&D Investment Impact |\n|--------|-----------------|-----------------------|\n| DeviceA | $500           | (1 + RDA / 1000)      |\n| DeviceB | $700           | (1 + RDB / 1000)      |\n| DeviceC | $600           | (1 + RDC / 1000)      |\n\nThe company has a total budget of $500,000 for R&D investments. The production capacity for the quarter is limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company must also produce at least 1,000 units of DeviceC to fulfill a contract.\n\nPlease help the company to determine the optimal number of units to produce for each device and the appropriate R&D investments to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RDA + RDB + RDC <= 500000)  # Total budget for R&D investments\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)  # Production capacity constraint\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Market demand constraint for DeviceA\nmodel.addCons(UnitsC >= 1000)  # Contract requirement for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. Additionally, the company must decide on the marketing budget for each product to maximize sales.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $2 for every $1000 increase in automation level. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales revenue per unit is $200 for ProductA, $240 for ProductB, and $300 for ProductC. The marketing budget increases the sales by 1% for every $1000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 * QuantityA - (100 - 0.002 * Automation) * QuantityA + 0.0001 * BudgetA * QuantityA)\n// Total profit for ProductB: ProfitB = (240 * QuantityB - (120 - 0.002 * Automation) * QuantityB + 0.0001 * BudgetB * QuantityB)\n// Total profit for ProductC: ProfitC = (300 * QuantityC - (150 - 0.002 * Automation) * QuantityC + 0.0001 * BudgetC * QuantityC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity of all products cannot exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget for all products cannot exceed $100,000.\n// BudgetA + BudgetB + BudgetC <= 100000\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductA and 150 units of ProductB are produced.\n// QuantityA >= 200; QuantityB >= 150\n\n## Generate Constraint-5:\nThe marketing budget for each product must be at least $10,000.\n// BudgetA >= 10000; BudgetB >= 10000; BudgetC >= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the level of automation to implement in the production process, and the marketing budget for each product to maximize sales. The production cost per unit decreases by $2 for every $1000 increase in automation level. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales revenue per unit is $200 for ProductA, $240 for ProductB, and $300 for ProductC. The marketing budget increases the sales by 1% for every $1000 spent. The company aims to maximize the total profit from all products.\n\nThe total production quantity of all products cannot exceed 1000 units. The total investment in automation cannot exceed $50,000. The total marketing budget for all products cannot exceed $100,000. The company must ensure that at least 200 units of ProductA and 150 units of ProductB are produced. The marketing budget for each product must be at least $10,000.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 * QuantityA - (100 - 0.002 * Automation) * QuantityA + 0.0001 * BudgetA * QuantityA)\nProfitB = (240 * QuantityB - (120 - 0.002 * Automation) * QuantityB + 0.0001 * BudgetB * QuantityB)\nProfitC = (300 * QuantityC - (150 - 0.002 * Automation) * QuantityC + 0.0001 * BudgetC * QuantityC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)  # total production quantity constraint\nmodel.addCons(Automation <= 50000)  # automation investment constraint\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 100000)  # total marketing budget constraint\nmodel.addCons(QuantityA >= 200)  # minimum production of ProductA\nmodel.addCons(QuantityB >= 150)  # minimum production of ProductB\nmodel.addCons(BudgetA >= 10000)  # minimum marketing budget for ProductA\nmodel.addCons(BudgetB >= 10000)  # minimum marketing budget for ProductB\nmodel.addCons(BudgetC >= 10000)  # minimum marketing budget for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of type 1 trucks must not exceed 10.\n// T1 <= 10",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation. Each type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The total capacity of all trucks must meet or exceed the required 1000 tons. The company has a budget to purchase at most 50 trucks in total. The number of type 1 trucks must not exceed 10. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\nFuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n## So, the objective function is: Minimize Fuel\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of type 1 trucks must not exceed 10.\nmodel.addCons(T1 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\n// Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\n// Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units per month.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceAUnits <= 2 * DeviceBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for the month. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, and for DeviceD is $40.\n// 20 * DeviceAUnits + 30 * DeviceBUnits + 25 * DeviceCUnits + 40 * DeviceDUnits <= 50,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units. The profit per unit for DeviceD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units. The company has a production capacity of 1000 units per month. The production of DeviceA must not exceed twice the production of DeviceB. The company has a budget of $50,000 for production costs for the month, with costs per unit for DeviceA at $20, DeviceB at $30, DeviceC at $25, and DeviceD at $40. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0)\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0)\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0)\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * DeviceA2) * DeviceA2 * DeviceA_b2 + 50 * DeviceA1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * max(DeviceBUnits - 200, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.05 * DeviceB2) * DeviceB2 * DeviceB_b2 + 70 * DeviceB1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (60 - 0.08 * max(DeviceCUnits - 150, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=150)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=150, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (60 - 0.08 * DeviceC2) * DeviceC2 * DeviceC_b2 + 60 * DeviceC1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (80 - 0.12 * max(DeviceDUnits - 250, 0)) * DeviceDUnits\nDeviceD1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD1\", lb=0, ub=250)\nDeviceD2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD2\", lb=250, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceDUnits == DeviceD1*DeviceD_b1 + DeviceD2*DeviceD_b2)\nProfit_DeviceD = (80 - 0.12 * DeviceD2) * DeviceD2 * DeviceD_b2 + 80 * DeviceD1 * DeviceD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits <= 1000)\nmodel.addCons(DeviceAUnits <= 2 * DeviceBUnits)\nmodel.addCons(20 * DeviceAUnits + 30 * DeviceBUnits + 25 * DeviceCUnits + 40 * DeviceDUnits <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints.\n// {\"quantity of M1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company aims to maximize its total profit.\n// Profit_M1 = 100 * Q1 - 0.01 * Q1^2\n// Profit_M2 = 150 * Q2 - 0.02 * Q2^2\n// Profit_M3 = 200 * Q3 - 0.03 * Q3^2\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production costs.\n// 0.01 * Q1^2 + 0.02 * Q2^2 + 0.03 * Q3^2 <= 10000",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints. The profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company aims to maximize its total profit. The company has a limited budget of $10,000 for production costs. Please help the company determine the optimal production quantities for M1, M2, and M3 to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of M1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of M2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of M3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = 100 * Q1 - 0.01 * Q1**2\nProfit_M2 = 150 * Q2 - 0.02 * Q2**2\nProfit_M3 = 200 * Q3 - 0.03 * Q3**2\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production costs.\nmodel.addCons(0.01 * Q1**2 + 0.02 * Q2**2 + 0.03 * Q3**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(Q1))\n    print(\"Quantity of M2: \", model.getVal(Q2))\n    print(\"Quantity of M3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter.\n// Fuel_Cost_A = (0.1 - 0.001 * FuelA) * Distance_A * TruckA\n// Fuel_Cost_B = (0.12 - 0.001 * FuelB) * Distance_B * TruckB\n// Fuel_Cost_C = (0.15 - 0.001 * FuelC) * Distance_C * TruckC\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 kilometers.\n// (0.1 - 0.001 * FuelA) * Distance_A * TruckA + (0.12 - 0.001 * FuelB) * Distance_B * TruckB + (0.15 - 0.001 * FuelC) * Distance_C * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for purchasing trucks and allocating fuel.\n// TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\n// TruckA >= 10; TruckB >= 5",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands. The fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter.\n\n| Vehicle Type | Fuel Consumption Rate (liters/km) | Decrease in Consumption Rate (liters/km per liter of fuel) |\n|--------------|-----------------------------------|--------------------------------------------------------------|\n| TruckA       | 0.1                               | 0.001                                                        |\n| TruckB       | 0.12                              | 0.001                                                        |\n| TruckC       | 0.15                              | 0.001                                                        |\n\nThe total distance to be covered by all trucks is 5000 kilometers. The company has a budget of $10,000 for purchasing trucks and allocating fuel. The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\n\nPlease help the company to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)\n\n# Define objective function\nFuel_Cost_A = (0.1 - 0.001 * FuelA) * TruckA\nFuel_Cost_B = (0.12 - 0.001 * FuelB) * TruckB\nFuel_Cost_C = (0.15 - 0.001 * FuelC) * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n# Add constraints\n# The total distance to be covered by all trucks is 5000 kilometers.\nmodel.addCons((0.1 - 0.001 * FuelA) * TruckA + (0.12 - 0.001 * FuelB) * TruckB + (0.15 - 0.001 * FuelC) * TruckC == 5000)\n# The company has a budget of $10,000 for purchasing trucks and allocating fuel.\nmodel.addCons(TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000)\n# The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1678,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck i at speed x\": \"Efficiency_i(x)\", \"range\": \"Efficiency_i(x) > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n// Fuel consumption for truck i on route j: Consumption_ij = Distance_j / Efficiency_i(Speed_i) * Trucks_j\n// Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\n// Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 100.\n// \u03a3(Trucks_j) for all j <= 100\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 120 km/h.\n// Speed_i <= 120 for all i\n\n## Generate Constraint-3:\nThe minimum speed required to maintain stability and safety is 40 km/h.\n// Speed_i >= 40 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed. The company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function. The total number of trucks available is limited to 100. The maximum speed limit for any truck is 120 km/h. The minimum speed required to maintain stability and safety is 40 km/h.\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed = {}\nfor i in range(1, 11):  # Assuming 10 trucks for simplicity\n    Speed[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=40, ub=120)\n\n## Number of trucks on each route\nTrucks = {}\nfor j in range(1, 6):  # Assuming 5 routes for simplicity\n    Trucks[j] = model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0)\n\n# Define objective function\n## Fuel efficiency function for each truck\nEfficiency = {}\nfor i in range(1, 11):\n    a_i, b_i, c_i = 0.0001, -0.01, 1.5  # Example coefficients for efficiency function\n    Efficiency[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Efficiency_{i}\", lb=0)\n    model.addCons(Efficiency[i] == a_i * Speed[i]**2 + b_i * Speed[i] + c_i)\n\n## Fuel consumption for each truck on each route\nConsumption = {}\nfor i in range(1, 11):\n    for j in range(1, 6):\n        Consumption[i, j] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Consumption_{i}_{j}\")\n        model.addCons(Consumption[i, j] == 1 / Efficiency[i] * Trucks[j])\n\n## Total fuel consumption\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Consumption[i, j] for i in range(1, 11) for j in range(1, 6)))\n\n# Add constraints\n## Total number of trucks available is limited to 100\nmodel.addCons(sum(Trucks[j] for j in range(1, 6)) <= 100)\n\n## Maximum speed limit for any truck is 120 km/h\nfor i in range(1, 11):\n    model.addCons(Speed[i] <= 120)\n\n## Minimum speed required to maintain stability and safety is 40 km/h\nfor i in range(1, 11):\n    model.addCons(Speed[i] >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(1, 11):\n        print(f\"Speed of truck {i}: {model.getVal(Speed[i])} km/h\")\n    for j in range(1, 6):\n        print(f\"Number of trucks on route {j}: {model.getVal(Trucks[j])}\")\n    print(f\"Total fuel consumption: {model.getObjVal()} liters\")\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost.\n// Cost_1 = 1000 * T1; Cost_2 = 1200 * T2; Cost_3 = 1500 * T3; Cost_4 = 1300 * T4; Cost_5 = 1400 * T5\n// Revenue_1 = 1800 * T1; Revenue_2 = 2000 * T2; Revenue_3 = 2200 * T3; Revenue_4 = 2100 * T4; Revenue_5 = 2300 * T5\n// Net_Profit_1 = Revenue_1 - Cost_1; Net_Profit_2 = Revenue_2 - Cost_2; Net_Profit_3 = Revenue_3 - Cost_3; Net_Profit_4 = Revenue_4 - Cost_4; Net_Profit_5 = Revenue_5 - Cost_5\n// So, the objective function is: Maximize (Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15\n\n## Generate Constraint-3:\nThe company aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 at least 10 trucks, route 3 at least 15 trucks, route 4 at least 5 trucks, and route 5 at least 3 trucks.\n// T1 >= 5; T2 >= 10; T3 >= 15; T4 >= 5; T5 >= 3\n\n## Generate Constraint-4:\nThe total number of trucks allocated to routes 1 and 2 combined should not exceed 40.\n// T1 + T2 <= 40",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost and revenue per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck | Maximum Capacity | Minimum Service Level |\n|-------|----------------|-------------------|------------------|-----------------------|\n| 1     | $1000          | $1800             | 20 trucks        | 5 trucks              |\n| 2     | $1200          | $2000             | 25 trucks        | 10 trucks             |\n| 3     | $1500          | $2200             | 30 trucks        | 15 trucks             |\n| 4     | $1300          | $2100             | 20 trucks        | 5 trucks              |\n| 5     | $1400          | $2300             | 15 trucks        | 3 trucks              |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks as specified in the table. The company aims to maintain a minimum service level on each route. The total number of trucks allocated to routes 1 and 2 combined should not exceed 40. \n\nPlease help the company to maximize the total net profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=3, ub=15) # number of trucks on route 5\n\n# Define objective function\nCost_1 = 1000 * T1\nCost_2 = 1200 * T2\nCost_3 = 1500 * T3\nCost_4 = 1300 * T4\nCost_5 = 1400 * T5\nRevenue_1 = 1800 * T1\nRevenue_2 = 2000 * T2\nRevenue_3 = 2200 * T3\nRevenue_4 = 2100 * T4\nRevenue_5 = 2300 * T5\nNet_Profit_1 = Revenue_1 - Cost_1\nNet_Profit_2 = Revenue_2 - Cost_2\nNet_Profit_3 = Revenue_3 - Cost_3\nNet_Profit_4 = Revenue_4 - Cost_4\nNet_Profit_5 = Revenue_5 - Cost_5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 + T2 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines.\n// The total production per hour: P = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50",
        "question": "A manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines. There are a total of 50 workers available.\nPlease help the plant manager determine the optimal number of workers to assign to each machine to maximize the total production per hour.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(W4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(W5))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per month. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating each shift is $1000. The company aims to maximize its total monthly profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_ProductA = 50 * ProdA\n// Profit_ProductB = 70 * ProdB\n// Profit_ProductC = 60 * ProdC\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a limited production capacity of 10,000 units per month.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-3:\nThe company has a budget of $5000 for shift operations per month.\n// 1000 * NumShifts <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per month and the number of shifts to operate in its factory to meet production demands. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating each shift is $1000. The factory has a limited production capacity of 10,000 units per month. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a budget of $5000 for shift operations per month. Please help the company to maximize its total monthly profit, considering both the revenue from product sales and the cost of operating shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProdA\nProfit_ProductB = 70 * ProdB\nProfit_ProductC = 60 * ProdC\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a limited production capacity of 10,000 units per month.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n# The company has a budget of $5000 for shift operations per month.\nmodel.addCons(1000 * NumShifts <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_A = 50 * ProductA\n// Profit_B = 70 * ProductB\n// Profit_C = 60 * ProductC\n// ShiftCost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can only support up to 3 shifts per day.\n// NumShifts <= 3\n\n## Generate Constraint-3:\nDue to market demand, the production of product A must be at least twice the production of product B.\n// ProductA >= 2 * ProductB\n\n## Generate Constraint-4:\nThe company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day.\n// 50 * ProductA + 70 * ProductB + 60 * ProductC + 1000 * NumShifts <= 5000\n\n## Generate Constraint-5:\nTo maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\n// ProductC <= ProductA + ProductB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product and the number of shifts to operate in its factory to maximize profit. The profit per unit and the cost of operating an additional shift are given in the following Table.\n\n| Product | Profit per Unit | Cost per Shift |\n|---------|-----------------|----------------|\n| A       | $50             | $1000          |\n| B       | $70             | $1000          |\n| C       | $60             | $1000          |\n\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts. The company has a limited workforce that can only support up to 3 shifts per day. Due to market demand, the production of product A must be at least twice the production of product B. The company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day. To maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\n\nPlease help the company to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nProfit_A = 50 * ProductA\nProfit_B = 70 * ProductB\nProfit_C = 60 * ProductC\nShiftCost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - ShiftCost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The company has a limited workforce that can only support up to 3 shifts per day.\nmodel.addCons(NumShifts <= 3)\n# Due to market demand, the production of product A must be at least twice the production of product B.\nmodel.addCons(ProductA >= 2 * ProductB)\n# The company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day.\nmodel.addCons(50 * ProductA + 70 * ProductB + 60 * ProductC + 1000 * NumShifts <= 5000)\n# To maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\nmodel.addCons(ProductC <= ProductA + ProductB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed. The company has a total fuel budget of 1000 liters per day. Please help the company determine the optimal number of Trucks, Vans, and Bikes to maximize their total daily efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_Truck = 1000 * 2 * T\nFuel_Truck = 50 * 2 * T\nRevenue_Van = 500 * 3 * V\nFuel_Van = 20 * 3 * V\nRevenue_Bike = 100 * 5 * B\nFuel_Bike = 1 * 5 * B\n## the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_Truck + Fuel_Van + Fuel_Bike) == Revenue_Truck + Revenue_Van + Revenue_Bike)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Daily Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency.\n// {\"quantity of Drug A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Drug A is $10, but it decreases by $0.02 for every unit produced above 100. The profit per unit of Drug B is $15, but it decreases by $0.03 for every unit produced above 150. The profit per unit of Drug C is $20, but it decreases by $0.04 for every unit produced above 200. The profit per unit of Drug D is $25, but it decreases by $0.05 for every unit produced above 250. The profit per unit of Drug E is $30, but it decreases by $0.06 for every unit produced above 300. The company wants to maximize the total profit from selling the drugs.\n// Profit_A = max(10 - 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 - 0.03 * (B - 150), 15) * B\n// Profit_C = max(20 - 0.04 * (C - 200), 20) * C\n// Profit_D = max(25 - 0.05 * (D - 250), 25) * D\n// Profit_E = max(30 - 0.06 * (E - 300), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe cost of raw materials for Drug A is $3 per unit, for Drug B is $4 per unit, for Drug C is $5 per unit, for Drug D is $6 per unit, and for Drug E is $7 per unit. The company has a budget of $2000 for raw materials.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000\n\n## Generate Constraint-2:\nThe production capacity for each drug is limited. The maximum production capacity for Drug A is 300 units, for Drug B is 250 units, for Drug C is 200 units, for Drug D is 150 units, and for Drug E is 100 units.\n// A <= 300; B <= 250; C <= 200; D <= 150; E <= 100\n\n## Generate Constraint-3:\nThe total production capacity of the company is 600 units.\n// A + B + C + D + E <= 600",
        "question": "A pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency.\nThe profit per unit of Drug A is $10, but it decreases by $0.02 for every unit produced above 100. The profit per unit of Drug B is $15, but it decreases by $0.03 for every unit produced above 150. The profit per unit of Drug C is $20, but it decreases by $0.04 for every unit produced above 200. The profit per unit of Drug D is $25, but it decreases by $0.05 for every unit produced above 250. The profit per unit of Drug E is $30, but it decreases by $0.06 for every unit produced above 300. The company wants to maximize the total profit from selling the drugs.\nThe cost of raw materials for Drug A is $3 per unit, for Drug B is $4 per unit, for Drug C is $5 per unit, for Drug D is $6 per unit, and for Drug E is $7 per unit. The company has a budget of $2000 for raw materials. The production capacity for each drug is limited. The maximum production capacity for Drug A is 300 units, for Drug B is 250 units, for Drug C is 200 units, for Drug D is 150 units, and for Drug E is 100 units. The total production capacity of the company is 600 units.\nPlease help the company to maximize the total profit from selling the drugs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Drug A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of Drug B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of Drug C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=150) # quantity of Drug D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=100) # quantity of Drug E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.03 * (B - 150), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.03 * (B2 - 150)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.04 * (C - 200), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.04 * (C2 - 200)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.05 * (D - 250), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=250)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=250, ub=150)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.05 * (D2 - 250)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.06 * (E - 300), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=300)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=300, ub=100)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.06 * (E2 - 300)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000)\nmodel.addCons(A + B + C + D + E <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Drug A: \", model.getVal(A))\n    print(\"Quantity of Drug B: \", model.getVal(B))\n    print(\"Quantity of Drug C: \", model.getVal(C))\n    print(\"Quantity of Drug D: \", model.getVal(D))\n    print(\"Quantity of Drug E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1388,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5\n\n## Generate Constraint-3:\nThe total travel time for all routes must not exceed 200 hours.\n// TimeA + TimeB + TimeC + TimeD + TimeE <= 200\n\n## Generate Constraint-4:\nThe total fuel consumption for all routes must not exceed 3000 liters.\n// FuelA + FuelB + FuelC + FuelD + FuelE <= 3000\n\n## Generate Constraint-5:\nThe number of trucks allocated to city E must be less than or equal to the sum of the trucks allocated to cities A, B, and C.\n// TrucksE <= TrucksA + TrucksB + TrucksC",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\nFor city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours.\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city. The total travel time for all routes must not exceed 200 hours. The total fuel consumption for all routes must not exceed 3000 liters. The number of trucks allocated to city E must be less than or equal to the sum of the trucks allocated to cities A, B, and C.\nPlease help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n# So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TimeA + TimeB + TimeC + TimeD + TimeE <= 200)\nmodel.addCons(FuelA + FuelB + FuelC + FuelD + FuelE <= 3000)\nmodel.addCons(TrucksE <= TrucksA + TrucksB + TrucksC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck on Route A is $1000, minus a fuel cost of $200 and a maintenance cost of $100.\nThe profit per truck on Route B is $1200, minus a fuel cost of $250 and a maintenance cost of $150.\nThe profit per truck on Route C is $1500, minus a fuel cost of $300 and a maintenance cost of $200.\nThe profit per truck on Route D is $1800, minus a fuel cost of $350 and a maintenance cost of $250.\nThe profit per truck on Route E is $2000, minus a fuel cost of $400 and a maintenance cost of $300.\nThe company aims to maximize the total net profit from all routes.\n// Net_Profit_A = (1000 - 200 - 100) * Trucks_A\n// Net_Profit_B = (1200 - 250 - 150) * Trucks_B\n// Net_Profit_C = (1500 - 300 - 200) * Trucks_C\n// Net_Profit_D = (1800 - 350 - 250) * Trucks_D\n// Net_Profit_E = (2000 - 400 - 300) * Trucks_E\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route.\nThe profit per truck on Route A is $1000, minus a fuel cost of $200 and a maintenance cost of $100.\nThe profit per truck on Route B is $1200, minus a fuel cost of $250 and a maintenance cost of $150.\nThe profit per truck on Route C is $1500, minus a fuel cost of $300 and a maintenance cost of $200.\nThe profit per truck on Route D is $1800, minus a fuel cost of $350 and a maintenance cost of $250.\nThe profit per truck on Route E is $2000, minus a fuel cost of $400 and a maintenance cost of $300.\nThe company has a total of 50 trucks available.\nPlease help the company to maximize the total net profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Route D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Route E\n\n# Define objective function\nNet_Profit_A = (1000 - 200 - 100) * Trucks_A\nNet_Profit_B = (1200 - 250 - 150) * Trucks_B\nNet_Profit_C = (1500 - 300 - 200) * Trucks_C\nNet_Profit_D = (1800 - 350 - 250) * Trucks_D\nNet_Profit_E = (2000 - 400 - 300) * Trucks_E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Route E: \", model.getVal(Trucks_E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net profit per day.\n// NetProfit_A = (1000 - 500) * TrucksA\n// NetProfit_B = (1200 - 600) * TrucksB\n// NetProfit_C = (1400 - 700) * TrucksC\n// NetProfit_D = (1600 - 800) * TrucksD\n// NetProfit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a daily budget of $30,000 for operating costs.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000\n\n## Generate Constraint-4:\nTo ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\n// |TrucksA - TrucksB| <= 10\n// |TrucksA - TrucksC| <= 10\n// |TrucksA - TrucksD| <= 10\n// |TrucksA - TrucksE| <= 10\n// |TrucksB - TrucksC| <= 10\n// |TrucksB - TrucksD| <= 10\n// |TrucksB - TrucksE| <= 10\n// |TrucksC - TrucksD| <= 10\n// |TrucksC - TrucksE| <= 10\n// |TrucksD - TrucksE| <= 10",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company has a total of 50 trucks available. Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB. The company has a daily budget of $30,000 for operating costs. To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\nPlease help the company to maximize the total net profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nNetProfit_A = (1000 - 500) * TrucksA\nNetProfit_B = (1200 - 600) * TrucksB\nNetProfit_C = (1400 - 700) * TrucksC\nNetProfit_D = (1600 - 800) * TrucksD\nNetProfit_E = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n# The company has a daily budget of $30,000 for operating costs.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n\n# To ensure balanced distribution, the company wants to limit the maximum difference in the number of trucks between any two types of goods to 10.\nmodel.addCons(abs(TrucksA - TrucksB) <= 10)\nmodel.addCons(abs(TrucksA - TrucksC) <= 10)\nmodel.addCons(abs(TrucksA - TrucksD) <= 10)\nmodel.addCons(abs(TrucksA - TrucksE) <= 10)\nmodel.addCons(abs(TrucksB - TrucksC) <= 10)\nmodel.addCons(abs(TrucksB - TrucksD) <= 10)\nmodel.addCons(abs(TrucksB - TrucksE) <= 10)\nmodel.addCons(abs(TrucksC - TrucksD) <= 10)\nmodel.addCons(abs(TrucksC - TrucksE) <= 10)\nmodel.addCons(abs(TrucksD - TrucksE) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations.\n// {\"trips of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for Truck A is $1000, and it can carry 10 tons of goods. For Truck B, the cost per trip is $1500, and it can carry 15 tons of goods. For Truck C, the cost per trip is $2000, and it can carry 20 tons of goods. The company wants to minimize the total cost of transportation while ensuring all goods are delivered.\n// Cost_A = 1000 * A\n// Cost_B = 1500 * B\n// Cost_C = 2000 * C\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total weight of goods to be transported is 600 tons.\n// 10 * A + 15 * B + 20 * C >= 600\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for transportation costs.\n// 1000 * A + 1500 * B + 2000 * C <= 100000\n\n## Generate Constraint-3:\nThe number of trips for each vehicle must not exceed 50.\n// A <= 50\n// B <= 50\n// C <= 50\n\n## Generate Constraint-4:\nThe company aims to use at least 2 different types of vehicles for diversification.\n// A + B + C >= 2\n\n## Generate Constraint-5:\nThe company prefers to use Truck C more than Truck A and B combined, if possible.\n// C >= A + B",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations. The cost per trip for Truck A is $1000, and it can carry 10 tons of goods. For Truck B, the cost per trip is $1500, and it can carry 15 tons of goods. For Truck C, the cost per trip is $2000, and it can carry 20 tons of goods. The company wants to minimize the total cost of transportation while ensuring all goods are delivered. The total weight of goods to be transported is 600 tons. The company has a budget of $100,000 for transportation costs. The number of trips for each vehicle must not exceed 50. The company aims to use at least 2 different types of vehicles for diversification. The company prefers to use Truck C more than Truck A and B combined, if possible. Please help the company to determine the optimal number of trips for each vehicle.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # trips of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=50) # trips of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=50) # trips of Truck C\n\n# Define objective function\nCost_A = 1000 * A\nCost_B = 1500 * B\nCost_C = 2000 * C\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total weight of goods to be transported is 600 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 600)\n# The company has a budget of $100,000 for transportation costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 100000)\n# The number of trips for each vehicle must not exceed 50.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 50)\nmodel.addCons(C <= 50)\n# The company aims to use at least 2 different types of vehicles for diversification.\nmodel.addCons(A + B + C >= 2)\n# The company prefers to use Truck C more than Truck A and B combined, if possible.\nmodel.addCons(C >= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips of Truck A: \", model.getVal(A))\n    print(\"Trips of Truck B: \", model.getVal(B))\n    print(\"Trips of Truck C: \", model.getVal(C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\n// Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\n// Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\n// Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\n// So, the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 units in total.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\n// 5 * C1 + 7 * C2 + 9 * C3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for C1 is at least 50 units and at most 200 units.\n// 50 <= C1 <= 200\n\n## Generate Constraint-4:\nThe market demand for C2 is at least 100 units and at most 300 units.\n// 100 <= C2 <= 300",
        "question": "A manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints. The profit per unit of each component and the associated production costs are given in the following Table.\n\n| Component | Profit per Unit | Cost per Unit |\n|-----------|-----------------|---------------|\n| C1        | $10 - $0.02 * max(C1 - 100, 0) | $5 |\n| C2        | $15 - $0.03 * max(C2 - 200, 0) | $7 |\n| C3        | $20 - $0.04 * max(C3 - 300, 0) | $9 |\n\nThe company has a limited production capacity of 500 units in total. The company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3, with a total budget of $3000. The market demand for C1 is at least 50 units and at most 200 units, and for C2 is at least 100 units and at most 300 units.\n\nPlease help the company to maximize the total profit from selling these components by determining the optimal quantities of C1, C2, and C3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\nC1_1 = model.addVar(vtype=\"INTEGER\", name=\"C1_1\", lb=50, ub=100)\nC1_2 = model.addVar(vtype=\"INTEGER\", name=\"C1_2\", lb=100, ub=200)\nC1_b1 = model.addVar(vtype=\"B\", name=\"C1_b1\")\nC1_b2 = model.addVar(vtype=\"B\", name=\"C1_b2\")\nmodel.addCons(C1_b1 + C1_b2 == 1)\nmodel.addCons(C1 == C1_1*C1_b1 + C1_2*C1_b2)\nProfit_C1 = (10 - 0.02 * (C1_2 - 100)) * C1_2 * C1_b2 + 10 * C1_1 * C1_b1\n## create piecewise variables for piecewise function: Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\nC2_1 = model.addVar(vtype=\"INTEGER\", name=\"C2_1\", lb=100, ub=200)\nC2_2 = model.addVar(vtype=\"INTEGER\", name=\"C2_2\", lb=200, ub=300)\nC2_b1 = model.addVar(vtype=\"B\", name=\"C2_b1\")\nC2_b2 = model.addVar(vtype=\"B\", name=\"C2_b2\")\nmodel.addCons(C2_b1 + C2_b2 == 1)\nmodel.addCons(C2 == C2_1*C2_b1 + C2_2*C2_b2)\nProfit_C2 = (15 - 0.03 * (C2_2 - 200)) * C2_2 * C2_b2 + 15 * C2_1 * C2_b1\n## create piecewise variables for piecewise function: Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\nC3_1 = model.addVar(vtype=\"INTEGER\", name=\"C3_1\", lb=0, ub=300)\nC3_b1 = model.addVar(vtype=\"B\", name=\"C3_b1\")\nmodel.addCons(C3_b1 == 1)\nmodel.addCons(C3 == C3_1)\nProfit_C3 = 20 * C3_1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 <= 500)\nmodel.addCons(5 * C1 + 7 * C2 + 9 * C3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity, and the company needs to determine the optimal number of trips each truck should make to minimize fuel consumption while meeting delivery requirements.\n// {\"trips for T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips for T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips for T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips for T4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips for T5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for T1 per trip is 100 liters, for T2 is 120 liters, for T3 is 140 liters, for T4 is 160 liters, and for T5 is 180 liters. The company aims to minimize the total fuel consumption.\n// Fuel_Consumption_T1 = 100 * T1\n// Fuel_Consumption_T2 = 120 * T2\n// Fuel_Consumption_T3 = 140 * T3\n// Fuel_Consumption_T4 = 160 * T4\n// Fuel_Consumption_T5 = 180 * T5\n// So, the objective function is: Minimize (Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 50 trips.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its routes for five different trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency and capacity, and the company needs to determine the optimal number of trips each truck should make to minimize fuel consumption while meeting delivery requirements. The fuel consumption for T1 per trip is 100 liters, for T2 is 120 liters, for T3 is 140 liters, for T4 is 160 liters, and for T5 is 180 liters. The total number of trips across all trucks must not exceed 50 trips. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips for T1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips for T2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trips for T3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips for T4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips for T5\n\n# Define objective function\nFuel_Consumption_T1 = 100 * T1\nFuel_Consumption_T2 = 120 * T2\nFuel_Consumption_T3 = 140 * T3\nFuel_Consumption_T4 = 160 * T4\nFuel_Consumption_T5 = 180 * T5\n# So, the objective function is: Minimize (Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_T1 + Fuel_Consumption_T2 + Fuel_Consumption_T3 + Fuel_Consumption_T4 + Fuel_Consumption_T5)\n\n# Add constraints\n# The total number of trips across all trucks must not exceed 50 trips.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips for T1: \", model.getVal(T1))\n    print(\"Trips for T2: \", model.getVal(T2))\n    print(\"Trips for T3: \", model.getVal(T3))\n    print(\"Trips for T4: \", model.getVal(T4))\n    print(\"Trips for T5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 580,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering packages. The company needs to determine the number of trucks to assign to each route to optimize delivery times and costs.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different delivery times and costs per truck. The company aims to minimize the total delivery time and cost while ensuring all packages are delivered on time.\n// Delivery time on route 1: D1 = 5 * T1^2\n// Delivery time on route 2: D2 = 4 * T2^2\n// Delivery time on route 3: D3 = 6 * T3^2\n// Delivery time on route 4: D4 = 3 * T4^2\n// Delivery time on route 5: D5 = 7 * T5^2\n// Delivery time on route 6: D6 = 8 * T6^2\n// The objective function is: Minimize (D1 + D2 + D3 + D4 + D5 + D6)\n// Minimize (5 * T1^2 + 4 * T2^2 + 6 * T3^2 + 3 * T4^2 + 7 * T5^2 + 8 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks at a time.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe total number of packages to be delivered on each route must be met.\n// 1000 * T1 >= 5000; 1500 * T2 >= 7500; 2000 * T3 >= 10000; 2500 * T4 >= 12500; 3000 * T5 >= 15000; 3500 * T6 >= 17500",
        "question": "A logistics company operates 6 different routes for delivering packages. The company needs to determine the number of trucks to assign to each route to optimize delivery times and costs. The delivery time for each route is given by the following formula: Delivery time = constant * (number of trucks)^2. The constants for each route are as follows:\n\n| Route | Constant |\n|-------|----------|\n| 1     | 5        |\n| 2     | 4        |\n| 3     | 6        |\n| 4     | 3        |\n| 5     | 7        |\n| 6     | 8        |\n\nThe company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks at a time. The total number of packages to be delivered on each route must be met, with the following minimum requirements:\n- Route 1: 1000 * T1 >= 5000\n- Route 2: 1500 * T2 >= 7500\n- Route 3: 2000 * T3 >= 10000\n- Route 4: 2500 * T4 >= 12500\n- Route 5: 3000 * T5 >= 15000\n- Route 6: 3500 * T6 >= 17500\n\nPlease help the company to minimize the total delivery time and cost while ensuring all packages are delivered on time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\nD1 = 5 * T1**2\nD2 = 4 * T2**2\nD3 = 6 * T3**2\nD4 = 3 * T4**2\nD5 = 7 * T5**2\nD6 = 8 * T6**2\n# The objective function is: Minimize (D1 + D2 + D3 + D4 + D5 + D6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == D1 + D2 + D3 + D4 + D5 + D6)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n# The total number of packages to be delivered on each route must be met.\nmodel.addCons(1000 * T1 >= 5000)\nmodel.addCons(1500 * T2 >= 7500)\nmodel.addCons(2000 * T3 >= 10000)\nmodel.addCons(2500 * T4 >= 12500)\nmodel.addCons(3000 * T5 >= 15000)\nmodel.addCons(3500 * T6 >= 17500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Total Delivery Time and Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce the production cost per unit for all products.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $2 for every $10,000 invested in the new technology. The initial production cost per unit for A is $50, for B is $60, for C is $70, and for D is $80. The selling price per unit is $100 for A, $120 for B, $140 for C, and $160 for D. The company aims to maximize the total profit from all products.\n// Total profit for A: ProfitA = (100 - 50 + 0.0002 * TechInvestment) * A\n// Total profit for B: ProfitB = (120 - 60 + 0.0002 * TechInvestment) * B\n// Total profit for C: ProfitC = (140 - 70 + 0.0002 * TechInvestment) * C\n// Total profit for D: ProfitD = (160 - 80 + 0.0002 * TechInvestment) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 5000 units.\n// A + B + C + D <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product A and 800 units of product B.\n// A >= 500; B >= 800",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new technology that could reduce the production cost per unit for all products. The production cost per unit decreases by $2 for every $10,000 invested in the new technology. The initial production cost per unit for A is $50, for B is $60, for C is $70, and for D is $80. The selling price per unit is $100 for A, $120 for B, $140 for C, and $160 for D. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for the investment in the new technology. The total production capacity for the next quarter is 5000 units. The company must produce at least 500 units of product A and 800 units of product B. Please help the company to determine the optimal production quantities and the amount to invest in the new technology to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=800) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * TechInvestment) * A\nProfitB = (120 - 60 + 0.0002 * TechInvestment) * B\nProfitC = (140 - 70 + 0.0002 * TechInvestment) * C\nProfitD = (160 - 80 + 0.0002 * TechInvestment) * D\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n# The total production capacity for the next quarter is 5000 units.\nmodel.addCons(A + B + C + D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand.\n// {\"quantity of Chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of Chemical A is $100, with a production cost of $60 per unit. Chemical B has a revenue of $150 per unit and a production cost of $90 per unit. Chemical C has a revenue of $200 per unit and a production cost of $120 per unit. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 60 * A\n// Profit_B = 150 * B - 90 * B\n// Profit_C = 200 * C - 120 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit.\n// 5 * A + 8 * B + 10 * C <= 2000\n\n## Generate Constraint-2:\nThe company has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit.\n// 60 * A + 90 * B + 120 * C <= 150,000\n\n## Generate Constraint-3:\nThe market demand for Chemical A is 1000 units. So, the company can only sell a maximum of 1000 units of Chemical A.\n// A <= 1000\n\n## Generate Constraint-4:\nDue to environmental regulations, the production of Chemical C cannot exceed 50% of the total production of Chemical A and Chemical B.\n// C <= 0.5 * (A + B)\n\n## Generate Constraint-5:\nThe company aims to produce at least 500 units of Chemical B to meet a contractual obligation.\n// B >= 500",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand. The revenue per unit of Chemical A is $100, with a production cost of $60 per unit. Chemical B has a revenue of $150 per unit and a production cost of $90 per unit. Chemical C has a revenue of $200 per unit and a production cost of $120 per unit. The company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit. The company has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit. The market demand for Chemical A is 1000 units. Due to environmental regulations, the production of Chemical C cannot exceed 50% of the total production of Chemical A and Chemical B. The company aims to produce at least 500 units of Chemical B to meet a contractual obligation. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=500) # quantity of Chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chemical C\n\n# Define objective function\nProfit_A = 100 * A - 60 * A\nProfit_B = 150 * B - 90 * B\nProfit_C = 200 * C - 120 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a limited storage capacity of 2000 cubic meters.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 2000)\n# The company has a production budget of $150,000.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 150000)\n# The market demand for Chemical A is 1000 units.\nmodel.addCons(A <= 1000)\n# Due to environmental regulations, the production of Chemical C cannot exceed 50% of the total production of Chemical A and Chemical B.\nmodel.addCons(C <= 0.5 * (A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Phone, Tablet, Laptop, Smartwatch, and Camera. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatch\": \"Smartwatch\", \"range\": \"Smartwatch >= 0\", \"type\": \"integer\"}\n// {\"quantity of Camera\": \"Camera\", \"range\": \"Camera >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each device is as follows: Phone $50, Tablet $70, Laptop $100, Smartwatch $30, and Camera $60. Due to economies of scale, the profit per unit increases by $0.10 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Phone = max(50 + 0.10 * (Phone - 100), 50) * Phone\n// Profit_Tablet = max(70 + 0.10 * (Tablet - 100), 70) * Tablet\n// Profit_Laptop = max(100 + 0.10 * (Laptop - 100), 100) * Laptop\n// Profit_Smartwatch = max(30 + 0.10 * (Smartwatch - 100), 30) * Smartwatch\n// Profit_Camera = max(60 + 0.10 * (Camera - 100), 60) * Camera\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for each device is: Phone $20, Tablet $30, Laptop $50, Smartwatch $15, and Camera $30.\n// 20 * Phone + 30 * Tablet + 50 * Laptop + 15 * Smartwatch + 30 * Camera <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 300 units in total.\n// Phone + Tablet + Laptop + Smartwatch + Camera <= 300",
        "question": "A manufacturing company produces five types of electronic devices: Phone, Tablet, Laptop, Smartwatch, and Camera. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows: Phone $50, Tablet $70, Laptop $100, Smartwatch $30, and Camera $60. Due to economies of scale, the profit per unit increases by $0.10 for each device type when the production quantity exceeds 100 units. The company has a budget of $10,000 for production costs, with the cost per unit for each device being: Phone $20, Tablet $30, Laptop $50, Smartwatch $15, and Camera $30. The company also has a limited production capacity of 300 units in total. Please help the company to maximize the total profit from the sales of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0)  # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0)  # quantity of Tablet\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0)  # quantity of Laptop\nSmartwatch = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch\", lb=0)  # quantity of Smartwatch\nCamera = model.addVar(vtype=\"INTEGER\", name=\"Camera\", lb=0)  # quantity of Camera\n\n# Define objective function\n# create piecewise variables for piecewise function: Profit_Phone = max(50 + 0.10 * (Phone - 100), 50) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=300)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 50 * Phone1 * Phone_b1 + (50 + 0.10 * (Phone2 - 100)) * Phone2 * Phone_b2\n\n# create piecewise variables for piecewise function: Profit_Tablet = max(70 + 0.10 * (Tablet - 100), 70) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=300)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 70 * Tablet1 * Tablet_b1 + (70 + 0.10 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n\n# create piecewise variables for piecewise function: Profit_Laptop = max(100 + 0.10 * (Laptop - 100), 100) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 100 * Laptop1 * Laptop_b1 + (100 + 0.10 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n\n# create piecewise variables for piecewise function: Profit_Smartwatch = max(30 + 0.10 * (Smartwatch - 100), 30) * Smartwatch\nSmartwatch1 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch1\", lb=0, ub=100)\nSmartwatch2 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch2\", lb=100, ub=300)\nSmartwatch_b1 = model.addVar(vtype=\"B\", name=\"Smartwatch_b1\")\nSmartwatch_b2 = model.addVar(vtype=\"B\", name=\"Smartwatch_b2\")\nmodel.addCons(Smartwatch_b1 + Smartwatch_b2 == 1)\nmodel.addCons(Smartwatch == Smartwatch1*Smartwatch_b1 + Smartwatch2*Smartwatch_b2)\nProfit_Smartwatch = 30 * Smartwatch1 * Smartwatch_b1 + (30 + 0.10 * (Smartwatch2 - 100)) * Smartwatch2 * Smartwatch_b2\n\n# create piecewise variables for piecewise function: Profit_Camera = max(60 + 0.10 * (Camera - 100), 60) * Camera\nCamera1 = model.addVar(vtype=\"INTEGER\", name=\"Camera1\", lb=0, ub=100)\nCamera2 = model.addVar(vtype=\"INTEGER\", name=\"Camera2\", lb=100, ub=300)\nCamera_b1 = model.addVar(vtype=\"B\", name=\"Camera_b1\")\nCamera_b2 = model.addVar(vtype=\"B\", name=\"Camera_b2\")\nmodel.addCons(Camera_b1 + Camera_b2 == 1)\nmodel.addCons(Camera == Camera1*Camera_b1 + Camera2*Camera_b2)\nProfit_Camera = 60 * Camera1 * Camera_b1 + (60 + 0.10 * (Camera2 - 100)) * Camera2 * Camera_b2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera)\n\n# Add constraints\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * Phone + 30 * Tablet + 50 * Laptop + 15 * Smartwatch + 30 * Camera <= 10000)\n# The company has a limited production capacity of 300 units in total.\nmodel.addCons(Phone + Tablet + Laptop + Smartwatch + Camera <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Quantity of Smartwatch: \", model.getVal(Smartwatch))\n    print(\"Quantity of Camera: \", model.getVal(Camera))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceEUnits\", \"range\": \"DeviceEUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the Selling Price per Unit is $200, the Production Cost per Unit is $120, and the Storage Cost per Unit is $10. \nFor DeviceB, the Selling Price per Unit is $250, the Production Cost per Unit is $150, and the Storage Cost per Unit is $15. \nFor DeviceC, the Selling Price per Unit is $300, the Production Cost per Unit is $180, and the Storage Cost per Unit is $20.\nFor DeviceD, the Selling Price per Unit is $220, the Production Cost per Unit is $130, and the Storage Cost per Unit is $12.\nFor DeviceE, the Selling Price per Unit is $280, the Production Cost per Unit is $160, and the Storage Cost per Unit is $18.\nThe company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (200 - 120 - 10) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (250 - 150 - 15) * DeviceBUnits\n// Total net profit for DeviceC: Profit_DeviceC = (300 - 180 - 20) * DeviceCUnits\n// Total net profit for DeviceD: Profit_DeviceD = (220 - 130 - 12) * DeviceDUnits\n// Total net profit for DeviceE: Profit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the quarter.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\n// DeviceAUnits >= 1.5 * DeviceBUnits",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit.\nFor DeviceA, the Selling Price per Unit is $200, the Production Cost per Unit is $120, and the Storage Cost per Unit is $10. \nFor DeviceB, the Selling Price per Unit is $250, the Production Cost per Unit is $150, and the Storage Cost per Unit is $15. \nFor DeviceC, the Selling Price per Unit is $300, the Production Cost per Unit is $180, and the Storage Cost per Unit is $20.\nFor DeviceD, the Selling Price per Unit is $220, the Production Cost per Unit is $130, and the Storage Cost per Unit is $12.\nFor DeviceE, the Selling Price per Unit is $280, the Production Cost per Unit is $160, and the Storage Cost per Unit is $18.\nThe company has a total production capacity of 1000 units for the quarter. Due to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=0) # number of units of DeviceD\nDeviceEUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceEUnits\", lb=0) # number of units of DeviceE\n\n# Define objective function\nProfit_DeviceA = (200 - 120 - 10) * DeviceAUnits\nProfit_DeviceB = (250 - 150 - 15) * DeviceBUnits\nProfit_DeviceC = (300 - 180 - 20) * DeviceCUnits\nProfit_DeviceD = (220 - 130 - 12) * DeviceDUnits\nProfit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 1000 units for the quarter.\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000)\n# Due to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\nmodel.addCons(DeviceAUnits >= 1.5 * DeviceBUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Number of DeviceE Units: \", model.getVal(DeviceEUnits))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost.\n// Net profit of A: NetProfit_A = (20 - 5) * A\n// Net profit of B: NetProfit_B = (30 - 10) * B\n// Net profit of C: NetProfit_C = (40 - 15) * C\n// Net profit of D: NetProfit_D = (50 - 20) * D\n// Total transportation cost: TotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 5 * A + 10 * B + 15 * C + 20 * D <= 5000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit. The profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost. The company has a budget of $5000 for transportation costs. Please help the company to determine the optimal number of units to distribute for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (20 - 5) * A\nNetProfit_B = (30 - 10) * B\nNetProfit_C = (40 - 15) * C\nNetProfit_D = (50 - 20) * D\nTotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different delivery efficiencies based on the number of trucks allocated. \nOn route 1, each additional truck increases the delivery efficiency by 10% of the previous total. \nOn route 2, each additional truck increases the delivery efficiency by 15% of the previous total. \nOn route 3, each additional truck increases the delivery efficiency by 20% of the previous total. \nOn route 4, each additional truck increases the delivery efficiency by 25% of the previous total.\nOn route 5, each additional truck increases the delivery efficiency by 30% of the previous total.\nThe company wants to maximize the total delivery efficiency across all routes.\n// Efficiency_R1 = 1.1^T1\n// Efficiency_R2 = 1.15^T2\n// Efficiency_R3 = 1.2^T3\n// Efficiency_R4 = 1.25^T4\n// Efficiency_R5 = 1.3^T5\n// So, the objective function is: Maximize (Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has different delivery efficiencies based on the number of trucks allocated. On route 1, each additional truck increases the delivery efficiency by 10% of the previous total. On route 2, each additional truck increases the delivery efficiency by 15% of the previous total. On route 3, each additional truck increases the delivery efficiency by 20% of the previous total. On route 4, each additional truck increases the delivery efficiency by 25% of the previous total. On route 5, each additional truck increases the delivery efficiency by 30% of the previous total. The company wants to maximize the total delivery efficiency across all routes. The company has a total of 100 trucks available. Please help the company determine the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n# Since pyscipopt does not support non-linear objective, we need to approximate the exponential functions with piecewise linear functions\n# Define piecewise linear approximation for each route efficiency\nEfficiency_R1 = model.addVar(name=\"Efficiency_R1\")\nEfficiency_R2 = model.addVar(name=\"Efficiency_R2\")\nEfficiency_R3 = model.addVar(name=\"Efficiency_R3\")\nEfficiency_R4 = model.addVar(name=\"Efficiency_R4\")\nEfficiency_R5 = model.addVar(name=\"Efficiency_R5\")\n\n# Set up piecewise linear constraints for each route efficiency\n# For simplicity, we assume a piecewise linear approximation with 10 segments for each route\n# This can be adjusted based on the desired accuracy and computational resources\nfor i in range(10):\n    model.addCons(Efficiency_R1 >= (1.1 ** i) * T1)\n    model.addCons(Efficiency_R1 <= (1.1 ** (i + 1)) * T1)\n    model.addCons(Efficiency_R2 >= (1.15 ** i) * T2)\n    model.addCons(Efficiency_R2 <= (1.15 ** (i + 1)) * T2)\n    model.addCons(Efficiency_R3 >= (1.2 ** i) * T3)\n    model.addCons(Efficiency_R3 <= (1.2 ** (i + 1)) * T3)\n    model.addCons(Efficiency_R4 >= (1.25 ** i) * T4)\n    model.addCons(Efficiency_R4 <= (1.25 ** (i + 1)) * T4)\n    model.addCons(Efficiency_R5 >= (1.3 ** i) * T5)\n    model.addCons(Efficiency_R5 <= (1.3 ** (i + 1)) * T5)\n\n# Set objective as a variable\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Maximized Total Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting the required cargo capacity. Additionally, the company can invest in fuel-saving technologies for each type of vehicle, which will reduce fuel consumption per kilometer but at a cost.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-saving technology for TruckA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for TruckB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-saving technology for TruckC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per kilometer for TruckA is 0.3 liters, which decreases by 0.01 liters for every $100 invested in fuel-saving technology.\nThe fuel consumption per kilometer for TruckB is 0.25 liters, which decreases by 0.008 liters for every $100 invested in fuel-saving technology.\nThe fuel consumption per kilometer for TruckC is 0.2 liters, which decreases by 0.005 liters for every $100 invested in fuel-saving technology.\nThe total route distance is 1000 kilometers. The company aims to minimize the total fuel consumption.\n// Fuel_TruckA = 1000 * (0.3 - 0.0001 * TechA) * TruckA\n// Fuel_TruckB = 1000 * (0.25 - 0.00008 * TechB) * TruckB\n// Fuel_TruckC = 1000 * (0.2 - 0.00005 * TechC) * TruckC\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons. TruckA has a capacity of 10 tons, TruckB has a capacity of 15 tons, and TruckC has a capacity of 20 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 500",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting the required cargo capacity. Additionally, the company can invest in fuel-saving technologies for each type of vehicle, which will reduce fuel consumption per kilometer but at a cost.\n\nThe fuel consumption per kilometer for TruckA is 0.3 liters, which decreases by 0.01 liters for every $100 invested in fuel-saving technology. The fuel consumption per kilometer for TruckB is 0.25 liters, which decreases by 0.008 liters for every $100 invested in fuel-saving technology. The fuel consumption per kilometer for TruckC is 0.2 liters, which decreases by 0.005 liters for every $100 invested in fuel-saving technology. The total route distance is 1000 kilometers. The company aims to minimize the total fuel consumption.\n\nThe total cargo capacity required is 500 tons. TruckA has a capacity of 10 tons, TruckB has a capacity of 15 tons, and TruckC has a capacity of 20 tons.\n\nPlease help the company to determine the optimal number of each type of vehicle and the amount to invest in fuel-saving technologies to minimize the total fuel consumption while ensuring the cargo capacity is met.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0) # investment in fuel-saving technology for TruckA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0) # investment in fuel-saving technology for TruckB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0) # investment in fuel-saving technology for TruckC\n\n# Define objective function\nFuel_TruckA = 1000 * (0.3 - 0.0001 * TechA) * TruckA\nFuel_TruckB = 1000 * (0.25 - 0.00008 * TechB) * TruckB\nFuel_TruckC = 1000 * (0.2 - 0.00005 * TechC) * TruckC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)\n\n# Add constraints\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in TechA: \", model.getVal(TechA))\n    print(\"Investment in TechB: \", model.getVal(TechB))\n    print(\"Investment in TechC: \", model.getVal(TechC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1359,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit.\n// {\"quantity of MachineA\": \"MachineA_qty\", \"range\": \"MachineA_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineB\": \"MachineB_qty\", \"range\": \"MachineB_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineC\": \"MachineC_qty\", \"range\": \"MachineC_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineD\": \"MachineD_qty\", \"range\": \"MachineD_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n// Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n// Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n// Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of MachineC must be at least twice the production of MachineB.\n// MachineC_qty >= 2 * MachineB_qty\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials per month.\n// (0.01 * (MachineA_qty^2) + 20 * MachineA_qty) * MachineA_qty + (0.015 * (MachineB_qty^2) + 25 * MachineB_qty) * MachineB_qty + (0.02 * (MachineC_qty^2) + 30 * MachineC_qty) * MachineC_qty + (0.025 * (MachineD_qty^2) + 35 * MachineD_qty) * MachineD_qty <= 500,000",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit. The profit per unit and the production cost for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost Function |\n|--------------|-----------------|---------------------------|\n| MachineA     | $500            | 0.01 * (MachineA_qty^2) + 20 * MachineA_qty |\n| MachineB     | $700            | 0.015 * (MachineB_qty^2) + 25 * MachineB_qty |\n| MachineC     | $900            | 0.02 * (MachineC_qty^2) + 30 * MachineC_qty |\n| MachineD     | $1100           | 0.025 * (MachineD_qty^2) + 35 * MachineD_qty |\n\nThe company has a total production capacity of 1000 machines per month. Due to market demand, the production of MachineC must be at least twice the production of MachineB. The company has a budget of $500,000 for raw materials per month.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each machine type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_qty\", lb=0) # quantity of MachineA\nMachineB_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_qty\", lb=0) # quantity of MachineB\nMachineC_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_qty\", lb=0) # quantity of MachineC\nMachineD_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineD_qty\", lb=0) # quantity of MachineD\n\n# Define objective function\n## Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n## Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n## Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n## Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n## So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\nProfit_MachineA = (500 - (0.01 * MachineA_qty**2 + 20 * MachineA_qty)) * MachineA_qty\nProfit_MachineB = (700 - (0.015 * MachineB_qty**2 + 25 * MachineB_qty)) * MachineB_qty\nProfit_MachineC = (900 - (0.02 * MachineC_qty**2 + 30 * MachineC_qty)) * MachineC_qty\nProfit_MachineD = (1100 - (0.025 * MachineD_qty**2 + 35 * MachineD_qty)) * MachineD_qty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000)\n## Due to market demand, the production of MachineC must be at least twice the production of MachineB.\nmodel.addCons(MachineC_qty >= 2 * MachineB_qty)\n## The company has a budget of $500,000 for raw materials per month.\nmodel.addCons((0.01 * MachineA_qty**2 + 20 * MachineA_qty) * MachineA_qty + \n              (0.015 * MachineB_qty**2 + 25 * MachineB_qty) * MachineB_qty + \n              (0.02 * MachineC_qty**2 + 30 * MachineC_qty) * MachineC_qty + \n              (0.025 * MachineD_qty**2 + 35 * MachineD_qty) * MachineD_qty <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of MachineA: \", model.getVal(MachineA_qty))\n    print(\"Quantity of MachineB: \", model.getVal(MachineB_qty))\n    print(\"Quantity of MachineC: \", model.getVal(MachineC_qty))\n    print(\"Quantity of MachineD: \", model.getVal(MachineD_qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of type 1 trucks must not exceed 10.\n// T1 <= 10\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 5.\n// T5 >= 5\n\n## Generate Constraint-5:\nThe ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\n// T2 <= 2 * T3",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation. The fuel consumption and capacity for each type of truck are given in the following Table.\n\n| Type of Truck | Fuel Consumption (liters/km) | Capacity (tons) |\n|---------------|------------------------------|-----------------|\n| Type 1        | 5                            | 10              |\n| Type 2        | 6                            | 15              |\n| Type 3        | 7                            | 20              |\n| Type 4        | 8                            | 25              |\n| Type 5        | 9                            | 30              |\n\nThe company needs to transport a total of 1000 tons of goods over a distance of 500 km. The total capacity of all trucks must meet or exceed the required 1000 tons. The company has a budget to purchase at most 50 trucks in total. The number of type 1 trucks must not exceed 10. The number of type 5 trucks must be at least 5. The ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\n\nPlease help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\nFuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n## So, the objective function is: Minimize Fuel\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of type 1 trucks must not exceed 10.\nmodel.addCons(T1 <= 10)\n## The number of type 5 trucks must be at least 5.\nmodel.addCons(T5 >= 5)\n## The ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\nmodel.addCons(T2 <= 2 * T3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget allocated to each product, and the number of skilled workers assigned to each product line. The marketing budget affects the sales of each product, and the number of skilled workers influences the production efficiency. The company aims to optimize its production and marketing strategies to maximize profit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of skilled workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of skilled workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of skilled workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is affected by the production quantity, the marketing budget, and the number of skilled workers. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1000 spent. The production efficiency increases by 0.5 units per worker. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.001 * MarketingBudgetA) * QuantityA * (1 + 0.005 * WorkersA)\n// Total profit for ProductB: ProfitB = (150 + 0.001 * MarketingBudgetB) * QuantityB * (1 + 0.005 * WorkersB)\n// Total profit for ProductC: ProfitC = (200 + 0.001 * MarketingBudgetC) * QuantityC * (1 + 0.005 * WorkersC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total marketing budget cannot exceed $50,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 skilled workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n// QuantityA >= 500; QuantityB >= 300\n\n## Generate Constraint-4:\nThe company must allocate at least 30 workers to ProductA and 40 workers to ProductB.\n// WorkersA >= 30; WorkersB >= 40\n\n## Generate Constraint-5:\nThe production capacity of the company allows for a maximum of 1000 units of ProductA, 800 units of ProductB, and 600 units of ProductC.\n// QuantityA <= 1000; QuantityB <= 800; QuantityC <= 600",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget allocated to each product, and the number of skilled workers assigned to each product line. The marketing budget affects the sales of each product, and the number of skilled workers influences the production efficiency. The company aims to optimize its production and marketing strategies to maximize profit. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1000 spent, and the production efficiency increases by 0.5 units per worker.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| ProductA | 100$            |\n| ProductB | 150$            |\n| ProductC | 200$            |\n\nThe company has a total marketing budget of $50,000. The company has a total of 100 skilled workers available. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 300 units. The company must allocate at least 30 workers to ProductA and 40 workers to ProductB. The production capacity of the company allows for a maximum of 1000 units of ProductA, 800 units of ProductB, and 600 units of ProductC.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500, ub=1000)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300, ub=800)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=600)  # production quantity of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=30)  # number of skilled workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=40)  # number of skilled workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of skilled workers for ProductC\n\n# Define objective function\nProfitA = (100 + 0.001 * MarketingBudgetA) * QuantityA * (1 + 0.005 * WorkersA)\nProfitB = (150 + 0.001 * MarketingBudgetB) * QuantityB * (1 + 0.005 * WorkersB)\nProfitC = (200 + 0.001 * MarketingBudgetC) * QuantityC * (1 + 0.005 * WorkersC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000)\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(QuantityA >= 500)\nmodel.addCons(QuantityB >= 300)\nmodel.addCons(WorkersA >= 30)\nmodel.addCons(WorkersB >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1395,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region. Additionally, the company needs to decide on the investment amount($) in energy storage systems for each region, which will enhance the efficiency and reliability of the energy generation.\n// {\"number of solar panels in Region1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region1\": \"Storage1\", \"range\": \"Storage1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage in Region2\": \"Storage2\", \"range\": \"Storage2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage in Region3\": \"Storage3\", \"range\": \"Storage3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of both solar panels and wind turbines increases with the investment in energy storage systems. The initial energy output per solar panel is 200 kWh, and it increases by 10 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, and it increases by 25 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from all regions.\n// Total energy output in Region1: Energy1 = (200 + 0.01 * Storage1) * Solar1 + (500 + 0.025 * Storage1) * Wind1\n// Total energy output in Region2: Energy2 = (200 + 0.01 * Storage2) * Solar2 + (500 + 0.025 * Storage2) * Wind2\n// Total energy output in Region3: Energy3 = (200 + 0.01 * Storage3) * Solar3 + (500 + 0.025 * Storage3) * Wind3\n// So, the objective function is: Maximize (Energy1 + Energy2 + Energy3)\n\n## Generate Constraint-1:\nThe total budget for installation and storage investments across all regions is $2,000,000.\n// 1000 * Solar1 + 2000 * Wind1 + Storage1 + 1000 * Solar2 + 2000 * Wind2 + Storage2 + 1000 * Solar3 + 2000 * Wind3 + Storage3 <= 2000000\n\n## Generate Constraint-2:\nThe total area available for installation in each region is limited. Region1 has space for up to 500 installations, Region2 for 600, and Region3 for 700.\n// Solar1 + Wind1 <= 500; Solar2 + Wind2 <= 600; Solar3 + Wind3 <= 700\n\n## Generate Constraint-3:\nDue to local regulations, the company must install at least 100 solar panels in Region1 and 150 wind turbines in Region2.\n// Solar1 >= 100; Wind2 >= 150",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment amount($) in energy storage systems for each region to enhance the efficiency and reliability of the energy generation. The initial energy output per solar panel is 200 kWh, increasing by 10 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, increasing by 25 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from all regions.\n\n| Region | Initial Energy Output per Solar Panel | Initial Energy Output per Wind Turbine |\n|--------|--------------------------------------|----------------------------------------|\n| Region1 | 200 kWh                               | 500 kWh                                |\n| Region2 | 200 kWh                               | 500 kWh                                |\n| Region3 | 200 kWh                               | 500 kWh                                |\n\nThe total budget for installation and storage investments across all regions is $2,000,000. The total area available for installation in each region is limited: Region1 has space for up to 500 installations, Region2 for 600, and Region3 for 700. Due to local regulations, the company must install at least 100 solar panels in Region1 and 150 wind turbines in Region2.\n\nPlease help the company to determine the optimal number of solar panels, wind turbines, and the investment in energy storage systems for each region to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)  # number of solar panels in Region1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)    # number of wind turbines in Region1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)  # number of solar panels in Region2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)    # number of wind turbines in Region2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)  # number of solar panels in Region3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)    # number of wind turbines in Region3\nStorage1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage1\", lb=0)  # investment in energy storage in Region1\nStorage2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage2\", lb=0)  # investment in energy storage in Region2\nStorage3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage3\", lb=0)  # investment in energy storage in Region3\n\n# Define objective function\nEnergy1 = (200 + 0.01 * Storage1) * Solar1 + (500 + 0.025 * Storage1) * Wind1\nEnergy2 = (200 + 0.01 * Storage2) * Solar2 + (500 + 0.025 * Storage2) * Wind2\nEnergy3 = (200 + 0.01 * Storage3) * Solar3 + (500 + 0.025 * Storage3) * Wind3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy1 + Energy2 + Energy3)\n\n# Add constraints\nmodel.addCons(1000 * Solar1 + 2000 * Wind1 + Storage1 + 1000 * Solar2 + 2000 * Wind2 + Storage2 + 1000 * Solar3 + 2000 * Wind3 + Storage3 <= 2000000)\nmodel.addCons(Solar1 + Wind1 <= 500)\nmodel.addCons(Solar2 + Wind2 <= 600)\nmodel.addCons(Solar3 + Wind3 <= 700)\nmodel.addCons(Solar1 >= 100)\nmodel.addCons(Wind2 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(Wind3))\n    print(\"Investment in Energy Storage in Region1: \", model.getVal(Storage1))\n    print(\"Investment in Energy Storage in Region2: \", model.getVal(Storage2))\n    print(\"Investment in Energy Storage in Region3: \", model.getVal(Storage3))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1705,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize the total cargo transported while minimizing fuel costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A can carry 10 tons per trip and consumes 5 liters of fuel per trip.\nTruck B can carry 15 tons per trip and consumes 7 liters of fuel per trip.\nTruck C can carry 20 tons per trip and consumes 9 liters of fuel per trip.\nThe company wants to maximize the total cargo transported while minimizing the total fuel consumption.\n// Cargo_TruckA = 10 * TruckA\n// Cargo_TruckB = 15 * TruckB\n// Cargo_TruckC = 20 * TruckC\n// Fuel_TruckA = 5 * TruckA\n// Fuel_TruckB = 7 * TruckB\n// Fuel_TruckC = 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 trips available.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500\n\n## Generate Constraint-4:\nThe number of Truck A must be at least 10.\n// TruckA >= 10",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. Truck A can carry 10 tons per trip and consumes 5 liters of fuel per trip. Truck B can carry 15 tons per trip and consumes 7 liters of fuel per trip. Truck C can carry 20 tons per trip and consumes 9 liters of fuel per trip. The company wants to maximize the total cargo transported while minimizing the total fuel consumption. The company has a total budget of $10,000 for fuel costs and a total of 100 trips available. The total cargo capacity of all trucks must not exceed 1500 tons. Additionally, the number of Truck A must be at least 10. Please help the company determine the number of each type of truck to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_TruckA = 5 * TruckA\nFuel_TruckB = 7 * TruckB\nFuel_TruckC = 9 * TruckC\n## the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n## convert the subtraction and square to multiplication\nmodel.addCons(obj == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)**2)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000)\n## The company has a total of 100 trips available.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The total cargo capacity of all trucks must not exceed 1500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Cargo Transport Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 773,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output and cost of each installation.\n// {\"number of solar panels in Region1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for solar panels\": \"RDSolar\", \"range\": \"RDSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for wind turbines\": \"RDWind\", \"range\": \"RDWind >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of solar panels and wind turbines increases nonlinearly with the investment in R&D. For every $100,000 invested in R&D for solar panels, the energy output increases by 5% per panel. For every $100,000 invested in R&D for wind turbines, the energy output increases by 8% per turbine. The company aims to maximize the total energy output from all installations.\n// Total energy output for solar panels in Region1: EnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region1: EnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region2: EnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region2: EnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region3: EnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region3: EnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n// So, the objective function is: Maximize (EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for R&D investments.\n// RDSolar + RDWind <= 200000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\n// Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in Region1 must not exceed the number of solar panels by more than 10.\n// Wind1 - Solar1 <= 10\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 solar panels are installed in Region2 and 50 wind turbines in Region3.\n// Solar2 >= 100; Wind3 >= 50",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The investment in R&D affects the energy output and cost of each installation. The company aims to maximize the total energy output from all installations.\n\nThe company has a total budget of $200,000 for R&D investments. The total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units. Due to regional regulations, the number of wind turbines in Region1 must not exceed the number of solar panels by more than 10. The company must ensure that at least 100 solar panels are installed in Region2 and 50 wind turbines in Region3.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to be installed in each region and the optimal investment in R&D to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels in Region1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of wind turbines in Region1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels in Region2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of wind turbines in Region2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels in Region3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of wind turbines in Region3\nRDSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"RDSolar\", lb=0) # investment in R&D for solar panels\nRDWind = model.addVar(vtype=\"CONTINUOUS\", name=\"RDWind\", lb=0) # investment in R&D for wind turbines\n\n# Define objective function\nEnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n# Add constraints\nmodel.addCons(RDSolar + RDWind <= 200000)\nmodel.addCons(Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000)\nmodel.addCons(Wind1 - Solar1 <= 10)\nmodel.addCons(Solar2 >= 100)\nmodel.addCons(Wind3 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(Wind3))\n    print(\"Investment in R&D for Solar Panels: \", model.getVal(RDSolar))\n    print(\"Investment in R&D for Wind Turbines: \", model.getVal(RDWind))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $2000 per month, and the machine cost per machine is $3000 per month. The company wants to maximize the total monthly profit.\n// Profit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\n// Profit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\n// Profit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe company has a total of 30 machines available.\n// MachinesA + MachinesB + MachinesC <= 30\n\n## Generate Constraint-3:\nThe production capacity for ProductA is limited to 1000 units per month, ProductB to 1500 units per month, and ProductC to 1200 units per month.\n// ProdA <= 1000; ProdB <= 1500; ProdC <= 1200\n\n## Generate Constraint-4:\nThe number of workers required for each unit of ProductA is 0.01, for ProductB is 0.02, and for ProductC is 0.015.\n// WorkersA >= 0.01 * ProdA; WorkersB >= 0.02 * ProdB; WorkersC >= 0.015 * ProdC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the number of machines used for each product. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $2000 per month, and the machine cost per machine is $3000 per month. The company wants to maximize the total monthly profit.\n\n| Product | Profit per Unit | Labor Cost per Worker | Machine Cost per Machine |\n|---------|-----------------|-----------------------|--------------------------|\n| ProductA | $50            | $2000                 | $3000                    |\n| ProductB | $70            | $2000                 | $3000                    |\n| ProductC | $60            | $2000                 | $3000                    |\n\nThe company has a total of 50 workers available. The company has a total of 30 machines available. The production capacity for ProductA is limited to 1000 units per month, ProductB to 1500 units per month, and ProductC to 1200 units per month. The number of workers required for each unit of ProductA is 0.01, for ProductB is 0.02, and for ProductC is 0.015.\n\nPlease help the company to maximize the total monthly profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\n\n# Define objective function\nProfit_ProductA = ProdA * 50 - WorkersA * 2000 - MachinesA * 3000\nProfit_ProductB = ProdB * 70 - WorkersB * 2000 - MachinesB * 3000\nProfit_ProductC = ProdC * 60 - WorkersC * 2000 - MachinesC * 3000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50) # total workers constraint\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 30) # total machines constraint\nmodel.addCons(ProdA <= 1000) # production capacity for ProductA\nmodel.addCons(ProdB <= 1500) # production capacity for ProductB\nmodel.addCons(ProdC <= 1200) # production capacity for ProductC\nmodel.addCons(WorkersA >= 0.01 * ProdA) # workers required for ProductA\nmodel.addCons(WorkersB >= 0.02 * ProdB) # workers required for ProductB\nmodel.addCons(WorkersC >= 0.015 * ProdC) # workers required for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Maximized Total Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations.\n// {\"trips of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for Truck A is $1000, and it can carry 10 tons of goods. For Truck B, the cost per trip is $1500, and it can carry 15 tons of goods. For Truck C, the cost per trip is $2000, and it can carry 20 tons of goods. The company wants to minimize the total cost of transportation while ensuring all goods are delivered.\n// Cost_A = 1000 * A\n// Cost_B = 1500 * B\n// Cost_C = 2000 * C\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total weight of goods to be transported is 600 tons.\n// 10 * A + 15 * B + 20 * C >= 600\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for transportation costs.\n// 1000 * A + 1500 * B + 2000 * C <= 100000\n\n## Generate Constraint-3:\nThe number of trips for each vehicle must not exceed 50.\n// A <= 50\n// B <= 50\n// C <= 50",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations. The cost per trip and the carrying capacity for each truck are given in the following Table.\n\n| Vehicle | Cost per Trip | Carrying Capacity |\n|---------|---------------|-------------------|\n| Truck A | $1000         | 10 tons           |\n| Truck B | $1500         | 15 tons           |\n| Truck C | $2000         | 20 tons           |\n\nThe total weight of goods to be transported is 600 tons. The company has a budget of $100,000 for transportation costs. The number of trips for each vehicle must not exceed 50.\nPlease help the company to minimize the total cost of transportation while ensuring all goods are delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # trips of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=50) # trips of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=50) # trips of Truck C\n\n# Define objective function\nCost_A = 1000 * A\nCost_B = 1500 * B\nCost_C = 2000 * C\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total weight of goods to be transported is 600 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 600)\n# The company has a budget of $100,000 for transportation costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500\n\n## Generate Constraint-2:\nDue to storage limitations, the number of container C cannot exceed twice the number of container A.\n// ContainerC <= 2 * ContainerA\n\n## Generate Constraint-3:\nThe company has a contractual obligation to ship at least 50 containers of type D.\n// ContainerD >= 50\n\n## Generate Constraint-4:\nThe total weight of all containers must not exceed 100,000 kg. Container A weighs 100 kg, container B weighs 200 kg, container C weighs 300 kg, container D weighs 400 kg, and container E weighs 500 kg.\n// 100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000\n\n## Generate Constraint-5:\nThe company must ensure that at least one container of each type is shipped.\n// ContainerA >= 1; ContainerB >= 1; ContainerC >= 1; ContainerD >= 1; ContainerE >= 1",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost. The company has a total shipping capacity of 500 containers. Due to storage limitations, the number of container C cannot exceed twice the number of container A. The company has a contractual obligation to ship at least 50 containers of type D. The total weight of all containers must not exceed 100,000 kg. Container A weighs 100 kg, container B weighs 200 kg, container C weighs 300 kg, container D weighs 400 kg, and container E weighs 500 kg. The company must ensure that at least one container of each type is shipped. Please help the company to minimize the total shipping cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=1)  # number of container A\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=1)  # number of container B\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=1)  # number of container C\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=50)  # number of container D\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=1)  # number of container E\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n# Due to storage limitations, the number of container C cannot exceed twice the number of container A.\nmodel.addCons(ContainerC <= 2 * ContainerA)\n# The total weight of all containers must not exceed 100,000 kg.\nmodel.addCons(100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which can be improved with additional maintenance investments.\n// {\"speed of Truck1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency improvement for Truck1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for Truck2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost, which is affected by the speed of the trucks and the number of trucks on each route. The fuel cost per kilometer is inversely proportional to the fuel efficiency of the trucks. The initial fuel efficiency for Truck1 is 5 km/liter and for Truck2 is 6 km/liter. Each additional $1000 invested in maintenance can improve the fuel efficiency by 0.5 km/liter for Truck1 and 0.6 km/liter for Truck2.\n// Fuel cost for Truck1: Cost1 = (1 / (5 + 0.5 * Efficiency1)) * Speed1 * Trucks1\n// Fuel cost for Truck2: Cost2 = (1 / (6 + 0.6 * Efficiency2)) * Speed2 * Trucks2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe total budget for maintenance and operations is $50,000.\n// Efficiency1 + Efficiency2 + Speed1 * Trucks1 + Speed2 * Trucks2 <= 50000\n\n## Generate Constraint-2:\nThe total distance covered by all trucks must not exceed 10,000 km.\n// Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000\n\n## Generate Constraint-3:\nAt least 5 trucks must be assigned to Route1, and at least 3 trucks must be assigned to Route2.\n// Trucks1 >= 5; Trucks2 >= 3\n\n## Generate Constraint-4:\nThe speed of Truck1 must be at least 60 km/h, and the speed of Truck2 must be at least 70 km/h.\n// Speed1 >= 60; Speed2 >= 70",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which can be improved with additional maintenance investments. The initial fuel efficiency for Truck1 is 5 km/liter and for Truck2 is 6 km/liter. Each additional $1000 invested in maintenance can improve the fuel efficiency by 0.5 km/liter for Truck1 and 0.6 km/liter for Truck2.\nThe company aims to minimize the total fuel cost, which is affected by the speed of the trucks and the number of trucks on each route. The fuel cost per kilometer is inversely proportional to the fuel efficiency of the trucks.\nThe total budget for maintenance and operations is $50,000. The total distance covered by all trucks must not exceed 10,000 km. At least 5 trucks must be assigned to Route1, and at least 3 trucks must be assigned to Route2. The speed of Truck1 must be at least 60 km/h, and the speed of Truck2 must be at least 70 km/h.\nPlease help the company to determine the optimal speed, number of trucks, and maintenance investments to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=60, ub=100)  # speed of Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=70, ub=100)  # speed of Truck2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=3)  # number of trucks on Route2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # fuel efficiency improvement for Truck1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # fuel efficiency improvement for Truck2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for Truck1: Cost1 = (1 / (5 + 0.5 * Efficiency1)) * Speed1 * Trucks1\n## Fuel cost for Truck2: Cost2 = (1 / (6 + 0.6 * Efficiency2)) * Speed2 * Trucks2\n## convert the division to multiplication\nCost1 = (5 + 0.5 * Efficiency1) * Speed1 * Trucks1\nCost2 = (6 + 0.6 * Efficiency2) * Speed2 * Trucks2\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n## The total budget for maintenance and operations is $50,000.\nmodel.addCons(Efficiency1 + Efficiency2 + Speed1 * Trucks1 + Speed2 * Trucks2 <= 50000)\n## The total distance covered by all trucks must not exceed 10,000 km.\nmodel.addCons(Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency Improvement for Truck1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency Improvement for Truck2: \", model.getVal(Efficiency2))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering packages. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. The operational cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1100. The delivery volume per truck on route 1 is 50 packages, on route 2 is 60 packages, on route 3 is 70 packages, on route 4 is 80 packages, and on route 5 is 90 packages. The company wants to minimize the cost per delivered package.\n// Cost_per_package_1 = 1000 * T1 / (50 * T1)\n// Cost_per_package_2 = 1200 * T2 / (60 * T2)\n// Cost_per_package_3 = 1500 * T3 / (70 * T3)\n// Cost_per_package_4 = 1300 * T4 / (80 * T4)\n// Cost_per_package_5 = 1100 * T5 / (90 * T5)\n// So, the objective function is: Minimize (Cost_per_package_1 + Cost_per_package_2 + Cost_per_package_3 + Cost_per_package_4 + Cost_per_package_5)\n\n## Generate Constraint-1:\nThe company has a total fleet of 100 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe total delivery volume must meet at least 5000 packages.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 5000",
        "question": "A logistics company operates 5 different routes for delivering packages. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has different operational costs and delivery volumes. The operational cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1100. The delivery volume per truck on route 1 is 50 packages, on route 2 is 60 packages, on route 3 is 70 packages, on route 4 is 80 packages, and on route 5 is 90 packages. The company wants to minimize the cost per delivered package. The company has a total fleet of 100 trucks. The total delivery volume must meet at least 5000 packages. Please help the company to minimize the cost per delivered package.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_per_package_1 = 1000 * T1\nCost_per_package_2 = 1200 * T2\nCost_per_package_3 = 1500 * T3\nCost_per_package_4 = 1300 * T4\nCost_per_package_5 = 1100 * T5\nDelivery_volume_1 = 50 * T1\nDelivery_volume_2 = 60 * T2\nDelivery_volume_3 = 70 * T3\nDelivery_volume_4 = 80 * T4\nDelivery_volume_5 = 90 * T5\n## the objective function is: Minimize (Cost_per_package_1 + Cost_per_package_2 + Cost_per_package_3 + Cost_per_package_4 + Cost_per_package_5) / (Delivery_volume_1 + Delivery_volume_2 + Delivery_volume_3 + Delivery_volume_4 + Delivery_volume_5)\n## convert the division to multiplication\nmodel.addCons(obj * (Delivery_volume_1 + Delivery_volume_2 + Delivery_volume_3 + Delivery_volume_4 + Delivery_volume_5) == Cost_per_package_1 + Cost_per_package_2 + Cost_per_package_3 + Cost_per_package_4 + Cost_per_package_5)\n\n# Add constraints\n## The company has a total fleet of 100 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total delivery volume must meet at least 5000 packages.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivered Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n// Fuel cost = (total distance / fuel efficiency) * fuel price\n// Maintenance cost = number of trucks * maintenance cost per truck\n// Objective function: Minimize (Fuel cost + Maintenance cost)\n\n## Generate Constraint-1:\nThe total budget for purchasing new trucks is $500,000.\n// 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 trucks in total.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10\n\n## Generate Constraint-3:\nThe total capacity of all trucks must exceed 100,000 kg.\n// (Truck1 * 1000) + (Truck2 * 2000) + (Truck3 * 3000) + (Truck4 * 4000) + (Truck5 * 5000) >= 100000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes. Each type of truck has different fuel efficiency and maintenance costs, as shown in the following Table.\n\n| Vehicle  | Fuel Efficiency (km/l) | Maintenance Cost per Year |\n|----------|-----------------------|--------------------------|\n| Truck1   | 5                     | $10,000                   |\n| Truck2   | 10                    | $15,000                   |\n| Truck3   | 15                    | $20,000                   |\n| Truck4   | 20                    | $25,000                   |\n| Truck5   | 25                    | $30,000                   |\n\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered. The total budget for purchasing new trucks is $500,000. The company must have at least 10 trucks in total. The total capacity of all trucks must exceed 100,000 kg.\n\nPlease help the company determine the optimal number of each type of truck to purchase to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel and maintenance costs\nfuel_efficiency = [5, 10, 15, 20, 25]\nmaintenance_cost = [10000, 15000, 20000, 25000, 30000]\nfuel_cost = sum((1 / eff) * truck for eff, truck in zip(fuel_efficiency, [Truck1, Truck2, Truck3, Truck4, Truck5]))\nmaintenance_cost = sum(cost * truck for cost, truck in zip(maintenance_cost, [Truck1, Truck2, Truck3, Truck4, Truck5]))\n\n## Objective function: Minimize (Fuel cost + Maintenance cost)\nmodel.addCons(obj == fuel_cost + maintenance_cost)\n\n# Add constraints\n## The total budget for purchasing new trucks is $500,000.\nmodel.addCons(10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000)\n## The company must have at least 10 trucks in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10)\n## The total capacity of all trucks must exceed 100,000 kg.\nmodel.addCons((Truck1 * 1000) + (Truck2 * 2000) + (Truck3 * 3000) + (Truck4 * 4000) + (Truck5 * 5000) >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Truck4: \", model.getVal(Truck4))\n    print(\"Number of Truck5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for ProductA\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductB\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductC\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $1000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20. The selling price per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\n// Total profit for ProductB: ProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\n// Total profit for ProductC: ProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 2000 units.\n// ProductA + ProductB + ProductC <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 500 units, and for ProductB is at least 300 units.\n// ProductA >= 500; ProductB >= 300\n\n## Generate Constraint-4:\nDue to operational constraints, the production of ProductC cannot exceed 800 units.\n// ProductC <= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. The energy cost per unit for each product decreases by $2 for every $1000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20. The selling price per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company has a total budget of $50,000 for energy efficiency upgrades. The total production capacity for all products is limited to 2000 units. The market demand for ProductA is at least 500 units, and for ProductB is at least 300 units. Due to operational constraints, the production of ProductC cannot exceed 800 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=500) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=300) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=800) # quantity of ProductC\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for ProductA\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for ProductB\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for ProductC\n\n# Define objective function\nProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\nProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\nProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000) # total budget for energy efficiency upgrades\nmodel.addCons(ProductA + ProductB + ProductC <= 2000) # total production capacity\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Energy Efficiency for ProductA: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for ProductB: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for ProductC: \", model.getVal(EnergyEfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for truck i\": \"Fuel_Rate_i\", \"range\": \"Fuel_Rate_i >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Total fuel consumption for truck i: Fuel_Consumption_i = Fuel_Rate_i * Distance_j * Trucks_j\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// \u03a3(Trucks_j) for all j <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for each route is 100 km/h.\n// Speed_i <= 100 for all i\n\n## Generate Constraint-3:\nEach route has a minimum required number of trucks to ensure service quality. Route A requires at least 5 trucks, Route B requires at least 10 trucks, and Route C requires at least 7 trucks.\n// Trucks_A >= 5; Trucks_B >= 10; Trucks_C >= 7\n\n## Generate Constraint-4:\nThe total distance covered by all trucks on each route must not exceed the maximum allowable distance. Route A has a limit of 5000 km, Route B has a limit of 7000 km, and Route C has a limit of 6000 km.\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route A <= 5000\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route B <= 7000\n// \u03a3(Speed_i * Trucks_j * Time_j) for all i on Route C <= 6000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed. The fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3. The company aims to minimize the total fuel consumption across all trucks and routes.\n\nThe company has the following constraints:\n1. The total number of trucks available is 50.\n2. The maximum speed limit for each route is 100 km/h.\n3. Each route has a minimum required number of trucks to ensure service quality. Route A requires at least 5 trucks, Route B requires at least 10 trucks, and Route C requires at least 7 trucks.\n4. The total distance covered by all trucks on each route must not exceed the maximum allowable distance. Route A has a limit of 5000 km, Route B has a limit of 7000 km, and Route C has a limit of 6000 km.\n\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption while meeting all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_A\", lb=0, ub=100)\nSpeed_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_B\", lb=0, ub=100)\nSpeed_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_C\", lb=0, ub=100)\n\n## Number of trucks on each route\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)\n\n## Fuel consumption rate for each truck\nFuel_Rate_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_A\", lb=0)\nFuel_Rate_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_B\", lb=0)\nFuel_Rate_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel_Rate_C\", lb=0)\n\n# Define objective function\n## Fuel consumption rate for each truck\nmodel.addCons(Fuel_Rate_A == 0.05 * Speed_A**2 + 0.001 * Speed_A**3)\nmodel.addCons(Fuel_Rate_B == 0.05 * Speed_B**2 + 0.001 * Speed_B**3)\nmodel.addCons(Fuel_Rate_C == 0.05 * Speed_C**2 + 0.001 * Speed_C**3)\n\n## Total fuel consumption for each route\nFuel_Consumption_A = Fuel_Rate_A * 5000 * Trucks_A\nFuel_Consumption_B = Fuel_Rate_B * 7000 * Trucks_B\nFuel_Consumption_C = Fuel_Rate_C * 6000 * Trucks_C\n\n## Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n## Total number of trucks available\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n## Minimum required number of trucks per route\nmodel.addCons(Trucks_A >= 5)\nmodel.addCons(Trucks_B >= 10)\nmodel.addCons(Trucks_C >= 7)\n\n## Maximum distance per route\nmodel.addCons(Speed_A * Trucks_A * 1 <= 5000)\nmodel.addCons(Speed_B * Trucks_B * 1 <= 7000)\nmodel.addCons(Speed_C * Trucks_C * 1 <= 6000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck A: \", model.getVal(Speed_A))\n    print(\"Speed of Truck B: \", model.getVal(Speed_B))\n    print(\"Speed of Truck C: \", model.getVal(Speed_C))\n    print(\"Number of Trucks on Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks on Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks on Route C: \", model.getVal(Trucks_C))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company aims to maximize the total profit from the production of these three products.\n// Profit_A = A * (50 - 20)\n// Profit_B = B * (70 - 30)\n// Profit_C = C * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 20 * A + 30 * B + 25 * C <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 500 units per day.\n// A + B + C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available. The profit per unit and the cost of production per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $20                         |\n| B       | $70             | $30                         |\n| C       | $60             | $25                         |\n\nThe company has a total budget of $10,000 for production costs. The total production capacity of the company is limited to 500 units per day. Please help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = A * (50 - 20)\nProfit_B = B * (70 - 30)\nProfit_C = C * (60 - 25)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $10,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 10000)\n# The total production capacity of the company is limited to 500 units per day.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of maintenance investment for each type of machine to optimize production efficiency. The production efficiency of a machine increases with the amount of maintenance investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for ProductA machines\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for ProductB machines\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for ProductC machines\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency of a machine increases by 5% for every $10,000 invested in maintenance. The initial production efficiency for ProductA machines is 80%, for ProductB is 75%, and for ProductC is 70%. The profit per unit produced is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (0.8 + 0.0005 * MaintenanceA) * QuantityA * 100\n// Total profit for ProductB: ProfitB = (0.75 + 0.0005 * MaintenanceB) * QuantityB * 150\n// Total profit for ProductC: ProfitC = (0.7 + 0.0005 * MaintenanceC) * QuantityC * 200\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 30 machines available.\n// MachinesA + MachinesB + MachinesC <= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of maintenance investment for each type of machine to optimize production efficiency. The production efficiency of a machine increases with the amount of maintenance investment. The production efficiency of a machine increases by 5% for every $10,000 invested in maintenance. The initial production efficiency for ProductA machines is 80%, for ProductB is 75%, and for ProductC is 70%. The profit per unit produced is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 30 machines available.\n\nPlease help the company to determine the optimal production quantity, number of machines, and maintenance investment for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # maintenance investment for ProductA machines\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # maintenance investment for ProductB machines\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # maintenance investment for ProductC machines\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (0.8 + 0.0005 * MaintenanceA) * QuantityA * 100\n## Total profit for ProductB: ProfitB = (0.75 + 0.0005 * MaintenanceB) * QuantityB * 150\n## Total profit for ProductC: ProfitC = (0.7 + 0.0005 * MaintenanceC) * QuantityC * 200\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (0.8 + 0.0005 * MaintenanceA) * QuantityA * 100\nProfitB = (0.75 + 0.0005 * MaintenanceB) * QuantityB * 150\nProfitC = (0.7 + 0.0005 * MaintenanceC) * QuantityC * 200\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 30 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Maintenance Investment for ProductA Machines: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for ProductB Machines: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for ProductC Machines: \", model.getVal(MaintenanceC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n// Total fuel cost per km: FuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) / (T1 + T2 + T3 + T4 + T5)\n// Total maintenance cost per km: MaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5) / (T1 + T2 + T3 + T4 + T5)\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 to purchase trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nAt least 10% of the fleet must be type 5 trucks for long-distance routes.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nNo more than 30% of the fleet can be type 1 trucks due to their high maintenance costs.\n// T1 <= 0.3 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each type of truck has a different fuel efficiency and maintenance cost, as shown in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost ($/km) |\n|------------|-----------------------|-------------------------|\n| Type 1     | 10                    | 100                     |\n| Type 2     | 15                    | 80                      |\n| Type 3     | 20                    | 70                      |\n| Type 4     | 25                    | 60                      |\n| Type 5     | 30                    | 50                      |\n\nThe company has a budget of $500,000 to purchase trucks. The total number of trucks cannot exceed 50. At least 10% of the fleet must be type 5 trucks for long-distance routes, and no more than 30% of the fleet can be type 1 trucks due to their high maintenance costs. \n\nPlease help the company to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5)\nMaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5)\nTotalTrucks = T1 + T2 + T3 + T4 + T5\n## the objective function is: Minimize (FuelCost + MaintCost) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $500,000 to purchase trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## At least 10% of the fleet must be type 5 trucks for long-distance routes.\nmodel.addCons(T5 >= 0.1 * TotalTrucks)\n## No more than 30% of the fleet can be type 1 trucks due to their high maintenance costs.\nmodel.addCons(T1 <= 0.3 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of machines A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of machines B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of machines C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of machines D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for machine A is $500, for machine B is $700, for machine C is $900, and for machine D is $1100. The company aims to maximize the total profit from the production of these machines.\n// Total profit for machine A: Profit_A = 500 * A\n// Total profit for machine B: Profit_B = 700 * B\n// Total profit for machine C: Profit_C = 900 * C\n// Total profit for machine D: Profit_D = 1100 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 hours per month. The production time for machine A is 5 hours, for machine B is 7 hours, for machine C is 9 hours, and for machine D is 11 hours.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 500\n\n## Generate Constraint-2:\nThe market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month.\n// A >= 20; D <= 30\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for machine A is $300, for machine B is $400, for machine C is $500, and for machine D is $600.\n// 300 * A + 400 * B + 500 * C + 600 * D <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of machine C does not exceed the combined production of machines A and B.\n// C <= A + B",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the production time for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Time |\n|---------|-----------------|-----------------|\n| A       | $500            | 5 hours         |\n| B       | $700            | 7 hours         |\n| C       | $900            | 9 hours         |\n| D       | $1100           | 11 hours        |\n\nThe company has a total production capacity of 500 hours per month. The market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month. The company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for machine A is $300, for machine B is $400, for machine C is $500, and for machine D is $600. The company wants to ensure that the production of machine C does not exceed the combined production of machines A and B.\n\nPlease help the company to maximize the total profit from the production of these machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of machines A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of machines B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of machines C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of machines D\n\n# Define objective function\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nProfit_D = 1100 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 500 hours per month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 500)\n# The market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month.\nmodel.addCons(A >= 20)\nmodel.addCons(D <= 30)\n# The company has a limited budget for raw materials, which is $30,000 per month.\nmodel.addCons(300 * A + 400 * B + 500 * C + 600 * D <= 30000)\n# The company wants to ensure that the production of machine C does not exceed the combined production of machines A and B.\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $10,000 invested in new technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechnologyInvestment) * ProductA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechnologyInvestment) * ProductB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechnologyInvestment) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 10,000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe investment in new technology cannot exceed $50,000.\n// TechnologyInvestment <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n// ProductA >= 500; ProductB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $250                   |\n| ProductC | $200                             | $300                   |\n\nThe cost of production per unit decreases by $5 for every $10,000 invested in new technology. The total resources available for production are limited to 10,000 units. The investment in new technology cannot exceed $50,000. The production of ProductA must be at least 500 units, and ProductB must be at least 300 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=500) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=300) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0) # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0) # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0) # resources allocated to ProductC\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = (200 - 100 + 0.0005 * TechnologyInvestment) * ProductA\nProfitB = (250 - 150 + 0.0005 * TechnologyInvestment) * ProductB\nProfitC = (300 - 200 + 0.0005 * TechnologyInvestment) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Technology Investment: \", model.getVal(TechnologyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1256,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wearables\": \"Wearables\", \"range\": \"Wearables >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company wants to maximize the total profit from selling these devices.\n// Profit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\n// Profit_Tablets = (150 - 0.05 * Tablets) * Tablets\n// Profit_Laptops = (200 - 0.08 * Laptops) * Laptops\n// Profit_Wearables = (50 - 0.03 * Wearables) * Wearables\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n// 5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\n// Smartphones <= 500; Tablets <= 300; Laptops <= 200; Wearables <= 400\n\n## Generate Constraint-3:\nThe company has a production capacity of 800 units in terms of the total number of devices it can produce.\n// Smartphones + Tablets + Laptops + Wearables <= 800\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced product portfolio. The ratio of Smartphones to the total number of devices should not exceed 0.5.\n// Smartphones / (Smartphones + Tablets + Laptops + Wearables) <= 0.5",
        "question": "A manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints. The profit per unit of each device decreases as more units are produced, as shown in the following Table.\n\n| Device       | Profit per Unit | Decrease in Profit per Additional Unit |\n|--------------|-----------------|---------------------------------------|\n| Smartphones  | $100            | $0.1 per Smartphone                    |\n| Tablets      | $150            | $0.05 per Tablet                      |\n| Laptops      | $200            | $0.08 per Laptop                      |\n| Wearables    | $50             | $0.03 per Wearable                    |\n\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000. The market has a demand limit for each device: 500 units for Smartphones, 300 units for Tablets, 200 units for Laptops, and 400 units for Wearables. The company has a production capacity of 800 units in terms of the total number of devices it can produce. The company aims to maintain a balanced product portfolio, where the ratio of Smartphones to the total number of devices should not exceed 0.5.\n\nPlease help the company to maximize the total profit from selling these devices, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nWearables = model.addVar(vtype=\"INTEGER\", name=\"Wearables\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.05 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.08 * Laptops) * Laptops\nProfit_Wearables = (50 - 0.03 * Wearables) * Wearables\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices.\nmodel.addCons(5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000)\n## The market has a demand limit for each device.\nmodel.addCons(Smartphones <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Wearables <= 400)\n## The company has a production capacity of 800 units in terms of the total number of devices it can produce.\nmodel.addCons(Smartphones + Tablets + Laptops + Wearables <= 800)\n## The company aims to maintain a balanced product portfolio.\nmodel.addCons(Smartphones <= 0.5 * (Smartphones + Tablets + Laptops + Wearables))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Wearables: \", model.getVal(Wearables))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1584,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each unit to optimize energy output and minimize operational costs.\n// {\"number of Solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment per Solar unit\": \"SolarMaintenance\", \"range\": \"SolarMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment per Wind unit\": \"WindMaintenance\", \"range\": \"WindMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment per Hydro unit\": \"HydroMaintenance\", \"range\": \"HydroMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each type of power plant is affected by the maintenance investment. For Solar, each $1000 invested increases the output by 1 MWh. For Wind, each $1000 invested increases the output by 1.5 MWh. For Hydro, each $1000 invested increases the output by 1.2 MWh. The operational cost per MWh is $50 for Solar, $60 for Wind, and $70 for Hydro. The company aims to maximize the net energy output (total energy output minus operational costs).\n// Total energy output for Solar: EnergySolar = SolarUnits * (10 + 0.001 * SolarMaintenance)\n// Total energy output for Wind: EnergyWind = WindUnits * (15 + 0.0015 * WindMaintenance)\n// Total energy output for Hydro: EnergyHydro = HydroUnits * (12 + 0.0012 * HydroMaintenance)\n// Operational cost for Solar: CostSolar = 50 * EnergySolar\n// Operational cost for Wind: CostWind = 60 * EnergyWind\n// Operational cost for Hydro: CostHydro = 70 * EnergyHydro\n// So, the objective function is: Maximize (EnergySolar - CostSolar + EnergyWind - CostWind + EnergyHydro - CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance investments and unit installations.\n// SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000\n\n## Generate Constraint-2:\nThe total number of power plant units that can be installed is limited to 500.\n// SolarUnits + WindUnits + HydroUnits <= 500\n\n## Generate Constraint-3:\nDue to environmental regulations, the number of Hydro units must not exceed 100.\n// HydroUnits <= 100",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each unit to optimize energy output and minimize operational costs.\nThe energy output of each type of power plant is affected by the maintenance investment. For Solar, each $1000 invested increases the output by 1 MWh. For Wind, each $1000 invested increases the output by 1.5 MWh. For Hydro, each $1000 invested increases the output by 1.2 MWh. The operational cost per MWh is $50 for Solar, $60 for Wind, and $70 for Hydro. The company aims to maximize the net energy output (total energy output minus operational costs).\nThe company has a total budget of $100,000 for maintenance investments and unit installations. The total number of power plant units that can be installed is limited to 500. Due to environmental regulations, the number of Hydro units must not exceed 100.\nPlease help the company to maximize the net energy output (total energy output minus operational costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nSolarMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarMaintenance\", lb=0)\nWindMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"WindMaintenance\", lb=0)\nHydroMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroMaintenance\", lb=0)\n\n# Define objective function\nEnergySolar = SolarUnits * (10 + 0.001 * SolarMaintenance)\nEnergyWind = WindUnits * (15 + 0.0015 * WindMaintenance)\nEnergyHydro = HydroUnits * (12 + 0.0012 * HydroMaintenance)\nCostSolar = 50 * EnergySolar\nCostWind = 60 * EnergyWind\nCostHydro = 70 * EnergyHydro\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar - CostSolar + EnergyWind - CostWind + EnergyHydro - CostHydro)\n\n# Add constraints\nmodel.addCons(SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000)\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 500)\nmodel.addCons(HydroUnits <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Maintenance Investment for Solar: \", model.getVal(SolarMaintenance))\n    print(\"Maintenance Investment for Wind: \", model.getVal(WindMaintenance))\n    print(\"Maintenance Investment for Hydro: \", model.getVal(HydroMaintenance))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times across multiple routes. The company needs to determine the optimal speed for each truck on each route to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck on each route and the number of trucks assigned to each route.\n// {\"speed of truck 1 on route 1\": \"Speed11\", \"range\": \"0 <= Speed11 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 2 on route 1\": \"Speed21\", \"range\": \"0 <= Speed21 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 1 on route 2\": \"Speed12\", \"range\": \"0 <= Speed12 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 2 on route 2\": \"Speed22\", \"range\": \"0 <= Speed22 <= 60\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed. The faster the truck, the more fuel it consumes, but the relationship is not linear. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Fuel consumption for truck 1 on route 1: Fuel11 = 0.05 * Speed11^2\n// Fuel consumption for truck 2 on route 1: Fuel21 = 0.05 * Speed21^2\n// Fuel consumption for truck 1 on route 2: Fuel12 = 0.05 * Speed12^2\n// Fuel consumption for truck 2 on route 2: Fuel22 = 0.05 * Speed22^2\n// Total fuel consumption: TotalFuel = Fuel11 + Fuel21 + Fuel12 + Fuel22\n// So, the objective function is: Minimize TotalFuel\n\n## Generate Constraint-1:\nThe total time taken for all trucks to complete their routes must not exceed a specified maximum time. The time taken for a truck to complete a route is inversely proportional to its speed.\n// Time for truck 1 on route 1: Time11 = 100 / Speed11\n// Time for truck 2 on route 1: Time21 = 100 / Speed21\n// Time for truck 1 on route 2: Time12 = 150 / Speed12\n// Time for truck 2 on route 2: Time22 = 150 / Speed22\n// Total time: TotalTime = Time11 * Trucks1 + Time21 * Trucks1 + Time12 * Trucks2 + Time22 * Trucks2\n// TotalTime <= 1200 (maximum allowed time)",
        "question": "A logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times across multiple routes. The company needs to determine the optimal speed for each truck on each route to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck on each route and the number of trucks assigned to each route. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where the faster the truck, the more fuel it consumes, but the relationship is not linear. The company aims to minimize the total fuel consumption across all trucks and routes. The total time taken for all trucks to complete their routes must not exceed a specified maximum time of 1200 hours, where the time taken for a truck to complete a route is inversely proportional to its speed. Please help the company to determine the optimal speeds and number of trucks for each route to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed11 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed11\", lb=0, ub=60) # speed of truck 1 on route 1\nSpeed21 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed21\", lb=0, ub=60) # speed of truck 2 on route 1\nSpeed12 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed12\", lb=0, ub=60) # speed of truck 1 on route 2\nSpeed22 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed22\", lb=0, ub=60) # speed of truck 2 on route 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on route 2\n\n# Define objective function\nFuel11 = 0.05 * Speed11**2\nFuel21 = 0.05 * Speed21**2\nFuel12 = 0.05 * Speed12**2\nFuel22 = 0.05 * Speed22**2\nTotalFuel = Fuel11 + Fuel21 + Fuel12 + Fuel22\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuel)\n\n# Add constraints\nTime11 = 100 / Speed11\nTime21 = 100 / Speed21\nTime12 = 150 / Speed12\nTime22 = 150 / Speed22\nTotalTime = Time11 * Trucks1 + Time21 * Trucks1 + Time12 * Trucks2 + Time22 * Trucks2\nmodel.addCons(TotalTime <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of truck 1 on route 1: \", model.getVal(Speed11))\n    print(\"Speed of truck 2 on route 1: \", model.getVal(Speed21))\n    print(\"Speed of truck 1 on route 2: \", model.getVal(Speed12))\n    print(\"Speed of truck 2 on route 2: \", model.getVal(Speed22))\n    print(\"Number of trucks on route 1: \", model.getVal(Trucks1))\n    print(\"Number of trucks on route 2: \", model.getVal(Trucks2))\n    print(\"Minimized Total Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), Affordable Homes (AH), Condominiums (CO), and Townhouses (TH). The developer needs to determine the number of units of each type to maximize profit while considering various constraints.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"number of Condominiums\": \"CO\", \"range\": \"CO >= 0\", \"type\": \"integer\"}\n// {\"number of Townhouses\": \"TH\", \"range\": \"TH >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Luxury Villas is $200,000, for Mid-Range Apartments is $100,000, for Affordable Homes is $50,000, for Condominiums is $150,000, and for Townhouses is $80,000. Due to economies of scale, the profit per unit increases by 0.1% for each type of property if more than 50 units are built. The developer aims to maximize the total profit from all properties.\n// Profit_LV = max(200000 + 0.001 * (LV - 50), 200000) * LV\n// Profit_MA = max(100000 + 0.001 * (MA - 50), 100000) * MA\n// Profit_AH = max(50000 + 0.001 * (AH - 50), 50000) * AH\n// Profit_CO = max(150000 + 0.001 * (CO - 50), 150000) * CO\n// Profit_TH = max(80000 + 0.001 * (TH - 50), 80000) * TH\n// So, the objective function is: Maximize Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH\n\n## Generate Constraint-1:\nThe total construction budget is $100 million. The cost per unit for Luxury Villas is $150,000, for Mid-Range Apartments is $70,000, for Affordable Homes is $30,000, for Condominiums is $100,000, and for Townhouses is $50,000.\n// 150000 * LV + 70000 * MA + 30000 * AH + 100000 * CO + 50000 * TH <= 100000000\n\n## Generate Constraint-2:\nThe total land available for construction is 100,000 square meters. The land required per unit for Luxury Villas is 1000 sqm, for Mid-Range Apartments is 500 sqm, for Affordable Homes is 300 sqm, for Condominiums is 800 sqm, and for Townhouses is 400 sqm.\n// 1000 * LV + 500 * MA + 300 * AH + 800 * CO + 400 * TH <= 100000\n\n## Generate Constraint-3:\nThe market demand for each type of property is limited. The demand for Luxury Villas is 20 units, for Mid-Range Apartments is 100 units, for Affordable Homes is 200 units, for Condominiums is 80 units, and for Townhouses is 50 units.\n// LV <= 20; MA <= 100; AH <= 200; CO <= 80; TH <= 50\n\n## Generate Constraint-4:\nThe developer aims to maintain a balanced portfolio. The ratio of Luxury Villas to the total number of units should not exceed 5%.\n// LV / (LV + MA + AH + CO + TH) <= 0.05",
        "question": "A real estate developer is planning to build five types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), Affordable Homes (AH), Condominiums (CO), and Townhouses (TH). The developer needs to determine the number of units of each type to maximize profit while considering various constraints. The profit per unit for Luxury Villas is $200,000, for Mid-Range Apartments is $100,000, for Affordable Homes is $50,000, for Condominiums is $150,000, and for Townhouses is $80,000. Due to economies of scale, the profit per unit increases by 0.1% for each type of property if more than 50 units are built. The total construction budget is $100 million. The cost per unit for Luxury Villas is $150,000, for Mid-Range Apartments is $70,000, for Affordable Homes is $30,000, for Condominiums is $100,000, and for Townhouses is $50,000. The total land available for construction is 100,000 square meters. The land required per unit for Luxury Villas is 1000 sqm, for Mid-Range Apartments is 500 sqm, for Affordable Homes is 300 sqm, for Condominiums is 800 sqm, and for Townhouses is 400 sqm. The market demand for each type of property is limited. The demand for Luxury Villas is 20 units, for Mid-Range Apartments is 100 units, for Affordable Homes is 200 units, for Condominiums is 80 units, and for Townhouses is 50 units. The developer aims to maintain a balanced portfolio. The ratio of Luxury Villas to the total number of units should not exceed 5%. Please help the developer to maximize the total profit from all properties.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=0, ub=20)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0, ub=100)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0, ub=200)  # number of Affordable Homes\nCO = model.addVar(vtype=\"INTEGER\", name=\"CO\", lb=0, ub=80)  # number of Condominiums\nTH = model.addVar(vtype=\"INTEGER\", name=\"TH\", lb=0, ub=50)  # number of Townhouses\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_LV = max(200000 + 0.001 * (LV - 50), 200000) * LV\nLV1 = model.addVar(vtype=\"INTEGER\", name=\"LV1\", lb=0, ub=50)\nLV2 = model.addVar(vtype=\"INTEGER\", name=\"LV2\", lb=50, ub=20)\nLV_b1 = model.addVar(vtype=\"B\", name=\"LV_b1\")\nLV_b2 = model.addVar(vtype=\"B\", name=\"LV_b2\")\nmodel.addCons(LV_b1 + LV_b2 == 1)\nmodel.addCons(LV == LV1*LV_b1 + LV2*LV_b2)\nProfit_LV = 200000 * LV1 * LV_b1 + (200000 + 0.001 * (LV2 - 50)) * LV2 * LV_b2\n\n## create piecewise variables for piecewise function: Profit_MA = max(100000 + 0.001 * (MA - 50), 100000) * MA\nMA1 = model.addVar(vtype=\"INTEGER\", name=\"MA1\", lb=0, ub=50)\nMA2 = model.addVar(vtype=\"INTEGER\", name=\"MA2\", lb=50, ub=100)\nMA_b1 = model.addVar(vtype=\"B\", name=\"MA_b1\")\nMA_b2 = model.addVar(vtype=\"B\", name=\"MA_b2\")\nmodel.addCons(MA_b1 + MA_b2 == 1)\nmodel.addCons(MA == MA1*MA_b1 + MA2*MA_b2)\nProfit_MA = 100000 * MA1 * MA_b1 + (100000 + 0.001 * (MA2 - 50)) * MA2 * MA_b2\n\n## create piecewise variables for piecewise function: Profit_AH = max(50000 + 0.001 * (AH - 50), 50000) * AH\nAH1 = model.addVar(vtype=\"INTEGER\", name=\"AH1\", lb=0, ub=50)\nAH2 = model.addVar(vtype=\"INTEGER\", name=\"AH2\", lb=50, ub=200)\nAH_b1 = model.addVar(vtype=\"B\", name=\"AH_b1\")\nAH_b2 = model.addVar(vtype=\"B\", name=\"AH_b2\")\nmodel.addCons(AH_b1 + AH_b2 == 1)\nmodel.addCons(AH == AH1*AH_b1 + AH2*AH_b2)\nProfit_AH = 50000 * AH1 * AH_b1 + (50000 + 0.001 * (AH2 - 50)) * AH2 * AH_b2\n\n## create piecewise variables for piecewise function: Profit_CO = max(150000 + 0.001 * (CO - 50), 150000) * CO\nCO1 = model.addVar(vtype=\"INTEGER\", name=\"CO1\", lb=0, ub=50)\nCO2 = model.addVar(vtype=\"INTEGER\", name=\"CO2\", lb=50, ub=80)\nCO_b1 = model.addVar(vtype=\"B\", name=\"CO_b1\")\nCO_b2 = model.addVar(vtype=\"B\", name=\"CO_b2\")\nmodel.addCons(CO_b1 + CO_b2 == 1)\nmodel.addCons(CO == CO1*CO_b1 + CO2*CO_b2)\nProfit_CO = 150000 * CO1 * CO_b1 + (150000 + 0.001 * (CO2 - 50)) * CO2 * CO_b2\n\n## create piecewise variables for piecewise function: Profit_TH = max(80000 + 0.001 * (TH - 50), 80000) * TH\nTH1 = model.addVar(vtype=\"INTEGER\", name=\"TH1\", lb=0, ub=50)\nTH2 = model.addVar(vtype=\"INTEGER\", name=\"TH2\", lb=50, ub=50)\nTH_b1 = model.addVar(vtype=\"B\", name=\"TH_b1\")\nTH_b2 = model.addVar(vtype=\"B\", name=\"TH_b2\")\nmodel.addCons(TH_b1 + TH_b2 == 1)\nmodel.addCons(TH == TH1*TH_b1 + TH2*TH_b2)\nProfit_TH = 80000 * TH1 * TH_b1 + (80000 + 0.001 * (TH2 - 50)) * TH2 * TH_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH\nmodel.addCons(obj == Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH)\n\n# Add constraints\nmodel.addCons(150000 * LV + 70000 * MA + 30000 * AH + 100000 * CO + 50000 * TH <= 100000000)\nmodel.addCons(1000 * LV + 500 * MA + 300 * AH + 800 * CO + 400 * TH <= 100000)\nmodel.addCons(LV <= 20)\nmodel.addCons(MA <= 100)\nmodel.addCons(AH <= 200)\nmodel.addCons(CO <= 80)\nmodel.addCons(TH <= 50)\nmodel.addCons(LV / (LV + MA + AH + CO + TH) <= 0.05)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Number of Condominiums: \", model.getVal(CO))\n    print(\"Number of Townhouses: \", model.getVal(TH))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1547,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods depends on the distance and the number of trucks used. The cost function is nonlinear and includes a quadratic term reflecting increased operational complexity with more trucks.\n// The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n// Objective: Minimize C\n// Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\n// T1 >= 15; T2 >= 15; T3 >= 15; T4 >= 15; T5 >= 15; T6 >= 15\n\n## Generate Constraint-4:\nThe demand for deliveries from each warehouse varies. Warehouse 1 must deliver at least 500 units, Warehouse 2 at least 600 units, Warehouse 3 at least 700 units, Warehouse 4 at least 800 units, Warehouse 5 at least 900 units, and Warehouse 6 at least 1000 units. The delivery capacity of each truck is 50 units.\n// 50 * T1 >= 500; 50 * T2 >= 600; 50 * T3 >= 700; 50 * T4 >= 800; 50 * T5 >= 900; 50 * T6 >= 1000",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands. The cost of transporting goods depends on the distance and the number of trucks used, with a nonlinear cost function that includes a quadratic term reflecting increased operational complexity with more trucks. The total number of trucks available across all warehouses is 100. Each warehouse can handle a maximum of 20 trucks, and the company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency. The demand for deliveries from each warehouse varies: Warehouse 1 must deliver at least 500 units, Warehouse 2 at least 600 units, Warehouse 3 at least 700 units, Warehouse 4 at least 800 units, Warehouse 5 at least 900 units, and Warehouse 6 at least 1000 units. The delivery capacity of each truck is 50 units.\n\nPlease help the company to minimize the total transportation cost, which is given by the function: 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=15, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=15, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=15, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=15, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=15, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n## The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n## Objective: Minimize C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1000 * (T1**2 + T2**2 + T3**2 + T4**2 + T5**2 + T6**2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Add constraints\n## The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each warehouse can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n## The company must ensure that at least 15 trucks are allocated to each warehouse to maintain operational efficiency.\nmodel.addCons(T1 >= 15)\nmodel.addCons(T2 >= 15)\nmodel.addCons(T3 >= 15)\nmodel.addCons(T4 >= 15)\nmodel.addCons(T5 >= 15)\nmodel.addCons(T6 >= 15)\n## The demand for deliveries from each warehouse varies.\nmodel.addCons(50 * T1 >= 500)\nmodel.addCons(50 * T2 >= 600)\nmodel.addCons(50 * T3 >= 700)\nmodel.addCons(50 * T4 >= 800)\nmodel.addCons(50 * T5 >= 900)\nmodel.addCons(50 * T6 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck.\n// {\"speed of each truck\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"number of trips per truck\": \"Trips\", \"range\": \"Trips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost per trip\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2. The maintenance cost per trip also depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips.\n// Total operational cost per truck: Cost = FuelRate * Trips * Speed + MaintenanceCost * Trips\n// So, the objective function is: Minimize \u03a3(Cost) for all trucks\n\n## Generate Constraint-1:\nThe total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\n// \u03a3(Investment) <= 100,000\n\n## Generate Constraint-2:\nThe maximum allowable speed for any truck is 60 mph.\n// Speed <= 60",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck. The fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2, and the maintenance cost per trip depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips. The total investment in fuel-efficient technologies across all trucks must not exceed $100,000, and the maximum allowable speed for any truck is 60 mph. Please help the company to minimize the total monthly operational cost for all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of each truck\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n## {\"number of trips per truck\": \"Trips\", \"range\": \"Trips >= 0\", \"type\": \"integer\"}\n## {\"investment in fuel-efficient technologies\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n## {\"fuel consumption rate per trip\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"continuous\"}\n## {\"maintenance cost per trip\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)\nTrips = model.addVar(vtype=\"INTEGER\", name=\"Trips\", lb=0)\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0)\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0)\nMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost\", lb=0)\n\n# Define objective function\n## The fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2\nmodel.addCons(FuelRate == 0.005 * Speed**2)\n## The maintenance cost per trip also depends on the speed, given by MaintenanceCost = 0.001 * Speed^3\nmodel.addCons(MaintenanceCost == 0.001 * Speed**3)\n## Total operational cost per truck: Cost = FuelRate * Trips * Speed + MaintenanceCost * Trips\nCost = FuelRate * Trips * Speed + MaintenanceCost * Trips\n## So, the objective function is: Minimize \u03a3(Cost) for all trucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\nmodel.addCons(Investment <= 100000)\n## The maximum allowable speed for any truck is 60 mph.\nmodel.addCons(Speed <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trips per truck: \", model.getVal(Trips))\n    print(\"Investment in fuel-efficient technologies: \", model.getVal(Investment))\n    print(\"Fuel consumption rate per trip: \", model.getVal(FuelRate))\n    print(\"Maintenance cost per trip: \", model.getVal(MaintenanceCost))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (A, B, C, D, and E) to maximize energy production while minimizing the environmental impact.\n// {\"number of solar panels in zone A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in zone A is 0.8 kWh/panel, with an environmental impact score of 0.1.\nIn zone B, the efficiency is 0.9 kWh/panel, with an environmental impact score of 0.2.\nIn zone C, the efficiency is 1.0 kWh/panel, with an environmental impact score of 0.3.\nIn zone D, the efficiency is 1.1 kWh/panel, with an environmental impact score of 0.4.\nIn zone E, the efficiency is 1.2 kWh/panel, with an environmental impact score of 0.5.\nThe city aims to maximize the energy production per unit of environmental impact (defined as the total energy produced divided by the total environmental impact).\n// Total energy produced: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 1.1 * D + 1.2 * E\n// Total environmental impact: Impact = 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 to spend on solar panel installations.\n// Cost of panels in zone A: 1000 * A\n// Cost of panels in zone B: 1200 * B\n// Cost of panels in zone C: 1400 * C\n// Cost of panels in zone D: 1600 * D\n// Cost of panels in zone E: 1800 * E\n// 1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E <= 500000\n\n## Generate Constraint-2:\nThe city wants to ensure that at least 50% of the budget is spent on solar panels.\n// 1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E >= 250000\n\n## Generate Constraint-3:\nThe city has a limit of 300 panels that can be installed in total.\n// A + B + C + D + E <= 300\n\n## Generate Constraint-4:\nThe city wants to ensure that the number of panels in zone A does not exceed the combined number of panels in zones B and C.\n// A <= B + C",
        "question": "A city is planning to install solar panels on rooftops across different zones (A, B, C, D, and E) to maximize energy production while minimizing the environmental impact. The efficiency and environmental impact score for each zone are given in the following Table.\n\n| Zone | Efficiency (kWh/panel) | Environmental Impact Score |\n|------|------------------------|----------------------------|\n| A    | 0.8                    | 0.1                        |\n| B    | 0.9                    | 0.2                        |\n| C    | 1.0                    | 0.3                        |\n| D    | 1.1                    | 0.4                        |\n| E    | 1.2                    | 0.5                        |\n\nThe city has a budget of $500,000 to spend on solar panel installations. The city wants to ensure that at least 50% of the budget is spent on solar panels. The city has a limit of 300 panels that can be installed in total. The city wants to ensure that the number of panels in zone A does not exceed the combined number of panels in zones B and C.\n\nPlease help the city to maximize the energy production per unit of environmental impact (defined as the total energy produced divided by the total environmental impact).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels in zone A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels in zone B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels in zone C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels in zone D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels in zone E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 1.1 * D + 1.2 * E\nImpact = 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 to spend on solar panel installations.\nmodel.addCons(1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E <= 500000)\n## The city wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E >= 250000)\n## The city has a limit of 300 panels that can be installed in total.\nmodel.addCons(A + B + C + D + E <= 300)\n## The city wants to ensure that the number of panels in zone A does not exceed the combined number of panels in zones B and C.\nmodel.addCons(A <= B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(A))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(B))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(C))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(D))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(E))\n    print(\"Maximized Energy per Unit of Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in fuel-efficient technologies for the trucks, which will reduce fuel costs per kilometer.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsW\": \"TechW\", \"range\": \"TechW >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods.\n// Fuel cost for GoodsX: CostX = (0.50 - 0.0001 * TechX) * (TrucksX * DistanceX)\n// Fuel cost for GoodsY: CostY = (0.60 - 0.0001 * TechY) * (TrucksY * DistanceY)\n// Fuel cost for GoodsZ: CostZ = (0.70 - 0.0001 * TechZ) * (TrucksZ * DistanceZ)\n// Fuel cost for GoodsW: CostW = (0.80 - 0.0001 * TechW) * (TrucksW * DistanceW)\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nThe total investment in fuel-efficient technology cannot exceed $100,000.\n// TechX + TechY + TechZ + TechW <= 100,000\n\n## Generate Constraint-3:\nDue to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks.\n// TrucksX >= 10; TrucksY >= 15\n\n## Generate Constraint-4:\nThe total distance each type of goods needs to be transported varies: GoodsX travels 10,000 km, GoodsY travels 15,000 km, GoodsZ travels 20,000 km, and GoodsW travels 25,000 km.\n// TrucksX * DistanceX = 10,000 * TrucksX\n// TrucksY * DistanceY = 15,000 * TrucksY\n// TrucksZ * DistanceZ = 20,000 * TrucksZ\n// TrucksW * DistanceW = 25,000 * TrucksW\n\n## Generate Constraint-5:\nThe company wants to ensure that each type of goods has at least one truck allocated to it.\n// TrucksX >= 1; TrucksY >= 1; TrucksZ >= 1; TrucksW >= 1",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month and the investment in fuel-efficient technologies for the trucks. The initial fuel cost per kilometer and the required distance for each type of goods are given in the following Table.\n\n| Goods | Initial Fuel Cost per Kilometer | Required Distance |\n|-------|---------------------------------|------------------|\n| X     | $0.50                           | 10,000 km        |\n| Y     | $0.60                           | 15,000 km        |\n| Z     | $0.70                           | 20,000 km        |\n| W     | $0.80                           | 25,000 km        |\n\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The company has a total of 50 trucks available for the month. The total investment in fuel-efficient technology cannot exceed $100,000. Due to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks. The company wants to ensure that each type of goods has at least one truck allocated to it.\n\nPlease help the company to minimize the total fuel cost for all goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=1)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=1)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=1)  # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=1)  # number of trucks for GoodsW\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in fuel-efficient technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in fuel-efficient technology for GoodsY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for GoodsZ\nTechW = model.addVar(vtype=\"CONTINUOUS\", name=\"TechW\", lb=0)  # investment in fuel-efficient technology for GoodsW\n\n# Define objective function\nCostX = (0.50 - 0.0001 * TechX) * (10000 * TrucksX)\nCostY = (0.60 - 0.0001 * TechY) * (15000 * TrucksY)\nCostZ = (0.70 - 0.0001 * TechZ) * (20000 * TrucksZ)\nCostW = (0.80 - 0.0001 * TechW) * (25000 * TrucksW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\nmodel.addCons(TechX + TechY + TechZ + TechW <= 100000)\nmodel.addCons(TrucksX >= 10)\nmodel.addCons(TrucksY >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Tech for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Tech for GoodsY: \", model.getVal(TechY))\n    print(\"Investment in Tech for GoodsZ: \", model.getVal(TechZ))\n    print(\"Investment in Tech for GoodsW: \", model.getVal(TechW))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1326,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The company also considers the fuel efficiency and maintenance costs of each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for small trucks\": \"DriversSmall\", \"range\": \"DriversSmall >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for medium trucks\": \"DriversMedium\", \"range\": \"DriversMedium >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for large trucks\": \"DriversLarge\", \"range\": \"DriversLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $45,000, and a large truck is $60,000. The fuel efficiency of a small truck is 15 km/l, a medium truck is 12 km/l, and a large truck is 10 km/l. The maintenance cost per kilometer for a small truck is $0.1, a medium truck is $0.15, and a large truck is $0.2. The company wants to minimize the total cost of purchasing trucks and their operational costs.\n// PurchaseCost = 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks\n// FuelCost = (15 * SmallTrucks * DriversSmall * Distance) + (12 * MediumTrucks * DriversMedium * Distance) + (10 * LargeTrucks * DriversLarge * Distance)\n// MaintenanceCost = (0.1 * SmallTrucks * DriversSmall * Distance) + (0.15 * MediumTrucks * DriversMedium * Distance) + (0.2 * LargeTrucks * DriversLarge * Distance)\n// So, the objective function is: Minimize (PurchaseCost + FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// DriversSmall + DriversMedium + DriversLarge <= 50\n\n## Generate Constraint-3:\nThe total distance that can be covered by the fleet per day is limited to 5000 km.\n// (15 * SmallTrucks * DriversSmall) + (12 * MediumTrucks * DriversMedium) + (10 * LargeTrucks * DriversLarge) <= 5000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The company also considers the fuel efficiency and maintenance costs of each type of truck. The cost of a small truck is $30,000, a medium truck is $45,000, and a large truck is $60,000. The fuel efficiency of a small truck is 15 km/l, a medium truck is 12 km/l, and a large truck is 10 km/l. The maintenance cost per kilometer for a small truck is $0.1, a medium truck is $0.15, and a large truck is $0.2. The company has a budget of $1,000,000 for purchasing trucks. The company has a total of 50 drivers available. The total distance that can be covered by the fleet per day is limited to 5000 km. Please help the company to minimize the total cost of purchasing trucks and their operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nDriversSmall = model.addVar(vtype=\"INTEGER\", name=\"DriversSmall\", lb=0)  # number of drivers for small trucks\nDriversMedium = model.addVar(vtype=\"INTEGER\", name=\"DriversMedium\", lb=0)  # number of drivers for medium trucks\nDriversLarge = model.addVar(vtype=\"INTEGER\", name=\"DriversLarge\", lb=0)  # number of drivers for large trucks\n\n# Define objective function\nPurchaseCost = 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks\nFuelCost = (15 * SmallTrucks * DriversSmall + 12 * MediumTrucks * DriversMedium + 10 * LargeTrucks * DriversLarge) * 5000  # assuming Distance = 5000 km\nMaintenanceCost = (0.1 * SmallTrucks * DriversSmall + 0.15 * MediumTrucks * DriversMedium + 0.2 * LargeTrucks * DriversLarge) * 5000\nTotalCost = PurchaseCost + FuelCost + MaintenanceCost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks <= 1000000)  # budget constraint\nmodel.addCons(DriversSmall + DriversMedium + DriversLarge <= 50)  # driver availability constraint\nmodel.addCons((15 * SmallTrucks * DriversSmall) + (12 * MediumTrucks * DriversMedium) + (10 * LargeTrucks * DriversLarge) <= 5000)  # distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers for Small Trucks: \", model.getVal(DriversSmall))\n    print(\"Number of Drivers for Medium Trucks: \", model.getVal(DriversMedium))\n    print(\"Number of Drivers for Large Trucks: \", model.getVal(DriversLarge))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 6 different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize efficiency while minimizing costs.\n// {\"number of turbines in farm 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach turbine generates a certain amount of electricity per hour, which varies by farm due to differences in wind conditions and turbine technology. The cost of operating each turbine also varies by farm. The company aims to maximize the total electricity generation while minimizing the total operating cost.\n// Electricity generated per hour in farm 1: E1 = 50 * T1^0.7\n// Electricity generated per hour in farm 2: E2 = 60 * T2^0.8\n// Electricity generated per hour in farm 3: E3 = 45 * T3^0.6\n// Electricity generated per hour in farm 4: E4 = 55 * T4^0.75\n// Electricity generated per hour in farm 5: E5 = 65 * T5^0.85\n// Electricity generated per hour in farm 6: E6 = 70 * T6^0.9\n// Operating cost per hour in farm 1: C1 = 10 * T1^1.2\n// Operating cost per hour in farm 2: C2 = 12 * T2^1.3\n// Operating cost per hour in farm 3: C3 = 9 * T3^1.1\n// Operating cost per hour in farm 4: C4 = 11 * T4^1.25\n// Operating cost per hour in farm 5: C5 = 13 * T5^1.35\n// Operating cost per hour in farm 6: C6 = 15 * T6^1.4\n// The objective function is: Maximize (E1 + E2 + E3 + E4 + E5 + E6) - (C1 + C2 + C3 + C4 + C5 + C6)\n// Maximize \u03a3(50 * T1^0.7 + 60 * T2^0.8 + 45 * T3^0.6 + 55 * T4^0.75 + 65 * T5^0.85 + 70 * T6^0.9) - \u03a3(10 * T1^1.2 + 12 * T2^1.3 + 9 * T3^1.1 + 11 * T4^1.25 + 13 * T5^1.35 + 15 * T6^1.4)\n\n## Generate Constraint-1:\nThe total number of turbines that can be installed across all farms is limited to 200.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 200",
        "question": "A company operates 6 different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize efficiency while minimizing costs. The electricity generated per hour and the operating cost per hour for each turbine vary by farm due to differences in wind conditions and turbine technology. The company aims to maximize the total electricity generation while minimizing the total operating cost.\n\n| Farm | Electricity Generated per Hour | Operating Cost per Hour |\n|------|---------------------------------|-------------------------|\n| 1    | 50 * T1^0.7                     | 10 * T1^1.2             |\n| 2    | 60 * T2^0.8                     | 12 * T2^1.3             |\n| 3    | 45 * T3^0.6                     | 9 * T3^1.1              |\n| 4    | 55 * T4^0.75                    | 11 * T4^1.25            |\n| 5    | 65 * T5^0.85                    | 13 * T5^1.35            |\n| 6    | 70 * T6^0.9                     | 15 * T6^1.4             |\n\nThe total number of turbines that can be installed across all farms is limited to 200.\n\nPlease help the company to maximize the total electricity generation while minimizing the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of turbines in farm 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of turbines in farm 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of turbines in farm 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of turbines in farm 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of turbines in farm 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of turbines in farm 6\n\n# Define objective function\n# Electricity and cost calculations\nE1 = 50 * T1**0.7\nE2 = 60 * T2**0.8\nE3 = 45 * T3**0.6\nE4 = 55 * T4**0.75\nE5 = 65 * T5**0.85\nE6 = 70 * T6**0.9\nC1 = 10 * T1**1.2\nC2 = 12 * T2**1.3\nC3 = 9 * T3**1.1\nC4 = 11 * T4**1.25\nC5 = 13 * T5**1.35\nC6 = 15 * T6**1.4\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6 - C1 - C2 - C3 - C4 - C5 - C6)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of turbines in farm 1: \", model.getVal(T1))\n    print(\"Number of turbines in farm 2: \", model.getVal(T2))\n    print(\"Number of turbines in farm 3: \", model.getVal(T3))\n    print(\"Number of turbines in farm 4: \", model.getVal(T4))\n    print(\"Number of turbines in farm 5: \", model.getVal(T5))\n    print(\"Number of turbines in farm 6: \", model.getVal(T6))\n    print(\"Maximized Net Electricity Generation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a cost per trip based on fuel and maintenance. The costs are as follows: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported.\n// Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// The objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trips must be at least 50 to meet the demand.\n// T1 + T2 + T3 + T4 + T5 >= 50\n\n## Generate Constraint-2:\nEach truck has a maximum capacity for trips per month. Truck1 can make up to 10 trips, Truck2 up to 12 trips, Truck3 up to 15 trips, Truck4 up to 18 trips, and Truck5 up to 20 trips.\n// T1 <= 10; T2 <= 12; T3 <= 15; T4 <= 18; T5 <= 20\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the trips are made by the most fuel-efficient truck (Truck1).\n// T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe total cost of trips for Truck5 should not exceed 30% of the total cost.\n// 200 * T5 <= 0.3 * (100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5)",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations. The cost per trip for each truck is given in the following Table.\n\n| Truck | Cost per Trip |\n|-------|---------------|\n| Truck1 | $100         |\n| Truck2 | $120         |\n| Truck3 | $150         |\n| Truck4 | $180         |\n| Truck5 | $200         |\n\nThe company aims to minimize the total cost of all trips while ensuring sufficient goods are transported. The total number of trips must be at least 50 to meet the demand. Each truck has a maximum capacity for trips per month: Truck1 can make up to 10 trips, Truck2 up to 12 trips, Truck3 up to 15 trips, Truck4 up to 18 trips, and Truck5 up to 20 trips. The company wants to ensure that at least 20% of the trips are made by the most fuel-efficient truck (Truck1). Additionally, the total cost of trips for Truck5 should not exceed 30% of the total cost.\n\nPlease help the company to determine the optimal number of trips for each truck to minimize the total cost while satisfying all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for Truck5\n\n# Define objective function\nTotal_cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_cost)\n\n# Add constraints\n# The total number of trips must be at least 50 to meet the demand.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 50)\n# Each truck has a maximum capacity for trips per month.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 12)\nmodel.addCons(T3 <= 15)\nmodel.addCons(T4 <= 18)\nmodel.addCons(T5 <= 20)\n# The company wants to ensure that at least 20% of the trips are made by the most fuel-efficient truck (Truck1).\nmodel.addCons(T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n# The total cost of trips for Truck5 should not exceed 30% of the total cost.\nmodel.addCons(200 * T5 <= 0.3 * Total_cost)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"ES\", \"range\": \"ES >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n// Energy_output_SP = 0.15 * (1 + 0.005 * (R&D / 100000)) * SP\n// Energy_output_WT = 0.25 * (1 + 0.007 * (R&D / 100000)) * WT\n// Cost_ES = 1000 - 50 * (R&D / 100000) * ES\n// So, the objective function is: Maximize (Energy_output_SP + Energy_output_WT) - Cost_ES\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage.\n// SP * 10000 + WT * 15000 + ES * 500 <= 5000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $1,000,000.\n// R&D <= 1000000\n\n## Generate Constraint-3:\nThe total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n// 2 * SP + 5 * WT <= 5000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 solar panels and 50 wind turbines are installed.\n// SP >= 100; WT >= 50\n\n## Generate Constraint-5:\nThe energy storage capacity must be sufficient to store at least 50% of the total energy output.\n// ES >= 0.5 * (Energy_output_SP + Energy_output_WT)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage. The total investment in R&D cannot exceed $1,000,000. The total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters. The company must ensure that at least 100 solar panels and 50 wind turbines are installed. The energy storage capacity must be sufficient to store at least 50% of the total energy output.\n\nPlease help the company to maximize the total energy output (in MWh) while minimizing the cost of energy storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=100)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=50)  # number of wind turbines\nES = model.addVar(vtype=\"INTEGER\", name=\"ES\", lb=0)  # amount of energy storage\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R_D\", lb=0)  # investment in R&D\n\n# Define objective function\nEnergy_output_SP = 0.15 * (1 + 0.005 * (R_D / 100000)) * SP\nEnergy_output_WT = 0.25 * (1 + 0.007 * (R_D / 100000)) * WT\nCost_ES = 1000 - 50 * (R_D / 100000) * ES\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output_SP + Energy_output_WT - Cost_ES)\n\n# Add constraints\nmodel.addCons(SP * 10000 + WT * 15000 + ES * 500 <= 5000000)  # budget constraint\nmodel.addCons(R_D <= 1000000)  # R&D investment constraint\nmodel.addCons(2 * SP + 5 * WT <= 5000)  # area constraint\nmodel.addCons(ES >= 0.5 * (Energy_output_SP + Energy_output_WT))  # energy storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Amount of Energy Storage: \", model.getVal(ES))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Maximized Total Energy Output - Cost of Energy Storage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Cost per Truck is $500, the Maintenance Cost per Truck is $300, and the Revenue per Truck is $1000.\nFor RouteB, the Fuel Cost per Truck is $600, the Maintenance Cost per Truck is $350, and the Revenue per Truck is $1200.\nFor RouteC, the Fuel Cost per Truck is $700, the Maintenance Cost per Truck is $400, and the Revenue per Truck is $1400.\nFor RouteD, the Fuel Cost per Truck is $800, the Maintenance Cost per Truck is $450, and the Revenue per Truck is $1600.\nFor RouteE, the Fuel Cost per Truck is $900, the Maintenance Cost per Truck is $500, and the Revenue per Truck is $1800.\nThe company wants to minimize the average cost per truck while ensuring profitability.\n// Total cost for RouteA: Cost_RouteA = (500 + 300) * TrucksA\n// Total cost for RouteB: Cost_RouteB = (600 + 350) * TrucksB\n// Total cost for RouteC: Cost_RouteC = (700 + 400) * TrucksC\n// Total cost for RouteD: Cost_RouteD = (800 + 450) * TrucksD\n// Total cost for RouteE: Cost_RouteE = (900 + 500) * TrucksE\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs. The costs and revenues per truck for each route are given in the following Table.\n\n| Route   | Fuel Cost per Truck | Maintenance Cost per Truck | Revenue per Truck |\n|---------|---------------------|----------------------------|-------------------|\n| RouteA  | $500                | $300                       | $1000             |\n| RouteB  | $600                | $350                       | $1200             |\n| RouteC  | $700                | $400                       | $1400             |\n| RouteD  | $800                | $450                       | $1600             |\n| RouteE  | $900                | $500                       | $1800             |\n\nThe company has a total of 40 trucks available for allocation. The company wants to minimize the average cost per truck while ensuring profitability. Please help the company to determine the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_RouteA = (500 + 300) * TrucksA\nCost_RouteB = (600 + 350) * TrucksB\nCost_RouteC = (700 + 400) * TrucksC\nCost_RouteD = (800 + 450) * TrucksD\nCost_RouteE = (900 + 500) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Average Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 * MachineA_units) - 10,000\n// Total profit for MachineB: Profit_MachineB = (700 * MachineB_units) - 15,000\n// Total profit for MachineC: Profit_MachineC = (900 * MachineC_units) - 20,000\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for setup costs.\n// 10,000 * MachineA_units + 15,000 * MachineB_units + 20,000 * MachineC_units <= 100,000\n\n## Generate Constraint-2:\nThe production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\n// MachineA_units <= 100\n// MachineB_units <= 80\n// MachineC_units <= 60\n\n## Generate Constraint-3:\nDue to market demand, the number of MachineB units produced must be at least twice the number of MachineA units.\n// MachineB_units >= 2 * MachineA_units\n\n## Generate Constraint-4:\nThe company must produce at least 20 units of MachineC.\n// MachineC_units >= 20",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type. The profit per unit and setup costs for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| MachineA | $500            | $10,000    |\n| MachineB | $700            | $15,000    |\n| MachineC | $900            | $20,000    |\n\nThe company has a total budget of $100,000 for setup costs. The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units. Due to market demand, the number of MachineB units produced must be at least twice the number of MachineA units. The company must also produce at least 20 units of MachineC.\n\nPlease help the company to maximize the total profit, which is calculated as the sum of the profits from each machine type minus their respective setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0)\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0)\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0)\n\n# Define objective function\nProfit_MachineA = (500 * MachineA_units) - 10000\nProfit_MachineB = (700 * MachineB_units) - 15000\nProfit_MachineC = (900 * MachineC_units) - 20000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\nmodel.addCons(10000 * MachineA_units + 15000 * MachineB_units + 20000 * MachineC_units <= 100000)\nmodel.addCons(MachineA_units <= 100)\nmodel.addCons(MachineB_units <= 80)\nmodel.addCons(MachineC_units <= 60)\nmodel.addCons(MachineB_units >= 2 * MachineA_units)\nmodel.addCons(MachineC_units >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process for each product, and the marketing budget for each product. The level of automation affects the production cost per unit and the production rate, while the marketing budget influences the sales rate. The initial production cost per unit, sales price per unit, and the effect of automation and marketing budget on costs and sales are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Sales Price per Unit | Effect of Automation on Cost | Effect of Marketing Budget on Sales |\n|---------|----------------------------------|----------------------|-------------------------------|-------------------------------------|\n| ProductA | $100                             | $150                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n| ProductB | $120                             | $180                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n| ProductC | $150                             | $200                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n\nThe company aims to maximize the total profit from all products. The total production capacity of the company is 10,000 units, and the total investment in automation cannot exceed $50,000.\n\nPlease help the company determine the optimal production quantity, level of automation, and marketing budget for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation Level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation Level for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1642,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations. The cost per trip, fuel consumption per trip, and revenue per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Fuel Consumption per Trip | Revenue per Trip |\n|---------|---------------|---------------------------|------------------|\n| V1      | $100          | 5 liters                  | $150             |\n| V2      | $120          | 6 liters                  | $180             |\n| V3      | $140          | 7 liters                  | $210             |\n\nThe company has a limited fuel budget of 500 liters. The company also has a budget of $10,000 for operational costs. The company wants to maximize the profit efficiency (profit per liter of fuel consumed). Please help the company determine the optimal number of trips for each vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for V1: \", model.getVal(V1))\n    print(\"Number of Trips for V2: \", model.getVal(V2))\n    print(\"Number of Trips for V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit.\n// {\"quantity of MachineA\": \"MachineA_qty\", \"range\": \"MachineA_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineB\": \"MachineB_qty\", \"range\": \"MachineB_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineC\": \"MachineC_qty\", \"range\": \"MachineC_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineD\": \"MachineD_qty\", \"range\": \"MachineD_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n// Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n// Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n// Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of MachineC must be at least twice the production of MachineB.\n// MachineC_qty >= 2 * MachineB_qty\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials per month.\n// (0.01 * (MachineA_qty^2) + 20 * MachineA_qty) * MachineA_qty + (0.015 * (MachineB_qty^2) + 25 * MachineB_qty) * MachineB_qty + (0.02 * (MachineC_qty^2) + 30 * MachineC_qty) * MachineC_qty + (0.025 * (MachineD_qty^2) + 35 * MachineD_qty) * MachineD_qty <= 500,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each machine type has at least some minimal production to maintain market presence.\n// MachineA_qty >= 10; MachineB_qty >= 10; MachineC_qty >= 10; MachineD_qty >= 10",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company has a total production capacity of 1000 machines per month. Due to market demand, the production of MachineC must be at least twice the production of MachineB. The company has a budget of $500,000 for raw materials per month. The company wants to ensure that each machine type has at least some minimal production to maintain market presence, with a minimum production of 10 units for each machine type. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_qty\", lb=0)\nMachineB_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_qty\", lb=0)\nMachineC_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_qty\", lb=0)\nMachineD_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineD_qty\", lb=0)\n\n# Define objective function\n## Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n## Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n## Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n## Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n## So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\nProfit_MachineA = (500 - (0.01 * MachineA_qty**2 + 20 * MachineA_qty)) * MachineA_qty\nProfit_MachineB = (700 - (0.015 * MachineB_qty**2 + 25 * MachineB_qty)) * MachineB_qty\nProfit_MachineC = (900 - (0.02 * MachineC_qty**2 + 30 * MachineC_qty)) * MachineC_qty\nProfit_MachineD = (1100 - (0.025 * MachineD_qty**2 + 35 * MachineD_qty)) * MachineD_qty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000)\n## Due to market demand, the production of MachineC must be at least twice the production of MachineB.\nmodel.addCons(MachineC_qty >= 2 * MachineB_qty)\n## The company has a budget of $500,000 for raw materials per month.\nmodel.addCons((0.01 * MachineA_qty**2 + 20 * MachineA_qty) * MachineA_qty + \n              (0.015 * MachineB_qty**2 + 25 * MachineB_qty) * MachineB_qty + \n              (0.02 * MachineC_qty**2 + 30 * MachineC_qty) * MachineC_qty + \n              (0.025 * MachineD_qty**2 + 35 * MachineD_qty) * MachineD_qty <= 500000)\n## The company wants to ensure that each machine type has at least some minimal production to maintain market presence.\nmodel.addCons(MachineA_qty >= 10)\nmodel.addCons(MachineB_qty >= 10)\nmodel.addCons(MachineC_qty >= 10)\nmodel.addCons(MachineD_qty >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of MachineA: \", model.getVal(MachineA_qty))\n    print(\"Quantity of MachineB: \", model.getVal(MachineB_qty))\n    print(\"Quantity of MachineC: \", model.getVal(MachineC_qty))\n    print(\"Quantity of MachineD: \", model.getVal(MachineD_qty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region to optimize its operations.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region1 is $1000 per day, the revenue per delivery is $500, and the average delivery time is 4 hours.\nIn Region2, the cost is $1200 per day, the revenue is $600, and the average delivery time is 5 hours.\nIn Region3, the cost is $1400 per day, the revenue is $700, and the average delivery time is 6 hours.\nIn Region4, the cost is $1600 per day, the revenue is $800, and the average delivery time is 7 hours.\nIn Region5, the cost is $1800 per day, the revenue is $900, and the average delivery time is 8 hours.\nThe company wants to maximize the profit per hour of operation across all regions.\n// Profit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\n// Profit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\n// Profit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\n// Profit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\n// Profit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n// So, the objective function is: Maximize (Profit_Region1 + Profit_Region2 + Profit_Region3 + Profit_Region4 + Profit_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 per day for operating costs.\n// 1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available across all regions is 100.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100\n\n## Generate Constraint-3:\nThe demand in Region1 requires at least 10 trucks.\n// Truck1 >= 10\n\n## Generate Constraint-4:\nNo more than 30 trucks can be allocated to Region3 due to infrastructure limitations.\n// Truck3 <= 30",
        "question": "A logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region to optimize its operations.\nThe cost of operating a truck in Region1 is $1000 per day, the revenue per delivery is $500, and the average delivery time is 4 hours.\nIn Region2, the cost is $1200 per day, the revenue is $600, and the average delivery time is 5 hours.\nIn Region3, the cost is $1400 per day, the revenue is $700, and the average delivery time is 6 hours.\nIn Region4, the cost is $1600 per day, the revenue is $800, and the average delivery time is 7 hours.\nIn Region5, the cost is $1800 per day, the revenue is $900, and the average delivery time is 8 hours.\nThe company has a total budget of $100,000 per day for operating costs. The total number of trucks available across all regions is 100. The demand in Region1 requires at least 10 trucks. No more than 30 trucks can be allocated to Region3 due to infrastructure limitations.\nPlease help the company to maximize the profit per hour of operation across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=10) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0, ub=30) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks in Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\nProfit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\nProfit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\nProfit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\nProfit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n## convert the division to multiplication\nmodel.addCons(obj * (4 * Truck1 + 5 * Truck2 + 6 * Truck3 + 7 * Truck4 + 8 * Truck5) == Profit_Region1 * 4 + Profit_Region2 * 5 + Profit_Region3 * 6 + Profit_Region4 * 7 + Profit_Region5 * 8)\n\n# Add constraints\n## The company has a total budget of $100,000 per day for operating costs.\nmodel.addCons(1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000)\n## The total number of trucks available across all regions is 100.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000\n\n## Generate Constraint-3:\nThe company has a distribution capacity of 100 units in terms of the number of units it can distribute.\n// P1 + P2 + P3 <= 100",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit for P1 is $30, requiring 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space). The company has a limited storage space of 200 square meters and a budget of $3000 for purchasing the products. Additionally, the company has a distribution capacity of 100 units in terms of the number of units it can distribute. Please help the company to maximize the total profit while considering the storage efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n## The company has a distribution capacity of 100 units in terms of the number of units it can distribute.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost structure. Machine 1 produces product 1 at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product 2 at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product 3 at a rate of 20 units per hour, with a profit of $6 per unit. Machine 4 produces product 1 at a rate of 12 units per hour, with a profit of $5 per unit. Machine 5 produces product 2 at a rate of 18 units per hour, with a profit of $7 per unit. The objective is to maximize the total profit from all products.\n// The profit from machine 1: P1 = 10 * M1 * 5\n// The profit from machine 2: P2 = 15 * M2 * 7\n// The profit from machine 3: P3 = 20 * M3 * 6\n// The profit from machine 4: P4 = 12 * M4 * 5\n// The profit from machine 5: P5 = 18 * M5 * 7\n// So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours per week.\n// M1 + M2 + M3 + M4 + M5 <= 100",
        "question": "A manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit. Machine 1 produces product 1 at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product 2 at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product 3 at a rate of 20 units per hour, with a profit of $6 per unit. Machine 4 produces product 1 at a rate of 12 units per hour, with a profit of $5 per unit. Machine 5 produces product 2 at a rate of 18 units per hour, with a profit of $7 per unit. The total operating hours for all machines must not exceed 100 hours per week. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\n\n# Define objective function\nP1 = 10 * M1 * 5\nP2 = 15 * M2 * 7\nP3 = 20 * M3 * 6\nP4 = 12 * M4 * 5\nP5 = 18 * M5 * 7\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialized truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are met.\n// Fuel_Consumption_Small = (S * 20) / (S * 5)\n// Fuel_Consumption_Medium = (M * 15) / (M * 10)\n// Fuel_Consumption_Large = (L * 10) / (L * 15)\n// Fuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\n// Fuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n## Generate Constraint-1:\nThe total capacity required for all deliveries is 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase a maximum of 30 trucks in total.\n// S + M + L + XL + Sp <= 30\n\n## Generate Constraint-3:\nThe number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment.\n// Sp <= 5",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fuel Efficiency (km/l) | Capacity (tons) |\n|------------------|-----------------------|-----------------|\n| Small            | 20                    | 5               |\n| Medium           | 15                    | 10              |\n| Large            | 10                    | 15              |\n| Extra-Large      | 8                     | 20              |\n| Specialized      | 5                     | 25              |\n\nThe total capacity required for all deliveries is 500 tons. The company has a budget to purchase a maximum of 30 trucks in total. The number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment. \n\nPlease help the company to minimize the total fuel consumption while ensuring all deliveries are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Small = (S * 20) / (S * 5)\nFuel_Consumption_Medium = (M * 15) / (M * 10)\nFuel_Consumption_Large = (L * 10) / (L * 15)\nFuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\nFuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n# Add constraints\n## The total capacity required for all deliveries is 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500)\n## The company has a budget to purchase a maximum of 30 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 30)\n## The number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment.\nmodel.addCons(Sp <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Specialized Trucks: \", model.getVal(Sp))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the overall operational cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of each truck type is a nonlinear function of the number of trucks and drivers. The cost includes fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is linearly dependent on the number of drivers, at $3000 per driver. The company aims to minimize the total operational cost.\n// Total operational cost: Cost = (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for vehicle operations and driver salaries.\n// (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers <= 150000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 500 tons. Each Small truck carries 1 ton, each Medium truck carries 2 tons, and each Large truck carries 3 tons.\n// SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nDue to licensing restrictions, the number of drivers must not exceed 200.\n// Drivers <= 200\n\n## Generate Constraint-4:\nThe company must operate at least 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks >= 50",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of Small, Medium, and Large trucks, as well as the number of drivers to hire. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The operational cost of each truck type is a nonlinear function of the number of trucks and drivers, including fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is $3000 per driver. The company has a budget of $150,000 for vehicle operations and driver salaries. The total cargo capacity of the fleet must be at least 500 tons, with each Small truck carrying 1 ton, each Medium truck carrying 2 tons, and each Large truck carrying 3 tons. The number of drivers must not exceed 200 due to licensing restrictions, and the company must operate at least 50 trucks in total.\n\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate the operational cost for each truck type\nCost_Small = (0.5 + 0.001 * SmallTrucks**2) * (SmallTrucks * Drivers)\nCost_Medium = (0.7 + 0.0015 * MediumTrucks**2) * (MediumTrucks * Drivers)\nCost_Large = (1 + 0.002 * LargeTrucks**2) * (LargeTrucks * Drivers)\nCost_Drivers = 3000 * Drivers\n\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers)\n\n# Add constraints\n## The company has a budget of $150,000 for vehicle operations and driver salaries.\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers <= 150000)\n## The total cargo capacity of the fleet must be at least 500 tons.\nmodel.addCons(SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500)\n## Due to licensing restrictions, the number of drivers must not exceed 200.\nmodel.addCons(Drivers <= 200)\n## The company must operate at least 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency (in km/l) of each truck type.\n// {\"speed of Truck 1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of Truck 2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of Truck 1 on Route A\": \"Truck1_RouteA\", \"range\": \"Truck1_RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck 2 on Route A\": \"Truck2_RouteA\", \"range\": \"Truck2_RouteA >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption rate of each truck is a nonlinear function of its speed, given by the formula: Fuel Consumption = (Speed^3 / Efficiency). The objective is to minimize the total fuel consumption across all trucks and routes.\n// Fuel Consumption for Truck 1 on Route A: FC1_A = (Speed1^3 / Efficiency1) * Truck1_RouteA\n// Fuel Consumption for Truck 2 on Route A: FC2_A = (Speed2^3 / Efficiency2) * Truck2_RouteA\n// Total Fuel Consumption: Minimize (FC1_A + FC2_A)\n\n## Generate Constraint-1:\nThe total number of trucks available for Route A is limited to 50.\n// Truck1_RouteA + Truck2_RouteA <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for trucks on Route A is 100 km/h.\n// Speed1 <= 100; Speed2 <= 100\n\n## Generate Constraint-3:\nThe fuel efficiency of Truck 1 is at least 5 km/l, and Truck 2 is at least 6 km/l.\n// Efficiency1 >= 5; Efficiency2 >= 6\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 deliveries are made on Route A.\n// Truck1_RouteA + Truck2_RouteA >= 20\n\n## Generate Constraint-5:\nThe average speed of trucks on Route A should not exceed the optimal speed for fuel efficiency, which is 80 km/h.\n// (Speed1 * Truck1_RouteA + Speed2 * Truck2_RouteA) / (Truck1_RouteA + Truck2_RouteA) <= 80",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency (in km/l) of each truck type. The company aims to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption rate of each truck is a nonlinear function of its speed, given by the formula: Fuel Consumption = (Speed^3 / Efficiency). The total number of trucks available for Route A is limited to 50. The maximum speed limit for trucks on Route A is 100 km/h. The fuel efficiency of Truck 1 is at least 5 km/l, and Truck 2 is at least 6 km/l. The company must ensure that at least 20 deliveries are made on Route A. The average speed of trucks on Route A should not exceed the optimal speed for fuel efficiency, which is 80 km/h.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120) # speed of Truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120) # speed of Truck 2\nTruck1_RouteA = model.addVar(vtype=\"INTEGER\", name=\"Truck1_RouteA\", lb=0) # number of Truck 1 on Route A\nTruck2_RouteA = model.addVar(vtype=\"INTEGER\", name=\"Truck2_RouteA\", lb=0) # number of Truck 2 on Route A\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=5) # fuel efficiency of Truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=6) # fuel efficiency of Truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel Consumption for Truck 1 on Route A: FC1_A = (Speed1^3 / Efficiency1) * Truck1_RouteA\n## Fuel Consumption for Truck 2 on Route A: FC2_A = (Speed2^3 / Efficiency2) * Truck2_RouteA\n## Total Fuel Consumption: Minimize (FC1_A + FC2_A)\nFC1_A = (Speed1**3 / Efficiency1) * Truck1_RouteA\nFC2_A = (Speed2**3 / Efficiency2) * Truck2_RouteA\nmodel.addCons(obj == FC1_A + FC2_A)\n\n# Add constraints\n## The total number of trucks available for Route A is limited to 50.\nmodel.addCons(Truck1_RouteA + Truck2_RouteA <= 50)\n## The maximum speed limit for trucks on Route A is 100 km/h.\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\n## The company must ensure that at least 20 deliveries are made on Route A.\nmodel.addCons(Truck1_RouteA + Truck2_RouteA >= 20)\n## The average speed of trucks on Route A should not exceed the optimal speed for fuel efficiency, which is 80 km/h.\nmodel.addCons((Speed1 * Truck1_RouteA + Speed2 * Truck2_RouteA) / (Truck1_RouteA + Truck2_RouteA) <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Truck 1 on Route A: \", model.getVal(Truck1_RouteA))\n    print(\"Number of Truck 2 on Route A: \", model.getVal(Truck2_RouteA))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of vehicles for transporting goods across different regions. The company has identified three types of vehicles (Truck, Van, and Sedan) each suitable for different types of cargo and distances. The company needs to determine the number of each type of vehicle to maximize efficiency and minimize operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"SedanCount\", \"range\": \"SedanCount >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a Truck is $300, for a Van is $200, and for a Sedan is $100. The efficiency of transport, measured in tons of goods transported per day, is 10 tons for a Truck, 5 tons for a Van, and 2 tons for a Sedan. The company wants to minimize the total operational cost while ensuring a minimum transport efficiency of 100 tons per day.\n// OperationalCost = 300 * TruckCount + 200 * VanCount + 100 * SedanCount\n// TransportEfficiency = 10 * TruckCount + 5 * VanCount + 2 * SedanCount\n// So, the objective function is: Minimize (OperationalCost) subject to TransportEfficiency >= 100\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operational costs.\n// 300 * TruckCount + 200 * VanCount + 100 * SedanCount <= 10000",
        "question": "A logistics company is planning its fleet of vehicles for transporting goods across different regions. The company has identified three types of vehicles (Truck, Van, and Sedan) each suitable for different types of cargo and distances. The company needs to determine the number of each type of vehicle to maximize efficiency and minimize operational costs. The operational cost per day and the transport efficiency for each type of vehicle are given in the following Table.\n\n| Vehicle | Operational Cost per Day | Transport Efficiency (tons/day) |\n|---------|--------------------------|---------------------------------|\n| Truck   | $300                     | 10                              |\n| Van     | $200                     | 5                               |\n| Sedan   | $100                     | 2                               |\n\nThe company has a budget of $10,000 per day for operational costs. The company wants to ensure a minimum transport efficiency of 100 tons per day. Please help the company to minimize the total operational cost while meeting the transport efficiency requirement.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0) # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0) # number of Vans\nSedanCount = model.addVar(vtype=\"INTEGER\", name=\"SedanCount\", lb=0) # number of Sedans\n\n# Define objective function\nOperationalCost = 300 * TruckCount + 200 * VanCount + 100 * SedanCount\nTransportEfficiency = 10 * TruckCount + 5 * VanCount + 2 * SedanCount\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n# The company has a budget of $10,000 per day for operational costs.\nmodel.addCons(300 * TruckCount + 200 * VanCount + 100 * SedanCount <= 10000)\n# Ensure a minimum transport efficiency of 100 tons per day.\nmodel.addCons(TransportEfficiency >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Sedans: \", model.getVal(SedanCount))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit.\n// {\"labor on production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each production line depends on the labor and machinery allocated. The profit function is nonlinear and is given by:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\nThe company aims to maximize the total profit from all production lines.\n// Objective function: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total labor available is 100 units.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe total machinery available is 80 units.\n// M1 + M2 + M3 <= 80\n\n## Generate Constraint-3:\nEach production line can utilize a maximum of 40 units of labor.\n// L1 <= 40; L2 <= 40; L3 <= 40\n\n## Generate Constraint-4:\nEach production line can utilize a maximum of 30 units of machinery.\n// M1 <= 30; M2 <= 30; M3 <= 30",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit. The profit from each production line depends on the labor and machinery allocated, with the following profit functions:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\nThe company aims to maximize the total profit from all production lines.\nThe total labor available is 100 units, and the total machinery available is 80 units. Each production line can utilize a maximum of 40 units of labor and 30 units of machinery.\nPlease help the company determine the optimal allocation of labor (L1, L2, L3) and machinery (M1, M2, M3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=40)  # labor on production line 1\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=0, ub=40)  # labor on production line 2\nL3 = model.addVar(vtype=\"INTEGER\", name=\"L3\", lb=0, ub=40)  # labor on production line 3\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=30)  # machinery on production line 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0, ub=30)  # machinery on production line 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0, ub=30)  # machinery on production line 3\n\n# Define objective function\n# The profit function is nonlinear, so we need to approximate it using additional variables and constraints\nP1 = model.addVar(name=\"P1\")  # profit from production line 1\nP2 = model.addVar(name=\"P2\")  # profit from production line 2\nP3 = model.addVar(name=\"P3\")  # profit from production line 3\nobj = model.addVar(name=\"obj\")  # overall objective variable\nmodel.setObjective(obj, \"maximize\")\n\n# Constraints to link the profit variables with the labor and machinery variables\nmodel.addCons(P1 == 100 * L1**0.5 * M1**0.5)\nmodel.addCons(P2 == 150 * L2**0.6 * M2**0.4)\nmodel.addCons(P3 == 200 * L3**0.7 * M3**0.3)\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(L1 + L2 + L3 <= 100)  # total labor constraint\nmodel.addCons(M1 + M2 + M3 <= 80)  # total machinery constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor on Production Line 1: \", model.getVal(L1))\n    print(\"Labor on Production Line 2: \", model.getVal(L2))\n    print(\"Labor on Production Line 3: \", model.getVal(L3))\n    print(\"Machinery on Production Line 1: \", model.getVal(M1))\n    print(\"Machinery on Production Line 2: \", model.getVal(M2))\n    print(\"Machinery on Production Line 3: \", model.getVal(M3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * Q1 = 20 * Q1\n// Profit_P2 = (40 - 20) * Q2 = 20 * Q2\n// Profit_P3 = (50 - 30) * Q3 = 20 * Q3\n// The objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units.\n// Q1 <= 100\n// Q2 <= 150\n// Q3 <= 200\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\n// Q1 >= 50\n// Q2 >= 75\n\n## Generate Constraint-4:\nThe market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units.\n// If Q3 <= 100, Profit_P3 = 20 * Q3\n// If Q3 > 100, Profit_P3 = 20 * Q3 * (1 - 0.1 * (Q3 - 100) / 50)\n\n## Generate Constraint-5:\nThe company has a policy to ensure that the total production does not exceed 300 units across all products.\n// Q1 + Q2 + Q3 <= 300",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company has a limited budget of $5000 for production costs. The production capacity for each product is limited: the maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units. The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced. The market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units. The company also has a policy to ensure that the total production does not exceed 300 units across all products. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=75) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * Q1\nProfit_P2 = 20 * Q2\n## handle nonlinear profit for P3\nQ3_1 = model.addVar(vtype=\"INTEGER\", name=\"Q3_1\", lb=0, ub=100)\nQ3_2 = model.addVar(vtype=\"INTEGER\", name=\"Q3_2\", lb=0)\nQ3_b1 = model.addVar(vtype=\"B\", name=\"Q3_b1\")\nQ3_b2 = model.addVar(vtype=\"B\", name=\"Q3_b2\")\nmodel.addCons(Q3_b1 + Q3_b2 == 1)\nmodel.addCons(Q3 == Q3_1*Q3_b1 + Q3_2*Q3_b2)\nProfit_P3_1 = 20 * Q3_1 * Q3_b1\nProfit_P3_2 = 20 * Q3_2 * Q3_b2 * (1 - 0.1 * (Q3_2 - 100) / 50)\nProfit_P3 = Profit_P3_1 + Profit_P3_2\n## the objective function is: Maximize (20 * Q1 + 20 * Q2 + Profit_P3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000)\n## The production capacity for each product is limited.\nmodel.addCons(Q1 <= 100)\nmodel.addCons(Q2 <= 150)\nmodel.addCons(Q3 <= 200)\n## The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\nmodel.addCons(Q1 >= 50)\nmodel.addCons(Q2 >= 75)\n## The company has a policy to ensure that the total production does not exceed 300 units across all products.\nmodel.addCons(Q1 + Q2 + Q3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500\n\n## Generate Constraint-2:\nDue to storage limitations, the number of container C cannot exceed twice the number of container A.\n// ContainerC <= 2 * ContainerA\n\n## Generate Constraint-3:\nThe company has a contractual obligation to ship at least 50 containers of type D.\n// ContainerD >= 50\n\n## Generate Constraint-4:\nThe total weight of all containers must not exceed 100,000 kg. Container A weighs 100 kg, container B weighs 200 kg, container C weighs 300 kg, container D weighs 400 kg, and container E weighs 500 kg.\n// 100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000\n\n## Generate Constraint-5:\nThe company must ensure that at least one container of each type is shipped.\n// ContainerA >= 1; ContainerB >= 1; ContainerC >= 1; ContainerD >= 1; ContainerE >= 1",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping each container and their weights are given in the following Table.\n\n| Container | Shipping Cost per Unit | Weight per Unit |\n|-----------|------------------------|-----------------|\n| A         | $100                   | 100 kg          |\n| B         | $150                   | 200 kg          |\n| C         | $200                   | 300 kg          |\n| D         | $250                   | 400 kg          |\n| E         | $300                   | 500 kg          |\n\nThe company has a fixed cost of $5000 for the shipping operation. The company has a total shipping capacity of 500 containers. Due to storage limitations, the number of container C cannot exceed twice the number of container A. The company has a contractual obligation to ship at least 50 containers of type D. The total weight of all containers must not exceed 100,000 kg. The company must ensure that at least one container of each type is shipped.\n\nPlease help the company to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=1)  # number of container A\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=1)  # number of container B\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=1)  # number of container C\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=50)  # number of container D\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=1)  # number of container E\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n# Due to storage limitations, the number of container C cannot exceed twice the number of container A.\nmodel.addCons(ContainerC <= 2 * ContainerA)\n# The total weight of all containers must not exceed 100,000 kg.\nmodel.addCons(100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor.\nThe profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor.\nThe profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor.\nThe profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor.\nThe profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor.\nThe company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n// Total profit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a labor budget of $5,000.\n// 10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000",
        "question": "A manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands. The profit per unit, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost | Labor Cost |\n|---------|-----------------|-------------------|------------|\n| A       | $50             | $20               | $10        |\n| B       | $70             | $30               | $15        |\n| C       | $60             | $25               | $12        |\n| D       | $80             | $40               | $20        |\n| E       | $90             | $50               | $25        |\n\nThe company has a budget of $10,000 for raw materials and a labor budget of $5,000. The company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n\nPlease help the company determine the optimal quantity of each product to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of product E produced\n\n# Define objective function\n## The company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\nTotalProfit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n## The company has a labor budget of $5,000.\nmodel.addCons(10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1144,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for RouteX: CostX = (0.5 - 0.00005 * TechX) * TrucksX\n// Operational cost for RouteY: CostY = (0.6 - 0.00006 * TechY) * TrucksY\n// Operational cost for RouteZ: CostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\n// TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all routes must not exceed 200.\n// TrucksX + TrucksY + TrucksZ <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must operate at least 50 trucks on RouteX and 75 trucks on RouteY.\n// TrucksX >= 50; TrucksY >= 75",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck. The operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks. The company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks across all routes must not exceed 200. Due to contractual obligations, the company must operate at least 50 trucks on RouteX and 75 trucks on RouteY. Please help the company to minimize the total operational cost of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=50)  # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=75)  # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)    # number of trucks for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)     # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)     # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)     # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nCostX = (0.5 - 0.00005 * TechX) * TrucksX\nCostY = (0.6 - 0.00006 * TechY) * TrucksY\nCostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000)\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD_Units\", \"range\": \"DeviceD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: Cost_DeviceA = 20 * sqrt(DeviceA_Units), Cost_DeviceB = 30 * sqrt(DeviceB_Units), Cost_DeviceC = 40 * sqrt(DeviceC_Units), Cost_DeviceD = 50 * sqrt(DeviceD_Units). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 * sqrt(DeviceA_Units)) * DeviceA_Units\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 * sqrt(DeviceB_Units)) * DeviceB_Units\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 * sqrt(DeviceC_Units)) * DeviceC_Units\n// Total net profit for DeviceD: Profit_DeviceD = (110 - 50 * sqrt(DeviceD_Units)) * DeviceD_Units\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units.\n// DeviceC_Units >= 2 * DeviceA_Units\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, for DeviceC is $20 per unit, and for DeviceD is $25 per unit.\n// 10 * DeviceA_Units + 15 * DeviceB_Units + 20 * DeviceC_Units + 25 * DeviceD_Units <= 30,000\n\n## Generate Constraint-4:\nTo ensure product diversity and market coverage, the company wants to ensure that at least one unit of each device is produced.\n// DeviceA_Units >= 1; DeviceB_Units >= 1; DeviceC_Units >= 1; DeviceD_Units >= 1",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit and the cost of raw materials for each device are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit |\n|--------|-----------------|----------------------------|\n| DeviceA | $50             | $10                        |\n| DeviceB | $70             | $15                        |\n| DeviceC | $90             | $20                        |\n| DeviceD | $110            | $25                        |\n\nThe production cost for each device increases nonlinearly with the number of units produced due to economies of scale, as follows: Cost_DeviceA = 20 * sqrt(DeviceA_Units), Cost_DeviceB = 30 * sqrt(DeviceB_Units), Cost_DeviceC = 40 * sqrt(DeviceC_Units), Cost_DeviceD = 50 * sqrt(DeviceD_Units). The company aims to maximize the total net profit.\n\nThe company has a total production capacity of 1000 units per month. Due to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units. The company has a limited budget for raw materials, which is $30,000 per month. To ensure product diversity and market coverage, the company wants to ensure that at least one unit of each device is produced.\n\nPlease help the company to maximize the total net profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=1)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=1)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=1)  # number of units of DeviceC\nDeviceD_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Units\", lb=1)  # number of units of DeviceD\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - 20 * sqrt(DeviceA_Units)) * DeviceA_Units\n## Total net profit for DeviceB: Profit_DeviceB = (70 - 30 * sqrt(DeviceB_Units)) * DeviceB_Units\n## Total net profit for DeviceC: Profit_DeviceC = (90 - 40 * sqrt(DeviceC_Units)) * DeviceC_Units\n## Total net profit for DeviceD: Profit_DeviceD = (110 - 50 * sqrt(DeviceD_Units)) * DeviceD_Units\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000)\n## Due to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units.\nmodel.addCons(DeviceC_Units >= 2 * DeviceA_Units)\n## The company has a limited budget for raw materials, which is $30,000 per month.\nmodel.addCons(10 * DeviceA_Units + 15 * DeviceB_Units + 20 * DeviceC_Units + 25 * DeviceD_Units <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceD_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1555,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours of machine type 1 used\": \"HoursMachine1\", \"range\": \"HoursMachine1 >= 0\", \"type\": \"real\"}\n// {\"hours of machine type 2 used\": \"HoursMachine2\", \"range\": \"HoursMachine2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// Cost_Machine1 = HoursMachine1 * 20\n// Cost_Machine2 = HoursMachine2 * 30\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n## Generate Constraint-1:\nThe total production time available for machine type 1 is 8 hours per day.\n// UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1\n\n## Generate Constraint-2:\nThe total production time available for machine type 2 is 10 hours per day.\n// UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2\n\n## Generate Constraint-3:\nThe manufacturer has a daily budget of $200 for machine operation costs.\n// 20 * HoursMachine1 + 30 * HoursMachine2 <= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n\n| Product | Profit per Unit | Machine Type 1 Usage per Unit | Machine Type 2 Usage per Unit |\n|---------|-----------------|-------------------------------|-------------------------------|\n| A       | 50$             | 0.5 hours                     | 0.3 hours                     |\n| B       | 70$             | 0.4 hours                     | 0.5 hours                     |\n| C       | 60$             | 0.3 hours                     | 0.4 hours                     |\n\nThe total production time available for machine type 1 is 8 hours per day. The total production time available for machine type 2 is 10 hours per day. The manufacturer has a daily budget of $200 for machine operation costs.\n\nPlease help the manufacturer to maximize the total daily profit by determining the optimal number of units of each product and the hours each machine type should be utilized.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nHoursMachine1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine1\", lb=0) # hours of machine type 1 used\nHoursMachine2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine2\", lb=0) # hours of machine type 2 used\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nCost_Machine1 = HoursMachine1 * 20\nCost_Machine2 = HoursMachine2 * 30\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n# Add constraints\n# The total production time available for machine type 1 is 8 hours per day.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1)\n# The total production time available for machine type 2 is 10 hours per day.\nmodel.addCons(UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2)\n# The manufacturer has a daily budget of $200 for machine operation costs.\nmodel.addCons(20 * HoursMachine1 + 30 * HoursMachine2 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours of Machine Type 1 Used: \", model.getVal(HoursMachine1))\n    print(\"Hours of Machine Type 2 Used: \", model.getVal(HoursMachine2))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for ProductA\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductB\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductC\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $1000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20. The selling price per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\n// Total profit for ProductB: ProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\n// Total profit for ProductC: ProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 2000 units.\n// ProductA + ProductB + ProductC <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 500 units, and for ProductB is at least 300 units.\n// ProductA >= 500; ProductB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product. The initial energy cost per unit, selling price per unit, and the effect of energy efficiency investments on the energy cost are given in the following Table.\n\n| Product | Initial Energy Cost per Unit | Selling Price per Unit | Reduction in Energy Cost per $1000 Invested |\n|---------|------------------------------|------------------------|--------------------------------------------|\n| ProductA | $10                          | $50                    | $2                                         |\n| ProductB | $15                          | $60                    | $2                                         |\n| ProductC | $20                          | $70                    | $2                                         |\n\nThe company has a total budget of $50,000 for energy efficiency upgrades. The total production capacity for all products is limited to 2000 units. The market demand for ProductA is at least 500 units, and for ProductB is at least 300 units. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=500) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=300) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for ProductA\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for ProductB\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for ProductC\n\n# Define objective function\nProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\nProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\nProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $50,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000)\n# The total production capacity for all products is limited to 2000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Energy Efficiency for ProductA: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for ProductB: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for ProductC: \", model.getVal(EnergyEfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1469,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks for RouteA\": \"RouteATrucks\", \"range\": \"RouteATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"RouteBTrucks\", \"range\": \"RouteBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"RouteCTrucks\", \"range\": \"RouteCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"RouteDTrucks\", \"range\": \"RouteDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"RouteETrucks\", \"range\": \"RouteETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Consumption per Truck is 500 liters per month, and the Maintenance Cost per Truck is $1000 per month.\nFor RouteB, the Fuel Consumption per Truck is 600 liters per month, and the Maintenance Cost per Truck is $1200 per month.\nFor RouteC, the Fuel Consumption per Truck is 700 liters per month, and the Maintenance Cost per Truck is $1400 per month.\nFor RouteD, the Fuel Consumption per Truck is 800 liters per month, and the Maintenance Cost per Truck is $1600 per month.\nFor RouteE, the Fuel Consumption per Truck is 900 liters per month, and the Maintenance Cost per Truck is $1800 per month.\nThe company wants to minimize the total cost per truck, which includes both fuel and maintenance costs.\n// Total cost for RouteA: Cost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\n// Total cost for RouteB: Cost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\n// Total cost for RouteC: Cost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\n// Total cost for RouteD: Cost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\n// Total cost for RouteE: Cost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40\n\n## Generate Constraint-2:\nDue to route complexities, RouteA must have at least half as many trucks as RouteB.\n// RouteATrucks <= 0.5 * RouteBTrucks\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for maintenance costs for the month.\n// 1000 * RouteATrucks + 1200 * RouteBTrucks + 1400 * RouteCTrucks + 1600 * RouteDTrucks + 1800 * RouteETrucks <= 50,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs. The Fuel Consumption per Truck and the Maintenance Cost per Truck for each route are given in the following Table.\n\n| Route | Fuel Consumption per Truck (liters/month) | Maintenance Cost per Truck (USD/month) |\n|-------|-------------------------------------------|----------------------------------------|\n| A     | 500                                       | 1000                                   |\n| B     | 600                                       | 1200                                   |\n| C     | 700                                       | 1400                                   |\n| D     | 800                                       | 1600                                   |\n| E     | 900                                       | 1800                                   |\n\nThe company has a total of 40 trucks available for allocation. Due to route complexities, RouteA must have at least half as many trucks as RouteB. The company has a budget of $50,000 for maintenance costs for the month. Please help the company to minimize the total cost per truck, which includes both fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteATrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteATrucks\", lb=0)\nRouteBTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteBTrucks\", lb=0)\nRouteCTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteCTrucks\", lb=0)\nRouteDTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteDTrucks\", lb=0)\nRouteETrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteETrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPrice = 1.5  # Assuming fuel price per liter\nCost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\nCost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\nCost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\nCost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\nCost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\nTotalTrucks = RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40)\n## Due to route complexities, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(RouteATrucks <= 0.5 * RouteBTrucks)\n## The company has a budget of $50,000 for maintenance costs for the month.\nmodel.addCons(1000 * RouteATrucks + 1200 * RouteBTrucks + 1400 * RouteCTrucks + 1600 * RouteDTrucks + 1800 * RouteETrucks <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(RouteATrucks))\n    print(\"Number of Trucks for RouteB: \", model.getVal(RouteBTrucks))\n    print(\"Number of Trucks for RouteC: \", model.getVal(RouteCTrucks))\n    print(\"Number of Trucks for RouteD: \", model.getVal(RouteDTrucks))\n    print(\"Number of Trucks for RouteE: \", model.getVal(RouteETrucks))\n    print(\"Minimized Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1391,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of units produced per day. Additionally, the manufacturer must decide on the workforce size for each product line to meet production demands. The workforce size affects the production rate per worker.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for product A\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for product B\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for product C\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of labor per worker for product A is $1000, product B is $1200, and product C is $1100. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkforceA * 1000\n// Profit_B = UnitsB * 70 - WorkforceB * 1200\n// Profit_C = UnitsC * 60 - WorkforceC * 1100\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total workforce available across all product lines is 50 workers.\n// WorkforceA + WorkforceB + WorkforceC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of units produced per day, and the manufacturer must decide on the workforce size for each product line to meet production demands. The workforce size affects the production rate per worker.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of labor per worker for product A is $1000, product B is $1200, and product C is $1100. The manufacturer aims to maximize the total daily profit.\nThe total workforce available across all product lines is 50 workers.\nPlease help the manufacturer determine the optimal number of units and workforce size for each product to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for product A\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for product B\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkforceA * 1000\nProfit_B = UnitsB * 70 - WorkforceB * 1200\nProfit_C = UnitsC * 60 - WorkforceC * 1100\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total workforce available across all product lines is 50 workers.\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Workforce Size for Product A: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for Product B: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for Product C: \", model.getVal(WorkforceC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month. Additionally, the company must decide on the number of shifts to operate for each device's production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceD\": \"ShiftsD\", \"range\": \"ShiftsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company aims to maximize the total profit minus the total cost of shifts.\n// Total profit for DeviceA: ProfitA = 50 * UnitsA\n// Total profit for DeviceB: ProfitB = 70 * UnitsB\n// Total profit for DeviceC: ProfitC = 90 * UnitsC\n// Total profit for DeviceD: ProfitD = 110 * UnitsD\n// Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n// Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for shift operations.\n// 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 500 units of each device.\n// UnitsA >= 500; UnitsB >= 500; UnitsC >= 500; UnitsD >= 500\n\n## Generate Constraint-3:\nThe company can operate a maximum of 50 shifts in total.\n// ShiftsA + ShiftsB + ShiftsC + ShiftsD <= 50",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month and the number of shifts to operate for each device's production line.\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company has a total budget of $100,000 for shift operations. The company wants to produce at least 500 units of each device. The company can operate a maximum of 50 shifts in total.\nPlease help the company to maximize the total profit minus the total cost of shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=500) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=500) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=500) # number of units of DeviceD\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for DeviceA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for DeviceB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for DeviceC\nShiftsD = model.addVar(vtype=\"INTEGER\", name=\"ShiftsD\", lb=0) # number of shifts for DeviceD\n\n# Define objective function\nProfitA = 50 * UnitsA\nProfitB = 70 * UnitsB\nProfitC = 90 * UnitsC\nProfitD = 110 * UnitsD\nCostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n# Units produced per shift\nmodel.addCons(UnitsA == 10 * ShiftsA)\nmodel.addCons(UnitsB == 12 * ShiftsB)\nmodel.addCons(UnitsC == 15 * ShiftsC)\nmodel.addCons(UnitsD == 18 * ShiftsD)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n# Add constraints\n# The company has a total budget of $100,000 for shift operations.\nmodel.addCons(1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100000)\n# The company can operate a maximum of 50 shifts in total.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC + ShiftsD <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Units of DeviceD: \", model.getVal(UnitsD))\n    print(\"Number of Shifts for DeviceA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for DeviceB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for DeviceC: \", model.getVal(ShiftsC))\n    print(\"Number of Shifts for DeviceD: \", model.getVal(ShiftsD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance.\n// Distance_TruckA = 10 * TruckA\n// Distance_TruckB = 15 * TruckB\n// Distance_TruckC = 20 * TruckC\n// So, the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / (100 * TruckA + 150 * TruckB + 200 * TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for maintenance per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks in total.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the fleet is Truck A.\n// TruckA >= 0.1 * (TruckA + TruckB + TruckC)\n\n## Generate Constraint-4:\nThe company has a contract that requires at least 15 Truck Bs.\n// TruckB >= 15\n\n## Generate Constraint-5:\nThe total daily mileage must not exceed 10,000 km.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 10000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints. The fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance. The company has a total budget of $5000 for maintenance per day. The company has a limit of 50 trucks in total. The company must ensure that at least 10% of the fleet is Truck A. The company has a contract that requires at least 15 Truck Bs. The total daily mileage must not exceed 10,000 km. Please help the company determine the optimal number of each type of truck to meet these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance_TruckA = 10 * TruckA\nDistance_TruckB = 15 * TruckB\nDistance_TruckC = 20 * TruckC\nMaintenanceCost = 100 * TruckA + 150 * TruckB + 200 * TruckC\n## the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / MaintenanceCost\n## convert the division to multiplication\nmodel.addCons(obj * MaintenanceCost == Distance_TruckA + Distance_TruckB + Distance_TruckC)\n\n# Add constraints\n## The company has a total budget of $5000 for maintenance per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n## The company has a limit of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## The company must ensure that at least 10% of the fleet is Truck A.\nmodel.addCons(TruckA >= 0.1 * (TruckA + TruckB + TruckC))\n## The company has a contract that requires at least 15 Truck Bs.\nmodel.addCons(TruckB >= 15)\n## The total daily mileage must not exceed 10,000 km.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Distance per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacities, and market demand constraints.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnits\", \"range\": \"ProductBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnits\", \"range\": \"ProductCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company aims to maximize the total profit from all products.\n// Profit_ProductA = ProductAUnits * (50 - 30)\n// Profit_ProductB = ProductBUnits * (70 - 40)\n// Profit_ProductC = ProductCUnits * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductAUnits + ProductBUnits + ProductCUnits <= 1000\n\n## Generate Constraint-2:\nThe storage capacity for each product is limited. ProductA can store up to 400 units, ProductB up to 300 units, and ProductC up to 500 units.\n// ProductAUnits <= 400\n// ProductBUnits <= 300\n// ProductCUnits <= 500\n\n## Generate Constraint-3:\nMarket demand constraints require that the production of ProductB must be at least twice the production of ProductA.\n// ProductBUnits >= 2 * ProductAUnits\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which must not exceed $35,000 per month.\n// 30 * ProductAUnits + 40 * ProductBUnits + 35 * ProductCUnits <= 35,000\n\n## Generate Constraint-5:\nDue to strategic partnerships, the production of ProductC must be at least 10% of the combined production of ProductA and ProductB.\n// ProductCUnits >= 0.1 * (ProductAUnits + ProductBUnits)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacities, and market demand constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a total production capacity of 1000 units per month. The storage capacity for each product is limited: ProductA can store up to 400 units, ProductB up to 300 units, and ProductC up to 500 units. Market demand constraints require that the production of ProductB must be at least twice the production of ProductA. The company has a budget constraint for production costs, which must not exceed $35,000 per month. Due to strategic partnerships, the production of ProductC must be at least 10% of the combined production of ProductA and ProductB. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0)  # number of units of ProductA\nProductBUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnits\", lb=0)  # number of units of ProductB\nProductCUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnits\", lb=0)  # number of units of ProductC\n\n# Define objective function\nProfit_ProductA = ProductAUnits * (50 - 30)\nProfit_ProductB = ProductBUnits * (70 - 40)\nProfit_ProductC = ProductCUnits * (60 - 35)\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(ProductAUnits + ProductBUnits + ProductCUnits <= 1000)\n# The storage capacity for each product is limited.\nmodel.addCons(ProductAUnits <= 400)\nmodel.addCons(ProductBUnits <= 300)\nmodel.addCons(ProductCUnits <= 500)\n# Market demand constraints require that the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductBUnits >= 2 * ProductAUnits)\n# The company has a budget constraint for production costs, which must not exceed $35,000 per month.\nmodel.addCons(30 * ProductAUnits + 40 * ProductBUnits + 35 * ProductCUnits <= 35000)\n# Due to strategic partnerships, the production of ProductC must be at least 10% of the combined production of ProductA and ProductB.\nmodel.addCons(ProductCUnits >= 0.1 * (ProductAUnits + ProductBUnits))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnits))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnits))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Refrigerated trucks\": \"FuelEfficiencyRefrigerated\", \"range\": \"FuelEfficiencyRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Heavy trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Standard trucks\": \"FuelEfficiencyStandard\", \"range\": \"FuelEfficiencyStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Refrigerated trucks, an investment of $1000 reduces the cost per mile by $0.01. For Heavy trucks, an investment of $1000 reduces the cost per mile by $0.02. For Standard trucks, an investment of $1000 reduces the cost per mile by $0.015. The company aims to minimize the total annual operational cost of the fleet.\n// Operational cost for Refrigerated trucks: CostRefrigerated = (0.5 - 0.00001 * FuelEfficiencyRefrigerated) * RefrigeratedTrucks * 100000\n// Operational cost for Heavy trucks: CostHeavy = (0.7 - 0.00002 * FuelEfficiencyHeavy) * HeavyTrucks * 100000\n// Operational cost for Standard trucks: CostStandard = (0.4 - 0.000015 * FuelEfficiencyStandard) * StandardTrucks * 100000\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for truck purchases and fuel efficiency upgrades.\n// RefrigeratedTrucks * 100000 + HeavyTrucks * 120000 + StandardTrucks * 80000 + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 Refrigerated trucks and 15 Heavy trucks to meet contractual obligations.\n// RefrigeratedTrucks >= 10; HeavyTrucks >= 15",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The cost per mile for each type of truck decreases with investment in fuel efficiency, as shown in the following Table.\n\n| Type of Truck       | Initial Cost per Mile | Reduction per $1000 Investment |\n|---------------------|-----------------------|--------------------------------|\n| Refrigerated        | 0.5$                  | $0.01                          |\n| Heavy               | 0.7$                  | $0.02                          |\n| Standard            | 0.4$                  | $0.015                         |\n\nThe company has a budget of $500,000 for truck purchases and fuel efficiency upgrades. The total number of trucks cannot exceed 50. The company must have at least 10 Refrigerated trucks and 15 Heavy trucks to meet contractual obligations. \n\nPlease help the company to minimize the total annual operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=10)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=15)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nFuelEfficiencyRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRefrigerated\", lb=0)\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)\nFuelEfficiencyStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = (0.5 - 0.00001 * FuelEfficiencyRefrigerated) * RefrigeratedTrucks * 100000\nCostHeavy = (0.7 - 0.00002 * FuelEfficiencyHeavy) * HeavyTrucks * 100000\nCostStandard = (0.4 - 0.000015 * FuelEfficiencyStandard) * StandardTrucks * 100000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(RefrigeratedTrucks * 100000 + HeavyTrucks * 120000 + StandardTrucks * 80000 + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyStandard <= 500000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Fuel Efficiency for Refrigerated Trucks: \", model.getVal(FuelEfficiencyRefrigerated))\n    print(\"Investment in Fuel Efficiency for Heavy Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for Standard Trucks: \", model.getVal(FuelEfficiencyStandard))\n    print(\"Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is 20$, the transportation cost is 8$, and the storage cost is 3$ per unit.\nFor Product B, the selling price is 30$, the transportation cost is 12$, and the storage cost is 5$ per unit.\nFor Product C, the selling price is 40$, the transportation cost is 16$, and the storage cost is 7$ per unit.\nFor Product D, the selling price is 50$, the transportation cost is 20$, and the storage cost is 9$ per unit.\nThe company aims to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage).\n// Profit of A: Profit_A = (20 - 8 - 3) * A\n// Profit of B: Profit_B = (30 - 12 - 5) * B\n// Profit of C: Profit_C = (40 - 16 - 7) * C\n// Profit of D: Profit_D = (50 - 20 - 9) * D\n// Total cost: Cost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for transportation costs.\n// 8 * A + 12 * B + 16 * C + 20 * D <= 2000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints. The selling price, transportation cost, and storage cost for each product are given in the following Table.\n\n| Product | Selling Price | Transportation Cost | Storage Cost |\n|---------|---------------|---------------------|--------------|\n| A       | 20$           | 8$                  | 3$           |\n| B       | 30$           | 12$                 | 5$           |\n| C       | 40$           | 16$                 | 7$           |\n| D       | 50$           | 20$                 | 9$           |\n\nThe company has a budget of $2000 for transportation costs. The company aims to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage). Please help the company determine the optimal number of units to distribute for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 8 - 3) * A\nProfit_B = (30 - 12 - 5) * B\nProfit_C = (40 - 16 - 7) * C\nProfit_D = (50 - 20 - 9) * D\nCost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $2000 for transportation costs.\nmodel.addCons(8 * A + 12 * B + 16 * C + 20 * D <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited.\n// {\"production quantity for Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product A\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product B\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product C\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit for Product A is $30, Product B is $40, and Product C is $20. The company aims to maximize the total profit from the production of all three products.\n// Profit_ProductA = ProductA * (50 - 30)\n// Profit_ProductB = ProductB * (70 - 40)\n// Profit_ProductC = ProductC * (60 - 20)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\n// ProductA <= StorageA\n// ProductB <= StorageB\n// ProductC <= StorageC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited. The profit per unit and the cost of production per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $30                         |\n| B       | $70             | $40                         |\n| C       | $60             | $20                         |\n\nThe total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units. The company aims to maximize the total profit from the production of all three products. Please help the company determine the optimal production quantity for each product to maximize profit while ensuring that the production quantity does not exceed the respective storage capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # production quantity for Product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # production quantity for Product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # production quantity for Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 30)\nProfit_ProductB = ProductB * (70 - 40)\nProfit_ProductC = ProductC * (60 - 20)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nStorageA = 100\nStorageB = 150\nStorageC = 200\n\nmodel.addCons(ProductA <= StorageA)\nmodel.addCons(ProductB <= StorageB)\nmodel.addCons(ProductC <= StorageC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. \nAt warehouse 1, the cost per truck is $500 per day.\nAt warehouse 2, the cost per truck is $600 per day.\nAt warehouse 3, the cost per truck is $700 per day.\nAt warehouse 4, the cost per truck is $800 per day.\nAt warehouse 5, the cost per truck is $900 per day.\nThe company aims to minimize the total daily operational cost of all trucks.\n// Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. At warehouse 1, the cost per truck is $500 per day. At warehouse 2, the cost per truck is $600 per day. At warehouse 3, the cost per truck is $700 per day. At warehouse 4, the cost per truck is $800 per day. At warehouse 5, the cost per truck is $900 per day. The company aims to minimize the total daily operational cost of all trucks. The total number of trucks available is 100. Please help the company determine the optimal number of trucks to allocate to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nmodel.addCons(obj == 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 50 trucks in total.\n// Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company aims to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact also affects the company's taxes.\n\n| Cargo Type       | Profit per Truck | Operational Cost Function | Environmental Impact Function |\n|------------------|------------------|---------------------------|-------------------------------|\n| Food             | 5000$            | 0.01 * Food^2             | 0.005 * Food^2                |\n| Electronics      | 7000$            | 0.015 * Electronics^2     | 0.007 * Electronics^2         |\n| Textiles         | 4000$            | 0.008 * Textiles^2        | 0.004 * Textiles^2            |\n| Chemicals        | 6000$            | 0.02 * Chemicals^2        | 0.01 * Chemicals^2            |\n| Heavy Machinery  | 8000$            | 0.025 * HeavyMachinery^2  | 0.012 * HeavyMachinery^2      |\n\nThe company has a budget of $500,000 for purchasing trucks. Additionally, the company must have at least 50 trucks in total.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks for each type of cargo, considering the operational costs and environmental impact.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=0)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=0)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=0)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=0)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=0)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and cost calculations\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (total profit) - (total operational cost) - (total environmental impact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n## The company must have at least 50 trucks in total.\nmodel.addCons(Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1498,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n// Delivery time for route A: T_A = 1 / (0.8 * A)\n// Delivery time for route B: T_B = 1 / (0.9 * B)\n// Delivery time for route C: T_C = 1 / (1.1 * C)\n// Delivery time for route D: T_D = 1 / (1.2 * D)\n// Delivery time for route E: T_E = 1 / (1.0 * E)\n// So, the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n// Minimize (1 / (0.8 * A) + 1 / (0.9 * B) + 1 / (1.1 * C) + 1 / (1.2 * D) + 1 / (1.0 * E))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks at a time.\n// A <= 15; B <= 15; C <= 15; D <= 15; E <= 15\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-4:\nThe total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\n// 1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B))\n\n## Generate Constraint-5:\nThe total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\n// 1 / (1.0 * E) <= (1 / (0.8 * A)) + (1 / (0.9 * B)) + (1 / (1.1 * C)) + (1 / (1.2 * D))",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n\nThe company has a total of 50 trucks available for allocation. Each route can handle a maximum of 15 trucks at a time. The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels. The total delivery time for Route D should not exceed the combined delivery times of Routes A and B. The total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\n\nPlease help the company to minimize the total delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5, ub=15) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5, ub=15) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5, ub=15) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5, ub=15) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5, ub=15) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_A = 1 / (0.8 * A)\nT_B = 1 / (0.9 * B)\nT_C = 1 / (1.1 * C)\nT_D = 1 / (1.2 * D)\nT_E = 1 / (1.0 * E)\n## the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n## convert the division to multiplication\nmodel.addCons(obj == T_A + T_B + T_C + T_D + T_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 50)\n## Each route can handle a maximum of 15 trucks at a time.\n## The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n\n## The total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\nmodel.addCons(1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B)))\n## The total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\nmodel.addCons(1 / (1.0 * E) <= (1 / (0.8 * A)) + (1 / (0.9 * B)) + (1 / (1.1 * C)) + (1 / (1.2 * D)))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"maintenance cost per Truck\": \"TruckMaintenance\", \"range\": \"TruckMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Van\": \"VanMaintenance\", \"range\": \"VanMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Bike\": \"BikeMaintenance\", \"range\": \"BikeMaintenance >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Truck\": \"TruckCapacity\", \"range\": \"TruckCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Van\": \"VanCapacity\", \"range\": \"VanCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Bike\": \"BikeCapacity\", \"range\": \"BikeCapacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total delivery capacity while minimizing the total maintenance cost. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles.\n// TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n// TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n// So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance.\n// TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2 <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// TruckCount + VanCount + BikeCount <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the vehicles are Trucks.\n// TruckCount >= 0.2 * (TruckCount + VanCount + BikeCount)",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles. The company wants to maximize the total delivery capacity while minimizing the total maintenance cost.\n\n| Vehicle Type | Maintenance Cost per Vehicle | Delivery Capacity per Vehicle |\n|--------------|-------------------------------|--------------------------------|\n| Trucks       | TruckMaintenance^2            | TruckCapacity                   |\n| Vans         | VanMaintenance^2              | VanCapacity                     |\n| Bikes        | BikeMaintenance^2             | BikeCapacity                    |\n\nThe company has a budget of $10,000 for vehicle maintenance. The total number of vehicles cannot exceed 50. The company must ensure that at least 20% of the vehicles are Trucks.\n\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize the total delivery capacity while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n## TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n## So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\n## Convert the nonlinear maintenance cost to a linear form using additional variables\nTruckMaintenance = model.addVar(name=\"TruckMaintenance\")\nVanMaintenance = model.addVar(name=\"VanMaintenance\")\nBikeMaintenance = model.addVar(name=\"BikeMaintenance\")\nmodel.addCons(TruckMaintenance**2 == TruckCount)\nmodel.addCons(VanMaintenance**2 == VanCount)\nmodel.addCons(BikeMaintenance**2 == BikeCount)\nTotalMaintenanceCost = TruckMaintenance + VanMaintenance + BikeMaintenance\nTotalDeliveryCapacity = TruckCount + VanCount + BikeCount\nmodel.addCons(obj == TotalDeliveryCapacity - TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(TruckMaintenance + VanMaintenance + BikeMaintenance <= 10000)\n## The total number of vehicles cannot exceed 50.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 50)\n## The company must ensure that at least 20% of the vehicles are Trucks.\nmodel.addCons(TruckCount >= 0.2 * (TruckCount + VanCount + BikeCount))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1355,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of machines A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of machines B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of machines C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of machines D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for machine A is $500, for machine B is $700, for machine C is $900, and for machine D is $1100. The company aims to maximize the total profit from the production of these machines.\n// Total profit for machine A: Profit_A = 500 * A\n// Total profit for machine B: Profit_B = 700 * B\n// Total profit for machine C: Profit_C = 900 * C\n// Total profit for machine D: Profit_D = 1100 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 hours per month. The production time for machine A is 5 hours, for machine B is 7 hours, for machine C is 9 hours, and for machine D is 11 hours.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 500",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for machine A is $500, for machine B is $700, for machine C is $900, and for machine D is $1100. The company aims to maximize the total profit from the production of these machines. The company has a total production capacity of 500 hours per month. The production time for machine A is 5 hours, for machine B is 7 hours, for machine C is 9 hours, and for machine D is 11 hours. Please help the company determine the optimal number of each machine type to produce to maximize profit while adhering to the production capacity constraint.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of machines A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of machines B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of machines C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of machines D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nProfit_D = 1100 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 500 hours per month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has a fixed cost of $100 per day and can carry 500 kg. \nEach Medium truck has a fixed cost of $150 per day and can carry 1000 kg. \nEach Large truck has a fixed cost of $200 per day and can carry 1500 kg. \nEach Extra-Large truck has a fixed cost of $250 per day and can carry 2000 kg. \nEach Specialized truck has a fixed cost of $300 per day and can carry 2500 kg. \nThe company needs to transport at least 10,000 kg of goods daily. The objective is to minimize the total daily cost of operating the trucks while meeting the required transport capacity.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp\n// Total capacity = 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp\n// So, the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n## Generate Constraint-1:\nThe total daily transport capacity must be at least 10,000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operating all trucks.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs. The fixed cost per day and the carrying capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fixed Cost per Day | Carrying Capacity |\n|------------------|--------------------|-------------------|\n| Small            | $100               | 500 kg            |\n| Medium           | $150               | 1000 kg           |\n| Large            | $200               | 1500 kg           |\n| Extra-Large      | $250               | 2000 kg           |\n| Specialized      | $300               | 2500 kg           |\n\nThe company needs to transport at least 10,000 kg of goods daily. The company has a budget constraint of $10,000 per day for operating all trucks. Please help the company to minimize the total daily cost of operating the trucks while meeting the required transport capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n# Add constraints\n## The total daily transport capacity must be at least 10,000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000)\n## The company has a budget constraint of $10,000 per day for operating all trucks.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialized trucks: \", model.getVal(Sp))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials, labor, and storage. The company also needs to decide on the number of shifts to operate in the factory to meet production demands.\n// {\"production quantity of product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of raw materials per unit for product A is $20, product B is $30, and product C is $25. The labor cost per shift is $1000. The storage cost per unit per day is $5 for all products. The company wants to maximize the total daily profit.\n// Profit_A = (50 - 20 - 5) * ProdA\n// Profit_B = (70 - 30 - 5) * ProdB\n// Profit_C = (60 - 25 - 5) * ProdC\n// Total_Labor_Cost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day for all products combined.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials per day.\n// 20 * ProdA + 30 * ProdB + 25 * ProdC <= 5000\n\n## Generate Constraint-3:\nThe total storage space available is limited to 800 units.\n// ProdA + ProdB + ProdC <= 800\n\n## Generate Constraint-4:\nDue to labor regulations, the number of shifts cannot exceed 3 per day.\n// NumShifts <= 3\n\n## Generate Constraint-5:\nThe company has a policy to produce at least 10 units of product A and 20 units of product B per day.\n// ProdA >= 10\n// ProdB >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product (ProdA for product A, ProdB for product B, and ProdC for product C) and the number of shifts to operate in the factory (NumShifts) to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of raw materials per unit for product A is $20, product B is $30, and product C is $25. The labor cost per shift is $1000, and the storage cost per unit per day is $5 for all products. The company wants to maximize the total daily profit.\n\nThe factory has a maximum capacity of 1000 units per day for all products combined. The company has a budget of $5000 for raw materials per day. The total storage space available is limited to 800 units. Due to labor regulations, the number of shifts cannot exceed 3 per day. The company has a policy to produce at least 10 units of product A and 20 units of product B per day.\n\nPlease help the company to maximize the total daily profit, which is defined as the sum of the profits from products A, B, and C minus the total labor cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=10) # production quantity of product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=20) # production quantity of product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_A = (50 - 20 - 5) * ProdA\nProfit_B = (70 - 30 - 5) * ProdB\nProfit_C = (60 - 25 - 5) * ProdC\nTotal_Labor_Cost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Total_Labor_Cost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day for all products combined.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n# The company has a budget of $5000 for raw materials per day.\nmodel.addCons(20 * ProdA + 30 * ProdB + 25 * ProdC <= 5000)\n# The total storage space available is limited to 800 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 800)\n# Due to labor regulations, the number of shifts cannot exceed 3 per day.\nmodel.addCons(NumShifts <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1222,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce, as well as the number of hours to operate each machine per day.\n// {\"number of MachineA\": \"MachineANum\", \"range\": \"MachineANum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBNum\", \"range\": \"MachineBNum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCNum\", \"range\": \"MachineCNum >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for MachineA per day\": \"MachineAHours\", \"range\": \"MachineAHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineB per day\": \"MachineBHours\", \"range\": \"MachineBHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineC per day\": \"MachineCHours\", \"range\": \"MachineCHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production rate of MachineA is 10 units per hour, MachineB is 15 units per hour, and MachineC is 20 units per hour. The company wants to maximize the total daily profit from all machines.\n// Profit_MachineA = MachineANum * MachineAHours * 10 * 500\n// Profit_MachineB = MachineBNum * MachineBHours * 15 * 700\n// Profit_MachineC = MachineCNum * MachineCHours * 20 * 900\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total of 24 hours available per day for all machines combined.\n// MachineAHours + MachineBHours + MachineCHours <= 24\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operational costs. The operational cost per hour for MachineA is $50, for MachineB is $70, and for MachineC is $90.\n// MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000\n\n## Generate Constraint-3:\nThe company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\n// MachineANum <= 5\n// MachineBNum <= 4\n// MachineCNum <= 3\n\n## Generate Constraint-4:\nDue to market demand, the production of MachineA must be at least twice the production of MachineB.\n// MachineAHours * MachineANum >= 2 * MachineBHours * MachineBNum",
        "question": "A manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce, as well as the number of hours to operate each machine per day. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production rate of MachineA is 10 units per hour, MachineB is 15 units per hour, and MachineC is 20 units per hour. The company wants to maximize the total daily profit from all machines.\n\nThe company has a total of 24 hours available per day for all machines combined. The company has a budget constraint of $10,000 per day for operational costs. The operational cost per hour for MachineA is $50, for MachineB is $70, and for MachineC is $90. The company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC. Due to market demand, the production of MachineA must be at least twice the production of MachineB.\n\nPlease help the company to maximize the total daily profit from all machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineANum = model.addVar(vtype=\"INTEGER\", name=\"MachineANum\", lb=0)  # number of MachineA\nMachineBNum = model.addVar(vtype=\"INTEGER\", name=\"MachineBNum\", lb=0)  # number of MachineB\nMachineCNum = model.addVar(vtype=\"INTEGER\", name=\"MachineCNum\", lb=0)  # number of MachineC\nMachineAHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAHours\", lb=0)  # hours of operation for MachineA per day\nMachineBHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBHours\", lb=0)  # hours of operation for MachineB per day\nMachineCHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCHours\", lb=0)  # hours of operation for MachineC per day\n\n# Define objective function\nProfit_MachineA = MachineANum * MachineAHours * 10 * 500\nProfit_MachineB = MachineBNum * MachineBHours * 15 * 700\nProfit_MachineC = MachineCNum * MachineCHours * 20 * 900\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total of 24 hours available per day for all machines combined.\nmodel.addCons(MachineAHours + MachineBHours + MachineCHours <= 24)\n# The company has a budget constraint of $10,000 per day for operational costs.\nmodel.addCons(MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000)\n# The company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\nmodel.addCons(MachineANum <= 5)\nmodel.addCons(MachineBNum <= 4)\nmodel.addCons(MachineCNum <= 3)\n# Due to market demand, the production of MachineA must be at least twice the production of MachineB.\nmodel.addCons(MachineAHours * MachineANum >= 2 * MachineBHours * MachineBNum)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineANum))\n    print(\"Number of MachineB: \", model.getVal(MachineBNum))\n    print(\"Number of MachineC: \", model.getVal(MachineCNum))\n    print(\"Hours of operation for MachineA per day: \", model.getVal(MachineAHours))\n    print(\"Hours of operation for MachineB per day: \", model.getVal(MachineBHours))\n    print(\"Hours of operation for MachineC per day: \", model.getVal(MachineCHours))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major regions (R1, R2, R3, R4, R5) where they need to optimize the number of trips for each region to maximize profit while minimizing fuel consumption and environmental impact.\n// {\"number of trips to region R1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor each trip to R1, the profit is $1000, the fuel consumption is 100 liters, and the CO2 emission is 250 kg.\nFor each trip to R2, the profit is $1200, the fuel consumption is 120 liters, and the CO2 emission is 300 kg.\nFor each trip to R3, the profit is $1500, the fuel consumption is 150 liters, and the CO2 emission is 375 kg.\nFor each trip to R4, the profit is $1800, the fuel consumption is 180 liters, and the CO2 emission is 450 kg.\nFor each trip to R5, the profit is $2000, the fuel consumption is 200 liters, and the CO2 emission is 500 kg.\nThe company wants to maximize the Profit-Emission ratio (the ratio of total profit to total CO2 emissions).\n// Total Profit = 1000 * R1 + 1200 * R2 + 1500 * R3 + 1800 * R4 + 2000 * R5\n// Total CO2 Emissions = 250 * R1 + 300 * R2 + 375 * R3 + 450 * R4 + 500 * R5\n// So, the objective function is: Maximize (Total Profit) / (Total CO2 Emissions)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10000 liters.\n// 100 * R1 + 120 * R2 + 150 * R3 + 180 * R4 + 200 * R5 <= 10000\n\n## Generate Constraint-2:\nThe company can only make a maximum of 50 trips in total across all regions.\n// R1 + R2 + R3 + R4 + R5 <= 50\n\n## Generate Constraint-3:\nThe company must make at least 5 trips to region R1.\n// R1 >= 5\n\n## Generate Constraint-4:\nThe company must not exceed 15 trips to region R5 due to local regulations.\n// R5 <= 15\n\n## Generate Constraint-5:\nThe company aims to balance the number of trips across regions, ensuring that the difference in trips between any two regions does not exceed 10.\n// |R1 - R2| <= 10\n// |R1 - R3| <= 10\n// |R1 - R4| <= 10\n// |R1 - R5| <= 10\n// |R2 - R3| <= 10\n// |R2 - R4| <= 10\n// |R2 - R5| <= 10\n// |R3 - R4| <= 10\n// |R3 - R5| <= 10\n// |R4 - R5| <= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across five major regions (R1, R2, R3, R4, R5). The company needs to optimize the number of trips for each region to maximize profit while minimizing fuel consumption and environmental impact.\nFor each trip to R1, the profit is $1000, the fuel consumption is 100 liters, and the CO2 emission is 250 kg.\nFor each trip to R2, the profit is $1200, the fuel consumption is 120 liters, and the CO2 emission is 300 kg.\nFor each trip to R3, the profit is $1500, the fuel consumption is 150 liters, and the CO2 emission is 375 kg.\nFor each trip to R4, the profit is $1800, the fuel consumption is 180 liters, and the CO2 emission is 450 kg.\nFor each trip to R5, the profit is $2000, the fuel consumption is 200 liters, and the CO2 emission is 500 kg.\nThe company has a total fuel budget of 10000 liters and can only make a maximum of 50 trips in total across all regions. The company must make at least 5 trips to region R1 and must not exceed 15 trips to region R5 due to local regulations. The company aims to balance the number of trips across regions, ensuring that the difference in trips between any two regions does not exceed 10.\nPlease help the company to maximize the Profit-Emission ratio (the ratio of total profit to total CO2 emissions).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=5)  # number of trips to region R1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0)  # number of trips to region R2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0)  # number of trips to region R3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0)  # number of trips to region R4\nR5 = model.addVar(vtype=\"INTEGER\", name=\"R5\", lb=0, ub=15)  # number of trips to region R5\n\n# Define objective function\nTotal_Profit = 1000 * R1 + 1200 * R2 + 1500 * R3 + 1800 * R4 + 2000 * R5\nTotal_CO2_Emissions = 250 * R1 + 300 * R2 + 375 * R3 + 450 * R4 + 500 * R5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Total Profit) / (Total CO2 Emissions)\n# convert the division to multiplication\nmodel.addCons(obj * Total_CO2_Emissions == Total_Profit)\n\n# Add constraints\n# The company has a total fuel budget of 10000 liters.\nmodel.addCons(100 * R1 + 120 * R2 + 150 * R3 + 180 * R4 + 200 * R5 <= 10000)\n# The company can only make a maximum of 50 trips in total across all regions.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 50)\n# The company must make at least 5 trips to region R1.\nmodel.addCons(R1 >= 5)\n# The company must not exceed 15 trips to region R5 due to local regulations.\nmodel.addCons(R5 <= 15)\n\n# Constraints for balancing the number of trips across regions\nmodel.addCons(R1 - R2 <= 10)\nmodel.addCons(R2 - R1 <= 10)\nmodel.addCons(R1 - R3 <= 10)\nmodel.addCons(R3 - R1 <= 10)\nmodel.addCons(R1 - R4 <= 10)\nmodel.addCons(R4 - R1 <= 10)\nmodel.addCons(R1 - R5 <= 10)\nmodel.addCons(R5 - R1 <= 10)\nmodel.addCons(R2 - R3 <= 10)\nmodel.addCons(R3 - R2 <= 10)\nmodel.addCons(R2 - R4 <= 10)\nmodel.addCons(R4 - R2 <= 10)\nmodel.addCons(R2 - R5 <= 10)\nmodel.addCons(R5 - R2 <= 10)\nmodel.addCons(R3 - R4 <= 10)\nmodel.addCons(R4 - R3 <= 10)\nmodel.addCons(R3 - R5 <= 10)\nmodel.addCons(R5 - R3 <= 10)\nmodel.addCons(R4 - R5 <= 10)\nmodel.addCons(R5 - R4 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to region R1: \", model.getVal(R1))\n    print(\"Number of trips to region R2: \", model.getVal(R2))\n    print(\"Number of trips to region R3: \", model.getVal(R3))\n    print(\"Number of trips to region R4: \", model.getVal(R4))\n    print(\"Number of trips to region R5: \", model.getVal(R5))\n    print(\"Maximized Profit-Emission Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1309,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances.\nIn region 1, each truck consumes 5 liters per km.\nIn region 2, each truck consumes 7 liters per km.\nIn region 3, each truck consumes 9 liters per km.\nIn region 4, each truck consumes 11 liters per km.\nIn region 5, each truck consumes 13 liters per km.\nThe company aims to minimize the total fuel consumption while ensuring timely deliveries.\n// Fuel consumption in region 1: FC1 = 5 * T1\n// Fuel consumption in region 2: FC2 = 7 * T2\n// Fuel consumption in region 3: FC3 = 9 * T3\n// Fuel consumption in region 4: FC4 = 11 * T4\n// Fuel consumption in region 5: FC5 = 13 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs.\n// 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company must ensure that at least 10 trucks are allocated to each region.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10\n\n## Generate Constraint-3:\nThe total number of trucks available in the fleet is 60.\n// T1 + T2 + T3 + T4 + T5 <= 60\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks in region 4 does not exceed the combined number of trucks in regions 1 and 2.\n// T4 <= T1 + T2",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. Each truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances. In region 1, each truck consumes 5 liters per km. In region 2, each truck consumes 7 liters per km. In region 3, each truck consumes 9 liters per km. In region 4, each truck consumes 11 liters per km. In region 5, each truck consumes 13 liters per km. The company aims to minimize the total fuel consumption while ensuring timely deliveries. The company has a total budget of $50,000 for fuel costs. The company must ensure that at least 10 trucks are allocated to each region. The total number of trucks available in the fleet is 60. The company wants to ensure that the number of trucks in region 4 does not exceed the combined number of trucks in regions 1 and 2. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each region.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks in region 5\n\n# Define objective function\n## Fuel consumption in region 1: FC1 = 5 * T1\n## Fuel consumption in region 2: FC2 = 7 * T2\n## Fuel consumption in region 3: FC3 = 9 * T3\n## Fuel consumption in region 4: FC4 = 11 * T4\n## Fuel consumption in region 5: FC5 = 13 * T5\n## So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs.\nmodel.addCons(5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000)\n## The total number of trucks available in the fleet is 60.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 60)\n## The company wants to ensure that the number of trucks in region 4 does not exceed the combined number of trucks in regions 1 and 2.\nmodel.addCons(T4 <= T1 + T2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50\n\n## Generate Constraint-2:\nThe firm has a budget of $3000 for raw materials per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000\n\n## Generate Constraint-3:\nThe firm has a production capacity of 300 devices per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit. The firm has a total of 50 workers available. The firm has a budget of $3000 for raw materials per day. The firm has a production capacity of 300 devices per day. Please help the firm determine the optimal number of workers and production quantities for each device type to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)  # number of workers for smartphones production\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)  # number of workers for tablets production\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)  # number of workers for laptops production\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\n# So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n# The firm has a budget of $3000 for raw materials per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000)\n# The firm has a production capacity of 300 devices per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones Produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets Produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops Produced: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones Production: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets Production: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops Production: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They have identified three types of vehicles (Small, Medium, and Large) to purchase. The company needs to determine the number of each type of vehicle to buy and the number of drivers to assign to each type of vehicle.\n// {\"number of Small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Small vehicles\": \"SmallDrivers\", \"range\": \"SmallDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Medium vehicles\": \"MediumDrivers\", \"range\": \"MediumDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Large vehicles\": \"LargeDrivers\", \"range\": \"LargeDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for Small vehicles is $0.5, for Medium vehicles is $0.7, and for Large vehicles is $1.0. The revenue per kilometer for Small vehicles is $1.5, for Medium vehicles is $2.0, and for Large vehicles is $3.0. Each vehicle type can cover a different number of kilometers per day: Small vehicles cover 100 km, Medium vehicles cover 150 km, and Large vehicles cover 200 km. The company wants to maximize the net revenue per day.\n// Revenue_Small = 100 * SmallVehicles * SmallDrivers * (1.5 - 0.5)\n// Revenue_Medium = 150 * MediumVehicles * MediumDrivers * (2.0 - 0.7)\n// Revenue_Large = 200 * LargeVehicles * LargeDrivers * (3.0 - 1.0)\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing vehicles.\n// Cost_Small * SmallVehicles + Cost_Medium * MediumVehicles + Cost_Large * LargeVehicles <= 100000\n// (Cost_Small, Cost_Medium, Cost_Large are the respective costs of each vehicle type)\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallVehicles * SmallDrivers + MediumVehicles * MediumDrivers + LargeVehicles * LargeDrivers <= 50",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They have identified three types of vehicles (Small, Medium, and Large) to purchase. The company needs to determine the number of each type of vehicle to buy and the number of drivers to assign to each type of vehicle. The cost of fuel per kilometer for Small vehicles is $0.5, for Medium vehicles is $0.7, and for Large vehicles is $1.0. The revenue per kilometer for Small vehicles is $1.5, for Medium vehicles is $2.0, and for Large vehicles is $3.0. Each vehicle type can cover a different number of kilometers per day: Small vehicles cover 100 km, Medium vehicles cover 150 km, and Large vehicles cover 200 km. The company has a total budget of $100,000 for purchasing vehicles and a total of 50 drivers available. The company wants to maximize the net revenue per day. Please help the company determine the optimal number of each type of vehicle and drivers to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)\nSmallDrivers = model.addVar(vtype=\"INTEGER\", name=\"SmallDrivers\", lb=0)\nMediumDrivers = model.addVar(vtype=\"INTEGER\", name=\"MediumDrivers\", lb=0)\nLargeDrivers = model.addVar(vtype=\"INTEGER\", name=\"LargeDrivers\", lb=0)\n\n# Define objective function\nRevenue_Small = 100 * SmallVehicles * SmallDrivers * (1.5 - 0.5)\nRevenue_Medium = 150 * MediumVehicles * MediumDrivers * (2.0 - 0.7)\nRevenue_Large = 200 * LargeVehicles * LargeDrivers * (3.0 - 1.0)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large)\n\n# Add constraints\n# The company has a total budget of $100,000 for purchasing vehicles.\nCost_Small = 10000  # Example cost for Small vehicle\nCost_Medium = 15000 # Example cost for Medium vehicle\nCost_Large = 20000  # Example cost for Large vehicle\nmodel.addCons(Cost_Small * SmallVehicles + Cost_Medium * MediumVehicles + Cost_Large * LargeVehicles <= 100000)\n\n# The company has a total of 50 drivers available.\nmodel.addCons(SmallVehicles * SmallDrivers + MediumVehicles * MediumDrivers + LargeVehicles * LargeDrivers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Number of Drivers for Small Vehicles: \", model.getVal(SmallDrivers))\n    print(\"Number of Drivers for Medium Vehicles: \", model.getVal(MediumDrivers))\n    print(\"Number of Drivers for Large Vehicles: \", model.getVal(LargeDrivers))\n    print(\"Maximized Net Revenue per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The company needs to optimize its production to maximize profit while considering resource limitations and market demands.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The company aims to maximize the total profit from selling these components.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 100 units, B is at least 150 units, C is at least 200 units, D is at least 120 units, and E is at least 80 units.\n// A >= 100\n// B >= 150\n// C >= 200\n// D >= 120\n// E >= 80\n\n## Generate Constraint-3:\nThe company has a limited amount of raw material. The raw material required for producing one unit of A is 3 kg, B is 4 kg, C is 5 kg, D is 6 kg, and E is 7 kg. The total available raw material is 3000 kg.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 3000",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The company needs to optimize its production to maximize profit while considering resource limitations and market demands.\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50. The market demand for component A is at least 100 units, B is at least 150 units, C is at least 200 units, D is at least 120 units, and E is at least 80 units. The company has a limited amount of raw material. The raw material required for producing one unit of A is 3 kg, B is 4 kg, C is 5 kg, D is 6 kg, and E is 7 kg. The total available raw material is 3000 kg.\nPlease help the company to maximize the total profit from selling these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production cost for all components must not exceed $10,000.\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n## The market demand for component A is at least 100 units, B is at least 150 units, C is at least 200 units, D is at least 120 units, and E is at least 80 units.\nmodel.addCons(A >= 100)\nmodel.addCons(B >= 150)\nmodel.addCons(C >= 200)\nmodel.addCons(D >= 120)\nmodel.addCons(E >= 80)\n## The company has a limited amount of raw material.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company wants to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n// Total_Cost_T1 = 1.5 * T1\n// Total_Cost_T2 = 2 * T2\n// Total_Cost_T3 = 2.5 * T3\n// Total_Cost_T4 = 3 * T4\n// Total_Cost_T5 = 3.5 * T5\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations.\n// 1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe company must deliver at least 2000 tons of goods.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the fleet is composed of T1 trucks.\n// T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-5:\nThe fuel consumption for all trucks must not exceed 5000 liters per day.\n// 0.2 * T1 + 0.3 * T2 + 0.4 * T3 + 0.5 * T4 + 0.6 * T5 <= 5000",
        "question": "A logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities, fuel efficiencies, and costs per kilometer. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Cost per Kilometer | Capacity (tons) |\n|------------|------------------------------|--------------------|-----------------|\n| T1         | 0.2                          | $1.5               | 10              |\n| T2         | 0.3                          | $2                 | 20              |\n| T3         | 0.4                          | $2.5               | 30              |\n| T4         | 0.5                          | $3                 | 40              |\n| T5         | 0.6                          | $3.5               | 50              |\n\nThe company has a budget of $10,000 for truck operations. The total number of trucks cannot exceed 100. The company must deliver at least 2000 tons of goods. The company must ensure that at least 20% of the fleet is composed of T1 trucks. The fuel consumption for all trucks must not exceed 5000 liters per day.\n\nPlease help the company to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 1.5 * T1\nTotal_Cost_T2 = 2 * T2\nTotal_Cost_T3 = 2.5 * T3\nTotal_Cost_T4 = 3 * T4\nTotal_Cost_T5 = 3.5 * T5\nTotal_Capacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / Total_Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Total_Capacity == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations.\nmodel.addCons(1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The company must deliver at least 2000 tons of goods.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000)\n## The company must ensure that at least 20% of the fleet is composed of T1 trucks.\nmodel.addCons(T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n## The fuel consumption for all trucks must not exceed 5000 liters per day.\nmodel.addCons(0.2 * T1 + 0.3 * T2 + 0.4 * T3 + 0.5 * T4 + 0.6 * T5 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for each truck on Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n// Fuel consumption for Route1: Consumption1 = (Fuel1^2 / (Trucks1 * 100))\n// Fuel consumption for Route2: Consumption2 = (Fuel2^2 / (Trucks2 * 100))\n// Fuel consumption for Route3: Consumption3 = (Fuel3^2 / (Trucks3 * 100))\n// Fuel consumption for Route4: Consumption4 = (Fuel4^2 / (Trucks4 * 100))\n// Fuel consumption for Route5: Consumption5 = (Fuel5^2 / (Trucks5 * 100))\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $100,000.\n// Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 200\n\n## Generate Constraint-3:\nDue to maintenance schedules, at least 20 trucks must be deployed on Route1 and at least 30 trucks on Route3.\n// Trucks1 >= 20; Trucks3 >= 30",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries. The company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n\nThe company has a total fuel budget of $100,000. The total number of trucks available is limited to 200. Due to maintenance schedules, at least 20 trucks must be deployed on Route1 and at least 30 trucks on Route3.\n\nPlease help the company to determine the optimal number of trucks and fuel allocation for each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=30)  # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks on Route5\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel allocation for each truck on Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel allocation for each truck on Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel allocation for each truck on Route3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)  # fuel allocation for each truck on Route4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)  # fuel allocation for each truck on Route5\n\n# Define objective function\nConsumption1 = (Fuel1**2) / (Trucks1 * 100)\nConsumption2 = (Fuel2**2) / (Trucks2 * 100)\nConsumption3 = (Fuel3**2) / (Trucks3 * 100)\nConsumption4 = (Fuel4**2) / (Trucks4 * 100)\nConsumption5 = (Fuel5**2) / (Trucks5 * 100)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n# Add constraints\nmodel.addCons(Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Fuel Allocation for Route4: \", model.getVal(Fuel4))\n    print(\"Fuel Allocation for Route5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"E_A\", \"range\": \"E_A >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"E_B\", \"range\": \"E_B >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"E_C\", \"range\": \"E_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is initially $100, which decreases by $1 for every $1000 invested in efficiency enhancement. For ProductB, the initial cost is $150, and for ProductC, it is $200. The selling price per unit of ProductA is $150, ProductB is $200, and ProductC is $250. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 0.001 * E_A)) * Q_A\n// Profit_B = (200 - (150 - 0.001 * E_B)) * Q_B\n// Profit_C = (250 - (200 - 0.001 * E_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// E_A + E_B + E_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// Q_A + Q_B + Q_C <= 5000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 500 units, and for ProductB, it is at least 1000 units.\n// Q_A >= 500; Q_B >= 1000\n\n## Generate Constraint-4:\nThe company must invest at least $20,000 in efficiency enhancements for ProductC.\n// E_C >= 20000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit. The production cost per unit of ProductA is initially $100, which decreases by $1 for every $1000 invested in efficiency enhancement. For ProductB, the initial cost is $150, and for ProductC, it is $200. The selling price per unit of ProductA is $150, ProductB is $200, and ProductC is $250. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. The market demand for ProductA is at least 500 units, and for ProductB, it is at least 1000 units. The company must invest at least $20,000 in efficiency enhancements for ProductC. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=500) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=1000) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nE_A = model.addVar(vtype=\"CONTINUOUS\", name=\"E_A\", lb=0) # investment in efficiency for ProductA\nE_B = model.addVar(vtype=\"CONTINUOUS\", name=\"E_B\", lb=0) # investment in efficiency for ProductB\nE_C = model.addVar(vtype=\"CONTINUOUS\", name=\"E_C\", lb=20000) # investment in efficiency for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 0.001 * E_A)) * Q_A\nProfit_B = (200 - (150 - 0.001 * E_B)) * Q_B\nProfit_C = (250 - (200 - 0.001 * E_C)) * Q_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(E_A + E_B + E_C <= 100000)\nmodel.addCons(Q_A + Q_B + Q_C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(E_A))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(E_B))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(E_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available per week.\n// DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE <= 1500",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit. The profit per unit, labor hours required, and raw material units required for each device are given in the following Table.\n\n| Device | Profit per Unit | Labor Hours | Raw Material Units |\n|--------|-----------------|-------------|--------------------|\n| DeviceA | $100            | 2           | 1                  |\n| DeviceB | $150            | 3           | 2                  |\n| DeviceC | $200            | 4           | 3                  |\n| DeviceD | $120            | 2.5         | 1.5                |\n| DeviceE | $180            | 3.5         | 2.5                |\n\nThe company has a total of 1000 labor hours available per week. The company also has a total of 1500 units of raw material available per week. The company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency. Please help the company to maximize the total profit, considering the objective function which is the total profit minus a factor of the square of labor hours and the square of raw material usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Convert the nonlinear objective to a linear form by introducing new variables and constraints\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\nLabor_squared = model.addVar(name=\"Labor_squared\")\nRawMaterial_squared = model.addVar(name=\"RawMaterial_squared\")\nmodel.addCons(Labor_squared == Labor**2)\nmodel.addCons(RawMaterial_squared == RawMaterial**2)\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - 0.01 * (Labor_squared + RawMaterial_squared))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n## The company has a total of 1500 units of raw material available per week.\nmodel.addCons(RawMaterial <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\n// {\"number of trucks allocated to Region A\": \"Truck_A\", \"range\": \"Truck_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"Truck_B\", \"range\": \"Truck_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"Truck_C\", \"range\": \"Truck_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"Truck_D\", \"range\": \"Truck_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"Truck_E\", \"range\": \"Truck_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n// Total revenue: Revenue = $100 * Truck_A + $120 * Truck_B + $140 * Truck_C + $160 * Truck_D + $180 * Truck_E\n// Total operational cost: Cost = $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E\n// Total delivery time: Time = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n// So, the objective function is: Maximize (Revenue / (Cost + Time))\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for operational costs.\n// $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E <= $50000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 100 trucks in total.\n// Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each region.\n// Truck_A >= 10; Truck_B >= 10; Truck_C >= 10; Truck_D >= 10; Truck_E >= 10",
        "question": "A logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\nThe company has a total budget of $50,000 for operational costs. The company can allocate a maximum of 100 trucks in total. The company must allocate at least 10 trucks to each region.\nPlease help the company to maximize the efficiency ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_A = model.addVar(vtype=\"INTEGER\", name=\"Truck_A\", lb=10) # number of trucks allocated to Region A\nTruck_B = model.addVar(vtype=\"INTEGER\", name=\"Truck_B\", lb=10) # number of trucks allocated to Region B\nTruck_C = model.addVar(vtype=\"INTEGER\", name=\"Truck_C\", lb=10) # number of trucks allocated to Region C\nTruck_D = model.addVar(vtype=\"INTEGER\", name=\"Truck_D\", lb=10) # number of trucks allocated to Region D\nTruck_E = model.addVar(vtype=\"INTEGER\", name=\"Truck_E\", lb=10) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 100 * Truck_A + 120 * Truck_B + 140 * Truck_C + 160 * Truck_D + 180 * Truck_E\nCost = 500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E\nTime = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n## the objective function is: Maximize (Revenue / (Cost + Time))\n## convert the division to multiplication\nmodel.addCons(obj * (Cost + Time) == Revenue)\n\n# Add constraints\n## The company has a total budget of $50,000 for operational costs.\nmodel.addCons(500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E <= 50000)\n## The company can allocate a maximum of 100 trucks in total.\nmodel.addCons(Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(Truck_A))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(Truck_B))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(Truck_C))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(Truck_D))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(Truck_E))\n    print(\"Maximized Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1231,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must determine the number of trips each truck will make to each region. Additionally, the company is considering investing in fuel-efficient technologies for each region, which will affect the fuel consumption and operational costs.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Region1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in technology. For each $1000 invested, the fuel consumption decreases by 0.5 liters per trip. The initial fuel consumption per trip to Region1 is 10 liters, to Region2 is 12 liters, to Region3 is 15 liters, to Region4 is 18 liters, and to Region5 is 20 liters. The company aims to minimize the total fuel consumption across all regions.\n// Fuel_Region1 = (10 - 0.0005 * Tech1) * Trips1\n// Fuel_Region2 = (12 - 0.0005 * Tech2) * Trips2\n// Fuel_Region3 = (15 - 0.0005 * Tech3) * Trips3\n// Fuel_Region4 = (18 - 0.0005 * Tech4) * Trips4\n// Fuel_Region5 = (20 - 0.0005 * Tech5) * Trips5\n// So, the objective function is: Minimize (Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The operational cost per trip to Region1 is $500, to Region2 is $600, to Region3 is $750, to Region4 is $900, and to Region5 is $1000.\n// 500 * Trips1 + 600 * Trips2 + 750 * Trips3 + 900 * Trips4 + 1000 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can make in a month is limited to 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3.\n// Trips1 >= 50; Trips3 >= 70",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must determine the number of trips each truck will make to each region and the investment in fuel-efficient technologies for each region, which will affect the fuel consumption and operational costs. The initial fuel consumption per trip and the operational cost per trip for each region are given in the following Table.\n\n| Region | Fuel Consumption per Trip | Operational Cost per Trip |\n|--------|---------------------------|---------------------------|\n| Region1 | 10 liters                | $500                      |\n| Region2 | 12 liters                | $600                      |\n| Region3 | 15 liters                | $750                      |\n| Region4 | 18 liters                | $900                      |\n| Region5 | 20 liters                | $1000                     |\n\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The total number of trips the company can make in a month is limited to 500. Due to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3. The fuel efficiency of the trucks improves with the investment in technology, where for each $1000 invested, the fuel consumption decreases by 0.5 liters per trip.\n\nPlease help the company to minimize the total fuel consumption across all regions while adhering to the budget and contractual obligations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to Region5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Region1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Region2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Region3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for Region4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for Region5\n\n# Define objective function\nFuel_Region1 = (10 - 0.0005 * Tech1) * Trips1\nFuel_Region2 = (12 - 0.0005 * Tech2) * Trips2\nFuel_Region3 = (15 - 0.0005 * Tech3) * Trips3\nFuel_Region4 = (18 - 0.0005 * Tech4) * Trips4\nFuel_Region5 = (20 - 0.0005 * Tech5) * Trips5\n# So, the objective function is: Minimize (Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\n\n# Add constraints\n# The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(500 * Trips1 + 600 * Trips2 + 750 * Trips3 + 900 * Trips4 + 1000 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n# The total number of trips the company can make in a month is limited to 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n# Due to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3.\nmodel.addCons(Trips1 >= 50)\nmodel.addCons(Trips3 >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips to Region5: \", model.getVal(Trips5))\n    print(\"Investment in Tech for Region1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Region2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Region3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Region4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Region5: \", model.getVal(Tech5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1564,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Truck A is $20, for Truck B is $30, and for Truck C is $40. The company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The objective function is to minimize the total operational cost, which is given by:\n// Operational cost of A: Cost_A = 20 * A\n// Operational cost of B: Cost_B = 30 * B\n// Operational cost of C: Cost_C = 40 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\n// Capacity of A: 100 * A\n// Capacity of B: 200 * B\n// Capacity of C: 300 * C\n// Constraint: 100 * A + 200 * B + 300 * C >= 5000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for purchasing new trucks.\n// Cost of A: 1000 * A\n// Cost of B: 2000 * B\n// Cost of C: 3000 * C\n// Constraint: 1000 * A + 2000 * B + 3000 * C <= 10000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 20 trucks in total.\n// Constraint: A + B + C <= 20\n\n## Generate Constraint-4:\nThe number of Truck C cannot exceed the combined number of Trucks A and B.\n// Constraint: C <= A + B",
        "question": "A logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations.\nThe operational cost per kilometer for Truck A is $20, for Truck B is $30, and for Truck C is $40. The company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters. The company has a budget constraint of $10,000 for purchasing new trucks. The company can only operate a maximum of 20 trucks in total. The number of Truck C cannot exceed the combined number of Trucks A and B.\nPlease help the company to minimize the total operational cost, which is given by the sum of the operational costs of each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\nmodel.addCons(100 * A + 200 * B + 300 * C >= 5000)\n## The company has a budget constraint of $10,000 for purchasing new trucks.\nmodel.addCons(1000 * A + 2000 * B + 3000 * C <= 10000)\n## The company can only operate a maximum of 20 trucks in total.\nmodel.addCons(A + B + C <= 20)\n## The number of Truck C cannot exceed the combined number of Trucks A and B.\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location.\n// {\"number of solar panels at location 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n// Energy output from solar panels at location 1: E_S1 = S1 * (1 - 0.01 * S1)\n// Energy output from wind turbines at location 1: E_W1 = W1 * (1 - 0.02 * W1)\n// Energy output from solar panels at location 2: E_S2 = S2 * (1 - 0.01 * S2)\n// Energy output from wind turbines at location 2: E_W2 = W2 * (1 - 0.02 * W2)\n// Energy output from solar panels at location 3: E_S3 = S3 * (1 - 0.01 * S3)\n// Energy output from wind turbines at location 3: E_W3 = W3 * (1 - 0.02 * W3)\n// Energy output from solar panels at location 4: E_S4 = S4 * (1 - 0.01 * S4)\n// Energy output from wind turbines at location 4: E_W4 = W4 * (1 - 0.02 * W4)\n// Energy output from solar panels at location 5: E_S5 = S5 * (1 - 0.01 * S5)\n// Energy output from wind turbines at location 5: E_W5 = W5 * (1 - 0.02 * W5)\n// So, the objective function is: Maximize E_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000.\n// 1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines at each location should not exceed 100.\n// S1 + W1 <= 100; S2 + W2 <= 100; S3 + W3 <= 100; S4 + W4 <= 100; S5 + W5 <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location. The efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output. The company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000. The total number of solar panels and wind turbines at each location should not exceed 100. Please help the company to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at location 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines at location 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at location 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines at location 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at location 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines at location 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at location 4\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of wind turbines at location 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at location 5\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## Energy output from solar panels and wind turbines\nE_S1 = S1 * (1 - 0.01 * S1)\nE_W1 = W1 * (1 - 0.02 * W1)\nE_S2 = S2 * (1 - 0.01 * S2)\nE_W2 = W2 * (1 - 0.02 * W2)\nE_S3 = S3 * (1 - 0.01 * S3)\nE_W3 = W3 * (1 - 0.02 * W3)\nE_S4 = S4 * (1 - 0.01 * S4)\nE_W4 = W4 * (1 - 0.02 * W4)\nE_S5 = S5 * (1 - 0.01 * S5)\nE_W5 = W5 * (1 - 0.02 * W5)\n## Objective function\nE_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## Budget constraint\nmodel.addCons(1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000)\n## Maximum number of installations at each location\nmodel.addCons(S1 + W1 <= 100)\nmodel.addCons(S2 + W2 <= 100)\nmodel.addCons(S3 + W3 <= 100)\nmodel.addCons(S4 + W4 <= 100)\nmodel.addCons(S5 + W5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(W3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(S4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(W4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(S5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(W5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption rate of Truck1\": \"Truck1_FuelRate\", \"range\": \"Truck1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck2\": \"Truck2_FuelRate\", \"range\": \"Truck2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck3\": \"Truck3_FuelRate\", \"range\": \"Truck3_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van1\": \"Van1_FuelRate\", \"range\": \"Van1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van2\": \"Van2_FuelRate\", \"range\": \"Van2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"speed of Truck1\": \"Truck1_Speed\", \"range\": \"Truck1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck2\": \"Truck2_Speed\", \"range\": \"Truck2_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck3\": \"Truck3_Speed\", \"range\": \"Truck3_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van1\": \"Van1_Speed\", \"range\": \"Van1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van2\": \"Van2_Speed\", \"range\": \"Van2_Speed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type.\n// Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\n// So, the objective function is: Minimize Objective\n\n## Generate Constraint-1:\nThe total fuel consumption for all vehicles must not exceed 1000 liters.\n// Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000\n\n## Generate Constraint-2:\nThe total time taken for all deliveries must not exceed 50 hours.\n// (1 / Truck1_Speed) + (1 / Truck2_Speed) + (1 / Truck3_Speed) + (1 / Van1_Speed) + (1 / Van2_Speed) <= 50\n\n## Generate Constraint-3:\nThe speed of each vehicle must be at least 50 km/h.\n// Truck1_Speed >= 50\n// Truck2_Speed >= 50\n// Truck3_Speed >= 50\n// Van1_Speed >= 50\n// Van2_Speed >= 50\n\n## Generate Constraint-4:\nThe fuel consumption rate of each vehicle must not exceed 20 liters per hour.\n// Truck1_FuelRate <= 20\n// Truck2_FuelRate <= 20\n// Truck3_FuelRate <= 20\n// Van1_FuelRate <= 20\n// Van2_FuelRate <= 20",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed. The company wants to minimize the total time and fuel consumption for all deliveries by minimizing the product of fuel consumption rate and speed for each vehicle type. The total fuel consumption for all vehicles must not exceed 1000 liters, and the total time taken for all deliveries must not exceed 50 hours. The speed of each vehicle must be at least 50 km/h, and the fuel consumption rate of each vehicle must not exceed 20 liters per hour. Please help the company to determine the optimal fuel consumption rates and speeds for each vehicle type to meet these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_FuelRate\", lb=0)\nTruck2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_FuelRate\", lb=0)\nTruck3_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_FuelRate\", lb=0)\nVan1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_FuelRate\", lb=0)\nVan2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_FuelRate\", lb=0)\nTruck1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_Speed\", lb=50)\nTruck2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_Speed\", lb=50)\nTruck3_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_Speed\", lb=50)\nVan1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_Speed\", lb=50)\nVan2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_Speed\", lb=50)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\nmodel.addCons(obj == Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed)\n\n# Add constraints\n## The total fuel consumption for all vehicles must not exceed 1000 liters.\nmodel.addCons(Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000)\n## The total time taken for all deliveries must not exceed 50 hours.\nmodel.addCons((1 / Truck1_Speed) + (1 / Truck2_Speed) + (1 / Truck3_Speed) + (1 / Van1_Speed) + (1 / Van2_Speed) <= 50)\n## The speed of each vehicle must be at least 50 km/h.\nmodel.addCons(Truck1_Speed >= 50)\nmodel.addCons(Truck2_Speed >= 50)\nmodel.addCons(Truck3_Speed >= 50)\nmodel.addCons(Van1_Speed >= 50)\nmodel.addCons(Van2_Speed >= 50)\n## The fuel consumption rate of each vehicle must not exceed 20 liters per hour.\nmodel.addCons(Truck1_FuelRate <= 20)\nmodel.addCons(Truck2_FuelRate <= 20)\nmodel.addCons(Truck3_FuelRate <= 20)\nmodel.addCons(Van1_FuelRate <= 20)\nmodel.addCons(Van2_FuelRate <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption Rate of Truck1: \", model.getVal(Truck1_FuelRate))\n    print(\"Fuel Consumption Rate of Truck2: \", model.getVal(Truck2_FuelRate))\n    print(\"Fuel Consumption Rate of Truck3: \", model.getVal(Truck3_FuelRate))\n    print(\"Fuel Consumption Rate of Van1: \", model.getVal(Van1_FuelRate))\n    print(\"Fuel Consumption Rate of Van2: \", model.getVal(Van2_FuelRate))\n    print(\"Speed of Truck1: \", model.getVal(Truck1_Speed))\n    print(\"Speed of Truck2: \", model.getVal(Truck2_Speed))\n    print(\"Speed of Truck3: \", model.getVal(Truck3_Speed))\n    print(\"Speed of Van1: \", model.getVal(Van1_Speed))\n    print(\"Speed of Van2: \", model.getVal(Van2_Speed))\n    print(\"Minimized Objective: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route selection for their deliveries. The company has five different routes available: Route1, Route2, Route3, Route4, and Route5. They need to determine the number of trips for each route and the amount of fuel to be used per trip.\n// {\"number of trips for Route1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel used per trip for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel used per trip for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel used per trip for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel used per trip for Route4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel used per trip for Route5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1. The fuel efficiency of each route varies nonlinearly with the amount of fuel used per trip. Specifically, the fuel efficiency decreases as more fuel is used, following a quadratic relationship. The company wants to minimize the total fuel cost across all routes.\n// Fuel_Cost1 = 1 * Trips1 * Fuel1\n// Fuel_Cost2 = 1 * Trips2 * Fuel2\n// Fuel_Cost3 = 1 * Trips3 * Fuel3\n// Fuel_Cost4 = 1 * Trips4 * Fuel4\n// Fuel_Cost5 = 1 * Trips5 * Fuel5\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n## Generate Constraint-1:\nThe total fuel available for all routes is limited to 5000 liters.\n// Fuel1 * Trips1 + Fuel2 * Trips2 + Fuel3 * Trips3 + Fuel4 * Trips4 + Fuel5 * Trips5 <= 5000\n\n## Generate Constraint-2:\nThe total number of trips across all routes must not exceed 1000.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 1000\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of trips for Route1 must be at least twice the number of trips for Route2.\n// Trips1 >= 2 * Trips2\n\n## Generate Constraint-4:\nThe fuel efficiency of each route is such that the fuel used per trip must be at least 10 liters and at most 50 liters.\n// Fuel1 >= 10; Fuel1 <= 50\n// Fuel2 >= 10; Fuel2 <= 50\n// Fuel3 >= 10; Fuel3 <= 50\n// Fuel4 >= 10; Fuel4 <= 50\n// Fuel5 >= 10; Fuel5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route selection for their deliveries. The company has five different routes available: Route1, Route2, Route3, Route4, and Route5. They need to determine the number of trips for each route and the amount of fuel to be used per trip. The fuel efficiency of each route varies nonlinearly with the amount of fuel used per trip, decreasing as more fuel is used, following a quadratic relationship. The company wants to minimize the total fuel cost across all routes.\n\nThe cost of fuel per liter is $1. The company has a total fuel limit of 5000 liters for all routes. The total number of trips across all routes must not exceed 1000. Due to maintenance schedules, the number of trips for Route1 must be at least twice the number of trips for Route2. The fuel used per trip for each route must be at least 10 liters and at most 50 liters.\n\nPlease help the company to determine the optimal number of trips and the amount of fuel to be used per trip for each route to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Route1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Route2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Route3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Route4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Route5\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=10, ub=50) # fuel used per trip for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=10, ub=50) # fuel used per trip for Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=10, ub=50) # fuel used per trip for Route3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=10, ub=50) # fuel used per trip for Route4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=10, ub=50) # fuel used per trip for Route5\n\n# Define objective function\nFuel_Cost1 = 1 * Trips1 * Fuel1\nFuel_Cost2 = 1 * Trips2 * Fuel2\nFuel_Cost3 = 1 * Trips3 * Fuel3\nFuel_Cost4 = 1 * Trips4 * Fuel4\nFuel_Cost5 = 1 * Trips5 * Fuel5\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n# Add constraints\n# The total fuel available for all routes is limited to 5000 liters.\nmodel.addCons(Fuel1 * Trips1 + Fuel2 * Trips2 + Fuel3 * Trips3 + Fuel4 * Trips4 + Fuel5 * Trips5 <= 5000)\n# The total number of trips across all routes must not exceed 1000.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 1000)\n# Due to maintenance schedules, the number of trips for Route1 must be at least twice the number of trips for Route2.\nmodel.addCons(Trips1 >= 2 * Trips2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Route1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Route2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Route3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Route4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Route5: \", model.getVal(Trips5))\n    print(\"Fuel Used per Trip for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Used per Trip for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Used per Trip for Route3: \", model.getVal(Fuel3))\n    print(\"Fuel Used per Trip for Route4: \", model.getVal(Fuel4))\n    print(\"Fuel Used per Trip for Route5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region4\": \"Efficiency4\", \"range\": \"Efficiency4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region5\": \"Efficiency5\", \"range\": \"Efficiency5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 20 trucks must be allocated to Region1 and at least 15 trucks to Region2.\n// Trucks1 >= 20; Trucks2 >= 15\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for each region must not exceed $20,000.\n// Efficiency1 <= 20000\n// Efficiency2 <= 20000\n// Efficiency3 <= 20000\n// Efficiency4 <= 20000\n// Efficiency5 <= 20000",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the investment in fuel efficiency for each region. The fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies, with an initial fuel cost per kilometer of $0.50 for each region. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Initial Fuel Cost per Kilometer | Fuel Efficiency Investment Impact |\n|--------|---------------------------------|-----------------------------------|\n| 1      | $0.50                           | 0.5% decrease per $1000 invested |\n| 2      | $0.50                           | 0.5% decrease per $1000 invested |\n| 3      | $0.50                           | 0.5% decrease per $1000 invested |\n| 4      | $0.50                           | 0.5% decrease per $1000 invested |\n| 5      | $0.50                           | 0.5% decrease per $1000 invested |\n\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 100. Due to contractual obligations, at least 20 trucks must be allocated to Region1 and at least 15 trucks to Region2. The investment in fuel efficiency for each region must not exceed $20,000.\n\nPlease help the company to determine the optimal number of trucks and the investment in fuel efficiency for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)    # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)    # number of trucks for Region5\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Region3\nEfficiency4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency4\", lb=0)  # investment in fuel efficiency for Region4\nEfficiency5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency5\", lb=0)  # investment in fuel efficiency for Region5\n\n# Define objective function\nCost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\nCost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\nCost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\nCost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\nCost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 15)\nmodel.addCons(Efficiency1 <= 20000)\nmodel.addCons(Efficiency2 <= 20000)\nmodel.addCons(Efficiency3 <= 20000)\nmodel.addCons(Efficiency4 <= 20000)\nmodel.addCons(Efficiency5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Investment in Fuel Efficiency for Region4: \", model.getVal(Efficiency4))\n    print(\"Investment in Fuel Efficiency for Region5: \", model.getVal(Efficiency5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1567,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The production cost and selling price per unit vary for each product. Additionally, the company has constraints on the total production capacity and the availability of raw materials.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"raw material usage for product A\": \"RawMaterialA\", \"range\": \"RawMaterialA >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product B\": \"RawMaterialB\", \"range\": \"RawMaterialB >= 0\", \"type\": \"real\"}\n// {\"raw material usage for product C\": \"RawMaterialC\", \"range\": \"RawMaterialC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $30, product B is $40, and product C is $35. The company aims to maximize its total profit.\n// Profit_A = ProductA * (50 - 30)\n// Profit_B = ProductB * (70 - 40)\n// Profit_C = ProductC * (60 - 35)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 2500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $30, product B is $40, and product C is $35. The company has a total production capacity of 1000 units per day and a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = ProductA * (50 - 30)\nProfit_B = ProductB * (70 - 40)\nProfit_C = ProductC * (60 - 35)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The company has a limited amount of raw materials. Each unit of product A requires 2 units of raw material, product B requires 3 units, and product C requires 2.5 units. The total raw material available per day is 2500 units.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 2500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles.\n// Annual operating cost for TruckA: CostA = 10000 - 0.2 * EfficiencyA\n// Annual operating cost for TruckB: CostB = 15000 - 0.3 * EfficiencyB\n// Annual operating cost for TruckC: CostC = 20000 - 0.4 * EfficiencyC\n// So, the objective function is: Minimize (CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 vehicles in total.\n// TruckA + TruckB + TruckC >= 50\n\n## Generate Constraint-3:\nDue to operational requirements, the company must have at least 20 TruckA and 15 TruckB.\n// TruckA >= 20; TruckB >= 15",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year and the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle. The operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles. The company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades. The company must purchase at least 50 vehicles in total. Due to operational requirements, the company must have at least 20 TruckA and 15 TruckB. Please help the company to determine the optimal number of each type of vehicle and the appropriate level of fuel efficiency upgrades to minimize the total annual operating cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # fuel efficiency upgrade for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # fuel efficiency upgrade for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # fuel efficiency upgrade for TruckC\n\n# Define objective function\nCostA = 10000 - 0.2 * EfficiencyA\nCostB = 15000 - 0.3 * EfficiencyB\nCostC = 20000 - 0.4 * EfficiencyC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000)\nmodel.addCons(TruckA + TruckB + TruckC >= 50)\nmodel.addCons(TruckA >= 20)\nmodel.addCons(TruckB >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Efficiency Upgrade for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Efficiency Upgrade for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Efficiency Upgrade for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation. Each type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The total capacity of all trucks must meet or exceed the required 1000 tons. The company has a budget to purchase at most 50 trucks in total. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\nFuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n## So, the objective function is: Minimize Fuel\nmodel.setObjective(Fuel, \"minimize\")\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) for their trucks. Each route has different fuel consumption rates, maintenance costs, and potential revenue.\n// {\"number of trips on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the fuel consumption per trip is 50 liters, the maintenance cost per trip is $100, and the revenue per trip is $500.\nFor Route B, the fuel consumption per trip is 60 liters, the maintenance cost per trip is $120, and the revenue per trip is $600.\nFor Route C, the fuel consumption per trip is 70 liters, the maintenance cost per trip is $140, and the revenue per trip is $700.\nFor Route D, the fuel consumption per trip is 80 liters, the maintenance cost per trip is $160, and the revenue per trip is $800.\nFor Route E, the fuel consumption per trip is 90 liters, the maintenance cost per trip is $180, and the revenue per trip is $900.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// NetProfit_A = (500 * RouteA - 100 * RouteA) / (50 * RouteA)\n// NetProfit_B = (600 * RouteB - 120 * RouteB) / (60 * RouteB)\n// NetProfit_C = (700 * RouteC - 140 * RouteC) / (70 * RouteC)\n// NetProfit_D = (800 * RouteD - 160 * RouteD) / (80 * RouteD)\n// NetProfit_E = (900 * RouteE - 180 * RouteE) / (90 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the quarter.\n// 50 * RouteA + 60 * RouteB + 70 * RouteC + 80 * RouteD + 90 * RouteE <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget of $20,000 for the quarter.\n// 100 * RouteA + 120 * RouteB + 140 * RouteC + 160 * RouteD + 180 * RouteE <= 20000\n\n## Generate Constraint-3:\nThe company has a limit of 500 trips across all routes for the quarter.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 500\n\n## Generate Constraint-4:\nThe company must make at least 50 trips on Route A due to contractual obligations.\n// RouteA >= 50\n\n## Generate Constraint-5:\nNo more than 20% of the total trips can be on Route E due to market saturation.\n// RouteE <= 0.2 * (RouteA + RouteB + RouteC + RouteD + RouteE)",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five routes (Route A, Route B, Route C, Route D, and Route E) for their trucks. Each route has different fuel consumption rates, maintenance costs, and potential revenue.\nFor Route A, the fuel consumption per trip is 50 liters, the maintenance cost per trip is $100, and the revenue per trip is $500.\nFor Route B, the fuel consumption per trip is 60 liters, the maintenance cost per trip is $120, and the revenue per trip is $600.\nFor Route C, the fuel consumption per trip is 70 liters, the maintenance cost per trip is $140, and the revenue per trip is $700.\nFor Route D, the fuel consumption per trip is 80 liters, the maintenance cost per trip is $160, and the revenue per trip is $800.\nFor Route E, the fuel consumption per trip is 90 liters, the maintenance cost per trip is $180, and the revenue per trip is $900.\nThe company has a total fuel budget of 10,000 liters for the quarter and a maintenance budget of $20,000 for the quarter. The company has a limit of 500 trips across all routes for the quarter. The company must make at least 50 trips on Route A due to contractual obligations. No more than 20% of the total trips can be on Route E due to market saturation.\nPlease help the company to maximize the net profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=50)  # number of trips on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0)    # number of trips on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0)    # number of trips on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0)    # number of trips on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0)    # number of trips on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (500 * RouteA - 100 * RouteA) / (50 * RouteA)\nNetProfit_B = (600 * RouteB - 120 * RouteB) / (60 * RouteB)\nNetProfit_C = (700 * RouteC - 140 * RouteC) / (70 * RouteC)\nNetProfit_D = (800 * RouteD - 160 * RouteD) / (80 * RouteD)\nNetProfit_E = (900 * RouteE - 180 * RouteE) / (90 * RouteE)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * RouteA + 60 * RouteB + 70 * RouteC + 80 * RouteD + 90 * RouteE) == (500 * RouteA - 100 * RouteA) + (600 * RouteB - 120 * RouteB) + (700 * RouteC - 140 * RouteC) + (800 * RouteD - 160 * RouteD) + (900 * RouteE - 180 * RouteE))\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the quarter.\nmodel.addCons(50 * RouteA + 60 * RouteB + 70 * RouteC + 80 * RouteD + 90 * RouteE <= 10000)\n## The company has a maintenance budget of $20,000 for the quarter.\nmodel.addCons(100 * RouteA + 120 * RouteB + 140 * RouteC + 160 * RouteD + 180 * RouteE <= 20000)\n## The company has a limit of 500 trips across all routes for the quarter.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 500)\n## The company must make at least 50 trips on Route A due to contractual obligations.\nmodel.addCons(RouteA >= 50)\n## No more than 20% of the total trips can be on Route E due to market saturation.\nmodel.addCons(RouteE <= 0.2 * (RouteA + RouteB + RouteC + RouteD + RouteE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips on Route A: \", model.getVal(RouteA))\n    print(\"Number of trips on Route B: \", model.getVal(RouteB))\n    print(\"Number of trips on Route C: \", model.getVal(RouteC))\n    print(\"Number of trips on Route D: \", model.getVal(RouteD))\n    print(\"Number of trips on Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1338,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit.\n// Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n// Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n// Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n// Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n// Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// A >= 2 * B",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints. The profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit. The company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n## Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n## Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n## Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n## Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nProfit_A = 50 * A - (2000 + 10 * A**2)\nProfit_B = 70 * B - (3000 + 15 * B**2)\nProfit_C = 90 * C - (4000 + 20 * C**2)\nProfit_D = 110 * D - (5000 + 25 * D**2)\nProfit_E = 130 * E - (6000 + 30 * E**2)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(A >= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"production quantity for ProductA\": \"ProductAQuantity\", \"range\": \"ProductAQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQuantity\", \"range\": \"ProductBQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQuantity\", \"range\": \"ProductCQuantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The company aims to maximize the total profit from all products.\n// Profit_ProductA = ProductAQuantity * (50 - 20)\n// Profit_ProductB = ProductBQuantity * (70 - 30)\n// Profit_ProductC = ProductCQuantity * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The company has a total production capacity of 1000 units per day.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductAQuantity\", lb=0) # production quantity for ProductA\nProductBQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductBQuantity\", lb=0) # production quantity for ProductB\nProductCQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductCQuantity\", lb=0) # production quantity for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQuantity * (50 - 20)\nProfit_ProductB = ProductBQuantity * (70 - 30)\nProfit_ProductC = ProductCQuantity * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQuantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQuantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQuantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 603,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of delivery vehicles. They have identified three types of vehicles (Small, Medium, and Large) that can be used for different delivery routes. The company needs to decide how many vehicles of each type to purchase and how many routes each vehicle type will cover.\n// {\"number of Small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Small vehicles\": \"RoutesPerSmallVehicle\", \"range\": \"RoutesPerSmallVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Medium vehicles\": \"RoutesPerMediumVehicle\", \"range\": \"RoutesPerMediumVehicle >= 0\", \"type\": \"integer\"}\n// {\"number of routes covered by Large vehicles\": \"RoutesPerLargeVehicle\", \"range\": \"RoutesPerLargeVehicle >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Small vehicle is $20,000, a Medium vehicle is $30,000, and a Large vehicle is $40,000. The revenue generated per route covered by a Small vehicle is $500, by a Medium vehicle is $700, and by a Large vehicle is $1000. The company wants to maximize the total revenue minus the total cost of vehicles.\n// TotalCost = 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles\n// TotalRevenue = 500 * SmallVehicles * RoutesPerSmallVehicle + 700 * MediumVehicles * RoutesPerMediumVehicle + 1000 * LargeVehicles * RoutesPerLargeVehicle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing vehicles.\n// 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles <= 500000\n\n## Generate Constraint-2:\nEach vehicle type must cover at least 10 routes per day.\n// RoutesPerSmallVehicle >= 10\n// RoutesPerMediumVehicle >= 10\n// RoutesPerLargeVehicle >= 10\n\n## Generate Constraint-3:\nThe total number of routes that can be covered daily is limited to 500.\n// SmallVehicles * RoutesPerSmallVehicle + MediumVehicles * RoutesPerMediumVehicle + LargeVehicles * RoutesPerLargeVehicle <= 500\n\n## Generate Constraint-4:\nThe company must have at least 10 vehicles in total.\n// SmallVehicles + MediumVehicles + LargeVehicles >= 10",
        "question": "A logistics company is planning its fleet of delivery vehicles. They have identified three types of vehicles (Small, Medium, and Large) that can be used for different delivery routes. The company needs to decide how many vehicles of each type to purchase and how many routes each vehicle type will cover. The cost of a Small vehicle is $20,000, a Medium vehicle is $30,000, and a Large vehicle is $40,000. The revenue generated per route covered by a Small vehicle is $500, by a Medium vehicle is $700, and by a Large vehicle is $1000. The company has a budget of $500,000 for purchasing vehicles. Each vehicle type must cover at least 10 routes per day. The total number of routes that can be covered daily is limited to 500. The company must have at least 10 vehicles in total. Please help the company to maximize the total revenue minus the total cost of vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)\nRoutesPerSmallVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerSmallVehicle\", lb=10)\nRoutesPerMediumVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerMediumVehicle\", lb=10)\nRoutesPerLargeVehicle = model.addVar(vtype=\"INTEGER\", name=\"RoutesPerLargeVehicle\", lb=10)\n\n# Define objective function\nTotalCost = 20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles\nTotalRevenue = 500 * SmallVehicles * RoutesPerSmallVehicle + 700 * MediumVehicles * RoutesPerMediumVehicle + 1000 * LargeVehicles * RoutesPerLargeVehicle\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\nmodel.addCons(20000 * SmallVehicles + 30000 * MediumVehicles + 40000 * LargeVehicles <= 500000)\nmodel.addCons(SmallVehicles * RoutesPerSmallVehicle + MediumVehicles * RoutesPerMediumVehicle + LargeVehicles * RoutesPerLargeVehicle <= 500)\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Routes per Small Vehicle: \", model.getVal(RoutesPerSmallVehicle))\n    print(\"Routes per Medium Vehicle: \", model.getVal(RoutesPerMediumVehicle))\n    print(\"Routes per Large Vehicle: \", model.getVal(RoutesPerLargeVehicle))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate for each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the fuel efficiency of each truck type.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for RegionA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionD\": \"FuelEfficiencyD\", \"range\": \"FuelEfficiencyD > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionE\": \"FuelEfficiencyE\", \"range\": \"FuelEfficiencyE > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n// FuelCost_RegionA = (500 / FuelEfficiencyA) * TrucksA * 1.5\n// FuelCost_RegionB = (500 / FuelEfficiencyB) * TrucksB * 1.5\n// FuelCost_RegionC = (500 / FuelEfficiencyC) * TrucksC * 1.5\n// FuelCost_RegionD = (500 / FuelEfficiencyD) * TrucksD * 1.5\n// FuelCost_RegionE = (500 / FuelEfficiencyE) * TrucksE * 1.5\n// So, the objective function is: Minimize (FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nThe total daily distance traveled by all trucks must not exceed 25,000 km.\n// 500 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE) <= 25000\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB.\n// FuelEfficiencyA >= 1.1 * FuelEfficiencyB",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate for each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the fuel efficiency of each truck type. The cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n\n| Region       | Number of Trucks | Fuel Efficiency |\n|--------------|------------------|-----------------|\n| RegionA      | TrucksA          | FuelEfficiencyA |\n| RegionB      | TrucksB          | FuelEfficiencyB |\n| RegionC      | TrucksC          | FuelEfficiencyC |\n| RegionD      | TrucksD          | FuelEfficiencyD |\n| RegionE      | TrucksE          | FuelEfficiencyE |\n\nThe company has a total of 50 trucks available. The total daily distance traveled by all trucks must not exceed 25,000 km. The fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB.\n\nPlease help the company to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0) # fuel efficiency of trucks for RegionA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0) # fuel efficiency of trucks for RegionB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0) # fuel efficiency of trucks for RegionC\nFuelEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyD\", lb=0) # fuel efficiency of trucks for RegionD\nFuelEfficiencyE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyE\", lb=0) # fuel efficiency of trucks for RegionE\n\n# Define objective function\nFuelCost_RegionA = (500 / FuelEfficiencyA) * TrucksA * 1.5\nFuelCost_RegionB = (500 / FuelEfficiencyB) * TrucksB * 1.5\nFuelCost_RegionC = (500 / FuelEfficiencyC) * TrucksC * 1.5\nFuelCost_RegionD = (500 / FuelEfficiencyD) * TrucksD * 1.5\nFuelCost_RegionE = (500 / FuelEfficiencyE) * TrucksE * 1.5\n# So, the objective function is: Minimize (FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# The total daily distance traveled by all trucks must not exceed 25,000 km.\nmodel.addCons(500 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE) <= 25000)\n# The fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB.\nmodel.addCons(FuelEfficiencyA >= 1.1 * FuelEfficiencyB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Fuel Efficiency for RegionA: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency for RegionB: \", model.getVal(FuelEfficiencyB))\n    print(\"Fuel Efficiency for RegionC: \", model.getVal(FuelEfficiencyC))\n    print(\"Fuel Efficiency for RegionD: \", model.getVal(FuelEfficiencyD))\n    print(\"Fuel Efficiency for RegionE: \", model.getVal(FuelEfficiencyE))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs.\n// {\"speed of each truck\": \"Speed\", \"range\": \"5 <= Speed <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for RouteA\": \"GreenTechA\", \"range\": \"GreenTechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for RouteB\": \"GreenTechB\", \"range\": \"GreenTechB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are affected by the speed of the trucks and the investment in green technology. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for RouteA: FuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\n// Fuel cost for RouteB: FuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\n// Maintenance cost for RouteA: MaintCostA = (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA\n// Maintenance cost for RouteB: MaintCostB = (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and green technology investments.\n// (100 - Speed + 0.01 * GreenTechA) * TrucksA + (100 - Speed + 0.01 * GreenTechB) * TrucksB + (Speed^2 / 1000 - 0.02 * GreenTechA) * TrucksA + (Speed^2 / 1000 - 0.02 * GreenTechB) * TrucksB + GreenTechA + GreenTechB <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is limited to 50.\n// TrucksA + TrucksB <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The company also needs to decide on the investment in green technology to reduce emissions, which affects the fuel efficiency and maintenance costs. The fuel consumption per truck decreases non-linearly with the speed and the investment in green technology. The maintenance costs also decrease with higher speeds but increase with the investment in green technology due to the complexity of the systems. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The company has a total budget of $100,000 for operational costs and green technology investments. The total number of trucks available for deployment is limited to 50. Please help the company to determine the optimal speed for each truck, the number of trucks to deploy for each route, and the investment in green technology to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed = model.addVar(lb=5, ub=100, name=\"Speed\")  # speed of each truck\nTrucksA = model.addVar(vtype=\"INTEGER\", lb=0, name=\"TrucksA\")  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", lb=0, name=\"TrucksB\")  # number of trucks for RouteB\nGreenTechA = model.addVar(lb=0, name=\"GreenTechA\")  # investment in green technology for RouteA\nGreenTechB = model.addVar(lb=0, name=\"GreenTechB\")  # investment in green technology for RouteB\n\n# Define objective function\nFuelCostA = (100 - Speed + 0.01 * GreenTechA) * TrucksA\nFuelCostB = (100 - Speed + 0.01 * GreenTechB) * TrucksB\nMaintCostA = (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA\nMaintCostB = (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + MaintCostA + MaintCostB)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and green technology investments.\nmodel.addCons(\n    (100 - Speed + 0.01 * GreenTechA) * TrucksA +\n    (100 - Speed + 0.01 * GreenTechB) * TrucksB +\n    (Speed**2 / 1000 - 0.02 * GreenTechA) * TrucksA +\n    (Speed**2 / 1000 - 0.02 * GreenTechB) * TrucksB +\n    GreenTechA + GreenTechB <= 100000\n)\n\n# The total number of trucks available for deployment is limited to 50.\nmodel.addCons(TrucksA + TrucksB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Investment in green technology for RouteA: \", model.getVal(GreenTechA))\n    print(\"Investment in green technology for RouteB: \", model.getVal(GreenTechB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\n// ProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\n// ProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for efficiency investments.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 500 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of ProductA and 150 units of ProductB.\n// ProductAQty >= 100; ProductBQty >= 150\n\n## Generate Constraint-4:\nThe investment in efficiency for each product line cannot exceed the production cost saved by the investment.\n// EfficiencyA <= 5000; EfficiencyB <= 7000; EfficiencyC <= 9000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment. The production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total budget of $10,000 for efficiency investments. The total production capacity of the company is 500 units per month. The company must produce at least 100 units of ProductA and 150 units of ProductB. The investment in efficiency for each product line cannot exceed the production cost saved by the investment.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=100)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=150)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\nProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\nProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 10000)  # total budget for efficiency investments\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)  # total production capacity\nmodel.addCons(EfficiencyA <= 5000)  # investment limit for ProductA\nmodel.addCons(EfficiencyB <= 7000)  # investment limit for ProductB\nmodel.addCons(EfficiencyC <= 9000)  # investment limit for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and route planning. The company needs to decide the number of trips each truck will make on different routes, as well as the amount of fuel to be allocated to each truck.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Truck1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Truck2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Truck3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck is affected by the amount of fuel allocated and the number of trips. Truck1 has a base fuel efficiency of 5 km/liter, Truck2 of 6 km/liter, and Truck3 of 7 km/liter. The efficiency decreases nonlinearly with increased fuel allocation and trips. The company aims to minimize the total fuel consumption across all trucks.\n// Total fuel consumption for Truck1: Consumption1 = (Trips1 * DistancePerTrip) / (5 - 0.1 * Fuel1 + 0.005 * Fuel1^2)\n// Total fuel consumption for Truck2: Consumption2 = (Trips2 * DistancePerTrip) / (6 - 0.12 * Fuel2 + 0.006 * Fuel2^2)\n// Total fuel consumption for Truck3: Consumption3 = (Trips3 * DistancePerTrip) / (7 - 0.14 * Fuel3 + 0.007 * Fuel3^2)\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe total fuel budget for the fleet is $10,000.\n// Fuel1 + Fuel2 + Fuel3 <= 10000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and route planning. The company needs to decide the number of trips each truck will make on different routes, as well as the amount of fuel to be allocated to each truck. The fuel efficiency of each truck is affected by the amount of fuel allocated and the number of trips. Truck1 has a base fuel efficiency of 5 km/liter, Truck2 of 6 km/liter, and Truck3 of 7 km/liter. The efficiency decreases nonlinearly with increased fuel allocation and trips. The company aims to minimize the total fuel consumption across all trucks.\n\n| Truck | Base Fuel Efficiency |\n|-------|----------------------|\n| 1     | 5 km/liter           |\n| 2     | 6 km/liter           |\n| 3     | 7 km/liter           |\n\nThe total fuel budget for the fleet is $10,000. Please help the company to minimize the total fuel consumption across all trucks, considering the nonlinear decrease in fuel efficiency with increased fuel allocation and trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for Truck1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for Truck2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for Truck3\n\n# Define objective function\n# Total fuel consumption for Truck1: Consumption1 = (Trips1 * DistancePerTrip) / (5 - 0.1 * Fuel1 + 0.005 * Fuel1^2)\n# Total fuel consumption for Truck2: Consumption2 = (Trips2 * DistancePerTrip) / (6 - 0.12 * Fuel2 + 0.006 * Fuel2^2)\n# Total fuel consumption for Truck3: Consumption3 = (Trips3 * DistancePerTrip) / (7 - 0.14 * Fuel3 + 0.007 * Fuel3^2)\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nConsumption1 = model.addVar(name=\"Consumption1\")\nConsumption2 = model.addVar(name=\"Consumption2\")\nConsumption3 = model.addVar(name=\"Consumption3\")\nmodel.setObjective(Consumption1 + Consumption2 + Consumption3, \"minimize\")\n\n# Add constraints for objective function\nmodel.addCons(Consumption1 == (Trips1 * 1) / (5 - 0.1 * Fuel1 + 0.005 * Fuel1**2))\nmodel.addCons(Consumption2 == (Trips2 * 1) / (6 - 0.12 * Fuel2 + 0.006 * Fuel2**2))\nmodel.addCons(Consumption3 == (Trips3 * 1) / (7 - 0.14 * Fuel3 + 0.007 * Fuel3**2))\n\n# Add constraints\n# The total fuel budget for the fleet is $10,000.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Fuel Allocation for Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Truck2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Truck3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region1\": \"Storage1\", \"range\": \"Storage1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region2\": \"Storage2\", \"range\": \"Storage2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region3\": \"Storage3\", \"range\": \"Storage3 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region4\": \"SolarPanels4\", \"range\": \"SolarPanels4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region4\": \"WindTurbines4\", \"range\": \"WindTurbines4 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region4\": \"Storage4\", \"range\": \"Storage4 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region5\": \"SolarPanels5\", \"range\": \"SolarPanels5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region5\": \"WindTurbines5\", \"range\": \"WindTurbines5 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region5\": \"Storage5\", \"range\": \"Storage5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Total energy output from Region1: Output1 = (SolarPanels1 * (100 + 0.1 * Storage1^2)) + (WindTurbines1 * (200 + 0.2 * Storage1^3))\n// Total energy output from Region2: Output2 = (SolarPanels2 * (100 + 0.1 * Storage2^2)) + (WindTurbines2 * (200 + 0.2 * Storage2^3))\n// Total energy output from Region3: Output3 = (SolarPanels3 * (100 + 0.1 * Storage3^2)) + (WindTurbines3 * (200 + 0.2 * Storage3^3))\n// Total energy output from Region4: Output4 = (SolarPanels4 * (100 + 0.1 * Storage4^2)) + (WindTurbines4 * (200 + 0.2 * Storage4^3))\n// Total energy output from Region5: Output5 = (SolarPanels5 * (100 + 0.1 * Storage5^2)) + (WindTurbines5 * (200 + 0.2 * Storage5^3))\n// So, the objective function is: Maximize (Output1 + Output2 + Output3 + Output4 + Output5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all installations and storage investments.\n// SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all regions must not exceed 10,000 units.\n// SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10,000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1.\n// WindTurbines1 >= 2 * SolarPanels1",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste. The energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n\nThe company has a total budget of $1,000,000 for all installations and storage investments. The total number of solar panels and wind turbines across all regions must not exceed 10,000 units. Due to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1.\n\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nStorage1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nStorage2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nStorage3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage3\", lb=0)\nSolarPanels4 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels4\", lb=0)\nWindTurbines4 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines4\", lb=0)\nStorage4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage4\", lb=0)\nSolarPanels5 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels5\", lb=0)\nWindTurbines5 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines5\", lb=0)\nStorage5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage5\", lb=0)\n\n# Define objective function\nOutput1 = SolarPanels1 * (100 + 0.1 * Storage1**2) + WindTurbines1 * (200 + 0.2 * Storage1**3)\nOutput2 = SolarPanels2 * (100 + 0.1 * Storage2**2) + WindTurbines2 * (200 + 0.2 * Storage2**3)\nOutput3 = SolarPanels3 * (100 + 0.1 * Storage3**2) + WindTurbines3 * (200 + 0.2 * Storage3**3)\nOutput4 = SolarPanels4 * (100 + 0.1 * Storage4**2) + WindTurbines4 * (200 + 0.2 * Storage4**3)\nOutput5 = SolarPanels5 * (100 + 0.1 * Storage5**2) + WindTurbines5 * (200 + 0.2 * Storage5**3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output1 + Output2 + Output3 + Output4 + Output5)\n\n# Add constraints\nmodel.addCons(SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1000000)\nmodel.addCons(SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10000)\nmodel.addCons(WindTurbines1 >= 2 * SolarPanels1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Investment in Energy Storage in Region1: \", model.getVal(Storage1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Investment in Energy Storage in Region2: \", model.getVal(Storage2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in Energy Storage in Region3: \", model.getVal(Storage3))\n    print(\"Number of Solar Panels in Region4: \", model.getVal(SolarPanels4))\n    print(\"Number of Wind Turbines in Region4: \", model.getVal(WindTurbines4))\n    print(\"Investment in Energy Storage in Region4: \", model.getVal(Storage4))\n    print(\"Number of Solar Panels in Region5: \", model.getVal(SolarPanels5))\n    print(\"Number of Wind Turbines in Region5: \", model.getVal(WindTurbines5))\n    print(\"Investment in Energy Storage in Region5: \", model.getVal(Storage5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of DeviceC to fulfill a contract.\n// UnitsC >= 1,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount of R&D investment for each device to optimize its profit. The profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company has a total budget of $500,000 for R&D investments and a production capacity limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB, and the company must produce at least 1,000 units of DeviceC to fulfill a contract. The company aims to maximize the total profit from selling all devices. Please help the company determine the optimal number of units to produce for each device and the appropriate R&D investments.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RDA + RDB + RDC <= 500000)  # Total budget for R&D investments\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)  # Production capacity constraint\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Market demand constraint for DeviceA\nmodel.addCons(UnitsC >= 1000)  # Contract requirement for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n// Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n// Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n// Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n// Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n// Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n// So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trucks of each type are deployed.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 100 drivers available for the upcoming month.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month. The company wants to ensure that at least 5 trucks of each type are deployed. The company has a total of 100 drivers available for the upcoming month. The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\nPlease help the company to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trucks of each type are deployed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks E\n\n# Define objective function\n## Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n## Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n## Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n## Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n## Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n## So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10 * 5 * A + 15 * 7 * B + 20 * 9 * C + 25 * 11 * D + 30 * 13 * E)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing fuel for the upcoming month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50000)\n## The company has a total of 100 drivers available for the upcoming month.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Ton-Kilometers per Liter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region (North, South, East, West, and Central) to optimize their operations.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Net Profit = (200 * NorthTrucks + 220 * SouthTrucks + 230 * EastTrucks + 210 * WestTrucks + 190 * CentralTrucks) - (100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks)\n// So, the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 trucks are allocated to each region.\n// NorthTrucks >= 10; SouthTrucks >= 10; EastTrucks >= 10; WestTrucks >= 10; CentralTrucks >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\n// 100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions.\n// EastTrucks + WestTrucks <= NorthTrucks + SouthTrucks",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n\nThe company has a total of 50 trucks available for allocation. The company wants to ensure that at least 10 trucks are allocated to each region. The company has a budget constraint on the total operating cost, which should not exceed $5000 per day. The company also wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions.\n\nPlease help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 10 trucks are allocated to each region.\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=10) # number of trucks in North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=10) # number of trucks in South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=10) # number of trucks in East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=10) # number of trucks in West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=10) # number of trucks in Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\nmodel.addCons(obj == 100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n## The company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\nmodel.addCons(100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000)\n## The company wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions.\nmodel.addCons(EastTrucks + WestTrucks <= NorthTrucks + SouthTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"daily operating cost for small trucks\": \"SmallCost\", \"range\": \"SmallCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for medium trucks\": \"MediumCost\", \"range\": \"MediumCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for large trucks\": \"LargeCost\", \"range\": \"LargeCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units.\n// TotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\n// 1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 per day for operating costs.\n// SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000\n\n## Generate Constraint-3:\nThe company can only purchase up to 5 small trucks due to limited storage space.\n// SmallTrucks <= 5\n\n## Generate Constraint-4:\nThe company must have at least 2 medium trucks to handle specific routes.\n// MediumTrucks >= 2",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units. The company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The company has a budget of $5000 per day for operating costs. The company can only purchase up to 5 small trucks due to limited storage space. The company must have at least 2 medium trucks to handle specific routes. Please help the company to determine the optimal number of each type of truck to purchase and their respective daily operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nSmallCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallCost\", lb=0)  # daily operating cost for small trucks\nMediumCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumCost\", lb=0)  # daily operating cost for medium trucks\nLargeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeCost\", lb=0)  # daily operating cost for large trucks\n\n# Define objective function\nTotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# The total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\nmodel.addCons(1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000)\n# The company has a budget of $5000 per day for operating costs.\nmodel.addCons(SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost <= 5000)\n# The company can only purchase up to 5 small trucks due to limited storage space.\nmodel.addCons(SmallTrucks <= 5)\n# The company must have at least 2 medium trucks to handle specific routes.\nmodel.addCons(MediumTrucks >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Daily Operating Cost for Small Trucks: \", model.getVal(SmallCost))\n    print(\"Daily Operating Cost for Medium Trucks: \", model.getVal(MediumCost))\n    print(\"Daily Operating Cost for Large Trucks: \", model.getVal(LargeCost))\n    print(\"Minimized Total Daily Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects. The efficiency of wind turbines also decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage.\n// Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\n// Installation_cost = 1000 * S + 1500 * W + 2000 * E\n// Storage_cost = 50 * E^2\n// So, the objective function is: Maximize (Energy_output - Installation_cost - Storage_cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for installation and storage costs.\n// 1000 * S + 1500 * W + 2000 * E + 50 * E^2 <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 5000 square meters.\n// S + 2 * W <= 5000\n\n## Generate Constraint-3:\nThe company must ensure that at least 50 solar panels and 30 wind turbines are installed.\n// S >= 50; W >= 30\n\n## Generate Constraint-4:\nThe energy storage capacity must be sufficient to store at least 50% of the total energy output during peak generation times.\n// E >= 0.5 * (S * (1 - 0.01 * S^2) + W * (1 - 0.02 * W^2))",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation. The efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects, and the efficiency of wind turbines decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage.\n\n| Component       | Installation Cost | Area Required |\n|-----------------|-------------------|---------------|\n| Solar Panels (S) | 1000$ per unit    | 1 sq. meter   |\n| Wind Turbines (W)| 1500$ per unit    | 2 sq. meters  |\n| Energy Storage (E)| 2000$ per unit + 50$ per unit^2 | - |\n\nThe company has a budget of $100,000 for installation and storage costs. The total area available for installation is limited to 5000 square meters. The company must ensure that at least 50 solar panels and 30 wind turbines are installed. The energy storage capacity must be sufficient to store at least 50% of the total energy output during peak generation times.\n\nPlease help the company to maximize the total energy output minus the total cost of installation and storage, considering all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=30)  # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # amount of energy storage\n\n# Define objective function\n# Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\n# Installation_cost = 1000 * S + 1500 * W + 2000 * E\n# Storage_cost = 50 * E^2\n# Maximize (Energy_output - Installation_cost - Storage_cost)\nEnergy_output = S * (1 - 0.01 * S**2) + W * (1 - 0.02 * W**2)\nInstallation_cost = 1000 * S + 1500 * W + 2000 * E\nStorage_cost = 50 * E**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output - Installation_cost - Storage_cost)\n\n# Add constraints\n# The company has a budget of $100,000 for installation and storage costs.\nmodel.addCons(1000 * S + 1500 * W + 2000 * E + 50 * E**2 <= 100000)\n# The total area available for installation is limited to 5000 square meters.\nmodel.addCons(S + 2 * W <= 5000)\n# The energy storage capacity must be sufficient to store at least 50% of the total energy output during peak generation times.\nmodel.addCons(E >= 0.5 * (S * (1 - 0.01 * S**2) + W * (1 - 0.02 * W**2)))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Energy Output - Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1532,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. \nFor S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. \nFor S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60.\nFor S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70.\nThe manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_S1 = 100 * S1 - 40 * S1\n// Profit_S2 = 120 * S2 - 50 * S2\n// Profit_S3 = 140 * S3 - 60 * S3\n// Profit_S4 = 160 * S4 - 70 * S4\n// So, the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / (1 * S1 + 2 * S2 + 3 * S3 + 4 * S4)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production time of 200 hours.\n// 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce.\nFor S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. \nFor S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. \nFor S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60.\nFor S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70.\nThe manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer has a limited production time of 200 hours.\nPlease help the manufacturer to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # quantity of S3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # quantity of S4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S1 = (100 - 40) * S1\nProfit_S2 = (120 - 50) * S2\nProfit_S3 = (140 - 60) * S3\nProfit_S4 = (160 - 70) * S4\nProductionTime = 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4\n## the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4)\n\n# Add constraints\n## The manufacturer has a limited production time of 200 hours.\nmodel.addCons(1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Quantity of S4: \", model.getVal(S4))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for ProductA is $50 per unit, with a production cost of $30 per unit. For ProductB, the selling price is $70 per unit, with a production cost of $40 per unit. For ProductC, the selling price is $90 per unit, with a production cost of $50 per unit. The company wants to maximize the total profit from selling all products.\n// Total profit for ProductA: Profit_ProductA = (50 - 30) * ProductAQty\n// Total profit for ProductB: Profit_ProductB = (70 - 40) * ProductBQty\n// Total profit for ProductC: Profit_ProductC = (90 - 50) * ProductCQty\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited budget for production costs, which is $15,000.\n// 30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total production quantity must not exceed 500 units.\n// ProductAQty + ProductBQty + ProductCQty <= 500",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The production cost, selling price, and demand for each product vary. The details for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| ProductA | $50 per unit | $30 per unit |\n| ProductB | $70 per unit | $40 per unit |\n| ProductC | $90 per unit | $50 per unit |\n\nThe company has a limited budget for production costs, which is $15,000. Due to storage limitations, the total production quantity must not exceed 500 units. Please help the company to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 30) * ProductAQty\nProfit_ProductB = (70 - 40) * ProductBQty\nProfit_ProductC = (90 - 50) * ProductCQty\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited budget for production costs, which is $15,000.\nmodel.addCons(30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15000)\n# Due to storage limitations, the total production quantity must not exceed 500 units.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck. The cost per truck, revenue per trip, and fuel consumption per trip for each type of truck are given in the following Table.\n\n| Type            | Cost per Truck | Revenue per Trip | Fuel Consumption per Trip |\n|-----------------|----------------|------------------|---------------------------|\n| Refrigerated    | $100,000       | $2,000           | 100 liters                |\n| Heavy           | $150,000       | $3,000           | 150 liters                |\n| Standard        | $50,000        | $1,000           | 50 liters                 |\n\nThe company has a budget of $10 million for purchasing trucks. The company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n\nPlease help the company determine the optimal number of each type of truck and the corresponding number of drivers to maximize the Profit-to-Fuel ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported.\n// Revenue_A = 1000 * TrucksA * TripsA\n// Revenue_B = 1500 * TrucksB * TripsB\n// Revenue_C = 2000 * TrucksC * TripsC\n// Cost_A = 200 * TrucksA * TripsA\n// Cost_B = 300 * TrucksB * TripsB\n// Cost_C = 400 * TrucksC * TripsC\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total number of trips per day across all goods must not exceed 100.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $15000.\n// 200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000\n\n## Generate Constraint-4:\nThe total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 12",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints. The revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported. The company has a total of 50 trucks available. The total number of trips per day across all goods must not exceed 100. The company has a daily fuel budget of $15000. The total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour. Please help the company to maximize the net daily revenue from all goods transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Good A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Good B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Good C\n\n# Define objective function\nRevenue_A = 1000 * TrucksA * TripsA\nRevenue_B = 1500 * TrucksB * TripsB\nRevenue_C = 2000 * TrucksC * TripsC\nCost_A = 200 * TrucksA * TripsA\nCost_B = 300 * TrucksB * TripsB\nCost_C = 400 * TrucksC * TripsC\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The total number of trips per day across all goods must not exceed 100.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\n# The company has a daily fuel budget of $15000.\nmodel.addCons(200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000)\n# The total time for all trips must not exceed 12 hours per day, assuming each trip takes 1 hour.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Good A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Good B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Good C: \", model.getVal(TripsC))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each with varying efficiency and capacity. The decision variables are the number of hours each unit operates.\n// {\"hours unit 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours unit 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours unit 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n// {\"hours unit 4 operates\": \"H4\", \"range\": \"H4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from the production of components A, B, and C. The profit per unit of component A produced in unit 1 is $10, in unit 2 is $12, in unit 3 is $15, and in unit 4 is $18. For component B, the profits are $20, $22, $25, and $28 respectively. For component C, the profits are $30, $32, $35, and $40 respectively. The production rate (units per hour) for each component in each unit is different and is given as follows:\n- Unit 1: A = 5, B = 10, C = 15\n- Unit 2: A = 6, B = 12, C = 18\n- Unit 3: A = 7, B = 14, C = 21\n- Unit 4: A = 8, B = 16, C = 24\nThe objective is to maximize the total profit.\n// Profit from A = 10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4\n// Profit from B = 20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4\n// Profit from C = 30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4\n// Objective function: Maximize (10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4) + (20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4) + (30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4)\n\n## Generate Constraint-1:\nThe total operating hours for all units must not exceed 160 hours.\n// H1 + H2 + H3 + H4 <= 160\n\n## Generate Constraint-2:\nEach unit has a maximum capacity of 40 hours of operation.\n// H1 <= 40; H2 <= 40; H3 <= 40; H4 <= 40\n\n## Generate Constraint-3:\nThe demand for component A must be met, which is at least 1000 units.\n// 5 * H1 + 6 * H2 + 7 * H3 + 8 * H4 >= 1000\n\n## Generate Constraint-4:\nThe demand for component B must be met, which is at least 2000 units.\n// 10 * H1 + 12 * H2 + 14 * H3 + 16 * H4 >= 2000\n\n## Generate Constraint-5:\nThe demand for component C must be met, which is at least 3000 units.\n// 15 * H1 + 18 * H2 + 21 * H3 + 24 * H4 >= 3000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each with varying efficiency and capacity. The decision variables are the number of hours each unit operates. The profit per unit of component A produced in unit 1 is $10, in unit 2 is $12, in unit 3 is $15, and in unit 4 is $18. For component B, the profits are $20, $22, $25, and $28 respectively. For component C, the profits are $30, $32, $35, and $40 respectively. The production rate (units per hour) for each component in each unit is different and is given in the following Table.\n\n| Unit | Component A | Component B | Component C |\n|------|-------------|-------------|-------------|\n| 1    | 5 units/hr  | 10 units/hr | 15 units/hr |\n| 2    | 6 units/hr  | 12 units/hr | 18 units/hr |\n| 3    | 7 units/hr  | 14 units/hr | 21 units/hr |\n| 4    | 8 units/hr  | 16 units/hr | 24 units/hr |\n\nThe company aims to maximize its profit from the production of components A, B, and C. The total operating hours for all units must not exceed 160 hours. Each unit has a maximum capacity of 40 hours of operation. The demand for component A must be met, which is at least 1000 units. The demand for component B must be met, which is at least 2000 units. The demand for component C must be met, which is at least 3000 units.\n\nPlease help the company to determine the optimal number of hours each unit should operate to maximize its profit while meeting all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours unit 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours unit 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours unit 3 operates\nH4 = model.addVar(vtype=\"CONTINUOUS\", name=\"H4\", lb=0) # hours unit 4 operates\n\n# Define objective function\n# Profit from A, B, C\nProfit_A = 10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4\nProfit_B = 20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4\nProfit_C = 30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4\n\n# Objective function: Maximize total profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# Total operating hours for all units must not exceed 160 hours\nmodel.addCons(H1 + H2 + H3 + H4 <= 160)\n\n# Each unit has a maximum capacity of 40 hours of operation\nmodel.addCons(H1 <= 40)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 40)\nmodel.addCons(H4 <= 40)\n\n# Demand for component A must be met, which is at least 1000 units\nmodel.addCons(5 * H1 + 6 * H2 + 7 * H3 + 8 * H4 >= 1000)\n\n# Demand for component B must be met, which is at least 2000 units\nmodel.addCons(10 * H1 + 12 * H2 + 14 * H3 + 16 * H4 >= 2000)\n\n# Demand for component C must be met, which is at least 3000 units\nmodel.addCons(15 * H1 + 18 * H2 + 21 * H3 + 24 * H4 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Unit 1 Operates: \", model.getVal(H1))\n    print(\"Hours Unit 2 Operates: \", model.getVal(H2))\n    print(\"Hours Unit 3 Operates: \", model.getVal(H3))\n    print(\"Hours Unit 4 Operates: \", model.getVal(H4))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1501,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified range.\n// {\"dosage level of DrugA\": \"DA\", \"range\": \"0 <= DA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DB\", \"range\": \"0 <= DB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DC\", \"range\": \"0 <= DC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of each drug is modeled as a nonlinear function of the dosage level. The side effects are also modeled as a nonlinear function of the dosage level. The company aims to maximize the total therapeutic effect while minimizing the total side effects.\n// Therapeutic effect of DrugA: TE_A = 100 * (DA / (DA + 50))^2\n// Therapeutic effect of DrugB: TE_B = 150 * (DB / (DB + 75))^2\n// Therapeutic effect of DrugC: TE_C = 200 * (DC / (DC + 100))^2\n// Side effect of DrugA: SE_A = 50 * (DA / (DA + 25))^2\n// Side effect of DrugB: SE_B = 75 * (DB / (DB + 37.5))^2\n// Side effect of DrugC: SE_C = 100 * (DC / (DC + 50))^2\n// The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DA + DB + DC <= 300",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within specified ranges: 0 <= DA <= 100 for DrugA, 0 <= DB <= 150 for DrugB, and 0 <= DC <= 200 for DrugC.\nThe therapeutic effect of each drug is modeled as a nonlinear function of the dosage level, and the side effects are also modeled as a nonlinear function of the dosage level. Specifically, the therapeutic effect of DrugA is TE_A = 100 * (DA / (DA + 50))^2, of DrugB is TE_B = 150 * (DB / (DB + 75))^2, and of DrugC is TE_C = 200 * (DC / (DC + 100))^2. The side effects of DrugA are SE_A = 50 * (DA / (DA + 25))^2, of DrugB are SE_B = 75 * (DB / (DB + 37.5))^2, and of DrugC are SE_C = 100 * (DC / (DC + 50))^2.\nThe company aims to maximize the total therapeutic effect (TE_A + TE_B + TE_C) while minimizing the total side effects (SE_A + SE_B + SE_C). Additionally, the total dosage across all drugs must not exceed 300 units.\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDA = model.addVar(vtype=\"CONTINUOUS\", name=\"DA\", lb=0, ub=100) # dosage level of DrugA\nDB = model.addVar(vtype=\"CONTINUOUS\", name=\"DB\", lb=0, ub=150) # dosage level of DrugB\nDC = model.addVar(vtype=\"CONTINUOUS\", name=\"DC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\n## Therapeutic effect and side effect functions\nTE_A = 100 * (DA / (DA + 50))**2\nTE_B = 150 * (DB / (DB + 75))**2\nTE_C = 200 * (DC / (DC + 100))**2\nSE_A = 50 * (DA / (DA + 25))**2\nSE_B = 75 * (DB / (DB + 37.5))**2\nSE_C = 100 * (DC / (DC + 50))**2\n\n## The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n## Convert to a maximization problem by negating the side effects\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TE_A + TE_B + TE_C - (SE_A + SE_B + SE_C))\n\n# Add constraints\n## The total dosage across all drugs must not exceed 300 units.\nmodel.addCons(DA + DB + DC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage level of DrugA: \", model.getVal(DA))\n    print(\"Dosage level of DrugB: \", model.getVal(DB))\n    print(\"Dosage level of DrugC: \", model.getVal(DC))\n    print(\"Maximized Therapeutic Effect: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials.\n// {\"labor hours on line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours on line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours.\n// Profit from device 1 on line 1: P1_L1 = 100 * (5 * L1 + 10 * M1)\n// Profit from device 1 on line 2: P1_L2 = 100 * (7 * L2 + 12 * M2)\n// Profit from device 2 on line 1: P2_L1 = 150 * (8 * L1 + 15 * M1)\n// Profit from device 2 on line 2: P2_L2 = 150 * (10 * L2 + 18 * M2)\n// Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L1 + L2 <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 1500 hours.\n// M1 + M2 <= 1500\n\n## Generate Constraint-3:\nThe total raw materials available are 2000 units.\n// R1 + R2 <= 2000",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials. The plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours. The total labor hours available are 1000 hours. The total machine hours available are 1500 hours. The total raw materials available are 2000 units. Please help the plant to maximize its total profit from producing both types of electronic devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours on line 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # machine hours on line 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials on line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours on line 2\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # machine hours on line 2\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials on line 2\n\n# Define objective function\nP1_L1 = 100 * (5 * L1 + 10 * M1) # Profit from device 1 on line 1\nP1_L2 = 100 * (7 * L2 + 12 * M2) # Profit from device 1 on line 2\nP2_L1 = 150 * (8 * L1 + 15 * M1) # Profit from device 2 on line 1\nP2_L2 = 150 * (10 * L2 + 18 * M2) # Profit from device 2 on line 2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1_L1 + P1_L2 + P2_L1 + P2_L2) # Objective function\n\n# Add constraints\nmodel.addCons(L1 + L2 <= 1000) # Total labor hours available are 1000 hours\nmodel.addCons(M1 + M2 <= 1500) # Total machine hours available are 1500 hours\nmodel.addCons(R1 + R2 <= 2000) # Total raw materials available are 2000 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours on line 1: \", model.getVal(L1))\n    print(\"Machine hours on line 1: \", model.getVal(M1))\n    print(\"Raw materials on line 1: \", model.getVal(R1))\n    print(\"Labor hours on line 2: \", model.getVal(L2))\n    print(\"Machine hours on line 2: \", model.getVal(M2))\n    print(\"Raw materials on line 2: \", model.getVal(R2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n// LaborA = 2 * UnitsA\n// LaborB = 3 * UnitsB\n// LaborC = 4 * UnitsC\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// UnitsA >= 50\n// UnitsB >= 30\n\n## Generate Constraint-4:\nThe company has a storage capacity limit that allows for a maximum of 200 units in total across all devices.\n// UnitsA + UnitsB + UnitsC <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company has a total of 1000 labor hours available for the month. The production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit. Due to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB. The company also has a storage capacity limit that allows for a maximum of 200 units in total across all devices. Please help the company to maximize the total profit, considering both the revenue from sales and the labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)    # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0) # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0) # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0) # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\nmodel.addCons(LaborA == 2 * UnitsA)\nmodel.addCons(LaborB == 3 * UnitsB)\nmodel.addCons(LaborC == 4 * UnitsC)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor Hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor Hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000\n\n## Generate Constraint-2:\nThe total fuel allocation must not exceed 5000 liters.\n// FuelA + FuelB + FuelC <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\n// TruckA >= 10; TruckB >= 15\n\n## Generate Constraint-4:\nThe total distance covered by TruckC must be at least 5000 km.\n// (Initial_efficiency_C + 0.0006 * Software) * FuelC >= 5000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type improves with the investment in the routing software. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter.\n\nThe company has a budget of $100,000 for vehicle purchases and software investments. The total fuel allocation must not exceed 5000 liters. The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements. The total distance covered by TruckC must be at least 5000 km.\n\nPlease help the company to minimize the total fuel consumption while ensuring all delivery routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\nFuel_consumption_A = (model.addVar(name=\"Distance_A\") / (model.addVar(name=\"Initial_efficiency_A\") + 0.0005 * Software)) * FuelA\nFuel_consumption_B = (model.addVar(name=\"Distance_B\") / (model.addVar(name=\"Initial_efficiency_B\") + 0.0007 * Software)) * FuelB\nFuel_consumption_C = (model.addVar(name=\"Distance_C\") / (model.addVar(name=\"Initial_efficiency_C\") + 0.0006 * Software)) * FuelC\nmodel.addCons(obj == Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nmodel.addCons(TruckA * model.addVar(name=\"Cost_A\") + TruckB * model.addVar(name=\"Cost_B\") + TruckC * model.addVar(name=\"Cost_C\") + Software <= 100000)\n## The total fuel allocation must not exceed 5000 liters.\nmodel.addCons(FuelA + FuelB + FuelC <= 5000)\n## The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 15)\n## The total distance covered by TruckC must be at least 5000 km.\nmodel.addCons((model.addVar(name=\"Initial_efficiency_C\") + 0.0006 * Software) * FuelC >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe manufacturer aims to maximize the total daily profit. The total production capacity of the factory is limited to 100 units per day. Please help the manufacturer determine the optimal number of units of each product to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 729,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for each truck\": \"Upgrade\", \"range\": \"Upgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company aims to minimize the total operational cost of all trips.\n// Operational cost per trip to Region1: Cost1 = (10 - 0.001 * Upgrade) * Trips1\n// Operational cost per trip to Region2: Cost2 = (10 - 0.001 * Upgrade) * Trips2\n// Operational cost per trip to Region3: Cost3 = (10 - 0.001 * Upgrade) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\n// Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions: Region1, Region2, and Region3. The company needs to decide the number of trips each truck should make to these regions and whether to invest in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip. The initial fuel consumption is 10 liters per 100 km, and for each $1000 invested in upgrades, the fuel consumption decreases by 1 liter per 100 km for all regions. The operational cost per trip is directly proportional to the fuel consumption.\n\n| Aspect                | Details                          |\n|-----------------------|----------------------------------|\n| Fuel Consumption      | 10 liters per 100 km             |\n| Upgrade Effect        | -1 liter per 100 km per $1000    |\n| Operational Cost      | Proportional to fuel consumption  |\n\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs. The total number of trips across all regions must not exceed 500.\n\nPlease help the company to minimize the total operational cost of all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to Region3\nUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade\", lb=0) # investment in fuel-efficient upgrades\n\n# Define objective function\nCost1 = (10 - 0.001 * Upgrade) * Trips1\nCost2 = (10 - 0.001 * Upgrade) * Trips2\nCost3 = (10 - 0.001 * Upgrade) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\nmodel.addCons(Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Investment in fuel-efficient upgrades: \", model.getVal(Upgrade))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company wants to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 30 - 5) * DeviceAProduction\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 40 - 7) * DeviceBProduction\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 50 - 9) * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company wants to maximize the total net profit, which is the sum of the profit minus the production and storage costs. The company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceA must be at least twice the production of DeviceB. Please help the company to determine the optimal production quantities for DeviceA, DeviceB, and DeviceC to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # number of DeviceA produced\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # number of DeviceB produced\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # number of DeviceC produced\n\n# Define objective function\nProfit_DeviceA = (50 - 30 - 5) * DeviceAProduction\nProfit_DeviceB = (70 - 40 - 7) * DeviceBProduction\nProfit_DeviceC = (90 - 50 - 9) * DeviceCProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 1000)\n# Due to raw material availability, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceAProduction))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceBProduction))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceCProduction))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs. Additionally, the company needs to decide on the level of maintenance for each truck to ensure efficiency and reliability.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Region 1 trucks\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Region 2 trucks\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Region 3 trucks\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks are affected by the number of trucks and the level of maintenance. The fuel efficiency of each truck decreases nonlinearly with the increase in the number of trucks in a region. Higher maintenance levels improve fuel efficiency but also increase costs. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Total operational cost for Region 1: Cost1 = (100 + 0.1 * Trucks1^2) * Trucks1 + 5 * Maintenance1\n// Total operational cost for Region 2: Cost2 = (120 + 0.12 * Trucks2^2) * Trucks2 + 6 * Maintenance2\n// Total operational cost for Region 3: Cost3 = (150 + 0.15 * Trucks3^2) * Trucks3 + 7 * Maintenance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for truck operations and maintenance across all regions is $100,000.\n// (100 + 0.1 * Trucks1^2) * Trucks1 + 5 * Maintenance1 + (120 + 0.12 * Trucks2^2) * Trucks2 + 6 * Maintenance2 + (150 + 0.15 * Trucks3^2) * Trucks3 + 7 * Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation across all regions is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional demand, there must be at least 20 trucks in Region 1 and 30 trucks in Region 2.\n// Trucks1 >= 20; Trucks2 >= 30\n\n## Generate Constraint-4:\nThe maintenance cost for each region must not exceed $10,000.\n// 5 * Maintenance1 <= 10000; 6 * Maintenance2 <= 10000; 7 * Maintenance3 <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region 1, Region 2, and Region 3) and the level of maintenance for each truck to minimize fuel consumption and operational costs. The fuel efficiency of each truck decreases nonlinearly with the increase in the number of trucks in a region, and higher maintenance levels improve fuel efficiency but also increase costs. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n\nThe total budget for truck operations and maintenance across all regions is $100,000. The total number of trucks available for allocation across all regions is 100. Due to regional demand, there must be at least 20 trucks in Region 1 and 30 trucks in Region 2. The maintenance cost for each region must not exceed $10,000.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region 3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance level for Region 1 trucks\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance level for Region 2 trucks\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance level for Region 3 trucks\n\n# Define objective function\nCost1 = (100 + 0.1 * Trucks1**2) * Trucks1 + 5 * Maintenance1\nCost2 = (120 + 0.12 * Trucks2**2) * Trucks2 + 6 * Maintenance2\nCost3 = (150 + 0.15 * Trucks3**2) * Trucks3 + 7 * Maintenance3\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons((100 + 0.1 * Trucks1**2) * Trucks1 + 5 * Maintenance1 +\n              (120 + 0.12 * Trucks2**2) * Trucks2 + 6 * Maintenance2 +\n              (150 + 0.15 * Trucks3**2) * Trucks3 + 7 * Maintenance3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\nmodel.addCons(5 * Maintenance1 <= 10000)\nmodel.addCons(6 * Maintenance2 <= 10000)\nmodel.addCons(7 * Maintenance3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Maintenance Level for Region 1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Level for Region 2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Level for Region 3: \", model.getVal(Maintenance3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer aims to maximize the total profit while considering the efficiency of battery usage.\n// Profit_E1 = 3000 * E1 - 2000 * E1\n// Profit_E2 = 4000 * E2 - 2500 * E2\n// Profit_E3 = 5000 * E3 - 3000 * E3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (2 * E1 + 3 * E2 + 4 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited battery supply of 500 kWh.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a production budget of $1,000,000 for production costs.\n// 2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000",
        "question": "A manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit, production cost, and battery requirement for each EV type are given in the following Table.\n\n| EV Type | Profit per Unit | Production Cost | Battery Requirement |\n|---------|-----------------|-----------------|---------------------|\n| E1      | $3000           | $2000           | 2 kWh               |\n| E2      | $4000           | $2500           | 3 kWh               |\n| E3      | $5000           | $3000           | 4 kWh               |\n\nThe manufacturer has a limited battery supply of 500 kWh. The manufacturer has a production budget of $1,000,000 for production costs. The manufacturer aims to maximize the total profit while considering the efficiency of battery usage. Please help the manufacturer to maximize the rate at which it earns profits (which is defined as the sum of the profit per unit minus the production cost, divided by the sum of the battery requirements).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (3000 - 2000) * E1\nProfit_E2 = (4000 - 2500) * E2\nProfit_E3 = (5000 - 3000) * E3\nBatteryUsage = 2 * E1 + 3 * E2 + 4 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / BatteryUsage\n## convert the division to multiplication\nmodel.addCons(obj * BatteryUsage == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited battery supply of 500 kWh.\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 500)\n## The manufacturer has a production budget of $1,000,000 for production costs.\nmodel.addCons(2000 * E1 + 2500 * E2 + 3000 * E3 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location1, Location2, Location3, Location4, Location5) where these installations can be made.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local climate conditions. Similarly, the efficiency of wind turbines depends on wind patterns.\nFor Location1, the efficiency of solar panels is 15%, the cost per panel is $500, and the maintenance cost is $50 per panel annually.\nFor Location2, the efficiency is 20%, the cost is $600, and the maintenance cost is $60 per panel annually.\nFor Location3, the efficiency is 10%, the cost is $400, and the maintenance cost is $40 per panel annually.\nFor Location4, the efficiency of wind turbines is 25%, the cost per turbine is $1000, and the maintenance cost is $100 per turbine annually.\nFor Location5, the efficiency is 30%, the cost is $1200, and the maintenance cost is $120 per turbine annually.\nThe company wants to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n// Total energy generated: Energy = 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5\n// Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the initial investment.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000\n\n## Generate Constraint-2:\nThe company aims to generate at least 10,000 kWh of energy annually.\n// 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5 >= 10000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations: Location1, Location2, Location3, Location4, and Location5. The efficiency, cost per unit, and annual maintenance cost for each installation are given in the following Table.\n\n| Location  | Efficiency | Cost per Unit | Annual Maintenance Cost |\n|-----------|------------|---------------|-------------------------|\n| Location1 | 15%        | $500          | $50 per panel          |\n| Location2 | 20%        | $600          | $60 per panel          |\n| Location3 | 10%        | $400          | $40 per panel          |\n| Location4 | 25%        | $1000         | $100 per turbine       |\n| Location5 | 30%        | $1200         | $120 per turbine       |\n\nThe company has a budget of $50,000 for the initial investment. The company aims to generate at least 10,000 kWh of energy annually. Please help the company to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at Location4\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\nCost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the initial investment.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000)\n## The company aims to generate at least 10,000 kWh of energy annually.\nmodel.addCons(0.15 * 500 * Solar1 + 0.20 * 600 * Solar2 + 0.10 * 400 * Solar3 + 0.25 * 1000 * Wind4 + 0.30 * 1200 * Wind5 >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location4: \", model.getVal(Wind4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind5))\n    print(\"Minimized Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\n// ProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\n// ProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for efficiency investments.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 500 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of ProductA and 150 units of ProductB.\n// ProductAQty >= 100; ProductBQty >= 150",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment. The production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $10,000 for efficiency investments. The total production capacity of the company is 500 units per month. The company must produce at least 100 units of ProductA and 150 units of ProductB. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=100)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=150)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\nProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\nProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 10000)  # total budget for efficiency investments\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)  # total production capacity\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck i at speed x\": \"Efficiency_i(x)\", \"range\": \"Efficiency_i(x) > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n// Fuel consumption for truck i on route j: Consumption_ij = Distance_j / Efficiency_i(Speed_i) * Trucks_j\n// Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\n// Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 100.\n// \u03a3(Trucks_j) for all j <= 100\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 120 km/h.\n// Speed_i <= 120 for all i\n\n## Generate Constraint-3:\nThe minimum speed required to maintain stability and safety is 40 km/h.\n// Speed_i >= 40 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i.\n\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route.\n\nThe company has the following constraints:\n1. The total number of trucks available is limited to 100.\n2. The maximum speed limit for any truck is 120 km/h.\n3. The minimum speed required to maintain stability and safety is 40 km/h.\n\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed = {}\nfor i in range(1, 11):  # Assuming 10 trucks for simplicity\n    Speed[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=40, ub=120)\n\n## Number of trucks on each route\nTrucks = {}\nfor j in range(1, 6):  # Assuming 5 routes for simplicity\n    Trucks[j] = model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0)\n\n# Define objective function\n## Fuel efficiency function for each truck\nEfficiency = {}\nfor i in range(1, 11):\n    a_i, b_i, c_i = 0.0001, -0.01, 1.5  # Example coefficients for efficiency function\n    Efficiency[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Efficiency_{i}\", lb=0)\n    model.addCons(Efficiency[i] == a_i * Speed[i]**2 + b_i * Speed[i] + c_i)\n\n## Fuel consumption for each truck on each route\nConsumption = {}\nfor i in range(1, 11):\n    for j in range(1, 6):\n        Consumption[i, j] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Consumption_{i}_{j}\")\n        model.addCons(Consumption[i, j] == 1 / Efficiency[i] * Trucks[j])\n\n## Total fuel consumption\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Consumption[i, j] for i in range(1, 11) for j in range(1, 6)))\n\n# Add constraints\n## Total number of trucks available is limited to 100\nmodel.addCons(sum(Trucks[j] for j in range(1, 6)) <= 100)\n\n## Maximum speed limit for any truck is 120 km/h\nfor i in range(1, 11):\n    model.addCons(Speed[i] <= 120)\n\n## Minimum speed required to maintain stability and safety is 40 km/h\nfor i in range(1, 11):\n    model.addCons(Speed[i] >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(1, 11):\n        print(f\"Speed of truck {i}: {model.getVal(Speed[i])} km/h\")\n    for j in range(1, 6):\n        print(f\"Number of trucks on route {j}: {model.getVal(Trucks[j])}\")\n    print(f\"Total fuel consumption: {model.getObjVal()} liters\")\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons.\nTruck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons.\nTruck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons.\nThe revenue per ton-km is $0.5. The company wants to maximize the net profit per day.\n// Profit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\n// Profit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\n// Profit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a daily fuel budget of $1000.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints.\nTruck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons.\nTruck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons.\nTruck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons.\nThe revenue per ton-km is $0.5. The company wants to maximize the net profit per day.\nThe company has a daily fuel budget of $1000.\nPlease help the company to determine the optimal number of each type of vehicle to maximize the net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\nProfit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\nProfit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Net Profit per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"ComponentA_Qty\", \"range\": \"ComponentA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"ComponentB_Qty\", \"range\": \"ComponentB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"ComponentC_Qty\", \"range\": \"ComponentC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentD\": \"ComponentD_Qty\", \"range\": \"ComponentD_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentE\": \"ComponentE_Qty\", \"range\": \"ComponentE_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function for each component is given by:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit. The profit from each component depends on its production quantity and market demand, as described in the following table:\n\n| Component | Profit Function                                                                 |\n|-----------|----------------------------------------------------------------------------------|\n| ComponentA | Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))                  |\n| ComponentB | Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))                  |\n| ComponentC | Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))                  |\n| ComponentD | Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))                  |\n| ComponentE | Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))                  |\n\nThe company has a total production capacity of 5000 units per month. Please help the company to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentA_Qty\", lb=0)\nComponentB_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentB_Qty\", lb=0)\nComponentC_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentC_Qty\", lb=0)\nComponentD_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentD_Qty\", lb=0)\nComponentE_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentE_Qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define profit functions\nProfit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\nProfit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\nProfit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\nProfit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\nProfit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ComponentA: \", model.getVal(ComponentA_Qty))\n    print(\"Production Quantity for ComponentB: \", model.getVal(ComponentB_Qty))\n    print(\"Production Quantity for ComponentC: \", model.getVal(ComponentC_Qty))\n    print(\"Production Quantity for ComponentD: \", model.getVal(ComponentD_Qty))\n    print(\"Production Quantity for ComponentE: \", model.getVal(ComponentE_Qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) for their trucks. Each route has different fuel consumption rates, maintenance costs, and potential revenue.\n// {\"number of trips on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the fuel consumption per trip is 50 liters, the maintenance cost per trip is $100, and the revenue per trip is $500.\nFor Route B, the fuel consumption per trip is 60 liters, the maintenance cost per trip is $120, and the revenue per trip is $600.\nFor Route C, the fuel consumption per trip is 70 liters, the maintenance cost per trip is $140, and the revenue per trip is $700.\nFor Route D, the fuel consumption per trip is 80 liters, the maintenance cost per trip is $160, and the revenue per trip is $800.\nFor Route E, the fuel consumption per trip is 90 liters, the maintenance cost per trip is $180, and the revenue per trip is $900.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// NetProfit_A = (500 * RouteA - 100 * RouteA) / (50 * RouteA)\n// NetProfit_B = (600 * RouteB - 120 * RouteB) / (60 * RouteB)\n// NetProfit_C = (700 * RouteC - 140 * RouteC) / (70 * RouteC)\n// NetProfit_D = (800 * RouteD - 160 * RouteD) / (80 * RouteD)\n// NetProfit_E = (900 * RouteE - 180 * RouteE) / (90 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the quarter.\n// 50 * RouteA + 60 * RouteB + 70 * RouteC + 80 * RouteD + 90 * RouteE <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget of $20,000 for the quarter.\n// 100 * RouteA + 120 * RouteB + 140 * RouteC + 160 * RouteD + 180 * RouteE <= 20000\n\n## Generate Constraint-3:\nThe company has a limit of 500 trips across all routes for the quarter.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 500\n\n## Generate Constraint-4:\nThe company must make at least 50 trips on Route A due to contractual obligations.\n// RouteA >= 50",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five routes (Route A, Route B, Route C, Route D, and Route E) for their trucks. Each route has different fuel consumption rates, maintenance costs, and potential revenue. The details for each route are given in the following Table.\n\n| Route | Fuel Consumption per Trip | Maintenance Cost per Trip | Revenue per Trip |\n|-------|---------------------------|---------------------------|------------------|\n| A     | 50 liters                 | $100                      | $500             |\n| B     | 60 liters                 | $120                      | $600             |\n| C     | 70 liters                 | $140                      | $700             |\n| D     | 80 liters                 | $160                      | $800             |\n| E     | 90 liters                 | $180                      | $900             |\n\nThe company has a total fuel budget of 10,000 liters for the quarter. The company also has a maintenance budget of $20,000 for the quarter. The company has a limit of 500 trips across all routes for the quarter. Due to contractual obligations, the company must make at least 50 trips on Route A.\n\nPlease help the company to maximize the net profit per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=50) # number of trips on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trips on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trips on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trips on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trips on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 500 * RouteA\nCost_A = 100 * RouteA\nFuel_A = 50 * RouteA\nNetProfit_A = (Revenue_A - Cost_A) / Fuel_A\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_A == Revenue_A - Cost_A)\n\nRevenue_B = 600 * RouteB\nCost_B = 120 * RouteB\nFuel_B = 60 * RouteB\nNetProfit_B = (Revenue_B - Cost_B) / Fuel_B\nmodel.addCons(obj * Fuel_B == Revenue_B - Cost_B)\n\nRevenue_C = 700 * RouteC\nCost_C = 140 * RouteC\nFuel_C = 70 * RouteC\nNetProfit_C = (Revenue_C - Cost_C) / Fuel_C\nmodel.addCons(obj * Fuel_C == Revenue_C - Cost_C)\n\nRevenue_D = 800 * RouteD\nCost_D = 160 * RouteD\nFuel_D = 80 * RouteD\nNetProfit_D = (Revenue_D - Cost_D) / Fuel_D\nmodel.addCons(obj * Fuel_D == Revenue_D - Cost_D)\n\nRevenue_E = 900 * RouteE\nCost_E = 180 * RouteE\nFuel_E = 90 * RouteE\nNetProfit_E = (Revenue_E - Cost_E) / Fuel_E\nmodel.addCons(obj * Fuel_E == Revenue_E - Cost_E)\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the quarter.\nmodel.addCons(50 * RouteA + 60 * RouteB + 70 * RouteC + 80 * RouteD + 90 * RouteE <= 10000)\n## The company has a maintenance budget of $20,000 for the quarter.\nmodel.addCons(100 * RouteA + 120 * RouteB + 140 * RouteC + 160 * RouteD + 180 * RouteE <= 20000)\n## The company has a limit of 500 trips across all routes for the quarter.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips on Route A: \", model.getVal(RouteA))\n    print(\"Number of trips on Route B: \", model.getVal(RouteB))\n    print(\"Number of trips on Route C: \", model.getVal(RouteC))\n    print(\"Number of trips on Route D: \", model.getVal(RouteD))\n    print(\"Number of trips on Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $50, the cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the revenue per unit is $70, the cost per unit is $40, and the storage cost per unit is $7.\nFor ProductC, the revenue per unit is $90, the cost per unit is $50, and the storage cost per unit is $9.\nFor ProductD, the revenue per unit is $110, the cost per unit is $60, and the storage cost per unit is $11.\nThe company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - 30 - 5) * ProdA\n// Total net profit for ProductB: Profit_B = (70 - 40 - 7) * ProdB\n// Total net profit for ProductC: Profit_C = (90 - 50 - 9) * ProdC\n// Total net profit for ProductD: Profit_D = (110 - 60 - 11) * ProdD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProdA + ProdB + ProdC + ProdD <= 1000\n\n## Generate Constraint-2:\nDue to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The revenue per unit, cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost per Unit | Storage Cost per Unit |\n|---------|------------------|---------------|-----------------------|\n| ProductA | $50             | $30           | $5                   |\n| ProductB | $70             | $40           | $7                   |\n| ProductC | $90             | $50           | $9                   |\n| ProductD | $110            | $60           | $11                  |\n\nThe company has a total production capacity of 1000 units per month. Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=0) # production quantity for ProductD\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * ProdA\nProfit_B = (70 - 40 - 7) * ProdB\nProfit_C = (90 - 50 - 9) * ProdC\nProfit_D = (110 - 60 - 11) * ProdD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(ProdA + ProdB + ProdC + ProdD <= 1000)\n# Due to limited raw materials, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProdB <= 2 * ProdA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $10,000, the material cost is $5,000, and the production time is 10 hours. \nFor Machine M2, the selling price is $15,000, the material cost is $7,000, and the production time is 15 hours. \nFor Machine M3, the selling price is $20,000, the material cost is $9,000, and the production time is 20 hours.\nFor Machine M4, the selling price is $25,000, the material cost is $11,000, and the production time is 25 hours.\nFor Machine M5, the selling price is $30,000, the material cost is $13,000, and the production time is 30 hours.\nThe company aims to maximize the total profit while considering the efficiency of production time.\n// Profit of M1: Profit_M1 = (10,000 - 5,000) * M1\n// Profit of M2: Profit_M2 = (15,000 - 7,000) * M2\n// Profit of M3: Profit_M3 = (20,000 - 9,000) * M3\n// Profit of M4: Profit_M4 = (25,000 - 11,000) * M4\n// Profit of M5: Profit_M5 = (30,000 - 13,000) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for material costs for the quarter.\n// 5,000 * M1 + 7,000 * M2 + 9,000 * M3 + 11,000 * M4 + 13,000 * M5 <= 1,000,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine in the next quarter.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a total of 10,000 hours available for production in the next quarter.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 <= 10,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\n// M4 <= M1 + M2\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, M3, and M4.\n// M5 <= M1 + M2 + M3 + M4",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter. The selling price, material cost, and production time for each machine are given in the following Table.\n\n| Machine | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| M1      | $10,000       | $5,000        | 10 hours        |\n| M2      | $15,000       | $7,000        | 15 hours        |\n| M3      | $20,000       | $9,000        | 20 hours        |\n| M4      | $25,000       | $11,000       | 25 hours        |\n| M5      | $30,000       | $13,000       | 30 hours        |\n\nThe company has a budget of $1,000,000 for material costs for the quarter. The company wants to produce at least 5 units of each machine in the next quarter. The company has a total of 10,000 hours available for production in the next quarter. The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2. Additionally, the company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, M3, and M4. \n\nPlease help the company to maximize the total profit while considering the efficiency of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine in the next quarter.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (10000 - 5000) * M1\nProfit_M2 = (15000 - 7000) * M2\nProfit_M3 = (20000 - 9000) * M3\nProfit_M4 = (25000 - 11000) * M4\nProfit_M5 = (30000 - 13000) * M5\nProductionTime = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for material costs for the quarter.\nmodel.addCons(5000 * M1 + 7000 * M2 + 9000 * M3 + 11000 * M4 + 13000 * M5 <= 1000000)\n## The company has a total of 10,000 hours available for production in the next quarter.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 <= 10000)\n## The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\nmodel.addCons(M4 <= M1 + M2)\n## The company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, M3, and M4.\nmodel.addCons(M5 <= M1 + M2 + M3 + M4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output per unit.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n// Total energy output from solar panels in Region1: EnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\n// Total energy output from solar panels in Region2: EnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\n// Total energy output from solar panels in Region3: EnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\n// Total energy output from wind turbines in Region1: EnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\n// Total energy output from wind turbines in Region2: EnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\n// Total energy output from wind turbines in Region3: EnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n// So, the objective function is: Maximize (EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n## Generate Constraint-1:\nThe total investment in R&D cannot exceed $100,000.\n// RnDInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $2,000,000 for the installation of all solar panels and wind turbines.\n// (SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000\n\n## Generate Constraint-3:\nDue to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region.\n// SolarPanels1 <= WindTurbines1; SolarPanels2 <= WindTurbines2; SolarPanels3 <= WindTurbines3",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n\nThe total investment in R&D cannot exceed $100,000. The company has a budget of $2,000,000 for the installation of all solar panels and wind turbines. Due to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region.\n\nPlease help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)\n\n# Define objective function\nEnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\nEnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\nEnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\nEnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\nEnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\nEnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n# Add constraints\nmodel.addCons(RnDInvestment <= 100000)\nmodel.addCons((SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000)\nmodel.addCons(SolarPanels1 <= WindTurbines1)\nmodel.addCons(SolarPanels2 <= WindTurbines2)\nmodel.addCons(SolarPanels3 <= WindTurbines3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in R&D: \", model.getVal(RnDInvestment))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1141,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The company aims to maximize its total revenue from all products.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe market share of each product increases by 1% for every $10,000 spent on marketing for that product. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The company aims to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production.\n// Total revenue for ProductA: RevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\n// Total revenue for ProductB: RevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\n// Total revenue for ProductC: RevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-3:\nDue to market saturation, the price of each product cannot exceed $200.\n// PriceA <= 200; PriceB <= 200; PriceC <= 200\n\n## Generate Constraint-4:\nThe company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n// UnitsA >= 2000; UnitsB >= 3000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The company aims to maximize its total revenue from all products. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The market share of each product increases by 1% for every $10,000 spent on marketing for that product.\n\n| Product | Initial Market Share | Cost of Production per Unit |\n|---------|----------------------|-----------------------------|\n| ProductA | 5%                  | $50                         |\n| ProductB | 10%                 | $75                         |\n| ProductC | 15%                 | $100                        |\n\nThe company has a total production capacity of 10,000 units across all products. The total marketing budget cannot exceed $100,000. Due to market saturation, the price of each product cannot exceed $200. The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n\nPlease help the company to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0)  # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nRevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\nRevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\nRevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)  # total production capacity constraint\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)  # total marketing budget constraint\nmodel.addCons(PriceA <= 200)  # price constraint for ProductA\nmodel.addCons(PriceB <= 200)  # price constraint for ProductB\nmodel.addCons(PriceC <= 200)  # price constraint for ProductC\nmodel.addCons(UnitsA >= 2000)  # minimum production units for ProductA\nmodel.addCons(UnitsB >= 3000)  # minimum production units for ProductB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1570,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on Type A buildings\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type B buildings\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type C buildings\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type D buildings\": \"TypeDSolarPanels\", \"range\": \"TypeDSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type E buildings\": \"TypeESolarPanels\", \"range\": \"TypeESolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Type A buildings, each solar panel generates 10 kWh of electricity per day, with an installation cost of $100 per panel and a maintenance cost of $5 per panel per year.\nFor Type B buildings, each solar panel generates 15 kWh of electricity per day, with an installation cost of $150 per panel and a maintenance cost of $7 per panel per year.\nFor Type C buildings, each solar panel generates 20 kWh of electricity per day, with an installation cost of $200 per panel and a maintenance cost of $10 per panel per year.\nFor Type D buildings, each solar panel generates 25 kWh of electricity per day, with an installation cost of $250 per panel and a maintenance cost of $12 per panel per year.\nFor Type E buildings, each solar panel generates 30 kWh of electricity per day, with an installation cost of $300 per panel and a maintenance cost of $15 per panel per year.\nThe city wants to maximize the net electricity generated per dollar spent on installation and maintenance costs.\n// Net electricity generated: NetElectricity = 10 * TypeASolarPanels + 15 * TypeBSolarPanels + 20 * TypeCSolarPanels + 25 * TypeDSolarPanels + 30 * TypeESolarPanels\n// Total cost: TotalCost = 100 * TypeASolarPanels + 150 * TypeBSolarPanels + 200 * TypeCSolarPanels + 250 * TypeDSolarPanels + 300 * TypeESolarPanels + (5 * TypeASolarPanels + 7 * TypeBSolarPanels + 10 * TypeCSolarPanels + 12 * TypeDSolarPanels + 15 * TypeESolarPanels)\n// So, the objective function is: Maximize NetElectricity / TotalCost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 100 * TypeASolarPanels + 150 * TypeBSolarPanels + 200 * TypeCSolarPanels + 250 * TypeDSolarPanels + 300 * TypeESolarPanels + (5 * TypeASolarPanels + 7 * TypeBSolarPanels + 10 * TypeCSolarPanels + 12 * TypeDSolarPanels + 15 * TypeESolarPanels) <= 100000\n\n## Generate Constraint-2:\nThe city aims to generate at least 1,000,000 kWh of electricity per year.\n// 10 * TypeASolarPanels + 15 * TypeBSolarPanels + 20 * TypeCSolarPanels + 25 * TypeDSolarPanels + 30 * TypeESolarPanels >= 1000000\n\n## Generate Constraint-3:\nThe city has a limit on the total number of solar panels that can be installed, which is 5,000 panels.\n// TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels + TypeDSolarPanels + TypeESolarPanels <= 5000",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building. The characteristics of each type of building in terms of electricity generation, installation cost, and maintenance cost per panel are given in the following Table.\n\n| Building Type | Electricity Generation (kWh/day) | Installation Cost ($/panel) | Maintenance Cost ($/panel/year) |\n|---------------|---------------------------------|-----------------------------|---------------------------------|\n| Type A        | 10                              | 100                         | 5                               |\n| Type B        | 15                              | 150                         | 7                               |\n| Type C        | 20                              | 200                         | 10                              |\n| Type D        | 25                              | 250                         | 12                              |\n| Type E        | 30                              | 300                         | 15                              |\n\nThe city has a budget of $100,000 for the installation and maintenance of solar panels. The city aims to generate at least 1,000,000 kWh of electricity per year. The city also has a limit on the total number of solar panels that can be installed, which is 5,000 panels. \n\nPlease help the city to maximize the net electricity generated per dollar spent on installation and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\nTypeDSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolarPanels\", lb=0)\nTypeESolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeESolarPanels\", lb=0)\n\n# Define objective function\nNetElectricity = 10 * TypeASolarPanels + 15 * TypeBSolarPanels + 20 * TypeCSolarPanels + 25 * TypeDSolarPanels + 30 * TypeESolarPanels\nTotalCost = 100 * TypeASolarPanels + 150 * TypeBSolarPanels + 200 * TypeCSolarPanels + 250 * TypeDSolarPanels + 300 * TypeESolarPanels + (5 * TypeASolarPanels + 7 * TypeBSolarPanels + 10 * TypeCSolarPanels + 12 * TypeDSolarPanels + 15 * TypeESolarPanels)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetElectricity)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(TotalCost <= 100000)\n# The city aims to generate at least 1,000,000 kWh of electricity per year.\nmodel.addCons(NetElectricity >= 1000000)\n# The city has a limit on the total number of solar panels that can be installed, which is 5,000 panels.\nmodel.addCons(TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels + TypeDSolarPanels + TypeESolarPanels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Type A Buildings: \", model.getVal(TypeASolarPanels))\n    print(\"Number of Solar Panels on Type B Buildings: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of Solar Panels on Type C Buildings: \", model.getVal(TypeCSolarPanels))\n    print(\"Number of Solar Panels on Type D Buildings: \", model.getVal(TypeDSolarPanels))\n    print(\"Number of Solar Panels on Type E Buildings: \", model.getVal(TypeESolarPanels))\n    print(\"Maximized Net Electricity per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1709,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck (Truck1, Truck2, Truck3) to maximize efficiency while minimizing fuel consumption and maintenance costs. Additionally, the company needs to decide on the optimal speed for each truck type to balance between trip duration and fuel efficiency.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for Truck1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"optimal speed for Truck2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"optimal speed for Truck3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. For Truck1, the fuel consumption rate is 0.1 * Speed1^2 liters per kilometer, and the maintenance cost is 0.005 * Speed1^3 dollars per kilometer. \nFor Truck2, the fuel consumption rate is 0.12 * Speed2^2 liters per kilometer, and the maintenance cost is 0.006 * Speed2^3 dollars per kilometer. \nFor Truck3, the fuel consumption rate is 0.15 * Speed3^2 liters per kilometer, and the maintenance cost is 0.007 * Speed3^3 dollars per kilometer. \nThe company aims to minimize the total cost of fuel and maintenance per trip.\n// Total cost for Truck1: Cost1 = (0.1 * Speed1^2 * Trips1) + (0.005 * Speed1^3 * Trips1)\n// Total cost for Truck2: Cost2 = (0.12 * Speed2^2 * Trips2) + (0.006 * Speed2^3 * Trips2)\n// Total cost for Truck3: Cost3 = (0.15 * Speed3^2 * Trips3) + (0.007 * Speed3^3 * Trips3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel and maintenance costs for the next month.\n// (0.1 * Speed1^2 * Trips1 + 0.005 * Speed1^3 * Trips1) + (0.12 * Speed2^2 * Trips2 + 0.006 * Speed2^3 * Trips2) + (0.15 * Speed3^2 * Trips3 + 0.007 * Speed3^3 * Trips3) <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across all truck types must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to driver availability, the number of trips for Truck1 must be at least twice the number of trips for Truck2.\n// Trips1 >= 2 * Trips2",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck (Truck1, Truck2, Truck3) and the optimal speed for each truck type to balance between trip duration and fuel efficiency. The fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. For Truck1, the fuel consumption rate is 0.1 * Speed1^2 liters per kilometer, and the maintenance cost is 0.005 * Speed1^3 dollars per kilometer. For Truck2, the fuel consumption rate is 0.12 * Speed2^2 liters per kilometer, and the maintenance cost is 0.006 * Speed2^3 dollars per kilometer. For Truck3, the fuel consumption rate is 0.15 * Speed3^2 liters per kilometer, and the maintenance cost is 0.007 * Speed3^3 dollars per kilometer. The company aims to minimize the total cost of fuel and maintenance per trip. The company has a total budget of $10,000 for fuel and maintenance costs for the next month. The total number of trips across all truck types must not exceed 500. Due to driver availability, the number of trips for Truck1 must be at least twice the number of trips for Truck2. Please help the company to determine the optimal number of trips and speeds to minimize the total cost of fuel and maintenance per trip.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # optimal speed for Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # optimal speed for Truck2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=60)  # optimal speed for Truck3\n\n# Define objective function\nCost1 = (0.1 * Speed1**2 * Trips1) + (0.005 * Speed1**3 * Trips1)\nCost2 = (0.12 * Speed2**2 * Trips2) + (0.006 * Speed2**3 * Trips2)\nCost3 = (0.15 * Speed3**2 * Trips3) + (0.007 * Speed3**3 * Trips3)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(0.1 * Speed1**2 * Trips1 + 0.005 * Speed1**3 * Trips1 +\n              0.12 * Speed2**2 * Trips2 + 0.006 * Speed2**3 * Trips2 +\n              0.15 * Speed3**2 * Trips3 + 0.007 * Speed3**3 * Trips3 <= 10000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\nmodel.addCons(Trips1 >= 2 * Trips2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Optimal Speed for Truck1: \", model.getVal(Speed1))\n    print(\"Optimal Speed for Truck2: \", model.getVal(Speed2))\n    print(\"Optimal Speed for Truck3: \", model.getVal(Speed3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"ComponentA_Qty\", \"range\": \"ComponentA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"ComponentB_Qty\", \"range\": \"ComponentB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"ComponentC_Qty\", \"range\": \"ComponentC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentD\": \"ComponentD_Qty\", \"range\": \"ComponentD_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentE\": \"ComponentE_Qty\", \"range\": \"ComponentE_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function for each component is given by:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentA must be at least twice the production of ComponentB.\n// ComponentA_Qty >= 2 * ComponentB_Qty",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit. The profit from each component depends on its production quantity and market demand, as shown in the following Table.\n\n| Component | Profit Function                                                                 |\n|-----------|----------------------------------------------------------------------------------|\n| ComponentA | Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))                  |\n| ComponentB | Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))                  |\n| ComponentC | Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))                  |\n| ComponentD | Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))                  |\n| ComponentE | Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))                  |\n\nThe company has a total production capacity of 5000 units per month. Due to resource limitations, the production of ComponentA must be at least twice the production of ComponentB. The company wants to maximize the total profit from all components.\n\nPlease help the company determine the optimal production quantity for each component to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentA_Qty\", lb=0)\nComponentB_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentB_Qty\", lb=0)\nComponentC_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentC_Qty\", lb=0)\nComponentD_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentD_Qty\", lb=0)\nComponentE_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentE_Qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define profit functions\nProfit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\nProfit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\nProfit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\nProfit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\nProfit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 5000 units per month.\nmodel.addCons(ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000)\n\n## Due to resource limitations, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(ComponentA_Qty >= 2 * ComponentB_Qty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ComponentA: \", model.getVal(ComponentA_Qty))\n    print(\"Production Quantity for ComponentB: \", model.getVal(ComponentB_Qty))\n    print(\"Production Quantity for ComponentC: \", model.getVal(ComponentC_Qty))\n    print(\"Production Quantity for ComponentD: \", model.getVal(ComponentD_Qty))\n    print(\"Production Quantity for ComponentE: \", model.getVal(ComponentE_Qty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1399,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance.\n// {\"number of solar panels in Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"SE\", \"range\": \"SE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city aims to maximize the total energy production while minimizing the total cost of installation and maintenance.\n// Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n// Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n// So, the objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance. The efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city has a budget of $100,000 for the installation and maintenance of solar panels. Please help the city to maximize the total energy production while minimizing the total cost of installation and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=0) # number of solar panels in Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of solar panels in Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of solar panels in Zone C\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of solar panels in Zone D\nSE = model.addVar(vtype=\"INTEGER\", name=\"SE\", lb=0) # number of solar panels in Zone E\n\n# Define objective function\n## Total energy production\nEnergy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n## Total cost\nCost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Energy - Cost)\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(SA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(SB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(SC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(SD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(SE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods.\n// {\"number of trucks at Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at Warehouse E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck varies with the number of trucks at each warehouse due to congestion and route optimization. The fuel consumption per truck at Warehouse A is 0.5 + 0.01 * TrucksA liters per km, at Warehouse B is 0.45 + 0.01 * TrucksB liters per km, at Warehouse C is 0.4 + 0.01 * TrucksC liters per km, at Warehouse D is 0.35 + 0.01 * TrucksD liters per km, and at Warehouse E is 0.3 + 0.01 * TrucksE liters per km. The company wants to minimize the total daily fuel consumption across all warehouses.\n// Total fuel consumption at Warehouse A: Fuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\n// Total fuel consumption at Warehouse B: Fuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\n// Total fuel consumption at Warehouse C: Fuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\n// Total fuel consumption at Warehouse D: Fuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\n// Total fuel consumption at Warehouse E: Fuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nEach warehouse must have at least 2 trucks to ensure operational efficiency.\n// TrucksA >= 2; TrucksB >= 2; TrucksC >= 2; TrucksD >= 2; TrucksE >= 2\n\n## Generate Constraint-3:\nDue to local regulations, the number of trucks at Warehouse A cannot exceed twice the number at Warehouse B.\n// TrucksA <= 2 * TrucksB\n\n## Generate Constraint-4:\nThe total number of trucks at Warehouses C and D combined must not exceed the number at Warehouse E.\n// TrucksC + TrucksD <= TrucksE\n\n## Generate Constraint-5:\nThe company aims to balance the workload, ensuring that the difference in the number of trucks between any two warehouses does not exceed 5.\n// |TrucksA - TrucksB| <= 5; |TrucksA - TrucksC| <= 5; |TrucksA - TrucksD| <= 5; |TrucksA - TrucksE| <= 5;\n// |TrucksB - TrucksC| <= 5; |TrucksB - TrucksD| <= 5; |TrucksB - TrucksE| <= 5;\n// |TrucksC - TrucksD| <= 5; |TrucksC - TrucksE| <= 5;\n// |TrucksD - TrucksE| <= 5",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) and needs to optimize the number of trucks assigned to each warehouse to minimize fuel consumption while ensuring timely delivery of goods. The fuel consumption of each truck varies with the number of trucks at each warehouse due to congestion and route optimization. The company has a total of 50 trucks available for allocation. Each warehouse must have at least 2 trucks to ensure operational efficiency. Due to local regulations, the number of trucks at Warehouse A cannot exceed twice the number at Warehouse B. The total number of trucks at Warehouses C and D combined must not exceed the number at Warehouse E. The company aims to balance the workload, ensuring that the difference in the number of trucks between any two warehouses does not exceed 5.\n\nPlease help the company to minimize the total daily fuel consumption across all warehouses, considering the fuel consumption per truck at Warehouse A is 0.5 + 0.01 * TrucksA liters per km, at Warehouse B is 0.45 + 0.01 * TrucksB liters per km, at Warehouse C is 0.4 + 0.01 * TrucksC liters per km, at Warehouse D is 0.35 + 0.01 * TrucksD liters per km, and at Warehouse E is 0.3 + 0.01 * TrucksE liters per km.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=2)  # number of trucks at Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=2)  # number of trucks at Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=2)  # number of trucks at Warehouse C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=2)  # number of trucks at Warehouse D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=2)  # number of trucks at Warehouse E\n\n# Define objective function\nFuel_A = (0.5 + 0.01 * TrucksA) * TrucksA\nFuel_B = (0.45 + 0.01 * TrucksB) * TrucksB\nFuel_C = (0.4 + 0.01 * TrucksC) * TrucksC\nFuel_D = (0.35 + 0.01 * TrucksD) * TrucksD\nFuel_E = (0.3 + 0.01 * TrucksE) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TrucksA <= 2 * TrucksB)\nmodel.addCons(TrucksC + TrucksD <= TrucksE)\n\n# Constraints for balancing workload\nmodel.addCons(abs(TrucksA - TrucksB) <= 5)\nmodel.addCons(abs(TrucksA - TrucksC) <= 5)\nmodel.addCons(abs(TrucksA - TrucksD) <= 5)\nmodel.addCons(abs(TrucksA - TrucksE) <= 5)\nmodel.addCons(abs(TrucksB - TrucksC) <= 5)\nmodel.addCons(abs(TrucksB - TrucksD) <= 5)\nmodel.addCons(abs(TrucksB - TrucksE) <= 5)\nmodel.addCons(abs(TrucksC - TrucksD) <= 5)\nmodel.addCons(abs(TrucksC - TrucksE) <= 5)\nmodel.addCons(abs(TrucksD - TrucksE) <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks at Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks at Warehouse C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks at Warehouse D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks at Warehouse E: \", model.getVal(TrucksE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n// Net profit per truck on route A: Profit_A = (1500 - 1000) * A\n// Net profit per truck on route B: Profit_B = (1800 - 1200) * B\n// Net profit per truck on route C: Profit_C = (2200 - 1500) * C\n// Net profit per truck on route D: Profit_D = (2500 - 1800) * D\n// Net profit per truck on route E: Profit_E = (3000 - 2000) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs. Each route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated. The company has a budget of $10,000 for operational costs. Please help the company to maximize the net profit per truck (which is defined as the sum of the net profits divided by the total number of trucks allocated).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1500 - 1000) * A\nProfit_B = (1800 - 1200) * B\nProfit_C = (2200 - 1500) * C\nProfit_D = (2500 - 1800) * D\nProfit_E = (3000 - 2000) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in region 1\": \"FE1\", \"range\": \"FE1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 2\": \"FE2\", \"range\": \"FE2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 3\": \"FE3\", \"range\": \"FE3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 4\": \"FE4\", \"range\": \"FE4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 5\": \"FE5\", \"range\": \"FE5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n// Total fuel cost for region 1: Cost1 = (3.50 * (D / FE1)) * T1\n// Total fuel cost for region 2: Cost2 = (3.50 * (D / FE2)) * T2\n// Total fuel cost for region 3: Cost3 = (3.50 * (D / FE3)) * T3\n// Total fuel cost for region 4: Cost4 = (3.50 * (D / FE4)) * T4\n// Total fuel cost for region 5: Cost5 = (3.50 * (D / FE5)) * T5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe fuel efficiency of trucks in each region must be at least 10 miles per gallon.\n// FE1 >= 10; FE2 >= 10; FE3 >= 10; FE4 >= 10; FE5 >= 10\n\n## Generate Constraint-3:\nEach region must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region. The company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region. The company has a total of 100 trucks available. The fuel efficiency of trucks in each region must be at least 10 miles per gallon. Each region must have at least 5 trucks. Please help the company to determine the optimal number of trucks and their fuel efficiency in each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks in region 5\nFE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE1\", lb=10) # fuel efficiency of trucks in region 1\nFE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE2\", lb=10) # fuel efficiency of trucks in region 2\nFE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE3\", lb=10) # fuel efficiency of trucks in region 3\nFE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE4\", lb=10) # fuel efficiency of trucks in region 4\nFE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE5\", lb=10) # fuel efficiency of trucks in region 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\") # distance each truck travels\n## Total fuel cost for each region\nCost1 = 3.50 * (D / FE1) * T1\nCost2 = 3.50 * (D / FE2) * T2\nCost3 = 3.50 * (D / FE3) * T3\nCost4 = 3.50 * (D / FE4) * T4\nCost5 = 3.50 * (D / FE5) * T5\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Fuel Efficiency in Region 1: \", model.getVal(FE1))\n    print(\"Fuel Efficiency in Region 2: \", model.getVal(FE2))\n    print(\"Fuel Efficiency in Region 3: \", model.getVal(FE3))\n    print(\"Fuel Efficiency in Region 4: \", model.getVal(FE4))\n    print(\"Fuel Efficiency in Region 5: \", model.getVal(FE5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. Additionally, the company needs to decide on the investment in renewable energy sources to reduce the carbon footprint of each truck.\n// {\"fuel consumption of Truck1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck1\": \"Renewable1\", \"range\": \"Renewable1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck2\": \"Renewable2\", \"range\": \"Renewable2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck3\": \"Renewable3\", \"range\": \"Renewable3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in renewable energy sources. For every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n// Fuel consumption for Truck1: Fuel1 = 100 - 0.01 * Renewable1\n// Fuel consumption for Truck2: Fuel2 = 100 - 0.01 * Renewable2\n// Fuel consumption for Truck3: Fuel3 = 100 - 0.01 * Renewable3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and renewable energy investments.\n// Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck, as well as decide on the investment in renewable energy sources to reduce the carbon footprint of each truck. The relationship between investment in renewable energy and fuel consumption is such that for every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n\n| Variable                     | Description                          |\n|------------------------------|--------------------------------------|\n| Fuel1                        | Fuel consumption of Truck1           |\n| Fuel2                        | Fuel consumption of Truck2           |\n| Fuel3                        | Fuel consumption of Truck3           |\n| Renewable1                    | Investment in renewable energy for Truck1 |\n| Renewable2                    | Investment in renewable energy for Truck2 |\n| Renewable3                    | Investment in renewable energy for Truck3 |\n\nThe company has a budget of $100,000 for fuel and renewable energy investments. Please help the company determine the optimal fuel consumption and investment in renewable energy for each truck to minimize the total fuel consumption while staying within the budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel consumption of Truck1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel consumption of Truck2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel consumption of Truck3\nRenewable1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable1\", lb=0)  # investment in renewable energy for Truck1\nRenewable2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable2\", lb=0)  # investment in renewable energy for Truck2\nRenewable3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable3\", lb=0)  # investment in renewable energy for Truck3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel consumption for Truck1: Fuel1 = 100 - 0.01 * Renewable1\n## Fuel consumption for Truck2: Fuel2 = 100 - 0.01 * Renewable2\n## Fuel consumption for Truck3: Fuel3 = 100 - 0.01 * Renewable3\nFuel1 = 100 - 0.01 * Renewable1\nFuel2 = 100 - 0.01 * Renewable2\nFuel3 = 100 - 0.01 * Renewable3\n## the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and renewable energy investments.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(Fuel2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(Fuel3))\n    print(\"Investment in renewable energy for Truck1: \", model.getVal(Renewable1))\n    print(\"Investment in renewable energy for Truck2: \", model.getVal(Renewable2))\n    print(\"Investment in renewable energy for Truck3: \", model.getVal(Renewable3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1427,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck per trip is $1000, the fuel cost per trip is $200, and the maintenance cost per truck per year is $1000. \nFor T2, the revenue per truck per trip is $1200, the fuel cost per trip is $250, and the maintenance cost per truck per year is $1200. \nFor T3, the revenue per truck per trip is $1400, the fuel cost per trip is $300, and the maintenance cost per truck per year is $1400.\nFor T4, the revenue per truck per trip is $1600, the fuel cost per trip is $350, and the maintenance cost per truck per year is $1600.\nFor T5, the revenue per truck per trip is $1800, the fuel cost per trip is $400, and the maintenance cost per truck per year is $1800.\nThe company wants to maximize the net profit per truck per year.\n// Profit_T1 = (1000 - 200) * T1 - 1000 * T1\n// Profit_T2 = (1200 - 250) * T2 - 1200 * T2\n// Profit_T3 = (1400 - 300) * T3 - 1400 * T3\n// Profit_T4 = (1600 - 350) * T4 - 1600 * T4\n// Profit_T5 = (1800 - 400) * T5 - 1800 * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trips available for all trucks is limited to 1000 trips per year.\n// T1 + T2 + T3 + T4 + T5 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the total cargo capacity of all trucks must not exceed 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 500",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\nFor T1, the revenue per truck per trip is $1000, the fuel cost per trip is $200, and the maintenance cost per truck per year is $1000. \nFor T2, the revenue per truck per trip is $1200, the fuel cost per trip is $250, and the maintenance cost per truck per year is $1200. \nFor T3, the revenue per truck per trip is $1400, the fuel cost per trip is $300, and the maintenance cost per truck per year is $1400.\nFor T4, the revenue per truck per trip is $1600, the fuel cost per trip is $350, and the maintenance cost per truck per year is $1600.\nFor T5, the revenue per truck per trip is $1800, the fuel cost per trip is $400, and the maintenance cost per truck per year is $1800.\nThe company has a total budget of $50,000 for purchasing new trucks. The total number of trips available for all trucks is limited to 1000 trips per year. Due to safety regulations, the total cargo capacity of all trucks must not exceed 500 tons.\nPlease help the company to maximize the net profit per truck per year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nProfit_T1 = (1000 - 200) * T1 - 1000 * T1\nProfit_T2 = (1200 - 250) * T2 - 1200 * T2\nProfit_T3 = (1400 - 300) * T3 - 1400 * T3\nProfit_T4 = (1600 - 350) * T4 - 1600 * T4\nProfit_T5 = (1800 - 400) * T5 - 1800 * T5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000) # Budget constraint\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 1000) # Trip constraint\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 500) # Cargo capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit per Truck per Year: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel.\n// {\"number of solar panels for Apartments\": \"ApartmentPanels\", \"range\": \"ApartmentPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Houses\": \"HousePanels\", \"range\": \"HousePanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"efficiency of solar panels for Apartments\": \"ApartmentEfficiency\", \"range\": \"ApartmentEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Houses\": \"HouseEfficiency\", \"range\": \"HouseEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Commercial buildings\": \"CommercialEfficiency\", \"range\": \"CommercialEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh.\n// Cost_Apartments = 1000 * ApartmentPanels\n// Cost_Houses = 1500 * HousePanels\n// Cost_Commercial = 2000 * CommercialPanels\n// Energy_Apartments = ApartmentEfficiency * ApartmentPanels\n// Energy_Houses = HouseEfficiency * HousePanels\n// Energy_Commercial = CommercialEfficiency * CommercialPanels\n// So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n## Generate Constraint-1:\nThe total daily energy generated must be at least 1000 kWh.\n// Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000\n\n## Generate Constraint-3:\nThe number of solar panels for Apartments must not exceed 500.\n// ApartmentPanels <= 500\n\n## Generate Constraint-4:\nThe efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments.\n// HouseEfficiency >= 1.2 * ApartmentEfficiency\n\n## Generate Constraint-5:\nThe number of solar panels for Commercial buildings must be at least 10% of the total number of solar panels for Apartments and Houses.\n// CommercialPanels >= 0.1 * (ApartmentPanels + HousePanels)",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel. The cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh. The city has a budget of $500,000 for the installation of solar panels. The number of solar panels for Apartments must not exceed 500. The efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments. The number of solar panels for Commercial buildings must be at least 10% of the total number of solar panels for Apartments and Houses.\n\nPlease help the city to determine the optimal number of solar panels and their efficiencies for each type of building to meet these requirements.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartmentPanels = model.addVar(vtype=\"INTEGER\", name=\"ApartmentPanels\", lb=0)\nHousePanels = model.addVar(vtype=\"INTEGER\", name=\"HousePanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nApartmentEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"ApartmentEfficiency\", lb=0)\nHouseEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HouseEfficiency\", lb=0)\nCommercialEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialEfficiency\", lb=0)\n\n# Define objective function\nCost_Apartments = 1000 * ApartmentPanels\nCost_Houses = 1500 * HousePanels\nCost_Commercial = 2000 * CommercialPanels\nmodel.setObjective(Cost_Apartments + Cost_Houses + Cost_Commercial, \"minimize\")\n\n# Add constraints\n## The total daily energy generated must be at least 1000 kWh.\nEnergy_Apartments = ApartmentEfficiency * ApartmentPanels\nEnergy_Houses = HouseEfficiency * HousePanels\nEnergy_Commercial = CommercialEfficiency * CommercialPanels\nmodel.addCons(Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000)\n\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * ApartmentPanels + 1500 * HousePanels + 2000 * CommercialPanels <= 500000)\n\n## The number of solar panels for Apartments must not exceed 500.\nmodel.addCons(ApartmentPanels <= 500)\n\n## The efficiency of solar panels for Houses must be at least 20% higher than the efficiency of solar panels for Apartments.\nmodel.addCons(HouseEfficiency >= 1.2 * ApartmentEfficiency)\n\n## The number of solar panels for Commercial buildings must be at least 10% of the total number of solar panels for Apartments and Houses.\nmodel.addCons(CommercialPanels >= 0.1 * (ApartmentPanels + HousePanels))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Apartments: \", model.getVal(ApartmentPanels))\n    print(\"Number of Solar Panels for Houses: \", model.getVal(HousePanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Efficiency of Solar Panels for Apartments: \", model.getVal(ApartmentEfficiency))\n    print(\"Efficiency of Solar Panels for Houses: \", model.getVal(HouseEfficiency))\n    print(\"Efficiency of Solar Panels for Commercial Buildings: \", model.getVal(CommercialEfficiency))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint that limits the total production to no more than 800 units.\n// ProdA + ProdB + ProdC <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to meet a contractual obligation.\n// ProdC >= 50\n\n## Generate Constraint-5:\nThe total production cost must not exceed $30,000.\n// 30 * ProdA + 40 * ProdB + 35 * ProdC <= 30,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50             | $30                      |\n| ProductB | $70             | $40                      |\n| ProductC | $60             | $35                      |\n\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a storage capacity constraint that limits the total production to no more than 800 units. The company must produce at least 50 units of ProductC to meet a contractual obligation. The total production cost must not exceed $30,000.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=50) # production quantity for ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n## So, the objective function is: Maximize Profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n## The company has a storage capacity constraint that limits the total production to no more than 800 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 800)\n## The company must produce at least 50 units of ProductC to meet a contractual obligation.\nmodel.addCons(ProdC >= 50)\n## The total production cost must not exceed $30,000.\nmodel.addCons(30 * ProdA + 40 * ProdB + 35 * ProdC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines that produce widgets. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"H4\", \"range\": \"H4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"H5\", \"range\": \"H5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine 1 produces 10 widgets per hour at a cost of $5 per hour, Machine 2 produces 15 widgets per hour at a cost of $7 per hour, Machine 3 produces 20 widgets per hour at a cost of $9 per hour, Machine 4 produces 25 widgets per hour at a cost of $11 per hour, and Machine 5 produces 30 widgets per hour at a cost of $13 per hour. The company wants to maximize the total number of widgets produced while keeping the total cost under $1000.\n// The total number of widgets produced: W = 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5\n// The total cost: C = 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5\n// The objective function is: Maximize W - C\n// Maximize (10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5) - (5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5)\n\n## Generate Constraint-1:\nThe total cost must not exceed $1000.\n// 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5 <= 1000\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 40 hours.\n// H1 <= 40; H2 <= 40; H3 <= 40; H4 <= 40; H5 <= 40",
        "question": "A manufacturing company has 5 different machines that produce widgets. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Widgets Produced per Hour | Cost per Hour |\n|---------|---------------------------|---------------|\n| 1       | 10                        | $5            |\n| 2       | 15                        | $7            |\n| 3       | 20                        | $9            |\n| 4       | 25                        | $11           |\n| 5       | 30                        | $13           |\n\nThe company wants to maximize the total number of widgets produced while keeping the total cost under $1000. Each machine can operate for a maximum of 40 hours.\nPlease help the company to maximize the total number of widgets produced while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours machine 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours machine 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours machine 3 operates\nH4 = model.addVar(vtype=\"CONTINUOUS\", name=\"H4\", lb=0) # hours machine 4 operates\nH5 = model.addVar(vtype=\"CONTINUOUS\", name=\"H5\", lb=0) # hours machine 5 operates\n\n# Define objective function\n## The total number of widgets produced: W = 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5\n## The total cost: C = 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5\n## The objective function is: Maximize W - C\nW = 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5\nC = 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == W - C)\n\n# Add constraints\n## The total cost must not exceed $1000.\nmodel.addCons(5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5 <= 1000)\n## Each machine can operate for a maximum of 40 hours.\nmodel.addCons(H1 <= 40)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 40)\nmodel.addCons(H4 <= 40)\nmodel.addCons(H5 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(H1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(H2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(H3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(H4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(H5))\n    print(\"Maximized Widget Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption.\n// {\"number of trips to D1\": \"TripsD1\", \"range\": \"TripsD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D2\": \"TripsD2\", \"range\": \"TripsD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D3\": \"TripsD3\", \"range\": \"TripsD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D4\": \"TripsD4\", \"range\": \"TripsD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D5\": \"TripsD5\", \"range\": \"TripsD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for D1\": \"FuelBudgetD1\", \"range\": \"FuelBudgetD1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D2\": \"FuelBudgetD2\", \"range\": \"FuelBudgetD2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D3\": \"FuelBudgetD3\", \"range\": \"FuelBudgetD3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D4\": \"FuelBudgetD4\", \"range\": \"FuelBudgetD4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D5\": \"FuelBudgetD5\", \"range\": \"FuelBudgetD5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumptionD1 = (TripsD1 * FuelBudgetD1^0.7)\n// FuelConsumptionD2 = (TripsD2 * FuelBudgetD2^0.7)\n// FuelConsumptionD3 = (TripsD3 * FuelBudgetD3^0.7)\n// FuelConsumptionD4 = (TripsD4 * FuelBudgetD4^0.7)\n// FuelConsumptionD5 = (TripsD5 * FuelBudgetD5^0.7)\n// So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel across all routes.\n// FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all destinations must not exceed 500.\n// TripsD1 + TripsD2 + TripsD3 + TripsD4 + TripsD5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trips must be made to D1 and at least 50 trips to D2.\n// TripsD1 >= 100; TripsD2 >= 50\n\n## Generate Constraint-4:\nThe fuel budget for each route must be sufficient to cover the expected fuel consumption, which is estimated to be at least 500 gallons per trip for D1, 600 gallons per trip for D2, 700 gallons per trip for D3, 800 gallons per trip for D4, and 900 gallons per trip for D5.\n// FuelBudgetD1 >= 500 * TripsD1\n// FuelBudgetD2 >= 600 * TripsD2\n// FuelBudgetD3 >= 700 * TripsD3\n// FuelBudgetD4 >= 800 * TripsD4\n// FuelBudgetD5 >= 900 * TripsD5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption. The fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company has a total budget of $100,000 for fuel across all routes. The total number of trips across all destinations must not exceed 500. Due to contractual obligations, at least 100 trips must be made to D1 and at least 50 trips to D2. The fuel budget for each route must be sufficient to cover the expected fuel consumption, which is estimated to be at least 500 gallons per trip for D1, 600 gallons per trip for D2, 700 gallons per trip for D3, 800 gallons per trip for D4, and 900 gallons per trip for D5. Please help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsD1 = model.addVar(vtype=\"INTEGER\", name=\"TripsD1\", lb=100)\nTripsD2 = model.addVar(vtype=\"INTEGER\", name=\"TripsD2\", lb=50)\nTripsD3 = model.addVar(vtype=\"INTEGER\", name=\"TripsD3\", lb=0)\nTripsD4 = model.addVar(vtype=\"INTEGER\", name=\"TripsD4\", lb=0)\nTripsD5 = model.addVar(vtype=\"INTEGER\", name=\"TripsD5\", lb=0)\nFuelBudgetD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD1\", lb=0)\nFuelBudgetD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD2\", lb=0)\nFuelBudgetD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD3\", lb=0)\nFuelBudgetD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD4\", lb=0)\nFuelBudgetD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD5\", lb=0)\n\n# Define objective function\nFuelConsumptionD1 = TripsD1 * FuelBudgetD1**0.7\nFuelConsumptionD2 = TripsD2 * FuelBudgetD2**0.7\nFuelConsumptionD3 = TripsD3 * FuelBudgetD3**0.7\nFuelConsumptionD4 = TripsD4 * FuelBudgetD4**0.7\nFuelConsumptionD5 = TripsD5 * FuelBudgetD5**0.7\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n# Add constraints\nmodel.addCons(FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000)\nmodel.addCons(TripsD1 + TripsD2 + TripsD3 + TripsD4 + TripsD5 <= 500)\nmodel.addCons(TripsD1 >= 100)\nmodel.addCons(TripsD2 >= 50)\nmodel.addCons(FuelBudgetD1 >= 500 * TripsD1)\nmodel.addCons(FuelBudgetD2 >= 600 * TripsD2)\nmodel.addCons(FuelBudgetD3 >= 700 * TripsD3)\nmodel.addCons(FuelBudgetD4 >= 800 * TripsD4)\nmodel.addCons(FuelBudgetD5 >= 900 * TripsD5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to D1: \", model.getVal(TripsD1))\n    print(\"Number of trips to D2: \", model.getVal(TripsD2))\n    print(\"Number of trips to D3: \", model.getVal(TripsD3))\n    print(\"Number of trips to D4: \", model.getVal(TripsD4))\n    print(\"Number of trips to D5: \", model.getVal(TripsD5))\n    print(\"Fuel budget for D1: \", model.getVal(FuelBudgetD1))\n    print(\"Fuel budget for D2: \", model.getVal(FuelBudgetD2))\n    print(\"Fuel budget for D3: \", model.getVal(FuelBudgetD3))\n    print(\"Fuel budget for D4: \", model.getVal(FuelBudgetD4))\n    print(\"Fuel budget for D5: \", model.getVal(FuelBudgetD5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour.\n// {\"number of hours machine 1 is used\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"number of hours machine 2 is used\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"number of hours machine 3 is used\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"number of hours machine 4 is used\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"number of hours machine 5 is used\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nMachine 1 produces 10 units of product A per hour, 15 units of product B per hour, and 20 units of product C per hour. It costs $50 per hour to operate.\nMachine 2 produces 12 units of product A per hour, 18 units of product B per hour, and 22 units of product C per hour. It costs $60 per hour to operate.\nMachine 3 produces 14 units of product A per hour, 20 units of product B per hour, and 24 units of product C per hour. It costs $70 per hour to operate.\nMachine 4 produces 16 units of product A per hour, 22 units of product B per hour, and 26 units of product C per hour. It costs $80 per hour to operate.\nMachine 5 produces 18 units of product A per hour, 24 units of product B per hour, and 28 units of product C per hour. It costs $90 per hour to operate.\nThe company wants to maximize the total production value (sum of the products produced) while minimizing the total operating cost.\n// Total production value: Value = 10 * M1 * Price_A + 15 * M1 * Price_B + 20 * M1 * Price_C + 12 * M2 * Price_A + 18 * M2 * Price_B + 22 * M2 * Price_C + 14 * M3 * Price_A + 20 * M3 * Price_B + 24 * M3 * Price_C + 16 * M4 * Price_A + 22 * M4 * Price_B + 26 * M4 * Price_C + 18 * M5 * Price_A + 24 * M5 * Price_B + 28 * M5 * Price_C\n// Total operating cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe total number of hours all machines can operate is limited to 100 hours.\n// M1 + M2 + M3 + M4 + M5 <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour. The company wants to maximize the total production value (sum of the products produced) while minimizing the total operating cost. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Units of A per Hour | Units of B per Hour | Units of C per Hour | Cost per Hour |\n|---------|---------------------|---------------------|---------------------|---------------|\n| M1      | 10                  | 15                  | 20                  | $50           |\n| M2      | 12                  | 18                  | 22                  | $60           |\n| M3      | 14                  | 20                  | 24                  | $70           |\n| M4      | 16                  | 22                  | 26                  | $80           |\n| M5      | 18                  | 24                  | 28                  | $90           |\n\nThe total number of hours all machines can operate is limited to 100 hours. Please help the company determine the optimal number of hours each machine should be used to maximize the total production value while minimizing the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # number of hours machine 1 is used\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # number of hours machine 2 is used\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # number of hours machine 3 is used\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # number of hours machine 4 is used\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # number of hours machine 5 is used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total production value and Total operating cost\nValue = 10 * M1 + 15 * M1 + 20 * M1 + 12 * M2 + 18 * M2 + 22 * M2 + 14 * M3 + 20 * M3 + 24 * M3 + 16 * M4 + 22 * M4 + 26 * M4 + 18 * M5 + 24 * M5 + 28 * M5\nCost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n\n## the objective function is: Maximize (Value - Cost)\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The total number of hours all machines can operate is limited to 100 hours.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Machine 1 used: \", model.getVal(M1))\n    print(\"Number of hours Machine 2 used: \", model.getVal(M2))\n    print(\"Number of hours Machine 3 used: \", model.getVal(M3))\n    print(\"Number of hours Machine 4 used: \", model.getVal(M4))\n    print(\"Number of hours Machine 5 used: \", model.getVal(M5))\n    print(\"Maximized Production Value - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1357,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route, the fuel efficiency of each truck, and the maintenance cost per truck. The company also needs to determine the investment in new technology to improve fuel efficiency and reduce maintenance costs.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck (miles per gallon)\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost per truck ($)\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is inversely proportional to the fuel efficiency of the trucks, and the maintenance cost decreases with the investment in new technology.\nThe fuel cost for Route1 is $3 per gallon, and for Route2 is $4 per gallon. The maintenance cost decreases by $100 for every $1000 invested in new technology.\n// Total operational cost for Route1: Cost1 = (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 - 0.1 * TechInvest1\n// Total operational cost for Route2: Cost2 = (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 - 0.1 * TechInvest2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs and technology investments.\n// (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 + (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 + TechInvest1 + TechInvest2 <= 100000",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route, the fuel efficiency of each truck, and the maintenance cost per truck. The company also needs to determine the investment in new technology to improve fuel efficiency and reduce maintenance costs. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost for Route1 is $3 per gallon, and for Route2 is $4 per gallon. The maintenance cost decreases by $100 for every $1000 invested in new technology.\n\n| Parameter                | Value          |\n|--------------------------|----------------|\n| Fuel cost for Route1     | $3 per gallon  |\n| Fuel cost for Route2     | $4 per gallon  |\n| Reduction in maintenance cost per $1000 tech investment | $100 |\n\nThe company has a budget of $100,000 for operational costs and technology investments. Please help the company to minimize the total operational cost for both routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # fuel efficiency of each truck\nMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost\", lb=0)  # maintenance cost per truck\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in new technology for Route1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=0)  # investment in new technology for Route2\n\n# Define objective function\nCost1 = (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 - 0.1 * TechInvest1\nCost2 = (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 - 0.1 * TechInvest2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons((3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 + (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 + TechInvest1 + TechInvest2 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency: \", model.getVal(Efficiency))\n    print(\"Maintenance Cost: \", model.getVal(MaintenanceCost))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits.\n// {\"number of apartments\": \"Apartments\", \"range\": \"Apartments >= 0\", \"type\": \"integer\"}\n// {\"number of townhouses\": \"Townhouses\", \"range\": \"Townhouses >= 0\", \"type\": \"integer\"}\n// {\"number of single-family homes\": \"SingleFamilyHomes\", \"range\": \"SingleFamilyHomes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per apartment is $100,000, and the city receives a tax revenue of $2,000 per apartment annually.\nThe cost per townhouse is $150,000, and the city receives a tax revenue of $2,500 per townhouse annually.\nThe cost per single-family home is $200,000, and the city receives a tax revenue of $3,000 per single-family home annually.\nThe city wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n// NPV = (2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes) / 0.05 - (100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes)\n// So, the objective function is: Maximize NPV\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of all housing units.\n// 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes <= 10000000\n\n## Generate Constraint-2:\nThe city has a land area constraint that allows for a maximum of 100 units to be built in total.\n// Apartments + Townhouses + SingleFamilyHomes <= 100",
        "question": "A city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits.\nThe cost per apartment is $100,000, and the city receives a tax revenue of $2,000 per apartment annually.\nThe cost per townhouse is $150,000, and the city receives a tax revenue of $2,500 per townhouse annually.\nThe cost per single-family home is $200,000, and the city receives a tax revenue of $3,000 per single-family home annually.\nThe city wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\nThe city has a budget of $10 million for the construction of all housing units.\nThe city has a land area constraint that allows for a maximum of 100 units to be built in total.\nPlease help the city determine the optimal number of each type of housing unit to build.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartments = model.addVar(vtype=\"INTEGER\", name=\"Apartments\", lb=0)  # number of apartments\nTownhouses = model.addVar(vtype=\"INTEGER\", name=\"Townhouses\", lb=0)  # number of townhouses\nSingleFamilyHomes = model.addVar(vtype=\"INTEGER\", name=\"SingleFamilyHomes\", lb=0)  # number of single-family homes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTaxRevenue = 2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes\nConstructionCost = 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes\n## the objective function is: Maximize NPV = (TaxRevenue) / 0.05 - ConstructionCost\n## convert the division to multiplication\nmodel.addCons(obj * 0.05 == TaxRevenue - ConstructionCost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of all housing units.\nmodel.addCons(ConstructionCost <= 10000000)\n## The city has a land area constraint that allows for a maximum of 100 units to be built in total.\nmodel.addCons(Apartments + Townhouses + SingleFamilyHomes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Apartments: \", model.getVal(Apartments))\n    print(\"Number of Townhouses: \", model.getVal(Townhouses))\n    print(\"Number of Single-Family Homes: \", model.getVal(SingleFamilyHomes))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck decreases non-linearly with the amount of fuel optimization, specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n\n| Region       | Number of Trucks | Fuel Optimization |\n|--------------|-----------------|-------------------|\n| Region1      | Trucks1         | FuelOpt1          |\n| Region2      | Trucks2         | FuelOpt2          |\n| Region3      | Trucks3         | FuelOpt3          |\n\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel. The total number of trucks that can be deployed is limited to 500.\n\nPlease help the company to determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\n# The total number of trucks that can be deployed is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each DeviceB produced. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each DeviceA produced. The profit per unit for DeviceC is $60, but it decreases by $0.2 for each DeviceD produced. The profit per unit for DeviceD is $80, but it decreases by $0.15 for each DeviceC produced. The profit per unit for DeviceE is $90, but it decreases by $0.1 for each DeviceA and DeviceB produced. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n// Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n// Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n// Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n// Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\n// DeviceA >= 2 * DeviceB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40.\n// 20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for each device and the impact of producing one device on the profit of another are given in the following Table.\n\n| Device | Profit per Unit | Impact on Profit of Other Devices |\n|--------|-----------------|-----------------------------------|\n| DeviceA | $50 | Decreases $0.1 for each DeviceB produced |\n| DeviceB | $70 | Decreases $0.05 for each DeviceA produced |\n| DeviceC | $60 | Decreases $0.2 for each DeviceD produced |\n| DeviceD | $80 | Decreases $0.15 for each DeviceC produced |\n| DeviceE | $90 | Decreases $0.1 for each DeviceA and DeviceB produced |\n\nThe company has a total production capacity of 1000 units for all devices combined. Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB. The company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of DeviceE\n\n# Define objective function\n## Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n## Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n## Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n## Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n## Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (50 - 0.1 * DeviceB) * DeviceA + (70 - 0.05 * DeviceA) * DeviceB + \n               (60 - 0.2 * DeviceD) * DeviceC + (80 - 0.15 * DeviceC) * DeviceD + \n               (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000)\n## Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\nmodel.addCons(DeviceA >= 2 * DeviceB)\n## The company has a budget of $50,000 for production costs for all devices.\nmodel.addCons(20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1318,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 50 trucks in total.\n// Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks for each type of cargo.\n// Food >= 10\n// Electronics >= 10\n// Textiles >= 10\n// Chemicals >= 10\n// HeavyMachinery >= 10",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company aims to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact also affects the company's taxes. The details of profit, operational cost, and environmental impact per truck are given in the following Table.\n\n| Cargo Type        | Profit per Truck | Operational Cost Function | Environmental Impact Function |\n|-------------------|------------------|---------------------------|-------------------------------|\n| Food              | 5000$            | 0.01 * Food^2            | 0.005 * Food^2               |\n| Electronics       | 7000$            | 0.015 * Electronics^2    | 0.007 * Electronics^2         |\n| Textiles          | 4000$            | 0.008 * Textiles^2       | 0.004 * Textiles^2           |\n| Chemicals         | 6000$            | 0.02 * Chemicals^2       | 0.01 * Chemicals^2            |\n| Heavy Machinery   | 8000$            | 0.025 * HeavyMachinery^2 | 0.012 * HeavyMachinery^2      |\n\nThe company has a budget of $500,000 for purchasing trucks. The company must have at least 50 trucks in total. Additionally, the company must have at least 10 trucks for each type of cargo. Please help the company to maximize its profit by determining the optimal number of trucks for each type of cargo.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=10)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=10)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=10)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=10)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=10)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and costs calculation\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (total profit - total cost - total environmental impact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n## The company must have at least 50 trucks in total.\nmodel.addCons(Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1612,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company needs to deliver at least 5000 kg of goods per day. Each Small truck can carry 500 kg, each Medium truck can carry 1000 kg, each Large truck can carry 1500 kg, each Extra-Large truck can carry 2000 kg, and each Refrigerated truck can carry 1000 kg. The company aims to minimize the total daily operational cost, considering the distance traveled by each type of truck.\n// Total_Cost = 2 * S * D_S + 3 * M * D_M + 4 * L * D_L + 5 * XL * D_XL + 6 * R * D_R\n// where D_S, D_M, D_L, D_XL, D_R are the distances traveled by each type of truck.\n// The objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting delivery requirements. The operational cost per kilometer for each type of truck and their carrying capacities are given in the following Table.\n\n| Truck Type       | Operational Cost per Kilometer | Carrying Capacity |\n|------------------|--------------------------------|-------------------|\n| Small            | $2                             | 500 kg            |\n| Medium           | $3                             | 1000 kg           |\n| Large            | $4                             | 1500 kg           |\n| Extra-Large      | $5                             | 2000 kg           |\n| Refrigerated     | $6                             | 1000 kg           |\n\nThe company needs to deliver at least 5000 kg of goods per day. The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg. Please help the company to minimize the total daily operational cost, considering the distance traveled by each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize Total_Cost\n## Assuming all trucks travel the same distance for simplicity\nD = model.addVar(name=\"D\") # distance traveled by each truck\nTotal_Cost = 2 * S * D + 3 * M * D + 4 * L * D + 5 * XL * D + 6 * R * D\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total carrying capacity of all trucks must meet or exceed the daily delivery requirement of 5000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 1000 * R >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities (City1, City2, City3, City4, City5) and the fuel efficiency of each truck, which can be improved with an investment in fuel-efficient technologies.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for each truck\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. The fuel efficiency of the trucks can be improved with an investment, reducing the fuel cost per trip. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company aims to maximize the total profit from all trips.\n// Profit per trip to City1: Profit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\n// Profit per trip to City2: Profit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\n// Profit per trip to City3: Profit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\n// Profit per trip to City4: Profit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\n// Profit per trip to City5: Profit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency investments.\n// EfficiencyInvestment <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities (City1, City2, City3, City4, City5). The company needs to determine the number of trips each truck should make to different cities and the investment in fuel efficiency for each truck. The profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company has a budget of $10,000 for fuel efficiency investments. The company aims to maximize the total profit from all trips. Please help the company determine the optimal number of trips to each city and the investment in fuel efficiency to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in fuel efficiency for each truck\n\n# Define objective function\nProfit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\nProfit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\nProfit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\nProfit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\nProfit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system\": \"FleetManagement\", \"range\": \"FleetManagement >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in the fleet management system, reducing the operational cost per truck. The operational cost per truck for GoodsX is $2000, for GoodsY is $2500, for GoodsZ is $3000, and for GoodsW is $3500. The fleet management system reduces these costs by $50 for every $1000 invested. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for GoodsX: CostX = (2000 - 0.05 * FleetManagement) * TrucksX\n// Operational cost for GoodsY: CostY = (2500 - 0.05 * FleetManagement) * TrucksY\n// Operational cost for GoodsZ: CostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\n// Operational cost for GoodsW: CostW = (3500 - 0.05 * FleetManagement) * TrucksW\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in a new fleet management system, which will affect the fuel efficiency and maintenance costs of the trucks. The operational cost per truck for each type of goods without the fleet management system is given in the following Table.\n\n| Goods | Operational Cost per Truck |\n|-------|---------------------------|\n| GoodsX | $2000                     |\n| GoodsY | $2500                     |\n| GoodsZ | $3000                     |\n| GoodsW | $3500                     |\n\nThe fleet management system reduces these costs by $50 for every $1000 invested. The company aims to minimize the total operational cost of all trucks. The company has a total of 50 trucks available for allocation.\nPlease help the company to determine the optimal number of trucks for each type of goods and the investment in the fleet management system to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=0) # number of trucks for GoodsW\nFleetManagement = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetManagement\", lb=0) # investment in fleet management system\n\n# Define objective function\nCostX = (2000 - 0.05 * FleetManagement) * TrucksX\nCostY = (2500 - 0.05 * FleetManagement) * TrucksY\nCostZ = (3000 - 0.05 * FleetManagement) * TrucksZ\nCostW = (3500 - 0.05 * FleetManagement) * TrucksW\n# So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Fleet Management System: \", model.getVal(FleetManagement))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of solar panels of type A\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type B\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type C\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type D\": \"PanelD\", \"range\": \"PanelD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years.\nThe efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years.\nThe efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years.\nThe efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years.\nThe city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n// EnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\n// TotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n// So, the objective function is: Maximize (EnergyOutput / TotalCost)\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000\n\n## Generate Constraint-2:\nThe total number of solar panels installed should not exceed 500.\n// PanelA + PanelB + PanelC + PanelD <= 500",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district. The efficiency, cost, and lifespan of each solar panel are given in the following Table.\n\n| Solar Panel Type | Efficiency (kWh/day) | Cost ($) | Lifespan (years) |\n|------------------|----------------------|----------|------------------|\n| A                | 0.15                 | 100      | 10               |\n| B                | 0.20                 | 150      | 12               |\n| C                | 0.25                 | 200      | 15               |\n| D                | 0.30                 | 250      | 20               |\n\nThe city has a budget of $50,000 for the installation of solar panels. The total number of solar panels installed should not exceed 500. The city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost. Please help the city to determine the optimal number of each type of solar panel to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of solar panels of type A\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of solar panels of type B\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of solar panels of type C\nPanelD = model.addVar(vtype=\"INTEGER\", name=\"PanelD\", lb=0) # number of solar panels of type D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\nTotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n## the objective function is: Maximize (EnergyOutput / TotalCost)\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == EnergyOutput)\n\n# Add constraints\n## The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000)\n## The total number of solar panels installed should not exceed 500.\nmodel.addCons(PanelA + PanelB + PanelC + PanelD <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels of Type A: \", model.getVal(PanelA))\n    print(\"Number of Solar Panels of Type B: \", model.getVal(PanelB))\n    print(\"Number of Solar Panels of Type C: \", model.getVal(PanelC))\n    print(\"Number of Solar Panels of Type D: \", model.getVal(PanelD))\n    print(\"Maximized Energy Output per Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The company needs to minimize the total operational cost of the fleet.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the daily demand of 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of type 1 trucks must not exceed 20% of the total number of trucks.\n// T1 <= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 10% of the total number of trucks.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation. The operational cost per kilometer for each type of truck is given in the following Table.\n\n| Type of Truck | Operational Cost per Kilometer |\n|---------------|--------------------------------|\n| Type 1        | $2                             |\n| Type 2        | $3                             |\n| Type 3        | $4                             |\n| Type 4        | $5                             |\n| Type 5        | $6                             |\n\nThe total capacity of all trucks must meet the daily demand of 1000 tons. The company has a budget to purchase at most 50 trucks in total. The number of type 1 trucks must not exceed 20% of the total number of trucks. The number of type 5 trucks must be at least 10% of the total number of trucks.\nPlease help the company to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The total capacity of all trucks must meet the daily demand of 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n# The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# The number of type 1 trucks must not exceed 20% of the total number of trucks.\nmodel.addCons(T1 <= 0.2 * (T1 + T2 + T3 + T4 + T5))\n# The number of type 5 trucks must be at least 10% of the total number of trucks.\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour. However, the production of laptops incurs an additional maintenance cost of $50 per hour due to complex machinery. The objective is to maximize the total daily profit.\n// The objective function is: Maximize P = 100S + 150T + (200L - 50L) = 100S + 150T + 150L\n\n## Generate Constraint-1:\nThe total available production hours per day across all lines is 24 hours.\n// S + T + L <= 24\n\n## Generate Constraint-2:\nDue to labor regulations, the tablet production line cannot operate more than 10 hours a day.\n// T <= 10\n\n## Generate Constraint-3:\nThe demand for smartphones requires at least 5 hours of production per day.\n// S >= 5\n\n## Generate Constraint-4:\nThe company has a contract that requires the production of at least 3 laptops per day. Given that each laptop takes 2 hours to produce, the laptop production line must operate at least 6 hours per day.\n// L >= 6 / 2 = 3\n\n## Generate Constraint-5:\nThe production of laptops and tablets cannot exceed 15 hours combined due to shared resources.\n// L + T <= 15",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour, with an additional maintenance cost of $50 per hour for laptops due to complex machinery. The company aims to maximize its daily profit.\n\n| Device       | Profit per Hour | Additional Cost per Hour |\n|--------------|-----------------|--------------------------|\n| Smartphones  | $100            | None                     |\n| Tablets      | $150            | None                     |\n| Laptops      | $200            | $50                      |\n\nThe company has the following constraints:\n- The total available production hours per day across all lines is 24 hours.\n- The tablet production line cannot operate more than 10 hours a day due to labor regulations.\n- The demand for smartphones requires at least 5 hours of production per day.\n- The company has a contract that requires the production of at least 3 laptops per day, which equates to at least 6 hours of operation for the laptop production line.\n- The production of laptops and tablets cannot exceed 15 hours combined due to shared resources.\n\nPlease help the company determine the optimal number of hours each production line should operate daily to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n## The objective function is: Maximize P = 100S + 150T + 150L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100 * S + 150 * T + 150 * L)\n\n# Add constraints\n## The total available production hours per day across all lines is 24 hours.\nmodel.addCons(S + T + L <= 24)\n## Due to labor regulations, the tablet production line cannot operate more than 10 hours a day.\nmodel.addCons(T <= 10)\n## The demand for smartphones requires at least 5 hours of production per day.\nmodel.addCons(S >= 5)\n## The company has a contract that requires the production of at least 3 laptops per day. Given that each laptop takes 2 hours to produce, the laptop production line must operate at least 6 hours per day.\nmodel.addCons(L >= 3)\n## The production of laptops and tablets cannot exceed 15 hours combined due to shared resources.\nmodel.addCons(L + T <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1522,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource usage varies with the level of investment in automation technology. The company also needs to decide on the investment amount in automation to optimize production efficiency.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductA\": \"MaterialsA\", \"range\": \"MaterialsA >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductB\": \"MaterialsB\", \"range\": \"MaterialsB >= 0\", \"type\": \"continuous\"}\n// {\"raw materials per unit of ProductC\": \"MaterialsC\", \"range\": \"MaterialsC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor and raw materials decreases by 1% for every $10,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The initial raw material cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The revenue per unit for ProductA is $100, for ProductB is $120, and for ProductC is $140. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 + 0.01 * AutomationInvestment) * LaborA - (30 + 0.01 * AutomationInvestment) * MaterialsA) * UnitsA\n// Total profit for ProductB: ProfitB = (120 - (60 + 0.01 * AutomationInvestment) * LaborB - (40 + 0.01 * AutomationInvestment) * MaterialsB) * UnitsB\n// Total profit for ProductC: ProfitC = (140 - (70 + 0.01 * AutomationInvestment) * LaborC - (50 + 0.01 * AutomationInvestment) * MaterialsC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 800 units of raw materials available.\n// MaterialsA * UnitsA + MaterialsB * UnitsB + MaterialsC * UnitsC <= 800\n\n## Generate Constraint-3:\nThe total investment in automation cannot exceed $50,000.\n// AutomationInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The efficiency of resource usage varies with the level of investment in automation technology. The company also needs to decide on the investment amount in automation to optimize production efficiency.\nThe cost of labor and raw materials decreases by 1% for every $10,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The initial raw material cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The revenue per unit for ProductA is $100, for ProductB is $120, and for ProductC is $140. The company aims to maximize the total profit from all products.\nThe company has a total of 1000 labor hours available. The company has a total of 800 units of raw materials available. The total investment in automation cannot exceed $50,000.\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0) # labor hours per unit of ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0) # labor hours per unit of ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0) # labor hours per unit of ProductC\nMaterialsA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialsA\", lb=0) # raw materials per unit of ProductA\nMaterialsB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialsB\", lb=0) # raw materials per unit of ProductB\nMaterialsC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaterialsC\", lb=0) # raw materials per unit of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation\n\n# Define objective function\nProfitA = (100 - (50 + 0.01 * AutomationInvestment) * LaborA - (30 + 0.01 * AutomationInvestment) * MaterialsA) * UnitsA\nProfitB = (120 - (60 + 0.01 * AutomationInvestment) * LaborB - (40 + 0.01 * AutomationInvestment) * MaterialsB) * UnitsB\nProfitC = (140 - (70 + 0.01 * AutomationInvestment) * LaborC - (50 + 0.01 * AutomationInvestment) * MaterialsC) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 1000)\nmodel.addCons(MaterialsA * UnitsA + MaterialsB * UnitsB + MaterialsC * UnitsC <= 800)\nmodel.addCons(AutomationInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor hours per unit of ProductA: \", model.getVal(LaborA))\n    print(\"Labor hours per unit of ProductB: \", model.getVal(LaborB))\n    print(\"Labor hours per unit of ProductC: \", model.getVal(LaborC))\n    print(\"Raw materials per unit of ProductA: \", model.getVal(MaterialsA))\n    print(\"Raw materials per unit of ProductB: \", model.getVal(MaterialsB))\n    print(\"Raw materials per unit of ProductC: \", model.getVal(MaterialsC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption rate of Truck1\": \"Truck1_FuelRate\", \"range\": \"Truck1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck2\": \"Truck2_FuelRate\", \"range\": \"Truck2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck3\": \"Truck3_FuelRate\", \"range\": \"Truck3_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van1\": \"Van1_FuelRate\", \"range\": \"Van1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van2\": \"Van2_FuelRate\", \"range\": \"Van2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"speed of Truck1\": \"Truck1_Speed\", \"range\": \"Truck1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck2\": \"Truck2_Speed\", \"range\": \"Truck2_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck3\": \"Truck3_Speed\", \"range\": \"Truck3_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van1\": \"Van1_Speed\", \"range\": \"Van1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van2\": \"Van2_Speed\", \"range\": \"Van2_Speed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type.\n// Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\n// So, the objective function is: Minimize Objective\n\n## Generate Constraint-1:\nThe total fuel consumption for all vehicles must not exceed 1000 liters.\n// Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed. The company wants to minimize the total time and fuel consumption for all deliveries by minimizing the product of fuel consumption rate and speed for each vehicle type. The total fuel consumption for all vehicles must not exceed 1000 liters.\n\nPlease help the company determine the optimal fuel consumption rates and speeds for each vehicle type to achieve this objective.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_FuelRate\", lb=0)\nTruck2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_FuelRate\", lb=0)\nTruck3_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_FuelRate\", lb=0)\nVan1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_FuelRate\", lb=0)\nVan2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_FuelRate\", lb=0)\nTruck1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_Speed\", lb=0)\nTruck2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_Speed\", lb=0)\nTruck3_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_Speed\", lb=0)\nVan1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_Speed\", lb=0)\nVan2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_Speed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\nmodel.addCons(obj == Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed)\n\n# Add constraints\n## The total fuel consumption for all vehicles must not exceed 1000 liters.\nmodel.addCons(Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption Rate of Truck1: \", model.getVal(Truck1_FuelRate))\n    print(\"Fuel Consumption Rate of Truck2: \", model.getVal(Truck2_FuelRate))\n    print(\"Fuel Consumption Rate of Truck3: \", model.getVal(Truck3_FuelRate))\n    print(\"Fuel Consumption Rate of Van1: \", model.getVal(Van1_FuelRate))\n    print(\"Fuel Consumption Rate of Van2: \", model.getVal(Van2_FuelRate))\n    print(\"Speed of Truck1: \", model.getVal(Truck1_Speed))\n    print(\"Speed of Truck2: \", model.getVal(Truck2_Speed))\n    print(\"Speed of Truck3: \", model.getVal(Truck3_Speed))\n    print(\"Speed of Van1: \", model.getVal(Van1_Speed))\n    print(\"Speed of Van2: \", model.getVal(Van2_Speed))\n    print(\"Minimized Objective Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 597,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software for Small trucks\": \"SoftwareSmall\", \"range\": \"SoftwareSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Medium trucks\": \"SoftwareMedium\", \"range\": \"SoftwareMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Large trucks\": \"SoftwareLarge\", \"range\": \"SoftwareLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\n// Total operational cost for Medium trucks: CostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\n// Total operational cost for Large trucks: CostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software.\n// 1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks should not exceed 500.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 500\n\n## Generate Constraint-3:\nThe company must purchase at least 50 Small trucks and 100 Medium trucks.\n// SmallTrucks >= 50; MediumTrucks >= 100",
        "question": "A logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck. The operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n\n| Truck Type | Operational Cost per Truck | Decrease in Cost per $1000 Software Investment |\n|------------|-----------------------------|-------------------------------------------------|\n| Small      | $1000                       | $50                                             |\n| Medium     | $1500                       | $75                                             |\n| Large      | $2000                       | $100                                            |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software. The total number of trucks should not exceed 500. The company must purchase at least 50 Small trucks and 100 Medium trucks.\n\nPlease help the company determine the optimal number of each type of truck to purchase and the investment in fleet management software to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=50)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=100)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nSoftwareSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareSmall\", lb=0)  # investment in fleet management software for Small trucks\nSoftwareMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareMedium\", lb=0)  # investment in fleet management software for Medium trucks\nSoftwareLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareLarge\", lb=0)  # investment in fleet management software for Large trucks\n\n# Define objective function\nCostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\nCostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\nCostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Software for Small Trucks: \", model.getVal(SoftwareSmall))\n    print(\"Investment in Software for Medium Trucks: \", model.getVal(SoftwareMedium))\n    print(\"Investment in Software for Large Trucks: \", model.getVal(SoftwareLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1775,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials.\n// {\"number of trucks for Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel.\nFor Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel.\nFor Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel.\nFor Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel.\nFor Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel.\nThe company wants to maximize the revenue-to-fuel ratio for the entire fleet.\n// Total Revenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total Fuel Consumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n// So, the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials. For Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel. For Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel. For Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel. For Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel. For Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel. The company has a total of 100 trucks available. The company wants to maximize the revenue-to-fuel ratio for the entire fleet. Please help the company determine the optimal number of trucks to allocate to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalRevenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nTotalFuelConsumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n## the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n## convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TruckE))\n    print(\"Maximized Revenue-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n// Net profit of M1: Profit_M1 = (5000 - 3000 - 500) * M1\n// Net profit of M2: Profit_M2 = (7000 - 4000 - 700) * M2\n// Net profit of M3: Profit_M3 = (9000 - 5000 - 900) * M3\n// Net profit of M4: Profit_M4 = (11000 - 6000 - 1100) * M4\n// Net profit of M5: Profit_M5 = (13000 - 7000 - 1300) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (M1 + M2 + M3 + M4 + M5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for production costs next month.\n// 3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine next month.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a maintenance budget of $50,000 for next month.\n// 500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\n// M4 <= M1 + M2\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3.\n// M5 <= M1 + M2 + M3",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy. The selling price, production cost, and maintenance cost per unit for each machine are given in the following Table.\n\n| Machine | Selling Price | Production Cost | Maintenance Cost per Unit |\n|---------|---------------|-----------------|---------------------------|\n| M1      | $5000         | $3000           | $500                      |\n| M2      | $7000         | $4000           | $700                      |\n| M3      | $9000         | $5000           | $900                      |\n| M4      | $11000        | $6000           | $1100                     |\n| M5      | $13000        | $7000           | $1300                     |\n\nThe company has a budget of $500,000 for production costs next month. The company wants to produce at least 5 units of each machine next month. The company has a maintenance budget of $50,000 for next month. The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2. The company also wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3. \n\nPlease help the company to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine next month.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (5000 - 3000 - 500) * M1\nProfit_M2 = (7000 - 4000 - 700) * M2\nProfit_M3 = (9000 - 5000 - 900) * M3\nProfit_M4 = (11000 - 6000 - 1100) * M4\nProfit_M5 = (13000 - 7000 - 1300) * M5\nTotalProduction = M1 + M2 + M3 + M4 + M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $500,000 for production costs next month.\nmodel.addCons(3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500000)\n## The company has a maintenance budget of $50,000 for next month.\nmodel.addCons(500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50000)\n## The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\nmodel.addCons(M4 <= M1 + M2)\n## The company wants to ensure that the total production of Machine M5 does not exceed the combined production of Machines M1, M2, and M3.\nmodel.addCons(M5 <= M1 + M2 + M3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Net Profit per Unit of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1487,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel.\n// {\"number of solar panels for Type A\": \"PanelsA\", \"range\": \"PanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type B\": \"PanelsB\", \"range\": \"PanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Type C\": \"PanelsC\", \"range\": \"PanelsC >= 0\", \"type\": \"integer\"}\n// {\"efficiency level of solar panels for Type A\": \"EfficiencyA\", \"range\": \"0 < EfficiencyA < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type B\": \"EfficiencyB\", \"range\": \"0 < EfficiencyB < 1\", \"type\": \"real\"}\n// {\"efficiency level of solar panels for Type C\": \"EfficiencyC\", \"range\": \"0 < EfficiencyC < 1\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings.\n// Cost = 1000 * (PanelsA + PanelsB + PanelsC)\n// Energy_A = 100 * PanelsA * EfficiencyA\n// Energy_B = 150 * PanelsB * EfficiencyB\n// Energy_C = 200 * PanelsC * EfficiencyC\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated must meet or exceed the total energy consumption of all buildings.\n// Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC)\n\n## Generate Constraint-2:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 1000 * (PanelsA + PanelsB + PanelsC) <= 50000\n\n## Generate Constraint-3:\nThe city has a limit on the total number of solar panels that can be installed, which is 50.\n// PanelsA + PanelsB + PanelsC <= 50\n\n## Generate Constraint-4:\nThe efficiency of solar panels must be at least 0.8 for Type A buildings.\n// EfficiencyA >= 0.8",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified three types of buildings (Type A, Type B, and Type C) with different roof sizes and energy consumption patterns. The city needs to determine the number of solar panels to install on each type of building and the efficiency level of each panel. The cost of installing a solar panel is $1000, and the energy generated per panel per day is proportional to its efficiency. The energy consumption of Type A, Type B, and Type C buildings are 100 kWh, 150 kWh, and 200 kWh per day, respectively. The city wants to minimize the total cost of installation while ensuring that the total energy generated meets or exceeds the total energy consumption of all buildings.\n\n| Building Type | Energy Consumption per Day |\n|---------------|----------------------------|\n| Type A        | 100 kWh                    |\n| Type B        | 150 kWh                    |\n| Type C        | 200 kWh                    |\n\nThe city has a budget of $50,000 for the installation of solar panels. The city has a limit on the total number of solar panels that can be installed, which is 50. The efficiency of solar panels must be at least 0.8 for Type A buildings.\n\nPlease help the city to determine the optimal number of solar panels and their efficiency levels to minimize the total cost of installation while meeting the energy requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelsA = model.addVar(vtype=\"INTEGER\", name=\"PanelsA\", lb=0) # number of solar panels for Type A\nPanelsB = model.addVar(vtype=\"INTEGER\", name=\"PanelsB\", lb=0) # number of solar panels for Type B\nPanelsC = model.addVar(vtype=\"INTEGER\", name=\"PanelsC\", lb=0) # number of solar panels for Type C\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0.8, ub=1) # efficiency level of solar panels for Type A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0, ub=1) # efficiency level of solar panels for Type B\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0, ub=1) # efficiency level of solar panels for Type C\n\n# Define objective function\nCost = 1000 * (PanelsA + PanelsB + PanelsC)\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n# The total energy generated must meet or exceed the total energy consumption of all buildings.\nEnergy_A = 100 * PanelsA * EfficiencyA\nEnergy_B = 150 * PanelsB * EfficiencyB\nEnergy_C = 200 * PanelsC * EfficiencyC\nmodel.addCons(Energy_A + Energy_B + Energy_C >= 100 * (PanelsA + PanelsB + PanelsC))\n\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(1000 * (PanelsA + PanelsB + PanelsC) <= 50000)\n\n# The city has a limit on the total number of solar panels that can be installed, which is 50.\nmodel.addCons(PanelsA + PanelsB + PanelsC <= 50)\n\n# The efficiency of solar panels must be at least 0.8 for Type A buildings.\nmodel.addCons(EfficiencyA >= 0.8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Type A: \", model.getVal(PanelsA))\n    print(\"Number of Solar Panels for Type B: \", model.getVal(PanelsB))\n    print(\"Number of Solar Panels for Type C: \", model.getVal(PanelsC))\n    print(\"Efficiency of Solar Panels for Type A: \", model.getVal(EfficiencyA))\n    print(\"Efficiency of Solar Panels for Type B: \", model.getVal(EfficiencyB))\n    print(\"Efficiency of Solar Panels for Type C: \", model.getVal(EfficiencyC))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1441,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the investment in a new fuel-efficient technology that can be applied to each type of truck to reduce fuel consumption and maintenance costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small trucks\": \"TechSmall\", \"range\": \"TechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"TechMedium\", \"range\": \"TechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large trucks\": \"TechLarge\", \"range\": \"TechLarge >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Extra-Large trucks\": \"TechExtraLarge\", \"range\": \"TechExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves by 1% for every $1,000 invested in the fuel-efficient technology. The company aims to minimize the total annual operating cost, which includes fuel and maintenance costs. The initial fuel cost per mile for Small trucks is $0.50, for Medium trucks is $0.60, for Large trucks is $0.70, and for Extra-Large trucks is $0.80. The initial maintenance cost per year for each type of truck is $5,000, $6,000, $7,000, and $8,000 respectively.\n// Total fuel cost for Small trucks: FuelSmall = 0.50 * (1 - 0.001 * TechSmall) * SmallTrucks\n// Total fuel cost for Medium trucks: FuelMedium = 0.60 * (1 - 0.001 * TechMedium) * MediumTrucks\n// Total fuel cost for Large trucks: FuelLarge = 0.70 * (1 - 0.001 * TechLarge) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: FuelExtraLarge = 0.80 * (1 - 0.001 * TechExtraLarge) * ExtraLargeTrucks\n// Total maintenance cost for Small trucks: MaintSmall = 5000 * (1 - 0.01 * TechSmall) * SmallTrucks\n// Total maintenance cost for Medium trucks: MaintMedium = 6000 * (1 - 0.01 * TechMedium) * MediumTrucks\n// Total maintenance cost for Large trucks: MaintLarge = 7000 * (1 - 0.01 * TechLarge) * LargeTrucks\n// Total maintenance cost for Extra-Large trucks: MaintExtraLarge = 8000 * (1 - 0.01 * TechExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Minimize (FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + MaintSmall + MaintMedium + MaintLarge + MaintExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks and investing in fuel-efficient technology.\n// SmallTrucks * 50000 + MediumTrucks * 60000 + LargeTrucks * 70000 + ExtraLargeTrucks * 80000 + TechSmall + TechMedium + TechLarge + TechExtraLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100\n\n## Generate Constraint-3:\nThe company must have at least 10 Small trucks and 15 Extra-Large trucks.\n// SmallTrucks >= 10; ExtraLargeTrucks >= 15",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the investment in a new fuel-efficient technology that can be applied to each type of truck to reduce fuel consumption and maintenance costs. The fuel efficiency of each truck type improves by 1% for every $1,000 invested in the fuel-efficient technology. The company aims to minimize the total annual operating cost, which includes fuel and maintenance costs. The initial fuel cost per mile for Small trucks is $0.50, for Medium trucks is $0.60, for Large trucks is $0.70, and for Extra-Large trucks is $0.80. The initial maintenance cost per year for each type of truck is $5,000, $6,000, $7,000, and $8,000 respectively. The company has a budget of $1,000,000 for purchasing new trucks and investing in fuel-efficient technology. The total number of trucks cannot exceed 100. The company must have at least 10 Small trucks and 15 Extra-Large trucks.\n\nPlease help the company to minimize the total annual operating cost, which includes fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechSmall\", lb=0)\nTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechMedium\", lb=0)\nTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechLarge\", lb=0)\nTechExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechExtraLarge\", lb=0)\n\n# Define objective function\nFuelSmall = 0.50 * (1 - 0.001 * TechSmall) * SmallTrucks\nFuelMedium = 0.60 * (1 - 0.001 * TechMedium) * MediumTrucks\nFuelLarge = 0.70 * (1 - 0.001 * TechLarge) * LargeTrucks\nFuelExtraLarge = 0.80 * (1 - 0.001 * TechExtraLarge) * ExtraLargeTrucks\nMaintSmall = 5000 * (1 - 0.01 * TechSmall) * SmallTrucks\nMaintMedium = 6000 * (1 - 0.01 * TechMedium) * MediumTrucks\nMaintLarge = 7000 * (1 - 0.01 * TechLarge) * LargeTrucks\nMaintExtraLarge = 8000 * (1 - 0.01 * TechExtraLarge) * ExtraLargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + MaintSmall + MaintMedium + MaintLarge + MaintExtraLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks * 50000 + MediumTrucks * 60000 + LargeTrucks * 70000 + ExtraLargeTrucks * 80000 + TechSmall + TechMedium + TechLarge + TechExtraLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100)\nmodel.addCons(SmallTrucks >= 10)\nmodel.addCons(ExtraLargeTrucks >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Tech for Small Trucks: \", model.getVal(TechSmall))\n    print(\"Investment in Tech for Medium Trucks: \", model.getVal(TechMedium))\n    print(\"Investment in Tech for Large Trucks: \", model.getVal(TechLarge))\n    print(\"Investment in Tech for Extra-Large Trucks: \", model.getVal(TechExtraLarge))\n    print(\"Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month. Additionally, the company must decide on the number of shifts to operate for each device's production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceD\": \"ShiftsD\", \"range\": \"ShiftsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company aims to maximize the total profit minus the total cost of shifts.\n// Total profit for DeviceA: ProfitA = 50 * UnitsA\n// Total profit for DeviceB: ProfitB = 70 * UnitsB\n// Total profit for DeviceC: ProfitC = 90 * UnitsC\n// Total profit for DeviceD: ProfitD = 110 * UnitsD\n// Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n// Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for shift operations.\n// 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 500 units of each device.\n// UnitsA >= 500; UnitsB >= 500; UnitsC >= 500; UnitsD >= 500\n\n## Generate Constraint-3:\nThe company can operate a maximum of 50 shifts in total.\n// ShiftsA + ShiftsB + ShiftsC + ShiftsD <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n// UnitsD <= UnitsA + UnitsB + UnitsC\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of shifts for DeviceC is at least twice the number of shifts for DeviceA.\n// ShiftsC >= 2 * ShiftsA",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device and the number of shifts to operate for each device's production line for the next month. The profit per unit, cost per shift, and production rate for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Shift | Production Rate (units per shift) |\n|--------|-----------------|----------------|-----------------------------------|\n| DeviceA | $50             | $1000          | 10                                |\n| DeviceB | $70             | $1200          | 12                                |\n| DeviceC | $90             | $1500          | 15                                |\n| DeviceD | $110            | $1800          | 18                                |\n\nThe company has a total budget of $100,000 for shift operations. The company wants to produce at least 500 units of each device. The company can operate a maximum of 50 shifts in total. The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC. Additionally, the company wants to ensure that the number of shifts for DeviceC is at least twice the number of shifts for DeviceA.\n\nPlease help the company to maximize the total profit minus the total cost of shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=500)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=500)  # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=500)  # number of units of DeviceD\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0)  # number of shifts for DeviceA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0)  # number of shifts for DeviceB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0)  # number of shifts for DeviceC\nShiftsD = model.addVar(vtype=\"INTEGER\", name=\"ShiftsD\", lb=0)  # number of shifts for DeviceD\n\n# Define objective function\nProfitA = 50 * UnitsA\nProfitB = 70 * UnitsB\nProfitC = 90 * UnitsC\nProfitD = 110 * UnitsD\nCostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n\n# Units produced per shift\nmodel.addCons(UnitsA == 10 * ShiftsA)\nmodel.addCons(UnitsB == 12 * ShiftsB)\nmodel.addCons(UnitsC == 15 * ShiftsC)\nmodel.addCons(UnitsD == 18 * ShiftsD)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n# Add constraints\nmodel.addCons(1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100000)\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC + ShiftsD <= 50)\nmodel.addCons(UnitsD <= UnitsA + UnitsB + UnitsC)\nmodel.addCons(ShiftsC >= 2 * ShiftsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Units of DeviceD: \", model.getVal(UnitsD))\n    print(\"Number of Shifts for DeviceA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for DeviceB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for DeviceC: \", model.getVal(ShiftsC))\n    print(\"Number of Shifts for DeviceD: \", model.getVal(ShiftsD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe production capacity of DeviceA is limited to 2000 units.\n// UnitsA <= 2000\n\n## Generate Constraint-3:\nThe production capacity of DeviceB is limited to 1500 units.\n// UnitsB <= 1500\n\n## Generate Constraint-4:\nThe production capacity of DeviceC is limited to 1000 units.\n// UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the number of hours to allocate to each production line. The profit per unit and the cost of production per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Hour | Production Rate |\n|--------|-----------------|---------------|-----------------|\n| DeviceA | $50 | $30 | 0.5 * HoursA^2 |\n| DeviceB | $70 | $40 | 0.6 * HoursB^2 |\n| DeviceC | $90 | $50 | 0.7 * HoursC^2 |\n\nThe company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The total available hours for all production lines is 1000 hours. The production capacity of DeviceA is limited to 2000 units, DeviceB to 1500 units, and DeviceC to 1000 units.\n\nPlease help the company to maximize the total profit, considering the constraints on production capacity and total hours available.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours allocated to DeviceC production line\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (30 * HoursA)\nProfit_B = (70 * UnitsB) - (40 * HoursB)\nProfit_C = (90 * UnitsC) - (50 * HoursC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\nmodel.addCons(UnitsA <= 2000)\nmodel.addCons(UnitsB <= 1500)\nmodel.addCons(UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit per unit of product. \nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\nThe company aims to maximize the total profit from all products.\n// The profit from product A: P_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\n// The profit from product B: P_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\n// The profit from product C: P_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n// So, the objective function is: Maximize P = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 + W4 <= 60\n\n## Generate Constraint-2:\nEach machine can be operated by up to 20 workers at a time.\n// W1 <= 20; W2 <= 20; W3 <= 20; W4 <= 20",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. The productivity and profit per unit of each product on each machine are given in the following Table.\n\n| Machine | Productivity (units/hour) | Profit per Unit ($) |\n|---------|---------------------------|---------------------|\n| 1       | A: 10, B: 15, C: 20       | A: 5, B: 10, C: 15  |\n| 2       | A: 15, B: 20, C: 25       | A: 6, B: 11, C: 16  |\n| 3       | A: 20, B: 25, C: 30       | A: 7, B: 12, C: 17  |\n| 4       | A: 25, B: 30, C: 35       | A: 8, B: 13, C: 18  |\n\nThe company has a total of 60 workers available. Each machine can be operated by up to 20 workers at a time. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\nP_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\nP_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n# So, the objective function is: Maximize P = P_A + P_B + P_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 <= 60)\n# Each machine can be operated by up to 20 workers at a time.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\nmodel.addCons(W4 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Number of workers on machine 4: \", model.getVal(W4))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage. The company has a budget of $100,000 for purchasing vehicles. Please help the company determine the optimal number of each type of vehicle to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 612,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50\n\n## Generate Constraint-2:\nThe demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25.\n// Truck1 >= 5\n// Truck2 >= 10\n// Truck3 >= 15\n// Truck4 >= 20\n// Truck5 >= 25",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company has a total of 50 trucks available for allocation. The demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25.\n\nPlease help the company to minimize the total operational cost plus the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=10) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=15) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=20) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=25) # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n# So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city and the speed at which the trucks travel. Additionally, the company is considering investing in hybrid technology for some of its trucks to reduce fuel consumption.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks (mph)\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for City3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of the trucks is a nonlinear function of their speed and the number of trips. The fuel efficiency improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for City1: Fuel1 = (Trips1 * (0.05 * Speed^2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1^2))\n// Fuel consumption for City2: Fuel2 = (Trips2 * (0.05 * Speed^2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2^2))\n// Fuel consumption for City3: Fuel3 = (Trips3 * (0.05 * Speed^2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3^2))\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in hybrid technology and operational costs.\n// Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routing of its trucks to minimize fuel consumption and travel time. The decision variables include the number of trips each truck makes to each city, the speed at which the trucks travel, and the investment in hybrid technology for some of its trucks to reduce fuel consumption. The fuel consumption of the trucks is a nonlinear function of their speed and the number of trips, and it improves with the investment in hybrid technology. The company aims to minimize the total fuel consumption across all trips.\n\n| Variable                     | Description                                      |\n|------------------------------|--------------------------------------------------|\n| Number of trips to City1     | Trips1 (Trips1 >= 0, integer)                   |\n| Number of trips to City2     | Trips2 (Trips2 >= 0, integer)                   |\n| Number of trips to City3     | Trips3 (Trips3 >= 0, integer)                   |\n| Speed of trucks (mph)        | Speed (Speed >= 0, continuous)                  |\n| Investment in hybrid City1   | Hybrid1 (Hybrid1 >= 0, continuous)              |\n| Investment in hybrid City2   | Hybrid2 (Hybrid2 >= 0, continuous)              |\n| Investment in hybrid City3   | Hybrid3 (Hybrid3 >= 0, continuous)              |\n\nThe company has a total budget of $100,000 for investments in hybrid technology and operational costs. The total number of trips across all cities must not exceed 500.\n\nPlease help the company to determine the optimal number of trips, truck speed, and investment in hybrid technology to minimize the total fuel consumption while adhering to the budget and trip constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to City3\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)  # speed of trucks (mph)\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for City1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for City2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for City3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel1 = Trips1 * (0.05 * Speed**2 - 0.001 * Hybrid1 * Speed + 0.00002 * Hybrid1**2)\nFuel2 = Trips2 * (0.05 * Speed**2 - 0.001 * Hybrid2 * Speed + 0.00002 * Hybrid2**2)\nFuel3 = Trips3 * (0.05 * Speed**2 - 0.001 * Hybrid3 * Speed + 0.00002 * Hybrid3**2)\n## the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## The company has a total budget of $100,000 for investments in hybrid technology and operational costs.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\n## The total number of trips across all cities must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Speed of trucks: \", model.getVal(Speed))\n    print(\"Investment in hybrid technology for City1: \", model.getVal(Hybrid1))\n    print(\"Investment in hybrid technology for City2: \", model.getVal(Hybrid2))\n    print(\"Investment in hybrid technology for City3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1762,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day.\n// Fuel_Consumption_Small = 1000 / 10 * SmallTrucks\n// Fuel_Consumption_Medium = 1000 / 15 * MediumTrucks\n// Fuel_Consumption_Large = 1000 / 20 * LargeTrucks\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 per day for fuel expenses.\n// (1000 / 10 * SmallTrucks * Fuel_Cost_Small) + (1000 / 15 * MediumTrucks * Fuel_Cost_Medium) + (1000 / 20 * LargeTrucks * Fuel_Cost_Large) <= 50000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands. The fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day. The company has a total budget of $50,000 per day for fuel expenses. Please help the company to minimize the total fuel consumption per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Small = (1000 / 10) * SmallTrucks\nFuel_Consumption_Medium = (1000 / 15) * MediumTrucks\nFuel_Consumption_Large = (1000 / 20) * LargeTrucks\n## the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n# Add constraints\n## The company has a total budget of $50,000 per day for fuel expenses.\nFuel_Cost_Small = 1  # placeholder cost for small trucks\nFuel_Cost_Medium = 1.5  # placeholder cost for medium trucks\nFuel_Cost_Large = 2  # placeholder cost for large trucks\nmodel.addCons(\n    (Fuel_Consumption_Small * Fuel_Cost_Small) + (Fuel_Consumption_Medium * Fuel_Cost_Medium) + (Fuel_Consumption_Large * Fuel_Cost_Large) <= 50000\n)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will affect the operational costs and delivery times.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TruckTechInvest\", \"range\": \"TruckTechInvest >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"VanTechInvest\", \"range\": \"VanTechInvest >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"BikeTechInvest\", \"range\": \"BikeTechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per vehicle decreases with the investment in fuel-efficient technology. For Trucks, the base operational cost is $100 per day, and for every $1000 invested in technology, the cost decreases by $5 per day. For Vans, the base operational cost is $70 per day, and for every $1000 invested in technology, the cost decreases by $3 per day. For Bikes, the base operational cost is $20 per day, and for every $1000 invested in technology, the cost decreases by $1 per day. The company aims to minimize the total daily operational cost.\n// Total cost for Trucks: CostTruck = 100 - 0.005 * TruckTechInvest * TruckCount\n// Total cost for Vans: CostVan = 70 - 0.003 * VanTechInvest * VanCount\n// Total cost for Bikes: CostBike = 20 - 0.001 * BikeTechInvest * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle purchases and technology investments.\n// 100000 * TruckCount + 50000 * VanCount + 10000 * BikeCount + TruckTechInvest + VanTechInvest + BikeTechInvest <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 500.\n// TruckCount + VanCount + BikeCount <= 500\n\n## Generate Constraint-3:\nDue to regulatory requirements, at least 10% of the total vehicles must be Bikes.\n// BikeCount >= 0.1 * (TruckCount + VanCount + BikeCount)\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 Trucks are operational.\n// TruckCount >= 20",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will affect the operational costs and delivery times.\nThe operational cost per vehicle decreases with the investment in fuel-efficient technology. For Trucks, the base operational cost is $100 per day, and for every $1000 invested in technology, the cost decreases by $5 per day. For Vans, the base operational cost is $70 per day, and for every $1000 invested in technology, the cost decreases by $3 per day. For Bikes, the base operational cost is $20 per day, and for every $1000 invested in technology, the cost decreases by $1 per day. The company aims to minimize the total daily operational cost.\nThe company has a total budget of $100,000 for vehicle purchases and technology investments. The total number of vehicles cannot exceed 500. Due to regulatory requirements, at least 10% of the total vehicles must be Bikes. The company must ensure that at least 20 Trucks are operational.\nPlease help the company to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nTruckTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTechInvest\", lb=0)\nVanTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"VanTechInvest\", lb=0)\nBikeTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeTechInvest\", lb=0)\n\n# Define objective function\nCostTruck = 100 - 0.005 * TruckTechInvest * TruckCount\nCostVan = 70 - 0.003 * VanTechInvest * VanCount\nCostBike = 20 - 0.001 * BikeTechInvest * BikeCount\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(100000 * TruckCount + 50000 * VanCount + 10000 * BikeCount + TruckTechInvest + VanTechInvest + BikeTechInvest <= 100000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 500)\nmodel.addCons(BikeCount >= 0.1 * (TruckCount + VanCount + BikeCount))\nmodel.addCons(TruckCount >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTechInvest))\n    print(\"Investment in Van Tech: \", model.getVal(VanTechInvest))\n    print(\"Investment in Bike Tech: \", model.getVal(BikeTechInvest))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1316,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000\n\n## Generate Constraint-2:\nThe maintenance budget for the year is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones <= 500,000\n\n## Generate Constraint-3:\nThe company needs to ensure a minimum total capacity of 50,000 units.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50,000\n\n## Generate Constraint-4:\nThe company wants to have at least 5 different types of vehicles.\n// Trucks >= 1; Vans >= 1; Bikes >= 1; Scooters >= 1; Drones >= 1",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs, capacities, and maintenance costs. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost | Capacity | Maintenance Cost |\n|--------------|------------------|----------|------------------|\n| Trucks       | $50,000          | 1000 units | $10,000          |\n| Vans         | $30,000          | 500 units  | $5,000           |\n| Bikes        | $5,000           | 100 units  | $1,000           |\n| Scooters     | $3,000           | 50 units   | $500             |\n| Drones       | $10,000          | 200 units  | $2,000           |\n\nThe company has a budget of $2,000,000 for purchasing vehicles and a maintenance budget of $500,000 for the year. The company needs to ensure a minimum total capacity of 50,000 units. Additionally, the company wants to have at least 5 different types of vehicles. \n\nPlease help the company to minimize the total operational and maintenance costs while maximizing the total capacity, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=1)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=1)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=1)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=1)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=1)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n## The maintenance budget for the year is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones <= 500000)\n## The company needs to ensure a minimum total capacity of 50,000 units.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 500 units.\n// UnitsA <= 500\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nTo maintain market share, the company must produce at least 100 units of DeviceB.\n// UnitsB >= 100\n\n## Generate Constraint-5:\nDue to a supplier agreement, the production of DeviceC must be at least twice the production of DeviceA.\n// UnitsC >= 2 * UnitsA",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit, considering increasing marginal costs for each device.\n\nThe company has a total production capacity of 1000 units per month. Due to market saturation, the production of DeviceA should not exceed 500 units. The company has a budget of $60,000 for production costs per month. To maintain market share, the company must produce at least 100 units of DeviceB. Due to a supplier agreement, the production of DeviceC must be at least twice the production of DeviceA.\n\nPlease help the company determine the optimal number of units to produce for each device to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\n\n# Define objective function\n# Due to increasing marginal costs, quadratic terms are introduced\nProfit_A = (100 - 50) * UnitsA - 0.01 * UnitsA**2\nProfit_B = (120 - 70) * UnitsB - 0.02 * UnitsB**2\nProfit_C = (150 - 80) * UnitsC - 0.03 * UnitsC**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# Total production capacity constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# Market saturation constraint for DeviceA\nmodel.addCons(UnitsA <= 500)\n# Budget constraint for production costs\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n# Market share maintenance for DeviceB\nmodel.addCons(UnitsB >= 100)\n# Supplier agreement constraint for DeviceC\nmodel.addCons(UnitsC >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption. The company has a total of 50 trucks available for allocation. Please help the company determine the optimal number of trucks to allocate to each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n# So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and delivery speed. \n- Truck 1 consumes 10 liters per trip and delivers in 2 hours.\n- Truck 2 consumes 12 liters per trip and delivers in 1.5 hours.\n- Truck 3 consumes 15 liters per trip and delivers in 1 hour.\n- Truck 4 consumes 18 liters per trip and delivers in 1.2 hours.\n- Truck 5 consumes 20 liters per trip and delivers in 0.8 hours.\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour.\n// Total fuel cost: FuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n// Total delay time: DelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\n// Total operational cost: OperationalCost = FuelCost + DelayTime * $50\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe total number of trips required across all trucks must be at least 100.\n// T1 + T2 + T3 + T4 + T5 >= 100",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes. The fuel consumption per trip and delivery time for each truck are given in the following Table.\n\n| Truck | Fuel Consumption per Trip | Delivery Time per Trip |\n|-------|--------------------------|------------------------|\n| 1     | 10 liters                | 2 hours                |\n| 2     | 12 liters                | 1.5 hours              |\n| 3     | 15 liters                | 1 hour                 |\n| 4     | 18 liters                | 1.2 hours              |\n| 5     | 20 liters                | 0.8 hours              |\n\nThe company aims to minimize the total operational cost, which includes the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour. The total number of trips required across all trucks must be at least 100.\n\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\nDelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\nOperationalCost = FuelCost + DelayTime * 50\n## the objective function is: Minimize OperationalCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The total number of trips required across all trucks must be at least 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade (in dollars) for each type of vehicle to enhance their fuel efficiency and operational efficiency.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrade for Trucks\": \"TechUpgradeTrucks\", \"range\": \"TechUpgradeTrucks >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrade for Vans\": \"TechUpgradeVans\", \"range\": \"TechUpgradeVans >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrade for Bikes\": \"TechUpgradeBikes\", \"range\": \"TechUpgradeBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and operational efficiency of each vehicle type improve with the technology upgrade. For Trucks, each $1000 investment in technology upgrade reduces fuel consumption by 10 liters per 100 km. For Vans, each $1000 investment reduces fuel consumption by 8 liters per 100 km. For Bikes, each $1000 investment reduces fuel consumption by 2 liters per 100 km. The company aims to minimize the total annual fuel cost.\n// Fuel cost for Trucks: CostTrucks = (100 - 0.01 * TechUpgradeTrucks) * Trucks\n// Fuel cost for Vans: CostVans = (80 - 0.008 * TechUpgradeVans) * Vans\n// Fuel cost for Bikes: CostBikes = (20 - 0.002 * TechUpgradeBikes) * Bikes\n// So, the objective function is: Minimize (CostTrucks + CostVans + CostBikes)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for vehicle purchases and technology upgrades.\n// Trucks + Vans + Bikes + TechUpgradeTrucks + TechUpgradeVans + TechUpgradeBikes <= 200000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 Trucks and 100 Vans to meet operational demands.\n// Trucks >= 50; Vans >= 100",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade (in dollars) for each type of vehicle to enhance their fuel efficiency and operational efficiency. The relationship between technology upgrade investment and fuel consumption reduction for each vehicle type is given in the following Table.\n\n| Vehicle Type | Fuel Consumption Reduction per $1000 Investment |\n|--------------|------------------------------------------------|\n| Trucks       | 10 liters per 100 km                           |\n| Vans         | 8 liters per 100 km                            |\n| Bikes        | 2 liters per 100 km                            |\n\nThe company has a budget of $200,000 for vehicle purchases and technology upgrades. The company must purchase at least 50 Trucks and 100 Vans to meet operational demands. Please help the company to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechUpgradeTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeTrucks\", lb=0)  # investment in technology upgrade for Trucks\nTechUpgradeVans = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeVans\", lb=0)  # investment in technology upgrade for Vans\nTechUpgradeBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeBikes\", lb=0)  # investment in technology upgrade for Bikes\n\n# Define objective function\nCostTrucks = (100 - 0.01 * TechUpgradeTrucks) * Trucks\nCostVans = (80 - 0.008 * TechUpgradeVans) * Vans\nCostBikes = (20 - 0.002 * TechUpgradeBikes) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTrucks + CostVans + CostBikes)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes + TechUpgradeTrucks + TechUpgradeVans + TechUpgradeBikes <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Technology Upgrade for Trucks: \", model.getVal(TechUpgradeTrucks))\n    print(\"Investment in Technology Upgrade for Vans: \", model.getVal(TechUpgradeVans))\n    print(\"Investment in Technology Upgrade for Bikes: \", model.getVal(TechUpgradeBikes))\n    print(\"Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company aims to maximize the total profit from the production of these three products.\n// Profit_A = A * (50 - 20)\n// Profit_B = B * (70 - 30)\n// Profit_C = C * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 20 * A + 30 * B + 25 * C <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe production of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 2.5 hours. The total labor hours available per day are 1200 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available. The profit per unit and the cost of production per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $20                         |\n| B       | $70             | $30                         |\n| C       | $60             | $25                         |\n\nThe company has a total budget of $10,000 for production costs. The total production capacity of the company is limited to 500 units per day. The production of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 2.5 hours. The total labor hours available per day are 1200 hours.\n\nPlease help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = A * (50 - 20)\nProfit_B = B * (70 - 30)\nProfit_C = C * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C <= 10000) # Total budget constraint\nmodel.addCons(A + B + C <= 500) # Total production capacity constraint\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1200) # Total labor hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency of each truck type.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks (km/liter)\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n// Total fuel cost for Region A: Cost_A = (500 / FuelEfficiency) * TrucksA * 1.5\n// Total fuel cost for Region B: Cost_B = (500 / FuelEfficiency) * TrucksB * 1.5\n// Total fuel cost for Region C: Cost_C = (500 / FuelEfficiency) * TrucksC * 1.5\n// Total fuel cost for Region D: Cost_D = (500 / FuelEfficiency) * TrucksD * 1.5\n// Total fuel cost for Region E: Cost_E = (500 / FuelEfficiency) * TrucksE * 1.5\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, Region A must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency of each truck type. The cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n\n| Region | Number of Trucks | Fuel Efficiency (km/liter) |\n|--------|------------------|---------------------------|\n| A      | TrucksA          | FuelEfficiency            |\n| B      | TrucksB          | FuelEfficiency            |\n| C      | TrucksC          | FuelEfficiency            |\n| D      | TrucksD          | FuelEfficiency            |\n| E      | TrucksE          | FuelEfficiency            |\n\nThe company has a total of 50 trucks available. Due to regional regulations, Region A must have at least 10% of the total trucks. Please help the company to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Region C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for Region D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for Region E\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=0) # fuel efficiency of trucks (km/liter)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (500 / FuelEfficiency) * TrucksA * 1.5\nCost_B = (500 / FuelEfficiency) * TrucksB * 1.5\nCost_C = (500 / FuelEfficiency) * TrucksC * 1.5\nCost_D = (500 / FuelEfficiency) * TrucksD * 1.5\nCost_E = (500 / FuelEfficiency) * TrucksE * 1.5\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to regional regulations, Region A must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Region D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Region E: \", model.getVal(TrucksE))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.1 for each unit produced after the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.05 for each unit produced after the first 200 units. The profit per unit for ComponentC is $80, but it decreases by $0.08 for each unit produced after the first 150 units. The profit per unit for ComponentD is $60, but it decreases by $0.06 for each unit produced after the first 120 units. The profit per unit for ComponentE is $90, but it decreases by $0.1 for each unit produced after the first 180 units. The company wants to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\n// Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\n// Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB.\n// UnitsA >= 0.5 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of component is produced at least 50 units per month to meet minimum order requirements.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50; UnitsD >= 50; UnitsE >= 50",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit. The profit per unit for ComponentA is $50, but it decreases by $0.1 for each unit produced after the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.05 for each unit produced after the first 200 units. The profit per unit for ComponentC is $80, but it decreases by $0.08 for each unit produced after the first 150 units. The profit per unit for ComponentD is $60, but it decreases by $0.06 for each unit produced after the first 120 units. The profit per unit for ComponentE is $90, but it decreases by $0.1 for each unit produced after the first 180 units. The company has a total production capacity of 1000 units per month. Due to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB. The company has a budget of $50,000 for raw materials per month. The company wants to ensure that each type of component is produced at least 50 units per month to meet minimum order requirements. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50)  # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=50)  # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=50)  # number of units of ComponentE\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=1000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=150)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=150, ub=1000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (80 - 0.08 * (C2 - 150)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=120)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=120, ub=1000)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(UnitsD == D1*D_b1 + D2*D_b2)\nProfit_D = (60 - 0.06 * (D2 - 120)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=180)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=180, ub=1000)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(UnitsE == E1*E_b1 + E2*E_b2)\nProfit_E = (90 - 0.1 * (E2 - 180)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\nmodel.addCons(UnitsA >= 0.5 * UnitsB)\nmodel.addCons(10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1266,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Region1\": \"FuelTech1\", \"range\": \"FuelTech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region2\": \"FuelTech2\", \"range\": \"FuelTech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region3\": \"FuelTech3\", \"range\": \"FuelTech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n// Total profit for Region1: Profit1 = (1000 + 0.1 * FuelTech1) * Trucks1\n// Total profit for Region2: Profit2 = (1200 + 0.12 * FuelTech2) * Trucks2\n// Total profit for Region3: Profit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed across all regions is limited to 100 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies. The total number of trucks that can be deployed across all regions is limited to 100 trucks. Due to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\n\nPlease help the company to maximize the total profit from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region3\nFuelTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech1\", lb=0)  # investment in alternative fuel technology for Region1\nFuelTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech2\", lb=0)  # investment in alternative fuel technology for Region2\nFuelTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech3\", lb=0)  # investment in alternative fuel technology for Region3\n\n# Define objective function\nProfit1 = (1000 + 0.1 * FuelTech1) * Trucks1\nProfit2 = (1200 + 0.12 * FuelTech2) * Trucks2\nProfit3 = (1100 + 0.11 * FuelTech3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Tech for Region1: \", model.getVal(FuelTech1))\n    print(\"Investment in Fuel Tech for Region2: \", model.getVal(FuelTech2))\n    print(\"Investment in Fuel Tech for Region3: \", model.getVal(FuelTech3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1388,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\n// NetProfit_Small = (200 - 50) * SmallVehicles\n// NetProfit_Medium = (300 - 75) * MediumVehicles\n// NetProfit_Large = (400 - 100) * LargeVehicles\n// So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs.\n// 50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000\n\n## Generate Constraint-2:\nThe company has a limited parking space that can accommodate a maximum of 100 vehicles.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 100\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all vehicles must not exceed 1000 units. The emission rate per vehicle is 5 units for small, 10 units for medium, and 15 units for large.\n// 5 * SmallVehicles + 10 * MediumVehicles + 15 * LargeVehicles <= 1000",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs. The company has a limited parking space that can accommodate a maximum of 100 vehicles. Due to environmental regulations, the total emissions from all vehicles must not exceed 1000 units. The emission rate per vehicle is 5 units for small, 10 units for medium, and 15 units for large.\nPlease help the company to maximize the net daily profit from all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nNetProfit_Small = (200 - 50) * SmallVehicles\nNetProfit_Medium = (300 - 75) * MediumVehicles\nNetProfit_Large = (400 - 100) * LargeVehicles\n# So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n# Add constraints\n# The company has a total budget of $5000 per day for vehicle maintenance and operational costs.\nmodel.addCons(50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000)\n# The company has a limited parking space that can accommodate a maximum of 100 vehicles.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 100)\n# Due to environmental regulations, the total emissions from all vehicles must not exceed 1000 units.\nmodel.addCons(5 * SmallVehicles + 10 * MediumVehicles + 15 * LargeVehicles <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the overall operational cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of each truck type is a nonlinear function of the number of trucks and drivers. The cost includes fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is linearly dependent on the number of drivers, at $3000 per driver. The company aims to minimize the total operational cost.\n// Total operational cost: Cost = (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for vehicle operations and driver salaries.\n// (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers <= 150000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 500 tons. Each Small truck carries 1 ton, each Medium truck carries 2 tons, and each Large truck carries 3 tons.\n// SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nDue to licensing restrictions, the number of drivers must not exceed 200.\n// Drivers <= 200",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of Small, Medium, and Large trucks, as well as the number of drivers to hire. Each vehicle type has different operational costs, which include fuel, maintenance, and driver salaries, and these costs are nonlinear functions of the number of trucks and drivers. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is $3000 per driver. The company aims to minimize the total operational cost.\n\n| Vehicle Type | Cost per Kilometer | Cargo Capacity |\n|--------------|---------------------|----------------|\n| Small        | $0.5 + 0.001 * SmallTrucks^2 | 1 ton |\n| Medium       | $0.7 + 0.0015 * MediumTrucks^2 | 2 tons |\n| Large        | $1 + 0.002 * LargeTrucks^2 | 3 tons |\n\nThe company has a budget of $150,000 for vehicle operations and driver salaries. The total cargo capacity of the fleet must be at least 500 tons. Due to licensing restrictions, the number of drivers must not exceed 200.\n\nPlease help the company to minimize the total operational cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate the operational cost for each truck type\nCost_Small = (0.5 + 0.001 * SmallTrucks**2) * (SmallTrucks * Drivers)\nCost_Medium = (0.7 + 0.0015 * MediumTrucks**2) * (MediumTrucks * Drivers)\nCost_Large = (1 + 0.002 * LargeTrucks**2) * (LargeTrucks * Drivers)\nCost_Drivers = 3000 * Drivers\n\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers)\n\n# Add constraints\n## The company has a budget of $150,000 for vehicle operations and driver salaries.\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers <= 150000)\n\n## The total cargo capacity of the fleet must be at least 500 tons.\nmodel.addCons(SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500)\n\n## Due to licensing restrictions, the number of drivers must not exceed 200.\nmodel.addCons(Drivers <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n// Total operational cost for Solar: CostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\n// Total operational cost for Wind: CostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\n// Total operational cost for Hydro: CostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\n// 50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants. The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology. Please help the company to determine the optimal number of units and the investment in advanced technology for each type of power plant to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nCostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\nCostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\nCostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n# So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\nmodel.addCons(50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(TechInvestmentHydro))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Trucks\": \"EfficiencyT\", \"range\": \"EfficiencyT >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Vans\": \"EfficiencyV\", \"range\": \"EfficiencyV >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Bikes\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n// Total annual fuel cost for Trucks: CostT = (100 - 0.01 * EfficiencyT) * Trucks\n// Total annual fuel cost for Vans: CostV = (100 - 0.015 * EfficiencyV) * Vans\n// Total annual fuel cost for Bikes: CostB = (100 - 0.02 * EfficiencyB) * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\n// Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000\n\n## Generate Constraint-2:\nThe company must have at least 50 Trucks and 100 Vans to meet contractual obligations.\n// Trucks >= 50; Vans >= 100\n\n## Generate Constraint-3:\nDue to storage limitations, the total number of vehicles cannot exceed 200.\n// Trucks + Vans + Bikes <= 200\n\n## Generate Constraint-4:\nThe company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\n// Bikes >= 0.20 * (Trucks + Vans + Bikes)",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle. The fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades. The company must have at least 50 Trucks and 100 Vans to meet contractual obligations. Due to storage limitations, the total number of vehicles cannot exceed 200. The company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\n\nPlease help the company to minimize the total annual fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nEfficiencyT = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyT\", lb=0)  # investment in fuel efficiency for Trucks\nEfficiencyV = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyV\", lb=0)  # investment in fuel efficiency for Vans\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for Bikes\n\n# Define objective function\nCostT = (100 - 0.01 * EfficiencyT) * Trucks\nCostV = (100 - 0.015 * EfficiencyV) * Vans\nCostB = (100 - 0.02 * EfficiencyB) * Bikes\n# So, the objective function is: Minimize (CostT + CostV + CostB)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\n# The company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\nmodel.addCons(Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000)\n# Due to storage limitations, the total number of vehicles cannot exceed 200.\nmodel.addCons(Trucks + Vans + Bikes <= 200)\n# The company aims to have at least 20% of its fleet as Bikes for last-mile delivery services.\nmodel.addCons(Bikes >= 0.20 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Fuel Efficiency for Trucks: \", model.getVal(EfficiencyT))\n    print(\"Investment in Fuel Efficiency for Vans: \", model.getVal(EfficiencyV))\n    print(\"Investment in Fuel Efficiency for Bikes: \", model.getVal(EfficiencyB))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major regions (R1, R2, R3, R4, R5) where they need to optimize the number of trips for each region to maximize profit while minimizing fuel consumption and environmental impact.\n// {\"number of trips to region R1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to region R5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor each trip to R1, the profit is $1000, the fuel consumption is 100 liters, and the CO2 emission is 250 kg.\nFor each trip to R2, the profit is $1200, the fuel consumption is 120 liters, and the CO2 emission is 300 kg.\nFor each trip to R3, the profit is $1500, the fuel consumption is 150 liters, and the CO2 emission is 375 kg.\nFor each trip to R4, the profit is $1800, the fuel consumption is 180 liters, and the CO2 emission is 450 kg.\nFor each trip to R5, the profit is $2000, the fuel consumption is 200 liters, and the CO2 emission is 500 kg.\nThe company wants to maximize the Profit-Emission ratio (the ratio of total profit to total CO2 emissions).\n// Total Profit = 1000 * R1 + 1200 * R2 + 1500 * R3 + 1800 * R4 + 2000 * R5\n// Total CO2 Emissions = 250 * R1 + 300 * R2 + 375 * R3 + 450 * R4 + 500 * R5\n// So, the objective function is: Maximize (Total Profit) / (Total CO2 Emissions)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10000 liters.\n// 100 * R1 + 120 * R2 + 150 * R3 + 180 * R4 + 200 * R5 <= 10000\n\n## Generate Constraint-2:\nThe company can only make a maximum of 50 trips in total across all regions.\n// R1 + R2 + R3 + R4 + R5 <= 50\n\n## Generate Constraint-3:\nThe company must make at least 5 trips to region R1.\n// R1 >= 5\n\n## Generate Constraint-4:\nThe company must not exceed 15 trips to region R5 due to local regulations.\n// R5 <= 15",
        "question": "A logistics company operates a fleet of trucks to transport goods across five major regions (R1, R2, R3, R4, R5). The company needs to optimize the number of trips to each region to maximize profit while minimizing fuel consumption and environmental impact. The profit, fuel consumption, and CO2 emissions for each trip to each region are given in the following Table.\n\n| Region | Profit per Trip | Fuel Consumption per Trip | CO2 Emissions per Trip |\n|--------|-----------------|---------------------------|-------------------------|\n| R1     | $1000           | 100 liters                | 250 kg                  |\n| R2     | $1200           | 120 liters                | 300 kg                  |\n| R3     | $1500           | 150 liters                | 375 kg                  |\n| R4     | $1800           | 180 liters                | 450 kg                  |\n| R5     | $2000           | 200 liters                | 500 kg                  |\n\nThe company has a total fuel budget of 10000 liters. The company can only make a maximum of 50 trips in total across all regions. The company must make at least 5 trips to region R1. The company must not exceed 15 trips to region R5 due to local regulations.\n\nPlease help the company to maximize the Profit-Emission ratio (the ratio of total profit to total CO2 emissions).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=5)  # number of trips to region R1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0)  # number of trips to region R2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0)  # number of trips to region R3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0)  # number of trips to region R4\nR5 = model.addVar(vtype=\"INTEGER\", name=\"R5\", lb=0, ub=15)  # number of trips to region R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_Profit = 1000 * R1 + 1200 * R2 + 1500 * R3 + 1800 * R4 + 2000 * R5\nTotal_CO2_Emissions = 250 * R1 + 300 * R2 + 375 * R3 + 450 * R4 + 500 * R5\n## the objective function is: Maximize (Total Profit) / (Total CO2 Emissions)\n## convert the division to multiplication\nmodel.addCons(obj * Total_CO2_Emissions == Total_Profit)\n\n# Add constraints\n## The company has a total fuel budget of 10000 liters.\nmodel.addCons(100 * R1 + 120 * R2 + 150 * R3 + 180 * R4 + 200 * R5 <= 10000)\n## The company can only make a maximum of 50 trips in total across all regions.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to region R1: \", model.getVal(R1))\n    print(\"Number of trips to region R2: \", model.getVal(R2))\n    print(\"Number of trips to region R3: \", model.getVal(R3))\n    print(\"Number of trips to region R4: \", model.getVal(R4))\n    print(\"Number of trips to region R5: \", model.getVal(R5))\n    print(\"Maximized Profit-Emission Ratio: \", model.getObjVal() / model.getVal(Total_CO2_Emissions))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices using 5 different machines. The company needs to optimize the allocation of workers to each machine to maximize efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate based on the number of workers assigned. The efficiency is modeled as a nonlinear function where the output increases with more workers but at a decreasing rate. The efficiency function for each machine is:\n- Machine 1: E1 = 100 * M1 / (M1^2 + 1)\n- Machine 2: E2 = 120 * M2 / (M2^2 + 4)\n- Machine 3: E3 = 140 * M3 / (M3^2 + 9)\n- Machine 4: E4 = 160 * M4 / (M4^2 + 16)\n- Machine 5: E5 = 180 * M5 / (M5^2 + 25)\nThe company aims to maximize the total efficiency of all machines.\n// The objective function is: Maximize E = E1 + E2 + E3 + E4 + E5\n\n## Generate Constraint-1:\nThere are a total of 30 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 30\n\n## Generate Constraint-2:\nEach machine can handle a maximum of 10 workers at a time.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10",
        "question": "A manufacturing company produces 3 types of electronic devices using 5 different machines. The company needs to optimize the allocation of workers to each machine to maximize efficiency. Each machine has a different efficiency rate based on the number of workers assigned, modeled as a nonlinear function where the output increases with more workers but at a decreasing rate. The efficiency function for each machine is:\n- Machine 1: E1 = 100 * M1 / (M1^2 + 1)\n- Machine 2: E2 = 120 * M2 / (M2^2 + 4)\n- Machine 3: E3 = 140 * M3 / (M3^2 + 9)\n- Machine 4: E4 = 160 * M4 / (M4^2 + 16)\n- Machine 5: E5 = 180 * M5 / (M5^2 + 25)\nThe company aims to maximize the total efficiency of all machines. There are a total of 30 workers available, and each machine can handle a maximum of 10 workers at a time. Please help the company determine the optimal number of workers to assign to each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=10) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0, ub=10) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0, ub=10) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0, ub=10) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0, ub=10) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define efficiency functions\nE1 = 100 * M1 / (M1**2 + 1)\nE2 = 120 * M2 / (M2**2 + 4)\nE3 = 140 * M3 / (M3**2 + 9)\nE4 = 160 * M4 / (M4**2 + 16)\nE5 = 180 * M5 / (M5**2 + 25)\n\n## the objective function is: Maximize E = E1 + E2 + E3 + E4 + E5\n## convert the division to multiplication\nmodel.addCons(obj * (M1**2 + 1) == 100 * M1)\nmodel.addCons(obj * (M2**2 + 4) == 120 * M2)\nmodel.addCons(obj * (M3**2 + 9) == 140 * M3)\nmodel.addCons(obj * (M4**2 + 16) == 160 * M4)\nmodel.addCons(obj * (M5**2 + 25) == 180 * M5)\n\n# Add constraints\n## There are a total of 30 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. \nThe fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. \nThe fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. \nThe company aims to maximize the total distance covered by all vehicles.\n// Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n// Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n// Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n// So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter.\n// 10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles the company can purchase is limited to 10.\n// TruckA + TruckB + TruckC <= 10\n\n## Generate Constraint-3:\nDue to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it.\n// FuelA >= 1; FuelB >= 1; FuelC >= 1\n\n## Generate Constraint-4:\nThe company must purchase at least 2 TruckA and 3 TruckB due to contractual obligations.\n// TruckA >= 2; TruckB >= 3",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel. The fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. The fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. The fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. The company aims to maximize the total distance covered by all vehicles. The company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter. The total number of vehicles the company can purchase is limited to 10. Due to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it. The company must purchase at least 2 TruckA and 3 TruckB due to contractual obligations. Please help the company to maximize the total distance covered by all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\n\n# Define objective function\nDistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\nDistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\nDistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == DistanceA + DistanceB + DistanceC)\n\n# Add constraints\nmodel.addCons(10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000)\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\nmodel.addCons(FuelA >= 1)\nmodel.addCons(FuelB >= 1)\nmodel.addCons(FuelC >= 1)\nmodel.addCons(TruckA >= 2)\nmodel.addCons(TruckB >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Total Distance Covered: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50\n\n## Generate Constraint-2:\nThe firm has a budget of $3000 for raw materials per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm has a total of 50 workers available and a budget of $3000 for raw materials per day. Please help the firm to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)  # number of workers for smartphones production\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)  # number of workers for tablets production\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)  # number of workers for laptops production\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\n# So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n# The firm has a budget of $3000 for raw materials per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational cost while considering the efficiency of each vehicle type. The operational cost per vehicle is a nonlinear function of the number of vehicles, given by:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\nThe objective is to minimize the total operational cost.\n// Total operational cost = 10000 + 50 * Truck1^2 + 12000 + 40 * Truck2^2 + 8000 + 60 * Van1^2 + 9000 + 55 * Van2^2 + 5000 + 70 * Sedan^2\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle acquisition.\n// 10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 different vehicles in total.\n// Truck1 + Truck2 + Van1 + Van2 + Sedan >= 10\n\n## Generate Constraint-3:\nThe number of Sedans must not exceed 30% of the total number of vehicles.\n// Sedan <= 0.3 * (Truck1 + Truck2 + Van1 + Van2 + Sedan)\n\n## Generate Constraint-4:\nThe total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles.\n// Truck1 + Truck2 >= 0.4 * (Truck1 + Truck2 + Van1 + Van2 + Sedan)\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of vans (Van1 and Van2 combined) does not exceed 50% of the total number of vehicles.\n// Van1 + Van2 <= 0.5 * (Truck1 + Truck2 + Van1 + Van2 + Sedan)",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs. The company wants to minimize the total operational cost, which is a nonlinear function of the number of vehicles:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\n\nThe company has a budget of $500,000 for vehicle acquisition. They must have at least 10 different vehicles in total. The number of Sedans must not exceed 30% of the total number of vehicles. The total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles. The company also wants to ensure that the total number of vans (Van1 and Van2 combined) does not exceed 50% of the total number of vehicles.\n\nPlease help the company to determine the optimal number of each type of vehicle to minimize the total operational cost while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost = 10000 + 50 * Truck1^2 + 12000 + 40 * Truck2^2 + 8000 + 60 * Van1^2 + 9000 + 55 * Van2^2 + 5000 + 70 * Sedan^2\nmodel.addCons(obj == 10000 + 50 * Truck1**2 + 12000 + 40 * Truck2**2 + 8000 + 60 * Van1**2 + 9000 + 55 * Van2**2 + 5000 + 70 * Sedan**2)\n\n# Add constraints\n## The company has a budget of $500,000 for vehicle acquisition.\nmodel.addCons(10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000)\n## The company must have at least 10 different vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Van1 + Van2 + Sedan >= 10)\n## The number of Sedans must not exceed 30% of the total number of vehicles.\nmodel.addCons(Sedan <= 0.3 * (Truck1 + Truck2 + Van1 + Van2 + Sedan))\n## The total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles.\nmodel.addCons(Truck1 + Truck2 >= 0.4 * (Truck1 + Truck2 + Van1 + Van2 + Sedan))\n## The company wants to ensure that the total number of vans (Van1 and Van2 combined) does not exceed 50% of the total number of vehicles.\nmodel.addCons(Van1 + Van2 <= 0.5 * (Truck1 + Truck2 + Van1 + Van2 + Sedan))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Number of Sedan: \", model.getVal(Sedan))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"storage cost per unit of product A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit of product B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit of product C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The cost of raw materials and labor for product A is $20, product B is $30, and product C is $40. The storage cost per unit per day for product A is $5, product B is $7, and product C is $9. The company wants to maximize the total daily profit.\n// Profit_A = A * (50 - 20 - SA)\n// Profit_B = B * (70 - 30 - SB)\n// Profit_C = C * (90 - 40 - SC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total storage capacity for all products is limited to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials and labor per day.\n// 20 * A + 30 * B + 40 * C <= 5000\n\n## Generate Constraint-3:\nThe storage cost for each product must not exceed the profit per unit.\n// SA <= (50 - 20)\n// SB <= (70 - 30)\n// SC <= (90 - 40)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit of product A is $50, product B is $70, and product C is $90. The cost of raw materials and labor for product A is $20, product B is $30, and product C is $40. The storage cost per unit per day for product A is $5, product B is $7, and product C is $9. The company wants to maximize the total daily profit. The total storage capacity for all products is limited to 1000 units. The company has a budget of $5000 for raw materials and labor per day. The storage cost for each product must not exceed the profit per unit. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nSA = model.addVar(vtype=\"CONTINUOUS\", name=\"SA\", lb=0) # storage cost per unit of product A\nSB = model.addVar(vtype=\"CONTINUOUS\", name=\"SB\", lb=0) # storage cost per unit of product B\nSC = model.addVar(vtype=\"CONTINUOUS\", name=\"SC\", lb=0) # storage cost per unit of product C\n\n# Define objective function\nProfit_A = A * (50 - 20 - SA)\nProfit_B = B * (70 - 30 - SB)\nProfit_C = C * (90 - 40 - SC)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total storage capacity for all products is limited to 1000 units.\nmodel.addCons(A + B + C <= 1000)\n# The company has a budget of $5000 for raw materials and labor per day.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 5000)\n# The storage cost for each product must not exceed the profit per unit.\nmodel.addCons(SA <= 50 - 20)\nmodel.addCons(SB <= 70 - 30)\nmodel.addCons(SC <= 90 - 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Storage Cost of Product A: \", model.getVal(SA))\n    print(\"Storage Cost of Product B: \", model.getVal(SB))\n    print(\"Storage Cost of Product C: \", model.getVal(SC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to determine how many units of each truck type to deploy for an upcoming project.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the capacity is 10 tons, the fuel consumption is 5 liters per 100 km, and the cost is $100 per day.\nFor Truck B, the capacity is 15 tons, the fuel consumption is 7 liters per 100 km, and the cost is $150 per day.\nFor Truck C, the capacity is 20 tons, the fuel consumption is 9 liters per 100 km, and the cost is $200 per day.\nFor Truck D, the capacity is 25 tons, the fuel consumption is 11 liters per 100 km, and the cost is $250 per day.\nFor Truck E, the capacity is 30 tons, the fuel consumption is 13 liters per 100 km, and the cost is $300 per day.\nThe company aims to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.\n// Total capacity utilized: Capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total fuel consumed: Fuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Maximize Capacity / Fuel\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for truck leasing.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000\n\n## Generate Constraint-2:\nThe total capacity of the trucks must be at least 500 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to determine how many units of each truck type to deploy for an upcoming project.\nFor Truck A, the capacity is 10 tons, the fuel consumption is 5 liters per 100 km, and the cost is $100 per day.\nFor Truck B, the capacity is 15 tons, the fuel consumption is 7 liters per 100 km, and the cost is $150 per day.\nFor Truck C, the capacity is 20 tons, the fuel consumption is 9 liters per 100 km, and the cost is $200 per day.\nFor Truck D, the capacity is 25 tons, the fuel consumption is 11 liters per 100 km, and the cost is $250 per day.\nFor Truck E, the capacity is 30 tons, the fuel consumption is 13 liters per 100 km, and the cost is $300 per day.\nThe company has a budget of $10,000 per day for truck leasing. The total capacity of the trucks must be at least 500 tons. The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C. The company also wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nPlease help the company to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nFuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Maximize Capacity / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Capacity)\n\n# Add constraints\n## The company has a budget of $10,000 per day for truck leasing.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n## The total capacity of the trucks must be at least 500 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500)\n## The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the fuel efficiency strategy (measured in miles per gallon) for each route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency strategy for Route1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency strategy for Route2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency strategy for Route3\": \"FuelEfficiency3\", \"range\": \"FuelEfficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is a nonlinear function of the number of trucks and the fuel efficiency strategy. The cost includes fuel expenses, maintenance, and driver wages. The cost per mile decreases nonlinearly as the fuel efficiency increases. The company aims to minimize the total operational cost across all routes.\n// OperationalCost1 = (1000 / FuelEfficiency1) * Trucks1 + 50 * Trucks1\n// OperationalCost2 = (1200 / FuelEfficiency2) * Trucks2 + 60 * Trucks2\n// OperationalCost3 = (1500 / FuelEfficiency3) * Trucks3 + 70 * Trucks3\n// So, the objective function is: Minimize (OperationalCost1 + OperationalCost2 + OperationalCost3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the fuel efficiency strategy (measured in miles per gallon) for each route. The operational cost of each route is a nonlinear function of the number of trucks and the fuel efficiency strategy, which includes fuel expenses, maintenance, and driver wages. The cost per mile decreases nonlinearly as the fuel efficiency increases.\n\n| Route | Number of Trucks | Fuel Efficiency Strategy (miles per gallon) |\n|-------|------------------|-------------------------------------------|\n| 1     | Trucks1          | FuelEfficiency1                            |\n| 2     | Trucks2          | FuelEfficiency2                            |\n| 3     | Trucks3          | FuelEfficiency3                            |\n\nThe total number of trucks available in the fleet is limited to 50. The company aims to minimize the total operational cost across all routes. Please help the company determine the optimal number of trucks and fuel efficiency strategy for each route to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuelEfficiency1 = model.addVar(name=\"FuelEfficiency1\", lb=0)  # fuel efficiency strategy for Route1\nFuelEfficiency2 = model.addVar(name=\"FuelEfficiency2\", lb=0)  # fuel efficiency strategy for Route2\nFuelEfficiency3 = model.addVar(name=\"FuelEfficiency3\", lb=0)  # fuel efficiency strategy for Route3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost1 = (1000 / FuelEfficiency1) * Trucks1 + 50 * Trucks1\nOperationalCost2 = (1200 / FuelEfficiency2) * Trucks2 + 60 * Trucks2\nOperationalCost3 = (1500 / FuelEfficiency3) * Trucks3 + 70 * Trucks3\n## the objective function is: Minimize (OperationalCost1 + OperationalCost2 + OperationalCost3)\nmodel.addCons(obj == OperationalCost1 + OperationalCost2 + OperationalCost3)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency for Route1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Route2: \", model.getVal(FuelEfficiency2))\n    print(\"Fuel Efficiency for Route3: \", model.getVal(FuelEfficiency3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: Processor, Memory, Storage, Display, and Battery. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand.\n// {\"number of Processors\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n// {\"number of Memories\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Storages\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Displays\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Batteries\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Processor is $30, Memory is $20, Storage is $15, Display is $25, and Battery is $10. Due to economies of scale, the profit per unit increases by $0.02 for each component type if production exceeds 100 units. The company aims to maximize the total profit from selling these components.\n// Profit_P = max(30 + 0.02 * (P - 100), 30) * P\n// Profit_M = max(20 + 0.02 * (M - 100), 20) * M\n// Profit_S = max(15 + 0.02 * (S - 100), 15) * S\n// Profit_D = max(25 + 0.02 * (D - 100), 25) * D\n// Profit_B = max(10 + 0.02 * (B - 100), 10) * B\n// So, the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_B\n\n## Generate Constraint-1:\nThe company has a limited production capacity. The maximum number of Processors that can be produced is 200, Memories is 300, Storages is 250, Displays is 150, and Batteries is 400.\n// P <= 200; M <= 300; S <= 250; D <= 150; B <= 400\n\n## Generate Constraint-2:\nThe total production across all components must not exceed the company's overall production capacity of 800 units.\n// P + M + S + D + B <= 800",
        "question": "A manufacturing company produces five types of electronic components: Processor, Memory, Storage, Display, and Battery. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand. The profit per unit of Processor is $30, Memory is $20, Storage is $15, Display is $25, and Battery is $10. Due to economies of scale, the profit per unit increases by $0.02 for each component type if production exceeds 100 units. The company has a limited production capacity. The maximum number of Processors that can be produced is 200, Memories is 300, Storages is 250, Displays is 150, and Batteries is 400. The total production across all components must not exceed the company's overall production capacity of 800 units. Please help the company to maximize the total profit from selling these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0, ub=200) # number of Processors\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=300) # number of Memories\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=250) # number of Storages\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=150) # number of Displays\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # number of Batteries\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_P = max(30 + 0.02 * (P - 100), 30) * P\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100)\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=100, ub=200)\nP_b1 = model.addVar(vtype=\"B\", name=\"P_b1\")\nP_b2 = model.addVar(vtype=\"B\", name=\"P_b2\")\nmodel.addCons(P_b1 + P_b2 == 1)\nmodel.addCons(P == P1*P_b1 + P2*P_b2)\nProfit_P = 30 * P1 * P_b1 + (30 + 0.02 * (P2 - 100)) * P2 * P_b2\n\n## create piecewise variables for piecewise function: Profit_M = max(20 + 0.02 * (M - 100), 20) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=100)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=100, ub=300)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nProfit_M = 20 * M1 * M_b1 + (20 + 0.02 * (M2 - 100)) * M2 * M_b2\n\n## create piecewise variables for piecewise function: Profit_S = max(15 + 0.02 * (S - 100), 15) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=250)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 15 * S1 * S_b1 + (15 + 0.02 * (S2 - 100)) * S2 * S_b2\n\n## create piecewise variables for piecewise function: Profit_D = max(25 + 0.02 * (D - 100), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=150)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 + 0.02 * (D2 - 100)) * D2 * D_b2\n\n## create piecewise variables for piecewise function: Profit_B = max(10 + 0.02 * (B - 100), 10) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 10 * B1 * B_b1 + (10 + 0.02 * (B2 - 100)) * B2 * B_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_B\nmodel.addCons(obj == Profit_P + Profit_M + Profit_S + Profit_D + Profit_B)\n\n# Add constraints\nmodel.addCons(P + M + S + D + B <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Processors: \", model.getVal(P))\n    print(\"Number of Memories: \", model.getVal(M))\n    print(\"Number of Storages: \", model.getVal(S))\n    print(\"Number of Displays: \", model.getVal(D))\n    print(\"Number of Batteries: \", model.getVal(B))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed.\n// Revenue from Trucks: Revenue_T = 1000 * T\n// Revenue from Vans: Revenue_V = 700 * V\n// Revenue from Bikes: Revenue_B = 300 * B\n// Fuel consumed by Trucks: Fuel_T = 50 * T\n// Fuel consumed by Vans: Fuel_V = 30 * V\n// Fuel consumed by Bikes: Fuel_B = 5 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel consumption.\n// 50 * T + 30 * V + 5 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed. The company has a budget of $10,000 for fuel consumption and a total of 50 drivers available. Please help the company determine the optimal number of Trucks (T), Vans (V), and Bikes (B) to maximize their efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_T = 1000 * T\nRevenue_V = 700 * V\nRevenue_B = 300 * B\nFuel_T = 50 * T\nFuel_V = 30 * V\nFuel_B = 5 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_T + Fuel_V + Fuel_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel consumption.\nmodel.addCons(50 * T + 30 * V + 5 * B <= 10000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product and the level of automation to be implemented in the production process. Higher levels of automation reduce the labor cost per unit but increase the initial investment cost.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by $5 for every $1000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investments.\n// AutomationLevel <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product and the level of automation to be implemented in the production process. Higher levels of automation reduce the labor cost per unit but increase the initial investment cost. The labor cost per unit decreases by $5 for every $1000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for automation investments. The total production capacity for all products is 5000 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. Please help the company determine the optimal production quantities and automation level to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0) # level of automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\nProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\nProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationLevel <= 100000) # budget constraint for automation\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000) # total production capacity constraint\nmodel.addCons(QuantityA >= 2 * QuantityB) # market demand constraint for ProductA\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering packages across different regions. The company needs to determine the number of trucks to allocate for each region and the number of packages each truck can carry. The regions are categorized into four: Urban, Suburban, Rural, and Remote.\n// {\"number of trucks for Urban region\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban region\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural region\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Remote region\": \"RemoteTrucks\", \"range\": \"RemoteTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Urban region\": \"UrbanPackagesPerTruck\", \"range\": \"UrbanPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Suburban region\": \"SuburbanPackagesPerTruck\", \"range\": \"SuburbanPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Rural region\": \"RuralPackagesPerTruck\", \"range\": \"RuralPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Remote region\": \"RemotePackagesPerTruck\", \"range\": \"RemotePackagesPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in the Urban region is $100 per day, in the Suburban region is $150 per day, in the Rural region is $200 per day, and in the Remote region is $250 per day. The revenue generated per package delivered in each region is $20. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Revenue_Urban = 20 * UrbanTrucks * UrbanPackagesPerTruck\n// Revenue_Suburban = 20 * SuburbanTrucks * SuburbanPackagesPerTruck\n// Revenue_Rural = 20 * RuralTrucks * RuralPackagesPerTruck\n// Revenue_Remote = 20 * RemoteTrucks * RemotePackagesPerTruck\n// Cost_Urban = 100 * UrbanTrucks\n// Cost_Suburban = 150 * SuburbanTrucks\n// Cost_Rural = 200 * RuralTrucks\n// Cost_Remote = 250 * RemoteTrucks\n// So, the objective function is: Maximize (Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote) - (Cost_Urban + Cost_Suburban + Cost_Rural + Cost_Remote)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks + RemoteTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $5000 for operating costs.\n// 100 * UrbanTrucks + 150 * SuburbanTrucks + 200 * RuralTrucks + 250 * RemoteTrucks <= 5000\n\n## Generate Constraint-3:\nThe company has a daily package delivery capacity of 1000 packages.\n// UrbanTrucks * UrbanPackagesPerTruck + SuburbanTrucks * SuburbanPackagesPerTruck + RuralTrucks * RuralPackagesPerTruck + RemoteTrucks * RemotePackagesPerTruck <= 1000",
        "question": "A logistics company is planning its routes for delivering packages across different regions. The company needs to determine the number of trucks to allocate for each region and the number of packages each truck can carry. The regions are categorized into four: Urban, Suburban, Rural, and Remote.\nThe cost of operating a truck in the Urban region is $100 per day, in the Suburban region is $150 per day, in the Rural region is $200 per day, and in the Remote region is $250 per day. The revenue generated per package delivered in each region is $20. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\nThe company has a total of 50 trucks available. The company has a daily budget of $5000 for operating costs. The company has a daily package delivery capacity of 1000 packages.\nPlease help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)\nRemoteTrucks = model.addVar(vtype=\"INTEGER\", name=\"RemoteTrucks\", lb=0)\nUrbanPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"UrbanPackagesPerTruck\", lb=0)\nSuburbanPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"SuburbanPackagesPerTruck\", lb=0)\nRuralPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RuralPackagesPerTruck\", lb=0)\nRemotePackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RemotePackagesPerTruck\", lb=0)\n\n# Define objective function\nRevenue_Urban = 20 * UrbanTrucks * UrbanPackagesPerTruck\nRevenue_Suburban = 20 * SuburbanTrucks * SuburbanPackagesPerTruck\nRevenue_Rural = 20 * RuralTrucks * RuralPackagesPerTruck\nRevenue_Remote = 20 * RemoteTrucks * RemotePackagesPerTruck\nCost_Urban = 100 * UrbanTrucks\nCost_Suburban = 150 * SuburbanTrucks\nCost_Rural = 200 * RuralTrucks\nCost_Remote = 250 * RemoteTrucks\n# So, the objective function is: Maximize (Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote) - (Cost_Urban + Cost_Suburban + Cost_Rural + Cost_Remote)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote - Cost_Urban - Cost_Suburban - Cost_Rural - Cost_Remote)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks + RemoteTrucks <= 50)\n# The company has a daily budget of $5000 for operating costs.\nmodel.addCons(100 * UrbanTrucks + 150 * SuburbanTrucks + 200 * RuralTrucks + 250 * RemoteTrucks <= 5000)\n# The company has a daily package delivery capacity of 1000 packages.\nmodel.addCons(UrbanTrucks * UrbanPackagesPerTruck + SuburbanTrucks * SuburbanPackagesPerTruck + RuralTrucks * RuralPackagesPerTruck + RemoteTrucks * RemotePackagesPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Urban Region: \", model.getVal(UrbanTrucks))\n    print(\"Number of Trucks for Suburban Region: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Trucks for Rural Region: \", model.getVal(RuralTrucks))\n    print(\"Number of Trucks for Remote Region: \", model.getVal(RemoteTrucks))\n    print(\"Packages per Truck for Urban Region: \", model.getVal(UrbanPackagesPerTruck))\n    print(\"Packages per Truck for Suburban Region: \", model.getVal(SuburbanPackagesPerTruck))\n    print(\"Packages per Truck for Rural Region: \", model.getVal(RuralPackagesPerTruck))\n    print(\"Packages per Truck for Remote Region: \", model.getVal(RemotePackagesPerTruck))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand.\n// {\"quantity of Chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of Chemical A is $100, with a production cost of $60 per unit. Chemical B has a revenue of $150 per unit and a production cost of $90 per unit. Chemical C has a revenue of $200 per unit and a production cost of $120 per unit. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 60 * A\n// Profit_B = 150 * B - 90 * B\n// Profit_C = 200 * C - 120 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit.\n// 5 * A + 8 * B + 10 * C <= 2000\n\n## Generate Constraint-2:\nThe company has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit.\n// 60 * A + 90 * B + 120 * C <= 150,000\n\n## Generate Constraint-3:\nThe market demand for Chemical A is 1000 units. So, the company can only sell a maximum of 1000 units of Chemical A.\n// A <= 1000",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand.\nThe revenue per unit of Chemical A is $100, with a production cost of $60 per unit. Chemical B has a revenue of $150 per unit and a production cost of $90 per unit. Chemical C has a revenue of $200 per unit and a production cost of $120 per unit. The company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit. The company has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit. The market demand for Chemical A is 1000 units. So, the company can only sell a maximum of 1000 units of Chemical A.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # quantity of Chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chemical C\n\n# Define objective function\nProfit_A = 100 * A - 60 * A\nProfit_B = 150 * B - 90 * B\nProfit_C = 200 * C - 120 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a limited storage capacity of 2000 cubic meters.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 2000)\n# The company has a production budget of $150,000.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold.\n// Cost of route A: Cost_A = 2 * A\n// Cost of route B: Cost_B = 3 * B\n// Cost of route C: Cost_C = 4 * C\n// Cost of route D: Cost_D = 5 * D\n// Cost of route E: Cost_E = 6 * E\n// Time spent on route A: Time_A = 1 / 30 * A\n// Time spent on route B: Time_B = 1 / 40 * B\n// Time spent on route C: Time_C = 1 / 50 * C\n// Time spent on route D: Time_D = 1 / 60 * D\n// Time spent on route E: Time_E = 1 / 70 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to the constraint that Time_A + Time_B + Time_C + Time_D + Time_E <= T_max\n\n## Generate Constraint-1:\nThe total time spent on all routes must not exceed 100 hours.\n// (1 / 30 * A) + (1 / 40 * B) + (1 / 50 * C) + (1 / 60 * D) + (1 / 70 * E) <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000\n\n## Generate Constraint-3:\nThe number of trucks allocated to each route must not exceed 10.\n// A <= 10; B <= 10; C <= 10; D <= 10; E <= 10\n\n## Generate Constraint-4:\nThe company must allocate at least 2 trucks to each route.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and average speed for each route are given in the following Table.\n\n| Route | Cost per Mile | Average Speed |\n|-------|---------------|---------------|\n| A     | $2            | 30 mph        |\n| B     | $3            | 40 mph        |\n| C     | $4            | 50 mph        |\n| D     | $5            | 60 mph        |\n| E     | $6            | 70 mph        |\n\nThe company has a budget of $2000 for operational costs. The total time spent on all routes must not exceed 100 hours. The number of trucks allocated to each route must not exceed 10, and the company must allocate at least 2 trucks to each route. \nPlease help the company to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed the given threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2, ub=10) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2, ub=10) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2, ub=10) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2, ub=10) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2, ub=10) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * A\nCost_B = 3 * B\nCost_C = 4 * C\nCost_D = 5 * D\nCost_E = 6 * E\nTime_A = 1 / 30 * A\nTime_B = 1 / 40 * B\nTime_C = 1 / 50 * C\nTime_D = 1 / 60 * D\nTime_E = 1 / 70 * E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The total time spent on all routes must not exceed 100 hours.\nmodel.addCons(Time_A + Time_B + Time_C + Time_D + Time_E <= 100)\n# The company has a budget of $2000 for operational costs.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000)\n# The number of trucks allocated to each route must not exceed 10.\nmodel.addCons(A <= 10)\nmodel.addCons(B <= 10)\nmodel.addCons(C <= 10)\nmodel.addCons(D <= 10)\nmodel.addCons(E <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Quantity\", \"range\": \"DeviceD_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceE_Quantity\", \"range\": \"DeviceE_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. \nThe profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units.\nThe profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units.\nThe profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all devices.\n// Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\n// Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\n// Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\n// Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\n// Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. \nThe profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units.\nThe profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units.\nThe profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units.\nThe company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\nDeviceD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity\", lb=0)\nDeviceE_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\nDeviceA_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity1\", lb=0, ub=100)\nDeviceA_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA_Quantity == DeviceA_Quantity1*DeviceA_b1 + DeviceA_Quantity2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * (DeviceA_Quantity2 - 100)) * DeviceA_Quantity2 * DeviceA_b2 + 50 * DeviceA_Quantity1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\nDeviceB_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity1\", lb=0, ub=200)\nDeviceB_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB_Quantity == DeviceB_Quantity1*DeviceB_b1 + DeviceB_Quantity2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.2 * (DeviceB_Quantity2 - 200)) * DeviceB_Quantity2 * DeviceB_b2 + 70 * DeviceB_Quantity1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\nDeviceC_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity1\", lb=0, ub=300)\nDeviceC_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity2\", lb=300, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC_Quantity == DeviceC_Quantity1*DeviceC_b1 + DeviceC_Quantity2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.3 * (DeviceC_Quantity2 - 300)) * DeviceC_Quantity2 * DeviceC_b2 + 90 * DeviceC_Quantity1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\nDeviceD_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity1\", lb=0, ub=150)\nDeviceD_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity2\", lb=150, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceD_Quantity == DeviceD_Quantity1*DeviceD_b1 + DeviceD_Quantity2*DeviceD_b2)\nProfit_DeviceD = (60 - 0.15 * (DeviceD_Quantity2 - 150)) * DeviceD_Quantity2 * DeviceD_b2 + 60 * DeviceD_Quantity1 * DeviceD_b1\n## create piecewise variables for piecewise function: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\nDeviceE_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity1\", lb=0, ub=250)\nDeviceE_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity2\", lb=250, ub=1000)\nDeviceE_b1 = model.addVar(vtype=\"B\", name=\"DeviceE_b1\")\nDeviceE_b2 = model.addVar(vtype=\"B\", name=\"DeviceE_b2\")\nmodel.addCons(DeviceE_b1 + DeviceE_b2 == 1)\nmodel.addCons(DeviceE_Quantity == DeviceE_Quantity1*DeviceE_b1 + DeviceE_Quantity2*DeviceE_b2)\nProfit_DeviceE = (80 - 0.25 * (DeviceE_Quantity2 - 250)) * DeviceE_Quantity2 * DeviceE_b2 + 80 * DeviceE_Quantity1 * DeviceE_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000)\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Quantity of DeviceD: \", model.getVal(DeviceD_Quantity))\n    print(\"Quantity of DeviceE: \", model.getVal(DeviceE_Quantity))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product to optimize their profit. The production cost, selling price, and demand for each product vary.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (Selling Price - Production Cost) * ProductA - 0.01 * ProductA^2, where the selling price is $100 and the production cost is $60.\nThe profit for ProductB is calculated as (Selling Price - Production Cost) * ProductB - 0.02 * ProductB^2, where the selling price is $150 and the production cost is $100.\nThe profit for ProductC is calculated as (Selling Price - Production Cost) * ProductC - 0.015 * ProductC^2, where the selling price is $200 and the production cost is $120.\nThe company wants to maximize the total profit from all products.\n// Objective function: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC) = ((100 - 60) * ProductA - 0.01 * ProductA^2) + ((150 - 100) * ProductB - 0.02 * ProductB^2) + ((200 - 120) * ProductC - 0.015 * ProductC^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units in total for all products.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\n// ProductA >= 2 * ProductB\n\n## Generate Constraint-3:\nThe company has a budget constraint of $80,000 for production costs.\n// 60 * ProductA + 100 * ProductB + 120 * ProductC <= 80,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// ProductA >= 1; ProductB >= 1; ProductC >= 1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product to optimize their profit. The profit for ProductA is calculated as (Selling Price - Production Cost) * ProductA - 0.01 * ProductA^2, where the selling price is $100 and the production cost is $60. The profit for ProductB is calculated as (Selling Price - Production Cost) * ProductB - 0.02 * ProductB^2, where the selling price is $150 and the production cost is $100. The profit for ProductC is calculated as (Selling Price - Production Cost) * ProductC - 0.015 * ProductC^2, where the selling price is $200 and the production cost is $120. The company has a limited production capacity of 1000 units in total for all products. Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB. The company has a budget constraint of $80,000 for production costs. The company wants to ensure that at least one unit of each product is produced to maintain market presence. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=1)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=1)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=1)  # quantity of ProductC\n\n# Define objective function\n# The profit for each product is a quadratic function\nProfit_ProductA = (100 - 60) * ProductA - 0.01 * ProductA**2\nProfit_ProductB = (150 - 100) * ProductB - 0.02 * ProductB**2\nProfit_ProductC = (200 - 120) * ProductC - 0.015 * ProductC**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# The objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units in total for all products.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductA >= 2 * ProductB)\n# The company has a budget constraint of $80,000 for production costs.\nmodel.addCons(60 * ProductA + 100 * ProductB + 120 * ProductC <= 80000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic components: Processor, Memory, Storage, Display, and Power Supply. The company needs to determine the optimal production quantities for each component to maximize profit while meeting market demands and resource constraints.\n// {\"quantity of Processor\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n// {\"quantity of Memory\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"quantity of Storage\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Display\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of Power Supply\": \"PS\", \"range\": \"PS >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Processor is $100, for Memory is $80, for Storage is $60, for Display is $70, and for Power Supply is $50. Due to economies of scale, the profit per unit increases by $0.10 for each component produced beyond 100 units. The company aims to maximize the total profit from the production of these components.\n// Profit_P = max(100 + 0.10 * (P - 100), 100) * P\n// Profit_M = max(80 + 0.10 * (M - 100), 80) * M\n// Profit_S = max(60 + 0.10 * (S - 100), 60) * S\n// Profit_D = max(70 + 0.10 * (D - 100), 70) * D\n// Profit_PS = max(50 + 0.10 * (PS - 100), 50) * PS\n// So, the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical material used in all components, with a total of 5000 units available. Each Processor requires 5 units, each Memory requires 4 units, each Storage requires 3 units, each Display requires 6 units, and each Power Supply requires 2 units of this material.\n// 5 * P + 4 * M + 3 * S + 6 * D + 2 * PS <= 5000\n\n## Generate Constraint-2:\nThe market demand for each component is limited. The demand for Processor is 200 units, for Memory is 300 units, for Storage is 400 units, for Display is 250 units, and for Power Supply is 150 units.\n// P <= 200; M <= 300; S <= 400; D <= 250; PS <= 150\n\n## Generate Constraint-3:\nThe company has a total production capacity of 800 units across all components.\n// P + M + S + D + PS <= 800",
        "question": "A manufacturer produces five types of electronic components: Processor, Memory, Storage, Display, and Power Supply. The company needs to determine the optimal production quantities for each component to maximize profit while meeting market demands and resource constraints. The profit per unit for each component and the additional profit from economies of scale are given in the following Table.\n\n| Component       | Profit per Unit | Additional Profit per Unit Beyond 100 |\n|-----------------|-----------------|--------------------------------------|\n| Processor (P)   | $100            | $0.10                                |\n| Memory (M)      | $80             | $0.10                                |\n| Storage (S)     | $60             | $0.10                                |\n| Display (D)     | $70             | $0.10                                |\n| Power Supply (PS)| $50            | $0.10                                |\n\nThe company has a limited supply of a critical material used in all components, with a total of 5000 units available. Each Processor requires 5 units, each Memory requires 4 units, each Storage requires 3 units, each Display requires 6 units, and each Power Supply requires 2 units of this material. The market demand for each component is limited: Processor is 200 units, Memory is 300 units, Storage is 400 units, Display is 250 units, and Power Supply is 150 units. The company also has a total production capacity of 800 units across all components.\n\nPlease help the company to maximize the total profit from the production of these components, considering the economies of scale and the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for each component is limited.\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0, ub=200) # quantity of Processor\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=300) # quantity of Memory\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=400) # quantity of Storage\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=250) # quantity of Display\nPS = model.addVar(vtype=\"INTEGER\", name=\"PS\", lb=0, ub=150) # quantity of Power Supply\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_P = max(100 + 0.10 * (P - 100), 100) * P\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100)\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=100, ub=200)\nP_b1 = model.addVar(vtype=\"B\", name=\"P_b1\")\nP_b2 = model.addVar(vtype=\"B\", name=\"P_b2\")\nmodel.addCons(P_b1 + P_b2 == 1)\nmodel.addCons(P == P1*P_b1 + P2*P_b2)\nProfit_P = 100 * P1 * P_b1 + (100 + 0.10 * (P2 - 100)) * P2 * P_b2\n## create piecewise variables for piecewise function: Profit_M = max(80 + 0.10 * (M - 100), 80) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=100)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=100, ub=300)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nProfit_M = 80 * M1 * M_b1 + (80 + 0.10 * (M2 - 100)) * M2 * M_b2\n## create piecewise variables for piecewise function: Profit_S = max(60 + 0.10 * (S - 100), 60) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=400)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 60 * S1 * S_b1 + (60 + 0.10 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Profit_D = max(70 + 0.10 * (D - 100), 70) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=250)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 70 * D1 * D_b1 + (70 + 0.10 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_PS = max(50 + 0.10 * (PS - 100), 50) * PS\nPS1 = model.addVar(vtype=\"INTEGER\", name=\"PS1\", lb=0, ub=100)\nPS2 = model.addVar(vtype=\"INTEGER\", name=\"PS2\", lb=100, ub=150)\nPS_b1 = model.addVar(vtype=\"B\", name=\"PS_b1\")\nPS_b2 = model.addVar(vtype=\"B\", name=\"PS_b2\")\nmodel.addCons(PS_b1 + PS_b2 == 1)\nmodel.addCons(PS == PS1*PS_b1 + PS2*PS_b2)\nProfit_PS = 50 * PS1 * PS_b1 + (50 + 0.10 * (PS2 - 100)) * PS2 * PS_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS\nmodel.addCons(obj == Profit_P + Profit_M + Profit_S + Profit_D + Profit_PS)\n\n# Add constraints\n## The company has a limited supply of a critical material used in all components, with a total of 5000 units available.\nmodel.addCons(5 * P + 4 * M + 3 * S + 6 * D + 2 * PS <= 5000)\n## The company has a total production capacity of 800 units across all components.\nmodel.addCons(P + M + S + D + PS <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Processor: \", model.getVal(P))\n    print(\"Quantity of Memory: \", model.getVal(M))\n    print(\"Quantity of Storage: \", model.getVal(S))\n    print(\"Quantity of Display: \", model.getVal(D))\n    print(\"Quantity of Power Supply: \", model.getVal(PS))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1649,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials.\n// {\"labor hours on line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours on line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours.\n// Profit from device 1 on line 1: P1_L1 = 100 * (5 * L1 + 10 * M1)\n// Profit from device 1 on line 2: P1_L2 = 100 * (7 * L2 + 12 * M2)\n// Profit from device 2 on line 1: P2_L1 = 150 * (8 * L1 + 15 * M1)\n// Profit from device 2 on line 2: P2_L2 = 150 * (10 * L2 + 18 * M2)\n// Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L1 + L2 <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 1500 hours.\n// M1 + M2 <= 1500\n\n## Generate Constraint-3:\nThe total raw materials available are 2000 units.\n// R1 + R2 <= 2000\n\n## Generate Constraint-4:\nThe production of device 1 must be at least 5000 units.\n// 5 * L1 + 10 * M1 + 7 * L2 + 12 * M2 >= 5000\n\n## Generate Constraint-5:\nThe production of device 2 must be at least 4000 units.\n// 8 * L1 + 15 * M1 + 10 * L2 + 18 * M2 >= 4000",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials. The plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours. The total labor hours available are 1000 hours. The total machine hours available are 1500 hours. The total raw materials available are 2000 units. The production of device 1 must be at least 5000 units. The production of device 2 must be at least 4000 units. Please help the plant to maximize its total profit from both devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours on line 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # machine hours on line 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials on line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours on line 2\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # machine hours on line 2\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials on line 2\n\n# Define objective function\nP1_L1 = 100 * (5 * L1 + 10 * M1) # Profit from device 1 on line 1\nP1_L2 = 100 * (7 * L2 + 12 * M2) # Profit from device 1 on line 2\nP2_L1 = 150 * (8 * L1 + 15 * M1) # Profit from device 2 on line 1\nP2_L2 = 150 * (10 * L2 + 18 * M2) # Profit from device 2 on line 2\n# Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1_L1 + P1_L2 + P2_L1 + P2_L2)\n\n# Add constraints\nmodel.addCons(L1 + L2 <= 1000) # Total labor hours available are 1000 hours\nmodel.addCons(M1 + M2 <= 1500) # Total machine hours available are 1500 hours\nmodel.addCons(R1 + R2 <= 2000) # Total raw materials available are 2000 units\nmodel.addCons(5 * L1 + 10 * M1 + 7 * L2 + 12 * M2 >= 5000) # Production of device 1 must be at least 5000 units\nmodel.addCons(8 * L1 + 15 * M1 + 10 * L2 + 18 * M2 >= 4000) # Production of device 2 must be at least 4000 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours on line 1: \", model.getVal(L1))\n    print(\"Machine hours on line 1: \", model.getVal(M1))\n    print(\"Raw materials on line 1: \", model.getVal(R1))\n    print(\"Labor hours on line 2: \", model.getVal(L2))\n    print(\"Machine hours on line 2: \", model.getVal(M2))\n    print(\"Raw materials on line 2: \", model.getVal(R2))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The company also needs to decide on the level of investment in fuel-efficient technologies for each region, which affects the fuel consumption rate of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Region1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region3\": \"TechInvest3\", \"range\": \"TechInvest3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of the trucks decreases with the investment in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region. The initial fuel consumption rate is 3 liters per kilometer. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region1: Fuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\n// Fuel consumption for Region2: Fuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\n// Fuel consumption for Region3: Fuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, Region1 must have at least 30 trucks.\n// Trucks1 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions: Region1, Region2, and Region3. The company needs to determine the optimal number of trucks to allocate to each region and the level of investment in fuel-efficient technologies for each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The relationship between investment in fuel-efficient technologies and fuel consumption rate is such that for every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region. The initial fuel consumption rate is 3 liters per kilometer.\n\n| Region | Initial Fuel Consumption Rate | Effect of Investment |\n|--------|--------------------------------|----------------------|\n| Region1 | 3 liters/km                   | -0.1 liters/km per $1000 invested |\n| Region2 | 3 liters/km                   | -0.1 liters/km per $1000 invested |\n| Region3 | 3 liters/km                   | -0.1 liters/km per $1000 invested |\n\nThe company has a total budget of $100,000 for truck allocation and technology investments. The total number of trucks available for allocation is 100. Due to contractual obligations, Region1 must have at least 30 trucks.\n\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=30)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technologies for Region1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=0)  # investment in fuel-efficient technologies for Region2\nTechInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest3\", lb=0)  # investment in fuel-efficient technologies for Region3\n\n# Define objective function\nFuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\nFuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\nFuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\nmodel.addCons(Trucks1 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Region1: \", model.getVal(TechInvest1))\n    print(\"Investment in Tech for Region2: \", model.getVal(TechInvest2))\n    print(\"Investment in Tech for Region3: \", model.getVal(TechInvest3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"TA\", \"range\": \"TA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TB\", \"range\": \"TB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TC\", \"range\": \"TC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TD\", \"range\": \"TD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TE\", \"range\": \"TE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck A has a fuel efficiency of 10 km/l and a maintenance cost of $500 per month.\n- Truck B has a fuel efficiency of 12 km/l and a maintenance cost of $600 per month.\n- Truck C has a fuel efficiency of 15 km/l and a maintenance cost of $700 per month.\n- Truck D has a fuel efficiency of 18 km/l and a maintenance cost of $800 per month.\n- Truck E has a fuel efficiency of 20 km/l and a maintenance cost of $900 per month.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Total fuel cost: FuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / FuelEfficiency)\n// Total maintenance cost: MaintenanceCost = (500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE)\n// Total cost per kilometer: TotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for all trucks combined.\n// 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000",
        "question": "A logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs. Each type of truck has different fuel efficiency and maintenance costs:\n- Truck A has a fuel efficiency of 10 km/l and a maintenance cost of $500 per month.\n- Truck B has a fuel efficiency of 12 km/l and a maintenance cost of $600 per month.\n- Truck C has a fuel efficiency of 15 km/l and a maintenance cost of $700 per month.\n- Truck D has a fuel efficiency of 18 km/l and a maintenance cost of $800 per month.\n- Truck E has a fuel efficiency of 20 km/l and a maintenance cost of $900 per month.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer. The company has a budget of $50,000 per month for all trucks combined.\nPlease help the company to determine the optimal number of each type of truck to minimize the total cost of fuel and maintenance per kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTA = model.addVar(vtype=\"INTEGER\", name=\"TA\", lb=0) # number of Truck A\nTB = model.addVar(vtype=\"INTEGER\", name=\"TB\", lb=0) # number of Truck B\nTC = model.addVar(vtype=\"INTEGER\", name=\"TC\", lb=0) # number of Truck C\nTD = model.addVar(vtype=\"INTEGER\", name=\"TD\", lb=0) # number of Truck D\nTE = model.addVar(vtype=\"INTEGER\", name=\"TE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPricePerLiter = 1.5  # Assuming fuel price per liter\nFuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / 1000)  # Convert to km/l\nMaintenanceCost = 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE\nTotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n## convert the division to multiplication\nmodel.addCons(obj * (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $50,000 per month for all trucks combined.\nmodel.addCons(500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TA))\n    print(\"Number of Truck B: \", model.getVal(TB))\n    print(\"Number of Truck C: \", model.getVal(TC))\n    print(\"Number of Truck D: \", model.getVal(TD))\n    print(\"Number of Truck E: \", model.getVal(TE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for cargo A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by cargo type. For cargo A, the cost per truck is $1000. For cargo B, the cost per truck is $1200. For cargo C, the cost per truck is $1500. For cargo D, the cost per truck is $1800. For cargo E, the cost per truck is $2000. The revenue generated by each cargo type also varies. For cargo A, the revenue per truck is $1500. For cargo B, the revenue per truck is $1800. For cargo C, the revenue per truck is $2200. For cargo D, the revenue per truck is $2500. For cargo E, the revenue per truck is $3000. The company wants to maximize the total net profit, which is the total revenue minus the total cost.\n// Total cost: Cost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total revenue: Revenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n// So, the objective function is: Maximize (Revenue_Total - Cost_Total)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, cargo A must be transported by at least 10 trucks.\n// TruckA >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total cost of operations, which must not exceed $60,000.\n// 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE <= 60000\n\n## Generate Constraint-4:\nThe demand for cargo D is limited to 15 trucks.\n// TruckD <= 15\n\n## Generate Constraint-5:\nTo maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\n// TruckB >= 0.5 * TruckC",
        "question": "A logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck and the revenue generated by each cargo type are given in the following Table.\n\n| Cargo Type | Cost per Truck | Revenue per Truck |\n|------------|----------------|-------------------|\n| A          | $1000          | $1500             |\n| B          | $1200          | $1800             |\n| C          | $1500          | $2200             |\n| D          | $1800          | $2500             |\n| E          | $2000          | $3000             |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, cargo A must be transported by at least 10 trucks. The company has a budget constraint on the total cost of operations, which must not exceed $60,000. The demand for cargo D is limited to 15 trucks. To maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\n\nPlease help the company to maximize the total net profit, which is the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for cargo A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for cargo B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for cargo C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for cargo D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for cargo E\n\n# Define objective function\nCost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nRevenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n# So, the objective function is: Maximize (Revenue_Total - Cost_Total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Total - Cost_Total)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n# Due to contractual agreements, cargo A must be transported by at least 10 trucks.\nmodel.addCons(TruckA >= 10)\n# The company has a budget constraint on the total cost of operations, which must not exceed $60,000.\nmodel.addCons(Cost_Total <= 60000)\n# The demand for cargo D is limited to 15 trucks.\nmodel.addCons(TruckD <= 15)\n# To maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\nmodel.addCons(TruckB >= 0.5 * TruckC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Cargo D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Cargo E: \", model.getVal(TruckE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1236,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost, sales price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, the sales price is $100, and the demand is 500 units. For ProductB, the production cost is $70, the sales price is $120, and the demand is 300 units. For ProductC, the production cost is $80, the sales price is $150, and the demand is 200 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\n// Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\n// Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 800 units in total.\n// UnitsA + UnitsB + UnitsC <= 800\n\n## Generate Constraint-2:\nDue to resource allocation, the production of ProductA must be at least twice the production of ProductB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least some units of each product are produced to maintain market presence.\n// UnitsA >= 50; UnitsB >= 30; UnitsC >= 20\n\n## Generate Constraint-5:\nDue to environmental regulations, the total production should not exceed 10% above the sum of individual product demands.\n// UnitsA <= 500 * 1.1; UnitsB <= 300 * 1.1; UnitsC <= 200 * 1.1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost, sales price, and demand for each product vary. The following table summarizes the relevant information for each product:\n\n| Product | Production Cost per Unit | Sales Price per Unit | Demand |\n|---------|--------------------------|----------------------|--------|\n| ProductA | $50                     | $100                 | 500 units |\n| ProductB | $70                     | $120                 | 300 units |\n| ProductC | $80                     | $150                 | 200 units |\n\nThe company wants to maximize its total profit, considering that:\n- The profit for ProductA is calculated as (Sales Price - Production Cost) * UnitsA minus a penalty of $10 for each unit produced above 500.\n- The profit for ProductB is calculated as (Sales Price - Production Cost) * UnitsB minus a penalty of $20 for each unit produced above 300.\n- The profit for ProductC is calculated as (Sales Price - Production Cost) * UnitsC minus a penalty of $30 for each unit produced above 200.\n\nThe company faces the following constraints:\n- The total monthly production capacity is 800 units.\n- The production of ProductA must be at least twice the production of ProductB.\n- The company has a budget of $50,000 for raw materials per month.\n- At least 50 units of ProductA, 30 units of ProductB, and 20 units of ProductC must be produced to maintain market presence.\n- Due to environmental regulations, the total production should not exceed 10% above the sum of individual product demands.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=20)  # number of units of ProductC\n\n# Define objective function\n## Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\n## Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\n## Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n# Handle the max function for each product\nUnitsA_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsA_excess\")\nUnitsB_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsB_excess\")\nUnitsC_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsC_excess\")\nmodel.addCons(UnitsA_excess >= UnitsA - 500)\nmodel.addCons(UnitsB_excess >= UnitsB - 300)\nmodel.addCons(UnitsC_excess >= UnitsC - 200)\n\nProfit_A = (100 - 50) * UnitsA - 10 * UnitsA_excess\nProfit_B = (120 - 70) * UnitsB - 20 * UnitsB_excess\nProfit_C = (150 - 80) * UnitsC - 30 * UnitsC_excess\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 800)\nmodel.addCons(UnitsA >= 2 * UnitsB)\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50000)\nmodel.addCons(UnitsA <= 500 * 1.1)\nmodel.addCons(UnitsB <= 300 * 1.1)\nmodel.addCons(UnitsC <= 200 * 1.1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1828,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"speed of TruckA\": \"SpeedA\", \"range\": \"0 < SpeedA <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckB\": \"SpeedB\", \"range\": \"0 < SpeedB <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckC\": \"SpeedC\", \"range\": \"0 < SpeedC <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe total cargo capacity required for the route is 100 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 100",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption. The fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe total cargo capacity required for the route is 100 tons. The company aims to minimize the total fuel consumption across all trucks. Please help the company determine the optimal number of each type of vehicle and their respective speeds to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nSpeedA = model.addVar(name=\"SpeedA\", lb=0, ub=60) # speed of TruckA\nSpeedB = model.addVar(name=\"SpeedB\", lb=0, ub=60) # speed of TruckB\nSpeedC = model.addVar(name=\"SpeedC\", lb=0, ub=60) # speed of TruckC\n\n# Define objective function\nFuelA = 0.05 * SpeedA**2 * TruckA\nFuelB = 0.03 * SpeedB**2 * TruckB\nFuelC = 0.04 * SpeedC**2 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Speed of TruckA: \", model.getVal(SpeedA))\n    print(\"Speed of TruckB: \", model.getVal(SpeedB))\n    print(\"Speed of TruckC: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\n// TruckC <= TruckA + 10",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. The operational costs and daily revenue generation for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Day | Revenue per Day |\n|------------|--------------------------|-----------------|\n| TruckA     | $500                     | $1000           |\n| TruckB     | $600                     | $1200           |\n| TruckC     | $700                     | $1400           |\n| TruckD     | $800                     | $1600           |\n| TruckE     | $900                     | $1800           |\n\nThe company has a total budget of $150,000 for operational costs for the month. The company has a limit of 100 trucks that can be deployed in total. Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10. \nPlease help the company to maximize the total daily net profit (revenue minus operational cost) per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\nmodel.addCons(TruckC <= TruckA + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Daily Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50\n\n## Generate Constraint-2:\nThe demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25.\n// Truck1 >= 5\n// Truck2 >= 10\n// Truck3 >= 15\n// Truck4 >= 20\n// Truck5 >= 25\n\n## Generate Constraint-3:\nThe total distance traveled by all trucks should not exceed 1000 kilometers per day.\n// 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5 <= 1000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate for trucks in each region and the operational cost per truck per day are given in the following Table.\n\n| Region   | Fuel Consumption Rate (liters/km) | Operational Cost per Truck per Day |\n|----------|----------------------------------|-----------------------------------|\n| Region1  | 0.5                              | $100                              |\n| Region2  | 0.6                              | $100                              |\n| Region3  | 0.7                              | $100                              |\n| Region4  | 0.8                              | $100                              |\n| Region5  | 0.9                              | $100                              |\n\nThe company has a total of 50 trucks available for allocation. The demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25. The total distance traveled by all trucks should not exceed 1000 kilometers per day.\n\nPlease help the company to minimize the total operational cost plus the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5)  # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=10)  # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=15)  # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=20)  # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=25)  # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)  # Total trucks available\nmodel.addCons(0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5 <= 1000)  # Total distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1404,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y).\n// {\"number of solar panels A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines X\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines Y\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company wants to minimize the total cost while maximizing the total energy output.\n// Total energy output: Energy = 15% * SolarA + 20% * SolarB + 25% * SolarC + 30% * WindX + 35% * WindY\n// Total cost: Cost = $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y). The efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company wants to minimize the total cost while maximizing the total energy output. The company has a budget of $50,000 for the installation. Please help the company to minimize the total cost while maximizing the total energy output, with the objective function defined as the ratio of total cost to total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels C\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=0) # number of wind turbines X\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=0) # number of wind turbines Y\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.15 * SolarA + 0.20 * SolarB + 0.25 * SolarC + 0.30 * WindX + 0.35 * WindY\nCost = 1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines X: \", model.getVal(WindX))\n    print(\"Number of Wind Turbines Y: \", model.getVal(WindY))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the nonlinear relationship between production quantity and market saturation, which affects the selling price. The objective function is to maximize the total profit, considering a nonlinear decrease in selling price with increased production:\n// Profit_A = (20 - 10 - 0.01 * A^2) * A\n// Profit_B = (30 - 15 - 0.01 * B^2) * B\n// Profit_C = (40 - 20 - 0.01 * C^2) * C\n// Profit_D = (50 - 25 - 0.01 * D^2) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours, with product A requiring 2 hours per unit, product B requiring 3 hours per unit, product C requiring 4 hours per unit, and product D requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 200",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations. The profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the nonlinear relationship between production quantity and market saturation, which affects the selling price. The company has a budget of $5000 for production costs and a limited production capacity of 200 hours, with product A requiring 2 hours per unit, product B requiring 3 hours per unit, product C requiring 4 hours per unit, and product D requiring 5 hours per unit. Please help the company to maximize the total profit, considering a nonlinear decrease in selling price with increased production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## convert the quadratic terms to linear terms by introducing new variables\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\nmodel.addCons(D_sq == D * D)\nProfit_A = (20 - 10 - 0.01 * A_sq) * A\nProfit_B = (30 - 15 - 0.01 * B_sq) * B\nProfit_C = (40 - 20 - 0.01 * C_sq) * C\nProfit_D = (50 - 25 - 0.01 * D_sq) * D\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n## The company has a limited production capacity of 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to optimize its operations. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each mode of transportation, which affects the fuel consumption and operational costs.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for trains\": \"TrainTech\", \"range\": \"TrainTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for ships\": \"ShipTech\", \"range\": \"ShipTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each mode of transportation improves with the investment in fuel-efficient technologies. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost per truck trip: FuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\n// Fuel cost per train trip: FuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\n// Fuel cost per ship trip: FuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes of transportation must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the investment in fuel-efficient technologies for each mode to optimize its operations. The investment in fuel-efficient technologies affects the fuel consumption and operational costs. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n\n| Mode of Transportation | Fuel Cost per Trip (without tech investment) |\n|------------------------|---------------------------------------------|\n| Trucks                 | 100$                                        |\n| Trains                 | 80$                                         |\n| Ships                  | 120$                                        |\n\nThe company has a total budget of $100,000 for transportation and technology investments. The total number of trips across all modes of transportation must not exceed 500 trips.\n\nPlease help the company to determine the optimal number of trips for each mode of transportation and the investment in fuel-efficient technologies to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=0)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=0)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckTech = model.addVar(name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for trucks\nTrainTech = model.addVar(name=\"TrainTech\", lb=0)  # investment in fuel-efficient technology for trains\nShipTech = model.addVar(name=\"ShipTech\", lb=0)  # investment in fuel-efficient technology for ships\n\n# Define objective function\nFuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\nFuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\nFuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n# Add constraints\nmodel.addCons(100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Train Tech: \", model.getVal(TrainTech))\n    print(\"Investment in Ship Tech: \", model.getVal(ShipTech))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 1,500 units per month.\n// Tablets >= 1500",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit from each device is calculated based on the selling price minus the production cost, which varies per device and is affected by the quantity produced due to economies of scale. The profit per unit for each device is given in the following Table.\n\n| Device       | Profit per Unit Formula                  |\n|--------------|------------------------------------------|\n| Smartphones  | $100 - 0.1 * Smartphones                 |\n| Tablets      | $150 - 0.2 * Tablets                     |\n| Laptops      | $200 - 0.3 * Laptops                     |\n| Smartwatches | $50 - 0.05 * Smartwatches                |\n| Cameras      | $300 - 0.4 * Cameras                     |\n\nThe company has a total production capacity of 10,000 units per month. The market demand for smartphones is at least 2,000 units per month, and for tablets, it is at least 1,500 units per month. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1500)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)  # number of smartwatches produced\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)  # number of cameras produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit per unit and total profit for each device\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras)\n\n# Add constraints\n## The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1231,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\n// {\"number of trucks for WarehouseA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by warehouse due to different operational costs and delivery distances. \nFor WarehouseA, the operating cost per truck is $5,000, and the delivery efficiency (packages delivered per hour) is 100.\nFor WarehouseB, the operating cost per truck is $6,000, and the delivery efficiency is 120.\nFor WarehouseC, the operating cost per truck is $7,000, and the delivery efficiency is 130.\nFor WarehouseD, the operating cost per truck is $8,000, and the delivery efficiency is 140.\nFor WarehouseE, the operating cost per truck is $9,000, and the delivery efficiency is 150.\nThe company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold.\n// Total operating cost for WarehouseA: Cost_A = 5000 * TruckA\n// Total operating cost for WarehouseB: Cost_B = 6000 * TruckB\n// Total operating cost for WarehouseC: Cost_C = 7000 * TruckC\n// Total operating cost for WarehouseD: Cost_D = 8000 * TruckD\n// Total operating cost for WarehouseE: Cost_E = 9000 * TruckE\n// Total delivery efficiency: Efficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to Efficiency >= 130\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 40\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC.\n// TruckC <= 10\n\n## Generate Constraint-3:\nTo ensure balanced operations, the number of trucks in WarehouseA must be at least half the number in WarehouseB.\n// TruckA >= 0.5 * TruckB",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency. The cost of operating a truck varies by warehouse due to different operational costs and delivery distances. For WarehouseA, the operating cost per truck is $5,000, and the delivery efficiency (packages delivered per hour) is 100. For WarehouseB, the operating cost per truck is $6,000, and the delivery efficiency is 120. For WarehouseC, the operating cost per truck is $7,000, and the delivery efficiency is 130. For WarehouseD, the operating cost per truck is $8,000, and the delivery efficiency is 140. For WarehouseE, the operating cost per truck is $9,000, and the delivery efficiency is 150. The company has a total of 40 trucks available for allocation. Due to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC. To ensure balanced operations, the number of trucks in WarehouseA must be at least half the number in WarehouseB. The company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold of 130 packages delivered per hour. Please help the company to determine the optimal allocation of trucks to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of trucks for WarehouseA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of trucks for WarehouseB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of trucks for WarehouseC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of trucks for WarehouseD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)  # number of trucks for WarehouseE\n\n# Define objective function\nCost_A = 5000 * TruckA\nCost_B = 6000 * TruckB\nCost_C = 7000 * TruckC\nCost_D = 8000 * TruckD\nCost_E = 9000 * TruckE\nTotalCost = Cost_A + Cost_B + Cost_C + Cost_D + Cost_E\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# Total delivery efficiency: Efficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n# subject to Efficiency >= 130\nEfficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\nmodel.addCons(Efficiency >= 130)\n\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 40)\n\n# Due to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC.\nmodel.addCons(TruckC <= 10)\n\n# To ensure balanced operations, the number of trucks in WarehouseA must be at least half the number in WarehouseB.\nmodel.addCons(TruckA >= 0.5 * TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TruckE))\n    print(\"Minimized Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1355,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of trips each type of truck will make per day. The cost of fuel and maintenance varies by truck size, and the revenue generated per trip also differs based on the type of goods transported.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for small trucks\": \"TripsSmall\", \"range\": \"TripsSmall >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for medium trucks\": \"TripsMedium\", \"range\": \"TripsMedium >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for large trucks\": \"TripsLarge\", \"range\": \"TripsLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel and maintenance for a small truck per trip is $100, for a medium truck is $150, and for a large truck is $200. The revenue generated per trip for a small truck is $200, for a medium truck is $300, and for a large truck is $400. The company aims to maximize its daily net profit.\n// Profit_Small = TripsSmall * (200 - 100) * SmallTrucks\n// Profit_Medium = TripsMedium * (300 - 150) * MediumTrucks\n// Profit_Large = TripsLarge * (400 - 200) * LargeTrucks\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel and maintenance.\n// 100 * TripsSmall * SmallTrucks + 150 * TripsMedium * MediumTrucks + 200 * TripsLarge * LargeTrucks <= 10000\n\n## Generate Constraint-2:\nThe company can only make a maximum of 500 trips per day across all trucks.\n// TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks <= 500",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of trips each type of truck will make per day. The cost of fuel and maintenance for a small truck per trip is $100, for a medium truck is $150, and for a large truck is $200. The revenue generated per trip for a small truck is $200, for a medium truck is $300, and for a large truck is $400. The company has a total budget of $10,000 per day for fuel and maintenance. The company can only make a maximum of 500 trips per day across all trucks. Please help the company to maximize its daily net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nTripsSmall = model.addVar(vtype=\"INTEGER\", name=\"TripsSmall\", lb=0)  # number of trips per day for small trucks\nTripsMedium = model.addVar(vtype=\"INTEGER\", name=\"TripsMedium\", lb=0)  # number of trips per day for medium trucks\nTripsLarge = model.addVar(vtype=\"INTEGER\", name=\"TripsLarge\", lb=0)  # number of trips per day for large trucks\n\n# Define objective function\nProfit_Small = TripsSmall * (200 - 100) * SmallTrucks\nProfit_Medium = TripsMedium * (300 - 150) * MediumTrucks\nProfit_Large = TripsLarge * (400 - 200) * LargeTrucks\n# So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n# The company has a total budget of $10,000 per day for fuel and maintenance.\nmodel.addCons(100 * TripsSmall * SmallTrucks + 150 * TripsMedium * MediumTrucks + 200 * TripsLarge * LargeTrucks <= 10000)\n# The company can only make a maximum of 500 trips per day across all trucks.\nmodel.addCons(TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Trips for Small Trucks: \", model.getVal(TripsSmall))\n    print(\"Trips for Medium Trucks: \", model.getVal(TripsMedium))\n    print(\"Trips for Large Trucks: \", model.getVal(TripsLarge))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 723,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be used across all regions.\n// T1 + T2 + T3 + T4 + T5 <= 5\n\n## Generate Constraint-3:\nThe demand for trucks in R1 is at least 1, and in R5 is at most 2.\n// T1 >= 1\n// T5 <= 2",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day. The company has a total budget of $10,000 per day for operating costs. The company has a limit of 5 trucks that can be used across all regions. The demand for trucks in R1 is at least 1, and in R5 is at most 2. Please help the company to maximize the net profit per truck per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_R1 = (1500 - 1000) # Profit per truck in R1\nProfit_R2 = (1800 - 1200) # Profit per truck in R2\nProfit_R3 = (2100 - 1500) # Profit per truck in R3\nProfit_R4 = (2400 - 1800) # Profit per truck in R4\nProfit_R5 = (2700 - 2000) # Profit per truck in R5\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be used across all regions.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n## The demand for trucks in R1 is at least 1, and in R5 is at most 2.\nmodel.addCons(T1 >= 1)\nmodel.addCons(T5 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet. The variables include the number of trucks assigned to each region (TruckA, TruckB, TruckC, TruckD, TruckE) and the speed at which each truck operates (SpeedA, SpeedB, SpeedC, SpeedD, SpeedE).\n// {\"number of trucks in region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in region A\": \"SpeedA\", \"range\": \"0 < SpeedA < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region B\": \"SpeedB\", \"range\": \"0 < SpeedB < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region C\": \"SpeedC\", \"range\": \"0 < SpeedC < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region D\": \"SpeedD\", \"range\": \"0 < SpeedD < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in region E\": \"SpeedE\", \"range\": \"0 < SpeedE < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks. The cost function for each region is given by a quadratic function where the cost increases at a faster rate as the speed increases. The company aims to minimize the total cost of fuel and maintenance across all regions.\n// Total cost for region A: CostA = TruckA * (0.1 * SpeedA^2 + 5 * SpeedA + 100)\n// Total cost for region B: CostB = TruckB * (0.1 * SpeedB^2 + 5 * SpeedB + 100)\n// Total cost for region C: CostC = TruckC * (0.1 * SpeedC^2 + 5 * SpeedC + 100)\n// Total cost for region D: CostD = TruckD * (0.1 * SpeedD^2 + 5 * SpeedD + 100)\n// Total cost for region E: CostE = TruckE * (0.1 * SpeedE^2 + 5 * SpeedE + 100)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet. The variables include the number of trucks assigned to each region (TruckA, TruckB, TruckC, TruckD, TruckE) and the speed at which each truck operates (SpeedA, SpeedB, SpeedC, SpeedD, SpeedE). The fuel consumption and maintenance costs are nonlinearly related to the speed of the trucks, with the cost increasing at a faster rate as the speed increases. The cost function for each region is given by a quadratic function. The company aims to minimize the total cost of fuel and maintenance across all regions.\n\n| Region | Cost Function (per truck) |\n|--------|---------------------------|\n| A      | 0.1 * SpeedA^2 + 5 * SpeedA + 100 |\n| B      | 0.1 * SpeedB^2 + 5 * SpeedB + 100 |\n| C      | 0.1 * SpeedC^2 + 5 * SpeedC + 100 |\n| D      | 0.1 * SpeedD^2 + 5 * SpeedD + 100 |\n| E      | 0.1 * SpeedE^2 + 5 * SpeedE + 100 |\n\nThe total number of trucks available in the fleet is 100. Please help the company to determine the optimal number of trucks and their speeds in each region to minimize the total cost of fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of trucks in region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of trucks in region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of trucks in region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of trucks in region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)  # number of trucks in region E\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0, ub=100)  # speed of trucks in region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0, ub=100)  # speed of trucks in region B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0, ub=100)  # speed of trucks in region C\nSpeedD = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedD\", lb=0, ub=100)  # speed of trucks in region D\nSpeedE = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedE\", lb=0, ub=100)  # speed of trucks in region E\n\n# Define objective function\nCostA = TruckA * (0.1 * SpeedA**2 + 5 * SpeedA + 100)\nCostB = TruckB * (0.1 * SpeedB**2 + 5 * SpeedB + 100)\nCostC = TruckC * (0.1 * SpeedC**2 + 5 * SpeedC + 100)\nCostD = TruckD * (0.1 * SpeedD**2 + 5 * SpeedD + 100)\nCostE = TruckE * (0.1 * SpeedE**2 + 5 * SpeedE + 100)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Speed of Trucks in Region A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks in Region B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks in Region C: \", model.getVal(SpeedC))\n    print(\"Speed of Trucks in Region D: \", model.getVal(SpeedD))\n    print(\"Speed of Trucks in Region E: \", model.getVal(SpeedE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.\n// Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n// Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n// Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n// Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n// Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for annual maintenance costs.\n// 5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1,000,000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be operated.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements. The operational cost per truck per kilometer, maintenance cost per truck per year, and cargo capacity for each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per km | Maintenance Cost per Year | Cargo Capacity |\n|------------|-------------------------|---------------------------|----------------|\n| T1         | $2                      | $5000                     | 10 tons        |\n| T2         | $1.5                    | $6000                     | 15 tons        |\n| T3         | $1.2                    | $7000                     | 20 tons        |\n| T4         | $1                      | $8000                     | 25 tons        |\n| T5         | $0.8                    | $9000                     | 30 tons        |\n\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met. The total cargo capacity required is 500 tons. The company has a budget of $1,000,000 for annual maintenance costs. The company has a limit of 100 trucks that can be operated.\n\nPlease help the company to determine the optimal number of each truck type to minimize the total annual operational and maintenance costs while meeting the cargo delivery requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance to be traveled, assumed constant for simplicity\nCost_T1 = 2 * Distance * T1 + 5000 * T1\nCost_T2 = 1.5 * Distance * T2 + 6000 * T2\nCost_T3 = 1.2 * Distance * T3 + 7000 * T3\nCost_T4 = 1 * Distance * T4 + 8000 * T4\nCost_T5 = 0.8 * Distance * T5 + 9000 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500)\n## The company has a budget of $1,000,000 for annual maintenance costs.\nmodel.addCons(5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1000000)\n## The company has a limit of 100 trucks that can be operated.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1571,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make.\n// {\"number of trucks for CityA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company wants to maximize the total net profit from all routes.\n// NetProfit_CityA = (1500 - 500) * TrucksA * TripsA\n// NetProfit_CityB = (1800 - 600) * TrucksB * TripsB\n// NetProfit_CityC = (2100 - 700) * TrucksC * TripsC\n// NetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n// So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\n// TripsA <= 20; TripsB <= 20; TripsC <= 20; TripsD <= 20",
        "question": "A logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make. The cost of operating a truck per trip and the revenue generated per trip for each city are given in the following Table.\n\n| City   | Operating Cost per Trip | Revenue per Trip |\n|--------|-------------------------|------------------|\n| CityA  | $500                    | $1500            |\n| CityB  | $600                    | $1800            |\n| CityC  | $700                    | $2100            |\n| CityD  | $800                    | $2400            |\n\nThe company has a total of 50 trucks available. Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter. The company wants to maximize the total net profit from all routes.\n\nPlease help the company to determine the optimal allocation of trucks and trips to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CityA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CityB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CityC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CityD\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=20) # number of trips per truck for CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=20) # number of trips per truck for CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=20) # number of trips per truck for CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=20) # number of trips per truck for CityD\n\n# Define objective function\nNetProfit_CityA = (1500 - 500) * TrucksA * TripsA\nNetProfit_CityB = (1800 - 600) * TrucksB * TripsB\nNetProfit_CityC = (2100 - 700) * TrucksC * TripsC\nNetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n# So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\nmodel.addCons(TripsA <= 20)\nmodel.addCons(TripsB <= 20)\nmodel.addCons(TripsC <= 20)\nmodel.addCons(TripsD <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CityB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CityC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CityD: \", model.getVal(TrucksD))\n    print(\"Number of Trips per Truck for CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for CityD: \", model.getVal(TripsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The company also needs to determine the investment in automation technology to reduce the labor hours required per unit.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\n// Total cost for ProductB: CostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\n// Total cost for ProductC: CostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 100 units of ProductB.\n// UnitsA >= 50; UnitsB >= 100\n\n## Generate Constraint-4:\nDue to market demand, the total number of units produced for all products cannot exceed 500.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-5:\nThe initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours.\n// LaborHoursA >= 2 - 0.0001 * AutomationInvestment; LaborHoursB >= 3 - 0.0001 * AutomationInvestment; LaborHoursC >= 4 - 0.0001 * AutomationInvestment",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The company also needs to determine the investment in automation technology to reduce the labor hours required per unit. The cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 100 units of ProductB. Due to market demand, the total number of units produced for all products cannot exceed 500. The initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit for ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit for ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit for ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # investment in automation technology\n\n# Define objective function\nCostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\nCostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\nCostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons((LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + \n              (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + \n              (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000)\n# The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvestment <= 50000)\n# The company must produce at least 50 units of ProductA and 100 units of ProductB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 100)\n# Due to market demand, the total number of units produced for all products cannot exceed 500.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n# The initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours.\nmodel.addCons(LaborHoursA >= 2 - 0.0001 * AutomationInvestment)\nmodel.addCons(LaborHoursB >= 3 - 0.0001 * AutomationInvestment)\nmodel.addCons(LaborHoursC >= 4 - 0.0001 * AutomationInvestment)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit for ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit for ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit for ProductC: \", model.getVal(LaborHoursC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for daily operational costs.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The details of each truck type are given in the following Table.\n\n| Truck Type | Maintenance Cost per Day | Fuel Efficiency (miles per gallon) |\n|------------|--------------------------|------------------------------------|\n| Small      | $100                     | 10                                 |\n| Medium     | $200                     | 8                                  |\n| Large      | $300                     | 6                                  |\n\nThe company has a total budget of $5000 for daily operational costs. The company has a total of 50 drivers available. Please help the company to determine the optimal number of each type of truck and the number of drivers per truck to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")  # Assuming fuel price is a variable\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000)\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Fuel Price: \", model.getVal(FuelPrice))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. \nOn Route A, the cost per truck is $500 per day.\nOn Route B, the cost per truck is $600 per day.\nOn Route C, the cost per truck is $700 per day.\nOn Route D, the cost per truck is $800 per day.\nOn Route E, the cost per truck is $900 per day.\nThe company wants to minimize the total daily operational cost while ensuring all routes are covered.\n// Total daily operational cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30\n\n## Generate Constraint-2:\nEach route must have at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1\n\n## Generate Constraint-3:\nThe total number of trucks on Route A and Route B combined should not exceed 15.\n// TruckA + TruckB <= 15\n\n## Generate Constraint-4:\nThe total number of trucks on Route C and Route D combined should be at least 8.\n// TruckC + TruckD >= 8\n\n## Generate Constraint-5:\nThe number of trucks on Route E should be at least half the number of trucks on Route A.\n// TruckE >= 0.5 * TruckA",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. On Route A, the cost per truck is $500 per day. On Route B, the cost per truck is $600 per day. On Route C, the cost per truck is $700 per day. On Route D, the cost per truck is $800 per day. On Route E, the cost per truck is $900 per day. The company has a total of 30 trucks available. Each route must have at least one truck assigned. The total number of trucks on Route A and Route B combined should not exceed 15. The total number of trucks on Route C and Route D combined should be at least 8. The number of trucks on Route E should be at least half the number of trucks on Route A. Please help the company to minimize the total daily operational cost while ensuring all routes are covered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of trucks on Route E\n\n# Define objective function\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)  # Total of 30 trucks available\nmodel.addCons(TruckA + TruckB <= 15)  # Trucks on Route A and B combined should not exceed 15\nmodel.addCons(TruckC + TruckD >= 8)  # Trucks on Route C and D combined should be at least 8\nmodel.addCons(TruckE >= 0.5 * TruckA)  # Trucks on Route E should be at least half of trucks on Route A\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to decide how many trucks of each type to purchase to optimize their operations.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a maintenance cost of $500 per month, and a cargo capacity of 5 tons.\nThe medium trucks have a fuel efficiency of 8 km/l, a maintenance cost of $700 per month, and a cargo capacity of 10 tons.\nThe large trucks have a fuel efficiency of 6 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 15 tons.\nThe company wants to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity.\n// FuelCost_Small = 100 / 10 * SmallTrucks * 500\n// FuelCost_Medium = 100 / 8 * MediumTrucks * 700\n// FuelCost_Large = 100 / 6 * LargeTrucks * 1000\n// MaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\n// TotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// SmallTrucks * 20000 + MediumTrucks * 30000 + LargeTrucks * 40000 <= 100000\n\n## Generate Constraint-2:\nThe total cargo capacity of the new fleet must be at least 500 tons.\n// 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nThe company can only accommodate a maximum of 20 new trucks in their current facilities.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion by adding new trucks. They are considering three types of trucks: small, medium, and large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The small trucks have a fuel efficiency of 10 km/l, a maintenance cost of $500 per month, and a cargo capacity of 5 tons. The medium trucks have a fuel efficiency of 8 km/l, a maintenance cost of $700 per month, and a cargo capacity of 10 tons. The large trucks have a fuel efficiency of 6 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 15 tons. The company wants to minimize the total cost per kilometer (including fuel and maintenance) while ensuring sufficient cargo capacity. The company has a budget of $100,000 for purchasing new trucks. The total cargo capacity of the new fleet must be at least 500 tons. The company can only accommodate a maximum of 20 new trucks in their current facilities. Please help the company decide how many trucks of each type to purchase to optimize their operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = (100 / 10) * SmallTrucks * 500\nFuelCost_Medium = (100 / 8) * MediumTrucks * 700\nFuelCost_Large = (100 / 6) * LargeTrucks * 1000\nMaintenanceCost = SmallTrucks * 500 + MediumTrucks * 700 + LargeTrucks * 1000\nTotalCostPerKm = (FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost) / 100\n## convert the division to multiplication\nmodel.addCons(obj * 100 == FuelCost_Small + FuelCost_Medium + FuelCost_Large + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(SmallTrucks * 20000 + MediumTrucks * 30000 + LargeTrucks * 40000 <= 100000)\n## The total cargo capacity of the new fleet must be at least 500 tons.\nmodel.addCons(5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500)\n## The company can only accommodate a maximum of 20 new trucks in their current facilities.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost per Km: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the number of sales personnel dedicated to each product. The marketing budget affects the sales of each product linearly, and the number of sales personnel also influences the sales directly. The company aims to optimize its production and marketing strategies to maximize total revenue.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales personnel for ProductA\": \"PersonnelA\", \"range\": \"PersonnelA >= 0\", \"type\": \"integer\"}\n// {\"number of sales personnel for ProductB\": \"PersonnelB\", \"range\": \"PersonnelB >= 0\", \"type\": \"integer\"}\n// {\"number of sales personnel for ProductC\": \"PersonnelC\", \"range\": \"PersonnelC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, marketing budget, and number of sales personnel. The revenue function for each product is nonlinear, given by: Revenue = (Production Quantity * Price) + (Marketing Budget * 0.01) - (0.0001 * Marketing Budget^2) + (Number of Personnel * 500). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (QuantityA * 100) + (BudgetA * 0.01) - (0.0001 * BudgetA^2) + (PersonnelA * 500)\n// Total revenue for ProductB: RevenueB = (QuantityB * 150) + (BudgetB * 0.01) - (0.0001 * BudgetB^2) + (PersonnelB * 500)\n// Total revenue for ProductC: RevenueC = (QuantityC * 200) + (BudgetC * 0.01) - (0.0001 * BudgetC^2) + (PersonnelC * 500)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total production quantity for all products cannot exceed 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the number of sales personnel dedicated to each product. The marketing budget affects the sales of each product linearly, and the number of sales personnel also influences the sales directly. The revenue from each product is influenced by the production quantity, marketing budget, and number of sales personnel, and is given by: Revenue = (Production Quantity * Price) + (Marketing Budget * 0.01) - (0.0001 * Marketing Budget^2) + (Number of Personnel * 500). The company aims to maximize the total revenue from all products. The total production quantity for all products cannot exceed 10,000 units. Please help the company to optimize its production and marketing strategies to maximize total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0) # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0) # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0) # marketing budget for ProductC\nPersonnelA = model.addVar(vtype=\"INTEGER\", name=\"PersonnelA\", lb=0) # number of sales personnel for ProductA\nPersonnelB = model.addVar(vtype=\"INTEGER\", name=\"PersonnelB\", lb=0) # number of sales personnel for ProductB\nPersonnelC = model.addVar(vtype=\"INTEGER\", name=\"PersonnelC\", lb=0) # number of sales personnel for ProductC\n\n# Define objective function\nRevenueA = (QuantityA * 100) + (BudgetA * 0.01) - (0.0001 * BudgetA**2) + (PersonnelA * 500)\nRevenueB = (QuantityB * 150) + (BudgetB * 0.01) - (0.0001 * BudgetB**2) + (PersonnelB * 500)\nRevenueC = (QuantityC * 200) + (BudgetC * 0.01) - (0.0001 * BudgetC**2) + (PersonnelC * 500)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Number of Sales Personnel for ProductA: \", model.getVal(PersonnelA))\n    print(\"Number of Sales Personnel for ProductB: \", model.getVal(PersonnelB))\n    print(\"Number of Sales Personnel for ProductC: \", model.getVal(PersonnelC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of labor per hour is $20, and the cost of raw materials per unit is $50 for ProductA, $70 for ProductB, and $90 for ProductC. The investment in automation reduces the labor hours required by 10% for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50) * UnitsA - LaborA * 20 + 0.001 * Automation * LaborA\n// Total profit for ProductB: ProfitB = (150 - 70) * UnitsB - LaborB * 20 + 0.001 * Automation * LaborB\n// Total profit for ProductC: ProfitC = (200 - 90) * UnitsC - LaborC * 20 + 0.001 * Automation * LaborC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total labor hours available for the month are 1000 hours.\n// LaborA + LaborB + LaborC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) to allocate for each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The profit per unit, cost of labor per hour, and cost of raw materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Hour | Raw Material Cost per Unit |\n|---------|-----------------|----------------------|----------------------------|\n| ProductA | $100            | $20                  | $50                        |\n| ProductB | $150            | $20                  | $70                        |\n| ProductC | $200            | $20                  | $90                        |\n\nThe investment in automation reduces the labor hours required by 10% for every $10,000 invested. The total labor hours available for the month are 1000 hours. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal number of units to produce for each product, the allocation of labor hours, and the investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA - LaborA * 20 + 0.001 * Automation * LaborA\nProfitB = (150 - 70) * UnitsB - LaborB * 20 + 0.001 * Automation * LaborB\nProfitC = (200 - 90) * UnitsC - LaborC * 20 + 0.001 * Automation * LaborC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n// Delivery time for route A: T_A = 1 / (0.8 * A)\n// Delivery time for route B: T_B = 1 / (0.9 * B)\n// Delivery time for route C: T_C = 1 / (1.1 * C)\n// Delivery time for route D: T_D = 1 / (1.2 * D)\n// Delivery time for route E: T_E = 1 / (1.0 * E)\n// So, the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n// Minimize (1 / (0.8 * A) + 1 / (0.9 * B) + 1 / (1.1 * C) + 1 / (1.2 * D) + 1 / (1.0 * E))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks at a time.\n// A <= 15; B <= 15; C <= 15; D <= 15; E <= 15\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated. The company has a total of 50 trucks available for allocation. Each route can handle a maximum of 15 trucks at a time. The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels. Please help the company to minimize the total delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_A = 1 / (0.8 * A)\nT_B = 1 / (0.9 * B)\nT_C = 1 / (1.1 * C)\nT_D = 1 / (1.2 * D)\nT_E = 1 / (1.0 * E)\n## the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n## convert the division to multiplication\nmodel.addCons(obj == T_A + T_B + T_C + T_D + T_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 50)\n## Each route can handle a maximum of 15 trucks at a time.\nmodel.addCons(A <= 15)\nmodel.addCons(B <= 15)\nmodel.addCons(C <= 15)\nmodel.addCons(D <= 15)\nmodel.addCons(E <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day.\nThe medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day.\nThe large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day.\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries.\n// Profit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily budget for vehicle operations is $3000.\n// 100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 20 vehicles available.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 20\n\n## Generate Constraint-3:\nThe total delivery demand is 15000 kg.\n// 500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles >= 15000",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day. The medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day. The large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day. The company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries.\n\nThe total daily budget for vehicle operations is $3000. The company has a total of 20 vehicles available. The total delivery demand is 15000 kg.\n\nPlease help the company determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nProfit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total daily budget for vehicle operations is $3000.\nmodel.addCons(100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000)\n## The company has a total of 20 vehicles available.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 20)\n## The total delivery demand is 15000 kg.\nmodel.addCons(500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles >= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month. Additionally, the company must decide on the number of hours to allocate for production and maintenance for each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceD\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n// Profit from DeviceA: ProfitA = (100 - 40) * UnitsA - 20 * HoursA\n// Profit from DeviceB: ProfitB = (150 - 60) * UnitsB - 30 * HoursB\n// Profit from DeviceC: ProfitC = (200 - 80) * UnitsC - 40 * HoursC\n// Profit from DeviceD: ProfitD = (250 - 100) * UnitsD - 50 * HoursD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs next month.\n// 40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10,000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for production and maintenance next month.\n// HoursA + HoursB + HoursC + HoursD <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each device are produced next month.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50; UnitsD >= 50",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month and the number of hours to allocate for production and maintenance for each device. The selling price per unit, material cost per unit, and production cost per hour for each device are given in the following Table.\n\n| Device | Selling Price per Unit | Material Cost per Unit | Production Cost per Hour |\n|--------|------------------------|------------------------|--------------------------|\n| DeviceA | $100 | $40 | $20 |\n| DeviceB | $150 | $60 | $30 |\n| DeviceC | $200 | $80 | $40 |\n| DeviceD | $250 | $100 | $50 |\n\nThe company has a total budget of $10,000 for material costs next month. The company has a total of 500 hours available for production and maintenance next month. The company wants to ensure that at least 50 units of each device are produced next month. \nPlease help the company to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=50) # number of units of DeviceD\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # production hours for DeviceA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # production hours for DeviceB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # production hours for DeviceC\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # production hours for DeviceD\n\n# Define objective function\nProfitA = (100 - 40) * UnitsA - 20 * HoursA\nProfitB = (150 - 60) * UnitsB - 30 * HoursB\nProfitC = (200 - 80) * UnitsC - 40 * HoursC\nProfitD = (250 - 100) * UnitsD - 50 * HoursD\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10000) # budget constraint\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 500) # hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Hours for DeviceA: \", model.getVal(HoursA))\n    print(\"Hours for DeviceB: \", model.getVal(HoursB))\n    print(\"Hours for DeviceC: \", model.getVal(HoursC))\n    print(\"Hours for DeviceD: \", model.getVal(HoursD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each truck on Route A\": \"Distance_A\", \"range\": \"Distance_A >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route B\": \"Distance_B\", \"range\": \"Distance_B >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route C\": \"Distance_C\", \"range\": \"Distance_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = Trucks_A * Distance_A^2\n// Fuel_Consumption_B = Trucks_B * Distance_B^2\n// Fuel_Consumption_C = Trucks_C * Distance_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for all routes.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total distance traveled by all trucks should not exceed 10,000 kilometers.\n// Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes. The company has a total of 50 trucks available for all routes. The total distance traveled by all trucks should not exceed 10,000 kilometers. Please help the company determine the optimal number of trucks for each route and the distance each truck should travel to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nDistance_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_A\", lb=0)  # distance traveled by each truck on Route A\nDistance_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_B\", lb=0)  # distance traveled by each truck on Route B\nDistance_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_C\", lb=0)  # distance traveled by each truck on Route C\n\n# Define objective function\nFuel_Consumption_A = Trucks_A * Distance_A**2\nFuel_Consumption_B = Trucks_B * Distance_B**2\nFuel_Consumption_C = Trucks_C * Distance_C**2\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for all routes.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n# The total distance traveled by all trucks should not exceed 10,000 kilometers.\nmodel.addCons(Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Distance on Route A: \", model.getVal(Distance_A))\n    print(\"Distance on Route B: \", model.getVal(Distance_B))\n    print(\"Distance on Route C: \", model.getVal(Distance_C))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of solar panels of type A\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type B\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type C\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type D\": \"PanelD\", \"range\": \"PanelD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years.\nThe efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years.\nThe efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years.\nThe efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years.\nThe city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n// EnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\n// TotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n// So, the objective function is: Maximize (EnergyOutput / TotalCost)\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000\n\n## Generate Constraint-2:\nThe total number of solar panels installed should not exceed 500.\n// PanelA + PanelB + PanelC + PanelD <= 500\n\n## Generate Constraint-3:\nAt least 20% of the total budget should be spent on the most efficient solar panel (type D).\n// 250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD)\n\n## Generate Constraint-4:\nThe number of solar panels of type A should not exceed the combined number of panels of types B, C, and D.\n// PanelA <= PanelB + PanelC + PanelD",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years. The efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years. The efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years. The efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years. The city has a budget of $50,000 for the installation of solar panels. The total number of solar panels installed should not exceed 500. At least 20% of the total budget should be spent on the most efficient solar panel (type D). The number of solar panels of type A should not exceed the combined number of panels of types B, C, and D. The city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost. Please help the city determine the number of each type of solar panel to install in each district.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of solar panels of type A\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of solar panels of type B\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of solar panels of type C\nPanelD = model.addVar(vtype=\"INTEGER\", name=\"PanelD\", lb=0) # number of solar panels of type D\n\n# Define objective function\nEnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\nTotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (EnergyOutput / TotalCost)\n# convert the division to multiplication\nmodel.addCons(obj * TotalCost == EnergyOutput)\n\n# Add constraints\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000)\n# The total number of solar panels installed should not exceed 500.\nmodel.addCons(PanelA + PanelB + PanelC + PanelD <= 500)\n# At least 20% of the total budget should be spent on the most efficient solar panel (type D).\nmodel.addCons(250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD))\n# The number of solar panels of type A should not exceed the combined number of panels of types B, C, and D.\nmodel.addCons(PanelA <= PanelB + PanelC + PanelD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels of Type A: \", model.getVal(PanelA))\n    print(\"Number of Solar Panels of Type B: \", model.getVal(PanelB))\n    print(\"Number of Solar Panels of Type C: \", model.getVal(PanelC))\n    print(\"Number of Solar Panels of Type D: \", model.getVal(PanelD))\n    print(\"Maximized Energy Output per Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost, sales price, and demand for each product vary.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, the sales price is $100, and the demand is 500 units. For ProductB, the production cost is $70, the sales price is $120, and the demand is 300 units. For ProductC, the production cost is $80, the sales price is $150, and the demand is 200 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\n// Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\n// Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 800 units in total.\n// UnitsA + UnitsB + UnitsC <= 800\n\n## Generate Constraint-2:\nDue to resource allocation, the production of ProductA must be at least twice the production of ProductB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least some units of each product are produced to maintain market presence.\n// UnitsA >= 50; UnitsB >= 30; UnitsC >= 20",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to optimize its profit. The production cost, sales price, and demand for each product vary. The details are as follows:\n\n| Product | Production Cost per Unit | Sales Price per Unit | Demand |\n|---------|--------------------------|----------------------|--------|\n| ProductA | $50                     | $100                 | 500 units |\n| ProductB | $70                     | $120                 | 300 units |\n| ProductC | $80                     | $150                 | 200 units |\n\nThe company has a monthly production capacity of 800 units in total. Due to resource allocation, the production of ProductA must be at least twice the production of ProductB. The company has a budget of $50,000 for raw materials per month. The company wants to ensure that at least some units of each product are produced to maintain market presence, with a minimum production of 50 units for ProductA, 30 units for ProductB, and 20 units for ProductC.\n\nPlease help the company to maximize its total profit, considering that any production beyond the demand for each product incurs an additional cost: $10 per unit for ProductA, $20 per unit for ProductB, and $30 per unit for ProductC.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=20)  # number of units of ProductC\n\n# Define objective function\n## Profit_A = (100 - 50) * UnitsA - max(0, UnitsA - 500) * 10\n## Profit_B = (120 - 70) * UnitsB - max(0, UnitsB - 300) * 20\n## Profit_C = (150 - 80) * UnitsC - max(0, UnitsC - 200) * 30\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n# Handling the max function for each product\nUnitsA_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsA_excess\")\nUnitsB_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsB_excess\")\nUnitsC_excess = model.addVar(vtype=\"INTEGER\", name=\"UnitsC_excess\")\nmodel.addCons(UnitsA_excess >= UnitsA - 500)\nmodel.addCons(UnitsB_excess >= UnitsB - 300)\nmodel.addCons(UnitsC_excess >= UnitsC - 200)\n\nProfit_A = (100 - 50) * UnitsA - 10 * UnitsA_excess\nProfit_B = (120 - 70) * UnitsB - 20 * UnitsB_excess\nProfit_C = (150 - 80) * UnitsC - 30 * UnitsC_excess\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 800)\nmodel.addCons(UnitsA >= 2 * UnitsB)\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1344,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks for route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times per truck. \nRoute 1: 50 liters of fuel per trip, 10 hours per trip.\nRoute 2: 60 liters of fuel per trip, 8 hours per trip.\nRoute 3: 70 liters of fuel per trip, 6 hours per trip.\nRoute 4: 80 liters of fuel per trip, 5 hours per trip.\nRoute 5: 90 liters of fuel per trip, 4 hours per trip.\nRoute 6: 100 liters of fuel per trip, 3 hours per trip.\nThe company wants to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time.\n// Total fuel cost for route 1: FC1 = 50 * T1\n// Total fuel cost for route 2: FC2 = 60 * T2\n// Total fuel cost for route 3: FC3 = 70 * T3\n// Total fuel cost for route 4: FC4 = 80 * T4\n// Total fuel cost for route 5: FC5 = 90 * T5\n// Total fuel cost for route 6: FC6 = 100 * T6\n// Total time cost for route 1: TC1 = 10 * T1\n// Total time cost for route 2: TC2 = 8 * T2\n// Total time cost for route 3: TC3 = 6 * T3\n// Total time cost for route 4: TC4 = 5 * T4\n// Total time cost for route 5: TC5 = 4 * T5\n// Total time cost for route 6: TC6 = 3 * T6\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2.\n// T1 <= 10; T2 <= 10\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 <= 50,000\n\n## Generate Constraint-4:\nEach route must have at least one truck assigned.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1; T6 >= 1\n\n## Generate Constraint-5:\nDue to safety regulations, the number of trucks on Route 3 and Route 4 combined cannot exceed 15.\n// T3 + T4 <= 15",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel consumption rates and delivery times per truck for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/trip) | Delivery Time (hours/trip) |\n|-------|--------------------------------|-----------------------------|\n| 1     | 50                             | 10                          |\n| 2     | 60                             | 8                           |\n| 3     | 70                             | 6                           |\n| 4     | 80                             | 5                           |\n| 5     | 90                             | 4                           |\n| 6     | 100                            | 3                           |\n\nThe company has a total of 50 trucks available. Due to maintenance schedules, no more than 10 trucks can be assigned to Route 1 and Route 2. The company has a budget of $50,000 for fuel costs. Each route must have at least one truck assigned. Due to safety regulations, the number of trucks on Route 3 and Route 4 combined cannot exceed 15.\n\nPlease help the company to minimize the total operational cost, which is the sum of fuel costs and opportunity costs of time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks for route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1, ub=10) # number of trucks for route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks for route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks for route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks for route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=1) # number of trucks for route 6\n\n# Define objective function\nFC1 = 50 * T1\nFC2 = 60 * T2\nFC3 = 70 * T3\nFC4 = 80 * T4\nFC5 = 90 * T5\nFC6 = 100 * T6\nTC1 = 10 * T1\nTC2 = 8 * T2\nTC3 = 6 * T3\nTC4 = 5 * T4\nTC5 = 4 * T5\nTC6 = 3 * T6\n# So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5 + FC6 + TC1 + TC2 + TC3 + TC4 + TC5 + TC6)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\nmodel.addCons(T1 <= 10)\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 <= 50000)\nmodel.addCons(T3 + T4 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks for Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks for Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks for Route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1353,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of DeviceC to fulfill a contract.\n// UnitsC >= 1,000\n\n## Generate Constraint-5:\nThe R&D investment for each device must not exceed 10% of the total production cost of that device.\n// RDA <= 0.1 * (500 * UnitsA); RDB <= 0.1 * (700 * UnitsB); RDC <= 0.1 * (600 * UnitsC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount to invest in research and development (R&D) for each device to optimize its profit. The profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n\nThe company has a total budget of $500,000 for R&D investments. The production capacity for the quarter is limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company must produce at least 1,000 units of DeviceC to fulfill a contract. The R&D investment for each device must not exceed 10% of the total production cost of that device.\n\nPlease help the company to determine the optimal number of units to produce for each device and the appropriate R&D investments to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1000)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RDA + RDB + RDC <= 500000)  # Total budget for R&D investments\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)  # Production capacity constraint\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Market demand constraint for DeviceA\nmodel.addCons(UnitsC >= 1000)  # Contract requirement for DeviceC\nmodel.addCons(RDA <= 0.1 * (500 * UnitsA))  # R&D investment limit for DeviceA\nmodel.addCons(RDB <= 0.1 * (700 * UnitsB))  # R&D investment limit for DeviceB\nmodel.addCons(RDC <= 0.1 * (600 * UnitsC))  # R&D investment limit for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\n// {\"number of trucks on CityA to CityB route\": \"Trucks_AB\", \"range\": \"Trucks_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityA to CityC route\": \"Trucks_AC\", \"range\": \"Trucks_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityB to CityC route\": \"Trucks_BC\", \"range\": \"Trucks_BC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Total fuel consumption and operational costs for CityA to CityB: Cost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\n// Total fuel consumption and operational costs for CityA to CityC: Cost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\n// Total fuel consumption and operational costs for CityB to CityC: Cost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n// So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks_AB + Trucks_AC + Trucks_BC <= 50\n\n## Generate Constraint-2:\nThe demand from CityA to CityB requires at least 15 trucks.\n// Trucks_AB >= 15\n\n## Generate Constraint-3:\nThe demand from CityA to CityC requires at least 20 trucks.\n// Trucks_AC >= 20\n\n## Generate Constraint-4:\nThe demand from CityB to CityC requires at least 10 trucks.\n// Trucks_BC >= 10",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand. The fuel consumption and operational costs per truck per trip for each route are given in the following Table.\n\n| Route          | Fuel Consumption (liters) | Operational Cost ($) |\n|----------------|--------------------------|---------------------|\n| CityA to CityB | 500                      | 1000                |\n| CityA to CityC | 600                      | 1200                |\n| CityB to CityC | 450                      | 900                 |\n\nThe company has a total of 50 trucks available. The demand from CityA to CityB requires at least 15 trucks. The demand from CityA to CityC requires at least 20 trucks. The demand from CityB to CityC requires at least 10 trucks. \n\nPlease help the company to minimize the total fuel consumption and operational costs while meeting these demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_AB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AB\", lb=15) # number of trucks on CityA to CityB route\nTrucks_AC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AC\", lb=20) # number of trucks on CityA to CityC route\nTrucks_BC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_BC\", lb=10) # number of trucks on CityB to CityC route\n\n# Define objective function\nCost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\nCost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\nCost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n# So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_AB + Cost_AC + Cost_BC)\n\n# Add constraints\nmodel.addCons(Trucks_AB + Trucks_AC + Trucks_BC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on CityA to CityB route: \", model.getVal(Trucks_AB))\n    print(\"Number of Trucks on CityA to CityC route: \", model.getVal(Trucks_AC))\n    print(\"Number of Trucks on CityB to CityC route: \", model.getVal(Trucks_BC))\n    print(\"Minimized Total Fuel Consumption and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination.\n// {\"trips to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies with the destination due to distance and terrain. For D1, the fuel cost per trip is $100, for D2 it is $120, for D3 it is $140, for D4 it is $160, and for D5 it is $180. The company wants to minimize the total fuel cost while ensuring efficient service.\n// Fuel_Cost_D1 = 100 * T1\n// Fuel_Cost_D2 = 120 * T2\n// Fuel_Cost_D3 = 140 * T3\n// Fuel_Cost_D4 = 160 * T4\n// Fuel_Cost_D5 = 180 * T5\n// So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-2:\nEach truck can make a maximum of 50 trips in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company has a contractual obligation to make at least 10 trips to D3.\n// T3 >= 10\n\n## Generate Constraint-4:\nDue to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5.\n// T5 - T1 <= 5\n\n## Generate Constraint-5:\nThe total number of trips across all destinations must not exceed 150.\n// T1 + T2 + T3 + T4 + T5 <= 150",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination. The fuel cost per trip varies with the destination as shown in the following Table.\n\n| Destination | Fuel Cost per Trip |\n|-------------|--------------------|\n| D1          | $100               |\n| D2          | $120               |\n| D3          | $140               |\n| D4          | $160               |\n| D5          | $180               |\n\nThe company has a total budget of $10,000 for fuel costs. Each truck can make a maximum of 50 trips in total. The company has a contractual obligation to make at least 10 trips to D3. Due to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5. The total number of trips across all destinations must not exceed 150.\n\nPlease help the company to minimize the total fuel cost while ensuring efficient service.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trips to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips to D5\n\n# Define objective function\nFuel_Cost_D1 = 100 * T1\nFuel_Cost_D2 = 120 * T2\nFuel_Cost_D3 = 140 * T3\nFuel_Cost_D4 = 160 * T4\nFuel_Cost_D5 = 180 * T5\n# So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\n# Each truck can make a maximum of 50 trips in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# The company has a contractual obligation to make at least 10 trips to D3.\nmodel.addCons(T3 >= 10)\n# Due to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5.\nmodel.addCons(T5 - T1 <= 5)\n# The total number of trips across all destinations must not exceed 150.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(T1))\n    print(\"Trips to D2: \", model.getVal(T2))\n    print(\"Trips to D3: \", model.getVal(T3))\n    print(\"Trips to D4: \", model.getVal(T4))\n    print(\"Trips to D5: \", model.getVal(T5))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency. The selling price per unit of ProductA is $150, ProductB is $225, and ProductC is $300. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - (100 - 0.001 * IA)) * QA\n// ProfitB = (225 - (150 - 0.0015 * IB)) * QB\n// ProfitC = (300 - (200 - 0.002 * IC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency investments.\n// IA + IB + IC <= 100000\n\n## Generate Constraint-2:\nThe total production quantity cannot exceed 5000 units.\n// QA + QB + QC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit. The production cost per unit, selling price per unit, and the efficiency investment impact for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Efficiency Investment Impact |\n|---------|--------------------------|------------------------|------------------------------|\n| ProductA | $100                     | $150                   | $1 reduction per $1000 invested |\n| ProductB | $150                     | $225                   | $1.5 reduction per $1000 invested |\n| ProductC | $200                     | $300                   | $2 reduction per $1000 invested |\n\nThe company has a total budget of $100,000 for efficiency investments. The total production quantity cannot exceed 5000 units. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in efficiency for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in efficiency for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.001 * IA)) * QA\nProfitB = (225 - (150 - 0.0015 * IB)) * QB\nProfitC = (300 - (200 - 0.002 * IC)) * QC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(IA + IB + IC <= 100000) # total budget for efficiency investments\nmodel.addCons(QA + QB + QC <= 5000) # total production quantity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(IA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(IB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(IC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. Additionally, the company must decide on the marketing budget for each product to maximize sales.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $2 for every $1000 increase in automation level. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales revenue per unit is $200 for ProductA, $240 for ProductB, and $300 for ProductC. The marketing budget increases the sales by 1% for every $1000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 * QuantityA - (100 - 0.002 * Automation) * QuantityA + 0.0001 * BudgetA * QuantityA)\n// Total profit for ProductB: ProfitB = (240 * QuantityB - (120 - 0.002 * Automation) * QuantityB + 0.0001 * BudgetB * QuantityB)\n// Total profit for ProductC: ProfitC = (300 * QuantityC - (150 - 0.002 * Automation) * QuantityC + 0.0001 * BudgetC * QuantityC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity of all products cannot exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget for all products cannot exceed $100,000.\n// BudgetA + BudgetB + BudgetC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the level of automation to implement in the production process, and the marketing budget for each product to maximize sales. The level of automation affects the production cost and efficiency. The initial production cost per unit, sales revenue per unit, and the effect of the marketing budget on sales are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Sales Revenue per Unit | Effect of Marketing Budget on Sales |\n|---------|----------------------------------|------------------------|-------------------------------------|\n| ProductA | $100                             | $200                   | 1% increase per $1000 spent         |\n| ProductB | $120                             | $240                   | 1% increase per $1000 spent         |\n| ProductC | $150                             | $300                   | 1% increase per $1000 spent         |\n\nThe company aims to maximize the total profit from all products. The total production quantity of all products cannot exceed 1000 units. The total investment in automation cannot exceed $50,000. The total marketing budget for all products cannot exceed $100,000. Please help the company determine the optimal production quantities, automation level, and marketing budgets to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 * QuantityA - (100 - 0.002 * Automation) * QuantityA + 0.0001 * BudgetA * QuantityA)\nProfitB = (240 * QuantityB - (120 - 0.002 * Automation) * QuantityB + 0.0001 * BudgetB * QuantityB)\nProfitC = (300 * QuantityC - (150 - 0.002 * Automation) * QuantityC + 0.0001 * BudgetC * QuantityC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)  # total production quantity constraint\nmodel.addCons(Automation <= 50000)  # automation investment constraint\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 100000)  # total marketing budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1457,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck is $100,000, the fuel cost per truck is $20,000, and the maintenance cost per truck is $10,000. \nFor T2, the revenue per truck is $120,000, the fuel cost per truck is $25,000, and the maintenance cost per truck is $12,000. \nFor T3, the revenue per truck is $150,000, the fuel cost per truck is $30,000, and the maintenance cost per truck is $15,000.\nFor T4, the revenue per truck is $180,000, the fuel cost per truck is $35,000, and the maintenance cost per truck is $18,000.\nFor T5, the revenue per truck is $200,000, the fuel cost per truck is $40,000, and the maintenance cost per truck is $20,000.\nThe company wants to maximize the total net profit.\n// Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n// Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n// Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n// Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n// Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 100,000 * T1 + 120,000 * T2 + 150,000 * T3 + 180,000 * T4 + 200,000 * T5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total fuel cost for all trucks must not exceed $200,000.\n// 20,000 * T1 + 25,000 * T2 + 30,000 * T3 + 35,000 * T4 + 40,000 * T5 <= 200,000\n\n## Generate Constraint-3:\nThe total maintenance cost for all trucks must not exceed $150,000.\n// 10,000 * T1 + 12,000 * T2 + 15,000 * T3 + 18,000 * T4 + 20,000 * T5 <= 150,000\n\n## Generate Constraint-4:\nThe company has a limit of 10 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 10\n\n## Generate Constraint-5:\nDue to market demand, the number of T1 trucks must be at least half the number of T2 trucks.\n// T1 >= 0.5 * T2",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different revenue, fuel cost, and maintenance cost per truck. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints. The details for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|-------------------|---------------------|----------------------------|\n| T1         | $100,000          | $20,000             | $10,000                    |\n| T2         | $120,000          | $25,000             | $12,000                    |\n| T3         | $150,000          | $30,000             | $15,000                    |\n| T4         | $180,000          | $35,000             | $18,000                    |\n| T5         | $200,000          | $40,000             | $20,000                    |\n\nThe company has a total budget of $1,000,000 for purchasing trucks. The total fuel cost for all trucks must not exceed $200,000. The total maintenance cost for all trucks must not exceed $150,000. The company has a limit of 10 trucks in total. Due to market demand, the number of T1 trucks must be at least half the number of T2 trucks.\n\nPlease help the company to maximize the total net profit by determining the optimal number of each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0)  # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0)  # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0)  # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0)  # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0)  # number of T5 trucks\n\n# Define objective function\nProfit_T1 = (100000 - 20000 - 10000) * T1\nProfit_T2 = (120000 - 25000 - 12000) * T2\nProfit_T3 = (150000 - 30000 - 15000) * T3\nProfit_T4 = (180000 - 35000 - 18000) * T4\nProfit_T5 = (200000 - 40000 - 20000) * T5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 1000000)\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 200000)\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 150000)\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 10)\nmodel.addCons(T1 >= 0.5 * T2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1420,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency.\n// {\"amount of raw material in reactor 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of each reactor varies with the amount of raw material fed into it. The efficiency is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors.\n// The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited to 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nEach reactor has a maximum capacity for raw material:\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200",
        "question": "A chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency. The efficiency of each reactor varies with the amount of raw material fed into it, and is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors. The total amount of raw material available is limited to 1000 units. Each reactor also has a maximum capacity for raw material, with each reactor's capacity not exceeding 200 units.\nPlease help the company determine the optimal amount of raw material to feed into each reactor to maximize the total efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material in reactor 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material in reactor 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material in reactor 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # amount of raw material in reactor 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # amount of raw material in reactor 5\n\n# Define objective function\n## The efficiency functions are nonlinear and are given by:\nEfficiency_R1 = 0.5 * R1**0.7\nEfficiency_R2 = 0.6 * R2**0.6\nEfficiency_R3 = 0.7 * R3**0.5\nEfficiency_R4 = 0.8 * R4**0.4\nEfficiency_R5 = 0.9 * R5**0.3\n## The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n# Add constraints\n## The total amount of raw material available is limited to 1000 units.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000)\n## Each reactor has a maximum capacity for raw material:\nmodel.addCons(R1 <= 200)\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material in Reactor 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material in Reactor 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material in Reactor 3: \", model.getVal(R3))\n    print(\"Amount of Raw Material in Reactor 4: \", model.getVal(R4))\n    print(\"Amount of Raw Material in Reactor 5: \", model.getVal(R5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in automation technology, which will reduce the production cost per unit and increase the production rate.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $300 for ProductB, and $400 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * AutomationInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (300 - 150 + 0.005 * AutomationInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (400 - 200 + 0.005 * AutomationInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for automation investments.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 100 units of ProductA and 200 units of ProductB.\n// UnitsA >= 100; UnitsB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in automation technology, which will reduce the production cost per unit and increase the production rate. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $300                   |\n| ProductC | $200                             | $400                   |\n\nThe company has a total budget of $50,000 for automation investments. The total production capacity of the company is limited to 1000 units per month. Due to market demand, the company must produce at least 100 units of ProductA and 200 units of ProductB. The production cost per unit decreases by $5 for every $1000 invested in automation. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=200) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0) # level of automation\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * AutomationInvestment) * UnitsA\nProfitB = (300 - 150 + 0.005 * AutomationInvestment) * UnitsB\nProfitC = (400 - 200 + 0.005 * AutomationInvestment) * UnitsC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $50,000 for automation investments.\nmodel.addCons(AutomationInvestment <= 50000)\n# The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively.\n// {\"number of packages for Express\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Standard\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Economy\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is a function of the total number of packages. The penalty is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty.\n// Profit_Express = 5 * E\n// Profit_Standard = 3 * S\n// Profit_Economy = 2 * N\n// Penalty = 0.01 * (E + S + N)^2\n// So, the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n\n## Generate Constraint-1:\nThe company has a daily delivery capacity of 1000 packages.\n// E + S + N <= 1000\n\n## Generate Constraint-2:\nThe company has a limited fleet size, which can handle at most 500 Express packages per day.\n// E <= 500",
        "question": "A logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively. The company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty. The company has a daily delivery capacity of 1000 packages and a limited fleet size, which can handle at most 500 Express packages per day. Please help the company maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of packages for Express\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of packages for Standard\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=0) # number of packages for Economy\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Express = 5 * E\nProfit_Standard = 3 * S\nProfit_Economy = 2 * N\nPenalty = 0.01 * (E + S + N)**2\n## the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n## convert the square to multiplication\nmodel.addCons(obj == Profit_Express + Profit_Standard + Profit_Economy - 0.01 * (E + S + N) * (E + S + N))\n\n# Add constraints\n## The company has a daily delivery capacity of 1000 packages.\nmodel.addCons(E + S + N <= 1000)\n## The company has a limited fleet size, which can handle at most 500 Express packages per day.\nmodel.addCons(E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Express Packages: \", model.getVal(E))\n    print(\"Number of Standard Packages: \", model.getVal(S))\n    print(\"Number of Economy Packages: \", model.getVal(N))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\n// {\"number of trucks for perishable food\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishable food\": \"PerishableTrips\", \"range\": \"PerishableTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for textiles\": \"TextilesTrips\", \"range\": \"TextilesTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor perishable food, the revenue per trip is $1000, and the fuel cost per trip is $200.\nFor electronics, the revenue per trip is $1500, and the fuel cost per trip is $300.\nFor textiles, the revenue per trip is $800, and the fuel cost per trip is $150.\nThe company wants to maximize the net profit per day.\n// NetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\n// NetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\n// NetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\n// So, the objective function is: Maximize (NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available.\n// PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20\n\n## Generate Constraint-2:\nDue to safety regulations, each truck can make a maximum of 5 trips per day.\n// PerishableTrips <= 5; ElectronicsTrips <= 5; TextilesTrips <= 5\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $5000.\n// 200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000\n\n## Generate Constraint-4:\nThe company must ensure that at least 5 trips are made for perishable food daily.\n// PerishableTrucks * PerishableTrips >= 5\n\n## Generate Constraint-5:\nThe company aims to balance the workload, ensuring that the number of trucks for electronics is at least half the number of trucks for perishable food.\n// ElectronicsTrucks >= 0.5 * PerishableTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day. The revenue and fuel cost per trip for each type of goods are given in the following Table.\n\n| Type of Goods | Revenue per Trip | Fuel Cost per Trip |\n|---------------|------------------|--------------------|\n| Perishable Food | $1000 | $200 |\n| Electronics | $1500 | $300 |\n| Textiles | $800 | $150 |\n\nThe company has a total of 20 trucks available. Due to safety regulations, each truck can make a maximum of 5 trips per day. The company has a daily fuel budget of $5000. The company must ensure that at least 5 trips are made for perishable food daily. The company aims to balance the workload, ensuring that the number of trucks for electronics is at least half the number of trucks for perishable food.\n\nPlease help the company to maximize the net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nPerishableTrips = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrips\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nTextilesTrips = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrips\", lb=0)\n\n# Define objective function\nNetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\nNetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\nNetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20)\nmodel.addCons(PerishableTrips <= 5)\nmodel.addCons(ElectronicsTrips <= 5)\nmodel.addCons(TextilesTrips <= 5)\nmodel.addCons(200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000)\nmodel.addCons(PerishableTrucks * PerishableTrips >= 5)\nmodel.addCons(ElectronicsTrucks >= 0.5 * PerishableTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Food: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Textiles: \", model.getVal(TextilesTrucks))\n    print(\"Number of Trips per Truck for Perishable Food: \", model.getVal(PerishableTrips))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Textiles: \", model.getVal(TextilesTrips))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours.\n// 8 * ProductA + 10 * ProductB + 9 * ProductC <= 800\n\n## Generate Constraint-3:\nMarket demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\n// ProductA <= 50\n// ProductB <= 60\n// ProductC <= 70",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours. The profit per unit, cost of production per unit, and production requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------------|------------------------|----------------------|\n| A       | $50             | $20                         | $50                    | 8 hours              |\n| B       | $70             | $30                         | $60                    | 10 hours             |\n| C       | $60             | $25                         | $55                    | 9 hours              |\n\nThe company has a total budget of $5000 for raw materials. The company has a total of 800 labor hours available. Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units. \nPlease help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total budget of $5000 for raw materials.\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000)\n# The company has a total of 800 labor hours available.\nmodel.addCons(8 * ProductA + 10 * ProductB + 9 * ProductC <= 800)\n# Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\nmodel.addCons(ProductA <= 50)\nmodel.addCons(ProductB <= 60)\nmodel.addCons(ProductC <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// TotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units per week.\n// ProductA >= 50\n\n## Generate Constraint-4:\nThe market demand for product B is at most 70 units per week.\n// ProductB <= 70",
        "question": "A manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has the following constraints:\n- The total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n- The total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n- The market demand for product A is at least 50 units per week.\n- The market demand for product B is at most 70 units per week.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=70) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\nTotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total available labor hours per week are 1000.\nmodel.addCons(5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000)\n# The total available raw material per week is 1500 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500)\n# The market demand for product A is at least 50 units per week.\nmodel.addCons(ProductA >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $50 per unit and requires 2 hours of labor and 3 units of raw material.\nProduct B has a profit margin of $70 per unit and requires 3 hours of labor and 4 units of raw material.\nProduct C has a profit margin of $60 per unit and requires 2.5 hours of labor and 3.5 units of raw material.\nProduct D has a profit margin of $80 per unit and requires 4 hours of labor and 5 units of raw material.\nProduct E has a profit margin of $90 per unit and requires 5 hours of labor and 6 units of raw material.\nThe company wants to maximize the total profit while considering the efficiency of resource use. The efficiency is defined as the total profit divided by the total hours of labor and raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total labor hours: Labor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\n// Total raw material: RawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n// So, the objective function is: Maximize Profit / (Labor + RawMaterial)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available.\n// 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n// D >= 10\n// E >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 30% of the total production is of any single product.\n// A <= 0.3 * (A + B + C + D + E)\n// B <= 0.3 * (A + B + C + D + E)\n// C <= 0.3 * (A + B + C + D + E)\n// D <= 0.3 * (A + B + C + D + E)\n// E <= 0.3 * (A + B + C + D + E)",
        "question": "A manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor. Each product requires a specific amount of resources and contributes differently to the company's profit. The profit margin, labor hours, and raw material units for each product are given in the following Table.\n\n| Product | Profit Margin | Labor Hours | Raw Material Units |\n|---------|---------------|-------------|--------------------|\n| A       | $50           | 2           | 3                  |\n| B       | $70           | 3           | 4                  |\n| C       | $60           | 2.5         | 3.5                |\n| D       | $80           | 4           | 5                  |\n| E       | $90           | 5           | 6                  |\n\nThe company has a total of 1000 hours of labor available and 1500 units of raw material available. The company must produce at least 10 units of each product to meet contractual obligations. The company wants to ensure that no more than 30% of the total production is of any single product. \nPlease help the company to maximize the total profit while considering the efficiency of resource use, which is defined as the total profit divided by the total hours of labor and raw material used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nLabor = 2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E\nRawMaterial = 3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E\n## the objective function is: Maximize Profit / (Labor + RawMaterial)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor + RawMaterial) == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 5 * E <= 1000)\n## The company has a total of 1500 units of raw material available.\nmodel.addCons(3 * A + 4 * B + 3.5 * C + 5 * D + 6 * E <= 1500)\n## The company must produce at least 10 units of each product to meet contractual obligations.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\nmodel.addCons(D >= 10)\nmodel.addCons(E >= 10)\n## The company wants to ensure that no more than 30% of the total production is of any single product.\nmodel.addCons(A <= 0.3 * (A + B + C + D + E))\nmodel.addCons(B <= 0.3 * (A + B + C + D + E))\nmodel.addCons(C <= 0.3 * (A + B + C + D + E))\nmodel.addCons(D <= 0.3 * (A + B + C + D + E))\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Trucks\": \"TechUpgradeT\", \"range\": \"TechUpgradeT >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Vans\": \"TechUpgradeV\", \"range\": \"TechUpgradeV >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Bikes\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet.\n// Total efficiency for Trucks: EfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\n// Total efficiency for Vans: EfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\n// Total efficiency for Bikes: EfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n// So, the objective function is: Maximize (EfficiencyT + EfficiencyV + EfficiencyB)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle purchases and technology upgrades.\n// Cost of Trucks + Cost of Vans + Cost of Bikes + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000\n\n## Generate Constraint-2:\nThe total number of vehicles to be purchased cannot exceed 1,000.\n// Trucks + Vans + Bikes <= 1000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade for each type of vehicle, which affects the operational efficiency and maintenance costs. The operational efficiency of each vehicle type increases with the level of technology upgrade. For Trucks, the efficiency increases by 3% for every $1,000 invested in technology upgrade. For Vans, the efficiency increases by 2% for every $1,000 invested. For Bikes, the efficiency increases by 5% for every $1,000 invested. The company aims to maximize the total operational efficiency of its fleet. The company has a budget of $500,000 for vehicle purchases and technology upgrades. The total number of vehicles to be purchased cannot exceed 1,000. Please help the company to determine the optimal number of each type of vehicle and the appropriate level of technology upgrade to maximize the total operational efficiency of its fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechUpgradeT = model.addVar(name=\"TechUpgradeT\", lb=0)  # technology upgrade for Trucks\nTechUpgradeV = model.addVar(name=\"TechUpgradeV\", lb=0)  # technology upgrade for Vans\nTechUpgradeB = model.addVar(name=\"TechUpgradeB\", lb=0)  # technology upgrade for Bikes\n\n# Define objective function\nEfficiencyT = (1 + 0.003 * TechUpgradeT) * Trucks\nEfficiencyV = (1 + 0.002 * TechUpgradeV) * Vans\nEfficiencyB = (1 + 0.005 * TechUpgradeB) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EfficiencyT + EfficiencyV + EfficiencyB)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes <= 1000)\nmodel.addCons(Trucks + Vans + Bikes + TechUpgradeT + TechUpgradeV + TechUpgradeB <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Technology Upgrade for Trucks: \", model.getVal(TechUpgradeT))\n    print(\"Technology Upgrade for Vans: \", model.getVal(TechUpgradeV))\n    print(\"Technology Upgrade for Bikes: \", model.getVal(TechUpgradeB))\n    print(\"Maximized Total Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for perishable goods\": \"PerishableSpeed\", \"range\": \"PerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for non-perishable goods\": \"NonPerishableSpeed\", \"range\": \"NonPerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for hazardous materials\": \"HazardousSpeed\", \"range\": \"HazardousSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// FuelConsumption_Perishable = PerishableTrucks * (PerishableSpeed^2)\n// FuelConsumption_NonPerishable = NonPerishableTrucks * (NonPerishableSpeed^2)\n// FuelConsumption_Hazardous = HazardousTrucks * (HazardousSpeed^2)\n// TimeSpent_Perishable = TotalDistance / PerishableSpeed\n// TimeSpent_NonPerishable = TotalDistance / NonPerishableSpeed\n// TimeSpent_Hazardous = TotalDistance / HazardousSpeed\n// So, the objective function is: Minimize (FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks.\n// Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100\n\n## Generate Constraint-3:\nThe average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations.\n// HazardousSpeed >= 60",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road. The company has a budget of $500,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations. Please help the company to determine the optimal number of trucks and their average speeds to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0)  # number of trucks for non-perishable goods\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)  # number of trucks for hazardous materials\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=0)  # average speed of trucks for perishable goods\nNonPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"NonPerishableSpeed\", lb=0)  # average speed of trucks for non-perishable goods\nHazardousSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousSpeed\", lb=60)  # average speed of trucks for hazardous materials\n\n# Define objective function\nFuelConsumption_Perishable = PerishableTrucks * PerishableSpeed**2\nFuelConsumption_NonPerishable = NonPerishableTrucks * NonPerishableSpeed**2\nFuelConsumption_Hazardous = HazardousTrucks * HazardousSpeed**2\nTimeSpent_Perishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Perishable\")  # Time spent on the road for perishable goods\nTimeSpent_NonPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_NonPerishable\")  # Time spent on the road for non-perishable goods\nTimeSpent_Hazardous = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Hazardous\")  # Time spent on the road for hazardous materials\nmodel.addCons(TimeSpent_Perishable == 1 / PerishableSpeed)\nmodel.addCons(TimeSpent_NonPerishable == 1 / NonPerishableSpeed)\nmodel.addCons(TimeSpent_Hazardous == 1 / HazardousSpeed)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n# Add constraints\nCost_PerishableTrucks = 50000  # Example cost per truck\nCost_NonPerishableTrucks = 60000  # Example cost per truck\nCost_HazardousTrucks = 70000  # Example cost per truck\nmodel.addCons(Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000)\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Perishable Speed: \", model.getVal(PerishableSpeed))\n    print(\"Non-Perishable Speed: \", model.getVal(NonPerishableSpeed))\n    print(\"Hazardous Speed: \", model.getVal(HazardousSpeed))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $10, and the production cost per unit is $5. \nFor Device B, the profit per unit is $15, and the production cost per unit is $7. \nFor Device C, the profit per unit is $20, and the production cost per unit is $9.\nFor Device D, the profit per unit is $25, and the production cost per unit is $11.\nFor Device E, the profit per unit is $30, and the production cost per unit is $13.\nThe company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity.\n// Profit_A = (10 - 5) * A\n// Profit_B = (15 - 7) * B\n// Profit_C = (20 - 9) * C\n// Profit_D = (25 - 11) * D\n// Profit_E = (30 - 13) * E\n// Penalty_Cost = k * (A + B + C + D + E)^2, where k is a constant (e.g., k = 0.001)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for production costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 10 units of each device.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-3:\nThe company has a production capacity of 200 units in total.\n// A + B + C + D + E <= 200",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit and the production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | 10$             | 5$                       |\n| B      | 15$             | 7$                       |\n| C      | 20$             | 9$                       |\n| D      | 25$             | 11$                      |\n| E      | 30$             | 13$                      |\n\nThe company has a budget of $1000 for production costs. The company wants to produce at least 10 units of each device. The company has a production capacity of 200 units in total. Additionally, the company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity.\n\nPlease help the company to determine the optimal production quantities for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 10 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # quantity of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 - 5) * A\nProfit_B = (15 - 7) * B\nProfit_C = (20 - 9) * C\nProfit_D = (25 - 11) * D\nProfit_E = (30 - 13) * E\n## Penalty_Cost = k * (A + B + C + D + E)^2, where k is a constant (e.g., k = 0.001)\n## convert the quadratic term to a linear term by introducing a new variable\nTotal_Production = model.addVar(name=\"Total_Production\")\nmodel.addCons(Total_Production == A + B + C + D + E)\nPenalty_Cost = 0.001 * Total_Production * Total_Production\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost)\n\n# Add constraints\n## The company has a budget of $1000 for production costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n## The company has a production capacity of 200 units in total.\nmodel.addCons(A + B + C + D + E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to differences in fuel efficiency, maintenance costs, and distance. \nFor route R1, the cost per truck is $1000, and the delivery efficiency (goods delivered per hour) is 50 units.\nFor route R2, the cost per truck is $1200, and the delivery efficiency is 60 units.\nFor route R3, the cost per truck is $1500, and the delivery efficiency is 70 units.\nFor route R4, the cost per truck is $1800, and the delivery efficiency is 80 units.\nFor route R5, the cost per truck is $2000, and the delivery efficiency is 90 units.\nThe company wants to minimize the total cost while maintaining a certain level of delivery efficiency.\n// Cost_R1 = 1000 * T1\n// Cost_R2 = 1200 * T2\n// Cost_R3 = 1500 * T3\n// Cost_R4 = 1800 * T4\n// Cost_R5 = 2000 * T5\n// Delivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n// The objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\nThe cost of operating a truck on each route varies due to differences in fuel efficiency, maintenance costs, and distance. \nFor route R1, the cost per truck is $1000, and the delivery efficiency (goods delivered per hour) is 50 units.\nFor route R2, the cost per truck is $1200, and the delivery efficiency is 60 units.\nFor route R3, the cost per truck is $1500, and the delivery efficiency is 70 units.\nFor route R4, the cost per truck is $1800, and the delivery efficiency is 80 units.\nFor route R5, the cost per truck is $2000, and the delivery efficiency is 90 units.\nThe company has a total budget of $100,000 for operating costs. The total number of trucks available is 50.\nPlease help the company to minimize the total cost while maintaining a certain level of delivery efficiency, defined as the total cost divided by the delivery efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_R1 = 1000 * T1\nCost_R2 = 1200 * T2\nCost_R3 = 1500 * T3\nCost_R4 = 1800 * T4\nCost_R5 = 2000 * T5\nDelivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n## the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Efficiency == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\n## The company has a total budget of $100,000 for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced manufacturing technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n// Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n// Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n// Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\n// DeviceA <= 500; DeviceB <= 400; DeviceC <= 300\n\n## Generate Constraint-3:\nThe total production quantity of all devices must not exceed 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\n// DeviceA >= 100; DeviceB >= 150\n\n## Generate Constraint-5:\nThe demand for DeviceC is limited to 200 units.\n// DeviceC <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device. The production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology. The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units. The total production quantity of all devices must not exceed 1000 units. The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced. The demand for DeviceC is limited to 200 units.\n\nPlease help the company to maximize the total profit from selling all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100, ub=500) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=150, ub=400) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=200) # quantity of DeviceC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in advanced manufacturing technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate the reduced production cost per unit due to investment\nReducedCost_DeviceA = 100 - 0.05 * TechInvestment / 1000\nReducedCost_DeviceB = 150 - 0.05 * TechInvestment / 1000\nReducedCost_DeviceC = 200 - 0.05 * TechInvestment / 1000\n## calculate the profit for each device\nProfit_DeviceA = (150 - ReducedCost_DeviceA) * DeviceA\nProfit_DeviceB = (200 - ReducedCost_DeviceB) * DeviceB\nProfit_DeviceC = (250 - ReducedCost_DeviceC) * DeviceC\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in advanced manufacturing technology.\nmodel.addCons(TechInvestment <= 100000)\n## The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\nmodel.addCons(DeviceC <= 300)\n## The total production quantity of all devices must not exceed 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n## The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\nmodel.addCons(DeviceA >= 100)\nmodel.addCons(DeviceB >= 150)\n## The demand for DeviceC is limited to 200 units.\nmodel.addCons(DeviceC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Investment in Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin.\n// {\"number of C1 cargo\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of C2 cargo\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of C3 cargo\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of C4 cargo\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of C5 cargo\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per unit is $100, the space required per unit is 5 cubic meters, and the handling cost per unit is $20.\nFor C2, the profit per unit is $150, the space required per unit is 7 cubic meters, and the handling cost per unit is $30.\nFor C3, the profit per unit is $200, the space required per unit is 10 cubic meters, and the handling cost per unit is $40.\nFor C4, the profit per unit is $250, the space required per unit is 12 cubic meters, and the handling cost per unit is $50.\nFor C5, the profit per unit is $300, the space required per unit is 15 cubic meters, and the handling cost per unit is $60.\nThe company wants to maximize the profit per cubic meter of space used.\n// Profit_C1 = 100 * C1 - 20 * C1\n// Profit_C2 = 150 * C2 - 30 * C2\n// Profit_C3 = 200 * C3 - 40 * C3\n// Profit_C4 = 250 * C4 - 50 * C4\n// Profit_C5 = 300 * C5 - 60 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5)\n\n## Generate Constraint-1:\nThe company has a total storage space of 1000 cubic meters.\n// 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10000 for handling costs.\n// 20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000\n\n## Generate Constraint-3:\nThe company can handle a maximum of 200 units of cargo in total.\n// C1 + C2 + C3 + C4 + C5 <= 200\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\n// C1 <= 50\n\n## Generate Constraint-5:\nThe company must deliver at least 10 units of each type of cargo to maintain customer relationships.\n// C1 >= 10\n// C2 >= 10\n// C3 >= 10\n// C4 >= 10\n// C5 >= 10",
        "question": "A logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin. The profit per unit, space required per unit, and handling cost per unit for each cargo type are given in the following Table.\n\n| Cargo Type | Profit per Unit | Space Required per Unit | Handling Cost per Unit |\n|------------|-----------------|-------------------------|------------------------|\n| C1         | $100            | 5 cubic meters          | $20                    |\n| C2         | $150            | 7 cubic meters          | $30                    |\n| C3         | $200            | 10 cubic meters         | $40                    |\n| C4         | $250            | 12 cubic meters         | $50                    |\n| C5         | $300            | 15 cubic meters         | $60                    |\n\nThe company has a total storage space of 1000 cubic meters. The company has a budget of $10000 for handling costs. The company can handle a maximum of 200 units of cargo in total. The market demand for C1 is 50 units, so the company can only sell a maximum of 50 units of C1. The company must deliver at least 10 units of each type of cargo to maintain customer relationships.\n\nPlease help the company to maximize the profit per cubic meter of space used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=10, ub=50) # number of C1 cargo\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=10) # number of C2 cargo\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=10) # number of C3 cargo\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=10) # number of C4 cargo\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=10) # number of C5 cargo\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (100 - 20) * C1\nProfit_C2 = (150 - 30) * C2\nProfit_C3 = (200 - 40) * C3\nProfit_C4 = (250 - 50) * C4\nProfit_C5 = (300 - 60) * C5\nSpaceUsed = 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / SpaceUsed\n## convert the division to multiplication\nmodel.addCons(obj * SpaceUsed == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total storage space of 1000 cubic meters.\nmodel.addCons(5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000)\n## The company has a budget of $10000 for handling costs.\nmodel.addCons(20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000)\n## The company can handle a maximum of 200 units of cargo in total.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 200)\n## The market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\nmodel.addCons(C1 <= 50)\n## The company must deliver at least 10 units of each type of cargo to maintain customer relationships.\nmodel.addCons(C1 >= 10)\nmodel.addCons(C2 >= 10)\nmodel.addCons(C3 >= 10)\nmodel.addCons(C4 >= 10)\nmodel.addCons(C5 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of C1 Cargo: \", model.getVal(C1))\n    print(\"Number of C2 Cargo: \", model.getVal(C2))\n    print(\"Number of C3 Cargo: \", model.getVal(C3))\n    print(\"Number of C4 Cargo: \", model.getVal(C4))\n    print(\"Number of C5 Cargo: \", model.getVal(C5))\n    print(\"Maximized Profit per Cubic Meter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1387,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for GoodsX trucks\": \"FuelOptX\", \"range\": \"FuelOptX >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsY trucks\": \"FuelOptY\", \"range\": \"FuelOptY >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsZ trucks\": \"FuelOptZ\", \"range\": \"FuelOptZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n// Operational cost for GoodsX: CostX = (1000 - 0.5 * FuelOptX) * TrucksX\n// Operational cost for GoodsY: CostY = (1200 - 0.6 * FuelOptY) * TrucksY\n// Operational cost for GoodsZ: CostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and truck operations.\n// FuelOptX + FuelOptY + FuelOptZ + (1000 * TrucksX) + (1200 * TrucksY) + (1500 * TrucksZ) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 100.\n// TrucksX + TrucksY + TrucksZ <= 100",
        "question": "A logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck. The operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries. The company has a total budget of $100,000 for fuel optimization and truck operations. The total number of trucks available for distribution is limited to 100. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFuelOptX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptX\", lb=0)  # fuel optimization for GoodsX trucks\nFuelOptY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptY\", lb=0)  # fuel optimization for GoodsY trucks\nFuelOptZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptZ\", lb=0)  # fuel optimization for GoodsZ trucks\n\n# Define objective function\nCostX = (1000 - 0.5 * FuelOptX) * TrucksX\nCostY = (1200 - 0.6 * FuelOptY) * TrucksY\nCostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons(FuelOptX + FuelOptY + FuelOptZ + 1000 * TrucksX + 1200 * TrucksY + 1500 * TrucksZ <= 100000)\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Optimization for GoodsX Trucks: \", model.getVal(FuelOptX))\n    print(\"Fuel Optimization for GoodsY Trucks: \", model.getVal(FuelOptY))\n    print(\"Fuel Optimization for GoodsZ Trucks: \", model.getVal(FuelOptZ))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 2000 units for all components combined.\n// E1 + E2 + E3 + E4 + E5 <= 2000\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\n// E4 <= E1 + E2\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3.\n// E5 <= E1 + E2 + E3",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company has a budget of $50,000 for production costs next month. The company has a storage capacity of 2000 units for all components combined. The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2. The company also wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3.\nPlease help the company to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (20 - 10 - 1 * E1) * E1\nProfit_E2 = (25 - 15 - 1.5 * E2) * E2\nProfit_E3 = (30 - 20 - 2 * E3) * E3\nProfit_E4 = (35 - 25 - 2.5 * E4) * E4\nProfit_E5 = (40 - 30 - 3 * E5) * E5\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n## The company has a storage capacity of 2000 units for all components combined.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 <= 2000)\n## The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\nmodel.addCons(E4 <= E1 + E2)\n## The company wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3.\nmodel.addCons(E5 <= E1 + E2 + E3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1466,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints.\n// {\"production rate of component 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 4\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 5\": \"P5\", \"range\": \"0 <= P5 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. The profit per unit for component 1 is 5 - 0.01 * P1, for component 2 is 7 - 0.02 * P2, for component 3 is 6 - 0.015 * P3, for component 4 is 8 - 0.025 * P4, and for component 5 is 9 - 0.03 * P5. The objective is to maximize the total profit from all components.\n// The objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\n\n## Generate Constraint-1:\nThe total production capacity of the plant is limited to 400 units per day.\n// P1 + P2 + P3 + P4 + P5 <= 400\n\n## Generate Constraint-2:\nThe market demand for each component must be met. The demand for component 1 is at least 50 units, for component 2 is at least 70 units, for component 3 is at least 60 units, for component 4 is at least 80 units, and for component 5 is at least 90 units.\n// P1 >= 50; P2 >= 70; P3 >= 60; P4 >= 80; P5 >= 90\n\n## Generate Constraint-3:\nThe production of component 1 and component 2 cannot exceed 150 units combined.\n// P1 + P2 <= 150",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints. The profit per unit and production cost for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost |\n|-----------|-----------------|-----------------|\n| 1         | 5 - 0.01 * P1   | -               |\n| 2         | 7 - 0.02 * P2   | -               |\n| 3         | 6 - 0.015 * P3  | -               |\n| 4         | 8 - 0.025 * P4  | -               |\n| 5         | 9 - 0.03 * P5   | -               |\n\nThe total production capacity of the plant is limited to 400 units per day. The market demand for each component must be met, with the demand for component 1 being at least 50 units, for component 2 at least 70 units, for component 3 at least 60 units, for component 4 at least 80 units, and for component 5 at least 90 units. Additionally, the production of component 1 and component 2 cannot exceed 150 units combined.\n\nPlease help the plant manager to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=50, ub=100) # production rate of component 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=70, ub=100) # production rate of component 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=60, ub=100) # production rate of component 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=80, ub=100) # production rate of component 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=90, ub=100) # production rate of component 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (5 - 0.01 * P1) * P1\nProfit_P2 = (7 - 0.02 * P2) * P2\nProfit_P3 = (6 - 0.015 * P3) * P3\nProfit_P4 = (8 - 0.025 * P4) * P4\nProfit_P5 = (9 - 0.03 * P5) * P5\n## the objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3 + Profit_P4 + Profit_P5)\n\n# Add constraints\n## The total production capacity of the plant is limited to 400 units per day.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 400)\n## The production of component 1 and component 2 cannot exceed 150 units combined.\nmodel.addCons(P1 + P2 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Component 1: \", model.getVal(P1))\n    print(\"Production Rate of Component 2: \", model.getVal(P2))\n    print(\"Production Rate of Component 3: \", model.getVal(P3))\n    print(\"Production Rate of Component 4: \", model.getVal(P4))\n    print(\"Production Rate of Component 5: \", model.getVal(P5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is a continuous variable representing liters per kilometer.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"FuelEfficiencySmall\", \"range\": \"FuelEfficiencySmall > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"FuelEfficiencyMedium\", \"range\": \"FuelEfficiencyMedium > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"FuelEfficiencyLarge\", \"range\": \"FuelEfficiencyLarge > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, which is a function of the number of trucks and their respective fuel efficiencies. The cost of fuel is $1 per liter, and each truck travels an average of 50,000 km per year.\n// FuelCostSmall = 50000 * SmallTrucks / FuelEfficiencySmall\n// FuelCostMedium = 50000 * MediumTrucks / FuelEfficiencyMedium\n// FuelCostLarge = 50000 * LargeTrucks / FuelEfficiencyLarge\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 to spend on purchasing trucks. The cost of a small truck is $50,000, a medium truck is $75,000, and a large truck is $100,000.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-3:\nThe company requires at least 5 trucks of each type to ensure adequate coverage across all regions.\n// SmallTrucks >= 5\n// MediumTrucks >= 5\n// LargeTrucks >= 5\n\n## Generate Constraint-4:\nThe fuel efficiency of each type of truck must be at least 5 liters per 100 kilometers.\n// FuelEfficiencySmall >= 0.05\n// FuelEfficiencyMedium >= 0.05\n// FuelEfficiencyLarge >= 0.05",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is a continuous variable representing liters per kilometer. The company aims to minimize the total annual fuel cost, which is a function of the number of trucks and their respective fuel efficiencies. The cost of fuel is $1 per liter, and each truck travels an average of 50,000 km per year. The company has a budget of $1,000,000 to spend on purchasing trucks. The cost of a small truck is $50,000, a medium truck is $75,000, and a large truck is $100,000. The total number of trucks cannot exceed 20. The company requires at least 5 trucks of each type to ensure adequate coverage across all regions. The fuel efficiency of each type of truck must be at least 5 liters per 100 kilometers. Please help the company to determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total annual fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=5)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=5)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=5)\nFuelEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencySmall\", lb=0.05)\nFuelEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyMedium\", lb=0.05)\nFuelEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyLarge\", lb=0.05)\n\n# Define objective function\nFuelCostSmall = 50000 * SmallTrucks / FuelEfficiencySmall\nFuelCostMedium = 50000 * MediumTrucks / FuelEfficiencyMedium\nFuelCostLarge = 50000 * LargeTrucks / FuelEfficiencyLarge\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(FuelEfficiencySmall))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(FuelEfficiencyMedium))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(FuelEfficiencyLarge))\n    print(\"Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance costs combined.\n// (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to Route A.\n// RouteA >= 5\n\n## Generate Constraint-4:\nNo more than 20% of the total trucks can be allocated to any single route.\n// RouteA <= 0.2 * 50\n// RouteB <= 0.2 * 50\n// RouteC <= 0.2 * 50\n// RouteD <= 0.2 * 50\n// RouteE <= 0.2 * 50",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company has a total of 50 trucks available for allocation. The company has a budget of $100,000 for fuel and maintenance costs combined. The company must allocate at least 5 trucks to Route A. No more than 20% of the total trucks can be allocated to any single route.\nPlease help the company to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=5)  # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0)  # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0)  # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0)  # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0)  # number of trucks for Route E\n\n# Define objective function\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\nmodel.addCons((2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000)\nmodel.addCons(RouteA <= 0.2 * 50)\nmodel.addCons(RouteB <= 0.2 * 50)\nmodel.addCons(RouteC <= 0.2 * 50)\nmodel.addCons(RouteD <= 0.2 * 50)\nmodel.addCons(RouteE <= 0.2 * 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region: North, South, East, West, and Central.\n// {\"number of trucks in North region\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck generates revenue based on the distance traveled and the load capacity. The revenue function is nonlinear due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions.\n// Revenue in North: R_N = 0.05 * N^2\n// Revenue in South: R_S = 0.06 * S^2\n// Revenue in East: R_E = 0.07 * E^2\n// Revenue in West: R_W = 0.08 * W^2\n// Revenue in Central: R_C = 0.09 * C^2\n// So, the objective function is: Maximize (R_N + R_S + R_E + R_W + R_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck maintenance and fuel costs.\n// 1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each region.\n// N >= 5; S >= 5; E >= 5; W >= 5; C >= 5\n\n## Generate Constraint-3:\nThe total number of trucks cannot exceed 100.\n// N + S + E + W + C <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region. Each truck generates revenue based on the distance traveled and the load capacity, with a nonlinear revenue function due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions. The revenue in the North region is 0.05 times the square of the number of trucks in the North region, in the South region is 0.06 times the square of the number of trucks in the South region, in the East region is 0.07 times the square of the number of trucks in the East region, in the West region is 0.08 times the square of the number of trucks in the West region, and in the Central region is 0.09 times the square of the number of trucks in the Central region. The company has a total budget of $500,000 for truck maintenance and fuel costs. The company must allocate at least 5 trucks to each region. The total number of trucks cannot exceed 100. Please help the company to maximize the total revenue from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=5)  # number of trucks in North region\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5)  # number of trucks in South region\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5)  # number of trucks in East region\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=5)  # number of trucks in West region\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5)  # number of trucks in Central region\n\n# Define objective function\nR_N = 0.05 * N**2\nR_S = 0.06 * S**2\nR_E = 0.07 * E**2\nR_W = 0.08 * W**2\nR_C = 0.09 * C**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_N + R_S + R_E + R_W + R_C)\n\n# Add constraints\nmodel.addCons(1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000)\nmodel.addCons(N + S + E + W + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks in North region: \", model.getVal(N))\n    print(\"Number of trucks in South region: \", model.getVal(S))\n    print(\"Number of trucks in East region: \", model.getVal(E))\n    print(\"Number of trucks in West region: \", model.getVal(W))\n    print(\"Number of trucks in Central region: \", model.getVal(C))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1177,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each DeviceB produced. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each DeviceA produced. The profit per unit for DeviceC is $60, but it decreases by $0.2 for each DeviceD produced. The profit per unit for DeviceD is $80, but it decreases by $0.15 for each DeviceC produced. The profit per unit for DeviceE is $90, but it decreases by $0.1 for each DeviceA and DeviceB produced. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n// Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n// Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n// Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n// Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\n// DeviceA >= 2 * DeviceB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40.\n// 20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each DeviceB produced. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each DeviceA produced. The profit per unit for DeviceC is $60, but it decreases by $0.2 for each DeviceD produced. The profit per unit for DeviceD is $80, but it decreases by $0.15 for each DeviceC produced. The profit per unit for DeviceE is $90, but it decreases by $0.1 for each DeviceA and DeviceB produced. The company has a total production capacity of 1000 units for all devices combined. Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB. The company has a budget of $50,000 for production costs for all devices. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $25, for DeviceD is $35, and for DeviceE is $40. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of DeviceE\n\n# Define objective function\n## Total profit for DeviceA: Profit_A = (50 - 0.1 * DeviceB) * DeviceA\n## Total profit for DeviceB: Profit_B = (70 - 0.05 * DeviceA) * DeviceB\n## Total profit for DeviceC: Profit_C = (60 - 0.2 * DeviceD) * DeviceC\n## Total profit for DeviceD: Profit_D = (80 - 0.15 * DeviceC) * DeviceD\n## Total profit for DeviceE: Profit_E = (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (50 - 0.1 * DeviceB) * DeviceA + (70 - 0.05 * DeviceA) * DeviceB + \n               (60 - 0.2 * DeviceD) * DeviceC + (80 - 0.15 * DeviceC) * DeviceD + \n               (90 - 0.1 * (DeviceA + DeviceB)) * DeviceE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA + DeviceB + DeviceC + DeviceD + DeviceE <= 1000)\n## Due to market research, the company knows that DeviceA must be produced at least twice as much as DeviceB.\nmodel.addCons(DeviceA >= 2 * DeviceB)\n## The company has a budget of $50,000 for production costs for all devices.\nmodel.addCons(20 * DeviceA + 30 * DeviceB + 25 * DeviceC + 35 * DeviceD + 40 * DeviceE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"speed of TruckA\": \"SpeedA\", \"range\": \"0 < SpeedA <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckB\": \"SpeedB\", \"range\": \"0 < SpeedB <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckC\": \"SpeedC\", \"range\": \"0 < SpeedC <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe total cargo capacity required for the route is 100 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 100",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption. The fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n\n| Vehicle | Cargo Capacity | Fuel Consumption Formula |\n|---------|----------------|--------------------------|\n| TruckA  | 10 tons        | 0.05 * SpeedA^2 * TruckA |\n| TruckB  | 15 tons        | 0.03 * SpeedB^2 * TruckB |\n| TruckC  | 20 tons        | 0.04 * SpeedC^2 * TruckC |\n\nThe total cargo capacity required for the route is 100 tons. The number of each type of vehicle must be non-negative integers, and the speed of each vehicle must be between 0 and 60 miles per hour. Please help the company determine the optimal number of each type of vehicle and their respective speeds to minimize total fuel consumption while meeting the cargo capacity requirement.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nSpeedA = model.addVar(name=\"SpeedA\", lb=0, ub=60) # speed of TruckA\nSpeedB = model.addVar(name=\"SpeedB\", lb=0, ub=60) # speed of TruckB\nSpeedC = model.addVar(name=\"SpeedC\", lb=0, ub=60) # speed of TruckC\n\n# Define objective function\nFuelA = 0.05 * SpeedA**2 * TruckA\nFuelB = 0.03 * SpeedB**2 * TruckB\nFuelC = 0.04 * SpeedC**2 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Speed of TruckA: \", model.getVal(SpeedA))\n    print(\"Speed of TruckB: \", model.getVal(SpeedB))\n    print(\"Speed of TruckC: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1393,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for five different types of cargo (A, B, C, D, E). The company needs to decide on the number of trucks to purchase for each type of cargo.\n// {\"number of trucks for cargo A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of cargo has a different profit per delivery and a different fuel consumption rate. Cargo A has a profit of $500 per delivery and consumes 10 liters of fuel. Cargo B has a profit of $600 per delivery and consumes 12 liters of fuel. Cargo C has a profit of $700 per delivery and consumes 14 liters of fuel. Cargo D has a profit of $800 per delivery and consumes 16 liters of fuel. Cargo E has a profit of $900 per delivery and consumes 18 liters of fuel. The company wants to maximize the net profit per liter of fuel consumed.\n// Profit_A = 500 * TruckA\n// Profit_B = 600 * TruckB\n// Profit_C = 700 * TruckC\n// Profit_D = 800 * TruckD\n// Profit_E = 900 * TruckE\n// Fuel_Consumption = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Fuel_Consumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_A * TruckA + Cost_B * TruckB + Cost_C * TruckC + Cost_D * TruckD + Cost_E * TruckE <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for five different types of cargo (A, B, C, D, E). The company needs to decide on the number of trucks to purchase for each type of cargo. Each type of cargo has a different profit per delivery and a different fuel consumption rate, as shown in the following Table.\n\n| Cargo Type | Profit per Delivery | Fuel Consumption per Delivery |\n|------------|---------------------|-------------------------------|\n| A          | $500                | 10 liters                     |\n| B          | $600                | 12 liters                     |\n| C          | $700                | 14 liters                     |\n| D          | $800                | 16 liters                     |\n| E          | $900                | 18 liters                     |\n\nThe company has a budget of $100,000 for purchasing new trucks. The company wants to maximize the net profit per liter of fuel consumed. Please help the company determine the optimal number of trucks to purchase for each type of cargo.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for cargo A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for cargo B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for cargo C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for cargo D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for cargo E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * TruckA\nProfit_B = 600 * TruckB\nProfit_C = 700 * TruckC\nProfit_D = 800 * TruckD\nProfit_E = 900 * TruckE\nFuel_Consumption = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Fuel_Consumption\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Consumption == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nCost_A = 10000 # cost of a truck for cargo A\nCost_B = 12000 # cost of a truck for cargo B\nCost_C = 14000 # cost of a truck for cargo C\nCost_D = 16000 # cost of a truck for cargo D\nCost_E = 18000 # cost of a truck for cargo E\nmodel.addCons(Cost_A * TruckA + Cost_B * TruckB + Cost_C * TruckC + Cost_D * TruckD + Cost_E * TruckE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Cargo D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Cargo E: \", model.getVal(TruckE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region1\": \"FuelEfficiencyRegion1\", \"range\": \"FuelEfficiencyRegion1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region2\": \"FuelEfficiencyRegion2\", \"range\": \"FuelEfficiencyRegion2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region3\": \"FuelEfficiencyRegion3\", \"range\": \"FuelEfficiencyRegion3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region4\": \"FuelEfficiencyRegion4\", \"range\": \"FuelEfficiencyRegion4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region5\": \"FuelEfficiencyRegion5\", \"range\": \"FuelEfficiencyRegion5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per delivery. The fuel cost is calculated based on the distance traveled by each truck and its fuel efficiency. The distance for each region is different and is known.\n// TotalFuelCost = DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 + DistanceRegion2 * TrucksRegion2 / FuelEfficiencyRegion2 + DistanceRegion3 * TrucksRegion3 / FuelEfficiencyRegion3 + DistanceRegion4 * TrucksRegion4 / FuelEfficiencyRegion4 + DistanceRegion5 * TrucksRegion5 / FuelEfficiencyRegion5\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 50",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company wants to minimize the total fuel cost per delivery, which is calculated based on the distance traveled by each truck and its fuel efficiency. The distance for each region is different and is known. The company has a total of 50 trucks available.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel cost per delivery.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0)\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0)\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0)\nFuelEfficiencyRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion1\", lb=0)\nFuelEfficiencyRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion2\", lb=0)\nFuelEfficiencyRegion3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion3\", lb=0)\nFuelEfficiencyRegion4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion4\", lb=0)\nFuelEfficiencyRegion5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## TotalFuelCost = DistanceRegion1 * TrucksRegion1 / FuelEfficiencyRegion1 + ...\n## convert the division to multiplication\nmodel.addCons(obj == TrucksRegion1 * FuelEfficiencyRegion1 + TrucksRegion2 * FuelEfficiencyRegion2 + TrucksRegion3 * FuelEfficiencyRegion3 + TrucksRegion4 * FuelEfficiencyRegion4 + TrucksRegion5 * FuelEfficiencyRegion5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Fuel Efficiency for Region1: \", model.getVal(FuelEfficiencyRegion1))\n    print(\"Fuel Efficiency for Region2: \", model.getVal(FuelEfficiencyRegion2))\n    print(\"Fuel Efficiency for Region3: \", model.getVal(FuelEfficiencyRegion3))\n    print(\"Fuel Efficiency for Region4: \", model.getVal(FuelEfficiencyRegion4))\n    print(\"Fuel Efficiency for Region5: \", model.getVal(FuelEfficiencyRegion5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 662,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Small trucks\": \"FuelSmall\", \"range\": \"FuelSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Medium trucks\": \"FuelMedium\", \"range\": \"FuelMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Large trucks\": \"FuelLarge\", \"range\": \"FuelLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Extra-Large trucks\": \"FuelExtraLarge\", \"range\": \"FuelExtraLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Hybrid trucks\": \"FuelHybrid\", \"range\": \"FuelHybrid >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel for each type of truck is different. The cost per gallon for Small trucks is $3, for Medium trucks is $4, for Large trucks is $5, for Extra-Large trucks is $6, and for Hybrid trucks is $2. The fuel efficiency of each truck also varies, with Small trucks consuming 10 gallons per 100 miles, Medium trucks consuming 15 gallons per 100 miles, Large trucks consuming 20 gallons per 100 miles, Extra-Large trucks consuming 25 gallons per 100 miles, and Hybrid trucks consuming 5 gallons per 100 miles. The company wants to minimize the total fuel cost for all deliveries.\n// FuelCostSmall = 3 * (10 * SmallTrucks * Distance / 100)\n// FuelCostMedium = 4 * (15 * MediumTrucks * Distance / 100)\n// FuelCostLarge = 5 * (20 * LargeTrucks * Distance / 100)\n// FuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * Distance / 100)\n// FuelCostHybrid = 2 * (5 * HybridTrucks * Distance / 100)\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n## Generate Constraint-1:\nThe total fuel available for all trucks is limited to 5000 gallons.\n// FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000\n\n## Generate Constraint-2:\nThe total number of trucks available for use is limited to 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 100\n\n## Generate Constraint-3:\nDue to maintenance schedules, the company must use at least 10 Small trucks and 5 Hybrid trucks.\n// SmallTrucks >= 10; HybridTrucks >= 5\n\n## Generate Constraint-4:\nThe total distance to be covered by all trucks is 5000 miles.\n// (10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks + 25 * ExtraLargeTrucks + 5 * HybridTrucks) * Distance / 100 <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck. The cost of fuel for each type of truck is different, and the fuel efficiency of each truck also varies. The company wants to minimize the total fuel cost for all deliveries. The total fuel available for all trucks is limited to 5000 gallons. The total number of trucks available for use is limited to 100. Due to maintenance schedules, the company must use at least 10 Small trucks and 5 Hybrid trucks. The total distance to be covered by all trucks is 5000 miles. Please help the company to determine the optimal number of each type of truck and the fuel allocation to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\nFuelSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelSmall\", lb=0)\nFuelMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelMedium\", lb=0)\nFuelLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelLarge\", lb=0)\nFuelExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelExtraLarge\", lb=0)\nFuelHybrid = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelHybrid\", lb=0)\n\n# Define objective function\nFuelCostSmall = 3 * (10 * SmallTrucks * 5000 / 100)\nFuelCostMedium = 4 * (15 * MediumTrucks * 5000 / 100)\nFuelCostLarge = 5 * (20 * LargeTrucks * 5000 / 100)\nFuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * 5000 / 100)\nFuelCostHybrid = 2 * (5 * HybridTrucks * 5000 / 100)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n# Add constraints\nmodel.addCons(FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 100)\nmodel.addCons(SmallTrucks >= 10)\nmodel.addCons(HybridTrucks >= 5)\nmodel.addCons((10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks + 25 * ExtraLargeTrucks + 5 * HybridTrucks) * 5000 / 100 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Fuel Allocation for Small Trucks: \", model.getVal(FuelSmall))\n    print(\"Fuel Allocation for Medium Trucks: \", model.getVal(FuelMedium))\n    print(\"Fuel Allocation for Large Trucks: \", model.getVal(FuelLarge))\n    print(\"Fuel Allocation for Extra-Large Trucks: \", model.getVal(FuelExtraLarge))\n    print(\"Fuel Allocation for Hybrid Trucks: \", model.getVal(FuelHybrid))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck depends on the route it takes. For route A, each truck consumes 100 liters of fuel per trip. For route B, each truck consumes 120 liters of fuel per trip. For route C, each truck consumes 150 liters of fuel per trip. For route D, each truck consumes 200 liters of fuel per trip. The company aims to minimize the total fuel consumption per day.\n// Fuel_Consumption_A = 100 * TrucksA\n// Fuel_Consumption_B = 120 * TrucksB\n// Fuel_Consumption_C = 150 * TrucksC\n// Fuel_Consumption_D = 200 * TrucksD\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $5000 for fuel costs.\n// 100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000\n\n## Generate Constraint-3:\nThe demand for goods transportation on route A is at least 10 trips per day.\n// TrucksA >= 10\n\n## Generate Constraint-4:\nThe demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C.\n// TrucksD <= 2 * (TrucksA + TrucksB + TrucksC)",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route. The fuel consumption of each truck per trip for each route is given in the following Table.\n\n| Route | Fuel Consumption per Truck per Trip |\n|-------|-------------------------------------|\n| A     | 100 liters                          |\n| B     | 120 liters                          |\n| C     | 150 liters                          |\n| D     | 200 liters                          |\n\nThe company has a total of 50 trucks available. The company has a daily budget of $5000 for fuel costs. The demand for goods transportation on route A is at least 10 trips per day. The demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C. \n\nPlease help the company to minimize the total fuel consumption per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\n\n# Define objective function\nFuel_Consumption_A = 100 * TrucksA\nFuel_Consumption_B = 120 * TrucksB\nFuel_Consumption_C = 150 * TrucksC\nFuel_Consumption_D = 200 * TrucksD\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# The company has a daily budget of $5000 for fuel costs.\nmodel.addCons(100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000)\n# The demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C.\nmodel.addCons(TrucksD <= 2 * (TrucksA + TrucksB + TrucksC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\n// {\"trips to D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs).\n// NetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1^2\n// NetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2^2\n// NetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3^2\n// NetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4^2\n// NetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5^2\n// So, the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10000.\n// 200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget that cannot exceed $2000.\n// 0.01 * D1^2 + 0.015 * D2^2 + 0.02 * D3^2 + 0.025 * D4^2 + 0.03 * D5^2 <= 2000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination. The profit, fuel cost, and maintenance cost for each trip are given in the following Table.\n\n| Destination | Profit per Trip | Fuel Cost per Trip | Maintenance Cost per Trip |\n|-------------|-----------------|--------------------|---------------------------|\n| D1          | $1000           | $200               | 0.01 * D1^2               |\n| D2          | $1200           | $250               | 0.015 * D2^2              |\n| D3          | $1500           | $300               | 0.02 * D3^2               |\n| D4          | $1800           | $350               | 0.025 * D4^2              |\n| D5          | $2000           | $400               | 0.03 * D5^2               |\n\nThe company has a total fuel budget of $10000. The company also has a maintenance budget that cannot exceed $2000. The company aims to maximize the net profit (total profit minus total costs). Please help the company determine the optimal number of trips to each destination to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # trips to D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # trips to D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # trips to D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # trips to D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # trips to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate net profit for each destination\nNetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1**2\nNetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2**2\nNetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3**2\nNetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4**2\nNetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5**2\n\n## the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\nmodel.addCons(obj == NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n# Add constraints\n## The company has a total fuel budget of $10000.\nmodel.addCons(200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000)\n## The company has a maintenance budget that cannot exceed $2000.\nmodel.addCons(0.01 * D1**2 + 0.015 * D2**2 + 0.02 * D3**2 + 0.025 * D4**2 + 0.03 * D5**2 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(D1))\n    print(\"Trips to D2: \", model.getVal(D2))\n    print(\"Trips to D3: \", model.getVal(D3))\n    print(\"Trips to D4: \", model.getVal(D4))\n    print(\"Trips to D5: \", model.getVal(D5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. \nEach truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. \nEach truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. \nEach truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. \nEach truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. \nThe company aims to minimize the total fuel consumption per package delivered.\n// Fuel consumption of route 1: FC1 = 10 * T1\n// Fuel consumption of route 2: FC2 = 15 * T2\n// Fuel consumption of route 3: FC3 = 20 * T3\n// Fuel consumption of route 4: FC4 = 25 * T4\n// Fuel consumption of route 5: FC5 = 30 * T5\n// Total packages delivered: TP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The fuel consumption per trip and the number of packages each truck can carry for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/trip) | Packages Carried |\n|-------|-------------------------------|------------------|\n| 1     | 10                            | 50               |\n| 2     | 15                            | 75               |\n| 3     | 20                            | 100              |\n| 4     | 25                            | 125              |\n| 5     | 30                            | 150              |\n\nThe company has a total of 100 trucks available. Each route must have at least 5 trucks. The company aims to minimize the total fuel consumption per package delivered. Please help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 5 trucks.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC1 = 10 * T1\nFC2 = 15 * T2\nFC3 = 20 * T3\nFC4 = 25 * T4\nFC5 = 30 * T5\nTP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n## the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n## convert the division to multiplication\nmodel.addCons(obj * TP == FC1 + FC2 + FC3 + FC4 + FC5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks for Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region1: Fuel consumption per truck is 100 liters, and travel time is 5 hours.\n- Region2: Fuel consumption per truck is 120 liters, and travel time is 6 hours.\n- Region3: Fuel consumption per truck is 140 liters, and travel time is 7 hours.\n- Region4: Fuel consumption per truck is 160 liters, and travel time is 8 hours.\n- Region5: Fuel consumption per truck is 180 liters, and travel time is 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate).\n// Total_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\n// Total_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n// So, the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\nThe fuel consumption and travel time for each region are as follows:\n- Region1: Fuel consumption per truck is 100 liters, and travel time is 5 hours.\n- Region2: Fuel consumption per truck is 120 liters, and travel time is 6 hours.\n- Region3: Fuel consumption per truck is 140 liters, and travel time is 7 hours.\n- Region4: Fuel consumption per truck is 160 liters, and travel time is 8 hours.\n- Region5: Fuel consumption per truck is 180 liters, and travel time is 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate). The company has a total budget of $10,000 for fuel costs.\nPlease help the company to minimize the total cost (Total_Fuel_Cost + Total_Time_Cost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks for Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks for Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks for Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks for Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Price = 1  # Assuming fuel price per liter is $1 for simplicity\nHourly_Cost_Rate = 1  # Assuming hourly cost rate is $1 for simplicity\nTotal_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\nTotal_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n## the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\nmodel.addCons(obj == Total_Fuel_Cost + Total_Time_Cost)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day.\nThe medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day.\nThe large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 200 * Small + 300 * Medium + 400 * Large\n// Total fuel cost: FuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n// So, the objective function is: Minimize (VehicleCost + FuelCost)\n\n## Generate Constraint-1:\nThe total capacity of vehicles must meet or exceed the required delivery of 1000 units.\n// 50 * Small + 100 * Medium + 150 * Large >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 200 * Small + 300 * Medium + 400 * Large <= 10000",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency. The small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day. The medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day. The large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day. The company needs to deliver at least 1000 units of goods over a distance of 500 km. The total capacity of vehicles must meet or exceed the required delivery of 1000 units, and the company has a budget of $10,000 for vehicle rental. Please help the company to minimize the total cost of vehicles and fuel.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nVehicleCost = 200 * Small + 300 * Medium + 400 * Large\nFuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n## the objective function is: Minimize (VehicleCost + FuelCost)\nmodel.addCons(obj == VehicleCost + FuelCost)\n\n# Add constraints\n## The total capacity of vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(50 * Small + 100 * Medium + 150 * Large >= 1000)\n## The company has a budget of $10,000 for vehicle rental.\nmodel.addCons(200 * Small + 300 * Medium + 400 * Large <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate to each route (Route1, Route2, Route3) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software which can reduce fuel consumption and improve efficiency, but at a cost.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for Route3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software\": \"SoftwareInvest\", \"range\": \"SoftwareInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in fuel optimization and route optimization software. The initial fuel cost per truck for Route1 is $1000, for Route2 is $1200, and for Route3 is $1500. The fuel cost decreases by $10 for every $100 invested in fuel optimization and by an additional $5 for every $1000 invested in route optimization software. The company aims to minimize the total fuel cost across all routes.\n// Total fuel cost for Route1: Cost1 = (1000 - 0.1 * FuelOpt1 - 0.005 * SoftwareInvest) * Trucks1\n// Total fuel cost for Route2: Cost2 = (1200 - 0.1 * FuelOpt2 - 0.005 * SoftwareInvest) * Trucks2\n// Total fuel cost for Route3: Cost3 = (1500 - 0.1 * FuelOpt3 - 0.005 * SoftwareInvest) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and software investments.\n// FuelOpt1 + FuelOpt2 + FuelOpt3 + SoftwareInvest <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation across all routes is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\n// Trucks1 >= 100; Trucks2 >= 150\n\n## Generate Constraint-4:\nThe investment in route optimization software should not exceed 20% of the total budget allocated for fuel optimization.\n// SoftwareInvest <= 0.2 * (FuelOpt1 + FuelOpt2 + FuelOpt3)",
        "question": "A logistics company is planning its routes for the next quarter and needs to decide the number of trucks to allocate to each route (Route1, Route2, Route3) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software which can reduce fuel consumption and improve efficiency, but at a cost. The initial fuel cost per truck for each route and the effects of fuel optimization and software investment on fuel cost are given in the following Table.\n\n| Route | Initial Fuel Cost per Truck | Reduction per $100 Fuel Opt | Additional Reduction per $1000 Software Invest |\n|-------|-----------------------------|-----------------------------|----------------------------------------------|\n| Route1 | $1000                       | $10                         | $5                                           |\n| Route2 | $1200                       | $10                         | $5                                           |\n| Route3 | $1500                       | $10                         | $5                                           |\n\nThe company has a total budget of $100,000 for fuel optimization and software investments. The total number of trucks available for allocation across all routes is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2. The investment in route optimization software should not exceed 20% of the total budget allocated for fuel optimization.\n\nPlease help the company to minimize the total fuel cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # amount of fuel optimization for Route1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # amount of fuel optimization for Route2\nFuelOpt3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt3\", lb=0)  # amount of fuel optimization for Route3\nSoftwareInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareInvest\", lb=0)  # investment in route optimization software\n\n# Define objective function\nCost1 = (1000 - 0.1 * FuelOpt1 - 0.005 * SoftwareInvest) * Trucks1\nCost2 = (1200 - 0.1 * FuelOpt2 - 0.005 * SoftwareInvest) * Trucks2\nCost3 = (1500 - 0.1 * FuelOpt3 - 0.005 * SoftwareInvest) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel optimization and software investments.\nmodel.addCons(FuelOpt1 + FuelOpt2 + FuelOpt3 + SoftwareInvest <= 100000)\n# The total number of trucks available for allocation across all routes is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n# Due to contractual obligations, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\nmodel.addCons(Trucks1 >= 100)\nmodel.addCons(Trucks2 >= 150)\n# The investment in route optimization software should not exceed 20% of the total budget allocated for fuel optimization.\nmodel.addCons(SoftwareInvest <= 0.2 * (FuelOpt1 + FuelOpt2 + FuelOpt3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Amount of Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Amount of Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Amount of Fuel Optimization for Route3: \", model.getVal(FuelOpt3))\n    print(\"Investment in Route Optimization Software: \", model.getVal(SoftwareInvest))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1599,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1000 units of ProductC are produced.\n// QuantityC >= 1000\n\n## Generate Constraint-5:\nThe company has a budget of $2,000,000 for total production costs for the quarter.\n// (100 - 0.0001 * TechInvestment) * QuantityA + (150 - 0.0001 * TechInvestment) * QuantityB + (200 - 0.0001 * TechInvestment) * QuantityC <= 2000000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function. The production and revenue details for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit |\n|---------|--------------------------|------------------|\n| ProductA | $100 - 0.0001 * TechInvestment | $120 |\n| ProductB | $150 - 0.0001 * TechInvestment | $180 |\n| ProductC | $200 - 0.0001 * TechInvestment | $220 |\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in the new technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must ensure that at least 1000 units of ProductC are produced. The company has a budget of $2,000,000 for total production costs for the quarter.\n\nPlease help the company to maximize the total profit from all products by determining the optimal production quantities of ProductA, ProductB, and ProductC, and the investment in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=1000)  # production quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\nProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\nProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC - TechInvestment)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company must ensure that at least 1000 units of ProductC are produced.\nmodel.addCons(QuantityC >= 1000)\n# The company has a budget of $2,000,000 for total production costs for the quarter.\nmodel.addCons((100 - 0.0001 * TechInvestment) * QuantityA + (150 - 0.0001 * TechInvestment) * QuantityB + (200 - 0.0001 * TechInvestment) * QuantityC <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of ProductA: ProfitA = (100 - 40) * QuantityA\n// Profit of ProductB: ProfitB = (120 - 50) * QuantityB\n// Profit of ProductC: ProfitC = (150 - 60) * QuantityC\n// Profit of ProductD: ProfitD = (200 - 80) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / (5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000\n\n## Generate Constraint-2:\nThe company has a total production capacity of 1000 hours.\n// 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// QuantityA >= 50; QuantityB >= 30\n\n## Generate Constraint-4:\nThe production of ProductC must not exceed the combined production of ProductA and ProductB.\n// QuantityC <= QuantityA + QuantityB\n\n## Generate Constraint-5:\nThe production of ProductD must not exceed the combined production of ProductA, ProductB, and ProductC.\n// QuantityD <= QuantityA + QuantityB + QuantityC",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\nThe company has a budget of $10,000 for raw materials. The company has a total production capacity of 1000 hours. The company must produce at least 50 units of ProductA and 30 units of ProductB. The production of ProductC must not exceed the combined production of ProductA and ProductB. The production of ProductD must not exceed the combined production of ProductA, ProductB, and ProductC.\nPlease help the company to determine the optimal production quantities of ProductA, ProductB, ProductC, and ProductD to maximize the profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=30)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)    # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0)    # production quantity of ProductD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 40) * QuantityA\nProfitB = (120 - 50) * QuantityB\nProfitC = (150 - 60) * QuantityC\nProfitD = (200 - 80) * QuantityD\nProductionTime = 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000)\n## The company has a total production capacity of 1000 hours.\nmodel.addCons(5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD <= 1000)\n## The company must produce at least 50 units of ProductA and 30 units of ProductB.\nmodel.addCons(QuantityA >= 50)\nmodel.addCons(QuantityB >= 30)\n## The production of ProductC must not exceed the combined production of ProductA and ProductB.\nmodel.addCons(QuantityC <= QuantityA + QuantityB)\n## The production of ProductD must not exceed the combined production of ProductA, ProductB, and ProductC.\nmodel.addCons(QuantityD <= QuantityA + QuantityB + QuantityC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Production Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1357,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day.\nThe medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day.\nThe large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day.\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries.\n// Profit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily budget for vehicle operations is $3000.\n// 100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day. The medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day. The large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day. The company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries. The total daily budget for vehicle operations is $3000.\n\nPlease help the company determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nProfit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total daily budget for vehicle operations is $3000.\nmodel.addCons(100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost.\n// Net profit of A: NetProfit_A = (20 - 5) * A\n// Net profit of B: NetProfit_B = (30 - 10) * B\n// Net profit of C: NetProfit_C = (40 - 15) * C\n// Net profit of D: NetProfit_D = (50 - 20) * D\n// Total transportation cost: TotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 5 * A + 10 * B + 15 * C + 20 * D <= 5000\n\n## Generate Constraint-2:\nThe company wants to distribute at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 300 units in total.\n// A + B + C + D <= 300\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit. The profit per unit and transportation cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Transportation Cost per Unit |\n|---------|-----------------|------------------------------|\n| A       | $20             | $5                           |\n| B       | $30             | $10                          |\n| C       | $40             | $15                          |\n| D       | $50             | $20                          |\n\nThe company has a budget of $5000 for transportation costs. The company wants to distribute at least 50 units of each product. The company has a storage capacity limit of 300 units in total. The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C. \nPlease help the company to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to distribute at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (20 - 5) * A\nNetProfit_B = (30 - 10) * B\nNetProfit_C = (40 - 15) * C\nNetProfit_D = (50 - 20) * D\nTotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D <= 5000)\n## The company has a storage capacity limit of 300 units in total.\nmodel.addCons(A + B + C + D <= 300)\n## The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per worker. \nOn machine 1, each worker generates a profit of 100 units of product 1, 150 units of product 2, and 200 units of product 3. \nOn machine 2, each worker generates a profit of 120 units of product 1, 180 units of product 2, and 240 units of product 3. \nOn machine 3, each worker generates a profit of 140 units of product 1, 210 units of product 2, and 280 units of product 3. \nOn machine 4, each worker generates a profit of 160 units of product 1, 240 units of product 2, and 320 units of product 3.\nThe company aims to maximize the total profit from all products.\n// The total profit: P = 100 * M1 + 150 * M1 + 200 * M1 + 120 * M2 + 180 * M2 + 240 * M2 + 140 * M3 + 210 * M3 + 280 * M3 + 160 * M4 + 240 * M4 + 320 * M4\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 <= 60",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. Each machine has a different efficiency and profit contribution per worker. On machine 1, each worker generates a profit of 100 units of product 1, 150 units of product 2, and 200 units of product 3. On machine 2, each worker generates a profit of 120 units of product 1, 180 units of product 2, and 240 units of product 3. On machine 3, each worker generates a profit of 140 units of product 1, 210 units of product 2, and 280 units of product 3. On machine 4, each worker generates a profit of 160 units of product 1, 240 units of product 2, and 320 units of product 3. The company aims to maximize the total profit from all products. There are total 60 workers available. Please help the company determine the optimal number of workers to assign to each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\n\n# Define objective function\n## The total profit: P = 100 * M1 + 150 * M1 + 200 * M1 + 120 * M2 + 180 * M2 + 240 * M2 + 140 * M3 + 210 * M3 + 280 * M3 + 160 * M4 + 240 * M4 + 320 * M4\nP = 100 * M1 + 150 * M1 + 200 * M1 + 120 * M2 + 180 * M2 + 240 * M2 + 140 * M3 + 210 * M3 + 280 * M3 + 160 * M4 + 240 * M4 + 320 * M4\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P\nmodel.addCons(obj == P)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met.\n// Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n// Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n// Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n// Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n// Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500\n\n## Generate Constraint-2:\nThe company has a budget of $1,000,000 for annual maintenance costs.\n// 5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1,000,000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck type has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each truck type to minimize the total operational cost while meeting the cargo delivery requirements.\nFor T1, the operational cost per truck per kilometer is $2, the maintenance cost per truck per year is $5000, and the cargo capacity is 10 tons.\nFor T2, the operational cost per truck per kilometer is $1.5, the maintenance cost per truck per year is $6000, and the cargo capacity is 15 tons.\nFor T3, the operational cost per truck per kilometer is $1.2, the maintenance cost per truck per year is $7000, and the cargo capacity is 20 tons.\nFor T4, the operational cost per truck per kilometer is $1, the maintenance cost per truck per year is $8000, and the cargo capacity is 25 tons.\nFor T5, the operational cost per truck per kilometer is $0.8, the maintenance cost per truck per year is $9000, and the cargo capacity is 30 tons.\nThe company wants to minimize the total annual operational and maintenance costs while ensuring the cargo capacity is met. The total cargo capacity required is 500 tons. The company has a budget of $1,000,000 for annual maintenance costs.\nPlease help the company to minimize the total annual operational and maintenance costs (which is defined as the sum of the operational cost per kilometer multiplied by the distance and the number of trucks plus the maintenance cost per truck per year multiplied by the number of trucks).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # distance traveled by all trucks\n## Total operational cost for T1: Cost_T1 = 2 * Distance * T1 + 5000 * T1\n## Total operational cost for T2: Cost_T2 = 1.5 * Distance * T2 + 6000 * T2\n## Total operational cost for T3: Cost_T3 = 1.2 * Distance * T3 + 7000 * T3\n## Total operational cost for T4: Cost_T4 = 1 * Distance * T4 + 8000 * T4\n## Total operational cost for T5: Cost_T5 = 0.8 * Distance * T5 + 9000 * T5\n## So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == 2 * Distance * T1 + 5000 * T1 + 1.5 * Distance * T2 + 6000 * T2 + 1.2 * Distance * T3 + 7000 * T3 + 1 * Distance * T4 + 8000 * T4 + 0.8 * Distance * T5 + 9000 * T5)\n\n# Add constraints\n## The total cargo capacity required is 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 500)\n## The company has a budget of $1,000,000 for annual maintenance costs.\nmodel.addCons(5000 * T1 + 6000 * T2 + 7000 * T3 + 8000 * T4 + 9000 * T5 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1584,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"ES\", \"range\": \"ES >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n// Energy_output_SP = 0.15 * (1 + 0.005 * (R&D / 100000)) * SP\n// Energy_output_WT = 0.25 * (1 + 0.007 * (R&D / 100000)) * WT\n// Cost_ES = 1000 - 50 * (R&D / 100000) * ES\n// So, the objective function is: Maximize (Energy_output_SP + Energy_output_WT) - Cost_ES\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage.\n// SP * 10000 + WT * 15000 + ES * 500 <= 5000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $1,000,000.\n// R&D <= 1000000\n\n## Generate Constraint-3:\nThe total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n// 2 * SP + 5 * WT <= 5000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage. The total investment in R&D cannot exceed $1,000,000. The total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n\nPlease help the company to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=0)  # number of wind turbines\nES = model.addVar(vtype=\"INTEGER\", name=\"ES\", lb=0)  # amount of energy storage\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R_D\", lb=0)  # investment in R&D\n\n# Define objective function\n# Efficiency and cost calculations\nEfficiency_SP = 0.15 * (1 + 0.005 * (R_D / 100000))\nEfficiency_WT = 0.25 * (1 + 0.007 * (R_D / 100000))\nCost_ES = 1000 - 50 * (R_D / 100000) * ES\n\n# Energy output and cost of storage\nEnergy_output_SP = Efficiency_SP * SP\nEnergy_output_WT = Efficiency_WT * WT\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output_SP + Energy_output_WT - Cost_ES)\n\n# Add constraints\n# Budget constraint\nmodel.addCons(SP * 10000 + WT * 15000 + ES * 500 <= 5000000)\n# R&D investment constraint\nmodel.addCons(R_D <= 1000000)\n# Area constraint\nmodel.addCons(2 * SP + 5 * WT <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Amount of Energy Storage: \", model.getVal(ES))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Maximized Energy Output - Cost of Storage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceA production line\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceB production line\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceC production line\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the production cost per unit is $100, the selling price per unit is $150, and the production rate is 5 units per worker per day.\nFor DeviceB, the production cost per unit is $120, the selling price per unit is $180, and the production rate is 4 units per worker per day.\nFor DeviceC, the production cost per unit is $140, the selling price per unit is $200, and the production rate is 3 units per worker per day.\nThe company wants to maximize the total daily profit.\n// Profit_A = UnitsA * (150 - 100)\n// Profit_B = UnitsB * (180 - 120)\n// Profit_C = UnitsC * (200 - 140)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 20 workers available.\n// WorkersA + WorkersB + WorkersC <= 20\n\n## Generate Constraint-2:\nThe production capacity for each device is limited by the number of workers and the production rate.\n// UnitsA <= 5 * WorkersA\n// UnitsB <= 4 * WorkersB\n// UnitsC <= 3 * WorkersC",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line. The production cost per unit, selling price per unit, and production rate for each device are given in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Production Rate (units/worker/day) |\n|--------|--------------------------|------------------------|------------------------------------|\n| DeviceA | $100                     | $150                   | 5                                  |\n| DeviceB | $120                     | $180                   | 4                                  |\n| DeviceC | $140                     | $200                   | 3                                  |\n\nThe company has a total of 20 workers available. The production capacity for each device is limited by the number of workers and the production rate. Specifically, the number of units produced for DeviceA cannot exceed 5 times the number of workers allocated to DeviceA's production line, the number of units produced for DeviceB cannot exceed 4 times the number of workers allocated to DeviceB's production line, and the number of units produced for DeviceC cannot exceed 3 times the number of workers allocated to DeviceC's production line.\n\nPlease help the company to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for DeviceA production line\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for DeviceB production line\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for DeviceC production line\n\n# Define objective function\nProfit_A = UnitsA * (150 - 100)\nProfit_B = UnitsB * (180 - 120)\nProfit_C = UnitsC * (200 - 140)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 20)\nmodel.addCons(UnitsA <= 5 * WorkersA)\nmodel.addCons(UnitsB <= 4 * WorkersB)\nmodel.addCons(UnitsC <= 3 * WorkersC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for DeviceA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for DeviceB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for DeviceC: \", model.getVal(WorkersC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1471,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network.\n// {\"number of trips to CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for each truck is $0.5, and the distance from CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips.\n// Fuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\n// Fuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\n// Fuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\n// Fuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\n// Fuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\n// Fuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\n// Fuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\n// Fuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\n// Fuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\n// Fuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\n// Fuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\n// Fuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\n// Fuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\n// Fuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\n// Fuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\n// Fuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\n// Fuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\n// Fuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\n// Fuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\n// Fuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n// So, the objective function is: Minimize (Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n## Generate Constraint-1:\nThe company has a total of 1000 trips available per week.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 1000\n\n## Generate Constraint-2:\nDue to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB.\n// TripsA <= 2 * TripsB\n\n## Generate Constraint-3:\nThe company has a limit on the total distance traveled per week, which is 500,000 km.\n// 200 * (TripsA * TripsB + TripsB * TripsA) + 300 * (TripsA * TripsC + TripsC * TripsA + TripsB * TripsC + TripsC * TripsB) + 400 * (TripsA * TripsD + TripsD * TripsA + TripsB * TripsD + TripsD * TripsB + TripsC * TripsD + TripsD * TripsC) + 500 * (TripsA * TripsE + TripsE * TripsA + TripsB * TripsE + TripsE * TripsB + TripsC * TripsE + TripsE * TripsC + TripsD * TripsE + TripsE * TripsD) <= 500000",
        "question": "A logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network. The cost of fuel per kilometer for each truck is $0.5, and the distances between cities are as follows: CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips.\n\n| From/To | CityB (km) | CityC (km) | CityD (km) | CityE (km) |\n|---------|------------|------------|------------|------------|\n| CityA   | 200        | 300        | 400        | 500        |\n| CityB   | 200        | 300        | 400        | 500        |\n| CityC   | 300        | 400        | 500        | 500        |\n| CityD   | 400        | 400        | 500        | 500        |\n| CityE   | 500        | 500        | 500        | 500        |\n\nThe company has a total of 1000 trips available per week. Due to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB. The company also has a limit on the total distance traveled per week, which is 500,000 km.\n\nPlease help the company to minimize the total fuel cost for all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips to CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips to CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips to CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0) # number of trips to CityD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0) # number of trips to CityE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel costs\nFuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\nFuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\nFuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\nFuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\nFuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\nFuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\nFuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\nFuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\nFuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\nFuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\nFuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\nFuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\nFuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\nFuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\nFuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\nFuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\nFuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\nFuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\nFuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\nFuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n\n## the objective function is: Minimize (Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\nmodel.addCons(obj == Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n# Add constraints\n## The company has a total of 1000 trips available per week.\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 1000)\n## Due to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB.\nmodel.addCons(TripsA <= 2 * TripsB)\n## The company has a limit on the total distance traveled per week, which is 500,000 km.\nmodel.addCons(200 * (TripsA * TripsB + TripsB * TripsA) + 300 * (TripsA * TripsC + TripsC * TripsA + TripsB * TripsC + TripsC * TripsB) + 400 * (TripsA * TripsD + TripsD * TripsA + TripsB * TripsD + TripsD * TripsB + TripsC * TripsD + TripsD * TripsC) + 500 * (TripsA * TripsE + TripsE * TripsA + TripsB * TripsE + TripsE * TripsB + TripsC * TripsE + TripsE * TripsC + TripsD * TripsE + TripsE * TripsD) <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips to CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips to CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips to CityD: \", model.getVal(TripsD))\n    print(\"Number of Trips to CityE: \", model.getVal(TripsE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. Additionally, they need to determine the number of drivers to hire for each type of cargo.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy equipment\": \"HeavyEquipmentTrucks\", \"range\": \"HeavyEquipmentTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousMaterialsTrucks\", \"range\": \"HazardousMaterialsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general cargo\": \"GeneralCargoTrucks\", \"range\": \"GeneralCargoTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for perishable goods\": \"PerishableDrivers\", \"range\": \"PerishableDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for heavy equipment\": \"HeavyEquipmentDrivers\", \"range\": \"HeavyEquipmentDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for hazardous materials\": \"HazardousMaterialsDrivers\", \"range\": \"HazardousMaterialsDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for general cargo\": \"GeneralCargoDrivers\", \"range\": \"GeneralCargoDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a truck for perishable goods is $100,000, and the revenue per truck is $150,000. The cost of a truck for heavy equipment is $120,000, and the revenue per truck is $180,000. The cost of a truck for hazardous materials is $150,000, and the revenue per truck is $200,000. The cost of a truck for general cargo is $90,000, and the revenue per truck is $130,000. The salary of a driver is $50,000 per year. The company wants to maximize the net profit per truck, considering both the revenue and the cost of drivers.\n// Net profit for perishable goods: Profit_Perishable = (150,000 - 100,000 - 50,000) * PerishableTrucks\n// Net profit for heavy equipment: Profit_HeavyEquipment = (180,000 - 120,000 - 50,000) * HeavyEquipmentTrucks\n// Net profit for hazardous materials: Profit_HazardousMaterials = (200,000 - 150,000 - 50,000) * HazardousMaterialsTrucks\n// Net profit for general cargo: Profit_GeneralCargo = (130,000 - 90,000 - 50,000) * GeneralCargoTrucks\n// So, the objective function is: Maximize (Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo) / (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing trucks.\n// 100,000 * PerishableTrucks + 120,000 * HeavyEquipmentTrucks + 150,000 * HazardousMaterialsTrucks + 90,000 * GeneralCargoTrucks <= 5,000,000\n\n## Generate Constraint-2:\nThe company can hire up to 100 drivers in total.\n// PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100\n\n## Generate Constraint-3:\nAt least 20% of the trucks must be allocated to hazardous materials due to safety regulations.\n// HazardousMaterialsTrucks >= 0.2 * (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)\n\n## Generate Constraint-4:\nThe company must have at least 5 trucks for each type of cargo.\n// PerishableTrucks >= 5; HeavyEquipmentTrucks >= 5; HazardousMaterialsTrucks >= 5; GeneralCargoTrucks >= 5",
        "question": "A logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. Additionally, they need to determine the number of drivers to hire for each type of cargo.\nThe cost of a truck for perishable goods is $100,000, and the revenue per truck is $150,000. The cost of a truck for heavy equipment is $120,000, and the revenue per truck is $180,000. The cost of a truck for hazardous materials is $150,000, and the revenue per truck is $200,000. The cost of a truck for general cargo is $90,000, and the revenue per truck is $130,000. The salary of a driver is $50,000 per year. The company has a budget of $5,000,000 for purchasing trucks and can hire up to 100 drivers in total. Due to safety regulations, at least 20% of the trucks must be allocated to hazardous materials. The company must also have at least 5 trucks for each type of cargo.\nPlease help the company to maximize the net profit per truck, considering both the revenue and the cost of drivers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nHeavyEquipmentTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentTrucks\", lb=0)\nHazardousMaterialsTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsTrucks\", lb=0)\nGeneralCargoTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoTrucks\", lb=0)\nPerishableDrivers = model.addVar(vtype=\"INTEGER\", name=\"PerishableDrivers\", lb=0)\nHeavyEquipmentDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentDrivers\", lb=0)\nHazardousMaterialsDrivers = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsDrivers\", lb=0)\nGeneralCargoDrivers = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoDrivers\", lb=0)\n\n# Define objective function\nProfit_Perishable = (150000 - 100000 - 50000) * PerishableTrucks\nProfit_HeavyEquipment = (180000 - 120000 - 50000) * HeavyEquipmentTrucks\nProfit_HazardousMaterials = (200000 - 150000 - 50000) * HazardousMaterialsTrucks\nProfit_GeneralCargo = (130000 - 90000 - 50000) * GeneralCargoTrucks\nTotalTrucks = PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalTrucks == Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo)\n\n# Add constraints\nmodel.addCons(100000 * PerishableTrucks + 120000 * HeavyEquipmentTrucks + 150000 * HazardousMaterialsTrucks + 90000 * GeneralCargoTrucks <= 5000000)\nmodel.addCons(PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100)\nmodel.addCons(HazardousMaterialsTrucks >= 0.2 * TotalTrucks)\nmodel.addCons(PerishableTrucks >= 5)\nmodel.addCons(HeavyEquipmentTrucks >= 5)\nmodel.addCons(HazardousMaterialsTrucks >= 5)\nmodel.addCons(GeneralCargoTrucks >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Equipment: \", model.getVal(HeavyEquipmentTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousMaterialsTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralCargoTrucks))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company wants to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n// Total_Cost_T1 = 1.5 * T1\n// Total_Cost_T2 = 2 * T2\n// Total_Cost_T3 = 2.5 * T3\n// Total_Cost_T4 = 3 * T4\n// Total_Cost_T5 = 3.5 * T5\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations.\n// 1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe company must deliver at least 2000 tons of goods.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000",
        "question": "A logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities, fuel consumption per kilometer, and cost per kilometer. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Cost per Kilometer | Capacity (tons) |\n|------------|------------------------------|--------------------|-----------------|\n| T1         | 0.2                          | 1.5$               | 10              |\n| T2         | 0.3                          | 2$                 | 20              |\n| T3         | 0.4                          | 2.5$               | 30              |\n| T4         | 0.5                          | 3$                 | 40              |\n| T5         | 0.6                          | 3.5$               | 50              |\n\nThe company has a budget of $10,000 for truck operations. The total number of trucks cannot exceed 100. The company must deliver at least 2000 tons of goods.\nPlease help the company to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 1.5 * T1\nTotal_Cost_T2 = 2 * T2\nTotal_Cost_T3 = 2.5 * T3\nTotal_Cost_T4 = 3 * T4\nTotal_Cost_T5 = 3.5 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations.\nmodel.addCons(1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The company must deliver at least 2000 tons of goods.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: ZoneA, ZoneB, ZoneC, ZoneD, and ZoneE. The company needs to determine the number of trucks to allocate to each zone and the fuel consumption rate for each truck in each zone.\n// {\"number of trucks for ZoneA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for ZoneA\": \"FuelRateA\", \"range\": \"FuelRateA >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneB\": \"FuelRateB\", \"range\": \"FuelRateB >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneC\": \"FuelRateC\", \"range\": \"FuelRateC >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneD\": \"FuelRateD\", \"range\": \"FuelRateD >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneE\": \"FuelRateE\", \"range\": \"FuelRateE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize the total profit from deliveries, considering the revenue per truck and the cost of fuel. The revenue per truck in ZoneA is $10,000, in ZoneB is $12,000, in ZoneC is $15,000, in ZoneD is $14,000, and in ZoneE is $13,000. The cost of fuel per unit is $3.\n// Total revenue for ZoneA: RevenueA = 10,000 * TrucksA\n// Total revenue for ZoneB: RevenueB = 12,000 * TrucksB\n// Total revenue for ZoneC: RevenueC = 15,000 * TrucksC\n// Total revenue for ZoneD: RevenueD = 14,000 * TrucksD\n// Total revenue for ZoneE: RevenueE = 13,000 * TrucksE\n// Total fuel cost for ZoneA: FuelCostA = FuelRateA * TrucksA * 3\n// Total fuel cost for ZoneB: FuelCostB = FuelRateB * TrucksB * 3\n// Total fuel cost for ZoneC: FuelCostC = FuelRateC * TrucksC * 3\n// Total fuel cost for ZoneD: FuelCostD = FuelRateD * TrucksD * 3\n// Total fuel cost for ZoneE: FuelCostE = FuelRateE * TrucksE * 3\n// So, the objective function is: Maximize (RevenueA - FuelCostA + RevenueB - FuelCostB + RevenueC - FuelCostC + RevenueD - FuelCostD + RevenueE - FuelCostE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all zones must not exceed 1000 units.\n// FuelRateA * TrucksA + FuelRateB * TrucksB + FuelRateC * TrucksC + FuelRateD * TrucksD + FuelRateE * TrucksE <= 1000\n\n## Generate Constraint-3:\nDue to road conditions, the fuel consumption rate in ZoneA must be at least twice that in ZoneB.\n// FuelRateA >= 2 * FuelRateB\n\n## Generate Constraint-4:\nThe company must allocate at least 5 trucks to ZoneC.\n// TrucksC >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: ZoneA, ZoneB, ZoneC, ZoneD, and ZoneE. The company needs to determine the number of trucks to allocate to each zone and the fuel consumption rate for each truck in each zone. The revenue per truck and the cost of fuel per unit are given in the following Table.\n\n| Zone    | Revenue per Truck | Cost of Fuel per Unit |\n|---------|-------------------|-----------------------|\n| ZoneA   | $10,000           | $3                    |\n| ZoneB   | $12,000           | $3                    |\n| ZoneC   | $15,000           | $3                    |\n| ZoneD   | $14,000           | $3                    |\n| ZoneE   | $13,000           | $3                    |\n\nThe company has a total of 50 trucks available for allocation. The total fuel consumption across all zones must not exceed 1000 units. Due to road conditions, the fuel consumption rate in ZoneA must be at least twice that in ZoneB. The company must allocate at least 5 trucks to ZoneC. \n\nPlease help the company to maximize the total profit from deliveries, considering the revenue per truck and the cost of fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for ZoneA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for ZoneB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for ZoneC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0)  # number of trucks for ZoneD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0)  # number of trucks for ZoneE\nFuelRateA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateA\", lb=0)  # fuel consumption rate for ZoneA\nFuelRateB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateB\", lb=0)  # fuel consumption rate for ZoneB\nFuelRateC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateC\", lb=0)  # fuel consumption rate for ZoneC\nFuelRateD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateD\", lb=0)  # fuel consumption rate for ZoneD\nFuelRateE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateE\", lb=0)  # fuel consumption rate for ZoneE\n\n# Define objective function\nRevenueA = 10000 * TrucksA\nRevenueB = 12000 * TrucksB\nRevenueC = 15000 * TrucksC\nRevenueD = 14000 * TrucksD\nRevenueE = 13000 * TrucksE\nFuelCostA = FuelRateA * TrucksA * 3\nFuelCostB = FuelRateB * TrucksB * 3\nFuelCostC = FuelRateC * TrucksC * 3\nFuelCostD = FuelRateD * TrucksD * 3\nFuelCostE = FuelRateE * TrucksE * 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - FuelCostA + RevenueB - FuelCostB + RevenueC - FuelCostC + RevenueD - FuelCostD + RevenueE - FuelCostE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(FuelRateA * TrucksA + FuelRateB * TrucksB + FuelRateC * TrucksC + FuelRateD * TrucksD + FuelRateE * TrucksE <= 1000)\nmodel.addCons(FuelRateA >= 2 * FuelRateB)\nmodel.addCons(TrucksC >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for ZoneA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for ZoneB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for ZoneC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for ZoneD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for ZoneE: \", model.getVal(TrucksE))\n    print(\"Fuel Consumption Rate for ZoneA: \", model.getVal(FuelRateA))\n    print(\"Fuel Consumption Rate for ZoneB: \", model.getVal(FuelRateB))\n    print(\"Fuel Consumption Rate for ZoneC: \", model.getVal(FuelRateC))\n    print(\"Fuel Consumption Rate for ZoneD: \", model.getVal(FuelRateD))\n    print(\"Fuel Consumption Rate for ZoneE: \", model.getVal(FuelRateE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand.\n// {\"number of trucks for product P1\": \"TruckP1\", \"range\": \"TruckP1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P2\": \"TruckP2\", \"range\": \"TruckP2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P3\": \"TruckP3\", \"range\": \"TruckP3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P4\": \"TruckP4\", \"range\": \"TruckP4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P5\": \"TruckP5\", \"range\": \"TruckP5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each product varies with the number of trucks used and the distance traveled. The cost function is nonlinear due to economies of scale in truck usage.\nFor product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck.\nFor product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck.\nFor product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck.\nFor product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck.\nFor product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck.\nThe company aims to minimize the total transportation cost.\n// Total cost for P1: Cost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\n// Total cost for P2: Cost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\n// Total cost for P3: Cost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\n// Total cost for P4: Cost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\n// Total cost for P5: Cost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n// So, the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50\n\n## Generate Constraint-2:\nThe demand for each product requires at least a certain number of trucks. Specifically, P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks.\n// TruckP1 >= 5; TruckP2 >= 6; TruckP3 >= 7; TruckP4 >= 8; TruckP5 >= 9\n\n## Generate Constraint-3:\nDue to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1.\n// TruckP3 >= 2 * TruckP1\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trucks allocated to P4 and P5 does not exceed the combined number allocated to P1, P2, and P3.\n// TruckP4 + TruckP5 <= TruckP1 + TruckP2 + TruckP3",
        "question": "A logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand. The cost of transporting each product varies with the number of trucks used and the distance traveled. For product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck. For product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck. For product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck. For product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck. For product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck. The company has a total of 50 trucks available for distribution. The demand for each product requires at least a certain number of trucks: P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks. Due to strategic partnerships, the number of trucks allocated to P3 must be at least twice the number allocated to P1. The company wants to ensure that the total number of trucks allocated to P4 and P5 does not exceed the combined number allocated to P1, P2, and P3. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckP1 = model.addVar(vtype=\"INTEGER\", name=\"TruckP1\", lb=5)  # number of trucks for product P1\nTruckP2 = model.addVar(vtype=\"INTEGER\", name=\"TruckP2\", lb=6)  # number of trucks for product P2\nTruckP3 = model.addVar(vtype=\"INTEGER\", name=\"TruckP3\", lb=7)  # number of trucks for product P3\nTruckP4 = model.addVar(vtype=\"INTEGER\", name=\"TruckP4\", lb=8)  # number of trucks for product P4\nTruckP5 = model.addVar(vtype=\"INTEGER\", name=\"TruckP5\", lb=9)  # number of trucks for product P5\n\n# Define objective function\n# For each product, the cost per truck increases with the number of trucks used\nCost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\nCost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\nCost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\nCost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\nCost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n# Add constraints\nmodel.addCons(TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50)\nmodel.addCons(TruckP3 >= 2 * TruckP1)\nmodel.addCons(TruckP4 + TruckP5 <= TruckP1 + TruckP2 + TruckP3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for P1: \", model.getVal(TruckP1))\n    print(\"Number of Trucks for P2: \", model.getVal(TruckP2))\n    print(\"Number of Trucks for P3: \", model.getVal(TruckP3))\n    print(\"Number of Trucks for P4: \", model.getVal(TruckP4))\n    print(\"Number of Trucks for P5: \", model.getVal(TruckP5))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1484,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter.\n// Fuel_Cost_A = (0.1 - 0.001 * FuelA) * Distance_A * TruckA\n// Fuel_Cost_B = (0.12 - 0.001 * FuelB) * Distance_B * TruckB\n// Fuel_Cost_C = (0.15 - 0.001 * FuelC) * Distance_C * TruckC\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 kilometers.\n// (0.1 - 0.001 * FuelA) * Distance_A * TruckA + (0.12 - 0.001 * FuelB) * Distance_B * TruckB + (0.15 - 0.001 * FuelC) * Distance_C * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for purchasing trucks and allocating fuel.\n// TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\n// TruckA >= 10; TruckB >= 5\n\n## Generate Constraint-4:\nThe total number of trucks cannot exceed 30.\n// TruckA + TruckB + TruckC <= 30\n\n## Generate Constraint-5:\nThe fuel allocation for each truck type must be at least 50 liters to ensure operational safety.\n// FuelA >= 50; FuelB >= 50; FuelC >= 50",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands. The fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter. The total distance to be covered by all trucks is 5000 kilometers. The company has a budget of $10,000 for purchasing trucks and allocating fuel. The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements. The total number of trucks cannot exceed 30. The fuel allocation for each truck type must be at least 50 liters to ensure operational safety. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_A = (0.1 - 0.001 * FuelA) * 5000 * TruckA\nFuel_Cost_B = (0.12 - 0.001 * FuelB) * 5000 * TruckB\nFuel_Cost_C = (0.15 - 0.001 * FuelC) * 5000 * TruckC\n## the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 kilometers.\nmodel.addCons((0.1 - 0.001 * FuelA) * 5000 * TruckA + (0.12 - 0.001 * FuelB) * 5000 * TruckB + (0.15 - 0.001 * FuelC) * 5000 * TruckC == 5000)\n## The company has a budget of $10,000 for purchasing trucks and allocating fuel.\nmodel.addCons(TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000)\n## The company must have at least 10 TruckA and 5 TruckB to meet specific route requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 5)\n## The total number of trucks cannot exceed 30.\nmodel.addCons(TruckA + TruckB + TruckC <= 30)\n## The fuel allocation for each truck type must be at least 50 liters to ensure operational safety.\nmodel.addCons(FuelA >= 50)\nmodel.addCons(FuelB >= 50)\nmodel.addCons(FuelC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 machines available for the month.\n// MachinesA + MachinesB + MachinesC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $150                   |\n| ProductB | $150                             | $200                   |\n| ProductC | $200                             | $250                   |\n\nThe company has a total of 100 machines available for the month. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities, number of machines, and investment in automation to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\nProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\nProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month. Additionally, the company must decide on the number of hours to allocate for production and maintenance for each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceD\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n// Profit from DeviceA: ProfitA = (100 - 40) * UnitsA - 20 * HoursA\n// Profit from DeviceB: ProfitB = (150 - 60) * UnitsB - 30 * HoursB\n// Profit from DeviceC: ProfitC = (200 - 80) * UnitsC - 40 * HoursC\n// Profit from DeviceD: ProfitD = (250 - 100) * UnitsD - 50 * HoursD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs next month.\n// 40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10,000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for production and maintenance next month.\n// HoursA + HoursB + HoursC + HoursD <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each device are produced next month.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50; UnitsD >= 50\n\n## Generate Constraint-4:\nThe production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC.\n// HoursD <= HoursA + HoursB + HoursC\n\n## Generate Constraint-5:\nThe total units of DeviceC produced must be at least twice the total units of DeviceA produced.\n// UnitsC >= 2 * UnitsA",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month and the number of hours to allocate for production and maintenance for each device. The selling price per unit, material cost per unit, and production cost per hour for each device are given in the following Table.\n\n| Device | Selling Price per Unit | Material Cost per Unit | Production Cost per Hour |\n|--------|------------------------|------------------------|--------------------------|\n| DeviceA | $100                  | $40                    | $20                      |\n| DeviceB | $150                  | $60                    | $30                      |\n| DeviceC | $200                  | $80                    | $40                      |\n| DeviceD | $250                  | $100                   | $50                      |\n\nThe company has a total budget of $10,000 for material costs next month. The company has a total of 500 hours available for production and maintenance next month. The company wants to ensure that at least 50 units of each device are produced next month. The production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC. The total units of DeviceC produced must be at least twice the total units of DeviceA produced.\n\nPlease help the company to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50)  # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=50)  # number of units of DeviceD\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # production hours for DeviceA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # production hours for DeviceB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # production hours for DeviceC\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0)  # production hours for DeviceD\n\n# Define objective function\nProfitA = (100 - 40) * UnitsA - 20 * HoursA\nProfitB = (150 - 60) * UnitsB - 30 * HoursB\nProfitC = (200 - 80) * UnitsC - 40 * HoursC\nProfitD = (250 - 100) * UnitsD - 50 * HoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $10,000 for material costs next month.\nmodel.addCons(40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10000)\n# The company has a total of 500 hours available for production and maintenance next month.\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 500)\n# The company wants to ensure that at least 50 units of each device are produced next month.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 50)\nmodel.addCons(UnitsC >= 50)\nmodel.addCons(UnitsD >= 50)\n# The production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(HoursD <= HoursA + HoursB + HoursC)\n# The total units of DeviceC produced must be at least twice the total units of DeviceA produced.\nmodel.addCons(UnitsC >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Units of DeviceD: \", model.getVal(UnitsD))\n    print(\"Production Hours for DeviceA: \", model.getVal(HoursA))\n    print(\"Production Hours for DeviceB: \", model.getVal(HoursB))\n    print(\"Production Hours for DeviceC: \", model.getVal(HoursC))\n    print(\"Production Hours for DeviceD: \", model.getVal(HoursD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1597,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks allocated to Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs. The cost function for each warehouse is nonlinear and is given by:\nFor Warehouse A: Cost = 500 + 10 * TruckA^2\nFor Warehouse B: Cost = 600 + 8 * TruckB^2\nFor Warehouse C: Cost = 550 + 12 * TruckC^2\nFor Warehouse D: Cost = 700 + 9 * TruckD^2\nFor Warehouse E: Cost = 650 + 11 * TruckE^2\nThe company wants to minimize the total operating cost of all trucks across the warehouses.\n// Total Cost = 500 + 10 * TruckA^2 + 600 + 8 * TruckB^2 + 550 + 12 * TruckC^2 + 700 + 9 * TruckD^2 + 650 + 11 * TruckE^2\n// So, the objective function is: Minimize Total Cost\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nEach warehouse must have at least 5 trucks.\n// TruckA >= 5; TruckB >= 5; TruckC >= 5; TruckD >= 5; TruckE >= 5",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs, as shown in the following Table.\n\n| Warehouse | Cost Function (per truck) |\n|-----------|--------------------------|\n| A         | 500 + 10 * TruckA^2      |\n| B         | 600 + 8 * TruckB^2        |\n| C         | 550 + 12 * TruckC^2       |\n| D         | 700 + 9 * TruckD^2        |\n| E         | 650 + 11 * TruckE^2       |\n\nThe total number of trucks available is 100. Each warehouse must have at least 5 trucks. Please help the company to minimize the total operating cost of all trucks across the warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least 5 trucks.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5) # number of trucks allocated to Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=5) # number of trucks allocated to Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=5) # number of trucks allocated to Warehouse C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=5) # number of trucks allocated to Warehouse D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=5) # number of trucks allocated to Warehouse E\n\n# Define objective function\n## The cost function for each warehouse is nonlinear and is given by:\nCostA = 500 + 10 * TruckA**2\nCostB = 600 + 8 * TruckB**2\nCostC = 550 + 12 * TruckC**2\nCostD = 700 + 9 * TruckD**2\nCostE = 650 + 11 * TruckE**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Total Cost\nTotalCost = CostA + CostB + CostC + CostD + CostE\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Warehouse C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Warehouse D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Warehouse E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The goal is to optimize the delivery efficiency while considering the cost of fuel and the environmental impact.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Region1 trucks\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Region2 trucks\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Region3 trucks\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of fuel and the total carbon emissions from all trucks. The cost of fuel is inversely proportional to the fuel efficiency upgrade, and the carbon emissions are directly proportional to the fuel consumption.\nThe initial fuel cost per truck in Region1 is $1000, but with upgrades, the cost decreases by $10 for every $100 invested in upgrades.\nThe initial fuel cost per truck in Region2 is $1200, and with upgrades, the cost decreases by $12 for every $100 invested in upgrades.\nThe initial fuel cost per truck in Region3 is $1100, and with upgrades, the cost decreases by $11 for every $100 invested in upgrades.\nThe carbon emissions per truck are calculated as the fuel cost divided by 10.\n// Total fuel cost for Region1: Cost1 = (1000 - 0.1 * Upgrade1) * Trucks1\n// Total fuel cost for Region2: Cost2 = (1200 - 0.12 * Upgrade2) * Trucks2\n// Total fuel cost for Region3: Cost3 = (1100 - 0.11 * Upgrade3) * Trucks3\n// Total carbon emissions: Emissions = (Cost1 + Cost2 + Cost3) / 10\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Emissions)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 <= 100000",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The goal is to optimize the delivery efficiency while considering the cost of fuel and the environmental impact.\nThe initial fuel cost per truck in Region1 is $1000, but with upgrades, the cost decreases by $10 for every $100 invested in upgrades.\nThe initial fuel cost per truck in Region2 is $1200, and with upgrades, the cost decreases by $12 for every $100 invested in upgrades.\nThe initial fuel cost per truck in Region3 is $1100, and with upgrades, the cost decreases by $11 for every $100 invested in upgrades.\nThe carbon emissions per truck are calculated as the fuel cost divided by 10.\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\nPlease help the company to minimize the total cost of fuel and the total carbon emissions from all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Region3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # fuel efficiency upgrade for Region1 trucks\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # fuel efficiency upgrade for Region2 trucks\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # fuel efficiency upgrade for Region3 trucks\n\n# Define objective function\nCost1 = (1000 - 0.1 * Upgrade1) * Trucks1\nCost2 = (1200 - 0.12 * Upgrade2) * Trucks2\nCost3 = (1100 - 0.11 * Upgrade3) * Trucks3\nEmissions = (Cost1 + Cost2 + Cost3) / 10\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Emissions)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Region1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Region2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Region3: \", model.getVal(Upgrade3))\n    print(\"Total Cost and Emissions: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost reduction per unit of product is affected by the investment in automation.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkA\", \"range\": \"WorkA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkB\", \"range\": \"WorkB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkC\", \"range\": \"WorkC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The investment in automation reduces the labor cost per unit by $0.01 for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce size across all products must not exceed 100 employees.\n// WorkA + WorkB + WorkC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to production capacity constraints, the production quantity of each product cannot exceed 500 units.\n// ProdA <= 500; ProdB <= 500; ProdC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 employees are dedicated to ProductA and 30 employees to ProductB.\n// WorkA >= 20; WorkB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost reduction per unit of product is affected by the investment in automation. The labor cost per unit, revenue per unit, and the effect of automation on labor costs are given in the following Table.\n\n| Product | Labor Cost per Unit | Revenue per Unit | Automation Effect on Labor Cost |\n|---------|---------------------|------------------|---------------------------------|\n| ProductA | $50                | $100             | $0.01 per $1,000 invested      |\n| ProductB | $70                | $150             | $0.01 per $1,000 invested      |\n| ProductC | $90                | $200             | $0.01 per $1,000 invested      |\n\nThe company aims to maximize the total profit from all products. The total workforce size across all products must not exceed 100 employees. The total investment in automation technology cannot exceed $50,000. Due to production capacity constraints, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 20 employees are dedicated to ProductA and 30 employees to ProductB.\n\nPlease help the company determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity of ProductC\nWorkA = model.addVar(vtype=\"INTEGER\", name=\"WorkA\", lb=0)  # workforce size for ProductA\nWorkB = model.addVar(vtype=\"INTEGER\", name=\"WorkB\", lb=0)  # workforce size for ProductB\nWorkC = model.addVar(vtype=\"INTEGER\", name=\"WorkC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\nProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\nProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkA + WorkB + WorkC <= 100)  # total workforce size constraint\nmodel.addCons(Automation <= 50000)  # investment in automation constraint\nmodel.addCons(ProdA <= 500)  # production capacity constraint for ProductA\nmodel.addCons(ProdB <= 500)  # production capacity constraint for ProductB\nmodel.addCons(ProdC <= 500)  # production capacity constraint for ProductC\nmodel.addCons(WorkA >= 20)  # workforce size for ProductA\nmodel.addCons(WorkB >= 30)  # workforce size for ProductB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles.\n// {\"number of vehicles on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per vehicle is $1000, the fuel cost per vehicle is $200, and the maintenance cost per vehicle is $100.\nFor Route B, the profit per vehicle is $1200, the fuel cost per vehicle is $250, and the maintenance cost per vehicle is $120.\nFor Route C, the profit per vehicle is $1500, the fuel cost per vehicle is $300, and the maintenance cost per vehicle is $150.\nFor Route D, the profit per vehicle is $1800, the fuel cost per vehicle is $350, and the maintenance cost per vehicle is $180.\nFor Route E, the profit per vehicle is $2000, the fuel cost per vehicle is $400, and the maintenance cost per vehicle is $200.\nThe company wants to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost).\n// Net_Profit_A = 1000 * RouteA - 200 * RouteA - 100 * RouteA\n// Net_Profit_B = 1200 * RouteB - 250 * RouteB - 120 * RouteB\n// Net_Profit_C = 1500 * RouteC - 300 * RouteC - 150 * RouteC\n// Net_Profit_D = 1800 * RouteD - 350 * RouteD - 180 * RouteD\n// Net_Profit_E = 2000 * RouteE - 400 * RouteE - 200 * RouteE\n// Total_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 vehicles.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $20,000 for maintenance costs.\n// 100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles. The company wants to determine the number of vehicles to allocate to each route. The profit per vehicle, fuel cost per vehicle, and maintenance cost per vehicle for each route are given in the following Table.\n\n| Route | Profit per Vehicle | Fuel Cost per Vehicle | Maintenance Cost per Vehicle |\n|-------|--------------------|-----------------------|------------------------------|\n| A     | $1000              | $200                  | $100                         |\n| B     | $1200              | $250                  | $120                         |\n| C     | $1500              | $300                  | $150                         |\n| D     | $1800              | $350                  | $180                         |\n| E     | $2000              | $400                  | $200                         |\n\nThe company has a total fleet size of 100 vehicles. The company also has a budget of $20,000 for maintenance costs. The company aims to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost). Please help the company to determine the optimal allocation of vehicles to each route to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of vehicles on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of vehicles on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of vehicles on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of vehicles on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of vehicles on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_A = (1000 - 200 - 100) * RouteA\nNet_Profit_B = (1200 - 250 - 120) * RouteB\nNet_Profit_C = (1500 - 300 - 150) * RouteC\nNet_Profit_D = (1800 - 350 - 180) * RouteD\nNet_Profit_E = (2000 - 400 - 200) * RouteE\nTotal_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n## the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Fuel_Cost == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\n## The company has a total fleet size of 100 vehicles.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 100)\n## The company has a budget of $20,000 for maintenance costs.\nmodel.addCons(100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles on Route A: \", model.getVal(RouteA))\n    print(\"Number of Vehicles on Route B: \", model.getVal(RouteB))\n    print(\"Number of Vehicles on Route C: \", model.getVal(RouteC))\n    print(\"Number of Vehicles on Route D: \", model.getVal(RouteD))\n    print(\"Number of Vehicles on Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1340,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide how many trucks to allocate to each of its five routes: Route A, Route B, Route C, Route D, and Route E. The profit per truck, fuel cost per truck, and maintenance cost per truck for each route are given in the following Table.\n\n| Route | Profit per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|-------|------------------|---------------------|----------------------------|\n| A     | $10,000          | $2,000              | $1,500                     |\n| B     | $12,000          | $2,500              | $1,800                     |\n| C     | $15,000          | $3,000              | $2,000                     |\n| D     | $18,000          | $3,500              | $2,500                     |\n| E     | $20,000          | $4,000              | $3,000                     |\n\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs). The company has a total of 50 trucks available for allocation.\n\nPlease help the company determine the optimal number of trucks to allocate to each route to maximize the net profit per unit of cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trucks for Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\n// {\"number of trucks for perishable food\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishable food\": \"PerishableTrips\", \"range\": \"PerishableTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for textiles\": \"TextilesTrips\", \"range\": \"TextilesTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor perishable food, the revenue per trip is $1000, and the fuel cost per trip is $200.\nFor electronics, the revenue per trip is $1500, and the fuel cost per trip is $300.\nFor textiles, the revenue per trip is $800, and the fuel cost per trip is $150.\nThe company wants to maximize the net profit per day.\n// NetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\n// NetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\n// NetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\n// So, the objective function is: Maximize (NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available.\n// PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20\n\n## Generate Constraint-2:\nDue to safety regulations, each truck can make a maximum of 5 trips per day.\n// PerishableTrips <= 5; ElectronicsTrips <= 5; TextilesTrips <= 5\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $5000.\n// 200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\nFor perishable food, the revenue per trip is $1000, and the fuel cost per trip is $200.\nFor electronics, the revenue per trip is $1500, and the fuel cost per trip is $300.\nFor textiles, the revenue per trip is $800, and the fuel cost per trip is $150.\nThe company has a total of 20 trucks available. Due to safety regulations, each truck can make a maximum of 5 trips per day. The company has a daily fuel budget of $5000.\nPlease help the company to maximize the net profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nPerishableTrips = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrips\", lb=0, ub=5)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0, ub=5)\nTextilesTrips = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrips\", lb=0, ub=5)\n\n# Define objective function\nNetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\nNetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\nNetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20)\nmodel.addCons(PerishableTrips <= 5)\nmodel.addCons(ElectronicsTrips <= 5)\nmodel.addCons(TextilesTrips <= 5)\nmodel.addCons(200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Food: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Textiles: \", model.getVal(TextilesTrucks))\n    print(\"Number of Trips per Truck for Perishable Food: \", model.getVal(PerishableTrips))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Textiles: \", model.getVal(TextilesTrips))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate.\n// {\"number of trips for RouteX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for RouteX: ConsumptionX = 50 - 0.005 * TechX * TripsX\n// Fuel consumption for RouteY: ConsumptionY = 60 - 0.006 * TechY * TripsY\n// Fuel consumption for RouteZ: ConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operations and technology investments.\n// 50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all routes must not exceed 2,000.\n// TripsX + TripsY + TripsZ <= 2,000\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 500 trips on RouteX and 300 trips on RouteY.\n// TripsX >= 500; TripsY >= 300\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each route must not exceed $20,000.\n// TechX <= 20000; TechY <= 20000; TechZ <= 20000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate. The initial fuel consumption rate for each route and the impact of technology investment on the fuel consumption rate are given in the following Table.\n\n| Route | Initial Fuel Consumption Rate | Decrease in Fuel Consumption Rate per $100 Investment |\n|-------|--------------------------------|------------------------------------------------------|\n| RouteX | 50 liters per trip | 0.5 liters per trip |\n| RouteY | 60 liters per trip | 0.6 liters per trip |\n| RouteZ | 70 liters per trip | 0.7 liters per trip |\n\nThe company has a total budget of $100,000 for operations and technology investments. The total number of trips across all routes must not exceed 2,000. Due to contractual obligations, the company must make at least 500 trips on RouteX and 300 trips on RouteY. The investment in fuel-efficient technology for each route must not exceed $20,000.\n\nPlease help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=500)  # number of trips for RouteX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=300)  # number of trips for RouteY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0)     # number of trips for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)   # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)   # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)   # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nConsumptionX = 50 - 0.005 * TechX * TripsX\nConsumptionY = 60 - 0.006 * TechY * TripsY\nConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n# So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for operations and technology investments.\nmodel.addCons(50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000)\n# The total number of trips across all routes must not exceed 2,000.\nmodel.addCons(TripsX + TripsY + TripsZ <= 2000)\n# The investment in fuel-efficient technology for each route must not exceed $20,000.\nmodel.addCons(TechX <= 20000)\nmodel.addCons(TechY <= 20000)\nmodel.addCons(TechZ <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for RouteX: \", model.getVal(TripsX))\n    print(\"Number of Trips for RouteY: \", model.getVal(TripsY))\n    print(\"Number of Trips for RouteZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods using a truck varies with the number of trucks allocated. The cost function is nonlinear and is given by: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants. The company aims to minimize the total transportation cost across all warehouses.\n// Cost_Warehouse1 = a1 * T1^2 + b1 * T1 + c1\n// Cost_Warehouse2 = a2 * T2^2 + b2 * T2 + c2\n// Cost_Warehouse3 = a3 * T3^2 + b3 * T3 + c3\n// Cost_Warehouse4 = a4 * T4^2 + b4 * T4 + c4\n// Cost_Warehouse5 = a5 * T5^2 + b5 * T5 + c5\n// So, the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse has a minimum and maximum number of trucks it can efficiently operate. For warehouse 1, the range is 5 to 20 trucks. For warehouse 2, the range is 10 to 25 trucks. For warehouse 3, the range is 15 to 30 trucks. For warehouse 4, the range is 20 to 35 trucks. For warehouse 5, the range is 25 to 40 trucks.\n// 5 <= T1 <= 20; 10 <= T2 <= 25; 15 <= T3 <= 30; 20 <= T4 <= 35; 25 <= T5 <= 40",
        "question": "A logistics company operates five different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods using a truck varies with the number of trucks allocated and is given by a nonlinear function: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants for each warehouse. The company aims to minimize the total transportation cost across all warehouses.\n\n| Warehouse | Constants (a, b, c) | Range of Trucks |\n|-----------|---------------------|-----------------|\n| 1         | (a1, b1, c1)        | 5 to 20         |\n| 2         | (a2, b2, c2)        | 10 to 25        |\n| 3         | (a3, b3, c3)        | 15 to 30        |\n| 4         | (a4, b4, c4)        | 20 to 35        |\n| 5         | (a5, b5, c5)        | 25 to 40        |\n\nThe total number of trucks available across all warehouses is limited to 100. Each warehouse has a minimum and maximum number of trucks it can efficiently operate as specified in the table. Please help the company to minimize the total transportation cost by determining the optimal number of trucks to allocate to each warehouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to determine the optimal number of trucks to allocate to each warehouse.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=20, ub=35) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=25, ub=40) # number of trucks at warehouse 5\n\n# Define objective function\n## The cost of transporting goods using a truck varies with the number of trucks allocated.\na1, b1, c1 = 0.1, 10, 500 # example constants for warehouse 1\na2, b2, c2 = 0.2, 15, 600 # example constants for warehouse 2\na3, b3, c3 = 0.3, 20, 700 # example constants for warehouse 3\na4, b4, c4 = 0.4, 25, 800 # example constants for warehouse 4\na5, b5, c5 = 0.5, 30, 900 # example constants for warehouse 5\n\nCost_Warehouse1 = a1 * T1**2 + b1 * T1 + c1\nCost_Warehouse2 = a2 * T2**2 + b2 * T2 + c2\nCost_Warehouse3 = a3 * T3**2 + b3 * T3 + c3\nCost_Warehouse4 = a4 * T4**2 + b4 * T4 + c4\nCost_Warehouse5 = a5 * T5**2 + b5 * T5 + c5\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\nmodel.addCons(obj == Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods (GoodA, GoodB, and GoodC) across five regions. They need to determine the number of trucks to allocate for each type of good in each region to optimize their distribution network.\n// {\"number of trucks for GoodA in Region1\": \"TruckA1\", \"range\": \"TruckA1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region2\": \"TruckA2\", \"range\": \"TruckA2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region3\": \"TruckA3\", \"range\": \"TruckA3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region4\": \"TruckA4\", \"range\": \"TruckA4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodA in Region5\": \"TruckA5\", \"range\": \"TruckA5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region1\": \"TruckB1\", \"range\": \"TruckB1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region2\": \"TruckB2\", \"range\": \"TruckB2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region3\": \"TruckB3\", \"range\": \"TruckB3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region4\": \"TruckB4\", \"range\": \"TruckB4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB in Region5\": \"TruckB5\", \"range\": \"TruckB5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region1\": \"TruckC1\", \"range\": \"TruckC1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region2\": \"TruckC2\", \"range\": \"TruckC2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region3\": \"TruckC3\", \"range\": \"TruckC3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region4\": \"TruckC4\", \"range\": \"TruckC4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC in Region5\": \"TruckC5\", \"range\": \"TruckC5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $1000 per day, for GoodB is $1200 per day, and for GoodC is $1500 per day. The revenue generated by each truck for GoodA is $2000 per day, for GoodB is $2500 per day, and for GoodC is $3000 per day. The company wants to maximize the total net profit across all regions.\n// NetProfit_A1 = (2000 - 1000) * TruckA1\n// NetProfit_A2 = (2000 - 1000) * TruckA2\n// NetProfit_A3 = (2000 - 1000) * TruckA3\n// NetProfit_A4 = (2000 - 1000) * TruckA4\n// NetProfit_A5 = (2000 - 1000) * TruckA5\n// NetProfit_B1 = (2500 - 1200) * TruckB1\n// NetProfit_B2 = (2500 - 1200) * TruckB2\n// NetProfit_B3 = (2500 - 1200) * TruckB3\n// NetProfit_B4 = (2500 - 1200) * TruckB4\n// NetProfit_B5 = (2500 - 1200) * TruckB5\n// NetProfit_C1 = (3000 - 1500) * TruckC1\n// NetProfit_C2 = (3000 - 1500) * TruckC2\n// NetProfit_C3 = (3000 - 1500) * TruckC3\n// NetProfit_C4 = (3000 - 1500) * TruckC4\n// NetProfit_C5 = (3000 - 1500) * TruckC5\n// So, the objective function is: Maximize (NetProfit_A1 + NetProfit_A2 + NetProfit_A3 + NetProfit_A4 + NetProfit_A5 + NetProfit_B1 + NetProfit_B2 + NetProfit_B3 + NetProfit_B4 + NetProfit_B5 + NetProfit_C1 + NetProfit_C2 + NetProfit_C3 + NetProfit_C4 + NetProfit_C5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available across all regions.\n// TruckA1 + TruckA2 + TruckA3 + TruckA4 + TruckA5 + TruckB1 + TruckB2 + TruckB3 + TruckB4 + TruckB5 + TruckC1 + TruckC2 + TruckC3 + TruckC4 + TruckC5 <= 50",
        "question": "A logistics company is managing the distribution of three types of goods (GoodA, GoodB, and GoodC) across five regions. They need to determine the number of trucks to allocate for each type of good in each region to optimize their distribution network. The cost and revenue for operating each type of truck are given in the following Table.\n\n| Good | Cost per Day | Revenue per Day |\n|------|--------------|-----------------|\n| A    | $1000        | $2000           |\n| B    | $1200        | $2500           |\n| C    | $1500        | $3000           |\n\nThe company wants to maximize the total net profit across all regions. The company has a total of 50 trucks available across all regions. Please help the company determine the optimal allocation of trucks for each type of good in each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA1 = model.addVar(vtype=\"INTEGER\", name=\"TruckA1\", lb=0)\nTruckA2 = model.addVar(vtype=\"INTEGER\", name=\"TruckA2\", lb=0)\nTruckA3 = model.addVar(vtype=\"INTEGER\", name=\"TruckA3\", lb=0)\nTruckA4 = model.addVar(vtype=\"INTEGER\", name=\"TruckA4\", lb=0)\nTruckA5 = model.addVar(vtype=\"INTEGER\", name=\"TruckA5\", lb=0)\nTruckB1 = model.addVar(vtype=\"INTEGER\", name=\"TruckB1\", lb=0)\nTruckB2 = model.addVar(vtype=\"INTEGER\", name=\"TruckB2\", lb=0)\nTruckB3 = model.addVar(vtype=\"INTEGER\", name=\"TruckB3\", lb=0)\nTruckB4 = model.addVar(vtype=\"INTEGER\", name=\"TruckB4\", lb=0)\nTruckB5 = model.addVar(vtype=\"INTEGER\", name=\"TruckB5\", lb=0)\nTruckC1 = model.addVar(vtype=\"INTEGER\", name=\"TruckC1\", lb=0)\nTruckC2 = model.addVar(vtype=\"INTEGER\", name=\"TruckC2\", lb=0)\nTruckC3 = model.addVar(vtype=\"INTEGER\", name=\"TruckC3\", lb=0)\nTruckC4 = model.addVar(vtype=\"INTEGER\", name=\"TruckC4\", lb=0)\nTruckC5 = model.addVar(vtype=\"INTEGER\", name=\"TruckC5\", lb=0)\n\n# Define objective function\nNetProfit_A1 = (2000 - 1000) * TruckA1\nNetProfit_A2 = (2000 - 1000) * TruckA2\nNetProfit_A3 = (2000 - 1000) * TruckA3\nNetProfit_A4 = (2000 - 1000) * TruckA4\nNetProfit_A5 = (2000 - 1000) * TruckA5\nNetProfit_B1 = (2500 - 1200) * TruckB1\nNetProfit_B2 = (2500 - 1200) * TruckB2\nNetProfit_B3 = (2500 - 1200) * TruckB3\nNetProfit_B4 = (2500 - 1200) * TruckB4\nNetProfit_B5 = (2500 - 1200) * TruckB5\nNetProfit_C1 = (3000 - 1500) * TruckC1\nNetProfit_C2 = (3000 - 1500) * TruckC2\nNetProfit_C3 = (3000 - 1500) * TruckC3\nNetProfit_C4 = (3000 - 1500) * TruckC4\nNetProfit_C5 = (3000 - 1500) * TruckC5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A1 + NetProfit_A2 + NetProfit_A3 + NetProfit_A4 + NetProfit_A5 + NetProfit_B1 + NetProfit_B2 + NetProfit_B3 + NetProfit_B4 + NetProfit_B5 + NetProfit_C1 + NetProfit_C2 + NetProfit_C3 + NetProfit_C4 + NetProfit_C5)\n\n# Add constraints\nmodel.addCons(TruckA1 + TruckA2 + TruckA3 + TruckA4 + TruckA5 + TruckB1 + TruckB2 + TruckB3 + TruckB4 + TruckB5 + TruckC1 + TruckC2 + TruckC3 + TruckC4 + TruckC5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for GoodA in Region1: \", model.getVal(TruckA1))\n    print(\"Number of trucks for GoodA in Region2: \", model.getVal(TruckA2))\n    print(\"Number of trucks for GoodA in Region3: \", model.getVal(TruckA3))\n    print(\"Number of trucks for GoodA in Region4: \", model.getVal(TruckA4))\n    print(\"Number of trucks for GoodA in Region5: \", model.getVal(TruckA5))\n    print(\"Number of trucks for GoodB in Region1: \", model.getVal(TruckB1))\n    print(\"Number of trucks for GoodB in Region2: \", model.getVal(TruckB2))\n    print(\"Number of trucks for GoodB in Region3: \", model.getVal(TruckB3))\n    print(\"Number of trucks for GoodB in Region4: \", model.getVal(TruckB4))\n    print(\"Number of trucks for GoodB in Region5: \", model.getVal(TruckB5))\n    print(\"Number of trucks for GoodC in Region1: \", model.getVal(TruckC1))\n    print(\"Number of trucks for GoodC in Region2: \", model.getVal(TruckC2))\n    print(\"Number of trucks for GoodC in Region3: \", model.getVal(TruckC3))\n    print(\"Number of trucks for GoodC in Region4: \", model.getVal(TruckC4))\n    print(\"Number of trucks for GoodC in Region5: \", model.getVal(TruckC5))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 15,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various locations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The company has three types of trucks: TruckA, TruckB, and TruckC.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type increases with the investment in upgrades. For every $1000 invested in upgrades for TruckA, the fuel efficiency improves by 5%. For TruckB, the improvement is 4% per $1000, and for TruckC, it's 3% per $1000. The company aims to minimize the total fuel cost across all trucks, considering the initial fuel consumption rates of 100, 120, and 150 liters per 100 km for TruckA, TruckB, and TruckC, respectively.\n// Fuel cost for TruckA: CostA = (100 * (1 - 0.05 * UpgradeA / 1000)) * TruckA\n// Fuel cost for TruckB: CostB = (120 * (1 - 0.04 * UpgradeB / 1000)) * TruckB\n// Fuel cost for TruckC: CostC = (150 * (1 - 0.03 * UpgradeC / 1000)) * TruckC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + UpgradeA + UpgradeB + UpgradeC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 100.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 20 trucks of type A and 30 trucks of type B.\n// TruckA >= 20; TruckB >= 30",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various locations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The company has three types of trucks: TruckA, TruckB, and TruckC. The fuel efficiency of each truck type increases with the investment in upgrades. For every $1000 invested in upgrades for TruckA, the fuel efficiency improves by 5%. For TruckB, the improvement is 4% per $1000, and for TruckC, it's 3% per $1000. The initial fuel consumption rates are 100, 120, and 150 liters per 100 km for TruckA, TruckB, and TruckC, respectively.\n\n| Truck Type | Initial Fuel Consumption (liters/100km) | Fuel Efficiency Improvement per $1000 |\n|------------|-----------------------------------------|---------------------------------------|\n| TruckA     | 100                                     | 5%                                     |\n| TruckB     | 120                                     | 4%                                     |\n| TruckC     | 150                                     | 3%                                     |\n\nThe company has a budget of $100,000 for truck allocations and fuel efficiency upgrades. The total number of trucks available for allocation is limited to 100. Due to contractual obligations, the company must allocate at least 20 trucks of type A and 30 trucks of type B.\n\nPlease help the company to minimize the total fuel cost across all trucks, considering the investments in fuel efficiency upgrades and the constraints on truck allocations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=20)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=30)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # fuel efficiency upgrade for TruckA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # fuel efficiency upgrade for TruckB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # fuel efficiency upgrade for TruckC\n\n# Define objective function\nCostA = (100 * (1 - 0.05 * UpgradeA / 1000)) * TruckA\nCostB = (120 * (1 - 0.04 * UpgradeB / 1000)) * TruckB\nCostC = (150 * (1 - 0.03 * UpgradeC / 1000)) * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + UpgradeA + UpgradeB + UpgradeC <= 100000)\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1631,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good. Additionally, the company needs to decide on the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit.\n// {\"number of units of GoodsA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for GoodsA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe transportation cost per unit decreases with the investment in fuel efficiency for each type of good.\nThe initial cost per unit of GoodsA is $30, but with fuel efficiency upgrades, the cost decreases by $1 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsB is $40, and with fuel efficiency upgrades, the cost decreases by $1.5 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsC is $50, and with fuel efficiency upgrades, the cost decreases by $2 per unit for every $100 invested in efficiency. \nThe company aims to minimize the total transportation cost from all goods.\n// Total cost for GoodsA: CostA = (30 - 0.01 * EfficiencyA) * UnitsA\n// Total cost for GoodsB: CostB = (40 - 0.015 * EfficiencyB) * UnitsB\n// Total cost for GoodsC: CostC = (50 - 0.02 * EfficiencyC) * UnitsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000\n\n## Generate Constraint-2:\nThe total capacity of the fleet for the next month is limited to 500 units.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good and the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit. The initial cost per unit and the effect of fuel efficiency upgrades on the cost for each type of good are given in the following Table.\n\n| Good       | Initial Cost per Unit | Decrease in Cost per Unit per $100 Invested in Efficiency |\n|------------|----------------------|--------------------------------------------------------|\n| GoodsA     | $30                  | $1                                                    |\n| GoodsB     | $40                  | $1.5                                                  |\n| GoodsC     | $50                  | $2                                                    |\n\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades. The total capacity of the fleet for the next month is limited to 500 units. Please help the company to minimize the total transportation cost from all goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of GoodsA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of GoodsB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of GoodsC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for GoodsA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for GoodsB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for GoodsC\n\n# Define objective function\nCostA = (30 - 0.01 * EfficiencyA) * UnitsA\nCostB = (40 - 0.015 * EfficiencyB) * UnitsB\nCostC = (50 - 0.02 * EfficiencyC) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsA: \", model.getVal(UnitsA))\n    print(\"Number of Units of GoodsB: \", model.getVal(UnitsB))\n    print(\"Number of Units of GoodsC: \", model.getVal(UnitsC))\n    print(\"Investment in Fuel Efficiency for GoodsA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for GoodsB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for GoodsC: \", model.getVal(EfficiencyC))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\n// ProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\n// ProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for efficiency investments.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 500 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of ProductA and 150 units of ProductB.\n// ProductAQty >= 100; ProductBQty >= 150\n\n## Generate Constraint-4:\nThe investment in efficiency for each product line cannot exceed the production cost saved by the investment.\n// EfficiencyA <= 5000; EfficiencyB <= 7000; EfficiencyC <= 9000\n\n## Generate Constraint-5:\nThe production cost per unit cannot be less than $30 after efficiency enhancements.\n// 50 - 0.01 * EfficiencyA >= 30; 70 - 0.015 * EfficiencyB >= 30; 90 - 0.02 * EfficiencyC >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment. The production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total budget of $10,000 for efficiency investments. The total production capacity of the company is 500 units per month. The company must produce at least 100 units of ProductA and 150 units of ProductB. The investment in efficiency for each product line cannot exceed the production cost saved by the investment. The production cost per unit cannot be less than $30 after efficiency enhancements.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=100) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=150) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\nProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\nProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 10000) # total budget for efficiency investments\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500) # total production capacity\nmodel.addCons(EfficiencyA <= 5000) # investment in efficiency for ProductA\nmodel.addCons(EfficiencyB <= 7000) # investment in efficiency for ProductB\nmodel.addCons(EfficiencyC <= 9000) # investment in efficiency for ProductC\nmodel.addCons(50 - 0.01 * EfficiencyA >= 30) # production cost per unit of ProductA\nmodel.addCons(70 - 0.015 * EfficiencyB >= 30) # production cost per unit of ProductB\nmodel.addCons(90 - 0.02 * EfficiencyC >= 30) # production cost per unit of ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1336,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency investment for each region to reduce operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency investment in Region1\": \"Invest1\", \"range\": \"Invest1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region2\": \"Invest2\", \"range\": \"Invest2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region3\": \"Invest3\", \"range\": \"Invest3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region4\": \"Invest4\", \"range\": \"Invest4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region5\": \"Invest5\", \"range\": \"Invest5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with increased fuel efficiency investment. The initial operational cost per truck in Region1 is $1000, and for every $1000 invested in fuel efficiency, the cost decreases by $50. The same pattern applies to the other regions with different initial costs: Region2 ($1200), Region3 ($900), Region4 ($1100), and Region5 ($1300). The company aims to minimize the total operational cost across all regions.\n// Cost_Region1 = (1000 - 0.05 * Invest1) * Trucks1\n// Cost_Region2 = (1200 - 0.05 * Invest2) * Trucks2\n// Cost_Region3 = (900 - 0.05 * Invest3) * Trucks3\n// Cost_Region4 = (1100 - 0.05 * Invest4) * Trucks4\n// Cost_Region5 = (1300 - 0.05 * Invest5) * Trucks5\n// So, the objective function is: Minimize (Cost_Region1 + Cost_Region2 + Cost_Region3 + Cost_Region4 + Cost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel efficiency investments and truck operations.\n// (1000 - 0.05 * Invest1) * Trucks1 + (1200 - 0.05 * Invest2) * Trucks2 + (900 - 0.05 * Invest3) * Trucks3 + (1100 - 0.05 * Invest4) * Trucks4 + (1300 - 0.05 * Invest5) * Trucks5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency investment for each region to reduce operational costs. The initial operational cost per truck and the effect of fuel efficiency investment on operational cost for each region are given in the following Table.\n\n| Region | Initial Operational Cost per Truck | Effect of $1000 Fuel Efficiency Investment |\n|--------|------------------------------------|---------------------------------------------|\n| Region1 | $1000                             | $50 decrease in operational cost           |\n| Region2 | $1200                             | $50 decrease in operational cost           |\n| Region3 | $900                              | $50 decrease in operational cost           |\n| Region4 | $1100                             | $50 decrease in operational cost           |\n| Region5 | $1300                             | $50 decrease in operational cost           |\n\nThe company has a total budget of $100,000 for fuel efficiency investments and truck operations. Please help the company to minimize the total operational cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest1\", lb=0)  # fuel efficiency investment in Region1\nInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest2\", lb=0)  # fuel efficiency investment in Region2\nInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest3\", lb=0)  # fuel efficiency investment in Region3\nInvest4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest4\", lb=0)  # fuel efficiency investment in Region4\nInvest5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest5\", lb=0)  # fuel efficiency investment in Region5\n\n# Define objective function\nCost_Region1 = (1000 - 0.05 * Invest1) * Trucks1\nCost_Region2 = (1200 - 0.05 * Invest2) * Trucks2\nCost_Region3 = (900 - 0.05 * Invest3) * Trucks3\nCost_Region4 = (1100 - 0.05 * Invest4) * Trucks4\nCost_Region5 = (1300 - 0.05 * Invest5) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Region1 + Cost_Region2 + Cost_Region3 + Cost_Region4 + Cost_Region5)\n\n# Add constraints\nmodel.addCons((1000 - 0.05 * Invest1) * Trucks1 + (1200 - 0.05 * Invest2) * Trucks2 + \n              (900 - 0.05 * Invest3) * Trucks3 + (1100 - 0.05 * Invest4) * Trucks4 + \n              (1300 - 0.05 * Invest5) * Trucks5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency Region1: \", model.getVal(Invest1))\n    print(\"Investment in Fuel Efficiency Region2: \", model.getVal(Invest2))\n    print(\"Investment in Fuel Efficiency Region3: \", model.getVal(Invest3))\n    print(\"Investment in Fuel Efficiency Region4: \", model.getVal(Invest4))\n    print(\"Investment in Fuel Efficiency Region5: \", model.getVal(Invest5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1291,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine type should be operated in the production process.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for machine A\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine B\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine C\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine D\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the material cost is $2000, and the operational cost per hour is $100.\nFor machine B, the selling price is $7000, the material cost is $3000, and the operational cost per hour is $150.\nFor machine C, the selling price is $9000, the material cost is $4000, and the operational cost per hour is $200.\nFor machine D, the selling price is $11000, the material cost is $5000, and the operational cost per hour is $250.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost.\n// Profit of A: Profit_A = (5000 - 2000) * A - 100 * HoursA\n// Profit of B: Profit_B = (7000 - 3000) * B - 150 * HoursB\n// Profit of C: Profit_C = (9000 - 4000) * C - 200 * HoursC\n// Profit of D: Profit_D = (11000 - 5000) * D - 250 * HoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for material costs next month.\n// 2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150,000",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine type should be operated in the production process. The selling price, material cost, and operational cost per hour for each machine are given in the following Table.\n\n| Machine | Selling Price | Material Cost | Operational Cost per Hour |\n|---------|---------------|---------------|---------------------------|\n| A       | $5000         | $2000         | $100                      |\n| B       | $7000         | $3000         | $150                      |\n| C       | $9000         | $4000         | $200                      |\n| D       | $11000        | $5000         | $250                      |\n\nThe company has a total budget of $150,000 for material costs next month. The company aims to maximize the total profit, which is the sum of the selling price minus the material cost and the operational cost. Please help the company determine the optimal number of units to produce for each machine type and the optimal number of hours each machine type should be operated to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of machine D\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # hours of operation for machine A\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # hours of operation for machine B\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # hours of operation for machine C\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # hours of operation for machine D\n\n# Define objective function\nProfit_A = (5000 - 2000) * A - 100 * HoursA\nProfit_B = (7000 - 3000) * B - 150 * HoursB\nProfit_C = (9000 - 4000) * C - 200 * HoursC\nProfit_D = (11000 - 5000) * D - 250 * HoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for material costs next month.\nmodel.addCons(2000 * A + 3000 * B + 4000 * C + 5000 * D <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Hours of Operation for Machine A: \", model.getVal(HoursA))\n    print(\"Hours of Operation for Machine B: \", model.getVal(HoursB))\n    print(\"Hours of Operation for Machine C: \", model.getVal(HoursC))\n    print(\"Hours of Operation for Machine D: \", model.getVal(HoursD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on R1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes.\n// So, the objective function is: Minimize (100 * R1^2 + 120 * R2^2 + 140 * R3^2 + 160 * R4^2 + 180 * R5^2)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// R1 + R2 + R3 + R4 + R5 <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel and maintenance costs. The cost per truck per route is linearly related to the number of trucks on that route.\n// 100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000\n\n## Generate Constraint-3:\nThe demand for transportation on route R1 is at least 5 trucks.\n// R1 >= 5",
        "question": "A logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes. The company has a total of 50 trucks available for allocation. The company has a budget of $10,000 for fuel and maintenance costs. The cost per truck per route is linearly related to the number of trucks on that route. The demand for transportation on route R1 is at least 5 trucks.\nPlease help the company to minimize the total operating cost of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=5) # number of trucks on R1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0) # number of trucks on R2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0) # number of trucks on R3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0) # number of trucks on R4\nR5 = model.addVar(vtype=\"INTEGER\", name=\"R5\", lb=0) # number of trucks on R5\n\n# Define objective function\nCost_R1 = 100 * R1**2\nCost_R2 = 120 * R2**2\nCost_R3 = 140 * R3**2\nCost_R4 = 160 * R4**2\nCost_R5 = 180 * R5**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 50)\nmodel.addCons(100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on R1: \", model.getVal(R1))\n    print(\"Number of Trucks on R2: \", model.getVal(R2))\n    print(\"Number of Trucks on R3: \", model.getVal(R3))\n    print(\"Number of Trucks on R4: \", model.getVal(R4))\n    print(\"Number of Trucks on R5: \", model.getVal(R5))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is inversely proportional to the square of its speed. The faster a truck travels, the less fuel it consumes per kilometer, but the more it costs in terms of maintenance and wear. The revenue per route is directly proportional to the number of trucks used. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs.\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1500 * Trucks2\n// Revenue_Route3 = 2000 * Trucks3\n// FuelCost_Route1 = (1 / (Speed1^2)) * Trucks1\n// FuelCost_Route2 = (1 / (Speed2^2)) * Trucks2\n// FuelCost_Route3 = (1 / (Speed3^2)) * Trucks3\n// MaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\n// MaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\n// MaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 + Revenue_Route2 + Revenue_Route3) - (FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel and maintenance costs.\n// (1 / (Speed1^2)) * Trucks1 + (1 / (Speed2^2)) * Trucks2 + (1 / (Speed3^2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to safety regulations, the average speed of all trucks across all routes must not exceed 50 km/h.\n// (Trucks1 * Speed1 + Trucks2 * Speed2 + Trucks3 * Speed3) / (Trucks1 + Trucks2 + Trucks3) <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to different cities. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The speed of a truck affects its fuel efficiency and the time it takes to complete the route. The fuel cost per kilometer for each truck is inversely proportional to the square of its speed, and the revenue per route is directly proportional to the number of trucks used. The company aims to maximize the net profit, which is the total revenue minus the total fuel and maintenance costs.\n\n| Route | Revenue per Truck | Fuel Cost per Kilometer | Maintenance Cost per Truck |\n|-------|-------------------|-------------------------|----------------------------|\n| Route1 | 1000$ | (1 / (Speed1^2)) | 0.1 * Speed1 |\n| Route2 | 1500$ | (1 / (Speed2^2)) | 0.1 * Speed2 |\n| Route3 | 2000$ | (1 / (Speed3^2)) | 0.1 * Speed3 |\n\nThe company has a total budget of $100,000 for fuel and maintenance costs. The total number of trucks available is limited to 100. Due to safety regulations, the average speed of all trucks across all routes must not exceed 50 km/h.\n\nPlease help the company to determine the optimal number of trucks and their speeds for each route to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0.1, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0.1, ub=60)  # speed of trucks for Route2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0.1, ub=60)  # speed of trucks for Route3\n\n# Define objective function\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1500 * Trucks2\nRevenue_Route3 = 2000 * Trucks3\nFuelCost_Route1 = (1 / (Speed1**2)) * Trucks1\nFuelCost_Route2 = (1 / (Speed2**2)) * Trucks2\nFuelCost_Route3 = (1 / (Speed3**2)) * Trucks3\nMaintenanceCost_Route1 = 0.1 * Speed1 * Trucks1\nMaintenanceCost_Route2 = 0.1 * Speed2 * Trucks2\nMaintenanceCost_Route3 = 0.1 * Speed3 * Trucks3\nTotalCost = FuelCost_Route1 + FuelCost_Route2 + FuelCost_Route3 + MaintenanceCost_Route1 + MaintenanceCost_Route2 + MaintenanceCost_Route3\nNetProfit = Revenue_Route1 + Revenue_Route2 + Revenue_Route3 - TotalCost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons((1 / (Speed1**2)) * Trucks1 + (1 / (Speed2**2)) * Trucks2 + (1 / (Speed3**2)) * Trucks3 + 0.1 * Speed1 * Trucks1 + 0.1 * Speed2 * Trucks2 + 0.1 * Speed3 * Trucks3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\nmodel.addCons((Trucks1 * Speed1 + Trucks2 * Speed2 + Trucks3 * Speed3) / (Trucks1 + Trucks2 + Trucks3) <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks for Route3: \", model.getVal(Speed3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1316,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company also needs to decide on the maintenance budget for each vehicle type to optimize their performance and longevity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Trucks\": \"MaintenanceT\", \"range\": \"MaintenanceT >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Vans\": \"MaintenanceV\", \"range\": \"MaintenanceV >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Bikes\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of Trucks is $100 per day, and with additional maintenance, the cost decreases by $1 for every $100 spent on maintenance.\nThe operational cost of Vans is $70 per day, and with additional maintenance, the cost decreases by $0.7 for every $100 spent on maintenance.\nThe operational cost of Bikes is $30 per day, and with additional maintenance, the cost decreases by $0.3 for every $100 spent on maintenance.\nThe company aims to minimize the total daily operational cost of all vehicles.\n// Total daily cost for Trucks: CostT = 100 - 0.01 * MaintenanceT\n// Total daily cost for Vans: CostV = 70 - 0.007 * MaintenanceV\n// Total daily cost for Bikes: CostB = 30 - 0.003 * MaintenanceB\n// So, the objective function is: Minimize (CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle purchases and maintenance.\n// 100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 500.\n// Trucks + Vans + Bikes <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 50 Trucks and 100 Vans.\n// Trucks >= 50; Vans >= 100\n\n## Generate Constraint-4:\nThe maintenance budget for each vehicle type should not exceed 20% of the total maintenance budget.\n// MaintenanceT <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB)\n// MaintenanceV <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB)\n// MaintenanceB <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB)",
        "question": "A logistics company is planning its fleet for the next quarter and operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities, and the company needs to decide on the maintenance budget for each vehicle type to optimize their performance and longevity. The operational cost of Trucks is $100 per day, which decreases by $1 for every $100 spent on maintenance. The operational cost of Vans is $70 per day, which decreases by $0.7 for every $100 spent on maintenance. The operational cost of Bikes is $30 per day, which decreases by $0.3 for every $100 spent on maintenance. The company aims to minimize the total daily operational cost of all vehicles.\n\nThe company has a total budget of $100,000 for vehicle purchases and maintenance. The total number of vehicles cannot exceed 500. Due to contractual obligations, the company must have at least 50 Trucks and 100 Vans. The maintenance budget for each vehicle type should not exceed 20% of the total maintenance budget.\n\nPlease help the company to determine the optimal number of each vehicle type and their respective maintenance budgets to minimize the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nMaintenanceT = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceT\", lb=0)  # maintenance budget for Trucks\nMaintenanceV = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceV\", lb=0)  # maintenance budget for Vans\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance budget for Bikes\n\n# Define objective function\nCostT = 100 - 0.01 * MaintenanceT\nCostV = 70 - 0.007 * MaintenanceV\nCostB = 30 - 0.003 * MaintenanceB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT * Trucks + CostV * Vans + CostB * Bikes)\n\n# Add constraints\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes + MaintenanceT + MaintenanceV + MaintenanceB <= 100000)\nmodel.addCons(Trucks + Vans + Bikes <= 500)\nmodel.addCons(MaintenanceT <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB))\nmodel.addCons(MaintenanceV <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB))\nmodel.addCons(MaintenanceB <= 0.2 * (MaintenanceT + MaintenanceV + MaintenanceB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maintenance Budget for Trucks: \", model.getVal(MaintenanceT))\n    print(\"Maintenance Budget for Vans: \", model.getVal(MaintenanceV))\n    print(\"Maintenance Budget for Bikes: \", model.getVal(MaintenanceB))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\nThe company has a limited fuel budget of 500 liters.\nPlease help the company determine the optimal number of trips for each vehicle to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for V1: \", model.getVal(V1))\n    print(\"Number of Trips for V2: \", model.getVal(V2))\n    print(\"Number of Trips for V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 779,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500\n\n## Generate Constraint-2:\nDue to storage limitations, the number of container C cannot exceed twice the number of container A.\n// ContainerC <= 2 * ContainerA\n\n## Generate Constraint-3:\nThe company has a contractual obligation to ship at least 50 containers of type D.\n// ContainerD >= 50\n\n## Generate Constraint-4:\nThe total weight of all containers must not exceed 100,000 kg. Container A weighs 100 kg, container B weighs 200 kg, container C weighs 300 kg, container D weighs 400 kg, and container E weighs 500 kg.\n// 100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping each container and their weights are given in the following Table.\n\n| Container | Shipping Cost per Unit | Weight per Unit |\n|-----------|------------------------|-----------------|\n| A         | $100                   | 100 kg          |\n| B         | $150                   | 200 kg          |\n| C         | $200                   | 300 kg          |\n| D         | $250                   | 400 kg          |\n| E         | $300                   | 500 kg          |\n\nThe company has a fixed cost of $5000 for the shipping operation. The company has a total shipping capacity of 500 containers. Due to storage limitations, the number of container C cannot exceed twice the number of container A. The company has a contractual obligation to ship at least 50 containers of type D. The total weight of all containers must not exceed 100,000 kg. \n\nPlease help the company to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=0)\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=0)\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=0)\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=0)\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=0)\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n# Due to storage limitations, the number of container C cannot exceed twice the number of container A.\nmodel.addCons(ContainerC <= 2 * ContainerA)\n# The company has a contractual obligation to ship at least 50 containers of type D.\nmodel.addCons(ContainerD >= 50)\n# The total weight of all containers must not exceed 100,000 kg.\nmodel.addCons(100 * ContainerA + 200 * ContainerB + 300 * ContainerC + 400 * ContainerD + 500 * ContainerE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $30,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 30000\n\n## Generate Constraint-4:\nThe company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n// QuantityA >= 2000; QuantityB >= 3000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process for each product, and the marketing budget for each product. The level of automation affects the production cost per unit and the production rate, while the marketing budget influences the sales rate. The initial production cost per unit, sales price per unit, and the effect of automation and marketing budget on costs and sales are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Sales Price per Unit | Effect of Automation on Cost | Effect of Marketing Budget on Sales |\n|---------|----------------------------------|----------------------|-------------------------------|-------------------------------------|\n| ProductA | $100                             | $150                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n| ProductB | $120                             | $180                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n| ProductC | $150                             | $200                 | $5 per $1,000 invested        | 1% increase per $1,000 spent        |\n\nThe total production capacity of the company is 10,000 units. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $30,000. The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $30,000.\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 30000)\n# The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\nmodel.addCons(QuantityA >= 2000)\nmodel.addCons(QuantityB >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1643,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five different types of residential buildings: A, B, C, D, and E. They need to determine the number of each type of building to construct.\n// {\"number of type A buildings\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of type B buildings\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of type C buildings\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of type D buildings\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of type E buildings\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor type A buildings, the construction cost per building is $500,000, the expected rental income per building is $100,000 per year, and the maintenance cost per building is $20,000 per year. \nFor type B buildings, the construction cost per building is $600,000, the expected rental income per building is $120,000 per year, and the maintenance cost per building is $25,000 per year. \nFor type C buildings, the construction cost per building is $700,000, the expected rental income per building is $140,000 per year, and the maintenance cost per building is $30,000 per year.\nFor type D buildings, the construction cost per building is $800,000, the expected rental income per building is $160,000 per year, and the maintenance cost per building is $35,000 per year.\nFor type E buildings, the construction cost per building is $900,000, the expected rental income per building is $180,000 per year, and the maintenance cost per building is $40,000 per year.\nThe developer wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n// NPV_A = (100,000 - 20,000) * A / (1 + 0.05)^1 - 500,000 * A\n// NPV_B = (120,000 - 25,000) * B / (1 + 0.05)^1 - 600,000 * B\n// NPV_C = (140,000 - 30,000) * C / (1 + 0.05)^1 - 700,000 * C\n// NPV_D = (160,000 - 35,000) * D / (1 + 0.05)^1 - 800,000 * D\n// NPV_E = (180,000 - 40,000) * E / (1 + 0.05)^1 - 900,000 * E\n// So, the objective function is: Maximize (NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\n\n## Generate Constraint-1:\nThe developer has a total budget of $5,000,000 for construction costs.\n// 500,000 * A + 600,000 * B + 700,000 * C + 800,000 * D + 900,000 * E <= 5,000,000\n\n## Generate Constraint-2:\nDue to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings.\n// A <= 2 * B",
        "question": "A real estate developer is planning to build five different types of residential buildings: A, B, C, D, and E. They need to determine the number of each type of building to construct. The construction cost per building, expected rental income per building, and maintenance cost per building for each type are given in the following Table.\n\n| Building Type | Construction Cost | Expected Rental Income | Maintenance Cost |\n|---------------|-------------------|------------------------|-----------------|\n| A             | $500,000          | $100,000 per year      | $20,000 per year|\n| B             | $600,000          | $120,000 per year      | $25,000 per year|\n| C             | $700,000          | $140,000 per year      | $30,000 per year|\n| D             | $800,000          | $160,000 per year      | $35,000 per year|\n| E             | $900,000          | $180,000 per year      | $40,000 per year|\n\nThe developer has a total budget of $5,000,000 for construction costs. Due to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings. The developer wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n\nPlease help the developer determine the optimal number of each type of building to construct to maximize the NPV of the project.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of type A buildings\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of type B buildings\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of type C buildings\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of type D buildings\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of type E buildings\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate NPV for each type of building\nNPV_A = (100000 - 20000) * A / (1 + 0.05) - 500000 * A\nNPV_B = (120000 - 25000) * B / (1 + 0.05) - 600000 * B\nNPV_C = (140000 - 30000) * C / (1 + 0.05) - 700000 * C\nNPV_D = (160000 - 35000) * D / (1 + 0.05) - 800000 * D\nNPV_E = (180000 - 40000) * E / (1 + 0.05) - 900000 * E\n## the objective function is: Maximize (NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\nmodel.addCons(obj == NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\n\n# Add constraints\n## The developer has a total budget of $5,000,000 for construction costs.\nmodel.addCons(500000 * A + 600000 * B + 700000 * C + 800000 * D + 900000 * E <= 5000000)\n## Due to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings.\nmodel.addCons(A <= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Buildings: \", model.getVal(A))\n    print(\"Number of Type B Buildings: \", model.getVal(B))\n    print(\"Number of Type C Buildings: \", model.getVal(C))\n    print(\"Number of Type D Buildings: \", model.getVal(D))\n    print(\"Number of Type E Buildings: \", model.getVal(E))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50\n\n## Generate Constraint-2:\nThe firm has a budget of $3000 for raw materials per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000\n\n## Generate Constraint-3:\nThe firm has a production capacity of 300 devices per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300\n\n## Generate Constraint-4:\nThe firm wants to ensure that the production of laptops does not exceed 20% of the total production.\n// Laptops <= 0.2 * (Smartphones + Tablets + Laptops)",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n\n| Device Type | Profit per Device | Production Rate per Worker per Day |\n|-------------|-------------------|------------------------------------|\n| Smartphones | $100              | 10                                 |\n| Tablets     | $150              | 5                                  |\n| Laptops     | $200              | 2                                  |\n\nThe firm has a total of 50 workers available. The firm has a budget of $3000 for raw materials per day. The firm has a production capacity of 300 devices per day. The firm wants to ensure that the production of laptops does not exceed 20% of the total production.\n\nPlease help the firm to maximize its daily profit by determining the optimal number of smartphones, tablets, and laptops to produce, and the number of workers to assign to each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n# The firm has a budget of $3000 for raw materials per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000)\n# The firm has a production capacity of 300 devices per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300)\n# The firm wants to ensure that the production of laptops does not exceed 20% of the total production.\nmodel.addCons(Laptops <= 0.2 * (Smartphones + Tablets + Laptops))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for furniture\": \"FurnitureSpeed\", \"range\": \"FurnitureSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Furniture = FurnitureTrucks * FurnitureSpeed^2\n// Fuel_Perishables = PerishablesTrucks * PerishablesSpeed^2\n// Time_Electronics = ElectronicsTrucks / ElectronicsSpeed\n// Time_Furniture = FurnitureTrucks / FurnitureSpeed\n// Time_Perishables = PerishablesTrucks / PerishablesSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 hours available for all trucks to be on the road per day.\n// Time_Electronics + Time_Furniture + Time_Perishables <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company has a total budget of $10,000 for fuel costs per day and a maximum of 50 hours available for all trucks to be on the road per day. Please help the company to minimize the total fuel consumption and time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nFurnitureSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FurnitureSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Furniture = FurnitureTrucks * FurnitureSpeed**2\nFuel_Perishables = PerishablesTrucks * PerishablesSpeed**2\nTime_Electronics = ElectronicsTrucks / ElectronicsSpeed\nTime_Furniture = FurnitureTrucks / FurnitureSpeed\nTime_Perishables = PerishablesTrucks / PerishablesSpeed\n## the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\nmodel.addCons(obj == Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000)\n## The company has a maximum of 50 hours available for all trucks to be on the road per day.\nmodel.addCons(Time_Electronics + Time_Furniture + Time_Perishables <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Furniture: \", model.getVal(FurnitureSpeed))\n    print(\"Average Speed of Trucks for Perishables: \", model.getVal(PerishablesSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits.\n// {\"number of units of MachineA\": \"MachineAUnits\", \"range\": \"MachineAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineBUnits\", \"range\": \"MachineBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineCUnits\", \"range\": \"MachineCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineDUnits\", \"range\": \"MachineDUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company wants to maximize the total profit.\n// Profit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\n// Profit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\n// Profit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\n// Profit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineA must be at least half the production of MachineB.\n// MachineAUnits >= 0.5 * MachineBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs for the month.\n// 2000 * MachineAUnits + 3000 * MachineBUnits + 4000 * MachineCUnits + 5000 * MachineDUnits <= 50,000",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce next month to optimize their profits. The profit per unit of MachineA is $500, but it decreases by $10 for each unit of MachineB produced. The profit per unit of MachineB is $800, but it decreases by $5 for each unit of MachineA produced. The profit per unit of MachineC is $1200, but it decreases by $20 for each unit of MachineD produced. The profit per unit of MachineD is $1500, but it decreases by $15 for each unit of MachineC produced. The company has a total production capacity of 100 units for the month. Due to supplier agreements, the production of MachineA must be at least half the production of MachineB. The company has a budget of $50,000 for production costs for the month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineAUnits\", lb=0)\nMachineBUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineBUnits\", lb=0)\nMachineCUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineCUnits\", lb=0)\nMachineDUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineDUnits\", lb=0)\n\n# Define objective function\nProfit_MachineA = (500 - 10 * MachineBUnits) * MachineAUnits\nProfit_MachineB = (800 - 5 * MachineAUnits) * MachineBUnits\nProfit_MachineC = (1200 - 20 * MachineDUnits) * MachineCUnits\nProfit_MachineD = (1500 - 15 * MachineCUnits) * MachineDUnits\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\nmodel.addCons(MachineAUnits + MachineBUnits + MachineCUnits + MachineDUnits <= 100)\nmodel.addCons(MachineAUnits >= 0.5 * MachineBUnits)\nmodel.addCons(2000 * MachineAUnits + 3000 * MachineBUnits + 4000 * MachineCUnits + 5000 * MachineDUnits <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineAUnits))\n    print(\"Number of MachineB Units: \", model.getVal(MachineBUnits))\n    print(\"Number of MachineC Units: \", model.getVal(MachineCUnits))\n    print(\"Number of MachineD Units: \", model.getVal(MachineDUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency. The selling price per unit of ProductA is $150, ProductB is $225, and ProductC is $300. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - (100 - 0.001 * IA)) * QA\n// ProfitB = (225 - (150 - 0.0015 * IB)) * QB\n// ProfitC = (300 - (200 - 0.002 * IC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency investments.\n// IA + IB + IC <= 100000\n\n## Generate Constraint-2:\nThe total production quantity cannot exceed 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 800 units of ProductB.\n// QA >= 500; QB >= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency. The selling price per unit of ProductA is $150, ProductB is $225, and ProductC is $300. The company aims to maximize the total profit from all products.\nThe company has a total budget of $100,000 for efficiency investments. The total production quantity cannot exceed 5000 units. The company must produce at least 500 units of ProductA and 800 units of ProductB.\nPlease help the company to determine the optimal production quantities and efficiency investments to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=500) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=800) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in efficiency for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in efficiency for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.001 * IA)) * QA\nProfitB = (225 - (150 - 0.0015 * IB)) * QB\nProfitC = (300 - (200 - 0.002 * IC)) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for efficiency investments.\nmodel.addCons(IA + IB + IC <= 100000)\n# The total production quantity cannot exceed 5000 units.\nmodel.addCons(QA + QB + QC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(IA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(IB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(IC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to transport goods across different regions. The company is considering three types of trucks: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the routes each truck will take to maximize efficiency and minimize operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"operational cost per small truck per km\": \"SmallCostPerKm\", \"range\": \"SmallCostPerKm >= 0\", \"type\": \"real\"}\n// {\"operational cost per medium truck per km\": \"MediumCostPerKm\", \"range\": \"MediumCostPerKm >= 0\", \"type\": \"real\"}\n// {\"operational cost per large truck per km\": \"LargeCostPerKm\", \"range\": \"LargeCostPerKm >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for small trucks is $0.5, for medium trucks is $0.7, and for large trucks is $1.0. The company wants to minimize the total operational cost of all trucks across their routes.\n// TotalCost = SmallTrucks * SmallCostPerKm * TotalSmallKm + MediumTrucks * MediumCostPerKm * TotalMediumKm + LargeTrucks * LargeCostPerKm * TotalLargeKm\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks.\n// SmallTrucks * SmallTruckPrice + MediumTrucks * MediumTruckPrice + LargeTrucks * LargeTruckPrice <= 500000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must meet the demand of 1,000,000 kg of goods.\n// SmallTrucks * SmallCapacity + MediumTrucks * MediumCapacity + LargeTrucks * LargeCapacity >= 1000000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to transport goods across different regions. The company is considering three types of trucks: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the routes each truck will take to maximize efficiency and minimize operational costs. The operational cost per kilometer for small trucks is $0.5, for medium trucks is $0.7, and for large trucks is $1.0. The company wants to minimize the total operational cost of all trucks across their routes.\n\n| Truck Type | Operational Cost per Km |\n|------------|-------------------------|\n| Small      | $0.5                    |\n| Medium     | $0.7                    |\n| Large      | $1.0                    |\n\nThe company has a budget of $500,000 for purchasing new trucks. The total capacity of all trucks must meet the demand of 1,000,000 kg of goods.\n\nPlease help the company to determine the optimal number of each type of truck to purchase and the routes each truck will take to minimize the total operational cost while adhering to the budget and capacity constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSmallCostPerKm = 0.5\nMediumCostPerKm = 0.7\nLargeCostPerKm = 1.0\nTotalSmallKm = model.addVar(name=\"TotalSmallKm\")\nTotalMediumKm = model.addVar(name=\"TotalMediumKm\")\nTotalLargeKm = model.addVar(name=\"TotalLargeKm\")\n## the objective function is: Minimize TotalCost\nTotalCost = SmallTrucks * SmallCostPerKm * TotalSmallKm + MediumTrucks * MediumCostPerKm * TotalMediumKm + LargeTrucks * LargeCostPerKm * TotalLargeKm\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing new trucks.\nSmallTruckPrice = model.addVar(name=\"SmallTruckPrice\")\nMediumTruckPrice = model.addVar(name=\"MediumTruckPrice\")\nLargeTruckPrice = model.addVar(name=\"LargeTruckPrice\")\nmodel.addCons(SmallTrucks * SmallTruckPrice + MediumTrucks * MediumTruckPrice + LargeTrucks * LargeTruckPrice <= 500000)\n## The total capacity of all trucks must meet the demand of 1,000,000 kg of goods.\nSmallCapacity = model.addVar(name=\"SmallCapacity\")\nMediumCapacity = model.addVar(name=\"MediumCapacity\")\nLargeCapacity = model.addVar(name=\"LargeCapacity\")\nmodel.addCons(SmallTrucks * SmallCapacity + MediumTrucks * MediumCapacity + LargeTrucks * LargeCapacity >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for route 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes.\n// Operational cost for route 1: Cost1 = (100 + 0.1 * Upgrade1) * Trucks1^2\n// Operational cost for route 2: Cost2 = (120 + 0.12 * Upgrade2) * Trucks2^2\n// Operational cost for route 3: Cost3 = (110 + 0.11 * Upgrade3) * Trucks3^2\n// Operational cost for route 4: Cost4 = (90 + 0.09 * Upgrade4) * Trucks4^2\n// Operational cost for route 5: Cost5 = (130 + 0.13 * Upgrade5) * Trucks5^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000",
        "question": "A logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes. The company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\n\nPlease help the company to determine the optimal allocation of trucks and fuel efficiency upgrades to minimize the total operational cost across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)\n\n# Define objective function\nCost1 = (100 + 0.1 * Upgrade1) * Trucks1**2\nCost2 = (120 + 0.12 * Upgrade2) * Trucks2**2\nCost3 = (110 + 0.11 * Upgrade3) * Trucks3**2\nCost4 = (90 + 0.09 * Upgrade4) * Trucks4**2\nCost5 = (130 + 0.13 * Upgrade5) * Trucks5**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route 1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route 2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route 3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route 4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route 5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of maintenance investment for each type of machine to optimize production efficiency. The production efficiency of a machine increases with the amount of maintenance investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for ProductA machines\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for ProductB machines\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for ProductC machines\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency of a machine increases by 5% for every $10,000 invested in maintenance. The initial production efficiency for ProductA machines is 80%, for ProductB is 75%, and for ProductC is 70%. The profit per unit produced is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (0.8 + 0.0005 * MaintenanceA) * QuantityA * 100\n// Total profit for ProductB: ProfitB = (0.75 + 0.0005 * MaintenanceB) * QuantityB * 150\n// Total profit for ProductC: ProfitC = (0.7 + 0.0005 * MaintenanceC) * QuantityC * 200\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 30 machines available.\n// MachinesA + MachinesB + MachinesC <= 30\n\n## Generate Constraint-2:\nThe total maintenance investment cannot exceed $50,000.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 50000\n\n## Generate Constraint-3:\nDue to operational constraints, each machine can produce no more than 1000 units of its respective product.\n// QuantityA <= 1000 * MachinesA; QuantityB <= 1000 * MachinesB; QuantityC <= 1000 * MachinesC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of maintenance investment for each type of machine to optimize production efficiency. The production efficiency of a machine increases with the amount of maintenance investment. The initial production efficiency and profit per unit for each product are given in the following Table.\n\n| Product | Initial Production Efficiency | Profit per Unit |\n|---------|--------------------------------|-----------------|\n| ProductA | 80%                            | $100            |\n| ProductB | 75%                            | $150            |\n| ProductC | 70%                            | $200            |\n\nThe production efficiency of a machine increases by 5% for every $10,000 invested in maintenance. The company has a total of 30 machines available. The total maintenance investment cannot exceed $50,000. Due to operational constraints, each machine can produce no more than 1000 units of its respective product. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance investment for ProductA machines\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance investment for ProductB machines\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance investment for ProductC machines\n\n# Define objective function\nProfitA = (0.8 + 0.0005 * MaintenanceA) * QuantityA * 100\nProfitB = (0.75 + 0.0005 * MaintenanceB) * QuantityB * 150\nProfitC = (0.7 + 0.0005 * MaintenanceC) * QuantityC * 200\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 30)  # total machines constraint\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 50000)  # total maintenance investment constraint\nmodel.addCons(QuantityA <= 1000 * MachinesA)  # operational constraint for ProductA\nmodel.addCons(QuantityB <= 1000 * MachinesB)  # operational constraint for ProductB\nmodel.addCons(QuantityC <= 1000 * MachinesC)  # operational constraint for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Maintenance Investment for ProductA Machines: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for ProductB Machines: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for ProductC Machines: \", model.getVal(MaintenanceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"acres of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"acres of C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $100, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $150, requiring 3 units of water per acre. \nFor C3, the profit per acre is $200, requiring 4 units of water per acre.\nFor C4, the profit per acre is $250, requiring 5 units of water per acre.\nFor C5, the profit per acre is $300, requiring 6 units of water per acre.\nThe farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n// Profit_C1 = 100 * C1\n// Profit_C2 = 150 * C2\n// Profit_C3 = 200 * C3\n// Profit_C4 = 250 * C4\n// Profit_C5 = 300 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 + C4 + C5 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500 units.\n// 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500",
        "question": "A farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability. The profit per acre for C1 is $100, but it requires 2 units of water per acre. For C2, the profit per acre is $150, requiring 3 units of water per acre. For C3, the profit per acre is $200, requiring 4 units of water per acre. For C4, the profit per acre is $250, requiring 5 units of water per acre. For C5, the profit per acre is $300, requiring 6 units of water per acre. The farm wants to maximize the profit per unit of water used to ensure sustainable water management. The farm has a total of 100 acres available for cultivation and a limited water supply of 500 units. Please help the farm determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # acres of C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # acres of C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * C1\nProfit_C2 = 150 * C2\nProfit_C3 = 200 * C3\nProfit_C4 = 250 * C4\nProfit_C5 = 300 * C5\nWaterUsage = 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n## The farm has a limited water supply of 500 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Acres of C4: \", model.getVal(C4))\n    print(\"Acres of C5: \", model.getVal(C5))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of its fleet. The variables include the number of trucks assigned to each region (North, South, East, West) and the average speed at which each truck travels.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks in North region\": \"SpeedNorth\", \"range\": \"SpeedNorth > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in South region\": \"SpeedSouth\", \"range\": \"SpeedSouth > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in East region\": \"SpeedEast\", \"range\": \"SpeedEast > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in West region\": \"SpeedWest\", \"range\": \"SpeedWest > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases quadratically with speed. The company aims to minimize the total fuel consumption across all regions.\n// FuelConsumptionNorth = TrucksNorth * (SpeedNorth^2)\n// FuelConsumptionSouth = TrucksSouth * (SpeedSouth^2)\n// FuelConsumptionEast = TrucksEast * (SpeedEast^2)\n// FuelConsumptionWest = TrucksWest * (SpeedWest^2)\n// So, the objective function is: Minimize (FuelConsumptionNorth + FuelConsumptionSouth + FuelConsumptionEast + FuelConsumptionWest)\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 trucks.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 100\n\n## Generate Constraint-2:\nThe maximum speed limit for trucks in each region is 60 km/h.\n// SpeedNorth <= 60; SpeedSouth <= 60; SpeedEast <= 60; SpeedWest <= 60\n\n## Generate Constraint-3:\nThe minimum speed required to maintain service levels in each region is 30 km/h.\n// SpeedNorth >= 30; SpeedSouth >= 30; SpeedEast >= 30; SpeedWest >= 30\n\n## Generate Constraint-4:\nThe company has a budget constraint on the total fuel cost, which should not exceed $5000 per day.\n// FuelConsumptionNorth * FuelCostPerUnit + FuelConsumptionSouth * FuelCostPerUnit + FuelConsumptionEast * FuelCostPerUnit + FuelConsumptionWest * FuelCostPerUnit <= 5000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, and West. The company needs to optimize the fuel consumption and route efficiency of its fleet. The variables include the number of trucks assigned to each region and the average speed at which each truck travels. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases quadratically with speed. The company aims to minimize the total fuel consumption across all regions.\n\n| Region   | Number of Trucks | Average Speed |\n|----------|------------------|---------------|\n| North    | TrucksNorth      | SpeedNorth    |\n| South    | TrucksSouth      | SpeedSouth    |\n| East     | TrucksEast       | SpeedEast     |\n| West     | TrucksWest       | SpeedWest     |\n\nThe company has a total fleet size of 100 trucks. The maximum speed limit for trucks in each region is 60 km/h, and the minimum speed required to maintain service levels in each region is 30 km/h. The company has a budget constraint on the total fuel cost, which should not exceed $5000 per day.\n\nPlease help the company to determine the optimal number of trucks and their average speeds in each region to minimize the total fuel consumption while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nSpeedNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedNorth\", lb=30, ub=60)\nSpeedSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedSouth\", lb=30, ub=60)\nSpeedEast = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedEast\", lb=30, ub=60)\nSpeedWest = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedWest\", lb=30, ub=60)\n\n# Define objective function\nFuelConsumptionNorth = TrucksNorth * SpeedNorth**2\nFuelConsumptionSouth = TrucksSouth * SpeedSouth**2\nFuelConsumptionEast = TrucksEast * SpeedEast**2\nFuelConsumptionWest = TrucksWest * SpeedWest**2\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# The objective function is: Minimize (FuelConsumptionNorth + FuelConsumptionSouth + FuelConsumptionEast + FuelConsumptionWest)\nmodel.addCons(obj == FuelConsumptionNorth + FuelConsumptionSouth + FuelConsumptionEast + FuelConsumptionWest)\n\n# Add constraints\n# The company has a total fleet size of 100 trucks.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 100)\n# The maximum speed limit for trucks in each region is 60 km/h.\nmodel.addCons(SpeedNorth <= 60)\nmodel.addCons(SpeedSouth <= 60)\nmodel.addCons(SpeedEast <= 60)\nmodel.addCons(SpeedWest <= 60)\n# The minimum speed required to maintain service levels in each region is 30 km/h.\nmodel.addCons(SpeedNorth >= 30)\nmodel.addCons(SpeedSouth >= 30)\nmodel.addCons(SpeedEast >= 30)\nmodel.addCons(SpeedWest >= 30)\n# The company has a budget constraint on the total fuel cost, which should not exceed $5000 per day.\nFuelCostPerUnit = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelCostPerUnit\")\nmodel.addCons(FuelConsumptionNorth * FuelCostPerUnit + FuelConsumptionSouth * FuelCostPerUnit + FuelConsumptionEast * FuelCostPerUnit + FuelConsumptionWest * FuelCostPerUnit <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South Region: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East Region: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West Region: \", model.getVal(TrucksWest))\n    print(\"Average Speed of Trucks in North Region: \", model.getVal(SpeedNorth))\n    print(\"Average Speed of Trucks in South Region: \", model.getVal(SpeedSouth))\n    print(\"Average Speed of Trucks in East Region: \", model.getVal(SpeedEast))\n    print(\"Average Speed of Trucks in West Region: \", model.getVal(SpeedWest))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs by determining the optimal speed for each truck. The speed of each truck affects both the fuel efficiency and the wear and tear on the vehicle.\n// {\"speed of Truck 1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 3\": \"Speed3\", \"range\": \"0 <= Speed3 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 4\": \"Speed4\", \"range\": \"0 <= Speed4 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck 5\": \"Speed5\", \"range\": \"0 <= Speed5 <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The faster the truck, the more fuel it consumes, but there is an optimal speed that minimizes fuel consumption for each truck. Additionally, the maintenance cost increases linearly with speed due to increased wear and tear. The company aims to minimize the total cost of fuel and maintenance for all trucks.\n// Fuel cost for Truck 1: Fuel1 = (Speed1^2 + 5*Speed1 + 10) * Distance\n// Fuel cost for Truck 2: Fuel2 = (Speed2^2 + 5*Speed2 + 10) * Distance\n// Fuel cost for Truck 3: Fuel3 = (Speed3^2 + 5*Speed3 + 10) * Distance\n// Fuel cost for Truck 4: Fuel4 = (Speed4^2 + 5*Speed4 + 10) * Distance\n// Fuel cost for Truck 5: Fuel5 = (Speed5^2 + 5*Speed5 + 10) * Distance\n// Maintenance cost for each truck: Maint = 0.1 * (Speed1 + Speed2 + Speed3 + Speed4 + Speed5) * Distance\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 + Maint)\n\n## Generate Constraint-1:\nThe total time available for all trucks to complete their routes is limited to 10 hours.\n// (Distance / Speed1) + (Distance / Speed2) + (Distance / Speed3) + (Distance / Speed4) + (Distance / Speed5) <= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs by determining the optimal speed for each truck. The speed of each truck affects both the fuel efficiency and the wear and tear on the vehicle. The fuel consumption of each truck is modeled by a quadratic function of its speed, and the maintenance cost increases linearly with speed due to increased wear and tear. The company aims to minimize the total cost of fuel and maintenance for all trucks.\n\n| Truck | Fuel Consumption Model | Maintenance Cost Model |\n|-------|------------------------|------------------------|\n| 1     | (Speed1^2 + 5*Speed1 + 10) * Distance | 0.1 * Speed1 * Distance |\n| 2     | (Speed2^2 + 5*Speed2 + 10) * Distance | 0.1 * Speed2 * Distance |\n| 3     | (Speed3^2 + 5*Speed3 + 10) * Distance | 0.1 * Speed3 * Distance |\n| 4     | (Speed4^2 + 5*Speed4 + 10) * Distance | 0.1 * Speed4 * Distance |\n| 5     | (Speed5^2 + 5*Speed5 + 10) * Distance | 0.1 * Speed5 * Distance |\n\nThe total time available for all trucks to complete their routes is limited to 10 hours. Please help the company to minimize the total cost of fuel and maintenance for all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(name=\"Speed1\", lb=0, ub=100) # speed of Truck 1\nSpeed2 = model.addVar(name=\"Speed2\", lb=0, ub=100) # speed of Truck 2\nSpeed3 = model.addVar(name=\"Speed3\", lb=0, ub=100) # speed of Truck 3\nSpeed4 = model.addVar(name=\"Speed4\", lb=0, ub=100) # speed of Truck 4\nSpeed5 = model.addVar(name=\"Speed5\", lb=0, ub=100) # speed of Truck 5\n\n# Define objective function\n## Fuel cost for each truck\nFuel1 = (Speed1**2 + 5*Speed1 + 10)\nFuel2 = (Speed2**2 + 5*Speed2 + 10)\nFuel3 = (Speed3**2 + 5*Speed3 + 10)\nFuel4 = (Speed4**2 + 5*Speed4 + 10)\nFuel5 = (Speed5**2 + 5*Speed5 + 10)\n## Maintenance cost for each truck\nMaint = 0.1 * (Speed1 + Speed2 + Speed3 + Speed4 + Speed5)\n## Objective function\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 + Maint)\n\n# Add constraints\n## Total time constraint\nmodel.addCons(1/Speed1 + 1/Speed2 + 1/Speed3 + 1/Speed4 + 1/Speed5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Speed of Truck 3: \", model.getVal(Speed3))\n    print(\"Speed of Truck 4: \", model.getVal(Speed4))\n    print(\"Speed of Truck 5: \", model.getVal(Speed5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trucks for destination A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for destination A\": \"FuelBudgetA\", \"range\": \"FuelBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination B\": \"FuelBudgetB\", \"range\": \"FuelBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination C\": \"FuelBudgetC\", \"range\": \"FuelBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination D\": \"FuelBudgetD\", \"range\": \"FuelBudgetD >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination E\": \"FuelBudgetE\", \"range\": \"FuelBudgetE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks. The cost increases at a decreasing rate as the fuel budget increases, reflecting economies of scale in fuel purchasing. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for destination A: CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2)\n// Fuel cost for destination B: CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2)\n// Fuel cost for destination C: CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2)\n// Fuel cost for destination D: CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2)\n// Fuel cost for destination E: CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total fuel budget across all destinations must not exceed $100,000.\n// FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000\n\n## Generate Constraint-2:\nThe company must ensure that at least 50 trucks are dispatched to each destination.\n// TrucksA >= 50; TrucksB >= 50; TrucksC >= 50; TrucksD >= 50; TrucksE >= 50\n\n## Generate Constraint-3:\nThe total number of trucks dispatched across all destinations must not exceed 300.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300\n\n## Generate Constraint-4:\nThe fuel budget for destination A must be at least twice the fuel budget for destination B.\n// FuelBudgetA >= 2 * FuelBudgetB\n\n## Generate Constraint-5:\nThe fuel budget for destination E must be at least as much as the combined fuel budgets for destinations A, B, and C.\n// FuelBudgetE >= FuelBudgetA + FuelBudgetB + FuelBudgetC",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks, where the cost increases at a decreasing rate as the fuel budget increases. The company aims to minimize the total fuel cost across all routes.\n\nThe company has a total fuel budget limit of $100,000. It must ensure that at least 50 trucks are dispatched to each destination, and the total number of trucks dispatched across all destinations must not exceed 300. Additionally, the fuel budget for destination A must be at least twice the fuel budget for destination B, and the fuel budget for destination E must be at least as much as the combined fuel budgets for destinations A, B, and C.\n\nPlease help the company determine the optimal number of trucks and fuel budgets for each destination to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=50)  # number of trucks for destination A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=50)  # number of trucks for destination B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=50)  # number of trucks for destination C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=50)  # number of trucks for destination D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=50)  # number of trucks for destination E\nFuelBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetA\", lb=0)  # fuel budget for destination A\nFuelBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetB\", lb=0)  # fuel budget for destination B\nFuelBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetC\", lb=0)  # fuel budget for destination C\nFuelBudgetD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD\", lb=0)  # fuel budget for destination D\nFuelBudgetE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetE\", lb=0)  # fuel budget for destination E\n\n# Define objective function\nCostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)**2)\nCostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)**2)\nCostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)**2)\nCostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)**2)\nCostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\nmodel.addCons(FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300)\nmodel.addCons(FuelBudgetA >= 2 * FuelBudgetB)\nmodel.addCons(FuelBudgetE >= FuelBudgetA + FuelBudgetB + FuelBudgetC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Destination A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Destination B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Destination C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Destination D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Destination E: \", model.getVal(TrucksE))\n    print(\"Fuel Budget for Destination A: \", model.getVal(FuelBudgetA))\n    print(\"Fuel Budget for Destination B: \", model.getVal(FuelBudgetB))\n    print(\"Fuel Budget for Destination C: \", model.getVal(FuelBudgetC))\n    print(\"Fuel Budget for Destination D: \", model.getVal(FuelBudgetD))\n    print(\"Fuel Budget for Destination E: \", model.getVal(FuelBudgetE))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD\", \"range\": \"MachineD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total profit for MachineA: Profit_A = (500 - CostA) * MachineA = (500 - (200 + 0.01 * MachineA^2)) * MachineA\n// Total profit for MachineB: Profit_B = (700 - CostB) * MachineB = (700 - (300 + 0.02 * MachineB^2)) * MachineB\n// Total profit for MachineC: Profit_C = (900 - CostC) * MachineC = (900 - (400 + 0.03 * MachineC^2)) * MachineC\n// Total profit for MachineD: Profit_D = (1100 - CostD) * MachineD = (1100 - (500 + 0.04 * MachineD^2)) * MachineD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines next month.\n// MachineA + MachineB + MachineC + MachineD <= 500",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for each machine and the production cost function for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| MachineA | $500 | CostA = 200 + 0.01 * MachineA^2 |\n| MachineB | $700 | CostB = 300 + 0.02 * MachineB^2 |\n| MachineC | $900 | CostC = 400 + 0.03 * MachineC^2 |\n| MachineD | $1100 | CostD = 500 + 0.04 * MachineD^2 |\n\nThe company has a total production capacity of 500 machines next month. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost. Please help the company determine the optimal number of each machine to produce next month to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0)\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0)\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0)\nMachineD = model.addVar(vtype=\"INTEGER\", name=\"MachineD\", lb=0)\n\n# Define objective function\nCostA = 200 + 0.01 * MachineA**2\nCostB = 300 + 0.02 * MachineB**2\nCostC = 400 + 0.03 * MachineC**2\nCostD = 500 + 0.04 * MachineD**2\n\nProfit_A = (500 - CostA) * MachineA\nProfit_B = (700 - CostB) * MachineB\nProfit_C = (900 - CostC) * MachineC\nProfit_D = (1100 - CostD) * MachineD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(MachineA + MachineB + MachineC + MachineD <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Number of MachineD: \", model.getVal(MachineD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n// Total energy output: Energy = 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3\n// Total cost: Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for this project.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000\n\n## Generate Constraint-3:\nThe total number of wind turbines must not exceed 20.\n// Wind1 + Wind2 + Wind3 <= 20\n\n## Generate Constraint-4:\nThe number of Solar1 panels must be at least twice the number of Solar5 panels.\n// Solar1 >= 2 * Solar5\n\n## Generate Constraint-5:\nThe total energy output must be at least 50,000 kWh per year.\n// 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3 >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). The efficiency, cost, and lifespan of each type of equipment are given in the following Table.\n\n| Equipment Type | Efficiency | Cost | Lifespan |\n|----------------|------------|------|----------|\n| Solar1         | 15%        | $1000| 10 years |\n| Solar2         | 20%        | $1200| 12 years |\n| Solar3         | 25%        | $1500| 15 years |\n| Solar4         | 30%        | $2000| 20 years |\n| Solar5         | 35%        | $2500| 25 years |\n| Wind1          | 20%        | $3000| 10 years |\n| Wind2          | 25%        | $3500| 15 years |\n| Wind3          | 30%        | $4000| 20 years |\n\nThe company has a budget of $100,000 for this project. At least 30% of the budget must be spent on solar panels. The total number of wind turbines must not exceed 20. The number of Solar1 panels must be at least twice the number of Solar5 panels. The total energy output must be at least 50,000 kWh per year.\n\nPlease help the company to maximize the total energy output per dollar spent over the lifespan of the equipment.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\nEnergy = 0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3\nCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000)\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000)\nmodel.addCons(Wind1 + Wind2 + Wind3 <= 20)\nmodel.addCons(Solar1 >= 2 * Solar5)\nmodel.addCons(0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3 >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1277,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Small trucks\": \"FuelSmall\", \"range\": \"FuelSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Medium trucks\": \"FuelMedium\", \"range\": \"FuelMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Large trucks\": \"FuelLarge\", \"range\": \"FuelLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Extra-Large trucks\": \"FuelExtraLarge\", \"range\": \"FuelExtraLarge >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Hybrid trucks\": \"FuelHybrid\", \"range\": \"FuelHybrid >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel for each type of truck is different. The cost per gallon for Small trucks is $3, for Medium trucks is $4, for Large trucks is $5, for Extra-Large trucks is $6, and for Hybrid trucks is $2. The fuel efficiency of each truck also varies, with Small trucks consuming 10 gallons per 100 miles, Medium trucks consuming 15 gallons per 100 miles, Large trucks consuming 20 gallons per 100 miles, Extra-Large trucks consuming 25 gallons per 100 miles, and Hybrid trucks consuming 5 gallons per 100 miles. The company wants to minimize the total fuel cost for all deliveries.\n// FuelCostSmall = 3 * (10 * SmallTrucks * Distance / 100)\n// FuelCostMedium = 4 * (15 * MediumTrucks * Distance / 100)\n// FuelCostLarge = 5 * (20 * LargeTrucks * Distance / 100)\n// FuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * Distance / 100)\n// FuelCostHybrid = 2 * (5 * HybridTrucks * Distance / 100)\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n## Generate Constraint-1:\nThe total fuel available for all trucks is limited to 5000 gallons.\n// FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and fuel consumption for a set of deliveries. The company has five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. They need to determine the number of each type of truck to use for the deliveries and the amount of fuel to allocate to each truck. The cost of fuel per gallon and the fuel efficiency for each type of truck are given in the following Table.\n\n| Truck Type       | Cost per Gallon | Fuel Efficiency (gallons/100 miles) |\n|------------------|-----------------|-------------------------------------|\n| Small            | $3              | 10                                  |\n| Medium           | $4              | 15                                  |\n| Large            | $5              | 20                                  |\n| Extra-Large      | $6              | 25                                  |\n| Hybrid           | $2              | 5                                   |\n\nThe total fuel available for all trucks is limited to 5000 gallons. The company wants to minimize the total fuel cost for all deliveries. Please help the company determine the optimal number of each type of truck and the fuel allocation to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\nFuelSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelSmall\", lb=0)\nFuelMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelMedium\", lb=0)\nFuelLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelLarge\", lb=0)\nFuelExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelExtraLarge\", lb=0)\nFuelHybrid = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelHybrid\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance\", lb=0)\nFuelCostSmall = 3 * (10 * SmallTrucks * Distance / 100)\nFuelCostMedium = 4 * (15 * MediumTrucks * Distance / 100)\nFuelCostLarge = 5 * (20 * LargeTrucks * Distance / 100)\nFuelCostExtraLarge = 6 * (25 * ExtraLargeTrucks * Distance / 100)\nFuelCostHybrid = 2 * (5 * HybridTrucks * Distance / 100)\n## the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge + FuelCostHybrid)\n\n# Add constraints\n## The total fuel available for all trucks is limited to 5000 gallons.\nmodel.addCons(FuelSmall + FuelMedium + FuelLarge + FuelExtraLarge + FuelHybrid <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Fuel Allocation for Small Trucks: \", model.getVal(FuelSmall))\n    print(\"Fuel Allocation for Medium Trucks: \", model.getVal(FuelMedium))\n    print(\"Fuel Allocation for Large Trucks: \", model.getVal(FuelLarge))\n    print(\"Fuel Allocation for Extra-Large Trucks: \", model.getVal(FuelExtraLarge))\n    print(\"Fuel Allocation for Hybrid Trucks: \", model.getVal(FuelHybrid))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1273,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones to maximize energy production while minimizing costs. The city has identified four zones (Zone A, Zone B, Zone C, Zone D) where solar panels can be installed. The city needs to determine the number of solar panels to install in each zone and the cost of installation per panel.\n// {\"number of solar panels in Zone A\": \"PanelsA\", \"range\": \"PanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"PanelsB\", \"range\": \"PanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"PanelsC\", \"range\": \"PanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"PanelsD\", \"range\": \"PanelsD >= 0\", \"type\": \"integer\"}\n// {\"cost of installation per panel in each zone\": \"CostPerPanel\", \"range\": \"CostPerPanel >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy production per panel varies by zone due to differences in sunlight exposure and panel efficiency. Zone A produces 10 kWh per day, Zone B produces 12 kWh per day, Zone C produces 15 kWh per day, and Zone D produces 18 kWh per day. The city aims to maximize the total daily energy production while minimizing the total installation cost.\n// Energy_A = 10 * PanelsA\n// Energy_B = 12 * PanelsB\n// Energy_C = 15 * PanelsC\n// Energy_D = 18 * PanelsD\n// Total_Energy = Energy_A + Energy_B + Energy_C + Energy_D\n// Total_Cost = CostPerPanel * (PanelsA + PanelsB + PanelsC + PanelsD)\n// So, the objective function is: Maximize Total_Energy - Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the total installation cost.\n// CostPerPanel * (PanelsA + PanelsB + PanelsC + PanelsD) <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different zones to maximize energy production while minimizing costs. The city has identified four zones (Zone A, Zone B, Zone C, Zone D) where solar panels can be installed. The city needs to determine the number of solar panels to install in each zone and the cost of installation per panel. The energy production per panel varies by zone due to differences in sunlight exposure and panel efficiency. Zone A produces 10 kWh per day, Zone B produces 12 kWh per day, Zone C produces 15 kWh per day, and Zone D produces 18 kWh per day. The city aims to maximize the total daily energy production while minimizing the total installation cost. The city has a budget of $100,000 for the total installation cost.\n\n| Zone | Energy Production per Panel (kWh/day) |\n|------|---------------------------------------|\n| A    | 10                                    |\n| B    | 12                                    |\n| C    | 15                                    |\n| D    | 18                                    |\n\nPlease help the city to maximize the total daily energy production (Total_Energy) while ensuring that the total installation cost (Total_Cost) does not exceed $100,000.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelsA = model.addVar(vtype=\"INTEGER\", name=\"PanelsA\", lb=0) # number of solar panels in Zone A\nPanelsB = model.addVar(vtype=\"INTEGER\", name=\"PanelsB\", lb=0) # number of solar panels in Zone B\nPanelsC = model.addVar(vtype=\"INTEGER\", name=\"PanelsC\", lb=0) # number of solar panels in Zone C\nPanelsD = model.addVar(vtype=\"INTEGER\", name=\"PanelsD\", lb=0) # number of solar panels in Zone D\nCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerPanel\", lb=0) # cost of installation per panel in each zone\n\n# Define objective function\nEnergy_A = 10 * PanelsA\nEnergy_B = 12 * PanelsB\nEnergy_C = 15 * PanelsC\nEnergy_D = 18 * PanelsD\nTotal_Energy = Energy_A + Energy_B + Energy_C + Energy_D\nTotal_Cost = CostPerPanel * (PanelsA + PanelsB + PanelsC + PanelsD)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize Total_Energy - Total_Cost\nmodel.addCons(obj == Total_Energy - Total_Cost)\n\n# Add constraints\n# The city has a budget of $100,000 for the total installation cost.\nmodel.addCons(CostPerPanel * (PanelsA + PanelsB + PanelsC + PanelsD) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(PanelsA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(PanelsB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(PanelsC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(PanelsD))\n    print(\"Cost Per Panel: \", model.getVal(CostPerPanel))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency profile. Route 1 has a cost of $100 per truck and an efficiency of 50 units of goods per trip. Route 2 has a cost of $120 per truck and an efficiency of 60 units of goods per trip. Route 3 has a cost of $110 per truck and an efficiency of 55 units of goods per trip. Route 4 has a cost of $90 per truck and an efficiency of 45 units of goods per trip. Route 5 has a cost of $130 per truck and an efficiency of 70 units of goods per trip. The company wants to maximize the total units of goods transported while minimizing the total cost.\n// Total cost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\n// Total goods transported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n// The objective function is: Minimize (Total cost / Total goods transported)\n// Minimize (100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5) / (50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and efficiency profile: Route 1 costs $100 per truck and transports 50 units of goods per trip, Route 2 costs $120 per truck and transports 60 units of goods per trip, Route 3 costs $110 per truck and transports 55 units of goods per trip, Route 4 costs $90 per truck and transports 45 units of goods per trip, and Route 5 costs $130 per truck and transports 70 units of goods per trip. The company wants to maximize the total units of goods transported while minimizing the total cost. The company has a total of 100 trucks available for allocation. Please help the company to minimize the ratio of total cost to total goods transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\nTotalGoodsTransported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n## the objective function is: Minimize (Total cost / Total goods transported)\n## convert the division to multiplication\nmodel.addCons(obj * TotalGoodsTransported == TotalCost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Unit of Goods Transported: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering packages. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. The operational cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1100. The delivery volume per truck on route 1 is 50 packages, on route 2 is 60 packages, on route 3 is 70 packages, on route 4 is 80 packages, and on route 5 is 90 packages. The company wants to minimize the cost per delivered package.\n// Cost_per_package_1 = 1000 * T1 / (50 * T1)\n// Cost_per_package_2 = 1200 * T2 / (60 * T2)\n// Cost_per_package_3 = 1500 * T3 / (70 * T3)\n// Cost_per_package_4 = 1300 * T4 / (80 * T4)\n// Cost_per_package_5 = 1100 * T5 / (90 * T5)\n// So, the objective function is: Minimize (Cost_per_package_1 + Cost_per_package_2 + Cost_per_package_3 + Cost_per_package_4 + Cost_per_package_5)\n\n## Generate Constraint-1:\nThe company has a total fleet of 100 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize their operations. The operational cost per truck and the delivery volume per truck for each route are given in the following Table.\n\n| Route | Operational Cost per Truck | Delivery Volume per Truck |\n|-------|----------------------------|---------------------------|\n| 1     | $1000                      | 50 packages               |\n| 2     | $1200                      | 60 packages               |\n| 3     | $1500                      | 70 packages               |\n| 4     | $1300                      | 80 packages               |\n| 5     | $1100                      | 90 packages               |\n\nThe company wants to minimize the cost per delivered package. The company has a total fleet of 100 trucks. Please help the company determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_per_package_1 = 1000 * T1 / (50 * T1)\nCost_per_package_2 = 1200 * T2 / (60 * T2)\nCost_per_package_3 = 1500 * T3 / (70 * T3)\nCost_per_package_4 = 1300 * T4 / (80 * T4)\nCost_per_package_5 = 1100 * T5 / (90 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5) == 1000 * T1 + 1200 * T2 + 1500 * T3 + 1300 * T4 + 1100 * T5)\n\n# Add constraints\n## The company has a total fleet of 100 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivered Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n// Delivery time for route A: T_A = 1 / (0.8 * A)\n// Delivery time for route B: T_B = 1 / (0.9 * B)\n// Delivery time for route C: T_C = 1 / (1.1 * C)\n// Delivery time for route D: T_D = 1 / (1.2 * D)\n// Delivery time for route E: T_E = 1 / (1.0 * E)\n// So, the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n// Minimize (1 / (0.8 * A) + 1 / (0.9 * B) + 1 / (1.1 * C) + 1 / (1.2 * D) + 1 / (1.0 * E))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks at a time.\n// A <= 15; B <= 15; C <= 15; D <= 15; E <= 15\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-4:\nThe total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\n// 1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B))\n\n## Generate Constraint-5:\nThe total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\n// 1 / (1.0 * E) <= (1 / (0.8 * A)) + (1 / (0.9 * B)) + (1 / (1.1 * C)) + (1 / (1.2 * D))",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density, as shown in the following Table.\n\n| Route | Efficiency Factor |\n|-------|-------------------|\n| A     | 0.8               |\n| B     | 0.9               |\n| C     | 1.1               |\n| D     | 1.2               |\n| E     | 1.0               |\n\nThe company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated. The company has a total of 50 trucks available for allocation. Each route can handle a maximum of 15 trucks at a time. The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels. The total delivery time for Route D should not exceed the combined delivery times of Routes A and B. The total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\n\nPlease help the company to minimize the total delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5, ub=15) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5, ub=15) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5, ub=15) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5, ub=15) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5, ub=15) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_A = 1 / (0.8 * A)\nT_B = 1 / (0.9 * B)\nT_C = 1 / (1.1 * C)\nT_D = 1 / (1.2 * D)\nT_E = 1 / (1.0 * E)\n## the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n## convert the division to multiplication\nmodel.addCons(obj == T_A + T_B + T_C + T_D + T_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 50)\n## Each route can handle a maximum of 15 trucks at a time.\n## The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n\n## The total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\nmodel.addCons(1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B)))\n## The total delivery time for Route E should not exceed the combined delivery times of Routes A, B, C, and D.\nmodel.addCons(1 / (1.0 * E) <= (1 / (0.8 * A)) + (1 / (0.9 * B)) + (1 / (1.1 * C)) + (1 / (1.2 * D)))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its profit and resource usage.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. The production cost per unit for device A is $20, for device B is $30, and for device C is $40. The company has a limited amount of a critical component that is used in the production of all devices. The usage of this component per unit of device A is 2 units, for device B is 3 units, and for device C is 4 units. The company aims to maximize the total profit while considering the efficiency of component usage, defined as the ratio of total profit to total component usage.\n// Profit of A: Profit_A = (50 - 20) * A = 30 * A\n// Profit of B: Profit_B = (70 - 30) * B = 40 * B\n// Profit of C: Profit_C = (90 - 40) * C = 50 * C\n// Component usage for A: Comp_A = 2 * A\n// Component usage for B: Comp_B = 3 * B\n// Component usage for C: Comp_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Comp_A + Comp_B + Comp_C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 20 * A + 30 * B + 40 * C <= 5000\n\n## Generate Constraint-2:\nThe company has 1000 units of the critical component available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-3:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its profit and resource usage. The profit per unit for device A is $50, for device B is $70, and for device C is $90. The production cost per unit for device A is $20, for device B is $30, and for device C is $40. The company has a limited amount of a critical component that is used in the production of all devices. The usage of this component per unit of device A is 2 units, for device B is 3 units, and for device C is 4 units. The company has a budget of $5000 for production costs and has 1000 units of the critical component available. The company wants to produce at least 50 units of each device. The company aims to maximize the total profit while considering the efficiency of component usage, defined as the ratio of total profit to total component usage. Please help the company determine the optimal production quantities for devices A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nComp_A = 2 * A\nComp_B = 3 * B\nComp_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Comp_A + Comp_B + Comp_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Comp_A + Comp_B + Comp_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 5000)\n## The company has 1000 units of the critical component available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit/Component Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route 1 has a cost of $2 per km and an average speed of 60 km/h. Route 2 has a cost of $3 per km and an average speed of 50 km/h. Route 3 has a cost of $2.5 per km and an average speed of 55 km/h. Route 4 has a cost of $3.5 per km and an average speed of 45 km/h. Route 5 has a cost of $4 per km and an average speed of 40 km/h. The company aims to minimize the total cost of operations while ensuring that the total delivery time does not exceed 10 hours.\n// Total cost = 2 * T1 * D1 + 3 * T2 * D2 + 2.5 * T3 * D3 + 3.5 * T4 * D4 + 4 * T5 * D5\n// Total time = (D1 / 60) * T1 + (D2 / 50) * T2 + (D3 / 55) * T3 + (D4 / 45) * T4 + (D5 / 40) * T5\n// Objective function: Minimize Total cost + (Total time - 10)^2\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. Each route has a different cost per kilometer and a different average speed. Route 1 has a cost of $2 per km and an average speed of 60 km/h. Route 2 has a cost of $3 per km and an average speed of 50 km/h. Route 3 has a cost of $2.5 per km and an average speed of 55 km/h. Route 4 has a cost of $3.5 per km and an average speed of 45 km/h. Route 5 has a cost of $4 per km and an average speed of 40 km/h. The company aims to minimize the total cost of operations while ensuring that the total delivery time does not exceed 10 hours. The company has a total of 100 trucks available for allocation. Please help the company to minimize the objective function, which is the total cost plus the square of the difference between the total delivery time and 10 hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 2 * T1 + 3 * T2 + 2.5 * T3 + 3.5 * T4 + 4 * T5\nTotalTime = (1 / 60) * T1 + (1 / 50) * T2 + (1 / 55) * T3 + (1 / 45) * T4 + (1 / 40) * T5\n## convert the square to multiplication\nmodel.addCons(obj == TotalCost + (TotalTime - 10)**2)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route decreases with the investment in fuel-efficient technology. Specifically, for every $1000 invested, the fuel consumption decreases by 10 liters per truck per route. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Fuel1 = (1000 - 0.01 * Tech1) * Trucks1\n// Fuel consumption for Route2: Fuel2 = (1000 - 0.01 * Tech2) * Trucks2\n// Fuel consumption for Route3: Fuel3 = (1000 - 0.01 * Tech3) * Trucks3\n// Fuel consumption for Route4: Fuel4 = (1000 - 0.01 * Tech4) * Trucks4\n// Fuel consumption for Route5: Fuel5 = (1000 - 0.01 * Tech5) * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000",
        "question": "A logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route. For every $1000 invested in fuel-efficient technology, the fuel consumption decreases by 10 liters per truck per route. The company aims to minimize the total fuel consumption across all routes. The company has a budget of $100,000 for investments in fuel-efficient technologies.\n\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in fuel-efficient technologies for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks for Route5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Route3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for Route4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for Route5\n\n# Define objective function\nFuel1 = (1000 - 0.01 * Tech1) * Trucks1\nFuel2 = (1000 - 0.01 * Tech2) * Trucks2\nFuel3 = (1000 - 0.01 * Tech3) * Trucks3\nFuel4 = (1000 - 0.01 * Tech4) * Trucks4\nFuel5 = (1000 - 0.01 * Tech5) * Trucks5\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\n# The company has a budget of $100,000 for investments in fuel-efficient technologies.\nmodel.addCons(Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Route4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Route5: \", model.getVal(Tech5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\n// {\"number of solar panels in Region A\": \"SolarPanels_A\", \"range\": \"SolarPanels_A >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindTurbines_A\", \"range\": \"WindTurbines_A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarPanels_B\", \"range\": \"SolarPanels_B >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindTurbines_B\", \"range\": \"WindTurbines_B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarPanels_C\", \"range\": \"SolarPanels_C >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindTurbines_C\", \"range\": \"WindTurbines_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n// Total cost in Region A: Cost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\n// Total cost in Region B: Cost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\n// Total cost in Region C: Cost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\n// Total energy production in Region A: Energy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\n// Total energy production in Region B: Energy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\n// Total energy production in Region C: Energy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total daily energy production in each region must be at least 1000 kWh.\n// Energy_A >= 1000; Energy_B >= 1000; Energy_C >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for installation costs across all regions.\n// Cost_A + Cost_B + Cost_C <= 500,000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs. The cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to ensure a minimum daily energy production of 1000 kWh per region and has a budget of $500,000 for installation costs across all regions. Please help the company to minimize the total cost of installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels_A = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_A\", lb=0)\nWindTurbines_A = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_A\", lb=0)\nSolarPanels_B = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_B\", lb=0)\nWindTurbines_B = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_B\", lb=0)\nSolarPanels_C = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_C\", lb=0)\nWindTurbines_C = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_C\", lb=0)\n\n# Define objective function\nCost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\nCost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\nCost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nEnergy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\nEnergy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\nEnergy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\nmodel.addCons(Energy_A >= 1000)\nmodel.addCons(Energy_B >= 1000)\nmodel.addCons(Energy_C >= 1000)\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarPanels_A))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindTurbines_A))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarPanels_B))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindTurbines_B))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarPanels_C))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindTurbines_C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make between each pair of cities to minimize the total fuel consumption while meeting the demand for goods in each city.\n// {\"number of trips from city A to city B\": \"AB\", \"range\": \"AB >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city C\": \"AC\", \"range\": \"AC >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city D\": \"AD\", \"range\": \"AD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city E\": \"AE\", \"range\": \"AE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city C\": \"BC\", \"range\": \"BC >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city D\": \"BD\", \"range\": \"BD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city E\": \"BE\", \"range\": \"BE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city C to city D\": \"CD\", \"range\": \"CD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city C to city E\": \"CE\", \"range\": \"CE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city D to city E\": \"DE\", \"range\": \"DE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried. The company aims to minimize the total fuel consumption.\n// Fuel_AB = k1 * AB^2 * d_AB\n// Fuel_AC = k1 * AC^2 * d_AC\n// Fuel_AD = k1 * AD^2 * d_AD\n// Fuel_AE = k1 * AE^2 * d_AE\n// Fuel_BC = k1 * BC^2 * d_BC\n// Fuel_BD = k1 * BD^2 * d_BD\n// Fuel_BE = k1 * BE^2 * d_BE\n// Fuel_CD = k1 * CD^2 * d_CD\n// Fuel_CE = k1 * CE^2 * d_CE\n// Fuel_DE = k1 * DE^2 * d_DE\n// So, the objective function is: Minimize (Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n\n## Generate Constraint-1:\nThe demand for goods in city A is 100 units, and each trip can carry 10 units.\n// AB + AC + AD + AE >= 10\n\n## Generate Constraint-2:\nThe demand for goods in city B is 150 units, and each trip can carry 10 units.\n// BC + BD + BE >= 15\n\n## Generate Constraint-3:\nThe demand for goods in city C is 200 units, and each trip can carry 10 units.\n// CD + CE >= 20\n\n## Generate Constraint-4:\nThe demand for goods in city D is 120 units, and each trip can carry 10 units.\n// AD + BD + CD + DE >= 12\n\n## Generate Constraint-5:\nThe demand for goods in city E is 180 units, and each trip can carry 10 units.\n// AE + BE + CE + DE >= 18",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make between each pair of cities to minimize the total fuel consumption while meeting the demand for goods in each city. The fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried.\n\nThe company aims to minimize the total fuel consumption. The demand for goods in each city and the capacity of each trip are given in the following Table.\n\n| City | Demand (units) | Trip Capacity (units) |\n|------|----------------|-----------------------|\n| A    | 100            | 10                    |\n| B    | 150            | 10                    |\n| C    | 200            | 10                    |\n| D    | 120            | 10                    |\n| E    | 180            | 10                    |\n\nThe company must meet the following constraints:\n- The number of trips from city A to other cities must be sufficient to meet the demand of 100 units in city A.\n- The number of trips from city B to other cities must be sufficient to meet the demand of 150 units in city B.\n- The number of trips from city C to other cities must be sufficient to meet the demand of 200 units in city C.\n- The number of trips from city D to other cities must be sufficient to meet the demand of 120 units in city D.\n- The number of trips from city E to other cities must be sufficient to meet the demand of 180 units in city E.\n\nPlease help the company to determine the optimal number of trips between each pair of cities to minimize the total fuel consumption while meeting the demand for goods in each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAB = model.addVar(vtype=\"INTEGER\", name=\"AB\", lb=0) # number of trips from city A to city B\nAC = model.addVar(vtype=\"INTEGER\", name=\"AC\", lb=0) # number of trips from city A to city C\nAD = model.addVar(vtype=\"INTEGER\", name=\"AD\", lb=0) # number of trips from city A to city D\nAE = model.addVar(vtype=\"INTEGER\", name=\"AE\", lb=0) # number of trips from city A to city E\nBC = model.addVar(vtype=\"INTEGER\", name=\"BC\", lb=0) # number of trips from city B to city C\nBD = model.addVar(vtype=\"INTEGER\", name=\"BD\", lb=0) # number of trips from city B to city D\nBE = model.addVar(vtype=\"INTEGER\", name=\"BE\", lb=0) # number of trips from city B to city E\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0) # number of trips from city C to city D\nCE = model.addVar(vtype=\"INTEGER\", name=\"CE\", lb=0) # number of trips from city C to city E\nDE = model.addVar(vtype=\"INTEGER\", name=\"DE\", lb=0) # number of trips from city D to city E\n\n# Define objective function\n# The fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried.\n# Fuel_AB = k1 * AB^2 * d_AB\n# Fuel_AC = k1 * AC^2 * d_AC\n# Fuel_AD = k1 * AD^2 * d_AD\n# Fuel_AE = k1 * AE^2 * d_AE\n# Fuel_BC = k1 * BC^2 * d_BC\n# Fuel_BD = k1 * BD^2 * d_BD\n# Fuel_BE = k1 * BE^2 * d_BE\n# Fuel_CD = k1 * CD^2 * d_CD\n# Fuel_CE = k1 * CE^2 * d_CE\n# Fuel_DE = k1 * DE^2 * d_DE\n# So, the objective function is: Minimize (Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_AB = AB**2\nFuel_AC = AC**2\nFuel_AD = AD**2\nFuel_AE = AE**2\nFuel_BC = BC**2\nFuel_BD = BD**2\nFuel_BE = BE**2\nFuel_CD = CD**2\nFuel_CE = CE**2\nFuel_DE = DE**2\nmodel.addCons(obj == Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n\n# Add constraints\n# The demand for goods in city A is 100 units, and each trip can carry 10 units.\nmodel.addCons(AB + AC + AD + AE >= 10)\n# The demand for goods in city B is 150 units, and each trip can carry 10 units.\nmodel.addCons(BC + BD + BE >= 15)\n# The demand for goods in city C is 200 units, and each trip can carry 10 units.\nmodel.addCons(CD + CE >= 20)\n# The demand for goods in city D is 120 units, and each trip can carry 10 units.\nmodel.addCons(AD + BD + CD + DE >= 12)\n# The demand for goods in city E is 180 units, and each trip can carry 10 units.\nmodel.addCons(AE + BE + CE + DE >= 18)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips from city A to city B: \", model.getVal(AB))\n    print(\"Number of trips from city A to city C: \", model.getVal(AC))\n    print(\"Number of trips from city A to city D: \", model.getVal(AD))\n    print(\"Number of trips from city A to city E: \", model.getVal(AE))\n    print(\"Number of trips from city B to city C: \", model.getVal(BC))\n    print(\"Number of trips from city B to city D: \", model.getVal(BD))\n    print(\"Number of trips from city B to city E: \", model.getVal(BE))\n    print(\"Number of trips from city C to city D: \", model.getVal(CD))\n    print(\"Number of trips from city C to city E: \", model.getVal(CE))\n    print(\"Number of trips from city D to city E: \", model.getVal(DE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1745,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a network of five types of public transportation: buses, trams, subways, ferries, and bicycles. The city needs to determine the number of each type of transportation to maximize efficiency and minimize environmental impact.\n// {\"number of buses\": \"Buses\", \"range\": \"Buses >= 0\", \"type\": \"integer\"}\n// {\"number of trams\": \"Trams\", \"range\": \"Trams >= 0\", \"type\": \"integer\"}\n// {\"number of subways\": \"Subways\", \"range\": \"Subways >= 0\", \"type\": \"integer\"}\n// {\"number of ferries\": \"Ferries\", \"range\": \"Ferries >= 0\", \"type\": \"integer\"}\n// {\"number of bicycles\": \"Bicycles\", \"range\": \"Bicycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each transportation type is measured by its capacity and speed. The environmental impact is measured by the carbon emissions per passenger kilometer. The city aims to maximize the total transportation efficiency while minimizing the total environmental impact.\n// Efficiency_Buses = 1000 * Buses\n// Efficiency_Trams = 1500 * Trams\n// Efficiency_Subways = 2000 * Subways\n// Efficiency_Ferries = 1200 * Ferries\n// Efficiency_Bicycles = 800 * Bicycles\n// Environmental_Impact_Buses = 0.1 * Buses\n// Environmental_Impact_Trams = 0.05 * Trams\n// Environmental_Impact_Subways = 0.02 * Subways\n// Environmental_Impact_Ferries = 0.08 * Ferries\n// Environmental_Impact_Bicycles = 0.01 * Bicycles\n// So, the objective function is: Maximize (Efficiency_Buses + Efficiency_Trams + Efficiency_Subways + Efficiency_Ferries + Efficiency_Bicycles) / (Environmental_Impact_Buses + Environmental_Impact_Trams + Environmental_Impact_Subways + Environmental_Impact_Ferries + Environmental_Impact_Bicycles)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the initial setup of the transportation network.\n// 50000 * Buses + 70000 * Trams + 100000 * Subways + 80000 * Ferries + 1000 * Bicycles <= 500000\n\n## Generate Constraint-2:\nThe city has a total space limitation of 100 units for all transportation types.\n// Buses + Trams + Subways + Ferries + Bicycles <= 100",
        "question": "A city is planning to build a network of five types of public transportation: buses, trams, subways, ferries, and bicycles. The city needs to determine the number of each type of transportation to maximize efficiency and minimize environmental impact. The efficiency of each transportation type is measured by its capacity and speed, and the environmental impact is measured by the carbon emissions per passenger kilometer. The city aims to maximize the total transportation efficiency while minimizing the total environmental impact.\n\n| Transportation Type | Efficiency (per unit) | Environmental Impact (per unit) |\n|---------------------|----------------------|---------------------------------|\n| Buses               | 1000                 | 0.1                             |\n| Trams               | 1500                 | 0.05                            |\n| Subways             | 2000                 | 0.02                            |\n| Ferries             | 1200                 | 0.08                            |\n| Bicycles            | 800                  | 0.01                            |\n\nThe city has a budget of $500,000 for the initial setup of the transportation network. The city also has a total space limitation of 100 units for all transportation types.\n\nPlease help the city to maximize the total transportation efficiency while minimizing the total environmental impact, defined as the ratio of the sum of efficiencies to the sum of environmental impacts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nBuses = model.addVar(vtype=\"INTEGER\", name=\"Buses\", lb=0)  # number of buses\nTrams = model.addVar(vtype=\"INTEGER\", name=\"Trams\", lb=0)  # number of trams\nSubways = model.addVar(vtype=\"INTEGER\", name=\"Subways\", lb=0)  # number of subways\nFerries = model.addVar(vtype=\"INTEGER\", name=\"Ferries\", lb=0)  # number of ferries\nBicycles = model.addVar(vtype=\"INTEGER\", name=\"Bicycles\", lb=0)  # number of bicycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Buses = 1000 * Buses\nEfficiency_Trams = 1500 * Trams\nEfficiency_Subways = 2000 * Subways\nEfficiency_Ferries = 1200 * Ferries\nEfficiency_Bicycles = 800 * Bicycles\nEnvironmental_Impact_Buses = 0.1 * Buses\nEnvironmental_Impact_Trams = 0.05 * Trams\nEnvironmental_Impact_Subways = 0.02 * Subways\nEnvironmental_Impact_Ferries = 0.08 * Ferries\nEnvironmental_Impact_Bicycles = 0.01 * Bicycles\n## the objective function is: Maximize (Efficiency_Buses + Efficiency_Trams + Efficiency_Subways + Efficiency_Ferries + Efficiency_Bicycles) / (Environmental_Impact_Buses + Environmental_Impact_Trams + Environmental_Impact_Subways + Environmental_Impact_Ferries + Environmental_Impact_Bicycles)\n## convert the division to multiplication\nmodel.addCons(obj * (Environmental_Impact_Buses + Environmental_Impact_Trams + Environmental_Impact_Subways + Environmental_Impact_Ferries + Environmental_Impact_Bicycles) == Efficiency_Buses + Efficiency_Trams + Efficiency_Subways + Efficiency_Ferries + Efficiency_Bicycles)\n\n# Add constraints\n## The city has a budget of $500,000 for the initial setup of the transportation network.\nmodel.addCons(50000 * Buses + 70000 * Trams + 100000 * Subways + 80000 * Ferries + 1000 * Bicycles <= 500000)\n## The city has a total space limitation of 100 units for all transportation types.\nmodel.addCons(Buses + Trams + Subways + Ferries + Bicycles <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Buses: \", model.getVal(Buses))\n    print(\"Number of Trams: \", model.getVal(Trams))\n    print(\"Number of Subways: \", model.getVal(Subways))\n    print(\"Number of Ferries: \", model.getVal(Ferries))\n    print(\"Number of Bicycles: \", model.getVal(Bicycles))\n    print(\"Maximized Efficiency to Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1481,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,800,000\n\n## Generate Constraint-4:\nTo ensure service quality, each route must have at least one truck.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-5:\nThe company aims to have at least twice as many trucks on RouteC as on RouteD.\n// TrucksC >= 2 * TrucksD",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for each route is given in the following Table.\n\n| Route   | Cost per Truck |\n|---------|----------------|\n| RouteA  | $50,000        |\n| RouteB  | $60,000        |\n| RouteC  | $70,000        |\n| RouteD  | $80,000        |\n| RouteE  | $90,000        |\n\nThe company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The company has a budget of $2,800,000 for total fuel and maintenance costs for the year. To ensure service quality, each route must have at least one truck. The company aims to have at least twice as many trucks on RouteC as on RouteD.\n\nPlease help the company to minimize the total cost of fuel and maintenance by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The company has a budget of $2,800,000 for total fuel and maintenance costs for the year.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2800000)\n# To ensure service quality, each route must have at least one truck.\nmodel.addCons(TrucksA >= 1)\nmodel.addCons(TrucksB >= 1)\nmodel.addCons(TrucksC >= 1)\nmodel.addCons(TrucksD >= 1)\nmodel.addCons(TrucksE >= 1)\n# The company aims to have at least twice as many trucks on RouteC as on RouteD.\nmodel.addCons(TrucksC >= 2 * TrucksD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The company also needs to determine the investment in automation technology to reduce the labor hours required per unit.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\n// Total cost for ProductB: CostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\n// Total cost for ProductC: CostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 100 units of ProductB.\n// UnitsA >= 50; UnitsB >= 100\n\n## Generate Constraint-4:\nDue to market demand, the total number of units produced for all products cannot exceed 500.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-5:\nThe initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours.\n// LaborHoursA >= 2 - 0.0001 * AutomationInvestment; LaborHoursB >= 3 - 0.0001 * AutomationInvestment; LaborHoursC >= 4 - 0.0001 * AutomationInvestment",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the amount of resources (labor hours and raw materials) allocated to each product, and the investment in automation technology to reduce the labor hours required per unit. The cost of labor per hour is $20, and the revenue per unit for ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit | Initial Labor Hours per Unit |\n|---------|------------------|------------------------------|\n| ProductA | $100             | 2                            |\n| ProductB | $150             | 3                            |\n| ProductC | $200             | 4                            |\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 100 units of ProductB. Due to market demand, the total number of units produced for all products cannot exceed 500. The initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours, but these can be reduced with investment in automation technology.\n\nPlease help the company to maximize the total profit from all products, considering the constraints on labor hours, investment in automation, and production quantities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit for ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit for ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit for ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # investment in automation technology\n\n# Define objective function\nCostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\nCostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\nCostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons((LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + \n              (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + \n              (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000)\n# The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvestment <= 50000)\n# The company must produce at least 50 units of ProductA and 100 units of ProductB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 100)\n# Due to market demand, the total number of units produced for all products cannot exceed 500.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n# The initial labor hours required per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours.\nmodel.addCons(LaborHoursA >= 2 - 0.0001 * AutomationInvestment)\nmodel.addCons(LaborHoursB >= 3 - 0.0001 * AutomationInvestment)\nmodel.addCons(LaborHoursC >= 4 - 0.0001 * AutomationInvestment)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit for ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit for ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit for ProductC: \", model.getVal(LaborHoursC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1623,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to determine the production quantity for each device to optimize its operations.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100. \nFor DeviceB, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150. \nFor DeviceC, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nFor DeviceD, the profit per unit is $60, the storage cost per unit is $6, and the production setup cost is $120.\nFor DeviceE, the profit per unit is $80, the storage cost per unit is $8, and the production setup cost is $160.\nThe company aims to maximize the total net profit, which is the sum of the profit per unit minus the storage cost per unit, minus the production setup cost per unit times the square root of the production quantity.\n// Net profit for DeviceA: Profit_A = (50 - 5) * A - 100 * sqrt(A)\n// Net profit for DeviceB: Profit_B = (70 - 7) * B - 150 * sqrt(B)\n// Net profit for DeviceC: Profit_C = (90 - 9) * C - 200 * sqrt(C)\n// Net profit for DeviceD: Profit_D = (60 - 6) * D - 120 * sqrt(D)\n// Net profit for DeviceE: Profit_E = (80 - 8) * E - 160 * sqrt(E)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production setup costs.\n// 100 * A + 150 * B + 200 * C + 120 * D + 160 * E <= 5000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 500 units across all devices.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20 units of each device are produced.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-4:\nThe production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB.\n// D <= 0.5 * (A + B)\n\n## Generate Constraint-5:\nThe production of DeviceE must be at least twice the production of DeviceC.\n// E >= 2 * C",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to determine the production quantity for each device to optimize its operations.\nFor DeviceA, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100. \nFor DeviceB, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150. \nFor DeviceC, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nFor DeviceD, the profit per unit is $60, the storage cost per unit is $6, and the production setup cost is $120.\nFor DeviceE, the profit per unit is $80, the storage cost per unit is $8, and the production setup cost is $160.\nThe company has a budget of $5000 for production setup costs. The company has a storage capacity of 500 units across all devices. The company wants to ensure that at least 20 units of each device are produced. The production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB. The production of DeviceE must be at least twice the production of DeviceC.\nPlease help the company to maximize the total net profit, which is the sum of the profit per unit minus the storage cost per unit, minus the production setup cost per unit times the square root of the production quantity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of DeviceD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of DeviceE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit for DeviceA: Profit_A = (50 - 5) * A - 100 * sqrt(A)\n## Net profit for DeviceB: Profit_B = (70 - 7) * B - 150 * sqrt(B)\n## Net profit for DeviceC: Profit_C = (90 - 9) * C - 200 * sqrt(C)\n## Net profit for DeviceD: Profit_D = (60 - 6) * D - 120 * sqrt(D)\n## Net profit for DeviceE: Profit_E = (80 - 8) * E - 160 * sqrt(E)\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n## convert the square root to a variable\nsqrt_A = model.addVar(name=\"sqrt_A\")\nsqrt_B = model.addVar(name=\"sqrt_B\")\nsqrt_C = model.addVar(name=\"sqrt_C\")\nsqrt_D = model.addVar(name=\"sqrt_D\")\nsqrt_E = model.addVar(name=\"sqrt_E\")\nmodel.addCons(sqrt_A * sqrt_A == A)\nmodel.addCons(sqrt_B * sqrt_B == B)\nmodel.addCons(sqrt_C * sqrt_C == C)\nmodel.addCons(sqrt_D * sqrt_D == D)\nmodel.addCons(sqrt_E * sqrt_E == E)\nProfit_A = (50 - 5) * A - 100 * sqrt_A\nProfit_B = (70 - 7) * B - 150 * sqrt_B\nProfit_C = (90 - 9) * C - 200 * sqrt_C\nProfit_D = (60 - 6) * D - 120 * sqrt_D\nProfit_E = (80 - 8) * E - 160 * sqrt_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $5000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C + 120 * D + 160 * E <= 5000)\n## The company has a storage capacity of 500 units across all devices.\nmodel.addCons(A + B + C + D + E <= 500)\n## The production of DeviceD must not exceed 50% of the total production of DeviceA and DeviceB.\nmodel.addCons(D <= 0.5 * (A + B))\n## The production of DeviceE must be at least twice the production of DeviceC.\nmodel.addCons(E >= 2 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of DeviceE: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1383,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000.\nFor wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000.\nThe company wants to minimize the Cost-Energy ratio of the installation. (The Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production.)\n// total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\n// total energy production: Energy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation. For solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000. For wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000. The company wants to minimize the Cost-Energy ratio of the installation, which is defined as the total cost of the installations divided by the total energy production. The company has a budget of $100,000 for the installations. Please help the company determine the optimal number of solar panels and wind turbines to install at each location.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of solar panels at Location4\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\nEnergy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations.\nmodel.addCons(1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Solar Panels at Location4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind))\n    print(\"Minimized Cost-Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost structure. Machine 1 produces product 1 at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product 2 at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product 3 at a rate of 20 units per hour, with a profit of $6 per unit. Machine 4 produces product 1 at a rate of 12 units per hour, with a profit of $5 per unit. Machine 5 produces product 2 at a rate of 18 units per hour, with a profit of $7 per unit. The objective is to maximize the total profit from all products.\n// The profit from machine 1: P1 = 10 * M1 * 5\n// The profit from machine 2: P2 = 15 * M2 * 7\n// The profit from machine 3: P3 = 20 * M3 * 6\n// The profit from machine 4: P4 = 12 * M4 * 5\n// The profit from machine 5: P5 = 18 * M5 * 7\n// So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours per week.\n// M1 + M2 + M3 + M4 + M5 <= 100\n\n## Generate Constraint-2:\nEach machine has a maximum operating capacity. Machine 1 can operate up to 20 hours, Machine 2 up to 25 hours, Machine 3 up to 30 hours, Machine 4 up to 22 hours, and Machine 5 up to 28 hours.\n// M1 <= 20; M2 <= 25; M3 <= 30; M4 <= 22; M5 <= 28",
        "question": "A manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit. The production rate and profit per unit for each machine are given in the following Table.\n\n| Machine | Product | Production Rate (units/hour) | Profit per Unit |\n|---------|---------|-------------------------------|-----------------|\n| 1       | 1       | 10                            | $5              |\n| 2       | 2       | 15                            | $7              |\n| 3       | 3       | 20                            | $6              |\n| 4       | 1       | 12                            | $5              |\n| 5       | 2       | 18                            | $7              |\n\nThe total operating hours for all machines must not exceed 100 hours per week. Each machine has a maximum operating capacity: Machine 1 can operate up to 20 hours, Machine 2 up to 25 hours, Machine 3 up to 30 hours, Machine 4 up to 22 hours, and Machine 5 up to 28 hours.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0, ub=20) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0, ub=25) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0, ub=30) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0, ub=22) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0, ub=28) # hours machine 5 operates\n\n# Define objective function\nP1 = 10 * M1 * 5\nP2 = 15 * M2 * 7\nP3 = 20 * M3 * 6\nP4 = 12 * M4 * 5\nP5 = 18 * M5 * 7\n# So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 100 hours per week.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods using a truck varies with the number of trucks allocated. The cost function is nonlinear and is given by: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants. The company aims to minimize the total transportation cost across all warehouses.\n// Cost_Warehouse1 = a1 * T1^2 + b1 * T1 + c1\n// Cost_Warehouse2 = a2 * T2^2 + b2 * T2 + c2\n// Cost_Warehouse3 = a3 * T3^2 + b3 * T3 + c3\n// Cost_Warehouse4 = a4 * T4^2 + b4 * T4 + c4\n// Cost_Warehouse5 = a5 * T5^2 + b5 * T5 + c5\n// So, the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse has a minimum and maximum number of trucks it can efficiently operate. For warehouse 1, the range is 5 to 20 trucks. For warehouse 2, the range is 10 to 25 trucks. For warehouse 3, the range is 15 to 30 trucks. For warehouse 4, the range is 20 to 35 trucks. For warehouse 5, the range is 25 to 40 trucks.\n// 5 <= T1 <= 20; 10 <= T2 <= 25; 15 <= T3 <= 30; 20 <= T4 <= 35; 25 <= T5 <= 40",
        "question": "A logistics company operates five different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods using a truck varies with the number of trucks allocated. The cost function is nonlinear and is given by: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants. The company aims to minimize the total transportation cost across all warehouses. The total number of trucks available across all warehouses is limited to 100. Each warehouse has a minimum and maximum number of trucks it can efficiently operate. For warehouse 1, the range is 5 to 20 trucks. For warehouse 2, the range is 10 to 25 trucks. For warehouse 3, the range is 15 to 30 trucks. For warehouse 4, the range is 20 to 35 trucks. For warehouse 5, the range is 25 to 40 trucks. Please help the company to determine the optimal allocation of trucks to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to determine the optimal number of trucks to allocate to each warehouse.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=20, ub=35) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=25, ub=40) # number of trucks at warehouse 5\n\n# Define objective function\n## The cost of transporting goods using a truck varies with the number of trucks allocated.\na1, b1, c1 = 0.1, 10, 500 # example constants for warehouse 1\na2, b2, c2 = 0.2, 15, 600 # example constants for warehouse 2\na3, b3, c3 = 0.3, 20, 700 # example constants for warehouse 3\na4, b4, c4 = 0.4, 25, 800 # example constants for warehouse 4\na5, b5, c5 = 0.5, 30, 900 # example constants for warehouse 5\n\nCost_Warehouse1 = a1 * T1**2 + b1 * T1 + c1\nCost_Warehouse2 = a2 * T2**2 + b2 * T2 + c2\nCost_Warehouse3 = a3 * T3**2 + b3 * T3 + c3\nCost_Warehouse4 = a4 * T4**2 + b4 * T4 + c4\nCost_Warehouse5 = a5 * T5**2 + b5 * T5 + c5\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\nmodel.addCons(obj == Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\n// {\"number of trucks for WarehouseA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by warehouse due to different operational costs and delivery distances. \nFor WarehouseA, the operating cost per truck is $5,000, and the delivery efficiency (packages delivered per hour) is 100.\nFor WarehouseB, the operating cost per truck is $6,000, and the delivery efficiency is 120.\nFor WarehouseC, the operating cost per truck is $7,000, and the delivery efficiency is 130.\nFor WarehouseD, the operating cost per truck is $8,000, and the delivery efficiency is 140.\nFor WarehouseE, the operating cost per truck is $9,000, and the delivery efficiency is 150.\nThe company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold.\n// Total operating cost for WarehouseA: Cost_A = 5000 * TruckA\n// Total operating cost for WarehouseB: Cost_B = 6000 * TruckB\n// Total operating cost for WarehouseC: Cost_C = 7000 * TruckC\n// Total operating cost for WarehouseD: Cost_D = 8000 * TruckD\n// Total operating cost for WarehouseE: Cost_E = 9000 * TruckE\n// Total delivery efficiency: Efficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to Efficiency >= 130\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 40\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC.\n// TruckC <= 10",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency. The operating cost per truck and the delivery efficiency for each warehouse are given in the following Table.\n\n| Warehouse | Operating Cost per Truck | Delivery Efficiency (packages/hour) |\n|-----------|--------------------------|-------------------------------------|\n| WarehouseA| $5,000                   | 100                                 |\n| WarehouseB| $6,000                   | 120                                 |\n| WarehouseC| $7,000                   | 130                                 |\n| WarehouseD| $8,000                   | 140                                 |\n| WarehouseE| $9,000                   | 150                                 |\n\nThe company has a total of 40 trucks available for allocation. Due to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC. The company wants to minimize the total operating cost while maintaining a minimum delivery efficiency threshold of 130 packages per hour.\n\nPlease help the company to determine the optimal allocation of trucks to each warehouse to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for WarehouseA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for WarehouseB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for WarehouseC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for WarehouseD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for WarehouseE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 5000 * TruckA\nCost_B = 6000 * TruckB\nCost_C = 7000 * TruckC\nCost_D = 8000 * TruckD\nCost_E = 9000 * TruckE\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## Total delivery efficiency: Efficiency = (100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## Convert the division to multiplication\nEfficiency = model.addVar('Efficiency')\nmodel.addCons(Efficiency * (TruckA + TruckB + TruckC + TruckD + TruckE) == 100 * TruckA + 120 * TruckB + 130 * TruckC + 140 * TruckD + 150 * TruckE)\nmodel.addCons(Efficiency >= 130)\n\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 40)\n\n## Due to maintenance schedules, no more than 10 trucks can be assigned to WarehouseC.\nmodel.addCons(TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TruckE))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency.\n// {\"deliveries of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor each delivery, the company incurs a fuel cost and time cost. The fuel consumption per delivery for P1 is 5 liters, for P2 is 6 liters, for P3 is 7 liters, for P4 is 8 liters, and for P5 is 9 liters. The time taken per delivery for P1 is 1 hour, for P2 is 2 hours, for P3 is 3 hours, for P4 is 4 hours, and for P5 is 5 hours. The company wants to minimize the total fuel consumption and time cost.\n// Fuel_Cost_P1 = 5 * P1\n// Fuel_Cost_P2 = 6 * P2\n// Fuel_Cost_P3 = 7 * P3\n// Fuel_Cost_P4 = 8 * P4\n// Fuel_Cost_P5 = 9 * P5\n// Time_Cost_P1 = 1 * P1\n// Time_Cost_P2 = 2 * P2\n// Time_Cost_P3 = 3 * P3\n// Time_Cost_P4 = 4 * P4\n// Time_Cost_P5 = 5 * P5\n// So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters.\n// 5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000\n\n## Generate Constraint-2:\nThe company has a total time budget of 500 hours.\n// P1 + 2 * P2 + 3 * P3 + 4 * P4 + 5 * P5 <= 500",
        "question": "A logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency. The fuel consumption and time taken per delivery for each product are given in the following Table.\n\n| Product | Fuel Consumption (liters) | Time Taken (hours) |\n|---------|---------------------------|--------------------|\n| P1      | 5                         | 1                  |\n| P2      | 6                         | 2                  |\n| P3      | 7                         | 3                  |\n| P4      | 8                         | 4                  |\n| P5      | 9                         | 5                  |\n\nThe company has a total fuel budget of 1000 liters and a total time budget of 500 hours. Please help the company to minimize the total fuel consumption and time cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # deliveries of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # deliveries of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # deliveries of P3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # deliveries of P4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # deliveries of P5\n\n# Define objective function\nFuel_Cost_P1 = 5 * P1\nFuel_Cost_P2 = 6 * P2\nFuel_Cost_P3 = 7 * P3\nFuel_Cost_P4 = 8 * P4\nFuel_Cost_P5 = 9 * P5\nTime_Cost_P1 = 1 * P1\nTime_Cost_P2 = 2 * P2\nTime_Cost_P3 = 3 * P3\nTime_Cost_P4 = 4 * P4\nTime_Cost_P5 = 5 * P5\n# So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5 + Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n# Add constraints\n# The company has a total fuel budget of 1000 liters.\nmodel.addCons(5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000)\n# The company has a total time budget of 500 hours.\nmodel.addCons(P1 + 2 * P2 + 3 * P3 + 4 * P4 + 5 * P5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Deliveries of P1: \", model.getVal(P1))\n    print(\"Deliveries of P2: \", model.getVal(P2))\n    print(\"Deliveries of P3: \", model.getVal(P3))\n    print(\"Deliveries of P4: \", model.getVal(P4))\n    print(\"Deliveries of P5: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company aims to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact also affects the company's taxes.\n\n| Cargo Type       | Profit per Truck | Operational Cost Function | Environmental Impact Function |\n|------------------|------------------|---------------------------|-------------------------------|\n| Food             | 5000             | 0.01 * Food^2            | 0.005 * Food^2                |\n| Electronics      | 7000             | 0.015 * Electronics^2    | 0.007 * Electronics^2          |\n| Textiles         | 4000             | 0.008 * Textiles^2       | 0.004 * Textiles^2            |\n| Chemicals        | 6000             | 0.02 * Chemicals^2       | 0.01 * Chemicals^2             |\n| Heavy Machinery  | 8000             | 0.025 * HeavyMachinery^2 | 0.012 * HeavyMachinery^2       |\n\nThe company has a budget of $500,000 for purchasing trucks. Please help the company to maximize its profit by determining the optimal number of trucks for each type of cargo, considering the operational costs and environmental impacts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=0)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=0)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=0)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=0)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=0)  # number of Heavy Machinery trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and costs calculation\nProfit_Food = 5000 * Food\nCost_Food = 0.01 * Food**2\nEnvImpact_Food = 0.005 * Food**2\n\nProfit_Electronics = 7000 * Electronics\nCost_Electronics = 0.015 * Electronics**2\nEnvImpact_Electronics = 0.007 * Electronics**2\n\nProfit_Textiles = 4000 * Textiles\nCost_Textiles = 0.008 * Textiles**2\nEnvImpact_Textiles = 0.004 * Textiles**2\n\nProfit_Chemicals = 6000 * Chemicals\nCost_Chemicals = 0.02 * Chemicals**2\nEnvImpact_Chemicals = 0.01 * Chemicals**2\n\nProfit_HeavyMachinery = 8000 * HeavyMachinery\nCost_HeavyMachinery = 0.025 * HeavyMachinery**2\nEnvImpact_HeavyMachinery = 0.012 * HeavyMachinery**2\n\n## the objective function is: Maximize (Profit - Cost - EnvImpact)\nmodel.addCons(obj == Profit_Food + Profit_Electronics + Profit_Textiles + Profit_Chemicals + Profit_HeavyMachinery - Cost_Food - Cost_Electronics - Cost_Textiles - Cost_Chemicals - Cost_HeavyMachinery - EnvImpact_Food - EnvImpact_Electronics - EnvImpact_Textiles - EnvImpact_Chemicals - EnvImpact_HeavyMachinery)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1431,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which reduces the cost of production per unit of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for ProductA\": \"TechInvestmentA\", \"range\": \"TechInvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for ProductB\": \"TechInvestmentB\", \"range\": \"TechInvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for ProductC\": \"TechInvestmentC\", \"range\": \"TechInvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in new technology for each product. The initial cost of production per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * TechInvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * TechInvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * TechInvestmentC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which reduces the cost of production per unit of each product. The cost of production per unit decreases by $5 for every $1000 invested in new technology for each product. The initial cost of production per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products. The total resources available for production are limited to 1000 units.\n\nPlease help the company to determine the optimal production quantities, resource allocations, and technology investments to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nTechInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentA\", lb=0)  # investment in new technology for ProductA\nTechInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentB\", lb=0)  # investment in new technology for ProductB\nTechInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentC\", lb=0)  # investment in new technology for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * TechInvestmentA) * QuantityA\nProfitB = (250 - 150 + 0.005 * TechInvestmentB) * QuantityB\nProfitC = (300 - 200 + 0.005 * TechInvestmentC) * QuantityC\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in New Technology for ProductA: \", model.getVal(TechInvestmentA))\n    print(\"Investment in New Technology for ProductB: \", model.getVal(TechInvestmentB))\n    print(\"Investment in New Technology for ProductC: \", model.getVal(TechInvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various costs and constraints.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the material cost is $40, and the production time is 1 hour.\nFor DeviceB, the selling price is $150, the material cost is $60, and the production time is 2 hours.\nFor DeviceC, the selling price is $200, the material cost is $80, and the production time is 3 hours.\nFor DeviceD, the selling price is $250, the material cost is $100, and the production time is 4 hours.\nThe company aims to maximize the total profit per hour of production.\n// Profit of DeviceA: Profit_A = (100 - 40) * A\n// Profit of DeviceB: Profit_B = (150 - 60) * B\n// Profit of DeviceC: Profit_C = (200 - 80) * C\n// Profit of DeviceD: Profit_D = (250 - 100) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs.\n// 40 * A + 60 * B + 80 * C + 100 * D <= 10,000\n\n## Generate Constraint-2:\nThe company has a maximum production capacity of 500 hours.\n// A + 2 * B + 3 * C + 4 * D <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\n// C <= A + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various costs and constraints.\nFor DeviceA, the selling price is $100, the material cost is $40, and the production time is 1 hour.\nFor DeviceB, the selling price is $150, the material cost is $60, and the production time is 2 hours.\nFor DeviceC, the selling price is $200, the material cost is $80, and the production time is 3 hours.\nFor DeviceD, the selling price is $250, the material cost is $100, and the production time is 4 hours.\nThe company has a total budget of $10,000 for material costs. The company has a maximum production capacity of 500 hours. The company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB. The company also wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\nPlease help the company to maximize the total profit per hour of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 40) * A\nProfit_B = (150 - 60) * B\nProfit_C = (200 - 80) * C\nProfit_D = (250 - 100) * D\nProductionTime = A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for material costs.\nmodel.addCons(40 * A + 60 * B + 80 * C + 100 * D <= 10000)\n## The company has a maximum production capacity of 500 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D <= 500)\n## The company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\nmodel.addCons(C <= A + B)\n## The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the revenue per unit is $30, the production time per unit is 1 hour, and the material cost per unit is $10. \nFor product B, the revenue per unit is $40, the production time per unit is 2 hours, and the material cost per unit is $15. \nFor product C, the revenue per unit is $50, the production time per unit is 3 hours, and the material cost per unit is $20.\nFor product D, the revenue per unit is $60, the production time per unit is 4 hours, and the material cost per unit is $25.\nThe company only has one production line and can only produce one product at a time. The company wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_A = 30 * A - 10 * A\n// Profit_B = 40 * B - 15 * B\n// Profit_C = 50 * C - 20 * C\n// Profit_D = 60 * D - 25 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe company has a limited production time of 200 hours.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for material costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 3000\n\n## Generate Constraint-3:\nThe company has a production capacity of 400 units in terms of the number of units it can produce.\n// A + B + C + D <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce.\nFor product A, the revenue per unit is $30, the production time per unit is 1 hour, and the material cost per unit is $10. \nFor product B, the revenue per unit is $40, the production time per unit is 2 hours, and the material cost per unit is $15. \nFor product C, the revenue per unit is $50, the production time per unit is 3 hours, and the material cost per unit is $20.\nFor product D, the revenue per unit is $60, the production time per unit is 4 hours, and the material cost per unit is $25.\nThe company only has one production line and can only produce one product at a time. The company has a limited production time of 200 hours and a budget of $3000 for material costs. The company also has a production capacity of 400 units in terms of the number of units it can produce.\nPlease help the company to maximize the profit efficiency (profit per hour of production time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProfit_D = (60 - 25) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a limited production time of 200 hours.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 200)\n## The company has a budget of $3000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 3000)\n## The company has a production capacity of 400 units in terms of the number of units it can produce.\nmodel.addCons(A + B + C + D <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary. The details are as follows:\n\n| Device | Production Cost | Selling Price | Demand |\n|--------|-----------------|---------------|--------|\n| DeviceA | $50 | $100 | 500 units |\n| DeviceB | $70 | $120 | 400 units |\n| DeviceC | $80 | $150 | 300 units |\n\nThe company wants to maximize its total profit, considering that the profit for each device includes a quadratic term due to increasing marginal costs:\n- Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2\n- Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2\n- Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2\n\nThe company has a total production capacity of 1000 units per month. Please help the company determine the optimal number of units to produce for each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2\n## Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2\n## Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2\n## Convert quadratic terms to linear terms by introducing new variables and constraints\nQuadA = model.addVar(vtype=\"INTEGER\", name=\"QuadA\", lb=0)\nQuadB = model.addVar(vtype=\"INTEGER\", name=\"QuadB\", lb=0)\nQuadC = model.addVar(vtype=\"INTEGER\", name=\"QuadC\", lb=0)\nmodel.addCons(QuadA == UnitsA * UnitsA)\nmodel.addCons(QuadB == UnitsB * UnitsB)\nmodel.addCons(QuadC == UnitsC * UnitsC)\nProfit_A = (100 - 50) * UnitsA - 0.01 * QuadA\nProfit_B = (120 - 70) * UnitsB - 0.02 * QuadB\nProfit_C = (150 - 80) * UnitsC - 0.03 * QuadC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and cost structure. The efficiency of producing component 1 on line 1 is 10 units per hour, and the cost is $5 per hour. On line 2, it's 15 units per hour at a cost of $7 per hour. On line 3, it's 20 units per hour at a cost of $9 per hour. On line 4, it's 25 units per hour at a cost of $11 per hour. On line 5, it's 30 units per hour at a cost of $13 per hour. The company aims to maximize the total production of component 1 while minimizing the total cost.\n// The total production of component 1: Q1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5\n// The total cost: C = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5\n// So, the objective function is: Maximize (Q1 - C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 100 hours.\n// P1 + P2 + P3 + P4 + P5 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 30 hours.\n// P1 <= 30; P2 <= 30; P3 <= 30; P4 <= 30; P5 <= 30",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production. The efficiency and cost structure for each production line are given in the following Table.\n\n| Production Line | Efficiency (Units per Hour) | Cost per Hour |\n|-----------------|-----------------------------|---------------|\n| 1               | 10                          | $5            |\n| 2               | 15                          | $7            |\n| 3               | 20                          | $9            |\n| 4               | 25                          | $11           |\n| 5               | 30                          | $13           |\n\nThe company aims to maximize the total production of component 1 while minimizing the total cost. The total available hours for all production lines is 100 hours. Each production line can operate for a maximum of 30 hours. Please help the company to maximize the total production of component 1 while minimizing the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=0) # hours for production line 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=0) # hours for production line 5\n\n# Define objective function\nQ1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5 # total production of component 1\nC = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5 # total cost\n# So, the objective function is: Maximize (Q1 - C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Q1 - C)\n\n# Add constraints\n# The total available hours for all production lines is 100 hours.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 100)\n# Each production line can operate for a maximum of 30 hours.\nmodel.addCons(P1 <= 30)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 30)\nmodel.addCons(P4 <= 30)\nmodel.addCons(P5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Hours for Production Line 4: \", model.getVal(P4))\n    print(\"Hours for Production Line 5: \", model.getVal(P5))\n    print(\"Maximized Production of Component 1: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the amount of investment in automation technology to reduce production costs. The production cost per unit decreases with increased investment in automation.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The selling price per unit is $200 for DeviceA, $250 for DeviceB, and $300 for DeviceC. For every $10,000 invested in automation, the production cost per unit decreases by $5. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\n// Total profit for DeviceB: ProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\n// Total profit for DeviceC: ProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n// UnitsA >= 1000; UnitsB >= 1500\n\n## Generate Constraint-4:\nThe company has a budget of $2,000,000 for total production costs, including the cost of automation investment.\n// (100 - 0.0005 * AutomationInvestment) * UnitsA + (150 - 0.0005 * AutomationInvestment) * UnitsB + (200 - 0.0005 * AutomationInvestment) * UnitsC + AutomationInvestment <= 2000000\n\n## Generate Constraint-5:\nThe company wants to ensure that the investment in automation does not reduce the production cost per unit below $50 for any device.\n// 100 - 0.0005 * AutomationInvestment >= 50; 150 - 0.0005 * AutomationInvestment >= 50; 200 - 0.0005 * AutomationInvestment >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the amount of investment in automation technology to reduce production costs. The production cost per unit decreases with increased investment in automation. The selling price and initial production cost per unit for each device are given in the following Table.\n\n| Device | Selling Price | Initial Production Cost |\n|--------|---------------|-------------------------|\n| DeviceA | $200         | $100                    |\n| DeviceB | $250         | $150                    |\n| DeviceC | $300         | $200                    |\n\nFor every $10,000 invested in automation, the production cost per unit decreases by $5. The company has a total production capacity of 10,000 units for all devices combined. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB. The company has a budget of $2,000,000 for total production costs, including the cost of automation investment. The company wants to ensure that the investment in automation does not reduce the production cost per unit below $50 for any device. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1000) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1500) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for DeviceA: ProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\n## Total profit for DeviceB: ProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\n## Total profit for DeviceC: ProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\nProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\nProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\nProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvestment <= 50000)\n## Due to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n## The company has a budget of $2,000,000 for total production costs, including the cost of automation investment.\nmodel.addCons((100 - 0.0005 * AutomationInvestment) * UnitsA + (150 - 0.0005 * AutomationInvestment) * UnitsB + (200 - 0.0005 * AutomationInvestment) * UnitsC + AutomationInvestment <= 2000000)\n## The company wants to ensure that the investment in automation does not reduce the production cost per unit below $50 for any device.\nmodel.addCons(100 - 0.0005 * AutomationInvestment >= 50)\nmodel.addCons(150 - 0.0005 * AutomationInvestment >= 50)\nmodel.addCons(200 - 0.0005 * AutomationInvestment >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1376,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The initial cost per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation technology.\n// AutomationInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 10,000 units per month.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units.\n// QuantityA <= 4000; QuantityB <= 3000\n\n## Generate Constraint-4:\nThe company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations.\n// QuantityC >= 1000\n\n## Generate Constraint-5:\nThe total cost of production, including raw materials and labor, cannot exceed $800,000 per month.\n// (50 + 0.0001 * AutomationInvestment) * QuantityA + (70 + 0.0001 * AutomationInvestment) * QuantityB + (90 + 0.0001 * AutomationInvestment) * QuantityC <= 800000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the investment in automation technology to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology. The profit per unit and the initial cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $100            | $50                   |\n| ProductB | $150            | $70                   |\n| ProductC | $200            | $90                   |\n\nThe company has a budget of $100,000 for investment in automation technology. The total production capacity of the company is 10,000 units per month. Due to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units. The company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations. The total cost of production, including raw materials and labor, cannot exceed $800,000 per month. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\nProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\nProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $100,000 for investment in automation technology.\nmodel.addCons(AutomationInvestment <= 100000)\n# The total production capacity of the company is 10,000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# Due to market demand, the production of ProductA must not exceed 4,000 units, and ProductB must not exceed 3,000 units.\nmodel.addCons(QuantityA <= 4000)\nmodel.addCons(QuantityB <= 3000)\n# The company must ensure that at least 1,000 units of ProductC are produced to meet contractual obligations.\nmodel.addCons(QuantityC >= 1000)\n# The total cost of production, including raw materials and labor, cannot exceed $800,000 per month.\nmodel.addCons((50 + 0.0001 * AutomationInvestment) * QuantityA + (70 + 0.0001 * AutomationInvestment) * QuantityB + (90 + 0.0001 * AutomationInvestment) * QuantityC <= 800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the limited resources such as labor hours and raw materials. The variables include the number of units of product A, product B, and product C to be produced.\n// {\"number of units of product A\": \"Units_A\", \"range\": \"Units_A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"Units_B\", \"range\": \"Units_B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"Units_C\", \"range\": \"Units_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// Profit_A = 50 * Units_A\n// Profit_B = 70 * Units_B\n// Profit_C = 60 * Units_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available. Each unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * Units_A + 8 * Units_B + 6 * Units_C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit while considering the limited resources such as labor hours and raw materials. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company has a total of 1000 labor hours available. Each unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits_A = model.addVar(vtype=\"INTEGER\", name=\"Units_A\", lb=0) # number of units of product A\nUnits_B = model.addVar(vtype=\"INTEGER\", name=\"Units_B\", lb=0) # number of units of product B\nUnits_C = model.addVar(vtype=\"INTEGER\", name=\"Units_C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = 50 * Units_A\nProfit_B = 70 * Units_B\nProfit_C = 60 * Units_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 labor hours available. Each unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\nmodel.addCons(5 * Units_A + 8 * Units_B + 6 * Units_C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(Units_A))\n    print(\"Number of Units of Product B: \", model.getVal(Units_B))\n    print(\"Number of Units of Product C: \", model.getVal(Units_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 557,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component is influenced by a nonlinear function of the quantity produced. The profit functions are as follows:\n- Profit from component A: PA = 100 * A - 0.1 * A^2\n- Profit from component B: PB = 150 * B - 0.2 * B^2\n- Profit from component C: PC = 200 * C - 0.3 * C^2\n- Profit from component D: PD = 250 * D - 0.4 * D^2\n- Profit from component E: PE = 300 * E - 0.5 * E^2\nThe company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize TotalProfit = PA + PB + PC + PD + PE\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints. The profit from each component is influenced by a nonlinear function of the quantity produced, as shown in the following table:\n\n| Component | Profit Function                |\n|-----------|--------------------------------|\n| A         | PA = 100 * A - 0.1 * A^2       |\n| B         | PB = 150 * B - 0.2 * B^2       |\n| C         | PC = 200 * C - 0.3 * C^2       |\n| D         | PD = 250 * D - 0.4 * D^2       |\n| E         | PE = 300 * E - 0.5 * E^2       |\n\nThe company aims to maximize the total profit from all components. The total production capacity of the company is limited to 1000 units per day. Please help the company determine the optimal quantities of each component to produce daily to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nPA = 100 * A - 0.1 * A**2\nPB = 150 * B - 0.2 * B**2\nPC = 200 * C - 0.3 * C**2\nPD = 250 * D - 0.4 * D**2\nPE = 300 * E - 0.5 * E**2\n## the objective function is: Maximize TotalProfit = PA + PB + PC + PD + PE\nmodel.addCons(obj == PA + PB + PC + PD + PE)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Quantity of Component D: \", model.getVal(D))\n    print(\"Quantity of Component E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company wants to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 30 - 5) * DeviceAProduction\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 40 - 7) * DeviceBProduction\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 50 - 9) * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint of 800 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 800",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|-----------------|--------------------------|-----------------------|\n| DeviceA | $50 | $30 | $5 |\n| DeviceB | $70 | $40 | $7 |\n| DeviceC | $90 | $50 | $9 |\n\nThe company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceA must be at least twice the production of DeviceB. The company also has a storage capacity constraint of 800 units. \n\nPlease help the company to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # number of DeviceA produced\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # number of DeviceB produced\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # number of DeviceC produced\n\n# Define objective function\nProfit_DeviceA = (50 - 30 - 5) * DeviceAProduction\nProfit_DeviceB = (70 - 40 - 7) * DeviceBProduction\nProfit_DeviceC = (90 - 50 - 9) * DeviceCProduction\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 1000) # limited production capacity\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction) # DeviceA production must be at least twice DeviceB production\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 800) # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceAProduction))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceBProduction))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceCProduction))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of delivery vehicles. The company has identified three types of vehicles (Small, Medium, and Large) that can be used for deliveries. The company needs to determine the number of each type of vehicle to purchase and the daily operational cost for each type of vehicle.\n// {\"number of Small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"daily operational cost for Small vehicles\": \"SmallCost\", \"range\": \"SmallCost >= 0\", \"type\": \"real\"}\n// {\"daily operational cost for Medium vehicles\": \"MediumCost\", \"range\": \"MediumCost >= 0\", \"type\": \"real\"}\n// {\"daily operational cost for Large vehicles\": \"LargeCost\", \"range\": \"LargeCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total daily operational cost of the fleet while ensuring that the fleet can handle the expected delivery volume. The operational cost per vehicle type is not linear and depends on the number of vehicles of that type.\n// TotalCost = SmallVehicles * SmallCost + MediumVehicles * MediumCost + LargeVehicles * LargeCost\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operational costs.\n// SmallVehicles * SmallCost + MediumVehicles * MediumCost + LargeVehicles * LargeCost <= 10000\n\n## Generate Constraint-2:\nThe total delivery capacity of the fleet must be at least 5000 units per day. The delivery capacity per vehicle type is as follows: Small vehicles can deliver 100 units, Medium vehicles can deliver 200 units, and Large vehicles can deliver 300 units.\n// 100 * SmallVehicles + 200 * MediumVehicles + 300 * LargeVehicles >= 5000",
        "question": "A logistics company is planning its fleet of delivery vehicles. The company has identified three types of vehicles (Small, Medium, and Large) that can be used for deliveries. The company needs to determine the number of each type of vehicle to purchase and the daily operational cost for each type of vehicle. The daily operational cost and delivery capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Daily Operational Cost | Delivery Capacity |\n|--------------|------------------------|-------------------|\n| Small        | SmallCost              | 100 units         |\n| Medium       | MediumCost             | 200 units         |\n| Large        | LargeCost              | 300 units         |\n\nThe company has a budget of $10,000 per day for operational costs. The total delivery capacity of the fleet must be at least 5000 units per day. \nPlease help the company to minimize the total daily operational cost of the fleet while ensuring that the fleet can handle the expected delivery volume.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)  # number of Small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)  # number of Medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)  # number of Large vehicles\nSmallCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallCost\", lb=0)  # daily operational cost for Small vehicles\nMediumCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumCost\", lb=0)  # daily operational cost for Medium vehicles\nLargeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeCost\", lb=0)  # daily operational cost for Large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize TotalCost\nTotalCost = SmallVehicles * SmallCost + MediumVehicles * MediumCost + LargeVehicles * LargeCost\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for operational costs.\nmodel.addCons(SmallVehicles * SmallCost + MediumVehicles * MediumCost + LargeVehicles * LargeCost <= 10000)\n## The total delivery capacity of the fleet must be at least 5000 units per day.\nmodel.addCons(100 * SmallVehicles + 200 * MediumVehicles + 300 * LargeVehicles >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Daily Operational Cost for Small Vehicles: \", model.getVal(SmallCost))\n    print(\"Daily Operational Cost for Medium Vehicles: \", model.getVal(MediumCost))\n    print(\"Daily Operational Cost for Large Vehicles: \", model.getVal(LargeCost))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"investment in landscaping\": \"Landscaping\", \"range\": \"Landscaping >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer aims to maximize the total value of all properties.\n// Value_LV = 500000 + 10 * Landscaping * LV\n// Value_MA = 300000 + 5 * Landscaping * MA\n// Value_AH = 150000 + 2 * Landscaping * AH\n// So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\n\n## Generate Constraint-1:\nThe developer has a budget of $1,000,000 for construction and landscaping.\n// 500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000\n\n## Generate Constraint-2:\nThe total area available for construction is limited to 100,000 square meters. Each Luxury Villa requires 1,000 square meters, each Mid-Range Apartment requires 500 square meters, and each Affordable Home requires 200 square meters.\n// 1000 * LV + 500 * MA + 200 * AH <= 100000\n\n## Generate Constraint-3:\nThe developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n// LV >= 5; MA >= 10",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer also needs to determine the amount of money to invest in landscaping to enhance the property values. The relationship between landscaping investment and property value increase is as follows:\n\n| Property Type | Initial Value per Unit | Value Increase per $1,000 Landscaping Investment |\n|---------------|-------------------------|-------------------------------------------------|\n| Luxury Villas | $500,000                | $10,000                                         |\n| Mid-Range Apartments | $300,000              | $5,000                                          |\n| Affordable Homes | $150,000               | $2,000                                          |\n\nThe developer has a budget of $1,000,000 for construction and landscaping. The total area available for construction is limited to 100,000 square meters, with each Luxury Villa requiring 1,000 square meters, each Mid-Range Apartment requiring 500 square meters, and each Affordable Home requiring 200 square meters. The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n\nPlease help the developer to maximize the total value of all properties by determining the optimal number of each type of property to build and the amount of money to invest in landscaping.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=5)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0)  # number of Affordable Homes\nLandscaping = model.addVar(vtype=\"CONTINUOUS\", name=\"Landscaping\", lb=0)  # investment in landscaping\n\n# Define objective function\nValue_LV = 500000 * LV + 10 * Landscaping * LV\nValue_MA = 300000 * MA + 5 * Landscaping * MA\nValue_AH = 150000 * AH + 2 * Landscaping * AH\n# So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value_LV + Value_MA + Value_AH)\n\n# Add constraints\n# The developer has a budget of $1,000,000 for construction and landscaping.\nmodel.addCons(500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000)\n# The total area available for construction is limited to 100,000 square meters.\nmodel.addCons(1000 * LV + 500 * MA + 200 * AH <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Investment in Landscaping: \", model.getVal(Landscaping))\n    print(\"Total Property Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1428,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption.\n// {\"number of trips to D1\": \"TripsD1\", \"range\": \"TripsD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D2\": \"TripsD2\", \"range\": \"TripsD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D3\": \"TripsD3\", \"range\": \"TripsD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D4\": \"TripsD4\", \"range\": \"TripsD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D5\": \"TripsD5\", \"range\": \"TripsD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for D1\": \"FuelBudgetD1\", \"range\": \"FuelBudgetD1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D2\": \"FuelBudgetD2\", \"range\": \"FuelBudgetD2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D3\": \"FuelBudgetD3\", \"range\": \"FuelBudgetD3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D4\": \"FuelBudgetD4\", \"range\": \"FuelBudgetD4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D5\": \"FuelBudgetD5\", \"range\": \"FuelBudgetD5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumptionD1 = (TripsD1 * FuelBudgetD1^0.7)\n// FuelConsumptionD2 = (TripsD2 * FuelBudgetD2^0.7)\n// FuelConsumptionD3 = (TripsD3 * FuelBudgetD3^0.7)\n// FuelConsumptionD4 = (TripsD4 * FuelBudgetD4^0.7)\n// FuelConsumptionD5 = (TripsD5 * FuelBudgetD5^0.7)\n// So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel across all routes.\n// FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption. The fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes.\n\n| Destination | Number of Trips | Fuel Budget |\n|-------------|-----------------|-------------|\n| D1          | TripsD1         | FuelBudgetD1|\n| D2          | TripsD2         | FuelBudgetD2|\n| D3          | TripsD3         | FuelBudgetD3|\n| D4          | TripsD4         | FuelBudgetD4|\n| D5          | TripsD5         | FuelBudgetD5|\n\nThe company has a total budget of $100,000 for fuel across all routes. Each destination requires a non-negative number of trips and a non-negative fuel budget.\n\nPlease help the company to determine the optimal number of trips and fuel budget for each destination to minimize the total fuel consumption while staying within the total fuel budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsD1 = model.addVar(vtype=\"INTEGER\", name=\"TripsD1\", lb=0)\nTripsD2 = model.addVar(vtype=\"INTEGER\", name=\"TripsD2\", lb=0)\nTripsD3 = model.addVar(vtype=\"INTEGER\", name=\"TripsD3\", lb=0)\nTripsD4 = model.addVar(vtype=\"INTEGER\", name=\"TripsD4\", lb=0)\nTripsD5 = model.addVar(vtype=\"INTEGER\", name=\"TripsD5\", lb=0)\nFuelBudgetD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD1\", lb=0)\nFuelBudgetD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD2\", lb=0)\nFuelBudgetD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD3\", lb=0)\nFuelBudgetD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD4\", lb=0)\nFuelBudgetD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD5\", lb=0)\n\n# Define objective function\nFuelConsumptionD1 = TripsD1 * FuelBudgetD1**0.7\nFuelConsumptionD2 = TripsD2 * FuelBudgetD2**0.7\nFuelConsumptionD3 = TripsD3 * FuelBudgetD3**0.7\nFuelConsumptionD4 = TripsD4 * FuelBudgetD4**0.7\nFuelConsumptionD5 = TripsD5 * FuelBudgetD5**0.7\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n# Add constraints\nmodel.addCons(FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to D1: \", model.getVal(TripsD1))\n    print(\"Number of Trips to D2: \", model.getVal(TripsD2))\n    print(\"Number of Trips to D3: \", model.getVal(TripsD3))\n    print(\"Number of Trips to D4: \", model.getVal(TripsD4))\n    print(\"Number of Trips to D5: \", model.getVal(TripsD5))\n    print(\"Fuel Budget for D1: \", model.getVal(FuelBudgetD1))\n    print(\"Fuel Budget for D2: \", model.getVal(FuelBudgetD2))\n    print(\"Fuel Budget for D3: \", model.getVal(FuelBudgetD3))\n    print(\"Fuel Budget for D4: \", model.getVal(FuelBudgetD4))\n    print(\"Fuel Budget for D5: \", model.getVal(FuelBudgetD5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n// Total energy production: Energy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\n// Total environmental impact: Impact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 for the construction of these facilities.\n// Cost of solar facilities: 100,000 * Solar\n// Cost of wind facilities: 150,000 * Wind\n// Cost of hydro facilities: 200,000 * Hydro\n// Cost of biomass facilities: 80,000 * Biomass\n// Cost of geothermal facilities: 250,000 * Geothermal\n// Total cost: 100,000 * Solar + 150,000 * Wind + 200,000 * Hydro + 80,000 * Biomass + 250,000 * Geothermal <= 5,000,000\n\n## Generate Constraint-2:\nThe city has a land area constraint that limits the total number of facilities to 50.\n// Solar + Wind + Hydro + Biomass + Geothermal <= 50\n\n## Generate Constraint-3:\nThe city wants to ensure a minimum energy production of 2000 MWh.\n// 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal >= 2000\n\n## Generate Constraint-4:\nDue to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5.\n// Geothermal - Hydro <= 5\n\n## Generate Constraint-5:\nThe city aims to have at least 10 facilities of any type to ensure a diversified energy portfolio.\n// Solar >= 10 or Wind >= 10 or Hydro >= 10 or Biomass >= 10 or Geothermal >= 10",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact. The energy production per unit and the environmental impact score for each type of facility are given in the following Table.\n\n| Facility Type | Energy Production per Unit (MWh) | Environmental Impact Score |\n|---------------|----------------------------------|----------------------------|\n| Solar         | 50                               | 10                         |\n| Wind          | 60                               | 12                         |\n| Hydro         | 70                               | 15                         |\n| Biomass       | 40                               | 8                          |\n| Geothermal    | 80                               | 18                         |\n\nThe city has a budget of $5,000,000 for the construction of these facilities. The city has a land area constraint that limits the total number of facilities to 50. The city wants to ensure a minimum energy production of 2000 MWh. Due to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5. The city aims to have at least 10 facilities of any type to ensure a diversified energy portfolio.\n\nPlease help the city to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\nImpact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $5,000,000 for the construction of these facilities.\nmodel.addCons(100000 * Solar + 150000 * Wind + 200000 * Hydro + 80000 * Biomass + 250000 * Geothermal <= 5000000)\n## The city has a land area constraint that limits the total number of facilities to 50.\nmodel.addCons(Solar + Wind + Hydro + Biomass + Geothermal <= 50)\n## The city wants to ensure a minimum energy production of 2000 MWh.\nmodel.addCons(50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal >= 2000)\n## Due to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5.\nmodel.addCons(Geothermal - Hydro <= 5)\n\n# Ensure at least 10 facilities of any type\nmodel.addCons(Solar >= 10)\nmodel.addCons(Wind >= 10)\nmodel.addCons(Hydro >= 10)\nmodel.addCons(Biomass >= 10)\nmodel.addCons(Geothermal >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Maximized Energy-Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1584,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption\n\n## Generate Constraint-3:\nThe company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n// CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000\n\n## Generate Constraint-4:\nThe company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n// Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage\n\n## Generate Constraint-5:\nThe number of solar panels must not exceed the number of available suitable roof spaces.\n// Solar <= NumberOfSuitableRoofSpaces",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines, as well as determining the capacity of energy storage systems. The decision variables include the number of solar panels, wind turbines, and the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n\n| Variable                     | Description                          |\n|------------------------------|--------------------------------------|\n| Solar                        | Number of solar panels               |\n| Wind                         | Number of wind turbines              |\n| Storage                      | Capacity of energy storage systems   |\n| Consumption                  | Energy consumption (kWh)             |\n| Cost                         | Energy cost (per kWh)                |\n\nThe company has several constraints:\n1. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n2. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n3. The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n4. The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n5. The number of solar panels must not exceed the number of available suitable roof spaces.\n\nPlease help the company to minimize the total energy cost while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # efficiency of solar panels\nWindEfficiency = 0.3  # efficiency of wind turbines\nTotalEnergyDemand = 10000  # total energy demand of the company\nPricePerKWh = 0.15  # price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**-1) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 400  # average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n## The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\nCostOfSolarPanel = 1000  # cost of a solar panel\nCostOfWindTurbine = 2000  # cost of a wind turbine\nCostOfStorage = 100  # cost of storage per kWh\nmodel.addCons(CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000)\n## The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\nmodel.addCons(Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage)\n## The number of solar panels must not exceed the number of available suitable roof spaces.\nNumberOfSuitableRoofSpaces = 50  # number of suitable roof spaces\nmodel.addCons(Solar <= NumberOfSuitableRoofSpaces)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Total Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1792,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company wants to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n// Total_Cost_T1 = 1.5 * T1\n// Total_Cost_T2 = 2 * T2\n// Total_Cost_T3 = 2.5 * T3\n// Total_Cost_T4 = 3 * T4\n// Total_Cost_T5 = 3.5 * T5\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations.\n// 1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe company must deliver at least 2000 tons of goods.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the fleet is composed of T1 trucks.\n// T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities, fuel consumption per kilometer, and cost per kilometer. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Cost per Kilometer | Capacity (tons) |\n|------------|------------------------------|--------------------|-----------------|\n| T1         | 0.2                          | $1.5               | 10              |\n| T2         | 0.3                          | $2                 | 20              |\n| T3         | 0.4                          | $2.5               | 30              |\n| T4         | 0.5                          | $3                 | 40              |\n| T5         | 0.6                          | $3.5               | 50              |\n\nThe company has a budget of $10,000 for truck operations. The total number of trucks cannot exceed 100. The company must deliver at least 2000 tons of goods. The company must ensure that at least 20% of the fleet is composed of T1 trucks. \n\nPlease help the company to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 1.5 * T1\nTotal_Cost_T2 = 2 * T2\nTotal_Cost_T3 = 2.5 * T3\nTotal_Cost_T4 = 3 * T4\nTotal_Cost_T5 = 3.5 * T5\nTotal_Capacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / Total_Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Total_Capacity == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations.\nmodel.addCons(1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The company must deliver at least 2000 tons of goods.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000)\n## The company must ensure that at least 20% of the fleet is composed of T1 trucks.\nmodel.addCons(T1 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1277,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Cargo carried by TruckA: Cargo_A = 10 * TruckA\n// Cargo carried by TruckB: Cargo_B = 15 * TruckB\n// Cargo carried by TruckC: Cargo_C = 20 * TruckC\n// Cargo carried by TruckD: Cargo_D = 25 * TruckD\n// Fuel consumed by all trucks: Fuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs per month.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50,000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 50 trucks in total.\n// TruckA + TruckB + TruckC + TruckD <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB",
        "question": "A logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints. Each TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed. The company has a total budget of $50,000 for fuel costs per month. The company can only operate a maximum of 50 trucks in total. Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB. Please help the company to determine the optimal number of each type of truck to maximize the total cargo carried per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_A = 10 * TruckA\nCargo_B = 15 * TruckB\nCargo_C = 20 * TruckC\nCargo_D = 25 * TruckD\nFuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Total == Cargo_A + Cargo_B + Cargo_C + Cargo_D)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs per month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50000)\n## The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 50)\n## Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nmodel.addCons(TruckC <= TruckA + TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the advertising budget for each product to enhance market penetration.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10. The storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n// Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n// Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the advertising budget for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit, cost of raw materials per unit, labor cost per unit, storage cost per unit, and advertising effectiveness for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit | Storage Cost per Unit | Advertising Effectiveness |\n|---------|-----------------|----------------------------|---------------------|-----------------------|---------------------------|\n| ProductA | $50            | $20                        | $10                 | $5                    | 0.1                       |\n| ProductB | $70            | $30                        | $10                 | $7                    | 0.15                      |\n| ProductC | $60            | $25                        | $10                 | $6                    | 0.12                      |\n\nThe company has a total budget of $100,000 for raw materials and labor. The production quantity for each product must be a non-negative integer, and the advertising budget for each product must be a non-negative real number.\n\nPlease help the company to maximize the total profit, which is calculated as the sum of the profit from each product's sales and the additional profit from advertising.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\nProfit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\nProfit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons((20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1537,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for Good A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Good C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks.\n// Fuel_Consumption_A = kA * (SpeedA^2) * TrucksA * Hours_Operated\n// Fuel_Consumption_B = kB * (SpeedB^2) * TrucksB * Hours_Operated\n// Fuel_Consumption_C = kC * (SpeedC^2) * TrucksC * Hours_Operated\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel expenses.\n// kA * (SpeedA^2) * TrucksA * Hours_Operated + kB * (SpeedB^2) * TrucksB * Hours_Operated + kC * (SpeedC^2) * TrucksC * Hours_Operated <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is planning its fleet of trucks to optimize the delivery of three types of goods (A, B, and C) across different regions. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption in liters per hour, v is the speed in km/h, and k is a constant specific to each type of truck. The company wants to minimize the total daily fuel consumption across all trucks. The company has a total budget of $10,000 per day for fuel expenses. The total number of trucks available is limited to 50. Please help the company determine the optimal number of trucks for each type of good and their respective average speeds to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # average speed of trucks for Good A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # average speed of trucks for Good B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # average speed of trucks for Good C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nkA = 0.01  # example constant for Good A\nkB = 0.02  # example constant for Good B\nkC = 0.03  # example constant for Good C\nHours_Operated = 8  # example hours operated per day\nFuel_Consumption_A = kA * (SpeedA**2) * TrucksA * Hours_Operated\nFuel_Consumption_B = kB * (SpeedB**2) * TrucksB * Hours_Operated\nFuel_Consumption_C = kC * (SpeedC**2) * TrucksC * Hours_Operated\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for fuel expenses.\nmodel.addCons(kA * (SpeedA**2) * TrucksA * Hours_Operated + kB * (SpeedB**2) * TrucksB * Hours_Operated + kC * (SpeedC**2) * TrucksC * Hours_Operated <= 10000)\n## The total number of trucks available is limited to 50.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Average Speed of Trucks for Good A: \", model.getVal(SpeedA))\n    print(\"Average Speed of Trucks for Good B: \", model.getVal(SpeedB))\n    print(\"Average Speed of Trucks for Good C: \", model.getVal(SpeedC))\n    print(\"Minimized Total Daily Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Refrigerated trucks\": \"TechUpgradeRefrigerated\", \"range\": \"TechUpgradeRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Heavy-Duty trucks\": \"TechUpgradeHeavyDuty\", \"range\": \"TechUpgradeHeavyDuty >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Standard trucks\": \"TechUpgradeStandard\", \"range\": \"TechUpgradeStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs.\n// Fuel cost per Refrigerated truck: FuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\n// Maintenance cost per Refrigerated truck: MaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\n// Similar calculations for Heavy-Duty and Standard trucks.\n// Total annual operating cost: OperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n// So, the objective function is: Minimize OperatingCost\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades.\n// RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200\n\n## Generate Constraint-3:\nAt least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations.\n// RefrigeratedTrucks >= 50; HeavyDutyTrucks >= 75\n\n## Generate Constraint-4:\nThe investment in technology upgrades for each type of truck must not exceed 50% of the total cost of purchasing that type of truck.\n// TechUpgradeRefrigerated <= 0.5 * (RefrigeratedTrucks * TruckCostRefrigerated)\n// TechUpgradeHeavyDuty <= 0.5 * (HeavyDutyTrucks * TruckCostHeavyDuty)\n// TechUpgradeStandard <= 0.5 * (StandardTrucks * TruckCostStandard)",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs. The fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs.\n\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades. The total number of trucks cannot exceed 200. At least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations. The investment in technology upgrades for each type of truck must not exceed 50% of the total cost of purchasing that type of truck.\n\nPlease help the company to minimize the total annual operating cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=50)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=75)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nTechUpgradeRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeRefrigerated\", lb=0)\nTechUpgradeHeavyDuty = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeHeavyDuty\", lb=0)\nTechUpgradeStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeStandard\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel and maintenance cost calculations\nBaseFuelCost = 10000  # Example base fuel cost per truck\nBaseMaintenanceCost = 2000  # Example base maintenance cost per truck\nTruckCostRefrigerated = 100000  # Example cost of Refrigerated truck\nTruckCostHeavyDuty = 150000  # Example cost of Heavy-Duty truck\nTruckCostStandard = 80000  # Example cost of Standard truck\n\nFuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\nMaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\nFuelCostHeavyDuty = (BaseFuelCost * HeavyDutyTrucks) / (1 + 0.01 * TechUpgradeHeavyDuty)\nMaintenanceCostHeavyDuty = (BaseMaintenanceCost * HeavyDutyTrucks) * (1 - 0.005 * TechUpgradeHeavyDuty)\nFuelCostStandard = (BaseFuelCost * StandardTrucks) / (1 + 0.01 * TechUpgradeStandard)\nMaintenanceCostStandard = (BaseMaintenanceCost * StandardTrucks) * (1 - 0.005 * TechUpgradeStandard)\n\nOperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\nmodel.addCons(obj == OperatingCost)\n\n# Add constraints\nmodel.addCons(RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000)\nmodel.addCons(RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200)\nmodel.addCons(TechUpgradeRefrigerated <= 0.5 * (RefrigeratedTrucks * TruckCostRefrigerated))\nmodel.addCons(TechUpgradeHeavyDuty <= 0.5 * (HeavyDutyTrucks * TruckCostHeavyDuty))\nmodel.addCons(TechUpgradeStandard <= 0.5 * (StandardTrucks * TruckCostStandard))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Tech Upgrades for Refrigerated Trucks: \", model.getVal(TechUpgradeRefrigerated))\n    print(\"Investment in Tech Upgrades for Heavy-Duty Trucks: \", model.getVal(TechUpgradeHeavyDuty))\n    print(\"Investment in Tech Upgrades for Standard Trucks: \", model.getVal(TechUpgradeStandard))\n    print(\"Minimized Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function. The production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units for the quarter. The total investment in the new technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB.\n\nPlease help the company to maximize the total profit from all products, considering the investment in the new technology and the constraints on production quantities and investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n## Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n## Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\nProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\nProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\nProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC - TechInvestment)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of chemicals: C1, C2, and C3, and a new type of chemical C4. They need to determine the quantities of each chemical to produce.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the revenue per unit is $100, the production cost per unit is $40, and the storage cost per unit is $10.\nFor C2, the revenue per unit is $120, the production cost per unit is $50, and the storage cost per unit is $15.\nFor C3, the revenue per unit is $140, the production cost per unit is $60, and the storage cost per unit is $20.\nFor C4, the revenue per unit is $160, the production cost per unit is $70, and the storage cost per unit is $25.\nThe manufacturer wants to maximize the net profit (revenue minus production and storage costs).\n// Profit_C1 = 100 * C1 - 40 * C1 - 10 * C1^2\n// Profit_C2 = 120 * C2 - 50 * C2 - 15 * C2^2\n// Profit_C3 = 140 * C3 - 60 * C3 - 20 * C3^2\n// Profit_C4 = 160 * C4 - 70 * C4 - 25 * C4^2\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production capacity of 200 units in total.\n// C1 + C2 + C3 + C4 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $10000 for production costs.\n// 40 * C1 + 50 * C2 + 60 * C3 + 70 * C4 <= 10000\n\n## Generate Constraint-3:\nThe storage space is limited to 150 units in total.\n// C1^2 + C2^2 + C3^2 + C4^2 <= 150\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of C1.\n// C1 <= 50",
        "question": "A manufacturer produces three types of chemicals: C1, C2, and C3, and a new type of chemical C4. They need to determine the quantities of each chemical to produce.\nFor C1, the revenue per unit is $100, the production cost per unit is $40, and the storage cost per unit is $10.\nFor C2, the revenue per unit is $120, the production cost per unit is $50, and the storage cost per unit is $15.\nFor C3, the revenue per unit is $140, the production cost per unit is $60, and the storage cost per unit is $20.\nFor C4, the revenue per unit is $160, the production cost per unit is $70, and the storage cost per unit is $25.\nThe manufacturer wants to maximize the net profit (revenue minus production and storage costs).\nThe manufacturer has a limited production capacity of 200 units in total. The manufacturer has a budget of $10000 for production costs. The storage space is limited to 150 units in total. The market demand for C1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of C1.\nPlease help the manufacturer to determine the optimal quantities of each chemical to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)  # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0)  # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0)  # quantity of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0)  # quantity of C4\n\n# Define objective function\n# For C1, C2, C3, C4, the profit is revenue minus production and storage costs.\n# Profit_Ci = revenue_i * Ci - cost_i * Ci - storage_cost_i * Ci^2\n# Since pyscipopt does not support quadratic terms in the objective, we will handle the quadratic terms as constraints.\n\n# Define quadratic terms as variables\nC1_squared = model.addVar(vtype=\"INTEGER\", name=\"C1_squared\")\nC2_squared = model.addVar(vtype=\"INTEGER\", name=\"C2_squared\")\nC3_squared = model.addVar(vtype=\"INTEGER\", name=\"C3_squared\")\nC4_squared = model.addVar(vtype=\"INTEGER\", name=\"C4_squared\")\n\n# Constraints to link quadratic terms with original variables\nmodel.addCons(C1_squared == C1 * C1)\nmodel.addCons(C2_squared == C2 * C2)\nmodel.addCons(C3_squared == C3 * C3)\nmodel.addCons(C4_squared == C4 * C4)\n\n# Calculate profits\nProfit_C1 = 100 * C1 - 40 * C1 - 10 * C1_squared\nProfit_C2 = 120 * C2 - 50 * C2 - 15 * C2_squared\nProfit_C3 = 140 * C3 - 60 * C3 - 20 * C3_squared\nProfit_C4 = 160 * C4 - 70 * C4 - 25 * C4_squared\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4)\n\n# Add constraints\n# Constraint-1: Total production capacity is 200 units\nmodel.addCons(C1 + C2 + C3 + C4 <= 200)\n# Constraint-2: Budget for production costs is $10000\nmodel.addCons(40 * C1 + 50 * C2 + 60 * C3 + 70 * C4 <= 10000)\n# Constraint-3: Storage space is limited to 150 units in total\nmodel.addCons(C1_squared + C2_squared + C3_squared + C4_squared <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Quantity of C4: \", model.getVal(C4))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The variables include the number of units produced for each device.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceAUnits\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceBUnits\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceCUnits\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units across all devices.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize profits, considering the costs of production and the demand for each device. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from all devices. The company has a monthly production capacity of 1000 units across all devices. Please help the company determine the optimal number of units to produce for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceAUnits\nProfit_DeviceB = (70 - 40) * DeviceBUnits\nProfit_DeviceC = (60 - 35) * DeviceCUnits\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 708,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\n// TrucksC + TrucksD >= 20",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks. Please help the company to minimize the total cost of fuel and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\nmodel.addCons(TrucksC + TrucksD >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 775,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of wireless headphones produced\": \"Headphones\", \"range\": \"Headphones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets $80, laptops $200, smartwatches $50, and headphones $30. The production cost per unit for smartphones is $60, tablets $50, laptops $120, smartwatches $30, and headphones $20. The company wants to maximize the net profit, which is the difference between the revenue and the cost of production.\n// Revenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\n// Cost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production cost should not exceed $100,000.\n// 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000\n\n## Generate Constraint-2:\nThe storage capacity for all devices combined is limited to 2000 units.\n// Smartphones + Tablets + Laptops + Smartwatches + Headphones <= 2000\n\n## Generate Constraint-3:\nThe company can produce at most 500 units of laptops due to component supply constraints.\n// Laptops <= 500\n\n## Generate Constraint-4:\nThe production of smartphones should be at least twice the production of tablets.\n// Smartphones >= 2 * Tablets",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity. The profit per unit for smartphones is $100, tablets $80, laptops $200, smartwatches $50, and headphones $30. The production cost per unit for smartphones is $60, tablets $50, laptops $120, smartwatches $30, and headphones $20. The company wants to maximize the net profit, which is the difference between the revenue and the cost of production. The total production cost should not exceed $100,000. The storage capacity for all devices combined is limited to 2000 units. The company can produce at most 500 units of laptops due to component supply constraints. The production of smartphones should be at least twice the production of tablets. Please help the company determine the optimal number of each device to produce to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nHeadphones = model.addVar(vtype=\"INTEGER\", name=\"Headphones\", lb=0)\n\n# Define objective function\nRevenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\nCost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The total production cost should not exceed $100,000.\nmodel.addCons(60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000)\n# The storage capacity for all devices combined is limited to 2000 units.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Headphones <= 2000)\n# The company can produce at most 500 units of laptops due to component supply constraints.\nmodel.addCons(Laptops <= 500)\n# The production of smartphones should be at least twice the production of tablets.\nmodel.addCons(Smartphones >= 2 * Tablets)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Headphones: \", model.getVal(Headphones))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each truck to reduce fuel costs and increase the number of trips possible per day.\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost for Truck 1: Cost1 = (100 - 0.05 * Upgrade1) * Trips1\n// Fuel cost for Truck 2: Cost2 = (120 - 0.06 * Upgrade2) * Trips2\n// Fuel cost for Truck 3: Cost3 = (150 - 0.075 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and upgrades.\n// (100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nEach truck can make at most 50 trips per day.\n// Trips1 <= 50; Trips2 <= 50; Trips3 <= 50\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips.\n// Trips1 >= 20; Trips2 >= 25",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities and the investment in fuel-efficient upgrades for each truck to optimize its operations. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips. The company has a budget of $10,000 for fuel and upgrades. Each truck can make at most 50 trips per day. Due to maintenance schedules, Truck 1 must make at least 20 trips, and Truck 2 must make at least 25 trips.\n\nPlease help the company to determine the optimal number of trips for each truck and the investment in fuel-efficient upgrades to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=20, ub=50)  # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=25, ub=50)  # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0, ub=50)    # number of trips for Truck 3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)   # investment in fuel-efficient upgrades for Truck 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)   # investment in fuel-efficient upgrades for Truck 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)   # investment in fuel-efficient upgrades for Truck 3\n\n# Define objective function\nCost1 = (100 - 0.05 * Upgrade1) * Trips1\nCost2 = (120 - 0.06 * Upgrade2) * Trips2\nCost3 = (150 - 0.075 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel and upgrades.\nmodel.addCons((100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# Each truck can make at most 50 trips per day.\nmodel.addCons(Trips1 <= 50)\nmodel.addCons(Trips2 <= 50)\nmodel.addCons(Trips3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrades for Truck 1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck 2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck 3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is measured by the profit per fuel cost. Trucks generate a profit of $100 per trip with a fuel cost of $20, Vans generate a profit of $70 per trip with a fuel cost of $15, and Bikes generate a profit of $30 per trip with a fuel cost of $5. The company aims to maximize the total efficiency, which is defined as the sum of the profits divided by the sum of the fuel costs.\n// Profit per Truck: Profit_T = 100 * T\n// Profit per Van: Profit_V = 70 * V\n// Profit per Bike: Profit_B = 30 * B\n// Fuel cost for Trucks: Fuel_T = 20 * T\n// Fuel cost for Vans: Fuel_V = 15 * V\n// Fuel cost for Bikes: Fuel_B = 5 * B\n// So, the objective function is: Maximize (Profit_T + Profit_V + Profit_B) / (Fuel_T + Fuel_V + Fuel_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per month.\n// 20 * T + 15 * V + 5 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 vehicles available.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is measured by the profit per fuel cost, as shown in the following Table.\n\n| Vehicle Type | Profit per Trip | Fuel Cost per Trip |\n|--------------|-----------------|--------------------|\n| Trucks       | $100            | $20                |\n| Vans         | $70             | $15                |\n| Bikes        | $30             | $5                 |\n\nThe company has a budget of $10,000 for fuel costs per month. The company has a total of 50 vehicles available. Please help the company to maximize the total efficiency, which is defined as the sum of the profits divided by the sum of the fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_T = 100 * T\nProfit_V = 70 * V\nProfit_B = 30 * B\nFuel_T = 20 * T\nFuel_V = 15 * V\nFuel_B = 5 * B\n## the objective function is: Maximize (Profit_T + Profit_V + Profit_B) / (Fuel_T + Fuel_V + Fuel_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_T + Fuel_V + Fuel_B) == Profit_T + Profit_V + Profit_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per month.\nmodel.addCons(20 * T + 15 * V + 5 * B <= 10000)\n## The company has a total of 50 vehicles available.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The initial cost per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation technology.\n// AutomationInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 10,000 units per month.\n// QuantityA + QuantityB + QuantityC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The initial cost per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company has a budget of $100,000 for investment in automation technology. The total production capacity of the company is 10,000 units per month. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\nProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\nProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $100,000 for investment in automation technology.\nmodel.addCons(AutomationInvestment <= 100000)\n# The total production capacity of the company is 10,000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation Technology: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe storage facility can hold a maximum of 500 units at any given time.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nMarket demand for product A is at least 100 units per month.\n// UnitsA >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit. The company has a total production capacity of 1000 units per month. The storage facility can hold a maximum of 500 units at any given time. Market demand for product A is at least 100 units per month. Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\n# So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The storage facility can hold a maximum of 500 units at any given time.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency rate based on the number of trucks allocated. The efficiency is calculated as the square root of the number of trucks, which represents the optimal balance between utilization and congestion. The company aims to maximize the total efficiency across all routes.\n// Efficiency of route 1: E1 = sqrt(T1)\n// Efficiency of route 2: E2 = sqrt(T2)\n// Efficiency of route 3: E3 = sqrt(T3)\n// Efficiency of route 4: E4 = sqrt(T4)\n// Efficiency of route 5: E5 = sqrt(T5)\n// Efficiency of route 6: E6 = sqrt(T6)\n// The objective function is: Maximize E1 + E2 + E3 + E4 + E5 + E6\n// Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency rate based on the number of trucks allocated, calculated as the square root of the number of trucks. The company aims to maximize the total efficiency across all routes. The company has a total of 100 trucks available. Please help the company determine the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\n# The objective function is: Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n# Convert square root to a variable to handle non-linearity\nE1 = model.addVar(name=\"E1\")\nE2 = model.addVar(name=\"E2\")\nE3 = model.addVar(name=\"E3\")\nE4 = model.addVar(name=\"E4\")\nE5 = model.addVar(name=\"E5\")\nE6 = model.addVar(name=\"E6\")\n\n# Constraints to link square root variables with original variables\nmodel.addCons(E1**2 == T1)\nmodel.addCons(E2**2 == T2)\nmodel.addCons(E3**2 == T3)\nmodel.addCons(E4**2 == T4)\nmodel.addCons(E5**2 == T5)\nmodel.addCons(E6**2 == T6)\n\n# Set objective as a variable\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 519,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize the total fuel consumption while meeting delivery demands.\n// {\"number of trucks for WarehouseA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck varies with the number of trips it makes. For WarehouseA, each truck consumes fuel at a rate of 0.5 * (TruckA^2) liters per trip. For WarehouseB, the rate is 0.6 * (TruckB^2) liters per trip. For WarehouseC, it's 0.7 * (TruckC^2) liters per trip. For WarehouseD, it's 0.8 * (TruckD^2) liters per trip. For WarehouseE, it's 0.9 * (TruckE^2) liters per trip. The company wants to minimize the total fuel consumption across all warehouses.\n// Total fuel consumption for WarehouseA: Fuel_A = 0.5 * (TruckA^2) * TripsA\n// Total fuel consumption for WarehouseB: Fuel_B = 0.6 * (TruckB^2) * TripsB\n// Total fuel consumption for WarehouseC: Fuel_C = 0.7 * (TruckC^2) * TripsC\n// Total fuel consumption for WarehouseD: Fuel_D = 0.8 * (TruckD^2) * TripsD\n// Total fuel consumption for WarehouseE: Fuel_E = 0.9 * (TruckE^2) * TripsE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nEach warehouse must have at least 5 trucks to operate effectively.\n// TruckA >= 5; TruckB >= 5; TruckC >= 5; TruckD >= 5; TruckE >= 5\n\n## Generate Constraint-3:\nThe company has a budget constraint that limits the total number of trips that can be made across all warehouses to 5000 trips.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 5000",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize the total fuel consumption while meeting delivery demands. The fuel consumption of each truck varies with the number of trips it makes, as shown in the following Table.\n\n| Warehouse | Fuel Consumption Rate (liters per trip) |\n|-----------|----------------------------------------|\n| WarehouseA| 0.5 * (TruckA^2)                       |\n| WarehouseB| 0.6 * (TruckB^2)                       |\n| WarehouseC| 0.7 * (TruckC^2)                       |\n| WarehouseD| 0.8 * (TruckD^2)                       |\n| WarehouseE| 0.9 * (TruckE^2)                       |\n\nThe total number of trucks available across all warehouses is 100. Each warehouse must have at least 5 trucks to operate effectively. The company has a budget constraint that limits the total number of trips that can be made across all warehouses to 5000 trips.\n\nPlease help the company to minimize the total fuel consumption across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least 5 trucks to operate effectively.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5) # number of trucks for WarehouseA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=5) # number of trucks for WarehouseB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=5) # number of trucks for WarehouseC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=5) # number of trucks for WarehouseD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=5) # number of trucks for WarehouseE\n\n## Define the number of trips for each warehouse\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\") # trips for WarehouseA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\") # trips for WarehouseB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\") # trips for WarehouseC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\") # trips for WarehouseD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\") # trips for WarehouseE\n\n# Define objective function\n## The fuel consumption of each truck varies with the number of trips it makes.\nFuel_A = 0.5 * (TruckA**2) * TripsA\nFuel_B = 0.6 * (TruckB**2) * TripsB\nFuel_C = 0.7 * (TruckC**2) * TripsC\nFuel_D = 0.8 * (TruckD**2) * TripsD\nFuel_E = 0.9 * (TruckE**2) * TripsE\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The total number of trucks available across all warehouses is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## The company has a budget constraint that limits the total number of trips that can be made across all warehouses to 5000 trips.\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TruckE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $90, for product D is $60, and for product E is $80. The production cost per unit for each product is a nonlinear function of the number of units produced due to economies of scale. The cost function for each product is given by: CostA = 20 + 0.05 * (UnitsA^2), CostB = 30 + 0.03 * (UnitsB^2), CostC = 40 + 0.02 * (UnitsC^2), CostD = 25 + 0.04 * (UnitsD^2), CostE = 35 + 0.01 * (UnitsE^2). The company wants to maximize the total profit.\n// Total profit for product A: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * (UnitsA^2))) * UnitsA\n// Total profit for product B: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * (UnitsB^2))) * UnitsB\n// Total profit for product C: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * (UnitsC^2))) * UnitsC\n// Total profit for product D: ProfitD = (60 - CostD) * UnitsD = (60 - (25 + 0.04 * (UnitsD^2))) * UnitsD\n// Total profit for product E: ProfitE = (80 - CostE) * UnitsE = (80 - (35 + 0.01 * (UnitsE^2))) * UnitsE\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 100 units of product A and 50 units of product B to fulfill contractual obligations.\n// UnitsA >= 100\n// UnitsB >= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the total production cost to $50,000.\n// (20 + 0.05 * (UnitsA^2)) * UnitsA + (30 + 0.03 * (UnitsB^2)) * UnitsB + (40 + 0.02 * (UnitsC^2)) * UnitsC + (25 + 0.04 * (UnitsD^2)) * UnitsD + (35 + 0.01 * (UnitsE^2)) * UnitsE <= 50000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product C does not exceed 20% of the total production.\n// UnitsC <= 0.2 * (UnitsA + UnitsB + UnitsC + UnitsD + UnitsE)",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit for product A is $50, for product B is $70, for product C is $90, for product D is $60, and for product E is $80. The production cost per unit for each product is a nonlinear function of the number of units produced due to economies of scale. The cost function for each product is given by: CostA = 20 + 0.05 * (UnitsA^2), CostB = 30 + 0.03 * (UnitsB^2), CostC = 40 + 0.02 * (UnitsC^2), CostD = 25 + 0.04 * (UnitsD^2), CostE = 35 + 0.01 * (UnitsE^2). The company has a total production capacity of 1000 units. The company must produce at least 100 units of product A and 50 units of product B to fulfill contractual obligations. The company has a limited budget for raw materials, which restricts the total production cost to $50,000. The company wants to ensure that the production of product C does not exceed 20% of the total production. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of product D\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0) # number of units of product E\n\n# Define objective function\n## Total profit for product A: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * (UnitsA^2))) * UnitsA\n## Total profit for product B: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * (UnitsB^2))) * UnitsB\n## Total profit for product C: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * (UnitsC^2))) * UnitsC\n## Total profit for product D: ProfitD = (60 - CostD) * UnitsD = (60 - (25 + 0.04 * (UnitsD^2))) * UnitsD\n## Total profit for product E: ProfitE = (80 - CostE) * UnitsE = (80 - (35 + 0.01 * (UnitsE^2))) * UnitsE\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\nProfitA = (50 - (20 + 0.05 * UnitsA**2)) * UnitsA\nProfitB = (70 - (30 + 0.03 * UnitsB**2)) * UnitsB\nProfitC = (90 - (40 + 0.02 * UnitsC**2)) * UnitsC\nProfitD = (60 - (25 + 0.04 * UnitsD**2)) * UnitsD\nProfitE = (80 - (35 + 0.01 * UnitsE**2)) * UnitsE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\nmodel.addCons((20 + 0.05 * UnitsA**2) * UnitsA + (30 + 0.03 * UnitsB**2) * UnitsB + (40 + 0.02 * UnitsC**2) * UnitsC + (25 + 0.04 * UnitsD**2) * UnitsD + (35 + 0.01 * UnitsE**2) * UnitsE <= 50000)\nmodel.addCons(UnitsC <= 0.2 * (UnitsA + UnitsB + UnitsC + UnitsD + UnitsE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Units of Product D: \", model.getVal(UnitsD))\n    print(\"Number of Units of Product E: \", model.getVal(UnitsE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n// Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n// Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of all machines combined is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum daily production requirement of 200 units for component A.\n// A >= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E does not exceed 30% of the total production.\n// E <= 0.3 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe total cost of maintenance should not exceed $15,000 per day.\n// 10A + 15B + 20C + 25D + 30E <= 15000",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost. The total production capacity of all machines combined is 1000 units per day. The company has a minimum daily production requirement of 200 units for component A. The company wants to ensure that the production of component E does not exceed 30% of the total production. The total cost of maintenance should not exceed $15,000 per day. Please help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n# So, the objective function is: Maximize (Profit - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n# The total production capacity of all machines combined is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n# The company has a minimum daily production requirement of 200 units for component A.\nmodel.addCons(A >= 200)\n# The company wants to ensure that the production of component E does not exceed 30% of the total production.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n# The total cost of maintenance should not exceed $15,000 per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The company wants to minimize the total fuel consumption while ensuring timely deliveries. The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The objective is to minimize the total fuel consumption per delivery time.\n// Fuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\n// Delivery_Time = (1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5))\n// So, the objective function is: Minimize Fuel_Consumption / Delivery_Time\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000.\n// 20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe company has a contract that requires at least 15 deliveries per hour.\n// (50 * T1) + (55 * T2) + (60 * T3) + (65 * T4) + (70 * T5) >= 15",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy. Each type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000. The total number of trucks cannot exceed 50. The company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5. The company has a contract that requires at least 15 deliveries per hour.\n\nPlease help the company to minimize the total fuel consumption per delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\nDelivery_Time = 1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Time == Fuel_Consumption)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5.\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n## The company has a contract that requires at least 15 deliveries per hour.\nmodel.addCons((50 * T1) + (55 * T2) + (60 * T3) + (65 * T4) + (70 * T5) >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints.\n// {\"number of solar units\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar unit is $5000 with an annual maintenance cost of $500, and it generates 10 MWh of energy per year.\nThe cost of installing each wind unit is $8000 with an annual maintenance cost of $800, and it generates 15 MWh of energy per year.\nThe cost of installing each hydro unit is $10000 with an annual maintenance cost of $1000, and it generates 20 MWh of energy per year.\nThe cost of installing each geothermal unit is $12000 with an annual maintenance cost of $1200, and it generates 25 MWh of energy per year.\nThe cost of installing each biomass unit is $6000 with an annual maintenance cost of $600, and it generates 12 MWh of energy per year.\nThe company wants to minimize the total cost of installation and maintenance.\n// Total installation cost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n// Total annual maintenance cost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n// So, the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for installation.\n// 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000\n\n## Generate Constraint-2:\nThe company needs to generate at least 1000 MWh of energy per year.\n// 10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed.\n// Solar <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Wind <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Hydro <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Geothermal <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Biomass <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)",
        "question": "A company is planning to optimize its energy consumption by installing five different types of renewable energy systems: Solar, Wind, Hydro, Geothermal, and Biomass. The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints. The cost of installation, annual maintenance cost, and energy generation for each type of unit are given in the following Table.\n\n| Type          | Installation Cost | Annual Maintenance Cost | Energy Generation (MWh/year) |\n|---------------|-------------------|-------------------------|------------------------------|\n| Solar         | $5000             | $500                    | 10                           |\n| Wind          | $8000             | $800                    | 15                           |\n| Hydro         | $10000            | $1000                   | 20                           |\n| Geothermal    | $12000            | $1200                   | 25                           |\n| Biomass       | $6000             | $600                    | 12                           |\n\nThe company has a budget of $200,000 for installation. The company needs to generate at least 1000 MWh of energy per year. The company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed.\n\nPlease help the company to minimize the total cost of installation and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar units\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind units\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro units\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal units\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass units\n\n# Define objective function\n## Total installation cost and Total annual maintenance cost\nTotalInstallationCost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\nTotalAnnualMaintenanceCost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n## So, the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalInstallationCost + TotalAnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $200,000 for installation.\nmodel.addCons(5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000)\n## The company needs to generate at least 1000 MWh of energy per year.\nmodel.addCons(10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000)\n## The company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed.\nmodel.addCons(Solar <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Wind <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Hydro <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Geothermal <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Biomass <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(Solar))\n    print(\"Number of Wind Units: \", model.getVal(Wind))\n    print(\"Number of Hydro Units: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Units: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Units: \", model.getVal(Biomass))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1501,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: light, medium, and heavy, each with different fuel efficiencies and capacities.\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of light trucks (km/liter)\": \"LightFuelEfficiency\", \"range\": \"LightFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of heavy trucks (km/liter)\": \"HeavyFuelEfficiency\", \"range\": \"HeavyFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel cost, considering the distance traveled by each type of truck and the current fuel prices. The fuel price is $1.5 per liter.\n// FuelCost_Light = (Distance_Light / LightFuelEfficiency) * 1.5 * LightTrucks\n// FuelCost_Medium = (Distance_Medium / MediumFuelEfficiency) * 1.5 * MediumTrucks\n// FuelCost_Heavy = (Distance_Heavy / HeavyFuelEfficiency) * 1.5 * HeavyTrucks\n// So, the objective function is: Minimize (FuelCost_Light + FuelCost_Medium + FuelCost_Heavy)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 per day for fuel expenses.\n// FuelCost_Light + FuelCost_Medium + FuelCost_Heavy <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: light, medium, and heavy, each with different fuel efficiencies and capacities. The company aims to minimize the total daily fuel cost, considering the distance traveled by each type of truck and the current fuel prices, which is $1.5 per liter. The company has a total budget of $1000 per day for fuel expenses. Please help the company determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of heavy trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define fuel efficiencies and calculate fuel costs\nLightFuelEfficiency = 10  # example value, should be replaced with actual data\nMediumFuelEfficiency = 8  # example value, should be replaced with actual data\nHeavyFuelEfficiency = 6  # example value, should be replaced with actual data\n\nDistance_Light = 100  # example value, should be replaced with actual data\nDistance_Medium = 150  # example value, should be replaced with actual data\nDistance_Heavy = 200  # example value, should be replaced with actual data\n\nFuelCost_Light = (Distance_Light / LightFuelEfficiency) * 1.5 * LightTrucks\nFuelCost_Medium = (Distance_Medium / MediumFuelEfficiency) * 1.5 * MediumTrucks\nFuelCost_Heavy = (Distance_Heavy / HeavyFuelEfficiency) * 1.5 * HeavyTrucks\n\n## the objective function is: Minimize (FuelCost_Light + FuelCost_Medium + FuelCost_Heavy)\nmodel.addCons(obj == FuelCost_Light + FuelCost_Medium + FuelCost_Heavy)\n\n# Add constraints\n## The company has a total budget of $1000 per day for fuel expenses.\nmodel.addCons(FuelCost_Light + FuelCost_Medium + FuelCost_Heavy <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the revenue generated per trip to the fuel cost per trip. Trucks generate $500 per trip with a fuel cost of $50, Vans generate $300 per trip with a fuel cost of $30, and Bikes generate $100 per trip with a fuel cost of $10. The company aims to maximize the total efficiency, which is the sum of the efficiencies of all vehicles.\n// Efficiency_T = (500 - 50) / 50 * T\n// Efficiency_V = (300 - 30) / 30 * V\n// Efficiency_B = (100 - 10) / 10 * B\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per month.\n// 100 * T + 50 * V + 20 * B <= 10000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 100 vehicles in total.\n// T + V + B <= 100\n\n## Generate Constraint-3:\nThe number of Trucks must be at least twice the number of Vans.\n// T >= 2 * V\n\n## Generate Constraint-4:\nThe number of Bikes must not exceed the combined number of Trucks and Vans.\n// B <= T + V\n\n## Generate Constraint-5:\nThe company aims to ensure that the total number of trips does not exceed 500 per month.\n// 10 * T + 10 * V + 10 * B <= 500",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the ratio of the revenue generated per trip to the fuel cost per trip. Trucks generate $500 per trip with a fuel cost of $50, Vans generate $300 per trip with a fuel cost of $30, and Bikes generate $100 per trip with a fuel cost of $10. The company aims to maximize the total efficiency, which is the sum of the efficiencies of all vehicles. The company has a budget of $10,000 for vehicle maintenance per month. The company can only operate a maximum of 100 vehicles in total. The number of Trucks must be at least twice the number of Vans. The number of Bikes must not exceed the combined number of Trucks and Vans. The company aims to ensure that the total number of trips does not exceed 500 per month. Please help the company to determine the optimal number of Trucks (T), Vans (V), and Bikes (B) to maximize the total efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = (500 - 50) / 50 * T\nEfficiency_V = (300 - 30) / 30 * V\nEfficiency_B = (100 - 10) / 10 * B\n## the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B)\nmodel.addCons(obj == Efficiency_T + Efficiency_V + Efficiency_B)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance per month.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 10000)\n## The company can only operate a maximum of 100 vehicles in total.\nmodel.addCons(T + V + B <= 100)\n## The number of Trucks must be at least twice the number of Vans.\nmodel.addCons(T >= 2 * V)\n## The number of Bikes must not exceed the combined number of Trucks and Vans.\nmodel.addCons(B <= T + V)\n## The company aims to ensure that the total number of trips does not exceed 500 per month.\nmodel.addCons(10 * T + 10 * V + 10 * B <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region1\": \"Storage1\", \"range\": \"Storage1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region2\": \"Storage2\", \"range\": \"Storage2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region3\": \"Storage3\", \"range\": \"Storage3 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region4\": \"SolarPanels4\", \"range\": \"SolarPanels4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region4\": \"WindTurbines4\", \"range\": \"WindTurbines4 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region4\": \"Storage4\", \"range\": \"Storage4 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region5\": \"SolarPanels5\", \"range\": \"SolarPanels5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region5\": \"WindTurbines5\", \"range\": \"WindTurbines5 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region5\": \"Storage5\", \"range\": \"Storage5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Total energy output from Region1: Output1 = (SolarPanels1 * (100 + 0.1 * Storage1^2)) + (WindTurbines1 * (200 + 0.2 * Storage1^3))\n// Total energy output from Region2: Output2 = (SolarPanels2 * (100 + 0.1 * Storage2^2)) + (WindTurbines2 * (200 + 0.2 * Storage2^3))\n// Total energy output from Region3: Output3 = (SolarPanels3 * (100 + 0.1 * Storage3^2)) + (WindTurbines3 * (200 + 0.2 * Storage3^3))\n// Total energy output from Region4: Output4 = (SolarPanels4 * (100 + 0.1 * Storage4^2)) + (WindTurbines4 * (200 + 0.2 * Storage4^3))\n// Total energy output from Region5: Output5 = (SolarPanels5 * (100 + 0.1 * Storage5^2)) + (WindTurbines5 * (200 + 0.2 * Storage5^3))\n// So, the objective function is: Maximize (Output1 + Output2 + Output3 + Output4 + Output5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all installations and storage investments.\n// SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all regions must not exceed 10,000 units.\n// SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10,000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1.\n// WindTurbines1 >= 2 * SolarPanels1\n\n## Generate Constraint-4:\nThe company must ensure that each region has at least one solar panel and one wind turbine.\n// SolarPanels1 >= 1; WindTurbines1 >= 1; SolarPanels2 >= 1; WindTurbines2 >= 1; SolarPanels3 >= 1; WindTurbines3 >= 1; SolarPanels4 >= 1; WindTurbines4 >= 1; SolarPanels5 >= 1; WindTurbines5 >= 1",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste. The energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n\nThe company has a total budget of $1,000,000 for all installations and storage investments. The total number of solar panels and wind turbines across all regions must not exceed 10,000 units. Due to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1. The company must ensure that each region has at least one solar panel and one wind turbine.\n\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nStorage1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nStorage2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nStorage3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage3\", lb=0)\nSolarPanels4 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels4\", lb=0)\nWindTurbines4 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines4\", lb=0)\nStorage4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage4\", lb=0)\nSolarPanels5 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels5\", lb=0)\nWindTurbines5 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines5\", lb=0)\nStorage5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage5\", lb=0)\n\n# Define objective function\nOutput1 = SolarPanels1 * (100 + 0.1 * Storage1**2) + WindTurbines1 * (200 + 0.2 * Storage1**3)\nOutput2 = SolarPanels2 * (100 + 0.1 * Storage2**2) + WindTurbines2 * (200 + 0.2 * Storage2**3)\nOutput3 = SolarPanels3 * (100 + 0.1 * Storage3**2) + WindTurbines3 * (200 + 0.2 * Storage3**3)\nOutput4 = SolarPanels4 * (100 + 0.1 * Storage4**2) + WindTurbines4 * (200 + 0.2 * Storage4**3)\nOutput5 = SolarPanels5 * (100 + 0.1 * Storage5**2) + WindTurbines5 * (200 + 0.2 * Storage5**3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output1 + Output2 + Output3 + Output4 + Output5)\n\n# Add constraints\nmodel.addCons(SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1000000)\nmodel.addCons(SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10000)\nmodel.addCons(WindTurbines1 >= 2 * SolarPanels1)\nmodel.addCons(SolarPanels1 >= 1)\nmodel.addCons(WindTurbines1 >= 1)\nmodel.addCons(SolarPanels2 >= 1)\nmodel.addCons(WindTurbines2 >= 1)\nmodel.addCons(SolarPanels3 >= 1)\nmodel.addCons(WindTurbines3 >= 1)\nmodel.addCons(SolarPanels4 >= 1)\nmodel.addCons(WindTurbines4 >= 1)\nmodel.addCons(SolarPanels5 >= 1)\nmodel.addCons(WindTurbines5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Investment in Storage in Region1: \", model.getVal(Storage1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Investment in Storage in Region2: \", model.getVal(Storage2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in Storage in Region3: \", model.getVal(Storage3))\n    print(\"Number of Solar Panels in Region4: \", model.getVal(SolarPanels4))\n    print(\"Number of Wind Turbines in Region4: \", model.getVal(WindTurbines4))\n    print(\"Investment in Storage in Region4: \", model.getVal(Storage4))\n    print(\"Number of Solar Panels in Region5: \", model.getVal(SolarPanels5))\n    print(\"Number of Wind Turbines in Region5: \", model.getVal(WindTurbines5))\n    print(\"Investment in Storage in Region5: \", model.getVal(Storage5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and production cost. Device A has a profit margin of $50 per unit and a production cost of $20 per unit. Device B has a profit margin of $70 per unit and a production cost of $30 per unit. Device C has a profit margin of $90 per unit and a production cost of $40 per unit. Device D has a profit margin of $110 per unit and a production cost of $50 per unit. The company aims to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 10000",
        "question": "A manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. Each device has a different profit margin and production cost. Device A has a profit margin of $50 per unit and a production cost of $20 per unit. Device B has a profit margin of $70 per unit and a production cost of $30 per unit. Device C has a profit margin of $90 per unit and a production cost of $40 per unit. Device D has a profit margin of $110 per unit and a production cost of $50 per unit. The company aims to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs. The company has a budget of $10,000 for production costs. Please help the company determine the optimal production quantities for each device to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited.\n// {\"production quantity for Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"production quantity for Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product A\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product B\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"real\"}\n// {\"storage capacity for Product C\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit for Product A is $30, Product B is $40, and Product C is $20. The company aims to maximize the total profit from the production of all three products.\n// Profit_ProductA = ProductA * (50 - 30)\n// Profit_ProductB = ProductB * (70 - 40)\n// Profit_ProductC = ProductC * (60 - 20)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\n// ProductA <= StorageA\n// ProductB <= StorageB\n// ProductC <= StorageC\n\n## Generate Constraint-2:\nThe total production capacity for all products combined is 300 units.\n// ProductA + ProductB + ProductC <= 300\n\n## Generate Constraint-3:\nThe demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units.\n// ProductA >= 50\n// ProductB >= 70\n// ProductC >= 60\n\n## Generate Constraint-4:\nThe cost of production for all products combined should not exceed $10,000.\n// 30 * ProductA + 40 * ProductB + 20 * ProductC <= 10000\n\n## Generate Constraint-5:\nThe production of Product A and Product B should be at least twice the production of Product C.\n// ProductA + ProductB >= 2 * ProductC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production, storage, and demand constraints. The production quantity for each product is a continuous variable, and the storage capacity for each product is limited. The profit per unit, cost of production per unit, and storage capacity for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit | Storage Capacity |\n|---------|-----------------|-----------------------------|------------------|\n| A       | $50             | $30                         | 100 units        |\n| B       | $70             | $40                         | 150 units        |\n| C       | $60             | $20                         | 200 units        |\n\nThe company aims to maximize the total profit from the production of all three products. The total storage capacity for each product, the total production capacity for all products combined, and the demand for each product are as follows:\n- The total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\n- The total production capacity for all products combined is 300 units.\n- The demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units.\n- The cost of production for all products combined should not exceed $10,000.\n- The production of Product A and Product B should be at least twice the production of Product C.\n\nPlease help the company to determine the optimal production quantity for each product to maximize profit while satisfying all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # production quantity for Product A\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # production quantity for Product B\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # production quantity for Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 30)\nProfit_ProductB = ProductB * (70 - 40)\nProfit_ProductC = ProductC * (60 - 20)\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The total storage capacity for Product A is 100 units, for Product B is 150 units, and for Product C is 200 units.\nmodel.addCons(ProductA <= 100)\nmodel.addCons(ProductB <= 150)\nmodel.addCons(ProductC <= 200)\n\n# The total production capacity for all products combined is 300 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 300)\n\n# The demand for Product A is at least 50 units, for Product B is at least 70 units, and for Product C is at least 60 units.\nmodel.addCons(ProductA >= 50)\nmodel.addCons(ProductB >= 70)\nmodel.addCons(ProductC >= 60)\n\n# The cost of production for all products combined should not exceed $10,000.\nmodel.addCons(30 * ProductA + 40 * ProductB + 20 * ProductC <= 10000)\n\n# The production of Product A and Product B should be at least twice the production of Product C.\nmodel.addCons(ProductA + ProductB >= 2 * ProductC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1753,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, but it requires 2 units of a scarce resource R. The profit per unit of P2 is $150, requiring 3 units of resource R. The profit per unit of P3 is $200, requiring 4 units of resource R. The company aims to maximize the total profit.\n// Profit_P1 = 100 * P1 - 2 * P1^2 (due to diminishing returns)\n// Profit_P2 = 150 * P2 - 3 * P2^2 (due to diminishing returns)\n// Profit_P3 = 200 * P3 - 4 * P3^2 (due to diminishing returns)\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3)\n\n## Generate Constraint-1:\nThe company has a limited supply of resource R, with only 200 units available.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-3:\nThe market demand for P1 is 30 units. So, the company can only sell a maximum of 30 units of P1.\n// P1 <= 30\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which should not exceed $5000.\n// 50 * P1 + 75 * P2 + 100 * P3 <= 5000",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the required units of a scarce resource R for each product are given in the following Table.\n\n| Product | Profit per Unit | Units of Resource R Required |\n|---------|-----------------|------------------------------|\n| P1      | $100            | 2                            |\n| P2      | $150            | 3                            |\n| P3      | $200            | 4                            |\n\nThe company has a limited supply of resource R, with only 200 units available. The company has a production capacity constraint of 100 units in total. The market demand for P1 is 30 units, so the company can only sell a maximum of 30 units of P1. The company has a budget constraint for production costs, which should not exceed $5000. \n\nPlease help the company to maximize the total profit, considering the diminishing returns where the profit for each product is calculated as the profit per unit times the quantity minus a quadratic term proportional to the square of the quantity produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_P1 = 100 * P1 - 2 * P1^2 (due to diminishing returns)\n## Profit_P2 = 150 * P2 - 3 * P2^2 (due to diminishing returns)\n## Profit_P3 = 200 * P3 - 4 * P3^2 (due to diminishing returns)\n## So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3)\nmodel.addCons(obj == 100 * P1 - 2 * P1**2 + 150 * P2 - 3 * P2**2 + 200 * P3 - 4 * P3**2)\n\n# Add constraints\n## The company has a limited supply of resource R, with only 200 units available.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a production capacity constraint of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The market demand for P1 is 30 units. So, the company can only sell a maximum of 30 units of P1.\nmodel.addCons(P1 <= 30)\n## The company has a budget constraint for production costs, which should not exceed $5000.\nmodel.addCons(50 * P1 + 75 * P2 + 100 * P3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and vehicle capacities. The company also needs to decide on the daily fuel budget for each type of vehicle.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"daily fuel budget for Trucks\": \"TruckFuelBudget\", \"range\": \"TruckFuelBudget >= 0\", \"type\": \"continuous\"}\n// {\"daily fuel budget for Vans\": \"VanFuelBudget\", \"range\": \"VanFuelBudget >= 0\", \"type\": \"continuous\"}\n// {\"daily fuel budget for Bikes\": \"BikeFuelBudget\", \"range\": \"BikeFuelBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each Truck is $1000 per day, but it decreases by $5 for every $100 spent on fuel.\nThe revenue from each Van is $500 per day, but it decreases by $3 for every $100 spent on fuel.\nThe revenue from each Bike is $100 per day, but it decreases by $1 for every $100 spent on fuel.\nThe company aims to maximize the total daily revenue from all vehicles.\n// Total revenue from Trucks: RevenueTruck = 1000 * TruckCount - 0.05 * TruckFuelBudget * TruckCount\n// Total revenue from Vans: RevenueVan = 500 * VanCount - 0.03 * VanFuelBudget * VanCount\n// Total revenue from Bikes: RevenueBike = 100 * BikeCount - 0.01 * BikeFuelBudget * BikeCount\n// So, the objective function is: Maximize (RevenueTruck + RevenueVan + RevenueBike)\n\n## Generate Constraint-1:\nThe total daily fuel budget for all vehicles is limited to $10,000.\n// TruckFuelBudget + VanFuelBudget + BikeFuelBudget <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 vehicles available.\n// TruckCount + VanCount + BikeCount <= 50\n\n## Generate Constraint-3:\nDue to maintenance and operational constraints, the number of Trucks cannot exceed 20, and the number of Vans cannot exceed 30.\n// TruckCount <= 20; VanCount <= 30",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and vehicle capacities. The company also needs to decide on the daily fuel budget for each type of vehicle.\nThe revenue from each Truck is $1000 per day, but it decreases by $5 for every $100 spent on fuel.\nThe revenue from each Van is $500 per day, but it decreases by $3 for every $100 spent on fuel.\nThe revenue from each Bike is $100 per day, but it decreases by $1 for every $100 spent on fuel.\nThe company aims to maximize the total daily revenue from all vehicles.\nThe total daily fuel budget for all vehicles is limited to $10,000. The company has a total of 50 vehicles available. Due to maintenance and operational constraints, the number of Trucks cannot exceed 20, and the number of Vans cannot exceed 30.\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes, and their respective daily fuel budgets to maximize the total daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nTruckFuelBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckFuelBudget\", lb=0)\nVanFuelBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"VanFuelBudget\", lb=0)\nBikeFuelBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeFuelBudget\", lb=0)\n\n# Define objective function\nRevenueTruck = 1000 * TruckCount - 0.05 * TruckFuelBudget * TruckCount\nRevenueVan = 500 * VanCount - 0.03 * VanFuelBudget * VanCount\nRevenueBike = 100 * BikeCount - 0.01 * BikeFuelBudget * BikeCount\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueTruck + RevenueVan + RevenueBike)\n\n# Add constraints\nmodel.addCons(TruckFuelBudget + VanFuelBudget + BikeFuelBudget <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 50)\nmodel.addCons(TruckCount <= 20)\nmodel.addCons(VanCount <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Truck Fuel Budget: \", model.getVal(TruckFuelBudget))\n    print(\"Van Fuel Budget: \", model.getVal(VanFuelBudget))\n    print(\"Bike Fuel Budget: \", model.getVal(BikeFuelBudget))\n    print(\"Maximized Total Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company aims to maximize the total profit, considering both the selling profit and the storage costs over a week.\n// Selling profit of A: Profit_A = (50 - 20) * A - A\n// Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n// Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n// Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 5000",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company has a budget of $5000 for production costs.\nPlease help the company to maximize the total profit, considering both the selling profit and the storage costs over a week.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\n## Selling profit of A: Profit_A = (50 - 20) * A - A\n## Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n## Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n## Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\nProfit_A = (50 - 20 - 1) * A\nProfit_B = (70 - 30 - 2) * B\nProfit_C = (90 - 40 - 3) * C\nProfit_D = (110 - 50 - 4) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. They need to determine the production quantity for each device to optimize their profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceA_Qty\", \"range\": \"DeviceA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Qty\", \"range\": \"DeviceB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Qty\", \"range\": \"DeviceC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Qty\", \"range\": \"DeviceD_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $100, and for DeviceD is $120. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by: Cost_A = 20 * sqrt(DeviceA_Qty), Cost_B = 30 * sqrt(DeviceB_Qty), Cost_C = 40 * sqrt(DeviceC_Qty), Cost_D = 50 * sqrt(DeviceD_Qty). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 - 20 * sqrt(DeviceA_Qty)) * DeviceA_Qty\n// Total net profit for DeviceB: Profit_B = (70 - 30 * sqrt(DeviceB_Qty)) * DeviceB_Qty\n// Total net profit for DeviceC: Profit_C = (100 - 40 * sqrt(DeviceC_Qty)) * DeviceC_Qty\n// Total net profit for DeviceD: Profit_D = (120 - 50 * sqrt(DeviceD_Qty)) * DeviceD_Qty\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// DeviceA_Qty + DeviceB_Qty + DeviceC_Qty + DeviceD_Qty <= 10,000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceA_Qty <= 2 * DeviceB_Qty\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $500,000 per month. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, for DeviceC is $20 per unit, and for DeviceD is $25 per unit.\n// 10 * DeviceA_Qty + 15 * DeviceB_Qty + 20 * DeviceC_Qty + 25 * DeviceD_Qty <= 500,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. They need to determine the production quantity for each device to optimize their profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $100, and for DeviceD is $120. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by: Cost_A = 20 * sqrt(DeviceA_Qty), Cost_B = 30 * sqrt(DeviceB_Qty), Cost_C = 40 * sqrt(DeviceC_Qty), Cost_D = 50 * sqrt(DeviceD_Qty). The company has a total production capacity of 10,000 units per month. Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB. The company has a limited budget for raw materials, which is $500,000 per month. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, for DeviceC is $20 per unit, and for DeviceD is $25 per unit.\n\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Qty\", lb=0)\nDeviceB_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Qty\", lb=0)\nDeviceC_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Qty\", lb=0)\nDeviceD_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit for DeviceA: Profit_A = (50 - 20 * sqrt(DeviceA_Qty)) * DeviceA_Qty\n## Total net profit for DeviceB: Profit_B = (70 - 30 * sqrt(DeviceB_Qty)) * DeviceB_Qty\n## Total net profit for DeviceC: Profit_C = (100 - 40 * sqrt(DeviceC_Qty)) * DeviceC_Qty\n## Total net profit for DeviceD: Profit_D = (120 - 50 * sqrt(DeviceD_Qty)) * DeviceD_Qty\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## Convert square root to a variable to handle non-linearity\nsqrt_DeviceA_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceA_Qty\")\nsqrt_DeviceB_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceB_Qty\")\nsqrt_DeviceC_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceC_Qty\")\nsqrt_DeviceD_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceD_Qty\")\nmodel.addCons(sqrt_DeviceA_Qty**2 == DeviceA_Qty)\nmodel.addCons(sqrt_DeviceB_Qty**2 == DeviceB_Qty)\nmodel.addCons(sqrt_DeviceC_Qty**2 == DeviceC_Qty)\nmodel.addCons(sqrt_DeviceD_Qty**2 == DeviceD_Qty)\nProfit_A = (50 - 20 * sqrt_DeviceA_Qty) * DeviceA_Qty\nProfit_B = (70 - 30 * sqrt_DeviceB_Qty) * DeviceB_Qty\nProfit_C = (100 - 40 * sqrt_DeviceC_Qty) * DeviceC_Qty\nProfit_D = (120 - 50 * sqrt_DeviceD_Qty) * DeviceD_Qty\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units per month.\nmodel.addCons(DeviceA_Qty + DeviceB_Qty + DeviceC_Qty + DeviceD_Qty <= 10000)\n## Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\nmodel.addCons(DeviceA_Qty <= 2 * DeviceB_Qty)\n## The company has a limited budget for raw materials, which is $500,000 per month.\nmodel.addCons(10 * DeviceA_Qty + 15 * DeviceB_Qty + 20 * DeviceC_Qty + 25 * DeviceD_Qty <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceA_Qty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceB_Qty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceC_Qty))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceD_Qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to deploy for the next quarter to optimize fuel efficiency and delivery capacity. Additionally, the company is considering investing in advanced navigation systems for each type of vehicle to further enhance efficiency.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in navigation system for TruckA\": \"NavSystemA\", \"range\": \"NavSystemA >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckB\": \"NavSystemB\", \"range\": \"NavSystemB >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckC\": \"NavSystemC\", \"range\": \"NavSystemC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in advanced navigation systems. For every $1000 invested in the navigation system for TruckA, its fuel efficiency increases by 1.5 liters per 100 kilometers. Similarly, for TruckB, an investment of $1000 increases its fuel efficiency by 2 liters per 100 kilometers, and for TruckC, it increases by 1 liter per 100 kilometers. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (100 / (15 + 0.015 * NavSystemA)) * TruckA\n// Fuel consumption for TruckB: ConsumptionB = (100 / (20 + 0.02 * NavSystemB)) * TruckB\n// Fuel consumption for TruckC: ConsumptionC = (100 / (10 + 0.01 * NavSystemC)) * TruckC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle deployment and navigation system investments.\n// TruckA + TruckB + TruckC + NavSystemA + NavSystemB + NavSystemC <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles that can be deployed is limited to 500.\n// TruckA + TruckB + TruckC <= 500",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to deploy for the next quarter to optimize fuel efficiency and delivery capacity. Additionally, the company is considering investing in advanced navigation systems for each type of vehicle to further enhance efficiency. The fuel efficiency of each vehicle type improves with the investment in advanced navigation systems, as shown in the following Table.\n\n| Vehicle Type | Initial Fuel Efficiency | Improvement per $1000 Investment |\n|--------------|-------------------------|----------------------------------|\n| TruckA       | 15 liters/100km        | 1.5 liters/100km                |\n| TruckB       | 20 liters/100km        | 2 liters/100km                  |\n| TruckC       | 10 liters/100km        | 1 liter/100km                   |\n\nThe company has a budget of $100,000 for vehicle deployment and navigation system investments. The total number of vehicles that can be deployed is limited to 500. The company aims to minimize the total fuel consumption across all vehicles. Please help the company determine the optimal number of each type of vehicle and the investment in navigation systems to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nNavSystemA = model.addVar(vtype=\"CONTINUOUS\", name=\"NavSystemA\", lb=0) # investment in navigation system for TruckA\nNavSystemB = model.addVar(vtype=\"CONTINUOUS\", name=\"NavSystemB\", lb=0) # investment in navigation system for TruckB\nNavSystemC = model.addVar(vtype=\"CONTINUOUS\", name=\"NavSystemC\", lb=0) # investment in navigation system for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel consumption for TruckA: ConsumptionA = (100 / (15 + 0.015 * NavSystemA)) * TruckA\n## Fuel consumption for TruckB: ConsumptionB = (100 / (20 + 0.02 * NavSystemB)) * TruckB\n## Fuel consumption for TruckC: ConsumptionC = (100 / (10 + 0.01 * NavSystemC)) * TruckC\n## So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\nConsumptionA = (100 / (15 + 0.015 * NavSystemA)) * TruckA\nConsumptionB = (100 / (20 + 0.02 * NavSystemB)) * TruckB\nConsumptionC = (100 / (10 + 0.01 * NavSystemC)) * TruckC\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle deployment and navigation system investments.\nmodel.addCons(TruckA + TruckB + TruckC + NavSystemA + NavSystemB + NavSystemC <= 100000)\n## The total number of vehicles that can be deployed is limited to 500.\nmodel.addCons(TruckA + TruckB + TruckC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Navigation System for TruckA: \", model.getVal(NavSystemA))\n    print(\"Investment in Navigation System for TruckB: \", model.getVal(NavSystemB))\n    print(\"Investment in Navigation System for TruckC: \", model.getVal(NavSystemC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region (North, South, East, West) and the fuel efficiency of each truck type. The fuel efficiency affects the operational cost, and the company wants to minimize this cost while meeting the demand for transportation in each region.\n// {\"number of trucks for North\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for North\": \"NorthFuelEfficiency\", \"range\": \"NorthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for South\": \"SouthFuelEfficiency\", \"range\": \"SouthFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for East\": \"EastFuelEfficiency\", \"range\": \"EastFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for West\": \"WestFuelEfficiency\", \"range\": \"WestFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational cost of each truck is directly related to its fuel efficiency. The less fuel efficient a truck is, the higher the operational cost. The company wants to minimize the total operational cost across all regions.\n// OperationalCost_North = NorthTrucks / NorthFuelEfficiency\n// OperationalCost_South = SouthTrucks / SouthFuelEfficiency\n// OperationalCost_East = EastTrucks / EastFuelEfficiency\n// OperationalCost_West = WestTrucks / WestFuelEfficiency\n// So, the objective function is: Minimize (OperationalCost_North + OperationalCost_South + OperationalCost_East + OperationalCost_West)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// NorthTrucks * 20000 + SouthTrucks * 25000 + EastTrucks * 30000 + WestTrucks * 35000 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50\n\n## Generate Constraint-3:\nThe company must meet a minimum transportation demand of 1000 tons per day.\n// NorthTrucks * 50 + SouthTrucks * 40 + EastTrucks * 30 + WestTrucks * 20 >= 1000\n\n## Generate Constraint-4:\nThe fuel efficiency of trucks in each region must be at least 5 km/liter.\n// NorthFuelEfficiency >= 5\n// SouthFuelEfficiency >= 5\n// EastFuelEfficiency >= 5\n// WestFuelEfficiency >= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions (North, South, East, West). The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The fuel efficiency affects the operational cost, and the company wants to minimize this cost while meeting the demand for transportation in each region.\n\n| Region | Number of Trucks | Fuel Efficiency |\n|--------|------------------|-----------------|\n| North  | NorthTrucks     | NorthFuelEfficiency |\n| South  | SouthTrucks     | SouthFuelEfficiency |\n| East   | EastTrucks      | EastFuelEfficiency |\n| West   | WestTrucks      | WestFuelEfficiency |\n\nThe company has a total budget of $100,000 for purchasing trucks. The total number of trucks cannot exceed 50. The company must meet a minimum transportation demand of 1000 tons per day. The fuel efficiency of trucks in each region must be at least 5 km/liter.\n\nPlease help the company to minimize the total operational cost across all regions, which is calculated as the number of trucks divided by the fuel efficiency for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)  # number of trucks for North\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)  # number of trucks for South\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)  # number of trucks for East\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)  # number of trucks for West\nNorthFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"NorthFuelEfficiency\", lb=5)  # fuel efficiency of trucks for North\nSouthFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SouthFuelEfficiency\", lb=5)  # fuel efficiency of trucks for South\nEastFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EastFuelEfficiency\", lb=5)  # fuel efficiency of trucks for East\nWestFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"WestFuelEfficiency\", lb=5)  # fuel efficiency of trucks for West\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost_North = NorthTrucks / NorthFuelEfficiency\nOperationalCost_South = SouthTrucks / SouthFuelEfficiency\nOperationalCost_East = EastTrucks / EastFuelEfficiency\nOperationalCost_West = WestTrucks / WestFuelEfficiency\n## convert the division to multiplication\nmodel.addCons(obj == OperationalCost_North + OperationalCost_South + OperationalCost_East + OperationalCost_West)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(NorthTrucks * 20000 + SouthTrucks * 25000 + EastTrucks * 30000 + WestTrucks * 35000 <= 100000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50)\n## The company must meet a minimum transportation demand of 1000 tons per day.\nmodel.addCons(NorthTrucks * 50 + SouthTrucks * 40 + EastTrucks * 30 + WestTrucks * 20 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West: \", model.getVal(WestTrucks))\n    print(\"Fuel Efficiency for North: \", model.getVal(NorthFuelEfficiency))\n    print(\"Fuel Efficiency for South: \", model.getVal(SouthFuelEfficiency))\n    print(\"Fuel Efficiency for East: \", model.getVal(EastFuelEfficiency))\n    print(\"Fuel Efficiency for West: \", model.getVal(WestFuelEfficiency))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption.\n// {\"number of Compact vehicles\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan vehicles\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of SUV vehicles\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Truck vehicles\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type varies. Compact vehicles consume 10 liters per 100 km, Sedans consume 12 liters per 100 km, SUVs consume 15 liters per 100 km, Vans consume 20 liters per 100 km, and Trucks consume 25 liters per 100 km. The company aims to minimize the total fuel consumption while ensuring all transportation needs are met. The total distance traveled by all vehicles is expected to be 5000 km.\n// Fuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n// The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\n// Minimize 500 * C + 600 * S + 750 * SUV + 1000 * V + 1250 * T\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 to purchase vehicles. Compact vehicles cost $10,000 each, Sedans cost $15,000 each, SUVs cost $20,000 each, Vans cost $25,000 each, and Trucks cost $30,000 each.\n// 10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000",
        "question": "A logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption. The fuel efficiency of each vehicle type and their respective costs are given in the following Table.\n\n| Vehicle Type | Fuel Consumption (liters/100 km) | Cost (USD) |\n|--------------|----------------------------------|------------|\n| Compact      | 10                               | 10,000     |\n| Sedan        | 12                               | 15,000     |\n| SUV          | 15                               | 20,000     |\n| Van          | 20                               | 25,000     |\n| Truck        | 25                               | 30,000     |\n\nThe company has a total budget of $50,000 to purchase vehicles. The total distance traveled by all vehicles is expected to be 5000 km. Please help the company to minimize the total fuel consumption while ensuring all transportation needs are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Compact vehicles\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sedan vehicles\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # number of SUV vehicles\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Van vehicles\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Truck vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n## The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\nmodel.addCons(obj == 50 * Fuel_Consumption)\n\n# Add constraints\n## The company has a total budget of $50,000 to purchase vehicles.\nmodel.addCons(10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Compact vehicles: \", model.getVal(C))\n    print(\"Number of Sedan vehicles: \", model.getVal(S))\n    print(\"Number of SUV vehicles: \", model.getVal(SUV))\n    print(\"Number of Van vehicles: \", model.getVal(V))\n    print(\"Number of Truck vehicles: \", model.getVal(T))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has an operational cost of $100 per day and can carry 10 tons of cargo. Each Medium truck costs $150 per day and carries 20 tons. Each Large truck costs $200 per day and carries 30 tons. Each Extra-Large truck costs $250 per day and carries 40 tons. Each Refrigerated truck costs $300 per day and carries 25 tons. The company needs to transport at least 500 tons of cargo daily. The objective is to minimize the total daily operational cost while meeting the cargo requirement.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\n// Total capacity = 10 * S + 20 * M + 30 * L + 40 * XL + 25 * R\n// The objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * R) subject to the constraint that Total capacity >= 500\n\n## Generate Constraint-1:\nThe company has a budget constraint of $5000 per day for all truck operations.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs. The operational cost and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Operational Cost per Day | Cargo Capacity |\n|------------------|--------------------------|----------------|\n| Small            | $100                     | 10 tons        |\n| Medium           | $150                     | 20 tons        |\n| Large            | $200                     | 30 tons        |\n| Extra-Large      | $250                     | 40 tons        |\n| Refrigerated     | $300                     | 25 tons        |\n\nThe company needs to transport at least 500 tons of cargo daily. The company has a budget constraint of $5000 per day for all truck operations. Please help the company to minimize the total daily operational cost while meeting the cargo requirement.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R)\n\n# Add constraints\n## Total capacity = 10 * S + 20 * M + 30 * L + 40 * XL + 25 * R\n## The company needs to transport at least 500 tons of cargo daily.\nmodel.addCons(10 * S + 20 * M + 30 * L + 40 * XL + 25 * R >= 500)\n## The company has a budget constraint of $5000 per day for all truck operations.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost. The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\n// Profit_Route1 = Revenue_Route1 - FuelCost_Route1 = 1000 * T1 - 0.1 * T1^2\n// Profit_Route2 = Revenue_Route2 - FuelCost_Route2 = 1200 * T2 - 0.12 * T2^2\n// Profit_Route3 = Revenue_Route3 - FuelCost_Route3 = 1500 * T3 - 0.15 * T3^2\n// Profit_Route4 = Revenue_Route4 - FuelCost_Route4 = 1300 * T4 - 0.13 * T4^2\n// Profit_Route5 = Revenue_Route5 - FuelCost_Route5 = 1100 * T5 - 0.11 * T5^2\n// The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost, where the fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing. The company has a total of 100 trucks available for allocation.\n\nPlease help the company to maximize its total profit, considering the following profit calculations for each route:\n- Profit for Route 1: 1000 * T1 - 0.1 * T1^2\n- Profit for Route 2: 1200 * T2 - 0.12 * T2^2\n- Profit for Route 3: 1500 * T3 - 0.15 * T3^2\n- Profit for Route 4: 1300 * T4 - 0.13 * T4^2\n- Profit for Route 5: 1100 * T5 - 0.11 * T5^2",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## The profit per route is calculated as the revenue from deliveries minus the fuel cost.\nProfit_Route1 = 1000 * T1 - 0.1 * T1**2\nProfit_Route2 = 1200 * T2 - 0.12 * T2**2\nProfit_Route3 = 1500 * T3 - 0.15 * T3**2\nProfit_Route4 = 1300 * T4 - 0.13 * T4**2\nProfit_Route5 = 1100 * T5 - 0.11 * T5**2\n## The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate. The production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products. The total production capacity of the company is 10,000 units. The total investment in automation cannot exceed $50,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation level for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for perishable goods\": \"PerishableSpeed\", \"range\": \"PerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for non-perishable goods\": \"NonPerishableSpeed\", \"range\": \"NonPerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for hazardous materials\": \"HazardousSpeed\", \"range\": \"HazardousSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// FuelConsumption_Perishable = PerishableTrucks * (PerishableSpeed^2)\n// FuelConsumption_NonPerishable = NonPerishableTrucks * (NonPerishableSpeed^2)\n// FuelConsumption_Hazardous = HazardousTrucks * (HazardousSpeed^2)\n// TimeSpent_Perishable = TotalDistance / PerishableSpeed\n// TimeSpent_NonPerishable = TotalDistance / NonPerishableSpeed\n// TimeSpent_Hazardous = TotalDistance / HazardousSpeed\n// So, the objective function is: Minimize (FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks.\n// Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100\n\n## Generate Constraint-3:\nThe average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations.\n// HazardousSpeed >= 60\n\n## Generate Constraint-4:\nThe average speed of trucks carrying perishable goods must not exceed 80 km/h to ensure the freshness of the goods.\n// PerishableSpeed <= 80\n\n## Generate Constraint-5:\nThe company must have at least 20 trucks dedicated to non-perishable goods to meet the demand.\n// NonPerishableTrucks >= 20",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company has a budget of $500,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations. The average speed of trucks carrying perishable goods must not exceed 80 km/h to ensure the freshness of the goods. The company must have at least 20 trucks dedicated to non-perishable goods to meet the demand. Please help the company to minimize the total fuel consumption and time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0)  # number of trucks for non-perishable goods\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)  # number of trucks for hazardous materials\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=0)  # average speed of trucks for perishable goods\nNonPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"NonPerishableSpeed\", lb=0)  # average speed of trucks for non-perishable goods\nHazardousSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousSpeed\", lb=0)  # average speed of trucks for hazardous materials\n\n# Define objective function\nFuelConsumption_Perishable = PerishableTrucks * PerishableSpeed**2\nFuelConsumption_NonPerishable = NonPerishableTrucks * NonPerishableSpeed**2\nFuelConsumption_Hazardous = HazardousTrucks * HazardousSpeed**2\nTimeSpent_Perishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Perishable\", lb=0)  # Time spent on the road for perishable goods\nTimeSpent_NonPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_NonPerishable\", lb=0)  # Time spent on the road for non-perishable goods\nTimeSpent_Hazardous = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Hazardous\", lb=0)  # Time spent on the road for hazardous materials\nmodel.addCons(TimeSpent_Perishable == 1 / PerishableSpeed)\nmodel.addCons(TimeSpent_NonPerishable == 1 / NonPerishableSpeed)\nmodel.addCons(TimeSpent_Hazardous == 1 / HazardousSpeed)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n# Add constraints\nCost_PerishableTrucks = 50000  # Example cost per truck\nCost_NonPerishableTrucks = 40000  # Example cost per truck\nCost_HazardousTrucks = 60000  # Example cost per truck\nmodel.addCons(Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000)\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100)\nmodel.addCons(HazardousSpeed >= 60)\nmodel.addCons(PerishableSpeed <= 80)\nmodel.addCons(NonPerishableTrucks >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Perishable Speed: \", model.getVal(PerishableSpeed))\n    print(\"Non-Perishable Speed: \", model.getVal(NonPerishableSpeed))\n    print(\"Hazardous Speed: \", model.getVal(HazardousSpeed))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products. The total production capacity of the company is 5000 units. The total marketing budget is $50,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0)  # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability.\n// {\"number of Small wind farms\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"investment in Small wind farms\": \"Investment_Small\", \"range\": \"Investment_Small >= 0\", \"type\": \"continuous\"}\n// {\"investment in Medium wind farms\": \"Investment_Medium\", \"range\": \"Investment_Medium >= 0\", \"type\": \"continuous\"}\n// {\"investment in Large wind farms\": \"Investment_Large\", \"range\": \"Investment_Large >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n// Energy_Small = 10 * Small + 0.001 * Investment_Small * Small\n// Energy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\n// Energy_Large = 30 * Large + 0.002 * Investment_Large * Large\n// So, the objective function is: Maximize (Energy_Small + Energy_Medium + Energy_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for construction and investment in wind farms.\n// 10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000\n\n## Generate Constraint-2:\nThe total number of wind farms cannot exceed 100 due to land availability and zoning restrictions.\n// Small + Medium + Large <= 100",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability. The energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n\n| Wind Farm Type | Base Energy Output (MWh) | Additional Energy Output per $1000 Investment (MWh) |\n|----------------|--------------------------|----------------------------------------------------|\n| Small          | 10                       | 0.001                                              |\n| Medium         | 20                       | 0.0015                                             |\n| Large          | 30                       | 0.002                                              |\n\nThe company has a total budget of $1,000,000 for construction and investment in wind farms. The total number of wind farms cannot exceed 100 due to land availability and zoning restrictions.\n\nPlease help the company to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of Small wind farms\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of Medium wind farms\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of Large wind farms\nInvestment_Small = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Small\", lb=0)  # investment in Small wind farms\nInvestment_Medium = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Medium\", lb=0)  # investment in Medium wind farms\nInvestment_Large = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Large\", lb=0)  # investment in Large wind farms\n\n# Define objective function\nEnergy_Small = 10 * Small + 0.001 * Investment_Small * Small\nEnergy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\nEnergy_Large = 30 * Large + 0.002 * Investment_Large * Large\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Small + Energy_Medium + Energy_Large)\n\n# Add constraints\nmodel.addCons(10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000)\nmodel.addCons(Small + Medium + Large <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(Small))\n    print(\"Number of Medium Wind Farms: \", model.getVal(Medium))\n    print(\"Number of Large Wind Farms: \", model.getVal(Large))\n    print(\"Investment in Small Wind Farms: \", model.getVal(Investment_Small))\n    print(\"Investment in Medium Wind Farms: \", model.getVal(Investment_Medium))\n    print(\"Investment in Large Wind Farms: \", model.getVal(Investment_Large))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1482,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue, cost of raw materials, and cost of labor for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost of Raw Materials per Unit | Cost of Labor per Unit |\n|---------|------------------|--------------------------------|------------------------|\n| A       | $50              | $10                            | $5                     |\n| B       | $70              | $15                            | $10                    |\n| C       | $60              | $20                            | $15                    |\n\nThe company has a budget of $10,000 for raw materials. The company wants to maximize the total profit, which is calculated as the revenue per unit minus the cost of raw materials per unit and the cost of labor per unit for each product. Please help the company determine the optimal production quantity for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\n// Profit_ProductA = ProductAQty * 50 - WorkersA * 100\n// Profit_ProductB = ProductBQty * 70 - WorkersB * 100\n// Profit_ProductC = ProductCQty * 60 - WorkersC * 100\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120\n\n## Generate Constraint-3:\nDue to the complexity of ProductC, each unit requires at least 2 workers.\n// WorkersC >= 2 * ProductCQty",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit and the labor cost per worker are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $100                  |\n| ProductB | $70             | $100                  |\n| ProductC | $60             | $100                  |\n\nThe company has a total of 50 workers available. The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day. Due to the complexity of ProductC, each unit requires at least 2 workers. \n\nPlease help the company to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - WorkersA * 100\nProfit_ProductB = ProductBQty * 70 - WorkersB * 100\nProfit_ProductC = ProductCQty * 60 - WorkersC * 100\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n# The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n# Due to the complexity of ProductC, each unit requires at least 2 workers.\nmodel.addCons(WorkersC >= 2 * ProductCQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. \n- Truck A consumes 5 liters per km and carries 10 tons.\n- Truck B consumes 7 liters per km and carries 15 tons.\n- Truck C consumes 9 liters per km and carries 20 tons.\n- Truck D consumes 11 liters per km and carries 25 tons.\n- Truck E consumes 13 liters per km and carries 30 tons.\nThe company aims to maximize the total cargo carried per liter of fuel consumed.\n// Fuel efficiency of A: FE_A = 10 / 5 = 2 tons/liter\n// Fuel efficiency of B: FE_B = 15 / 7 = 2.14 tons/liter\n// Fuel efficiency of C: FE_C = 20 / 9 = 2.22 tons/liter\n// Fuel efficiency of D: FE_D = 25 / 11 = 2.27 tons/liter\n// Fuel efficiency of E: FE_E = 30 / 13 = 2.31 tons/liter\n// Objective function: Maximize (FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel for the month. The cost of fuel is $1 per liter.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 100,000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 500 tons of cargo are delivered.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500\n\n## Generate Constraint-4:\nThe number of Truck E cannot exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel efficiency and cargo capacity for each truck type are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Cargo Capacity (tons) |\n|------------|------------------------------|-----------------------|\n| A          | 5                            | 10                    |\n| B          | 7                            | 15                    |\n| C          | 9                            | 20                    |\n| D          | 11                           | 25                    |\n| E          | 13                           | 30                    |\n\nThe company has a budget of $100,000 for fuel for the month. The cost of fuel is $1 per liter. The company has a total of 100 trucks available. The company needs to ensure that at least 500 tons of cargo are delivered. The number of Truck E cannot exceed the combined number of Trucks A, B, and C. \nPlease help the company to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks E\n\n# Define objective function\nFE_A = 2  # Fuel efficiency of A\nFE_B = 2.14  # Fuel efficiency of B\nFE_C = 2.22  # Fuel efficiency of C\nFE_D = 2.27  # Fuel efficiency of D\nFE_E = 2.31  # Fuel efficiency of E\n\n# Objective function: Maximize (FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == FE_A * A + FE_B * B + FE_C * C + FE_D * D + FE_E * E)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel for the month. The cost of fuel is $1 per liter.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 100000)\n# The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n# The company needs to ensure that at least 500 tons of cargo are delivered.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500)\n# The number of Truck E cannot exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\n// Total fuel cost for Small trucks: Cost_Small = 0.8 * (1000 / 10) * SmallTrucks\n// Total fuel cost for Medium trucks: Cost_Medium = 0.7 * (1000 / 8) * MediumTrucks\n// Total fuel cost for Large trucks: Cost_Large = 0.6 * (1000 / 6) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: Cost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\n// Total fuel cost for Hybrid trucks: Cost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the day.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, at least 10% of the fleet must be Hybrid trucks.\n// HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks)\n\n## Generate Constraint-3:\nThe company has a daily budget of $3000 for fuel costs.\n// (0.8 * (1000 / 10) * SmallTrucks) + (0.7 * (1000 / 8) * MediumTrucks) + (0.6 * (1000 / 6) * LargeTrucks) + (0.5 * (1000 / 5) * ExtraLargeTrucks) + (1.0 * (1000 / 12) * HybridTrucks) <= 3000\n\n## Generate Constraint-4:\nEach type of truck must have at least one truck deployed.\n// SmallTrucks >= 1; MediumTrucks >= 1; LargeTrucks >= 1; ExtraLargeTrucks >= 1; HybridTrucks >= 1",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day. The fuel efficiency and cost per kilometer for each type of truck are given in the following Table.\n\n| Truck Type       | Fuel Efficiency (km/l) | Cost per km ($) |\n|------------------|-----------------------|-----------------|\n| Small            | 10                    | 0.8             |\n| Medium           | 8                     | 0.7             |\n| Large            | 6                     | 0.6             |\n| Extra-Large      | 5                     | 0.5             |\n| Hybrid           | 12                    | 1.0             |\n\nThe company has a total of 50 trucks available for the day. Due to maintenance schedules, at least 10% of the fleet must be Hybrid trucks. The company has a daily budget of $3000 for fuel costs. Each type of truck must have at least one truck deployed. \n\nPlease help the company to minimize the total daily fuel cost while considering the efficiency of each truck type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\n\n# Define objective function\nCost_Small = 0.8 * (1000 / 10) * SmallTrucks\nCost_Medium = 0.7 * (1000 / 8) * MediumTrucks\nCost_Large = 0.6 * (1000 / 6) * LargeTrucks\nCost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\nCost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50)\nmodel.addCons(HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks))\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid <= 3000)\nmodel.addCons(SmallTrucks >= 1)\nmodel.addCons(MediumTrucks >= 1)\nmodel.addCons(LargeTrucks >= 1)\nmodel.addCons(ExtraLargeTrucks >= 1)\nmodel.addCons(HybridTrucks >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck type varies based on the distance traveled and the load capacity. TruckA has an efficiency of 50 units per km, TruckB has 60 units per km, TruckC has 70 units per km, and TruckD has 80 units per km. The company aims to maximize the total efficiency of all trucks.\n// Total efficiency of TruckA: Efficiency_TruckA = 50 * TruckA\n// Total efficiency of TruckB: Efficiency_TruckB = 60 * TruckB\n// Total efficiency of TruckC: Efficiency_TruckC = 70 * TruckC\n// Total efficiency of TruckD: Efficiency_TruckD = 80 * TruckD\n// So, the objective function is: Maximize (Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 to purchase trucks. The cost of TruckA is $50,000, TruckB is $60,000, TruckC is $70,000, and TruckD is $80,000.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD <= 500,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of trucks cannot exceed 10.\n// TruckA + TruckB + TruckC + TruckD <= 10",
        "question": "A logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints. The efficiency of each truck type varies based on the distance traveled and the load capacity, as shown in the following Table.\n\n| Truck Type | Efficiency (units per km) | Cost (USD) |\n|------------|---------------------------|------------|\n| TruckA     | 50                        | 50,000     |\n| TruckB     | 60                        | 60,000     |\n| TruckC     | 70                        | 70,000     |\n| TruckD     | 80                        | 80,000     |\n\nThe company has a total budget of $500,000 to purchase trucks. Due to maintenance constraints, the total number of trucks cannot exceed 10. Please help the company to maximize the total efficiency of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\n\n# Define objective function\nEfficiency_TruckA = 50 * TruckA\nEfficiency_TruckB = 60 * TruckB\nEfficiency_TruckC = 70 * TruckC\nEfficiency_TruckD = 80 * TruckD\n# So, the objective function is: Maximize (Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n# Add constraints\n# The company has a total budget of $500,000 to purchase trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD <= 500000)\n# Due to maintenance constraints, the total number of trucks cannot exceed 10.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource X used for product A\": \"ResourceXA\", \"range\": \"ResourceXA >= 0\", \"type\": \"real\"}\n// {\"resource X used for product B\": \"ResourceXB\", \"range\": \"ResourceXB >= 0\", \"type\": \"real\"}\n// {\"resource X used for product C\": \"ResourceXC\", \"range\": \"ResourceXC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 100 units of resource X available. The usage of resource X per unit of product A is 0.5, for product B is 0.6, and for product C is 0.4.\n// ResourceXA + ResourceXB + ResourceXC <= 100\n// UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units.\n// UnitsA <= 150\n// UnitsB <= 120\n// UnitsC <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. The company has a total of 100 units of resource X available, with the usage of resource X per unit of product A being 0.5, for product B being 0.6, and for product C being 0.4. The market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units. Please help the company to maximize the total profit from the sales of all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0, ub=150)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0, ub=120)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=100)  # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100)  # Resource constraint\nmodel.addCons(UnitsA <= 150)  # Market demand constraint for product A\nmodel.addCons(UnitsB <= 120)  # Market demand constraint for product B\nmodel.addCons(UnitsC <= 100)  # Market demand constraint for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 729,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n// Delivery efficiency of Trucks: Efficiency_T = 10 * T / 100\n// Delivery efficiency of Vans: Efficiency_V = 5 * V / 50\n// Delivery efficiency of Bikes: Efficiency_B = 2 * B / 20\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B) = Maximize (10 * T / 100 + 5 * V / 50 + 2 * B / 20)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for operational costs.\n// 100 * T + 50 * V + 20 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints. The operational cost and delivery capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Delivery Capacity |\n|--------------|--------------------------|-------------------|\n| Trucks       | $100                     | 10 packages       |\n| Vans         | $50                      | 5 packages        |\n| Bikes        | $20                      | 2 packages        |\n\nThe company has a budget of $1000 per day for operational costs. The company has a total of 50 drivers available. Please help the company to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = 10 * T / 100\nEfficiency_V = 5 * V / 50\nEfficiency_B = 2 * B / 20\n## convert the division to multiplication\nmodel.addCons(obj * (100 * T + 50 * V + 20 * B) == 10 * T + 5 * V + 2 * B)\n\n# Add constraints\n## The company has a budget of $1000 per day for operational costs.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total delivery time, considering the nonlinear relationship between the number of trucks and the delivery time. The delivery time for each warehouse is modeled as a quadratic function of the number of trucks allocated:\n- For WarehouseA, the delivery time is given by: TimeA = 100 / (TrucksA^2 + 1)\n- For WarehouseB, the delivery time is given by: TimeB = 120 / (TrucksB^2 + 1)\n- For WarehouseC, the delivery time is given by: TimeC = 150 / (TrucksC^2 + 1)\n- For WarehouseD, the delivery time is given by: TimeD = 130 / (TrucksD^2 + 1)\n- For WarehouseE, the delivery time is given by: TimeE = 140 / (TrucksE^2 + 1)\nThe company wants to minimize the total delivery time across all warehouses.\n// So, the objective function is: Minimize (TimeA + TimeB + TimeC + TimeD + TimeE)\n// Minimize (100 / (TrucksA^2 + 1) + 120 / (TrucksB^2 + 1) + 150 / (TrucksC^2 + 1) + 130 / (TrucksD^2 + 1) + 140 / (TrucksE^2 + 1))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nWarehouseC requires at least 10 trucks to operate efficiently.\n// TrucksC >= 10",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the number of trucks to allocate to each warehouse for the upcoming month to optimize delivery efficiency. The delivery time for each warehouse is modeled as a quadratic function of the number of trucks allocated, as shown in the following Table.\n\n| Warehouse | Delivery Time Function |\n|-----------|------------------------|\n| WarehouseA | TimeA = 100 / (TrucksA^2 + 1) |\n| WarehouseB | TimeB = 120 / (TrucksB^2 + 1) |\n| WarehouseC | TimeC = 150 / (TrucksC^2 + 1) |\n| WarehouseD | TimeD = 130 / (TrucksD^2 + 1) |\n| WarehouseE | TimeE = 140 / (TrucksE^2 + 1) |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB. WarehouseC requires at least 10 trucks to operate efficiently.\n\nPlease help the company to minimize the total delivery time across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=10) # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for WarehouseE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTimeA = 100 / (TrucksA**2 + 1)\nTimeB = 120 / (TrucksB**2 + 1)\nTimeC = 150 / (TrucksC**2 + 1)\nTimeD = 130 / (TrucksD**2 + 1)\nTimeE = 140 / (TrucksE**2 + 1)\n## the objective function is: Minimize (TimeA + TimeB + TimeC + TimeD + TimeE)\nmodel.addCons(obj == TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to maintenance schedules, WarehouseA must operate with at least half the number of trucks as WarehouseB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product A\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product B\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product C\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkersA * 100\n// Profit_B = UnitsB * 70 - WorkersB * 120\n// Profit_C = UnitsC * 60 - WorkersC * 110\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C.\n// UnitsA <= 100\n// UnitsB <= 150\n// UnitsC <= 120\n\n## Generate Constraint-3:\nThe efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\n// UnitsA <= 2 * WorkersA\n// UnitsB <= 3 * WorkersB\n// UnitsC <= 2.5 * WorkersC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit and labor cost per worker per day for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker per Day |\n|---------|-----------------|-------------------------------|\n| A       | $50             | $100                          |\n| B       | $70             | $120                          |\n| C       | $60             | $110                          |\n\nThe company has a total of 50 workers available. The production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C. The efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\n\nPlease help the company to maximize the total daily profit, considering the constraints on the number of workers and the production capacities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for product A\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for product B\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkersA * 100\nProfit_B = UnitsB * 70 - WorkersB * 120\nProfit_C = UnitsC * 60 - WorkersC * 110\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)  # Total workers constraint\nmodel.addCons(UnitsA <= 100)  # Production capacity for product A\nmodel.addCons(UnitsB <= 150)  # Production capacity for product B\nmodel.addCons(UnitsC <= 120)  # Production capacity for product C\nmodel.addCons(UnitsA <= 2 * WorkersA)  # Efficiency constraint for product A\nmodel.addCons(UnitsB <= 3 * WorkersB)  # Efficiency constraint for product B\nmodel.addCons(UnitsC <= 2.5 * WorkersC)  # Efficiency constraint for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Workers for Product A: \", model.getVal(WorkersA))\n    print(\"Number of Workers for Product B: \", model.getVal(WorkersB))\n    print(\"Number of Workers for Product C: \", model.getVal(WorkersC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"GoodATrucks\", \"range\": \"GoodATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"GoodBTrucks\", \"range\": \"GoodBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"GoodCTrucks\", \"range\": \"GoodCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"GoodDTrucks\", \"range\": \"GoodDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"GoodETrucks\", \"range\": \"GoodETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated per truck is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net revenue per day.\n// Net revenue for GoodA: Revenue_GoodA = (1000 - 500) * GoodATrucks\n// Net revenue for GoodB: Revenue_GoodB = (1200 - 600) * GoodBTrucks\n// Net revenue for GoodC: Revenue_GoodC = (1400 - 700) * GoodCTrucks\n// Net revenue for GoodD: Revenue_GoodD = (1600 - 800) * GoodDTrucks\n// Net revenue for GoodE: Revenue_GoodE = (1800 - 900) * GoodETrucks\n// So, the objective function is: Maximize (Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50\n\n## Generate Constraint-2:\nDue to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB.\n// GoodATrucks <= 2 * GoodBTrucks",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network. The operating cost and revenue generated per truck for each type of good are given in the following Table.\n\n| Good   | Operating Cost per Truck per Day | Revenue per Truck per Day |\n|--------|---------------------------------|---------------------------|\n| GoodA  | $500                            | $1000                     |\n| GoodB  | $600                            | $1200                     |\n| GoodC  | $700                            | $1400                     |\n| GoodD  | $800                            | $1600                     |\n| GoodE  | $900                            | $1800                     |\n\nThe company has a total of 50 trucks available for distribution. Due to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB. The company wants to maximize the total net revenue per day.\n\nPlease help the company determine the optimal number of trucks to allocate for each type of good.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nGoodATrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodATrucks\", lb=0)  # number of trucks for GoodA\nGoodBTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodBTrucks\", lb=0)  # number of trucks for GoodB\nGoodCTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodCTrucks\", lb=0)  # number of trucks for GoodC\nGoodDTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodDTrucks\", lb=0)  # number of trucks for GoodD\nGoodETrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodETrucks\", lb=0)  # number of trucks for GoodE\n\n# Define objective function\nRevenue_GoodA = (1000 - 500) * GoodATrucks\nRevenue_GoodB = (1200 - 600) * GoodBTrucks\nRevenue_GoodC = (1400 - 700) * GoodCTrucks\nRevenue_GoodD = (1600 - 800) * GoodDTrucks\nRevenue_GoodE = (1800 - 900) * GoodETrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n# Add constraints\nmodel.addCons(GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50)\nmodel.addCons(GoodATrucks <= 2 * GoodBTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(GoodATrucks))\n    print(\"Number of Trucks for GoodB: \", model.getVal(GoodBTrucks))\n    print(\"Number of Trucks for GoodC: \", model.getVal(GoodCTrucks))\n    print(\"Number of Trucks for GoodD: \", model.getVal(GoodDTrucks))\n    print(\"Number of Trucks for GoodE: \", model.getVal(GoodETrucks))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer aims to maximize the total profit while considering the efficiency of battery usage.\n// Profit_E1 = 3000 * E1 - 2000 * E1\n// Profit_E2 = 4000 * E2 - 2500 * E2\n// Profit_E3 = 5000 * E3 - 3000 * E3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (2 * E1 + 3 * E2 + 4 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited battery supply of 500 kWh.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 500",
        "question": "A manufacturer produces three types of electric vehicles (EVs): E1, E2, and E3. They need to determine the production quantities of each EV type to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for E1 is $3000, with a production cost of $2000 and a battery requirement of 2 kWh per unit.\nFor E2, the profit per unit is $4000, with a production cost of $2500 and a battery requirement of 3 kWh per unit.\nFor E3, the profit per unit is $5000, with a production cost of $3000 and a battery requirement of 4 kWh per unit.\nThe manufacturer has a limited battery supply of 500 kWh.\nPlease help the manufacturer to maximize the total profit while considering the efficiency of battery usage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (3000 - 2000) * E1\nProfit_E2 = (4000 - 2500) * E2\nProfit_E3 = (5000 - 3000) * E3\nBatteryUsage = 2 * E1 + 3 * E2 + 4 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / BatteryUsage\n## convert the division to multiplication\nmodel.addCons(obj * BatteryUsage == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited battery supply of 500 kWh.\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by small trucks per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by medium trucks per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by large trucks per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for small trucks is $0.5, medium trucks is $0.7, and large trucks is $0.9. The maintenance cost per day for small trucks is $100, medium trucks is $150, and large trucks is $200. The company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs.\n// FuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\n// FuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\n// FuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\n// MaintenanceCostSmall = 100 * SmallTrucks\n// MaintenanceCostMedium = 150 * MediumTrucks\n// MaintenanceCostLarge = 200 * LargeTrucks\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n## Generate Constraint-1:\nThe total distance traveled by all trucks must not exceed 5000 kilometers per day.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 per day for fuel costs.\n// 0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000\n\n## Generate Constraint-3:\nThe company can only afford to maintain a maximum of 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50\n\n## Generate Constraint-4:\nThe company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks >= 2000\n\n## Generate Constraint-5:\nThe company prefers to use more fuel-efficient trucks if possible.\n// DistanceSmall * SmallTrucks >= DistanceMedium * MediumTrucks\n// DistanceMedium * MediumTrucks >= DistanceLarge * LargeTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs. The fuel cost per kilometer and maintenance cost per day for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Cost per Kilometer | Maintenance Cost per Day |\n|------------|-------------------------|--------------------------|\n| Small      | $0.5                    | $100                     |\n| Medium     | $0.7                    | $150                     |\n| Large      | $0.9                    | $200                     |\n\nThe company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs. The total distance traveled by all trucks must not exceed 5000 kilometers per day. The company has a budget of $2000 per day for fuel costs. The company can only afford to maintain a maximum of 50 trucks in total. The company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements. The company prefers to use more fuel-efficient trucks if possible.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks to deploy and the distances they should travel each day to minimize total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nDistanceSmall = model.addVar(name=\"DistanceSmall\", lb=0)  # distance traveled by small trucks per day\nDistanceMedium = model.addVar(name=\"DistanceMedium\", lb=0)  # distance traveled by medium trucks per day\nDistanceLarge = model.addVar(name=\"DistanceLarge\", lb=0)  # distance traveled by large trucks per day\n\n# Define objective function\nFuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\nFuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\nFuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\nMaintenanceCostSmall = 100 * SmallTrucks\nMaintenanceCostMedium = 150 * MediumTrucks\nMaintenanceCostLarge = 200 * LargeTrucks\n# So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n# Add constraints\n# The total distance traveled by all trucks must not exceed 5000 kilometers per day.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000)\n# The company has a budget of $2000 per day for fuel costs.\nmodel.addCons(0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000)\n# The company can only afford to maintain a maximum of 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n# The company must ensure that at least 2000 kilometers are covered daily to meet delivery requirements.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks >= 2000)\n# The company prefers to use more fuel-efficient trucks if possible.\nmodel.addCons(DistanceSmall * SmallTrucks >= DistanceMedium * MediumTrucks)\nmodel.addCons(DistanceMedium * MediumTrucks >= DistanceLarge * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Distance Traveled by Small Trucks: \", model.getVal(DistanceSmall))\n    print(\"Distance Traveled by Medium Trucks: \", model.getVal(DistanceMedium))\n    print(\"Distance Traveled by Large Trucks: \", model.getVal(DistanceLarge))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1573,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation technology cannot exceed $50,000.\n// IA <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30\n\n## Generate Constraint-4:\nThe company must allocate at least 200 units of resources to ProductB.\n// RB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product (QA for ProductA, QB for ProductB, and QC for ProductC) and the amount of resources (labor and materials) allocated to each product (RA for ProductA, RB for ProductB, and RC for ProductC). Additionally, the company is considering investing in automation technology to improve production efficiency (IA).\n\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n\nThe total resources available for production are limited to 1000 units. The investment in automation technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units. The company must allocate at least 200 units of resources to ProductB.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30) # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=200) # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # resources allocated to ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0, ub=50000) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 60 + 0.005 * IA) * QA\nProfitB = (150 - 80 + 0.005 * IA) * QB\nProfitC = (200 - 100 + 0.005 * IA) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RA + RB + RC <= 1000)\nmodel.addCons(IA <= 50000)\nmodel.addCons(QA <= 50)\nmodel.addCons(QC <= 30)\nmodel.addCons(RB >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Automation Technology: \", model.getVal(IA))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints.\n// {\"production quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_ProductA = (50 - 10) * ProductA\n// Total net profit for ProductB: Profit_ProductB = (70 - 15) * ProductB\n// Total net profit for ProductC: Profit_ProductC = (90 - 20) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40.\n// 20 * ProductA + 30 * ProductB + 40 * ProductC <= 20,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints. The profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total. Due to market demand, the production of ProductB must be at least twice the production of ProductA. The company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40.\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 10) * ProductA\nProfit_ProductB = (70 - 15) * ProductB\nProfit_ProductC = (90 - 20) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 1000) # limited warehouse space\nmodel.addCons(ProductB >= 2 * ProductA) # market demand constraint for ProductB\nmodel.addCons(20 * ProductA + 30 * ProductB + 40 * ProductC <= 20000) # fixed budget for production costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200\n\n## Generate Constraint-3:\nThe company wants to produce at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15; E >= 15\n\n## Generate Constraint-4:\nThe production of product D should not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe production of product E should not exceed the combined production of products A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. Each product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n\nThe company has a budget of $1500 for raw materials. The company has a production capacity of 200 hours. The company wants to produce at least 15 units of each product. The production of product D should not exceed the combined production of products A, B, and C. The production of product E should not exceed the combined production of products A, B, C, and D.\n\nPlease help the company to maximize the total profit per unit of time (profit rate).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 15 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=15) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n## The production of product D should not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The production of product E should not exceed the combined production of products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct.\n// {\"number of CondoA\": \"CondoA\", \"range\": \"CondoA >= 0\", \"type\": \"integer\"}\n// {\"number of CondoB\": \"CondoB\", \"range\": \"CondoB >= 0\", \"type\": \"integer\"}\n// {\"number of HouseC\": \"HouseC\", \"range\": \"HouseC >= 0\", \"type\": \"integer\"}\n// {\"number of HouseD\": \"HouseD\", \"range\": \"HouseD >= 0\", \"type\": \"integer\"}\n// {\"number of VillaE\": \"VillaE\", \"range\": \"VillaE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoA, the profit per unit is $100,000, the construction cost per unit is $70,000, and the land cost per unit is $20,000. \nFor CondoB, the profit per unit is $120,000, the construction cost per unit is $80,000, and the land cost per unit is $25,000. \nFor HouseC, the profit per unit is $150,000, the construction cost per unit is $100,000, and the land cost per unit is $30,000.\nFor HouseD, the profit per unit is $180,000, the construction cost per unit is $110,000, and the land cost per unit is $35,000.\nFor VillaE, the profit per unit is $200,000, the construction cost per unit is $120,000, and the land cost per unit is $40,000.\nThe developer wants to maximize the total profit while considering the efficiency of land use (profit per unit of land).\n// Profit_CondoA = (100,000 - 70,000 - 20,000) * CondoA\n// Profit_CondoB = (120,000 - 80,000 - 25,000) * CondoB\n// Profit_HouseC = (150,000 - 100,000 - 30,000) * HouseC\n// Profit_HouseD = (180,000 - 110,000 - 35,000) * HouseD\n// Profit_VillaE = (200,000 - 120,000 - 40,000) * VillaE\n// So, the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / (20,000 * CondoA + 25,000 * CondoB + 30,000 * HouseC + 35,000 * HouseD + 40,000 * VillaE)\n\n## Generate Constraint-1:\nThe developer has a total budget of $5,000,000 for construction costs.\n// 70,000 * CondoA + 80,000 * CondoB + 100,000 * HouseC + 110,000 * HouseD + 120,000 * VillaE <= 5,000,000\n\n## Generate Constraint-2:\nThe developer has a limited amount of land available, which can accommodate a maximum of 100 units.\n// CondoA + CondoB + HouseC + HouseD + VillaE <= 100",
        "question": "A real estate developer is planning to build five different types of residential properties: CondoA, CondoB, HouseC, HouseD, and VillaE. They need to determine the number of each type of property to construct. The profit per unit, construction cost per unit, and land cost per unit for each type of property are given in the following Table.\n\n| Property Type | Profit per Unit | Construction Cost per Unit | Land Cost per Unit |\n|---------------|-----------------|----------------------------|--------------------|\n| CondoA        | $100,000        | $70,000                    | $20,000            |\n| CondoB        | $120,000        | $80,000                    | $25,000            |\n| HouseC        | $150,000        | $100,000                   | $30,000            |\n| HouseD        | $180,000        | $110,000                   | $35,000            |\n| VillaE        | $200,000        | $120,000                   | $40,000            |\n\nThe developer has a total budget of $5,000,000 for construction costs. The developer has a limited amount of land available, which can accommodate a maximum of 100 units. The developer wants to maximize the total profit while considering the efficiency of land use (profit per unit of land).\nPlease help the developer to determine the optimal number of each type of property to construct.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCondoA = model.addVar(vtype=\"INTEGER\", name=\"CondoA\", lb=0) # number of CondoA\nCondoB = model.addVar(vtype=\"INTEGER\", name=\"CondoB\", lb=0) # number of CondoB\nHouseC = model.addVar(vtype=\"INTEGER\", name=\"HouseC\", lb=0) # number of HouseC\nHouseD = model.addVar(vtype=\"INTEGER\", name=\"HouseD\", lb=0) # number of HouseD\nVillaE = model.addVar(vtype=\"INTEGER\", name=\"VillaE\", lb=0) # number of VillaE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoA = (100000 - 70000 - 20000) * CondoA\nProfit_CondoB = (120000 - 80000 - 25000) * CondoB\nProfit_HouseC = (150000 - 100000 - 30000) * HouseC\nProfit_HouseD = (180000 - 110000 - 35000) * HouseD\nProfit_VillaE = (200000 - 120000 - 40000) * VillaE\nLandCost = 20000 * CondoA + 25000 * CondoB + 30000 * HouseC + 35000 * HouseD + 40000 * VillaE\n## the objective function is: Maximize (Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE) / LandCost\n## convert the division to multiplication\nmodel.addCons(obj * LandCost == Profit_CondoA + Profit_CondoB + Profit_HouseC + Profit_HouseD + Profit_VillaE)\n\n# Add constraints\n## The developer has a total budget of $5,000,000 for construction costs.\nmodel.addCons(70000 * CondoA + 80000 * CondoB + 100000 * HouseC + 110000 * HouseD + 120000 * VillaE <= 5000000)\n## The developer has a limited amount of land available, which can accommodate a maximum of 100 units.\nmodel.addCons(CondoA + CondoB + HouseC + HouseD + VillaE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoA: \", model.getVal(CondoA))\n    print(\"Number of CondoB: \", model.getVal(CondoB))\n    print(\"Number of HouseC: \", model.getVal(HouseC))\n    print(\"Number of HouseD: \", model.getVal(HouseD))\n    print(\"Number of VillaE: \", model.getVal(VillaE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1334,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n// Total profit for ProductA: ProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\n// Total profit for ProductB: ProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\n// Total profit for ProductC: ProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// AutomationA + AutomationB + AutomationC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units.\n// QuantityA <= 500; QuantityB <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductC are produced.\n// QuantityC >= 200\n\n## Generate Constraint-5:\nThe labor hours per unit of each product are affected by the investment in automation:\n// LaborHoursA = 2 - 0.0001 * AutomationA\n// LaborHoursB = 3 - 0.0001 * AutomationB\n// LaborHoursC = 4 - 0.0001 * AutomationC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units. The company must ensure that at least 200 units of ProductC are produced.\n\nPlease help the company to maximize the total profit from all products, considering the cost of labor and investment in automation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0) # labor hours per unit of ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0) # labor hours per unit of ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0) # labor hours per unit of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\nProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\nProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons(LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000)\n# The total investment in automation technology cannot exceed $20,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 20000)\n# Due to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units.\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 300)\n# The company must ensure that at least 200 units of ProductC are produced.\nmodel.addCons(QuantityC >= 200)\n# The labor hours per unit of each product are affected by the investment in automation:\nmodel.addCons(LaborHoursA == 2 - 0.0001 * AutomationA)\nmodel.addCons(LaborHoursB == 3 - 0.0001 * AutomationB)\nmodel.addCons(LaborHoursC == 4 - 0.0001 * AutomationC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels.\n// {\"number of trucks on Route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumption_A = k * SpeedA^3 * TrucksA\n// FuelConsumption_B = k * SpeedB^3 * TrucksB\n// FuelConsumption_C = k * SpeedC^3 * TrucksC\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe maximum speed allowed on Route A is 60 km/h.\n// SpeedA <= 60\n\n## Generate Constraint-3:\nThe maximum speed allowed on Route B is 70 km/h.\n// SpeedB <= 70\n\n## Generate Constraint-4:\nThe maximum speed allowed on Route C is 80 km/h.\n// SpeedC <= 80\n\n## Generate Constraint-5:\nThe company must ensure that at least 10 trucks are assigned to each route.\n// TrucksA >= 10; TrucksB >= 10; TrucksC >= 10",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels. The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes. The company has a total of 50 trucks available. The maximum speed allowed on Route A is 60 km/h, on Route B is 70 km/h, and on Route C is 80 km/h. The company must ensure that at least 10 trucks are assigned to each route. Please help the company to determine the optimal number of trucks and their speeds on each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are assigned to each route.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks on Route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=10) # number of trucks on Route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=10) # number of trucks on Route C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # speed of trucks on Route A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # speed of trucks on Route B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # speed of trucks on Route C\n\n# Define objective function\n## The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3\n## Since pyscipopt does not support non-linear objective, we need to linearize the cubic term\nFuelConsumption_A = model.addVar(name=\"FuelConsumption_A\")\nFuelConsumption_B = model.addVar(name=\"FuelConsumption_B\")\nFuelConsumption_C = model.addVar(name=\"FuelConsumption_C\")\nmodel.addCons(FuelConsumption_A == SpeedA**3 * TrucksA)\nmodel.addCons(FuelConsumption_B == SpeedB**3 * TrucksB)\nmodel.addCons(FuelConsumption_C == SpeedC**3 * TrucksC)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\nmodel.addCons(obj == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## The maximum speed allowed on Route A is 60 km/h.\nmodel.addCons(SpeedA <= 60)\n## The maximum speed allowed on Route B is 70 km/h.\nmodel.addCons(SpeedB <= 70)\n## The maximum speed allowed on Route C is 80 km/h.\nmodel.addCons(SpeedC <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks on Route A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks on Route B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks on Route C: \", model.getVal(SpeedC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDQty\", \"range\": \"DeviceDQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEQty\", \"range\": \"DeviceEQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each additional unit produced. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each additional unit produced. The profit per unit for DeviceC is $90, but it decreases by $0.3 for each additional unit produced. The profit per unit for DeviceD is $60, but it decreases by $0.15 for each additional unit produced. The profit per unit for DeviceE is $80, but it decreases by $0.25 for each additional unit produced. The company wants to maximize the total profit.\n// Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 1)) * DeviceAQty\n// Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 1)) * DeviceBQty\n// Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * (DeviceCQty - 1)) * DeviceCQty\n// Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * (DeviceDQty - 1)) * DeviceDQty\n// Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * (DeviceEQty - 1)) * DeviceEQty\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty + DeviceDQty + DeviceEQty <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\n// DeviceAQty >= 0.5 * DeviceBQty",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each additional unit produced. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each additional unit produced. The profit per unit for DeviceC is $90, but it decreases by $0.3 for each additional unit produced. The profit per unit for DeviceD is $60, but it decreases by $0.15 for each additional unit produced. The profit per unit for DeviceE is $80, but it decreases by $0.25 for each additional unit produced. The company wants to maximize the total profit. The company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB. Please help the company to determine the optimal production quantities for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\nDeviceDQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceDQty\", lb=0) # production quantity for DeviceD\nDeviceEQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceEQty\", lb=0) # production quantity for DeviceE\n\n# Define objective function\n## Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 1)) * DeviceAQty\n## Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 1)) * DeviceBQty\n## Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * (DeviceCQty - 1)) * DeviceCQty\n## Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * (DeviceDQty - 1)) * DeviceDQty\n## Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * (DeviceEQty - 1)) * DeviceEQty\n## So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\nProfit_DeviceA = (50 - 0.1 * (DeviceAQty - 1)) * DeviceAQty\nProfit_DeviceB = (70 - 0.2 * (DeviceBQty - 1)) * DeviceBQty\nProfit_DeviceC = (90 - 0.3 * (DeviceCQty - 1)) * DeviceCQty\nProfit_DeviceD = (60 - 0.15 * (DeviceDQty - 1)) * DeviceDQty\nProfit_DeviceE = (80 - 0.25 * (DeviceEQty - 1)) * DeviceEQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty + DeviceDQty + DeviceEQty <= 1000)\n## Due to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\nmodel.addCons(DeviceAQty >= 0.5 * DeviceBQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDQty))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. \nFor route 1, each truck consumes 100 liters of fuel and takes 5 hours. \nFor route 2, each truck consumes 120 liters of fuel and takes 6 hours. \nFor route 3, each truck consumes 140 liters of fuel and takes 7 hours. \nFor route 4, each truck consumes 160 liters of fuel and takes 8 hours.\nFor route 5, each truck consumes 180 liters of fuel and takes 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n// Fuel_Cost_R1 = 100 * T1 * fuel_price\n// Fuel_Cost_R2 = 120 * T2 * fuel_price\n// Fuel_Cost_R3 = 140 * T3 * fuel_price\n// Fuel_Cost_R4 = 160 * T4 * fuel_price\n// Fuel_Cost_R5 = 180 * T5 * fuel_price\n// Time_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\n// Time_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\n// Time_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\n// Time_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\n// Time_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n// So, the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 10,000 liters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-3:\nThe total delivery time across all routes must not exceed 500 hours.\n// 5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500\n\n## Generate Constraint-4:\nThe company must deliver at least 500 packages, and each truck can carry 10 packages.\n// 10 * (T1 + T2 + T3 + T4 + T5) >= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route. The fuel consumption rates and delivery times for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/truck) | Delivery Time (hours/truck) |\n|-------|---------------------------------|-----------------------------|\n| R1    | 100                             | 5                           |\n| R2    | 120                             | 6                           |\n| R3    | 140                             | 7                           |\n| R4    | 160                             | 8                           |\n| R5    | 180                             | 9                           |\n\nThe company has a total of 100 trucks available. The total fuel consumption across all routes must not exceed 10,000 liters. The total delivery time across all routes must not exceed 500 hours. The company must deliver at least 500 packages, and each truck can carry 10 packages. \n\nPlease help the company to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nfuel_price = 1.5 # assuming fuel price per liter\nhourly_cost_of_downtime = 20 # assuming hourly cost of downtime\n\nFuel_Cost_R1 = 100 * T1 * fuel_price\nFuel_Cost_R2 = 120 * T2 * fuel_price\nFuel_Cost_R3 = 140 * T3 * fuel_price\nFuel_Cost_R4 = 160 * T4 * fuel_price\nFuel_Cost_R5 = 180 * T5 * fuel_price\n\nTime_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\nTime_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\nTime_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\nTime_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\nTime_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\nmodel.addCons(obj == Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5 + Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100) # total trucks available\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000) # total fuel consumption\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500) # total delivery time\nmodel.addCons(10 * (T1 + T2 + T3 + T4 + T5) >= 500) # total packages to be delivered\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1338,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wearables\": \"Wearables\", \"range\": \"Wearables >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company wants to maximize the total profit from selling these devices.\n// Profit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\n// Profit_Tablets = (150 - 0.05 * Tablets) * Tablets\n// Profit_Laptops = (200 - 0.08 * Laptops) * Laptops\n// Profit_Wearables = (50 - 0.03 * Wearables) * Wearables\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n// 5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\n// Smartphones <= 500; Tablets <= 300; Laptops <= 200; Wearables <= 400",
        "question": "A manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints. The profit per unit of each device decreases as more units are produced, as shown in the following Table.\n\n| Device       | Profit per Unit | Decrease in Profit per Additional Unit |\n|--------------|-----------------|---------------------------------------|\n| Smartphones  | $100            | $0.1 per additional Smartphone         |\n| Tablets      | $150            | $0.05 per additional Tablet           |\n| Laptops      | $200            | $0.08 per additional Laptop           |\n| Wearables    | $50             | $0.03 per additional Wearable         |\n\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000. The market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0, ub=500) # quantity of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0, ub=300) # quantity of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0, ub=200) # quantity of Laptops\nWearables = model.addVar(vtype=\"INTEGER\", name=\"Wearables\", lb=0, ub=400) # quantity of Wearables\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.05 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.08 * Laptops) * Laptops\nProfit_Wearables = (50 - 0.03 * Wearables) * Wearables\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices.\nmodel.addCons(5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000)\n## The market has a demand limit for each device.\nmodel.addCons(Smartphones <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Wearables <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Wearables: \", model.getVal(Wearables))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand.\n// {\"number of trucks for product P1\": \"TruckP1\", \"range\": \"TruckP1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P2\": \"TruckP2\", \"range\": \"TruckP2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P3\": \"TruckP3\", \"range\": \"TruckP3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P4\": \"TruckP4\", \"range\": \"TruckP4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for product P5\": \"TruckP5\", \"range\": \"TruckP5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each product varies with the number of trucks used and the distance traveled. The cost function is nonlinear due to economies of scale in truck usage.\nFor product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck.\nFor product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck.\nFor product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck.\nFor product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck.\nFor product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck.\nThe company aims to minimize the total transportation cost.\n// Total cost for P1: Cost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\n// Total cost for P2: Cost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\n// Total cost for P3: Cost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\n// Total cost for P4: Cost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\n// Total cost for P5: Cost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n// So, the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50\n\n## Generate Constraint-2:\nThe demand for each product requires at least a certain number of trucks. Specifically, P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks.\n// TruckP1 >= 5; TruckP2 >= 6; TruckP3 >= 7; TruckP4 >= 8; TruckP5 >= 9",
        "question": "A logistics company is managing the distribution of five different products: P1, P2, P3, P4, and P5. The company needs to determine the optimal number of trucks to allocate for each product to minimize transportation costs while meeting demand. The cost of transporting each product varies with the number of trucks used and the distance traveled. For product P1, the cost per truck is $5000, and the cost increases by 5% for each additional truck. For product P2, the cost per truck is $6000, and the cost increases by 4% for each additional truck. For product P3, the cost per truck is $7000, and the cost increases by 3% for each additional truck. For product P4, the cost per truck is $8000, and the cost increases by 2% for each additional truck. For product P5, the cost per truck is $9000, and the cost increases by 1% for each additional truck. The company has a total of 50 trucks available for distribution. The demand for each product requires at least a certain number of trucks: P1 requires at least 5 trucks, P2 requires at least 6 trucks, P3 requires at least 7 trucks, P4 requires at least 8 trucks, and P5 requires at least 9 trucks. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckP1 = model.addVar(vtype=\"INTEGER\", name=\"TruckP1\", lb=5) # number of trucks for product P1\nTruckP2 = model.addVar(vtype=\"INTEGER\", name=\"TruckP2\", lb=6) # number of trucks for product P2\nTruckP3 = model.addVar(vtype=\"INTEGER\", name=\"TruckP3\", lb=7) # number of trucks for product P3\nTruckP4 = model.addVar(vtype=\"INTEGER\", name=\"TruckP4\", lb=8) # number of trucks for product P4\nTruckP5 = model.addVar(vtype=\"INTEGER\", name=\"TruckP5\", lb=9) # number of trucks for product P5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Cost functions for each product\nCost_P1 = 5000 * TruckP1 * (1 + 0.05 * (TruckP1 - 1))\nCost_P2 = 6000 * TruckP2 * (1 + 0.04 * (TruckP2 - 1))\nCost_P3 = 7000 * TruckP3 * (1 + 0.03 * (TruckP3 - 1))\nCost_P4 = 8000 * TruckP4 * (1 + 0.02 * (TruckP4 - 1))\nCost_P5 = 9000 * TruckP5 * (1 + 0.01 * (TruckP5 - 1))\n\n## the objective function is: Minimize (Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\nmodel.addCons(obj == Cost_P1 + Cost_P2 + Cost_P3 + Cost_P4 + Cost_P5)\n\n# Add constraints\n## The company has a total of 50 trucks available for distribution.\nmodel.addCons(TruckP1 + TruckP2 + TruckP3 + TruckP4 + TruckP5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for P1: \", model.getVal(TruckP1))\n    print(\"Number of Trucks for P2: \", model.getVal(TruckP2))\n    print(\"Number of Trucks for P3: \", model.getVal(TruckP3))\n    print(\"Number of Trucks for P4: \", model.getVal(TruckP4))\n    print(\"Number of Trucks for P5: \", model.getVal(TruckP5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, each panel generates 150 kWh annually with a cost of $100 per panel and a carbon offset of 0.5 tons. In D2, each panel generates 120 kWh annually with a cost of $120 per panel and a carbon offset of 0.4 tons. In D3, each panel generates 180 kWh annually with a cost of $110 per panel and a carbon offset of 0.6 tons. In D4, each panel generates 160 kWh annually with a cost of $130 per panel and a carbon offset of 0.5 tons. In D5, each panel generates 140 kWh annually with a cost of $140 per panel and a carbon offset of 0.4 tons. The city aims to maximize the energy production efficiency (total energy generated per total cost).\n// Total_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\n// Total_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n// So, the objective function is: Maximize Total_Energy / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total carbon offset should be at least 200 tons.\n// 0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed in D1 and D2 combined is 500.\n// D1 + D2 <= 500",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, each panel generates 150 kWh annually with a cost of $100 per panel and a carbon offset of 0.5 tons. In D2, each panel generates 120 kWh annually with a cost of $120 per panel and a carbon offset of 0.4 tons. In D3, each panel generates 180 kWh annually with a cost of $110 per panel and a carbon offset of 0.6 tons. In D4, each panel generates 160 kWh annually with a cost of $130 per panel and a carbon offset of 0.5 tons. In D5, each panel generates 140 kWh annually with a cost of $140 per panel and a carbon offset of 0.4 tons. The city aims to maximize the energy production efficiency (total energy generated per total cost). The city has a budget of $100,000 for the installation of solar panels. The total carbon offset should be at least 200 tons. The maximum number of panels that can be installed in D1 and D2 combined is 500. Please help the city to maximize the energy production efficiency (total energy generated per total cost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\nTotal_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n## the objective function is: Maximize Total_Energy / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Energy)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000)\n## The total carbon offset should be at least 200 tons.\nmodel.addCons(0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200)\n## The maximum number of panels that can be installed in D1 and D2 combined is 500.\nmodel.addCons(D1 + D2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for daily operational costs, including maintenance and fuel.\n// (100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice) + (200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice) + (300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice) <= 10000\n\n## Generate Constraint-3:\nThe company has a daily delivery capacity of 1000 miles.\n// 10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the fleet is composed of small trucks.\n// SmallTrucks >= 0.2 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The details of each type of truck are given in the following Table.\n\n| Truck Type | Maintenance Cost per Day | Fuel Efficiency (miles per gallon) |\n|------------|--------------------------|------------------------------------|\n| Small      | $100                     | 10                                 |\n| Medium     | $200                     | 8                                  |\n| Large      | $300                     | 6                                  |\n\nThe company has a total of 50 drivers available. The company has a budget of $10,000 for daily operational costs, including maintenance and fuel. The company has a daily delivery capacity of 1000 miles. The company must ensure that at least 20% of the fleet is composed of small trucks.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks, and the number of drivers assigned to each type of truck to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")  # Assuming fuel price is a variable\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\nmodel.addCons(100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 10000)\nmodel.addCons(10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000)\nmodel.addCons(SmallTrucks >= 0.2 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1383,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each truck on Route A is 50 liters per trip, on Route B is 60 liters per trip, on Route C is 70 liters per trip, and on Route D is 80 liters per trip. The operational cost per truck on Route A is $100 per trip, on Route B is $120 per trip, on Route C is $140 per trip, and on Route D is $160 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Fuel_Cost_A = 50 * Trucks_A\n// Fuel_Cost_B = 60 * Trucks_B\n// Fuel_Cost_C = 70 * Trucks_C\n// Fuel_Cost_D = 80 * Trucks_D\n// Operational_Cost_A = 100 * Trucks_A\n// Operational_Cost_B = 120 * Trucks_B\n// Operational_Cost_C = 140 * Trucks_C\n// Operational_Cost_D = 160 * Trucks_D\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route. The fuel consumption and operational costs for each truck on each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/trip) | Operational Cost ($/trip) |\n|-------|--------------------------------|---------------------------|\n| A     | 50                             | 100                       |\n| B     | 60                             | 120                       |\n| C     | 70                             | 140                       |\n| D     | 80                             | 160                       |\n\nThe company has a total of 50 trucks available. Please help the company to minimize the total fuel consumption and operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Route D\n\n# Define objective function\nFuel_Cost_A = 50 * Trucks_A\nFuel_Cost_B = 60 * Trucks_B\nFuel_Cost_C = 70 * Trucks_C\nFuel_Cost_D = 80 * Trucks_D\nOperational_Cost_A = 100 * Trucks_A\nOperational_Cost_B = 120 * Trucks_B\nOperational_Cost_C = 140 * Trucks_C\nOperational_Cost_D = 160 * Trucks_D\n# So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The production quantity for each product is a decision variable.\n// {\"production quantity for product A\": \"A_quantity\", \"range\": \"A_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B_quantity\", \"range\": \"B_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C_quantity\", \"range\": \"C_quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = A_quantity * 50\n// Profit_B = B_quantity * 70\n// Profit_C = C_quantity * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A_quantity + B_quantity + C_quantity <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\n// A_quantity >= 30\n// B_quantity >= 20\n\n## Generate Constraint-3:\nThe company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B.\n// C_quantity <= 2 * (A_quantity + B_quantity)\n\n## Generate Constraint-4:\nThe production of product A and product B must be in a ratio of at least 2:1.\n// A_quantity >= 2 * B_quantity\n\n## Generate Constraint-5:\nThe company has a budget constraint for raw materials, which is $5000 per day. The cost of raw materials for product A is $20 per unit, for product B is $30 per unit, and for product C is $25 per unit.\n// 20 * A_quantity + 30 * B_quantity + 25 * C_quantity <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the sales of all three products. The total production capacity of the company is limited to 100 units per day. The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day. The company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B. The production of product A and product B must be in a ratio of at least 2:1. The company has a budget constraint for raw materials, which is $5000 per day. The cost of raw materials for product A is $20 per unit, for product B is $30 per unit, and for product C is $25 per unit. Please help the company to determine the optimal production quantity for each product to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_quantity = model.addVar(vtype=\"INTEGER\", name=\"A_quantity\", lb=0) # production quantity for product A\nB_quantity = model.addVar(vtype=\"INTEGER\", name=\"B_quantity\", lb=0) # production quantity for product B\nC_quantity = model.addVar(vtype=\"INTEGER\", name=\"C_quantity\", lb=0) # production quantity for product C\n\n# Define objective function\nProfit_A = A_quantity * 50\nProfit_B = B_quantity * 70\nProfit_C = C_quantity * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A_quantity + B_quantity + C_quantity <= 100)\n# The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\nmodel.addCons(A_quantity >= 30)\nmodel.addCons(B_quantity >= 20)\n# The production of product C is limited by the sum of the productions of products A and B.\nmodel.addCons(C_quantity <= 2 * (A_quantity + B_quantity))\n# The production of product A and product B must be in a ratio of at least 2:1.\nmodel.addCons(A_quantity >= 2 * B_quantity)\n# The company has a budget constraint for raw materials, which is $5000 per day.\nmodel.addCons(20 * A_quantity + 30 * B_quantity + 25 * C_quantity <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A_quantity))\n    print(\"Production Quantity for Product B: \", model.getVal(B_quantity))\n    print(\"Production Quantity for Product C: \", model.getVal(C_quantity))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3.\n// {\"number of Type1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Type1 trucks\": \"FEU1\", \"range\": \"FEU1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type2 trucks\": \"FEU2\", \"range\": \"FEU2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type3 trucks\": \"FEU3\", \"range\": \"FEU3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n// Fuel cost for Type1 trucks: FC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\n// Fuel cost for Type2 trucks: FC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\n// Fuel cost for Type3 trucks: FC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\n// Upgrade cost: UC = 100 * (FEU1 + FEU2 + FEU3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency upgrades.\n// 100 * (FEU1 + FEU2 + FEU3) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 <= 100\n\n## Generate Constraint-3:\nDue to regional demand, the company must allocate at least 20 Type1 trucks and 30 Type2 trucks.\n// T1 >= 20; T2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n\n| Truck Type | Fuel Cost per Kilometer | Fuel Efficiency Upgrade Cost |\n|------------|-------------------------|------------------------------|\n| Type1      | $0.50                   | $100 per 0.01 L/km reduction|\n| Type2      | $0.60                   | $100 per 0.01 L/km reduction|\n| Type3      | $0.70                   | $100 per 0.01 L/km reduction|\n\nThe company has a budget of $50,000 for fuel efficiency upgrades. The total number of trucks available is 100. Due to regional demand, the company must allocate at least 20 Type1 trucks and 30 Type2 trucks.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and upgrade costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=20) # number of Type1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=30) # number of Type2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Type3 trucks\nFEU1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU1\", lb=0) # fuel efficiency upgrade for Type1 trucks\nFEU2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU2\", lb=0) # fuel efficiency upgrade for Type2 trucks\nFEU3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU3\", lb=0) # fuel efficiency upgrade for Type3 trucks\n\n# Define objective function\nFC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1 # Fuel cost for Type1 trucks\nFC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2 # Fuel cost for Type2 trucks\nFC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3 # Fuel cost for Type3 trucks\nUC = 100 * (FEU1 + FEU2 + FEU3) # Upgrade cost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + UC)\n\n# Add constraints\nmodel.addCons(100 * (FEU1 + FEU2 + FEU3) <= 50000) # Budget constraint for upgrades\nmodel.addCons(T1 + T2 + T3 <= 100) # Total number of trucks constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type3 Trucks: \", model.getVal(T3))\n    print(\"Fuel Efficiency Upgrade for Type1: \", model.getVal(FEU1))\n    print(\"Fuel Efficiency Upgrade for Type2: \", model.getVal(FEU2))\n    print(\"Fuel Efficiency Upgrade for Type3: \", model.getVal(FEU3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1329,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for Small trucks\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Medium trucks\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Large trucks\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Extra-Large trucks\": \"MaintenanceExtraLarge\", \"range\": \"MaintenanceExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n// Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n// Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n// Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n// Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Maximize (RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20\n\n## Generate Constraint-3:\nThe company must have at least 2 Large trucks and no more than 5 Extra-Large trucks.\n// LargeTrucks >= 2; ExtraLargeTrucks <= 5",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance. The revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100. The total number of trucks cannot exceed 20. The company must have at least 2 Large trucks and no more than 5 Extra-Large trucks.\n\nPlease help the company to maximize the total revenue from all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)  # maintenance hours for Small trucks\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)  # maintenance hours for Medium trucks\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)  # maintenance hours for Large trucks\nMaintenanceExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceExtraLarge\", lb=0)  # maintenance hours for Extra-Large trucks\n\n# Define objective function\nRevenueSmall = (5000 + 0.02 * MaintenanceSmall) * SmallTrucks  # Total revenue for Small trucks\nRevenueMedium = (7000 + 0.03 * MaintenanceMedium) * MediumTrucks  # Total revenue for Medium trucks\nRevenueLarge = (9000 + 0.04 * MaintenanceLarge) * LargeTrucks  # Total revenue for Large trucks\nRevenueExtraLarge = (11000 + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks  # Total revenue for Extra-Large trucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20)\nmodel.addCons(LargeTrucks >= 2)\nmodel.addCons(ExtraLargeTrucks <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Maintenance Hours for Small Trucks: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Hours for Medium Trucks: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Hours for Large Trucks: \", model.getVal(MaintenanceLarge))\n    print(\"Maintenance Hours for Extra-Large Trucks: \", model.getVal(MaintenanceExtraLarge))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1266,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements.\n// Fuel_Small = (S * 20) / 5\n// Fuel_Medium = (M * 15) / 10\n// Fuel_Large = (L * 10) / 15\n// Fuel_ExtraLarge = (XL * 8) / 20\n// Fuel_Specialty = (Sp * 5) / 25\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe total weight of all deliveries must not exceed 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase up to 100 trucks in total.\n// S + M + L + XL + Sp <= 100\n\n## Generate Constraint-3:\nThe number of Specialty trucks cannot exceed 10% of the total number of trucks.\n// Sp <= 0.1 * (S + M + L + XL + Sp)",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. Each type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements. The total weight of all deliveries must not exceed 500 tons. The company has a budget to purchase up to 100 trucks in total. The number of Specialty trucks cannot exceed 10% of the total number of trucks. Please help the company to determine the optimal number of each type of truck to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialty trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Small = (S * 20) / 5\nFuel_Medium = (M * 15) / 10\nFuel_Large = (L * 10) / 15\nFuel_ExtraLarge = (XL * 8) / 20\nFuel_Specialty = (Sp * 5) / 25\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The total weight of all deliveries must not exceed 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500)\n## The company has a budget to purchase up to 100 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 100)\n## The number of Specialty trucks cannot exceed 10% of the total number of trucks.\nmodel.addCons(Sp <= 0.1 * (S + M + L + XL + Sp))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Specialty Trucks: \", model.getVal(Sp))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines.\n// {\"cargo weight in truck 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The company aims to minimize the total fuel cost.\n// Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\n// So, the objective function is: Minimize Total fuel cost\n\n## Generate Constraint-1:\nThe total weight of cargo to be delivered is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100",
        "question": "A logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines. The fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The total weight of cargo to be delivered is 100 tons. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1\", lb=0) # cargo weight in truck 1\nTruck2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2\", lb=0) # cargo weight in truck 2\nTruck3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3\", lb=0) # cargo weight in truck 3\nTruck4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4\", lb=0) # cargo weight in truck 4\nTruck5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5\", lb=0) # cargo weight in truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\nmodel.addCons(obj == 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5))\n\n# Add constraints\n## The total weight of cargo to be delivered is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo weight in Truck 1: \", model.getVal(Truck1))\n    print(\"Cargo weight in Truck 2: \", model.getVal(Truck2))\n    print(\"Cargo weight in Truck 3: \", model.getVal(Truck3))\n    print(\"Cargo weight in Truck 4: \", model.getVal(Truck4))\n    print(\"Cargo weight in Truck 5: \", model.getVal(Truck5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 673,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the costs and market demand. The production process involves both fixed and variable costs, and the demand for each product varies with its price.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"price of product A\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"real\"}\n// {\"price of product B\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"real\"}\n// {\"price of product C\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit for product A is given by (PriceA * ProductA) - (10 * ProductA + 500).\nThe profit for product B is given by (PriceB * ProductB) - (15 * ProductB + 1000).\nThe profit for product C is given by (PriceC * ProductC) - (20 * ProductC + 1500).\nThe company wants to maximize the total profit from all products.\n// TotalProfit = (PriceA * ProductA - 10 * ProductA - 500) + (PriceB * ProductB - 15 * ProductB - 1000) + (PriceC * ProductC - 20 * ProductC - 1500)\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $5000 per month.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC + 500 + 1000 + 1500 <= 5000\n\n## Generate Constraint-2:\nThe market demand for product A is PriceA^2 - 20*PriceA + 100 units.\nThe market demand for product B is PriceB^2 - 30*PriceB + 200 units.\nThe market demand for product C is PriceC^2 - 40*PriceC + 300 units.\nThe production quantities must meet or exceed the market demands.\n// ProductA >= PriceA^2 - 20*PriceA + 100\n// ProductB >= PriceB^2 - 30*PriceB + 200\n// ProductC >= PriceC^2 - 40*PriceC + 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the costs and market demand. The production process involves both fixed and variable costs, and the demand for each product varies with its price. The profit for each product is calculated based on the selling price minus the production costs, which include a fixed cost and a variable cost per unit. The company wants to maximize the total profit from all products.\n\n| Product | Fixed Cost | Variable Cost per Unit |\n|---------|------------|------------------------|\n| A       | 500        | 10                     |\n| B       | 1000       | 15                     |\n| C       | 1500       | 20                     |\n\nThe total production cost must not exceed $5000 per month. The market demand for each product is determined by a quadratic function of its price, as shown in the following table:\n\n| Product | Market Demand Function |\n|---------|------------------------|\n| A       | PriceA^2 - 20*PriceA + 100 |\n| B       | PriceB^2 - 30*PriceB + 200 |\n| C       | PriceC^2 - 40*PriceC + 300 |\n\nThe production quantities must meet or exceed the market demands. Please help the company determine the optimal production quantities and prices for products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0)  # price of product A\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0)  # price of product B\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0)  # price of product C\n\n# Define objective function\nTotalProfit = (PriceA * ProductA - 10 * ProductA - 500) + (PriceB * ProductB - 15 * ProductB - 1000) + (PriceC * ProductC - 20 * ProductC - 1500)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The total production cost must not exceed $5000 per month.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC + 500 + 1000 + 1500 <= 5000)\n## The market demand for product A is PriceA^2 - 20*PriceA + 100 units.\nmodel.addCons(ProductA >= PriceA**2 - 20*PriceA + 100)\n## The market demand for product B is PriceB^2 - 30*PriceB + 200 units.\nmodel.addCons(ProductB >= PriceB**2 - 30*PriceB + 200)\n## The market demand for product C is PriceC^2 - 40*PriceC + 300 units.\nmodel.addCons(ProductC >= PriceC**2 - 40*PriceC + 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Price of Product A: \", model.getVal(PriceA))\n    print(\"Price of Product B: \", model.getVal(PriceB))\n    print(\"Price of Product C: \", model.getVal(PriceC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1380,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each product is as follows: Product A earns $50, Product B earns $70, Product C earns $90, Product D earns $110, and Product E earns $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource limitations. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2. The company aims to maximize the net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited budget of $50,000 for production.\n// 50A + 70B + 90C + 110D + 130E <= 50000\n\n## Generate Constraint-2:\nThe warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters. Each unit of product A requires 1 cubic meter, product B requires 2 cubic meters, product C requires 3 cubic meters, product D requires 4 cubic meters, and product E requires 5 cubic meters.\n// A + 2B + 3C + 4D + 5E <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product A to meet contractual obligations.\n// A >= 100",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints. The profit per unit for each product is as follows: Product A earns $50, Product B earns $70, Product C earns $90, Product D earns $110, and Product E earns $130. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2. The company aims to maximize the net profit, which is the total revenue minus the total cost.\n\n| Product | Profit per Unit | Storage per Unit |\n|---------|-----------------|------------------|\n| A       | $50             | 1 cubic meter    |\n| B       | $70             | 2 cubic meters   |\n| C       | $90             | 3 cubic meters   |\n| D       | $110            | 4 cubic meters   |\n| E       | $130            | 5 cubic meters   |\n\nThe company has a limited budget of $50,000 for production. The warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters. The company must produce at least 100 units of product A to meet contractual obligations.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of product E\n\n# Define objective function\n## Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n## Total cost: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2\n## So, the objective function is: Maximize (Revenue - Cost)\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nE_sq = model.addVar(vtype=\"INTEGER\", name=\"E_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nmodel.addCons(D_sq == D**2)\nmodel.addCons(E_sq == E**2)\nCost = 1000 + 20*A_sq + 15*B_sq + 10*C_sq + 5*D_sq + 3*E_sq\nRevenue = 50*A + 70*B + 90*C + 110*D + 130*E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited budget of $50,000 for production.\nmodel.addCons(50*A + 70*B + 90*C + 110*D + 130*E <= 50000)\n## The warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters.\nmodel.addCons(A + 2*B + 3*C + 4*D + 5*E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3\n\n## Generate Constraint-2:\nThe company has a total fleet size of 50 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. Each route has a specific distance that must be covered: Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route. The company has a total fleet size of 50 trucks. The company wants to minimize the total fuel cost while ensuring all deliveries are made. Please help the company to determine the optimal number of trucks and fuel allocation for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for Route1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for Route2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n# The company has a total fleet size of 50 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced manufacturing technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n// Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n// Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n// Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\n// DeviceA <= 500; DeviceB <= 400; DeviceC <= 300",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device. The production cost per unit, selling price per unit, and production capacity for each device are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Production Capacity |\n|--------|--------------------------|------------------------|---------------------|\n| DeviceA | $100                     | $150                   | 500 units           |\n| DeviceB | $150                     | $200                   | 400 units           |\n| DeviceC | $200                     | $250                   | 300 units           |\n\nThe investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The company has a total budget of $100,000 for investment in advanced manufacturing technology. The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units. \n\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0, ub=500) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0, ub=400) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=300) # quantity of DeviceC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in advanced manufacturing technology\n\n# Define objective function\n## The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested.\n## Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n## Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n## Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\nProfit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\nProfit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in advanced manufacturing technology.\nmodel.addCons(TechInvestment <= 100000)\n## The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\nmodel.addCons(DeviceC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Investment in Technology: \", model.getVal(TechInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation.\n// Cost_T1 = 2 * T1\n// Cost_T2 = 3 * T2\n// Cost_T3 = 4 * T3\n// Cost_T4 = 5 * T4\n// Cost_T5 = 6 * T5\n// The objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe total demand for transportation is 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-4:\nThe company has a limit on the number of T3 trucks it can operate, which is 10.\n// T3 <= 10\n\n## Generate Constraint-5:\nThe company must operate at least 5 T1 trucks to cover short-distance routes.\n// T1 >= 5",
        "question": "A logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs. Each type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation. The total demand for transportation is 1000 tons. The company has a budget of $2000 for operational costs. The company can only operate a maximum of 50 trucks in total. The company has a limit on the number of T3 trucks it can operate, which is 10. The company must operate at least 5 T1 trucks to cover short-distance routes. Please help the company to minimize the total operational cost while meeting the demand for transportation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5)  # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0)  # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=10)  # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0)  # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0)  # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 2 * T1\nCost_T2 = 3 * T2\nCost_T3 = 4 * T3\nCost_T4 = 5 * T4\nCost_T5 = 6 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total demand for transportation is 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n## The company has a budget of $2000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000)\n## The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The company has a limit on the number of T3 trucks it can operate, which is 10.\nmodel.addCons(T3 <= 10)\n## The company must operate at least 5 T1 trucks to cover short-distance routes.\nmodel.addCons(T1 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company aims to maximize the total profit, considering both the selling profit and the storage costs over a week.\n// Selling profit of A: Profit_A = (50 - 20) * A - A\n// Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n// Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n// Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 5000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each device are produced.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company has a budget of $5000 for production costs. The company wants to ensure that at least 50 units of each device are produced.\nPlease help the company to maximize the total profit, considering both the selling profit and the storage costs over a week.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each device are produced.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\n\n# Define objective function\n## Selling profit of A: Profit_A = (50 - 20) * A - A\n## Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n## Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n## Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\nProfit_A = (50 - 20 - 1) * A\nProfit_B = (70 - 30 - 2) * B\nProfit_C = (90 - 40 - 3) * C\nProfit_D = (110 - 50 - 4) * D\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company has a total budget of $5000 for fuel costs. \n\nPlease help the company to minimize the total fuel cost while maximizing the total cargo carried, with the objective function defined as the ratio of the total fuel cost to the total cargo carried.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 20 liters of fuel per day and incurs a maintenance cost of $100 per day. \nEach truck on route 2 consumes 25 liters of fuel per day and incurs a maintenance cost of $120 per day. \nEach truck on route 3 consumes 30 liters of fuel per day and incurs a maintenance cost of $140 per day. \nEach truck on route 4 consumes 35 liters of fuel per day and incurs a maintenance cost of $160 per day. \nEach truck on route 5 consumes 40 liters of fuel per day and incurs a maintenance cost of $180 per day. \nThe company aims to minimize the total daily cost of fuel and maintenance across all routes.\n// Fuel_Cost = 20 * T1 + 25 * T2 + 30 * T3 + 35 * T4 + 40 * T5\n// Maintenance_Cost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Minimize (Fuel_Cost + Maintenance_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 35 trucks, and route 5 up to 40 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 35; T5 <= 40\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. The fuel consumption and maintenance costs per truck per day for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/day) | Maintenance Cost ($/day) |\n|-------|-------------------------------|--------------------------|\n| 1     | 20                            | 100                      |\n| 2     | 25                            | 120                      |\n| 3     | 30                            | 140                      |\n| 4     | 35                            | 160                      |\n| 5     | 40                            | 180                      |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 35 trucks, and route 5 up to 40 trucks. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n\nPlease help the company to minimize the total daily cost of fuel and maintenance across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks on route 5\n\n# Define objective function\n## Each truck on route 1 consumes 20 liters of fuel per day and incurs a maintenance cost of $100 per day.\n## Each truck on route 2 consumes 25 liters of fuel per day and incurs a maintenance cost of $120 per day.\n## Each truck on route 3 consumes 30 liters of fuel per day and incurs a maintenance cost of $140 per day.\n## Each truck on route 4 consumes 35 liters of fuel per day and incurs a maintenance cost of $160 per day.\n## Each truck on route 5 consumes 40 liters of fuel per day and incurs a maintenance cost of $180 per day.\nFuel_Cost = 20 * T1 + 25 * T2 + 30 * T3 + 35 * T4 + 40 * T5\nMaintenance_Cost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n## So, the objective function is: Minimize (Fuel_Cost + Maintenance_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 35 trucks, and route 5 up to 40 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 35)\nmodel.addCons(T5 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make between each pair of cities to minimize the total fuel consumption while meeting the demand for goods in each city.\n// {\"number of trips from city A to city B\": \"AB\", \"range\": \"AB >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city C\": \"AC\", \"range\": \"AC >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city D\": \"AD\", \"range\": \"AD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city A to city E\": \"AE\", \"range\": \"AE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city C\": \"BC\", \"range\": \"BC >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city D\": \"BD\", \"range\": \"BD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city B to city E\": \"BE\", \"range\": \"BE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city C to city D\": \"CD\", \"range\": \"CD >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city C to city E\": \"CE\", \"range\": \"CE >= 0\", \"type\": \"integer\"}\n// {\"number of trips from city D to city E\": \"DE\", \"range\": \"DE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried. The company aims to minimize the total fuel consumption.\n// Fuel_AB = k1 * AB^2 * d_AB\n// Fuel_AC = k1 * AC^2 * d_AC\n// Fuel_AD = k1 * AD^2 * d_AD\n// Fuel_AE = k1 * AE^2 * d_AE\n// Fuel_BC = k1 * BC^2 * d_BC\n// Fuel_BD = k1 * BD^2 * d_BD\n// Fuel_BE = k1 * BE^2 * d_BE\n// Fuel_CD = k1 * CD^2 * d_CD\n// Fuel_CE = k1 * CE^2 * d_CE\n// Fuel_DE = k1 * DE^2 * d_DE\n// So, the objective function is: Minimize (Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n\n## Generate Constraint-1:\nThe demand for goods in city A is 100 units, and each trip can carry 10 units.\n// AB + AC + AD + AE >= 10\n\n## Generate Constraint-2:\nThe demand for goods in city B is 150 units, and each trip can carry 10 units.\n// BC + BD + BE >= 15\n\n## Generate Constraint-3:\nThe demand for goods in city C is 200 units, and each trip can carry 10 units.\n// CD + CE >= 20\n\n## Generate Constraint-4:\nThe demand for goods in city D is 120 units, and each trip can carry 10 units.\n// AD + BD + CD + DE >= 12\n\n## Generate Constraint-5:\nThe demand for goods in city E is 180 units, and each trip can carry 10 units.\n// AE + BE + CE + DE >= 18",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make between each pair of cities to minimize the total fuel consumption while meeting the demand for goods in each city. The fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried. The demand for goods in city A is 100 units, and each trip can carry 10 units. The demand for goods in city B is 150 units, and each trip can carry 10 units. The demand for goods in city C is 200 units, and each trip can carry 10 units. The demand for goods in city D is 120 units, and each trip can carry 10 units. The demand for goods in city E is 180 units, and each trip can carry 10 units. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAB = model.addVar(vtype=\"INTEGER\", name=\"AB\", lb=0) # number of trips from city A to city B\nAC = model.addVar(vtype=\"INTEGER\", name=\"AC\", lb=0) # number of trips from city A to city C\nAD = model.addVar(vtype=\"INTEGER\", name=\"AD\", lb=0) # number of trips from city A to city D\nAE = model.addVar(vtype=\"INTEGER\", name=\"AE\", lb=0) # number of trips from city A to city E\nBC = model.addVar(vtype=\"INTEGER\", name=\"BC\", lb=0) # number of trips from city B to city C\nBD = model.addVar(vtype=\"INTEGER\", name=\"BD\", lb=0) # number of trips from city B to city D\nBE = model.addVar(vtype=\"INTEGER\", name=\"BE\", lb=0) # number of trips from city B to city E\nCD = model.addVar(vtype=\"INTEGER\", name=\"CD\", lb=0) # number of trips from city C to city D\nCE = model.addVar(vtype=\"INTEGER\", name=\"CE\", lb=0) # number of trips from city C to city E\nDE = model.addVar(vtype=\"INTEGER\", name=\"DE\", lb=0) # number of trips from city D to city E\n\n# Define objective function\n# The fuel consumption for each trip between cities is given by a nonlinear function that depends on the distance between cities and the load carried.\n# Fuel_AB = k1 * AB^2 * d_AB\n# Fuel_AC = k1 * AC^2 * d_AC\n# Fuel_AD = k1 * AD^2 * d_AD\n# Fuel_AE = k1 * AE^2 * d_AE\n# Fuel_BC = k1 * BC^2 * d_BC\n# Fuel_BD = k1 * BD^2 * d_BD\n# Fuel_BE = k1 * BE^2 * d_BE\n# Fuel_CD = k1 * CD^2 * d_CD\n# Fuel_CE = k1 * CE^2 * d_CE\n# Fuel_DE = k1 * DE^2 * d_DE\n# So, the objective function is: Minimize (Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_AB = AB**2\nFuel_AC = AC**2\nFuel_AD = AD**2\nFuel_AE = AE**2\nFuel_BC = BC**2\nFuel_BD = BD**2\nFuel_BE = BE**2\nFuel_CD = CD**2\nFuel_CE = CE**2\nFuel_DE = DE**2\nmodel.addCons(obj == Fuel_AB + Fuel_AC + Fuel_AD + Fuel_AE + Fuel_BC + Fuel_BD + Fuel_BE + Fuel_CD + Fuel_CE + Fuel_DE)\n\n# Add constraints\n# The demand for goods in city A is 100 units, and each trip can carry 10 units.\nmodel.addCons(AB + AC + AD + AE >= 10)\n# The demand for goods in city B is 150 units, and each trip can carry 10 units.\nmodel.addCons(BC + BD + BE >= 15)\n# The demand for goods in city C is 200 units, and each trip can carry 10 units.\nmodel.addCons(CD + CE >= 20)\n# The demand for goods in city D is 120 units, and each trip can carry 10 units.\nmodel.addCons(AD + BD + CD + DE >= 12)\n# The demand for goods in city E is 180 units, and each trip can carry 10 units.\nmodel.addCons(AE + BE + CE + DE >= 18)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips from city A to city B: \", model.getVal(AB))\n    print(\"Number of trips from city A to city C: \", model.getVal(AC))\n    print(\"Number of trips from city A to city D: \", model.getVal(AD))\n    print(\"Number of trips from city A to city E: \", model.getVal(AE))\n    print(\"Number of trips from city B to city C: \", model.getVal(BC))\n    print(\"Number of trips from city B to city D: \", model.getVal(BD))\n    print(\"Number of trips from city B to city E: \", model.getVal(BE))\n    print(\"Number of trips from city C to city D: \", model.getVal(CD))\n    print(\"Number of trips from city C to city E: \", model.getVal(CE))\n    print(\"Number of trips from city D to city E: \", model.getVal(DE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost.\n// The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n// Minimize (0.05 * T1^2 + 0.07 * T2^2 + 0.06 * T3^2 + 0.08 * T4^2 + 0.04 * T5^2 + 0.09 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost. The company has a total of 100 trucks available. Each warehouse can handle a maximum of 20 trucks.\nPlease help the company determine the optimal number of trucks to allocate to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_1 = 0.05 * T1**2\nCost_2 = 0.07 * T2**2\nCost_3 = 0.06 * T3**2\nCost_4 = 0.08 * T4**2\nCost_5 = 0.04 * T5**2\nCost_6 = 0.09 * T6**2\n## the objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\nmodel.addCons(obj == Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs.\n// {\"number of containers for air transport\": \"AirContainers\", \"range\": \"AirContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for sea transport\": \"SeaContainers\", \"range\": \"SeaContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for rail transport\": \"RailContainers\", \"range\": \"RailContainers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting a container via air is $500, via sea is $200, and via rail is $300. The efficiency of transportation is measured by the time taken to deliver goods, with air taking 1 day, sea taking 5 days, and rail taking 3 days. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n// Total cost: Cost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\n// Average delivery time: Time = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n// So, the objective function is: Minimize (Cost + Time)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for transportation costs.\n// 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10,000\n\n## Generate Constraint-2:\nThe total number of containers that can be transported is limited to 50.\n// AirContainers + SeaContainers + RailContainers <= 50\n\n## Generate Constraint-3:\nDue to safety regulations, the number of containers transported by air must not exceed 10.\n// AirContainers <= 10\n\n## Generate Constraint-4:\nThe company has a contractual obligation to transport at least 15 containers by sea.\n// SeaContainers >= 15",
        "question": "A logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs. The cost and delivery time for each mode of transportation are given in the following Table.\n\n| Mode        | Cost per Container | Delivery Time |\n|-------------|--------------------|---------------|\n| Air         | $500               | 1 day         |\n| Sea         | $200               | 5 days        |\n| Rail        | $300               | 3 days        |\n\nThe company has a budget of $10,000 for transportation costs. The total number of containers that can be transported is limited to 50. Due to safety regulations, the number of containers transported by air must not exceed 10. The company has a contractual obligation to transport at least 15 containers by sea. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n\nPlease help the company to minimize the total cost and average delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAirContainers = model.addVar(vtype=\"INTEGER\", name=\"AirContainers\", lb=0)  # number of containers for air transport\nSeaContainers = model.addVar(vtype=\"INTEGER\", name=\"SeaContainers\", lb=15)  # number of containers for sea transport\nRailContainers = model.addVar(vtype=\"INTEGER\", name=\"RailContainers\", lb=0)  # number of containers for rail transport\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\nDeliveryTime = AirContainers + 5 * SeaContainers + 3 * RailContainers\nTotalContainers = AirContainers + SeaContainers + RailContainers\n## the objective function is: Minimize (Cost + Time)\n## convert the division to multiplication\nmodel.addCons(obj * TotalContainers == Cost + DeliveryTime)\n\n# Add constraints\n## The company has a budget of $10,000 for transportation costs.\nmodel.addCons(500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10000)\n## The total number of containers that can be transported is limited to 50.\nmodel.addCons(AirContainers + SeaContainers + RailContainers <= 50)\n## Due to safety regulations, the number of containers transported by air must not exceed 10.\nmodel.addCons(AirContainers <= 10)\n## The company has a contractual obligation to transport at least 15 containers by sea.\nmodel.addCons(SeaContainers >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Containers: \", model.getVal(AirContainers))\n    print(\"Number of Sea Containers: \", model.getVal(SeaContainers))\n    print(\"Number of Rail Containers: \", model.getVal(RailContainers))\n    print(\"Minimized Cost and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and cargo capacity. TruckA has a fuel efficiency of 5 km/liter and a cargo capacity of 10 tons. TruckB has a fuel efficiency of 7 km/liter and a cargo capacity of 15 tons. TruckC has a fuel efficiency of 10 km/liter and a cargo capacity of 20 tons. TruckD has a fuel efficiency of 12 km/liter and a cargo capacity of 25 tons. TruckE has a fuel efficiency of 15 km/liter and a cargo capacity of 30 tons. The company wants to minimize the total fuel consumption while ensuring all cargo is delivered.\n// Total fuel consumption for TruckA: Fuel_TruckA = (Distance / 5) * TruckA\n// Total fuel consumption for TruckB: Fuel_TruckB = (Distance / 7) * TruckB\n// Total fuel consumption for TruckC: Fuel_TruckC = (Distance / 10) * TruckC\n// Total fuel consumption for TruckD: Fuel_TruckD = (Distance / 12) * TruckD\n// Total fuel consumption for TruckE: Fuel_TruckE = (Distance / 15) * TruckE\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 200 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200\n\n## Generate Constraint-2:\nThe company has a budget to maintain a maximum of 10 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 10",
        "question": "A logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints. The fuel efficiency and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Cargo Capacity (tons) |\n|------------|---------------------------|-----------------------|\n| TruckA     | 5                         | 10                    |\n| TruckB     | 7                         | 15                    |\n| TruckC     | 10                        | 20                    |\n| TruckD     | 12                        | 25                    |\n| TruckE     | 15                        | 30                    |\n\nThe total cargo to be delivered is 200 tons. The company has a budget to maintain a maximum of 10 trucks in total. Please help the company to minimize the total fuel consumption while ensuring all cargo is delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # Distance variable to handle division\n## Total fuel consumption for each type of truck\nFuel_TruckA = (Distance / 5) * TruckA\nFuel_TruckB = (Distance / 7) * TruckB\nFuel_TruckC = (Distance / 10) * TruckC\nFuel_TruckD = (Distance / 12) * TruckD\nFuel_TruckE = (Distance / 15) * TruckE\n## the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\nmodel.addCons(Distance == 1) # Ensuring Distance is 1 to simplify the objective\n\n# Add constraints\n## The total cargo to be delivered is 200 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200)\n## The company has a budget to maintain a maximum of 10 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location.\n// {\"number of solar panels at location 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n// Energy output from solar panels at location 1: E_S1 = S1 * (1 - 0.01 * S1)\n// Energy output from wind turbines at location 1: E_W1 = W1 * (1 - 0.02 * W1)\n// Energy output from solar panels at location 2: E_S2 = S2 * (1 - 0.01 * S2)\n// Energy output from wind turbines at location 2: E_W2 = W2 * (1 - 0.02 * W2)\n// Energy output from solar panels at location 3: E_S3 = S3 * (1 - 0.01 * S3)\n// Energy output from wind turbines at location 3: E_W3 = W3 * (1 - 0.02 * W3)\n// Energy output from solar panels at location 4: E_S4 = S4 * (1 - 0.01 * S4)\n// Energy output from wind turbines at location 4: E_W4 = W4 * (1 - 0.02 * W4)\n// Energy output from solar panels at location 5: E_S5 = S5 * (1 - 0.01 * S5)\n// Energy output from wind turbines at location 5: E_W5 = W5 * (1 - 0.02 * W5)\n// So, the objective function is: Maximize E_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000.\n// 1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location. The efficiency of solar panels decreases with the number of panels installed at a location due to shading effects, and the efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n\n| Location | Solar Panels Efficiency | Wind Turbines Efficiency |\n|----------|-------------------------|--------------------------|\n| 1        | 1 - 0.01 * S1           | 1 - 0.02 * W1            |\n| 2        | 1 - 0.01 * S2           | 1 - 0.02 * W2            |\n| 3        | 1 - 0.01 * S3           | 1 - 0.02 * W3            |\n| 4        | 1 - 0.01 * S4           | 1 - 0.02 * W4            |\n| 5        | 1 - 0.01 * S5           | 1 - 0.02 * W5            |\n\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000. Please help the company to maximize the total energy output while staying within the budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at location 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines at location 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at location 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines at location 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at location 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines at location 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at location 4\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of wind turbines at location 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at location 5\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## Energy output from solar panels and wind turbines\nE_S1 = S1 * (1 - 0.01 * S1)\nE_W1 = W1 * (1 - 0.02 * W1)\nE_S2 = S2 * (1 - 0.01 * S2)\nE_W2 = W2 * (1 - 0.02 * W2)\nE_S3 = S3 * (1 - 0.01 * S3)\nE_W3 = W3 * (1 - 0.02 * W3)\nE_S4 = S4 * (1 - 0.01 * S4)\nE_W4 = W4 * (1 - 0.02 * W4)\nE_S5 = S5 * (1 - 0.01 * S5)\nE_W5 = W5 * (1 - 0.02 * W5)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize E_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\nmodel.addCons(obj == E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5)\n\n# Add constraints\n## The company has a budget of $500,000 for installation.\nmodel.addCons(1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(W3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(S4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(W4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(S5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(W5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to ensure adequate coverage.\n// Trucks1 >= 10; Trucks2 >= 10; Trucks3 >= 10; Trucks4 >= 10; Trucks5 >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Trucks Required | Fuel Budget |\n|--------|-----------------|-------------|\n| Region1 | Trucks1 >= 10 | FuelBudget1 |\n| Region2 | Trucks2 >= 10 | FuelBudget2 |\n| Region3 | Trucks3 >= 10 | FuelBudget3 |\n| Region4 | Trucks4 >= 10 | FuelBudget4 |\n| Region5 | Trucks5 >= 10 | FuelBudget5 |\n\nThe total fuel budget across all regions must not exceed $100,000. Each region must have at least 10 trucks to ensure adequate coverage.\n\nPlease help the company to determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 10 trucks to ensure adequate coverage.\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10) # trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10) # trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=10) # trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=10) # trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=10) # trucks in Region5\n\n## Fuel budget for each region\nFuelBudget1 = model.addVar(name=\"FuelBudget1\") # fuel budget for Region1\nFuelBudget2 = model.addVar(name=\"FuelBudget2\") # fuel budget for Region2\nFuelBudget3 = model.addVar(name=\"FuelBudget3\") # fuel budget for Region3\nFuelBudget4 = model.addVar(name=\"FuelBudget4\") # fuel budget for Region4\nFuelBudget5 = model.addVar(name=\"FuelBudget5\") # fuel budget for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\nFuelCost1 = (FuelBudget1 / Trucks1)**2\nFuelCost2 = (FuelBudget2 / Trucks2)**2\nFuelCost3 = (FuelBudget3 / Trucks3)**2\nFuelCost4 = (FuelBudget4 / Trucks4)**2\nFuelCost5 = (FuelBudget5 / Trucks5)**2\n\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Residential\": \"TechUpgradeResidential\", \"range\": \"TechUpgradeResidential >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Commercial\": \"TechUpgradeCommercial\", \"range\": \"TechUpgradeCommercial >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Industrial\": \"TechUpgradeIndustrial\", \"range\": \"TechUpgradeIndustrial >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output efficiency of solar panels increases with technology upgrades. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. The company aims to maximize the total energy output from all farms.\n// EnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\n// EnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\n// EnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n// So, the objective function is: Maximize (EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000\n\n## Generate Constraint-2:\nThe total area available for installing solar panels across all types of farms is limited to 5000 square meters. Each Residential panel requires 1 square meter, each Commercial panel requires 2 square meters, and each Industrial panel requires 3 square meters.\n// ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The company aims to maximize the total energy output from all farms.\n\n| Farm Type       | Initial Energy Output per Panel | Panel Area Requirement |\n|-----------------|--------------------------------|-----------------------|\n| Residential     | 200 kWh                         | 1 square meter        |\n| Commercial      | 300 kWh                         | 2 square meters       |\n| Industrial      | 400 kWh                         | 3 square meters       |\n\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades. The total area available for installing solar panels across all types of farms is limited to 5000 square meters. Each Residential panel requires 1 square meter, each Commercial panel requires 2 square meters, and each Industrial panel requires 3 square meters.\n\nPlease help the company determine the optimal number of solar panels and technology upgrades for each type of farm to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nTechUpgradeResidential = model.addVar(name=\"TechUpgradeResidential\", lb=0)\nTechUpgradeCommercial = model.addVar(name=\"TechUpgradeCommercial\", lb=0)\nTechUpgradeIndustrial = model.addVar(name=\"TechUpgradeIndustrial\", lb=0)\n\n# Define objective function\nEnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\nEnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\nEnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000)\nmodel.addCons(ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Technology Upgrade for Residential: \", model.getVal(TechUpgradeResidential))\n    print(\"Technology Upgrade for Commercial: \", model.getVal(TechUpgradeCommercial))\n    print(\"Technology Upgrade for Industrial: \", model.getVal(TechUpgradeIndustrial))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1506,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production. Additionally, the company must determine the number of hours of maintenance each machine requires daily.\n// {\"number of operating hours for MachineA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n// Net revenue for MachineA: RevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\n// Net revenue for MachineB: RevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\n// Net revenue for MachineC: RevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total daily operating hours for all machines must not exceed 24 hours.\n// HoursA + HoursB + HoursC <= 24\n\n## Generate Constraint-2:\nThe total daily maintenance hours for all machines must not exceed 8 hours.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 8\n\n## Generate Constraint-3:\nMachineA must operate at least 2 hours daily.\n// HoursA >= 2\n\n## Generate Constraint-4:\nMachineB and MachineC combined must not operate more than 16 hours daily.\n// HoursB + HoursC <= 16\n\n## Generate Constraint-5:\nThe maintenance hours for MachineC must be at least half of its operating hours.\n// MaintenanceC >= 0.5 * HoursC",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production and the number of hours of maintenance each machine requires daily. Each hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n\nThe total daily operating hours for all machines must not exceed 24 hours. The total daily maintenance hours for all machines must not exceed 8 hours. MachineA must operate at least 2 hours daily. MachineB and MachineC combined must not operate more than 16 hours daily. The maintenance hours for MachineC must be at least half of its operating hours.\n\nPlease help the company to maximize the total net revenue per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of operating hours for MachineA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of operating hours for MachineB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of operating hours for MachineC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # number of maintenance hours for MachineA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # number of maintenance hours for MachineB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # number of maintenance hours for MachineC\n\n# Define objective function\nRevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\nRevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\nRevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 24) # total daily operating hours for all machines must not exceed 24 hours\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 8) # total daily maintenance hours for all machines must not exceed 8 hours\nmodel.addCons(HoursA >= 2) # MachineA must operate at least 2 hours daily\nmodel.addCons(HoursB + HoursC <= 16) # MachineB and MachineC combined must not operate more than 16 hours daily\nmodel.addCons(MaintenanceC >= 0.5 * HoursC) # maintenance hours for MachineC must be at least half of its operating hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for MachineA: \", model.getVal(HoursA))\n    print(\"Operating Hours for MachineB: \", model.getVal(HoursB))\n    print(\"Operating Hours for MachineC: \", model.getVal(HoursC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, and the production cost per unit is $50. For ProductB, the profit per unit is $120, and the production cost per unit is $60. For ProductC, the profit per unit is $150, and the production cost per unit is $75. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\n// ProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\n// ProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe demand for ProductA is at least 1000 units.\n// QA >= 1000\n\n## Generate Constraint-4:\nThe company must produce at least twice as many units of ProductB as ProductC.\n// QB >= 2 * QC\n\n## Generate Constraint-5:\nThe investment in new technology must not exceed 50% of the total profit from the previous year.\n// TechInvestment <= 0.5 * (100 * QA_prev + 120 * QB_prev + 150 * QC_prev)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $100            | $50                      |\n| ProductB | $120            | $60                      |\n| ProductC | $150            | $75                      |\n\nThe new technology reduces the production cost per unit by $5 for every $10,000 invested. The company has a budget of $100,000 for the investment in new technology. The total production capacity of the company is 5000 units. The demand for ProductA is at least 1000 units. The company must produce at least twice as many units of ProductB as ProductC. The investment in new technology must not exceed 50% of the total profit from the previous year.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=1000)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\")  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\")  # quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\nProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\nProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(TechInvestment <= 100000)  # budget constraint for technology investment\nmodel.addCons(QA + QB + QC <= 5000)  # total production capacity constraint\nmodel.addCons(QB >= 2 * QC)  # production ratio constraint between ProductB and ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. \nOn route 1, each additional truck improves fuel efficiency by 0.5% per mile. \nOn route 2, each additional truck improves fuel efficiency by 0.7% per mile. \nOn route 3, each additional truck improves fuel efficiency by 0.6% per mile. \nOn route 4, each additional truck improves fuel efficiency by 0.8% per mile. \nOn route 5, each additional truck improves fuel efficiency by 0.4% per mile. \nThe company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time.\n// Fuel_Consumption_Route_1 = (1 - 0.005 * T1) * D1\n// Fuel_Consumption_Route_2 = (1 - 0.007 * T2) * D2\n// Fuel_Consumption_Route_3 = (1 - 0.006 * T3) * D3\n// Fuel_Consumption_Route_4 = (1 - 0.008 * T4) * D4\n// Fuel_Consumption_Route_5 = (1 - 0.004 * T5) * D5\n// So, the objective function is: Minimize (Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1\n\n## Generate Constraint-3:\nThe maximum number of trucks that can be assigned to each route is limited by the route's capacity.\n// T1 <= 30; T2 <= 25; T3 <= 20; T4 <= 15; T5 <= 10",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. The fuel efficiency of each route varies with the number of trucks assigned. On route 1, each additional truck improves fuel efficiency by 0.5% per mile. On route 2, each additional truck improves fuel efficiency by 0.7% per mile. On route 3, each additional truck improves fuel efficiency by 0.6% per mile. On route 4, each additional truck improves fuel efficiency by 0.8% per mile. On route 5, each additional truck improves fuel efficiency by 0.4% per mile. The company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time. The total number of trucks available is 100. Each route must have at least one truck. The maximum number of trucks that can be assigned to each route is limited by the route's capacity, with route 1 limited to 30 trucks, route 2 to 25 trucks, route 3 to 20 trucks, route 4 to 15 trucks, and route 5 to 10 trucks. Please help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least one truck.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel_Consumption_Route_1 = (1 - 0.005 * T1) * D1\n## Fuel_Consumption_Route_2 = (1 - 0.007 * T2) * D2\n## Fuel_Consumption_Route_3 = (1 - 0.006 * T3) * D3\n## Fuel_Consumption_Route_4 = (1 - 0.008 * T4) * D4\n## Fuel_Consumption_Route_5 = (1 - 0.004 * T5) * D5\n## So, the objective function is: Minimize (Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\nmodel.addCons(obj == (1 - 0.005 * T1) + (1 - 0.007 * T2) + (1 - 0.006 * T3) + (1 - 0.008 * T4) + (1 - 0.004 * T5))\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The maximum number of trucks that can be assigned to each route is limited by the route's capacity.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit, which is the difference between the revenue and the production cost.\n// Total profit: Profit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint that limits the total production to no more than 800 units.\n// ProductA + ProductB + ProductC <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to fulfill a contractual obligation.\n// ProductC >= 50\n\n## Generate Constraint-5:\nDue to labor constraints, the total production cannot exceed 700 units.\n// ProductA + ProductB + ProductC <= 700",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50             | $30                      |\n| ProductB | $70             | $40                      |\n| ProductC | $60             | $35                      |\n\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductB must be at least twice the production of ProductA. The company has a storage capacity constraint that limits the total production to no more than 800 units. The company must produce at least 50 units of ProductC to fulfill a contractual obligation. Due to labor constraints, the total production cannot exceed 700 units.\n\nPlease help the company to maximize the total profit, which is the difference between the revenue and the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50) # number of units of ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\nProfit = (50 - 30) * ProductA + (70 - 40) * ProductB + (60 - 35) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n## Due to market demand, the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductB >= 2 * ProductA)\n## The company has a storage capacity constraint that limits the total production to no more than 800 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 800)\n## The company must produce at least 50 units of ProductC to fulfill a contractual obligation.\nmodel.addCons(ProductC >= 50)\n## Due to labor constraints, the total production cannot exceed 700 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to minimize fuel consumption and travel time while meeting delivery deadlines.\n// {\"trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each truck is a nonlinear function of the distance and load. For D1, the fuel consumption is modeled as 0.5 * T1^2 + 10 * T1. For D2, it's 0.6 * T2^2 + 12 * T2. For D3, it's 0.7 * T3^2 + 14 * T3. For D4, it's 0.8 * T4^2 + 16 * T4. For D5, it's 0.9 * T5^2 + 18 * T5. The company wants to minimize the total fuel consumption.\n// So, the objective function is: Minimize (0.5 * T1^2 + 10 * T1 + 0.6 * T2^2 + 12 * T2 + 0.7 * T3^2 + 14 * T3 + 0.8 * T4^2 + 16 * T4 + 0.9 * T5^2 + 18 * T5)\n\n## Generate Constraint-1:\nThe company has a total fleet size of 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to minimize fuel consumption and travel time while meeting delivery deadlines. The fuel consumption for each truck is a nonlinear function of the distance and load, as shown in the following Table.\n\n| Destination | Fuel Consumption Formula |\n|-------------|--------------------------|\n| D1          | 0.5 * T1^2 + 10 * T1     |\n| D2          | 0.6 * T2^2 + 12 * T2     |\n| D3          | 0.7 * T3^2 + 14 * T3     |\n| D4          | 0.8 * T4^2 + 16 * T4     |\n| D5          | 0.9 * T5^2 + 18 * T5     |\n\nThe company has a total fleet size of 50 trucks. Please help the company to minimize the total fuel consumption while ensuring that the total number of trucks assigned to all destinations does not exceed 50.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * T1^2 + 10 * T1 + 0.6 * T2^2 + 12 * T2 + 0.7 * T3^2 + 14 * T3 + 0.8 * T4^2 + 16 * T4 + 0.9 * T5^2 + 18 * T5)\nmodel.addCons(obj == 0.5 * T1**2 + 10 * T1 + 0.6 * T2**2 + 12 * T2 + 0.7 * T3**2 + 14 * T3 + 0.8 * T4**2 + 16 * T4 + 0.9 * T5**2 + 18 * T5)\n\n# Add constraints\n## The company has a total fleet size of 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 862,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $10, and the production cost per unit is $5. \nFor Device B, the profit per unit is $15, and the production cost per unit is $7. \nFor Device C, the profit per unit is $20, and the production cost per unit is $9.\nFor Device D, the profit per unit is $25, and the production cost per unit is $11.\nFor Device E, the profit per unit is $30, and the production cost per unit is $13.\nThe company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity.\n// Profit_A = (10 - 5) * A\n// Profit_B = (15 - 7) * B\n// Profit_C = (20 - 9) * C\n// Profit_D = (25 - 11) * D\n// Profit_E = (30 - 13) * E\n// Penalty_Cost = k * (A + B + C + D + E)^2, where k is a constant (e.g., k = 0.001)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for production costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 10 units of each device.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. For Device A, the profit per unit is $10, and the production cost per unit is $5. For Device B, the profit per unit is $15, and the production cost per unit is $7. For Device C, the profit per unit is $20, and the production cost per unit is $9. For Device D, the profit per unit is $25, and the production cost per unit is $11. For Device E, the profit per unit is $30, and the production cost per unit is $13. The company has a budget of $1000 for production costs. The company wants to produce at least 10 units of each device. The company aims to maximize the total profit, which is the sum of the profits from selling all devices minus a penalty cost that increases quadratically with the total production quantity. Please help the company to determine the optimal production quantities for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # quantity of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 - 5) * A\nProfit_B = (15 - 7) * B\nProfit_C = (20 - 9) * C\nProfit_D = (25 - 11) * D\nProfit_E = (30 - 13) * E\nTotalProduction = A + B + C + D + E\nPenalty_Cost = 0.001 * TotalProduction**2\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Penalty_Cost)\n\n# Add constraints\n## The company has a budget of $1000 for production costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made.\n// Fuel consumption for Route1: Consumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\n// Fuel consumption for Route2: Consumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and technology investments.\n// Fuel1 + Fuel2 + Investment <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-3:\nEach route must be completed with a minimum of 5 trucks.\n// Trucks1 >= 5; Trucks2 >= 5\n\n## Generate Constraint-4:\nThe total fuel consumption must not exceed 10,000 liters.\n// Consumption1 + Consumption2 <= 10000\n\n## Generate Constraint-5:\nThe investment in fuel-efficient technology cannot exceed 20% of the total budget.\n// Investment <= 0.2 * (Fuel1 + Fuel2 + Investment)",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet. The fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made. The company has a budget of $100,000 for fuel and technology investments. The total number of trucks available for all routes is limited to 50. Each route must be completed with a minimum of 5 trucks. The total fuel consumption must not exceed 10,000 liters. The investment in fuel-efficient technology cannot exceed 20% of the total budget. Please help the company to determine the optimal number of trucks and amount of fuel for each route, as well as the investment in the fuel-efficient technology.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\")  # amount of fuel for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\")  # amount of fuel for Route2\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\")  # investment in fuel-efficient technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\nConsumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n## the objective function is: Minimize (Consumption1 + Consumption2)\n## convert the division to multiplication\nmodel.addCons(obj * (1 - 0.01 * Investment) * Trucks1 == Fuel1 * Trucks1)\nmodel.addCons(obj * (1 - 0.01 * Investment) * Trucks2 == Fuel2 * Trucks2)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and technology investments.\nmodel.addCons(Fuel1 + Fuel2 + Investment <= 100000)\n## The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n## The total fuel consumption must not exceed 10,000 liters.\nmodel.addCons(Consumption1 + Consumption2 <= 10000)\n## The investment in fuel-efficient technology cannot exceed 20% of the total budget.\nmodel.addCons(Investment <= 0.2 * (Fuel1 + Fuel2 + Investment))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Amount of Fuel for Route1: \", model.getVal(Fuel1))\n    print(\"Amount of Fuel for Route2: \", model.getVal(Fuel2))\n    print(\"Investment in Fuel-Efficient Technology: \", model.getVal(Investment))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceA production line\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceB production line\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceC production line\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the production cost per unit is $100, the selling price per unit is $150, and the production rate is 5 units per worker per day.\nFor DeviceB, the production cost per unit is $120, the selling price per unit is $180, and the production rate is 4 units per worker per day.\nFor DeviceC, the production cost per unit is $140, the selling price per unit is $200, and the production rate is 3 units per worker per day.\nThe company wants to maximize the total daily profit.\n// Profit_A = UnitsA * (150 - 100)\n// Profit_B = UnitsB * (180 - 120)\n// Profit_C = UnitsC * (200 - 140)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 20 workers available.\n// WorkersA + WorkersB + WorkersC <= 20\n\n## Generate Constraint-2:\nThe production capacity for each device is limited by the number of workers and the production rate.\n// UnitsA <= 5 * WorkersA\n// UnitsB <= 4 * WorkersB\n// UnitsC <= 3 * WorkersC",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line. For DeviceA, the production cost per unit is $100, the selling price per unit is $150, and the production rate is 5 units per worker per day. For DeviceB, the production cost per unit is $120, the selling price per unit is $180, and the production rate is 4 units per worker per day. For DeviceC, the production cost per unit is $140, the selling price per unit is $200, and the production rate is 3 units per worker per day. The company has a total of 20 workers available. The production capacity for each device is limited by the number of workers and the production rate. The company wants to maximize the total daily profit. Please help the company determine the optimal number of units to produce for each device and the optimal allocation of workers to each production line.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for DeviceA production line\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for DeviceB production line\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for DeviceC production line\n\n# Define objective function\nProfit_A = UnitsA * (150 - 100)\nProfit_B = UnitsB * (180 - 120)\nProfit_C = UnitsC * (200 - 140)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 20)\nmodel.addCons(UnitsA <= 5 * WorkersA)\nmodel.addCons(UnitsB <= 4 * WorkersB)\nmodel.addCons(UnitsC <= 3 * WorkersC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for DeviceA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for DeviceB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for DeviceC: \", model.getVal(WorkersC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each capable of producing these components. The decision variables are the number of workers assigned to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 produces 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker produces 12 units of A, 18 units of B, and 22 units of C per hour. In production unit 3, each worker produces 14 units of A, 20 units of B, and 24 units of C per hour. In production unit 4, each worker produces 16 units of A, 22 units of B, and 26 units of C per hour. The company aims to maximize the total production of all components.\n// The production of component A: PA = 10 * W1 + 12 * W2 + 14 * W3 + 16 * W4\n// The production of component B: PB = 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4\n// The production of component C: PC = 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4\n// The objective function is: Maximize (PA + PB + PC)\n// Maximize (10 * W1 + 12 * W2 + 14 * W3 + 16 * W4 + 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4 + 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4)\n\n## Generate Constraint-1:\nThe total number of workers available across all production units is 100.\n// W1 + W2 + W3 + W4 <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each capable of producing these components. The decision variables are the number of workers assigned to each production unit. Each worker in production unit 1 produces 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker produces 12 units of A, 18 units of B, and 22 units of C per hour. In production unit 3, each worker produces 14 units of A, 20 units of B, and 24 units of C per hour. In production unit 4, each worker produces 16 units of A, 22 units of B, and 26 units of C per hour. The company aims to maximize the total production of all components. The total number of workers available across all production units is 100. Please help the company determine the optimal number of workers to assign to each production unit to maximize the total production of components A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on production unit 4\n\n# Define objective function\nPA = 10 * W1 + 12 * W2 + 14 * W3 + 16 * W4 # production of component A\nPB = 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4 # production of component B\nPC = 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4 # production of component C\n# The objective function is: Maximize (PA + PB + PC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total number of workers available across all production units is 100.\nmodel.addCons(W1 + W2 + W3 + W4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production unit 1: \", model.getVal(W1))\n    print(\"Number of workers on production unit 2: \", model.getVal(W2))\n    print(\"Number of workers on production unit 3: \", model.getVal(W3))\n    print(\"Number of workers on production unit 4: \", model.getVal(W4))\n    print(\"Total production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 993,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many vehicles of each type to deploy for the upcoming quarter. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will affect the operational costs and fuel efficiency of each vehicle.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for TruckA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle decreases with the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost per kilometer decreases by $0.1 for TruckA, $0.15 for TruckB, and $0.2 for TruckC. The company aims to minimize the total operational cost of all vehicles.\n// Operational cost per kilometer for TruckA: CostA = (0.5 - 0.0001 * TechA) * TruckA\n// Operational cost per kilometer for TruckB: CostB = (0.6 - 0.00015 * TechB) * TruckB\n// Operational cost per kilometer for TruckC: CostC = (0.7 - 0.0002 * TechC) * TruckC\n// Total operational cost: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle deployment and technology investments.\n// TruckA + TruckB + TruckC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles that can be deployed is limited to 500.\n// TruckA + TruckB + TruckC <= 500",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many vehicles of each type to deploy for the upcoming quarter and how much to invest in fuel-efficient technologies for each type of vehicle. The operational cost of each vehicle decreases with the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost per kilometer decreases by $0.1 for TruckA, $0.15 for TruckB, and $0.2 for TruckC. The company aims to minimize the total operational cost of all vehicles. The company has a total budget of $100,000 for vehicle deployment and technology investments. The total number of vehicles that can be deployed is limited to 500. Please help the company determine the optimal number of vehicles of each type and the investment in fuel-efficient technologies to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0) # investment in fuel-efficient technology for TruckA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0) # investment in fuel-efficient technology for TruckB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0) # investment in fuel-efficient technology for TruckC\n\n# Define objective function\nCostA = (0.5 - 0.0001 * TechA) * TruckA\nCostB = (0.6 - 0.00015 * TechB) * TruckB\nCostC = (0.7 - 0.0002 * TechC) * TruckC\n# Total operational cost: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $100,000 for vehicle deployment and technology investments.\nmodel.addCons(TruckA + TruckB + TruckC + TechA + TechB + TechC <= 100000)\n# The total number of vehicles that can be deployed is limited to 500.\nmodel.addCons(TruckA + TruckB + TruckC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in TechA: \", model.getVal(TechA))\n    print(\"Investment in TechB: \", model.getVal(TechB))\n    print(\"Investment in TechC: \", model.getVal(TechC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to determine how many units of each component to produce in the next month to optimize their production strategy.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor ComponentA, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per month. \nFor ComponentB, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per month. \nFor ComponentC, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per month.\nFor ComponentD, the selling price is $60, the production cost is $35, and the storage cost is $6 per unit per month.\nFor ComponentE, the selling price is $80, the production cost is $45, and the storage cost is $8 per unit per month.\nThe company aims to maximize the total profit, which is defined as the sum of the selling profit minus the sum of the storage costs.\n// Selling profit of A: Profit_A = (50 - 30) * A\n// Selling profit of B: Profit_B = (70 - 40) * B\n// Selling profit of C: Profit_C = (90 - 50) * C\n// Selling profit of D: Profit_D = (60 - 35) * D\n// Selling profit of E: Profit_E = (80 - 45) * E\n// Storage cost of A: Storage_A = 5 * A\n// Storage cost of B: Storage_B = 7 * B\n// Storage cost of C: Storage_C = 9 * C\n// Storage cost of D: Storage_D = 6 * D\n// Storage cost of E: Storage_E = 8 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Storage_A - Storage_B - Storage_C - Storage_D - Storage_E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production costs for the month.\n// 30 * A + 40 * B + 50 * C + 35 * D + 45 * E <= 15,000",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to determine how many units of each component to produce in the next month to optimize their production strategy. The selling price, production cost, and storage cost per unit per month for each component are given in the following Table.\n\n| Component | Selling Price | Production Cost | Storage Cost per Unit per Month |\n|-----------|---------------|-----------------|---------------------------------|\n| ComponentA | $50           | $30             | $5                              |\n| ComponentB | $70           | $40             | $7                              |\n| ComponentC | $90           | $50             | $9                              |\n| ComponentD | $60           | $35             | $6                              |\n| ComponentE | $80           | $45             | $8                              |\n\nThe company aims to maximize the total profit, which is defined as the sum of the selling profit minus the sum of the storage costs. The company has a budget of $15,000 for production costs for the month.\n\nPlease help the company to determine the optimal number of units to produce for each component to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 30) * A\nProfit_B = (70 - 40) * B\nProfit_C = (90 - 50) * C\nProfit_D = (60 - 35) * D\nProfit_E = (80 - 45) * E\nStorage_A = 5 * A\nStorage_B = 7 * B\nStorage_C = 9 * C\nStorage_D = 6 * D\nStorage_E = 8 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Storage_A - Storage_B - Storage_C - Storage_D - Storage_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E - Storage_A - Storage_B - Storage_C - Storage_D - Storage_E)\n\n# Add constraints\n## The company has a budget of $15,000 for production costs for the month.\nmodel.addCons(30 * A + 40 * B + 50 * C + 35 * D + 45 * E <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced manufacturing technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n// Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n// Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n// Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\n// DeviceA <= 500; DeviceB <= 400; DeviceC <= 300\n\n## Generate Constraint-3:\nThe total production quantity of all devices must not exceed 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device. The production cost per unit, selling price per unit, and production capacity for each device are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Production Capacity |\n|--------|--------------------------|------------------------|---------------------|\n| DeviceA | $100                     | $150                   | 500 units           |\n| DeviceB | $150                     | $200                   | 400 units           |\n| DeviceC | $200                     | $250                   | 300 units           |\n\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology. The production capacity for each device is limited as shown in the table. The total production quantity of all devices must not exceed 1000 units. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. \n\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0, ub=500) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0, ub=400) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=300) # quantity of DeviceC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in advanced manufacturing technology\n\n# Define objective function\n## The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested.\n## Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n## Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n## Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\nProfit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\nProfit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in advanced manufacturing technology.\nmodel.addCons(TechInvestment <= 100000)\n## The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\nmodel.addCons(DeviceC <= 300)\n## The total production quantity of all devices must not exceed 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Investment in Technology: \", model.getVal(TechInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1363,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $10,000 invested in new technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechnologyInvestment) * ProductA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechnologyInvestment) * ProductB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechnologyInvestment) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 10,000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe investment in new technology cannot exceed $50,000.\n// TechnologyInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product. The cost of production per unit decreases by $5 for every $10,000 invested in new technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products. The total resources available for production are limited to 10,000 units. The investment in new technology cannot exceed $50,000. Please help the company to determine the optimal production quantities and resource allocations to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfitA = (200 - 100 + 0.0005 * TechnologyInvestment) * ProductA\nProfitB = (250 - 150 + 0.0005 * TechnologyInvestment) * ProductB\nProfitC = (300 - 200 + 0.0005 * TechnologyInvestment) * ProductC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in New Technology: \", model.getVal(TechnologyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations.\n// {\"trips of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"trips of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for Truck A is $1000, and it can carry 10 tons of goods. For Truck B, the cost per trip is $1500, and it can carry 15 tons of goods. For Truck C, the cost per trip is $2000, and it can carry 20 tons of goods. The company wants to minimize the total cost of transportation while ensuring all goods are delivered.\n// Cost_A = 1000 * A\n// Cost_B = 1500 * B\n// Cost_C = 2000 * C\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total weight of goods to be transported is 600 tons.\n// 10 * A + 15 * B + 20 * C >= 600",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of trips for each vehicle to optimize their operations. The cost per trip and the carrying capacity for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Carrying Capacity |\n|---------|---------------|-------------------|\n| Truck A | $1000         | 10 tons           |\n| Truck B | $1500         | 15 tons           |\n| Truck C | $2000         | 20 tons           |\n\nThe total weight of goods to be transported is 600 tons. The company wants to minimize the total cost of transportation while ensuring all goods are delivered. Please help the company determine the optimal number of trips for each vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # trips of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # trips of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # trips of Truck C\n\n# Define objective function\nCost_A = 1000 * A\nCost_B = 1500 * B\nCost_C = 2000 * C\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total weight of goods to be transported is 600 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips of Truck A: \", model.getVal(A))\n    print(\"Trips of Truck B: \", model.getVal(B))\n    print(\"Trips of Truck C: \", model.getVal(C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good. Additionally, the company needs to decide on the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit.\n// {\"number of units of GoodsA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for GoodsA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe transportation cost per unit decreases with the investment in fuel efficiency for each type of good.\nThe initial cost per unit of GoodsA is $30, but with fuel efficiency upgrades, the cost decreases by $1 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsB is $40, and with fuel efficiency upgrades, the cost decreases by $1.5 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsC is $50, and with fuel efficiency upgrades, the cost decreases by $2 per unit for every $100 invested in efficiency. \nThe company aims to minimize the total transportation cost from all goods.\n// Total cost for GoodsA: CostA = (30 - 0.01 * EfficiencyA) * UnitsA\n// Total cost for GoodsB: CostB = (40 - 0.015 * EfficiencyB) * UnitsB\n// Total cost for GoodsC: CostC = (50 - 0.02 * EfficiencyC) * UnitsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000",
        "question": "A logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good and the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit. The transportation cost per unit decreases with the investment in fuel efficiency for each type of good. The initial cost per unit of GoodsA is $30, but with fuel efficiency upgrades, the cost decreases by $1 per unit for every $100 invested in efficiency. The initial cost per unit of GoodsB is $40, and with fuel efficiency upgrades, the cost decreases by $1.5 per unit for every $100 invested in efficiency. The initial cost per unit of GoodsC is $50, and with fuel efficiency upgrades, the cost decreases by $2 per unit for every $100 invested in efficiency. The company aims to minimize the total transportation cost from all goods. The company has a total budget of $20,000 for transportation and fuel efficiency upgrades. Please help the company to determine the optimal number of units to transport for each type of good and the appropriate level of fuel efficiency upgrades to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of GoodsA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of GoodsB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of GoodsC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for GoodsA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for GoodsB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for GoodsC\n\n# Define objective function\nCostA = (30 - 0.01 * EfficiencyA) * UnitsA\nCostB = (40 - 0.015 * EfficiencyB) * UnitsB\nCostC = (50 - 0.02 * EfficiencyC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsA: \", model.getVal(UnitsA))\n    print(\"Number of Units of GoodsB: \", model.getVal(UnitsB))\n    print(\"Number of Units of GoodsC: \", model.getVal(UnitsC))\n    print(\"Investment in Fuel Efficiency for GoodsA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for GoodsB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for GoodsC: \", model.getVal(EfficiencyC))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1216,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicles have a fuel efficiency of 20 km/l, a capacity of 500 kg, and an operational cost of $100 per day.\nThe medium vehicles have a fuel efficiency of 15 km/l, a capacity of 1000 kg, and an operational cost of $150 per day.\nThe large vehicles have a fuel efficiency of 10 km/l, a capacity of 2000 kg, and an operational cost of $200 per day.\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries.\n// Profit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily budget for vehicle operations is $3000.\n// 100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 20 vehicles available.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 20\n\n## Generate Constraint-3:\nThe total delivery demand is 15000 kg.\n// 500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles >= 15000\n\n## Generate Constraint-4:\nThe fuel consumption for all vehicles should not exceed 1000 liters per day.\n// (1/20) * 500 * SmallVehicles + (1/15) * 1000 * MediumVehicles + (1/10) * 2000 * LargeVehicles <= 1000",
        "question": "A logistics company is planning to optimize its delivery routes using three types of vehicles: small, medium, and large. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company needs to determine the number of each vehicle type to deploy for maximizing profit while considering the constraints of budget, vehicle availability, and delivery demand. The characteristics of each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Capacity (kg) | Operational Cost ($/day) |\n|--------------|-----------------------|---------------|--------------------------|\n| Small        | 20                    | 500           | 100                      |\n| Medium       | 15                    | 1000          | 150                      |\n| Large        | 10                    | 2000          | 200                      |\n\nThe company earns $5 per kg delivered. The objective is to maximize the daily profit from deliveries. The total daily budget for vehicle operations is $3000. The company has a total of 20 vehicles available. The total delivery demand is 15000 kg. The fuel consumption for all vehicles should not exceed 1000 liters per day.\n\nPlease help the company determine the optimal number of small, medium, and large vehicles to deploy to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\nProfit = 5 * (500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles) - (100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total daily budget for vehicle operations is $3000.\nmodel.addCons(100 * SmallVehicles + 150 * MediumVehicles + 200 * LargeVehicles <= 3000)\n## The company has a total of 20 vehicles available.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 20)\n## The total delivery demand is 15000 kg.\nmodel.addCons(500 * SmallVehicles + 1000 * MediumVehicles + 2000 * LargeVehicles >= 15000)\n## The fuel consumption for all vehicles should not exceed 1000 liters per day.\nmodel.addCons((1/20) * 500 * SmallVehicles + (1/15) * 1000 * MediumVehicles + (1/10) * 2000 * LargeVehicles <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1334,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The company also needs to decide on the level of investment in fuel-efficient technologies for each region, which affects the fuel consumption rate of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Region1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region3\": \"TechInvest3\", \"range\": \"TechInvest3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of the trucks decreases with the investment in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region. The initial fuel consumption rate is 3 liters per kilometer. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region1: Fuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\n// Fuel consumption for Region2: Fuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\n// Fuel consumption for Region3: Fuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the level of investment in fuel-efficient technologies for each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The initial fuel consumption rate for the trucks is 3 liters per kilometer, and for every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region.\n\n| Region | Number of Trucks | Investment in Technology |\n|--------|------------------|--------------------------|\n| 1      | Trucks1          | TechInvest1              |\n| 2      | Trucks2          | TechInvest2              |\n| 3      | Trucks3          | TechInvest3              |\n\nThe company has a total budget of $100,000 for truck allocation and technology investments. The total number of trucks available for allocation is 100.\n\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technologies for Region1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=0)  # investment in fuel-efficient technologies for Region2\nTechInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest3\", lb=0)  # investment in fuel-efficient technologies for Region3\n\n# Define objective function\nFuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\nFuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\nFuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocation and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000)\n# The total number of trucks available for allocation is 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Region1: \", model.getVal(TechInvest1))\n    print(\"Investment in Tech for Region2: \", model.getVal(TechInvest2))\n    print(\"Investment in Tech for Region3: \", model.getVal(TechInvest3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials.\n// {\"number of trucks for Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel.\nFor Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel.\nFor Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel.\nFor Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel.\nFor Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel.\nThe company wants to maximize the revenue-to-fuel ratio for the entire fleet.\n// Total Revenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total Fuel Consumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n// So, the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000\n\n## Generate Constraint-3:\nRoute A requires at least 10 trucks to be operational.\n// TruckA >= 10",
        "question": "A logistics company is planning its fleet usage for five different routes (Route A, Route B, Route C, Route D, and Route E). Each route requires a certain number of trucks and has varying fuel consumption rates and revenue potentials. For Route A, each truck generates $1000 in revenue and consumes 50 liters of fuel. For Route B, each truck generates $1200 in revenue and consumes 60 liters of fuel. For Route C, each truck generates $1500 in revenue and consumes 70 liters of fuel. For Route D, each truck generates $1800 in revenue and consumes 80 liters of fuel. For Route E, each truck generates $2000 in revenue and consumes 90 liters of fuel. The company has a total of 100 trucks available and a budget constraint on fuel, limiting the total fuel consumption to 7000 liters. Route A requires at least 10 trucks to be operational. The company wants to maximize the revenue-to-fuel ratio for the entire fleet. Please help the company determine the optimal number of trucks to allocate to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for Route E\n\n# Define objective function\nTotalRevenue = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nTotalFuelConsumption = 50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Total Revenue) / (Total Fuel Consumption)\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n# The company has a budget constraint on fuel, limiting the total fuel consumption to 7000 liters.\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 80 * TruckD + 90 * TruckE <= 7000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TruckE))\n    print(\"Maximized Revenue-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for small trucks per km\": \"FuelRateSmall\", \"range\": \"FuelRateSmall > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for medium trucks per km\": \"FuelRateMedium\", \"range\": \"FuelRateMedium > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for large trucks per km\": \"FuelRateLarge\", \"range\": \"FuelRateLarge > 0\", \"type\": \"real\"}\n// {\"distance traveled by each small truck per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each medium truck per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each large truck per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel consumption across all trucks.\n// TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000\n\n## Generate Constraint-2:\nThe total daily distance traveled by all trucks must not exceed 10,000 km.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company must ensure at least 50% of the total daily demand is met. The demand is 8000 kg, and small trucks carry 500 kg, medium trucks carry 1000 kg, and large trucks carry 1500 kg.\n// 500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency. The company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000. The total daily distance traveled by all trucks must not exceed 10,000 km. The company must ensure at least 50% of the total daily demand is met. The demand is 8000 kg, and small trucks carry 500 kg, medium trucks carry 1000 kg, and large trucks carry 1500 kg. Please help the company to minimize the total daily fuel consumption across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\nFuelRateSmall = model.addVar(name=\"FuelRateSmall\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for small trucks per km\nFuelRateMedium = model.addVar(name=\"FuelRateMedium\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for medium trucks per km\nFuelRateLarge = model.addVar(name=\"FuelRateLarge\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for large trucks per km\nDistanceSmall = model.addVar(name=\"DistanceSmall\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each small truck per day\nDistanceMedium = model.addVar(name=\"DistanceMedium\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each medium truck per day\nDistanceLarge = model.addVar(name=\"DistanceLarge\", vtype=\"CONTINUOUS\", lb=0)  # distance traveled by each large truck per day\n\nTotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelConsumption)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n\n# The total daily distance traveled by all trucks must not exceed 10,000 km.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 10000)\n\n# The company must ensure at least 50% of the total daily demand is met.\nmodel.addCons(500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency.\n// {\"speed setting for machine 1\": \"S1\", \"range\": \"0 < S1 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 2\": \"S2\", \"range\": \"0 < S2 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 3\": \"S3\", \"range\": \"0 < S3 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 4\": \"S4\", \"range\": \"0 < S4 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 5\": \"S5\", \"range\": \"0 < S5 < 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine's production rate is a nonlinear function of its speed setting. The production rate of each machine is given by the following functions:\n- Machine 1: P1 = 100 * S1 - 0.5 * S1^2\n- Machine 2: P2 = 120 * S2 - 0.6 * S2^2\n- Machine 3: P3 = 110 * S3 - 0.55 * S3^2\n- Machine 4: P4 = 90 * S4 - 0.45 * S4^2\n- Machine 5: P5 = 80 * S5 - 0.4 * S5^2\nThe objective is to maximize the total production rate of all machines.\n// Objective function: Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * S1 - 0.5 * S1^2) + (120 * S2 - 0.6 * S2^2) + (110 * S3 - 0.55 * S3^2) + (90 * S4 - 0.45 * S4^2) + (80 * S5 - 0.4 * S5^2)\n\n## Generate Constraint-1:\nThe total energy consumption of all machines must not exceed 1000 units.\n// 10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000\n\n## Generate Constraint-2:\nThe speed setting of each machine must be within its operational limits.\n// 0 < S1 < 100; 0 < S2 < 100; 0 < S3 < 100; 0 < S4 < 100; 0 < S5 < 100",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency. Each machine's production rate is a nonlinear function of its speed setting, as follows:\n- Machine 1: P1 = 100 * S1 - 0.5 * S1^2\n- Machine 2: P2 = 120 * S2 - 0.6 * S2^2\n- Machine 3: P3 = 110 * S3 - 0.55 * S3^2\n- Machine 4: P4 = 90 * S4 - 0.45 * S4^2\n- Machine 5: P5 = 80 * S5 - 0.4 * S5^2\nThe objective is to maximize the total production rate of all machines. The total energy consumption of all machines must not exceed 1000 units. Additionally, the speed setting of each machine must be within its operational limits (0 < S1 < 100; 0 < S2 < 100; 0 < S3 < 100; 0 < S4 < 100; 0 < S5 < 100).\nPlease help the manager to determine the optimal speed settings for each machine to maximize the total production rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The speed setting of each machine must be within its operational limits.\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=100) # speed setting for machine 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0, ub=100) # speed setting for machine 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0, ub=100) # speed setting for machine 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0, ub=100) # speed setting for machine 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0, ub=100) # speed setting for machine 5\n\n# Define objective function\n## Each machine's production rate is a nonlinear function of its speed setting.\nP1 = 100 * S1 - 0.5 * S1**2\nP2 = 120 * S2 - 0.6 * S2**2\nP3 = 110 * S3 - 0.55 * S3**2\nP4 = 90 * S4 - 0.45 * S4**2\nP5 = 80 * S5 - 0.4 * S5**2\n## The objective is to maximize the total production rate of all machines.\n## Objective function: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n## The total energy consumption of all machines must not exceed 1000 units.\nmodel.addCons(10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed Setting for Machine 1: \", model.getVal(S1))\n    print(\"Speed Setting for Machine 2: \", model.getVal(S2))\n    print(\"Speed Setting for Machine 3: \", model.getVal(S3))\n    print(\"Speed Setting for Machine 4: \", model.getVal(S4))\n    print(\"Speed Setting for Machine 5: \", model.getVal(S5))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter. Additionally, the company needs to decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery.\n// {\"number of units of GoodsX\": \"UnitsX\", \"range\": \"UnitsX >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsY\": \"UnitsY\", \"range\": \"UnitsY >= 0\", \"type\": \"integer\"}\n// {\"investment in transportation technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in transportation technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of transportation is exponentially related to the amount of technology investment for each type of good.\nThe initial cost per unit of GoodsX is $100, but with technology, the cost decreases by 1% for every $100 invested in technology.\nThe initial cost per unit of GoodsY is $150, and with technology, the cost decreases by 1.5% for every $100 invested in technology.\nThe company aims to minimize the total transportation cost for all goods.\n// Total cost for GoodsX: CostX = 100 * UnitsX * (1 - 0.0001 * TechX)\n// Total cost for GoodsY: CostY = 150 * UnitsY * (1 - 0.00015 * TechY)\n// So, the objective function is: Minimize (CostX + CostY)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000",
        "question": "A logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter and decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery. The initial cost per unit of GoodsX is $100, and the cost decreases by 1% for every $100 invested in technology. The initial cost per unit of GoodsY is $150, and the cost decreases by 1.5% for every $100 invested in technology. The company aims to minimize the total transportation cost for all goods.\n\n| Good Type | Initial Cost per Unit | Technology Investment Impact |\n|-----------|-----------------------|-------------------------------|\n| GoodsX    | $100                  | 1% decrease per $100          |\n| GoodsY    | $150                  | 1.5% decrease per $100        |\n\nThe company has a total budget of $100,000 for transportation and technology investments. Please help the company to determine the optimal number of units to transport for GoodsX and GoodsY, and the appropriate investment in transportation technologies to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsX = model.addVar(vtype=\"INTEGER\", name=\"UnitsX\", lb=0)  # number of units of GoodsX\nUnitsY = model.addVar(vtype=\"INTEGER\", name=\"UnitsY\", lb=0)  # number of units of GoodsY\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in transportation technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in transportation technology for GoodsY\n\n# Define objective function\nCostX = 100 * UnitsX * (1 - 0.0001 * TechX)\nCostY = 150 * UnitsY * (1 - 0.00015 * TechY)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY)\n\n# Add constraints\nmodel.addCons(100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsX: \", model.getVal(UnitsX))\n    print(\"Number of Units of GoodsY: \", model.getVal(UnitsY))\n    print(\"Investment in Technology for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Technology for GoodsY: \", model.getVal(TechY))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacities, and market demand constraints.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnits\", \"range\": \"ProductBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnits\", \"range\": \"ProductCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company aims to maximize the total profit from all products.\n// Profit_ProductA = ProductAUnits * (50 - 30)\n// Profit_ProductB = ProductBUnits * (70 - 40)\n// Profit_ProductC = ProductCUnits * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductAUnits + ProductBUnits + ProductCUnits <= 1000\n\n## Generate Constraint-2:\nThe storage capacity for each product is limited. ProductA can store up to 400 units, ProductB up to 300 units, and ProductC up to 500 units.\n// ProductAUnits <= 400\n// ProductBUnits <= 300\n// ProductCUnits <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacities, and market demand constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50            | $30                      |\n| ProductB | $70            | $40                      |\n| ProductC | $60            | $35                      |\n\nThe company has a total production capacity of 1000 units per month. The storage capacity for each product is limited: ProductA can store up to 400 units, ProductB up to 300 units, and ProductC up to 500 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0) # number of units of ProductA\nProductBUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnits\", lb=0) # number of units of ProductB\nProductCUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnits\", lb=0) # number of units of ProductC\n\n# Define objective function\nProfit_ProductA = ProductAUnits * (50 - 30)\nProfit_ProductB = ProductBUnits * (70 - 40)\nProfit_ProductC = ProductCUnits * (60 - 35)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAUnits + ProductBUnits + ProductCUnits <= 1000) # Total production capacity constraint\nmodel.addCons(ProductAUnits <= 400) # Storage capacity for ProductA\nmodel.addCons(ProductBUnits <= 300) # Storage capacity for ProductB\nmodel.addCons(ProductCUnits <= 500) # Storage capacity for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnits))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnits))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50             | 2 hours                  |\n| ComponentB | $70             | 3 hours                  |\n| ComponentC | $90             | 4 hours                  |\n| ComponentD | $110            | 5 hours                  |\n\nThe company has a total production capacity of 1000 hours per week. The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week. The company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n\nPlease help the company to maximize the total profit from the production of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n# The company has a limited budget for raw materials, which is $5000 per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes.\n// {\"number of Truck1 vehicles\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2 vehicles\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3 vehicles\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1 vehicles\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2 vehicles\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has a different operational cost and capacity. \n- Truck1 costs $50,000 per year to operate and has a capacity of 10 tons.\n- Truck2 costs $60,000 per year to operate and has a capacity of 15 tons.\n- Truck3 costs $70,000 per year to operate and has a capacity of 20 tons.\n- Van1 costs $30,000 per year to operate and has a capacity of 5 tons.\n- Van2 costs $40,000 per year to operate and has a capacity of 8 tons.\nThe company wants to minimize the total operational cost while ensuring they can handle at least 1000 tons of cargo.\n// Total operational cost: Cost = 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2\n// Total capacity: Capacity = 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $3,000,000 for vehicle operations.\n// 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2 <= 3000000\n\n## Generate Constraint-2:\nThe company must be able to handle at least 1000 tons of cargo.\n// 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2 >= 1000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes. The operational cost and capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Year | Capacity (tons) |\n|--------------|---------------------------|-----------------|\n| Truck1       | $50,000                    | 10              |\n| Truck2       | $60,000                    | 15              |\n| Truck3       | $70,000                    | 20              |\n| Van1         | $30,000                    | 5               |\n| Van2         | $40,000                    | 8               |\n\nThe company has a budget of $3,000,000 for vehicle operations. The company must be able to handle at least 1000 tons of cargo. \n\nPlease help the company to minimize the total operational cost while ensuring they can handle at least 1000 tons of cargo, by determining the optimal number of each vehicle type to include in their fleet. The objective is to minimize the ratio of total operational cost to total capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)  # number of Truck1 vehicles\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)  # number of Truck2 vehicles\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)  # number of Truck3 vehicles\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)      # number of Van1 vehicles\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)      # number of Van2 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2\nCapacity = 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $3,000,000 for vehicle operations.\nmodel.addCons(Cost <= 3000000)\n## The company must be able to handle at least 1000 tons of cargo.\nmodel.addCons(Capacity >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1 vehicles: \", model.getVal(Truck1))\n    print(\"Number of Truck2 vehicles: \", model.getVal(Truck2))\n    print(\"Number of Truck3 vehicles: \", model.getVal(Truck3))\n    print(\"Number of Van1 vehicles: \", model.getVal(Van1))\n    print(\"Number of Van2 vehicles: \", model.getVal(Van2))\n    print(\"Minimized Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the level of maintenance investment for each plant, which affects the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar plant\": \"MaintenanceSolar\", \"range\": \"MaintenanceSolar >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind plant\": \"MaintenanceWind\", \"range\": \"MaintenanceWind >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro plant\": \"MaintenanceHydro\", \"range\": \"MaintenanceHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company aims to maximize the total daily energy production.\n// EnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\n// EnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\n// EnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance investments and operational costs.\n// 1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000\n\n## Generate Constraint-2:\nEach plant has a maximum operational capacity of 24 hours per day.\n// HoursSolar <= 24; HoursWind <= 24; HoursHydro <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the level of maintenance investment for each plant to maximize energy production. The efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company has a total budget of $100,000 for maintenance investments and operational costs. Each plant has a maximum operational capacity of 24 hours per day.\nPlease help the company to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nMaintenanceSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSolar\", lb=0)  # maintenance investment for Solar plant\nMaintenanceWind = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceWind\", lb=0)  # maintenance investment for Wind plant\nMaintenanceHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHydro\", lb=0)  # maintenance investment for Hydro plant\n\n# Define objective function\nEnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\nEnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\nEnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n# So, the objective function is: Maximize (EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for maintenance investments and operational costs.\nmodel.addCons(1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000)\n# Each plant has a maximum operational capacity of 24 hours per day.\nmodel.addCons(HoursSolar <= 24)\nmodel.addCons(HoursWind <= 24)\nmodel.addCons(HoursHydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Solar plant: \", model.getVal(HoursSolar))\n    print(\"Hours of Wind plant: \", model.getVal(HoursWind))\n    print(\"Hours of Hydro plant: \", model.getVal(HoursHydro))\n    print(\"Maintenance Investment for Solar plant: \", model.getVal(MaintenanceSolar))\n    print(\"Maintenance Investment for Wind plant: \", model.getVal(MaintenanceWind))\n    print(\"Maintenance Investment for Hydro plant: \", model.getVal(MaintenanceHydro))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted based on the speed and load of the trucks.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for City1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for City2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for City3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for City4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for City5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each trip is affected by the fuel consumption rate, which is a nonlinear function of the speed and load. The profit per trip to City1 is $1000 - 10 * FuelRate1. The profit per trip to City2 is $1200 - 12 * FuelRate2. The profit per trip to City3 is $900 - 9 * FuelRate3. The profit per trip to City4 is $1100 - 11 * FuelRate4. The profit per trip to City5 is $1300 - 13 * FuelRate5. The company wants to maximize the total profit from all trips.\n// Profit_City1 = (1000 - 10 * FuelRate1) * Trips1\n// Profit_City2 = (1200 - 12 * FuelRate2) * Trips2\n// Profit_City3 = (900 - 9 * FuelRate3) * Trips3\n// Profit_City4 = (1100 - 11 * FuelRate4) * Trips4\n// Profit_City5 = (1300 - 13 * FuelRate5) * Trips5\n// So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n## Generate Constraint-1:\nThe total fuel consumption for all trips must not exceed 10000 liters.\n// FuelRate1 * Trips1 + FuelRate2 * Trips2 + FuelRate3 * Trips3 + FuelRate4 * Trips4 + FuelRate5 * Trips5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limited number of trucks available for trips, with a maximum of 500 trips in total.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted based on the speed and load of the trucks. The profit from each trip is affected by the fuel consumption rate, which is a nonlinear function of the speed and load. The profit per trip to City1 is $1000 - 10 * FuelRate1. The profit per trip to City2 is $1200 - 12 * FuelRate2. The profit per trip to City3 is $900 - 9 * FuelRate3. The profit per trip to City4 is $1100 - 11 * FuelRate4. The profit per trip to City5 is $1300 - 13 * FuelRate5. The company wants to maximize the total profit from all trips. The total fuel consumption for all trips must not exceed 10000 liters. The company has a limited number of trucks available for trips, with a maximum of 500 trips in total. Please help the company to maximize the total profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0) # fuel consumption rate for City1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0) # fuel consumption rate for City2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0) # fuel consumption rate for City3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0) # fuel consumption rate for City4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0) # fuel consumption rate for City5\n\n# Define objective function\nProfit_City1 = (1000 - 10 * FuelRate1) * Trips1\nProfit_City2 = (1200 - 12 * FuelRate2) * Trips2\nProfit_City3 = (900 - 9 * FuelRate3) * Trips3\nProfit_City4 = (1100 - 11 * FuelRate4) * Trips4\nProfit_City5 = (1300 - 13 * FuelRate5) * Trips5\n# So, the objective function is: Maximize (Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_City1 + Profit_City2 + Profit_City3 + Profit_City4 + Profit_City5)\n\n# Add constraints\n# The total fuel consumption for all trips must not exceed 10000 liters.\nmodel.addCons(FuelRate1 * Trips1 + FuelRate2 * Trips2 + FuelRate3 * Trips3 + FuelRate4 * Trips4 + FuelRate5 * Trips5 <= 10000)\n# The company has a limited number of trucks available for trips, with a maximum of 500 trips in total.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Fuel consumption rate for City1: \", model.getVal(FuelRate1))\n    print(\"Fuel consumption rate for City2: \", model.getVal(FuelRate2))\n    print(\"Fuel consumption rate for City3: \", model.getVal(FuelRate3))\n    print(\"Fuel consumption rate for City4: \", model.getVal(FuelRate4))\n    print(\"Fuel consumption rate for City5: \", model.getVal(FuelRate5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks allocated to Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs. The cost function for each warehouse is nonlinear and is given by:\nFor Warehouse A: Cost = 500 + 10 * TruckA^2\nFor Warehouse B: Cost = 600 + 8 * TruckB^2\nFor Warehouse C: Cost = 550 + 12 * TruckC^2\nFor Warehouse D: Cost = 700 + 9 * TruckD^2\nFor Warehouse E: Cost = 650 + 11 * TruckE^2\nThe company wants to minimize the total operating cost of all trucks across the warehouses.\n// Total Cost = 500 + 10 * TruckA^2 + 600 + 8 * TruckB^2 + 550 + 12 * TruckC^2 + 700 + 9 * TruckD^2 + 650 + 11 * TruckE^2\n// So, the objective function is: Minimize Total Cost\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs. For Warehouse A, the cost function is 500 + 10 * TruckA^2; for Warehouse B, it's 600 + 8 * TruckB^2; for Warehouse C, it's 550 + 12 * TruckC^2; for Warehouse D, it's 700 + 9 * TruckD^2; and for Warehouse E, it's 650 + 11 * TruckE^2. The company wants to minimize the total operating cost of all trucks across the warehouses. The total number of trucks available is 100. Please help the company determine the optimal number of trucks to allocate to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to Warehouse C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to Warehouse D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to Warehouse E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostA = 500 + 10 * TruckA**2\nCostB = 600 + 8 * TruckB**2\nCostC = 550 + 12 * TruckC**2\nCostD = 700 + 9 * TruckD**2\nCostE = 650 + 11 * TruckE**2\n## the objective function is: Minimize Total Cost\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Warehouse C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Warehouse D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Warehouse E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of shifts per day for each production line, and the investment in automation technology to improve production efficiency. The efficiency improvement from automation is nonlinear and varies by product type.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by 5% for every $10,000 invested in automation for ProductA, by 7% for ProductB, and by 10% for ProductC. The initial production cost per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.05 * Automation / 10000) * UnitsA) * ShiftsA\n// Total profit for ProductB: ProfitB = (225 - (150 - 0.07 * Automation / 10000) * UnitsB) * ShiftsB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.1 * Automation / 10000) * UnitsC) * ShiftsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 shifts available per day across all production lines.\n// ShiftsA + ShiftsB + ShiftsC <= 100\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nEach production line can operate for a maximum of 5 shifts per day.\n// ShiftsA <= 5; ShiftsB <= 5; ShiftsC <= 5",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of shifts per day for each production line, and the investment in automation technology to improve production efficiency. The efficiency improvement from automation is nonlinear and varies by product type. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $150                   |\n| ProductB | $150                             | $225                   |\n| ProductC | $200                             | $300                   |\n\nThe cost of production per unit decreases by 5% for every $10,000 invested in automation for ProductA, by 7% for ProductB, and by 10% for ProductC. The company aims to maximize the total profit from all products. The total investment in automation cannot exceed $50,000. The company has a total of 100 shifts available per day across all production lines. Due to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB. Each production line can operate for a maximum of 5 shifts per day.\n\nPlease help the company determine the optimal number of units to produce for each product, the number of shifts per day for each production line, and the investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0)  # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0)  # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0)  # number of shifts for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.05 * Automation / 10000) * UnitsA) * ShiftsA\n## Total profit for ProductB: ProfitB = (225 - (150 - 0.07 * Automation / 10000) * UnitsB) * ShiftsB\n## Total profit for ProductC: ProfitC = (300 - (200 - 0.1 * Automation / 10000) * UnitsC) * ShiftsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ((150 - (100 - 0.05 * Automation / 10000)) * UnitsA * ShiftsA) +\n                     ((225 - (150 - 0.07 * Automation / 10000)) * UnitsB * ShiftsB) +\n                     ((300 - (200 - 0.1 * Automation / 10000)) * UnitsC * ShiftsC))\n\n# Add constraints\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The company has a total of 100 shifts available per day across all production lines.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 100)\n## Each production line can operate for a maximum of 5 shifts per day.\nmodel.addCons(ShiftsA <= 5)\nmodel.addCons(ShiftsB <= 5)\nmodel.addCons(ShiftsC <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1608,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Trucks\": \"TruckHours\", \"range\": \"TruckHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Vans\": \"VanHours\", \"range\": \"VanHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Bikes\": \"BikeHours\", \"range\": \"BikeHours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type is a function of operational hours and the number of vehicles. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company aims to maximize the net daily revenue.\n// Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\n// Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\n// Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n// So, the objective function is: Maximize (Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n## Generate Constraint-1:\nThe company has a total of 200 operational hours available per day across all vehicle types.\n// TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for daily operational costs including fuel and maintenance.\n// 50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability. The revenue generated by each vehicle type is a function of operational hours and the number of vehicles. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company has a total of 200 operational hours available per day across all vehicle types and a budget of $10,000 for daily operational costs including fuel and maintenance. Please help the company to maximize the net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckHours = model.addVar(vtype=\"INTEGER\", name=\"TruckHours\", lb=0)  # operational hours for Trucks\nVanHours = model.addVar(vtype=\"INTEGER\", name=\"VanHours\", lb=0)  # operational hours for Vans\nBikeHours = model.addVar(vtype=\"INTEGER\", name=\"BikeHours\", lb=0)  # operational hours for Bikes\n\n# Define objective function\nRevenue_Trucks = (100 - 50) * TruckHours * TruckCount  # Revenue - Cost for Trucks\nRevenue_Vans = (70 - 30) * VanHours * VanCount  # Revenue - Cost for Vans\nRevenue_Bikes = (30 - 10) * BikeHours * BikeCount  # Revenue - Cost for Bikes\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n# Add constraints\n# The company has a total of 200 operational hours available per day across all vehicle types.\nmodel.addCons(TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200)\n# The company has a budget of $10,000 for daily operational costs including fuel and maintenance.\nmodel.addCons(50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Operational Hours for Trucks: \", model.getVal(TruckHours))\n    print(\"Operational Hours for Vans: \", model.getVal(VanHours))\n    print(\"Operational Hours for Bikes: \", model.getVal(BikeHours))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively.\n// {\"number of packages for Express\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Standard\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Economy\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is a function of the total number of packages. The penalty is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty.\n// Profit_Express = 5 * E\n// Profit_Standard = 3 * S\n// Profit_Economy = 2 * N\n// Penalty = 0.01 * (E + S + N)^2\n// So, the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n\n## Generate Constraint-1:\nThe company has a daily delivery capacity of 1000 packages.\n// E + S + N <= 1000\n\n## Generate Constraint-2:\nThe company has a limited fleet size, which can handle at most 500 Express packages per day.\n// E <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages.\n// N <= E + S\n\n## Generate Constraint-4:\nThe company has a policy to ensure that at least 20% of the total packages are Express packages.\n// E >= 0.2 * (E + S + N)\n\n## Generate Constraint-5:\nThe company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\n// |E - S| <= 100",
        "question": "A logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively.\nThe company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty.\nThe company has a daily delivery capacity of 1000 packages. The company has a limited fleet size, which can handle at most 500 Express packages per day. The company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages. The company has a policy to ensure that at least 20% of the total packages are Express packages. The company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)  # number of packages for Express\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0)  # number of packages for Standard\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=0)  # number of packages for Economy\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Express = 5 * E\nProfit_Standard = 3 * S\nProfit_Economy = 2 * N\nPenalty = 0.01 * (E + S + N)**2\n## the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n## convert the square to multiplication\nmodel.addCons(obj == Profit_Express + Profit_Standard + Profit_Economy - 0.01 * (E + S + N) * (E + S + N))\n\n# Add constraints\n## The company has a daily delivery capacity of 1000 packages.\nmodel.addCons(E + S + N <= 1000)\n## The company has a limited fleet size, which can handle at most 500 Express packages per day.\nmodel.addCons(E <= 500)\n## The company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages.\nmodel.addCons(N <= E + S)\n## The company has a policy to ensure that at least 20% of the total packages are Express packages.\nmodel.addCons(E >= 0.2 * (E + S + N))\n## The company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\nmodel.addCons(E - S <= 100)\nmodel.addCons(S - E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Express Packages: \", model.getVal(E))\n    print(\"Number of Standard Packages: \", model.getVal(S))\n    print(\"Number of Economy Packages: \", model.getVal(N))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in warehouse upgrades\": \"WarehouseInvestment\", \"range\": \"WarehouseInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of the trucks and the warehouse is affected by the warehouse upgrades. For each $1,000 invested in warehouse upgrades, the operational cost per truck decreases by $100. \nThe operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for both truck purchases and warehouse upgrades.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs. The operational efficiency of the trucks and the warehouse is affected by the warehouse upgrades. For each $1,000 invested in warehouse upgrades, the operational cost per truck decreases by $100. The operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. The company aims to minimize the total operational cost of the fleet. The company has a budget of $1,000,000 for both truck purchases and warehouse upgrades. The total number of trucks cannot exceed 100. Please help the company to determine the optimal number of each type of truck to purchase and the amount to invest in warehouse upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nWarehouseInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WarehouseInvestment\", lb=0)  # investment in warehouse upgrades\n\n# Define objective function\nCostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\nCostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\nCostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\n# So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $1,000,000 for both truck purchases and warehouse upgrades.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000)\n# The total number of trucks cannot exceed 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Warehouse Investment: \", model.getVal(WarehouseInvestment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter. Additionally, the company needs to decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery.\n// {\"number of units of GoodsX\": \"UnitsX\", \"range\": \"UnitsX >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsY\": \"UnitsY\", \"range\": \"UnitsY >= 0\", \"type\": \"integer\"}\n// {\"investment in transportation technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in transportation technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of transportation is exponentially related to the amount of technology investment for each type of good.\nThe initial cost per unit of GoodsX is $100, but with technology, the cost decreases by 1% for every $100 invested in technology.\nThe initial cost per unit of GoodsY is $150, and with technology, the cost decreases by 1.5% for every $100 invested in technology.\nThe company aims to minimize the total transportation cost for all goods.\n// Total cost for GoodsX: CostX = 100 * UnitsX * (1 - 0.0001 * TechX)\n// Total cost for GoodsY: CostY = 150 * UnitsY * (1 - 0.00015 * TechY)\n// So, the objective function is: Minimize (CostX + CostY)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000",
        "question": "A logistics company manages the distribution of two types of goods: GoodsX and GoodsY. The company needs to determine the number of units to transport for each type of good in the next quarter and decide on the investment amount ($) in new transportation technologies to reduce fuel consumption and increase delivery speed, which affects the cost and efficiency of each delivery. The efficiency of transportation is exponentially related to the amount of technology investment for each type of good. The initial cost per unit of GoodsX is $100, but with technology, the cost decreases by 1% for every $100 invested in technology. The initial cost per unit of GoodsY is $150, and with technology, the cost decreases by 1.5% for every $100 invested in technology. The company aims to minimize the total transportation cost for all goods. The company has a total budget of $100,000 for transportation and technology investments. Please help the company to minimize the total transportation cost for all goods.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsX = model.addVar(vtype=\"INTEGER\", name=\"UnitsX\", lb=0)  # number of units of GoodsX\nUnitsY = model.addVar(vtype=\"INTEGER\", name=\"UnitsY\", lb=0)  # number of units of GoodsY\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in transportation technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in transportation technology for GoodsY\n\n# Define objective function\nCostX = 100 * UnitsX * (1 - 0.0001 * TechX)\nCostY = 150 * UnitsY * (1 - 0.00015 * TechY)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY)\n\n# Add constraints\nmodel.addCons(100 * UnitsX + 150 * UnitsY + TechX + TechY <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsX: \", model.getVal(UnitsX))\n    print(\"Number of Units of GoodsY: \", model.getVal(UnitsY))\n    print(\"Investment in Technology for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Technology for GoodsY: \", model.getVal(TechY))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"VanTech\", \"range\": \"VanTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"BikeTech\", \"range\": \"BikeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in fuel-efficient technology. The cost reduction is nonlinear, with diminishing returns as more technology is invested.\nThe operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology.\nThe operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology.\nThe operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology.\nThe company aims to minimize the total operational cost of all vehicles.\n// Total cost for Trucks: CostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\n// Total cost for Vans: CostVan = 70 * VanCount - 0.07 * VanTech * VanCount\n// Total cost for Bikes: CostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle purchases and technology investments.\n// TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// TruckCount + VanCount + BikeCount <= 200\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Trucks must be at least twice the number of Vans.\n// TruckCount >= 2 * VanCount",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs. The operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology. The operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology. The operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology. The company has a total budget of $10,000 for vehicle purchases and technology investments. The total number of vehicles cannot exceed 200. Due to maintenance constraints, the number of Trucks must be at least twice the number of Vans. Please help the company to minimize the total operational cost of all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for Trucks\nVanTech = model.addVar(vtype=\"CONTINUOUS\", name=\"VanTech\", lb=0)  # investment in fuel-efficient technology for Vans\nBikeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeTech\", lb=0)  # investment in fuel-efficient technology for Bikes\n\n# Define objective function\nCostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\nCostVan = 70 * VanCount - 0.07 * VanTech * VanCount\nCostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 200)\nmodel.addCons(TruckCount >= 2 * VanCount)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Van Tech: \", model.getVal(VanTech))\n    print(\"Investment in Bike Tech: \", model.getVal(BikeTech))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per truck and delivery efficiency. Route 1 has a cost of $100 per truck and an efficiency of 20 deliveries per hour. Route 2 has a cost of $120 per truck and an efficiency of 25 deliveries per hour. Route 3 has a cost of $110 per truck and an efficiency of 22 deliveries per hour. Route 4 has a cost of $130 per truck and an efficiency of 28 deliveries per hour. Route 5 has a cost of $140 per truck and an efficiency of 30 deliveries per hour. The company aims to maximize the total deliveries while minimizing the total cost.\n// Cost = 100 * T1 + 120 * T2 + 110 * T3 + 130 * T4 + 140 * T5\n// Deliveries = 20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5\n// The objective function is: Maximize (Deliveries - Cost)\n// Maximize (20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5 - 100 * T1 - 120 * T2 - 110 * T3 - 130 * T4 - 140 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 22 trucks, Route 4 up to 28 trucks, and Route 5 up to 30 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 22; T4 <= 28; T5 <= 30\n\n## Generate Constraint-3:\nThe company aims to ensure that at least 10% of the total trucks are allocated to each route to maintain route viability.\n// T1 >= 0.1 * (T1 + T2 + T3 + T4 + T5); T2 >= 0.1 * (T1 + T2 + T3 + T4 + T5); T3 >= 0.1 * (T1 + T2 + T3 + T4 + T5); T4 >= 0.1 * (T1 + T2 + T3 + T4 + T5); T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. Each route has a different cost per truck and delivery efficiency. Route 1 has a cost of $100 per truck and an efficiency of 20 deliveries per hour. Route 2 has a cost of $120 per truck and an efficiency of 25 deliveries per hour. Route 3 has a cost of $110 per truck and an efficiency of 22 deliveries per hour. Route 4 has a cost of $130 per truck and an efficiency of 28 deliveries per hour. Route 5 has a cost of $140 per truck and an efficiency of 30 deliveries per hour. The company aims to maximize the total deliveries while minimizing the total cost. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 22 trucks, Route 4 up to 28 trucks, and Route 5 up to 30 trucks. The company aims to ensure that at least 10% of the total trucks are allocated to each route to maintain route viability. Please help the company to maximize the total deliveries while minimizing the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nCost = 100 * T1 + 120 * T2 + 110 * T3 + 130 * T4 + 140 * T5\nDeliveries = 20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5\n# The objective function is: Maximize (Deliveries - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Deliveries - Cost)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n# Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 22)\nmodel.addCons(T4 <= 28)\nmodel.addCons(T5 <= 30)\n# The company aims to ensure that at least 10% of the total trucks are allocated to each route.\nmodel.addCons(T1 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\nmodel.addCons(T2 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\nmodel.addCons(T3 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\nmodel.addCons(T4 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Deliveries - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company wants to maximize the energy output while minimizing the carbon footprint.\n// Energy Output = 15% * 1000 * Solar1 + 20% * 1500 * Solar2 + 25% * 2000 * Solar3 + 30% * 2500 * Solar4 + 35% * 3000 * Solar5 + 20% * 2000 * Wind1 + 25% * 2500 * Wind2 + 30% * 3000 * Wind3\n// Carbon Footprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n// So, the objective function is: Maximize Energy Output / Carbon Footprint\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). Each solar panel type and wind turbine has a different efficiency, cost, and carbon footprint. The company wants to maximize the energy output while minimizing the carbon footprint.\n\nThe company has a budget of $1,000,000 for the installation. At least 30% of the budget must be spent on solar panels.\n\nPlease help the company to maximize the energy output divided by the carbon footprint.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\nEnergyOutput = 0.15 * 1000 * Solar1 + 0.20 * 1500 * Solar2 + 0.25 * 2000 * Solar3 + 0.30 * 2500 * Solar4 + 0.35 * 3000 * Solar5 + 0.20 * 2000 * Wind1 + 0.25 * 2500 * Wind2 + 0.30 * 3000 * Wind3\nCarbonFootprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize Energy Output / Carbon Footprint\n# convert the division to multiplication\nmodel.addCons(obj * CarbonFootprint == EnergyOutput)\n\n# Add constraints\n# The company has a budget of $1,000,000 for the installation.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000)\n# At least 30% of the budget must be spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 >= 0.3 * 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output / Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 647,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company wants to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// Total ton-kilometers: TonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n// So, the objective function is: Minimize Cost / TonKm\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for operational costs next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000\n\n## Generate Constraint-2:\nThe company needs to transport at least 1000 tons next month.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000",
        "question": "A logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities, operational costs, and fuel efficiencies.\n\n| Vehicle | Capacity (tons) | Operational Cost ($/day) | Fuel Efficiency (km/liter) |\n|---------|-----------------|--------------------------|----------------------------|\n| Truck A | 10              | 500                      | 5                          |\n| Truck B | 15              | 700                      | 7                          |\n| Truck C | 20              | 900                      | 9                          |\n| Truck D | 25              | 1100                     | 11                         |\n| Truck E | 30              | 1300                     | 13                         |\n\nThe company has a total budget of $30,000 for operational costs next month. The company needs to transport at least 1000 tons next month. \n\nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of Truck D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nTonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * TonKm == Cost)\n\n# Add constraints\n## The company has a total budget of $30,000 for operational costs next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000)\n## The company needs to transport at least 1000 tons next month.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Number of Truck E: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much land to allocate to each crop to optimize its profit and resource usage.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per acre is $500, and the water usage is 1000 gallons per acre.\nFor Crop B, the profit per acre is $700, and the water usage is 1500 gallons per acre.\nFor Crop C, the profit per acre is $600, and the water usage is 1200 gallons per acre.\nFor Crop D, the profit per acre is $800, and the water usage is 2000 gallons per acre.\nFor Crop E, the profit per acre is $900, and the water usage is 2500 gallons per acre.\nThe farm aims to maximize the profit per unit of water used (which is defined as the total profit divided by the total water usage).\n// Profit of A: Profit_A = 500 * A\n// Profit of B: Profit_B = 700 * B\n// Profit of C: Profit_C = 600 * C\n// Profit of D: Profit_D = 800 * D\n// Profit of E: Profit_E = 900 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E)\n\n## Generate Constraint-1:\nThe farm has 100 acres available for cultivation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 150,000 gallons of water available for irrigation.\n// 1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E <= 150000\n\n## Generate Constraint-3:\nThe farm wants to ensure that at least 10 acres are allocated to each crop.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-4:\nThe farm wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe farm wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much land to allocate to each crop to optimize its profit and resource usage.\nFor Crop A, the profit per acre is $500, and the water usage is 1000 gallons per acre.\nFor Crop B, the profit per acre is $700, and the water usage is 1500 gallons per acre.\nFor Crop C, the profit per acre is $600, and the water usage is 1200 gallons per acre.\nFor Crop D, the profit per acre is $800, and the water usage is 2000 gallons per acre.\nFor Crop E, the profit per acre is $900, and the water usage is 2500 gallons per acre.\nThe farm has 100 acres available for cultivation and a total of 150,000 gallons of water available for irrigation. The farm wants to ensure that at least 10 acres are allocated to each crop. The farm wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C. The farm also wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\nPlease help the farm to maximize the profit per unit of water used (which is defined as the total profit divided by the total water usage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=10) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=10) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=10) # land allocated to crop C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=10) # land allocated to crop D\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=10) # land allocated to crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 600 * C\nProfit_D = 800 * D\nProfit_E = 900 * E\nWaterUsage = 1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has 100 acres available for cultivation.\nmodel.addCons(A + B + C + D + E <= 100)\n## The farm has a total of 150,000 gallons of water available for irrigation.\nmodel.addCons(1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E <= 150000)\n## The farm wants to ensure that at least 10 acres are allocated to each crop.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\nmodel.addCons(D >= 10)\nmodel.addCons(E >= 10)\n## The farm wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The farm wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Land allocated to Crop D: \", model.getVal(D))\n    print(\"Land allocated to Crop E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints.\n// {\"number of DeviceA\": \"DeviceANum\", \"range\": \"DeviceANum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceBNum\", \"range\": \"DeviceBNum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceCNum\", \"range\": \"DeviceCNum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company aims to maximize the total profit.\n// Profit_DeviceA = (100 - 50) * DeviceANum\n// Profit_DeviceB = (150 - 75) * DeviceBNum\n// Profit_DeviceC = (200 - 100) * DeviceCNum\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// DeviceANum + DeviceBNum + DeviceCNum <= 500\n\n## Generate Constraint-2:\nDue to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBNum <= 2 * DeviceANum\n\n## Generate Constraint-3:\nThe market demand for DeviceC is limited to 150 units per month.\n// DeviceCNum <= 150",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints. The profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company has a total production capacity of 500 units per month. Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA. The market demand for DeviceC is limited to 150 units per month. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceANum = model.addVar(vtype=\"INTEGER\", name=\"DeviceANum\", lb=0) # number of DeviceA\nDeviceBNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceBNum\", lb=0) # number of DeviceB\nDeviceCNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceCNum\", lb=0) # number of DeviceC\n\n# Define objective function\nProfit_DeviceA = (100 - 50) * DeviceANum\nProfit_DeviceB = (150 - 75) * DeviceBNum\nProfit_DeviceC = (200 - 100) * DeviceCNum\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 500 units per month.\nmodel.addCons(DeviceANum + DeviceBNum + DeviceCNum <= 500)\n# Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBNum <= 2 * DeviceANum)\n# The market demand for DeviceC is limited to 150 units per month.\nmodel.addCons(DeviceCNum <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceANum))\n    print(\"Number of DeviceB: \", model.getVal(DeviceBNum))\n    print(\"Number of DeviceC: \", model.getVal(DeviceCNum))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 718,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company aims to minimize the total daily fuel cost across all trucks.\n// FuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\n// FuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\n// FuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\n// TotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel efficiency upgrades.\n// FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the company must ensure that at least 10 trucks of each type are deployed.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the investment in fuel efficiency upgrades for each type of truck. The fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company has a total budget of $10,000 for fuel efficiency upgrades. The total number of trucks that can be deployed is limited to 50. Due to maintenance constraints, the company must ensure that at least 10 trucks of each type are deployed. The company aims to minimize the total daily fuel cost across all trucks.\n\nPlease help the company to determine the optimal number of trucks to deploy for each type and the optimal investment in fuel efficiency upgrades to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10)  # number of TruckC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nFuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\nFuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\nFuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\nTotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\nmodel.addCons(FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)  # total budget for fuel efficiency upgrades\nmodel.addCons(TruckA + TruckB + TruckC <= 50)  # total number of trucks\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(FuelEfficiencyC))\n    print(\"Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1290,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 50 vehicles.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\n// T <= 0.5 * (V + B)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle | Revenue per Day | Operational Cost per Day |\n|---------|-----------------|--------------------------|\n| Trucks  | $500            | $200                     |\n| Vans    | $300            | $100                     |\n| Bikes   | $100            | $30                      |\n\nThe company has a total budget of $10,000 for daily operational costs. The company has a maximum storage capacity of 50 vehicles. The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined. \n\nPlease help the company to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## Revenue and cost calculations\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n## Objective function: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n## The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n## The company has a maximum storage capacity of 50 vehicles.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\nmodel.addCons(T <= 0.5 * (V + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space, which can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints. The revenue per unit, production cost per unit, and storage cost per unit for each machine type are given in the following Table.\n\n| Machine Type | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------------|------------------|--------------------------|-----------------------|\n| M1           | $1000            | $600                     | $50                   |\n| M2           | $1500            | $800                     | $75                   |\n| M3           | $2000            | $1200                    | $100                  |\n\nThe company has a total production budget of $100,000. The company also has a limited storage space, which can hold a maximum of 100 units in total. The company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n\nPlease help the company determine the optimal production quantities for each machine type to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000) # Total production budget\nmodel.addCons(M1 + M2 + M3 <= 100) # Limited storage space\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies.\n// {\"number of trips to D1\": \"TripsD1\", \"range\": \"TripsD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D2\": \"TripsD2\", \"range\": \"TripsD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D3\": \"TripsD3\", \"range\": \"TripsD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D4\": \"TripsD4\", \"range\": \"TripsD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D5\": \"TripsD5\", \"range\": \"TripsD5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for D1\": \"FuelEffD1\", \"range\": \"FuelEffD1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for D2\": \"FuelEffD2\", \"range\": \"FuelEffD2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for D3\": \"FuelEffD3\", \"range\": \"FuelEffD3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for D4\": \"FuelEffD4\", \"range\": \"FuelEffD4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for D5\": \"FuelEffD5\", \"range\": \"FuelEffD5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each route decreases with increased investment in fuel efficiency technologies. The initial fuel consumption rate for each route is 50 liters per trip, and for every $1000 invested, the fuel consumption decreases by 1 liter per trip. The company wants to minimize the total fuel consumption while considering the investments in fuel efficiency.\n// FuelConsumptionD1 = (50 - 0.001 * FuelEffD1) * TripsD1\n// FuelConsumptionD2 = (50 - 0.001 * FuelEffD2) * TripsD2\n// FuelConsumptionD3 = (50 - 0.001 * FuelEffD3) * TripsD3\n// FuelConsumptionD4 = (50 - 0.001 * FuelEffD4) * TripsD4\n// FuelConsumptionD5 = (50 - 0.001 * FuelEffD5) * TripsD5\n// So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel efficiency technologies.\n// FuelEffD1 + FuelEffD2 + FuelEffD3 + FuelEffD4 + FuelEffD5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies. The initial fuel consumption rate for each route is 50 liters per trip, and for every $1000 invested, the fuel consumption decreases by 1 liter per trip. The company has a total budget of $100,000 for investments in fuel efficiency technologies.\n\nPlease help the company to minimize the total fuel consumption while considering the investments in fuel efficiency. The variables to consider are the number of trips to each destination and the investment in fuel efficiency for each destination.\n\n| Destination | Initial Fuel Consumption Rate | Investment Impact on Fuel Consumption |\n|-------------|--------------------------------|----------------------------------------|\n| D1          | 50 liters per trip            | $1000 decreases fuel consumption by 1 liter per trip |\n| D2          | 50 liters per trip            | $1000 decreases fuel consumption by 1 liter per trip |\n| D3          | 50 liters per trip            | $1000 decreases fuel consumption by 1 liter per trip |\n| D4          | 50 liters per trip            | $1000 decreases fuel consumption by 1 liter per trip |\n| D5          | 50 liters per trip            | $1000 decreases fuel consumption by 1 liter per trip |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsD1 = model.addVar(vtype=\"INTEGER\", name=\"TripsD1\", lb=0)\nTripsD2 = model.addVar(vtype=\"INTEGER\", name=\"TripsD2\", lb=0)\nTripsD3 = model.addVar(vtype=\"INTEGER\", name=\"TripsD3\", lb=0)\nTripsD4 = model.addVar(vtype=\"INTEGER\", name=\"TripsD4\", lb=0)\nTripsD5 = model.addVar(vtype=\"INTEGER\", name=\"TripsD5\", lb=0)\nFuelEffD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffD1\", lb=0)\nFuelEffD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffD2\", lb=0)\nFuelEffD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffD3\", lb=0)\nFuelEffD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffD4\", lb=0)\nFuelEffD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffD5\", lb=0)\n\n# Define objective function\nFuelConsumptionD1 = (50 - 0.001 * FuelEffD1) * TripsD1\nFuelConsumptionD2 = (50 - 0.001 * FuelEffD2) * TripsD2\nFuelConsumptionD3 = (50 - 0.001 * FuelEffD3) * TripsD3\nFuelConsumptionD4 = (50 - 0.001 * FuelEffD4) * TripsD4\nFuelConsumptionD5 = (50 - 0.001 * FuelEffD5) * TripsD5\n# So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n# Add constraints\n# The company has a total budget of $100,000 for investments in fuel efficiency technologies.\nmodel.addCons(FuelEffD1 + FuelEffD2 + FuelEffD3 + FuelEffD4 + FuelEffD5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to D1: \", model.getVal(TripsD1))\n    print(\"Number of trips to D2: \", model.getVal(TripsD2))\n    print(\"Number of trips to D3: \", model.getVal(TripsD3))\n    print(\"Number of trips to D4: \", model.getVal(TripsD4))\n    print(\"Number of trips to D5: \", model.getVal(TripsD5))\n    print(\"Investment in fuel efficiency for D1: \", model.getVal(FuelEffD1))\n    print(\"Investment in fuel efficiency for D2: \", model.getVal(FuelEffD2))\n    print(\"Investment in fuel efficiency for D3: \", model.getVal(FuelEffD3))\n    print(\"Investment in fuel efficiency for D4: \", model.getVal(FuelEffD4))\n    print(\"Investment in fuel efficiency for D5: \", model.getVal(FuelEffD5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1469,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for route 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes.\n// Operational cost for route 1: Cost1 = (100 + 0.1 * Upgrade1) * Trucks1^2\n// Operational cost for route 2: Cost2 = (120 + 0.12 * Upgrade2) * Trucks2^2\n// Operational cost for route 3: Cost3 = (110 + 0.11 * Upgrade3) * Trucks3^2\n// Operational cost for route 4: Cost4 = (90 + 0.09 * Upgrade4) * Trucks4^2\n// Operational cost for route 5: Cost5 = (130 + 0.13 * Upgrade5) * Trucks5^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-3:\nEach route must have at least 5 trucks to ensure reliable service.\n// Trucks1 >= 5; Trucks2 >= 5; Trucks3 >= 5; Trucks4 >= 5; Trucks5 >= 5",
        "question": "A logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades, with the cost per kilometer decreasing nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes.\n\n| Route | Operational Cost Formula |\n|-------|--------------------------|\n| 1     | (100 + 0.1 * Upgrade1) * Trucks1^2 |\n| 2     | (120 + 0.12 * Upgrade2) * Trucks2^2 |\n| 3     | (110 + 0.11 * Upgrade3) * Trucks3^2 |\n| 4     | (90 + 0.09 * Upgrade4) * Trucks4^2 |\n| 5     | (130 + 0.13 * Upgrade5) * Trucks5^2 |\n\nThe company has a total budget of $100,000 for fuel efficiency upgrades across all routes. The total number of trucks available is limited to 100. Each route must have at least 5 trucks to ensure reliable service.\n\nPlease help the company to determine the optimal allocation of trucks and fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks on route 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=5)  # number of trucks on route 3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=5)  # number of trucks on route 4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks on route 5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for route 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for route 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for route 3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for route 4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for route 5\n\n# Define objective function\nCost1 = (100 + 0.1 * Upgrade1) * Trucks1**2\nCost2 = (120 + 0.12 * Upgrade2) * Trucks2**2\nCost3 = (110 + 0.11 * Upgrade3) * Trucks3**2\nCost4 = (90 + 0.09 * Upgrade4) * Trucks4**2\nCost5 = (130 + 0.13 * Upgrade5) * Trucks5**2\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n# The total number of trucks available is limited to 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route 1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route 2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route 3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route 4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route 5: \", model.getVal(Upgrade5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available across all products cannot exceed 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level. The labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price per Unit | Initial Labor Cost per Unit |\n|---------|------------------------|-----------------------------|\n| ProductA | $100                   | $50                          |\n| ProductB | $120                   | $60                          |\n| ProductC | $140                   | $70                          |\n\nThe total workforce available across all products cannot exceed 100 employees. The total investment in automation cannot exceed $50,000.\n\nPlease help the company to determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\nProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\nProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total workforce available across all products cannot exceed 100 employees.\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkforceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1328,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month. Additionally, the company must decide on the number of hours to allocate for production and maintenance for each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceD\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n// Profit from DeviceA: ProfitA = (100 - 40) * UnitsA - 20 * HoursA\n// Profit from DeviceB: ProfitB = (150 - 60) * UnitsB - 30 * HoursB\n// Profit from DeviceC: ProfitC = (200 - 80) * UnitsC - 40 * HoursC\n// Profit from DeviceD: ProfitD = (250 - 100) * UnitsD - 50 * HoursD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs next month.\n// 40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10,000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for production and maintenance next month.\n// HoursA + HoursB + HoursC + HoursD <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each device are produced next month.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50; UnitsD >= 50\n\n## Generate Constraint-4:\nThe production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC.\n// HoursD <= HoursA + HoursB + HoursC",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month and the number of hours to allocate for production and maintenance for each device. The selling price per unit, material cost per unit, and production cost per hour for each device are given in the following Table.\n\n| Device | Selling Price per Unit | Material Cost per Unit | Production Cost per Hour |\n|--------|------------------------|------------------------|--------------------------|\n| DeviceA | $100 | $40 | $20 |\n| DeviceB | $150 | $60 | $30 |\n| DeviceC | $200 | $80 | $40 |\n| DeviceD | $250 | $100 | $50 |\n\nThe company has a total budget of $10,000 for material costs next month. The company has a total of 500 hours available for production and maintenance next month. The company wants to ensure that at least 50 units of each device are produced next month. The production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC. \n\nPlease help the company to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=50) # number of units of DeviceD\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # production hours for DeviceA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # production hours for DeviceB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # production hours for DeviceC\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # production hours for DeviceD\n\n# Define objective function\nProfitA = (100 - 40) * UnitsA - 20 * HoursA\nProfitB = (150 - 60) * UnitsB - 30 * HoursB\nProfitC = (200 - 80) * UnitsC - 40 * HoursC\nProfitD = (250 - 100) * UnitsD - 50 * HoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $10,000 for material costs next month.\nmodel.addCons(40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10000)\n# The company has a total of 500 hours available for production and maintenance next month.\nmodel.addCons(HoursA + HoursB + HoursC + HoursD <= 500)\n# The company wants to ensure that at least 50 units of each device are produced next month.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 50)\nmodel.addCons(UnitsC >= 50)\nmodel.addCons(UnitsD >= 50)\n# The production hours for DeviceD must not exceed the combined production hours of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(HoursD <= HoursA + HoursB + HoursC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Hours for DeviceA: \", model.getVal(HoursA))\n    print(\"Hours for DeviceB: \", model.getVal(HoursB))\n    print(\"Hours for DeviceC: \", model.getVal(HoursC))\n    print(\"Hours for DeviceD: \", model.getVal(HoursD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover.\n// {\"number of refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of dry goods trucks\": \"DryGoodsTrucks\", \"range\": \"DryGoodsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average daily distance for refrigerated trucks\": \"RefrigeratedDistance\", \"range\": \"RefrigeratedDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for dry goods trucks\": \"DryGoodsDistance\", \"range\": \"DryGoodsDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for hazardous material trucks\": \"HazardousDistance\", \"range\": \"HazardousDistance >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company wants to maximize the net profit from the fleet expansion.\n// OperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\n// OperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\n// OperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\n// Revenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\n// Revenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\n// Revenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n// So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for the initial purchase of new trucks.\n// RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000\n\n## Generate Constraint-2:\nThe total daily distance all trucks can cover is limited to 5000 miles.\n// RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// RefrigeratedTrucks >= 5\n// DryGoodsTrucks >= 5\n// HazardousTrucks >= 5",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover. The cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company has a budget of $10,000 for the initial purchase of new trucks. The total daily distance all trucks can cover is limited to 5000 miles. The company must have at least 5 trucks of each type. \n\nPlease help the company to maximize the net profit from the fleet expansion.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=5)\nDryGoodsTrucks = model.addVar(vtype=\"INTEGER\", name=\"DryGoodsTrucks\", lb=5)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=5)\nRefrigeratedDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"RefrigeratedDistance\", lb=0)\nDryGoodsDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DryGoodsDistance\", lb=0)\nHazardousDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousDistance\", lb=0)\n\n# Define objective function\nOperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\nOperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\nOperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\nRevenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\nRevenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\nRevenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n# So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous))\n\n# Add constraints\n# The company has a budget of $10,000 for the initial purchase of new trucks.\nmodel.addCons(RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000)\n# The total daily distance all trucks can cover is limited to 5000 miles.\nmodel.addCons(RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Dry Goods Trucks: \", model.getVal(DryGoodsTrucks))\n    print(\"Number of Hazardous Material Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Average Daily Distance for Refrigerated Trucks: \", model.getVal(RefrigeratedDistance))\n    print(\"Average Daily Distance for Dry Goods Trucks: \", model.getVal(DryGoodsDistance))\n    print(\"Average Daily Distance for Hazardous Material Trucks: \", model.getVal(HazardousDistance))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in advanced technology for each plant, which enhances the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company aims to maximize the total energy production.\n// Energy_Solar = (SolarHours * (1 + 0.01 * SolarTechInvestment / 1000))\n// Energy_Wind = (WindHours * (1 + 0.01 * WindTechInvestment / 1000))\n// Energy_Hydro = (HydroHours * (1 + 0.01 * HydroTechInvestment / 1000))\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000\n\n## Generate Constraint-2:\nThe total operational hours for all plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24\n\n## Generate Constraint-3:\nDue to maintenance requirements, each plant must operate at least 2 hours per day.\n// SolarHours >= 2; WindHours >= 2; HydroHours >= 2\n\n## Generate Constraint-4:\nThe investment in advanced technology for each plant must not exceed $20,000.\n// SolarTechInvestment <= 20000; WindTechInvestment <= 20000; HydroTechInvestment <= 20000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company has a total budget of $50,000 for technology investments and operational costs. The total operational hours for all plants must not exceed 24 hours per day. Due to maintenance requirements, each plant must operate at least 2 hours per day. The investment in advanced technology for each plant must not exceed $20,000. Please help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=2)  # number of hours Solar plant operates\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=2)  # number of hours Wind plant operates\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=2)  # number of hours Hydro plant operates\nSolarTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarTechInvestment\", lb=0)  # investment in advanced technology for Solar\nWindTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindTechInvestment\", lb=0)  # investment in advanced technology for Wind\nHydroTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroTechInvestment\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nEnergy_Solar = SolarHours * (1 + 0.01 * SolarTechInvestment / 1000)\nEnergy_Wind = WindHours * (1 + 0.01 * WindTechInvestment / 1000)\nEnergy_Hydro = HydroHours * (1 + 0.01 * HydroTechInvestment / 1000)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\nmodel.addCons(SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\nmodel.addCons(SolarTechInvestment <= 20000)\nmodel.addCons(WindTechInvestment <= 20000)\nmodel.addCons(HydroTechInvestment <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(SolarHours))\n    print(\"Number of hours Wind plant operates: \", model.getVal(WindHours))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(WindTechInvestment))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(HydroTechInvestment))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000\n\n## Generate Constraint-2:\nDue to space limitations, the total number of trucks cannot exceed 60.\n// SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60\n\n## Generate Constraint-3:\nThe company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations.\n// RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks)\n\n## Generate Constraint-4:\nThe company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts.\n// HeavyDutyTrucks >= 20",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost and revenue per truck for each type are given in the following Table.\n\n| Truck Type          | Operational Cost | Revenue |\n|---------------------|------------------|---------|\n| Small               | $50,000          | $70,000 |\n| Medium              | $75,000          | $100,000|\n| Large               | $100,000         | $130,000|\n| Refrigerated        | $120,000         | $150,000|\n| Heavy-Duty          | $150,000         | $180,000|\n\nThe company has a budget of $5,000,000 for purchasing new trucks. Due to space limitations, the total number of trucks cannot exceed 60. The company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations. Additionally, the company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60)\nmodel.addCons(RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks))\nmodel.addCons(HeavyDutyTrucks >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions.\n// Net profit for Region A: Profit_A = (1.5 - 0.5) * Trucks_A\n// Net profit for Region B: Profit_B = (1.6 - 0.6) * Trucks_B\n// Net profit for Region C: Profit_C = (1.7 - 0.7) * Trucks_C\n// Net profit for Region D: Profit_D = (1.8 - 0.8) * Trucks_D\n// Net profit for Region E: Profit_E = (1.9 - 0.9) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, Region A must have at least 10% of the total trucks.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs. The cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions. The company has a total of 50 trucks available for allocation. Due to regional regulations, Region A must have at least 10% of the total trucks. Please help the company to maximize the net profit per kilometer across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1.5 - 0.5) * Trucks_A\nProfit_B = (1.6 - 0.6) * Trucks_B\nProfit_C = (1.7 - 0.7) * Trucks_C\nProfit_D = (1.8 - 0.8) * Trucks_D\nProfit_E = (1.9 - 0.9) * Trucks_E\nTotal_Trucks = Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Total_Trucks\n## convert the division to multiplication\nmodel.addCons(obj * Total_Trucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n## Due to regional regulations, Region A must have at least 10% of the total trucks.\nmodel.addCons(Trucks_A >= 0.1 * Total_Trucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n// Total net profit for RegionA: Profit_A = (100,000 - 50,000) * TrucksA\n// Total net profit for RegionB: Profit_B = (120,000 - 60,000) * TrucksB\n// Total net profit for RegionC: Profit_C = (140,000 - 70,000) * TrucksC\n// Total net profit for RegionD: Profit_D = (160,000 - 80,000) * TrucksD\n// Total net profit for RegionE: Profit_E = (180,000 - 90,000) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regional regulations, RegionA must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $2,000,000 for operating costs for the quarter.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,000,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each region has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-5:\nThe company aims to have no more than 30% of the trucks in any single region.\n// TrucksA <= 0.3 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksB <= 0.3 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksC <= 0.3 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksD <= 0.3 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksE <= 0.3 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs. The cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n\nThe company has a total of 40 trucks available for allocation. Due to regional regulations, RegionA must have at least 10% of the total trucks. The company has a budget of $2,000,000 for operating costs for the quarter. The company wants to ensure that each region has at least one truck allocated. The company aims to have no more than 30% of the trucks in any single region.\n\nPlease help the company to maximize the net profit per truck, which is defined as the sum of the net profits for each region divided by the total number of trucks allocated.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100000 - 50000) * TrucksA\nProfit_B = (120000 - 60000) * TrucksB\nProfit_C = (140000 - 70000) * TrucksC\nProfit_D = (160000 - 80000) * TrucksD\nProfit_E = (180000 - 90000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regional regulations, RegionA must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * TotalTrucks)\n## The company has a budget of $2,000,000 for operating costs for the quarter.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2000000)\n## The company wants to ensure that each region has at least one truck allocated.\nmodel.addCons(TrucksA >= 1)\nmodel.addCons(TrucksB >= 1)\nmodel.addCons(TrucksC >= 1)\nmodel.addCons(TrucksD >= 1)\nmodel.addCons(TrucksE >= 1)\n## The company aims to have no more than 30% of the trucks in any single region.\nmodel.addCons(TrucksA <= 0.3 * TotalTrucks)\nmodel.addCons(TrucksB <= 0.3 * TotalTrucks)\nmodel.addCons(TrucksC <= 0.3 * TotalTrucks)\nmodel.addCons(TrucksD <= 0.3 * TotalTrucks)\nmodel.addCons(TrucksE <= 0.3 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities (City1, City2, City3, City4, City5) and the fuel efficiency of each truck, which can be improved with an investment in fuel-efficient technologies.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for each truck\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. The fuel efficiency of the trucks can be improved with an investment, reducing the fuel cost per trip. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company aims to maximize the total profit from all trips.\n// Profit per trip to City1: Profit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\n// Profit per trip to City2: Profit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\n// Profit per trip to City3: Profit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\n// Profit per trip to City4: Profit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\n// Profit per trip to City5: Profit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency investments.\n// EfficiencyInvestment <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2.\n// Trips1 >= 50; Trips2 >= 75",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities (City1, City2, City3, City4, City5). The company needs to determine the number of trips each truck should make to different cities and the investment in fuel efficiency for each truck, which can be improved with an investment in fuel-efficient technologies. The profit per trip varies by city and is affected by the fuel efficiency of the trucks. The base profit per trip to City1 is $100, to City2 is $150, to City3 is $200, to City4 is $250, and to City5 is $300. For every $1000 invested in fuel efficiency, the fuel cost per trip decreases by $10. The company has a budget of $10,000 for fuel efficiency investments. The total number of trips across all cities must not exceed 500. Due to contractual obligations, the company must make at least 50 trips to City1 and 75 trips to City2. Please help the company to maximize the total profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)    # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)    # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)    # number of trips to City5\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in fuel efficiency\n\n# Define objective function\nProfit1 = (100 - 0.01 * EfficiencyInvestment) * Trips1\nProfit2 = (150 - 0.01 * EfficiencyInvestment) * Trips2\nProfit3 = (200 - 0.01 * EfficiencyInvestment) * Trips3\nProfit4 = (250 - 0.01 * EfficiencyInvestment) * Trips4\nProfit5 = (300 - 0.01 * EfficiencyInvestment) * Trips5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 10000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in fuel efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for Small trucks\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Medium trucks\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Large trucks\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Extra-Large trucks\": \"MaintenanceExtraLarge\", \"range\": \"MaintenanceExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n// Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n// Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n// Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n// Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Maximize (RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance. The revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n\n| Truck Type       | Cost of Truck | Maintenance Cost per Hour |\n|------------------|---------------|---------------------------|\n| Small            | $50,000       | $100                      |\n| Medium           | $70,000       | $100                      |\n| Large            | $90,000       | $100                      |\n| Extra-Large      | $110,000      | $100                      |\n\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. Please help the company determine the optimal number of each type of truck to purchase and the maintenance hours to allocate to each type of truck to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)\nMaintenanceExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceExtraLarge\", lb=0)\n\n# Define objective function\nBaseRevenueSmall = 10000  # Example base revenue for Small trucks\nBaseRevenueMedium = 15000  # Example base revenue for Medium trucks\nBaseRevenueLarge = 20000  # Example base revenue for Large trucks\nBaseRevenueExtraLarge = 25000  # Example base revenue for Extra-Large trucks\n\nRevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\nRevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\nRevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\nRevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Maintenance Hours for Small Trucks: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Hours for Medium Trucks: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Hours for Large Trucks: \", model.getVal(MaintenanceLarge))\n    print(\"Maintenance Hours for Extra-Large Trucks: \", model.getVal(MaintenanceExtraLarge))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1462,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region1\": \"Storage1\", \"range\": \"Storage1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region2\": \"Storage2\", \"range\": \"Storage2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region3\": \"Storage3\", \"range\": \"Storage3 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region4\": \"SolarPanels4\", \"range\": \"SolarPanels4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region4\": \"WindTurbines4\", \"range\": \"WindTurbines4 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region4\": \"Storage4\", \"range\": \"Storage4 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region5\": \"SolarPanels5\", \"range\": \"SolarPanels5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region5\": \"WindTurbines5\", \"range\": \"WindTurbines5 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region5\": \"Storage5\", \"range\": \"Storage5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Total energy output from Region1: Output1 = (SolarPanels1 * (100 + 0.1 * Storage1^2)) + (WindTurbines1 * (200 + 0.2 * Storage1^3))\n// Total energy output from Region2: Output2 = (SolarPanels2 * (100 + 0.1 * Storage2^2)) + (WindTurbines2 * (200 + 0.2 * Storage2^3))\n// Total energy output from Region3: Output3 = (SolarPanels3 * (100 + 0.1 * Storage3^2)) + (WindTurbines3 * (200 + 0.2 * Storage3^3))\n// Total energy output from Region4: Output4 = (SolarPanels4 * (100 + 0.1 * Storage4^2)) + (WindTurbines4 * (200 + 0.2 * Storage4^3))\n// Total energy output from Region5: Output5 = (SolarPanels5 * (100 + 0.1 * Storage5^2)) + (WindTurbines5 * (200 + 0.2 * Storage5^3))\n// So, the objective function is: Maximize (Output1 + Output2 + Output3 + Output4 + Output5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all installations and storage investments.\n// SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1,000,000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions. The company has a total budget of $1,000,000 for all installations and storage investments. Please help the company to determine the optimal number of solar panels, wind turbines, and investments in energy storage systems for each region to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nStorage1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nStorage2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nStorage3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage3\", lb=0)\nSolarPanels4 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels4\", lb=0)\nWindTurbines4 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines4\", lb=0)\nStorage4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage4\", lb=0)\nSolarPanels5 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels5\", lb=0)\nWindTurbines5 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines5\", lb=0)\nStorage5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage5\", lb=0)\n\n# Define objective function\nOutput1 = SolarPanels1 * (100 + 0.1 * Storage1**2) + WindTurbines1 * (200 + 0.2 * Storage1**3)\nOutput2 = SolarPanels2 * (100 + 0.1 * Storage2**2) + WindTurbines2 * (200 + 0.2 * Storage2**3)\nOutput3 = SolarPanels3 * (100 + 0.1 * Storage3**2) + WindTurbines3 * (200 + 0.2 * Storage3**3)\nOutput4 = SolarPanels4 * (100 + 0.1 * Storage4**2) + WindTurbines4 * (200 + 0.2 * Storage4**3)\nOutput5 = SolarPanels5 * (100 + 0.1 * Storage5**2) + WindTurbines5 * (200 + 0.2 * Storage5**3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output1 + Output2 + Output3 + Output4 + Output5)\n\n# Add constraints\nmodel.addCons(SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Investment in Storage in Region1: \", model.getVal(Storage1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Investment in Storage in Region2: \", model.getVal(Storage2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in Storage in Region3: \", model.getVal(Storage3))\n    print(\"Number of Solar Panels in Region4: \", model.getVal(SolarPanels4))\n    print(\"Number of Wind Turbines in Region4: \", model.getVal(WindTurbines4))\n    print(\"Investment in Storage in Region4: \", model.getVal(Storage4))\n    print(\"Number of Solar Panels in Region5: \", model.getVal(SolarPanels5))\n    print(\"Number of Wind Turbines in Region5: \", model.getVal(WindTurbines5))\n    print(\"Investment in Storage in Region5: \", model.getVal(Storage5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\n// Total revenue for ProductB: RevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\n// Total revenue for ProductC: RevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $100,000.\n// MachineryA + MachineryB + MachineryC <= 100000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 50 units of ProductA and 100 units of ProductB.\n// UnitsA >= 50; UnitsB >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume. The labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products. The company has a total of 10,000 labor hours available for the month. The total capital investment in advanced machinery cannot exceed $100,000. The total marketing budget cannot exceed $50,000. Due to market demand, the company must produce at least 50 units of ProductA and 100 units of ProductB. Please help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours per unit of ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours per unit of ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours per unit of ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in machinery for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nRevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\nRevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\nRevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 100000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 100)\n\n# Constraint to link labor hours with machinery investment\nmodel.addCons(LaborA == 10 - MachineryA / 10000)\nmodel.addCons(LaborB == 15 - MachineryB / 10000)\nmodel.addCons(LaborC == 20 - MachineryC / 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. The efficiency factors for each route are as follows:\n\n| Route | Efficiency Factor |\n|-------|-------------------|\n| A     | 0.8               |\n| B     | 0.9               |\n| C     | 1.1               |\n| D     | 1.2               |\n| E     | 1.3               |\n\nThe company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. \n\nPlease help the company to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: CityA, CityB, CityC, CityD, and CityE. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for CityA route\": \"Trucks_CityA\", \"range\": \"Trucks_CityA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB route\": \"Trucks_CityB\", \"range\": \"Trucks_CityB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC route\": \"Trucks_CityC\", \"range\": \"Trucks_CityC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD route\": \"Trucks_CityD\", \"range\": \"Trucks_CityD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityE route\": \"Trucks_CityE\", \"range\": \"Trucks_CityE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For CityA, the fuel consumption per truck is 100 liters, and the travel time is 5 hours. For CityB, the fuel consumption per truck is 120 liters, and the travel time is 6 hours. For CityC, the fuel consumption per truck is 150 liters, and the travel time is 7 hours. For CityD, the fuel consumption per truck is 130 liters, and the travel time is 8 hours. For CityE, the fuel consumption per truck is 140 liters, and the travel time is 9 hours. The company wants to minimize the total fuel consumption and travel time.\n// Fuel_CityA = 100 * Trucks_CityA^1.2\n// Fuel_CityB = 120 * Trucks_CityB^1.2\n// Fuel_CityC = 150 * Trucks_CityC^1.2\n// Fuel_CityD = 130 * Trucks_CityD^1.2\n// Fuel_CityE = 140 * Trucks_CityE^1.2\n// Time_CityA = 5 * Trucks_CityA^0.8\n// Time_CityB = 6 * Trucks_CityB^0.8\n// Time_CityC = 7 * Trucks_CityC^0.8\n// Time_CityD = 8 * Trucks_CityD^0.8\n// Time_CityE = 9 * Trucks_CityE^0.8\n// So, the objective function is: Minimize (Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE + Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_CityA + Trucks_CityB + Trucks_CityC + Trucks_CityD + Trucks_CityE <= 50\n\n## Generate Constraint-2:\nDue to road capacity limitations, the number of trucks on the CityC route must not exceed the number on the CityA route by more than 10.\n// Trucks_CityC - Trucks_CityA <= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: CityA, CityB, CityC, CityD, and CityE. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each route are given in the following Table.\n\n| City | Fuel Consumption per Truck | Travel Time per Truck |\n|------|----------------------------|-----------------------|\n| CityA | 100 liters | 5 hours |\n| CityB | 120 liters | 6 hours |\n| CityC | 150 liters | 7 hours |\n| CityD | 130 liters | 8 hours |\n| CityE | 140 liters | 9 hours |\n\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. The company has a total of 50 trucks available for allocation. Due to road capacity limitations, the number of trucks on the CityC route must not exceed the number on the CityA route by more than 10.\n\nPlease help the company to minimize the total fuel consumption and travel time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_CityA = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityA\", lb=0)  # number of trucks for CityA route\nTrucks_CityB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityB\", lb=0)  # number of trucks for CityB route\nTrucks_CityC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityC\", lb=0)  # number of trucks for CityC route\nTrucks_CityD = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityD\", lb=0)  # number of trucks for CityD route\nTrucks_CityE = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityE\", lb=0)  # number of trucks for CityE route\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel consumption and travel time calculations\nFuel_CityA = 100 * Trucks_CityA**1.2\nFuel_CityB = 120 * Trucks_CityB**1.2\nFuel_CityC = 150 * Trucks_CityC**1.2\nFuel_CityD = 130 * Trucks_CityD**1.2\nFuel_CityE = 140 * Trucks_CityE**1.2\nTime_CityA = 5 * Trucks_CityA**0.8\nTime_CityB = 6 * Trucks_CityB**0.8\nTime_CityC = 7 * Trucks_CityC**0.8\nTime_CityD = 8 * Trucks_CityD**0.8\nTime_CityE = 9 * Trucks_CityE**0.8\n\n## the objective function is: Minimize (Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE + Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE)\nmodel.addCons(obj == Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE + Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks_CityA + Trucks_CityB + Trucks_CityC + Trucks_CityD + Trucks_CityE <= 50)\n\n## Due to road capacity limitations, the number of trucks on the CityC route must not exceed the number on the CityA route by more than 10.\nmodel.addCons(Trucks_CityC - Trucks_CityA <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA route: \", model.getVal(Trucks_CityA))\n    print(\"Number of Trucks for CityB route: \", model.getVal(Trucks_CityB))\n    print(\"Number of Trucks for CityC route: \", model.getVal(Trucks_CityC))\n    print(\"Number of Trucks for CityD route: \", model.getVal(Trucks_CityD))\n    print(\"Number of Trucks for CityE route: \", model.getVal(Trucks_CityE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software for Small trucks\": \"SoftwareSmall\", \"range\": \"SoftwareSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Medium trucks\": \"SoftwareMedium\", \"range\": \"SoftwareMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Large trucks\": \"SoftwareLarge\", \"range\": \"SoftwareLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\n// Total operational cost for Medium trucks: CostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\n// Total operational cost for Large trucks: CostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software.\n// 1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks should not exceed 500.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 500\n\n## Generate Constraint-3:\nThe company must purchase at least 50 Small trucks and 100 Medium trucks.\n// SmallTrucks >= 50; MediumTrucks >= 100\n\n## Generate Constraint-4:\nThe investment in fleet management software for each type of truck should not exceed $100,000.\n// SoftwareSmall <= 100000; SoftwareMedium <= 100000; SoftwareLarge <= 100000",
        "question": "A logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck. The operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n\n| Truck Type | Operational Cost per Truck | Decrease in Cost per $1000 Software Investment |\n|------------|-----------------------------|------------------------------------------------|\n| Small      | $1000                       | $50 per truck                                  |\n| Medium     | $1500                       | $75 per truck                                  |\n| Large      | $2000                       | $100 per truck                                 |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software. The total number of trucks should not exceed 500. The company must purchase at least 50 Small trucks and 100 Medium trucks. The investment in fleet management software for each type of truck should not exceed $100,000.\n\nPlease help the company to determine the optimal number of each type of truck to purchase and the corresponding investment in fleet management software to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=50)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=100)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nSoftwareSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareSmall\", lb=0)  # investment in fleet management software for Small trucks\nSoftwareMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareMedium\", lb=0)  # investment in fleet management software for Medium trucks\nSoftwareLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareLarge\", lb=0)  # investment in fleet management software for Large trucks\n\n# Define objective function\nCostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\nCostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\nCostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 500)\nmodel.addCons(SoftwareSmall <= 100000)\nmodel.addCons(SoftwareMedium <= 100000)\nmodel.addCons(SoftwareLarge <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Software for Small Trucks: \", model.getVal(SoftwareSmall))\n    print(\"Investment in Software for Medium Trucks: \", model.getVal(SoftwareMedium))\n    print(\"Investment in Software for Large Trucks: \", model.getVal(SoftwareLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1883,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of labor per hour is $20. The investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - 20 * LA) * QA - IA\n// ProfitB = (150 - 20 * LB) * QB - IB\n// ProfitC = (200 - 20 * LC) * QC - IC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 5000 labor hours available for the month.\n// QA * LA + QB * LB + QC * LC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit. The revenue per unit and the cost of labor per hour for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost of Labor per Hour |\n|---------|------------------|------------------------|\n| ProductA | $100             | $20                    |\n| ProductB | $150             | $20                    |\n| ProductC | $200             | $20                    |\n\nThe investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company has a total of 5000 labor hours available for the month. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=0) # labor hours per unit for ProductA\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=0) # labor hours per unit for ProductB\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=0) # labor hours per unit for ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in automation for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in automation for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (100 - 20 * LA) * QA - IA\nProfitB = (150 - 20 * LB) * QB - IB\nProfitC = (200 - 20 * LC) * QC - IC\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 5000 labor hours available for the month.\nmodel.addCons(QA * LA + QB * LB + QC * LC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Labor hours per unit for ProductA: \", model.getVal(LA))\n    print(\"Labor hours per unit for ProductB: \", model.getVal(LB))\n    print(\"Labor hours per unit for ProductC: \", model.getVal(LC))\n    print(\"Investment in automation for ProductA: \", model.getVal(IA))\n    print(\"Investment in automation for ProductB: \", model.getVal(IB))\n    print(\"Investment in automation for ProductC: \", model.getVal(IC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The decision involves determining the number of solar panels to install in each district.\n// {\"number of solar panels in district A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent.\n// Energy production: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\n// Total cost: Cost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n// So, the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / (1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000\n\n## Generate Constraint-2:\nEach district must have at least 100 solar panels installed.\n// A >= 100; B >= 100; C >= 100; D >= 100; E >= 100",
        "question": "A city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent. The city has a budget of $500,000 for the installation of solar panels. Each district must have at least 100 solar panels installed. Please help the city determine the number of solar panels to install in each district to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each district must have at least 100 solar panels installed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of solar panels in district A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=100) # number of solar panels in district B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # number of solar panels in district C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=100) # number of solar panels in district D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=100) # number of solar panels in district E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\nCost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n## the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in District A: \", model.getVal(A))\n    print(\"Number of Solar Panels in District B: \", model.getVal(B))\n    print(\"Number of Solar Panels in District C: \", model.getVal(C))\n    print(\"Number of Solar Panels in District D: \", model.getVal(D))\n    print(\"Number of Solar Panels in District E: \", model.getVal(E))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints.\n// {\"number of solar units\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar unit is $5000 with an annual maintenance cost of $500, and it generates 10 MWh of energy per year.\nThe cost of installing each wind unit is $8000 with an annual maintenance cost of $800, and it generates 15 MWh of energy per year.\nThe cost of installing each hydro unit is $10000 with an annual maintenance cost of $1000, and it generates 20 MWh of energy per year.\nThe cost of installing each geothermal unit is $12000 with an annual maintenance cost of $1200, and it generates 25 MWh of energy per year.\nThe cost of installing each biomass unit is $6000 with an annual maintenance cost of $600, and it generates 12 MWh of energy per year.\nThe company wants to minimize the total cost of installation and maintenance.\n// Total installation cost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n// Total annual maintenance cost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n// So, the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for installation.\n// 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000\n\n## Generate Constraint-2:\nThe company needs to generate at least 1000 MWh of energy per year.\n// 10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed.\n// Solar <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Wind <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Hydro <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Geothermal <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n// Biomass <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass)\n\n## Generate Constraint-4:\nThe company has space constraints that limit the total number of units to 25.\n// Solar + Wind + Hydro + Geothermal + Biomass <= 25",
        "question": "A company is planning to optimize its energy consumption by installing five different types of renewable energy systems: Solar, Wind, Hydro, Geothermal, and Biomass. The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints. The cost of installation, annual maintenance cost, and energy generation for each type of unit are given in the following Table.\n\n| Type          | Installation Cost | Annual Maintenance Cost | Energy Generation (MWh/year) |\n|---------------|-------------------|-------------------------|------------------------------|\n| Solar         | $5000             | $500                    | 10                           |\n| Wind          | $8000             | $800                    | 15                           |\n| Hydro         | $10000            | $1000                   | 20                           |\n| Geothermal    | $12000            | $1200                   | 25                           |\n| Biomass       | $6000             | $600                    | 12                           |\n\nThe company has a budget of $200,000 for installation. The company needs to generate at least 1000 MWh of energy per year. The company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed. The company also has space constraints that limit the total number of units to 25.\n\nPlease help the company to minimize the total cost of installation and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar units\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind units\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro units\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal units\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass units\n\n# Define objective function\n## Total installation cost and Total annual maintenance cost\nTotalInstallationCost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\nTotalAnnualMaintenanceCost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\nmodel.addCons(obj == TotalInstallationCost + TotalAnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $200,000 for installation.\nmodel.addCons(5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000)\n## The company needs to generate at least 1000 MWh of energy per year.\nmodel.addCons(10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000)\n## The company wants to ensure diversity in energy sources, limiting the number of units of any single type to no more than 30% of the total units installed.\nmodel.addCons(Solar <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Wind <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Hydro <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Geothermal <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\nmodel.addCons(Biomass <= 0.3 * (Solar + Wind + Hydro + Geothermal + Biomass))\n## The company has space constraints that limit the total number of units to 25.\nmodel.addCons(Solar + Wind + Hydro + Geothermal + Biomass <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(Solar))\n    print(\"Number of Wind Units: \", model.getVal(Wind))\n    print(\"Number of Hydro Units: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Units: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Units: \", model.getVal(Biomass))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1584,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices using 5 different machines. The company needs to optimize the allocation of workers to each machine to maximize efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate based on the number of workers assigned. The efficiency is modeled as a nonlinear function where the output increases with more workers but at a decreasing rate. The efficiency function for each machine is:\n- Machine 1: E1 = 100 * M1 / (M1^2 + 1)\n- Machine 2: E2 = 120 * M2 / (M2^2 + 4)\n- Machine 3: E3 = 140 * M3 / (M3^2 + 9)\n- Machine 4: E4 = 160 * M4 / (M4^2 + 16)\n- Machine 5: E5 = 180 * M5 / (M5^2 + 25)\nThe company aims to maximize the total efficiency of all machines.\n// The objective function is: Maximize E = E1 + E2 + E3 + E4 + E5\n\n## Generate Constraint-1:\nThere are a total of 30 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 30\n\n## Generate Constraint-2:\nEach machine can handle a maximum of 10 workers at a time.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10\n\n## Generate Constraint-3:\nThe company requires at least 2 workers to operate each machine.\n// M1 >= 2; M2 >= 2; M3 >= 2; M4 >= 2; M5 >= 2",
        "question": "A manufacturing company produces 3 types of electronic devices using 5 different machines. The company needs to optimize the allocation of workers to each machine to maximize efficiency. Each machine has a different efficiency rate based on the number of workers assigned, modeled as a nonlinear function where the output increases with more workers but at a decreasing rate. The efficiency function for each machine is:\n- Machine 1: E1 = 100 * M1 / (M1^2 + 1)\n- Machine 2: E2 = 120 * M2 / (M2^2 + 4)\n- Machine 3: E3 = 140 * M3 / (M3^2 + 9)\n- Machine 4: E4 = 160 * M4 / (M4^2 + 16)\n- Machine 5: E5 = 180 * M5 / (M5^2 + 25)\nThe company aims to maximize the total efficiency of all machines. There are a total of 30 workers available. Each machine can handle a maximum of 10 workers at a time. The company requires at least 2 workers to operate each machine.\nPlease help the company determine the optimal number of workers to assign to each machine (M1, M2, M3, M4, M5) to maximize the total efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=2, ub=10) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=2, ub=10) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=2, ub=10) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=2, ub=10) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=2, ub=10) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define efficiency functions\nE1 = 100 * M1 / (M1**2 + 1)\nE2 = 120 * M2 / (M2**2 + 4)\nE3 = 140 * M3 / (M3**2 + 9)\nE4 = 160 * M4 / (M4**2 + 16)\nE5 = 180 * M5 / (M5**2 + 25)\n\n## the objective function is: Maximize E = E1 + E2 + E3 + E4 + E5\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5)\n\n# Add constraints\n## There are a total of 30 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 30)\n\n## Each machine can handle a maximum of 10 workers at a time.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n\n## The company requires at least 2 workers to operate each machine.\nmodel.addCons(M1 >= 2)\nmodel.addCons(M2 >= 2)\nmodel.addCons(M3 >= 2)\nmodel.addCons(M4 >= 2)\nmodel.addCons(M5 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to differences in fuel efficiency, maintenance costs, and distance. \nFor route R1, the cost per truck is $1000, and the delivery efficiency (goods delivered per hour) is 50 units.\nFor route R2, the cost per truck is $1200, and the delivery efficiency is 60 units.\nFor route R3, the cost per truck is $1500, and the delivery efficiency is 70 units.\nFor route R4, the cost per truck is $1800, and the delivery efficiency is 80 units.\nFor route R5, the cost per truck is $2000, and the delivery efficiency is 90 units.\nThe company wants to minimize the total cost while maintaining a certain level of delivery efficiency.\n// Cost_R1 = 1000 * T1\n// Cost_R2 = 1200 * T2\n// Cost_R3 = 1500 * T3\n// Cost_R4 = 1800 * T4\n// Cost_R5 = 2000 * T5\n// Delivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n// The objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe minimum required delivery efficiency is 2000 units per hour.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 2000",
        "question": "A logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\nFor route R1, the cost per truck is $1000, and the delivery efficiency (goods delivered per hour) is 50 units.\nFor route R2, the cost per truck is $1200, and the delivery efficiency is 60 units.\nFor route R3, the cost per truck is $1500, and the delivery efficiency is 70 units.\nFor route R4, the cost per truck is $1800, and the delivery efficiency is 80 units.\nFor route R5, the cost per truck is $2000, and the delivery efficiency is 90 units.\nThe company has a total budget of $100,000 for operating costs. The total number of trucks available is 50. The minimum required delivery efficiency is 2000 units per hour.\nPlease help the company to minimize the total cost while maintaining a certain level of delivery efficiency, defined as the sum of the operating costs divided by the delivery efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_R1 = 1000 * T1\nCost_R2 = 1200 * T2\nCost_R3 = 1500 * T3\nCost_R4 = 1800 * T4\nCost_R5 = 2000 * T5\nDelivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n## the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Efficiency == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\n## The company has a total budget of $100,000 for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The minimum required delivery efficiency is 2000 units per hour.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. Route 1 has a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 has 12 - 0.12 * T2, Route 3 has 15 - 0.15 * T3, Route 4 has 11 - 0.11 * T4, and Route 5 has 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time.\n// Fuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n// Time_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n// So, the objective function is: Minimize (Fuel_Cost + Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 10 trucks.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe minimum fuel efficiency for any route must be at least 5 km/liter.\n// 10 - 0.1 * T1 >= 5; 12 - 0.12 * T2 >= 5; 15 - 0.15 * T3 >= 5; 11 - 0.11 * T4 >= 5; 9 - 0.09 * T5 >= 5\n\n## Generate Constraint-4:\nThe delivery time for any route must not exceed 20 hours.\n// 500 / T1 <= 20; 450 / T2 <= 20; 400 / T3 <= 20; 350 / T4 <= 20; 300 / T5 <= 20",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route decreases with the number of trucks assigned, and the delivery time for each route is inversely proportional to the number of trucks. The details for each route are given in the following Table.\n\n| Route | Fuel Efficiency (km/liter) | Delivery Time (hours) |\n|-------|---------------------------|-----------------------|\n| 1     | 10 - 0.1 * T1             | 500 / T1              |\n| 2     | 12 - 0.12 * T2            | 450 / T2              |\n| 3     | 15 - 0.15 * T3            | 400 / T3              |\n| 4     | 11 - 0.11 * T4            | 350 / T4              |\n| 5     | 9 - 0.09 * T5             | 300 / T5              |\n\nThe company has a total of 50 trucks available. Each route can handle a maximum of 10 trucks. The minimum fuel efficiency for any route must be at least 5 km/liter, and the delivery time for any route must not exceed 20 hours. \n\nPlease help the company to minimize the total cost of fuel and time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate Fuel_Cost\nFuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n## convert the division to multiplication\nFuel_Cost = T1 * (1000 / (10 - 0.1 * T1)) + T2 * (1000 / (12 - 0.12 * T2)) + T3 * (1000 / (15 - 0.15 * T3)) + T4 * (1000 / (11 - 0.11 * T4)) + T5 * (1000 / (9 - 0.09 * T5))\n\n## calculate Time_Cost\nTime_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n## convert the division to multiplication\nTime_Cost = 500 * (1 / T1) + 450 * (1 / T2) + 400 * (1 / T3) + 350 * (1 / T4) + 300 * (1 / T5)\n\n## the objective function is: Minimize (Fuel_Cost + Time_Cost)\nmodel.addCons(obj == Fuel_Cost + Time_Cost)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## Each route can handle a maximum of 10 trucks.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n## The minimum fuel efficiency for any route must be at least 5 km/liter.\nmodel.addCons(10 - 0.1 * T1 >= 5)\nmodel.addCons(12 - 0.12 * T2 >= 5)\nmodel.addCons(15 - 0.15 * T3 >= 5)\nmodel.addCons(11 - 0.11 * T4 >= 5)\nmodel.addCons(9 - 0.09 * T5 >= 5)\n## The delivery time for any route must not exceed 20 hours.\nmodel.addCons(500 / T1 <= 20)\nmodel.addCons(450 / T2 <= 20)\nmodel.addCons(400 / T3 <= 20)\nmodel.addCons(350 / T4 <= 20)\nmodel.addCons(300 / T5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations.\n// {\"size of the playground (in square meters)\": \"Playground\", \"range\": \"Playground >= 0\", \"type\": \"real\"}\n// {\"size of the sports field (in square meters)\": \"SportsField\", \"range\": \"SportsField >= 0\", \"type\": \"real\"}\n// {\"size of the picnic area (in square meters)\": \"PicnicArea\", \"range\": \"PicnicArea >= 0\", \"type\": \"real\"}\n// {\"size of the botanical garden (in square meters)\": \"BotanicalGarden\", \"range\": \"BotanicalGarden >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe satisfaction derived from each facility is estimated as follows: Playground satisfaction is 0.05 * Playground^2, SportsField satisfaction is 0.08 * SportsField^2, PicnicArea satisfaction is 0.03 * PicnicArea^2, and BotanicalGarden satisfaction is 0.1 * BotanicalGarden^2. The city council aims to maximize the total satisfaction from all facilities.\n// Total satisfaction: Satisfaction = 0.05 * Playground^2 + 0.08 * SportsField^2 + 0.03 * PicnicArea^2 + 0.1 * BotanicalGarden^2\n// So, the objective function is: Maximize Satisfaction\n\n## Generate Constraint-1:\nThe total area available for the park is 10,000 square meters.\n// Playground + SportsField + PicnicArea + BotanicalGarden <= 10000\n\n## Generate Constraint-2:\nThe budget for the park development is $500,000. The cost of developing each facility is as follows: Playground costs $100 per square meter, SportsField costs $150 per square meter, PicnicArea costs $50 per square meter, and BotanicalGarden costs $200 per square meter.\n// 100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000",
        "question": "A city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations. The satisfaction derived from each facility is estimated as follows: Playground satisfaction is 0.05 * Playground^2, SportsField satisfaction is 0.08 * SportsField^2, PicnicArea satisfaction is 0.03 * PicnicArea^2, and BotanicalGarden satisfaction is 0.1 * BotanicalGarden^2. The total area available for the park is 10,000 square meters. The budget for the park development is $500,000, with the cost of developing each facility as follows: Playground costs $100 per square meter, SportsField costs $150 per square meter, PicnicArea costs $50 per square meter, and BotanicalGarden costs $200 per square meter. Please help the city council to maximize the total satisfaction from all facilities.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPlayground = model.addVar(vtype=\"CONTINUOUS\", name=\"Playground\", lb=0)  # size of the playground\nSportsField = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsField\", lb=0)  # size of the sports field\nPicnicArea = model.addVar(vtype=\"CONTINUOUS\", name=\"PicnicArea\", lb=0)  # size of the picnic area\nBotanicalGarden = model.addVar(vtype=\"CONTINUOUS\", name=\"BotanicalGarden\", lb=0)  # size of the botanical garden\n\n# Define objective function\nSatisfaction_Playground = 0.05 * Playground**2\nSatisfaction_SportsField = 0.08 * SportsField**2\nSatisfaction_PicnicArea = 0.03 * PicnicArea**2\nSatisfaction_BotanicalGarden = 0.1 * BotanicalGarden**2\nTotal_Satisfaction = Satisfaction_Playground + Satisfaction_SportsField + Satisfaction_PicnicArea + Satisfaction_BotanicalGarden\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Satisfaction)\n\n# Add constraints\n# The total area available for the park is 10,000 square meters.\nmodel.addCons(Playground + SportsField + PicnicArea + BotanicalGarden <= 10000)\n# The budget for the park development is $500,000.\nmodel.addCons(100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Size of Playground: \", model.getVal(Playground))\n    print(\"Size of SportsField: \", model.getVal(SportsField))\n    print(\"Size of PicnicArea: \", model.getVal(PicnicArea))\n    print(\"Size of BotanicalGarden: \", model.getVal(BotanicalGarden))\n    print(\"Maximized Total Satisfaction: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit.\n// {\"number of units of component 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component varies with the number of units produced due to economies of scale and market saturation. The profit function for each component is given by:\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\nThe company wants to maximize the total profit from all components.\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// C1 + C2 + C3 + C4 + C5 <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of component 1 must be at least twice the production of component 2.\n// C1 >= 2 * C2",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit. The profit from each component varies with the number of units produced due to economies of scale and market saturation, and is given by the following profit functions:\n\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\n\nThe company wants to maximize the total profit from all components. The company has a total production capacity of 1000 units across all components. Due to market demand, the production of component 1 must be at least twice the production of component 2.\n\nPlease help the company determine the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of units of component 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of units of component 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of units of component 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of units of component 4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # number of units of component 5\n\n# Define objective function\n## The profit function for each component is given by:\nP1 = 100 * C1 - 0.1 * C1**2\nP2 = 120 * C2 - 0.15 * C2**2\nP3 = 150 * C3 - 0.2 * C3**2\nP4 = 180 * C4 - 0.25 * C4**2\nP5 = 200 * C5 - 0.3 * C5**2\n## The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 1000)\n## Due to market demand, the production of component 1 must be at least twice the production of component 2.\nmodel.addCons(C1 >= 2 * C2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component 1: \", model.getVal(C1))\n    print(\"Number of Component 2: \", model.getVal(C2))\n    print(\"Number of Component 3: \", model.getVal(C3))\n    print(\"Number of Component 4: \", model.getVal(C4))\n    print(\"Number of Component 5: \", model.getVal(C5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to ensure adequate coverage.\n// Trucks1 >= 10; Trucks2 >= 10; Trucks3 >= 10; Trucks4 >= 10; Trucks5 >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-4:\nDue to regional regulations, the fuel budget for Region1 must be at least twice the fuel budget for Region2.\n// FuelBudget1 >= 2 * FuelBudget2\n\n## Generate Constraint-5:\nThe fuel cost in Region3 is subject to a minimum cost of $500 due to fixed administrative fees.\n// FuelCost3 >= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, decreasing as the fuel budget increases but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Fuel Cost Function | Minimum Trucks |\n|--------|--------------------|----------------|\n| Region1 | (FuelBudget1 / Trucks1)^2 | 10 |\n| Region2 | (FuelBudget2 / Trucks2)^2 | 10 |\n| Region3 | (FuelBudget3 / Trucks3)^2 | 10 |\n| Region4 | (FuelBudget4 / Trucks4)^2 | 10 |\n| Region5 | (FuelBudget5 / Trucks5)^2 | 10 |\n\nThe total fuel budget across all regions must not exceed $100,000. Each region must have at least 10 trucks to ensure adequate coverage. The total number of trucks across all regions must not exceed 100. Due to regional regulations, the fuel budget for Region1 must be at least twice the fuel budget for Region2. The fuel cost in Region3 is subject to a minimum cost of $500 due to fixed administrative fees.\n\nPlease help the company to determine the optimal number of trucks and fuel budgets for each region to minimize the total fuel cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10)  # trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=10)  # trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=10)  # trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=10)  # trucks in Region5\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0)  # fuel budget for Region1\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0)  # fuel budget for Region2\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0)  # fuel budget for Region3\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0)  # fuel budget for Region4\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0)  # fuel budget for Region5\n\n# Define objective function\nFuelCost1 = (FuelBudget1 / Trucks1) ** 2\nFuelCost2 = (FuelBudget2 / Trucks2) ** 2\nFuelCost3 = (FuelBudget3 / Trucks3) ** 2\nFuelCost4 = (FuelBudget4 / Trucks4) ** 2\nFuelCost5 = (FuelBudget5 / Trucks5) ** 2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\nmodel.addCons(FuelBudget1 >= 2 * FuelBudget2)\nmodel.addCons(FuelCost3 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1452,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering three types of trucks: Small, Medium, and Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company needs to decide how many trucks of each type to purchase to optimize its operations.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Small trucks have a fuel efficiency of 10 km/l, a cargo capacity of 5 tons, and a purchase cost of $50,000 each.\nThe Medium trucks have a fuel efficiency of 8 km/l, a cargo capacity of 10 tons, and a purchase cost of $75,000 each.\nThe Large trucks have a fuel efficiency of 6 km/l, a cargo capacity of 15 tons, and a purchase cost of $100,000 each.\nThe company wants to minimize the total cost of ownership per ton-kilometer, which is defined as the sum of the purchase costs divided by the sum of the cargo capacities multiplied by the fuel efficiency.\n// TotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n// TotalCargoCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\n// TotalFuelEfficiency = 10 * SmallTrucks + 8 * MediumTrucks + 6 * LargeTrucks\n// So, the objective function is: Minimize (TotalPurchaseCost / (TotalCargoCapacity * TotalFuelEfficiency))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe total cargo capacity of the new fleet should be at least 500 tons.\n// 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering three types of trucks: Small, Medium, and Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The Small trucks have a fuel efficiency of 10 km/l, a cargo capacity of 5 tons, and a purchase cost of $50,000 each. The Medium trucks have a fuel efficiency of 8 km/l, a cargo capacity of 10 tons, and a purchase cost of $75,000 each. The Large trucks have a fuel efficiency of 6 km/l, a cargo capacity of 15 tons, and a purchase cost of $100,000 each. The company has a budget of $1,000,000 for purchasing new trucks. The total cargo capacity of the new fleet should be at least 500 tons. \n\nPlease help the company to minimize the total cost of ownership per ton-kilometer, which is defined as the sum of the purchase costs divided by the sum of the cargo capacities multiplied by the fuel efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of Large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\nTotalCargoCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\nTotalFuelEfficiency = 10 * SmallTrucks + 8 * MediumTrucks + 6 * LargeTrucks\n## the objective function is: Minimize (TotalPurchaseCost / (TotalCargoCapacity * TotalFuelEfficiency))\n## convert the division to multiplication\nmodel.addCons(obj * TotalCargoCapacity * TotalFuelEfficiency == TotalPurchaseCost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n## The total cargo capacity of the new fleet should be at least 500 tons.\nmodel.addCons(5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (in hours) allocated to each product. The efficiency of resource use can be improved by investing in automation technology, which affects the resource usage per unit of product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for ProductA (in hours)\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductB (in hours)\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductC (in hours)\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The resource usage per unit decreases by 1 hour for every $500 invested in automation for that product. The initial resource usage per unit for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The company aims to maximize the total profit from all products.\n// ProfitA = (100 * QuantityA) - (ResourceA * QuantityA) + (0.002 * AutomationA * QuantityA)\n// ProfitB = (150 * QuantityB) - (ResourceB * QuantityB) + (0.002 * AutomationB * QuantityB)\n// ProfitC = (200 * QuantityC) - (ResourceC * QuantityC) + (0.002 * AutomationC * QuantityC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource allocation (in hours) across all products cannot exceed 1000 hours.\n// ResourceA + ResourceB + ResourceC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (in hours) allocated to each product. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The resource usage per unit decreases by 1 hour for every $500 invested in automation for that product. The initial resource usage per unit for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The total resource allocation (in hours) across all products cannot exceed 1000 hours. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities, resource allocations, and investments in automation for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resource allocation for ProductA\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resource allocation for ProductB\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resource allocation for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 * QuantityA) - (ResourceA * QuantityA) + (0.002 * AutomationA * QuantityA)\nProfitB = (150 * QuantityB) - (ResourceB * QuantityB) + (0.002 * AutomationB * QuantityB)\nProfitC = (200 * QuantityC) - (ResourceC * QuantityC) + (0.002 * AutomationC * QuantityC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total resource allocation (in hours) across all products cannot exceed 1000 hours.\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resource Allocation for ProductA: \", model.getVal(ResourceA))\n    print(\"Resource Allocation for ProductB: \", model.getVal(ResourceB))\n    print(\"Resource Allocation for ProductC: \", model.getVal(ResourceC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. They need to determine the production quantities of each component to optimize their manufacturing process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost of each component decreases nonlinearly with increased production due to economies of scale. The cost function for each component is defined as:\n- Cost_A = 100 / (1 + 0.01 * A)^2\n- Cost_B = 120 / (1 + 0.01 * B)^2\n- Cost_C = 150 / (1 + 0.01 * C)^2\n- Cost_D = 130 / (1 + 0.01 * D)^2\n- Cost_E = 140 / (1 + 0.01 * E)^2\nThe company wants to minimize the total production cost of all components.\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for the production of these components.\n// 100 / (1 + 0.01 * A)^2 * A + 120 / (1 + 0.01 * B)^2 * B + 150 / (1 + 0.01 * C)^2 * C + 130 / (1 + 0.01 * D)^2 * D + 140 / (1 + 0.01 * E)^2 * E <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each component is limited. The maximum production quantities are: 100 units for A, 150 units for B, 200 units for C, 120 units for D, and 80 units for E.\n// A <= 100; B <= 150; C <= 200; D <= 120; E <= 80\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of each component to meet the minimum order requirements from their clients.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. They need to determine the production quantities of each component to optimize their manufacturing process. The cost of producing each component decreases nonlinearly with increased production due to economies of scale, as defined by the following cost functions:\n\n| Component | Cost Function                |\n|-----------|-------------------------------|\n| A         | Cost_A = 100 / (1 + 0.01 * A)^2 |\n| B         | Cost_B = 120 / (1 + 0.01 * B)^2 |\n| C         | Cost_C = 150 / (1 + 0.01 * C)^2 |\n| D         | Cost_D = 130 / (1 + 0.01 * D)^2 |\n| E         | Cost_E = 140 / (1 + 0.01 * E)^2 |\n\nThe company has a limited budget of $5000 for the production of these components. The production capacity for each component is also limited: 100 units for A, 150 units for B, 200 units for C, 120 units for D, and 80 units for E. Additionally, the company must produce at least 20 units of each component to meet the minimum order requirements from their clients.\n\nPlease help the company to minimize the total production cost of all components while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20, ub=100)  # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20, ub=150)  # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20, ub=200)  # quantity of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20, ub=120)  # quantity of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20, ub=80)   # quantity of component E\n\n# Define objective function\n# Cost functions for each component\nCost_A = model.addVar(name=\"Cost_A\")\nCost_B = model.addVar(name=\"Cost_B\")\nCost_C = model.addVar(name=\"Cost_C\")\nCost_D = model.addVar(name=\"Cost_D\")\nCost_E = model.addVar(name=\"Cost_E\")\n\n# Define the cost functions as constraints\nmodel.addCons(Cost_A == 100 / (1 + 0.01 * A)**2 * A)\nmodel.addCons(Cost_B == 120 / (1 + 0.01 * B)**2 * B)\nmodel.addCons(Cost_C == 150 / (1 + 0.01 * C)**2 * C)\nmodel.addCons(Cost_D == 130 / (1 + 0.01 * D)**2 * D)\nmodel.addCons(Cost_E == 140 / (1 + 0.01 * E)**2 * E)\n\n# Set objective as a variable\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# Limited budget constraint\nmodel.addCons(Cost_A * A + Cost_B * B + Cost_C * C + Cost_D * D + Cost_E * E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Quantity of Component D: \", model.getVal(D))\n    print(\"Quantity of Component E: \", model.getVal(E))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company aims to maximize the total profit from selling all products.\n// Profit_A = 50 * A\n// Profit_B = 70 * B - 0.5 * A * B (cost of A used in B)\n// Profit_C = 90 * C - 0.3 * A * C (cost of A used in C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the production of product B to at most 150 units per month.\n// B <= 150\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product C as product B.\n// C >= 2 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company aims to maximize the total profit from selling all products.\n\n| Product | Profit per Unit | Additional Component Requirement (from Product A) |\n|---------|-----------------|--------------------------------------------------|\n| A       | $50             | -                                                |\n| B       | $70             | 0.5 units of A                                   |\n| C       | $90             | 0.3 units of A                                   |\n\nThe company has a total production capacity of 1000 units per month. The market demand for product A is at least 200 units per month. The company has a limited budget for raw materials, which restricts the production of product B to at most 150 units per month. The company aims to produce at least twice as many units of product C as product B.\n\nPlease help the company to determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B - 0.5 * A * B # cost of A used in B\nProfit_C = 90 * C - 0.3 * A * C # cost of A used in C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units per month.\nmodel.addCons(A >= 200)\n## The company has a limited budget for raw materials, which restricts the production of product B to at most 150 units per month.\nmodel.addCons(B <= 150)\n## The company aims to produce at least twice as many units of product C as product B.\nmodel.addCons(C >= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1576,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: ZoneA, ZoneB, ZoneC, ZoneD, and ZoneE. The company needs to determine the number of trucks to allocate to each zone and the fuel consumption rate for each truck in each zone.\n// {\"number of trucks for ZoneA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ZoneE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for ZoneA\": \"FuelRateA\", \"range\": \"FuelRateA >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneB\": \"FuelRateB\", \"range\": \"FuelRateB >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneC\": \"FuelRateC\", \"range\": \"FuelRateC >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneD\": \"FuelRateD\", \"range\": \"FuelRateD >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for ZoneE\": \"FuelRateE\", \"range\": \"FuelRateE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize the total profit from deliveries, considering the revenue per truck and the cost of fuel. The revenue per truck in ZoneA is $10,000, in ZoneB is $12,000, in ZoneC is $15,000, in ZoneD is $14,000, and in ZoneE is $13,000. The cost of fuel per unit is $3.\n// Total revenue for ZoneA: RevenueA = 10,000 * TrucksA\n// Total revenue for ZoneB: RevenueB = 12,000 * TrucksB\n// Total revenue for ZoneC: RevenueC = 15,000 * TrucksC\n// Total revenue for ZoneD: RevenueD = 14,000 * TrucksD\n// Total revenue for ZoneE: RevenueE = 13,000 * TrucksE\n// Total fuel cost for ZoneA: FuelCostA = FuelRateA * TrucksA * 3\n// Total fuel cost for ZoneB: FuelCostB = FuelRateB * TrucksB * 3\n// Total fuel cost for ZoneC: FuelCostC = FuelRateC * TrucksC * 3\n// Total fuel cost for ZoneD: FuelCostD = FuelRateD * TrucksD * 3\n// Total fuel cost for ZoneE: FuelCostE = FuelRateE * TrucksE * 3\n// So, the objective function is: Maximize (RevenueA - FuelCostA + RevenueB - FuelCostB + RevenueC - FuelCostC + RevenueD - FuelCostD + RevenueE - FuelCostE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all zones must not exceed 1000 units.\n// FuelRateA * TrucksA + FuelRateB * TrucksB + FuelRateC * TrucksC + FuelRateD * TrucksD + FuelRateE * TrucksE <= 1000\n\n## Generate Constraint-3:\nDue to road conditions, the fuel consumption rate in ZoneA must be at least twice that in ZoneB.\n// FuelRateA >= 2 * FuelRateB\n\n## Generate Constraint-4:\nThe company must allocate at least 5 trucks to ZoneC.\n// TrucksC >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: ZoneA, ZoneB, ZoneC, ZoneD, and ZoneE. The company needs to determine the number of trucks to allocate to each zone and the fuel consumption rate for each truck in each zone. The revenue per truck in ZoneA is $10,000, in ZoneB is $12,000, in ZoneC is $15,000, in ZoneD is $14,000, and in ZoneE is $13,000. The cost of fuel per unit is $3. The company has a total of 50 trucks available for allocation. The total fuel consumption across all zones must not exceed 1000 units. Due to road conditions, the fuel consumption rate in ZoneA must be at least twice that in ZoneB. The company must allocate at least 5 trucks to ZoneC. Please help the company to maximize the total profit from deliveries, considering the revenue per truck and the cost of fuel.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for ZoneA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for ZoneB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for ZoneC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0)  # number of trucks for ZoneD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0)  # number of trucks for ZoneE\nFuelRateA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateA\", lb=0)  # fuel consumption rate for ZoneA\nFuelRateB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateB\", lb=0)  # fuel consumption rate for ZoneB\nFuelRateC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateC\", lb=0)  # fuel consumption rate for ZoneC\nFuelRateD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateD\", lb=0)  # fuel consumption rate for ZoneD\nFuelRateE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRateE\", lb=0)  # fuel consumption rate for ZoneE\n\n# Define objective function\nRevenueA = 10000 * TrucksA\nRevenueB = 12000 * TrucksB\nRevenueC = 15000 * TrucksC\nRevenueD = 14000 * TrucksD\nRevenueE = 13000 * TrucksE\nFuelCostA = FuelRateA * TrucksA * 3\nFuelCostB = FuelRateB * TrucksB * 3\nFuelCostC = FuelRateC * TrucksC * 3\nFuelCostD = FuelRateD * TrucksD * 3\nFuelCostE = FuelRateE * TrucksE * 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - FuelCostA + RevenueB - FuelCostB + RevenueC - FuelCostC + RevenueD - FuelCostD + RevenueE - FuelCostE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(FuelRateA * TrucksA + FuelRateB * TrucksB + FuelRateC * TrucksC + FuelRateD * TrucksD + FuelRateE * TrucksE <= 1000)\nmodel.addCons(FuelRateA >= 2 * FuelRateB)\nmodel.addCons(TrucksC >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for ZoneA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for ZoneB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for ZoneC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for ZoneD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for ZoneE: \", model.getVal(TrucksE))\n    print(\"Fuel Consumption Rate for ZoneA: \", model.getVal(FuelRateA))\n    print(\"Fuel Consumption Rate for ZoneB: \", model.getVal(FuelRateB))\n    print(\"Fuel Consumption Rate for ZoneC: \", model.getVal(FuelRateC))\n    print(\"Fuel Consumption Rate for ZoneD: \", model.getVal(FuelRateD))\n    print(\"Fuel Consumption Rate for ZoneE: \", model.getVal(FuelRateE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency (in km/l) of each truck type.\n// {\"speed of Truck 1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of Truck 2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of Truck 1 on Route A\": \"Truck1_RouteA\", \"range\": \"Truck1_RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck 2 on Route A\": \"Truck2_RouteA\", \"range\": \"Truck2_RouteA >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption rate of each truck is a nonlinear function of its speed, given by the formula: Fuel Consumption = (Speed^3 / Efficiency). The objective is to minimize the total fuel consumption across all trucks and routes.\n// Fuel Consumption for Truck 1 on Route A: FC1_A = (Speed1^3 / Efficiency1) * Truck1_RouteA\n// Fuel Consumption for Truck 2 on Route A: FC2_A = (Speed2^3 / Efficiency2) * Truck2_RouteA\n// Total Fuel Consumption: Minimize (FC1_A + FC2_A)\n\n## Generate Constraint-1:\nThe total number of trucks available for Route A is limited to 50.\n// Truck1_RouteA + Truck2_RouteA <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for trucks on Route A is 100 km/h.\n// Speed1 <= 100; Speed2 <= 100\n\n## Generate Constraint-3:\nThe fuel efficiency of Truck 1 is at least 5 km/l, and Truck 2 is at least 6 km/l.\n// Efficiency1 >= 5; Efficiency2 >= 6",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency (in km/l) of each truck type. The company aims to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption rate of each truck is a nonlinear function of its speed, given by the formula: Fuel Consumption = (Speed^3 / Efficiency). The total number of trucks available for Route A is limited to 50. The maximum speed limit for trucks on Route A is 100 km/h. The fuel efficiency of Truck 1 is at least 5 km/l, and Truck 2 is at least 6 km/l.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120) # speed of Truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120) # speed of Truck 2\nTruck1_RouteA = model.addVar(vtype=\"INTEGER\", name=\"Truck1_RouteA\", lb=0) # number of Truck 1 on Route A\nTruck2_RouteA = model.addVar(vtype=\"INTEGER\", name=\"Truck2_RouteA\", lb=0) # number of Truck 2 on Route A\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=5) # fuel efficiency of Truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=6) # fuel efficiency of Truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel Consumption for Truck 1 on Route A: FC1_A = (Speed1^3 / Efficiency1) * Truck1_RouteA\n## Fuel Consumption for Truck 2 on Route A: FC2_A = (Speed2^3 / Efficiency2) * Truck2_RouteA\n## Total Fuel Consumption: Minimize (FC1_A + FC2_A)\nFC1_A = (Speed1**3 / Efficiency1) * Truck1_RouteA\nFC2_A = (Speed2**3 / Efficiency2) * Truck2_RouteA\nmodel.addCons(obj == FC1_A + FC2_A)\n\n# Add constraints\n## The total number of trucks available for Route A is limited to 50.\nmodel.addCons(Truck1_RouteA + Truck2_RouteA <= 50)\n## The maximum speed limit for trucks on Route A is 100 km/h.\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Truck 1 on Route A: \", model.getVal(Truck1_RouteA))\n    print(\"Number of Truck 2 on Route A: \", model.getVal(Truck2_RouteA))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost.\n// Cost_1 = 1000 * T1; Cost_2 = 1200 * T2; Cost_3 = 1500 * T3; Cost_4 = 1300 * T4; Cost_5 = 1400 * T5\n// Revenue_1 = 1800 * T1; Revenue_2 = 2000 * T2; Revenue_3 = 2200 * T3; Revenue_4 = 2100 * T4; Revenue_5 = 2300 * T5\n// Net_Profit_1 = Revenue_1 - Cost_1; Net_Profit_2 = Revenue_2 - Cost_2; Net_Profit_3 = Revenue_3 - Cost_3; Net_Profit_4 = Revenue_4 - Cost_4; Net_Profit_5 = Revenue_5 - Cost_5\n// So, the objective function is: Maximize (Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost. The company has a total of 100 trucks available for allocation. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nCost_1 = 1000 * T1\nCost_2 = 1200 * T2\nCost_3 = 1500 * T3\nCost_4 = 1300 * T4\nCost_5 = 1400 * T5\n\nRevenue_1 = 1800 * T1\nRevenue_2 = 2000 * T2\nRevenue_3 = 2200 * T3\nRevenue_4 = 2100 * T4\nRevenue_5 = 2300 * T5\n\nNet_Profit_1 = Revenue_1 - Cost_1\nNet_Profit_2 = Revenue_2 - Cost_2\nNet_Profit_3 = Revenue_3 - Cost_3\nNet_Profit_4 = Revenue_4 - Cost_4\nNet_Profit_5 = Revenue_5 - Cost_5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000.\nFor wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000.\nThe company wants to minimize the Cost-Energy ratio of the installation. (The Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production.)\n// total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\n// total energy production: Energy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000\n\n## Generate Constraint-2:\nThe company wants to produce at least 150,000 kWh of energy.\n// 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000\n\n## Generate Constraint-3:\nThe company wants to install at least 50 solar panels in total.\n// Solar1 + Solar2 + Solar3 + Solar4 >= 50\n\n## Generate Constraint-4:\nNo more than 60% of the budget can be spent on wind turbines.\n// 5000 * Wind <= 0.6 * 100000\n\n## Generate Constraint-5:\nThe maximum number of wind turbines that can be installed is 10.\n// Wind <= 10",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five locations (Location1, Location2, Location3, Location4, and Location5). The company wants to minimize the Cost-Energy ratio of the installation, which is defined as the total cost of the installations divided by the total energy production. For solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000. For wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000. The company has a budget of $100,000 for the installations and wants to produce at least 150,000 kWh of energy. Additionally, the company wants to install at least 50 solar panels in total, and no more than 60% of the budget can be spent on wind turbines. The maximum number of wind turbines that can be installed is 10. Please help the company determine the optimal number of solar panels and wind turbines to install at each location to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)  # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)  # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)  # number of solar panels at Location3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)  # number of solar panels at Location4\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines at Location5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\nEnergy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations.\nmodel.addCons(1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000)\n## The company wants to produce at least 150,000 kWh of energy.\nmodel.addCons(200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000)\n## The company wants to install at least 50 solar panels in total.\nmodel.addCons(Solar1 + Solar2 + Solar3 + Solar4 >= 50)\n## No more than 60% of the budget can be spent on wind turbines.\nmodel.addCons(5000 * Wind <= 0.6 * 100000)\n## The maximum number of wind turbines that can be installed is 10.\nmodel.addCons(Wind <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Solar Panels at Location4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Minimized Cost-Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. Higher levels of automation reduce the cost per unit but increase the initial investment required.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost per unit of ProductA decreases by $2 for every $1000 invested in automation for ProductA. Similarly, the cost per unit of ProductB decreases by $3 for every $1000 invested in automation for ProductB, and the cost per unit of ProductC decreases by $4 for every $1000 invested in automation for ProductC. The selling price per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - (10 - 0.002 * AutomationA)) * QuantityA\n// Total profit for ProductB: ProfitB = (60 - (15 - 0.003 * AutomationB)) * QuantityB\n// Total profit for ProductC: ProfitC = (70 - (20 - 0.004 * AutomationC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 1000 units for each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 200 units of ProductA and 300 units of ProductB.\n// QuantityA >= 200; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. Higher levels of automation reduce the cost per unit but increase the initial investment required. The cost per unit of ProductA decreases by $2 for every $1000 invested in automation for ProductA. Similarly, the cost per unit of ProductB decreases by $3 for every $1000 invested in automation for ProductB, and the cost per unit of ProductC decreases by $4 for every $1000 invested in automation for ProductC. The selling price per unit of ProductA is $50, ProductB is $60, and ProductC is $70. The company aims to maximize the total profit from all products. The total investment in automation cannot exceed $50,000. The company has a production capacity limit of 1000 units for each product. Due to market demand, the company must produce at least 200 units of ProductA and 300 units of ProductB. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for ProductC\n\n# Define objective function\nProfitA = (50 - (10 - 0.002 * AutomationA)) * QuantityA\nProfitB = (60 - (15 - 0.003 * AutomationB)) * QuantityB\nProfitC = (70 - (20 - 0.004 * AutomationC)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of trips each vehicle should make to maximize profit while considering the varying costs and revenues associated with each vehicle type. Additionally, the company must decide on the level of maintenance investment for each vehicle type to improve fuel efficiency and reduce operational costs.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip for each vehicle type is affected by the maintenance investment, which improves fuel efficiency and reduces operational costs.\nFor TruckA, the initial profit per trip is $1000, and with maintenance, the profit increases by $10 per trip for every $100 invested in maintenance.\nFor TruckB, the initial profit per trip is $1500, and with maintenance, the profit increases by $15 per trip for every $100 invested in maintenance.\nFor TruckC, the initial profit per trip is $2000, and with maintenance, the profit increases by $20 per trip for every $100 invested in maintenance.\nThe company aims to maximize the total profit from all vehicle types.\n// Total profit for TruckA: ProfitA = (1000 + 0.1 * MaintenanceA) * TripsA\n// Total profit for TruckB: ProfitB = (1500 + 0.15 * MaintenanceB) * TripsB\n// Total profit for TruckC: ProfitC = (2000 + 0.2 * MaintenanceC) * TripsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance and operational costs.\n// MaintenanceA + MaintenanceB + MaintenanceC + (1000 * TripsA) + (1500 * TripsB) + (2000 * TripsC) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicle types must not exceed 500 trips.\n// TripsA + TripsB + TripsC <= 500\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must ensure that at least 100 trips are made by TruckA and 150 trips are made by TruckB.\n// TripsA >= 100; TripsB >= 150",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of trips each vehicle should make and the level of maintenance investment for each vehicle type to maximize profit while considering the varying costs and revenues associated with each vehicle type. The profit per trip for each vehicle type is affected by the maintenance investment, which improves fuel efficiency and reduces operational costs. The initial profit per trip and the impact of maintenance on profit for each vehicle type are given in the following Table.\n\n| Vehicle | Initial Profit per Trip | Increase in Profit per $100 Maintenance |\n|---------|-------------------------|----------------------------------------|\n| TruckA  | $1000                   | $10                                    |\n| TruckB  | $1500                   | $15                                    |\n| TruckC  | $2000                   | $20                                    |\n\nThe company has a total budget of $100,000 for maintenance and operational costs. The total number of trips across all vehicle types must not exceed 500 trips. Due to regulatory requirements, the company must ensure that at least 100 trips are made by TruckA and 150 trips are made by TruckB.\nPlease help the company to maximize the total profit from all vehicle types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=100)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=150)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance investment for TruckA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance investment for TruckB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance investment for TruckC\n\n# Define objective function\nProfitA = (1000 + 0.1 * MaintenanceA) * TripsA\nProfitB = (1500 + 0.15 * MaintenanceB) * TripsB\nProfitC = (2000 + 0.2 * MaintenanceC) * TripsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC + 1000 * TripsA + 1500 * TripsB + 2000 * TripsC <= 100000)\nmodel.addCons(TripsA + TripsB + TripsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Maintenance Investment for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1417,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the workforce size dedicated to each product, and the amount of capital investment in advanced machinery that enhances production efficiency. The efficiency gain from the machinery investment is nonlinear and varies with the investment amount.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by 0.5% for every $100,000 invested in advanced machinery. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * MachineryInvestment) * QuantityA\n// Total profit for ProductB: ProfitB = (225 - 150 + 0.005 * MachineryInvestment) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * MachineryInvestment) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available for all products is limited to 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the workforce size dedicated to each product, and the amount of capital investment in advanced machinery that enhances production efficiency. The efficiency gain from the machinery investment is nonlinear and varies with the investment amount. The production cost per unit decreases by 0.5% for every $100,000 invested in advanced machinery. The initial production cost per unit and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $150                   |\n| ProductB | $150                             | $225                   |\n| ProductC | $200                             | $300                   |\n\nThe company aims to maximize the total profit from all products. The total workforce available for all products is limited to 100 employees. Please help the company determine the optimal production quantities, workforce sizes, and capital investment in machinery to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0)  # capital investment in machinery\n\n# Define objective function\n## The production cost per unit decreases by 0.5% for every $100,000 invested in advanced machinery.\n## Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * MachineryInvestment) * QuantityA\n## Total profit for ProductB: ProfitB = (225 - 150 + 0.005 * MachineryInvestment) * QuantityB\n## Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * MachineryInvestment) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (150 - 100 + 0.005 * MachineryInvestment) * QuantityA\nProfitB = (225 - 150 + 0.005 * MachineryInvestment) * QuantityB\nProfitC = (300 - 200 + 0.005 * MachineryInvestment) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total workforce available for all products is limited to 100 employees.\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkforceC))\n    print(\"Machinery Investment: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1277,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery times. Route A has a cost of $100 per truck and a delivery time of 5 hours. Route B has a cost of $120 per truck and a delivery time of 6 hours. Route C has a cost of $150 per truck and a delivery time of 7 hours. Route D has a cost of $180 per truck and a delivery time of 8 hours. Route E has a cost of $200 per truck and a delivery time of 9 hours. The company aims to minimize the total cost per hour of operation across all routes.\n// Cost per hour for route A: Cost_A = 100 / 5 * A\n// Cost per hour for route B: Cost_B = 120 / 6 * B\n// Cost per hour for route C: Cost_C = 150 / 7 * C\n// Cost per hour for route D: Cost_D = 180 / 8 * D\n// Cost per hour for route E: Cost_E = 200 / 9 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operational costs.\n// 100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and delivery times for each route are given in the following Table.\n\n| Route | Operational Cost per Truck | Delivery Time |\n|-------|-----------------------------|---------------|\n| A     | $100                        | 5 hours       |\n| B     | $120                        | 6 hours       |\n| C     | $150                        | 7 hours       |\n| D     | $180                        | 8 hours       |\n| E     | $200                        | 9 hours       |\n\nThe company has a total budget of $10,000 for operational costs. The company has a maximum of 50 trucks available. Please help the company to minimize the total cost per hour of operation across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (100 / 5) * A\nCost_B = (120 / 6) * B\nCost_C = (150 / 7) * C\nCost_D = (180 / 8) * D\nCost_E = (200 / 9) * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 for operational costs.\nmodel.addCons(100 * A + 120 * B + 150 * C + 180 * D + 200 * E <= 10000)\n## The company has a maximum of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide how many trucks to allocate to each region and the fuel consumption rate for each truck in that region.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per truck in North region\": \"NorthFuelRate\", \"range\": \"NorthFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in South region\": \"SouthFuelRate\", \"range\": \"SouthFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in East region\": \"EastFuelRate\", \"range\": \"EastFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in West region\": \"WestFuelRate\", \"range\": \"WestFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in Central region\": \"CentralFuelRate\", \"range\": \"CentralFuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost while ensuring efficient delivery. The fuel cost per liter is $1.5. The company wants to minimize the total fuel consumption across all regions.\n// Total fuel consumption for North region: Fuel_North = NorthTrucks * NorthFuelRate\n// Total fuel consumption for South region: Fuel_South = SouthTrucks * SouthFuelRate\n// Total fuel consumption for East region: Fuel_East = EastTrucks * EastFuelRate\n// Total fuel consumption for West region: Fuel_West = WestTrucks * WestFuelRate\n// Total fuel consumption for Central region: Fuel_Central = CentralTrucks * CentralFuelRate\n// So, the objective function is: Minimize (1.5 * (Fuel_North + Fuel_South + Fuel_East + Fuel_West + Fuel_Central))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation across all regions.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100\n\n## Generate Constraint-2:\nDue to environmental regulations, the average fuel consumption rate across all trucks must not exceed 20 liters per truck per day.\n// (NorthTrucks * NorthFuelRate + SouthTrucks * SouthFuelRate + EastTrucks * EastFuelRate + WestTrucks * WestFuelRate + CentralTrucks * CentralFuelRate) / (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks) <= 20\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the total trucks are allocated to the Central region for critical deliveries.\n// CentralTrucks >= 0.2 * (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks)\n\n## Generate Constraint-4:\nThe fuel consumption rate in the North region must be at least 10% lower than the average rate in the South region.\n// NorthFuelRate <= 0.9 * SouthFuelRate",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide how many trucks to allocate to each region and the fuel consumption rate for each truck in that region. The company aims to minimize the total fuel cost while ensuring efficient delivery. The fuel cost per liter is $1.5. The company has a total of 100 trucks available for allocation across all regions. Due to environmental regulations, the average fuel consumption rate across all trucks must not exceed 20 liters per truck per day. The company must ensure that at least 20% of the total trucks are allocated to the Central region for critical deliveries. The fuel consumption rate in the North region must be at least 10% lower than the average rate in the South region. Please help the company to minimize the total fuel consumption across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=0)\nNorthFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"NorthFuelRate\", lb=0)\nSouthFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"SouthFuelRate\", lb=0)\nEastFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"EastFuelRate\", lb=0)\nWestFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"WestFuelRate\", lb=0)\nCentralFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"CentralFuelRate\", lb=0)\n\n# Define objective function\nFuel_North = NorthTrucks * NorthFuelRate\nFuel_South = SouthTrucks * SouthFuelRate\nFuel_East = EastTrucks * EastFuelRate\nFuel_West = WestTrucks * WestFuelRate\nFuel_Central = CentralTrucks * CentralFuelRate\nTotalFuelCost = 1.5 * (Fuel_North + Fuel_South + Fuel_East + Fuel_West + Fuel_Central)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation across all regions.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100)\n# Due to environmental regulations, the average fuel consumption rate across all trucks must not exceed 20 liters per truck per day.\nmodel.addCons((NorthTrucks * NorthFuelRate + SouthTrucks * SouthFuelRate + EastTrucks * EastFuelRate + WestTrucks * WestFuelRate + CentralTrucks * CentralFuelRate) <= 20 * (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks))\n# The company must ensure that at least 20% of the total trucks are allocated to the Central region for critical deliveries.\nmodel.addCons(CentralTrucks >= 0.2 * (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks))\n# The fuel consumption rate in the North region must be at least 10% lower than the average rate in the South region.\nmodel.addCons(NorthFuelRate <= 0.9 * SouthFuelRate)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Fuel Consumption Rate in North Region: \", model.getVal(NorthFuelRate))\n    print(\"Fuel Consumption Rate in South Region: \", model.getVal(SouthFuelRate))\n    print(\"Fuel Consumption Rate in East Region: \", model.getVal(EastFuelRate))\n    print(\"Fuel Consumption Rate in West Region: \", model.getVal(WestFuelRate))\n    print(\"Fuel Consumption Rate in Central Region: \", model.getVal(CentralFuelRate))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for furniture\": \"FurnitureTripsPerTruck\", \"range\": \"FurnitureTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishables\": \"PerishablesTripsPerTruck\", \"range\": \"PerishablesTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for electronics is $300, for furniture is $200, and for perishables is $400. The company aims to maximize the total daily profit from all trips.\n// Profit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\n// Profit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\n// Profit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n## Generate Constraint-1:\nThe company has a total of 50 drivers available for the day.\n// ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity. The profit per trip for electronics is $300, for furniture is $200, and for perishables is $400. The company aims to maximize the total daily profit from all trips. The company has a total of 50 drivers available for the day. Please help the company determine the optimal number of trucks and trips for each type of goods to maximize their daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nFurnitureTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTripsPerTruck\", lb=0)\nPerishablesTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\nProfit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\nProfit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Furniture: \", model.getVal(FurnitureTripsPerTruck))\n    print(\"Trips per Truck for Perishables: \", model.getVal(PerishablesTripsPerTruck))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Region1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2\n// Fuel cost for Region2: Cost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2\n// Fuel cost for Region3: Cost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all regions must not exceed $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region. The efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions. The total maintenance budget for all regions must not exceed $100,000. The company has a total of 50 trucks available for allocation. Please help the company to determine the optimal allocation of trucks and maintenance budgets to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance budget for Region1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance budget for Region2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance budget for Region3\n\n# Define objective function\n# Fuel cost for Region1: Cost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2\n# Fuel cost for Region2: Cost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2\n# Fuel cost for Region3: Cost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = (1000 * Trucks1) / ((1 + 0.001 * Maintenance1)**2)\nCost2 = (1200 * Trucks2) / ((1 + 0.001 * Maintenance2)**2)\nCost3 = (1500 * Trucks3) / ((1 + 0.001 * Maintenance3)**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The total maintenance budget for all regions must not exceed $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Maintenance Budget for Region1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Budget for Region2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Budget for Region3: \", model.getVal(Maintenance3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for cargo A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies by cargo type. For cargo A, the cost per truck is $1000. For cargo B, the cost per truck is $1200. For cargo C, the cost per truck is $1500. For cargo D, the cost per truck is $1800. For cargo E, the cost per truck is $2000. The revenue generated by each cargo type also varies. For cargo A, the revenue per truck is $1500. For cargo B, the revenue per truck is $1800. For cargo C, the revenue per truck is $2200. For cargo D, the revenue per truck is $2500. For cargo E, the revenue per truck is $3000. The company wants to maximize the total net profit, which is the total revenue minus the total cost.\n// Total cost: Cost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\n// Total revenue: Revenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n// So, the objective function is: Maximize (Revenue_Total - Cost_Total)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, cargo A must be transported by at least 10 trucks.\n// TruckA >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total cost of operations, which must not exceed $60,000.\n// 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE <= 60000\n\n## Generate Constraint-4:\nThe demand for cargo D is limited to 15 trucks.\n// TruckD <= 15\n\n## Generate Constraint-5:\nTo maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\n// TruckB >= 0.5 * TruckC",
        "question": "A logistics company is managing the distribution of five different types of cargo: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck varies by cargo type. For cargo A, the cost per truck is $1000 and the revenue per truck is $1500. For cargo B, the cost per truck is $1200 and the revenue per truck is $1800. For cargo C, the cost per truck is $1500 and the revenue per truck is $2200. For cargo D, the cost per truck is $1800 and the revenue per truck is $2500. For cargo E, the cost per truck is $2000 and the revenue per truck is $3000. The company wants to maximize the total net profit, which is the total revenue minus the total cost.\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, cargo A must be transported by at least 10 trucks. The company has a budget constraint on the total cost of operations, which must not exceed $60,000. The demand for cargo D is limited to 15 trucks. To maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\n\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for cargo A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for cargo B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for cargo C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for cargo D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for cargo E\n\n# Define objective function\nCost_Total = 1000 * TruckA + 1200 * TruckB + 1500 * TruckC + 1800 * TruckD + 2000 * TruckE\nRevenue_Total = 1500 * TruckA + 1800 * TruckB + 2200 * TruckC + 2500 * TruckD + 3000 * TruckE\n# So, the objective function is: Maximize (Revenue_Total - Cost_Total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Total - Cost_Total)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n# Due to contractual agreements, cargo A must be transported by at least 10 trucks.\nmodel.addCons(TruckA >= 10)\n# The company has a budget constraint on the total cost of operations, which must not exceed $60,000.\nmodel.addCons(Cost_Total <= 60000)\n# The demand for cargo D is limited to 15 trucks.\nmodel.addCons(TruckD <= 15)\n# To maintain a balanced distribution, the company aims to ensure that the number of trucks for cargo B is at least half the number of trucks for cargo C.\nmodel.addCons(TruckB >= 0.5 * TruckC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Cargo D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Cargo E: \", model.getVal(TruckE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line.\n// {\"number of production lines for DeviceA\": \"LineA\", \"range\": \"LineA >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceB\": \"LineB\", \"range\": \"LineB >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceC\": \"LineC\", \"range\": \"LineC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceA lines\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceB lines\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceC lines\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost per production line per shift is $1000 for DeviceA, $1200 for DeviceB, and $1500 for DeviceC. The company aims to maximize its total daily profit.\n// Total daily profit for DeviceA: ProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\n// Total daily profit for DeviceB: ProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\n// Total daily profit for DeviceC: ProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10 production lines available.\n// LineA + LineB + LineC <= 10\n\n## Generate Constraint-2:\nEach production line can operate up to 3 shifts per day.\n// ShiftA <= 3; ShiftB <= 3; ShiftC <= 3\n\n## Generate Constraint-3:\nThe total daily production cost for all devices must not exceed $30,000.\n// 1000 * LineA * ShiftA + 1200 * LineB * ShiftB + 1500 * LineC * ShiftC <= 30000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line. The profit per unit and the cost per production line per shift for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Line per Shift |\n|--------|-----------------|-------------------------|\n| DeviceA | $50             | $1000                   |\n| DeviceB | $70             | $1200                   |\n| DeviceC | $90             | $1500                   |\n\nThe company has a total of 10 production lines available. Each production line can operate up to 3 shifts per day. The total daily production cost for all devices must not exceed $30,000. \nPlease help the company to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLineA = model.addVar(vtype=\"INTEGER\", name=\"LineA\", lb=0) # number of production lines for DeviceA\nLineB = model.addVar(vtype=\"INTEGER\", name=\"LineB\", lb=0) # number of production lines for DeviceB\nLineC = model.addVar(vtype=\"INTEGER\", name=\"LineC\", lb=0) # number of production lines for DeviceC\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0) # number of shifts per day for DeviceA lines\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0) # number of shifts per day for DeviceB lines\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0) # number of shifts per day for DeviceC lines\n\n# Define objective function\nProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\nProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\nProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LineA + LineB + LineC <= 10)\nmodel.addCons(ShiftA <= 3)\nmodel.addCons(ShiftB <= 3)\nmodel.addCons(ShiftC <= 3)\nmodel.addCons(1000 * LineA * ShiftA + 1200 * LineB * ShiftB + 1500 * LineC * ShiftC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of production lines for DeviceA: \", model.getVal(LineA))\n    print(\"Number of production lines for DeviceB: \", model.getVal(LineB))\n    print(\"Number of production lines for DeviceC: \", model.getVal(LineC))\n    print(\"Number of shifts per day for DeviceA lines: \", model.getVal(ShiftA))\n    print(\"Number of shifts per day for DeviceB lines: \", model.getVal(ShiftB))\n    print(\"Number of shifts per day for DeviceC lines: \", model.getVal(ShiftC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks is 0.5 liters per kilometer, for vans is 0.3 liters per kilometer, and for motorcycles is 0.1 liters per kilometer. The total distance traveled by each type of vehicle is proportional to the number of vehicles. The company aims to minimize the total fuel consumption.\n// Total fuel consumption = 0.5 * T + 0.3 * V + 0.1 * M\n// So, the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each.\n// 2000 * T + 1500 * V + 500 * M <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg. Trucks can carry 1000 kg each, vans can carry 500 kg each, and motorcycles can carry 100 kg each.\n// 1000 * T + 500 * V + 100 * M >= 5000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can operate, which is 10 in total.\n// T + V + M <= 10\n\n## Generate Constraint-4:\nThe company must ensure that at least 2 trucks are in operation to handle heavy loads.\n// T >= 2\n\n## Generate Constraint-5:\nThe number of motorcycles should not exceed twice the number of vans.\n// M <= 2 * V",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands. The fuel consumption rate for trucks is 0.5 liters per kilometer, for vans is 0.3 liters per kilometer, and for motorcycles is 0.1 liters per kilometer. The total distance traveled by each type of vehicle is proportional to the number of vehicles. The company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each. The total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg. Trucks can carry 1000 kg each, vans can carry 500 kg each, and motorcycles can carry 100 kg each. The company has a limit on the number of vehicles it can operate, which is 10 in total. The company must ensure that at least 2 trucks are in operation to handle heavy loads. The number of motorcycles should not exceed twice the number of vans. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=2)  # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0)  # number of vans\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0)  # number of motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\nmodel.addCons(obj == 0.5 * T + 0.3 * V + 0.1 * M)\n\n# Add constraints\n## The company has a budget of $10,000 to purchase vehicles.\nmodel.addCons(2000 * T + 1500 * V + 500 * M <= 10000)\n## The total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg.\nmodel.addCons(1000 * T + 500 * V + 100 * M >= 5000)\n## The company has a limit on the number of vehicles it can operate, which is 10 in total.\nmodel.addCons(T + V + M <= 10)\n## The company must ensure that at least 2 trucks are in operation to handle heavy loads.\nmodel.addCons(T >= 2)\n## The number of motorcycles should not exceed twice the number of vans.\nmodel.addCons(M <= 2 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Motorcycles: \", model.getVal(M))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the number of each type of truck to deploy for the upcoming quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will reduce fuel consumption but at a cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small trucks\": \"FuelTechSmall\", \"range\": \"FuelTechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"FuelTechMedium\", \"range\": \"FuelTechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large trucks\": \"FuelTechLarge\", \"range\": \"FuelTechLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings from investing in fuel-efficient technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces fuel costs by $200 per truck per quarter. For Medium trucks, each $1000 invested reduces fuel costs by $300 per truck per quarter. For Large trucks, each $1000 invested reduces fuel costs by $400 per truck per quarter. The company aims to maximize the total cost savings from fuel and operational efficiency.\n// FuelCostSavingsSmall = 0.2 * FuelTechSmall * SmallTrucks\n// FuelCostSavingsMedium = 0.3 * FuelTechMedium * MediumTrucks\n// FuelCostSavingsLarge = 0.4 * FuelTechLarge * LargeTrucks\n// OperationalCostSavings = (FuelCostSavingsSmall + FuelCostSavingsMedium + FuelCostSavingsLarge) - (FuelTechSmall + FuelTechMedium + FuelTechLarge)\n// So, the objective function is: Maximize OperationalCostSavings\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for investing in fuel-efficient technologies.\n// FuelTechSmall + FuelTechMedium + FuelTechLarge <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100",
        "question": "A logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the number of each type of truck to deploy for the upcoming quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will reduce fuel consumption but at a cost. The fuel cost savings from investing in fuel-efficient technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces fuel costs by $200 per truck per quarter. For Medium trucks, each $1000 invested reduces fuel costs by $300 per truck per quarter. For Large trucks, each $1000 invested reduces fuel costs by $400 per truck per quarter. The company aims to maximize the total cost savings from fuel and operational efficiency. The company has a total budget of $50,000 for investing in fuel-efficient technologies. The total number of trucks cannot exceed 100. Please help the company to maximize the total cost savings from fuel and operational efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nFuelTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechSmall\", lb=0)\nFuelTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechMedium\", lb=0)\nFuelTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechLarge\", lb=0)\n\n# Define objective function\nFuelCostSavingsSmall = 0.2 * FuelTechSmall * SmallTrucks\nFuelCostSavingsMedium = 0.3 * FuelTechMedium * MediumTrucks\nFuelCostSavingsLarge = 0.4 * FuelTechLarge * LargeTrucks\nOperationalCostSavings = (FuelCostSavingsSmall + FuelCostSavingsMedium + FuelCostSavingsLarge) - (FuelTechSmall + FuelTechMedium + FuelTechLarge)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == OperationalCostSavings)\n\n# Add constraints\nmodel.addCons(FuelTechSmall + FuelTechMedium + FuelTechLarge <= 50000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel-Efficient Tech for Small Trucks: \", model.getVal(FuelTechSmall))\n    print(\"Investment in Fuel-Efficient Tech for Medium Trucks: \", model.getVal(FuelTechMedium))\n    print(\"Investment in Fuel-Efficient Tech for Large Trucks: \", model.getVal(FuelTechLarge))\n    print(\"Maximized Operational Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency investment for each region to reduce operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency investment in Region1\": \"Invest1\", \"range\": \"Invest1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region2\": \"Invest2\", \"range\": \"Invest2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region3\": \"Invest3\", \"range\": \"Invest3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region4\": \"Invest4\", \"range\": \"Invest4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency investment in Region5\": \"Invest5\", \"range\": \"Invest5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with increased fuel efficiency investment. The initial operational cost per truck in Region1 is $1000, and for every $1000 invested in fuel efficiency, the cost decreases by $50. The same pattern applies to the other regions with different initial costs: Region2 ($1200), Region3 ($900), Region4 ($1100), and Region5 ($1300). The company aims to minimize the total operational cost across all regions.\n// Cost_Region1 = (1000 - 0.05 * Invest1) * Trucks1\n// Cost_Region2 = (1200 - 0.05 * Invest2) * Trucks2\n// Cost_Region3 = (900 - 0.05 * Invest3) * Trucks3\n// Cost_Region4 = (1100 - 0.05 * Invest4) * Trucks4\n// Cost_Region5 = (1300 - 0.05 * Invest5) * Trucks5\n// So, the objective function is: Minimize (Cost_Region1 + Cost_Region2 + Cost_Region3 + Cost_Region4 + Cost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel efficiency investments and truck operations.\n// (1000 - 0.05 * Invest1) * Trucks1 + (1200 - 0.05 * Invest2) * Trucks2 + (900 - 0.05 * Invest3) * Trucks3 + (1100 - 0.05 * Invest4) * Trucks4 + (1300 - 0.05 * Invest5) * Trucks5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks the company can operate is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500\n\n## Generate Constraint-3:\nDue to regional demand, the company must allocate at least 50 trucks to Region1, 75 trucks to Region2, and 60 trucks to Region3.\n// Trucks1 >= 50; Trucks2 >= 75; Trucks3 >= 60\n\n## Generate Constraint-4:\nThe fuel efficiency investment in each region must not exceed $20,000.\n// Invest1 <= 20000; Invest2 <= 20000; Invest3 <= 20000; Invest4 <= 20000; Invest5 <= 20000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide how many trucks to allocate to each region and the fuel efficiency investment for each region to reduce operational costs. The operational cost per truck decreases with increased fuel efficiency investment. The initial operational cost per truck in Region1 is $1000, and for every $1000 invested in fuel efficiency, the cost decreases by $50. The same pattern applies to the other regions with different initial costs: Region2 ($1200), Region3 ($900), Region4 ($1100), and Region5 ($1300). The company has a total budget of $100,000 for fuel efficiency investments and truck operations. The total number of trucks the company can operate is limited to 500. Due to regional demand, the company must allocate at least 50 trucks to Region1, 75 trucks to Region2, and 60 trucks to Region3. The fuel efficiency investment in each region must not exceed $20,000. Please help the company to minimize the total operational cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest1\", lb=0)  # fuel efficiency investment in Region1\nInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest2\", lb=0)  # fuel efficiency investment in Region2\nInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest3\", lb=0)  # fuel efficiency investment in Region3\nInvest4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest4\", lb=0)  # fuel efficiency investment in Region4\nInvest5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest5\", lb=0)  # fuel efficiency investment in Region5\n\n# Define objective function\nCost_Region1 = (1000 - 0.05 * Invest1) * Trucks1\nCost_Region2 = (1200 - 0.05 * Invest2) * Trucks2\nCost_Region3 = (900 - 0.05 * Invest3) * Trucks3\nCost_Region4 = (1100 - 0.05 * Invest4) * Trucks4\nCost_Region5 = (1300 - 0.05 * Invest5) * Trucks5\n# So, the objective function is: Minimize (Cost_Region1 + Cost_Region2 + Cost_Region3 + Cost_Region4 + Cost_Region5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Region1 + Cost_Region2 + Cost_Region3 + Cost_Region4 + Cost_Region5)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel efficiency investments and truck operations.\nmodel.addCons((1000 - 0.05 * Invest1) * Trucks1 + (1200 - 0.05 * Invest2) * Trucks2 + \n              (900 - 0.05 * Invest3) * Trucks3 + (1100 - 0.05 * Invest4) * Trucks4 + \n              (1300 - 0.05 * Invest5) * Trucks5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000)\n# The total number of trucks the company can operate is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500)\n# Due to regional demand, the company must allocate at least 50 trucks to Region1, 75 trucks to Region2, and 60 trucks to Region3.\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 75)\nmodel.addCons(Trucks3 >= 60)\n# The fuel efficiency investment in each region must not exceed $20,000.\nmodel.addCons(Invest1 <= 20000)\nmodel.addCons(Invest2 <= 20000)\nmodel.addCons(Invest3 <= 20000)\nmodel.addCons(Invest4 <= 20000)\nmodel.addCons(Invest5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Investment in Region1: \", model.getVal(Invest1))\n    print(\"Fuel Efficiency Investment in Region2: \", model.getVal(Invest2))\n    print(\"Fuel Efficiency Investment in Region3: \", model.getVal(Invest3))\n    print(\"Fuel Efficiency Investment in Region4: \", model.getVal(Invest4))\n    print(\"Fuel Efficiency Investment in Region5: \", model.getVal(Invest5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgBudgetA\", \"range\": \"MktgBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MktgBudgetB\", \"range\": \"MktgBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MktgBudgetC\", \"range\": \"MktgBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepA\", \"range\": \"SalesRepA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepB\", \"range\": \"SalesRepB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepC\", \"range\": \"SalesRepC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated from each product is influenced by the marketing budget and the number of sales representatives. The revenue function is nonlinear, with a diminishing return effect for both marketing and sales representatives. The cost of production for ProductA is $50 per unit, for ProductB is $70 per unit, and for ProductC is $90 per unit. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 * ProdA - 50 * ProdA - 0.01 * MktgBudgetA^2 - 100 * SalesRepA + 0.1 * SalesRepA^2)\n// Total profit for ProductB: ProfitB = (120 * ProdB - 70 * ProdB - 0.01 * MktgBudgetB^2 - 120 * SalesRepB + 0.1 * SalesRepB^2)\n// Total profit for ProductC: ProfitC = (150 * ProdC - 90 * ProdC - 0.01 * MktgBudgetC^2 - 150 * SalesRepC + 0.1 * SalesRepC^2)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MktgBudgetA + MktgBudgetB + MktgBudgetC <= 100000\n\n## Generate Constraint-2:\nThe total number of sales representatives for all products must not exceed 100.\n// SalesRepA + SalesRepB + SalesRepC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue generated from each product is influenced by the marketing budget and the number of sales representatives, with a diminishing return effect for both. The cost of production for ProductA is $50 per unit, for ProductB is $70 per unit, and for ProductC is $90 per unit. The company aims to maximize the total profit from all products. The total marketing budget for all products cannot exceed $100,000, and the total number of sales representatives for all products must not exceed 100.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity for ProductC\nMktgBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgBudgetA\", lb=0)  # marketing budget for ProductA\nMktgBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgBudgetB\", lb=0)  # marketing budget for ProductB\nMktgBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgBudgetC\", lb=0)  # marketing budget for ProductC\nSalesRepA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepA\", lb=0)  # number of sales representatives for ProductA\nSalesRepB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepB\", lb=0)  # number of sales representatives for ProductB\nSalesRepC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepC\", lb=0)  # number of sales representatives for ProductC\n\n# Define objective function\nProfitA = (100 * ProdA - 50 * ProdA - 0.01 * MktgBudgetA**2 - 100 * SalesRepA + 0.1 * SalesRepA**2)\nProfitB = (120 * ProdB - 70 * ProdB - 0.01 * MktgBudgetB**2 - 120 * SalesRepB + 0.1 * SalesRepB**2)\nProfitC = (150 * ProdC - 90 * ProdC - 0.01 * MktgBudgetC**2 - 150 * SalesRepC + 0.1 * SalesRepC**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MktgBudgetA + MktgBudgetB + MktgBudgetC <= 100000)\nmodel.addCons(SalesRepA + SalesRepB + SalesRepC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgBudgetC))\n    print(\"Number of Sales Representatives for ProductA: \", model.getVal(SalesRepA))\n    print(\"Number of Sales Representatives for ProductB: \", model.getVal(SalesRepB))\n    print(\"Number of Sales Representatives for ProductC: \", model.getVal(SalesRepC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"cost per kilometer for small vehicles\": \"CostPerKmSmall\", \"range\": \"CostPerKmSmall >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for medium vehicles\": \"CostPerKmMedium\", \"range\": \"CostPerKmMedium >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for large vehicles\": \"CostPerKmLarge\", \"range\": \"CostPerKmLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer.\n// Revenue_Small = 10 * SmallVehicles\n// Revenue_Medium = 15 * MediumVehicles\n// Revenue_Large = 20 * LargeVehicles\n// Operational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads.\n// LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles)\n\n## Generate Constraint-4:\nThe operational cost per kilometer for each type of vehicle is a nonlinear function of the number of vehicles of that type, given by:\n// CostPerKmSmall = 0.1 * (SmallVehicles)^2 + 2 * SmallVehicles + 1\n// CostPerKmMedium = 0.15 * (MediumVehicles)^2 + 3 * MediumVehicles + 2\n// CostPerKmLarge = 0.2 * (LargeVehicles)^2 + 4 * LargeVehicles + 3\n// These constraints ensure that the operational cost increases nonlinearly with the number of vehicles.",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints. The revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The operational cost per kilometer for each type of vehicle is a nonlinear function of the number of vehicles of that type, as shown in the following Table.\n\n| Vehicle Type | Revenue per Kilometer | Operational Cost per Kilometer |\n|--------------|-----------------------|--------------------------------|\n| Small        | 10$                   | 0.1 * (SmallVehicles)^2 + 2 * SmallVehicles + 1 |\n| Medium       | 15$                   | 0.15 * (MediumVehicles)^2 + 3 * MediumVehicles + 2 |\n| Large        | 20$                   | 0.2 * (LargeVehicles)^2 + 4 * LargeVehicles + 3 |\n\nThe company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The company must ensure that at least 20% of the fleet is composed of large vehicles to handle heavy loads. \n\nPlease help the company to maximize the total revenue minus the total operational cost per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)\n\n# Define objective function\nRevenue_Small = 10 * SmallVehicles\nRevenue_Medium = 15 * MediumVehicles\nRevenue_Large = 20 * LargeVehicles\n\n# Define nonlinear operational costs\nCostPerKmSmall = 0.1 * SmallVehicles**2 + 2 * SmallVehicles + 1\nCostPerKmMedium = 0.15 * MediumVehicles**2 + 3 * MediumVehicles + 2\nCostPerKmLarge = 0.2 * LargeVehicles**2 + 4 * LargeVehicles + 3\n\nOperational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n# Add constraints\nmodel.addCons(CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000)\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 50)\nmodel.addCons(LargeVehicles >= 0.2 * (SmallVehicles + MediumVehicles + LargeVehicles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1391,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using five different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profitability per worker. \nOn machine 1, each worker generates a profit of $500 for product 1, $600 for product 2, and $700 for product 3 per day. \nOn machine 2, each worker generates a profit of $600 for product 1, $700 for product 2, and $800 for product 3 per day. \nOn machine 3, each worker generates a profit of $700 for product 1, $800 for product 2, and $900 for product 3 per day. \nOn machine 4, each worker generates a profit of $800 for product 1, $900 for product 2, and $1000 for product 3 per day.\nOn machine 5, each worker generates a profit of $900 for product 1, $1000 for product 2, and $1100 for product 3 per day.\nThe company aims to maximize the total daily profit from all three products.\n// The profit from product 1: P1 = (500 * M1 + 600 * M2 + 700 * M3 + 800 * M4 + 900 * M5)\n// The profit from product 2: P2 = (600 * M1 + 700 * M2 + 800 * M3 + 900 * M4 + 1000 * M5)\n// The profit from product 3: P3 = (700 * M1 + 800 * M2 + 900 * M3 + 1000 * M4 + 1100 * M5)\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 50\n\n## Generate Constraint-2:\nEach machine can be operated by up to 12 workers at a time.\n// M1 <= 12; M2 <= 12; M3 <= 12; M4 <= 12; M5 <= 12\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of each product daily.\n// M1 >= 100 / 500; M2 >= 100 / 600; M3 >= 100 / 700; M4 >= 100 / 800; M5 >= 100 / 900 (for product 1)\n// M1 >= 100 / 600; M2 >= 100 / 700; M3 >= 100 / 800; M4 >= 100 / 900; M5 >= 100 / 1000 (for product 2)\n// M1 >= 100 / 700; M2 >= 100 / 800; M3 >= 100 / 900; M4 >= 100 / 1000; M5 >= 100 / 1100 (for product 3)",
        "question": "A manufacturing company produces three types of products using five different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. Each machine has a different efficiency and profitability per worker. On machine 1, each worker generates a profit of $500 for product 1, $600 for product 2, and $700 for product 3 per day. On machine 2, each worker generates a profit of $600 for product 1, $700 for product 2, and $800 for product 3 per day. On machine 3, each worker generates a profit of $700 for product 1, $800 for product 2, and $900 for product 3 per day. On machine 4, each worker generates a profit of $800 for product 1, $900 for product 2, and $1000 for product 3 per day. On machine 5, each worker generates a profit of $900 for product 1, $1000 for product 2, and $1100 for product 3 per day. The company aims to maximize the total daily profit from all three products. There are a total of 50 workers available. Each machine can be operated by up to 12 workers at a time. The company must produce at least 100 units of each product daily. Please help the company to maximize the total daily profit from all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP1 = 500 * M1 + 600 * M2 + 700 * M3 + 800 * M4 + 900 * M5\nP2 = 600 * M1 + 700 * M2 + 800 * M3 + 900 * M4 + 1000 * M5\nP3 = 700 * M1 + 800 * M2 + 900 * M3 + 1000 * M4 + 1100 * M5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 50)\nmodel.addCons(M1 <= 12)\nmodel.addCons(M2 <= 12)\nmodel.addCons(M3 <= 12)\nmodel.addCons(M4 <= 12)\nmodel.addCons(M5 <= 12)\nmodel.addCons(M1 >= 100 / 500)\nmodel.addCons(M2 >= 100 / 600)\nmodel.addCons(M3 >= 100 / 700)\nmodel.addCons(M4 >= 100 / 800)\nmodel.addCons(M5 >= 100 / 900)\nmodel.addCons(M1 >= 100 / 600)\nmodel.addCons(M2 >= 100 / 700)\nmodel.addCons(M3 >= 100 / 800)\nmodel.addCons(M4 >= 100 / 900)\nmodel.addCons(M5 >= 100 / 1000)\nmodel.addCons(M1 >= 100 / 700)\nmodel.addCons(M2 >= 100 / 800)\nmodel.addCons(M3 >= 100 / 900)\nmodel.addCons(M4 >= 100 / 1000)\nmodel.addCons(M5 >= 100 / 1100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(M1))\n    print(\"Number of workers on machine 2: \", model.getVal(M2))\n    print(\"Number of workers on machine 3: \", model.getVal(M3))\n    print(\"Number of workers on machine 4: \", model.getVal(M4))\n    print(\"Number of workers on machine 5: \", model.getVal(M5))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to optimize its operations. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each mode of transportation, which affects the fuel consumption and operational costs.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for trains\": \"TrainTech\", \"range\": \"TrainTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for ships\": \"ShipTech\", \"range\": \"ShipTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each mode of transportation improves with the investment in fuel-efficient technologies. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost per truck trip: FuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\n// Fuel cost per train trip: FuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\n// Fuel cost per ship trip: FuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes of transportation must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500\n\n## Generate Constraint-3:\nDue to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50.\n// TruckTrips >= 100; TrainTrips >= 50",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the investment in fuel-efficient technologies for each mode to optimize its operations. The investment in fuel-efficient technologies affects the fuel consumption and operational costs. The following table summarizes the initial fuel cost per trip for each mode of transportation and the impact of technology investment on fuel cost.\n\n| Mode of Transportation | Initial Fuel Cost per Trip | Impact of Tech Investment on Fuel Cost |\n|------------------------|----------------------------|----------------------------------------|\n| Truck                  | 100$                       | Decreases by 0.1$ per unit of investment |\n| Train                  | 80$                        | Decreases by 0.08$ per unit of investment |\n| Ship                   | 120$                       | Decreases by 0.12$ per unit of investment |\n\nThe company has a total budget of $100,000 for transportation and technology investments. The total number of trips across all modes of transportation must not exceed 500 trips. Due to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50.\n\nPlease help the company to minimize the total fuel cost of all trips by determining the optimal number of trips for each mode of transportation and the appropriate investment in fuel-efficient technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=100)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=50)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for trucks\nTrainTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TrainTech\", lb=0)  # investment in fuel-efficient technology for trains\nShipTech = model.addVar(vtype=\"CONTINUOUS\", name=\"ShipTech\", lb=0)  # investment in fuel-efficient technology for ships\n\n# Define objective function\nFuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\nFuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\nFuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n# Add constraints\nmodel.addCons(100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Train Tech: \", model.getVal(TrainTech))\n    print(\"Investment in Ship Tech: \", model.getVal(ShipTech))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1521,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested.\n// Total fuel cost for TruckA: CostA = (100 - 0.05 * EfficiencyA) * TripsA\n// Total fuel cost for TruckB: CostB = (150 - 0.07 * EfficiencyB) * TripsB\n// Total fuel cost for TruckC: CostC = (200 - 0.1 * EfficiencyC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs.\n// 100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000",
        "question": "A logistics company is planning its routes for the next quarter and operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested. The company has a budget of $20,000 for investments in fuel efficiency and operational costs.\n\nPlease help the company to minimize the total fuel cost for all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # investment in fuel efficiency for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # investment in fuel efficiency for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # investment in fuel efficiency for TruckC\n\n# Define objective function\nCostA = (100 - 0.05 * EfficiencyA) * TripsA\nCostB = (150 - 0.07 * EfficiencyB) * TripsB\nCostC = (200 - 0.1 * EfficiencyC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a budget of $20,000 for investments in fuel efficiency and operational costs.\nmodel.addCons(100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region and the number of trips each truck should make per day. The company also needs to consider the fuel efficiency of each type of truck and the distance each truck travels per trip.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A (km/liter)\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B (km/liter)\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"distance per trip for Region A (km)\": \"DistanceA\", \"range\": \"DistanceA > 0\", \"type\": \"real\"}\n// {\"distance per trip for Region B (km)\": \"DistanceB\", \"range\": \"DistanceB > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel cost, considering the fuel price per liter and the total fuel consumption per day.\n// TotalFuelConsumptionA = TrucksA * TripsA * DistanceA / FuelEffA\n// TotalFuelConsumptionB = TrucksB * TripsB * DistanceB / FuelEffB\n// TotalFuelCost = FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB)\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for daily fuel expenses.\n// FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB) <= 1000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of trucks to allocate for each region and the number of trips each truck should make per day. The company also needs to consider the fuel efficiency of each type of truck and the distance each truck travels per trip. The company aims to minimize the total daily fuel cost, considering the fuel price per liter and the total fuel consumption per day. The company has a total budget of $1000 for daily fuel expenses.\n\nPlease help the company determine the optimal number of trucks and trips for each region to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Region A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Region B\n\n# Define objective function\nFuelPrice = 1.5  # assume fuel price per liter\nFuelEffA = 5  # assume fuel efficiency of trucks for Region A (km/liter)\nFuelEffB = 6  # assume fuel efficiency of trucks for Region B (km/liter)\nDistanceA = 100  # assume distance per trip for Region A (km)\nDistanceB = 120  # assume distance per trip for Region B (km)\n\nTotalFuelConsumptionA = TrucksA * TripsA * DistanceA / FuelEffA\nTotalFuelConsumptionB = TrucksB * TripsB * DistanceB / FuelEffB\nTotalFuelCost = FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n# The company has a total budget of $1000 for daily fuel expenses.\nmodel.addCons(FuelPrice * (TotalFuelConsumptionA + TotalFuelConsumptionB) <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trips per Truck for Region A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Region B: \", model.getVal(TripsB))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 695,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering the purchase of different types of vehicles (Trucks, Vans, and Bikes) to optimize its delivery network. The company needs to decide on the number of each type of vehicle to buy and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"CostTruck\", \"range\": \"CostTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"CostVan\", \"range\": \"CostVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"CostBike\", \"range\": \"CostBike >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that Trucks can handle 100 deliveries per day with an operational cost of $200 per day, Vans can handle 50 deliveries per day with an operational cost of $100 per day, and Bikes can handle 20 deliveries per day with an operational cost of $50 per day. The company aims to minimize the total operational cost while ensuring a certain level of delivery capacity.\n// Total operational cost: Cost = Trucks * CostTruck + Vans * CostVan + Bikes * CostBike\n// Total delivery capacity: Capacity = Trucks * 100 + Vans * 50 + Bikes * 20\n// The objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for purchasing vehicles.\n// Trucks * CostTruck + Vans * CostVan + Bikes * CostBike <= 10000",
        "question": "A logistics company is planning its fleet expansion by considering the purchase of different types of vehicles (Trucks, Vans, and Bikes) to optimize its delivery network. The company needs to decide on the number of each type of vehicle to buy and the associated operational costs. The operational costs and delivery capacities for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity per Day | Operational Cost per Day |\n|--------------|---------------------------|--------------------------|\n| Trucks       | 100                       | $200                     |\n| Vans         | 50                        | $100                     |\n| Bikes        | 20                        | $50                      |\n\nThe company has a budget of $10,000 for purchasing vehicles. The company aims to minimize the total operational cost while ensuring a certain level of delivery capacity. Please help the company to minimize the total operational cost per unit of delivery capacity (defined as the total operational cost divided by the total delivery capacity).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostTruck = 200  # operational cost per Truck\nCostVan = 100  # operational cost per Van\nCostBike = 50  # operational cost per Bike\nCost = Trucks * CostTruck + Vans * CostVan + Bikes * CostBike\nCapacity = Trucks * 100 + Vans * 50 + Bikes * 20\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for purchasing vehicles.\nmodel.addCons(Trucks * CostTruck + Vans * CostVan + Bikes * CostBike <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Cost per Delivery Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of T1 is $100 per km, with a fuel efficiency of 5 km/liter and a maintenance cost of $500 per month.\nThe operational cost of T2 is $120 per km, with a fuel efficiency of 6 km/liter and a maintenance cost of $600 per month.\nThe operational cost of T3 is $140 per km, with a fuel efficiency of 7 km/liter and a maintenance cost of $700 per month.\nThe operational cost of T4 is $160 per km, with a fuel efficiency of 8 km/liter and a maintenance cost of $800 per month.\nThe operational cost of T5 is $180 per km, with a fuel efficiency of 9 km/liter and a maintenance cost of $900 per month.\nThe company wants to minimize the total monthly operational cost, considering both fuel and maintenance costs.\n// Cost_T1 = 100 * distance_T1 / 5 + 500 * T1\n// Cost_T2 = 120 * distance_T2 / 6 + 600 * T2\n// Cost_T3 = 140 * distance_T3 / 7 + 700 * T3\n// Cost_T4 = 160 * distance_T4 / 8 + 800 * T4\n// Cost_T5 = 180 * distance_T5 / 9 + 900 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 5000 tons, and T1, T2, T3, T4, and T5 can carry 100, 200, 300, 400, and 500 tons respectively.\n// 100 * T1 + 200 * T2 + 300 * T3 + 400 * T4 + 500 * T5 >= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for monthly operational costs.\n// (100 * distance_T1 / 5 + 500 * T1) + (120 * distance_T2 / 6 + 600 * T2) + (140 * distance_T3 / 7 + 700 * T3) + (160 * distance_T4 / 8 + 800 * T4) + (180 * distance_T5 / 9 + 900 * T5) <= 100000\n\n## Generate Constraint-3:\nThe company has a limit of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-4:\nThe market demand for T1 is 5 trucks. So, the company can only operate a maximum of 5 trucks of T1.\n// T1 <= 5",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to minimize the total operational cost while meeting the cargo delivery requirements. The operational costs, fuel efficiency, and maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per km | Fuel Efficiency (km/liter) | Maintenance Cost per Month |\n|------------|-------------------------|----------------------------|----------------------------|\n| T1         | $100                    | 5                          | $500                       |\n| T2         | $120                    | 6                          | $600                       |\n| T3         | $140                    | 7                          | $700                       |\n| T4         | $160                    | 8                          | $800                       |\n| T5         | $180                    | 9                          | $900                       |\n\nThe total cargo capacity required is 5000 tons, and T1, T2, T3, T4, and T5 can carry 100, 200, 300, 400, and 500 tons respectively. The company has a budget of $100,000 for monthly operational costs. The company has a limit of 50 trucks in total. The market demand for T1 is 5 trucks. So, the company can only operate a maximum of 5 trucks of T1.\n\nPlease help the company to minimize the total monthly operational cost, considering both fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## convert the division to multiplication\nCost_T1 = 100 * (distance_T1 := model.addVar(name=\"distance_T1\")) / 5 + 500 * T1\nCost_T2 = 120 * (distance_T2 := model.addVar(name=\"distance_T2\")) / 6 + 600 * T2\nCost_T3 = 140 * (distance_T3 := model.addVar(name=\"distance_T3\")) / 7 + 700 * T3\nCost_T4 = 160 * (distance_T4 := model.addVar(name=\"distance_T4\")) / 8 + 800 * T4\nCost_T5 = 180 * (distance_T5 := model.addVar(name=\"distance_T5\")) / 9 + 900 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 5000 tons\nmodel.addCons(100 * T1 + 200 * T2 + 300 * T3 + 400 * T4 + 500 * T5 >= 5000)\n## The company has a budget of $100,000 for monthly operational costs\nmodel.addCons(Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5 <= 100000)\n## The company has a limit of 50 trucks in total\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The market demand for T1 is 5 trucks\nmodel.addCons(T1 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1602,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel.\n// {\"number of solar panels for Apartments\": \"ApartmentPanels\", \"range\": \"ApartmentPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Houses\": \"HousePanels\", \"range\": \"HousePanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"efficiency of solar panels for Apartments\": \"ApartmentEfficiency\", \"range\": \"ApartmentEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Houses\": \"HouseEfficiency\", \"range\": \"HouseEfficiency > 0\", \"type\": \"real\"}\n// {\"efficiency of solar panels for Commercial buildings\": \"CommercialEfficiency\", \"range\": \"CommercialEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000 for Apartments, $1500 for Houses, and $2000 for Commercial buildings. The energy generated per panel per day is proportional to the efficiency of the panel. The city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh.\n// Cost_Apartments = 1000 * ApartmentPanels\n// Cost_Houses = 1500 * HousePanels\n// Cost_Commercial = 2000 * CommercialPanels\n// Energy_Apartments = ApartmentEfficiency * ApartmentPanels\n// Energy_Houses = HouseEfficiency * HousePanels\n// Energy_Commercial = CommercialEfficiency * CommercialPanels\n// So, the objective function is: Minimize (Cost_Apartments + Cost_Houses + Cost_Commercial)\n\n## Generate Constraint-1:\nThe total daily energy generated must be at least 1000 kWh.\n// Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to reduce energy costs and carbon emissions. The city has identified three types of buildings (Apartments, Houses, and Commercial) suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building and the efficiency of each type of solar panel. The cost of installation per solar panel and the energy generated per panel per day are given in the following Table.\n\n| Building Type | Installation Cost per Panel | Energy Generated per Panel per Day |\n|---------------|-----------------------------|------------------------------------|\n| Apartments    | $1000                       | ApartmentEfficiency                |\n| Houses        | $1500                       | HouseEfficiency                    |\n| Commercial    | $2000                       | CommercialEfficiency               |\n\nThe city aims to minimize the total cost of installation while ensuring a minimum daily energy generation of 1000 kWh. The total daily energy generated must be at least 1000 kWh. Please help the city determine the optimal number of solar panels and their efficiencies for each type of building.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartmentPanels = model.addVar(vtype=\"INTEGER\", name=\"ApartmentPanels\", lb=0)  # number of solar panels for Apartments\nHousePanels = model.addVar(vtype=\"INTEGER\", name=\"HousePanels\", lb=0)  # number of solar panels for Houses\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)  # number of solar panels for Commercial buildings\nApartmentEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"ApartmentEfficiency\", lb=0)  # efficiency of solar panels for Apartments\nHouseEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HouseEfficiency\", lb=0)  # efficiency of solar panels for Houses\nCommercialEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialEfficiency\", lb=0)  # efficiency of solar panels for Commercial buildings\n\n# Define objective function\nCost_Apartments = 1000 * ApartmentPanels\nCost_Houses = 1500 * HousePanels\nCost_Commercial = 2000 * CommercialPanels\nmodel.setObjective(Cost_Apartments + Cost_Houses + Cost_Commercial, \"minimize\")\n\n# Add constraints\nEnergy_Apartments = ApartmentEfficiency * ApartmentPanels\nEnergy_Houses = HouseEfficiency * HousePanels\nEnergy_Commercial = CommercialEfficiency * CommercialPanels\nmodel.addCons(Energy_Apartments + Energy_Houses + Energy_Commercial >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Apartments: \", model.getVal(ApartmentPanels))\n    print(\"Number of Solar Panels for Houses: \", model.getVal(HousePanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Efficiency of Solar Panels for Apartments: \", model.getVal(ApartmentEfficiency))\n    print(\"Efficiency of Solar Panels for Houses: \", model.getVal(HouseEfficiency))\n    print(\"Efficiency of Solar Panels for Commercial Buildings: \", model.getVal(CommercialEfficiency))\n    print(\"Minimized Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n// Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\n// Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\n// Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per day.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-2:\nThe cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $2000 per day for raw materials.\n// 5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at most 200 units per day, for product B is at most 300 units per day, and for product C is at most 150 units per day.\n// ProductA <= 200; ProductB <= 300; ProductC <= 150\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, ensuring that the ratio of product A to product B is at least 1:2, and the ratio of product B to product C is at least 2:1.\n// ProductA >= 0.5 * ProductB; ProductB >= 2 * ProductC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit, cost of raw materials, and market demand for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials | Market Demand |\n|---------|-----------------|-----------------------|---------------|\n| A       | $20             | $5                    | 200 units     |\n| B       | $30             | $10                   | 300 units     |\n| C       | $40             | $15                   | 150 units     |\n\nThe profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company has a total production capacity of 500 units per day and a budget of $2000 per day for raw materials. The company aims to maintain a balanced production, ensuring that the ratio of product A to product B is at least 1:2, and the ratio of product B to product C is at least 2:1.\n\nPlease help the company to maximize the total profit from the production and sale of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=300)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=150)  # quantity of product C\n\n# Define objective function\n# create piecewise variables for piecewise function: Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 20 * A1 * A_b1 + (20 + 0.05 * (A2 - 100)) * A2 * A_b2\n\n# create piecewise variables for piecewise function: Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 30 * B1 * B_b1 + (30 + 0.05 * (B2 - 100)) * B2 * B_b2\n\n# create piecewise variables for piecewise function: Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=150)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 40 * C1 * C_b1 + (40 + 0.05 * (C2 - 100)) * C2 * C_b2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000)\nmodel.addCons(ProductA <= 200)\nmodel.addCons(ProductB <= 300)\nmodel.addCons(ProductC <= 150)\nmodel.addCons(ProductA >= 0.5 * ProductB)\nmodel.addCons(ProductB >= 2 * ProductC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks.\n// {\"number of trucks for Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Zone1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones.\n// Operational cost for Zone1: Cost1 = (500 - 0.1 * Upgrade1) * Trucks1\n// Operational cost for Zone2: Cost2 = (500 - 0.1 * Upgrade2) * Trucks2\n// Operational cost for Zone3: Cost3 = (500 - 0.1 * Upgrade3) * Trucks3\n// Operational cost for Zone4: Cost4 = (500 - 0.1 * Upgrade4) * Trucks4\n// Operational cost for Zone5: Cost5 = (500 - 0.1 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks. The operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades, with an initial operational cost per truck of $500. The company aims to minimize the total operational cost across all zones.\n\nThe company has a total of 100 trucks available for allocation and a total budget for fuel efficiency upgrades of $100,000.\n\nPlease help the company to determine the optimal allocation of trucks and investments in fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Zone5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Zone1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Zone2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Zone3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Zone4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Zone5\n\n# Define objective function\nCost1 = (500 - 0.1 * Upgrade1) * Trucks1\nCost2 = (500 - 0.1 * Upgrade2) * Trucks2\nCost3 = (500 - 0.1 * Upgrade3) * Trucks3\nCost4 = (500 - 0.1 * Upgrade4) * Trucks4\nCost5 = (500 - 0.1 * Upgrade5) * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Zone5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Zone1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Zone2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Zone3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Zone4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Zone5: \", model.getVal(Upgrade5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor.\nThe profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor.\nThe profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor.\nThe profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor.\nThe profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor.\nThe company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n// Total profit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a labor budget of $5,000.\n// 10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product E is at most 50 units.\n// E <= 50",
        "question": "A manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands.\nThe profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor.\nThe profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor.\nThe profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor.\nThe profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor.\nThe profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor.\nThe company has a budget of $10,000 for raw materials and a labor budget of $5,000. The market demand for product A is at least 100 units, and the market demand for product E is at most 50 units.\nPlease help the company to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=50) # quantity of product E produced\n\n# Define objective function\n## The company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\nTotalProfit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n## The company has a labor budget of $5,000.\nmodel.addCons(10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company wants to maximize the total profit per liter of fuel consumed.\n// Profit_TruckA = (2 - 0.5) * Distance_TruckA / 10\n// Profit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\n// Profit_TruckC = (3 - 0.7) * Distance_TruckC / 15\n// Profit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\n// Profit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n// Distance_TruckA = TruckA * Average_Distance\n// Distance_TruckB = TruckB * Average_Distance\n// Distance_TruckC = TruckC * Average_Distance\n// Distance_TruckD = TruckD * Average_Distance\n// Distance_TruckE = TruckE * Average_Distance\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\n// 0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000\n\n## Generate Constraint-3:\nThe company has a fuel budget of 5000 liters for the season.\n// 10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season. The fuel efficiency, maintenance cost per km, and revenue per km for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/l) | Maintenance Cost per km ($) | Revenue per km ($) |\n|-------|-----------------------|-----------------------------|-------------------|\n| TruckA | 10 | 0.5 | 2 |\n| TruckB | 12 | 0.6 | 2.5 |\n| TruckC | 15 | 0.7 | 3 |\n| TruckD | 18 | 0.8 | 3.5 |\n| TruckE | 20 | 0.9 | 4 |\n\nThe company has a total of 100 trucks available for deployment. Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000. The company has a fuel budget of 5000 liters for the season. \n\nPlease help the company to maximize the total profit per liter of fuel consumed, considering that the distance each truck travels is proportional to the number of trucks of that type deployed (i.e., Distance_TruckX = TruckX * Average_Distance for each type X).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define distances and profits\nDistance_TruckA = TruckA * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckB = TruckB * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckC = TruckC * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckD = TruckD * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckE = TruckE * model.addVar(name=\"Average_Distance\", lb=0)\n\nProfit_TruckA = (2 - 0.5) * Distance_TruckA / 10\nProfit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\nProfit_TruckC = (3 - 0.7) * Distance_TruckC / 15\nProfit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\nProfit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TruckA + TruckB + TruckC + TruckD + TruckE) == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\nmodel.addCons(0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000)\n\n## The company has a fuel budget of 5000 liters for the season.\nmodel.addCons(10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n// Total profit from Small trucks: ProfitSmall = 50000 * SmallTrucks\n// Total profit from Medium trucks: ProfitMedium = 75000 * MediumTrucks\n// Total profit from Large trucks: ProfitLarge = 100000 * LargeTrucks\n// Total profit from Extra-Large trucks: ProfitExtraLarge = 125000 * ExtraLargeTrucks\n// Operational cost: OperationalCost = 50000 * Drivers\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 30.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 30",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large, each with different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs. The profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost. The company has a budget of $2,000,000 for purchasing new trucks and hiring drivers. The total number of trucks cannot exceed 30.\n\nPlease help the company to maximize the net profit, which is the total profit from all trucks minus the operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)  # number of drivers\n\n# Define objective function\nProfitSmall = 50000 * SmallTrucks\nProfitMedium = 75000 * MediumTrucks\nProfitLarge = 100000 * LargeTrucks\nProfitExtraLarge = 125000 * ExtraLargeTrucks\nOperationalCost = 50000 * Drivers\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced manufacturing technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from selling all devices.\n// Profit_DeviceA = (150 - (100 - 0.05 * TechInvestment / 1000)) * DeviceA\n// Profit_DeviceB = (200 - (150 - 0.05 * TechInvestment / 1000)) * DeviceB\n// Profit_DeviceC = (250 - (200 - 0.05 * TechInvestment / 1000)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\n// DeviceA <= 500; DeviceB <= 400; DeviceC <= 300\n\n## Generate Constraint-3:\nThe total production quantity of all devices must not exceed 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\n// DeviceA >= 100; DeviceB >= 150\n\n## Generate Constraint-5:\nThe demand for DeviceC is limited to 200 units.\n// DeviceC <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantities of each device and the amount of investment in advanced manufacturing technology to improve production efficiency. The investment in technology will reduce the production cost per unit of each device. The production cost per unit, selling price per unit, and production capacity for each device are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Production Capacity |\n|--------|--------------------------|-----------------------|---------------------|\n| DeviceA | $100                    | $150                  | 500 units           |\n| DeviceB | $150                    | $200                  | 400 units           |\n| DeviceC | $200                    | $250                  | 300 units           |\n\nThe company has a total budget of $100,000 for investment in advanced manufacturing technology. The production capacity for each device is limited as shown in the table. The total production quantity of all devices must not exceed 1000 units. The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced. The demand for DeviceC is limited to 200 units. \n\nPlease help the company to maximize the total profit from selling all devices, considering the investment in advanced manufacturing technology reduces the production cost per unit by $0.05 for every $1,000 invested.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100, ub=500) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=150, ub=400) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=200) # quantity of DeviceC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in advanced manufacturing technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate the reduced production cost per unit due to investment\nReducedCost_DeviceA = 100 - 0.05 * TechInvestment / 1000\nReducedCost_DeviceB = 150 - 0.05 * TechInvestment / 1000\nReducedCost_DeviceC = 200 - 0.05 * TechInvestment / 1000\n## calculate the profit for each device\nProfit_DeviceA = (150 - ReducedCost_DeviceA) * DeviceA\nProfit_DeviceB = (200 - ReducedCost_DeviceB) * DeviceB\nProfit_DeviceC = (250 - ReducedCost_DeviceC) * DeviceC\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in advanced manufacturing technology.\nmodel.addCons(TechInvestment <= 100000)\n## The production capacity for DeviceA is 500 units, for DeviceB is 400 units, and for DeviceC is 300 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\nmodel.addCons(DeviceC <= 300)\n## The total production quantity of all devices must not exceed 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n## The company must ensure that at least 100 units of DeviceA and 150 units of DeviceB are produced.\nmodel.addCons(DeviceA >= 100)\nmodel.addCons(DeviceB >= 150)\n## The demand for DeviceC is limited to 200 units.\nmodel.addCons(DeviceC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Investment in Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1514,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost, selling price, and demand for each device vary and are influenced by market conditions.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price per unit is $100, and the demand is capped at 500 units. For DeviceB, the production cost per unit is $70, the selling price per unit is $120, and the demand is capped at 400 units. For DeviceC, the production cost per unit is $80, the selling price per unit is $150, and the demand is capped at 300 units. The company wants to maximize the total profit from selling these devices.\n// Total profit for DeviceA: ProfitA = (100 - 50) * UnitsA\n// Total profit for DeviceB: ProfitB = (120 - 70) * UnitsB\n// Total profit for DeviceC: ProfitC = (150 - 80) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity for the company is limited to 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB.\n// UnitsA <= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000\n\n## Generate Constraint-4:\nThe demand for each device must be met or exceeded.\n// UnitsA >= 500; UnitsB >= 400; UnitsC >= 300\n\n## Generate Constraint-5:\nDue to a strategic partnership, the company must produce at least 200 units of DeviceC.\n// UnitsC >= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The production cost per unit for DeviceA is $50, the selling price per unit is $100, and the demand is capped at 500 units. For DeviceB, the production cost per unit is $70, the selling price per unit is $120, and the demand is capped at 400 units. For DeviceC, the production cost per unit is $80, the selling price per unit is $150, and the demand is capped at 300 units. The company wants to maximize the total profit from selling these devices. The total production capacity for the company is limited to 1000 units per month. The production of DeviceA should not exceed twice the production of DeviceB. The company has a budget of $60,000 for production costs per month. The demand for each device must be met or exceeded. Due to a strategic partnership, the company must produce at least 200 units of DeviceC. Please help the company determine the optimal number of units to produce for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=200) # number of units of DeviceC\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA\nProfitB = (120 - 70) * UnitsB\nProfitC = (150 - 80) * UnitsC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity for the company is limited to 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# Due to market research, the company knows that the production of DeviceA should not exceed twice the production of DeviceB.\nmodel.addCons(UnitsA <= 2 * UnitsB)\n# The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n# The demand for each device must be met or exceeded.\nmodel.addCons(UnitsA >= 500)\nmodel.addCons(UnitsB >= 400)\nmodel.addCons(UnitsC >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. \nEach truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. \nEach truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. \nEach truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. \nEach truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. \nThe company aims to minimize the total fuel consumption per package delivered.\n// Fuel consumption of route 1: FC1 = 10 * T1\n// Fuel consumption of route 2: FC2 = 15 * T2\n// Fuel consumption of route 3: FC3 = 20 * T3\n// Fuel consumption of route 4: FC4 = 25 * T4\n// Fuel consumption of route 5: FC5 = 30 * T5\n// Total packages delivered: TP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5\n\n## Generate Constraint-3:\nThe total number of packages that can be delivered should not exceed 10,000.\n// 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5 <= 10000",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route 1 consumes 10 liters of fuel per trip and can carry 50 packages. Each truck on route 2 consumes 15 liters of fuel per trip and can carry 75 packages. Each truck on route 3 consumes 20 liters of fuel per trip and can carry 100 packages. Each truck on route 4 consumes 25 liters of fuel per trip and can carry 125 packages. Each truck on route 5 consumes 30 liters of fuel per trip and can carry 150 packages. The company aims to minimize the total fuel consumption per package delivered. The company has a total of 100 trucks available. Each route must have at least 5 trucks. The total number of packages that can be delivered should not exceed 10,000. Please help the company to minimize the total fuel consumption per package delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 5 trucks.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC1 = 10 * T1\nFC2 = 15 * T2\nFC3 = 20 * T3\nFC4 = 25 * T4\nFC5 = 30 * T5\nTP = 50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5\n## the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5) / TP\n## convert the division to multiplication\nmodel.addCons(obj * TP == FC1 + FC2 + FC3 + FC4 + FC5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total number of packages that can be delivered should not exceed 10,000.\nmodel.addCons(50 * T1 + 75 * T2 + 100 * T3 + 125 * T4 + 150 * T5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the revenue per unit is $30, the production time per unit is 1 hour, and the material cost per unit is $10. \nFor product B, the revenue per unit is $40, the production time per unit is 2 hours, and the material cost per unit is $15. \nFor product C, the revenue per unit is $50, the production time per unit is 3 hours, and the material cost per unit is $20.\nFor product D, the revenue per unit is $60, the production time per unit is 4 hours, and the material cost per unit is $25.\nThe company only has one production line and can only produce one product at a time. The company wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_A = 30 * A - 10 * A\n// Profit_B = 40 * B - 15 * B\n// Profit_C = 50 * C - 20 * C\n// Profit_D = 60 * D - 25 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe company has a limited production time of 200 hours.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for material costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 3000",
        "question": "A manufacturing company produces three types of products: A, B, and C, and a new type of product D. They need to determine the quantities of each product to produce. The revenue per unit, production time per unit, and material cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Time per Unit | Material Cost per Unit |\n|---------|------------------|--------------------------|------------------------|\n| A       | $30              | 1 hour                   | $10                    |\n| B       | $40              | 2 hours                  | $15                    |\n| C       | $50              | 3 hours                  | $20                    |\n| D       | $60              | 4 hours                  | $25                    |\n\nThe company has a limited production time of 200 hours. The company also has a budget of $3000 for material costs. The company only has one production line and can only produce one product at a time. \nPlease help the company to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProfit_D = (60 - 25) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a limited production time of 200 hours.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 200)\n## The company has a budget of $3000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The company wants to minimize the total fuel consumption while ensuring timely deliveries. The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The objective is to minimize the total fuel consumption per delivery time.\n// Fuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\n// Delivery_Time = (1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5))\n// So, the objective function is: Minimize Fuel_Consumption / Delivery_Time\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000.\n// 20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy. The fuel consumption rates (gallons per mile) and speeds (miles per hour) for each truck type are given in the following Table.\n\n| Truck Type | Fuel Consumption (gal/mi) | Speed (mph) |\n|------------|--------------------------|-------------|\n| T1         | 0.1                      | 50          |\n| T2         | 0.08                     | 55          |\n| T3         | 0.06                     | 60          |\n| T4         | 0.05                     | 65          |\n| T5         | 0.04                     | 70          |\n\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000. The total number of trucks cannot exceed 50.\n\nPlease help the company to minimize the total fuel consumption per delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nFuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\nDelivery_Time = 1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize Fuel_Consumption / Delivery_Time\n# convert the division to multiplication\nmodel.addCons(obj * Delivery_Time == Fuel_Consumption)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each.\nThe medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each.\nThe large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each.\nThe company wants to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost.\n// TotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\n// TotalFuelConsumption = (10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks) / TotalCarryingCapacity\n// TotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n// So, the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has space to park a maximum of 20 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints. The specifications for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Carrying Capacity (tons) | Purchase Cost ($) |\n|------------|-----------------------|--------------------------|-------------------|\n| Small      | 10                    | 5                        | 50,000            |\n| Medium     | 15                    | 10                       | 75,000            |\n| Large      | 20                    | 15                       | 100,000           |\n\nThe company has a budget of $1,000,000 for purchasing new trucks. The company has space to park a maximum of 20 trucks. Please help the company to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost, with the objective function defined as the total carrying capacity divided by the sum of total fuel consumption and total purchase cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\nTotalFuelConsumption = 10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks\nTotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n## the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n## convert the division to multiplication\nmodel.addCons(obj * (TotalFuelConsumption + TotalPurchaseCost) == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n## The company has space to park a maximum of 20 trucks.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe storage facility can hold a maximum of 500 units at any given time.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nMarket demand for product A is at least 100 units per month.\n// UnitsA >= 100\n\n## Generate Constraint-4:\nDue to labor constraints, the production of product B cannot exceed twice the production of product A.\n// UnitsB <= 2 * UnitsA",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand. The profit per unit, production cost per unit, and market demand for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Market Demand |\n|---------|-----------------|--------------------------|---------------|\n| A       | $50             | $20                      | At least 100  |\n| B       | $70             | $30                      | No constraint  |\n| C       | $60             | $25                      | No constraint  |\n\nThe company has a total production capacity of 1000 units per month. The storage facility can hold a maximum of 500 units at any given time. Due to labor constraints, the production of product B cannot exceed twice the production of product A.\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000) # total production capacity\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500) # storage capacity\nmodel.addCons(UnitsA >= 100) # market demand for product A\nmodel.addCons(UnitsB <= 2 * UnitsA) # labor constraints for product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons.\n// The total cost function is: 50S + 70M + 90L + 110XL + 130R\n// The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\n// The objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for operational costs.\n// 50S + 70M + 90L + 110XL + 130R <= 5000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can operate. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10.\n// S <= 30; M <= 25; L <= 20; XL <= 15; R <= 10\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements.\n// 0.2 * (10S + 20M + 30L + 40XL + 25R) <= 25R\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced fleet, ensuring that the number of Large and Extra-Large trucks does not exceed the combined number of Small and Medium trucks.\n// L + XL <= S + M",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The operational cost and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Operational Cost per Day | Cargo Capacity |\n|------------------|-------------------------|----------------|\n| Small            | $50                     | 10 tons        |\n| Medium           | $70                     | 20 tons        |\n| Large            | $90                     | 30 tons        |\n| Extra-Large      | $110                    | 40 tons        |\n| Refrigerated     | $130                    | 25 tons        |\n\nThe company has a budget of $5000 per day for operational costs. The company has a limit on the number of trucks it can operate: the maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10. The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements. The company aims to maintain a balanced fleet, ensuring that the number of Large and Extra-Large trucks does not exceed the combined number of Small and Medium trucks. The total cargo to be delivered is 1000 tons.\n\nPlease help the company to minimize the total daily operational cost while ensuring all cargo is delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\nmodel.addCons(obj == 50*S + 70*M + 90*L + 110*XL + 130*R)\n\n# Add constraints\n## The company has a budget of $5000 per day for operational costs.\nmodel.addCons(50*S + 70*M + 90*L + 110*XL + 130*R <= 5000)\n## The company has a limit on the number of trucks it can operate.\nmodel.addCons(S <= 30)\nmodel.addCons(M <= 25)\nmodel.addCons(L <= 20)\nmodel.addCons(XL <= 15)\nmodel.addCons(R <= 10)\n## The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks.\nmodel.addCons(0.2 * (10*S + 20*M + 30*L + 40*XL + 25*R) <= 25*R)\n## The company aims to maintain a balanced fleet.\nmodel.addCons(L + XL <= S + M)\n## The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\nmodel.addCons(10*S + 20*M + 30*L + 40*XL + 25*R >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1497,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\n// RevenueA = 100 * ProductA\n// RevenueB = 150 * ProductB\n// RevenueC = 200 * ProductC\n// LaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\n// LaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\n// LaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\n// RawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n// So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe raw material supply is limited to 500 units.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 10 units of ProductA and 20 units of ProductB.\n// ProductA >= 10; ProductB >= 20",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production.\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\nThe company has a total of 1000 labor hours available. The total investment in automation cannot exceed $50,000. The raw material supply is limited to 500 units. The company must produce at least 10 units of ProductA and 20 units of ProductB.\nPlease help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0) # labor hours for ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0) # labor hours for ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0) # labor hours for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\nRevenueA = 100 * ProductA\nRevenueB = 150 * ProductB\nRevenueC = 200 * ProductC\nLaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\nLaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\nLaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\nRawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n# So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000) # total labor hours constraint\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000) # total automation investment constraint\nmodel.addCons(ProductA + ProductB + ProductC <= 500) # raw material supply constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Labor Hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor.\nThe profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor.\nThe profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor.\nThe profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor.\nThe profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor.\nThe company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n// Total profit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000",
        "question": "A manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands. The profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor. The profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor. The profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor. The profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor. The profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor. The company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor. The company has a budget of $10,000 for raw materials. Please help the company determine the optimal quantity of each product to produce to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of product E produced\n\n# Define objective function\n## calculate the profit and cost for each product\nProfit_A = 50 * A - (20 * A + 10 * A)\nProfit_B = 70 * B - (30 * B + 15 * B)\nProfit_C = 60 * C - (25 * C + 12 * C)\nProfit_D = 80 * D - (40 * D + 20 * D)\nProfit_E = 90 * E - (50 * E + 25 * E)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints.\n// {\"production rate of component 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 4\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 5\": \"P5\", \"range\": \"0 <= P5 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. The profit per unit for component 1 is 5 - 0.01 * P1, for component 2 is 7 - 0.02 * P2, for component 3 is 6 - 0.015 * P3, for component 4 is 8 - 0.025 * P4, and for component 5 is 9 - 0.03 * P5. The objective is to maximize the total profit from all components.\n// The objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\n\n## Generate Constraint-1:\nThe total production capacity of the plant is limited to 400 units per day.\n// P1 + P2 + P3 + P4 + P5 <= 400\n\n## Generate Constraint-2:\nThe market demand for each component must be met. The demand for component 1 is at least 50 units, for component 2 is at least 70 units, for component 3 is at least 60 units, for component 4 is at least 80 units, and for component 5 is at least 90 units.\n// P1 >= 50; P2 >= 70; P3 >= 60; P4 >= 80; P5 >= 90",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints. Each component has a different profit margin and production cost. The profit per unit for component 1 is 5 - 0.01 * P1, for component 2 is 7 - 0.02 * P2, for component 3 is 6 - 0.015 * P3, for component 4 is 8 - 0.025 * P4, and for component 5 is 9 - 0.03 * P5. The total production capacity of the plant is limited to 400 units per day. The market demand for each component must be met, with the demand for component 1 being at least 50 units, for component 2 at least 70 units, for component 3 at least 60 units, for component 4 at least 80 units, and for component 5 at least 90 units. Please help the plant manager to maximize the total profit from all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=50, ub=100) # production rate of component 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=70, ub=100) # production rate of component 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=60, ub=100) # production rate of component 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=80, ub=100) # production rate of component 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=90, ub=100) # production rate of component 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (5 - 0.01 * P1) * P1\nProfit_P2 = (7 - 0.02 * P2) * P2\nProfit_P3 = (6 - 0.015 * P3) * P3\nProfit_P4 = (8 - 0.025 * P4) * P4\nProfit_P5 = (9 - 0.03 * P5) * P5\n## the objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3 + Profit_P4 + Profit_P5)\n\n# Add constraints\n## The total production capacity of the plant is limited to 400 units per day.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Component 1: \", model.getVal(P1))\n    print(\"Production Rate of Component 2: \", model.getVal(P2))\n    print(\"Production Rate of Component 3: \", model.getVal(P3))\n    print(\"Production Rate of Component 4: \", model.getVal(P4))\n    print(\"Production Rate of Component 5: \", model.getVal(P5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of cargo containers: Small, Medium, and Large. They need to determine the number of each type of container to maximize their profit while considering various constraints such as storage space, handling costs, and market demand.\n// {\"number of Small containers\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium containers\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large containers\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Small container is $500, per Medium container is $1000, and per Large container is $1500. Due to economies of scale, the profit per container increases by $1 for every 10 containers produced beyond the first 50 for each type. The company aims to maximize the total profit from selling these containers.\n// Profit_Small = max(500 + 0.1 * (Small - 50), 500) * Small\n// Profit_Medium = max(1000 + 0.1 * (Medium - 50), 1000) * Medium\n// Profit_Large = max(1500 + 0.1 * (Large - 50), 1500) * Large\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large\n\n## Generate Constraint-1:\nThe company has a limited storage space of 1000 square meters. Each Small container requires 5 square meters, each Medium container requires 10 square meters, and each Large container requires 15 square meters.\n// 5 * Small + 10 * Medium + 15 * Large <= 1000\n\n## Generate Constraint-2:\nThe handling cost for each Small container is $100, for each Medium container is $200, and for each Large container is $300. The company has a budget of $15000 for handling costs.\n// 100 * Small + 200 * Medium + 300 * Large <= 15000\n\n## Generate Constraint-3:\nThe market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units.\n// Small <= 200; Medium <= 150; Large <= 100\n\n## Generate Constraint-4:\nThe company aims to ensure a balanced distribution of containers. The number of Large containers should not exceed half the combined number of Small and Medium containers.\n// Large <= 0.5 * (Small + Medium)\n\n## Generate Constraint-5:\nThe company has a minimum order requirement from a key client for at least 30 Medium containers and 20 Large containers.\n// Medium >= 30; Large >= 20",
        "question": "A logistics company is managing the distribution of three types of cargo containers: Small, Medium, and Large. They need to determine the number of each type of container to maximize their profit while considering various constraints such as storage space, handling costs, and market demand. The profit per Small container is $500, per Medium container is $1000, and per Large container is $1500. Due to economies of scale, the profit per container increases by $1 for every 10 containers produced beyond the first 50 for each type. The company has a limited storage space of 1000 square meters. Each Small container requires 5 square meters, each Medium container requires 10 square meters, and each Large container requires 15 square meters. The handling cost for each Small container is $100, for each Medium container is $200, and for each Large container is $300. The company has a budget of $15000 for handling costs. The market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units. The company aims to ensure a balanced distribution of containers. The number of Large containers should not exceed half the combined number of Small and Medium containers. The company has a minimum order requirement from a key client for at least 30 Medium containers and 20 Large containers. Please help the company to maximize the total profit from selling these containers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units.\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0, ub=200) # number of Small containers\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0, ub=150) # number of Medium containers\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0, ub=100) # number of Large containers\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Small = max(500 + 0.1 * (Small - 50), 500) * Small\nSmall1 = model.addVar(vtype=\"INTEGER\", name=\"Small1\", lb=0, ub=50)\nSmall2 = model.addVar(vtype=\"INTEGER\", name=\"Small2\", lb=50, ub=200)\nSmall_b1 = model.addVar(vtype=\"B\", name=\"Small_b1\")\nSmall_b2 = model.addVar(vtype=\"B\", name=\"Small_b2\")\nmodel.addCons(Small_b1 + Small_b2 == 1)\nmodel.addCons(Small == Small1*Small_b1 + Small2*Small_b2)\nProfit_Small = 500 * Small1 * Small_b1 + (500 + 0.1 * (Small2 - 50)) * Small2 * Small_b2\n## create piecewise variables for piecewise function: Profit_Medium = max(1000 + 0.1 * (Medium - 50), 1000) * Medium\nMedium1 = model.addVar(vtype=\"INTEGER\", name=\"Medium1\", lb=0, ub=50)\nMedium2 = model.addVar(vtype=\"INTEGER\", name=\"Medium2\", lb=50, ub=150)\nMedium_b1 = model.addVar(vtype=\"B\", name=\"Medium_b1\")\nMedium_b2 = model.addVar(vtype=\"B\", name=\"Medium_b2\")\nmodel.addCons(Medium_b1 + Medium_b2 == 1)\nmodel.addCons(Medium == Medium1*Medium_b1 + Medium2*Medium_b2)\nProfit_Medium = 1000 * Medium1 * Medium_b1 + (1000 + 0.1 * (Medium2 - 50)) * Medium2 * Medium_b2\n## create piecewise variables for piecewise function: Profit_Large = max(1500 + 0.1 * (Large - 50), 1500) * Large\nLarge1 = model.addVar(vtype=\"INTEGER\", name=\"Large1\", lb=0, ub=50)\nLarge2 = model.addVar(vtype=\"INTEGER\", name=\"Large2\", lb=50, ub=100)\nLarge_b1 = model.addVar(vtype=\"B\", name=\"Large_b1\")\nLarge_b2 = model.addVar(vtype=\"B\", name=\"Large_b2\")\nmodel.addCons(Large_b1 + Large_b2 == 1)\nmodel.addCons(Large == Large1*Large_b1 + Large2*Large_b2)\nProfit_Large = 1500 * Large1 * Large_b1 + (1500 + 0.1 * (Large2 - 50)) * Large2 * Large_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n## The company has a limited storage space of 1000 square meters.\nmodel.addCons(5 * Small + 10 * Medium + 15 * Large <= 1000)\n## The handling cost for each Small container is $100, for each Medium container is $200, and for each Large container is $300.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large <= 15000)\n## The number of Large containers should not exceed half the combined number of Small and Medium containers.\nmodel.addCons(Large <= 0.5 * (Small + Medium))\n## The company has a minimum order requirement from a key client for at least 30 Medium containers and 20 Large containers.\nmodel.addCons(Medium >= 30)\nmodel.addCons(Large >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small containers: \", model.getVal(Small))\n    print(\"Number of Medium containers: \", model.getVal(Medium))\n    print(\"Number of Large containers: \", model.getVal(Large))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1452,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A has a fuel efficiency of 10 km/l and a cargo capacity of 5 tons.\n- Truck B has a fuel efficiency of 15 km/l and a cargo capacity of 7 tons.\n- Truck C has a fuel efficiency of 20 km/l and a cargo capacity of 9 tons.\n- Truck D has a fuel efficiency of 25 km/l and a cargo capacity of 11 tons.\n- Truck E has a fuel efficiency of 30 km/l and a cargo capacity of 13 tons.\nThe company aims to maximize the total cargo capacity while minimizing the total fuel consumption. The objective is to maximize the ratio of total cargo capacity to total fuel consumption.\n// Total cargo capacity: Cap = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// Total fuel consumption: Fuel = (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / 1000 (converted to 1000 liters to simplify the ratio)\n// So, the objective function is: Maximize (Cap) / (Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for truck deployment. The cost of each truck type is as follows: A = $50,000, B = $60,000, C = $70,000, D = $80,000, E = $90,000.\n// 50000 * A + 60000 * B + 70000 * C + 80000 * D + 90000 * E <= 500000\n\n## Generate Constraint-2:\nThe company must deploy at least 5 trucks of each type.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks deployed must not exceed 20.\n// A + B + C + D + E <= 20\n\n## Generate Constraint-4:\nThe total cargo capacity must be at least 100 tons.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E >= 100\n\n## Generate Constraint-5:\nThe total fuel consumption must not exceed 2000 liters.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. Each type of truck has a different fuel efficiency and cargo capacity:\n- Truck A has a fuel efficiency of 10 km/l and a cargo capacity of 5 tons.\n- Truck B has a fuel efficiency of 15 km/l and a cargo capacity of 7 tons.\n- Truck C has a fuel efficiency of 20 km/l and a cargo capacity of 9 tons.\n- Truck D has a fuel efficiency of 25 km/l and a cargo capacity of 11 tons.\n- Truck E has a fuel efficiency of 30 km/l and a cargo capacity of 13 tons.\nThe company has a budget of $500,000 for truck deployment. The cost of each truck type is as follows: A = $50,000, B = $60,000, C = $70,000, D = $80,000, E = $90,000. The company must deploy at least 5 trucks of each type. The total number of trucks deployed must not exceed 20. The total cargo capacity must be at least 100 tons. The total fuel consumption must not exceed 2000 liters.\nPlease help the company to maximize the ratio of total cargo capacity to total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCap = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\nFuel = (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / 1000\n## the objective function is: Maximize (Cap) / (Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Cap)\n\n# Add constraints\n## The company has a budget of $500,000 for truck deployment.\nmodel.addCons(50000 * A + 60000 * B + 70000 * C + 80000 * D + 90000 * E <= 500000)\n## The total number of trucks deployed must not exceed 20.\nmodel.addCons(A + B + C + D + E <= 20)\n## The total cargo capacity must be at least 100 tons.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E >= 100)\n## The total fuel consumption must not exceed 2000 liters.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Fuel Consumption Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The regions are RegionA, RegionB, RegionC, and RegionD.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck varies by region due to terrain and distance. For RegionA, the fuel efficiency is 5 km/liter, and the maintenance cost per truck is $1000 per month. For RegionB, the fuel efficiency is 6 km/liter, and the maintenance cost per truck is $1200 per month. For RegionC, the fuel efficiency is 4 km/liter, and the maintenance cost per truck is $800 per month. For RegionD, the fuel efficiency is 7 km/liter, and the maintenance cost per truck is $1500 per month. The company wants to minimize the total cost (fuel and maintenance) per kilometer traveled.\n// FuelCostA = (1/5) * TrucksA * DistanceA\n// FuelCostB = (1/6) * TrucksB * DistanceB\n// FuelCostC = (1/4) * TrucksC * DistanceC\n// FuelCostD = (1/7) * TrucksD * DistanceD\n// MaintenanceCost = 1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + 1500 * TrucksD\n// TotalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\n// So, the objective function is: Minimize (TotalCost / (DistanceA * TrucksA + DistanceB * TrucksB + DistanceC * TrucksC + DistanceD * TrucksD))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to contractual obligations, RegionA must have at least 10 trucks.\n// TrucksA >= 10\n\n## Generate Constraint-3:\nThe total distance traveled by all trucks must not exceed 10,000 kilometers per month.\n// DistanceA * TrucksA + DistanceB * TrucksB + DistanceC * TrucksC + DistanceD * TrucksD <= 10000\n\n## Generate Constraint-4:\nThe company has a budget of $50,000 for total maintenance costs per month.\n// 1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + 1500 * TrucksD <= 50000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: RegionA, RegionB, RegionC, and RegionD. The company needs to determine the optimal number of trucks to allocate to each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel efficiency of each truck varies by region due to terrain and distance. For RegionA, the fuel efficiency is 5 km/liter, and the maintenance cost per truck is $1000 per month. For RegionB, the fuel efficiency is 6 km/liter, and the maintenance cost per truck is $1200 per month. For RegionC, the fuel efficiency is 4 km/liter, and the maintenance cost per truck is $800 per month. For RegionD, the fuel efficiency is 7 km/liter, and the maintenance cost per truck is $1500 per month. The company wants to minimize the total cost (fuel and maintenance) per kilometer traveled. The company has a total of 50 trucks available. Due to contractual obligations, RegionA must have at least 10 trucks. The total distance traveled by all trucks must not exceed 10,000 kilometers per month. The company has a budget of $50,000 for total maintenance costs per month. Please help the company to minimize the total cost per kilometer traveled.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostA = (1/5) * TrucksA\nFuelCostB = (1/6) * TrucksB\nFuelCostC = (1/4) * TrucksC\nFuelCostD = (1/7) * TrucksD\nMaintenanceCost = 1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + 1500 * TrucksD\nTotalCost = FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCost\nDistance = TrucksA + TrucksB + TrucksC + TrucksD\n## the objective function is: Minimize (TotalCost / Distance)\n## convert the division to multiplication\nmodel.addCons(obj * Distance == TotalCost)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n## The total distance traveled by all trucks must not exceed 10,000 kilometers per month.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 10000)\n## The company has a budget of $50,000 for total maintenance costs per month.\nmodel.addCons(1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + 1500 * TrucksD <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1236,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone1\": \"Zone1\", \"range\": \"Zone1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone2\": \"Zone2\", \"range\": \"Zone2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone3\": \"Zone3\", \"range\": \"Zone3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone4\": \"Zone4\", \"range\": \"Zone4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone5\": \"Zone5\", \"range\": \"Zone5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone1 is 80%, with a cost of $100 per panel.\nIn Zone2, the efficiency is 85%, with a cost of $120 per panel.\nIn Zone3, the efficiency is 90%, with a cost of $140 per panel.\nIn Zone4, the efficiency is 95%, with a cost of $160 per panel.\nIn Zone5, the efficiency is 100%, with a cost of $180 per panel.\nThe city aims to maximize the energy production per dollar spent.\n// Energy_Production = 80% * Zone1 * 100 + 85% * Zone2 * 120 + 90% * Zone3 * 140 + 95% * Zone4 * 160 + 100% * Zone5 * 180\n// Total_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n// So, the objective function is: Maximize Energy_Production / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs.\nThe efficiency of solar panels in Zone1 is 80%, with a cost of $100 per panel.\nIn Zone2, the efficiency is 85%, with a cost of $120 per panel.\nIn Zone3, the efficiency is 90%, with a cost of $140 per panel.\nIn Zone4, the efficiency is 95%, with a cost of $160 per panel.\nIn Zone5, the efficiency is 100%, with a cost of $180 per panel.\nThe city has a budget of $100,000 for the installation of solar panels.\nPlease help the city to maximize the energy production per dollar spent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZone1 = model.addVar(vtype=\"INTEGER\", name=\"Zone1\", lb=0) # number of solar panels in Zone1\nZone2 = model.addVar(vtype=\"INTEGER\", name=\"Zone2\", lb=0) # number of solar panels in Zone2\nZone3 = model.addVar(vtype=\"INTEGER\", name=\"Zone3\", lb=0) # number of solar panels in Zone3\nZone4 = model.addVar(vtype=\"INTEGER\", name=\"Zone4\", lb=0) # number of solar panels in Zone4\nZone5 = model.addVar(vtype=\"INTEGER\", name=\"Zone5\", lb=0) # number of solar panels in Zone5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Production = 0.8 * Zone1 * 100 + 0.85 * Zone2 * 120 + 0.9 * Zone3 * 140 + 0.95 * Zone4 * 160 + 1 * Zone5 * 180\nTotal_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n## the objective function is: Maximize Energy_Production / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Energy_Production)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone1: \", model.getVal(Zone1))\n    print(\"Number of Solar Panels in Zone2: \", model.getVal(Zone2))\n    print(\"Number of Solar Panels in Zone3: \", model.getVal(Zone3))\n    print(\"Number of Solar Panels in Zone4: \", model.getVal(Zone4))\n    print(\"Number of Solar Panels in Zone5: \", model.getVal(Zone5))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 648,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows five types of crops: A, B, C, D, and E. The farmer needs to decide how much land to allocate to each crop to maximize the overall yield per unit of land.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per unit of land for each crop is as follows: Crop A yields 5 tons/hectare, Crop B yields 7 tons/hectare, Crop C yields 9 tons/hectare, Crop D yields 11 tons/hectare, and Crop E yields 13 tons/hectare. The farmer aims to maximize the total yield per unit of land used (which is defined as the sum of the yields of all crops divided by the total land used).\n// Yield of A: Yield_A = 5 * A\n// Yield of B: Yield_B = 7 * B\n// Yield of C: Yield_C = 9 * C\n// Yield of D: Yield_D = 11 * D\n// Yield of E: Yield_E = 13 * E\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C + Yield_D + Yield_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares of land available.\n// A + B + C + D + E <= 100",
        "question": "A farmer grows five types of crops: A, B, C, D, and E. The farmer needs to decide how much land to allocate to each crop to maximize the overall yield per unit of land. The yield per unit of land for each crop is as follows: Crop A yields 5 tons/hectare, Crop B yields 7 tons/hectare, Crop C yields 9 tons/hectare, Crop D yields 11 tons/hectare, and Crop E yields 13 tons/hectare. The farmer has a total of 100 hectares of land available. Please help the farmer to maximize the total yield per unit of land used (which is defined as the sum of the yields of all crops divided by the total land used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # land allocated to crop D\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # land allocated to crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nYield_D = 11 * D\nYield_E = 13 * E\nTotalLand = A + B + C + D + E\n## the objective function is: Maximize (Yield_A + Yield_B + Yield_C + Yield_D + Yield_E) / TotalLand\n## convert the division to multiplication\nmodel.addCons(obj * TotalLand == Yield_A + Yield_B + Yield_C + Yield_D + Yield_E)\n\n# Add constraints\n## The farmer has a total of 100 hectares of land available.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Land allocated to Crop D: \", model.getVal(D))\n    print(\"Land allocated to Crop E: \", model.getVal(E))\n    print(\"Maximized Yield per Unit of Land: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 600,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for each truck\": \"Upgrade\", \"range\": \"Upgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company aims to minimize the total operational cost of all trips.\n// Operational cost per trip to Region1: Cost1 = (10 - 0.001 * Upgrade) * Trips1\n// Operational cost per trip to Region2: Cost2 = (10 - 0.001 * Upgrade) * Trips2\n// Operational cost per trip to Region3: Cost3 = (10 - 0.001 * Upgrade) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\n// Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip. The fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company aims to minimize the total operational cost of all trips. The company has a budget of $100,000 for fuel-efficient upgrades and operational costs. The total number of trips across all regions must not exceed 500. Please help the company determine the optimal number of trips to each region and the investment in fuel-efficient upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to Region3\nUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade\", lb=0) # investment in fuel-efficient upgrades\n\n# Define objective function\nCost1 = (10 - 0.001 * Upgrade) * Trips1\nCost2 = (10 - 0.001 * Upgrade) * Trips2\nCost3 = (10 - 0.001 * Upgrade) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\nmodel.addCons(Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Investment in fuel-efficient upgrades: \", model.getVal(Upgrade))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck is $100,000, the fuel cost per truck is $20,000, and the maintenance cost per truck is $10,000. \nFor T2, the revenue per truck is $120,000, the fuel cost per truck is $25,000, and the maintenance cost per truck is $12,000. \nFor T3, the revenue per truck is $150,000, the fuel cost per truck is $30,000, and the maintenance cost per truck is $15,000.\nFor T4, the revenue per truck is $180,000, the fuel cost per truck is $35,000, and the maintenance cost per truck is $18,000.\nFor T5, the revenue per truck is $200,000, the fuel cost per truck is $40,000, and the maintenance cost per truck is $20,000.\nThe company wants to maximize the total net profit.\n// Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n// Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n// Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n// Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n// Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 100,000 * T1 + 120,000 * T2 + 150,000 * T3 + 180,000 * T4 + 200,000 * T5 <= 1,000,000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different revenue, fuel cost, and maintenance cost per truck. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints. The details for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|-------------------|---------------------|----------------------------|\n| T1         | $100,000          | $20,000             | $10,000                    |\n| T2         | $120,000          | $25,000             | $12,000                    |\n| T3         | $150,000          | $30,000             | $15,000                    |\n| T4         | $180,000          | $35,000             | $18,000                    |\n| T5         | $200,000          | $40,000             | $20,000                    |\n\nThe company has a total budget of $1,000,000 for purchasing trucks. The company wants to maximize the total net profit, which is calculated as the revenue per truck minus the fuel cost per truck and the maintenance cost per truck, for each type of truck.\n\nPlease help the company determine the optimal number of each type of truck to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n## Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n## Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n## Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n## Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\nProfit_T1 = (100000 - 20000 - 10000) * T1\nProfit_T2 = (120000 - 25000 - 12000) * T2\nProfit_T3 = (150000 - 30000 - 15000) * T3\nProfit_T4 = (180000 - 35000 - 18000) * T4\nProfit_T5 = (200000 - 40000 - 20000) * T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\n## The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption of the fleet by determining the optimal speed for each truck. Additionally, the company needs to decide on the number of trucks to deploy for each route.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"50 <= Speed_i <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks for route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function: Fuel_Consumption_i = a * (Speed_i^2) + b * Speed_i + c, where a, b, and c are constants. The company aims to minimize the total fuel consumption across all trucks.\n// Total fuel consumption: Fuel_Total = \u03a3 [a * (Speed_i^2) + b * Speed_i + c] * Trucks_j for all routes j\n// So, the objective function is: Minimize Fuel_Total\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel costs.\n// \u03a3 [(a * (Speed_i^2) + b * Speed_i + c) * Trucks_j] <= 100,000 for all routes j\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// \u03a3 Trucks_j <= 50 for all routes j\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks on route X must not exceed 80 km/h.\n// Speed_i <= 80 for trucks on route X\n\n## Generate Constraint-4:\nThe demand for goods on route Y requires at least 10 trucks to be deployed.\n// Trucks_j >= 10 for route Y",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The fuel consumption of each truck is modeled by a nonlinear function: Fuel_Consumption_i = a * (Speed_i^2) + b * Speed_i + c, where a, b, and c are constants. The company aims to minimize the total fuel consumption across all trucks. The company has a total budget of $100,000 for fuel costs. The total number of trucks available is limited to 50. Due to safety regulations, the speed of trucks on route X must not exceed 80 km/h. The demand for goods on route Y requires at least 10 trucks to be deployed. Please help the company to determine the optimal speed for each truck and the number of trucks to deploy for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of truck i\nSpeed_i = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_i\", lb=50, ub=100)\n## Number of trucks for route j\nTrucks_j = model.addVar(vtype=\"INTEGER\", name=\"Trucks_j\", lb=0)\n\n# Define objective function\n## Fuel consumption of each truck\na = 0.01  # example constants\nb = 0.5\nc = 10\nFuel_Consumption_i = a * (Speed_i**2) + b * Speed_i + c\n## Total fuel consumption\nFuel_Total = Fuel_Consumption_i * Trucks_j\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Total)\n\n# Add constraints\n## Total budget for fuel costs\nmodel.addCons(Fuel_Total <= 100000)\n## Total number of trucks available\nmodel.addCons(Trucks_j <= 50)\n## Speed limit for trucks on route X\nmodel.addCons(Speed_i <= 80)\n## Minimum number of trucks required for route Y\nmodel.addCons(Trucks_j >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Optimal Speed of Trucks: \", model.getVal(Speed_i))\n    print(\"Number of Trucks Deployed: \", model.getVal(Trucks_j))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 2,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100 - 0.01 * TechA, for ProductB is $150 - 0.01 * TechB, and for ProductC is $200 - 0.01 * TechC. The revenue per unit of ProductA is $120, for ProductB is $180, and for ProductC is $240. The company aims to maximize the total profit from all products.\n// ProfitA = (120 - (100 - 0.01 * TechA)) * QA\n// ProfitB = (180 - (150 - 0.01 * TechB)) * QB\n// ProfitC = (240 - (200 - 0.01 * TechC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe total investment in technology cannot exceed $50,000.\n// TechA + TechB + TechC <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product. The production cost per unit, revenue per unit, and the effect of technology investment on production cost for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit | Effect of Tech Investment on Cost |\n|---------|--------------------------|------------------|----------------------------------|\n| ProductA | $100 - 0.01 * TechA      | $120             | -0.01 * TechA                    |\n| ProductB | $150 - 0.01 * TechB      | $180             | -0.01 * TechB                    |\n| ProductC | $200 - 0.01 * TechC      | $240             | -0.01 * TechC                    |\n\nThe company aims to maximize the total profit from all products. The total resources available for production are limited to 1000 units. The total investment in technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n\nPlease help the company to determine the optimal production quantities and resource allocations to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30) # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # resources allocated to ProductC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0) # investment in technology for ProductA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0) # investment in technology for ProductB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0) # investment in technology for ProductC\n\n# Define objective function\nProfitA = (120 - (100 - 0.01 * TechA)) * QA\nProfitB = (180 - (150 - 0.01 * TechB)) * QB\nProfitC = (240 - (200 - 0.01 * TechC)) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total resources available for production are limited to 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n# The total investment in technology cannot exceed $50,000.\nmodel.addCons(TechA + TechB + TechC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1423,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions.\n// Net profit for Region A: Profit_A = (1.5 - 0.5) * Trucks_A\n// Net profit for Region B: Profit_B = (1.6 - 0.6) * Trucks_B\n// Net profit for Region C: Profit_C = (1.7 - 0.7) * Trucks_C\n// Net profit for Region D: Profit_D = (1.8 - 0.8) * Trucks_D\n// Net profit for Region E: Profit_E = (1.9 - 0.9) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, Region A must have at least 10% of the total trucks.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for operational costs per month.\n// 0.5 * Trucks_A + 0.6 * Trucks_B + 0.7 * Trucks_C + 0.8 * Trucks_D + 0.9 * Trucks_E <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each region has at least one truck.\n// Trucks_A >= 1; Trucks_B >= 1; Trucks_C >= 1; Trucks_D >= 1; Trucks_E >= 1\n\n## Generate Constraint-5:\nThe total distance covered by all trucks should not exceed 10,000 kilometers per month.\n// (1.5 * Trucks_A) + (1.6 * Trucks_B) + (1.7 * Trucks_C) + (1.8 * Trucks_D) + (1.9 * Trucks_E) <= 10,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs. The cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions.\n\nThe company has a total of 50 trucks available for allocation. Due to regional regulations, Region A must have at least 10% of the total trucks. The company has a budget of $30,000 for operational costs per month. The company wants to ensure that each region has at least one truck. The total distance covered by all trucks should not exceed 10,000 kilometers per month.\n\nPlease help the company to maximize the net profit per kilometer across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=1)  # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=1)  # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=1)  # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=1)  # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=1)  # number of trucks for Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1.5 - 0.5) * Trucks_A\nProfit_B = (1.6 - 0.6) * Trucks_B\nProfit_C = (1.7 - 0.7) * Trucks_C\nProfit_D = (1.8 - 0.8) * Trucks_D\nProfit_E = (1.9 - 0.9) * Trucks_E\nTotal_Trucks = Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Total_Trucks\n## convert the division to multiplication\nmodel.addCons(obj * Total_Trucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n## Due to regional regulations, Region A must have at least 10% of the total trucks.\nmodel.addCons(Trucks_A >= 0.1 * Total_Trucks)\n## The company has a budget of $30,000 for operational costs per month.\nmodel.addCons(0.5 * Trucks_A + 0.6 * Trucks_B + 0.7 * Trucks_C + 0.8 * Trucks_D + 0.9 * Trucks_E <= 30000)\n## The total distance covered by all trucks should not exceed 10,000 kilometers per month.\nmodel.addCons(1.5 * Trucks_A + 1.6 * Trucks_B + 1.7 * Trucks_C + 1.8 * Trucks_D + 1.9 * Trucks_E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Phone, Tablet, Laptop, Smartwatch, and Camera. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatch\": \"Smartwatch\", \"range\": \"Smartwatch >= 0\", \"type\": \"integer\"}\n// {\"quantity of Camera\": \"Camera\", \"range\": \"Camera >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each device is as follows: Phone $50, Tablet $70, Laptop $100, Smartwatch $30, and Camera $60. Due to economies of scale, the profit per unit increases by $0.10 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Phone = max(50 + 0.10 * (Phone - 100), 50) * Phone\n// Profit_Tablet = max(70 + 0.10 * (Tablet - 100), 70) * Tablet\n// Profit_Laptop = max(100 + 0.10 * (Laptop - 100), 100) * Laptop\n// Profit_Smartwatch = max(30 + 0.10 * (Smartwatch - 100), 30) * Smartwatch\n// Profit_Camera = max(60 + 0.10 * (Camera - 100), 60) * Camera\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for each device is: Phone $20, Tablet $30, Laptop $50, Smartwatch $15, and Camera $30.\n// 20 * Phone + 30 * Tablet + 50 * Laptop + 15 * Smartwatch + 30 * Camera <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 300 units in total.\n// Phone + Tablet + Laptop + Smartwatch + Camera <= 300\n\n## Generate Constraint-3:\nThe market demand for each device type is limited. The demand for Phone is 150 units, Tablet is 200 units, Laptop is 100 units, Smartwatch is 50 units, and Camera is 80 units.\n// Phone <= 150; Tablet <= 200; Laptop <= 100; Smartwatch <= 50; Camera <= 80",
        "question": "A manufacturing company produces five types of electronic devices: Phone, Tablet, Laptop, Smartwatch, and Camera. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows: Phone $50, Tablet $70, Laptop $100, Smartwatch $30, and Camera $60. Due to economies of scale, the profit per unit increases by $0.10 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n\n| Device     | Profit per Unit | Cost per Unit | Market Demand |\n|------------|-----------------|---------------|---------------|\n| Phone      | 50$             | 20$           | 150 units     |\n| Tablet     | 70$             | 30$           | 200 units     |\n| Laptop     | 100$            | 50$           | 100 units     |\n| Smartwatch | 30$             | 15$           | 50 units      |\n| Camera     | 60$             | 30$           | 80 units      |\n\nThe company has a budget of $10,000 for production costs. The company has a limited production capacity of 300 units in total. The market demand for each device type is limited as shown in the table. Please help the company to maximize the total profit from the sales of these devices while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0)\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0)\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0)\nSmartwatch = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch\", lb=0)\nCamera = model.addVar(vtype=\"INTEGER\", name=\"Camera\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(50 + 0.10 * (Phone - 100), 50) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=150)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 50 * Phone1 * Phone_b1 + (50 + 0.10 * (Phone2 - 100)) * Phone2 * Phone_b2\n\n## create piecewise variables for piecewise function: Profit_Tablet = max(70 + 0.10 * (Tablet - 100), 70) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=200)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 70 * Tablet1 * Tablet_b1 + (70 + 0.10 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n\n## create piecewise variables for piecewise function: Profit_Laptop = max(100 + 0.10 * (Laptop - 100), 100) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=100)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 100 * Laptop1 * Laptop_b1 + (100 + 0.10 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n\n## create piecewise variables for piecewise function: Profit_Smartwatch = max(30 + 0.10 * (Smartwatch - 100), 30) * Smartwatch\nSmartwatch1 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch1\", lb=0, ub=100)\nSmartwatch2 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatch2\", lb=100, ub=50)\nSmartwatch_b1 = model.addVar(vtype=\"B\", name=\"Smartwatch_b1\")\nSmartwatch_b2 = model.addVar(vtype=\"B\", name=\"Smartwatch_b2\")\nmodel.addCons(Smartwatch_b1 + Smartwatch_b2 == 1)\nmodel.addCons(Smartwatch == Smartwatch1*Smartwatch_b1 + Smartwatch2*Smartwatch_b2)\nProfit_Smartwatch = 30 * Smartwatch1 * Smartwatch_b1 + (30 + 0.10 * (Smartwatch2 - 100)) * Smartwatch2 * Smartwatch_b2\n\n## create piecewise variables for piecewise function: Profit_Camera = max(60 + 0.10 * (Camera - 100), 60) * Camera\nCamera1 = model.addVar(vtype=\"INTEGER\", name=\"Camera1\", lb=0, ub=100)\nCamera2 = model.addVar(vtype=\"INTEGER\", name=\"Camera2\", lb=100, ub=80)\nCamera_b1 = model.addVar(vtype=\"B\", name=\"Camera_b1\")\nCamera_b2 = model.addVar(vtype=\"B\", name=\"Camera_b2\")\nmodel.addCons(Camera_b1 + Camera_b2 == 1)\nmodel.addCons(Camera == Camera1*Camera_b1 + Camera2*Camera_b2)\nProfit_Camera = 60 * Camera1 * Camera_b1 + (60 + 0.10 * (Camera2 - 100)) * Camera2 * Camera_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Laptop + Profit_Smartwatch + Profit_Camera)\n\n# Add constraints\nmodel.addCons(20 * Phone + 30 * Tablet + 50 * Laptop + 15 * Smartwatch + 30 * Camera <= 10000)\nmodel.addCons(Phone + Tablet + Laptop + Smartwatch + Camera <= 300)\nmodel.addCons(Phone <= 150)\nmodel.addCons(Tablet <= 200)\nmodel.addCons(Laptop <= 100)\nmodel.addCons(Smartwatch <= 50)\nmodel.addCons(Camera <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Quantity of Smartwatch: \", model.getVal(Smartwatch))\n    print(\"Quantity of Camera: \", model.getVal(Camera))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1364,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate.\n// {\"number of trips for RouteX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for RouteX: ConsumptionX = 50 - 0.005 * TechX * TripsX\n// Fuel consumption for RouteY: ConsumptionY = 60 - 0.006 * TechY * TripsY\n// Fuel consumption for RouteZ: ConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operations and technology investments.\n// 50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate. The fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $100,000 for operations and technology investments. Please help the company to determine the optimal number of trips and the appropriate investment in fuel-efficient technologies for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=0)  # number of trips for RouteX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=0)  # number of trips for RouteY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0)  # number of trips for RouteZ\nTechX = model.addVar(name=\"TechX\", lb=0)  # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(name=\"TechY\", lb=0)  # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumptionX = 50 - 0.005 * TechX * TripsX\nConsumptionY = 60 - 0.006 * TechY * TripsY\nConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n## the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\n## The company has a total budget of $100,000 for operations and technology investments.\nmodel.addCons(50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for RouteX: \", model.getVal(TripsX))\n    print(\"Number of Trips for RouteY: \", model.getVal(TripsY))\n    print(\"Number of Trips for RouteZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across 6 different production lines. Each production line requires a specific number of workers and machines to operate efficiently.\n// {\"number of workers on production line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 6\": \"W6\", \"range\": \"W6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate based on the number of workers and machines. The efficiency is modeled as a nonlinear function where increasing the number of workers initially increases efficiency but then decreases it due to overcrowding. The efficiency function for each line is given by:\nEfficiency = (100 * (Wi / (Wi + Mi))^2) / (1 + 0.01 * Wi^2)\nwhere Wi is the number of workers on line i and Mi is the number of machines on line i. The plant aims to maximize the total efficiency of all production lines.\n// The objective function is: Maximize \u03a3(100 * (Wi / (Wi + Mi))^2) / (1 + 0.01 * Wi^2) for i = 1 to 6\n\n## Generate Constraint-1:\nThe total number of workers available in the plant is 100.\n// W1 + W2 + W3 + W4 + W5 + W6 <= 100\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20; W4 <= 20; W5 <= 20; W6 <= 20",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across 6 different production lines. Each production line requires a specific number of workers and machines to operate efficiently. The efficiency of each production line is modeled as a nonlinear function where increasing the number of workers initially increases efficiency but then decreases it due to overcrowding. The efficiency function for each line is given by: Efficiency = (100 * (Wi / (Wi + Mi))^2) / (1 + 0.01 * Wi^2), where Wi is the number of workers on line i and Mi is the number of machines on line i. The plant aims to maximize the total efficiency of all production lines.\nThe total number of workers available in the plant is 100. Each production line can accommodate a maximum of 20 workers.\nPlease help the plant to determine the optimal number of workers for each production line to maximize the total efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=20)  # number of workers on production line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0, ub=20)  # number of workers on production line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0, ub=20)  # number of workers on production line 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0, ub=20)  # number of workers on production line 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0, ub=20)  # number of workers on production line 5\nW6 = model.addVar(vtype=\"INTEGER\", name=\"W6\", lb=0, ub=20)  # number of workers on production line 6\n\n# Define objective function\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n# Calculate efficiency for each line\nEfficiency1 = (100 * (W1 / (W1 + 10))**2) / (1 + 0.01 * W1**2)\nEfficiency2 = (100 * (W2 / (W2 + 10))**2) / (1 + 0.01 * W2**2)\nEfficiency3 = (100 * (W3 / (W3 + 10))**2) / (1 + 0.01 * W3**2)\nEfficiency4 = (100 * (W4 / (W4 + 10))**2) / (1 + 0.01 * W4**2)\nEfficiency5 = (100 * (W5 / (W5 + 10))**2) / (1 + 0.01 * W5**2)\nEfficiency6 = (100 * (W6 / (W6 + 10))**2) / (1 + 0.01 * W6**2)\n\n# The objective function is: Maximize \u03a3(100 * (Wi / (Wi + Mi))^2) / (1 + 0.01 * Wi^2) for i = 1 to 6\nmodel.addCons(obj == Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 + Efficiency6)\n\n# Add constraints\n# The total number of workers available in the plant is 100.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 + W6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(W3))\n    print(\"Number of Workers on Production Line 4: \", model.getVal(W4))\n    print(\"Number of Workers on Production Line 5: \", model.getVal(W5))\n    print(\"Number of Workers on Production Line 6: \", model.getVal(W6))\n    print(\"Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce.\n// {\"quantity of Compact EV\": \"Compact\", \"range\": \"Compact >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sedan EV\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n// {\"quantity of SUV EV\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Compact, the profit per unit is $10,000, the production cost per unit is $20,000, and the environmental impact per unit is 10 points.\nFor Sedan, the profit per unit is $15,000, the production cost per unit is $25,000, and the environmental impact per unit is 15 points.\nFor SUV, the profit per unit is $20,000, the production cost per unit is $30,000, and the environmental impact per unit is 20 points.\nThe manufacturer wants to maximize the net profit while considering the environmental impact. The environmental impact is inversely proportional to the net profit, with a weight factor of 0.001.\n// Net_Profit_Compact = 10000 * Compact - 20000 * Compact\n// Net_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\n// Net_Profit_SUV = 20000 * SUV - 30000 * SUV\n// Environmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n// So, the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $1,000,000 for production costs.\n// 20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 50 units in terms of the number of units it can produce.\n// Compact + Sedan + SUV <= 50",
        "question": "A manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce. The profit per unit, production cost per unit, and environmental impact per unit for each EV type are given in the following Table.\n\n| EV Type | Profit per Unit | Production Cost per Unit | Environmental Impact per Unit |\n|---------|-----------------|--------------------------|-------------------------------|\n| Compact | $10,000         | $20,000                  | 10 points                     |\n| Sedan   | $15,000         | $25,000                  | 15 points                     |\n| SUV     | $20,000         | $30,000                  | 20 points                     |\n\nThe manufacturer has a limited production budget of $1,000,000 for production costs. The manufacturer has a production capacity of 50 units in terms of the number of units it can produce. The manufacturer wants to maximize the net profit while considering the environmental impact, which is inversely proportional to the net profit with a weight factor of 0.001.\n\nPlease help the manufacturer to determine the optimal quantities of Compact, Sedan, and SUV EVs to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCompact = model.addVar(vtype=\"INTEGER\", name=\"Compact\", lb=0) # quantity of Compact EV\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0) # quantity of Sedan EV\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # quantity of SUV EV\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_Compact = 10000 * Compact - 20000 * Compact\nNet_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\nNet_Profit_SUV = 20000 * SUV - 30000 * SUV\nEnvironmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n## the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n## convert the subtraction to addition\nmodel.addCons(obj == Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV + 0.001 * Environmental_Impact)\n\n# Add constraints\n## The manufacturer has a limited production budget of $1,000,000 for production costs.\nmodel.addCons(20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000)\n## The manufacturer has a production capacity of 50 units in terms of the number of units it can produce.\nmodel.addCons(Compact + Sedan + SUV <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Compact EV: \", model.getVal(Compact))\n    print(\"Quantity of Sedan EV: \", model.getVal(Sedan))\n    print(\"Quantity of SUV EV: \", model.getVal(SUV))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each production line operates. The efficiency of each production line varies, and the manufacturer aims to optimize the production schedule to maximize daily profit.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for product A\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours of operation for product B\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours of operation for product C\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per hour for product A is $100, product B is $120, and product C is $150. The manufacturer wants to maximize the total daily profit.\n// Profit_A = UnitsA * (50 - (100 * HoursA))\n// Profit_B = UnitsB * (70 - (120 * HoursB))\n// Profit_C = UnitsC * (60 - (150 * HoursC))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available production hours per day are 100 hours.\n// HoursA + HoursB + HoursC <= 100\n\n## Generate Constraint-2:\nThe total production capacity for all products is 150 units per day.\n// UnitsA + UnitsB + UnitsC <= 150\n\n## Generate Constraint-3:\nThe production rate for product A is 10 units per hour, product B is 8 units per hour, and product C is 12 units per hour.\n// UnitsA <= 10 * HoursA\n// UnitsB <= 8 * HoursB\n// UnitsC <= 12 * HoursC\n\n## Generate Constraint-4:\nThe manufacturer has a daily operational budget of $12000 for production costs.\n// 100 * HoursA + 120 * HoursB + 150 * HoursC <= 12000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each production line operates. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per hour for product A is $100, product B is $120, and product C is $150. The manufacturer wants to maximize the total daily profit. The total available production hours per day are 100 hours. The total production capacity for all products is 150 units per day. The production rate for product A is 10 units per hour, product B is 8 units per hour, and product C is 12 units per hour. The manufacturer has a daily operational budget of $12000 for production costs. Please help the manufacturer to optimize the production schedule to maximize daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours of operation for product A\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours of operation for product B\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours of operation for product C\n\n# Define objective function\nProfit_A = UnitsA * (50 - (100 * HoursA))\nProfit_B = UnitsB * (70 - (120 * HoursB))\nProfit_C = UnitsC * (60 - (150 * HoursC))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 100)  # total available production hours per day\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 150)  # total production capacity for all products\nmodel.addCons(UnitsA <= 10 * HoursA)  # production rate for product A\nmodel.addCons(UnitsB <= 8 * HoursB)  # production rate for product B\nmodel.addCons(UnitsC <= 12 * HoursC)  # production rate for product C\nmodel.addCons(100 * HoursA + 120 * HoursB + 150 * HoursC <= 12000)  # daily operational budget\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours of Operation for Product A: \", model.getVal(HoursA))\n    print(\"Hours of Operation for Product B: \", model.getVal(HoursB))\n    print(\"Hours of Operation for Product C: \", model.getVal(HoursC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for RouteX: CostX = (0.5 - 0.00005 * TechX) * TrucksX\n// Operational cost for RouteY: CostY = (0.6 - 0.00006 * TechY) * TrucksY\n// Operational cost for RouteZ: CostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\n// TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks across all routes must not exceed 200.\n// TrucksX + TrucksY + TrucksZ <= 200",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck. The operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks.\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks across all routes must not exceed 200.\n\nPlease help the company to determine the optimal number of trucks and the investment in fuel-efficient technologies to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0) # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0) # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0) # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nCostX = (0.5 - 0.00005 * TechX) * TrucksX\nCostY = (0.6 - 0.00006 * TechY) * TrucksY\nCostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000)\n# The total number of trucks across all routes must not exceed 200.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck at warehouse 1 incurs a cost of $50 per km and can travel 100 km per day.\nEach truck at warehouse 2 incurs a cost of $60 per km and can travel 90 km per day.\nEach truck at warehouse 3 incurs a cost of $70 per km and can travel 80 km per day.\nEach truck at warehouse 4 incurs a cost of $80 per km and can travel 70 km per day.\nEach truck at warehouse 5 incurs a cost of $90 per km and can travel 60 km per day.\nThe company needs to deliver at least 5000 km worth of goods per day. The objective is to minimize the total daily transportation cost.\n// Total daily cost: Cost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\n// Total daily distance: Distance = 100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe total daily distance must meet or exceed 5000 km.\n// 100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5 >= 5000\n\n## Generate Constraint-4:\nAt least 10 trucks must be allocated to warehouse 1.\n// T1 >= 10",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. Each truck at warehouse 1 incurs a cost of $50 per km and can travel 100 km per day. Each truck at warehouse 2 incurs a cost of $60 per km and can travel 90 km per day. Each truck at warehouse 3 incurs a cost of $70 per km and can travel 80 km per day. Each truck at warehouse 4 incurs a cost of $80 per km and can travel 70 km per day. Each truck at warehouse 5 incurs a cost of $90 per km and can travel 60 km per day. The company needs to deliver at least 5000 km worth of goods per day. The company has a total of 100 trucks available. Each warehouse can handle a maximum of 30 trucks. At least 10 trucks must be allocated to warehouse 1. Please help the company to minimize the total daily transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\nCost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100) # Total of 100 trucks available\nmodel.addCons(T1 <= 30) # Each warehouse can handle a maximum of 30 trucks\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\nmodel.addCons(100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5 >= 5000) # Total daily distance must meet or exceed 5000 km\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Truck A is $20, for Truck B is $30, and for Truck C is $40. The company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The objective function is to minimize the total operational cost, which is given by:\n// Operational cost of A: Cost_A = 20 * A\n// Operational cost of B: Cost_B = 30 * B\n// Operational cost of C: Cost_C = 40 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\n// Capacity of A: 100 * A\n// Capacity of B: 200 * B\n// Capacity of C: 300 * C\n// Constraint: 100 * A + 200 * B + 300 * C >= 5000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for purchasing new trucks.\n// Cost of A: 1000 * A\n// Cost of B: 2000 * B\n// Cost of C: 3000 * C\n// Constraint: 1000 * A + 2000 * B + 3000 * C <= 10000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 20 trucks in total.\n// Constraint: A + B + C <= 20",
        "question": "A logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations. The operational cost per kilometer and the capacity for each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per Kilometer | Capacity (cubic meters) |\n|------------|--------------------------------|-------------------------|\n| A          | $20                            | 100                     |\n| B          | $30                            | 200                     |\n| C          | $40                            | 300                     |\n\nThe company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters. The company has a budget constraint of $10,000 for purchasing new trucks. The company can only operate a maximum of 20 trucks in total.\n\nPlease help the company to minimize the total operational cost, which is given by the sum of the operational costs of all truck types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\nmodel.addCons(100 * A + 200 * B + 300 * C >= 5000)\n## The company has a budget constraint of $10,000 for purchasing new trucks.\nmodel.addCons(1000 * A + 2000 * B + 3000 * C <= 10000)\n## The company can only operate a maximum of 20 trucks in total.\nmodel.addCons(A + B + C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The production quantity for each product is a decision variable.\n// {\"production quantity for product A\": \"A_quantity\", \"range\": \"A_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B_quantity\", \"range\": \"B_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C_quantity\", \"range\": \"C_quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = A_quantity * 50\n// Profit_B = B_quantity * 70\n// Profit_C = C_quantity * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A_quantity + B_quantity + C_quantity <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\n// A_quantity >= 30\n// B_quantity >= 20\n\n## Generate Constraint-3:\nThe company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B.\n// C_quantity <= 2 * (A_quantity + B_quantity)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the sales of all three products. The total production capacity of the company is limited to 100 units per day. The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day. Additionally, the company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B.\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_quantity = model.addVar(vtype=\"INTEGER\", name=\"A_quantity\", lb=0) # production quantity for product A\nB_quantity = model.addVar(vtype=\"INTEGER\", name=\"B_quantity\", lb=0) # production quantity for product B\nC_quantity = model.addVar(vtype=\"INTEGER\", name=\"C_quantity\", lb=0) # production quantity for product C\n\n# Define objective function\nProfit_A = A_quantity * 50\nProfit_B = B_quantity * 70\nProfit_C = C_quantity * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A_quantity + B_quantity + C_quantity <= 100)\n# The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\nmodel.addCons(A_quantity >= 30)\nmodel.addCons(B_quantity >= 20)\n# The company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B.\nmodel.addCons(C_quantity <= 2 * (A_quantity + B_quantity))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A_quantity))\n    print(\"Production Quantity for Product B: \", model.getVal(B_quantity))\n    print(\"Production Quantity for Product C: \", model.getVal(C_quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 1 kg of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 kg of raw material. Product C yields a profit of $100 per unit, requiring 4 hours of labor and 3 kg of raw material. The company aims to maximize the total profit while considering the efficiency of resource usage (labor and raw material).\n// Profit_A = 50 * A\n// Profit_B = 70 * B\n// Profit_C = 100 * C\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// A + 2 * B + 3 * C <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 1000 labor hours available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are produced.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe production of product C should not exceed the combined production of products A and B.\n// C <= A + B\n\n## Generate Constraint-5:\nThe total production of all products should not exceed 200 units.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit. The profit per unit of product A is $50, requiring 2 hours of labor and 1 kg of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 kg of raw material. Product C yields a profit of $100 per unit, requiring 4 hours of labor and 3 kg of raw material. The company has a budget of $5000 for raw materials and a total of 1000 labor hours available. The company wants to ensure that at least 50 units of each product are produced. The production of product C should not exceed the combined production of products A and B. The total production of all products should not exceed 200 units. Please help the company to maximize the total profit while considering the efficiency of resource usage (labor and raw material), which is defined as the sum of the profits divided by the sum of the labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 5000)\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The production of product C should not exceed the combined production of products A and B.\nmodel.addCons(C <= A + B)\n## The total production of all products should not exceed 200 units.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five locations (A, B, C, D, E) suitable for these installations.\n// {\"number of solar panels at location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at locations A, B, and C is 15%, 18%, and 20% respectively. The cost per solar panel is $1000, $1200, and $1500 respectively.\nThe efficiency of wind turbines at locations D and E is 30% and 25% respectively. The cost per wind turbine is $5000 and $4500 respectively.\nThe company wants to minimize the total cost of installation while maximizing the total energy output.\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE\n// Total energy output: Output = 15% * 1000 * SolarA + 18% * 1200 * SolarB + 20% * 1500 * SolarC + 30% * 5000 * WindD + 25% * 4500 * WindE\n// So, the objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installations.\n// 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe company aims to generate at least 200,000 kWh of energy.\n// 15% * 1000 * SolarA + 18% * 1200 * SolarB + 20% * 1500 * SolarC + 30% * 5000 * WindD + 25% * 4500 * WindE >= 200000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels in total.\n// SolarA + SolarB + SolarC >= 50\n\n## Generate Constraint-4:\nThe number of wind turbines should not exceed 30.\n// WindD + WindE <= 30\n\n## Generate Constraint-5:\nNo more than 40% of the budget should be spent on wind turbines.\n// 5000 * WindD + 4500 * WindE <= 0.4 * 1000000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five locations (A, B, C, D, E). The efficiency and cost per unit for each type of installation are given in the following Table.\n\n| Location | Type       | Efficiency | Cost per Unit |\n|----------|------------|------------|---------------|\n| A        | Solar Panel| 15%        | $1000         |\n| B        | Solar Panel| 18%        | $1200         |\n| C        | Solar Panel| 20%        | $1500         |\n| D        | Wind Turbine| 30%        | $5000         |\n| E        | Wind Turbine| 25%        | $4500         |\n\nThe company has a budget of $1,000,000 for the installations. The company aims to generate at least 200,000 kWh of energy. The company must install at least 50 solar panels in total. The number of wind turbines should not exceed 30. No more than 40% of the budget should be spent on wind turbines.\n\nPlease help the company to minimize the total cost of installation while maximizing the total energy output, defined as the ratio of the total cost to the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at location E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE\nOutput = 0.15 * 1000 * SolarA + 0.18 * 1200 * SolarB + 0.20 * 1500 * SolarC + 0.30 * 5000 * WindD + 0.25 * 4500 * WindE\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installations.\nmodel.addCons(1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE <= 1000000)\n## The company aims to generate at least 200,000 kWh of energy.\nmodel.addCons(0.15 * 1000 * SolarA + 0.18 * 1200 * SolarB + 0.20 * 1500 * SolarC + 0.30 * 5000 * WindD + 0.25 * 4500 * WindE >= 200000)\n## The company must install at least 50 solar panels in total.\nmodel.addCons(SolarA + SolarB + SolarC >= 50)\n## The number of wind turbines should not exceed 30.\nmodel.addCons(WindD + WindE <= 30)\n## No more than 40% of the budget should be spent on wind turbines.\nmodel.addCons(5000 * WindD + 4500 * WindE <= 0.4 * 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Minimized Cost per Unit of Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company has the option to invest in a new technology that can increase the efficiency of production, but at a cost.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit without the new technology is $30 for ProductA, $40 for ProductB, and $50 for ProductC. If the new technology is invested in, the production cost per unit decreases by $5 for each product. The investment cost for the new technology is $100,000. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_ProductA = (50 - 30 + 0.5 * TechInvestment) * ProductAQty\n// Total profit for ProductB: Profit_ProductB = (70 - 40 + 0.5 * TechInvestment) * ProductBQty\n// Total profit for ProductC: Profit_ProductC = (90 - 50 + 0.5 * TechInvestment) * ProductCQty\n// Total investment cost: InvestmentCost = 100,000 * TechInvestment\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - InvestmentCost)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 10,000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for technology investments.\n// TechInvestment <= 500,000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProductAQty >= 2 * ProductBQty\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of ProductC to meet contractual obligations.\n// ProductCQty >= 1,000\n\n## Generate Constraint-5:\nThe total investment in the new technology should not exceed 50% of the total production cost.\n// TechInvestment <= 0.5 * (30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company has the option to invest in a new technology that can increase the efficiency of production, but at a cost. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit without the new technology is $30 for ProductA, $40 for ProductB, and $50 for ProductC. If the new technology is invested in, the production cost per unit decreases by $5 for each product. The investment cost for the new technology is $100,000. The company has a total production capacity of 10,000 units per month. The company has a budget of $500,000 for technology investments. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must produce at least 1,000 units of ProductC to meet contractual obligations. The total investment in the new technology should not exceed 50% of the total production cost. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=1000)  # production quantity for ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfit_ProductA = (50 - 30 + 0.5 * TechInvestment) * ProductAQty\nProfit_ProductB = (70 - 40 + 0.5 * TechInvestment) * ProductBQty\nProfit_ProductC = (90 - 50 + 0.5 * TechInvestment) * ProductCQty\nInvestmentCost = 100000 * TechInvestment\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - InvestmentCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - InvestmentCost)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units per month.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 10000)\n# The company has a budget of $500,000 for technology investments.\nmodel.addCons(TechInvestment <= 500000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductAQty >= 2 * ProductBQty)\n# The company must produce at least 1,000 units of ProductC to meet contractual obligations.\nmodel.addCons(ProductCQty >= 1000)\n# The total investment in the new technology should not exceed 50% of the total production cost.\nmodel.addCons(TechInvestment <= 0.5 * (30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget constraint for raw materials, which is $500,000. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours.\n// 8 * ProductA + 10 * ProductB + 9 * ProductC <= 800\n\n## Generate Constraint-3:\nMarket demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\n// ProductA <= 50\n// ProductB <= 60\n// ProductC <= 70",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55. The company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours. Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units. Please help the company to maximize the total profit from the sales of all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total budget of $5000 for raw materials.\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000)\n# The company has a total of 800 labor hours available.\nmodel.addCons(8 * ProductA + 10 * ProductB + 9 * ProductC <= 800)\n# Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\nmodel.addCons(ProductA <= 50)\nmodel.addCons(ProductB <= 60)\nmodel.addCons(ProductC <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations.\n// {\"size of the playground (in square meters)\": \"Playground\", \"range\": \"Playground >= 0\", \"type\": \"real\"}\n// {\"size of the sports field (in square meters)\": \"SportsField\", \"range\": \"SportsField >= 0\", \"type\": \"real\"}\n// {\"size of the picnic area (in square meters)\": \"PicnicArea\", \"range\": \"PicnicArea >= 0\", \"type\": \"real\"}\n// {\"size of the botanical garden (in square meters)\": \"BotanicalGarden\", \"range\": \"BotanicalGarden >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe satisfaction derived from each facility is estimated as follows: Playground satisfaction is 0.05 * Playground^2, SportsField satisfaction is 0.08 * SportsField^2, PicnicArea satisfaction is 0.03 * PicnicArea^2, and BotanicalGarden satisfaction is 0.1 * BotanicalGarden^2. The city council aims to maximize the total satisfaction from all facilities.\n// Total satisfaction: Satisfaction = 0.05 * Playground^2 + 0.08 * SportsField^2 + 0.03 * PicnicArea^2 + 0.1 * BotanicalGarden^2\n// So, the objective function is: Maximize Satisfaction\n\n## Generate Constraint-1:\nThe total area available for the park is 10,000 square meters.\n// Playground + SportsField + PicnicArea + BotanicalGarden <= 10000\n\n## Generate Constraint-2:\nThe budget for the park development is $500,000. The cost of developing each facility is as follows: Playground costs $100 per square meter, SportsField costs $150 per square meter, PicnicArea costs $50 per square meter, and BotanicalGarden costs $200 per square meter.\n// 100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000\n\n## Generate Constraint-3:\nThe city council wants to ensure that at least 20% of the park area is dedicated to green spaces, which includes the BotanicalGarden and part of the PicnicArea.\n// BotanicalGarden + 0.5 * PicnicArea >= 0.2 * 10000",
        "question": "A city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations. The satisfaction derived from each facility is estimated as follows: Playground satisfaction is 0.05 * Playground^2, SportsField satisfaction is 0.08 * SportsField^2, PicnicArea satisfaction is 0.03 * PicnicArea^2, and BotanicalGarden satisfaction is 0.1 * BotanicalGarden^2. The city council aims to maximize the total satisfaction from all facilities. The total area available for the park is 10,000 square meters. The budget for the park development is $500,000, with costs of $100 per square meter for the Playground, $150 per square meter for the SportsField, $50 per square meter for the PicnicArea, and $200 per square meter for the BotanicalGarden. The city council also wants to ensure that at least 20% of the park area is dedicated to green spaces, which includes the BotanicalGarden and part of the PicnicArea. Please help the city council determine the optimal sizes for each facility to maximize community satisfaction.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPlayground = model.addVar(vtype=\"CONTINUOUS\", name=\"Playground\", lb=0)  # size of the playground\nSportsField = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsField\", lb=0)  # size of the sports field\nPicnicArea = model.addVar(vtype=\"CONTINUOUS\", name=\"PicnicArea\", lb=0)  # size of the picnic area\nBotanicalGarden = model.addVar(vtype=\"CONTINUOUS\", name=\"BotanicalGarden\", lb=0)  # size of the botanical garden\n\n# Define objective function\nPlaygroundSatisfaction = 0.05 * Playground**2\nSportsFieldSatisfaction = 0.08 * SportsField**2\nPicnicAreaSatisfaction = 0.03 * PicnicArea**2\nBotanicalGardenSatisfaction = 0.1 * BotanicalGarden**2\nSatisfaction = PlaygroundSatisfaction + SportsFieldSatisfaction + PicnicAreaSatisfaction + BotanicalGardenSatisfaction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Satisfaction)\n\n# Add constraints\nmodel.addCons(Playground + SportsField + PicnicArea + BotanicalGarden <= 10000)\nmodel.addCons(100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000)\nmodel.addCons(BotanicalGarden + 0.5 * PicnicArea >= 0.2 * 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Size of Playground: \", model.getVal(Playground))\n    print(\"Size of SportsField: \", model.getVal(SportsField))\n    print(\"Size of PicnicArea: \", model.getVal(PicnicArea))\n    print(\"Size of BotanicalGarden: \", model.getVal(BotanicalGarden))\n    print(\"Maximized Satisfaction: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) to minimize fuel consumption and environmental impact. Each truck has a different fuel efficiency and can carry a different load.\n// {\"load carried by Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its load. For Truck1, the fuel consumption is 0.05 * (Truck1^2) liters. For Truck2, it's 0.04 * (Truck2^2) liters. For Truck3, it's 0.06 * (Truck3^2) liters. For Truck4, it's 0.03 * (Truck4^2) liters. For Truck5, it's 0.07 * (Truck5^2) liters. The company wants to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 0.05 * (Truck1^2) + 0.04 * (Truck2^2) + 0.06 * (Truck3^2) + 0.03 * (Truck4^2) + 0.07 * (Truck5^2)\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total load to be transported is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck1 can carry up to 20 tons, Truck2 up to 30 tons, Truck3 up to 25 tons, Truck4 up to 15 tons, and Truck5 up to 10 tons.\n// Truck1 <= 20\n// Truck2 <= 30\n// Truck3 <= 25\n// Truck4 <= 15\n// Truck5 <= 10\n\n## Generate Constraint-3:\nAt least 30 tons must be transported by Truck1 and Truck2 combined.\n// Truck1 + Truck2 >= 30\n\n## Generate Constraint-4:\nNo more than 50% of the total load can be carried by Truck1 and Truck3 combined.\n// Truck1 + Truck3 <= 50",
        "question": "A logistics company is planning its routes for five different vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) to minimize fuel consumption and environmental impact. Each truck has a different fuel efficiency and can carry a different load. The fuel consumption of each truck is a nonlinear function of its load, as shown in the following Table.\n\n| Truck | Fuel Consumption Function | Maximum Capacity |\n|-------|---------------------------|------------------|\n| Truck1 | 0.05 * (Truck1^2) liters | 20 tons          |\n| Truck2 | 0.04 * (Truck2^2) liters | 30 tons          |\n| Truck3 | 0.06 * (Truck3^2) liters | 25 tons          |\n| Truck4 | 0.03 * (Truck4^2) liters | 15 tons          |\n| Truck5 | 0.07 * (Truck5^2) liters | 10 tons          |\n\nThe total load to be transported is 100 tons. Each truck has a maximum capacity as indicated in the Table. At least 30 tons must be transported by Truck1 and Truck2 combined. No more than 50% of the total load can be carried by Truck1 and Truck3 combined.\n\nPlease help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # load carried by Truck1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # load carried by Truck2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # load carried by Truck3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # load carried by Truck4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # load carried by Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel = 0.05 * (Truck1**2) + 0.04 * (Truck2**2) + 0.06 * (Truck3**2) + 0.03 * (Truck4**2) + 0.07 * (Truck5**2)\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total load to be transported is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n## Each truck has a maximum capacity: Truck1 can carry up to 20 tons, Truck2 up to 30 tons, Truck3 up to 25 tons, Truck4 up to 15 tons, and Truck5 up to 10 tons.\nmodel.addCons(Truck1 <= 20)\nmodel.addCons(Truck2 <= 30)\nmodel.addCons(Truck3 <= 25)\nmodel.addCons(Truck4 <= 15)\nmodel.addCons(Truck5 <= 10)\n## At least 30 tons must be transported by Truck1 and Truck2 combined.\nmodel.addCons(Truck1 + Truck2 >= 30)\n## No more than 50% of the total load can be carried by Truck1 and Truck3 combined.\nmodel.addCons(Truck1 + Truck3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Load carried by Truck1: \", model.getVal(Truck1))\n    print(\"Load carried by Truck2: \", model.getVal(Truck2))\n    print(\"Load carried by Truck3: \", model.getVal(Truck3))\n    print(\"Load carried by Truck4: \", model.getVal(Truck4))\n    print(\"Load carried by Truck5: \", model.getVal(Truck5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device to optimize its profit. Additionally, the company must decide on the number of quality control checks to perform for each device type.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceA\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceB\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceC\": \"QC_C\", \"range\": \"QC_C >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceD\": \"QC_D\", \"range\": \"QC_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\nThe company aims to maximize the total profit per unit of production, considering both the production and quality control costs.\n// Profit of DeviceA: Profit_A = (100 - 60) * A - 5 * QC_A\n// Profit of DeviceB: Profit_B = (150 - 90) * B - 7 * QC_B\n// Profit of DeviceC: Profit_C = (200 - 120) * C - 9 * QC_C\n// Profit of DeviceD: Profit_D = (250 - 150) * D - 11 * QC_D\n// So, the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / (A + B + C + D))\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for quality control checks.\n// 5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10,000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 100 units of each device.\n// A <= 100; B <= 100; C <= 100; D <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is checked for quality.\n// QC_A >= 0.1 * A; QC_B >= 0.1 * B; QC_C >= 0.1 * C; QC_D >= 0.1 * D\n\n## Generate Constraint-4:\nThe company has a limited production capacity of 300 hours, with DeviceA requiring 2 hours per unit, DeviceB requiring 3 hours per unit, DeviceC requiring 4 hours per unit, and DeviceD requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 300\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device and the number of quality control checks to perform for each device type to optimize its profit. For DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5. For DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7. For DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9. For DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11. The company has a total budget of $10,000 for quality control checks and can produce a maximum of 100 units of each device. The company wants to ensure that at least 10% of each device's production is checked for quality and has a limited production capacity of 300 hours. The company also wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC. Please help the company to maximize the total profit per unit of production, considering both the production and quality control costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of DeviceD\nQC_A = model.addVar(vtype=\"INTEGER\", name=\"QC_A\", lb=0) # number of quality control checks for DeviceA\nQC_B = model.addVar(vtype=\"INTEGER\", name=\"QC_B\", lb=0) # number of quality control checks for DeviceB\nQC_C = model.addVar(vtype=\"INTEGER\", name=\"QC_C\", lb=0) # number of quality control checks for DeviceC\nQC_D = model.addVar(vtype=\"INTEGER\", name=\"QC_D\", lb=0) # number of quality control checks for DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * QC_A\nProfit_B = (150 - 90) * B - 7 * QC_B\nProfit_C = (200 - 120) * C - 9 * QC_C\nProfit_D = (250 - 150) * D - 11 * QC_D\nTotalProduction = A + B + C + D\n## the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / TotalProduction)\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for quality control checks.\nmodel.addCons(5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10000)\n## The company can produce a maximum of 100 units of each device.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 100)\nmodel.addCons(C <= 100)\nmodel.addCons(D <= 100)\n## The company wants to ensure that at least 10% of each device's production is checked for quality.\nmodel.addCons(QC_A >= 0.1 * A)\nmodel.addCons(QC_B >= 0.1 * B)\nmodel.addCons(QC_C >= 0.1 * C)\nmodel.addCons(QC_D >= 0.1 * D)\n## The company has a limited production capacity of 300 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 300)\n## The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of QC checks for DeviceA: \", model.getVal(QC_A))\n    print(\"Number of QC checks for DeviceB: \", model.getVal(QC_B))\n    print(\"Number of QC checks for DeviceC: \", model.getVal(QC_C))\n    print(\"Number of QC checks for DeviceD: \", model.getVal(QC_D))\n    print(\"Maximized Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for solar\": \"ESS_SP\", \"range\": \"ESS_SP >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for wind\": \"ESS_WT\", \"range\": \"ESS_WT >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. Similarly, the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar: Energy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\n// Total energy production from wind: Energy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\n// So, the objective function is: Maximize (Energy_SP + Energy_WT)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for investments in energy storage systems.\n// ESS_SP + ESS_WT <= 200000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) must not exceed 1000 units.\n// SP + WT <= 1000\n\n## Generate Constraint-3:\nDue to environmental regulations, the number of wind turbines must not exceed half the number of solar panels.\n// WT <= 0.5 * SP\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 solar panels and 100 wind turbines are installed.\n// SP >= 200; WT >= 100\n\n## Generate Constraint-5:\nThe total area available for installations is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n// 2 * SP + 5 * WT <= 5000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems, and the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The company aims to maximize the total energy production.\n\n| Component | Initial Efficiency | Area Required | Investment Impact |\n|-----------|--------------------|---------------|-------------------|\n| Solar Panel (SP) | 20% | 2 square meters | 1% increase per $10,000 in ESS_SP |\n| Wind Turbine (WT) | 30% | 5 square meters | 1.5% increase per $10,000 in ESS_WT |\n\nThe company has a budget of $200,000 for investments in energy storage systems. The total number of installations (solar panels and wind turbines) must not exceed 1000 units. Due to environmental regulations, the number of wind turbines must not exceed half the number of solar panels. The company must ensure that at least 200 solar panels and 100 wind turbines are installed. The total area available for installations is limited to 5000 square meters.\n\nPlease help the company to maximize the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=200)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=100)  # number of wind turbines\nESS_SP = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_SP\", lb=0)  # investment in energy storage for solar\nESS_WT = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_WT\", lb=0)  # investment in energy storage for wind\n\n# Define objective function\nEnergy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\nEnergy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SP + Energy_WT)\n\n# Add constraints\nmodel.addCons(ESS_SP + ESS_WT <= 200000)  # budget constraint for energy storage systems\nmodel.addCons(SP + WT <= 1000)  # total installations constraint\nmodel.addCons(WT <= 0.5 * SP)  # environmental regulation constraint\nmodel.addCons(2 * SP + 5 * WT <= 5000)  # area constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Investment in Energy Storage for Solar: \", model.getVal(ESS_SP))\n    print(\"Investment in Energy Storage for Wind: \", model.getVal(ESS_WT))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1595,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. They have five types of vehicles (A, B, C, D, and E) available for transportation tasks. Each vehicle type has different capacities and operational costs.\n// {\"number of vehicles of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nVehicle B has a capacity of 20 tons, an operational cost of $700 per day, and a fuel efficiency of 8 km/liter.\nVehicle C has a capacity of 30 tons, an operational cost of $900 per day, and a fuel efficiency of 10 km/liter.\nVehicle D has a capacity of 40 tons, an operational cost of $1100 per day, and a fuel efficiency of 12 km/liter.\nVehicle E has a capacity of 50 tons, an operational cost of $1300 per day, and a fuel efficiency of 15 km/liter.\nThe company aims to maximize the transportation capacity per dollar spent (defined as the total capacity of all vehicles divided by the total operational cost).\n// Total capacity: Capacity = 10 * A + 20 * B + 30 * C + 40 * D + 50 * E\n// Total operational cost: Cost = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\n// So, the objective function is: Maximize Capacity / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $30,000 for operational costs next month.\n// 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E <= 30000\n\n## Generate Constraint-2:\nThe company needs to transport at least 1000 tons next month.\n// 10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 100 vehicles in total.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Vehicle E does not exceed 20% of the total fleet.\n// E <= 0.2 * (A + B + C + D + E)",
        "question": "A logistics company is planning its fleet usage for the next month. They have five types of vehicles (A, B, C, D, and E) available for transportation tasks. Each vehicle type has different capacities, operational costs, and fuel efficiencies. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Capacity (tons) | Operational Cost ($/day) | Fuel Efficiency (km/liter) |\n|--------------|-----------------|--------------------------|----------------------------|\n| A            | 10              | 500                      | 5                          |\n| B            | 20              | 700                      | 8                          |\n| C            | 30              | 900                      | 10                         |\n| D            | 40              | 1100                     | 12                         |\n| E            | 50              | 1300                     | 15                         |\n\nThe company has a budget of $30,000 for operational costs next month. The company needs to transport at least 1000 tons next month. The company can only operate a maximum of 100 vehicles in total. The company wants to ensure that the number of Vehicle E does not exceed 20% of the total fleet.\n\nPlease help the company to maximize the transportation capacity per dollar spent (defined as the total capacity of all vehicles divided by the total operational cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of vehicles of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of vehicles of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * A + 20 * B + 30 * C + 40 * D + 50 * E\nCost = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\n## the objective function is: Maximize Capacity / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Capacity)\n\n# Add constraints\n## The company has a budget of $30,000 for operational costs next month.\nmodel.addCons(500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E <= 30000)\n## The company needs to transport at least 1000 tons next month.\nmodel.addCons(10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000)\n## The company can only operate a maximum of 100 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the number of Vehicle E does not exceed 20% of the total fleet.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicle A: \", model.getVal(A))\n    print(\"Number of Vehicle B: \", model.getVal(B))\n    print(\"Number of Vehicle C: \", model.getVal(C))\n    print(\"Number of Vehicle D: \", model.getVal(D))\n    print(\"Number of Vehicle E: \", model.getVal(E))\n    print(\"Maximized Transportation Capacity per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1412,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The decision variables include the number of trucks allocated to each route and the investment in fuel-efficient technologies for each truck type.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its total profit from all routes. The profit per truck on each route is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per truck decreases by $50 per month. The initial profit per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $900. The company wants to maximize the total profit, considering the reduced fuel costs due to technology investments.\n// Total profit for Route1: Profit1 = (1000 - 0.05 * Tech1) * Trucks1\n// Total profit for Route2: Profit2 = (1200 - 0.05 * Tech2) * Trucks2\n// Total profit for Route3: Profit3 = (900 - 0.05 * Tech3) * Trucks3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trucks must be allocated to Route1 and 150 trucks to Route2.\n// Trucks1 >= 100; Trucks2 >= 150\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each route must not exceed 10% of the total budget allocated to that route.\n// Tech1 <= 0.1 * (Trucks1 + Tech1); Tech2 <= 0.1 * (Trucks2 + Tech2); Tech3 <= 0.1 * (Trucks3 + Tech3)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The decision variables include the number of trucks allocated to each route and the investment in fuel-efficient technologies for each truck type. The company aims to maximize its total profit from all routes, where the profit per truck on each route is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per truck decreases by $50 per month. The initial profit per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $900.\n\n| Route | Initial Profit per Truck |\n|-------|--------------------------|\n| Route1 | $1000                    |\n| Route2 | $1200                    |\n| Route3 | $900                     |\n\nThe company has a total budget of $100,000 for truck allocations and technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual obligations, at least 100 trucks must be allocated to Route1 and 150 trucks to Route2. The investment in fuel-efficient technology for each route must not exceed 10% of the total budget allocated to that route.\n\nPlease help the company to maximize the total profit, considering the reduced fuel costs due to technology investments.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=100) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=150) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Route3\n\n# Define objective function\nProfit1 = (1000 - 0.05 * Tech1) * Trucks1\nProfit2 = (1200 - 0.05 * Tech2) * Trucks2\nProfit3 = (900 - 0.05 * Tech3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\nmodel.addCons(Trucks1 >= 100)\nmodel.addCons(Trucks2 >= 150)\nmodel.addCons(Tech1 <= 0.1 * (Trucks1 + Tech1))\nmodel.addCons(Tech2 <= 0.1 * (Trucks2 + Tech2))\nmodel.addCons(Tech3 <= 0.1 * (Trucks3 + Tech3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1435,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation.\n// {\"number of trucks for cargo A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for cargo A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels.\n// FuelCostA = TrucksA * SpeedA * 2\n// FuelCostB = TrucksB * SpeedB * 3\n// FuelCostC = TrucksC * SpeedC * 4\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// 2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-3:\nThe average speed of trucks cannot exceed 100 km/h.\n// SpeedA + SpeedB + SpeedC <= 100",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation. The cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels.\n\n| Cargo Type | Fuel Cost per Kilometer |\n|------------|-------------------------|\n| A          | $2                      |\n| B          | $3                      |\n| C          | $4                      |\n\nThe company has a total budget of $1000 for fuel costs per day. The company has a maximum of 50 trucks available. The average speed of trucks cannot exceed 100 km/h.\n\nPlease help the company to determine the optimal number of trucks for each type of cargo and their respective speeds to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for cargo A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for cargo B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for cargo C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks for cargo A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for cargo B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0)  # speed of trucks for cargo C\n\n# Define objective function\nFuelCostA = TrucksA * SpeedA * 2\nFuelCostB = TrucksB * SpeedB * 3\nFuelCostC = TrucksC * SpeedC * 4\n# So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\n# The company has a total budget of $1000 for fuel costs per day.\nmodel.addCons(2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000)\n# The company has a maximum of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The average speed of trucks cannot exceed 100 km/h.\nmodel.addCons(SpeedA + SpeedB + SpeedC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks for Cargo A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for Cargo B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks for Cargo C: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels on that route.\n// {\"number of trucks on Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route A\": \"Speed_A\", \"range\": \"Speed_A > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route B\": \"Speed_B\", \"range\": \"Speed_B > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route C\": \"Speed_C\", \"range\": \"Speed_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: Fuel_Consumption = k * Speed^2, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = k * Trucks_A * Speed_A^2\n// Fuel_Consumption_B = k * Trucks_B * Speed_B^2\n// Fuel_Consumption_C = k * Trucks_C * Speed_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total travel time for all routes must not exceed 100 hours.\n// (Distance_A / Speed_A) * Trucks_A + (Distance_B / Speed_B) * Trucks_B + (Distance_C / Speed_C) * Trucks_C <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels on that route. The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: Fuel_Consumption = k * Speed^2, where k is a constant.\n\nThe company has a total of 50 trucks available. The total travel time for all routes must not exceed 100 hours. Please help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks on Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks on Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks on Route C\nSpeed_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_A\", lb=0)  # speed of trucks on Route A\nSpeed_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_B\", lb=0)  # speed of trucks on Route B\nSpeed_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_C\", lb=0)  # speed of trucks on Route C\n\n# Define objective function\nk = 1  # constant for fuel consumption, assuming k = 1 for simplicity\nFuel_Consumption_A = k * Trucks_A * Speed_A**2\nFuel_Consumption_B = k * Trucks_B * Speed_B**2\nFuel_Consumption_C = k * Trucks_C * Speed_C**2\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n# The total travel time for all routes must not exceed 100 hours.\nDistance_A = 1  # assuming distance for Route A\nDistance_B = 1  # assuming distance for Route B\nDistance_C = 1  # assuming distance for Route C\nmodel.addCons((Distance_A / Speed_A) * Trucks_A + (Distance_B / Speed_B) * Trucks_B + (Distance_C / Speed_C) * Trucks_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks on Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks on Route C: \", model.getVal(Trucks_C))\n    print(\"Speed of Trucks on Route A: \", model.getVal(Speed_A))\n    print(\"Speed of Trucks on Route B: \", model.getVal(Speed_B))\n    print(\"Speed of Trucks on Route C: \", model.getVal(Speed_C))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 699,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer has 100 hectares of land available and a total of 50,000 liters of water for irrigation. The farmer must plant at least 10 hectares of Wheat. The farmer wants to maximize the profit per liter of water used. Please help the farmer determine the optimal area of land to allocate to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # area of land for Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # area of land for Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit Rate per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency.\n// {\"number of Small solar plants\": \"SmallPlants\", \"range\": \"SmallPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Medium solar plants\": \"MediumPlants\", \"range\": \"MediumPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Large solar plants\": \"LargePlants\", \"range\": \"LargePlants >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Small plants\": \"TechInvestmentSmall\", \"range\": \"TechInvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Medium plants\": \"TechInvestmentMedium\", \"range\": \"TechInvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Large plants\": \"TechInvestmentLarge\", \"range\": \"TechInvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n// EnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\n// EnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\n// EnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for building new plants and investing in technology.\n// 1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000",
        "question": "A renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency. The energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n\n| Plant Type | Base Energy Output | Technology Investment Impact |\n|------------|--------------------|------------------------------|\n| Small      | 100 MWh            | 5 MWh per $100,000           |\n| Medium     | 200 MWh            | 7 MWh per $100,000           |\n| Large      | 300 MWh            | 10 MWh per $100,000          |\n\nThe company has a total budget of $10 million for building new plants and investing in technology. Please help the company determine the optimal number of each type of solar plant to build and the investment in advanced solar technology to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallPlants = model.addVar(vtype=\"INTEGER\", name=\"SmallPlants\", lb=0)  # number of Small solar plants\nMediumPlants = model.addVar(vtype=\"INTEGER\", name=\"MediumPlants\", lb=0)  # number of Medium solar plants\nLargePlants = model.addVar(vtype=\"INTEGER\", name=\"LargePlants\", lb=0)  # number of Large solar plants\nTechInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSmall\", lb=0)  # investment in advanced technology for Small plants\nTechInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentMedium\", lb=0)  # investment in advanced technology for Medium plants\nTechInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentLarge\", lb=0)  # investment in advanced technology for Large plants\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\nEnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\nEnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n# So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# Add constraints\n# The company has a total budget of $10 million for building new plants and investing in technology.\nmodel.addCons(1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small solar plants: \", model.getVal(SmallPlants))\n    print(\"Number of Medium solar plants: \", model.getVal(MediumPlants))\n    print(\"Number of Large solar plants: \", model.getVal(LargePlants))\n    print(\"Investment in advanced technology for Small plants: \", model.getVal(TechInvestmentSmall))\n    print(\"Investment in advanced technology for Medium plants: \", model.getVal(TechInvestmentMedium))\n    print(\"Investment in advanced technology for Large plants: \", model.getVal(TechInvestmentLarge))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1218,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different warehouses across the country. The company needs to optimize the distribution of goods from these warehouses to minimize transportation costs while meeting customer demand.\n// {\"goods distributed from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of transporting goods from each warehouse is a nonlinear function of the quantity of goods distributed. The cost functions are as follows:\n- Warehouse 1: Cost = 0.05 * W1^2\n- Warehouse 2: Cost = 0.04 * W2^2\n- Warehouse 3: Cost = 0.06 * W3^2\n- Warehouse 4: Cost = 0.03 * W4^2\n- Warehouse 5: Cost = 0.07 * W5^2\nThe company aims to minimize the total transportation cost.\n// Objective function: Minimize (0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2)\n\n## Generate Constraint-1:\nThe total amount of goods distributed must meet the national demand of 1000 units.\n// W1 + W2 + W3 + W4 + W5 = 1000\n\n## Generate Constraint-2:\nEach warehouse has a maximum capacity for distribution:\n- Warehouse 1: 200 units\n- Warehouse 2: 250 units\n- Warehouse 3: 150 units\n- Warehouse 4: 300 units\n- Warehouse 5: 100 units\n// W1 <= 200; W2 <= 250; W3 <= 150; W4 <= 300; W5 <= 100",
        "question": "A logistics company operates 5 different warehouses across the country. The company needs to optimize the distribution of goods from these warehouses to minimize transportation costs while meeting customer demand. The cost of transporting goods from each warehouse is a nonlinear function of the quantity of goods distributed, as shown in the following Table.\n\n| Warehouse | Cost Function          | Maximum Capacity |\n|-----------|------------------------|------------------|\n| 1         | 0.05 * W1^2           | 200 units        |\n| 2         | 0.04 * W2^2           | 250 units        |\n| 3         | 0.06 * W3^2           | 150 units        |\n| 4         | 0.03 * W4^2           | 300 units        |\n| 5         | 0.07 * W5^2           | 100 units        |\n\nThe total amount of goods distributed must meet the national demand of 1000 units. Each warehouse has a maximum capacity for distribution as specified in the Table. Please help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0) # goods distributed from warehouse 1\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=0) # goods distributed from warehouse 2\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=0) # goods distributed from warehouse 3\nW4 = model.addVar(vtype=\"CONTINUOUS\", name=\"W4\", lb=0) # goods distributed from warehouse 4\nW5 = model.addVar(vtype=\"CONTINUOUS\", name=\"W5\", lb=0) # goods distributed from warehouse 5\n\n# Define objective function\n## The cost of transporting goods from each warehouse is a nonlinear function of the quantity of goods distributed.\nCost_W1 = 0.05 * W1**2\nCost_W2 = 0.04 * W2**2\nCost_W3 = 0.06 * W3**2\nCost_W4 = 0.03 * W4**2\nCost_W5 = 0.07 * W5**2\n## Objective function: Minimize (0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_W1 + Cost_W2 + Cost_W3 + Cost_W4 + Cost_W5)\n\n# Add constraints\n## The total amount of goods distributed must meet the national demand of 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 == 1000)\n## Each warehouse has a maximum capacity for distribution.\nmodel.addCons(W1 <= 200)\nmodel.addCons(W2 <= 250)\nmodel.addCons(W3 <= 150)\nmodel.addCons(W4 <= 300)\nmodel.addCons(W5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Goods distributed from Warehouse 1: \", model.getVal(W1))\n    print(\"Goods distributed from Warehouse 2: \", model.getVal(W2))\n    print(\"Goods distributed from Warehouse 3: \", model.getVal(W3))\n    print(\"Goods distributed from Warehouse 4: \", model.getVal(W4))\n    print(\"Goods distributed from Warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Truck A is $20, for Truck B is $30, and for Truck C is $40. The company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand. The objective function is to minimize the total operational cost, which is given by:\n// Operational cost of A: Cost_A = 20 * A\n// Operational cost of B: Cost_B = 30 * B\n// Operational cost of C: Cost_C = 40 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\n// Capacity of A: 100 * A\n// Capacity of B: 200 * B\n// Capacity of C: 300 * C\n// Constraint: 100 * A + 200 * B + 300 * C >= 5000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for purchasing new trucks.\n// Cost of A: 1000 * A\n// Cost of B: 2000 * B\n// Cost of C: 3000 * C\n// Constraint: 1000 * A + 2000 * B + 3000 * C <= 10000",
        "question": "A logistics company manages the transportation of goods using three types of trucks: A, B, and C. Each truck type has different capacities and operational costs. The company needs to decide how many of each type of truck to deploy for the next month to optimize its operations. The operational cost per kilometer and the capacity for each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per Kilometer | Capacity (cubic meters) | Purchase Cost |\n|------------|--------------------------------|-------------------------|---------------|\n| A          | $20                            | 100                     | $1000         |\n| B          | $30                            | 200                     | $2000         |\n| C          | $40                            | 300                     | $3000         |\n\nThe company aims to minimize the total operational cost while ensuring that the total capacity of the trucks is sufficient to meet the demand of 5000 cubic meters. The company has a budget constraint of $10,000 for purchasing new trucks. Please help the company to determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required capacity of 5000 cubic meters.\nmodel.addCons(100 * A + 200 * B + 300 * C >= 5000)\n## The company has a budget constraint of $10,000 for purchasing new trucks.\nmodel.addCons(1000 * A + 2000 * B + 3000 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total net profit.\n// NetProfit_A = A * (50 - 20)\n// NetProfit_B = B * (70 - 30)\n// NetProfit_C = C * (60 - 25)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\n// A >= 200\n// B >= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n\nThe company aims to maximize the total net profit, which is the sum of the profits minus the production costs for each product. The total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month. Please help the company determine the optimal production quantities for products A, B, and C to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = A * (50 - 20)\nNetProfit_B = B * (70 - 30)\nNetProfit_C = C * (60 - 25)\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost is $500 per month, and the rental cost is $1000 per month. \nFor TruckB, the fuel efficiency is 15 km/l, the maintenance cost is $700 per month, and the rental cost is $1200 per month. \nFor TruckC, the fuel efficiency is 20 km/l, the maintenance cost is $900 per month, and the rental cost is $1400 per month.\nFor TruckD, the fuel efficiency is 25 km/l, the maintenance cost is $1100 per month, and the rental cost is $1600 per month.\nFor TruckE, the fuel efficiency is 30 km/l, the maintenance cost is $1300 per month, and the rental cost is $1800 per month.\nThe company aims to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance).\n// Total cost for TruckA: Cost_TruckA = (1000 + 500) * TruckA\n// Total cost for TruckB: Cost_TruckB = (1200 + 700) * TruckB\n// Total cost for TruckC: Cost_TruckC = (1400 + 900) * TruckC\n// Total cost for TruckD: Cost_TruckD = (1600 + 1100) * TruckD\n// Total cost for TruckE: Cost_TruckE = (1800 + 1300) * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month.\n// (1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 units of each type of truck are deployed.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10; TruckD >= 10; TruckE >= 10\n\n## Generate Constraint-3:\nThe company has a total of 50 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and rental cost for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost per Month | Rental Cost per Month |\n|------------|-----------------------|----------------------------|-----------------------|\n| TruckA     | 10                    | $500                       | $1000                 |\n| TruckB     | 15                    | $700                       | $1200                 |\n| TruckC     | 20                    | $900                       | $1400                 |\n| TruckD     | 25                    | $1100                      | $1600                 |\n| TruckE     | 30                    | $1300                      | $1800                 |\n\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month. The company wants to ensure that at least 10 units of each type of truck are deployed. The company has a total of 50 trucks available for deployment. \n\nPlease help the company to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 10 units of each type of truck are deployed.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=10) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=10) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (1000 + 500) * TruckA\nCost_TruckB = (1200 + 700) * TruckB\nCost_TruckC = (1400 + 900) * TruckC\nCost_TruckD = (1600 + 1100) * TruckD\nCost_TruckE = (1800 + 1300) * TruckE\nDistance = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Distance\n## convert the division to multiplication\nmodel.addCons(obj * Distance == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $150,000 for truck rentals and maintenance for the next month.\nmodel.addCons((1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150000)\n## The company has a total of 50 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1448,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 1 hour          |\n| B       | 30$           | 15$           | 2 hours         |\n| C       | 40$           | 20$           | 3 hours         |\n| D       | 50$           | 25$           | 4 hours         |\n| E       | 60$           | 30$           | 5 hours         |\n\nThe company has $1500 available for material costs for the next quarter. The company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times). Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products.\n// {\"number of hours machine M1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine M1 produces 10 units of product A, 20 units of product B, and 30 units of product C per hour, with a cost of $50 per hour. Machine M2 produces 15 units of product A, 25 units of product B, and 35 units of product C per hour, with a cost of $60 per hour. Machine M3 produces 20 units of product A, 30 units of product B, and 40 units of product C per hour, with a cost of $70 per hour. Machine M4 produces 25 units of product A, 35 units of product B, and 45 units of product C per hour, with a cost of $80 per hour. Machine M5 produces 30 units of product A, 40 units of product B, and 50 units of product C per hour, with a cost of $90 per hour. The company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets.\n// Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n// Production of product A: A = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Production of product B: B = 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5\n// Production of product C: C = 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total production of product A must be at least 1000 units.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour, as shown in the following Table.\n\n| Machine | Units of Product A per Hour | Units of Product B per Hour | Units of Product C per Hour | Cost per Hour |\n|---------|-----------------------------|-----------------------------|-----------------------------|---------------|\n| M1      | 10                          | 20                          | 30                          | $50           |\n| M2      | 15                          | 25                          | 35                          | $60           |\n| M3      | 20                          | 30                          | 40                          | $70           |\n| M4      | 25                          | 35                          | 45                          | $80           |\n| M5      | 30                          | 40                          | 50                          | $90           |\n\nThe company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets. The total production of product A must be at least 1000 units.\n\nPlease help the company determine the optimal number of hours each machine should operate to minimize the total cost of production while meeting the production targets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of hours machine M1 operates\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of hours machine M2 operates\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of hours machine M3 operates\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of hours machine M4 operates\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of hours machine M5 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\nmodel.addCons(obj == 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5)\n\n# Add constraints\n## The total production of product A must be at least 1000 units.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000)\n## Production of product B: B = 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5\n## Production of product C: C = 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5\n## The company needs to produce at least 1500 units of product B and 2000 units of product C.\nmodel.addCons(20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500)\nmodel.addCons(30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours machine M1 operates: \", model.getVal(M1))\n    print(\"Number of hours machine M2 operates: \", model.getVal(M2))\n    print(\"Number of hours machine M3 operates: \", model.getVal(M3))\n    print(\"Number of hours machine M4 operates: \", model.getVal(M4))\n    print(\"Number of hours machine M5 operates: \", model.getVal(M5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1541,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination.\n// {\"number of trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck to D1 is $1000, to D2 is $1200, to D3 is $1500, to D4 is $1800, and to D5 is $2000. The revenue generated by sending a truck to D1 is $1500, to D2 is $1800, to D3 is $2100, to D4 is $2400, and to D5 is $2700. The company wants to maximize the net profit (revenue minus cost) per dollar spent on fuel, which is a nonlinear function of the number of trucks sent.\n// Cost_D1 = 1000 * T1\n// Cost_D2 = 1200 * T2\n// Cost_D3 = 1500 * T3\n// Cost_D4 = 1800 * T4\n// Cost_D5 = 2000 * T5\n// Revenue_D1 = 1500 * T1\n// Revenue_D2 = 1800 * T2\n// Revenue_D3 = 2100 * T3\n// Revenue_D4 = 2400 * T4\n// Revenue_D5 = 2700 * T5\n// Fuel_Cost = (T1^2 + T2^2 + T3^2 + T4^2 + T5^2) * 10\n// So, the objective function is: Maximize (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5) / Fuel_Cost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for sending trucks.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination. The cost and revenue for sending a truck to each destination are given in the following Table.\n\n| Destination | Cost per Truck | Revenue per Truck |\n|-------------|----------------|-------------------|\n| D1          | $1000          | $1500             |\n| D2          | $1200          | $1800             |\n| D3          | $1500          | $2100             |\n| D4          | $1800          | $2400             |\n| D5          | $2000          | $2700             |\n\nThe company has a total budget of $10,000 for sending trucks. The company wants to maximize the net profit (revenue minus cost) per dollar spent on fuel, which is a nonlinear function of the number of trucks sent. Please help the company determine the optimal number of trucks to send to each destination to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_D1 = 1000 * T1\nCost_D2 = 1200 * T2\nCost_D3 = 1500 * T3\nCost_D4 = 1800 * T4\nCost_D5 = 2000 * T5\nRevenue_D1 = 1500 * T1\nRevenue_D2 = 1800 * T2\nRevenue_D3 = 2100 * T3\nRevenue_D4 = 2400 * T4\nRevenue_D5 = 2700 * T5\nFuel_Cost = (T1**2 + T2**2 + T3**2 + T4**2 + T5**2) * 10\n## the objective function is: Maximize (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5) / Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Cost == (Revenue_D1 - Cost_D1 + Revenue_D2 - Cost_D2 + Revenue_D3 - Cost_D3 + Revenue_D4 - Cost_D4 + Revenue_D5 - Cost_D5))\n\n# Add constraints\n## The company has a total budget of $10,000 for sending trucks.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover.\n// {\"number of refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of dry goods trucks\": \"DryGoodsTrucks\", \"range\": \"DryGoodsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average daily distance for refrigerated trucks\": \"RefrigeratedDistance\", \"range\": \"RefrigeratedDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for dry goods trucks\": \"DryGoodsDistance\", \"range\": \"DryGoodsDistance >= 0\", \"type\": \"real\"}\n// {\"average daily distance for hazardous material trucks\": \"HazardousDistance\", \"range\": \"HazardousDistance >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company wants to maximize the net profit from the fleet expansion.\n// OperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\n// OperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\n// OperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\n// Revenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\n// Revenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\n// Revenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n// So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for the initial purchase of new trucks.\n// RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000\n\n## Generate Constraint-2:\nThe total daily distance all trucks can cover is limited to 5000 miles.\n// RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// RefrigeratedTrucks >= 5\n// DryGoodsTrucks >= 5\n// HazardousTrucks >= 5\n\n## Generate Constraint-4:\nThe total number of trucks cannot exceed 20.\n// RefrigeratedTrucks + DryGoodsTrucks + HazardousTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering adding trucks to their fleet that specialize in different types of cargo: refrigerated goods, dry goods, and hazardous materials. The company needs to decide how many trucks of each type to add and the average daily distance each truck will cover. The cost of operating a refrigerated truck is $0.5 per mile, a dry goods truck is $0.3 per mile, and a hazardous material truck is $0.7 per mile. The revenue generated by a refrigerated truck is $1.2 per mile, a dry goods truck is $0.8 per mile, and a hazardous material truck is $1.5 per mile. The company has a budget of $10,000 for the initial purchase of new trucks. The total daily distance all trucks can cover is limited to 5000 miles. The company must have at least 5 trucks of each type. The total number of trucks cannot exceed 20. Please help the company to maximize the net profit from the fleet expansion.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=5)\nDryGoodsTrucks = model.addVar(vtype=\"INTEGER\", name=\"DryGoodsTrucks\", lb=5)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=5)\nRefrigeratedDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"RefrigeratedDistance\", lb=0)\nDryGoodsDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DryGoodsDistance\", lb=0)\nHazardousDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousDistance\", lb=0)\n\n# Define objective function\nOperatingCost_Refrigerated = 0.5 * RefrigeratedTrucks * RefrigeratedDistance\nOperatingCost_DryGoods = 0.3 * DryGoodsTrucks * DryGoodsDistance\nOperatingCost_Hazardous = 0.7 * HazardousTrucks * HazardousDistance\nRevenue_Refrigerated = 1.2 * RefrigeratedTrucks * RefrigeratedDistance\nRevenue_DryGoods = 0.8 * DryGoodsTrucks * DryGoodsDistance\nRevenue_Hazardous = 1.5 * HazardousTrucks * HazardousDistance\n# So, the objective function is: Maximize (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_Refrigerated + Revenue_DryGoods + Revenue_Hazardous) - (OperatingCost_Refrigerated + OperatingCost_DryGoods + OperatingCost_Hazardous))\n\n# Add constraints\n# The company has a budget of $10,000 for the initial purchase of new trucks.\nmodel.addCons(RefrigeratedTrucks * 20000 + DryGoodsTrucks * 15000 + HazardousTrucks * 25000 <= 10000)\n# The total daily distance all trucks can cover is limited to 5000 miles.\nmodel.addCons(RefrigeratedTrucks * RefrigeratedDistance + DryGoodsTrucks * DryGoodsDistance + HazardousTrucks * HazardousDistance <= 5000)\n# The company must have at least 5 trucks of each type.\nmodel.addCons(RefrigeratedTrucks >= 5)\nmodel.addCons(DryGoodsTrucks >= 5)\nmodel.addCons(HazardousTrucks >= 5)\n# The total number of trucks cannot exceed 20.\nmodel.addCons(RefrigeratedTrucks + DryGoodsTrucks + HazardousTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Dry Goods Trucks: \", model.getVal(DryGoodsTrucks))\n    print(\"Number of Hazardous Material Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Average Daily Distance for Refrigerated Trucks: \", model.getVal(RefrigeratedDistance))\n    print(\"Average Daily Distance for Dry Goods Trucks: \", model.getVal(DryGoodsDistance))\n    print(\"Average Daily Distance for Hazardous Material Trucks: \", model.getVal(HazardousDistance))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available per week.\n// DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE <= 1500",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit. The profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material. The profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material. The profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material. The profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material. The profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material. The company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency. The company has a total of 1000 labor hours available per week and 1500 units of raw material available per week. Please help the company to maximize the total profit, considering the objective function that includes a penalty for the square of labor hours and raw material usage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Convert the nonlinear objective to a linear form by introducing new variables and constraints\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\nLabor_squared = model.addVar(name=\"Labor_squared\")\nRawMaterial_squared = model.addVar(name=\"RawMaterial_squared\")\nmodel.addCons(Labor_squared == Labor**2)\nmodel.addCons(RawMaterial_squared == RawMaterial**2)\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - 0.01 * (Labor_squared + RawMaterial_squared))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n## The company has a total of 1500 units of raw material available per week.\nmodel.addCons(RawMaterial <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks allocated to Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region A: Fuel consumption rate is 0.5 liters per km, and travel time is 0.1 hours per km.\n- Region B: Fuel consumption rate is 0.6 liters per km, and travel time is 0.12 hours per km.\n- Region C: Fuel consumption rate is 0.7 liters per km, and travel time is 0.14 hours per km.\n- Region D: Fuel consumption rate is 0.8 liters per km, and travel time is 0.16 hours per km.\n- Region E: Fuel consumption rate is 0.9 liters per km, and travel time is 0.18 hours per km.\nThe company wants to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck).\n// Fuel cost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * TotalDistance\n// Time cost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * TotalDistance * HourlyRate\n// So, the objective function is: Minimize (Fuel cost + Time cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total distance covered by all trucks should not exceed 5000 km.\n// (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 5000",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time. The fuel consumption rate and travel time for each region are given in the following Table.\n\n| Region | Fuel Consumption Rate (liters/km) | Travel Time (hours/km) |\n|--------|----------------------------------|-----------------------|\n| A      | 0.5                              | 0.1                   |\n| B      | 0.6                              | 0.12                  |\n| C      | 0.7                              | 0.14                  |\n| D      | 0.8                              | 0.16                  |\n| E      | 0.9                              | 0.18                  |\n\nThe company has a total of 100 trucks available. The total distance covered by all trucks should not exceed 5000 km. The company wants to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck).\n\nPlease help the company to determine the optimal number of trucks to allocate to each region to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel cost and Time cost calculation\nFuelCost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * 5000\nTimeCost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * 5000 * 20 # assuming HourlyRate = 20\n\n## the objective function is: Minimize (Fuel cost + Time cost)\nmodel.addCons(obj == FuelCost + TimeCost)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## The total distance covered by all trucks should not exceed 5000 km.\nmodel.addCons(0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n// Net profit of M1: Profit_M1 = (5000 - 3000 - 500) * M1\n// Net profit of M2: Profit_M2 = (7000 - 4000 - 700) * M2\n// Net profit of M3: Profit_M3 = (9000 - 5000 - 900) * M3\n// Net profit of M4: Profit_M4 = (11000 - 6000 - 1100) * M4\n// Net profit of M5: Profit_M5 = (13000 - 7000 - 1300) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (M1 + M2 + M3 + M4 + M5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for production costs next month.\n// 3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine next month.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a maintenance budget of $50,000 for next month.\n// 500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\n// M4 <= M1 + M2",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company has a budget of $500,000 for production costs next month. The company wants to produce at least 5 units of each machine next month. The company has a maintenance budget of $50,000 for next month. The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\nPlease help the company to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine next month.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (5000 - 3000 - 500) * M1\nProfit_M2 = (7000 - 4000 - 700) * M2\nProfit_M3 = (9000 - 5000 - 900) * M3\nProfit_M4 = (11000 - 6000 - 1100) * M4\nProfit_M5 = (13000 - 7000 - 1300) * M5\nProductionUnits = M1 + M2 + M3 + M4 + M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / ProductionUnits\n## convert the division to multiplication\nmodel.addCons(obj * ProductionUnits == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $500,000 for production costs next month.\nmodel.addCons(3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500000)\n## The company has a maintenance budget of $50,000 for next month.\nmodel.addCons(500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50000)\n## The company wants to ensure that the total production of Machine M4 does not exceed the combined production of Machines M1 and M2.\nmodel.addCons(M4 <= M1 + M2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Net Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\n// TrucksC + TrucksD >= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks. The company wants to ensure that each route has at least one truck allocated. Please help the company to minimize the total cost of fuel and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\nmodel.addCons(TrucksC + TrucksD >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device in the next quarter, considering both internal production and outsourcing to external contractors.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"A_outsourced\", \"range\": \"A_outsourced >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"B_outsourced\", \"range\": \"B_outsourced >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"C_outsourced\", \"range\": \"C_outsourced >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceD\": \"D_outsourced\", \"range\": \"D_outsourced >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the internal production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the internal production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the internal production cost is $120, and the outsourcing cost is $140.\nFor DeviceD, the selling price is $250, the internal production cost is $150, and the outsourcing cost is $170.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the production costs for both internal and outsourced units.\n// Profit for DeviceA: Profit_A = (100 - 60) * A + (100 - 80) * A_outsourced\n// Profit for DeviceB: Profit_B = (150 - 90) * B + (150 - 110) * B_outsourced\n// Profit for DeviceC: Profit_C = (200 - 120) * C + (200 - 140) * C_outsourced\n// Profit for DeviceD: Profit_D = (250 - 150) * D + (250 - 170) * D_outsourced\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for production costs, including both internal and outsourced production.\n// 60 * A + 90 * B + 120 * C + 150 * D + 80 * A_outsourced + 110 * B_outsourced + 140 * C_outsourced + 170 * D_outsourced <= 100,000\n\n## Generate Constraint-2:\nThe company can only produce a maximum of 500 units internally across all devices.\n// A + B + C + D <= 500\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 50 units of DeviceA and DeviceB combined.\n// A + B >= 50\n\n## Generate Constraint-4:\nThe company has a contract that requires outsourcing at least 20% of the total production of DeviceC.\n// C_outsourced >= 0.2 * (C + C_outsourced)",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device in the next quarter, considering both internal production and outsourcing to external contractors.\nFor DeviceA, the selling price is $100, the internal production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the internal production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the internal production cost is $120, and the outsourcing cost is $140.\nFor DeviceD, the selling price is $250, the internal production cost is $150, and the outsourcing cost is $170.\nThe company has a budget of $100,000 for production costs, including both internal and outsourced production. The company can only produce a maximum of 500 units internally across all devices. Due to market demand, the company must produce at least 50 units of DeviceA and DeviceB combined. The company has a contract that requires outsourcing at least 20% of the total production of DeviceC.\nPlease help the company to maximize the total profit, which is the sum of the selling price minus the production costs for both internal and outsourced units.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\nA_outsourced = model.addVar(vtype=\"INTEGER\", name=\"A_outsourced\", lb=0) # number of units outsourced for DeviceA\nB_outsourced = model.addVar(vtype=\"INTEGER\", name=\"B_outsourced\", lb=0) # number of units outsourced for DeviceB\nC_outsourced = model.addVar(vtype=\"INTEGER\", name=\"C_outsourced\", lb=0) # number of units outsourced for DeviceC\nD_outsourced = model.addVar(vtype=\"INTEGER\", name=\"D_outsourced\", lb=0) # number of units outsourced for DeviceD\n\n# Define objective function\nProfit_A = (100 - 60) * A + (100 - 80) * A_outsourced\nProfit_B = (150 - 90) * B + (150 - 110) * B_outsourced\nProfit_C = (200 - 120) * C + (200 - 140) * C_outsourced\nProfit_D = (250 - 150) * D + (250 - 170) * D_outsourced\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a budget of $100,000 for production costs, including both internal and outsourced production.\nmodel.addCons(60 * A + 90 * B + 120 * C + 150 * D + 80 * A_outsourced + 110 * B_outsourced + 140 * C_outsourced + 170 * D_outsourced <= 100000)\n# The company can only produce a maximum of 500 units internally across all devices.\nmodel.addCons(A + B + C + D <= 500)\n# Due to market demand, the company must produce at least 50 units of DeviceA and DeviceB combined.\nmodel.addCons(A + B >= 50)\n# The company has a contract that requires outsourcing at least 20% of the total production of DeviceC.\nmodel.addCons(C_outsourced >= 0.2 * (C + C_outsourced))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of DeviceA outsourced: \", model.getVal(A_outsourced))\n    print(\"Number of DeviceB outsourced: \", model.getVal(B_outsourced))\n    print(\"Number of DeviceC outsourced: \", model.getVal(C_outsourced))\n    print(\"Number of DeviceD outsourced: \", model.getVal(D_outsourced))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1288,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good to optimize delivery efficiency. Additionally, the company is considering investing in a new fleet management system that can reduce the operational costs per truck, depending on the level of investment.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system for GoodsX\": \"FleetX\", \"range\": \"FleetX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsY\": \"FleetY\", \"range\": \"FleetY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsZ\": \"FleetZ\", \"range\": \"FleetZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for GoodsX: CostX = (1000 - 0.1 * FleetX) * TrucksX\n// Total operational cost for GoodsY: CostY = (1200 - 0.12 * FleetY) * TrucksY\n// Total operational cost for GoodsZ: CostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and fleet management system investments.\n// (1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 500.\n// TrucksX + TrucksY + TrucksZ <= 500",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the level of investment in a fleet management system to optimize delivery efficiency. The operational cost per truck decreases with the investment in the fleet management system. The initial cost per truck and the reduction in cost per $100 invested for each type of good are given in the following Table.\n\n| Type of Good | Initial Cost per Truck | Reduction in Cost per $100 Invested |\n|--------------|------------------------|-------------------------------------|\n| GoodsX       | $1000                  | $10                                 |\n| GoodsY       | $1200                  | $12                                 |\n| GoodsZ       | $1500                  | $15                                 |\n\nThe company has a total budget of $100,000 for truck operations and fleet management system investments. The total number of trucks available for distribution is limited to 500. Please help the company to minimize the total operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFleetX = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetX\", lb=0)  # investment in fleet management system for GoodsX\nFleetY = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetY\", lb=0)  # investment in fleet management system for GoodsY\nFleetZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetZ\", lb=0)  # investment in fleet management system for GoodsZ\n\n# Define objective function\nCostX = (1000 - 0.1 * FleetX) * TrucksX\nCostY = (1200 - 0.12 * FleetY) * TrucksY\nCostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck operations and fleet management system investments.\nmodel.addCons((1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000)\n\n# The total number of trucks available for distribution is limited to 500.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Investment in Fleet Management System for GoodsX: \", model.getVal(FleetX))\n    print(\"Investment in Fleet Management System for GoodsY: \", model.getVal(FleetY))\n    print(\"Investment in Fleet Management System for GoodsZ: \", model.getVal(FleetZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"maintenance cost per Truck\": \"TruckMaintenance\", \"range\": \"TruckMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Van\": \"VanMaintenance\", \"range\": \"VanMaintenance >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per Bike\": \"BikeMaintenance\", \"range\": \"BikeMaintenance >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Truck\": \"TruckCapacity\", \"range\": \"TruckCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Van\": \"VanCapacity\", \"range\": \"VanCapacity >= 0\", \"type\": \"real\"}\n// {\"delivery capacity per Bike\": \"BikeCapacity\", \"range\": \"BikeCapacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total delivery capacity while minimizing the total maintenance cost. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles.\n// TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n// TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n// So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance.\n// TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2 <= 10000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles (Trucks, Vans, and Bikes) and needs to determine the number of each type of vehicle to maximize efficiency while considering maintenance costs and delivery capacities. The maintenance cost for each vehicle type is a nonlinear function of the number of vehicles, and the delivery capacity is directly proportional to the number of vehicles. The company wants to maximize the total delivery capacity while minimizing the total maintenance cost.\n\n| Vehicle Type | Maintenance Cost per Vehicle | Delivery Capacity per Vehicle |\n|--------------|------------------------------|--------------------------------|\n| Trucks       | TruckMaintenance^2           | TruckCapacity                   |\n| Vans         | VanMaintenance^2             | VanCapacity                     |\n| Bikes        | BikeMaintenance^2            | BikeCapacity                    |\n\nThe company has a budget of $10,000 for vehicle maintenance. Please help the company determine the optimal number of Trucks, Vans, and Bikes to maximize the total delivery capacity minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## TotalMaintenanceCost = TruckCount * TruckMaintenance^2 + VanCount * VanMaintenance^2 + BikeCount * BikeMaintenance^2\n## TotalDeliveryCapacity = TruckCount * TruckCapacity + VanCount * VanCapacity + BikeCount * BikeCapacity\n## So, the objective function is: Maximize (TotalDeliveryCapacity - TotalMaintenanceCost)\nTotalMaintenanceCost = TruckCount * TruckCount + VanCount * VanCount + BikeCount * BikeCount  # Simplified as TruckMaintenance^2 = TruckCount, etc.\nTotalDeliveryCapacity = TruckCount + VanCount + BikeCount\nmodel.addCons(obj == TotalDeliveryCapacity - TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(TruckCount * TruckCount + VanCount * VanCount + BikeCount * BikeCount <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Small trucks\": \"EfficiencySmall\", \"range\": \"EfficiencySmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"EfficiencyMedium\", \"range\": \"EfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Large trucks\": \"EfficiencyLarge\", \"range\": \"EfficiencyLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Small trucks, the operational cost per mile is initially $0.50, and it decreases by $0.01 for every $100 invested in efficiency. For Medium trucks, the initial cost is $0.70, decreasing by $0.015 per $100 invested. For Large trucks, the initial cost is $0.90, decreasing by $0.02 per $100 invested. The company aims to minimize the total annual operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = 0.50 - 0.0001 * EfficiencySmall\n// Total operational cost for Medium trucks: CostMedium = 0.70 - 0.00015 * EfficiencyMedium\n// Total operational cost for Large trucks: CostLarge = 0.90 - 0.0002 * EfficiencyLarge\n// Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n// So, the objective function is: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The initial operational cost per mile and the rate at which it decreases with investment for each type of truck are given in the following Table.\n\n| Truck Type | Initial Operational Cost per Mile | Decrease per $100 Invested |\n|------------|-----------------------------------|----------------------------|\n| Small      | $0.50                             | $0.01                      |\n| Medium     | $0.70                             | $0.015                     |\n| Large      | $0.90                             | $0.02                      |\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency. The annual miles driven for each type of truck are known as MilesSmall, MilesMedium, and MilesLarge. \n\nPlease help the company to minimize the total annual operational cost of the fleet, which is defined as the sum of the product of the operational cost per mile and the annual miles driven for each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySmall\", lb=0)  # investment in fuel efficiency for Small trucks\nEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyMedium\", lb=0)  # investment in fuel efficiency for Medium trucks\nEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyLarge\", lb=0)  # investment in fuel efficiency for Large trucks\n\n# Define objective function\nCostSmall = 0.50 - 0.0001 * EfficiencySmall\nCostMedium = 0.70 - 0.00015 * EfficiencyMedium\nCostLarge = 0.90 - 0.0002 * EfficiencyLarge\n# Assume annual miles driven for each type of truck are given constants\nMilesSmall = 100000  # example value\nMilesMedium = 150000  # example value\nMilesLarge = 200000  # example value\n# Objective function: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\n# Assume prices for each type of truck are given constants\nPriceSmall = 50000  # example value\nPriceMedium = 70000  # example value\nPriceLarge = 90000  # example value\nmodel.addCons(SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel Efficiency for Small Trucks: \", model.getVal(EfficiencySmall))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(EfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Large Trucks: \", model.getVal(EfficiencyLarge))\n    print(\"Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines.\n// The total production per hour: P = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach machine has a maximum capacity for workers. Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\n// W1 <= 10; W2 <= 12; W3 <= 15; W4 <= 18; W5 <= 20",
        "question": "A manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency. The efficiency rate per worker for each machine is given in the following Table.\n\n| Machine | Efficiency Rate per Worker (units/hour) |\n|---------|-----------------------------------------|\n| 1       | 10                                      |\n| 2       | 12                                      |\n| 3       | 15                                      |\n| 4       | 18                                      |\n| 5       | 20                                      |\n\nThere are a total of 50 workers available. Each machine has a maximum capacity for workers: Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\n\nPlease help the plant manager to maximize the total production of all machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\nmodel.addCons(W1 <= 10)\nmodel.addCons(W2 <= 12)\nmodel.addCons(W3 <= 15)\nmodel.addCons(W4 <= 18)\nmodel.addCons(W5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(W4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(W5))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of type 1 trucks must not exceed 10.\n// T1 <= 10\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 5.\n// T5 >= 5\n\n## Generate Constraint-5:\nThe ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\n// T2 <= 2 * T3",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to minimize fuel consumption while meeting the demand for transportation.\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks consume 5 liters per km and can carry 10 tons. Type 2 trucks consume 6 liters per km and can carry 15 tons. Type 3 trucks consume 7 liters per km and can carry 20 tons. Type 4 trucks consume 8 liters per km and can carry 25 tons. Type 5 trucks consume 9 liters per km and can carry 30 tons. The company needs to transport a total of 1000 tons of goods over a distance of 500 km.\nThe total capacity of all trucks must meet or exceed the required 1000 tons. The company has a budget to purchase at most 50 trucks in total. The number of type 1 trucks must not exceed 10. The number of type 5 trucks must be at least 5. The ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\nPlease help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\nFuel = 5 * 500 * T1 + 6 * 500 * T2 + 7 * 500 * T3 + 8 * 500 * T4 + 9 * 500 * T5\n## So, the objective function is: Minimize Fuel\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of type 1 trucks must not exceed 10.\nmodel.addCons(T1 <= 10)\n## The number of type 5 trucks must be at least 5.\nmodel.addCons(T5 >= 5)\n## The ratio of type 2 trucks to type 3 trucks should not exceed 2:1.\nmodel.addCons(T2 <= 2 * T3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of goods (Electronics, Perishables, and Heavy Machinery) across five regions. The company needs to determine the number of trucks to allocate for each type of good in each region, considering the varying costs and capacities of the trucks.\n// {\"number of trucks for Electronics in Region 1\": \"ElectronicsTrucks1\", \"range\": \"ElectronicsTrucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishables in Region 1\": \"PerishablesTrucks1\", \"range\": \"PerishablesTrucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Heavy Machinery in Region 1\": \"HeavyMachineryTrucks1\", \"range\": \"HeavyMachineryTrucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Electronics in Region 2\": \"ElectronicsTrucks2\", \"range\": \"ElectronicsTrucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishables in Region 2\": \"PerishablesTrucks2\", \"range\": \"PerishablesTrucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Heavy Machinery in Region 2\": \"HeavyMachineryTrucks2\", \"range\": \"HeavyMachineryTrucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Electronics in Region 3\": \"ElectronicsTrucks3\", \"range\": \"ElectronicsTrucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishables in Region 3\": \"PerishablesTrucks3\", \"range\": \"PerishablesTrucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Heavy Machinery in Region 3\": \"HeavyMachineryTrucks3\", \"range\": \"HeavyMachineryTrucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Electronics in Region 4\": \"ElectronicsTrucks4\", \"range\": \"ElectronicsTrucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishables in Region 4\": \"PerishablesTrucks4\", \"range\": \"PerishablesTrucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Heavy Machinery in Region 4\": \"HeavyMachineryTrucks4\", \"range\": \"HeavyMachineryTrucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Electronics in Region 5\": \"ElectronicsTrucks5\", \"range\": \"ElectronicsTrucks5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishables in Region 5\": \"PerishablesTrucks5\", \"range\": \"PerishablesTrucks5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Heavy Machinery in Region 5\": \"HeavyMachineryTrucks5\", \"range\": \"HeavyMachineryTrucks5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for Electronics is $100 per day, for Perishables is $150 per day, and for Heavy Machinery is $200 per day. The company wants to minimize the total operational cost while ensuring all goods are delivered efficiently.\n// TotalCost = 100 * (ElectronicsTrucks1 + ElectronicsTrucks2 + ElectronicsTrucks3 + ElectronicsTrucks4 + ElectronicsTrucks5) + 150 * (PerishablesTrucks1 + PerishablesTrucks2 + PerishablesTrucks3 + PerishablesTrucks4 + PerishablesTrucks5) + 200 * (HeavyMachineryTrucks1 + HeavyMachineryTrucks2 + HeavyMachineryTrucks3 + HeavyMachineryTrucks4 + HeavyMachineryTrucks5)\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total number of trucks available for all regions and goods types is 50.\n// ElectronicsTrucks1 + ElectronicsTrucks2 + ElectronicsTrucks3 + ElectronicsTrucks4 + ElectronicsTrucks5 + PerishablesTrucks1 + PerishablesTrucks2 + PerishablesTrucks3 + PerishablesTrucks4 + PerishablesTrucks5 + HeavyMachineryTrucks1 + HeavyMachineryTrucks2 + HeavyMachineryTrucks3 + HeavyMachineryTrucks4 + HeavyMachineryTrucks5 <= 50",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of goods (Electronics, Perishables, and Heavy Machinery) across five regions. The company needs to determine the number of trucks to allocate for each type of good in each region, considering the varying costs and capacities of the trucks. The cost of operating a truck for Electronics is $100 per day, for Perishables is $150 per day, and for Heavy Machinery is $200 per day. The company wants to minimize the total operational cost while ensuring all goods are delivered efficiently. The total number of trucks available for all regions and goods types is 50. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks1\", lb=0)\nPerishablesTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks1\", lb=0)\nHeavyMachineryTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks1\", lb=0)\nElectronicsTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks2\", lb=0)\nPerishablesTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks2\", lb=0)\nHeavyMachineryTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks2\", lb=0)\nElectronicsTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks3\", lb=0)\nPerishablesTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks3\", lb=0)\nHeavyMachineryTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks3\", lb=0)\nElectronicsTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks4\", lb=0)\nPerishablesTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks4\", lb=0)\nHeavyMachineryTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks4\", lb=0)\nElectronicsTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks5\", lb=0)\nPerishablesTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks5\", lb=0)\nHeavyMachineryTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks5\", lb=0)\n\n# Define objective function\nTotalCost = 100 * (ElectronicsTrucks1 + ElectronicsTrucks2 + ElectronicsTrucks3 + ElectronicsTrucks4 + ElectronicsTrucks5) + \\\n            150 * (PerishablesTrucks1 + PerishablesTrucks2 + PerishablesTrucks3 + PerishablesTrucks4 + PerishablesTrucks5) + \\\n            200 * (HeavyMachineryTrucks1 + HeavyMachineryTrucks2 + HeavyMachineryTrucks3 + HeavyMachineryTrucks4 + HeavyMachineryTrucks5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks1 + ElectronicsTrucks2 + ElectronicsTrucks3 + ElectronicsTrucks4 + ElectronicsTrucks5 +\n              PerishablesTrucks1 + PerishablesTrucks2 + PerishablesTrucks3 + PerishablesTrucks4 + PerishablesTrucks5 +\n              HeavyMachineryTrucks1 + HeavyMachineryTrucks2 + HeavyMachineryTrucks3 + HeavyMachineryTrucks4 + HeavyMachineryTrucks5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Electronics in Region 1: \", model.getVal(ElectronicsTrucks1))\n    print(\"Number of trucks for Perishables in Region 1: \", model.getVal(PerishablesTrucks1))\n    print(\"Number of trucks for Heavy Machinery in Region 1: \", model.getVal(HeavyMachineryTrucks1))\n    print(\"Number of trucks for Electronics in Region 2: \", model.getVal(ElectronicsTrucks2))\n    print(\"Number of trucks for Perishables in Region 2: \", model.getVal(PerishablesTrucks2))\n    print(\"Number of trucks for Heavy Machinery in Region 2: \", model.getVal(HeavyMachineryTrucks2))\n    print(\"Number of trucks for Electronics in Region 3: \", model.getVal(ElectronicsTrucks3))\n    print(\"Number of trucks for Perishables in Region 3: \", model.getVal(PerishablesTrucks3))\n    print(\"Number of trucks for Heavy Machinery in Region 3: \", model.getVal(HeavyMachineryTrucks3))\n    print(\"Number of trucks for Electronics in Region 4: \", model.getVal(ElectronicsTrucks4))\n    print(\"Number of trucks for Perishables in Region 4: \", model.getVal(PerishablesTrucks4))\n    print(\"Number of trucks for Heavy Machinery in Region 4: \", model.getVal(HeavyMachineryTrucks4))\n    print(\"Number of trucks for Electronics in Region 5: \", model.getVal(ElectronicsTrucks5))\n    print(\"Number of trucks for Perishables in Region 5: \", model.getVal(PerishablesTrucks5))\n    print(\"Number of trucks for Heavy Machinery in Region 5: \", model.getVal(HeavyMachineryTrucks5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\n// Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\n// Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\n// Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\n// So, the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 units in total.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\n// 5 * C1 + 7 * C2 + 9 * C3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for C1 is at least 50 units and at most 200 units.\n// 50 <= C1 <= 200\n\n## Generate Constraint-4:\nThe market demand for C2 is at least 100 units and at most 300 units.\n// 100 <= C2 <= 300\n\n## Generate Constraint-5:\nThe market demand for C3 is at least 150 units and at most 400 units.\n// 150 <= C3 <= 400",
        "question": "A manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\nThe company has a limited production capacity of 500 units in total. The company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\nThe market demand for C1 is at least 50 units and at most 200 units. The market demand for C2 is at least 100 units and at most 300 units. The market demand for C3 is at least 150 units and at most 400 units.\nPlease help the company to determine the optimal quantities of C1, C2, and C3 to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200)  # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300)  # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=150, ub=400)  # quantity of C3\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\nC1_1 = model.addVar(vtype=\"INTEGER\", name=\"C1_1\", lb=50, ub=100)\nC1_2 = model.addVar(vtype=\"INTEGER\", name=\"C1_2\", lb=100, ub=200)\nC1_b1 = model.addVar(vtype=\"B\", name=\"C1_b1\")\nC1_b2 = model.addVar(vtype=\"B\", name=\"C1_b2\")\nmodel.addCons(C1_b1 + C1_b2 == 1)\nmodel.addCons(C1 == C1_1*C1_b1 + C1_2*C1_b2)\nProfit_C1 = (10 - 0.02 * (C1_2 - 100)) * C1_2 * C1_b2 + 10 * C1_1 * C1_b1\n## create piecewise variables for piecewise function: Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\nC2_1 = model.addVar(vtype=\"INTEGER\", name=\"C2_1\", lb=100, ub=200)\nC2_2 = model.addVar(vtype=\"INTEGER\", name=\"C2_2\", lb=200, ub=300)\nC2_b1 = model.addVar(vtype=\"B\", name=\"C2_b1\")\nC2_b2 = model.addVar(vtype=\"B\", name=\"C2_b2\")\nmodel.addCons(C2_b1 + C2_b2 == 1)\nmodel.addCons(C2 == C2_1*C2_b1 + C2_2*C2_b2)\nProfit_C2 = (15 - 0.03 * (C2_2 - 200)) * C2_2 * C2_b2 + 15 * C2_1 * C2_b1\n## create piecewise variables for piecewise function: Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\nC3_1 = model.addVar(vtype=\"INTEGER\", name=\"C3_1\", lb=150, ub=300)\nC3_2 = model.addVar(vtype=\"INTEGER\", name=\"C3_2\", lb=300, ub=400)\nC3_b1 = model.addVar(vtype=\"B\", name=\"C3_b1\")\nC3_b2 = model.addVar(vtype=\"B\", name=\"C3_b2\")\nmodel.addCons(C3_b1 + C3_b2 == 1)\nmodel.addCons(C3 == C3_1*C3_b1 + C3_2*C3_b2)\nProfit_C3 = (20 - 0.04 * (C3_2 - 300)) * C3_2 * C3_b2 + 20 * C3_1 * C3_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 <= 500)\nmodel.addCons(5 * C1 + 7 * C2 + 9 * C3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"GoodATrucks\", \"range\": \"GoodATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"GoodBTrucks\", \"range\": \"GoodBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"GoodCTrucks\", \"range\": \"GoodCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"GoodDTrucks\", \"range\": \"GoodDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"GoodETrucks\", \"range\": \"GoodETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated per truck is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net revenue per day.\n// Net revenue for GoodA: Revenue_GoodA = (1000 - 500) * GoodATrucks\n// Net revenue for GoodB: Revenue_GoodB = (1200 - 600) * GoodBTrucks\n// Net revenue for GoodC: Revenue_GoodC = (1400 - 700) * GoodCTrucks\n// Net revenue for GoodD: Revenue_GoodD = (1600 - 800) * GoodDTrucks\n// Net revenue for GoodE: Revenue_GoodE = (1800 - 900) * GoodETrucks\n// So, the objective function is: Maximize (Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50\n\n## Generate Constraint-2:\nDue to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB.\n// GoodATrucks <= 2 * GoodBTrucks",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated per truck is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net revenue per day.\nThe company has a total of 50 trucks available for distribution. Due to regional restrictions, the number of trucks for GoodA must not exceed twice the number of trucks for GoodB.\nPlease help the company determine the optimal allocation of trucks for each type of good to maximize their total net revenue per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nGoodATrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodATrucks\", lb=0)  # number of trucks for GoodA\nGoodBTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodBTrucks\", lb=0)  # number of trucks for GoodB\nGoodCTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodCTrucks\", lb=0)  # number of trucks for GoodC\nGoodDTrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodDTrucks\", lb=0)  # number of trucks for GoodD\nGoodETrucks = model.addVar(vtype=\"INTEGER\", name=\"GoodETrucks\", lb=0)  # number of trucks for GoodE\n\n# Define objective function\nRevenue_GoodA = (1000 - 500) * GoodATrucks\nRevenue_GoodB = (1200 - 600) * GoodBTrucks\nRevenue_GoodC = (1400 - 700) * GoodCTrucks\nRevenue_GoodD = (1600 - 800) * GoodDTrucks\nRevenue_GoodE = (1800 - 900) * GoodETrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_GoodA + Revenue_GoodB + Revenue_GoodC + Revenue_GoodD + Revenue_GoodE)\n\n# Add constraints\nmodel.addCons(GoodATrucks + GoodBTrucks + GoodCTrucks + GoodDTrucks + GoodETrucks <= 50)\nmodel.addCons(GoodATrucks <= 2 * GoodBTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(GoodATrucks))\n    print(\"Number of Trucks for GoodB: \", model.getVal(GoodBTrucks))\n    print(\"Number of Trucks for GoodC: \", model.getVal(GoodCTrucks))\n    print(\"Number of Trucks for GoodD: \", model.getVal(GoodDTrucks))\n    print(\"Number of Trucks for GoodE: \", model.getVal(GoodETrucks))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. Component A has a profit of $5 per unit and a production cost of $2 per unit. Component B has a profit of $7 per unit and a production cost of $3 per unit. Component C has a profit of $9 per unit and a production cost of $4 per unit. Component D has a profit of $11 per unit and a production cost of $5 per unit. The firm aims to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n// Profit of A: Profit_A = (5 - 2) * A\n// Profit of B: Profit_B = (7 - 3) * B\n// Profit of C: Profit_C = (9 - 4) * C\n// Profit of D: Profit_D = (11 - 5) * D\n// Production time for A: Time_A = 0.5 * A\n// Production time for B: Time_B = 0.7 * B\n// Production time for C: Time_C = 0.9 * C\n// Production time for D: Time_D = 1.1 * D\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n\n## Generate Constraint-1:\nThe firm has a budget of $1000 for production costs in the upcoming quarter.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe firm must produce at least 20 units of each component in the upcoming quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20\n\n## Generate Constraint-3:\nThe firm has a maximum of 150 hours available for production in the upcoming quarter.\n// 0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150\n\n## Generate Constraint-4:\nThe firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe firm wants to ensure that the production of Component C does not exceed twice the production of Component A.\n// C <= 2 * A",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations. The profit margin, production cost, and production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|-------------------------|\n| A         | $5              | $2                       | 0.5 hours               |\n| B         | $7              | $3                       | 0.7 hours               |\n| C         | $9              | $4                       | 0.9 hours               |\n| D         | $11             | $5                       | 1.1 hours               |\n\nThe firm has a budget of $1000 for production costs in the upcoming quarter. The firm must produce at least 20 units of each component in the upcoming quarter. The firm has a maximum of 150 hours available for production in the upcoming quarter. The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C. Additionally, the firm wants to ensure that the production of Component C does not exceed twice the production of Component A.\n\nPlease help the firm to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm must produce at least 20 units of each component in the upcoming quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (7 - 3) * B\nProfit_C = (9 - 4) * C\nProfit_D = (11 - 5) * D\nTime_A = 0.5 * A\nTime_B = 0.7 * B\nTime_C = 0.9 * C\nTime_D = 1.1 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n## convert the division to multiplication\nmodel.addCons(obj * (Time_A + Time_B + Time_C + Time_D) == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $1000 for production costs in the upcoming quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n## The firm has a maximum of 150 hours available for production in the upcoming quarter.\nmodel.addCons(0.5 * A + 0.7 * B + 0.9 * C + 1.1 * D <= 150)\n## The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The firm wants to ensure that the production of Component C does not exceed twice the production of Component A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit per Unit of Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1499,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\n// Total fuel cost for Small trucks: Cost_Small = 0.8 * (1000 / 10) * SmallTrucks\n// Total fuel cost for Medium trucks: Cost_Medium = 0.7 * (1000 / 8) * MediumTrucks\n// Total fuel cost for Large trucks: Cost_Large = 0.6 * (1000 / 6) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: Cost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\n// Total fuel cost for Hybrid trucks: Cost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the day.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, at least 10% of the fleet must be Hybrid trucks.\n// HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks)\n\n## Generate Constraint-3:\nThe company has a daily budget of $3000 for fuel costs.\n// (0.8 * (1000 / 10) * SmallTrucks) + (0.7 * (1000 / 8) * MediumTrucks) + (0.6 * (1000 / 6) * LargeTrucks) + (0.5 * (1000 / 5) * ExtraLargeTrucks) + (1.0 * (1000 / 12) * HybridTrucks) <= 3000\n\n## Generate Constraint-4:\nEach type of truck must have at least one truck deployed.\n// SmallTrucks >= 1; MediumTrucks >= 1; LargeTrucks >= 1; ExtraLargeTrucks >= 1; HybridTrucks >= 1\n\n## Generate Constraint-5:\nThe total daily distance that can be covered by the fleet is limited to 5000 km.\n// (1000 / 10) * SmallTrucks + (1000 / 8) * MediumTrucks + (1000 / 6) * LargeTrucks + (1000 / 5) * ExtraLargeTrucks + (1000 / 12) * HybridTrucks <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\nThe company has a total of 50 trucks available for the day. Due to maintenance schedules, at least 10% of the fleet must be Hybrid trucks. The company has a daily budget of $3000 for fuel costs. Each type of truck must have at least one truck deployed. The total daily distance that can be covered by the fleet is limited to 5000 km.\nPlease help the company to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=1)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=1)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=1)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=1)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=1)\n\n# Define objective function\nCost_Small = 0.8 * (1000 / 10) * SmallTrucks\nCost_Medium = 0.7 * (1000 / 8) * MediumTrucks\nCost_Large = 0.6 * (1000 / 6) * LargeTrucks\nCost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\nCost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50)\nmodel.addCons(HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks))\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid <= 3000)\nmodel.addCons((1000 / 10) * SmallTrucks + (1000 / 8) * MediumTrucks + (1000 / 6) * LargeTrucks + (1000 / 5) * ExtraLargeTrucks + (1000 / 12) * HybridTrucks <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, and for product C is $200. The production cost per unit for product A is $50, for product B is $75, and for product C is $100. The company aims to maximize the total profit, which is the difference between the revenue and the cost.\n// Profit_A = (100 - 50) * A = 50 * A\n// Profit_B = (150 - 75) * B = 75 * B\n// Profit_C = (200 - 100) * C = 100 * C\n// So, the objective function is: Maximize (50 * A + 75 * B + 100 * C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for production costs.\n// 50 * A + 75 * B + 100 * C <= 5000\n\n## Generate Constraint-2:\nThe production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 600\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units.\n// A >= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product C does not exceed the combined production of products A and B.\n// C <= A + B\n\n## Generate Constraint-5:\nThe company wants to maintain a balanced production, ensuring that the difference in production quantities between any two products does not exceed 30 units.\n// |A - B| <= 30\n// |A - C| <= 30\n// |B - C| <= 30",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $100            | $50                      |\n| B       | $150            | $75                      |\n| C       | $200            | $100                     |\n\nThe company has a total budget of $5000 for production costs. The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production. The market demand for product A is at least 50 units. The company wants to ensure that the production of product C does not exceed the combined production of products A and B. Additionally, the company wants to maintain a balanced production, ensuring that the difference in production quantities between any two products does not exceed 30 units.\n\nPlease help the company to maximize the total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 75 * B\nProfit_C = 100 * C\n# So, the objective function is: Maximize (50 * A + 75 * B + 100 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $5000 for production costs.\nmodel.addCons(50 * A + 75 * B + 100 * C <= 5000)\n# The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit. The company has a total of 600 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 600)\n# The market demand for product A is at least 50 units.\nmodel.addCons(A >= 50)\n# The company wants to ensure that the production of product C does not exceed the combined production of products A and B.\nmodel.addCons(C <= A + B)\n# The company wants to maintain a balanced production, ensuring that the difference in production quantities between any two products does not exceed 30 units.\nmodel.addCons(A - B <= 30)\nmodel.addCons(B - A <= 30)\nmodel.addCons(A - C <= 30)\nmodel.addCons(C - A <= 30)\nmodel.addCons(B - C <= 30)\nmodel.addCons(C - B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1315,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. The company aims to maximize the total profit per unit of fuel consumed.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\n// So, the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per week.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trips are made by each type of truck per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 500 hours available for all trucks to operate per week.\n// A + B + C + D + E <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E. The profit per trip and fuel consumption for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Consumption |\n|------------|-----------------|------------------|\n| A          | $500            | 10 liters        |\n| B          | $700            | 15 liters        |\n| C          | $900            | 20 liters        |\n| D          | $1100           | 25 liters        |\n| E          | $1300           | 30 liters        |\n\nThe company has a budget of $10,000 for fuel costs per week. The company wants to ensure that at least 5 trips are made by each type of truck per week. The company has a total of 500 hours available for all trucks to operate per week. \nPlease help the company to maximize the total profit per unit of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trips are made by each type of truck per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\nFuelConsumption = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n## the objective function is: Maximize (Profit) / (FuelConsumption)\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n## The company has a total of 500 hours available for all trucks to operate per week.\nmodel.addCons(A + B + C + D + E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck A: \", model.getVal(A))\n    print(\"Number of trips for truck B: \", model.getVal(B))\n    print(\"Number of trips for truck C: \", model.getVal(C))\n    print(\"Number of trips for truck D: \", model.getVal(D))\n    print(\"Number of trips for truck E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and operating cost. The company needs to determine the optimal number of each type of truck to minimize the total operating cost while meeting the delivery requirements.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operating cost for truck A is $50 per day, for truck B is $70 per day, for truck C is $90 per day, for truck D is $110 per day, and for truck E is $130 per day. The company wants to minimize the total daily operating cost.\n// Total operating cost: Cost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total daily delivery capacity required is 1000 units. Truck A can carry 10 units, truck B can carry 20 units, truck C can carry 30 units, truck D can carry 40 units, and truck E can carry 50 units.\n// 10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 per day for truck operations.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-3:\nThe company must use at least 5 trucks of any type.\n// A + B + C + D + E >= 5\n\n## Generate Constraint-4:\nThe number of truck E cannot exceed the combined number of trucks A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe total number of trucks D and E combined must not exceed 20% of the total number of trucks.\n// D + E <= 0.2 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and operating cost. The company needs to determine the optimal number of each type of truck to minimize the total operating cost while meeting the delivery requirements. The operating cost and capacity for each truck type are given in the following Table.\n\n| Truck Type | Operating Cost per Day | Capacity (Units) |\n|------------|------------------------|------------------|\n| A          | $50                    | 10               |\n| B          | $70                    | 20               |\n| C          | $90                    | 30               |\n| D          | $110                   | 40               |\n| E          | $130                   | 50               |\n\nThe total daily delivery capacity required is 1000 units. The company has a budget of $10,000 per day for truck operations. The company must use at least 5 trucks of any type. The number of truck E cannot exceed the combined number of trucks A, B, and C. The total number of trucks D and E combined must not exceed 20% of the total number of trucks.\n\nPlease help the company to minimize the total daily operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\nCost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The total daily delivery capacity required is 1000 units.\nmodel.addCons(10 * A + 20 * B + 30 * C + 40 * D + 50 * E >= 1000)\n# The company has a budget of $10,000 per day for truck operations.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n# The company must use at least 5 trucks of any type.\nmodel.addCons(A + B + C + D + E >= 5)\n# The number of truck E cannot exceed the combined number of trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n# The total number of trucks D and E combined must not exceed 20% of the total number of trucks.\nmodel.addCons(D + E <= 0.2 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons.\nFor V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons.\nFor V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons.\nFor V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons.\nFor V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons.\nThe company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance).\n// Cargo_V1 = 10 * V1\n// Cargo_V2 = 15 * V2\n// Cargo_V3 = 20 * V3\n// Cargo_V4 = 25 * V4\n// Cargo_V5 = 30 * V5\n// Maintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n// So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for maintenance costs.\n// 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100.\n// V1 + V2 + V3 + V4 + V5 <= 100",
        "question": "A logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. For V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons. For V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons. For V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons. For V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons. For V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons. The company has a budget of $50,000 for maintenance costs. The total number of vehicles cannot exceed 100. The company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance). Please help the company determine the optimal number of each type of vehicle to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of V5 vehicles\n\n# Define objective function\nCargo_V1 = 10 * V1\nCargo_V2 = 15 * V2\nCargo_V3 = 20 * V3\nCargo_V4 = 25 * V4\nCargo_V5 = 30 * V5\nMaintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n# convert the division to multiplication\nmodel.addCons(obj * Maintenance_Cost == Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5)\n\n# Add constraints\n# The company has a budget of $50,000 for maintenance costs.\nmodel.addCons(500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000)\n# The total number of vehicles cannot exceed 100.\nmodel.addCons(V1 + V2 + V3 + V4 + V5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for ProductA\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductB\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductC\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $1000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20. The selling price per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\n// Total profit for ProductB: ProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\n// Total profit for ProductC: ProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 2000 units.\n// ProductA + ProductB + ProductC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product to maximize profit while considering the varying costs and market demands. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product. The energy cost per unit for each product decreases by $2 for every $1000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20. The selling price per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company has a total budget of $50,000 for energy efficiency upgrades. The total production capacity for all products is limited to 2000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0)  # investment in energy efficiency for ProductA\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0)  # investment in energy efficiency for ProductB\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0)  # investment in energy efficiency for ProductC\n\n# Define objective function\nProfitA = (50 - 10 + 0.002 * EnergyEfficiencyA) * ProductA\nProfitB = (60 - 15 + 0.002 * EnergyEfficiencyB) * ProductB\nProfitC = (70 - 20 + 0.002 * EnergyEfficiencyC) * ProductC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $50,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC <= 50000)\n# The total production capacity for all products is limited to 2000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Energy Efficiency for ProductA: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for ProductB: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for ProductC: \", model.getVal(EnergyEfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all product lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in efficiency upgrades cannot exceed $50,000.\n// InvestmentA + InvestmentB + InvestmentC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n// WorkersA >= 30; WorkersB >= 40\n\n## Generate Constraint-5:\nThe production quantity of ProductC must be at least half of the total production quantity of ProductA and ProductB.\n// QuantityC >= 0.5 * (QuantityA + QuantityB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 100 workers available for all product lines. The total capital investment in efficiency upgrades cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB. The production quantity of ProductC must be at least half of the total production quantity of ProductA and ProductB.\n\nPlease help the company to determine the optimal production quantities, worker assignments, and capital investments to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=30) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=40) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0) # capital investment for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0) # capital investment for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0) # capital investment for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 50000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\nmodel.addCons(WorkersA >= 30)\nmodel.addCons(WorkersB >= 40)\nmodel.addCons(QuantityC >= 0.5 * (QuantityA + QuantityB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment for ProductA: \", model.getVal(InvestmentA))\n    print(\"Capital Investment for ProductB: \", model.getVal(InvestmentB))\n    print(\"Capital Investment for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the cost per kilometer is $2, the fuel efficiency is 5 km/liter, and the maintenance cost is $1000 per quarter.\nFor Truck B, the cost per kilometer is $3, the fuel efficiency is 4 km/liter, and the maintenance cost is $1500 per quarter.\nFor Truck C, the cost per kilometer is $4, the fuel efficiency is 3 km/liter, and the maintenance cost is $2000 per quarter.\nFor Van D, the cost per kilometer is $1.5, the fuel efficiency is 6 km/liter, and the maintenance cost is $800 per quarter.\nFor Van E, the cost per kilometer is $1, the fuel efficiency is 7 km/liter, and the maintenance cost is $500 per quarter.\nThe company wants to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies.\n// Total cost for Truck A: Cost_A = 2 * (5 * TruckA) + 1000\n// Total cost for Truck B: Cost_B = 3 * (4 * TruckB) + 1500\n// Total cost for Truck C: Cost_C = 4 * (3 * TruckC) + 2000\n// Total cost for Van D: Cost_D = 1.5 * (6 * VanD) + 800\n// Total cost for Van E: Cost_E = 1 * (7 * VanE) + 500\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter.\n// 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000\n\n## Generate Constraint-2:\nThe company plans to cover at least 50,000 kilometers next quarter.\n// 5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE >= 50000",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes.\nFor Truck A, the cost per kilometer is $2, the fuel efficiency is 5 km/liter, and the maintenance cost is $1000 per quarter.\nFor Truck B, the cost per kilometer is $3, the fuel efficiency is 4 km/liter, and the maintenance cost is $1500 per quarter.\nFor Truck C, the cost per kilometer is $4, the fuel efficiency is 3 km/liter, and the maintenance cost is $2000 per quarter.\nFor Van D, the cost per kilometer is $1.5, the fuel efficiency is 6 km/liter, and the maintenance cost is $800 per quarter.\nFor Van E, the cost per kilometer is $1, the fuel efficiency is 7 km/liter, and the maintenance cost is $500 per quarter.\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter. The company plans to cover at least 50,000 kilometers next quarter.\nPlease help the company to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * (5 * TruckA) + 1000\nCost_B = 3 * (4 * TruckB) + 1500\nCost_C = 4 * (3 * TruckC) + 2000\nCost_D = 1.5 * (6 * VanD) + 800\nCost_E = 1 * (7 * VanE) + 500\nFuelEfficiency = 5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / FuelEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * FuelEfficiency == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle maintenance for the next quarter.\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000)\n## The company plans to cover at least 50,000 kilometers next quarter.\nmodel.addCons(5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Van E: \", model.getVal(VanE))\n    print(\"Minimized Total Cost Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability.\n// {\"number of Small wind farms\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"investment in Small wind farms\": \"Investment_Small\", \"range\": \"Investment_Small >= 0\", \"type\": \"continuous\"}\n// {\"investment in Medium wind farms\": \"Investment_Medium\", \"range\": \"Investment_Medium >= 0\", \"type\": \"continuous\"}\n// {\"investment in Large wind farms\": \"Investment_Large\", \"range\": \"Investment_Large >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n// Energy_Small = 10 * Small + 0.001 * Investment_Small * Small\n// Energy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\n// Energy_Large = 30 * Large + 0.002 * Investment_Large * Large\n// So, the objective function is: Maximize (Energy_Small + Energy_Medium + Energy_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for construction and investment in wind farms.\n// 10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000\n\n## Generate Constraint-2:\nThe total number of wind farms cannot exceed 100 due to land availability and zoning restrictions.\n// Small + Medium + Large <= 100\n\n## Generate Constraint-3:\nDue to local regulations, at least 20% of the total wind farms must be Small or Medium sized.\n// Small + Medium >= 0.2 * (Small + Medium + Large)",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to construct and the level of investment in each farm to optimize energy output and profitability. The energy output and profitability of each wind farm type are affected by the investment level. For Small wind farms, each additional $1000 investment increases the energy output by 1 MWh. For Medium wind farms, each additional $1000 investment increases the energy output by 1.5 MWh. For Large wind farms, each additional $1000 investment increases the energy output by 2 MWh. The company aims to maximize the total energy output, which directly correlates with the profit.\n\n| Wind Farm Type | Base Energy Output (MWh) | Investment Impact per $1000 |\n|----------------|--------------------------|-----------------------------|\n| Small          | 10                       | 1 MWh                       |\n| Medium         | 20                       | 1.5 MWh                     |\n| Large          | 30                       | 2 MWh                       |\n\nThe company has a total budget of $1,000,000 for construction and investment in wind farms. The total number of wind farms cannot exceed 100 due to land availability and zoning restrictions. Due to local regulations, at least 20% of the total wind farms must be Small or Medium sized.\n\nPlease help the company to maximize the total energy output (which is defined as the sum of the energy output from Small, Medium, and Large wind farms).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of Small wind farms\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of Medium wind farms\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of Large wind farms\nInvestment_Small = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Small\", lb=0)  # investment in Small wind farms\nInvestment_Medium = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Medium\", lb=0)  # investment in Medium wind farms\nInvestment_Large = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment_Large\", lb=0)  # investment in Large wind farms\n\n# Define objective function\nEnergy_Small = 10 * Small + 0.001 * Investment_Small * Small\nEnergy_Medium = 20 * Medium + 0.0015 * Investment_Medium * Medium\nEnergy_Large = 30 * Large + 0.002 * Investment_Large * Large\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Small + Energy_Medium + Energy_Large)\n\n# Add constraints\nmodel.addCons(10000 * Small + 20000 * Medium + 30000 * Large + Investment_Small + Investment_Medium + Investment_Large <= 1000000)\nmodel.addCons(Small + Medium + Large <= 100)\nmodel.addCons(Small + Medium >= 0.2 * (Small + Medium + Large))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small wind farms: \", model.getVal(Small))\n    print(\"Number of Medium wind farms: \", model.getVal(Medium))\n    print(\"Number of Large wind farms: \", model.getVal(Large))\n    print(\"Investment in Small wind farms: \", model.getVal(Investment_Small))\n    print(\"Investment in Medium wind farms: \", model.getVal(Investment_Medium))\n    print(\"Investment in Large wind farms: \", model.getVal(Investment_Large))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1552,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to maintain service levels.\n// TrucksNorth >= 10; TrucksSouth >= 10; TrucksEast >= 10; TrucksWest >= 10; TrucksCentral >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100\n\n## Generate Constraint-4:\nDue to regional regulations, the fuel budget for each region must not exceed 30% of the total fuel budget.\n// FuelBudgetNorth <= 0.3 * 100000; FuelBudgetSouth <= 0.3 * 100000; FuelBudgetEast <= 0.3 * 100000; FuelBudgetWest <= 0.3 * 100000; FuelBudgetCentral <= 0.3 * 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost function is given by: Cost = a * (FuelBudget)^(-b) + c, and a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n\nThe company has a total fuel budget of $100,000. Each region must have at least 10 trucks to maintain service levels, and the total number of trucks across all regions must not exceed 100. Due to regional regulations, the fuel budget for each region must not exceed 30% of the total fuel budget.\n\nPlease help the company to determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 10 trucks to maintain service levels.\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=10)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=10)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=10)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=10)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=10)\n\n## Define fuel budgets with upper bounds based on regional regulations.\nFuelBudgetNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetNorth\", lb=0, ub=0.3 * 100000)\nFuelBudgetSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetSouth\", lb=0, ub=0.3 * 100000)\nFuelBudgetEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetEast\", lb=0, ub=0.3 * 100000)\nFuelBudgetWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetWest\", lb=0, ub=0.3 * 100000)\nFuelBudgetCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetCentral\", lb=0, ub=0.3 * 100000)\n\n# Define objective function\n## The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\n## Cost = a * (FuelBudget)^(-b) + c\n## FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n## FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n## FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n## FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n## FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n## So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n## The total number of trucks across all regions must not exceed 100.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget in North: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget in South: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget in East: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget in West: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget in Central: \", model.getVal(FuelBudgetCentral))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1 trips\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2 trips\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3 trips\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4 trips\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5 trips\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each trip is a nonlinear function of the fuel budget allocated, influenced by factors such as fuel efficiency and distance. The fuel cost for trips to City1 is $0.05 * (FuelBudget1^2), to City2 is $0.06 * (FuelBudget2^2), to City3 is $0.07 * (FuelBudget3^2), to City4 is $0.08 * (FuelBudget4^2), and to City5 is $0.09 * (FuelBudget5^2). The company aims to minimize the total fuel cost across all cities.\n// Total fuel cost for City1: FuelCost1 = 0.05 * (FuelBudget1^2) * Trips1\n// Total fuel cost for City2: FuelCost2 = 0.06 * (FuelBudget2^2) * Trips2\n// Total fuel cost for City3: FuelCost3 = 0.07 * (FuelBudget3^2) * Trips3\n// Total fuel cost for City4: FuelCost4 = 0.08 * (FuelBudget4^2) * Trips4\n// Total fuel cost for City5: FuelCost5 = 0.09 * (FuelBudget5^2) * Trips5\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10,000 for all routes.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 10000\n\n## Generate Constraint-2:\nThe company must make at least 50 trips to City1, 75 trips to City2, 100 trips to City3, 125 trips to City4, and 150 trips to City5.\n// Trips1 >= 50; Trips2 >= 75; Trips3 >= 100; Trips4 >= 125; Trips5 >= 150\n\n## Generate Constraint-3:\nThe total number of trips across all cities must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-4:\nThe fuel budget for each city must be at least 10% of the total fuel budget allocated to that city's trips.\n// FuelBudget1 >= 0.1 * (FuelBudget1 * Trips1); FuelBudget2 >= 0.1 * (FuelBudget2 * Trips2); FuelBudget3 >= 0.1 * (FuelBudget3 * Trips3); FuelBudget4 >= 0.1 * (FuelBudget4 * Trips4); FuelBudget5 >= 0.1 * (FuelBudget5 * Trips5)\n\n## Generate Constraint-5:\nThe fuel cost for trips to City4 must not exceed the combined fuel costs of trips to City1, City2, and City3.\n// FuelCost4 <= FuelCost1 + FuelCost2 + FuelCost3",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each trip is a nonlinear function of the fuel budget allocated, influenced by factors such as fuel efficiency and distance. The fuel cost for trips to City1 is $0.05 * (FuelBudget1^2), to City2 is $0.06 * (FuelBudget2^2), to City3 is $0.07 * (FuelBudget3^2), to City4 is $0.08 * (FuelBudget4^2), and to City5 is $0.09 * (FuelBudget5^2). The company has a total fuel budget of $10,000 for all routes. The company must make at least 50 trips to City1, 75 trips to City2, 100 trips to City3, 125 trips to City4, and 150 trips to City5. The total number of trips across all cities must not exceed 500. The fuel budget for each city must be at least 10% of the total fuel budget allocated to that city's trips. The fuel cost for trips to City4 must not exceed the combined fuel costs of trips to City1, City2, and City3. Please help the company to minimize the total fuel cost across all cities.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=100)\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=125)\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=150)\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0)\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0)\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0)\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0)\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0)\n\n# Define objective function\nFuelCost1 = 0.05 * (FuelBudget1**2) * Trips1\nFuelCost2 = 0.06 * (FuelBudget2**2) * Trips2\nFuelCost3 = 0.07 * (FuelBudget3**2) * Trips3\nFuelCost4 = 0.08 * (FuelBudget4**2) * Trips4\nFuelCost5 = 0.09 * (FuelBudget5**2) * Trips5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 10000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(FuelBudget1 >= 0.1 * (FuelBudget1 * Trips1))\nmodel.addCons(FuelBudget2 >= 0.1 * (FuelBudget2 * Trips2))\nmodel.addCons(FuelBudget3 >= 0.1 * (FuelBudget3 * Trips3))\nmodel.addCons(FuelBudget4 >= 0.1 * (FuelBudget4 * Trips4))\nmodel.addCons(FuelBudget5 >= 0.1 * (FuelBudget5 * Trips5))\nmodel.addCons(FuelCost4 <= FuelCost1 + FuelCost2 + FuelCost3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to City1: \", model.getVal(Trips1))\n    print(\"Number of trips to City2: \", model.getVal(Trips2))\n    print(\"Number of trips to City3: \", model.getVal(Trips3))\n    print(\"Number of trips to City4: \", model.getVal(Trips4))\n    print(\"Number of trips to City5: \", model.getVal(Trips5))\n    print(\"Fuel budget for City1 trips: \", model.getVal(FuelBudget1))\n    print(\"Fuel budget for City2 trips: \", model.getVal(FuelBudget2))\n    print(\"Fuel budget for City3 trips: \", model.getVal(FuelBudget3))\n    print(\"Fuel budget for City4 trips: \", model.getVal(FuelBudget4))\n    print(\"Fuel budget for City5 trips: \", model.getVal(FuelBudget5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Small trucks\": \"EfficiencySmall\", \"range\": \"EfficiencySmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"EfficiencyMedium\", \"range\": \"EfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Large trucks\": \"EfficiencyLarge\", \"range\": \"EfficiencyLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Small trucks, the operational cost per mile is initially $0.50, and it decreases by $0.01 for every $100 invested in efficiency. For Medium trucks, the initial cost is $0.70, decreasing by $0.015 per $100 invested. For Large trucks, the initial cost is $0.90, decreasing by $0.02 per $100 invested. The company aims to minimize the total annual operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = 0.50 - 0.0001 * EfficiencySmall\n// Total operational cost for Medium trucks: CostMedium = 0.70 - 0.00015 * EfficiencyMedium\n// Total operational cost for Large trucks: CostLarge = 0.90 - 0.0002 * EfficiencyLarge\n// Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n// So, the objective function is: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 200\n\n## Generate Constraint-3:\nDue to market demand, the company must have at least 50 Small trucks and 30 Large trucks.\n// SmallTrucks >= 50; LargeTrucks >= 30",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The initial operational cost per mile and the rate at which it decreases with investment for each type of truck are given in the following Table.\n\n| Truck Type | Initial Operational Cost per Mile | Decrease per $100 Invested |\n|------------|----------------------------------|---------------------------|\n| Small      | $0.50                            | $0.01                     |\n| Medium     | $0.70                            | $0.015                    |\n| Large      | $0.90                            | $0.02                     |\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency. The total number of trucks cannot exceed 200. Due to market demand, the company must have at least 50 Small trucks and 30 Large trucks. \n\nPlease help the company to minimize the total annual operational cost of the fleet, considering the annual miles driven for each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=50)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=30)  # number of Large trucks\nEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySmall\", lb=0)  # investment in fuel efficiency for Small trucks\nEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyMedium\", lb=0)  # investment in fuel efficiency for Medium trucks\nEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyLarge\", lb=0)  # investment in fuel efficiency for Large trucks\n\n# Define objective function\nCostSmall = 0.50 - 0.0001 * EfficiencySmall  # Total operational cost for Small trucks\nCostMedium = 0.70 - 0.00015 * EfficiencyMedium  # Total operational cost for Medium trucks\nCostLarge = 0.90 - 0.0002 * EfficiencyLarge  # Total operational cost for Large trucks\n# Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n# So, the objective function is: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall * SmallTrucks + CostMedium * MediumTrucks + CostLarge * LargeTrucks)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000)\n# The total number of trucks cannot exceed 200.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel Efficiency for Small Trucks: \", model.getVal(EfficiencySmall))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(EfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Large Trucks: \", model.getVal(EfficiencyLarge))\n    print(\"Minimized Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. Each type of truck has different operational costs and revenue generation capabilities, as shown in the following Table.\n\n| Truck Type | Operational Cost per Day | Revenue per Day |\n|------------|--------------------------|-----------------|\n| TruckA     | $500                     | $1000           |\n| TruckB     | $600                     | $1200           |\n| TruckC     | $700                     | $1400           |\n| TruckD     | $800                     | $1600           |\n| TruckE     | $900                     | $1800           |\n\nThe company aims to maximize the total daily net profit (revenue minus operational cost) per truck. The company has a total budget of $150,000 for operational costs for the month. Please help the company determine the optimal number of each type of truck to deploy to maximize their daily net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Daily Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available across all products cannot exceed 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level. The labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products. The total workforce available across all products cannot exceed 100 employees.\n\nPlease help the company to determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\nProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\nProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkforceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and cost structure. The efficiency of producing component 1 on line 1 is 10 units per hour, and the cost is $5 per hour. On line 2, it's 15 units per hour at a cost of $7 per hour. On line 3, it's 20 units per hour at a cost of $9 per hour. On line 4, it's 25 units per hour at a cost of $11 per hour. On line 5, it's 30 units per hour at a cost of $13 per hour. The company aims to maximize the total production of component 1 while minimizing the total cost.\n// The total production of component 1: Q1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5\n// The total cost: C = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5\n// So, the objective function is: Maximize (Q1 - C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 100 hours.\n// P1 + P2 + P3 + P4 + P5 <= 100",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of hours each production line should operate to optimize production. Each production line has a different efficiency and cost structure. The efficiency of producing component 1 on line 1 is 10 units per hour, and the cost is $5 per hour. On line 2, it's 15 units per hour at a cost of $7 per hour. On line 3, it's 20 units per hour at a cost of $9 per hour. On line 4, it's 25 units per hour at a cost of $11 per hour. On line 5, it's 30 units per hour at a cost of $13 per hour. The company aims to maximize the total production of component 1 while minimizing the total cost. The total available hours for all production lines is 100 hours. Please help the company to maximize the total production of component 1 while minimizing the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=0) # hours for production line 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=0) # hours for production line 5\n\n# Define objective function\nQ1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4 + 30 * P5 # total production of component 1\nC = 5 * P1 + 7 * P2 + 9 * P3 + 11 * P4 + 13 * P5 # total cost\n# So, the objective function is: Maximize (Q1 - C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Q1 - C)\n\n# Add constraints\n# The total available hours for all production lines is 100 hours.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Hours for Production Line 4: \", model.getVal(P4))\n    print(\"Hours for Production Line 5: \", model.getVal(P5))\n    print(\"Maximized Production of Component 1 - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel efficiencies and maintenance costs. \nFor WarehouseA, the cost per truck is $500 per day.\nFor WarehouseB, the cost per truck is $600 per day.\nFor WarehouseC, the cost per truck is $700 per day.\nFor WarehouseD, the cost per truck is $800 per day.\nFor WarehouseE, the cost per truck is $900 per day.\nThe company wants to minimize the total daily cost of operating all trucks.\n// Total cost for WarehouseA: CostA = 500 * TrucksA\n// Total cost for WarehouseB: CostB = 600 * TrucksB\n// Total cost for WarehouseC: CostC = 700 * TrucksC\n// Total cost for WarehouseD: CostD = 800 * TrucksD\n// Total cost for WarehouseE: CostE = 900 * TrucksE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nEach warehouse must have at least one truck to ensure basic operations.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company operates five different warehouses: WarehouseA, WarehouseB, WarehouseC, WarehouseD, and WarehouseE. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| WarehouseA | $500                  |\n| WarehouseB | $600                  |\n| WarehouseC | $700                  |\n| WarehouseD | $800                  |\n| WarehouseE | $900                  |\n\nThe company has a total of 40 trucks available for allocation. Each warehouse must have at least one truck to ensure basic operations. Please help the company to minimize the total daily cost of operating all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each warehouse must have at least one truck to ensure basic operations.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1) # number of trucks for WarehouseC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1) # number of trucks for WarehouseD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1) # number of trucks for WarehouseE\n\n# Define objective function\n## The company wants to minimize the total daily cost of operating all trucks.\nCostA = 500 * TrucksA\nCostB = 600 * TrucksB\nCostC = 700 * TrucksC\nCostD = 800 * TrucksD\nCostE = 900 * TrucksE\n## So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for WarehouseD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for WarehouseE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, production time, and market demand.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"production time per unit of ProductA\": \"TimeA\", \"range\": \"TimeA >= 0\", \"type\": \"continuous\"}\n// {\"production time per unit of ProductB\": \"TimeB\", \"range\": \"TimeB >= 0\", \"type\": \"continuous\"}\n// {\"production time per unit of ProductC\": \"TimeC\", \"range\": \"TimeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, with a production time of TimeA hours and a raw material cost of $30. \nThe profit per unit of ProductB is $120, with a production time of TimeB hours and a raw material cost of $40. \nThe profit per unit of ProductC is $150, with a production time of TimeC hours and a raw material cost of $50. \nThe company aims to maximize the total profit, considering the nonlinear relationship between production time and profit due to varying efficiency levels at different production volumes.\n// Profit_ProductA = 100 * ProductA - 30 * ProductA - TimeA * ProductA^2\n// Profit_ProductB = 120 * ProductB - 40 * ProductB - TimeB * ProductB^2\n// Profit_ProductC = 150 * ProductC - 50 * ProductC - TimeC * ProductC^2\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours.\n// TimeA * ProductA + TimeB * ProductB + TimeC * ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $40,000 for raw materials.\n// 30 * ProductA + 40 * ProductB + 50 * ProductC <= 40000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 200 units, and for ProductB is 150 units.\n// ProductA <= 200; ProductB <= 150\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductC to fulfill a contract.\n// ProductC >= 50\n\n## Generate Constraint-5:\nThe production time for each product cannot exceed 50 hours.\n// TimeA <= 50; TimeB <= 50; TimeC <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, production time, and market demand. The profit per unit, production time, and raw material cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit | Raw Material Cost per Unit |\n|---------|-----------------|--------------------------|---------------------------|\n| ProductA | $100 | TimeA hours | $30 |\n| ProductB | $120 | TimeB hours | $40 |\n| ProductC | $150 | TimeC hours | $50 |\n\nThe company has a total production capacity of 1000 hours. The company has a budget of $40,000 for raw materials. The market demand for ProductA is 200 units, and for ProductB is 150 units. The company must produce at least 50 units of ProductC to fulfill a contract. The production time for each product cannot exceed 50 hours. \n\nPlease help the company to maximize the total profit, considering the nonlinear relationship between production time and profit due to varying efficiency levels at different production volumes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=150)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50, ub=1000)  # quantity of ProductC\nTimeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeA\", lb=0, ub=50)  # production time per unit of ProductA\nTimeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeB\", lb=0, ub=50)  # production time per unit of ProductB\nTimeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeC\", lb=0, ub=50)  # production time per unit of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_ProductA = 100 * ProductA - 30 * ProductA - TimeA * ProductA**2\nProfit_ProductB = 120 * ProductB - 40 * ProductB - TimeB * ProductB**2\nProfit_ProductC = 150 * ProductC - 50 * ProductC - TimeC * ProductC**2\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours.\nmodel.addCons(TimeA * ProductA + TimeB * ProductB + TimeC * ProductC <= 1000)\n## The company has a budget of $40,000 for raw materials.\nmodel.addCons(30 * ProductA + 40 * ProductB + 50 * ProductC <= 40000)\n## The market demand for ProductA is 200 units, and for ProductB is 150 units.\nmodel.addCons(ProductA <= 200)\nmodel.addCons(ProductB <= 150)\n## The company must produce at least 50 units of ProductC to fulfill a contract.\nmodel.addCons(ProductC >= 50)\n## The production time for each product cannot exceed 50 hours.\nmodel.addCons(TimeA <= 50)\nmodel.addCons(TimeB <= 50)\nmodel.addCons(TimeC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1193,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production. Additionally, the company must determine the number of hours of maintenance each machine requires daily.\n// {\"number of operating hours for MachineA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n// Net revenue for MachineA: RevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\n// Net revenue for MachineB: RevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\n// Net revenue for MachineC: RevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total daily operating hours for all machines must not exceed 24 hours.\n// HoursA + HoursB + HoursC <= 24\n\n## Generate Constraint-2:\nThe total daily maintenance hours for all machines must not exceed 8 hours.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 8\n\n## Generate Constraint-3:\nMachineA must operate at least 2 hours daily.\n// HoursA >= 2",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production, as well as the number of hours of maintenance each machine requires daily. The revenue, cost, and maintenance cost per hour for each machine are given in the following Table.\n\n| Machine | Revenue per Hour | Cost per Hour | Maintenance Cost per Hour |\n|---------|------------------|---------------|---------------------------|\n| MachineA | $500            | $200          | $100                      |\n| MachineB | $700            | $300          | $100                      |\n| MachineC | $900            | $400          | $100                      |\n\nThe company aims to maximize the total net revenue per day. The total daily operating hours for all machines must not exceed 24 hours. The total daily maintenance hours for all machines must not exceed 8 hours. MachineA must operate at least 2 hours daily.\n\nPlease help the company determine the optimal number of operating and maintenance hours for each machine to maximize the total net revenue per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=2)  # number of operating hours for MachineA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # number of operating hours for MachineB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # number of operating hours for MachineC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # number of maintenance hours for MachineA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # number of maintenance hours for MachineB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # number of maintenance hours for MachineC\n\n# Define objective function\nRevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\nRevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\nRevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 24)\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for MachineA: \", model.getVal(HoursA))\n    print(\"Operating Hours for MachineB: \", model.getVal(HoursB))\n    print(\"Operating Hours for MachineC: \", model.getVal(HoursC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily to maximize energy production. Additionally, the company is considering investing in energy storage systems for each type of power plant to enhance efficiency and stability of power output.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Solar\": \"SolarStorage\", \"range\": \"SolarStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Wind\": \"WindStorage\", \"range\": \"WindStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Hydro\": \"HydroStorage\", \"range\": \"HydroStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company aims to maximize the total daily energy production.\n// Total energy for Solar: EnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\n// Total energy for Wind: EnergyWind = (120 + 0.0008 * WindStorage) * WindHours\n// Total energy for Hydro: EnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and energy storage investments.\n// 1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily and the investment in energy storage systems for each type to maximize energy production. The relationship between investment in energy storage and energy output for each power plant is given in the following Table.\n\n| Power Plant | Energy Output per Hour without Storage | Additional Output per $1000 Storage Investment |\n|-------------|---------------------------------------|-----------------------------------------------|\n| Solar       | 100 MWh                               | 1 MWh                                         |\n| Wind        | 120 MWh                               | 0.8 MWh                                       |\n| Hydro       | 150 MWh                               | 1.2 MWh                                       |\n\nThe company has a total budget of $100,000 for operating costs and energy storage investments. Please help the company to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of operating hours for Hydro\nSolarStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarStorage\", lb=0)  # investment in energy storage for Solar\nWindStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"WindStorage\", lb=0)  # investment in energy storage for Wind\nHydroStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroStorage\", lb=0)  # investment in energy storage for Hydro\n\n# Define objective function\nEnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\nEnergyWind = (120 + 0.0008 * WindStorage) * WindHours\nEnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Solar Storage: \", model.getVal(SolarStorage))\n    print(\"Investment in Wind Storage: \", model.getVal(WindStorage))\n    print(\"Investment in Hydro Storage: \", model.getVal(HydroStorage))\n    print(\"Total Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\n// {\"number of trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"fuel-efficient upgrades per truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"maintenance frequency\": \"MaintenanceFreq\", \"range\": \"MaintenanceFreq >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\n// FuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount^2\n// MaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq^2 * TruckCount\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\n// FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000\n\n## Generate Constraint-2:\nThe minimum number of trucks required for the route is 10.\n// TruckCount >= 10\n\n## Generate Constraint-3:\nThe maximum number of maintenance checks allowed per truck is 12 per year.\n// MaintenanceFreq <= 12\n\n## Generate Constraint-4:\nThe total weight capacity of all trucks combined must not exceed 1000 tons.\n// TruckCount <= 1000\n\n## Generate Constraint-5:\nThe fuel-efficient upgrades must not exceed $5000 per truck.\n// FuelUpgrade <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks. The minimum number of trucks required for the route is 10. The maximum number of maintenance checks allowed per truck is 12 per year. The total weight capacity of all trucks combined must not exceed 1000 tons. The fuel-efficient upgrades must not exceed $5000 per truck.\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=10)  # number of trucks\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0)  # fuel-efficient upgrades per truck\nMaintenanceFreq = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceFreq\", lb=0, ub=12)  # maintenance frequency\n\n# Define objective function\nFuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount**2\nMaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq**2 * TruckCount\n# So, the objective function is: Minimize (FuelCost + MaintenanceCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\nmodel.addCons(FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000)\n# The minimum number of trucks required for the route is 10.\nmodel.addCons(TruckCount >= 10)\n# The maximum number of maintenance checks allowed per truck is 12 per year.\nmodel.addCons(MaintenanceFreq <= 12)\n# The total weight capacity of all trucks combined must not exceed 1000 tons.\nmodel.addCons(TruckCount <= 1000)\n# The fuel-efficient upgrades must not exceed $5000 per truck.\nmodel.addCons(FuelUpgrade <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Fuel-efficient Upgrades per Truck: \", model.getVal(FuelUpgrade))\n    print(\"Maintenance Frequency: \", model.getVal(MaintenanceFreq))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1344,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift.\n// {\"production quantity for product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product A\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product B\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product C\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the production cost per unit is $50, and the revenue per unit is $100. Each shift increases the production capacity by 100 units.\nFor product B, the production cost per unit is $70, and the revenue per unit is $140. Each shift increases the production capacity by 120 units.\nFor product C, the production cost per unit is $60, and the revenue per unit is $120. Each shift increases the production capacity by 110 units.\nThe company wants to maximize the total net profit.\n// NetProfit_A = (100 - 50) * ProdA\n// NetProfit_B = (140 - 70) * ProdB\n// NetProfit_C = (120 - 60) * ProdC\n// TotalProduction_A = ShiftA * 100\n// TotalProduction_B = ShiftB * 120\n// TotalProduction_C = ShiftC * 110\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) subject to the production constraints.\n\n## Generate Constraint-1:\nThe company has a total of 500 units of raw materials available.\n// ProdA + ProdB + ProdC <= 500\n\n## Generate Constraint-2:\nThe company can operate a maximum of 5 shifts in total.\n// ShiftA + ShiftB + ShiftC <= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift. For product A, the production cost per unit is $50, and the revenue per unit is $100. Each shift increases the production capacity by 100 units. For product B, the production cost per unit is $70, and the revenue per unit is $140. Each shift increases the production capacity by 120 units. For product C, the production cost per unit is $60, and the revenue per unit is $120. Each shift increases the production capacity by 110 units. The company has a total of 500 units of raw materials available and can operate a maximum of 5 shifts in total. The company wants to maximize the total net profit. Please help the company determine the optimal production quantities and shifts for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for product C\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0) # number of shifts for product A\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0) # number of shifts for product B\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0) # number of shifts for product C\n\n# Define objective function\nNetProfit_A = (100 - 50) * ProdA\nNetProfit_B = (140 - 70) * ProdB\nNetProfit_C = (120 - 60) * ProdC\nTotalProduction_A = ShiftA * 100\nTotalProduction_B = ShiftB * 120\nTotalProduction_C = ShiftC * 110\nmodel.addCons(ProdA <= TotalProduction_A)\nmodel.addCons(ProdB <= TotalProduction_B)\nmodel.addCons(ProdC <= TotalProduction_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n# The company has a total of 500 units of raw materials available.\nmodel.addCons(ProdA + ProdB + ProdC <= 500)\n# The company can operate a maximum of 5 shifts in total.\nmodel.addCons(ShiftA + ShiftB + ShiftC <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts for Product A: \", model.getVal(ShiftA))\n    print(\"Number of Shifts for Product B: \", model.getVal(ShiftB))\n    print(\"Number of Shifts for Product C: \", model.getVal(ShiftC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet usage for delivering goods across five regions: North, South, East, West, and Central. The company has to decide the number of trucks to allocate to each region.\n// {\"number of trucks in North region\": \"North\", \"range\": \"North >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"South\", \"range\": \"South >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"East\", \"range\": \"East >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"West\", \"range\": \"West >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"Central\", \"range\": \"Central >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in the North region is $100 per day, with a delivery efficiency of 1.2 deliveries per day. In the South region, the cost is $120 per day with an efficiency of 1.5 deliveries per day. In the East region, the cost is $110 per day with an efficiency of 1.3 deliveries per day. In the West region, the cost is $90 per day with an efficiency of 1.1 deliveries per day. In the Central region, the cost is $130 per day with an efficiency of 1.6 deliveries per day. The company wants to minimize the total cost while ensuring a minimum delivery efficiency across all regions.\n// Total Cost = 100 * North + 120 * South + 110 * East + 90 * West + 130 * Central\n// Total Deliveries = 1.2 * North + 1.5 * South + 1.3 * East + 1.1 * West + 1.6 * Central\n// The objective function is: Minimize Total Cost / Total Deliveries\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// North + South + East + West + Central <= 100\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks allocated.\n// North >= 10; South >= 10; East >= 10; West >= 10; Central >= 10",
        "question": "A logistics company needs to optimize its fleet usage for delivering goods across five regions: North, South, East, West, and Central. The company has to decide the number of trucks to allocate to each region.\nThe cost of operating a truck in the North region is $100 per day, with a delivery efficiency of 1.2 deliveries per day. In the South region, the cost is $120 per day with an efficiency of 1.5 deliveries per day. In the East region, the cost is $110 per day with an efficiency of 1.3 deliveries per day. In the West region, the cost is $90 per day with an efficiency of 1.1 deliveries per day. In the Central region, the cost is $130 per day with an efficiency of 1.6 deliveries per day. The company wants to minimize the total cost while ensuring a minimum delivery efficiency across all regions.\nThe company has a total of 100 trucks available for allocation. Each region must have at least 10 trucks allocated.\nPlease help the company to minimize the total cost while ensuring a minimum delivery efficiency across all regions, defined as the total cost divided by the total number of deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 10 trucks allocated.\nNorth = model.addVar(vtype=\"INTEGER\", name=\"North\", lb=10) # number of trucks in North region\nSouth = model.addVar(vtype=\"INTEGER\", name=\"South\", lb=10) # number of trucks in South region\nEast = model.addVar(vtype=\"INTEGER\", name=\"East\", lb=10) # number of trucks in East region\nWest = model.addVar(vtype=\"INTEGER\", name=\"West\", lb=10) # number of trucks in West region\nCentral = model.addVar(vtype=\"INTEGER\", name=\"Central\", lb=10) # number of trucks in Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * North + 120 * South + 110 * East + 90 * West + 130 * Central\nTotalDeliveries = 1.2 * North + 1.5 * South + 1.3 * East + 1.1 * West + 1.6 * Central\n## The objective function is: Minimize Total Cost / Total Deliveries\n## convert the division to multiplication\nmodel.addCons(obj * TotalDeliveries == TotalCost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(North + South + East + West + Central <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(North))\n    print(\"Number of Trucks in South Region: \", model.getVal(South))\n    print(\"Number of Trucks in East Region: \", model.getVal(East))\n    print(\"Number of Trucks in West Region: \", model.getVal(West))\n    print(\"Number of Trucks in Central Region: \", model.getVal(Central))\n    print(\"Minimized Cost per Delivery: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for transporting goods across different regions. The company has identified five regions (Region A, Region B, Region C, Region D, and Region E) where they need to optimize the number of trucks.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a fixed cost of operation and a variable cost that depends on the distance traveled. The fixed cost for each region is as follows: Region A - $500, Region B - $600, Region C - $700, Region D - $800, Region E - $900. The variable cost per kilometer is $1 for all regions. The average distance each truck travels in a region is: Region A - 500 km, Region B - 600 km, Region C - 700 km, Region D - 800 km, Region E - 900 km. The company aims to minimize the total cost of operation.\n// Fixed costs: FC = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Variable costs: VC = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Total cost: TC = FC + VC\n// So, the objective function is: Minimize TC\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck operations.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nAt least 20 trucks must be allocated to Region A.\n// TruckA >= 20\n\n## Generate Constraint-4:\nNo more than 30% of the total trucks can be allocated to any single region.\n// TruckA <= 0.3 * 100\n// TruckB <= 0.3 * 100\n// TruckC <= 0.3 * 100\n// TruckD <= 0.3 * 100\n// TruckE <= 0.3 * 100\n\n## Generate Constraint-5:\nThe total distance traveled by all trucks should not exceed 80,000 km.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 80000",
        "question": "A logistics company is planning its fleet of trucks for transporting goods across five regions: Region A, Region B, Region C, Region D, and Region E. The company needs to optimize the number of trucks in each region. The fixed cost of operation and the average distance each truck travels in each region are given in the following Table.\n\n| Region | Fixed Cost | Average Distance |\n|--------|------------|------------------|\n| A      | $500       | 500 km           |\n| B      | $600       | 600 km           |\n| C      | $700       | 700 km           |\n| D      | $800       | 800 km           |\n| E      | $900       | 900 km           |\n\nThe variable cost per kilometer is $1 for all regions. The company has a budget of $100,000 for truck operations. The total number of trucks available is 100. At least 20 trucks must be allocated to Region A. No more than 30% of the total trucks can be allocated to any single region. The total distance traveled by all trucks should not exceed 80,000 km.\n\nPlease help the company to minimize the total cost of operation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=20) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks in Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFixedCosts = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nVariableCosts = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nTotalCost = FixedCosts + VariableCosts\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $100,000 for truck operations.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 100000)\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## No more than 30% of the total trucks can be allocated to any single region.\nmodel.addCons(TruckA <= 0.3 * 100)\nmodel.addCons(TruckB <= 0.3 * 100)\nmodel.addCons(TruckC <= 0.3 * 100)\nmodel.addCons(TruckD <= 0.3 * 100)\nmodel.addCons(TruckE <= 0.3 * 100)\n## The total distance traveled by all trucks should not exceed 80,000 km.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 80000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Total Cost of Operation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit per unit of product. \nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\nThe company aims to maximize the total profit from all products.\n// The profit from product A: P_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\n// The profit from product B: P_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\n// The profit from product C: P_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n// So, the objective function is: Maximize P = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 + W4 <= 60\n\n## Generate Constraint-2:\nEach machine can be operated by up to 20 workers at a time.\n// W1 <= 20; W2 <= 20; W3 <= 20; W4 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily.\n// 10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 >= 1000\n// 15 * W1 + 20 * W2 + 25 * W3 + 30 * W4 >= 1500\n// 20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 >= 2000",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. Each machine has a different efficiency and profit per unit of product. On machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C. On machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C. On machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C. On machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C. The company aims to maximize the total profit from all products. There are a total of 60 workers available. Each machine can be operated by up to 20 workers at a time. The company must produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily. Please help the company to determine the optimal number of workers to allocate to each machine to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\nP_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\nP_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n# So, the objective function is: Maximize P = P_A + P_B + P_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 <= 60)\n# Each machine can be operated by up to 20 workers at a time.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\nmodel.addCons(W4 <= 20)\n# The company must produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily.\nmodel.addCons(10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 >= 1000)\nmodel.addCons(15 * W1 + 20 * W2 + 25 * W3 + 30 * W4 >= 1500)\nmodel.addCons(20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Number of workers on machine 4: \", model.getVal(W4))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1443,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location A, Location B, Location C, Location D, and Location E) for installation.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local weather conditions. The efficiency of wind turbines also varies based on wind patterns. The company wants to maximize the total energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe objective is to maximize the total daily energy output while minimizing the total cost of installation.\n// Total energy output: Energy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\n// Total cost: Cost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations: Location A, Location B, Location C, Location D, and Location E. The company needs to determine the number of solar panels and wind turbines to install at each location. The energy generation and cost per unit for each location are given in the following Table.\n\n| Location | Device | Energy Generation (kWh/day) | Cost per Unit ($) |\n|----------|---------|-----------------------------|-------------------|\n| A        | Solar   | 100                          | 500               |\n| B        | Solar   | 120                          | 600               |\n| C        | Solar   | 110                          | 550               |\n| D        | Wind    | 200                          | 1000              |\n| E        | Wind    | 180                          | 900               |\n\nThe company has a budget of $50,000 for the installation. The objective is to maximize the total daily energy output while minimizing the total cost of installation. Please help the company to determine the optimal number of solar panels and wind turbines to install at each location to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Location E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\nCost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n## the objective function is: Maximize Energy - Cost\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck varies with the number of trips it makes. For Truck1, the fuel efficiency is 0.5 + 0.01 * T1 (in gallons per mile). For Truck2, it's 0.6 + 0.01 * T2. For Truck3, it's 0.7 + 0.01 * T3. For Truck4, it's 0.8 + 0.01 * T4. For Truck5, it's 0.9 + 0.01 * T5. The operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost.\n// Fuel efficiency for Truck1: FE1 = 0.5 + 0.01 * T1\n// Fuel efficiency for Truck2: FE2 = 0.6 + 0.01 * T2\n// Fuel efficiency for Truck3: FE3 = 0.7 + 0.01 * T3\n// Fuel efficiency for Truck4: FE4 = 0.8 + 0.01 * T4\n// Fuel efficiency for Truck5: FE5 = 0.9 + 0.01 * T5\n// Total operational cost: Cost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach truck can make at most 30 trips.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nAt least 10 trips must be made by Truck1 and Truck2 combined.\n// T1 + T2 >= 10\n\n## Generate Constraint-4:\nThe total number of trips for Truck3 and Truck4 must be at least 20.\n// T3 + T4 >= 20\n\n## Generate Constraint-5:\nThe number of trips for Truck5 must be at least twice the number of trips for Truck1.\n// T5 >= 2 * T1",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs. The fuel efficiency of each truck varies with the number of trips it makes. For Truck1, the fuel efficiency is 0.5 + 0.01 * T1 (in gallons per mile). For Truck2, it's 0.6 + 0.01 * T2. For Truck3, it's 0.7 + 0.01 * T3. For Truck4, it's 0.8 + 0.01 * T4. For Truck5, it's 0.9 + 0.01 * T5. The operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost. The total number of trips across all trucks must not exceed 100. Each truck can make at most 30 trips. At least 10 trips must be made by Truck1 and Truck2 combined. The total number of trips for Truck3 and Truck4 must be at least 20. The number of trips for Truck5 must be at least twice the number of trips for Truck1. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=30) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=30) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=30) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=30) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=30) # number of trips for Truck5\n\n# Define objective function\nFE1 = 0.5 + 0.01 * T1\nFE2 = 0.6 + 0.01 * T2\nFE3 = 0.7 + 0.01 * T3\nFE4 = 0.8 + 0.01 * T4\nFE5 = 0.9 + 0.01 * T5\nCost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 + T2 >= 10)\nmodel.addCons(T3 + T4 >= 20)\nmodel.addCons(T5 >= 2 * T1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 machines available for the month.\n// MachinesA + MachinesB + MachinesC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $100,000.\n// Automation <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product must not exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 100 machines available for the month. The total investment in automation cannot exceed $100,000. Due to market demand, the production quantity of each product must not exceed 500 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\nProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\nProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 100)\nmodel.addCons(Automation <= 100000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month to optimize fuel efficiency and reduce carbon emissions. Additionally, the company is considering investing in hybrid technology upgrades for each vehicle type to further improve fuel efficiency.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for TruckA\": \"HybridA\", \"range\": \"HybridA >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckB\": \"HybridB\", \"range\": \"HybridB >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckC\": \"HybridC\", \"range\": \"HybridC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for TruckA, the fuel consumption per trip decreases by 0.1 liters. For TruckB, the decrease is 0.15 liters per $1000, and for TruckC, it's 0.2 liters per $1000. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (5 - 0.0001 * HybridA) * TripsA\n// Fuel consumption for TruckB: ConsumptionB = (6 - 0.00015 * HybridB) * TripsB\n// Fuel consumption for TruckC: ConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\n// 1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month to optimize fuel efficiency and reduce carbon emissions. Additionally, the company is considering investing in hybrid technology upgrades for each vehicle type to further improve fuel efficiency. The fuel efficiency of each vehicle type improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for TruckA, the fuel consumption per trip decreases by 0.1 liters. For TruckB, the decrease is 0.15 liters per $1000, and for TruckC, it's 0.2 liters per $1000. The company aims to minimize the total fuel consumption across all vehicles. The company has a total budget of $100,000 for hybrid technology upgrades and operational costs. Please help the company to determine the optimal number of trips and the investment in hybrid technology for each vehicle type to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nHybridA = model.addVar(name=\"HybridA\", lb=0) # investment in hybrid technology for TruckA\nHybridB = model.addVar(name=\"HybridB\", lb=0) # investment in hybrid technology for TruckB\nHybridC = model.addVar(name=\"HybridC\", lb=0) # investment in hybrid technology for TruckC\n\n# Define objective function\nConsumptionA = (5 - 0.0001 * HybridA) * TripsA\nConsumptionB = (6 - 0.00015 * HybridB) * TripsB\nConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n# The company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\nmodel.addCons(1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Hybrid Technology for TruckA: \", model.getVal(HybridA))\n    print(\"Investment in Hybrid Technology for TruckB: \", model.getVal(HybridB))\n    print(\"Investment in Hybrid Technology for TruckC: \", model.getVal(HybridC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n// Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\n// Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\n// Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per day.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-2:\nThe cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $2000 per day for raw materials.\n// 5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company has a total production capacity of 500 units per day and a budget of $2000 per day for raw materials. The cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. Please help the company to maximize the total profit from the production and sale of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 20 * A1 * A_b1 + (20 + 0.05 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 30 * B1 * B_b1 + (30 + 0.05 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 40 * C1 * C_b1 + (40 + 0.05 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 500 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n## The cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $2000 per day for raw materials.\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type D solar panels\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $200 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $300 per panel, and a lifespan of 12 years.\nType C solar panels have an efficiency of 25%, a cost of $400 per panel, and a lifespan of 15 years.\nType D solar panels have an efficiency of 30%, a cost of $500 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.\n// TotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\n// EnergyProduced = 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar\n// So, the objective function is: Minimize (TotalCost - EnergyProduced)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the initial installation of solar panels.\n// 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000\n\n## Generate Constraint-2:\nThe total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\n// 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar >= 0.8 * 500000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies and costs. Type A solar panels have an efficiency of 15%, a cost of $200 per panel, and a lifespan of 10 years. Type B solar panels have an efficiency of 20%, a cost of $300 per panel, and a lifespan of 12 years. Type C solar panels have an efficiency of 25%, a cost of $400 per panel, and a lifespan of 15 years. Type D solar panels have an efficiency of 30%, a cost of $500 per panel, and a lifespan of 20 years. The city has a budget of $100,000 for the initial installation of solar panels. The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year. Please help the city to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0) # number of Type A solar panels\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0) # number of Type B solar panels\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0) # number of Type C solar panels\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0) # number of Type D solar panels\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\nEnergyProduced = 0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar\n## the objective function is: Minimize (TotalCost - EnergyProduced)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * EnergyProduced)\n\n# Add constraints\n## The city has a budget of $100,000 for the initial installation of solar panels.\nmodel.addCons(200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000)\n## The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\nmodel.addCons(0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar >= 0.8 * 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolar))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolar))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolar))\n    print(\"Number of Type D Solar Panels: \", model.getVal(TypeDSolar))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product A\": \"InventoryA\", \"range\": \"InventoryA >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product B\": \"InventoryB\", \"range\": \"InventoryB >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product C\": \"InventoryC\", \"range\": \"InventoryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\n// Profit_ProductA = (ProductA - InventoryA) * (50 - 30)\n// Profit_ProductB = (ProductB - InventoryB) * (70 - 40)\n// Profit_ProductC = (ProductC - InventoryC) * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 50 units for each product.\n// InventoryA <= 50\n// InventoryB <= 50\n// InventoryC <= 50\n\n## Generate Constraint-3:\nThe total cost of production and inventory maintenance must not exceed $4000 per day.\n// 30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company has a total production capacity of 100 units per day. The company has a storage capacity limit of 50 units for each product. The total cost of production and inventory maintenance must not exceed $4000 per day.\nPlease help the company to maximize the total profit, considering both the production and the inventory levels.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nInventoryA = model.addVar(vtype=\"INTEGER\", name=\"InventoryA\", lb=0)  # inventory level of product A\nInventoryB = model.addVar(vtype=\"INTEGER\", name=\"InventoryB\", lb=0)  # inventory level of product B\nInventoryC = model.addVar(vtype=\"INTEGER\", name=\"InventoryC\", lb=0)  # inventory level of product C\n\n# Define objective function\nProfit_ProductA = (ProductA - InventoryA) * (50 - 30)\nProfit_ProductB = (ProductB - InventoryB) * (70 - 40)\nProfit_ProductC = (ProductC - InventoryC) * (60 - 35)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 100)  # total production capacity constraint\nmodel.addCons(InventoryA <= 50)  # storage capacity limit for product A\nmodel.addCons(InventoryB <= 50)  # storage capacity limit for product B\nmodel.addCons(InventoryC <= 50)  # storage capacity limit for product C\nmodel.addCons(30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000)  # total cost constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Inventory Level of Product A: \", model.getVal(InventoryA))\n    print(\"Inventory Level of Product B: \", model.getVal(InventoryB))\n    print(\"Inventory Level of Product C: \", model.getVal(InventoryC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in the factory. The production cost, revenue, and resource consumption vary for each product and shift.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ProductAShifts\", \"range\": \"ProductAShifts >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ProductBShifts\", \"range\": \"ProductBShifts >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ProductCShifts\", \"range\": \"ProductCShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, and the revenue per unit is $100. For ProductB, the production cost per unit is $60, and the revenue per unit is $120. For ProductC, the production cost per unit is $70, and the revenue per unit is $140. The cost of operating a shift is $1000. The company wants to maximize the total net profit.\n// Profit_ProductA = (100 - 50) * ProductAQty - 1000 * ProductAShifts\n// Profit_ProductB = (120 - 60) * ProductBQty - 1000 * ProductBShifts\n// Profit_ProductC = (140 - 70) * ProductCQty - 1000 * ProductCShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 shifts available per week.\n// ProductAShifts + ProductBShifts + ProductCShifts <= 50\n\n## Generate Constraint-2:\nThe total production quantity for all products cannot exceed 1000 units per week.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-3:\nDue to limited raw materials, the production of ProductA cannot exceed twice the production of ProductB.\n// ProductAQty <= 2 * ProductBQty\n\n## Generate Constraint-4:\nThe company has a weekly budget of $50,000 for operating shifts and production costs.\n// 50 * ProductAQty + 60 * ProductBQty + 70 * ProductCQty + 1000 * (ProductAShifts + ProductBShifts + ProductCShifts) <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product and the number of shifts to operate in the factory. The production cost, revenue, and resource consumption vary for each product and shift. The production cost per unit for ProductA is $50, and the revenue per unit is $100. For ProductB, the production cost per unit is $60, and the revenue per unit is $120. For ProductC, the production cost per unit is $70, and the revenue per unit is $140. The cost of operating a shift is $1000. The company has a total of 50 shifts available per week. The total production quantity for all products cannot exceed 1000 units per week. Due to limited raw materials, the production of ProductA cannot exceed twice the production of ProductB. The company has a weekly budget of $50,000 for operating shifts and production costs. The company wants to maximize the total net profit. Please help the company determine the optimal production quantities and shifts for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nProductAShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductAShifts\", lb=0)  # number of shifts for ProductA\nProductBShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductBShifts\", lb=0)  # number of shifts for ProductB\nProductCShifts = model.addVar(vtype=\"INTEGER\", name=\"ProductCShifts\", lb=0)  # number of shifts for ProductC\n\n# Define objective function\nProfit_ProductA = (100 - 50) * ProductAQty - 1000 * ProductAShifts\nProfit_ProductB = (120 - 60) * ProductBQty - 1000 * ProductBShifts\nProfit_ProductC = (140 - 70) * ProductCQty - 1000 * ProductCShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 shifts available per week.\nmodel.addCons(ProductAShifts + ProductBShifts + ProductCShifts <= 50)\n# The total production quantity for all products cannot exceed 1000 units per week.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# Due to limited raw materials, the production of ProductA cannot exceed twice the production of ProductB.\nmodel.addCons(ProductAQty <= 2 * ProductBQty)\n# The company has a weekly budget of $50,000 for operating shifts and production costs.\nmodel.addCons(50 * ProductAQty + 60 * ProductBQty + 70 * ProductCQty + 1000 * (ProductAShifts + ProductBShifts + ProductCShifts) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ProductAShifts))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ProductBShifts))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ProductCShifts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the amount of money to invest in upgrading the fuel efficiency of each vehicle type.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckD\": \"EfficiencyD\", \"range\": \"EfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost for the next quarter. The fuel cost per mile for TruckA is $0.50, which decreases by $0.01 for every $100 invested in efficiency upgrades. The fuel cost per mile for TruckB is $0.60, which decreases by $0.015 for every $100 invested in efficiency upgrades. The fuel cost per mile for TruckC is $0.70, which decreases by $0.02 for every $100 invested in efficiency upgrades. The fuel cost per mile for TruckD is $0.80, which decreases by $0.025 for every $100 invested in efficiency upgrades. The total miles driven by each truck type is estimated to be 10,000 miles.\n// Fuel cost for TruckA: CostA = (0.50 - 0.0001 * EfficiencyA) * 10000 * TruckA\n// Fuel cost for TruckB: CostB = (0.60 - 0.00015 * EfficiencyB) * 10000 * TruckB\n// Fuel cost for TruckC: CostC = (0.70 - 0.0002 * EfficiencyC) * 10000 * TruckC\n// Fuel cost for TruckD: CostD = (0.80 - 0.00025 * EfficiencyD) * 10000 * TruckD\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fleet upgrades and operations.\n// 10000 * (0.50 * TruckA + 0.60 * TruckB + 0.70 * TruckC + 0.80 * TruckD) + EfficiencyA + EfficiencyB + EfficiencyC + EfficiencyD <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-3:\nAt least 20 TruckA and 30 TruckB must be in the fleet.\n// TruckA >= 20; TruckB >= 30\n\n## Generate Constraint-4:\nThe investment in efficiency upgrades for each truck type must not exceed $20,000.\n// EfficiencyA <= 20000\n// EfficiencyB <= 20000\n// EfficiencyC <= 20000\n// EfficiencyD <= 20000",
        "question": "A logistics company is planning its fleet for the next quarter and operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the amount of money to invest in upgrading the fuel efficiency of each vehicle type. The company aims to minimize the total fuel cost for the next quarter, where the fuel cost per mile for each truck type decreases with investment in efficiency upgrades, and the total miles driven by each truck type is estimated to be 10,000 miles. The company has a budget of $100,000 for fleet upgrades and operations. The total number of trucks in the fleet must not exceed 100, with at least 20 TruckA and 30 TruckB in the fleet. The investment in efficiency upgrades for each truck type must not exceed $20,000. Please help the company to determine the optimal number of each truck type and the investment in fuel efficiency to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)\nEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyD\", lb=0)\n\n# Define objective function\nCostA = (0.50 - 0.0001 * EfficiencyA) * 10000 * TruckA\nCostB = (0.60 - 0.00015 * EfficiencyB) * 10000 * TruckB\nCostC = (0.70 - 0.0002 * EfficiencyC) * 10000 * TruckC\nCostD = (0.80 - 0.00025 * EfficiencyD) * 10000 * TruckD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD)\n\n# Add constraints\nmodel.addCons(10000 * (0.50 * TruckA + 0.60 * TruckB + 0.70 * TruckC + 0.80 * TruckD) + EfficiencyA + EfficiencyB + EfficiencyC + EfficiencyD <= 100000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\nmodel.addCons(TruckA >= 20)\nmodel.addCons(TruckB >= 30)\nmodel.addCons(EfficiencyA <= 20000)\nmodel.addCons(EfficiencyB <= 20000)\nmodel.addCons(EfficiencyC <= 20000)\nmodel.addCons(EfficiencyD <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Investment in Efficiency for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Investment in Efficiency for TruckD: \", model.getVal(EfficiencyD))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region (North, South, East, West, and Central) to optimize their operations.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Net Profit = (200 * NorthTrucks + 220 * SouthTrucks + 230 * EastTrucks + 210 * WestTrucks + 190 * CentralTrucks) - (100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks)\n// So, the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 trucks are allocated to each region.\n// NorthTrucks >= 10; SouthTrucks >= 10; EastTrucks >= 10; WestTrucks >= 10; CentralTrucks >= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region to optimize their operations. The cost and revenue per truck in each region are given in the following Table.\n\n| Region       | Cost per Truck | Revenue per Truck |\n|--------------|----------------|-------------------|\n| North        | $100           | $200              |\n| South        | $120           | $220              |\n| East         | $130           | $230              |\n| West         | $110           | $210              |\n| Central      | $90            | $190              |\n\nThe company has a total of 50 trucks available for allocation. The company wants to ensure that at least 10 trucks are allocated to each region. Please help the company to maximize the net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 10 trucks are allocated to each region.\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=10) # number of trucks in North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=10) # number of trucks in South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=10) # number of trucks in East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=10) # number of trucks in West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=10) # number of trucks in Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\nmodel.addCons(obj == 100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) to minimize fuel consumption and environmental impact. Each truck has a different fuel efficiency and can carry a different load.\n// {\"load carried by Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"load carried by Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its load. For Truck1, the fuel consumption is 0.05 * (Truck1^2) liters. For Truck2, it's 0.04 * (Truck2^2) liters. For Truck3, it's 0.06 * (Truck3^2) liters. For Truck4, it's 0.03 * (Truck4^2) liters. For Truck5, it's 0.07 * (Truck5^2) liters. The company wants to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = 0.05 * (Truck1^2) + 0.04 * (Truck2^2) + 0.06 * (Truck3^2) + 0.03 * (Truck4^2) + 0.07 * (Truck5^2)\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total load to be transported is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck1 can carry up to 20 tons, Truck2 up to 30 tons, Truck3 up to 25 tons, Truck4 up to 15 tons, and Truck5 up to 10 tons.\n// Truck1 <= 20\n// Truck2 <= 30\n// Truck3 <= 25\n// Truck4 <= 15\n// Truck5 <= 10",
        "question": "A logistics company is planning its routes for five different vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) to minimize fuel consumption and environmental impact. Each truck has a different fuel efficiency and can carry a different load. The fuel consumption of each truck is a nonlinear function of its load: for Truck1, it's 0.05 * (Truck1^2) liters; for Truck2, it's 0.04 * (Truck2^2) liters; for Truck3, it's 0.06 * (Truck3^2) liters; for Truck4, it's 0.03 * (Truck4^2) liters; and for Truck5, it's 0.07 * (Truck5^2) liters. The company wants to minimize the total fuel consumption. The total load to be transported is 100 tons, and each truck has a maximum capacity: Truck1 can carry up to 20 tons, Truck2 up to 30 tons, Truck3 up to 25 tons, Truck4 up to 15 tons, and Truck5 up to 10 tons. Please help the company determine the optimal load for each truck to minimize the total fuel consumption while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # load carried by Truck1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # load carried by Truck2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # load carried by Truck3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # load carried by Truck4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # load carried by Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel consumption: Fuel = 0.05 * (Truck1^2) + 0.04 * (Truck2^2) + 0.06 * (Truck3^2) + 0.03 * (Truck4^2) + 0.07 * (Truck5^2)\nFuel = 0.05 * Truck1**2 + 0.04 * Truck2**2 + 0.06 * Truck3**2 + 0.03 * Truck4**2 + 0.07 * Truck5**2\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total load to be transported is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n## Each truck has a maximum capacity: Truck1 can carry up to 20 tons, Truck2 up to 30 tons, Truck3 up to 25 tons, Truck4 up to 15 tons, and Truck5 up to 10 tons.\nmodel.addCons(Truck1 <= 20)\nmodel.addCons(Truck2 <= 30)\nmodel.addCons(Truck3 <= 25)\nmodel.addCons(Truck4 <= 15)\nmodel.addCons(Truck5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Load carried by Truck1: \", model.getVal(Truck1))\n    print(\"Load carried by Truck2: \", model.getVal(Truck2))\n    print(\"Load carried by Truck3: \", model.getVal(Truck3))\n    print(\"Load carried by Truck4: \", model.getVal(Truck4))\n    print(\"Load carried by Truck5: \", model.getVal(Truck5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n// NetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\n// NetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\n// NetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n// So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all wind farms is $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limit of 100 turbines that can be installed across all types.\n// Turbines1 + Turbines2 + Turbines3 <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\n// Turbines1 >= 20; Turbines2 >= 30\n\n## Generate Constraint-4:\nThe maximum maintenance investment for Type1 is $50,000, for Type2 is $60,000, and for Type3 is $70,000.\n// Maintenance1 <= 50000; Maintenance2 <= 60000; Maintenance3 <= 70000",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales. The total maintenance budget for all wind farms is $100,000. The company has a limit of 100 turbines that can be installed across all types. Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2. The maximum maintenance investment for Type1 is $50,000, for Type2 is $60,000, and for Type3 is $70,000.\n\nPlease help the company to maximize the net profit from energy sales.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=20)  # number of turbines for Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=30)  # number of turbines for Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)    # number of turbines for Type3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0, ub=50000)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0, ub=60000)  # maintenance investment for Type2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0, ub=70000)  # maintenance investment for Type3\n\n# Define objective function\nNetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\nNetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\nNetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n# So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit1 + NetProfit2 + NetProfit3)\n\n# Add constraints\n# The total maintenance budget for all wind farms is $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n# The company has a limit of 100 turbines that can be installed across all types.\nmodel.addCons(Turbines1 + Turbines2 + Turbines3 <= 100)\n# Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\nmodel.addCons(Turbines1 >= 20)\nmodel.addCons(Turbines2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines for Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines for Type3: \", model.getVal(Turbines3))\n    print(\"Maintenance Investment for Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment for Type2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Investment for Type3: \", model.getVal(Maintenance3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the efficiency and capacity of each machine.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D, and E are $50, $70, $60, $80, and $90 respectively. The production time per unit for each product on each machine varies. Machine 1 takes 2 hours for A, 3 hours for B, 2.5 hours for C, 4 hours for D, and 3.5 hours for E. Machine 2 takes 1.5 hours for A, 2 hours for B, 1.8 hours for C, 3 hours for D, and 2.5 hours for E. Machine 3 takes 2.2 hours for A, 2.8 hours for B, 2.3 hours for C, 3.5 hours for D, and 3 hours for E. The company aims to maximize the total profit while considering the time efficiency of each machine.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total production time on Machine 1: Time1 = 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E\n// Total production time on Machine 2: Time2 = 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E\n// Total production time on Machine 3: Time3 = 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E\n// The objective function is: Maximize Profit / (Time1 + Time2 + Time3)\n\n## Generate Constraint-1:\nThe total production time on each machine cannot exceed 120 hours per week.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 120\n// 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E <= 120\n// 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E <= 120\n\n## Generate Constraint-2:\nThe company has a minimum weekly demand of 10 units for product A, 15 units for product B, 20 units for product C, 5 units for product D, and 8 units for product E.\n// A >= 10\n// B >= 15\n// C >= 20\n// D >= 5\n// E >= 8\n\n## Generate Constraint-3:\nThe total number of units produced for all products cannot exceed 100 units per week.\n// A + B + C + D + E <= 100",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the efficiency and capacity of each machine. The profit per unit for products A, B, C, D, and E are $50, $70, $60, $80, and $90 respectively. The production time per unit for each product on each machine varies as shown in the following Table.\n\n| Product | Machine 1 Time | Machine 2 Time | Machine 3 Time |\n|---------|----------------|----------------|----------------|\n| A       | 2 hours        | 1.5 hours      | 2.2 hours      |\n| B       | 3 hours        | 2 hours        | 2.8 hours      |\n| C       | 2.5 hours      | 1.8 hours      | 2.3 hours      |\n| D       | 4 hours        | 3 hours        | 3.5 hours      |\n| E       | 3.5 hours      | 2.5 hours      | 3 hours        |\n\nThe total production time on each machine cannot exceed 120 hours per week. The company has a minimum weekly demand of 10 units for product A, 15 units for product B, 20 units for product C, 5 units for product D, and 8 units for product E. The total number of units produced for all products cannot exceed 100 units per week. \n\nPlease help the company to maximize the total profit while considering the time efficiency of each machine, which is defined as the total profit divided by the sum of the total production times on all machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=8) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nTime1 = 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E\nTime2 = 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E\nTime3 = 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E\n## the objective function is: Maximize Profit / (Time1 + Time2 + Time3)\n## convert the division to multiplication\nmodel.addCons(obj * (Time1 + Time2 + Time3) == Profit)\n\n# Add constraints\n## The total production time on each machine cannot exceed 120 hours per week.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 120)\nmodel.addCons(1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E <= 120)\nmodel.addCons(2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E <= 120)\n## The total number of units produced for all products cannot exceed 100 units per week.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1421,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying sizes and orientations suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on building A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type due to differences in roof size and orientation. Building A has an efficiency of 0.8 kWh per panel, Building B has 0.7 kWh, Building C has 0.6 kWh, Building D has 0.5 kWh, and Building E has 0.4 kWh. The cost of installation per panel also varies: $500 for Building A, $600 for Building B, $700 for Building C, $800 for Building D, and $900 for Building E. The city aims to maximize the total energy generated per dollar spent.\n// Energy_A = 0.8 * A\n// Energy_B = 0.7 * B\n// Energy_C = 0.6 * C\n// Energy_D = 0.5 * D\n// Energy_E = 0.4 * E\n// Cost_A = 500 * A\n// Cost_B = 600 * B\n// Cost_C = 700 * C\n// Cost_D = 800 * D\n// Cost_E = 900 * E\n// So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) / (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 500 * A + 600 * B + 700 * C + 800 * D + 900 * E <= 100000",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying sizes and orientations suitable for solar panel installation. The efficiency of solar panels varies by building type: Building A has an efficiency of 0.8 kWh per panel, Building B has 0.7 kWh, Building C has 0.6 kWh, Building D has 0.5 kWh, and Building E has 0.4 kWh. The cost of installation per panel also varies: $500 for Building A, $600 for Building B, $700 for Building C, $800 for Building D, and $900 for Building E. The city has a budget of $100,000 for the installation of solar panels.\n\nPlease help the city to maximize the total energy generated per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels on building A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels on building B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels on building C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels on building D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels on building E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_A = 0.8 * A\nEnergy_B = 0.7 * B\nEnergy_C = 0.6 * C\nEnergy_D = 0.5 * D\nEnergy_E = 0.4 * E\nCost_A = 500 * A\nCost_B = 600 * B\nCost_C = 700 * C\nCost_D = 800 * D\nCost_E = 900 * E\n## the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) / (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) == Energy_A + Energy_B + Energy_C + Energy_D + Energy_E)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(500 * A + 600 * B + 700 * C + 800 * D + 900 * E <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building A: \", model.getVal(A))\n    print(\"Number of Solar Panels on Building B: \", model.getVal(B))\n    print(\"Number of Solar Panels on Building C: \", model.getVal(C))\n    print(\"Number of Solar Panels on Building D: \", model.getVal(D))\n    print(\"Number of Solar Panels on Building E: \", model.getVal(E))\n    print(\"Maximized Energy per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different plants that produce electronic components. The company needs to determine the optimal number of workers to assign to each plant to maximize efficiency.\n// {\"number of workers at plant 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at plant 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach plant has a different efficiency rate based on the number of workers assigned. The efficiency is modeled as a nonlinear function of the number of workers, where efficiency increases with more workers but at a decreasing rate. The company aims to maximize the total efficiency across all plants.\n// Efficiency at plant 1: E1 = W1 / (1 + 0.01 * W1^2)\n// Efficiency at plant 2: E2 = W2 / (1 + 0.01 * W2^2)\n// Efficiency at plant 3: E3 = W3 / (1 + 0.01 * W3^2)\n// Efficiency at plant 4: E4 = W4 / (1 + 0.01 * W4^2)\n// Efficiency at plant 5: E5 = W5 / (1 + 0.01 * W5^2)\n// Objective function: Maximize E = E1 + E2 + E3 + E4 + E5\n// Maximize E = W1 / (1 + 0.01 * W1^2) + W2 / (1 + 0.01 * W2^2) + W3 / (1 + 0.01 * W3^2) + W4 / (1 + 0.01 * W4^2) + W5 / (1 + 0.01 * W5^2)\n\n## Generate Constraint-1:\nThe total number of workers available across all plants is limited to 100.\n// W1 + W2 + W3 + W4 + W5 <= 100\n\n## Generate Constraint-2:\nEach plant can accommodate a maximum of 30 workers.\n// W1 <= 30; W2 <= 30; W3 <= 30; W4 <= 30; W5 <= 30\n\n## Generate Constraint-3:\nThe minimum number of workers required at each plant to operate is 5.\n// W1 >= 5; W2 >= 5; W3 >= 5; W4 >= 5; W5 >= 5",
        "question": "A manufacturing company has 5 different plants that produce electronic components. The company needs to determine the optimal number of workers to assign to each plant to maximize efficiency. Each plant has a different efficiency rate based on the number of workers assigned, where efficiency increases with more workers but at a decreasing rate. The total number of workers available across all plants is limited to 100. Each plant can accommodate a maximum of 30 workers, and the minimum number of workers required at each plant to operate is 5. Please help the company to maximize the total efficiency across all plants, which is modeled as the sum of each plant's efficiency: E = W1 / (1 + 0.01 * W1^2) + W2 / (1 + 0.01 * W2^2) + W3 / (1 + 0.01 * W3^2) + W4 / (1 + 0.01 * W4^2) + W5 / (1 + 0.01 * W5^2).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=5, ub=30)  # number of workers at plant 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=5, ub=30)  # number of workers at plant 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=5, ub=30)  # number of workers at plant 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=5, ub=30)  # number of workers at plant 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=5, ub=30)  # number of workers at plant 5\n\n# Define objective function\n# Efficiency at each plant\nE1 = model.addVar(name=\"E1\")\nE2 = model.addVar(name=\"E2\")\nE3 = model.addVar(name=\"E3\")\nE4 = model.addVar(name=\"E4\")\nE5 = model.addVar(name=\"E5\")\n\n# Objective function: Maximize E = E1 + E2 + E3 + E4 + E5\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\n\n# Constraints for efficiency calculations\nmodel.addCons(E1 == W1 / (1 + 0.01 * W1**2))\nmodel.addCons(E2 == W2 / (1 + 0.01 * W2**2))\nmodel.addCons(E3 == W3 / (1 + 0.01 * W3**2))\nmodel.addCons(E4 == W4 / (1 + 0.01 * W4**2))\nmodel.addCons(E5 == W5 / (1 + 0.01 * W5**2))\n\n# Set the objective as the sum of efficiencies\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5)\n\n# Add constraints\n# Total number of workers available across all plants is limited to 100\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 100)\n\n# Each plant can accommodate a maximum of 30 workers\nmodel.addCons(W1 <= 30)\nmodel.addCons(W2 <= 30)\nmodel.addCons(W3 <= 30)\nmodel.addCons(W4 <= 30)\nmodel.addCons(W5 <= 30)\n\n# The minimum number of workers required at each plant to operate is 5\nmodel.addCons(W1 >= 5)\nmodel.addCons(W2 >= 5)\nmodel.addCons(W3 >= 5)\nmodel.addCons(W4 >= 5)\nmodel.addCons(W5 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers at plant 1: \", model.getVal(W1))\n    print(\"Number of workers at plant 2: \", model.getVal(W2))\n    print(\"Number of workers at plant 3: \", model.getVal(W3))\n    print(\"Number of workers at plant 4: \", model.getVal(W4))\n    print(\"Number of workers at plant 5: \", model.getVal(W5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has a fixed cost of $100 per day and can carry 500 kg. \nEach Medium truck has a fixed cost of $150 per day and can carry 1000 kg. \nEach Large truck has a fixed cost of $200 per day and can carry 1500 kg. \nEach Extra-Large truck has a fixed cost of $250 per day and can carry 2000 kg. \nEach Specialized truck has a fixed cost of $300 per day and can carry 2500 kg. \nThe company needs to transport at least 10,000 kg of goods daily. The objective is to minimize the total daily cost of operating the trucks while meeting the required transport capacity.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp\n// Total capacity = 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp\n// So, the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n## Generate Constraint-1:\nThe total daily transport capacity must be at least 10,000 kg.\n// 500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operating all trucks.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000\n\n## Generate Constraint-3:\nThere is a limit on the number of trucks of each type that can be operated. The company can operate at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 3 Specialized trucks.\n// S <= 10; M <= 8; L <= 6; XL <= 4; Sp <= 3",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while minimizing costs. Each Small truck has a fixed cost of $100 per day and can carry 500 kg. Each Medium truck has a fixed cost of $150 per day and can carry 1000 kg. Each Large truck has a fixed cost of $200 per day and can carry 1500 kg. Each Extra-Large truck has a fixed cost of $250 per day and can carry 2000 kg. Each Specialized truck has a fixed cost of $300 per day and can carry 2500 kg. The company needs to transport at least 10,000 kg of goods daily. The company has a budget constraint of $10,000 per day for operating all trucks. There is a limit on the number of trucks of each type that can be operated. The company can operate at most 10 Small trucks, 8 Medium trucks, 6 Large trucks, 4 Extra-Large trucks, and 3 Specialized trucks. Please help the company to minimize the total daily cost of operating the trucks while meeting the required transport capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp)\n\n# Add constraints\n## The total daily transport capacity must be at least 10,000 kg.\nmodel.addCons(500 * S + 1000 * M + 1500 * L + 2000 * XL + 2500 * Sp >= 10000)\n## The company has a budget constraint of $10,000 per day for operating all trucks.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * Sp <= 10000)\n## There is a limit on the number of trucks of each type that can be operated.\nmodel.addCons(S <= 10)\nmodel.addCons(M <= 8)\nmodel.addCons(L <= 6)\nmodel.addCons(XL <= 4)\nmodel.addCons(Sp <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialized trucks: \", model.getVal(Sp))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different production methods: Method1 and Method2.\n// {\"production quantity for ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductA using Method1\": \"ProductAMethod1\", \"range\": \"ProductAMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB using Method1\": \"ProductBMethod1\", \"range\": \"ProductBMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC using Method1\": \"ProductCMethod1\", \"range\": \"ProductCMethod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductA using Method2\": \"ProductAMethod2\", \"range\": \"ProductAMethod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB using Method2\": \"ProductBMethod2\", \"range\": \"ProductBMethod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC using Method2\": \"ProductCMethod2\", \"range\": \"ProductCMethod2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of using Method1 is $20 per unit, and the cost of using Method2 is $30 per unit. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_ProductA = (50 - 20) * ProductAMethod1 + (50 - 30) * ProductAMethod2\n// Total profit for ProductB: Profit_ProductB = (70 - 20) * ProductBMethod1 + (70 - 30) * ProductBMethod2\n// Total profit for ProductC: Profit_ProductC = (90 - 20) * ProductCMethod1 + (90 - 30) * ProductCMethod2\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe total production capacity for all products using Method1 is 100 units.\n// ProductAMethod1 + ProductBMethod1 + ProductCMethod1 <= 100\n\n## Generate Constraint-2:\nThe total production capacity for all products using Method2 is 150 units.\n// ProductAMethod2 + ProductBMethod2 + ProductCMethod2 <= 150\n\n## Generate Constraint-3:\nThe company has a budget constraint of $5000 for the total cost of production methods.\n// 20 * (ProductAMethod1 + ProductBMethod1 + ProductCMethod1) + 30 * (ProductAMethod2 + ProductBMethod2 + ProductCMethod2) <= 5000\n\n## Generate Constraint-4:\nThe demand for ProductA is at least 50 units, and the demand for ProductB is at least 60 units.\n// ProductA >= 50; ProductB >= 60\n\n## Generate Constraint-5:\nThe company aims to produce at least 100 units of ProductC.\n// ProductC >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different production methods: Method1 and Method2. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of using Method1 is $20 per unit, and the cost of using Method2 is $30 per unit. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Method1 Cost | Method2 Cost |\n|---------|-----------------|--------------|--------------|\n| ProductA | $50             | $20          | $30          |\n| ProductB | $70             | $20          | $30          |\n| ProductC | $90             | $20          | $30          |\n\nThe total production capacity for all products using Method1 is 100 units. The total production capacity for all products using Method2 is 150 units. The company has a budget constraint of $5000 for the total cost of production methods. The demand for ProductA is at least 50 units, and the demand for ProductB is at least 60 units. The company aims to produce at least 100 units of ProductC.\n\nPlease help the company to determine the optimal production quantity for each product using each method to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50)  # production quantity for ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=60)  # production quantity for ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=100) # production quantity for ProductC\nProductAMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductAMethod1\", lb=0)  # production quantity for ProductA using Method1\nProductBMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductBMethod1\", lb=0)  # production quantity for ProductB using Method1\nProductCMethod1 = model.addVar(vtype=\"INTEGER\", name=\"ProductCMethod1\", lb=0)  # production quantity for ProductC using Method1\nProductAMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductAMethod2\", lb=0)  # production quantity for ProductA using Method2\nProductBMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductBMethod2\", lb=0)  # production quantity for ProductB using Method2\nProductCMethod2 = model.addVar(vtype=\"INTEGER\", name=\"ProductCMethod2\", lb=0)  # production quantity for ProductC using Method2\n\n# Define objective function\nProfit_ProductA = (50 - 20) * ProductAMethod1 + (50 - 30) * ProductAMethod2\nProfit_ProductB = (70 - 20) * ProductBMethod1 + (70 - 30) * ProductBMethod2\nProfit_ProductC = (90 - 20) * ProductCMethod1 + (90 - 30) * ProductCMethod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAMethod1 + ProductBMethod1 + ProductCMethod1 <= 100)  # total production capacity for Method1\nmodel.addCons(ProductAMethod2 + ProductBMethod2 + ProductCMethod2 <= 150)  # total production capacity for Method2\nmodel.addCons(20 * (ProductAMethod1 + ProductBMethod1 + ProductCMethod1) + 30 * (ProductAMethod2 + ProductBMethod2 + ProductCMethod2) <= 5000)  # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC))\n    print(\"Production Quantity for ProductA using Method1: \", model.getVal(ProductAMethod1))\n    print(\"Production Quantity for ProductB using Method1: \", model.getVal(ProductBMethod1))\n    print(\"Production Quantity for ProductC using Method1: \", model.getVal(ProductCMethod1))\n    print(\"Production Quantity for ProductA using Method2: \", model.getVal(ProductAMethod2))\n    print(\"Production Quantity for ProductB using Method2: \", model.getVal(ProductBMethod2))\n    print(\"Production Quantity for ProductC using Method2: \", model.getVal(ProductCMethod2))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h) and the number of trucks assigned to each route.\n// {\"speed of Truck1\": \"Speed1\", \"range\": \"Speed1 >= 0\", \"type\": \"continuous\"}\n// {\"speed of Truck2\": \"Speed2\", \"range\": \"Speed2 >= 0\", \"type\": \"continuous\"}\n// {\"speed of Truck3\": \"Speed3\", \"range\": \"Speed3 >= 0\", \"type\": \"continuous\"}\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, with higher speeds leading to greater fuel consumption. The fuel consumption function for each truck is given by: Fuel_Consumption = k * Speed^2, where k is a constant. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Total fuel consumption for Truck1: Fuel1 = k1 * Speed1^2 * TrucksA\n// Total fuel consumption for Truck2: Fuel2 = k2 * Speed2^2 * TrucksB\n// Total fuel consumption for Truck3: Fuel3 = k3 * Speed3^2 * TrucksC\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across all routes.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for all trucks is 100 km/h.\n// Speed1 <= 100; Speed2 <= 100; Speed3 <= 100\n\n## Generate Constraint-3:\nDue to road conditions, the speed of Truck1 must be at least half the speed of Truck2.\n// Speed1 >= 0.5 * Speed2\n\n## Generate Constraint-4:\nThe total distance covered by all trucks on RouteA must not exceed 5000 km.\n// Speed1 * TrucksA <= 5000\n\n## Generate Constraint-5:\nThe company must ensure that at least one truck is assigned to each route.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h) and the number of trucks assigned to each route. The fuel consumption of each truck is modeled as a nonlinear function of its speed, with higher speeds leading to greater fuel consumption. The fuel consumption function for each truck is given by: Fuel_Consumption = k * Speed^2, where k is a constant. The company aims to minimize the total fuel consumption across all trucks and routes.\n\nThe company has a total of 50 trucks available for allocation across all routes. The maximum speed limit for all trucks is 100 km/h. Due to road conditions, the speed of Truck1 must be at least half the speed of Truck2. The total distance covered by all trucks on RouteA must not exceed 5000 km. The company must ensure that at least one truck is assigned to each route.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of Truck2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of Truck3\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks on RouteC\n\n# Define objective function\n# Total fuel consumption for Truck1: Fuel1 = k1 * Speed1^2 * TrucksA\n# Total fuel consumption for Truck2: Fuel2 = k2 * Speed2^2 * TrucksB\n# Total fuel consumption for Truck3: Fuel3 = k3 * Speed3^2 * TrucksC\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\")\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\")\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\")\nmodel.setObjective(Fuel1 + Fuel2 + Fuel3, \"minimize\")\nmodel.addCons(Fuel1 == Speed1**2 * TrucksA)\nmodel.addCons(Fuel2 == Speed2**2 * TrucksB)\nmodel.addCons(Fuel3 == Speed3**2 * TrucksC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation across all routes.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The maximum speed limit for all trucks is 100 km/h.\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\nmodel.addCons(Speed3 <= 100)\n# Due to road conditions, the speed of Truck1 must be at least half the speed of Truck2.\nmodel.addCons(Speed1 >= 0.5 * Speed2)\n# The total distance covered by all trucks on RouteA must not exceed 5000 km.\nmodel.addCons(Speed1 * TrucksA <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Speed of Truck3: \", model.getVal(Speed3))\n    print(\"Number of trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The cost function is nonlinear due to varying fuel consumption rates and maintenance costs based on the number of trucks.\n// Fuel cost on route 1: F1 = 0.5 * T1^2\n// Fuel cost on route 2: F2 = 0.6 * T2^2\n// Fuel cost on route 3: F3 = 0.4 * T3^2\n// Fuel cost on route 4: F4 = 0.7 * T4^2\n// Fuel cost on route 5: F5 = 0.55 * T5^2\n// Fuel cost on route 6: F6 = 0.65 * T6^2\n// Maintenance cost: M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n// The objective function is: Minimize (F1 + F2 + F3 + F4 + F5 + F6 + M)\n// Minimize (0.5 * T1^2 + 0.6 * T2^2 + 0.4 * T3^2 + 0.7 * T4^2 + 0.55 * T5^2 + 0.65 * T6^2 + 1000 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost. The fuel consumption rates and maintenance costs vary per route and are affected by the number of trucks assigned.\n\n| Route | Fuel Consumption Rate |\n|-------|-----------------------|\n| 1     | 0.5 * T1^2           |\n| 2     | 0.6 * T2^2           |\n| 3     | 0.4 * T3^2           |\n| 4     | 0.7 * T4^2           |\n| 5     | 0.55 * T5^2          |\n| 6     | 0.65 * T6^2          |\n\nThe maintenance cost is calculated as M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6).\n\nThe company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs, by determining the optimal number of trucks to assign to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20)  # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20)  # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20)  # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20)  # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20)  # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20)  # number of trucks on route 6\n\n# Define objective function\nF1 = 0.5 * T1**2\nF2 = 0.6 * T2**2\nF3 = 0.4 * T3**2\nF4 = 0.7 * T4**2\nF5 = 0.55 * T5**2\nF6 = 0.65 * T6**2\nM = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5 + F6 + M)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space, which can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of M1 must be at least twice the production of M2.\n// M1 >= 2 * M2\n\n## Generate Constraint-4:\nThe company has a contract that requires them to produce at least 10 units of M3.\n// M3 >= 10\n\n## Generate Constraint-5:\nThe total production time for all machines cannot exceed 500 hours. The production time for M1 is 5 hours per unit, for M2 is 8 hours per unit, and for M3 is 10 hours per unit.\n// 5 * M1 + 8 * M2 + 10 * M3 <= 500",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company has a total production budget of $100,000. The company has a limited storage space, which can hold a maximum of 100 units in total. Due to market demand, the production of M1 must be at least twice the production of M2. The company has a contract that requires them to produce at least 10 units of M3. The total production time for all machines cannot exceed 500 hours. The production time for M1 is 5 hours per unit, for M2 is 8 hours per unit, and for M3 is 10 hours per unit.\nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=10) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n# So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n# The company has a total production budget of $100,000.\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n# The company has a limited storage space, which can hold a maximum of 100 units in total.\nmodel.addCons(M1 + M2 + M3 <= 100)\n# Due to market demand, the production of M1 must be at least twice the production of M2.\nmodel.addCons(M1 >= 2 * M2)\n# The company has a contract that requires them to produce at least 10 units of M3.\nmodel.addCons(M3 >= 10)\n# The total production time for all machines cannot exceed 500 hours.\nmodel.addCons(5 * M1 + 8 * M2 + 10 * M3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food) across different regions. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should travel to minimize fuel consumption and time.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for Electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Clothing\": \"ClothingSpeed\", \"range\": \"ClothingSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Food\": \"FoodSpeed\", \"range\": \"FoodSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of a truck is modeled by a nonlinear function that increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Clothing = ClothingTrucks * ClothingSpeed^2\n// Fuel_Food = FoodTrucks * FoodSpeed^2\n// Time_Electronics = Distance / ElectronicsSpeed\n// Time_Clothing = Distance / ClothingSpeed\n// Time_Food = Distance / FoodSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Clothing + Fuel_Food + Time_Electronics + Time_Clothing + Time_Food)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics * ElectronicsTrucks + Fuel_Clothing * ClothingTrucks + Fuel_Food * FoodTrucks <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food) across different regions. The company needs to decide the number of trucks dedicated to each type of goods and the average speed at which each type of truck should travel to minimize fuel consumption and time. The fuel consumption of a truck is modeled by a nonlinear function that increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road. The following table summarizes the variables and their relationships.\n\n| Variable                     | Description                          |\n|------------------------------|--------------------------------------|\n| ElectronicsTrucks           | Number of trucks for Electronics     |\n| ClothingTrucks              | Number of trucks for Clothing        |\n| FoodTrucks                  | Number of trucks for Food            |\n| ElectronicsSpeed            | Average speed of trucks for Electronics |\n| ClothingSpeed               | Average speed of trucks for Clothing |\n| FoodSpeed                   | Average speed of trucks for Food     |\n\nThe company has a total budget of $10,000 for fuel costs per day. Please help the company to determine the optimal number of trucks and their average speeds to minimize the total fuel consumption and time spent on the road.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nClothingSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ClothingSpeed\", lb=0)\nFoodSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FoodSpeed\", lb=0)\n\n# Define objective function\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Clothing = ClothingTrucks * ClothingSpeed**2\nFuel_Food = FoodTrucks * FoodSpeed**2\nTime_Electronics = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Electronics\", lb=0)\nTime_Clothing = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Clothing\", lb=0)\nTime_Food = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Food\", lb=0)\nmodel.addCons(Time_Electronics == 1 / ElectronicsSpeed)\nmodel.addCons(Time_Clothing == 1 / ClothingSpeed)\nmodel.addCons(Time_Food == 1 / FoodSpeed)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Electronics + Fuel_Clothing + Fuel_Food + Time_Electronics + Time_Clothing + Time_Food)\n\n# Add constraints\nmodel.addCons(Fuel_Electronics * ElectronicsTrucks + Fuel_Clothing * ClothingTrucks + Fuel_Food * FoodTrucks <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Clothing: \", model.getVal(ClothingSpeed))\n    print(\"Average Speed of Trucks for Food: \", model.getVal(FoodSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1400,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total marketing budget available for all products is $100,000.\n// MA + MB + MC <= 100000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC.\n// QA <= 500; QB <= 400; QC <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\nThe total marketing budget available for all products is $100,000. The production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC.\nPlease help the company to determine the optimal production quantities and marketing budgets for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=400) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=300) # quantity of ProductC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # marketing budget for ProductA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # marketing budget for ProductB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## The profit function is nonlinear and is given by:\n## Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n## Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n## Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\n## The company aims to maximize the total profit from all products.\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (100 * QA - 0.01 * QA**2 + 0.1 * MA) * QA\nProfit_B = (120 * QB - 0.02 * QB**2 + 0.15 * MB) * QB\nProfit_C = (150 * QC - 0.03 * QC**2 + 0.2 * MC) * QC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total marketing budget available for all products is $100,000.\nmodel.addCons(MA + MB + MC <= 100000)\n## The production capacity for each product is limited.\nmodel.addCons(QA <= 500)\nmodel.addCons(QB <= 400)\nmodel.addCons(QC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company has 5 different locations where it can install solar panels. The company needs to decide how many solar panels to install at each location to maximize energy production while minimizing costs.\n// {\"number of solar panels at location 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies by location due to different solar irradiance levels and efficiency of the panels. The cost of installation also varies by location. \n- At location 1, each panel produces 150 kWh and costs $1000 to install.\n- At location 2, each panel produces 120 kWh and costs $900 to install.\n- At location 3, each panel produces 180 kWh and costs $1100 to install.\n- At location 4, each panel produces 160 kWh and costs $1000 to install.\n- At location 5, each panel produces 140 kWh and costs $950 to install.\nThe company wants to maximize the total energy production while keeping the total installation cost below $100,000.\n// The total energy production: E = 150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5\n// The total installation cost: C = 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5\n// The objective function is: Maximize E - 0.01 * C\n// Maximize (150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5) - 0.01 * (1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5)\n\n## Generate Constraint-1:\nThe total installation cost must not exceed $100,000.\n// 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5 <= 100000\n\n## Generate Constraint-2:\nEach location has a maximum capacity for solar panels:\n// P1 <= 100; P2 <= 120; P3 <= 90; P4 <= 110; P5 <= 130",
        "question": "A solar energy company has 5 different locations where it can install solar panels. The company needs to decide how many solar panels to install at each location to maximize energy production while minimizing costs. The energy production and installation cost for each location are given in the following Table.\n\n| Location | Energy Production per Panel (kWh) | Installation Cost per Panel ($) |\n|----------|-----------------------------------|---------------------------------|\n| 1        | 150                               | 1000                            |\n| 2        | 120                               | 900                             |\n| 3        | 180                               | 1100                            |\n| 4        | 160                               | 1000                            |\n| 5        | 140                               | 950                             |\n\nThe company wants to maximize the total energy production while keeping the total installation cost below $100,000. Each location has a maximum capacity for solar panels: Location 1 can install up to 100 panels, Location 2 up to 120 panels, Location 3 up to 90 panels, Location 4 up to 110 panels, and Location 5 up to 130 panels.\n\nPlease help the company to maximize the total energy production while considering the total installation cost and the maximum capacity of each location.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels at location 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels at location 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels at location 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of solar panels at location 4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # number of solar panels at location 5\n\n# Define objective function\n## The objective function is: Maximize E - 0.01 * C\nE = 150 * P1 + 120 * P2 + 180 * P3 + 160 * P4 + 140 * P5\nC = 1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E - 0.01 * C)\n\n# Add constraints\n## The total installation cost must not exceed $100,000.\nmodel.addCons(1000 * P1 + 900 * P2 + 1100 * P3 + 1000 * P4 + 950 * P5 <= 100000)\n## Each location has a maximum capacity for solar panels:\nmodel.addCons(P1 <= 100)\nmodel.addCons(P2 <= 120)\nmodel.addCons(P3 <= 90)\nmodel.addCons(P4 <= 110)\nmodel.addCons(P5 <= 130)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(P3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(P4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(P5))\n    print(\"Maximized Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1379,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation technology cannot exceed $50,000.\n// IA <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30\n\n## Generate Constraint-4:\nThe company must allocate at least 200 units of resources to ProductB.\n// RB >= 200\n\n## Generate Constraint-5:\nThe total production quantity of all products must not exceed 100 units.\n// QA + QB + QC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n\nThe total resources available for production are limited to 1000 units. The investment in automation technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units. The company must allocate at least 200 units of resources to ProductB. The total production quantity of all products must not exceed 100 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0)  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30)  # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0)  # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=200)  # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0)  # resources allocated to ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0, ub=50000)  # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 60 + 0.005 * IA) * QA\nProfitB = (150 - 80 + 0.005 * IA) * QB\nProfitC = (200 - 100 + 0.005 * IA) * QC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RA + RB + RC <= 1000)\nmodel.addCons(QA + QB + QC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Automation Technology: \", model.getVal(IA))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $30, for DeviceB is $40, and for DeviceC is $35. The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 30) * DeviceA_Units\n// Total profit for DeviceB: Profit_DeviceB = (70 - 40) * DeviceB_Units\n// Total profit for DeviceC: Profit_DeviceC = (60 - 35) * DeviceC_Units\n// The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 400 units per month.\n// DeviceA_Units <= 400\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 200 units of DeviceB to be produced per month.\n// DeviceB_Units >= 200\n\n## Generate Constraint-4:\nThe production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\n// DeviceC_Units <= 300",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource constraints. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| DeviceA | $50             | $30                      |\n| DeviceB | $70             | $40                      |\n| DeviceC | $60             | $35                      |\n\nThe company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month. Due to market saturation, the production of DeviceA should not exceed 400 units per month. The company has a contract that requires at least 200 units of DeviceB to be produced per month. The production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\n\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)  # number of units of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 30) * DeviceA_Units\nProfit_DeviceB = (70 - 40) * DeviceB_Units\nProfit_DeviceC = (60 - 35) * DeviceC_Units\n# The objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited supply of a critical component that allows for a maximum of 1000 units to be produced per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)\n# Due to market saturation, the production of DeviceA should not exceed 400 units per month.\nmodel.addCons(DeviceA_Units <= 400)\n# The company has a contract that requires at least 200 units of DeviceB to be produced per month.\nmodel.addCons(DeviceB_Units >= 200)\n# The production of DeviceC is constrained by the availability of skilled labor, which is limited to 300 units per month.\nmodel.addCons(DeviceC_Units <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor costs.\n// LaborA * ProductA + LaborB * ProductB + LaborC * ProductC <= 5000\n\n## Generate Constraint-3:\nThe total storage space for all products is limited to 200 cubic meters. Product A requires 1 cubic meter per unit, product B requires 2 cubic meters per unit, and product C requires 3 cubic meters per unit.\n// ProductA + 2 * ProductB + 3 * ProductC <= 200\n\n## Generate Constraint-4:\nThe company can produce at most 150 units of product A, 100 units of product B, and 200 units of product C.\n// ProductA <= 150\n// ProductB <= 100\n// ProductC <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $10,000 for raw materials and $5,000 for labor costs. The total storage space for all products is limited to 200 cubic meters, with product A requiring 1 cubic meter per unit, product B requiring 2 cubic meters per unit, and product C requiring 3 cubic meters per unit. The company can produce at most 150 units of product A, 100 units of product B, and 200 units of product C. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n# The company has a budget of $5,000 for labor costs.\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 5000)\n# The total storage space for all products is limited to 200 cubic meters.\nmodel.addCons(ProductA + 2 * ProductB + 3 * ProductC <= 200)\n# The company can produce at most 150 units of product A, 100 units of product B, and 200 units of product C.\nmodel.addCons(ProductA <= 150)\nmodel.addCons(ProductB <= 100)\nmodel.addCons(ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours allocated to ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\n// Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n// Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n// Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available production hours for the company is 100 hours.\n// HoursA + HoursB + HoursC <= 100\n\n## Generate Constraint-2:\nThe company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB.\n// UnitsA >= 10; UnitsB >= 15\n\n## Generate Constraint-3:\nDue to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\n// UnitsC <= 2 * UnitsA\n\n## Generate Constraint-4:\nThe company has a budget constraint that the total cost of production should not exceed $2000.\n// (20 * HoursA / 5) * UnitsA + (25 * HoursB / 4) * UnitsB + (30 * HoursC / 3) * UnitsC <= 2000",
        "question": "A manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\nThe total available production hours for the company is 100 hours. The company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB. Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA. The company has a budget constraint that the total cost of production should not exceed $2000.\nPlease help the company to determine the optimal number of units and hours to allocate for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of hours allocated to ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of hours allocated to ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of hours allocated to ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n## Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n## Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n## convert the division to multiplication\nProfitA = (50 - 20 * HoursA * UnitsA / 5)\nProfitB = (70 - 25 * HoursB * UnitsB / 4)\nProfitC = (60 - 30 * HoursC * UnitsC / 3)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total available production hours for the company is 100 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 100)\n## Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\nmodel.addCons(UnitsC <= 2 * UnitsA)\n## The company has a budget constraint that the total cost of production should not exceed $2000.\nmodel.addCons((20 * HoursA * UnitsA / 5) + (25 * HoursB * UnitsB / 4) + (30 * HoursC * UnitsC / 3) <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Hours Allocated to ProductA: \", model.getVal(HoursA))\n    print(\"Hours Allocated to ProductB: \", model.getVal(HoursB))\n    print(\"Hours Allocated to ProductC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The voltage applied to each machine affects both its energy consumption and production rate, as described in the following table:\n\n| Machine | Voltage Range | Energy Consumption (Ei) | Production Rate (Pi) |\n|---------|---------------|-------------------------|----------------------|\n| 1       | 0 < V1 <= 120 | E1 = V1^2               | P1 = 100 * V1 - V1^2/10 |\n| 2       | 0 < V2 <= 120 | E2 = V2^2               | P2 = 100 * V2 - V2^2/10 |\n| 3       | 0 < V3 <= 120 | E3 = V3^2               | P3 = 100 * V3 - V3^2/10 |\n| 4       | 0 < V4 <= 120 | E4 = V4^2               | P4 = 100 * V4 - V4^2/10 |\n| 5       | 0 < V5 <= 120 | E5 = V5^2               | P5 = 100 * V5 - V5^2/10 |\n| 6       | 0 < V6 <= 120 | E6 = V6^2               | P6 = 100 * V6 - V6^2/10 |\n\nThe objective is to minimize the total energy consumption (E1 + E2 + E3 + E4 + E5 + E6) while maintaining a minimum production rate of 1000 units per hour (P1 + P2 + P3 + P4 + P5 + P6 >= 1000). Additionally, the total energy consumption should not exceed 15000 units.\n\nPlease help the plant manager determine the optimal voltage settings for each machine to achieve these goals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120) # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120) # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120) # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120) # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120) # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120) # voltage for machine 6\n\n# Define objective function\n## Energy consumption for machine i: Ei = Vi^2\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\n## Production rate for machine i: Pi = 100 * Vi - Vi^2/10\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\n## Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n## Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\nmodel.addCons(P1 + P2 + P3 + P4 + P5 + P6 >= 1000)\n## The total energy consumption should not exceed 15000 units.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 + E6 <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1359,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of production per unit of ProductA is $30, ProductB is $40, and ProductC is $35. The fixed operational cost per shift is $1000. The company aims to maximize the net profit per day.\n// Revenue_ProductA = ProductAQty * 50\n// Revenue_ProductB = ProductBQty * 70\n// Revenue_ProductC = ProductCQty * 60\n// Cost_ProductA = ProductAQty * 30\n// Cost_ProductB = ProductBQty * 40\n// Cost_ProductC = ProductCQty * 35\n// FixedCost = NumShifts * 1000\n// NetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n// So, the objective function is: Maximize (NetProfit)\n\n## Generate Constraint-1:\nThe company has a daily production capacity of 1000 units in total.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe total number of shifts cannot exceed 5 due to labor regulations.\n// NumShifts <= 5\n\n## Generate Constraint-3:\nThe company has a minimum daily production requirement for each product: ProductA must produce at least 100 units, ProductB at least 150 units, and ProductC at least 200 units.\n// ProductAQty >= 100\n// ProductBQty >= 150\n// ProductCQty >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product. The revenue per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of production per unit of ProductA is $30, ProductB is $40, and ProductC is $35. The fixed operational cost per shift is $1000. The company aims to maximize the net profit per day.\nThe company has a daily production capacity of 1000 units in total. The total number of shifts cannot exceed 5 due to labor regulations. The company has a minimum daily production requirement for each product: ProductA must produce at least 100 units, ProductB at least 150 units, and ProductC at least 200 units.\nPlease help the company to maximize the net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nRevenue_ProductA = ProductAQty * 50\nRevenue_ProductB = ProductBQty * 70\nRevenue_ProductC = ProductCQty * 60\nCost_ProductA = ProductAQty * 30\nCost_ProductB = ProductBQty * 40\nCost_ProductC = ProductCQty * 35\nFixedCost = NumShifts * 1000\nNetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000) # daily production capacity\nmodel.addCons(NumShifts <= 5) # maximum number of shifts\nmodel.addCons(ProductAQty >= 100) # minimum production for ProductA\nmodel.addCons(ProductBQty >= 150) # minimum production for ProductB\nmodel.addCons(ProductCQty >= 200) # minimum production for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to differences in fuel efficiency, maintenance costs, and distance. \nFor route R1, the cost per truck is $1000, and the delivery efficiency (goods delivered per hour) is 50 units.\nFor route R2, the cost per truck is $1200, and the delivery efficiency is 60 units.\nFor route R3, the cost per truck is $1500, and the delivery efficiency is 70 units.\nFor route R4, the cost per truck is $1800, and the delivery efficiency is 80 units.\nFor route R5, the cost per truck is $2000, and the delivery efficiency is 90 units.\nThe company wants to minimize the total cost while maintaining a certain level of delivery efficiency.\n// Cost_R1 = 1000 * T1\n// Cost_R2 = 1200 * T2\n// Cost_R3 = 1500 * T3\n// Cost_R4 = 1800 * T4\n// Cost_R5 = 2000 * T5\n// Delivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n// The objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per truck and the delivery efficiency (goods delivered per hour) for each route are given in the following Table.\n\n| Route | Cost per Truck | Delivery Efficiency |\n|-------|----------------|---------------------|\n| R1    | $1000          | 50 units            |\n| R2    | $1200          | 60 units            |\n| R3    | $1500          | 70 units            |\n| R4    | $1800          | 80 units            |\n| R5    | $2000          | 90 units            |\n\nThe company has a total budget of $100,000 for operating costs. The total number of trucks available is 50. Please help the company to minimize the total cost while maintaining a certain level of delivery efficiency, defined as the ratio of the total operating cost to the total delivery efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_R1 = 1000 * T1\nCost_R2 = 1200 * T2\nCost_R3 = 1500 * T3\nCost_R4 = 1800 * T4\nCost_R5 = 2000 * T5\nDelivery_Efficiency = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n## the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) / Delivery_Efficiency\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Efficiency == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\n## The company has a total budget of $100,000 for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company can invest in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"hours of operation for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency upgrade for Solar plant\": \"Efficiency_Solar\", \"range\": \"Efficiency_Solar >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Wind plant\": \"Efficiency_Wind\", \"range\": \"Efficiency_Wind >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Hydro plant\": \"Efficiency_Hydro\", \"range\": \"Efficiency_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company aims to maximize the total daily energy production from all plants.\n// Total energy output for Solar: Output_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\n// Total energy output for Wind: Output_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\n// Total energy output for Hydro: Output_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Output_Solar + Output_Wind + Output_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for daily operations and efficiency upgrades.\n// Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the amount to invest in efficiency upgrades for each plant to maximize energy production. The energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company has a budget of $100,000 for daily operations and efficiency upgrades. Please help the company to maximize the total daily energy production from all plants.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=0)  # hours of operation for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=0)  # hours of operation for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=0)  # hours of operation for Hydro plant\nEfficiency_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Solar\", lb=0)  # investment in efficiency upgrade for Solar plant\nEfficiency_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Wind\", lb=0)  # investment in efficiency upgrade for Wind plant\nEfficiency_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Hydro\", lb=0)  # investment in efficiency upgrade for Hydro plant\n\n# Define objective function\nOutput_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\nOutput_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\nOutput_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output_Solar + Output_Wind + Output_Hydro)\n\n# Add constraints\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(Hours_Solar))\n    print(\"Hours of operation for Wind plant: \", model.getVal(Hours_Wind))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(Hours_Hydro))\n    print(\"Investment in efficiency upgrade for Solar plant: \", model.getVal(Efficiency_Solar))\n    print(\"Investment in efficiency upgrade for Wind plant: \", model.getVal(Efficiency_Wind))\n    print(\"Investment in efficiency upgrade for Hydro plant: \", model.getVal(Efficiency_Hydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production. Additionally, the company must determine the number of hours of maintenance each machine requires daily.\n// {\"number of operating hours for MachineA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n// Net revenue for MachineA: RevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\n// Net revenue for MachineB: RevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\n// Net revenue for MachineC: RevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total daily operating hours for all machines must not exceed 24 hours.\n// HoursA + HoursB + HoursC <= 24\n\n## Generate Constraint-2:\nThe total daily maintenance hours for all machines must not exceed 8 hours.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 8\n\n## Generate Constraint-3:\nMachineA must operate at least 2 hours daily.\n// HoursA >= 2\n\n## Generate Constraint-4:\nMachineB and MachineC combined must not operate more than 16 hours daily.\n// HoursB + HoursC <= 16",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production and the number of hours of maintenance each machine requires daily. The revenue, cost, and maintenance cost for each machine per hour of operation are given in the following Table.\n\n| Machine | Revenue per Hour | Cost per Hour | Maintenance Cost per Hour |\n|---------|------------------|---------------|---------------------------|\n| MachineA | $500            | $200          | $100                      |\n| MachineB | $700            | $300          | $100                      |\n| MachineC | $900            | $400          | $100                      |\n\nThe company aims to maximize the total net revenue per day. The total daily operating hours for all machines must not exceed 24 hours. The total daily maintenance hours for all machines must not exceed 8 hours. MachineA must operate at least 2 hours daily. MachineB and MachineC combined must not operate more than 16 hours daily.\n\nPlease help the company to determine the optimal number of operating and maintenance hours for each machine to maximize the total net revenue per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of operating hours for MachineA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of operating hours for MachineB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of operating hours for MachineC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # number of maintenance hours for MachineA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # number of maintenance hours for MachineB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # number of maintenance hours for MachineC\n\n# Define objective function\nRevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\nRevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\nRevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The total daily operating hours for all machines must not exceed 24 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 24)\n# The total daily maintenance hours for all machines must not exceed 8 hours.\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 8)\n# MachineA must operate at least 2 hours daily.\nmodel.addCons(HoursA >= 2)\n# MachineB and MachineC combined must not operate more than 16 hours daily.\nmodel.addCons(HoursB + HoursC <= 16)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for MachineA: \", model.getVal(HoursA))\n    print(\"Operating Hours for MachineB: \", model.getVal(HoursB))\n    print(\"Operating Hours for MachineC: \", model.getVal(HoursC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency. The selling price per unit of ProductA is $150, ProductB is $225, and ProductC is $300. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - (100 - 0.001 * IA)) * QA\n// ProfitB = (225 - (150 - 0.0015 * IB)) * QB\n// ProfitC = (300 - (200 - 0.002 * IC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency investments.\n// IA + IB + IC <= 100000\n\n## Generate Constraint-2:\nThe total production quantity cannot exceed 5000 units.\n// QA + QB + QC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product (ProductA: QA, ProductB: QB, ProductC: QC) and the amount of money to be invested in enhancing the production efficiency of each product (ProductA: IA, ProductB: IB, ProductC: IC). The efficiency enhancement directly reduces the production cost per unit. The production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency. The selling price per unit of ProductA is $150, ProductB is $225, and ProductC is $300. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for efficiency investments. The total production quantity cannot exceed 5000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in efficiency for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in efficiency for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.001 * IA)) * QA\nProfitB = (225 - (150 - 0.0015 * IB)) * QB\nProfitC = (300 - (200 - 0.002 * IC)) * QC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(IA + IB + IC <= 100000) # total budget for efficiency investments\nmodel.addCons(QA + QB + QC <= 5000) # total production quantity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(IA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(IB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(IC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate for each product, and the amount of capital to invest in automation technology to enhance production efficiency. The efficiency gain from automation is nonlinear and decreases as more capital is invested.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for ProductA is $60, ProductB is $80, and ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.0001 * Automation) * UnitsA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.0001 * Automation) * UnitsB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.0001 * Automation) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for allocation.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate for each product, and the amount of capital to invest in automation technology to enhance production efficiency. The efficiency gain from automation is nonlinear and decreases as more capital is invested. The revenue and initial production costs for each product are given in the following Table.\n\n| Product | Revenue per Unit | Initial Cost per Unit |\n|---------|------------------|-----------------------|\n| ProductA | $100             | $60                   |\n| ProductB | $150             | $80                   |\n| ProductC | $200             | $100                  |\n\nThe cost of production per unit decreases by $1 for every $10,000 invested in automation. The company has a total of 100 workers available for allocation. The total investment in automation cannot exceed $50,000. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 60 + 0.0001 * Automation) * UnitsA\nProfitB = (150 - 80 + 0.0001 * Automation) * UnitsB\nProfitC = (200 - 100 + 0.0001 * Automation) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal systems\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels is 0.2 kWh per panel per day, with a cost of $1000 per panel and a lifespan of 20 years.\nThe efficiency of wind turbines is 0.3 kWh per turbine per day, with a cost of $2000 per turbine and a lifespan of 15 years.\nThe efficiency of hydroelectric plants is 0.4 kWh per plant per day, with a cost of $3000 per plant and a lifespan of 25 years.\nThe efficiency of geothermal systems is 0.25 kWh per system per day, with a cost of $2500 per system and a lifespan of 20 years.\nThe efficiency of biomass generators is 0.15 kWh per generator per day, with a cost of $1500 per generator and a lifespan of 10 years.\nThe city aims to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).\n// Daily energy production: Energy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\n// Investment cost: Cost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n// So, the objective function is: Maximize Energy / Cost\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of these systems.\n// 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000",
        "question": "A city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost. The efficiency, cost per unit, and lifespan of each system are given in the following Table.\n\n| System Type       | Efficiency (kWh/day) | Cost per Unit | Lifespan (years) |\n|-------------------|----------------------|---------------|------------------|\n| Solar Panels      | 0.2                  | $1000         | 20               |\n| Wind Turbines     | 0.3                  | $2000         | 15               |\n| Hydroelectric     | 0.4                  | $3000         | 25               |\n| Geothermal Systems| 0.25                 | $2500         | 20               |\n| Biomass Generators| 0.15                 | $1500         | 10               |\n\nThe city has a budget of $1,000,000 for the installation of these systems. The city aims to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).\nPlease help the city to determine the optimal number of units of each renewable energy system to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric plants\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal systems\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\nCost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n## the objective function is: Maximize Energy / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation of these systems.\nmodel.addCons(1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Systems: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Generators: \", model.getVal(Biomass))\n    print(\"Maximized Energy Production per Investment Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different fuel consumption rate per truck. Route 1 consumes 20 liters per hour, Route 2 consumes 25 liters per hour, Route 3 consumes 30 liters per hour, Route 4 consumes 35 liters per hour, and Route 5 consumes 40 liters per hour. The company aims to minimize the total fuel consumption while ensuring all deliveries are made within a specified time frame. The total fuel consumption is a nonlinear function of the number of trucks on each route due to varying traffic conditions and load factors.\n// Fuel_Consumption_Route1 = 20 * T1^1.2\n// Fuel_Consumption_Route2 = 25 * T2^1.2\n// Fuel_Consumption_Route3 = 30 * T3^1.2\n// Fuel_Consumption_Route4 = 35 * T4^1.2\n// Fuel_Consumption_Route5 = 40 * T5^1.2\n// So, the objective function is: Minimize Fuel_Consumption_Route1 + Fuel_Consumption_Route2 + Fuel_Consumption_Route3 + Fuel_Consumption_Route4 + Fuel_Consumption_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation across all routes.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has a different fuel consumption rate per truck: Route 1 consumes 20 liters per hour, Route 2 consumes 25 liters per hour, Route 3 consumes 30 liters per hour, Route 4 consumes 35 liters per hour, and Route 5 consumes 40 liters per hour. The total fuel consumption is a nonlinear function of the number of trucks on each route due to varying traffic conditions and load factors. The company has a total of 100 trucks available for allocation across all routes.\n\nPlease help the company to minimize the total fuel consumption while ensuring all deliveries are made within a specified time frame.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Consumption_Route1 + Fuel_Consumption_Route2 + Fuel_Consumption_Route3 + Fuel_Consumption_Route4 + Fuel_Consumption_Route5\n## convert the nonlinear terms to linear constraints using auxiliary variables\nT1_power = model.addVar(vtype=\"INTEGER\", name=\"T1_power\")\nT2_power = model.addVar(vtype=\"INTEGER\", name=\"T2_power\")\nT3_power = model.addVar(vtype=\"INTEGER\", name=\"T3_power\")\nT4_power = model.addVar(vtype=\"INTEGER\", name=\"T4_power\")\nT5_power = model.addVar(vtype=\"INTEGER\", name=\"T5_power\")\nmodel.addCons(T1_power == T1**1.2)\nmodel.addCons(T2_power == T2**1.2)\nmodel.addCons(T3_power == T3**1.2)\nmodel.addCons(T4_power == T4**1.2)\nmodel.addCons(T5_power == T5**1.2)\nFuel_Consumption_Route1 = 20 * T1_power\nFuel_Consumption_Route2 = 25 * T2_power\nFuel_Consumption_Route3 = 30 * T3_power\nFuel_Consumption_Route4 = 35 * T4_power\nFuel_Consumption_Route5 = 40 * T5_power\nmodel.addCons(obj == Fuel_Consumption_Route1 + Fuel_Consumption_Route2 + Fuel_Consumption_Route3 + Fuel_Consumption_Route4 + Fuel_Consumption_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation across all routes.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region to optimize fuel efficiency and reduce operational costs. Additionally, the company is considering investing in hybrid technology for some of its trucks to further enhance fuel efficiency.\n// {\"number of trucks allocated to Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Region1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks increases with the investment in hybrid technology. For every $1000 invested in hybrid technology, the fuel efficiency of a truck improves by 1%. The company aims to minimize the total fuel consumption across all regions.\nThe fuel consumption of a non-hybrid truck in Region1 is 100 liters per 1000 km, in Region2 is 120 liters per 1000 km, and in Region3 is 110 liters per 1000 km.\n// Fuel consumption for Region1: Consumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\n// Fuel consumption for Region2: Consumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\n// Fuel consumption for Region3: Consumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the investment in hybrid technology for each region to optimize fuel efficiency and reduce operational costs. The fuel consumption of non-hybrid trucks and the impact of hybrid technology on fuel efficiency are given in the following Table.\n\n| Region | Fuel Consumption (non-hybrid) | Hybrid Technology Impact |\n|--------|-------------------------------|--------------------------|\n| Region1 | 100 liters per 1000 km        | 1% improvement per $1000 |\n| Region2 | 120 liters per 1000 km        | 1% improvement per $1000 |\n| Region3 | 110 liters per 1000 km        | 1% improvement per $1000 |\n\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments. The total number of trucks available for allocation is limited to 500. \nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks allocated to Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks allocated to Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks allocated to Region3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for Region1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for Region2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for Region3\n\n# Define objective function\nConsumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\nConsumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\nConsumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocation and hybrid technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\n# The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Hybrid Technology for Region1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Region2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Region3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the revenue generated per trip to the fuel cost per trip. Trucks generate $500 per trip with a fuel cost of $50, Vans generate $300 per trip with a fuel cost of $30, and Bikes generate $100 per trip with a fuel cost of $10. The company aims to maximize the total efficiency, which is the sum of the efficiencies of all vehicles.\n// Efficiency_T = (500 - 50) / 50 * T\n// Efficiency_V = (300 - 30) / 30 * V\n// Efficiency_B = (100 - 10) / 10 * B\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per month.\n// 100 * T + 50 * V + 20 * B <= 10000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 100 vehicles in total.\n// T + V + B <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the ratio of the revenue generated per trip to the fuel cost per trip, as shown in the following Table.\n\n| Vehicle | Revenue per Trip | Fuel Cost per Trip |\n|---------|------------------|--------------------|\n| Trucks  | $500             | $50                |\n| Vans    | $300             | $30                |\n| Bikes   | $100             | $10                |\n\nThe company has a budget of $10,000 for vehicle maintenance per month. The company can only operate a maximum of 100 vehicles in total. Please help the company to maximize the total efficiency, which is the sum of the efficiencies of all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = (500 - 50) / 50 * T\nEfficiency_V = (300 - 30) / 30 * V\nEfficiency_B = (100 - 10) / 10 * B\n## the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_T + Efficiency_V + Efficiency_B)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance per month.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 10000)\n## The company can only operate a maximum of 100 vehicles in total.\nmodel.addCons(T + V + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption of the fleet by determining the optimal speed for each truck. Additionally, the company needs to decide on the number of trucks to deploy for each route.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"50 <= Speed_i <= 100\", \"type\": \"continuous\"}\n// {\"number of trucks for route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function: Fuel_Consumption_i = a * (Speed_i^2) + b * Speed_i + c, where a, b, and c are constants. The company aims to minimize the total fuel consumption across all trucks.\n// Total fuel consumption: Fuel_Total = \u03a3 [a * (Speed_i^2) + b * Speed_i + c] * Trucks_j for all routes j\n// So, the objective function is: Minimize Fuel_Total\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel costs.\n// \u03a3 [(a * (Speed_i^2) + b * Speed_i + c) * Trucks_j] <= 100,000 for all routes j\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// \u03a3 Trucks_j <= 50 for all routes j",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption of the fleet by determining the optimal speed for each truck and the number of trucks to deploy for each route. The speed of each truck should be between 50 and 100 km/h, and the number of trucks for each route should be a non-negative integer.\nThe fuel consumption of each truck is modeled by a nonlinear function: Fuel_Consumption_i = a * (Speed_i^2) + b * Speed_i + c, where a, b, and c are constants. The company aims to minimize the total fuel consumption across all trucks.\nThe company has a total budget of $100,000 for fuel costs. The total number of trucks available is limited to 50.\nPlease help the company to minimize the total fuel consumption while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define speed of truck i and number of trucks for route j\nnum_routes = 10  # Example number of routes, adjust as necessary\ntrucks = [model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0) for j in range(num_routes)]\nspeeds = [model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=50, ub=100) for i in range(num_routes)]\n\n# Define objective function\n## Calculate fuel consumption for each truck\na, b, c = 0.001, 0.1, 10  # Example constants, adjust as necessary\nfuel_consumption = sum(a * speed**2 + b * speed + c for speed in speeds)\n## Total fuel consumption across all trucks\nFuel_Total = sum(fuel_consumption * trucks[j] for j in range(num_routes))\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Total)\n\n# Add constraints\n## Total budget for fuel costs\nmodel.addCons(Fuel_Total <= 100000)\n## Total number of trucks available\nmodel.addCons(sum(trucks) <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Optimal Speeds: \", [model.getVal(speeds[i]) for i in range(num_routes)])\n    print(\"Optimal Number of Trucks per Route: \", [model.getVal(trucks[j]) for j in range(num_routes)])\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 2,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The cost function is defined as Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2). The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost.\n// Maximize Profit = (20A + 30B + 40C + 50D) - (10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2))\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs in the next quarter.\n// 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2) <= 5000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each product are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2A + 3B + 4C + 5D <= 1000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to maintain a balanced production where the ratio of product A to product B is at least 1:2.\n// A >= 0.5 * B",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $15                      |\n| C       | $40             | $20                      |\n| D       | $50             | $25                      |\n\nThe company has a budget of $5000 for production costs in the next quarter. The company wants to ensure that at least 50 units of each product are produced in the next quarter. The company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. Additionally, the company wants to maintain a balanced production where the ratio of product A to product B is at least 1:2.\n\nPlease help the company to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The cost function is defined as Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2), and the objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50)  # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50)  # number of units of product D\n\n# Define objective function\n# Maximize Profit = (20A + 30B + 40C + 50D) - (10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2))\n# Convert the quadratic terms to linear by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\nmodel.addCons(D_sq == D * D)\n\nCost = 10 * A + 15 * B + 20 * C + 25 * D - 0.01 * (A_sq + B_sq + C_sq + D_sq)\nProfit = 20 * A + 30 * B + 40 * C + 50 * D - Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a budget of $5000 for production costs in the next quarter.\nmodel.addCons(Cost <= 5000)\n\n# The company has a limited production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n\n# The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# The company wants to maintain a balanced production where the ratio of product A to product B is at least 1:2.\nmodel.addCons(A >= 0.5 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1616,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints.\n// {\"number of solar panels on building A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building A generates 10 kWh per day, costs $100, and requires 1 square meter of roof space.\nEach solar panel on building B generates 15 kWh per day, costs $150, and requires 1.5 square meters of roof space.\nEach solar panel on building C generates 20 kWh per day, costs $200, and requires 2 square meters of roof space.\nEach solar panel on building D generates 25 kWh per day, costs $250, and requires 2.5 square meters of roof space.\nEach solar panel on building E generates 30 kWh per day, costs $300, and requires 3 square meters of roof space.\nThe city aims to maximize the total daily energy generation (kWh) while minimizing the total cost of installation.\n// Daily energy generation from A: Energy_A = 10 * A\n// Daily energy generation from B: Energy_B = 15 * B\n// Daily energy generation from C: Energy_C = 20 * C\n// Daily energy generation from D: Energy_D = 25 * D\n// Daily energy generation from E: Energy_E = 30 * E\n// Total cost of installation: Cost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n// So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n\n## Generate Constraint-1:\nThe total budget for the solar panel installation is $10,000.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints.\nEach solar panel on building A generates 10 kWh per day, costs $100, and requires 1 square meter of roof space.\nEach solar panel on building B generates 15 kWh per day, costs $150, and requires 1.5 square meters of roof space.\nEach solar panel on building C generates 20 kWh per day, costs $200, and requires 2 square meters of roof space.\nEach solar panel on building D generates 25 kWh per day, costs $250, and requires 2.5 square meters of roof space.\nEach solar panel on building E generates 30 kWh per day, costs $300, and requires 3 square meters of roof space.\nThe total budget for the solar panel installation is $10,000.\nPlease help the city to maximize the total daily energy generation (kWh) while minimizing the total cost of installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels on building A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels on building B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels on building C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels on building D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels on building E\n\n# Define objective function\nEnergy_A = 10 * A\nEnergy_B = 15 * B\nEnergy_C = 20 * C\nEnergy_D = 25 * D\nEnergy_E = 30 * E\nCost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n# convert the division to multiplication\nmodel.addCons(obj == Energy_A + Energy_B + Energy_C + Energy_D + Energy_E - Cost / 1000)\n\n# Add constraints\n# The total budget for the solar panel installation is $10,000.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building A: \", model.getVal(A))\n    print(\"Number of Solar Panels on Building B: \", model.getVal(B))\n    print(\"Number of Solar Panels on Building C: \", model.getVal(C))\n    print(\"Number of Solar Panels on Building D: \", model.getVal(D))\n    print(\"Number of Solar Panels on Building E: \", model.getVal(E))\n    print(\"Maximized Daily Energy Generation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption\n\n## Generate Constraint-3:\nThe company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n// CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000\n\n## Generate Constraint-4:\nThe company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n// Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption. The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems. The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems. Please help the company to minimize the total energy cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # example efficiency for solar panels\nWindEfficiency = 0.3  # example efficiency for wind turbines\nTotalEnergyDemand = 10000  # example total energy demand of the company\nPricePerKWh = 0.1  # example price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**(-1)) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 1000  # example average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n## The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\nCostOfSolarPanel = 1000  # example cost of a solar panel\nCostOfWindTurbine = 2000  # example cost of a wind turbine\nCostOfStorage = 100  # example cost of storage per kWh\nmodel.addCons(CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000)\n## The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\nmodel.addCons(Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Minimized Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 639,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, heavy machinery, and hazardous materials. The company needs to decide on the number of trucks to purchase for each type of cargo and the fuel efficiency of each truck type.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"MachineryTrucks\", \"range\": \"MachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for perishable goods (miles per gallon)\": \"PerishableEfficiency\", \"range\": \"PerishableEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for heavy machinery (miles per gallon)\": \"MachineryEfficiency\", \"range\": \"MachineryEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for hazardous materials (miles per gallon)\": \"HazardousEfficiency\", \"range\": \"HazardousEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3. The company estimates that each truck for perishable goods will travel 5000 miles per month, for heavy machinery 3000 miles per month, and for hazardous materials 2000 miles per month. The company aims to minimize the total monthly fuel cost.\n// FuelCost_Perishable = 5000 * PerishableTrucks / PerishableEfficiency * 3\n// FuelCost_Machinery = 3000 * MachineryTrucks / MachineryEfficiency * 3\n// FuelCost_Hazardous = 2000 * HazardousTrucks / HazardousEfficiency * 3\n// So, the objective function is: Minimize (FuelCost_Perishable + FuelCost_Machinery + FuelCost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// PerishableTrucks * 20000 + MachineryTrucks * 30000 + HazardousTrucks * 40000 <= 100000\n\n## Generate Constraint-2:\nThe company must ensure that the total number of trucks does not exceed 10.\n// PerishableTrucks + MachineryTrucks + HazardousTrucks <= 10\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks for hazardous materials must be at least 10% better than the efficiency of trucks for perishable goods.\n// HazardousEfficiency >= 1.10 * PerishableEfficiency",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, heavy machinery, and hazardous materials. The company needs to decide on the number of trucks to purchase for each type of cargo and the fuel efficiency of each truck type. The cost of fuel per gallon is $3. The company estimates that each truck for perishable goods will travel 5000 miles per month, for heavy machinery 3000 miles per month, and for hazardous materials 2000 miles per month. The company aims to minimize the total monthly fuel cost. The company has a budget of $100,000 for purchasing new trucks. The company must ensure that the total number of trucks does not exceed 10. The fuel efficiency of trucks for hazardous materials must be at least 10% better than the efficiency of trucks for perishable goods. Please help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total monthly fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"MachineryTrucks\", lb=0)  # number of trucks for heavy machinery\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)  # number of trucks for hazardous materials\nPerishableEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableEfficiency\", lb=0)  # fuel efficiency of trucks for perishable goods\nMachineryEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryEfficiency\", lb=0)  # fuel efficiency of trucks for heavy machinery\nHazardousEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousEfficiency\", lb=0)  # fuel efficiency of trucks for hazardous materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Perishable = 5000 * PerishableTrucks / PerishableEfficiency * 3\nFuelCost_Machinery = 3000 * MachineryTrucks / MachineryEfficiency * 3\nFuelCost_Hazardous = 2000 * HazardousTrucks / HazardousEfficiency * 3\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_Perishable + FuelCost_Machinery + FuelCost_Hazardous)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(PerishableTrucks * 20000 + MachineryTrucks * 30000 + HazardousTrucks * 40000 <= 100000)\n## The company must ensure that the total number of trucks does not exceed 10.\nmodel.addCons(PerishableTrucks + MachineryTrucks + HazardousTrucks <= 10)\n## The fuel efficiency of trucks for hazardous materials must be at least 10% better than the efficiency of trucks for perishable goods.\nmodel.addCons(HazardousEfficiency >= 1.10 * PerishableEfficiency)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(MachineryTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousTrucks))\n    print(\"Fuel Efficiency of Trucks for Perishable Goods: \", model.getVal(PerishableEfficiency))\n    print(\"Fuel Efficiency of Trucks for Heavy Machinery: \", model.getVal(MachineryEfficiency))\n    print(\"Fuel Efficiency of Trucks for Hazardous Materials: \", model.getVal(HazardousEfficiency))\n    print(\"Minimized Monthly Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good. Additionally, the company needs to decide on the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit.\n// {\"number of units of GoodsA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for GoodsA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe transportation cost per unit decreases with the investment in fuel efficiency for each type of good.\nThe initial cost per unit of GoodsA is $30, but with fuel efficiency upgrades, the cost decreases by $1 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsB is $40, and with fuel efficiency upgrades, the cost decreases by $1.5 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsC is $50, and with fuel efficiency upgrades, the cost decreases by $2 per unit for every $100 invested in efficiency. \nThe company aims to minimize the total transportation cost from all goods.\n// Total cost for GoodsA: CostA = (30 - 0.01 * EfficiencyA) * UnitsA\n// Total cost for GoodsB: CostB = (40 - 0.015 * EfficiencyB) * UnitsB\n// Total cost for GoodsC: CostC = (50 - 0.02 * EfficiencyC) * UnitsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000\n\n## Generate Constraint-2:\nThe total capacity of the fleet for the next month is limited to 500 units.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must transport at least 50 units of GoodsA and 100 units of GoodsB.\n// UnitsA >= 50; UnitsB >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total investment in fuel efficiency for GoodsC does not exceed the combined investment for GoodsA and GoodsB.\n// EfficiencyC <= EfficiencyA + EfficiencyB\n\n## Generate Constraint-5:\nThe company wants to ensure that the total transportation of GoodsC does not exceed the combined transportation of GoodsA and GoodsB.\n// UnitsC <= UnitsA + UnitsB",
        "question": "A logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good and the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit. The initial cost per unit of GoodsA is $30, GoodsB is $40, and GoodsC is $50. The cost decreases with investment in fuel efficiency: $1 per unit for every $100 invested in GoodsA, $1.5 per unit for every $100 invested in GoodsB, and $2 per unit for every $100 invested in GoodsC. The company aims to minimize the total transportation cost from all goods. The company has a total budget of $20,000 for transportation and fuel efficiency upgrades. The total capacity of the fleet for the next month is limited to 500 units. Due to contractual agreements, the company must transport at least 50 units of GoodsA and 100 units of GoodsB. The company wants to ensure that the total investment in fuel efficiency for GoodsC does not exceed the combined investment for GoodsA and GoodsB, and that the total transportation of GoodsC does not exceed the combined transportation of GoodsA and GoodsB. Please help the company to determine the optimal number of units to transport and the appropriate level of fuel efficiency upgrades to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of GoodsA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of GoodsB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of GoodsC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for GoodsA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for GoodsB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for GoodsC\n\n# Define objective function\nCostA = (30 - 0.01 * EfficiencyA) * UnitsA\nCostB = (40 - 0.015 * EfficiencyB) * UnitsB\nCostC = (50 - 0.02 * EfficiencyC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsC <= UnitsA + UnitsB)\nmodel.addCons(EfficiencyC <= EfficiencyA + EfficiencyB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsA: \", model.getVal(UnitsA))\n    print(\"Number of Units of GoodsB: \", model.getVal(UnitsB))\n    print(\"Number of Units of GoodsC: \", model.getVal(UnitsC))\n    print(\"Investment in Fuel Efficiency for GoodsA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for GoodsB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for GoodsC: \", model.getVal(EfficiencyC))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1355,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Cameras. The company needs to determine the production quantities for each device to optimize their profit.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"quantity of Cameras\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, for Laptops is $200, for Smartwatches is $50, and for Cameras is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_S = max(100 + 0.5 * (S - 100), 100) * S\n// Profit_T = max(150 + 0.5 * (T - 100), 150) * T\n// Profit_L = max(200 + 0.5 * (L - 100), 200) * L\n// Profit_W = max(50 + 0.5 * (W - 100), 50) * W\n// Profit_C = max(300 + 0.5 * (C - 100), 300) * C\n// So, the objective function is: Maximize Profit_S + Profit_T + Profit_L + Profit_W + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited budget for production, which is $100,000. The cost of producing each Smartphone is $50, each Tablet is $100, each Laptop is $150, each Smartwatch is $30, and each Camera is $250.\n// 50 * S + 100 * T + 150 * L + 30 * W + 250 * C <= 100000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, for Smartwatches is 400 units, and for Cameras is 100 units.\n// S <= 500; T <= 300; L <= 200; W <= 400; C <= 100",
        "question": "A manufacturer produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Cameras. The company needs to determine the production quantities for each device to optimize their profit. The profit per unit for Smartphones is $100, for Tablets is $150, for Laptops is $200, for Smartwatches is $50, and for Cameras is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production quantity exceeds 100 units. The company has a limited budget for production, which is $100,000. The cost of producing each Smartphone is $50, each Tablet is $100, each Laptop is $150, each Smartwatch is $30, and each Camera is $250. The market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, for Smartwatches is 400 units, and for Cameras is 100 units. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=400) # quantity of Smartwatches\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # quantity of Cameras\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_S = max(100 + 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 100 * S1 * S_b1 + (100 + 0.5 * (S2 - 100)) * S2 * S_b2\n\n## create piecewise variables for piecewise function: Profit_T = max(150 + 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nProfit_T = 150 * T1 * T_b1 + (150 + 0.5 * (T2 - 100)) * T2 * T_b2\n\n## create piecewise variables for piecewise function: Profit_L = max(200 + 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nProfit_L = 200 * L1 * L_b1 + (200 + 0.5 * (L2 - 100)) * L2 * L_b2\n\n## create piecewise variables for piecewise function: Profit_W = max(50 + 0.5 * (W - 100), 50) * W\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=100)\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=100, ub=400)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nmodel.addCons(W_b1 + W_b2 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2)\nProfit_W = 50 * W1 * W_b1 + (50 + 0.5 * (W2 - 100)) * W2 * W_b2\n\n## create piecewise variables for piecewise function: Profit_C = max(300 + 0.5 * (C - 100), 300) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 300 * C1 * C_b1 + (300 + 0.5 * (C2 - 100)) * C2 * C_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_S + Profit_T + Profit_L + Profit_W + Profit_C\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L + Profit_W + Profit_C)\n\n# Add constraints\nmodel.addCons(50 * S + 100 * T + 150 * L + 30 * W + 250 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Quantity of Smartwatch: \", model.getVal(W))\n    print(\"Quantity of Camera: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"quantity of ProductA\": \"ProductAQ\", \"range\": \"ProductAQ >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQ\", \"range\": \"ProductBQ >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQ\", \"range\": \"ProductCQ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (Selling Price - Production Cost) * Quantity, where the selling price is $100 per unit, and the production cost is $60 per unit. For ProductB, the selling price is $150 per unit, and the production cost is $100 per unit. For ProductC, the selling price is $200 per unit, and the production cost is $120 per unit. The company wants to maximize the total profit.\n// Profit_ProductA = (100 - 60) * ProductAQ\n// Profit_ProductB = (150 - 100) * ProductBQ\n// Profit_ProductC = (200 - 120) * ProductCQ\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per month.\n// ProductAQ + ProductBQ + ProductCQ <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\n// ProductAQ >= 2 * ProductBQ\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for production costs per month.\n// 60 * ProductAQ + 100 * ProductBQ + 120 * ProductCQ <= 100,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// ProductAQ >= 1; ProductBQ >= 1; ProductCQ >= 1\n\n## Generate Constraint-5:\nDue to supplier agreements, the company must produce at least 100 units of ProductC per month.\n// ProductCQ >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to optimize its profit. The profit for ProductA is calculated as (Selling Price - Production Cost) * Quantity, where the selling price is $100 per unit, and the production cost is $60 per unit. For ProductB, the selling price is $150 per unit, and the production cost is $100 per unit. For ProductC, the selling price is $200 per unit, and the production cost is $120 per unit. The company has a limited production capacity of 1000 units per month and a budget of $100,000 for production costs per month. Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB. The company wants to ensure that at least one unit of each product is produced to maintain market presence and must produce at least 100 units of ProductC per month. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQ = model.addVar(vtype=\"INTEGER\", name=\"ProductAQ\", lb=1)  # quantity of ProductA\nProductBQ = model.addVar(vtype=\"INTEGER\", name=\"ProductBQ\", lb=1)  # quantity of ProductB\nProductCQ = model.addVar(vtype=\"INTEGER\", name=\"ProductCQ\", lb=100)  # quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (100 - 60) * ProductAQ\nProfit_ProductB = (150 - 100) * ProductBQ\nProfit_ProductC = (200 - 120) * ProductCQ\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per month.\nmodel.addCons(ProductAQ + ProductBQ + ProductCQ <= 1000)\n# Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductAQ >= 2 * ProductBQ)\n# The company has a budget of $100,000 for production costs per month.\nmodel.addCons(60 * ProductAQ + 100 * ProductBQ + 120 * ProductCQ <= 100000)\n# The company wants to ensure that at least one unit of each product is produced to maintain market presence.\nmodel.addCons(ProductAQ >= 1)\nmodel.addCons(ProductBQ >= 1)\nmodel.addCons(ProductCQ >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQ))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQ))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQ))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements.\n// {\"number of trucks of type 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for T1 is 0.5 liters per kilometer, and the maintenance cost is $100 per month.\nFor T2, the fuel consumption rate is 0.4 liters per kilometer, and the maintenance cost is $120 per month.\nFor T3, the fuel consumption rate is 0.3 liters per kilometer, and the maintenance cost is $150 per month.\nFor T4, the fuel consumption rate is 0.25 liters per kilometer, and the maintenance cost is $180 per month.\nFor T5, the fuel consumption rate is 0.2 liters per kilometer, and the maintenance cost is $200 per month.\nThe company wants to minimize the total cost of fuel and maintenance per month.\n// Total fuel cost: FuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\n// Total maintenance cost: MaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for purchasing new trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements. The fuel consumption rate and maintenance cost for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Maintenance Cost per Month ($) |\n|------------|-----------------------------------|--------------------------------|\n| T1         | 0.5                               | 100                            |\n| T2         | 0.4                               | 120                            |\n| T3         | 0.3                               | 150                            |\n| T4         | 0.25                              | 180                            |\n| T5         | 0.2                               | 200                            |\n\nThe company has a budget of $50,000 per month for purchasing new trucks. The total number of trucks in the fleet must not exceed 50. Please help the company to minimize the total cost of fuel and maintenance per month.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks of type 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks of type 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks of type 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks of type 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks of type 5\n\n# Define objective function\nFuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\nMaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n# So, the objective function is: Minimize (FuelCost + MaintCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintCost)\n\n# Add constraints\n# The company has a budget of $50,000 per month for purchasing new trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000)\n# The total number of trucks in the fleet must not exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type 1: \", model.getVal(T1))\n    print(\"Number of Trucks of Type 2: \", model.getVal(T2))\n    print(\"Number of Trucks of Type 3: \", model.getVal(T3))\n    print(\"Number of Trucks of Type 4: \", model.getVal(T4))\n    print(\"Number of Trucks of Type 5: \", model.getVal(T5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements.\n// {\"number of trucks of type 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for T1 is 0.5 liters per kilometer, and the maintenance cost is $100 per month.\nFor T2, the fuel consumption rate is 0.4 liters per kilometer, and the maintenance cost is $120 per month.\nFor T3, the fuel consumption rate is 0.3 liters per kilometer, and the maintenance cost is $150 per month.\nFor T4, the fuel consumption rate is 0.25 liters per kilometer, and the maintenance cost is $180 per month.\nFor T5, the fuel consumption rate is 0.2 liters per kilometer, and the maintenance cost is $200 per month.\nThe company wants to minimize the total cost of fuel and maintenance per month.\n// Total fuel cost: FuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\n// Total maintenance cost: MaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for purchasing new trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nAt least 10 trucks of type T1 must be in the fleet.\n// T1 >= 10\n\n## Generate Constraint-4:\nNo more than 20% of the fleet can be of type T5.\n// T5 <= 0.2 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements. The fuel consumption rate and maintenance cost for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Maintenance Cost ($/month) |\n|------------|-----------------------------------|----------------------------|\n| T1         | 0.5                               | 100                        |\n| T2         | 0.4                               | 120                        |\n| T3         | 0.3                               | 150                        |\n| T4         | 0.25                              | 180                        |\n| T5         | 0.2                               | 200                        |\n\nThe company has a budget of $50,000 per month for purchasing new trucks. The total number of trucks in the fleet must not exceed 50. At least 10 trucks of type T1 must be in the fleet. No more than 20% of the fleet can be of type T5.\nPlease help the company to minimize the total cost of fuel and maintenance per month.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks of type 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks of type 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks of type 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks of type 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks of type 5\n\n# Define objective function\nFuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\nMaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n# So, the objective function is: Minimize (FuelCost + MaintCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintCost)\n\n# Add constraints\n# The company has a budget of $50,000 per month for purchasing new trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000)\n# The total number of trucks in the fleet must not exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# At least 10 trucks of type T1 must be in the fleet.\nmodel.addCons(T1 >= 10)\n# No more than 20% of the fleet can be of type T5.\nmodel.addCons(T5 <= 0.2 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type 1: \", model.getVal(T1))\n    print(\"Number of Trucks of Type 2: \", model.getVal(T2))\n    print(\"Number of Trucks of Type 3: \", model.getVal(T3))\n    print(\"Number of Trucks of Type 4: \", model.getVal(T4))\n    print(\"Number of Trucks of Type 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the varying efficiency and cost of each machine.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each product varies based on the machine used. \nFor product A, machine 1 yields a profit of $50, machine 2 yields $45, and machine 3 yields $40.\nFor product B, machine 1 yields a profit of $60, machine 2 yields $55, and machine 3 yields $50.\nFor product C, machine 1 yields a profit of $70, machine 2 yields $65, and machine 3 yields $60.\nFor product D, machine 1 yields a profit of $80, machine 2 yields $75, and machine 3 yields $70.\nFor product E, machine 1 yields a profit of $90, machine 2 yields $85, and machine 3 yields $80.\nThe company wants to maximize the total profit from all products.\n// Total profit = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production time for all machines is limited to 100 hours.\n// 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E <= 100",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the varying efficiency and cost of each machine. The profit per unit for each product varies based on the machine used, as shown in the following Table.\n\n| Product | Profit per Unit (Machine 1) | Profit per Unit (Machine 2) | Profit per Unit (Machine 3) |\n|---------|-----------------------------|-----------------------------|-----------------------------|\n| A       | $50                         | $45                         | $40                         |\n| B       | $60                         | $55                         | $50                         |\n| C       | $70                         | $65                         | $60                         |\n| D       | $80                         | $75                         | $70                         |\n| E       | $90                         | $85                         | $80                         |\n\nThe company wants to maximize the total profit from all products. The total production time for all machines is limited to 100 hours. Please help the company determine the optimal number of units of each product to produce to maximize profit, given that the production time for each product is as follows:\n\n| Product | Production Time per Unit (hours) |\n|---------|----------------------------------|\n| A       | 0.1                              |\n| B       | 0.2                              |\n| C       | 0.3                              |\n| D       | 0.4                              |\n| E       | 0.5                              |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nTotal_profit = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\nmodel.addCons(obj == Total_profit)\n\n# Add constraints\n## The total production time for all machines is limited to 100 hours.\nmodel.addCons(0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1699,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production costs and automation investments.\n// (100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// Automation <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n// ProdA <= 500; ProdB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductC are produced.\n// ProdC >= 100\n\n## Generate Constraint-5:\nThe total production quantity of all products must not exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for production costs and automation investments. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units. The company must ensure that at least 100 units of ProductC are produced. The total production quantity of all products must not exceed 1000 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\nProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\nProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons((100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000)\nmodel.addCons(Automation <= 20000)\nmodel.addCons(ProdA <= 500)\nmodel.addCons(ProdB <= 400)\nmodel.addCons(ProdC >= 100)\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooter\", \"range\": \"Scooter >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drone\", \"range\": \"Drone >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $1000, maintenance cost is $200, and capacity is 1000 units.\nThe operational cost per Van is $500, maintenance cost is $100, and capacity is 500 units.\nThe operational cost per Bike is $100, maintenance cost is $20, and capacity is 100 units.\nThe operational cost per Scooter is $50, maintenance cost is $10, and capacity is 50 units.\nThe operational cost per Drone is $200, maintenance cost is $50, and capacity is 200 units.\nThe company wants to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized.\n// Total operational cost: OperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// Total maintenance cost: MaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\n// Total capacity utilized: Capacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// So, the objective function is: Minimize (OperCost + MaintCost) / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational and maintenance costs.\n// 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units.\n// 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone >= 50000\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed the combined number of other vehicles by more than 10.\n// Truck <= (Van + Bike + Scooter + Drone) + 10\n\n## Generate Constraint-4:\nThe number of Drones must be at least 50% of the total number of Trucks and Vans.\n// Drone >= 0.5 * (Truck + Van)\n\n## Generate Constraint-5:\nThe total number of vehicles must not exceed 200.\n// Truck + Van + Bike + Scooter + Drone <= 200",
        "question": "A logistics company is planning its fleet for the next quarter and operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities. The company wants to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized. The operational and maintenance costs, as well as the capacities for each vehicle type, are given in the following Table.\n\n| Vehicle Type | Operational Cost | Maintenance Cost | Capacity |\n|--------------|------------------|------------------|----------|\n| Truck        | $1000            | $200             | 1000 units |\n| Van          | $500             | $100             | 500 units |\n| Bike         | $100             | $20              | 100 units |\n| Scooter      | $50              | $10              | 50 units |\n| Drone        | $200             | $50              | 200 units |\n\nThe company has a budget of $100,000 for operational and maintenance costs. The company must transport at least 50,000 units. The number of Trucks must not exceed the combined number of other vehicles by more than 10. The number of Drones must be at least 50% of the total number of Trucks and Vans. The total number of vehicles must not exceed 200.\n\nPlease help the company determine the optimal number of each vehicle type to minimize the Total Cost per Unit Shipped.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0) # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0) # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0) # number of Bikes\nScooter = model.addVar(vtype=\"INTEGER\", name=\"Scooter\", lb=0) # number of Scooters\nDrone = model.addVar(vtype=\"INTEGER\", name=\"Drone\", lb=0) # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\nMaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\nCapacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n## the objective function is: Minimize (OperCost + MaintCost) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == OperCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $100,000 for operational and maintenance costs.\nmodel.addCons(1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000)\n## The company must transport at least 50,000 units.\nmodel.addCons(1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone >= 50000)\n## The number of Trucks must not exceed the combined number of other vehicles by more than 10.\nmodel.addCons(Truck <= Van + Bike + Scooter + Drone + 10)\n## The number of Drones must be at least 50% of the total number of Trucks and Vans.\nmodel.addCons(Drone >= 0.5 * (Truck + Van))\n## The total number of vehicles must not exceed 200.\nmodel.addCons(Truck + Van + Bike + Scooter + Drone <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Number of Scooters: \", model.getVal(Scooter))\n    print(\"Number of Drones: \", model.getVal(Drone))\n    print(\"Minimized Cost per Unit Shipped: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1457,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel efficiency upgrade. The base fuel consumption for Route1 is 50 liters per 100 km, which decreases by 1 liter per 100 km for every $100 invested in upgrades. For Route2, the base consumption is 60 liters per 100 km, decreasing by 1.2 liters per 100 km for every $100 invested. For Route3, the base consumption is 70 liters per 100 km, decreasing by 1.4 liters per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (50 - 0.01 * Upgrade1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (60 - 0.012 * Upgrade2) * Trucks2\n// Fuel consumption for Route3: Consumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200\n\n## Generate Constraint-3:\nDue to contractual agreements, at least 50 trucks must be allocated to Route1 and 70 trucks to Route2.\n// Trucks1 >= 50; Trucks2 >= 70\n\n## Generate Constraint-4:\nThe total distance covered by Route3 must not exceed 10,000 km, and the average speed of trucks on this route is 60 km/h. The total time spent on Route3 must not exceed 200 hours.\n// Trucks3 * (10000 / 60) <= 200",
        "question": "A logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades.\nThe fuel consumption of each truck is affected by the fuel efficiency upgrade. The base fuel consumption for Route1 is 50 liters per 100 km, which decreases by 1 liter per 100 km for every $100 invested in upgrades. For Route2, the base consumption is 60 liters per 100 km, decreasing by 1.2 liters per 100 km for every $100 invested. For Route3, the base consumption is 70 liters per 100 km, decreasing by 1.4 liters per 100 km for every $100 invested. The company has a budget of $10,000 for fuel efficiency upgrades. The total number of trucks available is limited to 200. Due to contractual agreements, at least 50 trucks must be allocated to Route1 and 70 trucks to Route2. The total distance covered by Route3 must not exceed 10,000 km, and the average speed of trucks on this route is 60 km/h. The total time spent on Route3 must not exceed 200 hours.\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=70)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\n\n# Define objective function\nConsumption1 = (50 - 0.01 * Upgrade1) * Trucks1\nConsumption2 = (60 - 0.012 * Upgrade2) * Trucks2\nConsumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel efficiency upgrades.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# The total number of trucks available is limited to 200.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n# Due to contractual agreements, at least 50 trucks must be allocated to Route1 and 70 trucks to Route2.\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 70)\n# The total distance covered by Route3 must not exceed 10,000 km, and the average speed of trucks on this route is 60 km/h. The total time spent on Route3 must not exceed 200 hours.\nmodel.addCons(Trucks3 * (10000 / 60) <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\n// {\"number of trucks for GoodsA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor GoodsA, the transportation cost per truck is $10,000, the revenue per truck is $15,000, and the storage cost per truck is $2,000. \nFor GoodsB, the transportation cost per truck is $12,000, the revenue per truck is $18,000, and the storage cost per truck is $2,500. \nFor GoodsC, the transportation cost per truck is $14,000, the revenue per truck is $21,000, and the storage cost per truck is $3,000.\nFor GoodsD, the transportation cost per truck is $16,000, the revenue per truck is $24,000, and the storage cost per truck is $3,500.\nFor GoodsE, the transportation cost per truck is $18,000, the revenue per truck is $27,000, and the storage cost per truck is $4,000.\nThe company wants to maximize the net profit per truck.\n// Net profit for GoodsA: Profit_GoodsA = (15,000 - 10,000 - 2,000) * TrucksA\n// Net profit for GoodsB: Profit_GoodsB = (18,000 - 12,000 - 2,500) * TrucksB\n// Net profit for GoodsC: Profit_GoodsC = (21,000 - 14,000 - 3,000) * TrucksC\n// Net profit for GoodsD: Profit_GoodsD = (24,000 - 16,000 - 3,500) * TrucksD\n// Net profit for GoodsE: Profit_GoodsE = (27,000 - 18,000 - 4,000) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20\n\n## Generate Constraint-2:\nDue to contractual agreements, GoodsA must be transported by at least 3 trucks.\n// TrucksA >= 3\n\n## Generate Constraint-3:\nThe company has a budget of $300,000 for transportation costs.\n// 10,000 * TrucksA + 12,000 * TrucksB + 14,000 * TrucksC + 16,000 * TrucksD + 18,000 * TrucksE <= 300,000",
        "question": "A logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\nFor GoodsA, the transportation cost per truck is $10,000, the revenue per truck is $15,000, and the storage cost per truck is $2,000. \nFor GoodsB, the transportation cost per truck is $12,000, the revenue per truck is $18,000, and the storage cost per truck is $2,500. \nFor GoodsC, the transportation cost per truck is $14,000, the revenue per truck is $21,000, and the storage cost per truck is $3,000.\nFor GoodsD, the transportation cost per truck is $16,000, the revenue per truck is $24,000, and the storage cost per truck is $3,500.\nFor GoodsE, the transportation cost per truck is $18,000, the revenue per truck is $27,000, and the storage cost per truck is $4,000.\nThe company has a total of 20 trucks available for distribution. Due to contractual agreements, GoodsA must be transported by at least 3 trucks. The company has a budget of $300,000 for transportation costs.\nPlease help the company to maximize the net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodsA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodsB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodsC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodsD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodsE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_GoodsA = (15000 - 10000 - 2000) * TrucksA\nProfit_GoodsB = (18000 - 12000 - 2500) * TrucksB\nProfit_GoodsC = (21000 - 14000 - 3000) * TrucksC\nProfit_GoodsD = (24000 - 16000 - 3500) * TrucksD\nProfit_GoodsE = (27000 - 18000 - 4000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE)\n\n# Add constraints\n## The company has a total of 20 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20)\n## Due to contractual agreements, GoodsA must be transported by at least 3 trucks.\nmodel.addCons(TrucksA >= 3)\n## The company has a budget of $300,000 for transportation costs.\nmodel.addCons(10000 * TrucksA + 12000 * TrucksB + 14000 * TrucksC + 16000 * TrucksD + 18000 * TrucksE <= 300000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodsB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodsC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodsD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodsE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates.\n// {\"amount of diesel\": \"Diesel\", \"range\": \"Diesel >= 0\", \"type\": \"continuous\"}\n// {\"amount of gasoline\": \"Gasoline\", \"range\": \"Gasoline >= 0\", \"type\": \"continuous\"}\n// {\"amount of natural gas\": \"NaturalGas\", \"range\": \"NaturalGas >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of diesel is $3 per gallon, gasoline is $2.5 per gallon, and natural gas is $1.8 per gallon. The fuel-efficient technologies reduce the consumption rate of each fuel type by a certain percentage based on the investment. The company aims to minimize the total cost of fuel consumption while considering the investment in technologies.\n// Total cost of diesel: CostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\n// Total cost of gasoline: CostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\n// Total cost of natural gas: CostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n// So, the objective function is: Minimize (CostDiesel + CostGasoline + CostNaturalGas)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel purchases and technology investments.\n// 3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons.\n// Diesel + Gasoline + NaturalGas >= 20000",
        "question": "A logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates. The cost of diesel is $3 per gallon, gasoline is $2.5 per gallon, and natural gas is $1.8 per gallon. The fuel-efficient technologies reduce the consumption rate of each fuel type by a certain percentage based on the investment.\n\n| Fuel Type       | Cost per Gallon |\n|-----------------|----------------|\n| Diesel          | $3             |\n| Gasoline        | $2.5           |\n| Natural Gas     | $1.8           |\n\nThe company has a budget of $100,000 for fuel purchases and technology investments. The total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons. Please help the company to minimize the total cost of fuel consumption while considering the investment in technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDiesel = model.addVar(vtype=\"CONTINUOUS\", name=\"Diesel\", lb=0)  # amount of diesel\nGasoline = model.addVar(vtype=\"CONTINUOUS\", name=\"Gasoline\", lb=0)  # amount of gasoline\nNaturalGas = model.addVar(vtype=\"CONTINUOUS\", name=\"NaturalGas\", lb=0)  # amount of natural gas\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in fuel-efficient technologies\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\nCostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\nCostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n## the objective function is: Minimize (CostDiesel + CostGasoline + CostNaturalGas)\nmodel.addCons(obj == CostDiesel + CostGasoline + CostNaturalGas)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel purchases and technology investments.\nmodel.addCons(3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000)\n## The total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons.\nmodel.addCons(Diesel + Gasoline + NaturalGas >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Diesel: \", model.getVal(Diesel))\n    print(\"Amount of Gasoline: \", model.getVal(Gasoline))\n    print(\"Amount of Natural Gas: \", model.getVal(NaturalGas))\n    print(\"Investment in Fuel-Efficient Technologies: \", model.getVal(TechInvestment))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type.\n// {\"number of trucks for Goods A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Goods A (km/liter)\": \"EfficiencyA\", \"range\": \"EfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods B (km/liter)\": \"EfficiencyB\", \"range\": \"EfficiencyB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods C (km/liter)\": \"EfficiencyC\", \"range\": \"EfficiencyC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency.\n// FuelCostA = 3 * (DistanceA / EfficiencyA) * TrucksA\n// FuelCostB = 3 * (DistanceB / EfficiencyB) * TrucksB\n// FuelCostC = 3 * (DistanceC / EfficiencyC) * TrucksC\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $2000 for daily fuel expenses.\n// (DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks that can be used daily.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-3:\nThe total distance that can be covered by all trucks daily is limited to 10000 km.\n// DistanceA * TrucksA / EfficiencyA + DistanceB * TrucksB / EfficiencyB + DistanceC * TrucksC / EfficiencyC <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type. The cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency. The company has a total budget of $2000 for daily fuel expenses. The company has a limit of 50 trucks that can be used daily. The total distance that can be covered by all trucks daily is limited to 10000 km. Please help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Goods A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Goods B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Goods C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceA = model.addVar(name=\"DistanceA\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods A\nDistanceB = model.addVar(name=\"DistanceB\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods B\nDistanceC = model.addVar(name=\"DistanceC\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods C\nEfficiencyA = model.addVar(name=\"EfficiencyA\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods A\nEfficiencyB = model.addVar(name=\"EfficiencyB\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods B\nEfficiencyC = model.addVar(name=\"EfficiencyC\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods C\n\n## the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n## convert the division to multiplication\nmodel.addCons(obj == 3 * (DistanceA / EfficiencyA) * TrucksA + 3 * (DistanceB / EfficiencyB) * TrucksB + 3 * (DistanceC / EfficiencyC) * TrucksC)\n\n# Add constraints\n## The company has a total budget of $2000 for daily fuel expenses.\nmodel.addCons((DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3)\n## The company has a limit of 50 trucks that can be used daily.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## The total distance that can be covered by all trucks daily is limited to 10000 km.\nmodel.addCons(DistanceA * TrucksA / EfficiencyA + DistanceB * TrucksB / EfficiencyB + DistanceC * TrucksC / EfficiencyC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. The company wants to minimize the total cost of purchasing trucks and fuel expenses per year, given that each truck travels an average of 50,000 miles per year.\n// Cost_SmallTrucks = 30000 * SmallTrucks\n// Cost_MediumTrucks = 50000 * MediumTrucks\n// Cost_LargeTrucks = 80000 * LargeTrucks\n// Fuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\n// Fuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\n// Fuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n// So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 500,000 kg.\n// SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary. The cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. Each truck travels an average of 50,000 miles per year. The company has a total budget of $1,000,000 for purchasing trucks and a total of 100 drivers available. The total cargo capacity of all trucks must not exceed 500,000 kg. \n\nPlease help the company to minimize the total cost of purchasing trucks and fuel expenses per year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nCost_SmallTrucks = 30000 * SmallTrucks\nCost_MediumTrucks = 50000 * MediumTrucks\nCost_LargeTrucks = 80000 * LargeTrucks\nFuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\nFuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\nFuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\nmodel.addCons(obj == Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000)\n# The company has a total of 100 drivers available.\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100)\n# The total cargo capacity of all trucks must not exceed 500,000 kg.\nmodel.addCons(SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Number of Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Number of Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce next month. Additionally, the company must determine the number of hours to allocate for production and maintenance for each machine type.\n// {\"number of units of MachineA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production hours for MachineA\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production hours for MachineB\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production hours for MachineC\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The production cost per hour for MachineA is $50, MachineB is $60, and MachineC is $70. The maintenance cost per hour for MachineA is $30, MachineB is $40, and MachineC is $50. The company aims to maximize the total profit minus the total production and maintenance costs.\n// Profit from MachineA: Profit_A = 500 * A - (50 * PA + 30 * MA)\n// Profit from MachineB: Profit_B = 700 * B - (60 * PB + 40 * MB)\n// Profit from MachineC: Profit_C = 900 * C - (70 * PC + 50 * MC)\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 500 production hours available for the month.\n// PA + PB + PC <= 500\n\n## Generate Constraint-2:\nThe company has a total of 200 maintenance hours available for the month.\n// MA + MB + MC <= 200\n\n## Generate Constraint-3:\nEach machine requires a minimum of 10 production hours per unit produced.\n// PA >= 10 * A; PB >= 10 * B; PC >= 10 * C\n\n## Generate Constraint-4:\nEach machine requires a minimum of 5 maintenance hours per unit produced.\n// MA >= 5 * A; MB >= 5 * B; MC >= 5 * C\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of MachineC does not exceed the combined production of MachineA and MachineB.\n// C <= A + B",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce next month and determine the number of hours to allocate for production and maintenance for each machine type. The profit per unit, production cost per hour, and maintenance cost per hour for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost per Hour | Maintenance Cost per Hour |\n|---------|-----------------|--------------------------|---------------------------|\n| MachineA | $500           | $50                      | $30                       |\n| MachineB | $700           | $60                      | $40                       |\n| MachineC | $900           | $70                      | $50                       |\n\nThe company has a total of 500 production hours and 200 maintenance hours available for the month. Each machine requires a minimum of 10 production hours and 5 maintenance hours per unit produced. The company wants to ensure that the production of MachineC does not exceed the combined production of MachineA and MachineB. \n\nPlease help the company to maximize the total profit minus the total production and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of MachineA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of MachineB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of MachineC\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # production hours for MachineA\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # production hours for MachineB\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # production hours for MachineC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # maintenance hours for MachineA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # maintenance hours for MachineB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # maintenance hours for MachineC\n\n# Define objective function\nProfit_A = 500 * A - (50 * PA + 30 * MA)\nProfit_B = 700 * B - (60 * PB + 40 * MB)\nProfit_C = 900 * C - (70 * PC + 50 * MC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(PA + PB + PC <= 500) # Total production hours constraint\nmodel.addCons(MA + MB + MC <= 200) # Total maintenance hours constraint\nmodel.addCons(PA >= 10 * A) # Minimum production hours per unit for MachineA\nmodel.addCons(PB >= 10 * B) # Minimum production hours per unit for MachineB\nmodel.addCons(PC >= 10 * C) # Minimum production hours per unit for MachineC\nmodel.addCons(MA >= 5 * A) # Minimum maintenance hours per unit for MachineA\nmodel.addCons(MB >= 5 * B) # Minimum maintenance hours per unit for MachineB\nmodel.addCons(MC >= 5 * C) # Minimum maintenance hours per unit for MachineC\nmodel.addCons(C <= A + B) # Production of MachineC does not exceed combined production of MachineA and MachineB\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(A))\n    print(\"Number of MachineB: \", model.getVal(B))\n    print(\"Number of MachineC: \", model.getVal(C))\n    print(\"Production hours for MachineA: \", model.getVal(PA))\n    print(\"Production hours for MachineB: \", model.getVal(PB))\n    print(\"Production hours for MachineC: \", model.getVal(PC))\n    print(\"Maintenance hours for MachineA: \", model.getVal(MA))\n    print(\"Maintenance hours for MachineB: \", model.getVal(MB))\n    print(\"Maintenance hours for MachineC: \", model.getVal(MC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of cars\": \"Cars\", \"range\": \"Cars >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\n// Profit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\n// FuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n// So, the objective function is: Maximize (Profit - FuelCost)\n// Maximize (0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars) - (50 * Trucks + 30 * Vans + 10 * Cars) * 5)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet or exceed the required 100,000 kg.\n// 5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// (50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000\n\n## Generate Constraint-3:\nThe company can only acquire a maximum of 20 vehicles in total.\n// Trucks + Vans + Cars <= 20\n\n## Generate Constraint-4:\nThe number of trucks cannot exceed 10.\n// Trucks <= 10\n\n## Generate Constraint-5:\nThe number of vans must be at least 5.\n// Vans >= 5",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand. Each truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The company has a budget of $10,000 for fuel costs. The company can only acquire a maximum of 20 vehicles in total. The number of trucks cannot exceed 10, and the number of vans must be at least 5. Please help the company to maximize the total profit while minimizing the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=5)  # number of vans\nCars = model.addVar(vtype=\"INTEGER\", name=\"Cars\", lb=0)  # number of cars\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\nFuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n## the objective function is: Maximize (Profit - FuelCost)\nmodel.addCons(obj == Profit - FuelCost)\n\n# Add constraints\n## The total cargo capacity must meet or exceed the required 100,000 kg.\nmodel.addCons(5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000)\n## The company has a budget of $10,000 for fuel costs.\nmodel.addCons((50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000)\n## The company can only acquire a maximum of 20 vehicles in total.\nmodel.addCons(Trucks + Vans + Cars <= 20)\n## The number of trucks cannot exceed 10.\nmodel.addCons(Trucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Cars: \", model.getVal(Cars))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of constructing a solar facility is $500,000, a wind facility is $600,000, a hydro facility is $700,000, a biomass facility is $400,000, and a geothermal facility is $800,000. The energy output per facility is 1.5 MW for solar, 2 MW for wind, 1.8 MW for hydro, 1.2 MW for biomass, and 2.5 MW for geothermal. The city wants to minimize the cost per MW of energy produced.\n// Total cost: Cost = 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal\n// Total energy output: Energy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of these facilities.\n// 500,000 * Solar + 600,000 * Wind + 700,000 * Hydro + 400,000 * Biomass + 800,000 * Geothermal <= 10,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 50 MW of renewable energy.\n// 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50\n\n## Generate Constraint-3:\nDue to geographical limitations, the city can only build a maximum of 10 hydro facilities.\n// Hydro <= 10",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to decide how many units of each type of facility to construct to meet its energy needs efficiently. The cost of constructing each type of facility and their respective energy output are given in the following Table.\n\n| Facility Type | Construction Cost | Energy Output per Facility |\n|---------------|-------------------|-----------------------------|\n| Solar         | $500,000          | 1.5 MW                      |\n| Wind          | $600,000          | 2 MW                        |\n| Hydro         | $700,000          | 1.8 MW                      |\n| Biomass       | $400,000          | 1.2 MW                      |\n| Geothermal    | $800,000          | 2.5 MW                      |\n\nThe city has a budget of $10 million for the construction of these facilities. The city aims to produce at least 50 MW of renewable energy. Due to geographical limitations, the city can only build a maximum of 10 hydro facilities. \n\nPlease help the city to minimize the cost per MW of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0, ub=10)  # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0)  # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0)  # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal\nEnergy = 1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of these facilities.\nmodel.addCons(500000 * Solar + 600000 * Wind + 700000 * Hydro + 400000 * Biomass + 800000 * Geothermal <= 10000000)\n## The city aims to produce at least 50 MW of renewable energy.\nmodel.addCons(1.5 * Solar + 2 * Wind + 1.8 * Hydro + 1.2 * Biomass + 2.5 * Geothermal >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per MW: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"ES\", \"range\": \"ES >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n// Energy_output_SP = 0.15 * (1 + 0.005 * (R&D / 100000)) * SP\n// Energy_output_WT = 0.25 * (1 + 0.007 * (R&D / 100000)) * WT\n// Cost_ES = 1000 - 50 * (R&D / 100000) * ES\n// So, the objective function is: Maximize (Energy_output_SP + Energy_output_WT) - Cost_ES\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage.\n// SP * 10000 + WT * 15000 + ES * 500 <= 5000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $1,000,000.\n// R&D <= 1000000\n\n## Generate Constraint-3:\nThe total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n// 2 * SP + 5 * WT <= 5000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 solar panels and 50 wind turbines are installed.\n// SP >= 100; WT >= 50",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage. The company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage. The total investment in R&D cannot exceed $1,000,000. The total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters. The company must ensure that at least 100 solar panels and 50 wind turbines are installed. Please help the company to maximize the total energy output (in MWh) while minimizing the cost of energy storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=100)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=50)   # number of wind turbines\nES = model.addVar(vtype=\"INTEGER\", name=\"ES\", lb=0)    # amount of energy storage\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0)  # investment in R&D\n\n# Define objective function\n# Efficiency and cost calculations\nEfficiency_SP = 0.15 * (1 + 0.005 * (R_D / 100000))\nEfficiency_WT = 0.25 * (1 + 0.007 * (R_D / 100000))\nCost_ES = 1000 - 50 * (R_D / 100000)\n\n# Energy output and cost of storage\nEnergy_output_SP = Efficiency_SP * SP\nEnergy_output_WT = Efficiency_WT * WT\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output_SP + Energy_output_WT - Cost_ES * ES)\n\n# Add constraints\n# Budget constraint\nmodel.addCons(SP * 10000 + WT * 15000 + ES * 500 <= 5000000)\n# R&D investment constraint\nmodel.addCons(R_D <= 1000000)\n# Area constraint\nmodel.addCons(2 * SP + 5 * WT <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Amount of Energy Storage: \", model.getVal(ES))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Maximized Total Energy Output - Cost of Storage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1390,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit margin per product. \nMachine 1 produces 10 units of product 1, 15 units of product 2, and 20 units of product 3 per worker per hour, with a profit of $5 per unit of product 1, $10 per unit of product 2, and $15 per unit of product 3.\nMachine 2 produces 12 units of product 1, 18 units of product 2, and 22 units of product 3 per worker per hour, with a profit of $6 per unit of product 1, $12 per unit of product 2, and $18 per unit of product 3.\nMachine 3 produces 14 units of product 1, 20 units of product 2, and 24 units of product 3 per worker per hour, with a profit of $7 per unit of product 1, $14 per unit of product 2, and $21 per unit of product 3.\nMachine 4 produces 16 units of product 1, 22 units of product 2, and 26 units of product 3 per worker per hour, with a profit of $8 per unit of product 1, $16 per unit of product 2, and $24 per unit of product 3.\nThe objective is to maximize the total daily profit.\n// The profit function is: P = 5*(10*M1 + 12*M2 + 14*M3 + 16*M4) + 10*(15*M1 + 18*M2 + 20*M3 + 22*M4) + 15*(20*M1 + 22*M2 + 24*M3 + 26*M4)\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 <= 60\n\n## Generate Constraint-2:\nEach machine can be utilized by up to 20 workers at a time.\n// M1 <= 20; M2 <= 20; M3 <= 20; M4 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product 1, 800 units of product 2, and 1000 units of product 3 daily.\n// 10*M1 + 12*M2 + 14*M3 + 16*M4 >= 500\n// 15*M1 + 18*M2 + 20*M3 + 22*M4 >= 800\n// 20*M1 + 22*M2 + 24*M3 + 26*M4 >= 1000",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. The production rates and profit margins for each product on each machine are given in the following Table.\n\n| Machine | Product 1 Units/Worker/Hour | Product 2 Units/Worker/Hour | Product 3 Units/Worker/Hour | Profit/Unit Product 1 | Profit/Unit Product 2 | Profit/Unit Product 3 |\n|---------|-----------------------------|-----------------------------|-----------------------------|-----------------------|------------------------|-------------------------|\n| 1       | 10                          | 15                          | 20                          | $5                    | $10                    | $15                    |\n| 2       | 12                          | 18                          | 22                          | $6                    | $12                    | $18                    |\n| 3       | 14                          | 20                          | 24                          | $7                    | $14                    | $21                    |\n| 4       | 16                          | 22                          | 26                          | $8                    | $16                    | $24                    |\n\nThe company has a total of 60 workers available. Each machine can be utilized by up to 20 workers at a time. The company must produce at least 500 units of product 1, 800 units of product 2, and 1000 units of product 3 daily.\n\nPlease help the company to maximize the total daily profit by determining the optimal number of workers to allocate to each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\n\n# Define objective function\n## The profit function is: P = 5*(10*M1 + 12*M2 + 14*M3 + 16*M4) + 10*(15*M1 + 18*M2 + 20*M3 + 22*M4) + 15*(20*M1 + 22*M2 + 24*M3 + 26*M4)\nP = 5*(10*M1 + 12*M2 + 14*M3 + 16*M4) + 10*(15*M1 + 18*M2 + 20*M3 + 22*M4) + 15*(20*M1 + 22*M2 + 24*M3 + 26*M4)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 <= 60)\n## Each machine can be utilized by up to 20 workers at a time.\nmodel.addCons(M1 <= 20)\nmodel.addCons(M2 <= 20)\nmodel.addCons(M3 <= 20)\nmodel.addCons(M4 <= 20)\n## The company must produce at least 500 units of product 1, 800 units of product 2, and 1000 units of product 3 daily.\nmodel.addCons(10*M1 + 12*M2 + 14*M3 + 16*M4 >= 500)\nmodel.addCons(15*M1 + 18*M2 + 20*M3 + 22*M4 >= 800)\nmodel.addCons(20*M1 + 22*M2 + 24*M3 + 26*M4 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1703,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost.\n// Total cargo capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total operational cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n// So, the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations. Each type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost. The company has a budget of $100,000 for operational costs for the month. The company also has a limit on the number of trucks it can deploy, with a maximum of 50 trucks in total. Please help the company determine the optimal number of each type of truck to deploy to achieve this objective.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCargoCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nTotalOperationalCost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n## the objective function is: Maximize (TotalCargoCapacity) / (TotalOperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * TotalOperationalCost == TotalCargoCapacity)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000)\n## The company has a limit on the number of trucks it can deploy. It can deploy at most 50 trucks in total.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Operational Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity, daily operational cost, and fuel efficiency. The company needs to deliver a total of 1500 units over a distance of 500 km. The details of each type of truck are given in the following Table.\n\n| Truck Type | Capacity (units) | Daily Operational Cost ($) | Fuel Efficiency (km/L) |\n|------------|------------------|----------------------------|-----------------------|\n| Small      | 100              | 200                        | 5                     |\n| Medium     | 200              | 300                        | 8                     |\n| Large      | 300              | 400                        | 10                    |\n\nThe company aims to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs. The total capacity of all trucks must meet the delivery requirement of 1500 units. Please help the company determine the optimal number of small, medium, and large trucks to use for this delivery.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital invested in automation\": \"AutomationCapital\", \"range\": \"AutomationCapital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for the production of all products.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested. The production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 100 workers available for the production of all products.\n\nPlease help the company determine the optimal production quantities, worker allocations, and capital investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationCapital\", lb=0)  # capital invested in automation\n\n# Define objective function\n# The production cost per unit decreases non-linearly with the investment in automation\nProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\nProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\nProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total of 100 workers available for the production of all products.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Invested in Automation: \", model.getVal(AutomationCapital))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of chemicals: C1, C2, and C3, and a new type of chemical C4. They need to determine the quantities of each chemical to produce.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the revenue per unit is $100, the production cost per unit is $40, and the storage cost per unit is $10.\nFor C2, the revenue per unit is $120, the production cost per unit is $50, and the storage cost per unit is $15.\nFor C3, the revenue per unit is $140, the production cost per unit is $60, and the storage cost per unit is $20.\nFor C4, the revenue per unit is $160, the production cost per unit is $70, and the storage cost per unit is $25.\nThe manufacturer wants to maximize the net profit (revenue minus production and storage costs).\n// Profit_C1 = 100 * C1 - 40 * C1 - 10 * C1^2\n// Profit_C2 = 120 * C2 - 50 * C2 - 15 * C2^2\n// Profit_C3 = 140 * C3 - 60 * C3 - 20 * C3^2\n// Profit_C4 = 160 * C4 - 70 * C4 - 25 * C4^2\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production capacity of 200 units in total.\n// C1 + C2 + C3 + C4 <= 200",
        "question": "A manufacturer produces three types of chemicals: C1, C2, and C3, and a new type of chemical C4. They need to determine the quantities of each chemical to produce.\nFor C1, the revenue per unit is $100, the production cost per unit is $40, and the storage cost per unit is $10.\nFor C2, the revenue per unit is $120, the production cost per unit is $50, and the storage cost per unit is $15.\nFor C3, the revenue per unit is $140, the production cost per unit is $60, and the storage cost per unit is $20.\nFor C4, the revenue per unit is $160, the production cost per unit is $70, and the storage cost per unit is $25.\nThe manufacturer wants to maximize the net profit (revenue minus production and storage costs).\nThe manufacturer has a limited production capacity of 200 units in total.\nPlease help the manufacturer determine the optimal quantities of each chemical to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # quantity of C4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4)\n## convert the quadratic terms to linear terms by introducing new variables\nC1_sq = model.addVar(vtype=\"INTEGER\", name=\"C1_sq\")\nC2_sq = model.addVar(vtype=\"INTEGER\", name=\"C2_sq\")\nC3_sq = model.addVar(vtype=\"INTEGER\", name=\"C3_sq\")\nC4_sq = model.addVar(vtype=\"INTEGER\", name=\"C4_sq\")\n\nmodel.addCons(C1_sq == C1**2)\nmodel.addCons(C2_sq == C2**2)\nmodel.addCons(C3_sq == C3**2)\nmodel.addCons(C4_sq == C4**2)\n\nProfit_C1 = 100 * C1 - 40 * C1 - 10 * C1_sq\nProfit_C2 = 120 * C2 - 50 * C2 - 15 * C2_sq\nProfit_C3 = 140 * C3 - 60 * C3 - 20 * C3_sq\nProfit_C4 = 160 * C4 - 70 * C4 - 25 * C4_sq\n\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4)\n\n# Add constraints\n## The manufacturer has a limited production capacity of 200 units in total.\nmodel.addCons(C1 + C2 + C3 + C4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Quantity of C4: \", model.getVal(C4))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The company needs to decide how many of each type of truck to purchase to maximize their operational efficiency while considering their budget and space constraints.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each.\nThe medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each.\nThe large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each.\nThe company wants to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost.\n// TotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\n// TotalFuelConsumption = (10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks) / TotalCarryingCapacity\n// TotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n// So, the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. They are considering three types of vehicles: small, medium, and large trucks. Each type of truck has different fuel efficiency, carrying capacity, and purchase cost. The small trucks have a fuel efficiency of 10 km/l, a carrying capacity of 5 tons, and a purchase cost of $50,000 each. The medium trucks have a fuel efficiency of 15 km/l, a carrying capacity of 10 tons, and a purchase cost of $75,000 each. The large trucks have a fuel efficiency of 20 km/l, a carrying capacity of 15 tons, and a purchase cost of $100,000 each. The company has a budget of $1,000,000 for purchasing new trucks.\n\nPlease help the company to maximize the total carrying capacity while minimizing the total fuel consumption and purchase cost, considering the objective function is to maximize the total carrying capacity divided by the sum of total fuel consumption and total purchase cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0) # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0) # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0) # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalCarryingCapacity = 5 * SmallTrucks + 10 * MediumTrucks + 15 * LargeTrucks\nTotalFuelConsumption = 10 * SmallTrucks + 15 * MediumTrucks + 20 * LargeTrucks\nTotalPurchaseCost = 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks\n## the objective function is: Maximize (TotalCarryingCapacity / (TotalFuelConsumption + TotalPurchaseCost))\n## convert the division to multiplication\nmodel.addCons(obj * (TotalFuelConsumption + TotalPurchaseCost) == TotalCarryingCapacity)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 machines available for the month.\n// MachinesA + MachinesB + MachinesC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $100,000.\n// Automation <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product must not exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 machines are allocated to ProductA and 30 machines to ProductB.\n// MachinesA >= 20; MachinesB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 100 machines available for the month. The total investment in automation cannot exceed $100,000. Due to market demand, the production quantity of each product must not exceed 500 units. The company must ensure that at least 20 machines are allocated to ProductA and 30 machines to ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=20)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=30)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100000)  # investment in automation\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\nProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\nProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 100)  # total machines constraint\nmodel.addCons(Automation <= 100000)  # investment in automation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 * MachineA_units) - 10,000\n// Total profit for MachineB: Profit_MachineB = (700 * MachineB_units) - 15,000\n// Total profit for MachineC: Profit_MachineC = (900 * MachineC_units) - 20,000\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for setup costs.\n// 10,000 * MachineA_units + 15,000 * MachineB_units + 20,000 * MachineC_units <= 100,000\n\n## Generate Constraint-2:\nThe production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\n// MachineA_units <= 100\n// MachineB_units <= 80\n// MachineC_units <= 60\n\n## Generate Constraint-3:\nDue to market demand, the number of MachineB units produced must be at least twice the number of MachineA units.\n// MachineB_units >= 2 * MachineA_units",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type. The profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company has a total budget of $100,000 for setup costs. The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units. Due to market demand, the number of MachineB units produced must be at least twice the number of MachineA units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0)  # number of units of MachineA\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0)  # number of units of MachineB\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0)  # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 * MachineA_units) - 10000\nProfit_MachineB = (700 * MachineB_units) - 15000\nProfit_MachineC = (900 * MachineC_units) - 20000\n# So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total budget of $100,000 for setup costs.\nmodel.addCons(10000 * MachineA_units + 15000 * MachineB_units + 20000 * MachineC_units <= 100000)\n# The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\nmodel.addCons(MachineA_units <= 100)\nmodel.addCons(MachineB_units <= 80)\nmodel.addCons(MachineC_units <= 60)\n# Due to market demand, the number of MachineB units produced must be at least twice the number of MachineA units.\nmodel.addCons(MachineB_units >= 2 * MachineA_units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for CargoA is $1000 per day, for CargoB is $1200 per day, for CargoC is $1500 per day, for CargoD is $1800 per day, and for CargoE is $2000 per day. The revenue generated by each truck for CargoA is $2000 per day, for CargoB is $2500 per day, for CargoC is $3000 per day, for CargoD is $3500 per day, and for CargoE is $4000 per day. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\n// Total net revenue for CargoA: Revenue_A = (2000 - 1000) * TrucksA\n// Total net revenue for CargoB: Revenue_B = (2500 - 1200) * TrucksB\n// Total net revenue for CargoC: Revenue_C = (3000 - 1500) * TrucksC\n// Total net revenue for CargoD: Revenue_D = (3500 - 1800) * TrucksD\n// Total net revenue for CargoE: Revenue_E = (4000 - 2000) * TrucksE\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, CargoA must be transported by at least 10 trucks.\n// TrucksA >= 10\n\n## Generate Constraint-3:\nThe company has a fuel budget of $50,000 per day. The fuel cost per truck for CargoA is $100, for CargoB is $150, for CargoC is $200, for CargoD is $250, and for CargoE is $300.\n// 100 * TrucksA + 150 * TrucksB + 200 * TrucksC + 250 * TrucksD + 300 * TrucksE <= 50000\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA.\n// TrucksB >= 0.5 * TrucksA\n\n## Generate Constraint-5:\nThe company has a maintenance capacity constraint, limiting the number of trucks for CargoC to a maximum of 15.\n// TrucksC <= 15",
        "question": "A logistics company is managing the distribution of five different types of cargo: CargoA, CargoB, CargoC, CargoD, and CargoE. They need to determine the number of trucks allocated to each type of cargo to optimize their operations. The cost of operating a truck for CargoA is $1000 per day, for CargoB is $1200 per day, for CargoC is $1500 per day, for CargoD is $1800 per day, and for CargoE is $2000 per day. The revenue generated by each truck for CargoA is $2000 per day, for CargoB is $2500 per day, for CargoC is $3000 per day, for CargoD is $3500 per day, and for CargoE is $4000 per day. The company wants to maximize the total net revenue, which is the difference between the total revenue and the total cost.\n\nThe company has a total of 50 trucks available for distribution. Due to contractual agreements, CargoA must be transported by at least 10 trucks. The company has a fuel budget of $50,000 per day. The fuel cost per truck for CargoA is $100, for CargoB is $150, for CargoC is $200, for CargoD is $250, and for CargoE is $300. The company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA. Additionally, the company has a maintenance capacity constraint, limiting the number of trucks for CargoC to a maximum of 15.\n\nPlease help the company to maximize the total net revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for CargoA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CargoB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0, ub=15) # number of trucks for CargoC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CargoD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for CargoE\n\n# Define objective function\nRevenue_A = (2000 - 1000) * TrucksA\nRevenue_B = (2500 - 1200) * TrucksB\nRevenue_C = (3000 - 1500) * TrucksC\nRevenue_D = (3500 - 1800) * TrucksD\nRevenue_E = (4000 - 2000) * TrucksE\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E)\n\n# Add constraints\n# The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# The company has a fuel budget of $50,000 per day.\nmodel.addCons(100 * TrucksA + 150 * TrucksB + 200 * TrucksC + 250 * TrucksD + 300 * TrucksE <= 50000)\n# The company wants to ensure a balanced distribution, such that the number of trucks for CargoB is at least half the number of trucks for CargoA.\nmodel.addCons(TrucksB >= 0.5 * TrucksA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CargoB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CargoC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CargoD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for CargoE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions. The total fuel budget across all regions must not exceed $100,000. Please help the company determine the optimal number of trucks and fuel budgets for each region to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0)\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0)\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0)\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0)\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost1 = (FuelBudget1 / Trucks1)**2\nFuelCost2 = (FuelBudget2 / Trucks2)**2\nFuelCost3 = (FuelBudget3 / Trucks3)**2\nFuelCost4 = (FuelBudget4 / Trucks4)**2\nFuelCost5 = (FuelBudget5 / Trucks5)**2\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 753,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production costs and automation investments.\n// (100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// Automation <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n// ProdA <= 500; ProdB <= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for production costs and automation investments. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\nProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\nProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for production costs and automation investments.\nmodel.addCons((100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000)\n# The total investment in automation technology cannot exceed $20,000.\nmodel.addCons(Automation <= 20000)\n# Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\nmodel.addCons(ProdA <= 500)\nmodel.addCons(ProdB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the efficiency and capacity of each machine.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for products A, B, C, D, and E are $50, $70, $60, $80, and $90 respectively. The production time per unit for each product on each machine varies. Machine 1 takes 2 hours for A, 3 hours for B, 2.5 hours for C, 4 hours for D, and 3.5 hours for E. Machine 2 takes 1.5 hours for A, 2 hours for B, 1.8 hours for C, 3 hours for D, and 2.5 hours for E. Machine 3 takes 2.2 hours for A, 2.8 hours for B, 2.3 hours for C, 3.5 hours for D, and 3 hours for E. The company aims to maximize the total profit while considering the time efficiency of each machine.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// Total production time on Machine 1: Time1 = 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E\n// Total production time on Machine 2: Time2 = 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E\n// Total production time on Machine 3: Time3 = 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E\n// The objective function is: Maximize Profit / (Time1 + Time2 + Time3)\n\n## Generate Constraint-1:\nThe total production time on each machine cannot exceed 120 hours per week.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 120\n// 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E <= 120\n// 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E <= 120",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The profit per unit for products A, B, C, D, and E are $50, $70, $60, $80, and $90 respectively. The production time per unit for each product on each machine varies. Machine 1 takes 2 hours for A, 3 hours for B, 2.5 hours for C, 4 hours for D, and 3.5 hours for E. Machine 2 takes 1.5 hours for A, 2 hours for B, 1.8 hours for C, 3 hours for D, and 2.5 hours for E. Machine 3 takes 2.2 hours for A, 2.8 hours for B, 2.3 hours for C, 3.5 hours for D, and 3 hours for E. The company aims to maximize the total profit while considering the time efficiency of each machine. The total production time on each machine cannot exceed 120 hours per week.\n\nPlease help the company to maximize the total profit while considering the time efficiency of each machine, which is defined as the total profit divided by the sum of the total production times on all three machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nTime1 = 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E\nTime2 = 1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E\nTime3 = 2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E\n## the objective function is: Maximize Profit / (Time1 + Time2 + Time3)\n## convert the division to multiplication\nmodel.addCons(obj * (Time1 + Time2 + Time3) == Profit)\n\n# Add constraints\n## The total production time on each machine cannot exceed 120 hours per week.\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 120)\nmodel.addCons(1.5 * A + 2 * B + 1.8 * C + 3 * D + 2.5 * E <= 120)\nmodel.addCons(2.2 * A + 2.8 * B + 2.3 * C + 3.5 * D + 3 * E <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter, Truck B has a fuel efficiency of 8 km/liter, and Truck C has a fuel efficiency of 10 km/liter. The company wants to maximize the total distance covered per liter of fuel.\n// FuelEfficiency_A = 5 * TruckA\n// FuelEfficiency_B = 8 * TruckB\n// FuelEfficiency_C = 10 * TruckC\n// So, the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / (TruckA + TruckB + TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands. Truck A has a fuel efficiency of 5 km/liter, Truck B has a fuel efficiency of 8 km/liter, and Truck C has a fuel efficiency of 10 km/liter. The company wants to maximize the total distance covered per liter of fuel. The company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000. Please help the company to determine the optimal number of each type of truck to maximize their overall fuel efficiency while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuelEfficiency_A = 5 * TruckA\nFuelEfficiency_B = 8 * TruckB\nFuelEfficiency_C = 10 * TruckC\nTotalTrucks = TruckA + TruckB + TruckC\n## the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Fuel Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"quantity of goods to City1\": \"City1\", \"range\": \"City1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City2\": \"City2\", \"range\": \"City2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City3\": \"City3\", \"range\": \"City3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City4\": \"City4\", \"range\": \"City4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City5\": \"City5\", \"range\": \"City5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered. The fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time.\n// Fuel_Cost_City1 = (Fuel1^2) * City1\n// Fuel_Cost_City2 = (Fuel2^2) * City2\n// Fuel_Cost_City3 = (Fuel3^2) * City3\n// Fuel_Cost_City4 = (Fuel4^2) * City4\n// Fuel_Cost_City5 = (Fuel5^2) * City5\n// So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n## Generate Constraint-1:\nThe total fuel budget across all cities must not exceed $10,000.\n// Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000\n\n## Generate Constraint-2:\nThe company must deliver at least 500 units of goods to each city.\n// City1 >= 500; City2 >= 500; City3 >= 500; City4 >= 500; City5 >= 500\n\n## Generate Constraint-3:\nThe total quantity of goods delivered across all cities must not exceed 3000 units.\n// City1 + City2 + City3 + City4 + City5 <= 3000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered, where the fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods.\n\nThe company aims to minimize the total fuel cost while ensuring all deliveries are made on time. The total fuel budget across all cities must not exceed $10,000. The company must deliver at least 500 units of goods to each city. The total quantity of goods delivered across all cities must not exceed 3000 units.\n\nPlease help the company to determine the optimal quantity of goods and fuel budget for each city to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deliver at least 500 units of goods to each city.\nCity1 = model.addVar(vtype=\"INTEGER\", name=\"City1\", lb=500) # quantity of goods to City1\nCity2 = model.addVar(vtype=\"INTEGER\", name=\"City2\", lb=500) # quantity of goods to City2\nCity3 = model.addVar(vtype=\"INTEGER\", name=\"City3\", lb=500) # quantity of goods to City3\nCity4 = model.addVar(vtype=\"INTEGER\", name=\"City4\", lb=500) # quantity of goods to City4\nCity5 = model.addVar(vtype=\"INTEGER\", name=\"City5\", lb=500) # quantity of goods to City5\n## Fuel budget for each city\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel budget for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel budget for City2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0) # fuel budget for City3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0) # fuel budget for City4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0) # fuel budget for City5\n\n# Define objective function\n## The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered.\nFuel_Cost_City1 = (Fuel1**2) * City1\nFuel_Cost_City2 = (Fuel2**2) * City2\nFuel_Cost_City3 = (Fuel3**2) * City3\nFuel_Cost_City4 = (Fuel4**2) * City4\nFuel_Cost_City5 = (Fuel5**2) * City5\n## So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n# Add constraints\n## The total fuel budget across all cities must not exceed $10,000.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000)\n## The total quantity of goods delivered across all cities must not exceed 3000 units.\nmodel.addCons(City1 + City2 + City3 + City4 + City5 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of goods to City1: \", model.getVal(City1))\n    print(\"Quantity of goods to City2: \", model.getVal(City2))\n    print(\"Quantity of goods to City3: \", model.getVal(City3))\n    print(\"Quantity of goods to City4: \", model.getVal(City4))\n    print(\"Quantity of goods to City5: \", model.getVal(City5))\n    print(\"Fuel budget for City1: \", model.getVal(Fuel1))\n    print(\"Fuel budget for City2: \", model.getVal(Fuel2))\n    print(\"Fuel budget for City3: \", model.getVal(Fuel3))\n    print(\"Fuel budget for City4: \", model.getVal(Fuel4))\n    print(\"Fuel budget for City5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs, capacities, and maintenance costs. The company wants to minimize the total operational and maintenance costs while maximizing the total capacity. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost | Capacity | Maintenance Cost |\n|--------------|------------------|----------|------------------|\n| Trucks       | $50,000          | 1000 units | $10,000          |\n| Vans         | $30,000          | 500 units  | $5,000           |\n| Bikes        | $5,000           | 100 units  | $1,000           |\n| Scooters     | $3,000           | 50 units   | $500             |\n| Drones       | $10,000          | 200 units  | $2,000           |\n\nThe company has a budget of $2,000,000 for purchasing vehicles. Please help the company to determine the optimal number of each type of vehicle to minimize the total operational and maintenance costs while maximizing the total capacity, expressed as the ratio of total costs to total capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=0)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the speed at which each truck should travel to optimize delivery times and fuel consumption. The speed of each truck affects the fuel efficiency and the time taken to deliver the goods.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for GoodsX\": \"SpeedX\", \"range\": \"0 < SpeedX <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for GoodsY\": \"SpeedY\", \"range\": \"0 < SpeedY <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for GoodsZ\": \"SpeedZ\", \"range\": \"0 < SpeedZ <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: Fuel = a * Speed^3, where a is a constant. The company aims to minimize the total fuel consumption across all trucks while ensuring timely deliveries.\n// Fuel consumption for GoodsX: FuelX = a * SpeedX^3 * TrucksX\n// Fuel consumption for GoodsY: FuelY = a * SpeedY^3 * TrucksY\n// Fuel consumption for GoodsZ: FuelZ = a * SpeedZ^3 * TrucksZ\n// So, the objective function is: Minimize (FuelX + FuelY + FuelZ)\n\n## Generate Constraint-1:\nThe total number of trucks available for distribution is limited to 50.\n// TrucksX + TrucksY + TrucksZ <= 50\n\n## Generate Constraint-2:\nThe total delivery time for all goods must not exceed 10 hours. The delivery time for each type of good is inversely proportional to the speed of the trucks.\n// (TrucksX / SpeedX) + (TrucksY / SpeedY) + (TrucksZ / SpeedZ) <= 10",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the speed at which each truck should travel to optimize delivery times and fuel consumption. The speed of each truck affects the fuel efficiency and the time taken to deliver the goods. The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: Fuel = a * Speed^3, where a is a constant. The company aims to minimize the total fuel consumption across all trucks while ensuring timely deliveries. The total number of trucks available for distribution is limited to 50. The total delivery time for all goods must not exceed 10 hours. The delivery time for each type of good is inversely proportional to the speed of the trucks. Please help the company to determine the optimal number of trucks and their speeds to minimize fuel consumption while meeting the delivery time constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nSpeedX = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedX\", lb=0.01, ub=60)  # speed of trucks for GoodsX\nSpeedY = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedY\", lb=0.01, ub=60)  # speed of trucks for GoodsY\nSpeedZ = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedZ\", lb=0.01, ub=60)  # speed of trucks for GoodsZ\n\n# Define objective function\na = 0.002  # constant for fuel consumption formula\nFuelX = a * SpeedX**3 * TrucksX\nFuelY = a * SpeedY**3 * TrucksY\nFuelZ = a * SpeedZ**3 * TrucksZ\n# So, the objective function is: Minimize (FuelX + FuelY + FuelZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelX + FuelY + FuelZ)\n\n# Add constraints\n# The total number of trucks available for distribution is limited to 50.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 50)\n# The total delivery time for all goods must not exceed 10 hours.\nmodel.addCons((TrucksX / SpeedX) + (TrucksY / SpeedY) + (TrucksZ / SpeedZ) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Speed of Trucks for GoodsX: \", model.getVal(SpeedX))\n    print(\"Speed of Trucks for GoodsY: \", model.getVal(SpeedY))\n    print(\"Speed of Trucks for GoodsZ: \", model.getVal(SpeedZ))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 6 different delivery zones. The company must decide how many trucks to allocate to each zone and the average speed at which these trucks should travel to minimize fuel consumption and delivery time.\n// {\"number of trucks for zone 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for zone 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks in zone 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"real\"}\n// {\"average speed of trucks in zone 6\": \"S6\", \"range\": \"S6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function of speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption across all zones while ensuring timely deliveries.\n// Total fuel consumption in zone 1: FC1 = T1 * (S1^2 + 0.1 * S1^3)\n// Total fuel consumption in zone 2: FC2 = T2 * (S2^2 + 0.1 * S2^3)\n// Total fuel consumption in zone 3: FC3 = T3 * (S3^2 + 0.1 * S3^3)\n// Total fuel consumption in zone 4: FC4 = T4 * (S4^2 + 0.1 * S4^3)\n// Total fuel consumption in zone 5: FC5 = T5 * (S5^2 + 0.1 * S5^3)\n// Total fuel consumption in zone 6: FC6 = T6 * (S6^2 + 0.1 * S6^3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5 + FC6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nEach zone must have at least 2 trucks.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2; T6 >= 2\n\n## Generate Constraint-3:\nThe maximum speed for any truck in any zone is 60 km/h.\n// S1 <= 60; S2 <= 60; S3 <= 60; S4 <= 60; S5 <= 60; S6 <= 60\n\n## Generate Constraint-4:\nThe minimum speed for any truck in any zone is 30 km/h to ensure timely deliveries.\n// S1 >= 30; S2 >= 30; S3 >= 30; S4 >= 30; S5 >= 30; S6 >= 30",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for 6 different delivery zones. The company must decide how many trucks to allocate to each zone and the average speed at which these trucks should travel to minimize fuel consumption and delivery time. The fuel consumption of each truck is modeled by a nonlinear function of speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption across all zones while ensuring timely deliveries.\n\nThe company has a total of 50 trucks available. Each zone must have at least 2 trucks. The maximum speed for any truck in any zone is 60 km/h, and the minimum speed for any truck in any zone is 30 km/h to ensure timely deliveries.\n\nPlease help the company to determine the optimal number of trucks and their average speeds for each zone to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks for zone 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks for zone 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks for zone 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks for zone 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks for zone 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=2) # number of trucks for zone 6\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=30, ub=60) # average speed of trucks in zone 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=30, ub=60) # average speed of trucks in zone 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=30, ub=60) # average speed of trucks in zone 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=30, ub=60) # average speed of trucks in zone 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=30, ub=60) # average speed of trucks in zone 5\nS6 = model.addVar(vtype=\"CONTINUOUS\", name=\"S6\", lb=30, ub=60) # average speed of trucks in zone 6\n\n# Define objective function\nFC1 = T1 * (S1**2 + 0.1 * S1**3)\nFC2 = T2 * (S2**2 + 0.1 * S2**3)\nFC3 = T3 * (S3**2 + 0.1 * S3**3)\nFC4 = T4 * (S4**2 + 0.1 * S4**3)\nFC5 = T5 * (S5**2 + 0.1 * S5**3)\nFC6 = T6 * (S6**2 + 0.1 * S6**3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + FC4 + FC5 + FC6)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Zone 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Zone 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Zone 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Zone 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Zone 5: \", model.getVal(T5))\n    print(\"Number of Trucks in Zone 6: \", model.getVal(T6))\n    print(\"Average Speed in Zone 1: \", model.getVal(S1))\n    print(\"Average Speed in Zone 2: \", model.getVal(S2))\n    print(\"Average Speed in Zone 3: \", model.getVal(S3))\n    print(\"Average Speed in Zone 4: \", model.getVal(S4))\n    print(\"Average Speed in Zone 5: \", model.getVal(S5))\n    print(\"Average Speed in Zone 6: \", model.getVal(S6))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Trucks\": \"TruckHours\", \"range\": \"TruckHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Vans\": \"VanHours\", \"range\": \"VanHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Bikes\": \"BikeHours\", \"range\": \"BikeHours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type is a function of operational hours and the number of vehicles. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company aims to maximize the net daily revenue.\n// Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\n// Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\n// Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n// So, the objective function is: Maximize (Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n## Generate Constraint-1:\nThe company has a total of 200 operational hours available per day across all vehicle types.\n// TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for daily operational costs including fuel and maintenance.\n// 50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000\n\n## Generate Constraint-3:\nDue to driver availability, the total number of vehicles cannot exceed 50.\n// TruckCount + VanCount + BikeCount <= 50\n\n## Generate Constraint-4:\nThe company must ensure at least 10 hours of operation for Trucks and 15 hours for Vans to meet critical delivery schedules.\n// TruckHours >= 10; VanHours >= 15",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability. The revenue and operational costs for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Hour | Operational Cost per Hour |\n|--------------|------------------|---------------------------|\n| Trucks       | $100             | $50                       |\n| Vans         | $70              | $30                       |\n| Bikes        | $30              | $10                       |\n\nThe company has a total of 200 operational hours available per day across all vehicle types. The company has a budget of $10,000 for daily operational costs including fuel and maintenance. Due to driver availability, the total number of vehicles cannot exceed 50. The company must ensure at least 10 hours of operation for Trucks and 15 hours for Vans to meet critical delivery schedules.\n\nPlease help the company to maximize the net daily revenue, which is calculated as the total revenue generated by each vehicle type minus the corresponding operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckHours = model.addVar(vtype=\"INTEGER\", name=\"TruckHours\", lb=10)  # operational hours for Trucks\nVanHours = model.addVar(vtype=\"INTEGER\", name=\"VanHours\", lb=15)  # operational hours for Vans\nBikeHours = model.addVar(vtype=\"INTEGER\", name=\"BikeHours\", lb=0)  # operational hours for Bikes\n\n# Define objective function\nRevenue_Trucks = (100 - 50) * TruckHours * TruckCount  # Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\nRevenue_Vans = (70 - 30) * VanHours * VanCount  # Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\nRevenue_Bikes = (30 - 10) * BikeHours * BikeCount  # Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n# Add constraints\nmodel.addCons(TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200)  # Total operational hours constraint\nmodel.addCons(50 * TruckHours * TruckCount + 30 * VanHours * VanCount + 10 * BikeHours * BikeCount <= 10000)  # Operational cost budget constraint\nmodel.addCons(TruckCount + VanCount + BikeCount <= 50)  # Total number of vehicles constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Operational Hours for Trucks: \", model.getVal(TruckHours))\n    print(\"Operational Hours for Vans: \", model.getVal(VanHours))\n    print(\"Operational Hours for Bikes: \", model.getVal(BikeHours))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n// Cost_A = (100 - 5 * Automation) * A\n// Cost_B = (150 - 5 * Automation) * B\n// Cost_C = (200 - 5 * Automation) * C\n// Revenue_A = 150 * A\n// Revenue_B = 200 * B\n// Revenue_C = 250 * C\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for implementing automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// A + B + C <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 500 units.\n// A >= 500\n\n## Generate Constraint-4:\nThe company must ensure that the production of ProductB does not exceed 800 units.\n// B <= 800\n\n## Generate Constraint-5:\nThe level of automation must be at least 200 units to start the automation process.\n// Automation >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\nThe company has a budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units. The market demand for ProductA is at least 500 units. The company must ensure that the production of ProductB does not exceed 800 units. The level of automation must be at least 200 units to start the automation process.\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=200) # level of automation\n\n# Define objective function\nCost_A = (100 - 5 * Automation) * A\nCost_B = (150 - 5 * Automation) * B\nCost_C = (200 - 5 * Automation) * C\nRevenue_A = 150 * A\nRevenue_B = 200 * B\nRevenue_C = 250 * C\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\nmodel.addCons(A + B + C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good and the frequency of trips per truck. The company also considers investing in fuel-efficient technologies for each type of truck to reduce operational costs.\n// {\"number of trucks for Heavy Machinery\": \"TrucksHM\", \"range\": \"TrucksHM >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Consumer Electronics\": \"TrucksCE\", \"range\": \"TrucksCE >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable Goods\": \"TrucksPG\", \"range\": \"TrucksPG >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Heavy Machinery\": \"TripsHM\", \"range\": \"TripsHM >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Consumer Electronics\": \"TripsCE\", \"range\": \"TripsCE >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Perishable Goods\": \"TripsPG\", \"range\": \"TripsPG >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy Machinery\": \"InvestmentHM\", \"range\": \"InvestmentHM >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Consumer Electronics\": \"InvestmentCE\", \"range\": \"InvestmentCE >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Perishable Goods\": \"InvestmentPG\", \"range\": \"InvestmentPG >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit, which is affected by the investment in fuel-efficient technologies. The net profit per trip for Heavy Machinery is $1000, which decreases by $10 for every $100 invested in fuel-efficient technology. The net profit per trip for Consumer Electronics is $800, which decreases by $8 for every $100 invested in fuel-efficient technology. The net profit per trip for Perishable Goods is $1200, which decreases by $12 for every $100 invested in fuel-efficient technology.\n// Net profit for Heavy Machinery: ProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\n// Net profit for Consumer Electronics: ProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\n// Net profit for Perishable Goods: ProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\n// So, the objective function is: Maximize (ProfitHM + ProfitCE + ProfitPG)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies.\n// 1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available.\n// TrucksHM + TrucksCE + TrucksPG <= 50",
        "question": "A logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good, the frequency of trips per truck, and the investment in fuel-efficient technologies for each type of truck to reduce operational costs. The company aims to maximize its net profit, which is affected by the investment in fuel-efficient technologies. The net profit per trip for Heavy Machinery is $1000, which decreases by $10 for every $100 invested in fuel-efficient technology. The net profit per trip for Consumer Electronics is $800, which decreases by $8 for every $100 invested in fuel-efficient technology. The net profit per trip for Perishable Goods is $1200, which decreases by $12 for every $100 invested in fuel-efficient technology. The company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies. The company has a total of 50 trucks available. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksHM = model.addVar(vtype=\"INTEGER\", name=\"TrucksHM\", lb=0)  # number of trucks for Heavy Machinery\nTrucksCE = model.addVar(vtype=\"INTEGER\", name=\"TrucksCE\", lb=0)  # number of trucks for Consumer Electronics\nTrucksPG = model.addVar(vtype=\"INTEGER\", name=\"TrucksPG\", lb=0)  # number of trucks for Perishable Goods\nTripsHM = model.addVar(vtype=\"INTEGER\", name=\"TripsHM\", lb=0)  # frequency of trips per truck for Heavy Machinery\nTripsCE = model.addVar(vtype=\"INTEGER\", name=\"TripsCE\", lb=0)  # frequency of trips per truck for Consumer Electronics\nTripsPG = model.addVar(vtype=\"INTEGER\", name=\"TripsPG\", lb=0)  # frequency of trips per truck for Perishable Goods\nInvestmentHM = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentHM\", lb=0)  # investment in fuel-efficient technology for Heavy Machinery\nInvestmentCE = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentCE\", lb=0)  # investment in fuel-efficient technology for Consumer Electronics\nInvestmentPG = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentPG\", lb=0)  # investment in fuel-efficient technology for Perishable Goods\n\n# Define objective function\nProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\nProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\nProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHM + ProfitCE + ProfitPG)\n\n# Add constraints\nmodel.addCons(1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000)\nmodel.addCons(TrucksHM + TrucksCE + TrucksPG <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(TrucksHM))\n    print(\"Number of Trucks for Consumer Electronics: \", model.getVal(TrucksCE))\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(TrucksPG))\n    print(\"Frequency of Trips for Heavy Machinery: \", model.getVal(TripsHM))\n    print(\"Frequency of Trips for Consumer Electronics: \", model.getVal(TripsCE))\n    print(\"Frequency of Trips for Perishable Goods: \", model.getVal(TripsPG))\n    print(\"Investment in Fuel-Efficient Technology for Heavy Machinery: \", model.getVal(InvestmentHM))\n    print(\"Investment in Fuel-Efficient Technology for Consumer Electronics: \", model.getVal(InvestmentCE))\n    print(\"Investment in Fuel-Efficient Technology for Perishable Goods: \", model.getVal(InvestmentPG))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected yield is 150 bushels per acre, the price per bushel is $5, and the water requirement is 200 gallons per acre.\nFor Wheat, the expected yield is 100 bushels per acre, the price per bushel is $6, and the water requirement is 150 gallons per acre.\nFor Soybeans, the expected yield is 50 bushels per acre, the price per bushel is $10, and the water requirement is 100 gallons per acre.\nFor Barley, the expected yield is 80 bushels per acre, the price per bushel is $4, and the water requirement is 120 gallons per acre.\nFor Oats, the expected yield is 70 bushels per acre, the price per bushel is $3, and the water requirement is 90 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n// Total profit: Profit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\n// Total water usage: Water = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer has a total of 15,000 gallons of water available for irrigation.\n// 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000\n\n## Generate Constraint-3:\nThe farmer wants to plant at least 5 acres of each crop.\n// Corn >= 5; Wheat >= 5; Soybeans >= 5; Barley >= 5; Oats >= 5",
        "question": "A farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop. The expected yield, price per bushel, and water requirement for each crop are given in the following Table.\n\n| Crop      | Expected Yield (bushels/acre) | Price per Bushel | Water Requirement (gallons/acre) |\n|-----------|-------------------------------|------------------|---------------------------------|\n| Corn      | 150                           | $5               | 200                             |\n| Wheat     | 100                           | $6               | 150                             |\n| Soybeans  | 50                            | $10              | 100                             |\n| Barley    | 80                            | $4               | 120                             |\n| Oats      | 70                            | $3               | 90                              |\n\nThe farmer has 100 acres available for planting and a total of 15,000 gallons of water available for irrigation. The farmer wants to plant at least 5 acres of each crop. \nPlease help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5)  # number of acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=5)  # number of acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=5)  # number of acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=5)  # number of acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=5)  # number of acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\nWater = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer has a total of 15,000 gallons of water available for irrigation.\nmodel.addCons(200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Number of Acres of Barley: \", model.getVal(Barley))\n    print(\"Number of Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed.\n// {\"speed of truck 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of truck 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = Distance / FuelEfficiency. The fuel efficiency decreases nonlinearly with increasing speed due to aerodynamic drag. The company aims to minimize the total fuel consumption across all trucks and routes.\n// FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n// FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n// TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed. The speed range for each truck is between 0 and 120 km/h, and the fuel efficiency is a continuous variable that is greater than 0.\n\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = Distance / FuelEfficiency. The fuel efficiency decreases nonlinearly with increasing speed due to aerodynamic drag. The company aims to minimize the total fuel consumption across all trucks and routes.\n\nThe company has a total of 50 trucks available. The number of trucks assigned to each route must be an integer and non-negative.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes, given the following constraints:\n1. The total number of trucks available is 50.\n2. The speed of each truck must be between 0 and 120 km/h.\n3. The number of trucks assigned to each route must be non-negative integers.\n4. The fuel efficiency of each truck is a continuous variable greater than 0.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120)  # speed of truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120)  # speed of truck 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks on route 2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # fuel efficiency of truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # fuel efficiency of truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n## FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n## TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n## Convert the division to multiplication\nmodel.addCons(obj == Trucks1 * Efficiency1 * (1 - 0.005 * (Speed1 - 60)**2) + Trucks2 * Efficiency2 * (1 - 0.005 * (Speed2 - 60)**2))\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. They have five types of vehicles (A, B, C, D, and E) available for transportation tasks. Each vehicle type has different capacities and operational costs.\n// {\"number of vehicles of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nVehicle B has a capacity of 20 tons, an operational cost of $700 per day, and a fuel efficiency of 8 km/liter.\nVehicle C has a capacity of 30 tons, an operational cost of $900 per day, and a fuel efficiency of 10 km/liter.\nVehicle D has a capacity of 40 tons, an operational cost of $1100 per day, and a fuel efficiency of 12 km/liter.\nVehicle E has a capacity of 50 tons, an operational cost of $1300 per day, and a fuel efficiency of 15 km/liter.\nThe company aims to maximize the transportation capacity per dollar spent (defined as the total capacity of all vehicles divided by the total operational cost).\n// Total capacity: Capacity = 10 * A + 20 * B + 30 * C + 40 * D + 50 * E\n// Total operational cost: Cost = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\n// So, the objective function is: Maximize Capacity / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $30,000 for operational costs next month.\n// 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E <= 30000",
        "question": "A logistics company is planning its fleet usage for the next month. They have five types of vehicles (A, B, C, D, and E) available for transportation tasks. Each vehicle type has different capacities and operational costs. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Capacity (tons) | Operational Cost ($/day) | Fuel Efficiency (km/liter) |\n|--------------|-----------------|--------------------------|----------------------------|\n| A            | 10              | 500                      | 5                          |\n| B            | 20              | 700                      | 8                          |\n| C            | 30              | 900                      | 10                         |\n| D            | 40              | 1100                     | 12                         |\n| E            | 50              | 1300                     | 15                         |\n\nThe company has a budget of $30,000 for operational costs next month. The company aims to maximize the transportation capacity per dollar spent (defined as the total capacity of all vehicles divided by the total operational cost). Please help the company determine the optimal number of vehicles of each type to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of vehicles of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of vehicles of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * A + 20 * B + 30 * C + 40 * D + 50 * E\nCost = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\n## the objective function is: Maximize Capacity / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Capacity)\n\n# Add constraints\n## The company has a budget of $30,000 for operational costs next month.\nmodel.addCons(500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles of Type A: \", model.getVal(A))\n    print(\"Number of Vehicles of Type B: \", model.getVal(B))\n    print(\"Number of Vehicles of Type C: \", model.getVal(C))\n    print(\"Number of Vehicles of Type D: \", model.getVal(D))\n    print(\"Number of Vehicles of Type E: \", model.getVal(E))\n    print(\"Maximized Transportation Capacity per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1259,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large vehicles\": \"ExtraLarge\", \"range\": \"ExtraLarge >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer.\n// Profit_Small = (1.20 - 0.50) * Small\n// Profit_Medium = (1.50 - 0.70) * Medium\n// Profit_Large = (1.80 - 0.90) * Large\n// Profit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\n// Profit_Electric = (1.00 - 0.30) * Electric\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\n\n## Generate Constraint-1:\nThe total number of vehicles the company can operate is limited to 200.\n// Small + Medium + Large + ExtraLarge + Electric <= 200\n\n## Generate Constraint-2:\nThe company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500.\n// 2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000\n\n## Generate Constraint-3:\nThe cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\n// Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of vehicles: Small, Medium, Large, Extra-Large, and Electric. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The cost per kilometer for Small vehicles is $0.50, for Medium vehicles is $0.70, for Large vehicles is $0.90, for Extra-Large vehicles is $1.10, and for Electric vehicles is $0.30. The revenue per kilometer for Small vehicles is $1.20, for Medium vehicles is $1.50, for Large vehicles is $1.80, for Extra-Large vehicles is $2.10, and for Electric vehicles is $1.00. The company wants to maximize the profit per kilometer, which is defined as the revenue per kilometer minus the cost per kilometer. The total number of vehicles the company can operate is limited to 200. The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000. The cost to acquire and maintain a Small vehicle is $2000, a Medium vehicle is $3000, a Large vehicle is $4000, an Extra-Large vehicle is $5000, and an Electric vehicle is $3500. The cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons. Please help the company to maximize the profit per kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of Large vehicles\nExtraLarge = model.addVar(vtype=\"INTEGER\", name=\"ExtraLarge\", lb=0) # number of Extra-Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0) # number of Electric vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Small = (1.20 - 0.50) * Small\nProfit_Medium = (1.50 - 0.70) * Medium\nProfit_Large = (1.80 - 0.90) * Large\nProfit_ExtraLarge = (2.10 - 1.10) * ExtraLarge\nProfit_Electric = (1.00 - 0.30) * Electric\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large + Profit_ExtraLarge + Profit_Electric)\n\n# Add constraints\n## The total number of vehicles the company can operate is limited to 200.\nmodel.addCons(Small + Medium + Large + ExtraLarge + Electric <= 200)\n## The company has a budget constraint for vehicle acquisition and maintenance, which is $100,000.\nmodel.addCons(2000 * Small + 3000 * Medium + 4000 * Large + 5000 * ExtraLarge + 3500 * Electric <= 100000)\n## The cargo capacity constraint is as follows: Small vehicles can carry 1 ton, Medium vehicles can carry 2 tons, Large vehicles can carry 3 tons, Extra-Large vehicles can carry 4 tons, and Electric vehicles can carry 1.5 tons. The total cargo capacity required is 300 tons.\nmodel.addCons(Small + 2 * Medium + 3 * Large + 4 * ExtraLarge + 1.5 * Electric >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Number of Extra-Large Vehicles: \", model.getVal(ExtraLarge))\n    print(\"Number of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Maximized Profit Per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1420,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Trucks\": \"FuelTruck\", \"range\": \"FuelTruck > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Vans\": \"FuelVan\", \"range\": \"FuelVan > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Bikes\": \"FuelBike\", \"range\": \"FuelBike > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Trucks\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Vans\": \"MaintenanceVan\", \"range\": \"MaintenanceVan > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Bikes\": \"MaintenanceBike\", \"range\": \"MaintenanceBike > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes.\n// Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe number of Trucks must be at least half the number of Vans.\n// Trucks >= 0.5 * Vans\n\n## Generate Constraint-4:\nThe number of Bikes must be at least twice the number of Trucks.\n// Bikes >= 2 * Trucks",
        "question": "A logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption rates and maintenance costs per vehicle for each type are given in the following Table.\n\n| Vehicle | Fuel Consumption Rate | Maintenance Cost per Vehicle |\n|---------|----------------------|------------------------------|\n| Trucks  | FuelTruck            | MaintenanceTruck             |\n| Vans    | FuelVan              | MaintenanceVan               |\n| Bikes   | FuelBike             | MaintenanceBike              |\n\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The number of Trucks must be at least half the number of Vans. The number of Bikes must be at least twice the number of Trucks.\n\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuelTruck = model.addVar(name=\"FuelTruck\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Trucks\nFuelVan = model.addVar(name=\"FuelVan\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Vans\nFuelBike = model.addVar(name=\"FuelBike\", vtype=\"CONTINUOUS\", lb=0)  # fuel consumption rate for Bikes\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Trucks\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Vans\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", vtype=\"CONTINUOUS\", lb=0)  # maintenance cost per vehicle for Bikes\n\n# Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000)\n# The total number of vehicles cannot exceed 50.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n# The number of Trucks must be at least half the number of Vans.\nmodel.addCons(Trucks >= 0.5 * Vans)\n# The number of Bikes must be at least twice the number of Trucks.\nmodel.addCons(Bikes >= 2 * Trucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\n// {\"number of trucks for short distance routes\": \"ShortDistance\", \"range\": \"ShortDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for medium distance routes\": \"MediumDistance\", \"range\": \"MediumDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for long distance routes\": \"LongDistance\", \"range\": \"LongDistance >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company wants to maximize the net daily profit from the fleet expansion.\n// NetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\n// NetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\n// NetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n// So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the fleet expansion.\n// 500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. For short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day. For medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day. For long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day. The company has a budget of $100,000 for the fleet expansion. The company wants to maximize the net daily profit from the fleet expansion. Please help the company determine the number of trucks to add to each route type.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistance = model.addVar(vtype=\"INTEGER\", name=\"ShortDistance\", lb=0) # number of trucks for short distance routes\nMediumDistance = model.addVar(vtype=\"INTEGER\", name=\"MediumDistance\", lb=0) # number of trucks for medium distance routes\nLongDistance = model.addVar(vtype=\"INTEGER\", name=\"LongDistance\", lb=0) # number of trucks for long distance routes\n\n# Define objective function\nNetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\nNetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\nNetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n# Add constraints\nmodel.addCons(500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Short Distance Routes: \", model.getVal(ShortDistance))\n    print(\"Number of Trucks for Medium Distance Routes: \", model.getVal(MediumDistance))\n    print(\"Number of Trucks for Long Distance Routes: \", model.getVal(LongDistance))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for solar\": \"ESS_SP\", \"range\": \"ESS_SP >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for wind\": \"ESS_WT\", \"range\": \"ESS_WT >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. Similarly, the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar: Energy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\n// Total energy production from wind: Energy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\n// So, the objective function is: Maximize (Energy_SP + Energy_WT)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for investments in energy storage systems.\n// ESS_SP + ESS_WT <= 200000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) must not exceed 1000 units.\n// SP + WT <= 1000",
        "question": "A renewable energy company is planning to install solar panels (SP) and wind turbines (WT) in different regions, as well as invest in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste. The energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems, and the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production. The company has a budget of $200,000 for investments in energy storage systems, and the total number of installations (solar panels and wind turbines) must not exceed 1000 units.\n\nPlease help the company determine the optimal number of solar panels, wind turbines, and investments in energy storage systems to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=0)  # number of wind turbines\nESS_SP = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_SP\", lb=0)  # investment in energy storage for solar\nESS_WT = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_WT\", lb=0)  # investment in energy storage for wind\n\n# Define objective function\nEnergy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\nEnergy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SP + Energy_WT)\n\n# Add constraints\nmodel.addCons(ESS_SP + ESS_WT <= 200000)\nmodel.addCons(SP + WT <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Investment in Energy Storage for Solar: \", model.getVal(ESS_SP))\n    print(\"Investment in Energy Storage for Wind: \", model.getVal(ESS_WT))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost of materials for DeviceA\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceB\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceC\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price of DeviceA is $200, DeviceB is $300, and DeviceC is $400. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost of materials.\n// Total revenue: Revenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\n// Total cost of materials: Cost = CostA * UnitsA + CostB * UnitsB + CostC * UnitsC\n// The objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units in total.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe market demand for DeviceA is at least 200 units per month.\n// UnitsA >= 200\n\n## Generate Constraint-3:\nThe cost of materials for DeviceA is $50 per unit, for DeviceB is $70 per unit, and for DeviceC is $90 per unit. The company has a budget of $70,000 for materials per month.\n// 50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs.\nThe selling price of DeviceA is $200, DeviceB is $300, and DeviceC is $400. The cost of materials for DeviceA is $50 per unit, for DeviceB is $70 per unit, and for DeviceC is $90 per unit. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost of materials.\nThe company has a monthly production capacity of 1000 units in total. The market demand for DeviceA is at least 200 units per month. The company has a budget of $70,000 for materials per month.\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\nRevenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\nCost = 50 * UnitsA + 70 * UnitsB + 90 * UnitsC\n# The objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a monthly production capacity of 1000 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The market demand for DeviceA is at least 200 units per month.\nmodel.addCons(UnitsA >= 200)\n# The company has a budget of $70,000 for materials per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost.\n// Total cargo capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total operational cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n// So, the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize its operations. Each type of truck has different operational costs and capacities. Truck A has an operational cost of $1000 per month and a capacity of 10 tons. Truck B has an operational cost of $1500 per month and a capacity of 15 tons. Truck C has an operational cost of $2000 per month and a capacity of 20 tons. Truck D has an operational cost of $2500 per month and a capacity of 25 tons. Truck E has an operational cost of $3000 per month and a capacity of 30 tons. The company aims to maximize its total cargo capacity while minimizing the total operational cost. The objective is to maximize the ratio of total cargo capacity to total operational cost. The company has a budget of $100,000 for operational costs for the month. Please help the company determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_cargo_capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nTotal_operational_cost = 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E\n## the objective function is: Maximize (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / (1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E)\n## convert the division to multiplication\nmodel.addCons(obj * Total_operational_cost == Total_cargo_capacity)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Operational Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints.\n// {\"number of trucks for goods A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for goods E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The company aims to minimize the total transportation cost.\n// Cost_A = (1000 - 10 * TruckA) * TruckA\n// Cost_B = (1200 - 10 * TruckB) * TruckB\n// Cost_C = (1500 - 10 * TruckC) * TruckC\n// Cost_D = (1800 - 10 * TruckD) * TruckD\n// Cost_E = (2000 - 10 * TruckE) * TruckE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe total number of trucks available for the month is 50.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-2:\nThe demand for goods A requires at least 5 trucks, and the demand for goods E requires at least 3 trucks.\n// TruckA >= 5; TruckE >= 3\n\n## Generate Constraint-3:\nThe volume of goods that can be carried by each truck is limited. Each truck for goods A can carry 100 units, for goods B can carry 120 units, for goods C can carry 150 units, for goods D can carry 180 units, and for goods E can carry 200 units. The total volume of goods to be transported is 7000 units.\n// 100 * TruckA + 120 * TruckB + 150 * TruckC + 180 * TruckD + 200 * TruckE >= 7000\n\n## Generate Constraint-4:\nDue to operational constraints, the number of trucks for goods B cannot exceed twice the number of trucks for goods A.\n// TruckB <= 2 * TruckA\n\n## Generate Constraint-5:\nThe company has a policy to ensure that at least 20% of the total trucks are allocated to goods C.\n// TruckC >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)",
        "question": "A logistics company is managing the distribution of five different types of goods: A, B, C, D, and E. They need to determine the number of trucks allocated to each type of good for the upcoming month. Each truck can carry a specific volume of goods, and the company wants to optimize the allocation to minimize transportation costs while meeting demand and capacity constraints.\nThe cost of transporting goods A, B, C, D, and E varies based on the distance and volume of goods. The cost per truck for goods A is $1000, for goods B is $1200, for goods C is $1500, for goods D is $1800, and for goods E is $2000. Additionally, due to economies of scale, the cost per truck decreases by $10 for each additional truck allocated to the same type of goods. The company aims to minimize the total transportation cost.\nThe total number of trucks available for the month is 50. The demand for goods A requires at least 5 trucks, and the demand for goods E requires at least 3 trucks. The volume of goods that can be carried by each truck is limited. Each truck for goods A can carry 100 units, for goods B can carry 120 units, for goods C can carry 150 units, for goods D can carry 180 units, and for goods E can carry 200 units. The total volume of goods to be transported is 7000 units. Due to operational constraints, the number of trucks for goods B cannot exceed twice the number of trucks for goods A. The company has a policy to ensure that at least 20% of the total trucks are allocated to goods C.\nPlease help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for goods A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for goods B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for goods C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for goods D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for goods E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (1000 - 10 * TruckA) * TruckA\nCost_B = (1200 - 10 * TruckB) * TruckB\nCost_C = (1500 - 10 * TruckC) * TruckC\nCost_D = (1800 - 10 * TruckD) * TruckD\nCost_E = (2000 - 10 * TruckE) * TruckE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available for the month is 50.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n## The demand for goods A requires at least 5 trucks, and the demand for goods E requires at least 3 trucks.\nmodel.addCons(TruckA >= 5)\nmodel.addCons(TruckE >= 3)\n## The volume of goods that can be carried by each truck is limited.\nmodel.addCons(100 * TruckA + 120 * TruckB + 150 * TruckC + 180 * TruckD + 200 * TruckE >= 7000)\n## Due to operational constraints, the number of trucks for goods B cannot exceed twice the number of trucks for goods A.\nmodel.addCons(TruckB <= 2 * TruckA)\n## The company has a policy to ensure that at least 20% of the total trucks are allocated to goods C.\nmodel.addCons(TruckC >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Goods D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Goods E: \", model.getVal(TruckE))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1564,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per truck for RouteA is $50,000, for RouteB is $60,000, for RouteC is $70,000, for RouteD is $80,000, and for RouteE is $90,000. The company wants to minimize the total cost of fuel and maintenance.\n// Total cost for RouteA: Cost_A = 50,000 * TrucksA\n// Total cost for RouteB: Cost_B = 60,000 * TrucksB\n// Total cost for RouteC: Cost_C = 70,000 * TrucksC\n// Total cost for RouteD: Cost_D = 80,000 * TrucksD\n// Total cost for RouteE: Cost_E = 90,000 * TrucksE\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\n// TrucksA >= TrucksB + 5\n\n## Generate Constraint-3:\nThe total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\n// TrucksC + TrucksD >= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-5:\nThe company has a budget of $2,800,000 for total fuel and maintenance costs for the quarter.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,800,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to minimize fuel consumption and maintenance costs while meeting delivery demands. The fuel consumption and maintenance cost per truck for each route is given in the following Table.\n\n| Route   | Cost per Truck |\n|---------|----------------|\n| RouteA  | $50,000        |\n| RouteB  | $60,000        |\n| RouteC  | $70,000        |\n| RouteD  | $80,000        |\n| RouteE  | $90,000        |\n\nThe company has a total of 40 trucks available for allocation. Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB. The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks. The company wants to ensure that each route has at least one truck allocated. The company has a budget of $2,800,000 for total fuel and maintenance costs for the quarter.\n\nPlease help the company to minimize the total cost of fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\nCost_A = 50000 * TrucksA\nCost_B = 60000 * TrucksB\nCost_C = 70000 * TrucksC\nCost_D = 80000 * TrucksD\nCost_E = 90000 * TrucksE\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n# Due to contractual agreements, RouteA must have at least 5 more trucks than RouteB.\nmodel.addCons(TrucksA >= TrucksB + 5)\n# The total demand for deliveries on RouteC and RouteD combined must be met with at least 20 trucks.\nmodel.addCons(TrucksC + TrucksD >= 20)\n# The company has a budget of $2,800,000 for total fuel and maintenance costs for the quarter.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2800000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Good C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported.\n// Revenue_A = 1000 * TrucksA * TripsA\n// Revenue_B = 1500 * TrucksB * TripsB\n// Revenue_C = 2000 * TrucksC * TripsC\n// Cost_A = 200 * TrucksA * TripsA\n// Cost_B = 300 * TrucksB * TripsB\n// Cost_C = 400 * TrucksC * TripsC\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total number of trips per day across all goods must not exceed 100.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $15000.\n// 200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the number of trips each truck should make per day to maximize efficiency while considering fuel costs and time constraints.\nThe revenue generated per trip for Good A is $1000, for Good B is $1500, and for Good C is $2000. The fuel cost per trip for Good A is $200, for Good B is $300, and for Good C is $400. The company aims to maximize the net daily revenue from all goods transported.\nThe company has a total of 50 trucks available. The total number of trips per day across all goods must not exceed 100. The company has a daily fuel budget of $15000.\nPlease help the company to maximize the net daily revenue from all goods transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Good C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for Good A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for Good B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for Good C\n\n# Define objective function\nRevenue_A = 1000 * TrucksA * TripsA\nRevenue_B = 1500 * TrucksB * TripsB\nRevenue_C = 2000 * TrucksC * TripsC\nCost_A = 200 * TrucksA * TripsA\nCost_B = 300 * TrucksB * TripsB\nCost_C = 400 * TrucksC * TripsC\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The total number of trips per day across all goods must not exceed 100.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)\n# The company has a daily fuel budget of $15000.\nmodel.addCons(200 * TrucksA * TripsA + 300 * TrucksB * TripsB + 400 * TrucksC * TripsC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Good A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Good B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Good C: \", model.getVal(TripsC))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering the cost of fuel, maintenance, and the number of deliveries each vehicle can handle per day. Additionally, the company must decide on the level of investment in vehicle upgrades, which can improve fuel efficiency and delivery capacity.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck upgrades\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van upgrades\": \"VanUpgrade\", \"range\": \"VanUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike upgrades\": \"BikeUpgrade\", \"range\": \"BikeUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is affected by the investment in upgrades. Trucks have an initial efficiency of 10 deliveries per day, which increases by 1 delivery for every $100 invested in upgrades. Vans have an initial efficiency of 15 deliveries per day, increasing by 1.5 deliveries for every $100 invested in upgrades. Bikes have an initial efficiency of 20 deliveries per day, increasing by 2 deliveries for every $100 invested in upgrades. The cost of operating each vehicle type is also affected by the upgrades, with Trucks costing $100 per day, Vans costing $70 per day, and Bikes costing $50 per day, all decreasing by 1% for every $100 invested in upgrades. The company aims to maximize the net daily profit from deliveries.\n// NetProfit_Trucks = (10 + 0.01 * TruckUpgrade) * TruckCount * (DeliveryPrice - (100 - 0.01 * TruckUpgrade))\n// NetProfit_Vans = (15 + 0.015 * VanUpgrade) * VanCount * (DeliveryPrice - (70 - 0.01 * VanUpgrade))\n// NetProfit_Bikes = (20 + 0.02 * BikeUpgrade) * BikeCount * (DeliveryPrice - (50 - 0.01 * BikeUpgrade))\n// So, the objective function is: Maximize (NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations and upgrades.\n// 100 * TruckCount + 70 * VanCount + 50 * BikeCount + TruckUpgrade + VanUpgrade + BikeUpgrade <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering the cost of fuel, maintenance, and the number of deliveries each vehicle can handle per day. Additionally, the company must decide on the level of investment in vehicle upgrades, which can improve fuel efficiency and delivery capacity.\n\nThe efficiency of each vehicle type is affected by the investment in upgrades. Trucks have an initial efficiency of 10 deliveries per day, which increases by 1 delivery for every $100 invested in upgrades. Vans have an initial efficiency of 15 deliveries per day, increasing by 1.5 deliveries for every $100 invested in upgrades. Bikes have an initial efficiency of 20 deliveries per day, increasing by 2 deliveries for every $100 invested in upgrades. The cost of operating each vehicle type is also affected by the upgrades, with Trucks costing $100 per day, Vans costing $70 per day, and Bikes costing $50 per day, all decreasing by 1% for every $100 invested in upgrades. The company aims to maximize the net daily profit from deliveries.\n\nThe company has a total budget of $10,000 for vehicle operations and upgrades. Please help the company to maximize the net daily profit from deliveries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nTruckUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckUpgrade\", lb=0)\nVanUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"VanUpgrade\", lb=0)\nBikeUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeUpgrade\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDeliveryPrice = 20  # Assuming a constant delivery price for simplicity\nNetProfit_Trucks = (10 + 0.01 * TruckUpgrade) * TruckCount * (DeliveryPrice - (100 - 0.01 * TruckUpgrade))\nNetProfit_Vans = (15 + 0.015 * VanUpgrade) * VanCount * (DeliveryPrice - (70 - 0.01 * VanUpgrade))\nNetProfit_Bikes = (20 + 0.02 * BikeUpgrade) * BikeCount * (DeliveryPrice - (50 - 0.01 * BikeUpgrade))\n## the objective function is: Maximize (NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\nmodel.addCons(obj == NetProfit_Trucks + NetProfit_Vans + NetProfit_Bikes)\n\n# Add constraints\n## The company has a total budget of $10,000 for vehicle operations and upgrades.\nmodel.addCons(100 * TruckCount + 70 * VanCount + 50 * BikeCount + TruckUpgrade + VanUpgrade + BikeUpgrade <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Upgrades: \", model.getVal(TruckUpgrade))\n    print(\"Investment in Van Upgrades: \", model.getVal(VanUpgrade))\n    print(\"Investment in Bike Upgrades: \", model.getVal(BikeUpgrade))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TypeA trucks\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeB trucks\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeC trucks\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The company wants to minimize the total operational cost.\n// Fuel cost per kilometer for TypeA: CostA = 0.5 - 0.0001 * UpgradeA\n// Fuel cost per kilometer for TypeB: CostB = 0.6 - 0.0001 * UpgradeB\n// Fuel cost per kilometer for TypeC: CostC = 0.7 - 0.0001 * UpgradeC\n// Total operational cost: Minimize (CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $10,000.\n// UpgradeA + UpgradeB + UpgradeC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks.\n// TrucksA >= 20; TrucksB >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The total budget for fuel efficiency upgrades is $10,000. The total number of trucks available is 100. Due to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=20) # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=30) # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of TypeC trucks\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0) # fuel efficiency upgrade for TypeA trucks\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0) # fuel efficiency upgrade for TypeB trucks\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0) # fuel efficiency upgrade for TypeC trucks\n\n# Define objective function\nCostA = 0.5 - 0.0001 * UpgradeA\nCostB = 0.6 - 0.0001 * UpgradeB\nCostC = 0.7 - 0.0001 * UpgradeC\nTotalCost = CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC <= 10000) # total budget for fuel efficiency upgrades\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100) # total number of trucks available\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Upgrade for TypeA Trucks: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TypeB Trucks: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TypeC Trucks: \", model.getVal(UpgradeC))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions. The company needs to determine the number of trucks to allocate to each region and the number of trips each truck will make. The company also needs to decide on the fuel consumption rate for each truck, which can vary depending on the region and the load.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Region1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Region5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit, which is the total revenue from all regions minus the total fuel cost. The revenue per region is calculated as the number of trips per truck multiplied by the number of trucks in that region. The fuel cost is calculated as the product of the fuel consumption rate, the number of trips, and the number of trucks in each region.\n// Revenue_Region1 = Trips1 * Trucks1\n// Revenue_Region2 = Trips2 * Trucks2\n// Revenue_Region3 = Trips3 * Trucks3\n// Revenue_Region4 = Trips4 * Trucks4\n// Revenue_Region5 = Trips5 * Trucks5\n// FuelCost_Region1 = FuelRate1 * Trips1 * Trucks1\n// FuelCost_Region2 = FuelRate2 * Trips2 * Trucks2\n// FuelCost_Region3 = FuelRate3 * Trips3 * Trucks3\n// FuelCost_Region4 = FuelRate4 * Trips4 * Trucks4\n// FuelCost_Region5 = FuelRate5 * Trips5 * Trucks5\n// So, the objective function is: Maximize (Revenue_Region1 + Revenue_Region2 + Revenue_Region3 + Revenue_Region4 + Revenue_Region5 - FuelCost_Region1 - FuelCost_Region2 - FuelCost_Region3 - FuelCost_Region4 - FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available across all regions.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nThe total number of trips across all regions should not exceed 500.\n// Trips1 * Trucks1 + Trips2 * Trucks2 + Trips3 * Trucks3 + Trips4 * Trucks4 + Trips5 * Trucks5 <= 500",
        "question": "A logistics company is planning its routes for delivering goods to five different regions. The company needs to determine the number of trucks to allocate to each region (Trucks1 for Region1, Trucks2 for Region2, Trucks3 for Region3, Trucks4 for Region4, Trucks5 for Region5) and the number of trips each truck will make (Trips1 for Region1, Trips2 for Region2, Trips3 for Region3, Trips4 for Region4, Trips5 for Region5). The company also needs to decide on the fuel consumption rate for each truck, which can vary depending on the region and the load (FuelRate1 for Region1, FuelRate2 for Region2, FuelRate3 for Region3, FuelRate4 for Region4, FuelRate5 for Region5).\n\nThe company wants to maximize its profit, which is the total revenue from all regions minus the total fuel cost. The revenue per region is calculated as the number of trips per truck multiplied by the number of trucks in that region. The fuel cost is calculated as the product of the fuel consumption rate, the number of trips, and the number of trucks in each region.\n\nThe company has a total of 50 trucks available across all regions. The total number of trips across all regions should not exceed 500.\n\nPlease help the company to maximize its profit by determining the optimal allocation of trucks, number of trips per truck, and fuel consumption rates for each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Region5\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips per truck for Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips per truck for Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips per truck for Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips per truck for Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips per truck for Region5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0)  # fuel consumption rate for Region1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate for Region2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate for Region3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0)  # fuel consumption rate for Region4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0)  # fuel consumption rate for Region5\n\n# Define objective function\nRevenue_Region1 = Trips1 * Trucks1\nRevenue_Region2 = Trips2 * Trucks2\nRevenue_Region3 = Trips3 * Trucks3\nRevenue_Region4 = Trips4 * Trucks4\nRevenue_Region5 = Trips5 * Trucks5\nFuelCost_Region1 = FuelRate1 * Trips1 * Trucks1\nFuelCost_Region2 = FuelRate2 * Trips2 * Trucks2\nFuelCost_Region3 = FuelRate3 * Trips3 * Trucks3\nFuelCost_Region4 = FuelRate4 * Trips4 * Trucks4\nFuelCost_Region5 = FuelRate5 * Trips5 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Region1 + Revenue_Region2 + Revenue_Region3 + Revenue_Region4 + Revenue_Region5 - FuelCost_Region1 - FuelCost_Region2 - FuelCost_Region3 - FuelCost_Region4 - FuelCost_Region5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)  # total trucks constraint\nmodel.addCons(Trips1 * Trucks1 + Trips2 * Trucks2 + Trips3 * Trucks3 + Trips4 * Trucks4 + Trips5 * Trucks5 <= 500)  # total trips constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Number of Trips per Truck for Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips per Truck for Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips per Truck for Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips per Truck for Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips per Truck for Region5: \", model.getVal(Trips5))\n    print(\"Fuel Consumption Rate for Region1: \", model.getVal(FuelRate1))\n    print(\"Fuel Consumption Rate for Region2: \", model.getVal(FuelRate2))\n    print(\"Fuel Consumption Rate for Region3: \", model.getVal(FuelRate3))\n    print(\"Fuel Consumption Rate for Region4: \", model.getVal(FuelRate4))\n    print(\"Fuel Consumption Rate for Region5: \", model.getVal(FuelRate5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the overall operational cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of each truck type is a nonlinear function of the number of trucks and drivers. The cost includes fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is linearly dependent on the number of drivers, at $3000 per driver. The company aims to minimize the total operational cost.\n// Total operational cost: Cost = (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for vehicle operations and driver salaries.\n// (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + (0.7 + 0.0015 * MediumTrucks^2) * (MediumTrucks * Drivers) + (1 + 0.002 * LargeTrucks^2) * (LargeTrucks * Drivers) + 3000 * Drivers <= 150000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 500 tons. Each Small truck carries 1 ton, each Medium truck carries 2 tons, and each Large truck carries 3 tons.\n// SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500\n\n## Generate Constraint-3:\nDue to licensing restrictions, the number of drivers must not exceed 200.\n// Drivers <= 200\n\n## Generate Constraint-4:\nThe company must operate at least 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks >= 50\n\n## Generate Constraint-5:\nThe ratio of Large trucks to the total number of trucks should not exceed 30%.\n// LargeTrucks / (SmallTrucks + MediumTrucks + LargeTrucks) <= 0.3",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of Small, Medium, and Large trucks, as well as the number of drivers to hire. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The operational cost of each truck type is a nonlinear function of the number of trucks and drivers, including fuel, maintenance, and driver salaries. The cost per kilometer for Small trucks is $0.5 + 0.001 * SmallTrucks^2, for Medium trucks is $0.7 + 0.0015 * MediumTrucks^2, and for Large trucks is $1 + 0.002 * LargeTrucks^2. The driver cost is $3000 per driver. The company has a budget of $150,000 for vehicle operations and driver salaries. The total cargo capacity of the fleet must be at least 500 tons, with each Small truck carrying 1 ton, each Medium truck carrying 2 tons, and each Large truck carrying 3 tons. The number of drivers must not exceed 200 due to licensing restrictions. The company must operate at least 50 trucks in total, and the ratio of Large trucks to the total number of trucks should not exceed 30%.\n\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total operational cost: Cost = (0.5 + 0.001 * SmallTrucks^2) * (SmallTrucks * Drivers) + ...\nCost_Small = (0.5 + 0.001 * SmallTrucks**2) * SmallTrucks * Drivers\nCost_Medium = (0.7 + 0.0015 * MediumTrucks**2) * MediumTrucks * Drivers\nCost_Large = (1 + 0.002 * LargeTrucks**2) * LargeTrucks * Drivers\nCost_Drivers = 3000 * Drivers\n\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers)\n\n# Add constraints\n## The company has a budget of $150,000 for vehicle operations and driver salaries.\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_Drivers <= 150000)\n\n## The total cargo capacity of the fleet must be at least 500 tons.\nmodel.addCons(SmallTrucks + 2 * MediumTrucks + 3 * LargeTrucks >= 500)\n\n## Due to licensing restrictions, the number of drivers must not exceed 200.\nmodel.addCons(Drivers <= 200)\n\n## The company must operate at least 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks >= 50)\n\n## The ratio of Large trucks to the total number of trucks should not exceed 30%.\nmodel.addCons(LargeTrucks <= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in routing software for Trucks\": \"SoftwareT\", \"range\": \"SoftwareT >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Vans\": \"SoftwareV\", \"range\": \"SoftwareV >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Bikes\": \"SoftwareB\", \"range\": \"SoftwareB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\n// Total operational cost for Trucks: CostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\n// Total operational cost for Vans: CostV = 500 * Vans - 0.3 * SoftwareV * Vans\n// Total operational cost for Bikes: CostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and software investments.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000\n\n## Generate Constraint-2:\nThe total number of vehicles must not exceed 2000 units.\n// Trucks + Vans + Bikes <= 2000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has different operational costs and capacities. The company needs to decide how many units of each vehicle type to purchase and how much to invest in advanced routing software for each vehicle type to optimize fuel efficiency and delivery times.\nThe operational cost of each vehicle type decreases with the investment in routing software. For Trucks, the operational cost is $1000 per unit without software, decreasing by $50 for every $100 invested in software. For Vans, the operational cost is $500 per unit without software, decreasing by $30 for every $100 invested in software. For Bikes, the operational cost is $100 per unit without software, decreasing by $10 for every $100 invested in software. The company aims to minimize the total operational cost of all vehicles.\nThe company has a budget of $1,000,000 for vehicle purchases and software investments. The total number of vehicles must not exceed 2000 units.\nPlease help the company to minimize the total operational cost of all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nSoftwareT = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareT\", lb=0)  # investment in routing software for Trucks\nSoftwareV = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareV\", lb=0)  # investment in routing software for Vans\nSoftwareB = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareB\", lb=0)  # investment in routing software for Bikes\n\n# Define objective function\nCostT = 1000 * Trucks - 0.5 * SoftwareT * Trucks\nCostV = 500 * Vans - 0.3 * SoftwareV * Vans\nCostB = 100 * Bikes - 0.1 * SoftwareB * Bikes\n# So, the objective function is: Minimize (CostT + CostV + CostB)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\n# The company has a budget of $1,000,000 for vehicle purchases and software investments.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + SoftwareT + SoftwareV + SoftwareB <= 1000000)\n# The total number of vehicles must not exceed 2000 units.\nmodel.addCons(Trucks + Vans + Bikes <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Routing Software for Trucks: \", model.getVal(SoftwareT))\n    print(\"Investment in Routing Software for Vans: \", model.getVal(SoftwareV))\n    print(\"Investment in Routing Software for Bikes: \", model.getVal(SoftwareB))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n// LaborA = 2 * UnitsA\n// LaborB = 3 * UnitsB\n// LaborC = 4 * UnitsC\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// UnitsA >= 50\n// UnitsB >= 30\n\n## Generate Constraint-4:\nThe company has a storage capacity limit that allows for a maximum of 200 units in total across all devices.\n// UnitsA + UnitsB + UnitsC <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n\n| Device | Profit per Unit | Labor Hours per Unit |\n|--------|-----------------|----------------------|\n| DeviceA | $100            | 2 hours              |\n| DeviceB | $150            | 3 hours              |\n| DeviceC | $200            | 4 hours              |\n\nThe company has a total of 1000 labor hours available for the month. The production of each device requires a specific number of labor hours per unit as shown in the table. Due to market demand, the company must produce at least 50 units of DeviceA and 30 units of DeviceB. The company has a storage capacity limit that allows for a maximum of 200 units in total across all devices.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device and the corresponding labor hours allocated to each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)    # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0) # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0) # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0) # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\nmodel.addCons(LaborA == 2 * UnitsA)\nmodel.addCons(LaborB == 3 * UnitsB)\nmodel.addCons(LaborC == 4 * UnitsC)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor Hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor Hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1292,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n// Energy_output = 100 * S + 200 * W\n// Storage_efficiency = 1 + 0.05 * (E / 100000)\n// So, the objective function is: Maximize (Energy_output * Storage_efficiency)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for investments in energy storage systems.\n// E <= 500000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters.\n// 5 * S + 10 * W <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the investment in energy storage systems (E) for each location to maximize the efficiency and profitability of the energy production. The energy output from solar panels is 100 kWh per panel, and from wind turbines is 200 kWh per turbine. The efficiency of energy storage increases by 5% for every $100,000 invested in energy storage systems. The company aims to maximize the total energy output stored efficiently.\n\n| Component          | Energy Output | Area Required |\n|--------------------|---------------|---------------|\n| Solar Panel (S)    | 100 kWh       | 5 square meters |\n| Wind Turbine (W)   | 200 kWh       | 10 square meters |\n\nThe company has a budget of $500,000 for investments in energy storage systems. The total area available for installation is limited to 1000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 10 square meters.\n\nPlease help the company to maximize the total energy output stored efficiently, considering the constraints on budget and available area.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_output = 100 * S + 200 * W\nStorage_efficiency = 1 + 0.05 * (E / 100000)\n## the objective function is: Maximize (Energy_output * Storage_efficiency)\n## convert the multiplication to addition\nmodel.addCons(obj == Energy_output + Storage_efficiency)\n\n# Add constraints\n## The company has a budget of $500,000 for investments in energy storage systems.\nmodel.addCons(E <= 500000)\n## The total area available for installation is limited to 1000 square meters.\nmodel.addCons(5 * S + 10 * W <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(E))\n    print(\"Maximized Energy Output Stored Efficiently: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production efficiency of each product increases with the investment in new machinery.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The revenue generated per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total capital investment in new machinery cannot exceed $100,000.\n// MachineryInvestment <= 100000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 2000\n\n## Generate Constraint-5:\nThe marketing budget for ProductC must be at least 20% of the total marketing budget.\n// MarketingC >= 0.2 * (MarketingA + MarketingB + MarketingC)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities of each product, the marketing budget allocated to each product, and the amount of capital investment in new machinery that can increase the production efficiency of all products. The production efficiency of each product increases with the investment in new machinery. The initial production cost per unit and the revenue generated per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Revenue Generated per Unit |\n|---------|----------------------------------|----------------------------|\n| ProductA | $100                             | $150                       |\n| ProductB | $150                             | $200                       |\n| ProductC | $200                             | $250                       |\n\nThe company aims to maximize the total profit from all products. The total production capacity of the company is limited to 10,000 units. The total marketing budget cannot exceed $50,000. The total capital investment in new machinery cannot exceed $100,000. Due to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB. The marketing budget for ProductC must be at least 20% of the total marketing budget.\n\nPlease help the company to determine the optimal production quantities, marketing budgets, and capital investment in new machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=2000) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0) # capital investment in new machinery\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * MachineryInvestment) * QuantityA - MarketingA\nProfitB = (200 - 150 + 0.0005 * MachineryInvestment) * QuantityB - MarketingB\nProfitC = (250 - 200 + 0.0005 * MachineryInvestment) * QuantityC - MarketingC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is limited to 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total marketing budget cannot exceed $50,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n# The total capital investment in new machinery cannot exceed $100,000.\nmodel.addCons(MachineryInvestment <= 100000)\n# Due to market demand, the company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\nmodel.addCons(QuantityA >= 1000)\nmodel.addCons(QuantityB >= 2000)\n# The marketing budget for ProductC must be at least 20% of the total marketing budget.\nmodel.addCons(MarketingC >= 0.2 * (MarketingA + MarketingB + MarketingC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Machinery Investment: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1538,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 1\": \"DistanceRegion1\", \"range\": \"DistanceRegion1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 2\": \"DistanceRegion2\", \"range\": \"DistanceRegion2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions. The fuel consumption is calculated based on the number of trucks, their fuel efficiency, and the distance they travel.\n// FuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\n// FuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n// So, the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\n// DistanceRegion1 + DistanceRegion2 <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region. The following table summarizes the variables involved:\n\n| Variable                          | Description                     | Range/Type       |\n|-----------------------------------|---------------------------------|------------------|\n| TrucksRegion1                     | Number of trucks for Region 1   | >= 0, integer    |\n| TrucksRegion2                     | Number of trucks for Region 2   | >= 0, integer    |\n| FuelEfficiency1                   | Fuel efficiency for Region 1    | > 0, real        |\n| FuelEfficiency2                   | Fuel efficiency for Region 2    | > 0, real        |\n| DistanceRegion1                   | Distance traveled in Region 1   | >= 0, real       |\n| DistanceRegion2                   | Distance traveled in Region 2   | >= 0, real       |\n\nThe company aims to minimize the total fuel consumption across all regions, calculated based on the number of trucks, their fuel efficiency, and the distance they travel. The total number of trucks available in the fleet is limited to 50, and the total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nDistanceRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion1\", lb=0)  # distance traveled by trucks in Region 1\nDistanceRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion2\", lb=0)  # distance traveled by trucks in Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\nFuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n## convert the division to multiplication\nmodel.addCons(obj * (FuelEfficiency1 * FuelEfficiency2) == FuelConsumptionRegion1 * FuelEfficiency2 + FuelConsumptionRegion2 * FuelEfficiency1)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\nmodel.addCons(DistanceRegion1 + DistanceRegion2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Distance Traveled in Region 1: \", model.getVal(DistanceRegion1))\n    print(\"Distance Traveled in Region 2: \", model.getVal(DistanceRegion2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1603,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost includes fuel cost and depreciation cost. The fuel cost is directly proportional to the amount of fuel purchased and the speed of the trucks. The depreciation cost increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes.\n// Fuel cost for Route1: FuelCost1 = Fuel1 * Speed1\n// Fuel cost for Route2: FuelCost2 = Fuel2 * Speed2\n// Depreciation cost for Route1: Depreciation1 = 0.01 * Speed1^2 * Trucks1\n// Depreciation cost for Route2: Depreciation2 = 0.01 * Speed2^2 * Trucks2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n## Generate Constraint-1:\nThe total budget for fuel purchases is $10,000.\n// Fuel1 + Fuel2 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks. The operational cost includes fuel cost, which is directly proportional to the amount of fuel purchased and the speed of the trucks, and depreciation cost, which increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes.\n\n| Route | Number of Trucks | Speed Range | Fuel Purchased |\n|-------|------------------|-------------|----------------|\n| 1     | Trucks1          | 0 < Speed1 \u2264 60 | Fuel1          |\n| 2     | Trucks2          | 0 < Speed2 \u2264 60 | Fuel2          |\n\nThe total budget for fuel purchases is $10,000. The total number of trucks available is 50. Please help the company determine the optimal number of trucks, their speeds, and the amount of fuel to purchase to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel purchased for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel purchased for Route2\n\n# Define objective function\nFuelCost1 = Fuel1 * Speed1\nFuelCost2 = Fuel2 * Speed2\nDepreciation1 = 0.01 * Speed1**2 * Trucks1\nDepreciation2 = 0.01 * Speed2**2 * Trucks2\n# So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n# Add constraints\n# The total budget for fuel purchases is $10,000.\nmodel.addCons(Fuel1 + Fuel2 <= 10000)\n# The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Fuel Purchased for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Purchased for Route2: \", model.getVal(Fuel2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods depends on the number of trucks and the distance traveled. The cost function is nonlinear and includes a fuel cost factor that increases with the number of trucks. The objective is to minimize the total transportation cost.\n// The cost function for warehouse 1: C1 = (T1^2 * D1) / (1 + 0.05 * T1)\n// The cost function for warehouse 2: C2 = (T2^2 * D2) / (1 + 0.05 * T2)\n// The cost function for warehouse 3: C3 = (T3^2 * D3) / (1 + 0.05 * T3)\n// The cost function for warehouse 4: C4 = (T4^2 * D4) / (1 + 0.05 * T4)\n// The cost function for warehouse 5: C5 = (T5^2 * D5) / (1 + 0.05 * T5)\n// The objective function is: Minimize (C1 + C2 + C3 + C4 + C5)\n// Minimize [(T1^2 * D1) / (1 + 0.05 * T1) + (T2^2 * D2) / (1 + 0.05 * T2) + (T3^2 * D3) / (1 + 0.05 * T3) + (T4^2 * D4) / (1 + 0.05 * T4) + (T5^2 * D5) / (1 + 0.05 * T5)]\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 25 trucks.\n// T1 <= 25; T2 <= 25; T3 <= 25; T4 <= 25; T5 <= 25",
        "question": "A logistics company operates 5 different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods depends on the number of trucks and the distance traveled. The cost function is nonlinear and includes a fuel cost factor that increases with the number of trucks. The objective is to minimize the total transportation cost. The total number of trucks available across all warehouses is 100. Each warehouse can handle a maximum of 25 trucks.\nPlease help the company to minimize the total transportation cost, which is calculated as the sum of the cost functions for each warehouse: [(T1^2 * D1) / (1 + 0.05 * T1) + (T2^2 * D2) / (1 + 0.05 * T2) + (T3^2 * D3) / (1 + 0.05 * T3) + (T4^2 * D4) / (1 + 0.05 * T4) + (T5^2 * D5) / (1 + 0.05 * T5)].",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=25)  # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=25)  # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=25)  # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=25)  # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=25)  # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The cost function for each warehouse\nC1 = model.addVar('C1')\nC2 = model.addVar('C2')\nC3 = model.addVar('C3')\nC4 = model.addVar('C4')\nC5 = model.addVar('C5')\n\n## Define the nonlinear cost functions as constraints\nmodel.addCons(C1 == (T1**2 * 1) / (1 + 0.05 * T1))  # Assuming D1 = 1 for simplicity\nmodel.addCons(C2 == (T2**2 * 1) / (1 + 0.05 * T2))  # Assuming D2 = 1 for simplicity\nmodel.addCons(C3 == (T3**2 * 1) / (1 + 0.05 * T3))  # Assuming D3 = 1 for simplicity\nmodel.addCons(C4 == (T4**2 * 1) / (1 + 0.05 * T4))  # Assuming D4 = 1 for simplicity\nmodel.addCons(C5 == (T5**2 * 1) / (1 + 0.05 * T5))  # Assuming D5 = 1 for simplicity\n\n## The objective function is: Minimize (C1 + C2 + C3 + C4 + C5)\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install a network of electric vehicle charging stations across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E). The city needs to determine the number of charging stations to install in each zone and the cost of installation per station.\n// {\"number of charging stations in Zone A\": \"ZoneA_Stations\", \"range\": \"ZoneA_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone B\": \"ZoneB_Stations\", \"range\": \"ZoneB_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone C\": \"ZoneC_Stations\", \"range\": \"ZoneC_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone D\": \"ZoneD_Stations\", \"range\": \"ZoneD_Stations >= 0\", \"type\": \"integer\"}\n// {\"number of charging stations in Zone E\": \"ZoneE_Stations\", \"range\": \"ZoneE_Stations >= 0\", \"type\": \"integer\"}\n// {\"cost of installation per station in each zone\": \"InstallationCost\", \"range\": \"InstallationCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city aims to minimize the total cost of installation while ensuring adequate coverage. The cost of installation per station varies by zone and is influenced by the complexity of electrical infrastructure required. The total installation cost is the sum of the product of the number of stations and the installation cost per station in each zone.\n// Total_Cost = ZoneA_Stations * InstallationCost + ZoneB_Stations * InstallationCost + ZoneC_Stations * InstallationCost + ZoneD_Stations * InstallationCost + ZoneE_Stations * InstallationCost\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the entire installation project.\n// ZoneA_Stations * InstallationCost + ZoneB_Stations * InstallationCost + ZoneC_Stations * InstallationCost + ZoneD_Stations * InstallationCost + ZoneE_Stations * InstallationCost <= 1000000\n\n## Generate Constraint-2:\nEach zone must have at least 10 charging stations.\n// ZoneA_Stations >= 10\n// ZoneB_Stations >= 10\n// ZoneC_Stations >= 10\n// ZoneD_Stations >= 10\n// ZoneE_Stations >= 10\n\n## Generate Constraint-3:\nThe total number of charging stations across all zones should not exceed 100.\n// ZoneA_Stations + ZoneB_Stations + ZoneC_Stations + ZoneD_Stations + ZoneE_Stations <= 100\n\n## Generate Constraint-4:\nThe installation cost per station in Zone A is twice that of Zone B, Zone C is 1.5 times that of Zone B, Zone D is the same as Zone B, and Zone E is 0.8 times that of Zone B.\n// InstallationCost_ZoneA = 2 * InstallationCost_ZoneB\n// InstallationCost_ZoneC = 1.5 * InstallationCost_ZoneB\n// InstallationCost_ZoneD = InstallationCost_ZoneB\n// InstallationCost_ZoneE = 0.8 * InstallationCost_ZoneB\n// This constraint ensures that the installation costs are consistent with the specified ratios.",
        "question": "A city is planning to install a network of electric vehicle charging stations across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E). The city needs to determine the number of charging stations to install in each zone and the cost of installation per station. The city aims to minimize the total cost of installation while ensuring adequate coverage. The cost of installation per station varies by zone and is influenced by the complexity of electrical infrastructure required. The total installation cost is the sum of the product of the number of stations and the installation cost per station in each zone.\n\nThe city has a budget of $1,000,000 for the entire installation project. Each zone must have at least 10 charging stations. The total number of charging stations across all zones should not exceed 100. The installation cost per station in Zone A is twice that of Zone B, Zone C is 1.5 times that of Zone B, Zone D is the same as Zone B, and Zone E is 0.8 times that of Zone B.\n\nPlease help the city to minimize the total cost of installation while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneA_Stations\", lb=10)\nZoneB_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneB_Stations\", lb=10)\nZoneC_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneC_Stations\", lb=10)\nZoneD_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneD_Stations\", lb=10)\nZoneE_Stations = model.addVar(vtype=\"INTEGER\", name=\"ZoneE_Stations\", lb=10)\nInstallationCost_ZoneB = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneB\", lb=0)\nInstallationCost_ZoneA = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneA\")\nInstallationCost_ZoneC = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneC\")\nInstallationCost_ZoneD = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneD\")\nInstallationCost_ZoneE = model.addVar(vtype=\"CONTINUOUS\", name=\"InstallationCost_ZoneE\")\n\n# Define objective function\nTotal_Cost = ZoneA_Stations * InstallationCost_ZoneA + ZoneB_Stations * InstallationCost_ZoneB + ZoneC_Stations * InstallationCost_ZoneC + ZoneD_Stations * InstallationCost_ZoneD + ZoneE_Stations * InstallationCost_ZoneE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\nmodel.addCons(ZoneA_Stations * InstallationCost_ZoneA + ZoneB_Stations * InstallationCost_ZoneB + ZoneC_Stations * InstallationCost_ZoneC + ZoneD_Stations * InstallationCost_ZoneD + ZoneE_Stations * InstallationCost_ZoneE <= 1000000)\nmodel.addCons(ZoneA_Stations + ZoneB_Stations + ZoneC_Stations + ZoneD_Stations + ZoneE_Stations <= 100)\nmodel.addCons(InstallationCost_ZoneA == 2 * InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneC == 1.5 * InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneD == InstallationCost_ZoneB)\nmodel.addCons(InstallationCost_ZoneE == 0.8 * InstallationCost_ZoneB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Charging Stations in Zone A: \", model.getVal(ZoneA_Stations))\n    print(\"Number of Charging Stations in Zone B: \", model.getVal(ZoneB_Stations))\n    print(\"Number of Charging Stations in Zone C: \", model.getVal(ZoneC_Stations))\n    print(\"Number of Charging Stations in Zone D: \", model.getVal(ZoneD_Stations))\n    print(\"Number of Charging Stations in Zone E: \", model.getVal(ZoneE_Stations))\n    print(\"Installation Cost per Station in Zone B: \", model.getVal(InstallationCost_ZoneB))\n    print(\"Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The goal is to minimize the total operational cost while meeting delivery requirements and constraints.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company aims to minimize the total operational cost across all routes.\n// Total operational cost for Route1: Cost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Route3: Cost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades. The total number of trucks available for all routes is limited to 50. The company aims to minimize the total operational cost across all routes. Please help the company determine the optimal number of trucks and the appropriate investments in fuel efficiency for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\n# Total operational cost for Route1: Cost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\n# Total operational cost for Route2: Cost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\n# Total operational cost for Route3: Cost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = (2 - 0.005 * Efficiency1) * Trucks1 * 1000  # Assuming Distance1 = 1000 km\nCost2 = (3 - 0.005 * Efficiency2) * Trucks2 * 1000  # Assuming Distance2 = 1000 km\nCost3 = (4 - 0.005 * Efficiency3) * Trucks3 * 1000  # Assuming Distance3 = 1000 km\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n# The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The company also wants to determine the optimal speed at which each truck should travel to minimize fuel consumption while meeting delivery deadlines.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"real\"}\n// {\"optimal speed for trucks in Region A\": \"SpeedA\", \"range\": \"0 < SpeedA <= 65\", \"type\": \"real\"}\n// {\"optimal speed for trucks in Region B\": \"SpeedB\", \"range\": \"0 < SpeedB <= 65\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day, considering the fuel efficiency of trucks and the speed at which they travel. The fuel cost is calculated based on the distance traveled and the fuel consumption rate, which is a nonlinear function of speed.\n// FuelCostA = TrucksA * DistanceA * (SpeedA / FuelEfficiencyA) * FuelPrice\n// FuelCostB = TrucksB * DistanceB * (SpeedB / FuelEfficiencyB) * FuelPrice\n// The objective function is: Minimize (FuelCostA + FuelCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// FuelCostA + FuelCostB <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available in the fleet is 50.\n// TrucksA + TrucksB <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The company also wants to determine the optimal speed at which each truck should travel to minimize fuel consumption while meeting delivery deadlines. The following table summarizes the variables and their constraints:\n\n| Variable                     | Description                          | Constraints                  |\n|------------------------------|--------------------------------------|------------------------------|\n| TrucksA                      | Number of trucks for Region A        | TrucksA >= 0, integer        |\n| TrucksB                      | Number of trucks for Region B        | TrucksB >= 0, integer        |\n| FuelEfficiencyA              | Fuel efficiency of trucks for Region A | FuelEfficiencyA > 0, real    |\n| FuelEfficiencyB              | Fuel efficiency of trucks for Region B | FuelEfficiencyB > 0, real    |\n| SpeedA                       | Optimal speed for trucks in Region A | 0 < SpeedA <= 65, real       |\n| SpeedB                       | Optimal speed for trucks in Region B | 0 < SpeedB <= 65, real       |\n\nThe company aims to minimize the total fuel cost per day, considering the fuel efficiency of trucks and the speed at which they travel. The fuel cost is calculated based on the distance traveled and the fuel consumption rate, which is a nonlinear function of speed. The company has a total budget of $10,000 for fuel costs per day. The total number of trucks available in the fleet is 50.\n\nPlease help the company to minimize the total fuel cost per day, given the constraints and the objective function: Minimize (FuelCostA + FuelCostB), where FuelCostA = TrucksA * DistanceA * (SpeedA / FuelEfficiencyA) * FuelPrice and FuelCostB = TrucksB * DistanceB * (SpeedB / FuelEfficiencyB) * FuelPrice.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Region B\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # fuel efficiency of trucks for Region A\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # fuel efficiency of trucks for Region B\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0, ub=65)  # optimal speed for trucks in Region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0, ub=65)  # optimal speed for trucks in Region B\n\n# Define objective function\nFuelPrice = 3.5  # constant fuel price per unit\nDistanceA = 500  # distance for Region A\nDistanceB = 600  # distance for Region B\n\n# Calculate fuel costs\nFuelCostA = TrucksA * DistanceA * (SpeedA / FuelEfficiencyA) * FuelPrice\nFuelCostB = TrucksB * DistanceB * (SpeedB / FuelEfficiencyB) * FuelPrice\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(FuelCostA + FuelCostB <= 10000)\n# The total number of trucks available in the fleet is 50.\nmodel.addCons(TrucksA + TrucksB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Fuel Efficiency for Region A: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency for Region B: \", model.getVal(FuelEfficiencyB))\n    print(\"Optimal Speed for Region A: \", model.getVal(SpeedA))\n    print(\"Optimal Speed for Region B: \", model.getVal(SpeedB))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1978,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs.\n// {\"number of trucks for ProductA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for ProductA is $500 per trip, and the revenue generated is $1000 per trip. For ProductB, the cost is $600 per trip, and the revenue is $1200 per trip. For ProductC, the cost is $700 per trip, and the revenue is $1400 per trip. For ProductD, the cost is $800 per trip, and the revenue is $1600 per trip. For ProductE, the cost is $900 per trip, and the revenue is $1800 per trip. The company wants to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_A = (1000 - 500) * TruckA\n// Total net profit for ProductB: Profit_B = (1200 - 600) * TruckB\n// Total net profit for ProductC: Profit_C = (1400 - 700) * TruckC\n// Total net profit for ProductD: Profit_D = (1600 - 800) * TruckD\n// Total net profit for ProductE: Profit_E = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for truck operations.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000\n\n## Generate Constraint-2:\nThe company can operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to regional demand, at least 10 trucks must be allocated for ProductA.\n// TruckA >= 10\n\n## Generate Constraint-4:\nThe company aims to allocate at least 20% of the total trucks to ProductE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-5:\nThe number of trucks for ProductC must not exceed twice the number of trucks for ProductB.\n// TruckC <= 2 * TruckB",
        "question": "A logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs. The cost and revenue per trip for each product are given in the following Table.\n\n| Product | Cost per Trip | Revenue per Trip |\n|---------|---------------|------------------|\n| ProductA | $500         | $1000            |\n| ProductB | $600         | $1200            |\n| ProductC | $700         | $1400            |\n| ProductD | $800         | $1600            |\n| ProductE | $900         | $1800            |\n\nThe company has a total budget of $50,000 for truck operations. The company can operate a maximum of 100 trucks in total. Due to regional demand, at least 10 trucks must be allocated for ProductA. The company aims to allocate at least 20% of the total trucks to ProductE. The number of trucks for ProductC must not exceed twice the number of trucks for ProductB.\n\nPlease help the company to maximize the total net profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for ProductA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for ProductB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for ProductC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for ProductD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for ProductE\n\n# Define objective function\nProfit_A = (1000 - 500) * TruckA\nProfit_B = (1200 - 600) * TruckB\nProfit_C = (1400 - 700) * TruckC\nProfit_D = (1600 - 800) * TruckD\nProfit_E = (1800 - 900) * TruckE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\nmodel.addCons(TruckC <= 2 * TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for ProductA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for ProductB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for ProductC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for ProductD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for ProductE: \", model.getVal(TruckE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\n// TruckC <= TruckA + 10\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the total trucks are TruckE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-5:\nThe company has a policy to ensure that each type of truck is deployed at least once.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. Each type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n\nThe company has a total budget of $150,000 for operational costs for the month. The company has a limit of 100 trucks that can be deployed in total. Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10. The company wants to ensure that at least 20% of the total trucks are TruckE. The company also has a policy to ensure that each type of truck is deployed at least once.\n\nPlease help the company to maximize the total daily net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\nmodel.addCons(TruckC <= TruckA + 10)\n## The company wants to ensure that at least 20% of the total trucks are TruckE.\nmodel.addCons(TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The decision involves determining the number of solar panels to install in each district.\n// {\"number of solar panels in district A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent.\n// Energy production: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\n// Total cost: Cost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n// So, the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / (1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000",
        "question": "A city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The decision involves determining the number of solar panels to install in each district. The efficiency of solar panels and the cost per panel in each district are given in the following Table.\n\n| District | Efficiency | Cost per Panel |\n|----------|------------|----------------|\n| A        | 0.8        | $1000          |\n| B        | 0.9        | $1200          |\n| C        | 1.0        | $1500          |\n| D        | 0.7        | $900           |\n| E        | 0.6        | $800           |\n\nThe city has a budget of $500,000 for the installation of solar panels. The city aims to maximize the energy production per dollar spent. Please help the city determine the optimal number of solar panels to install in each district.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels in district A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels in district B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels in district C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels in district D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels in district E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\nCost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n## the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in District A: \", model.getVal(A))\n    print(\"Number of Solar Panels in District B: \", model.getVal(B))\n    print(\"Number of Solar Panels in District C: \", model.getVal(C))\n    print(\"Number of Solar Panels in District D: \", model.getVal(D))\n    print(\"Number of Solar Panels in District E: \", model.getVal(E))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product A\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product B\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product C\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkersA * 100\n// Profit_B = UnitsB * 70 - WorkersB * 120\n// Profit_C = UnitsC * 60 - WorkersC * 110\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line. The profit per unit and labor cost per worker per day for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker per Day |\n|---------|-----------------|-------------------------------|\n| A       | $50             | $100                          |\n| B       | $70             | $120                          |\n| C       | $60             | $110                          |\n\nThe company has a total of 50 workers available. The company wants to maximize the total daily profit. Please help the company determine the optimal number of units to produce for each product and the number of workers to assign to each product line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for product A\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for product B\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkersA * 100\nProfit_B = UnitsB * 70 - WorkersB * 120\nProfit_C = UnitsC * 60 - WorkersC * 110\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Workers for Product A: \", model.getVal(WorkersA))\n    print(\"Number of Workers for Product B: \", model.getVal(WorkersB))\n    print(\"Number of Workers for Product C: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\n// Total profit for ProductB: ProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $30,000.\n// MarketingA + MarketingB + MarketingC <= 30000\n\n## Generate Constraint-3:\nDue to production capacity, the total number of units produced cannot exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\n// UnitsA >= 200; UnitsB >= 300\n\n## Generate Constraint-5:\nThe company has a limited workforce that can handle a maximum of 500 units of production.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume. The production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n\n| Product | Initial Production Cost per Unit | Sales Price per Unit |\n|---------|----------------------------------|----------------------|\n| ProductA | $100                             | $200                 |\n| ProductB | $120                             | $220                 |\n| ProductC | $150                             | $250                 |\n\nThe total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $30,000. Due to production capacity, the total number of units produced cannot exceed 1000. The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced. The company has a limited workforce that can handle a maximum of 500 units of production.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $30,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 30000)\n# Due to production capacity, the total number of units produced cannot exceed 1000.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\nmodel.addCons(UnitsA >= 200)\nmodel.addCons(UnitsB >= 300)\n# The company has a limited workforce that can handle a maximum of 500 units of production.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1783,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * Q1 = 20 * Q1\n// Profit_P2 = (40 - 20) * Q2 = 20 * Q2\n// Profit_P3 = (50 - 30) * Q3 = 20 * Q3\n// The objective function is: Maximize (20 * Q1 + 20 * Q2 + 20 * Q3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units.\n// Q1 <= 100\n// Q2 <= 150\n// Q3 <= 200\n\n## Generate Constraint-3:\nThe company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\n// Q1 >= 50\n// Q2 >= 75\n\n## Generate Constraint-4:\nThe market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units.\n// If Q3 <= 100, Profit_P3 = 20 * Q3\n// If Q3 > 100, Profit_P3 = 20 * Q3 * (1 - 0.1 * (Q3 - 100) / 50)",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $20, and P3 is $30. The company has a limited budget of $5000 for production costs. The production capacity for each product is limited: the maximum production capacity for P1 is 100 units, for P2 is 150 units, and for P3 is 200 units. The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced. The market demand for P3 is highly elastic, and the company believes that the profit from P3 is a nonlinear function of the quantity produced. Specifically, the profit per unit decreases by 10% for every 50 units produced beyond the first 100 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * Q1\nProfit_P2 = 20 * Q2\n## handle nonlinear profit for P3\nQ3_1 = model.addVar(vtype=\"INTEGER\", name=\"Q3_1\", lb=0, ub=100)\nQ3_2 = model.addVar(vtype=\"INTEGER\", name=\"Q3_2\", lb=0, ub=200)\nQ3_b1 = model.addVar(vtype=\"B\", name=\"Q3_b1\")\nQ3_b2 = model.addVar(vtype=\"B\", name=\"Q3_b2\")\nmodel.addCons(Q3_b1 + Q3_b2 == 1)\nmodel.addCons(Q3 == Q3_1*Q3_b1 + Q3_2*Q3_b2)\nProfit_P3 = 20 * Q3_1 * Q3_b1 + 20 * Q3_2 * (1 - 0.1 * (Q3_2 - 100) / 50) * Q3_b2\n## the objective function is: Maximize (20 * Q1 + 20 * Q2 + Profit_P3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * Q1 + 20 * Q2 + 30 * Q3 <= 5000)\n## The production capacity for each product is limited.\nmodel.addCons(Q1 <= 100)\nmodel.addCons(Q2 <= 150)\nmodel.addCons(Q3 <= 200)\n## The company has a contract that requires at least 50 units of P1 and 75 units of P2 to be produced.\nmodel.addCons(Q1 >= 50)\nmodel.addCons(Q2 >= 75)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"units of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"units of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"units of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for B is $70, for C is $60, for D is $80, and for E is $90. The company wants to maximize the total profit from all products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 hours. Producing one unit of A requires 2 hours, B requires 3 hours, C requires 2.5 hours, D requires 4 hours, and E requires 3.5 hours.\n// 2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500\n\n## Generate Constraint-2:\nThe market demand for each product is limited. The maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100.\n// A <= 200\n// B <= 300\n// C <= 250\n// D <= 150\n// E <= 100",
        "question": "A company is planning to optimize its production of five different products (A, B, C, D, E) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit for each product and the production time required for each unit are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 2.5 hours                |\n| D       | $80             | 4 hours                  |\n| E       | $90             | 3.5 hours                |\n\nThe company has a total production capacity of 1500 hours. The market demand for each product is limited. The maximum number of units that can be sold for A is 200, for B is 300, for C is 250, for D is 150, and for E is 100.\n\nPlease help the company to maximize the total profit from all products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # units of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # units of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=250) # units of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=150) # units of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=100) # units of product E produced\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 2.5 * C + 4 * D + 3.5 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Product A: \", model.getVal(A))\n    print(\"Units of Product B: \", model.getVal(B))\n    print(\"Units of Product C: \", model.getVal(C))\n    print(\"Units of Product D: \", model.getVal(D))\n    print(\"Units of Product E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for E1 is $30,000, with a production cost per unit of $20,000 and a carbon footprint per unit of 100 kg CO2. \nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the carbon footprint per unit is 150 kg CO2. \nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the carbon footprint per unit is 200 kg CO2.\nThe manufacturer aims to maximize the net revenue per unit of carbon footprint.\n// Profit_E1 = (30000 * E1 - 20000 * E1) / 100\n// Profit_E2 = (40000 * E2 - 25000 * E2) / 150\n// Profit_E3 = (50000 * E3 - 30000 * E3) / 200\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50\n\n## Generate Constraint-2:\nThe total carbon footprint allowed for all vehicles is 8000 kg CO2.\n// 100 * E1 + 150 * E2 + 200 * E3 <= 8000",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and carbon footprint per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Carbon Footprint per Unit |\n|--------------|------------------|--------------------------|---------------------------|\n| E1           | $30,000          | $20,000                  | 100 kg CO2                |\n| E2           | $40,000          | $25,000                  | 150 kg CO2                |\n| E3           | $50,000          | $30,000                  | 200 kg CO2                |\n\nThe manufacturer has a total production capacity of 50 vehicles. The total carbon footprint allowed for all vehicles is 8000 kg CO2. \n\nPlease help the manufacturer to maximize the net revenue per unit of carbon footprint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30000 * E1 - 20000 * E1) / 100\nProfit_E2 = (40000 * E2 - 25000 * E2) / 150\nProfit_E3 = (50000 * E3 - 30000 * E3) / 200\n## convert the division to multiplication\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a total production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n## The total carbon footprint allowed for all vehicles is 8000 kg CO2.\nmodel.addCons(100 * E1 + 150 * E2 + 200 * E3 <= 8000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Unit of Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for furniture\": \"FurnitureSpeed\", \"range\": \"FurnitureSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Furniture = FurnitureTrucks * FurnitureSpeed^2\n// Fuel_Perishables = PerishablesTrucks * PerishablesSpeed^2\n// Time_Electronics = ElectronicsTrucks / ElectronicsSpeed\n// Time_Furniture = FurnitureTrucks / FurnitureSpeed\n// Time_Perishables = PerishablesTrucks / PerishablesSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 hours available for all trucks to be on the road per day.\n// Time_Electronics + Time_Furniture + Time_Perishables <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n\n| Type of Goods | Number of Trucks | Average Speed |\n|---------------|-----------------|---------------|\n| Electronics   | ElectronicsTrucks | ElectronicsSpeed |\n| Furniture     | FurnitureTrucks | FurnitureSpeed |\n| Perishables   | PerishablesTrucks | PerishablesSpeed |\n\nThe company has a total budget of $10,000 for fuel costs per day. The company has a maximum of 50 hours available for all trucks to be on the road per day.\n\nPlease help the company to minimize the total fuel consumption and time spent on the road, considering the nonlinear relationship between fuel consumption and speed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nFurnitureSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FurnitureSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Furniture = FurnitureTrucks * FurnitureSpeed**2\nFuel_Perishables = PerishablesTrucks * PerishablesSpeed**2\nTime_Electronics = ElectronicsTrucks / ElectronicsSpeed\nTime_Furniture = FurnitureTrucks / FurnitureSpeed\nTime_Perishables = PerishablesTrucks / PerishablesSpeed\n## the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\nmodel.addCons(obj == Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000)\n## The company has a maximum of 50 hours available for all trucks to be on the road per day.\nmodel.addCons(Time_Electronics + Time_Furniture + Time_Perishables <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Furniture: \", model.getVal(FurnitureSpeed))\n    print(\"Average Speed of Trucks for Perishables: \", model.getVal(PerishablesSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and the revenue generated per Truck is $150 per day. The operational cost per Van is $70 per day, and the revenue generated per Van is $120 per day. The operational cost per Bike is $30 per day, and the revenue generated per Bike is $60 per day. The company wants to maximize the total daily profit from all vehicles.\n// Profit_Trucks = (150 - 100) * Trucks\n// Profit_Vans = (120 - 70) * Vans\n// Profit_Bikes = (60 - 30) * Bikes\n// So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n## Generate Constraint-1:\nThe company has a limited budget for vehicle maintenance, which is $2000 per day. The maintenance cost per Truck is $150, per Van is $100, and per Bike is $50.\n// 150 * Trucks + 100 * Vans + 50 * Bikes <= 2000\n\n## Generate Constraint-2:\nThe company has a limited number of parking spaces, which is 20. Each Truck requires 3 spaces, each Van requires 2 spaces, and each Bike requires 1 space.\n// 3 * Trucks + 2 * Vans + 1 * Bikes <= 20\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. Each Truck emits 50 units, each Van emits 30 units, and each Bike emits 10 units.\n// 50 * Trucks + 30 * Vans + 10 * Bikes <= 500\n\n## Generate Constraint-4:\nThe company has a contract that requires at least 5 Trucks to be operational.\n// Trucks >= 5\n\n## Generate Constraint-5:\nThe company aims to have at least twice as many Vans as Trucks.\n// Vans >= 2 * Trucks",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs. The operational cost, revenue, maintenance cost, parking space requirement, and emission rate for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Revenue per Day | Maintenance Cost per Day | Parking Spaces Required | Emission Units per Day |\n|--------------|--------------------------|-----------------|--------------------------|-------------------------|-----------------------|\n| Trucks       | $100                     | $150            | $150                     | 3                       | 50                    |\n| Vans         | $70                      | $120            | $100                     | 2                       | 30                    |\n| Bikes        | $30                      | $60             | $50                      | 1                       | 10                    |\n\nThe company has a limited budget for vehicle maintenance, which is $2000 per day. The company has a limited number of parking spaces, which is 20. Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. The company has a contract that requires at least 5 Trucks to be operational. The company aims to have at least twice as many Vans as Trucks.\n\nPlease help the company to maximize the total daily profit from all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=5)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nProfit_Trucks = (150 - 100) * Trucks\nProfit_Vans = (120 - 70) * Vans\nProfit_Bikes = (60 - 30) * Bikes\n# So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n# Add constraints\n# The company has a limited budget for vehicle maintenance, which is $2000 per day.\nmodel.addCons(150 * Trucks + 100 * Vans + 50 * Bikes <= 2000)\n# The company has a limited number of parking spaces, which is 20.\nmodel.addCons(3 * Trucks + 2 * Vans + 1 * Bikes <= 20)\n# Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day.\nmodel.addCons(50 * Trucks + 30 * Vans + 10 * Bikes <= 500)\n# The company has a contract that requires at least 5 Trucks to be operational.\nmodel.addCons(Trucks >= 5)\n# The company aims to have at least twice as many Vans as Trucks.\nmodel.addCons(Vans >= 2 * Trucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1576,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance and upgrades.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck maintenance and upgrades\": \"TruckInvestment\", \"range\": \"TruckInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van maintenance and upgrades\": \"VanInvestment\", \"range\": \"VanInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike maintenance and upgrades\": \"BikeInvestment\", \"range\": \"BikeInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company's profit from each vehicle type is affected by the investment in maintenance and upgrades. The profit from Trucks increases by $100 per Truck for every $1000 invested in maintenance and upgrades. The profit from Vans increases by $75 per Van for every $1000 invested. The profit from Bikes increases by $50 per Bike for every $1000 invested. The company aims to maximize the total annual profit from all vehicles.\n// Total profit from Trucks: ProfitTrucks = (1000 + 0.1 * TruckInvestment) * Trucks\n// Total profit from Vans: ProfitVans = (800 + 0.075 * VanInvestment) * Vans\n// Total profit from Bikes: ProfitBikes = (500 + 0.05 * BikeInvestment) * Bikes\n// So, the objective function is: Maximize (ProfitTrucks + ProfitVans + ProfitBikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and maintenance investments.\n// Trucks + Vans + Bikes + TruckInvestment + VanInvestment + BikeInvestment <= 100000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance and upgrades. The company's profit from each vehicle type is affected by the investment in maintenance and upgrades. The profit from Trucks increases by $100 per Truck for every $1000 invested in maintenance and upgrades. The profit from Vans increases by $75 per Van for every $1000 invested. The profit from Bikes increases by $50 per Bike for every $1000 invested. The company aims to maximize the total annual profit from all vehicles. The company has a budget of $100,000 for vehicle purchases and maintenance investments. Please help the company determine the optimal number of each type of vehicle to purchase and the amount to invest in maintenance and upgrades to maximize their total annual profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTruckInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckInvestment\", lb=0)  # investment in Truck maintenance and upgrades\nVanInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"VanInvestment\", lb=0)  # investment in Van maintenance and upgrades\nBikeInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeInvestment\", lb=0)  # investment in Bike maintenance and upgrades\n\n# Define objective function\nProfitTrucks = (1000 + 0.1 * TruckInvestment) * Trucks\nProfitVans = (800 + 0.075 * VanInvestment) * Vans\nProfitBikes = (500 + 0.05 * BikeInvestment) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitTrucks + ProfitVans + ProfitBikes)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes + TruckInvestment + VanInvestment + BikeInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Truck maintenance and upgrades: \", model.getVal(TruckInvestment))\n    print(\"Investment in Van maintenance and upgrades: \", model.getVal(VanInvestment))\n    print(\"Investment in Bike maintenance and upgrades: \", model.getVal(BikeInvestment))\n    print(\"Maximized Total Annual Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce next month. Additionally, the company must determine the number of hours to allocate for production and maintenance for each machine type.\n// {\"number of units of MachineA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production hours for MachineA\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production hours for MachineB\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production hours for MachineC\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for MachineC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The production cost per hour for MachineA is $50, MachineB is $60, and MachineC is $70. The maintenance cost per hour for MachineA is $30, MachineB is $40, and MachineC is $50. The company aims to maximize the total profit minus the total production and maintenance costs.\n// Profit from MachineA: Profit_A = 500 * A - (50 * PA + 30 * MA)\n// Profit from MachineB: Profit_B = 700 * B - (60 * PB + 40 * MB)\n// Profit from MachineC: Profit_C = 900 * C - (70 * PC + 50 * MC)\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 500 production hours available for the month.\n// PA + PB + PC <= 500\n\n## Generate Constraint-2:\nThe company has a total of 200 maintenance hours available for the month.\n// MA + MB + MC <= 200\n\n## Generate Constraint-3:\nEach machine requires a minimum of 10 production hours per unit produced.\n// PA >= 10 * A; PB >= 10 * B; PC >= 10 * C\n\n## Generate Constraint-4:\nEach machine requires a minimum of 5 maintenance hours per unit produced.\n// MA >= 5 * A; MB >= 5 * B; MC >= 5 * C",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce next month and also determine the number of hours to allocate for production and maintenance for each machine type. The profit per unit, production cost per hour, and maintenance cost per hour for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost per Hour | Maintenance Cost per Hour |\n|---------|-----------------|--------------------------|---------------------------|\n| MachineA | $500           | $50                      | $30                       |\n| MachineB | $700           | $60                      | $40                       |\n| MachineC | $900           | $70                      | $50                       |\n\nThe company has a total of 500 production hours and 200 maintenance hours available for the month. Each machine requires a minimum of 10 production hours per unit produced and a minimum of 5 maintenance hours per unit produced. The company aims to maximize the total profit minus the total production and maintenance costs.\n\nPlease help the company determine the optimal number of units to produce for each machine type and the corresponding hours to allocate for production and maintenance to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of MachineA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of MachineB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of MachineC\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # production hours for MachineA\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # production hours for MachineB\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # production hours for MachineC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # maintenance hours for MachineA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # maintenance hours for MachineB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # maintenance hours for MachineC\n\n# Define objective function\nProfit_A = 500 * A - (50 * PA + 30 * MA)\nProfit_B = 700 * B - (60 * PB + 40 * MB)\nProfit_C = 900 * C - (70 * PC + 50 * MC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 500 production hours available for the month.\nmodel.addCons(PA + PB + PC <= 500)\n# The company has a total of 200 maintenance hours available for the month.\nmodel.addCons(MA + MB + MC <= 200)\n# Each machine requires a minimum of 10 production hours per unit produced.\nmodel.addCons(PA >= 10 * A)\nmodel.addCons(PB >= 10 * B)\nmodel.addCons(PC >= 10 * C)\n# Each machine requires a minimum of 5 maintenance hours per unit produced.\nmodel.addCons(MA >= 5 * A)\nmodel.addCons(MB >= 5 * B)\nmodel.addCons(MC >= 5 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(A))\n    print(\"Number of MachineB: \", model.getVal(B))\n    print(\"Number of MachineC: \", model.getVal(C))\n    print(\"Production Hours for MachineA: \", model.getVal(PA))\n    print(\"Production Hours for MachineB: \", model.getVal(PB))\n    print(\"Production Hours for MachineC: \", model.getVal(PC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1353,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce and the number of workers dedicated to each production line to optimize their profit while considering various constraints such as labor availability, production capacity, and material costs.\n// {\"number of smartphones\": \"SmartphoneUnits\", \"range\": \"SmartphoneUnits >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"TabletUnits\", \"range\": \"TabletUnits >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"LaptopUnits\", \"range\": \"LaptopUnits >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones\": \"SmartphoneWorkers\", \"range\": \"SmartphoneWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets\": \"TabletWorkers\", \"range\": \"TabletWorkers >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops\": \"LaptopWorkers\", \"range\": \"LaptopWorkers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 3 laptops. The company aims to maximize the total daily profit.\n// Profit_Smartphones = 10 * SmartphoneWorkers * 100 * SmartphoneUnits\n// Profit_Tablets = 5 * TabletWorkers * 150 * TabletUnits\n// Profit_Laptops = 3 * LaptopWorkers * 200 * LaptopUnits\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// SmartphoneWorkers + TabletWorkers + LaptopWorkers <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for material costs per day.\n// 50 * SmartphoneUnits + 75 * TabletUnits + 100 * LaptopUnits <= 3000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce and the number of workers dedicated to each production line to optimize their profit while considering various constraints such as labor availability, production capacity, and material costs.\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 3 laptops. The company aims to maximize the total daily profit.\nThe company has a total of 50 workers available. The company also has a budget of $3000 for material costs per day.\nPlease help the company determine the optimal number of smartphones, tablets, laptops, and workers for each production line to maximize their total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphoneUnits = model.addVar(vtype=\"INTEGER\", name=\"SmartphoneUnits\", lb=0)\nTabletUnits = model.addVar(vtype=\"INTEGER\", name=\"TabletUnits\", lb=0)\nLaptopUnits = model.addVar(vtype=\"INTEGER\", name=\"LaptopUnits\", lb=0)\nSmartphoneWorkers = model.addVar(vtype=\"INTEGER\", name=\"SmartphoneWorkers\", lb=0)\nTabletWorkers = model.addVar(vtype=\"INTEGER\", name=\"TabletWorkers\", lb=0)\nLaptopWorkers = model.addVar(vtype=\"INTEGER\", name=\"LaptopWorkers\", lb=0)\n\n# Define objective function\nProfit_Smartphones = 10 * SmartphoneWorkers * 100 * SmartphoneUnits\nProfit_Tablets = 5 * TabletWorkers * 150 * TabletUnits\nProfit_Laptops = 3 * LaptopWorkers * 200 * LaptopUnits\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\nmodel.addCons(SmartphoneWorkers + TabletWorkers + LaptopWorkers <= 50)\nmodel.addCons(50 * SmartphoneUnits + 75 * TabletUnits + 100 * LaptopUnits <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(SmartphoneUnits))\n    print(\"Number of Tablets: \", model.getVal(TabletUnits))\n    print(\"Number of Laptops: \", model.getVal(LaptopUnits))\n    print(\"Number of Workers for Smartphones: \", model.getVal(SmartphoneWorkers))\n    print(\"Number of Workers for Tablets: \", model.getVal(TabletWorkers))\n    print(\"Number of Workers for Laptops: \", model.getVal(LaptopWorkers))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company wants to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n// Delivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\n// Delivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\n// Delivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\n// Delivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\n// Delivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n// So, the objective function is: Maximize (Delivery_Efficiency_TruckA + Delivery_Efficiency_TruckB + Delivery_Efficiency_TruckC + Delivery_Efficiency_TruckD + Delivery_Efficiency_TruckE)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the month.\n// 5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10,000\n\n## Generate Constraint-2:\nThe company has a total operating budget of $30,000 for the month.\n// 2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30,000\n\n## Generate Constraint-3:\nThe company has a total fleet size of 500 trucks.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 500\n\n## Generate Constraint-4:\nDue to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\n// TruckA + TruckB <= 200\n\n## Generate Constraint-5:\nThe company must ensure that at least 50 trucks of each type are deployed to maintain service levels.\n// TruckA >= 50; TruckB >= 50; TruckC >= 50; TruckD >= 50; TruckE >= 50",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel efficiency, delivery capacity, and operating cost per km for each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Delivery Capacity (kg) | Operating Cost per km ($) |\n|------------|---------------------------|------------------------|---------------------------|\n| TruckA     | 5                         | 1000                   | 2                         |\n| TruckB     | 6                         | 1500                   | 2.5                       |\n| TruckC     | 7                         | 2000                   | 3                         |\n| TruckD     | 8                         | 2500                   | 3.5                       |\n| TruckE     | 9                         | 3000                   | 4                         |\n\nThe company has a total fuel budget of 10,000 liters for the month. The company has a total operating budget of $30,000 for the month. The company has a total fleet size of 500 trucks. Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks. The company must ensure that at least 50 trucks of each type are deployed to maintain service levels.\n\nPlease help the company to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=50)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=50)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=50)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=50)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=50)  # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDelivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\nDelivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\nDelivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\nDelivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\nDelivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE) == 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 2500 * TruckD + 3000 * TruckE)\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the month.\nmodel.addCons(5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10000)\n## The company has a total operating budget of $30,000 for the month.\nmodel.addCons(2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30000)\n## The company has a total fleet size of 500 trucks.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 500)\n## Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\nmodel.addCons(TruckA + TruckB <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1512,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"investment per Small wind farm\": \"InvestmentSmall\", \"range\": \"InvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment per Medium wind farm\": \"InvestmentMedium\", \"range\": \"InvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment per Large wind farm\": \"InvestmentLarge\", \"range\": \"InvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n// EnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\n// EnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\n// EnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\n// OperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for investment in all wind farms.\n// InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10,000,000\n\n## Generate Constraint-2:\nThe total number of wind farms cannot exceed 100.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 100\n\n## Generate Constraint-3:\nDue to environmental regulations, the number of Large wind farms must not exceed half the number of Medium wind farms.\n// LargeWindFarms <= 0.5 * MediumWindFarms\n\n## Generate Constraint-4:\nThe minimum energy output requirement is 10,000 MWh.\n// EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge >= 10,000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of investment in each to optimize energy output and cost efficiency. The investment affects the energy output and operational costs of each type of wind farm. The energy output of each wind farm type is a nonlinear function of the investment per farm. For Small wind farms, the energy output increases by 10 MWh for every $100,000 invested. For Medium wind farms, the energy output increases by 15 MWh for every $100,000 invested. For Large wind farms, the energy output increases by 20 MWh for every $100,000 invested. The operational cost per MWh decreases with increased investment. The company aims to maximize the net energy output (energy output - operational cost) across all wind farms.\n\nThe company has a total budget of $10 million for investment in all wind farms. The total number of wind farms cannot exceed 100. Due to environmental regulations, the number of Large wind farms must not exceed half the number of Medium wind farms. The minimum energy output requirement is 10,000 MWh.\n\nPlease help the company to determine the optimal number of each type of wind farm and the investment per farm to maximize the net energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSmall\", lb=0)\nInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentMedium\", lb=0)\nInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentLarge\", lb=0)\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallWindFarms * (1 + 0.0001 * InvestmentSmall)\nEnergyOutputMedium = 150 * MediumWindFarms * (1 + 0.00015 * InvestmentMedium)\nEnergyOutputLarge = 200 * LargeWindFarms * (1 + 0.0002 * InvestmentLarge)\nOperationalCost = 0.5 * (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(InvestmentSmall * SmallWindFarms + InvestmentMedium * MediumWindFarms + InvestmentLarge * LargeWindFarms <= 10000000)\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 100)\nmodel.addCons(LargeWindFarms <= 0.5 * MediumWindFarms)\nmodel.addCons(EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Investment per Small Wind Farm: \", model.getVal(InvestmentSmall))\n    print(\"Investment per Medium Wind Farm: \", model.getVal(InvestmentMedium))\n    print(\"Investment per Large Wind Farm: \", model.getVal(InvestmentLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. Each route has a specific distance that must be covered: Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\nPlease help the company to determine the optimal number of trucks and fuel allocation for each route to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for Route1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for Route2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\n// Total profit for ProductB: ProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $30,000.\n// MarketingA + MarketingB + MarketingC <= 30000\n\n## Generate Constraint-3:\nDue to production capacity, the total number of units produced cannot exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\n// UnitsA >= 200; UnitsB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process, which affects the production cost per unit. The level of automation is measured by the investment in automation technology, which reduces the production cost per unit linearly. The company also needs to determine the marketing budget for each product, which affects the sales volume.\nThe production cost per unit decreases by $5 for every $1000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $200 for ProductA, $220 for ProductB, and $250 for ProductC. The sales volume increases by 10 units for every $1000 spent on marketing for that product. The company aims to maximize the total profit from all products.\nThe total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $30,000. Due to production capacity, the total number of units produced cannot exceed 1000. The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 0.005 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 0.005 * AutomationC)) * UnitsC - MarketingC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $30,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 30000)\n# Due to production capacity, the total number of units produced cannot exceed 1000.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\nmodel.addCons(UnitsA >= 200)\nmodel.addCons(UnitsB >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements.\n// {\"number of P1 packages\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 packages\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 packages\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of P4 packages\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"number of P5 packages\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each package type varies based on weight and volume. P1 weighs 5 kg and has a volume of 0.1 m\u00b3, P2 weighs 10 kg and has a volume of 0.2 m\u00b3, P3 weighs 15 kg and has a volume of 0.3 m\u00b3, P4 weighs 20 kg and has a volume of 0.4 m\u00b3, and P5 weighs 25 kg and has a volume of 0.5 m\u00b3. The transportation cost per kg is $0.5, and the cost per m\u00b3 is $1. The company wants to minimize the total transportation cost.\n// Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total weight of packages in each warehouse must not exceed 1000 kg.\n// 5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements. The weight and volume of each package type are given in the following Table.\n\n| Package Type | Weight (kg) | Volume (m\u00b3) |\n|--------------|-------------|-------------|\n| P1           | 5           | 0.1         |\n| P2           | 10          | 0.2         |\n| P3           | 15          | 0.3         |\n| P4           | 20          | 0.4         |\n| P5           | 25          | 0.5         |\n\nThe cost of transporting each package type varies based on weight and volume. The transportation cost per kg is $0.5, and the cost per m\u00b3 is $1. The company wants to minimize the total transportation cost. The total weight of packages in each warehouse must not exceed 1000 kg.\n\nPlease help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 packages\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 packages\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 packages\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of P4 packages\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # number of P5 packages\n\n# Define objective function\n## Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\nTotal_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Total_Cost\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total weight of packages in each warehouse must not exceed 1000 kg.\nmodel.addCons(5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 packages: \", model.getVal(P1))\n    print(\"Number of P2 packages: \", model.getVal(P2))\n    print(\"Number of P3 packages: \", model.getVal(P3))\n    print(\"Number of P4 packages: \", model.getVal(P4))\n    print(\"Number of P5 packages: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for each product is influenced by the production quantities of the other products due to market saturation effects. The profit functions for each product are as follows:\n\n- Profit for ProductA: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\n- Profit for ProductB: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\n- Profit for ProductC: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nThe company wants to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per month.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n// Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n// Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of all machines combined is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum daily production requirement of 200 units for component A.\n// A >= 200",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost. The total production capacity of all machines combined is 1000 units per day. The company has a minimum daily production requirement of 200 units for component A. Please help the company to determine the optimal number of units to produce for each component to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n## {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n## {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n## {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n## {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n## Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity of all machines combined is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 726,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\n// B >= 0.1 * (T + V + B)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed. The company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their total daily efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\nmodel.addCons(B >= 0.1 * (T + V + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Daily Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company aims to maximize the total carrying capacity while minimizing the total daily operational cost.\n// Objective function: Maximize (1000 * Trucks + 500 * Vans + 100 * Bikes) / (500 * Trucks + 300 * Vans + 100 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle operations.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 15000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 50,000 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 vehicles in total.\n// Trucks + Vans + Bikes <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company has a budget of $15,000 per month for vehicle operations. The total carrying capacity must be at least 50,000 kg. The company can only operate a maximum of 50 vehicles in total. Please help the company to maximize the total carrying capacity while minimizing the total daily operational cost, which is defined as the ratio of the total carrying capacity to the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCarryingCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes\nOperationalCost = 500 * Trucks + 300 * Vans + 100 * Bikes\n## the objective function is: Maximize (CarryingCapacity) / (OperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * OperationalCost == CarryingCapacity)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle operations.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 15000)\n## The total carrying capacity must be at least 50,000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000)\n## The company can only operate a maximum of 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Carrying Capacity per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost.\n// Total cargo capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n// Total maintenance cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck maintenance next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100,000\n\n## Generate Constraint-2:\nThe company must deploy at least 5 trucks of each type next month.\n// TruckA >= 5; TruckB >= 5; TruckC >= 5; TruckD >= 5; TruckE >= 5\n\n## Generate Constraint-3:\nThe total number of trucks deployed must not exceed 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-4:\nThe total cargo capacity must be at least 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1500",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. Each TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost. The company has a budget of $100,000 for truck maintenance next month. The company must deploy at least 5 trucks of each type next month. The total number of trucks deployed must not exceed 100. The total cargo capacity must be at least 1500 tons. Please help the company to maximize the objective function (Capacity - Cost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deploy at least 5 trucks of each type next month.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=5) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=5) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=5) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=5) # number of TruckE\n\n# Define objective function\n## Total cargo capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n## Total maintenance cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n## So, the objective function is: Maximize (Capacity - Cost)\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for truck maintenance next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100000)\n## The total number of trucks deployed must not exceed 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## The total cargo capacity must be at least 1500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Cargo Capacity - Maintenance Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the average fuel consumption per truck is 50 liters per day, the average revenue per truck is $1000 per day, and the maintenance cost per truck is $200 per day.\nFor RouteB, the average fuel consumption per truck is 60 liters per day, the average revenue per truck is $1200 per day, and the maintenance cost per truck is $250 per day.\nFor RouteC, the average fuel consumption per truck is 70 liters per day, the average revenue per truck is $1400 per day, and the maintenance cost per truck is $300 per day.\nFor RouteD, the average fuel consumption per truck is 80 liters per day, the average revenue per truck is $1600 per day, and the maintenance cost per truck is $350 per day.\nFor RouteE, the average fuel consumption per truck is 90 liters per day, the average revenue per truck is $1800 per day, and the maintenance cost per truck is $400 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for RouteA: Profit_A = (1000 - 200) * TrucksA - 50 * TrucksA\n// Total net profit for RouteB: Profit_B = (1200 - 250) * TrucksB - 60 * TrucksB\n// Total net profit for RouteC: Profit_C = (1400 - 300) * TrucksC - 70 * TrucksC\n// Total net profit for RouteD: Profit_D = (1600 - 350) * TrucksD - 80 * TrucksD\n// Total net profit for RouteE: Profit_E = (1800 - 400) * TrucksE - 90 * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for deployment.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is planning its fleet deployment for five different routes (RouteA, RouteB, RouteC, RouteD, and RouteE). They need to determine how many trucks to allocate to each route to optimize their operations. The average fuel consumption per truck, average revenue per truck, and maintenance cost per truck for each route are given in the following Table.\n\n| Route   | Fuel Consumption (liters/day) | Revenue (per day) | Maintenance Cost (per day) |\n|---------|-------------------------------|-------------------|----------------------------|\n| RouteA  | 50                            | $1000             | $200                       |\n| RouteB  | 60                            | $1200             | $250                       |\n| RouteC  | 70                            | $1400             | $300                       |\n| RouteD  | 80                            | $1600             | $350                       |\n| RouteE  | 90                            | $1800             | $400                       |\n\nThe company wants to maximize the net profit per liter of fuel consumed. The company has a total of 50 trucks available for deployment. Please help the company determine the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * TrucksA - 50 * TrucksA\nProfit_B = (1200 - 250) * TrucksB - 60 * TrucksB\nProfit_C = (1400 - 300) * TrucksC - 70 * TrucksC\nProfit_D = (1600 - 350) * TrucksD - 80 * TrucksD\nProfit_E = (1800 - 400) * TrucksE - 90 * TrucksE\nFuelConsumption = 50 * TrucksA + 60 * TrucksB + 70 * TrucksC + 80 * TrucksD + 90 * TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for deployment.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1245,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck consumes fuel based on the distance traveled and the load it carries. The fuel consumption rate for each region is different due to varying road conditions and distances.\nIn region 1, each truck consumes 5 liters per km.\nIn region 2, each truck consumes 7 liters per km.\nIn region 3, each truck consumes 9 liters per km.\nIn region 4, each truck consumes 11 liters per km.\nIn region 5, each truck consumes 13 liters per km.\nThe company aims to minimize the total fuel consumption while ensuring timely deliveries.\n// Fuel consumption in region 1: FC1 = 5 * T1\n// Fuel consumption in region 2: FC2 = 7 * T2\n// Fuel consumption in region 3: FC3 = 9 * T3\n// Fuel consumption in region 4: FC4 = 11 * T4\n// Fuel consumption in region 5: FC5 = 13 * T5\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs.\n// 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company must ensure that at least 10 trucks are allocated to each region.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10\n\n## Generate Constraint-3:\nThe total number of trucks available in the fleet is 60.\n// T1 + T2 + T3 + T4 + T5 <= 60",
        "question": "A logistics company operates a fleet of trucks to transport goods across five different regions. The company needs to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. The fuel consumption rate for each region is different due to varying road conditions and distances.\n\n| Region | Fuel Consumption Rate (liters per km) |\n|--------|--------------------------------------|\n| 1      | 5                                    |\n| 2      | 7                                    |\n| 3      | 9                                    |\n| 4      | 11                                   |\n| 5      | 13                                   |\n\nThe company has a total budget of $50,000 for fuel costs. The company must ensure that at least 10 trucks are allocated to each region. The total number of trucks available in the fleet is 60.\n\nPlease help the company to minimize the total fuel consumption while ensuring timely deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each region.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks in region 5\n\n# Define objective function\n## Fuel consumption in region 1: FC1 = 5 * T1\n## Fuel consumption in region 2: FC2 = 7 * T2\n## Fuel consumption in region 3: FC3 = 9 * T3\n## Fuel consumption in region 4: FC4 = 11 * T4\n## Fuel consumption in region 5: FC5 = 13 * T5\n## So, the objective function is: Minimize (FC1 + FC2 + FC3 + FC4 + FC5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs.\nmodel.addCons(5 * T1 + 7 * T2 + 9 * T3 + 11 * T4 + 13 * T5 <= 50000)\n## The total number of trucks available in the fleet is 60.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\n// {\"number of trucks on CityA to CityB route\": \"Trucks_AB\", \"range\": \"Trucks_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityA to CityC route\": \"Trucks_AC\", \"range\": \"Trucks_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityB to CityC route\": \"Trucks_BC\", \"range\": \"Trucks_BC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Total fuel consumption and operational costs for CityA to CityB: Cost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\n// Total fuel consumption and operational costs for CityA to CityC: Cost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\n// Total fuel consumption and operational costs for CityB to CityC: Cost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n// So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks_AB + Trucks_AC + Trucks_BC <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand. The fuel consumption and operational costs per truck per trip for each route are given in the following Table.\n\n| Route          | Fuel Consumption (liters) | Operational Cost ($) |\n|----------------|--------------------------|----------------------|\n| CityA to CityB | 500                      | 1000                 |\n| CityA to CityC | 600                      | 1200                 |\n| CityB to CityC | 450                      | 900                  |\n\nThe company has a total of 50 trucks available. Please help the company to minimize the total fuel consumption and operational costs by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_AB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AB\", lb=0) # number of trucks on CityA to CityB route\nTrucks_AC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AC\", lb=0) # number of trucks on CityA to CityC route\nTrucks_BC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_BC\", lb=0) # number of trucks on CityB to CityC route\n\n# Define objective function\nCost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\nCost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\nCost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n# So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_AB + Cost_AC + Cost_BC)\n\n# Add constraints\n# The total number of trucks available is 50.\nmodel.addCons(Trucks_AB + Trucks_AC + Trucks_BC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on CityA to CityB route: \", model.getVal(Trucks_AB))\n    print(\"Number of Trucks on CityA to CityC route: \", model.getVal(Trucks_AC))\n    print(\"Number of Trucks on CityB to CityC route: \", model.getVal(Trucks_BC))\n    print(\"Minimized Total Fuel Consumption and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000\n\n## Generate Constraint-2:\nThe total production of Component B must be at least 1500 units.\n// H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The company aims to minimize the total operational cost while meeting the demand for each component.\n\n| Facility | Cost per Hour (USD) | Production Rate per Hour for Component A | Production Rate per Hour for Component B | Production Rate per Hour for Component C |\n|----------|---------------------|------------------------------------------|------------------------------------------|------------------------------------------|\n| 1        | 100                | 5                                        | 10                                       | Not specified                           |\n| 2        | 150                | 10                                       | 15                                       | Not specified                           |\n| 3        | 200                | 15                                       | 20                                       | Not specified                           |\n| 4        | 250                | 20                                       | 25                                       | Not specified                           |\n\nThe total production of Component A must be at least 1000 units. The total production of Component B must be at least 1500 units. Please help the company to minimize the total operational cost while meeting these production requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0) # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0) # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0) # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0) # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0) # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0) # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0) # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0) # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0) # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0) # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0) # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0) # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000) # total production of Component A must be at least 1000 units\nmodel.addCons(H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500) # total production of Component B must be at least 1500 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 operates for Component A: \", model.getVal(H1A))\n    print(\"Hours Facility 1 operates for Component B: \", model.getVal(H1B))\n    print(\"Hours Facility 1 operates for Component C: \", model.getVal(H1C))\n    print(\"Hours Facility 2 operates for Component A: \", model.getVal(H2A))\n    print(\"Hours Facility 2 operates for Component B: \", model.getVal(H2B))\n    print(\"Hours Facility 2 operates for Component C: \", model.getVal(H2C))\n    print(\"Hours Facility 3 operates for Component A: \", model.getVal(H3A))\n    print(\"Hours Facility 3 operates for Component B: \", model.getVal(H3B))\n    print(\"Hours Facility 3 operates for Component C: \", model.getVal(H3C))\n    print(\"Hours Facility 4 operates for Component A: \", model.getVal(H4A))\n    print(\"Hours Facility 4 operates for Component B: \", model.getVal(H4B))\n    print(\"Hours Facility 4 operates for Component C: \", model.getVal(H4C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1719,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n// Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n// Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n// Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n// Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n// Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n// So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trucks of each type are deployed.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 100 drivers available for the upcoming month.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month. The capacity and fuel efficiency for each truck are given in the following Table.\n\n| Truck | Capacity (tons) | Fuel Efficiency (km/liter) |\n|-------|-----------------|----------------------------|\n| A     | 10              | 5                          |\n| B     | 15              | 7                          |\n| C     | 20              | 9                          |\n| D     | 25              | 11                         |\n| E     | 30              | 13                         |\n\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month. The company wants to ensure that at least 5 trucks of each type are deployed. The company has a total of 100 drivers available for the upcoming month. The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C. The company also wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n\nPlease help the company to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks E\n\n# Define objective function\n## Ton-kilometers per liter for each truck type\nTkm_A = 10 * 5 * A\nTkm_B = 15 * 7 * B\nTkm_C = 20 * 9 * C\nTkm_D = 25 * 11 * D\nTkm_E = 30 * 13 * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\nmodel.addCons(obj == Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing fuel for the upcoming month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50000)\n## The company has a total of 100 drivers available for the upcoming month.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Ton-kilometers per liter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1394,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades. The maintenance cost is linearly proportional to the number of trucks.\n// Fuel cost for Route1: FuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\n// Fuel cost for Route2: FuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\n// Fuel cost for Route3: FuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\n// Fuel cost for Route4: FuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\n// Fuel cost for Route5: FuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\n// Maintenance cost: MaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nAt least 10 trucks must be assigned to Route1 and Route2 combined.\n// Trucks1 + Trucks2 >= 10\n\n## Generate Constraint-4:\nThe fuel efficiency upgrade for any route cannot exceed 30%.\n// Upgrade1 <= 30; Upgrade2 <= 30; Upgrade3 <= 30; Upgrade4 <= 30; Upgrade5 <= 30\n\n## Generate Constraint-5:\nThe total operational cost must not exceed $200,000.\n// (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost) <= 200000",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades. The maintenance cost is linearly proportional to the number of trucks. The company has a budget of $100,000 for fuel efficiency upgrades. The total number of trucks available is limited to 50. At least 10 trucks must be assigned to Route1 and Route2 combined. The fuel efficiency upgrade for any route cannot exceed 30%. The total operational cost must not exceed $200,000.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Route5\n\n# Define objective function\nFuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\nFuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\nFuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\nFuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\nFuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\nMaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)  # budget for upgrades\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)  # total trucks\nmodel.addCons(Trucks1 + Trucks2 >= 10)  # at least 10 trucks for Route1 and Route2\nmodel.addCons(Upgrade1 <= 30)  # upgrade limit for Route1\nmodel.addCons(Upgrade2 <= 30)  # upgrade limit for Route2\nmodel.addCons(Upgrade3 <= 30)  # upgrade limit for Route3\nmodel.addCons(Upgrade4 <= 30)  # upgrade limit for Route4\nmodel.addCons(Upgrade5 <= 30)  # upgrade limit for Route5\nmodel.addCons(obj <= 200000)  # total operational cost limit\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck type, and the average speed of each truck type. The goal is to minimize the total fuel consumption while ensuring timely deliveries.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region A\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region B\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region C\": \"FuelEffC\", \"range\": \"FuelEffC > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for Region C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions, considering the distance traveled and the fuel efficiency of each truck type.\n// FuelConsumption_A = TrucksA * DistanceA / FuelEffA\n// FuelConsumption_B = TrucksB * DistanceB / FuelEffB\n// FuelConsumption_C = TrucksC * DistanceC / FuelEffC\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// TrucksA * CostA + TrucksB * CostB + TrucksC * CostC <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of trucks to allocate to each region, the fuel efficiency of each truck type, and the average speed of each truck type. The goal is to minimize the total fuel consumption while ensuring timely deliveries. The following table provides the details of each truck type for each region.\n\n| Region | Number of Trucks | Fuel Efficiency | Average Speed |\n|--------|------------------|-----------------|---------------|\n| A      | TrucksA          | FuelEffA        | SpeedA        |\n| B      | TrucksB          | FuelEffB        | SpeedB        |\n| C      | TrucksC          | FuelEffC        | SpeedC        |\n\nThe company aims to minimize the total fuel consumption across all regions, considering the distance traveled and the fuel efficiency of each truck type. The company has a total budget of $100,000 for purchasing trucks. Please help the company to determine the optimal number of trucks for each region to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Region C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceA = 1000 # Assuming distance for Region A\nDistanceB = 1500 # Assuming distance for Region B\nDistanceC = 2000 # Assuming distance for Region C\nFuelEffA = 5 # Assuming fuel efficiency for Region A\nFuelEffB = 6 # Assuming fuel efficiency for Region B\nFuelEffC = 7 # Assuming fuel efficiency for Region C\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n## convert the division to multiplication\nmodel.addCons(obj == TrucksA * DistanceA * FuelEffA + TrucksB * DistanceB * FuelEffB + TrucksC * DistanceC * FuelEffC)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nCostA = 20000 # Assuming cost per truck for Region A\nCostB = 25000 # Assuming cost per truck for Region B\nCostC = 30000 # Assuming cost per truck for Region C\nmodel.addCons(TrucksA * CostA + TrucksB * CostB + TrucksC * CostC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials.\n// {\"labor hours on line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours on line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours.\n// Profit from device 1 on line 1: P1_L1 = 100 * (5 * L1 + 10 * M1)\n// Profit from device 1 on line 2: P1_L2 = 100 * (7 * L2 + 12 * M2)\n// Profit from device 2 on line 1: P2_L1 = 150 * (8 * L1 + 15 * M1)\n// Profit from device 2 on line 2: P2_L2 = 150 * (10 * L2 + 18 * M2)\n// Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L1 + L2 <= 1000",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials. The plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours. The total labor hours available are 1000 hours. Please help the plant to maximize its total profit from both devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0)  # labor hours on line 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # machine hours on line 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0)  # raw materials on line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0)  # labor hours on line 2\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0)  # machine hours on line 2\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0)  # raw materials on line 2\n\n# Define objective function\nP1_L1 = 100 * (5 * L1 + 10 * M1)  # Profit from device 1 on line 1\nP1_L2 = 100 * (7 * L2 + 12 * M2)  # Profit from device 1 on line 2\nP2_L1 = 150 * (8 * L1 + 15 * M1)  # Profit from device 2 on line 1\nP2_L2 = 150 * (10 * L2 + 18 * M2)  # Profit from device 2 on line 2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1_L1 + P1_L2 + P2_L1 + P2_L2)  # Objective function\n\n# Add constraints\nmodel.addCons(L1 + L2 <= 1000)  # Total labor hours available are 1000 hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours on line 1: \", model.getVal(L1))\n    print(\"Machine hours on line 1: \", model.getVal(M1))\n    print(\"Raw materials on line 1: \", model.getVal(R1))\n    print(\"Labor hours on line 2: \", model.getVal(L2))\n    print(\"Machine hours on line 2: \", model.getVal(M2))\n    print(\"Raw materials on line 2: \", model.getVal(R2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The decision variables include the number of trucks assigned to each route.\n// {\"number of trucks on Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different profit per truck, fuel cost per truck, and toll fee per truck. The company aims to maximize the total profit, which is the difference between the revenue and the total costs (fuel and tolls).\n// Profit_A = Revenue_A - (FuelCost_A + TollFee_A) * Trucks_A\n// Profit_B = Revenue_B - (FuelCost_B + TollFee_B) * Trucks_B\n// Profit_C = Revenue_C - (FuelCost_C + TollFee_C) * Trucks_C\n// Profit_D = Revenue_D - (FuelCost_D + TollFee_D) * Trucks_D\n// Profit_E = Revenue_E - (FuelCost_E + TollFee_E) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nThe total fuel cost across all routes must not exceed $10,000.\n// FuelCost_A * Trucks_A + FuelCost_B * Trucks_B + FuelCost_C * Trucks_C + FuelCost_D * Trucks_D + FuelCost_E * Trucks_E <= 10000\n\n## Generate Constraint-3:\nThe total toll fees across all routes must not exceed $5,000.\n// TollFee_A * Trucks_A + TollFee_B * Trucks_B + TollFee_C * Trucks_C + TollFee_D * Trucks_D + TollFee_E * Trucks_E <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the trucks are allocated to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n// Trucks_E <= Trucks_A + Trucks_B + Trucks_C",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The decision variables include the number of trucks assigned to each route. The profit per truck, fuel cost per truck, and toll fee per truck vary by route as shown in the following Table.\n\n| Route | Profit per Truck | Fuel Cost per Truck | Toll Fee per Truck |\n|-------|------------------|---------------------|--------------------|\n| A     | Revenue_A        | FuelCost_A          | TollFee_A          |\n| B     | Revenue_B        | FuelCost_B          | TollFee_B          |\n| C     | Revenue_C        | FuelCost_C          | TollFee_C          |\n| D     | Revenue_D        | FuelCost_D          | TollFee_D          |\n| E     | Revenue_E        | FuelCost_E          | TollFee_E          |\n\nThe company has a total of 50 trucks available. The total fuel cost across all routes must not exceed $10,000. The total toll fees across all routes must not exceed $5,000. The company wants to ensure that at least 10% of the trucks are allocated to Route A. The company also wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n\nPlease help the company to maximize the total profit, which is the difference between the revenue and the total costs (fuel and tolls).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks on Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks on Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks on Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0)  # number of trucks on Route D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0)  # number of trucks on Route E\n\n# Define objective function\nRevenue_A = 1200  # example values\nFuelCost_A = 200\nTollFee_A = 100\nRevenue_B = 1500\nFuelCost_B = 300\nTollFee_B = 150\nRevenue_C = 1800\nFuelCost_C = 400\nTollFee_C = 200\nRevenue_D = 2000\nFuelCost_D = 500\nTollFee_D = 250\nRevenue_E = 2200\nFuelCost_E = 600\nTollFee_E = 300\n\nProfit_A = Revenue_A - (FuelCost_A + TollFee_A) * Trucks_A\nProfit_B = Revenue_B - (FuelCost_B + TollFee_B) * Trucks_B\nProfit_C = Revenue_C - (FuelCost_C + TollFee_C) * Trucks_C\nProfit_D = Revenue_D - (FuelCost_D + TollFee_D) * Trucks_D\nProfit_E = Revenue_E - (FuelCost_E + TollFee_E) * Trucks_E\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\nmodel.addCons(FuelCost_A * Trucks_A + FuelCost_B * Trucks_B + FuelCost_C * Trucks_C + FuelCost_D * Trucks_D + FuelCost_E * Trucks_E <= 10000)\nmodel.addCons(TollFee_A * Trucks_A + TollFee_B * Trucks_B + TollFee_C * Trucks_C + TollFee_D * Trucks_D + TollFee_E * Trucks_E <= 5000)\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E))\nmodel.addCons(Trucks_E <= Trucks_A + Trucks_B + Trucks_C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks on Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks on Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks on Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks on Route E: \", model.getVal(Trucks_E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1492,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"HeavyMachineryTrucks\", \"range\": \"HeavyMachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general merchandise\": \"GeneralMerchandiseTrucks\", \"range\": \"GeneralMerchandiseTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per truck for perishable goods is $50,000 per year, and the revenue generated per truck is $100,000 per year.\nFor heavy machinery, the operational cost per truck is $70,000 per year, and the revenue generated per truck is $150,000 per year.\nFor general merchandise, the operational cost per truck is $60,000 per year, and the revenue generated per truck is $120,000 per year.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\n// TotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 50 trucks in total.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks <= 50\n\n## Generate Constraint-3:\nAt least 20% of the fleet must be dedicated to perishable goods.\n// PerishableTrucks >= 0.2 * (PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks)\n\n## Generate Constraint-4:\nNo more than 30 trucks can be allocated to heavy machinery due to market demand constraints.\n// HeavyMachineryTrucks <= 30\n\n## Generate Constraint-5:\nThe company aims to have at least 10 trucks for general merchandise to maintain existing contracts.\n// GeneralMerchandiseTrucks >= 10",
        "question": "A logistics company is planning its fleet for the next year and needs to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials. The operational cost per truck for perishable goods is $50,000 per year, and the revenue generated per truck is $100,000 per year. For heavy machinery, the operational cost per truck is $70,000 per year, and the revenue generated per truck is $150,000 per year. For general merchandise, the operational cost per truck is $60,000 per year, and the revenue generated per truck is $120,000 per year. The company wants to maximize the net profit, which is the total revenue minus the total operational costs. The company has a budget of $2,000,000 for purchasing trucks and can only operate a maximum of 50 trucks in total. At least 20% of the fleet must be dedicated to perishable goods, no more than 30 trucks can be allocated to heavy machinery due to market demand constraints, and the company aims to have at least 10 trucks for general merchandise to maintain existing contracts. Please help the company determine the optimal number of trucks for each type of cargo to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nHeavyMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks\", lb=0)\nGeneralMerchandiseTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralMerchandiseTrucks\", lb=0)\n\n# Define objective function\nTotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\nTotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000)\n# The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks <= 50)\n# At least 20% of the fleet must be dedicated to perishable goods.\nmodel.addCons(PerishableTrucks >= 0.2 * (PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks))\n# No more than 30 trucks can be allocated to heavy machinery due to market demand constraints.\nmodel.addCons(HeavyMachineryTrucks <= 30)\n# The company aims to have at least 10 trucks for general merchandise to maintain existing contracts.\nmodel.addCons(GeneralMerchandiseTrucks >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(HeavyMachineryTrucks))\n    print(\"Number of Trucks for General Merchandise: \", model.getVal(GeneralMerchandiseTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each capable of producing these components. The decision variables are the number of workers assigned to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 produces 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker produces 12 units of A, 18 units of B, and 22 units of C per hour. In production unit 3, each worker produces 14 units of A, 20 units of B, and 24 units of C per hour. In production unit 4, each worker produces 16 units of A, 22 units of B, and 26 units of C per hour. The company aims to maximize the total production of all components.\n// The production of component A: PA = 10 * W1 + 12 * W2 + 14 * W3 + 16 * W4\n// The production of component B: PB = 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4\n// The production of component C: PC = 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4\n// The objective function is: Maximize (PA + PB + PC)\n// Maximize (10 * W1 + 12 * W2 + 14 * W3 + 16 * W4 + 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4 + 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4)\n\n## Generate Constraint-1:\nThe total number of workers available across all production units is 100.\n// W1 + W2 + W3 + W4 <= 100\n\n## Generate Constraint-2:\nEach production unit can handle a maximum of 30 workers.\n// W1 <= 30; W2 <= 30; W3 <= 30; W4 <= 30\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C.\n// 10 * W1 + 12 * W2 + 14 * W3 + 16 * W4 >= 500 (for component A)\n// 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4 >= 600 (for component B)\n// 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4 >= 700 (for component C)",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each capable of producing these components. The decision variables are the number of workers assigned to each production unit. Each worker in production unit 1 produces 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker produces 12 units of A, 18 units of B, and 22 units of C per hour. In production unit 3, each worker produces 14 units of A, 20 units of B, and 24 units of C per hour. In production unit 4, each worker produces 16 units of A, 22 units of B, and 26 units of C per hour. The company aims to maximize the total production of all components. The total number of workers available across all production units is 100. Each production unit can handle a maximum of 30 workers. The company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C. Please help the company to maximize the total production of all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on production unit 4\n\n# Define objective function\nPA = 10 * W1 + 12 * W2 + 14 * W3 + 16 * W4 # production of component A\nPB = 15 * W1 + 18 * W2 + 20 * W3 + 22 * W4 # production of component B\nPC = 20 * W1 + 22 * W2 + 24 * W3 + 26 * W4 # production of component C\n# The objective function is: Maximize (PA + PB + PC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total number of workers available across all production units is 100.\nmodel.addCons(W1 + W2 + W3 + W4 <= 100)\n# Each production unit can handle a maximum of 30 workers.\nmodel.addCons(W1 <= 30)\nmodel.addCons(W2 <= 30)\nmodel.addCons(W3 <= 30)\nmodel.addCons(W4 <= 30)\n# The company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C.\nmodel.addCons(PA >= 500)\nmodel.addCons(PB >= 600)\nmodel.addCons(PC >= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production unit 1: \", model.getVal(W1))\n    print(\"Number of workers on production unit 2: \", model.getVal(W2))\n    print(\"Number of workers on production unit 3: \", model.getVal(W3))\n    print(\"Number of workers on production unit 4: \", model.getVal(W4))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to small trucks\": \"RoutesSmall\", \"range\": \"RoutesSmall >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to medium trucks\": \"RoutesMedium\", \"range\": \"RoutesMedium >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to large trucks\": \"RoutesLarge\", \"range\": \"RoutesLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company aims to minimize the total daily operational and fuel costs.\n// FuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\n// OperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n// So, the objective function is: Minimize (FuelCost + OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000\n\n## Generate Constraint-2:\nThe total number of routes available is 1000.\n// RoutesSmall + RoutesMedium + RoutesLarge <= 1000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs. The fuel consumption and operational costs for each type of truck are given in the following Table.\n\n| Vehicle Type | Fuel Consumption per Route | Operational Cost per Day |\n|--------------|---------------------------|--------------------------|\n| Small Trucks | 10 liters                 | $500                     |\n| Medium Trucks| 15 liters                 | $750                     |\n| Large Trucks | 20 liters                 | $1000                    |\n\nThe company has a total budget of $50,000 for purchasing new trucks. The total number of routes available is 1000. Please help the company to minimize the total daily operational and fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nRoutesSmall = model.addVar(vtype=\"INTEGER\", name=\"RoutesSmall\", lb=0)  # number of routes assigned to small trucks\nRoutesMedium = model.addVar(vtype=\"INTEGER\", name=\"RoutesMedium\", lb=0)  # number of routes assigned to medium trucks\nRoutesLarge = model.addVar(vtype=\"INTEGER\", name=\"RoutesLarge\", lb=0)  # number of routes assigned to large trucks\n\n# Define objective function\nFuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\nOperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n# So, the objective function is: Minimize (FuelCost + OperationalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + OperationalCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000)\n# The total number of routes available is 1000.\nmodel.addCons(RoutesSmall + RoutesMedium + RoutesLarge <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Routes Assigned to Small Trucks: \", model.getVal(RoutesSmall))\n    print(\"Number of Routes Assigned to Medium Trucks: \", model.getVal(RoutesMedium))\n    print(\"Number of Routes Assigned to Large Trucks: \", model.getVal(RoutesLarge))\n    print(\"Minimized Total Daily Operational and Fuel Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n// 5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50,000\n\n## Generate Constraint-4:\nTo maintain market presence, the company must produce at least 50 units of each product per month.\n// ProductAQty >= 50; ProductBQty >= 50; ProductCQty >= 50\n\n## Generate Constraint-5:\nDue to environmental regulations, the total production of all products must not exceed the company's carbon emission allowance, which is 800 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for each product is influenced by the production quantities of the other products due to market saturation effects. The profit functions for each product are as follows:\n\n- Profit for ProductA: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\n- Profit for ProductB: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\n- Profit for ProductC: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nThe company wants to maximize the total profit from all products. The following constraints apply:\n\n1. The total production capacity of the company is limited to 1000 units per month.\n2. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n3. The company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n4. To maintain market presence, the company must produce at least 50 units of each product per month.\n5. Due to environmental regulations, the total production of all products must not exceed the company's carbon emission allowance, which is 800 units per month.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=50)  # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=50)  # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=50)  # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)  # Total production capacity\nmodel.addCons(ProductBQty <= 2 * ProductAQty)  # ProductB production cannot exceed twice ProductA\nmodel.addCons(5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50000)  # Budget constraint\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 800)  # Carbon emission allowance\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1565,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks for Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region1: Fuel consumption per truck is 100 liters, and travel time is 5 hours.\n- Region2: Fuel consumption per truck is 120 liters, and travel time is 6 hours.\n- Region3: Fuel consumption per truck is 140 liters, and travel time is 7 hours.\n- Region4: Fuel consumption per truck is 160 liters, and travel time is 8 hours.\n- Region5: Fuel consumption per truck is 180 liters, and travel time is 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate).\n// Total_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\n// Total_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n// So, the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000\n\n## Generate Constraint-2:\nThe total travel time across all regions should not exceed 500 hours.\n// 5 * Truck1 + 6 * Truck2 + 7 * Truck3 + 8 * Truck4 + 9 * Truck5 <= 500",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each region are given in the following Table.\n\n| Region   | Fuel Consumption per Truck | Travel Time per Truck |\n|----------|---------------------------|----------------------|\n| Region1  | 100 liters                | 5 hours              |\n| Region2  | 120 liters                | 6 hours              |\n| Region3  | 140 liters                | 7 hours              |\n| Region4  | 160 liters                | 8 hours              |\n| Region5  | 180 liters                | 9 hours              |\n\nThe company has a total budget of $10,000 for fuel costs. The total travel time across all regions should not exceed 500 hours. Please help the company to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks for Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks for Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks for Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks for Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Price = 1  # Assuming fuel price per liter is $1 for simplicity\nHourly_Cost_Rate = 1  # Assuming hourly cost rate is $1 for simplicity\nTotal_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\nTotal_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n## the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\nmodel.addCons(obj == Total_Fuel_Cost + Total_Time_Cost)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000)\n## The total travel time across all regions should not exceed 500 hours.\nmodel.addCons(5 * Truck1 + 6 * Truck2 + 7 * Truck3 + 8 * Truck4 + 9 * Truck5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The production quantity for each product is a decision variable.\n// {\"production quantity for product A\": \"A_quantity\", \"range\": \"A_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B_quantity\", \"range\": \"B_quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C_quantity\", \"range\": \"C_quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = A_quantity * 50\n// Profit_B = B_quantity * 70\n// Profit_C = C_quantity * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A_quantity + B_quantity + C_quantity <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\n// A_quantity >= 30\n// B_quantity >= 20\n\n## Generate Constraint-3:\nThe company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B.\n// C_quantity <= 2 * (A_quantity + B_quantity)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit for each product is given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe total production capacity of the company is limited to 100 units per day. The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day. The company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B. Specifically, the production of product C cannot exceed twice the sum of the productions of products A and B.\n\nPlease help the company to maximize the total profit from the sales of all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_quantity = model.addVar(vtype=\"INTEGER\", name=\"A_quantity\", lb=0) # production quantity for product A\nB_quantity = model.addVar(vtype=\"INTEGER\", name=\"B_quantity\", lb=0) # production quantity for product B\nC_quantity = model.addVar(vtype=\"INTEGER\", name=\"C_quantity\", lb=0) # production quantity for product C\n\n# Define objective function\nProfit_A = A_quantity * 50\nProfit_B = B_quantity * 70\nProfit_C = C_quantity * 60\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A_quantity + B_quantity + C_quantity <= 100)\n# The market demand for product A is at least 30 units per day, and for product B is at least 20 units per day.\nmodel.addCons(A_quantity >= 30)\nmodel.addCons(B_quantity >= 20)\n# The company has a resource constraint such that the production of product C is limited by the sum of the productions of products A and B.\nmodel.addCons(C_quantity <= 2 * (A_quantity + B_quantity))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A_quantity))\n    print(\"Production Quantity for Product B: \", model.getVal(B_quantity))\n    print(\"Production Quantity for Product C: \", model.getVal(C_quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different production cost, selling price, and requires a specific amount of labor hours. The firm aims to maximize its profit rate, which is defined as the total profit divided by the total labor hours.\nFor Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours.\nFor Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours.\nFor Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours.\nFor Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours.\n// Profit of A: Profit_A = (30 - 20) * A\n// Profit of B: Profit_B = (35 - 25) * B\n// Profit of C: Profit_C = (40 - 30) * C\n// Profit of D: Profit_D = (45 - 35) * D\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (3 * A + 4 * B + 5 * C + 6 * D)\n\n## Generate Constraint-1:\nThe firm has a budget of $10,000 for production costs next month.\n// 20 * A + 25 * B + 30 * C + 35 * D <= 10000\n\n## Generate Constraint-2:\nThe firm wants to ensure that at least 50 units of each component are produced next month.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe firm has a maximum of 1500 labor hours available next month.\n// 3 * A + 4 * B + 5 * C + 6 * D <= 1500",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations. Each component has a different production cost, selling price, and requires a specific amount of labor hours. For Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours. For Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours. For Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours. For Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours. The firm aims to maximize its profit rate, which is defined as the total profit divided by the total labor hours. The firm has a budget of $10,000 for production costs next month. The firm wants to ensure that at least 50 units of each component are produced next month. The firm has a maximum of 1500 labor hours available next month. Please help the firm determine the optimal number of units to manufacture for each component to maximize its profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm wants to ensure that at least 50 units of each component are produced next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 20) * A\nProfit_B = (35 - 25) * B\nProfit_C = (40 - 30) * C\nProfit_D = (45 - 35) * D\nLaborHours = 3 * A + 4 * B + 5 * C + 6 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $10,000 for production costs next month.\nmodel.addCons(20 * A + 25 * B + 30 * C + 35 * D <= 10000)\n## The firm has a maximum of 1500 labor hours available next month.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device to optimize its profit. Additionally, the company must decide on the number of quality control checks to perform for each device type.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceA\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceB\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceC\": \"QC_C\", \"range\": \"QC_C >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceD\": \"QC_D\", \"range\": \"QC_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\nThe company aims to maximize the total profit per unit of production, considering both the production and quality control costs.\n// Profit of DeviceA: Profit_A = (100 - 60) * A - 5 * QC_A\n// Profit of DeviceB: Profit_B = (150 - 90) * B - 7 * QC_B\n// Profit of DeviceC: Profit_C = (200 - 120) * C - 9 * QC_C\n// Profit of DeviceD: Profit_D = (250 - 150) * D - 11 * QC_D\n// So, the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / (A + B + C + D))\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for quality control checks.\n// 5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10,000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 100 units of each device.\n// A <= 100; B <= 100; C <= 100; D <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is checked for quality.\n// QC_A >= 0.1 * A; QC_B >= 0.1 * B; QC_C >= 0.1 * C; QC_D >= 0.1 * D\n\n## Generate Constraint-4:\nThe company has a limited production capacity of 300 hours, with DeviceA requiring 2 hours per unit, DeviceB requiring 3 hours per unit, DeviceC requiring 4 hours per unit, and DeviceD requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 300",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device and the number of quality control checks to perform for each device type to optimize its profit. The selling price, production cost, and cost per quality control check for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Cost per Quality Control Check |\n|--------|---------------|-----------------|--------------------------------|\n| DeviceA | 100$ | 60$ | 5$ |\n| DeviceB | 150$ | 90$ | 7$ |\n| DeviceC | 200$ | 120$ | 9$ |\n| DeviceD | 250$ | 150$ | 11$ |\n\nThe company has a total budget of $10,000 for quality control checks. The company can produce a maximum of 100 units of each device. The company wants to ensure that at least 10% of each device's production is checked for quality. The company has a limited production capacity of 300 hours, with DeviceA requiring 2 hours per unit, DeviceB requiring 3 hours per unit, DeviceC requiring 4 hours per unit, and DeviceD requiring 5 hours per unit.\n\nPlease help the company to maximize the total profit per unit of production, considering both the production and quality control costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of DeviceD\nQC_A = model.addVar(vtype=\"INTEGER\", name=\"QC_A\", lb=0) # number of quality control checks for DeviceA\nQC_B = model.addVar(vtype=\"INTEGER\", name=\"QC_B\", lb=0) # number of quality control checks for DeviceB\nQC_C = model.addVar(vtype=\"INTEGER\", name=\"QC_C\", lb=0) # number of quality control checks for DeviceC\nQC_D = model.addVar(vtype=\"INTEGER\", name=\"QC_D\", lb=0) # number of quality control checks for DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * QC_A\nProfit_B = (150 - 90) * B - 7 * QC_B\nProfit_C = (200 - 120) * C - 9 * QC_C\nProfit_D = (250 - 150) * D - 11 * QC_D\nTotalProduction = A + B + C + D\n## the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / TotalProduction)\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for quality control checks.\nmodel.addCons(5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10000)\n## The company wants to ensure that at least 10% of each device's production is checked for quality.\nmodel.addCons(QC_A >= 0.1 * A)\nmodel.addCons(QC_B >= 0.1 * B)\nmodel.addCons(QC_C >= 0.1 * C)\nmodel.addCons(QC_D >= 0.1 * D)\n## The company has a limited production capacity of 300 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of QC checks for DeviceA: \", model.getVal(QC_A))\n    print(\"Number of QC checks for DeviceB: \", model.getVal(QC_B))\n    print(\"Number of QC checks for DeviceC: \", model.getVal(QC_C))\n    print(\"Number of QC checks for DeviceD: \", model.getVal(QC_D))\n    print(\"Maximized Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1257,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and delivery volume. Route A has a cost of $2 per mile and delivers 10 packages per mile. Route B has a cost of $3 per mile and delivers 15 packages per mile. Route C has a cost of $4 per mile and delivers 20 packages per mile. Route D has a cost of $5 per mile and delivers 25 packages per mile. Route E has a cost of $6 per mile and delivers 30 packages per mile. The company aims to minimize the total cost per package delivered across all routes.\n// Cost per package on route A: Cost_A = 2 * A / 10 * A\n// Cost per package on route B: Cost_B = 3 * B / 15 * B\n// Cost per package on route C: Cost_C = 4 * C / 20 * C\n// Cost per package on route D: Cost_D = 5 * D / 25 * D\n// Cost per package on route E: Cost_E = 6 * E / 30 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for all routes.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 1000\n\n## Generate Constraint-2:\nThe company must deliver at least 500 packages in total.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500\n\n## Generate Constraint-3:\nThe number of trucks allocated to any route must not exceed 20.\n// A <= 20; B <= 20; C <= 20; D <= 20; E <= 20\n\n## Generate Constraint-4:\nRoute A must have at least 5 trucks.\n// A >= 5\n\n## Generate Constraint-5:\nThe total number of trucks across all routes must not exceed 70.\n// A + B + C + D + E <= 70",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different cost per mile and delivery volume. Route A has a cost of $2 per mile and delivers 10 packages per mile. Route B has a cost of $3 per mile and delivers 15 packages per mile. Route C has a cost of $4 per mile and delivers 20 packages per mile. Route D has a cost of $5 per mile and delivers 25 packages per mile. Route E has a cost of $6 per mile and delivers 30 packages per mile. The company aims to minimize the total cost per package delivered across all routes. The company has a total budget of $1000 for all routes. The company must deliver at least 500 packages in total. The number of trucks allocated to any route must not exceed 20. Route A must have at least 5 trucks. The total number of trucks across all routes must not exceed 70. Please help the company to determine the optimal number of trucks to allocate to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5, ub=20) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=20) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=20) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=20) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=20) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * A / (10 * A)\nCost_B = 3 * B / (15 * B)\nCost_C = 4 * C / (20 * C)\nCost_D = 5 * D / (25 * D)\nCost_E = 6 * E / (30 * E)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $1000 for all routes.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 1000)\n## The company must deliver at least 500 packages in total.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500)\n## The number of trucks allocated to any route must not exceed 20.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 20)\nmodel.addCons(C <= 20)\nmodel.addCons(D <= 20)\nmodel.addCons(E <= 20)\n## Route A must have at least 5 trucks.\nmodel.addCons(A >= 5)\n## The total number of trucks across all routes must not exceed 70.\nmodel.addCons(A + B + C + D + E <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal systems\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels is 0.2 kWh per panel per day, with a cost of $1000 per panel and a lifespan of 20 years.\nThe efficiency of wind turbines is 0.3 kWh per turbine per day, with a cost of $2000 per turbine and a lifespan of 15 years.\nThe efficiency of hydroelectric plants is 0.4 kWh per plant per day, with a cost of $3000 per plant and a lifespan of 25 years.\nThe efficiency of geothermal systems is 0.25 kWh per system per day, with a cost of $2500 per system and a lifespan of 20 years.\nThe efficiency of biomass generators is 0.15 kWh per generator per day, with a cost of $1500 per generator and a lifespan of 10 years.\nThe city aims to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).\n// Daily energy production: Energy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\n// Investment cost: Cost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n// So, the objective function is: Maximize Energy / Cost\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of these systems.\n// 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000",
        "question": "A city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost.\nThe efficiency of solar panels is 0.2 kWh per panel per day, with a cost of $1000 per panel and a lifespan of 20 years.\nThe efficiency of wind turbines is 0.3 kWh per turbine per day, with a cost of $2000 per turbine and a lifespan of 15 years.\nThe efficiency of hydroelectric plants is 0.4 kWh per plant per day, with a cost of $3000 per plant and a lifespan of 25 years.\nThe efficiency of geothermal systems is 0.25 kWh per system per day, with a cost of $2500 per system and a lifespan of 20 years.\nThe efficiency of biomass generators is 0.15 kWh per generator per day, with a cost of $1500 per generator and a lifespan of 10 years.\nThe city has a budget of $1,000,000 for the installation of these systems.\nPlease help the city to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric plants\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal systems\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\nCost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n## the objective function is: Maximize Energy / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation of these systems.\nmodel.addCons(1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Systems: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Generators: \", model.getVal(Biomass))\n    print(\"Maximized Energy Production per Investment Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times by determining the optimal speed for each truck.\n// {\"speed of truck 1\": \"T1\", \"range\": \"0 <= T1 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"T2\", \"range\": \"0 <= T2 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"T3\", \"range\": \"0 <= T3 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"T4\", \"range\": \"0 <= T4 <= 60\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"T5\", \"range\": \"0 <= T5 <= 60\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed. The fuel consumption rate (in liters per kilometer) for each truck is given by:\n- Truck 1: F1 = 0.05 * T1^2\n- Truck 2: F2 = 0.06 * T2^2\n- Truck 3: F3 = 0.07 * T3^2\n- Truck 4: F4 = 0.08 * T4^2\n- Truck 5: F5 = 0.09 * T5^2\nThe total delivery time for each truck is inversely proportional to its speed:\n- Truck 1: D1 = 500 / T1\n- Truck 2: D2 = 450 / T2\n- Truck 3: D3 = 400 / T3\n- Truck 4: D4 = 350 / T4\n- Truck 5: D5 = 300 / T5\nThe company aims to minimize the total cost, which is the sum of the total fuel consumption and the total delivery time multiplied by a cost factor of $10 per hour.\n// Total fuel consumption: Fuel = 500 * F1 + 450 * F2 + 400 * F3 + 350 * F4 + 300 * F5\n// Total delivery time: Time = D1 + D2 + D3 + D4 + D5\n// Objective function: Minimize (Fuel + 10 * Time)\n\n## Generate Constraint-1:\nThe total time for all trucks to complete their deliveries must not exceed 10 hours.\n// D1 + D2 + D3 + D4 + D5 <= 10",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times by determining the optimal speed for each truck. The fuel consumption of each truck is modeled as a nonlinear function of its speed, with the fuel consumption rate (in liters per kilometer) for each truck given by:\n- Truck 1: F1 = 0.05 * T1^2\n- Truck 2: F2 = 0.06 * T2^2\n- Truck 3: F3 = 0.07 * T3^2\n- Truck 4: F4 = 0.08 * T4^2\n- Truck 5: F5 = 0.09 * T5^2\nThe total delivery time for each truck is inversely proportional to its speed:\n- Truck 1: D1 = 500 / T1\n- Truck 2: D2 = 450 / T2\n- Truck 3: D3 = 400 / T3\n- Truck 4: D4 = 350 / T4\n- Truck 5: D5 = 300 / T5\nThe company aims to minimize the total cost, which is the sum of the total fuel consumption and the total delivery time multiplied by a cost factor of $10 per hour. The total time for all trucks to complete their deliveries must not exceed 10 hours.\nPlease help the company to determine the optimal speeds for each truck to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0, ub=60) # speed of truck 1\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0, ub=60) # speed of truck 2\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0, ub=60) # speed of truck 3\nT4 = model.addVar(vtype=\"CONTINUOUS\", name=\"T4\", lb=0, ub=60) # speed of truck 4\nT5 = model.addVar(vtype=\"CONTINUOUS\", name=\"T5\", lb=0, ub=60) # speed of truck 5\n\n# Define objective function\nF1 = 0.05 * T1**2\nF2 = 0.06 * T2**2\nF3 = 0.07 * T3**2\nF4 = 0.08 * T4**2\nF5 = 0.09 * T5**2\nD1 = 500 / T1\nD2 = 450 / T2\nD3 = 400 / T3\nD4 = 350 / T4\nD5 = 300 / T5\nFuel = 500 * F1 + 450 * F2 + 400 * F3 + 350 * F4 + 300 * F5\nTime = D1 + D2 + D3 + D4 + D5\n# Objective function: Minimize (Fuel + 10 * Time)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel + 10 * Time)\n\n# Add constraints\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(T1))\n    print(\"Speed of Truck 2: \", model.getVal(T2))\n    print(\"Speed of Truck 3: \", model.getVal(T3))\n    print(\"Speed of Truck 4: \", model.getVal(T4))\n    print(\"Speed of Truck 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each product for the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company wants to spend at most 400 hours on production for the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company has $1500 available for material costs for the next quarter. The company wants to produce at least 20 units of each product for the next quarter. The company wants to spend at most 400 hours on production for the next quarter.\nPlease help the company to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n## The company wants to spend at most 400 hours on production for the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by small trucks per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by medium trucks per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by large trucks per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for small trucks is $0.5, medium trucks is $0.7, and large trucks is $0.9. The maintenance cost per day for small trucks is $100, medium trucks is $150, and large trucks is $200. The company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs.\n// FuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\n// FuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\n// FuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\n// MaintenanceCostSmall = 100 * SmallTrucks\n// MaintenanceCostMedium = 150 * MediumTrucks\n// MaintenanceCostLarge = 200 * LargeTrucks\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n## Generate Constraint-1:\nThe total distance traveled by all trucks must not exceed 5000 kilometers per day.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 per day for fuel costs.\n// 0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000\n\n## Generate Constraint-3:\nThe company can only afford to maintain a maximum of 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks to minimize fuel consumption and maintenance costs while ensuring timely delivery of goods. The company operates three types of trucks: small, medium, and large, each with different fuel efficiencies and maintenance costs. The company needs to determine the optimal number of each type of truck to deploy and the routes they should take to minimize total operational costs.\nThe fuel cost per kilometer for small trucks is $0.5, medium trucks is $0.7, and large trucks is $0.9. The maintenance cost per day for small trucks is $100, medium trucks is $150, and large trucks is $200. The company aims to minimize the total daily operational cost, which includes both fuel and maintenance costs.\nThe total distance traveled by all trucks must not exceed 5000 kilometers per day. The company has a budget of $2000 per day for fuel costs. The company can only afford to maintain a maximum of 50 trucks in total.\nPlease help the company to minimize the total daily operational cost, which includes both fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nDistanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceSmall\", lb=0)  # distance traveled by small trucks per day\nDistanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceMedium\", lb=0)  # distance traveled by medium trucks per day\nDistanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceLarge\", lb=0)  # distance traveled by large trucks per day\n\n# Define objective function\nFuelCostSmall = 0.5 * DistanceSmall * SmallTrucks\nFuelCostMedium = 0.7 * DistanceMedium * MediumTrucks\nFuelCostLarge = 0.9 * DistanceLarge * LargeTrucks\nMaintenanceCostSmall = 100 * SmallTrucks\nMaintenanceCostMedium = 150 * MediumTrucks\nMaintenanceCostLarge = 200 * LargeTrucks\n# So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostSmall + FuelCostMedium + FuelCostLarge + MaintenanceCostSmall + MaintenanceCostMedium + MaintenanceCostLarge)\n\n# Add constraints\n# The total distance traveled by all trucks must not exceed 5000 kilometers per day.\nmodel.addCons(DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 5000)\n# The company has a budget of $2000 per day for fuel costs.\nmodel.addCons(0.5 * DistanceSmall * SmallTrucks + 0.7 * DistanceMedium * MediumTrucks + 0.9 * DistanceLarge * LargeTrucks <= 2000)\n# The company can only afford to maintain a maximum of 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Distance Traveled by Small Trucks: \", model.getVal(DistanceSmall))\n    print(\"Distance Traveled by Medium Trucks: \", model.getVal(DistanceMedium))\n    print(\"Distance Traveled by Large Trucks: \", model.getVal(DistanceLarge))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n// SpecialTrucks >= 0.5 * LargeTrucks\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to Small and Medium packages combined.\n// SmallTrucks + MediumTrucks >= 10\n\n## Generate Constraint-4:\nThe demand for X-Large packages requires at least 5 trucks dedicated to them.\n// XL_Trucks >= 5",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages. The company must ensure that at least 10 trucks are allocated to Small and Medium packages combined. The demand for X-Large packages requires at least 5 trucks dedicated to them. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=5)  # Constraint-4: XL_Trucks >= 5\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\n# Cost per truck decreases by $10 for every additional truck allocated to the same package type\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\n# Constraint-1: Total of 50 trucks available\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\n# Constraint-2: SpecialTrucks must be at least half of LargeTrucks\nmodel.addCons(SpecialTrucks >= 0.5 * LargeTrucks)\n# Constraint-3: At least 10 trucks for Small and Medium combined\nmodel.addCons(SmallTrucks + MediumTrucks >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of X-Large Trucks: \", model.getVal(XL_Trucks))\n    print(\"Number of Special Trucks: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours.\n// Fuel_Consumption_Route_1 = 10 * T1\n// Fuel_Consumption_Route_2 = 12 * T2\n// Fuel_Consumption_Route_3 = 15 * T3\n// Fuel_Consumption_Route_4 = 18 * T4\n// Fuel_Consumption_Route_5 = 20 * T5\n// Delivery_Time_Route_1 = K1 / T1\n// Delivery_Time_Route_2 = K2 / T2\n// Delivery_Time_Route_3 = K3 / T3\n// Delivery_Time_Route_4 = K4 / T4\n// Delivery_Time_Route_5 = K5 / T5\n// Total_Delivery_Time = Delivery_Time_Route_1 + Delivery_Time_Route_2 + Delivery_Time_Route_3 + Delivery_Time_Route_4 + Delivery_Time_Route_5\n// Objective function: Minimize Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5, subject to Total_Delivery_Time <= 500\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1\n\n## Generate Constraint-3:\nThe total delivery time across all routes must not exceed 500 hours.\n// K1 / T1 + K2 / T2 + K3 / T3 + K4 / T4 + K5 / T5 <= 500\n\n## Generate Constraint-4:\nThe company has a budget constraint for fuel costs, limiting the total fuel consumption to 1500 liters.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500",
        "question": "A logistics company operates 5 different routes for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel consumption per truck on each route is as follows: Route 1 consumes 10 liters per hour, Route 2 consumes 12 liters per hour, Route 3 consumes 15 liters per hour, Route 4 consumes 18 liters per hour, and Route 5 consumes 20 liters per hour. The delivery time per truck on each route is inversely proportional to the number of trucks allocated. The company aims to minimize the total fuel consumption while ensuring all routes are serviced within a maximum total delivery time of 500 hours. The total number of trucks available is 100. Each route must have at least one truck. The company has a budget constraint for fuel costs, limiting the total fuel consumption to 1500 liters.\n\nPlease help the company to minimize the total fuel consumption while meeting the delivery time constraint and the budget constraint.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\nFuel_Consumption_Route_1 = 10 * T1\nFuel_Consumption_Route_2 = 12 * T2\nFuel_Consumption_Route_3 = 15 * T3\nFuel_Consumption_Route_4 = 18 * T4\nFuel_Consumption_Route_5 = 20 * T5\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n# Add constraints\n# The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Each route must have at least one truck.\nmodel.addCons(T1 >= 1)\nmodel.addCons(T2 >= 1)\nmodel.addCons(T3 >= 1)\nmodel.addCons(T4 >= 1)\nmodel.addCons(T5 >= 1)\n\n# The total delivery time across all routes must not exceed 500 hours.\n# Convert division to multiplication\nK1 = model.addVar(vtype=\"CONTINUOUS\", name=\"K1\")\nK2 = model.addVar(vtype=\"CONTINUOUS\", name=\"K2\")\nK3 = model.addVar(vtype=\"CONTINUOUS\", name=\"K3\")\nK4 = model.addVar(vtype=\"CONTINUOUS\", name=\"K4\")\nK5 = model.addVar(vtype=\"CONTINUOUS\", name=\"K5\")\nmodel.addCons(K1 / T1 + K2 / T2 + K3 / T3 + K4 / T4 + K5 / T5 <= 500)\n\n# The company has a budget constraint for fuel costs, limiting the total fuel consumption to 1500 liters.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 1,500 units per month.\n// Tablets >= 1500\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 1,000 units per month.\n// Laptops >= 1000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit from each device is calculated based on the selling price minus the production cost, which varies per device and is affected by the quantity produced due to economies of scale. The profit per unit for each device is given in the following Table.\n\n| Device       | Profit per Unit Formula                  |\n|--------------|------------------------------------------|\n| Smartphones  | $100 - 0.1 * Smartphones                |\n| Tablets      | $150 - 0.2 * Tablets                    |\n| Laptops      | $200 - 0.3 * Laptops                    |\n| Smartwatches | $50 - 0.05 * Smartwatches               |\n| Cameras      | $300 - 0.4 * Cameras                    |\n\nThe company wants to maximize the total profit from all devices. The total production capacity of the company is 10,000 units per month. The market demand for smartphones is at least 2,000 units per month, for tablets is at least 1,500 units per month, and for laptops is at least 1,000 units per month.\n\nPlease help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1500)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=1000)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)  # number of smartwatches produced\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)  # number of cameras produced\n\n# Define objective function\n# The profit from each device is calculated based on the selling price minus the production cost.\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n\nTotal_profit = Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_profit)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1373,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget allocated to each product, and the number of skilled workers assigned to each product line. The marketing budget affects the sales of each product, and the number of skilled workers influences the production efficiency. The company aims to optimize its production and marketing strategies to maximize profit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of skilled workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of skilled workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of skilled workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is affected by the production quantity, the marketing budget, and the number of skilled workers. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1000 spent. The production efficiency increases by 0.5 units per worker. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 + 0.001 * MarketingBudgetA) * QuantityA * (1 + 0.005 * WorkersA)\n// Total profit for ProductB: ProfitB = (150 + 0.001 * MarketingBudgetB) * QuantityB * (1 + 0.005 * WorkersB)\n// Total profit for ProductC: ProfitC = (200 + 0.001 * MarketingBudgetC) * QuantityC * (1 + 0.005 * WorkersC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total marketing budget cannot exceed $50,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 skilled workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n// QuantityA >= 500; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget allocated to each product, and the number of skilled workers assigned to each product line. The marketing budget affects the sales of each product, and the number of skilled workers influences the production efficiency. The company aims to optimize its production and marketing strategies to maximize profit. The profit per unit of each product and the effects of marketing budget and skilled workers on sales and production efficiency are summarized in the following table:\n\n| Product | Profit per Unit | Marketing Budget Effect | Production Efficiency per Worker |\n|---------|-----------------|-------------------------|----------------------------------|\n| ProductA | $100 | 1% increase per $1000 spent | 0.5 units increase |\n| ProductB | $150 | 1% increase per $1000 spent | 0.5 units increase |\n| ProductC | $200 | 1% increase per $1000 spent | 0.5 units increase |\n\nThe total marketing budget cannot exceed $50,000. The company has a total of 100 skilled workers available. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 300 units. \n\nPlease help the company to maximize the total profit from all products by determining the optimal production quantity, marketing budget, and number of skilled workers for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of skilled workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of skilled workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of skilled workers for ProductC\n\n# Define objective function\nProfitA = (100 + 0.001 * MarketingBudgetA) * QuantityA * (1 + 0.005 * WorkersA)\nProfitB = (150 + 0.001 * MarketingBudgetB) * QuantityB * (1 + 0.005 * WorkersB)\nProfitC = (200 + 0.001 * MarketingBudgetC) * QuantityC * (1 + 0.005 * WorkersC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 50000)\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1475,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TypeA trucks\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeB trucks\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeC trucks\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The company wants to minimize the total operational cost.\n// Fuel cost per kilometer for TypeA: CostA = 0.5 - 0.0001 * UpgradeA\n// Fuel cost per kilometer for TypeB: CostB = 0.6 - 0.0001 * UpgradeB\n// Fuel cost per kilometer for TypeC: CostC = 0.7 - 0.0001 * UpgradeC\n// Total operational cost: Minimize (CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $10,000.\n// UpgradeA + UpgradeB + UpgradeC <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The total budget for fuel efficiency upgrades is $10,000. Please help the company to determine the optimal number of trucks of each type and the appropriate fuel efficiency upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of TypeC trucks\nUpgradeA = model.addVar(name=\"UpgradeA\", lb=0) # fuel efficiency upgrade for TypeA trucks\nUpgradeB = model.addVar(name=\"UpgradeB\", lb=0) # fuel efficiency upgrade for TypeB trucks\nUpgradeC = model.addVar(name=\"UpgradeC\", lb=0) # fuel efficiency upgrade for TypeC trucks\n\n# Define objective function\nCostA = 0.5 - 0.0001 * UpgradeA\nCostB = 0.6 - 0.0001 * UpgradeB\nCostC = 0.7 - 0.0001 * UpgradeC\nTotalCost = CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Upgrade for TypeA Trucks: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TypeB Trucks: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TypeC Trucks: \", model.getVal(UpgradeC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the level of maintenance for each vehicle type to optimize fuel efficiency and reduce breakdowns.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckD\": \"MaintenanceD\", \"range\": \"MaintenanceD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost per kilometer for TruckA is $0.5, for TruckB is $0.4, for TruckC is $0.3, and for TruckD is $0.2. The maintenance cost is a nonlinear function of the maintenance level, increasing at a decreasing rate. The higher the maintenance level, the lower the probability of breakdowns and the higher the fuel efficiency.\n// Fuel cost for TruckA: FuelCostA = 0.5 * (1 + 0.01 * MaintenanceA) * TruckA\n// Fuel cost for TruckB: FuelCostB = 0.4 * (1 + 0.01 * MaintenanceB) * TruckB\n// Fuel cost for TruckC: FuelCostC = 0.3 * (1 + 0.01 * MaintenanceC) * TruckC\n// Fuel cost for TruckD: FuelCostD = 0.2 * (1 + 0.01 * MaintenanceD) * TruckD\n// Maintenance cost for TruckA: MaintenanceCostA = 100 * (MaintenanceA^2)\n// Maintenance cost for TruckB: MaintenanceCostB = 100 * (MaintenanceB^2)\n// Maintenance cost for TruckC: MaintenanceCostC = 100 * (MaintenanceC^2)\n// Maintenance cost for TruckD: MaintenanceCostD = 100 * (MaintenanceD^2)\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCostA + MaintenanceCostB + MaintenanceCostC + MaintenanceCostD)\n\n## Generate Constraint-1:\nThe total budget for vehicle acquisition and maintenance is $200,000.\n// TruckA + TruckB + TruckC + TruckD + MaintenanceA + MaintenanceB + MaintenanceC + MaintenanceD <= 200000\n\n## Generate Constraint-2:\nThe company must operate at least 10 TruckA, 15 TruckB, 20 TruckC, and 25 TruckD.\n// TruckA >= 10; TruckB >= 15; TruckC >= 20; TruckD >= 25\n\n## Generate Constraint-3:\nThe total number of vehicles must not exceed 100.\n// TruckA + TruckB + TruckC + TruckD <= 100",
        "question": "A logistics company is planning its fleet for the next quarter and operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the level of maintenance for each vehicle type to optimize fuel efficiency and reduce breakdowns. The fuel cost per kilometer and the relationship between maintenance level and maintenance cost are given in the following Table.\n\n| Vehicle Type | Fuel Cost per Kilometer | Maintenance Cost Function |\n|--------------|-------------------------|---------------------------|\n| TruckA       | $0.5 * (1 + 0.01 * MaintenanceA) | 100 * (MaintenanceA^2) |\n| TruckB       | $0.4 * (1 + 0.01 * MaintenanceB) | 100 * (MaintenanceB^2) |\n| TruckC       | $0.3 * (1 + 0.01 * MaintenanceC) | 100 * (MaintenanceC^2) |\n| TruckD       | $0.2 * (1 + 0.01 * MaintenanceD) | 100 * (MaintenanceD^2) |\n\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The total budget for vehicle acquisition and maintenance is $200,000. The company must operate at least 10 TruckA, 15 TruckB, 20 TruckC, and 25 TruckD. The total number of vehicles must not exceed 100.\n\nPlease help the company to determine the optimal number of each vehicle type and the appropriate level of maintenance to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=15)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=20)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=25)  # number of TruckD\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance level for TruckA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance level for TruckB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance level for TruckC\nMaintenanceD = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceD\", lb=0)  # maintenance level for TruckD\n\n# Define objective function\nFuelCostA = 0.5 * (1 + 0.01 * MaintenanceA) * TruckA\nFuelCostB = 0.4 * (1 + 0.01 * MaintenanceB) * TruckB\nFuelCostC = 0.3 * (1 + 0.01 * MaintenanceC) * TruckC\nFuelCostD = 0.2 * (1 + 0.01 * MaintenanceD) * TruckD\nMaintenanceCostA = 100 * (MaintenanceA**2)\nMaintenanceCostB = 100 * (MaintenanceB**2)\nMaintenanceCostC = 100 * (MaintenanceC**2)\nMaintenanceCostD = 100 * (MaintenanceD**2)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCostA + MaintenanceCostB + MaintenanceCostC + MaintenanceCostD)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + MaintenanceA + MaintenanceB + MaintenanceC + MaintenanceD <= 200000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maintenance Level for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Level for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Level for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Maintenance Level for TruckD: \", model.getVal(MaintenanceD))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1386,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck depends on the route it takes. For route A, each truck consumes 100 liters of fuel per trip. For route B, each truck consumes 120 liters of fuel per trip. For route C, each truck consumes 150 liters of fuel per trip. For route D, each truck consumes 200 liters of fuel per trip. The company aims to minimize the total fuel consumption per day.\n// Fuel_Consumption_A = 100 * TrucksA\n// Fuel_Consumption_B = 120 * TrucksB\n// Fuel_Consumption_C = 150 * TrucksC\n// Fuel_Consumption_D = 200 * TrucksD\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $5000 for fuel costs.\n// 100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000\n\n## Generate Constraint-3:\nThe demand for goods transportation on route A is at least 10 trips per day.\n// TrucksA >= 10\n\n## Generate Constraint-4:\nThe demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C.\n// TrucksD <= 2 * (TrucksA + TrucksB + TrucksC)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks on route C does not exceed the number on route A by more than 5.\n// TrucksC - TrucksA <= 5",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route. The fuel consumption of each truck depends on the route it takes. For route A, each truck consumes 100 liters of fuel per trip. For route B, each truck consumes 120 liters of fuel per trip. For route C, each truck consumes 150 liters of fuel per trip. For route D, each truck consumes 200 liters of fuel per trip. The company aims to minimize the total fuel consumption per day. The company has a total of 50 trucks available and a daily budget of $5000 for fuel costs. The demand for goods transportation on route A is at least 10 trips per day. The demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C. The company wants to ensure that the number of trucks on route C does not exceed the number on route A by more than 5. Please help the company to determine the optimal allocation of trucks to each route to minimize the total fuel consumption per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\n\n# Define objective function\nFuel_Consumption_A = 100 * TrucksA\nFuel_Consumption_B = 120 * TrucksB\nFuel_Consumption_C = 150 * TrucksC\nFuel_Consumption_D = 200 * TrucksD\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# The company has a daily budget of $5000 for fuel costs.\nmodel.addCons(100 * TrucksA + 120 * TrucksB + 150 * TrucksC + 200 * TrucksD <= 5000)\n# The demand for goods transportation on route D is at most twice the combined demand of routes A, B, and C.\nmodel.addCons(TrucksD <= 2 * (TrucksA + TrucksB + TrucksC))\n# The company wants to ensure that the number of trucks on route C does not exceed the number on route A by more than 5.\nmodel.addCons(TrucksC - TrucksA <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y).\n// {\"number of solar panels A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines X\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines Y\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company wants to minimize the total cost while maximizing the total energy output.\n// Total energy output: Energy = 15% * SolarA + 20% * SolarB + 25% * SolarC + 30% * WindX + 35% * WindY\n// Total cost: Cost = $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY <= 50000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on solar panels.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC >= 0.5 * (50000)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y). The efficiency and cost per unit for each type of equipment are given in the following Table.\n\n| Equipment | Efficiency | Cost per Unit |\n|-----------|------------|---------------|\n| Solar A   | 15%        | $1000         |\n| Solar B   | 20%        | $1500         |\n| Solar C   | 25%        | $2000         |\n| Wind X    | 30%        | $2500         |\n| Wind Y    | 35%        | $3000         |\n\nThe company has a budget of $50,000 for the installation. The company wants to ensure that at least 50% of the budget is spent on solar panels. Please help the company to minimize the total cost while maximizing the total energy output, which is defined as the ratio of the total cost to the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels C\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=0) # number of wind turbines X\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=0) # number of wind turbines Y\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.15 * SolarA + 0.20 * SolarB + 0.25 * SolarC + 0.30 * WindX + 0.35 * WindY\nCost = 1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY <= 50000)\n## The company wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC >= 0.5 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines X: \", model.getVal(WindX))\n    print(\"Number of Wind Turbines Y: \", model.getVal(WindY))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Residential, Commercial, and Industrial) to reduce energy costs and carbon emissions. The city needs to determine the number of solar panels to install in each zone and the associated installation costs.\n// {\"number of solar panels in Residential zone\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Commercial zone\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Industrial zone\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"installation cost per panel in Residential zone\": \"ResidentialCost\", \"range\": \"ResidentialCost >= 0\", \"type\": \"real\"}\n// {\"installation cost per panel in Commercial zone\": \"CommercialCost\", \"range\": \"CommercialCost >= 0\", \"type\": \"real\"}\n// {\"installation cost per panel in Industrial zone\": \"IndustrialCost\", \"range\": \"IndustrialCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to minimize the total installation cost while maximizing the energy output. The energy output per panel is 100 kWh for Residential, 150 kWh for Commercial, and 200 kWh for Industrial. The installation costs are $500 for Residential, $400 for Commercial, and $300 for Industrial.\n// Total installation cost: Cost = ResidentialPanels * ResidentialCost + CommercialPanels * CommercialCost + IndustrialPanels * IndustrialCost\n// Total energy output: Energy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n// The objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// ResidentialPanels * ResidentialCost + CommercialPanels * CommercialCost + IndustrialPanels * IndustrialCost <= 100000\n\n## Generate Constraint-2:\nThe city aims to generate at least 50,000 kWh of energy from the solar panels.\n// 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels >= 50000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Residential, Commercial, and Industrial) to reduce energy costs and carbon emissions. The city needs to determine the number of solar panels to install in each zone and the associated installation costs. The energy output per panel and the installation costs for each zone are given in the following Table.\n\n| Zone             | Energy Output per Panel | Installation Cost per Panel |\n|------------------|-------------------------|-----------------------------|\n| Residential      | 100 kWh                 | $500                        |\n| Commercial       | 150 kWh                 | $400                        |\n| Industrial       | 200 kWh                 | $300                        |\n\nThe city has a budget of $100,000 for the installation of solar panels. The city aims to generate at least 50,000 kWh of energy from the solar panels. Please help the city to minimize the total installation cost while maximizing the energy output, defined as the total installation cost divided by the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0) # number of solar panels in Residential zone\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0) # number of solar panels in Commercial zone\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0) # number of solar panels in Industrial zone\nResidentialCost = 500 # installation cost per panel in Residential zone\nCommercialCost = 400 # installation cost per panel in Commercial zone\nIndustrialCost = 300 # installation cost per panel in Industrial zone\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = ResidentialPanels * ResidentialCost + CommercialPanels * CommercialCost + IndustrialPanels * IndustrialCost\nEnergy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(Cost <= 100000)\n## The city aims to generate at least 50,000 kWh of energy from the solar panels.\nmodel.addCons(Energy >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Residential Zone: \", model.getVal(ResidentialPanels))\n    print(\"Number of Solar Panels in Commercial Zone: \", model.getVal(CommercialPanels))\n    print(\"Number of Solar Panels in Industrial Zone: \", model.getVal(IndustrialPanels))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionX, RegionY, and RegionZ. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in RegionX\": \"SolarX\", \"range\": \"SolarX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionX\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionX\": \"StorageX\", \"range\": \"StorageX >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionY\": \"SolarY\", \"range\": \"SolarY >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionY\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionY\": \"StorageY\", \"range\": \"StorageY >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionZ\": \"SolarZ\", \"range\": \"SolarZ >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionZ\": \"WindZ\", \"range\": \"WindZ >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionZ\": \"StorageZ\", \"range\": \"StorageZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Energy output from solar panels in RegionX: Energy_SolarX = 1000 * SolarX * (1 + 0.01 * StorageX)^2\n// Energy output from wind turbines in RegionX: Energy_WindX = 2000 * WindX * (1 + 0.02 * StorageX)^3\n// Energy output from solar panels in RegionY: Energy_SolarY = 1200 * SolarY * (1 + 0.01 * StorageY)^2\n// Energy output from wind turbines in RegionY: Energy_WindY = 2200 * WindY * (1 + 0.02 * StorageY)^3\n// Energy output from solar panels in RegionZ: Energy_SolarZ = 1500 * SolarZ * (1 + 0.01 * StorageZ)^2\n// Energy output from wind turbines in RegionZ: Energy_WindZ = 2500 * WindZ * (1 + 0.02 * StorageZ)^3\n// So, the objective function is: Maximize (Energy_SolarX + Energy_WindX + Energy_SolarY + Energy_WindY + Energy_SolarZ + Energy_WindZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for installation and storage investments in all regions.\n// 10000 * SolarX + 20000 * WindX + StorageX + 10000 * SolarY + 20000 * WindY + StorageY + 10000 * SolarZ + 20000 * WindZ + StorageZ <= 1,000,000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines that can be installed across all regions is limited to 500.\n// SolarX + WindX + SolarY + WindY + SolarZ + WindZ <= 500\n\n## Generate Constraint-3:\nDue to regional regulations, the investment in energy storage in each region must not exceed $100,000.\n// StorageX <= 100,000; StorageY <= 100,000; StorageZ <= 100,000\n\n## Generate Constraint-4:\nThe company must install at least 50 solar panels and 20 wind turbines in each region.\n// SolarX >= 50; WindX >= 20; SolarY >= 50; WindY >= 20; SolarZ >= 50; WindZ >= 20",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionX, RegionY, and RegionZ. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste. The energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n\nThe company has a total budget of $1,000,000 for installation and storage investments in all regions. The total number of solar panels and wind turbines that can be installed across all regions is limited to 500. Due to regional regulations, the investment in energy storage in each region must not exceed $100,000. The company must install at least 50 solar panels and 20 wind turbines in each region.\n\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarX = model.addVar(vtype=\"INTEGER\", name=\"SolarX\", lb=50)  # number of solar panels in RegionX\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=20)    # number of wind turbines in RegionX\nStorageX = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageX\", lb=0)  # investment in energy storage in RegionX\nSolarY = model.addVar(vtype=\"INTEGER\", name=\"SolarY\", lb=50)  # number of solar panels in RegionY\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=20)    # number of wind turbines in RegionY\nStorageY = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageY\", lb=0)  # investment in energy storage in RegionY\nSolarZ = model.addVar(vtype=\"INTEGER\", name=\"SolarZ\", lb=50)  # number of solar panels in RegionZ\nWindZ = model.addVar(vtype=\"INTEGER\", name=\"WindZ\", lb=20)    # number of wind turbines in RegionZ\nStorageZ = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageZ\", lb=0)  # investment in energy storage in RegionZ\n\n# Define objective function\n# Energy output from solar panels and wind turbines is affected by the investment in energy storage systems.\n# The energy output from solar panels is modeled as a quadratic function of the storage investment,\n# and the energy output from wind turbines is modeled as a cubic function of the storage investment.\n# The company aims to maximize the total energy output from all regions.\nEnergy_SolarX = 1000 * SolarX * (1 + 0.01 * StorageX)**2\nEnergy_WindX = 2000 * WindX * (1 + 0.02 * StorageX)**3\nEnergy_SolarY = 1200 * SolarY * (1 + 0.01 * StorageY)**2\nEnergy_WindY = 2200 * WindY * (1 + 0.02 * StorageY)**3\nEnergy_SolarZ = 1500 * SolarZ * (1 + 0.01 * StorageZ)**2\nEnergy_WindZ = 2500 * WindZ * (1 + 0.02 * StorageZ)**3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SolarX + Energy_WindX + Energy_SolarY + Energy_WindY + Energy_SolarZ + Energy_WindZ)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for installation and storage investments in all regions.\nmodel.addCons(10000 * SolarX + 20000 * WindX + StorageX + 10000 * SolarY + 20000 * WindY + StorageY + 10000 * SolarZ + 20000 * WindZ + StorageZ <= 1000000)\n# The total number of solar panels and wind turbines that can be installed across all regions is limited to 500.\nmodel.addCons(SolarX + WindX + SolarY + WindY + SolarZ + WindZ <= 500)\n# Due to regional regulations, the investment in energy storage in each region must not exceed $100,000.\nmodel.addCons(StorageX <= 100000)\nmodel.addCons(StorageY <= 100000)\nmodel.addCons(StorageZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionX: \", model.getVal(SolarX))\n    print(\"Number of Wind Turbines in RegionX: \", model.getVal(WindX))\n    print(\"Investment in Energy Storage in RegionX: \", model.getVal(StorageX))\n    print(\"Number of Solar Panels in RegionY: \", model.getVal(SolarY))\n    print(\"Number of Wind Turbines in RegionY: \", model.getVal(WindY))\n    print(\"Investment in Energy Storage in RegionY: \", model.getVal(StorageY))\n    print(\"Number of Solar Panels in RegionZ: \", model.getVal(SolarZ))\n    print(\"Number of Wind Turbines in RegionZ: \", model.getVal(WindZ))\n    print(\"Investment in Energy Storage in RegionZ: \", model.getVal(StorageZ))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month. Additionally, the company is considering outsourcing part of the production to external contractors.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"A_outsource\", \"range\": \"A_outsource >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"B_outsource\", \"range\": \"B_outsource >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"C_outsource\", \"range\": \"C_outsource >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceD\": \"D_outsource\", \"range\": \"D_outsource >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nFor DeviceD, the selling price is $250, the production cost is $150, and the outsourcing cost is $170.\nThe company aims to maximize the total profit, considering both in-house production and outsourcing.\n// Profit from DeviceA: Profit_A = (100 - 60) * A + (100 - 80) * A_outsource\n// Profit from DeviceB: Profit_B = (150 - 90) * B + (150 - 110) * B_outsource\n// Profit from DeviceC: Profit_C = (200 - 120) * C + (200 - 140) * C_outsource\n// Profit from DeviceD: Profit_D = (250 - 150) * D + (250 - 170) * D_outsource\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production and outsourcing costs.\n// 60 * A + 90 * B + 120 * C + 150 * D + 80 * A_outsource + 110 * B_outsource + 140 * C_outsource + 170 * D_outsource <= 100,000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 500 units for all devices combined.\n// A + B + C + D <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of each device's production is outsourced.\n// A_outsource >= 0.2 * A; B_outsource >= 0.2 * B; C_outsource >= 0.2 * C; D_outsource >= 0.2 * D\n\n## Generate Constraint-4:\nThe company wants to ensure that the total outsourced units do not exceed 200 units.\n// A_outsource + B_outsource + C_outsource + D_outsource <= 200",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month and is considering outsourcing part of the production to external contractors.\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nFor DeviceD, the selling price is $250, the production cost is $150, and the outsourcing cost is $170.\nThe company has a total budget of $100,000 for production and outsourcing costs. The company has a production capacity limit of 500 units for all devices combined. The company wants to ensure that at least 20% of each device's production is outsourced and that the total outsourced units do not exceed 200 units.\nPlease help the company to maximize the total profit, considering both in-house production and outsourcing.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\nA_outsource = model.addVar(vtype=\"INTEGER\", name=\"A_outsource\", lb=0) # number of units outsourced for DeviceA\nB_outsource = model.addVar(vtype=\"INTEGER\", name=\"B_outsource\", lb=0) # number of units outsourced for DeviceB\nC_outsource = model.addVar(vtype=\"INTEGER\", name=\"C_outsource\", lb=0) # number of units outsourced for DeviceC\nD_outsource = model.addVar(vtype=\"INTEGER\", name=\"D_outsource\", lb=0) # number of units outsourced for DeviceD\n\n# Define objective function\nProfit_A = (100 - 60) * A + (100 - 80) * A_outsource\nProfit_B = (150 - 90) * B + (150 - 110) * B_outsource\nProfit_C = (200 - 120) * C + (200 - 140) * C_outsource\nProfit_D = (250 - 150) * D + (250 - 170) * D_outsource\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(60 * A + 90 * B + 120 * C + 150 * D + 80 * A_outsource + 110 * B_outsource + 140 * C_outsource + 170 * D_outsource <= 100000)\nmodel.addCons(A + B + C + D <= 500)\nmodel.addCons(A_outsource >= 0.2 * A)\nmodel.addCons(B_outsource >= 0.2 * B)\nmodel.addCons(C_outsource >= 0.2 * C)\nmodel.addCons(D_outsource >= 0.2 * D)\nmodel.addCons(A_outsource + B_outsource + C_outsource + D_outsource <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of DeviceA outsourced: \", model.getVal(A_outsource))\n    print(\"Number of DeviceB outsourced: \", model.getVal(B_outsource))\n    print(\"Number of DeviceC outsourced: \", model.getVal(C_outsource))\n    print(\"Number of DeviceD outsourced: \", model.getVal(D_outsource))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit per unit of product. \nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\nThe company aims to maximize the total profit from all products.\n// The profit from product A: P_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\n// The profit from product B: P_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\n// The profit from product C: P_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n// So, the objective function is: Maximize P = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 + W4 <= 60",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. The productivity and profit per unit for each product on each machine are given in the following Table.\n\n| Machine | Productivity (units/hour) | Profit per Unit ($) |\n|---------|---------------------------|---------------------|\n| 1       | A: 10, B: 15, C: 20      | A: 5, B: 10, C: 15  |\n| 2       | A: 15, B: 20, C: 25      | A: 6, B: 11, C: 16  |\n| 3       | A: 20, B: 25, C: 30      | A: 7, B: 12, C: 17  |\n| 4       | A: 25, B: 30, C: 35      | A: 8, B: 13, C: 18  |\n\nThe company aims to maximize the total profit from all products. There are a total of 60 workers available. Please help the company determine the optimal number of workers to allocate to each machine to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\nP_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\nP_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n# So, the objective function is: Maximize P = P_A + P_B + P_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Number of workers on machine 4: \", model.getVal(W4))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region4\": \"Efficiency4\", \"range\": \"Efficiency4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region5\": \"Efficiency5\", \"range\": \"Efficiency5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies. The fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions. The company has a total budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 100.\n\nPlease help the company to determine the optimal number of trucks and the investment in fuel efficiency for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Region5\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Region3\nEfficiency4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency4\", lb=0)  # investment in fuel efficiency for Region4\nEfficiency5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency5\", lb=0)  # investment in fuel efficiency for Region5\n\n# Define objective function\nCost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\nCost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\nCost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\nCost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\nCost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Investment in Fuel Efficiency for Region4: \", model.getVal(Efficiency4))\n    print(\"Investment in Fuel Efficiency for Region5: \", model.getVal(Efficiency5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified range.\n// {\"dosage level of DrugA\": \"DA\", \"range\": \"0 <= DA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DB\", \"range\": \"0 <= DB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DC\", \"range\": \"0 <= DC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of each drug is modeled as a nonlinear function of the dosage level. The side effects are also modeled as a nonlinear function of the dosage level. The company aims to maximize the total therapeutic effect while minimizing the total side effects.\n// Therapeutic effect of DrugA: TE_A = 100 * (DA / (DA + 50))^2\n// Therapeutic effect of DrugB: TE_B = 150 * (DB / (DB + 75))^2\n// Therapeutic effect of DrugC: TE_C = 200 * (DC / (DC + 100))^2\n// Side effect of DrugA: SE_A = 50 * (DA / (DA + 25))^2\n// Side effect of DrugB: SE_B = 75 * (DB / (DB + 37.5))^2\n// Side effect of DrugC: SE_C = 100 * (DC / (DC + 50))^2\n// The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DA + DB + DC <= 300\n\n## Generate Constraint-2:\nThe dosage of DrugA must be at least half of the dosage of DrugB.\n// DA >= 0.5 * DB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least twice the dosage of DrugA.\n// DC >= 2 * DA",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within specified ranges: DrugA from 0 to 100 units, DrugB from 0 to 150 units, and DrugC from 0 to 200 units.\n\nThe therapeutic effect and side effects of each drug are modeled as nonlinear functions of the dosage level. The therapeutic effect of DrugA is given by TE_A = 100 * (DA / (DA + 50))^2, DrugB by TE_B = 150 * (DB / (DB + 75))^2, and DrugC by TE_C = 200 * (DC / (DC + 100))^2. The side effects of DrugA are given by SE_A = 50 * (DA / (DA + 25))^2, DrugB by SE_B = 75 * (DB / (DB + 37.5))^2, and DrugC by SE_C = 100 * (DC / (DC + 50))^2.\n\nThe company aims to maximize the total therapeutic effect while minimizing the total side effects. The constraints are as follows:\n1. The total dosage across all drugs must not exceed 300 units.\n2. The dosage of DrugA must be at least half of the dosage of DrugB.\n3. The dosage of DrugC must be at least twice the dosage of DrugA.\n\nPlease help the company to determine the optimal dosage levels for DrugA, DrugB, and DrugC to achieve the maximum therapeutic effect while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDA = model.addVar(vtype=\"CONTINUOUS\", name=\"DA\", lb=0, ub=100) # dosage level of DrugA\nDB = model.addVar(vtype=\"CONTINUOUS\", name=\"DB\", lb=0, ub=150) # dosage level of DrugB\nDC = model.addVar(vtype=\"CONTINUOUS\", name=\"DC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\n## Therapeutic effect and side effect functions\nTE_A = 100 * (DA / (DA + 50))**2\nTE_B = 150 * (DB / (DB + 75))**2\nTE_C = 200 * (DC / (DC + 100))**2\nSE_A = 50 * (DA / (DA + 25))**2\nSE_B = 75 * (DB / (DB + 37.5))**2\nSE_C = 100 * (DC / (DC + 50))**2\n## The objective function is: Maximize (TE_A + TE_B + TE_C) - Minimize (SE_A + SE_B + SE_C)\n## Combine the maximization and minimization into a single maximization problem\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TE_A + TE_B + TE_C - SE_A - SE_B - SE_C)\n\n# Add constraints\n## The total dosage across all drugs must not exceed 300 units.\nmodel.addCons(DA + DB + DC <= 300)\n## The dosage of DrugA must be at least half of the dosage of DrugB.\nmodel.addCons(DA >= 0.5 * DB)\n## The dosage of DrugC must be at least twice the dosage of DrugA.\nmodel.addCons(DC >= 2 * DA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DC))\n    print(\"Maximized Therapeutic Effect Minimized Side Effects: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost structure. Machine 1 produces product 1 at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product 2 at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product 3 at a rate of 20 units per hour, with a profit of $6 per unit. Machine 4 produces product 1 at a rate of 12 units per hour, with a profit of $5 per unit. Machine 5 produces product 2 at a rate of 18 units per hour, with a profit of $7 per unit. The objective is to maximize the total profit from all products.\n// The profit from machine 1: P1 = 10 * M1 * 5\n// The profit from machine 2: P2 = 15 * M2 * 7\n// The profit from machine 3: P3 = 20 * M3 * 6\n// The profit from machine 4: P4 = 12 * M4 * 5\n// The profit from machine 5: P5 = 18 * M5 * 7\n// So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours per week.\n// M1 + M2 + M3 + M4 + M5 <= 100\n\n## Generate Constraint-2:\nEach machine has a maximum operating capacity. Machine 1 can operate up to 20 hours, Machine 2 up to 25 hours, Machine 3 up to 30 hours, Machine 4 up to 22 hours, and Machine 5 up to 28 hours.\n// M1 <= 20; M2 <= 25; M3 <= 30; M4 <= 22; M5 <= 28",
        "question": "A manufacturing company produces three types of products using five different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit. Each machine has a different efficiency and cost structure. Machine 1 produces product 1 at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product 2 at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product 3 at a rate of 20 units per hour, with a profit of $6 per unit. Machine 4 produces product 1 at a rate of 12 units per hour, with a profit of $5 per unit. Machine 5 produces product 2 at a rate of 18 units per hour, with a profit of $7 per unit. The objective is to maximize the total profit from all products. The total operating hours for all machines must not exceed 100 hours per week. Each machine has a maximum operating capacity. Machine 1 can operate up to 20 hours, Machine 2 up to 25 hours, Machine 3 up to 30 hours, Machine 4 up to 22 hours, and Machine 5 up to 28 hours. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0, ub=20) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0, ub=25) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0, ub=30) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0, ub=22) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0, ub=28) # hours machine 5 operates\n\n# Define objective function\nP1 = 10 * M1 * 5\nP2 = 15 * M2 * 7\nP3 = 20 * M3 * 6\nP4 = 12 * M4 * 5\nP5 = 18 * M5 * 7\n# So, the objective function is: Maximize (P1 + P2 + P3 + P4 + P5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 100 hours per week.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods depends on the distance and the number of trucks used. The cost function is nonlinear and includes a quadratic term reflecting increased operational complexity with more trucks.\n// The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n// Objective: Minimize C\n// Minimize 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to minimize transportation costs while meeting delivery demands. The cost of transporting goods depends on the number of trucks used, with a nonlinear cost function that includes a quadratic term reflecting increased operational complexity with more trucks.\n\nThe company has a total of 100 trucks available across all warehouses. Each warehouse can handle a maximum of 20 trucks.\n\nPlease help the company to minimize the total transportation cost, which is calculated as follows:\nC = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n\nwhere T1, T2, T3, T4, T5, and T6 represent the number of trucks at each warehouse, respectively.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n# The cost function is: C = 1000 * (T1^2 + T2^2 + T3^2 + T4^2 + T5^2 + T6^2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6)\n# Objective: Minimize C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1000 * (T1**2 + T2**2 + T3**2 + T4**2 + T5**2 + T6**2) + 50 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Add constraints\n# The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Each warehouse can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks is 0.5 liters per kilometer, for vans is 0.3 liters per kilometer, and for motorcycles is 0.1 liters per kilometer. The total distance traveled by each type of vehicle is proportional to the number of vehicles. The company aims to minimize the total fuel consumption.\n// Total fuel consumption = 0.5 * T + 0.3 * V + 0.1 * M\n// So, the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each.\n// 2000 * T + 1500 * V + 500 * M <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg. Trucks can carry 1000 kg each, vans can carry 500 kg each, and motorcycles can carry 100 kg each.\n// 1000 * T + 500 * V + 100 * M >= 5000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands. The fuel consumption rate and cargo capacity for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Fuel Consumption Rate (liters/km) | Cargo Capacity (kg) |\n|--------------|-----------------------------------|---------------------|\n| Trucks       | 0.5                               | 1000                |\n| Vans         | 0.3                               | 500                 |\n| Motorcycles  | 0.1                               | 100                 |\n\nThe company has a budget of $10,000 to purchase vehicles. Trucks cost $2000 each, vans cost $1500 each, and motorcycles cost $500 each. The total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg. \n\nPlease help the company to minimize the total fuel consumption (which is defined as 0.5 * T + 0.3 * V + 0.1 * M) while adhering to the budget and cargo capacity constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * T + 0.3 * V + 0.1 * M)\nmodel.addCons(obj == 0.5 * T + 0.3 * V + 0.1 * M)\n\n# Add constraints\n## The company has a budget of $10,000 to purchase vehicles.\nmodel.addCons(2000 * T + 1500 * V + 500 * M <= 10000)\n## The total cargo capacity of all vehicles must meet a minimum requirement of 5000 kg.\nmodel.addCons(1000 * T + 500 * V + 100 * M >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Motorcycles: \", model.getVal(M))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost of materials for DeviceA\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceB\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost of materials for DeviceC\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe selling price of DeviceA is $200, DeviceB is $300, and DeviceC is $400. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost of materials.\n// Total revenue: Revenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\n// Total cost of materials: Cost = CostA * UnitsA + CostB * UnitsB + CostC * UnitsC\n// The objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 1000 units in total.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe market demand for DeviceA is at least 200 units per month.\n// UnitsA >= 200\n\n## Generate Constraint-3:\nThe cost of materials for DeviceA is $50 per unit, for DeviceB is $70 per unit, and for DeviceC is $90 per unit. The company has a budget of $70,000 for materials per month.\n// 50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70,000\n\n## Generate Constraint-4:\nDue to a strategic partnership, the company must produce at least twice as many units of DeviceB as DeviceA.\n// UnitsB >= 2 * UnitsA\n\n## Generate Constraint-5:\nThe company aims to ensure that the production of DeviceC does not exceed 30% of the total production.\n// UnitsC <= 0.3 * (UnitsA + UnitsB + UnitsC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize their profit, considering the production capacity, market demand, and material costs. The selling price of DeviceA is $200, DeviceB is $300, and DeviceC is $400. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost of materials. The company has a monthly production capacity of 1000 units in total. The market demand for DeviceA is at least 200 units per month. The cost of materials for DeviceA is $50 per unit, for DeviceB is $70 per unit, and for DeviceC is $90 per unit. The company has a budget of $70,000 for materials per month. Due to a strategic partnership, the company must produce at least twice as many units of DeviceB as DeviceA. The company aims to ensure that the production of DeviceC does not exceed 30% of the total production. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\n\n# Define objective function\nRevenue = 200 * UnitsA + 300 * UnitsB + 400 * UnitsC\nCost = 50 * UnitsA + 70 * UnitsB + 90 * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # Monthly production capacity\nmodel.addCons(UnitsA >= 200)  # Market demand for DeviceA\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 90 * UnitsC <= 70000)  # Material budget\nmodel.addCons(UnitsB >= 2 * UnitsA)  # Strategic partnership requirement\nmodel.addCons(UnitsC <= 0.3 * (UnitsA + UnitsB + UnitsC))  # DeviceC production limit\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements.\n// {\"number of P1 packages\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 packages\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 packages\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of P4 packages\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"number of P5 packages\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each package type varies based on weight and volume. P1 weighs 5 kg and has a volume of 0.1 m\u00b3, P2 weighs 10 kg and has a volume of 0.2 m\u00b3, P3 weighs 15 kg and has a volume of 0.3 m\u00b3, P4 weighs 20 kg and has a volume of 0.4 m\u00b3, and P5 weighs 25 kg and has a volume of 0.5 m\u00b3. The transportation cost per kg is $0.5, and the cost per m\u00b3 is $1. The company wants to minimize the total transportation cost.\n// Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total weight of packages in each warehouse must not exceed 1000 kg.\n// 5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000\n\n## Generate Constraint-2:\nThe total volume of packages in each warehouse must not exceed 200 m\u00b3.\n// 0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5 <= 200",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements. The weight, volume, and transportation costs per kg and per m\u00b3 for each package type are given in the following Table.\n\n| Package Type | Weight (kg) | Volume (m\u00b3) | Transportation Cost per kg ($) | Transportation Cost per m\u00b3 ($) |\n|--------------|-------------|-------------|--------------------------------|--------------------------------|\n| P1           | 5           | 0.1         | 0.5                            | 1                              |\n| P2           | 10          | 0.2         | 0.5                            | 1                              |\n| P3           | 15          | 0.3         | 0.5                            | 1                              |\n| P4           | 20          | 0.4         | 0.5                            | 1                              |\n| P5           | 25          | 0.5         | 0.5                            | 1                              |\n\nThe company wants to minimize the total transportation cost. The total weight of packages in each warehouse must not exceed 1000 kg, and the total volume of packages in each warehouse must not exceed 200 m\u00b3. Please help the company determine the optimal number of each type of package to distribute across the warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 packages\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 packages\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 packages\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of P4 packages\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # number of P5 packages\n\n# Define objective function\n## Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\nTotal_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total weight of packages in each warehouse must not exceed 1000 kg.\nmodel.addCons(5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000)\n## The total volume of packages in each warehouse must not exceed 200 m\u00b3.\nmodel.addCons(0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 packages: \", model.getVal(P1))\n    print(\"Number of P2 packages: \", model.getVal(P2))\n    print(\"Number of P3 packages: \", model.getVal(P3))\n    print(\"Number of P4 packages: \", model.getVal(P4))\n    print(\"Number of P5 packages: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1429,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe production capacity of DeviceA is limited to 2000 units.\n// UnitsA <= 2000\n\n## Generate Constraint-3:\nThe production capacity of DeviceB is limited to 1500 units.\n// UnitsB <= 1500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2. The company aims to maximize the total profit. The total available hours for all production lines is 1000 hours. The production capacity of DeviceA is limited to 2000 units, and the production capacity of DeviceB is limited to 1500 units.\nPlease help the company determine the optimal number of units and hours to allocate to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # hours allocated to DeviceC production line\n\n# Define objective function\n## Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n## Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n## Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 50 * UnitsA - 30 * HoursA\nProfit_B = 70 * UnitsB - 40 * HoursB\nProfit_C = 90 * UnitsC - 50 * HoursC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available hours for all production lines is 1000 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n## The production capacity of DeviceA is limited to 2000 units.\nmodel.addCons(UnitsA <= 2000)\n## The production capacity of DeviceB is limited to 1500 units.\nmodel.addCons(UnitsB <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The details of each truck type are given in the following Table.\n\n| Truck Type | Maintenance Cost per Day | Fuel Efficiency (miles per gallon) |\n|------------|--------------------------|------------------------------------|\n| Small      | $100                     | 10                                 |\n| Medium     | $200                     | 8                                  |\n| Large      | $300                     | 6                                  |\n\nThe company has a total of 50 drivers available. The operational cost includes maintenance and fuel costs, where fuel cost is calculated based on the number of drivers per truck and the fuel efficiency of each truck type.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks, and the number of drivers assigned to each type of truck to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)  # drivers per small truck\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)  # drivers per medium truck\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)  # drivers per large truck\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")  # fuel price per gallon\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\n# The company has a total of 50 drivers available.\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1315,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available per week.\n// DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE <= 1500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// DeviceA >= 100; DeviceB >= 100; DeviceC >= 100; DeviceD >= 100; DeviceE >= 100",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company has a total of 1000 labor hours available per week and 1500 units of raw material available per week. The company wants to ensure that at least 100 units of each device are produced to maintain market presence.\nPlease help the company to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency, which is defined as maximizing the total profit minus 0.01 times the square of labor hours plus the square of raw material usage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=100) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=100) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=100) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=100) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Convert the nonlinear terms to linear by introducing new variables and constraints\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\nLabor_squared = model.addVar(name=\"Labor_squared\")\nRawMaterial_squared = model.addVar(name=\"RawMaterial_squared\")\nmodel.addCons(Labor_squared == Labor**2)\nmodel.addCons(RawMaterial_squared == RawMaterial**2)\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - 0.01 * (Labor_squared + RawMaterial_squared))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n## The company has a total of 1500 units of raw material available per week.\nmodel.addCons(RawMaterial <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000\n\n## Generate Constraint-2:\nThe company has a total of 500 drivers available.\n// RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\n// RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)\n\n## Generate Constraint-4:\nThe company has a fuel budget of $50,000 per month.\n// 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000\n\n## Generate Constraint-5:\nThe company wants to limit the number of Heavy trucks to no more than 30% of the total fleet.\n// HeavyTrucks <= 0.3 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company has a budget of $10 million for purchasing trucks. The company has a total of 500 drivers available. The company wants to ensure that at least 20% of the fleet is Refrigerated trucks. The company has a fuel budget of $50,000 per month. The company wants to limit the number of Heavy trucks to no more than 30% of the total fleet.\nPlease help the company to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n# The company has a total of 500 drivers available.\nmodel.addCons(RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500)\n# The company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\nmodel.addCons(RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n# The company has a fuel budget of $50,000 per month.\nmodel.addCons(100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000)\n# The company wants to limit the number of Heavy trucks to no more than 30% of the total fleet.\nmodel.addCons(HeavyTrucks <= 0.3 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. Route 1 has a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 has 12 - 0.12 * T2, Route 3 has 15 - 0.15 * T3, Route 4 has 11 - 0.11 * T4, and Route 5 has 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time.\n// Fuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n// Time_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n// So, the objective function is: Minimize (Fuel_Cost + Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route varies with the number of trucks assigned: Route 1 has a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 has 12 - 0.12 * T2, Route 3 has 15 - 0.15 * T3, Route 4 has 11 - 0.11 * T4, and Route 5 has 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time. The company has a total of 50 trucks available. Please help the company to minimize the total cost of fuel and time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate Fuel_Cost and Time_Cost\nFuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\nTime_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n\n## the objective function is: Minimize (Fuel_Cost + Time_Cost)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Cost + Time_Cost)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $20, with a production cost of $10 and a resource usage of 3 units.\nFor component B, the profit per unit is $25, with a production cost of $12 and a resource usage of 4 units.\nFor component C, the profit per unit is $30, with a production cost of $15 and a resource usage of 5 units.\nFor component D, the profit per unit is $35, with a production cost of $18 and a resource usage of 6 units.\nFor component E, the profit per unit is $40, with a production cost of $20 and a resource usage of 7 units.\nThe company aims to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (3 * A + 4 * B + 5 * C + 6 * D + 7 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each component.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe company has a total resource capacity of 1500 units.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 1500\n\n## Generate Constraint-4:\nThe production of component D should not exceed the combined production of components A and B.\n// D <= A + B",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage. The profit per unit, production cost, and resource usage for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost | Resource Usage |\n|-----------|-----------------|-----------------|----------------|\n| A         | $20             | $10             | 3 units        |\n| B         | $25             | $12             | 4 units        |\n| C         | $30             | $15             | 5 units        |\n| D         | $35             | $18             | 6 units        |\n| E         | $40             | $20             | 7 units        |\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each component. The company has a total resource capacity of 1500 units. The production of component D should not exceed the combined production of components A and B. \nPlease help the company to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each component.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nResourceUsage = 3 * A + 4 * B + 5 * C + 6 * D + 7 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000)\n## The company has a total resource capacity of 1500 units.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 1500)\n## The production of component D should not exceed the combined production of components A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter.\n// Fuel_Cost_A = (0.1 - 0.001 * FuelA) * Distance_A * TruckA\n// Fuel_Cost_B = (0.12 - 0.001 * FuelB) * Distance_B * TruckB\n// Fuel_Cost_C = (0.15 - 0.001 * FuelC) * Distance_C * TruckC\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 kilometers.\n// (0.1 - 0.001 * FuelA) * Distance_A * TruckA + (0.12 - 0.001 * FuelB) * Distance_B * TruckB + (0.15 - 0.001 * FuelC) * Distance_C * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for purchasing trucks and allocating fuel.\n// TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of truck to purchase and the amount of fuel to allocate to each truck to minimize fuel costs while meeting delivery demands. The fuel efficiency of each truck type is affected by the amount of fuel allocated. TruckA consumes fuel at a rate of 0.1 liters per kilometer, but this rate decreases by 0.001 liters per kilometer for every additional liter of fuel allocated. TruckB consumes fuel at a rate of 0.12 liters per kilometer, with a similar decrease in consumption rate. TruckC consumes fuel at a rate of 0.15 liters per kilometer, also with a decrease in consumption rate. The company aims to minimize the total fuel cost, assuming a fuel price of $1 per liter. The total distance to be covered by all trucks is 5000 kilometers. The company has a budget of $10,000 for purchasing trucks and allocating fuel. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_A = (0.1 - 0.001 * FuelA) * TruckA\nFuel_Cost_B = (0.12 - 0.001 * FuelB) * TruckB\nFuel_Cost_C = (0.15 - 0.001 * FuelC) * TruckC\n## the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 kilometers.\nmodel.addCons((0.1 - 0.001 * FuelA) * TruckA + (0.12 - 0.001 * FuelB) * TruckB + (0.15 - 0.001 * FuelC) * TruckC == 5000)\n## The company has a budget of $10,000 for purchasing trucks and allocating fuel.\nmodel.addCons(TruckA + TruckB + TruckC + FuelA + FuelB + FuelC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck varies by region due to different road conditions and distances. In Region A, each truck can deliver 100 packages per day with a fuel cost of $50 per day. In Region B, each truck can deliver 120 packages per day with a fuel cost of $60 per day. In Region C, each truck can deliver 150 packages per day with a fuel cost of $70 per day. In Region D, each truck can deliver 130 packages per day with a fuel cost of $65 per day. In Region E, each truck can deliver 110 packages per day with a fuel cost of $55 per day. The company wants to maximize the total daily delivery volume while minimizing the total daily fuel cost.\n// Total daily delivery volume: Volume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\n// Total daily fuel cost: Cost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n// So, the objective function is: Maximize (Volume - Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $3000 per day for fuel.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000",
        "question": "A logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency. The efficiency of each truck varies by region due to different road conditions and distances. In Region A, each truck can deliver 100 packages per day with a fuel cost of $50 per day. In Region B, each truck can deliver 120 packages per day with a fuel cost of $60 per day. In Region C, each truck can deliver 150 packages per day with a fuel cost of $70 per day. In Region D, each truck can deliver 130 packages per day with a fuel cost of $65 per day. In Region E, each truck can deliver 110 packages per day with a fuel cost of $55 per day. The company has a total budget of $3000 per day for fuel.\n\nPlease help the company to maximize the total daily delivery volume while minimizing the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks in Region E\n\n# Define objective function\nVolume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\nCost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n# So, the objective function is: Maximize (Volume - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Volume - Cost)\n\n# Add constraints\n# The company has a total budget of $3000 per day for fuel.\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for textiles\": \"TextilesSpeed\", \"range\": \"TextilesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n// FuelConsumption_Electronics = k1 * ElectronicsSpeed^3 * ElectronicsTrucks\n// FuelConsumption_Perishables = k2 * PerishablesSpeed^3 * PerishablesTrucks\n// FuelConsumption_Textiles = k3 * TextilesSpeed^3 * TextilesTrucks\n// So, the objective function is: Minimize (FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel costs.\n// k1 * ElectronicsSpeed^3 * ElectronicsTrucks + k2 * PerishablesSpeed^3 * PerishablesTrucks + k3 * TextilesSpeed^3 * TextilesTrucks <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum fleet size of 50 trucks.\n// ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50\n\n## Generate Constraint-3:\nThe total daily travel time for all trucks must not exceed 12 hours.\n// (8 / ElectronicsSpeed) * ElectronicsTrucks + (8 / PerishablesSpeed) * PerishablesTrucks + (8 / TextilesSpeed) * TextilesTrucks <= 12\n\n## Generate Constraint-4:\nThe average speed of trucks transporting perishables must be at least 50 km/h to ensure freshness.\n// PerishablesSpeed >= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks. The company has a total budget of $10,000 per day for fuel costs. The company has a maximum fleet size of 50 trucks. The total daily travel time for all trucks must not exceed 12 hours. The average speed of trucks transporting perishables must be at least 50 km/h to ensure freshness. Please help the company to determine the optimal number of trucks and their speeds to meet these constraints while minimizing the total daily fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=50)\nTextilesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"TextilesSpeed\", lb=0)\n\n# Define objective function\nFuelConsumption_Electronics = model.addVar(name=\"FuelConsumption_Electronics\")\nFuelConsumption_Perishables = model.addVar(name=\"FuelConsumption_Perishables\")\nFuelConsumption_Textiles = model.addVar(name=\"FuelConsumption_Textiles\")\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\n\nmodel.addCons(FuelConsumption_Electronics == ElectronicsTrucks * ElectronicsSpeed**3)\nmodel.addCons(FuelConsumption_Perishables == PerishablesTrucks * PerishablesSpeed**3)\nmodel.addCons(FuelConsumption_Textiles == TextilesTrucks * TextilesSpeed**3)\nmodel.addCons(obj == FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks * ElectronicsSpeed**3 + PerishablesTrucks * PerishablesSpeed**3 + TextilesTrucks * TextilesSpeed**3 <= 10000)\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50)\nmodel.addCons((8 / ElectronicsSpeed) * ElectronicsTrucks + (8 / PerishablesSpeed) * PerishablesTrucks + (8 / TextilesSpeed) * TextilesTrucks <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Electronics Trucks: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Perishables Trucks: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Textiles Trucks: \", model.getVal(TextilesTrucks))\n    print(\"Electronics Speed: \", model.getVal(ElectronicsSpeed))\n    print(\"Perishables Speed: \", model.getVal(PerishablesSpeed))\n    print(\"Textiles Speed: \", model.getVal(TextilesSpeed))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"production quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\n// DeviceB_Quantity >= 2 * DeviceA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint of 800 units.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceC to fulfill a contractual obligation.\n// DeviceC_Quantity >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs. The company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA. The company has a storage capacity constraint of 800 units. The company must produce at least 50 units of DeviceC to fulfill a contractual obligation. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0) # production quantity of DeviceA\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0) # production quantity of DeviceB\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=50) # production quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\nProfit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\nProfit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n# Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\nmodel.addCons(DeviceB_Quantity >= 2 * DeviceA_Quantity)\n# The company has a storage capacity constraint of 800 units.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit.\n// Total profit: Profit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month.\n// 2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a fixed monthly budget for production costs, which is $2000.\n// 30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability. The profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. The company also has a fixed monthly budget for production costs, which is $2000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\nProfit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited amount of a critical component that is used in the production of all devices.\nmodel.addCons(2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150)\n# Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# The company has a fixed monthly budget for production costs, which is $2000.\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various costs and constraints.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the material cost is $40, and the production time is 1 hour.\nFor DeviceB, the selling price is $150, the material cost is $60, and the production time is 2 hours.\nFor DeviceC, the selling price is $200, the material cost is $80, and the production time is 3 hours.\nFor DeviceD, the selling price is $250, the material cost is $100, and the production time is 4 hours.\nThe company aims to maximize the total profit per hour of production.\n// Profit of DeviceA: Profit_A = (100 - 40) * A\n// Profit of DeviceB: Profit_B = (150 - 60) * B\n// Profit of DeviceC: Profit_C = (200 - 80) * C\n// Profit of DeviceD: Profit_D = (250 - 100) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs.\n// 40 * A + 60 * B + 80 * C + 100 * D <= 10,000\n\n## Generate Constraint-2:\nThe company has a maximum production capacity of 500 hours.\n// A + 2 * B + 3 * C + 4 * D <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\n// C <= A + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that at least 50 units of each device are produced.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various costs and constraints.\nFor DeviceA, the selling price is $100, the material cost is $40, and the production time is 1 hour.\nFor DeviceB, the selling price is $150, the material cost is $60, and the production time is 2 hours.\nFor DeviceC, the selling price is $200, the material cost is $80, and the production time is 3 hours.\nFor DeviceD, the selling price is $250, the material cost is $100, and the production time is 4 hours.\nThe company has a total budget of $10,000 for material costs. The company has a maximum production capacity of 500 hours. The company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB. The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC. The company wants to ensure that at least 50 units of each device are produced.\nPlease help the company to maximize the total profit per hour of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 40) * A\nProfit_B = (150 - 60) * B\nProfit_C = (200 - 80) * C\nProfit_D = (250 - 100) * D\nProductionTime = A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for material costs.\nmodel.addCons(40 * A + 60 * B + 80 * C + 100 * D <= 10000)\n## The company has a maximum production capacity of 500 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D <= 500)\n## The company wants to ensure that the production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\nmodel.addCons(C <= A + B)\n## The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit.\n// {\"hours machine 1 works on product 1\": \"M1P1\", \"range\": \"M1P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 1\": \"M2P1\", \"range\": \"M2P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 1\": \"M3P1\", \"range\": \"M3P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 1\": \"M4P1\", \"range\": \"M4P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 2\": \"M1P2\", \"range\": \"M1P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 2\": \"M2P2\", \"range\": \"M2P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 2\": \"M3P2\", \"range\": \"M3P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 2\": \"M4P2\", \"range\": \"M4P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 3\": \"M1P3\", \"range\": \"M1P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 3\": \"M2P3\", \"range\": \"M2P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 3\": \"M3P3\", \"range\": \"M3P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 3\": \"M4P3\", \"range\": \"M4P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per hour for each product. The profit per hour for product 1 on machine 1 is $100, on machine 2 is $120, on machine 3 is $110, and on machine 4 is $130. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. The objective is to maximize the total profit from all products.\n// The objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n## Generate Constraint-1:\nEach machine can operate a maximum of 100 hours per week.\n// M1P1 + M1P2 + M1P3 <= 100; M2P1 + M2P2 + M2P3 <= 100; M3P1 + M3P2 + M3P3 <= 100; M4P1 + M4P2 + M4P3 <= 100",
        "question": "A manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit. The profit per hour for each product on each machine is given in the following Table.\n\n| Machine | Product 1 Profit/Hour | Product 2 Profit/Hour | Product 3 Profit/Hour |\n|---------|-----------------------|-----------------------|-----------------------|\n| 1       | 100$                  | 150$                  | 200$                  |\n| 2       | 120$                  | 160$                  | 210$                  |\n| 3       | 110$                  | 140$                  | 190$                  |\n| 4       | 130$                  | 170$                  | 220$                  |\n\nEach machine can operate a maximum of 100 hours per week. Please help the plant manager to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P1\", lb=0) # hours machine 1 works on product 1\nM2P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P1\", lb=0) # hours machine 2 works on product 1\nM3P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P1\", lb=0) # hours machine 3 works on product 1\nM4P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P1\", lb=0) # hours machine 4 works on product 1\nM1P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P2\", lb=0) # hours machine 1 works on product 2\nM2P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P2\", lb=0) # hours machine 2 works on product 2\nM3P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P2\", lb=0) # hours machine 3 works on product 2\nM4P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P2\", lb=0) # hours machine 4 works on product 2\nM1P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P3\", lb=0) # hours machine 1 works on product 3\nM2P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P3\", lb=0) # hours machine 2 works on product 3\nM3P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P3\", lb=0) # hours machine 3 works on product 3\nM4P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P3\", lb=0) # hours machine 4 works on product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\nmodel.addCons(obj == 100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1 + 150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2 + 200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n# Add constraints\n## Each machine can operate a maximum of 100 hours per week.\nmodel.addCons(M1P1 + M1P2 + M1P3 <= 100)\nmodel.addCons(M2P1 + M2P2 + M2P3 <= 100)\nmodel.addCons(M3P1 + M3P2 + M3P3 <= 100)\nmodel.addCons(M4P1 + M4P2 + M4P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 works on Product 1: \", model.getVal(M1P1))\n    print(\"Hours Machine 2 works on Product 1: \", model.getVal(M2P1))\n    print(\"Hours Machine 3 works on Product 1: \", model.getVal(M3P1))\n    print(\"Hours Machine 4 works on Product 1: \", model.getVal(M4P1))\n    print(\"Hours Machine 1 works on Product 2: \", model.getVal(M1P2))\n    print(\"Hours Machine 2 works on Product 2: \", model.getVal(M2P2))\n    print(\"Hours Machine 3 works on Product 2: \", model.getVal(M3P2))\n    print(\"Hours Machine 4 works on Product 2: \", model.getVal(M4P2))\n    print(\"Hours Machine 1 works on Product 3: \", model.getVal(M1P3))\n    print(\"Hours Machine 2 works on Product 3: \", model.getVal(M2P3))\n    print(\"Hours Machine 3 works on Product 3: \", model.getVal(M3P3))\n    print(\"Hours Machine 4 works on Product 3: \", model.getVal(M4P3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for device A is 0.01 * A^2, for device B is 0.02 * B^2, and for device C is 0.03 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs next month.\n// 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2 <= 5000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce next month to optimize its profit margin. The profit per unit for device A is $50, for device B is $70, and for device C is $90. The production cost for each device increases nonlinearly with the number of units produced due to economies of scale, with the cost for device A being 0.01 * A^2, for device B being 0.02 * B^2, and for device C being 0.03 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the production cost.\n\n| Device | Profit per Unit | Production Cost Formula |\n|--------|-----------------|-------------------------|\n| A      | $50             | 0.01 * A^2              |\n| B      | $70             | 0.02 * B^2              |\n| C      | $90             | 0.03 * C^2              |\n\nThe company has a budget of $5000 for production costs next month. Please help the company to determine the optimal number of units of each device to produce to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## The company has a budget of $5000 for production costs next month.\nmodel.addCons(0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. Each type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck. The company has a total budget of $150,000 for operational costs for the month. The company also has a limit of 100 trucks that can be deployed in total. Please help the company to maximize the total daily net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine how many of each type of truck to purchase.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue potentials. TruckA has an annual operational cost of $50,000 and generates $80,000 in revenue. TruckB has an annual operational cost of $60,000 and generates $90,000 in revenue. TruckC has an annual operational cost of $70,000 and generates $100,000 in revenue. TruckD has an annual operational cost of $80,000 and generates $110,000 in revenue. TruckE has an annual operational cost of $90,000 and generates $120,000 in revenue. The company wants to maximize the total net profit from all trucks.\n// Total net profit for TruckA: Profit_TruckA = (80,000 - 50,000) * TruckANum\n// Total net profit for TruckB: Profit_TruckB = (90,000 - 60,000) * TruckBNum\n// Total net profit for TruckC: Profit_TruckC = (100,000 - 70,000) * TruckCNum\n// Total net profit for TruckD: Profit_TruckD = (110,000 - 80,000) * TruckDNum\n// Total net profit for TruckE: Profit_TruckE = (120,000 - 90,000) * TruckENum\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks.\n// 100,000 * TruckANum + 120,000 * TruckBNum + 150,000 * TruckCNum + 180,000 * TruckDNum + 200,000 * TruckENum <= 2,000,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of trucks cannot exceed 20.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 20",
        "question": "A logistics company is planning its fleet for the next year, considering five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine how many of each type of truck to purchase. The operational costs and revenue potentials for each type of truck are given in the following Table.\n\n| Truck Type | Annual Operational Cost | Annual Revenue | Purchase Cost |\n|------------|-------------------------|----------------|---------------|\n| TruckA     | $50,000                  | $80,000        | $100,000      |\n| TruckB     | $60,000                  | $90,000        | $120,000      |\n| TruckC     | $70,000                  | $100,000       | $150,000      |\n| TruckD     | $80,000                  | $110,000       | $180,000      |\n| TruckE     | $90,000                  | $120,000       | $200,000      |\n\nThe company has a budget of $2,000,000 for purchasing new trucks. Due to maintenance constraints, the total number of trucks cannot exceed 20. The company wants to maximize the total net profit from all trucks. Please help the company determine the optimal number of each type of truck to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\nProfit_TruckA = (80000 - 50000) * TruckANum\nProfit_TruckB = (90000 - 60000) * TruckBNum\nProfit_TruckC = (100000 - 70000) * TruckCNum\nProfit_TruckD = (110000 - 80000) * TruckDNum\nProfit_TruckE = (120000 - 90000) * TruckENum\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\nmodel.addCons(100000 * TruckANum + 120000 * TruckBNum + 150000 * TruckCNum + 180000 * TruckDNum + 200000 * TruckENum <= 2000000)\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"HydroPlants\", \"range\": \"HydroPlants >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"BiomassGenerators\", \"range\": \"BiomassGenerators >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal stations\": \"GeothermalStations\", \"range\": \"GeothermalStations >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city wants to minimize the cost per unit of energy produced.\n// Total cost: Cost = 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations\n// Total energy produced: Energy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for installing renewable energy sources.\n// 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations <= 1,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 30,000 MWh of energy annually.\n// 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations >= 30,000\n\n## Generate Constraint-3:\nThe city has space to install a maximum of 100 units of any type of energy source.\n// SolarPanels <= 100; WindTurbines <= 100; HydroPlants <= 100; BiomassGenerators <= 100; GeothermalStations <= 100\n\n## Generate Constraint-4:\nThe city wants to ensure a diversified energy portfolio, requiring at least one unit of each type of energy source.\n// SolarPanels >= 1; WindTurbines >= 1; HydroPlants >= 1; BiomassGenerators >= 1; GeothermalStations >= 1",
        "question": "A city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost. The cost per unit and annual energy production for each type of energy source are given in the following Table.\n\n| Energy Source         | Cost per Unit | Annual Energy Production |\n|-----------------------|---------------|--------------------------|\n| Solar Panels          | $10,000       | 20 MWh                   |\n| Wind Turbines         | $15,000       | 30 MWh                   |\n| Hydroelectric Plants  | $20,000       | 40 MWh                   |\n| Biomass Generators    | $12,000       | 25 MWh                   |\n| Geothermal Stations   | $25,000       | 50 MWh                   |\n\nThe city has a budget of $1,000,000 for installing renewable energy sources. The city aims to produce at least 30,000 MWh of energy annually. The city has space to install a maximum of 100 units of any type of energy source. The city wants to ensure a diversified energy portfolio, requiring at least one unit of each type of energy source. \n\nPlease help the city to minimize the cost per unit of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=1, ub=100)\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=1, ub=100)\nHydroPlants = model.addVar(vtype=\"INTEGER\", name=\"HydroPlants\", lb=1, ub=100)\nBiomassGenerators = model.addVar(vtype=\"INTEGER\", name=\"BiomassGenerators\", lb=1, ub=100)\nGeothermalStations = model.addVar(vtype=\"INTEGER\", name=\"GeothermalStations\", lb=1, ub=100)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 10000 * SolarPanels + 15000 * WindTurbines + 20000 * HydroPlants + 12000 * BiomassGenerators + 25000 * GeothermalStations\nEnergy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for installing renewable energy sources.\nmodel.addCons(Cost <= 1000000)\n## The city aims to produce at least 30,000 MWh of energy annually.\nmodel.addCons(Energy >= 30000)\n## The city has space to install a maximum of 100 units of any type of energy source.\nmodel.addCons(SolarPanels <= 100)\nmodel.addCons(WindTurbines <= 100)\nmodel.addCons(HydroPlants <= 100)\nmodel.addCons(BiomassGenerators <= 100)\nmodel.addCons(GeothermalStations <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(HydroPlants))\n    print(\"Number of Biomass Generators: \", model.getVal(BiomassGenerators))\n    print(\"Number of Geothermal Stations: \", model.getVal(GeothermalStations))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the marketing budget for each product to enhance sales.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgA\", \"range\": \"MktgA >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductB\": \"MktgB\", \"range\": \"MktgB >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductC\": \"MktgC\", \"range\": \"MktgC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n// Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n// Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 2000 units across all products.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe total marketing budget must not exceed $20,000.\n// MktgA + MktgB + MktgC <= 20,000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA must be at least 20% of the total production.\n// ProdA >= 0.2 * (ProdA + ProdB + ProdC)",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the marketing budget for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit, cost of raw materials per unit, labor cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|----------------------------|---------------------|-----------------------|\n| ProductA | $50            | $20                        | $10                 | $5                    |\n| ProductB | $70            | $30                        | $15                 | $5                    |\n| ProductC | $60            | $25                        | $12                 | $5                    |\n\nThe marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company has a total budget of $100,000 for raw materials and labor. The storage capacity is limited to 2000 units across all products. The total marketing budget must not exceed $20,000. Due to market demand, the production of ProductA must be at least 20% of the total production.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product and the marketing budget for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMktgA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgA\", lb=0) # marketing budget for ProductA\nMktgB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgB\", lb=0) # marketing budget for ProductB\nMktgC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n## Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n## Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\nProfit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\nProfit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100000)\n## The storage capacity is limited to 2000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n## The total marketing budget must not exceed $20,000.\nmodel.addCons(MktgA + MktgB + MktgC <= 20000)\n## Due to market demand, the production of ProductA must be at least 20% of the total production.\nmodel.addCons(ProdA >= 0.2 * (ProdA + ProdB + ProdC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1606,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. The company aims to maximize the total profit per unit of fuel consumed.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\n// So, the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per week.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trips are made by each type of truck per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 500 hours available for all trucks to operate per week.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E. The profit per trip and fuel consumption for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Consumption |\n|------------|-----------------|------------------|\n| A          | $500            | 10 liters        |\n| B          | $700            | 15 liters        |\n| C          | $900            | 20 liters        |\n| D          | $1100           | 25 liters        |\n| E          | $1300           | 30 liters        |\n\nThe company has a budget of $10,000 for fuel costs per week. The company wants to ensure that at least 5 trips are made by each type of truck per week. The company has a total of 500 hours available for all trucks to operate per week. The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C. \nPlease help the company to maximize the total profit per unit of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trips are made by each type of truck per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\nFuelConsumption = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n## the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n## The company has a total of 500 hours available for all trucks to operate per week.\nmodel.addCons(A + B + C + D + E <= 500)\n## The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost reduction per unit of product is affected by the investment in automation.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkA\", \"range\": \"WorkA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkB\", \"range\": \"WorkB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkC\", \"range\": \"WorkC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The investment in automation reduces the labor cost per unit by $0.01 for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce size across all products must not exceed 100 employees.\n// WorkA + WorkB + WorkC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost reduction per unit of product is affected by the investment in automation. The labor cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The investment in automation reduces the labor cost per unit by $0.01 for every $1,000 invested. The company aims to maximize the total profit from all products.\n\n| Product | Labor Cost per Unit | Revenue per Unit |\n|---------|---------------------|------------------|\n| ProductA | $50                 | $100             |\n| ProductB | $70                 | $150             |\n| ProductC | $90                 | $200             |\n\nThe total workforce size across all products must not exceed 100 employees. Please help the company determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0)  # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0)  # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production quantity of ProductC\nWorkA = model.addVar(vtype=\"INTEGER\", name=\"WorkA\", lb=0)  # workforce size for ProductA\nWorkB = model.addVar(vtype=\"INTEGER\", name=\"WorkB\", lb=0)  # workforce size for ProductB\nWorkC = model.addVar(vtype=\"INTEGER\", name=\"WorkC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * Automation) * ProdA\nProfitB = (150 - 70 + 0.0001 * Automation) * ProdB\nProfitC = (200 - 90 + 0.0001 * Automation) * ProdC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkA + WorkB + WorkC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of public facilities: a library, a park, a community center, a sports complex, and a museum. The city council needs to decide how much to invest in each facility to maximize the overall utility while adhering to budget constraints and other requirements.\n// {\"investment in the library\": \"LibraryInvestment\", \"range\": \"LibraryInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the park\": \"ParkInvestment\", \"range\": \"ParkInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the community center\": \"CommunityCenterInvestment\", \"range\": \"CommunityCenterInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the sports complex\": \"SportsComplexInvestment\", \"range\": \"SportsComplexInvestment >= 0\", \"type\": \"real\"}\n// {\"investment in the museum\": \"MuseumInvestment\", \"range\": \"MuseumInvestment >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe utility of each facility is modeled as a nonlinear function of investment:\n- Library: Utility = 100 * sqrt(LibraryInvestment)\n- Park: Utility = 150 * sqrt(ParkInvestment)\n- Community Center: Utility = 200 * sqrt(CommunityCenterInvestment)\n- Sports Complex: Utility = 250 * sqrt(SportsComplexInvestment)\n- Museum: Utility = 300 * sqrt(MuseumInvestment)\nThe city council wants to maximize the total utility of all facilities.\n// So, the objective function is: Maximize (100 * sqrt(LibraryInvestment) + 150 * sqrt(ParkInvestment) + 200 * sqrt(CommunityCenterInvestment) + 250 * sqrt(SportsComplexInvestment) + 300 * sqrt(MuseumInvestment))\n\n## Generate Constraint-1:\nThe total budget for all facilities is $500,000.\n// LibraryInvestment + ParkInvestment + CommunityCenterInvestment + SportsComplexInvestment + MuseumInvestment <= 500000\n\n## Generate Constraint-2:\nAt least $50,000 must be invested in the library.\n// LibraryInvestment >= 50000\n\n## Generate Constraint-3:\nThe investment in the park must be at least twice the investment in the museum.\n// ParkInvestment >= 2 * MuseumInvestment",
        "question": "A city is planning to build five different types of public facilities: a library, a park, a community center, a sports complex, and a museum. The city council needs to decide how much to invest in each facility to maximize the overall utility while adhering to budget constraints and other requirements.\nThe utility of each facility is modeled as a nonlinear function of investment:\n- Library: Utility = 100 * sqrt(LibraryInvestment)\n- Park: Utility = 150 * sqrt(ParkInvestment)\n- Community Center: Utility = 200 * sqrt(CommunityCenterInvestment)\n- Sports Complex: Utility = 250 * sqrt(SportsComplexInvestment)\n- Museum: Utility = 300 * sqrt(MuseumInvestment)\nThe city council wants to maximize the total utility of all facilities.\nThe total budget for all facilities is $500,000. At least $50,000 must be invested in the library. The investment in the park must be at least twice the investment in the museum.\nPlease help the city council determine the optimal investment amounts for each facility to maximize the total utility.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLibraryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"LibraryInvestment\", lb=50000)\nParkInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"ParkInvestment\", lb=0)\nCommunityCenterInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"CommunityCenterInvestment\", lb=0)\nSportsComplexInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsComplexInvestment\", lb=0)\nMuseumInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MuseumInvestment\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * sqrt(LibraryInvestment) + 150 * sqrt(ParkInvestment) + 200 * sqrt(CommunityCenterInvestment) + 250 * sqrt(SportsComplexInvestment) + 300 * sqrt(MuseumInvestment))\n## convert the square root to a variable\nsqrt_LibraryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_LibraryInvestment\")\nsqrt_ParkInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_ParkInvestment\")\nsqrt_CommunityCenterInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_CommunityCenterInvestment\")\nsqrt_SportsComplexInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_SportsComplexInvestment\")\nsqrt_MuseumInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MuseumInvestment\")\nmodel.addCons(sqrt_LibraryInvestment**2 == LibraryInvestment)\nmodel.addCons(sqrt_ParkInvestment**2 == ParkInvestment)\nmodel.addCons(sqrt_CommunityCenterInvestment**2 == CommunityCenterInvestment)\nmodel.addCons(sqrt_SportsComplexInvestment**2 == SportsComplexInvestment)\nmodel.addCons(sqrt_MuseumInvestment**2 == MuseumInvestment)\nmodel.addCons(obj == 100 * sqrt_LibraryInvestment + 150 * sqrt_ParkInvestment + 200 * sqrt_CommunityCenterInvestment + 250 * sqrt_SportsComplexInvestment + 300 * sqrt_MuseumInvestment)\n\n# Add constraints\nmodel.addCons(LibraryInvestment + ParkInvestment + CommunityCenterInvestment + SportsComplexInvestment + MuseumInvestment <= 500000)\nmodel.addCons(ParkInvestment >= 2 * MuseumInvestment)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in the Library: \", model.getVal(LibraryInvestment))\n    print(\"Investment in the Park: \", model.getVal(ParkInvestment))\n    print(\"Investment in the Community Center: \", model.getVal(CommunityCenterInvestment))\n    print(\"Investment in the Sports Complex: \", model.getVal(SportsComplexInvestment))\n    print(\"Investment in the Museum: \", model.getVal(MuseumInvestment))\n    print(\"Maximized Total Utility: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, each panel generates 150 kWh annually with a cost of $100 per panel and a carbon offset of 0.5 tons. In D2, each panel generates 120 kWh annually with a cost of $120 per panel and a carbon offset of 0.4 tons. In D3, each panel generates 180 kWh annually with a cost of $110 per panel and a carbon offset of 0.6 tons. In D4, each panel generates 160 kWh annually with a cost of $130 per panel and a carbon offset of 0.5 tons. In D5, each panel generates 140 kWh annually with a cost of $140 per panel and a carbon offset of 0.4 tons. The city aims to maximize the energy production efficiency (total energy generated per total cost).\n// Total_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\n// Total_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n// So, the objective function is: Maximize Total_Energy / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total carbon offset should be at least 200 tons.\n// 0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed in D1 and D2 combined is 500.\n// D1 + D2 <= 500",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. The details for each district are given in the following Table.\n\n| District | Annual Energy Generation per Panel (kWh) | Cost per Panel ($) | Carbon Offset per Panel (tons) |\n|----------|------------------------------------------|--------------------|--------------------------------|\n| D1       | 150                                      | 100                | 0.5                            |\n| D2       | 120                                      | 120                | 0.4                            |\n| D3       | 180                                      | 110                | 0.6                            |\n| D4       | 160                                      | 130                | 0.5                            |\n| D5       | 140                                      | 140                | 0.4                            |\n\nThe city has a budget of $100,000 for the installation of solar panels. The total carbon offset should be at least 200 tons. The maximum number of panels that can be installed in D1 and D2 combined is 500. \nPlease help the city to maximize the energy production efficiency (total energy generated per total cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\nTotal_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n## the objective function is: Maximize Total_Energy / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Energy)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000)\n## The total carbon offset should be at least 200 tons.\nmodel.addCons(0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200)\n## The maximum number of panels that can be installed in D1 and D2 combined is 500.\nmodel.addCons(D1 + D2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1504,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $25. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $6. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceAQty\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceBQty\n// Total net profit for DeviceC: Profit_DeviceC = (60 - 25 - 6) * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAQty >= 2 * DeviceBQty\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs per day.\n// 20 * DeviceAQty + 30 * DeviceBQty + 25 * DeviceCQty <= 50,000\n\n## Generate Constraint-4:\nThe storage space available is limited to 800 units.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 800",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $25. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $6. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs. The company has a limited production capacity of 1000 units per day. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $50,000 for production costs per day. The storage space available is limited to 800 units. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceAQty\nProfit_DeviceB = (70 - 30 - 7) * DeviceBQty\nProfit_DeviceC = (60 - 25 - 6) * DeviceCQty\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 1000)\n# Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAQty >= 2 * DeviceBQty)\n# The company has a budget of $50,000 for production costs per day.\nmodel.addCons(20 * DeviceAQty + 30 * DeviceBQty + 25 * DeviceCQty <= 50000)\n# The storage space available is limited to 800 units.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The company needs to optimize its production to maximize profit while considering resource limitations and market demands.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The company aims to maximize the total profit from selling these components.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The company aims to maximize the total profit from selling these components. The total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50. Please help the company optimize its production to maximize profit while considering the given resource limitation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 545,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepsA\", \"range\": \"SalesRepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepsB\", \"range\": \"SalesRepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepsC\", \"range\": \"SalesRepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\n// Total revenue for ProductB: RevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\n// Total revenue for ProductC: RevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives, and is calculated using the formula: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n\n| Product | Production Quantity | Marketing Budget | Number of Sales Representatives |\n|---------|---------------------|------------------|---------------------------------|\n| ProductA | QuantityA          | MarketingBudgetA | SalesRepsA                      |\n| ProductB | QuantityB          | MarketingBudgetB | SalesRepsB                      |\n| ProductC | QuantityC          | MarketingBudgetC | SalesRepsC                      |\n\nThe total marketing budget for all products cannot exceed $100,000.\n\nPlease help the company to determine the optimal production quantity, marketing budget, and number of sales representatives for each product to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nSalesRepsA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsA\", lb=0)  # number of sales representatives for ProductA\nSalesRepsB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsB\", lb=0)  # number of sales representatives for ProductB\nSalesRepsC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsC\", lb=0)  # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\nRevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\nRevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Sales Reps for ProductA: \", model.getVal(SalesRepsA))\n    print(\"Number of Sales Reps for ProductB: \", model.getVal(SalesRepsB))\n    print(\"Number of Sales Reps for ProductC: \", model.getVal(SalesRepsC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. \nOn route 1, each additional truck improves fuel efficiency by 0.5% per mile. \nOn route 2, each additional truck improves fuel efficiency by 0.7% per mile. \nOn route 3, each additional truck improves fuel efficiency by 0.6% per mile. \nOn route 4, each additional truck improves fuel efficiency by 0.8% per mile. \nOn route 5, each additional truck improves fuel efficiency by 0.4% per mile. \nThe company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time.\n// Fuel_Consumption_Route_1 = (1 - 0.005 * T1) * D1\n// Fuel_Consumption_Route_2 = (1 - 0.007 * T2) * D2\n// Fuel_Consumption_Route_3 = (1 - 0.006 * T3) * D3\n// Fuel_Consumption_Route_4 = (1 - 0.008 * T4) * D4\n// Fuel_Consumption_Route_5 = (1 - 0.004 * T5) * D5\n// So, the objective function is: Minimize (Fuel_Consumption_Route_1 + Fuel_Consumption_Route_2 + Fuel_Consumption_Route_3 + Fuel_Consumption_Route_4 + Fuel_Consumption_Route_5)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route must have at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. The fuel efficiency of each route varies with the number of trucks assigned. On route 1, each additional truck improves fuel efficiency by 0.5% per mile. On route 2, each additional truck improves fuel efficiency by 0.7% per mile. On route 3, each additional truck improves fuel efficiency by 0.6% per mile. On route 4, each additional truck improves fuel efficiency by 0.8% per mile. On route 5, each additional truck improves fuel efficiency by 0.4% per mile. The company wants to minimize the total fuel consumption while ensuring all packages are delivered within a specified time. The total number of trucks available is 100. Each route must have at least one truck. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1)  # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1)  # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1)  # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1)  # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1)  # number of trucks on route 5\n\n# Define objective function\n# Fuel efficiency improvements\nFuel_Consumption_Route_1 = (1 - 0.005 * T1)  # Fuel efficiency for route 1\nFuel_Consumption_Route_2 = (1 - 0.007 * T2)  # Fuel efficiency for route 2\nFuel_Consumption_Route_3 = (1 - 0.006 * T3)  # Fuel efficiency for route 3\nFuel_Consumption_Route_4 = (1 - 0.008 * T4)  # Fuel efficiency for route 4\nFuel_Consumption_Route_5 = (1 - 0.004 * T5)  # Fuel efficiency for route 5\n\n# Assuming D1, D2, D3, D4, D5 are the distances for each route\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\")  # Distance for route 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\")  # Distance for route 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\")  # Distance for route 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\")  # Distance for route 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\")  # Distance for route 5\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Route_1 * D1 + Fuel_Consumption_Route_2 * D2 + Fuel_Consumption_Route_3 * D3 + Fuel_Consumption_Route_4 * D4 + Fuel_Consumption_Route_5 * D5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)  # Total number of trucks available\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"speed of TruckA\": \"SpeedA\", \"range\": \"0 < SpeedA <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckB\": \"SpeedB\", \"range\": \"0 < SpeedB <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckC\": \"SpeedC\", \"range\": \"0 < SpeedC <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe total cargo capacity required for the route is 100 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 100\n\n## Generate Constraint-2:\nThe company has a budget constraint of $5000 for vehicle deployment.\n// 1000 * TruckA + 1500 * TruckB + 2000 * TruckC <= 5000\n\n## Generate Constraint-3:\nDue to safety regulations, the combined speed of all trucks must not exceed 150 km/h.\n// SpeedA * TruckA + SpeedB * TruckB + SpeedC * TruckC <= 150",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption. The fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n\n| Vehicle | Cargo Capacity | Cost per Vehicle |\n|---------|----------------|------------------|\n| TruckA  | 10 tons        | $1000            |\n| TruckB  | 15 tons        | $1500            |\n| TruckC  | 20 tons        | $2000            |\n\nThe total cargo capacity required for the route is 100 tons. The company has a budget constraint of $5000 for vehicle deployment. Due to safety regulations, the combined speed of all trucks must not exceed 150 km/h. Please help the company to determine the optimal number of each type of vehicle and their respective speeds to minimize total fuel consumption while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nSpeedA = model.addVar(name=\"SpeedA\", lb=0.01, ub=60)  # speed of TruckA\nSpeedB = model.addVar(name=\"SpeedB\", lb=0.01, ub=60)  # speed of TruckB\nSpeedC = model.addVar(name=\"SpeedC\", lb=0.01, ub=60)  # speed of TruckC\n\n# Define objective function\nFuelA = 0.05 * SpeedA**2 * TruckA\nFuelB = 0.03 * SpeedB**2 * TruckB\nFuelC = 0.04 * SpeedC**2 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 100)  # total cargo capacity constraint\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 2000 * TruckC <= 5000)  # budget constraint\nmodel.addCons(SpeedA * TruckA + SpeedB * TruckB + SpeedC * TruckC <= 150)  # speed constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Speed of TruckA: \", model.getVal(SpeedA))\n    print(\"Speed of TruckB: \", model.getVal(SpeedB))\n    print(\"Speed of TruckC: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region.\n// {\"number of trucks allocated to region 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 6\": \"Truck6\", \"range\": \"Truck6 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 1\": \"Driver1\", \"range\": \"Driver1 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 2\": \"Driver2\", \"range\": \"Driver2 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 3\": \"Driver3\", \"range\": \"Driver3 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 4\": \"Driver4\", \"range\": \"Driver4 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 5\": \"Driver5\", \"range\": \"Driver5 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 6\": \"Driver6\", \"range\": \"Driver6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n// Total profit for region 1: Profit1 = (50,000 - 20,000 * Driver1) * Truck1\n// Total profit for region 2: Profit2 = (60,000 - 20,000 * Driver2) * Truck2\n// Total profit for region 3: Profit3 = (70,000 - 20,000 * Driver3) * Truck3\n// Total profit for region 4: Profit4 = (80,000 - 20,000 * Driver4) * Truck4\n// Total profit for region 5: Profit5 = (90,000 - 20,000 * Driver5) * Truck5\n// Total profit for region 6: Profit6 = (100,000 - 20,000 * Driver6) * Truck6\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n\n| Region | Profit per Truck | Cost per Driver |\n|--------|------------------|-----------------|\n| 1      | $50,000          | $20,000         |\n| 2      | $60,000          | $20,000         |\n| 3      | $70,000          | $20,000         |\n| 4      | $80,000          | $20,000         |\n| 5      | $90,000          | $20,000         |\n| 6      | $100,000         | $20,000         |\n\nThe company has a total of 50 trucks available for allocation. The company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. Please help the company determine the optimal allocation of trucks and hiring of additional drivers to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks allocated to region 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks allocated to region 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks allocated to region 3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks allocated to region 4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks allocated to region 5\nTruck6 = model.addVar(vtype=\"INTEGER\", name=\"Truck6\", lb=0) # number of trucks allocated to region 6\nDriver1 = model.addVar(vtype=\"INTEGER\", name=\"Driver1\", lb=0) # number of additional drivers hired for region 1\nDriver2 = model.addVar(vtype=\"INTEGER\", name=\"Driver2\", lb=0) # number of additional drivers hired for region 2\nDriver3 = model.addVar(vtype=\"INTEGER\", name=\"Driver3\", lb=0) # number of additional drivers hired for region 3\nDriver4 = model.addVar(vtype=\"INTEGER\", name=\"Driver4\", lb=0) # number of additional drivers hired for region 4\nDriver5 = model.addVar(vtype=\"INTEGER\", name=\"Driver5\", lb=0) # number of additional drivers hired for region 5\nDriver6 = model.addVar(vtype=\"INTEGER\", name=\"Driver6\", lb=0) # number of additional drivers hired for region 6\n\n# Define objective function\nProfit1 = (50000 - 20000 * Driver1) * Truck1\nProfit2 = (60000 - 20000 * Driver2) * Truck2\nProfit3 = (70000 - 20000 * Driver3) * Truck3\nProfit4 = (80000 - 20000 * Driver4) * Truck4\nProfit5 = (90000 - 20000 * Driver5) * Truck5\nProfit6 = (100000 - 20000 * Driver6) * Truck6\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(Truck5))\n    print(\"Number of Trucks in Region 6: \", model.getVal(Truck6))\n    print(\"Number of Drivers in Region 1: \", model.getVal(Driver1))\n    print(\"Number of Drivers in Region 2: \", model.getVal(Driver2))\n    print(\"Number of Drivers in Region 3: \", model.getVal(Driver3))\n    print(\"Number of Drivers in Region 4: \", model.getVal(Driver4))\n    print(\"Number of Drivers in Region 5: \", model.getVal(Driver5))\n    print(\"Number of Drivers in Region 6: \", model.getVal(Driver6))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1331,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for each truck on Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n// Fuel consumption for Route1: Consumption1 = (Fuel1^2 / (Trucks1 * 100))\n// Fuel consumption for Route2: Consumption2 = (Fuel2^2 / (Trucks2 * 100))\n// Fuel consumption for Route3: Consumption3 = (Fuel3^2 / (Trucks3 * 100))\n// Fuel consumption for Route4: Consumption4 = (Fuel4^2 / (Trucks4 * 100))\n// Fuel consumption for Route5: Consumption5 = (Fuel5^2 / (Trucks5 * 100))\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $100,000.\n// Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 200",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries. The company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n\n| Route | Fuel Consumption Function |\n|-------|---------------------------|\n| Route1 | Consumption1 = (Fuel1^2 / (Trucks1 * 100)) |\n| Route2 | Consumption2 = (Fuel2^2 / (Trucks2 * 100)) |\n| Route3 | Consumption3 = (Fuel3^2 / (Trucks3 * 100)) |\n| Route4 | Consumption4 = (Fuel4^2 / (Trucks4 * 100)) |\n| Route5 | Consumption5 = (Fuel5^2 / (Trucks5 * 100)) |\n\nThe company has a total fuel budget of $100,000. The total number of trucks available is limited to 200. Please help the company to determine the optimal number of trucks to deploy on each route and the amount of fuel to allocate to each truck to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)\n\n# Define objective function\nConsumption1 = (Fuel1**2) / (Trucks1 * 100)\nConsumption2 = (Fuel2**2) / (Trucks2 * 100)\nConsumption3 = (Fuel3**2) / (Trucks3 * 100)\nConsumption4 = (Fuel4**2) / (Trucks4 * 100)\nConsumption5 = (Fuel5**2) / (Trucks5 * 100)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n# Add constraints\nmodel.addCons(Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Fuel Allocation for Route4: \", model.getVal(Fuel4))\n    print(\"Fuel Allocation for Route5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Residential\": \"TechUpgradeResidential\", \"range\": \"TechUpgradeResidential >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Commercial\": \"TechUpgradeCommercial\", \"range\": \"TechUpgradeCommercial >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Industrial\": \"TechUpgradeIndustrial\", \"range\": \"TechUpgradeIndustrial >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output efficiency of solar panels increases with technology upgrades. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. The company aims to maximize the total energy output from all farms.\n// EnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\n// EnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\n// EnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n// So, the objective function is: Maximize (EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000\n\n## Generate Constraint-2:\nThe total area available for installing solar panels across all types of farms is limited to 5000 square meters. Each Residential panel requires 1 square meter, each Commercial panel requires 2 square meters, and each Industrial panel requires 3 square meters.\n// ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000\n\n## Generate Constraint-3:\nDue to local regulations, the company must install at least 500 panels for Residential and 300 panels for Commercial.\n// ResidentialPanels >= 500; CommercialPanels >= 300\n\n## Generate Constraint-4:\nThe maximum technology upgrade budget for each type of farm is limited. The Residential farm can have up to $10,000, the Commercial farm can have up to $20,000, and the Industrial farm can have up to $30,000.\n// TechUpgradeResidential <= 10000; TechUpgradeCommercial <= 20000; TechUpgradeIndustrial <= 30000",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The company aims to maximize the total energy output from all farms.\n\n| Farm Type       | Initial Energy Output per Panel | Panel Area Requirement | Maximum Tech Upgrade Budget |\n|-----------------|---------------------------------|-----------------------|----------------------------|\n| Residential     | 200 kWh                         | 1 square meter        | $10,000                    |\n| Commercial      | 300 kWh                         | 2 square meters       | $20,000                    |\n| Industrial      | 400 kWh                         | 3 square meters       | $30,000                    |\n\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades. The total area available for installing solar panels across all types of farms is limited to 5000 square meters. Due to local regulations, the company must install at least 500 panels for Residential and 300 panels for Commercial. The maximum technology upgrade budget for each type of farm is also limited as shown in the table.\n\nPlease help the company to maximize the total energy output from all farms.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=500)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=300)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nTechUpgradeResidential = model.addVar(name=\"TechUpgradeResidential\", lb=0)\nTechUpgradeCommercial = model.addVar(name=\"TechUpgradeCommercial\", lb=0)\nTechUpgradeIndustrial = model.addVar(name=\"TechUpgradeIndustrial\", lb=0)\n\n# Define objective function\nEnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\nEnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\nEnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000)\nmodel.addCons(ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000)\nmodel.addCons(TechUpgradeResidential <= 10000)\nmodel.addCons(TechUpgradeCommercial <= 20000)\nmodel.addCons(TechUpgradeIndustrial <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Technology Upgrade for Residential: \", model.getVal(TechUpgradeResidential))\n    print(\"Technology Upgrade for Commercial: \", model.getVal(TechUpgradeCommercial))\n    print(\"Technology Upgrade for Industrial: \", model.getVal(TechUpgradeIndustrial))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1646,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a revenue per trip of $1000, a fuel cost per trip of $200, and a maintenance cost per trip of $100.\nTruck B has a revenue per trip of $1500, a fuel cost per trip of $300, and a maintenance cost per trip of $150.\nTruck C has a revenue per trip of $2000, a fuel cost per trip of $400, and a maintenance cost per trip of $200.\nThe company wants to maximize the net profit per trip across all vehicles.\n// Profit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\n// Profit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\n// Profit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total budget of $5000 for maintenance costs per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-3:\nThe company has a limited fleet size of 50 vehicles in total.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-4:\nThe company has a daily operational limit of 100 trips.\n// TruckA + 1.5 * TruckB + 2 * TruckC <= 100\n\n## Generate Constraint-5:\nThe market demand for Truck A trips is 30. So, the company can only operate a maximum of 30 Truck A vehicles.\n// TruckA <= 30",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different revenue per trip, fuel cost per trip, and maintenance cost per trip. The company needs to determine the optimal number of each type of vehicle to maximize net profit per trip while considering operational costs and constraints. The details of each vehicle are given in the following Table.\n\n| Vehicle | Revenue per Trip | Fuel Cost per Trip | Maintenance Cost per Trip |\n|---------|------------------|--------------------|---------------------------|\n| Truck A | $1000            | $200               | $100                      |\n| Truck B | $1500            | $300               | $150                      |\n| Truck C | $2000            | $400               | $200                      |\n\nThe company has a total budget of $10,000 for fuel costs per day and $5000 for maintenance costs per day. The company has a limited fleet size of 50 vehicles in total and a daily operational limit of 100 trips. The market demand for Truck A trips is 30, so the company can only operate a maximum of 30 Truck A vehicles.\n\nPlease help the company to maximize the net profit per trip across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\nProfit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\nProfit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n# So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000)\n# The company has a total budget of $5000 for maintenance costs per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n# The company has a limited fleet size of 50 vehicles in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# The company has a daily operational limit of 100 trips.\nmodel.addCons(TruckA + 1.5 * TruckB + 2 * TruckC <= 100)\n# The market demand for Truck A trips is 30. So, the company can only operate a maximum of 30 Truck A vehicles.\nmodel.addCons(TruckA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Net Profit per Trip: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to purchase to maximize their operational efficiency.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nT1 has a fuel efficiency of 5 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 10 tons.\nT2 has a fuel efficiency of 7 km/l, a maintenance cost of $1200 per month, and a cargo capacity of 15 tons.\nT3 has a fuel efficiency of 9 km/l, a maintenance cost of $1500 per month, and a cargo capacity of 20 tons.\nT4 has a fuel efficiency of 11 km/l, a maintenance cost of $1800 per month, and a cargo capacity of 25 tons.\nT5 has a fuel efficiency of 13 km/l, a maintenance cost of $2000 per month, and a cargo capacity of 30 tons.\nThe company wants to maximize the total profit, which is the revenue from cargo transportation minus the total maintenance and fuel costs.\n// Profit_T1 = (10 * T1 * PricePerTon) - (1000 * T1) - (Distance / 5 * FuelPrice * T1)\n// Profit_T2 = (15 * T2 * PricePerTon) - (1200 * T2) - (Distance / 7 * FuelPrice * T2)\n// Profit_T3 = (20 * T3 * PricePerTon) - (1500 * T3) - (Distance / 9 * FuelPrice * T3)\n// Profit_T4 = (25 * T4 * PricePerTon) - (1800 * T4) - (Distance / 11 * FuelPrice * T4)\n// Profit_T5 = (30 * T5 * PricePerTon) - (2000 * T5) - (Distance / 13 * FuelPrice * T5)\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 1000\n\n## Generate Constraint-3:\nThe company has a maximum parking space for 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to purchase to maximize their operational efficiency.\nT1 has a fuel efficiency of 5 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 10 tons.\nT2 has a fuel efficiency of 7 km/l, a maintenance cost of $1200 per month, and a cargo capacity of 15 tons.\nT3 has a fuel efficiency of 9 km/l, a maintenance cost of $1500 per month, and a cargo capacity of 20 tons.\nT4 has a fuel efficiency of 11 km/l, a maintenance cost of $1800 per month, and a cargo capacity of 25 tons.\nT5 has a fuel efficiency of 13 km/l, a maintenance cost of $2000 per month, and a cargo capacity of 30 tons.\nThe company has a budget of $100,000 for purchasing new trucks. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a maximum parking space for 50 trucks.\nPlease help the company to maximize the total profit, which is the revenue from cargo transportation minus the total maintenance and fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nPricePerTon = 100  # Assuming a price per ton for simplicity\nFuelPrice = 1.5    # Assuming a fuel price for simplicity\nDistance = 1000    # Assuming a distance for simplicity\n\nProfit_T1 = (10 * T1 * PricePerTon) - (1000 * T1) - (Distance / 5 * FuelPrice * T1)\nProfit_T2 = (15 * T2 * PricePerTon) - (1200 * T2) - (Distance / 7 * FuelPrice * T2)\nProfit_T3 = (20 * T3 * PricePerTon) - (1500 * T3) - (Distance / 9 * FuelPrice * T3)\nProfit_T4 = (25 * T4 * PricePerTon) - (1800 * T4) - (Distance / 11 * FuelPrice * T4)\nProfit_T5 = (30 * T5 * PricePerTon) - (2000 * T5) - (Distance / 13 * FuelPrice * T5)\n\n## the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 100000)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 1000)\n## The company has a maximum parking space for 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km.\n// Fuel_Consumption_Trucks = 20 * Trucks\n// Fuel_Consumption_Vans = 15 * Vans\n// Fuel_Consumption_Bikes = 1 * Bikes\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of vehicles it can operate, which is 20.\n// Trucks + Vans + Bikes <= 20\n\n## Generate Constraint-4:\nThe company must ensure at least 5 different routes are covered. Each Truck can cover 2 routes, each Van can cover 1 route, and each Bike can cover 0.5 routes.\n// 2 * Trucks + Vans + 0.5 * Bikes >= 5",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands. The fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km. The company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100. The total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg. The company has a limit on the total number of vehicles it can operate, which is 20. The company must ensure at least 5 different routes are covered. Each Truck can cover 2 routes, each Van can cover 1 route, and each Bike can cover 0.5 routes. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize fuel consumption while meeting all constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuel_Consumption_Trucks = 20 * Trucks\nFuel_Consumption_Vans = 15 * Vans\nFuel_Consumption_Bikes = 1 * Bikes\n# So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for purchasing vehicles.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 10000)\n# The total cargo capacity required is 5000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000)\n# The company has a limit on the total number of vehicles it can operate, which is 20.\nmodel.addCons(Trucks + Vans + Bikes <= 20)\n# The company must ensure at least 5 different routes are covered.\nmodel.addCons(2 * Trucks + Vans + 0.5 * Bikes >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to maintain service levels.\n// TrucksNorth >= 10; TrucksSouth >= 10; TrucksEast >= 10; TrucksWest >= 10; TrucksCentral >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost function is given by: Cost = a * (FuelBudget)^(-b) + c, and a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n\nThe company has a total fuel budget of $100,000 across all regions. Each region must have at least 10 trucks to maintain service levels, and the total number of trucks across all regions must not exceed 100.\n\nPlease help the company to determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=10)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=10)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=10)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=10)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=10)\nFuelBudgetNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetNorth\", lb=0)\nFuelBudgetSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetSouth\", lb=0)\nFuelBudgetEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetEast\", lb=0)\nFuelBudgetWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetWest\", lb=0)\nFuelBudgetCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetCentral\", lb=0)\n\n# Define objective function\n# The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\n# Cost = a * (FuelBudget)^(-b) + c\n# FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n# FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n# FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n# FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n# FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n# So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Add constraints\n# The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n# Each region must have at least 10 trucks to maintain service levels.\nmodel.addCons(TrucksNorth >= 10)\nmodel.addCons(TrucksSouth >= 10)\nmodel.addCons(TrucksEast >= 10)\nmodel.addCons(TrucksWest >= 10)\nmodel.addCons(TrucksCentral >= 10)\n# The total number of trucks across all regions must not exceed 100.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South Region: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East Region: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West Region: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central Region: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget for North Region: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget for South Region: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget for East Region: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget for West Region: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget for Central Region: \", model.getVal(FuelBudgetCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\n// {\"number of trucks for G1\": \"TruckG1\", \"range\": \"TruckG1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G2\": \"TruckG2\", \"range\": \"TruckG2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G3\": \"TruckG3\", \"range\": \"TruckG3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G4\": \"TruckG4\", \"range\": \"TruckG4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G5\": \"TruckG5\", \"range\": \"TruckG5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n// Net profit for G1: Profit_G1 = (5000 - 1000 - 500) * TruckG1\n// Net profit for G2: Profit_G2 = (7000 - 1500 - 700) * TruckG2\n// Net profit for G3: Profit_G3 = (9000 - 2000 - 900) * TruckG3\n// Net profit for G4: Profit_G4 = (6000 - 1200 - 600) * TruckG4\n// Net profit for G5: Profit_G5 = (8000 - 1800 - 800) * TruckG5\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / (TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50\n\n## Generate Constraint-2:\nDue to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\n// TruckG3 <= TruckG1 + TruckG2\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs for the month.\n// 1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of good has at least one truck allocated.\n// TruckG1 >= 1; TruckG2 >= 1; TruckG3 >= 1; TruckG4 >= 1; TruckG5 >= 1\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\n// TruckG4 <= 2 * TruckG1",
        "question": "A logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\nThe company has a total of 50 trucks available for the month. Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2. The company has a budget of $50,000 for fuel costs for the month. The company wants to ensure that each type of good has at least one truck allocated. The company also wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\nPlease help the company determine the optimal allocation of trucks to maximize the average net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckG1 = model.addVar(vtype=\"INTEGER\", name=\"TruckG1\", lb=1)  # number of trucks for G1\nTruckG2 = model.addVar(vtype=\"INTEGER\", name=\"TruckG2\", lb=1)  # number of trucks for G2\nTruckG3 = model.addVar(vtype=\"INTEGER\", name=\"TruckG3\", lb=1)  # number of trucks for G3\nTruckG4 = model.addVar(vtype=\"INTEGER\", name=\"TruckG4\", lb=1)  # number of trucks for G4\nTruckG5 = model.addVar(vtype=\"INTEGER\", name=\"TruckG5\", lb=1)  # number of trucks for G5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = (5000 - 1000 - 500) * TruckG1\nProfit_G2 = (7000 - 1500 - 700) * TruckG2\nProfit_G3 = (9000 - 2000 - 900) * TruckG3\nProfit_G4 = (6000 - 1200 - 600) * TruckG4\nProfit_G5 = (8000 - 1800 - 800) * TruckG5\nTotalTrucks = TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50)\n## Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\nmodel.addCons(TruckG3 <= TruckG1 + TruckG2)\n## The company has a budget of $50,000 for fuel costs for the month.\nmodel.addCons(1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50000)\n## The company wants to ensure that each type of good has at least one truck allocated.\nmodel.addCons(TruckG1 >= 1)\nmodel.addCons(TruckG2 >= 1)\nmodel.addCons(TruckG3 >= 1)\nmodel.addCons(TruckG4 >= 1)\nmodel.addCons(TruckG5 >= 1)\n## The company wants to ensure that the total number of trucks for G4 does not exceed twice the number of trucks for G1.\nmodel.addCons(TruckG4 <= 2 * TruckG1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for G1: \", model.getVal(TruckG1))\n    print(\"Number of Trucks for G2: \", model.getVal(TruckG2))\n    print(\"Number of Trucks for G3: \", model.getVal(TruckG3))\n    print(\"Number of Trucks for G4: \", model.getVal(TruckG4))\n    print(\"Number of Trucks for G5: \", model.getVal(TruckG5))\n    print(\"Maximized Average Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1598,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"Auto_A\", \"range\": \"Auto_A >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"Auto_B\", \"range\": \"Auto_B >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"Auto_C\", \"range\": \"Auto_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 5 * Auto_A)) * Q_A\n// Profit_B = (180 - (120 - 5 * Auto_B)) * Q_B\n// Profit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation.\n// Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for implementing automation.\nPlease help the company determine the optimal production quantities and levels of automation for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAuto_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_A\", lb=0) # level of automation for ProductA\nAuto_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_B\", lb=0) # level of automation for ProductB\nAuto_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_C\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 5 * Auto_A)) * Q_A\nProfit_B = (180 - (120 - 5 * Auto_B)) * Q_B\nProfit_C = (200 - (150 - 5 * Auto_C)) * Q_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation for ProductA: \", model.getVal(Auto_A))\n    print(\"Level of Automation for ProductB: \", model.getVal(Auto_B))\n    print(\"Level of Automation for ProductC: \", model.getVal(Auto_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours.\n// 8 * ProductA + 10 * ProductB + 9 * ProductC <= 800\n\n## Generate Constraint-3:\nMarket demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\n// ProductA <= 50\n// ProductB <= 60\n// ProductC <= 70\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, ensuring that the ratio of Product B to Product A does not exceed 1.5, and the ratio of Product C to Product A does not exceed 1.2.\n// ProductB / ProductA <= 1.5\n// ProductC / ProductA <= 1.2",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours. The profit per unit, cost of production per unit, and the required resources for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit | Raw Materials per Unit | Labor Hours per Unit |\n|---------|-----------------|-----------------------------|------------------------|----------------------|\n| A       | $30             | $20                         | $50                    | 8 hours              |\n| B       | $40             | $30                         | $60                    | 10 hours             |\n| C       | $35             | $25                         | $55                    | 9 hours              |\n\nThe company has a total budget of $5000 for raw materials. The company has a total of 800 labor hours available. Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units. The company aims to maintain a balanced production, ensuring that the ratio of Product B to Product A does not exceed 1.5, and the ratio of Product C to Product A does not exceed 1.2.\n\nPlease help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# Constraint-1: Raw materials budget\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000)\n# Constraint-2: Labor hours\nmodel.addCons(8 * ProductA + 10 * ProductB + 9 * ProductC <= 800)\n# Constraint-3: Market demand\nmodel.addCons(ProductA <= 50)\nmodel.addCons(ProductB <= 60)\nmodel.addCons(ProductC <= 70)\n# Constraint-4: Balanced production ratios\nmodel.addCons(ProductB <= 1.5 * ProductA)\nmodel.addCons(ProductC <= 1.2 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1530,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the optimal number of trucks to deploy for each type to maximize profit while considering the varying fuel efficiency and maintenance costs. Additionally, the company must decide on the number of trips each truck will make per day.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for TruckA is $300, but it decreases by $1 for every additional trip made that day. The profit per trip for TruckB is $400, decreasing by $1.50 for every additional trip made that day. The profit per trip for TruckC is $500, decreasing by $2 for every additional trip made that day. The company aims to maximize the total daily profit from all trucks.\n// Profit_TruckA = TruckA * TripsA * (300 - (TripsA - 1))\n// Profit_TruckB = TruckB * TripsB * (400 - 1.5 * (TripsB - 1))\n// Profit_TruckC = TruckC * TripsC * (500 - 2 * (TripsC - 1))\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC <= 30\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 150 per day.\n// TruckA * TripsA + TruckB * TripsB + TruckC * TripsC <= 150\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of trips per TruckA cannot exceed 10, per TruckB cannot exceed 12, and per TruckC cannot exceed 8.\n// TripsA <= 10; TripsB <= 12; TripsC <= 8",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the optimal number of trucks to deploy for each type and the number of trips each truck will make per day to maximize profit while considering the varying fuel efficiency and maintenance costs. The profit per trip for TruckA is $300, decreasing by $1 for every additional trip made that day. The profit per trip for TruckB is $400, decreasing by $1.50 for every additional trip made that day. The profit per trip for TruckC is $500, decreasing by $2 for every additional trip made that day. The company has a total of 30 trucks available. The total number of trips across all trucks must not exceed 150 per day. Due to maintenance constraints, the number of trips per TruckA cannot exceed 10, per TruckB cannot exceed 12, and per TruckC cannot exceed 8. Please help the company to maximize the total daily profit from all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=10)  # number of trips per TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=12)  # number of trips per TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=8)  # number of trips per TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with piecewise linear functions\nProfit_TruckA = model.addVar(name=\"Profit_TruckA\")\nmodel.addCons(Profit_TruckA == TruckA * TripsA * (300 - (TripsA - 1)))\nProfit_TruckB = model.addVar(name=\"Profit_TruckB\")\nmodel.addCons(Profit_TruckB == TruckB * TripsB * (400 - 1.5 * (TripsB - 1)))\nProfit_TruckC = model.addVar(name=\"Profit_TruckC\")\nmodel.addCons(Profit_TruckC == TruckC * TripsC * (500 - 2 * (TripsC - 1)))\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n## The company has a total of 30 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC <= 30)\n## The total number of trips across all trucks must not exceed 150 per day.\nmodel.addCons(TruckA * TripsA + TruckB * TripsB + TruckC * TripsC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Trips per TruckA: \", model.getVal(TripsA))\n    print(\"Trips per TruckB: \", model.getVal(TripsB))\n    print(\"Trips per TruckC: \", model.getVal(TripsC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost. The company has a total shipping capacity of 500 containers. Please help the company to determine the optimal number of each type of container to minimize the total shipping cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=0) # number of container A\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=0) # number of container B\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=0) # number of container C\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=0) # number of container D\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=0) # number of container E\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce the production cost per unit for all products.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $2 for every $10,000 invested in the new technology. The initial production cost per unit for A is $50, for B is $60, for C is $70, and for D is $80. The selling price per unit is $100 for A, $120 for B, $140 for C, and $160 for D. The company aims to maximize the total profit from all products.\n// Total profit for A: ProfitA = (100 - 50 + 0.0002 * TechInvestment) * A\n// Total profit for B: ProfitB = (120 - 60 + 0.0002 * TechInvestment) * B\n// Total profit for C: ProfitC = (140 - 70 + 0.0002 * TechInvestment) * C\n// Total profit for D: ProfitD = (160 - 80 + 0.0002 * TechInvestment) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 5000 units.\n// A + B + C + D <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product A and 800 units of product B.\n// A >= 500; B >= 800\n\n## Generate Constraint-4:\nThe total production cost for all products, including the investment in the new technology, must not exceed $300,000.\n// (50 - 0.0002 * TechInvestment) * A + (60 - 0.0002 * TechInvestment) * B + (70 - 0.0002 * TechInvestment) * C + (80 - 0.0002 * TechInvestment) * D + TechInvestment <= 300000\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new technology that could reduce the production cost per unit for all products. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| A       | $50                     | $100          |\n| B       | $60                     | $120          |\n| C       | $70                     | $140          |\n| D       | $80                     | $160          |\n\nThe production cost per unit decreases by $2 for every $10,000 invested in the new technology. The company has a budget of $100,000 for the investment in the new technology. The total production capacity for the next quarter is 5000 units. The company must produce at least 500 units of product A and 800 units of product B. The total production cost for all products, including the investment in the new technology, must not exceed $300,000. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=800) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for A: ProfitA = (100 - 50 + 0.0002 * TechInvestment) * A\n## Total profit for B: ProfitB = (120 - 60 + 0.0002 * TechInvestment) * B\n## Total profit for C: ProfitC = (140 - 70 + 0.0002 * TechInvestment) * C\n## Total profit for D: ProfitD = (160 - 80 + 0.0002 * TechInvestment) * D\nProfitA = (100 - 50 + 0.0002 * TechInvestment) * A\nProfitB = (120 - 60 + 0.0002 * TechInvestment) * B\nProfitC = (140 - 70 + 0.0002 * TechInvestment) * C\nProfitD = (160 - 80 + 0.0002 * TechInvestment) * D\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n## The total production capacity for the next quarter is 5000 units.\nmodel.addCons(A + B + C + D <= 5000)\n## The company must produce at least 500 units of product A and 800 units of product B.\nmodel.addCons(A >= 500)\nmodel.addCons(B >= 800)\n## The total production cost for all products, including the investment in the new technology, must not exceed $300,000.\nmodel.addCons((50 - 0.0002 * TechInvestment) * A + (60 - 0.0002 * TechInvestment) * B + (70 - 0.0002 * TechInvestment) * C + (80 - 0.0002 * TechInvestment) * D + TechInvestment <= 300000)\n## The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n// {\"technicians assigned to machine 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components.\n// Production rate of machine 1: P1 = 100 * (1 + 0.05 * T1) * M1\n// Production rate of machine 2: P2 = 120 * (1 + 0.04 * T2) * M2\n// Production rate of machine 3: P3 = 140 * (1 + 0.03 * T3) * M3\n// Production rate of machine 4: P4 = 160 * (1 + 0.02 * T4) * M4\n// Production rate of machine 5: P5 = 180 * (1 + 0.01 * T5) * M5\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThere are a total of 30 technicians available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 10 hours per day.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine. The production rate of each machine is influenced by the number of technicians assigned and is given by a nonlinear function. The objective is to maximize the total production of all components. The production rates for each machine are as follows:\n\n| Machine | Production Rate Formula |\n|---------|-------------------------|\n| 1       | 100 * (1 + 0.05 * T1) * M1 |\n| 2       | 120 * (1 + 0.04 * T2) * M2 |\n| 3       | 140 * (1 + 0.03 * T3) * M3 |\n| 4       | 160 * (1 + 0.02 * T4) * M4 |\n| 5       | 180 * (1 + 0.01 * T5) * M5 |\n\nThe plant has a total of 30 technicians available. Each machine can operate for a maximum of 10 hours per day.\n\nPlease help the plant manager to determine the optimal allocation of technicians and machine operating hours to maximize the total production of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # technicians assigned to machine 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # technicians assigned to machine 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # technicians assigned to machine 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # technicians assigned to machine 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # technicians assigned to machine 5\n\n# Define objective function\nP1 = 100 * (1 + 0.05 * T1) * M1\nP2 = 120 * (1 + 0.04 * T2) * M2\nP3 = 140 * (1 + 0.03 * T3) * M3\nP4 = 160 * (1 + 0.02 * T4) * M4\nP5 = 180 * (1 + 0.01 * T5) * M5\n# The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# There are a total of 30 technicians available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n# Each machine can operate for a maximum of 10 hours per day.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Technicians Assigned to Machine 1: \", model.getVal(T1))\n    print(\"Technicians Assigned to Machine 2: \", model.getVal(T2))\n    print(\"Technicians Assigned to Machine 3: \", model.getVal(T3))\n    print(\"Technicians Assigned to Machine 4: \", model.getVal(T4))\n    print(\"Technicians Assigned to Machine 5: \", model.getVal(T5))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1500, on route 2 is $1800, on route 3 is $2000, on route 4 is $1900, and on route 5 is $2100. The company aims to maximize the total net revenue (revenue minus cost) from all routes.\n// Net_Revenue_1 = (1500 - 1000) * T1\n// Net_Revenue_2 = (1800 - 1200) * T2\n// Net_Revenue_3 = (2000 - 1500) * T3\n// Net_Revenue_4 = (1900 - 1300) * T4\n// Net_Revenue_5 = (2100 - 1400) * T5\n// So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all trucks must not exceed a certain limit. Each truck on route 1 emits 5 units of emissions, on route 2 emits 6 units, on route 3 emits 7 units, on route 4 emits 5 units, and on route 5 emits 4 units. The total emissions must not exceed 500 units.\n// 5 * T1 + 6 * T2 + 7 * T3 + 5 * T4 + 4 * T5 <= 500\n\n## Generate Constraint-4:\nThe company also aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 requires at least 8 trucks, route 3 requires at least 10 trucks, route 4 requires at least 5 trucks, and route 5 requires at least 3 trucks.\n// T1 >= 5; T2 >= 8; T3 >= 10; T4 >= 5; T5 >= 3",
        "question": "A logistics company operates five different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck, revenue per truck, and emission units per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck | Emission Units per Truck |\n|-------|----------------|-------------------|--------------------------|\n| 1     | $1000          | $1500             | 5                        |\n| 2     | $1200          | $1800             | 6                        |\n| 3     | $1500          | $2000             | 7                        |\n| 4     | $1300          | $1900             | 5                        |\n| 5     | $1400          | $2100             | 4                        |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks. Due to environmental regulations, the total emissions from all trucks must not exceed 500 units. The company also aims to maintain a minimum service level on each route: Route 1 requires at least 5 trucks, route 2 requires at least 8 trucks, route 3 requires at least 10 trucks, route 4 requires at least 5 trucks, and route 5 requires at least 3 trucks.\n\nPlease help the company to maximize the total net revenue (revenue minus cost) from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nNet_Revenue_1 = (1500 - 1000) * T1\nNet_Revenue_2 = (1800 - 1200) * T2\nNet_Revenue_3 = (2000 - 1500) * T3\nNet_Revenue_4 = (1900 - 1300) * T4\nNet_Revenue_5 = (2100 - 1400) * T5\n# So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n# Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 15)\n# Due to environmental regulations, the total emissions from all trucks must not exceed a certain limit.\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 5 * T4 + 4 * T5 <= 500)\n# The company also aims to maintain a minimum service level on each route.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 8)\nmodel.addCons(T3 >= 10)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1510,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000\n\n## Generate Constraint-2:\nThe total production of Component B must be at least 1500 units.\n// H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500\n\n## Generate Constraint-3:\nThe total production of Component C must be at least 2000 units.\n// H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component. The company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The total production of Component A must be at least 1000 units. The total production of Component B must be at least 1500 units. The total production of Component C must be at least 2000 units.\n\nPlease help the company to minimize the total operational cost, which is calculated as follows:\n- Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n- Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n- Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n- Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n- Objective function: Minimize C = C1 + C2 + C3 + C4",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0) # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0) # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0) # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0) # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0) # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0) # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0) # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0) # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0) # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0) # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0) # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0) # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000) # Total production of Component A must be at least 1000 units\nmodel.addCons(H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500) # Total production of Component B must be at least 1500 units\nmodel.addCons(H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000) # Total production of Component C must be at least 2000 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 operates for Component A: \", model.getVal(H1A))\n    print(\"Hours Facility 1 operates for Component B: \", model.getVal(H1B))\n    print(\"Hours Facility 1 operates for Component C: \", model.getVal(H1C))\n    print(\"Hours Facility 2 operates for Component A: \", model.getVal(H2A))\n    print(\"Hours Facility 2 operates for Component B: \", model.getVal(H2B))\n    print(\"Hours Facility 2 operates for Component C: \", model.getVal(H2C))\n    print(\"Hours Facility 3 operates for Component A: \", model.getVal(H3A))\n    print(\"Hours Facility 3 operates for Component B: \", model.getVal(H3B))\n    print(\"Hours Facility 3 operates for Component C: \", model.getVal(H3C))\n    print(\"Hours Facility 4 operates for Component A: \", model.getVal(H4A))\n    print(\"Hours Facility 4 operates for Component B: \", model.getVal(H4B))\n    print(\"Hours Facility 4 operates for Component C: \", model.getVal(H4C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone A\": \"ZoneA\", \"range\": \"ZoneA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"ZoneB\", \"range\": \"ZoneB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"ZoneC\", \"range\": \"ZoneC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"ZoneD\", \"range\": \"ZoneD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"ZoneE\", \"range\": \"ZoneE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone A is 80%, in Zone B is 75%, in Zone C is 70%, in Zone D is 65%, and in Zone E is 60%. The cost per panel installation in Zone A is $1000, in Zone B is $1200, in Zone C is $1400, in Zone D is $1600, and in Zone E is $1800. The city aims to maximize the total energy production while minimizing the total installation cost.\n// Total energy production: Energy = 80% * ZoneA + 75% * ZoneB + 70% * ZoneC + 65% * ZoneD + 60% * ZoneE\n// Total installation cost: Cost = $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// $1000 * ZoneA + $1200 * ZoneB + $1400 * ZoneC + $1600 * ZoneD + $1800 * ZoneE <= $100000\n\n## Generate Constraint-2:\nThere is a maximum capacity of 100 panels that can be installed in each zone.\n// ZoneA <= 100\n// ZoneB <= 100\n// ZoneC <= 100\n// ZoneD <= 100\n// ZoneE <= 100\n\n## Generate Constraint-3:\nThe city requires at least 300 panels to be installed across all zones.\n// ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to optimize energy production and minimize costs. The efficiency of solar panels and the cost per panel installation in each zone are given in the following Table.\n\n| Zone   | Efficiency | Cost per Panel Installation |\n|--------|------------|-----------------------------|\n| A      | 80%        | $1000                       |\n| B      | 75%        | $1200                       |\n| C      | 70%        | $1400                       |\n| D      | 65%        | $1600                       |\n| E      | 60%        | $1800                       |\n\nThe city has a budget of $100,000 for the installation of solar panels. There is a maximum capacity of 100 panels that can be installed in each zone. The city requires at least 300 panels to be installed across all zones. \n\nPlease help the city to maximize the total energy production while minimizing the total installation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZoneA = model.addVar(vtype=\"INTEGER\", name=\"ZoneA\", lb=0, ub=100)  # number of solar panels in Zone A\nZoneB = model.addVar(vtype=\"INTEGER\", name=\"ZoneB\", lb=0, ub=100)  # number of solar panels in Zone B\nZoneC = model.addVar(vtype=\"INTEGER\", name=\"ZoneC\", lb=0, ub=100)  # number of solar panels in Zone C\nZoneD = model.addVar(vtype=\"INTEGER\", name=\"ZoneD\", lb=0, ub=100)  # number of solar panels in Zone D\nZoneE = model.addVar(vtype=\"INTEGER\", name=\"ZoneE\", lb=0, ub=100)  # number of solar panels in Zone E\n\n# Define objective function\nEnergy = 0.8 * ZoneA + 0.75 * ZoneB + 0.7 * ZoneC + 0.65 * ZoneD + 0.6 * ZoneE\nCost = 1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE\n# So, the objective function is: Maximize Energy - Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * ZoneA + 1200 * ZoneB + 1400 * ZoneC + 1600 * ZoneD + 1800 * ZoneE <= 100000)\n# There is a maximum capacity of 100 panels that can be installed in each zone.\nmodel.addCons(ZoneA <= 100)\nmodel.addCons(ZoneB <= 100)\nmodel.addCons(ZoneC <= 100)\nmodel.addCons(ZoneD <= 100)\nmodel.addCons(ZoneE <= 100)\n# The city requires at least 300 panels to be installed across all zones.\nmodel.addCons(ZoneA + ZoneB + ZoneC + ZoneD + ZoneE >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(ZoneA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(ZoneB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(ZoneC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(ZoneD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(ZoneE))\n    print(\"Maximized Energy Production - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to ensure adequate coverage.\n// Trucks1 >= 10; Trucks2 >= 10; Trucks3 >= 10; Trucks4 >= 10; Trucks5 >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all regions must not exceed 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-4:\nDue to regional regulations, the fuel budget for Region1 must be at least twice the fuel budget for Region2.\n// FuelBudget1 >= 2 * FuelBudget2",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, decreasing as the fuel budget increases but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions. The total fuel budget across all regions must not exceed $100,000. Each region must have at least 10 trucks to ensure adequate coverage, and the total number of trucks across all regions must not exceed 100. Due to regional regulations, the fuel budget for Region1 must be at least twice the fuel budget for Region2. Please help the company determine the optimal number of trucks and fuel budgets for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each region must have at least 10 trucks to ensure adequate coverage.\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10) # trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10) # trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=10) # trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=10) # trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=10) # trucks in Region5\n\n## Define fuel budgets for each region\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0) # fuel budget for Region1\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0) # fuel budget for Region2\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0) # fuel budget for Region3\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0) # fuel budget for Region4\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0) # fuel budget for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define fuel costs for each region\nFuelCost1 = (FuelBudget1 / Trucks1)**2\nFuelCost2 = (FuelBudget2 / Trucks2)**2\nFuelCost3 = (FuelBudget3 / Trucks3)**2\nFuelCost4 = (FuelBudget4 / Trucks4)**2\nFuelCost5 = (FuelBudget5 / Trucks5)**2\n\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\n\n## The total number of trucks across all regions must not exceed 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n## Due to regional regulations, the fuel budget for Region1 must be at least twice the fuel budget for Region2.\nmodel.addCons(FuelBudget1 >= 2 * FuelBudget2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company needs to decide on the optimal speed for each truck type to minimize fuel consumption per kilometer.\n// {\"number of small truck trips\": \"TripsS\", \"range\": \"TripsS >= 0\", \"type\": \"integer\"}\n// {\"number of medium truck trips\": \"TripsM\", \"range\": \"TripsM >= 0\", \"type\": \"integer\"}\n// {\"number of large truck trips\": \"TripsL\", \"range\": \"TripsL >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for small trucks (km/h)\": \"SpeedS\", \"range\": \"SpeedS >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for medium trucks (km/h)\": \"SpeedM\", \"range\": \"SpeedM >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for large trucks (km/h)\": \"SpeedL\", \"range\": \"SpeedL >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip for each truck type is affected by the speed at which the trucks travel. The faster the trucks travel, the more trips they can make, but the fuel consumption per kilometer increases nonlinearly. The profit per trip for small trucks is $1000 - 0.1 * SpeedS^2, for medium trucks is $1500 - 0.15 * SpeedM^2, and for large trucks is $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types.\n// Total profit for small trucks: ProfitS = (1000 - 0.1 * SpeedS^2) * TripsS\n// Total profit for medium trucks: ProfitM = (1500 - 0.15 * SpeedM^2) * TripsM\n// Total profit for large trucks: ProfitL = (2000 - 0.2 * SpeedL^2) * TripsL\n// So, the objective function is: Maximize (ProfitS + ProfitM + ProfitL)\n\n## Generate Constraint-1:\nThe total number of trips across all truck types must not exceed 500.\n// TripsS + TripsM + TripsL <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance. The fuel cost per kilometer for small trucks is 0.1 * SpeedS, for medium trucks is 0.15 * SpeedM, and for large trucks is 0.2 * SpeedL. The maintenance cost per trip is $50 for small trucks, $75 for medium trucks, and $100 for large trucks.\n// (0.1 * SpeedS * TripsS + 50 * TripsS) + (0.15 * SpeedM * TripsM + 75 * TripsM) + (0.2 * SpeedL * TripsL + 100 * TripsL) <= 100000\n\n## Generate Constraint-3:\nDue to driver availability, the total number of trips for small and medium trucks must not exceed 300.\n// TripsS + TripsM <= 300\n\n## Generate Constraint-4:\nThe optimal speed for each truck type must be within the legal speed limit: 60 km/h for small trucks, 80 km/h for medium trucks, and 100 km/h for large trucks.\n// SpeedS <= 60; SpeedM <= 80; SpeedL <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) and the optimal speed for each truck type to maximize profit while considering the cost of fuel, maintenance, and driver wages. The profit per trip for each truck type is affected by the speed at which the trucks travel, with the profit per trip for small trucks being $1000 - 0.1 * SpeedS^2, for medium trucks being $1500 - 0.15 * SpeedM^2, and for large trucks being $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types.\n\n| Truck Type | Profit per Trip Formula | Speed Limit (km/h) |\n|------------|-------------------------|--------------------|\n| Small      | $1000 - 0.1 * SpeedS^2  | 60                 |\n| Medium     | $1500 - 0.15 * SpeedM^2 | 80                 |\n| Large      | $2000 - 0.2 * SpeedL^2  | 100                |\n\nThe company has the following constraints:\n1. The total number of trips across all truck types must not exceed 500.\n2. The company has a budget of $100,000 for fuel and maintenance. The fuel cost per kilometer and maintenance cost per trip vary by truck type.\n3. Due to driver availability, the total number of trips for small and medium trucks must not exceed 300.\n4. The optimal speed for each truck type must be within the legal speed limit.\n\nPlease help the company determine the optimal number of trips for each truck type (TripsS, TripsM, TripsL) and the optimal speed for each truck type (SpeedS, SpeedM, SpeedL) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsS = model.addVar(vtype=\"INTEGER\", name=\"TripsS\", lb=0) # number of small truck trips\nTripsM = model.addVar(vtype=\"INTEGER\", name=\"TripsM\", lb=0) # number of medium truck trips\nTripsL = model.addVar(vtype=\"INTEGER\", name=\"TripsL\", lb=0) # number of large truck trips\nSpeedS = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedS\", lb=0) # optimal speed for small trucks\nSpeedM = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedM\", lb=0) # optimal speed for medium trucks\nSpeedL = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedL\", lb=0) # optimal speed for large trucks\n\n# Define objective function\n## The profit per trip for each truck type is affected by the speed at which the trucks travel.\nProfitS = (1000 - 0.1 * SpeedS**2) * TripsS\nProfitM = (1500 - 0.15 * SpeedM**2) * TripsM\nProfitL = (2000 - 0.2 * SpeedL**2) * TripsL\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitS + ProfitM + ProfitL)\nmodel.addCons(obj == ProfitS + ProfitM + ProfitL)\n\n# Add constraints\n## The total number of trips across all truck types must not exceed 500.\nmodel.addCons(TripsS + TripsM + TripsL <= 500)\n## The company has a budget of $100,000 for fuel and maintenance.\nmodel.addCons((0.1 * SpeedS * TripsS + 50 * TripsS) + (0.15 * SpeedM * TripsM + 75 * TripsM) + (0.2 * SpeedL * TripsL + 100 * TripsL) <= 100000)\n## Due to driver availability, the total number of trips for small and medium trucks must not exceed 300.\nmodel.addCons(TripsS + TripsM <= 300)\n## The optimal speed for each truck type must be within the legal speed limit.\nmodel.addCons(SpeedS <= 60)\nmodel.addCons(SpeedM <= 80)\nmodel.addCons(SpeedL <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Truck Trips: \", model.getVal(TripsS))\n    print(\"Number of Medium Truck Trips: \", model.getVal(TripsM))\n    print(\"Number of Large Truck Trips: \", model.getVal(TripsL))\n    print(\"Optimal Speed for Small Trucks: \", model.getVal(SpeedS))\n    print(\"Optimal Speed for Medium Trucks: \", model.getVal(SpeedM))\n    print(\"Optimal Speed for Large Trucks: \", model.getVal(SpeedL))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1618,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\n// {\"trips to D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs).\n// NetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1^2\n// NetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2^2\n// NetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3^2\n// NetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4^2\n// NetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5^2\n// So, the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10000.\n// 200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget that cannot exceed $2000.\n// 0.01 * D1^2 + 0.015 * D2^2 + 0.02 * D3^2 + 0.025 * D4^2 + 0.03 * D5^2 <= 2000\n\n## Generate Constraint-3:\nThe company has a limit of 50 trips per truck.\n// D1 + D2 + D3 + D4 + D5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination. The profit, fuel cost, and maintenance cost for each trip are given in the following Table.\n\n| Destination | Profit per Trip | Fuel Cost per Trip | Maintenance Cost per Trip |\n|-------------|-----------------|--------------------|---------------------------|\n| D1          | $1000           | $200               | 0.01 * D1^2               |\n| D2          | $1200           | $250               | 0.015 * D2^2              |\n| D3          | $1500           | $300               | 0.02 * D3^2               |\n| D4          | $1800           | $350               | 0.025 * D4^2              |\n| D5          | $2000           | $400               | 0.03 * D5^2               |\n\nThe company has a total fuel budget of $10000. The company has a maintenance budget that cannot exceed $2000. The company has a limit of 50 trips per truck. \nPlease help the company to maximize the net profit (total profit minus total costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # trips to D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # trips to D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # trips to D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # trips to D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # trips to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate net profit for each destination\nNetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1**2\nNetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2**2\nNetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3**2\nNetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4**2\nNetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5**2\n\n## the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\nmodel.addCons(obj == NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n# Add constraints\n## The company has a total fuel budget of $10000.\nmodel.addCons(200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000)\n## The company has a maintenance budget that cannot exceed $2000.\nmodel.addCons(0.01 * D1**2 + 0.015 * D2**2 + 0.02 * D3**2 + 0.025 * D4**2 + 0.03 * D5**2 <= 2000)\n## The company has a limit of 50 trips per truck.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(D1))\n    print(\"Trips to D2: \", model.getVal(D2))\n    print(\"Trips to D3: \", model.getVal(D3))\n    print(\"Trips to D4: \", model.getVal(D4))\n    print(\"Trips to D5: \", model.getVal(D5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different fuel consumption rate per kilometer and a varying distance. The company aims to minimize the total fuel consumption while ensuring all deliveries are made on time. The fuel consumption rate for each route is as follows:\n- Route 1: 0.5 liters/km\n- Route 2: 0.6 liters/km\n- Route 3: 0.4 liters/km\n- Route 4: 0.7 liters/km\n- Route 5: 0.55 liters/km\n- Route 6: 0.65 liters/km\nThe distances for each route are:\n- Route 1: 100 km\n- Route 2: 150 km\n- Route 3: 200 km\n- Route 4: 120 km\n- Route 5: 180 km\n- Route 6: 220 km\nThe objective is to minimize the total fuel consumption, which is a nonlinear function of the number of trucks and the fuel consumption rates.\n// Objective function: Minimize (0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each route has a different fuel consumption rate per kilometer and a varying distance. The fuel consumption rate for each route is as follows:\n- Route 1: 0.5 liters/km\n- Route 2: 0.6 liters/km\n- Route 3: 0.4 liters/km\n- Route 4: 0.7 liters/km\n- Route 5: 0.55 liters/km\n- Route 6: 0.65 liters/km\nThe distances for each route are:\n- Route 1: 100 km\n- Route 2: 150 km\n- Route 3: 200 km\n- Route 4: 120 km\n- Route 5: 180 km\n- Route 6: 220 km\nThe company has a total of 100 trucks available. The objective is to minimize the total fuel consumption, which is a nonlinear function of the number of trucks and the fuel consumption rates. Please help the company to minimize the total fuel consumption while ensuring all deliveries are made on time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\nmodel.addCons(obj == 0.5 * 100 * T1 + 0.6 * 150 * T2 + 0.4 * 200 * T3 + 0.7 * 120 * T4 + 0.55 * 180 * T5 + 0.65 * 220 * T6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The regions are categorized into three types: Urban, Suburban, and Rural. The company also needs to consider the fuel efficiency of trucks in different regions, which varies due to traffic conditions and road types.\n// {\"number of trucks for Urban\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Urban\": \"UrbanTripsPerTruck\", \"range\": \"UrbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Suburban\": \"SuburbanTripsPerTruck\", \"range\": \"SuburbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Rural\": \"RuralTripsPerTruck\", \"range\": \"RuralTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency for Urban trucks is 5 km/liter, for Suburban trucks is 8 km/liter, and for Rural trucks is 10 km/liter. The average distance per trip in Urban is 20 km, in Suburban is 40 km, and in Rural is 60 km. The company aims to minimize the total daily fuel cost.\n// FuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\n// FuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\n// FuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n// So, the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $1000 for fuel costs.\n// (20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The regions are categorized into three types: Urban, Suburban, and Rural. The cost of fuel per liter is $1.5. The fuel efficiency for Urban trucks is 5 km/liter, for Suburban trucks is 8 km/liter, and for Rural trucks is 10 km/liter. The average distance per trip in Urban is 20 km, in Suburban is 40 km, and in Rural is 60 km. The company aims to minimize the total daily fuel cost. The company has a total of 50 trucks available and a daily budget of $1000 for fuel costs.\n\nPlease help the company to determine the optimal allocation of trucks and trips to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)\nUrbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"UrbanTripsPerTruck\", lb=0)\nSuburbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTripsPerTruck\", lb=0)\nRuralTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RuralTripsPerTruck\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\nFuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\nFuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n## the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\nmodel.addCons(obj == FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50)\n## The company has a daily budget of $1000 for fuel costs.\nmodel.addCons((20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + \n              (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + \n              (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Urban Trucks: \", model.getVal(UrbanTrucks))\n    print(\"Number of Suburban Trucks: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Rural Trucks: \", model.getVal(RuralTrucks))\n    print(\"Number of Urban Trips per Truck: \", model.getVal(UrbanTripsPerTruck))\n    print(\"Number of Suburban Trips per Truck: \", model.getVal(SuburbanTripsPerTruck))\n    print(\"Number of Rural Trips per Truck: \", model.getVal(RuralTripsPerTruck))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. The company needs to determine the number of trips each type of truck should make to optimize their operations.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and cargo capacity. Truck A has a fuel efficiency of 10 km/l and can carry 10 tons. Truck B has a fuel efficiency of 12 km/l and can carry 12 tons. Truck C has a fuel efficiency of 15 km/l and can carry 15 tons. Truck D has a fuel efficiency of 18 km/l and can carry 18 tons. Truck E has a fuel efficiency of 20 km/l and can carry 20 tons. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Fuel consumption for A: Fuel_A = 1000 / 10 * A\n// Fuel consumption for B: Fuel_B = 1000 / 12 * B\n// Fuel consumption for C: Fuel_C = 1000 / 15 * C\n// Fuel consumption for D: Fuel_D = 1000 / 18 * D\n// Fuel consumption for E: Fuel_E = 1000 / 20 * E\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 12 * B\n// Cargo carried by C: Cargo_C = 15 * C\n// Cargo carried by D: Cargo_D = 18 * D\n// Cargo carried by E: Cargo_E = 20 * E\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 liters of fuel available for the week.\n// 1000 / 10 * A + 1000 / 12 * B + 1000 / 15 * C + 1000 / 18 * D + 1000 / 20 * E <= 10000\n\n## Generate Constraint-2:\nEach truck type must make at least 5 trips per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trips across all truck types must not exceed 500.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe total cargo carried by Truck D must not exceed the combined cargo carried by Trucks A and B.\n// 18 * D <= 10 * A + 12 * B",
        "question": "A logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. The company needs to determine the number of trips each type of truck should make to optimize their operations. Each truck type has a different fuel efficiency and cargo capacity, as shown in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Cargo Capacity (tons) |\n|------------|-----------------------|-----------------------|\n| A          | 10                    | 10                    |\n| B          | 12                    | 12                    |\n| C          | 15                    | 15                    |\n| D          | 18                    | 18                    |\n| E          | 20                    | 20                    |\n\nThe company has a total of 10,000 liters of fuel available for the week. Each truck type must make at least 5 trips per week. The total number of trips across all truck types must not exceed 500. The total cargo carried by Truck D must not exceed the combined cargo carried by Trucks A and B.\n\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuel_A = 1000 / 10 * A\nFuel_B = 1000 / 12 * B\nFuel_C = 1000 / 15 * C\nFuel_D = 1000 / 18 * D\nFuel_E = 1000 / 20 * E\nCargo_A = 10 * A\nCargo_B = 12 * B\nCargo_C = 15 * C\nCargo_D = 18 * D\nCargo_E = 20 * E\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E)\n\n# Add constraints\n## The company has a total of 10,000 liters of fuel available for the week.\nmodel.addCons(Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E <= 10000)\n## The total number of trips across all truck types must not exceed 500.\nmodel.addCons(A + B + C + D + E <= 500)\n## The total cargo carried by Truck D must not exceed the combined cargo carried by Trucks A and B.\nmodel.addCons(18 * D <= 10 * A + 12 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck A: \", model.getVal(A))\n    print(\"Number of trips for truck B: \", model.getVal(B))\n    print(\"Number of trips for truck C: \", model.getVal(C))\n    print(\"Number of trips for truck D: \", model.getVal(D))\n    print(\"Number of trips for truck E: \", model.getVal(E))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000\n\n## Generate Constraint-2:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe total load capacity required is at least 1500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter. The company has a total of 100 trucks available. The total load capacity required is at least 1500 tons.\nPlease help the company to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total load capacity required is at least 1500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product and the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"ProductAW\", \"range\": \"ProductAW >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"ProductBW\", \"range\": \"ProductBW >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"ProductCW\", \"range\": \"ProductCW >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The labor cost per worker is $200 per day. The company wants to maximize the total daily profit.\n// Profit_ProductA = ProductAQty * 50 - ProductAW * 200\n// Profit_ProductB = ProductBQty * 70 - ProductBW * 200\n// Profit_ProductC = ProductCQty * 60 - ProductCW * 200\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// ProductAW + ProductBW + ProductCW <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity for each product and the number of workers assigned to each product line. The efficiency of workers varies per product line. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The labor cost per worker is $200 per day. The company wants to maximize the total daily profit.\n\n| Product | Profit per Unit | Labor Cost per Worker |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $200                  |\n| ProductB | $70             | $200                  |\n| ProductC | $60             | $200                  |\n\nThe company has a total of 50 workers available. Please help the company determine the optimal production quantity for each product and the number of workers assigned to each product line to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\nProductAW = model.addVar(vtype=\"INTEGER\", name=\"ProductAW\", lb=0) # number of workers for ProductA\nProductBW = model.addVar(vtype=\"INTEGER\", name=\"ProductBW\", lb=0) # number of workers for ProductB\nProductCW = model.addVar(vtype=\"INTEGER\", name=\"ProductCW\", lb=0) # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - ProductAW * 200\nProfit_ProductB = ProductBQty * 70 - ProductBW * 200\nProfit_ProductC = ProductCQty * 60 - ProductCW * 200\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(ProductAW + ProductBW + ProductCW <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(ProductAW))\n    print(\"Number of Workers for ProductB: \", model.getVal(ProductBW))\n    print(\"Number of Workers for ProductC: \", model.getVal(ProductCW))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of distributing each product varies with the number of units distributed. For product A, the cost per unit is 5$, for product B, it's 7$, for product C, it's 9$, and for product D, it's 11$. The company aims to minimize the total distribution cost, which is a nonlinear function due to economies of scale.\n// Distribution cost of A: Cost_A = 5 * A^2\n// Distribution cost of B: Cost_B = 7 * B^2\n// Distribution cost of C: Cost_C = 9 * C^2\n// Distribution cost of D: Cost_D = 11 * D^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for distribution costs.\n// 5 * A^2 + 7 * B^2 + 9 * C^2 + 11 * D^2 <= 10000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints. The cost per unit for distributing each product is given in the following Table.\n\n| Product | Cost per Unit |\n|---------|---------------|\n| A       | 5$            |\n| B       | 7$            |\n| C       | 9$            |\n| D       | 11$           |\n\nThe cost of distribution is a nonlinear function due to economies of scale, where the cost for product A is 5 * A^2, for product B is 7 * B^2, for product C is 9 * C^2, and for product D is 11 * D^2. The company aims to minimize the total distribution cost. The company has a budget of $10,000 for distribution costs.\n\nPlease help the company determine the optimal number of units of each product to distribute within the budget constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 5 * A**2\nCost_B = 7 * B**2\nCost_C = 9 * C**2\nCost_D = 11 * D**2\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D)\n\n# Add constraints\n## The company has a budget of $10,000 for distribution costs.\nmodel.addCons(5 * A**2 + 7 * B**2 + 9 * C**2 + 11 * D**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Minimized Distribution Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3.\n// {\"number of Type1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Type1 trucks\": \"FEU1\", \"range\": \"FEU1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type2 trucks\": \"FEU2\", \"range\": \"FEU2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type3 trucks\": \"FEU3\", \"range\": \"FEU3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n// Fuel cost for Type1 trucks: FC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\n// Fuel cost for Type2 trucks: FC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\n// Fuel cost for Type3 trucks: FC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\n// Upgrade cost: UC = 100 * (FEU1 + FEU2 + FEU3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency upgrades.\n// 100 * (FEU1 + FEU2 + FEU3) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 <= 100\n\n## Generate Constraint-3:\nDue to regional demand, the company must allocate at least 20 Type1 trucks and 30 Type2 trucks.\n// T1 >= 20; T2 >= 30\n\n## Generate Constraint-4:\nThe maximum fuel efficiency upgrade for each truck type is limited to $5,000.\n// FEU1 <= 5000; FEU2 <= 5000; FEU3 <= 5000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n\n| Truck Type | Fuel Cost per Kilometer |\n|------------|-------------------------|\n| Type1      | $0.50                   |\n| Type2      | $0.60                   |\n| Type3      | $0.70                   |\n\nThe company has a budget of $50,000 for fuel efficiency upgrades. The total number of trucks available is 100. Due to regional demand, the company must allocate at least 20 Type1 trucks and 30 Type2 trucks. The maximum fuel efficiency upgrade for each truck type is limited to $5,000.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and upgrade costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=20) # number of Type1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=30) # number of Type2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Type3 trucks\nFEU1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU1\", lb=0, ub=5000) # fuel efficiency upgrade for Type1 trucks\nFEU2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU2\", lb=0, ub=5000) # fuel efficiency upgrade for Type2 trucks\nFEU3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU3\", lb=0, ub=5000) # fuel efficiency upgrade for Type3 trucks\n\n# Define objective function\nFC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\nFC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\nFC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\nUC = 100 * (FEU1 + FEU2 + FEU3)\n# So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FC1 + FC2 + FC3 + UC)\n\n# Add constraints\nmodel.addCons(100 * (FEU1 + FEU2 + FEU3) <= 50000) # Budget constraint for upgrades\nmodel.addCons(T1 + T2 + T3 <= 100) # Total number of trucks constraint\nmodel.addCons(T1 >= 20) # Minimum Type1 trucks constraint\nmodel.addCons(T2 >= 30) # Minimum Type2 trucks constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type3 Trucks: \", model.getVal(T3))\n    print(\"Fuel Efficiency Upgrade for Type1: \", model.getVal(FEU1))\n    print(\"Fuel Efficiency Upgrade for Type2: \", model.getVal(FEU2))\n    print(\"Fuel Efficiency Upgrade for Type3: \", model.getVal(FEU3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1255,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal systems\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels is 0.2 kWh per panel per day, with a cost of $1000 per panel and a lifespan of 20 years.\nThe efficiency of wind turbines is 0.3 kWh per turbine per day, with a cost of $2000 per turbine and a lifespan of 15 years.\nThe efficiency of hydroelectric plants is 0.4 kWh per plant per day, with a cost of $3000 per plant and a lifespan of 25 years.\nThe efficiency of geothermal systems is 0.25 kWh per system per day, with a cost of $2500 per system and a lifespan of 20 years.\nThe efficiency of biomass generators is 0.15 kWh per generator per day, with a cost of $1500 per generator and a lifespan of 10 years.\nThe city aims to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).\n// Daily energy production: Energy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\n// Investment cost: Cost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n// So, the objective function is: Maximize Energy / Cost\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of these systems.\n// 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000\n\n## Generate Constraint-2:\nThe city wants to ensure that at least 10% of the budget is spent on each type of system.\n// 1000 * Solar >= 100000\n// 2000 * Wind >= 100000\n// 3000 * Hydro >= 100000\n// 2500 * Geothermal >= 100000\n// 1500 * Biomass >= 100000",
        "question": "A city is planning to install five different types of renewable energy systems: solar panels, wind turbines, hydroelectric plants, geothermal systems, and biomass generators. The city needs to decide how many units of each system to install to optimize energy production and cost. The efficiency, cost per unit, and lifespan of each system are given in the following Table.\n\n| System Type       | Efficiency (kWh/day) | Cost per Unit | Lifespan |\n|-------------------|----------------------|---------------|----------|\n| Solar Panels      | 0.2                  | $1000         | 20 years |\n| Wind Turbines     | 0.3                  | $2000         | 15 years |\n| Hydroelectric     | 0.4                  | $3000         | 25 years |\n| Geothermal        | 0.25                 | $2500         | 20 years |\n| Biomass Generators| 0.15                 | $1500         | 10 years |\n\nThe city has a budget of $1,000,000 for the installation of these systems. The city wants to ensure that at least 10% of the budget is spent on each type of system. The city aims to maximize the total daily energy production per total investment cost (which is defined as the sum of the daily energy production divided by the sum of the investment costs).\n\nPlease help the city to determine the optimal number of units of each renewable energy system to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric plants\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal systems\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.2 * Solar + 0.3 * Wind + 0.4 * Hydro + 0.25 * Geothermal + 0.15 * Biomass\nCost = 1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass\n## the objective function is: Maximize Energy / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation of these systems.\nmodel.addCons(1000 * Solar + 2000 * Wind + 3000 * Hydro + 2500 * Geothermal + 1500 * Biomass <= 1000000)\n## The city wants to ensure that at least 10% of the budget is spent on each type of system.\nmodel.addCons(1000 * Solar >= 100000)\nmodel.addCons(2000 * Wind >= 100000)\nmodel.addCons(3000 * Hydro >= 100000)\nmodel.addCons(2500 * Geothermal >= 100000)\nmodel.addCons(1500 * Biomass >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Systems: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Generators: \", model.getVal(Biomass))\n    print(\"Maximized Energy Production per Investment Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1342,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency rate based on the number of trucks allocated. The efficiency rate is defined as the number of packages delivered per hour. \nOn route 1, each truck delivers 100 packages per hour. \nOn route 2, each truck delivers 120 packages per hour. \nOn route 3, each truck delivers 150 packages per hour. \nOn route 4, each truck delivers 130 packages per hour. \nOn route 5, each truck delivers 110 packages per hour. \nThe company aims to maximize the total number of packages delivered per hour across all routes.\n// The total delivery rate for route 1: R1 = 100 * T1\n// The total delivery rate for route 2: R2 = 120 * T2\n// The total delivery rate for route 3: R3 = 150 * T3\n// The total delivery rate for route 4: R4 = 130 * T4\n// The total delivery rate for route 5: R5 = 110 * T5\n// So, the objective function is: Maximize (R1 + R2 + R3 + R4 + R5)\n// Maximize (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 25 trucks.\n// T1 <= 25; T2 <= 25; T3 <= 25; T4 <= 25; T5 <= 25\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10",
        "question": "A logistics company operates 5 different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency rate based on the number of trucks allocated. On route 1, each truck delivers 100 packages per hour. On route 2, each truck delivers 120 packages per hour. On route 3, each truck delivers 150 packages per hour. On route 4, each truck delivers 130 packages per hour. On route 5, each truck delivers 110 packages per hour. The company aims to maximize the total number of packages delivered per hour across all routes. The company has a total of 100 trucks available. Each route can handle a maximum of 25 trucks. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels. Please help the company to maximize the total number of packages delivered per hour across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks on route 5\n\n# Define objective function\n## The company aims to maximize the total number of packages delivered per hour across all routes.\nR1 = 100 * T1\nR2 = 120 * T2\nR3 = 150 * T3\nR4 = 130 * T4\nR5 = 110 * T5\n## So, the objective function is: Maximize (R1 + R2 + R3 + R4 + R5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3 + R4 + R5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route can handle a maximum of 25 trucks.\nmodel.addCons(T1 <= 25)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 25)\nmodel.addCons(T4 <= 25)\nmodel.addCons(T5 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Delivery Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (A, B, C, D, and E) to transport goods. Each vehicle has a different capacity and operating cost.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a capacity of 10 tons, an operating cost of $50 per day, and a fuel efficiency of 5 km/l.\nVehicle B has a capacity of 15 tons, an operating cost of $70 per day, and a fuel efficiency of 7 km/l.\nVehicle C has a capacity of 20 tons, an operating cost of $90 per day, and a fuel efficiency of 9 km/l.\nVehicle D has a capacity of 25 tons, an operating cost of $110 per day, and a fuel efficiency of 11 km/l.\nVehicle E has a capacity of 30 tons, an operating cost of $130 per day, and a fuel efficiency of 13 km/l.\nThe company wants to minimize the cost per ton-kilometer (defined as the total operating cost divided by the total ton-kilometers transported).\n// Total operating cost: Cost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\n// Total ton-kilometers: TonKM = (10 * 5 * A + 15 * 7 * B + 20 * 9 * C + 25 * 11 * D + 30 * 13 * E) / 1000 (converted to thousands for simplification)\n// So, the objective function is: Minimize Cost / TonKM\n\n## Generate Constraint-1:\nThe total daily budget for operating costs is $10,000.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-2:\nThe company must transport at least 1000 tons per day.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000",
        "question": "A logistics company operates five different types of vehicles (A, B, C, D, and E) to transport goods. Each vehicle has a different capacity, operating cost, and fuel efficiency. The details for each vehicle are provided in the following Table.\n\n| Vehicle | Capacity (tons) | Operating Cost ($/day) | Fuel Efficiency (km/l) |\n|---------|-----------------|------------------------|-----------------------|\n| A       | 10              | 50                     | 5                     |\n| B       | 15              | 70                     | 7                     |\n| C       | 20              | 90                     | 9                     |\n| D       | 25              | 110                    | 11                    |\n| E       | 30              | 130                    | 13                    |\n\nThe company has a total daily budget for operating costs of $10,000. The company must transport at least 1000 tons per day. \n\nPlease help the company to minimize the cost per ton-kilometer (defined as the total operating cost divided by the total ton-kilometers transported).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of vehicles D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of vehicles E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nTonKM = (10 * 5 * A + 15 * 7 * B + 20 * 9 * C + 25 * 11 * D + 30 * 13 * E) / 1000\n## convert the division to multiplication\nmodel.addCons(obj * TonKM == Cost)\n\n# Add constraints\n## The total daily budget for operating costs is $10,000.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n## The company must transport at least 1000 tons per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Number of Vehicles D: \", model.getVal(D))\n    print(\"Number of Vehicles E: \", model.getVal(E))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n// NetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\n// NetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\n// NetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n// So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all wind farms is $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limit of 100 turbines that can be installed across all types.\n// Turbines1 + Turbines2 + Turbines3 <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\n// Turbines1 >= 20; Turbines2 >= 30",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n\n| Wind Farm Type | Maintenance Investment Impact per $1000 | Operational Cost per MWh |\n|-----------------|-----------------------------------------|--------------------------|\n| Type1           | 1 MWh                                   | $50                      |\n| Type2           | 1.5 MWh                                 | $40                      |\n| Type3           | 2 MWh                                   | $30                      |\n\nThe total maintenance budget for all wind farms is $100,000. The company has a limit of 100 turbines that can be installed across all types. Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\n\nPlease help the company to maximize the net profit from energy sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=0)  # number of turbines for Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=0)  # number of turbines for Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)  # number of turbines for Type3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance investment for Type2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance investment for Type3\n\n# Define objective function\nNetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\nNetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\nNetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit1 + NetProfit2 + NetProfit3)\n\n# Add constraints\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)  # total maintenance budget\nmodel.addCons(Turbines1 + Turbines2 + Turbines3 <= 100)  # limit of turbines\nmodel.addCons(Turbines1 >= 20)  # at least 20 turbines of Type1\nmodel.addCons(Turbines2 >= 30)  # at least 30 turbines of Type2\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines for Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines for Type3: \", model.getVal(Turbines3))\n    print(\"Maintenance Investment for Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment for Type2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Investment for Type3: \", model.getVal(Maintenance3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1473,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, with a carbon emission of 10 kg per unit.\nThe profit per unit of Product B is $70, with a carbon emission of 15 kg per unit.\nThe profit per unit of Product C is $60, with a carbon emission of 12 kg per unit.\nThe profit per unit of Product D is $80, with a carbon emission of 20 kg per unit.\nThe profit per unit of Product E is $90, with a carbon emission of 25 kg per unit.\nThe company wants to maximize the Profit-Carbon ratio of the production. (The Profit-Carbon ratio is defined as the total profit divided by the total carbon emissions.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total carbon emissions: Carbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n// So, the objective function is: Maximize Profit / Carbon\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1500\n\n## Generate Constraint-2:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200\n\n## Generate Constraint-3:\nThe total carbon emissions must not exceed 20,000 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit of Product A is $50, with a carbon emission of 10 kg per unit. The profit per unit of Product B is $70, with a carbon emission of 15 kg per unit. The profit per unit of Product C is $60, with a carbon emission of 12 kg per unit. The profit per unit of Product D is $80, with a carbon emission of 20 kg per unit. The profit per unit of Product E is $90, with a carbon emission of 25 kg per unit. The company wants to maximize the Profit-Carbon ratio of the production, which is defined as the total profit divided by the total carbon emissions. The company has a total production capacity of 1500 units across all products. The company must produce at least 200 units of Product A. The total carbon emissions must not exceed 20,000 kg. Please help the company determine the optimal amount of each product to produce to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCarbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n## the objective function is: Maximize Profit / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1500)\n## The company must produce at least 200 units of Product A.\nmodel.addCons(ProductA >= 200)\n## The total carbon emissions must not exceed 20,000 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates five different fields: A, B, C, D, and E. The farm needs to decide how many acres of each field to cultivate with a specific crop.\n// {\"acres of field A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of field B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of field C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of field D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"acres of field E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm grows a high-value crop that requires specific soil conditions and labor. The yield per acre varies by field due to soil quality and labor efficiency. \nField A yields 100 units per acre, with a cost of 50 units per acre.\nField B yields 120 units per acre, with a cost of 60 units per acre.\nField C yields 140 units per acre, with a cost of 70 units per acre.\nField D yields 160 units per acre, with a cost of 80 units per acre.\nField E yields 180 units per acre, with a cost of 90 units per acre.\nThe farm aims to maximize the net profit per acre, which is the difference between the yield and the cost, divided by the total acres cultivated.\n// Net profit per acre of A: Profit_A = (100 - 50) / A\n// Net profit per acre of B: Profit_B = (120 - 60) / B\n// Net profit per acre of C: Profit_C = (140 - 70) / C\n// Net profit per acre of D: Profit_D = (160 - 80) / D\n// Net profit per acre of E: Profit_E = (180 - 90) / E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nThe farm must cultivate at least 10 acres in each field.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-3:\nThe farm has a budget constraint of $7000 for cultivation costs.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 7000\n\n## Generate Constraint-4:\nThe farm wants to ensure that the total acres cultivated in Field E does not exceed the combined acres cultivated in Fields A, B, and C.\n// E <= A + B + C",
        "question": "A farm operates five different fields: A, B, C, D, and E. The farm needs to decide how many acres of each field to cultivate with a specific crop. The yield per acre and the cost per acre for each field are given in the following Table.\n\n| Field | Yield per Acre | Cost per Acre |\n|-------|----------------|---------------|\n| A     | 100 units      | 50 units      |\n| B     | 120 units      | 60 units      |\n| C     | 140 units      | 70 units      |\n| D     | 160 units      | 80 units      |\n| E     | 180 units      | 90 units      |\n\nThe farm has a total of 100 acres available for cultivation. The farm must cultivate at least 10 acres in each field. The farm has a budget constraint of $7000 for cultivation costs. The farm wants to ensure that the total acres cultivated in Field E does not exceed the combined acres cultivated in Fields A, B, and C. \nPlease help the farm to maximize the net profit per acre, which is the difference between the yield and the cost, divided by the total acres cultivated.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must cultivate at least 10 acres in each field.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of field A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of field B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of field C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # acres of field D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # acres of field E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) / A\nProfit_B = (120 - 60) / B\nProfit_C = (140 - 70) / C\nProfit_D = (160 - 80) / D\nProfit_E = (180 - 90) / E\nTotalAcres = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C + D + E <= 100)\n## The farm has a budget constraint of $7000 for cultivation costs.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 7000)\n## The farm wants to ensure that the total acres cultivated in Field E does not exceed the combined acres cultivated in Fields A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Field A: \", model.getVal(A))\n    print(\"Acres of Field B: \", model.getVal(B))\n    print(\"Acres of Field C: \", model.getVal(C))\n    print(\"Acres of Field D: \", model.getVal(D))\n    print(\"Acres of Field E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\n// {\"trips to D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs).\n// NetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1^2\n// NetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2^2\n// NetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3^2\n// NetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4^2\n// NetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5^2\n// So, the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10000.\n// 200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget that cannot exceed $2000.\n// 0.01 * D1^2 + 0.015 * D2^2 + 0.02 * D3^2 + 0.025 * D4^2 + 0.03 * D5^2 <= 2000\n\n## Generate Constraint-3:\nThe company has a limit of 50 trips per truck.\n// D1 + D2 + D3 + D4 + D5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company has a total fuel budget of $10000. The company has a maintenance budget that cannot exceed $2000. The company has a limit of 50 trips per truck.\nPlease help the company to maximize the net profit (total profit minus total costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # trips to D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # trips to D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # trips to D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # trips to D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # trips to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate net profit for each destination\nNetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1**2\nNetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2**2\nNetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3**2\nNetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4**2\nNetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5**2\n\n## the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\nmodel.addCons(obj == NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n# Add constraints\n## The company has a total fuel budget of $10000.\nmodel.addCons(200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000)\n## The company has a maintenance budget that cannot exceed $2000.\nmodel.addCons(0.01 * D1**2 + 0.015 * D2**2 + 0.02 * D3**2 + 0.025 * D4**2 + 0.03 * D5**2 <= 2000)\n## The company has a limit of 50 trips per truck.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(D1))\n    print(\"Trips to D2: \", model.getVal(D2))\n    print(\"Trips to D3: \", model.getVal(D3))\n    print(\"Trips to D4: \", model.getVal(D4))\n    print(\"Trips to D5: \", model.getVal(D5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering the cost of operation and maintenance. Additionally, the company needs to decide on the fuel efficiency upgrades for each type of vehicle to further enhance their operational efficiency.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Trucks\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Vans\": \"VanUpgrade\", \"range\": \"VanUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Bikes\": \"BikeUpgrade\", \"range\": \"BikeUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per vehicle decreases with the investment in fuel efficiency upgrades. For Trucks, the operational cost per mile is $0.50 without upgrades, decreasing by $0.01 for every $100 invested in upgrades. For Vans, the operational cost per mile is $0.30, decreasing by $0.008 for every $100 invested in upgrades. For Bikes, the operational cost per mile is $0.10, decreasing by $0.005 for every $100 invested in upgrades. The company aims to minimize the total operational cost per day.\n// Total operational cost for Trucks: CostTruck = 0.50 - 0.0001 * TruckUpgrade * TruckCount\n// Total operational cost for Vans: CostVan = 0.30 - 0.00008 * VanUpgrade * VanCount\n// Total operational cost for Bikes: CostBike = 0.10 - 0.00005 * BikeUpgrade * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades and vehicle purchases.\n// TruckUpgrade * TruckCount + VanUpgrade * VanCount + BikeUpgrade * BikeCount <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and operational limitations.\n// TruckCount + VanCount + BikeCount <= 100\n\n## Generate Constraint-3:\nThe company must have at least 10 Trucks and 20 Vans to meet contractual obligations.\n// TruckCount >= 10; VanCount >= 20",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle and the appropriate fuel efficiency upgrades for each to maximize operational efficiency while considering the cost of operation and maintenance. The operational cost per vehicle decreases with the investment in fuel efficiency upgrades. For Trucks, the operational cost per mile is $0.50 without upgrades, decreasing by $0.01 for every $100 invested in upgrades. For Vans, the operational cost per mile is $0.30, decreasing by $0.008 for every $100 invested in upgrades. For Bikes, the operational cost per mile is $0.10, decreasing by $0.005 for every $100 invested in upgrades. The company aims to minimize the total operational cost per day. The company has a budget of $10,000 for fuel efficiency upgrades and vehicle purchases. The total number of vehicles cannot exceed 100 due to parking and operational limitations. The company must have at least 10 Trucks and 20 Vans to meet contractual obligations. Please help the company to determine the optimal number of each type of vehicle and the appropriate fuel efficiency upgrades to minimize the total operational cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=10)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=20)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckUpgrade\", lb=0)  # fuel efficiency upgrade for Trucks\nVanUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"VanUpgrade\", lb=0)  # fuel efficiency upgrade for Vans\nBikeUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeUpgrade\", lb=0)  # fuel efficiency upgrade for Bikes\n\n# Define objective function\nCostTruck = 0.50 - 0.0001 * TruckUpgrade * TruckCount\nCostVan = 0.30 - 0.00008 * VanUpgrade * VanCount\nCostBike = 0.10 - 0.00005 * BikeUpgrade * BikeCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckUpgrade * TruckCount + VanUpgrade * VanCount + BikeUpgrade * BikeCount <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Truck Upgrade: \", model.getVal(TruckUpgrade))\n    print(\"Van Upgrade: \", model.getVal(VanUpgrade))\n    print(\"Bike Upgrade: \", model.getVal(BikeUpgrade))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, D5) to optimize energy production and minimize environmental impact.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, the efficiency is 80%, in D2 it's 75%, in D3 it's 70%, in D4 it's 85%, and in D5 it's 90%. The cost of installation per panel also varies: $1000 in D1, $1200 in D2, $1100 in D3, $900 in D4, and $1300 in D5. The city aims to maximize the energy production efficiency per dollar spent.\n// Energy_D1 = 0.8 * D1\n// Energy_D2 = 0.75 * D2\n// Energy_D3 = 0.7 * D3\n// Energy_D4 = 0.85 * D4\n// Energy_D5 = 0.9 * D5\n// Total_Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n// So, the objective function is: Maximize (Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5) / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000\n\n## Generate Constraint-2:\nEach district has a limited number of suitable rooftops: 100 in D1, 120 in D2, 110 in D3, 90 in D4, and 130 in D5.\n// D1 <= 100\n// D2 <= 120\n// D3 <= 110\n// D4 <= 90\n// D5 <= 130\n\n## Generate Constraint-3:\nThe city aims to install at least 500 solar panels in total.\n// D1 + D2 + D3 + D4 + D5 >= 500\n\n## Generate Constraint-4:\nThe city wants to ensure that no more than 40% of the total budget is spent in any single district.\n// 1000 * D1 <= 0.4 * 100000\n// 1200 * D2 <= 0.4 * 100000\n// 1100 * D3 <= 0.4 * 100000\n// 900 * D4 <= 0.4 * 100000\n// 1300 * D5 <= 0.4 * 100000",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, D5) to optimize energy production and minimize environmental impact. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, the efficiency is 80%, in D2 it's 75%, in D3 it's 70%, in D4 it's 85%, and in D5 it's 90%. The cost of installation per panel also varies: $1000 in D1, $1200 in D2, $1100 in D3, $900 in D4, and $1300 in D5. The city has a budget of $100,000 for the installation of solar panels. Each district has a limited number of suitable rooftops: 100 in D1, 120 in D2, 110 in D3, 90 in D4, and 130 in D5. The city aims to install at least 500 solar panels in total and wants to ensure that no more than 40% of the total budget is spent in any single district. Please help the city to maximize the energy production efficiency per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\nEnergy_D1 = 0.8 * D1\nEnergy_D2 = 0.75 * D2\nEnergy_D3 = 0.7 * D3\nEnergy_D4 = 0.85 * D4\nEnergy_D5 = 0.9 * D5\nTotal_Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n# So, the objective function is: Maximize (Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5) / Total_Cost\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Total_Cost == Energy_D1 + Energy_D2 + Energy_D3 + Energy_D4 + Energy_D5)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000)\n# Each district has a limited number of suitable rooftops: 100 in D1, 120 in D2, 110 in D3, 90 in D4, and 130 in D5.\nmodel.addCons(D1 <= 100)\nmodel.addCons(D2 <= 120)\nmodel.addCons(D3 <= 110)\nmodel.addCons(D4 <= 90)\nmodel.addCons(D5 <= 130)\n# The city aims to install at least 500 solar panels in total.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 >= 500)\n# The city wants to ensure that no more than 40% of the total budget is spent in any single district.\nmodel.addCons(1000 * D1 <= 0.4 * 100000)\nmodel.addCons(1200 * D2 <= 0.4 * 100000)\nmodel.addCons(1100 * D3 <= 0.4 * 100000)\nmodel.addCons(900 * D4 <= 0.4 * 100000)\nmodel.addCons(1300 * D5 <= 0.4 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Efficiency per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints.\n// {\"production quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_ProductA = (50 - 10) * ProductA\n// Total net profit for ProductB: Profit_ProductB = (70 - 15) * ProductB\n// Total net profit for ProductC: Profit_ProductC = (90 - 20) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40.\n// 20 * ProductA + 30 * ProductB + 40 * ProductC <= 20,000\n\n## Generate Constraint-4:\nTo maintain market presence, the company must produce at least 50 units of each product.\n// ProductA >= 50; ProductB >= 50; ProductC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints. The profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total. Due to market demand, the production of ProductB must be at least twice the production of ProductA. The company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40. To maintain market presence, the company must produce at least 50 units of each product.\n\nPlease help the company to determine the optimal production quantities of ProductA, ProductB, and ProductC to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50) # production quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50) # production quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50) # production quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 10) * ProductA\nProfit_ProductB = (70 - 15) * ProductB\nProfit_ProductC = (90 - 20) * ProductC\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited warehouse space, which can store a maximum of 1000 units in total.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# Due to market demand, the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductB >= 2 * ProductA)\n# The company has a fixed budget for production costs, which is $20,000.\nmodel.addCons(20 * ProductA + 30 * ProductB + 40 * ProductC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine the production quantity for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the profit per unit is $50, the production cost per unit is $20, and the storage cost per unit is $10.\nFor product B, the profit per unit is $70, the production cost per unit is $30, and the storage cost per unit is $15.\nFor product C, the profit per unit is $90, the production cost per unit is $40, and the storage cost per unit is $20.\nFor product D, the profit per unit is $60, the production cost per unit is $25, and the storage cost per unit is $12.\nFor product E, the profit per unit is $80, the production cost per unit is $35, and the storage cost per unit is $18.\nThe company aims to maximize the total profit per unit of storage space used.\n// Profit of A: Profit_A = (50 - 20 - 10) * A\n// Profit of B: Profit_B = (70 - 30 - 15) * B\n// Profit of C: Profit_C = (90 - 40 - 20) * C\n// Profit of D: Profit_D = (60 - 25 - 12) * D\n// Profit of E: Profit_E = (80 - 35 - 18) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (10 * A + 15 * B + 20 * C + 12 * D + 18 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production costs.\n// 20 * A + 30 * B + 40 * C + 25 * D + 35 * E <= 15,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe company has a storage capacity of 1000 units.\n// 10 * A + 15 * B + 20 * C + 12 * D + 18 * E <= 1000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A and B.\n// D <= A + B",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine the production quantity for each product to optimize its operations.\nFor product A, the profit per unit is $50, the production cost per unit is $20, and the storage cost per unit is $10.\nFor product B, the profit per unit is $70, the production cost per unit is $30, and the storage cost per unit is $15.\nFor product C, the profit per unit is $90, the production cost per unit is $40, and the storage cost per unit is $20.\nFor product D, the profit per unit is $60, the production cost per unit is $25, and the storage cost per unit is $12.\nFor product E, the profit per unit is $80, the production cost per unit is $35, and the storage cost per unit is $18.\nThe company has a budget of $15,000 for production costs. The company wants to produce at least 50 units of each product. The company has a storage capacity of 1000 units. The company wants to ensure that the production of product D does not exceed the combined production of products A and B.\nPlease help the company to maximize the total profit per unit of storage space used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20 - 10) * A\nProfit_B = (70 - 30 - 15) * B\nProfit_C = (90 - 40 - 20) * C\nProfit_D = (60 - 25 - 12) * D\nProfit_E = (80 - 35 - 18) * E\nStorageCost = 10 * A + 15 * B + 20 * C + 12 * D + 18 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 25 * D + 35 * E <= 15000)\n## The company has a storage capacity of 1000 units.\nmodel.addCons(10 * A + 15 * B + 20 * C + 12 * D + 18 * E <= 1000)\n## The company wants to ensure that the production of product D does not exceed the combined production of products A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1144,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in region 1\": \"FE1\", \"range\": \"FE1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 2\": \"FE2\", \"range\": \"FE2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 3\": \"FE3\", \"range\": \"FE3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 4\": \"FE4\", \"range\": \"FE4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 5\": \"FE5\", \"range\": \"FE5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n// Total fuel cost for region 1: Cost1 = (3.50 * (D / FE1)) * T1\n// Total fuel cost for region 2: Cost2 = (3.50 * (D / FE2)) * T2\n// Total fuel cost for region 3: Cost3 = (3.50 * (D / FE3)) * T3\n// Total fuel cost for region 4: Cost4 = (3.50 * (D / FE4)) * T4\n// Total fuel cost for region 5: Cost5 = (3.50 * (D / FE5)) * T5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe fuel efficiency of trucks in each region must be at least 10 miles per gallon.\n// FE1 >= 10; FE2 >= 10; FE3 >= 10; FE4 >= 10; FE5 >= 10\n\n## Generate Constraint-3:\nEach region must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5\n\n## Generate Constraint-4:\nThe total fuel cost for any region cannot exceed $5000.\n// (3.50 * (D / FE1)) * T1 <= 5000; (3.50 * (D / FE2)) * T2 <= 5000; (3.50 * (D / FE3)) * T3 <= 5000; (3.50 * (D / FE4)) * T4 <= 5000; (3.50 * (D / FE5)) * T5 <= 5000\n\n## Generate Constraint-5:\nThe number of trucks in any region cannot exceed 30.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region. The company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region. The company has a total of 100 trucks available. The fuel efficiency of trucks in each region must be at least 10 miles per gallon. Each region must have at least 5 trucks. The total fuel cost for any region cannot exceed $5000. The number of trucks in any region cannot exceed 30. Please help the company to minimize the total fuel cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=30) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5, ub=30) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5, ub=30) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5, ub=30) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5, ub=30) # number of trucks in region 5\nFE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE1\", lb=10) # fuel efficiency of trucks in region 1\nFE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE2\", lb=10) # fuel efficiency of trucks in region 2\nFE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE3\", lb=10) # fuel efficiency of trucks in region 3\nFE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE4\", lb=10) # fuel efficiency of trucks in region 4\nFE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE5\", lb=10) # fuel efficiency of trucks in region 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\") # distance each truck travels\n## Total fuel cost for each region\nCost1 = 3.50 * (D / FE1) * T1\nCost2 = 3.50 * (D / FE2) * T2\nCost3 = 3.50 * (D / FE3) * T3\nCost4 = 3.50 * (D / FE4) * T4\nCost5 = 3.50 * (D / FE5) * T5\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each region must have at least 5 trucks.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 5)\nmodel.addCons(T3 >= 5)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 5)\n## The total fuel cost for any region cannot exceed $5000.\nmodel.addCons(3.50 * (D / FE1) * T1 <= 5000)\nmodel.addCons(3.50 * (D / FE2) * T2 <= 5000)\nmodel.addCons(3.50 * (D / FE3) * T3 <= 5000)\nmodel.addCons(3.50 * (D / FE4) * T4 <= 5000)\nmodel.addCons(3.50 * (D / FE5) * T5 <= 5000)\n## The number of trucks in any region cannot exceed 30.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Fuel Efficiency in Region 1: \", model.getVal(FE1))\n    print(\"Fuel Efficiency in Region 2: \", model.getVal(FE2))\n    print(\"Fuel Efficiency in Region 3: \", model.getVal(FE3))\n    print(\"Fuel Efficiency in Region 4: \", model.getVal(FE4))\n    print(\"Fuel Efficiency in Region 5: \", model.getVal(FE5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route decreases with the investment in fuel-efficient technology. Specifically, for every $1000 invested, the fuel consumption decreases by 10 liters per truck per route. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Fuel1 = (1000 - 0.01 * Tech1) * Trucks1\n// Fuel consumption for Route2: Fuel2 = (1000 - 0.01 * Tech2) * Trucks2\n// Fuel consumption for Route3: Fuel3 = (1000 - 0.01 * Tech3) * Trucks3\n// Fuel consumption for Route4: Fuel4 = (1000 - 0.01 * Tech4) * Trucks4\n// Fuel consumption for Route5: Fuel5 = (1000 - 0.01 * Tech5) * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000",
        "question": "A logistics company is planning its routes for the next quarter. The company operates five different routes (Route1, Route2, Route3, Route4, Route5) and needs to decide the number of trucks to allocate to each route. Additionally, the company is considering investing in fuel-efficient technologies for its fleet, which will reduce fuel consumption per route. The relationship between investment in fuel-efficient technology and fuel consumption reduction is such that for every $1000 invested, the fuel consumption decreases by 10 liters per truck per route.\n\n| Route | Number of Trucks | Investment in Fuel-Efficient Technology |\n|-------|------------------|-----------------------------------------|\n| Route1 | Trucks1 | Tech1 |\n| Route2 | Trucks2 | Tech2 |\n| Route3 | Trucks3 | Tech3 |\n| Route4 | Trucks4 | Tech4 |\n| Route5 | Trucks5 | Tech5 |\n\nThe company has a budget of $100,000 for investments in fuel-efficient technologies. The company aims to minimize the total fuel consumption across all routes.\n\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in fuel-efficient technologies for each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks for Route5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Route3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0) # investment in fuel-efficient technology for Route4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0) # investment in fuel-efficient technology for Route5\n\n# Define objective function\nFuel1 = (1000 - 0.01 * Tech1) * Trucks1\nFuel2 = (1000 - 0.01 * Tech2) * Trucks2\nFuel3 = (1000 - 0.01 * Tech3) * Trucks3\nFuel4 = (1000 - 0.01 * Tech4) * Trucks4\nFuel5 = (1000 - 0.01 * Tech5) * Trucks5\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\n# The company has a budget of $100,000 for investments in fuel-efficient technologies.\nmodel.addCons(Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Route4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Route5: \", model.getVal(Tech5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of five different types of goods: A, B, C, D, and E. The company needs to decide how many tons of each type of goods to transport next month to optimize its operations.\n// {\"tons of goods A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"tons of goods B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"tons of goods C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"tons of goods D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"tons of goods E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per ton for goods A is $50, for goods B is $60, for goods C is $70, for goods D is $80, and for goods E is $90. The revenue per ton for goods A is $100, for goods B is $120, for goods C is $140, for goods D is $160, and for goods E is $180. The company aims to maximize the profit rate, which is defined as the total revenue minus the total cost, divided by the total weight of goods transported.\n// Cost of transporting A: Cost_A = 50 * A\n// Cost of transporting B: Cost_B = 60 * B\n// Cost of transporting C: Cost_C = 70 * C\n// Cost of transporting D: Cost_D = 80 * D\n// Cost of transporting E: Cost_E = 90 * E\n// Revenue of A: Revenue_A = 100 * A\n// Revenue of B: Revenue_B = 120 * B\n// Revenue of C: Revenue_C = 140 * C\n// Revenue of D: Revenue_D = 160 * D\n// Revenue of E: Revenue_E = 180 * E\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for transportation costs next month.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to transport at least 50 tons of each type of goods next month.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50",
        "question": "A logistics company manages the transportation of five different types of goods: A, B, C, D, and E. The company needs to decide how many tons of each type of goods to transport next month to optimize its operations. The transportation cost per ton for goods A is $50, for goods B is $60, for goods C is $70, for goods D is $80, and for goods E is $90. The revenue per ton for goods A is $100, for goods B is $120, for goods C is $140, for goods D is $160, and for goods E is $180. The company aims to maximize the profit rate, which is defined as the total revenue minus the total cost, divided by the total weight of goods transported. The company has a budget of $10,000 for transportation costs next month. The company wants to transport at least 50 tons of each type of goods next month. Please help the company to determine the optimal amount of each type of goods to transport to maximize the profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to transport at least 50 tons of each type of goods next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # tons of goods A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # tons of goods B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # tons of goods C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # tons of goods D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # tons of goods E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 50 * A\nCost_B = 60 * B\nCost_C = 70 * C\nCost_D = 80 * D\nCost_E = 90 * E\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 140 * C\nRevenue_D = 160 * D\nRevenue_E = 180 * E\nTotalWeight = A + B + C + D + E\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E) / TotalWeight\n## convert the division to multiplication\nmodel.addCons(obj * TotalWeight == Revenue_A + Revenue_B + Revenue_C + Revenue_D + Revenue_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for transportation costs next month.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Tons of goods A: \", model.getVal(A))\n    print(\"Tons of goods B: \", model.getVal(B))\n    print(\"Tons of goods C: \", model.getVal(C))\n    print(\"Tons of goods D: \", model.getVal(D))\n    print(\"Tons of goods E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery times. The company needs to determine the optimal speed for each truck and the number of trips each truck should make to minimize total fuel consumption and time spent on the road.\n// {\"speed of truck 1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of truck 2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"number of trips for truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The time spent on the road is directly proportional to the number of trips and inversely proportional to the speed. The company aims to minimize the total fuel consumption and total time spent on the road.\n// Fuel consumption for truck 1: Fuel1 = (Speed1^2) * Trips1\n// Fuel consumption for truck 2: Fuel2 = (Speed2^2) * Trips2\n// Time spent on the road for truck 1: Time1 = (Distance / Speed1) * Trips1\n// Time spent on the road for truck 2: Time2 = (Distance / Speed2) * Trips2\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Time1 + Time2)\n\n## Generate Constraint-1:\nThe total number of trips across both trucks must not exceed 100.\n// Trips1 + Trips2 <= 100\n\n## Generate Constraint-2:\nThe maximum allowable speed for any truck is 100 km/h.\n// Speed1 <= 100; Speed2 <= 100",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery times. The company needs to determine the optimal speed for each truck and the number of trips each truck should make to minimize total fuel consumption and time spent on the road.\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The time spent on the road is directly proportional to the number of trips and inversely proportional to the speed. The company aims to minimize the total fuel consumption and total time spent on the road.\nThe total number of trips across both trucks must not exceed 100. The maximum allowable speed for any truck is 100 km/h.\nPlease help the company to determine the optimal speeds (Speed1 and Speed2) and the number of trips (Trips1 and Trips2) for each truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of truck 1\": \"Speed1\", \"range\": \"0 <= Speed1 <= 100\", \"type\": \"continuous\"}\n## {\"speed of truck 2\": \"Speed2\", \"range\": \"0 <= Speed2 <= 100\", \"type\": \"continuous\"}\n## {\"number of trips for truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n## {\"number of trips for truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)\n\n# Define objective function\n## Fuel consumption for truck 1: Fuel1 = (Speed1^2) * Trips1\n## Fuel consumption for truck 2: Fuel2 = (Speed2^2) * Trips2\n## Time spent on the road for truck 1: Time1 = (Distance / Speed1) * Trips1\n## Time spent on the road for truck 2: Time2 = (Distance / Speed2) * Trips2\n## So, the objective function is: Minimize (Fuel1 + Fuel2 + Time1 + Time2)\nFuel1 = (Speed1**2) * Trips1\nFuel2 = (Speed2**2) * Trips2\nTime1 = (1 / Speed1) * Trips1  # Assuming Distance is 1 for simplicity\nTime2 = (1 / Speed2) * Trips2  # Assuming Distance is 1 for simplicity\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Time1 + Time2)\n\n# Add constraints\n## The total number of trips across both trucks must not exceed 100.\nmodel.addCons(Trips1 + Trips2 <= 100)\n## The maximum allowable speed for any truck is 100 km/h.\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of truck 1: \", model.getVal(Speed1))\n    print(\"Speed of truck 2: \", model.getVal(Speed2))\n    print(\"Number of trips for truck 1: \", model.getVal(Trips1))\n    print(\"Number of trips for truck 2: \", model.getVal(Trips2))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\n// {\"number of trucks allocated to Region A\": \"Truck_A\", \"range\": \"Truck_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"Truck_B\", \"range\": \"Truck_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"Truck_C\", \"range\": \"Truck_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"Truck_D\", \"range\": \"Truck_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"Truck_E\", \"range\": \"Truck_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n// Total revenue: Revenue = $100 * Truck_A + $120 * Truck_B + $140 * Truck_C + $160 * Truck_D + $180 * Truck_E\n// Total operational cost: Cost = $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E\n// Total delivery time: Time = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n// So, the objective function is: Maximize (Revenue / (Cost + Time))\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for operational costs.\n// $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E <= $50000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 100 trucks in total.\n// Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each region.\n// Truck_A >= 10; Truck_B >= 10; Truck_C >= 10; Truck_D >= 10; Truck_E >= 10",
        "question": "A logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency. The cost of operating a truck, the average delivery time, and the revenue per delivery for each region are given in the following Table.\n\n| Region | Cost per Day | Average Delivery Time | Revenue per Delivery |\n|--------|--------------|-----------------------|----------------------|\n| A      | $500         | 4 hours               | $100                 |\n| B      | $600         | 5 hours               | $120                 |\n| C      | $700         | 6 hours               | $140                 |\n| D      | $800         | 7 hours               | $160                 |\n| E      | $900         | 8 hours               | $180                 |\n\nThe company has a total budget of $50,000 for operational costs. The company can allocate a maximum of 100 trucks in total. The company must allocate at least 10 trucks to each region. \nPlease help the company to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_A = model.addVar(vtype=\"INTEGER\", name=\"Truck_A\", lb=10) # number of trucks allocated to Region A\nTruck_B = model.addVar(vtype=\"INTEGER\", name=\"Truck_B\", lb=10) # number of trucks allocated to Region B\nTruck_C = model.addVar(vtype=\"INTEGER\", name=\"Truck_C\", lb=10) # number of trucks allocated to Region C\nTruck_D = model.addVar(vtype=\"INTEGER\", name=\"Truck_D\", lb=10) # number of trucks allocated to Region D\nTruck_E = model.addVar(vtype=\"INTEGER\", name=\"Truck_E\", lb=10) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 100 * Truck_A + 120 * Truck_B + 140 * Truck_C + 160 * Truck_D + 180 * Truck_E\nCost = 500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E\nTime = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n## the objective function is: Maximize (Revenue / (Cost + Time))\n## convert the division to multiplication\nmodel.addCons(obj * (Cost + Time) == Revenue)\n\n# Add constraints\n## The company has a total budget of $50,000 for operational costs.\nmodel.addCons(500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E <= 50000)\n## The company can allocate a maximum of 100 trucks in total.\nmodel.addCons(Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(Truck_A))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(Truck_B))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(Truck_C))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(Truck_D))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(Truck_E))\n    print(\"Maximized Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1236,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs.\n// {\"fuel consumption of truck 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled. The cost function is given by C = F^2 * D, where F is the fuel consumption and D is the distance. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost: Cost = (F1^2 * D1) + (F2^2 * D2) + (F3^2 * D3) + (F4^2 * D4) + (F5^2 * D5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nEach truck must cover a minimum distance of 500 km.\n// D1 >= 500; D2 >= 500; D3 >= 500; D4 >= 500; D5 >= 500\n\n## Generate Constraint-2:\nThe total fuel consumption for all trucks must not exceed 1000 liters.\n// F1 + F2 + F3 + F4 + F5 <= 1000\n\n## Generate Constraint-3:\nThe maximum distance any truck can travel is 1000 km.\n// D1 <= 1000; D2 <= 1000; D3 <= 1000; D4 <= 1000; D5 <= 1000\n\n## Generate Constraint-4:\nThe fuel consumption of each truck is inversely proportional to its speed, which is a nonlinear relationship.\n// F1 = k1 / S1; F2 = k2 / S2; F3 = k3 / S3; F4 = k4 / S4; F5 = k5 / S5\n// where k1, k2, k3, k4, k5 are constants and S1, S2, S3, S4, S5 are the speeds of the trucks.",
        "question": "A logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs. The operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled, given by C = F^2 * D, where F is the fuel consumption and D is the distance. The company aims to minimize the total operational cost of all trucks. Each truck must cover a minimum distance of 500 km and the total fuel consumption for all trucks must not exceed 1000 liters. The maximum distance any truck can travel is 1000 km. The fuel consumption of each truck is inversely proportional to its speed, which is a nonlinear relationship. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define fuel consumption and distance for each truck\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of truck 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of truck 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of truck 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of truck 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of truck 5\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=500, ub=1000) # distance of truck 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=500, ub=1000) # distance of truck 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=500, ub=1000) # distance of truck 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=500, ub=1000) # distance of truck 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=500, ub=1000) # distance of truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost: Cost = (F1^2 * D1) + (F2^2 * D2) + (F3^2 * D3) + (F4^2 * D4) + (F5^2 * D5)\nCost = F1**2 * D1 + F2**2 * D2 + F3**2 * D3 + F4**2 * D4 + F5**2 * D5\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total fuel consumption for all trucks must not exceed 1000 liters.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of truck 1: \", model.getVal(F1))\n    print(\"Fuel consumption of truck 2: \", model.getVal(F2))\n    print(\"Fuel consumption of truck 3: \", model.getVal(F3))\n    print(\"Fuel consumption of truck 4: \", model.getVal(F4))\n    print(\"Fuel consumption of truck 5: \", model.getVal(F5))\n    print(\"Distance of truck 1: \", model.getVal(D1))\n    print(\"Distance of truck 2: \", model.getVal(D2))\n    print(\"Distance of truck 3: \", model.getVal(D3))\n    print(\"Distance of truck 4: \", model.getVal(D4))\n    print(\"Distance of truck 5: \", model.getVal(D5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company aims to maximize the total profit from the production of these three products.\n// Profit_A = A * (50 - 20)\n// Profit_B = B * (70 - 30)\n// Profit_C = C * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 20 * A + 30 * B + 25 * C <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe production of product A requires 2 hours of labor, product B requires 3 hours, and product C requires 2.5 hours. The total labor hours available per day are 1200 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1200\n\n## Generate Constraint-4:\nThe demand for product A must be at least 50 units per day.\n// A >= 50\n\n## Generate Constraint-5:\nThe demand for product B must be at least 30 units per day.\n// B >= 30",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available. The profit per unit, cost of production per unit, and labor hours required for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit | Labor Hours Required |\n|---------|-----------------|-----------------------------|----------------------|\n| A       | $50             | $20                         | 2 hours              |\n| B       | $70             | $30                         | 3 hours              |\n| C       | $60             | $25                         | 2.5 hours            |\n\nThe company has a total budget of $10,000 for production costs. The total production capacity of the company is limited to 500 units per day. The total labor hours available per day are 1200 hours. The demand for product A must be at least 50 units per day, and the demand for product B must be at least 30 units per day.\n\nPlease help the company to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = A * (50 - 20)\nProfit_B = B * (70 - 30)\nProfit_C = C * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C <= 10000) # Total budget constraint\nmodel.addCons(A + B + C <= 500) # Total production capacity constraint\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1200) # Total labor hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in five different renewable energy sources (Solar, Wind, Hydro, Geothermal, and Biomass). The company aims to balance cost, efficiency, and environmental impact.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"real\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"real\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"real\"}\n// {\"amount of energy from geothermal\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"real\"}\n// {\"amount of energy from biomass\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost per unit of energy for Solar is $0.05, Wind is $0.03, Hydro is $0.04, Geothermal is $0.06, and Biomass is $0.08. The efficiency of each source is 90% for Solar, 85% for Wind, 95% for Hydro, 80% for Geothermal, and 75% for Biomass. The environmental impact per unit of energy is 0.1 for Solar, 0.05 for Wind, 0.08 for Hydro, 0.07 for Geothermal, and 0.12 for Biomass. The company wants to minimize the Total Cost-Efficiency-Impact (CEI) Index, which is defined as the sum of the costs plus the sum of the inefficiencies plus the sum of the environmental impacts.\n// Total cost: Cost = 0.05 * Solar + 0.03 * Wind + 0.04 * Hydro + 0.06 * Geothermal + 0.08 * Biomass\n// Total inefficiency: Inefficiency = (1 - 90%) * Solar + (1 - 85%) * Wind + (1 - 95%) * Hydro + (1 - 80%) * Geothermal + (1 - 75%) * Biomass\n// Total environmental impact: Impact = 0.1 * Solar + 0.05 * Wind + 0.08 * Hydro + 0.07 * Geothermal + 0.12 * Biomass\n// So, the objective function is: Minimize (Cost + Inefficiency + Impact)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for this investment.\n// 0.05 * Solar + 0.03 * Wind + 0.04 * Hydro + 0.06 * Geothermal + 0.08 * Biomass <= 500000",
        "question": "A company is planning to optimize its energy consumption by investing in five different renewable energy sources (Solar, Wind, Hydro, Geothermal, and Biomass). The company aims to balance cost, efficiency, and environmental impact. The cost per unit of energy for Solar is $0.05, Wind is $0.03, Hydro is $0.04, Geothermal is $0.06, and Biomass is $0.08. The efficiency of each source is 90% for Solar, 85% for Wind, 95% for Hydro, 80% for Geothermal, and 75% for Biomass. The environmental impact per unit of energy is 0.1 for Solar, 0.05 for Wind, 0.08 for Hydro, 0.07 for Geothermal, and 0.12 for Biomass. The company wants to minimize the Total Cost-Efficiency-Impact (CEI) Index, which is defined as the sum of the costs plus the sum of the inefficiencies plus the sum of the environmental impacts. The company has a budget of $500,000 for this investment.\n\nPlease help the company to determine the optimal amounts of energy to invest in each renewable energy source to minimize the Total CEI Index.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"Solar\", lb=0) # amount of energy from solar\nWind = model.addVar(vtype=\"CONTINUOUS\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"Hydro\", lb=0) # amount of energy from hydro\nGeothermal = model.addVar(vtype=\"CONTINUOUS\", name=\"Geothermal\", lb=0) # amount of energy from geothermal\nBiomass = model.addVar(vtype=\"CONTINUOUS\", name=\"Biomass\", lb=0) # amount of energy from biomass\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost\nCost = 0.05 * Solar + 0.03 * Wind + 0.04 * Hydro + 0.06 * Geothermal + 0.08 * Biomass\n## Total inefficiency\nInefficiency = (1 - 0.9) * Solar + (1 - 0.85) * Wind + (1 - 0.95) * Hydro + (1 - 0.8) * Geothermal + (1 - 0.75) * Biomass\n## Total environmental impact\nImpact = 0.1 * Solar + 0.05 * Wind + 0.08 * Hydro + 0.07 * Geothermal + 0.12 * Biomass\n\n## the objective function is: Minimize (Cost + Inefficiency + Impact)\nmodel.addCons(obj == Cost + Inefficiency + Impact)\n\n# Add constraints\n## The company has a budget of $500,000 for this investment.\nmodel.addCons(0.05 * Solar + 0.03 * Wind + 0.04 * Hydro + 0.06 * Geothermal + 0.08 * Biomass <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Energy from Solar: \", model.getVal(Solar))\n    print(\"Amount of Energy from Wind: \", model.getVal(Wind))\n    print(\"Amount of Energy from Hydro: \", model.getVal(Hydro))\n    print(\"Amount of Energy from Geothermal: \", model.getVal(Geothermal))\n    print(\"Amount of Energy from Biomass: \", model.getVal(Biomass))\n    print(\"Minimized CEI Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Residential\": \"ResidentialStorage\", \"range\": \"ResidentialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Commercial\": \"CommercialStorage\", \"range\": \"CommercialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Industrial\": \"IndustrialStorage\", \"range\": \"IndustrialStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling energy is affected by the amount of energy storage. For Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms.\n// Total revenue for Residential: Revenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\n// Total revenue for Commercial: Revenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\n// Total revenue for Industrial: Revenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n// So, the objective function is: Maximize (Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for solar panel installations and energy storage investments.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000\n\n## Generate Constraint-2:\nThe total area available for solar panel installation across all types of farms is limited to 5000 square meters.\n// ResidentialPanels + CommercialPanels + IndustrialPanels <= 5000",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold. For Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms. The company has a total budget of $1,000,000 for solar panel installations and energy storage investments. The total area available for solar panel installation across all types of farms is limited to 5000 square meters. Please help the company to maximize the total annual revenue from all solar farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nResidentialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"ResidentialStorage\", lb=0)\nCommercialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialStorage\", lb=0)\nIndustrialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"IndustrialStorage\", lb=0)\n\n# Define objective function\nRevenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\nRevenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\nRevenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000)\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Investment in Residential Storage: \", model.getVal(ResidentialStorage))\n    print(\"Investment in Commercial Storage: \", model.getVal(CommercialStorage))\n    print(\"Investment in Industrial Storage: \", model.getVal(IndustrialStorage))\n    print(\"Maximized Total Annual Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day.\nThe medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day.\nThe large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 200 * Small + 300 * Medium + 400 * Large\n// Total fuel cost: FuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n// So, the objective function is: Minimize (VehicleCost + FuelCost)\n\n## Generate Constraint-1:\nThe total capacity of vehicles must meet or exceed the required delivery of 1000 units.\n// 50 * Small + 100 * Medium + 150 * Large >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 200 * Small + 300 * Medium + 400 * Large <= 10000\n\n## Generate Constraint-3:\nThe company can only rent a maximum of 20 vehicles in total.\n// Small + Medium + Large <= 20",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity, fuel consumption rate, and daily cost. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Capacity (units) | Fuel Consumption (liters/100 km) | Daily Cost ($) |\n|--------------|------------------|----------------------------------|----------------|\n| Small        | 50               | 10                               | 200            |\n| Medium       | 100              | 15                               | 300            |\n| Large        | 150              | 20                               | 400            |\n\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel. The total capacity of vehicles must meet or exceed the required delivery of 1000 units. The company has a budget of $10,000 for vehicle rental and can only rent a maximum of 20 vehicles in total.\n\nPlease help the company determine the optimal number of small, medium, and large vehicles to minimize the total cost of vehicles and fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0) # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0) # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0) # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nVehicleCost = 200 * Small + 300 * Medium + 400 * Large\nFuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n## the objective function is: Minimize (VehicleCost + FuelCost)\nmodel.addCons(obj == VehicleCost + FuelCost)\n\n# Add constraints\n## The total capacity of vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(50 * Small + 100 * Medium + 150 * Large >= 1000)\n## The company has a budget of $10,000 for vehicle rental.\nmodel.addCons(200 * Small + 300 * Medium + 400 * Large <= 10000)\n## The company can only rent a maximum of 20 vehicles in total.\nmodel.addCons(Small + Medium + Large <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company has a maximum capacity of 100 trips across all vehicles.\n// V1 + V2 + V3 <= 100\n\n## Generate Constraint-4:\nThe market demand for V1 trips is 10. So, the company can only make a maximum of 10 trips with V1.\n// V1 <= 10\n\n## Generate Constraint-5:\nThe company must ensure that at least 20% of the total trips are made by V2.\n// V2 >= 0.2 * (V1 + V2 + V3)",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations. The cost per trip, fuel consumption per trip, and revenue per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Fuel Consumption per Trip | Revenue per Trip |\n|---------|---------------|---------------------------|------------------|\n| V1      | $100          | 5 liters                  | $150             |\n| V2      | $120          | 6 liters                  | $180             |\n| V3      | $140          | 7 liters                  | $210             |\n\nThe company has a limited fuel budget of 500 liters. The company has a budget of $10,000 for operational costs. The company has a maximum capacity of 100 trips across all vehicles. The market demand for V1 trips is 10, so the company can only make a maximum of 10 trips with V1. The company must ensure that at least 20% of the total trips are made by V2.\n\nPlease help the company to maximize the profit efficiency (profit per liter of fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0, ub=10)  # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0)  # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0)  # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n## The company has a maximum capacity of 100 trips across all vehicles.\nmodel.addCons(V1 + V2 + V3 <= 100)\n## The market demand for V1 trips is 10. So, the company can only make a maximum of 10 trips with V1.\nmodel.addCons(V1 <= 10)\n## The company must ensure that at least 20% of the total trips are made by V2.\nmodel.addCons(V2 >= 0.2 * (V1 + V2 + V3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 trips: \", model.getVal(V1))\n    print(\"Number of V2 trips: \", model.getVal(V2))\n    print(\"Number of V3 trips: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The production of DeviceA must be at least twice the production of DeviceB.\nPlease help the company to determine the optimal production quantities for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n# The production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operating cost per TruckA is $5000, and the revenue per TruckA is $7000. \nThe operating cost per TruckB is $6000, and the revenue per TruckB is $8000. \nThe operating cost per TruckC is $7000, and the revenue per TruckC is $9000.\nThe operating cost per TruckD is $8000, and the revenue per TruckD is $10000.\nThe operating cost per TruckE is $9000, and the revenue per TruckE is $11000.\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company wants to maximize the total net profit from operating the trucks.\n// NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\n// NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\n// NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\n// NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\n// NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\n// So, the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing and maintaining the trucks.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckA <= 2 * TruckB\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can operate, which is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations. The operating cost and revenue per truck are given in the following Table.\n\n| Vehicle | Operating Cost | Revenue |\n|---------|----------------|---------|\n| TruckA  | $5000          | $7000   |\n| TruckB  | $6000          | $8000   |\n| TruckC  | $7000          | $9000   |\n| TruckD  | $8000          | $10000  |\n| TruckE  | $9000          | $11000  |\n\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company has a total budget of $500,000 for purchasing and maintaining the trucks. Due to licensing restrictions, the number of TruckA cannot exceed twice the number of TruckB. The company has a limit on the total number of trucks it can operate, which is 100.\n\nPlease help the company to maximize the total net profit from operating the trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## create piecewise variables for piecewise function: NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\nTruckA1 = model.addVar(vtype=\"INTEGER\", name=\"TruckA1\", lb=0, ub=1)\nTruckA2 = model.addVar(vtype=\"INTEGER\", name=\"TruckA2\", lb=1, ub=100)\nTruckA_b1 = model.addVar(vtype=\"B\", name=\"TruckA_b1\")\nTruckA_b2 = model.addVar(vtype=\"B\", name=\"TruckA_b2\")\nmodel.addCons(TruckA_b1 + TruckA_b2 == 1)\nmodel.addCons(TruckA == TruckA1*TruckA_b1 + TruckA2*TruckA_b2)\nNetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA2 - 1)) * TruckA2 * TruckA_b2\n## create piecewise variables for piecewise function: NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\nTruckB1 = model.addVar(vtype=\"INTEGER\", name=\"TruckB1\", lb=0, ub=1)\nTruckB2 = model.addVar(vtype=\"INTEGER\", name=\"TruckB2\", lb=1, ub=100)\nTruckB_b1 = model.addVar(vtype=\"B\", name=\"TruckB_b1\")\nTruckB_b2 = model.addVar(vtype=\"B\", name=\"TruckB_b2\")\nmodel.addCons(TruckB_b1 + TruckB_b2 == 1)\nmodel.addCons(TruckB == TruckB1*TruckB_b1 + TruckB2*TruckB_b2)\nNetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB2 - 1)) * TruckB2 * TruckB_b2\n## create piecewise variables for piecewise function: NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\nTruckC1 = model.addVar(vtype=\"INTEGER\", name=\"TruckC1\", lb=0, ub=1)\nTruckC2 = model.addVar(vtype=\"INTEGER\", name=\"TruckC2\", lb=1, ub=100)\nTruckC_b1 = model.addVar(vtype=\"B\", name=\"TruckC_b1\")\nTruckC_b2 = model.addVar(vtype=\"B\", name=\"TruckC_b2\")\nmodel.addCons(TruckC_b1 + TruckC_b2 == 1)\nmodel.addCons(TruckC == TruckC1*TruckC_b1 + TruckC2*TruckC_b2)\nNetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC2 - 1)) * TruckC2 * TruckC_b2\n## create piecewise variables for piecewise function: NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\nTruckD1 = model.addVar(vtype=\"INTEGER\", name=\"TruckD1\", lb=0, ub=1)\nTruckD2 = model.addVar(vtype=\"INTEGER\", name=\"TruckD2\", lb=1, ub=100)\nTruckD_b1 = model.addVar(vtype=\"B\", name=\"TruckD_b1\")\nTruckD_b2 = model.addVar(vtype=\"B\", name=\"TruckD_b2\")\nmodel.addCons(TruckD_b1 + TruckD_b2 == 1)\nmodel.addCons(TruckD == TruckD1*TruckD_b1 + TruckD2*TruckD_b2)\nNetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD2 - 1)) * TruckD2 * TruckD_b2\n## create piecewise variables for piecewise function: NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\nTruckE1 = model.addVar(vtype=\"INTEGER\", name=\"TruckE1\", lb=0, ub=1)\nTruckE2 = model.addVar(vtype=\"INTEGER\", name=\"TruckE2\", lb=1, ub=100)\nTruckE_b1 = model.addVar(vtype=\"B\", name=\"TruckE_b1\")\nTruckE_b2 = model.addVar(vtype=\"B\", name=\"TruckE_b2\")\nmodel.addCons(TruckE_b1 + TruckE_b2 == 1)\nmodel.addCons(TruckE == TruckE1*TruckE_b1 + TruckE2*TruckE_b2)\nNetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE2 - 1)) * TruckE2 * TruckE_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\nmodel.addCons(obj == NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE)\n\n# Add constraints\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500000)\nmodel.addCons(TruckA <= 2 * TruckB)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed.\n// Revenue from Trucks: Revenue_T = 1000 * T\n// Revenue from Vans: Revenue_V = 700 * V\n// Revenue from Bikes: Revenue_B = 300 * B\n// Fuel consumed by Trucks: Fuel_T = 50 * T\n// Fuel consumed by Vans: Fuel_V = 30 * V\n// Fuel consumed by Bikes: Fuel_B = 5 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel consumption.\n// 50 * T + 30 * V + 5 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Bikes does not exceed 20.\n// B <= 20\n\n## Generate Constraint-5:\nThe company wants to ensure that the total revenue from Vans is at least 50% of the total revenue from Trucks.\n// 700 * V >= 0.5 * (1000 * T)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel; Vans generate $700 per trip, consume 30 liters of fuel; Bikes generate $300 per trip, consume 5 liters of fuel. The company aims to maximize the total efficiency, which is the sum of revenues divided by the sum of fuel consumed. The company has a budget of $10,000 for fuel consumption. The company has a total of 50 drivers available. The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company wants to ensure that the total number of Bikes does not exceed 20. The company also wants to ensure that the total revenue from Vans is at least 50% of the total revenue from Trucks. Please help the company determine the optimal number of Trucks, Vans, and Bikes to maximize their efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_T = 1000 * T\nRevenue_V = 700 * V\nRevenue_B = 300 * B\nFuel_T = 50 * T\nFuel_V = 30 * V\nFuel_B = 5 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Fuel_T + Fuel_V + Fuel_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_T + Fuel_V + Fuel_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel consumption.\nmodel.addCons(50 * T + 30 * V + 5 * B <= 10000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company wants to ensure that the total number of Bikes does not exceed 20.\nmodel.addCons(B <= 20)\n## The company wants to ensure that the total revenue from Vans is at least 50% of the total revenue from Trucks.\nmodel.addCons(700 * V >= 0.5 * (1000 * T))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to deploy for each of its three main routes: RouteA, RouteB, and RouteC. Additionally, the company is considering investing in fuel-efficient technologies for its trucks, which will reduce fuel consumption per kilometer but at a cost.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in technology. For every $1000 invested in technology for RouteA, fuel consumption decreases by 10 liters per 1000 km. For RouteB, every $1000 investment decreases fuel consumption by 12 liters per 1000 km. For RouteC, every $1000 investment decreases fuel consumption by 8 liters per 1000 km. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate.\n// Fuel cost for RouteA: CostA = (1000 / (1 + 0.001 * TechA)) * TrucksA\n// Fuel cost for RouteB: CostB = (1200 / (1 + 0.0012 * TechB)) * TrucksB\n// Fuel cost for RouteC: CostC = (800 / (1 + 0.0008 * TechC)) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for both truck deployment and technology investments.\n// 1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks deployed across all routes must not exceed 100.\n// TrucksA + TrucksB + TrucksC <= 100",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to deploy for each of its three main routes: RouteA, RouteB, and RouteC. Additionally, the company is considering investing in fuel-efficient technologies for its trucks, which will reduce fuel consumption per kilometer but at a cost. The fuel efficiency of each route improves with the investment in technology. For every $1000 invested in technology for RouteA, fuel consumption decreases by 10 liters per 1000 km. For RouteB, every $1000 investment decreases fuel consumption by 12 liters per 1000 km. For RouteC, every $1000 investment decreases fuel consumption by 8 liters per 1000 km. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate.\n\n| Route | Fuel Consumption Reduction per $1000 Investment |\n|-------|------------------------------------------------|\n| RouteA | 10 liters per 1000 km                          |\n| RouteB | 12 liters per 1000 km                          |\n| RouteC | 8 liters per 1000 km                           |\n\nThe company has a budget of $100,000 for both truck deployment and technology investments. The total number of trucks deployed across all routes must not exceed 100.\n\nPlease help the company to determine the optimal number of trucks to deploy for each route and the amount to invest in fuel-efficient technology to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for RouteC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)  # investment in fuel-efficient technology for RouteA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)  # investment in fuel-efficient technology for RouteB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)  # investment in fuel-efficient technology for RouteC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel cost for RouteA: CostA = (1000 / (1 + 0.001 * TechA)) * TrucksA\n## Fuel cost for RouteB: CostB = (1200 / (1 + 0.0012 * TechB)) * TrucksB\n## Fuel cost for RouteC: CostC = (800 / (1 + 0.0008 * TechC)) * TrucksC\n## convert the division to multiplication\nCostA = (1000 / (1 + 0.001 * TechA)) * TrucksA\nCostB = (1200 / (1 + 0.0012 * TechB)) * TrucksB\nCostC = (800 / (1 + 0.0008 * TechC)) * TrucksC\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n## The company has a budget of $100,000 for both truck deployment and technology investments.\nmodel.addCons(1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + TechA + TechB + TechC <= 100000)\n## The total number of trucks deployed across all routes must not exceed 100.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Investment in Tech for RouteA: \", model.getVal(TechA))\n    print(\"Investment in Tech for RouteB: \", model.getVal(TechB))\n    print(\"Investment in Tech for RouteC: \", model.getVal(TechC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations.\n// {\"number of container A\": \"ContainerA\", \"range\": \"ContainerA >= 0\", \"type\": \"integer\"}\n// {\"number of container B\": \"ContainerB\", \"range\": \"ContainerB >= 0\", \"type\": \"integer\"}\n// {\"number of container C\": \"ContainerC\", \"range\": \"ContainerC >= 0\", \"type\": \"integer\"}\n// {\"number of container D\": \"ContainerD\", \"range\": \"ContainerD >= 0\", \"type\": \"integer\"}\n// {\"number of container E\": \"ContainerE\", \"range\": \"ContainerE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping container A is $100 per unit, container B is $150 per unit, container C is $200 per unit, container D is $250 per unit, and container E is $300 per unit. The company has a fixed cost of $5000 for the shipping operation. The company wants to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n// Total cost for container A: Cost_A = 100 * ContainerA\n// Total cost for container B: Cost_B = 150 * ContainerB\n// Total cost for container C: Cost_C = 200 * ContainerC\n// Total cost for container D: Cost_D = 250 * ContainerD\n// Total cost for container E: Cost_E = 300 * ContainerE\n// The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\n\n## Generate Constraint-1:\nThe company has a total shipping capacity of 500 containers.\n// ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500\n\n## Generate Constraint-2:\nDue to storage limitations, the number of container C cannot exceed twice the number of container A.\n// ContainerC <= 2 * ContainerA\n\n## Generate Constraint-3:\nThe company has a contractual obligation to ship at least 50 containers of type D.\n// ContainerD >= 50",
        "question": "A logistics company is managing the distribution of five different types of cargo containers: A, B, C, D, and E. They need to determine the number of each type of container to optimize their shipping operations. The cost of shipping each type of container is given in the following Table.\n\n| Container Type | Cost per Unit |\n|----------------|---------------|\n| A              | $100          |\n| B              | $150          |\n| C              | $200          |\n| D              | $250          |\n| E              | $300          |\n\nThe company has a fixed cost of $5000 for the shipping operation. The company has a total shipping capacity of 500 containers. Due to storage limitations, the number of container C cannot exceed twice the number of container A. The company has a contractual obligation to ship at least 50 containers of type D.\n\nPlease help the company to minimize the total shipping cost, which includes both the variable cost per container and the fixed cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nContainerA = model.addVar(vtype=\"INTEGER\", name=\"ContainerA\", lb=0) # number of container A\nContainerB = model.addVar(vtype=\"INTEGER\", name=\"ContainerB\", lb=0) # number of container B\nContainerC = model.addVar(vtype=\"INTEGER\", name=\"ContainerC\", lb=0) # number of container C\nContainerD = model.addVar(vtype=\"INTEGER\", name=\"ContainerD\", lb=0) # number of container D\nContainerE = model.addVar(vtype=\"INTEGER\", name=\"ContainerE\", lb=0) # number of container E\n\n# Define objective function\nCost_A = 100 * ContainerA\nCost_B = 150 * ContainerB\nCost_C = 200 * ContainerC\nCost_D = 250 * ContainerD\nCost_E = 300 * ContainerE\n# The objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) + 5000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E + 5000)\n\n# Add constraints\n# The company has a total shipping capacity of 500 containers.\nmodel.addCons(ContainerA + ContainerB + ContainerC + ContainerD + ContainerE <= 500)\n# Due to storage limitations, the number of container C cannot exceed twice the number of container A.\nmodel.addCons(ContainerC <= 2 * ContainerA)\n# The company has a contractual obligation to ship at least 50 containers of type D.\nmodel.addCons(ContainerD >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Container A: \", model.getVal(ContainerA))\n    print(\"Number of Container B: \", model.getVal(ContainerB))\n    print(\"Number of Container C: \", model.getVal(ContainerC))\n    print(\"Number of Container D: \", model.getVal(ContainerD))\n    print(\"Number of Container E: \", model.getVal(ContainerE))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade (in dollars) for each type of vehicle to enhance their fuel efficiency and operational efficiency.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrade for Trucks\": \"TechUpgradeTrucks\", \"range\": \"TechUpgradeTrucks >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrade for Vans\": \"TechUpgradeVans\", \"range\": \"TechUpgradeVans >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrade for Bikes\": \"TechUpgradeBikes\", \"range\": \"TechUpgradeBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and operational efficiency of each vehicle type improve with the technology upgrade. For Trucks, each $1000 investment in technology upgrade reduces fuel consumption by 10 liters per 100 km. For Vans, each $1000 investment reduces fuel consumption by 8 liters per 100 km. For Bikes, each $1000 investment reduces fuel consumption by 2 liters per 100 km. The company aims to minimize the total annual fuel cost.\n// Fuel cost for Trucks: CostTrucks = (100 - 0.01 * TechUpgradeTrucks) * Trucks\n// Fuel cost for Vans: CostVans = (80 - 0.008 * TechUpgradeVans) * Vans\n// Fuel cost for Bikes: CostBikes = (20 - 0.002 * TechUpgradeBikes) * Bikes\n// So, the objective function is: Minimize (CostTrucks + CostVans + CostBikes)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for vehicle purchases and technology upgrades.\n// Trucks + Vans + Bikes + TechUpgradeTrucks + TechUpgradeVans + TechUpgradeBikes <= 200000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 Trucks and 100 Vans to meet operational demands.\n// Trucks >= 50; Vans >= 100\n\n## Generate Constraint-3:\nThe total number of vehicles cannot exceed 300 due to storage and operational constraints.\n// Trucks + Vans + Bikes <= 300\n\n## Generate Constraint-4:\nThe investment in technology upgrades for any single vehicle type cannot exceed $50,000.\n// TechUpgradeTrucks <= 50000\n// TechUpgradeVans <= 50000\n// TechUpgradeBikes <= 50000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also needs to determine the level of technology upgrade (in dollars) for each type of vehicle to enhance their fuel efficiency and operational efficiency. The fuel efficiency and operational efficiency of each vehicle type improve with the technology upgrade. For Trucks, each $1000 investment in technology upgrade reduces fuel consumption by 10 liters per 100 km. For Vans, each $1000 investment reduces fuel consumption by 8 liters per 100 km. For Bikes, each $1000 investment reduces fuel consumption by 2 liters per 100 km. The company aims to minimize the total annual fuel cost.\n\n| Vehicle Type | Fuel Consumption Reduction per $1000 Tech Upgrade |\n|--------------|---------------------------------------------------|\n| Trucks       | 10 liters per 100 km                             |\n| Vans         | 8 liters per 100 km                              |\n| Bikes        | 2 liters per 100 km                              |\n\nThe company has a budget of $200,000 for vehicle purchases and technology upgrades. The company must purchase at least 50 Trucks and 100 Vans to meet operational demands. The total number of vehicles cannot exceed 300 due to storage and operational constraints. The investment in technology upgrades for any single vehicle type cannot exceed $50,000.\n\nPlease help the company to determine the optimal number of each type of vehicle to purchase and the appropriate level of technology upgrade to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nTechUpgradeTrucks = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeTrucks\", lb=0)\nTechUpgradeVans = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeVans\", lb=0)\nTechUpgradeBikes = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeBikes\", lb=0)\n\n# Define objective function\nCostTrucks = (100 - 0.01 * TechUpgradeTrucks) * Trucks\nCostVans = (80 - 0.008 * TechUpgradeVans) * Vans\nCostBikes = (20 - 0.002 * TechUpgradeBikes) * Bikes\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTrucks + CostVans + CostBikes)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes + TechUpgradeTrucks + TechUpgradeVans + TechUpgradeBikes <= 200000)\nmodel.addCons(Trucks >= 50)\nmodel.addCons(Vans >= 100)\nmodel.addCons(Trucks + Vans + Bikes <= 300)\nmodel.addCons(TechUpgradeTrucks <= 50000)\nmodel.addCons(TechUpgradeVans <= 50000)\nmodel.addCons(TechUpgradeBikes <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Technology Upgrade for Trucks: \", model.getVal(TechUpgradeTrucks))\n    print(\"Investment in Technology Upgrade for Vans: \", model.getVal(TechUpgradeVans))\n    print(\"Investment in Technology Upgrade for Bikes: \", model.getVal(TechUpgradeBikes))\n    print(\"Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1680,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for ProductA is $50 per unit, with a production cost of $30 per unit. For ProductB, the selling price is $70 per unit, with a production cost of $40 per unit. For ProductC, the selling price is $90 per unit, with a production cost of $50 per unit. The company wants to maximize the total profit from selling all products.\n// Total profit for ProductA: Profit_ProductA = (50 - 30) * ProductAQty\n// Total profit for ProductB: Profit_ProductB = (70 - 40) * ProductBQty\n// Total profit for ProductC: Profit_ProductC = (90 - 50) * ProductCQty\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited budget for production costs, which is $15,000.\n// 30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The production cost, selling price, and demand for each product vary. The details for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| ProductA | $50 per unit | $30 per unit |\n| ProductB | $70 per unit | $40 per unit |\n| ProductC | $90 per unit | $50 per unit |\n\nThe company has a limited budget for production costs, which is $15,000. Please help the company to maximize the total profit from selling all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 30) * ProductAQty\nProfit_ProductB = (70 - 40) * ProductBQty\nProfit_ProductC = (90 - 50) * ProductCQty\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited budget for production costs, which is $15,000.\nmodel.addCons(30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 698,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the production cost is $20, and the storage cost per unit is $1 per week.\nFor Device B, the selling price is $70, the production cost is $30, and the storage cost per unit is $2 per week.\nFor Device C, the selling price is $90, the production cost is $40, and the storage cost per unit is $3 per week.\nFor Device D, the selling price is $110, the production cost is $50, and the storage cost per unit is $4 per week.\nThe company aims to maximize the total profit, considering both the selling profit and the storage costs over a week.\n// Selling profit of A: Profit_A = (50 - 20) * A - A\n// Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n// Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n// Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 5000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each device are produced.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 300 units across all devices.\n// A + B + C + D <= 300",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The company needs to determine the production quantities for each device to optimize their profit margin. The selling price, production cost, and storage cost per unit per week for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Storage Cost per Unit per Week |\n|--------|---------------|-----------------|--------------------------------|\n| A      | $50           | $20             | $1                             |\n| B      | $70           | $30             | $2                             |\n| C      | $90           | $40             | $3                             |\n| D      | $110          | $50             | $4                             |\n\nThe company has a budget of $5000 for production costs. The company wants to ensure that at least 50 units of each device are produced. The company has a storage capacity limit of 300 units across all devices. \nPlease help the company to maximize the total profit, considering both the selling profit and the storage costs over a week.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each device are produced.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\n\n# Define objective function\n## Selling profit of A: Profit_A = (50 - 20) * A - A\n## Selling profit of B: Profit_B = (70 - 30) * B - 2 * B\n## Selling profit of C: Profit_C = (90 - 40) * C - 3 * C\n## Selling profit of D: Profit_D = (110 - 50) * D - 4 * D\nProfit_A = (50 - 20 - 1) * A\nProfit_B = (70 - 30 - 2) * B\nProfit_C = (90 - 40 - 3) * C\nProfit_D = (110 - 50 - 4) * D\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 5000)\n## The company has a storage capacity limit of 300 units across all devices.\nmodel.addCons(A + B + C + D <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n// Total energy output: Energy = 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3\n// Total cost: Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for this project.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment. The company has a budget of $100,000 for this project.\nPlease help the company determine the optimal number of each type of solar panel and wind turbine to install to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of Solar1 panels\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of Solar2 panels\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of Solar3 panels\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of Solar4 panels\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0) # number of Solar5 panels\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of Wind1 turbines\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of Wind2 turbines\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of Wind3 turbines\n\n# Define objective function\n## Total energy output\nEnergy = 0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3\n## Total cost\nCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Energy / Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The company has a budget of $100,000 for this project.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food). The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Clothing\": \"ClothingTripsPerTruck\", \"range\": \"ClothingTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Food\": \"FoodTripsPerTruck\", \"range\": \"FoodTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for Electronics is $100, for Clothing is $70, and for Food is $50. The fuel cost per trip for Electronics is $20, for Clothing is $15, and for Food is $10. The company aims to maximize its net daily profit.\n// Profit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\n// Profit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\n// Profit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Clothing + Profit_Food)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food). The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The profit per trip for Electronics is $100, for Clothing is $70, and for Food is $50. The fuel cost per trip for Electronics is $20, for Clothing is $15, and for Food is $10. The company aims to maximize its net daily profit. The company has a total of 50 trucks available and a daily fuel budget of $1000. Please help the company determine the optimal allocation of trucks and trips to maximize its net daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nClothingTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ClothingTripsPerTruck\", lb=0)\nFoodTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FoodTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\nProfit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\nProfit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Clothing + Profit_Food)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Clothing: \", model.getVal(ClothingTripsPerTruck))\n    print(\"Trips per Truck for Food: \", model.getVal(FoodTripsPerTruck))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 688,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for ProductA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechInvestC\", \"range\": \"TechInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total investment budget of $50,000 for advanced manufacturing technologies.\n// TechInvestA + TechInvestB + TechInvestC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units.\n// QuantityA <= 400; QuantityB <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $250                   |\n| ProductC | $200                             | $300                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The company has a total investment budget of $50,000 for advanced manufacturing technologies. The total production capacity of the company is limited to 1000 units. Due to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0) # investment in technology for ProductA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0) # investment in technology for ProductB\nTechInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestC\", lb=0) # investment in technology for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\nProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\nProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total investment budget of $50,000 for advanced manufacturing technologies.\nmodel.addCons(TechInvestA + TechInvestB + TechInvestC <= 50000)\n# The total production capacity of the company is limited to 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n# Due to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units.\nmodel.addCons(QuantityA <= 400)\nmodel.addCons(QuantityB <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechInvestA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechInvestB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechInvestC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1353,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in fuel-efficient technologies for the trucks, which will reduce fuel costs per kilometer.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsW\": \"TechW\", \"range\": \"TechW >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods.\n// Fuel cost for GoodsX: CostX = (0.50 - 0.0001 * TechX) * (TrucksX * DistanceX)\n// Fuel cost for GoodsY: CostY = (0.60 - 0.0001 * TechY) * (TrucksY * DistanceY)\n// Fuel cost for GoodsZ: CostZ = (0.70 - 0.0001 * TechZ) * (TrucksZ * DistanceZ)\n// Fuel cost for GoodsW: CostW = (0.80 - 0.0001 * TechW) * (TrucksW * DistanceW)\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nThe total investment in fuel-efficient technology cannot exceed $100,000.\n// TechX + TechY + TechZ + TechW <= 100,000\n\n## Generate Constraint-3:\nDue to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks.\n// TrucksX >= 10; TrucksY >= 15\n\n## Generate Constraint-4:\nThe total distance each type of goods needs to be transported varies: GoodsX travels 10,000 km, GoodsY travels 15,000 km, GoodsZ travels 20,000 km, and GoodsW travels 25,000 km.\n// TrucksX * DistanceX = 10,000 * TrucksX\n// TrucksY * DistanceY = 15,000 * TrucksY\n// TrucksZ * DistanceZ = 20,000 * TrucksZ\n// TrucksW * DistanceW = 25,000 * TrucksW",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month and the investment in fuel-efficient technologies for the trucks. The initial fuel cost per kilometer and the required distance for each type of goods are given in the following Table.\n\n| Goods | Initial Fuel Cost per Kilometer | Required Distance (km) |\n|-------|---------------------------------|-----------------------|\n| GoodsX | $0.50                           | 10,000                |\n| GoodsY | $0.60                           | 15,000                |\n| GoodsZ | $0.70                           | 20,000                |\n| GoodsW | $0.80                           | 25,000                |\n\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The company has a total of 50 trucks available for the month. The total investment in fuel-efficient technology cannot exceed $100,000. Due to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks.\n\nPlease help the company to minimize the total fuel cost for all goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=0)  # number of trucks for GoodsW\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in fuel-efficient technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in fuel-efficient technology for GoodsY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for GoodsZ\nTechW = model.addVar(vtype=\"CONTINUOUS\", name=\"TechW\", lb=0)  # investment in fuel-efficient technology for GoodsW\n\n# Define objective function\nCostX = (0.50 - 0.0001 * TechX) * (10000 * TrucksX)\nCostY = (0.60 - 0.0001 * TechY) * (15000 * TrucksY)\nCostZ = (0.70 - 0.0001 * TechZ) * (20000 * TrucksZ)\nCostW = (0.80 - 0.0001 * TechW) * (25000 * TrucksW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\nmodel.addCons(TechX + TechY + TechZ + TechW <= 100000)\nmodel.addCons(TrucksX >= 10)\nmodel.addCons(TrucksY >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Tech for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Tech for GoodsY: \", model.getVal(TechY))\n    print(\"Investment in Tech for GoodsZ: \", model.getVal(TechZ))\n    print(\"Investment in Tech for GoodsW: \", model.getVal(TechW))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n// Profit_ProductA = 50 * ProductAQty\n// Profit_ProductB = 70 * ProductBQty\n// Profit_ProductC = 60 * ProductCQty\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\n// (50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000\n\n## Generate Constraint-3:\nDue to labor regulations, the number of shifts cannot exceed 3.\n// NumShifts <= 3\n\n## Generate Constraint-4:\nThe demand for ProductA is at least twice the demand for ProductB.\n// ProductAQty >= 2 * ProductBQty",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| ProductA | $50             |\n| ProductB | $70             |\n| ProductC | $60             |\n\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts. The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day. Due to labor regulations, the number of shifts cannot exceed 3. The demand for ProductA is at least twice the demand for ProductB.\n\nPlease help the company to determine the optimal production quantity for each product and the number of shifts to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProductAQty\nProfit_ProductB = 70 * ProductBQty\nProfit_ProductC = 60 * ProductCQty\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\nmodel.addCons((50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000)\n# Due to labor regulations, the number of shifts cannot exceed 3.\nmodel.addCons(NumShifts <= 3)\n# The demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductAQty >= 2 * ProductBQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different types of trucks (Type A, Type B, Type C, Type D, Type E) to minimize fuel consumption and time spent on the road. Each type of truck has a different fuel efficiency and speed.\n// {\"number of Type A trucks\": \"TypeATrucks\", \"range\": \"TypeATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Type B trucks\": \"TypeBTrucks\", \"range\": \"TypeBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Type C trucks\": \"TypeCTrucks\", \"range\": \"TypeCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Type D trucks\": \"TypeDTrucks\", \"range\": \"TypeDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Type E trucks\": \"TypeETrucks\", \"range\": \"TypeETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for Type A trucks is 0.5 liters per kilometer, and the speed is 60 km/h.\nFor Type B trucks, the fuel consumption rate is 0.6 liters per kilometer, and the speed is 55 km/h.\nFor Type C trucks, the fuel consumption rate is 0.7 liters per kilometer, and the speed is 50 km/h.\nFor Type D trucks, the fuel consumption rate is 0.8 liters per kilometer, and the speed is 45 km/h.\nFor Type E trucks, the fuel consumption rate is 0.9 liters per kilometer, and the speed is 40 km/h.\nThe company wants to minimize the total fuel consumption and time spent on the road, considering the nonlinear relationship between speed and fuel efficiency.\n// Fuel_TypeA = 0.5 * TypeATrucks * Distance\n// Fuel_TypeB = 0.6 * TypeBTrucks * Distance\n// Fuel_TypeC = 0.7 * TypeCTrucks * Distance\n// Fuel_TypeD = 0.8 * TypeDTrucks * Distance\n// Fuel_TypeE = 0.9 * TypeETrucks * Distance\n// Time_TypeA = Distance / 60\n// Time_TypeB = Distance / 55\n// Time_TypeC = Distance / 50\n// Time_TypeD = Distance / 45\n// Time_TypeE = Distance / 40\n// So, the objective function is: Minimize (Fuel_TypeA + Fuel_TypeB + Fuel_TypeC + Fuel_TypeD + Fuel_TypeE + Time_TypeA + Time_TypeB + Time_TypeC + Time_TypeD + Time_TypeE)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 0.5 * TypeATrucks * Distance + 0.6 * TypeBTrucks * Distance + 0.7 * TypeCTrucks * Distance + 0.8 * TypeDTrucks * Distance + 0.9 * TypeETrucks * Distance <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available in total.\n// TypeATrucks + TypeBTrucks + TypeCTrucks + TypeDTrucks + TypeETrucks <= 50\n\n## Generate Constraint-3:\nThe company has a maximum distance limit of 1000 kilometers for all trucks.\n// Distance <= 1000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different types of trucks (Type A, Type B, Type C, Type D, Type E) to minimize fuel consumption and time spent on the road. Each type of truck has a different fuel efficiency and speed, as shown in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Speed (km/h) |\n|------------|-----------------------------------|--------------|\n| Type A     | 0.5                               | 60           |\n| Type B     | 0.6                               | 55           |\n| Type C     | 0.7                               | 50           |\n| Type D     | 0.8                               | 45           |\n| Type E     | 0.9                               | 40           |\n\nThe company has a total budget of $10,000 for fuel costs. The company has a maximum of 50 trucks available in total. The company has a maximum distance limit of 1000 kilometers for all trucks. \n\nPlease help the company to minimize the total fuel consumption and time spent on the road, considering the nonlinear relationship between speed and fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeATrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeATrucks\", lb=0)\nTypeBTrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeBTrucks\", lb=0)\nTypeCTrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeCTrucks\", lb=0)\nTypeDTrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeDTrucks\", lb=0)\nTypeETrucks = model.addVar(vtype=\"INTEGER\", name=\"TypeETrucks\", lb=0)\nDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance\", lb=0)\n\n# Define objective function\nFuel_TypeA = 0.5 * TypeATrucks * Distance\nFuel_TypeB = 0.6 * TypeBTrucks * Distance\nFuel_TypeC = 0.7 * TypeCTrucks * Distance\nFuel_TypeD = 0.8 * TypeDTrucks * Distance\nFuel_TypeE = 0.9 * TypeETrucks * Distance\nTime_TypeA = Distance / 60\nTime_TypeB = Distance / 55\nTime_TypeC = Distance / 50\nTime_TypeD = Distance / 45\nTime_TypeE = Distance / 40\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_TypeA + Fuel_TypeB + Fuel_TypeC + Fuel_TypeD + Fuel_TypeE + Time_TypeA + Time_TypeB + Time_TypeC + Time_TypeD + Time_TypeE)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(0.5 * TypeATrucks * Distance + 0.6 * TypeBTrucks * Distance + 0.7 * TypeCTrucks * Distance + 0.8 * TypeDTrucks * Distance + 0.9 * TypeETrucks * Distance <= 10000)\n# The company has a maximum of 50 trucks available in total.\nmodel.addCons(TypeATrucks + TypeBTrucks + TypeCTrucks + TypeDTrucks + TypeETrucks <= 50)\n# The company has a maximum distance limit of 1000 kilometers for all trucks.\nmodel.addCons(Distance <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Trucks: \", model.getVal(TypeATrucks))\n    print(\"Number of Type B Trucks: \", model.getVal(TypeBTrucks))\n    print(\"Number of Type C Trucks: \", model.getVal(TypeCTrucks))\n    print(\"Number of Type D Trucks: \", model.getVal(TypeDTrucks))\n    print(\"Number of Type E Trucks: \", model.getVal(TypeETrucks))\n    print(\"Distance: \", model.getVal(Distance))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1131,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies and capacities.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per km, the delivery speed is 50 km/h, and the cost per truck is $50,000.\nFor T2, the fuel consumption rate is 0.4 liters per km, the delivery speed is 60 km/h, and the cost per truck is $60,000.\nFor T3, the fuel consumption rate is 0.3 liters per km, the delivery speed is 70 km/h, and the cost per truck is $70,000.\nFor T4, the fuel consumption rate is 0.25 liters per km, the delivery speed is 80 km/h, and the cost per truck is $80,000.\nFor T5, the fuel consumption rate is 0.2 liters per km, the delivery speed is 90 km/h, and the cost per truck is $90,000.\nThe company wants to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).\n// Total_Cost_T1 = 50000 * T1 / 50\n// Total_Cost_T2 = 60000 * T2 / 60\n// Total_Cost_T3 = 70000 * T3 / 70\n// Total_Cost_T4 = 80000 * T4 / 80\n// Total_Cost_T5 = 90000 * T5 / 90\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000\n\n## Generate Constraint-2:\nThe total fuel consumption must not exceed 10,000 liters per day.\n// 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks in total.\n// T1 + T2 + T3 + T4 + T5 >= 10\n\n## Generate Constraint-4:\nThe number of T1 trucks must not exceed the number of T2 trucks.\n// T1 <= T2\n\n## Generate Constraint-5:\nThe total number of trucks must not exceed 30.\n// T1 + T2 + T3 + T4 + T5 <= 30",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. The company operates five types of trucks (T1, T2, T3, T4, T5) with different fuel efficiencies, delivery speeds, and costs per truck. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Delivery Speed (km/h) | Cost per Truck ($) |\n|------------|-----------------------------------|-----------------------|--------------------|\n| T1         | 0.5                               | 50                    | 50,000             |\n| T2         | 0.4                               | 60                    | 60,000             |\n| T3         | 0.3                               | 70                    | 70,000             |\n| T4         | 0.25                              | 80                    | 80,000             |\n| T5         | 0.2                               | 90                    | 90,000             |\n\nThe company has a budget of $1,000,000 for purchasing trucks. The total fuel consumption must not exceed 10,000 liters per day. The company must have at least 10 trucks in total. The number of T1 trucks must not exceed the number of T2 trucks. The total number of trucks must not exceed 30.\n\nPlease help the company to minimize the total cost of ownership per delivery hour (cost of trucks divided by delivery speed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 50000 * T1 / 50\nTotal_Cost_T2 = 60000 * T2 / 60\nTotal_Cost_T3 = 70000 * T3 / 70\nTotal_Cost_T4 = 80000 * T4 / 80\nTotal_Cost_T5 = 90000 * T5 / 90\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for purchasing trucks.\nmodel.addCons(50000 * T1 + 60000 * T2 + 70000 * T3 + 80000 * T4 + 90000 * T5 <= 1000000)\n## The total fuel consumption must not exceed 10,000 liters per day.\nmodel.addCons(0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5 <= 10000)\n## The company must have at least 10 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 10)\n## The number of T1 trucks must not exceed the number of T2 trucks.\nmodel.addCons(T1 <= T2)\n## The total number of trucks must not exceed 30.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Delivery Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1396,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Small Trucks\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Medium Trucks\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Large Trucks\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n// Operational cost for Small Trucks: CostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\n// Operational cost for Medium Trucks: CostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\n// Operational cost for Large Trucks: CostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for fleet expansion and technology upgrades.\n// 100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks to be added to the fleet should not exceed 10.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 10",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs. The fuel efficiency of each truck type improves with the level of technology upgrade, and the cost savings per kilometer for each type are as follows:\n\n| Truck Type       | Cost Savings per Kilometer | Investment per $100 |\n|------------------|----------------------------|---------------------|\n| Small Trucks     | $0.10                      | $100                |\n| Medium Trucks    | $0.15                      | $100                |\n| Large Trucks     | $0.20                      | $100                |\n\nThe operational cost for each type of truck includes the initial purchase cost and the ongoing fuel cost, which are influenced by the technology upgrade. The company has a budget of $1,000,000 for fleet expansion and technology upgrades. The total number of trucks to be added to the fleet should not exceed 10.\n\nPlease help the company to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small Trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium Trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large Trucks\nTechUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSmall\", lb=0)  # technology upgrade for Small Trucks\nTechUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeMedium\", lb=0)  # technology upgrade for Medium Trucks\nTechUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeLarge\", lb=0)  # technology upgrade for Large Trucks\n\n# Define objective function\nCostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\nCostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\nCostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n# So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $1,000,000 for fleet expansion and technology upgrades.\nmodel.addCons(100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000)\n# The total number of trucks to be added to the fleet should not exceed 10.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Technology Upgrade for Small Trucks: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade for Medium Trucks: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade for Large Trucks: \", model.getVal(TechUpgradeLarge))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck depends on the route it takes. For route A, each truck consumes 100 liters of fuel per trip. For route B, each truck consumes 120 liters of fuel per trip. For route C, each truck consumes 150 liters of fuel per trip. For route D, each truck consumes 200 liters of fuel per trip. The company aims to minimize the total fuel consumption per day.\n// Fuel_Consumption_A = 100 * TrucksA\n// Fuel_Consumption_B = 120 * TrucksB\n// Fuel_Consumption_C = 150 * TrucksC\n// Fuel_Consumption_D = 200 * TrucksD\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The company has identified four major routes (A, B, C, D) and needs to decide how many trucks to allocate to each route. The fuel consumption of each truck depends on the route it takes, as shown in the following Table.\n\n| Route | Fuel Consumption per Truck (liters) |\n|-------|-------------------------------------|\n| A     | 100                                 |\n| B     | 120                                 |\n| C     | 150                                 |\n| D     | 200                                 |\n\nThe company has a total of 50 trucks available. Please help the company to minimize the total fuel consumption per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\n\n# Define objective function\nFuel_Consumption_A = 100 * TrucksA\nFuel_Consumption_B = 120 * TrucksB\nFuel_Consumption_C = 150 * TrucksC\nFuel_Consumption_D = 200 * TrucksD\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for solar\": \"ESS_SP\", \"range\": \"ESS_SP >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for wind\": \"ESS_WT\", \"range\": \"ESS_WT >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. Similarly, the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar: Energy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\n// Total energy production from wind: Energy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\n// So, the objective function is: Maximize (Energy_SP + Energy_WT)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for investments in energy storage systems.\n// ESS_SP + ESS_WT <= 200000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) must not exceed 1000 units.\n// SP + WT <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste. The efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems, and the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%.\n\n| Installation Type | Efficiency Increase per $10,000 ESS Investment | Initial Efficiency |\n|-------------------|-----------------------------------------------|---------------------|\n| Solar Panels      | 1%                                            | 20%                 |\n| Wind Turbines     | 1.5%                                          | 30%                 |\n\nThe company has a budget of $200,000 for investments in energy storage systems. The total number of installations (solar panels and wind turbines) must not exceed 1000 units. The company aims to maximize the total energy production. Please help the company determine the optimal number of solar panels, wind turbines, and the investment in energy storage systems to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=0)  # number of wind turbines\nESS_SP = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_SP\", lb=0)  # investment in energy storage for solar\nESS_WT = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_WT\", lb=0)  # investment in energy storage for wind\n\n# Define objective function\nEnergy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\nEnergy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SP + Energy_WT)\n\n# Add constraints\nmodel.addCons(ESS_SP + ESS_WT <= 200000)\nmodel.addCons(SP + WT <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Investment in Energy Storage for Solar: \", model.getVal(ESS_SP))\n    print(\"Investment in Energy Storage for Wind: \", model.getVal(ESS_WT))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1444,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n// 5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for each product is influenced by the production quantities of the other products due to market saturation effects. The profit functions for each product are as follows:\n\n- Profit for ProductA: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\n- Profit for ProductB: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\n- Profit for ProductC: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nThe company wants to maximize the total profit from all products. The company faces the following constraints:\n\n1. The total production capacity of the company is limited to 1000 units per month.\n2. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n3. The company has a fixed budget for production costs, which cannot exceed $50,000 per month.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(ProductBQty <= 2 * ProductAQty)\n# The company has a fixed budget for production costs, which cannot exceed $50,000 per month.\nmodel.addCons(5 * ProductAQty + 7 * ProductBQty + 10 * ProductCQty <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1314,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks.\n// Objective function: Minimize C_S + C_M + C_L + C_XL + C_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\n// 5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000\n\n## Generate Constraint-2:\nThere is a limit on the number of trucks that can be operated due to licensing and maintenance constraints. The maximum number of each type of truck is:\n- Small truck: 10\n- Medium truck: 8\n- Large truck: 6\n- Extra-Large truck: 4\n- Refrigerated truck: 2\n// S <= 10; M <= 8; L <= 6; XL <= 4; R <= 2\n\n## Generate Constraint-3:\nThe total number of trucks in the fleet must not exceed 20 due to parking and operational constraints.\n// S + M + L + XL + R <= 20",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks. The company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\nThere is a limit on the number of trucks that can be operated due to licensing and maintenance constraints. The maximum number of each type of truck is:\n- Small truck: 10\n- Medium truck: 8\n- Large truck: 6\n- Extra-Large truck: 4\n- Refrigerated truck: 2\nThe total number of trucks in the fleet must not exceed 20 due to parking and operational constraints.\nPlease help the company to determine the optimal number of each type of truck to minimize the total operating cost while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=10)  # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0, ub=8)   # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=6)   # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0, ub=4) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0, ub=2)   # number of Refrigerated trucks\n\n# Define objective function\n# Cost functions are nonlinear, so we need to approximate them using piecewise linear functions\n# Define helper variables for piecewise linear approximation\nS_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"S_helper_{i}\") for i in range(11)]\nM_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"M_helper_{i}\") for i in range(9)]\nL_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"L_helper_{i}\") for i in range(7)]\nXL_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"XL_helper_{i}\") for i in range(5)]\nR_helper = [model.addVar(vtype=\"CONTINUOUS\", name=f\"R_helper_{i}\") for i in range(3)]\n\n# Connect helper variables to main variables\nfor i in range(10):\n    model.addCons(S_helper[i] <= S)\nfor i in range(8):\n    model.addCons(M_helper[i] <= M)\nfor i in range(6):\n    model.addCons(L_helper[i] <= L)\nfor i in range(4):\n    model.addCons(XL_helper[i] <= XL)\nfor i in range(2):\n    model.addCons(R_helper[i] <= R)\n\n# Define cost functions using helper variables\nC_S = sum(1000 * (S_helper[i]**0.7) for i in range(10))\nC_M = sum(1500 * (M_helper[i]**0.6) for i in range(8))\nC_L = sum(2000 * (L_helper[i]**0.5) for i in range(6))\nC_XL = sum(2500 * (XL_helper[i]**0.4) for i in range(4))\nC_R = sum(3000 * (R_helper[i]**0.3) for i in range(2))\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C_S + C_M + C_L + C_XL + C_R)\n\n# Add constraints\nmodel.addCons(5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000)\nmodel.addCons(S + M + L + XL + R <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1459,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"production quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\n// DeviceB_Quantity >= 2 * DeviceA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage capacity constraint of 800 units.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|-----------------|--------------------------|-----------------------|\n| DeviceA | $50 | $20 | $5 |\n| DeviceB | $70 | $30 | $7 |\n| DeviceC | $90 | $40 | $9 |\n\nThe company has a limited production capacity of 1000 units per day. Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA. The company also has a storage capacity constraint of 800 units. \n\nPlease help the company to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0) # production quantity of DeviceA\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0) # production quantity of DeviceB\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0) # production quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\nProfit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\nProfit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per day.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n# Due to raw material availability, the production of DeviceB must be at least twice the production of DeviceA.\nmodel.addCons(DeviceB_Quantity >= 2 * DeviceA_Quantity)\n# The company has a storage capacity constraint of 800 units.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5\n\n## Generate Constraint-3:\nThe total travel time for all routes must not exceed 200 hours.\n// TimeA + TimeB + TimeC + TimeD + TimeE <= 200",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\nFor city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours.\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city. The total travel time for all routes must not exceed 200 hours.\nPlease help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Due to contractual agreements, the company must allocate at least 5 trucks to each city.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\n## The fuel consumption and travel time for each route are nonlinear functions of the number of trucks.\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n## So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## The total travel time for all routes must not exceed 200 hours.\nmodel.addCons(TimeA + TimeB + TimeC + TimeD + TimeE <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The production process involves a nonlinear relationship between the quantity produced and the cost.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\nThe profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\nThe profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs per day.\n// 0.5 * ProductA^2 + 0.4 * ProductB^2 + 0.3 * ProductC^2 <= 10000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day.\n// ProductA >= 20\n\n## Generate Constraint-4:\nThe market demand for product B is at least 15 units per day.\n// ProductB >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the cost of production and the market demand. The profit for each product is given by the following functions:\n\n- Profit for product A: Profit_A = 100 * ProductA - 0.5 * ProductA^2\n- Profit for product B: Profit_B = 150 * ProductB - 0.4 * ProductB^2\n- Profit for product C: Profit_C = 200 * ProductC - 0.3 * ProductC^2\n\nThe company wants to maximize the total profit from all products. The company has a total production capacity of 100 units per day and a budget of $10,000 for production costs per day. The market demand for product A is at least 20 units per day, and for product B is at least 15 units per day.\n\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=20) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=15) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## The profit for product A is given by the function: Profit_A = 100 * ProductA - 0.5 * ProductA^2.\n## The profit for product B is given by the function: Profit_B = 150 * ProductB - 0.4 * ProductB^2.\n## The profit for product C is given by the function: Profit_C = 200 * ProductC - 0.3 * ProductC^2.\n## The company wants to maximize the total profit from all products.\nProfit_A = 100 * ProductA - 0.5 * ProductA**2\nProfit_B = 150 * ProductB - 0.4 * ProductB**2\nProfit_C = 200 * ProductC - 0.3 * ProductC**2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 100)\n## The company has a budget of $10,000 for production costs per day.\nmodel.addCons(0.5 * ProductA**2 + 0.4 * ProductB**2 + 0.3 * ProductC**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption rate of Truck1\": \"Truck1_FuelRate\", \"range\": \"Truck1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck2\": \"Truck2_FuelRate\", \"range\": \"Truck2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck3\": \"Truck3_FuelRate\", \"range\": \"Truck3_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van1\": \"Van1_FuelRate\", \"range\": \"Van1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van2\": \"Van2_FuelRate\", \"range\": \"Van2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"speed of Truck1\": \"Truck1_Speed\", \"range\": \"Truck1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck2\": \"Truck2_Speed\", \"range\": \"Truck2_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck3\": \"Truck3_Speed\", \"range\": \"Truck3_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van1\": \"Van1_Speed\", \"range\": \"Van1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van2\": \"Van2_Speed\", \"range\": \"Van2_Speed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type.\n// Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\n// So, the objective function is: Minimize Objective\n\n## Generate Constraint-1:\nThe total fuel consumption for all vehicles must not exceed 1000 liters.\n// Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000\n\n## Generate Constraint-2:\nThe total time taken for all deliveries must not exceed 50 hours.\n// (1 / Truck1_Speed) + (1 / Truck2_Speed) + (1 / Truck3_Speed) + (1 / Van1_Speed) + (1 / Van2_Speed) <= 50",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed. The company wants to minimize the total time and fuel consumption for all deliveries by minimizing the product of fuel consumption rate and speed for each vehicle type. The total fuel consumption for all vehicles must not exceed 1000 liters, and the total time taken for all deliveries must not exceed 50 hours. Please help the company determine the optimal fuel consumption rates and speeds for each vehicle type to meet these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_FuelRate\", lb=0)\nTruck2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_FuelRate\", lb=0)\nTruck3_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_FuelRate\", lb=0)\nVan1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_FuelRate\", lb=0)\nVan2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_FuelRate\", lb=0)\nTruck1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_Speed\", lb=0)\nTruck2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_Speed\", lb=0)\nTruck3_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_Speed\", lb=0)\nVan1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_Speed\", lb=0)\nVan2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_Speed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\nmodel.addCons(obj == Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed)\n\n# Add constraints\n## The total fuel consumption for all vehicles must not exceed 1000 liters.\nmodel.addCons(Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000)\n## The total time taken for all deliveries must not exceed 50 hours.\nmodel.addCons(1 / Truck1_Speed + 1 / Truck2_Speed + 1 / Truck3_Speed + 1 / Van1_Speed + 1 / Van2_Speed <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption Rate of Truck1: \", model.getVal(Truck1_FuelRate))\n    print(\"Fuel Consumption Rate of Truck2: \", model.getVal(Truck2_FuelRate))\n    print(\"Fuel Consumption Rate of Truck3: \", model.getVal(Truck3_FuelRate))\n    print(\"Fuel Consumption Rate of Van1: \", model.getVal(Van1_FuelRate))\n    print(\"Fuel Consumption Rate of Van2: \", model.getVal(Van2_FuelRate))\n    print(\"Speed of Truck1: \", model.getVal(Truck1_Speed))\n    print(\"Speed of Truck2: \", model.getVal(Truck2_Speed))\n    print(\"Speed of Truck3: \", model.getVal(Truck3_Speed))\n    print(\"Speed of Van1: \", model.getVal(Van1_Speed))\n    print(\"Speed of Van2: \", model.getVal(Van2_Speed))\n    print(\"Minimized Objective Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 666,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation.\n// {\"production quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvest\", \"range\": \"AutomationInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n// Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n// Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvest <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB.\n// DeviceAQty >= 1000; DeviceBQty >= 1500\n\n## Generate Constraint-4:\nThe company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\n// DeviceCQty <= DeviceAQty + DeviceBQty\n\n## Generate Constraint-5:\nThe company has a budget of $3,000,000 for total production costs for the quarter.\n// (100 - 0.0005 * AutomationInvest) * DeviceAQty + (150 - 0.0005 * AutomationInvest) * DeviceBQty + (200 - 0.0005 * AutomationInvest) * DeviceCQty <= 3000000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation. The selling price and initial production cost per unit for each device are given in the following Table.\n\n| Device | Selling Price | Initial Production Cost |\n|--------|---------------|-------------------------|\n| DeviceA | $150 | $100 |\n| DeviceB | $200 | $150 |\n| DeviceC | $250 | $200 |\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB. The company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB. The company has a budget of $3,000,000 for total production costs for the quarter.\n\nPlease help the company to maximize the total profit from all devices, considering that the investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=1000)  # production quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=1500)  # production quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0)  # production quantity of DeviceC\nAutomationInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvest\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\nProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\nProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 10000)\n# The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvest <= 50000)\n# Due to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB.\nmodel.addCons(DeviceAQty >= 1000)\nmodel.addCons(DeviceBQty >= 1500)\n# The company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\nmodel.addCons(DeviceCQty <= DeviceAQty + DeviceBQty)\n# The company has a budget of $3,000,000 for total production costs for the quarter.\nmodel.addCons((100 - 0.0005 * AutomationInvest) * DeviceAQty + \n              (150 - 0.0005 * AutomationInvest) * DeviceBQty + \n              (200 - 0.0005 * AutomationInvest) * DeviceCQty <= 3000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Investment in Automation: \", model.getVal(AutomationInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1285,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource X used for product A\": \"ResourceXA\", \"range\": \"ResourceXA >= 0\", \"type\": \"real\"}\n// {\"resource X used for product B\": \"ResourceXB\", \"range\": \"ResourceXB >= 0\", \"type\": \"real\"}\n// {\"resource X used for product C\": \"ResourceXC\", \"range\": \"ResourceXC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of all three products.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 100 units of resource X available. The usage of resource X per unit of product A is 0.5, for product B is 0.6, and for product C is 0.4.\n// ResourceXA + ResourceXB + ResourceXC <= 100\n// UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units.\n// UnitsA <= 150\n// UnitsB <= 120\n// UnitsC <= 100\n\n## Generate Constraint-3:\nThe production capacity of the company is limited to 300 units in total.\n// UnitsA + UnitsB + UnitsC <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many units of product A as product B.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production capacity, market demand, and resource constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. The usage of resource X per unit of product A is 0.5, for product B is 0.6, and for product C is 0.4. The company has a total of 100 units of resource X available.\n\n| Product | Profit per Unit | Resource X Usage per Unit |\n|---------|-----------------|---------------------------|\n| A       | 50$             | 0.5                       |\n| B       | 70$             | 0.6                       |\n| C       | 60$             | 0.4                       |\n\nThe market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units. The production capacity of the company is limited to 300 units in total. The company has a policy to produce at least twice as many units of product A as product B.\n\nPlease help the company to maximize the total profit from the sales of all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 100 units of resource X available.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.6 + UnitsC * 0.4 <= 100)\n# The market demand for product A is at most 150 units, for product B is at most 120 units, and for product C is at most 100 units.\nmodel.addCons(UnitsA <= 150)\nmodel.addCons(UnitsB <= 120)\nmodel.addCons(UnitsC <= 100)\n# The production capacity of the company is limited to 300 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 300)\n# The company has a policy to produce at least twice as many units of product A as product B.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying sizes and orientations suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on building A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type due to differences in roof size and orientation. Building A has an efficiency of 0.8 kWh per panel, Building B has 0.7 kWh, Building C has 0.6 kWh, Building D has 0.5 kWh, and Building E has 0.4 kWh. The cost of installation per panel also varies: $500 for Building A, $600 for Building B, $700 for Building C, $800 for Building D, and $900 for Building E. The city aims to maximize the total energy generated per dollar spent.\n// Energy_A = 0.8 * A\n// Energy_B = 0.7 * B\n// Energy_C = 0.6 * C\n// Energy_D = 0.5 * D\n// Energy_E = 0.4 * E\n// Cost_A = 500 * A\n// Cost_B = 600 * B\n// Cost_C = 700 * C\n// Cost_D = 800 * D\n// Cost_E = 900 * E\n// So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) / (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 500 * A + 600 * B + 700 * C + 800 * D + 900 * E <= 100000\n\n## Generate Constraint-2:\nEach building type has a limited available roof space for solar panels. Building A can accommodate up to 100 panels, Building B up to 150 panels, Building C up to 200 panels, Building D up to 250 panels, and Building E up to 300 panels.\n// A <= 100; B <= 150; C <= 200; D <= 250; E <= 300",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying sizes and orientations suitable for solar panel installation. The efficiency of solar panels varies by building type due to differences in roof size and orientation. Building A has an efficiency of 0.8 kWh per panel, Building B has 0.7 kWh, Building C has 0.6 kWh, Building D has 0.5 kWh, and Building E has 0.4 kWh. The cost of installation per panel also varies: $500 for Building A, $600 for Building B, $700 for Building C, $800 for Building D, and $900 for Building E. The city has a budget of $100,000 for the installation of solar panels. Each building type has a limited available roof space for solar panels. Building A can accommodate up to 100 panels, Building B up to 150 panels, Building C up to 200 panels, Building D up to 250 panels, and Building E up to 300 panels.\n\nPlease help the city to maximize the total energy generated per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of solar panels on building A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # number of solar panels on building B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # number of solar panels on building C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=250) # number of solar panels on building D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=300) # number of solar panels on building E\n\n# Define objective function\nEnergy_A = 0.8 * A\nEnergy_B = 0.7 * B\nEnergy_C = 0.6 * C\nEnergy_D = 0.5 * D\nEnergy_E = 0.4 * E\nCost_A = 500 * A\nCost_B = 600 * B\nCost_C = 700 * C\nCost_D = 800 * D\nCost_E = 900 * E\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) / (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n# convert the division to multiplication\nmodel.addCons(obj * (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) == Energy_A + Energy_B + Energy_C + Energy_D + Energy_E)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(500 * A + 600 * B + 700 * C + 800 * D + 900 * E <= 100000)\n# Each building type has a limited available roof space for solar panels.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 200)\nmodel.addCons(D <= 250)\nmodel.addCons(E <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building A: \", model.getVal(A))\n    print(\"Number of Solar Panels on Building B: \", model.getVal(B))\n    print(\"Number of Solar Panels on Building C: \", model.getVal(C))\n    print(\"Number of Solar Panels on Building D: \", model.getVal(D))\n    print(\"Number of Solar Panels on Building E: \", model.getVal(E))\n    print(\"Maximized Energy per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit.\n// Total profit: Profit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month.\n// 2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a fixed monthly budget for production costs, which is $2000.\n// 30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of each device are produced to maintain market presence.\n// UnitsA >= 10; UnitsB >= 10; UnitsC >= 10\n\n## Generate Constraint-5:\nDue to strategic partnerships, the company should produce at least 30 units in total per month.\n// UnitsA + UnitsB + UnitsC >= 30",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability. The profit per unit, production cost per unit, and the required units of a critical component for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Required Units of Critical Component |\n|--------|-----------------|--------------------------|--------------------------------------|\n| DeviceA | $50 | $30 | 2 |\n| DeviceB | $70 | $40 | 3 |\n| DeviceC | $60 | $35 | 4 |\n\nThe company has a limited amount of a critical component that is used in the production of all devices, with a total available amount of 150 units per month. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. The company has a fixed monthly budget for production costs, which is $2000. The company wants to ensure that at least 10 units of each device are produced to maintain market presence. Additionally, due to strategic partnerships, the company should produce at least 30 units in total per month.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=10) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=10) # number of units of DeviceC\n\n# Define objective function\nProfit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint-1: Limited amount of a critical component\nmodel.addCons(2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150)\n# Constraint-2: Demand for DeviceA is at least twice the demand for DeviceB\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# Constraint-3: Fixed monthly budget for production costs\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000)\n# Constraint-4: At least 10 units of each device are produced\nmodel.addCons(UnitsA >= 10)\nmodel.addCons(UnitsB >= 10)\nmodel.addCons(UnitsC >= 10)\n# Constraint-5: Produce at least 30 units in total per month\nmodel.addCons(UnitsA + UnitsB + UnitsC >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1315,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, with a production cost per unit of $10 and a storage cost per unit of $5. \nThe profit per unit of P2 is $40, with a production cost per unit of $15 and a storage cost per unit of $7. \nThe profit per unit of P3 is $50, with a production cost per unit of $20 and a storage cost per unit of $9. \nThe manufacturer aims to maximize the total net profit (profit minus production and storage costs) while considering the storage space and production time.\n// NetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\n// NetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\n// NetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n// The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited storage space of 200 cubic meters. The storage requirement for P1 is 2 cubic meters per unit, for P2 is 3 cubic meters per unit, and for P3 is 4 cubic meters per unit.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a limited production time of 150 hours. The production time for P1 is 3 hours per unit, for P2 is 4 hours per unit, and for P3 is 5 hours per unit.\n// 3 * P1 + 4 * P2 + 5 * P3 <= 150\n\n## Generate Constraint-3:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * P1 + 15 * P2 + 20 * P3 <= 3000\n\n## Generate Constraint-4:\nThe market demand for P1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of P1.\n// P1 <= 10",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints.\nThe profit per unit of P1 is $30, with a production cost per unit of $10 and a storage cost per unit of $5. \nThe profit per unit of P2 is $40, with a production cost per unit of $15 and a storage cost per unit of $7. \nThe profit per unit of P3 is $50, with a production cost per unit of $20 and a storage cost per unit of $9. \nThe manufacturer has a limited storage space of 200 cubic meters. The storage requirement for P1 is 2 cubic meters per unit, for P2 is 3 cubic meters per unit, and for P3 is 4 cubic meters per unit.\nThe manufacturer has a limited production time of 150 hours. The production time for P1 is 3 hours per unit, for P2 is 4 hours per unit, and for P3 is 5 hours per unit.\nThe manufacturer has a budget of $3000 for production costs.\nThe market demand for P1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of P1.\nPlease help the manufacturer to maximize the total net profit (profit minus production and storage costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=10) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\nNetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\nNetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n# The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The manufacturer has a limited storage space of 200 cubic meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n# The manufacturer has a limited production time of 150 hours.\nmodel.addCons(3 * P1 + 4 * P2 + 5 * P3 <= 150)\n# The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * P1 + 15 * P2 + 20 * P3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize the total fuel consumption while meeting the delivery demand.\n// {\"number of Trucks\": \"TruckNum\", \"range\": \"TruckNum >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanNum\", \"range\": \"VanNum >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeNum\", \"range\": \"BikeNum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Trucks is 50 liters per 100 km, for Vans is 30 liters per 100 km, and for Bikes is 5 liters per 100 km. The company wants to minimize the total fuel consumption for a given total distance of 10,000 km.\n// Total fuel consumption for Trucks: Fuel_Truck = 50 * (10,000 / 100) * TruckNum\n// Total fuel consumption for Vans: Fuel_Van = 30 * (10,000 / 100) * VanNum\n// Total fuel consumption for Bikes: Fuel_Bike = 5 * (10,000 / 100) * BikeNum\n// So, the objective function is: Minimize (Fuel_Truck + Fuel_Van + Fuel_Bike)\n\n## Generate Constraint-1:\nThe total number of vehicles available is 200.\n// TruckNum + VanNum + BikeNum <= 200\n\n## Generate Constraint-2:\nThe capacity constraint requires that the total capacity of all vehicles must be at least 500 tons. Trucks have a capacity of 10 tons, Vans have a capacity of 5 tons, and Bikes have a capacity of 1 ton.\n// 10 * TruckNum + 5 * VanNum + 1 * BikeNum >= 500\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Trucks must be at least twice the number of Vans.\n// TruckNum >= 2 * VanNum\n\n## Generate Constraint-4:\nThe company has a policy to ensure that at least 10% of the fleet are Bikes for short-distance deliveries.\n// BikeNum >= 0.1 * (TruckNum + VanNum + BikeNum)\n\n## Generate Constraint-5:\nThe company wants to ensure that each type of vehicle is used at least once to maintain operational readiness.\n// TruckNum >= 1; VanNum >= 1; BikeNum >= 1",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize the total fuel consumption while meeting the delivery demand. The fuel consumption for Trucks is 50 liters per 100 km, for Vans is 30 liters per 100 km, and for Bikes is 5 liters per 100 km. The company wants to minimize the total fuel consumption for a given total distance of 10,000 km. The total number of vehicles available is 200. The capacity constraint requires that the total capacity of all vehicles must be at least 500 tons. Trucks have a capacity of 10 tons, Vans have a capacity of 5 tons, and Bikes have a capacity of 1 ton. Due to maintenance constraints, the number of Trucks must be at least twice the number of Vans. The company has a policy to ensure that at least 10% of the fleet are Bikes for short-distance deliveries. The company wants to ensure that each type of vehicle is used at least once to maintain operational readiness. Please help the company to determine the optimal number of each type of vehicle to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckNum = model.addVar(vtype=\"INTEGER\", name=\"TruckNum\", lb=1)  # number of Trucks\nVanNum = model.addVar(vtype=\"INTEGER\", name=\"VanNum\", lb=1)  # number of Vans\nBikeNum = model.addVar(vtype=\"INTEGER\", name=\"BikeNum\", lb=1)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Truck = 50 * (10000 / 100) * TruckNum\nFuel_Van = 30 * (10000 / 100) * VanNum\nFuel_Bike = 5 * (10000 / 100) * BikeNum\n## the objective function is: Minimize (Fuel_Truck + Fuel_Van + Fuel_Bike)\nmodel.addCons(obj == Fuel_Truck + Fuel_Van + Fuel_Bike)\n\n# Add constraints\n## The total number of vehicles available is 200.\nmodel.addCons(TruckNum + VanNum + BikeNum <= 200)\n## The capacity constraint requires that the total capacity of all vehicles must be at least 500 tons.\nmodel.addCons(10 * TruckNum + 5 * VanNum + 1 * BikeNum >= 500)\n## Due to maintenance constraints, the number of Trucks must be at least twice the number of Vans.\nmodel.addCons(TruckNum >= 2 * VanNum)\n## The company has a policy to ensure that at least 10% of the fleet are Bikes for short-distance deliveries.\nmodel.addCons(BikeNum >= 0.1 * (TruckNum + VanNum + BikeNum))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckNum))\n    print(\"Number of Vans: \", model.getVal(VanNum))\n    print(\"Number of Bikes: \", model.getVal(BikeNum))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company needs to minimize the total daily operational cost and fuel consumption.\n// Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n// Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (Cost + Fuel)\n\n## Generate Constraint-1:\nThe company has a daily demand of 1000 km of transportation.\n// 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company can only afford to operate a maximum of 20 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 20\n\n## Generate Constraint-3:\nThe number of type 1 trucks cannot exceed 5.\n// T1 <= 5\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 2.\n// T5 >= 2\n\n## Generate Constraint-5:\nThe total operational cost should not exceed $3000 per day.\n// 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 <= 3000",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation. The fuel efficiency and operational costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Operational Cost ($/day) |\n|------------|------------------------------|--------------------------|\n| Type 1     | 5                            | 100                      |\n| Type 2     | 4                            | 120                      |\n| Type 3     | 3                            | 150                      |\n| Type 4     | 2.5                          | 180                      |\n| Type 5     | 2                            | 200                      |\n\nThe company has a daily demand of 1000 km of transportation. The company can only afford to operate a maximum of 20 trucks in total. The number of type 1 trucks cannot exceed 5. The number of type 5 trucks must be at least 2. The total operational cost should not exceed $3000 per day.\nPlease help the company to minimize the total daily operational cost and fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n## Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n## So, the objective function is: Minimize (Cost + Fuel)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 + 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5)\n\n# Add constraints\n## The company has a daily demand of 1000 km of transportation.\nmodel.addCons(5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000)\n## The company can only afford to operate a maximum of 20 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 20)\n## The number of type 1 trucks cannot exceed 5.\nmodel.addCons(T1 <= 5)\n## The number of type 5 trucks must be at least 2.\nmodel.addCons(T5 >= 2)\n## The total operational cost should not exceed $3000 per day.\nmodel.addCons(100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost and Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company has a maximum operational capacity of 100 trips in total.\n// V1 + V2 + V3 <= 100\n\n## Generate Constraint-4:\nThe market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1.\n// V1 <= 30\n\n## Generate Constraint-5:\nThe company must ensure that at least 20% of the total trips are made by V2 for compliance reasons.\n// V2 >= 0.2 * (V1 + V2 + V3)",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations. The cost per trip, fuel consumption per trip, and revenue per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Fuel Consumption per Trip | Revenue per Trip |\n|---------|---------------|---------------------------|------------------|\n| V1      | $100          | 5 liters                  | $150             |\n| V2      | $120          | 6 liters                  | $180             |\n| V3      | $140          | 7 liters                  | $210             |\n\nThe company has a limited fuel budget of 500 liters. The company has a budget of $10,000 for operational costs. The company has a maximum operational capacity of 100 trips in total. The market demand for V1 trips is 30. So, the company can only make a maximum of 30 trips with V1. The company must ensure that at least 20% of the total trips are made by V2 for compliance reasons.\n\nPlease help the company to maximize the profit efficiency (profit per liter of fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n## The company has a maximum operational capacity of 100 trips in total.\nmodel.addCons(V1 + V2 + V3 <= 100)\n## The market demand for V1 trips is 30.\nmodel.addCons(V1 <= 30)\n## The company must ensure that at least 20% of the total trips are made by V2 for compliance reasons.\nmodel.addCons(V2 >= 0.2 * (V1 + V2 + V3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips of V1: \", model.getVal(V1))\n    print(\"Trips of V2: \", model.getVal(V2))\n    print(\"Trips of V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region (Region A, Region B, and Region C) and the number of trips each truck should make per day. The efficiency of each truck varies depending on the region and the type of goods being transported.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Region C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $100 per trip, in Region B is $150 per trip, and in Region C is $200 per trip. The revenue generated per trip in Region A is $200, in Region B is $300, and in Region C is $400. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Profit_A = TripsA * TrucksA * (200 - 100)\n// Profit_B = TripsB * TrucksB * (300 - 150)\n// Profit_C = TripsC * TrucksC * (400 - 200)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs per day.\n// 100 * TrucksA * TripsA + 150 * TrucksB * TripsB + 200 * TrucksC * TripsC <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trips per day across all regions.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100\n\n## Generate Constraint-3:\nThe company can only allocate a maximum of 20 trucks in total across all regions.\n// TrucksA + TrucksB + TrucksC <= 20\n\n## Generate Constraint-4:\nThe average load capacity of each truck must be respected, with a maximum of 5 tons per trip. The total weight of goods transported per day should not exceed 400 tons.\n// 5 * TrucksA * TripsA + 5 * TrucksB * TripsB + 5 * TrucksC * TripsC <= 400",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region (Region A, Region B, and Region C) and the number of trips each truck should make per day. The cost of operating a truck and the revenue generated per trip vary by region as shown in the following Table.\n\n| Region | Operating Cost per Trip | Revenue per Trip |\n|--------|-------------------------|------------------|\n| A      | $100                    | $200             |\n| B      | $150                    | $300             |\n| C      | $200                    | $400             |\n\nThe company has a total budget of $10,000 for operating costs per day. The company has a limit of 100 trips per day across all regions. The company can only allocate a maximum of 20 trucks in total across all regions. The average load capacity of each truck must be respected, with a maximum of 5 tons per trip. The total weight of goods transported per day should not exceed 400 tons.\n\nPlease help the company to maximize its net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for Region C\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips per truck for Region A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips per truck for Region B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)  # number of trips per truck for Region C\n\n# Define objective function\nProfit_A = TripsA * TrucksA * (200 - 100)\nProfit_B = TripsB * TrucksB * (300 - 150)\nProfit_C = TripsC * TrucksC * (400 - 200)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(100 * TrucksA * TripsA + 150 * TrucksB * TripsB + 200 * TrucksC * TripsC <= 10000)  # Total budget constraint\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC <= 100)  # Total trips constraint\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 20)  # Total trucks constraint\nmodel.addCons(5 * TrucksA * TripsA + 5 * TrucksB * TripsB + 5 * TrucksC * TripsC <= 400)  # Total weight constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Number of Trips per Truck for Region A: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for Region B: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for Region C: \", model.getVal(TripsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. The company wants to minimize the total cost of purchasing trucks and fuel expenses per year, given that each truck travels an average of 50,000 miles per year.\n// Cost_SmallTrucks = 30000 * SmallTrucks\n// Cost_MediumTrucks = 50000 * MediumTrucks\n// Cost_LargeTrucks = 80000 * LargeTrucks\n// Fuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\n// Fuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\n// Fuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n// So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 500,000 kg.\n// SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000\n\n## Generate Constraint-4:\nThe total fuel consumption must not exceed 20,000 gallons per year.\n// (50000 * SmallTrucks) / 10 + (50000 * MediumTrucks) / 15 + (50000 * LargeTrucks) / 20 <= 20000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary. The cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. Each truck travels an average of 50,000 miles per year.\n\nThe company has a total budget of $1,000,000 for purchasing trucks. It has a total of 100 drivers available. The total cargo capacity of all trucks must not exceed 500,000 kg. The total fuel consumption must not exceed 20,000 gallons per year.\n\nPlease help the company to minimize the total cost of purchasing trucks and fuel expenses per year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nCost_SmallTrucks = 30000 * SmallTrucks\nCost_MediumTrucks = 50000 * MediumTrucks\nCost_LargeTrucks = 80000 * LargeTrucks\nFuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\nFuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\nFuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n# So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000)\n# The company has a total of 100 drivers available.\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100)\n# The total cargo capacity of all trucks must not exceed 500,000 kg.\nmodel.addCons(SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000)\n# The total fuel consumption must not exceed 20,000 gallons per year.\nmodel.addCons((50000 * SmallTrucks) / 10 + (50000 * MediumTrucks) / 15 + (50000 * LargeTrucks) / 20 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Number of Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Number of Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its distribution network for five different regions: North, South, East, West, and Central. They need to determine the number of trucks to allocate to each region to optimize their delivery efficiency.\n// {\"number of trucks allocated to the North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck in the North region is 0.8, in the South region is 0.9, in the East region is 0.7, in the West region is 0.85, and in the Central region is 1.0. The company wants to maximize the total efficiency of the truck fleet.\n// Total efficiency for the North region: EfficiencyNorth = 0.8 * TrucksNorth\n// Total efficiency for the South region: EfficiencySouth = 0.9 * TrucksSouth\n// Total efficiency for the East region: EfficiencyEast = 0.7 * TrucksEast\n// Total efficiency for the West region: EfficiencyWest = 0.85 * TrucksWest\n// Total efficiency for the Central region: EfficiencyCentral = 1.0 * TrucksCentral\n// So, the objective function is: Maximize (EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100\n\n## Generate Constraint-2:\nDue to geographical constraints, the number of trucks in the North region must be at least half the number in the Central region.\n// TrucksNorth >= 0.5 * TrucksCentral\n\n## Generate Constraint-3:\nThe company aims to have at least 20 trucks in the East and West regions combined.\n// TrucksEast + TrucksWest >= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total trucks are allocated to any single region.\n// TrucksNorth <= 0.4 * 100\n// TrucksSouth <= 0.4 * 100\n// TrucksEast <= 0.4 * 100\n// TrucksWest <= 0.4 * 100\n// TrucksCentral <= 0.4 * 100",
        "question": "A logistics company is planning its distribution network for five different regions: North, South, East, West, and Central. They need to determine the number of trucks to allocate to each region to optimize their delivery efficiency.\nThe efficiency of each truck in the North region is 0.8, in the South region is 0.9, in the East region is 0.7, in the West region is 0.85, and in the Central region is 1.0. The company wants to maximize the total efficiency of the truck fleet.\nThe company has a total of 100 trucks available for allocation. Due to geographical constraints, the number of trucks in the North region must be at least half the number in the Central region. The company aims to have at least 20 trucks in the East and West regions combined. The company wants to ensure that no more than 40% of the total trucks are allocated to any single region.\nPlease help the company to maximize the total efficiency of the truck fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)  # number of trucks allocated to the North region\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)  # number of trucks allocated to the South region\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)  # number of trucks allocated to the East region\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)  # number of trucks allocated to the West region\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0)  # number of trucks allocated to the Central region\n\n# Define objective function\nEfficiencyNorth = 0.8 * TrucksNorth\nEfficiencySouth = 0.9 * TrucksSouth\nEfficiencyEast = 0.7 * TrucksEast\nEfficiencyWest = 0.85 * TrucksWest\nEfficiencyCentral = 1.0 * TrucksCentral\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral)\n\n# Add constraints\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\nmodel.addCons(TrucksNorth >= 0.5 * TrucksCentral)\nmodel.addCons(TrucksEast + TrucksWest >= 20)\nmodel.addCons(TrucksNorth <= 0.4 * 100)\nmodel.addCons(TrucksSouth <= 0.4 * 100)\nmodel.addCons(TrucksEast <= 0.4 * 100)\nmodel.addCons(TrucksWest <= 0.4 * 100)\nmodel.addCons(TrucksCentral <= 0.4 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000\n\n## Generate Constraint-3:\nThe company has a distribution capacity of 100 units in terms of the number of units it can distribute.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-4:\nThe market demand for P1 is 15 units. So, the company can only sell a maximum of 15 units of P1.\n// P1 <= 15\n\n## Generate Constraint-5:\nThe company must distribute at least 20 units of P2 to meet contractual obligations.\n// P2 >= 20",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit for P1 is $30 and requires 2 square meters of storage space, for P2 the profit per unit is $40 and requires 3 square meters of storage space, and for P3 the profit per unit is $50 and requires 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space). The company has a limited storage space of 200 square meters and a budget of $3000 for purchasing the products. The company has a distribution capacity of 100 units in terms of the number of units it can distribute. The market demand for P1 is 15 units, so the company can only sell a maximum of 15 units of P1. The company must distribute at least 20 units of P2 to meet contractual obligations. Please help the company to maximize the total profit while considering the storage efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=15) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=20, ub=100) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n## The company has a distribution capacity of 100 units in terms of the number of units it can distribute.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The market demand for P1 is 15 units. So, the company can only sell a maximum of 15 units of P1.\nmodel.addCons(P1 <= 15)\n## The company must distribute at least 20 units of P2 to meet contractual obligations.\nmodel.addCons(P2 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. TruckA has an operational cost of $500 per day and generates $1000 per day. TruckB has an operational cost of $600 per day and generates $1200 per day. TruckC has an operational cost of $700 per day and generates $1400 per day. TruckD has an operational cost of $800 per day and generates $1600 per day. TruckE has an operational cost of $900 per day and generates $1800 per day. The company aims to maximize the total daily net profit (revenue minus operational cost) per truck.\n// Daily net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckA\n// Daily net profit for TruckB: Profit_TruckB = (1200 - 600) * TruckB\n// Daily net profit for TruckC: Profit_TruckC = (1400 - 700) * TruckC\n// Daily net profit for TruckD: Profit_TruckD = (1600 - 800) * TruckD\n// Daily net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for operational costs for the month.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150,000\n\n## Generate Constraint-2:\nThe company has a limit of 100 trucks that can be deployed in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\n// TruckC <= TruckA + 10\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the total trucks are TruckE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-5:\nThe company has a policy to ensure that each type of truck is deployed at least once.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize their operations. The operational costs and daily revenue for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Day | Daily Revenue |\n|------------|--------------------------|---------------|\n| TruckA     | $500                     | $1000         |\n| TruckB     | $600                     | $1200         |\n| TruckC     | $700                     | $1400         |\n| TruckD     | $800                     | $1600         |\n| TruckE     | $900                     | $1800         |\n\nThe company has a total budget of $150,000 for operational costs for the month. The company has a limit of 100 trucks that can be deployed in total. Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10. The company wants to ensure that at least 20% of the total trucks are TruckE. The company also has a policy to ensure that each type of truck is deployed at least once. \n\nPlease help the company to maximize the total daily net profit (revenue minus operational cost) per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_TruckA = (1000 - 500) * TruckA\nProfit_TruckB = (1200 - 600) * TruckB\nProfit_TruckC = (1400 - 700) * TruckC\nProfit_TruckD = (1600 - 800) * TruckD\nProfit_TruckE = (1800 - 900) * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total budget of $150,000 for operational costs for the month.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 150000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance requirements, the number of TruckC cannot exceed the number of TruckA by more than 10.\nmodel.addCons(TruckC <= TruckA + 10)\n## The company wants to ensure that at least 20% of the total trucks are TruckE.\nmodel.addCons(TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000\n\n## Generate Constraint-2:\nThe company aims to have at least 10 vehicles in total.\n// Trucks + Vans + Bikes + Drones >= 10",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for each vehicle type per day are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day |\n|--------------|--------------------------|\n| Trucks       | $500                     |\n| Vans         | $300                     |\n| Bikes        | $100                     |\n| Drones       | $200                     |\n\nThe company has a budget of $100,000 for purchasing vehicles. The company aims to have at least 10 vehicles in total. Please help the company to minimize the total operational cost while ensuring efficient delivery coverage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n# The company aims to have at least 10 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes + Drones >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good to optimize delivery efficiency. Additionally, the company is considering investing in a new fleet management system that can reduce the operational costs per truck, depending on the level of investment.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system for GoodsX\": \"FleetX\", \"range\": \"FleetX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsY\": \"FleetY\", \"range\": \"FleetY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsZ\": \"FleetZ\", \"range\": \"FleetZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for GoodsX: CostX = (1000 - 0.1 * FleetX) * TrucksX\n// Total operational cost for GoodsY: CostY = (1200 - 0.12 * FleetY) * TrucksY\n// Total operational cost for GoodsZ: CostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and fleet management system investments.\n// (1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 500.\n// TrucksX + TrucksY + TrucksZ <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 50 trucks for GoodsX and 100 trucks for GoodsY.\n// TrucksX >= 50; TrucksY >= 100\n\n## Generate Constraint-4:\nThe investment in the fleet management system for each type of good cannot exceed $10,000.\n// FleetX <= 10000; FleetY <= 10000; FleetZ <= 10000",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the investment in a fleet management system to optimize delivery efficiency. The operational cost per truck decreases with the investment in the fleet management system. The initial cost per truck and the reduction in cost per $100 invested for each type of good are given in the following Table.\n\n| Type of Good | Initial Cost per Truck | Reduction in Cost per $100 Invested |\n|--------------|------------------------|-------------------------------------|\n| GoodsX       | $1000                  | $10                                 |\n| GoodsY       | $1200                  | $12                                 |\n| GoodsZ       | $1500                  | $15                                 |\n\nThe company has a total budget of $100,000 for truck operations and fleet management system investments. The total number of trucks available for distribution is limited to 500. Due to contractual obligations, the company must allocate at least 50 trucks for GoodsX and 100 trucks for GoodsY. The investment in the fleet management system for each type of good cannot exceed $10,000.\n\nPlease help the company to minimize the total operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=50)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=100)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFleetX = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetX\", lb=0)  # investment in fleet management system for GoodsX\nFleetY = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetY\", lb=0)  # investment in fleet management system for GoodsY\nFleetZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetZ\", lb=0)  # investment in fleet management system for GoodsZ\n\n# Define objective function\nCostX = (1000 - 0.1 * FleetX) * TrucksX\nCostY = (1200 - 0.12 * FleetY) * TrucksY\nCostZ = (1500 - 0.15 * FleetZ) * TrucksZ\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons((1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000)\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\nmodel.addCons(TrucksX >= 50)\nmodel.addCons(TrucksY >= 100)\nmodel.addCons(FleetX <= 10000)\nmodel.addCons(FleetY <= 10000)\nmodel.addCons(FleetZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Investment in FleetX: \", model.getVal(FleetX))\n    print(\"Investment in FleetY: \", model.getVal(FleetY))\n    print(\"Investment in FleetZ: \", model.getVal(FleetZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck on RouteA is $500, on RouteB is $600, and on RouteC is $700. The maintenance cost per truck on RouteA is $300, on RouteB is $400, and on RouteC is $500. The revenue per truck on RouteA is $1500, on RouteB is $2000, and on RouteC is $2500. The company aims to maximize the total net profit from all routes.\n// Total net profit for RouteA: Profit_A = (1500 - 500 - 300) * TrucksA\n// Total net profit for RouteB: Profit_B = (2000 - 600 - 400) * TrucksB\n// Total net profit for RouteC: Profit_C = (2500 - 700 - 500) * TrucksC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to road conditions, RouteA can handle a maximum of 20 trucks.\n// TrucksA <= 20\n\n## Generate Constraint-3:\nRouteB requires at least 10% of the total fleet due to contractual obligations.\n// TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC)\n\n## Generate Constraint-4:\nThe total maintenance cost across all routes must not exceed $15,000.\n// 300 * TrucksA + 400 * TrucksB + 500 * TrucksC <= 15000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route. The details of costs and revenue per truck for each route are given in the following Table.\n\n| Route | Fuel Cost per Truck | Maintenance Cost per Truck | Revenue per Truck |\n|-------|---------------------|----------------------------|-------------------|\n| RouteA | $500               | $300                       | $1500             |\n| RouteB | $600               | $400                       | $2000             |\n| RouteC | $700               | $500                       | $2500             |\n\nThe company has a total of 50 trucks available. RouteA can handle a maximum of 20 trucks due to road conditions. RouteB requires at least 10% of the total fleet due to contractual obligations. The total maintenance cost across all routes must not exceed $15,000. \n\nPlease help the company to maximize the total net profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks on RouteC\n\n# Define objective function\nProfit_A = (1500 - 500 - 300) * TrucksA\nProfit_B = (2000 - 600 - 400) * TrucksB\nProfit_C = (2500 - 700 - 500) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)  # Total of 50 trucks available\nmodel.addCons(TrucksA <= 20)  # RouteA can handle a maximum of 20 trucks\nmodel.addCons(TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC))  # RouteB requires at least 10% of the total fleet\nmodel.addCons(300 * TrucksA + 400 * TrucksB + 500 * TrucksC <= 15000)  # Total maintenance cost must not exceed $15,000\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company aims to maximize the total carrying capacity while minimizing the total daily operational cost.\n// Objective function: Maximize (1000 * Trucks + 500 * Vans + 100 * Bikes) / (500 * Trucks + 300 * Vans + 100 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle operations.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 15000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 50,000 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company aims to maximize the total carrying capacity while minimizing the total daily operational cost. The company has a budget of $15,000 per month for vehicle operations. The total carrying capacity must be at least 50,000 kg. Please help the company to maximize the ratio of the total carrying capacity to the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCarryingCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes\nOperationalCost = 500 * Trucks + 300 * Vans + 100 * Bikes\n## the objective function is: Maximize (CarryingCapacity) / (OperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * OperationalCost == CarryingCapacity)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle operations.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 15000)\n## The total carrying capacity must be at least 50,000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Carrying Capacity per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is 0.05 * A^2, for product B is 0.07 * B^2, and for product C is 0.09 * C^2. The company aims to maximize its total profit.\n// Profit_A = 20 * A - 0.05 * A^2\n// Profit_B = 30 * B - 0.07 * B^2\n// Profit_C = 40 * C - 0.09 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for production costs.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 <= 1000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 50 hours per week. The production time for product A is 1 hour per unit, for product B is 2 hours per unit, and for product C is 3 hours per unit.\n// A + 2 * B + 3 * C <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit margin. The profit per unit and the production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | 1 hour                   |\n| B       | $30             | 2 hours                  |\n| C       | $40             | 3 hours                  |\n\nThe production cost for each product increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is 0.05 * A^2, for product B is 0.07 * B^2, and for product C is 0.09 * C^2. The company has a total budget of $1000 for production costs. The company also has a limited production capacity of 50 hours per week. \n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A - 0.05 * A**2\nProfit_B = 30 * B - 0.07 * B**2\nProfit_C = 40 * C - 0.09 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $1000 for production costs.\nmodel.addCons(0.05 * A**2 + 0.07 * B**2 + 0.09 * C**2 <= 1000)\n## The company has a limited production capacity of 50 hours per week.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is measured by the profit per fuel cost. Trucks generate a profit of $100 per trip with a fuel cost of $20, Vans generate a profit of $70 per trip with a fuel cost of $15, and Bikes generate a profit of $30 per trip with a fuel cost of $5. The company aims to maximize the total efficiency, which is defined as the sum of the profits divided by the sum of the fuel costs.\n// Profit per Truck: Profit_T = 100 * T\n// Profit per Van: Profit_V = 70 * V\n// Profit per Bike: Profit_B = 30 * B\n// Fuel cost for Trucks: Fuel_T = 20 * T\n// Fuel cost for Vans: Fuel_V = 15 * V\n// Fuel cost for Bikes: Fuel_B = 5 * B\n// So, the objective function is: Maximize (Profit_T + Profit_V + Profit_B) / (Fuel_T + Fuel_V + Fuel_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per month.\n// 20 * T + 15 * V + 5 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 50 vehicles available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is measured by the profit per fuel cost, as shown in the following Table.\n\n| Vehicle | Profit per Trip | Fuel Cost per Trip |\n|---------|-----------------|--------------------|\n| Trucks  | $100            | $20                |\n| Vans    | $70             | $15                |\n| Bikes   | $30             | $5                 |\n\nThe company has a budget of $10,000 for fuel costs per month. The company has a total of 50 vehicles available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. \n\nPlease help the company to maximize the total efficiency, which is defined as the sum of the profits divided by the sum of the fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_T = 100 * T\nProfit_V = 70 * V\nProfit_B = 30 * B\nFuel_T = 20 * T\nFuel_V = 15 * V\nFuel_B = 5 * B\n## the objective function is: Maximize (Profit_T + Profit_V + Profit_B) / (Fuel_T + Fuel_V + Fuel_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_T + Fuel_V + Fuel_B) == Profit_T + Profit_V + Profit_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per month.\nmodel.addCons(20 * T + 15 * V + 5 * B <= 10000)\n## The company has a total of 50 vehicles available.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (Fragile, Perishable, and General). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time while considering the different speed limits and cargo handling requirements.\n// {\"number of trucks for Fragile cargo\": \"FragileTrucks\", \"range\": \"FragileTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable cargo\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for General cargo\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Fragile cargo\": \"FragileSpeed\", \"range\": \"FragileSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for Perishable cargo\": \"PerishableSpeed\", \"range\": \"PerishableSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for General cargo\": \"GeneralSpeed\", \"range\": \"GeneralSpeed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe delivery time for Fragile cargo is inversely proportional to the speed squared due to the need for careful handling, and the distance is 500 km.\nThe delivery time for Perishable cargo is inversely proportional to the speed, and the distance is 400 km.\nThe delivery time for General cargo is directly proportional to the speed due to less stringent delivery requirements, and the distance is 300 km.\nThe company wants to minimize the total delivery time for all cargos.\n// Time_Fragile = 500 / (FragileSpeed^2) * FragileTrucks\n// Time_Perishable = 400 / PerishableSpeed * PerishableTrucks\n// Time_General = GeneralSpeed * 300 * GeneralTrucks\n// So, the objective function is: Minimize (Time_Fragile + Time_Perishable + Time_General)\n\n## Generate Constraint-1:\nThe company has a total of 10 trucks available.\n// FragileTrucks + PerishableTrucks + GeneralTrucks <= 10\n\n## Generate Constraint-2:\nThe speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns.\n// FragileSpeed <= 60\n\n## Generate Constraint-3:\nThe speed of trucks carrying Perishable cargo must be at least 50 km/h to ensure timely delivery.\n// PerishableSpeed >= 50",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo (Fragile, Perishable, and General). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time. The delivery time for Fragile cargo is inversely proportional to the speed squared due to the need for careful handling, and the distance is 500 km. The delivery time for Perishable cargo is inversely proportional to the speed, and the distance is 400 km. The delivery time for General cargo is directly proportional to the speed due to less stringent delivery requirements, and the distance is 300 km. The company has a total of 10 trucks available. The speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns. The speed of trucks carrying Perishable cargo must be at least 50 km/h to ensure timely delivery. Please help the company to minimize the total delivery time for all cargos.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFragileTrucks = model.addVar(vtype=\"INTEGER\", name=\"FragileTrucks\", lb=0)  # number of trucks for Fragile cargo\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for Perishable cargo\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=0)  # number of trucks for General cargo\nFragileSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FragileSpeed\", lb=0)  # speed of trucks for Fragile cargo\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=0)  # speed of trucks for Perishable cargo\nGeneralSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"GeneralSpeed\", lb=0)  # speed of trucks for General cargo\n\n# Define objective function\nTime_Fragile = 500 / (FragileSpeed**2) * FragileTrucks\nTime_Perishable = 400 / PerishableSpeed * PerishableTrucks\nTime_General = GeneralSpeed * 300 * GeneralTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Time_Fragile + Time_Perishable + Time_General)\n\n# Add constraints\nmodel.addCons(FragileTrucks + PerishableTrucks + GeneralTrucks <= 10)\nmodel.addCons(FragileSpeed <= 60)\nmodel.addCons(PerishableSpeed >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Fragile Cargo: \", model.getVal(FragileTrucks))\n    print(\"Number of Trucks for Perishable Cargo: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralTrucks))\n    print(\"Speed of Trucks for Fragile Cargo: \", model.getVal(FragileSpeed))\n    print(\"Speed of Trucks for Perishable Cargo: \", model.getVal(PerishableSpeed))\n    print(\"Speed of Trucks for General Cargo: \", model.getVal(GeneralSpeed))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TypeA trucks\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeB trucks\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeC trucks\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The company wants to minimize the total operational cost.\n// Fuel cost per kilometer for TypeA: CostA = 0.5 - 0.0001 * UpgradeA\n// Fuel cost per kilometer for TypeB: CostB = 0.6 - 0.0001 * UpgradeB\n// Fuel cost per kilometer for TypeC: CostC = 0.7 - 0.0001 * UpgradeC\n// Total operational cost: Minimize (CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $10,000.\n// UpgradeA + UpgradeB + UpgradeC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks.\n// TrucksA >= 20; TrucksB >= 30\n\n## Generate Constraint-4:\nThe maximum number of TypeC trucks that can be effectively utilized is 40.\n// TrucksC <= 40\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced fleet, requiring that the number of TypeA trucks does not exceed the number of TypeB trucks by more than 10.\n// TrucksA - TrucksB <= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The total budget for fuel efficiency upgrades is $10,000. The total number of trucks available is 100. Due to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks. The maximum number of TypeC trucks that can be effectively utilized is 40. The company aims to maintain a balanced fleet, requiring that the number of TypeA trucks does not exceed the number of TypeB trucks by more than 10.\n\nPlease help the company to determine the optimal number of trucks of each type and the appropriate fuel efficiency upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=20)  # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=30)  # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0, ub=40)  # number of TypeC trucks\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # fuel efficiency upgrade for TypeA trucks\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # fuel efficiency upgrade for TypeB trucks\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # fuel efficiency upgrade for TypeC trucks\n\n# Define objective function\nCostA = 0.5 - 0.0001 * UpgradeA\nCostB = 0.6 - 0.0001 * UpgradeB\nCostC = 0.7 - 0.0001 * UpgradeC\nTotalCost = (CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC <= 10000)  # total budget for fuel efficiency upgrades\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)  # total number of trucks available\nmodel.addCons(TrucksA - TrucksB <= 10)  # balanced fleet constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Upgrade for TypeA Trucks: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TypeB Trucks: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TypeC Trucks: \", model.getVal(UpgradeC))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"storage capacity for ProductA\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductB\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductC\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $1000 invested in automation for that product. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to automation.\n// Total revenue for ProductA: RevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product. The initial production time per unit and the revenue per unit for each product are given in the following Table.\n\n| Product | Initial Production Time (minutes) | Revenue per Unit |\n|---------|-----------------------------------|------------------|\n| ProductA | 30                                | $100             |\n| ProductB | 25                                | $120             |\n| ProductC | 20                                | $150             |\n\nThe production time per unit decreases by 1 minute for every $1000 invested in automation for that product. The company has a total of 100 workers available. The total capital investment in automation cannot exceed $50,000. \n\nPlease help the company to maximize the total revenue from all products, considering the reduced production time due to automation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # capital investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # capital investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # capital investment in automation for ProductC\n\n# Define objective function\nRevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\nRevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\nRevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The company has a total of 100 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n# The total capital investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Capital Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Capital Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost.\n// Cost_1 = 1000 * T1; Cost_2 = 1200 * T2; Cost_3 = 1500 * T3; Cost_4 = 1300 * T4; Cost_5 = 1400 * T5\n// Revenue_1 = 1800 * T1; Revenue_2 = 2000 * T2; Revenue_3 = 2200 * T3; Revenue_4 = 2100 * T4; Revenue_5 = 2300 * T5\n// Net_Profit_1 = Revenue_1 - Cost_1; Net_Profit_2 = Revenue_2 - Cost_2; Net_Profit_3 = Revenue_3 - Cost_3; Net_Profit_4 = Revenue_4 - Cost_4; Net_Profit_5 = Revenue_5 - Cost_5\n// So, the objective function is: Maximize (Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost and revenue per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| 1     | $1000          | $1800             |\n| 2     | $1200          | $2000             |\n| 3     | $1500          | $2200             |\n| 4     | $1300          | $2100             |\n| 5     | $1400          | $2300             |\n\nThe company wants to maximize the total net profit, which is the difference between the total revenue and the total cost. The company has a total of 100 trucks available for allocation.\n\nPlease help the company to determine the optimal number of trucks to allocate to each route to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nCost_1 = 1000 * T1\nCost_2 = 1200 * T2\nCost_3 = 1500 * T3\nCost_4 = 1300 * T4\nCost_5 = 1400 * T5\n\nRevenue_1 = 1800 * T1\nRevenue_2 = 2000 * T2\nRevenue_3 = 2200 * T3\nRevenue_4 = 2100 * T4\nRevenue_5 = 2300 * T5\n\nNet_Profit_1 = Revenue_1 - Cost_1\nNet_Profit_2 = Revenue_2 - Cost_2\nNet_Profit_3 = Revenue_3 - Cost_3\nNet_Profit_4 = Revenue_4 - Cost_4\nNet_Profit_5 = Revenue_5 - Cost_5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company can only use a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity, daily operational cost, and fuel efficiency. The company needs to deliver a total of 1500 units over a distance of 500 km. The details of each type of truck are given in the following Table.\n\n| Truck Type | Capacity (units) | Daily Operational Cost ($) | Fuel Efficiency (km/L) |\n|------------|------------------|-----------------------------|------------------------|\n| Small      | 100              | 200                         | 5                      |\n| Medium     | 200              | 300                         | 8                      |\n| Large      | 300              | 400                         | 10                     |\n\nThe company has a budget constraint of $10,000 for the total operational costs. The total capacity of all trucks must meet the delivery requirement of 1500 units. The company can only use a maximum of 20 trucks in total. \nPlease help the company to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n## The company can only use a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the cost of raw materials and the time required for production.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a production time of 1 hour. Product B sells for $70, with a raw material cost of $30 and a production time of 2 hours. Product C sells for $90, with a raw material cost of $40 and a production time of 3 hours. Product D sells for $110, with a raw material cost of $50 and a production time of 4 hours. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20) * A\n// Profit of product B: Profit_B = (70 - 30) * B\n// Profit of product C: Profit_C = (90 - 40) * C\n// Profit of product D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 10000\n\n## Generate Constraint-2:\nThe total production time cannot exceed 500 hours.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A and 30 units of product B.\n// A >= 50; B >= 30\n\n## Generate Constraint-4:\nThe production of product C must be at least twice the production of product A.\n// C >= 2 * A\n\n## Generate Constraint-5:\nThe production of product D must not exceed the combined production of products A and B.\n// D <= A + B",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the cost of raw materials and the time required for production. The selling price, raw material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Production Time |\n|---------|---------------|-------------------|-----------------|\n| A       | $50           | $20               | 1 hour          |\n| B       | $70           | $30               | 2 hours         |\n| C       | $90           | $40               | 3 hours         |\n| D       | $110          | $50               | 4 hours         |\n\nThe company has a budget of $10,000 for raw materials. The total production time cannot exceed 500 hours. The company must produce at least 50 units of product A and 30 units of product B. The production of product C must be at least twice the production of product A. The production of product D must not exceed the combined production of products A and B.\n\nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 10000)\n# The total production time cannot exceed 500 hours.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 500)\n# The company must produce at least 50 units of product A and 30 units of product B.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 30)\n# The production of product C must be at least twice the production of product A.\nmodel.addCons(C >= 2 * A)\n# The production of product D must not exceed the combined production of products A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"average daily mileage for trucks\": \"TruckMileage\", \"range\": \"TruckMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for vans\": \"VanMileage\", \"range\": \"VanMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for motorcycles\": \"MotorcycleMileage\", \"range\": \"MotorcycleMileage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost for trucks is $0.5 per mile, for vans is $0.3 per mile, and for motorcycles is $0.1 per mile. The company aims to minimize the total daily fuel cost.\n// FuelCost_Trucks = Trucks * TruckMileage * 0.5\n// FuelCost_Vans = Vans * VanMileage * 0.3\n// FuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 per day for vehicle maintenance and fuel.\n// 0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle. The fuel cost per mile for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.1. The company aims to minimize the total daily fuel cost.\n\n| Vehicle Type | Fuel Cost per Mile |\n|--------------|-------------------|\n| Trucks       | $0.5              |\n| Vans         | $0.3              |\n| Motorcycles  | $0.1              |\n\nThe company has a total budget of $1000 per day for vehicle maintenance and fuel. Please help the company determine the optimal number of each type of vehicle and their average daily mileage to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nTruckMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckMileage\", lb=0)  # average daily mileage for trucks\nVanMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"VanMileage\", lb=0)  # average daily mileage for vans\nMotorcycleMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"MotorcycleMileage\", lb=0)  # average daily mileage for motorcycles\n\n# Define objective function\nFuelCost_Trucks = Trucks * TruckMileage * 0.5\nFuelCost_Vans = Vans * VanMileage * 0.3\nFuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n# So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n# Add constraints\n# The company has a total budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Truck Mileage: \", model.getVal(TruckMileage))\n    print(\"Van Mileage: \", model.getVal(VanMileage))\n    print(\"Motorcycle Mileage: \", model.getVal(MotorcycleMileage))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours.\n// 10 * T + 8 * V + 2 * B <= 500",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h). The company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each. The company also has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours. Please help the company to maximize the total daily transport capacity in tons per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\n# So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n# The company has a total of 500 hours of driver work time available per day.\nmodel.addCons(10 * T + 8 * V + 2 * B <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\n// Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\n// Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed half of the total production.\n// UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC)\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30,000\n\n## Generate Constraint-4:\nTo maintain a diversified product line, at least one unit of each device must be produced each month.\n// UnitsA >= 1; UnitsB >= 1; UnitsC >= 1",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company has a monthly production capacity of 500 units in total. Due to market saturation, the production of DeviceA should not exceed half of the total production. The company has a budget of $30,000 for production costs per month. To maintain a diversified product line, at least one unit of each device must be produced each month. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with min function\n# DeviceA\nProfit_A = model.addVar(name=\"Profit_A\")\nmodel.addCons(Profit_A <= (100 - 50) * UnitsA)\nmodel.addCons(Profit_A <= (100 - 50) * (1000 - 5 * UnitsA))\n# DeviceB\nProfit_B = model.addVar(name=\"Profit_B\")\nmodel.addCons(Profit_B <= (120 - 70) * UnitsB)\nmodel.addCons(Profit_B <= (120 - 70) * (1500 - 10 * UnitsB))\n# DeviceC\nProfit_C = model.addVar(name=\"Profit_C\")\nmodel.addCons(Profit_C <= (150 - 80) * UnitsC)\nmodel.addCons(Profit_C <= (150 - 80) * (2000 - 15 * UnitsC))\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a monthly production capacity of 500 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n## Due to market saturation, the production of DeviceA should not exceed half of the total production.\nmodel.addCons(UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC))\n## The company has a budget of $30,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and delivery speed. \n- Truck 1 consumes 10 liters per trip and delivers in 2 hours.\n- Truck 2 consumes 12 liters per trip and delivers in 1.5 hours.\n- Truck 3 consumes 15 liters per trip and delivers in 1 hour.\n- Truck 4 consumes 18 liters per trip and delivers in 1.2 hours.\n- Truck 5 consumes 20 liters per trip and delivers in 0.8 hours.\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour.\n// Total fuel cost: FuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n// Total delay time: DelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\n// Total operational cost: OperationalCost = FuelCost + DelayTime * $50\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe total number of trips required across all trucks must be at least 100.\n// T1 + T2 + T3 + T4 + T5 >= 100\n\n## Generate Constraint-2:\nEach truck can make a maximum of 30 trips due to maintenance and driver availability.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500\n\n## Generate Constraint-4:\nThe total delivery time should not exceed 120 hours to maintain service quality.\n// 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5 <= 120",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes. The fuel consumption and delivery times for each truck are given in the following Table.\n\n| Truck | Fuel Consumption (liters/trip) | Delivery Time (hours/trip) |\n|-------|--------------------------------|----------------------------|\n| 1     | 10                             | 2                          |\n| 2     | 12                             | 1.5                        |\n| 3     | 15                             | 1                          |\n| 4     | 18                             | 1.2                        |\n| 5     | 20                             | 0.8                        |\n\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour. The total number of trips required across all trucks must be at least 100. Each truck can make a maximum of 30 trips due to maintenance and driver availability. The company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters. The total delivery time should not exceed 120 hours to maintain service quality.\n\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\nDelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\nOperationalCost = FuelCost + DelayTime * 50\n## the objective function is: Minimize OperationalCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The total number of trips required across all trucks must be at least 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 100)\n## Each truck can make a maximum of 30 trips due to maintenance and driver availability.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n## The company has a budget constraint for fuel, limiting the total fuel consumption to 1500 liters.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 <= 1500)\n## The total delivery time should not exceed 120 hours to maintain service quality.\nmodel.addCons(2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1448,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1500, on route 2 is $1800, on route 3 is $2000, on route 4 is $1900, and on route 5 is $2100. The company aims to maximize the total net revenue (revenue minus cost) from all routes.\n// Net_Revenue_1 = (1500 - 1000) * T1\n// Net_Revenue_2 = (1800 - 1200) * T2\n// Net_Revenue_3 = (2000 - 1500) * T3\n// Net_Revenue_4 = (1900 - 1300) * T4\n// Net_Revenue_5 = (2100 - 1400) * T5\n// So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1500, on route 2 is $1800, on route 3 is $2000, on route 4 is $1900, and on route 5 is $2100. The company aims to maximize the total net revenue (revenue minus cost) from all routes. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks. Please help the company to maximize the total net revenue from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nNet_Revenue_1 = (1500 - 1000) * T1\nNet_Revenue_2 = (1800 - 1200) * T2\nNet_Revenue_3 = (2000 - 1500) * T3\nNet_Revenue_4 = (1900 - 1300) * T4\nNet_Revenue_5 = (2100 - 1400) * T5\n# So, the objective function is: Maximize (Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Revenue_1 + Net_Revenue_2 + Net_Revenue_3 + Net_Revenue_4 + Net_Revenue_5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n# Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency of each truck type.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks (km/liter)\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n// Total fuel cost for Region A: Cost_A = (500 / FuelEfficiency) * TrucksA * 1.5\n// Total fuel cost for Region B: Cost_B = (500 / FuelEfficiency) * TrucksB * 1.5\n// Total fuel cost for Region C: Cost_C = (500 / FuelEfficiency) * TrucksC * 1.5\n// Total fuel cost for Region D: Cost_D = (500 / FuelEfficiency) * TrucksD * 1.5\n// Total fuel cost for Region E: Cost_E = (500 / FuelEfficiency) * TrucksE * 1.5\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, Region A must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency of each truck type. The cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost. The company has a total of 50 trucks available. Due to regional regulations, Region A must have at least 10% of the total trucks. Please help the company to determine the optimal allocation of trucks and the fuel efficiency to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Region C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for Region D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for Region E\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=0) # fuel efficiency of trucks (km/liter)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = (500 / FuelEfficiency) * TrucksA * 1.5\nCost_B = (500 / FuelEfficiency) * TrucksB * 1.5\nCost_C = (500 / FuelEfficiency) * TrucksC * 1.5\nCost_D = (500 / FuelEfficiency) * TrucksD * 1.5\nCost_E = (500 / FuelEfficiency) * TrucksE * 1.5\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## Due to regional regulations, Region A must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Region D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Region E: \", model.getVal(TrucksE))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n// Fuel cost per trip for TruckA: CostA = (50 - 0.02 * UpgradeA) * TripsA\n// Fuel cost per trip for TruckB: CostB = (60 - 0.03 * UpgradeB) * TripsB\n// Fuel cost per trip for TruckC: CostC = (70 - 0.04 * UpgradeC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for transportation and upgrades.\n// 50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2,000.\n// TripsA + TripsB + TripsC <= 2000\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n// TripsA >= 200; TripsB >= 300\n\n## Generate Constraint-4:\nThe investment in upgrades for any vehicle cannot exceed 20% of the total budget allocated for that vehicle's operations.\n// UpgradeA <= 0.2 * (50 * TripsA); UpgradeB <= 0.2 * (60 * TripsB); UpgradeC <= 0.2 * (70 * TripsC)",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter and how much to invest in fuel-efficient upgrades for each vehicle type to optimize its operations. The fuel cost per trip decreases with the investment in upgrades as shown in the following Table.\n\n| Vehicle | Fuel Cost per Trip without Upgrades | Reduction in Fuel Cost per $100 Invested |\n|---------|------------------------------------|-----------------------------------------|\n| TruckA  | 50$                                | $2                                      |\n| TruckB  | 60$                                | $3                                      |\n| TruckC  | 70$                                | $4                                      |\n\nThe company has a total budget of $30,000 for transportation and upgrades. The total number of trips across all vehicles must not exceed 2,000. Due to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300. The investment in upgrades for any vehicle cannot exceed 20% of the total budget allocated for that vehicle's operations.\n\nPlease help the company to minimize the total fuel cost for all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=200)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=300)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # investment in fuel-efficient upgrades for TruckA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # investment in fuel-efficient upgrades for TruckB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # investment in fuel-efficient upgrades for TruckC\n\n# Define objective function\nCostA = (50 - 0.02 * UpgradeA) * TripsA\nCostB = (60 - 0.03 * UpgradeB) * TripsB\nCostC = (70 - 0.04 * UpgradeC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $30,000 for transportation and upgrades.\nmodel.addCons(50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000)\n# The total number of trips across all vehicles must not exceed 2,000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n# Due to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\nmodel.addCons(TripsA >= 200)\nmodel.addCons(TripsB >= 300)\n# The investment in upgrades for any vehicle cannot exceed 20% of the total budget allocated for that vehicle's operations.\nmodel.addCons(UpgradeA <= 0.2 * (50 * TripsA))\nmodel.addCons(UpgradeB <= 0.2 * (60 * TripsB))\nmodel.addCons(UpgradeC <= 0.2 * (70 * TripsC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Upgrades for TruckA: \", model.getVal(UpgradeA))\n    print(\"Investment in Upgrades for TruckB: \", model.getVal(UpgradeB))\n    print(\"Investment in Upgrades for TruckC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Operating cost of A: CostA = 200 * TrucksA\n// Operating cost of B: CostB = 250 * TrucksB\n// Operating cost of C: CostC = 300 * TrucksC\n// Operating cost of D: CostD = 350 * TrucksD\n// Operating cost of E: CostE = 400 * TrucksE\n// Revenue of A: RevenueA = 500 * TrucksA\n// Revenue of B: RevenueB = 600 * TrucksB\n// Revenue of C: RevenueC = 700 * TrucksC\n// Revenue of D: RevenueD = 800 * TrucksD\n// Revenue of E: RevenueE = 900 * TrucksE\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000",
        "question": "A logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost. The company has a total budget of $10,000 for operating costs. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for route E\n\n# Define objective function\nCostA = 200 * TrucksA\nCostB = 250 * TrucksB\nCostC = 300 * TrucksC\nCostD = 350 * TrucksD\nCostE = 400 * TrucksE\nRevenueA = 500 * TrucksA\nRevenueB = 600 * TrucksB\nRevenueC = 700 * TrucksC\nRevenueD = 800 * TrucksD\nRevenueE = 900 * TrucksE\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n# Add constraints\n# The company has a total budget of $10,000 for operating costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product type to optimize its profit while considering the constraints of raw materials and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type for every 100 units produced beyond that threshold. The company aims to maximize the total profit from the sales of these products.\n// Profit_A = max(10 + 0.02 * (A - 100) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100) / 100, 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical raw material. Each unit of product A requires 2 kg of the raw material, product B requires 3 kg, and product C requires 4 kg. The total available raw material is 1000 kg.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. The demand limit for product A is 500 units, for product B is 400 units, and for product C is 300 units.\n// A <= 500; B <= 400; C <= 300\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 800 units in total.\n// A + B + C <= 800\n\n## Generate Constraint-4:\nTo ensure product quality, the production of product C must not exceed twice the production of product A.\n// C <= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product type to optimize its profit while considering the constraints of raw materials and market demand. The profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type for every 100 units produced beyond that threshold. The company has a limited supply of a critical raw material. Each unit of product A requires 2 kg of the raw material, product B requires 3 kg, and product C requires 4 kg. The total available raw material is 1000 kg. The market has a demand limit for each product. The demand limit for product A is 500 units, for product B is 400 units, and for product C is 300 units. The company has a production capacity limit of 800 units in total. To ensure product quality, the production of product C must not exceed twice the production of product A. Please help the company to maximize the total profit from the sales of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\nmodel.addCons(A + B + C <= 800)\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) for delivering goods. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting delivery requirements.\n// {\"number of Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and capacity. Truck1 has a fuel efficiency of 10 km/l and a capacity of 5 tons. Truck2 has a fuel efficiency of 15 km/l and a capacity of 10 tons. Truck3 has a fuel efficiency of 20 km/l and a capacity of 15 tons. Truck4 has a fuel efficiency of 25 km/l and a capacity of 20 tons. Truck5 has a fuel efficiency of 30 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are made.\n// Total fuel consumption: Fuel = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) * TotalDistance\n// Total capacity needed: Capacity = 5 * T1 + 10 * T2 + 15 * T3 + 20 * T4 + 25 * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the total delivery requirement of 1000 tons.\n// 5 * T1 + 10 * T2 + 15 * T3 + 20 * T4 + 25 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase a maximum of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of Truck1 and Truck2 combined must not exceed 30.\n// T1 + T2 <= 30",
        "question": "A logistics company operates a fleet of 5 different types of vehicles (Truck1, Truck2, Truck3, Truck4, Truck5) for delivering goods. Each type of truck has different fuel efficiency and capacity. Truck1 has a fuel efficiency of 10 km/l and a capacity of 5 tons. Truck2 has a fuel efficiency of 15 km/l and a capacity of 10 tons. Truck3 has a fuel efficiency of 20 km/l and a capacity of 15 tons. Truck4 has a fuel efficiency of 25 km/l and a capacity of 20 tons. Truck5 has a fuel efficiency of 30 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are made. The total capacity of all trucks must meet or exceed the total delivery requirement of 1000 tons. The company has a budget to purchase a maximum of 50 trucks in total. The number of Truck1 and Truck2 combined must not exceed 30. Please help the company determine the optimal number of each type of vehicle to maximize efficiency while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of Truck5\n\n# Define objective function\n## Total fuel consumption: Fuel = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) * TotalDistance\n## Assuming TotalDistance is a constant, we can directly minimize the fuel consumption\nFuel = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel)\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the total delivery requirement of 1000 tons.\nmodel.addCons(5 * T1 + 10 * T2 + 15 * T3 + 20 * T4 + 25 * T5 >= 1000)\n## The company has a budget to purchase a maximum of 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of Truck1 and Truck2 combined must not exceed 30.\nmodel.addCons(T1 + T2 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(T1))\n    print(\"Number of Truck2: \", model.getVal(T2))\n    print(\"Number of Truck3: \", model.getVal(T3))\n    print(\"Number of Truck4: \", model.getVal(T4))\n    print(\"Number of Truck5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&DInvestment\", \"range\": \"R&DInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of ProductA is initially $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The market price of ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. For every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products cannot exceed $50,000 per month.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe total investment in R&D cannot exceed $100,000 per month.\n// R&DInvestment <= 100000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 200 units of ProductA and 150 units of ProductB.\n// QuantityA >= 200; QuantityB >= 150",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality and reduce production costs. The production costs and market prices of the products are affected by the R&D investment. The initial production costs and market prices for each product are given in the following Table.\n\n| Product | Initial Production Cost | Market Price |\n|---------|-------------------------|--------------|\n| ProductA | $100 per unit          | $150 per unit|\n| ProductB | $150 per unit          | $200 per unit|\n| ProductC | $200 per unit          | $250 per unit|\n\nFor every $10,000 invested in R&D, the production cost of each product decreases by $5 per unit. The marketing budget increases the sales of each product linearly. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units per month. The total marketing budget for all products cannot exceed $50,000 per month. The total investment in R&D cannot exceed $100,000 per month. Due to market demand, the company must produce at least 200 units of ProductA and 150 units of ProductB.\n\nPlease help the company determine the optimal production quantities, marketing budgets, and R&D investment to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=150)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)     # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nR_DInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"R&DInvestment\", lb=0)  # investment in R&D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * R&DInvestment)) * QuantityA - MarketingA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * R&DInvestment)) * QuantityB - MarketingB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * R&DInvestment)) * QuantityC - MarketingC\nProfitA = (150 - (100 - 0.0005 * R_DInvestment)) * QuantityA - MarketingA\nProfitB = (200 - (150 - 0.0005 * R_DInvestment)) * QuantityB - MarketingB\nProfitC = (250 - (200 - 0.0005 * R_DInvestment)) * QuantityC - MarketingC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n## The total marketing budget for all products cannot exceed $50,000 per month.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n## The total investment in R&D cannot exceed $100,000 per month.\nmodel.addCons(R_DInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Investment in R&D: \", model.getVal(R_DInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1444,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the amount of fuel to be used per truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Route1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Route2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Route3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of the logistics company is influenced by the number of trucks and their fuel consumption rates. The cost of fuel per liter is $1.5, and the cost of operating a truck per route is $100. The company aims to minimize the total operational cost, which includes fuel and truck operation costs.\n// Operational cost for Route1: Cost1 = (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1)\n// Operational cost for Route2: Cost2 = (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2)\n// Operational cost for Route3: Cost3 = (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for operational costs is $10,000.\n// (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1) + (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2) + (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3) <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the amount of fuel to be used per truck. The operational cost of the logistics company is influenced by the number of trucks and their fuel consumption rates. The cost of fuel per liter is $1.5, and the cost of operating a truck per route is $100. The company aims to minimize the total operational cost, which includes fuel and truck operation costs.\n\n| Route | Cost of Operating a Truck | Fuel Cost per Liter |\n|-------|---------------------------|---------------------|\n| Route1 | $100                     | $1.5                |\n| Route2 | $100                     | $1.5                |\n| Route3 | $100                     | $1.5                |\n\nThe total budget for operational costs is $10,000. The total number of trucks available is limited to 50. Please help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0) # fuel consumption rate for Route1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0) # fuel consumption rate for Route2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0) # fuel consumption rate for Route3\n\n# Define objective function\nCost1 = (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1)\nCost2 = (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2)\nCost3 = (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons((100 * Trucks1) + (1.5 * FuelRate1 * Trucks1) + (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2) + (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3) <= 10000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Consumption Rate for Route1: \", model.getVal(FuelRate1))\n    print(\"Fuel Consumption Rate for Route2: \", model.getVal(FuelRate2))\n    print(\"Fuel Consumption Rate for Route3: \", model.getVal(FuelRate3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device for the next month. Additionally, the company must determine the number of hours to allocate for maintenance of each device's production line.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for DeviceA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceD\": \"MD\", \"range\": \"MD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. The cost of maintenance per hour for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, and for DeviceD is $50. The company aims to maximize the total profit minus the total maintenance cost.\n// Profit from DeviceA: Profit_A = 50 * A - 20 * MA\n// Profit from DeviceB: Profit_B = 70 * B - 30 * MB\n// Profit from DeviceC: Profit_C = 90 * C - 40 * MC\n// Profit from DeviceD: Profit_D = 110 * D - 50 * MD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe total maintenance hours available for all devices is 100 hours.\n// MA + MB + MC + MD <= 100\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 500 units for DeviceA, 400 units for DeviceB, 300 units for DeviceC, and 200 units for DeviceD.\n// A <= 500; B <= 400; C <= 300; D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10 units of each device are produced.\n// A >= 10; B >= 10; C >= 10; D >= 10",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device and the number of hours to allocate for maintenance of each device's production line for the next month. The profit per unit and the cost of maintenance per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Maintenance Cost per Hour |\n|--------|-----------------|---------------------------|\n| DeviceA | $50             | $20                       |\n| DeviceB | $70             | $30                       |\n| DeviceC | $90             | $40                       |\n| DeviceD | $110            | $50                       |\n\nThe company aims to maximize the total profit minus the total maintenance cost. The total maintenance hours available for all devices is 100 hours. The company has a production capacity limit of 500 units for DeviceA, 400 units for DeviceB, 300 units for DeviceC, and 200 units for DeviceD. The company wants to ensure that at least 10 units of each device are produced.\n\nPlease help the company determine the optimal production quantity for each device and the number of maintenance hours to allocate to maximize the total profit minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=500) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=400) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10, ub=300) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10, ub=200) # number of units of DeviceD\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # maintenance hours for DeviceA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # maintenance hours for DeviceB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # maintenance hours for DeviceC\nMD = model.addVar(vtype=\"CONTINUOUS\", name=\"MD\", lb=0) # maintenance hours for DeviceD\n\n# Define objective function\nProfit_A = 50 * A - 20 * MA\nProfit_B = 70 * B - 30 * MB\nProfit_C = 90 * C - 40 * MC\nProfit_D = 110 * D - 50 * MD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The total maintenance hours available for all devices is 100 hours.\nmodel.addCons(MA + MB + MC + MD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maintenance hours for DeviceA: \", model.getVal(MA))\n    print(\"Maintenance hours for DeviceB: \", model.getVal(MB))\n    print(\"Maintenance hours for DeviceC: \", model.getVal(MC))\n    print(\"Maintenance hours for DeviceD: \", model.getVal(MD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations.\n// {\"number of trucks allocated to region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in region A is $500 per day, with a delivery efficiency of 10 deliveries per day.\nIn region B, the cost is $600 per day, with an efficiency of 12 deliveries per day.\nIn region C, the cost is $700 per day, with an efficiency of 14 deliveries per day.\nIn region D, the cost is $800 per day, with an efficiency of 16 deliveries per day.\nIn region E, the cost is $900 per day, with an efficiency of 18 deliveries per day.\nThe company aims to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).\n// Total operating cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Total number of deliveries: Deliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n// So, the objective function is: Minimize Cost / Deliveries\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operating costs.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000\n\n## Generate Constraint-2:\nThe company must ensure that at least 100 deliveries are made each day.\n// 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100\n\n## Generate Constraint-3:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C.\n// TruckA <= TruckB + TruckC\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\n// TruckE <= TruckA + TruckB + TruckC + TruckD",
        "question": "A logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations. The cost of operating a truck and the delivery efficiency for each region are given in the following Table.\n\n| Region | Operating Cost per Truck per Day | Delivery Efficiency per Truck per Day |\n|--------|----------------------------------|---------------------------------------|\n| A      | $500                             | 10 deliveries                         |\n| B      | $600                             | 12 deliveries                         |\n| C      | $700                             | 14 deliveries                         |\n| D      | $800                             | 16 deliveries                         |\n| E      | $900                             | 18 deliveries                         |\n\nThe company has a budget of $10,000 per day for operating costs. The company must ensure that at least 100 deliveries are made each day. The company can allocate a maximum of 20 trucks in total across all regions. The company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C. The company also wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\n\nPlease help the company to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nDeliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n## the objective function is: Minimize Cost / Deliveries\n## convert the division to multiplication\nmodel.addCons(obj * Deliveries == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for operating costs.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000)\n## The company must ensure that at least 100 deliveries are made each day.\nmodel.addCons(10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 20)\n## The company wants to ensure that the number of trucks in region A does not exceed the combined number of trucks in regions B and C.\nmodel.addCons(TruckA <= TruckB + TruckC)\n## The company wants to ensure that the number of trucks in region E does not exceed the combined number of trucks in regions A, B, C, and D.\nmodel.addCons(TruckE <= TruckA + TruckB + TruckC + TruckD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Minimized Cost-Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1544,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000\n\n## Generate Constraint-2:\nThe total production hours available in the Testing department is 800 hours.\n// TestingHours <= 800",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production. The total production hours available in the Assembly department is 1000 hours, and the total production hours available in the Testing department is 800 hours.\nPlease help the company to determine the optimal number of units to produce for each device and the number of hours to allocate for production in each department to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0) # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0) # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0) # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(AssemblyHours <= 1000)\nmodel.addCons(TestingHours <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the production time per unit and increases the quality of the product, which in turn increases the selling price per unit. The company aims to maximize its total revenue while considering various operational and financial constraints.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in advanced machinery for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe advanced machinery reduces the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The selling price per unit increases by $5 for every $1000 invested in advanced machinery. The initial selling price per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (50 + 0.005 * InvestmentA) * QuantityA\n// Total revenue for ProductB: RevenueB = (60 + 0.005 * InvestmentB) * QuantityB\n// Total revenue for ProductC: RevenueC = (70 + 0.005 * InvestmentC) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $50,000.\n// InvestmentA + InvestmentB + InvestmentC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n// WorkersA >= 30; WorkersB >= 40",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the production time per unit by 0.1 hours for every $1000 invested and increases the selling price per unit by $5 for every $1000 invested. The initial production time per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The initial selling price per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The company aims to maximize the total revenue from all products.\n\nThe company has a total of 100 workers available. The total capital investment in advanced machinery cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n\nPlease help the company to maximize its total revenue while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0) # capital investment in advanced machinery for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0) # capital investment in advanced machinery for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0) # capital investment in advanced machinery for ProductC\n\n# Define objective function\nRevenueA = (50 + 0.005 * InvestmentA) * QuantityA\nRevenueB = (60 + 0.005 * InvestmentB) * QuantityB\nRevenueC = (70 + 0.005 * InvestmentC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 50000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\nmodel.addCons(WorkersA >= 30)\nmodel.addCons(WorkersB >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Advanced Machinery for ProductA: \", model.getVal(InvestmentA))\n    print(\"Capital Investment in Advanced Machinery for ProductB: \", model.getVal(InvestmentB))\n    print(\"Capital Investment in Advanced Machinery for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is 5$, for B it is 7$, for C it is 9$, for D it is 11$, and for E it is 13$. The company aims to minimize the total shipping cost while maintaining a certain profit margin. The profit margin is defined as the difference between the selling price and the shipping cost per unit. The selling price for each product is 10$ for A, 15$ for B, 20$ for C, 25$ for D, and 30$ for E. The objective is to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price.\n// Shipping cost of A: Cost_A = 5 * A\n// Shipping cost of B: Cost_B = 7 * B\n// Shipping cost of C: Cost_C = 9 * C\n// Shipping cost of D: Cost_D = 11 * D\n// Shipping cost of E: Cost_E = 13 * E\n// Profit margin of A: Profit_A = (10 - 5) * A\n// Profit margin of B: Profit_B = (15 - 7) * B\n// Profit margin of C: Profit_C = (20 - 9) * C\n// Profit margin of D: Profit_D = (25 - 11) * D\n// Profit margin of E: Profit_E = (30 - 13) * E\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for shipping costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company must ship at least 20 units of each product to meet customer demands.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe total profit margin must be at least 20% of the total selling price.\n// (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-4:\nThe company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints. The cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is $5, for B it is $7, for C it is $9, for D it is $11, and for E it is $13$. The selling price for each product is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to minimize the total shipping cost while maintaining a certain profit margin, which is defined as the difference between the selling price and the shipping cost per unit, and ensuring a profit margin of at least 20% of the selling price. The company has a budget of $1500 for shipping costs. The company must ship at least 20 units of each product to meet customer demands. The total profit margin must be at least 20% of the total selling price. The company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D. Please help the company to minimize the total shipping cost while meeting these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ship at least 20 units of each product to meet customer demands.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## Shipping cost of A: Cost_A = 5 * A\n## Shipping cost of B: Cost_B = 7 * B\n## Shipping cost of C: Cost_C = 9 * C\n## Shipping cost of D: Cost_D = 11 * D\n## Shipping cost of E: Cost_E = 13 * E\nCost_A = 5 * A\nCost_B = 7 * B\nCost_C = 9 * C\nCost_D = 11 * D\nCost_E = 13 * E\n## Profit margin of A: Profit_A = (10 - 5) * A\n## Profit margin of B: Profit_B = (15 - 7) * B\n## Profit margin of C: Profit_C = (20 - 9) * C\n## Profit margin of D: Profit_D = (25 - 11) * D\n## Profit margin of E: Profit_E = (30 - 13) * E\nProfit_A = (10 - 5) * A\nProfit_B = (15 - 7) * B\nProfit_C = (20 - 9) * C\nProfit_D = (25 - 11) * D\nProfit_E = (30 - 13) * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $1500 for shipping costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The total profit margin must be at least 20% of the total selling price.\nmodel.addCons((10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n## The company wants to ensure that the total units of product E shipped does not exceed the combined units of products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Minimized Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital invested in automation\": \"AutomationCapital\", \"range\": \"AutomationCapital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for the production of all products.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital available for investment in automation is $100,000.\n// AutomationCapital <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\n// QuantityA <= 500; QuantityB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n// WorkersA >= 20; WorkersB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested. The production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Initial Production Cost |\n|---------|---------------|-------------------------|\n| ProductA | 150$          | 100$                    |\n| ProductB | 200$          | 150$                    |\n| ProductC | 250$          | 200$                    |\n\nThe company has a total of 100 workers available for the production of all products. The total capital available for investment in automation is $100,000. Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units. The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationCapital\", lb=0)  # capital invested in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA +\n                (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB +\n                (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC)\n\n# Add constraints\n## The company has a total of 100 workers available for the production of all products.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital available for investment in automation is $100,000.\nmodel.addCons(AutomationCapital <= 100000)\n## Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 400)\n## The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\nmodel.addCons(WorkersA >= 20)\nmodel.addCons(WorkersB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Invested in Automation: \", model.getVal(AutomationCapital))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1478,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company aims to maximize the total carrying capacity while minimizing the total daily operational cost.\n// Objective function: Maximize (1000 * Trucks + 500 * Vans + 100 * Bikes) / (500 * Trucks + 300 * Vans + 100 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle operations.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 15000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 50,000 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 vehicles in total.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-4:\nThe number of Trucks must not exceed the combined number of Vans and Bikes.\n// Trucks <= Vans + Bikes\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles.\n// Bikes <= 0.2 * (Trucks + Vans + Bikes)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations. Each Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company has a budget of $15,000 per month for vehicle operations. The total carrying capacity must be at least 50,000 kg. The company can only operate a maximum of 50 vehicles in total. The number of Trucks must not exceed the combined number of Vans and Bikes. The company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles. Please help the company to maximize the total carrying capacity while minimizing the total daily operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCarryingCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes\nOperationalCost = 500 * Trucks + 300 * Vans + 100 * Bikes\n## the objective function is: Maximize (CarryingCapacity) / (OperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * OperationalCost == CarryingCapacity)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle operations.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 15000)\n## The total carrying capacity must be at least 50,000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000)\n## The company can only operate a maximum of 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n## The number of Trucks must not exceed the combined number of Vans and Bikes.\nmodel.addCons(Trucks <= Vans + Bikes)\n## The company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles.\nmodel.addCons(Bikes <= 0.2 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Carrying Capacity per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route 1 has a cost of $2 per mile and an average speed of 50 mph. Route 2 has a cost of $3 per mile and an average speed of 45 mph. Route 3 has a cost of $4 per mile and an average speed of 40 mph. Route 4 has a cost of $5 per mile and an average speed of 35 mph. Route 5 has a cost of $6 per mile and an average speed of 30 mph. The company aims to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed a certain threshold.\n// Cost of route 1: C1 = 2 * T1\n// Cost of route 2: C2 = 3 * T2\n// Cost of route 3: C3 = 4 * T3\n// Cost of route 4: C4 = 5 * T4\n// Cost of route 5: C5 = 6 * T5\n// Total delivery time: T_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n// So, the objective function is: Minimize (C1 + C2 + C3 + C4 + C5) + (T_total * 100)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different average speed. Route 1 has a cost of $2 per mile and an average speed of 50 mph. Route 2 has a cost of $3 per mile and an average speed of 45 mph. Route 3 has a cost of $4 per mile and an average speed of 40 mph. Route 4 has a cost of $5 per mile and an average speed of 35 mph. Route 5 has a cost of $6 per mile and an average speed of 30 mph. The company aims to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed a certain threshold. The company has a budget of $1000 for operational costs. The total number of trucks available is 50. Please help the company to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed the specified threshold.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 2 * T1\nC2 = 3 * T2\nC3 = 4 * T3\nC4 = 5 * T4\nC5 = 6 * T5\nT_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n## convert the division to multiplication\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5 + T_total * 100)\n\n# Add constraints\n## The company has a budget of $1000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor costs.\n// LaborA * ProductA + LaborB * ProductB + LaborC * ProductC <= 5000\n\n## Generate Constraint-3:\nThe total storage space for all products is limited to 200 cubic meters. Product A requires 1 cubic meter per unit, product B requires 2 cubic meters per unit, and product C requires 3 cubic meters per unit.\n// ProductA + 2 * ProductB + 3 * ProductC <= 200\n\n## Generate Constraint-4:\nThe company can produce at most 150 units of product A, 100 units of product B, and 200 units of product C.\n// ProductA <= 150\n// ProductB <= 100\n// ProductC <= 200\n\n## Generate Constraint-5:\nThe company aims to produce at least 50 units of product A, 30 units of product B, and 50 units of product C.\n// ProductA >= 50\n// ProductB >= 30\n// ProductC >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $10,000 for raw materials and $5,000 for labor costs. The total storage space for all products is limited to 200 cubic meters, with product A requiring 1 cubic meter per unit, product B requiring 2 cubic meters per unit, and product C requiring 3 cubic meters per unit. The company can produce at most 150 units of product A, 100 units of product B, and 200 units of product C. Additionally, the company aims to produce at least 50 units of product A, 30 units of product B, and 50 units of product C. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50, ub=150) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=30, ub=100) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50, ub=200) # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n# The company has a budget of $5,000 for labor costs.\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 5000)\n# The total storage space for all products is limited to 200 cubic meters.\nmodel.addCons(ProductA + 2 * ProductB + 3 * ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit. The profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\n// Total profit for Route1: Profit1 = (1000 + 0.2 * Upgrade1) * Trucks1\n// Total profit for Route2: Profit2 = (1200 + 0.24 * Upgrade2) * Trucks2\n// Total profit for Route3: Profit3 = (900 + 0.18 * Upgrade3) * Trucks3\n// Additional profit from advertising: AdvertisingProfit = 5 * Advertising\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n## Generate Constraint-1:\nThe total budget for trucks, upgrades, and advertising is $100,000.\n// Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000\n\n## Generate Constraint-2:\nThe maximum number of trucks that can be deployed across all routes is 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of trucks on Route1 must not exceed 50% of the total trucks.\n// Trucks1 <= 0.5 * (Trucks1 + Trucks2 + Trucks3)\n\n## Generate Constraint-4:\nThe minimum number of trucks required on Route2 is 30.\n// Trucks2 >= 30",
        "question": "A logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\nThe profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\nThe total budget for trucks, upgrades, and advertising is $100,000. The maximum number of trucks that can be deployed across all routes is 200. Due to maintenance constraints, the number of trucks on Route1 must not exceed 50% of the total trucks. The minimum number of trucks required on Route2 is 30.\nPlease help the company to maximize its quarterly profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\n\n# Define objective function\nProfit1 = (1000 + 0.2 * Upgrade1) * Trucks1\nProfit2 = (1200 + 0.24 * Upgrade2) * Trucks2\nProfit3 = (900 + 0.18 * Upgrade3) * Trucks3\nAdvertisingProfit = 5 * Advertising\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\nmodel.addCons(Trucks1 <= 0.5 * (Trucks1 + Trucks2 + Trucks3))\nmodel.addCons(Trucks2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine should be operated in the testing phase.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine A is tested\": \"TestHoursA\", \"range\": \"TestHoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours machine B is tested\": \"TestHoursB\", \"range\": \"TestHoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours machine C is tested\": \"TestHoursC\", \"range\": \"TestHoursC >= 0\", \"type\": \"real\"}\n// {\"number of hours machine D is tested\": \"TestHoursD\", \"range\": \"TestHoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the production cost is $3000, and the testing cost per hour is $50.\nFor machine B, the selling price is $7000, the production cost is $4000, and the testing cost per hour is $70.\nFor machine C, the selling price is $9000, the production cost is $5000, and the testing cost per hour is $90.\nFor machine D, the selling price is $11000, the production cost is $6000, and the testing cost per hour is $110.\nThe company aims to maximize the total profit, which is the sum of the selling profits minus the testing costs.\n// Profit from A: Profit_A = (5000 - 3000) * A - 50 * TestHoursA\n// Profit from B: Profit_B = (7000 - 4000) * B - 70 * TestHoursB\n// Profit from C: Profit_C = (9000 - 5000) * C - 90 * TestHoursC\n// Profit from D: Profit_D = (11000 - 6000) * D - 110 * TestHoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for production costs next month.\n// 3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000\n\n## Generate Constraint-2:\nThe total testing hours available next month are limited to 1000 hours.\n// TestHoursA + TestHoursB + TestHoursC + TestHoursD <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10 units of each machine are produced next month.\n// A >= 10; B >= 10; C >= 10; D >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\n// TestHoursC >= 2 * TestHoursA",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine should be operated in the testing phase. The selling price, production cost, and testing cost per hour for each machine are given in the following Table.\n\n| Machine | Selling Price | Production Cost | Testing Cost per Hour |\n|---------|---------------|-----------------|-----------------------|\n| A       | $5000         | $3000           | $50                   |\n| B       | $7000         | $4000           | $70                   |\n| C       | $9000         | $5000           | $90                   |\n| D       | $11000        | $6000           | $110                  |\n\nThe company has a total budget of $150,000 for production costs next month. The total testing hours available next month are limited to 1000 hours. The company wants to ensure that at least 10 units of each machine are produced next month. The company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C. Additionally, the company wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\n\nPlease help the company to maximize the total profit, which is the sum of the selling profits minus the testing costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of machine D\nTestHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursA\", lb=0) # number of hours machine A is tested\nTestHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursB\", lb=0) # number of hours machine B is tested\nTestHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursC\", lb=0) # number of hours machine C is tested\nTestHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursD\", lb=0) # number of hours machine D is tested\n\n# Define objective function\nProfit_A = (5000 - 3000) * A - 50 * TestHoursA\nProfit_B = (7000 - 4000) * B - 70 * TestHoursB\nProfit_C = (9000 - 5000) * C - 90 * TestHoursC\nProfit_D = (11000 - 6000) * D - 110 * TestHoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for production costs next month.\nmodel.addCons(3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000)\n# The total testing hours available next month are limited to 1000 hours.\nmodel.addCons(TestHoursA + TestHoursB + TestHoursC + TestHoursD <= 1000)\n# The company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C.\nmodel.addCons(D <= A + B + C)\n# The company wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\nmodel.addCons(TestHoursC >= 2 * TestHoursA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Test Hours for Machine A: \", model.getVal(TestHoursA))\n    print(\"Test Hours for Machine B: \", model.getVal(TestHoursB))\n    print(\"Test Hours for Machine C: \", model.getVal(TestHoursC))\n    print(\"Test Hours for Machine D: \", model.getVal(TestHoursD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1392,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location1, Location2, Location3, Location4, Location5) where these installations can be made.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local climate conditions. Similarly, the efficiency of wind turbines depends on wind patterns.\nFor Location1, the efficiency of solar panels is 15%, the cost per panel is $500, and the maintenance cost is $50 per panel annually.\nFor Location2, the efficiency is 20%, the cost is $600, and the maintenance cost is $60 per panel annually.\nFor Location3, the efficiency is 10%, the cost is $400, and the maintenance cost is $40 per panel annually.\nFor Location4, the efficiency of wind turbines is 25%, the cost per turbine is $1000, and the maintenance cost is $100 per turbine annually.\nFor Location5, the efficiency is 30%, the cost is $1200, and the maintenance cost is $120 per turbine annually.\nThe company wants to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n// Total energy generated: Energy = 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5\n// Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the initial investment.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000\n\n## Generate Constraint-2:\nThe company aims to generate at least 10,000 kWh of energy annually.\n// 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5 >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 30% of the budget is spent on solar panels.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 >= 0.3 * (500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations (Location1, Location2, Location3, Location4, Location5). The efficiency, cost per unit, and annual maintenance cost for each type of installation are given in the following Table.\n\n| Location | Type       | Efficiency | Cost per Unit | Annual Maintenance Cost |\n|----------|------------|------------|---------------|-------------------------|\n| Location1| Solar Panel| 15%        | $500          | $50 per panel           |\n| Location2| Solar Panel| 20%        | $600          | $60 per panel           |\n| Location3| Solar Panel| 10%        | $400          | $40 per panel           |\n| Location4| Wind Turbine| 25% | $1000        | $100 per turbine        |\n| Location5| Wind Turbine| 30% | $1200        | $120 per turbine        |\n\nThe company has a budget of $50,000 for the initial investment. The company aims to generate at least 10,000 kWh of energy annually. The company wants to ensure that at least 30% of the budget is spent on solar panels. \nPlease help the company to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at Location4\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\nCost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the initial investment.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000)\n## The company aims to generate at least 10,000 kWh of energy annually.\nmodel.addCons(0.15 * 500 * Solar1 + 0.20 * 600 * Solar2 + 0.10 * 400 * Solar3 + 0.25 * 1000 * Wind4 + 0.30 * 1200 * Wind5 >= 10000)\n## The company wants to ensure that at least 30% of the budget is spent on solar panels.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 >= 0.3 * (500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location4: \", model.getVal(Wind4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind5))\n    print(\"Minimized Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n// Fuel cost per trip for TruckA: CostA = (50 - 0.02 * UpgradeA) * TripsA\n// Fuel cost per trip for TruckB: CostB = (60 - 0.03 * UpgradeB) * TripsB\n// Fuel cost per trip for TruckC: CostC = (70 - 0.04 * UpgradeC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for transportation and upgrades.\n// 50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n\n| Vehicle | Fuel Cost per Trip without Upgrades | Cost Reduction per $100 Invested |\n|---------|------------------------------------|----------------------------------|\n| TruckA  | 50$                                | $2                               |\n| TruckB  | 60$                                | $3                               |\n| TruckC  | 70$                                | $4                               |\n\nThe company has a total budget of $30,000 for transportation and upgrades. Please help the company determine the optimal number of trips for each vehicle and the amount to invest in fuel-efficient upgrades to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nUpgradeA = model.addVar(name=\"UpgradeA\", lb=0) # investment in fuel-efficient upgrades for TruckA\nUpgradeB = model.addVar(name=\"UpgradeB\", lb=0) # investment in fuel-efficient upgrades for TruckB\nUpgradeC = model.addVar(name=\"UpgradeC\", lb=0) # investment in fuel-efficient upgrades for TruckC\n\n# Define objective function\nCostA = (50 - 0.02 * UpgradeA) * TripsA\nCostB = (60 - 0.03 * UpgradeB) * TripsB\nCostC = (70 - 0.04 * UpgradeC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $30,000 for transportation and upgrades.\nmodel.addCons(50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Investment in Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Investment in Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1304,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000\n\n## Generate Constraint-2:\nThe maintenance budget for the year is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones <= 500,000",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs, capacities, and maintenance costs. The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost | Capacity | Maintenance Cost |\n|--------------|------------------|----------|-----------------|\n| Trucks       | $50,000          | 1000 units | $10,000         |\n| Vans         | $30,000          | 500 units  | $5,000          |\n| Bikes        | $5,000           | 100 units  | $1,000          |\n| Scooters     | $3,000           | 50 units   | $500            |\n| Drones       | $10,000          | 200 units  | $2,000          |\n\nThe company has a budget of $2,000,000 for purchasing vehicles and a maintenance budget of $500,000 for the year. The company wants to minimize the total operational and maintenance costs while maximizing the total capacity. Please help the company determine the optimal number of each type of vehicle to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=0)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n## The maintenance budget for the year is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day.\n// Fuel_Consumption_Small = 1000 / 10 * SmallTrucks\n// Fuel_Consumption_Medium = 1000 / 15 * MediumTrucks\n// Fuel_Consumption_Large = 1000 / 20 * LargeTrucks\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 per day for fuel expenses.\n// (1000 / 10 * SmallTrucks * Fuel_Cost_Small) + (1000 / 15 * MediumTrucks * Fuel_Cost_Medium) + (1000 / 20 * LargeTrucks * Fuel_Cost_Large) <= 50000\n\n## Generate Constraint-2:\nThe total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters.\n// (Capacity_Small * SmallTrucks) + (Capacity_Medium * MediumTrucks) + (Capacity_Large * LargeTrucks) >= 10000\n\n## Generate Constraint-3:\nThe company can only afford to operate a maximum of 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50\n\n## Generate Constraint-4:\nThe number of large trucks must not exceed 30% of the total number of trucks.\n// LargeTrucks <= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands. The fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day. The company has a total budget of $50,000 per day for fuel expenses. The total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters. The company can only afford to operate a maximum of 50 trucks in total. The number of large trucks must not exceed 30% of the total number of trucks. Please help the company to determine the optimal number of each type of truck to maximize fuel efficiency while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\nFuel_Consumption_Small = (1000 / 10) * SmallTrucks\nFuel_Consumption_Medium = (1000 / 15) * MediumTrucks\nFuel_Consumption_Large = (1000 / 20) * LargeTrucks\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n# Add constraints\n# Constraint-1: Total budget of $50,000 per day for fuel expenses\nFuel_Cost_Small = 1  # Assuming fuel cost per liter for small trucks\nFuel_Cost_Medium = 1  # Assuming fuel cost per liter for medium trucks\nFuel_Cost_Large = 1  # Assuming fuel cost per liter for large trucks\nmodel.addCons((Fuel_Consumption_Small * Fuel_Cost_Small) + (Fuel_Consumption_Medium * Fuel_Cost_Medium) + (Fuel_Consumption_Large * Fuel_Cost_Large) <= 50000)\n\n# Constraint-2: Total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters\nCapacity_Small = 100  # Assuming capacity of small trucks in cubic meters\nCapacity_Medium = 200  # Assuming capacity of medium trucks in cubic meters\nCapacity_Large = 300  # Assuming capacity of large trucks in cubic meters\nmodel.addCons((Capacity_Small * SmallTrucks) + (Capacity_Medium * MediumTrucks) + (Capacity_Large * LargeTrucks) >= 10000)\n\n# Constraint-3: The company can only afford to operate a maximum of 50 trucks in total\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n\n# Constraint-4: The number of large trucks must not exceed 30% of the total number of trucks\nmodel.addCons(LargeTrucks <= 0.3 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. The company needs to determine the number of trips each type of truck should make to optimize their operations.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and cargo capacity. Truck A has a fuel efficiency of 10 km/l and can carry 10 tons. Truck B has a fuel efficiency of 12 km/l and can carry 12 tons. Truck C has a fuel efficiency of 15 km/l and can carry 15 tons. Truck D has a fuel efficiency of 18 km/l and can carry 18 tons. Truck E has a fuel efficiency of 20 km/l and can carry 20 tons. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Fuel consumption for A: Fuel_A = 1000 / 10 * A\n// Fuel consumption for B: Fuel_B = 1000 / 12 * B\n// Fuel consumption for C: Fuel_C = 1000 / 15 * C\n// Fuel consumption for D: Fuel_D = 1000 / 18 * D\n// Fuel consumption for E: Fuel_E = 1000 / 20 * E\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 12 * B\n// Cargo carried by C: Cargo_C = 15 * C\n// Cargo carried by D: Cargo_D = 18 * D\n// Cargo carried by E: Cargo_E = 20 * E\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 liters of fuel available for the week.\n// 1000 / 10 * A + 1000 / 12 * B + 1000 / 15 * C + 1000 / 18 * D + 1000 / 20 * E <= 10000",
        "question": "A logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. The company needs to determine the number of trips each type of truck should make to optimize their operations. Each truck type has a different fuel efficiency and cargo capacity. Truck A has a fuel efficiency of 10 km/l and can carry 10 tons. Truck B has a fuel efficiency of 12 km/l and can carry 12 tons. Truck C has a fuel efficiency of 15 km/l and can carry 15 tons. Truck D has a fuel efficiency of 18 km/l and can carry 18 tons. Truck E has a fuel efficiency of 20 km/l and can carry 20 tons. The company aims to maximize the total cargo carried per liter of fuel consumed. The company has a total of 10,000 liters of fuel available for the week.\n\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuel_A = 1000 / 10 * A\nFuel_B = 1000 / 12 * B\nFuel_C = 1000 / 15 * C\nFuel_D = 1000 / 18 * D\nFuel_E = 1000 / 20 * E\nCargo_A = 10 * A\nCargo_B = 12 * B\nCargo_C = 15 * C\nCargo_D = 18 * D\nCargo_E = 20 * E\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cargo_A + Cargo_B + Cargo_C + Cargo_D + Cargo_E)\n\n# Add constraints\n## The company has a total of 10,000 liters of fuel available for the week.\nmodel.addCons(1000 / 10 * A + 1000 / 12 * B + 1000 / 15 * C + 1000 / 18 * D + 1000 / 20 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck A: \", model.getVal(A))\n    print(\"Number of trips for truck B: \", model.getVal(B))\n    print(\"Number of trips for truck C: \", model.getVal(C))\n    print(\"Number of trips for truck D: \", model.getVal(D))\n    print(\"Number of trips for truck E: \", model.getVal(E))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption.\n// {\"number of Compact vehicles\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan vehicles\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of SUV vehicles\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Truck vehicles\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type varies. Compact vehicles consume 10 liters per 100 km, Sedans consume 12 liters per 100 km, SUVs consume 15 liters per 100 km, Vans consume 20 liters per 100 km, and Trucks consume 25 liters per 100 km. The company aims to minimize the total fuel consumption while ensuring all transportation needs are met. The total distance traveled by all vehicles is expected to be 5000 km.\n// Fuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n// The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\n// Minimize 500 * C + 600 * S + 750 * SUV + 1000 * V + 1250 * T\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 to purchase vehicles. Compact vehicles cost $10,000 each, Sedans cost $15,000 each, SUVs cost $20,000 each, Vans cost $25,000 each, and Trucks cost $30,000 each.\n// 10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000\n\n## Generate Constraint-2:\nThe company has a limit on the number of vehicles it can operate. The maximum number of Compact vehicles is 5, Sedans is 4, SUVs is 3, Vans is 2, and Trucks is 1.\n// C <= 5; S <= 4; SUV <= 3; V <= 2; T <= 1\n\n## Generate Constraint-3:\nThe total number of vehicles must not exceed 10 due to operational constraints.\n// C + S + SUV + V + T <= 10",
        "question": "A logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption. The fuel efficiency of each vehicle type is given in the following Table.\n\n| Vehicle Type | Fuel Consumption (liters/100 km) |\n|--------------|---------------------------------|\n| Compact      | 10                              |\n| Sedan        | 12                              |\n| SUV          | 15                              |\n| Van          | 20                              |\n| Truck        | 25                              |\n\nThe company has a total budget of $50,000 to purchase vehicles. Compact vehicles cost $10,000 each, Sedans cost $15,000 each, SUVs cost $20,000 each, Vans cost $25,000 each, and Trucks cost $30,000 each. The company has a limit on the number of vehicles it can operate: the maximum number of Compact vehicles is 5, Sedans is 4, SUVs is 3, Vans is 2, and Trucks is 1. The total number of vehicles must not exceed 10 due to operational constraints. The total distance traveled by all vehicles is expected to be 5000 km.\n\nPlease help the company to minimize the total fuel consumption while ensuring all transportation needs are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Compact vehicles\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sedan vehicles\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # number of SUV vehicles\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Van vehicles\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Truck vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n## The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\nmodel.addCons(obj == 50 * Fuel_Consumption)\n\n# Add constraints\n## The company has a total budget of $50,000 to purchase vehicles.\nmodel.addCons(10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000)\n## The company has a limit on the number of vehicles it can operate.\nmodel.addCons(C <= 5)\nmodel.addCons(S <= 4)\nmodel.addCons(SUV <= 3)\nmodel.addCons(V <= 2)\nmodel.addCons(T <= 1)\n## The total number of vehicles must not exceed 10 due to operational constraints.\nmodel.addCons(C + S + SUV + V + T <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Compact vehicles: \", model.getVal(C))\n    print(\"Number of Sedan vehicles: \", model.getVal(S))\n    print(\"Number of SUV vehicles: \", model.getVal(SUV))\n    print(\"Number of Van vehicles: \", model.getVal(V))\n    print(\"Number of Truck vehicles: \", model.getVal(T))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in engine upgrades for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\n// Fuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\n// Fuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\n// Fuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\n// Fuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency. The fuel consumption per truck on each route is affected by the route's distance and traffic conditions, and investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Fuel Consumption per Truck (without upgrades) | Upgrade Effectiveness |\n|-------|----------------------------------------------|-----------------------|\n| Route1 | 100 units                                   | 0.1 units reduction per $1 invested |\n| Route2 | 120 units                                   | 0.12 units reduction per $1 invested |\n| Route3 | 110 units                                   | 0.11 units reduction per $1 invested |\n| Route4 | 90 units                                    | 0.09 units reduction per $1 invested |\n| Route5 | 130 units                                   | 0.13 units reduction per $1 invested |\n\nThe company has a budget of $100,000 for engine upgrades and operational costs. Please help the company determine the optimal number of trucks to allocate to each route and the amount to invest in engine upgrades for each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks on Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in engine upgrades for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in engine upgrades for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in engine upgrades for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in engine upgrades for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in engine upgrades for Route5\n\n# Define objective function\nFuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\nFuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\nFuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\nFuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\nFuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n# Add constraints\n# The company has a budget of $100,000 for engine upgrades and operational costs.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Engine Upgrades for Route1: \", model.getVal(Upgrade1))\n    print(\"Investment in Engine Upgrades for Route2: \", model.getVal(Upgrade2))\n    print(\"Investment in Engine Upgrades for Route3: \", model.getVal(Upgrade3))\n    print(\"Investment in Engine Upgrades for Route4: \", model.getVal(Upgrade4))\n    print(\"Investment in Engine Upgrades for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1633,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed.\n// {\"number of trips for Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A consumes 5 liters of fuel per hour and travels at 60 km/h.\nTruck B consumes 7 liters of fuel per hour and travels at 50 km/h.\nTruck C consumes 6 liters of fuel per hour and travels at 40 km/h.\nVan D consumes 3 liters of fuel per hour and travels at 80 km/h.\nVan E consumes 4 liters of fuel per hour and travels at 70 km/h.\nThe company wants to minimize the total fuel consumption while ensuring timely deliveries.\n// TotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\n// TotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n// The objective function is: Minimize TotalFuelConsumption * TotalDeliveryTime\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000\n\n## Generate Constraint-2:\nThe company must complete at least 1000 km of deliveries per day.\n// 60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed. Truck A consumes 5 liters of fuel per hour and travels at 60 km/h. Truck B consumes 7 liters of fuel per hour and travels at 50 km/h. Truck C consumes 6 liters of fuel per hour and travels at 40 km/h. Van D consumes 3 liters of fuel per hour and travels at 80 km/h. Van E consumes 4 liters of fuel per hour and travels at 70 km/h. The company has a total fuel budget of 1000 liters per day and must complete at least 1000 km of deliveries per day. The company wants to minimize the total fuel consumption while ensuring timely deliveries. Please help the company to minimize the total fuel consumption multiplied by the total delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trips for Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trips for Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trips for Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of trips for Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of trips for Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\nTotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n## convert the division to multiplication\nmodel.addCons(obj == TotalFuelConsumption * TotalDeliveryTime)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000)\n## The company must complete at least 1000 km of deliveries per day.\nmodel.addCons(60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(TruckA))\n    print(\"Number of trips for Truck B: \", model.getVal(TruckB))\n    print(\"Number of trips for Truck C: \", model.getVal(TruckC))\n    print(\"Number of trips for Van D: \", model.getVal(VanD))\n    print(\"Number of trips for Van E: \", model.getVal(VanE))\n    print(\"Minimized Fuel Consumption * Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, and the production cost per unit is $50. For ProductB, the profit per unit is $120, and the production cost per unit is $60. For ProductC, the profit per unit is $150, and the production cost per unit is $75. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\n// ProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\n// ProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and the efficiency of production lines. Additionally, the company is considering investing in a new technology that can improve the production efficiency of all products. The profit per unit of ProductA is $100, and the production cost per unit is $50. For ProductB, the profit per unit is $120, and the production cost per unit is $60. For ProductC, the profit per unit is $150, and the production cost per unit is $75. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The company has a budget of $100,000 for the investment in new technology. The total production capacity of the company is 5000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = 100 * QA - (50 - 0.0005 * TechInvestment) * QA\nProfitB = 120 * QB - (60 - 0.0005 * TechInvestment) * QB\nProfitC = 150 * QC - (75 - 0.0005 * TechInvestment) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $100,000 for the investment in new technology.\nmodel.addCons(TechInvestment <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QA + QB + QC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000\n\n## Generate Constraint-2:\nThe company aims to have at least 10 vehicles in total.\n// Trucks + Vans + Bikes + Drones >= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\n// Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones)\n\n## Generate Constraint-4:\nThe operational cost per day should not exceed $20,000.\n// Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone <= 20000",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for each vehicle type per day are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day |\n|--------------|--------------------------|\n| Trucks       | $500                     |\n| Vans         | $300                     |\n| Bikes        | $100                     |\n| Drones       | $200                     |\n\nThe company has a budget of $100,000 for purchasing vehicles. The company aims to have at least 10 vehicles in total. The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles. The operational cost per day should not exceed $20,000.\n\nPlease help the company to minimize the total operational cost while ensuring efficient delivery coverage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)\n\n# Define operational costs\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\n\n# Define objective function\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n## The company aims to have at least 10 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes + Drones >= 10)\n## The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\nmodel.addCons(Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones))\n## The operational cost per day should not exceed $20,000.\nmodel.addCons(Total_Cost <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate to each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the number of trips each truck should make per day.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for RegionE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $100 per trip, in RegionB is $120 per trip, in RegionC is $150 per trip, in RegionD is $130 per trip, and in RegionE is $140 per trip. The revenue generated per trip in RegionA is $200, in RegionB is $220, in RegionC is $250, in RegionD is $230, and in RegionE is $240. The company wants to maximize the total net profit per day.\n// NetProfit_RegionA = (200 - 100) * TrucksA * TripsA\n// NetProfit_RegionB = (220 - 120) * TrucksB * TripsB\n// NetProfit_RegionC = (250 - 150) * TrucksC * TripsC\n// NetProfit_RegionD = (230 - 130) * TrucksD * TripsD\n// NetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n// So, the objective function is: Maximize (NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nEach truck can make a maximum of 5 trips per day.\n// TripsA <= 5; TripsB <= 5; TripsC <= 5; TripsD <= 5; TripsE <= 5\n\n## Generate Constraint-3:\nThe total daily fuel cost must not exceed $5000.\n// 100 * TrucksA * TripsA + 120 * TrucksB * TripsB + 150 * TrucksC * TripsC + 130 * TrucksD * TripsD + 140 * TrucksE * TripsE <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that each region has at least one truck.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-5:\nThe total number of trips across all regions must not exceed 200.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD + TrucksE * TripsE <= 200",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. The company needs to determine the number of trucks to allocate to each region and the number of trips each truck should make per day. The cost of operating a truck and the revenue generated per trip in each region are given in the following Table.\n\n| Region | Cost per Trip | Revenue per Trip |\n|--------|---------------|------------------|\n| RegionA | $100         | $200             |\n| RegionB | $120         | $220             |\n| RegionC | $150         | $250             |\n| RegionD | $130         | $230             |\n| RegionE | $140         | $240             |\n\nThe company has a total of 50 trucks available. Each truck can make a maximum of 5 trips per day. The total daily fuel cost must not exceed $5000. The company wants to ensure that each region has at least one truck. The total number of trips across all regions must not exceed 200.\n\nPlease help the company to maximize the total net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RegionE\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=5)  # number of trips per truck for RegionA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=5)  # number of trips per truck for RegionB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=5)  # number of trips per truck for RegionC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=5)  # number of trips per truck for RegionD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0, ub=5)  # number of trips per truck for RegionE\n\n# Define objective function\nNetProfit_RegionA = (200 - 100) * TrucksA * TripsA\nNetProfit_RegionB = (220 - 120) * TrucksB * TripsB\nNetProfit_RegionC = (250 - 150) * TrucksC * TripsC\nNetProfit_RegionD = (230 - 130) * TrucksD * TripsD\nNetProfit_RegionE = (240 - 140) * TrucksE * TripsE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_RegionA + NetProfit_RegionB + NetProfit_RegionC + NetProfit_RegionD + NetProfit_RegionE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TripsA <= 5)\nmodel.addCons(TripsB <= 5)\nmodel.addCons(TripsC <= 5)\nmodel.addCons(TripsD <= 5)\nmodel.addCons(TripsE <= 5)\nmodel.addCons(100 * TrucksA * TripsA + 120 * TrucksB * TripsB + 150 * TrucksC * TripsC + 130 * TrucksD * TripsD + 140 * TrucksE * TripsE <= 5000)\nmodel.addCons(TrucksA >= 1)\nmodel.addCons(TrucksB >= 1)\nmodel.addCons(TrucksC >= 1)\nmodel.addCons(TrucksD >= 1)\nmodel.addCons(TrucksE >= 1)\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD + TrucksE * TripsE <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Number of Trips per Truck for RegionA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for RegionB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for RegionC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for RegionD: \", model.getVal(TripsD))\n    print(\"Number of Trips per Truck for RegionE: \", model.getVal(TripsE))\n    print(\"Maximized Total Net Profit per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\n// {\"number of company-owned trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteA\": \"LeaseA\", \"range\": \"LeaseA >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteB\": \"LeaseB\", \"range\": \"LeaseB >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteC\": \"LeaseC\", \"range\": \"LeaseC >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteD\": \"LeaseD\", \"range\": \"LeaseD >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteE\": \"LeaseE\", \"range\": \"LeaseE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company wants to maximize the total profit minus the total leasing cost.\n// Total profit for RouteA: Profit_A = 50,000 * TruckA - 15,000 * LeaseA\n// Total profit for RouteB: Profit_B = 60,000 * TruckB - 18,000 * LeaseB\n// Total profit for RouteC: Profit_C = 70,000 * TruckC - 20,000 * LeaseC\n// Total profit for RouteD: Profit_D = 55,000 * TruckD - 16,000 * LeaseD\n// Total profit for RouteE: Profit_E = 65,000 * TruckE - 19,000 * LeaseE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 company-owned trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total number of leased trucks should not exceed 50.\n// LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50\n\n## Generate Constraint-3:\nRouteC must have at least 20% of the total trucks (company-owned and leased).\n// (TruckC + LeaseC) >= 0.20 * (TruckA + TruckB + TruckC + TruckD + TruckE + LeaseA + LeaseB + LeaseC + LeaseD + LeaseE)",
        "question": "A logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route. The profit per company-owned truck and the cost of leasing a truck for each route are given in the following Table.\n\n| Route | Profit per Company-Owned Truck | Cost of Leasing a Truck |\n|-------|--------------------------------|-------------------------|\n| A     | $50,000                        | $15,000                 |\n| B     | $60,000                        | $18,000                 |\n| C     | $70,000                        | $20,000                 |\n| D     | $55,000                        | $16,000                 |\n| E     | $65,000                        | $19,000                 |\n\nThe company has a total of 100 company-owned trucks available. The total number of leased trucks should not exceed 50. RouteC must have at least 20% of the total trucks (company-owned and leased). The company wants to maximize the total profit minus the total leasing cost.\n\nPlease help the company determine the optimal allocation of company-owned and leased trucks for each route to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of company-owned trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of company-owned trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of company-owned trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of company-owned trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)  # number of company-owned trucks for RouteE\nLeaseA = model.addVar(vtype=\"INTEGER\", name=\"LeaseA\", lb=0)  # number of leased trucks for RouteA\nLeaseB = model.addVar(vtype=\"INTEGER\", name=\"LeaseB\", lb=0)  # number of leased trucks for RouteB\nLeaseC = model.addVar(vtype=\"INTEGER\", name=\"LeaseC\", lb=0)  # number of leased trucks for RouteC\nLeaseD = model.addVar(vtype=\"INTEGER\", name=\"LeaseD\", lb=0)  # number of leased trucks for RouteD\nLeaseE = model.addVar(vtype=\"INTEGER\", name=\"LeaseE\", lb=0)  # number of leased trucks for RouteE\n\n# Define objective function\nProfit_A = 50000 * TruckA - 15000 * LeaseA\nProfit_B = 60000 * TruckB - 18000 * LeaseB\nProfit_C = 70000 * TruckC - 20000 * LeaseC\nProfit_D = 55000 * TruckD - 16000 * LeaseD\nProfit_E = 65000 * TruckE - 19000 * LeaseE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)  # Total of 100 company-owned trucks available\nmodel.addCons(LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50)  # Total number of leased trucks should not exceed 50\nmodel.addCons((TruckC + LeaseC) >= 0.20 * (TruckA + TruckB + TruckC + TruckD + TruckE + LeaseA + LeaseB + LeaseC + LeaseD + LeaseE))  # RouteC must have at least 20% of the total trucks\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of company-owned trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of company-owned trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of company-owned trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of company-owned trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of company-owned trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of leased trucks for RouteA: \", model.getVal(LeaseA))\n    print(\"Number of leased trucks for RouteB: \", model.getVal(LeaseB))\n    print(\"Number of leased trucks for RouteC: \", model.getVal(LeaseC))\n    print(\"Number of leased trucks for RouteD: \", model.getVal(LeaseD))\n    print(\"Number of leased trucks for RouteE: \", model.getVal(LeaseE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1332,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"capacity of the battery storage system\": \"Battery\", \"range\": \"Battery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing one solar panel at each site is $1000, and the expected energy generation per panel is 100 kWh. The cost of installing one wind turbine at each site is $2000, and the expected energy generation per turbine is 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n// Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n// Total energy generation = 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC)\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n// 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy. The cost and expected energy generation for each type of installation are given in the following Table.\n\n| Installation Type | Cost per Unit | Expected Energy Generation per Unit |\n|-------------------|---------------|-------------------------------------|\n| Solar Panel at Site A | $1000 | 100 kWh |\n| Solar Panel at Site B | $1000 | 100 kWh |\n| Solar Panel at Site C | $1000 | 100 kWh |\n| Wind Turbine at Site A | $2000 | 200 kWh |\n| Wind Turbine at Site B | $2000 | 200 kWh |\n| Wind Turbine at Site C | $2000 | 200 kWh |\n| Battery Storage System | $50 per kWh | - |\n\nThe company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage. The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n\nPlease help the company determine the optimal number of solar panels and wind turbines at each site, as well as the capacity of the battery storage system to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Site A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Site B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Site C\nBattery = model.addVar(vtype=\"CONTINUOUS\", name=\"Battery\", lb=0) # capacity of the battery storage system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n## Objective function: Minimize Total cost\nmodel.addCons(obj == 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery)\n\n# Add constraints\n## The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\nmodel.addCons(100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Site B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Site C: \", model.getVal(WindC))\n    print(\"Battery Storage Capacity: \", model.getVal(Battery))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (North, South, East, West, and Central). The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate per truck.\n// {\"number of trucks for North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per truck (gallons per mile)\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3. The distance traveled by each truck in the North region is 100 miles, South is 150 miles, East is 200 miles, West is 250 miles, and Central is 300 miles. The company wants to minimize the total fuel cost per day.\n// FuelCost_North = 100 * NorthTrucks * FuelRate * 3\n// FuelCost_South = 150 * SouthTrucks * FuelRate * 3\n// FuelCost_East = 200 * EastTrucks * FuelRate * 3\n// FuelCost_West = 250 * WestTrucks * FuelRate * 3\n// FuelCost_Central = 300 * CentralTrucks * FuelRate * 3\n// So, the objective function is: Minimize (FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West + FuelCost_Central)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs per day.\n// 100 * NorthTrucks * FuelRate + 150 * SouthTrucks * FuelRate + 200 * EastTrucks * FuelRate + 250 * WestTrucks * FuelRate + 300 * CentralTrucks * FuelRate <= 5000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (North, South, East, West, and Central). The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate per truck. The cost of fuel per gallon is $3. The distance traveled by each truck in the North region is 100 miles, South is 150 miles, East is 200 miles, West is 250 miles, and Central is 300 miles. The company has a total budget of $5000 for fuel costs per day and a maximum of 50 trucks available. The company wants to minimize the total fuel cost per day. Please help the company determine the optimal allocation of trucks and the fuel consumption rate per truck to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=0)\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0)\n\n# Define objective function\nFuelCost_North = 100 * NorthTrucks * FuelRate * 3\nFuelCost_South = 150 * SouthTrucks * FuelRate * 3\nFuelCost_East = 200 * EastTrucks * FuelRate * 3\nFuelCost_West = 250 * WestTrucks * FuelRate * 3\nFuelCost_Central = 300 * CentralTrucks * FuelRate * 3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West + FuelCost_Central)\n\n# Add constraints\nmodel.addCons(100 * NorthTrucks * FuelRate + 150 * SouthTrucks * FuelRate + 200 * EastTrucks * FuelRate + 250 * WestTrucks * FuelRate + 300 * CentralTrucks * FuelRate <= 5000)\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks for Central Region: \", model.getVal(CentralTrucks))\n    print(\"Fuel Consumption Rate per Truck: \", model.getVal(FuelRate))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected yield is 150 bushels per acre, the price per bushel is $5, and the water requirement is 200 gallons per acre.\nFor Wheat, the expected yield is 100 bushels per acre, the price per bushel is $6, and the water requirement is 150 gallons per acre.\nFor Soybeans, the expected yield is 50 bushels per acre, the price per bushel is $10, and the water requirement is 100 gallons per acre.\nFor Barley, the expected yield is 80 bushels per acre, the price per bushel is $4, and the water requirement is 120 gallons per acre.\nFor Oats, the expected yield is 70 bushels per acre, the price per bushel is $3, and the water requirement is 90 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n// Total profit: Profit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\n// Total water usage: Water = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer has a total of 15,000 gallons of water available for irrigation.\n// 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000",
        "question": "A farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop. The expected yield, price per bushel, and water requirement for each crop are given in the following Table.\n\n| Crop      | Expected Yield (bushels/acre) | Price per Bushel | Water Requirement (gallons/acre) |\n|-----------|-------------------------------|------------------|---------------------------------|\n| Corn      | 150                           | $5               | 200                             |\n| Wheat     | 100                           | $6               | 150                             |\n| Soybeans  | 50                            | $10              | 100                             |\n| Barley    | 80                            | $4               | 120                             |\n| Oats      | 70                            | $3               | 90                              |\n\nThe farmer has 100 acres available for planting. The farmer also has a total of 15,000 gallons of water available for irrigation. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # number of acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # number of acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # number of acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0)  # number of acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0)  # number of acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\nWater = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer has a total of 15,000 gallons of water available for irrigation.\nmodel.addCons(200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Number of Acres of Barley: \", model.getVal(Barley))\n    print(\"Number of Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the labor hours dedicated to each product. The marketing budget affects the sales of each product, and the labor hours determine the production efficiency.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1,000 spent. The labor hours affect the production cost, which decreases by $5 for every additional hour. The company aims to maximize the total profit from all products.\n// Profit for ProductA: ProfitA = (100 * QuantityA - 0.001 * BudgetA * QuantityA - 5 * HoursA)\n// Profit for ProductB: ProfitB = (150 * QuantityB - 0.001 * BudgetB * QuantityB - 5 * HoursB)\n// Profit for ProductC: ProfitC = (200 * QuantityC - 0.001 * BudgetC * QuantityC - 5 * HoursC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total marketing budget cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000\n\n## Generate Constraint-2:\nThe total labor hours available for the month are 1000 hours.\n// HoursA + HoursB + HoursC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the labor hours dedicated to each product. The marketing budget affects the sales of each product, and the labor hours determine the production efficiency. The revenue generated per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1,000 spent. The labor hours affect the production cost, which decreases by $5 for every additional hour. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit | Marketing Budget Effect | Labor Hours Effect |\n|---------|------------------|-------------------------|--------------------|\n| ProductA | $100             | 1% per $1,000 spent     | $5 cost decrease per hour |\n| ProductB | $150             | 1% per $1,000 spent     | $5 cost decrease per hour |\n| ProductC | $200             | 1% per $1,000 spent     | $5 cost decrease per hour |\n\nThe total marketing budget cannot exceed $50,000. The total labor hours available for the month are 1000 hours. Please help the company to determine the optimal production quantity, marketing budget, and labor hours for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0)  # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0)  # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0)  # marketing budget for ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # labor hours for ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # labor hours for ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # labor hours for ProductC\n\n# Define objective function\nProfitA = (100 * QuantityA - 0.001 * BudgetA * QuantityA - 5 * HoursA)\nProfitB = (150 * QuantityB - 0.001 * BudgetB * QuantityB - 5 * HoursB)\nProfitC = (200 * QuantityC - 0.001 * BudgetC * QuantityC - 5 * HoursC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Labor Hours for ProductA: \", model.getVal(HoursA))\n    print(\"Labor Hours for ProductB: \", model.getVal(HoursB))\n    print(\"Labor Hours for ProductC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the optimal route length for each type of truck to maximize profit. The route length affects the fuel efficiency and thus the operational cost of each truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"route length for Small trucks\": \"SmallRouteLength\", \"range\": \"SmallRouteLength >= 0\", \"type\": \"continuous\"}\n// {\"route length for Medium trucks\": \"MediumRouteLength\", \"range\": \"MediumRouteLength >= 0\", \"type\": \"continuous\"}\n// {\"route length for Large trucks\": \"LargeRouteLength\", \"range\": \"LargeRouteLength >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the route length, which influences fuel efficiency and operational costs. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The operational cost per mile decreases with increasing route length: for Small trucks, it decreases by $0.01 per mile for every 10 miles increase in route length; for Medium trucks, it decreases by $0.015 per mile for every 10 miles increase in route length; for Large trucks, it decreases by $0.02 per mile for every 10 miles increase in route length. The company aims to maximize the total daily profit from all trucks.\n// Profit_Small = SmallTrucks * SmallRouteLength * (0.50 - 0.01 * (SmallRouteLength / 10))\n// Profit_Medium = MediumTrucks * MediumRouteLength * (0.70 - 0.015 * (MediumRouteLength / 10))\n// Profit_Large = LargeTrucks * LargeRouteLength * (1.00 - 0.02 * (LargeRouteLength / 10))\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a Small truck is $20,000, a Medium truck is $30,000, and a Large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000\n\n## Generate Constraint-2:\nThe company has a daily operational limit of 5000 miles for all trucks combined.\n// SmallTrucks * SmallRouteLength + MediumTrucks * MediumRouteLength + LargeTrucks * LargeRouteLength <= 5000\n\n## Generate Constraint-3:\nDue to maintenance constraints, the company can operate at most 100 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100",
        "question": "A logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the optimal route length for each type of truck to maximize profit. The route length affects the fuel efficiency and thus the operational cost of each truck. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The operational cost per mile decreases with increasing route length: for Small trucks, it decreases by $0.01 per mile for every 10 miles increase in route length; for Medium trucks, it decreases by $0.015 per mile for every 10 miles increase in route length; for Large trucks, it decreases by $0.02 per mile for every 10 miles increase in route length.\n\nThe company has a budget of $100,000 for purchasing trucks. The cost of a Small truck is $20,000, a Medium truck is $30,000, and a Large truck is $40,000. The company has a daily operational limit of 5000 miles for all trucks combined. Due to maintenance constraints, the company can operate at most 100 trucks in total.\n\nPlease help the company to maximize the total daily profit from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallRouteLength\", lb=0)\nMediumRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumRouteLength\", lb=0)\nLargeRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeRouteLength\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit calculation with piecewise linear functions for operational cost reduction\nProfit_Small = SmallTrucks * SmallRouteLength * (0.50 - 0.01 * (SmallRouteLength / 10))\nProfit_Medium = MediumTrucks * MediumRouteLength * (0.70 - 0.015 * (MediumRouteLength / 10))\nProfit_Large = LargeTrucks * LargeRouteLength * (1.00 - 0.02 * (LargeRouteLength / 10))\n## the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The company has a daily operational limit of 5000 miles for all trucks combined.\nmodel.addCons(SmallTrucks * SmallRouteLength + MediumTrucks * MediumRouteLength + LargeTrucks * LargeRouteLength <= 5000)\n## Due to maintenance constraints, the company can operate at most 100 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Route Length for Small Trucks: \", model.getVal(SmallRouteLength))\n    print(\"Route Length for Medium Trucks: \", model.getVal(MediumRouteLength))\n    print(\"Route Length for Large Trucks: \", model.getVal(LargeRouteLength))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialized truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while ensuring all deliveries are met.\n// Fuel_Consumption_Small = (S * 20) / (S * 5)\n// Fuel_Consumption_Medium = (M * 15) / (M * 10)\n// Fuel_Consumption_Large = (L * 10) / (L * 15)\n// Fuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\n// Fuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n## Generate Constraint-1:\nThe total capacity required for all deliveries is 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase a maximum of 30 trucks in total.\n// S + M + L + XL + Sp <= 30\n\n## Generate Constraint-3:\nThe number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment.\n// Sp <= 5\n\n## Generate Constraint-4:\nThe number of Small and Medium trucks combined must be at least twice the number of Large trucks.\n// S + M >= 2 * (L + XL + Sp)",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialized. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Fuel Efficiency (km/l) | Capacity (tons) |\n|------------------|-----------------------|-----------------|\n| Small            | 20                    | 5               |\n| Medium           | 15                    | 10              |\n| Large            | 10                    | 15              |\n| Extra-Large      | 8                     | 20              |\n| Specialized      | 5                     | 25              |\n\nThe total capacity required for all deliveries is 500 tons. The company has a budget to purchase a maximum of 30 trucks in total. The number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment. The number of Small and Medium trucks combined must be at least twice the number of Large trucks. \n\nPlease help the company to minimize the total fuel consumption while ensuring all deliveries are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0, ub=5) # number of Specialized trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Small = (S * 20) / (S * 5)\nFuel_Consumption_Medium = (M * 15) / (M * 10)\nFuel_Consumption_Large = (L * 10) / (L * 15)\nFuel_Consumption_Extra_Large = (XL * 8) / (XL * 20)\nFuel_Consumption_Specialized = (Sp * 5) / (Sp * 25)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large + Fuel_Consumption_Extra_Large + Fuel_Consumption_Specialized)\n\n# Add constraints\n## The total capacity required for all deliveries is 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp >= 500)\n## The company has a budget to purchase a maximum of 30 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 30)\n## The number of Specialized trucks cannot exceed 5 due to limited availability of specialized equipment.\nmodel.addCons(Sp <= 5)\n## The number of Small and Medium trucks combined must be at least twice the number of Large trucks.\nmodel.addCons(S + M >= 2 * (L + XL + Sp))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Specialized Trucks: \", model.getVal(Sp))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks.\n// Operational cost for RouteX: CostX = (0.5 - 0.00005 * TechX) * TrucksX\n// Operational cost for RouteY: CostY = (0.6 - 0.00006 * TechY) * TrucksY\n// Operational cost for RouteZ: CostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\n// TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company needs to determine the amount of investment in fuel-efficient technologies for each route, which affects the operational cost and efficiency of each truck. The operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for RouteX, $0.06 for RouteY, and $0.07 for RouteZ. The company aims to minimize the total operational cost of all trucks.\n\n| Route | Fuel Cost per Kilometer | Investment Impact per $1000 |\n|-------|-------------------------|-----------------------------|\n| RouteX | 0.5$                   | -$0.05 per $1000            |\n| RouteY | 0.6$                   | -$0.06 per $1000            |\n| RouteZ | 0.7$                   | -$0.07 per $1000            |\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies. Please help the company to determine the optimal number of trucks and the investment in fuel-efficient technologies to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0) # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0) # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0) # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nCostX = (0.5 - 0.00005 * TechX) * TrucksX\nCostY = (0.6 - 0.00006 * TechY) * TrucksY\nCostZ = (0.7 - 0.00007 * TechZ) * TrucksZ\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TechX + TechY + TechZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to load onto each truck.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for RouteX\": \"SpeedX\", \"range\": \"SpeedX >= 0\", \"type\": \"continuous\"}\n// {\"speed of trucks for RouteY\": \"SpeedY\", \"range\": \"SpeedY >= 0\", \"type\": \"continuous\"}\n// {\"fuel loaded onto trucks for RouteX\": \"FuelX\", \"range\": \"FuelX >= 0\", \"type\": \"continuous\"}\n// {\"fuel loaded onto trucks for RouteY\": \"FuelY\", \"range\": \"FuelY >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption, v is the speed, and k is a constant. The company aims to minimize the total fuel cost, which is the product of the total fuel consumed and the fuel price.\n// Total fuel consumption for RouteX: ConsumptionX = k * SpeedX^2 * TrucksX * DistanceX / SpeedX\n// Total fuel consumption for RouteY: ConsumptionY = k * SpeedY^2 * TrucksY * DistanceY / SpeedY\n// Total fuel cost: Cost = FuelPrice * (ConsumptionX + ConsumptionY)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available for both routes.\n// TrucksX + TrucksY <= 20\n\n## Generate Constraint-2:\nThe maximum speed limit for trucks on RouteX is 60 km/h, and on RouteY is 50 km/h.\n// SpeedX <= 60; SpeedY <= 50\n\n## Generate Constraint-3:\nThe total fuel capacity of all trucks for both routes must not exceed 10,000 liters.\n// FuelX + FuelY <= 10,000\n\n## Generate Constraint-4:\nThe company must ensure that at least 5 trucks are assigned to each route.\n// TrucksX >= 5; TrucksY >= 5\n\n## Generate Constraint-5:\nThe total travel time for all trucks on both routes must not exceed 100 hours.\n// (DistanceX / SpeedX) * TrucksX + (DistanceY / SpeedY) * TrucksY <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to load onto each truck. The fuel consumption rate of each truck is a nonlinear function of its speed, given by F = k * v^2, where F is the fuel consumption, v is the speed, and k is a constant. The company aims to minimize the total fuel cost, which is the product of the total fuel consumed and the fuel price. The company has a total of 20 trucks available for both routes. The maximum speed limit for trucks on RouteX is 60 km/h, and on RouteY is 50 km/h. The total fuel capacity of all trucks for both routes must not exceed 10,000 liters. The company must ensure that at least 5 trucks are assigned to each route. The total travel time for all trucks on both routes must not exceed 100 hours. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=5)  # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=5)  # number of trucks for RouteY\nSpeedX = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedX\", lb=0)  # speed of trucks for RouteX\nSpeedY = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedY\", lb=0)  # speed of trucks for RouteY\nFuelX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelX\", lb=0)  # fuel loaded onto trucks for RouteX\nFuelY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelY\", lb=0)  # fuel loaded onto trucks for RouteY\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nk = 0.01  # constant for fuel consumption rate\nDistanceX = 500  # distance for RouteX\nDistanceY = 400  # distance for RouteY\nFuelPrice = 1.5  # price per liter of fuel\n## Total fuel consumption for RouteX: ConsumptionX = k * SpeedX^2 * TrucksX * DistanceX / SpeedX\n## Total fuel consumption for RouteY: ConsumptionY = k * SpeedY^2 * TrucksY * DistanceY / SpeedY\n## Total fuel cost: Cost = FuelPrice * (ConsumptionX + ConsumptionY)\nConsumptionX = k * SpeedX * TrucksX * DistanceX\nConsumptionY = k * SpeedY * TrucksY * DistanceY\nCost = FuelPrice * (ConsumptionX + ConsumptionY)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a total of 20 trucks available for both routes.\nmodel.addCons(TrucksX + TrucksY <= 20)\n## The maximum speed limit for trucks on RouteX is 60 km/h, and on RouteY is 50 km/h.\nmodel.addCons(SpeedX <= 60)\nmodel.addCons(SpeedY <= 50)\n## The total fuel capacity of all trucks for both routes must not exceed 10,000 liters.\nmodel.addCons(FuelX + FuelY <= 10000)\n## The company must ensure that at least 5 trucks are assigned to each route.\nmodel.addCons(TrucksX >= 5)\nmodel.addCons(TrucksY >= 5)\n## The total travel time for all trucks on both routes must not exceed 100 hours.\nmodel.addCons((DistanceX / SpeedX) * TrucksX + (DistanceY / SpeedY) * TrucksY <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Speed of Trucks for RouteX: \", model.getVal(SpeedX))\n    print(\"Speed of Trucks for RouteY: \", model.getVal(SpeedY))\n    print(\"Fuel Loaded onto Trucks for RouteX: \", model.getVal(FuelX))\n    print(\"Fuel Loaded onto Trucks for RouteY: \", model.getVal(FuelY))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 10,000 units.\n// A + B + C + D <= 10000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient upgrades for their production lines. The energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for energy efficiency upgrades. The total production capacity for the next quarter is 10,000 units.\n\nPlease help the company to determine the optimal production quantity for each product and the investment in energy efficiency upgrades to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0) # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $100,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000)\n# The total production capacity for the next quarter is 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons.\n// The total cost function is: 50S + 70M + 90L + 110XL + 130R\n// The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\n// The objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for operational costs.\n// 50S + 70M + 90L + 110XL + 130R <= 5000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can operate. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10.\n// S <= 30; M <= 25; L <= 20; XL <= 15; R <= 10\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements.\n// 0.2 * (10S + 20M + 30L + 40XL + 25R) <= 25R\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced fleet, ensuring that the number of Large and Extra-Large trucks does not exceed the combined number of Small and Medium trucks.\n// L + XL <= S + M",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons. The company has a budget of $5000 per day for operational costs. The company has a limit on the number of trucks it can operate. The maximum number of Small trucks is 30, Medium trucks is 25, Large trucks is 20, Extra-Large trucks is 15, and Refrigerated trucks is 10. The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks due to specific cargo requirements. The company aims to maintain a balanced fleet, ensuring that the number of Large and Extra-Large trucks does not exceed the combined number of Small and Medium trucks.\n\nPlease help the company to minimize the total daily operational cost while meeting all constraints and ensuring all cargo is delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\nmodel.addCons(obj == 50*S + 70*M + 90*L + 110*XL + 130*R)\n\n# Add constraints\n## The company has a budget of $5000 per day for operational costs.\nmodel.addCons(50*S + 70*M + 90*L + 110*XL + 130*R <= 5000)\n## The company has a limit on the number of trucks it can operate.\nmodel.addCons(S <= 30)\nmodel.addCons(M <= 25)\nmodel.addCons(L <= 20)\nmodel.addCons(XL <= 15)\nmodel.addCons(R <= 10)\n## The company must ensure that at least 20% of the cargo is transported by Refrigerated trucks.\nmodel.addCons(0.2 * (10*S + 20*M + 30*L + 40*XL + 25*R) <= 25*R)\n## The company aims to maintain a balanced fleet.\nmodel.addCons(L + XL <= S + M)\n## The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\nmodel.addCons(10*S + 20*M + 30*L + 40*XL + 25*R >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1404,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"Auto_A\", \"range\": \"Auto_A >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"Auto_B\", \"range\": \"Auto_B >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"Auto_C\", \"range\": \"Auto_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 5 * Auto_A)) * Q_A\n// Profit_B = (180 - (120 - 5 * Auto_B)) * Q_B\n// Profit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation.\n// Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// Q_A + Q_B + Q_C <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 500 units and for ProductB is 800 units.\n// Q_A <= 500; Q_B <= 800\n\n## Generate Constraint-4:\nThe level of automation for each product must be between 0 and 100 units.\n// 0 <= Auto_A <= 100; 0 <= Auto_B <= 100; 0 <= Auto_C <= 100\n\n## Generate Constraint-5:\nThe company must produce at least 200 units of ProductC.\n// Q_C >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $150                   |\n| ProductB | $120                             | $180                   |\n| ProductC | $150                             | $200                   |\n\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The company has a total budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units. The market demand for ProductA is 500 units and for ProductB is 800 units. The level of automation for each product must be between 0 and 100 units. The company must produce at least 200 units of ProductC.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAuto_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_A\", lb=0, ub=100) # level of automation for ProductA\nAuto_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_B\", lb=0, ub=100) # level of automation for ProductB\nAuto_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_C\", lb=0, ub=100) # level of automation for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 5 * Auto_A)) * Q_A\nProfit_B = (180 - (120 - 5 * Auto_B)) * Q_B\nProfit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation.\nmodel.addCons(Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(Q_A + Q_B + Q_C <= 2000)\n# The market demand for ProductA is 500 units and for ProductB is 800 units.\nmodel.addCons(Q_A <= 500)\nmodel.addCons(Q_B <= 800)\n# The company must produce at least 200 units of ProductC.\nmodel.addCons(Q_C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation for ProductA: \", model.getVal(Auto_A))\n    print(\"Level of Automation for ProductB: \", model.getVal(Auto_B))\n    print(\"Level of Automation for ProductC: \", model.getVal(Auto_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. Route 1 has a cost per truck of $1000 and generates a revenue of $1500 per truck. Route 2 has a cost per truck of $1200 and generates a revenue of $1800 per truck. Route 3 has a cost per truck of $1100 and generates a revenue of $1600 per truck. Route 4 has a cost per truck of $1300 and generates a revenue of $1900 per truck. Route 5 has a cost per truck of $1400 and generates a revenue of $2000 per truck. The company wants to maximize the total net profit from all routes, where net profit is the revenue minus the cost.\n// Net_Profit_Route1 = (1500 - 1000) * T1\n// Net_Profit_Route2 = (1800 - 1200) * T2\n// Net_Profit_Route3 = (1600 - 1100) * T3\n// Net_Profit_Route4 = (1900 - 1300) * T4\n// Net_Profit_Route5 = (2000 - 1400) * T5\n// So, the objective function is: Maximize Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 15; T5 <= 10",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure: Route 1 has a cost per truck of $1000 and generates a revenue of $1500 per truck; Route 2 has a cost per truck of $1200 and generates a revenue of $1800 per truck; Route 3 has a cost per truck of $1100 and generates a revenue of $1600 per truck; Route 4 has a cost per truck of $1300 and generates a revenue of $1900 per truck; Route 5 has a cost per truck of $1400 and generates a revenue of $2000 per truck. The company wants to maximize the total net profit from all routes, where net profit is the revenue minus the cost. The company has a total of 100 trucks available for allocation. Each route also has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks. Please help the company determine the optimal allocation of trucks to each route to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_Route1 = (1500 - 1000) * T1\nNet_Profit_Route2 = (1800 - 1200) * T2\nNet_Profit_Route3 = (1600 - 1100) * T3\nNet_Profit_Route4 = (1900 - 1300) * T4\nNet_Profit_Route5 = (2000 - 1400) * T5\n## the objective function is: Maximize Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5\nmodel.addCons(obj == Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate.\n// {\"number of trips for RouteX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for RouteX: ConsumptionX = 50 - 0.005 * TechX * TripsX\n// Fuel consumption for RouteY: ConsumptionY = 60 - 0.006 * TechY * TripsY\n// Fuel consumption for RouteZ: ConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operations and technology investments.\n// 50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate. The initial fuel consumption rate and the reduction in fuel consumption per trip for every $100 invested in technology for each route are given in the following Table.\n\n| Route | Initial Fuel Consumption Rate | Reduction in Fuel Consumption per $100 Investment |\n|-------|-------------------------------|--------------------------------------------------|\n| RouteX | 50 liters per trip           | 0.5 liters per trip                              |\n| RouteY | 60 liters per trip           | 0.6 liters per trip                              |\n| RouteZ | 70 liters per trip           | 0.7 liters per trip                              |\n\nThe company has a total budget of $100,000 for operations and technology investments. The company aims to minimize the total fuel consumption across all routes. Please help the company determine the optimal number of trips for each route and the investment in fuel-efficient technology for each route to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=0)  # number of trips for RouteX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=0)  # number of trips for RouteY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0)  # number of trips for RouteZ\nTechX = model.addVar(name=\"TechX\", lb=0)  # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(name=\"TechY\", lb=0)  # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumptionX = 50 - 0.005 * TechX * TripsX\nConsumptionY = 60 - 0.006 * TechY * TripsY\nConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n## the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\n## The company has a total budget of $100,000 for operations and technology investments.\nmodel.addCons(50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for RouteX: \", model.getVal(TripsX))\n    print(\"Number of Trips for RouteY: \", model.getVal(TripsY))\n    print(\"Number of Trips for RouteZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. \nFor Truck A, the operational cost per mile is $2, and it generates $5 per mile.\nFor Truck B, the operational cost per mile is $3, and it generates $6 per mile.\nFor Truck C, the operational cost per mile is $4, and it generates $7 per mile.\nFor Truck D, the operational cost per mile is $5, and it generates $8 per mile.\nFor Truck E, the operational cost per mile is $6, and it generates $9 per mile.\nThe company aims to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).\n// Net profit per mile of A: Profit_A = (5 - 2) * A\n// Net profit per mile of B: Profit_B = (6 - 3) * B\n// Net profit per mile of C: Profit_C = (7 - 4) * C\n// Net profit per mile of D: Profit_D = (8 - 5) * D\n// Net profit per mile of E: Profit_E = (9 - 6) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs for the month.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to deploy at least 5 trucks of each type for the month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be deployed in total.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month. The operational cost per mile and revenue generation per mile for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Revenue per Mile |\n|------------|--------------------------|------------------|\n| A          | $2                       | $5               |\n| B          | $3                       | $6               |\n| C          | $4                       | $7               |\n| D          | $5                       | $8               |\n| E          | $6                       | $9               |\n\nThe company has a budget of $10,000 for operational costs for the month. The company wants to deploy at least 5 trucks of each type for the month. The company has a limit of 100 trucks that can be deployed in total. \nPlease help the company to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to deploy at least 5 trucks of each type for the month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (6 - 3) * B\nProfit_C = (7 - 4) * C\nProfit_D = (8 - 5) * D\nProfit_E = (9 - 6) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs for the month.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\n// Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\n// Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed half of the total production.\n// UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC)\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30,000\n\n## Generate Constraint-4:\nTo maintain a diversified product line, at least one unit of each device must be produced each month.\n// UnitsA >= 1; UnitsB >= 1; UnitsC >= 1\n\n## Generate Constraint-5:\nDue to environmental regulations, the total production should not exceed the sustainable limit of 450 units.\n// UnitsA + UnitsB + UnitsC <= 450",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n\nThe company has a monthly production capacity of 500 units in total. Due to market saturation, the production of DeviceA should not exceed half of the total production. The company has a budget of $30,000 for production costs per month. To maintain a diversified product line, at least one unit of each device must be produced each month. Due to environmental regulations, the total production should not exceed the sustainable limit of 450 units.\n\nPlease help the company to determine the optimal number of units of each device to produce per month to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\nUnitsA_min = model.addVar(vtype=\"INTEGER\", name=\"UnitsA_min\")\nmodel.addCons(UnitsA_min <= UnitsA)\nmodel.addCons(UnitsA_min <= 1000 - 5 * UnitsA)\nProfit_A = (100 - 50) * UnitsA_min\n## create piecewise variables for piecewise function: Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\nUnitsB_min = model.addVar(vtype=\"INTEGER\", name=\"UnitsB_min\")\nmodel.addCons(UnitsB_min <= UnitsB)\nmodel.addCons(UnitsB_min <= 1500 - 10 * UnitsB)\nProfit_B = (120 - 70) * UnitsB_min\n## create piecewise variables for piecewise function: Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\nUnitsC_min = model.addVar(vtype=\"INTEGER\", name=\"UnitsC_min\")\nmodel.addCons(UnitsC_min <= UnitsC)\nmodel.addCons(UnitsC_min <= 2000 - 15 * UnitsC)\nProfit_C = (150 - 80) * UnitsC_min\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC))\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 450)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will enhance the product quality and potentially increase the selling price.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductA\": \"RnD_A\", \"range\": \"RnD_A >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductB\": \"RnD_B\", \"range\": \"RnD_B >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductC\": \"RnD_C\", \"range\": \"RnD_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in automation level for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 + 0.01 * RnD_A - (100 - 5 * AutomationA)) * UnitsA\n// Total profit for ProductB: ProfitB = (180 + 0.01 * RnD_B - (120 - 5 * AutomationB)) * UnitsB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * RnD_C - (150 - 5 * AutomationC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for automation and R&D investments.\n// AutomationA + AutomationB + AutomationC + RnD_A + RnD_B + RnD_C <= 100000\n\n## Generate Constraint-2:\nThe total number of units produced cannot exceed 10,000 units.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1000 units of ProductA and 2000 units of ProductB.\n// UnitsA >= 1000; UnitsB >= 2000\n\n## Generate Constraint-4:\nThe level of automation for any product cannot exceed 50 units.\n// AutomationA <= 50; AutomationB <= 50; AutomationC <= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the level of automation to implement in the production process, and the investment in research and development (R&D) for each product. The level of automation affects the production cost per unit and the production rate, while R&D investments enhance product quality and potentially increase the selling price. The initial production cost and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost | Initial Selling Price |\n|---------|-------------------------|-----------------------|\n| ProductA | $100                   | $150                  |\n| ProductB | $120                   | $180                  |\n| ProductC | $150                   | $200                  |\n\nThe production cost per unit decreases by $5 for every unit increase in automation level for that product. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The company has a total budget of $100,000 for automation and R&D investments. The total number of units produced cannot exceed 10,000 units. Due to market demand, the company must produce at least 1000 units of ProductA and 2000 units of ProductB. The level of automation for any product cannot exceed 50 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for ProductC\nRnD_A = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_A\", lb=0)  # investment in R&D for ProductA\nRnD_B = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_B\", lb=0)  # investment in R&D for ProductB\nRnD_C = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_C\", lb=0)  # investment in R&D for ProductC\n\n# Define objective function\nProfitA = (150 + 0.01 * RnD_A - (100 - 5 * AutomationA)) * UnitsA\nProfitB = (180 + 0.01 * RnD_B - (120 - 5 * AutomationB)) * UnitsB\nProfitC = (200 + 0.01 * RnD_C - (150 - 5 * AutomationC)) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationA + AutomationB + AutomationC + RnD_A + RnD_B + RnD_C <= 100000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\nmodel.addCons(UnitsA >= 1000)\nmodel.addCons(UnitsB >= 2000)\nmodel.addCons(AutomationA <= 50)\nmodel.addCons(AutomationB <= 50)\nmodel.addCons(AutomationC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Automation Level for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation Level for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation Level for ProductC: \", model.getVal(AutomationC))\n    print(\"R&D Investment for ProductA: \", model.getVal(RnD_A))\n    print(\"R&D Investment for ProductB: \", model.getVal(RnD_B))\n    print(\"R&D Investment for ProductC: \", model.getVal(RnD_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1484,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption rate of Truck1\": \"Truck1_FuelRate\", \"range\": \"Truck1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck2\": \"Truck2_FuelRate\", \"range\": \"Truck2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck3\": \"Truck3_FuelRate\", \"range\": \"Truck3_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van1\": \"Van1_FuelRate\", \"range\": \"Van1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van2\": \"Van2_FuelRate\", \"range\": \"Van2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"speed of Truck1\": \"Truck1_Speed\", \"range\": \"Truck1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck2\": \"Truck2_Speed\", \"range\": \"Truck2_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck3\": \"Truck3_Speed\", \"range\": \"Truck3_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van1\": \"Van1_Speed\", \"range\": \"Van1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van2\": \"Van2_Speed\", \"range\": \"Van2_Speed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type.\n// Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\n// So, the objective function is: Minimize Objective\n\n## Generate Constraint-1:\nThe total fuel consumption for all vehicles must not exceed 1000 liters.\n// Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000\n\n## Generate Constraint-2:\nThe total time taken for all deliveries must not exceed 50 hours.\n// (1 / Truck1_Speed) + (1 / Truck2_Speed) + (1 / Truck3_Speed) + (1 / Van1_Speed) + (1 / Van2_Speed) <= 50",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed. The company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type. The following table provides the fuel consumption rate and speed for each vehicle.\n\n| Vehicle  | Fuel Consumption Rate | Speed |\n|----------|----------------------|-------|\n| Truck1   | Truck1_FuelRate      | Truck1_Speed |\n| Truck2   | Truck2_FuelRate      | Truck2_Speed |\n| Truck3   | Truck3_FuelRate      | Truck3_Speed |\n| Van1     | Van1_FuelRate        | Van1_Speed |\n| Van2     | Van2_FuelRate        | Van2_Speed |\n\nThe company has a constraint that the total fuel consumption for all vehicles must not exceed 1000 liters. Additionally, the total time taken for all deliveries must not exceed 50 hours. Please help the company determine the optimal fuel consumption rates and speeds for each vehicle type to meet these constraints while minimizing the objective function.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_FuelRate\", lb=0)\nTruck2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_FuelRate\", lb=0)\nTruck3_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_FuelRate\", lb=0)\nVan1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_FuelRate\", lb=0)\nVan2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_FuelRate\", lb=0)\nTruck1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_Speed\", lb=0)\nTruck2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_Speed\", lb=0)\nTruck3_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_Speed\", lb=0)\nVan1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_Speed\", lb=0)\nVan2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_Speed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\nmodel.addCons(obj == Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed)\n\n# Add constraints\n## The total fuel consumption for all vehicles must not exceed 1000 liters.\nmodel.addCons(Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000)\n## The total time taken for all deliveries must not exceed 50 hours.\nmodel.addCons(1 / Truck1_Speed + 1 / Truck2_Speed + 1 / Truck3_Speed + 1 / Van1_Speed + 1 / Van2_Speed <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption Rate of Truck1: \", model.getVal(Truck1_FuelRate))\n    print(\"Fuel Consumption Rate of Truck2: \", model.getVal(Truck2_FuelRate))\n    print(\"Fuel Consumption Rate of Truck3: \", model.getVal(Truck3_FuelRate))\n    print(\"Fuel Consumption Rate of Van1: \", model.getVal(Van1_FuelRate))\n    print(\"Fuel Consumption Rate of Van2: \", model.getVal(Van2_FuelRate))\n    print(\"Speed of Truck1: \", model.getVal(Truck1_Speed))\n    print(\"Speed of Truck2: \", model.getVal(Truck2_Speed))\n    print(\"Speed of Truck3: \", model.getVal(Truck3_Speed))\n    print(\"Speed of Van1: \", model.getVal(Van1_Speed))\n    print(\"Speed of Van2: \", model.getVal(Van2_Speed))\n    print(\"Minimized Objective Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost per unit of product A\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product B\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product C\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product A\": \"RevenueA\", \"range\": \"RevenueA >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product B\": \"RevenueB\", \"range\": \"RevenueB >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product C\": \"RevenueC\", \"range\": \"RevenueC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, and the revenue per unit is $100.\nThe cost of producing each unit of product B is $70, and the revenue per unit is $140.\nThe cost of producing each unit of product C is $60, and the revenue per unit is $120.\nThe company wants to maximize the total profit.\n// Profit_A = UnitsA * (RevenueA - CostA)\n// Profit_B = UnitsB * (RevenueB - CostB)\n// Profit_C = UnitsC * (RevenueC - CostC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the machines is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The cost of producing each unit of product A is $50, and the revenue per unit is $100. The cost of producing each unit of product B is $70, and the revenue per unit is $140. The cost of producing each unit of product C is $60, and the revenue per unit is $120. The company wants to maximize the total profit. The total production capacity of the machines is 100 units per day. Please help the company determine the optimal production quantities of products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * (100 - 50) # Profit per unit of product A\nProfit_B = UnitsB * (140 - 70) # Profit per unit of product B\nProfit_C = UnitsC * (120 - 60) # Profit per unit of product C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C) # Objective function\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100) # Total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 705,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\n// Packages delivered by Trucks per hour: Packages_Trucks = 100 * Trucks * 50\n// Packages delivered by Vans per hour: Packages_Vans = 50 * Vans * 40\n// Packages delivered by Bikes per hour: Packages_Bikes = 10 * Bikes * 20\n// So, the objective function is: Maximize (Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\n// 100 * Trucks + 50 * Vans + 20 * Bikes <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to maximize its daily delivery efficiency, considering the different speeds and capacities of each vehicle.\nEach Truck can deliver 100 packages at a speed of 50 km/h, each Van can deliver 50 packages at a speed of 40 km/h, and each Bike can deliver 10 packages at a speed of 20 km/h. The company aims to maximize the total number of packages delivered per hour, considering the different speeds and capacities of each vehicle.\nThe company has a budget of $10,000 per day for vehicle maintenance. The maintenance cost for each Truck is $100, for each Van is $50, and for each Bike is $20.\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize the total number of packages delivered per hour.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nPackages_Trucks = 100 * Trucks * 50\nPackages_Vans = 50 * Vans * 40\nPackages_Bikes = 10 * Bikes * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Packages_Trucks + Packages_Vans + Packages_Bikes)\n\n# Add constraints\nmodel.addCons(100 * Trucks + 50 * Vans + 20 * Bikes <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Packages Delivered per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational cost while considering the efficiency of each vehicle type. The operational cost per vehicle is a nonlinear function of the number of vehicles, given by:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\nThe objective is to minimize the total operational cost.\n// Total operational cost = 10000 + 50 * Truck1^2 + 12000 + 40 * Truck2^2 + 8000 + 60 * Van1^2 + 9000 + 55 * Van2^2 + 5000 + 70 * Sedan^2\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for vehicle acquisition.\n// 10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 different vehicles in total.\n// Truck1 + Truck2 + Van1 + Van2 + Sedan >= 10\n\n## Generate Constraint-3:\nThe number of Sedans must not exceed 30% of the total number of vehicles.\n// Sedan <= 0.3 * (Truck1 + Truck2 + Van1 + Van2 + Sedan)\n\n## Generate Constraint-4:\nThe total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles.\n// Truck1 + Truck2 >= 0.4 * (Truck1 + Truck2 + Van1 + Van2 + Sedan)",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Van1, Van2, and Sedan) to optimize their delivery routes and costs. The company wants to minimize the total operational cost, which is a nonlinear function of the number of vehicles:\n- For Truck1, cost = 10000 + 50 * Truck1^2\n- For Truck2, cost = 12000 + 40 * Truck2^2\n- For Van1, cost = 8000 + 60 * Van1^2\n- For Van2, cost = 9000 + 55 * Van2^2\n- For Sedan, cost = 5000 + 70 * Sedan^2\n\nThe company has a budget of $500,000 for vehicle acquisition. They must have at least 10 different vehicles in total. The number of Sedans must not exceed 30% of the total number of vehicles. The total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles.\n\nPlease help the company determine the optimal number of each type of vehicle to minimize the total operational cost while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0)\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0)\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost = 10000 + 50 * Truck1^2 + 12000 + 40 * Truck2^2 + 8000 + 60 * Van1^2 + 9000 + 55 * Van2^2 + 5000 + 70 * Sedan^2\nmodel.addCons(obj == 10000 + 50 * Truck1**2 + 12000 + 40 * Truck2**2 + 8000 + 60 * Van1**2 + 9000 + 55 * Van2**2 + 5000 + 70 * Sedan**2)\n\n# Add constraints\n## The company has a budget of $500,000 for vehicle acquisition.\nmodel.addCons(10000 * Truck1 + 12000 * Truck2 + 8000 * Van1 + 9000 * Van2 + 5000 * Sedan <= 500000)\n## The company must have at least 10 different vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Van1 + Van2 + Sedan >= 10)\n## The number of Sedans must not exceed 30% of the total number of vehicles.\nmodel.addCons(Sedan <= 0.3 * (Truck1 + Truck2 + Van1 + Van2 + Sedan))\n## The total number of trucks (Truck1 and Truck2 combined) must be at least 40% of the total number of vehicles.\nmodel.addCons(Truck1 + Truck2 >= 0.4 * (Truck1 + Truck2 + Van1 + Van2 + Sedan))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Number of Sedan: \", model.getVal(Sedan))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120\n\n## Generate Constraint-2:\nMachine 1 can operate for a maximum of 50 hours per week.\n// M1 <= 50",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency of each machine in producing both products is given in the following Table.\n\n| Machine | Units of Product A per Hour | Units of Product B per Hour |\n|---------|-----------------------------|-----------------------------|\n| 1       | 10                          | 5                           |\n| 2       | 8                           | 12                          |\n| 3       | 6                           | 15                          |\n\nProduct A is valued at $20 per unit, and Product B is valued at $30 per unit. The company aims to maximize the total production value. The total operating hours for all machines must not exceed 120 hours per week. Additionally, Machine 1 can operate for a maximum of 50 hours per week.\n\nPlease help the company determine the optimal number of hours each machine should operate to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB) # objective function: Maximize (VA + VB)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 120) # total operating hours for all machines must not exceed 120 hours per week\nmodel.addCons(M1 <= 50) # Machine 1 can operate for a maximum of 50 hours per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductE\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor ProductA, the profit per unit is $50, the production cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the profit per unit is $70, the production cost per unit is $40, and the storage cost per unit is $8.\nFor ProductC, the profit per unit is $60, the production cost per unit is $35, and the storage cost per unit is $6.\nFor ProductD, the profit per unit is $80, the production cost per unit is $50, and the storage cost per unit is $10.\nFor ProductE, the profit per unit is $90, the production cost per unit is $60, and the storage cost per unit is $12.\nThe company wants to maximize the net profit, which is the total profit minus the total production and storage costs.\n// Total net profit: NetProfit = (50 - 30 - 5) * ProductA + (70 - 40 - 8) * ProductB + (60 - 35 - 6) * ProductC + (80 - 50 - 10) * ProductD + (90 - 60 - 12) * ProductE\n// So, the objective function is: Maximize NetProfit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 10000",
        "question": "A manufacturing company produces five types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints.\nFor ProductA, the profit per unit is $50, the production cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the profit per unit is $70, the production cost per unit is $40, and the storage cost per unit is $8.\nFor ProductC, the profit per unit is $60, the production cost per unit is $35, and the storage cost per unit is $6.\nFor ProductD, the profit per unit is $80, the production cost per unit is $50, and the storage cost per unit is $10.\nFor ProductE, the profit per unit is $90, the production cost per unit is $60, and the storage cost per unit is $12.\nThe company wants to maximize the net profit, which is the total profit minus the total production and storage costs. The company has a total production capacity of 10,000 units per month.\nPlease help the company determine the optimal production quantities for each product to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of ProductC\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of ProductD\nProductE = model.addVar(vtype=\"INTEGER\", name=\"ProductE\", lb=0) # number of units of ProductE\n\n# Define objective function\nNetProfit = (50 - 30 - 5) * ProductA + (70 - 40 - 8) * ProductB + (60 - 35 - 6) * ProductC + (80 - 50 - 10) * ProductD + (90 - 60 - 12) * ProductE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Number of ProductD: \", model.getVal(ProductD))\n    print(\"Number of ProductE: \", model.getVal(ProductE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for TypeA\": \"TurbinesA\", \"range\": \"TurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeB\": \"TurbinesB\", \"range\": \"TurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeC\": \"TurbinesC\", \"range\": \"TurbinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TypeA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms.\n// EnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\n// EnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\n// EnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n// So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for turbine installation and maintenance investments.\n// 10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000\n\n## Generate Constraint-2:\nThe total number of turbines that can be installed is limited to 100.\n// TurbinesA + TurbinesB + TurbinesC <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must install at least 20 turbines of TypeA and 30 turbines of TypeB.\n// TurbinesA >= 20; TurbinesB >= 30\n\n## Generate Constraint-4:\nThe maximum maintenance investment for each type of wind farm is capped at $5000.\n// MaintenanceA <= 5000; MaintenanceB <= 5000; MaintenanceC <= 5000",
        "question": "A renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms. The company has a total budget of $100,000 for turbine installation and maintenance investments. The total number of turbines that can be installed is limited to 100. Due to regulatory requirements, the company must install at least 20 turbines of TypeA and 30 turbines of TypeB. The maximum maintenance investment for each type of wind farm is capped at $5000. Please help the company to maximize the total energy output from all wind farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"TurbinesA\", lb=20)  # number of turbines for TypeA\nTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"TurbinesB\", lb=30)  # number of turbines for TypeB\nTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"TurbinesC\", lb=0)    # number of turbines for TypeC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0, ub=5000)  # maintenance investment for TypeA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0, ub=5000)  # maintenance investment for TypeB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0, ub=5000)  # maintenance investment for TypeC\n\n# Define objective function\nEnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\nEnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\nEnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n# So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n# Add constraints\n# The company has a total budget of $100,000 for turbine installation and maintenance investments.\nmodel.addCons(10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000)\n# The total number of turbines that can be installed is limited to 100.\nmodel.addCons(TurbinesA + TurbinesB + TurbinesC <= 100)\n# Due to regulatory requirements, the company must install at least 20 turbines of TypeA and 30 turbines of TypeB.\nmodel.addCons(TurbinesA >= 20)\nmodel.addCons(TurbinesB >= 30)\n# The maximum maintenance investment for each type of wind farm is capped at $5000.\nmodel.addCons(MaintenanceA <= 5000)\nmodel.addCons(MaintenanceB <= 5000)\nmodel.addCons(MaintenanceC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for TypeA: \", model.getVal(TurbinesA))\n    print(\"Number of Turbines for TypeB: \", model.getVal(TurbinesB))\n    print(\"Number of Turbines for TypeC: \", model.getVal(TurbinesC))\n    print(\"Maintenance Investment for TypeA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TypeB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TypeC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels in five different districts (District1, District2, District3, District4, District5) to optimize energy production and minimize environmental impact.\n// {\"number of solar panels in District1\": \"District1\", \"range\": \"District1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in District2\": \"District2\", \"range\": \"District2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in District3\": \"District3\", \"range\": \"District3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in District4\": \"District4\", \"range\": \"District4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in District5\": \"District5\", \"range\": \"District5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different levels of sunlight exposure and panel technology. The efficiency rates are as follows:\n- District1: 80% efficiency, $1000 per panel, and a carbon footprint of 50 kg CO2 per panel.\n- District2: 75% efficiency, $1200 per panel, and a carbon footprint of 60 kg CO2 per panel.\n- District3: 70% efficiency, $1100 per panel, and a carbon footprint of 70 kg CO2 per panel.\n- District4: 85% efficiency, $1300 per panel, and a carbon footprint of 55 kg CO2 per panel.\n- District5: 90% efficiency, $1500 per panel, and a carbon footprint of 65 kg CO2 per panel.\nThe city aims to maximize the total energy production while minimizing the total carbon footprint. The objective is to maximize the Energy-Carbon ratio (total energy production divided by total carbon footprint).\n// Total energy production: Energy = 0.8 * 1000 * District1 + 0.75 * 1200 * District2 + 0.7 * 1100 * District3 + 0.85 * 1300 * District4 + 0.9 * 1500 * District5\n// Total carbon footprint: Carbon = 50 * District1 + 60 * District2 + 70 * District3 + 55 * District4 + 65 * District5\n// So, the objective function is: Maximize Energy / Carbon\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for installing solar panels.\n// 1000 * District1 + 1200 * District2 + 1100 * District3 + 1300 * District4 + 1500 * District5 <= 1000000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all districts is limited to 1000 panels.\n// District1 + District2 + District3 + District4 + District5 <= 1000\n\n## Generate Constraint-3:\nEach district must have at least 50 solar panels installed.\n// District1 >= 50\n// District2 >= 50\n// District3 >= 50\n// District4 >= 50\n// District5 >= 50\n\n## Generate Constraint-4:\nThe total carbon footprint from all districts should not exceed 60,000 kg CO2.\n// 50 * District1 + 60 * District2 + 70 * District3 + 55 * District4 + 65 * District5 <= 60000",
        "question": "A city is planning to install solar panels in five different districts (District1, District2, District3, District4, District5) to optimize energy production and minimize environmental impact. The efficiency of solar panels varies by district due to different levels of sunlight exposure and panel technology. The efficiency rates are as follows:\n- District1: 80% efficiency, $1000 per panel, and a carbon footprint of 50 kg CO2 per panel.\n- District2: 75% efficiency, $1200 per panel, and a carbon footprint of 60 kg CO2 per panel.\n- District3: 70% efficiency, $1100 per panel, and a carbon footprint of 70 kg CO2 per panel.\n- District4: 85% efficiency, $1300 per panel, and a carbon footprint of 55 kg CO2 per panel.\n- District5: 90% efficiency, $1500 per panel, and a carbon footprint of 65 kg CO2 per panel.\nThe city aims to maximize the total energy production while minimizing the total carbon footprint. The objective is to maximize the Energy-Carbon ratio (total energy production divided by total carbon footprint). The city has a budget of $1,000,000 for installing solar panels. The total number of solar panels that can be installed across all districts is limited to 1000 panels. Each district must have at least 50 solar panels installed. The total carbon footprint from all districts should not exceed 60,000 kg CO2.\nPlease help the city determine the optimal number of solar panels to install in each district to achieve the objective.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDistrict1 = model.addVar(vtype=\"INTEGER\", name=\"District1\", lb=50)\nDistrict2 = model.addVar(vtype=\"INTEGER\", name=\"District2\", lb=50)\nDistrict3 = model.addVar(vtype=\"INTEGER\", name=\"District3\", lb=50)\nDistrict4 = model.addVar(vtype=\"INTEGER\", name=\"District4\", lb=50)\nDistrict5 = model.addVar(vtype=\"INTEGER\", name=\"District5\", lb=50)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * 1000 * District1 + 0.75 * 1200 * District2 + 0.7 * 1100 * District3 + 0.85 * 1300 * District4 + 0.9 * 1500 * District5\nCarbon = 50 * District1 + 60 * District2 + 70 * District3 + 55 * District4 + 65 * District5\n## the objective function is: Maximize Energy / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Energy)\n\n# Add constraints\n## The city has a budget of $1,000,000 for installing solar panels.\nmodel.addCons(1000 * District1 + 1200 * District2 + 1100 * District3 + 1300 * District4 + 1500 * District5 <= 1000000)\n## The total number of solar panels that can be installed across all districts is limited to 1000 panels.\nmodel.addCons(District1 + District2 + District3 + District4 + District5 <= 1000)\n## Each district must have at least 50 solar panels installed.\nmodel.addCons(District1 >= 50)\nmodel.addCons(District2 >= 50)\nmodel.addCons(District3 >= 50)\nmodel.addCons(District4 >= 50)\nmodel.addCons(District5 >= 50)\n## The total carbon footprint from all districts should not exceed 60,000 kg CO2.\nmodel.addCons(50 * District1 + 60 * District2 + 70 * District3 + 55 * District4 + 65 * District5 <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in District1: \", model.getVal(District1))\n    print(\"Number of Solar Panels in District2: \", model.getVal(District2))\n    print(\"Number of Solar Panels in District3: \", model.getVal(District3))\n    print(\"Number of Solar Panels in District4: \", model.getVal(District4))\n    print(\"Number of Solar Panels in District5: \", model.getVal(District5))\n    print(\"Maximized Energy-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the nonlinear relationship between production quantity and market saturation, which affects the selling price. The objective function is to maximize the total profit, considering a nonlinear decrease in selling price with increased production:\n// Profit_A = (20 - 10 - 0.01 * A^2) * A\n// Profit_B = (30 - 15 - 0.01 * B^2) * B\n// Profit_C = (40 - 20 - 0.01 * C^2) * C\n// Profit_D = (50 - 25 - 0.01 * D^2) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours, with product A requiring 2 hours per unit, product B requiring 3 hours per unit, product C requiring 4 hours per unit, and product D requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company has a minimum production requirement of 10 units for each product.\n// A >= 10; B >= 10; C >= 10; D >= 10\n\n## Generate Constraint-5:\nThe company wants to maintain a balance in production, ensuring that the difference in production quantities between any two products does not exceed 20 units.\n// |A - B| <= 20; |A - C| <= 20; |A - D| <= 20; |B - C| <= 20; |B - D| <= 20; |C - D| <= 20",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantities for each product to optimize its operations. The profit per unit, production cost per unit, and production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|-------------------------|\n| A       | $20             | $10                      | 2 hours                 |\n| B       | $30             | $15                      | 3 hours                 |\n| C       | $40             | $20                      | 4 hours                 |\n| D       | $50             | $25                      | 5 hours                 |\n\nThe company has a budget of $5000 for production costs. The company has a limited production capacity of 200 hours. The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C. The company has a minimum production requirement of 10 units for each product. The company wants to maintain a balance in production, ensuring that the difference in production quantities between any two products does not exceed 20 units.\n\nPlease help the company to maximize the total profit, considering a nonlinear decrease in selling price with increased production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## convert the quadratic terms to linear terms using additional variables\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\nmodel.addCons(D_sq == D * D)\nProfit_A = (20 - 10 - 0.01 * A_sq) * A\nProfit_B = (30 - 15 - 0.01 * B_sq) * B\nProfit_C = (40 - 20 - 0.01 * C_sq) * C\nProfit_D = (50 - 25 - 0.01 * D_sq) * D\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n## The company has a limited production capacity of 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 200)\n## The company wants to ensure that the production of product D does not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company has a minimum production requirement of 10 units for each product.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\nmodel.addCons(D >= 10)\n## The company wants to maintain a balance in production, ensuring that the difference in production quantities between any two products does not exceed 20 units.\nmodel.addCons(A - B <= 20)\nmodel.addCons(B - A <= 20)\nmodel.addCons(A - C <= 20)\nmodel.addCons(C - A <= 20)\nmodel.addCons(A - D <= 20)\nmodel.addCons(D - A <= 20)\nmodel.addCons(B - C <= 20)\nmodel.addCons(C - B <= 20)\nmodel.addCons(B - D <= 20)\nmodel.addCons(D - B <= 20)\nmodel.addCons(C - D <= 20)\nmodel.addCons(D - C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1406,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. The operational costs and the units of goods each vehicle type can transport are given in the following Table.\n\n| Vehicle Type | Operational Cost per Month | Units of Goods Transported |\n|--------------|----------------------------|----------------------------|\n| Truck A      | $1000                      | 1000                       |\n| Truck B      | $1200                      | 1200                       |\n| Truck C      | $1500                      | 1500                       |\n| Truck D      | $1800                      | 1800                       |\n| Truck E      | $2000                      | 2000                       |\n\nThe company has a budget of $100,000 for operational costs for the upcoming month. The company must transport at least 50,000 units of goods. The company has a limit on the number of vehicles it can deploy, specifically, it can deploy at most 50 vehicles in total.\n\nPlease help the company to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n## The company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints.\n// {\"number of DeviceA\": \"DeviceANum\", \"range\": \"DeviceANum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceBNum\", \"range\": \"DeviceBNum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceCNum\", \"range\": \"DeviceCNum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company aims to maximize the total profit.\n// Profit_DeviceA = (100 - 50) * DeviceANum\n// Profit_DeviceB = (150 - 75) * DeviceBNum\n// Profit_DeviceC = (200 - 100) * DeviceCNum\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// DeviceANum + DeviceBNum + DeviceCNum <= 500\n\n## Generate Constraint-2:\nDue to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBNum <= 2 * DeviceANum\n\n## Generate Constraint-3:\nThe market demand for DeviceC is limited to 150 units per month.\n// DeviceCNum <= 150",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| DeviceA | $100            | $50                      |\n| DeviceB | $150            | $75                      |\n| DeviceC | $200            | $100                     |\n\nThe company has a total production capacity of 500 units per month. Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA. The market demand for DeviceC is limited to 150 units per month.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceANum = model.addVar(vtype=\"INTEGER\", name=\"DeviceANum\", lb=0) # number of DeviceA\nDeviceBNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceBNum\", lb=0) # number of DeviceB\nDeviceCNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceCNum\", lb=0) # number of DeviceC\n\n# Define objective function\nProfit_DeviceA = (100 - 50) * DeviceANum\nProfit_DeviceB = (150 - 75) * DeviceBNum\nProfit_DeviceC = (200 - 100) * DeviceCNum\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 500 units per month.\nmodel.addCons(DeviceANum + DeviceBNum + DeviceCNum <= 500)\n# Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBNum <= 2 * DeviceANum)\n# The market demand for DeviceC is limited to 150 units per month.\nmodel.addCons(DeviceCNum <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceANum))\n    print(\"Number of DeviceB: \", model.getVal(DeviceBNum))\n    print(\"Number of DeviceC: \", model.getVal(DeviceCNum))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5.\nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4.\nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3.\nThe manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_E1 = 30000 * E1 - 20000 * E1\n// NetRevenue_E2 = 40000 * E2 - 25000 * E2\n// NetRevenue_E3 = 50000 * E3 - 30000 * E3\n// So, the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / (5 * E1 + 4 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and environmental impact score per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Environmental Impact Score per Unit |\n|--------------|------------------|--------------------------|--------------------------------------|\n| E1           | $30,000          | $20,000                  | 5                                    |\n| E2           | $40,000          | $25,000                  | 4                                    |\n| E3           | $50,000          | $30,000                  | 3                                    |\n\nThe manufacturer has a total production budget of $1,000,000. The manufacturer has a limited production capacity of 50 vehicles. Please help the manufacturer to maximize the net revenue per environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_E1 = 30000 * E1 - 20000 * E1\nNetRevenue_E2 = 40000 * E2 - 25000 * E2\nNetRevenue_E3 = 50000 * E3 - 30000 * E3\nEnvironmentalImpact = 5 * E1 + 4 * E2 + 3 * E3\n## the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000)\n## The manufacturer has a limited production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed.\n// {\"speed of truck 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of truck 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = Distance / FuelEfficiency. The fuel efficiency decreases nonlinearly with increasing speed due to aerodynamic drag. The company aims to minimize the total fuel consumption across all trucks and routes.\n// FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n// FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n// TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\n// Speed1 <= 80; Speed2 <= 100\n\n## Generate Constraint-3:\nThe minimum required number of trucks on route 1 is 10, and on route 2 is 20.\n// Trucks1 >= 10; Trucks2 >= 20\n\n## Generate Constraint-4:\nThe initial fuel efficiency of truck 1 is 10 km/liter at 60 km/h, and of truck 2 is 12 km/liter at 60 km/h.\n// Efficiency1 = 10 * (1 - 0.005 * (Speed1 - 60)^2)\n// Efficiency2 = 12 * (1 - 0.005 * (Speed2 - 60)^2)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed. The fuel consumption of each truck is a nonlinear function of its speed, and the company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is 50. The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h. The minimum required number of trucks on route 1 is 10, and on route 2 is 20. The initial fuel efficiency of truck 1 is 10 km/liter at 60 km/h, and of truck 2 is 12 km/liter at 60 km/h. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120) # speed of truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120) # speed of truck 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on route 2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # fuel efficiency of truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # fuel efficiency of truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n## FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n## TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n## convert the division to multiplication\nmodel.addCons(obj == Trucks1 * (Efficiency1 * (1 - 0.005 * (Speed1 - 60)**2)) + Trucks2 * (Efficiency2 * (1 - 0.005 * (Speed2 - 60)**2)))\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n## The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 100)\n## The minimum required number of trucks on route 1 is 10, and on route 2 is 20.\nmodel.addCons(Trucks1 >= 10)\nmodel.addCons(Trucks2 >= 20)\n## The initial fuel efficiency of truck 1 is 10 km/liter at 60 km/h, and of truck 2 is 12 km/liter at 60 km/h.\nmodel.addCons(Efficiency1 == 10 * (1 - 0.005 * (Speed1 - 60)**2))\nmodel.addCons(Efficiency2 == 12 * (1 - 0.005 * (Speed2 - 60)**2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output during peak demand periods.\n// {\"number of solar panels in RegionA\": \"SolarPanelsA\", \"range\": \"SolarPanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarPanelsB\", \"range\": \"SolarPanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarPanelsC\", \"range\": \"SolarPanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindTurbinesA\", \"range\": \"WindTurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindTurbinesB\", \"range\": \"WindTurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindTurbinesC\", \"range\": \"WindTurbinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines varies with the investment in energy storage systems. For every $10,000 invested in energy storage, the efficiency of both solar panels and wind turbines increases by 1%. The initial energy output per solar panel is 200 kWh, and per wind turbine is 500 kWh. The company aims to maximize the total energy output from all regions.\n// Total energy output for RegionA: OutputA = (200 * SolarPanelsA + 500 * WindTurbinesA) * (1 + 0.0001 * EnergyStorage)\n// Total energy output for RegionB: OutputB = (200 * SolarPanelsB + 500 * WindTurbinesB) * (1 + 0.0001 * EnergyStorage)\n// Total energy output for RegionC: OutputC = (200 * SolarPanelsC + 500 * WindTurbinesC) * (1 + 0.0001 * EnergyStorage)\n// So, the objective function is: Maximize (OutputA + OutputB + OutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for installing solar panels and wind turbines.\n// 2000 * SolarPanelsA + 5000 * WindTurbinesA + 2000 * SolarPanelsB + 5000 * WindTurbinesB + 2000 * SolarPanelsC + 5000 * WindTurbinesC <= 500000\n\n## Generate Constraint-2:\nThe total investment in energy storage systems cannot exceed $100,000.\n// EnergyStorage <= 100000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in each region cannot exceed the number of solar panels by more than 50%.\n// WindTurbinesA <= 1.5 * SolarPanelsA; WindTurbinesB <= 1.5 * SolarPanelsB; WindTurbinesC <= 1.5 * SolarPanelsC",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output during peak demand periods. The energy output from solar panels and wind turbines varies with the investment in energy storage systems. For every $10,000 invested in energy storage, the efficiency of both solar panels and wind turbines increases by 1%. The initial energy output per solar panel is 200 kWh, and per wind turbine is 500 kWh. The company aims to maximize the total energy output from all regions. The company has a total budget of $500,000 for installing solar panels and wind turbines. The total investment in energy storage systems cannot exceed $100,000. Due to regional regulations, the number of wind turbines in each region cannot exceed the number of solar panels by more than 50%. Please help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanelsA = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsA\", lb=0)  # number of solar panels in RegionA\nSolarPanelsB = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsB\", lb=0)  # number of solar panels in RegionB\nSolarPanelsC = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsC\", lb=0)  # number of solar panels in RegionC\nWindTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesA\", lb=0)  # number of wind turbines in RegionA\nWindTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesB\", lb=0)  # number of wind turbines in RegionB\nWindTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesC\", lb=0)  # number of wind turbines in RegionC\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)  # investment in energy storage systems\n\n# Define objective function\nOutputA = (200 * SolarPanelsA + 500 * WindTurbinesA) * (1 + 0.0001 * EnergyStorage)\nOutputB = (200 * SolarPanelsB + 500 * WindTurbinesB) * (1 + 0.0001 * EnergyStorage)\nOutputC = (200 * SolarPanelsC + 500 * WindTurbinesC) * (1 + 0.0001 * EnergyStorage)\n# So, the objective function is: Maximize (OutputA + OutputB + OutputC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == OutputA + OutputB + OutputC)\n\n# Add constraints\n# The company has a total budget of $500,000 for installing solar panels and wind turbines.\nmodel.addCons(2000 * SolarPanelsA + 5000 * WindTurbinesA + 2000 * SolarPanelsB + 5000 * WindTurbinesB + 2000 * SolarPanelsC + 5000 * WindTurbinesC <= 500000)\n# The total investment in energy storage systems cannot exceed $100,000.\nmodel.addCons(EnergyStorage <= 100000)\n# Due to regional regulations, the number of wind turbines in each region cannot exceed the number of solar panels by more than 50%.\nmodel.addCons(WindTurbinesA <= 1.5 * SolarPanelsA)\nmodel.addCons(WindTurbinesB <= 1.5 * SolarPanelsB)\nmodel.addCons(WindTurbinesC <= 1.5 * SolarPanelsC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarPanelsA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarPanelsB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarPanelsC))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindTurbinesA))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindTurbinesB))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindTurbinesC))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(EnergyStorage))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. Additionally, the company is considering investing in hybrid technology for some vehicles to reduce fuel consumption, which varies based on the type of vehicle and the level of hybridization.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Trucks\": \"HybridTruck\", \"range\": \"HybridTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Vans\": \"HybridVan\", \"range\": \"HybridVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Bikes\": \"HybridBike\", \"range\": \"HybridBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter.\n// FuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\n// FuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\n// FuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\n// TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and operational constraints.\n// TruckCount + VanCount + BikeCount <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize daily delivery capacity while minimizing fuel costs. Additionally, the company is considering investing in hybrid technology for some vehicles to reduce fuel consumption, which varies based on the type of vehicle and the level of hybridization. The fuel efficiency of each vehicle type improves with the investment in hybrid technology. For Trucks, each $1000 investment in hybrid technology reduces fuel consumption by 0.1 liters per kilometer. For Vans, each $1000 investment reduces fuel consumption by 0.08 liters per kilometer. For Bikes, each $1000 investment reduces fuel consumption by 0.01 liters per kilometer. The company aims to minimize the total daily fuel cost, given that Trucks consume 0.5 liters per kilometer, Vans consume 0.3 liters per kilometer, and Bikes consume 0.1 liters per kilometer. The fuel price is $1 per liter. The company has a budget of $100,000 for vehicle purchases and hybrid technology investments. The total number of vehicles cannot exceed 100 due to parking and operational constraints.\n\nPlease help the company to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nHybridTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridTruck\", lb=0)\nHybridVan = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridVan\", lb=0)\nHybridBike = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridBike\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDailyDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"DailyDistance\", lb=0)\nFuelCost_Trucks = 0.5 * (1 - 0.1 * HybridTruck / 1000) * TruckCount * DailyDistance\nFuelCost_Vans = 0.3 * (1 - 0.08 * HybridVan / 1000) * VanCount * DailyDistance\nFuelCost_Bikes = 0.1 * (1 - 0.01 * HybridBike / 1000) * BikeCount * DailyDistance\n## the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Bikes)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and hybrid technology investments.\nmodel.addCons(TruckCount + VanCount + BikeCount + HybridTruck + HybridVan + HybridBike <= 100000)\n## The total number of vehicles cannot exceed 100 due to parking and operational constraints.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Hybrid Technology for Trucks: \", model.getVal(HybridTruck))\n    print(\"Investment in Hybrid Technology for Vans: \", model.getVal(HybridVan))\n    print(\"Investment in Hybrid Technology for Bikes: \", model.getVal(HybridBike))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified five districts (North, South, East, West, and Central) where solar panels can be installed. The decision variables include the number of solar panels to be installed in each district.\n// {\"number of solar panels in North district\": \"NorthPanels\", \"range\": \"NorthPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in South district\": \"SouthPanels\", \"range\": \"SouthPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in East district\": \"EastPanels\", \"range\": \"EastPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in West district\": \"WestPanels\", \"range\": \"WestPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Central district\": \"CentralPanels\", \"range\": \"CentralPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel in the North district is $1000, and it generates $200 worth of energy annually.\nIn the South district, the cost is $1200, and it generates $240 worth of energy annually.\nIn the East district, the cost is $900, and it generates $180 worth of energy annually.\nIn the West district, the cost is $1100, and it generates $220 worth of energy annually.\nIn the Central district, the cost is $1300, and it generates $260 worth of energy annually.\nThe city aims to maximize the net annual benefit from the solar panels, which is the total energy generated minus the installation cost.\n// NetBenefit_North = 200 * NorthPanels - 1000 * NorthPanels\n// NetBenefit_South = 240 * SouthPanels - 1200 * SouthPanels\n// NetBenefit_East = 180 * EastPanels - 900 * EastPanels\n// NetBenefit_West = 220 * WestPanels - 1100 * WestPanels\n// NetBenefit_Central = 260 * CentralPanels - 1300 * CentralPanels\n// So, the objective function is: Maximize (NetBenefit_North + NetBenefit_South + NetBenefit_East + NetBenefit_West + NetBenefit_Central)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * NorthPanels + 1200 * SouthPanels + 900 * EastPanels + 1100 * WestPanels + 1300 * CentralPanels <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels to be installed across all districts must not exceed 500.\n// NorthPanels + SouthPanels + EastPanels + WestPanels + CentralPanels <= 500\n\n## Generate Constraint-3:\nAt least 100 solar panels must be installed in the North district.\n// NorthPanels >= 100\n\n## Generate Constraint-4:\nNo more than 20% of the total budget can be spent on solar panels in the Central district.\n// 1300 * CentralPanels <= 0.2 * 500000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified five districts (North, South, East, West, and Central) where solar panels can be installed. The decision variables include the number of solar panels to be installed in each district. The cost of installing a solar panel and the annual energy generation for each district are given in the following Table.\n\n| District      | Installation Cost | Annual Energy Generation |\n|---------------|-------------------|---------------------------|\n| North         | $1000             | $200                      |\n| South         | $1200             | $240                      |\n| East          | $900              | $180                      |\n| West          | $1100             | $220                      |\n| Central       | $1300             | $260                      |\n\nThe city has a budget of $500,000 for the installation of solar panels. The total number of solar panels to be installed across all districts must not exceed 500. At least 100 solar panels must be installed in the North district. No more than 20% of the total budget can be spent on solar panels in the Central district. \n\nPlease help the city to maximize the net annual benefit from the solar panels, which is the total energy generated minus the installation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthPanels = model.addVar(vtype=\"INTEGER\", name=\"NorthPanels\", lb=100)  # number of solar panels in North district\nSouthPanels = model.addVar(vtype=\"INTEGER\", name=\"SouthPanels\", lb=0)  # number of solar panels in South district\nEastPanels = model.addVar(vtype=\"INTEGER\", name=\"EastPanels\", lb=0)  # number of solar panels in East district\nWestPanels = model.addVar(vtype=\"INTEGER\", name=\"WestPanels\", lb=0)  # number of solar panels in West district\nCentralPanels = model.addVar(vtype=\"INTEGER\", name=\"CentralPanels\", lb=0)  # number of solar panels in Central district\n\n# Define objective function\nNetBenefit_North = 200 * NorthPanels - 1000 * NorthPanels\nNetBenefit_South = 240 * SouthPanels - 1200 * SouthPanels\nNetBenefit_East = 180 * EastPanels - 900 * EastPanels\nNetBenefit_West = 220 * WestPanels - 1100 * WestPanels\nNetBenefit_Central = 260 * CentralPanels - 1300 * CentralPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetBenefit_North + NetBenefit_South + NetBenefit_East + NetBenefit_West + NetBenefit_Central)\n\n# Add constraints\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * NorthPanels + 1200 * SouthPanels + 900 * EastPanels + 1100 * WestPanels + 1300 * CentralPanels <= 500000)\n# The total number of solar panels to be installed across all districts must not exceed 500.\nmodel.addCons(NorthPanels + SouthPanels + EastPanels + WestPanels + CentralPanels <= 500)\n# At least 100 solar panels must be installed in the North district.\nmodel.addCons(NorthPanels >= 100)\n# No more than 20% of the total budget can be spent on solar panels in the Central district.\nmodel.addCons(1300 * CentralPanels <= 0.2 * 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in North District: \", model.getVal(NorthPanels))\n    print(\"Number of Solar Panels in South District: \", model.getVal(SouthPanels))\n    print(\"Number of Solar Panels in East District: \", model.getVal(EastPanels))\n    print(\"Number of Solar Panels in West District: \", model.getVal(WestPanels))\n    print(\"Number of Solar Panels in Central District: \", model.getVal(CentralPanels))\n    print(\"Maximized Net Annual Benefit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1386,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: Type1, Type2, and Type3. Additionally, the company is considering investing in advanced routing software to optimize fuel consumption and delivery times, which varies in effectiveness depending on the type of cargo.\n// {\"number of trucks for Type1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Type3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in routing software for Type1\": \"Software1\", \"range\": \"Software1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Type2\": \"Software2\", \"range\": \"Software2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software for Type3\": \"Software3\", \"range\": \"Software3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel efficiency of each type of truck improves with the investment in routing software, but the relationship is nonlinear. Specifically, for every $1000 invested in software, the fuel efficiency increases by 1% for Type1, 1.5% for Type2, and 2% for Type3. The initial fuel cost per mile for Type1 is $0.8, for Type2 is $0.7, and for Type3 is $0.6.\n// Fuel cost for Type1: Cost1 = 0.8 * (1 - 0.01 * Software1) * Trucks1\n// Fuel cost for Type2: Cost2 = 0.7 * (1 - 0.015 * Software2) * Trucks2\n// Fuel cost for Type3: Cost3 = 0.6 * (1 - 0.02 * Software3) * Trucks3\n// The cost of purchasing trucks is $100,000 per truck for all types.\n// So, the objective function is: Minimize (100000 * (Trucks1 + Trucks2 + Trucks3) + Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for both truck purchases and software investments.\n// 100000 * (Trucks1 + Trucks2 + Trucks3) + Software1 + Software2 + Software3 <= 5000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50 due to parking and maintenance limitations.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 10 trucks for Type1 and 15 trucks for Type2.\n// Trucks1 >= 10; Trucks2 >= 15",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: Type1, Type2, and Type3. Additionally, the company is considering investing in advanced routing software to optimize fuel consumption and delivery times, which varies in effectiveness depending on the type of cargo. The company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel efficiency of each type of truck improves with the investment in routing software, but the relationship is nonlinear. Specifically, for every $1000 invested in software, the fuel efficiency increases by 1% for Type1, 1.5% for Type2, and 2% for Type3. The initial fuel cost per mile for Type1 is $0.8, for Type2 is $0.7, and for Type3 is $0.6. The cost of purchasing trucks is $100,000 per truck for all types.\n\n| Cargo Type | Initial Fuel Cost per Mile | Fuel Efficiency Improvement per $1000 Software Investment |\n|------------|----------------------------|--------------------------------------------------------|\n| Type1      | $0.8                       | 1%                                                     |\n| Type2      | $0.7                       | 1.5%                                                   |\n| Type3      | $0.6                       | 2%                                                     |\n\nThe company has a budget of $5,000,000 for both truck purchases and software investments. The total number of trucks cannot exceed 50 due to parking and maintenance limitations. Due to contractual obligations, the company must have at least 10 trucks for Type1 and 15 trucks for Type2.\n\nPlease help the company to determine the optimal number of trucks and the investment in routing software to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Type1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Type2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)   # number of trucks for Type3\nSoftware1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software1\", lb=0)  # investment in routing software for Type1\nSoftware2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software2\", lb=0)  # investment in routing software for Type2\nSoftware3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software3\", lb=0)  # investment in routing software for Type3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 0.8 * (1 - 0.01 * Software1) * Trucks1\nCost2 = 0.7 * (1 - 0.015 * Software2) * Trucks2\nCost3 = 0.6 * (1 - 0.02 * Software3) * Trucks3\nTruckCost = 100000 * (Trucks1 + Trucks2 + Trucks3)\n## the objective function is: Minimize (TruckCost + Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == TruckCost + Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $5,000,000 for both truck purchases and software investments.\nmodel.addCons(TruckCost + Software1 + Software2 + Software3 <= 5000000)\n## The total number of trucks cannot exceed 50 due to parking and maintenance limitations.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Type1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Type2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Type3: \", model.getVal(Trucks3))\n    print(\"Investment in Software for Type1: \", model.getVal(Software1))\n    print(\"Investment in Software for Type2: \", model.getVal(Software2))\n    print(\"Investment in Software for Type3: \", model.getVal(Software3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1868,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit.\n// {\"hours machine 1 works on product 1\": \"M1P1\", \"range\": \"M1P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 1\": \"M2P1\", \"range\": \"M2P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 1\": \"M3P1\", \"range\": \"M3P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 1\": \"M4P1\", \"range\": \"M4P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 2\": \"M1P2\", \"range\": \"M1P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 2\": \"M2P2\", \"range\": \"M2P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 2\": \"M3P2\", \"range\": \"M3P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 2\": \"M4P2\", \"range\": \"M4P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 3\": \"M1P3\", \"range\": \"M1P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 3\": \"M2P3\", \"range\": \"M2P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 3\": \"M3P3\", \"range\": \"M3P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 3\": \"M4P3\", \"range\": \"M4P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per hour for each product. The profit per hour for product 1 on machine 1 is $100, on machine 2 is $120, on machine 3 is $110, and on machine 4 is $130. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. The objective is to maximize the total profit from all products.\n// The objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n## Generate Constraint-1:\nEach machine can operate a maximum of 100 hours per week.\n// M1P1 + M1P2 + M1P3 <= 100; M2P1 + M2P2 + M2P3 <= 100; M3P1 + M3P2 + M3P3 <= 100; M4P1 + M4P2 + M4P3 <= 100\n\n## Generate Constraint-2:\nThe total production hours for product 1 must not exceed 150 hours.\n// M1P1 + M2P1 + M3P1 + M4P1 <= 150\n\n## Generate Constraint-3:\nThe total production hours for product 2 must not exceed 200 hours.\n// M1P2 + M2P2 + M3P2 + M4P2 <= 200",
        "question": "A manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit. Each machine has a different efficiency and profit contribution per hour for each product. For product 1, the profits per hour are $100, $120, $110, and $130 for machines 1, 2, 3, and 4 respectively. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. Each machine can operate a maximum of 100 hours per week. The total production hours for product 1 must not exceed 150 hours, and for product 2, it must not exceed 200 hours. Please help the plant manager to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P1\", lb=0) # hours machine 1 works on product 1\nM2P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P1\", lb=0) # hours machine 2 works on product 1\nM3P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P1\", lb=0) # hours machine 3 works on product 1\nM4P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P1\", lb=0) # hours machine 4 works on product 1\nM1P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P2\", lb=0) # hours machine 1 works on product 2\nM2P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P2\", lb=0) # hours machine 2 works on product 2\nM3P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P2\", lb=0) # hours machine 3 works on product 2\nM4P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P2\", lb=0) # hours machine 4 works on product 2\nM1P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P3\", lb=0) # hours machine 1 works on product 3\nM2P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P3\", lb=0) # hours machine 2 works on product 3\nM3P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P3\", lb=0) # hours machine 3 works on product 3\nM4P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P3\", lb=0) # hours machine 4 works on product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\nmodel.addCons(obj == 100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1 + 150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2 + 200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n# Add constraints\n## Each machine can operate a maximum of 100 hours per week.\nmodel.addCons(M1P1 + M1P2 + M1P3 <= 100)\nmodel.addCons(M2P1 + M2P2 + M2P3 <= 100)\nmodel.addCons(M3P1 + M3P2 + M3P3 <= 100)\nmodel.addCons(M4P1 + M4P2 + M4P3 <= 100)\n## The total production hours for product 1 must not exceed 150 hours.\nmodel.addCons(M1P1 + M2P1 + M3P1 + M4P1 <= 150)\n## The total production hours for product 2 must not exceed 200 hours.\nmodel.addCons(M1P2 + M2P2 + M3P2 + M4P2 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 works on Product 1: \", model.getVal(M1P1))\n    print(\"Hours Machine 2 works on Product 1: \", model.getVal(M2P1))\n    print(\"Hours Machine 3 works on Product 1: \", model.getVal(M3P1))\n    print(\"Hours Machine 4 works on Product 1: \", model.getVal(M4P1))\n    print(\"Hours Machine 1 works on Product 2: \", model.getVal(M1P2))\n    print(\"Hours Machine 2 works on Product 2: \", model.getVal(M2P2))\n    print(\"Hours Machine 3 works on Product 2: \", model.getVal(M3P2))\n    print(\"Hours Machine 4 works on Product 2: \", model.getVal(M4P2))\n    print(\"Hours Machine 1 works on Product 3: \", model.getVal(M1P3))\n    print(\"Hours Machine 2 works on Product 3: \", model.getVal(M2P3))\n    print(\"Hours Machine 3 works on Product 3: \", model.getVal(M3P3))\n    print(\"Hours Machine 4 works on Product 3: \", model.getVal(M4P3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality. The quality improvement affects the defect rate and thus the cost of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost per unit of ProductA is $60, ProductB is $80, and ProductC is $120, but these costs decrease by $0.5 for every $10,000 invested in R&D. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.0005 * RnDInvestment) * QuantityA - MarketingA/1000 * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.0005 * RnDInvestment) * QuantityB - MarketingB/1000 * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 120 + 0.0005 * RnDInvestment) * QuantityC - MarketingC/1000 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity for all products cannot exceed 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget for all products must not exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe investment in R&D cannot exceed $100,000.\n// RnDInvestment <= 100000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA must be at least 2,000 units, and ProductB must be at least 1,500 units.\n// QuantityA >= 2000; QuantityB >= 1500\n\n## Generate Constraint-5:\nThe company must allocate at least $10,000 to the marketing budget for ProductC.\n// MarketingC >= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality. The quality improvement affects the defect rate and thus the cost of each product.\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost per unit of ProductA is $60, ProductB is $80, and ProductC is $120, but these costs decrease by $0.5 for every $10,000 invested in R&D. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\nThe total production quantity for all products cannot exceed 10,000 units. The total marketing budget for all products must not exceed $50,000. The investment in R&D cannot exceed $100,000. Due to market demand, the production of ProductA must be at least 2,000 units, and ProductB must be at least 1,500 units. The company must allocate at least $10,000 to the marketing budget for ProductC.\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0) # investment in R&D\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (100 - 60 + 0.0005 * RnDInvestment) * QuantityA - MarketingA/1000 * QuantityA\n## Total profit for ProductB: ProfitB = (150 - 80 + 0.0005 * RnDInvestment) * QuantityB - MarketingB/1000 * QuantityB\n## Total profit for ProductC: ProfitC = (200 - 120 + 0.0005 * RnDInvestment) * QuantityC - MarketingC/1000 * QuantityC\nProfitA = (100 - 60 + 0.0005 * RnDInvestment) * QuantityA - MarketingA/1000 * QuantityA\nProfitB = (150 - 80 + 0.0005 * RnDInvestment) * QuantityB - MarketingB/1000 * QuantityB\nProfitC = (200 - 120 + 0.0005 * RnDInvestment) * QuantityC - MarketingC/1000 * QuantityC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production quantity for all products cannot exceed 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n## The total marketing budget for all products must not exceed $50,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n## The investment in R&D cannot exceed $100,000.\nmodel.addCons(RnDInvestment <= 100000)\n## Due to market demand, the production of ProductA must be at least 2,000 units, and ProductB must be at least 1,500 units.\nmodel.addCons(QuantityA >= 2000)\nmodel.addCons(QuantityB >= 1500)\n## The company must allocate at least $10,000 to the marketing budget for ProductC.\nmodel.addCons(MarketingC >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"R&D Investment: \", model.getVal(RnDInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. \nFor S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. \nFor S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60.\nFor S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70.\nThe manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_S1 = 100 * S1 - 40 * S1\n// Profit_S2 = 120 * S2 - 50 * S2\n// Profit_S3 = 140 * S3 - 60 * S3\n// Profit_S4 = 160 * S4 - 70 * S4\n// So, the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / (1 * S1 + 2 * S2 + 3 * S3 + 4 * S4)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production time of 200 hours.\n// 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $10000 for material costs.\n// 40 * S1 + 50 * S2 + 60 * S3 + 70 * S4 <= 10000\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 500 units in terms of the number of units it can produce.\n// S1 + S2 + S3 + S4 <= 500\n\n## Generate Constraint-4:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3, and a new type of solar panel S4. They need to determine the quantities of each solar panel to produce. For S1, the revenue per unit is $100, the production time per unit is 1 hour, and the material cost per unit is $40. For S2, the revenue per unit is $120, the production time per unit is 2 hours, and the material cost per unit is $50. For S3, the revenue per unit is $140, the production time per unit is 3 hours, and the material cost per unit is $60. For S4, the revenue per unit is $160, the production time per unit is 4 hours, and the material cost per unit is $70. The manufacturer has a limited production line and can only produce one type of solar panel at a time. The manufacturer wants to maximize the profit efficiency (profit per hour of production time). The manufacturer has a limited production time of 200 hours. The manufacturer has a budget of $10000 for material costs. The manufacturer has a production capacity of 500 units in terms of the number of units it can produce. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1. Please help the manufacturer determine the optimal quantities of each solar panel to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0)  # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0)  # quantity of S3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0)  # quantity of S4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S1 = (100 - 40) * S1\nProfit_S2 = (120 - 50) * S2\nProfit_S3 = (140 - 60) * S3\nProfit_S4 = (160 - 70) * S4\nProductionTime = 1 * S1 + 2 * S2 + 3 * S3 + 4 * S4\n## the objective function is: Maximize (Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_S1 + Profit_S2 + Profit_S3 + Profit_S4)\n\n# Add constraints\n## The manufacturer has a limited production time of 200 hours.\nmodel.addCons(1 * S1 + 2 * S2 + 3 * S3 + 4 * S4 <= 200)\n## The manufacturer has a budget of $10000 for material costs.\nmodel.addCons(40 * S1 + 50 * S2 + 60 * S3 + 70 * S4 <= 10000)\n## The manufacturer has a production capacity of 500 units in terms of the number of units it can produce.\nmodel.addCons(S1 + S2 + S3 + S4 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Quantity of S4: \", model.getVal(S4))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company has 4 different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each type of device. The efficiency is measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota.\n// Efficiency for device 1: E1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\n// Efficiency for device 2: E2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\n// Efficiency for device 3: E3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n// The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3.\n// Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for assignment.\n// P1 + P2 + P3 + P4 <= 50\n\n## Generate Constraint-2:\nEach production line can handle up to 12 workers at a time.\n// P1 <= 12; P2 <= 12; P3 <= 12; P4 <= 12",
        "question": "A manufacturing company produces 3 types of electronic devices and has 4 different production lines. The company needs to determine the number of workers to assign to each line to optimize production efficiency. The efficiency of each production line in producing each type of device is measured in units produced per worker per hour. The company aims to maximize the total production of all devices while ensuring each device meets a certain production quota. The efficiency for each device and production line is given in the following Table.\n\n| Device | Production Line Efficiency (units/worker/hour) |\n|--------|-----------------------------------------------|\n| 1      | 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4         |\n| 2      | 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4         |\n| 3      | 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4         |\n\nThe company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3. There are a total of 50 workers available for assignment. Each production line can handle up to 12 workers at a time.\n\nPlease help the company to maximize the production efficiency by determining the optimal number of workers to assign to each production line, aiming to maximize the minimum of the production quotas divided by the respective efficiencies (1000 / E1, 1500 / E2, 2000 / E3).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of workers on production line 4\n\n# Define objective function\n## Efficiency for device 1: E1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\n## Efficiency for device 2: E2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\n## Efficiency for device 3: E3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\nE1 = 10 * P1 + 15 * P2 + 20 * P3 + 25 * P4\nE2 = 12 * P1 + 18 * P2 + 24 * P3 + 30 * P4\nE3 = 14 * P1 + 21 * P2 + 28 * P3 + 35 * P4\n## The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3.\n## Objective function: Maximize min(1000 / E1, 1500 / E2, 2000 / E3)\n## Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * E1 >= 1000)\nmodel.addCons(obj * E2 >= 1500)\nmodel.addCons(obj * E3 >= 2000)\n\n# Add constraints\n## There are a total of 50 workers available for assignment.\nmodel.addCons(P1 + P2 + P3 + P4 <= 50)\n## Each production line can handle up to 12 workers at a time.\nmodel.addCons(P1 <= 12)\nmodel.addCons(P2 <= 12)\nmodel.addCons(P3 <= 12)\nmodel.addCons(P4 <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(P1))\n    print(\"Number of workers on production line 2: \", model.getVal(P2))\n    print(\"Number of workers on production line 3: \", model.getVal(P3))\n    print(\"Number of workers on production line 4: \", model.getVal(P4))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company also needs to decide on the investment in alternative fuel technologies for each vehicle type to reduce environmental impact and operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Small trucks\": \"AltFuelSmall\", \"range\": \"AltFuelSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Medium trucks\": \"AltFuelMedium\", \"range\": \"AltFuelMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Large trucks\": \"AltFuelLarge\", \"range\": \"AltFuelLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost reduction due to alternative fuel technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces the operational cost by $10 per truck per year. For Medium trucks, each $1000 invested reduces the operational cost by $15 per truck per year. For Large trucks, each $1000 invested reduces the operational cost by $20 per truck per year. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (InitialCostSmall - 0.01 * AltFuelSmall) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (InitialCostMedium - 0.015 * AltFuelMedium) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (InitialCostLarge - 0.02 * AltFuelLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for fleet expansion and alternative fuel technology investments.\n// SmallTrucks + MediumTrucks + LargeTrucks + AltFuelSmall + AltFuelMedium + AltFuelLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company also needs to decide on the investment in alternative fuel technologies for each vehicle type to reduce environmental impact and operational costs. The operational cost reduction due to alternative fuel technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces the operational cost by $10 per truck per year. For Medium trucks, each $1000 invested reduces the operational cost by $15 per truck per year. For Large trucks, each $1000 invested reduces the operational cost by $20 per truck per year. The company aims to minimize the total operational cost of the fleet. The company has a budget of $200,000 for fleet expansion and alternative fuel technology investments. The total number of trucks in the fleet must not exceed 100.\n\nPlease help the company determine the optimal number of each type of truck and the investment in alternative fuel technology to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nAltFuelSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelSmall\", lb=0)  # investment in alternative fuel technology for Small trucks\nAltFuelMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelMedium\", lb=0)  # investment in alternative fuel technology for Medium trucks\nAltFuelLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelLarge\", lb=0)  # investment in alternative fuel technology for Large trucks\n\n# Define objective function\n## Operational cost for Small trucks: CostSmall = (InitialCostSmall - 0.01 * AltFuelSmall) * SmallTrucks\n## Operational cost for Medium trucks: CostMedium = (InitialCostMedium - 0.015 * AltFuelMedium) * MediumTrucks\n## Operational cost for Large trucks: CostLarge = (InitialCostLarge - 0.02 * AltFuelLarge) * LargeTrucks\n## So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nCostSmall = (100 - 0.01 * AltFuelSmall) * SmallTrucks\nCostMedium = (100 - 0.015 * AltFuelMedium) * MediumTrucks\nCostLarge = (100 - 0.02 * AltFuelLarge) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n## The company has a budget of $200,000 for fleet expansion and alternative fuel technology investments.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + AltFuelSmall + AltFuelMedium + AltFuelLarge <= 200000)\n## The total number of trucks in the fleet must not exceed 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Alternative Fuel for Small Trucks: \", model.getVal(AltFuelSmall))\n    print(\"Investment in Alternative Fuel for Medium Trucks: \", model.getVal(AltFuelMedium))\n    print(\"Investment in Alternative Fuel for Large Trucks: \", model.getVal(AltFuelLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks.\n// {\"number of trucks for Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Zone1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones.\n// Operational cost for Zone1: Cost1 = (500 - 0.1 * Upgrade1) * Trucks1\n// Operational cost for Zone2: Cost2 = (500 - 0.1 * Upgrade2) * Trucks2\n// Operational cost for Zone3: Cost3 = (500 - 0.1 * Upgrade3) * Trucks3\n// Operational cost for Zone4: Cost4 = (500 - 0.1 * Upgrade4) * Trucks4\n// Operational cost for Zone5: Cost5 = (500 - 0.1 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-3:\nDue to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\n// Trucks1 >= 20; Trucks2 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks. The operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones. The company has a total of 100 trucks available for allocation. The total budget for fuel efficiency upgrades is $100,000. Due to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks. Please help the company to minimize the total operational cost across all zones.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Zone5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Zone1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Zone2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Zone3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Zone4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Zone5\n\n# Define objective function\nCost1 = (500 - 0.1 * Upgrade1) * Trucks1\nCost2 = (500 - 0.1 * Upgrade2) * Trucks2\nCost3 = (500 - 0.1 * Upgrade3) * Trucks3\nCost4 = (500 - 0.1 * Upgrade4) * Trucks4\nCost5 = (500 - 0.1 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n# The total budget for fuel efficiency upgrades is $100,000.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n# Due to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Zone5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Zone1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Zone2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Zone3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Zone4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Zone5: \", model.getVal(Upgrade5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\n// {\"number of trucks allocated to Region A\": \"Truck_A\", \"range\": \"Truck_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"Truck_B\", \"range\": \"Truck_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"Truck_C\", \"range\": \"Truck_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"Truck_D\", \"range\": \"Truck_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"Truck_E\", \"range\": \"Truck_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n// Total revenue: Revenue = $100 * Truck_A + $120 * Truck_B + $140 * Truck_C + $160 * Truck_D + $180 * Truck_E\n// Total operational cost: Cost = $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E\n// Total delivery time: Time = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n// So, the objective function is: Maximize (Revenue / (Cost + Time))\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for operational costs.\n// $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E <= $50000",
        "question": "A logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\nThe company has a total budget of $50,000 for operational costs.\nPlease help the company to determine the optimal number of trucks to allocate to each region to maximize the efficiency ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_A = model.addVar(vtype=\"INTEGER\", name=\"Truck_A\", lb=0) # number of trucks allocated to Region A\nTruck_B = model.addVar(vtype=\"INTEGER\", name=\"Truck_B\", lb=0) # number of trucks allocated to Region B\nTruck_C = model.addVar(vtype=\"INTEGER\", name=\"Truck_C\", lb=0) # number of trucks allocated to Region C\nTruck_D = model.addVar(vtype=\"INTEGER\", name=\"Truck_D\", lb=0) # number of trucks allocated to Region D\nTruck_E = model.addVar(vtype=\"INTEGER\", name=\"Truck_E\", lb=0) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 100 * Truck_A + 120 * Truck_B + 140 * Truck_C + 160 * Truck_D + 180 * Truck_E\nCost = 500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E\nTime = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n## the objective function is: Maximize (Revenue / (Cost + Time))\n## convert the division to multiplication\nmodel.addCons(obj * (Cost + Time) == Revenue)\n\n# Add constraints\n## The company has a total budget of $50,000 for operational costs.\nmodel.addCons(500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(Truck_A))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(Truck_B))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(Truck_C))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(Truck_D))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(Truck_E))\n    print(\"Maximized Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel efficiency upgrade. The base fuel consumption for Route1 is 50 liters per 100 km, which decreases by 1 liter per 100 km for every $100 invested in upgrades. For Route2, the base consumption is 60 liters per 100 km, decreasing by 1.2 liters per 100 km for every $100 invested. For Route3, the base consumption is 70 liters per 100 km, decreasing by 1.4 liters per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (50 - 0.01 * Upgrade1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (60 - 0.012 * Upgrade2) * Trucks2\n// Fuel consumption for Route3: Consumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200",
        "question": "A logistics company is planning its routes for delivering goods to multiple cities. The company needs to decide the number of trucks to allocate to each route and the fuel efficiency upgrades for each truck type. The goal is to minimize the total fuel consumption while meeting delivery demands and considering the cost of fuel efficiency upgrades. The base fuel consumption and the effect of upgrades on fuel consumption for each route are given in the following Table.\n\n| Route | Base Fuel Consumption (liters/100 km) | Decrease in Consumption per $100 Upgrade (liters/100 km) |\n|-------|--------------------------------------|---------------------------------------------------------|\n| Route1 | 50                                  | 1                                                       |\n| Route2 | 60                                  | 1.2                                                     |\n| Route3 | 70                                  | 1.4                                                     |\n\nThe company has a budget of $10,000 for fuel efficiency upgrades. The total number of trucks available is limited to 200. Please help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nUpgrade1 = model.addVar(name=\"Upgrade1\", lb=0) # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(name=\"Upgrade2\", lb=0) # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(name=\"Upgrade3\", lb=0) # fuel efficiency upgrade for Route3\n\n# Define objective function\nConsumption1 = (50 - 0.01 * Upgrade1) * Trucks1\nConsumption2 = (60 - 0.012 * Upgrade2) * Trucks2\nConsumption3 = (70 - 0.014 * Upgrade3) * Trucks3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel efficiency upgrades.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# The total number of trucks available is limited to 200.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all product lines.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $150                   |\n| ProductB | $150                             | $200                   |\n| ProductC | $200                             | $250                   |\n\nThe production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The company has a total of 100 workers available for all product lines. \n\nPlease help the company to maximize the total profit from all products, considering the constraints on the number of workers and the investments in production efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # capital investment for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # capital investment for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # capital investment for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment for ProductA: \", model.getVal(InvestmentA))\n    print(\"Capital Investment for ProductB: \", model.getVal(InvestmentB))\n    print(\"Capital Investment for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The decision involves determining the number of solar panels to install in each district.\n// {\"number of solar panels in district A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent.\n// Energy production: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\n// Total cost: Cost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n// So, the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / (1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000\n\n## Generate Constraint-2:\nEach district must have at least 100 solar panels installed.\n// A >= 100; B >= 100; C >= 100; D >= 100; E >= 100\n\n## Generate Constraint-3:\nThe total number of solar panels installed across all districts should not exceed 500.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe number of solar panels in district C should not exceed the combined number of panels in districts A and B.\n// C <= A + B",
        "question": "A city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city has a budget of $500,000 for the installation of solar panels. Each district must have at least 100 solar panels installed. The total number of solar panels installed across all districts should not exceed 500. The number of solar panels in district C should not exceed the combined number of panels in districts A and B. The city aims to maximize the energy production per dollar spent.\n\nPlease help the city determine the optimal number of solar panels to install in each district to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each district must have at least 100 solar panels installed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of solar panels in district A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=100) # number of solar panels in district B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # number of solar panels in district C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=100) # number of solar panels in district D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=100) # number of solar panels in district E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\nCost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n## the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000)\n## The total number of solar panels installed across all districts should not exceed 500.\nmodel.addCons(A + B + C + D + E <= 500)\n## The number of solar panels in district C should not exceed the combined number of panels in districts A and B.\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in District A: \", model.getVal(A))\n    print(\"Number of Solar Panels in District B: \", model.getVal(B))\n    print(\"Number of Solar Panels in District C: \", model.getVal(C))\n    print(\"Number of Solar Panels in District D: \", model.getVal(D))\n    print(\"Number of Solar Panels in District E: \", model.getVal(E))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production. Additionally, the company must determine the number of hours of maintenance each machine requires daily.\n// {\"number of operating hours for MachineA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n// Net revenue for MachineA: RevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\n// Net revenue for MachineB: RevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\n// Net revenue for MachineC: RevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total daily operating hours for all machines must not exceed 24 hours.\n// HoursA + HoursB + HoursC <= 24\n\n## Generate Constraint-2:\nThe total daily maintenance hours for all machines must not exceed 8 hours.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 8\n\n## Generate Constraint-3:\nMachineA must operate at least 2 hours daily.\n// HoursA >= 2\n\n## Generate Constraint-4:\nMachineB and MachineC combined must not operate more than 16 hours daily.\n// HoursB + HoursC <= 16",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production and the number of hours of maintenance each machine requires daily. Each hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day. The total daily operating hours for all machines must not exceed 24 hours. The total daily maintenance hours for all machines must not exceed 8 hours. MachineA must operate at least 2 hours daily. MachineB and MachineC combined must not operate more than 16 hours daily. Please help the company to maximize the total net revenue per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of operating hours for MachineA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of operating hours for MachineB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of operating hours for MachineC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # number of maintenance hours for MachineA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # number of maintenance hours for MachineB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # number of maintenance hours for MachineC\n\n# Define objective function\nRevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\nRevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\nRevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The total daily operating hours for all machines must not exceed 24 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 24)\n# The total daily maintenance hours for all machines must not exceed 8 hours.\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 8)\n# MachineA must operate at least 2 hours daily.\nmodel.addCons(HoursA >= 2)\n# MachineB and MachineC combined must not operate more than 16 hours daily.\nmodel.addCons(HoursB + HoursC <= 16)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for MachineA: \", model.getVal(HoursA))\n    print(\"Operating Hours for MachineB: \", model.getVal(HoursB))\n    print(\"Operating Hours for MachineC: \", model.getVal(HoursC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month to optimize fuel efficiency and reduce carbon emissions. Additionally, the company is considering investing in hybrid technology upgrades for each vehicle type to further improve fuel efficiency.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for TruckA\": \"HybridA\", \"range\": \"HybridA >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckB\": \"HybridB\", \"range\": \"HybridB >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for TruckC\": \"HybridC\", \"range\": \"HybridC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for TruckA, the fuel consumption per trip decreases by 0.1 liters. For TruckB, the decrease is 0.15 liters per $1000, and for TruckC, it's 0.2 liters per $1000. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (5 - 0.0001 * HybridA) * TripsA\n// Fuel consumption for TruckB: ConsumptionB = (6 - 0.00015 * HybridB) * TripsB\n// Fuel consumption for TruckC: ConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\n// 1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2000.\n// TripsA + TripsB + TripsC <= 2000\n\n## Generate Constraint-3:\nDue to maintenance schedules, TruckA can make no more than 500 trips, and TruckB can make no more than 600 trips.\n// TripsA <= 500; TripsB <= 600\n\n## Generate Constraint-4:\nTo meet contractual obligations, at least 300 trips must be made by TruckC.\n// TripsC >= 300",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of trips each vehicle should make in the next month and the investment in hybrid technology upgrades for each vehicle type to optimize fuel efficiency and reduce carbon emissions. The fuel efficiency of each vehicle type improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for TruckA, the fuel consumption per trip decreases by 0.1 liters. For TruckB, the decrease is 0.15 liters per $1000, and for TruckC, it's 0.2 liters per $1000. The company aims to minimize the total fuel consumption across all vehicles. The company has a total budget of $100,000 for hybrid technology upgrades and operational costs. The total number of trips across all vehicles must not exceed 2000. Due to maintenance schedules, TruckA can make no more than 500 trips, and TruckB can make no more than 600 trips. To meet contractual obligations, at least 300 trips must be made by TruckC. Please help the company to determine the optimal number of trips and the investment in hybrid technology for each vehicle type to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=300)  # number of trips for TruckC\nHybridA = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridA\", lb=0)  # investment in hybrid technology for TruckA\nHybridB = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridB\", lb=0)  # investment in hybrid technology for TruckB\nHybridC = model.addVar(vtype=\"CONTINUOUS\", name=\"HybridC\", lb=0)  # investment in hybrid technology for TruckC\n\n# Define objective function\nConsumptionA = (5 - 0.0001 * HybridA) * TripsA\nConsumptionB = (6 - 0.00015 * HybridB) * TripsB\nConsumptionC = (7 - 0.0002 * HybridC) * TripsC\n# So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n# The company has a total budget of $100,000 for hybrid technology upgrades and operational costs.\nmodel.addCons(1000 * HybridA + 1000 * HybridB + 1000 * HybridC + 5 * TripsA + 6 * TripsB + 7 * TripsC <= 100000)\n# The total number of trips across all vehicles must not exceed 2000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n# Due to maintenance schedules, TruckA can make no more than 500 trips, and TruckB can make no more than 600 trips.\nmodel.addCons(TripsA <= 500)\nmodel.addCons(TripsB <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Hybrid Technology for TruckA: \", model.getVal(HybridA))\n    print(\"Investment in Hybrid Technology for TruckB: \", model.getVal(HybridB))\n    print(\"Investment in Hybrid Technology for TruckC: \", model.getVal(HybridC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"daily operational cost per Truck\": \"TruckCost\", \"range\": \"TruckCost >= 0\", \"type\": \"continuous\"}\n// {\"daily operational cost per Van\": \"VanCost\", \"range\": \"VanCost >= 0\", \"type\": \"continuous\"}\n// {\"daily operational cost per Bike\": \"BikeCost\", \"range\": \"BikeCost >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type depends on the number of deliveries and the distance traveled, which is influenced by the operational cost and fuel efficiency. Trucks generate $100 per delivery, Vans generate $70 per delivery, and Bikes generate $30 per delivery. The operational cost of Trucks is $50 per day, Vans is $30 per day, and Bikes is $10 per day. The company aims to maximize the total daily profit.\n// Profit_Truck = 100 * TruckCount - TruckCost\n// Profit_Van = 70 * VanCount - VanCost\n// Profit_Bike = 30 * BikeCount - BikeCost\n// So, the objective function is: Maximize (Profit_Truck + Profit_Van + Profit_Bike)\n\n## Generate Constraint-1:\nThe total daily operational budget for all vehicles is $10,000.\n// TruckCost * TruckCount + VanCost * VanCount + BikeCost * BikeCount <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// TruckCount + VanCount + BikeCount <= 200\n\n## Generate Constraint-3:\nDue to maintenance limitations, the number of Trucks cannot exceed 50, and the number of Vans cannot exceed 100.\n// TruckCount <= 50; VanCount <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the number of each type of vehicle to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and vehicle capacities. The revenue generated by each vehicle type depends on the number of deliveries and the distance traveled, which is influenced by the operational cost and fuel efficiency. Trucks generate $100 per delivery, Vans generate $70 per delivery, and Bikes generate $30 per delivery. The operational cost of Trucks is $50 per day, Vans is $30 per day, and Bikes is $10 per day. The company aims to maximize the total daily profit.\n\n| Vehicle Type | Revenue per Delivery | Operational Cost per Day |\n|--------------|----------------------|--------------------------|\n| Trucks       | $100                 | $50                      |\n| Vans         | $70                  | $30                      |\n| Bikes        | $30                  | $10                      |\n\nThe total daily operational budget for all vehicles is $10,000. The total number of vehicles cannot exceed 200. Due to maintenance limitations, the number of Trucks cannot exceed 50, and the number of Vans cannot exceed 100. Please help the company to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckCost = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckCost\", lb=0)  # daily operational cost per Truck\nVanCost = model.addVar(vtype=\"CONTINUOUS\", name=\"VanCost\", lb=0)  # daily operational cost per Van\nBikeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeCost\", lb=0)  # daily operational cost per Bike\n\n# Define objective function\nProfit_Truck = 100 * TruckCount - TruckCost\nProfit_Van = 70 * VanCount - VanCost\nProfit_Bike = 30 * BikeCount - BikeCost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Truck + Profit_Van + Profit_Bike)\n\n# Add constraints\n# The total daily operational budget for all vehicles is $10,000.\nmodel.addCons(TruckCost * TruckCount + VanCost * VanCount + BikeCost * BikeCount <= 10000)\n# The total number of vehicles cannot exceed 200.\nmodel.addCons(TruckCount + VanCount + BikeCount <= 200)\n# Due to maintenance limitations, the number of Trucks cannot exceed 50, and the number of Vans cannot exceed 100.\nmodel.addCons(TruckCount <= 50)\nmodel.addCons(VanCount <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Daily Operational Cost of Trucks: \", model.getVal(TruckCost))\n    print(\"Daily Operational Cost of Vans: \", model.getVal(VanCost))\n    print(\"Daily Operational Cost of Bikes: \", model.getVal(BikeCost))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine how many units of each device to produce in the next quarter to optimize its resource usage and profitability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and requires a different amount of raw materials and labor hours. The profit per unit for A is $50, for B is $70, for C is $90, and for D is $110. The raw material cost per unit for A is $20, for B is $30, for C is $40, and for D is $50. The labor hours required per unit for A is 3 hours, for B is 4 hours, for C is 5 hours, and for D is 6 hours. The company aims to maximize the total profit per labor hour used.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (3 * A + 4 * B + 5 * C + 6 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 15000\n\n## Generate Constraint-2:\nThe company has a maximum of 1000 labor hours available for the next quarter.\n// 3 * A + 4 * B + 5 * C + 6 * D <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\n// C <= A + B",
        "question": "A manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine how many units of each device to produce in the next quarter to optimize its resource usage and profitability. The profit per unit, raw material cost per unit, and labor hours required per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit | Labor Hours per Unit |\n|--------|-----------------|----------------------------|----------------------|\n| A      | $50             | $20                        | 3 hours              |\n| B      | $70             | $30                        | 4 hours              |\n| C      | $90             | $40                        | 5 hours              |\n| D      | $110            | $50                        | 6 hours              |\n\nThe company has a budget of $15,000 for raw materials for the next quarter. The company has a maximum of 1000 labor hours available for the next quarter. The company wants to ensure that the production of device C does not exceed the combined production of devices A and B. \nPlease help the company to maximize the total profit per labor hour used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\nLaborHours = 3 * A + 4 * B + 5 * C + 6 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $15,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 15000)\n## The company has a maximum of 1000 labor hours available for the next quarter.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D <= 1000)\n## The company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered. The company has a budget of $100,000 for vehicle purchases and software investments. Please help the company to determine the optimal number of each type of vehicle to purchase, the amount of fuel to allocate to each vehicle, and the investment in the routing software.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)  # investment in routing software\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitial_efficiency_A = 10  # example initial efficiency for TruckA in km/liter\nInitial_efficiency_B = 12  # example initial efficiency for TruckB in km/liter\nInitial_efficiency_C = 15  # example initial efficiency for TruckC in km/liter\nDistance_A = 1000  # example distance for TruckA in km\nDistance_B = 1500  # example distance for TruckB in km\nDistance_C = 2000  # example distance for TruckC in km\n## the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n## convert the division to multiplication\nmodel.addCons(obj == (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA +\n              (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB +\n              (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nCost_A = 20000  # example cost for TruckA\nCost_B = 25000  # example cost for TruckB\nCost_C = 30000  # example cost for TruckC\nmodel.addCons(TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\n// B >= 0.1 * (T + V + B)\n\n## Generate Constraint-4:\nThe company has a daily revenue target of $20,000.\n// 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000\n\n## Generate Constraint-5:\nThe company wants to limit the number of Trucks to no more than twice the number of Vans.\n// T <= 2 * V",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Trip | Fuel Consumption per Trip | Number of Trips per Day |\n|--------------|------------------|---------------------------|--------------------------|\n| Trucks       | $1000            | 50 liters                 | 2                        |\n| Vans         | $500             | 20 liters                 | 3                        |\n| Bikes        | $100             | 1 liter                   | 5                        |\n\nThe company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery. The company has a daily revenue target of $20,000. The company wants to limit the number of Trucks to no more than twice the number of Vans.\n\nPlease help the company to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that at least 10% of its fleet is composed of Bikes for last-mile delivery.\nmodel.addCons(B >= 0.1 * (T + V + B))\n## The company has a daily revenue target of $20,000.\nmodel.addCons(1000 * 2 * T + 500 * 3 * V + 100 * 5 * B >= 20000)\n## The company wants to limit the number of Trucks to no more than twice the number of Vans.\nmodel.addCons(T <= 2 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1353,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit.\n// {\"number of units of component 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component varies with the number of units produced due to economies of scale and market saturation. The profit function for each component is given by:\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\nThe company wants to maximize the total profit from all components.\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// C1 + C2 + C3 + C4 + C5 <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of component 1 must be at least twice the production of component 2.\n// C1 >= 2 * C2",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit. The profit from each component varies with the number of units produced due to economies of scale and market saturation. The profit function for each component is given by:\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\nThe company wants to maximize the total profit from all components. The company has a total production capacity of 1000 units across all components. Due to market demand, the production of component 1 must be at least twice the production of component 2. Please help the company determine the optimal number of units to produce for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of units of component 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of units of component 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of units of component 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of units of component 4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # number of units of component 5\n\n# Define objective function\n## The profit function for each component is given by:\nP1 = 100 * C1 - 0.1 * C1**2\nP2 = 120 * C2 - 0.15 * C2**2\nP3 = 150 * C3 - 0.2 * C3**2\nP4 = 180 * C4 - 0.25 * C4**2\nP5 = 200 * C5 - 0.3 * C5**2\n## The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 1000)\n## Due to market demand, the production of component 1 must be at least twice the production of component 2.\nmodel.addCons(C1 >= 2 * C2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component 1: \", model.getVal(C1))\n    print(\"Number of Component 2: \", model.getVal(C2))\n    print(\"Number of Component 3: \", model.getVal(C3))\n    print(\"Number of Component 4: \", model.getVal(C4))\n    print(\"Number of Component 5: \", model.getVal(C5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand.\n// {\"quantity of Chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of Chemical A is $100, with a production cost of $60 per unit. Chemical B has a revenue of $150 per unit and a production cost of $90 per unit. Chemical C has a revenue of $200 per unit and a production cost of $120 per unit. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 60 * A\n// Profit_B = 150 * B - 90 * B\n// Profit_C = 200 * C - 120 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit.\n// 5 * A + 8 * B + 10 * C <= 2000\n\n## Generate Constraint-2:\nThe company has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit.\n// 60 * A + 90 * B + 120 * C <= 150,000",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to maximize their profit while considering the storage capacity and market demand. The revenue and production cost per unit for each chemical are given in the following Table.\n\n| Chemical | Revenue per Unit | Production Cost per Unit |\n|----------|------------------|--------------------------|\n| A        | $100             | $60                      |\n| B        | $150             | $90                      |\n| C        | $200             | $120                     |\n\nThe company has a limited storage capacity of 2000 cubic meters. The storage requirement for Chemical A is 5 cubic meters per unit, for Chemical B is 8 cubic meters per unit, and for Chemical C is 10 cubic meters per unit. The company also has a production budget of $150,000. The production cost for Chemical A is $60 per unit, for Chemical B is $90 per unit, and for Chemical C is $120 per unit.\n\nPlease help the company to maximize the total profit by determining the optimal production quantities of each chemical.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chemical C\n\n# Define objective function\nProfit_A = 100 * A - 60 * A\nProfit_B = 150 * B - 90 * B\nProfit_C = 200 * C - 120 * C\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a limited storage capacity of 2000 cubic meters.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 2000)\n# The company has a production budget of $150,000.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance budget for Region1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance budget for Region3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2\n// Fuel cost for Region2: Cost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2\n// Fuel cost for Region3: Cost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all regions must not exceed $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the level of maintenance to ensure optimal performance and cost efficiency. The variables include the number of trucks allocated to Region1, Region2, and Region3, and the maintenance budget for each region. The efficiency of trucks increases with higher maintenance budgets, but the relationship is nonlinear. For every $1000 increase in maintenance budget, the fuel efficiency of trucks improves by 1%, but this improvement diminishes as the budget increases. The company aims to minimize the total fuel cost across all regions. The fuel cost for each region is calculated based on the number of trucks and the maintenance budget, as shown in the following Table.\n\n| Region | Number of Trucks | Maintenance Budget | Fuel Cost Formula |\n|--------|------------------|--------------------|-------------------|\n| Region1 | Trucks1 | Maintenance1 | (1000 * Trucks1) / (1 + 0.001 * Maintenance1)^2 |\n| Region2 | Trucks2 | Maintenance2 | (1200 * Trucks2) / (1 + 0.001 * Maintenance2)^2 |\n| Region3 | Trucks3 | Maintenance3 | (1500 * Trucks3) / (1 + 0.001 * Maintenance3)^2 |\n\nThe total maintenance budget for all regions must not exceed $100,000. Please help the company to minimize the total fuel cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance budget for Region1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance budget for Region2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance budget for Region3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel cost calculation with nonlinear relationship\nCost1 = (1000 * Trucks1) / (1 + 0.001 * Maintenance1)**2\nCost2 = (1200 * Trucks2) / (1 + 0.001 * Maintenance2)**2\nCost3 = (1500 * Trucks3) / (1 + 0.001 * Maintenance3)**2\n\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The total maintenance budget for all regions must not exceed $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Maintenance Budget for Region1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Budget for Region2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Budget for Region3: \", model.getVal(Maintenance3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1388,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50\n\n## Generate Constraint-2:\nThe demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25.\n// Truck1 >= 5\n// Truck2 >= 10\n// Truck3 >= 15\n// Truck4 >= 20\n// Truck5 >= 25\n\n## Generate Constraint-3:\nThe total distance traveled by all trucks should not exceed 1000 kilometers per day.\n// 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5 <= 1000\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total trucks are allocated to any single region.\n// Truck1 <= 0.4 * 50\n// Truck2 <= 0.4 * 50\n// Truck3 <= 0.4 * 50\n// Truck4 <= 0.4 * 50\n// Truck5 <= 0.4 * 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company has a total of 50 trucks available for allocation. The demand for trucks in Region1 is at least 5, in Region2 is at least 10, in Region3 is at least 15, in Region4 is at least 20, and in Region5 is at least 25. The total distance traveled by all trucks should not exceed 1000 kilometers per day. The company wants to ensure that no more than 40% of the total trucks are allocated to any single region.\n\nPlease help the company to minimize the total operational cost plus the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5)  # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=10)  # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=15)  # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=20)  # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=25)  # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n# So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)\n# The total distance traveled by all trucks should not exceed 1000 kilometers per day.\nmodel.addCons(0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5 <= 1000)\n# The company wants to ensure that no more than 40% of the total trucks are allocated to any single region.\nmodel.addCons(Truck1 <= 0.4 * 50)\nmodel.addCons(Truck2 <= 0.4 * 50)\nmodel.addCons(Truck3 <= 0.4 * 50)\nmodel.addCons(Truck4 <= 0.4 * 50)\nmodel.addCons(Truck5 <= 0.4 * 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs by determining the optimal speed for each truck. The variables include the speed of each truck in the fleet.\n// {\"speed of truck 1\": \"S1\", \"range\": \"0 <= S1 <= 100\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"S2\", \"range\": \"0 <= S2 <= 100\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"S3\", \"range\": \"0 <= S3 <= 100\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"S4\", \"range\": \"0 <= S4 <= 100\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"S5\", \"range\": \"0 <= S5 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs are modeled as a nonlinear function of the speed of each truck. The cost function is given by C(S) = a * S^2 + b * S + c, where a, b, and c are constants. The company aims to minimize the total cost of fuel and maintenance for all trucks.\n// Cost_Truck1 = a1 * S1^2 + b1 * S1 + c1\n// Cost_Truck2 = a2 * S2^2 + b2 * S2 + c2\n// Cost_Truck3 = a3 * S3^2 + b3 * S3 + c3\n// Cost_Truck4 = a4 * S4^2 + b4 * S4 + c4\n// Cost_Truck5 = a5 * S5^2 + b5 * S5 + c5\n// So, the objective function is: Minimize (Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Truck4 + Cost_Truck5)\n\n## Generate Constraint-1:\nEach truck must complete its route within a specified time limit. The time taken for each truck is inversely proportional to its speed.\n// Route_Distance / S1 <= Time_Limit1\n// Route_Distance / S2 <= Time_Limit2\n// Route_Distance / S3 <= Time_Limit3\n// Route_Distance / S4 <= Time_Limit4\n// Route_Distance / S5 <= Time_Limit5\n\n## Generate Constraint-2:\nThe speed of each truck must be within a safe operational range.\n// S1 >= Minimum_Speed\n// S2 >= Minimum_Speed\n// S3 >= Minimum_Speed\n// S4 >= Minimum_Speed\n// S5 >= Minimum_Speed",
        "question": "A logistics company operates a fleet of trucks that transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs by determining the optimal speed for each truck. The variables include the speed of each truck in the fleet, with each truck's speed ranging from 0 to 100. The fuel consumption and maintenance costs are modeled as a nonlinear function of the speed of each truck, given by C(S) = a * S^2 + b * S + c, where a, b, and c are constants. The company aims to minimize the total cost of fuel and maintenance for all trucks. Each truck must complete its route within a specified time limit, where the time taken for each truck is inversely proportional to its speed. Additionally, the speed of each truck must be within a safe operational range, with a minimum speed requirement. Please help the company to determine the optimal speeds for each truck to minimize the total cost of fuel and maintenance while meeting the time and safety constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=100) # speed of truck 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0, ub=100) # speed of truck 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0, ub=100) # speed of truck 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0, ub=100) # speed of truck 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0, ub=100) # speed of truck 5\n\n# Define objective function\na1, b1, c1 = 0.01, 0.5, 10  # example constants for truck 1\na2, b2, c2 = 0.01, 0.5, 10  # example constants for truck 2\na3, b3, c3 = 0.01, 0.5, 10  # example constants for truck 3\na4, b4, c4 = 0.01, 0.5, 10  # example constants for truck 4\na5, b5, c5 = 0.01, 0.5, 10  # example constants for truck 5\n\nCost_Truck1 = a1 * S1**2 + b1 * S1 + c1\nCost_Truck2 = a2 * S2**2 + b2 * S2 + c2\nCost_Truck3 = a3 * S3**2 + b3 * S3 + c3\nCost_Truck4 = a4 * S4**2 + b4 * S4 + c4\nCost_Truck5 = a5 * S5**2 + b5 * S5 + c5\n\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Truck1 + Cost_Truck2 + Cost_Truck3 + Cost_Truck4 + Cost_Truck5)\n\n# Add constraints\nRoute_Distance = 500  # example distance\nTime_Limit1, Time_Limit2, Time_Limit3, Time_Limit4, Time_Limit5 = 5, 5, 5, 5, 5  # example time limits\nMinimum_Speed = 20  # example minimum speed\n\nmodel.addCons(Route_Distance / S1 <= Time_Limit1)\nmodel.addCons(Route_Distance / S2 <= Time_Limit2)\nmodel.addCons(Route_Distance / S3 <= Time_Limit3)\nmodel.addCons(Route_Distance / S4 <= Time_Limit4)\nmodel.addCons(Route_Distance / S5 <= Time_Limit5)\n\nmodel.addCons(S1 >= Minimum_Speed)\nmodel.addCons(S2 >= Minimum_Speed)\nmodel.addCons(S3 >= Minimum_Speed)\nmodel.addCons(S4 >= Minimum_Speed)\nmodel.addCons(S5 >= Minimum_Speed)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(S1))\n    print(\"Speed of Truck 2: \", model.getVal(S2))\n    print(\"Speed of Truck 3: \", model.getVal(S3))\n    print(\"Speed of Truck 4: \", model.getVal(S4))\n    print(\"Speed of Truck 5: \", model.getVal(S5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The goal is to minimize the total operational cost while meeting delivery requirements and constraints.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company aims to minimize the total operational cost across all routes.\n// Total operational cost for Route1: Cost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Route3: Cost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The goal is to minimize the total operational cost while meeting delivery requirements and constraints. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\n\n| Route | Initial Cost per Kilometer |\n|-------|-----------------------------|\n| Route1 | $2                         |\n| Route2 | $3                         |\n| Route3 | $4                         |\n\nPlease help the company to minimize the total operational cost across all routes, considering the constraints on the budget and the impact of fuel efficiency upgrades on the cost per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0)  # distance for Route1\nDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0)  # distance for Route2\nDistance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance3\", lb=0)  # distance for Route3\nCost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\nCost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\nCost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of Type D solar panels\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $200 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $300 per panel, and a lifespan of 12 years.\nType C solar panels have an efficiency of 25%, a cost of $400 per panel, and a lifespan of 15 years.\nType D solar panels have an efficiency of 30%, a cost of $500 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.\n// TotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\n// EnergyProduced = 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar\n// So, the objective function is: Minimize (TotalCost - EnergyProduced)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the initial installation of solar panels.\n// 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000\n\n## Generate Constraint-2:\nThe total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\n// 15% * TypeASolar + 20% * TypeBSolar + 25% * TypeCSolar + 30% * TypeDSolar >= 0.8 * 500000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (Type A, Type B, Type C, and Type D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district. The characteristics of each type of solar panel are given in the following Table.\n\n| Type of Solar Panel | Efficiency | Cost per Panel | Lifespan |\n|---------------------|------------|----------------|----------|\n| Type A              | 15%        | $200           | 10 years |\n| Type B              | 20%        | $300           | 12 years |\n| Type C              | 25%        | $400           | 15 years |\n| Type D              | 30%        | $500           | 20 years |\n\nThe city has a budget of $100,000 for the initial installation of solar panels. The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year. Please help the city to minimize the total cost of installation and maintenance over the lifespan of the panels, while ensuring sufficient energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0) # number of Type A solar panels\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0) # number of Type B solar panels\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0) # number of Type C solar panels\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0) # number of Type D solar panels\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar\nEnergyProduced = 0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar\n## the objective function is: Minimize (TotalCost - EnergyProduced)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * EnergyProduced)\n\n# Add constraints\n## The city has a budget of $100,000 for the initial installation of solar panels.\nmodel.addCons(200 * TypeASolar + 300 * TypeBSolar + 400 * TypeCSolar + 500 * TypeDSolar <= 100000)\n## The total energy production must meet at least 80% of the city's current energy demand, which is 500,000 kWh per year.\nmodel.addCons(0.15 * TypeASolar + 0.20 * TypeBSolar + 0.25 * TypeCSolar + 0.30 * TypeDSolar >= 0.8 * 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolar))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolar))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolar))\n    print(\"Number of Type D Solar Panels: \", model.getVal(TypeDSolar))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km.\n// Fuel_Consumption_Trucks = 20 * Trucks\n// Fuel_Consumption_Vans = 15 * Vans\n// Fuel_Consumption_Bikes = 1 * Bikes\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands. The fuel consumption and cargo capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Consumption per 100 km | Cargo Capacity |\n|--------------|-----------------------------|----------------|\n| Trucks       | 20 liters                   | 1000 kg        |\n| Vans         | 15 liters                   | 500 kg         |\n| Bikes        | 1 liter                     | 100 kg         |\n\nThe company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100. The total cargo capacity required is 5000 kg. \n\nPlease help the company to minimize the total fuel consumption per 100 km while ensuring the total cargo capacity is met and the vehicle purchase budget is not exceeded.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nFuel_Consumption_Trucks = 20 * Trucks\nFuel_Consumption_Vans = 15 * Vans\nFuel_Consumption_Bikes = 1 * Bikes\n# So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for purchasing vehicles.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 10000)\n# The total cargo capacity required is 5000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company wants to maximize the total profit per day.\n// Profit_GoodA = (1000 - 500) * TrucksA\n// Profit_GoodB = (1200 - 600) * TrucksB\n// Profit_GoodC = (1400 - 700) * TrucksC\n// Profit_GoodD = (1600 - 800) * TrucksD\n// Profit_GoodE = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network. The cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000. For GoodB, the cost is $600 per trip, and the revenue is $1200. For GoodC, the cost is $700 per trip, and the revenue is $1400. For GoodD, the cost is $800 per trip, and the revenue is $1600. For GoodE, the cost is $900 per trip, and the revenue is $1800. The company wants to maximize the total profit per day. The company has a total of 50 trucks available for distribution. Please help the company determine the optimal allocation of trucks to each type of good.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nProfit_GoodA = (1000 - 500) * TrucksA\nProfit_GoodB = (1200 - 600) * TrucksB\nProfit_GoodC = (1400 - 700) * TrucksC\nProfit_GoodD = (1600 - 800) * TrucksD\nProfit_GoodE = (1800 - 900) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\n// {\"number of trucks on CityA to CityB route\": \"Trucks_AB\", \"range\": \"Trucks_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityA to CityC route\": \"Trucks_AC\", \"range\": \"Trucks_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityB to CityC route\": \"Trucks_BC\", \"range\": \"Trucks_BC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Total fuel consumption and operational costs for CityA to CityB: Cost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\n// Total fuel consumption and operational costs for CityA to CityC: Cost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\n// Total fuel consumption and operational costs for CityB to CityC: Cost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n// So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks_AB + Trucks_AC + Trucks_BC <= 50\n\n## Generate Constraint-2:\nThe demand from CityA to CityB requires at least 15 trucks.\n// Trucks_AB >= 15\n\n## Generate Constraint-3:\nThe demand from CityA to CityC requires at least 20 trucks.\n// Trucks_AC >= 20",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\nThe total number of trucks available is 50. The demand from CityA to CityB requires at least 15 trucks. The demand from CityA to CityC requires at least 20 trucks.\nPlease help the company to determine the optimal allocation of trucks to minimize the total fuel consumption and operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_AB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AB\", lb=15) # number of trucks on CityA to CityB route\nTrucks_AC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AC\", lb=20) # number of trucks on CityA to CityC route\nTrucks_BC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_BC\", lb=0) # number of trucks on CityB to CityC route\n\n# Define objective function\nCost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\nCost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\nCost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n# So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_AB + Cost_AC + Cost_BC)\n\n# Add constraints\n# The total number of trucks available is 50.\nmodel.addCons(Trucks_AB + Trucks_AC + Trucks_BC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on CityA to CityB route: \", model.getVal(Trucks_AB))\n    print(\"Number of Trucks on CityA to CityC route: \", model.getVal(Trucks_AC))\n    print(\"Number of Trucks on CityB to CityC route: \", model.getVal(Trucks_BC))\n    print(\"Minimized Total Fuel Consumption and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD\", \"range\": \"MachineD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total profit for MachineA: Profit_A = (500 - CostA) * MachineA = (500 - (200 + 0.01 * MachineA^2)) * MachineA\n// Total profit for MachineB: Profit_B = (700 - CostB) * MachineB = (700 - (300 + 0.02 * MachineB^2)) * MachineB\n// Total profit for MachineC: Profit_C = (900 - CostC) * MachineC = (900 - (400 + 0.03 * MachineC^2)) * MachineC\n// Total profit for MachineD: Profit_D = (1100 - CostD) * MachineD = (1100 - (500 + 0.04 * MachineD^2)) * MachineD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines next month.\n// MachineA + MachineB + MachineC + MachineD <= 500\n\n## Generate Constraint-2:\nDue to market demand, the number of MachineD produced should not exceed twice the number of MachineA.\n// MachineD <= 2 * MachineA",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. The company needs to determine the optimal number of each machine to produce next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale and resource utilization. The production cost function for each machine is given by: CostA = 200 + 0.01 * MachineA^2, CostB = 300 + 0.02 * MachineB^2, CostC = 400 + 0.03 * MachineC^2, CostD = 500 + 0.04 * MachineD^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost. The company has a total production capacity of 500 machines next month. Due to market demand, the number of MachineD produced should not exceed twice the number of MachineA. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0) # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0) # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0) # number of MachineC\nMachineD = model.addVar(vtype=\"INTEGER\", name=\"MachineD\", lb=0) # number of MachineD\n\n# Define objective function\n## calculate the cost for each machine\nCostA = 200 + 0.01 * MachineA**2\nCostB = 300 + 0.02 * MachineB**2\nCostC = 400 + 0.03 * MachineC**2\nCostD = 500 + 0.04 * MachineD**2\n## calculate the profit for each machine\nProfit_A = (500 - CostA) * MachineA\nProfit_B = (700 - CostB) * MachineB\nProfit_C = (900 - CostC) * MachineC\nProfit_D = (1100 - CostD) * MachineD\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 500 machines next month.\nmodel.addCons(MachineA + MachineB + MachineC + MachineD <= 500)\n## Due to market demand, the number of MachineD produced should not exceed twice the number of MachineA.\nmodel.addCons(MachineD <= 2 * MachineA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Number of MachineD: \", model.getVal(MachineD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day.\nThe medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day.\nThe large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 200 * Small + 300 * Medium + 400 * Large\n// Total fuel cost: FuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n// So, the objective function is: Minimize (VehicleCost + FuelCost)\n\n## Generate Constraint-1:\nThe total capacity of vehicles must meet or exceed the required delivery of 1000 units.\n// 50 * Small + 100 * Medium + 150 * Large >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 200 * Small + 300 * Medium + 400 * Large <= 10000\n\n## Generate Constraint-3:\nThe company can only rent a maximum of 20 vehicles in total.\n// Small + Medium + Large <= 20\n\n## Generate Constraint-4:\nThe company prefers to use at least 5 small vehicles if possible.\n// Small >= 5\n\n## Generate Constraint-5:\nThe company wants to limit the number of large vehicles to a maximum of 10.\n// Large <= 10",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity, fuel efficiency, and daily cost. The details of each vehicle are given in the following Table.\n\n| Vehicle Type | Capacity (units) | Fuel Consumption (liters/100 km) | Daily Cost ($) |\n|--------------|------------------|----------------------------------|----------------|\n| Small        | 50               | 10                               | 200            |\n| Medium       | 100              | 15                               | 300            |\n| Large        | 150              | 20                               | 400            |\n\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel. The company has a budget of $10,000 for vehicle rental and can only rent a maximum of 20 vehicles in total. The company prefers to use at least 5 small vehicles if possible and wants to limit the number of large vehicles to a maximum of 10.\n\nPlease help the company determine the optimal number of small, medium, and large vehicles to minimize the total cost of vehicles and fuel while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of large vehicles\n\n# Define objective function\nVehicleCost = 200 * Small + 300 * Medium + 400 * Large\nFuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == VehicleCost + FuelCost)\n\n# Add constraints\nmodel.addCons(50 * Small + 100 * Medium + 150 * Large >= 1000)  # Total capacity constraint\nmodel.addCons(200 * Small + 300 * Medium + 400 * Large <= 10000)  # Budget constraint\nmodel.addCons(Small + Medium + Large <= 20)  # Total vehicles constraint\nmodel.addCons(Small >= 5)  # Preference for small vehicles\nmodel.addCons(Large <= 10)  # Limit on large vehicles\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices. The company needs to decide the number of each device to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of device 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of device 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of device 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"raw material usage for device 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"raw material usage for device 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"raw material usage for device 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of device 1 is $50, device 2 is $70, and device 3 is $90. The company wants to maximize the total profit from selling these devices.\n// The objective function is: Maximize P = 50 * D1 + 70 * D2 + 90 * D3\n\n## Generate Constraint-1:\nThe total raw material usage must not exceed 1000 units. The usage for device 1 is R1 units, device 2 is R2 units, and device 3 is R3 units.\n// R1 * D1 + R2 * D2 + R3 * D3 <= 1000\n\n## Generate Constraint-2:\nThe production capacity for device 1 is limited to 50 units, device 2 to 70 units, and device 3 to 90 units.\n// D1 <= 50; D2 <= 70; D3 <= 90\n\n## Generate Constraint-3:\nThe relationship between the number of devices produced and the raw material usage is nonlinear. For each device, the raw material usage increases nonlinearly with the number of devices produced:\n// R1 = 0.1 * D1^2\n// R2 = 0.2 * D2^2\n// R3 = 0.3 * D3^2",
        "question": "A manufacturing company produces three types of electronic devices. The company needs to decide the number of each device to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit per unit of device 1 is $50, device 2 is $70, and device 3 is $90. The following table summarizes the nonlinear relationship between the number of devices produced and the raw material usage for each device.\n\n| Device | Profit per Unit | Nonlinear Raw Material Usage |\n|--------|-----------------|-------------------------------|\n| 1      | $50             | 0.1 * D1^2                    |\n| 2      | $70             | 0.2 * D2^2                    |\n| 3      | $90             | 0.3 * D3^2                    |\n\nThe total raw material usage must not exceed 1000 units. The production capacity for device 1 is limited to 50 units, device 2 to 70 units, and device 3 to 90 units. Please help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=50)  # number of device 1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0, ub=70)  # number of device 2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0, ub=90)  # number of device 3\n\n# Define nonlinear raw material usage\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\")  # raw material usage for device 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\")  # raw material usage for device 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\")  # raw material usage for device 3\n\n# Define objective function\nP = model.addVar(vtype=\"CONTINUOUS\", name=\"P\")  # total profit\nmodel.setObjective(P, \"maximize\")\nmodel.addCons(P == 50 * D1 + 70 * D2 + 90 * D3)\n\n# Add constraints\n# Nonlinear relationship between devices and raw material usage\nmodel.addCons(R1 == 0.1 * D1**2)\nmodel.addCons(R2 == 0.2 * D2**2)\nmodel.addCons(R3 == 0.3 * D3**2)\n\n# Total raw material usage constraint\nmodel.addCons(R1 * D1 + R2 * D2 + R3 * D3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(D1))\n    print(\"Number of Device 2: \", model.getVal(D2))\n    print(\"Number of Device 3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide the number of trips each truck will make to each region. Additionally, the company is considering investing in fuel-efficient upgrades for each region's fleet, which will affect the fuel consumption and operational costs.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Region1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Region5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the number of trips and the level of fuel-efficient upgrades. The initial fuel cost per trip is $100 for all regions. With upgrades, the fuel cost decreases by $1 for every $10 invested in upgrades. The company aims to minimize the total fuel cost across all regions.\n// Fuel_Cost1 = (100 - 0.1 * Upgrade1) * Trips1\n// Fuel_Cost2 = (100 - 0.1 * Upgrade2) * Trips2\n// Fuel_Cost3 = (100 - 0.1 * Upgrade3) * Trips3\n// Fuel_Cost4 = (100 - 0.1 * Upgrade4) * Trips4\n// Fuel_Cost5 = (100 - 0.1 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for all operational costs and upgrades.\n// 100 * (Trips1 + Trips2 + Trips3 + Trips4 + Trips5) + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must decide the number of trips each truck will make to each region and consider investing in fuel-efficient upgrades for each region's fleet, which will affect the fuel consumption and operational costs. The fuel consumption of each truck is affected by the number of trips and the level of fuel-efficient upgrades. The initial fuel cost per trip is $100 for all regions. With upgrades, the fuel cost decreases by $1 for every $10 invested in upgrades. The company aims to minimize the total fuel cost across all regions. The company has a total budget of $100,000 for all operational costs and upgrades.\n\nPlease help the company to determine the optimal number of trips and the investment in fuel-efficient upgrades for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Region1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Region2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Region3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # investment in fuel-efficient upgrades for Region4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # investment in fuel-efficient upgrades for Region5\n\n# Define objective function\nFuel_Cost1 = (100 - 0.1 * Upgrade1) * Trips1\nFuel_Cost2 = (100 - 0.1 * Upgrade2) * Trips2\nFuel_Cost3 = (100 - 0.1 * Upgrade3) * Trips3\nFuel_Cost4 = (100 - 0.1 * Upgrade4) * Trips4\nFuel_Cost5 = (100 - 0.1 * Upgrade5) * Trips5\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3 + Fuel_Cost4 + Fuel_Cost5)\n\n# Add constraints\n# The company has a total budget of $100,000 for all operational costs and upgrades.\nmodel.addCons(100 * (Trips1 + Trips2 + Trips3 + Trips4 + Trips5) + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips to Region5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrade1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrade2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrade3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrade4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrade5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month. Additionally, the company must decide on the number of hours to allocate for production and maintenance for each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceD\": \"HoursD\", \"range\": \"HoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\n// Profit from DeviceA: ProfitA = (100 - 40) * UnitsA - 20 * HoursA\n// Profit from DeviceB: ProfitB = (150 - 60) * UnitsB - 30 * HoursB\n// Profit from DeviceC: ProfitC = (200 - 80) * UnitsC - 40 * HoursC\n// Profit from DeviceD: ProfitD = (250 - 100) * UnitsD - 50 * HoursD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs next month.\n// 40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal number of units to produce for each device next month and the number of hours to allocate for production and maintenance for each device.\nFor DeviceA, the selling price per unit is $100, the material cost per unit is $40, and the production cost per hour is $20.\nFor DeviceB, the selling price per unit is $150, the material cost per unit is $60, and the production cost per hour is $30.\nFor DeviceC, the selling price per unit is $200, the material cost per unit is $80, and the production cost per hour is $40.\nFor DeviceD, the selling price per unit is $250, the material cost per unit is $100, and the production cost per hour is $50.\nThe company has a total budget of $10,000 for material costs next month.\nThe company aims to maximize the total profit, which is the sum of the profits from each device, considering both the number of units produced and the hours spent on production.\nPlease help the company to determine the optimal production strategy to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of DeviceD\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # production hours for DeviceA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # production hours for DeviceB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # production hours for DeviceC\nHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursD\", lb=0) # production hours for DeviceD\n\n# Define objective function\nProfitA = (100 - 40) * UnitsA - 20 * HoursA\nProfitB = (150 - 60) * UnitsB - 30 * HoursB\nProfitC = (200 - 80) * UnitsC - 40 * HoursC\nProfitD = (250 - 100) * UnitsD - 50 * HoursD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(40 * UnitsA + 60 * UnitsB + 80 * UnitsC + 100 * UnitsD <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Hours for DeviceA: \", model.getVal(HoursA))\n    print(\"Hours for DeviceB: \", model.getVal(HoursB))\n    print(\"Hours for DeviceC: \", model.getVal(HoursC))\n    print(\"Hours for DeviceD: \", model.getVal(HoursD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different vehicles (V1, V2, V3, V4, V5) to minimize fuel consumption and travel time. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption of V1\": \"FuelV1\", \"range\": \"FuelV1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V2\": \"FuelV2\", \"range\": \"FuelV2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V3\": \"FuelV3\", \"range\": \"FuelV3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V4\": \"FuelV4\", \"range\": \"FuelV4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of V5\": \"FuelV5\", \"range\": \"FuelV5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nVehicle V1 consumes fuel at a rate of 0.1 liters per kilometer and travels at a speed of 60 km/h.\nVehicle V2 consumes fuel at a rate of 0.12 liters per kilometer and travels at a speed of 55 km/h.\nVehicle V3 consumes fuel at a rate of 0.15 liters per kilometer and travels at a speed of 50 km/h.\nVehicle V4 consumes fuel at a rate of 0.18 liters per kilometer and travels at a speed of 45 km/h.\nVehicle V5 consumes fuel at a rate of 0.2 liters per kilometer and travels at a speed of 40 km/h.\nThe company wants to minimize the total fuel consumption and travel time for all vehicles.\n// Total fuel consumption: Fuel = 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5\n// Total travel time: Time = FuelV1 / 60 + FuelV2 / 55 + FuelV3 / 50 + FuelV4 / 45 + FuelV5 / 40\n// So, the objective function is: Minimize (Fuel + Time)\n\n## Generate Constraint-1:\nThe total distance covered by all vehicles must not exceed 5000 kilometers.\n// FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5 <= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs. The cost of fuel is $1 per liter.\n// 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5 <= 10000\n\n## Generate Constraint-3:\nEach vehicle must cover at least 500 kilometers.\n// FuelV1 >= 500\n// FuelV2 >= 500\n// FuelV3 >= 500\n// FuelV4 >= 500\n// FuelV5 >= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that no single vehicle covers more than 50% of the total distance.\n// FuelV1 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5)\n// FuelV2 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5)\n// FuelV3 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5)\n// FuelV4 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5)\n// FuelV5 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5)",
        "question": "A logistics company is planning its routes for five different vehicles (V1, V2, V3, V4, V5) to minimize fuel consumption and travel time. Each vehicle has a different fuel efficiency and speed. Vehicle V1 consumes fuel at a rate of 0.1 liters per kilometer and travels at a speed of 60 km/h. Vehicle V2 consumes fuel at a rate of 0.12 liters per kilometer and travels at a speed of 55 km/h. Vehicle V3 consumes fuel at a rate of 0.15 liters per kilometer and travels at a speed of 50 km/h. Vehicle V4 consumes fuel at a rate of 0.18 liters per kilometer and travels at a speed of 45 km/h. Vehicle V5 consumes fuel at a rate of 0.2 liters per kilometer and travels at a speed of 40 km/h. The company wants to minimize the total fuel consumption and travel time for all vehicles. The total distance covered by all vehicles must not exceed 5000 kilometers. The company has a budget of $10,000 for fuel costs, with the cost of fuel being $1 per liter. Each vehicle must cover at least 500 kilometers. The company wants to ensure that no single vehicle covers more than 50% of the total distance. Please help the company determine the optimal fuel consumption for each vehicle to meet these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFuelV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV1\", lb=500)\nFuelV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV2\", lb=500)\nFuelV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV3\", lb=500)\nFuelV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV4\", lb=500)\nFuelV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelV5\", lb=500)\n\n# Define objective function\nFuel = 0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5\nTime = FuelV1 / 60 + FuelV2 / 55 + FuelV3 / 50 + FuelV4 / 45 + FuelV5 / 40\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel + Time)\n\n# Add constraints\nmodel.addCons(FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5 <= 5000)\nmodel.addCons(0.1 * FuelV1 + 0.12 * FuelV2 + 0.15 * FuelV3 + 0.18 * FuelV4 + 0.2 * FuelV5 <= 10000)\nmodel.addCons(FuelV1 >= 500)\nmodel.addCons(FuelV2 >= 500)\nmodel.addCons(FuelV3 >= 500)\nmodel.addCons(FuelV4 >= 500)\nmodel.addCons(FuelV5 >= 500)\nmodel.addCons(FuelV1 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5))\nmodel.addCons(FuelV2 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5))\nmodel.addCons(FuelV3 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5))\nmodel.addCons(FuelV4 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5))\nmodel.addCons(FuelV5 <= 0.5 * (FuelV1 + FuelV2 + FuelV3 + FuelV4 + FuelV5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of V1: \", model.getVal(FuelV1))\n    print(\"Fuel consumption of V2: \", model.getVal(FuelV2))\n    print(\"Fuel consumption of V3: \", model.getVal(FuelV3))\n    print(\"Fuel consumption of V4: \", model.getVal(FuelV4))\n    print(\"Fuel consumption of V5: \", model.getVal(FuelV5))\n    print(\"Total Fuel and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route. The company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. Please help the company to maximize the total efficiency of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The company aims to maximize the total profit, but due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company wants to maximize the total profit from selling these devices.\n// Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\n// Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\n// Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\n// Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\n// Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for device A is $5, for device B is $7, for device C is $9, for device D is $11, and for device E is $13.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 units in total.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units.\n// A >= 50; B >= 75; C >= 100; D >= 125; E >= 150\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit and the cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Unit |\n|--------|-----------------|---------------|\n| A      | 10$             | 5$            |\n| B      | 15$             | 7$            |\n| C      | 20$             | 9$            |\n| D      | 25$             | 11$           |\n| E      | 30$             | 13$           |\n\nThe profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company has a budget of $10,000 for production costs. The company has a production capacity of 500 units in total. The market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units. The company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D. \n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=125) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150) # quantity of device E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=75, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.01 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=100, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.01 * (C2 - 100)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=125, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=500)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.01 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=150, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.01 * (E2 - 100)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000)\nmodel.addCons(A + B + C + D + E <= 500)\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\nThe company has a budget of $50,000 for purchasing trucks.\nPlease help the company determine the optimal number of each type of truck to use to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-2:\nThe total fuel budget per day is $5000.\n// 0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000\n\n## Generate Constraint-3:\nThe total maintenance budget per day is $10000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000\n\n## Generate Constraint-4:\nEach truck type has a different capacity. Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route. The profit per trip, fuel cost per kilometer, and maintenance cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Cost per Kilometer | Maintenance Cost per Trip |\n|------------|-----------------|-------------------------|--------------------------|\n| A          | $500            | $0.5                    | $100                     |\n| B          | $700            | $0.7                    | $150                     |\n| C          | $900            | $0.9                    | $200                     |\n| D          | $1100           | $1.1                    | $250                     |\n\nThe company has a total of 100 trucks available. The total fuel budget per day is $5000, and the total maintenance budget per day is $10000. Each truck type has a different capacity: Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons.\n\nPlease help the company to maximize the total profit from all trips, considering the costs and constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the fuel cost\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n## The total fuel budget per day is $5000.\nmodel.addCons(0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000)\n## The total maintenance budget per day is $10000.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000)\n## Each truck type has a different capacity. Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1320,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1 trips\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2 trips\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3 trips\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4 trips\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5 trips\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each trip is a nonlinear function of the fuel budget allocated, influenced by factors such as fuel efficiency and distance. The fuel cost for trips to City1 is $0.05 * (FuelBudget1^2), to City2 is $0.06 * (FuelBudget2^2), to City3 is $0.07 * (FuelBudget3^2), to City4 is $0.08 * (FuelBudget4^2), and to City5 is $0.09 * (FuelBudget5^2). The company aims to minimize the total fuel cost across all cities.\n// Total fuel cost for City1: FuelCost1 = 0.05 * (FuelBudget1^2) * Trips1\n// Total fuel cost for City2: FuelCost2 = 0.06 * (FuelBudget2^2) * Trips2\n// Total fuel cost for City3: FuelCost3 = 0.07 * (FuelBudget3^2) * Trips3\n// Total fuel cost for City4: FuelCost4 = 0.08 * (FuelBudget4^2) * Trips4\n// Total fuel cost for City5: FuelCost5 = 0.09 * (FuelBudget5^2) * Trips5\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10,000 for all routes.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 10000\n\n## Generate Constraint-2:\nThe company must make at least 50 trips to City1, 75 trips to City2, 100 trips to City3, 125 trips to City4, and 150 trips to City5.\n// Trips1 >= 50; Trips2 >= 75; Trips3 >= 100; Trips4 >= 125; Trips5 >= 150",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each trip is a nonlinear function of the fuel budget allocated, influenced by factors such as fuel efficiency and distance. The fuel cost for trips to City1 is $0.05 * (FuelBudget1^2), to City2 is $0.06 * (FuelBudget2^2), to City3 is $0.07 * (FuelBudget3^2), to City4 is $0.08 * (FuelBudget4^2), and to City5 is $0.09 * (FuelBudget5^2). The company aims to minimize the total fuel cost across all cities.\n\n| City | Fuel Cost Function | Minimum Required Trips |\n|------|-------------------|-----------------------|\n| City1 | $0.05 * (FuelBudget1^2) | 50 |\n| City2 | $0.06 * (FuelBudget2^2) | 75 |\n| City3 | $0.07 * (FuelBudget3^2) | 100 |\n| City4 | $0.08 * (FuelBudget4^2) | 125 |\n| City5 | $0.09 * (FuelBudget5^2) | 150 |\n\nThe company has a total fuel budget of $10,000 for all routes. The company must make at least 50 trips to City1, 75 trips to City2, 100 trips to City3, 125 trips to City4, and 150 trips to City5. Please help the company to minimize the total fuel cost across all cities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=100) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=125) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=150) # number of trips to City5\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0) # fuel budget for City1 trips\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0) # fuel budget for City2 trips\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0) # fuel budget for City3 trips\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0) # fuel budget for City4 trips\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0) # fuel budget for City5 trips\n\n# Define objective function\nFuelCost1 = 0.05 * (FuelBudget1**2) * Trips1\nFuelCost2 = 0.06 * (FuelBudget2**2) * Trips2\nFuelCost3 = 0.07 * (FuelBudget3**2) * Trips3\nFuelCost4 = 0.08 * (FuelBudget4**2) * Trips4\nFuelCost5 = 0.09 * (FuelBudget5**2) * Trips5\n# So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Number of Trips to City4: \", model.getVal(Trips4))\n    print(\"Number of Trips to City5: \", model.getVal(Trips5))\n    print(\"Fuel Budget for City1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for City2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for City3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for City4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for City5: \", model.getVal(FuelBudget5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 500 units of each device.\n// DeviceAProduction >= 500; DeviceBProduction >= 500; DeviceCProduction >= 500; DeviceDProduction >= 500; DeviceEProduction >= 500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost of Raw Materials per Unit |\n|--------|-----------------|--------------------------------|\n| DeviceA | $50             | $20                            |\n| DeviceB | $70             | $30                            |\n| DeviceC | $90             | $40                            |\n| DeviceD | $60             | $25                            |\n| DeviceE | $80             | $35                            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The company has a budget constraint for raw materials, which is $500,000. To ensure market presence, the company must produce at least 500 units of each device.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=500)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=500)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=500)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=500)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=500)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the storage cost per unit per month is $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and the storage cost per unit per month is $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and the storage cost per unit per month is $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and the storage cost per unit per month is $11.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the production cost and the storage cost.\n// Profit of DeviceA: Profit_A = (100 - 60 - 5 * T) * A\n// Profit of DeviceB: Profit_B = (150 - 90 - 7 * T) * B\n// Profit of DeviceC: Profit_C = (200 - 120 - 9 * T) * C\n// Profit of DeviceD: Profit_D = (250 - 150 - 11 * T) * D\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe total production capacity for the month is 500 units.\n// A + B + C + D <= 500",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\nFor DeviceA, the selling price is $100, the production cost is $60, and the storage cost per unit per month is $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and the storage cost per unit per month is $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and the storage cost per unit per month is $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and the storage cost per unit per month is $11.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the production cost and the storage cost.\nThe total production capacity for the month is 500 units.\nPlease help the company determine the optimal production quantities for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # time in months\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60 - 5 * T) * A\nProfit_B = (150 - 90 - 7 * T) * B\nProfit_C = (200 - 120 - 9 * T) * C\nProfit_D = (250 - 150 - 11 * T) * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The total production capacity for the month is 500 units.\nmodel.addCons(A + B + C + D <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Time in months: \", model.getVal(T))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce.\n// {\"quantity of Compact EV\": \"Compact\", \"range\": \"Compact >= 0\", \"type\": \"integer\"}\n// {\"quantity of Sedan EV\": \"Sedan\", \"range\": \"Sedan >= 0\", \"type\": \"integer\"}\n// {\"quantity of SUV EV\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Compact, the profit per unit is $10,000, the production cost per unit is $20,000, and the environmental impact per unit is 10 points.\nFor Sedan, the profit per unit is $15,000, the production cost per unit is $25,000, and the environmental impact per unit is 15 points.\nFor SUV, the profit per unit is $20,000, the production cost per unit is $30,000, and the environmental impact per unit is 20 points.\nThe manufacturer wants to maximize the net profit while considering the environmental impact. The environmental impact is inversely proportional to the net profit, with a weight factor of 0.001.\n// Net_Profit_Compact = 10000 * Compact - 20000 * Compact\n// Net_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\n// Net_Profit_SUV = 20000 * SUV - 30000 * SUV\n// Environmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n// So, the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $1,000,000 for production costs.\n// 20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000",
        "question": "A manufacturer produces three types of electric vehicles (EVs): Compact, Sedan, and SUV. They need to determine the quantities of each EV type to produce. The profit per unit, production cost per unit, and environmental impact per unit for each EV type are given in the following Table.\n\n| EV Type | Profit per Unit | Production Cost per Unit | Environmental Impact per Unit |\n|---------|-----------------|--------------------------|-------------------------------|\n| Compact | $10,000         | $20,000                  | 10 points                     |\n| Sedan   | $15,000         | $25,000                  | 15 points                     |\n| SUV     | $20,000         | $30,000                  | 20 points                     |\n\nThe manufacturer has a limited production budget of $1,000,000 for production costs. The manufacturer wants to maximize the net profit while considering the environmental impact, which is inversely proportional to the net profit with a weight factor of 0.001.\nPlease help the manufacturer to determine the optimal quantities of each EV type to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCompact = model.addVar(vtype=\"INTEGER\", name=\"Compact\", lb=0) # quantity of Compact EV\nSedan = model.addVar(vtype=\"INTEGER\", name=\"Sedan\", lb=0) # quantity of Sedan EV\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # quantity of SUV EV\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_Compact = 10000 * Compact - 20000 * Compact\nNet_Profit_Sedan = 15000 * Sedan - 25000 * Sedan\nNet_Profit_SUV = 20000 * SUV - 30000 * SUV\nEnvironmental_Impact = 10 * Compact + 15 * Sedan + 20 * SUV\n## the objective function is: Maximize (Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV) - 0.001 * Environmental_Impact\n## convert the subtraction to addition and multiplication\nmodel.addCons(obj == Net_Profit_Compact + Net_Profit_Sedan + Net_Profit_SUV + 0.001 * Environmental_Impact)\n\n# Add constraints\n## The manufacturer has a limited production budget of $1,000,000 for production costs.\nmodel.addCons(20000 * Compact + 25000 * Sedan + 30000 * SUV <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Compact EV: \", model.getVal(Compact))\n    print(\"Quantity of Sedan EV: \", model.getVal(Sedan))\n    print(\"Quantity of SUV EV: \", model.getVal(SUV))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1000 units of ProductC are produced.\n// QuantityC >= 1000\n\n## Generate Constraint-5:\nThe company has a budget of $2,000,000 for total production costs for the quarter.\n// (100 - 0.0001 * TechInvestment) * QuantityA + (150 - 0.0001 * TechInvestment) * QuantityB + (200 - 0.0001 * TechInvestment) * QuantityC <= 2000000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function. The production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products.\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in the new technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must ensure that at least 1000 units of ProductC are produced. The company has a budget of $2,000,000 for total production costs for the quarter.\n\nPlease help the company to maximize the total profit from all products, considering the constraints and the impact of the new technology on production costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=1000)  # production quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\nProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\nProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC - TechInvestment)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company must ensure that at least 1000 units of ProductC are produced.\nmodel.addCons(QuantityC >= 1000)\n# The company has a budget of $2,000,000 for total production costs for the quarter.\nmodel.addCons((100 - 0.0001 * TechInvestment) * QuantityA + (150 - 0.0001 * TechInvestment) * QuantityB + (200 - 0.0001 * TechInvestment) * QuantityC <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a cost per trip based on fuel and maintenance. The costs are as follows: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported.\n// Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// The objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trips must be at least 50 to meet the demand.\n// T1 + T2 + T3 + T4 + T5 >= 50",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations. The cost per trip for each truck is given in the following Table.\n\n| Truck | Cost per Trip |\n|-------|---------------|\n| Truck1 | $100         |\n| Truck2 | $120         |\n| Truck3 | $150         |\n| Truck4 | $180         |\n| Truck5 | $200         |\n\nThe company aims to minimize the total cost of all trips while ensuring sufficient goods are transported. The total number of trips must be at least 50 to meet the demand. Please help the company determine the optimal number of trips for each truck to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\nmodel.addCons(obj == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5)\n\n# Add constraints\n## The total number of trips must be at least 50 to meet the demand.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits.\n// {\"number of apartments\": \"Apartments\", \"range\": \"Apartments >= 0\", \"type\": \"integer\"}\n// {\"number of townhouses\": \"Townhouses\", \"range\": \"Townhouses >= 0\", \"type\": \"integer\"}\n// {\"number of single-family homes\": \"SingleFamilyHomes\", \"range\": \"SingleFamilyHomes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per apartment is $100,000, and the city receives a tax revenue of $2,000 per apartment annually.\nThe cost per townhouse is $150,000, and the city receives a tax revenue of $2,500 per townhouse annually.\nThe cost per single-family home is $200,000, and the city receives a tax revenue of $3,000 per single-family home annually.\nThe city wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n// NPV = (2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes) / 0.05 - (100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes)\n// So, the objective function is: Maximize NPV\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of all housing units.\n// 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes <= 10000000\n\n## Generate Constraint-2:\nThe city has a land area constraint that allows for a maximum of 100 units to be built in total.\n// Apartments + Townhouses + SingleFamilyHomes <= 100\n\n## Generate Constraint-3:\nThe city aims to have at least 30% of the total units as affordable housing, which are the apartments.\n// Apartments >= 0.3 * (Apartments + Townhouses + SingleFamilyHomes)\n\n## Generate Constraint-4:\nThe city wants to ensure a balanced community, with no more than 50% of the total units being single-family homes.\n// SingleFamilyHomes <= 0.5 * (Apartments + Townhouses + SingleFamilyHomes)",
        "question": "A city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits. The cost per unit and annual tax revenue for each type of housing are given in the following Table.\n\n| Housing Type        | Cost per Unit | Annual Tax Revenue per Unit |\n|---------------------|---------------|-----------------------------|\n| Apartments          | $100,000      | $2,000                      |\n| Townhouses          | $150,000      | $2,500                      |\n| Single-Family Homes | $200,000      | $3,000                      |\n\nThe city has a budget of $10 million for the construction of all housing units. The city has a land area constraint that allows for a maximum of 100 units to be built in total. The city aims to have at least 30% of the total units as affordable housing, which are the apartments. The city also wants to ensure a balanced community, with no more than 50% of the total units being single-family homes. \n\nPlease help the city to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartments = model.addVar(vtype=\"INTEGER\", name=\"Apartments\", lb=0)  # number of apartments\nTownhouses = model.addVar(vtype=\"INTEGER\", name=\"Townhouses\", lb=0)  # number of townhouses\nSingleFamilyHomes = model.addVar(vtype=\"INTEGER\", name=\"SingleFamilyHomes\", lb=0)  # number of single-family homes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTaxRevenue = 2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes\nConstructionCost = 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes\n## NPV = (TaxRevenue) / 0.05 - ConstructionCost\n## convert the division to multiplication\nmodel.addCons(obj * 0.05 == TaxRevenue - ConstructionCost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of all housing units.\nmodel.addCons(100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes <= 10000000)\n## The city has a land area constraint that allows for a maximum of 100 units to be built in total.\nmodel.addCons(Apartments + Townhouses + SingleFamilyHomes <= 100)\n## The city aims to have at least 30% of the total units as affordable housing, which are the apartments.\nmodel.addCons(Apartments >= 0.3 * (Apartments + Townhouses + SingleFamilyHomes))\n## The city wants to ensure a balanced community, with no more than 50% of the total units being single-family homes.\nmodel.addCons(SingleFamilyHomes <= 0.5 * (Apartments + Townhouses + SingleFamilyHomes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Apartments: \", model.getVal(Apartments))\n    print(\"Number of Townhouses: \", model.getVal(Townhouses))\n    print(\"Number of Single-Family Homes: \", model.getVal(SingleFamilyHomes))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1216,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major routes (Route A, Route B, Route C, Route D, and Route E) with varying distances and fuel efficiencies.\n// {\"number of trips on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the distance per trip is 500 km, the fuel efficiency is 5 km/liter, and the cost per liter of fuel is $1.2.\nFor Route B, the distance per trip is 600 km, the fuel efficiency is 6 km/liter, and the cost per liter of fuel is $1.2.\nFor Route C, the distance per trip is 700 km, the fuel efficiency is 7 km/liter, and the cost per liter of fuel is $1.2.\nFor Route D, the distance per trip is 800 km, the fuel efficiency is 8 km/liter, and the cost per liter of fuel is $1.2.\nFor Route E, the distance per trip is 900 km, the fuel efficiency is 9 km/liter, and the cost per liter of fuel is $1.2.\nThe company wants to minimize the total fuel cost while maintaining service levels.\n// Fuel_Cost_A = (500 / 5) * 1.2 * RouteA\n// Fuel_Cost_B = (600 / 6) * 1.2 * RouteB\n// Fuel_Cost_C = (700 / 7) * 1.2 * RouteC\n// Fuel_Cost_D = (800 / 8) * 1.2 * RouteD\n// Fuel_Cost_E = (900 / 9) * 1.2 * RouteE\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n## Generate Constraint-1:\nThe company has a total fleet capacity of 1000 trips across all routes.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 1000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major routes (Route A, Route B, Route C, Route D, and Route E) with varying distances and fuel efficiencies. For Route A, the distance per trip is 500 km, the fuel efficiency is 5 km/liter, and the cost per liter of fuel is $1.2. For Route B, the distance per trip is 600 km, the fuel efficiency is 6 km/liter, and the cost per liter of fuel is $1.2. For Route C, the distance per trip is 700 km, the fuel efficiency is 7 km/liter, and the cost per liter of fuel is $1.2. For Route D, the distance per trip is 800 km, the fuel efficiency is 8 km/liter, and the cost per liter of fuel is $1.2. For Route E, the distance per trip is 900 km, the fuel efficiency is 9 km/liter, and the cost per liter of fuel is $1.2. The company wants to minimize the total fuel cost while maintaining service levels. The company has a total fleet capacity of 1000 trips across all routes. Please help the company determine the optimal number of trips on each route to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of trips on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trips on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trips on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trips on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trips on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_A = (500 / 5) * 1.2 * RouteA\nFuel_Cost_B = (600 / 6) * 1.2 * RouteB\nFuel_Cost_C = (700 / 7) * 1.2 * RouteC\nFuel_Cost_D = (800 / 8) * 1.2 * RouteD\nFuel_Cost_E = (900 / 9) * 1.2 * RouteE\n## the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n## The company has a total fleet capacity of 1000 trips across all routes.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips on Route A: \", model.getVal(RouteA))\n    print(\"Number of Trips on Route B: \", model.getVal(RouteB))\n    print(\"Number of Trips on Route C: \", model.getVal(RouteC))\n    print(\"Number of Trips on Route D: \", model.getVal(RouteD))\n    print(\"Number of Trips on Route E: \", model.getVal(RouteE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. \nFor route 1, each truck consumes 100 liters of fuel and takes 5 hours. \nFor route 2, each truck consumes 120 liters of fuel and takes 6 hours. \nFor route 3, each truck consumes 140 liters of fuel and takes 7 hours. \nFor route 4, each truck consumes 160 liters of fuel and takes 8 hours.\nFor route 5, each truck consumes 180 liters of fuel and takes 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n// Fuel_Cost_R1 = 100 * T1 * fuel_price\n// Fuel_Cost_R2 = 120 * T2 * fuel_price\n// Fuel_Cost_R3 = 140 * T3 * fuel_price\n// Fuel_Cost_R4 = 160 * T4 * fuel_price\n// Fuel_Cost_R5 = 180 * T5 * fuel_price\n// Time_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\n// Time_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\n// Time_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\n// Time_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\n// Time_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n// So, the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 10,000 liters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route. The fuel consumption rates and delivery times for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/truck) | Delivery Time (hours/truck) |\n|-------|---------------------------------|-----------------------------|\n| R1    | 100                             | 5                           |\n| R2    | 120                             | 6                           |\n| R3    | 140                             | 7                           |\n| R4    | 160                             | 8                           |\n| R5    | 180                             | 9                           |\n\nThe company has a total of 100 trucks available. The total fuel consumption across all routes must not exceed 10,000 liters. The company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n\nPlease help the company to determine the optimal number of trucks to allocate to each route to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nfuel_price = 1 # assuming fuel price per liter\nhourly_cost_of_downtime = 1 # assuming hourly cost of downtime\nFuel_Cost_R1 = 100 * T1 * fuel_price\nFuel_Cost_R2 = 120 * T2 * fuel_price\nFuel_Cost_R3 = 140 * T3 * fuel_price\nFuel_Cost_R4 = 160 * T4 * fuel_price\nFuel_Cost_R5 = 180 * T5 * fuel_price\nTime_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\nTime_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\nTime_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\nTime_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\nTime_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n## the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\nmodel.addCons(obj == Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5 + Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The total fuel consumption across all routes must not exceed 10,000 liters.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1296,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of cargo containers: Small, Medium, and Large. They need to determine the number of each type of container to maximize their profit while considering various constraints such as storage space, handling costs, and market demand.\n// {\"number of Small containers\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium containers\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large containers\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Small container is $500, per Medium container is $1000, and per Large container is $1500. Due to economies of scale, the profit per container increases by $1 for every 10 containers produced beyond the first 50 for each type. The company aims to maximize the total profit from selling these containers.\n// Profit_Small = max(500 + 0.1 * (Small - 50), 500) * Small\n// Profit_Medium = max(1000 + 0.1 * (Medium - 50), 1000) * Medium\n// Profit_Large = max(1500 + 0.1 * (Large - 50), 1500) * Large\n// So, the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large\n\n## Generate Constraint-1:\nThe company has a limited storage space of 1000 square meters. Each Small container requires 5 square meters, each Medium container requires 10 square meters, and each Large container requires 15 square meters.\n// 5 * Small + 10 * Medium + 15 * Large <= 1000\n\n## Generate Constraint-2:\nThe handling cost for each Small container is $100, for each Medium container is $200, and for each Large container is $300. The company has a budget of $15000 for handling costs.\n// 100 * Small + 200 * Medium + 300 * Large <= 15000\n\n## Generate Constraint-3:\nThe market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units.\n// Small <= 200; Medium <= 150; Large <= 100",
        "question": "A logistics company is managing the distribution of three types of cargo containers: Small, Medium, and Large. They need to determine the number of each type of container to maximize their profit while considering various constraints such as storage space, handling costs, and market demand. The profit per Small container is $500, per Medium container is $1000, and per Large container is $1500. Due to economies of scale, the profit per container increases by $1 for every 10 containers produced beyond the first 50 for each type. The company has a limited storage space of 1000 square meters. Each Small container requires 5 square meters, each Medium container requires 10 square meters, and each Large container requires 15 square meters. The handling cost for each Small container is $100, for each Medium container is $200, and for each Large container is $300. The company has a budget of $15000 for handling costs. The market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units. Please help the company to maximize the total profit from selling these containers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for Small containers is at most 200 units, for Medium containers is at most 150 units, and for Large containers is at most 100 units.\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0, ub=200) # number of Small containers\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0, ub=150) # number of Medium containers\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0, ub=100) # number of Large containers\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Small = max(500 + 0.1 * (Small - 50), 500) * Small\nSmall1 = model.addVar(vtype=\"INTEGER\", name=\"Small1\", lb=0, ub=50)\nSmall2 = model.addVar(vtype=\"INTEGER\", name=\"Small2\", lb=50, ub=200)\nSmall_b1 = model.addVar(vtype=\"B\", name=\"Small_b1\")\nSmall_b2 = model.addVar(vtype=\"B\", name=\"Small_b2\")\nmodel.addCons(Small_b1 + Small_b2 == 1)\nmodel.addCons(Small == Small1*Small_b1 + Small2*Small_b2)\nProfit_Small = 500 * Small1 * Small_b1 + (500 + 0.1 * (Small2 - 50)) * Small2 * Small_b2\n## create piecewise variables for piecewise function: Profit_Medium = max(1000 + 0.1 * (Medium - 50), 1000) * Medium\nMedium1 = model.addVar(vtype=\"INTEGER\", name=\"Medium1\", lb=0, ub=50)\nMedium2 = model.addVar(vtype=\"INTEGER\", name=\"Medium2\", lb=50, ub=150)\nMedium_b1 = model.addVar(vtype=\"B\", name=\"Medium_b1\")\nMedium_b2 = model.addVar(vtype=\"B\", name=\"Medium_b2\")\nmodel.addCons(Medium_b1 + Medium_b2 == 1)\nmodel.addCons(Medium == Medium1*Medium_b1 + Medium2*Medium_b2)\nProfit_Medium = 1000 * Medium1 * Medium_b1 + (1000 + 0.1 * (Medium2 - 50)) * Medium2 * Medium_b2\n## create piecewise variables for piecewise function: Profit_Large = max(1500 + 0.1 * (Large - 50), 1500) * Large\nLarge1 = model.addVar(vtype=\"INTEGER\", name=\"Large1\", lb=0, ub=50)\nLarge2 = model.addVar(vtype=\"INTEGER\", name=\"Large2\", lb=50, ub=100)\nLarge_b1 = model.addVar(vtype=\"B\", name=\"Large_b1\")\nLarge_b2 = model.addVar(vtype=\"B\", name=\"Large_b2\")\nmodel.addCons(Large_b1 + Large_b2 == 1)\nmodel.addCons(Large == Large1*Large_b1 + Large2*Large_b2)\nProfit_Large = 1500 * Large1 * Large_b1 + (1500 + 0.1 * (Large2 - 50)) * Large2 * Large_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Small + Profit_Medium + Profit_Large\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\nmodel.addCons(5 * Small + 10 * Medium + 15 * Large <= 1000)\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small containers: \", model.getVal(Small))\n    print(\"Number of Medium containers: \", model.getVal(Medium))\n    print(\"Number of Large containers: \", model.getVal(Large))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\n// {\"number of company-owned trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteA\": \"LeaseA\", \"range\": \"LeaseA >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteB\": \"LeaseB\", \"range\": \"LeaseB >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteC\": \"LeaseC\", \"range\": \"LeaseC >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteD\": \"LeaseD\", \"range\": \"LeaseD >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteE\": \"LeaseE\", \"range\": \"LeaseE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company wants to maximize the total profit minus the total leasing cost.\n// Total profit for RouteA: Profit_A = 50,000 * TruckA - 15,000 * LeaseA\n// Total profit for RouteB: Profit_B = 60,000 * TruckB - 18,000 * LeaseB\n// Total profit for RouteC: Profit_C = 70,000 * TruckC - 20,000 * LeaseC\n// Total profit for RouteD: Profit_D = 55,000 * TruckD - 16,000 * LeaseD\n// Total profit for RouteE: Profit_E = 65,000 * TruckE - 19,000 * LeaseE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 company-owned trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total number of leased trucks should not exceed 50.\n// LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50",
        "question": "A logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company has a total of 100 company-owned trucks available. The total number of leased trucks should not exceed 50.\nPlease help the company to maximize the total profit minus the total leasing cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of company-owned trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of company-owned trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of company-owned trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of company-owned trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of company-owned trucks for RouteE\nLeaseA = model.addVar(vtype=\"INTEGER\", name=\"LeaseA\", lb=0) # number of leased trucks for RouteA\nLeaseB = model.addVar(vtype=\"INTEGER\", name=\"LeaseB\", lb=0) # number of leased trucks for RouteB\nLeaseC = model.addVar(vtype=\"INTEGER\", name=\"LeaseC\", lb=0) # number of leased trucks for RouteC\nLeaseD = model.addVar(vtype=\"INTEGER\", name=\"LeaseD\", lb=0) # number of leased trucks for RouteD\nLeaseE = model.addVar(vtype=\"INTEGER\", name=\"LeaseE\", lb=0) # number of leased trucks for RouteE\n\n# Define objective function\nProfit_A = 50000 * TruckA - 15000 * LeaseA\nProfit_B = 60000 * TruckB - 18000 * LeaseB\nProfit_C = 70000 * TruckC - 20000 * LeaseC\nProfit_D = 55000 * TruckD - 16000 * LeaseD\nProfit_E = 65000 * TruckE - 19000 * LeaseE\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n# The company has a total of 100 company-owned trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n# The total number of leased trucks should not exceed 50.\nmodel.addCons(LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Company-Owned Trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of Company-Owned Trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of Company-Owned Trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of Company-Owned Trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of Company-Owned Trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of Leased Trucks for RouteA: \", model.getVal(LeaseA))\n    print(\"Number of Leased Trucks for RouteB: \", model.getVal(LeaseB))\n    print(\"Number of Leased Trucks for RouteC: \", model.getVal(LeaseC))\n    print(\"Number of Leased Trucks for RouteD: \", model.getVal(LeaseD))\n    print(\"Number of Leased Trucks for RouteE: \", model.getVal(LeaseE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"Efficiency_A\", \"range\": \"Efficiency_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"Efficiency_B\", \"range\": \"Efficiency_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"Efficiency_C\", \"range\": \"Efficiency_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// Fuel_Consumption_A = Trucks_A / Efficiency_A\n// Fuel_Consumption_B = Trucks_B / Efficiency_B\n// Fuel_Consumption_C = Trucks_C / Efficiency_C\n// Profit_A = 1000 * Trucks_A - Fuel_Consumption_A^2\n// Profit_B = 1500 * Trucks_B - Fuel_Consumption_B^2\n// Profit_C = 2000 * Trucks_C - Fuel_Consumption_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total fuel budget for all routes is $10,000.\n// Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C <= 10000\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each route.\n// Trucks_A >= 10; Trucks_B >= 10; Trucks_C >= 10\n\n## Generate Constraint-4:\nThe fuel efficiency of trucks on Route C must be at least twice that of Route A.\n// Efficiency_C >= 2 * Efficiency_A",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n\n| Route | Number of Trucks | Fuel Efficiency |\n|-------|------------------|-----------------|\n| A     | Trucks_A         | Efficiency_A    |\n| B     | Trucks_B         | Efficiency_B    |\n| C     | Trucks_C         | Efficiency_C    |\n\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n\nThe company has a total of 50 trucks available. The total fuel budget for all routes is $10,000. The company must allocate at least 10 trucks to each route. The fuel efficiency of trucks on Route C must be at least twice that of Route A.\n\nPlease help the company to minimize the total fuel consumption (defined as the sum of the fuel consumption for each route) and maximize the total profit (defined as the sum of the profits from each route).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 10 trucks to each route.\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=10) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=10) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=10) # number of trucks for Route C\nEfficiency_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_A\", lb=0) # fuel efficiency of trucks for Route A\nEfficiency_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_B\", lb=0) # fuel efficiency of trucks for Route B\nEfficiency_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_C\", lb=0) # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_min = model.addVar('obj_min')\nobj_max = model.addVar('obj_max')\nmodel.setObjective(obj_min, \"minimize\")\nmodel.setObjective(obj_max, \"maximize\")\n\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nFuel_Consumption_A = Trucks_A / Efficiency_A\nFuel_Consumption_B = Trucks_B / Efficiency_B\nFuel_Consumption_C = Trucks_C / Efficiency_C\nProfit_A = 1000 * Trucks_A - Fuel_Consumption_A**2\nProfit_B = 1500 * Trucks_B - Fuel_Consumption_B**2\nProfit_C = 2000 * Trucks_C - Fuel_Consumption_C**2\n\nmodel.addCons(obj_min == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj_max == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n## The total fuel budget for all routes is $10,000.\nmodel.addCons(Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C <= 10000)\n## The fuel efficiency of trucks on Route C must be at least twice that of Route A.\nmodel.addCons(Efficiency_C >= 2 * Efficiency_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(Efficiency_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(Efficiency_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(Efficiency_C))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_min))\n    print(\"Maximized Profit: \", model.getVal(obj_max))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: Processor, Memory, Storage, Display, and Battery. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand.\n// {\"number of Processors\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n// {\"number of Memories\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Storages\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Displays\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Batteries\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Processor is $30, Memory is $20, Storage is $15, Display is $25, and Battery is $10. Due to economies of scale, the profit per unit increases by $0.02 for each component type if production exceeds 100 units. The company aims to maximize the total profit from selling these components.\n// Profit_P = max(30 + 0.02 * (P - 100), 30) * P\n// Profit_M = max(20 + 0.02 * (M - 100), 20) * M\n// Profit_S = max(15 + 0.02 * (S - 100), 15) * S\n// Profit_D = max(25 + 0.02 * (D - 100), 25) * D\n// Profit_B = max(10 + 0.02 * (B - 100), 10) * B\n// So, the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_B\n\n## Generate Constraint-1:\nThe company has a limited production capacity. The maximum number of Processors that can be produced is 200, Memories is 300, Storages is 250, Displays is 150, and Batteries is 400.\n// P <= 200; M <= 300; S <= 250; D <= 150; B <= 400\n\n## Generate Constraint-2:\nThe total production across all components must not exceed the company's overall production capacity of 800 units.\n// P + M + S + D + B <= 800\n\n## Generate Constraint-3:\nThe market has a minimum demand for each component. The minimum demand for Processors is 50 units, Memories is 75 units, Storages is 100 units, Displays is 25 units, and Batteries is 125 units.\n// P >= 50; M >= 75; S >= 100; D >= 25; B >= 125",
        "question": "A manufacturing company produces five types of electronic components: Processor, Memory, Storage, Display, and Battery. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand. The profit per unit for each component and the production constraints are given in the following Table.\n\n| Component | Profit per Unit | Production Capacity | Minimum Market Demand |\n|-----------|-----------------|----------------------|------------------------|\n| Processor | $30 (increases by $0.02 per unit if production exceeds 100) | 200 units | 50 units |\n| Memory    | $20 (increases by $0.02 per unit if production exceeds 100) | 300 units | 75 units |\n| Storage   | $15 (increases by $0.02 per unit if production exceeds 100) | 250 units | 100 units |\n| Display   | $25 (increases by $0.02 per unit if production exceeds 100) | 150 units | 25 units |\n| Battery   | $10 (increases by $0.02 per unit if production exceeds 100) | 400 units | 125 units |\n\nThe company has a limited overall production capacity of 800 units across all components. The company aims to maximize the total profit from selling these components, considering the profit increase due to economies of scale and the constraints on production capacity and market demand. Please help the company determine the optimal number of each component to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to determine the optimal number of each component to produce.\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=50, ub=200) # number of Processors\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=75, ub=300) # number of Memories\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100, ub=250) # number of Storages\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=25, ub=150) # number of Displays\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=125, ub=400) # number of Batteries\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_P = max(30 + 0.02 * (P - 100), 30) * P\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=50, ub=100)\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=100, ub=200)\nP_b1 = model.addVar(vtype=\"B\", name=\"P_b1\")\nP_b2 = model.addVar(vtype=\"B\", name=\"P_b2\")\nmodel.addCons(P_b1 + P_b2 == 1)\nmodel.addCons(P == P1*P_b1 + P2*P_b2)\nProfit_P = 30 * P1 * P_b1 + (30 + 0.02 * (P2 - 100)) * P2 * P_b2\n## create piecewise variables for piecewise function: Profit_M = max(20 + 0.02 * (M - 100), 20) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=75, ub=100)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=100, ub=300)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nProfit_M = 20 * M1 * M_b1 + (20 + 0.02 * (M2 - 100)) * M2 * M_b2\n## create piecewise variables for piecewise function: Profit_S = max(15 + 0.02 * (S - 100), 15) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=100, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=250)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 15 * S1 * S_b1 + (15 + 0.02 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 + 0.02 * (D - 100), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=25, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=150)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 + 0.02 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_B = max(10 + 0.02 * (B - 100), 10) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=125, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 10 * B1 * B_b1 + (10 + 0.02 * (B2 - 100)) * B2 * B_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_P + Profit_M + Profit_S + Profit_D + Profit_B\nmodel.addCons(obj == Profit_P + Profit_M + Profit_S + Profit_D + Profit_B)\n\n# Add constraints\nmodel.addCons(P + M + S + D + B <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Processors: \", model.getVal(P))\n    print(\"Number of Memories: \", model.getVal(M))\n    print(\"Number of Storages: \", model.getVal(S))\n    print(\"Number of Displays: \", model.getVal(D))\n    print(\"Number of Batteries: \", model.getVal(B))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: EV1, EV2, and EV3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of EV1\": \"EV1\", \"range\": \"EV1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of EV2\": \"EV2\", \"range\": \"EV2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of EV3\": \"EV3\", \"range\": \"EV3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor EV1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5 points.\nFor EV2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4 points.\nFor EV3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3 points.\nThe manufacturer wants to maximize the net revenue while minimizing the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_EV1 = 30000 * EV1 - 20000 * EV1\n// NetRevenue_EV2 = 40000 * EV2 - 25000 * EV2\n// NetRevenue_EV3 = 50000 * EV3 - 30000 * EV3\n// So, the objective function is: Maximize (NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3) / (5 * EV1 + 4 * EV2 + 3 * EV3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $1,000,000.\n// 20000 * EV1 + 25000 * EV2 + 30000 * EV3 <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 50 vehicles in total.\n// EV1 + EV2 + EV3 <= 50\n\n## Generate Constraint-3:\nThe market demand for EV1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of EV1.\n// EV1 <= 10\n\n## Generate Constraint-4:\nThe manufacturer aims to produce at least 5 units of EV2 to maintain a presence in that market segment.\n// EV2 >= 5",
        "question": "A manufacturer produces three types of eco-friendly vehicles: EV1, EV2, and EV3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and environmental impact score per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Environmental Impact Score per Unit |\n|--------------|------------------|--------------------------|--------------------------------------|\n| EV1          | $30,000          | $20,000                  | 5 points                             |\n| EV2          | $40,000          | $25,000                  | 4 points                             |\n| EV3          | $50,000          | $30,000                  | 3 points                             |\n\nThe manufacturer has a limited production budget of $1,000,000. The manufacturer has a production capacity of 50 vehicles in total. The market demand for EV1 is 10 units. The manufacturer aims to produce at least 5 units of EV2 to maintain a presence in that market segment. \n\nPlease help the manufacturer to maximize the net revenue per environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nEV1 = model.addVar(vtype=\"INTEGER\", name=\"EV1\", lb=0, ub=10) # quantity of EV1\nEV2 = model.addVar(vtype=\"INTEGER\", name=\"EV2\", lb=5, ub=50) # quantity of EV2\nEV3 = model.addVar(vtype=\"INTEGER\", name=\"EV3\", lb=0, ub=50) # quantity of EV3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_EV1 = (30000 - 20000) * EV1\nNetRevenue_EV2 = (40000 - 25000) * EV2\nNetRevenue_EV3 = (50000 - 30000) * EV3\nEnvironmentalImpact = 5 * EV1 + 4 * EV2 + 3 * EV3\n## the objective function is: Maximize (NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3)\n\n# Add constraints\n## The manufacturer has a limited production budget of $1,000,000.\nmodel.addCons(20000 * EV1 + 25000 * EV2 + 30000 * EV3 <= 1000000)\n## The manufacturer has a production capacity of 50 vehicles in total.\nmodel.addCons(EV1 + EV2 + EV3 <= 50)\n## The market demand for EV1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of EV1.\nmodel.addCons(EV1 <= 10)\n## The manufacturer aims to produce at least 5 units of EV2 to maintain a presence in that market segment.\nmodel.addCons(EV2 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of EV1: \", model.getVal(EV1))\n    print(\"Quantity of EV2: \", model.getVal(EV2))\n    print(\"Quantity of EV3: \", model.getVal(EV3))\n    print(\"Maximized Net Revenue per Environmental Impact Score: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n// Fuel consumption on route A: Fuel_A = 10 * A\n// Fuel consumption on route B: Fuel_B = 15 * B\n// Fuel consumption on route C: Fuel_C = 20 * C\n// Fuel consumption on route D: Fuel_D = 25 * D\n// Fuel consumption on route E: Fuel_E = 30 * E\n// Total capacity of goods transported: Capacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nEach route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks.\n// A >= 5; B >= 10; C >= 15; D >= 20; E >= 25",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The company has a total of 100 trucks available. Each route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks. Please help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=25) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\nCapacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of product. The profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products.\n// Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n// Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n// Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours.\n// M1 + M2 + M3 + M4 <= 100\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 30 hours due to maintenance constraints.\n// M1 <= 30; M2 <= 30; M3 <= 30; M4 <= 30",
        "question": "A manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency of each machine in producing each type of product varies, and the profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products. The profit from each product is given by the following equations:\n\n- Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n- Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n- Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n\nThe company has the following constraints:\n- The total operating hours for all machines must not exceed 100 hours.\n- Each machine can operate for a maximum of 30 hours due to maintenance constraints.\n\nPlease help the company to maximize the total profit from all products by determining the optimal number of hours each machine should operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\n\n# Define objective function\n# Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\nP1 = (100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2\n# Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\nP2 = (110 - 0.15 * M3**2) * M3 + (130 - 0.25 * M4**2) * M4\n# Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\nP3 = (120 - 0.3 * M1**2) * M1 + (140 - 0.4 * M2**2) * M2 + (150 - 0.5 * M3**2) * M3 + (160 - 0.6 * M4**2) * M4\n# The objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 + M4 <= 100)\n# Each machine can operate for a maximum of 30 hours due to maintenance constraints.\nmodel.addCons(M1 <= 30)\nmodel.addCons(M2 <= 30)\nmodel.addCons(M3 <= 30)\nmodel.addCons(M4 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to three regions: Region1, Region2, and Region3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and hence the operational cost per trip.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for each truck\": \"Upgrade\", \"range\": \"Upgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip decreases with the investment in fuel-efficient upgrades. For each $1000 invested, the fuel consumption decreases by 1 liter per 100 km for all regions. The initial fuel consumption is 10 liters per 100 km. The operational cost per trip is directly proportional to the fuel consumption. The company aims to minimize the total operational cost of all trips.\n// Operational cost per trip to Region1: Cost1 = (10 - 0.001 * Upgrade) * Trips1\n// Operational cost per trip to Region2: Cost2 = (10 - 0.001 * Upgrade) * Trips2\n// Operational cost per trip to Region3: Cost3 = (10 - 0.001 * Upgrade) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\n// Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 100 trips to Region1 and 150 trips to Region2.\n// Trips1 >= 100; Trips2 >= 150",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions: Region1, Region2, and Region3. The company needs to decide the number of trips each truck should make to these regions and whether to invest in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational cost per trip. The initial fuel consumption is 10 liters per 100 km, and for each $1000 invested in upgrades, the fuel consumption decreases by 1 liter per 100 km. The operational cost per trip is directly proportional to the fuel consumption.\n\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs. The total number of trips across all regions must not exceed 500. Due to contractual obligations, the company must make at least 100 trips to Region1 and 150 trips to Region2.\n\nPlease help the company to minimize the total operational cost of all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=150)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)     # number of trips to Region3\nUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade\", lb=0)  # investment in fuel-efficient upgrades\n\n# Define objective function\nCost1 = (10 - 0.001 * Upgrade) * Trips1\nCost2 = (10 - 0.001 * Upgrade) * Trips2\nCost3 = (10 - 0.001 * Upgrade) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\nmodel.addCons(Upgrade + (10 - 0.001 * Upgrade) * (Trips1 + Trips2 + Trips3) <= 100000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Investment in fuel-efficient upgrades: \", model.getVal(Upgrade))\n    print(\"Total operational cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit per unit of product. \nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\nThe company aims to maximize the total profit from all products.\n// The profit from product A: P_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\n// The profit from product B: P_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\n// The profit from product C: P_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n// So, the objective function is: Maximize P = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 + W4 <= 60",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. Each machine has a different efficiency and profit per unit of product. \n\nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\n\nThe company aims to maximize the total profit from all products. There are a total of 60 workers available. Please help the company determine the optimal number of workers to assign to each machine to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\nP_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\nP_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n# So, the objective function is: Maximize P = P_A + P_B + P_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Number of workers on machine 4: \", model.getVal(W4))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal number of units to produce for each device to maximize profit.\n// {\"number of units of device 1\": \"U1\", \"range\": \"U1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 2\": \"U2\", \"range\": \"U2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 3\": \"U3\", \"range\": \"U3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 4\": \"U4\", \"range\": \"U4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 5\": \"U5\", \"range\": \"U5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and production cost. The profit per unit for device 1 is 50 - 0.1*U1, for device 2 is 60 - 0.2*U2, for device 3 is 70 - 0.3*U3, for device 4 is 80 - 0.4*U4, and for device 5 is 90 - 0.5*U5. The company wants to maximize the total profit.\n// The objective function is: Maximize (50*U1 - 0.1*U1^2 + 60*U2 - 0.2*U2^2 + 70*U3 - 0.3*U3^2 + 80*U4 - 0.4*U4^2 + 90*U5 - 0.5*U5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// U1 + U2 + U3 + U4 + U5 <= 1000",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal number of units to produce for each device to maximize profit. Each device has a different profit margin and production cost. The profit per unit for device 1 is 50 - 0.1*U1, for device 2 is 60 - 0.2*U2, for device 3 is 70 - 0.3*U3, for device 4 is 80 - 0.4*U4, and for device 5 is 90 - 0.5*U5. The company wants to maximize the total profit. The total production capacity is limited to 1000 units across all devices. Please help the company determine the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nU1 = model.addVar(vtype=\"INTEGER\", name=\"U1\", lb=0) # number of units of device 1\nU2 = model.addVar(vtype=\"INTEGER\", name=\"U2\", lb=0) # number of units of device 2\nU3 = model.addVar(vtype=\"INTEGER\", name=\"U3\", lb=0) # number of units of device 3\nU4 = model.addVar(vtype=\"INTEGER\", name=\"U4\", lb=0) # number of units of device 4\nU5 = model.addVar(vtype=\"INTEGER\", name=\"U5\", lb=0) # number of units of device 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_U1 = 50 * U1 - 0.1 * U1**2\nProfit_U2 = 60 * U2 - 0.2 * U2**2\nProfit_U3 = 70 * U3 - 0.3 * U3**2\nProfit_U4 = 80 * U4 - 0.4 * U4**2\nProfit_U5 = 90 * U5 - 0.5 * U5**2\n## the objective function is: Maximize (50*U1 - 0.1*U1^2 + 60*U2 - 0.2*U2^2 + 70*U3 - 0.3*U3^2 + 80*U4 - 0.4*U4^2 + 90*U5 - 0.5*U5^2)\nmodel.addCons(obj == Profit_U1 + Profit_U2 + Profit_U3 + Profit_U4 + Profit_U5)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(U1 + U2 + U3 + U4 + U5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(U1))\n    print(\"Number of Device 2: \", model.getVal(U2))\n    print(\"Number of Device 3: \", model.getVal(U3))\n    print(\"Number of Device 4: \", model.getVal(U4))\n    print(\"Number of Device 5: \", model.getVal(U5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 615,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to optimize its delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 units of cargo and costs $500 per day to operate. Each Van can carry 500 units of cargo and costs $300 per day to operate. Each Bike can carry 100 units of cargo and costs $50 per day to operate. The company aims to maximize the total cargo carried per dollar spent on operation costs.\n// Objective function: Maximize (1000 * T + 500 * V + 100 * B) / (500 * T + 300 * V + 50 * B)\n\n## Generate Constraint-1:\nThe company has a daily budget of $3000 for operating costs.\n// 500 * T + 300 * V + 50 * B <= 3000\n\n## Generate Constraint-2:\nThe total cargo capacity of all vehicles should not exceed 100,000 units.\n// 1000 * T + 500 * V + 100 * B <= 100000\n\n## Generate Constraint-3:\nThe company must have at least 5 Trucks and 10 Vans.\n// T >= 5; V >= 10\n\n## Generate Constraint-4:\nThe number of Bikes should not exceed the combined number of Trucks and Vans.\n// B <= T + V",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the number of each type of vehicle to optimize its delivery operations. Each Truck can carry 1000 units of cargo and costs $500 per day to operate. Each Van can carry 500 units of cargo and costs $300 per day to operate. Each Bike can carry 100 units of cargo and costs $50 per day to operate. The company aims to maximize the total cargo carried per dollar spent on operation costs. The company has a daily budget of $3000 for operating costs. The total cargo capacity of all vehicles should not exceed 100,000 units. The company must have at least 5 Trucks and 10 Vans. The number of Bikes should not exceed the combined number of Trucks and Vans. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to meet these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5)  # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=10)  # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo = 1000 * T + 500 * V + 100 * B\nOperationCost = 500 * T + 300 * V + 50 * B\n## the objective function is: Maximize (Cargo) / (OperationCost)\n## convert the division to multiplication\nmodel.addCons(obj * OperationCost == Cargo)\n\n# Add constraints\n## The company has a daily budget of $3000 for operating costs.\nmodel.addCons(500 * T + 300 * V + 50 * B <= 3000)\n## The total cargo capacity of all vehicles should not exceed 100,000 units.\nmodel.addCons(1000 * T + 500 * V + 100 * B <= 100000)\n## The company must have at least 5 Trucks and 10 Vans.\nmodel.addCons(T >= 5)\nmodel.addCons(V >= 10)\n## The number of Bikes should not exceed the combined number of Trucks and Vans.\nmodel.addCons(B <= T + V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Cargo per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit.\n// Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n// Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n// Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n// Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n// Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// A >= 2 * B\n\n## Generate Constraint-3:\nThe company has a budget constraint of $50,000 for total production costs.\n// 2000 + 10A^2 + 3000 + 15B^2 + 4000 + 20C^2 + 5000 + 25D^2 + 6000 + 30E^2 <= 50,000\n\n## Generate Constraint-4:\nThe production of ComponentC cannot exceed 200 units.\n// C <= 200",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints. The profit per unit and the production cost function for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50 | 2000 + 10A^2 |\n| ComponentB | $70 | 3000 + 15B^2 |\n| ComponentC | $90 | 4000 + 20C^2 |\n| ComponentD | $110 | 5000 + 25D^2 |\n| ComponentE | $130 | 6000 + 30E^2 |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint of $50,000 for total production costs. The production of ComponentC cannot exceed 200 units.\n\nPlease help the company to maximize the total net profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## Total net profit for each component\nProfit_A = 50 * A - (2000 + 10 * A**2)\nProfit_B = 70 * B - (3000 + 15 * B**2)\nProfit_C = 90 * C - (4000 + 20 * C**2)\nProfit_D = 110 * D - (5000 + 25 * D**2)\nProfit_E = 130 * E - (6000 + 30 * E**2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(A >= 2 * B)\n## The company has a budget constraint of $50,000 for total production costs.\nmodel.addCons(2000 + 10 * A**2 + 3000 + 15 * B**2 + 4000 + 20 * C**2 + 5000 + 25 * D**2 + 6000 + 30 * E**2 <= 50000)\n## The production of ComponentC cannot exceed 200 units.\nmodel.addCons(C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"production quantity for ProductA\": \"ProductAQuantity\", \"range\": \"ProductAQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQuantity\", \"range\": \"ProductBQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQuantity\", \"range\": \"ProductCQuantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The company aims to maximize the total profit from all products.\n// Profit_ProductA = ProductAQuantity * (50 - 20)\n// Profit_ProductB = ProductBQuantity * (70 - 30)\n// Profit_ProductC = ProductCQuantity * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit and the cost of raw materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit |\n|---------|-----------------|--------------------------------|\n| ProductA | $50             | $20                            |\n| ProductB | $70             | $30                            |\n| ProductC | $60             | $25                            |\n\nThe company has a total production capacity of 1000 units per day. The production quantities for ProductA, ProductB, and ProductC must be non-negative integers. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductAQuantity\", lb=0) # production quantity for ProductA\nProductBQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductBQuantity\", lb=0) # production quantity for ProductB\nProductCQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductCQuantity\", lb=0) # production quantity for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQuantity * (50 - 20)\nProfit_ProductB = ProductBQuantity * (70 - 30)\nProfit_ProductC = ProductCQuantity * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQuantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQuantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQuantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\n// Profit_D1 = 100 * D1\n// Profit_D2 = 150 * D2\n// Profit_D3 = 200 * D3\n// The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 500 units available.\n// 2 * D1 + 3 * D2 + 4 * D3 <= 500\n\n## Generate Constraint-2:\nThe supply of material N is also limited, with only 200 units available.\n// D2 + 2 * D3 <= 200",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the required materials for each device are given in the following Table.\n\n| Device | Profit per Unit | Material M Required | Material N Required |\n|--------|-----------------|---------------------|---------------------|\n| D1     | $100            | 2 units             | 0 units             |\n| D2     | $150            | 3 units             | 1 unit              |\n| D3     | $200            | 4 units             | 2 units             |\n\nThe manufacturer has a limited supply of material M, with only 500 units available. The supply of material N is also limited, with only 200 units available. The manufacturer aims to maximize the total profit. Please help the manufacturer determine the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 100 * D1\nProfit_D2 = 150 * D2\nProfit_D3 = 200 * D3\n# The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited supply of material M, with only 500 units available.\nmodel.addCons(2 * D1 + 3 * D2 + 4 * D3 <= 500)\n# The supply of material N is also limited, with only 200 units available.\nmodel.addCons(D2 + 2 * D3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of Type A solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type B solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of Type C solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nType A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years.\nType B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years.\nType C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years.\nThe city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output.\n// EnergyOutput = 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20\n// TotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\n// So, the objective function is: Minimize (TotalCost - EnergyOutput)\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation of solar panels.\n// 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000\n\n## Generate Constraint-2:\nThe total energy output from the solar panels must be at least 1,000,000 kWh per year.\n// 15% * TypeASolarPanels * 10 + 20% * TypeBSolarPanels * 15 + 25% * TypeCSolarPanels * 20 >= 1000000\n\n## Generate Constraint-3:\nThe number of Type C solar panels must not exceed 50% of the total number of solar panels.\n// TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified three types of solar panels (Type A, Type B, and Type C) with varying efficiencies and costs. Type A solar panels have an efficiency of 15%, a cost of $1000 per panel, and a lifespan of 10 years. Type B solar panels have an efficiency of 20%, a cost of $1500 per panel, and a lifespan of 15 years. Type C solar panels have an efficiency of 25%, a cost of $2000 per panel, and a lifespan of 20 years. The city has a budget of $1,000,000 for the installation of solar panels. The total energy output from the solar panels must be at least 1,000,000 kWh per year. The number of Type C solar panels must not exceed 50% of the total number of solar panels. The city wants to minimize the total cost of installation and maintenance over the lifespan of the solar panels, while maximizing the energy output. Please help the city determine the number of each type of solar panel to install in each district.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergyOutput = 0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20\nTotalCost = 1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost - EnergyOutput)\n\n# Add constraints\nmodel.addCons(1000 * TypeASolarPanels + 1500 * TypeBSolarPanels + 2000 * TypeCSolarPanels <= 1000000)\nmodel.addCons(0.15 * TypeASolarPanels * 10 + 0.20 * TypeBSolarPanels * 15 + 0.25 * TypeCSolarPanels * 20 >= 1000000)\nmodel.addCons(TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of Type B Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of Type C Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company aims to minimize the total operational cost per liter of fuel consumed.\n// Operational cost of A: Cost_A = 50 * A\n// Operational cost of B: Cost_B = 70 * B\n// Operational cost of C: Cost_C = 90 * C\n// Operational cost of D: Cost_D = 110 * D\n// Operational cost of E: Cost_E = 130 * E\n// Fuel consumption of A: Fuel_A = 10 * A\n// Fuel consumption of B: Fuel_B = 15 * B\n// Fuel consumption of C: Fuel_C = 20 * C\n// Fuel consumption of D: Fuel_D = 25 * D\n// Fuel consumption of E: Fuel_E = 30 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs this month.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption and operational cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/trip) | Operational Cost ($/trip) |\n|------------|--------------------------------|---------------------------|\n| A          | 10                             | 50                        |\n| B          | 15                             | 70                        |\n| C          | 20                             | 90                        |\n| D          | 25                             | 110                       |\n| E          | 30                             | 130                       |\n\nThe company has a budget of $10,000 for operational costs this month. The company aims to minimize the total operational cost per liter of fuel consumed. Please help the company determine the optimal number of trips for each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trips for Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trips for Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 50 * A\nCost_B = 70 * B\nCost_C = 90 * C\nCost_D = 110 * D\nCost_E = 130 * E\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs this month.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Minimized Operational Cost per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the fuel efficiency strategy (measured in miles per gallon) for each route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency strategy for Route1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency strategy for Route2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency strategy for Route3\": \"FuelEfficiency3\", \"range\": \"FuelEfficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is a nonlinear function of the number of trucks and the fuel efficiency strategy. The cost includes fuel expenses, maintenance, and driver wages. The cost per mile decreases nonlinearly as the fuel efficiency increases. The company aims to minimize the total operational cost across all routes.\n// OperationalCost1 = (1000 / FuelEfficiency1) * Trucks1 + 50 * Trucks1\n// OperationalCost2 = (1200 / FuelEfficiency2) * Trucks2 + 60 * Trucks2\n// OperationalCost3 = (1500 / FuelEfficiency3) * Trucks3 + 70 * Trucks3\n// So, the objective function is: Minimize (OperationalCost1 + OperationalCost2 + OperationalCost3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-2:\nThe total fuel budget for all routes is $5000 per day.\n// (1000 / FuelEfficiency1) * Trucks1 + (1200 / FuelEfficiency2) * Trucks2 + (1500 / FuelEfficiency3) * Trucks3 <= 5000\n\n## Generate Constraint-3:\nEach route must be covered by at least one truck.\n// Trucks1 >= 1; Trucks2 >= 1; Trucks3 >= 1\n\n## Generate Constraint-4:\nThe fuel efficiency of each route cannot exceed 20 miles per gallon.\n// FuelEfficiency1 <= 20; FuelEfficiency2 <= 20; FuelEfficiency3 <= 20",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the fuel efficiency strategy (measured in miles per gallon) for each route. The operational cost of each route is a nonlinear function of the number of trucks and the fuel efficiency strategy, including fuel expenses, maintenance, and driver wages. The cost per mile decreases nonlinearly as the fuel efficiency increases. The company aims to minimize the total operational cost across all routes.\n\nThe company has a total of 50 trucks available. The total fuel budget for all routes is $5000 per day. Each route must be covered by at least one truck, and the fuel efficiency of each route cannot exceed 20 miles per gallon.\n\nPlease help the company to minimize the total operational cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=1)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=1)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=1)  # number of trucks for Route3\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0, ub=20)  # fuel efficiency strategy for Route1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0, ub=20)  # fuel efficiency strategy for Route2\nFuelEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency3\", lb=0, ub=20)  # fuel efficiency strategy for Route3\n\n# Define objective function\nOperationalCost1 = (1000 / FuelEfficiency1) * Trucks1 + 50 * Trucks1\nOperationalCost2 = (1200 / FuelEfficiency2) * Trucks2 + 60 * Trucks2\nOperationalCost3 = (1500 / FuelEfficiency3) * Trucks3 + 70 * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == OperationalCost1 + OperationalCost2 + OperationalCost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)  # total number of trucks available is limited to 50\nmodel.addCons((1000 / FuelEfficiency1) * Trucks1 + (1200 / FuelEfficiency2) * Trucks2 + (1500 / FuelEfficiency3) * Trucks3 <= 5000)  # total fuel budget for all routes is $5000 per day\nmodel.addCons(Trucks1 >= 1)  # each route must be covered by at least one truck\nmodel.addCons(Trucks2 >= 1)\nmodel.addCons(Trucks3 >= 1)\nmodel.addCons(FuelEfficiency1 <= 20)  # fuel efficiency of each route cannot exceed 20 miles per gallon\nmodel.addCons(FuelEfficiency2 <= 20)\nmodel.addCons(FuelEfficiency3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency for Route1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Route2: \", model.getVal(FuelEfficiency2))\n    print(\"Fuel Efficiency for Route3: \", model.getVal(FuelEfficiency3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total marketing budget available for all products is $100,000.\n// MA + MB + MC <= 100000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC.\n// QA <= 500; QB <= 400; QC <= 300\n\n## Generate Constraint-3:\nThe company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB.\n// MA >= 20000; MB >= 30000\n\n## Generate Constraint-4:\nDue to market saturation, the total quantity of all products produced must not exceed 1000 units.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-5:\nThe production of ProductC is dependent on the production of ProductA and ProductB. The quantity of ProductC produced must be at least half the sum of the quantities of ProductA and ProductB.\n// QC >= 0.5 * (QA + QB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\nThe total marketing budget available for all products is $100,000. The production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC. The company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB. Due to market saturation, the total quantity of all products produced must not exceed 1000 units. The production of ProductC is dependent on the production of ProductA and ProductB. The quantity of ProductC produced must be at least half the sum of the quantities of ProductA and ProductB.\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=400)  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=300)  # quantity of ProductC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=20000)  # marketing budget for ProductA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=30000)  # marketing budget for ProductB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nProfit_A = (100 * QA - 0.01 * QA**2 + 0.1 * MA) * QA\nProfit_B = (120 * QB - 0.02 * QB**2 + 0.15 * MB) * QB\nProfit_C = (150 * QC - 0.03 * QC**2 + 0.2 * MC) * QC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(MA + MB + MC <= 100000)  # total marketing budget constraint\nmodel.addCons(QA + QB + QC <= 1000)  # total production quantity constraint\nmodel.addCons(QC >= 0.5 * (QA + QB))  # dependency constraint for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1438,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm is planning to optimize its production of three different products: Widget A, Widget B, and Widget C. The firm needs to decide on the number of production lines for each widget and the number of workers assigned to each line to maximize profit while adhering to certain constraints related to labor, budget, and production capacity.\n// {\"number of production lines for Widget A\": \"WidgetALines\", \"range\": \"WidgetALines >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for Widget B\": \"WidgetBLines\", \"range\": \"WidgetBLines >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for Widget C\": \"WidgetCLines\", \"range\": \"WidgetCLines >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget A\": \"WidgetAWokersPerLine\", \"range\": \"WidgetAWokersPerLine >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget B\": \"WidgetBWokersPerLine\", \"range\": \"WidgetBWokersPerLine >= 0\", \"type\": \"integer\"}\n// {\"number of workers per production line for Widget C\": \"WidgetCWokersPerLine\", \"range\": \"WidgetCWokersPerLine >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of materials for Widget A is $3 per unit, and it sells for $8 per unit, with each worker producing 120 units per day.\nThe cost of materials for Widget B is $4 per unit, and it sells for $10 per unit, with each worker producing 100 units per day.\nThe cost of materials for Widget C is $5 per unit, and it sells for $12 per unit, with each worker producing 80 units per day.\nThe firm aims to maximize the total daily profit from all widgets.\n// Profit_WidgetA = 120 * WidgetALines * WidgetAWokersPerLine * (8 - 3)\n// Profit_WidgetB = 100 * WidgetBLines * WidgetBWokersPerLine * (10 - 4)\n// Profit_WidgetC = 80 * WidgetCLines * WidgetCWokersPerLine * (12 - 5)\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe firm has a total of 150 workers available.\n// WidgetALines * WidgetAWokersPerLine + WidgetBLines * WidgetBWokersPerLine + WidgetCLines * WidgetCWokersPerLine <= 150",
        "question": "A manufacturing firm is planning to optimize its production of three different products: Widget A, Widget B, and Widget C. The firm needs to decide on the number of production lines for each widget and the number of workers assigned to each line to maximize profit while adhering to certain constraints related to labor, budget, and production capacity. The cost of materials and selling price for each widget, along with the production rate per worker, are given in the following Table.\n\n| Widget | Cost of Materials per Unit | Selling Price per Unit | Production Rate per Worker per Day |\n|--------|----------------------------|------------------------|------------------------------------|\n| A      | $3                         | $8                     | 120 units                          |\n| B      | $4                         | $10                    | 100 units                          |\n| C      | $5                         | $12                    | 80 units                           |\n\nThe firm has a total of 150 workers available. The firm aims to maximize the total daily profit from all widgets. Please help the firm determine the optimal number of production lines and workers per line for each widget to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetALines = model.addVar(vtype=\"INTEGER\", name=\"WidgetALines\", lb=0)\nWidgetBLines = model.addVar(vtype=\"INTEGER\", name=\"WidgetBLines\", lb=0)\nWidgetCLines = model.addVar(vtype=\"INTEGER\", name=\"WidgetCLines\", lb=0)\nWidgetAWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetAWokersPerLine\", lb=0)\nWidgetBWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetBWokersPerLine\", lb=0)\nWidgetCWokersPerLine = model.addVar(vtype=\"INTEGER\", name=\"WidgetCWokersPerLine\", lb=0)\n\n# Define objective function\nProfit_WidgetA = 120 * WidgetALines * WidgetAWokersPerLine * (8 - 3)\nProfit_WidgetB = 100 * WidgetBLines * WidgetBWokersPerLine * (10 - 4)\nProfit_WidgetC = 80 * WidgetCLines * WidgetCWokersPerLine * (12 - 5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetALines * WidgetAWokersPerLine + WidgetBLines * WidgetBWokersPerLine + WidgetCLines * WidgetCWokersPerLine <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines for Widget A: \", model.getVal(WidgetALines))\n    print(\"Number of Production Lines for Widget B: \", model.getVal(WidgetBLines))\n    print(\"Number of Production Lines for Widget C: \", model.getVal(WidgetCLines))\n    print(\"Number of Workers per Production Line for Widget A: \", model.getVal(WidgetAWokersPerLine))\n    print(\"Number of Workers per Production Line for Widget B: \", model.getVal(WidgetBWokersPerLine))\n    print(\"Number of Workers per Production Line for Widget C: \", model.getVal(WidgetCWokersPerLine))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all product lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in efficiency upgrades cannot exceed $50,000.\n// InvestmentA + InvestmentB + InvestmentC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested. The production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\nThe company has a total of 100 workers available for all product lines. The total capital investment in efficiency upgrades cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units.\nPlease help the company to determine the optimal production quantities, worker allocations, and capital investments to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # capital investment for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # capital investment for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # capital investment for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)  # total workers constraint\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 50000)  # total investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment for ProductA: \", model.getVal(InvestmentA))\n    print(\"Capital Investment for ProductB: \", model.getVal(InvestmentB))\n    print(\"Capital Investment for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"VanTech\", \"range\": \"VanTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"BikeTech\", \"range\": \"BikeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in fuel-efficient technology. The cost reduction is nonlinear, with diminishing returns as more technology is invested.\nThe operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology.\nThe operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology.\nThe operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology.\nThe company aims to minimize the total operational cost of all vehicles.\n// Total cost for Trucks: CostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\n// Total cost for Vans: CostVan = 70 * VanCount - 0.07 * VanTech * VanCount\n// Total cost for Bikes: CostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle purchases and technology investments.\n// TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// TruckCount + VanCount + BikeCount <= 200\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Trucks must be at least twice the number of Vans.\n// TruckCount >= 2 * VanCount",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle and the investment in fuel-efficient technologies for each type to maximize efficiency and minimize operational costs. The operational cost per day and the cost reduction from investing in technology for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Cost Reduction per $100 Tech Investment |\n|--------------|--------------------------|-----------------------------------------|\n| Trucks       | $100                     | $10                                     |\n| Vans         | $70                      | $7                                      |\n| Bikes        | $30                      | $3                                      |\n\nThe company has a total budget of $10,000 for vehicle purchases and technology investments. The total number of vehicles cannot exceed 200. Due to maintenance constraints, the number of Trucks must be at least twice the number of Vans. \n\nPlease help the company to minimize the total operational cost of all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for Trucks\nVanTech = model.addVar(vtype=\"CONTINUOUS\", name=\"VanTech\", lb=0)  # investment in fuel-efficient technology for Vans\nBikeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeTech\", lb=0)  # investment in fuel-efficient technology for Bikes\n\n# Define objective function\nCostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\nCostVan = 70 * VanCount - 0.07 * VanTech * VanCount\nCostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 200)\nmodel.addCons(TruckCount >= 2 * VanCount)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Van Tech: \", model.getVal(VanTech))\n    print(\"Investment in Bike Tech: \", model.getVal(BikeTech))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs.\n// {\"number of containers for air transport\": \"AirContainers\", \"range\": \"AirContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for sea transport\": \"SeaContainers\", \"range\": \"SeaContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for rail transport\": \"RailContainers\", \"range\": \"RailContainers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting a container via air is $500, via sea is $200, and via rail is $300. The efficiency of transportation is measured by the time taken to deliver goods, with air taking 1 day, sea taking 5 days, and rail taking 3 days. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n// Total cost: Cost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\n// Average delivery time: Time = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n// So, the objective function is: Minimize (Cost + Time)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for transportation costs.\n// 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10,000\n\n## Generate Constraint-2:\nThe total number of containers that can be transported is limited to 50.\n// AirContainers + SeaContainers + RailContainers <= 50\n\n## Generate Constraint-3:\nDue to safety regulations, the number of containers transported by air must not exceed 10.\n// AirContainers <= 10\n\n## Generate Constraint-4:\nThe company has a contractual obligation to transport at least 15 containers by sea.\n// SeaContainers >= 15\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced distribution of containers across all modes, ensuring that the difference in the number of containers between any two modes does not exceed 5.\n// |AirContainers - SeaContainers| <= 5\n// |AirContainers - RailContainers| <= 5\n// |SeaContainers - RailContainers| <= 5",
        "question": "A logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs. The cost of transporting a container via air is $500, via sea is $200, and via rail is $300. The efficiency of transportation is measured by the time taken to deliver goods, with air taking 1 day, sea taking 5 days, and rail taking 3 days. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\nThe company has a budget of $10,000 for transportation costs. The total number of containers that can be transported is limited to 50. Due to safety regulations, the number of containers transported by air must not exceed 10. The company has a contractual obligation to transport at least 15 containers by sea. The company aims to maintain a balanced distribution of containers across all modes, ensuring that the difference in the number of containers between any two modes does not exceed 5.\nPlease help the company to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAirContainers = model.addVar(vtype=\"INTEGER\", name=\"AirContainers\", lb=0)\nSeaContainers = model.addVar(vtype=\"INTEGER\", name=\"SeaContainers\", lb=15)\nRailContainers = model.addVar(vtype=\"INTEGER\", name=\"RailContainers\", lb=0)\n\n# Define objective function\nCost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\nDeliveryTime = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost + DeliveryTime)\n\n# Add constraints\nmodel.addCons(500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10000)\nmodel.addCons(AirContainers + SeaContainers + RailContainers <= 50)\nmodel.addCons(AirContainers <= 10)\nmodel.addCons(SeaContainers >= 15)\n\n# Constraint for balanced distribution\nmodel.addCons(AirContainers - SeaContainers <= 5)\nmodel.addCons(SeaContainers - AirContainers <= 5)\nmodel.addCons(AirContainers - RailContainers <= 5)\nmodel.addCons(RailContainers - AirContainers <= 5)\nmodel.addCons(SeaContainers - RailContainers <= 5)\nmodel.addCons(RailContainers - SeaContainers <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Containers: \", model.getVal(AirContainers))\n    print(\"Number of Sea Containers: \", model.getVal(SeaContainers))\n    print(\"Number of Rail Containers: \", model.getVal(RailContainers))\n    print(\"Minimized Cost + Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. \nThe fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. \nThe fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. \nThe company aims to maximize the total distance covered by all vehicles.\n// Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n// Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n// Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n// So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter.\n// 10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles the company can purchase is limited to 10.\n// TruckA + TruckB + TruckC <= 10\n\n## Generate Constraint-3:\nDue to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it.\n// FuelA >= 1; FuelB >= 1; FuelC >= 1",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel. The fuel efficiency increases as follows: for TruckA, it increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter; for TruckB, it increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter; and for TruckC, it increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. The company aims to maximize the total distance covered by all vehicles.\n\n| Vehicle Type | Initial Fuel Efficiency | Cost per Vehicle |\n|--------------|-------------------------|------------------|\n| TruckA       | 10 km/liter             | $10,000          |\n| TruckB       | 15 km/liter             | $15,000          |\n| TruckC       | 20 km/liter             | $20,000          |\n\nThe company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of fuel is $1 per liter. The total number of vehicles the company can purchase is limited to 10. Due to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it.\n\nPlease help the company to determine the optimal number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to maximize the total distance covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=1) # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=1) # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=1) # fuel allocation for TruckC\n\n# Define objective function\n## Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n## Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n## Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n## So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\nDistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\nDistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\nDistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == DistanceA + DistanceB + DistanceC)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles and allocating fuel.\nmodel.addCons(10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000)\n## The total number of vehicles the company can purchase is limited to 10.\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Maximized Total Distance: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1700,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, ComponentB is $70, ComponentC is $90, ComponentD is $110, and ComponentE is $130. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is given by: Cost_A = 2000 + 10A^2, Cost_B = 3000 + 15B^2, Cost_C = 4000 + 20C^2, Cost_D = 5000 + 25D^2, Cost_E = 6000 + 30E^2. The company aims to maximize the total net profit.\n// Total net profit for ComponentA: Profit_A = 50A - (2000 + 10A^2)\n// Total net profit for ComponentB: Profit_B = 70B - (3000 + 15B^2)\n// Total net profit for ComponentC: Profit_C = 90C - (4000 + 20C^2)\n// Total net profit for ComponentD: Profit_D = 110D - (5000 + 25D^2)\n// Total net profit for ComponentE: Profit_E = 130E - (6000 + 30E^2)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// A >= 2 * B\n\n## Generate Constraint-3:\nThe company has a budget constraint of $50,000 for total production costs.\n// 2000 + 10A^2 + 3000 + 15B^2 + 4000 + 20C^2 + 5000 + 25D^2 + 6000 + 30E^2 <= 50,000\n\n## Generate Constraint-4:\nThe production of ComponentC cannot exceed 200 units.\n// C <= 200\n\n## Generate Constraint-5:\nThe company must produce at least 50 units of each component to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide the number of units to produce for each component to maximize profit while considering various constraints. The profit per unit and the production cost function for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50             | 2000 + 10A^2             |\n| ComponentB | $70             | 3000 + 15B^2             |\n| ComponentC | $90             | 4000 + 20C^2             |\n| ComponentD | $110            | 5000 + 25D^2             |\n| ComponentE | $130            | 6000 + 30E^2             |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint of $50,000 for total production costs. The production of ComponentC cannot exceed 200 units. The company must produce at least 50 units of each component to meet contractual obligations.\n\nPlease help the company to maximize the total net profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=200) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of ComponentD\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of ComponentE\n\n# Define objective function\n## Total net profit for each component\nProfit_A = 50 * A - (2000 + 10 * A**2)\nProfit_B = 70 * B - (3000 + 15 * B**2)\nProfit_C = 90 * C - (4000 + 20 * C**2)\nProfit_D = 110 * D - (5000 + 25 * D**2)\nProfit_E = 130 * E - (6000 + 30 * E**2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(A + B + C + D + E <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(A >= 2 * B)\n## The company has a budget constraint of $50,000 for total production costs.\nmodel.addCons(2000 + 10 * A**2 + 3000 + 15 * B**2 + 4000 + 20 * C**2 + 5000 + 25 * D**2 + 6000 + 30 * E**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Number of ComponentE: \", model.getVal(E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, DrugB as 70 * DosageB - 0.4 * DosageB^2, and DrugC as 90 * DosageC - 0.3 * DosageC^2. The side effects are modeled as 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2. The company wants to maximize the net therapeutic effect (therapeutic effect - side effects).\n// Therapeutic_Effect = (50 * DosageA - 0.5 * DosageA^2) + (70 * DosageB - 0.4 * DosageB^2) + (90 * DosageC - 0.3 * DosageC^2)\n// Side_Effects = 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2\n// So, the objective function is: Maximize (Therapeutic_Effect - Side_Effects)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DosageA + DosageB + DosageC <= 300\n\n## Generate Constraint-2:\nThe dosage of DrugA must be at least half the dosage of DrugB.\n// DosageA >= 0.5 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be no more than twice the dosage of DrugA.\n// DosageC <= 2 * DosageA\n\n## Generate Constraint-4:\nThe combined side effects from all drugs should not exceed a threshold of 1000 units.\n// 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2 <= 1000",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range. The therapeutic effect and side effects for each drug are modeled as follows:\n\n| Drug   | Therapeutic Effect Model                  | Side Effects Model                     |\n|--------|-------------------------------------------|----------------------------------------|\n| DrugA  | 50 * DosageA - 0.5 * DosageA^2            | 0.1 * DosageA^2                       |\n| DrugB  | 70 * DosageB - 0.4 * DosageB^2            | 0.15 * DosageB^2                      |\n| DrugC  | 90 * DosageC - 0.3 * DosageC^2            | 0.2 * DosageC^2                       |\n\nThe company wants to maximize the net therapeutic effect (therapeutic effect - side effects). The total dosage across all drugs must not exceed 300 units. The dosage of DrugA must be at least half the dosage of DrugB. The dosage of DrugC must be no more than twice the dosage of DrugA. The combined side effects from all drugs should not exceed a threshold of 1000 units.\n\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to maximize the net therapeutic effect while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=150) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\nTherapeutic_Effect = (50 * DosageA - 0.5 * DosageA**2) + (70 * DosageB - 0.4 * DosageB**2) + (90 * DosageC - 0.3 * DosageC**2)\nSide_Effects = 0.1 * DosageA**2 + 0.15 * DosageB**2 + 0.2 * DosageC**2\nNet_Therapeutic_Effect = Therapeutic_Effect - Side_Effects\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Therapeutic_Effect)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 300)\nmodel.addCons(DosageA >= 0.5 * DosageB)\nmodel.addCons(DosageC <= 2 * DosageA)\nmodel.addCons(0.1 * DosageA**2 + 0.15 * DosageB**2 + 0.2 * DosageC**2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Net Therapeutic Effect: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1377,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for E1 is $100, but it requires 2 units of a rare material M. For E2, the profit per unit is $150, requiring 3 units of material M. For E3, the profit per unit is $200, requiring 4 units of material M. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * E1 - 2 * E1 * M_cost\n// Profit_E2 = 150 * E2 - 3 * E2 * M_cost\n// Profit_E3 = 200 * E3 - 4 * E3 * M_cost\n// Objective function: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 200 units available.\n// 2 * E1 + 3 * E2 + 4 * E3 <= 200\n\n## Generate Constraint-2:\nThe production line has a total available time of 150 hours. Producing E1 takes 1 hour, E2 takes 2 hours, and E3 takes 3 hours.\n// E1 + 2 * E2 + 3 * E3 <= 150\n\n## Generate Constraint-3:\nThe market demand for E1 is 50 units, and the manufacturer can only sell a maximum of 50 units of E1.\n// E1 <= 50\n\n## Generate Constraint-4:\nThe total production capacity is limited to 80 units across all devices.\n// E1 + E2 + E3 <= 80",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for E1 is $100, but it requires 2 units of a rare material M. For E2, the profit per unit is $150, requiring 3 units of material M. For E3, the profit per unit is $200, requiring 4 units of material M. The manufacturer has a limited supply of material M, with only 200 units available. The production line has a total available time of 150 hours. Producing E1 takes 1 hour, E2 takes 2 hours, and E3 takes 3 hours. The market demand for E1 is 50 units, and the manufacturer can only sell a maximum of 50 units of E1. The total production capacity is limited to 80 units across all devices. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\nM_cost = model.addVar(name=\"M_cost\") # cost of material M\nProfit_E1 = 100 * E1 - 2 * E1 * M_cost\nProfit_E2 = 150 * E2 - 3 * E2 * M_cost\nProfit_E3 = 200 * E3 - 4 * E3 * M_cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\nmodel.addCons(2 * E1 + 3 * E2 + 4 * E3 <= 200) # limited supply of material M\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 150) # production time constraint\nmodel.addCons(E1 <= 50) # market demand for E1\nmodel.addCons(E1 + E2 + E3 <= 80) # total production capacity\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs.\n// {\"number of trucks for ProductA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for ProductA is $500 per trip, and the revenue generated is $1000 per trip. For ProductB, the cost is $600 per trip, and the revenue is $1200 per trip. For ProductC, the cost is $700 per trip, and the revenue is $1400 per trip. For ProductD, the cost is $800 per trip, and the revenue is $1600 per trip. For ProductE, the cost is $900 per trip, and the revenue is $1800 per trip. The company wants to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_A = (1000 - 500) * TruckA\n// Total net profit for ProductB: Profit_B = (1200 - 600) * TruckB\n// Total net profit for ProductC: Profit_C = (1400 - 700) * TruckC\n// Total net profit for ProductD: Profit_D = (1600 - 800) * TruckD\n// Total net profit for ProductE: Profit_E = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for truck operations.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000\n\n## Generate Constraint-2:\nThe company can operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to regional demand, at least 10 trucks must be allocated for ProductA.\n// TruckA >= 10\n\n## Generate Constraint-4:\nThe company aims to allocate at least 20% of the total trucks to ProductE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)",
        "question": "A logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs.\nThe cost of operating a truck for ProductA is $500 per trip, and the revenue generated is $1000 per trip. For ProductB, the cost is $600 per trip, and the revenue is $1200 per trip. For ProductC, the cost is $700 per trip, and the revenue is $1400 per trip. For ProductD, the cost is $800 per trip, and the revenue is $1600 per trip. For ProductE, the cost is $900 per trip, and the revenue is $1800 per trip. The company wants to maximize the total net profit from all products.\nThe company has a total budget of $50,000 for truck operations. The company can operate a maximum of 100 trucks in total. Due to regional demand, at least 10 trucks must be allocated for ProductA. The company aims to allocate at least 20% of the total trucks to ProductE.\nPlease help the company to determine the optimal number of trucks to allocate for each product to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for ProductA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for ProductB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for ProductC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for ProductD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for ProductE\n\n# Define objective function\nProfit_A = (1000 - 500) * TruckA\nProfit_B = (1200 - 600) * TruckB\nProfit_C = (1400 - 700) * TruckC\nProfit_D = (1600 - 800) * TruckD\nProfit_E = (1800 - 900) * TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for ProductA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for ProductB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for ProductC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for ProductD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for ProductE: \", model.getVal(TruckE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route.\n// {\"number of company-owned trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of company-owned trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteA\": \"LeaseA\", \"range\": \"LeaseA >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteB\": \"LeaseB\", \"range\": \"LeaseB >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteC\": \"LeaseC\", \"range\": \"LeaseC >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteD\": \"LeaseD\", \"range\": \"LeaseD >= 0\", \"type\": \"integer\"}\n// {\"number of leased trucks for RouteE\": \"LeaseE\", \"range\": \"LeaseE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the profit per company-owned truck is $50,000, and the cost of leasing a truck is $15,000.\nFor RouteB, the profit per company-owned truck is $60,000, and the cost of leasing a truck is $18,000.\nFor RouteC, the profit per company-owned truck is $70,000, and the cost of leasing a truck is $20,000.\nFor RouteD, the profit per company-owned truck is $55,000, and the cost of leasing a truck is $16,000.\nFor RouteE, the profit per company-owned truck is $65,000, and the cost of leasing a truck is $19,000.\nThe company wants to maximize the total profit minus the total leasing cost.\n// Total profit for RouteA: Profit_A = 50,000 * TruckA - 15,000 * LeaseA\n// Total profit for RouteB: Profit_B = 60,000 * TruckB - 18,000 * LeaseB\n// Total profit for RouteC: Profit_C = 70,000 * TruckC - 20,000 * LeaseC\n// Total profit for RouteD: Profit_D = 55,000 * TruckD - 16,000 * LeaseD\n// Total profit for RouteE: Profit_E = 65,000 * TruckE - 19,000 * LeaseE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 company-owned trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total number of leased trucks should not exceed 50.\n// LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50",
        "question": "A logistics company is planning its fleet allocation for the next year. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) that require different numbers of trucks. The company needs to decide how many trucks to allocate to each route and how many additional trucks to lease for each route. The profit per company-owned truck and the cost of leasing a truck for each route are given in the following Table.\n\n| Route | Profit per Company-Owned Truck | Cost of Leasing a Truck |\n|-------|--------------------------------|-------------------------|\n| A     | $50,000                        | $15,000                 |\n| B     | $60,000                        | $18,000                 |\n| C     | $70,000                        | $20,000                 |\n| D     | $55,000                        | $16,000                 |\n| E     | $65,000                        | $19,000                 |\n\nThe company has a total of 100 company-owned trucks available. The total number of leased trucks should not exceed 50. The company wants to maximize the total profit minus the total leasing cost. Please help the company determine the optimal allocation of company-owned and leased trucks for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of company-owned trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of company-owned trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of company-owned trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of company-owned trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of company-owned trucks for RouteE\nLeaseA = model.addVar(vtype=\"INTEGER\", name=\"LeaseA\", lb=0) # number of leased trucks for RouteA\nLeaseB = model.addVar(vtype=\"INTEGER\", name=\"LeaseB\", lb=0) # number of leased trucks for RouteB\nLeaseC = model.addVar(vtype=\"INTEGER\", name=\"LeaseC\", lb=0) # number of leased trucks for RouteC\nLeaseD = model.addVar(vtype=\"INTEGER\", name=\"LeaseD\", lb=0) # number of leased trucks for RouteD\nLeaseE = model.addVar(vtype=\"INTEGER\", name=\"LeaseE\", lb=0) # number of leased trucks for RouteE\n\n# Define objective function\nProfit_A = 50000 * TruckA - 15000 * LeaseA\nProfit_B = 60000 * TruckB - 18000 * LeaseB\nProfit_C = 70000 * TruckC - 20000 * LeaseC\nProfit_D = 55000 * TruckD - 16000 * LeaseD\nProfit_E = 65000 * TruckE - 19000 * LeaseE\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n# The company has a total of 100 company-owned trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n# The total number of leased trucks should not exceed 50.\nmodel.addCons(LeaseA + LeaseB + LeaseC + LeaseD + LeaseE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Company-Owned Trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of Company-Owned Trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of Company-Owned Trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of Company-Owned Trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of Company-Owned Trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of Leased Trucks for RouteA: \", model.getVal(LeaseA))\n    print(\"Number of Leased Trucks for RouteB: \", model.getVal(LeaseB))\n    print(\"Number of Leased Trucks for RouteC: \", model.getVal(LeaseC))\n    print(\"Number of Leased Trucks for RouteD: \", model.getVal(LeaseD))\n    print(\"Number of Leased Trucks for RouteE: \", model.getVal(LeaseE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products.\n// {\"number of hours machine M1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine M1 produces 10 units of product A, 20 units of product B, and 30 units of product C per hour, with a cost of $50 per hour. Machine M2 produces 15 units of product A, 25 units of product B, and 35 units of product C per hour, with a cost of $60 per hour. Machine M3 produces 20 units of product A, 30 units of product B, and 40 units of product C per hour, with a cost of $70 per hour. Machine M4 produces 25 units of product A, 35 units of product B, and 45 units of product C per hour, with a cost of $80 per hour. Machine M5 produces 30 units of product A, 40 units of product B, and 50 units of product C per hour, with a cost of $90 per hour. The company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets.\n// Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n// Production of product A: A = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Production of product B: B = 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5\n// Production of product C: C = 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total production of product A must be at least 1000 units.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000\n\n## Generate Constraint-2:\nThe total production of product B must be at least 1500 units.\n// 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500\n\n## Generate Constraint-3:\nThe total production of product C must be at least 2000 units.\n// 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5 >= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour, as shown in the following Table.\n\n| Machine | Units of A Produced per Hour | Units of B Produced per Hour | Units of C Produced per Hour | Cost per Hour |\n|---------|------------------------------|------------------------------|------------------------------|---------------|\n| M1      | 10                           | 20                           | 30                           | $50           |\n| M2      | 15                           | 25                           | 35                           | $60           |\n| M3      | 20                           | 30                           | 40                           | $70           |\n| M4      | 25                           | 35                           | 45                           | $80           |\n| M5      | 30                           | 40                           | 50                           | $90           |\n\nThe company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets. The total production of product A must be at least 1000 units, the total production of product B must be at least 1500 units, and the total production of product C must be at least 2000 units.\n\nPlease help the company determine the optimal number of hours each machine should operate to minimize the total cost of production while meeting the production targets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of hours machine M1 operates\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of hours machine M2 operates\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of hours machine M3 operates\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of hours machine M4 operates\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of hours machine M5 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total production of product A must be at least 1000 units.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000)\n## The total production of product B must be at least 1500 units.\nmodel.addCons(20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500)\n## The total production of product C must be at least 2000 units.\nmodel.addCons(30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours machine M1 operates: \", model.getVal(M1))\n    print(\"Number of hours machine M2 operates: \", model.getVal(M2))\n    print(\"Number of hours machine M3 operates: \", model.getVal(M3))\n    print(\"Number of hours machine M4 operates: \", model.getVal(M4))\n    print(\"Number of hours machine M5 operates: \", model.getVal(M5))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1692,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision involves the number of solar panels and wind turbines to install, as well as the capacity of each type of installation.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of each solar panel (kW)\": \"SolarCapacity\", \"range\": \"SolarCapacity > 0\", \"type\": \"real\"}\n// {\"capacity of each wind turbine (kW)\": \"WindCapacity\", \"range\": \"WindCapacity > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of energy installations while ensuring sufficient energy generation. The cost function is nonlinear due to economies of scale and varying installation costs per unit.\n// Total cost of solar panels: CostSolar = 1000 * Solar * SolarCapacity^0.7\n// Total cost of wind turbines: CostWind = 2000 * Wind * WindCapacity^0.6\n// Total energy generation: Energy = Solar * SolarCapacity + Wind * WindCapacity\n// Objective function: Minimize CostSolar + CostWind\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for the installations.\n// 1000 * Solar * SolarCapacity^0.7 + 2000 * Wind * WindCapacity^0.6 <= 500000\n\n## Generate Constraint-2:\nThe total energy generation must meet or exceed 1000 kW.\n// Solar * SolarCapacity + Wind * WindCapacity >= 1000\n\n## Generate Constraint-3:\nThe company must install at least 5 solar panels and 3 wind turbines.\n// Solar >= 5\n// Wind >= 3\n\n## Generate Constraint-4:\nThe capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\n// SolarCapacity <= 20\n// WindCapacity <= 30",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision involves the number of solar panels and wind turbines to install, as well as the capacity of each type of installation. The company aims to minimize the total cost of energy installations while ensuring sufficient energy generation. The cost function is nonlinear due to economies of scale and varying installation costs per unit. The following table summarizes the cost and capacity details:\n\n| Installation Type | Cost per Unit (USD) | Capacity per Unit (kW) |\n|-------------------|---------------------|------------------------|\n| Solar Panel       | 1000                | SolarCapacity          |\n| Wind Turbine      | 2000                | WindCapacity           |\n\nThe company has a budget of $500,000 for the installations. The total energy generation must meet or exceed 1000 kW. The company must install at least 5 solar panels and 3 wind turbines. The capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\n\nPlease help the company determine the optimal number of solar panels and wind turbines to install, as well as the capacity of each, to minimize the total cost while meeting the energy requirements and budget constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=5)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=3)  # number of wind turbines\nSolarCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarCapacity\", lb=0.01)  # capacity of each solar panel (kW)\nWindCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"WindCapacity\", lb=0.01)  # capacity of each wind turbine (kW)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostSolar = 1000 * Solar * SolarCapacity**0.7\nCostWind = 2000 * Wind * WindCapacity**0.6\nmodel.addCons(obj == CostSolar + CostWind)\n\n# Add constraints\n## The company has a budget of $500,000 for the installations.\nmodel.addCons(1000 * Solar * SolarCapacity**0.7 + 2000 * Wind * WindCapacity**0.6 <= 500000)\n## The total energy generation must meet or exceed 1000 kW.\nmodel.addCons(Solar * SolarCapacity + Wind * WindCapacity >= 1000)\n## The company must install at least 5 solar panels and 3 wind turbines.\nmodel.addCons(Solar >= 5)\nmodel.addCons(Wind >= 3)\n## The capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\nmodel.addCons(SolarCapacity <= 20)\nmodel.addCons(WindCapacity <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Each Solar Panel (kW): \", model.getVal(SolarCapacity))\n    print(\"Capacity of Each Wind Turbine (kW): \", model.getVal(WindCapacity))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for trucks is 50 liters per 100 km, for vans is 30 liters per 100 km, and for motorcycles is 10 liters per 100 km. The company needs to deliver goods over a total distance of 5000 km. The objective is to minimize the total fuel consumption.\n// Fuel_Consumption_Trucks = 50 * T * 5000 / 100\n// Fuel_Consumption_Vans = 30 * V * 5000 / 100\n// Fuel_Consumption_Motorcycles = 10 * M * 5000 / 100\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\n// Minimize (250 * T + 150 * V + 50 * M)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles. Trucks cost $50,000 each, vans cost $30,000 each, and motorcycles cost $10,000 each.\n// 50000 * T + 30000 * V + 10000 * M <= 100000\n\n## Generate Constraint-2:\nThe total capacity of vehicles must meet the delivery demand of 1000 tons. Trucks can carry 50 tons, vans can carry 20 tons, and motorcycles can carry 5 tons.\n// 50 * T + 20 * V + 5 * M >= 1000\n\n## Generate Constraint-3:\nThe company can only purchase a maximum of 5 vehicles in total.\n// T + V + M <= 5\n\n## Generate Constraint-4:\nThe number of trucks cannot exceed the number of vans and motorcycles combined.\n// T <= V + M",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and capacity. The company needs to determine the optimal number of each type of vehicle to minimize fuel consumption while meeting delivery demands. The fuel consumption and carrying capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Consumption (liters/100 km) | Carrying Capacity (tons) |\n|--------------|----------------------------------|--------------------------|\n| Trucks       | 50                               | 50                       |\n| Vans         | 30                               | 20                       |\n| Motorcycles  | 10                               | 5                        |\n\nThe company needs to deliver goods over a total distance of 5000 km. The company has a budget of $100,000 for purchasing vehicles. Trucks cost $50,000 each, vans cost $30,000 each, and motorcycles cost $10,000 each. The total capacity of vehicles must meet the delivery demand of 1000 tons. The company can only purchase a maximum of 5 vehicles in total. The number of trucks cannot exceed the number of vans and motorcycles combined.\n\nPlease help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Trucks = 250 * T\nFuel_Consumption_Vans = 150 * V\nFuel_Consumption_Motorcycles = 50 * M\n## the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Motorcycles)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(50000 * T + 30000 * V + 10000 * M <= 100000)\n## The total capacity of vehicles must meet the delivery demand of 1000 tons.\nmodel.addCons(50 * T + 20 * V + 5 * M >= 1000)\n## The company can only purchase a maximum of 5 vehicles in total.\nmodel.addCons(T + V + M <= 5)\n## The number of trucks cannot exceed the number of vans and motorcycles combined.\nmodel.addCons(T <= V + M)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Motorcycles: \", model.getVal(M))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its distribution network for five different regions: North, South, East, West, and Central. They need to determine the number of trucks to allocate to each region to optimize their delivery efficiency.\n// {\"number of trucks allocated to the North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck in the North region is 0.8, in the South region is 0.9, in the East region is 0.7, in the West region is 0.85, and in the Central region is 1.0. The company wants to maximize the total efficiency of the truck fleet.\n// Total efficiency for the North region: EfficiencyNorth = 0.8 * TrucksNorth\n// Total efficiency for the South region: EfficiencySouth = 0.9 * TrucksSouth\n// Total efficiency for the East region: EfficiencyEast = 0.7 * TrucksEast\n// Total efficiency for the West region: EfficiencyWest = 0.85 * TrucksWest\n// Total efficiency for the Central region: EfficiencyCentral = 1.0 * TrucksCentral\n// So, the objective function is: Maximize (EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100\n\n## Generate Constraint-2:\nDue to geographical constraints, the number of trucks in the North region must be at least half the number in the Central region.\n// TrucksNorth >= 0.5 * TrucksCentral",
        "question": "A logistics company is planning its distribution network for five different regions: North, South, East, West, and Central. They need to determine the number of trucks to allocate to each region to optimize their delivery efficiency. The efficiency of each truck in the North region is 0.8, in the South region is 0.9, in the East region is 0.7, in the West region is 0.85, and in the Central region is 1.0. The company wants to maximize the total efficiency of the truck fleet. The company has a total of 100 trucks available for allocation. Due to geographical constraints, the number of trucks in the North region must be at least half the number in the Central region. Please help the company determine the optimal allocation of trucks to each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0) # number of trucks allocated to the North region\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0) # number of trucks allocated to the South region\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0) # number of trucks allocated to the East region\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0) # number of trucks allocated to the West region\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0) # number of trucks allocated to the Central region\n\n# Define objective function\nEfficiencyNorth = 0.8 * TrucksNorth\nEfficiencySouth = 0.9 * TrucksSouth\nEfficiencyEast = 0.7 * TrucksEast\nEfficiencyWest = 0.85 * TrucksWest\nEfficiencyCentral = 1.0 * TrucksCentral\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral)\nmodel.addCons(obj == EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest + TrucksCentral <= 100)\n# Due to geographical constraints, the number of trucks in the North region must be at least half the number in the Central region.\nmodel.addCons(TrucksNorth >= 0.5 * TrucksCentral)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different warehouses across the country. The company needs to determine the number of trucks to allocate to each warehouse for optimal distribution of goods.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach warehouse has a different efficiency in terms of goods distribution. \nAt warehouse 1, each truck can distribute 100 units of goods per hour. \nAt warehouse 2, each truck can distribute 120 units of goods per hour. \nAt warehouse 3, each truck can distribute 150 units of goods per hour. \nAt warehouse 4, each truck can distribute 130 units of goods per hour. \nAt warehouse 5, each truck can distribute 110 units of goods per hour. \nThe company needs to distribute at least 5000 units of goods per day. The objective is to minimize the total time taken to distribute these goods.\n// The distribution time for goods: T = 5000 / (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5)\n// So, the objective function is: Minimize T\n// Minimize (5000 / (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5))\n\n## Generate Constraint-1:\nThere are total 30 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach warehouse can handle up to 10 trucks at a time.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe company requires that at least 2 warehouses must be operational at any given time.\n// T1 + T2 + T3 + T4 + T5 >= 2",
        "question": "A logistics company operates 5 different warehouses across the country. The company needs to determine the number of trucks to allocate to each warehouse for optimal distribution of goods. Each warehouse has a different efficiency in terms of goods distribution. At warehouse 1, each truck can distribute 100 units of goods per hour. At warehouse 2, each truck can distribute 120 units of goods per hour. At warehouse 3, each truck can distribute 150 units of goods per hour. At warehouse 4, each truck can distribute 130 units of goods per hour. At warehouse 5, each truck can distribute 110 units of goods per hour. The company needs to distribute at least 5000 units of goods per day. The objective is to minimize the total time taken to distribute these goods. There are total 30 trucks available. Each warehouse can handle up to 10 trucks at a time. The company requires that at least 2 warehouses must be operational at any given time. Please help the company to minimize the total time taken to distribute 5000 units of goods per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=10) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=10) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=10) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=10) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistributionRate = 100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5\n## the objective function is: Minimize (5000 / DistributionRate)\n## convert the division to multiplication\nmodel.addCons(obj * DistributionRate == 5000)\n\n# Add constraints\n## There are total 30 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n## Each warehouse can handle up to 10 trucks at a time.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n## The company requires that at least 2 warehouses must be operational at any given time.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Distribution Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n// Revenue_A = 50 * A\n// Revenue_B = 70 * B\n// Revenue_C = 60 * C\n// Cost_A = 0.01 * A^2\n// Cost_B = 0.015 * B^2\n// Cost_C = 0.012 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\n// A <= 1000\n// B <= 800\n// C <= 900\n\n## Generate Constraint-2:\nThe market demand for product A is at least 500 units, for product B is at least 400 units, and for product C is at least 600 units.\n// A >= 500\n// B >= 400\n// C >= 600",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| A       | $50             | 0.01 * A^2               |\n| B       | $70             | 0.015 * B^2              |\n| C       | $60             | 0.012 * C^2              |\n\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C. The market demand for product A is at least 500 units, for product B is at least 400 units, and for product C is at least 600 units.\n\nPlease help the company to determine the optimal production quantity for each product to maximize the total profit, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500, ub=1000) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=400, ub=800) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=600, ub=900) # production quantity of product C\n\n# Define objective function\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nTotalProfit = Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\nmodel.addCons(A <= 1000)\nmodel.addCons(B <= 800)\nmodel.addCons(C <= 900)\n\n# The market demand for product A is at least 500 units, for product B is at least 400 units, and for product C is at least 600 units.\nmodel.addCons(A >= 500)\nmodel.addCons(B >= 400)\nmodel.addCons(C >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1423,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The company also needs to determine the investment in automation technology to reduce the labor hours required per unit.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\n// Total cost for ProductB: CostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\n// Total cost for ProductC: CostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the amount of resources (labor hours and raw materials) allocated to each product, and the investment in automation technology to reduce the labor hours required per unit. The cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit | Labor Hours per Unit (without automation) |\n|---------|------------------|------------------------------------------|\n| ProductA | $100             | LaborHoursA                              |\n| ProductB | $150             | LaborHoursB                              |\n| ProductC | $200             | LaborHoursC                              |\n\nThe company has a total of 10,000 labor hours available for the month. The company needs to determine the optimal number of units to produce for each product, the allocation of labor hours per unit, and the investment in automation technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit for ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit for ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit for ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # investment in automation technology\n\n# Define objective function\nCostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\nCostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\nCostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons((LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + \n              (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + \n              (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit for ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit for ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit for ProductC: \", model.getVal(LaborHoursC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region.\n// {\"number of trucks in region 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in region 1\": \"FE1\", \"range\": \"FE1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 2\": \"FE2\", \"range\": \"FE2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 3\": \"FE3\", \"range\": \"FE3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 4\": \"FE4\", \"range\": \"FE4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in region 5\": \"FE5\", \"range\": \"FE5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n// Total fuel cost for region 1: Cost1 = (3.50 * (D / FE1)) * T1\n// Total fuel cost for region 2: Cost2 = (3.50 * (D / FE2)) * T2\n// Total fuel cost for region 3: Cost3 = (3.50 * (D / FE3)) * T3\n// Total fuel cost for region 4: Cost4 = (3.50 * (D / FE4)) * T4\n// Total fuel cost for region 5: Cost5 = (3.50 * (D / FE5)) * T5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe fuel efficiency of trucks in each region must be at least 10 miles per gallon.\n// FE1 >= 10; FE2 >= 10; FE3 >= 10; FE4 >= 10; FE5 >= 10\n\n## Generate Constraint-3:\nEach region must have at least 5 trucks.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions. The company must decide how many trucks to allocate to each region and the fuel efficiency of each truck type in that region. The company aims to minimize the total fuel cost across all regions. The cost of fuel per gallon is $3.50, and the distance each truck travels in a region is inversely proportional to the fuel efficiency of the trucks in that region.\n\nThe company has a total of 100 trucks available. The fuel efficiency of trucks in each region must be at least 10 miles per gallon. Each region must have at least 5 trucks.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiency in each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks in region 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks in region 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks in region 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks in region 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks in region 5\nFE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE1\", lb=10) # fuel efficiency of trucks in region 1\nFE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE2\", lb=10) # fuel efficiency of trucks in region 2\nFE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE3\", lb=10) # fuel efficiency of trucks in region 3\nFE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE4\", lb=10) # fuel efficiency of trucks in region 4\nFE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FE5\", lb=10) # fuel efficiency of trucks in region 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\") # distance each truck travels\n## Total fuel cost for each region\nCost1 = 3.50 * (D / FE1) * T1\nCost2 = 3.50 * (D / FE2) * T2\nCost3 = 3.50 * (D / FE3) * T3\nCost4 = 3.50 * (D / FE4) * T4\nCost5 = 3.50 * (D / FE5) * T5\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(T1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(T2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(T3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(T4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(T5))\n    print(\"Fuel Efficiency in Region 1: \", model.getVal(FE1))\n    print(\"Fuel Efficiency in Region 2: \", model.getVal(FE2))\n    print(\"Fuel Efficiency in Region 3: \", model.getVal(FE3))\n    print(\"Fuel Efficiency in Region 4: \", model.getVal(FE4))\n    print(\"Fuel Efficiency in Region 5: \", model.getVal(FE5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TypeA trucks\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeB trucks\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TypeC trucks\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck type decreases with the investment in fuel efficiency technologies. The fuel consumption reduction is nonlinear, with diminishing returns as more investment is made. The initial fuel consumption for TypeA trucks is 50 liters per 100 km, for TypeB trucks is 60 liters per 100 km, and for TypeC trucks is 70 liters per 100 km. For every $1000 invested in efficiency, TypeA trucks reduce consumption by 1 liter per 100 km, TypeB by 1.5 liters per 100 km, and TypeC by 2 liters per 100 km. The company aims to minimize the total fuel consumption across all truck types.\n// Fuel consumption for TypeA: ConsumptionA = 50 - 0.001 * EfficiencyA\n// Fuel consumption for TypeB: ConsumptionB = 60 - 0.0015 * EfficiencyB\n// Fuel consumption for TypeC: ConsumptionC = 70 - 0.002 * EfficiencyC\n// Total fuel consumption: TotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n// So, the objective function is: Minimize TotalConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments.\n// TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 500.\n// TrucksA + TrucksB + TrucksC <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The company also needs to decide on the investment in fuel-saving technologies for each truck type to optimize fuel consumption and operational costs. The initial fuel consumption and the reduction in consumption per $1000 investment in efficiency for each truck type are given in the following Table.\n\n| Truck Type | Initial Fuel Consumption (liters/100km) | Reduction in Consumption per $1000 Investment (liters/100km) |\n|------------|-----------------------------------------|-----------------------------------------------------------------|\n| TypeA      | 50                                      | 1                                                               |\n| TypeB      | 60                                      | 1.5                                                             |\n| TypeC      | 70                                      | 2                                                               |\n\nThe company has a budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 500. Please help the company to minimize the total fuel consumption across all truck types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of TypeC trucks\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for TypeA trucks\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for TypeB trucks\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for TypeC trucks\n\n# Define objective function\nConsumptionA = 50 - 0.001 * EfficiencyA\nConsumptionB = 60 - 0.0015 * EfficiencyB\nConsumptionC = 70 - 0.002 * EfficiencyC\nTotalConsumption = (ConsumptionA * TrucksA) + (ConsumptionB * TrucksB) + (ConsumptionC * TrucksC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalConsumption)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + EfficiencyA + EfficiencyB + EfficiencyC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Investment in Efficiency for TypeA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for TypeB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for TypeC: \", model.getVal(EfficiencyC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1430,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices using 5 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating hours of each machine.\n// {\"operating hours for machine 1\": \"M1\", \"range\": \"0 <= M1 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 2\": \"M2\", \"range\": \"0 <= M2 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 3\": \"M3\", \"range\": \"0 <= M3 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 4\": \"M4\", \"range\": \"0 <= M4 <= 24\", \"type\": \"real\"}\n// {\"operating hours for machine 5\": \"M5\", \"range\": \"0 <= M5 <= 24\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different energy efficiency and production rate. Machine 1 consumes 10 units of energy per hour and produces 5 units of product. Machine 2 consumes 12 units of energy per hour and produces 6 units of product. Machine 3 consumes 15 units of energy per hour and produces 7 units of product. Machine 4 consumes 18 units of energy per hour and produces 8 units of product. Machine 5 consumes 20 units of energy per hour and produces 9 units of product. The plant aims to maximize the total production while keeping the total energy consumption below a certain threshold.\n// Total energy consumption: E = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\n// Total production: P = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\n// Objective function: Maximize P - E^2 (to introduce nonlinearity)\n\n## Generate Constraint-1:\nThe total energy consumption must not exceed 1000 units per day.\n// 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5 <= 1000",
        "question": "A manufacturing plant produces electronic devices using 5 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating hours of each machine. Each machine has a different energy efficiency and production rate. Machine 1 consumes 10 units of energy per hour and produces 5 units of product. Machine 2 consumes 12 units of energy per hour and produces 6 units of product. Machine 3 consumes 15 units of energy per hour and produces 7 units of product. Machine 4 consumes 18 units of energy per hour and produces 8 units of product. Machine 5 consumes 20 units of energy per hour and produces 9 units of product. The plant aims to maximize the total production while keeping the total energy consumption below a certain threshold. The total energy consumption must not exceed 1000 units per day.\nPlease help the plant manager to maximize the total production while considering the energy consumption constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0, ub=24) # operating hours for machine 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0, ub=24) # operating hours for machine 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0, ub=24) # operating hours for machine 3\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0, ub=24) # operating hours for machine 4\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0, ub=24) # operating hours for machine 5\n\n# Define objective function\n## Total energy consumption: E = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\n## Total production: P = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\n## Objective function: Maximize P - E^2 (to introduce nonlinearity)\nE = 10 * M1 + 12 * M2 + 15 * M3 + 18 * M4 + 20 * M5\nP = 5 * M1 + 6 * M2 + 7 * M3 + 8 * M4 + 9 * M5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - E**2)\n\n# Add constraints\n## The total energy consumption must not exceed 1000 units per day.\nmodel.addCons(E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Machine 1: \", model.getVal(M1))\n    print(\"Operating hours for Machine 2: \", model.getVal(M2))\n    print(\"Operating hours for Machine 3: \", model.getVal(M3))\n    print(\"Operating hours for Machine 4: \", model.getVal(M4))\n    print(\"Operating hours for Machine 5: \", model.getVal(M5))\n    print(\"Maximized Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit while considering various constraints such as material costs, production capacity, and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale in production costs. The production cost per unit decreases as the production quantity increases. The cost function for each product is given by: Cost_A = 20 - 0.01 * A^2, Cost_B = 30 - 0.01 * B^2, Cost_C = 40 - 0.01 * C^2. The company aims to maximize its total profit.\n// Profit_A = (50 - Cost_A) * A = (50 - (20 - 0.01 * A^2)) * A\n// Profit_B = (70 - Cost_B) * B = (70 - (30 - 0.01 * B^2)) * B\n// Profit_C = (90 - Cost_C) * C = (90 - (40 - 0.01 * C^2)) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for total material costs.\n// (20 - 0.01 * A^2) * A + (30 - 0.01 * B^2) * B + (40 - 0.01 * C^2) * C <= 10000\n\n## Generate Constraint-2:\nThe production capacity is limited to 200 hours per week. The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit while considering various constraints such as material costs, production capacity, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale in production costs. The cost function for each product is given by: Cost_A = 20 - 0.01 * A^2, Cost_B = 30 - 0.01 * B^2, Cost_C = 40 - 0.01 * C^2. The company aims to maximize its total profit.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $90             | 4 hours                  |\n\nThe company has a budget of $10,000 for total material costs. The production capacity is limited to 200 hours per week. The production time for product A is 2 hours per unit, for product B is 3 hours per unit, and for product C is 4 hours per unit.\n\nPlease help the company to maximize its total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The cost function for each product is given by: Cost_A = 20 - 0.01 * A^2, Cost_B = 30 - 0.01 * B^2, Cost_C = 40 - 0.01 * C^2\nCost_A = 20 - 0.01 * A**2\nCost_B = 30 - 0.01 * B**2\nCost_C = 40 - 0.01 * C**2\n## Profit_A = (50 - Cost_A) * A, Profit_B = (70 - Cost_B) * B, Profit_C = (90 - Cost_C) * C\nProfit_A = (50 - Cost_A) * A\nProfit_B = (70 - Cost_B) * B\nProfit_C = (90 - Cost_C) * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for total material costs.\nmodel.addCons((20 - 0.01 * A**2) * A + (30 - 0.01 * B**2) * B + (40 - 0.01 * C**2) * C <= 10000)\n## The production capacity is limited to 200 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A consumes 10 liters per 100 km and can carry 10 tons.\n- Truck B consumes 15 liters per 100 km and can carry 15 tons.\n- Truck C consumes 20 liters per 100 km and can carry 20 tons.\n- Truck D consumes 25 liters per 100 km and can carry 25 tons.\n- Truck E consumes 30 liters per 100 km and can carry 30 tons.\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons.\n// Fuel consumption of A: FC_A = 10 * A\n// Fuel consumption of B: FC_B = 15 * B\n// Fuel consumption of C: FC_C = 20 * C\n// Fuel consumption of D: FC_D = 25 * D\n// Fuel consumption of E: FC_E = 30 * E\n// So, the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet the demand of 1000 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to maintain at most 50 trucks.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel efficiency and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/100 km) | Cargo Capacity (tons) |\n|------------|----------------------------------|----------------------|\n| A          | 10                               | 10                   |\n| B          | 15                               | 15                   |\n| C          | 20                               | 20                   |\n| D          | 25                               | 25                   |\n| E          | 30                               | 30                   |\n\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons. The company has a budget to maintain at most 50 trucks. The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n\nPlease help the company to minimize the total fuel consumption while meeting the cargo capacity requirement.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC_A = 10 * A\nFC_B = 15 * B\nFC_C = 20 * C\nFC_D = 25 * D\nFC_E = 30 * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FC_A + FC_B + FC_C + FC_D + FC_E)\n\n# Add constraints\n## The total cargo capacity must meet the demand of 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n## The company has a budget to maintain at most 50 trucks.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1248,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"ES\", \"range\": \"ES >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n// Energy_output_SP = 0.15 * (1 + 0.005 * (R&D / 100000)) * SP\n// Energy_output_WT = 0.25 * (1 + 0.007 * (R&D / 100000)) * WT\n// Cost_ES = 1000 - 50 * (R&D / 100000) * ES\n// So, the objective function is: Maximize (Energy_output_SP + Energy_output_WT) - Cost_ES\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage.\n// SP * 10000 + WT * 15000 + ES * 500 <= 5000000\n\n## Generate Constraint-2:\nThe total investment in R&D cannot exceed $1,000,000.\n// R&D <= 1000000\n\n## Generate Constraint-3:\nThe total area available for installation is limited to 5000 square meters. Each solar panel requires 2 square meters, and each wind turbine requires 5 square meters.\n// 2 * SP + 5 * WT <= 5000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 solar panels and 50 wind turbines are installed.\n// SP >= 100; WT >= 50\n\n## Generate Constraint-5:\nThe energy storage capacity must be sufficient to store at least 50% of the total energy output.\n// ES >= 0.5 * (Energy_output_SP + Energy_output_WT)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (SP), wind turbines (WT), and the amount of energy storage (ES) to maximize the efficiency of the renewable energy system. The company also needs to decide on the investment in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and wind turbines is 25%. The cost of energy storage decreases by $50 for every $100,000 invested in R&D. The company aims to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n\nThe company has a budget of $5,000,000 for the installation of solar panels, wind turbines, and energy storage. The total investment in R&D cannot exceed $1,000,000. The total area available for installation is limited to 5000 square meters, with each solar panel requiring 2 square meters and each wind turbine requiring 5 square meters. The company must ensure that at least 100 solar panels and 50 wind turbines are installed. The energy storage capacity must be sufficient to store at least 50% of the total energy output.\n\nPlease help the company to maximize the total energy output (in MWh) while minimizing the cost of energy storage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=100)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=50)  # number of wind turbines\nES = model.addVar(vtype=\"INTEGER\", name=\"ES\", lb=0)  # amount of energy storage\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R_D\", lb=0)  # investment in R&D\n\n# Define objective function\nEnergy_output_SP = 0.15 * (1 + 0.005 * (R_D / 100000)) * SP\nEnergy_output_WT = 0.25 * (1 + 0.007 * (R_D / 100000)) * WT\nCost_ES = 1000 - 50 * (R_D / 100000) * ES\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output_SP + Energy_output_WT - Cost_ES)\n\n# Add constraints\nmodel.addCons(SP * 10000 + WT * 15000 + ES * 500 <= 5000000)  # budget constraint\nmodel.addCons(R_D <= 1000000)  # R&D investment constraint\nmodel.addCons(2 * SP + 5 * WT <= 5000)  # area constraint\nmodel.addCons(ES >= 0.5 * (Energy_output_SP + Energy_output_WT))  # energy storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Amount of Energy Storage: \", model.getVal(ES))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Maximized Total Energy Output - Cost of Energy Storage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1495,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each unit to optimize energy output and minimize operational costs.\n// {\"number of Solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment per Solar unit\": \"SolarMaintenance\", \"range\": \"SolarMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment per Wind unit\": \"WindMaintenance\", \"range\": \"WindMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment per Hydro unit\": \"HydroMaintenance\", \"range\": \"HydroMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each type of power plant is affected by the maintenance investment. For Solar, each $1000 invested increases the output by 1 MWh. For Wind, each $1000 invested increases the output by 1.5 MWh. For Hydro, each $1000 invested increases the output by 1.2 MWh. The operational cost per MWh is $50 for Solar, $60 for Wind, and $70 for Hydro. The company aims to maximize the net energy output (total energy output minus operational costs).\n// Total energy output for Solar: EnergySolar = SolarUnits * (10 + 0.001 * SolarMaintenance)\n// Total energy output for Wind: EnergyWind = WindUnits * (15 + 0.0015 * WindMaintenance)\n// Total energy output for Hydro: EnergyHydro = HydroUnits * (12 + 0.0012 * HydroMaintenance)\n// Operational cost for Solar: CostSolar = 50 * EnergySolar\n// Operational cost for Wind: CostWind = 60 * EnergyWind\n// Operational cost for Hydro: CostHydro = 70 * EnergyHydro\n// So, the objective function is: Maximize (EnergySolar - CostSolar + EnergyWind - CostWind + EnergyHydro - CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance investments and unit installations.\n// SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each unit to optimize energy output and minimize operational costs. The energy output of each type of power plant is affected by the maintenance investment. For Solar, each $1000 invested increases the output by 1 MWh. For Wind, each $1000 invested increases the output by 1.5 MWh. For Hydro, each $1000 invested increases the output by 1.2 MWh. The operational cost per MWh is $50 for Solar, $60 for Wind, and $70 for Hydro. The company aims to maximize the net energy output (total energy output minus operational costs). The company has a total budget of $100,000 for maintenance investments and unit installations. Please help the company to maximize the net energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nSolarMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarMaintenance\", lb=0)\nWindMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"WindMaintenance\", lb=0)\nHydroMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroMaintenance\", lb=0)\n\n# Define objective function\nEnergySolar = SolarUnits * (10 + 0.001 * SolarMaintenance)\nEnergyWind = WindUnits * (15 + 0.0015 * WindMaintenance)\nEnergyHydro = HydroUnits * (12 + 0.0012 * HydroMaintenance)\nCostSolar = 50 * EnergySolar\nCostWind = 60 * EnergyWind\nCostHydro = 70 * EnergyHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar - CostSolar + EnergyWind - CostWind + EnergyHydro - CostHydro)\n\n# Add constraints\nmodel.addCons(SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Maintenance Investment for Solar: \", model.getVal(SolarMaintenance))\n    print(\"Maintenance Investment for Wind: \", model.getVal(WindMaintenance))\n    print(\"Maintenance Investment for Hydro: \", model.getVal(HydroMaintenance))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA cannot exceed 200 units.\n// UnitsA <= 200\n\n## Generate Constraint-3:\nMarket research indicates that the demand for DeviceB is at least twice the demand for DeviceA.\n// UnitsB >= 2 * UnitsA\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceC to fulfill a contract.\n// UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of each device decreases as more units are produced beyond certain thresholds: $0.1 for each unit of DeviceA beyond 100 units, $0.05 for each unit of DeviceB beyond 200 units, and $0.02 for each unit of DeviceC beyond 300 units. The company aims to maximize total profit.\n\n| Device | Profit per Unit (beyond threshold) | Threshold |\n|--------|-----------------------------------|-----------|\n| DeviceA | $50 - $0.1 * (UnitsA - 100) | 100 units |\n| DeviceB | $70 - $0.05 * (UnitsB - 200) | 200 units |\n| DeviceC | $90 - $0.02 * (UnitsC - 300) | 300 units |\n\nThe company has a production capacity of 500 units in total. Due to raw material availability, the production of DeviceA cannot exceed 200 units. Market research indicates that the demand for DeviceB is at least twice the demand for DeviceA. Additionally, the company must produce at least 50 units of DeviceC to fulfill a contract.\n\nPlease help the company determine the optimal number of units to produce for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (90 - 0.02 * C2) * C2 * C_b2 + 90 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 200)\nmodel.addCons(UnitsB >= 2 * UnitsA)\nmodel.addCons(UnitsC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 50 vehicles.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\n// T <= 0.5 * (V + B)\n\n## Generate Constraint-4:\nThe company has a minimum requirement to operate at least 5 Trucks and 10 Vans.\n// T >= 5; V >= 10",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle | Revenue per Day | Operational Cost per Day |\n|---------|-----------------|--------------------------|\n| Trucks  | $500            | $200                     |\n| Vans    | $300            | $100                     |\n| Bikes   | $100            | $30                      |\n\nThe company has a total budget of $10,000 for daily operational costs. The company has a maximum storage capacity of 50 vehicles. The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined. The company has a minimum requirement to operate at least 5 Trucks and 10 Vans. \n\nPlease help the company to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=10) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n# So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n# The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n# The company has a maximum storage capacity of 50 vehicles.\nmodel.addCons(T + V + B <= 50)\n# The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\nmodel.addCons(T <= 0.5 * (V + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles.\n// {\"number of vehicles on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per vehicle is $1000, the fuel cost per vehicle is $200, and the maintenance cost per vehicle is $100.\nFor Route B, the profit per vehicle is $1200, the fuel cost per vehicle is $250, and the maintenance cost per vehicle is $120.\nFor Route C, the profit per vehicle is $1500, the fuel cost per vehicle is $300, and the maintenance cost per vehicle is $150.\nFor Route D, the profit per vehicle is $1800, the fuel cost per vehicle is $350, and the maintenance cost per vehicle is $180.\nFor Route E, the profit per vehicle is $2000, the fuel cost per vehicle is $400, and the maintenance cost per vehicle is $200.\nThe company wants to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost).\n// Net_Profit_A = 1000 * RouteA - 200 * RouteA - 100 * RouteA\n// Net_Profit_B = 1200 * RouteB - 250 * RouteB - 120 * RouteB\n// Net_Profit_C = 1500 * RouteC - 300 * RouteC - 150 * RouteC\n// Net_Profit_D = 1800 * RouteD - 350 * RouteD - 180 * RouteD\n// Net_Profit_E = 2000 * RouteE - 400 * RouteE - 200 * RouteE\n// Total_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 vehicles.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $20,000 for maintenance costs.\n// 100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000\n\n## Generate Constraint-3:\nRoute A has a maximum capacity of 30 vehicles due to local regulations.\n// RouteA <= 30\n\n## Generate Constraint-4:\nRoute E has a minimum requirement of 10 vehicles due to contractual obligations.\n// RouteE >= 10",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles. The profit per vehicle, fuel cost per vehicle, and maintenance cost per vehicle for each route are given in the following Table.\n\n| Route | Profit per Vehicle | Fuel Cost per Vehicle | Maintenance Cost per Vehicle |\n|-------|--------------------|-----------------------|------------------------------|\n| A     | $1000              | $200                  | $100                         |\n| B     | $1200              | $250                  | $120                         |\n| C     | $1500              | $300                  | $150                         |\n| D     | $1800              | $350                  | $180                         |\n| E     | $2000              | $400                  | $200                         |\n\nThe company has a total fleet size of 100 vehicles. The company has a budget of $20,000 for maintenance costs. Route A has a maximum capacity of 30 vehicles due to local regulations, and Route E has a minimum requirement of 10 vehicles due to contractual obligations. \n\nPlease help the company to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of vehicles on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of vehicles on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of vehicles on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of vehicles on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=10) # number of vehicles on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_A = (1000 - 200 - 100) * RouteA\nNet_Profit_B = (1200 - 250 - 120) * RouteB\nNet_Profit_C = (1500 - 300 - 150) * RouteC\nNet_Profit_D = (1800 - 350 - 180) * RouteD\nNet_Profit_E = (2000 - 400 - 200) * RouteE\nTotal_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n## the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Fuel_Cost == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\n## The company has a total fleet size of 100 vehicles.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 100)\n## The company has a budget of $20,000 for maintenance costs.\nmodel.addCons(100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000)\n## Route A has a maximum capacity of 30 vehicles due to local regulations.\nmodel.addCons(RouteA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles on Route A: \", model.getVal(RouteA))\n    print(\"Number of Vehicles on Route B: \", model.getVal(RouteB))\n    print(\"Number of Vehicles on Route C: \", model.getVal(RouteC))\n    print(\"Number of Vehicles on Route D: \", model.getVal(RouteD))\n    print(\"Number of Vehicles on Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 3\": \"FuelEfficiency3\", \"range\": \"FuelEfficiency3 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per liter is $1.5. The distance traveled by each truck in Region 1, Region 2, and Region 3 is 500 km, 700 km, and 600 km respectively. The company wants to minimize the total fuel cost per day.\n// FuelCostRegion1 = 1.5 * (500 / FuelEfficiency1) * TrucksRegion1\n// FuelCostRegion2 = 1.5 * (700 / FuelEfficiency2) * TrucksRegion2\n// FuelCostRegion3 = 1.5 * (600 / FuelEfficiency3) * TrucksRegion3\n// So, the objective function is: Minimize (FuelCostRegion1 + FuelCostRegion2 + FuelCostRegion3)\n\n## Generate Constraint-1:\nThe company has a total budget of $3000 for fuel costs per day.\n// (500 / FuelEfficiency1) * TrucksRegion1 + (700 / FuelEfficiency2) * TrucksRegion2 + (600 / FuelEfficiency3) * TrucksRegion3 <= 3000 / 1.5\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks that can be allocated across all regions.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region. The fuel cost per liter is $1.5, and the distance traveled by each truck in Region 1, Region 2, and Region 3 is 500 km, 700 km, and 600 km respectively. The company has a total budget of $3000 for fuel costs per day and a limit of 50 trucks that can be allocated across all regions. Please help the company to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0)  # number of trucks for Region 3\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nFuelEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency3\", lb=0)  # fuel efficiency of trucks for Region 3\n\n# Define objective function\nFuelCostRegion1 = 1.5 * (500 / FuelEfficiency1) * TrucksRegion1\nFuelCostRegion2 = 1.5 * (700 / FuelEfficiency2) * TrucksRegion2\nFuelCostRegion3 = 1.5 * (600 / FuelEfficiency3) * TrucksRegion3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostRegion1 + FuelCostRegion2 + FuelCostRegion3)\n\n# Add constraints\n# The company has a total budget of $3000 for fuel costs per day.\nmodel.addCons((500 / FuelEfficiency1) * TrucksRegion1 + (700 / FuelEfficiency2) * TrucksRegion2 + (600 / FuelEfficiency3) * TrucksRegion3 <= 3000 / 1.5)\n# The company has a limit of 50 trucks that can be allocated across all regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region 3: \", model.getVal(TrucksRegion3))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Fuel Efficiency for Region 3: \", model.getVal(FuelEfficiency3))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each product is as follows: Product A earns $50, Product B earns $70, Product C earns $90, Product D earns $110, and Product E earns $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource limitations. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2. The company aims to maximize the net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited budget of $50,000 for production.\n// 50A + 70B + 90C + 110D + 130E <= 50000\n\n## Generate Constraint-2:\nThe warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters. Each unit of product A requires 1 cubic meter, product B requires 2 cubic meters, product C requires 3 cubic meters, product D requires 4 cubic meters, and product E requires 5 cubic meters.\n// A + 2B + 3C + 4D + 5E <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product A to meet contractual obligations.\n// A >= 100",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the production quantities to maximize profit while considering various constraints. The profit per unit for each product is as follows: Product A earns $50, Product B earns $70, Product C earns $90, Product D earns $110, and Product E earns $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource limitations. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2. The company has a limited budget of $50,000 for production. The warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters. Each unit of product A requires 1 cubic meter, product B requires 2 cubic meters, product C requires 3 cubic meters, product D requires 4 cubic meters, and product E requires 5 cubic meters. The company must produce at least 100 units of product A to meet contractual obligations. Please help the company to maximize the net profit, which is the total revenue minus the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of product E\n\n# Define objective function\n## Total revenue: Revenue = 50A + 70B + 90C + 110D + 130E\n## Total cost: Cost = 1000 + 20A^2 + 15B^2 + 10C^2 + 5D^2 + 3E^2\n## So, the objective function is: Maximize (Revenue - Cost)\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nD_sq = model.addVar(vtype=\"INTEGER\", name=\"D_sq\")\nE_sq = model.addVar(vtype=\"INTEGER\", name=\"E_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nmodel.addCons(D_sq == D**2)\nmodel.addCons(E_sq == E**2)\nCost = 1000 + 20*A_sq + 15*B_sq + 10*C_sq + 5*D_sq + 3*E_sq\nRevenue = 50*A + 70*B + 90*C + 110*D + 130*E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited budget of $50,000 for production.\nmodel.addCons(50*A + 70*B + 90*C + 110*D + 130*E <= 50000)\n## The warehouse space is limited, and the total storage for all products cannot exceed 1000 cubic meters.\nmodel.addCons(A + 2*B + 3*C + 4*D + 5*E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints.\n// {\"number of solar panels on building A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building A generates 10 kWh per day, costs $100, and requires 1 square meter of roof space.\nEach solar panel on building B generates 15 kWh per day, costs $150, and requires 1.5 square meters of roof space.\nEach solar panel on building C generates 20 kWh per day, costs $200, and requires 2 square meters of roof space.\nEach solar panel on building D generates 25 kWh per day, costs $250, and requires 2.5 square meters of roof space.\nEach solar panel on building E generates 30 kWh per day, costs $300, and requires 3 square meters of roof space.\nThe city aims to maximize the total daily energy generation (kWh) while minimizing the total cost of installation.\n// Daily energy generation from A: Energy_A = 10 * A\n// Daily energy generation from B: Energy_B = 15 * B\n// Daily energy generation from C: Energy_C = 20 * C\n// Daily energy generation from D: Energy_D = 25 * D\n// Daily energy generation from E: Energy_E = 30 * E\n// Total cost of installation: Cost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n// So, the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n\n## Generate Constraint-1:\nThe total budget for the solar panel installation is $10,000.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000\n\n## Generate Constraint-2:\nThe total available roof space for installation across all buildings is 500 square meters.\n// A + 1.5 * B + 2 * C + 2.5 * D + 3 * E <= 500",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. The city has identified five different types of buildings (A, B, C, D, E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine how many solar panels to install on each type of building to maximize energy production while considering the cost and space constraints. The specifications for each type of building are given in the following Table.\n\n| Building | Energy Generation per Panel (kWh/day) | Cost per Panel ($) | Roof Space Required per Panel (sq.m) |\n|----------|---------------------------------------|--------------------|--------------------------------------|\n| A        | 10                                    | 100                | 1                                    |\n| B        | 15                                    | 150                | 1.5                                  |\n| C        | 20                                    | 200                | 2                                    |\n| D        | 25                                    | 250                | 2.5                                  |\n| E        | 30                                    | 300                | 3                                    |\n\nThe total budget for the solar panel installation is $10,000. The total available roof space for installation across all buildings is 500 square meters. Please help the city to maximize the total daily energy generation (kWh) while minimizing the total cost of installation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels on building A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels on building B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels on building C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels on building D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels on building E\n\n# Define objective function\n## Daily energy generation from each building\nEnergy_A = 10 * A\nEnergy_B = 15 * B\nEnergy_C = 20 * C\nEnergy_D = 25 * D\nEnergy_E = 30 * E\n## Total cost of installation\nCost = 100 * A + 150 * B + 200 * C + 250 * D + 300 * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Energy_A + Energy_B + Energy_C + Energy_D + Energy_E) - (Cost / 1000)\n## convert the division to multiplication\nmodel.addCons(obj == Energy_A + Energy_B + Energy_C + Energy_D + Energy_E - Cost / 1000)\n\n# Add constraints\n## The total budget for the solar panel installation is $10,000.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n## The total available roof space for installation across all buildings is 500 square meters.\nmodel.addCons(A + 1.5 * B + 2 * C + 2.5 * D + 3 * E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building A: \", model.getVal(A))\n    print(\"Number of Solar Panels on Building B: \", model.getVal(B))\n    print(\"Number of Solar Panels on Building C: \", model.getVal(C))\n    print(\"Number of Solar Panels on Building D: \", model.getVal(D))\n    print(\"Number of Solar Panels on Building E: \", model.getVal(E))\n    print(\"Maximized Daily Energy Generation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1571,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of production per unit of ProductA is $30, ProductB is $40, and ProductC is $35. The fixed operational cost per shift is $1000. The company aims to maximize the net profit per day.\n// Revenue_ProductA = ProductAQty * 50\n// Revenue_ProductB = ProductBQty * 70\n// Revenue_ProductC = ProductCQty * 60\n// Cost_ProductA = ProductAQty * 30\n// Cost_ProductB = ProductBQty * 40\n// Cost_ProductC = ProductCQty * 35\n// FixedCost = NumShifts * 1000\n// NetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n// So, the objective function is: Maximize (NetProfit)\n\n## Generate Constraint-1:\nThe company has a daily production capacity of 1000 units in total.\n// ProductAQty + ProductBQty + ProductCQty <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each shift has a fixed operational cost and contributes to the production of each product. The revenue per unit, cost of production per unit, and fixed operational cost per shift are given in the following Table.\n\n| Product | Revenue per Unit | Cost of Production per Unit | Fixed Operational Cost per Shift |\n|---------|------------------|------------------------------|----------------------------------|\n| ProductA | $50              | $30                          | $1000                           |\n| ProductB | $70              | $40                          | $1000                           |\n| ProductC | $60              | $35                          | $1000                           |\n\nThe company has a daily production capacity of 1000 units in total. The company aims to maximize the net profit per day. Please help the company determine the optimal production quantity for each product and the number of shifts to operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nRevenue_ProductA = ProductAQty * 50\nRevenue_ProductB = ProductBQty * 70\nRevenue_ProductC = ProductCQty * 60\nCost_ProductA = ProductAQty * 30\nCost_ProductB = ProductBQty * 40\nCost_ProductC = ProductCQty * 35\nFixedCost = NumShifts * 1000\nNetProfit = (Revenue_ProductA + Revenue_ProductB + Revenue_ProductC) - (Cost_ProductA + Cost_ProductB + Cost_ProductC + FixedCost)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks allocated to Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Warehouse E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs. The cost function for each warehouse is nonlinear and is given by:\nFor Warehouse A: Cost = 500 + 10 * TruckA^2\nFor Warehouse B: Cost = 600 + 8 * TruckB^2\nFor Warehouse C: Cost = 550 + 12 * TruckC^2\nFor Warehouse D: Cost = 700 + 9 * TruckD^2\nFor Warehouse E: Cost = 650 + 11 * TruckE^2\nThe company wants to minimize the total operating cost of all trucks across the warehouses.\n// Total Cost = 500 + 10 * TruckA^2 + 600 + 8 * TruckB^2 + 550 + 12 * TruckC^2 + 700 + 9 * TruckD^2 + 650 + 11 * TruckE^2\n// So, the objective function is: Minimize Total Cost\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company operates five different warehouses (Warehouse A, B, C, D, and E) across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to different fuel prices and maintenance costs, and is given by the following nonlinear cost functions:\n\n| Warehouse | Cost Function                |\n|-----------|------------------------------|\n| A         | Cost = 500 + 10 * TruckA^2   |\n| B         | Cost = 600 + 8 * TruckB^2    |\n| C         | Cost = 550 + 12 * TruckC^2   |\n| D         | Cost = 700 + 9 * TruckD^2    |\n| E         | Cost = 650 + 11 * TruckE^2   |\n\nThe company wants to minimize the total operating cost of all trucks across the warehouses. The total number of trucks available is 100.\n\nPlease help the company determine the optimal number of trucks to allocate to each warehouse to minimize the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to Warehouse C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to Warehouse D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to Warehouse E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostA = 500 + 10 * TruckA**2\nCostB = 600 + 8 * TruckB**2\nCostC = 550 + 12 * TruckC**2\nCostD = 700 + 9 * TruckD**2\nCostE = 650 + 11 * TruckE**2\n## the objective function is: Minimize Total Cost\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Warehouse C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Warehouse D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Warehouse E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost includes fuel cost and depreciation cost. The fuel cost is directly proportional to the amount of fuel purchased and the speed of the trucks. The depreciation cost increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes.\n// Fuel cost for Route1: FuelCost1 = Fuel1 * Speed1\n// Fuel cost for Route2: FuelCost2 = Fuel2 * Speed2\n// Depreciation cost for Route1: Depreciation1 = 0.01 * Speed1^2 * Trucks1\n// Depreciation cost for Route2: Depreciation2 = 0.01 * Speed2^2 * Trucks2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n## Generate Constraint-1:\nThe total budget for fuel purchases is $10,000.\n// Fuel1 + Fuel2 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks must not exceed 60 km/h.\n// Speed1 <= 60; Speed2 <= 60\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 trucks are used for Route1 and 15 trucks for Route2.\n// Trucks1 >= 20; Trucks2 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks. The operational cost includes fuel cost, which is directly proportional to the amount of fuel purchased and the speed of the trucks, and depreciation cost, which increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes. The total budget for fuel purchases is $10,000. The total number of trucks available is 50. Due to safety regulations, the speed of trucks must not exceed 60 km/h. The company must ensure that at least 20 trucks are used for Route1 and 15 trucks for Route2. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel purchased for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel purchased for Route2\n\n# Define objective function\nFuelCost1 = Fuel1 * Speed1\nFuelCost2 = Fuel2 * Speed2\nDepreciation1 = 0.01 * Speed1**2 * Trucks1\nDepreciation2 = 0.01 * Speed2**2 * Trucks2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 <= 10000)  # total budget for fuel purchases\nmodel.addCons(Trucks1 + Trucks2 <= 50)  # total number of trucks available\nmodel.addCons(Speed1 <= 60)  # speed of trucks must not exceed 60 km/h\nmodel.addCons(Speed2 <= 60)  # speed of trucks must not exceed 60 km/h\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Fuel Purchased for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Purchased for Route2: \", model.getVal(Fuel2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (in hours) allocated to each product. The efficiency of resource use can be improved by investing in automation technology, which affects the resource usage per unit of product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for ProductA (in hours)\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductB (in hours)\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductC (in hours)\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The resource usage per unit decreases by 1 hour for every $500 invested in automation for that product. The initial resource usage per unit for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The company aims to maximize the total profit from all products.\n// ProfitA = (100 * QuantityA) - (ResourceA * QuantityA) + (0.002 * AutomationA * QuantityA)\n// ProfitB = (150 * QuantityB) - (ResourceB * QuantityB) + (0.002 * AutomationB * QuantityB)\n// ProfitC = (200 * QuantityC) - (ResourceC * QuantityC) + (0.002 * AutomationC * QuantityC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource allocation (in hours) across all products cannot exceed 1000 hours.\n// ResourceA + ResourceB + ResourceC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the amount of resources (in hours) allocated to each product, and the investment in automation technology for each product. The efficiency of resource use can be improved by investing in automation technology, which affects the resource usage per unit of product. The profit per unit and the initial resource usage per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Initial Resource Usage per Unit |\n|---------|-----------------|---------------------------------|\n| ProductA | $100            | 5 hours                         |\n| ProductB | $150            | 6 hours                         |\n| ProductC | $200            | 7 hours                         |\n\nThe company aims to maximize the total profit from all products. The resource usage per unit decreases by 1 hour for every $500 invested in automation for that product. The total resource allocation (in hours) across all products cannot exceed 1000 hours. Please help the company determine the optimal production quantities, resource allocations, and investments in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resource allocation for ProductA\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resource allocation for ProductB\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resource allocation for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 * QuantityA) - (ResourceA * QuantityA) + (0.002 * AutomationA * QuantityA)\nProfitB = (150 * QuantityB) - (ResourceB * QuantityB) + (0.002 * AutomationB * QuantityB)\nProfitC = (200 * QuantityC) - (ResourceC * QuantityC) + (0.002 * AutomationC * QuantityC)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total resource allocation (in hours) across all products cannot exceed 1000 hours.\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resource Allocation for ProductA: \", model.getVal(ResourceA))\n    print(\"Resource Allocation for ProductB: \", model.getVal(ResourceB))\n    print(\"Resource Allocation for ProductC: \", model.getVal(ResourceC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: CargoA, CargoB, and CargoC. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will affect the operational costs and fuel efficiency.\n// {\"number of trucks for CargoA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for CargoA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CargoB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CargoC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost decreases by $50 per truck per month. The operational cost of a truck without technology is $1000 per month for CargoA, $1200 for CargoB, and $1500 for CargoC. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for CargoA: CostA = (1000 - 0.05 * TechA) * TrucksA\n// Operational cost for CargoB: CostB = (1200 - 0.05 * TechB) * TrucksB\n// Operational cost for CargoC: CostC = (1500 - 0.05 * TechC) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies.\n// TrucksA + TrucksB + TrucksC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// TrucksA + TrucksB + TrucksC <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must have at least 50 trucks for CargoA and 60 trucks for CargoB.\n// TrucksA >= 50; TrucksB >= 60\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each type of truck cannot exceed the cost of purchasing that type of truck.\n// TechA <= TrucksA; TechB <= TrucksB; TechC <= TrucksC",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: CargoA, CargoB, and CargoC. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will affect the operational costs and fuel efficiency. The operational cost of each truck is affected by the investment in fuel-efficient technology. For every $1000 invested in technology, the operational cost decreases by $50 per truck per month. The operational cost of a truck without technology is $1000 per month for CargoA, $1200 for CargoB, and $1500 for CargoC. The company aims to minimize the total operational cost of the fleet.\n\nThe company has a budget of $100,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks in the fleet must not exceed 200. Due to contractual obligations, the company must have at least 50 trucks for CargoA and 60 trucks for CargoB. The investment in fuel-efficient technology for each type of truck cannot exceed the cost of purchasing that type of truck.\n\nPlease help the company to determine the optimal number of trucks and the investment in fuel-efficient technologies to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=50)  # number of trucks for CargoA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=60)  # number of trucks for CargoB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)    # number of trucks for CargoC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)    # investment in fuel-efficient technology for CargoA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)    # investment in fuel-efficient technology for CargoB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)    # investment in fuel-efficient technology for CargoC\n\n# Define objective function\nCostA = (1000 - 0.05 * TechA) * TrucksA\nCostB = (1200 - 0.05 * TechB) * TrucksB\nCostC = (1500 - 0.05 * TechC) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TechA + TechB + TechC <= 100000)\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 200)\nmodel.addCons(TrucksA >= 50)\nmodel.addCons(TrucksB >= 60)\nmodel.addCons(TechA <= TrucksA)\nmodel.addCons(TechB <= TrucksB)\nmodel.addCons(TechC <= TrucksC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CargoB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CargoC: \", model.getVal(TrucksC))\n    print(\"Investment in Tech for CargoA: \", model.getVal(TechA))\n    print(\"Investment in Tech for CargoB: \", model.getVal(TechB))\n    print(\"Investment in Tech for CargoC: \", model.getVal(TechC))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 hours of assembly time and 1 hour of testing time. \nThe profit per unit of E2 is $150, requiring 3 hours of assembly time and 2 hours of testing time. \nThe profit per unit of E3 is $200, requiring 4 hours of assembly time and 3 hours of testing time. \nThe company aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// Total_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\n// Total_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time), where C is a cost coefficient for time.\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours available for assembly.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours available for testing.\n// 1 * Q1 + 2 * Q2 + 3 * Q3 <= 500\n\n## Generate Constraint-3:\nThe market demand for E1 is limited to 50 units.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe company has a budget constraint for raw materials, which limits the production of E2 to 30 units.\n// Q2 <= 30\n\n## Generate Constraint-5:\nThe total production quantity should not exceed 100 units.\n// Q1 + Q2 + Q3 <= 100",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints. The profit per unit and the required assembly and testing times for each device are given in the following Table.\n\n| Device | Profit per Unit | Assembly Time | Testing Time |\n|--------|-----------------|---------------|--------------|\n| E1     | $100            | 2 hours       | 1 hour       |\n| E2     | $150            | 3 hours       | 2 hours      |\n| E3     | $200            | 4 hours       | 3 hours      |\n\nThe company has a total of 1000 hours available for assembly and 500 hours available for testing. The market demand for E1 is limited to 50 units, and the budget constraint for raw materials limits the production of E2 to 30 units. The total production quantity should not exceed 100 units. \n\nPlease help the company to maximize the total profit, considering a cost coefficient for time in the objective function, which is defined as the sum of the profits from each device minus the cost coefficient times the total assembly and testing times.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=50)  # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0, ub=30)  # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0)  # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\nTotal_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\nTotal_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\nC = 1  # cost coefficient for time\n# The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 - C * (Total_Assembly_Time + Total_Testing_Time))\n\n# Add constraints\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000)  # Total assembly time constraint\nmodel.addCons(1 * Q1 + 2 * Q2 + 3 * Q3 <= 500)  # Total testing time constraint\nmodel.addCons(Q1 <= 50)  # Market demand constraint for E1\nmodel.addCons(Q2 <= 30)  # Budget constraint for raw materials for E2\nmodel.addCons(Q1 + Q2 + Q3 <= 100)  # Total production quantity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon.\nFor T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon.\nFor T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon.\nFor T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon.\nFor T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// Total capacity: Capacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5\n\n## Generate Constraint-4:\nThe total number of trucks must not exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-5:\nThe number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks.\n// T5 <= T1 + T2 + T3 + T4",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities, operational costs per mile, and fuel efficiencies. The details for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Capacity | Fuel Efficiency |\n|------------|---------------------------|----------|-----------------|\n| T1         | $2                        | 10 tons  | 5 miles/gallon  |\n| T2         | $3                        | 15 tons  | 4 miles/gallon  |\n| T3         | $4                        | 20 tons  | 3 miles/gallon  |\n| T4         | $5                        | 25 tons  | 2 miles/gallon  |\n| T5         | $6                        | 30 tons  | 1 mile/gallon   |\n\nThe company has a budget of $500,000 for purchasing trucks. The total capacity of all trucks must be at least 1000 tons. The company must have at least 5 trucks of each type. The total number of trucks must not exceed 50. The number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks.\n\nPlease help the company to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nCapacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000)\n## The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company must have at least 5 trucks of each type.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 5)\nmodel.addCons(T3 >= 5)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 5)\n## The total number of trucks must not exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks.\nmodel.addCons(T5 <= T1 + T2 + T3 + T4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1364,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the labor hours required for each product, and the amount of raw material used for each product. The efficiency of raw material usage can be improved by investing in technology upgrades, which will reduce the raw material usage per unit of product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"raw material usage per unit of ProductA\": \"RawMaterialA\", \"range\": \"RawMaterialA >= 0\", \"type\": \"continuous\"}\n// {\"raw material usage per unit of ProductB\": \"RawMaterialB\", \"range\": \"RawMaterialB >= 0\", \"type\": \"continuous\"}\n// {\"raw material usage per unit of ProductC\": \"RawMaterialC\", \"range\": \"RawMaterialC >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of raw material per unit decreases by $5 for every $1000 invested in technology upgrades for that product. The initial raw material cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The revenue generated per unit is $200 for ProductA, $300 for ProductB, and $400 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * TechUpgradeA) * QuantityA\n// Total profit for ProductB: ProfitB = (300 - 150 + 0.005 * TechUpgradeB) * QuantityB\n// Total profit for ProductC: ProfitC = (400 - 200 + 0.005 * TechUpgradeC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the labor hours required for each product, and the amount of raw material used for each product. The efficiency of raw material usage can be improved by investing in technology upgrades, which will reduce the raw material usage per unit of product. The initial raw material cost per unit and the revenue generated per unit for each product are given in the following Table.\n\n| Product | Initial Raw Material Cost per Unit | Revenue per Unit |\n|---------|-----------------------------------|------------------|\n| ProductA | $100                              | $200             |\n| ProductB | $150                              | $300             |\n| ProductC | $200                              | $400             |\n\nThe cost of raw material per unit decreases by $5 for every $1000 invested in technology upgrades for that product. The company has a total of 10,000 labor hours available for the month. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal production quantity for each product, the labor hours required for each product, and the investment in technology upgrades to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0) # labor hours per unit of ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0) # labor hours per unit of ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0) # labor hours per unit of ProductC\nRawMaterialA = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialA\", lb=0) # raw material usage per unit of ProductA\nRawMaterialB = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialB\", lb=0) # raw material usage per unit of ProductB\nRawMaterialC = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialC\", lb=0) # raw material usage per unit of ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0) # investment in technology upgrades for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0) # investment in technology upgrades for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0) # investment in technology upgrades for ProductC\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * TechUpgradeA) * QuantityA\n## Total profit for ProductB: ProfitB = (300 - 150 + 0.005 * TechUpgradeB) * QuantityB\n## Total profit for ProductC: ProfitC = (400 - 200 + 0.005 * TechUpgradeC) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (200 - 100 + 0.005 * TechUpgradeA) * QuantityA\nProfitB = (300 - 150 + 0.005 * TechUpgradeB) * QuantityB\nProfitC = (400 - 200 + 0.005 * TechUpgradeC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 10,000 labor hours available for the month.\nmodel.addCons(LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborHoursC))\n    print(\"Raw Material Usage per Unit of ProductA: \", model.getVal(RawMaterialA))\n    print(\"Raw Material Usage per Unit of ProductB: \", model.getVal(RawMaterialB))\n    print(\"Raw Material Usage per Unit of ProductC: \", model.getVal(RawMaterialC))\n    print(\"Investment in Technology Upgrades for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Investment in Technology Upgrades for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Investment in Technology Upgrades for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1330,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours allocated to ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\n// Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n// Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n// Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available production hours for the company is 100 hours.\n// HoursA + HoursB + HoursC <= 100\n\n## Generate Constraint-2:\nThe company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB.\n// UnitsA >= 10; UnitsB >= 15\n\n## Generate Constraint-3:\nDue to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\n// UnitsC <= 2 * UnitsA\n\n## Generate Constraint-4:\nThe company has a budget constraint that the total cost of production should not exceed $2000.\n// (20 * HoursA / 5) * UnitsA + (25 * HoursB / 4) * UnitsB + (30 * HoursC / 3) * UnitsC <= 2000\n\n## Generate Constraint-5:\nTo maintain quality, the company must ensure that the production hours for each product are at least 10% of the total available hours.\n// HoursA >= 0.1 * 100; HoursB >= 0.1 * 100; HoursC >= 0.1 * 100",
        "question": "A manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\n\nThe total available production hours for the company is 100 hours. The company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB. Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA. The company has a budget constraint that the total cost of production should not exceed $2000. To maintain quality, the company must ensure that the production hours for each product are at least 10% of the total available hours.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # number of hours allocated to ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # number of hours allocated to ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # number of hours allocated to ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (50 - (20 * HoursA / 5)) * UnitsA\nProfitB = (70 - (25 * HoursB / 4)) * UnitsB\nProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total available production hours for the company is 100 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 100)\n## The company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB.\nmodel.addCons(UnitsA >= 10)\nmodel.addCons(UnitsB >= 15)\n## Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\nmodel.addCons(UnitsC <= 2 * UnitsA)\n## The company has a budget constraint that the total cost of production should not exceed $2000.\nmodel.addCons((20 * HoursA / 5) * UnitsA + (25 * HoursB / 4) * UnitsB + (30 * HoursC / 3) * UnitsC <= 2000)\n## To maintain quality, the company must ensure that the production hours for each product are at least 10% of the total available hours.\nmodel.addCons(HoursA >= 0.1 * 100)\nmodel.addCons(HoursB >= 0.1 * 100)\nmodel.addCons(HoursC >= 0.1 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Hours Allocated to ProductA: \", model.getVal(HoursA))\n    print(\"Hours Allocated to ProductB: \", model.getVal(HoursB))\n    print(\"Hours Allocated to ProductC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each cargo type and the distance each truck will travel. The cost and revenue associated with each type of cargo vary with the distance traveled.\n// {\"number of trucks for Fragile\": \"FragileTrucks\", \"range\": \"FragileTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for General\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each Fragile truck\": \"FragileDistance\", \"range\": \"FragileDistance >= 0\", \"type\": \"continuous\"}\n// {\"distance traveled by each Perishable truck\": \"PerishableDistance\", \"range\": \"PerishableDistance >= 0\", \"type\": \"continuous\"}\n// {\"distance traveled by each General truck\": \"GeneralDistance\", \"range\": \"GeneralDistance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of transporting Fragile cargo is $0.5 per mile, and the revenue is $1.5 per mile.\nThe cost of transporting Perishable cargo is $0.4 per mile, and the revenue is $1.2 per mile.\nThe cost of transporting General cargo is $0.3 per mile, and the revenue is $0.9 per mile.\nThe company aims to maximize the total profit from all cargo types.\n// Profit_Fragile = FragileTrucks * FragileDistance * (1.5 - 0.5)\n// Profit_Perishable = PerishableTrucks * PerishableDistance * (1.2 - 0.4)\n// Profit_General = GeneralTrucks * GeneralDistance * (0.9 - 0.3)\n// So, the objective function is: Maximize (Profit_Fragile + Profit_Perishable + Profit_General)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// FragileTrucks + PerishableTrucks + GeneralTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $1000 for transportation costs per day.\n// 0.5 * FragileTrucks * FragileDistance + 0.4 * PerishableTrucks * PerishableDistance + 0.3 * GeneralTrucks * GeneralDistance <= 1000\n\n## Generate Constraint-3:\nThe total distance traveled by all trucks must not exceed 2000 miles per day.\n// FragileTrucks * FragileDistance + PerishableTrucks * PerishableDistance + GeneralTrucks * GeneralDistance <= 2000",
        "question": "A logistics company is planning its routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each cargo type and the distance each truck will travel. The cost and revenue associated with each type of cargo vary with the distance traveled.\nThe cost of transporting Fragile cargo is $0.5 per mile, and the revenue is $1.5 per mile.\nThe cost of transporting Perishable cargo is $0.4 per mile, and the revenue is $1.2 per mile.\nThe cost of transporting General cargo is $0.3 per mile, and the revenue is $0.9 per mile.\nThe company aims to maximize the total profit from all cargo types.\nThe company has a total of 50 trucks available. The company has a budget of $1000 for transportation costs per day. The total distance traveled by all trucks must not exceed 2000 miles per day.\nPlease help the company to maximize the total profit from all cargo types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFragileTrucks = model.addVar(vtype=\"INTEGER\", name=\"FragileTrucks\", lb=0)  # number of trucks for Fragile\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for Perishable\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=0)  # number of trucks for General\nFragileDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"FragileDistance\", lb=0)  # distance traveled by each Fragile truck\nPerishableDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableDistance\", lb=0)  # distance traveled by each Perishable truck\nGeneralDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"GeneralDistance\", lb=0)  # distance traveled by each General truck\n\n# Define objective function\nProfit_Fragile = FragileTrucks * FragileDistance * (1.5 - 0.5)\nProfit_Perishable = PerishableTrucks * PerishableDistance * (1.2 - 0.4)\nProfit_General = GeneralTrucks * GeneralDistance * (0.9 - 0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Fragile + Profit_Perishable + Profit_General)\n\n# Add constraints\nmodel.addCons(FragileTrucks + PerishableTrucks + GeneralTrucks <= 50)\nmodel.addCons(0.5 * FragileTrucks * FragileDistance + 0.4 * PerishableTrucks * PerishableDistance + 0.3 * GeneralTrucks * GeneralDistance <= 1000)\nmodel.addCons(FragileTrucks * FragileDistance + PerishableTrucks * PerishableDistance + GeneralTrucks * GeneralDistance <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Fragile Trucks: \", model.getVal(FragileTrucks))\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of General Trucks: \", model.getVal(GeneralTrucks))\n    print(\"Distance Traveled by Each Fragile Truck: \", model.getVal(FragileDistance))\n    print(\"Distance Traveled by Each Perishable Truck: \", model.getVal(PerishableDistance))\n    print(\"Distance Traveled by Each General Truck: \", model.getVal(GeneralDistance))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, given by:\nCost_A = 1000 + 0.01 * (ProductA^2)\nCost_B = 1500 + 0.015 * (ProductB^2)\nCost_C = 1200 + 0.012 * (ProductC^2)\nCost_D = 1800 + 0.018 * (ProductD^2)\nCost_E = 2000 + 0.02 * (ProductE^2)\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\n// Total Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 12\n// ProductD >= 20\n// ProductE >= 25\n\n## Generate Constraint-3:\nThe raw material for Product D is limited, and no more than 300 units of Product D can be produced.\n// ProductD <= 300\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total production is dedicated to any single product.\n// ProductA <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE)\n// ProductB <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE)\n// ProductC <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE)\n// ProductD <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE)\n// ProductE <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE)",
        "question": "A manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process. The profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, where the cost increases with the square of the production quantity. The company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\n\nThe total production capacity of the factory is limited to 1000 units across all products. The company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E. The raw material for Product D is limited, and no more than 300 units of Product D can be produced. Additionally, the company wants to ensure that no more than 40% of the total production is dedicated to any single product.\n\nPlease help the company determine the optimal production quantities for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=10) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=15) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=12) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=20, ub=300) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=25) # amount of Product E produced\n\n# Define objective function\nCost_A = 1000 + 0.01 * (ProductA**2)\nCost_B = 1500 + 0.015 * (ProductB**2)\nCost_C = 1200 + 0.012 * (ProductC**2)\nCost_D = 1800 + 0.018 * (ProductD**2)\nCost_E = 2000 + 0.02 * (ProductE**2)\nTotalProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1000)\nmodel.addCons(ProductA <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE))\nmodel.addCons(ProductB <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE))\nmodel.addCons(ProductC <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE))\nmodel.addCons(ProductD <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE))\nmodel.addCons(ProductE <= 0.4 * (ProductA + ProductB + ProductC + ProductD + ProductE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit. The company has a production capacity of 500 units in total. Please help the company determine the optimal number of units to produce for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-saving technology for product A\": \"EnergyInvestA\", \"range\": \"EnergyInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product B\": \"EnergyInvestB\", \"range\": \"EnergyInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product C\": \"EnergyInvestC\", \"range\": \"EnergyInvestC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product D\": \"EnergyInvestD\", \"range\": \"EnergyInvestD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n// Profit of product A: ProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\n// Profit of product B: ProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\n// Profit of product C: ProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\n// Profit of product D: ProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for energy-saving technology investments.\n// EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000\n\n## Generate Constraint-2:\nThe total raw material cost must not exceed $50,000.\n// 30 * A + 40 * B + 50 * C + 60 * D <= 50000\n\n## Generate Constraint-3:\nThe total labor cost must not exceed $30,000.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 30000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product and the investment in energy-saving technologies for each product line to optimize its profit while considering the costs of raw materials, labor, and energy. The selling price, raw material cost, labor cost, and energy cost per unit for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Labor Cost | Energy Cost per Unit |\n|---------|---------------|-------------------|------------|----------------------|\n| A       | 100$          | 30$               | 20$        | 10 - 0.001 * EnergyInvestA |\n| B       | 150$          | 40$               | 30$        | 15 - 0.001 * EnergyInvestB |\n| C       | 200$          | 50$               | 40$        | 20 - 0.001 * EnergyInvestC |\n| D       | 250$          | 60$               | 50$        | 25 - 0.001 * EnergyInvestD |\n\nThe company has a budget of $100,000 for energy-saving technology investments. The total raw material cost must not exceed $50,000. The total labor cost must not exceed $30,000. \n\nPlease help the company to maximize its total profit by determining the optimal production quantity for each product and the appropriate investment in energy-saving technologies for each product line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # production quantity of product D\nEnergyInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestA\", lb=0) # investment in energy-saving technology for product A\nEnergyInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestB\", lb=0) # investment in energy-saving technology for product B\nEnergyInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestC\", lb=0) # investment in energy-saving technology for product C\nEnergyInvestD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestD\", lb=0) # investment in energy-saving technology for product D\n\n# Define objective function\nProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\nProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\nProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\nProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for energy-saving technology investments.\nmodel.addCons(EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000)\n# The total raw material cost must not exceed $50,000.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D <= 50000)\n# The total labor cost must not exceed $30,000.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Production Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Energy-Saving Technology for Product A: \", model.getVal(EnergyInvestA))\n    print(\"Investment in Energy-Saving Technology for Product B: \", model.getVal(EnergyInvestB))\n    print(\"Investment in Energy-Saving Technology for Product C: \", model.getVal(EnergyInvestC))\n    print(\"Investment in Energy-Saving Technology for Product D: \", model.getVal(EnergyInvestD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1339,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n// Total net profit for RegionA: Profit_A = (100,000 - 50,000) * TrucksA\n// Total net profit for RegionB: Profit_B = (120,000 - 60,000) * TrucksB\n// Total net profit for RegionC: Profit_C = (140,000 - 70,000) * TrucksC\n// Total net profit for RegionD: Profit_D = (160,000 - 80,000) * TrucksD\n// Total net profit for RegionE: Profit_E = (180,000 - 90,000) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regional regulations, RegionA must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $2,000,000 for operating costs for the quarter.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,000,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each region has at least one truck allocated.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs. The cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck. The company has a total of 40 trucks available for allocation. Due to regional regulations, RegionA must have at least 10% of the total trucks. The company has a budget of $2,000,000 for operating costs for the quarter. The company wants to ensure that each region has at least one truck allocated. Please help the company to maximize the net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100000 - 50000) * TrucksA\nProfit_B = (120000 - 60000) * TrucksB\nProfit_C = (140000 - 70000) * TrucksC\nProfit_D = (160000 - 80000) * TrucksD\nProfit_E = (180000 - 90000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regional regulations, RegionA must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * TotalTrucks)\n## The company has a budget of $2,000,000 for operating costs for the quarter.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints such as production capacity, market demand, and raw material availability.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $60. The company aims to maximize the total profit from all products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 90 * ProductC + 60 * ProductD\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// ProductA + ProductB + ProductC + ProductD <= 1000\n\n## Generate Constraint-2:\nThe market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week.\n// ProductA >= 200\n// ProductB >= 150",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints such as production capacity, market demand, and raw material availability. The profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $60. The company aims to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per week. The market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week. Please help the company determine the optimal production quantities for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of ProductC\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of ProductD\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 90 * ProductC + 60 * ProductD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD <= 1000)\n# The market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week.\nmodel.addCons(ProductA >= 200)\nmodel.addCons(ProductB >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Number of ProductD: \", model.getVal(ProductD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each truck to reduce fuel costs and increase the number of trips possible per day.\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost for Truck 1: Cost1 = (100 - 0.05 * Upgrade1) * Trips1\n// Fuel cost for Truck 2: Cost2 = (120 - 0.06 * Upgrade2) * Trips2\n// Fuel cost for Truck 3: Cost3 = (150 - 0.075 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and upgrades.\n// (100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nEach truck can make at most 50 trips per day.\n// Trips1 <= 50; Trips2 <= 50; Trips3 <= 50",
        "question": "A logistics company operates a fleet of three trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make and the investment in fuel-efficient upgrades for each truck to optimize its operations. The fuel cost per trip and the effect of upgrades on fuel cost for each truck are given in the following Table.\n\n| Truck | Fuel Cost per Trip | Reduction in Fuel Cost per $100 Invested |\n|-------|--------------------|-----------------------------------------|\n| 1     | $100               | $5                                      |\n| 2     | $120               | $6                                      |\n| 3     | $150               | $7.5                                    |\n\nThe company has a budget of $10,000 for fuel and upgrades. Each truck can make at most 50 trips per day. The company aims to minimize the total fuel cost of all trips.\nPlease help the company to determine the optimal number of trips for each truck and the investment in fuel-efficient upgrades to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0, ub=50)  # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0, ub=50)  # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0, ub=50)  # number of trips for Truck 3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck 3\n\n# Define objective function\nCost1 = (100 - 0.05 * Upgrade1) * Trips1\nCost2 = (120 - 0.06 * Upgrade2) * Trips2\nCost3 = (150 - 0.075 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel and upgrades.\nmodel.addCons((100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# Each truck can make at most 50 trips per day.\nmodel.addCons(Trips1 <= 50)\nmodel.addCons(Trips2 <= 50)\nmodel.addCons(Trips3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrade for Truck 1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrade for Truck 2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrade for Truck 3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times across multiple routes. The company needs to determine the optimal speed for each truck on each route to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck on each route and the number of trucks assigned to each route.\n// {\"speed of truck 1 on route 1\": \"Speed11\", \"range\": \"0 <= Speed11 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 2 on route 1\": \"Speed21\", \"range\": \"0 <= Speed21 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 1 on route 2\": \"Speed12\", \"range\": \"0 <= Speed12 <= 60\", \"type\": \"continuous\"}\n// {\"speed of truck 2 on route 2\": \"Speed22\", \"range\": \"0 <= Speed22 <= 60\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed. The faster the truck, the more fuel it consumes, but the relationship is not linear. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Fuel consumption for truck 1 on route 1: Fuel11 = 0.05 * Speed11^2\n// Fuel consumption for truck 2 on route 1: Fuel21 = 0.05 * Speed21^2\n// Fuel consumption for truck 1 on route 2: Fuel12 = 0.05 * Speed12^2\n// Fuel consumption for truck 2 on route 2: Fuel22 = 0.05 * Speed22^2\n// Total fuel consumption: TotalFuel = Fuel11 + Fuel21 + Fuel12 + Fuel22\n// So, the objective function is: Minimize TotalFuel\n\n## Generate Constraint-1:\nThe total time taken for all trucks to complete their routes must not exceed a specified maximum time. The time taken for a truck to complete a route is inversely proportional to its speed.\n// Time for truck 1 on route 1: Time11 = 100 / Speed11\n// Time for truck 2 on route 1: Time21 = 100 / Speed21\n// Time for truck 1 on route 2: Time12 = 150 / Speed12\n// Time for truck 2 on route 2: Time22 = 150 / Speed22\n// Total time: TotalTime = Time11 * Trucks1 + Time21 * Trucks1 + Time12 * Trucks2 + Time22 * Trucks2\n// TotalTime <= 1200 (maximum allowed time)\n\n## Generate Constraint-2:\nThe company has a limited number of trucks available, with a maximum of 4 trucks in total.\n// Trucks1 + Trucks2 <= 4\n\n## Generate Constraint-3:\nEach route must be covered by at least one truck.\n// Trucks1 >= 1; Trucks2 >= 1",
        "question": "A logistics company operates a fleet of trucks and aims to optimize fuel consumption and delivery times across multiple routes. The company needs to determine the optimal speed for each truck on each route to minimize fuel consumption while ensuring timely deliveries. The variables include the speed of each truck on each route and the number of trucks assigned to each route. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where the faster the truck, the more fuel it consumes, but the relationship is not linear. The company aims to minimize the total fuel consumption across all trucks and routes. The total time taken for all trucks to complete their routes must not exceed a specified maximum time of 1200 hours, and the time taken for a truck to complete a route is inversely proportional to its speed. The company has a limited number of trucks available, with a maximum of 4 trucks in total. Each route must be covered by at least one truck. Please help the company to determine the optimal speeds and number of trucks for each route to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed11 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed11\", lb=0, ub=60) # speed of truck 1 on route 1\nSpeed21 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed21\", lb=0, ub=60) # speed of truck 2 on route 1\nSpeed12 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed12\", lb=0, ub=60) # speed of truck 1 on route 2\nSpeed22 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed22\", lb=0, ub=60) # speed of truck 2 on route 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=1) # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=1) # number of trucks on route 2\n\n# Define objective function\nFuel11 = 0.05 * Speed11**2\nFuel21 = 0.05 * Speed21**2\nFuel12 = 0.05 * Speed12**2\nFuel22 = 0.05 * Speed22**2\nTotalFuel = Fuel11 + Fuel21 + Fuel12 + Fuel22\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuel)\n\n# Add constraints\nTime11 = 100 / Speed11\nTime21 = 100 / Speed21\nTime12 = 150 / Speed12\nTime22 = 150 / Speed22\nTotalTime = Time11 * Trucks1 + Time21 * Trucks1 + Time12 * Trucks2 + Time22 * Trucks2\nmodel.addCons(TotalTime <= 1200)\nmodel.addCons(Trucks1 + Trucks2 <= 4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of truck 1 on route 1: \", model.getVal(Speed11))\n    print(\"Speed of truck 2 on route 1: \", model.getVal(Speed21))\n    print(\"Speed of truck 1 on route 2: \", model.getVal(Speed12))\n    print(\"Speed of truck 2 on route 2: \", model.getVal(Speed22))\n    print(\"Number of trucks on route 1: \", model.getVal(Trucks1))\n    print(\"Number of trucks on route 2: \", model.getVal(Trucks2))\n    print(\"Minimized Total Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. \nOn Route A, the cost per truck is $500 per day.\nOn Route B, the cost per truck is $600 per day.\nOn Route C, the cost per truck is $700 per day.\nOn Route D, the cost per truck is $800 per day.\nOn Route E, the cost per truck is $900 per day.\nThe company wants to minimize the total daily operational cost while ensuring all routes are covered.\n// Total daily operational cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30\n\n## Generate Constraint-2:\nEach route must have at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\nThe cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. \nOn Route A, the cost per truck is $500 per day.\nOn Route B, the cost per truck is $600 per day.\nOn Route C, the cost per truck is $700 per day.\nOn Route D, the cost per truck is $800 per day.\nOn Route E, the cost per truck is $900 per day.\nThe company has a total of 30 trucks available. Each route must have at least one truck assigned.\nPlease help the company to minimize the total daily operational cost while ensuring all routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of trucks on Route E\n\n# Define objective function\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production while considering the varying efficiency of each plant based on weather conditions and maintenance schedules. Additionally, the company needs to decide on the investment in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"investment in upgrading Solar plant efficiency\": \"InvestmentSolar\", \"range\": \"InvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in upgrading Wind plant efficiency\": \"InvestmentWind\", \"range\": \"InvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in upgrading Hydro plant efficiency\": \"InvestmentHydro\", \"range\": \"InvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant is affected by the investment in upgrading its efficiency. The Solar plant initially produces 100 kWh per hour, but with upgrades, it increases by 5 kWh per hour for every $1000 invested. The Wind plant initially produces 120 kWh per hour, increasing by 6 kWh per hour for every $1000 invested. The Hydro plant initially produces 150 kWh per hour, increasing by 7.5 kWh per hour for every $1000 invested. The company aims to maximize the total daily energy production.\n// Total energy from Solar: EnergySolar = (100 + 0.005 * InvestmentSolar) * HoursSolar\n// Total energy from Wind: EnergyWind = (120 + 0.006 * InvestmentWind) * HoursWind\n// Total energy from Hydro: EnergyHydro = (150 + 0.0075 * InvestmentHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational hours and efficiency upgrades.\n// 1000 * (InvestmentSolar + InvestmentWind + InvestmentHydro) + 24 * (HoursSolar + HoursWind + HoursHydro) <= 100000\n\n## Generate Constraint-2:\nDue to maintenance schedules, the total operational hours for all plants cannot exceed 24 hours per day.\n// HoursSolar + HoursWind + HoursHydro <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in upgrading the efficiency of each plant to maximize energy production. The Solar plant initially produces 100 kWh per hour, but with upgrades, it increases by 5 kWh per hour for every $1000 invested. The Wind plant initially produces 120 kWh per hour, increasing by 6 kWh per hour for every $1000 invested. The Hydro plant initially produces 150 kWh per hour, increasing by 7.5 kWh per hour for every $1000 invested. The company has a total budget of $100,000 for operational hours and efficiency upgrades. Due to maintenance schedules, the total operational hours for all plants cannot exceed 24 hours per day. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentSolar\", lb=0)  # investment in upgrading Solar plant efficiency\nInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentWind\", lb=0)  # investment in upgrading Wind plant efficiency\nInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentHydro\", lb=0)  # investment in upgrading Hydro plant efficiency\n\n# Define objective function\nEnergySolar = (100 + 0.005 * InvestmentSolar) * HoursSolar\nEnergyWind = (120 + 0.006 * InvestmentWind) * HoursWind\nEnergyHydro = (150 + 0.0075 * InvestmentHydro) * HoursHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(1000 * (InvestmentSolar + InvestmentWind + InvestmentHydro) + 24 * (HoursSolar + HoursWind + HoursHydro) <= 100000)\nmodel.addCons(HoursSolar + HoursWind + HoursHydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(HoursSolar))\n    print(\"Number of hours Wind plant operates: \", model.getVal(HoursWind))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HoursHydro))\n    print(\"Investment in upgrading Solar plant efficiency: \", model.getVal(InvestmentSolar))\n    print(\"Investment in upgrading Wind plant efficiency: \", model.getVal(InvestmentWind))\n    print(\"Investment in upgrading Hydro plant efficiency: \", model.getVal(InvestmentHydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production efficiency of each product improves by a certain percentage for every unit of capital invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all product lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in efficiency upgrades cannot exceed $50,000.\n// InvestmentA + InvestmentB + InvestmentC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n// WorkersA >= 30; WorkersB >= 40",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide on the production quantities of each product, the number of workers assigned to each product line, and the amount of capital invested in upgrading the production efficiency for each product. The production cost per unit decreases by 0.1% for every $1,000 invested in efficiency upgrades for each product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total of 100 workers available for all product lines. The total capital investment in efficiency upgrades cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0) # capital investment for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0) # capital investment for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0) # capital investment for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.0001 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0001 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0001 * InvestmentC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 50000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\nmodel.addCons(WorkersA >= 30)\nmodel.addCons(WorkersB >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for smartphones is $1000, for tablets is $1500, and for laptops is $2000. However, the profit rates are subject to diminishing returns; for each additional hour, the profit decreases by 1% compared to the previous hour.\n// The profit function for smartphones: P_S = 1000 * S * (1 - 0.01 * (S - 1))\n// The profit function for tablets: P_T = 1500 * T * (1 - 0.01 * (T - 1))\n// The profit function for laptops: P_L = 2000 * L * (1 - 0.01 * (L - 1))\n// The objective function is: Maximize P_total = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThe total daily operating hours for all production lines must not exceed 24 hours.\n// S + T + L <= 24",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for smartphones is $1000, for tablets is $1500, and for laptops is $2000. However, the profit rates are subject to diminishing returns; for each additional hour, the profit decreases by 1% compared to the previous hour. The total daily operating hours for all production lines must not exceed 24 hours. Please help the company to maximize its daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n# The profit function for smartphones: P_S = 1000 * S * (1 - 0.01 * (S - 1))\n# The profit function for tablets: P_T = 1500 * T * (1 - 0.01 * (T - 1))\n# The profit function for laptops: P_L = 2000 * L * (1 - 0.01 * (L - 1))\n# The objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = 1000 * S * (1 - 0.01 * (S - 1))\nP_T = 1500 * T * (1 - 0.01 * (T - 1))\nP_L = 2000 * L * (1 - 0.01 * (L - 1))\nP_total = P_S + P_T + P_L\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\n# The total daily operating hours for all production lines must not exceed 24 hours.\nmodel.addCons(S + T + L <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 611,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows five types of crops: A, B, C, D, and E. The farmer needs to decide how much land to allocate to each crop to maximize the overall yield per unit of land.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per unit of land for each crop is as follows: Crop A yields 5 tons/hectare, Crop B yields 7 tons/hectare, Crop C yields 9 tons/hectare, Crop D yields 11 tons/hectare, and Crop E yields 13 tons/hectare. The farmer aims to maximize the total yield per unit of land used (which is defined as the sum of the yields of all crops divided by the total land used).\n// Yield of A: Yield_A = 5 * A\n// Yield of B: Yield_B = 7 * B\n// Yield of C: Yield_C = 9 * C\n// Yield of D: Yield_D = 11 * D\n// Yield of E: Yield_E = 13 * E\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C + Yield_D + Yield_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares of land available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 5 hectares to each crop.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A farmer grows five types of crops: A, B, C, D, and E. The farmer needs to decide how much land to allocate to each crop to maximize the overall yield per unit of land. The yield per unit of land for each crop is given in the following Table.\n\n| Crop | Yield per Hectare |\n|------|-------------------|\n| A    | 5 tons            |\n| B    | 7 tons            |\n| C    | 9 tons            |\n| D    | 11 tons           |\n| E    | 13 tons           |\n\nThe farmer has a total of 100 hectares of land available. The farmer must allocate at least 5 hectares to each crop. The farmer wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C. The farmer also wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\nPlease help the farmer to maximize the total yield per unit of land used (which is defined as the sum of the yields of all crops divided by the total land used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=5) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=5) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=5) # land allocated to crop C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=5) # land allocated to crop D\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=5) # land allocated to crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nYield_D = 11 * D\nYield_E = 13 * E\nTotalLand = A + B + C + D + E\n## the objective function is: Maximize (Yield_A + Yield_B + Yield_C + Yield_D + Yield_E) / TotalLand\n## convert the division to multiplication\nmodel.addCons(obj * TotalLand == Yield_A + Yield_B + Yield_C + Yield_D + Yield_E)\n\n# Add constraints\n## The farmer has a total of 100 hectares of land available.\nmodel.addCons(A + B + C + D + E <= 100)\n## The farmer wants to ensure that the total land allocated to Crop D does not exceed the combined land allocated to Crops A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The farmer wants to ensure that the total land allocated to Crop E does not exceed the combined land allocated to Crops A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Land allocated to Crop D: \", model.getVal(D))\n    print(\"Land allocated to Crop E: \", model.getVal(E))\n    print(\"Maximized Yield per Unit of Land: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in research and development (R&D) for each type of plant to improve efficiency. The efficiency improvement is nonlinear and depends on the R&D investment.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for Solar\": \"RDSolar\", \"range\": \"RDSolar >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Wind\": \"RDWind\", \"range\": \"RDWind >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Hydro\": \"RDHydro\", \"range\": \"RDHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each plant increases with R&D investment. For Solar, every $1000 invested increases efficiency by 1% up to a maximum of 20%. For Wind, every $1000 invested increases efficiency by 1.5% up to a maximum of 25%. For Hydro, every $1000 invested increases efficiency by 0.8% up to a maximum of 15%. The company aims to maximize the total energy production.\n// EnergySolar = (1 + 0.001 * RDSolar) * HoursSolar\n// EnergyWind = (1 + 0.0015 * RDWind) * HoursWind\n// EnergyHydro = (1 + 0.0008 * RDHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for R&D investments.\n// RDSolar + RDWind + RDHydro <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants must not exceed 24 hours per day.\n// HoursSolar + HoursWind + HoursHydro <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in research and development (R&D) for each type of plant to maximize energy production. The efficiency of each plant increases with R&D investment: for Solar, every $1000 invested increases efficiency by 1% up to a maximum of 20%; for Wind, every $1000 invested increases efficiency by 1.5% up to a maximum of 25%; for Hydro, every $1000 invested increases efficiency by 0.8% up to a maximum of 15%. The company has a total budget of $100,000 for R&D investments and the total operating hours for all plants must not exceed 24 hours per day. Please help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nRDSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"RDSolar\", lb=0)  # R&D investment for Solar\nRDWind = model.addVar(vtype=\"CONTINUOUS\", name=\"RDWind\", lb=0)  # R&D investment for Wind\nRDHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"RDHydro\", lb=0)  # R&D investment for Hydro\n\n# Define objective function\nEnergySolar = (1 + 0.001 * RDSolar) * HoursSolar\nEnergyWind = (1 + 0.0015 * RDWind) * HoursWind\nEnergyHydro = (1 + 0.0008 * RDHydro) * HoursHydro\n# So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for R&D investments.\nmodel.addCons(RDSolar + RDWind + RDHydro <= 100000)\n# The total operating hours for all plants must not exceed 24 hours per day.\nmodel.addCons(HoursSolar + HoursWind + HoursHydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Solar Plant: \", model.getVal(HoursSolar))\n    print(\"Hours of Wind Plant: \", model.getVal(HoursWind))\n    print(\"Hours of Hydro Plant: \", model.getVal(HoursHydro))\n    print(\"R&D Investment for Solar: \", model.getVal(RDSolar))\n    print(\"R&D Investment for Wind: \", model.getVal(RDWind))\n    print(\"R&D Investment for Hydro: \", model.getVal(RDHydro))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily to maximize energy production while minimizing operational costs. Additionally, the company needs to decide on the level of investment in technology upgrades for each plant, which affects the efficiency and cost of energy production.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Solar\": \"TechUpgradeSolar\", \"range\": \"TechUpgradeSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Wind\": \"TechUpgradeWind\", \"range\": \"TechUpgradeWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Hydro\": \"TechUpgradeHydro\", \"range\": \"TechUpgradeHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each plant increases with technology upgrades. For every $1000 invested in Solar, the efficiency increases by 1 kWh per hour. For Wind, every $1000 investment increases efficiency by 1.5 kWh per hour. For Hydro, every $1000 investment increases efficiency by 1.2 kWh per hour. The operational cost per hour for Solar is $50, for Wind is $60, and for Hydro is $70. The company aims to maximize the net energy output (energy produced minus operational costs).\n// EnergyOutputSolar = (10 + 0.001 * TechUpgradeSolar) * HoursSolar - 50 * HoursSolar\n// EnergyOutputWind = (15 + 0.0015 * TechUpgradeWind) * HoursWind - 60 * HoursWind\n// EnergyOutputHydro = (12 + 0.0012 * TechUpgradeHydro) * HoursHydro - 70 * HoursHydro\n// So, the objective function is: Maximize (EnergyOutputSolar + EnergyOutputWind + EnergyOutputHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and technology upgrades.\n// 50 * HoursSolar + 60 * HoursWind + 70 * HoursHydro + TechUpgradeSolar + TechUpgradeWind + TechUpgradeHydro <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the optimal number of hours each plant should operate daily and the level of investment in technology upgrades for each plant to maximize energy production while minimizing operational costs. The efficiency of each plant increases with technology upgrades. For every $1000 invested in Solar, the efficiency increases by 1 kWh per hour. For Wind, every $1000 investment increases efficiency by 1.5 kWh per hour. For Hydro, every $1000 investment increases efficiency by 1.2 kWh per hour. The operational cost per hour for Solar is $50, for Wind is $60, and for Hydro is $70. The company aims to maximize the net energy output (energy produced minus operational costs).\n\n| Plant Type | Operational Cost per Hour | Efficiency Increase per $1000 Investment |\n|------------|---------------------------|------------------------------------------|\n| Solar      | $50                       | 1 kWh per hour                           |\n| Wind       | $60                       | 1.5 kWh per hour                         |\n| Hydro      | $70                       | 1.2 kWh per hour                         |\n\nThe company has a total budget of $100,000 for operational costs and technology upgrades. Please help the company determine the optimal number of hours each plant should operate daily and the level of investment in technology upgrades to maximize the net energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nTechUpgradeSolar = model.addVar(name=\"TechUpgradeSolar\", lb=0)  # investment in technology upgrades for Solar\nTechUpgradeWind = model.addVar(name=\"TechUpgradeWind\", lb=0)  # investment in technology upgrades for Wind\nTechUpgradeHydro = model.addVar(name=\"TechUpgradeHydro\", lb=0)  # investment in technology upgrades for Hydro\n\n# Define objective function\nEnergyOutputSolar = (10 + 0.001 * TechUpgradeSolar) * HoursSolar - 50 * HoursSolar\nEnergyOutputWind = (15 + 0.0015 * TechUpgradeWind) * HoursWind - 60 * HoursWind\nEnergyOutputHydro = (12 + 0.0012 * TechUpgradeHydro) * HoursHydro - 70 * HoursHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar + EnergyOutputWind + EnergyOutputHydro)\n\n# Add constraints\nmodel.addCons(50 * HoursSolar + 60 * HoursWind + 70 * HoursHydro + TechUpgradeSolar + TechUpgradeWind + TechUpgradeHydro <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hours Solar Plant Operates: \", model.getVal(HoursSolar))\n    print(\"Number of Hours Wind Plant Operates: \", model.getVal(HoursWind))\n    print(\"Number of Hours Hydro Plant Operates: \", model.getVal(HoursHydro))\n    print(\"Investment in Technology Upgrades for Solar: \", model.getVal(TechUpgradeSolar))\n    print(\"Investment in Technology Upgrades for Wind: \", model.getVal(TechUpgradeWind))\n    print(\"Investment in Technology Upgrades for Hydro: \", model.getVal(TechUpgradeHydro))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1489,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses.\n// {\"number of warehouses at Location A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each location to the distribution centers is as follows:\n- From Location A: $5 per unit\n- From Location B: $7 per unit\n- From Location C: $6 per unit\n- From Location D: $8 per unit\n- From Location E: $9 per unit\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location.\n// Total transportation cost: Cost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 to build warehouses.\n// Construction cost per warehouse at A: $1000, at B: $1500, at C: $1200, at D: $1800, at E: $2000\n// 1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000\n\n## Generate Constraint-2:\nThe total number of warehouses should not exceed 30.\n// A + B + C + D + E <= 30\n\n## Generate Constraint-3:\nAt least one warehouse must be built at Location A.\n// A >= 1",
        "question": "A logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses. The transportation cost from each location to the distribution centers is as follows:\n- From Location A: $5 per unit\n- From Location B: $7 per unit\n- From Location C: $6 per unit\n- From Location D: $8 per unit\n- From Location E: $9 per unit\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location. The company has a budget of $50,000 to build warehouses. The total number of warehouses should not exceed 30. At least one warehouse must be built at Location A.\nPlease help the company determine the optimal number of warehouses to build at each location to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1)  # number of warehouses at Location A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)  # number of warehouses at Location B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)  # number of warehouses at Location C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0)  # number of warehouses at Location D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)  # number of warehouses at Location E\n\n# Define objective function\nCost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The company has a budget of $50,000 to build warehouses.\nmodel.addCons(1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000)\n# The total number of warehouses should not exceed 30.\nmodel.addCons(A + B + C + D + E <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Warehouses at Location A: \", model.getVal(A))\n    print(\"Number of Warehouses at Location B: \", model.getVal(B))\n    print(\"Number of Warehouses at Location C: \", model.getVal(C))\n    print(\"Number of Warehouses at Location D: \", model.getVal(D))\n    print(\"Number of Warehouses at Location E: \", model.getVal(E))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a specific amount of raw materials and labor hours. The company needs to determine the optimal production quantities for each product to maximize profit while considering the constraints on raw materials and labor hours.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, due to market saturation, the profit per unit decreases by $0.10 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sales of these products.\n// Profit_A = max(50 - 0.10 * (ProductA - 100), 50) * ProductA\n// Profit_B = max(70 - 0.10 * (ProductB - 100), 70) * ProductB\n// Profit_C = max(90 - 0.10 * (ProductC - 100), 90) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Each unit of product A requires 2 kg of raw materials, product B requires 3 kg, and product C requires 4 kg. The total available raw materials are 1000 kg.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited number of labor hours available. Each unit of product A requires 5 hours of labor, product B requires 6 hours, and product C requires 8 hours. The total available labor hours are 1500 hours.\n// 5 * ProductA + 6 * ProductB + 8 * ProductC <= 1500\n\n## Generate Constraint-3:\nThe market has a demand limit for each product. The demand limit for product A is 200 units, for product B is 300 units, and for product C is 250 units.\n// ProductA <= 200; ProductB <= 300; ProductC <= 250",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a specific amount of raw materials and labor hours. The company needs to determine the optimal production quantities for each product to maximize profit while considering the constraints on raw materials and labor hours. The profit per unit of product A is $50, product B is $70, and product C is $90. However, due to market saturation, the profit per unit decreases by $0.10 for each additional unit produced beyond 100 units for each product. The following table summarizes the requirements and constraints:\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit | Demand Limit |\n|---------|-----------------|-----------------------|----------------------|--------------|\n| A       | $50             | 2 kg                  | 5 hours              | 200 units    |\n| B       | $70             | 3 kg                  | 6 hours              | 300 units    |\n| C       | $90             | 4 kg                  | 8 hours              | 250 units    |\n\nThe company has a limited supply of raw materials totaling 1000 kg. The company also has a limited number of labor hours available, totaling 1500 hours. Please help the company to maximize the total profit from the sales of these products, considering the constraints on raw materials, labor hours, and market demand limits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=300) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=250) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(50 - 0.10 * (ProductA - 100), 50) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 50 * A1 * A_b1 + (50 - 0.10 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(70 - 0.10 * (ProductB - 100), 70) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 70 * B1 * B_b1 + (70 - 0.10 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(90 - 0.10 * (ProductC - 100), 90) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=250)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 90 * C1 * C_b1 + (90 - 0.10 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\nmodel.addCons(5 * ProductA + 6 * ProductB + 8 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1389,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. \nAt warehouse 1, the cost per truck is $500 per day.\nAt warehouse 2, the cost per truck is $600 per day.\nAt warehouse 3, the cost per truck is $700 per day.\nAt warehouse 4, the cost per truck is $800 per day.\nAt warehouse 5, the cost per truck is $900 per day.\nThe company aims to minimize the total daily operational cost of all trucks.\n// Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs, as shown in the following Table.\n\n| Warehouse | Cost per Truck per Day |\n|-----------|------------------------|\n| 1         | $500                   |\n| 2         | $600                   |\n| 3         | $700                   |\n| 4         | $800                   |\n| 5         | $900                   |\n\nThe total number of trucks available across all warehouses is 100. Each warehouse can handle a maximum of 30 trucks. Please help the company to minimize the total daily operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nmodel.addCons(obj == 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each warehouse can handle a maximum of 30 trucks.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\n// RevenueA = 100 * ProductA\n// RevenueB = 150 * ProductB\n// RevenueC = 200 * ProductC\n// LaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\n// LaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\n// LaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\n// RawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n// So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe raw material supply is limited to 500 units.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production. The revenue per unit, labor cost per hour, and raw material cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Labor Cost per Hour | Raw Material Cost per Unit |\n|---------|------------------|---------------------|----------------------------|\n| ProductA | $100            | $20                 | $30                        |\n| ProductB | $150            | $20                 | $30                        |\n| ProductC | $200            | $20                 | $30                        |\n\nThe company has a total of 1000 labor hours available. The total investment in automation cannot exceed $50,000. The raw material supply is limited to 500 units. \n\nPlease help the company to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nRevenueA = 100 * ProductA\nRevenueB = 150 * ProductB\nRevenueC = 200 * ProductC\nLaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\nLaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\nLaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\nRawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n# So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n# Add constraints\n# The company has a total of 1000 labor hours available.\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The raw material supply is limited to 500 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Labor hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n// Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\n// Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\n// Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per day.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-2:\nThe cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $2000 per day for raw materials.\n// 5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000\n\n## Generate Constraint-3:\nThe market demand for product A is at most 200 units per day, for product B is at most 300 units per day, and for product C is at most 150 units per day.\n// ProductA <= 200; ProductB <= 300; ProductC <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n\n| Product | Profit per Unit | Raw Material Cost | Market Demand Limit |\n|---------|-----------------|-------------------|---------------------|\n| A       | $20             | $5                | 200 units           |\n| B       | $30             | $10               | 300 units           |\n| C       | $40             | $15               | 150 units           |\n\nThe company has a total production capacity of 500 units per day. The cost of raw materials for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company has a budget of $2000 per day for raw materials. The market demand for product A is at most 200 units per day, for product B is at most 300 units per day, and for product C is at most 150 units per day.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=300) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=150) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 20 * A1 * A_b1 + (20 + 0.05 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 30 * B1 * B_b1 + (30 + 0.05 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=150)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 40 * C1 * C_b1 + (40 + 0.05 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1463,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of delivery vehicles. The company has five types of vehicles: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Small vehicle has a fuel efficiency of 20 km/l, a maintenance cost of $500 per month, and a capacity of 500 kg.\nThe Medium vehicle has a fuel efficiency of 15 km/l, a maintenance cost of $700 per month, and a capacity of 1000 kg.\nThe Large vehicle has a fuel efficiency of 10 km/l, a maintenance cost of $1000 per month, and a capacity of 1500 kg.\nThe Electric vehicle has a fuel efficiency equivalent to 30 km/l, a maintenance cost of $800 per month, and a capacity of 750 kg.\nThe Hybrid vehicle has a fuel efficiency of 25 km/l, a maintenance cost of $600 per month, and a capacity of 1250 kg.\nThe company aims to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities.\n// Monthly maintenance costs: Costs = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\n// Sum of vehicle capacities: Capacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n// So, the objective function is: Minimize Costs / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle maintenance.\n// 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid <= 15000\n\n## Generate Constraint-2:\nThe company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\n// 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid >= 10000\n\n## Generate Constraint-3:\nThe company wants to have at least 5 vehicles of each type.\n// Small >= 5; Medium >= 5; Large >= 5; Electric >= 5; Hybrid >= 5\n\n## Generate Constraint-4:\nThe company aims to have no more than 20% of its fleet as Electric vehicles due to charging infrastructure limitations.\n// Electric <= 0.2 * (Small + Medium + Large + Electric + Hybrid)",
        "question": "A logistics company needs to optimize its fleet of delivery vehicles, which includes five types: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity. The Small vehicle has a fuel efficiency of 20 km/l, a maintenance cost of $500 per month, and a capacity of 500 kg. The Medium vehicle has a fuel efficiency of 15 km/l, a maintenance cost of $700 per month, and a capacity of 1000 kg. The Large vehicle has a fuel efficiency of 10 km/l, a maintenance cost of $1000 per month, and a capacity of 1500 kg. The Electric vehicle has a fuel efficiency equivalent to 30 km/l, a maintenance cost of $800 per month, and a capacity of 750 kg. The Hybrid vehicle has a fuel efficiency of 25 km/l, a maintenance cost of $600 per month, and a capacity of 1250 kg.\n\nThe company aims to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities. The company has a budget of $15,000 per month for vehicle maintenance. It needs to ensure that the total capacity of the fleet is at least 10,000 kg. The company wants to have at least 5 vehicles of each type. Additionally, due to charging infrastructure limitations, the company aims to have no more than 20% of its fleet as Electric vehicles.\n\nPlease help the company determine the optimal number of each type of vehicle to minimize the Total Cost Efficiency (TCE).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=5)  # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=5)  # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=5)  # number of Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=5)  # number of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=5)  # number of Hybrid vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCosts = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\nCapacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n## the objective function is: Minimize Costs / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Costs)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle maintenance.\nmodel.addCons(500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid <= 15000)\n## The company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\nmodel.addCons(500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid >= 10000)\n## The company wants to have at least 5 vehicles of each type.\nmodel.addCons(Small >= 5)\nmodel.addCons(Medium >= 5)\nmodel.addCons(Large >= 5)\nmodel.addCons(Electric >= 5)\nmodel.addCons(Hybrid >= 5)\n## The company aims to have no more than 20% of its fleet as Electric vehicles due to charging infrastructure limitations.\nmodel.addCons(Electric <= 0.2 * (Small + Medium + Large + Electric + Hybrid))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Electric vehicles: \", model.getVal(Electric))\n    print(\"Number of Hybrid vehicles: \", model.getVal(Hybrid))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1460,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. Additionally, the company needs to decide on the fuel consumption rate for each route, which is influenced by the number of trucks and the route's specific conditions.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for route 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for route 5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel is a nonlinear function of the number of trucks and the fuel consumption rate. The company aims to minimize the total fuel cost across all routes. The fuel cost per route is given by the product of the number of trucks, the fuel consumption rate, and the average fuel price per liter.\n// Fuel cost for route 1: Cost1 = Trucks1 * Fuel1 * FuelPrice\n// Fuel cost for route 2: Cost2 = Trucks2 * Fuel2 * FuelPrice\n// Fuel cost for route 3: Cost3 = Trucks3 * Fuel3 * FuelPrice\n// Fuel cost for route 4: Cost4 = Trucks4 * Fuel4 * FuelPrice\n// Fuel cost for route 5: Cost5 = Trucks5 * Fuel5 * FuelPrice\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity of 30 trucks.\n// Trucks1 <= 30; Trucks2 <= 30; Trucks3 <= 30; Trucks4 <= 30; Trucks5 <= 30",
        "question": "A logistics company operates 5 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each route, which is influenced by the number of trucks and the route's specific conditions. The cost of fuel is a nonlinear function of the number of trucks and the fuel consumption rate. The company aims to minimize the total fuel cost across all routes, where the fuel cost per route is given by the product of the number of trucks, the fuel consumption rate, and the average fuel price per liter. The total number of trucks available is 100, and each route has a maximum capacity of 30 trucks. Please help the company to minimize the total fuel cost across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)\n\n# Define objective function\nFuelPrice = 1.5  # Assuming a constant fuel price per liter\nCost1 = Trucks1 * Fuel1 * FuelPrice\nCost2 = Trucks2 * Fuel2 * FuelPrice\nCost3 = Trucks3 * Fuel3 * FuelPrice\nCost4 = Trucks4 * Fuel4 * FuelPrice\nCost5 = Trucks5 * Fuel5 * FuelPrice\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\nmodel.addCons(Trucks1 <= 30)\nmodel.addCons(Trucks2 <= 30)\nmodel.addCons(Trucks3 <= 30)\nmodel.addCons(Trucks4 <= 30)\nmodel.addCons(Trucks5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(Trucks5))\n    print(\"Fuel Consumption Rate for Route 1: \", model.getVal(Fuel1))\n    print(\"Fuel Consumption Rate for Route 2: \", model.getVal(Fuel2))\n    print(\"Fuel Consumption Rate for Route 3: \", model.getVal(Fuel3))\n    print(\"Fuel Consumption Rate for Route 4: \", model.getVal(Fuel4))\n    print(\"Fuel Consumption Rate for Route 5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: Destination1, Destination2, Destination3, Destination4, and Destination5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies.\n// {\"number of trucks to Destination1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to Destination5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Destination1\": \"FuelEff1\", \"range\": \"FuelEff1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination2\": \"FuelEff2\", \"range\": \"FuelEff2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination3\": \"FuelEff3\", \"range\": \"FuelEff3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination4\": \"FuelEff4\", \"range\": \"FuelEff4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Destination5\": \"FuelEff5\", \"range\": \"FuelEff5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each route decreases with the investment in fuel-efficient technologies. The initial fuel consumption rate for each destination is 100 liters per truck, but with investment, the rate decreases by 1 liter per truck for every $100 invested in fuel efficiency. The company aims to minimize the total fuel consumption while considering the investments in fuel efficiency.\n// Fuel consumption for Destination1: Fuel1 = (100 - 0.01 * FuelEff1) * Trucks1\n// Fuel consumption for Destination2: Fuel2 = (100 - 0.01 * FuelEff2) * Trucks2\n// Fuel consumption for Destination3: Fuel3 = (100 - 0.01 * FuelEff3) * Trucks3\n// Fuel consumption for Destination4: Fuel4 = (100 - 0.01 * FuelEff4) * Trucks4\n// Fuel consumption for Destination5: Fuel5 = (100 - 0.01 * FuelEff5) * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel efficiency and operational costs.\n// FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 + 100 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks dispatched should not exceed 500.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 50 trucks must be dispatched to Destination1 and 100 trucks to Destination2.\n// Trucks1 >= 50; Trucks2 >= 100\n\n## Generate Constraint-4:\nThe fuel consumption for Destination3 should not exceed the combined fuel consumption of Destination1 and Destination2.\n// Fuel3 <= Fuel1 + Fuel2",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: Destination1, Destination2, Destination3, Destination4, and Destination5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies. The initial fuel consumption rate for each destination is 100 liters per truck, but with investment, the rate decreases by 1 liter per truck for every $100 invested in fuel efficiency. The company aims to minimize the total fuel consumption while considering the investments in fuel efficiency.\n\n| Destination | Initial Fuel Consumption Rate | Investment Impact |\n|-------------|-------------------------------|-------------------|\n| Destination1| 100 liters per truck          | -1 liter per $100 |\n| Destination2| 100 liters per truck          | -1 liter per $100 |\n| Destination3| 100 liters per truck          | -1 liter per $100 |\n| Destination4| 100 liters per truck          | -1 liter per $100 |\n| Destination5| 100 liters per truck          | -1 liter per $100 |\n\nThe company has a budget of $100,000 for investments in fuel efficiency and operational costs. The total number of trucks dispatched should not exceed 500. Due to contractual obligations, at least 50 trucks must be dispatched to Destination1 and 100 trucks to Destination2. The fuel consumption for Destination3 should not exceed the combined fuel consumption of Destination1 and Destination2.\n\nPlease help the company to minimize the total fuel consumption while considering the investments in fuel efficiency and the constraints mentioned above.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks to Destination1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks to Destination2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks to Destination3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks to Destination4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks to Destination5\nFuelEff1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff1\", lb=0)  # investment in fuel efficiency for Destination1\nFuelEff2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff2\", lb=0)  # investment in fuel efficiency for Destination2\nFuelEff3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff3\", lb=0)  # investment in fuel efficiency for Destination3\nFuelEff4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff4\", lb=0)  # investment in fuel efficiency for Destination4\nFuelEff5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff5\", lb=0)  # investment in fuel efficiency for Destination5\n\n# Define objective function\nFuel1 = (100 - 0.01 * FuelEff1) * Trucks1\nFuel2 = (100 - 0.01 * FuelEff2) * Trucks2\nFuel3 = (100 - 0.01 * FuelEff3) * Trucks3\nFuel4 = (100 - 0.01 * FuelEff4) * Trucks4\nFuel5 = (100 - 0.01 * FuelEff5) * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 + 100 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 500)\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 100)\nmodel.addCons(Fuel3 <= Fuel1 + Fuel2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to Destination1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks to Destination2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks to Destination3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks to Destination4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks to Destination5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Destination1: \", model.getVal(FuelEff1))\n    print(\"Investment in Fuel Efficiency for Destination2: \", model.getVal(FuelEff2))\n    print(\"Investment in Fuel Efficiency for Destination3: \", model.getVal(FuelEff3))\n    print(\"Investment in Fuel Efficiency for Destination4: \", model.getVal(FuelEff4))\n    print(\"Investment in Fuel Efficiency for Destination5: \", model.getVal(FuelEff5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1652,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed1\", \"range\": \"0 < Speed1 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed2\", \"range\": \"0 < Speed2 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed3\", \"range\": \"0 < Speed3 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region4\": \"Speed4\", \"range\": \"0 < Speed4 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region5\": \"Speed5\", \"range\": \"0 < Speed5 < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions.\n// Total fuel consumption in Region1: Fuel1 = 0.05 * Speed1^2 * Trucks1\n// Total fuel consumption in Region2: Fuel2 = 0.055 * Speed2^2 * Trucks2\n// Total fuel consumption in Region3: Fuel3 = 0.06 * Speed3^2 * Trucks3\n// Total fuel consumption in Region4: Fuel4 = 0.065 * Speed4^2 * Trucks4\n// Total fuel consumption in Region5: Fuel5 = 0.07 * Speed5^2 * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the speed of trucks in each region must not exceed 80 km/h.\n// Speed1 <= 80; Speed2 <= 80; Speed3 <= 80; Speed4 <= 80; Speed5 <= 80\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to each region.\n// Trucks1 >= 5; Trucks2 >= 5; Trucks3 >= 5; Trucks4 >= 5; Trucks5 >= 5\n\n## Generate Constraint-4:\nThe total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km.\n// Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the optimal number of trucks to allocate to each region and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs. The fuel consumption rate for each truck is modeled by a quadratic function of its speed, as shown in the following Table.\n\n| Region | Fuel Consumption Rate (gallons per hour) |\n|--------|-----------------------------------------|\n| Region1 | 0.05 * Speed1^2                        |\n| Region2 | 0.055 * Speed2^2                       |\n| Region3 | 0.06 * Speed3^2                        |\n| Region4 | 0.065 * Speed4^2                       |\n| Region5 | 0.07 * Speed5^2                        |\n\nThe company has a total of 50 trucks available for allocation. Due to regional regulations, the speed of trucks in each region must not exceed 80 km/h. The company must allocate at least 5 trucks to each region. Additionally, the total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km.\n\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=5)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=5)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks in Region5\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of trucks in Region1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of trucks in Region2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of trucks in Region3\nSpeed4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed4\", lb=0, ub=100)  # speed of trucks in Region4\nSpeed5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed5\", lb=0, ub=100)  # speed of trucks in Region5\n\n# Define objective function\nFuel1 = 0.05 * Speed1**2 * Trucks1\nFuel2 = 0.055 * Speed2**2 * Trucks2\nFuel3 = 0.06 * Speed3**2 * Trucks3\nFuel4 = 0.065 * Speed4**2 * Trucks4\nFuel5 = 0.07 * Speed5**2 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 80)\nmodel.addCons(Speed3 <= 80)\nmodel.addCons(Speed4 <= 80)\nmodel.addCons(Speed5 <= 80)\nmodel.addCons(Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed3))\n    print(\"Speed of Trucks in Region4: \", model.getVal(Speed4))\n    print(\"Speed of Trucks in Region5: \", model.getVal(Speed5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1235,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for route 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for route 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The cost decreases as the fuel allocation increases, but at a decreasing rate. The company aims to minimize the total fuel cost for all routes.\n// Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n// Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n// Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total fuel budget for the company is $10,000.\n// Fuel1 + Fuel2 + Fuel3 <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// Truck1 + Truck2 + Truck3 <= 50\n\n## Generate Constraint-3:\nEach route must be completed with at least 5 trucks.\n// Truck1 >= 5; Truck2 >= 5; Truck3 >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The cost decreases as the fuel allocation increases, but at a decreasing rate. The company aims to minimize the total fuel cost for all routes.\n\n| Route | Number of Trucks | Fuel Allocation |\n|-------|-----------------|-----------------|\n| 1     | Truck1          | Fuel1           |\n| 2     | Truck2          | Fuel2           |\n| 3     | Truck3          | Fuel3           |\n\nThe total fuel budget for the company is $10,000. The company has a maximum of 50 trucks available. Each route must be completed with at least 5 trucks.\n\nPlease help the company to minimize the total fuel cost for all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=5)  # number of trucks for route 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=5)  # number of trucks for route 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=5)  # number of trucks for route 3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for route 1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for route 2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for route 3\n\n# Define objective function\n# Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n# Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n# Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = model.addVar(name=\"Cost1\")\nCost2 = model.addVar(name=\"Cost2\")\nCost3 = model.addVar(name=\"Cost3\")\nmodel.addCons(Cost1 == (1000 / (1 + 1 / (1 + Fuel1 * 0.05))) * Truck1)\nmodel.addCons(Cost2 == (1200 / (1 + 1 / (1 + Fuel2 * 0.05))) * Truck2)\nmodel.addCons(Cost3 == (1100 / (1 + 1 / (1 + Fuel3 * 0.05))) * Truck3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 <= 10000)\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Truck3))\n    print(\"Fuel Allocation for Route 1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route 2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route 3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in research and development (R&D) to improve the efficiency of both technologies.\n// {\"number of solar panels in RegionA\": \"SolarPanelsA\", \"range\": \"SolarPanelsA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarPanelsB\", \"range\": \"SolarPanelsB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarPanelsC\", \"range\": \"SolarPanelsC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindTurbinesA\", \"range\": \"WindTurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindTurbinesB\", \"range\": \"WindTurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindTurbinesC\", \"range\": \"WindTurbinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The cost of electricity generated per unit decreases as efficiency increases. The company aims to minimize the total cost of electricity generation across all regions.\n// Total cost of electricity for solar panels in RegionA: Cost_SolarA = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsA\n// Total cost of electricity for solar panels in RegionB: Cost_SolarB = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsB\n// Total cost of electricity for solar panels in RegionC: Cost_SolarC = (1 / (0.15 + 0.005 * RnDInvestment)) * SolarPanelsC\n// Total cost of electricity for wind turbines in RegionA: Cost_WindA = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesA\n// Total cost of electricity for wind turbines in RegionB: Cost_WindB = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesB\n// Total cost of electricity for wind turbines in RegionC: Cost_WindC = (1 / (0.25 + 0.007 * RnDInvestment)) * WindTurbinesC\n// So, the objective function is: Minimize (Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for installation in each region.\n// SolarPanelsA + WindTurbinesA <= 1000\n// SolarPanelsB + WindTurbinesB <= 1000\n// SolarPanelsC + WindTurbinesC <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: RegionA, RegionB, and RegionC. The company also plans to invest in research and development (R&D) to improve the efficiency of both technologies. The initial efficiency of solar panels is 15%, and for wind turbines is 25%. The efficiency of solar panels increases by 0.5% for every $100,000 invested in R&D, and the efficiency of wind turbines increases by 0.7% for every $100,000 invested in R&D. The cost of electricity generated per unit decreases as efficiency increases. The company aims to minimize the total cost of electricity generation across all regions.\n\n| Component | Initial Efficiency | Efficiency Increase per $100,000 R&D |\n|-----------|---------------------|---------------------------------------|\n| Solar Panels | 15% | 0.5% |\n| Wind Turbines | 25% | 0.7% |\n\nThe company has a total budget of $1,000,000 for installation in each region. The number of solar panels and wind turbines to install in each region, as well as the investment in R&D, should be determined to meet this budget constraint.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to install in each region, and the investment in R&D to minimize the total cost of electricity generation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanelsA = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsA\", lb=0)\nSolarPanelsB = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsB\", lb=0)\nSolarPanelsC = model.addVar(vtype=\"INTEGER\", name=\"SolarPanelsC\", lb=0)\nWindTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesA\", lb=0)\nWindTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesB\", lb=0)\nWindTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"WindTurbinesC\", lb=0)\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate costs with efficiency improvements\nEfficiency_Solar = 0.15 + 0.005 * RnDInvestment\nEfficiency_Wind = 0.25 + 0.007 * RnDInvestment\n\nCost_SolarA = (1 / Efficiency_Solar) * SolarPanelsA\nCost_SolarB = (1 / Efficiency_Solar) * SolarPanelsB\nCost_SolarC = (1 / Efficiency_Solar) * SolarPanelsC\nCost_WindA = (1 / Efficiency_Wind) * WindTurbinesA\nCost_WindB = (1 / Efficiency_Wind) * WindTurbinesB\nCost_WindC = (1 / Efficiency_Wind) * WindTurbinesC\n\n## the objective function is: Minimize (Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\nmodel.addCons(obj == Cost_SolarA + Cost_SolarB + Cost_SolarC + Cost_WindA + Cost_WindB + Cost_WindC)\n\n# Add constraints\nmodel.addCons(SolarPanelsA + WindTurbinesA <= 1000)\nmodel.addCons(SolarPanelsB + WindTurbinesB <= 1000)\nmodel.addCons(SolarPanelsC + WindTurbinesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarPanelsA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarPanelsB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarPanelsC))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindTurbinesA))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindTurbinesB))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindTurbinesC))\n    print(\"Investment in R&D: \", model.getVal(RnDInvestment))\n    print(\"Minimized Total Cost of Electricity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1326,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\n// C + D >= 15\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5.\n// D <= E + 5",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density, as shown in the following Table.\n\n| Route | Efficiency Factor |\n|-------|-------------------|\n| A     | 0.8               |\n| B     | 0.9               |\n| C     | 1.1               |\n| D     | 1.2               |\n| E     | 1.3               |\n\nThe company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined. The company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C. Additionally, the company wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5.\n\nPlease help the company to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n# The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\nmodel.addCons(C + D >= 15)\n# The company wants to ensure that the number of trucks allocated to Route E does not exceed the combined number of trucks allocated to Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n# The company wants to ensure that the total number of trucks allocated to Route D does not exceed the number of trucks allocated to Route E by more than 5.\nmodel.addCons(D <= E + 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1305,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Cost per Truck is $500, the Maintenance Cost per Truck is $300, and the Revenue per Truck is $1000.\nFor RouteB, the Fuel Cost per Truck is $600, the Maintenance Cost per Truck is $350, and the Revenue per Truck is $1200.\nFor RouteC, the Fuel Cost per Truck is $700, the Maintenance Cost per Truck is $400, and the Revenue per Truck is $1400.\nFor RouteD, the Fuel Cost per Truck is $800, the Maintenance Cost per Truck is $450, and the Revenue per Truck is $1600.\nFor RouteE, the Fuel Cost per Truck is $900, the Maintenance Cost per Truck is $500, and the Revenue per Truck is $1800.\nThe company wants to minimize the average cost per truck while ensuring profitability.\n// Total cost for RouteA: Cost_RouteA = (500 + 300) * TrucksA\n// Total cost for RouteB: Cost_RouteB = (600 + 350) * TrucksB\n// Total cost for RouteC: Cost_RouteC = (700 + 400) * TrucksC\n// Total cost for RouteD: Cost_RouteD = (800 + 450) * TrucksD\n// Total cost for RouteE: Cost_RouteE = (900 + 500) * TrucksE\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\n// TrucksC >= 0.5 * TrucksA\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for maintenance costs for the month.\n// 300 * TrucksA + 350 * TrucksB + 400 * TrucksC + 450 * TrucksD + 500 * TrucksE <= 20,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs.\nFor RouteA, the Fuel Cost per Truck is $500, the Maintenance Cost per Truck is $300, and the Revenue per Truck is $1000.\nFor RouteB, the Fuel Cost per Truck is $600, the Maintenance Cost per Truck is $350, and the Revenue per Truck is $1200.\nFor RouteC, the Fuel Cost per Truck is $700, the Maintenance Cost per Truck is $400, and the Revenue per Truck is $1400.\nFor RouteD, the Fuel Cost per Truck is $800, the Maintenance Cost per Truck is $450, and the Revenue per Truck is $1600.\nFor RouteE, the Fuel Cost per Truck is $900, the Maintenance Cost per Truck is $500, and the Revenue per Truck is $1800.\nThe company has a total of 40 trucks available for allocation. Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA. The company has a budget of $20,000 for maintenance costs for the month.\nPlease help the company to minimize the average cost per truck while ensuring profitability.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_RouteA = (500 + 300) * TrucksA\nCost_RouteB = (600 + 350) * TrucksB\nCost_RouteC = (700 + 400) * TrucksC\nCost_RouteD = (800 + 450) * TrucksD\nCost_RouteE = (900 + 500) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\nmodel.addCons(TrucksC >= 0.5 * TrucksA)\n## The company has a budget of $20,000 for maintenance costs for the month.\nmodel.addCons(300 * TrucksA + 350 * TrucksB + 400 * TrucksC + 450 * TrucksD + 500 * TrucksE <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Average Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1165,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company aims to maximize the total profit from selling all products.\n// Profit_A = 50 * A\n// Profit_B = 70 * B - 0.5 * A * B (cost of A used in B)\n// Profit_C = 90 * C - 0.3 * A * C (cost of A used in C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company has a total production capacity of 1000 units per month. Please help the company to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B - 0.5 * A * B\nProfit_C = 90 * C - 0.3 * A * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\n// {\"number of trucks allocated to Region A\": \"Truck_A\", \"range\": \"Truck_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"Truck_B\", \"range\": \"Truck_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"Truck_C\", \"range\": \"Truck_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"Truck_D\", \"range\": \"Truck_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"Truck_E\", \"range\": \"Truck_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n// Total revenue: Revenue = $100 * Truck_A + $120 * Truck_B + $140 * Truck_C + $160 * Truck_D + $180 * Truck_E\n// Total operational cost: Cost = $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E\n// Total delivery time: Time = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n// So, the objective function is: Maximize (Revenue / (Cost + Time))\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for operational costs.\n// $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E <= $50000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 100 trucks in total.\n// Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each region.\n// Truck_A >= 10; Truck_B >= 10; Truck_C >= 10; Truck_D >= 10; Truck_E >= 10\n\n## Generate Constraint-4:\nThe total delivery time across all regions should not exceed 500 hours.\n// 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E <= 500\n\n## Generate Constraint-5:\nThe number of trucks allocated to Region E should not exceed the combined number of trucks allocated to Regions A, B, and C.\n// Truck_E <= Truck_A + Truck_B + Truck_C",
        "question": "A logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company has a total budget of $50,000 for operational costs. The company can allocate a maximum of 100 trucks in total. The company must allocate at least 10 trucks to each region. The total delivery time across all regions should not exceed 500 hours. The number of trucks allocated to Region E should not exceed the combined number of trucks allocated to Regions A, B, and C.\nPlease help the company to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_A = model.addVar(vtype=\"INTEGER\", name=\"Truck_A\", lb=10) # number of trucks allocated to Region A\nTruck_B = model.addVar(vtype=\"INTEGER\", name=\"Truck_B\", lb=10) # number of trucks allocated to Region B\nTruck_C = model.addVar(vtype=\"INTEGER\", name=\"Truck_C\", lb=10) # number of trucks allocated to Region C\nTruck_D = model.addVar(vtype=\"INTEGER\", name=\"Truck_D\", lb=10) # number of trucks allocated to Region D\nTruck_E = model.addVar(vtype=\"INTEGER\", name=\"Truck_E\", lb=10) # number of trucks allocated to Region E\n\n# Define objective function\nRevenue = 100 * Truck_A + 120 * Truck_B + 140 * Truck_C + 160 * Truck_D + 180 * Truck_E\nCost = 500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E\nTime = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue / (Cost + Time))\n# convert the division to multiplication\nmodel.addCons(obj * (Cost + Time) == Revenue)\n\n# Add constraints\nmodel.addCons(500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E <= 50000) # budget constraint\nmodel.addCons(Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100) # total trucks constraint\nmodel.addCons(4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E <= 500) # total delivery time constraint\nmodel.addCons(Truck_E <= Truck_A + Truck_B + Truck_C) # Region E trucks constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(Truck_A))\n    print(\"Number of Trucks in Region B: \", model.getVal(Truck_B))\n    print(\"Number of Trucks in Region C: \", model.getVal(Truck_C))\n    print(\"Number of Trucks in Region D: \", model.getVal(Truck_D))\n    print(\"Number of Trucks in Region E: \", model.getVal(Truck_E))\n    print(\"Maximized Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1377,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. \nOn Route A, the cost per truck is $500 per day.\nOn Route B, the cost per truck is $600 per day.\nOn Route C, the cost per truck is $700 per day.\nOn Route D, the cost per truck is $800 per day.\nOn Route E, the cost per truck is $900 per day.\nThe company wants to minimize the total daily operational cost while ensuring all routes are covered.\n// Total daily operational cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30\n\n## Generate Constraint-2:\nEach route must have at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1\n\n## Generate Constraint-3:\nThe total number of trucks on Route A and Route B combined should not exceed 15.\n// TruckA + TruckB <= 15\n\n## Generate Constraint-4:\nThe total number of trucks on Route C and Route D combined should be at least 8.\n// TruckC + TruckD >= 8",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. On Route A, the cost per truck is $500 per day. On Route B, the cost per truck is $600 per day. On Route C, the cost per truck is $700 per day. On Route D, the cost per truck is $800 per day. On Route E, the cost per truck is $900 per day. The company has a total of 30 trucks available. Each route must have at least one truck assigned. The total number of trucks on Route A and Route B combined should not exceed 15. The total number of trucks on Route C and Route D combined should be at least 8. Please help the company to minimize the total daily operational cost while ensuring all routes are covered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of trucks on Route E\n\n# Define objective function\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)\nmodel.addCons(TruckA + TruckB <= 15)\nmodel.addCons(TruckC + TruckD >= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering four types of vehicles (Truck1, Truck2, Van, and Motorcycle) to add to its fleet. Each vehicle type has different capacities and operational costs.\n// {\"number of Truck1 vehicles\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2 vehicles\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle vehicles\": \"Motorcycle\", \"range\": \"Motorcycle >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for Truck1 is $200, for Truck2 is $150, for Van is $100, and for Motorcycle is $50. The delivery capacity per vehicle per day for Truck1 is 100 packages, for Truck2 is 80 packages, for Van is 50 packages, and for Motorcycle is 20 packages. The company wants to minimize the total operational cost while ensuring sufficient delivery capacity.\n// Total operational cost: Cost = 200 * Truck1 + 150 * Truck2 + 100 * Van + 50 * Motorcycle\n// Total delivery capacity: Capacity = 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle\n// The objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to spend on vehicle acquisition.\n// 20000 * Truck1 + 15000 * Truck2 + 10000 * Van + 5000 * Motorcycle <= 100000\n\n## Generate Constraint-2:\nThe company needs to ensure a daily delivery capacity of at least 5000 packages.\n// 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle >= 5000\n\n## Generate Constraint-3:\nThe company aims to have at least 20 vehicles in total.\n// Truck1 + Truck2 + Van + Motorcycle >= 20",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering four types of vehicles (Truck1, Truck2, Van, and Motorcycle) to add to its fleet. Each vehicle type has different capacities and operational costs. The operational cost per day and delivery capacity per vehicle per day for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Delivery Capacity per Day |\n|--------------|--------------------------|---------------------------|\n| Truck1       | $200                     | 100 packages              |\n| Truck2       | $150                     | 80 packages               |\n| Van          | $100                     | 50 packages               |\n| Motorcycle   | $50                      | 20 packages               |\n\nThe company has a budget of $10,000 to spend on vehicle acquisition. The company needs to ensure a daily delivery capacity of at least 5000 packages. The company aims to have at least 20 vehicles in total. \nPlease help the company to minimize the total operational cost while ensuring sufficient delivery capacity by minimizing the ratio of total operational cost to total delivery capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)  # number of Truck1 vehicles\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)  # number of Truck2 vehicles\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Van vehicles\nMotorcycle = model.addVar(vtype=\"INTEGER\", name=\"Motorcycle\", lb=0)  # number of Motorcycle vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 200 * Truck1 + 150 * Truck2 + 100 * Van + 50 * Motorcycle\nCapacity = 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 to spend on vehicle acquisition.\nmodel.addCons(20000 * Truck1 + 15000 * Truck2 + 10000 * Van + 5000 * Motorcycle <= 100000)\n## The company needs to ensure a daily delivery capacity of at least 5000 packages.\nmodel.addCons(100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle >= 5000)\n## The company aims to have at least 20 vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Van + Motorcycle >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1 Vehicles: \", model.getVal(Truck1))\n    print(\"Number of Truck2 Vehicles: \", model.getVal(Truck2))\n    print(\"Number of Van Vehicles: \", model.getVal(Van))\n    print(\"Number of Motorcycle Vehicles: \", model.getVal(Motorcycle))\n    print(\"Minimized Cost per Delivery Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\n// {\"number of trucks for GoodsA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodsA is $500 per trip, for GoodsB is $600 per trip, for GoodsC is $700 per trip, for GoodsD is $800 per trip, and for GoodsE is $900 per trip. The revenue generated by each trip of GoodsA is $1000, GoodsB is $1200, GoodsC is $1400, GoodsD is $1600, and GoodsE is $1800. The company wants to maximize the total net profit from all trips.\n// Net profit for GoodsA: Profit_A = (1000 - 500) * TrucksA\n// Net profit for GoodsB: Profit_B = (1200 - 600) * TrucksB\n// Net profit for GoodsC: Profit_C = (1400 - 700) * TrucksC\n// Net profit for GoodsD: Profit_D = (1600 - 800) * TrucksD\n// Net profit for GoodsE: Profit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to storage limitations, the total amount of goods that can be transported at any given time is limited to 200 units. Each trip of GoodsA transports 2 units, GoodsB transports 3 units, GoodsC transports 4 units, GoodsD transports 5 units, and GoodsE transports 6 units.\n// 2 * TrucksA + 3 * TrucksB + 4 * TrucksC + 5 * TrucksD + 6 * TrucksE <= 200\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for operational costs.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000\n\n## Generate Constraint-4:\nThe company must ensure that at least 10% of the total trucks are allocated to GoodsA to maintain a baseline level of service.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network. The cost of operating a truck for GoodsA is $500 per trip, for GoodsB is $600 per trip, for GoodsC is $700 per trip, for GoodsD is $800 per trip, and for GoodsE is $900 per trip. The revenue generated by each trip of GoodsA is $1000, GoodsB is $1200, GoodsC is $1400, GoodsD is $1600, and GoodsE is $1800. The company wants to maximize the total net profit from all trips. The company has a total of 50 trucks available for distribution. Due to storage limitations, the total amount of goods that can be transported at any given time is limited to 200 units. Each trip of GoodsA transports 2 units, GoodsB transports 3 units, GoodsC transports 4 units, GoodsD transports 5 units, and GoodsE transports 6 units. The company has a budget of $30,000 for operational costs. The company must ensure that at least 10% of the total trucks are allocated to GoodsA to maintain a baseline level of service. Please help the company to maximize the total net profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodsA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodsB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodsC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodsD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodsE\n\n# Define objective function\nProfit_A = (1000 - 500) * TrucksA\nProfit_B = (1200 - 600) * TrucksB\nProfit_C = (1400 - 700) * TrucksC\nProfit_D = (1600 - 800) * TrucksD\nProfit_E = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to storage limitations, the total amount of goods that can be transported at any given time is limited to 200 units.\nmodel.addCons(2 * TrucksA + 3 * TrucksB + 4 * TrucksC + 5 * TrucksD + 6 * TrucksE <= 200)\n# The company has a budget of $30,000 for operational costs.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n# The company must ensure that at least 10% of the total trucks are allocated to GoodsA to maintain a baseline level of service.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodsB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodsC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodsD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodsE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for furniture\": \"FurnitureSpeed\", \"range\": \"FurnitureSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// Fuel_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// Fuel_Furniture = FurnitureTrucks * FurnitureSpeed^2\n// Fuel_Perishables = PerishablesTrucks * PerishablesSpeed^2\n// Time_Electronics = ElectronicsTrucks / ElectronicsSpeed\n// Time_Furniture = FurnitureTrucks / FurnitureSpeed\n// Time_Perishables = PerishablesTrucks / PerishablesSpeed\n// So, the objective function is: Minimize (Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 hours available for all trucks to be on the road per day.\n// Time_Electronics + Time_Furniture + Time_Perishables <= 50\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 20 trucks in total.\n// ElectronicsTrucks + FurnitureTrucks + PerishablesTrucks <= 20\n\n## Generate Constraint-4:\nThe average speed of trucks carrying perishables must be at least 50 km/h to ensure timely delivery.\n// PerishablesSpeed >= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n\n| Type of Goods | Number of Trucks | Average Speed |\n|---------------|------------------|---------------|\n| Electronics    | ElectronicsTrucks | ElectronicsSpeed |\n| Furniture      | FurnitureTrucks | FurnitureSpeed |\n| Perishables    | PerishablesTrucks | PerishablesSpeed |\n\nThe company has a total budget of $10,000 for fuel costs per day. The company has a maximum of 50 hours available for all trucks to be on the road per day. The company can only operate a maximum of 20 trucks in total. The average speed of trucks carrying perishables must be at least 50 km/h to ensure timely delivery.\n\nPlease help the company to minimize the total fuel consumption and time spent on the road by determining the optimal number of trucks and their average speeds for each type of good.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nFurnitureSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FurnitureSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=50)\n\n# Define objective function\nFuel_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuel_Furniture = FurnitureTrucks * FurnitureSpeed**2\nFuel_Perishables = PerishablesTrucks * PerishablesSpeed**2\nTime_Electronics = ElectronicsTrucks / ElectronicsSpeed\nTime_Furniture = FurnitureTrucks / FurnitureSpeed\nTime_Perishables = PerishablesTrucks / PerishablesSpeed\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Electronics + Fuel_Furniture + Fuel_Perishables + Time_Electronics + Time_Furniture + Time_Perishables)\n\n# Add constraints\nmodel.addCons(Fuel_Electronics + Fuel_Furniture + Fuel_Perishables <= 10000)\nmodel.addCons(Time_Electronics + Time_Furniture + Time_Perishables <= 50)\nmodel.addCons(ElectronicsTrucks + FurnitureTrucks + PerishablesTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Average Speed of Trucks for Electronics: \", model.getVal(ElectronicsSpeed))\n    print(\"Average Speed of Trucks for Furniture: \", model.getVal(FurnitureSpeed))\n    print(\"Average Speed of Trucks for Perishables: \", model.getVal(PerishablesSpeed))\n    print(\"Minimized Total Fuel Consumption and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on Route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on Route 1 is $1000, on Route 2 is $1200, on Route 3 is $1500, on Route 4 is $1800, and on Route 5 is $2000. The revenue per truck on Route 1 is $2000, on Route 2 is $2500, on Route 3 is $3000, on Route 4 is $3500, and on Route 5 is $4000. The company aims to maximize the total profit from all routes, considering that the profit per truck increases nonlinearly with the number of trucks due to economies of scale. Specifically, the profit per truck on each route increases by an additional $10 for every additional truck allocated to that route beyond the first 10 trucks.\n// Profit_Route1 = (2000 - 1000 + 10 * max(T1 - 10, 0)) * T1\n// Profit_Route2 = (2500 - 1200 + 10 * max(T2 - 10, 0)) * T2\n// Profit_Route3 = (3000 - 1500 + 10 * max(T3 - 10, 0)) * T3\n// Profit_Route4 = (3500 - 1800 + 10 * max(T4 - 10, 0)) * T4\n// Profit_Route5 = (4000 - 2000 + 10 * max(T5 - 10, 0)) * T5\n// So, the objective function is: Maximize Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across all routes.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route has a maximum capacity for the number of trucks it can handle efficiently. Route 1 can handle up to 15 trucks, Route 2 up to 12 trucks, Route 3 up to 10 trucks, Route 4 up to 8 trucks, and Route 5 up to 5 trucks.\n// T1 <= 15; T2 <= 12; T3 <= 10; T4 <= 8; T5 <= 5",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and revenue structure. The cost per truck on Route 1 is $1000, on Route 2 is $1200, on Route 3 is $1500, on Route 4 is $1800, and on Route 5 is $2000. The revenue per truck on Route 1 is $2000, on Route 2 is $2500, on Route 3 is $3000, on Route 4 is $3500, and on Route 5 is $4000. The company aims to maximize the total profit from all routes, considering that the profit per truck increases nonlinearly with the number of trucks due to economies of scale. Specifically, the profit per truck on each route increases by an additional $10 for every additional truck allocated to that route beyond the first 10 trucks.\n\nThe company has a total of 50 trucks available for allocation across all routes. Each route also has a maximum capacity for the number of trucks it can handle efficiently: Route 1 can handle up to 15 trucks, Route 2 up to 12 trucks, Route 3 up to 10 trucks, Route 4 up to 8 trucks, and Route 5 up to 5 trucks.\n\nPlease help the company to maximize the total profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on Route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on Route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on Route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on Route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on Route 5\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Route1 = (2000 - 1000 + 10 * max(T1 - 10, 0)) * T1\nT1_1 = model.addVar(vtype=\"INTEGER\", name=\"T1_1\", lb=0, ub=10)\nT1_2 = model.addVar(vtype=\"INTEGER\", name=\"T1_2\", lb=10, ub=15)\nT1_b1 = model.addVar(vtype=\"B\", name=\"T1_b1\")\nT1_b2 = model.addVar(vtype=\"B\", name=\"T1_b2\")\nmodel.addCons(T1_b1 + T1_b2 == 1)\nmodel.addCons(T1 == T1_1*T1_b1 + T1_2*T1_b2)\nProfit_Route1 = (2000 - 1000) * T1_1 * T1_b1 + (2000 - 1000 + 10 * (T1_2 - 10)) * T1_2 * T1_b2\n## create piecewise variables for piecewise function: Profit_Route2 = (2500 - 1200 + 10 * max(T2 - 10, 0)) * T2\nT2_1 = model.addVar(vtype=\"INTEGER\", name=\"T2_1\", lb=0, ub=10)\nT2_2 = model.addVar(vtype=\"INTEGER\", name=\"T2_2\", lb=10, ub=12)\nT2_b1 = model.addVar(vtype=\"B\", name=\"T2_b1\")\nT2_b2 = model.addVar(vtype=\"B\", name=\"T2_b2\")\nmodel.addCons(T2_b1 + T2_b2 == 1)\nmodel.addCons(T2 == T2_1*T2_b1 + T2_2*T2_b2)\nProfit_Route2 = (2500 - 1200) * T2_1 * T2_b1 + (2500 - 1200 + 10 * (T2_2 - 10)) * T2_2 * T2_b2\n## create piecewise variables for piecewise function: Profit_Route3 = (3000 - 1500 + 10 * max(T3 - 10, 0)) * T3\nT3_1 = model.addVar(vtype=\"INTEGER\", name=\"T3_1\", lb=0, ub=10)\nT3_2 = model.addVar(vtype=\"INTEGER\", name=\"T3_2\", lb=10, ub=10)\nT3_b1 = model.addVar(vtype=\"B\", name=\"T3_b1\")\nT3_b2 = model.addVar(vtype=\"B\", name=\"T3_b2\")\nmodel.addCons(T3_b1 + T3_b2 == 1)\nmodel.addCons(T3 == T3_1*T3_b1 + T3_2*T3_b2)\nProfit_Route3 = (3000 - 1500) * T3_1 * T3_b1 + (3000 - 1500 + 10 * (T3_2 - 10)) * T3_2 * T3_b2\n## create piecewise variables for piecewise function: Profit_Route4 = (3500 - 1800 + 10 * max(T4 - 10, 0)) * T4\nT4_1 = model.addVar(vtype=\"INTEGER\", name=\"T4_1\", lb=0, ub=10)\nT4_2 = model.addVar(vtype=\"INTEGER\", name=\"T4_2\", lb=10, ub=8)\nT4_b1 = model.addVar(vtype=\"B\", name=\"T4_b1\")\nT4_b2 = model.addVar(vtype=\"B\", name=\"T4_b2\")\nmodel.addCons(T4_b1 + T4_b2 == 1)\nmodel.addCons(T4 == T4_1*T4_b1 + T4_2*T4_b2)\nProfit_Route4 = (3500 - 1800) * T4_1 * T4_b1 + (3500 - 1800 + 10 * (T4_2 - 10)) * T4_2 * T4_b2\n## create piecewise variables for piecewise function: Profit_Route5 = (4000 - 2000 + 10 * max(T5 - 10, 0)) * T5\nT5_1 = model.addVar(vtype=\"INTEGER\", name=\"T5_1\", lb=0, ub=10)\nT5_2 = model.addVar(vtype=\"INTEGER\", name=\"T5_2\", lb=10, ub=5)\nT5_b1 = model.addVar(vtype=\"B\", name=\"T5_b1\")\nT5_b2 = model.addVar(vtype=\"B\", name=\"T5_b2\")\nmodel.addCons(T5_b1 + T5_b2 == 1)\nmodel.addCons(T5 == T5_1*T5_b1 + T5_2*T5_b2)\nProfit_Route5 = (4000 - 2000) * T5_1 * T5_b1 + (4000 - 2000 + 10 * (T5_2 - 10)) * T5_2 * T5_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\nmodel.addCons(T1 <= 15)\nmodel.addCons(T2 <= 12)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 8)\nmodel.addCons(T5 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 hours of assembly time and 1 hour of testing time. \nThe profit per unit of E2 is $150, requiring 3 hours of assembly time and 2 hours of testing time. \nThe profit per unit of E3 is $200, requiring 4 hours of assembly time and 3 hours of testing time. \nThe company aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// Total_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\n// Total_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\n// The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time), where C is a cost coefficient for time.\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours available for assembly.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. The company needs to decide the production quantities of each device to maximize profit while considering various constraints. The profit per unit of E1 is $100, requiring 2 hours of assembly time and 1 hour of testing time. The profit per unit of E2 is $150, requiring 3 hours of assembly time and 2 hours of testing time. The profit per unit of E3 is $200, requiring 4 hours of assembly time and 3 hours of testing time. The company has a total of 1000 hours available for assembly. Please help the company to maximize the total profit, considering the cost coefficient for time in the objective function: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time), where C is a cost coefficient for time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\nTotal_Assembly_Time = 2 * Q1 + 3 * Q2 + 4 * Q3\nTotal_Testing_Time = 1 * Q1 + 2 * Q2 + 3 * Q3\nC = 0.1  # Cost coefficient for time\n## The objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) - C * (Total_Assembly_Time + Total_Testing_Time)\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 - C * (Total_Assembly_Time + Total_Testing_Time))\n\n# Add constraints\n## The company has a total of 1000 hours available for assembly.\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the number of sales representatives dedicated to each product. The effectiveness of the marketing budget and the number of sales representatives both have a nonlinear impact on the sales of each product.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"RepsA\", \"range\": \"RepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"RepsB\", \"range\": \"RepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"RepsC\", \"range\": \"RepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear, with the revenue increasing at a decreasing rate with respect to the marketing budget and the number of sales representatives. The cost of production per unit is $50 for ProductA, $70 for ProductB, and $90 for ProductC. The company aims to maximize the total profit from all products.\n// Revenue for ProductA: RevenueA = QuantityA * (100 - 0.01 * BudgetA^2 + 0.02 * RepsA^2)\n// Revenue for ProductB: RevenueB = QuantityB * (120 - 0.015 * BudgetB^2 + 0.015 * RepsB^2)\n// Revenue for ProductC: RevenueC = QuantityC * (150 - 0.02 * BudgetC^2 + 0.01 * RepsC^2)\n// Total cost for ProductA: CostA = 50 * QuantityA\n// Total cost for ProductB: CostB = 70 * QuantityB\n// Total cost for ProductC: CostC = 90 * QuantityC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// BudgetA + BudgetB + BudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 sales representatives available.\n// RepsA + RepsB + RepsC <= 50\n\n## Generate Constraint-3:\nThe production capacity for each product is limited. ProductA can be produced up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the number of sales representatives dedicated to each product. The effectiveness of the marketing budget and the number of sales representatives both have a nonlinear impact on the sales of each product. The revenue generated from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear, with the revenue increasing at a decreasing rate with respect to the marketing budget and the number of sales representatives. The cost of production per unit is $50 for ProductA, $70 for ProductB, and $90 for ProductC. The company aims to maximize the total profit from all products. The total marketing budget for all products cannot exceed $100,000. The company has a total of 50 sales representatives available. The production capacity for each product is limited. ProductA can be produced up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0) # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0) # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0) # marketing budget for ProductC\nRepsA = model.addVar(vtype=\"INTEGER\", name=\"RepsA\", lb=0) # number of sales representatives for ProductA\nRepsB = model.addVar(vtype=\"INTEGER\", name=\"RepsB\", lb=0) # number of sales representatives for ProductB\nRepsC = model.addVar(vtype=\"INTEGER\", name=\"RepsC\", lb=0) # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (100 - 0.01 * BudgetA**2 + 0.02 * RepsA**2)\nRevenueB = QuantityB * (120 - 0.015 * BudgetB**2 + 0.015 * RepsB**2)\nRevenueC = QuantityC * (150 - 0.02 * BudgetC**2 + 0.01 * RepsC**2)\nCostA = 50 * QuantityA\nCostB = 70 * QuantityB\nCostC = 90 * QuantityC\nTotalProfit = RevenueA - CostA + RevenueB - CostB + RevenueC - CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 100000)\nmodel.addCons(RepsA + RepsB + RepsC <= 50)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1500)\nmodel.addCons(QuantityC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Number of Sales Representatives for ProductA: \", model.getVal(RepsA))\n    print(\"Number of Sales Representatives for ProductB: \", model.getVal(RepsB))\n    print(\"Number of Sales Representatives for ProductC: \", model.getVal(RepsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3.\n// {\"number of Type1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Type1 trucks\": \"FEU1\", \"range\": \"FEU1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type2 trucks\": \"FEU2\", \"range\": \"FEU2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Type3 trucks\": \"FEU3\", \"range\": \"FEU3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n// Fuel cost for Type1 trucks: FC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\n// Fuel cost for Type2 trucks: FC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\n// Fuel cost for Type3 trucks: FC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\n// Upgrade cost: UC = 100 * (FEU1 + FEU2 + FEU3)\n// So, the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency upgrades.\n// 100 * (FEU1 + FEU2 + FEU3) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The truck types are Type1, Type2, and Type3. The company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for Type1 trucks is $0.50, for Type2 trucks is $0.60, and for Type3 trucks is $0.70. The fuel efficiency upgrade reduces the fuel consumption by 0.01 liters per kilometer for every $100 invested. The company operates a total of 10,000 kilometers per month.\n\n| Truck Type | Fuel Cost per Kilometer | Fuel Efficiency Upgrade Cost |\n|------------|-------------------------|------------------------------|\n| Type1      | $0.50                   | $100 per 0.01 L/km reduction|\n| Type2      | $0.60                   | $100 per 0.01 L/km reduction|\n| Type3      | $0.70                   | $100 per 0.01 L/km reduction|\n\nThe company has a budget of $50,000 for fuel efficiency upgrades. The total number of trucks available is 100.\nPlease help the company to determine the optimal number of trucks of each type and the appropriate fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of Type1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of Type2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of Type3 trucks\nFEU1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU1\", lb=0) # fuel efficiency upgrade for Type1 trucks\nFEU2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU2\", lb=0) # fuel efficiency upgrade for Type2 trucks\nFEU3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FEU3\", lb=0) # fuel efficiency upgrade for Type3 trucks\n\n# Define objective function\nFC1 = 0.50 * (1 - 0.0001 * FEU1) * 10000 * T1\nFC2 = 0.60 * (1 - 0.0001 * FEU2) * 10000 * T2\nFC3 = 0.70 * (1 - 0.0001 * FEU3) * 10000 * T3\nUC = 100 * (FEU1 + FEU2 + FEU3)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (FC1 + FC2 + FC3 + UC)\nmodel.addCons(obj == FC1 + FC2 + FC3 + UC)\n\n# Add constraints\n# The company has a budget of $50,000 for fuel efficiency upgrades.\nmodel.addCons(100 * (FEU1 + FEU2 + FEU3) <= 50000)\n# The total number of trucks available is 100.\nmodel.addCons(T1 + T2 + T3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type3 Trucks: \", model.getVal(T3))\n    print(\"Fuel Efficiency Upgrade for Type1: \", model.getVal(FEU1))\n    print(\"Fuel Efficiency Upgrade for Type2: \", model.getVal(FEU2))\n    print(\"Fuel Efficiency Upgrade for Type3: \", model.getVal(FEU3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Trucks\": \"TruckHours\", \"range\": \"TruckHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Vans\": \"VanHours\", \"range\": \"VanHours >= 0\", \"type\": \"integer\"}\n// {\"operational hours for Bikes\": \"BikeHours\", \"range\": \"BikeHours >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue generated by each vehicle type is a function of operational hours and the number of vehicles. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company aims to maximize the net daily revenue.\n// Revenue_Trucks = 100 * TruckHours * TruckCount - 50 * TruckHours * TruckCount\n// Revenue_Vans = 70 * VanHours * VanCount - 30 * VanHours * VanCount\n// Revenue_Bikes = 30 * BikeHours * BikeCount - 10 * BikeHours * BikeCount\n// So, the objective function is: Maximize (Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n## Generate Constraint-1:\nThe company has a total of 200 operational hours available per day across all vehicle types.\n// TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to optimize the fleet size and operational hours for each vehicle type to maximize daily revenue while considering operational costs and constraints such as fuel efficiency, maintenance costs, and driver availability. Trucks generate $100 per hour, Vans generate $70 per hour, and Bikes generate $30 per hour. The operational cost for Trucks is $50 per hour, for Vans is $30 per hour, and for Bikes is $10 per hour. The company has a total of 200 operational hours available per day across all vehicle types. Please help the company to maximize the net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0) # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0) # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0) # number of Bikes\nTruckHours = model.addVar(vtype=\"INTEGER\", name=\"TruckHours\", lb=0) # operational hours for Trucks\nVanHours = model.addVar(vtype=\"INTEGER\", name=\"VanHours\", lb=0) # operational hours for Vans\nBikeHours = model.addVar(vtype=\"INTEGER\", name=\"BikeHours\", lb=0) # operational hours for Bikes\n\n# Define objective function\nRevenue_Trucks = (100 - 50) * TruckHours * TruckCount\nRevenue_Vans = (70 - 30) * VanHours * VanCount\nRevenue_Bikes = (30 - 10) * BikeHours * BikeCount\n# So, the objective function is: Maximize (Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Trucks + Revenue_Vans + Revenue_Bikes)\n\n# Add constraints\n# The company has a total of 200 operational hours available per day across all vehicle types.\nmodel.addCons(TruckHours * TruckCount + VanHours * VanCount + BikeHours * BikeCount <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Operational hours for Trucks: \", model.getVal(TruckHours))\n    print(\"Operational hours for Vans: \", model.getVal(VanHours))\n    print(\"Operational hours for Bikes: \", model.getVal(BikeHours))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"storage capacity for ProductA\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductB\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductC\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $1000 invested in automation for that product. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to automation.\n// Total revenue for ProductA: RevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product. The following table provides the initial production time per unit, revenue per unit, and the effect of automation on production time for each product.\n\n| Product | Initial Production Time | Revenue per Unit | Automation Effect (Reduction in Production Time per $1000) |\n|---------|-------------------------|------------------|--------------------------------------------------------|\n| ProductA | 30 minutes              | $100             | 1 minute                                               |\n| ProductB | 25 minutes              | $120             | 1 minute                                               |\n| ProductC | 20 minutes              | $150             | 1 minute                                               |\n\nThe company has a total of 100 workers available. The company aims to maximize the total revenue from all products, considering the reduced production time due to automation. Please help the company determine the optimal production quantity, number of workers, and capital investment in automation for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # capital investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # capital investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # capital investment in automation for ProductC\n\n# Define objective function\nRevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\nRevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\nRevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Capital Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Capital Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1514,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good and the frequency of trips per truck. The company also considers investing in fuel-efficient technologies for each type of truck to reduce operational costs.\n// {\"number of trucks for Heavy Machinery\": \"TrucksHM\", \"range\": \"TrucksHM >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Consumer Electronics\": \"TrucksCE\", \"range\": \"TrucksCE >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable Goods\": \"TrucksPG\", \"range\": \"TrucksPG >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Heavy Machinery\": \"TripsHM\", \"range\": \"TripsHM >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Consumer Electronics\": \"TripsCE\", \"range\": \"TripsCE >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Perishable Goods\": \"TripsPG\", \"range\": \"TripsPG >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy Machinery\": \"InvestmentHM\", \"range\": \"InvestmentHM >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Consumer Electronics\": \"InvestmentCE\", \"range\": \"InvestmentCE >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Perishable Goods\": \"InvestmentPG\", \"range\": \"InvestmentPG >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit, which is affected by the investment in fuel-efficient technologies. The net profit per trip for Heavy Machinery is $1000, which decreases by $10 for every $100 invested in fuel-efficient technology. The net profit per trip for Consumer Electronics is $800, which decreases by $8 for every $100 invested in fuel-efficient technology. The net profit per trip for Perishable Goods is $1200, which decreases by $12 for every $100 invested in fuel-efficient technology.\n// Net profit for Heavy Machinery: ProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\n// Net profit for Consumer Electronics: ProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\n// Net profit for Perishable Goods: ProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\n// So, the objective function is: Maximize (ProfitHM + ProfitCE + ProfitPG)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies.\n// 1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available.\n// TrucksHM + TrucksCE + TrucksPG <= 50\n\n## Generate Constraint-3:\nThe operational capacity limits the total number of trips to 500 per day.\n// TrucksHM * TripsHM + TrucksCE * TripsCE + TrucksPG * TripsPG <= 500\n\n## Generate Constraint-4:\nDue to maintenance constraints, each truck can make at most 10 trips per day.\n// TripsHM <= 10; TripsCE <= 10; TripsPG <= 10\n\n## Generate Constraint-5:\nThe company must allocate at least 10 trucks to Perishable Goods due to contractual obligations.\n// TrucksPG >= 10",
        "question": "A logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good, the frequency of trips per truck, and the investment in fuel-efficient technologies for each type of truck to reduce operational costs. The net profit per trip for each type of good, affected by the investment in fuel-efficient technologies, is given in the following Table.\n\n| Type of Good       | Net Profit per Trip | Reduction in Profit per $100 Investment |\n|--------------------|---------------------|-----------------------------------------|\n| Heavy Machinery    | $1000               | $10                                     |\n| Consumer Electronics| $800                | $8                                      |\n| Perishable Goods   | $1200               | $12                                     |\n\nThe company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies. The company has a total of 50 trucks available. The operational capacity limits the total number of trips to 500 per day. Due to maintenance constraints, each truck can make at most 10 trips per day. The company must allocate at least 10 trucks to Perishable Goods due to contractual obligations.\n\nPlease help the company to maximize its net profit, which is affected by the investment in fuel-efficient technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksHM = model.addVar(vtype=\"INTEGER\", name=\"TrucksHM\", lb=0)  # number of trucks for Heavy Machinery\nTrucksCE = model.addVar(vtype=\"INTEGER\", name=\"TrucksCE\", lb=0)  # number of trucks for Consumer Electronics\nTrucksPG = model.addVar(vtype=\"INTEGER\", name=\"TrucksPG\", lb=0)  # number of trucks for Perishable Goods\nTripsHM = model.addVar(vtype=\"INTEGER\", name=\"TripsHM\", lb=0)  # frequency of trips per truck for Heavy Machinery\nTripsCE = model.addVar(vtype=\"INTEGER\", name=\"TripsCE\", lb=0)  # frequency of trips per truck for Consumer Electronics\nTripsPG = model.addVar(vtype=\"INTEGER\", name=\"TripsPG\", lb=0)  # frequency of trips per truck for Perishable Goods\nInvestmentHM = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentHM\", lb=0)  # investment in fuel-efficient technology for Heavy Machinery\nInvestmentCE = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentCE\", lb=0)  # investment in fuel-efficient technology for Consumer Electronics\nInvestmentPG = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentPG\", lb=0)  # investment in fuel-efficient technology for Perishable Goods\n\n# Define objective function\nProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\nProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\nProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHM + ProfitCE + ProfitPG)\n\n# Add constraints\nmodel.addCons(1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000)\nmodel.addCons(TrucksHM + TrucksCE + TrucksPG <= 50)\nmodel.addCons(TrucksHM * TripsHM + TrucksCE * TripsCE + TrucksPG * TripsPG <= 500)\nmodel.addCons(TripsHM <= 10)\nmodel.addCons(TripsCE <= 10)\nmodel.addCons(TripsPG <= 10)\nmodel.addCons(TrucksPG >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(TrucksHM))\n    print(\"Number of Trucks for Consumer Electronics: \", model.getVal(TrucksCE))\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(TrucksPG))\n    print(\"Frequency of Trips for Heavy Machinery: \", model.getVal(TripsHM))\n    print(\"Frequency of Trips for Consumer Electronics: \", model.getVal(TripsCE))\n    print(\"Frequency of Trips for Perishable Goods: \", model.getVal(TripsPG))\n    print(\"Investment in Fuel-Efficient Technology for Heavy Machinery: \", model.getVal(InvestmentHM))\n    print(\"Investment in Fuel-Efficient Technology for Consumer Electronics: \", model.getVal(InvestmentCE))\n    print(\"Investment in Fuel-Efficient Technology for Perishable Goods: \", model.getVal(InvestmentPG))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1463,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency.\n// {\"speed setting for machine 1\": \"S1\", \"range\": \"0 < S1 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 2\": \"S2\", \"range\": \"0 < S2 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 3\": \"S3\", \"range\": \"0 < S3 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 4\": \"S4\", \"range\": \"0 < S4 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 5\": \"S5\", \"range\": \"0 < S5 < 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine's production rate is a nonlinear function of its speed setting. The production rate of each machine is given by the following functions:\n- Machine 1: P1 = 100 * S1 - 0.5 * S1^2\n- Machine 2: P2 = 120 * S2 - 0.6 * S2^2\n- Machine 3: P3 = 110 * S3 - 0.55 * S3^2\n- Machine 4: P4 = 90 * S4 - 0.45 * S4^2\n- Machine 5: P5 = 80 * S5 - 0.4 * S5^2\nThe objective is to maximize the total production rate of all machines.\n// Objective function: Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * S1 - 0.5 * S1^2) + (120 * S2 - 0.6 * S2^2) + (110 * S3 - 0.55 * S3^2) + (90 * S4 - 0.45 * S4^2) + (80 * S5 - 0.4 * S5^2)\n\n## Generate Constraint-1:\nThe total energy consumption of all machines must not exceed 1000 units.\n// 10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency. The speed settings for each machine must be between 0 and 100. The production rate of each machine is a nonlinear function of its speed setting:\n- Machine 1: P1 = 100 * S1 - 0.5 * S1^2\n- Machine 2: P2 = 120 * S2 - 0.6 * S2^2\n- Machine 3: P3 = 110 * S3 - 0.55 * S3^2\n- Machine 4: P4 = 90 * S4 - 0.45 * S4^2\n- Machine 5: P5 = 80 * S5 - 0.4 * S5^2\nThe objective is to maximize the total production rate of all machines. Additionally, the total energy consumption of all machines must not exceed 1000 units.\nPlease help the manager to determine the optimal speed settings for each machine to maximize the total production rate while adhering to the energy constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=100) # speed setting for machine 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0, ub=100) # speed setting for machine 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0, ub=100) # speed setting for machine 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0, ub=100) # speed setting for machine 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0, ub=100) # speed setting for machine 5\n\n# Define objective function\nP1 = 100 * S1 - 0.5 * S1**2\nP2 = 120 * S2 - 0.6 * S2**2\nP3 = 110 * S3 - 0.55 * S3**2\nP4 = 90 * S4 - 0.45 * S4**2\nP5 = 80 * S5 - 0.4 * S5**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total energy consumption of all machines must not exceed 1000 units.\nmodel.addCons(10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed Setting for Machine 1: \", model.getVal(S1))\n    print(\"Speed Setting for Machine 2: \", model.getVal(S2))\n    print(\"Speed Setting for Machine 3: \", model.getVal(S3))\n    print(\"Speed Setting for Machine 4: \", model.getVal(S4))\n    print(\"Speed Setting for Machine 5: \", model.getVal(S5))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on Type A buildings\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type B buildings\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type C buildings\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type D buildings\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type E buildings\": \"TypeESolar\", \"range\": \"TypeESolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type due to differences in roof orientation and size. Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city aims to maximize the total energy generated per dollar spent.\n// Total energy generated: Energy = 80% * TypeASolar + 75% * TypeBSolar + 70% * TypeCSolar + 65% * TypeDSolar + 60% * TypeESolar\n// Total cost of installation: Cost = $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar <= $500,000\n\n## Generate Constraint-2:\nDue to building regulations, the number of solar panels on Type A buildings must not exceed 500.\n// TypeASolar <= 500\n\n## Generate Constraint-3:\nThe city aims to install at least 1000 solar panels in total across all building types.\n// TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000\n\n## Generate Constraint-4:\nTo ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined.\n// TypeCSolar + TypeDSolar >= 0.10 * (TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar)\n\n## Generate Constraint-5:\nThe city has a limited number of installers skilled in installing solar panels on Type E buildings, so the number of panels installed on Type E buildings must not exceed 200.\n// TypeESolar <= 200",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The efficiency of solar panels varies by building type due to differences in roof orientation and size. Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city aims to maximize the total energy generated per dollar spent.\n\nThe city has a budget of $500,000 for the installation of solar panels. Due to building regulations, the number of solar panels on Type A buildings must not exceed 500. The city aims to install at least 1000 solar panels in total across all building types. To ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined. The city has a limited number of installers skilled in installing solar panels on Type E buildings, so the number of panels installed on Type E buildings must not exceed 200.\n\nPlease help the city determine the number of solar panels to install on each type of building to maximize the total energy generated per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0) # number of solar panels on Type A buildings\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0) # number of solar panels on Type B buildings\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0) # number of solar panels on Type C buildings\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0) # number of solar panels on Type D buildings\nTypeESolar = model.addVar(vtype=\"INTEGER\", name=\"TypeESolar\", lb=0) # number of solar panels on Type E buildings\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * TypeASolar + 0.75 * TypeBSolar + 0.7 * TypeCSolar + 0.65 * TypeDSolar + 0.6 * TypeESolar\nCost = 1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar\n## the objective function is: Maximize (Energy / Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar <= 500000)\n## Due to building regulations, the number of solar panels on Type A buildings must not exceed 500.\nmodel.addCons(TypeASolar <= 500)\n## The city aims to install at least 1000 solar panels in total across all building types.\nmodel.addCons(TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000)\n## To ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined.\nmodel.addCons(TypeCSolar + TypeDSolar >= 0.10 * (TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar))\n## The city has a limited number of installers skilled in installing solar panels on Type E buildings, so the number of panels installed on Type E buildings must not exceed 200.\nmodel.addCons(TypeESolar <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Type A Buildings: \", model.getVal(TypeASolar))\n    print(\"Number of Solar Panels on Type B Buildings: \", model.getVal(TypeBSolar))\n    print(\"Number of Solar Panels on Type C Buildings: \", model.getVal(TypeCSolar))\n    print(\"Number of Solar Panels on Type D Buildings: \", model.getVal(TypeDSolar))\n    print(\"Number of Solar Panels on Type E Buildings: \", model.getVal(TypeESolar))\n    print(\"Maximized Energy per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1442,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases as more money is invested in automation.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. These costs decrease by $1 for every $10,000 invested in automation. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * Automation) * ProductA\n// Total cost for ProductB: CostB = (70 - 0.0001 * Automation) * ProductB\n// Total cost for ProductC: CostC = (90 - 0.0001 * Automation) * ProductC\n// Total revenue for ProductA: RevenueA = 100 * ProductA\n// Total revenue for ProductB: RevenueB = 120 * ProductB\n// Total revenue for ProductC: RevenueC = 150 * ProductC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// ProductA + ProductB + ProductC <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 1000 units of ProductA and 1500 units of ProductB.\n// ProductA >= 1000; ProductB >= 1500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases by $1 for every $10,000 invested in automation. The selling price per unit and the initial production cost per unit for each product are given in the following Table.\n\n| Product | Selling Price | Initial Production Cost |\n|---------|---------------|-------------------------|\n| ProductA | $100          | $50                     |\n| ProductB | $120          | $70                     |\n| ProductC | $150          | $90                     |\n\nThe company has a budget of $100,000 for investment in automation. The total production capacity of the company is 5000 units. The company must produce at least 1000 units of ProductA and 1500 units of ProductB. \nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=1000)  # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=1500)  # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nCostA = (50 - 0.0001 * Automation) * ProductA\nCostB = (70 - 0.0001 * Automation) * ProductB\nCostC = (90 - 0.0001 * Automation) * ProductC\nRevenueA = 100 * ProductA\nRevenueB = 120 * ProductB\nRevenueC = 150 * ProductC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)  # The company has a budget of $100,000 for investment in automation.\nmodel.addCons(ProductA + ProductB + ProductC <= 5000)  # The total production capacity of the company is 5000 units.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location.\n// {\"number of solar panels at location 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n// Energy output from solar panels at location 1: E_S1 = S1 * (1 - 0.01 * S1)\n// Energy output from wind turbines at location 1: E_W1 = W1 * (1 - 0.02 * W1)\n// Energy output from solar panels at location 2: E_S2 = S2 * (1 - 0.01 * S2)\n// Energy output from wind turbines at location 2: E_W2 = W2 * (1 - 0.02 * W2)\n// Energy output from solar panels at location 3: E_S3 = S3 * (1 - 0.01 * S3)\n// Energy output from wind turbines at location 3: E_W3 = W3 * (1 - 0.02 * W3)\n// Energy output from solar panels at location 4: E_S4 = S4 * (1 - 0.01 * S4)\n// Energy output from wind turbines at location 4: E_W4 = W4 * (1 - 0.02 * W4)\n// Energy output from solar panels at location 5: E_S5 = S5 * (1 - 0.01 * S5)\n// Energy output from wind turbines at location 5: E_W5 = W5 * (1 - 0.02 * W5)\n// So, the objective function is: Maximize E_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000.\n// 1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines at each location should not exceed 100.\n// S1 + W1 <= 100; S2 + W2 <= 100; S3 + W3 <= 100; S4 + W4 <= 100; S5 + W5 <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location. The efficiency of solar panels decreases with the number of panels installed at a location due to shading effects, and the efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000. The total number of solar panels and wind turbines at each location should not exceed 100.\n\nPlease help the company to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at location 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines at location 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at location 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines at location 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at location 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines at location 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at location 4\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of wind turbines at location 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at location 5\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## Energy output from solar panels and wind turbines\nE_S1 = S1 * (1 - 0.01 * S1)\nE_W1 = W1 * (1 - 0.02 * W1)\nE_S2 = S2 * (1 - 0.01 * S2)\nE_W2 = W2 * (1 - 0.02 * W2)\nE_S3 = S3 * (1 - 0.01 * S3)\nE_W3 = W3 * (1 - 0.02 * W3)\nE_S4 = S4 * (1 - 0.01 * S4)\nE_W4 = W4 * (1 - 0.02 * W4)\nE_S5 = S5 * (1 - 0.01 * S5)\nE_W5 = W5 * (1 - 0.02 * W5)\n## Objective function\nE_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## Budget constraint\nmodel.addCons(1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000)\n## Maximum number of installations at each location\nmodel.addCons(S1 + W1 <= 100)\nmodel.addCons(S2 + W2 <= 100)\nmodel.addCons(S3 + W3 <= 100)\nmodel.addCons(S4 + W4 <= 100)\nmodel.addCons(S5 + W5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(W3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(S4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(W4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(S5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(W5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost. The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\n// Profit_Route1 = Revenue_Route1 - FuelCost_Route1 = 1000 * T1 - 0.1 * T1^2\n// Profit_Route2 = Revenue_Route2 - FuelCost_Route2 = 1200 * T2 - 0.12 * T2^2\n// Profit_Route3 = Revenue_Route3 - FuelCost_Route3 = 1500 * T3 - 0.15 * T3^2\n// Profit_Route4 = Revenue_Route4 - FuelCost_Route4 = 1300 * T4 - 0.13 * T4^2\n// Profit_Route5 = Revenue_Route5 - FuelCost_Route5 = 1100 * T5 - 0.11 * T5^2\n// The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks due to road restrictions and operational efficiency.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 22; T5 <= 18\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10\n\n## Generate Constraint-4:\nThe total fuel cost should not exceed a budget of $5000 per day.\n// 0.1 * T1^2 + 0.12 * T2^2 + 0.15 * T3^2 + 0.13 * T4^2 + 0.11 * T5^2 <= 5000",
        "question": "A logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost, where the fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks due to road restrictions and operational efficiency. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels. Additionally, the total fuel cost should not exceed a budget of $5000 per day.\n\nPlease help the company to maximize its total profit across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10) # number of trucks on route 5\n\n# Define objective function\n## The profit per route is calculated as the revenue from deliveries minus the fuel cost.\nProfit_Route1 = 1000 * T1 - 0.1 * T1**2\nProfit_Route2 = 1200 * T2 - 0.12 * T2**2\nProfit_Route3 = 1500 * T3 - 0.15 * T3**2\nProfit_Route4 = 1300 * T4 - 0.13 * T4**2\nProfit_Route5 = 1100 * T5 - 0.11 * T5**2\n## The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks due to road restrictions and operational efficiency.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 22)\nmodel.addCons(T5 <= 18)\n## The total fuel cost should not exceed a budget of $5000 per day.\nmodel.addCons(0.1 * T1**2 + 0.12 * T2**2 + 0.15 * T3**2 + 0.13 * T4**2 + 0.11 * T5**2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 T1 trucks.\n// T1 >= 10",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries. The revenue generated and fuel consumed per trip for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Trip | Fuel Cost per Trip |\n|------------|------------------|--------------------|\n| T1         | $500             | $100               |\n| T2         | $600             | $120               |\n| T3         | $700             | $140               |\n| T4         | $800             | $160               |\n| T5         | $900             | $180               |\n\nThe company has a budget of $50,000 for purchasing trucks. The total number of trucks cannot exceed 50. The company must have at least 10 T1 trucks. \n\nPlease help the company to maximize the net profit, which is the total revenue minus the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 trucks: \", model.getVal(T1))\n    print(\"Number of T2 trucks: \", model.getVal(T2))\n    print(\"Number of T3 trucks: \", model.getVal(T3))\n    print(\"Number of T4 trucks: \", model.getVal(T4))\n    print(\"Number of T5 trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of hours each machine will operate for each product, and the investment in maintenance to optimize machine efficiency. The efficiency of each machine increases by 1% for every $1,000 invested in maintenance. The company aims to maximize its total revenue while considering the costs of production and maintenance.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"integer\"}\n// {\"machine hours for ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"integer\"}\n// {\"investment in maintenance for ProductA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for ProductB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"investment in maintenance for ProductC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by 0.1% for every $1,000 invested in maintenance. The initial cost of production per unit for ProductA is $70, for ProductB is $80, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 70 + 0.0001 * MaintenanceA) * QuantityA * HoursA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.0001 * MaintenanceB) * QuantityB * HoursB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * MaintenanceC) * QuantityC * HoursC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total machine hours available for all products cannot exceed 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-2:\nThe total investment in maintenance cannot exceed $50,000.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 50000\n\n## Generate Constraint-3:\nDue to operational constraints, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of hours each machine will operate for each product, and the investment in maintenance to optimize machine efficiency. The efficiency of each machine increases by 1% for every $1,000 invested in maintenance. The revenue per unit and the initial cost of production per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Initial Cost per Unit |\n|---------|------------------|-----------------------|\n| ProductA | $100            | $70                   |\n| ProductB | $150            | $80                   |\n| ProductC | $200            | $90                   |\n\nThe company aims to maximize its total profit from all products. The total machine hours available for all products cannot exceed 1000 hours. The total investment in maintenance cannot exceed $50,000. Due to operational constraints, the production quantity of each product cannot exceed 500 units. Please help the company to determine the optimal production quantity, machine hours, and maintenance investment for each product to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)  # production quantity of ProductC\nHoursA = model.addVar(vtype=\"INTEGER\", name=\"HoursA\", lb=0)  # machine hours for ProductA\nHoursB = model.addVar(vtype=\"INTEGER\", name=\"HoursB\", lb=0)  # machine hours for ProductB\nHoursC = model.addVar(vtype=\"INTEGER\", name=\"HoursC\", lb=0)  # machine hours for ProductC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # investment in maintenance for ProductA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # investment in maintenance for ProductB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # investment in maintenance for ProductC\n\n# Define objective function\nProfitA = (100 - 70 + 0.0001 * MaintenanceA) * QuantityA * HoursA\nProfitB = (150 - 80 + 0.0001 * MaintenanceB) * QuantityB * HoursB\nProfitC = (200 - 90 + 0.0001 * MaintenanceC) * QuantityC * HoursC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)  # total machine hours available for all products\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 50000)  # total investment in maintenance\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Hours for ProductA: \", model.getVal(HoursA))\n    print(\"Hours for ProductB: \", model.getVal(HoursB))\n    print(\"Hours for ProductC: \", model.getVal(HoursC))\n    print(\"Maintenance for ProductA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance for ProductB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance for ProductC: \", model.getVal(MaintenanceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n// Total profit from Small trucks: ProfitSmall = 50000 * SmallTrucks\n// Total profit from Medium trucks: ProfitMedium = 75000 * MediumTrucks\n// Total profit from Large trucks: ProfitLarge = 100000 * LargeTrucks\n// Total profit from Extra-Large trucks: ProfitExtraLarge = 125000 * ExtraLargeTrucks\n// Operational cost: OperationalCost = 50000 * Drivers\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 30.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 30\n\n## Generate Constraint-3:\nDue to regulatory requirements, the number of drivers must be at least equal to the number of trucks.\n// Drivers >= SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large, each with different profit contributions based on their cargo capacity and operational efficiency. The company also needs to decide on the number of drivers to hire, which affects the operational costs. The profit per truck type and the operational cost per driver are given in the following Table.\n\n| Truck Type         | Profit per Truck |\n|--------------------|------------------|\n| Small              | $50,000          |\n| Medium             | $75,000          |\n| Large              | $100,000         |\n| Extra-Large        | $125,000         |\n| Drivers (Operational Cost) | $50,000 per driver |\n\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers. The total number of trucks cannot exceed 30. Due to regulatory requirements, the number of drivers must be at least equal to the number of trucks.\n\nPlease help the company to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)\n\n# Define objective function\nProfitSmall = 50000 * SmallTrucks\nProfitMedium = 75000 * MediumTrucks\nProfitLarge = 100000 * LargeTrucks\nProfitExtraLarge = 125000 * ExtraLargeTrucks\nOperationalCost = 50000 * Drivers\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 30)\nmodel.addCons(Drivers >= SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons.\nFor V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons.\nFor V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons.\nFor V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons.\nFor V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons.\nThe company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance).\n// Cargo_V1 = 10 * V1\n// Cargo_V2 = 15 * V2\n// Cargo_V3 = 20 * V3\n// Cargo_V4 = 25 * V4\n// Cargo_V5 = 30 * V5\n// Maintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n// So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for maintenance costs.\n// 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000",
        "question": "A logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity. The company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance). The details for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost per Quarter ($) | Cargo Capacity (tons) |\n|--------------|-----------------------|----------------------------------|-----------------------|\n| V1           | 10                    | 500                              | 10                   |\n| V2           | 15                    | 600                              | 15                   |\n| V3           | 20                    | 700                              | 20                   |\n| V4           | 25                    | 800                              | 25                   |\n| V5           | 30                    | 900                              | 30                   |\n\nThe company has a budget of $50,000 for maintenance costs. Please help the company determine the optimal number of each type of vehicle to deploy to maximize the operational efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of V5 vehicles\n\n# Define objective function\nCargo_V1 = 10 * V1\nCargo_V2 = 15 * V2\nCargo_V3 = 20 * V3\nCargo_V4 = 25 * V4\nCargo_V5 = 30 * V5\nMaintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n# So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Maintenance_Cost == Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5)\n\n# Add constraints\n# The company has a budget of $50,000 for maintenance costs.\nmodel.addCons(500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and thus the operational costs of each truck.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades. The initial fuel consumption rate for Truck1 is 5 liters per trip, but with upgrades, it decreases by 0.5 liters per trip for every $100 invested. The initial fuel consumption rate for Truck2 is 6 liters per trip, and it decreases by 0.6 liters per trip for every $100 invested. The initial fuel consumption rate for Truck3 is 7 liters per trip, and it decreases by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all trucks.\n// Fuel consumption for Truck1: Consumption1 = (5 - 0.005 * Upgrade1) * Trips1\n// Fuel consumption for Truck2: Consumption2 = (6 - 0.006 * Upgrade2) * Trips2\n// Fuel consumption for Truck3: Consumption3 = (7 - 0.007 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1.\n// 1 * (5 * Trips1 + 6 * Trips2 + 7 * Trips3) + Upgrade1 + Upgrade2 + Upgrade3 <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 500 trips.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, Truck1 must make at least 50 trips and Truck2 must make at least 75 trips.\n// Trips1 >= 50; Trips2 >= 75",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its three trucks: Truck1, Truck2, and Truck3. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and thus the operational costs of each truck. The fuel efficiency of each truck improves with the investment in upgrades. The initial fuel consumption rate for Truck1 is 5 liters per trip, but with upgrades, it decreases by 0.5 liters per trip for every $100 invested. The initial fuel consumption rate for Truck2 is 6 liters per trip, and it decreases by 0.6 liters per trip for every $100 invested. The initial fuel consumption rate for Truck3 is 7 liters per trip, and it decreases by 0.7 liters per trip for every $100 invested. The company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1. The total number of trips across all trucks must not exceed 500 trips. Due to contractual obligations, Truck1 must make at least 50 trips and Truck2 must make at least 75 trips. The company aims to minimize the total fuel consumption across all trucks.\n\nPlease help the company determine the optimal number of trips for each truck and the amount to invest in fuel-efficient upgrades to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)    # number of trips for Truck3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck3\n\n# Define objective function\nConsumption1 = (5 - 0.005 * Upgrade1) * Trips1\nConsumption2 = (6 - 0.006 * Upgrade2) * Trips2\nConsumption3 = (7 - 0.007 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\n# The company has a total budget of $20,000 for fuel and upgrades. The cost of fuel per liter is $1.\nmodel.addCons(1 * (5 * Trips1 + 6 * Trips2 + 7 * Trips3) + Upgrade1 + Upgrade2 + Upgrade3 <= 20000)\n# The total number of trips across all trucks must not exceed 500 trips.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrade for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrade for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrade for Truck3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1361,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: TruckA, TruckB, TruckC, and TruckD. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the number of drivers to hire, which affects the operational costs and efficiency.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profitability of each truck type is influenced by its fuel efficiency, maintenance costs, and cargo capacity. TruckA has a profit per trip of $1000, TruckB $1500, TruckC $2000, and TruckD $2500. The operational cost per driver is $500 per month. The company aims to maximize the total monthly profit from all trucks minus the cost of drivers.\n// Total profit from TruckA: ProfitA = 1000 * TruckA\n// Total profit from TruckB: ProfitB = 1500 * TruckB\n// Total profit from TruckC: ProfitC = 2000 * TruckC\n// Total profit from TruckD: ProfitD = 2500 * TruckD\n// Total cost of drivers: DriverCost = 500 * Drivers\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks. The cost of TruckA is $20,000, TruckB is $30,000, TruckC is $40,000, and TruckD is $50,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC + 50000 * TruckD <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 5 due to limited parking space.\n// TruckA + TruckB + TruckC + TruckD <= 5\n\n## Generate Constraint-3:\nThe number of drivers must be at least equal to the total number of trucks to ensure full operational capacity.\n// Drivers >= TruckA + TruckB + TruckC + TruckD\n\n## Generate Constraint-4:\nDue to safety regulations, the total cargo capacity of all trucks must not exceed 100 tons. TruckA has a capacity of 10 tons, TruckB 15 tons, TruckC 20 tons, and TruckD 25 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD <= 100",
        "question": "A logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: TruckA, TruckB, TruckC, and TruckD. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. Additionally, the company needs to decide on the number of drivers to hire, which affects the operational costs and efficiency.\n\nThe profitability of each truck type is influenced by its fuel efficiency, maintenance costs, and cargo capacity. TruckA has a profit per trip of $1000, TruckB $1500, TruckC $2000, and TruckD $2500. The operational cost per driver is $500 per month. The company aims to maximize the total monthly profit from all trucks minus the cost of drivers.\n\nThe company has a budget of $100,000 for purchasing new trucks. The cost of TruckA is $20,000, TruckB is $30,000, TruckC is $40,000, and TruckD is $50,000. The total number of trucks cannot exceed 5 due to limited parking space. The number of drivers must be at least equal to the total number of trucks to ensure full operational capacity. Due to safety regulations, the total cargo capacity of all trucks must not exceed 100 tons. TruckA has a capacity of 10 tons, TruckB 15 tons, TruckC 20 tons, and TruckD 25 tons.\n\nPlease help the company to maximize the total monthly profit from all trucks minus the cost of drivers.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0) # number of drivers\n\n# Define objective function\nProfitA = 1000 * TruckA\nProfitB = 1500 * TruckB\nProfitC = 2000 * TruckC\nProfitD = 2500 * TruckD\nDriverCost = 500 * Drivers\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - DriverCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC + 50000 * TruckD <= 100000)\n# The total number of trucks cannot exceed 5 due to limited parking space.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 5)\n# The number of drivers must be at least equal to the total number of trucks to ensure full operational capacity.\nmodel.addCons(Drivers >= TruckA + TruckB + TruckC + TruckD)\n# Due to safety regulations, the total cargo capacity of all trucks must not exceed 100 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Monthly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price for ProductA is $50 per unit, with a production cost of $30 per unit. For ProductB, the selling price is $70 per unit, with a production cost of $40 per unit. For ProductC, the selling price is $90 per unit, with a production cost of $50 per unit. The company wants to maximize the total profit from selling all products.\n// Total profit for ProductA: Profit_ProductA = (50 - 30) * ProductAQty\n// Total profit for ProductB: Profit_ProductB = (70 - 40) * ProductBQty\n// Total profit for ProductC: Profit_ProductC = (90 - 50) * ProductCQty\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited budget for production costs, which is $15,000.\n// 30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total production quantity must not exceed 500 units.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-3:\nThe demand for ProductA is at least 100 units, and the demand for ProductC is at least 50 units.\n// ProductAQty >= 100; ProductCQty >= 50\n\n## Generate Constraint-4:\nThe production of ProductB is dependent on the production of ProductA, with a ratio of 2:1.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-5:\nThe company aims to produce at least 200 units in total.\n// ProductAQty + ProductBQty + ProductCQty >= 200",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit. The selling price for ProductA is $50 per unit, with a production cost of $30 per unit. For ProductB, the selling price is $70 per unit, with a production cost of $40 per unit. For ProductC, the selling price is $90 per unit, with a production cost of $50 per unit. The company has a limited budget for production costs, which is $15,000. Due to storage limitations, the total production quantity must not exceed 500 units. The demand for ProductA is at least 100 units, and the demand for ProductC is at least 50 units. The production of ProductB is dependent on the production of ProductA, with a ratio of 2:1. The company aims to produce at least 200 units in total.\n\nPlease help the company to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=100) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=50) # production quantity for ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 30) * ProductAQty\nProfit_ProductB = (70 - 40) * ProductBQty\nProfit_ProductC = (90 - 50) * ProductCQty\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(30 * ProductAQty + 40 * ProductBQty + 50 * ProductCQty <= 15000) # limited budget for production costs\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500) # storage limitations\nmodel.addCons(ProductBQty <= 2 * ProductAQty) # production ratio of ProductB to ProductA\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty >= 200) # total production goal\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Type1 trucks\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Type1 trucks\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type2 trucks\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type3 trucks\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n// Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n// Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n// Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 500.\n// Truck1 + Truck2 + Truck3 <= 500",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n\n| Truck Type | Fuel Cost per Mile | Fuel Efficiency Improvement per $1000 |\n|------------|--------------------|--------------------------------------|\n| Type1      | $0.8               | 1.5%                                 |\n| Type2      | $0.7               | 2%                                   |\n| Type3      | $0.6               | 1%                                   |\n\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks in the fleet must not exceed 500.\n\nPlease help the company to determine the optimal number of each type of truck to purchase and the investment in fuel efficiency to minimize the total fuel cost for the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Type1 trucks\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Type2 trucks\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Type3 trucks\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # investment in fuel efficiency for Type1 trucks\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # investment in fuel efficiency for Type2 trucks\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0) # investment in fuel efficiency for Type3 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n## Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n## Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n## convert the division to multiplication\nCost1 = 0.8 * (1 - 0.015 * Efficiency1 / 1000) * Truck1\nCost2 = 0.7 * (1 - 0.02 * Efficiency2 / 1000) * Truck2\nCost3 = 0.6 * (1 - 0.01 * Efficiency3 / 1000) * Truck3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000)\n## The total number of trucks in the fleet must not exceed 500.\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(Truck1))\n    print(\"Number of Type2 Trucks: \", model.getVal(Truck2))\n    print(\"Number of Type3 Trucks: \", model.getVal(Truck3))\n    print(\"Investment in Fuel Efficiency for Type1 Trucks: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Type2 Trucks: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Type3 Trucks: \", model.getVal(Efficiency3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1296,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software for Small trucks\": \"SoftwareSmall\", \"range\": \"SoftwareSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Medium trucks\": \"SoftwareMedium\", \"range\": \"SoftwareMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Large trucks\": \"SoftwareLarge\", \"range\": \"SoftwareLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\n// Total operational cost for Medium trucks: CostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\n// Total operational cost for Large trucks: CostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software.\n// 1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000",
        "question": "A logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck. The operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet. The company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software. Please help the company determine the optimal number of each type of truck and the investment in fleet management software to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSoftwareSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareSmall\", lb=0)\nSoftwareMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareMedium\", lb=0)\nSoftwareLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareLarge\", lb=0)\n\n# Define objective function\nCostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\nCostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\nCostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Software for Small Trucks: \", model.getVal(SoftwareSmall))\n    print(\"Investment in Software for Medium Trucks: \", model.getVal(SoftwareMedium))\n    print(\"Investment in Software for Large Trucks: \", model.getVal(SoftwareLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\n// Total emissions: Emissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\n// Total load capacity: Load = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Emissions / Load\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\n// 0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000",
        "question": "A logistics company is planning its routes for five different types of trucks (T1, T2, T3, T4, T5) to optimize fuel efficiency and minimize environmental impact. Each truck has a different fuel consumption rate and can carry a different load.\nFor T1, the fuel consumption rate is 0.5 liters per kilometer, the load capacity is 10 tons, and the emission rate is 1.2 kg CO2 per kilometer.\nFor T2, the fuel consumption rate is 0.6 liters per kilometer, the load capacity is 15 tons, and the emission rate is 1.4 kg CO2 per kilometer.\nFor T3, the fuel consumption rate is 0.7 liters per kilometer, the load capacity is 20 tons, and the emission rate is 1.6 kg CO2 per kilometer.\nFor T4, the fuel consumption rate is 0.8 liters per kilometer, the load capacity is 25 tons, and the emission rate is 1.8 kg CO2 per kilometer.\nFor T5, the fuel consumption rate is 0.9 liters per kilometer, the load capacity is 30 tons, and the emission rate is 2.0 kg CO2 per kilometer.\nThe company wants to minimize the Environmental Impact Index (EII), which is defined as the total emissions divided by the total load capacity.\nThe company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nPlease help the company determine the optimal number of each type of truck to deploy to minimize the Environmental Impact Index while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEmissions = 1.2 * T1 + 1.4 * T2 + 1.6 * T3 + 1.8 * T4 + 2.0 * T5\nLoad = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Emissions / Load\n## convert the division to multiplication\nmodel.addCons(obj * Load == Emissions)\n\n# Add constraints\n## The company has a total budget of $50,000 for fuel costs, and the fuel price is $1.5 per liter.\nmodel.addCons(0.5 * 1.5 * T1 + 0.6 * 1.5 * T2 + 0.7 * 1.5 * T3 + 0.8 * 1.5 * T4 + 0.9 * 1.5 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Environmental Impact Index: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1363,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wearables\": \"Wearables\", \"range\": \"Wearables >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company wants to maximize the total profit from selling these devices.\n// Profit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\n// Profit_Tablets = (150 - 0.05 * Tablets) * Tablets\n// Profit_Laptops = (200 - 0.08 * Laptops) * Laptops\n// Profit_Wearables = (50 - 0.03 * Wearables) * Wearables\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n// 5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000",
        "question": "A manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints. The profit per unit of each device decreases as more units are produced, as shown in the following Table.\n\n| Device       | Profit per Unit | Decrease in Profit per Additional Unit |\n|--------------|-----------------|----------------------------------------|\n| Smartphones  | $100            | $0.1 per Smartphone                    |\n| Tablets      | $150            | $0.05 per Tablet                      |\n| Laptops      | $200            | $0.08 per Laptop                      |\n| Wearables    | $50             | $0.03 per Wearable                    |\n\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n\nPlease help the company to maximize the total profit from selling these devices, considering the constraint on the critical component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nWearables = model.addVar(vtype=\"INTEGER\", name=\"Wearables\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.05 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.08 * Laptops) * Laptops\nProfit_Wearables = (50 - 0.03 * Wearables) * Wearables\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\nmodel.addCons(5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Wearables: \", model.getVal(Wearables))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to optimize its operations. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each mode of transportation, which affects the fuel consumption and operational costs.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for trains\": \"TrainTech\", \"range\": \"TrainTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for ships\": \"ShipTech\", \"range\": \"ShipTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each mode of transportation improves with the investment in fuel-efficient technologies. The fuel cost per trip decreases by a factor of the investment. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost per truck trip: FuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\n// Fuel cost per train trip: FuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\n// Fuel cost per ship trip: FuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for transportation and technology investments.\n// 100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes of transportation must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500\n\n## Generate Constraint-3:\nDue to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50.\n// TruckTrips >= 100; TrainTrips >= 50",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the investment in fuel-efficient technologies for each mode to optimize its operations. The fuel efficiency of each mode improves with the investment in fuel-efficient technologies, reducing the fuel cost per trip. The company aims to minimize the total fuel cost of all trips. The company has a total budget of $100,000 for transportation and technology investments. The total number of trips across all modes must not exceed 500 trips. Due to operational constraints, the number of truck trips must be at least 100, and the number of train trips must be at least 50. Please help the company to determine the optimal number of trips and investments to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=100)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=50)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)  # investment in fuel-efficient technology for trucks\nTrainTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TrainTech\", lb=0)  # investment in fuel-efficient technology for trains\nShipTech = model.addVar(vtype=\"CONTINUOUS\", name=\"ShipTech\", lb=0)  # investment in fuel-efficient technology for ships\n\n# Define objective function\nFuelCostTruck = (100 - 0.1 * TruckTech) * TruckTrips\nFuelCostTrain = (80 - 0.08 * TrainTech) * TrainTrips\nFuelCostShip = (120 - 0.12 * ShipTech) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostTrain + FuelCostShip)\n\n# Add constraints\nmodel.addCons(100 * TruckTrips + 80 * TrainTrips + 120 * ShipTrips + TruckTech + TrainTech + ShipTech <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Train Tech: \", model.getVal(TrainTech))\n    print(\"Investment in Ship Tech: \", model.getVal(ShipTech))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the production quantity of each component to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of component 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function is nonlinear and is given by:\nProfit_i = (a_i * C_i - b_i * C_i^2) - c_i * C_i, where a_i, b_i, and c_i are constants representing the market price, market saturation, and cost per unit, respectively.\n// The objective function is: Maximize P = (a1 * C1 - b1 * C1^2) - c1 * C1 + (a2 * C2 - b2 * C2^2) - c2 * C2 + (a3 * C3 - b3 * C3^2) - c3 * C3 + (a4 * C4 - b4 * C4^2) - c4 * C4 + (a5 * C5 - b5 * C5^2) - c5 * C5\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// C1 + C2 + C3 + C4 + C5 <= 1000\n\n## Generate Constraint-2:\nThe demand for each component is limited. Component 1 has a maximum demand of 200 units, Component 2 has a maximum demand of 150 units, Component 3 has a maximum demand of 300 units, Component 4 has a maximum demand of 250 units, and Component 5 has a maximum demand of 180 units.\n// C1 <= 200; C2 <= 150; C3 <= 300; C4 <= 250; C5 <= 180",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the production quantity of each component to maximize profit while considering the cost of raw materials and labor. The profit from each component depends on its production quantity and market demand, and is given by a nonlinear function: Profit_i = (a_i * C_i - b_i * C_i^2) - c_i * C_i, where a_i, b_i, and c_i are constants representing the market price, market saturation, and cost per unit, respectively. The total production capacity of the company is limited to 1000 units per day. Additionally, the demand for each component is limited: Component 1 has a maximum demand of 200 units, Component 2 has a maximum demand of 150 units, Component 3 has a maximum demand of 300 units, Component 4 has a maximum demand of 250 units, and Component 5 has a maximum demand of 180 units. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)  # production quantity of component 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=150)  # production quantity of component 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=300)  # production quantity of component 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0, ub=250)  # production quantity of component 4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0, ub=180)  # production quantity of component 5\n\n# Define objective function\n# Assuming constants a_i, b_i, c_i are given\na1, b1, c1 = 10, 0.01, 1  # example values\na2, b2, c2 = 12, 0.02, 2  # example values\na3, b3, c3 = 15, 0.03, 3  # example values\na4, b4, c4 = 18, 0.04, 4  # example values\na5, b5, c5 = 20, 0.05, 5  # example values\n\n# Calculate profit for each component\nProfit_C1 = (a1 * C1 - b1 * C1**2) - c1 * C1\nProfit_C2 = (a2 * C2 - b2 * C2**2) - c2 * C2\nProfit_C3 = (a3 * C3 - b3 * C3**2) - c3 * C3\nProfit_C4 = (a4 * C4 - b4 * C4**2) - c4 * C4\nProfit_C5 = (a5 * C5 - b5 * C5**2) - c5 * C5\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 1000)  # total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Component 1: \", model.getVal(C1))\n    print(\"Production Quantity of Component 2: \", model.getVal(C2))\n    print(\"Production Quantity of Component 3: \", model.getVal(C3))\n    print(\"Production Quantity of Component 4: \", model.getVal(C4))\n    print(\"Production Quantity of Component 5: \", model.getVal(C5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to determine the number of trucks to deploy for each route (Route1, Route2, Route3), the fuel efficiency of each truck (Efficiency1, Efficiency2, Efficiency3), and the maintenance cost per truck (Maintenance1, Maintenance2, Maintenance3). The fuel efficiency and maintenance costs are influenced by the investment in technology upgrades for each route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is a nonlinear function of the fuel efficiency and the number of trucks. The maintenance cost is also a nonlinear function of the investment in technology upgrades.\n// Fuel cost for Route1: FuelCost1 = (1/Efficiency1) * Trucks1\n// Fuel cost for Route2: FuelCost2 = (1/Efficiency2) * Trucks2\n// Fuel cost for Route3: FuelCost3 = (1/Efficiency3) * Trucks3\n// Maintenance cost for Route1: MaintenanceCost1 = Maintenance1 * Trucks1\n// Maintenance cost for Route2: MaintenanceCost2 = Maintenance2 * Trucks2\n// Maintenance cost for Route3: MaintenanceCost3 = Maintenance3 * Trucks3\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + MaintenanceCost1 + MaintenanceCost2 + MaintenanceCost3)\n\n## Generate Constraint-1:\nThe total budget for technology upgrades and operational costs is $100,000.\n// (1/Efficiency1) * Trucks1 + (1/Efficiency2) * Trucks2 + (1/Efficiency3) * Trucks3 + Maintenance1 * Trucks1 + Maintenance2 * Trucks2 + Maintenance3 * Trucks3 <= 100000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available for deployment across all routes.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 10 trucks must be deployed on Route1 and 15 trucks on Route2.\n// Trucks1 >= 10; Trucks2 >= 15",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to determine the number of trucks to deploy for each route (Route1, Route2, Route3), the fuel efficiency of each truck (Efficiency1, Efficiency2, Efficiency3), and the maintenance cost per truck (Maintenance1, Maintenance2, Maintenance3). The fuel efficiency and maintenance costs are influenced by the investment in technology upgrades for each route.\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is a nonlinear function of the fuel efficiency and the number of trucks. The maintenance cost is also a nonlinear function of the investment in technology upgrades.\nThe total budget for technology upgrades and operational costs is $100,000. The company has a maximum of 50 trucks available for deployment across all routes. Due to contractual obligations, at least 10 trucks must be deployed on Route1 and 15 trucks on Route2.\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # fuel efficiency for Route3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance cost for Route1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance cost for Route2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance cost for Route3\n\n# Define objective function\nFuelCost1 = (1/Efficiency1) * Trucks1\nFuelCost2 = (1/Efficiency2) * Trucks2\nFuelCost3 = (1/Efficiency3) * Trucks3\nMaintenanceCost1 = Maintenance1 * Trucks1\nMaintenanceCost2 = Maintenance2 * Trucks2\nMaintenanceCost3 = Maintenance3 * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + MaintenanceCost1 + MaintenanceCost2 + MaintenanceCost3)\n\n# Add constraints\nmodel.addCons((1/Efficiency1) * Trucks1 + (1/Efficiency2) * Trucks2 + (1/Efficiency3) * Trucks3 + Maintenance1 * Trucks1 + Maintenance2 * Trucks2 + Maintenance3 * Trucks3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maintenance Cost for Route1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Cost for Route2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Cost for Route3: \", model.getVal(Maintenance3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for production efficiency upgrades.\n// EfficiencyInvestment <= 1000000\n\n## Generate Constraint-2:\nThe total number of units produced cannot exceed 10,000.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1,000 units of ProductA and 1,500 units of ProductB.\n// UnitsA >= 1000; UnitsB >= 1500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally. The initial production cost and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| ProductA | $100                    | $200          |\n| ProductB | $150                    | $250          |\n| ProductC | $200                    | $300          |\n\nThe production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The company has a total budget of $1,000,000 for production efficiency upgrades. The total number of units produced cannot exceed 10,000. Due to market demand, the company must produce at least 1,000 units of ProductA and 1,500 units of ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1000) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1500) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in production efficiency\n\n# Define objective function\nProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\nProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\nProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 1000000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000\n\n## Generate Constraint-2:\nThe maintenance budget for the year is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones <= 500,000\n\n## Generate Constraint-3:\nThe company needs to ensure a minimum total capacity of 50,000 units.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50,000\n\n## Generate Constraint-4:\nThe company wants to have at least 5 different types of vehicles.\n// Trucks >= 1; Vans >= 1; Bikes >= 1; Scooters >= 1; Drones >= 1",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities. The operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000. The operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000. The operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000. The operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500. The operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000. The company has a budget of $2,000,000 for purchasing vehicles and a maintenance budget of $500,000 for the year. The company needs to ensure a minimum total capacity of 50,000 units and wants to have at least 5 different types of vehicles. The company wants to minimize the total operational and maintenance costs while maximizing the total capacity. Please help the company to minimize the total operational and maintenance costs divided by the total capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=1)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=1)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=1)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=1)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=1)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n## The maintenance budget for the year is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones <= 500000)\n## The company needs to ensure a minimum total capacity of 50,000 units.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per trip, and the revenue generated per trip is $1000.\nFor GoodB, the cost is $600 per trip, and the revenue is $1200.\nFor GoodC, the cost is $700 per trip, and the revenue is $1400.\nFor GoodD, the cost is $800 per trip, and the revenue is $1600.\nFor GoodE, the cost is $900 per trip, and the revenue is $1800.\nThe company wants to maximize the total profit per day.\n// Profit_GoodA = (1000 - 500) * TrucksA\n// Profit_GoodB = (1200 - 600) * TrucksB\n// Profit_GoodC = (1400 - 700) * TrucksC\n// Profit_GoodD = (1600 - 800) * TrucksD\n// Profit_GoodE = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks allocated to each type of good to optimize their distribution network. The cost of operating a truck and the revenue generated per trip for each type of good are given in the following Table.\n\n| Good    | Cost per Trip | Revenue per Trip |\n|---------|---------------|------------------|\n| GoodA   | $500          | $1000            |\n| GoodB   | $600          | $1200            |\n| GoodC   | $700          | $1400            |\n| GoodD   | $800          | $1600            |\n| GoodE   | $900          | $1800            |\n\nThe company has a total of 50 trucks available for distribution. The company wants to maximize the total profit per day. Please help the company determine the optimal allocation of trucks to each type of good.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nProfit_GoodA = (1000 - 500) * TrucksA\nProfit_GoodB = (1200 - 600) * TrucksB\nProfit_GoodC = (1400 - 700) * TrucksC\nProfit_GoodD = (1600 - 800) * TrucksD\nProfit_GoodE = (1800 - 900) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_GoodA + Profit_GoodB + Profit_GoodC + Profit_GoodD + Profit_GoodE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for TypeA\": \"TurbinesA\", \"range\": \"TurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeB\": \"TurbinesB\", \"range\": \"TurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeC\": \"TurbinesC\", \"range\": \"TurbinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TypeA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms.\n// EnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\n// EnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\n// EnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n// So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for turbine installation and maintenance investments.\n// 10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000\n\n## Generate Constraint-2:\nThe total number of turbines that can be installed is limited to 100.\n// TurbinesA + TurbinesB + TurbinesC <= 100",
        "question": "A renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms. The company has a total budget of $100,000 for turbine installation and maintenance investments. The total number of turbines that can be installed is limited to 100. Please help the company to determine the optimal number of turbines and maintenance investments for each type of wind farm.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"TurbinesA\", lb=0)  # number of turbines for TypeA\nTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"TurbinesB\", lb=0)  # number of turbines for TypeB\nTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"TurbinesC\", lb=0)  # number of turbines for TypeC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance investment for TypeA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance investment for TypeB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance investment for TypeC\n\n# Define objective function\nEnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\nEnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\nEnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n# So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n# Add constraints\n# The company has a total budget of $100,000 for turbine installation and maintenance investments.\nmodel.addCons(10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000)\n# The total number of turbines that can be installed is limited to 100.\nmodel.addCons(TurbinesA + TurbinesB + TurbinesC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for TypeA: \", model.getVal(TurbinesA))\n    print(\"Number of Turbines for TypeB: \", model.getVal(TurbinesB))\n    print(\"Number of Turbines for TypeC: \", model.getVal(TurbinesC))\n    print(\"Maintenance Investment for TypeA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TypeB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TypeC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type, which will affect the fuel consumption and operational costs.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Truck1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel_Consumption_Truck1 = (Initial_Consumption - 0.0001 * Tech1) * Distance_Per_Trip * Trips1\n// Fuel_Consumption_Truck2 = (Initial_Consumption - 0.0002 * Tech2) * Distance_Per_Trip * Trips2\n// Fuel_Consumption_Truck3 = (Initial_Consumption - 0.0003 * Tech3) * Distance_Per_Trip * Trips3\n// So, the objective function is: Minimize (Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck1 can make at most 150 trips, Truck2 can make at most 200 trips, and Truck3 can make at most 250 trips.\n// Trips1 <= 150; Trips2 <= 200; Trips3 <= 250\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 trips are made by Truck1 and at least 120 trips are made by Truck2 to meet contractual obligations.\n// Trips1 >= 100; Trips2 >= 120",
        "question": "A logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make and the investment in fuel-efficient technologies for each vehicle type to optimize its operations. The fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles. The company has a budget of $100,000 for investments in fuel-efficient technologies. The total number of trips across all vehicles must not exceed 500. Due to maintenance schedules, Truck1 can make at most 150 trips, Truck2 can make at most 200 trips, and Truck3 can make at most 250 trips. The company must ensure that at least 100 trips are made by Truck1 and at least 120 trips are made by Truck2 to meet contractual obligations. Please help the company determine the optimal number of trips for each vehicle and the appropriate investment in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=120) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Truck1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Truck2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Truck3\n\n# Define objective function\nFuel_Consumption_Truck1 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0001 * Tech1) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips1\nFuel_Consumption_Truck2 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0002 * Tech2) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips2\nFuel_Consumption_Truck3 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0003 * Tech3) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 <= 100000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\nmodel.addCons(Trips1 <= 150)\nmodel.addCons(Trips2 <= 200)\nmodel.addCons(Trips3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Tech for Truck1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Truck2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Truck3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company has identified four major regions (North, South, East, West) and needs to determine the number of trucks to allocate to each region, as well as the fuel efficiency of each truck type.\n// {\"number of trucks for North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for North region (km/liter)\": \"NorthEfficiency\", \"range\": \"NorthEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for South region (km/liter)\": \"SouthEfficiency\", \"range\": \"SouthEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for East region (km/liter)\": \"EastEfficiency\", \"range\": \"EastEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for West region (km/liter)\": \"WestEfficiency\", \"range\": \"WestEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day. The cost of fuel is $1 per liter, and each truck travels an average of 500 km per day.\n// FuelCost_North = 500 * NorthTrucks / NorthEfficiency\n// FuelCost_South = 500 * SouthTrucks / SouthEfficiency\n// FuelCost_East = 500 * EastTrucks / EastEfficiency\n// FuelCost_West = 500 * WestTrucks / WestEfficiency\n// So, the objective function is: Minimize (FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50",
        "question": "A logistics company is planning its routes for delivering goods to four major regions: North, South, East, and West. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company aims to minimize the total fuel cost per day, with the cost of fuel being $1 per liter and each truck traveling an average of 500 km per day. The following table summarizes the variables and their constraints:\n\n| Variable                          | Description                                      | Constraints                |\n|------------------------------------|--------------------------------------------------|----------------------------|\n| NorthTrucks                       | Number of trucks for North region                | NorthTrucks >= 0, integer  |\n| SouthTrucks                       | Number of trucks for South region                | SouthTrucks >= 0, integer  |\n| EastTrucks                        | Number of trucks for East region                 | EastTrucks >= 0, integer   |\n| WestTrucks                        | Number of trucks for West region                 | WestTrucks >= 0, integer   |\n| NorthEfficiency                   | Fuel efficiency of trucks for North region (km/liter) | NorthEfficiency > 0, real |\n| SouthEfficiency                   | Fuel efficiency of trucks for South region (km/liter) | SouthEfficiency > 0, real |\n| EastEfficiency                    | Fuel efficiency of trucks for East region (km/liter) | EastEfficiency > 0, real  |\n| WestEfficiency                    | Fuel efficiency of trucks for West region (km/liter) | WestEfficiency > 0, real  |\n\nThe company has a total of 50 trucks available. Please help the company to minimize the total fuel cost per day, which is calculated as the sum of the fuel costs for each region, where the fuel cost for each region is 500 km per day divided by the fuel efficiency of the trucks in that region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)  # number of trucks for North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)  # number of trucks for South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)  # number of trucks for East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)  # number of trucks for West region\nNorthEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"NorthEfficiency\", lb=0)  # fuel efficiency of trucks for North region\nSouthEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SouthEfficiency\", lb=0)  # fuel efficiency of trucks for South region\nEastEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EastEfficiency\", lb=0)  # fuel efficiency of trucks for East region\nWestEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"WestEfficiency\", lb=0)  # fuel efficiency of trucks for West region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_North = 500 * NorthTrucks / NorthEfficiency\nFuelCost_South = 500 * SouthTrucks / SouthEfficiency\nFuelCost_East = 500 * EastTrucks / EastEfficiency\nFuelCost_West = 500 * WestTrucks / WestEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * (NorthEfficiency * SouthEfficiency * EastEfficiency * WestEfficiency) == FuelCost_North * NorthEfficiency * SouthEfficiency * EastEfficiency * WestEfficiency +\n              FuelCost_South * NorthEfficiency * SouthEfficiency * EastEfficiency * WestEfficiency +\n              FuelCost_East * NorthEfficiency * SouthEfficiency * EastEfficiency * WestEfficiency +\n              FuelCost_West * NorthEfficiency * SouthEfficiency * EastEfficiency * WestEfficiency)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West Region: \", model.getVal(WestTrucks))\n    print(\"Fuel Efficiency for North Region: \", model.getVal(NorthEfficiency))\n    print(\"Fuel Efficiency for South Region: \", model.getVal(SouthEfficiency))\n    print(\"Fuel Efficiency for East Region: \", model.getVal(EastEfficiency))\n    print(\"Fuel Efficiency for West Region: \", model.getVal(WestEfficiency))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1952,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-2:\nThe total fuel budget per day is $5000.\n// 0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000\n\n## Generate Constraint-3:\nThe total maintenance budget per day is $10000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000\n\n## Generate Constraint-4:\nEach truck type has a different capacity. Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck D does not exceed the combined number of Truck A and Truck B.\n// TruckD <= TruckA + TruckB",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route. Each truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs. The total number of trucks available is 100. The total fuel budget per day is $5000. The total maintenance budget per day is $10000. Each truck type has a different capacity. Truck A can carry 10 tons, Truck B can carry 15 tons, Truck C can carry 20 tons, and Truck D can carry 25 tons. The total cargo to be transported is 1500 tons. The company wants to ensure that the number of Truck D does not exceed the combined number of Truck A and Truck B. Please help the company to maximize the total profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the fuel cost per kilometer\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100) # total number of trucks available is 100\nmodel.addCons(0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000) # total fuel budget per day is $5000\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC + 250 * TruckD <= 10000) # total maintenance budget per day is $10000\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD >= 1500) # total cargo to be transported is 1500 tons\nmodel.addCons(TruckD <= TruckA + TruckB) # number of Truck D does not exceed the combined number of Truck A and Truck B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and maintenance costs. Additionally, the company needs to decide on the optimal speed for each truck to further reduce costs, as fuel consumption and maintenance costs are nonlinearly related to speed.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for trucks in Region 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs for each truck are nonlinearly related to the speed at which they operate. The cost function for each region is given by:\nCost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region.\nThe company aims to minimize the total cost across all regions.\n// Total cost for Region 1: Cost1 = Trucks1 * (a1 * (Speed1^2) + b1 * Speed1 + c1)\n// Total cost for Region 2: Cost2 = Trucks2 * (a2 * (Speed2^2) + b2 * Speed2 + c2)\n// Total cost for Region 3: Cost3 = Trucks3 * (a3 * (Speed3^2) + b3 * Speed3 + c3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the optimal speed for each truck to minimize fuel consumption and maintenance costs. The cost function for each region is given by: Cost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region. The company aims to minimize the total cost across all regions.\n\n| Region | Constants (a, b, c) |\n|--------|----------------------|\n| 1      | a1, b1, c1          |\n| 2      | a2, b2, c2          |\n| 3      | a3, b3, c3          |\n\nThe total number of trucks available in the fleet is limited to 100. The company needs to decide on the optimal number of trucks for each region (Trucks1, Trucks2, Trucks3) and the optimal speed for each region (Speed1, Speed2, Speed3), ensuring that the speed for each region is between 0 and 100.\n\nPlease help the company to minimize the total cost across all regions, given the constraints on the number of trucks and the speed ranges.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # optimal speed for trucks in Region 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # optimal speed for trucks in Region 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # optimal speed for trucks in Region 3\n\n# Define objective function\n# Constants for the cost function\na1, b1, c1 = 0.01, 0.5, 10  # example values for Region 1\na2, b2, c2 = 0.02, 0.6, 12  # example values for Region 2\na3, b3, c3 = 0.03, 0.7, 14  # example values for Region 3\n\n# Calculate costs for each region\nCost1 = Trucks1 * (a1 * Speed1**2 + b1 * Speed1 + c1)\nCost2 = Trucks2 * (a2 * Speed2**2 + b2 * Speed2 + c2)\nCost3 = Trucks3 * (a3 * Speed3**2 + b3 * Speed3 + c3)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The total number of trucks available in the fleet is limited to 100\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Optimal Speed for Region 1: \", model.getVal(Speed1))\n    print(\"Optimal Speed for Region 2: \", model.getVal(Speed2))\n    print(\"Optimal Speed for Region 3: \", model.getVal(Speed3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA cannot exceed 200 units.\n// UnitsA <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of each device decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit of DeviceA decreases by $0.1 for each unit produced beyond the first 100 units, the profit per unit of DeviceB decreases by $0.05 for each unit produced beyond the first 200 units, and the profit per unit of DeviceC decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n\n| Device | Profit per Unit (beyond threshold) | Threshold |\n|--------|------------------------------------|-----------|\n| DeviceA | $50 - $0.1 * (UnitsA - 100)        | 100 units |\n| DeviceB | $70 - $0.05 * (UnitsB - 200)       | 200 units |\n| DeviceC | $90 - $0.02 * (UnitsC - 300)       | 300 units |\n\nThe company has a production capacity of 500 units in total. Due to raw material availability, the production of DeviceA cannot exceed 200 units. Please help the company determine the optimal number of units to produce for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0, ub=200) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (90 - 0.02 * C2) * C2 * C_b2 + 90 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of vehicles of each type to deploy for the next quarter. Additionally, the company needs to decide on the level of maintenance ($) for each vehicle type to optimize fuel efficiency and reduce operational costs.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"maintenance cost for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with increased maintenance. For every $100 spent on maintenance for TruckA, the fuel efficiency increases by 1.5 liters per 100 kilometers. For TruckB, the increase is 1.2 liters per 100 kilometers for every $100 spent, and for TruckC, it's 1.8 liters per 100 kilometers. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (InitialFuelConsumptionA - 0.015 * MaintenanceA) * TruckA\n// Fuel consumption for TruckB: ConsumptionB = (InitialFuelConsumptionB - 0.012 * MaintenanceB) * TruckB\n// Fuel consumption for TruckC: ConsumptionC = (InitialFuelConsumptionC - 0.018 * MaintenanceC) * TruckC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for vehicle deployment and maintenance.\n// TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC <= 20000\n\n## Generate Constraint-2:\nThe total number of vehicles that can be deployed is limited to 200.\n// TruckA + TruckB + TruckC <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB.\n// TruckA >= 50; TruckB >= 70",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of vehicles of each type to deploy for the next quarter and the level of maintenance ($) for each vehicle type to optimize fuel efficiency and reduce operational costs. The fuel efficiency of each vehicle type improves with increased maintenance. For every $100 spent on maintenance for TruckA, the fuel efficiency increases by 1.5 liters per 100 kilometers. For TruckB, the increase is 1.2 liters per 100 kilometers for every $100 spent, and for TruckC, it's 1.8 liters per 100 kilometers. The company aims to minimize the total fuel consumption across all vehicles. The company has a budget of $20,000 for vehicle deployment and maintenance. The total number of vehicles that can be deployed is limited to 200. Due to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB. Please help the company to minimize the total fuel consumption across all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # maintenance cost for TruckA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # maintenance cost for TruckB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # maintenance cost for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel consumption for TruckA: ConsumptionA = (InitialFuelConsumptionA - 0.015 * MaintenanceA) * TruckA\n## Fuel consumption for TruckB: ConsumptionB = (InitialFuelConsumptionB - 0.012 * MaintenanceB) * TruckB\n## Fuel consumption for TruckC: ConsumptionC = (InitialFuelConsumptionC - 0.018 * MaintenanceC) * TruckC\n## So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\nConsumptionA = (1 - 0.015 * MaintenanceA) * TruckA\nConsumptionB = (1 - 0.012 * MaintenanceB) * TruckB\nConsumptionC = (1 - 0.018 * MaintenanceC) * TruckC\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n## The company has a budget of $20,000 for vehicle deployment and maintenance.\nmodel.addCons(TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC <= 20000)\n## The total number of vehicles that can be deployed is limited to 200.\nmodel.addCons(TruckA + TruckB + TruckC <= 200)\n## Due to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB.\nmodel.addCons(TruckA >= 50)\nmodel.addCons(TruckB >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Maintenance cost for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance cost for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance cost for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different profitability and operational costs. The profit per truck on route R1 is $1000, with an operational cost of $500 per truck. For route R2, the profit is $1200 with a cost of $600. For route R3, the profit is $1500 with a cost of $750. For route R4, the profit is $1800 with a cost of $900. For route R5, the profit is $2000 with a cost of $1000. The company aims to maximize the total net profit while considering the operational costs.\n// Net_Profit_R1 = (1000 - 500) * T1 = 500 * T1\n// Net_Profit_R2 = (1200 - 600) * T2 = 600 * T2\n// Net_Profit_R3 = (1500 - 750) * T3 = 750 * T3\n// Net_Profit_R4 = (1800 - 900) * T4 = 900 * T4\n// Net_Profit_R5 = (2000 - 1000) * T5 = 1000 * T5\n// So, the objective function is: Maximize (500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks.\n// T1 <= 20; T2 <= 15; T3 <= 25; T4 <= 10; T5 <= 30\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the total trucks are allocated to routes R1 and R2 combined to maintain a strong presence in the market.\n// T1 + T2 >= 0.3 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability. The profit per truck and operational cost for each route are given in the following Table.\n\n| Route | Profit per Truck | Operational Cost per Truck |\n|-------|------------------|----------------------------|\n| R1    | $1000            | $500                       |\n| R2    | $1200            | $600                       |\n| R3    | $1500            | $750                       |\n| R4    | $1800            | $900                       |\n| R5    | $2000            | $1000                      |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks. The company must ensure that at least 30% of the total trucks are allocated to routes R1 and R2 combined to maintain a strong presence in the market.\n\nPlease help the company to maximize the total net profit while considering the operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\nNet_Profit_R1 = 500 * T1\nNet_Profit_R2 = 600 * T2\nNet_Profit_R3 = 750 * T3\nNet_Profit_R4 = 900 * T4\nNet_Profit_R5 = 1000 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_R1 + Net_Profit_R2 + Net_Profit_R3 + Net_Profit_R4 + Net_Profit_R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 25)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 30)\nmodel.addCons(T1 + T2 >= 0.3 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency.\n// {\"number of small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day.\nThe medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day.\nThe large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 200 * Small + 300 * Medium + 400 * Large\n// Total fuel cost: FuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n// So, the objective function is: Minimize (VehicleCost + FuelCost)\n\n## Generate Constraint-1:\nThe total capacity of vehicles must meet or exceed the required delivery of 1000 units.\n// 50 * Small + 100 * Medium + 150 * Large >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 200 * Small + 300 * Medium + 400 * Large <= 10000\n\n## Generate Constraint-3:\nThe company can only rent a maximum of 20 vehicles in total.\n// Small + Medium + Large <= 20\n\n## Generate Constraint-4:\nThe company prefers to use at least 5 small vehicles if possible.\n// Small >= 5",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large. Each vehicle has a different capacity and fuel efficiency. The small vehicle has a capacity of 50 units, a fuel consumption rate of 10 liters per 100 km, and a cost of $200 per day. The medium vehicle has a capacity of 100 units, a fuel consumption rate of 15 liters per 100 km, and a cost of $300 per day. The large vehicle has a capacity of 150 units, a fuel consumption rate of 20 liters per 100 km, and a cost of $400 per day. The company needs to deliver at least 1000 units of goods over a distance of 500 km. The company has a budget of $10,000 for vehicle rental and can only rent a maximum of 20 vehicles in total. The company prefers to use at least 5 small vehicles if possible. Please help the company to minimize the total cost of vehicles and fuel.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of large vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nVehicleCost = 200 * Small + 300 * Medium + 400 * Large\nFuelCost = (10 * Small + 15 * Medium + 20 * Large) * 500 / 100\n## the objective function is: Minimize (VehicleCost + FuelCost)\nmodel.addCons(obj == VehicleCost + FuelCost)\n\n# Add constraints\n## The total capacity of vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(50 * Small + 100 * Medium + 150 * Large >= 1000)\n## The company has a budget of $10,000 for vehicle rental.\nmodel.addCons(200 * Small + 300 * Medium + 400 * Large <= 10000)\n## The company can only rent a maximum of 20 vehicles in total.\nmodel.addCons(Small + Medium + Large <= 20)\n## The company prefers to use at least 5 small vehicles if possible.\nmodel.addCons(Small >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(Small))\n    print(\"Number of Medium Vehicles: \", model.getVal(Medium))\n    print(\"Number of Large Vehicles: \", model.getVal(Large))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The variables include the number of trucks assigned to each route and the cost parameters for each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel cost per kilometer for Route A\": \"Fuel_Cost_A\", \"range\": \"Fuel_Cost_A >= 0\", \"type\": \"real\"}\n// {\"fuel cost per kilometer for Route B\": \"Fuel_Cost_B\", \"range\": \"Fuel_Cost_B >= 0\", \"type\": \"real\"}\n// {\"fuel cost per kilometer for Route C\": \"Fuel_Cost_C\", \"range\": \"Fuel_Cost_C >= 0\", \"type\": \"real\"}\n// {\"toll fee per trip for Route A\": \"Toll_Fee_A\", \"range\": \"Toll_Fee_A >= 0\", \"type\": \"real\"}\n// {\"toll fee per trip for Route B\": \"Toll_Fee_B\", \"range\": \"Toll_Fee_B >= 0\", \"type\": \"real\"}\n// {\"toll fee per trip for Route C\": \"Toll_Fee_C\", \"range\": \"Toll_Fee_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize the total profit from all routes, which is the revenue from transporting goods minus the total fuel costs and toll fees. The revenue per route is proportional to the number of trucks assigned.\n// Revenue_A = Revenue_Rate_A * Trucks_A\n// Revenue_B = Revenue_Rate_B * Trucks_B\n// Revenue_C = Revenue_Rate_C * Trucks_C\n// Fuel_Cost_A = Fuel_Cost_A * Distance_A * Trucks_A\n// Fuel_Cost_B = Fuel_Cost_B * Distance_B * Trucks_B\n// Fuel_Cost_C = Fuel_Cost_C * Distance_C * Trucks_C\n// Toll_Fee_A = Toll_Fee_A * Trucks_A\n// Toll_Fee_B = Toll_Fee_B * Trucks_B\n// Toll_Fee_C = Toll_Fee_C * Trucks_C\n// So, the objective function is: Maximize (Revenue_A - Fuel_Cost_A - Toll_Fee_A + Revenue_B - Fuel_Cost_B - Toll_Fee_B + Revenue_C - Fuel_Cost_C - Toll_Fee_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total fuel cost across all routes must not exceed $10,000 per day.\n// Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C <= 10000\n\n## Generate Constraint-3:\nThe total toll fees across all routes must not exceed $2,000 per day.\n// Toll_Fee_A + Toll_Fee_B + Toll_Fee_C <= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 10% of the total trucks are assigned to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C)\n\n## Generate Constraint-5:\nThe company must ensure that the number of trucks assigned to Route B does not exceed twice the number assigned to Route A.\n// Trucks_B <= 2 * Trucks_A",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, toll fees, and the number of trucks available. The variables include the number of trucks assigned to each route and the cost parameters for each route. The company aims to maximize the total profit from all routes, which is the revenue from transporting goods minus the total fuel costs and toll fees. The revenue per route is proportional to the number of trucks assigned. The company has a total of 50 trucks available. The total fuel cost across all routes must not exceed $10,000 per day. The total toll fees across all routes must not exceed $2,000 per day. The company must ensure that at least 10% of the total trucks are assigned to Route A. The company must also ensure that the number of trucks assigned to Route B does not exceed twice the number assigned to Route A.\n\nPlease help the company to determine the optimal number of trucks to assign to each route (Route A, Route B, and Route C) to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\n\n# Define objective function\nRevenue_Rate_A = 100  # Example revenue rate for Route A\nRevenue_Rate_B = 150  # Example revenue rate for Route B\nRevenue_Rate_C = 200  # Example revenue rate for Route C\nDistance_A = 500  # Example distance for Route A\nDistance_B = 600  # Example distance for Route B\nDistance_C = 700  # Example distance for Route C\nFuel_Cost_A = 0.5  # Example fuel cost per kilometer for Route A\nFuel_Cost_B = 0.6  # Example fuel cost per kilometer for Route B\nFuel_Cost_C = 0.7  # Example fuel cost per kilometer for Route C\nToll_Fee_A = 50  # Example toll fee per trip for Route A\nToll_Fee_B = 60  # Example toll fee per trip for Route B\nToll_Fee_C = 70  # Example toll fee per trip for Route C\n\nRevenue_A = Revenue_Rate_A * Trucks_A\nRevenue_B = Revenue_Rate_B * Trucks_B\nRevenue_C = Revenue_Rate_C * Trucks_C\nFuel_Cost_A = Fuel_Cost_A * Distance_A * Trucks_A\nFuel_Cost_B = Fuel_Cost_B * Distance_B * Trucks_B\nFuel_Cost_C = Fuel_Cost_C * Distance_C * Trucks_C\nToll_Fee_A = Toll_Fee_A * Trucks_A\nToll_Fee_B = Toll_Fee_B * Trucks_B\nToll_Fee_C = Toll_Fee_C * Trucks_C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Fuel_Cost_A - Toll_Fee_A + Revenue_B - Fuel_Cost_B - Toll_Fee_B + Revenue_C - Fuel_Cost_C - Toll_Fee_C)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)  # Total trucks constraint\nmodel.addCons(Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C <= 10000)  # Total fuel cost constraint\nmodel.addCons(Toll_Fee_A + Toll_Fee_B + Toll_Fee_C <= 2000)  # Total toll fees constraint\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C))  # Minimum trucks for Route A constraint\nmodel.addCons(Trucks_B <= 2 * Trucks_A)  # Trucks for Route B constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company wants to minimize the total operational cost per ton-kilometer.\n// Operational cost for TruckA: Cost_TruckA = (0.5 + 0.3) * TruckANum\n// Operational cost for TruckB: Cost_TruckB = (0.6 + 0.4) * TruckBNum\n// Operational cost for TruckC: Cost_TruckC = (0.7 + 0.5) * TruckCNum\n// Operational cost for TruckD: Cost_TruckD = (0.8 + 0.6) * TruckDNum\n// Operational cost for TruckE: Cost_TruckE = (0.9 + 0.7) * TruckENum\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// 10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50\n\n## Generate Constraint-3:\nThe total capacity of all trucks must exceed 1000 tons.\n// 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum >= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company has a total budget of $100,000 for purchasing trucks. The company has a total of 50 drivers available. The total capacity of all trucks must exceed 1000 tons.\nPlease help the company to minimize the total operational cost per ton-kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (0.5 + 0.3) * TruckANum\nCost_TruckB = (0.6 + 0.4) * TruckBNum\nCost_TruckC = (0.7 + 0.5) * TruckCNum\nCost_TruckD = (0.8 + 0.6) * TruckDNum\nCost_TruckE = (0.9 + 0.7) * TruckENum\nCapacity = 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000)\n## The company has a total of 50 drivers available.\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\n## The total capacity of all trucks must exceed 1000 tons.\nmodel.addCons(10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Minimized Operational Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1201,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000\n\n## Generate Constraint-2:\nThe production rate from each machine should not be less than 10 units per hour.\n// Pi >= 10 for i = 1, 2, 3, 4, 5, 6\n\n## Generate Constraint-3:\nThe voltage applied to each machine should not exceed 120 units.\n// Vi <= 120 for i = 1, 2, 3, 4, 5, 6",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The voltage applied to each machine affects both its energy consumption and production rate, as shown in the following Table.\n\n| Machine | Voltage (V) | Energy Consumption (Ei) | Production Rate (Pi) |\n|---------|-------------|-------------------------|----------------------|\n| 1       | V1          | V1^2                    | 100 * V1 - V1^2/10   |\n| 2       | V2          | V2^2                    | 100 * V2 - V2^2/10   |\n| 3       | V3          | V3^2                    | 100 * V3 - V3^2/10   |\n| 4       | V4          | V4^2                    | 100 * V4 - V4^2/10   |\n| 5       | V5          | V5^2                    | 100 * V5 - V5^2/10   |\n| 6       | V6          | V6^2                    | 100 * V6 - V6^2/10   |\n\nThe total energy consumption should not exceed 15000 units. The production rate from each machine should not be less than 10 units per hour. The voltage applied to each machine should not exceed 120 units. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n\nPlease help the plant manager to determine the optimal voltage settings for each machine to achieve these goals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120) # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120) # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120) # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120) # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120) # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120) # voltage for machine 6\n\n# Define objective function\n## Energy consumption for machine i: Ei = Vi^2\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\n## Production rate for machine i: Pi = 100 * Vi - Vi^2/10\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\n## Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n## The total energy consumption should not exceed 15000 units.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 + E6 <= 15000)\n## The production rate from each machine should not be less than 10 units per hour.\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\nmodel.addCons(P4 >= 10)\nmodel.addCons(P5 >= 10)\nmodel.addCons(P6 >= 10)\n## Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\nmodel.addCons(P1 + P2 + P3 + P4 + P5 + P6 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Minimized Total Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1388,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for ProductA\": \"RawMaterialACost\", \"range\": \"RawMaterialACost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductB\": \"RawMaterialBCost\", \"range\": \"RawMaterialBCost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductC\": \"RawMaterialCCost\", \"range\": \"RawMaterialCCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductA\": \"LaborACost\", \"range\": \"LaborACost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductB\": \"LaborBCost\", \"range\": \"LaborBCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductC\": \"LaborCCost\", \"range\": \"LaborCCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductA\": \"StorageACost\", \"range\": \"StorageACost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductB\": \"StorageBCost\", \"range\": \"StorageBCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductC\": \"StorageCCost\", \"range\": \"StorageCCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60.\n// Total profit for ProductA: Profit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\n// Total profit for ProductB: Profit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\n// Total profit for ProductC: Profit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for raw materials.\n// RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The costs of labor and storage per unit for each product are also considered in the profit calculation.\n\n| Product | Revenue per Unit | Labor Cost per Unit | Storage Cost per Unit |\n|---------|------------------|---------------------|-----------------------|\n| ProductA | $50             | LaborACost          | StorageACost          |\n| ProductB | $70             | LaborBCost          | StorageBCost          |\n| ProductC | $60             | LaborCCost          | StorageCCost          |\n\nThe company has a budget of $100,000 for raw materials. The company wants to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage. Please help the company determine the optimal production quantity for each product to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # quantity of ProductC\nRawMaterialACost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialACost\", lb=0)  # cost of raw materials for ProductA\nRawMaterialBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialBCost\", lb=0)  # cost of raw materials for ProductB\nRawMaterialCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialCCost\", lb=0)  # cost of raw materials for ProductC\nLaborACost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborACost\", lb=0)  # labor cost per unit for ProductA\nLaborBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborBCost\", lb=0)  # labor cost per unit for ProductB\nLaborCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborCCost\", lb=0)  # labor cost per unit for ProductC\nStorageACost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageACost\", lb=0)  # storage cost per unit for ProductA\nStorageBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageBCost\", lb=0)  # storage cost per unit for ProductB\nStorageCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageCCost\", lb=0)  # storage cost per unit for ProductC\n\n# Define objective function\nProfit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\nProfit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\nProfit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company needs to decide the number of trucks to purchase for three different types of trucks: TruckA, TruckB, and TruckC. Additionally, the company is considering investing in advanced navigation systems for each type of truck to improve fuel efficiency and reduce delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in navigation system for TruckA\": \"NavA\", \"range\": \"NavA >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckB\": \"NavB\", \"range\": \"NavB >= 0\", \"type\": \"continuous\"}\n// {\"investment in navigation system for TruckC\": \"NavC\", \"range\": \"NavC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel cost is affected by the navigation system investment, reducing the fuel consumption per kilometer by a certain percentage based on the investment.\nThe operational cost per kilometer for TruckA is $0.50, but with the navigation system, it decreases by 0.01% for every $100 invested.\nThe operational cost per kilometer for TruckB is $0.60, and with the navigation system, it decreases by 0.015% for every $100 invested.\nThe operational cost per kilometer for TruckC is $0.70, and with the navigation system, it decreases by 0.02% for every $100 invested.\nThe company operates each truck for 100,000 kilometers per year.\n// Operational cost for TruckA: CostA = (0.50 - 0.0001 * NavA) * 100000 * TruckA\n// Operational cost for TruckB: CostB = (0.60 - 0.00015 * NavB) * 100000 * TruckB\n// Operational cost for TruckC: CostC = (0.70 - 0.0002 * NavC) * 100000 * TruckC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in navigation systems.\n// TruckA * 100000 + TruckB * 120000 + TruckC * 150000 + NavA + NavB + NavC <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 10.\n// TruckA + TruckB + TruckC <= 10",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company needs to decide the number of trucks to purchase for three different types of trucks: TruckA, TruckB, and TruckC. Additionally, the company is considering investing in advanced navigation systems for each type of truck to improve fuel efficiency and reduce delivery times. The company aims to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel. The fuel cost is affected by the navigation system investment, reducing the fuel consumption per kilometer by a certain percentage based on the investment. The company operates each truck for 100,000 kilometers per year. The company has a budget of $1,000,000 for purchasing trucks and investing in navigation systems. The total number of trucks cannot exceed 10.\n\nPlease help the company to minimize the total operational cost, which includes the cost of purchasing trucks and the cost of fuel, considering the investment in navigation systems for each type of truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nNavA = model.addVar(vtype=\"CONTINUOUS\", name=\"NavA\", lb=0)\nNavB = model.addVar(vtype=\"CONTINUOUS\", name=\"NavB\", lb=0)\nNavC = model.addVar(vtype=\"CONTINUOUS\", name=\"NavC\", lb=0)\n\n# Define objective function\nCostA = (0.50 - 0.0001 * NavA) * 100000 * TruckA\nCostB = (0.60 - 0.00015 * NavB) * 100000 * TruckB\nCostC = (0.70 - 0.0002 * NavC) * 100000 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\nmodel.addCons(TruckA * 100000 + TruckB * 120000 + TruckC * 150000 + NavA + NavB + NavC <= 1000000)\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Navigation System for TruckA: \", model.getVal(NavA))\n    print(\"Investment in Navigation System for TruckB: \", model.getVal(NavB))\n    print(\"Investment in Navigation System for TruckC: \", model.getVal(NavC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each truck on Route A\": \"Distance_A\", \"range\": \"Distance_A >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route B\": \"Distance_B\", \"range\": \"Distance_B >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route C\": \"Distance_C\", \"range\": \"Distance_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = Trucks_A * Distance_A^2\n// Fuel_Consumption_B = Trucks_B * Distance_B^2\n// Fuel_Consumption_C = Trucks_C * Distance_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for all routes.\n// Trucks_A + Trucks_B + Trucks_C <= 50\n\n## Generate Constraint-2:\nThe total distance traveled by all trucks should not exceed 10,000 kilometers.\n// Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the total available trucks are assigned to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C)",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total of 50 trucks available for all routes. The total distance traveled by all trucks should not exceed 10,000 kilometers. The company must ensure that at least 10% of the total available trucks are assigned to Route A.\n\nPlease help the company to determine the optimal number of trucks for each route and the distance each truck should travel to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nDistance_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_A\", lb=0)  # distance traveled by each truck on Route A\nDistance_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_B\", lb=0)  # distance traveled by each truck on Route B\nDistance_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_C\", lb=0)  # distance traveled by each truck on Route C\n\n# Define objective function\nFuel_Consumption_A = Trucks_A * Distance_A**2\nFuel_Consumption_B = Trucks_B * Distance_B**2\nFuel_Consumption_C = Trucks_C * Distance_C**2\n# So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for all routes.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n# The total distance traveled by all trucks should not exceed 10,000 kilometers.\nmodel.addCons(Trucks_A * Distance_A + Trucks_B * Distance_B + Trucks_C * Distance_C <= 10000)\n# The company must ensure that at least 10% of the total available trucks are assigned to Route A.\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Distance on Route A: \", model.getVal(Distance_A))\n    print(\"Distance on Route B: \", model.getVal(Distance_B))\n    print(\"Distance on Route C: \", model.getVal(Distance_C))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and production cost. Device A has a profit margin of $50 per unit and a production cost of $20 per unit. Device B has a profit margin of $70 per unit and a production cost of $30 per unit. Device C has a profit margin of $90 per unit and a production cost of $40 per unit. Device D has a profit margin of $110 per unit and a production cost of $50 per unit. The company aims to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours. The production time for each device is as follows: Device A takes 2 hours, Device B takes 3 hours, Device C takes 4 hours, and Device D takes 5 hours.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company has a minimum production requirement for each device. Device A must produce at least 10 units, Device B must produce at least 15 units, Device C must produce at least 20 units, and Device D must produce at least 25 units.\n// A >= 10; B >= 15; C >= 20; D >= 25\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Device C does not exceed twice the production of Device A.\n// C <= 2 * A",
        "question": "A manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit margin, production cost, and production time for each device are given in the following Table.\n\n| Device | Profit Margin | Production Cost | Production Time |\n|--------|---------------|-----------------|-----------------|\n| A      | $50           | $20             | 2 hours         |\n| B      | $70           | $30             | 3 hours         |\n| C      | $90           | $40             | 4 hours         |\n| D      | $110          | $50             | 5 hours         |\n\nThe company has a budget of $10,000 for production costs. The company has a limited production capacity of 200 hours. The company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C. The company has a minimum production requirement for each device: Device A must produce at least 10 units, Device B must produce at least 15 units, Device C must produce at least 20 units, and Device D must produce at least 25 units. Additionally, the company wants to ensure that the total production of Device C does not exceed twice the production of Device A.\n\nPlease help the company to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=25) # number of units of device D\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 10000)\n# The company has a limited production capacity of 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 200)\n# The company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C.\nmodel.addCons(D <= A + B + C)\n# The company has a minimum production requirement for each device.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\nmodel.addCons(C >= 20)\nmodel.addCons(D >= 25)\n# The company wants to ensure that the total production of Device C does not exceed twice the production of Device A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1446,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials (X, Y, and Z). The manufacturer needs to determine the optimal quantities of each product to maximize profit while considering the availability and cost of raw materials.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material X\": \"RawMaterialX\", \"range\": \"RawMaterialX >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Y\": \"RawMaterialY\", \"range\": \"RawMaterialY >= 0\", \"type\": \"integer\"}\n// {\"quantity of raw material Z\": \"RawMaterialZ\", \"range\": \"RawMaterialZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, product B is $15, and product C is $20. The cost of raw material X per unit is $2, Y is $3, and Z is $4. The production of each product requires a specific combination of raw materials: Product A requires 1 unit of X and 2 units of Y, Product B requires 2 units of X, 1 unit of Y, and 1 unit of Z, and Product C requires 1 unit of X and 3 units of Z. The manufacturer wants to maximize the total profit.\n// Profit_A = 10 * ProductA\n// Profit_B = 15 * ProductB\n// Profit_C = 20 * ProductC\n// Cost_X = 2 * (ProductA + 2 * ProductB + ProductC)\n// Cost_Y = 3 * (2 * ProductA + ProductB)\n// Cost_Z = 4 * (ProductB + 3 * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials: 100 units of X, 80 units of Y, and 90 units of Z.\n// ProductA + 2 * ProductB + ProductC <= 100 (for X)\n// 2 * ProductA + ProductB <= 80 (for Y)\n// ProductB + 3 * ProductC <= 90 (for Z)",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials (X, Y, and Z). The manufacturer needs to determine the optimal quantities of each product to maximize profit while considering the availability and cost of raw materials. The profit per unit of product A is $10, product B is $15, and product C is $20. The cost of raw material X per unit is $2, Y is $3, and Z is $4. The production of each product requires a specific combination of raw materials: Product A requires 1 unit of X and 2 units of Y, Product B requires 2 units of X, 1 unit of Y, and 1 unit of Z, and Product C requires 1 unit of X and 3 units of Z. The manufacturer has a limited supply of raw materials: 100 units of X, 80 units of Y, and 90 units of Z. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\nProfit_A = 10 * ProductA\nProfit_B = 15 * ProductB\nProfit_C = 20 * ProductC\nCost_X = 2 * (ProductA + 2 * ProductB + ProductC)\nCost_Y = 3 * (2 * ProductA + ProductB)\nCost_Z = 4 * (ProductB + 3 * ProductC)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y - Cost_Z)\n\n# Add constraints\nmodel.addCons(ProductA + 2 * ProductB + ProductC <= 100) # for X\nmodel.addCons(2 * ProductA + ProductB <= 80) # for Y\nmodel.addCons(ProductB + 3 * ProductC <= 90) # for Z\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption\n\n## Generate Constraint-3:\nThe company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n// CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000\n\n## Generate Constraint-4:\nThe company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n// Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines, as well as determining the capacity of energy storage systems. The decision variables include the number of solar panels, wind turbines, and the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n\n| Component                | Description                                      |\n|--------------------------|--------------------------------------------------|\n| Solar Panels             | Number of solar panels                           |\n| Wind Turbines            | Number of wind turbines                          |\n| Energy Storage (kWh)     | Capacity of energy storage systems               |\n| Energy Consumption (kWh) | Total energy consumed by the company             |\n| Energy Cost (per kWh)    | Cost of energy per kilowatt-hour                 |\n\nThe company has the following constraints:\n1. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n2. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n3. The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n4. The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\n\nPlease help the company to minimize the total energy cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # example efficiency for solar panels\nWindEfficiency = 0.3  # example efficiency for wind turbines\nTotalEnergyDemand = 10000  # example total energy demand of the company\nPricePerKWh = 0.1  # example price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**(-1)) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 1000  # example average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n## The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\nCostOfSolarPanel = 1000  # example cost of a solar panel\nCostOfWindTurbine = 2000  # example cost of a wind turbine\nCostOfStorage = 100  # example cost of storage per kWh\nmodel.addCons(CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000)\n## The company must ensure that the energy consumption does not exceed the total energy generated plus the energy stored in the storage systems.\nmodel.addCons(Consumption <= Solar * SolarEfficiency + Wind * WindEfficiency + Storage)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Minimized Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1726,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers to allocate to each product line, and the amount of overtime hours to allow for each product line to meet fluctuating demand. The company also needs to decide on the investment in automation technology to reduce labor costs.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductA\": \"OvertimeA\", \"range\": \"OvertimeA >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductB\": \"OvertimeB\", \"range\": \"OvertimeB >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductC\": \"OvertimeC\", \"range\": \"OvertimeC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The labor cost per worker is $20 per hour, and overtime costs are $30 per hour. For every $10,000 invested in automation, labor costs per worker are reduced by $1 per hour. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50) * UnitsA - (20 - 0.0001 * Automation) * (WorkersA * 8 + OvertimeA)\n// Total profit for ProductB: ProfitB = (150 - 70) * UnitsB - (20 - 0.0001 * Automation) * (WorkersB * 8 + OvertimeB)\n// Total profit for ProductC: ProfitC = (200 - 90) * UnitsC - (20 - 0.0001 * Automation) * (WorkersC * 8 + OvertimeC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to equipment limitations, the maximum number of units that can be produced for ProductA is 500, for ProductB is 400, and for ProductC is 300.\n// UnitsA <= 500; UnitsB <= 400; UnitsC <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers to allocate to each product line, and the amount of overtime hours to allow for each product line to meet fluctuating demand. The company also needs to decide on the investment in automation technology to reduce labor costs. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The labor cost per worker is $20 per hour, and overtime costs are $30 per hour. For every $10,000 invested in automation, labor costs per worker are reduced by $1 per hour. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The company has a total of 100 workers available. The total investment in automation cannot exceed $50,000. Due to equipment limitations, the maximum number of units that can be produced for ProductA is 500, for ProductB is 400, and for ProductC is 300. The company aims to maximize the total profit from all products. Please help the company determine the optimal production and workforce allocation strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nOvertimeA = model.addVar(vtype=\"INTEGER\", name=\"OvertimeA\", lb=0)  # overtime hours for ProductA\nOvertimeB = model.addVar(vtype=\"INTEGER\", name=\"OvertimeB\", lb=0)  # overtime hours for ProductB\nOvertimeC = model.addVar(vtype=\"INTEGER\", name=\"OvertimeC\", lb=0)  # overtime hours for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA - (20 - 0.0001 * Automation) * (WorkersA * 8 + OvertimeA)\nProfitB = (150 - 70) * UnitsB - (20 - 0.0001 * Automation) * (WorkersB * 8 + OvertimeB)\nProfitC = (200 - 90) * UnitsC - (20 - 0.0001 * Automation) * (WorkersC * 8 + OvertimeC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)  # total workers constraint\nmodel.addCons(Automation <= 50000)  # automation investment constraint\nmodel.addCons(UnitsA <= 500)  # production limit for ProductA\nmodel.addCons(UnitsB <= 400)  # production limit for ProductB\nmodel.addCons(UnitsC <= 300)  # production limit for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Overtime Hours for ProductA: \", model.getVal(OvertimeA))\n    print(\"Overtime Hours for ProductB: \", model.getVal(OvertimeB))\n    print(\"Overtime Hours for ProductC: \", model.getVal(OvertimeC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: perishable goods, non-perishable goods, and hazardous materials. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for perishable trucks\": \"FuelEfficiencyPerishable\", \"range\": \"FuelEfficiencyPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for non-perishable trucks\": \"FuelEfficiencyNonPerishable\", \"range\": \"FuelEfficiencyNonPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for hazardous trucks\": \"FuelEfficiencyHazardous\", \"range\": \"FuelEfficiencyHazardous >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The cost savings per mile driven is a nonlinear function of the investment, with diminishing returns. The company aims to maximize the total cost savings from fuel efficiency across all types of trucks.\n// Cost savings per mile for perishable trucks: SavingsPerishable = (1 - (1 / (1 + FuelEfficiencyPerishable))^2) * PerishableTrucks\n// Cost savings per mile for non-perishable trucks: SavingsNonPerishable = (1 - (1 / (1 + FuelEfficiencyNonPerishable))^2) * NonPerishableTrucks\n// Cost savings per mile for hazardous trucks: SavingsHazardous = (1 - (1 / (1 + FuelEfficiencyHazardous))^2) * HazardousTrucks\n// So, the objective function is: Maximize (SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\n// PerishableTrucks * TruckCostPerishable + NonPerishableTrucks * TruckCostNonPerishable + HazardousTrucks * TruckCostHazardous + FuelEfficiencyPerishable + FuelEfficiencyNonPerishable + FuelEfficiencyHazardous <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: perishable goods, non-perishable goods, and hazardous materials. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The cost savings per mile driven is a nonlinear function of the investment, with diminishing returns. The company aims to maximize the total cost savings from fuel efficiency across all types of trucks. The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks cannot exceed 100. Please help the company to maximize the total cost savings from fuel efficiency across all types of trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)\nFuelEfficiencyPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyPerishable\", lb=0)\nFuelEfficiencyNonPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyNonPerishable\", lb=0)\nFuelEfficiencyHazardous = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHazardous\", lb=0)\n\n# Define objective function\n## Cost savings per mile for perishable trucks\nSavingsPerishable = (1 - (1 / (1 + FuelEfficiencyPerishable))**2) * PerishableTrucks\n## Cost savings per mile for non-perishable trucks\nSavingsNonPerishable = (1 - (1 / (1 + FuelEfficiencyNonPerishable))**2) * NonPerishableTrucks\n## Cost savings per mile for hazardous trucks\nSavingsHazardous = (1 - (1 / (1 + FuelEfficiencyHazardous))**2) * HazardousTrucks\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\nmodel.addCons(obj == SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(PerishableTrucks * 50000 + NonPerishableTrucks * 40000 + HazardousTrucks * 60000 + FuelEfficiencyPerishable + FuelEfficiencyNonPerishable + FuelEfficiencyHazardous <= 200000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Investment in Fuel Efficiency for Perishable Trucks: \", model.getVal(FuelEfficiencyPerishable))\n    print(\"Investment in Fuel Efficiency for Non-Perishable Trucks: \", model.getVal(FuelEfficiencyNonPerishable))\n    print(\"Investment in Fuel Efficiency for Hazardous Trucks: \", model.getVal(FuelEfficiencyHazardous))\n    print(\"Total Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks for RouteA\": \"RouteATrucks\", \"range\": \"RouteATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"RouteBTrucks\", \"range\": \"RouteBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"RouteCTrucks\", \"range\": \"RouteCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"RouteDTrucks\", \"range\": \"RouteDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"RouteETrucks\", \"range\": \"RouteETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Consumption per Truck is 500 liters per month, and the Maintenance Cost per Truck is $1000 per month.\nFor RouteB, the Fuel Consumption per Truck is 600 liters per month, and the Maintenance Cost per Truck is $1200 per month.\nFor RouteC, the Fuel Consumption per Truck is 700 liters per month, and the Maintenance Cost per Truck is $1400 per month.\nFor RouteD, the Fuel Consumption per Truck is 800 liters per month, and the Maintenance Cost per Truck is $1600 per month.\nFor RouteE, the Fuel Consumption per Truck is 900 liters per month, and the Maintenance Cost per Truck is $1800 per month.\nThe company wants to minimize the total cost per truck, which includes both fuel and maintenance costs.\n// Total cost for RouteA: Cost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\n// Total cost for RouteB: Cost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\n// Total cost for RouteC: Cost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\n// Total cost for RouteD: Cost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\n// Total cost for RouteE: Cost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40\n\n## Generate Constraint-2:\nDue to route complexities, RouteA must have at least half as many trucks as RouteB.\n// RouteATrucks <= 0.5 * RouteBTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while minimizing fuel consumption and maintenance costs.\nFor RouteA, the Fuel Consumption per Truck is 500 liters per month, and the Maintenance Cost per Truck is $1000 per month.\nFor RouteB, the Fuel Consumption per Truck is 600 liters per month, and the Maintenance Cost per Truck is $1200 per month.\nFor RouteC, the Fuel Consumption per Truck is 700 liters per month, and the Maintenance Cost per Truck is $1400 per month.\nFor RouteD, the Fuel Consumption per Truck is 800 liters per month, and the Maintenance Cost per Truck is $1600 per month.\nFor RouteE, the Fuel Consumption per Truck is 900 liters per month, and the Maintenance Cost per Truck is $1800 per month.\nThe company has a total of 40 trucks available for allocation. Due to route complexities, RouteA must have at least half as many trucks as RouteB.\nPlease help the company to minimize the total cost per truck, which includes both fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteATrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteATrucks\", lb=0)\nRouteBTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteBTrucks\", lb=0)\nRouteCTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteCTrucks\", lb=0)\nRouteDTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteDTrucks\", lb=0)\nRouteETrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteETrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPrice = 1.5  # Assuming fuel price per liter\nCost_RouteA = (500 * FuelPrice + 1000) * RouteATrucks\nCost_RouteB = (600 * FuelPrice + 1200) * RouteBTrucks\nCost_RouteC = (700 * FuelPrice + 1400) * RouteCTrucks\nCost_RouteD = (800 * FuelPrice + 1600) * RouteDTrucks\nCost_RouteE = (900 * FuelPrice + 1800) * RouteETrucks\nTotalTrucks = RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 40)\n## Due to route complexities, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(RouteATrucks <= 0.5 * RouteBTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(RouteATrucks))\n    print(\"Number of Trucks for RouteB: \", model.getVal(RouteBTrucks))\n    print(\"Number of Trucks for RouteC: \", model.getVal(RouteCTrucks))\n    print(\"Number of Trucks for RouteD: \", model.getVal(RouteDTrucks))\n    print(\"Number of Trucks for RouteE: \", model.getVal(RouteETrucks))\n    print(\"Minimized Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices.\n// Profit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R&D)) * DeviceA\n// Profit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R&D)) * DeviceB\n// Profit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R&D)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation and R&D cannot exceed $50,000.\n// Automation + R&D <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\n// DeviceA <= 500; DeviceB <= 400",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit.\n\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices.\n\nThe company has a total production capacity of 1000 units. The total investment in automation and R&D cannot exceed $50,000. Due to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0) # investment in R&D\n\n# Define objective function\nProfit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R_D)) * DeviceA\nProfit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R_D)) * DeviceB\nProfit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R_D)) * DeviceC\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n# The total investment in automation and R&D cannot exceed $50,000.\nmodel.addCons(Automation + R_D <= 50000)\n# Due to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Region 1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region 3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in fuel-efficient technology. The more invested, the less fuel each truck consumes per kilometer. The relationship is nonlinear, with diminishing returns as more technology is applied. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region 1: Fuel1 = (100 - 0.05 * Tech1^2) * Trucks1\n// Fuel consumption for Region 2: Fuel2 = (120 - 0.06 * Tech2^2) * Trucks2\n// Fuel consumption for Region 3: Fuel3 = (110 - 0.04 * Tech3^2) * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nDue to regional demand, the company must allocate at least 50 trucks to Region 1 and 70 trucks to Region 2.\n// Trucks1 >= 50; Trucks2 >= 70\n\n## Generate Constraint-3:\nThe maximum number of trucks that can be allocated to each region is limited by the regional infrastructure. Region 1 can handle up to 150 trucks, Region 2 up to 200 trucks, and Region 3 up to 100 trucks.\n// Trucks1 <= 150; Trucks2 <= 200; Trucks3 <= 100\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each region cannot exceed the total number of trucks in that region.\n// Tech1 <= Trucks1; Tech2 <= Trucks2; Tech3 <= Trucks3",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region and the investment in fuel-efficient technologies to minimize fuel consumption and operational costs. The relationship between investment in technology and fuel consumption is nonlinear, with diminishing returns as more technology is applied. The company aims to minimize the total fuel consumption across all regions.\n\n| Region | Minimum Trucks Required | Maximum Trucks Allowed |\n|--------|-------------------------|------------------------|\n| 1      | 50                      | 150                    |\n| 2      | 70                      | 200                    |\n| 3      | 0                       | 100                    |\n\nThe company has a total budget of $100,000 for truck allocation and technology investments. The investment in fuel-efficient technology for each region cannot exceed the total number of trucks in that region.\n\nPlease help the company to determine the optimal number of trucks and the appropriate investment in fuel-efficient technologies for each region to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50, ub=150) # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=70, ub=200) # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0, ub=100) # number of trucks in Region 3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Region 1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Region 2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Region 3\n\n# Define objective function\nFuel1 = (100 - 0.05 * Tech1**2) * Trucks1\nFuel2 = (120 - 0.06 * Tech2**2) * Trucks2\nFuel3 = (110 - 0.04 * Tech3**2) * Trucks3\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocation and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\n# Due to regional demand, the company must allocate at least 50 trucks to Region 1 and 70 trucks to Region 2.\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 70)\n# The maximum number of trucks that can be allocated to each region is limited by the regional infrastructure.\nmodel.addCons(Trucks1 <= 150)\nmodel.addCons(Trucks2 <= 200)\nmodel.addCons(Trucks3 <= 100)\n# The investment in fuel-efficient technology for each region cannot exceed the total number of trucks in that region.\nmodel.addCons(Tech1 <= Trucks1)\nmodel.addCons(Tech2 <= Trucks2)\nmodel.addCons(Tech3 <= Trucks3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Region 1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Region 2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Region 3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops to reduce energy costs and carbon emissions. The city has identified three types of buildings (residential, commercial, and industrial) where solar panels can be installed. The city needs to determine the number of solar panels to install on each type of building and the cost per panel for each type.\n// {\"number of solar panels for residential buildings\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for commercial buildings\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for industrial buildings\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"cost per solar panel for residential buildings\": \"ResidentialCostPerPanel\", \"range\": \"ResidentialCostPerPanel >= 0\", \"type\": \"real\"}\n// {\"cost per solar panel for commercial buildings\": \"CommercialCostPerPanel\", \"range\": \"CommercialCostPerPanel >= 0\", \"type\": \"real\"}\n// {\"cost per solar panel for industrial buildings\": \"IndustrialCostPerPanel\", \"range\": \"IndustrialCostPerPanel >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city aims to minimize the total cost of installing solar panels while maximizing the total energy generated. The energy generated per panel is 100 kWh for residential, 150 kWh for commercial, and 200 kWh for industrial buildings. The city also wants to ensure that the total energy generated is at least 10,000 kWh.\n// TotalCost = ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel\n// TotalEnergy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n// So, the objective function is: Minimize TotalCost subject to TotalEnergy >= 10000\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel <= 50000\n\n## Generate Constraint-2:\nThe city wants to ensure that at least 20% of the budget is spent on residential buildings.\n// ResidentialPanels * ResidentialCostPerPanel >= 0.2 * (ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel)\n\n## Generate Constraint-3:\nThe city has a limit on the number of panels that can be installed on commercial buildings due to space constraints, not more than 100 panels.\n// CommercialPanels <= 100\n\n## Generate Constraint-4:\nThe cost per panel for industrial buildings is at least twice the cost per panel for residential buildings.\n// IndustrialCostPerPanel >= 2 * ResidentialCostPerPanel",
        "question": "A city is planning to install solar panels on rooftops to reduce energy costs and carbon emissions. The city has identified three types of buildings (residential, commercial, and industrial) where solar panels can be installed. The city needs to determine the number of solar panels to install on each type of building and the cost per panel for each type. The energy generated per panel is 100 kWh for residential, 150 kWh for commercial, and 200 kWh for industrial buildings. The city aims to minimize the total cost of installing solar panels while maximizing the total energy generated, ensuring that the total energy generated is at least 10,000 kWh. The city has a budget of $50,000 for the installation of solar panels. The city wants to ensure that at least 20% of the budget is spent on residential buildings. Due to space constraints, the city has a limit on the number of panels that can be installed on commercial buildings, not more than 100 panels. The cost per panel for industrial buildings is at least twice the cost per panel for residential buildings. Please help the city to determine the optimal number of solar panels and their costs for each type of building to meet these objectives.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=0)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=0)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nResidentialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"ResidentialCostPerPanel\", lb=0)\nCommercialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialCostPerPanel\", lb=0)\nIndustrialCostPerPanel = model.addVar(vtype=\"CONTINUOUS\", name=\"IndustrialCostPerPanel\", lb=0)\n\n# Define objective function\nTotalCost = ResidentialPanels * ResidentialCostPerPanel + CommercialPanels * CommercialCostPerPanel + IndustrialPanels * IndustrialCostPerPanel\nTotalEnergy = 100 * ResidentialPanels + 150 * CommercialPanels + 200 * IndustrialPanels\n# Minimize TotalCost subject to TotalEnergy >= 10000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\nmodel.addCons(TotalEnergy >= 10000)\n\n# Add constraints\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(TotalCost <= 50000)\n# The city wants to ensure that at least 20% of the budget is spent on residential buildings.\nmodel.addCons(ResidentialPanels * ResidentialCostPerPanel >= 0.2 * TotalCost)\n# The city has a limit on the number of panels that can be installed on commercial buildings due to space constraints, not more than 100 panels.\nmodel.addCons(CommercialPanels <= 100)\n# The cost per panel for industrial buildings is at least twice the cost per panel for residential buildings.\nmodel.addCons(IndustrialCostPerPanel >= 2 * ResidentialCostPerPanel)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels for Residential Buildings: \", model.getVal(ResidentialPanels))\n    print(\"Number of Solar Panels for Commercial Buildings: \", model.getVal(CommercialPanels))\n    print(\"Number of Solar Panels for Industrial Buildings: \", model.getVal(IndustrialPanels))\n    print(\"Cost per Panel for Residential Buildings: \", model.getVal(ResidentialCostPerPanel))\n    print(\"Cost per Panel for Commercial Buildings: \", model.getVal(CommercialCostPerPanel))\n    print(\"Cost per Panel for Industrial Buildings: \", model.getVal(IndustrialCostPerPanel))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes.\n// FuelCost_A = 1 * (RouteDistance / 10) * TruckA\n// FuelCost_B = 1 * (RouteDistance / 15) * TruckB\n// FuelCost_C = 1 * (RouteDistance / 20) * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 km.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for fuel costs.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nThe market demand for Truck A is 30 units. So, the company can only operate a maximum of 30 units of Truck A.\n// TruckA <= 30\n\n## Generate Constraint-5:\nThe company must operate at least 20 units of Truck B to maintain certain delivery routes.\n// TruckB >= 20",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption. The fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes. The total distance to be covered by all trucks is 5000 km. The company has a budget of $3000 for fuel costs. The company can only operate a maximum of 100 trucks in total. The market demand for Truck A is 30 units, so the company can only operate a maximum of 30 units of Truck A. The company must operate at least 20 units of Truck B to maintain certain delivery routes. Please help the company to determine the optimal number of each type of truck to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=20)  # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nRouteDistance = model.addVar(name=\"RouteDistance\")  # variable for route distance\nFuelCost_A = 1 * (RouteDistance / 10) * TruckA\nFuelCost_B = 1 * (RouteDistance / 15) * TruckB\nFuelCost_C = 1 * (RouteDistance / 20) * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\nmodel.addCons(obj == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 km.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC == 5000)\n## The company has a budget of $3000 for fuel costs.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000)\n## The company can only operate a maximum of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The market demand for Truck A is 30 units. So, the company can only operate a maximum of 30 units of Truck A.\nmodel.addCons(TruckA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 5 different trucks to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed.\n// {\"fuel efficiency of truck 1\": \"E1\", \"range\": \"E1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 2\": \"E2\", \"range\": \"E2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 3\": \"E3\", \"range\": \"E3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 4\": \"E4\", \"range\": \"E4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 5\": \"E5\", \"range\": \"E5 > 0\", \"type\": \"real\"}\n// {\"speed of truck 1\": \"S1\", \"range\": \"S1 > 0\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"S2\", \"range\": \"S2 > 0\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"S3\", \"range\": \"S3 > 0\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"S4\", \"range\": \"S4 > 0\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"S5\", \"range\": \"S5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel consumption and travel time for all trucks. The fuel consumption is a nonlinear function of speed and fuel efficiency. The objective is to minimize the total cost, which is the sum of fuel costs and time costs (assuming time has a cost).\n// Fuel_Cost_T1 = (Distance / E1) * (1 / S1)\n// Fuel_Cost_T2 = (Distance / E2) * (1 / S2)\n// Fuel_Cost_T3 = (Distance / E3) * (1 / S3)\n// Fuel_Cost_T4 = (Distance / E4) * (1 / S4)\n// Fuel_Cost_T5 = (Distance / E5) * (1 / S5)\n// Time_Cost_T1 = Distance / S1\n// Time_Cost_T2 = Distance / S2\n// Time_Cost_T3 = Distance / S3\n// Time_Cost_T4 = Distance / S4\n// Time_Cost_T5 = Distance / S5\n// So, the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n## Generate Constraint-1:\nThe total distance each truck can travel is limited to 500 km.\n// Distance / S1 <= 500; Distance / S2 <= 500; Distance / S3 <= 500; Distance / S4 <= 500; Distance / S5 <= 500\n\n## Generate Constraint-2:\nThe fuel efficiency of each truck must be between 5 and 15 km/liter.\n// 5 <= E1 <= 15; 5 <= E2 <= 15; 5 <= E3 <= 15; 5 <= E4 <= 15; 5 <= E5 <= 15",
        "question": "A logistics company operates a fleet of 5 trucks and needs to optimize the routes for these trucks to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed. The company wants to minimize the total cost, which includes both fuel costs and time costs (assuming time has a cost). The fuel consumption is a nonlinear function of speed and fuel efficiency. The total distance each truck can travel is limited to 500 km. Additionally, the fuel efficiency of each truck must be between 5 and 15 km/liter.\n\nPlease help the company to minimize the total cost, which is the sum of fuel costs and time costs for all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"E1\", lb=5, ub=15) # fuel efficiency of truck 1\nE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"E2\", lb=5, ub=15) # fuel efficiency of truck 2\nE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"E3\", lb=5, ub=15) # fuel efficiency of truck 3\nE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"E4\", lb=5, ub=15) # fuel efficiency of truck 4\nE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"E5\", lb=5, ub=15) # fuel efficiency of truck 5\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0) # speed of truck 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0) # speed of truck 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0) # speed of truck 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0) # speed of truck 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0) # speed of truck 5\nDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance\", lb=0) # total distance\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_T1 = (Distance / E1) * (1 / S1)\nFuel_Cost_T2 = (Distance / E2) * (1 / S2)\nFuel_Cost_T3 = (Distance / E3) * (1 / S3)\nFuel_Cost_T4 = (Distance / E4) * (1 / S4)\nFuel_Cost_T5 = (Distance / E5) * (1 / S5)\nTime_Cost_T1 = Distance / S1\nTime_Cost_T2 = Distance / S2\nTime_Cost_T3 = Distance / S3\nTime_Cost_T4 = Distance / S4\nTime_Cost_T5 = Distance / S5\n## the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\nmodel.addCons(obj == Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n# Add constraints\n## The total distance each truck can travel is limited to 500 km.\nmodel.addCons(Distance / S1 <= 500)\nmodel.addCons(Distance / S2 <= 500)\nmodel.addCons(Distance / S3 <= 500)\nmodel.addCons(Distance / S4 <= 500)\nmodel.addCons(Distance / S5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(E1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(E2))\n    print(\"Fuel Efficiency of Truck 3: \", model.getVal(E3))\n    print(\"Fuel Efficiency of Truck 4: \", model.getVal(E4))\n    print(\"Fuel Efficiency of Truck 5: \", model.getVal(E5))\n    print(\"Speed of Truck 1: \", model.getVal(S1))\n    print(\"Speed of Truck 2: \", model.getVal(S2))\n    print(\"Speed of Truck 3: \", model.getVal(S3))\n    print(\"Speed of Truck 4: \", model.getVal(S4))\n    print(\"Speed of Truck 5: \", model.getVal(S5))\n    print(\"Total Distance: \", model.getVal(Distance))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 654,
        "var_num": 11,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of production lines dedicated to each device and the number of units produced per line per month. Additionally, the company is considering investing in automation upgrades to increase the production efficiency of each line, which will reduce the production cost per unit.\n// {\"number of production lines for DeviceA\": \"LinesA\", \"range\": \"LinesA >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceB\": \"LinesB\", \"range\": \"LinesB >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceC\": \"LinesC\", \"range\": \"LinesC >= 0\", \"type\": \"integer\"}\n// {\"number of units produced per line for DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units produced per line for DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units produced per line for DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation upgrades\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation upgrades. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - 100 + 0.0005 * Automation) * LinesA * UnitsA\n// Total profit for DeviceB: ProfitB = (220 - 120 + 0.0005 * Automation) * LinesB * UnitsB\n// Total profit for DeviceC: ProfitC = (250 - 150 + 0.0005 * Automation) * LinesC * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 production lines available for the month.\n// LinesA + LinesB + LinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in automation upgrades cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to operational constraints, each production line can produce no more than 1000 units in the month.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of production lines dedicated to each device and the number of units produced per line per month. Additionally, the company is considering investing in automation upgrades to increase the production efficiency of each line, which will reduce the production cost per unit. The production cost per unit decreases by $5 for every $10,000 invested in automation upgrades. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices. The company has a total of 40 production lines available for the month. The total investment in automation upgrades cannot exceed $50,000. Due to operational constraints, each production line can produce no more than 1000 units in the month. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLinesA = model.addVar(vtype=\"INTEGER\", name=\"LinesA\", lb=0) # number of production lines for DeviceA\nLinesB = model.addVar(vtype=\"INTEGER\", name=\"LinesB\", lb=0) # number of production lines for DeviceB\nLinesC = model.addVar(vtype=\"INTEGER\", name=\"LinesC\", lb=0) # number of production lines for DeviceC\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units produced per line for DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units produced per line for DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units produced per line for DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation upgrades\n\n# Define objective function\n## Total profit for DeviceA: ProfitA = (200 - 100 + 0.0005 * Automation) * LinesA * UnitsA\n## Total profit for DeviceB: ProfitB = (220 - 120 + 0.0005 * Automation) * LinesB * UnitsB\n## Total profit for DeviceC: ProfitC = (250 - 150 + 0.0005 * Automation) * LinesC * UnitsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (200 - 100 + 0.0005 * Automation) * LinesA * UnitsA\nProfitB = (220 - 120 + 0.0005 * Automation) * LinesB * UnitsB\nProfitC = (250 - 150 + 0.0005 * Automation) * LinesC * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 40 production lines available for the month.\nmodel.addCons(LinesA + LinesB + LinesC <= 40)\n## The total investment in automation upgrades cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## Due to operational constraints, each production line can produce no more than 1000 units in the month.\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines for DeviceA: \", model.getVal(LinesA))\n    print(\"Number of Production Lines for DeviceB: \", model.getVal(LinesB))\n    print(\"Number of Production Lines for DeviceC: \", model.getVal(LinesC))\n    print(\"Number of Units Produced per Line for DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units Produced per Line for DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units Produced per Line for DeviceC: \", model.getVal(UnitsC))\n    print(\"Investment in Automation Upgrades: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product for the next month. Additionally, the company needs to decide on the number of shifts to operate in their factory for each product type.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of operating a shift for ProductA is $2000, for ProductB is $2500, and for ProductC is $3000. The company wants to maximize the total profit minus the shift operating costs.\n// Total profit for ProductA: Profit_A = 50 * ProdA - 2000 * ShiftsA\n// Total profit for ProductB: Profit_B = 70 * ProdB - 2500 * ShiftsB\n// Total profit for ProductC: Profit_C = 60 * ProdC - 3000 * ShiftsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe factory has a total of 20 shifts available for the month.\n// ShiftsA + ShiftsB + ShiftsC <= 20\n\n## Generate Constraint-2:\nDue to production capacity, the total production quantity for all products cannot exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product and the number of shifts to operate in their factory for each product type for the next month. The profit per unit and the cost of operating a shift for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Shift |\n|---------|-----------------|----------------|\n| ProductA | $50            | $2000          |\n| ProductB | $70            | $2500          |\n| ProductC | $60            | $3000          |\n\nThe factory has a total of 20 shifts available for the month. Due to production capacity, the total production quantity for all products cannot exceed 1000 units. The company wants to maximize the total profit minus the shift operating costs. Please help the company determine the optimal production quantity and number of shifts for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for ProductC\n\n# Define objective function\nProfit_A = 50 * ProdA - 2000 * ShiftsA\nProfit_B = 70 * ProdB - 2500 * ShiftsB\nProfit_C = 60 * ProdC - 3000 * ShiftsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The factory has a total of 20 shifts available for the month.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 20)\n# Due to production capacity, the total production quantity for all products cannot exceed 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for material costs for the next quarter.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each component in the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $2000 for material costs for the next quarter. The company wants to produce at least 20 units of each component in the next quarter.\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each component in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $2000 for material costs for the next quarter.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type.\n// {\"number of trucks from City A to City B\": \"TrucksAB\", \"range\": \"TrucksAB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City A to City C\": \"TrucksAC\", \"range\": \"TrucksAC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks from City B to City C\": \"TrucksBC\", \"range\": \"TrucksBC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks from City A to City B\": \"FuelEfficiencyAB\", \"range\": \"FuelEfficiencyAB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City A to City C\": \"FuelEfficiencyAC\", \"range\": \"FuelEfficiencyAC > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks from City B to City C\": \"FuelEfficiencyBC\", \"range\": \"FuelEfficiencyBC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day. The fuel cost is calculated based on the distance between cities, the number of trucks, and their fuel efficiency. The distance from City A to City B is 500 km, from City A to City C is 700 km, and from City B to City C is 600 km. The fuel cost is $1 per liter.\n// FuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\n// FuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\n// FuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n// So, the objective function is: Minimize (FuelCostAB + FuelCostAC + FuelCostBC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// FuelCostAB + FuelCostAC + FuelCostBC <= 1000\n\n## Generate Constraint-2:\nThe company can only allocate a maximum of 50 trucks in total across all routes.\n// TrucksAB + TrucksAC + TrucksBC <= 50\n\n## Generate Constraint-3:\nThe fuel efficiency of the trucks must be at least 5 km/liter for each route.\n// FuelEfficiencyAB >= 5\n// FuelEfficiencyAC >= 5\n// FuelEfficiencyBC >= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport goods between three cities: City A, City B, and City C. The company needs to decide the number of trucks to allocate for each city pair and the fuel efficiency of each truck type. The distance between cities and the fuel cost per liter are given in the following Table.\n\n| City Pair       | Distance (km) | Fuel Cost per Liter |\n|-----------------|---------------|---------------------|\n| City A to City B| 500           | $1                  |\n| City A to City C| 700           | $1                  |\n| City B to City C| 600           | $1                  |\n\nThe company has a total budget of $1000 for fuel costs per day. The company can only allocate a maximum of 50 trucks in total across all routes. The fuel efficiency of the trucks must be at least 5 km/liter for each route. \nPlease help the company to minimize the total fuel cost per day, which is calculated based on the distance between cities, the number of trucks, and their fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksAB = model.addVar(vtype=\"INTEGER\", name=\"TrucksAB\", lb=0)  # number of trucks from City A to City B\nTrucksAC = model.addVar(vtype=\"INTEGER\", name=\"TrucksAC\", lb=0)  # number of trucks from City A to City C\nTrucksBC = model.addVar(vtype=\"INTEGER\", name=\"TrucksBC\", lb=0)  # number of trucks from City B to City C\nFuelEfficiencyAB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAB\", lb=5)  # fuel efficiency of trucks from City A to City B\nFuelEfficiencyAC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyAC\", lb=5)  # fuel efficiency of trucks from City A to City C\nFuelEfficiencyBC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyBC\", lb=5)  # fuel efficiency of trucks from City B to City C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostAB = 500 * TrucksAB / FuelEfficiencyAB\nFuelCostAC = 700 * TrucksAC / FuelEfficiencyAC\nFuelCostBC = 600 * TrucksBC / FuelEfficiencyBC\n## convert the division to multiplication\nmodel.addCons(obj * (FuelEfficiencyAB * FuelEfficiencyAC * FuelEfficiencyBC) == FuelCostAB * FuelEfficiencyAC * FuelEfficiencyBC + FuelCostAC * FuelEfficiencyAB * FuelEfficiencyBC + FuelCostBC * FuelEfficiencyAB * FuelEfficiencyAC)\n\n# Add constraints\n## The company has a total budget of $1000 for fuel costs per day.\nmodel.addCons(FuelCostAB + FuelCostAC + FuelCostBC <= 1000)\n## The company can only allocate a maximum of 50 trucks in total across all routes.\nmodel.addCons(TrucksAB + TrucksAC + TrucksBC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks from City A to City B: \", model.getVal(TrucksAB))\n    print(\"Number of Trucks from City A to City C: \", model.getVal(TrucksAC))\n    print(\"Number of Trucks from City B to City C: \", model.getVal(TrucksBC))\n    print(\"Fuel Efficiency of Trucks from City A to City B: \", model.getVal(FuelEfficiencyAB))\n    print(\"Fuel Efficiency of Trucks from City A to City C: \", model.getVal(FuelEfficiencyAC))\n    print(\"Fuel Efficiency of Trucks from City B to City C: \", model.getVal(FuelEfficiencyBC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000\n\n## Generate Constraint-3:\nThe market demand for tablets is at least 1,500 units per month.\n// Tablets >= 1500\n\n## Generate Constraint-4:\nThe market demand for laptops is at least 1,000 units per month.\n// Laptops >= 1000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\nThe profit from each device is calculated based on the selling price minus the production cost, with the profit per unit for smartphones being $100 - 0.1 * Smartphones, for tablets being $150 - 0.2 * Tablets, for laptops being $200 - 0.3 * Laptops, for smartwatches being $50 - 0.05 * Smartwatches, and for cameras being $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices. The total production capacity of the company is 10,000 units per month. The market demand for smartphones is at least 2,000 units per month, for tablets is at least 1,500 units per month, and for laptops is at least 1,000 units per month.\nPlease help the company determine the optimal production quantities for each device to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1500)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=1000)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)  # number of smartwatches produced\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)  # number of cameras produced\n\n# Define objective function\n# The profit from each device is calculated based on the selling price minus the production cost.\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n\nTotal_profit = Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_profit)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck incurs a cost per trip based on fuel and maintenance. The costs are as follows: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported.\n// Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// The objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trips must be at least 50 to meet the demand.\n// T1 + T2 + T3 + T4 + T5 >= 50",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) to transport goods across different regions. The company needs to decide how many trips each truck should make to optimize its operations. Each truck incurs a cost per trip based on fuel and maintenance: Truck1 costs $100 per trip, Truck2 costs $120 per trip, Truck3 costs $150 per trip, Truck4 costs $180 per trip, and Truck5 costs $200 per trip. The company aims to minimize the total cost of all trips while ensuring sufficient goods are transported. The total number of trips must be at least 50 to meet the demand. Please help the company determine the optimal number of trips for each truck to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\nmodel.addCons(obj == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5)\n\n# Add constraints\n## The total number of trips must be at least 50 to meet the demand.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 714,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company aims to maximize the total daily deliveries while minimizing the total cost.\n// TotalCost = 100 * T + 50 * V + 10 * B\n// TotalDeliveries = 100 * T + 75 * V + 20 * B\n// So, the objective function is: Minimize (TotalCost - TotalDeliveries)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for vehicle operations.\n// 100 * T + 50 * V + 10 * B <= 5000\n\n## Generate Constraint-2:\nThere is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total.\n// T + V + B <= 100\n\n## Generate Constraint-3:\nThe company has a daily delivery target of 5000 deliveries.\n// 100 * T + 75 * V + 20 * B >= 5000\n\n## Generate Constraint-4:\nDue to licensing restrictions, the number of trucks cannot exceed 30.\n// T <= 30",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company has a budget of $5000 per day for vehicle operations. There is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total. The company has a daily delivery target of 5000 deliveries. Due to licensing restrictions, the number of trucks cannot exceed 30.\nPlease help the company to minimize the total cost while maximizing the total daily deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T + 50 * V + 10 * B\nTotalDeliveries = 100 * T + 75 * V + 20 * B\n## the objective function is: Minimize (TotalCost - TotalDeliveries)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * TotalDeliveries)\n\n# Add constraints\n## The company has a budget of $5000 per day for vehicle operations.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 5000)\n## There is a limit on the number of vehicles that can be stored and operated, which is 100 vehicles in total.\nmodel.addCons(T + V + B <= 100)\n## The company has a daily delivery target of 5000 deliveries.\nmodel.addCons(100 * T + 75 * V + 20 * B >= 5000)\n## Due to licensing restrictions, the number of trucks cannot exceed 30.\nmodel.addCons(T <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Cost-Delivery Difference: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Cost per Truck is $500, the Maintenance Cost per Truck is $300, and the Revenue per Truck is $1000.\nFor RouteB, the Fuel Cost per Truck is $600, the Maintenance Cost per Truck is $350, and the Revenue per Truck is $1200.\nFor RouteC, the Fuel Cost per Truck is $700, the Maintenance Cost per Truck is $400, and the Revenue per Truck is $1400.\nFor RouteD, the Fuel Cost per Truck is $800, the Maintenance Cost per Truck is $450, and the Revenue per Truck is $1600.\nFor RouteE, the Fuel Cost per Truck is $900, the Maintenance Cost per Truck is $500, and the Revenue per Truck is $1800.\nThe company wants to minimize the average cost per truck while ensuring profitability.\n// Total cost for RouteA: Cost_RouteA = (500 + 300) * TrucksA\n// Total cost for RouteB: Cost_RouteB = (600 + 350) * TrucksB\n// Total cost for RouteC: Cost_RouteC = (700 + 400) * TrucksC\n// Total cost for RouteD: Cost_RouteD = (800 + 450) * TrucksD\n// Total cost for RouteE: Cost_RouteE = (900 + 500) * TrucksE\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\n// TrucksC >= 0.5 * TrucksA\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for maintenance costs for the month.\n// 300 * TrucksA + 350 * TrucksB + 400 * TrucksC + 450 * TrucksD + 500 * TrucksE <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck assigned.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1; TrucksD >= 1; TrucksE >= 1\n\n## Generate Constraint-5:\nThe total revenue from all routes must exceed $50,000 to meet financial targets.\n// 1000 * TrucksA + 1200 * TrucksB + 1400 * TrucksC + 1600 * TrucksD + 1800 * TrucksE >= 50,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs. The costs and revenues per truck for each route are given in the following Table.\n\n| Route   | Fuel Cost per Truck | Maintenance Cost per Truck | Revenue per Truck |\n|---------|---------------------|----------------------------|-------------------|\n| RouteA  | $500                | $300                       | $1000             |\n| RouteB  | $600                | $350                       | $1200             |\n| RouteC  | $700                | $400                       | $1400             |\n| RouteD  | $800                | $450                       | $1600             |\n| RouteE  | $900                | $500                       | $1800             |\n\nThe company has a total of 40 trucks available for allocation. Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA. The company has a budget of $20,000 for maintenance costs for the month. The company wants to ensure that each route has at least one truck assigned. The total revenue from all routes must exceed $50,000 to meet financial targets.\n\nPlease help the company to minimize the average cost per truck while ensuring profitability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=1)  # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=1)  # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_RouteA = (500 + 300) * TrucksA\nCost_RouteB = (600 + 350) * TrucksB\nCost_RouteC = (700 + 400) * TrucksC\nCost_RouteD = (800 + 450) * TrucksD\nCost_RouteE = (900 + 500) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\nmodel.addCons(TrucksC >= 0.5 * TrucksA)\n## The company has a budget of $20,000 for maintenance costs for the month.\nmodel.addCons(300 * TrucksA + 350 * TrucksB + 400 * TrucksC + 450 * TrucksD + 500 * TrucksE <= 20000)\n## The total revenue from all routes must exceed $50,000 to meet financial targets.\nmodel.addCons(1000 * TrucksA + 1200 * TrucksB + 1400 * TrucksC + 1600 * TrucksD + 1800 * TrucksE >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Average Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1384,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers\": \"Drivers\", \"range\": \"Drivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost.\n// Total profit from Small trucks: ProfitSmall = 50000 * SmallTrucks\n// Total profit from Medium trucks: ProfitMedium = 75000 * MediumTrucks\n// Total profit from Large trucks: ProfitLarge = 100000 * LargeTrucks\n// Total profit from Extra-Large trucks: ProfitExtraLarge = 125000 * ExtraLargeTrucks\n// Operational cost: OperationalCost = 50000 * Drivers\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing new trucks and hiring drivers.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large, each with different fuel efficiency, maintenance costs, and cargo capacity. The company also needs to decide on the number of drivers to hire, which affects the operational costs. The profit per truck type varies based on the cargo capacity and operational efficiency. The profit for Small trucks is $50,000 per truck, for Medium trucks is $75,000 per truck, for Large trucks is $100,000 per truck, and for Extra-Large trucks is $125,000 per truck. The operational cost of the fleet is affected by the number of drivers, with a cost of $50,000 per driver. The company has a budget of $2,000,000 for purchasing new trucks and hiring drivers. The company aims to maximize the net profit, which is the total profit from all trucks minus the operational cost. Please help the company determine the optimal number of each type of truck and the number of drivers to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nDrivers = model.addVar(vtype=\"INTEGER\", name=\"Drivers\", lb=0)  # number of drivers\n\n# Define objective function\nProfitSmall = 50000 * SmallTrucks\nProfitMedium = 75000 * MediumTrucks\nProfitLarge = 100000 * LargeTrucks\nProfitExtraLarge = 125000 * ExtraLargeTrucks\nOperationalCost = 50000 * Drivers\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge - OperationalCost)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 125000 * ExtraLargeTrucks + 50000 * Drivers <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Drivers: \", model.getVal(Drivers))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour. However, the production of laptops incurs an additional maintenance cost of $50 per hour due to complex machinery. The objective is to maximize the total daily profit.\n// The objective function is: Maximize P = 100S + 150T + (200L - 50L) = 100S + 150T + 150L\n\n## Generate Constraint-1:\nThe total available production hours per day across all lines is 24 hours.\n// S + T + L <= 24\n\n## Generate Constraint-2:\nDue to labor regulations, the tablet production line cannot operate more than 10 hours a day.\n// T <= 10",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour, with an additional maintenance cost of $50 per hour for laptops due to complex machinery. The company aims to maximize its daily profit.\n\n| Device     | Profit per Hour | Additional Cost per Hour |\n|------------|-----------------|--------------------------|\n| Smartphones | $100            | None                     |\n| Tablets     | $150            | None                     |\n| Laptops     | $200            | $50                      |\n\nThe total available production hours per day across all lines is 24 hours. Due to labor regulations, the tablet production line cannot operate more than 10 hours a day. Please help the company to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0, ub=10) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n## The objective function is: Maximize P = 100S + 150T + 150L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100 * S + 150 * T + 150 * L)\n\n# Add constraints\n## The total available production hours per day across all lines is 24 hours.\nmodel.addCons(S + T + L <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutoA\", \"range\": \"AutoA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutoB\", \"range\": \"AutoB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutoC\", \"range\": \"AutoC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 5 * AutoA)) * QA\n// Total profit for ProductB: ProfitB = (180 - (120 - 5 * AutoB)) * QB\n// Total profit for ProductC: ProfitC = (200 - (150 - 5 * AutoC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation across all products.\n// AutoA * QA + AutoB * QB + AutoC * QC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for implementing automation across all products.\n\nPlease help the company to determine the optimal production quantities and levels of automation for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutoA = model.addVar(name=\"AutoA\", lb=0) # level of automation for ProductA\nAutoB = model.addVar(name=\"AutoB\", lb=0) # level of automation for ProductB\nAutoC = model.addVar(name=\"AutoC\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 5 * AutoA)) * QA\nProfitB = (180 - (120 - 5 * AutoB)) * QB\nProfitC = (200 - (150 - 5 * AutoC)) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation across all products.\nmodel.addCons(AutoA * QA + AutoB * QB + AutoC * QC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutoA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutoB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutoC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the amount of investment in automation technology to reduce production costs. The production cost per unit decreases with increased investment in automation.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The selling price per unit is $200 for DeviceA, $250 for DeviceB, and $300 for DeviceC. For every $10,000 invested in automation, the production cost per unit decreases by $5. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\n// Total profit for DeviceB: ProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\n// Total profit for DeviceC: ProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the amount of investment in automation technology to reduce production costs. The production cost per unit decreases with increased investment in automation. The production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The selling price per unit is $200 for DeviceA, $250 for DeviceB, and $300 for DeviceC. For every $10,000 invested in automation, the production cost per unit decreases by $5. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units for all devices combined. The total investment in automation technology cannot exceed $50,000. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for DeviceA: ProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\n## Total profit for DeviceB: ProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\n## Total profit for DeviceC: ProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\nProfitA = (200 - (100 - 0.0005 * AutomationInvestment)) * UnitsA\nProfitB = (250 - (150 - 0.0005 * AutomationInvestment)) * UnitsB\nProfitC = (300 - (200 - 0.0005 * AutomationInvestment)) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 T1 trucks.\n// T1 >= 10",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company has a budget of $50,000 for purchasing trucks. The total number of trucks cannot exceed 50. The company must have at least 10 T1 trucks.\nPlease help the company to maximize the net profit, which is the total revenue minus the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 trucks: \", model.getVal(T1))\n    print(\"Number of T2 trucks: \", model.getVal(T2))\n    print(\"Number of T3 trucks: \", model.getVal(T3))\n    print(\"Number of T4 trucks: \", model.getVal(T4))\n    print(\"Number of T5 trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product A\": \"InventoryA\", \"range\": \"InventoryA >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product B\": \"InventoryB\", \"range\": \"InventoryB >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product C\": \"InventoryC\", \"range\": \"InventoryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\n// Profit_ProductA = (ProductA - InventoryA) * (50 - 30)\n// Profit_ProductB = (ProductB - InventoryB) * (70 - 40)\n// Profit_ProductC = (ProductC - InventoryC) * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 50 units for each product.\n// InventoryA <= 50\n// InventoryB <= 50\n// InventoryC <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\nThe company has a total production capacity of 100 units per day. The company also has a storage capacity limit of 50 units for each product.\nPlease help the company to determine the optimal production quantities for products A, B, and C, as well as the inventory levels for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nInventoryA = model.addVar(vtype=\"INTEGER\", name=\"InventoryA\", lb=0)  # inventory level of product A\nInventoryB = model.addVar(vtype=\"INTEGER\", name=\"InventoryB\", lb=0)  # inventory level of product B\nInventoryC = model.addVar(vtype=\"INTEGER\", name=\"InventoryC\", lb=0)  # inventory level of product C\n\n# Define objective function\nProfit_ProductA = (ProductA - InventoryA) * (50 - 30)\nProfit_ProductB = (ProductB - InventoryB) * (70 - 40)\nProfit_ProductC = (ProductC - InventoryC) * (60 - 35)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 100)  # total production capacity constraint\nmodel.addCons(InventoryA <= 50)  # storage capacity limit for product A\nmodel.addCons(InventoryB <= 50)  # storage capacity limit for product B\nmodel.addCons(InventoryC <= 50)  # storage capacity limit for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Inventory Level of Product A: \", model.getVal(InventoryA))\n    print(\"Inventory Level of Product B: \", model.getVal(InventoryB))\n    print(\"Inventory Level of Product C: \", model.getVal(InventoryC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck type\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3, and the distance traveled by each truck to each region varies (Region1: 500 miles, Region2: 700 miles, Region3: 600 miles, Region4: 800 miles, Region5: 900 miles). The company wants to minimize the total fuel cost per day.\n// FuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * $3\n// FuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * $3\n// FuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * $3\n// FuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * $3\n// FuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * $3\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 500 * TrucksRegion1 / FuelEfficiency * $3 + 700 * TrucksRegion2 / FuelEfficiency * $3 + 600 * TrucksRegion3 / FuelEfficiency * $3 + 800 * TrucksRegion4 / FuelEfficiency * $3 + 900 * TrucksRegion5 / FuelEfficiency * $3 <= $10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The distance traveled by each truck to each region varies as shown in the following Table.\n\n| Region | Distance (miles) |\n|--------|------------------|\n| Region1 | 500             |\n| Region2 | 700             |\n| Region3 | 600             |\n| Region4 | 800             |\n| Region5 | 900             |\n\nThe cost of fuel per gallon is $3, and the fuel efficiency of each truck type is denoted by \"FuelEfficiency\". The company has a total budget of $10,000 for fuel costs per day. The company can allocate a maximum of 20 trucks in total across all regions. \n\nPlease help the company to minimize the total fuel cost per day, which is calculated as the sum of the fuel costs for each region, where the fuel cost for each region is the product of the distance, the number of trucks allocated to that region, divided by the fuel efficiency, and the cost of fuel per gallon.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0)\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0)\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0)\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * 3\nFuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * 3\nFuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * 3\nFuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * 3\nFuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * 3\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(500 * TrucksRegion1 / FuelEfficiency * 3 + 700 * TrucksRegion2 / FuelEfficiency * 3 + 600 * TrucksRegion3 / FuelEfficiency * 3 + 800 * TrucksRegion4 / FuelEfficiency * 3 + 900 * TrucksRegion5 / FuelEfficiency * 3 <= 10000)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes.\n// {\"number of Truck1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck1 has a fuel efficiency of 5 km/l and a maintenance cost of $10,000 per year.\n- Truck2 has a fuel efficiency of 10 km/l and a maintenance cost of $15,000 per year.\n- Truck3 has a fuel efficiency of 15 km/l and a maintenance cost of $20,000 per year.\n- Truck4 has a fuel efficiency of 20 km/l and a maintenance cost of $25,000 per year.\n- Truck5 has a fuel efficiency of 25 km/l and a maintenance cost of $30,000 per year.\nThe company wants to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n// Fuel cost = (total distance / fuel efficiency) * fuel price\n// Maintenance cost = number of trucks * maintenance cost per truck\n// Objective function: Minimize (Fuel cost + Maintenance cost)\n\n## Generate Constraint-1:\nThe total budget for purchasing new trucks is $500,000.\n// 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 10 trucks in total.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10\n\n## Generate Constraint-3:\nThe total capacity of all trucks must exceed 100,000 kg.\n// (Truck1 * 1000) + (Truck2 * 2000) + (Truck3 * 3000) + (Truck4 * 4000) + (Truck5 * 5000) >= 100000\n\n## Generate Constraint-4:\nNo more than 5 Truck1 and 5 Truck2 can be purchased.\n// Truck1 <= 5\n// Truck2 <= 5",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to optimize their delivery routes. The fuel efficiency and maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost per Year |\n|------------|-----------------------|--------------------------|\n| Truck1     | 5                     | $10,000                   |\n| Truck2     | 10                    | $15,000                   |\n| Truck3     | 15                    | $20,000                   |\n| Truck4     | 20                    | $25,000                   |\n| Truck5     | 25                    | $30,000                   |\n\nThe company has a total budget of $500,000 for purchasing new trucks. The company must have at least 10 trucks in total. The total capacity of all trucks must exceed 100,000 kg. Additionally, no more than 5 Truck1 and 5 Truck2 can be purchased. \n\nPlease help the company to minimize the total cost of fuel and maintenance while ensuring all delivery routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)\n\n# Define objective function\n# Fuel cost = (total distance / fuel efficiency) * fuel price\n# Maintenance cost = number of trucks * maintenance cost per truck\n# Objective function: Minimize (Fuel cost + Maintenance cost)\n# Assuming fuel price and total distance are constants for simplicity\nFuelCost = (5 * Truck1 + 10 * Truck2 + 15 * Truck3 + 20 * Truck4 + 25 * Truck5) * 1  # Simplified fuel cost calculation\nMaintenanceCost = 10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n# The total budget for purchasing new trucks is $500,000.\nmodel.addCons(10000 * Truck1 + 15000 * Truck2 + 20000 * Truck3 + 25000 * Truck4 + 30000 * Truck5 <= 500000)\n# The company must have at least 10 trucks in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 >= 10)\n# The total capacity of all trucks must exceed 100,000 kg.\nmodel.addCons((Truck1 * 1000) + (Truck2 * 2000) + (Truck3 * 3000) + (Truck4 * 4000) + (Truck5 * 5000) >= 100000)\n# No more than 5 Truck1 and 5 Truck2 can be purchased.\nmodel.addCons(Truck1 <= 5)\nmodel.addCons(Truck2 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Truck4: \", model.getVal(Truck4))\n    print(\"Number of Truck5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices. The company has a total production capacity of 10,000 units for all devices combined. Please help the company determine the optimal production quantities for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 651,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for each truck on Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for each truck on Route5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n// Fuel consumption for Route1: Consumption1 = (Fuel1^2 / (Trucks1 * 100))\n// Fuel consumption for Route2: Consumption2 = (Fuel2^2 / (Trucks2 * 100))\n// Fuel consumption for Route3: Consumption3 = (Fuel3^2 / (Trucks3 * 100))\n// Fuel consumption for Route4: Consumption4 = (Fuel4^2 / (Trucks4 * 100))\n// Fuel consumption for Route5: Consumption5 = (Fuel5^2 / (Trucks5 * 100))\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $100,000.\n// Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trucks to deploy on each of its five main routes, as well as the amount of fuel to allocate to each truck. The fuel efficiency of each truck varies based on the route and the amount of fuel it carries. The company aims to minimize the total fuel consumption across all routes, considering that the fuel efficiency of each truck decreases nonlinearly with the increase in fuel load. The fuel consumption function for each route is modeled as a quadratic function of the fuel allocation.\n\n| Route | Fuel Consumption Function |\n|-------|---------------------------|\n| Route1 | Consumption1 = (Fuel1^2 / (Trucks1 * 100)) |\n| Route2 | Consumption2 = (Fuel2^2 / (Trucks2 * 100)) |\n| Route3 | Consumption3 = (Fuel3^2 / (Trucks3 * 100)) |\n| Route4 | Consumption4 = (Fuel4^2 / (Trucks4 * 100)) |\n| Route5 | Consumption5 = (Fuel5^2 / (Trucks5 * 100)) |\n\nThe company has a total fuel budget of $100,000. Please help the company to minimize the total fuel consumption across all routes while staying within the fuel budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)\n\n# Define objective function\nConsumption1 = (Fuel1**2) / (Trucks1 * 100)\nConsumption2 = (Fuel2**2) / (Trucks2 * 100)\nConsumption3 = (Fuel3**2) / (Trucks3 * 100)\nConsumption4 = (Fuel4**2) / (Trucks4 * 100)\nConsumption5 = (Fuel5**2) / (Trucks5 * 100)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n# Add constraints\nmodel.addCons(Fuel1 * Trucks1 + Fuel2 * Trucks2 + Fuel3 * Trucks3 + Fuel4 * Trucks4 + Fuel5 * Trucks5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Fuel Allocation for Route4: \", model.getVal(Fuel4))\n    print(\"Fuel Allocation for Route5: \", model.getVal(Fuel5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The efficiency of each route, measured in deliveries per hour, is 20 for route 1, 25 for route 2, 30 for route 3, 28 for route 4, and 22 for route 5. The company wants to maximize the total deliveries per dollar spent.\n// Efficiency_Route1 = 20 * T1 / 1000\n// Efficiency_Route2 = 25 * T2 / 1200\n// Efficiency_Route3 = 30 * T3 / 1500\n// Efficiency_Route4 = 28 * T4 / 1300\n// Efficiency_Route5 = 22 * T5 / 1400\n// So, the objective function is: Maximize Efficiency_Route1 + Efficiency_Route2 + Efficiency_Route3 + Efficiency_Route4 + Efficiency_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. Each route has a different cost and efficiency. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The efficiency of each route, measured in deliveries per hour, is 20 for route 1, 25 for route 2, 30 for route 3, 28 for route 4, and 22 for route 5. The company wants to maximize the total deliveries per dollar spent. The company has a total of 100 trucks available for allocation. Please help the company to maximize the total deliveries per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Route1 = 20 * T1 / 1000\nEfficiency_Route2 = 25 * T2 / 1200\nEfficiency_Route3 = 30 * T3 / 1500\nEfficiency_Route4 = 28 * T4 / 1300\nEfficiency_Route5 = 22 * T5 / 1400\n## convert the division to multiplication\nmodel.addCons(obj * 1000 == 20 * T1)\nmodel.addCons(obj * 1200 == 25 * T2)\nmodel.addCons(obj * 1500 == 30 * T3)\nmodel.addCons(obj * 1300 == 28 * T4)\nmodel.addCons(obj * 1400 == 22 * T5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Deliveries per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wireless Earbuds\": \"WirelessEarbuds\", \"range\": \"WirelessEarbuds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\n// Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\n// Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\n// Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\n// Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all devices.\n// Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $50 per Smartphone, $70 per Tablet, $100 per Laptop, $20 per Smartwatch, and $15 per Wireless Earbud. The total budget for raw materials is $60,000.\n// 50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units.\n// Smartphones <= 300; Tablets <= 200; Laptops <= 150; Smartwatches <= 250; WirelessEarbuds <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units of each device type to meet the minimum order requirements from distributors.\n// Smartphones >= 100; Tablets >= 100; Laptops >= 100; Smartwatches >= 100; WirelessEarbuds >= 100",
        "question": "A manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints. The profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company has a total production capacity of 1000 units across all devices. The company has a limited budget for raw materials, which costs $50 per Smartphone, $70 per Tablet, $100 per Laptop, $20 per Smartwatch, and $15 per Wireless Earbud, with a total budget of $60,000. The market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units. The company aims to produce at least 100 units of each device type to meet the minimum order requirements from distributors. Please help the company to maximize the total profit from the sales of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units.\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=100, ub=300)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=100, ub=200)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=100, ub=150)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=100, ub=250)\nWirelessEarbuds = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds\", lb=100, ub=300)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=100, ub=300)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=300, ub=300)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(Smartphones == S1*S_b1 + S2*S_b2)\nProfit_Smartphones = 100 * S1 * S_b1 + (100 + 0.1 * (S2 - 100)) * S2 * S_b2\n\n## create piecewise variables for piecewise function: Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=100, ub=200)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=200, ub=200)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(Tablets == T1*T_b1 + T2*T_b2)\nProfit_Tablets = 200 * T1 * T_b1 + (200 + 0.1 * (T2 - 100)) * T2 * T_b2\n\n## create piecewise variables for piecewise function: Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=100, ub=150)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=150, ub=150)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(Laptops == L1*L_b1 + L2*L_b2)\nProfit_Laptops = 300 * L1 * L_b1 + (300 + 0.1 * (L2 - 100)) * L2 * L_b2\n\n## create piecewise variables for piecewise function: Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\nSW1 = model.addVar(vtype=\"INTEGER\", name=\"SW1\", lb=100, ub=250)\nSW2 = model.addVar(vtype=\"INTEGER\", name=\"SW2\", lb=250, ub=250)\nSW_b1 = model.addVar(vtype=\"B\", name=\"SW_b1\")\nSW_b2 = model.addVar(vtype=\"B\", name=\"SW_b2\")\nmodel.addCons(SW_b1 + SW_b2 == 1)\nmodel.addCons(Smartwatches == SW1*SW_b1 + SW2*SW_b2)\nProfit_Smartwatches = 50 * SW1 * SW_b1 + (50 + 0.1 * (SW2 - 100)) * SW2 * SW_b2\n\n## create piecewise variables for piecewise function: Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\nWE1 = model.addVar(vtype=\"INTEGER\", name=\"WE1\", lb=100, ub=300)\nWE2 = model.addVar(vtype=\"INTEGER\", name=\"WE2\", lb=300, ub=300)\nWE_b1 = model.addVar(vtype=\"B\", name=\"WE_b1\")\nWE_b2 = model.addVar(vtype=\"B\", name=\"WE_b2\")\nmodel.addCons(WE_b1 + WE_b2 == 1)\nmodel.addCons(WirelessEarbuds == WE1*WE_b1 + WE2*WE_b2)\nProfit_WirelessEarbuds = 30 * WE1 * WE_b1 + (30 + 0.1 * (WE2 - 100)) * WE2 * WE_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000)\nmodel.addCons(50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Quantity of Wireless Earbuds: \", model.getVal(WirelessEarbuds))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company wants to minimize the total operational cost per ton-kilometer.\n// Operational cost for TruckA: Cost_TruckA = (0.5 + 0.3) * TruckANum\n// Operational cost for TruckB: Cost_TruckB = (0.6 + 0.4) * TruckBNum\n// Operational cost for TruckC: Cost_TruckC = (0.7 + 0.5) * TruckCNum\n// Operational cost for TruckD: Cost_TruckD = (0.8 + 0.6) * TruckDNum\n// Operational cost for TruckE: Cost_TruckE = (0.9 + 0.7) * TruckENum\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks.\n// 10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks (TruckA, TruckB, TruckC, TruckD, and TruckE) with varying capacities and fuel efficiencies. The company needs to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel cost per kilometer is $0.5, the maintenance cost per kilometer is $0.3, and the capacity is 10 tons.\nFor TruckB, the fuel cost per kilometer is $0.6, the maintenance cost per kilometer is $0.4, and the capacity is 15 tons.\nFor TruckC, the fuel cost per kilometer is $0.7, the maintenance cost per kilometer is $0.5, and the capacity is 20 tons.\nFor TruckD, the fuel cost per kilometer is $0.8, the maintenance cost per kilometer is $0.6, and the capacity is 25 tons.\nFor TruckE, the fuel cost per kilometer is $0.9, the maintenance cost per kilometer is $0.7, and the capacity is 30 tons.\nThe company has a total budget of $100,000 for purchasing trucks.\nPlease help the company to minimize the total operational cost per ton-kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (0.5 + 0.3) * TruckANum\nCost_TruckB = (0.6 + 0.4) * TruckBNum\nCost_TruckC = (0.7 + 0.5) * TruckCNum\nCost_TruckD = (0.8 + 0.6) * TruckDNum\nCost_TruckE = (0.9 + 0.7) * TruckENum\nCapacity = 10 * TruckANum + 15 * TruckBNum + 20 * TruckCNum + 25 * TruckDNum + 30 * TruckENum\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(10000 * TruckANum + 15000 * TruckBNum + 20000 * TruckCNum + 25000 * TruckDNum + 30000 * TruckENum <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Minimized Operational Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. \nTruck A has a fuel efficiency of 10 km/l and an operational cost of $50 per day.\nTruck B has a fuel efficiency of 15 km/l and an operational cost of $60 per day.\nTruck C has a fuel efficiency of 20 km/l and an operational cost of $70 per day.\nTruck D has a fuel efficiency of 25 km/l and an operational cost of $80 per day.\nTruck E has a fuel efficiency of 30 km/l and an operational cost of $90 per day.\nThe company aims to minimize the total operational cost while maintaining a certain level of fuel efficiency (defined as the total distance traveled divided by the total fuel consumed).\n// Total operational cost: Cost = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\n// Total distance traveled: Distance = 1000 * (A + B + C + D + E)\n// Total fuel consumed: Fuel = 1000 * (A / 10 + B / 15 + C / 20 + D / 25 + E / 30)\n// So, the objective function is: Minimize Cost / (Distance / Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per month for operational costs.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000\n\n## Generate Constraint-2:\nThe company must deploy at least 10 trucks of each type.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-3:\nThe total number of trucks deployed must not exceed 100.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe fuel efficiency of the fleet (in km/l) must be at least 18 km/l.\n// (1000 * (A + B + C + D + E)) / (A / 10 + B / 15 + C / 20 + D / 25 + E / 30) >= 18000\n\n## Generate Constraint-5:\nThe number of Truck E must not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost. The fuel efficiency and operational cost for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Operational Cost ($/day) |\n|------------|-----------------------|--------------------------|\n| A          | 10                    | 50                       |\n| B          | 15                    | 60                       |\n| C          | 20                    | 70                       |\n| D          | 25                    | 80                       |\n| E          | 30                    | 90                       |\n\nThe company has a budget of $10,000 per month for operational costs. The company must deploy at least 10 trucks of each type. The total number of trucks deployed must not exceed 100. The fuel efficiency of the fleet (in km/l) must be at least 18 km/l. The number of Truck E must not exceed the combined number of Trucks A, B, and C.\n\nPlease help the company to minimize the total operational cost while maintaining the required level of fuel efficiency (defined as the total distance traveled divided by the total fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deploy at least 10 trucks of each type.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of trucks E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\nDistance = 1000 * (A + B + C + D + E)\nFuel = 1000 * (A / 10 + B / 15 + C / 20 + D / 25 + E / 30)\n## the objective function is: Minimize Cost / (Distance / Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * (Distance / Fuel) == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per month for operational costs.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E <= 10000)\n## The total number of trucks deployed must not exceed 100.\nmodel.addCons(A + B + C + D + E <= 100)\n## The fuel efficiency of the fleet (in km/l) must be at least 18 km/l.\nmodel.addCons((1000 * (A + B + C + D + E)) / (A / 10 + B / 15 + C / 20 + D / 25 + E / 30) >= 18000)\n## The number of Truck E must not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. The production cost, revenue, and required machine hours vary for each product.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product A\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a production cost of $50 per unit, a revenue of $100 per unit, and requires 2 machine hours per unit.\nProduct B has a production cost of $70 per unit, a revenue of $140 per unit, and requires 3 machine hours per unit.\nProduct C has a production cost of $90 per unit, a revenue of $180 per unit, and requires 4 machine hours per unit.\nThe company wants to maximize the total daily profit.\n// Profit_A = (100 - 50) * UnitsA - 2000 * MachinesA\n// Profit_B = (140 - 70) * UnitsB - 3000 * MachinesB\n// Profit_C = (180 - 90) * UnitsC - 4000 * MachinesC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nThe total production capacity per day is limited to 100 units across all products.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily operational budget of $5000 for machine maintenance.\n// 2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. The production cost, revenue, and required machine hours vary for each product. The details are as follows:\n\n| Product | Production Cost per Unit | Revenue per Unit | Machine Hours per Unit |\n|---------|---------------------------|------------------|-------------------------|\n| A       | $50                       | $100             | 2 hours                 |\n| B       | $70                       | $140             | 3 hours                 |\n| C       | $90                       | $180             | 4 hours                 |\n\nThe company has a total of 50 machines available. The total production capacity per day is limited to 100 units across all products. The company has a daily operational budget of $5000 for machine maintenance. \n\nPlease help the company to maximize the total daily profit, considering the constraints on machines and production capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for product A\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for product B\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for product C\n\n# Define objective function\nProfit_A = (100 - 50) * UnitsA - 2000 * MachinesA\nProfit_B = (140 - 70) * UnitsB - 3000 * MachinesB\nProfit_C = (180 - 90) * UnitsC - 4000 * MachinesC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 50 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n# The total production capacity per day is limited to 100 units across all products.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n# The company has a daily operational budget of $5000 for machine maintenance.\nmodel.addCons(2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Machines for Product A: \", model.getVal(MachinesA))\n    print(\"Number of Machines for Product B: \", model.getVal(MachinesB))\n    print(\"Number of Machines for Product C: \", model.getVal(MachinesC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (North, South, East, West, and Central). The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate per truck.\n// {\"number of trucks for North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per truck (gallons per mile)\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3. The distance traveled by each truck in the North region is 100 miles, South is 150 miles, East is 200 miles, West is 250 miles, and Central is 300 miles. The company wants to minimize the total fuel cost per day.\n// FuelCost_North = 100 * NorthTrucks * FuelRate * 3\n// FuelCost_South = 150 * SouthTrucks * FuelRate * 3\n// FuelCost_East = 200 * EastTrucks * FuelRate * 3\n// FuelCost_West = 250 * WestTrucks * FuelRate * 3\n// FuelCost_Central = 300 * CentralTrucks * FuelRate * 3\n// So, the objective function is: Minimize (FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West + FuelCost_Central)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs per day.\n// 100 * NorthTrucks * FuelRate + 150 * SouthTrucks * FuelRate + 200 * EastTrucks * FuelRate + 250 * WestTrucks * FuelRate + 300 * CentralTrucks * FuelRate <= 5000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to each region.\n// NorthTrucks >= 5\n// SouthTrucks >= 5\n// EastTrucks >= 5\n// WestTrucks >= 5\n// CentralTrucks >= 5",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (North, South, East, West, and Central). The company needs to determine the number of trucks to allocate to each region and the fuel consumption rate per truck. The distance traveled by each truck in the North region is 100 miles, South is 150 miles, East is 200 miles, West is 250 miles, and Central is 300 miles. The cost of fuel per gallon is $3. The company wants to minimize the total fuel cost per day.\n\n| Region       | Distance Traveled (miles) |\n|--------------|---------------------------|\n| North        | 100                       |\n| South        | 150                       |\n| East         | 200                       |\n| West         | 250                       |\n| Central      | 300                       |\n\nThe company has a total budget of $5000 for fuel costs per day. The company has a maximum of 50 trucks available. The company must allocate at least 5 trucks to each region. Please help the company to determine the optimal allocation of trucks and the fuel consumption rate per truck to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=5)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=5)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=5)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=5)\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=5)\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0)\n\n# Define objective function\nFuelCost_North = 100 * NorthTrucks * FuelRate * 3\nFuelCost_South = 150 * SouthTrucks * FuelRate * 3\nFuelCost_East = 200 * EastTrucks * FuelRate * 3\nFuelCost_West = 250 * WestTrucks * FuelRate * 3\nFuelCost_Central = 300 * CentralTrucks * FuelRate * 3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_North + FuelCost_South + FuelCost_East + FuelCost_West + FuelCost_Central)\n\n# Add constraints\nmodel.addCons(100 * NorthTrucks * FuelRate + 150 * SouthTrucks * FuelRate + 200 * EastTrucks * FuelRate + 250 * WestTrucks * FuelRate + 300 * CentralTrucks * FuelRate <= 5000)\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks for South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks for East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks for West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks for Central Region: \", model.getVal(CentralTrucks))\n    print(\"Fuel Consumption Rate per Truck: \", model.getVal(FuelRate))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 T1 trucks.\n// T1 >= 10\n\n## Generate Constraint-4:\nThe number of T5 trucks cannot exceed 10.\n// T5 <= 10\n\n## Generate Constraint-5:\nThe ratio of T2 to T3 trucks should be at least 1:2.\n// T2 >= 0.5 * T3",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries. The revenue generated and fuel consumed per trip for each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Trip | Fuel Cost per Trip |\n|------------|------------------|--------------------|\n| T1         | $500             | $100               |\n| T2         | $600             | $120               |\n| T3         | $700             | $140               |\n| T4         | $800             | $160               |\n| T5         | $900             | $180               |\n\nThe company has a budget of $50,000 for purchasing trucks. The total number of trucks cannot exceed 50. The company must have at least 10 T1 trucks. The number of T5 trucks cannot exceed 10. The ratio of T2 to T3 trucks should be at least 1:2. \n\nPlease help the company to maximize the net profit, which is the total revenue minus the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# The company must have at least 10 T1 trucks.\nmodel.addCons(T1 >= 10)\n# The number of T5 trucks cannot exceed 10.\nmodel.addCons(T5 <= 10)\n# The ratio of T2 to T3 trucks should be at least 1:2.\nmodel.addCons(T2 >= 0.5 * T3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production while considering the varying efficiency of each plant due to weather conditions and maintenance. Additionally, the company needs to decide on the investment in advanced technology for each plant to enhance efficiency.\n// {\"hours of operation for Solar plant\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar plant\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind plant\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro plant\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. The Solar plant produces 100 kWh per hour without technology, increasing by 10 kWh per hour for every $1000 invested. The Wind plant produces 120 kWh per hour initially, increasing by 12 kWh per hour for every $1000 invested. The Hydro plant produces 150 kWh per hour initially, increasing by 15 kWh per hour for every $1000 invested. The company aims to maximize the total daily energy production.\n// Total energy production for Solar: EnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\n// Total energy production for Wind: EnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\n// Total energy production for Hydro: EnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000\n\n## Generate Constraint-2:\nDue to maintenance and weather conditions, the total operational hours for all plants cannot exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. The initial production rates and the increase in production per $1000 investment for each plant are given in the following Table.\n\n| Plant Type | Initial Production Rate | Increase in Production per $1000 Investment |\n|------------|-------------------------|--------------------------------------------|\n| Solar      | 100 kWh/hour            | 10 kWh/hour                                |\n| Wind       | 120 kWh/hour            | 12 kWh/hour                                |\n| Hydro      | 150 kWh/hour            | 15 kWh/hour                                |\n\nThe company has a total budget of $50,000 for technology investments and operational costs. Due to maintenance and weather conditions, the total operational hours for all plants cannot exceed 24 hours per day. \n\nPlease help the company to maximize the total daily energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # hours of operation for Solar plant\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # hours of operation for Wind plant\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # hours of operation for Hydro plant\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar plant\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind plant\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro plant\n\n# Define objective function\nEnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\nEnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\nEnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000)\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(SolarHours))\n    print(\"Hours of operation for Wind plant: \", model.getVal(WindHours))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar plant: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind plant: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro plant: \", model.getVal(TechInvestmentHydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. Additionally, the company needs to decide on the investment in renewable energy sources to reduce the carbon footprint of each truck.\n// {\"fuel consumption of Truck1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption of Truck3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck1\": \"Renewable1\", \"range\": \"Renewable1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck2\": \"Renewable2\", \"range\": \"Renewable2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in renewable energy for Truck3\": \"Renewable3\", \"range\": \"Renewable3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the investment in renewable energy sources. For every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n// Fuel consumption for Truck1: Fuel1 = 100 - 0.01 * Renewable1\n// Fuel consumption for Truck2: Fuel2 = 100 - 0.01 * Renewable2\n// Fuel consumption for Truck3: Fuel3 = 100 - 0.01 * Renewable3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and renewable energy investments.\n// Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000\n\n## Generate Constraint-2:\nThe total distance each truck can travel is limited to 5000 km.\n// Fuel1 * 50 + Fuel2 * 50 + Fuel3 * 50 <= 5000",
        "question": "A logistics company operates a fleet of three trucks (Truck1, Truck2, and Truck3) and needs to optimize the fuel consumption and route selection for each truck. Additionally, the company needs to decide on the investment in renewable energy sources to reduce the carbon footprint of each truck. The relationship between investment in renewable energy and fuel consumption is such that for every $1000 invested in renewable energy, the fuel consumption decreases by 10 liters per 100 km for each truck. The company aims to minimize the total fuel consumption of all trucks.\n\n| Truck | Initial Fuel Consumption (liters/100km) | Investment in Renewable Energy |\n|-------|-----------------------------------------|---------------------------------|\n| 1     | 100 - 0.01 * Renewable1                 | Renewable1                      |\n| 2     | 100 - 0.01 * Renewable2                 | Renewable2                      |\n| 3     | 100 - 0.01 * Renewable3                 | Renewable3                      |\n\nThe company has a budget of $100,000 for fuel and renewable energy investments. The total distance each truck can travel is limited to 5000 km.\n\nPlease help the company determine the optimal fuel consumption and investment in renewable energy for each truck to minimize the total fuel consumption while adhering to the budget and distance constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel consumption of Truck1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel consumption of Truck2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel consumption of Truck3\nRenewable1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable1\", lb=0)  # investment in renewable energy for Truck1\nRenewable2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable2\", lb=0)  # investment in renewable energy for Truck2\nRenewable3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Renewable3\", lb=0)  # investment in renewable energy for Truck3\n\n# Define objective function\n## The fuel consumption of each truck is affected by the investment in renewable energy sources.\nFuel1 = 100 - 0.01 * Renewable1\nFuel2 = 100 - 0.01 * Renewable2\nFuel3 = 100 - 0.01 * Renewable3\n## So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and renewable energy investments.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Renewable1 + Renewable2 + Renewable3 <= 100000)\n## The total distance each truck can travel is limited to 5000 km.\nmodel.addCons(Fuel1 * 50 + Fuel2 * 50 + Fuel3 * 50 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(Fuel2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(Fuel3))\n    print(\"Investment in renewable energy for Truck1: \", model.getVal(Renewable1))\n    print(\"Investment in renewable energy for Truck2: \", model.getVal(Renewable2))\n    print(\"Investment in renewable energy for Truck3: \", model.getVal(Renewable3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1355,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: electric cars (EC), hybrid cars (HC), and hydrogen fuel cell cars (HFC). The company needs to determine the production quantities of each type of vehicle to maximize profit while considering various constraints.\n// {\"quantity of EC\": \"EC\", \"range\": \"EC >= 0\", \"type\": \"integer\"}\n// {\"quantity of HC\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n// {\"quantity of HFC\": \"HFC\", \"range\": \"HFC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per electric car is $20,000, per hybrid car is $15,000, and per hydrogen fuel cell car is $25,000. The production cost per electric car is $10,000, per hybrid car is $8,000, and per hydrogen fuel cell car is $12,000. The company wants to maximize the total profit.\n// Profit_EC = 20000 * EC - 10000 * EC\n// Profit_HC = 15000 * HC - 8000 * HC\n// Profit_HFC = 25000 * HFC - 12000 * HFC\n// So, the objective function is: Maximize (Profit_EC + Profit_HC + Profit_HFC)\n\n## Generate Constraint-1:\nThe company has a limited production budget of $1,000,000.\n// 10000 * EC + 8000 * HC + 12000 * HFC <= 1000000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 100 vehicles.\n// EC + HC + HFC <= 100",
        "question": "A manufacturer produces three types of eco-friendly vehicles: electric cars (EC), hybrid cars (HC), and hydrogen fuel cell cars (HFC). The company needs to determine the production quantities of each type of vehicle to maximize profit while considering various constraints. The profit and production cost per vehicle are given in the following Table.\n\n| Vehicle Type | Profit per Vehicle | Production Cost per Vehicle |\n|--------------|--------------------|-----------------------------|\n| Electric Car (EC) | $20,000 | $10,000 |\n| Hybrid Car (HC) | $15,000 | $8,000 |\n| Hydrogen Fuel Cell Car (HFC) | $25,000 | $12,000 |\n\nThe company has a limited production budget of $1,000,000. The company also has a limited production capacity of 100 vehicles. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nEC = model.addVar(vtype=\"INTEGER\", name=\"EC\", lb=0) # quantity of EC\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=0) # quantity of HC\nHFC = model.addVar(vtype=\"INTEGER\", name=\"HFC\", lb=0) # quantity of HFC\n\n# Define objective function\nProfit_EC = (20000 - 10000) * EC\nProfit_HC = (15000 - 8000) * HC\nProfit_HFC = (25000 - 12000) * HFC\n# So, the objective function is: Maximize (Profit_EC + Profit_HC + Profit_HFC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_EC + Profit_HC + Profit_HFC)\n\n# Add constraints\n# The company has a limited production budget of $1,000,000.\nmodel.addCons(10000 * EC + 8000 * HC + 12000 * HFC <= 1000000)\n# The company has a limited production capacity of 100 vehicles.\nmodel.addCons(EC + HC + HFC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric Cars: \", model.getVal(EC))\n    print(\"Quantity of Hybrid Cars: \", model.getVal(HC))\n    print(\"Quantity of Hydrogen Fuel Cell Cars: \", model.getVal(HFC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel purchased for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost includes fuel cost and depreciation cost. The fuel cost is directly proportional to the amount of fuel purchased and the speed of the trucks. The depreciation cost increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes.\n// Fuel cost for Route1: FuelCost1 = Fuel1 * Speed1\n// Fuel cost for Route2: FuelCost2 = Fuel2 * Speed2\n// Depreciation cost for Route1: Depreciation1 = 0.01 * Speed1^2 * Trucks1\n// Depreciation cost for Route2: Depreciation2 = 0.01 * Speed2^2 * Trucks2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n## Generate Constraint-1:\nThe total budget for fuel purchases is $10,000.\n// Fuel1 + Fuel2 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route, the speed at which each truck should travel, and the amount of fuel to purchase for each truck. The goal is to minimize the total operational cost, which includes fuel cost and depreciation cost based on the speed of the trucks. The operational cost includes fuel cost, which is directly proportional to the amount of fuel purchased and the speed of the trucks, and depreciation cost, which increases quadratically with the speed of the trucks. The company aims to minimize the total operational cost for both routes. The total budget for fuel purchases is $10,000. Please help the company determine the optimal number of trucks, their speeds, and the amount of fuel to purchase to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel purchased for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel purchased for Route2\n\n# Define objective function\nFuelCost1 = Fuel1 * Speed1\nFuelCost2 = Fuel2 * Speed2\nDepreciation1 = 0.01 * Speed1**2 * Trucks1\nDepreciation2 = 0.01 * Speed2**2 * Trucks2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + Depreciation1 + Depreciation2)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Fuel Purchased for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Purchased for Route2: \", model.getVal(Fuel2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase, the number of drivers to hire, and the amount of fuel to stockpile for each type of truck. Additionally, the company must determine the investment in maintenance and technology upgrades for each truck type to optimize fuel efficiency and reduce downtime.\n// {\"number of trucks of Type1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of Type2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Type1\": \"Drivers1\", \"range\": \"Drivers1 >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Type2\": \"Drivers2\", \"range\": \"Drivers2 >= 0\", \"type\": \"integer\"}\n// {\"fuel stock for Type1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel stock for Type2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade investment for Type1\": \"TechUpgrade1\", \"range\": \"TechUpgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade investment for Type2\": \"TechUpgrade2\", \"range\": \"TechUpgrade2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit, which is affected by the number of trips each truck can make, the efficiency of fuel usage, and the cost of maintenance and technology upgrades. The profit per trip for Type1 trucks is $1000, and for Type2 trucks is $1500. The fuel efficiency of Type1 trucks improves by 0.5% for every $1000 spent on technology upgrades, and Type2 trucks improve by 0.7% for every $1000 spent. Maintenance costs decrease by $500 for every $1000 spent on maintenance.\n// Profit per trip for Type1: Profit1 = 1000 * (Trucks1 * (Drivers1 / Trucks1)) * (1 + 0.005 * (TechUpgrade1 / 1000))\n// Profit per trip for Type2: Profit2 = 1500 * (Trucks2 * (Drivers2 / Trucks2)) * (1 + 0.007 * (TechUpgrade2 / 1000))\n// Maintenance cost reduction for Type1: CostReduction1 = 500 * (Maintenance1 / 1000)\n// Maintenance cost reduction for Type2: CostReduction2 = 500 * (Maintenance2 / 1000)\n// So, the objective function is: Maximize (Profit1 - CostReduction1 + Profit2 - CostReduction2)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks, hiring drivers, stockpiling fuel, and investing in maintenance and technology upgrades.\n// Trucks1 + Trucks2 + Drivers1 + Drivers2 + Fuel1 + Fuel2 + Maintenance1 + Maintenance2 + TechUpgrade1 + TechUpgrade2 <= 1000000\n\n## Generate Constraint-2:\nThe total number of drivers available is limited to 500.\n// Drivers1 + Drivers2 <= 500\n\n## Generate Constraint-3:\nDue to regulatory requirements, each type of truck must have at least one driver for every two trucks.\n// Drivers1 >= Trucks1 / 2; Drivers2 >= Trucks2 / 2\n\n## Generate Constraint-4:\nThe company must stockpile at least 10,000 liters of fuel for Type1 trucks and 15,000 liters for Type2 trucks.\n// Fuel1 >= 10000; Fuel2 >= 15000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase, the number of drivers to hire, and the amount of fuel to stockpile for each type of truck. Additionally, the company must determine the investment in maintenance and technology upgrades for each truck type to optimize fuel efficiency and reduce downtime. The company aims to maximize its quarterly profit, which is affected by the number of trips each truck can make, the efficiency of fuel usage, and the cost of maintenance and technology upgrades. The profit per trip for Type1 trucks is $1000, and for Type2 trucks is $1500. The fuel efficiency of Type1 trucks improves by 0.5% for every $1000 spent on technology upgrades, and Type2 trucks improve by 0.7% for every $1000 spent. Maintenance costs decrease by $500 for every $1000 spent on maintenance.\n\nThe company has a total budget of $1,000,000 for purchasing trucks, hiring drivers, stockpiling fuel, and investing in maintenance and technology upgrades. The total number of drivers available is limited to 500. Due to regulatory requirements, each type of truck must have at least one driver for every two trucks. The company must stockpile at least 10,000 liters of fuel for Type1 trucks and 15,000 liters for Type2 trucks.\n\nPlease help the company to maximize its quarterly profit, considering all these factors and constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks of Type1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks of Type2\nDrivers1 = model.addVar(vtype=\"INTEGER\", name=\"Drivers1\", lb=0)  # number of drivers for Type1\nDrivers2 = model.addVar(vtype=\"INTEGER\", name=\"Drivers2\", lb=0)  # number of drivers for Type2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel stock for Type1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel stock for Type2\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance investment for Type2\nTechUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgrade1\", lb=0)  # technology upgrade investment for Type1\nTechUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgrade2\", lb=0)  # technology upgrade investment for Type2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit per trip for Type1 and Type2\nProfit1 = 1000 * (Trucks1 * (Drivers1 / Trucks1)) * (1 + 0.005 * (TechUpgrade1 / 1000))\nProfit2 = 1500 * (Trucks2 * (Drivers2 / Trucks2)) * (1 + 0.007 * (TechUpgrade2 / 1000))\n## Maintenance cost reduction\nCostReduction1 = 500 * (Maintenance1 / 1000)\nCostReduction2 = 500 * (Maintenance2 / 1000)\n## the objective function is: Maximize (Profit1 - CostReduction1 + Profit2 - CostReduction2)\nmodel.addCons(obj == Profit1 - CostReduction1 + Profit2 - CostReduction2)\n\n# Add constraints\n## The company has a total budget of $1,000,000\nmodel.addCons(Trucks1 + Trucks2 + Drivers1 + Drivers2 + Fuel1 + Fuel2 + Maintenance1 + Maintenance2 + TechUpgrade1 + TechUpgrade2 <= 1000000)\n## The total number of drivers available is limited to 500\nmodel.addCons(Drivers1 + Drivers2 <= 500)\n## Each type of truck must have at least one driver for every two trucks\nmodel.addCons(Drivers1 >= Trucks1 / 2)\nmodel.addCons(Drivers2 >= Trucks2 / 2)\n## The company must stockpile at least 10,000 liters of fuel for Type1 trucks and 15,000 liters for Type2 trucks\nmodel.addCons(Fuel1 >= 10000)\nmodel.addCons(Fuel2 >= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Type1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks Type2: \", model.getVal(Trucks2))\n    print(\"Number of Drivers Type1: \", model.getVal(Drivers1))\n    print(\"Number of Drivers Type2: \", model.getVal(Drivers2))\n    print(\"Fuel Stock Type1: \", model.getVal(Fuel1))\n    print(\"Fuel Stock Type2: \", model.getVal(Fuel2))\n    print(\"Maintenance Investment Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment Type2: \", model.getVal(Maintenance2))\n    print(\"Tech Upgrade Investment Type1: \", model.getVal(TechUpgrade1))\n    print(\"Tech Upgrade Investment Type2: \", model.getVal(TechUpgrade2))\n    print(\"Maximized Quarterly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1416,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each device, which affects the sales rate.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for DeviceA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\n// Total profit for DeviceB: ProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\n// Total profit for DeviceC: ProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n// UnitsA >= 1000; UnitsB >= 1500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the level of automation to implement in the production process, which affects the production cost per unit and the production rate. Additionally, the company needs to decide on the marketing budget for each device, which affects the sales rate. The production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices.\n\nThe company has a total production capacity of 10,000 units across all devices. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $100,000. Due to market demand, the company must produce at least 1000 units of DeviceA and 1500 units of DeviceB.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1000) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1500) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for DeviceA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for DeviceB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for DeviceC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for DeviceA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for DeviceB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for DeviceC\n\n# Define objective function\nProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $100,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Automation Level for DeviceA: \", model.getVal(AutomationA))\n    print(\"Automation Level for DeviceB: \", model.getVal(AutomationB))\n    print(\"Automation Level for DeviceC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for DeviceA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for DeviceB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for DeviceC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels.\n// {\"number of trucks on Route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumption_A = k * SpeedA^3 * TrucksA\n// FuelConsumption_B = k * SpeedB^3 * TrucksB\n// FuelConsumption_C = k * SpeedC^3 * TrucksC\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe maximum speed allowed on Route A is 60 km/h.\n// SpeedA <= 60",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels. The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Number of Trucks | Speed (km/h) |\n|-------|------------------|--------------|\n| A     | TrucksA          | SpeedA       |\n| B     | TrucksB          | SpeedB       |\n| C     | TrucksC          | SpeedC       |\n\nThe company has a total of 50 trucks available. The maximum speed allowed on Route A is 60 km/h.\n\nPlease help the company to determine the optimal number of trucks and their speeds on each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks on Route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks on Route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks on Route C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks on Route A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks on Route B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0)  # speed of trucks on Route C\n\n# Define objective function\nk = 0.0001  # constant for fuel consumption formula\nFuelConsumption_A = k * SpeedA**3 * TrucksA\nFuelConsumption_B = k * SpeedB**3 * TrucksB\nFuelConsumption_C = k * SpeedC**3 * TrucksC\n# So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The maximum speed allowed on Route A is 60 km/h.\nmodel.addCons(SpeedA <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks on Route A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks on Route B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks on Route C: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"storage cost per unit of product A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit of product B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit of product C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The cost of raw materials and labor for product A is $20, product B is $30, and product C is $40. The storage cost per unit per day for product A is $5, product B is $7, and product C is $9. The company wants to maximize the total daily profit.\n// Profit_A = A * (50 - 20 - SA)\n// Profit_B = B * (70 - 30 - SB)\n// Profit_C = C * (90 - 40 - SC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total storage capacity for all products is limited to 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for raw materials and labor per day.\n// 20 * A + 30 * B + 40 * C <= 5000\n\n## Generate Constraint-3:\nThe storage cost for each product must not exceed the profit per unit.\n// SA <= (50 - 20)\n// SB <= (70 - 30)\n// SC <= (90 - 40)\n\n## Generate Constraint-4:\nThe production of product A must be at least twice the production of product B.\n// A >= 2 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit of product A is $50, product B is $70, and product C is $90. The cost of raw materials and labor for product A is $20, product B is $30, and product C is $40. The storage cost per unit per day for product A is $5, product B is $7, and product C is $9. The company wants to maximize the total daily profit.\nThe total storage capacity for all products is limited to 1000 units. The company has a budget of $5000 for raw materials and labor per day. The storage cost for each product must not exceed the profit per unit. The production of product A must be at least twice the production of product B.\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize their total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nSA = model.addVar(vtype=\"CONTINUOUS\", name=\"SA\", lb=0) # storage cost per unit of product A\nSB = model.addVar(vtype=\"CONTINUOUS\", name=\"SB\", lb=0) # storage cost per unit of product B\nSC = model.addVar(vtype=\"CONTINUOUS\", name=\"SC\", lb=0) # storage cost per unit of product C\n\n# Define objective function\nProfit_A = A * (50 - 20 - SA)\nProfit_B = B * (70 - 30 - SB)\nProfit_C = C * (90 - 40 - SC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000) # total storage capacity constraint\nmodel.addCons(20 * A + 30 * B + 40 * C <= 5000) # budget constraint for raw materials and labor\nmodel.addCons(SA <= 30) # storage cost for product A must not exceed profit per unit\nmodel.addCons(SB <= 40) # storage cost for product B must not exceed profit per unit\nmodel.addCons(SC <= 50) # storage cost for product C must not exceed profit per unit\nmodel.addCons(A >= 2 * B) # production of product A must be at least twice the production of product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Storage Cost for Product A: \", model.getVal(SA))\n    print(\"Storage Cost for Product B: \", model.getVal(SB))\n    print(\"Storage Cost for Product C: \", model.getVal(SC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. They need to determine the production quantities of each component to optimize their manufacturing process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost of each component decreases nonlinearly with increased production due to economies of scale. The cost function for each component is defined as:\n- Cost_A = 100 / (1 + 0.01 * A)^2\n- Cost_B = 120 / (1 + 0.01 * B)^2\n- Cost_C = 150 / (1 + 0.01 * C)^2\n- Cost_D = 130 / (1 + 0.01 * D)^2\n- Cost_E = 140 / (1 + 0.01 * E)^2\nThe company wants to minimize the total production cost of all components.\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for the production of these components.\n// 100 / (1 + 0.01 * A)^2 * A + 120 / (1 + 0.01 * B)^2 * B + 150 / (1 + 0.01 * C)^2 * C + 130 / (1 + 0.01 * D)^2 * D + 140 / (1 + 0.01 * E)^2 * E <= 5000",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. They need to determine the production quantities of each component to optimize their manufacturing process. The cost of producing each component decreases nonlinearly with increased production due to economies of scale. The cost function for each component is defined as:\n- Cost_A = 100 / (1 + 0.01 * A)^2\n- Cost_B = 120 / (1 + 0.01 * B)^2\n- Cost_C = 150 / (1 + 0.01 * C)^2\n- Cost_D = 130 / (1 + 0.01 * D)^2\n- Cost_E = 140 / (1 + 0.01 * E)^2\n\nThe company has a limited budget of $5000 for the production of these components. Please help the company to minimize the total production cost of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define cost functions\nCost_A = 100 / (1 + 0.01 * A)**2 * A\nCost_B = 120 / (1 + 0.01 * B)**2 * B\nCost_C = 150 / (1 + 0.01 * C)**2 * C\nCost_D = 130 / (1 + 0.01 * D)**2 * D\nCost_E = 140 / (1 + 0.01 * E)**2 * E\n\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a limited budget of $5000 for the production of these components.\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Quantity of Component D: \", model.getVal(D))\n    print(\"Quantity of Component E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 694,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepsA\", \"range\": \"SalesRepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepsB\", \"range\": \"SalesRepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepsC\", \"range\": \"SalesRepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\n// Total revenue for ProductB: RevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\n// Total revenue for ProductC: RevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 sales representatives available.\n// SalesRepsA + SalesRepsB + SalesRepsC <= 50\n\n## Generate Constraint-3:\nThe production capacity for each product is limited. ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n// QuantityA >= 100; QuantityB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives, and is calculated using the formula: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n\nThe company has the following constraints:\n1. The total marketing budget for all products cannot exceed $100,000.\n2. The company has a total of 50 sales representatives available.\n3. The production capacity for each product is limited. ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n4. The company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n\nPlease help the company to determine the optimal production quantity, marketing budget, and number of sales representatives for each product to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=100) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=200) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nSalesRepsA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsA\", lb=0) # number of sales representatives for ProductA\nSalesRepsB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsB\", lb=0) # number of sales representatives for ProductB\nSalesRepsC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsC\", lb=0) # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\nRevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\nRevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\nmodel.addCons(SalesRepsA + SalesRepsB + SalesRepsC <= 50)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1500)\nmodel.addCons(QuantityC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Sales Reps for ProductA: \", model.getVal(SalesRepsA))\n    print(\"Number of Sales Reps for ProductB: \", model.getVal(SalesRepsB))\n    print(\"Number of Sales Reps for ProductC: \", model.getVal(SalesRepsC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1340,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs.\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology investment for heavy trucks\": \"TechInvestHeavy\", \"range\": \"TechInvestHeavy >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for medium trucks\": \"TechInvestMedium\", \"range\": \"TechInvestMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for light trucks\": \"TechInvestLight\", \"range\": \"TechInvestLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n// Total profit for heavy trucks: ProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\n// Total profit for medium trucks: ProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\n// Total profit for light trucks: ProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n// So, the objective function is: Maximize (ProfitHeavy + ProfitMedium + ProfitLight)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments.\n// HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50 due to operational constraints.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50\n\n## Generate Constraint-3:\nDue to market demand, the company must have at least 10 heavy trucks and 15 medium trucks.\n// HeavyTrucks >= 10; MediumTrucks >= 15\n\n## Generate Constraint-4:\nThe technology investment for each type of truck must not exceed 50% of the total cost of that type of truck.\n// TechInvestHeavy <= 0.5 * HeavyTrucks\n// TechInvestMedium <= 0.5 * MediumTrucks\n// TechInvestLight <= 0.5 * LightTrucks",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs. The company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments. The total number of trucks cannot exceed 50 due to operational constraints. Due to market demand, the company must have at least 10 heavy trucks and 15 medium trucks. The technology investment for each type of truck must not exceed 50% of the total cost of that type of truck.\n\nPlease help the company to maximize its annual profit from the truck fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=10)  # number of heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=15)  # number of medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nTechInvestHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestHeavy\", lb=0)  # technology investment for heavy trucks\nTechInvestMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestMedium\", lb=0)  # technology investment for medium trucks\nTechInvestLight = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestLight\", lb=0)  # technology investment for light trucks\n\n# Define objective function\nProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\nProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\nProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHeavy + ProfitMedium + ProfitLight)\n\n# Add constraints\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000)\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\nmodel.addCons(TechInvestHeavy <= 0.5 * HeavyTrucks)\nmodel.addCons(TechInvestMedium <= 0.5 * MediumTrucks)\nmodel.addCons(TechInvestLight <= 0.5 * LightTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Technology Investment for Heavy Trucks: \", model.getVal(TechInvestHeavy))\n    print(\"Technology Investment for Medium Trucks: \", model.getVal(TechInvestMedium))\n    print(\"Technology Investment for Light Trucks: \", model.getVal(TechInvestLight))\n    print(\"Maximized Annual Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel.\n// {\"number of trucks for Route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route 1: Fuel1 = 0.002 * Speed1^2 * Trucks1 * Distance1\n// Fuel consumption for Route 2: Fuel2 = 0.003 * Speed2^2 * Trucks2 * Distance2\n// Fuel consumption for Route 3: Fuel3 = 0.004 * Speed3^2 * Trucks3 * Distance3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe total number of trucks available for all routes is 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by all trucks should not exceed 10,000 kilometers.\n// Speed1 * Trucks1 * Distance1 + Speed2 * Trucks2 * Distance2 + Speed3 * Trucks3 * Distance3 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Fuel Consumption Function |\n|-------|---------------------------|\n| 1     | 0.002 * Speed1^2         |\n| 2     | 0.003 * Speed2^2         |\n| 3     | 0.004 * Speed3^2         |\n\nThe total number of trucks available for all routes is 50. The total distance that can be covered by all trucks should not exceed 10,000 kilometers. Please help the company to determine the optimal number of trucks and their speeds to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=60)  # speed of trucks on Route 3\n\n# Define objective function\nFuel1 = 0.002 * Speed1**2 * Trucks1 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0)  # Fuel consumption for Route 1\nFuel2 = 0.003 * Speed2**2 * Trucks2 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0)  # Fuel consumption for Route 2\nFuel3 = 0.004 * Speed3**2 * Trucks3 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance3\", lb=0)  # Fuel consumption for Route 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)  # Minimize total fuel consumption\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)  # Total number of trucks available\nmodel.addCons(Speed1 * Trucks1 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0) +\n              Speed2 * Trucks2 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0) +\n              Speed3 * Trucks3 * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance3\", lb=0) <= 10000)  # Total distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks on Route 1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route 2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks on Route 3: \", model.getVal(Speed3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A consumes 10 liters per 100 km and can carry 10 tons.\n- Truck B consumes 15 liters per 100 km and can carry 15 tons.\n- Truck C consumes 20 liters per 100 km and can carry 20 tons.\n- Truck D consumes 25 liters per 100 km and can carry 25 tons.\n- Truck E consumes 30 liters per 100 km and can carry 30 tons.\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons.\n// Fuel consumption of A: FC_A = 10 * A\n// Fuel consumption of B: FC_B = 15 * B\n// Fuel consumption of C: FC_C = 20 * C\n// Fuel consumption of D: FC_D = 25 * D\n// Fuel consumption of E: FC_E = 30 * E\n// So, the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet the demand of 1000 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to maintain at most 50 trucks.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel efficiency and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/100 km) | Cargo Capacity (tons) |\n|------------|----------------------------------|-----------------------|\n| A          | 10                               | 10                    |\n| B          | 15                               | 15                    |\n| C          | 20                               | 20                    |\n| D          | 25                               | 25                    |\n| E          | 30                               | 30                    |\n\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons. The company has a budget to maintain at most 50 trucks.\nPlease help the company to minimize the total fuel consumption while meeting the cargo capacity demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC_A = 10 * A\nFC_B = 15 * B\nFC_C = 20 * C\nFC_D = 25 * D\nFC_E = 30 * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FC_A + FC_B + FC_C + FC_D + FC_E)\n\n# Add constraints\n## The total cargo capacity must meet the demand of 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n## The company has a budget to maintain at most 50 trucks.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and E-readers. The company needs to decide on the production quantities for each device to optimize their profit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"quantity of E-readers\": \"E-readers\", \"range\": \"E-readers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for E-readers is $150. Due to economies of scale, the profit per unit increases by $0.5 for each additional unit produced beyond the first 100 units for each product. The company aims to maximize the total profit from the production of these devices.\n// Profit_Smartphones = max(100 + 0.5 * (Smartphones - 100), 100) * Smartphones\n// Profit_Tablets = max(200 + 0.5 * (Tablets - 100), 200) * Tablets\n// Profit_Laptops = max(300 + 0.5 * (Laptops - 100), 300) * Laptops\n// Profit_Smartwatches = max(50 + 0.5 * (Smartwatches - 100), 50) * Smartwatches\n// Profit_E-readers = max(150 + 0.5 * (E-readers - 100), 150) * E-readers\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_E-readers\n\n## Generate Constraint-1:\nThe company has a total production budget of $50,000. The cost per unit for Smartphones is $50, for Tablets is $100, for Laptops is $200, for Smartwatches is $25, and for E-readers is $75.\n// 50 * Smartphones + 100 * Tablets + 200 * Laptops + 25 * Smartwatches + 75 * E-readers <= 50000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 500 units across all products.\n// Smartphones + Tablets + Laptops + Smartwatches + E-readers <= 500\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 200 units, for Tablets is at most 150 units, for Laptops is at most 100 units, for Smartwatches is at most 300 units, and for E-readers is at most 250 units.\n// Smartphones <= 200; Tablets <= 150; Laptops <= 100; Smartwatches <= 300; E-readers <= 250\n\n## Generate Constraint-4:\nThe company aims to produce at least 50 units of each product to maintain operational efficiency.\n// Smartphones >= 50; Tablets >= 50; Laptops >= 50; Smartwatches >= 50; E-readers >= 50",
        "question": "A manufacturer produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and E-readers. The company needs to decide on the production quantities for each device to optimize their profit. The profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for E-readers is $150. Due to economies of scale, the profit per unit increases by $0.5 for each additional unit produced beyond the first 100 units for each product. The company has a total production budget of $50,000. The cost per unit for Smartphones is $50, for Tablets is $100, for Laptops is $200, for Smartwatches is $25, and for E-readers is $75. The company has a limited production capacity of 500 units across all products. The market demand for Smartphones is at most 200 units, for Tablets is at most 150 units, for Laptops is at most 100 units, for Smartwatches is at most 300 units, and for E-readers is at most 250 units. The company aims to produce at least 50 units of each product to maintain operational efficiency. Please help the company to maximize the total profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=50, ub=200)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=50, ub=150)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=50, ub=100)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=50, ub=300)\nE_readers = model.addVar(vtype=\"INTEGER\", name=\"E-readers\", lb=50, ub=250)\n\n# Define objective function\n# create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.5 * (Smartphones - 100), 100) * Smartphones\nSmartphones1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones1\", lb=0, ub=100)\nSmartphones2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones2\", lb=100, ub=200)\nSmartphones_b1 = model.addVar(vtype=\"B\", name=\"Smartphones_b1\")\nSmartphones_b2 = model.addVar(vtype=\"B\", name=\"Smartphones_b2\")\nmodel.addCons(Smartphones_b1 + Smartphones_b2 == 1)\nmodel.addCons(Smartphones == Smartphones1*Smartphones_b1 + Smartphones2*Smartphones_b2)\nProfit_Smartphones = 100 * Smartphones1 * Smartphones_b1 + (100 + 0.5 * (Smartphones2 - 100)) * Smartphones2 * Smartphones_b2\n\n# create piecewise variables for piecewise function: Profit_Tablets = max(200 + 0.5 * (Tablets - 100), 200) * Tablets\nTablets1 = model.addVar(vtype=\"INTEGER\", name=\"Tablets1\", lb=0, ub=100)\nTablets2 = model.addVar(vtype=\"INTEGER\", name=\"Tablets2\", lb=100, ub=150)\nTablets_b1 = model.addVar(vtype=\"B\", name=\"Tablets_b1\")\nTablets_b2 = model.addVar(vtype=\"B\", name=\"Tablets_b2\")\nmodel.addCons(Tablets_b1 + Tablets_b2 == 1)\nmodel.addCons(Tablets == Tablets1*Tablets_b1 + Tablets2*Tablets_b2)\nProfit_Tablets = 200 * Tablets1 * Tablets_b1 + (200 + 0.5 * (Tablets2 - 100)) * Tablets2 * Tablets_b2\n\n# create piecewise variables for piecewise function: Profit_Laptops = max(300 + 0.5 * (Laptops - 100), 300) * Laptops\nLaptops1 = model.addVar(vtype=\"INTEGER\", name=\"Laptops1\", lb=0, ub=100)\nLaptops2 = model.addVar(vtype=\"INTEGER\", name=\"Laptops2\", lb=100, ub=100)\nLaptops_b1 = model.addVar(vtype=\"B\", name=\"Laptops_b1\")\nLaptops_b2 = model.addVar(vtype=\"B\", name=\"Laptops_b2\")\nmodel.addCons(Laptops_b1 + Laptops_b2 == 1)\nmodel.addCons(Laptops == Laptops1*Laptops_b1 + Laptops2*Laptops_b2)\nProfit_Laptops = 300 * Laptops1 * Laptops_b1 + (300 + 0.5 * (Laptops2 - 100)) * Laptops2 * Laptops_b2\n\n# create piecewise variables for piecewise function: Profit_Smartwatches = max(50 + 0.5 * (Smartwatches - 100), 50) * Smartwatches\nSmartwatches1 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches1\", lb=0, ub=100)\nSmartwatches2 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches2\", lb=100, ub=300)\nSmartwatches_b1 = model.addVar(vtype=\"B\", name=\"Smartwatches_b1\")\nSmartwatches_b2 = model.addVar(vtype=\"B\", name=\"Smartwatches_b2\")\nmodel.addCons(Smartwatches_b1 + Smartwatches_b2 == 1)\nmodel.addCons(Smartwatches == Smartwatches1*Smartwatches_b1 + Smartwatches2*Smartwatches_b2)\nProfit_Smartwatches = 50 * Smartwatches1 * Smartwatches_b1 + (50 + 0.5 * (Smartwatches2 - 100)) * Smartwatches2 * Smartwatches_b2\n\n# create piecewise variables for piecewise function: Profit_E-readers = max(150 + 0.5 * (E-readers - 100), 150) * E-readers\nE_readers1 = model.addVar(vtype=\"INTEGER\", name=\"E-readers1\", lb=0, ub=100)\nE_readers2 = model.addVar(vtype=\"INTEGER\", name=\"E-readers2\", lb=100, ub=250)\nE_readers_b1 = model.addVar(vtype=\"B\", name=\"E-readers_b1\")\nE_readers_b2 = model.addVar(vtype=\"B\", name=\"E-readers_b2\")\nmodel.addCons(E_readers_b1 + E_readers_b2 == 1)\nmodel.addCons(E_readers == E_readers1*E_readers_b1 + E_readers2*E_readers_b2)\nProfit_E_readers = 150 * E_readers1 * E_readers_b1 + (150 + 0.5 * (E_readers2 - 100)) * E_readers2 * E_readers_b2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_E-readers\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_E_readers)\n\n# Add constraints\nmodel.addCons(50 * Smartphones + 100 * Tablets + 200 * Laptops + 25 * Smartwatches + 75 * E_readers <= 50000)\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + E_readers <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Quantity of E-readers: \", model.getVal(E_readers))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various locations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The company has three types of trucks: TruckA, TruckB, and TruckC.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type increases with the investment in upgrades. For every $1000 invested in upgrades for TruckA, the fuel efficiency improves by 5%. For TruckB, the improvement is 4% per $1000, and for TruckC, it's 3% per $1000. The company aims to minimize the total fuel cost across all trucks, considering the initial fuel consumption rates of 100, 120, and 150 liters per 100 km for TruckA, TruckB, and TruckC, respectively.\n// Fuel cost for TruckA: CostA = (100 * (1 - 0.05 * UpgradeA / 1000)) * TruckA\n// Fuel cost for TruckB: CostB = (120 * (1 - 0.04 * UpgradeB / 1000)) * TruckB\n// Fuel cost for TruckC: CostC = (150 * (1 - 0.03 * UpgradeC / 1000)) * TruckC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + UpgradeA + UpgradeB + UpgradeC <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various locations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The company has three types of trucks: TruckA, TruckB, and TruckC. The fuel efficiency of each truck type increases with the investment in upgrades. For every $1000 invested in upgrades for TruckA, the fuel efficiency improves by 5%. For TruckB, the improvement is 4% per $1000, and for TruckC, it's 3% per $1000. The company aims to minimize the total fuel cost across all trucks, considering the initial fuel consumption rates of 100, 120, and 150 liters per 100 km for TruckA, TruckB, and TruckC, respectively. The company has a budget of $100,000 for truck allocations and fuel efficiency upgrades. Please help the company to minimize the total fuel cost across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0) # fuel efficiency upgrade for TruckA\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0) # fuel efficiency upgrade for TruckB\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0) # fuel efficiency upgrade for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for TruckA: CostA = (100 * (1 - 0.05 * UpgradeA / 1000)) * TruckA\n## Fuel cost for TruckB: CostB = (120 * (1 - 0.04 * UpgradeB / 1000)) * TruckB\n## Fuel cost for TruckC: CostC = (150 * (1 - 0.03 * UpgradeC / 1000)) * TruckC\nCostA = 100 * (1 - 0.05 * UpgradeA / 1000) * TruckA\nCostB = 120 * (1 - 0.04 * UpgradeB / 1000) * TruckB\nCostC = 150 * (1 - 0.03 * UpgradeC / 1000) * TruckC\n## the objective function is: Minimize (CostA + CostB + CostC)\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n## The company has a budget of $100,000 for truck allocations and fuel efficiency upgrades.\nmodel.addCons(TruckA + TruckB + TruckC + UpgradeA + UpgradeB + UpgradeC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing electronic components. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine produces a different type of component. \nOn machine 1, each worker produces 10 units of component 1 per hour. \nOn machine 2, each worker produces 15 units of component 2 per hour. \nOn machine 3, each worker produces 20 units of component 3 per hour. \nOn machine 4, each worker produces 25 units of component 4 per hour. \nOn machine 5, each worker produces 30 units of component 5 per hour. \nThe company needs to produce at least 500 units of each component. The five machines can only be operated or shut down at the same time. The objective is to minimize the total production time to meet the weekly demand.\n// The production time for component 1: T1 = 500 / (10 * M1)\n// The production time for component 2: T2 = 500 / (15 * M2)\n// The production time for component 3: T3 = 500 / (20 * M3)\n// The production time for component 4: T4 = 500 / (25 * M4)\n// The production time for component 5: T5 = 500 / (30 * M5)\n// So, the objective function is: Minimize max(T1, T2, T3, T4, T5)\n// Minimize max(500 / (10 * M1), 500 / (15 * M2), 500 / (20 * M3), 500 / (25 * M4), 500 / (30 * M5))\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 60",
        "question": "A manufacturing company has 5 different machines for producing electronic components. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency. Each machine produces a different type of component:\n- On machine 1, each worker produces 10 units of component 1 per hour.\n- On machine 2, each worker produces 15 units of component 2 per hour.\n- On machine 3, each worker produces 20 units of component 3 per hour.\n- On machine 4, each worker produces 25 units of component 4 per hour.\n- On machine 5, each worker produces 30 units of component 5 per hour.\nThe company needs to produce at least 500 units of each component. The five machines can only be operated or shut down at the same time. The objective is to minimize the total production time to meet the weekly demand. There are total 60 workers available.\nPlease help the company to minimize the maximum production time for any component (which is defined as the maximum of the production times for each component).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT1 = 500 / (10 * M1)\nT2 = 500 / (15 * M2)\nT3 = 500 / (20 * M3)\nT4 = 500 / (25 * M4)\nT5 = 500 / (30 * M5)\n## convert the division to multiplication\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\nmodel.addCons(obj >= T4)\nmodel.addCons(obj >= T5)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(M5))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip decreases by $2 for every $100 invested in upgrades. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips.\n// Operational cost for Truck1: Cost1 = (100 - 0.02 * Upgrade1) * Trips1\n// Operational cost for Truck2: Cost2 = (120 - 0.02 * Upgrade2) * Trips2\n// Operational cost for Truck3: Cost3 = (110 - 0.02 * Upgrade3) * Trips3\n// Operational cost for Truck4: Cost4 = (90 - 0.02 * Upgrade4) * Trips4\n// Operational cost for Truck5: Cost5 = (130 - 0.02 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for both trip operations and upgrades.\n// (100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000",
        "question": "A logistics company is planning its routes for the next quarter and needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. The company is also considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip. The initial operational cost per trip and the effect of upgrades on operational costs are given in the following Table.\n\n| Truck | Initial Operational Cost per Trip | Reduction in Cost per $100 Invested |\n|-------|-----------------------------------|-------------------------------------|\n| Truck1 | $100                             | $2                                  |\n| Truck2 | $120                             | $2                                  |\n| Truck3 | $110                             | $2                                  |\n| Truck4 | $90                              | $2                                  |\n| Truck5 | $130                             | $2                                  |\n\nThe company has a budget of $20,000 for both trip operations and upgrades. The company aims to minimize the total operational cost of all trips. Please help the company determine the optimal number of trips for each truck and the amount to invest in fuel-efficient upgrades for each truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips for Truck5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in fuel-efficient upgrades for Truck3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in fuel-efficient upgrades for Truck4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in fuel-efficient upgrades for Truck5\n\n# Define objective function\nCost1 = (100 - 0.02 * Upgrade1) * Trips1\nCost2 = (120 - 0.02 * Upgrade2) * Trips2\nCost3 = (110 - 0.02 * Upgrade3) * Trips3\nCost4 = (90 - 0.02 * Upgrade4) * Trips4\nCost5 = (130 - 0.02 * Upgrade5) * Trips5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a budget of $20,000 for both trip operations and upgrades.\nmodel.addCons((100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + \n              (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + \n              (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Truck5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrades for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrades for Truck4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrades for Truck5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of wireless headphones produced\": \"Headphones\", \"range\": \"Headphones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets $80, laptops $200, smartwatches $50, and headphones $30. The production cost per unit for smartphones is $60, tablets $50, laptops $120, smartwatches $30, and headphones $20. The company wants to maximize the net profit, which is the difference between the revenue and the cost of production.\n// Revenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\n// Cost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production cost should not exceed $100,000.\n// 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity. The profit per unit and the production cost per unit for each device are given in the following Table.\n\n| Device         | Profit per Unit | Production Cost per Unit |\n|----------------|-----------------|--------------------------|\n| Smartphones    | $100            | $60                      |\n| Tablets        | $80             | $50                      |\n| Laptops        | $200            | $120                     |\n| Smartwatches   | $50             | $30                      |\n| Headphones     | $30             | $20                      |\n\nThe total production cost should not exceed $100,000. Please help the company to maximize the net profit, which is the difference between the revenue and the cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nHeadphones = model.addVar(vtype=\"INTEGER\", name=\"Headphones\", lb=0)\n\n# Define objective function\nRevenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\nCost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\nNetProfit = Revenue - Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Headphones: \", model.getVal(Headphones))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"number of batteries for energy storage\": \"Batteries\", \"range\": \"Batteries >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to geographical and weather conditions. The efficiency is 20% for Location A, 25% for Location B, and 18% for Location C. The wind turbines have an efficiency of 30% at Location A, 28% at Location B, and 32% at Location C. Each battery has a capacity of 100 kWh. The company aims to minimize the total cost of energy generation and storage, which is a nonlinear function of the number of installations and batteries.\n// Total energy generated: Energy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\n// Total cost: Cost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations and batteries.\n// (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000\n\n## Generate Constraint-2:\nThe total energy generated must be at least 5000 kWh to meet the company's needs.\n// 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC >= 5000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries. The efficiency of solar panels and wind turbines at each location varies, and each battery has a capacity of 100 kWh. The company aims to minimize the total cost of energy generation and storage.\n\n| Component       | Location A Efficiency | Location B Efficiency | Location C Efficiency | Cost per Unit |\n|-----------------|-----------------------|-----------------------|-----------------------|---------------|\n| Solar Panels    | 20%                   | 25%                   | 18%                   | $1000         |\n| Wind Turbines   | 30%                   | 28%                   | 32%                   | $1500         |\n| Batteries       | -                     | -                     | -                     | $500          |\n\nThe company has a budget of $100,000 for the installations and batteries. The total energy generated must be at least 5000 kWh to meet the company's needs.\n\nPlease help the company to determine the optimal number of solar panels, wind turbines, and batteries to install at each location to minimize the total cost of energy generation and storage, given the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Location A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Location B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Location C\nBatteries = model.addVar(vtype=\"INTEGER\", name=\"Batteries\", lb=0) # number of batteries for energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\nCost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations and batteries.\nmodel.addCons((SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000)\n## The total energy generated must be at least 5000 kWh to meet the company's needs.\nmodel.addCons(0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Location B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Location C: \", model.getVal(WindC))\n    print(\"Number of Batteries: \", model.getVal(Batteries))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1408,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost.\n// Efficiency_Truck = 100 * T / (5 * T)\n// Efficiency_Van = 70 * V / (3 * V)\n// Efficiency_Bike = 30 * B / (0 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for fuel costs per day.\n// 5 * T + 3 * V <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of deliveries does not exceed 2000 per day.\n// 100 * T + 70 * V + 30 * B <= 2000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost. The company has a budget of $1000 for fuel costs per day. The company has a total of 50 drivers available. The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company wants to ensure that the total number of deliveries does not exceed 2000 per day. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their total efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = 100 * T / (5 * T)\nEfficiency_Van = 70 * V / (3 * V)\nEfficiency_Bike = 30 * B / (0 * B)\n## the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n## The company has a budget of $1000 for fuel costs per day.\nmodel.addCons(5 * T + 3 * V <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company wants to ensure that the total number of deliveries does not exceed 2000 per day.\nmodel.addCons(100 * T + 70 * V + 30 * B <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste.\n// {\"number of solar panels\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WT\", \"range\": \"WT >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for solar\": \"ESS_SP\", \"range\": \"ESS_SP >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for wind\": \"ESS_WT\", \"range\": \"ESS_WT >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. Similarly, the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar: Energy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\n// Total energy production from wind: Energy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\n// So, the objective function is: Maximize (Energy_SP + Energy_WT)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for investments in energy storage systems.\n// ESS_SP + ESS_WT <= 200000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) must not exceed 1000 units.\n// SP + WT <= 1000\n\n## Generate Constraint-3:\nDue to environmental regulations, the number of wind turbines must not exceed half the number of solar panels.\n// WT <= 0.5 * SP",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. They need to determine the number of solar panels (SP) and wind turbines (WT) to install in each region, as well as the investment in energy storage systems (ESS) for each type of installation. The energy storage systems will enhance the efficiency of energy production and reduce energy waste. The efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems, and the efficiency of wind turbines increases by 1.5% for every $10,000 invested in their energy storage systems. The initial efficiency of solar panels is 20%, and for wind turbines is 30%. The company aims to maximize the total energy production.\n\n| Component | Initial Efficiency | Efficiency Increase per $10,000 Investment |\n|-----------|---------------------|--------------------------------------------|\n| Solar Panels (SP) | 20% | 1% |\n| Wind Turbines (WT) | 30% | 1.5% |\n\nThe company has a budget of $200,000 for investments in energy storage systems. The total number of installations (solar panels and wind turbines) must not exceed 1000 units. Due to environmental regulations, the number of wind turbines must not exceed half the number of solar panels.\n\nPlease help the company to maximize the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0)  # number of solar panels\nWT = model.addVar(vtype=\"INTEGER\", name=\"WT\", lb=0)  # number of wind turbines\nESS_SP = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_SP\", lb=0)  # investment in energy storage for solar\nESS_WT = model.addVar(vtype=\"CONTINUOUS\", name=\"ESS_WT\", lb=0)  # investment in energy storage for wind\n\n# Define objective function\nEnergy_SP = 0.2 * SP * (1 + 0.0001 * ESS_SP)\nEnergy_WT = 0.3 * WT * (1 + 0.00015 * ESS_WT)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SP + Energy_WT)\n\n# Add constraints\nmodel.addCons(ESS_SP + ESS_WT <= 200000)  # budget constraint for energy storage systems\nmodel.addCons(SP + WT <= 1000)  # total installations constraint\nmodel.addCons(WT <= 0.5 * SP)  # environmental regulation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SP))\n    print(\"Number of Wind Turbines: \", model.getVal(WT))\n    print(\"Investment in Energy Storage for Solar: \", model.getVal(ESS_SP))\n    print(\"Investment in Energy Storage for Wind: \", model.getVal(ESS_WT))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1331,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wireless Earbuds\": \"WirelessEarbuds\", \"range\": \"WirelessEarbuds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\n// Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\n// Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\n// Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\n// Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all devices.\n// Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $50 per Smartphone, $70 per Tablet, $100 per Laptop, $20 per Smartwatch, and $15 per Wireless Earbud. The total budget for raw materials is $60,000.\n// 50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units.\n// Smartphones <= 300; Tablets <= 200; Laptops <= 150; Smartwatches <= 250; WirelessEarbuds <= 300",
        "question": "A manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints. The profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company has a total production capacity of 1000 units across all devices. The company has a limited budget for raw materials, which costs $50 per Smartphone, $70 per Tablet, $100 per Laptop, $20 per Smartwatch, and $15 per Wireless Earbud, with a total budget of $60,000. The market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units. Please help the company to maximize the total profit from the sales of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nWirelessEarbuds = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\nSmartphones1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones1\", lb=0, ub=100)\nSmartphones2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones2\", lb=100, ub=300)\nSmartphones_b1 = model.addVar(vtype=\"B\", name=\"Smartphones_b1\")\nSmartphones_b2 = model.addVar(vtype=\"B\", name=\"Smartphones_b2\")\nmodel.addCons(Smartphones_b1 + Smartphones_b2 == 1)\nmodel.addCons(Smartphones == Smartphones1*Smartphones_b1 + Smartphones2*Smartphones_b2)\nProfit_Smartphones = 100 * Smartphones1 * Smartphones_b1 + (100 + 0.1 * (Smartphones2 - 100)) * Smartphones2 * Smartphones_b2\n\n## create piecewise variables for piecewise function: Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\nTablets1 = model.addVar(vtype=\"INTEGER\", name=\"Tablets1\", lb=0, ub=100)\nTablets2 = model.addVar(vtype=\"INTEGER\", name=\"Tablets2\", lb=100, ub=200)\nTablets_b1 = model.addVar(vtype=\"B\", name=\"Tablets_b1\")\nTablets_b2 = model.addVar(vtype=\"B\", name=\"Tablets_b2\")\nmodel.addCons(Tablets_b1 + Tablets_b2 == 1)\nmodel.addCons(Tablets == Tablets1*Tablets_b1 + Tablets2*Tablets_b2)\nProfit_Tablets = 200 * Tablets1 * Tablets_b1 + (200 + 0.1 * (Tablets2 - 100)) * Tablets2 * Tablets_b2\n\n## create piecewise variables for piecewise function: Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\nLaptops1 = model.addVar(vtype=\"INTEGER\", name=\"Laptops1\", lb=0, ub=100)\nLaptops2 = model.addVar(vtype=\"INTEGER\", name=\"Laptops2\", lb=100, ub=150)\nLaptops_b1 = model.addVar(vtype=\"B\", name=\"Laptops_b1\")\nLaptops_b2 = model.addVar(vtype=\"B\", name=\"Laptops_b2\")\nmodel.addCons(Laptops_b1 + Laptops_b2 == 1)\nmodel.addCons(Laptops == Laptops1*Laptops_b1 + Laptops2*Laptops_b2)\nProfit_Laptops = 300 * Laptops1 * Laptops_b1 + (300 + 0.1 * (Laptops2 - 100)) * Laptops2 * Laptops_b2\n\n## create piecewise variables for piecewise function: Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\nSmartwatches1 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches1\", lb=0, ub=100)\nSmartwatches2 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches2\", lb=100, ub=250)\nSmartwatches_b1 = model.addVar(vtype=\"B\", name=\"Smartwatches_b1\")\nSmartwatches_b2 = model.addVar(vtype=\"B\", name=\"Smartwatches_b2\")\nmodel.addCons(Smartwatches_b1 + Smartwatches_b2 == 1)\nmodel.addCons(Smartwatches == Smartwatches1*Smartwatches_b1 + Smartwatches2*Smartwatches_b2)\nProfit_Smartwatches = 50 * Smartwatches1 * Smartwatches_b1 + (50 + 0.1 * (Smartwatches2 - 100)) * Smartwatches2 * Smartwatches_b2\n\n## create piecewise variables for piecewise function: Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\nWirelessEarbuds1 = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds1\", lb=0, ub=100)\nWirelessEarbuds2 = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds2\", lb=100, ub=300)\nWirelessEarbuds_b1 = model.addVar(vtype=\"B\", name=\"WirelessEarbuds_b1\")\nWirelessEarbuds_b2 = model.addVar(vtype=\"B\", name=\"WirelessEarbuds_b2\")\nmodel.addCons(WirelessEarbuds_b1 + WirelessEarbuds_b2 == 1)\nmodel.addCons(WirelessEarbuds == WirelessEarbuds1*WirelessEarbuds_b1 + WirelessEarbuds2*WirelessEarbuds_b2)\nProfit_WirelessEarbuds = 30 * WirelessEarbuds1 * WirelessEarbuds_b1 + (30 + 0.1 * (WirelessEarbuds2 - 100)) * WirelessEarbuds2 * WirelessEarbuds_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000)\nmodel.addCons(50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000)\nmodel.addCons(Smartphones <= 300)\nmodel.addCons(Tablets <= 200)\nmodel.addCons(Laptops <= 150)\nmodel.addCons(Smartwatches <= 250)\nmodel.addCons(WirelessEarbuds <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Quantity of Wireless Earbuds: \", model.getVal(WirelessEarbuds))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and efficiency profile. Route 1 has a cost of $100 per truck and an efficiency of 50 units of goods per trip. Route 2 has a cost of $120 per truck and an efficiency of 60 units of goods per trip. Route 3 has a cost of $110 per truck and an efficiency of 55 units of goods per trip. Route 4 has a cost of $90 per truck and an efficiency of 45 units of goods per trip. Route 5 has a cost of $130 per truck and an efficiency of 70 units of goods per trip. The company wants to maximize the total units of goods transported while minimizing the total cost.\n// Total cost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\n// Total goods transported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n// The objective function is: Minimize (Total cost / Total goods transported)\n// Minimize (100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5) / (50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for transporting goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck and the efficiency (units of goods per trip) for each route are given in the following Table.\n\n| Route | Cost per Truck | Efficiency (Units/Trip) |\n|-------|----------------|-------------------------|\n| 1     | $100           | 50                      |\n| 2     | $120           | 60                      |\n| 3     | $110           | 55                      |\n| 4     | $90            | 45                      |\n| 5     | $130           | 70                      |\n\nThe company has a total of 100 trucks available for allocation. The company wants to maximize the total units of goods transported while minimizing the total cost. Please help the company to minimize the ratio of total cost to total goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T1 + 120 * T2 + 110 * T3 + 90 * T4 + 130 * T5\nTotalGoodsTransported = 50 * T1 + 60 * T2 + 55 * T3 + 45 * T4 + 70 * T5\n## the objective function is: Minimize (Total cost / Total goods transported)\n## convert the division to multiplication\nmodel.addCons(obj * TotalGoodsTransported == TotalCost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Unit of Goods Transported: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for ProductA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechInvestC\", \"range\": \"TechInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total investment budget of $50,000 for advanced manufacturing technologies.\n// TechInvestA + TechInvestB + TechInvestC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units.\n// QuantityA <= 400; QuantityB <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductC are produced.\n// QuantityC >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| ProductA | $100                            | $200                   |\n| ProductB | $150                            | $250                   |\n| ProductC | $200                            | $300                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The company has a total investment budget of $50,000 for advanced manufacturing technologies. The total production capacity of the company is limited to 1000 units. Due to market demand, the production of ProductA must not exceed 400 units, and the production of ProductB must not exceed 300 units. The company must ensure that at least 100 units of ProductC are produced.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=100) # quantity of ProductC\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0) # investment in technology for ProductA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0) # investment in technology for ProductB\nTechInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestC\", lb=0) # investment in technology for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\nProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\nProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + TechInvestC <= 50000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\nmodel.addCons(QuantityA <= 400)\nmodel.addCons(QuantityB <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechInvestA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechInvestB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechInvestC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1422,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor hours.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $60, for product D is $80, and for product E is $90. The production cost per unit for product A is $20, for product B is $30, for product C is $25, for product D is $40, and for product E is $50. The company wants to maximize the net profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// Total cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for raw materials and labor.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE <= 50000",
        "question": "A manufacturing company produces five types of products (A, B, C, D, and E) using different raw materials and labor hours. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n| D       | $80             | $40                      |\n| E       | $90             | $50                      |\n\nThe company has a total budget of $50,000 for raw materials and labor. The company wants to maximize the net profit, which is the difference between the total revenue and the total cost.\nPlease help the company determine the optimal number of units to produce for each product to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of product D\nProductE = model.addVar(vtype=\"INTEGER\", name=\"ProductE\", lb=0) # number of units of product E\n\n# Define objective function\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a total budget of $50,000 for raw materials and labor.\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC + 40 * ProductD + 50 * ProductE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Number of Product D: \", model.getVal(ProductD))\n    print(\"Number of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different characteristics in terms of distance, traffic, and road conditions. \nOn route 1, each truck consumes 10 liters of fuel per 100 km and can deliver 50 packages per hour. \nOn route 2, each truck consumes 12 liters of fuel per 100 km and can deliver 60 packages per hour. \nOn route 3, each truck consumes 15 liters of fuel per 100 km and can deliver 70 packages per hour. \nOn route 4, each truck consumes 18 liters of fuel per 100 km and can deliver 80 packages per hour. \nOn route 5, each truck consumes 20 liters of fuel per 100 km and can deliver 90 packages per hour. \nThe company wants to minimize the total fuel consumption while ensuring that all packages are delivered within a specified time frame.\n// Fuel_Consumption_1 = 10 * T1\n// Fuel_Consumption_2 = 12 * T2\n// Fuel_Consumption_3 = 15 * T3\n// Fuel_Consumption_4 = 18 * T4\n// Fuel_Consumption_5 = 20 * T5\n// So, the objective function is: Minimize (Fuel_Consumption_1 + Fuel_Consumption_2 + Fuel_Consumption_3 + Fuel_Consumption_4 + Fuel_Consumption_5) / (50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe total number of packages to be delivered is 5000.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 5000",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. The characteristics of each route in terms of fuel consumption per 100 km and delivery speed are given in the following Table.\n\n| Route | Fuel Consumption (liters/100 km) | Delivery Speed (packages/hour) |\n|-------|----------------------------------|--------------------------------|\n| 1     | 10                               | 50                             |\n| 2     | 12                               | 60                             |\n| 3     | 15                               | 70                             |\n| 4     | 18                               | 80                             |\n| 5     | 20                               | 90                             |\n\nThe company has a total of 100 trucks available. Each route can handle a maximum of 30 trucks. The total number of packages to be delivered is 5000. \nPlease help the company to minimize the total fuel consumption while ensuring that all packages are delivered within a specified time frame.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_1 = 10 * T1\nFuel_Consumption_2 = 12 * T2\nFuel_Consumption_3 = 15 * T3\nFuel_Consumption_4 = 18 * T4\nFuel_Consumption_5 = 20 * T5\nDelivery_Rate = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5\n## the objective function is: Minimize (Fuel_Consumption_1 + Fuel_Consumption_2 + Fuel_Consumption_3 + Fuel_Consumption_4 + Fuel_Consumption_5) / Delivery_Rate\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Rate == Fuel_Consumption_1 + Fuel_Consumption_2 + Fuel_Consumption_3 + Fuel_Consumption_4 + Fuel_Consumption_5)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route can handle a maximum of 30 trucks.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n## The total number of packages to be delivered is 5000.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each route is determined by the number of packages delivered per fuel consumption. \nOn route 1, each truck delivers 100 packages and consumes 10 liters of fuel. \nOn route 2, each truck delivers 120 packages and consumes 12 liters of fuel. \nOn route 3, each truck delivers 150 packages and consumes 15 liters of fuel. \nOn route 4, each truck delivers 180 packages and consumes 18 liters of fuel. \nOn route 5, each truck delivers 200 packages and consumes 20 liters of fuel. \nThe company wants to maximize the total delivery efficiency (total packages delivered per total fuel consumed).\n// Efficiency_R1 = 100 * T1 / (10 * T1)\n// Efficiency_R2 = 120 * T2 / (12 * T2)\n// Efficiency_R3 = 150 * T3 / (15 * T3)\n// Efficiency_R4 = 180 * T4 / (18 * T4)\n// Efficiency_R5 = 200 * T5 / (20 * T5)\n// So, the objective function is: Maximize (Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n// Maximize (100 * T1 / (10 * T1) + 120 * T2 / (12 * T2) + 150 * T3 / (15 * T3) + 180 * T4 / (18 * T4) + 200 * T5 / (20 * T5))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 10 trucks.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. The efficiency of each route is determined by the number of packages delivered per fuel consumption. The details of each route are given in the following Table.\n\n| Route | Packages Delivered per Truck | Fuel Consumed per Truck |\n|-------|------------------------------|-------------------------|\n| 1     | 100                          | 10 liters               |\n| 2     | 120                          | 12 liters               |\n| 3     | 150                          | 15 liters               |\n| 4     | 180                          | 18 liters               |\n| 5     | 200                          | 20 liters               |\n\nThe company has a total of 50 trucks available. Each route can handle a maximum of 10 trucks. Please help the company to maximize the total delivery efficiency (total packages delivered per total fuel consumed).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * T1 / (10 * T1) + 120 * T2 / (12 * T2) + 150 * T3 / (15 * T3) + 180 * T4 / (18 * T4) + 200 * T5 / (20 * T5))\n## convert the division to multiplication\nmodel.addCons(obj * (10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5) == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers.\n// {\"production quantity of ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for production costs and automation investments.\n// (100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// Automation <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n// ProdA <= 500; ProdB <= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of capital to invest in automation technology, which reduces the production cost per unit. The investment in automation technology is a continuous variable, and the production quantities are integers. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| ProductA | $100                            | $150                   |\n| ProductB | $150                            | $200                   |\n| ProductC | $200                            | $250                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The company has a total budget of $100,000 for production costs and automation investments. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity of ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity of ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.005 * Automation)) * ProdA\nProfitB = (200 - (150 - 0.005 * Automation)) * ProdB\nProfitC = (250 - (200 - 0.005 * Automation)) * ProdC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for production costs and automation investments.\nmodel.addCons((100 - 0.005 * Automation) * ProdA + (150 - 0.005 * Automation) * ProdB + (200 - 0.005 * Automation) * ProdC + Automation <= 100000)\n# The total investment in automation technology cannot exceed $20,000.\nmodel.addCons(Automation <= 20000)\n# Due to market demand, the production of ProductA must not exceed 500 units, and the production of ProductB must not exceed 400 units.\nmodel.addCons(ProdA <= 500)\nmodel.addCons(ProdB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the production quantity of each component to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of component 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of component 5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function is nonlinear and is given by:\nProfit_i = (a_i * C_i - b_i * C_i^2) - c_i * C_i, where a_i, b_i, and c_i are constants representing the market price, market saturation, and cost per unit, respectively.\n// The objective function is: Maximize P = (a1 * C1 - b1 * C1^2) - c1 * C1 + (a2 * C2 - b2 * C2^2) - c2 * C2 + (a3 * C3 - b3 * C3^2) - c3 * C3 + (a4 * C4 - b4 * C4^2) - c4 * C4 + (a5 * C5 - b5 * C5^2) - c5 * C5\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// C1 + C2 + C3 + C4 + C5 <= 1000",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the production quantity of each component to maximize profit while considering the cost of raw materials and labor. The profit from each component depends on its production quantity and market demand, with a nonlinear profit function given by: Profit_i = (a_i * C_i - b_i * C_i^2) - c_i * C_i, where a_i, b_i, and c_i are constants representing the market price, market saturation, and cost per unit, respectively. The total production capacity of the company is limited to 1000 units per day.\nPlease help the company determine the optimal production quantity for each component to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # production quantity of component 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # production quantity of component 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # production quantity of component 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # production quantity of component 4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # production quantity of component 5\n\n# Define objective function\n## The profit function is nonlinear and is given by:\n## Profit_i = (a_i * C_i - b_i * C_i^2) - c_i * C_i\n## The objective function is: Maximize P = (a1 * C1 - b1 * C1^2) - c1 * C1 + ... + (a5 * C5 - b5 * C5^2) - c5 * C5\n## Set constants for the profit function\na1, b1, c1 = 10, 0.01, 1  # Example values\na2, b2, c2 = 15, 0.02, 2  # Example values\na3, b3, c3 = 20, 0.03, 3  # Example values\na4, b4, c4 = 25, 0.04, 4  # Example values\na5, b5, c5 = 30, 0.05, 5  # Example values\n\n## Calculate profits for each component\nProfit_C1 = (a1 * C1 - b1 * C1**2) - c1 * C1\nProfit_C2 = (a2 * C2 - b2 * C2**2) - c2 * C2\nProfit_C3 = (a3 * C3 - b3 * C3**2) - c3 * C3\nProfit_C4 = (a4 * C4 - b4 * C4**2) - c4 * C4\nProfit_C5 = (a5 * C5 - b5 * C5**2) - c5 * C5\n\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize P = Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per day.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Component 1: \", model.getVal(C1))\n    print(\"Production Quantity of Component 2: \", model.getVal(C2))\n    print(\"Production Quantity of Component 3: \", model.getVal(C3))\n    print(\"Production Quantity of Component 4: \", model.getVal(C4))\n    print(\"Production Quantity of Component 5: \", model.getVal(C5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The company aims to maximize the total profit, but due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company wants to maximize the total profit from selling these devices.\n// Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\n// Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\n// Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\n// Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\n// Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for device A is $5, for device B is $7, for device C is $9, for device D is $11, and for device E is $13.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 units in total.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units.\n// A >= 50; B >= 75; C >= 100; D >= 125; E >= 150\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. Due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company has a budget of $10,000 for production costs, with the cost per unit for device A being $5, for device B being $7, for device C being $9, for device D being $11, and for device E being $13. The company has a production capacity of 500 units in total. The market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units. The company wants to ensure that the production of device E does not exceed the combined production of devices A, B, C, and D. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=125) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150) # quantity of device E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=75, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.01 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=100, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.01 * (C2 - 100)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=125, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=500)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.01 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=150, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.01 * (E2 - 100)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000)\nmodel.addCons(A + B + C + D + E <= 500)\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $10,000, the material cost is $5,000, and the production time is 10 hours. \nFor Machine M2, the selling price is $15,000, the material cost is $7,000, and the production time is 15 hours. \nFor Machine M3, the selling price is $20,000, the material cost is $9,000, and the production time is 20 hours.\nFor Machine M4, the selling price is $25,000, the material cost is $11,000, and the production time is 25 hours.\nFor Machine M5, the selling price is $30,000, the material cost is $13,000, and the production time is 30 hours.\nThe company aims to maximize the total profit while considering the efficiency of production time.\n// Profit of M1: Profit_M1 = (10,000 - 5,000) * M1\n// Profit of M2: Profit_M2 = (15,000 - 7,000) * M2\n// Profit of M3: Profit_M3 = (20,000 - 9,000) * M3\n// Profit of M4: Profit_M4 = (25,000 - 11,000) * M4\n// Profit of M5: Profit_M5 = (30,000 - 13,000) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for material costs for the quarter.\n// 5,000 * M1 + 7,000 * M2 + 9,000 * M3 + 11,000 * M4 + 13,000 * M5 <= 1,000,000",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter. The selling price, material cost, and production time for each machine are given in the following Table.\n\n| Machine | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| M1      | $10,000       | $5,000        | 10 hours        |\n| M2      | $15,000       | $7,000        | 15 hours        |\n| M3      | $20,000       | $9,000        | 20 hours        |\n| M4      | $25,000       | $11,000       | 25 hours        |\n| M5      | $30,000       | $13,000       | 30 hours        |\n\nThe company has a budget of $1,000,000 for material costs for the quarter. The company aims to maximize the total profit while considering the efficiency of production time. Please help the company to determine the optimal number of units to produce for each machine to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (10000 - 5000) * M1\nProfit_M2 = (15000 - 7000) * M2\nProfit_M3 = (20000 - 9000) * M3\nProfit_M4 = (25000 - 11000) * M4\nProfit_M5 = (30000 - 13000) * M5\nProductionTime = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for material costs for the quarter.\nmodel.addCons(5000 * M1 + 7000 * M2 + 9000 * M3 + 11000 * M4 + 13000 * M5 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location.\n// {\"number of solar panels at location 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output.\n// Energy output from solar panels at location 1: E_S1 = S1 * (1 - 0.01 * S1)\n// Energy output from wind turbines at location 1: E_W1 = W1 * (1 - 0.02 * W1)\n// Energy output from solar panels at location 2: E_S2 = S2 * (1 - 0.01 * S2)\n// Energy output from wind turbines at location 2: E_W2 = W2 * (1 - 0.02 * W2)\n// Energy output from solar panels at location 3: E_S3 = S3 * (1 - 0.01 * S3)\n// Energy output from wind turbines at location 3: E_W3 = W3 * (1 - 0.02 * W3)\n// Energy output from solar panels at location 4: E_S4 = S4 * (1 - 0.01 * S4)\n// Energy output from wind turbines at location 4: E_W4 = W4 * (1 - 0.02 * W4)\n// Energy output from solar panels at location 5: E_S5 = S5 * (1 - 0.01 * S5)\n// Energy output from wind turbines at location 5: E_W5 = W5 * (1 - 0.02 * W5)\n// So, the objective function is: Maximize E_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000.\n// 1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines at each location should not exceed 100.\n// S1 + W1 <= 100; S2 + W2 <= 100; S3 + W3 <= 100; S4 + W4 <= 100; S5 + W5 <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the total budget is spent on solar panels.\n// 1000 * (S1 + S2 + S3 + S4 + S5) >= 0.2 * 500000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The company needs to determine the number of solar panels and wind turbines to install at each location. The efficiency of solar panels decreases with the number of panels installed at a location due to shading effects. The efficiency of wind turbines decreases with the number of turbines installed due to turbulence. The company aims to maximize the total energy output. The company has a budget of $500,000 for installation. The cost of installing a solar panel is $1,000, and a wind turbine is $5,000. The total number of solar panels and wind turbines at each location should not exceed 100. The company wants to ensure that at least 20% of the total budget is spent on solar panels. Please help the company to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels at location 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines at location 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels at location 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines at location 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels at location 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines at location 3\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of solar panels at location 4\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of wind turbines at location 4\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of solar panels at location 5\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## Energy output from solar panels and wind turbines\nE_S1 = S1 * (1 - 0.01 * S1)\nE_W1 = W1 * (1 - 0.02 * W1)\nE_S2 = S2 * (1 - 0.01 * S2)\nE_W2 = W2 * (1 - 0.02 * W2)\nE_S3 = S3 * (1 - 0.01 * S3)\nE_W3 = W3 * (1 - 0.02 * W3)\nE_S4 = S4 * (1 - 0.01 * S4)\nE_W4 = W4 * (1 - 0.02 * W4)\nE_S5 = S5 * (1 - 0.01 * S5)\nE_W5 = W5 * (1 - 0.02 * W5)\n## Objective function: Maximize total energy output\nE_total = E_S1 + E_W1 + E_S2 + E_W2 + E_S3 + E_W3 + E_S4 + E_W4 + E_S5 + E_W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## Budget constraint\nmodel.addCons(1000 * (S1 + S2 + S3 + S4 + S5) + 5000 * (W1 + W2 + W3 + W4 + W5) <= 500000)\n## Total number of installations at each location\nmodel.addCons(S1 + W1 <= 100)\nmodel.addCons(S2 + W2 <= 100)\nmodel.addCons(S3 + W3 <= 100)\nmodel.addCons(S4 + W4 <= 100)\nmodel.addCons(S5 + W5 <= 100)\n## At least 20% of the budget on solar panels\nmodel.addCons(1000 * (S1 + S2 + S3 + S4 + S5) >= 0.2 * 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(W3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(S4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(W4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(S5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(W5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available across all products cannot exceed 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to production capacity constraints, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products. The total workforce available across all products cannot exceed 100 employees. The total investment in automation cannot exceed $50,000. Due to production capacity constraints, the production quantity of each product cannot exceed 500 units. Please help the company to determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\nProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\nProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total workforce available across all products cannot exceed 100 employees.\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n# Due to production capacity constraints, the production quantity of each product cannot exceed 500 units.\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 500)\nmodel.addCons(QuantityC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkforceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility.\n// {\"number of solar facilities\": \"SolarFacilities\", \"range\": \"SolarFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"WindFacilities\", \"range\": \"WindFacilities >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"HydroFacilities\", \"range\": \"HydroFacilities >= 0\", \"type\": \"integer\"}\n// {\"land required for each solar facility (in acres)\": \"LandPerSolarFacility\", \"range\": \"LandPerSolarFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each wind facility (in acres)\": \"LandPerWindFacility\", \"range\": \"LandPerWindFacility >= 0\", \"type\": \"real\"}\n// {\"land required for each hydro facility (in acres)\": \"LandPerHydroFacility\", \"range\": \"LandPerHydroFacility >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to maximize the total annual energy output from these facilities. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe objective is to maximize the total energy output, which is a nonlinear function of the number of facilities and the land required.\n// TotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\n// So, the objective function is: Maximize TotalEnergyOutput\n\n## Generate Constraint-1:\nThe city has a total of 1000 acres of land available for these facilities.\n// SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $5 million for construction costs, with costs per facility as follows:\n- Solar: $1 million\n- Wind: $1.5 million\n- Hydro: $2 million\n// 1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000",
        "question": "A city is planning to build three types of renewable energy facilities: solar, wind, and hydro. The city needs to determine the number of each type of facility to build and the amount of land required for each facility. The city wants to maximize the total annual energy output from these facilities. The energy output per facility is as follows:\n- Solar: 1000 MWh per facility per year\n- Wind: 1500 MWh per facility per year\n- Hydro: 2000 MWh per facility per year\nThe city has a total of 1000 acres of land available for these facilities. The city also has a budget of $5 million for construction costs, with costs per facility as follows:\n- Solar: $1 million\n- Wind: $1.5 million\n- Hydro: $2 million\nPlease help the city to determine the optimal number of each type of facility to build to maximize the total annual energy output while adhering to the land and budget constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarFacilities = model.addVar(vtype=\"INTEGER\", name=\"SolarFacilities\", lb=0)\nWindFacilities = model.addVar(vtype=\"INTEGER\", name=\"WindFacilities\", lb=0)\nHydroFacilities = model.addVar(vtype=\"INTEGER\", name=\"HydroFacilities\", lb=0)\nLandPerSolarFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerSolarFacility\", lb=0)\nLandPerWindFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerWindFacility\", lb=0)\nLandPerHydroFacility = model.addVar(vtype=\"CONTINUOUS\", name=\"LandPerHydroFacility\", lb=0)\n\n# Define objective function\nTotalEnergyOutput = 1000 * SolarFacilities + 1500 * WindFacilities + 2000 * HydroFacilities\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalEnergyOutput)\n\n# Add constraints\nmodel.addCons(SolarFacilities * LandPerSolarFacility + WindFacilities * LandPerWindFacility + HydroFacilities * LandPerHydroFacility <= 1000)\nmodel.addCons(1000000 * SolarFacilities + 1500000 * WindFacilities + 2000000 * HydroFacilities <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(SolarFacilities))\n    print(\"Number of Wind Facilities: \", model.getVal(WindFacilities))\n    print(\"Number of Hydro Facilities: \", model.getVal(HydroFacilities))\n    print(\"Land Required for Each Solar Facility: \", model.getVal(LandPerSolarFacility))\n    print(\"Land Required for Each Wind Facility: \", model.getVal(LandPerWindFacility))\n    print(\"Land Required for Each Hydro Facility: \", model.getVal(LandPerHydroFacility))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the production time per unit and increases the quality of the product, which in turn increases the selling price per unit. The company aims to maximize its total revenue while considering various operational and financial constraints.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in advanced machinery for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe advanced machinery reduces the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The selling price per unit increases by $5 for every $1000 invested in advanced machinery. The initial selling price per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (50 + 0.005 * InvestmentA) * QuantityA\n// Total revenue for ProductB: RevenueB = (60 + 0.005 * InvestmentB) * QuantityB\n// Total revenue for ProductC: RevenueC = (70 + 0.005 * InvestmentC) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $50,000.\n// InvestmentA + InvestmentB + InvestmentC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB.\n// WorkersA >= 30; WorkersB >= 40\n\n## Generate Constraint-5:\nThe production time for each product, considering the investment in advanced machinery, must not exceed 1000 hours.\n// (2 - 0.0001 * InvestmentA) * QuantityA <= 1000\n// (3 - 0.0001 * InvestmentB) * QuantityB <= 1000\n// (4 - 0.0001 * InvestmentC) * QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the production time per unit and increases the quality of the product, which in turn increases the selling price per unit. The company aims to maximize its total revenue while considering various operational and financial constraints. The initial production time per unit and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Time per Unit | Initial Selling Price per Unit |\n|---------|----------------------------------|--------------------------------|\n| ProductA | 2 hours                          | $50                            |\n| ProductB | 3 hours                          | $60                            |\n| ProductC | 4 hours                          | $70                            |\n\nThe company has a total of 100 workers available. The total capital investment in advanced machinery cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 30 workers are assigned to ProductA and 40 workers to ProductB. The production time for each product, considering the investment in advanced machinery, must not exceed 1000 hours.\n\nPlease help the company to maximize the total revenue from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity for ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # capital investment in advanced machinery for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # capital investment in advanced machinery for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # capital investment in advanced machinery for ProductC\n\n# Define objective function\nRevenueA = (50 + 0.005 * InvestmentA) * QuantityA\nRevenueB = (60 + 0.005 * InvestmentB) * QuantityB\nRevenueC = (70 + 0.005 * InvestmentC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)  # total workers constraint\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 50000)  # total investment constraint\nmodel.addCons(QuantityA <= 500)  # production quantity constraint for ProductA\nmodel.addCons(QuantityB <= 500)  # production quantity constraint for ProductB\nmodel.addCons(QuantityC <= 500)  # production quantity constraint for ProductC\nmodel.addCons(WorkersA >= 30)  # minimum workers for ProductA\nmodel.addCons(WorkersB >= 40)  # minimum workers for ProductB\nmodel.addCons((2 - 0.0001 * InvestmentA) * QuantityA <= 1000)  # production time constraint for ProductA\nmodel.addCons((3 - 0.0001 * InvestmentB) * QuantityB <= 1000)  # production time constraint for ProductB\nmodel.addCons((4 - 0.0001 * InvestmentC) * QuantityC <= 1000)  # production time constraint for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in Advanced Machinery for ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in Advanced Machinery for ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in Advanced Machinery for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1577,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n// Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000\n// where Cost_Small = $20000, Cost_Medium = $30000, Cost_Large = $40000\n\n## Generate Constraint-2:\nThe total capacity of the new trucks should not exceed 1000 tons.\n// Capacity_Small * SmallTrucks + Capacity_Medium * MediumTrucks + Capacity_Large * LargeTrucks <= 1000\n// where Capacity_Small = 10, Capacity_Medium = 20, Capacity_Large = 30\n\n## Generate Constraint-3:\nThe company must purchase at least 5 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks >= 5\n\n## Generate Constraint-4:\nThe number of large trucks should not exceed half the total number of small and medium trucks combined.\n// LargeTrucks <= 0.5 * (SmallTrucks + MediumTrucks)",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability. The operational costs, capacities, and daily revenue generation for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Day | Capacity (tons) | Daily Revenue | Purchase Cost |\n|------------|--------------------------|-----------------|---------------|---------------|\n| Small      | $200                     | 10              | $500          | $20,000       |\n| Medium     | $300                     | 20              | $700          | $30,000       |\n| Large      | $400                     | 30              | $900          | $40,000       |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total capacity of the new trucks should not exceed 1000 tons. The company must purchase at least 5 trucks in total. The number of large trucks should not exceed half the total number of small and medium trucks combined. \nPlease help the company to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\nProfit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n# The total capacity of the new trucks should not exceed 1000 tons.\nmodel.addCons(10 * SmallTrucks + 20 * MediumTrucks + 30 * LargeTrucks <= 1000)\n# The company must purchase at least 5 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks >= 5)\n# The number of large trucks should not exceed half the total number of small and medium trucks combined.\nmodel.addCons(LargeTrucks <= 0.5 * (SmallTrucks + MediumTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1395,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n// Net profit per truck on route A: Profit_A = (1500 - 1000) * A\n// Net profit per truck on route B: Profit_B = (1800 - 1200) * B\n// Net profit per truck on route C: Profit_C = (2200 - 1500) * C\n// Net profit per truck on route D: Profit_D = (2500 - 1800) * D\n// Net profit per truck on route E: Profit_E = (3000 - 2000) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks allocated cannot exceed 20.\n// A + B + C + D + E <= 20",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs. The operational costs and revenue potentials per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| A     | $1000          | $1500             |\n| B     | $1200          | $1800             |\n| C     | $1500          | $2200             |\n| D     | $1800          | $2500             |\n| E     | $2000          | $3000             |\n\nThe company has a budget of $10,000 for operational costs. The company must allocate at least 5 trucks to each route. The total number of trucks allocated cannot exceed 20. \nPlease help the company to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1500 - 1000) * A\nProfit_B = (1800 - 1200) * B\nProfit_C = (2200 - 1500) * C\nProfit_D = (2500 - 1800) * D\nProfit_E = (3000 - 2000) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000)\n## The total number of trucks allocated cannot exceed 20.\nmodel.addCons(A + B + C + D + E <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000\n\n## Generate Constraint-2:\nThe total fuel allocation must not exceed 5000 liters.\n// FuelA + FuelB + FuelC <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\n// TruckA >= 10; TruckB >= 15\n\n## Generate Constraint-4:\nThe total distance covered by TruckC must be at least 5000 km.\n// (Initial_efficiency_C + 0.0006 * Software) * FuelC >= 5000\n\n## Generate Constraint-5:\nThe investment in routing software must not exceed $20,000.\n// Software <= 20000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type improves with the investment in the routing software, as shown in the following Table.\n\n| Vehicle | Initial Efficiency | Improvement per $1000 Software Investment |\n|---------|--------------------|------------------------------------------|\n| TruckA  | X km/liter         | 0.5 km/liter                             |\n| TruckB  | Y km/liter         | 0.7 km/liter                             |\n| TruckC  | Z km/liter         | 0.6 km/liter                             |\n\nThe company has a budget of $100,000 for vehicle purchases and software investments. The total fuel allocation must not exceed 5000 liters. The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements. The total distance covered by TruckC must be at least 5000 km. The investment in routing software must not exceed $20,000.\n\nPlease help the company to minimize the total fuel consumption while ensuring all delivery routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)  # investment in routing software\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitial_efficiency_A = 10  # example initial efficiency for TruckA\nInitial_efficiency_B = 12  # example initial efficiency for TruckB\nInitial_efficiency_C = 15  # example initial efficiency for TruckC\nDistance_A = 1000  # example distance for TruckA\nDistance_B = 1500  # example distance for TruckB\nDistance_C = 2000  # example distance for TruckC\n## Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n## Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n## Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n## So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n## convert the division to multiplication\nmodel.addCons(obj == (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA +\n               (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB +\n               (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nmodel.addCons(TruckA * 20000 + TruckB * 25000 + TruckC * 30000 + Software <= 100000)\n## The total fuel allocation must not exceed 5000 liters.\nmodel.addCons(FuelA + FuelB + FuelC <= 5000)\n## The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 15)\n## The total distance covered by TruckC must be at least 5000 km.\nmodel.addCons((Initial_efficiency_C + 0.0006 * Software) * FuelC >= 5000)\n## The investment in routing software must not exceed $20,000.\nmodel.addCons(Software <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1363,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed1\", \"range\": \"0 < Speed1 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed2\", \"range\": \"0 < Speed2 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed3\", \"range\": \"0 < Speed3 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region4\": \"Speed4\", \"range\": \"0 < Speed4 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region5\": \"Speed5\", \"range\": \"0 < Speed5 < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions.\n// Total fuel consumption in Region1: Fuel1 = 0.05 * Speed1^2 * Trucks1\n// Total fuel consumption in Region2: Fuel2 = 0.055 * Speed2^2 * Trucks2\n// Total fuel consumption in Region3: Fuel3 = 0.06 * Speed3^2 * Trucks3\n// Total fuel consumption in Region4: Fuel4 = 0.065 * Speed4^2 * Trucks4\n// Total fuel consumption in Region5: Fuel5 = 0.07 * Speed5^2 * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the speed of trucks in each region must not exceed 80 km/h.\n// Speed1 <= 80; Speed2 <= 80; Speed3 <= 80; Speed4 <= 80; Speed5 <= 80\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to each region.\n// Trucks1 >= 5; Trucks2 >= 5; Trucks3 >= 5; Trucks4 >= 5; Trucks5 >= 5\n\n## Generate Constraint-4:\nThe total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km.\n// Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000\n\n## Generate Constraint-5:\nThe total distance covered by trucks in Region3, Region4, and Region5 combined must not exceed 15,000 km.\n// Speed3 * Trucks3 + Speed4 * Trucks4 + Speed5 * Trucks5 <= 15000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs. The fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company has a total of 50 trucks available for allocation. Due to regional regulations, the speed of trucks in each region must not exceed 80 km/h. The company must allocate at least 5 trucks to each region. The total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km. The total distance covered by trucks in Region3, Region4, and Region5 combined must not exceed 15,000 km.\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=5)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=5)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks in Region5\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of trucks in Region1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of trucks in Region2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of trucks in Region3\nSpeed4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed4\", lb=0, ub=100)  # speed of trucks in Region4\nSpeed5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed5\", lb=0, ub=100)  # speed of trucks in Region5\n\n# Define objective function\nFuel1 = 0.05 * Speed1**2 * Trucks1\nFuel2 = 0.055 * Speed2**2 * Trucks2\nFuel3 = 0.06 * Speed3**2 * Trucks3\nFuel4 = 0.065 * Speed4**2 * Trucks4\nFuel5 = 0.07 * Speed5**2 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 80)\nmodel.addCons(Speed3 <= 80)\nmodel.addCons(Speed4 <= 80)\nmodel.addCons(Speed5 <= 80)\nmodel.addCons(Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000)\nmodel.addCons(Speed3 * Trucks3 + Speed4 * Trucks4 + Speed5 * Trucks5 <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed3))\n    print(\"Speed of Trucks in Region4: \", model.getVal(Speed4))\n    print(\"Speed of Trucks in Region5: \", model.getVal(Speed5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages.\n// Cost of route A: Cost_A = 100 * A\n// Cost of route B: Cost_B = 120 * B\n// Cost of route C: Cost_C = 150 * C\n// Cost of route D: Cost_D = 180 * D\n// Cost of route E: Cost_E = 200 * E\n// Delivery volume of route A: Vol_A = 50 * A\n// Delivery volume of route B: Vol_B = 60 * B\n// Delivery volume of route C: Vol_C = 70 * C\n// Delivery volume of route D: Vol_D = 80 * D\n// Delivery volume of route E: Vol_E = 90 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n\n## Generate Constraint-1:\nThe total number of trucks available is 10.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-2:\nThe total delivery volume must meet or exceed 1000 packages.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E.\n// D <= A + B + C + E",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages. The total number of trucks available is 10. The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C. The company also wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E. Please help the company to minimize the total cost while meeting the delivery volume target.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 120 * B\nCost_C = 150 * C\nCost_D = 180 * D\nCost_E = 200 * E\nVol_A = 50 * A\nVol_B = 60 * B\nVol_C = 70 * C\nVol_D = 80 * D\nVol_E = 90 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available is 10.\nmodel.addCons(A + B + C + D + E <= 10)\n## The total delivery volume must meet or exceed 1000 packages.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000)\n## The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E.\nmodel.addCons(D <= A + B + C + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Delivery Volume: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\n// {\"number of trucks for perishable food\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishable food\": \"PerishableTrips\", \"range\": \"PerishableTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for textiles\": \"TextilesTrips\", \"range\": \"TextilesTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor perishable food, the revenue per trip is $1000, and the fuel cost per trip is $200.\nFor electronics, the revenue per trip is $1500, and the fuel cost per trip is $300.\nFor textiles, the revenue per trip is $800, and the fuel cost per trip is $150.\nThe company wants to maximize the net profit per day.\n// NetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\n// NetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\n// NetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\n// So, the objective function is: Maximize (NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available.\n// PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20\n\n## Generate Constraint-2:\nDue to safety regulations, each truck can make a maximum of 5 trips per day.\n// PerishableTrips <= 5; ElectronicsTrips <= 5; TextilesTrips <= 5\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of $5000.\n// 200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000\n\n## Generate Constraint-4:\nThe company must ensure that at least 5 trips are made for perishable food daily.\n// PerishableTrucks * PerishableTrips >= 5\n\n## Generate Constraint-5:\nThe company aims to balance the workload, ensuring that the number of trucks for electronics is at least half the number of trucks for perishable food.\n// ElectronicsTrucks >= 0.5 * PerishableTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable food, electronics, and textiles. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\nFor perishable food, the revenue per trip is $1000, and the fuel cost per trip is $200.\nFor electronics, the revenue per trip is $1500, and the fuel cost per trip is $300.\nFor textiles, the revenue per trip is $800, and the fuel cost per trip is $150.\nThe company has a total of 20 trucks available. Due to safety regulations, each truck can make a maximum of 5 trips per day. The company has a daily fuel budget of $5000. The company must ensure that at least 5 trips are made for perishable food daily. The company aims to balance the workload, ensuring that the number of trucks for electronics is at least half the number of trucks for perishable food.\nPlease help the company to maximize the net profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nPerishableTrips = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrips\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nTextilesTrips = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrips\", lb=0)\n\n# Define objective function\nNetProfit_Perishable = PerishableTrucks * PerishableTrips * (1000 - 200)\nNetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (1500 - 300)\nNetProfit_Textiles = TextilesTrucks * TextilesTrips * (800 - 150)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Perishable + NetProfit_Electronics + NetProfit_Textiles)\n\n# Add constraints\nmodel.addCons(PerishableTrucks + ElectronicsTrucks + TextilesTrucks <= 20)\nmodel.addCons(PerishableTrips <= 5)\nmodel.addCons(ElectronicsTrips <= 5)\nmodel.addCons(TextilesTrips <= 5)\nmodel.addCons(200 * PerishableTrucks * PerishableTrips + 300 * ElectronicsTrucks * ElectronicsTrips + 150 * TextilesTrucks * TextilesTrips <= 5000)\nmodel.addCons(PerishableTrucks * PerishableTrips >= 5)\nmodel.addCons(ElectronicsTrucks >= 0.5 * PerishableTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Food: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Textiles: \", model.getVal(TextilesTrucks))\n    print(\"Number of Trips per Truck for Perishable Food: \", model.getVal(PerishableTrips))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Textiles: \", model.getVal(TextilesTrips))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per truck and delivery efficiency. Route 1 has a cost of $100 per truck and an efficiency of 20 deliveries per hour. Route 2 has a cost of $120 per truck and an efficiency of 25 deliveries per hour. Route 3 has a cost of $110 per truck and an efficiency of 22 deliveries per hour. Route 4 has a cost of $130 per truck and an efficiency of 28 deliveries per hour. Route 5 has a cost of $140 per truck and an efficiency of 30 deliveries per hour. The company aims to maximize the total deliveries while minimizing the total cost.\n// Cost = 100 * T1 + 120 * T2 + 110 * T3 + 130 * T4 + 140 * T5\n// Deliveries = 20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5\n// The objective function is: Maximize (Deliveries - Cost)\n// Maximize (20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5 - 100 * T1 - 120 * T2 - 110 * T3 - 130 * T4 - 140 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 22 trucks, Route 4 up to 28 trucks, and Route 5 up to 30 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 22; T4 <= 28; T5 <= 30",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency and cost. The cost per truck and delivery efficiency for each route are given in the following Table.\n\n| Route | Cost per Truck | Delivery Efficiency | Maximum Capacity |\n|-------|----------------|---------------------|------------------|\n| 1     | $100           | 20 deliveries/hour | 20 trucks        |\n| 2     | $120           | 25 deliveries/hour | 25 trucks        |\n| 3     | $110           | 22 deliveries/hour | 22 trucks        |\n| 4     | $130           | 28 deliveries/hour | 28 trucks        |\n| 5     | $140           | 30 deliveries/hour | 30 trucks        |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks as specified in the table. The company aims to maximize the total deliveries while minimizing the total cost. Please help the company to maximize the objective function, which is the total deliveries minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost = 100 * T1 + 120 * T2 + 110 * T3 + 130 * T4 + 140 * T5\nDeliveries = 20 * T1 + 25 * T2 + 22 * T3 + 28 * T4 + 30 * T5\n## The objective function is: Maximize (Deliveries - Cost)\nmodel.addCons(obj == Deliveries - Cost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 22)\nmodel.addCons(T4 <= 28)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Deliveries - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in improving the production efficiency of each product line. The efficiency improvement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in efficiency improvements for each product line. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * EfficiencyA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * EfficiencyB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * EfficiencyC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for efficiency improvements.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 50000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in improving the production efficiency of each product line. The efficiency improvement directly reduces the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $250                   |\n| ProductC | $200                             | $300                   |\n\nThe production cost per unit decreases by $5 for every $1000 invested in efficiency improvements for each product line. The company has a total budget of $50,000 for efficiency improvements. The total production quantity for all products must not exceed 1000 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * EfficiencyA) * QuantityA\nProfitB = (250 - 150 + 0.005 * EfficiencyB) * QuantityB\nProfitC = (300 - 200 + 0.005 * EfficiencyC) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 50000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductA\": \"QualityControlA\", \"range\": \"QualityControlA >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductB\": \"QualityControlB\", \"range\": \"QualityControlB >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductC\": \"QualityControlC\", \"range\": \"QualityControlC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n// Total revenue for ProductA: RevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\n// Total cost for ProductA: CostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\n// Total cost for ProductB: CostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\n// Total cost for ProductC: CostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total budget for marketing and quality control cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 1000 units of each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control). The total budget for marketing and quality control cannot exceed $100,000. The company can produce a maximum of 1000 units of each product. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nQualityControlA = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlA\", lb=0) # quality control investment for ProductA\nQualityControlB = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlB\", lb=0) # quality control investment for ProductB\nQualityControlC = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlC\", lb=0) # quality control investment for ProductC\n\n# Define objective function\nRevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\nRevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\nRevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\nCostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\nCostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\nCostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\nTotalProfit = RevenueA - CostA + RevenueB - CostB + RevenueC - CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Quality Control Investment for ProductA: \", model.getVal(QualityControlA))\n    print(\"Quality Control Investment for ProductB: \", model.getVal(QualityControlB))\n    print(\"Quality Control Investment for ProductC: \", model.getVal(QualityControlC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The company aims to maximize the total profit from distributing these products. However, the profit rate is affected by the storage and transportation costs, which are nonlinear functions of the number of units. The storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Storage cost of A: Storage_A = 0.1 * A^2\n// Storage cost of B: Storage_B = 0.1 * B^2\n// Storage cost of C: Storage_C = 0.1 * C^2\n// Storage cost of D: Storage_D = 0.1 * D^2\n// Transportation cost of A: Trans_A = 0.01 * A^3\n// Transportation cost of B: Trans_B = 0.01 * B^3\n// Transportation cost of C: Trans_C = 0.01 * C^3\n// Transportation cost of D: Trans_D = 0.01 * D^3\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\n\n## Generate Constraint-1:\nThe total storage space available for all products is limited to 1000 square units.\n// 0.1 * A^2 + 0.1 * B^2 + 0.1 * C^2 + 0.1 * D^2 <= 1000\n\n## Generate Constraint-2:\nThe total transportation capacity is limited to 5000 cubic units.\n// 0.01 * A^3 + 0.01 * B^3 + 0.01 * C^3 + 0.01 * D^3 <= 5000\n\n## Generate Constraint-3:\nThe company has a minimum distribution requirement of 50 units for each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A.\n// C <= 2 * A",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $20             |\n| B       | $30             |\n| C       | $40             |\n| D       | $50             |\n\nThe storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n\nThe company has the following constraints:\n1. The total storage space available for all products is limited to 1000 square units.\n2. The total transportation capacity is limited to 5000 cubic units.\n3. The company has a minimum distribution requirement of 50 units for each product.\n4. The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\n5. The company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A.\n\nPlease help the company to determine the optimal number of units to distribute for each product to maximize the net profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nStorage_A = 0.1 * A**2\nStorage_B = 0.1 * B**2\nStorage_C = 0.1 * C**2\nStorage_D = 0.1 * D**2\nTrans_A = 0.01 * A**3\nTrans_B = 0.01 * B**3\nTrans_C = 0.01 * C**3\nTrans_D = 0.01 * D**3\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D))\n\n# Add constraints\n## The total storage space available for all products is limited to 1000 square units.\nmodel.addCons(0.1 * A**2 + 0.1 * B**2 + 0.1 * C**2 + 0.1 * D**2 <= 1000)\n## The total transportation capacity is limited to 5000 cubic units.\nmodel.addCons(0.01 * A**3 + 0.01 * B**3 + 0.01 * C**3 + 0.01 * D**3 <= 5000)\n## The company has a minimum distribution requirement of 50 units for each product.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 50)\nmodel.addCons(C >= 50)\nmodel.addCons(D >= 50)\n## The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total distribution of product C does not exceed twice the distribution of product A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1455,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on residential buildings\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on commercial buildings\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on industrial buildings\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on government buildings\": \"Government\", \"range\": \"Government >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on educational buildings\": \"Educational\", \"range\": \"Educational >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type. Residential buildings have an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels.\n// Total energy output: Energy = 80% * Residential + 85% * Commercial + 90% * Industrial + 95% * Government + 100% * Educational\n// The objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 to spend on solar panel installations. The cost per panel is $1,000 for residential, $1,200 for commercial, $1,500 for industrial, $1,800 for government, and $2,000 for educational buildings.\n// 1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000\n\n## Generate Constraint-2:\nThe city aims to install at least 200 solar panels in total.\n// Residential + Commercial + Industrial + Government + Educational >= 200\n\n## Generate Constraint-3:\nThe number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels.\n// Government <= 0.3 * (Residential + Commercial + Industrial + Government + Educational)",
        "question": "A city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building. The efficiency of solar panels varies by building type, with residential buildings having an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels.\n\n| Building Type   | Efficiency | Cost per Panel |\n|-----------------|------------|----------------|\n| Residential     | 80%        | $1,000         |\n| Commercial      | 85%        | $1,200         |\n| Industrial      | 90%        | $1,500         |\n| Government      | 95%        | $1,800         |\n| Educational     | 100%       | $2,000         |\n\nThe city has a budget of $500,000 to spend on solar panel installations. The city aims to install at least 200 solar panels in total. Additionally, the number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels.\n\nPlease help the city to maximize the total energy output from the solar panels.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0)  # number of solar panels on residential buildings\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0)  # number of solar panels on commercial buildings\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0)  # number of solar panels on industrial buildings\nGovernment = model.addVar(vtype=\"INTEGER\", name=\"Government\", lb=0)  # number of solar panels on government buildings\nEducational = model.addVar(vtype=\"INTEGER\", name=\"Educational\", lb=0)  # number of solar panels on educational buildings\n\n# Define objective function\nEnergy = 0.8 * Residential + 0.85 * Commercial + 0.9 * Industrial + 0.95 * Government + Educational\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\n# The city has a budget of $500,000 to spend on solar panel installations.\nmodel.addCons(1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000)\n# The city aims to install at least 200 solar panels in total.\nmodel.addCons(Residential + Commercial + Industrial + Government + Educational >= 200)\n# The number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels.\nmodel.addCons(Government <= 0.3 * (Residential + Commercial + Industrial + Government + Educational))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Residential Buildings: \", model.getVal(Residential))\n    print(\"Number of Solar Panels on Commercial Buildings: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels on Industrial Buildings: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels on Government Buildings: \", model.getVal(Government))\n    print(\"Number of Solar Panels on Educational Buildings: \", model.getVal(Educational))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company wants to maximize the total profit per liter of fuel consumed.\n// Profit_TruckA = (2 - 0.5) * Distance_TruckA / 10\n// Profit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\n// Profit_TruckC = (3 - 0.7) * Distance_TruckC / 15\n// Profit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\n// Profit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n// Distance_TruckA = TruckA * Average_Distance\n// Distance_TruckB = TruckB * Average_Distance\n// Distance_TruckC = TruckC * Average_Distance\n// Distance_TruckD = TruckD * Average_Distance\n// Distance_TruckE = TruckE * Average_Distance\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\n// 0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company has a total of 100 trucks available for deployment. Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\nPlease help the company to maximize the total profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define distances based on the number of trucks and an average distance\nAverage_Distance = 1000  # Assuming an average distance for simplicity\nDistance_TruckA = TruckA * Average_Distance\nDistance_TruckB = TruckB * Average_Distance\nDistance_TruckC = TruckC * Average_Distance\nDistance_TruckD = TruckD * Average_Distance\nDistance_TruckE = TruckE * Average_Distance\n\n## Calculate profits per liter of fuel\nProfit_TruckA = (2 - 0.5) * Distance_TruckA / 10\nProfit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\nProfit_TruckC = (3 - 0.7) * Distance_TruckC / 15\nProfit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\nProfit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TruckA + TruckB + TruckC + TruckD + TruckE) == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\nmodel.addCons(0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, for product C is $90, for product D is $60, and for product E is $80. The production cost per unit for each product is a nonlinear function of the number of units produced due to economies of scale. The cost function for each product is given by: CostA = 20 + 0.05 * (UnitsA^2), CostB = 30 + 0.03 * (UnitsB^2), CostC = 40 + 0.02 * (UnitsC^2), CostD = 25 + 0.04 * (UnitsD^2), CostE = 35 + 0.01 * (UnitsE^2). The company wants to maximize the total profit.\n// Total profit for product A: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * (UnitsA^2))) * UnitsA\n// Total profit for product B: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * (UnitsB^2))) * UnitsB\n// Total profit for product C: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * (UnitsC^2))) * UnitsC\n// Total profit for product D: ProfitD = (60 - CostD) * UnitsD = (60 - (25 + 0.04 * (UnitsD^2))) * UnitsD\n// Total profit for product E: ProfitE = (80 - CostE) * UnitsE = (80 - (35 + 0.01 * (UnitsE^2))) * UnitsE\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit for product A is $50, for product B is $70, for product C is $90, for product D is $60, and for product E is $80. The production cost per unit for each product is a nonlinear function of the number of units produced due to economies of scale. The cost function for each product is given by: CostA = 20 + 0.05 * (UnitsA^2), CostB = 30 + 0.03 * (UnitsB^2), CostC = 40 + 0.02 * (UnitsC^2), CostD = 25 + 0.04 * (UnitsD^2), CostE = 35 + 0.01 * (UnitsE^2). The company has a total production capacity of 1000 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of product D\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for product A: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * (UnitsA^2))) * UnitsA\n## Total profit for product B: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * (UnitsB^2))) * UnitsB\n## Total profit for product C: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * (UnitsC^2))) * UnitsC\n## Total profit for product D: ProfitD = (60 - CostD) * UnitsD = (60 - (25 + 0.04 * (UnitsD^2))) * UnitsD\n## Total profit for product E: ProfitE = (80 - CostE) * UnitsE = (80 - (35 + 0.01 * (UnitsE^2))) * UnitsE\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\nCostA = 20 + 0.05 * (UnitsA**2)\nCostB = 30 + 0.03 * (UnitsB**2)\nCostC = 40 + 0.02 * (UnitsC**2)\nCostD = 25 + 0.04 * (UnitsD**2)\nCostE = 35 + 0.01 * (UnitsE**2)\nProfitA = (50 - CostA) * UnitsA\nProfitB = (70 - CostB) * UnitsB\nProfitC = (90 - CostC) * UnitsC\nProfitD = (60 - CostD) * UnitsD\nProfitE = (80 - CostE) * UnitsE\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD + ProfitE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Product D: \", model.getVal(UnitsD))\n    print(\"Number of Product E: \", model.getVal(UnitsE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed.\n// {\"number of trips for Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A consumes 5 liters of fuel per hour and travels at 60 km/h.\nTruck B consumes 7 liters of fuel per hour and travels at 50 km/h.\nTruck C consumes 6 liters of fuel per hour and travels at 40 km/h.\nVan D consumes 3 liters of fuel per hour and travels at 80 km/h.\nVan E consumes 4 liters of fuel per hour and travels at 70 km/h.\nThe company wants to minimize the total fuel consumption while ensuring timely deliveries.\n// TotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\n// TotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n// The objective function is: Minimize TotalFuelConsumption * TotalDeliveryTime\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000\n\n## Generate Constraint-2:\nThe company must complete at least 1000 km of deliveries per day.\n// 60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000\n\n## Generate Constraint-3:\nThe number of trips for each vehicle must not exceed 20 per day.\n// TruckA <= 20\n// TruckB <= 20\n// TruckC <= 20\n// VanD <= 20\n// VanE <= 20",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize fuel efficiency and delivery times. Each vehicle has a different fuel consumption rate and speed. The details of each vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/hour) | Speed (km/h) |\n|---------|--------------------------------|--------------|\n| Truck A | 5                              | 60           |\n| Truck B | 7                              | 50           |\n| Truck C | 6                              | 40           |\n| Van D   | 3                              | 80           |\n| Van E   | 4                              | 70           |\n\nThe company has a total fuel budget of 1000 liters per day. The company must complete at least 1000 km of deliveries per day. The number of trips for each vehicle must not exceed 20 per day. \nPlease help the company to minimize the total fuel consumption while ensuring timely deliveries, by minimizing the product of total fuel consumption and total delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trips for Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trips for Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trips for Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of trips for Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of trips for Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalFuelConsumption = 5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE\nTotalDeliveryTime = (1 / 60) * TruckA + (1 / 50) * TruckB + (1 / 40) * TruckC + (1 / 80) * VanD + (1 / 70) * VanE\n## the objective function is: Minimize TotalFuelConsumption * TotalDeliveryTime\n## convert the division to multiplication\nmodel.addCons(obj == TotalFuelConsumption * TotalDeliveryTime)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(5 * 60 * TruckA + 7 * 50 * TruckB + 6 * 40 * TruckC + 3 * 80 * VanD + 4 * 70 * VanE <= 1000)\n## The company must complete at least 1000 km of deliveries per day.\nmodel.addCons(60 * TruckA + 50 * TruckB + 40 * TruckC + 80 * VanD + 70 * VanE >= 1000)\n## The number of trips for each vehicle must not exceed 20 per day.\nmodel.addCons(TruckA <= 20)\nmodel.addCons(TruckB <= 20)\nmodel.addCons(TruckC <= 20)\nmodel.addCons(VanD <= 20)\nmodel.addCons(VanE <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(TruckA))\n    print(\"Number of trips for Truck B: \", model.getVal(TruckB))\n    print(\"Number of trips for Truck C: \", model.getVal(TruckC))\n    print(\"Number of trips for Van D: \", model.getVal(VanD))\n    print(\"Number of trips for Van E: \", model.getVal(VanE))\n    print(\"Minimized Fuel Consumption * Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount of investment in research and development (R&D) for each device to optimize its profit. The profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n\n| Device | Profit per Unit | R&D Investment Impact |\n|--------|-----------------|-----------------------|\n| DeviceA | $500           | (1 + RDA / 1000)     |\n| DeviceB | $700           | (1 + RDB / 1000)     |\n| DeviceC | $600           | (1 + RDC / 1000)     |\n\nThe company has a total budget of $500,000 for R&D investments. The production capacity for the quarter is limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n\nPlease help the company to determine the optimal number of units to produce for each device and the appropriate R&D investments to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $500,000 for R&D investments.\nmodel.addCons(RDA + RDB + RDC <= 500000)\n# The production capacity for the quarter is limited to 10,000 units in total.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Residential\": \"TechUpgradeResidential\", \"range\": \"TechUpgradeResidential >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Commercial\": \"TechUpgradeCommercial\", \"range\": \"TechUpgradeCommercial >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Industrial\": \"TechUpgradeIndustrial\", \"range\": \"TechUpgradeIndustrial >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output efficiency of solar panels increases with technology upgrades. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. The company aims to maximize the total energy output from all farms.\n// EnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\n// EnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\n// EnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n// So, the objective function is: Maximize (EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both the installation of solar panels and technology upgrades.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000\n\n## Generate Constraint-2:\nThe total area available for installing solar panels across all types of farms is limited to 5000 square meters. Each Residential panel requires 1 square meter, each Commercial panel requires 2 square meters, and each Industrial panel requires 3 square meters.\n// ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000\n\n## Generate Constraint-3:\nDue to local regulations, the company must install at least 500 panels for Residential and 300 panels for Commercial.\n// ResidentialPanels >= 500; CommercialPanels >= 300",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm, and the level of technology upgrade (in dollars) for each type of farm to enhance energy output efficiency. The energy output efficiency of solar panels increases with technology upgrades. For every $1000 invested in technology upgrades, the energy output per panel increases by 10%. The initial energy output per panel for Residential is 200 kWh, for Commercial is 300 kWh, and for Industrial is 400 kWh. The company has a total budget of $100,000 for both the installation of solar panels and technology upgrades. The total area available for installing solar panels across all types of farms is limited to 5000 square meters. Each Residential panel requires 1 square meter, each Commercial panel requires 2 square meters, and each Industrial panel requires 3 square meters. Due to local regulations, the company must install at least 500 panels for Residential and 300 panels for Commercial. The company aims to maximize the total energy output from all farms. Please help the company determine the optimal number of solar panels and technology upgrades for each type of farm.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=500)\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=300)\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)\nTechUpgradeResidential = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeResidential\", lb=0)\nTechUpgradeCommercial = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeCommercial\", lb=0)\nTechUpgradeIndustrial = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeIndustrial\", lb=0)\n\n# Define objective function\nEnergyOutputResidential = ResidentialPanels * (200 + 0.1 * TechUpgradeResidential / 1000)\nEnergyOutputCommercial = CommercialPanels * (300 + 0.1 * TechUpgradeCommercial / 1000)\nEnergyOutputIndustrial = IndustrialPanels * (400 + 0.1 * TechUpgradeIndustrial / 1000)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputResidential + EnergyOutputCommercial + EnergyOutputIndustrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + TechUpgradeResidential + TechUpgradeCommercial + TechUpgradeIndustrial <= 100000)\nmodel.addCons(ResidentialPanels + 2 * CommercialPanels + 3 * IndustrialPanels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Technology Upgrade for Residential: \", model.getVal(TechUpgradeResidential))\n    print(\"Technology Upgrade for Commercial: \", model.getVal(TechUpgradeCommercial))\n    print(\"Technology Upgrade for Industrial: \", model.getVal(TechUpgradeIndustrial))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for route 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for route 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for route 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The cost decreases as the fuel allocation increases, but at a decreasing rate. The company aims to minimize the total fuel cost for all routes.\n// Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n// Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n// Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total fuel budget for the company is $10,000.\n// Fuel1 + Fuel2 + Fuel3 <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// Truck1 + Truck2 + Truck3 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The cost of fuel per kilometer is a nonlinear function of the fuel allocation, with diminishing returns as more fuel is allocated. The cost decreases as the fuel allocation increases, but at a decreasing rate. The company aims to minimize the total fuel cost for all routes. The total fuel budget for the company is $10,000. The company has a maximum of 50 trucks available. Please help the company to determine the optimal number of trucks and fuel allocation for each route to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)  # number of trucks for route 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)  # number of trucks for route 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)  # number of trucks for route 3\nFuel1 = model.addVar(name=\"Fuel1\", lb=0)  # fuel allocation for route 1\nFuel2 = model.addVar(name=\"Fuel2\", lb=0)  # fuel allocation for route 2\nFuel3 = model.addVar(name=\"Fuel3\", lb=0)  # fuel allocation for route 3\n\n# Define objective function\n# Fuel cost for route 1: Cost1 = (1000 / (1 + e^(-0.05 * Fuel1))) * Truck1\n# Fuel cost for route 2: Cost2 = (1200 / (1 + e^(-0.05 * Fuel2))) * Truck2\n# Fuel cost for route 3: Cost3 = (1100 / (1 + e^(-0.05 * Fuel3))) * Truck3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n# Convert the nonlinear function to a linear approximation using Taylor series expansion\nCost1 = (1000 / (1 + 1 / (1 + 0.05 * Fuel1))) * Truck1\nCost2 = (1200 / (1 + 1 / (1 + 0.05 * Fuel2))) * Truck2\nCost3 = (1100 / (1 + 1 / (1 + 0.05 * Fuel3))) * Truck3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 <= 10000)  # Total fuel budget for the company is $10,000\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 50)  # The company has a maximum of 50 trucks available\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Truck3))\n    print(\"Fuel Allocation for Route 1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route 2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route 3: \", model.getVal(Fuel3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The company aims to maximize the total profit from distributing these products. However, the profit rate is affected by the storage and transportation costs, which are nonlinear functions of the number of units. The storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Storage cost of A: Storage_A = 0.1 * A^2\n// Storage cost of B: Storage_B = 0.1 * B^2\n// Storage cost of C: Storage_C = 0.1 * C^2\n// Storage cost of D: Storage_D = 0.1 * D^2\n// Transportation cost of A: Trans_A = 0.01 * A^3\n// Transportation cost of B: Trans_B = 0.01 * B^3\n// Transportation cost of C: Trans_C = 0.01 * C^3\n// Transportation cost of D: Trans_D = 0.01 * D^3\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\n\n## Generate Constraint-1:\nThe total storage space available for all products is limited to 1000 square units.\n// 0.1 * A^2 + 0.1 * B^2 + 0.1 * C^2 + 0.1 * D^2 <= 1000\n\n## Generate Constraint-2:\nThe total transportation capacity is limited to 5000 cubic units.\n// 0.01 * A^3 + 0.01 * B^3 + 0.01 * C^3 + 0.01 * D^3 <= 5000\n\n## Generate Constraint-3:\nThe company has a minimum distribution requirement of 50 units for each product.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $20             |\n| B       | $30             |\n| C       | $40             |\n| D       | $50             |\n\nThe storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n\nThe total storage space available for all products is limited to 1000 square units. The total transportation capacity is limited to 5000 cubic units. The company has a minimum distribution requirement of 50 units for each product.\n\nPlease help the company to determine the optimal number of units to distribute for each product to maximize the net profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate profits and costs\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nStorage_A = 0.1 * A**2\nStorage_B = 0.1 * B**2\nStorage_C = 0.1 * C**2\nStorage_D = 0.1 * D**2\nTrans_A = 0.01 * A**3\nTrans_B = 0.01 * B**3\nTrans_C = 0.01 * C**3\nTrans_D = 0.01 * D**3\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D))\n\n# Add constraints\n## The total storage space available for all products is limited to 1000 square units.\nmodel.addCons(0.1 * A**2 + 0.1 * B**2 + 0.1 * C**2 + 0.1 * D**2 <= 1000)\n## The total transportation capacity is limited to 5000 cubic units.\nmodel.addCons(0.01 * A**3 + 0.01 * B**3 + 0.01 * C**3 + 0.01 * D**3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its delivery routes for multiple destinations. The company needs to determine the number of trucks to allocate for each route and the speed at which each truck should travel to minimize fuel consumption. The fuel efficiency of a truck is affected by its speed, following a nonlinear relationship.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks for Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of a truck is modeled by a quadratic function of its speed, where lower speeds result in less fuel consumption but too low speeds increase consumption due to engine inefficiency. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Fuel1 = Trucks1 * (0.005 * Speed1^2 + 0.1 * Speed1 + 10)\n// Fuel consumption for Route2: Fuel2 = Trucks2 * (0.005 * Speed2^2 + 0.1 * Speed2 + 10)\n// So, the objective function is: Minimize (Fuel1 + Fuel2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel and operational costs. The cost of fuel per kilometer for each truck is $0.5, and the total distance covered by all trucks must not exceed the budget.\n// 0.5 * (Trucks1 * Speed1 + Trucks2 * Speed2) <= 10000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its delivery routes for multiple destinations. The company needs to determine the number of trucks to allocate for each route and the speed at which each truck should travel to minimize fuel consumption. The fuel efficiency of a truck is affected by its speed, following a nonlinear relationship. The fuel consumption of a truck is modeled by a quadratic function of its speed, where lower speeds result in less fuel consumption but too low speeds increase consumption due to engine inefficiency. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $10,000 for fuel and operational costs. The cost of fuel per kilometer for each truck is $0.5, and the total distance covered by all trucks must not exceed the budget.\n\nPlease help the company to determine the optimal number of trucks and their speeds for Route1 and Route2 to minimize the total fuel consumption while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks for Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks for Route2\n\n# Define objective function\nFuel1 = Trucks1 * (0.005 * Speed1**2 + 0.1 * Speed1 + 10)\nFuel2 = Trucks2 * (0.005 * Speed2**2 + 0.1 * Speed2 + 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2)\n\n# Add constraints\nmodel.addCons(0.5 * (Trucks1 * Speed1 + Trucks2 * Speed2) <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks for Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks for Route2: \", model.getVal(Speed2))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital invested in automation\": \"AutomationCapital\", \"range\": \"AutomationCapital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for the production of all products.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital available for investment in automation is $100,000.\n// AutomationCapital <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested. The production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 100 workers available for the production of all products. The total capital available for investment in automation is $100,000. Please help the company determine the optimal production quantities, worker allocations, and automation capital investment to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationCapital\", lb=0)  # capital invested in automation\n\n# Define objective function\n## The production cost per unit decreases non-linearly with the investment in automation.\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA +\n                    (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB +\n                    (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC)\n\n# Add constraints\n## The company has a total of 100 workers available for the production of all products.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital available for investment in automation is $100,000.\nmodel.addCons(AutomationCapital <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Invested in Automation: \", model.getVal(AutomationCapital))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested.\n// Total fuel cost for TruckA: CostA = (100 - 0.05 * EfficiencyA) * TripsA\n// Total fuel cost for TruckB: CostB = (150 - 0.07 * EfficiencyB) * TripsB\n// Total fuel cost for TruckC: CostC = (200 - 0.1 * EfficiencyC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs.\n// 100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000",
        "question": "A logistics company is planning its routes for the next quarter and needs to decide how many trips each of its three vehicle types (TruckA, TruckB, and TruckC) will make, as well as the amount of money to be invested in improving the fuel efficiency of each vehicle type. The company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip and the impact of investment in fuel efficiency on the fuel cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Cost per Trip | Reduction in Fuel Cost per $100 Invested in Efficiency |\n|--------------|--------------------|---------------------------------------------------------|\n| TruckA       | $100               | $5                                                     |\n| TruckB       | $150               | $7                                                     |\n| TruckC       | $200               | $10                                                    |\n\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs. The total fuel cost for each vehicle type is affected by the number of trips and the investment in fuel efficiency, as shown in the Table.\n\nPlease help the company to minimize the total fuel cost for all vehicles (which is the sum of the fuel costs for TruckA, TruckB, and TruckC).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # investment in fuel efficiency for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # investment in fuel efficiency for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # investment in fuel efficiency for TruckC\n\n# Define objective function\nCostA = (100 - 0.05 * EfficiencyA) * TripsA\nCostB = (150 - 0.07 * EfficiencyB) * TripsB\nCostC = (200 - 0.1 * EfficiencyC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a budget of $20,000 for investments in fuel efficiency and operational costs.\nmodel.addCons(100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1336,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks allocated to Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region A: Fuel consumption rate is 0.5 liters per km, and travel time is 0.1 hours per km.\n- Region B: Fuel consumption rate is 0.6 liters per km, and travel time is 0.12 hours per km.\n- Region C: Fuel consumption rate is 0.7 liters per km, and travel time is 0.14 hours per km.\n- Region D: Fuel consumption rate is 0.8 liters per km, and travel time is 0.16 hours per km.\n- Region E: Fuel consumption rate is 0.9 liters per km, and travel time is 0.18 hours per km.\nThe company wants to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck).\n// Fuel cost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * TotalDistance\n// Time cost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * TotalDistance * HourlyRate\n// So, the objective function is: Minimize (Fuel cost + Time cost)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe total distance covered by all trucks should not exceed 5000 km.\n// (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 5000\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each region.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10; TruckD >= 10; TruckE >= 10\n\n## Generate Constraint-4:\nThe total travel time for all trucks should not exceed 500 hours.\n// (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) <= 500\n\n## Generate Constraint-5:\nThe total fuel consumption for all trucks should not exceed 3000 liters.\n// (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 3000",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\nThe fuel consumption and travel time for each region are as follows:\n- Region A: Fuel consumption rate is 0.5 liters per km, and travel time is 0.1 hours per km.\n- Region B: Fuel consumption rate is 0.6 liters per km, and travel time is 0.12 hours per km.\n- Region C: Fuel consumption rate is 0.7 liters per km, and travel time is 0.14 hours per km.\n- Region D: Fuel consumption rate is 0.8 liters per km, and travel time is 0.16 hours per km.\n- Region E: Fuel consumption rate is 0.9 liters per km, and travel time is 0.18 hours per km.\nThe company has a total of 100 trucks available. The total distance covered by all trucks should not exceed 5000 km. The company must allocate at least 10 trucks to each region. The total travel time for all trucks should not exceed 500 hours. The total fuel consumption for all trucks should not exceed 3000 liters.\nPlease help the company to minimize the total cost, which is the sum of the fuel cost and the opportunity cost of time (assuming a fixed hourly rate for each truck).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks allocated to Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10) # number of trucks allocated to Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10) # number of trucks allocated to Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=10) # number of trucks allocated to Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=10) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = (0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) * 5000 # assuming TotalDistance = 5000\nTimeCost = (0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) * 5000 * 20 # assuming HourlyRate = 20\n## the objective function is: Minimize (Fuel cost + Time cost)\nmodel.addCons(obj == FuelCost + TimeCost)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n## The total distance covered by all trucks should not exceed 5000 km.\nmodel.addCons((0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 5000)\n## The company must allocate at least 10 trucks to each region.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 10)\nmodel.addCons(TruckC >= 10)\nmodel.addCons(TruckD >= 10)\nmodel.addCons(TruckE >= 10)\n## The total travel time for all trucks should not exceed 500 hours.\nmodel.addCons((0.1 * TruckA + 0.12 * TruckB + 0.14 * TruckC + 0.16 * TruckD + 0.18 * TruckE) <= 500)\n## The total fuel consumption for all trucks should not exceed 3000 liters.\nmodel.addCons((0.5 * TruckA + 0.6 * TruckB + 0.7 * TruckC + 0.8 * TruckD + 0.9 * TruckE) <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(TruckE))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route1\": \"Additive1\", \"range\": \"Additive1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route2\": \"Additive2\", \"range\": \"Additive2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes.\n// Fuel cost on Route1: Cost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\n// Fuel cost on Route2: Cost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe total number of trucks available for both routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe budget for fuel additives is limited to $1000.\n// Additive1 + Additive2 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h.\n// Speed1 <= 50\n\n## Generate Constraint-4:\nThe demand for goods requires at least 10 trucks to be assigned to Route2.\n// Trucks2 >= 10\n\n## Generate Constraint-5:\nThe fuel efficiency improvement due to additives is capped at 10% for each route.\n// Additive1 <= 0.1 * Speed1; Additive2 <= 0.1 * Speed2",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency. The following table summarizes the relevant parameters for each route.\n\n| Parameter          | Route1 | Route2 |\n|--------------------|--------|--------|\n| Number of Trucks   | Trucks1 | Trucks2 |\n| Speed (km/h)       | Speed1  | Speed2  |\n| Fuel Additive      | Additive1 | Additive2 |\n\nThe company aims to minimize the total fuel cost across both routes, where the fuel consumption rate decreases with the increase in speed but increases with the use of additive. The total number of trucks available for both routes is limited to 50. The budget for fuel additives is limited to $1000. Due to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h. The demand for goods requires at least 10 trucks to be assigned to Route2. The fuel efficiency improvement due to additives is capped at 10% for each route.\n\nPlease help the company to minimize the total fuel cost across both routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10)  # number of trucks on Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route2\nAdditive1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive1\", lb=0)  # amount of fuel additive used on Route1\nAdditive2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive2\", lb=0)  # amount of fuel additive used on Route2\n\n# Define objective function\nCost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\nCost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons(Additive1 + Additive2 <= 1000)\nmodel.addCons(Speed1 <= 50)\nmodel.addCons(Trucks2 >= 10)\nmodel.addCons(Additive1 <= 0.1 * Speed1)\nmodel.addCons(Additive2 <= 0.1 * Speed2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks on Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route2: \", model.getVal(Speed2))\n    print(\"Amount of Additive on Route1: \", model.getVal(Additive1))\n    print(\"Amount of Additive on Route2: \", model.getVal(Additive2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1291,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000\n\n## Generate Constraint-2:\nThe production rate from each machine should not be less than 10 units per hour.\n// Pi >= 10 for i = 1, 2, 3, 4, 5, 6",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The voltage applied to each machine affects both its energy consumption and production rate, as described in the following table:\n\n| Machine | Voltage Range | Energy Consumption Model | Production Rate Model |\n|---------|---------------|--------------------------|-----------------------|\n| 1       | 0 < V1 <= 120 | E1 = V1^2                | P1 = 100 * V1 - V1^2/10 |\n| 2       | 0 < V2 <= 120 | E2 = V2^2                | P2 = 100 * V2 - V2^2/10 |\n| 3       | 0 < V3 <= 120 | E3 = V3^2                | P3 = 100 * V3 - V3^2/10 |\n| 4       | 0 < V4 <= 120 | E4 = V4^2                | P4 = 100 * V4 - V4^2/10 |\n| 5       | 0 < V5 <= 120 | E5 = V5^2                | P5 = 100 * V5 - V5^2/10 |\n| 6       | 0 < V6 <= 120 | E6 = V6^2                | P6 = 100 * V6 - V6^2/10 |\n\nThe plant manager aims to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour. The total energy consumption should not exceed 15000 units, and the production rate from each machine should not be less than 10 units per hour.\n\nPlease help the plant manager determine the optimal voltage settings for each machine to achieve these goals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120)  # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120)  # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120)  # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120)  # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120)  # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120)  # voltage for machine 6\n\n# Define objective function\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\nTotalEnergy = E1 + E2 + E3 + E4 + E5 + E6\n\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\nTotalProduction = P1 + P2 + P3 + P4 + P5 + P6\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalEnergy)\n\n# Add constraints\nmodel.addCons(TotalEnergy <= 15000)\nmodel.addCons(TotalProduction >= 1000)\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\nmodel.addCons(P4 >= 10)\nmodel.addCons(P5 >= 10)\nmodel.addCons(P6 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods through three different modes: air, sea, and land. The company needs to determine the number of trips to schedule for each mode of transportation in the next quarter. Additionally, the company needs to decide on the investment amount ($) in technology upgrades for each mode to enhance efficiency and reduce fuel consumption, which directly impacts the operational cost per trip.\n// {\"number of trips by air\": \"TripsAir\", \"range\": \"TripsAir >= 0\", \"type\": \"integer\"}\n// {\"number of trips by sea\": \"TripsSea\", \"range\": \"TripsSea >= 0\", \"type\": \"integer\"}\n// {\"number of trips by land\": \"TripsLand\", \"range\": \"TripsLand >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for air\": \"TechAir\", \"range\": \"TechAir >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for sea\": \"TechSea\", \"range\": \"TechSea >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for land\": \"TechLand\", \"range\": \"TechLand >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in technology upgrades. For every $1000 invested in technology, the operational cost per trip reduces by $5 for air, $3 for sea, and $2 for land. The company aims to minimize the total operational cost of all trips.\nThe initial operational cost per trip for air is $1000, for sea is $800, and for land is $500.\n// Operational cost for air: CostAir = (1000 - 0.005 * TechAir) * TripsAir\n// Operational cost for sea: CostSea = (800 - 0.003 * TechSea) * TripsSea\n// Operational cost for land: CostLand = (500 - 0.002 * TechLand) * TripsLand\n// So, the objective function is: Minimize (CostAir + CostSea + CostLand)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational expenses and technology investments.\n// (1000 - 0.005 * TechAir) * TripsAir + (800 - 0.003 * TechSea) * TripsSea + (500 - 0.002 * TechLand) * TripsLand + TechAir + TechSea + TechLand <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes must not exceed 2000.\n// TripsAir + TripsSea + TripsLand <= 2000",
        "question": "A logistics company manages the transportation of goods through three different modes: air, sea, and land. The company needs to determine the number of trips to schedule for each mode of transportation in the next quarter and the investment amount ($) in technology upgrades for each mode to enhance efficiency and reduce fuel consumption, which directly impacts the operational cost per trip. The operational cost per trip decreases with the investment in technology upgrades. For every $1000 invested in technology, the operational cost per trip reduces by $5 for air, $3 for sea, and $2 for land. The initial operational cost per trip for air is $1000, for sea is $800, and for land is $500.\n\n| Mode       | Initial Operational Cost per Trip | Reduction per $1000 Investment |\n|------------|----------------------------------|--------------------------------|\n| Air        | $1000                            | $5                              |\n| Sea        | $800                             | $3                              |\n| Land       | $500                             | $2                              |\n\nThe company has a total budget of $100,000 for operational expenses and technology investments. The total number of trips across all modes must not exceed 2000.\n\nPlease help the company to minimize the total operational cost of all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsAir = model.addVar(vtype=\"INTEGER\", name=\"TripsAir\", lb=0)  # number of trips by air\nTripsSea = model.addVar(vtype=\"INTEGER\", name=\"TripsSea\", lb=0)  # number of trips by sea\nTripsLand = model.addVar(vtype=\"INTEGER\", name=\"TripsLand\", lb=0)  # number of trips by land\nTechAir = model.addVar(vtype=\"CONTINUOUS\", name=\"TechAir\", lb=0)  # investment in technology for air\nTechSea = model.addVar(vtype=\"CONTINUOUS\", name=\"TechSea\", lb=0)  # investment in technology for sea\nTechLand = model.addVar(vtype=\"CONTINUOUS\", name=\"TechLand\", lb=0)  # investment in technology for land\n\n# Define objective function\nCostAir = (1000 - 0.005 * TechAir) * TripsAir\nCostSea = (800 - 0.003 * TechSea) * TripsSea\nCostLand = (500 - 0.002 * TechLand) * TripsLand\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostAir + CostSea + CostLand)\n\n# Add constraints\nmodel.addCons((1000 - 0.005 * TechAir) * TripsAir + (800 - 0.003 * TechSea) * TripsSea + (500 - 0.002 * TechLand) * TripsLand + TechAir + TechSea + TechLand <= 100000)\nmodel.addCons(TripsAir + TripsSea + TripsLand <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Trips: \", model.getVal(TripsAir))\n    print(\"Number of Sea Trips: \", model.getVal(TripsSea))\n    print(\"Number of Land Trips: \", model.getVal(TripsLand))\n    print(\"Investment in Air Technology: \", model.getVal(TechAir))\n    print(\"Investment in Sea Technology: \", model.getVal(TechSea))\n    print(\"Investment in Land Technology: \", model.getVal(TechLand))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1354,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"distance from depot to warehouse 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 6\": \"D6\", \"range\": \"D6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe transportation cost is calculated based on the number of trucks and the distance each truck travels. The cost per kilometer is $2. The company aims to minimize the total transportation cost.\n// Total_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n// So, the objective function is: Minimize Total_Cost\n// Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined. The transportation cost is calculated based on the number of trucks and the distance each truck travels, with a cost of $2 per kilometer. The company aims to minimize the total transportation cost.\n\n| Warehouse | Number of Trucks | Distance from Depot |\n|-----------|------------------|---------------------|\n| 1         | T1               | D1                  |\n| 2         | T2               | D2                  |\n| 3         | T3               | D3                  |\n| 4         | T4               | D4                  |\n| 5         | T5               | D5                  |\n| 6         | T6               | D6                  |\n\nThe total number of trucks available is 50. Please help the company to minimize the total transportation cost, which is calculated as 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks at warehouse 6\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance from depot to warehouse 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance from depot to warehouse 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance from depot to warehouse 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance from depot to warehouse 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance from depot to warehouse 5\nD6 = model.addVar(vtype=\"CONTINUOUS\", name=\"D6\", lb=0) # distance from depot to warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nTotal_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Distance from Depot to Warehouse 1: \", model.getVal(D1))\n    print(\"Distance from Depot to Warehouse 2: \", model.getVal(D2))\n    print(\"Distance from Depot to Warehouse 3: \", model.getVal(D3))\n    print(\"Distance from Depot to Warehouse 4: \", model.getVal(D4))\n    print(\"Distance from Depot to Warehouse 5: \", model.getVal(D5))\n    print(\"Distance from Depot to Warehouse 6: \", model.getVal(D6))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA_Quantity\", \"range\": \"MachineA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB_Quantity\", \"range\": \"MachineB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC_Quantity\", \"range\": \"MachineC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD_Quantity\", \"range\": \"MachineD_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n// Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company wants to maximize the total net profit. The company has a total production capacity of 1000 machines per month. Please help the company to determine the optimal production quantity for each type of machine to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Quantity\", lb=0)\nMachineB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Quantity\", lb=0)\nMachineC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Quantity\", lb=0)\nMachineD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineD_Quantity\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n## Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineA_Quantity\")\nsqrt_MachineB_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineB_Quantity\")\nsqrt_MachineC_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineC_Quantity\")\nsqrt_MachineD_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineD_Quantity\")\nmodel.addCons(sqrt_MachineA_Quantity**2 == MachineA_Quantity)\nmodel.addCons(sqrt_MachineB_Quantity**2 == MachineB_Quantity)\nmodel.addCons(sqrt_MachineC_Quantity**2 == MachineC_Quantity)\nmodel.addCons(sqrt_MachineD_Quantity**2 == MachineD_Quantity)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Quantity) * MachineA_Quantity\nProfit_B = (700 - 300 * sqrt_MachineB_Quantity) * MachineB_Quantity\nProfit_C = (900 - 400 * sqrt_MachineC_Quantity) * MachineC_Quantity\nProfit_D = (1100 - 500 * sqrt_MachineD_Quantity) * MachineD_Quantity\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA_Quantity))\n    print(\"Number of MachineB: \", model.getVal(MachineB_Quantity))\n    print(\"Number of MachineC: \", model.getVal(MachineC_Quantity))\n    print(\"Number of MachineD: \", model.getVal(MachineD_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency and minimize operational costs. Additionally, the company is considering investing in fuel-efficient technologies for each type of vehicle, which will reduce fuel consumption and operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TruckTech\", \"range\": \"TruckTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"VanTech\", \"range\": \"VanTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"BikeTech\", \"range\": \"BikeTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each vehicle type decreases with the investment in fuel-efficient technology. The cost reduction is nonlinear, with diminishing returns as more technology is invested.\nThe operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology.\nThe operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology.\nThe operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology.\nThe company aims to minimize the total operational cost of all vehicles.\n// Total cost for Trucks: CostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\n// Total cost for Vans: CostVan = 70 * VanCount - 0.07 * VanTech * VanCount\n// Total cost for Bikes: CostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle purchases and technology investments.\n// TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 200.\n// TruckCount + VanCount + BikeCount <= 200\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Trucks must be at least twice the number of Vans.\n// TruckCount >= 2 * VanCount\n\n## Generate Constraint-4:\nThe investment in technology for Bikes must not exceed the combined investment in Trucks and Vans.\n// BikeTech <= TruckTech + VanTech",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle and the investment in fuel-efficient technologies for each type to maximize efficiency and minimize operational costs. The operational cost per Truck is $100 per day, reduced by $10 for every $100 invested in technology. The operational cost per Van is $70 per day, reduced by $7 for every $100 invested in technology. The operational cost per Bike is $30 per day, reduced by $3 for every $100 invested in technology. The company has a total budget of $10,000 for vehicle purchases and technology investments. The total number of vehicles cannot exceed 200. Due to maintenance constraints, the number of Trucks must be at least twice the number of Vans. The investment in technology for Bikes must not exceed the combined investment in Trucks and Vans. Please help the company to minimize the total operational cost of all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)\nTruckTech = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckTech\", lb=0)\nVanTech = model.addVar(vtype=\"CONTINUOUS\", name=\"VanTech\", lb=0)\nBikeTech = model.addVar(vtype=\"CONTINUOUS\", name=\"BikeTech\", lb=0)\n\n# Define objective function\nCostTruck = 100 * TruckCount - 0.1 * TruckTech * TruckCount\nCostVan = 70 * VanCount - 0.07 * VanTech * VanCount\nCostBike = 30 * BikeCount - 0.03 * BikeTech * BikeCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckCount + VanCount + BikeCount + TruckTech + VanTech + BikeTech <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 200)\nmodel.addCons(TruckCount >= 2 * VanCount)\nmodel.addCons(BikeTech <= TruckTech + VanTech)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Investment in Truck Tech: \", model.getVal(TruckTech))\n    print(\"Investment in Van Tech: \", model.getVal(VanTech))\n    print(\"Investment in Bike Tech: \", model.getVal(BikeTech))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line.\n// {\"number of production lines for DeviceA\": \"LineA\", \"range\": \"LineA >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceB\": \"LineB\", \"range\": \"LineB >= 0\", \"type\": \"integer\"}\n// {\"number of production lines for DeviceC\": \"LineC\", \"range\": \"LineC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceA lines\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceB lines\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per day for DeviceC lines\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost per production line per shift is $1000 for DeviceA, $1200 for DeviceB, and $1500 for DeviceC. The company aims to maximize its total daily profit.\n// Total daily profit for DeviceA: ProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\n// Total daily profit for DeviceB: ProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\n// Total daily profit for DeviceC: ProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10 production lines available.\n// LineA + LineB + LineC <= 10\n\n## Generate Constraint-2:\nEach production line can operate up to 3 shifts per day.\n// ShiftA <= 3; ShiftB <= 3; ShiftC <= 3\n\n## Generate Constraint-3:\nThe total daily production cost for all devices must not exceed $30,000.\n// 1000 * LineA * ShiftA + 1200 * LineB * ShiftB + 1500 * LineC * ShiftC <= 30000\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of DeviceA, 600 units of DeviceB, and 700 units of DeviceC daily.\n// LineA * ShiftA * 100 >= 500; LineB * ShiftB * 100 >= 600; LineC * ShiftC * 100 >= 700",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of production lines to dedicate to each device type and the number of shifts per day for each line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost per production line per shift is $1000 for DeviceA, $1200 for DeviceB, and $1500 for DeviceC. The company aims to maximize its total daily profit. The company has a total of 10 production lines available. Each production line can operate up to 3 shifts per day. The total daily production cost for all devices must not exceed $30,000. The company must produce at least 500 units of DeviceA, 600 units of DeviceB, and 700 units of DeviceC daily. Please help the company to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLineA = model.addVar(vtype=\"INTEGER\", name=\"LineA\", lb=0) # number of production lines for DeviceA\nLineB = model.addVar(vtype=\"INTEGER\", name=\"LineB\", lb=0) # number of production lines for DeviceB\nLineC = model.addVar(vtype=\"INTEGER\", name=\"LineC\", lb=0) # number of production lines for DeviceC\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0) # number of shifts per day for DeviceA lines\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0) # number of shifts per day for DeviceB lines\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0) # number of shifts per day for DeviceC lines\n\n# Define objective function\nProfitA = (50 * LineA * ShiftA * 100) - (1000 * LineA * ShiftA)\nProfitB = (70 * LineB * ShiftB * 100) - (1200 * LineB * ShiftB)\nProfitC = (90 * LineC * ShiftC * 100) - (1500 * LineC * ShiftC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LineA + LineB + LineC <= 10)\nmodel.addCons(ShiftA <= 3)\nmodel.addCons(ShiftB <= 3)\nmodel.addCons(ShiftC <= 3)\nmodel.addCons(1000 * LineA * ShiftA + 1200 * LineB * ShiftB + 1500 * LineC * ShiftC <= 30000)\nmodel.addCons(LineA * ShiftA * 100 >= 500)\nmodel.addCons(LineB * ShiftB * 100 >= 600)\nmodel.addCons(LineC * ShiftC * 100 >= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines for DeviceA: \", model.getVal(LineA))\n    print(\"Number of Production Lines for DeviceB: \", model.getVal(LineB))\n    print(\"Number of Production Lines for DeviceC: \", model.getVal(LineC))\n    print(\"Number of Shifts per Day for DeviceA Lines: \", model.getVal(ShiftA))\n    print(\"Number of Shifts per Day for DeviceB Lines: \", model.getVal(ShiftB))\n    print(\"Number of Shifts per Day for DeviceC Lines: \", model.getVal(ShiftC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product A\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product B\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product C\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkersA * 100\n// Profit_B = UnitsB * 70 - WorkersB * 120\n// Profit_C = UnitsC * 60 - WorkersC * 110\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C.\n// UnitsA <= 100\n// UnitsB <= 150\n// UnitsC <= 120\n\n## Generate Constraint-3:\nThe efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\n// UnitsA <= 2 * WorkersA\n// UnitsB <= 3 * WorkersB\n// UnitsC <= 2.5 * WorkersC",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\nThe company has a total of 50 workers available. The production capacity per day is limited to 100 units for product A, 150 units for product B, and 120 units for product C. The efficiency of workers varies: each worker can produce 2 units of product A per day, 3 units of product B per day, and 2.5 units of product C per day.\nPlease help the company determine the optimal number of units to produce for each product and the number of workers to assign to each product line to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for product A\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for product B\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkersA * 100\nProfit_B = UnitsB * 70 - WorkersB * 120\nProfit_C = UnitsC * 60 - WorkersC * 110\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)  # Total workers constraint\nmodel.addCons(UnitsA <= 100)  # Production capacity for product A\nmodel.addCons(UnitsB <= 150)  # Production capacity for product B\nmodel.addCons(UnitsC <= 120)  # Production capacity for product C\nmodel.addCons(UnitsA <= 2 * WorkersA)  # Efficiency constraint for product A\nmodel.addCons(UnitsB <= 3 * WorkersB)  # Efficiency constraint for product B\nmodel.addCons(UnitsC <= 2.5 * WorkersC)  # Efficiency constraint for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Workers for Product A: \", model.getVal(WorkersA))\n    print(\"Number of Workers for Product B: \", model.getVal(WorkersB))\n    print(\"Number of Workers for Product C: \", model.getVal(WorkersC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\n// {\"number of solar panels in Region A\": \"SolarPanels_A\", \"range\": \"SolarPanels_A >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindTurbines_A\", \"range\": \"WindTurbines_A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarPanels_B\", \"range\": \"SolarPanels_B >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindTurbines_B\", \"range\": \"WindTurbines_B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarPanels_C\", \"range\": \"SolarPanels_C >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindTurbines_C\", \"range\": \"WindTurbines_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n// Total cost in Region A: Cost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\n// Total cost in Region B: Cost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\n// Total cost in Region C: Cost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\n// Total energy production in Region A: Energy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\n// Total energy production in Region B: Energy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\n// Total energy production in Region C: Energy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total daily energy production in each region must be at least 1000 kWh.\n// Energy_A >= 1000; Energy_B >= 1000; Energy_C >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for installation costs across all regions.\n// Cost_A + Cost_B + Cost_C <= 500,000\n\n## Generate Constraint-3:\nDue to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines.\n// SolarPanels_A <= 500; WindTurbines_A <= 200",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs. The cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to ensure a minimum daily energy production of 1000 kWh per region. The company has a budget of $500,000 for installation costs across all regions. Due to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines. Please help the company to minimize the total cost of installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels_A = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_A\", lb=0)\nWindTurbines_A = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_A\", lb=0)\nSolarPanels_B = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_B\", lb=0)\nWindTurbines_B = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_B\", lb=0)\nSolarPanels_C = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_C\", lb=0)\nWindTurbines_C = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_C\", lb=0)\n\n# Define objective function\nCost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\nCost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\nCost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nEnergy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\nEnergy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\nEnergy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\nmodel.addCons(Energy_A >= 1000)\nmodel.addCons(Energy_B >= 1000)\nmodel.addCons(Energy_C >= 1000)\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 500000)\nmodel.addCons(SolarPanels_A <= 500)\nmodel.addCons(WindTurbines_A <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarPanels_A))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindTurbines_A))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarPanels_B))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindTurbines_B))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarPanels_C))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindTurbines_C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours of machine type 1 used\": \"HoursMachine1\", \"range\": \"HoursMachine1 >= 0\", \"type\": \"real\"}\n// {\"hours of machine type 2 used\": \"HoursMachine2\", \"range\": \"HoursMachine2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// Cost_Machine1 = HoursMachine1 * 20\n// Cost_Machine2 = HoursMachine2 * 30\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n## Generate Constraint-1:\nThe total production time available for machine type 1 is 8 hours per day.\n// UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1\n\n## Generate Constraint-2:\nThe total production time available for machine type 2 is 10 hours per day.\n// UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2\n\n## Generate Constraint-3:\nThe manufacturer has a daily budget of $200 for machine operation costs.\n// 20 * HoursMachine1 + 30 * HoursMachine2 <= 200\n\n## Generate Constraint-4:\nThe total number of units produced cannot exceed 50 units per day.\n// UnitsA + UnitsB + UnitsC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\nThe total production time available for machine type 1 is 8 hours per day. The total production time available for machine type 2 is 10 hours per day. The manufacturer has a daily budget of $200 for machine operation costs. The total number of units produced cannot exceed 50 units per day.\nPlease help the manufacturer to maximize the total daily profit, considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nHoursMachine1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine1\", lb=0)  # hours of machine type 1 used\nHoursMachine2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine2\", lb=0)  # hours of machine type 2 used\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nCost_Machine1 = HoursMachine1 * 20\nCost_Machine2 = HoursMachine2 * 30\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n# Add constraints\n# The total production time available for machine type 1 is 8 hours per day.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1)\n# The total production time available for machine type 2 is 10 hours per day.\nmodel.addCons(UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2)\n# The manufacturer has a daily budget of $200 for machine operation costs.\nmodel.addCons(20 * HoursMachine1 + 30 * HoursMachine2 <= 200)\n# The total number of units produced cannot exceed 50 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours of Machine Type 1 Used: \", model.getVal(HoursMachine1))\n    print(\"Hours of Machine Type 2 Used: \", model.getVal(HoursMachine2))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of vehicles of each type to deploy for the next quarter. Additionally, the company needs to decide on the level of maintenance ($) for each vehicle type to optimize fuel efficiency and reduce operational costs.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"maintenance cost for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with increased maintenance. For every $100 spent on maintenance for TruckA, the fuel efficiency increases by 1.5 liters per 100 kilometers. For TruckB, the increase is 1.2 liters per 100 kilometers for every $100 spent, and for TruckC, it's 1.8 liters per 100 kilometers. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for TruckA: ConsumptionA = (InitialFuelConsumptionA - 0.015 * MaintenanceA) * TruckA\n// Fuel consumption for TruckB: ConsumptionB = (InitialFuelConsumptionB - 0.012 * MaintenanceB) * TruckB\n// Fuel consumption for TruckC: ConsumptionC = (InitialFuelConsumptionC - 0.018 * MaintenanceC) * TruckC\n// So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for vehicle deployment and maintenance.\n// TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC <= 20000\n\n## Generate Constraint-2:\nThe total number of vehicles that can be deployed is limited to 200.\n// TruckA + TruckB + TruckC <= 200\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB.\n// TruckA >= 50; TruckB >= 70\n\n## Generate Constraint-4:\nThe maintenance cost for each vehicle type cannot exceed 10% of the total budget allocated for vehicle deployment and maintenance.\n// MaintenanceA <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC)\n// MaintenanceB <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC)\n// MaintenanceC <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC)",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of vehicles of each type to deploy for the next quarter and the level of maintenance ($) for each vehicle type to optimize fuel efficiency and reduce operational costs. The relationship between maintenance cost and fuel efficiency for each vehicle type is as follows:\n\n| Vehicle Type | Maintenance Impact on Fuel Efficiency |\n|--------------|----------------------------------------|\n| TruckA       | 1.5 liters per 100 km increase for every $100 spent |\n| TruckB       | 1.2 liters per 100 km increase for every $100 spent |\n| TruckC       | 1.8 liters per 100 km increase for every $100 spent |\n\nThe company has a budget of $20,000 for vehicle deployment and maintenance. The total number of vehicles that can be deployed is limited to 200. Due to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB. The maintenance cost for each vehicle type cannot exceed 10% of the total budget allocated for vehicle deployment and maintenance.\n\nPlease help the company to minimize the total fuel consumption across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=50)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=70)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)    # number of TruckC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance cost for TruckA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance cost for TruckB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance cost for TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel consumption for TruckA: ConsumptionA = (InitialFuelConsumptionA - 0.015 * MaintenanceA) * TruckA\n## Fuel consumption for TruckB: ConsumptionB = (InitialFuelConsumptionB - 0.012 * MaintenanceB) * TruckB\n## Fuel consumption for TruckC: ConsumptionC = (InitialFuelConsumptionC - 0.018 * MaintenanceC) * TruckC\n## So, the objective function is: Minimize (ConsumptionA + ConsumptionB + ConsumptionC)\nConsumptionA = (1 - 0.015 * MaintenanceA) * TruckA\nConsumptionB = (1 - 0.012 * MaintenanceB) * TruckB\nConsumptionC = (1 - 0.018 * MaintenanceC) * TruckC\nmodel.addCons(obj == ConsumptionA + ConsumptionB + ConsumptionC)\n\n# Add constraints\n## The company has a budget of $20,000 for vehicle deployment and maintenance.\nmodel.addCons(TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC <= 20000)\n## The total number of vehicles that can be deployed is limited to 200.\nmodel.addCons(TruckA + TruckB + TruckC <= 200)\n## Due to contractual obligations, the company must deploy at least 50 TruckA and 70 TruckB.\n## The maintenance cost for each vehicle type cannot exceed 10% of the total budget allocated for vehicle deployment and maintenance.\nmodel.addCons(MaintenanceA <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC))\nmodel.addCons(MaintenanceB <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC))\nmodel.addCons(MaintenanceC <= 0.1 * (TruckA + TruckB + TruckC + MaintenanceA + MaintenanceB + MaintenanceC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Maintenance Cost for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Cost for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Cost for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route1\": \"Additive1\", \"range\": \"Additive1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route2\": \"Additive2\", \"range\": \"Additive2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes.\n// Fuel cost on Route1: Cost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\n// Fuel cost on Route2: Cost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe total number of trucks available for both routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe budget for fuel additives is limited to $1000.\n// Additive1 + Additive2 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h.\n// Speed1 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency. The fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes. The total number of trucks available for both routes is limited to 50. The budget for fuel additives is limited to $1000. Due to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h. Please help the company to determine the optimal number of trucks, their speeds, and the amount of fuel additive to use on each route to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks on Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route2\nAdditive1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive1\", lb=0)  # amount of fuel additive used on Route1\nAdditive2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive2\", lb=0)  # amount of fuel additive used on Route2\n\n# Define objective function\nCost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\nCost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons(Additive1 + Additive2 <= 1000)\nmodel.addCons(Speed1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks on Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route2: \", model.getVal(Speed2))\n    print(\"Amount of Fuel Additive on Route1: \", model.getVal(Additive1))\n    print(\"Amount of Fuel Additive on Route2: \", model.getVal(Additive2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Solar1, the cost per unit is $1000, the energy output is 100 kWh, and the maintenance cost is $50 per year.\nFor Solar2, the cost per unit is $1200, the energy output is 120 kWh, and the maintenance cost is $60 per year.\nFor Solar3, the cost per unit is $1500, the energy output is 150 kWh, and the maintenance cost is $75 per year.\nFor Solar4, the cost per unit is $1800, the energy output is 180 kWh, and the maintenance cost is $90 per year.\nFor Solar5, the cost per unit is $2000, the energy output is 200 kWh, and the maintenance cost is $100 per year.\nFor Wind1, the cost per unit is $2500, the energy output is 250 kWh, and the maintenance cost is $125 per year.\nFor Wind2, the cost per unit is $3000, the energy output is 300 kWh, and the maintenance cost is $150 per year.\nFor Wind3, the cost per unit is $3500, the energy output is 350 kWh, and the maintenance cost is $175 per year.\nThe company wants to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output.\n// Initial Investment Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\n// Annual Maintenance Cost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\n// Total Energy Output = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n// So, the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3 <= 100000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\nFor Solar1, the cost per unit is $1000, the energy output is 100 kWh, and the maintenance cost is $50 per year.\nFor Solar2, the cost per unit is $1200, the energy output is 120 kWh, and the maintenance cost is $60 per year.\nFor Solar3, the cost per unit is $1500, the energy output is 150 kWh, and the maintenance cost is $75 per year.\nFor Solar4, the cost per unit is $1800, the energy output is 180 kWh, and the maintenance cost is $90 per year.\nFor Solar5, the cost per unit is $2000, the energy output is 200 kWh, and the maintenance cost is $100 per year.\nFor Wind1, the cost per unit is $2500, the energy output is 250 kWh, and the maintenance cost is $125 per year.\nFor Wind2, the cost per unit is $3000, the energy output is 300 kWh, and the maintenance cost is $150 per year.\nFor Wind3, the cost per unit is $3500, the energy output is 350 kWh, and the maintenance cost is $175 per year.\nThe company has a budget of $100,000 for the initial investment. The company wants to ensure that at least 50% of the budget is spent on solar panels.\nPlease help the company to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialInvestmentCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\nAnnualMaintenanceCost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\nTotalEnergyOutput = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n## the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n## convert the division to multiplication\nmodel.addCons(obj * TotalEnergyOutput == InitialInvestmentCost + AnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for the initial investment.\nmodel.addCons(InitialInvestmentCost <= 100000)\n## The company wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (InitialInvestmentCost))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Minimized TCO: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1500,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of component C1, with only 500 units available.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 500",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints. The profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer has a limited supply of component C1, with only 500 units available. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n# The manufacturer has a limited supply of component C1, with only 500 units available.\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 611,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption.\n// {\"number of Compact vehicles\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Sedan vehicles\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of SUV vehicles\": \"SUV\", \"range\": \"SUV >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Truck vehicles\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type varies. Compact vehicles consume 10 liters per 100 km, Sedans consume 12 liters per 100 km, SUVs consume 15 liters per 100 km, Vans consume 20 liters per 100 km, and Trucks consume 25 liters per 100 km. The company aims to minimize the total fuel consumption while ensuring all transportation needs are met. The total distance traveled by all vehicles is expected to be 5000 km.\n// Fuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n// The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\n// Minimize 500 * C + 600 * S + 750 * SUV + 1000 * V + 1250 * T\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 to purchase vehicles. Compact vehicles cost $10,000 each, Sedans cost $15,000 each, SUVs cost $20,000 each, Vans cost $25,000 each, and Trucks cost $30,000 each.\n// 10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000\n\n## Generate Constraint-2:\nThe company has a limit on the number of vehicles it can operate. The maximum number of Compact vehicles is 5, Sedans is 4, SUVs is 3, Vans is 2, and Trucks is 1.\n// C <= 5; S <= 4; SUV <= 3; V <= 2; T <= 1\n\n## Generate Constraint-3:\nThe total number of vehicles must not exceed 10 due to operational constraints.\n// C + S + SUV + V + T <= 10\n\n## Generate Constraint-4:\nThe company must ensure at least 2 different types of vehicles are in operation to handle various types of cargo and routes.\n// C + S + SUV + V + T >= 2",
        "question": "A logistics company operates five different types of vehicles: Compact, Sedan, SUV, Van, and Truck. The company needs to determine the optimal number of each vehicle type to maximize efficiency and minimize fuel consumption. The fuel efficiency of each vehicle type is given in the following Table.\n\n| Vehicle Type | Fuel Consumption (liters per 100 km) |\n|--------------|-------------------------------------|\n| Compact      | 10                                  |\n| Sedan        | 12                                  |\n| SUV          | 15                                  |\n| Van          | 20                                  |\n| Truck        | 25                                  |\n\nThe company has a total budget of $50,000 to purchase vehicles. Compact vehicles cost $10,000 each, Sedans cost $15,000 each, SUVs cost $20,000 each, Vans cost $25,000 each, and Trucks cost $30,000 each. The company has a limit on the number of vehicles it can operate: the maximum number of Compact vehicles is 5, Sedans is 4, SUVs is 3, Vans is 2, and Trucks is 1. The total number of vehicles must not exceed 10 due to operational constraints. The company must ensure at least 2 different types of vehicles are in operation to handle various types of cargo and routes. The total distance traveled by all vehicles is expected to be 5000 km.\n\nPlease help the company to minimize the total fuel consumption while ensuring all transportation needs are met.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Compact vehicles\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Sedan vehicles\nSUV = model.addVar(vtype=\"INTEGER\", name=\"SUV\", lb=0) # number of SUV vehicles\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Van vehicles\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Truck vehicles\n\n# Define objective function\nFuel_Consumption = 10 * C + 12 * S + 15 * SUV + 20 * V + 25 * T\n# The objective function is: Minimize Fuel_Consumption * 50 (to account for the total distance of 5000 km)\n# Minimize 500 * C + 600 * S + 750 * SUV + 1000 * V + 1250 * T\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500 * C + 600 * S + 750 * SUV + 1000 * V + 1250 * T)\n\n# Add constraints\n# The company has a total budget of $50,000 to purchase vehicles.\nmodel.addCons(10000 * C + 15000 * S + 20000 * SUV + 25000 * V + 30000 * T <= 50000)\n# The company has a limit on the number of vehicles it can operate.\nmodel.addCons(C <= 5)\nmodel.addCons(S <= 4)\nmodel.addCons(SUV <= 3)\nmodel.addCons(V <= 2)\nmodel.addCons(T <= 1)\n# The total number of vehicles must not exceed 10 due to operational constraints.\nmodel.addCons(C + S + SUV + V + T <= 10)\n# The company must ensure at least 2 different types of vehicles are in operation.\nmodel.addCons(C + S + SUV + V + T >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Compact vehicles: \", model.getVal(C))\n    print(\"Number of Sedan vehicles: \", model.getVal(S))\n    print(\"Number of SUV vehicles: \", model.getVal(SUV))\n    print(\"Number of Van vehicles: \", model.getVal(V))\n    print(\"Number of Truck vehicles: \", model.getVal(T))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1442,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy trucks\": \"HeavyTech\", \"range\": \"HeavyTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Light trucks\": \"LightTech\", \"range\": \"LightTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n// Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n// Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n// So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000.\n// 50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks. The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000. The total number of trucks cannot exceed 50. Please help the company to maximize the total fuel cost savings across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of Heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of Light trucks\nHeavyTech = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyTech\", lb=0)  # investment in fuel-efficient technology for Heavy trucks\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)  # investment in fuel-efficient technology for Medium trucks\nLightTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LightTech\", lb=0)  # investment in fuel-efficient technology for Light trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n## Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n## Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n## So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\nSavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * 1000  # Assuming MilesHeavy = 1000 for simplification\nSavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * 1000  # Assuming MilesMedium = 1000 for simplification\nSavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * 1000  # Assuming MilesLight = 1000 for simplification\nmodel.addCons(obj == SavingsHeavy + SavingsMedium + SavingsLight)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Heavy Tech: \", model.getVal(HeavyTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Light Tech: \", model.getVal(LightTech))\n    print(\"Total Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h) and the number of trucks assigned to each route.\n// {\"speed of Truck1\": \"Speed1\", \"range\": \"Speed1 >= 0\", \"type\": \"continuous\"}\n// {\"speed of Truck2\": \"Speed2\", \"range\": \"Speed2 >= 0\", \"type\": \"continuous\"}\n// {\"speed of Truck3\": \"Speed3\", \"range\": \"Speed3 >= 0\", \"type\": \"continuous\"}\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, with higher speeds leading to greater fuel consumption. The fuel consumption function for each truck is given by: Fuel_Consumption = k * Speed^2, where k is a constant. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Total fuel consumption for Truck1: Fuel1 = k1 * Speed1^2 * TrucksA\n// Total fuel consumption for Truck2: Fuel2 = k2 * Speed2^2 * TrucksB\n// Total fuel consumption for Truck3: Fuel3 = k3 * Speed3^2 * TrucksC\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across all routes.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for all trucks is 100 km/h.\n// Speed1 <= 100; Speed2 <= 100; Speed3 <= 100\n\n## Generate Constraint-3:\nDue to road conditions, the speed of Truck1 must be at least half the speed of Truck2.\n// Speed1 >= 0.5 * Speed2\n\n## Generate Constraint-4:\nThe total distance covered by all trucks on RouteA must not exceed 5000 km.\n// Speed1 * TrucksA <= 5000\n\n## Generate Constraint-5:\nThe company must ensure that at least one truck is assigned to each route.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h) and the number of trucks assigned to each route. The fuel consumption of each truck is modeled as a nonlinear function of its speed, with higher speeds leading to greater fuel consumption. The company aims to minimize the total fuel consumption across all trucks and routes. The company has a total of 50 trucks available for allocation across all routes. The maximum speed limit for all trucks is 100 km/h. Due to road conditions, the speed of Truck1 must be at least half the speed of Truck2. The total distance covered by all trucks on RouteA must not exceed 5000 km. The company must ensure that at least one truck is assigned to each route.\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of Truck1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of Truck2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of Truck3\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks on RouteC\n\n# Define objective function\n# Total fuel consumption for Truck1: Fuel1 = k1 * Speed1^2 * TrucksA\n# Total fuel consumption for Truck2: Fuel2 = k2 * Speed2^2 * TrucksB\n# Total fuel consumption for Truck3: Fuel3 = k3 * Speed3^2 * TrucksC\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\")\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\")\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\")\nmodel.setObjective(Fuel1 + Fuel2 + Fuel3, \"minimize\")\nmodel.addCons(Fuel1 == Speed1**2 * TrucksA)\nmodel.addCons(Fuel2 == Speed2**2 * TrucksB)\nmodel.addCons(Fuel3 == Speed3**2 * TrucksC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation across all routes.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The maximum speed limit for all trucks is 100 km/h.\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\nmodel.addCons(Speed3 <= 100)\n# Due to road conditions, the speed of Truck1 must be at least half the speed of Truck2.\nmodel.addCons(Speed1 >= 0.5 * Speed2)\n# The total distance covered by all trucks on RouteA must not exceed 5000 km.\nmodel.addCons(Speed1 * TrucksA <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Speed of Truck3: \", model.getVal(Speed3))\n    print(\"Number of trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks.\n// {\"fuel consumption of Truck1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel consumption rate and maintenance cost per kilometer. The rates are as follows:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost.\n// Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n// Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n// So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\n\n## Generate Constraint-1:\nThe total distance covered by all trucks should not exceed 10,000 km.\n// F1 + F2 + F3 + F4 + F5 <= 10000\n\n## Generate Constraint-2:\nTruck1 and Truck2 combined should cover at least 3000 km.\n// F1 + F2 >= 3000\n\n## Generate Constraint-3:\nTruck3 and Truck4 combined should not exceed 4000 km.\n// F3 + F4 <= 4000",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks. The fuel consumption rate and maintenance cost per kilometer for each truck are given in the following Table.\n\n| Truck  | Fuel Consumption (liters/km) | Maintenance Cost ($/km) |\n|--------|-----------------------------|-------------------------|\n| Truck1 | 0.15                        | 2                       |\n| Truck2 | 0.20                        | 3                       |\n| Truck3 | 0.18                        | 2.5                     |\n| Truck4 | 0.22                        | 3.5                     |\n| Truck5 | 0.25                        | 4                       |\n\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost. The total distance covered by all trucks should not exceed 10,000 km. Truck1 and Truck2 combined should cover at least 3000 km. Truck3 and Truck4 combined should not exceed 4000 km.\n\nPlease help the company to determine the optimal distance each truck should travel to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of Truck1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of Truck2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of Truck3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of Truck4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n## Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n## So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\nTotalFuelCost = 0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5\nTotalMaintenanceCost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The total distance covered by all trucks should not exceed 10,000 km.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 10000)\n## Truck1 and Truck2 combined should cover at least 3000 km.\nmodel.addCons(F1 + F2 >= 3000)\n## Truck3 and Truck4 combined should not exceed 4000 km.\nmodel.addCons(F3 + F4 <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(F1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(F2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(F3))\n    print(\"Fuel consumption of Truck4: \", model.getVal(F4))\n    print(\"Fuel consumption of Truck5: \", model.getVal(F5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, storage limitations, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"storage space required for product A\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"real\"}\n// {\"storage space required for product B\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"real\"}\n// {\"storage space required for product C\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling all three products.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity of 200 cubic meters. Each unit of product A requires 1 cubic meter, product B requires 2 cubic meters, and product C requires 1.5 cubic meters.\n// StorageA * UnitsA + StorageB * UnitsB + StorageC * UnitsC <= 200\n\n## Generate Constraint-3:\nThe market demand for product A is at least 30 units per day, for product B is at least 20 units per day, and for product C is at least 40 units per day.\n// UnitsA >= 30\n// UnitsB >= 20\n// UnitsC >= 40\n\n## Generate Constraint-4:\nThe production process for product B is nonlinear and depends on the square of the number of units produced. Specifically, the production cost of product B is proportional to the square of UnitsB.\n// 70 * UnitsB - k * UnitsB^2 >= 0, where k is a positive constant representing the cost coefficient.",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit, considering the production capacity, storage limitations, and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling all three products. The total production capacity of the company is 100 units per day. The company has a storage capacity of 200 cubic meters. Each unit of product A requires 1 cubic meter, product B requires 2 cubic meters, and product C requires 1.5 cubic meters. The market demand for product A is at least 30 units per day, for product B is at least 20 units per day, and for product C is at least 40 units per day. The production process for product B is nonlinear and depends on the square of the number of units produced. Specifically, the production cost of product B is proportional to the square of UnitsB. Please help the company to determine the optimal production quantities for products A, B, and C to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=30) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=20) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=40) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the company is 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n# The company has a storage capacity of 200 cubic meters.\nStorageA = 1\nStorageB = 2\nStorageC = 1.5\nmodel.addCons(StorageA * UnitsA + StorageB * UnitsB + StorageC * UnitsC <= 200)\n# The production process for product B is nonlinear and depends on the square of the number of units produced.\nk = 1  # Assuming k is given or can be estimated\nmodel.addCons(70 * UnitsB - k * UnitsB**2 >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space that can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-3:\nDue to market demand, the production of M1 must be at least twice the production of M2.\n// M1 >= 2 * M2\n\n## Generate Constraint-4:\nThe company has a contract that requires them to produce at least 10 units of M3.\n// M3 >= 10\n\n## Generate Constraint-5:\nThe production time for M1 is 5 hours per unit, for M2 is 8 hours per unit, and for M3 is 10 hours per unit. The total production time available is 1000 hours.\n// 5 * M1 + 8 * M2 + 10 * M3 <= 1000",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company has a total production budget of $100,000. The company has a limited storage space that can hold a maximum of 100 units in total. Due to market demand, the production of M1 must be at least twice the production of M2. The company has a contract that requires them to produce at least 10 units of M3. The production time for M1 is 5 hours per unit, for M2 is 8 hours per unit, and for M3 is 10 hours per unit. The total production time available is 1000 hours.\nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=10) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n# So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n# The company has a total production budget of $100,000.\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n# The company has a limited storage space that can hold a maximum of 100 units in total.\nmodel.addCons(M1 + M2 + M3 <= 100)\n# Due to market demand, the production of M1 must be at least twice the production of M2.\nmodel.addCons(M1 >= 2 * M2)\n# The company has a contract that requires them to produce at least 10 units of M3.\nmodel.addCons(M3 >= 10)\n# The production time for M1 is 5 hours per unit, for M2 is 8 hours per unit, and for M3 is 10 hours per unit. The total production time available is 1000 hours.\nmodel.addCons(5 * M1 + 8 * M2 + 10 * M3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The company wants to minimize the total fuel consumption while ensuring timely deliveries. The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The objective is to minimize the total fuel consumption per delivery time.\n// Fuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\n// Delivery_Time = (1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5))\n// So, the objective function is: Minimize Fuel_Consumption / Delivery_Time\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000.\n// 20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy. Each type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The company wants to minimize the total fuel consumption while ensuring timely deliveries. The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000. The total number of trucks cannot exceed 50. Please help the company to minimize the total fuel consumption per delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nFuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\nDelivery_Time = 1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize Fuel_Consumption / Delivery_Time\n# convert the division to multiplication\nmodel.addCons(obj * Delivery_Time == Fuel_Consumption)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency.\n// {\"number of trucks for RouteX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for RouteX\": \"UpgradeX\", \"range\": \"UpgradeX >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteY\": \"UpgradeY\", \"range\": \"UpgradeY >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for RouteZ\": \"UpgradeZ\", \"range\": \"UpgradeZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route decreases nonlinearly with the investment in fuel efficiency upgrades. The cost reduction is modeled as a quadratic function where the cost per kilometer decreases by a factor proportional to the square of the upgrade investment.\nThe initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ.\nThe company aims to minimize the total operational cost across all routes.\n// Operational cost for RouteX: CostX = 10 * TrucksX - 0.01 * UpgradeX^2 * TrucksX\n// Operational cost for RouteY: CostY = 12 * TrucksY - 0.015 * UpgradeY^2 * TrucksY\n// Operational cost for RouteZ: CostZ = 15 * TrucksZ - 0.02 * UpgradeZ^2 * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\n// TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company must determine the level of fuel efficiency upgrades for each route, which affects the operational cost and delivery efficiency. The initial operational cost per kilometer for RouteX is $10, for RouteY is $12, and for RouteZ is $15. The cost reduction per kilometer for each $1000 invested in upgrades is modeled as (0.01 * Upgrade^2) for RouteX, (0.015 * Upgrade^2) for RouteY, and (0.02 * Upgrade^2) for RouteZ.\n\n| Route | Initial Operational Cost per Kilometer | Cost Reduction per $1000 Invested |\n|-------|----------------------------------------|-----------------------------------|\n| RouteX | $10                                   | 0.01 * Upgrade^2                  |\n| RouteY | $12                                   | 0.015 * Upgrade^2                 |\n| RouteZ | $15                                   | 0.02 * Upgrade^2                  |\n\nThe company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency. The company aims to minimize the total operational cost across all routes. Please help the company determine the optimal number of trucks and the level of fuel efficiency upgrades for each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for RouteX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for RouteY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for RouteZ\nUpgradeX = model.addVar(name=\"UpgradeX\", lb=0) # fuel efficiency upgrade for RouteX\nUpgradeY = model.addVar(name=\"UpgradeY\", lb=0) # fuel efficiency upgrade for RouteY\nUpgradeZ = model.addVar(name=\"UpgradeZ\", lb=0) # fuel efficiency upgrade for RouteZ\n\n# Define objective function\nCostX = 10 * TrucksX - 0.01 * UpgradeX**2 * TrucksX\nCostY = 12 * TrucksY - 0.015 * UpgradeY**2 * TrucksY\nCostZ = 15 * TrucksZ - 0.02 * UpgradeZ**2 * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + UpgradeX + UpgradeY + UpgradeZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for RouteY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for RouteZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Efficiency Upgrade for RouteX: \", model.getVal(UpgradeX))\n    print(\"Fuel Efficiency Upgrade for RouteY: \", model.getVal(UpgradeY))\n    print(\"Fuel Efficiency Upgrade for RouteZ: \", model.getVal(UpgradeZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1343,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to different routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route, the fuel efficiency of each truck, and the fuel consumption rate per kilometer.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per kilometer for Route1\": \"ConsumptionRate1\", \"range\": \"ConsumptionRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per kilometer for Route2\": \"ConsumptionRate2\", \"range\": \"ConsumptionRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per kilometer for Route3\": \"ConsumptionRate3\", \"range\": \"ConsumptionRate3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of the logistics company is primarily driven by fuel expenses. The cost of fuel per liter is $1.5. The company aims to minimize the total fuel cost across all routes.\n// Fuel_Cost_Route1 = Trucks1 * (Route_Distance1 / Efficiency1) * ConsumptionRate1 * 1.5\n// Fuel_Cost_Route2 = Trucks2 * (Route_Distance2 / Efficiency2) * ConsumptionRate2 * 1.5\n// Fuel_Cost_Route3 = Trucks3 * (Route_Distance3 / Efficiency3) * ConsumptionRate3 * 1.5\n// So, the objective function is: Minimize (Fuel_Cost_Route1 + Fuel_Cost_Route2 + Fuel_Cost_Route3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-2:\nThe total fuel budget for the month is $10,000.\n// Fuel_Cost_Route1 + Fuel_Cost_Route2 + Fuel_Cost_Route3 <= 10000\n\n## Generate Constraint-3:\nEach route has a minimum and maximum distance that trucks can travel. Route1 has a distance range of 500-1000 km, Route2 has a range of 800-1500 km, and Route3 has a range of 1000-2000 km.\n// Route_Distance1 = 500 + 500 * Trucks1\n// Route_Distance2 = 800 + 700 * Trucks2\n// Route_Distance3 = 1000 + 1000 * Trucks3\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the total trucks are allocated to Route1, and no more than 50% of the total trucks are allocated to Route2.\n// Trucks1 >= 0.2 * (Trucks1 + Trucks2 + Trucks3)\n// Trucks2 <= 0.5 * (Trucks1 + Trucks2 + Trucks3)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to different routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route, the fuel efficiency of each truck, and the fuel consumption rate per kilometer. The operational cost of the logistics company is primarily driven by fuel expenses, with a cost of fuel per liter at $1.5. The company aims to minimize the total fuel cost across all routes.\n\nThe total number of trucks available in the fleet is 50. The total fuel budget for the month is $10,000. Each route has a minimum and maximum distance that trucks can travel: Route1 has a distance range of 500-1000 km, Route2 has a range of 800-1500 km, and Route3 has a range of 1000-2000 km. The company must ensure that at least 20% of the total trucks are allocated to Route1, and no more than 50% of the total trucks are allocated to Route2.\n\nPlease help the company to minimize the total fuel cost across all routes while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # fuel efficiency of trucks for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # fuel efficiency of trucks for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # fuel efficiency of trucks for Route3\nConsumptionRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"ConsumptionRate1\", lb=0)  # fuel consumption rate per kilometer for Route1\nConsumptionRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"ConsumptionRate2\", lb=0)  # fuel consumption rate per kilometer for Route2\nConsumptionRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"ConsumptionRate3\", lb=0)  # fuel consumption rate per kilometer for Route3\n\n# Define objective function\nFuel_Cost_Route1 = Trucks1 * (500 + 500 * Trucks1) / Efficiency1 * ConsumptionRate1 * 1.5\nFuel_Cost_Route2 = Trucks2 * (800 + 700 * Trucks2) / Efficiency2 * ConsumptionRate2 * 1.5\nFuel_Cost_Route3 = Trucks3 * (1000 + 1000 * Trucks3) / Efficiency3 * ConsumptionRate3 * 1.5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_Route1 + Fuel_Cost_Route2 + Fuel_Cost_Route3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\nmodel.addCons(Fuel_Cost_Route1 + Fuel_Cost_Route2 + Fuel_Cost_Route3 <= 10000)\nmodel.addCons(500 + 500 * Trucks1 <= 1000)\nmodel.addCons(800 + 700 * Trucks2 <= 1500)\nmodel.addCons(1000 + 1000 * Trucks3 <= 2000)\nmodel.addCons(Trucks1 >= 0.2 * (Trucks1 + Trucks2 + Trucks3))\nmodel.addCons(Trucks2 <= 0.5 * (Trucks1 + Trucks2 + Trucks3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. Additionally, they need to determine the number of drivers to hire for each type of cargo.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy equipment\": \"HeavyEquipmentTrucks\", \"range\": \"HeavyEquipmentTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousMaterialsTrucks\", \"range\": \"HazardousMaterialsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general cargo\": \"GeneralCargoTrucks\", \"range\": \"GeneralCargoTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for perishable goods\": \"PerishableDrivers\", \"range\": \"PerishableDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for heavy equipment\": \"HeavyEquipmentDrivers\", \"range\": \"HeavyEquipmentDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for hazardous materials\": \"HazardousMaterialsDrivers\", \"range\": \"HazardousMaterialsDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for general cargo\": \"GeneralCargoDrivers\", \"range\": \"GeneralCargoDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a truck for perishable goods is $100,000, and the revenue per truck is $150,000. The cost of a truck for heavy equipment is $120,000, and the revenue per truck is $180,000. The cost of a truck for hazardous materials is $150,000, and the revenue per truck is $200,000. The cost of a truck for general cargo is $90,000, and the revenue per truck is $130,000. The salary of a driver is $50,000 per year. The company wants to maximize the net profit per truck, considering both the revenue and the cost of drivers.\n// Net profit for perishable goods: Profit_Perishable = (150,000 - 100,000 - 50,000) * PerishableTrucks\n// Net profit for heavy equipment: Profit_HeavyEquipment = (180,000 - 120,000 - 50,000) * HeavyEquipmentTrucks\n// Net profit for hazardous materials: Profit_HazardousMaterials = (200,000 - 150,000 - 50,000) * HazardousMaterialsTrucks\n// Net profit for general cargo: Profit_GeneralCargo = (130,000 - 90,000 - 50,000) * GeneralCargoTrucks\n// So, the objective function is: Maximize (Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo) / (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing trucks.\n// 100,000 * PerishableTrucks + 120,000 * HeavyEquipmentTrucks + 150,000 * HazardousMaterialsTrucks + 90,000 * GeneralCargoTrucks <= 5,000,000\n\n## Generate Constraint-2:\nThe company can hire up to 100 drivers in total.\n// PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100\n\n## Generate Constraint-3:\nAt least 20% of the trucks must be allocated to hazardous materials due to safety regulations.\n// HazardousMaterialsTrucks >= 0.2 * (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)\n\n## Generate Constraint-4:\nThe company must have at least 5 trucks for each type of cargo.\n// PerishableTrucks >= 5; HeavyEquipmentTrucks >= 5; HazardousMaterialsTrucks >= 5; GeneralCargoTrucks >= 5\n\n## Generate Constraint-5:\nThe number of drivers for each type of cargo must match the number of trucks.\n// PerishableDrivers = PerishableTrucks; HeavyEquipmentDrivers = HeavyEquipmentTrucks; HazardousMaterialsDrivers = HazardousMaterialsTrucks; GeneralCargoDrivers = GeneralCargoTrucks",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks and drivers to allocate for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. The cost, revenue per truck, and driver salary for each type of cargo are given in the following Table.\n\n| Cargo Type            | Truck Cost | Revenue per Truck | Driver Salary |\n|-----------------------|------------|-------------------|---------------|\n| Perishable Goods      | $100,000   | $150,000          | $50,000       |\n| Heavy Equipment       | $120,000   | $180,000          | $50,000       |\n| Hazardous Materials   | $150,000   | $200,000          | $50,000       |\n| General Cargo         | $90,000    | $130,000          | $50,000       |\n\nThe company has a budget of $5,000,000 for purchasing trucks. They can hire up to 100 drivers in total. Due to safety regulations, at least 20% of the trucks must be allocated to hazardous materials. The company must have at least 5 trucks for each type of cargo, and the number of drivers for each type of cargo must match the number of trucks.\n\nPlease help the company to maximize the net profit per truck, considering both the revenue and the cost of drivers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=5)\nHeavyEquipmentTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentTrucks\", lb=5)\nHazardousMaterialsTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsTrucks\", lb=5)\nGeneralCargoTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoTrucks\", lb=5)\nPerishableDrivers = model.addVar(vtype=\"INTEGER\", name=\"PerishableDrivers\")\nHeavyEquipmentDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentDrivers\")\nHazardousMaterialsDrivers = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsDrivers\")\nGeneralCargoDrivers = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoDrivers\")\n\n# Define objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Perishable = (150000 - 100000 - 50000) * PerishableTrucks\nProfit_HeavyEquipment = (180000 - 120000 - 50000) * HeavyEquipmentTrucks\nProfit_HazardousMaterials = (200000 - 150000 - 50000) * HazardousMaterialsTrucks\nProfit_GeneralCargo = (130000 - 90000 - 50000) * GeneralCargoTrucks\nTotalTrucks = PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks\nmodel.addCons(obj * TotalTrucks == Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo)\n\n# Add constraints\nmodel.addCons(100000 * PerishableTrucks + 120000 * HeavyEquipmentTrucks + 150000 * HazardousMaterialsTrucks + 90000 * GeneralCargoTrucks <= 5000000)\nmodel.addCons(PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100)\nmodel.addCons(HazardousMaterialsTrucks >= 0.2 * TotalTrucks)\nmodel.addCons(PerishableDrivers == PerishableTrucks)\nmodel.addCons(HeavyEquipmentDrivers == HeavyEquipmentTrucks)\nmodel.addCons(HazardousMaterialsDrivers == HazardousMaterialsTrucks)\nmodel.addCons(GeneralCargoDrivers == GeneralCargoTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Equipment: \", model.getVal(HeavyEquipmentTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousMaterialsTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralCargoTrucks))\n    print(\"Number of Drivers for Perishable Goods: \", model.getVal(PerishableDrivers))\n    print(\"Number of Drivers for Heavy Equipment: \", model.getVal(HeavyEquipmentDrivers))\n    print(\"Number of Drivers for Hazardous Materials: \", model.getVal(HazardousMaterialsDrivers))\n    print(\"Number of Drivers for General Cargo: \", model.getVal(GeneralCargoDrivers))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of vehicles for transporting goods across different regions. The company has identified three types of vehicles (Truck, Van, and Sedan) each suitable for different types of cargo and distances. The company needs to determine the number of each type of vehicle to maximize efficiency and minimize operational costs.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"SedanCount\", \"range\": \"SedanCount >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a Truck is $300, for a Van is $200, and for a Sedan is $100. The efficiency of transport, measured in tons of goods transported per day, is 10 tons for a Truck, 5 tons for a Van, and 2 tons for a Sedan. The company wants to minimize the total operational cost while ensuring a minimum transport efficiency of 100 tons per day.\n// OperationalCost = 300 * TruckCount + 200 * VanCount + 100 * SedanCount\n// TransportEfficiency = 10 * TruckCount + 5 * VanCount + 2 * SedanCount\n// So, the objective function is: Minimize (OperationalCost) subject to TransportEfficiency >= 100\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operational costs.\n// 300 * TruckCount + 200 * VanCount + 100 * SedanCount <= 10000\n\n## Generate Constraint-2:\nThe company has a minimum requirement of 100 tons of goods to be transported per day.\n// 10 * TruckCount + 5 * VanCount + 2 * SedanCount >= 100\n\n## Generate Constraint-3:\nThe company can only acquire a maximum of 20 vehicles in total.\n// TruckCount + VanCount + SedanCount <= 20",
        "question": "A logistics company is planning its fleet of vehicles for transporting goods across different regions. The company has identified three types of vehicles (Truck, Van, and Sedan) each suitable for different types of cargo and distances. The company needs to determine the number of each type of vehicle to maximize efficiency and minimize operational costs.\nThe operational cost per day for a Truck is $300, for a Van is $200, and for a Sedan is $100. The efficiency of transport, measured in tons of goods transported per day, is 10 tons for a Truck, 5 tons for a Van, and 2 tons for a Sedan. The company wants to minimize the total operational cost while ensuring a minimum transport efficiency of 100 tons per day.\nThe company has a budget of $10,000 per day for operational costs. The company has a minimum requirement of 100 tons of goods to be transported per day. The company can only acquire a maximum of 20 vehicles in total.\nPlease help the company to determine the optimal number of Trucks, Vans, and Sedans to meet these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0) # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0) # number of Vans\nSedanCount = model.addVar(vtype=\"INTEGER\", name=\"SedanCount\", lb=0) # number of Sedans\n\n# Define objective function\nOperationalCost = 300 * TruckCount + 200 * VanCount + 100 * SedanCount\nmodel.setObjective(OperationalCost, \"minimize\")\n\n# Add constraints\n# The company has a budget of $10,000 per day for operational costs.\nmodel.addCons(300 * TruckCount + 200 * VanCount + 100 * SedanCount <= 10000)\n# The company has a minimum requirement of 100 tons of goods to be transported per day.\nmodel.addCons(10 * TruckCount + 5 * VanCount + 2 * SedanCount >= 100)\n# The company can only acquire a maximum of 20 vehicles in total.\nmodel.addCons(TruckCount + VanCount + SedanCount <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Sedans: \", model.getVal(SedanCount))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and production cost. The profit margin for product A is 10%, for B is 15%, for C is 20%, and for D is 25%. The production cost for each unit of product A is $50, for B is $70, for C is $90, and for D is $110. The company aims to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n// Profit of A: Profit_A = 0.10 * 50 * A = 5 * A\n// Profit of B: Profit_B = 0.15 * 70 * B = 10.5 * B\n// Profit of C: Profit_C = 0.20 * 90 * C = 18 * C\n// Profit of D: Profit_D = 0.25 * 110 * D = 27.5 * D\n// So, the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / (50 * A + 70 * B + 90 * C + 110 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C + 110 * D <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a limited production capacity of 150 hours. The production time for each unit of product A is 1 hour, for B is 2 hours, for C is 3 hours, and for D is 4 hours.\n// A + 2 * B + 3 * C + 4 * D <= 150",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its operations. Each product has a different profit margin and production cost. The profit margin for product A is 10%, for B is 15%, for C is 20%, and for D is 25%. The production cost for each unit of product A is $50, for B is $70, for C is $90, and for D is $110. The company aims to maximize the total profit while considering the cost efficiency, which is defined as the total profit divided by the total production cost.\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each product. The company has a limited production capacity of 150 hours. The production time for each unit of product A is 1 hour, for B is 2 hours, for C is 3 hours, and for D is 4 hours.\n\nPlease help the company to maximize the total profit while considering the cost efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10.5 * B\nProfit_C = 18 * C\nProfit_D = 27.5 * D\nProductionCost = 50 * A + 70 * B + 90 * C + 110 * D\n## the objective function is: Maximize (5 * A + 10.5 * B + 18 * C + 27.5 * D) / ProductionCost\n## convert the division to multiplication\nmodel.addCons(obj * ProductionCost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D <= 10000)\n## The company has a limited production capacity of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for TypeA\": \"TurbinesA\", \"range\": \"TurbinesA >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeB\": \"TurbinesB\", \"range\": \"TurbinesB >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for TypeC\": \"TurbinesC\", \"range\": \"TurbinesC >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for TypeA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for TypeC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms.\n// EnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\n// EnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\n// EnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n// So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for turbine installation and maintenance investments.\n// 10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000\n\n## Generate Constraint-2:\nThe total number of turbines that can be installed is limited to 100.\n// TurbinesA + TurbinesB + TurbinesC <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must install at least 20 turbines of TypeA and 30 turbines of TypeB.\n// TurbinesA >= 20; TurbinesB >= 30",
        "question": "A renewable energy company operates three types of wind farms: TypeA, TypeB, and TypeC. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For TypeA, each $1000 investment increases the output by 1 MWh. For TypeB, each $1000 investment increases the output by 1.5 MWh. For TypeC, each $1000 investment increases the output by 1.2 MWh. The company aims to maximize the total energy output from all wind farms. The company has a total budget of $100,000 for turbine installation and maintenance investments. The total number of turbines that can be installed is limited to 100. Due to regulatory requirements, the company must install at least 20 turbines of TypeA and 30 turbines of TypeB. Please help the company to maximize the total energy output from all wind farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbinesA = model.addVar(vtype=\"INTEGER\", name=\"TurbinesA\", lb=20)  # number of turbines for TypeA\nTurbinesB = model.addVar(vtype=\"INTEGER\", name=\"TurbinesB\", lb=30)  # number of turbines for TypeB\nTurbinesC = model.addVar(vtype=\"INTEGER\", name=\"TurbinesC\", lb=0)    # number of turbines for TypeC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance investment for TypeA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance investment for TypeB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance investment for TypeC\n\n# Define objective function\nEnergyOutputA = 10 * TurbinesA + 0.001 * MaintenanceA * TurbinesA\nEnergyOutputB = 15 * TurbinesB + 0.0015 * MaintenanceB * TurbinesB\nEnergyOutputC = 12 * TurbinesC + 0.0012 * MaintenanceC * TurbinesC\n# So, the objective function is: Maximize (EnergyOutputA + EnergyOutputB + EnergyOutputC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputA + EnergyOutputB + EnergyOutputC)\n\n# Add constraints\n# The company has a total budget of $100,000 for turbine installation and maintenance investments.\nmodel.addCons(10000 * TurbinesA + 10000 * TurbinesB + 10000 * TurbinesC + MaintenanceA + MaintenanceB + MaintenanceC <= 100000)\n# The total number of turbines that can be installed is limited to 100.\nmodel.addCons(TurbinesA + TurbinesB + TurbinesC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for TypeA: \", model.getVal(TurbinesA))\n    print(\"Number of Turbines for TypeB: \", model.getVal(TurbinesB))\n    print(\"Number of Turbines for TypeC: \", model.getVal(TurbinesC))\n    print(\"Maintenance Investment for TypeA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Investment for TypeB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Investment for TypeC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its operations for the next quarter, focusing on three main routes: RouteA, RouteB, and RouteC. The company needs to decide the number of trips to schedule on each route and the level of investment in fuel efficiency technologies for each route. The investment in fuel efficiency directly impacts the fuel cost per trip.\n// {\"number of trips on RouteA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on RouteB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on RouteC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for RouteA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for RouteB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for RouteC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit from all routes. The initial fuel cost per trip on RouteA is $300, but with increased fuel efficiency investment, the cost decreases by $5 for every $100 invested. The initial fuel cost per trip on RouteB is $250, and the cost decreases by $4 for every $100 invested in fuel efficiency. The initial fuel cost per trip on RouteC is $200, and the cost decreases by $3 for every $100 invested. The revenue per trip is constant at $500 for all routes.\n// Net profit for RouteA: ProfitA = 500 * TripsA - (300 - 0.05 * FuelEfficiencyA) * TripsA\n// Net profit for RouteB: ProfitB = 500 * TripsB - (250 - 0.04 * FuelEfficiencyB) * TripsB\n// Net profit for RouteC: ProfitC = 500 * TripsC - (200 - 0.03 * FuelEfficiencyC) * TripsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for both trip scheduling and fuel efficiency investments.\n// 300 * TripsA + 250 * TripsB + 200 * TripsC + FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum operational capacity of 50 trips across all routes.\n// TripsA + TripsB + TripsC <= 50\n\n## Generate Constraint-3:\nDue to market demand, the company must schedule at least 10 trips on RouteA and 15 trips on RouteB.\n// TripsA >= 10; TripsB >= 15",
        "question": "A logistics company is planning its operations for the next quarter, focusing on three main routes: RouteA, RouteB, and RouteC. The company needs to decide the number of trips to schedule on each route and the level of investment in fuel efficiency technologies for each route. The investment in fuel efficiency directly impacts the fuel cost per trip. The initial fuel cost per trip and the impact of fuel efficiency investment on the cost are given in the following Table.\n\n| Route       | Initial Fuel Cost per Trip | Reduction in Fuel Cost per $100 Invested | Revenue per Trip |\n|-------------|---------------------------|-----------------------------------------|------------------|\n| RouteA      | $300                      | $5                                       | $500             |\n| RouteB      | $250                      | $4                                       | $500             |\n| RouteC      | $200                      | $3                                       | $500             |\n\nThe company aims to maximize its net profit from all routes. The company has a total budget of $10,000 for both trip scheduling and fuel efficiency investments. The company has a maximum operational capacity of 50 trips across all routes. Due to market demand, the company must schedule at least 10 trips on RouteA and 15 trips on RouteB.\n\nPlease help the company to maximize its net profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=10) # number of trips on RouteA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=15) # number of trips on RouteB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips on RouteC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0) # investment in fuel efficiency for RouteA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0) # investment in fuel efficiency for RouteB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0) # investment in fuel efficiency for RouteC\n\n# Define objective function\nProfitA = 500 * TripsA - (300 - 0.05 * FuelEfficiencyA) * TripsA\nProfitB = 500 * TripsB - (250 - 0.04 * FuelEfficiencyB) * TripsB\nProfitC = 500 * TripsC - (200 - 0.03 * FuelEfficiencyC) * TripsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(300 * TripsA + 250 * TripsB + 200 * TripsC + FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)\nmodel.addCons(TripsA + TripsB + TripsC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips on RouteA: \", model.getVal(TripsA))\n    print(\"Number of Trips on RouteB: \", model.getVal(TripsB))\n    print(\"Number of Trips on RouteC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for RouteA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for RouteB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for RouteC: \", model.getVal(FuelEfficiencyC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1414,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected yield is 150 bushels per acre, the price per bushel is $5, and the water requirement is 200 gallons per acre.\nFor Wheat, the expected yield is 100 bushels per acre, the price per bushel is $6, and the water requirement is 150 gallons per acre.\nFor Soybeans, the expected yield is 50 bushels per acre, the price per bushel is $10, and the water requirement is 100 gallons per acre.\nFor Barley, the expected yield is 80 bushels per acre, the price per bushel is $4, and the water requirement is 120 gallons per acre.\nFor Oats, the expected yield is 70 bushels per acre, the price per bushel is $3, and the water requirement is 90 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n// Total profit: Profit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\n// Total water usage: Water = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100",
        "question": "A farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop. For Corn, the expected yield is 150 bushels per acre, the price per bushel is $5, and the water requirement is 200 gallons per acre. For Wheat, the expected yield is 100 bushels per acre, the price per bushel is $6, and the water requirement is 150 gallons per acre. For Soybeans, the expected yield is 50 bushels per acre, the price per bushel is $10, and the water requirement is 100 gallons per acre. For Barley, the expected yield is 80 bushels per acre, the price per bushel is $4, and the water requirement is 120 gallons per acre. For Oats, the expected yield is 70 bushels per acre, the price per bushel is $3, and the water requirement is 90 gallons per acre. The farmer has 100 acres available for planting. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage). Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # number of acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # number of acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # number of acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0)  # number of acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0)  # number of acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\nWater = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Number of Acres of Barley: \", model.getVal(Barley))\n    print(\"Number of Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five locations (Location1, Location2, Location3, Location4, and Location5) for installation.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar panels, the estimated energy production is 200 kWh per panel, and the cost per panel is $1000.\nFor wind turbines, the estimated energy production is 1000 kWh per turbine, and the cost per turbine is $5000.\nThe company wants to minimize the Cost-Energy ratio of the installation. (The Cost-Energy ratio is defined as the total cost of the installations divided by the total energy production.)\n// total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\n// total energy production: Energy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000\n\n## Generate Constraint-2:\nThe company wants to produce at least 150,000 kWh of energy.\n// 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000\n\n## Generate Constraint-3:\nThe company wants to install at least 50 solar panels in total.\n// Solar1 + Solar2 + Solar3 + Solar4 >= 50\n\n## Generate Constraint-4:\nNo more than 60% of the budget can be spent on wind turbines.\n// 5000 * Wind <= 0.6 * 100000\n\n## Generate Constraint-5:\nThe maximum number of wind turbines that can be installed is 10.\n// Wind <= 10",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five locations (Location1, Location2, Location3, Location4, and Location5). The company needs to determine the number of solar panels and wind turbines to install at each location. The estimated energy production and cost per unit for solar panels and wind turbines are given in the following Table.\n\n| Installation Type | Energy Production per Unit | Cost per Unit |\n|-------------------|----------------------------|---------------|\n| Solar Panel       | 200 kWh                    | $1000         |\n| Wind Turbine      | 1000 kWh                   | $5000         |\n\nThe company has a budget of $100,000 for the installations. The company wants to produce at least 150,000 kWh of energy. The company wants to install at least 50 solar panels in total. No more than 60% of the budget can be spent on wind turbines, and the maximum number of wind turbines that can be installed is 10.\n\nPlease help the company to minimize the Cost-Energy ratio of the installation (defined as the total cost of the installations divided by the total energy production).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)  # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)  # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)  # number of solar panels at Location3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)  # number of solar panels at Location4\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines at Location5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind\nEnergy = 200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations.\nmodel.addCons(1000 * (Solar1 + Solar2 + Solar3 + Solar4) + 5000 * Wind <= 100000)\n## The company wants to produce at least 150,000 kWh of energy.\nmodel.addCons(200 * (Solar1 + Solar2 + Solar3 + Solar4) + 1000 * Wind >= 150000)\n## The company wants to install at least 50 solar panels in total.\nmodel.addCons(Solar1 + Solar2 + Solar3 + Solar4 >= 50)\n## No more than 60% of the budget can be spent on wind turbines.\nmodel.addCons(5000 * Wind <= 0.6 * 100000)\n## The maximum number of wind turbines that can be installed is 10.\nmodel.addCons(Wind <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Solar Panels at Location4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Minimized Cost-Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C). The company also considers using a battery storage system to store excess energy.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"capacity of the battery storage system\": \"Battery\", \"range\": \"Battery >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing one solar panel at each site is $1000, and the expected energy generation per panel is 100 kWh. The cost of installing one wind turbine at each site is $2000, and the expected energy generation per turbine is 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage.\n// Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n// Total energy generation = 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC)\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n// 100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Site A, Site B, and Site C), and also considers using a battery storage system to store excess energy. The cost of installing one solar panel at each site is $1000, with an expected energy generation per panel of 100 kWh. The cost of installing one wind turbine at each site is $2000, with an expected energy generation per turbine of 200 kWh. The cost of the battery storage system is $50 per kWh of capacity. The company aims to minimize the total cost of installation while ensuring sufficient energy generation and storage. The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\n\nPlease help the company to minimize the total cost of installation while meeting the energy demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Site A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Site B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Site C\nBattery = model.addVar(vtype=\"CONTINUOUS\", name=\"Battery\", lb=0) # capacity of the battery storage system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery\n## Objective function: Minimize Total cost\nmodel.addCons(obj == 1000 * (SolarA + SolarB + SolarC) + 2000 * (WindA + WindB + WindC) + 50 * Battery)\n\n# Add constraints\n## The total energy generation must meet or exceed the company's annual energy demand of 1,000,000 kWh.\nmodel.addCons(100 * (SolarA + SolarB + SolarC) + 200 * (WindA + WindB + WindC) >= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Site B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Site C: \", model.getVal(WindC))\n    print(\"Battery Storage Capacity: \", model.getVal(Battery))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different warehouses across the country. The company needs to determine the number of trucks to allocate to each warehouse for optimal distribution of goods.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach warehouse has a different efficiency in terms of goods distribution. \nAt warehouse 1, each truck can distribute 100 units of goods per hour. \nAt warehouse 2, each truck can distribute 120 units of goods per hour. \nAt warehouse 3, each truck can distribute 150 units of goods per hour. \nAt warehouse 4, each truck can distribute 130 units of goods per hour. \nAt warehouse 5, each truck can distribute 110 units of goods per hour. \nThe company needs to distribute at least 5000 units of goods per day. The objective is to minimize the total time taken to distribute these goods.\n// The distribution time for goods: T = 5000 / (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5)\n// So, the objective function is: Minimize T\n// Minimize (5000 / (100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5))\n\n## Generate Constraint-1:\nThere are total 30 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach warehouse can handle up to 10 trucks at a time.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe company requires that at least 2 warehouses must be operational at any given time.\n// T1 + T2 + T3 + T4 + T5 >= 2",
        "question": "A logistics company operates 5 different warehouses across the country and needs to determine the number of trucks to allocate to each warehouse for optimal distribution of goods. Each warehouse has a different efficiency in terms of goods distribution, as shown in the following Table.\n\n| Warehouse | Distribution Efficiency (units/hour per truck) |\n|-----------|-----------------------------------------------|\n| 1         | 100                                           |\n| 2         | 120                                           |\n| 3         | 150                                           |\n| 4         | 130                                           |\n| 5         | 110                                           |\n\nThe company needs to distribute at least 5000 units of goods per day and aims to minimize the total time taken to distribute these goods. There are total 30 trucks available. Each warehouse can handle up to 10 trucks at a time. The company requires that at least 2 warehouses must be operational at any given time.\n\nPlease help the company to minimize the total time taken to distribute the required goods, which is defined as 5000 divided by the sum of the distribution efficiencies of all trucks allocated to the warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=10) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=10) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=10) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=10) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistributionRate = 100 * T1 + 120 * T2 + 150 * T3 + 130 * T4 + 110 * T5\n## the objective function is: Minimize (5000 / DistributionRate)\n## convert the division to multiplication\nmodel.addCons(obj * DistributionRate == 5000)\n\n# Add constraints\n## There are total 30 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n## Each warehouse can handle up to 10 trucks at a time.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n## The company requires that at least 2 warehouses must be operational at any given time.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Distribution Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for smartphones is $1000, for tablets is $1500, and for laptops is $2000. However, the profit rates are subject to diminishing returns; for each additional hour, the profit decreases by 1% compared to the previous hour.\n// The profit function for smartphones: P_S = 1000 * S * (1 - 0.01 * (S - 1))\n// The profit function for tablets: P_T = 1500 * T * (1 - 0.01 * (T - 1))\n// The profit function for laptops: P_L = 2000 * L * (1 - 0.01 * (L - 1))\n// The objective function is: Maximize P_total = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThe total daily operating hours for all production lines must not exceed 24 hours.\n// S + T + L <= 24",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for smartphones is $1000, for tablets is $1500, and for laptops is $2000. However, the profit rates are subject to diminishing returns; for each additional hour, the profit decreases by 1% compared to the previous hour.\n\n| Device       | Profit per Hour | Diminishing Returns |\n|--------------|-----------------|---------------------|\n| Smartphones  | $1000           | 1% decrease per additional hour |\n| Tablets      | $1500           | 1% decrease per additional hour |\n| Laptops      | $2000           | 1% decrease per additional hour |\n\nThe company aims to maximize its daily profit. The total daily operating hours for all production lines must not exceed 24 hours. Please help the company determine the optimal number of hours each production line should operate to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n# The profit function for smartphones: P_S = 1000 * S * (1 - 0.01 * (S - 1))\n# The profit function for tablets: P_T = 1500 * T * (1 - 0.01 * (T - 1))\n# The profit function for laptops: P_L = 2000 * L * (1 - 0.01 * (L - 1))\n# The objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = 1000 * S * (1 - 0.01 * (S - 1))\nP_T = 1500 * T * (1 - 0.01 * (T - 1))\nP_L = 2000 * L * (1 - 0.01 * (L - 1))\nP_total = P_S + P_T + P_L\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\n# The total daily operating hours for all production lines must not exceed 24 hours.\nmodel.addCons(S + T + L <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its delivery routes for three major cities: CityX, CityY, and CityZ. The company needs to decide the number of trips each truck will make to each city. Additionally, the company is considering investing in fuel-efficient technologies for each truck, which will reduce fuel consumption per trip but at a cost.\n// {\"number of trips to CityX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for CityX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CityY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for CityZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in fuel-efficient technologies. For every $1000 invested, the fuel consumption per trip decreases by 0.1 liters. The initial fuel consumption per trip to CityX is 10 liters, to CityY is 12 liters, and to CityZ is 15 liters. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for CityX: ConsumptionX = (10 - 0.0001 * TechX) * TripsX\n// Fuel consumption for CityY: ConsumptionY = (12 - 0.0001 * TechY) * TripsY\n// Fuel consumption for CityZ: ConsumptionZ = (15 - 0.0001 * TechZ) * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for both the number of trips and the investment in fuel-efficient technologies.\n// 10 * TripsX + 12 * TripsY + 15 * TripsZ + TechX + TechY + TechZ <= 100000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its delivery routes for three major cities: CityX, CityY, and CityZ. The company needs to decide the number of trips each truck will make to each city and whether to invest in fuel-efficient technologies for each truck. The investment in fuel-efficient technologies reduces fuel consumption per trip but comes at a cost. The initial fuel consumption per trip and the effect of investment on fuel consumption are given in the following Table.\n\n| City | Initial Fuel Consumption (liters) | Reduction per $1000 Investment |\n|------|----------------------------------|--------------------------------|\n| CityX | 10                               | 0.1 liters                      |\n| CityY | 12                               | 0.1 liters                      |\n| CityZ | 15                               | 0.1 liters                      |\n\nThe company has a budget of $100,000 for both the number of trips and the investment in fuel-efficient technologies. The company aims to minimize the total fuel consumption across all trips. Please help the company determine the optimal number of trips and the investment in fuel-efficient technologies for each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=0) # number of trips to CityX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=0) # number of trips to CityY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0) # number of trips to CityZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0) # investment in fuel-efficient technology for CityX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0) # investment in fuel-efficient technology for CityY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0) # investment in fuel-efficient technology for CityZ\n\n# Define objective function\nConsumptionX = (10 - 0.0001 * TechX) * TripsX\nConsumptionY = (12 - 0.0001 * TechY) * TripsY\nConsumptionZ = (15 - 0.0001 * TechZ) * TripsZ\n# So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\n# The company has a budget of $100,000 for both the number of trips and the investment in fuel-efficient technologies.\nmodel.addCons(10 * TripsX + 12 * TripsY + 15 * TripsZ + TechX + TechY + TechZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to CityX: \", model.getVal(TripsX))\n    print(\"Number of Trips to CityY: \", model.getVal(TripsY))\n    print(\"Number of Trips to CityZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for CityX: \", model.getVal(TechX))\n    print(\"Investment in Tech for CityY: \", model.getVal(TechY))\n    print(\"Investment in Tech for CityZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of distributing each product varies with the number of units distributed. For product A, the cost per unit is 5$, for product B, it's 7$, for product C, it's 9$, and for product D, it's 11$. The company aims to minimize the total distribution cost, which is a nonlinear function due to economies of scale.\n// Distribution cost of A: Cost_A = 5 * A^2\n// Distribution cost of B: Cost_B = 7 * B^2\n// Distribution cost of C: Cost_C = 9 * C^2\n// Distribution cost of D: Cost_D = 11 * D^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for distribution costs.\n// 5 * A^2 + 7 * B^2 + 9 * C^2 + 11 * D^2 <= 10000\n\n## Generate Constraint-2:\nThe company must distribute at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to decide how many units of each product to distribute to maximize efficiency while meeting certain operational constraints. The cost of distributing each product varies with the number of units distributed, as shown in the following Table.\n\n| Product | Cost per Unit |\n|---------|---------------|\n| A       | 5$            |\n| B       | 7$            |\n| C       | 9$            |\n| D       | 11$           |\n\nThe company has a budget of $10,000 for distribution costs. The company must distribute at least 50 units of each product. Please help the company to minimize the total distribution cost, which is a nonlinear function due to economies of scale.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must distribute at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 5 * A**2\nCost_B = 7 * B**2\nCost_C = 9 * C**2\nCost_D = 11 * D**2\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D)\n\n# Add constraints\n## The company has a budget of $10,000 for distribution costs.\nmodel.addCons(5 * A**2 + 7 * B**2 + 9 * C**2 + 11 * D**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Minimized Distribution Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The goal is to optimize the production schedule to maximize profit while adhering to certain operational constraints.\n// {\"number of units of product A on line 1\": \"A_Line1\", \"range\": \"A_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product A on line 2\": \"A_Line2\", \"range\": \"A_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 1\": \"B_Line1\", \"range\": \"B_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B on line 2\": \"B_Line2\", \"range\": \"B_Line2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 1\": \"C_Line1\", \"range\": \"C_Line1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C on line 2\": \"C_Line2\", \"range\": \"C_Line2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production on line 1 is $20 per unit, and on line 2 is $30 per unit. The manufacturer aims to maximize the total profit from all products.\n// Profit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\n// Profit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\n// Profit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of line 1 is 100 units per day.\n// A_Line1 + B_Line1 + C_Line1 <= 100",
        "question": "A manufacturer produces three types of products (A, B, and C) using two different production lines. The manufacturer needs to determine the number of units to produce for each product on each line, considering the varying efficiency and cost of each line. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production on line 1 is $20 per unit, and on line 2 is $30 per unit. The manufacturer aims to maximize the total profit from all products. The total production capacity of line 1 is 100 units per day.\n\nPlease help the manufacturer to determine the optimal number of units to produce for each product on each line to maximize the total profit while adhering to the production capacity constraint of line 1.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_Line1 = model.addVar(vtype=\"INTEGER\", name=\"A_Line1\", lb=0) # number of units of product A on line 1\nA_Line2 = model.addVar(vtype=\"INTEGER\", name=\"A_Line2\", lb=0) # number of units of product A on line 2\nB_Line1 = model.addVar(vtype=\"INTEGER\", name=\"B_Line1\", lb=0) # number of units of product B on line 1\nB_Line2 = model.addVar(vtype=\"INTEGER\", name=\"B_Line2\", lb=0) # number of units of product B on line 2\nC_Line1 = model.addVar(vtype=\"INTEGER\", name=\"C_Line1\", lb=0) # number of units of product C on line 1\nC_Line2 = model.addVar(vtype=\"INTEGER\", name=\"C_Line2\", lb=0) # number of units of product C on line 2\n\n# Define objective function\nProfit_A = 50 * (A_Line1 + A_Line2) - 20 * A_Line1 - 30 * A_Line2\nProfit_B = 70 * (B_Line1 + B_Line2) - 20 * B_Line1 - 30 * B_Line2\nProfit_C = 60 * (C_Line1 + C_Line2) - 20 * C_Line1 - 30 * C_Line2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A_Line1 + B_Line1 + C_Line1 <= 100) # total production capacity of line 1 is 100 units per day\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A on Line 1: \", model.getVal(A_Line1))\n    print(\"Number of Product A on Line 2: \", model.getVal(A_Line2))\n    print(\"Number of Product B on Line 1: \", model.getVal(B_Line1))\n    print(\"Number of Product B on Line 2: \", model.getVal(B_Line2))\n    print(\"Number of Product C on Line 1: \", model.getVal(C_Line1))\n    print(\"Number of Product C on Line 2: \", model.getVal(C_Line2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for production efficiency upgrades.\n// EfficiencyInvestment <= 1000000\n\n## Generate Constraint-2:\nThe total number of units produced cannot exceed 10,000.\n// UnitsA + UnitsB + UnitsC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of capital to invest in enhancing production efficiency, which reduces the production cost per unit. The production efficiency upgrade affects all products equally. The production cost per unit decreases by $5 for every $100,000 invested in efficiency upgrades. The initial production cost and selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| ProductA | $100                    | $200          |\n| ProductB | $150                    | $250          |\n| ProductC | $200                    | $300          |\n\nThe company has a total budget of $1,000,000 for production efficiency upgrades. The total number of units produced cannot exceed 10,000. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in production efficiency\n\n# Define objective function\nProfitA = (200 - 100 + 0.00005 * EfficiencyInvestment) * UnitsA\nProfitB = (250 - 150 + 0.00005 * EfficiencyInvestment) * UnitsB\nProfitC = (300 - 200 + 0.00005 * EfficiencyInvestment) * UnitsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 1000000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit. The total production capacity of the factory is limited to 100 units per day. Please help the manufacturer determine the optimal number of units of each product to produce daily to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 606,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours allocated to ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours allocated to ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of production per hour for ProductA is $20, for ProductB is $25, and for ProductC is $30. The production rate for ProductA is 5 units per hour, for ProductB is 4 units per hour, and for ProductC is 3 units per hour. The company aims to maximize the total profit.\n// Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n// Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n// Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available production hours for the company is 100 hours.\n// HoursA + HoursB + HoursC <= 100\n\n## Generate Constraint-2:\nThe company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB.\n// UnitsA >= 10; UnitsB >= 15\n\n## Generate Constraint-3:\nDue to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\n// UnitsC <= 2 * UnitsA",
        "question": "A manufacturing company is producing three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, as well as the number of hours to allocate to each product from the production line. The profit per unit, cost of production per hour, and production rate for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Hour | Production Rate |\n|---------|-----------------|---------------|-----------------|\n| ProductA | $50             | $20           | 5 units/hour    |\n| ProductB | $70             | $25           | 4 units/hour    |\n| ProductC | $60             | $30           | 3 units/hour    |\n\nThe total available production hours for the company is 100 hours. The company has a minimum order requirement of 10 units for ProductA and 15 units for ProductB. Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA. \nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of hours allocated to ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of hours allocated to ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of hours allocated to ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: ProfitA = (50 - (20 * HoursA / 5)) * UnitsA\n## Total profit for ProductB: ProfitB = (70 - (25 * HoursB / 4)) * UnitsB\n## Total profit for ProductC: ProfitC = (60 - (30 * HoursC / 3)) * UnitsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (50 - (20 * HoursA / 5)) * UnitsA\nProfitB = (70 - (25 * HoursB / 4)) * UnitsB\nProfitC = (60 - (30 * HoursC / 3)) * UnitsC\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total available production hours for the company is 100 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 100)\n## Due to market demand, the number of units of ProductC cannot exceed twice the number of units of ProductA.\nmodel.addCons(UnitsC <= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Hours Allocated to ProductA: \", model.getVal(HoursA))\n    print(\"Number of Hours Allocated to ProductB: \", model.getVal(HoursB))\n    print(\"Number of Hours Allocated to ProductC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for GoodsX trucks\": \"FuelOptX\", \"range\": \"FuelOptX >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsY trucks\": \"FuelOptY\", \"range\": \"FuelOptY >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsZ trucks\": \"FuelOptZ\", \"range\": \"FuelOptZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n// Operational cost for GoodsX: CostX = (1000 - 0.5 * FuelOptX) * TrucksX\n// Operational cost for GoodsY: CostY = (1200 - 0.6 * FuelOptY) * TrucksY\n// Operational cost for GoodsZ: CostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and truck operations.\n// FuelOptX + FuelOptY + FuelOptZ + (1000 * TrucksX) + (1200 * TrucksY) + (1500 * TrucksZ) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 100.\n// TrucksX + TrucksY + TrucksZ <= 100",
        "question": "A logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck. The operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n\n| Goods Type | Operational Cost Reduction per $100 Fuel Optimization |\n|------------|--------------------------------------------------------|\n| GoodsX     | $50                                                    |\n| GoodsY     | $60                                                    |\n| GoodsZ     | $70                                                    |\n\nThe company has a total budget of $100,000 for fuel optimization and truck operations. The total number of trucks available for distribution is limited to 100. Please help the company to minimize the total operational cost while ensuring timely deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFuelOptX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptX\", lb=0)  # fuel optimization for GoodsX trucks\nFuelOptY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptY\", lb=0)  # fuel optimization for GoodsY trucks\nFuelOptZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptZ\", lb=0)  # fuel optimization for GoodsZ trucks\n\n# Define objective function\nCostX = (1000 - 0.5 * FuelOptX) * TrucksX\nCostY = (1200 - 0.6 * FuelOptY) * TrucksY\nCostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\nmodel.addCons(FuelOptX + FuelOptY + FuelOptZ + 1000 * TrucksX + 1200 * TrucksY + 1500 * TrucksZ <= 100000)\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Optimization for GoodsX Trucks: \", model.getVal(FuelOptX))\n    print(\"Fuel Optimization for GoodsY Trucks: \", model.getVal(FuelOptY))\n    print(\"Fuel Optimization for GoodsZ Trucks: \", model.getVal(FuelOptZ))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 * MachineA_units) - 10,000\n// Total profit for MachineB: Profit_MachineB = (700 * MachineB_units) - 15,000\n// Total profit for MachineC: Profit_MachineC = (900 * MachineC_units) - 20,000\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for setup costs.\n// 10,000 * MachineA_units + 15,000 * MachineB_units + 20,000 * MachineC_units <= 100,000\n\n## Generate Constraint-2:\nThe production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\n// MachineA_units <= 100\n// MachineB_units <= 80\n// MachineC_units <= 60",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\nThe company has a total budget of $100,000 for setup costs. The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\nPlease help the company determine the optimal number of units to produce for each machine type to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0) # number of units of MachineA\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0) # number of units of MachineB\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0) # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 * MachineA_units) - 10000\nProfit_MachineB = (700 * MachineB_units) - 15000\nProfit_MachineC = (900 * MachineC_units) - 20000\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total budget of $100,000 for setup costs.\nmodel.addCons(10000 * MachineA_units + 15000 * MachineB_units + 20000 * MachineC_units <= 100000)\n# The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\nmodel.addCons(MachineA_units <= 100)\nmodel.addCons(MachineB_units <= 80)\nmodel.addCons(MachineC_units <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region to optimize its operations.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region1 is $1000 per day, the revenue per delivery is $500, and the average delivery time is 4 hours.\nIn Region2, the cost is $1200 per day, the revenue is $600, and the average delivery time is 5 hours.\nIn Region3, the cost is $1400 per day, the revenue is $700, and the average delivery time is 6 hours.\nIn Region4, the cost is $1600 per day, the revenue is $800, and the average delivery time is 7 hours.\nIn Region5, the cost is $1800 per day, the revenue is $900, and the average delivery time is 8 hours.\nThe company wants to maximize the profit per hour of operation across all regions.\n// Profit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\n// Profit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\n// Profit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\n// Profit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\n// Profit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n// So, the objective function is: Maximize (Profit_Region1 + Profit_Region2 + Profit_Region3 + Profit_Region4 + Profit_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 per day for operating costs.\n// 1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available across all regions is 100.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100",
        "question": "A logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region to optimize its operations. The cost of operating a truck, the revenue per delivery, and the average delivery time for each region are given in the following Table.\n\n| Region   | Operating Cost per Day | Revenue per Delivery | Average Delivery Time |\n|----------|------------------------|----------------------|----------------------|\n| Region1  | $1000                  | $500                 | 4 hours              |\n| Region2  | $1200                  | $600                 | 5 hours              |\n| Region3  | $1400                  | $700                 | 6 hours              |\n| Region4  | $1600                  | $800                 | 7 hours              |\n| Region5  | $1800                  | $900                 | 8 hours              |\n\nThe company has a total budget of $100,000 per day for operating costs. The total number of trucks available across all regions is 100. Please help the company to maximize the profit per hour of operation across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks in Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\nProfit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\nProfit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\nProfit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\nProfit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n## the objective function is: Maximize (Profit_Region1 + Profit_Region2 + Profit_Region3 + Profit_Region4 + Profit_Region5)\n## convert the division to multiplication\nmodel.addCons(obj == 4 * Profit_Region1 + 5 * Profit_Region2 + 6 * Profit_Region3 + 7 * Profit_Region4 + 8 * Profit_Region5)\n\n# Add constraints\n## The company has a total budget of $100,000 per day for operating costs.\nmodel.addCons(1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000)\n## The total number of trucks available across all regions is 100.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different types of trucks (T1, T2, T3, T4, T5) to minimize fuel consumption and travel time. The company needs to determine the number of trips each type of truck should make.\n// {\"number of trips for T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for T4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for T5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per trip is 50 liters, and the travel time per trip is 4 hours.\nFor T2, the fuel consumption per trip is 60 liters, and the travel time per trip is 5 hours.\nFor T3, the fuel consumption per trip is 70 liters, and the travel time per trip is 6 hours.\nFor T4, the fuel consumption per trip is 80 liters, and the travel time per trip is 7 hours.\nFor T5, the fuel consumption per trip is 90 liters, and the travel time per trip is 8 hours.\nThe company wants to minimize the total cost of fuel and travel time (cost of fuel + cost of labor per hour * total travel time).\n// Cost_T1 = 50 * T1 + 4 * T1 * LaborCostPerHour\n// Cost_T2 = 60 * T2 + 5 * T2 * LaborCostPerHour\n// Cost_T3 = 70 * T3 + 6 * T3 * LaborCostPerHour\n// Cost_T4 = 80 * T4 + 7 * T4 * LaborCostPerHour\n// Cost_T5 = 90 * T5 + 8 * T5 * LaborCostPerHour\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $5000.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different types of trucks (T1, T2, T3, T4, T5) to minimize fuel consumption and travel time. The company needs to determine the number of trips each type of truck should make.\nFor T1, the fuel consumption per trip is 50 liters, and the travel time per trip is 4 hours.\nFor T2, the fuel consumption per trip is 60 liters, and the travel time per trip is 5 hours.\nFor T3, the fuel consumption per trip is 70 liters, and the travel time per trip is 6 hours.\nFor T4, the fuel consumption per trip is 80 liters, and the travel time per trip is 7 hours.\nFor T5, the fuel consumption per trip is 90 liters, and the travel time per trip is 8 hours.\nThe company has a total fuel budget of $5000.\nPlease help the company to minimize the total cost of fuel and travel time (cost of fuel + cost of labor per hour * total travel time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for T1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for T2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for T3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for T4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for T5\n\n# Define objective function\nLaborCostPerHour = 20  # Assuming labor cost per hour\nCost_T1 = 50 * T1 + 4 * T1 * LaborCostPerHour\nCost_T2 = 60 * T2 + 5 * T2 * LaborCostPerHour\nCost_T3 = 70 * T3 + 6 * T3 * LaborCostPerHour\nCost_T4 = 80 * T4 + 7 * T4 * LaborCostPerHour\nCost_T5 = 90 * T5 + 8 * T5 * LaborCostPerHour\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for T1: \", model.getVal(T1))\n    print(\"Number of trips for T2: \", model.getVal(T2))\n    print(\"Number of trips for T3: \", model.getVal(T3))\n    print(\"Number of trips for T4: \", model.getVal(T4))\n    print(\"Number of trips for T5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n// Total profit for ProductA: ProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\n// Total profit for ProductB: ProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\n// Total profit for ProductC: ProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// AutomationA + AutomationB + AutomationC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units.\n// QuantityA <= 500; QuantityB <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit of ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit of ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\nProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\nProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000)\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 20000)\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 300)\n\n# Additional constraint for automation impact on labor hours\nmodel.addCons(LaborHoursA >= 2 - 0.1 * AutomationA / 1000)\nmodel.addCons(LaborHoursB >= 3 - 0.1 * AutomationB / 1000)\nmodel.addCons(LaborHoursC >= 4 - 0.1 * AutomationC / 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much of each crop to plant this season.\n// {\"amount of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"amount of crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the selling price is $20 per unit, the cost of seeds is $5 per unit, and the water usage is 3 liters per unit.\nFor Crop B, the selling price is $25 per unit, the cost of seeds is $7 per unit, and the water usage is 4 liters per unit.\nFor Crop C, the selling price is $30 per unit, the cost of seeds is $9 per unit, and the water usage is 5 liters per unit.\nFor Crop D, the selling price is $35 per unit, the cost of seeds is $11 per unit, and the water usage is 6 liters per unit.\nFor Crop E, the selling price is $40 per unit, the cost of seeds is $13 per unit, and the water usage is 7 liters per unit.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the water usage).\n// Selling profit of A: Profit_A = (20 - 5) * A\n// Selling profit of B: Profit_B = (25 - 7) * B\n// Selling profit of C: Profit_C = (30 - 9) * C\n// Selling profit of D: Profit_D = (35 - 11) * D\n// Selling profit of E: Profit_E = (40 - 13) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (3 * A + 4 * B + 5 * C + 6 * D + 7 * E)\n\n## Generate Constraint-1:\nThe farm has $1500 available for seed costs this season.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe farm wants to plant at least 20 units of each crop this season.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much of each crop to plant this season.\nFor Crop A, the selling price is $20 per unit, the cost of seeds is $5 per unit, and the water usage is 3 liters per unit.\nFor Crop B, the selling price is $25 per unit, the cost of seeds is $7 per unit, and the water usage is 4 liters per unit.\nFor Crop C, the selling price is $30 per unit, the cost of seeds is $9 per unit, and the water usage is 5 liters per unit.\nFor Crop D, the selling price is $35 per unit, the cost of seeds is $11 per unit, and the water usage is 6 liters per unit.\nFor Crop E, the selling price is $40 per unit, the cost of seeds is $13 per unit, and the water usage is 7 liters per unit.\nThe farm has $1500 available for seed costs this season. The farm wants to plant at least 20 units of each crop this season.\nPlease help the farm to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the water usage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to plant at least 20 units of each crop this season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # amount of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # amount of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # amount of crop C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # amount of crop D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # amount of crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (25 - 7) * B\nProfit_C = (30 - 9) * C\nProfit_D = (35 - 11) * D\nProfit_E = (40 - 13) * E\nWaterUsage = 3 * A + 4 * B + 5 * C + 6 * D + 7 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has $1500 available for seed costs this season.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Crop A: \", model.getVal(A))\n    print(\"Amount of Crop B: \", model.getVal(B))\n    print(\"Amount of Crop C: \", model.getVal(C))\n    print(\"Amount of Crop D: \", model.getVal(D))\n    print(\"Amount of Crop E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes.\n// FuelCost_A = 1 * (RouteDistance / 10) * TruckA\n// FuelCost_B = 1 * (RouteDistance / 15) * TruckB\n// FuelCost_C = 1 * (RouteDistance / 20) * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 km.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC = 5000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption. The fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes. The total distance to be covered by all trucks is 5000 km. Please help the company to minimize the total fuel cost (which is defined as the sum of the fuel cost for each type of truck).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nRouteDistance = model.addVar(name=\"RouteDistance\") # total distance to be covered\nFuelCost_A = 1 * (RouteDistance / 10) * TruckA\nFuelCost_B = 1 * (RouteDistance / 15) * TruckB\nFuelCost_C = 1 * (RouteDistance / 20) * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\nmodel.addCons(obj == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 km.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC == 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 610,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints.\n// {\"production quantity for ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company wants to maximize the total profit.\n// Profit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity = (50 - (20 + 0.05 * (ProductA_Quantity)^2)) * ProductA_Quantity\n// Profit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity = (70 - (30 + 0.03 * (ProductB_Quantity)^2)) * ProductB_Quantity\n// Profit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity = (60 - (25 + 0.04 * (ProductC_Quantity)^2)) * ProductC_Quantity\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company has a total production capacity of 1000 units per month.\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\n\n# Define objective function\n## Calculate the profit for each product\nCost_ProductA = 20 + 0.05 * (ProductA_Quantity**2)\nCost_ProductB = 30 + 0.03 * (ProductB_Quantity**2)\nCost_ProductC = 25 + 0.04 * (ProductC_Quantity**2)\n\nProfit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity\nProfit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity\nProfit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. The company wants to minimize the total cost of purchasing trucks and fuel expenses per year, given that each truck travels an average of 50,000 miles per year.\n// Cost_SmallTrucks = 30000 * SmallTrucks\n// Cost_MediumTrucks = 50000 * MediumTrucks\n// Cost_LargeTrucks = 80000 * LargeTrucks\n// Fuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\n// Fuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\n// Fuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n// So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 100 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 500,000 kg.\n// SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary. The details are provided in the following Table.\n\n| Truck Type       | Cost (USD) | Fuel Efficiency (miles/gallon) | Capacity (kg) |\n|------------------|------------|--------------------------------|---------------|\n| Small            | 30,000     | 10                             | 10,000        |\n| Medium           | 50,000     | 15                             | 20,000        |\n| Large            | 80,000     | 20                             | 30,000        |\n\nThe company has a total budget of $1,000,000 for purchasing trucks. The company has a total of 100 drivers available. The total cargo capacity of all trucks must not exceed 500,000 kg. Each truck travels an average of 50,000 miles per year.\n\nPlease help the company to minimize the total cost of purchasing trucks and fuel expenses per year.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nCost_SmallTrucks = 30000 * SmallTrucks\nCost_MediumTrucks = 50000 * MediumTrucks\nCost_LargeTrucks = 80000 * LargeTrucks\nFuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\nFuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\nFuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\nmodel.addCons(obj == Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000)\n# The company has a total of 100 drivers available.\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 100)\n# The total cargo capacity of all trucks must not exceed 500,000 kg.\nmodel.addCons(SmallTrucks * 10000 + MediumTrucks * 20000 + LargeTrucks * 30000 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Number of Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Number of Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 5 km/liter, the delivery capacity is 1000 kg, and the operating cost per km is $2. \nFor TruckB, the fuel efficiency is 6 km/liter, the delivery capacity is 1500 kg, and the operating cost per km is $2.5. \nFor TruckC, the fuel efficiency is 7 km/liter, the delivery capacity is 2000 kg, and the operating cost per km is $3.\nFor TruckD, the fuel efficiency is 8 km/liter, the delivery capacity is 2500 kg, and the operating cost per km is $3.5.\nFor TruckE, the fuel efficiency is 9 km/liter, the delivery capacity is 3000 kg, and the operating cost per km is $4.\nThe company wants to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n// Delivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\n// Delivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\n// Delivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\n// Delivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\n// Delivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n// So, the objective function is: Maximize (Delivery_Efficiency_TruckA + Delivery_Efficiency_TruckB + Delivery_Efficiency_TruckC + Delivery_Efficiency_TruckD + Delivery_Efficiency_TruckE)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 10,000 liters for the month.\n// 5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10,000\n\n## Generate Constraint-2:\nThe company has a total operating budget of $30,000 for the month.\n// 2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30,000\n\n## Generate Constraint-3:\nThe company has a total fleet size of 500 trucks.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 500\n\n## Generate Constraint-4:\nDue to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\n// TruckA + TruckB <= 200",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel efficiency, delivery capacity, and operating cost per km for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/liter) | Delivery Capacity (kg) | Operating Cost per km ($) |\n|-------|---------------------------|------------------------|---------------------------|\n| TruckA | 5                        | 1000                   | 2                         |\n| TruckB | 6                        | 1500                   | 2.5                       |\n| TruckC | 7                        | 2000                   | 3                         |\n| TruckD | 8                        | 2500                   | 3.5                       |\n| TruckE | 9                        | 3000                   | 4                         |\n\nThe company has a total fuel budget of 10,000 liters for the month. The company has a total operating budget of $30,000 for the month. The company has a total fleet size of 500 trucks. Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks. \nPlease help the company to maximize the delivery efficiency (total delivery capacity per liter of fuel).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDelivery_Efficiency_TruckA = 1000 * TruckA / (5 * TruckA)\nDelivery_Efficiency_TruckB = 1500 * TruckB / (6 * TruckB)\nDelivery_Efficiency_TruckC = 2000 * TruckC / (7 * TruckC)\nDelivery_Efficiency_TruckD = 2500 * TruckD / (8 * TruckD)\nDelivery_Efficiency_TruckE = 3000 * TruckE / (9 * TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE) == 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 2500 * TruckD + 3000 * TruckE)\n\n# Add constraints\n## The company has a total fuel budget of 10,000 liters for the month.\nmodel.addCons(5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE <= 10000)\n## The company has a total operating budget of $30,000 for the month.\nmodel.addCons(2 * TruckA + 2.5 * TruckB + 3 * TruckC + 3.5 * TruckD + 4 * TruckE <= 30000)\n## The company has a total fleet size of 500 trucks.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 500)\n## Due to maintenance schedules, TruckA and TruckB combined must not exceed 200 trucks.\nmodel.addCons(TruckA + TruckB <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region to maximize energy production while minimizing costs. The company needs to decide on the number of solar panels and wind turbines to install, as well as the investment in research and development (R&D) for improving the efficiency of each technology. The efficiency of solar panels increases by 0.5% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 1% for every $10,000 invested in R&D. The initial efficiency of solar panels is 15% and of wind turbines is 25%. The cost of installation per unit is $5,000 for solar panels and $10,000 for wind turbines.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for solar panels\": \"SolarRnD\", \"range\": \"SolarRnD >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for wind turbines\": \"WindRnD\", \"range\": \"WindRnD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize the total energy production while minimizing the total installation cost. The energy produced by each solar panel is 150 kWh per day, which increases by 0.5% for every $10,000 invested in R&D. The energy produced by each wind turbine is 500 kWh per day, which increases by 1% for every $10,000 invested in R&D. The total installation cost is the sum of the cost of all solar panels and wind turbines.\n// Total energy production from solar panels: EnergySolar = (150 * (1 + 0.005 * SolarRnD)) * SolarPanels\n// Total energy production from wind turbines: EnergyWind = (500 * (1 + 0.01 * WindRnD)) * WindTurbines\n// Total installation cost: Cost = 5000 * SolarPanels + 10000 * WindTurbines\n// So, the objective function is: Maximize (EnergySolar + EnergyWind - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for installation and R&D.\n// 5000 * SolarPanels + 10000 * WindTurbines + SolarRnD + WindRnD <= 500000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region to maximize energy production while minimizing costs. The company needs to decide on the number of solar panels and wind turbines to install, as well as the investment in research and development (R&D) for improving the efficiency of each technology. The efficiency of solar panels increases by 0.5% for every $10,000 invested in R&D, and the efficiency of wind turbines increases by 1% for every $10,000 invested in R&D. The initial efficiency of solar panels is 15% and of wind turbines is 25%. The cost of installation per unit is $5,000 for solar panels and $10,000 for wind turbines. The company aims to maximize the total energy production while minimizing the total installation cost. The energy produced by each solar panel is 150 kWh per day, which increases by 0.5% for every $10,000 invested in R&D. The energy produced by each wind turbine is 500 kWh per day, which increases by 1% for every $10,000 invested in R&D. The total installation cost is the sum of the cost of all solar panels and wind turbines. The company has a budget of $500,000 for installation and R&D. Please help the company to maximize the total energy production while minimizing the total installation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)  # number of wind turbines\nSolarRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarRnD\", lb=0)  # investment in R&D for solar panels\nWindRnD = model.addVar(vtype=\"CONTINUOUS\", name=\"WindRnD\", lb=0)  # investment in R&D for wind turbines\n\n# Define objective function\nEnergySolar = (150 * (1 + 0.005 * SolarRnD)) * SolarPanels\nEnergyWind = (500 * (1 + 0.01 * WindRnD)) * WindTurbines\nCost = 5000 * SolarPanels + 10000 * WindTurbines\n# So, the objective function is: Maximize (EnergySolar + EnergyWind - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind - Cost)\n\n# Add constraints\n# The company has a budget of $500,000 for installation and R&D.\nmodel.addCons(5000 * SolarPanels + 10000 * WindTurbines + SolarRnD + WindRnD <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in R&D for Solar Panels: \", model.getVal(SolarRnD))\n    print(\"Investment in R&D for Wind Turbines: \", model.getVal(WindRnD))\n    print(\"Maximized Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceA production line\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceB production line\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceC production line\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the production cost per unit is $100, the selling price per unit is $150, and the production rate is 5 units per worker per day.\nFor DeviceB, the production cost per unit is $120, the selling price per unit is $180, and the production rate is 4 units per worker per day.\nFor DeviceC, the production cost per unit is $140, the selling price per unit is $200, and the production rate is 3 units per worker per day.\nThe company wants to maximize the total daily profit.\n// Profit_A = UnitsA * (150 - 100)\n// Profit_B = UnitsB * (180 - 120)\n// Profit_C = UnitsC * (200 - 140)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 20 workers available.\n// WorkersA + WorkersB + WorkersC <= 20\n\n## Generate Constraint-2:\nThe production capacity for each device is limited by the number of workers and the production rate.\n// UnitsA <= 5 * WorkersA\n// UnitsB <= 4 * WorkersB\n// UnitsC <= 3 * WorkersC\n\n## Generate Constraint-3:\nThe company has a daily budget of $2000 for production costs.\n// 100 * UnitsA + 120 * UnitsB + 140 * UnitsC <= 2000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each device is produced daily.\n// UnitsA >= 1\n// UnitsB >= 1\n// UnitsC >= 1\n\n## Generate Constraint-5:\nDue to market demand, the number of DeviceB units produced should not exceed twice the number of DeviceA units.\n// UnitsB <= 2 * UnitsA",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per day, and how many workers to allocate to each production line. The production cost per unit, selling price per unit, and production rate for each device are given in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Production Rate (units/worker/day) |\n|--------|--------------------------|------------------------|------------------------------------|\n| DeviceA | $100                     | $150                   | 5                                  |\n| DeviceB | $120                     | $180                   | 4                                  |\n| DeviceC | $140                     | $200                   | 3                                  |\n\nThe company has a total of 20 workers available. The production capacity for each device is limited by the number of workers and the production rate. The company has a daily budget of $2000 for production costs. The company wants to ensure that at least one unit of each device is produced daily. Due to market demand, the number of DeviceB units produced should not exceed twice the number of DeviceA units.\n\nPlease help the company to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=1)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=1)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1)  # number of units of DeviceC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for DeviceA production line\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for DeviceB production line\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for DeviceC production line\n\n# Define objective function\nProfit_A = UnitsA * (150 - 100)\nProfit_B = UnitsB * (180 - 120)\nProfit_C = UnitsC * (200 - 140)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 20 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 20)\n# The production capacity for each device is limited by the number of workers and the production rate.\nmodel.addCons(UnitsA <= 5 * WorkersA)\nmodel.addCons(UnitsB <= 4 * WorkersB)\nmodel.addCons(UnitsC <= 3 * WorkersC)\n# The company has a daily budget of $2000 for production costs.\nmodel.addCons(100 * UnitsA + 120 * UnitsB + 140 * UnitsC <= 2000)\n# Due to market demand, the number of DeviceB units produced should not exceed twice the number of DeviceA units.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Number of Workers for DeviceA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for DeviceB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for DeviceC: \", model.getVal(WorkersC))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store.\n// {\"number of units shipped from warehouse A to store 1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse A to store 4\": \"A4\", \"range\": \"A4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 2\": \"B2\", \"range\": \"B2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse B to store 4\": \"B4\", \"range\": \"B4 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units shipped from warehouse C to store 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store.\n// Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\n// So, the objective function is: Minimize Total shipping cost\n\n## Generate Constraint-1:\nEach store must receive at least 100 units of the product.\n// A1 + B1 + C1 >= 100\n// A2 + B2 + C2 >= 100\n// A3 + B3 + C3 >= 100\n// A4 + B4 + C4 >= 100\n\n## Generate Constraint-2:\nWarehouse A has a total of 200 units available for shipping.\n// A1 + A2 + A3 + A4 <= 200\n\n## Generate Constraint-3:\nWarehouse B has a total of 300 units available for shipping.\n// B1 + B2 + B3 + B4 <= 300",
        "question": "A logistics company needs to optimize the distribution of goods from three warehouses (A, B, C) to four retail stores (1, 2, 3, 4). The company must decide how many units of a specific product to ship from each warehouse to each store. The cost of shipping from warehouse A is $5 per unit, from B is $6 per unit, and from C is $7 per unit. The company wants to minimize the total shipping cost while ensuring adequate supply to each store. Each store must receive at least 100 units of the product. Warehouse A has a total of 200 units available for shipping, and Warehouse B has a total of 300 units available for shipping. Please help the company to minimize the total shipping cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # number of units shipped from warehouse A to store 1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # number of units shipped from warehouse A to store 2\nA3 = model.addVar(vtype=\"INTEGER\", name=\"A3\", lb=0) # number of units shipped from warehouse A to store 3\nA4 = model.addVar(vtype=\"INTEGER\", name=\"A4\", lb=0) # number of units shipped from warehouse A to store 4\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # number of units shipped from warehouse B to store 1\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0) # number of units shipped from warehouse B to store 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # number of units shipped from warehouse B to store 3\nB4 = model.addVar(vtype=\"INTEGER\", name=\"B4\", lb=0) # number of units shipped from warehouse B to store 4\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # number of units shipped from warehouse C to store 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # number of units shipped from warehouse C to store 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # number of units shipped from warehouse C to store 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # number of units shipped from warehouse C to store 4\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total shipping cost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nTotalShippingCost = 5 * (A1 + A2 + A3 + A4) + 6 * (B1 + B2 + B3 + B4) + 7 * (C1 + C2 + C3 + C4)\nmodel.addCons(obj == TotalShippingCost)\n\n# Add constraints\n## Each store must receive at least 100 units of the product.\nmodel.addCons(A1 + B1 + C1 >= 100)\nmodel.addCons(A2 + B2 + C2 >= 100)\nmodel.addCons(A3 + B3 + C3 >= 100)\nmodel.addCons(A4 + B4 + C4 >= 100)\n## Warehouse A has a total of 200 units available for shipping.\nmodel.addCons(A1 + A2 + A3 + A4 <= 200)\n## Warehouse B has a total of 300 units available for shipping.\nmodel.addCons(B1 + B2 + B3 + B4 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of units shipped from warehouse A to store 1: \", model.getVal(A1))\n    print(\"Number of units shipped from warehouse A to store 2: \", model.getVal(A2))\n    print(\"Number of units shipped from warehouse A to store 3: \", model.getVal(A3))\n    print(\"Number of units shipped from warehouse A to store 4: \", model.getVal(A4))\n    print(\"Number of units shipped from warehouse B to store 1: \", model.getVal(B1))\n    print(\"Number of units shipped from warehouse B to store 2: \", model.getVal(B2))\n    print(\"Number of units shipped from warehouse B to store 3: \", model.getVal(B3))\n    print(\"Number of units shipped from warehouse B to store 4: \", model.getVal(B4))\n    print(\"Number of units shipped from warehouse C to store 1: \", model.getVal(C1))\n    print(\"Number of units shipped from warehouse C to store 2: \", model.getVal(C2))\n    print(\"Number of units shipped from warehouse C to store 3: \", model.getVal(C3))\n    print(\"Number of units shipped from warehouse C to store 4: \", model.getVal(C4))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 685,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination.\n// {\"trips to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies with the destination due to distance and terrain. For D1, the fuel cost per trip is $100, for D2 it is $120, for D3 it is $140, for D4 it is $160, and for D5 it is $180. The company wants to minimize the total fuel cost while ensuring efficient service.\n// Fuel_Cost_D1 = 100 * T1\n// Fuel_Cost_D2 = 120 * T2\n// Fuel_Cost_D3 = 140 * T3\n// Fuel_Cost_D4 = 160 * T4\n// Fuel_Cost_D5 = 180 * T5\n// So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-2:\nEach truck can make a maximum of 50 trips in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company has a contractual obligation to make at least 10 trips to D3.\n// T3 >= 10\n\n## Generate Constraint-4:\nDue to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5.\n// T5 - T1 <= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to determine the number of trips each truck should make to each destination. The cost of fuel per trip varies with the destination: $100 for D1, $120 for D2, $140 for D3, $160 for D4, and $180 for D5. The company wants to minimize the total fuel cost while ensuring efficient service. The company has a total budget of $10,000 for fuel costs. Each truck can make a maximum of 50 trips in total. The company has a contractual obligation to make at least 10 trips to D3. Due to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=50) # trips to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips to D5\n\n# Define objective function\nFuel_Cost_D1 = 100 * T1\nFuel_Cost_D2 = 120 * T2\nFuel_Cost_D3 = 140 * T3\nFuel_Cost_D4 = 160 * T4\nFuel_Cost_D5 = 180 * T5\n# So, the objective function is: Minimize (Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_D1 + Fuel_Cost_D2 + Fuel_Cost_D3 + Fuel_Cost_D4 + Fuel_Cost_D5)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\n# Each truck can make a maximum of 50 trips in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# The company has a contractual obligation to make at least 10 trips to D3.\nmodel.addCons(T3 >= 10)\n# Due to road restrictions, the number of trips to D5 cannot exceed the number of trips to D1 by more than 5.\nmodel.addCons(T5 - T1 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(T1))\n    print(\"Trips to D2: \", model.getVal(T2))\n    print(\"Trips to D3: \", model.getVal(T3))\n    print(\"Trips to D4: \", model.getVal(T4))\n    print(\"Trips to D5: \", model.getVal(T5))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods using a truck varies with the number of trucks allocated. The cost function is nonlinear and is given by: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants. The company aims to minimize the total transportation cost across all warehouses.\n// Cost_Warehouse1 = a1 * T1^2 + b1 * T1 + c1\n// Cost_Warehouse2 = a2 * T2^2 + b2 * T2 + c2\n// Cost_Warehouse3 = a3 * T3^2 + b3 * T3 + c3\n// Cost_Warehouse4 = a4 * T4^2 + b4 * T4 + c4\n// Cost_Warehouse5 = a5 * T5^2 + b5 * T5 + c5\n// So, the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse has a minimum and maximum number of trucks it can efficiently operate. For warehouse 1, the range is 5 to 20 trucks. For warehouse 2, the range is 10 to 25 trucks. For warehouse 3, the range is 15 to 30 trucks. For warehouse 4, the range is 20 to 35 trucks. For warehouse 5, the range is 25 to 40 trucks.\n// 5 <= T1 <= 20; 10 <= T2 <= 25; 15 <= T3 <= 30; 20 <= T4 <= 35; 25 <= T5 <= 40\n\n## Generate Constraint-3:\nThe company has a delivery demand that must be met. The total capacity of trucks across all warehouses must exceed 500 units of goods. Each truck at warehouse 1 can carry 10 units, at warehouse 2 can carry 12 units, at warehouse 3 can carry 15 units, at warehouse 4 can carry 18 units, and at warehouse 5 can carry 20 units.\n// 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 >= 500",
        "question": "A logistics company operates five different warehouses across the country and needs to determine the optimal number of trucks to allocate to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods using a truck varies with the number of trucks allocated, following a nonlinear cost function: Cost = a * (number of trucks)^2 + b * (number of trucks) + c, where a, b, and c are constants. The total number of trucks available across all warehouses is limited to 100. Each warehouse has a minimum and maximum number of trucks it can efficiently operate: 5 to 20 trucks for warehouse 1, 10 to 25 trucks for warehouse 2, 15 to 30 trucks for warehouse 3, 20 to 35 trucks for warehouse 4, and 25 to 40 trucks for warehouse 5. The total capacity of trucks across all warehouses must exceed 500 units of goods, with each truck at warehouse 1 carrying 10 units, at warehouse 2 carrying 12 units, at warehouse 3 carrying 15 units, at warehouse 4 carrying 18 units, and at warehouse 5 carrying 20 units. Please help the company to minimize the total transportation cost across all warehouses.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=20, ub=35) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=25, ub=40) # number of trucks at warehouse 5\n\n# Define objective function\n# The cost function is nonlinear and is given by: Cost = a * (number of trucks)^2 + b * (number of trucks) + c\na1, b1, c1 = 0.1, 1, 5  # Example values for warehouse 1\na2, b2, c2 = 0.2, 2, 10 # Example values for warehouse 2\na3, b3, c3 = 0.3, 3, 15 # Example values for warehouse 3\na4, b4, c4 = 0.4, 4, 20 # Example values for warehouse 4\na5, b5, c5 = 0.5, 5, 25 # Example values for warehouse 5\n\nCost_Warehouse1 = a1 * T1**2 + b1 * T1 + c1\nCost_Warehouse2 = a2 * T2**2 + b2 * T2 + c2\nCost_Warehouse3 = a3 * T3**2 + b3 * T3 + c3\nCost_Warehouse4 = a4 * T4**2 + b4 * T4 + c4\nCost_Warehouse5 = a5 * T5**2 + b5 * T5 + c5\n\n# So, the objective function is: Minimize Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Warehouse1 + Cost_Warehouse2 + Cost_Warehouse3 + Cost_Warehouse4 + Cost_Warehouse5)\n\n# Add constraints\n# The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# The total capacity of trucks across all warehouses must exceed 500 units of goods.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location A\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location B\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location C\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"number of batteries for energy storage\": \"Batteries\", \"range\": \"Batteries >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to geographical and weather conditions. The efficiency is 20% for Location A, 25% for Location B, and 18% for Location C. The wind turbines have an efficiency of 30% at Location A, 28% at Location B, and 32% at Location C. Each battery has a capacity of 100 kWh. The company aims to minimize the total cost of energy generation and storage, which is a nonlinear function of the number of installations and batteries.\n// Total energy generated: Energy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\n// Total cost: Cost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installations and batteries.\n// (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at three different locations (Location A, Location B, and Location C). The company also needs to consider the storage capacity for energy generated, which can be increased by adding more batteries. The efficiency of solar panels at each location varies due to geographical and weather conditions. The efficiency is 20% for Location A, 25% for Location B, and 18% for Location C. The wind turbines have an efficiency of 30% at Location A, 28% at Location B, and 32% at Location C. Each battery has a capacity of 100 kWh. The company has a budget of $100,000 for the installations and batteries.\n\nPlease help the company to minimize the total cost of energy generation and storage, which is a nonlinear function of the number of installations and batteries, while ensuring the total energy generated is maximized.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines at Location A\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines at Location B\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines at Location C\nBatteries = model.addVar(vtype=\"INTEGER\", name=\"Batteries\", lb=0) # number of batteries for energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.20 * SolarA + 0.25 * SolarB + 0.18 * SolarC + 0.30 * WindA + 0.28 * WindB + 0.32 * WindC\nCost = (SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installations and batteries.\nmodel.addCons((SolarA + SolarB + SolarC) * 1000 + (WindA + WindB + WindC) * 1500 + Batteries * 500 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location A: \", model.getVal(WindA))\n    print(\"Number of Wind Turbines at Location B: \", model.getVal(WindB))\n    print(\"Number of Wind Turbines at Location C: \", model.getVal(WindC))\n    print(\"Number of Batteries: \", model.getVal(Batteries))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate for each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the fuel efficiency of each truck type.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for RegionA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionD\": \"FuelEfficiencyD\", \"range\": \"FuelEfficiencyD > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for RegionE\": \"FuelEfficiencyE\", \"range\": \"FuelEfficiencyE > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost.\n// FuelCost_RegionA = (500 / FuelEfficiencyA) * TrucksA * 1.5\n// FuelCost_RegionB = (500 / FuelEfficiencyB) * TrucksB * 1.5\n// FuelCost_RegionC = (500 / FuelEfficiencyC) * TrucksC * 1.5\n// FuelCost_RegionD = (500 / FuelEfficiencyD) * TrucksD * 1.5\n// FuelCost_RegionE = (500 / FuelEfficiencyE) * TrucksE * 1.5\n// So, the objective function is: Minimize (FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nThe total daily distance traveled by all trucks must not exceed 25,000 km.\n// 500 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE) <= 25000\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB.\n// FuelEfficiencyA >= 1.1 * FuelEfficiencyB\n\n## Generate Constraint-4:\nThe number of trucks in RegionC must be at least twice the number in RegionD.\n// TrucksC >= 2 * TrucksD",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to determine the number of trucks to allocate for each region (RegionA, RegionB, RegionC, RegionD, and RegionE) and the fuel efficiency of each truck type. The cost of fuel per liter is $1.5, and the average distance traveled by each truck per day is 500 km. The company wants to minimize the total daily fuel cost. The company has a total of 50 trucks available. The total daily distance traveled by all trucks must not exceed 25,000 km. The fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB. The number of trucks in RegionC must be at least twice the number in RegionD.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0) # fuel efficiency of trucks for RegionA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0) # fuel efficiency of trucks for RegionB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0) # fuel efficiency of trucks for RegionC\nFuelEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyD\", lb=0) # fuel efficiency of trucks for RegionD\nFuelEfficiencyE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyE\", lb=0) # fuel efficiency of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_RegionA = (500 / FuelEfficiencyA) * TrucksA * 1.5\nFuelCost_RegionB = (500 / FuelEfficiencyB) * TrucksB * 1.5\nFuelCost_RegionC = (500 / FuelEfficiencyC) * TrucksC * 1.5\nFuelCost_RegionD = (500 / FuelEfficiencyD) * TrucksD * 1.5\nFuelCost_RegionE = (500 / FuelEfficiencyE) * TrucksE * 1.5\n## the objective function is: Minimize (FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\nmodel.addCons(obj == FuelCost_RegionA + FuelCost_RegionB + FuelCost_RegionC + FuelCost_RegionD + FuelCost_RegionE)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n## The total daily distance traveled by all trucks must not exceed 25,000 km.\nmodel.addCons(500 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE) <= 25000)\n## The fuel efficiency of trucks in RegionA must be at least 10% higher than that in RegionB.\nmodel.addCons(FuelEfficiencyA >= 1.1 * FuelEfficiencyB)\n## The number of trucks in RegionC must be at least twice the number in RegionD.\nmodel.addCons(TrucksC >= 2 * TrucksD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Fuel Efficiency for RegionA: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency for RegionB: \", model.getVal(FuelEfficiencyB))\n    print(\"Fuel Efficiency for RegionC: \", model.getVal(FuelEfficiencyC))\n    print(\"Fuel Efficiency for RegionD: \", model.getVal(FuelEfficiencyD))\n    print(\"Fuel Efficiency for RegionE: \", model.getVal(FuelEfficiencyE))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and cargo capacity. TruckA has a fuel efficiency of 5 km/liter and a cargo capacity of 10 tons. TruckB has a fuel efficiency of 7 km/liter and a cargo capacity of 15 tons. TruckC has a fuel efficiency of 10 km/liter and a cargo capacity of 20 tons. TruckD has a fuel efficiency of 12 km/liter and a cargo capacity of 25 tons. TruckE has a fuel efficiency of 15 km/liter and a cargo capacity of 30 tons. The company wants to minimize the total fuel consumption while ensuring all cargo is delivered.\n// Total fuel consumption for TruckA: Fuel_TruckA = (Distance / 5) * TruckA\n// Total fuel consumption for TruckB: Fuel_TruckB = (Distance / 7) * TruckB\n// Total fuel consumption for TruckC: Fuel_TruckC = (Distance / 10) * TruckC\n// Total fuel consumption for TruckD: Fuel_TruckD = (Distance / 12) * TruckD\n// Total fuel consumption for TruckE: Fuel_TruckE = (Distance / 15) * TruckE\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 200 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200\n\n## Generate Constraint-2:\nThe company has a budget to maintain a maximum of 10 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 10",
        "question": "A logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints. Each type of truck has different fuel efficiency and cargo capacity. TruckA has a fuel efficiency of 5 km/liter and a cargo capacity of 10 tons. TruckB has a fuel efficiency of 7 km/liter and a cargo capacity of 15 tons. TruckC has a fuel efficiency of 10 km/liter and a cargo capacity of 20 tons. TruckD has a fuel efficiency of 12 km/liter and a cargo capacity of 25 tons. TruckE has a fuel efficiency of 15 km/liter and a cargo capacity of 30 tons. The company wants to minimize the total fuel consumption while ensuring all cargo is delivered. The total cargo to be delivered is 200 tons. The company has a budget to maintain a maximum of 10 trucks in total. Please help the company to minimize the total fuel consumption (which is defined as the sum of the fuel consumption for each type of truck).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # Distance variable to handle division\n## Total fuel consumption for each type of truck\nFuel_TruckA = (Distance / 5) * TruckA\nFuel_TruckB = (Distance / 7) * TruckB\nFuel_TruckC = (Distance / 10) * TruckC\nFuel_TruckD = (Distance / 12) * TruckD\nFuel_TruckE = (Distance / 15) * TruckE\n## the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\nmodel.addCons(Distance == 1) # Ensuring Distance is 1 to simplify the objective\n\n# Add constraints\n## The total cargo to be delivered is 200 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200)\n## The company has a budget to maintain a maximum of 10 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Small Trucks\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Medium Trucks\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Large Trucks\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n// Operational cost for Small Trucks: CostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\n// Operational cost for Medium Trucks: CostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\n// Operational cost for Large Trucks: CostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for fleet expansion and technology upgrades.\n// 100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks to be added to the fleet should not exceed 10.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 10",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs. The fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost. The company has a budget of $1,000,000 for fleet expansion and technology upgrades. The total number of trucks to be added to the fleet should not exceed 10. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small Trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium Trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large Trucks\nTechUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSmall\", lb=0)  # technology upgrade for Small Trucks\nTechUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeMedium\", lb=0)  # technology upgrade for Medium Trucks\nTechUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeLarge\", lb=0)  # technology upgrade for Large Trucks\n\n# Define objective function\nCostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\nCostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\nCostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n# So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $1,000,000 for fleet expansion and technology upgrades.\nmodel.addCons(100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000)\n# The total number of trucks to be added to the fleet should not exceed 10.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Technology Upgrade for Small Trucks: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade for Medium Trucks: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade for Large Trucks: \", model.getVal(TechUpgradeLarge))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n// SpecialTrucks >= 0.5 * LargeTrucks",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting each package type per truck is given in the following Table.\n\n| Package Type | Cost per Truck |\n|--------------|----------------|\n| Small        | $1000          |\n| Medium       | $1500          |\n| Large        | $2000          |\n| X-Large      | $2500          |\n| Special      | $3000          |\n\nThe cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n\nPlease help the company to minimize the total transportation cost, which is calculated as the sum of the costs for each package type, considering the decreasing cost per truck for each type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=0)\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\nmodel.addCons(SpecialTrucks >= 0.5 * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Small packages: \", model.getVal(SmallTrucks))\n    print(\"Number of trucks for Medium packages: \", model.getVal(MediumTrucks))\n    print(\"Number of trucks for Large packages: \", model.getVal(LargeTrucks))\n    print(\"Number of trucks for X-Large packages: \", model.getVal(XL_Trucks))\n    print(\"Number of trucks for Special packages: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements.\n// {\"number of P1 packages\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 packages\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 packages\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of P4 packages\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"number of P5 packages\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting each package type varies based on weight and volume. P1 weighs 5 kg and has a volume of 0.1 m\u00b3, P2 weighs 10 kg and has a volume of 0.2 m\u00b3, P3 weighs 15 kg and has a volume of 0.3 m\u00b3, P4 weighs 20 kg and has a volume of 0.4 m\u00b3, and P5 weighs 25 kg and has a volume of 0.5 m\u00b3. The transportation cost per kg is $0.5, and the cost per m\u00b3 is $1. The company wants to minimize the total transportation cost.\n// Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe total weight of packages in each warehouse must not exceed 1000 kg.\n// 5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000",
        "question": "A logistics company needs to optimize the distribution of five different types of packages (P1, P2, P3, P4, P5) across three warehouses. Each package type has different weight, volume, and demand requirements. P1 weighs 5 kg and has a volume of 0.1 m\u00b3, P2 weighs 10 kg and has a volume of 0.2 m\u00b3, P3 weighs 15 kg and has a volume of 0.3 m\u00b3, P4 weighs 20 kg and has a volume of 0.4 m\u00b3, and P5 weighs 25 kg and has a volume of 0.5 m\u00b3. The transportation cost per kg is $0.5, and the cost per m\u00b3 is $1. The company wants to minimize the total transportation cost. The total weight of packages in each warehouse must not exceed 1000 kg.\n\nPlease help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 packages\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 packages\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 packages\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of P4 packages\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # number of P5 packages\n\n# Define objective function\n## Total_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\nTotal_Cost = 0.5 * (5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5) + 1 * (0.1 * P1 + 0.2 * P2 + 0.3 * P3 + 0.4 * P4 + 0.5 * P5)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Total_Cost\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total weight of packages in each warehouse must not exceed 1000 kg.\nmodel.addCons(5 * P1 + 10 * P2 + 15 * P3 + 20 * P4 + 25 * P5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 packages: \", model.getVal(P1))\n    print(\"Number of P2 packages: \", model.getVal(P2))\n    print(\"Number of P3 packages: \", model.getVal(P3))\n    print(\"Number of P4 packages: \", model.getVal(P4))\n    print(\"Number of P5 packages: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 700,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in fuel-efficient technologies for the trucks, which will reduce fuel costs per kilometer.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsW\": \"TechW\", \"range\": \"TechW >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods.\n// Fuel cost for GoodsX: CostX = (0.50 - 0.0001 * TechX) * (TrucksX * DistanceX)\n// Fuel cost for GoodsY: CostY = (0.60 - 0.0001 * TechY) * (TrucksY * DistanceY)\n// Fuel cost for GoodsZ: CostZ = (0.70 - 0.0001 * TechZ) * (TrucksZ * DistanceZ)\n// Fuel cost for GoodsW: CostW = (0.80 - 0.0001 * TechW) * (TrucksW * DistanceW)\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nThe total investment in fuel-efficient technology cannot exceed $100,000.\n// TechX + TechY + TechZ + TechW <= 100,000",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month and the investment in fuel-efficient technologies for the trucks, which will reduce fuel costs per kilometer. The fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods. The company has a total of 50 trucks available for the month, and the total investment in fuel-efficient technology cannot exceed $100,000. Please help the company to determine the optimal allocation of trucks and investment in fuel-efficient technologies to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=0) # number of trucks for GoodsW\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0) # investment in fuel-efficient technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0) # investment in fuel-efficient technology for GoodsY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0) # investment in fuel-efficient technology for GoodsZ\nTechW = model.addVar(vtype=\"CONTINUOUS\", name=\"TechW\", lb=0) # investment in fuel-efficient technology for GoodsW\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceX = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceX\") # distance for GoodsX\nDistanceY = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceY\") # distance for GoodsY\nDistanceZ = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceZ\") # distance for GoodsZ\nDistanceW = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceW\") # distance for GoodsW\nCostX = (0.50 - 0.0001 * TechX) * (TrucksX * DistanceX)\nCostY = (0.60 - 0.0001 * TechY) * (TrucksY * DistanceY)\nCostZ = (0.70 - 0.0001 * TechZ) * (TrucksZ * DistanceZ)\nCostW = (0.80 - 0.0001 * TechW) * (TrucksW * DistanceW)\n## the objective function is: Minimize (CostX + CostY + CostZ + CostW)\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\n## The total investment in fuel-efficient technology cannot exceed $100,000.\nmodel.addCons(TechX + TechY + TechZ + TechW <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Tech for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Tech for GoodsY: \", model.getVal(TechY))\n    print(\"Investment in Tech for GoodsZ: \", model.getVal(TechZ))\n    print(\"Investment in Tech for GoodsW: \", model.getVal(TechW))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and wants to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company needs to determine the number of trucks assigned to each route and the fuel consumption rate for each truck.\n// {\"number of trucks for D1\": \"TrucksD1\", \"range\": \"TrucksD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D2\": \"TrucksD2\", \"range\": \"TrucksD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D3\": \"TrucksD3\", \"range\": \"TrucksD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D4\": \"TrucksD4\", \"range\": \"TrucksD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D5\": \"TrucksD5\", \"range\": \"TrucksD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for each truck\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per truck for each destination is as follows: D1: $1000, D2: $1200, D3: $1500, D4: $1800, D5: $2000. The fuel cost per kilometer is $0.5, and the distance to each destination is D1: 100 km, D2: 150 km, D3: 200 km, D4: 250 km, D5: 300 km. The company wants to maximize the net profit per kilometer traveled.\n// NetProfitD1 = (1000 - 0.5 * FuelRate * 100) * TrucksD1\n// NetProfitD2 = (1200 - 0.5 * FuelRate * 150) * TrucksD2\n// NetProfitD3 = (1500 - 0.5 * FuelRate * 200) * TrucksD3\n// NetProfitD4 = (1800 - 0.5 * FuelRate * 250) * TrucksD4\n// NetProfitD5 = (2000 - 0.5 * FuelRate * 300) * TrucksD5\n// So, the objective function is: Maximize ((NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5) / (100 * TrucksD1 + 150 * TrucksD2 + 200 * TrucksD3 + 250 * TrucksD4 + 300 * TrucksD5))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50",
        "question": "A logistics company operates a fleet of trucks and wants to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company needs to determine the number of trucks assigned to each route and the fuel consumption rate for each truck. The revenue generated per truck for each destination and the distance to each destination are given in the following Table.\n\n| Destination | Revenue per Truck | Distance (km) |\n|-------------|-------------------|---------------|\n| D1          | $1000             | 100           |\n| D2          | $1200             | 150           |\n| D3          | $1500             | 200           |\n| D4          | $1800             | 250           |\n| D5          | $2000             | 300           |\n\nThe fuel cost per kilometer is $0.5. The company has a total of 50 trucks available. The company wants to maximize the net profit per kilometer traveled. Please help the company to determine the optimal number of trucks assigned to each route and the fuel consumption rate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksD1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD1\", lb=0) # number of trucks for D1\nTrucksD2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD2\", lb=0) # number of trucks for D2\nTrucksD3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD3\", lb=0) # number of trucks for D3\nTrucksD4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD4\", lb=0) # number of trucks for D4\nTrucksD5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD5\", lb=0) # number of trucks for D5\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0) # fuel consumption rate for each truck\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfitD1 = (1000 - 0.5 * FuelRate * 100) * TrucksD1\nNetProfitD2 = (1200 - 0.5 * FuelRate * 150) * TrucksD2\nNetProfitD3 = (1500 - 0.5 * FuelRate * 200) * TrucksD3\nNetProfitD4 = (1800 - 0.5 * FuelRate * 250) * TrucksD4\nNetProfitD5 = (2000 - 0.5 * FuelRate * 300) * TrucksD5\nTotalDistance = 100 * TrucksD1 + 150 * TrucksD2 + 200 * TrucksD3 + 250 * TrucksD4 + 300 * TrucksD5\n## the objective function is: Maximize ((NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5) / TotalDistance)\n## convert the division to multiplication\nmodel.addCons(obj * TotalDistance == NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for D1: \", model.getVal(TrucksD1))\n    print(\"Number of Trucks for D2: \", model.getVal(TrucksD2))\n    print(\"Number of Trucks for D3: \", model.getVal(TrucksD3))\n    print(\"Number of Trucks for D4: \", model.getVal(TrucksD4))\n    print(\"Number of Trucks for D5: \", model.getVal(TrucksD5))\n    print(\"Fuel Consumption Rate: \", model.getVal(FuelRate))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost.\n// Net profit of A: NetProfit_A = (20 - 5) * A\n// Net profit of B: NetProfit_B = (30 - 10) * B\n// Net profit of C: NetProfit_C = (40 - 15) * C\n// Net profit of D: NetProfit_D = (50 - 20) * D\n// Total transportation cost: TotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 5 * A + 10 * B + 15 * C + 20 * D <= 5000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit. The profit per unit and transportation cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Transportation Cost per Unit |\n|---------|-----------------|------------------------------|\n| A       | $20             | $5                           |\n| B       | $30             | $10                          |\n| C       | $40             | $15                          |\n| D       | $50             | $20                          |\n\nThe company has a budget of $5000 for transportation costs. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost. Please help the company determine the optimal number of units to distribute for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (20 - 5) * A\nNetProfit_B = (30 - 10) * B\nNetProfit_C = (40 - 15) * C\nNetProfit_D = (50 - 20) * D\nTotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Wearables. The company needs to decide the number of each device to produce to maximize profit while considering various constraints.\n// {\"number of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Wearables\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Wearables is $50. Due to economies of scale, the profit per unit increases by $0.5 for each device type if production exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphones = max(100 + 0.5 * (S - 100), 100) * S\n// Profit_Tablets = max(150 + 0.5 * (T - 100), 150) * T\n// Profit_Wearables = max(50 + 0.5 * (W - 100), 50) * W\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited budget for production. The cost to produce one Smartphone is $50, one Tablet is $75, and one Wearable is $25. The total production cost must not exceed $10,000.\n// 50 * S + 75 * T + 25 * W <= 10000\n\n## Generate Constraint-2:\nThe market demand for each device type is limited. The maximum demand for Smartphones is 200 units, for Tablets is 150 units, and for Wearables is 300 units.\n// S <= 200; T <= 150; W <= 300",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Wearables. The company needs to decide the number of each device to produce to maximize profit while considering various constraints. The profit per unit for Smartphones is $100, for Tablets is $150, and for Wearables is $50. Due to economies of scale, the profit per unit increases by $0.5 for each device type if production exceeds 100 units. The company has a limited budget for production. The cost to produce one Smartphone is $50, one Tablet is $75, and one Wearable is $25. The total production cost must not exceed $10,000. The market demand for each device type is limited. The maximum demand for Smartphones is 200 units, for Tablets is 150 units, and for Wearables is 300 units. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for each device type is limited. The maximum demand for Smartphones is 200 units, for Tablets is 150 units, and for Wearables is 300 units.\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=200) # number of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=150) # number of Tablets\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=300) # number of Wearables\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=200)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_Smartphones = 100 * S1 * S_b1 + (100 + 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Profit_Tablets = max(150 + 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=150)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nProfit_Tablets = 150 * T1 * T_b1 + (150 + 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Profit_Wearables = max(50 + 0.5 * (W - 100), 50) * W\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=100)\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=100, ub=300)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nmodel.addCons(W_b1 + W_b2 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2)\nProfit_Wearables = 50 * W1 * W_b1 + (50 + 0.5 * (W2 - 100)) * W2 * W_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Wearables)\n\n# Add constraints\n## The company has a limited budget for production. The cost to produce one Smartphone is $50, one Tablet is $75, and one Wearable is $25. The total production cost must not exceed $10,000.\nmodel.addCons(50 * S + 75 * T + 25 * W <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Wearables: \", model.getVal(W))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages.\n// Cost of route A: Cost_A = 100 * A\n// Cost of route B: Cost_B = 120 * B\n// Cost of route C: Cost_C = 150 * C\n// Cost of route D: Cost_D = 180 * D\n// Cost of route E: Cost_E = 200 * E\n// Delivery volume of route A: Vol_A = 50 * A\n// Delivery volume of route B: Vol_B = 60 * B\n// Delivery volume of route C: Vol_C = 70 * C\n// Delivery volume of route D: Vol_D = 80 * D\n// Delivery volume of route E: Vol_E = 90 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n\n## Generate Constraint-1:\nThe total number of trucks available is 10.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-2:\nThe total delivery volume must meet or exceed 1000 packages.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and delivery volumes for each route are given in the following Table.\n\n| Route | Cost per Truck | Delivery Volume per Truck |\n|-------|----------------|---------------------------|\n| A     | $100           | 50 packages               |\n| B     | $120           | 60 packages               |\n| C     | $150           | 70 packages               |\n| D     | $180           | 80 packages               |\n| E     | $200           | 90 packages               |\n\nThe company has a total of 10 trucks available. The total delivery volume must meet or exceed 1000 packages. The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C. \nPlease help the company to minimize the total cost while ensuring that the total delivery volume meets or exceeds the target of 1000 packages.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 120 * B\nCost_C = 150 * C\nCost_D = 180 * D\nCost_E = 200 * E\nVol_A = 50 * A\nVol_B = 60 * B\nVol_C = 70 * C\nVol_D = 80 * D\nVol_E = 90 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available is 10.\nmodel.addCons(A + B + C + D + E <= 10)\n## The total delivery volume must meet or exceed 1000 packages.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000)\n## The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs.\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology investment for heavy trucks\": \"TechInvestHeavy\", \"range\": \"TechInvestHeavy >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for medium trucks\": \"TechInvestMedium\", \"range\": \"TechInvestMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology investment for light trucks\": \"TechInvestLight\", \"range\": \"TechInvestLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n// Total profit for heavy trucks: ProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\n// Total profit for medium trucks: ProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\n// Total profit for light trucks: ProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n// So, the objective function is: Maximize (ProfitHeavy + ProfitMedium + ProfitLight)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments.\n// HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50 due to operational constraints.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide the number of trucks to purchase for three different types of cargo: heavy, medium, and light. Additionally, the company needs to determine the level of technology investment for each type of truck to enhance fuel efficiency and reduce maintenance costs. The company aims to maximize its annual profit from the truck fleet. The profit per heavy truck is $100,000, which increases by $1,000 for every $10,000 invested in technology. The profit per medium truck is $75,000, increasing by $750 for every $10,000 invested in technology. The profit per light truck is $50,000, increasing by $500 for every $10,000 invested in technology.\n\n| Type of Truck | Profit per Truck | Increase in Profit per $10,000 Tech Investment |\n|---------------|------------------|------------------------------------------------|\n| Heavy         | $100,000         | $1,000                                         |\n| Medium        | $75,000          | $750                                           |\n| Light         | $50,000          | $500                                           |\n\nThe company has a budget of $2,000,000 for purchasing trucks and technology investments. The total number of trucks cannot exceed 50 due to operational constraints.\n\nPlease help the company to maximize its annual profit from the truck fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nTechInvestHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestHeavy\", lb=0)  # technology investment for heavy trucks\nTechInvestMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestMedium\", lb=0)  # technology investment for medium trucks\nTechInvestLight = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestLight\", lb=0)  # technology investment for light trucks\n\n# Define objective function\nProfitHeavy = (100000 + 0.1 * TechInvestHeavy) * HeavyTrucks\nProfitMedium = (75000 + 0.075 * TechInvestMedium) * MediumTrucks\nProfitLight = (50000 + 0.05 * TechInvestLight) * LightTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHeavy + ProfitMedium + ProfitLight)\n\n# Add constraints\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + TechInvestHeavy + TechInvestMedium + TechInvestLight <= 2000000)\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Technology Investment for Heavy Trucks: \", model.getVal(TechInvestHeavy))\n    print(\"Technology Investment for Medium Trucks: \", model.getVal(TechInvestMedium))\n    print(\"Technology Investment for Light Trucks: \", model.getVal(TechInvestLight))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1405,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\n// Total environmental impact: Impact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation.\n// 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 1,000,000 kWh.\n// 200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000\n\n## Generate Constraint-3:\nThe maximum number of solar panels that can be installed at Site A is 1000.\n// SolarA <= 1000\n\n## Generate Constraint-4:\nThe maximum number of wind turbines that can be installed at Site E is 500.\n// WindE <= 500\n\n## Generate Constraint-5:\nThe city wants to ensure a balanced mix of solar and wind energy, so the number of solar panels should not exceed twice the number of wind turbines.\n// SolarA + SolarB + SolarC <= 2 * (WindD + WindE)",
        "question": "A city is planning to install solar panels and wind turbines to generate renewable energy at five potential sites (Site A, Site B, Site C, Site D, and Site E). The city wants to minimize the Cost-Environmental Impact ratio of the energy generation, where the Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.\n\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\n\nThe city has a budget of $1,000,000 for the installation. The total annual energy output must be at least 1,000,000 kWh. The maximum number of solar panels that can be installed at Site A is 1000, and the maximum number of wind turbines that can be installed at Site E is 500. The city also wants to ensure a balanced mix of solar and wind energy, so the number of solar panels should not exceed twice the number of wind turbines.\n\nPlease help the city determine the optimal number of solar panels and wind turbines to install at each site to meet these requirements while minimizing the Cost-Environmental Impact ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Site D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Site E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\nImpact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation.\nmodel.addCons(Cost <= 1000000)\n## The total annual energy output must be at least 1,000,000 kWh.\nmodel.addCons(200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000)\n## The maximum number of solar panels that can be installed at Site A is 1000.\nmodel.addCons(SolarA <= 1000)\n## The maximum number of wind turbines that can be installed at Site E is 500.\nmodel.addCons(WindE <= 500)\n## The number of solar panels should not exceed twice the number of wind turbines.\nmodel.addCons(SolarA + SolarB + SolarC <= 2 * (WindD + WindE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Site E: \", model.getVal(WindE))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1676,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductE\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor ProductA, the profit per unit is $50, the production cost per unit is $30, and the storage cost per unit is $5.\nFor ProductB, the profit per unit is $70, the production cost per unit is $40, and the storage cost per unit is $8.\nFor ProductC, the profit per unit is $60, the production cost per unit is $35, and the storage cost per unit is $6.\nFor ProductD, the profit per unit is $80, the production cost per unit is $50, and the storage cost per unit is $10.\nFor ProductE, the profit per unit is $90, the production cost per unit is $60, and the storage cost per unit is $12.\nThe company wants to maximize the net profit, which is the total profit minus the total production and storage costs.\n// Total net profit: NetProfit = (50 - 30 - 5) * ProductA + (70 - 40 - 8) * ProductB + (60 - 35 - 6) * ProductC + (80 - 50 - 10) * ProductD + (90 - 60 - 12) * ProductE\n// So, the objective function is: Maximize NetProfit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 10000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 5,000 units.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 5000\n\n## Generate Constraint-3:\nThe demand for ProductA is at least 1,000 units.\n// ProductA >= 1000\n\n## Generate Constraint-4:\nThe demand for ProductE is at least twice the demand for ProductB.\n// ProductE >= 2 * ProductB\n\n## Generate Constraint-5:\nThe production of ProductC cannot exceed 30% of the total production.\n// ProductC <= 0.3 * (ProductA + ProductB + ProductC + ProductD + ProductE)",
        "question": "A manufacturing company produces five types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| ProductA | $50 | $30 | $5 |\n| ProductB | $70 | $40 | $8 |\n| ProductC | $60 | $35 | $6 |\n| ProductD | $80 | $50 | $10 |\n| ProductE | $90 | $60 | $12 |\n\nThe company has a total production capacity of 10,000 units per month. The storage capacity is limited to 5,000 units. The demand for ProductA is at least 1,000 units. The demand for ProductE is at least twice the demand for ProductB. The production of ProductC cannot exceed 30% of the total production.\n\nPlease help the company to maximize the net profit, which is the total profit minus the total production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=1000) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of ProductC\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of ProductD\nProductE = model.addVar(vtype=\"INTEGER\", name=\"ProductE\", lb=0) # number of units of ProductE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit: NetProfit = (50 - 30 - 5) * ProductA + (70 - 40 - 8) * ProductB + (60 - 35 - 6) * ProductC + (80 - 50 - 10) * ProductD + (90 - 60 - 12) * ProductE\nNetProfit = (50 - 30 - 5) * ProductA + (70 - 40 - 8) * ProductB + (60 - 35 - 6) * ProductC + (80 - 50 - 10) * ProductD + (90 - 60 - 12) * ProductE\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units per month.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 10000)\n## The storage capacity is limited to 5,000 units.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 5000)\n## The demand for ProductE is at least twice the demand for ProductB.\nmodel.addCons(ProductE >= 2 * ProductB)\n## The production of ProductC cannot exceed 30% of the total production.\nmodel.addCons(ProductC <= 0.3 * (ProductA + ProductB + ProductC + ProductD + ProductE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Number of ProductD: \", model.getVal(ProductD))\n    print(\"Number of ProductE: \", model.getVal(ProductE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates.\n// {\"amount of diesel\": \"Diesel\", \"range\": \"Diesel >= 0\", \"type\": \"continuous\"}\n// {\"amount of gasoline\": \"Gasoline\", \"range\": \"Gasoline >= 0\", \"type\": \"continuous\"}\n// {\"amount of natural gas\": \"NaturalGas\", \"range\": \"NaturalGas >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of diesel is $3 per gallon, gasoline is $2.5 per gallon, and natural gas is $1.8 per gallon. The fuel-efficient technologies reduce the consumption rate of each fuel type by a certain percentage based on the investment. The company aims to minimize the total cost of fuel consumption while considering the investment in technologies.\n// Total cost of diesel: CostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\n// Total cost of gasoline: CostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\n// Total cost of natural gas: CostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n// So, the objective function is: Minimize (CostDiesel + CostGasoline + CostNaturalGas)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel purchases and technology investments.\n// 3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons.\n// Diesel + Gasoline + NaturalGas >= 20000\n\n## Generate Constraint-3:\nThe investment in fuel-efficient technologies cannot exceed 10% of the total fuel budget.\n// TechInvestment <= 0.1 * (3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas)\n\n## Generate Constraint-4:\nThe company must ensure that at least 30% of the fuel consumption comes from natural gas to comply with environmental regulations.\n// NaturalGas >= 0.3 * (Diesel + Gasoline + NaturalGas)",
        "question": "A logistics company is planning its fuel consumption for a fleet of trucks. The company needs to decide the amount of diesel (Diesel), gasoline (Gasoline), and natural gas (NaturalGas) to purchase for the next quarter. Additionally, the company is considering investing in fuel-efficient technologies (TechInvestment) for its trucks, which will affect the fuel consumption rates. The cost of each fuel type and the impact of technology investment on fuel consumption are given in the following Table.\n\n| Fuel Type       | Cost per Gallon | Impact of TechInvestment |\n|-----------------|-----------------|--------------------------|\n| Diesel          | $3              | 1% reduction per $100    |\n| Gasoline        | $2.5            | 1% reduction per $100    |\n| Natural Gas     | $1.8            | 1% reduction per $100    |\n\nThe company has a budget of $100,000 for fuel purchases and technology investments. The total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons. The investment in fuel-efficient technologies cannot exceed 10% of the total fuel budget. The company must ensure that at least 30% of the fuel consumption comes from natural gas to comply with environmental regulations.\n\nPlease help the company to minimize the total cost of fuel consumption while considering the investment in technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDiesel = model.addVar(vtype=\"CONTINUOUS\", name=\"Diesel\", lb=0)  # amount of diesel\nGasoline = model.addVar(vtype=\"CONTINUOUS\", name=\"Gasoline\", lb=0)  # amount of gasoline\nNaturalGas = model.addVar(vtype=\"CONTINUOUS\", name=\"NaturalGas\", lb=0)  # amount of natural gas\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in fuel-efficient technologies\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostDiesel = 3 * Diesel * (1 - 0.01 * TechInvestment)\nCostGasoline = 2.5 * Gasoline * (1 - 0.01 * TechInvestment)\nCostNaturalGas = 1.8 * NaturalGas * (1 - 0.01 * TechInvestment)\n## the objective function is: Minimize (CostDiesel + CostGasoline + CostNaturalGas)\nmodel.addCons(obj == CostDiesel + CostGasoline + CostNaturalGas)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel purchases and technology investments.\nmodel.addCons(3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas + TechInvestment <= 100000)\n## The total fuel consumption must meet or exceed the fleet's minimum requirement of 20,000 gallons.\nmodel.addCons(Diesel + Gasoline + NaturalGas >= 20000)\n## The investment in fuel-efficient technologies cannot exceed 10% of the total fuel budget.\nmodel.addCons(TechInvestment <= 0.1 * (3 * Diesel + 2.5 * Gasoline + 1.8 * NaturalGas))\n## The company must ensure that at least 30% of the fuel consumption comes from natural gas to comply with environmental regulations.\nmodel.addCons(NaturalGas >= 0.3 * (Diesel + Gasoline + NaturalGas))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Diesel: \", model.getVal(Diesel))\n    print(\"Amount of Gasoline: \", model.getVal(Gasoline))\n    print(\"Amount of Natural Gas: \", model.getVal(NaturalGas))\n    print(\"Investment in Tech: \", model.getVal(TechInvestment))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and General. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of General trucks\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Refrigerated trucks\": \"FuelEfficiencyRefrigerated\", \"range\": \"FuelEfficiencyRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Heavy trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for General trucks\": \"FuelEfficiencyGeneral\", \"range\": \"FuelEfficiencyGeneral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Refrigerated trucks, each $1000 investment improves fuel efficiency by 0.5 miles per gallon. For Heavy trucks, each $1000 investment improves fuel efficiency by 0.4 miles per gallon. For General trucks, each $1000 investment improves fuel efficiency by 0.3 miles per gallon. The company aims to minimize the total operational cost, which is a nonlinear function of the number of trucks and their fuel efficiency.\n// Operational cost for Refrigerated trucks: CostRefrigerated = (1000 / (InitialFuelEfficiencyRefrigerated + 0.0005 * FuelEfficiencyRefrigerated)) * RefrigeratedTrucks\n// Operational cost for Heavy trucks: CostHeavy = (1000 / (InitialFuelEfficiencyHeavy + 0.0004 * FuelEfficiencyHeavy)) * HeavyTrucks\n// Operational cost for General trucks: CostGeneral = (1000 / (InitialFuelEfficiencyGeneral + 0.0003 * FuelEfficiencyGeneral)) * GeneralTrucks\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostGeneral)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * GeneralTrucks + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 200000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and General. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Refrigerated trucks, each $1000 investment improves fuel efficiency by 0.5 miles per gallon. For Heavy trucks, each $1000 investment improves fuel efficiency by 0.4 miles per gallon. For General trucks, each $1000 investment improves fuel efficiency by 0.3 miles per gallon. The company aims to minimize the total operational cost, which is a nonlinear function of the number of trucks and their fuel efficiency. The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=0)\nFuelEfficiencyRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRefrigerated\", lb=0)\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)\nFuelEfficiencyGeneral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyGeneral\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Operational cost for Refrigerated trucks\nInitialFuelEfficiencyRefrigerated = 5.0  # Example initial fuel efficiency\nCostRefrigerated = (1000 / (InitialFuelEfficiencyRefrigerated + 0.0005 * FuelEfficiencyRefrigerated)) * RefrigeratedTrucks\n## Operational cost for Heavy trucks\nInitialFuelEfficiencyHeavy = 4.0  # Example initial fuel efficiency\nCostHeavy = (1000 / (InitialFuelEfficiencyHeavy + 0.0004 * FuelEfficiencyHeavy)) * HeavyTrucks\n## Operational cost for General trucks\nInitialFuelEfficiencyGeneral = 3.0  # Example initial fuel efficiency\nCostGeneral = (1000 / (InitialFuelEfficiencyGeneral + 0.0003 * FuelEfficiencyGeneral)) * GeneralTrucks\n\n## the objective function is: Minimize (CostRefrigerated + CostHeavy + CostGeneral)\n## convert the division to multiplication\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostGeneral)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * GeneralTrucks + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyGeneral <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of General Trucks: \", model.getVal(GeneralTrucks))\n    print(\"Investment in Fuel Efficiency for Refrigerated Trucks: \", model.getVal(FuelEfficiencyRefrigerated))\n    print(\"Investment in Fuel Efficiency for Heavy Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for General Trucks: \", model.getVal(FuelEfficiencyGeneral))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency.\n// {\"deliveries of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n// {\"deliveries of P5\": \"P5\", \"range\": \"P5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor each delivery, the company incurs a fuel cost and time cost. The fuel consumption per delivery for P1 is 5 liters, for P2 is 6 liters, for P3 is 7 liters, for P4 is 8 liters, and for P5 is 9 liters. The time taken per delivery for P1 is 1 hour, for P2 is 2 hours, for P3 is 3 hours, for P4 is 4 hours, and for P5 is 5 hours. The company wants to minimize the total fuel consumption and time cost.\n// Fuel_Cost_P1 = 5 * P1\n// Fuel_Cost_P2 = 6 * P2\n// Fuel_Cost_P3 = 7 * P3\n// Fuel_Cost_P4 = 8 * P4\n// Fuel_Cost_P5 = 9 * P5\n// Time_Cost_P1 = 1 * P1\n// Time_Cost_P2 = 2 * P2\n// Time_Cost_P3 = 3 * P3\n// Time_Cost_P4 = 4 * P4\n// Time_Cost_P5 = 5 * P5\n// So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters.\n// 5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000",
        "question": "A logistics company is planning its routes for delivering five different products: P1, P2, P3, P4, and P5. They need to determine the number of deliveries for each product to optimize their fuel consumption and delivery efficiency. For each delivery, the company incurs a fuel cost and time cost. The fuel consumption per delivery for P1 is 5 liters, for P2 is 6 liters, for P3 is 7 liters, for P4 is 8 liters, and for P5 is 9 liters. The time taken per delivery for P1 is 1 hour, for P2 is 2 hours, for P3 is 3 hours, for P4 is 4 hours, and for P5 is 5 hours. The company has a total fuel budget of 1000 liters. Please help the company to minimize the total fuel consumption and time cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # deliveries of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # deliveries of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # deliveries of P3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # deliveries of P4\nP5 = model.addVar(vtype=\"INTEGER\", name=\"P5\", lb=0) # deliveries of P5\n\n# Define objective function\nFuel_Cost_P1 = 5 * P1\nFuel_Cost_P2 = 6 * P2\nFuel_Cost_P3 = 7 * P3\nFuel_Cost_P4 = 8 * P4\nFuel_Cost_P5 = 9 * P5\nTime_Cost_P1 = 1 * P1\nTime_Cost_P2 = 2 * P2\nTime_Cost_P3 = 3 * P3\nTime_Cost_P4 = 4 * P4\nTime_Cost_P5 = 5 * P5\n# So, the objective function is: Minimize (Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5) + (Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_P1 + Fuel_Cost_P2 + Fuel_Cost_P3 + Fuel_Cost_P4 + Fuel_Cost_P5 + Time_Cost_P1 + Time_Cost_P2 + Time_Cost_P3 + Time_Cost_P4 + Time_Cost_P5)\n\n# Add constraints\n# The company has a total fuel budget of 1000 liters.\nmodel.addCons(5 * P1 + 6 * P2 + 7 * P3 + 8 * P4 + 9 * P5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Deliveries of P1: \", model.getVal(P1))\n    print(\"Deliveries of P2: \", model.getVal(P2))\n    print(\"Deliveries of P3: \", model.getVal(P3))\n    print(\"Deliveries of P4: \", model.getVal(P4))\n    print(\"Deliveries of P5: \", model.getVal(P5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 690,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Refrigerated trucks\": \"FuelEfficiencyRefrigerated\", \"range\": \"FuelEfficiencyRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Heavy trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Standard trucks\": \"FuelEfficiencyStandard\", \"range\": \"FuelEfficiencyStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Refrigerated trucks, an investment of $1000 reduces the cost per mile by $0.01. For Heavy trucks, an investment of $1000 reduces the cost per mile by $0.02. For Standard trucks, an investment of $1000 reduces the cost per mile by $0.015. The company aims to minimize the total annual operational cost of the fleet.\n// Operational cost for Refrigerated trucks: CostRefrigerated = (0.5 - 0.00001 * FuelEfficiencyRefrigerated) * RefrigeratedTrucks * 100000\n// Operational cost for Heavy trucks: CostHeavy = (0.7 - 0.00002 * FuelEfficiencyHeavy) * HeavyTrucks * 100000\n// Operational cost for Standard trucks: CostStandard = (0.4 - 0.000015 * FuelEfficiencyStandard) * StandardTrucks * 100000\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for truck purchases and fuel efficiency upgrades.\n// RefrigeratedTrucks * 100000 + HeavyTrucks * 120000 + StandardTrucks * 80000 + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Refrigerated trucks, an investment of $1000 reduces the cost per mile by $0.01. For Heavy trucks, an investment of $1000 reduces the cost per mile by $0.02. For Standard trucks, an investment of $1000 reduces the cost per mile by $0.015. The company aims to minimize the total annual operational cost of the fleet. The company has a budget of $500,000 for truck purchases and fuel efficiency upgrades. The total number of trucks cannot exceed 50. Please help the company to determine the optimal number of each type of truck to purchase and the amount to invest in fuel efficiency to minimize the total annual operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nFuelEfficiencyRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRefrigerated\", lb=0)\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)\nFuelEfficiencyStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = (0.5 - 0.00001 * FuelEfficiencyRefrigerated) * RefrigeratedTrucks * 100000\nCostHeavy = (0.7 - 0.00002 * FuelEfficiencyHeavy) * HeavyTrucks * 100000\nCostStandard = (0.4 - 0.000015 * FuelEfficiencyStandard) * StandardTrucks * 100000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(RefrigeratedTrucks * 100000 + HeavyTrucks * 120000 + StandardTrucks * 80000 + FuelEfficiencyRefrigerated + FuelEfficiencyHeavy + FuelEfficiencyStandard <= 500000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Fuel Efficiency for Refrigerated Trucks: \", model.getVal(FuelEfficiencyRefrigerated))\n    print(\"Investment in Fuel Efficiency for Heavy Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for Standard Trucks: \", model.getVal(FuelEfficiencyStandard))\n    print(\"Minimized Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency.\n// {\"number of Small solar plants\": \"SmallPlants\", \"range\": \"SmallPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Medium solar plants\": \"MediumPlants\", \"range\": \"MediumPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Large solar plants\": \"LargePlants\", \"range\": \"LargePlants >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Small plants\": \"TechInvestmentSmall\", \"range\": \"TechInvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Medium plants\": \"TechInvestmentMedium\", \"range\": \"TechInvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Large plants\": \"TechInvestmentLarge\", \"range\": \"TechInvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n// EnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\n// EnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\n// EnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for building new plants and investing in technology.\n// 1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000\n\n## Generate Constraint-2:\nThe total number of plants cannot exceed 50 due to land availability.\n// SmallPlants + MediumPlants + LargePlants <= 50\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must build at least 5 Small plants and 10 Medium plants.\n// SmallPlants >= 5; MediumPlants >= 10",
        "question": "A renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency. The energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants. The company has a total budget of $10 million for building new plants and investing in technology. The total number of plants cannot exceed 50 due to land availability. Due to regulatory requirements, the company must build at least 5 Small plants and 10 Medium plants. Please help the company to maximize the total energy output from all plants.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallPlants = model.addVar(vtype=\"INTEGER\", name=\"SmallPlants\", lb=5)  # number of Small solar plants\nMediumPlants = model.addVar(vtype=\"INTEGER\", name=\"MediumPlants\", lb=10)  # number of Medium solar plants\nLargePlants = model.addVar(vtype=\"INTEGER\", name=\"LargePlants\", lb=0)  # number of Large solar plants\nTechInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSmall\", lb=0)  # investment in advanced technology for Small plants\nTechInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentMedium\", lb=0)  # investment in advanced technology for Medium plants\nTechInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentLarge\", lb=0)  # investment in advanced technology for Large plants\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\nEnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\nEnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# Add constraints\nmodel.addCons(1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000)\nmodel.addCons(SmallPlants + MediumPlants + LargePlants <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small solar plants: \", model.getVal(SmallPlants))\n    print(\"Number of Medium solar plants: \", model.getVal(MediumPlants))\n    print(\"Number of Large solar plants: \", model.getVal(LargePlants))\n    print(\"Investment in advanced technology for Small plants: \", model.getVal(TechInvestmentSmall))\n    print(\"Investment in advanced technology for Medium plants: \", model.getVal(TechInvestmentMedium))\n    print(\"Investment in advanced technology for Large plants: \", model.getVal(TechInvestmentLarge))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost.\n// The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n// Minimize (0.05 * T1^2 + 0.07 * T2^2 + 0.06 * T3^2 + 0.08 * T4^2 + 0.04 * T5^2 + 0.09 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse. The transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost. The company has a total of 100 trucks available.\nPlease help the company to determine the optimal number of trucks to allocate to each warehouse to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks at warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_1 = 0.05 * T1**2\nCost_2 = 0.07 * T2**2\nCost_3 = 0.06 * T3**2\nCost_4 = 0.08 * T4**2\nCost_5 = 0.04 * T5**2\nCost_6 = 0.09 * T6**2\n## the objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\nmodel.addCons(obj == Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage.\n// {\"number of Device A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Device B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Device C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Device D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Device E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n// Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity for all devices is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70.\n// 30A + 40B + 50C + 60D + 70E <= 50000",
        "question": "A manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage. The profit per unit, cost of production, and cost of storage per unit per day for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Storage Cost per Unit per Day |\n|--------|-----------------|---------------------------|-------------------------------|\n| A      | $50             | $30                       | $2                            |\n| B      | $70             | $40                       | $3                            |\n| C      | $80             | $50                       | $4                            |\n| D      | $90             | $60                       | $5                            |\n| E      | $100            | $70                       | $6                            |\n\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity for all devices is 1000 units per day. The company has a budget constraint of $50,000 for production costs. Please help the company determine the optimal number of units to produce for each device to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Device A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Device B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Device C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Device D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Device E produced\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n## Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 80 * C + 90 * D + 100 * E\nStorage = 2 * A + 3 * B + 4 * C + 5 * D + 6 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity for all devices is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a budget constraint of $50,000 for production costs.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D + 70 * E <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n// Total profit for ProductA: ProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\n// Total profit for ProductB: ProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\n// Total profit for ProductC: ProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $20,000.\n// AutomationA + AutomationB + AutomationC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units.\n// QuantityA <= 500; QuantityB <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductC are produced.\n// QuantityC >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line.\n\n| Product | Initial Labor Hours per Unit | Revenue per Unit |\n|---------|------------------------------|------------------|\n| ProductA | 2 hours                      | $100             |\n| ProductB | 3 hours                      | $150             |\n| ProductC | 4 hours                      | $200             |\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $20,000. Due to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units. The company must ensure that at least 200 units of ProductC are produced.\n\nPlease help the company to maximize the total profit from all products, considering the cost of labor and investment in automation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit of ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit of ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\nProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\nProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology\nmodel.addCons(LaborHoursA == 2 - 0.1 * AutomationA / 1000)\nmodel.addCons(LaborHoursB == 3 - 0.1 * AutomationB / 1000)\nmodel.addCons(LaborHoursC == 4 - 0.1 * AutomationC / 1000)\n\n# The company has a total of 10,000 labor hours available for the month\nmodel.addCons(LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000)\n\n# The total investment in automation technology cannot exceed $20,000\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 20000)\n\n# Due to market demand, the production quantity of ProductA cannot exceed 500 units, and ProductB cannot exceed 300 units\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 300)\n\n# The company must ensure that at least 200 units of ProductC are produced\nmodel.addCons(QuantityC >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1503,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation to minimize overall transportation costs while meeting delivery deadlines. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each mode of transportation to reduce fuel consumption.\n// {\"number of truck trips\": \"TruckTrips\", \"range\": \"TruckTrips >= 0\", \"type\": \"integer\"}\n// {\"number of train trips\": \"TrainTrips\", \"range\": \"TrainTrips >= 0\", \"type\": \"integer\"}\n// {\"number of ship trips\": \"ShipTrips\", \"range\": \"ShipTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for trucks\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trains\": \"TrainUpgrade\", \"range\": \"TrainUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for ships\": \"ShipUpgrade\", \"range\": \"ShipUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe transportation cost per trip decreases with the investment in fuel efficiency upgrades. For trucks, the cost per trip is $1000 minus $10 for every $100 invested in upgrades. For trains, the cost per trip is $800 minus $8 for every $100 invested in upgrades. For ships, the cost per trip is $1500 minus $15 for every $100 invested in upgrades. The company aims to minimize the total transportation cost.\n// Total cost for trucks: CostTruck = (1000 - 0.1 * TruckUpgrade) * TruckTrips\n// Total cost for trains: CostTrain = (800 - 0.08 * TrainUpgrade) * TrainTrips\n// Total cost for ships: CostShip = (1500 - 0.15 * ShipUpgrade) * ShipTrips\n// So, the objective function is: Minimize (CostTruck + CostTrain + CostShip)\n\n## Generate Constraint-1:\nThe total budget for transportation and upgrades is $100,000.\n// 1000 * TruckTrips + 800 * TrainTrips + 1500 * ShipTrips + TruckUpgrade + TrainUpgrade + ShipUpgrade <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all modes must not exceed 500 trips.\n// TruckTrips + TrainTrips + ShipTrips <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, at least 100 truck trips and 150 train trips must be completed.\n// TruckTrips >= 100; TrainTrips >= 150",
        "question": "A logistics company manages the transportation of goods using trucks, trains, and ships. The company needs to determine the number of trips for each mode of transportation and the level of fuel efficiency upgrades for each mode to minimize overall transportation costs while meeting delivery deadlines. The transportation cost per trip decreases with the investment in fuel efficiency upgrades. For trucks, the cost per trip is $1000 minus $10 for every $100 invested in upgrades. For trains, the cost per trip is $800 minus $8 for every $100 invested in upgrades. For ships, the cost per trip is $1500 minus $15 for every $100 invested in upgrades. The company has a total budget of $100,000 for transportation and upgrades. The total number of trips across all modes must not exceed 500 trips. Due to contractual agreements, at least 100 truck trips and 150 train trips must be completed. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckTrips = model.addVar(vtype=\"INTEGER\", name=\"TruckTrips\", lb=100)  # number of truck trips\nTrainTrips = model.addVar(vtype=\"INTEGER\", name=\"TrainTrips\", lb=150)  # number of train trips\nShipTrips = model.addVar(vtype=\"INTEGER\", name=\"ShipTrips\", lb=0)  # number of ship trips\nTruckUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckUpgrade\", lb=0)  # fuel efficiency upgrade for trucks\nTrainUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"TrainUpgrade\", lb=0)  # fuel efficiency upgrade for trains\nShipUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"ShipUpgrade\", lb=0)  # fuel efficiency upgrade for ships\n\n# Define objective function\nCostTruck = (1000 - 0.1 * TruckUpgrade) * TruckTrips\nCostTrain = (800 - 0.08 * TrainUpgrade) * TrainTrips\nCostShip = (1500 - 0.15 * ShipUpgrade) * ShipTrips\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostTrain + CostShip)\n\n# Add constraints\nmodel.addCons(1000 * TruckTrips + 800 * TrainTrips + 1500 * ShipTrips + TruckUpgrade + TrainUpgrade + ShipUpgrade <= 100000)\nmodel.addCons(TruckTrips + TrainTrips + ShipTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck Trips: \", model.getVal(TruckTrips))\n    print(\"Number of Train Trips: \", model.getVal(TrainTrips))\n    print(\"Number of Ship Trips: \", model.getVal(ShipTrips))\n    print(\"Truck Upgrade: \", model.getVal(TruckUpgrade))\n    print(\"Train Upgrade: \", model.getVal(TrainUpgrade))\n    print(\"Ship Upgrade: \", model.getVal(ShipUpgrade))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 957,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50\n\n## Generate Constraint-2:\nThe firm has a budget of $3000 for raw materials per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000\n\n## Generate Constraint-3:\nThe firm has a production capacity of 300 devices per day.\n// 10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n\n| Device Type | Profit per Device | Production Rate per Worker per Day |\n|-------------|-------------------|------------------------------------|\n| Smartphones | $100              | 10                                 |\n| Tablets     | $150              | 5                                  |\n| Laptops     | $200              | 2                                  |\n\nThe firm has a total of 50 workers available. The firm has a budget of $3000 for raw materials per day. The firm has a production capacity of 300 devices per day.\n\nPlease help the firm determine the optimal number of workers for each production line to maximize its daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)  # number of workers for smartphones production\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)  # number of workers for tablets production\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)  # number of workers for laptops production\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\n# So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n# The firm has a budget of $3000 for raw materials per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 3000)\n# The firm has a production capacity of 300 devices per day.\nmodel.addCons(10 * WorkersSmartphones + 5 * WorkersTablets + 2 * WorkersLaptops <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones Produced: \", model.getVal(Smartphones))\n    print(\"Number of Tablets Produced: \", model.getVal(Tablets))\n    print(\"Number of Laptops Produced: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones Production: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets Production: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops Production: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements.\n// {\"cargo in truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck 1 has a fuel efficiency of 10 km/liter and a maximum cargo capacity of 5000 kg.\nTruck 2 has a fuel efficiency of 12 km/liter and a maximum cargo capacity of 4000 kg.\nTruck 3 has a fuel efficiency of 15 km/liter and a maximum cargo capacity of 3000 kg.\nTruck 4 has a fuel efficiency of 18 km/liter and a maximum cargo capacity of 2000 kg.\nTruck 5 has a fuel efficiency of 20 km/liter and a maximum cargo capacity of 1000 kg.\nThe company needs to deliver a total of 10000 kg of cargo over a distance of 1000 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = (1000 / 10) * T1 + (1000 / 12) * T2 + (1000 / 15) * T3 + (1000 / 18) * T4 + (1000 / 20) * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 10000 kg.\n// T1 + T2 + T3 + T4 + T5 = 10000\n\n## Generate Constraint-2:\nEach truck has a maximum cargo capacity.\n// T1 <= 5000\n// T2 <= 4000\n// T3 <= 3000\n// T4 <= 2000\n// T5 <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that no truck is loaded beyond 80% of its capacity to allow for safety margins.\n// T1 <= 0.8 * 5000\n// T2 <= 0.8 * 4000\n// T3 <= 0.8 * 3000\n// T4 <= 0.8 * 2000\n// T5 <= 0.8 * 1000",
        "question": "A logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements. The fuel efficiency and maximum cargo capacity for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/liter) | Maximum Cargo Capacity (kg) |\n|-------|---------------------------|-----------------------------|\n| 1     | 10                        | 5000                        |\n| 2     | 12                        | 4000                        |\n| 3     | 15                        | 3000                        |\n| 4     | 18                        | 2000                        |\n| 5     | 20                        | 1000                        |\n\nThe company needs to deliver a total of 10000 kg of cargo over a distance of 1000 km. Each truck has a maximum cargo capacity as specified in the table. The company wants to ensure that no truck is loaded beyond 80% of its capacity to allow for safety margins. Please help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # cargo in truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # cargo in truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # cargo in truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # cargo in truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # cargo in truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel consumption: Fuel = (1000 / 10) * T1 + (1000 / 12) * T2 + (1000 / 15) * T3 + (1000 / 18) * T4 + (1000 / 20) * T5\n## convert the division to multiplication\nmodel.addCons(obj == (1000 * T1 / 10) + (1000 * T2 / 12) + (1000 * T3 / 15) + (1000 * T4 / 18) + (1000 * T5 / 20))\n\n# Add constraints\n## The total cargo to be delivered is 10000 kg.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 10000)\n## Each truck has a maximum cargo capacity.\nmodel.addCons(T1 <= 5000)\nmodel.addCons(T2 <= 4000)\nmodel.addCons(T3 <= 3000)\nmodel.addCons(T4 <= 2000)\nmodel.addCons(T5 <= 1000)\n## The company wants to ensure that no truck is loaded beyond 80% of its capacity to allow for safety margins.\nmodel.addCons(T1 <= 0.8 * 5000)\nmodel.addCons(T2 <= 0.8 * 4000)\nmodel.addCons(T3 <= 0.8 * 3000)\nmodel.addCons(T4 <= 0.8 * 2000)\nmodel.addCons(T5 <= 0.8 * 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo in Truck 1: \", model.getVal(T1))\n    print(\"Cargo in Truck 2: \", model.getVal(T2))\n    print(\"Cargo in Truck 3: \", model.getVal(T3))\n    print(\"Cargo in Truck 4: \", model.getVal(T4))\n    print(\"Cargo in Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per worker. \nOn machine 1, each worker contributes $200 per hour for product 1, $250 per hour for product 2, and $300 per hour for product 3. \nOn machine 2, each worker contributes $220 per hour for product 1, $270 per hour for product 2, and $320 per hour for product 3. \nOn machine 3, each worker contributes $240 per hour for product 1, $290 per hour for product 2, and $340 per hour for product 3. \nOn machine 4, each worker contributes $260 per hour for product 1, $310 per hour for product 2, and $360 per hour for product 3.\nThe company aims to maximize the total profit from all products.\n// The profit from product 1: P1 = (200 * M1 + 220 * M2 + 240 * M3 + 260 * M4) * T\n// The profit from product 2: P2 = (250 * M1 + 270 * M2 + 290 * M3 + 310 * M4) * T\n// The profit from product 3: P3 = (300 * M1 + 320 * M2 + 340 * M3 + 360 * M4) * T\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// M1 + M2 + M3 + M4 <= 60\n\n## Generate Constraint-2:\nEach machine can be operated by up to 20 workers at a time.\n// M1 <= 20; M2 <= 20; M3 <= 20; M4 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of each product per day.\n// (200 * M1 + 220 * M2 + 240 * M3 + 260 * M4) * T >= 100\n// (250 * M1 + 270 * M2 + 290 * M3 + 310 * M4) * T >= 100\n// (300 * M1 + 320 * M2 + 340 * M3 + 360 * M4) * T >= 100",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. The contribution of each worker to the profit per hour for each product on each machine is given in the following Table.\n\n| Machine | Product 1 Profit/Hour | Product 2 Profit/Hour | Product 3 Profit/Hour |\n|---------|-----------------------|-----------------------|-----------------------|\n| 1       | $200                  | $250                  | $300                  |\n| 2       | $220                  | $270                  | $320                  |\n| 3       | $240                  | $290                  | $340                  |\n| 4       | $260                  | $310                  | $360                  |\n\nThe company aims to maximize the total profit from all products. There are a total of 60 workers available. Each machine can be operated by up to 20 workers at a time. The company must produce at least 100 units of each product per day.\n\nPlease help the company determine the optimal number of workers to allocate to each machine (M1, M2, M3, M4) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP1 = (200 * M1 + 220 * M2 + 240 * M3 + 260 * M4) # profit from product 1\nP2 = (250 * M1 + 270 * M2 + 290 * M3 + 310 * M4) # profit from product 2\nP3 = (300 * M1 + 320 * M2 + 340 * M3 + 360 * M4) # profit from product 3\n# The objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 <= 60)\n# Each machine can be operated by up to 20 workers at a time.\nmodel.addCons(M1 <= 20)\nmodel.addCons(M2 <= 20)\nmodel.addCons(M3 <= 20)\nmodel.addCons(M4 <= 20)\n# The company must produce at least 100 units of each product per day.\nmodel.addCons((200 * M1 + 220 * M2 + 240 * M3 + 260 * M4) >= 100)\nmodel.addCons((250 * M1 + 270 * M2 + 290 * M3 + 310 * M4) >= 100)\nmodel.addCons((300 * M1 + 320 * M2 + 340 * M3 + 360 * M4) >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(M1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(M2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(M3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(M4))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1183,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four production lines, each capable of producing any of the three components but with varying efficiencies. The company needs to decide how many workers to assign to each production line to optimize production.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"P4\", \"range\": \"P4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on production line 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. On production line 2, each worker produces 12 units of A, 18 units of B, and 22 units of C per hour. On production line 3, each worker produces 14 units of A, 20 units of B, and 24 units of C per hour. On production line 4, each worker produces 16 units of A, 22 units of B, and 26 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3 + 16 * P4\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3 + 22 * P4\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3 + 26 * P4\n// The objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe company has a total of 60 workers available.\n// P1 + P2 + P3 + P4 <= 60\n\n## Generate Constraint-2:\nEach production line can accommodate up to 20 workers.\n// P1 <= 20; P2 <= 20; P3 <= 20; P4 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of component A, 700 units of component B, and 900 units of component C.\n// 10 * P1 + 12 * P2 + 14 * P3 + 16 * P4 >= 500\n// 15 * P1 + 18 * P2 + 20 * P3 + 22 * P4 >= 700\n// 20 * P1 + 22 * P2 + 24 * P3 + 26 * P4 >= 900",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four production lines, each capable of producing any of the three components but with varying efficiencies. The company needs to decide how many workers to assign to each production line to optimize production. The production efficiency of each worker on each production line is given in the following Table.\n\n| Production Line | Component A Units/Hour | Component B Units/Hour | Component C Units/Hour |\n|-----------------|------------------------|------------------------|------------------------|\n| 1               | 10                     | 15                     | 20                     |\n| 2               | 12                     | 18                     | 22                     |\n| 3               | 14                     | 20                     | 24                     |\n| 4               | 16                     | 22                     | 26                     |\n\nThe company has a total of 60 workers available. Each production line can accommodate up to 20 workers. The company must produce at least 500 units of component A, 700 units of component B, and 900 units of component C.\nPlease help the company to maximize the total production of components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\nP4 = model.addVar(vtype=\"INTEGER\", name=\"P4\", lb=0) # number of workers on production line 4\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3 + 16 * P4\nB_total = 15 * P1 + 18 * P2 + 20 * P3 + 22 * P4\nC_total = 20 * P1 + 22 * P2 + 24 * P3 + 26 * P4\n# The objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The company has a total of 60 workers available.\nmodel.addCons(P1 + P2 + P3 + P4 <= 60)\n# Each production line can accommodate up to 20 workers.\nmodel.addCons(P1 <= 20)\nmodel.addCons(P2 <= 20)\nmodel.addCons(P3 <= 20)\nmodel.addCons(P4 <= 20)\n# The company must produce at least 500 units of component A, 700 units of component B, and 900 units of component C.\nmodel.addCons(10 * P1 + 12 * P2 + 14 * P3 + 16 * P4 >= 500)\nmodel.addCons(15 * P1 + 18 * P2 + 20 * P3 + 22 * P4 >= 700)\nmodel.addCons(20 * P1 + 22 * P2 + 24 * P3 + 26 * P4 >= 900)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(P1))\n    print(\"Number of workers on production line 2: \", model.getVal(P2))\n    print(\"Number of workers on production line 3: \", model.getVal(P3))\n    print(\"Number of workers on production line 4: \", model.getVal(P4))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to operate for each type of power plant to maximize energy production while minimizing operational costs. Additionally, the company needs to decide on the level of investment in advanced technology for each type of power plant, which can enhance efficiency but also incurs additional costs.\n// {\"number of Solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production and operational costs of each power plant are affected by the investment in advanced technology. For Solar, each unit produces 100 MWh of energy without technology, increasing by 5 MWh per $1000 invested. The operational cost is $5000 per unit, decreasing by $200 for every $1000 invested.\nFor Wind, each unit produces 120 MWh without technology, increasing by 6 MWh per $1000 invested. The operational cost is $6000 per unit, decreasing by $250 for every $1000 invested.\nFor Hydro, each unit produces 150 MWh without technology, increasing by 7 MWh per $1000 invested. The operational cost is $7000 per unit, decreasing by $300 for every $1000 invested.\nThe company aims to maximize the net energy production (total energy produced minus operational costs).\n// Net energy production for Solar: NetSolar = (100 + 0.005 * SolarTechInvestment) * SolarUnits - (5000 - 0.002 * SolarTechInvestment) * SolarUnits\n// Net energy production for Wind: NetWind = (120 + 0.006 * WindTechInvestment) * WindUnits - (6000 - 0.0025 * WindTechInvestment) * WindUnits\n// Net energy production for Hydro: NetHydro = (150 + 0.007 * HydroTechInvestment) * HydroUnits - (7000 - 0.003 * HydroTechInvestment) * HydroUnits\n// So, the objective function is: Maximize (NetSolar + NetWind + NetHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and technology investments.\n// 5000 * SolarUnits + 6000 * WindUnits + 7000 * HydroUnits + SolarTechInvestment + WindTechInvestment + HydroTechInvestment <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to operate for each type of power plant and the level of investment in advanced technology for each type to maximize energy production while minimizing operational costs. For Solar, each unit produces 100 MWh of energy without technology, increasing by 5 MWh per $1000 invested, and the operational cost is $5000 per unit, decreasing by $200 for every $1000 invested. For Wind, each unit produces 120 MWh without technology, increasing by 6 MWh per $1000 invested, and the operational cost is $6000 per unit, decreasing by $250 for every $1000 invested. For Hydro, each unit produces 150 MWh without technology, increasing by 7 MWh per $1000 invested, and the operational cost is $7000 per unit, decreasing by $300 for every $1000 invested. The company aims to maximize the net energy production (total energy produced minus operational costs). The company has a total budget of $100,000 for operational costs and technology investments. Please help the company to determine the optimal number of units and technology investments for each type of power plant.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro units\nSolarTechInvestment = model.addVar(name=\"SolarTechInvestment\", lb=0)  # investment in advanced technology for Solar\nWindTechInvestment = model.addVar(name=\"WindTechInvestment\", lb=0)  # investment in advanced technology for Wind\nHydroTechInvestment = model.addVar(name=\"HydroTechInvestment\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nNetSolar = (100 + 0.005 * SolarTechInvestment) * SolarUnits - (5000 - 0.002 * SolarTechInvestment) * SolarUnits\nNetWind = (120 + 0.006 * WindTechInvestment) * WindUnits - (6000 - 0.0025 * WindTechInvestment) * WindUnits\nNetHydro = (150 + 0.007 * HydroTechInvestment) * HydroUnits - (7000 - 0.003 * HydroTechInvestment) * HydroUnits\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetSolar + NetWind + NetHydro)\n\n# Add constraints\nmodel.addCons(5000 * SolarUnits + 6000 * WindUnits + 7000 * HydroUnits + SolarTechInvestment + WindTechInvestment + HydroTechInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Investment in Solar Technology: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in Wind Technology: \", model.getVal(WindTechInvestment))\n    print(\"Investment in Hydro Technology: \", model.getVal(HydroTechInvestment))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the annual operating cost is $50,000, the fuel efficiency is 5 km/l, and the capacity is 10 tons.\nFor TruckB, the annual operating cost is $60,000, the fuel efficiency is 6 km/l, and the capacity is 12 tons.\nFor TruckC, the annual operating cost is $70,000, the fuel efficiency is 7 km/l, and the capacity is 14 tons.\nFor TruckD, the annual operating cost is $80,000, the fuel efficiency is 8 km/l, and the capacity is 16 tons.\nFor TruckE, the annual operating cost is $90,000, the fuel efficiency is 9 km/l, and the capacity is 18 tons.\nThe company wants to minimize the total cost per ton-kilometer.\n// Total cost for TruckA: Cost_TruckA = 50,000 * TruckA\n// Total cost for TruckB: Cost_TruckB = 60,000 * TruckB\n// Total cost for TruckC: Cost_TruckC = 70,000 * TruckC\n// Total cost for TruckD: Cost_TruckD = 80,000 * TruckD\n// Total cost for TruckE: Cost_TruckE = 90,000 * TruckE\n// Total ton-kilometers for TruckA: TonKm_TruckA = 10 * 5 * TruckA\n// Total ton-kilometers for TruckB: TonKm_TruckB = 12 * 6 * TruckB\n// Total ton-kilometers for TruckC: TonKm_TruckC = 14 * 7 * TruckC\n// Total ton-kilometers for TruckD: TonKm_TruckD = 16 * 8 * TruckD\n// Total ton-kilometers for TruckE: TonKm_TruckE = 18 * 9 * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $1,500,000 for purchasing new trucks.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD + 90,000 * TruckE <= 1,500,000",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes. The annual operating cost, fuel efficiency, and capacity for each truck are given in the following Table.\n\n| Truck | Annual Operating Cost | Fuel Efficiency | Capacity |\n|-------|-----------------------|-----------------|----------|\n| TruckA | $50,000 | 5 km/l | 10 tons |\n| TruckB | $60,000 | 6 km/l | 12 tons |\n| TruckC | $70,000 | 7 km/l | 14 tons |\n| TruckD | $80,000 | 8 km/l | 16 tons |\n| TruckE | $90,000 | 9 km/l | 18 tons |\n\nThe company has a budget of $1,500,000 for purchasing new trucks. The company wants to minimize the total cost per ton-kilometer. Please help the company determine the optimal number of each type of truck to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = 50000 * TruckA\nCost_TruckB = 60000 * TruckB\nCost_TruckC = 70000 * TruckC\nCost_TruckD = 80000 * TruckD\nCost_TruckE = 90000 * TruckE\nTonKm_TruckA = 10 * 5 * TruckA\nTonKm_TruckB = 12 * 6 * TruckB\nTonKm_TruckC = 14 * 7 * TruckC\nTonKm_TruckD = 16 * 8 * TruckD\nTonKm_TruckE = 18 * 9 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE) == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $1,500,000 for purchasing new trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 1500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n// Efficiency of Trucks: E_T = 100 * T / 50\n// Efficiency of Vans: E_V = 50 * V / 30\n// Efficiency of Bikes: E_B = 10 * B / 10\n// So, the objective function is: Maximize (E_T + E_V + E_B)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 per day for operational costs.\n// 50 * T + 30 * V + 10 * B <= 1500\n\n## Generate Constraint-2:\nThe company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\n// 100 * T + 50 * V + 10 * B <= 2000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. The company has a budget of $1500 per day for operational costs and a storage capacity constraint that limits the total delivery capacity to 2000 units per day. Please help the company to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE_T = 100 * T / 50\nE_V = 50 * V / 30\nE_B = 10 * B / 10\n## the objective function is: Maximize (E_T + E_V + E_B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * T + 30 * V + 10 * B) == 100 * T + 50 * V + 10 * B)\n\n# Add constraints\n## The company has a budget of $1500 per day for operational costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1500)\n## The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The efficiency gain from the machinery is nonlinear and varies with the investment amount.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery. The initial production cost per unit for ProductA is $50, for ProductB is $75, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all production lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery. The initial production cost per unit for ProductA is $50, for ProductB is $75, and for ProductC is $100. The company aims to maximize the total profit from all products. The company has a total of 100 workers available for all production lines. The total investment in advanced machinery cannot exceed $50,000. Due to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB. Please help the company to determine the optimal number of units to produce for each product, the number of workers to allocate, and the amount of investment in advanced machinery to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)     # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0)  # investment in advanced machinery\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\nProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\nProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available for all production lines.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(MachineryInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(UnitsA))\n    print(\"Number of ProductB Units: \", model.getVal(UnitsB))\n    print(\"Number of ProductC Units: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in Advanced Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels.\n// {\"number of trucks on Route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks on Route C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumption_A = k * SpeedA^3 * TrucksA\n// FuelConsumption_B = k * SpeedB^3 * TrucksB\n// FuelConsumption_C = k * SpeedC^3 * TrucksC\n// So, the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe maximum speed allowed on Route A is 60 km/h.\n// SpeedA <= 60\n\n## Generate Constraint-3:\nThe maximum speed allowed on Route B is 70 km/h.\n// SpeedB <= 70\n\n## Generate Constraint-4:\nThe maximum speed allowed on Route C is 80 km/h.\n// SpeedC <= 80\n\n## Generate Constraint-5:\nThe company must ensure that at least 10 trucks are assigned to each route.\n// TrucksA >= 10; TrucksB >= 10; TrucksC >= 10",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the number of trucks and the routes they take to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the speed at which each truck travels. The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Number of Trucks | Speed (km/h) |\n|-------|------------------|--------------|\n| A     | TrucksA          | SpeedA       |\n| B     | TrucksB          | SpeedB       |\n| C     | TrucksC          | SpeedC       |\n\nThe company has a total of 50 trucks available. The maximum speed allowed on Route A is 60 km/h, on Route B is 70 km/h, and on Route C is 80 km/h. The company must ensure that at least 10 trucks are assigned to each route.\n\nPlease help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ensure that at least 10 trucks are assigned to each route.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10) # number of trucks on Route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=10) # number of trucks on Route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=10) # number of trucks on Route C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # speed of trucks on Route A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # speed of trucks on Route B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # speed of trucks on Route C\n\n# Define objective function\n## The fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3\n## Since pyscipopt does not support non-linear objective, we need to linearize the cubic term\nFuelConsumption_A = model.addVar(name=\"FuelConsumption_A\")\nFuelConsumption_B = model.addVar(name=\"FuelConsumption_B\")\nFuelConsumption_C = model.addVar(name=\"FuelConsumption_C\")\nmodel.addCons(FuelConsumption_A == SpeedA**3 * TrucksA)\nmodel.addCons(FuelConsumption_B == SpeedB**3 * TrucksB)\nmodel.addCons(FuelConsumption_C == SpeedC**3 * TrucksC)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\nmodel.addCons(obj == FuelConsumption_A + FuelConsumption_B + FuelConsumption_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## The maximum speed allowed on Route A is 60 km/h.\nmodel.addCons(SpeedA <= 60)\n## The maximum speed allowed on Route B is 70 km/h.\nmodel.addCons(SpeedB <= 70)\n## The maximum speed allowed on Route C is 80 km/h.\nmodel.addCons(SpeedC <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks on Route A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks on Route B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks on Route C: \", model.getVal(SpeedC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Refrigerated trucks\": \"TechUpgradeRefrigerated\", \"range\": \"TechUpgradeRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Heavy-Duty trucks\": \"TechUpgradeHeavyDuty\", \"range\": \"TechUpgradeHeavyDuty >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Standard trucks\": \"TechUpgradeStandard\", \"range\": \"TechUpgradeStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs.\n// Fuel cost per Refrigerated truck: FuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\n// Maintenance cost per Refrigerated truck: MaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\n// Similar calculations for Heavy-Duty and Standard trucks.\n// Total annual operating cost: OperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n// So, the objective function is: Minimize OperatingCost\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades.\n// RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200\n\n## Generate Constraint-3:\nAt least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations.\n// RefrigeratedTrucks >= 50; HeavyDutyTrucks >= 75",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs. The fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades, improving by 1% for each $1000 invested in technology upgrades and reducing maintenance costs by 0.5% for each $1000 invested.\n\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades. The total number of trucks cannot exceed 200. At least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations.\n\nPlease help the company to determine the optimal number of each type of truck and the investment in technology upgrades to minimize the total annual operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=50)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=75)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nTechUpgradeRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeRefrigerated\", lb=0)\nTechUpgradeHeavyDuty = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeHeavyDuty\", lb=0)\nTechUpgradeStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeStandard\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel and maintenance cost calculations\nBaseFuelCost = 10000  # Example base fuel cost per truck\nBaseMaintenanceCost = 2000  # Example base maintenance cost per truck\n\nFuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\nMaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\nFuelCostHeavyDuty = (BaseFuelCost * HeavyDutyTrucks) / (1 + 0.01 * TechUpgradeHeavyDuty)\nMaintenanceCostHeavyDuty = (BaseMaintenanceCost * HeavyDutyTrucks) * (1 - 0.005 * TechUpgradeHeavyDuty)\nFuelCostStandard = (BaseFuelCost * StandardTrucks) / (1 + 0.01 * TechUpgradeStandard)\nMaintenanceCostStandard = (BaseMaintenanceCost * StandardTrucks) * (1 - 0.005 * TechUpgradeStandard)\n\nOperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n\nmodel.addCons(obj == OperatingCost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks and technology upgrades.\nTruckCostRefrigerated = 50000  # Example cost per Refrigerated truck\nTruckCostHeavyDuty = 70000  # Example cost per Heavy-Duty truck\nTruckCostStandard = 30000  # Example cost per Standard truck\nmodel.addCons(RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000)\n\n## The total number of trucks cannot exceed 200.\nmodel.addCons(RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Tech Upgrades for Refrigerated Trucks: \", model.getVal(TechUpgradeRefrigerated))\n    print(\"Investment in Tech Upgrades for Heavy-Duty Trucks: \", model.getVal(TechUpgradeHeavyDuty))\n    print(\"Investment in Tech Upgrades for Standard Trucks: \", model.getVal(TechUpgradeStandard))\n    print(\"Minimized Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output and cost of each installation.\n// {\"number of solar panels in Region1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for solar panels\": \"RDSolar\", \"range\": \"RDSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for wind turbines\": \"RDWind\", \"range\": \"RDWind >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of solar panels and wind turbines increases nonlinearly with the investment in R&D. For every $100,000 invested in R&D for solar panels, the energy output increases by 5% per panel. For every $100,000 invested in R&D for wind turbines, the energy output increases by 8% per turbine. The company aims to maximize the total energy output from all installations.\n// Total energy output for solar panels in Region1: EnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region1: EnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region2: EnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region2: EnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region3: EnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region3: EnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n// So, the objective function is: Maximize (EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for R&D investments.\n// RDSolar + RDWind <= 200000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\n// Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The energy output of solar panels and wind turbines increases nonlinearly with the investment in R&D. For every $100,000 invested in R&D for solar panels, the energy output increases by 5% per panel. For every $100,000 invested in R&D for wind turbines, the energy output increases by 8% per turbine. The company aims to maximize the total energy output from all installations. The company has a total budget of $200,000 for R&D investments. Additionally, the total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to install in each region and the optimal investment in R&D to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels in Region1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of wind turbines in Region1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels in Region2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of wind turbines in Region2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels in Region3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of wind turbines in Region3\nRDSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"RDSolar\", lb=0) # investment in R&D for solar panels\nRDWind = model.addVar(vtype=\"CONTINUOUS\", name=\"RDWind\", lb=0) # investment in R&D for wind turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n## the objective function is: Maximize (EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\nmodel.addCons(obj == EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n# Add constraints\n## The company has a total budget of $200,000 for R&D investments.\nmodel.addCons(RDSolar + RDWind <= 200000)\n## The total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\nmodel.addCons(Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(Wind3))\n    print(\"Investment in R&D for Solar Panels: \", model.getVal(RDSolar))\n    print(\"Investment in R&D for Wind Turbines: \", model.getVal(RDWind))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the fuel efficiency upgrades to be made for each type of truck. The fuel efficiency upgrades are nonlinear and depend on the investment made in upgrading the engines.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. For TruckA, the initial fuel cost is $0.5 per km, and it decreases by $0.01 per km for every $100 invested in fuel efficiency. For TruckB, the initial fuel cost is $0.6 per km, and it decreases by $0.012 per km for every $100 invested in fuel efficiency. For TruckC, the initial fuel cost is $0.7 per km, and it decreases by $0.014 per km for every $100 invested in fuel efficiency. The company aims to minimize the total daily fuel cost across all trucks.\n// FuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\n// FuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\n// FuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\n// TotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n// So, the objective function is: Minimize TotalFuelCost\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel efficiency upgrades.\n// FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the company must ensure that at least 10 trucks of each type are deployed.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC, each designed for specific cargo types. The company needs to determine the number of trucks to deploy for each type and the investment in fuel efficiency upgrades for each type of truck. The fuel cost savings per kilometer for each truck type is a nonlinear function of the investment in fuel efficiency upgrades. The initial fuel cost and the rate of decrease in fuel cost per kilometer for each $100 invested in fuel efficiency are given in the following Table.\n\n| Truck Type | Initial Fuel Cost per km | Decrease in Fuel Cost per km for $100 Investment |\n|------------|--------------------------|-------------------------------------------------|\n| TruckA     | $0.5                     | $0.01                                           |\n| TruckB     | $0.6                     | $0.012                                          |\n| TruckC     | $0.7                     | $0.014                                          |\n\nThe company has a total budget of $10,000 for fuel efficiency upgrades. The total number of trucks that can be deployed is limited to 50. Due to maintenance constraints, the company must ensure that at least 10 trucks of each type are deployed. The company aims to minimize the total daily fuel cost across all trucks. Please help the company determine the optimal number of trucks and the investment in fuel efficiency upgrades to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10)  # number of TruckC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nFuelCostA = 0.5 - 0.0001 * FuelEfficiencyA\nFuelCostB = 0.6 - 0.00012 * FuelEfficiencyB\nFuelCostC = 0.7 - 0.00014 * FuelEfficiencyC\nTotalFuelCost = TruckA * 500 * FuelCostA + TruckB * 600 * FuelCostB + TruckC * 700 * FuelCostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\nmodel.addCons(FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)  # total budget for fuel efficiency upgrades\nmodel.addCons(TruckA + TruckB + TruckC <= 50)  # total number of trucks\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(FuelEfficiencyC))\n    print(\"Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000\n\n## Generate Constraint-2:\nThe production rate from each machine should not be less than 10 units per hour.\n// Pi >= 10 for i = 1, 2, 3, 4, 5, 6\n\n## Generate Constraint-3:\nThe voltage applied to each machine should not exceed 120 units.\n// Vi <= 120 for i = 1, 2, 3, 4, 5, 6",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The energy consumption of each machine is modeled as a quadratic function of the voltage applied, and the production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour. The total energy consumption should not exceed 15000 units, and the production rate from each machine should not be less than 10 units per hour. The voltage applied to each machine should not exceed 120 units.\nPlease help the plant manager to determine the optimal voltage settings for each machine (V1, V2, V3, V4, V5, V6) within the range of 0 to 120 to achieve these goals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120) # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120) # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120) # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120) # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120) # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120) # voltage for machine 6\n\n# Define objective function\n## Energy consumption for machine i: Ei = Vi^2\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\n## Production rate for machine i: Pi = 100 * Vi - Vi^2/10\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\n## Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n## The total energy consumption should not exceed 15000 units.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 + E6 <= 15000)\n## The production rate from each machine should not be less than 10 units per hour.\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\nmodel.addCons(P4 >= 10)\nmodel.addCons(P5 >= 10)\nmodel.addCons(P6 >= 10)\n## Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\nmodel.addCons(P1 + P2 + P3 + P4 + P5 + P6 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Minimized Total Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is 5$, for B it is 7$, for C it is 9$, for D it is 11$, and for E it is 13$. The company aims to minimize the total shipping cost while maintaining a certain profit margin. The profit margin is defined as the difference between the selling price and the shipping cost per unit. The selling price for each product is 10$ for A, 15$ for B, 20$ for C, 25$ for D, and 30$ for E. The objective is to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price.\n// Shipping cost of A: Cost_A = 5 * A\n// Shipping cost of B: Cost_B = 7 * B\n// Shipping cost of C: Cost_C = 9 * C\n// Shipping cost of D: Cost_D = 11 * D\n// Shipping cost of E: Cost_E = 13 * E\n// Profit margin of A: Profit_A = (10 - 5) * A\n// Profit margin of B: Profit_B = (15 - 7) * B\n// Profit margin of C: Profit_C = (20 - 9) * C\n// Profit margin of D: Profit_D = (25 - 11) * D\n// Profit margin of E: Profit_E = (30 - 13) * E\n// Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for shipping costs.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company must ship at least 20 units of each product to meet customer demands.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe total profit margin must be at least 20% of the total selling price.\n// (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)",
        "question": "A logistics company manages the delivery of five different products: A, B, C, D, and E. The company needs to determine the number of units of each product to ship to maximize efficiency while meeting customer demands and constraints.\nThe cost of shipping each product varies with the quantity shipped. For product A, the cost per unit is $5, for B it is $7, for C it is $9, for D it is $11, and for E it is $13. The selling price for each product is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to minimize the total shipping cost while maintaining a certain profit margin. The profit margin is defined as the difference between the selling price and the shipping cost per unit. The objective is to minimize the total shipping cost while ensuring a profit margin of at least 20% of the selling price.\nThe company has a budget of $1500 for shipping costs. The company must ship at least 20 units of each product to meet customer demands. The total profit margin must be at least 20% of the total selling price.\nPlease help the company to minimize the total shipping cost while meeting these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must ship at least 20 units of each product to meet customer demands.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## Shipping cost of A: Cost_A = 5 * A\n## Shipping cost of B: Cost_B = 7 * B\n## Shipping cost of C: Cost_C = 9 * C\n## Shipping cost of D: Cost_D = 11 * D\n## Shipping cost of E: Cost_E = 13 * E\nCost_A = 5 * A\nCost_B = 7 * B\nCost_C = 9 * C\nCost_D = 11 * D\nCost_E = 13 * E\n## Profit margin of A: Profit_A = (10 - 5) * A\n## Profit margin of B: Profit_B = (15 - 7) * B\n## Profit margin of C: Profit_C = (20 - 9) * C\n## Profit margin of D: Profit_D = (25 - 11) * D\n## Profit margin of E: Profit_E = (30 - 13) * E\nProfit_A = (10 - 5) * A\nProfit_B = (15 - 7) * B\nProfit_C = (20 - 9) * C\nProfit_D = (25 - 11) * D\nProfit_E = (30 - 13) * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $1500 for shipping costs.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The total profit margin must be at least 20% of the total selling price.\nmodel.addCons((10 * A + 15 * B + 20 * C + 25 * D + 30 * E) * 0.2 <= Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Minimized Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1132,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five different types of residential buildings: A, B, C, D, and E. They need to determine the number of each type of building to construct.\n// {\"number of type A buildings\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of type B buildings\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of type C buildings\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of type D buildings\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of type E buildings\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor type A buildings, the construction cost per building is $500,000, the expected rental income per building is $100,000 per year, and the maintenance cost per building is $20,000 per year. \nFor type B buildings, the construction cost per building is $600,000, the expected rental income per building is $120,000 per year, and the maintenance cost per building is $25,000 per year. \nFor type C buildings, the construction cost per building is $700,000, the expected rental income per building is $140,000 per year, and the maintenance cost per building is $30,000 per year.\nFor type D buildings, the construction cost per building is $800,000, the expected rental income per building is $160,000 per year, and the maintenance cost per building is $35,000 per year.\nFor type E buildings, the construction cost per building is $900,000, the expected rental income per building is $180,000 per year, and the maintenance cost per building is $40,000 per year.\nThe developer wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n// NPV_A = (100,000 - 20,000) * A / (1 + 0.05)^1 - 500,000 * A\n// NPV_B = (120,000 - 25,000) * B / (1 + 0.05)^1 - 600,000 * B\n// NPV_C = (140,000 - 30,000) * C / (1 + 0.05)^1 - 700,000 * C\n// NPV_D = (160,000 - 35,000) * D / (1 + 0.05)^1 - 800,000 * D\n// NPV_E = (180,000 - 40,000) * E / (1 + 0.05)^1 - 900,000 * E\n// So, the objective function is: Maximize (NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\n\n## Generate Constraint-1:\nThe developer has a total budget of $5,000,000 for construction costs.\n// 500,000 * A + 600,000 * B + 700,000 * C + 800,000 * D + 900,000 * E <= 5,000,000\n\n## Generate Constraint-2:\nDue to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings.\n// A <= 2 * B\n\n## Generate Constraint-3:\nThe total number of buildings cannot exceed 10.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-4:\nThe developer must build at least one type of each building.\n// A >= 1; B >= 1; C >= 1; D >= 1; E >= 1",
        "question": "A real estate developer is planning to build five different types of residential buildings: A, B, C, D, and E. They need to determine the number of each type of building to construct.\nFor type A buildings, the construction cost per building is $500,000, the expected rental income per building is $100,000 per year, and the maintenance cost per building is $20,000 per year. \nFor type B buildings, the construction cost per building is $600,000, the expected rental income per building is $120,000 per year, and the maintenance cost per building is $25,000 per year. \nFor type C buildings, the construction cost per building is $700,000, the expected rental income per building is $140,000 per year, and the maintenance cost per building is $30,000 per year.\nFor type D buildings, the construction cost per building is $800,000, the expected rental income per building is $160,000 per year, and the maintenance cost per building is $35,000 per year.\nFor type E buildings, the construction cost per building is $900,000, the expected rental income per building is $180,000 per year, and the maintenance cost per building is $40,000 per year.\nThe developer has a total budget of $5,000,000 for construction costs. Due to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings. The total number of buildings cannot exceed 10. The developer must build at least one type of each building.\nPlease help the developer to maximize the net present value (NPV) of the project, considering a discount rate of 5%.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1)  # number of type A buildings\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1)  # number of type B buildings\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=1)  # number of type C buildings\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=1)  # number of type D buildings\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=1)  # number of type E buildings\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNPV_A = (100000 - 20000) * A / (1 + 0.05) - 500000 * A\nNPV_B = (120000 - 25000) * B / (1 + 0.05) - 600000 * B\nNPV_C = (140000 - 30000) * C / (1 + 0.05) - 700000 * C\nNPV_D = (160000 - 35000) * D / (1 + 0.05) - 800000 * D\nNPV_E = (180000 - 40000) * E / (1 + 0.05) - 900000 * E\n## the objective function is: Maximize (NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\nmodel.addCons(obj == NPV_A + NPV_B + NPV_C + NPV_D + NPV_E)\n\n# Add constraints\n## The developer has a total budget of $5,000,000 for construction costs.\nmodel.addCons(500000 * A + 600000 * B + 700000 * C + 800000 * D + 900000 * E <= 5000000)\n## Due to zoning regulations, the number of type A buildings cannot exceed twice the number of type B buildings.\nmodel.addCons(A <= 2 * B)\n## The total number of buildings cannot exceed 10.\nmodel.addCons(A + B + C + D + E <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A Buildings: \", model.getVal(A))\n    print(\"Number of Type B Buildings: \", model.getVal(B))\n    print(\"Number of Type C Buildings: \", model.getVal(C))\n    print(\"Number of Type D Buildings: \", model.getVal(D))\n    print(\"Number of Type E Buildings: \", model.getVal(E))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1547,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a new location. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install, as well as the investment amount ($) in energy storage systems (StorageInvestment) to optimize the energy output and storage. The energy storage system affects the efficiency and capacity of both solar panels and wind turbines.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"StorageInvestment\", \"range\": \"StorageInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of both solar panels and wind turbines increases with the investment in energy storage systems. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from both sources.\n// Total energy output from solar panels: EnergySolar = (200 + 0.005 * StorageInvestment) * SolarPanels\n// Total energy output from wind turbines: EnergyWind = (500 + 0.01 * StorageInvestment) * WindTurbines\n// So, the objective function is: Maximize (EnergySolar + EnergyWind)\n\n## Generate Constraint-1:\nThe total budget for the installation and storage investment is $1,000,000.\n// SolarPanels + WindTurbines + StorageInvestment <= 1,000,000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a new location. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install, as well as the investment amount ($) in energy storage systems (StorageInvestment) to optimize the energy output and storage. The energy storage system affects the efficiency and capacity of both solar panels and wind turbines. The energy output of both solar panels and wind turbines increases with the investment in energy storage systems. The initial energy output per solar panel is 200 kWh, and it increases by 5 kWh for every $1,000 invested in storage. The initial energy output per wind turbine is 500 kWh, and it increases by 10 kWh for every $1,000 invested in storage. The company aims to maximize the total energy output from both sources. The total budget for the installation and storage investment is $1,000,000. Please help the company to maximize the total energy output from both solar panels and wind turbines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0) # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0) # number of wind turbines\nStorageInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageInvestment\", lb=0) # investment in energy storage systems\n\n# Define objective function\nEnergySolar = (200 + 0.005 * StorageInvestment) * SolarPanels\nEnergyWind = (500 + 0.01 * StorageInvestment) * WindTurbines\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind)\n\n# Add constraints\nmodel.addCons(SolarPanels + WindTurbines + StorageInvestment <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(StorageInvestment))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands.\n// {\"quantity of product A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 of raw materials and $10 of labor.\nThe profit per unit of product B is $70, but it requires $30 of raw materials and $15 of labor.\nThe profit per unit of product C is $60, but it requires $25 of raw materials and $12 of labor.\nThe profit per unit of product D is $80, but it requires $40 of raw materials and $20 of labor.\nThe profit per unit of product E is $90, but it requires $50 of raw materials and $25 of labor.\nThe company wants to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n// Total profit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a labor budget of $5,000.\n// 10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000\n\n## Generate Constraint-3:\nThe market demand for product A is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe market demand for product E is at most 50 units.\n// E <= 50\n\n## Generate Constraint-5:\nThe total production of all products must not exceed 500 units.\n// A + B + C + D + E <= 500",
        "question": "A manufacturing company produces five different types of products (A, B, C, D, E) using a complex production process. The company needs to optimize the allocation of resources to maximize profit while considering the varying costs and market demands. The profit per unit, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost | Labor Cost |\n|---------|-----------------|-------------------|------------|\n| A       | $50             | $20               | $10        |\n| B       | $70             | $30               | $15        |\n| C       | $60             | $25               | $12        |\n| D       | $80             | $40               | $20        |\n| E       | $90             | $50               | $25        |\n\nThe company has a budget of $10,000 for raw materials and a labor budget of $5,000. The market demand for product A is at least 100 units, and the market demand for product E is at most 50 units. The total production of all products must not exceed 500 units.\n\nPlease help the company to maximize the total profit, which is the sum of the profits from each product minus the total costs of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # quantity of product A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=50) # quantity of product E produced\n\n# Define objective function\n## Total profit = (50 * A - (20 * A + 10 * A)) + (70 * B - (30 * B + 15 * B)) + (60 * C - (25 * C + 12 * C)) + (80 * D - (40 * D + 20 * D)) + (90 * E - (50 * E + 25 * E))\nProfit_A = 50 * A - (20 * A + 10 * A)\nProfit_B = 70 * B - (30 * B + 15 * B)\nProfit_C = 60 * C - (25 * C + 12 * C)\nProfit_D = 80 * D - (40 * D + 20 * D)\nProfit_E = 90 * E - (50 * E + 25 * E)\nTotal_profit = Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_profit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n## The company has a labor budget of $5,000.\nmodel.addCons(10 * A + 15 * B + 12 * C + 20 * D + 25 * E <= 5000)\n## The market demand for product A is at least 100 units.\nmodel.addCons(A >= 100)\n## The market demand for product E is at most 50 units.\nmodel.addCons(E <= 50)\n## The total production of all products must not exceed 500 units.\nmodel.addCons(A + B + C + D + E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of product A: \", model.getVal(A))\n    print(\"Quantity of product B: \", model.getVal(B))\n    print(\"Quantity of product C: \", model.getVal(C))\n    print(\"Quantity of product D: \", model.getVal(D))\n    print(\"Quantity of product E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineD\": \"MachineD_units\", \"range\": \"MachineD_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 + 0.01 * (MachineA_units)^2, Cost_B = 300 + 0.015 * (MachineB_units)^2, Cost_C = 400 + 0.02 * (MachineC_units)^2, Cost_D = 500 + 0.025 * (MachineD_units)^2. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_A = (500 - Cost_A) * MachineA_units = (500 - (200 + 0.01 * (MachineA_units)^2)) * MachineA_units\n// Total profit for MachineB: Profit_B = (700 - Cost_B) * MachineB_units = (700 - (300 + 0.015 * (MachineB_units)^2)) * MachineB_units\n// Total profit for MachineC: Profit_C = (900 - Cost_C) * MachineC_units = (900 - (400 + 0.02 * (MachineC_units)^2)) * MachineC_units\n// Total profit for MachineD: Profit_D = (1100 - Cost_D) * MachineD_units = (1100 - (500 + 0.025 * (MachineD_units)^2)) * MachineD_units\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units for the month.\n// MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\n// MachineB_units >= 0.5 * MachineA_units\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $30,000. The cost of raw materials per unit for MachineA is $100, for MachineB is $150, for MachineC is $200, and for MachineD is $250.\n// 100 * MachineA_units + 150 * MachineB_units + 200 * MachineC_units + 250 * MachineD_units <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each machine is produced to maintain market presence.\n// MachineA_units >= 1; MachineB_units >= 1; MachineC_units >= 1; MachineD_units >= 1",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to decide how many units of each machine to produce in the next month to optimize their profit. The profit per unit for each machine and the production cost function for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| MachineA | $500 | Cost_A = 200 + 0.01 * (MachineA_units)^2 |\n| MachineB | $700 | Cost_B = 300 + 0.015 * (MachineB_units)^2 |\n| MachineC | $900 | Cost_C = 400 + 0.02 * (MachineC_units)^2 |\n| MachineD | $1100 | Cost_D = 500 + 0.025 * (MachineD_units)^2 |\n\nThe company has a total production capacity of 100 units for the month. Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA. The company has a limited budget for raw materials, which is $30,000. The cost of raw materials per unit for MachineA is $100, for MachineB is $150, for MachineC is $200, and for MachineD is $250. The company wants to ensure that at least one unit of each machine is produced to maintain market presence.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=1)\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=1)\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=1)\nMachineD_units = model.addVar(vtype=\"INTEGER\", name=\"MachineD_units\", lb=1)\n\n# Define objective function\n## Total profit for MachineA: Profit_A = (500 - Cost_A) * MachineA_units\nCost_A = 200 + 0.01 * MachineA_units**2\nProfit_A = (500 - Cost_A) * MachineA_units\n## Total profit for MachineB: Profit_B = (700 - Cost_B) * MachineB_units\nCost_B = 300 + 0.015 * MachineB_units**2\nProfit_B = (700 - Cost_B) * MachineB_units\n## Total profit for MachineC: Profit_C = (900 - Cost_C) * MachineC_units\nCost_C = 400 + 0.02 * MachineC_units**2\nProfit_C = (900 - Cost_C) * MachineC_units\n## Total profit for MachineD: Profit_D = (1100 - Cost_D) * MachineD_units\nCost_D = 500 + 0.025 * MachineD_units**2\nProfit_D = (1100 - Cost_D) * MachineD_units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 100 units for the month.\nmodel.addCons(MachineA_units + MachineB_units + MachineC_units + MachineD_units <= 100)\n## Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\nmodel.addCons(MachineB_units >= 0.5 * MachineA_units)\n## The company has a limited budget for raw materials, which is $30,000.\nmodel.addCons(100 * MachineA_units + 150 * MachineB_units + 200 * MachineC_units + 250 * MachineD_units <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Number of MachineD units: \", model.getVal(MachineD_units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1309,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device for the next month. Additionally, the company must determine the number of hours to allocate for maintenance of each device's production line.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for DeviceA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceD\": \"MD\", \"range\": \"MD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. The cost of maintenance per hour for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, and for DeviceD is $50. The company aims to maximize the total profit minus the total maintenance cost.\n// Profit from DeviceA: Profit_A = 50 * A - 20 * MA\n// Profit from DeviceB: Profit_B = 70 * B - 30 * MB\n// Profit from DeviceC: Profit_C = 90 * C - 40 * MC\n// Profit from DeviceD: Profit_D = 110 * D - 50 * MD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe total maintenance hours available for all devices is 100 hours.\n// MA + MB + MC + MD <= 100",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device for the next month and determine the number of hours to allocate for maintenance of each device's production line. The profit per unit and the cost of maintenance per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Maintenance Cost per Hour |\n|--------|-----------------|---------------------------|\n| DeviceA | $50             | $20                       |\n| DeviceB | $70             | $30                       |\n| DeviceC | $90             | $40                       |\n| DeviceD | $110            | $50                       |\n\nThe company aims to maximize the total profit minus the total maintenance cost. The total maintenance hours available for all devices is 100 hours. Please help the company determine the optimal production quantity and maintenance hours for each device to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # maintenance hours for DeviceA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # maintenance hours for DeviceB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # maintenance hours for DeviceC\nMD = model.addVar(vtype=\"CONTINUOUS\", name=\"MD\", lb=0) # maintenance hours for DeviceD\n\n# Define objective function\nProfit_A = 50 * A - 20 * MA\nProfit_B = 70 * B - 30 * MB\nProfit_C = 90 * C - 40 * MC\nProfit_D = 110 * D - 50 * MD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The total maintenance hours available for all devices is 100 hours.\nmodel.addCons(MA + MB + MC + MD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maintenance hours for DeviceA: \", model.getVal(MA))\n    print(\"Maintenance hours for DeviceB: \", model.getVal(MB))\n    print(\"Maintenance hours for DeviceC: \", model.getVal(MC))\n    print(\"Maintenance hours for DeviceD: \", model.getVal(MD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route.\n// Efficiency of Route A: E_A = 0.8 * A\n// Efficiency of Route B: E_B = 0.9 * B\n// Efficiency of Route C: E_C = 1.1 * C\n// Efficiency of Route D: E_D = 1.2 * D\n// Efficiency of Route E: E_E = 1.3 * E\n// So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nDue to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\n// A + B <= 25\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\n// C + D >= 15",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.3. The company aims to maximize the total efficiency of all routes, which is the sum of the product of the number of trucks and the efficiency factor for each route. The company has a total of 100 trucks available for allocation. Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined. The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined. Please help the company to maximize the total efficiency of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nE_A = 0.8 * A\nE_B = 0.9 * B\nE_C = 1.1 * C\nE_D = 1.2 * D\nE_E = 1.3 * E\n# So, the objective function is: Maximize (E_A + E_B + E_C + E_D + E_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E_A + E_B + E_C + E_D + E_E)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 100)\n# Due to maintenance schedules, no more than 25 trucks can be allocated to Route A and Route B combined.\nmodel.addCons(A + B <= 25)\n# The company wants to ensure that at least 15 trucks are allocated to Route C and Route D combined.\nmodel.addCons(C + D >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 910,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types of cargo (Perishable, Non-Perishable, and Hazardous). Each type of truck has different operational costs and capacities.\n// {\"number of trucks for Perishable cargo\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Non-Perishable cargo\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Hazardous cargo\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Perishable trucks is $2, for Non-Perishable trucks is $1.5, and for Hazardous trucks is $3. The revenue per kilometer for Perishable trucks is $5, for Non-Perishable trucks is $4, and for Hazardous trucks is $6. The company wants to maximize the profit per kilometer, which is defined as the difference between the revenue and the operational cost.\n// Profit_Perishable = (5 - 2) * PerishableTrucks\n// Profit_NonPerishable = (4 - 1.5) * NonPerishableTrucks\n// Profit_Hazardous = (6 - 3) * HazardousTrucks\n// So, the objective function is: Maximize (Profit_Perishable + Profit_NonPerishable + Profit_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks.\n// 20000 * PerishableTrucks + 15000 * NonPerishableTrucks + 30000 * HazardousTrucks <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 10.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 10",
        "question": "A logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types of cargo (Perishable, Non-Perishable, and Hazardous). Each type of truck has different operational costs and revenues per kilometer, as shown in the following Table.\n\n| Type of Cargo | Operational Cost per Kilometer | Revenue per Kilometer |\n|---------------|--------------------------------|-----------------------|\n| Perishable    | $2                             | $5                    |\n| Non-Perishable| $1.5                           | $4                    |\n| Hazardous     | $3                             | $6                    |\n\nThe company has a budget of $100,000 for purchasing trucks. The total number of trucks cannot exceed 10. The company wants to maximize the profit per kilometer, which is defined as the difference between the revenue and the operational cost.\n\nPlease help the company determine the optimal number of trucks for each type of cargo to maximize their profit per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0) # number of trucks for Perishable cargo\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0) # number of trucks for Non-Perishable cargo\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0) # number of trucks for Hazardous cargo\n\n# Define objective function\nProfit_Perishable = (5 - 2) * PerishableTrucks\nProfit_NonPerishable = (4 - 1.5) * NonPerishableTrucks\nProfit_Hazardous = (6 - 3) * HazardousTrucks\n# So, the objective function is: Maximize (Profit_Perishable + Profit_NonPerishable + Profit_Hazardous)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Perishable + Profit_NonPerishable + Profit_Hazardous)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * PerishableTrucks + 15000 * NonPerishableTrucks + 30000 * HazardousTrucks <= 100000)\n# The total number of trucks cannot exceed 10.\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Maximized Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. Component A has a profit of $5 per unit and a production cost of $2 per unit. Component B has a profit of $7 per unit and a production cost of $3 per unit. Component C has a profit of $9 per unit and a production cost of $4 per unit. Component D has a profit of $11 per unit and a production cost of $5 per unit. The firm aims to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced.\n// Profit of A: Profit_A = (5 - 2) * A\n// Profit of B: Profit_B = (7 - 3) * B\n// Profit of C: Profit_C = (9 - 4) * C\n// Profit of D: Profit_D = (11 - 5) * D\n// Production time for A: Time_A = 0.5 * A\n// Production time for B: Time_B = 0.7 * B\n// Production time for C: Time_C = 0.9 * C\n// Production time for D: Time_D = 1.1 * D\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n\n## Generate Constraint-1:\nThe firm has a budget of $1000 for production costs in the upcoming quarter.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe firm must produce at least 20 units of each component in the upcoming quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to produce in the upcoming quarter to optimize its operations. The profit margin, production cost, and production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|---------------------------|--------------------------|\n| A         | $5              | $2                        | 0.5 hours                |\n| B         | $7              | $3                        | 0.7 hours                |\n| C         | $9              | $4                        | 0.9 hours                |\n| D         | $11             | $5                        | 1.1 hours                |\n\nThe firm has a budget of $1000 for production costs in the upcoming quarter. The firm must produce at least 20 units of each component in the upcoming quarter. The firm aims to maximize the total profit per unit of production time, where production time for each component is linearly related to the number of units produced. Please help the firm determine the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm must produce at least 20 units of each component in the upcoming quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (7 - 3) * B\nProfit_C = (9 - 4) * C\nProfit_D = (11 - 5) * D\nTime_A = 0.5 * A\nTime_B = 0.7 * B\nTime_C = 0.9 * C\nTime_D = 1.1 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (Time_A + Time_B + Time_C + Time_D)\n## convert the division to multiplication\nmodel.addCons(obj * (Time_A + Time_B + Time_C + Time_D) == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $1000 for production costs in the upcoming quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation.\n// {\"production quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvest\", \"range\": \"AutomationInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n// Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n// Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvest <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB.\n// DeviceAQty >= 1000; DeviceBQty >= 1500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation. The production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units for the quarter. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB. Please help the company to determine the optimal production quantities and investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=1000)  # production quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=1500)  # production quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0)  # production quantity of DeviceC\nAutomationInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvest\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\nProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\nProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 10000)\nmodel.addCons(AutomationInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Investment in Automation: \", model.getVal(AutomationInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested.\n// Total fuel cost for TruckA: CostA = (100 - 0.05 * EfficiencyA) * TripsA\n// Total fuel cost for TruckB: CostB = (150 - 0.07 * EfficiencyB) * TripsB\n// Total fuel cost for TruckC: CostC = (200 - 0.1 * EfficiencyC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs.\n// 100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicle types must not exceed 500.\n// TripsA + TripsB + TripsC <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips.\n// TripsA >= 50; TripsB >= 100\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for any vehicle type should not exceed $5,000.\n// EfficiencyA <= 5000\n// EfficiencyB <= 5000\n// EfficiencyC <= 5000",
        "question": "A logistics company is planning its routes for the next quarter and operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type. The company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested. The company has a budget of $20,000 for investments in fuel efficiency and operational costs. The total number of trips across all vehicle types must not exceed 500. Due to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips. The investment in fuel efficiency for any vehicle type should not exceed $5,000. Please help the company to minimize the total fuel cost for all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=50)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=100)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nCostA = (100 - 0.05 * EfficiencyA) * TripsA\nCostB = (150 - 0.07 * EfficiencyB) * TripsB\nCostC = (200 - 0.1 * EfficiencyC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a budget of $20,000 for investments in fuel efficiency and operational costs.\nmodel.addCons(100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n# The total number of trips across all vehicle types must not exceed 500.\nmodel.addCons(TripsA + TripsB + TripsC <= 500)\n# Due to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips.\nmodel.addCons(TripsA >= 50)\nmodel.addCons(TripsB >= 100)\n# The investment in fuel efficiency for any vehicle type should not exceed $5,000.\nmodel.addCons(EfficiencyA <= 5000)\nmodel.addCons(EfficiencyB <= 5000)\nmodel.addCons(EfficiencyC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different warehouses across the country. The company needs to optimize the distribution of goods from these warehouses to minimize transportation costs while meeting customer demand.\n// {\"goods distributed from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"real\"}\n// {\"goods distributed from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of transporting goods from each warehouse is a nonlinear function of the quantity of goods distributed. The cost functions are as follows:\n- Warehouse 1: Cost = 0.05 * W1^2\n- Warehouse 2: Cost = 0.04 * W2^2\n- Warehouse 3: Cost = 0.06 * W3^2\n- Warehouse 4: Cost = 0.03 * W4^2\n- Warehouse 5: Cost = 0.07 * W5^2\nThe company aims to minimize the total transportation cost.\n// Objective function: Minimize (0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2)\n\n## Generate Constraint-1:\nThe total amount of goods distributed must meet the national demand of 1000 units.\n// W1 + W2 + W3 + W4 + W5 = 1000",
        "question": "A logistics company operates 5 different warehouses across the country. The company needs to optimize the distribution of goods from these warehouses to minimize transportation costs while meeting customer demand. The cost of transporting goods from each warehouse is a nonlinear function of the quantity of goods distributed, as shown in the following Table.\n\n| Warehouse | Cost Function          |\n|-----------|------------------------|\n| 1         | 0.05 * W1^2            |\n| 2         | 0.04 * W2^2            |\n| 3         | 0.06 * W3^2            |\n| 4         | 0.03 * W4^2            |\n| 5         | 0.07 * W5^2            |\n\nThe total amount of goods distributed must meet the national demand of 1000 units. Please help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0) # goods distributed from warehouse 1\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=0) # goods distributed from warehouse 2\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=0) # goods distributed from warehouse 3\nW4 = model.addVar(vtype=\"CONTINUOUS\", name=\"W4\", lb=0) # goods distributed from warehouse 4\nW5 = model.addVar(vtype=\"CONTINUOUS\", name=\"W5\", lb=0) # goods distributed from warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2)\nmodel.addCons(obj == 0.05 * W1**2 + 0.04 * W2**2 + 0.06 * W3**2 + 0.03 * W4**2 + 0.07 * W5**2)\n\n# Add constraints\n## The total amount of goods distributed must meet the national demand of 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 == 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Goods distributed from warehouse 1: \", model.getVal(W1))\n    print(\"Goods distributed from warehouse 2: \", model.getVal(W2))\n    print(\"Goods distributed from warehouse 3: \", model.getVal(W3))\n    print(\"Goods distributed from warehouse 4: \", model.getVal(W4))\n    print(\"Goods distributed from warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n// SpecialTrucks >= 0.5 * LargeTrucks",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=0)\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\nmodel.addCons(SpecialTrucks >= 0.5 * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Small packages: \", model.getVal(SmallTrucks))\n    print(\"Number of trucks for Medium packages: \", model.getVal(MediumTrucks))\n    print(\"Number of trucks for Large packages: \", model.getVal(LargeTrucks))\n    print(\"Number of trucks for X-Large packages: \", model.getVal(XL_Trucks))\n    print(\"Number of trucks for Special packages: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. The company needs to decide how many trips each type of truck should make to optimize its operations.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $100 per trip, and it can carry 10 tons of goods. Truck B costs $150 per trip and can carry 15 tons. Truck C costs $200 per trip and can carry 20 tons. The company aims to minimize the total cost of operations while maximizing the total tonnage transported. The objective is to minimize the ratio of total cost to total tonnage.\n// Cost of operating Truck A: Cost_A = 100 * A\n// Cost of operating Truck B: Cost_B = 150 * B\n// Cost of operating Truck C: Cost_C = 200 * C\n// Total tonnage transported: Tonnage = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (10 * A + 15 * B + 20 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 100 * A + 150 * B + 200 * C <= 5000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck A, Truck B, and Truck C. The company needs to decide how many trips each type of truck should make to optimize its operations. The cost of operating Truck A is $100 per trip, and it can carry 10 tons of goods. Truck B costs $150 per trip and can carry 15 tons. Truck C costs $200 per trip and can carry 20 tons. The company aims to minimize the total cost of operations while maximizing the total tonnage transported. The objective is to minimize the ratio of total cost to total tonnage. The company has a budget of $5000 for transportation costs. Please help the company determine the optimal number of trips for each type of truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 150 * B\nCost_C = 200 * C\nTonnage = 10 * A + 15 * B + 20 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / Tonnage\n## convert the division to multiplication\nmodel.addCons(obj * Tonnage == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Minimized Cost to Tonnage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type.\n// {\"number of units of MachineA\": \"MachineA_units\", \"range\": \"MachineA_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_units\", \"range\": \"MachineB_units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_units\", \"range\": \"MachineC_units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it requires a setup cost of $10,000. The profit per unit for MachineB is $700, with a setup cost of $15,000. The profit per unit for MachineC is $900, with a setup cost of $20,000. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 * MachineA_units) - 10,000\n// Total profit for MachineB: Profit_MachineB = (700 * MachineB_units) - 15,000\n// Total profit for MachineC: Profit_MachineC = (900 * MachineC_units) - 20,000\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for setup costs.\n// 10,000 * MachineA_units + 15,000 * MachineB_units + 20,000 * MachineC_units <= 100,000\n\n## Generate Constraint-2:\nThe production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units.\n// MachineA_units <= 100\n// MachineB_units <= 80\n// MachineC_units <= 60\n\n## Generate Constraint-3:\nDue to market demand, the number of MachineB units produced must be at least twice the number of MachineA units.\n// MachineB_units >= 2 * MachineA_units\n\n## Generate Constraint-4:\nThe company must produce at least 20 units of MachineC.\n// MachineC_units >= 20\n\n## Generate Constraint-5:\nThe total number of units produced across all machines cannot exceed 150 units.\n// MachineA_units + MachineB_units + MachineC_units <= 150",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit, considering the varying costs and revenues associated with each machine type. The profit per unit and setup cost for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| MachineA | $500           | $10,000    |\n| MachineB | $700           | $15,000    |\n| MachineC | $900           | $20,000    |\n\nThe company has a total budget of $100,000 for setup costs. The production capacity for MachineA is limited to 100 units, for MachineB to 80 units, and for MachineC to 60 units. Due to market demand, the number of MachineB units produced must be at least twice the number of MachineA units. The company must produce at least 20 units of MachineC. The total number of units produced across all machines cannot exceed 150 units.\n\nPlease help the company to maximize the total profit, which is calculated as the profit per unit multiplied by the number of units produced minus the setup cost for each machine type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_units\", lb=0)\nMachineB_units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_units\", lb=0)\nMachineC_units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_units\", lb=0)\n\n# Define objective function\nProfit_MachineA = (500 * MachineA_units) - 10000\nProfit_MachineB = (700 * MachineB_units) - 15000\nProfit_MachineC = (900 * MachineC_units) - 20000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\nmodel.addCons(10000 * MachineA_units + 15000 * MachineB_units + 20000 * MachineC_units <= 100000)\nmodel.addCons(MachineA_units <= 100)\nmodel.addCons(MachineB_units <= 80)\nmodel.addCons(MachineC_units <= 60)\nmodel.addCons(MachineB_units >= 2 * MachineA_units)\nmodel.addCons(MachineC_units >= 20)\nmodel.addCons(MachineA_units + MachineB_units + MachineC_units <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA units: \", model.getVal(MachineA_units))\n    print(\"Number of MachineB units: \", model.getVal(MachineB_units))\n    print(\"Number of MachineC units: \", model.getVal(MachineC_units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency.\n// {\"number of goods shipped from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping goods from each warehouse varies with the volume of goods shipped. The cost function is nonlinear and is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.04 * W2^2\n- Cost from warehouse 3: C3 = 0.06 * W3^2\n- Cost from warehouse 4: C4 = 0.03 * W4^2\n- Cost from warehouse 5: C5 = 0.07 * W5^2\nThe company wants to minimize the total shipping cost.\n// The objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\n// Minimize TotalCost = 0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2\n\n## Generate Constraint-1:\nThe total number of goods that can be shipped from all warehouses is limited to 1000 units.\n// W1 + W2 + W3 + W4 + W5 <= 1000\n\n## Generate Constraint-2:\nEach warehouse has a maximum capacity for shipping goods:\n- Warehouse 1: 200 units\n- Warehouse 2: 300 units\n- Warehouse 3: 250 units\n- Warehouse 4: 150 units\n- Warehouse 5: 100 units\n// W1 <= 200\n// W2 <= 300\n// W3 <= 250\n// W4 <= 150\n// W5 <= 100\n\n## Generate Constraint-3:\nThe company must ship at least 50 units from each warehouse to maintain operational efficiency.\n// W1 >= 50\n// W2 >= 50\n// W3 >= 50\n// W4 >= 50\n// W5 >= 50",
        "question": "A company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency. The cost of shipping goods from each warehouse varies with the volume of goods shipped, and the cost function for each warehouse is given by the following table:\n\n| Warehouse | Cost Function (per unit) |\n|-----------|-------------------------|\n| 1         | 0.05 * W1^2             |\n| 2         | 0.04 * W2^2             |\n| 3         | 0.06 * W3^2             |\n| 4         | 0.03 * W4^2             |\n| 5         | 0.07 * W5^2             |\n\nThe company wants to minimize the total shipping cost. The total number of goods that can be shipped from all warehouses is limited to 1000 units. Each warehouse has a maximum capacity for shipping goods as follows:\n- Warehouse 1: 200 units\n- Warehouse 2: 300 units\n- Warehouse 3: 250 units\n- Warehouse 4: 150 units\n- Warehouse 5: 100 units\nThe company must also ship at least 50 units from each warehouse to maintain operational efficiency.\n\nPlease help the company determine the optimal number of goods to be shipped from each warehouse to minimize the total shipping cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=50, ub=200) # number of goods shipped from warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=50, ub=300) # number of goods shipped from warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=50, ub=250) # number of goods shipped from warehouse 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=50, ub=150) # number of goods shipped from warehouse 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=50, ub=100) # number of goods shipped from warehouse 5\n\n# Define objective function\n## The cost of shipping goods from each warehouse varies with the volume of goods shipped.\nC1 = 0.05 * W1**2\nC2 = 0.04 * W2**2\nC3 = 0.06 * W3**2\nC4 = 0.03 * W4**2\nC5 = 0.07 * W5**2\n## The company wants to minimize the total shipping cost.\nTotalCost = C1 + C2 + C3 + C4 + C5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total number of goods that can be shipped from all warehouses is limited to 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 1000)\n## Each warehouse has a maximum capacity for shipping goods.\nmodel.addCons(W1 <= 200)\nmodel.addCons(W2 <= 300)\nmodel.addCons(W3 <= 250)\nmodel.addCons(W4 <= 150)\nmodel.addCons(W5 <= 100)\n## The company must ship at least 50 units from each warehouse to maintain operational efficiency.\nmodel.addCons(W1 >= 50)\nmodel.addCons(W2 >= 50)\nmodel.addCons(W3 >= 50)\nmodel.addCons(W4 >= 50)\nmodel.addCons(W5 >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of goods shipped from warehouse 1: \", model.getVal(W1))\n    print(\"Number of goods shipped from warehouse 2: \", model.getVal(W2))\n    print(\"Number of goods shipped from warehouse 3: \", model.getVal(W3))\n    print(\"Number of goods shipped from warehouse 4: \", model.getVal(W4))\n    print(\"Number of goods shipped from warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Shipping Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows:\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 673,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon.\nFor T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon.\nFor T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon.\nFor T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon.\nFor T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// Total capacity: Capacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities, operational costs per mile, and fuel efficiencies. The details for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Capacity | Fuel Efficiency |\n|------------|---------------------------|----------|-----------------|\n| T1         | $2                        | 10 tons  | 5 miles/gallon  |\n| T2         | $3                        | 15 tons  | 4 miles/gallon  |\n| T3         | $4                        | 20 tons  | 3 miles/gallon  |\n| T4         | $5                        | 25 tons  | 2 miles/gallon  |\n| T5         | $6                        | 30 tons  | 1 mile/gallon   |\n\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks. The company has a budget of $500,000 for purchasing trucks.\n\nPlease help the company determine the optimal number of each type of truck to purchase to minimize the Total Cost Efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nCapacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Type1 trucks\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Type1 trucks\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type2 trucks\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type3 trucks\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n// Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n// Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n// Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 500.\n// Truck1 + Truck2 + Truck3 <= 500\n\n## Generate Constraint-3:\nAt least 100 Type1 trucks and 150 Type2 trucks must be purchased.\n// Truck1 >= 100; Truck2 >= 150",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet. The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks in the fleet must not exceed 500. At least 100 Type1 trucks and 150 Type2 trucks must be purchased. Please help the company to determine the optimal number of trucks and the investment in fuel efficiency to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=100)  # number of Type1 trucks\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=150)  # number of Type2 trucks\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)  # number of Type3 trucks\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Type1 trucks\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Type2 trucks\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Type3 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\nCost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\nCost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000)\n## The total number of trucks in the fleet must not exceed 500.\nmodel.addCons(Truck1 + Truck2 + Truck3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(Truck1))\n    print(\"Number of Type2 Trucks: \", model.getVal(Truck2))\n    print(\"Number of Type3 Trucks: \", model.getVal(Truck3))\n    print(\"Investment in Fuel Efficiency for Type1 Trucks: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Type2 Trucks: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Type3 Trucks: \", model.getVal(Efficiency3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for small trucks per km\": \"FuelRateSmall\", \"range\": \"FuelRateSmall > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for medium trucks per km\": \"FuelRateMedium\", \"range\": \"FuelRateMedium > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for large trucks per km\": \"FuelRateLarge\", \"range\": \"FuelRateLarge > 0\", \"type\": \"real\"}\n// {\"distance traveled by each small truck per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each medium truck per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each large truck per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel consumption across all trucks.\n// TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000\n\n## Generate Constraint-2:\nThe total daily distance traveled by all trucks must not exceed 10,000 km.\n// DistanceSmall * SmallTrucks + DistanceMedium * MediumTrucks + DistanceLarge * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company must ensure at least 50% of the total daily demand is met. The demand is 8000 kg, and small trucks carry 500 kg, medium trucks carry 1000 kg, and large trucks carry 1500 kg.\n// 500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000\n\n## Generate Constraint-4:\nThe company wants to maintain a balanced fleet, ensuring that the number of medium trucks is at least half the number of small trucks, and the number of large trucks is at least half the number of medium trucks.\n// MediumTrucks >= 0.5 * SmallTrucks\n// LargeTrucks >= 0.5 * MediumTrucks",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency. The company aims to minimize the total daily fuel consumption across all trucks. The company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000. The total daily distance traveled by all trucks must not exceed 10,000 km. The company must ensure at least 50% of the total daily demand is met. The demand is 8000 kg, and small trucks carry 500 kg, medium trucks carry 1000 kg, and large trucks carry 1500 kg. The company wants to maintain a balanced fleet, ensuring that the number of medium trucks is at least half the number of small trucks, and the number of large trucks is at least half the number of medium trucks.\nPlease help the company to determine the optimal number of small, medium, and large trucks to purchase and their respective daily travel distances to meet these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\nTotalFuelConsumption = SmallTrucks * model.addVar(name=\"FuelRateSmall\") * model.addVar(name=\"DistanceSmall\") + \\\n                        MediumTrucks * model.addVar(name=\"FuelRateMedium\") * model.addVar(name=\"DistanceMedium\") + \\\n                        LargeTrucks * model.addVar(name=\"FuelRateLarge\") * model.addVar(name=\"DistanceLarge\")\nmodel.addCons(obj == TotalFuelConsumption)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The total daily distance traveled by all trucks must not exceed 10,000 km.\nmodel.addCons(model.addVar(name=\"DistanceSmall\") * SmallTrucks + model.addVar(name=\"DistanceMedium\") * MediumTrucks + model.addVar(name=\"DistanceLarge\") * LargeTrucks <= 10000)\n## The company must ensure at least 50% of the total daily demand is met.\nmodel.addCons(500 * SmallTrucks + 1000 * MediumTrucks + 1500 * LargeTrucks >= 0.5 * 8000)\n## The company wants to maintain a balanced fleet.\nmodel.addCons(MediumTrucks >= 0.5 * SmallTrucks)\nmodel.addCons(LargeTrucks >= 0.5 * MediumTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\n// NetProfit_Small = (200 - 50) * SmallVehicles\n// NetProfit_Medium = (300 - 75) * MediumVehicles\n// NetProfit_Large = (400 - 100) * LargeVehicles\n// So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs.\n// 50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The profit per trip and operational cost per vehicle per day for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Profit per Trip | Operational Cost per Day |\n|--------------|-----------------|--------------------------|\n| Small        | $200            | $50                      |\n| Medium       | $300            | $75                      |\n| Large        | $400            | $100                     |\n\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs. The number of each type of vehicle must be a non-negative integer. Please help the company to maximize the net daily profit from all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nNetProfit_Small = (200 - 50) * SmallVehicles\nNetProfit_Medium = (300 - 75) * MediumVehicles\nNetProfit_Large = (400 - 100) * LargeVehicles\n# So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n# Add constraints\n# The company has a total budget of $5000 per day for vehicle maintenance and operational costs.\nmodel.addCons(50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50, ProductionCostA is $30.\nThe profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70, ProductionCostB is $40.\nThe profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60, ProductionCostC is $35.\nThe company wants to maximize the total profit from all products.\n// Objective function: Maximize (ProfitA + ProfitB + ProfitC) = ((50 - 30) * QuantityA - 0.01 * QuantityA^2) + ((70 - 40) * QuantityB - 0.02 * QuantityB^2) + ((60 - 35) * QuantityC - 0.015 * QuantityC^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the demand for ProductA is at least twice the demand for ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $30,000. The cost of raw materials for ProductA is $10 per unit, for ProductB is $15 per unit, and for ProductC is $12 per unit.\n// 10 * QuantityA + 15 * QuantityB + 12 * QuantityC <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// QuantityA >= 1; QuantityB >= 1; QuantityC >= 1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50 and ProductionCostA is $30. The profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70 and ProductionCostB is $40. The profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60 and ProductionCostC is $35. The company wants to maximize the total profit from all products.\n\nThe total production capacity of the company is limited to 1000 units. Due to market research, the demand for ProductA is at least twice the demand for ProductB. The company has a budget constraint for raw materials, which is $30,000. The cost of raw materials for ProductA is $10 per unit, for ProductB is $15 per unit, and for ProductC is $12 per unit. The company wants to ensure that at least one unit of each product is produced to maintain market presence.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=1)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=1)  # production quantity for ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculations with quadratic terms\nProfitA = (50 - 30) * QuantityA - 0.01 * QuantityA**2\nProfitB = (70 - 40) * QuantityB - 0.02 * QuantityB**2\nProfitC = (60 - 35) * QuantityC - 0.015 * QuantityC**2\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n## Due to market research, the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n## The company has a budget constraint for raw materials, which is $30,000.\nmodel.addCons(10 * QuantityA + 15 * QuantityB + 12 * QuantityC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, with a production cost per unit of $10 and a storage cost per unit of $5. \nThe profit per unit of P2 is $40, with a production cost per unit of $15 and a storage cost per unit of $7. \nThe profit per unit of P3 is $50, with a production cost per unit of $20 and a storage cost per unit of $9. \nThe manufacturer aims to maximize the total net profit (profit minus production and storage costs) while considering the storage space and production time.\n// NetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\n// NetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\n// NetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n// The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited storage space of 200 cubic meters. The storage requirement for P1 is 2 cubic meters per unit, for P2 is 3 cubic meters per unit, and for P3 is 4 cubic meters per unit.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a limited production time of 150 hours. The production time for P1 is 3 hours per unit, for P2 is 4 hours per unit, and for P3 is 5 hours per unit.\n// 3 * P1 + 4 * P2 + 5 * P3 <= 150\n\n## Generate Constraint-3:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * P1 + 15 * P2 + 20 * P3 <= 3000\n\n## Generate Constraint-4:\nThe market demand for P1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of P1.\n// P1 <= 10\n\n## Generate Constraint-5:\nThe manufacturer wants to ensure that at least 20% of the production is of P3 to meet a specific contract requirement.\n// P3 >= 0.2 * (P1 + P2 + P3)",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints. The profit per unit of P1 is $30, with a production cost per unit of $10 and a storage cost per unit of $5. The profit per unit of P2 is $40, with a production cost per unit of $15 and a storage cost per unit of $7. The profit per unit of P3 is $50, with a production cost per unit of $20 and a storage cost per unit of $9. The manufacturer has a limited storage space of 200 cubic meters, with P1 requiring 2 cubic meters per unit, P2 requiring 3 cubic meters per unit, and P3 requiring 4 cubic meters per unit. The manufacturer also has a limited production time of 150 hours, with P1 taking 3 hours per unit, P2 taking 4 hours per unit, and P3 taking 5 hours per unit. Additionally, the manufacturer has a budget of $3000 for production costs. The market demand for P1 is 10 units, limiting the production of P1 to a maximum of 10 units. The manufacturer also wants to ensure that at least 20% of the production is of P3 to meet a specific contract requirement. Please help the manufacturer to maximize the total net profit (profit minus production and storage costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\nNetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\nNetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n# The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The manufacturer has a limited storage space of 200 cubic meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n# The manufacturer has a limited production time of 150 hours.\nmodel.addCons(3 * P1 + 4 * P2 + 5 * P3 <= 150)\n# The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * P1 + 15 * P2 + 20 * P3 <= 3000)\n# The market demand for P1 is 10 units.\nmodel.addCons(P1 <= 10)\n# The manufacturer wants to ensure that at least 20% of the production is of P3.\nmodel.addCons(P3 >= 0.2 * (P1 + P2 + P3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000, per Hybrid vehicle is $8,000, and per Hydrogen vehicle is $12,000. Due to economies of scale, the profit per vehicle increases nonlinearly with the quantity produced. Specifically, the profit per vehicle increases by an additional $10 for every 100 vehicles produced beyond the first 100 for each type. The company aims to maximize the total profit from vehicle sales.\n// Profit_E = (10000 + (E - 100) / 100 * 10) * E\n// Profit_H = (8000 + (H - 100) / 100 * 10) * H\n// Profit_Hy = (12000 + (Hy - 100) / 100 * 10) * Hy\n// So, the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 vehicles in total.\n// E + H + Hy <= 500\n\n## Generate Constraint-2:\nThe company has a budget constraint for production costs, which is $4,000,000. The cost per Electric vehicle is $5,000, per Hybrid vehicle is $4,500, and per Hydrogen vehicle is $6,000.\n// 5000 * E + 4500 * H + 6000 * Hy <= 4000000\n\n## Generate Constraint-3:\nThe market demand for Electric vehicles is at least 150 units, and for Hydrogen vehicles is at most 100 units.\n// E >= 150\n// Hy <= 100\n\n## Generate Constraint-4:\nThe company must produce at least twice as many Hybrid vehicles as Hydrogen vehicles.\n// H >= 2 * Hy",
        "question": "A company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints. The profit per vehicle and additional profit due to economies of scale are given in the following Table.\n\n| Vehicle Type | Profit per Vehicle (First 100) | Additional Profit per Vehicle (Beyond 100) |\n|--------------|-------------------------------|------------------------------------------|\n| Electric (E) | $10,000                       | $10 per 100 vehicles produced             |\n| Hybrid (H)   | $8,000                        | $10 per 100 vehicles produced             |\n| Hydrogen (Hy)| $12,000                       | $10 per 100 vehicles produced             |\n\nThe company has a limited production capacity of 500 vehicles in total. The company has a budget constraint for production costs, which is $4,000,000. The cost per Electric vehicle is $5,000, per Hybrid vehicle is $4,500, and per Hydrogen vehicle is $6,000. The market demand for Electric vehicles is at least 150 units, and for Hydrogen vehicles is at most 100 units. The company must produce at least twice as many Hybrid vehicles as Hydrogen vehicles.\n\nPlease help the company to maximize the total profit from vehicle sales, considering the economies of scale and the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0, ub=100) # quantity of Hydrogen vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_E = (10000 + (E - 100) / 100 * 10) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=150, ub=250)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=250, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = (10000 + (E1 - 100) / 100 * 10) * E1 * E_b1 + (10000 + (E2 - 100) / 100 * 10) * E2 * E_b2\n## create piecewise variables for piecewise function: Profit_H = (8000 + (H - 100) / 100 * 10) * H\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0, ub=100)\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=100, ub=500)\nH_b1 = model.addVar(vtype=\"B\", name=\"H_b1\")\nH_b2 = model.addVar(vtype=\"B\", name=\"H_b2\")\nmodel.addCons(H_b1 + H_b2 == 1)\nmodel.addCons(H == H1*H_b1 + H2*H_b2)\nProfit_H = (8000 + (H1 - 100) / 100 * 10) * H1 * H_b1 + (8000 + (H2 - 100) / 100 * 10) * H2 * H_b2\n## create piecewise variables for piecewise function: Profit_Hy = (12000 + (Hy - 100) / 100 * 10) * Hy\nHy1 = model.addVar(vtype=\"INTEGER\", name=\"Hy1\", lb=0, ub=100)\nHy2 = model.addVar(vtype=\"INTEGER\", name=\"Hy2\", lb=100, ub=500)\nHy_b1 = model.addVar(vtype=\"B\", name=\"Hy_b1\")\nHy_b2 = model.addVar(vtype=\"B\", name=\"Hy_b2\")\nmodel.addCons(Hy_b1 + Hy_b2 == 1)\nmodel.addCons(Hy == Hy1*Hy_b1 + Hy2*Hy_b2)\nProfit_Hy = (12000 + (Hy1 - 100) / 100 * 10) * Hy1 * Hy_b1 + (12000 + (Hy2 - 100) / 100 * 10) * Hy2 * Hy_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\nmodel.addCons(obj == Profit_E + Profit_H + Profit_Hy)\n\n# Add constraints\nmodel.addCons(E + H + Hy <= 500)\nmodel.addCons(5000 * E + 4500 * H + 6000 * Hy <= 4000000)\nmodel.addCons(H >= 2 * Hy)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1415,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n// Total energy output: Energy = 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3\n// Total cost: Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for this project.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000\n\n## Generate Constraint-3:\nThe total number of wind turbines must not exceed 20.\n// Wind1 + Wind2 + Wind3 <= 20\n\n## Generate Constraint-4:\nThe number of Solar1 panels must be at least twice the number of Solar5 panels.\n// Solar1 >= 2 * Solar5\n\n## Generate Constraint-5:\nThe total energy output must be at least 50,000 kWh per year.\n// 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3 >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). Each solar panel type and wind turbine type has different efficiencies, costs, and lifespans. The company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n\nThe company has a budget of $100,000 for this project. At least 30% of the budget must be spent on solar panels. The total number of wind turbines must not exceed 20. The number of Solar1 panels must be at least twice the number of Solar5 panels. The total energy output must be at least 50,000 kWh per year.\n\nPlease help the company determine the optimal number of each type of solar panel and wind turbine to install to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\nEnergy = 0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3\nCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000)\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000)\nmodel.addCons(Wind1 + Wind2 + Wind3 <= 20)\nmodel.addCons(Solar1 >= 2 * Solar5)\nmodel.addCons(0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3 >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month. Additionally, the company must decide on the number of shifts to operate for each device's production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceD\": \"ShiftsD\", \"range\": \"ShiftsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company aims to maximize the total profit minus the total cost of shifts.\n// Total profit for DeviceA: ProfitA = 50 * UnitsA\n// Total profit for DeviceB: ProfitB = 70 * UnitsB\n// Total profit for DeviceC: ProfitC = 90 * UnitsC\n// Total profit for DeviceD: ProfitD = 110 * UnitsD\n// Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n// Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for shift operations.\n// 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month and the number of shifts to operate for each device's production line.\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company has a total budget of $100,000 for shift operations.\nPlease help the company to maximize the total profit minus the total cost of shifts.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of DeviceD\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for DeviceA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for DeviceB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for DeviceC\nShiftsD = model.addVar(vtype=\"INTEGER\", name=\"ShiftsD\", lb=0) # number of shifts for DeviceD\n\n# Define objective function\n## Total profit for DeviceA: ProfitA = 50 * UnitsA\n## Total profit for DeviceB: ProfitB = 70 * UnitsB\n## Total profit for DeviceC: ProfitC = 90 * UnitsC\n## Total profit for DeviceD: ProfitD = 110 * UnitsD\n## Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n## Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\nProfitA = 50 * UnitsA\nProfitB = 70 * UnitsB\nProfitC = 90 * UnitsC\nProfitD = 110 * UnitsD\nCostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\nmodel.addCons(UnitsA == 10 * ShiftsA)\nmodel.addCons(UnitsB == 12 * ShiftsB)\nmodel.addCons(UnitsC == 15 * ShiftsC)\nmodel.addCons(UnitsD == 18 * ShiftsD)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n# Add constraints\n## The company has a total budget of $100,000 for shift operations.\nmodel.addCons(1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Units of DeviceD: \", model.getVal(UnitsD))\n    print(\"Number of Shifts for DeviceA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for DeviceB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for DeviceC: \", model.getVal(ShiftsC))\n    print(\"Number of Shifts for DeviceD: \", model.getVal(ShiftsD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. Additionally, they need to determine the number of drivers to hire for each type of cargo.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy equipment\": \"HeavyEquipmentTrucks\", \"range\": \"HeavyEquipmentTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousMaterialsTrucks\", \"range\": \"HazardousMaterialsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general cargo\": \"GeneralCargoTrucks\", \"range\": \"GeneralCargoTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for perishable goods\": \"PerishableDrivers\", \"range\": \"PerishableDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for heavy equipment\": \"HeavyEquipmentDrivers\", \"range\": \"HeavyEquipmentDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for hazardous materials\": \"HazardousMaterialsDrivers\", \"range\": \"HazardousMaterialsDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for general cargo\": \"GeneralCargoDrivers\", \"range\": \"GeneralCargoDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a truck for perishable goods is $100,000, and the revenue per truck is $150,000. The cost of a truck for heavy equipment is $120,000, and the revenue per truck is $180,000. The cost of a truck for hazardous materials is $150,000, and the revenue per truck is $200,000. The cost of a truck for general cargo is $90,000, and the revenue per truck is $130,000. The salary of a driver is $50,000 per year. The company wants to maximize the net profit per truck, considering both the revenue and the cost of drivers.\n// Net profit for perishable goods: Profit_Perishable = (150,000 - 100,000 - 50,000) * PerishableTrucks\n// Net profit for heavy equipment: Profit_HeavyEquipment = (180,000 - 120,000 - 50,000) * HeavyEquipmentTrucks\n// Net profit for hazardous materials: Profit_HazardousMaterials = (200,000 - 150,000 - 50,000) * HazardousMaterialsTrucks\n// Net profit for general cargo: Profit_GeneralCargo = (130,000 - 90,000 - 50,000) * GeneralCargoTrucks\n// So, the objective function is: Maximize (Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo) / (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing trucks.\n// 100,000 * PerishableTrucks + 120,000 * HeavyEquipmentTrucks + 150,000 * HazardousMaterialsTrucks + 90,000 * GeneralCargoTrucks <= 5,000,000\n\n## Generate Constraint-2:\nThe company can hire up to 100 drivers in total.\n// PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100\n\n## Generate Constraint-3:\nAt least 20% of the trucks must be allocated to hazardous materials due to safety regulations.\n// HazardousMaterialsTrucks >= 0.2 * (PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks)",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks and drivers to allocate for each of the four types of cargo they transport: perishable goods, heavy equipment, hazardous materials, and general cargo. The cost, revenue per truck, and driver salary for each type of cargo are given in the following Table.\n\n| Cargo Type            | Cost per Truck | Revenue per Truck | Driver Salary |\n|-----------------------|----------------|-------------------|---------------|\n| Perishable Goods      | $100,000       | $150,000          | $50,000       |\n| Heavy Equipment       | $120,000       | $180,000          | $50,000       |\n| Hazardous Materials   | $150,000       | $200,000          | $50,000       |\n| General Cargo         | $90,000        | $130,000          | $50,000       |\n\nThe company has a budget of $5,000,000 for purchasing trucks. They can hire up to 100 drivers in total. Due to safety regulations, at least 20% of the trucks must be allocated to hazardous materials. The company wants to maximize the net profit per truck, considering both the revenue and the cost of drivers.\n\nPlease help the company determine the optimal number of trucks and drivers for each type of cargo to maximize their net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nHeavyEquipmentTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentTrucks\", lb=0)\nHazardousMaterialsTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsTrucks\", lb=0)\nGeneralCargoTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoTrucks\", lb=0)\nPerishableDrivers = model.addVar(vtype=\"INTEGER\", name=\"PerishableDrivers\", lb=0)\nHeavyEquipmentDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyEquipmentDrivers\", lb=0)\nHazardousMaterialsDrivers = model.addVar(vtype=\"INTEGER\", name=\"HazardousMaterialsDrivers\", lb=0)\nGeneralCargoDrivers = model.addVar(vtype=\"INTEGER\", name=\"GeneralCargoDrivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Perishable = (150000 - 100000 - 50000) * PerishableTrucks\nProfit_HeavyEquipment = (180000 - 120000 - 50000) * HeavyEquipmentTrucks\nProfit_HazardousMaterials = (200000 - 150000 - 50000) * HazardousMaterialsTrucks\nProfit_GeneralCargo = (130000 - 90000 - 50000) * GeneralCargoTrucks\nTotalTrucks = PerishableTrucks + HeavyEquipmentTrucks + HazardousMaterialsTrucks + GeneralCargoTrucks\n## the objective function is: Maximize (Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_Perishable + Profit_HeavyEquipment + Profit_HazardousMaterials + Profit_GeneralCargo)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing trucks.\nmodel.addCons(100000 * PerishableTrucks + 120000 * HeavyEquipmentTrucks + 150000 * HazardousMaterialsTrucks + 90000 * GeneralCargoTrucks <= 5000000)\n## The company can hire up to 100 drivers in total.\nmodel.addCons(PerishableDrivers + HeavyEquipmentDrivers + HazardousMaterialsDrivers + GeneralCargoDrivers <= 100)\n## At least 20% of the trucks must be allocated to hazardous materials due to safety regulations.\nmodel.addCons(HazardousMaterialsTrucks >= 0.2 * TotalTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Equipment: \", model.getVal(HeavyEquipmentTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousMaterialsTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralCargoTrucks))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to optimize its profit. Additionally, the company can invest in research and development (R&D) for each device to potentially increase its market value.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for DeviceA\": \"RDA\", \"range\": \"RDA >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceB\": \"RDB\", \"range\": \"RDB >= 0\", \"type\": \"real\"}\n// {\"R&D investment for DeviceC\": \"RDC\", \"range\": \"RDC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $500, for DeviceB is $700, and for DeviceC is $600. The R&D investment increases the profit per unit by a factor of (1 + R&D investment / 1000). The company aims to maximize the total profit from selling all devices.\n// Total profit for DeviceA: ProfitA = UnitsA * (500 * (1 + RDA / 1000))\n// Total profit for DeviceB: ProfitB = UnitsB * (700 * (1 + RDB / 1000))\n// Total profit for DeviceC: ProfitC = UnitsC * (600 * (1 + RDC / 1000))\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for R&D investments.\n// RDA + RDB + RDC <= 500,000\n\n## Generate Constraint-2:\nThe production capacity for the quarter is limited to 10,000 units in total.\n// UnitsA + UnitsB + UnitsC <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-4:\nThe company must produce at least 1,000 units of DeviceC to fulfill a contract.\n// UnitsC >= 1,000\n\n## Generate Constraint-5:\nThe R&D investment for each device must not exceed 10% of the total production cost of that device.\n// RDA <= 0.1 * (500 * UnitsA); RDB <= 0.1 * (700 * UnitsB); RDC <= 0.1 * (600 * UnitsC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device and the amount to invest in research and development (R&D) for each device to optimize its profit. The profit per unit for each device and the effect of R&D investment on the profit per unit are given in the following Table.\n\n| Device | Profit per Unit | R&D Effect on Profit |\n|--------|-----------------|----------------------|\n| DeviceA | $500           | (1 + RDA / 1000)     |\n| DeviceB | $700           | (1 + RDB / 1000)     |\n| DeviceC | $600           | (1 + RDC / 1000)     |\n\nThe company has a total budget of $500,000 for R&D investments. The production capacity for the quarter is limited to 10,000 units in total. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company must produce at least 1,000 units of DeviceC to fulfill a contract. The R&D investment for each device must not exceed 10% of the total production cost of that device.\n\nPlease help the company to maximize the total profit from selling all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=1000)  # number of units of DeviceC\nRDA = model.addVar(vtype=\"CONTINUOUS\", name=\"RDA\", lb=0)  # R&D investment for DeviceA\nRDB = model.addVar(vtype=\"CONTINUOUS\", name=\"RDB\", lb=0)  # R&D investment for DeviceB\nRDC = model.addVar(vtype=\"CONTINUOUS\", name=\"RDC\", lb=0)  # R&D investment for DeviceC\n\n# Define objective function\nProfitA = UnitsA * (500 * (1 + RDA / 1000))\nProfitB = UnitsB * (700 * (1 + RDB / 1000))\nProfitC = UnitsC * (600 * (1 + RDC / 1000))\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RDA + RDB + RDC <= 500000)  # Total budget for R&D investments\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)  # Production capacity constraint\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Market demand constraint for DeviceA\nmodel.addCons(UnitsC >= 1000)  # Contract requirement for DeviceC\nmodel.addCons(RDA <= 0.1 * (500 * UnitsA))  # R&D investment limit for DeviceA\nmodel.addCons(RDB <= 0.1 * (700 * UnitsB))  # R&D investment limit for DeviceB\nmodel.addCons(RDC <= 0.1 * (600 * UnitsC))  # R&D investment limit for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"R&D Investment for DeviceA: \", model.getVal(RDA))\n    print(\"R&D Investment for DeviceB: \", model.getVal(RDB))\n    print(\"R&D Investment for DeviceC: \", model.getVal(RDC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Solar1, the cost per unit is $1000, the energy output is 100 kWh, and the maintenance cost is $50 per year.\nFor Solar2, the cost per unit is $1200, the energy output is 120 kWh, and the maintenance cost is $60 per year.\nFor Solar3, the cost per unit is $1500, the energy output is 150 kWh, and the maintenance cost is $75 per year.\nFor Solar4, the cost per unit is $1800, the energy output is 180 kWh, and the maintenance cost is $90 per year.\nFor Solar5, the cost per unit is $2000, the energy output is 200 kWh, and the maintenance cost is $100 per year.\nFor Wind1, the cost per unit is $2500, the energy output is 250 kWh, and the maintenance cost is $125 per year.\nFor Wind2, the cost per unit is $3000, the energy output is 300 kWh, and the maintenance cost is $150 per year.\nFor Wind3, the cost per unit is $3500, the energy output is 350 kWh, and the maintenance cost is $175 per year.\nThe company wants to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output.\n// Initial Investment Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\n// Annual Maintenance Cost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\n// Total Energy Output = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n// So, the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3 <= 100000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3)\n\n## Generate Constraint-3:\nThe company wants to generate at least 10,000 kWh of energy.\n// 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3 >= 10000\n\n## Generate Constraint-4:\nNo more than 30% of the total energy output can come from any single type of solar panel or wind turbine.\n// 100 * Solar1 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 120 * Solar2 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 150 * Solar3 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 180 * Solar4 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 200 * Solar5 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 250 * Wind1 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 300 * Wind2 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)\n// 350 * Wind3 <= 0.3 * (100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3). The company wants to minimize the Total Cost of Ownership (TCO), which is the sum of the initial investment cost plus the annual maintenance cost, divided by the total energy output. The cost per unit, energy output, and annual maintenance cost for each type of solar panel and wind turbine are given in the following Table.\n\n| Type       | Cost per Unit | Energy Output | Annual Maintenance Cost |\n|------------|---------------|---------------|-------------------------|\n| Solar1     | $1000         | 100 kWh       | $50                     |\n| Solar2     | $1200         | 120 kWh       | $60                     |\n| Solar3     | $1500         | 150 kWh       | $75                     |\n| Solar4     | $1800         | 180 kWh       | $90                     |\n| Solar5     | $2000         | 200 kWh       | $100                    |\n| Wind1      | $2500         | 250 kWh       | $125                    |\n| Wind2      | $3000         | 300 kWh       | $150                    |\n| Wind3      | $3500         | 350 kWh       | $175                    |\n\nThe company has a budget of $100,000 for the initial investment. The company wants to ensure that at least 50% of the budget is spent on solar panels. The company wants to generate at least 10,000 kWh of energy. Additionally, no more than 30% of the total energy output can come from any single type of solar panel or wind turbine.\n\nPlease help the company determine the optimal number of each type of solar panel and wind turbine to install to minimize the Total Cost of Ownership (TCO) while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialInvestmentCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 + 2500 * Wind1 + 3000 * Wind2 + 3500 * Wind3\nAnnualMaintenanceCost = 50 * Solar1 + 60 * Solar2 + 75 * Solar3 + 90 * Solar4 + 100 * Solar5 + 125 * Wind1 + 150 * Wind2 + 175 * Wind3\nTotalEnergyOutput = 100 * Solar1 + 120 * Solar2 + 150 * Solar3 + 180 * Solar4 + 200 * Solar5 + 250 * Wind1 + 300 * Wind2 + 350 * Wind3\n## the objective function is: Minimize (Initial Investment Cost + Annual Maintenance Cost) / Total Energy Output\n## convert the division to multiplication\nmodel.addCons(obj * TotalEnergyOutput == InitialInvestmentCost + AnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for the initial investment.\nmodel.addCons(InitialInvestmentCost <= 100000)\n## The company wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 1800 * Solar4 + 2000 * Solar5 >= 0.5 * (InitialInvestmentCost))\n## The company wants to generate at least 10,000 kWh of energy.\nmodel.addCons(TotalEnergyOutput >= 10000)\n## No more than 30% of the total energy output can come from any single type of solar panel or wind turbine.\nmodel.addCons(100 * Solar1 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(120 * Solar2 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(150 * Solar3 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(180 * Solar4 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(200 * Solar5 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(250 * Wind1 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(300 * Wind2 <= 0.3 * TotalEnergyOutput)\nmodel.addCons(350 * Wind3 <= 0.3 * TotalEnergyOutput)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Minimized TCO: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1841,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: E1, E2, and E3, and two types of accessories: A1 and A2. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of A1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of A2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the selling price is $100, the production cost is $50, and the production time is 1 hour. \nFor E2, the selling price is $150, the production cost is $75, and the production time is 2 hours. \nFor E3, the selling price is $200, the production cost is $100, and the production time is 3 hours.\nFor A1, the selling price is $30, the production cost is $15, and the production time is 0.5 hours.\nFor A2, the selling price is $40, the production cost is $20, and the production time is 0.75 hours.\nThe company has a limited production capacity and aims to maximize the profit per hour of production time.\n// Profit_E1 = (100 - 50) * E1\n// Profit_E2 = (150 - 75) * E2\n// Profit_E3 = (200 - 100) * E3\n// Profit_A1 = (30 - 15) * A1\n// Profit_A2 = (40 - 20) * A2\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_A1 + Profit_A2) / (E1 + 2 * E2 + 3 * E3 + 0.5 * A1 + 0.75 * A2)\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// E1 + 2 * E2 + 3 * E3 + 0.5 * A1 + 0.75 * A2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $15000 for production costs.\n// 50 * E1 + 75 * E2 + 100 * E3 + 15 * A1 + 20 * A2 <= 15000",
        "question": "A manufacturing company produces three types of electronic devices: E1, E2, and E3, and two types of accessories: A1 and A2. The company needs to decide how many units of each product to produce to optimize their profit. The selling price, production cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost | Production Time |\n|---------|---------------|-----------------|-----------------|\n| E1      | 100$          | 50$             | 1 hour          |\n| E2      | 150$          | 75$             | 2 hours         |\n| E3      | 200$          | 100$            | 3 hours         |\n| A1      | 30$           | 15$             | 0.5 hours       |\n| A2      | 40$           | 20$             | 0.75 hours      |\n\nThe company has a total production time of 200 hours. The company also has a budget of $15000 for production costs. The company aims to maximize the profit per hour of production time. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0) # quantity of A1\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0) # quantity of A2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (100 - 50) * E1\nProfit_E2 = (150 - 75) * E2\nProfit_E3 = (200 - 100) * E3\nProfit_A1 = (30 - 15) * A1\nProfit_A2 = (40 - 20) * A2\nProductionTime = E1 + 2 * E2 + 3 * E3 + 0.5 * A1 + 0.75 * A2\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_A1 + Profit_A2) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3 + Profit_A1 + Profit_A2)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(E1 + 2 * E2 + 3 * E3 + 0.5 * A1 + 0.75 * A2 <= 200)\n## The company has a budget of $15000 for production costs.\nmodel.addCons(50 * E1 + 75 * E2 + 100 * E3 + 15 * A1 + 20 * A2 <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Quantity of A1: \", model.getVal(A1))\n    print(\"Quantity of A2: \", model.getVal(A2))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $50, the material cost is $20, and the production time is 1 hour.\nFor Device B, the selling price is $70, the material cost is $30, and the production time is 2 hours.\nFor Device C, the selling price is $90, the material cost is $40, and the production time is 3 hours.\nFor Device D, the selling price is $110, the material cost is $50, and the production time is 4 hours.\nThe manufacturer aims to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (1 * A + 2 * B + 3 * C + 4 * D)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $15,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 15000",
        "question": "A manufacturer produces four types of electronic devices: A, B, C, and D. The manufacturer needs to determine how many units of each device to produce in the next quarter to optimize their profit margin.\nFor Device A, the selling price is $50, the material cost is $20, and the production time is 1 hour.\nFor Device B, the selling price is $70, the material cost is $30, and the production time is 2 hours.\nFor Device C, the selling price is $90, the material cost is $40, and the production time is 3 hours.\nFor Device D, the selling price is $110, the material cost is $50, and the production time is 4 hours.\nThe manufacturer has a budget of $15,000 for material costs for the next quarter.\nPlease help the manufacturer to maximize the profit per hour of production (which is defined as the sum of the profits divided by the sum of the production times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The manufacturer has a budget of $15,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for GoodsX trucks\": \"FuelOptX\", \"range\": \"FuelOptX >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsY trucks\": \"FuelOptY\", \"range\": \"FuelOptY >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for GoodsZ trucks\": \"FuelOptZ\", \"range\": \"FuelOptZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n// Operational cost for GoodsX: CostX = (1000 - 0.5 * FuelOptX) * TrucksX\n// Operational cost for GoodsY: CostY = (1200 - 0.6 * FuelOptY) * TrucksY\n// Operational cost for GoodsZ: CostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and truck operations.\n// FuelOptX + FuelOptY + FuelOptZ + (1000 * TrucksX) + (1200 * TrucksY) + (1500 * TrucksZ) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 100.\n// TrucksX + TrucksY + TrucksZ <= 100\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must allocate at least 20 trucks for GoodsX and 30 trucks for GoodsY.\n// TrucksX >= 20; TrucksY >= 30\n\n## Generate Constraint-4:\nThe fuel optimization for each type of goods must not exceed $10,000.\n// FuelOptX <= 10000; FuelOptY <= 10000; FuelOptZ <= 10000",
        "question": "A logistics company is managing the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of goods and the amount of fuel to optimize for each truck type. The fuel optimization affects the operational cost and the delivery speed of each truck. The operational cost of each truck is affected by the level of fuel optimization. For every $100 invested in fuel optimization for GoodsX, the operational cost per truck decreases by $50. For GoodsY, the cost decreases by $60 per truck, and for GoodsZ, it decreases by $70 per truck. The company aims to minimize the total operational cost while ensuring timely deliveries.\n\n| Goods Type | Operational Cost per Truck | Fuel Optimization Impact |\n|------------|-----------------------------|--------------------------|\n| GoodsX     | 1000 - 0.5 * FuelOptX       | $50 per $100 invested    |\n| GoodsY     | 1200 - 0.6 * FuelOptY       | $60 per $100 invested    |\n| GoodsZ     | 1500 - 0.7 * FuelOptZ       | $70 per $100 invested    |\n\nThe company has a total budget of $100,000 for fuel optimization and truck operations. The total number of trucks available for distribution is limited to 100. Due to contractual agreements, the company must allocate at least 20 trucks for GoodsX and 30 trucks for GoodsY. The fuel optimization for each type of goods must not exceed $10,000.\n\nPlease help the company to minimize the total operational cost while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=20) # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=30) # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0) # number of trucks for GoodsZ\nFuelOptX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptX\", lb=0) # fuel optimization for GoodsX trucks\nFuelOptY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptY\", lb=0) # fuel optimization for GoodsY trucks\nFuelOptZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptZ\", lb=0) # fuel optimization for GoodsZ trucks\n\n# Define objective function\nCostX = (1000 - 0.5 * FuelOptX) * TrucksX\nCostY = (1200 - 0.6 * FuelOptY) * TrucksY\nCostZ = (1500 - 0.7 * FuelOptZ) * TrucksZ\n# So, the objective function is: Minimize (CostX + CostY + CostZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for fuel optimization and truck operations.\nmodel.addCons(FuelOptX + FuelOptY + FuelOptZ + 1000 * TrucksX + 1200 * TrucksY + 1500 * TrucksZ <= 100000)\n# The total number of trucks available for distribution is limited to 100.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 100)\n# The fuel optimization for each type of goods must not exceed $10,000.\nmodel.addCons(FuelOptX <= 10000)\nmodel.addCons(FuelOptY <= 10000)\nmodel.addCons(FuelOptZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Fuel Optimization for GoodsX Trucks: \", model.getVal(FuelOptX))\n    print(\"Fuel Optimization for GoodsY Trucks: \", model.getVal(FuelOptY))\n    print(\"Fuel Optimization for GoodsZ Trucks: \", model.getVal(FuelOptZ))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1508,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD_Units\", \"range\": \"DeviceD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: Cost_DeviceA = 20 * sqrt(DeviceA_Units), Cost_DeviceB = 30 * sqrt(DeviceB_Units), Cost_DeviceC = 40 * sqrt(DeviceC_Units), Cost_DeviceD = 50 * sqrt(DeviceD_Units). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 * sqrt(DeviceA_Units)) * DeviceA_Units\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 * sqrt(DeviceB_Units)) * DeviceB_Units\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 * sqrt(DeviceC_Units)) * DeviceC_Units\n// Total net profit for DeviceD: Profit_DeviceD = (110 - 50 * sqrt(DeviceD_Units)) * DeviceD_Units\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for each device and the production cost function, which increases nonlinearly with the number of units produced, are given in the following Table.\n\n| Device    | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| DeviceA   | $50             | 20 * sqrt(DeviceA_Units) |\n| DeviceB   | $70             | 30 * sqrt(DeviceB_Units) |\n| DeviceC   | $90             | 40 * sqrt(DeviceC_Units) |\n| DeviceD   | $110            | 50 * sqrt(DeviceD_Units) |\n\nThe company has a total production capacity of 1000 units per month. Please help the company to maximize the total net profit, considering the nonlinear production cost functions for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)\nDeviceD_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Units\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for each device\nProfit_DeviceA = (50 - 20 * pyscipopt.sqrt(DeviceA_Units)) * DeviceA_Units\nProfit_DeviceB = (70 - 30 * pyscipopt.sqrt(DeviceB_Units)) * DeviceB_Units\nProfit_DeviceC = (90 - 40 * pyscipopt.sqrt(DeviceC_Units)) * DeviceC_Units\nProfit_DeviceD = (110 - 50 * pyscipopt.sqrt(DeviceD_Units)) * DeviceD_Units\n\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceD_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route1\": \"Additive1\", \"range\": \"Additive1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route2\": \"Additive2\", \"range\": \"Additive2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes.\n// Fuel cost on Route1: Cost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\n// Fuel cost on Route2: Cost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe total number of trucks available for both routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe budget for fuel additives is limited to $1000.\n// Additive1 + Additive2 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h.\n// Speed1 <= 50\n\n## Generate Constraint-4:\nThe demand for goods requires at least 10 trucks to be assigned to Route2.\n// Trucks2 >= 10",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency. The fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes.\n\n| Variable                | Route 1 | Route 2 |\n|-------------------------|---------|---------|\n| Number of Trucks        | Trucks1 | Trucks2 |\n| Speed of Trucks (km/h)  | Speed1  | Speed2  |\n| Amount of Fuel Additive | Additive1 | Additive2 |\n\nThe total number of trucks available for both routes is limited to 50. The budget for fuel additives is limited to $1000. Due to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h. The demand for goods requires at least 10 trucks to be assigned to Route2.\n\nPlease help the company to minimize the total fuel cost across both routes, considering the constraints provided.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10)  # number of trucks on Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route2\nAdditive1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive1\", lb=0)  # amount of fuel additive used on Route1\nAdditive2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive2\", lb=0)  # amount of fuel additive used on Route2\n\n# Define objective function\nCost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\nCost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons(Additive1 + Additive2 <= 1000)\nmodel.addCons(Speed1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks on Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route2: \", model.getVal(Speed2))\n    print(\"Amount of Additive on Route1: \", model.getVal(Additive1))\n    print(\"Amount of Additive on Route2: \", model.getVal(Additive2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck has an operational cost of $100 per day and can carry 10 tons of cargo. Each Medium truck costs $150 per day and carries 20 tons. Each Large truck costs $200 per day and carries 30 tons. Each Extra-Large truck costs $250 per day and carries 40 tons. Each Refrigerated truck costs $300 per day and carries 25 tons. The company needs to transport at least 500 tons of cargo daily. The objective is to minimize the total daily operational cost while meeting the cargo requirement.\n// Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\n// Total capacity = 10 * S + 20 * M + 30 * L + 40 * XL + 25 * R\n// The objective function is: Minimize (100 * S + 150 * M + 200 * L + 250 * XL + 300 * R) subject to the constraint that Total capacity >= 500\n\n## Generate Constraint-1:\nThe company has a budget constraint of $5000 per day for all truck operations.\n// 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000\n\n## Generate Constraint-2:\nThe company has a limit on the number of trucks it can operate. Specifically, it can operate a maximum of 20 Small trucks, 15 Medium trucks, 10 Large trucks, 8 Extra-Large trucks, and 5 Refrigerated trucks.\n// S <= 20; M <= 15; L <= 10; XL <= 8; R <= 5\n\n## Generate Constraint-3:\nThe total number of trucks operated should not exceed 40 to maintain operational efficiency.\n// S + M + L + XL + R <= 40",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs. Each Small truck has an operational cost of $100 per day and can carry 10 tons of cargo. Each Medium truck costs $150 per day and carries 20 tons. Each Large truck costs $200 per day and carries 30 tons. Each Extra-Large truck costs $250 per day and carries 40 tons. Each Refrigerated truck costs $300 per day and carries 25 tons. The company needs to transport at least 500 tons of cargo daily. The company has a budget constraint of $5000 per day for all truck operations. The company can operate a maximum of 20 Small trucks, 15 Medium trucks, 10 Large trucks, 8 Extra-Large trucks, and 5 Refrigerated trucks. The total number of trucks operated should not exceed 40 to maintain operational efficiency. Please help the company to minimize the total daily operational cost while meeting the cargo requirement.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R\nmodel.addCons(obj == 100 * S + 150 * M + 200 * L + 250 * XL + 300 * R)\n\n# Add constraints\n## The company has a budget constraint of $5000 per day for all truck operations.\nmodel.addCons(100 * S + 150 * M + 200 * L + 250 * XL + 300 * R <= 5000)\n## The company has a limit on the number of trucks it can operate.\nmodel.addCons(S <= 20)\nmodel.addCons(M <= 15)\nmodel.addCons(L <= 10)\nmodel.addCons(XL <= 8)\nmodel.addCons(R <= 5)\n## The total number of trucks operated should not exceed 40 to maintain operational efficiency.\nmodel.addCons(S + M + L + XL + R <= 40)\n## The company needs to transport at least 500 tons of cargo daily.\nmodel.addCons(10 * S + 20 * M + 30 * L + 40 * XL + 25 * R >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the level of maintenance for each vehicle type to optimize fuel efficiency and reduce breakdowns.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for TruckA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for TruckD\": \"MaintenanceD\", \"range\": \"MaintenanceD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost per kilometer for TruckA is $0.5, for TruckB is $0.4, for TruckC is $0.3, and for TruckD is $0.2. The maintenance cost is a nonlinear function of the maintenance level, increasing at a decreasing rate. The higher the maintenance level, the lower the probability of breakdowns and the higher the fuel efficiency.\n// Fuel cost for TruckA: FuelCostA = 0.5 * (1 + 0.01 * MaintenanceA) * TruckA\n// Fuel cost for TruckB: FuelCostB = 0.4 * (1 + 0.01 * MaintenanceB) * TruckB\n// Fuel cost for TruckC: FuelCostC = 0.3 * (1 + 0.01 * MaintenanceC) * TruckC\n// Fuel cost for TruckD: FuelCostD = 0.2 * (1 + 0.01 * MaintenanceD) * TruckD\n// Maintenance cost for TruckA: MaintenanceCostA = 100 * (MaintenanceA^2)\n// Maintenance cost for TruckB: MaintenanceCostB = 100 * (MaintenanceB^2)\n// Maintenance cost for TruckC: MaintenanceCostC = 100 * (MaintenanceC^2)\n// Maintenance cost for TruckD: MaintenanceCostD = 100 * (MaintenanceD^2)\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCostA + MaintenanceCostB + MaintenanceCostC + MaintenanceCostD)\n\n## Generate Constraint-1:\nThe total budget for vehicle acquisition and maintenance is $200,000.\n// TruckA + TruckB + TruckC + TruckD + MaintenanceA + MaintenanceB + MaintenanceC + MaintenanceD <= 200000\n\n## Generate Constraint-2:\nThe company must operate at least 10 TruckA, 15 TruckB, 20 TruckC, and 25 TruckD.\n// TruckA >= 10; TruckB >= 15; TruckC >= 20; TruckD >= 25",
        "question": "A logistics company is planning its fleet for the next quarter and operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. Each vehicle type has different fuel efficiency and cargo capacity. The company also needs to decide on the level of maintenance for each vehicle type to optimize fuel efficiency and reduce breakdowns. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost per kilometer for TruckA is $0.5, for TruckB is $0.4, for TruckC is $0.3, and for TruckD is $0.2. The maintenance cost is a nonlinear function of the maintenance level, increasing at a decreasing rate. The higher the maintenance level, the lower the probability of breakdowns and the higher the fuel efficiency. The total budget for vehicle acquisition and maintenance is $200,000. The company must operate at least 10 TruckA, 15 TruckB, 20 TruckC, and 25 TruckD.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=15)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=20)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=25)  # number of TruckD\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0)  # maintenance level for TruckA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0)  # maintenance level for TruckB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0)  # maintenance level for TruckC\nMaintenanceD = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceD\", lb=0)  # maintenance level for TruckD\n\n# Define objective function\nFuelCostA = 0.5 * (1 + 0.01 * MaintenanceA) * TruckA\nFuelCostB = 0.4 * (1 + 0.01 * MaintenanceB) * TruckB\nFuelCostC = 0.3 * (1 + 0.01 * MaintenanceC) * TruckC\nFuelCostD = 0.2 * (1 + 0.01 * MaintenanceD) * TruckD\nMaintenanceCostA = 100 * (MaintenanceA**2)\nMaintenanceCostB = 100 * (MaintenanceB**2)\nMaintenanceCostC = 100 * (MaintenanceC**2)\nMaintenanceCostD = 100 * (MaintenanceD**2)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC + FuelCostD + MaintenanceCostA + MaintenanceCostB + MaintenanceCostC + MaintenanceCostD)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + MaintenanceA + MaintenanceB + MaintenanceC + MaintenanceD <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maintenance Level for TruckA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Level for TruckB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Level for TruckC: \", model.getVal(MaintenanceC))\n    print(\"Maintenance Level for TruckD: \", model.getVal(MaintenanceD))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer.\n// {\"number of kilometers driven by Truck1\": \"Truck1Km\", \"range\": \"Truck1Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck2\": \"Truck2Km\", \"range\": \"Truck2Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck3\": \"Truck3Km\", \"range\": \"Truck3Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck4\": \"Truck4Km\", \"range\": \"Truck4Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck5\": \"Truck5Km\", \"range\": \"Truck5Km >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km.\nThe fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km.\nThe fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km.\nThe fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km.\nThe fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km.\nThe company wants to minimize the total cost of fuel and maintenance.\n// FuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\n// MaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe total distance that all trucks can cover is limited to 10,000 km.\n// Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs.\n// (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000\n\n## Generate Constraint-3:\nEach truck must cover at least 1000 km.\n// Truck1Km >= 1000\n// Truck2Km >= 1000\n// Truck3Km >= 1000\n// Truck4Km >= 1000\n// Truck5Km >= 1000\n\n## Generate Constraint-4:\nThe total maintenance cost must not exceed $3000.\n// 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km <= 3000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer. The fuel efficiency and maintenance cost for each truck are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/liter) | Maintenance Cost per km |\n|---------|---------------------------|-------------------------|\n| Truck1  | 5                         | $0.5                    |\n| Truck2  | 6                         | $0.4                    |\n| Truck3  | 7                         | $0.3                    |\n| Truck4  | 8                         | $0.2                    |\n| Truck5  | 9                         | $0.1                    |\n\nThe company wants to minimize the total cost of fuel and maintenance. The total distance that all trucks can cover is limited to 10,000 km. The company has a budget of $5000 for fuel costs. Each truck must cover at least 1000 km. The total maintenance cost must not exceed $3000.\n\nPlease help the company determine the optimal number of kilometers each truck should drive to minimize the total cost of fuel and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1Km\", lb=1000) # number of kilometers driven by Truck1\nTruck2Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2Km\", lb=1000) # number of kilometers driven by Truck2\nTruck3Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3Km\", lb=1000) # number of kilometers driven by Truck3\nTruck4Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4Km\", lb=1000) # number of kilometers driven by Truck4\nTruck5Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5Km\", lb=1000) # number of kilometers driven by Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPrice = 1  # Assuming fuel price is $1 per liter for simplicity\nFuelCost = (Truck1Km / 5) + (Truck2Km / 6) + (Truck3Km / 7) + (Truck4Km / 8) + (Truck5Km / 9)\nMaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n## the objective function is: Minimize (FuelCost + MaintenanceCost)\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The total distance that all trucks can cover is limited to 10,000 km.\nmodel.addCons(Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000)\n## The company has a budget of $5000 for fuel costs.\nmodel.addCons((Truck1Km / 5) + (Truck2Km / 6) + (Truck3Km / 7) + (Truck4Km / 8) + (Truck5Km / 9) <= 5000)\n## Each truck must cover at least 1000 km.\nmodel.addCons(Truck1Km >= 1000)\nmodel.addCons(Truck2Km >= 1000)\nmodel.addCons(Truck3Km >= 1000)\nmodel.addCons(Truck4Km >= 1000)\nmodel.addCons(Truck5Km >= 1000)\n## The total maintenance cost must not exceed $3000.\nmodel.addCons(0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of kilometers driven by Truck1: \", model.getVal(Truck1Km))\n    print(\"Number of kilometers driven by Truck2: \", model.getVal(Truck2Km))\n    print(\"Number of kilometers driven by Truck3: \", model.getVal(Truck3Km))\n    print(\"Number of kilometers driven by Truck4: \", model.getVal(Truck4Km))\n    print(\"Number of kilometers driven by Truck5: \", model.getVal(Truck5Km))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1264,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company also needs to decide on the number of trucks to allocate to each zone. Additionally, the company is considering investing in a new fleet management software that can reduce fuel consumption and maintenance costs, depending on the amount invested.\n// {\"number of trucks in Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software\": \"SoftwareInvestment\", \"range\": \"SoftwareInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost savings from the fleet management software are nonlinear and increase with the investment, but at a decreasing rate. The cost savings per truck per zone are modeled as a quadratic function of the investment. The company aims to minimize the total operational cost, which includes fuel, maintenance, and software investment costs.\n// Cost_Zone1 = (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment^2) * Trucks1\n// Cost_Zone2 = (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment^2) * Trucks2\n// Cost_Zone3 = (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment^2) * Trucks3\n// Cost_Zone4 = (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment^2) * Trucks4\n// Cost_Zone5 = (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment^2) * Trucks5\n// So, the objective function is: Minimize (Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and software investment.\n// (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment^2) * Trucks1 +\n// (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment^2) * Trucks2 +\n// (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment^2) * Trucks3 +\n// (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment^2) * Trucks4 +\n// (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment^2) * Trucks5 +\n// SoftwareInvestment <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available in the fleet is 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company also needs to decide on the number of trucks to allocate to each zone and consider investing in a new fleet management software that can reduce fuel consumption and maintenance costs, depending on the amount invested. The cost savings from the fleet management software are nonlinear and increase with the investment, but at a decreasing rate. The cost savings per truck per zone are modeled as a quadratic function of the investment. The company aims to minimize the total operational cost, which includes fuel, maintenance, and software investment costs. The company has a total budget of $100,000 for operational costs and software investment. The total number of trucks available in the fleet is 100.\n\nPlease help the company to minimize the total operational cost, which includes the costs for each zone and the investment in the fleet management software.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks in Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks in Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks in Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks in Zone5\nSoftwareInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareInvestment\", lb=0) # investment in fleet management software\n\n# Define objective function\nCost_Zone1 = (1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment**2) * Trucks1\nCost_Zone2 = (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment**2) * Trucks2\nCost_Zone3 = (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment**2) * Trucks3\nCost_Zone4 = (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment**2) * Trucks4\nCost_Zone5 = (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment**2) * Trucks5\n# So, the objective function is: Minimize (Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Zone1 + Cost_Zone2 + Cost_Zone3 + Cost_Zone4 + Cost_Zone5 + SoftwareInvestment)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and software investment.\nmodel.addCons((1000 + 0.01 * SoftwareInvestment - 0.0002 * SoftwareInvestment**2) * Trucks1 +\n              (1200 + 0.012 * SoftwareInvestment - 0.00024 * SoftwareInvestment**2) * Trucks2 +\n              (1100 + 0.011 * SoftwareInvestment - 0.00022 * SoftwareInvestment**2) * Trucks3 +\n              (900 + 0.009 * SoftwareInvestment - 0.00018 * SoftwareInvestment**2) * Trucks4 +\n              (1300 + 0.013 * SoftwareInvestment - 0.00026 * SoftwareInvestment**2) * Trucks5 +\n              SoftwareInvestment <= 100000)\n# The total number of trucks available in the fleet is 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Zone5: \", model.getVal(Trucks5))\n    print(\"Investment in Fleet Management Software: \", model.getVal(SoftwareInvestment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to deploy for each of its three main routes: RouteA, RouteB, and RouteC. Additionally, the company is considering investing in fuel-efficient technologies for its trucks, which will reduce fuel consumption per kilometer but at a cost.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in technology. For every $1000 invested in technology for RouteA, fuel consumption decreases by 10 liters per 1000 km. For RouteB, every $1000 investment decreases fuel consumption by 12 liters per 1000 km. For RouteC, every $1000 investment decreases fuel consumption by 8 liters per 1000 km. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate.\n// Fuel cost for RouteA: CostA = (1000 / (1 + 0.001 * TechA)) * TrucksA\n// Fuel cost for RouteB: CostB = (1200 / (1 + 0.0012 * TechB)) * TrucksB\n// Fuel cost for RouteC: CostC = (800 / (1 + 0.0008 * TechC)) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for both truck deployment and technology investments.\n// 1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks deployed across all routes must not exceed 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nAt least 30 trucks must be deployed for RouteA, and at least 25 trucks for RouteB.\n// TrucksA >= 30; TrucksB >= 25\n\n## Generate Constraint-4:\nThe investment in technology for any single route must not exceed $20,000.\n// TechA <= 20000; TechB <= 20000; TechC <= 20000",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to deploy for each of its three main routes: RouteA, RouteB, and RouteC. Additionally, the company is considering investing in fuel-efficient technologies for its trucks, which will reduce fuel consumption per kilometer but at a cost. The fuel efficiency of each route improves with the investment in technology. For every $1000 invested in technology for RouteA, fuel consumption decreases by 10 liters per 1000 km. For RouteB, every $1000 investment decreases fuel consumption by 12 liters per 1000 km. For RouteC, every $1000 investment decreases fuel consumption by 8 liters per 1000 km. The company aims to minimize the total fuel cost, which is a nonlinear function of the number of trucks and the fuel consumption rate. The company has a budget of $100,000 for both truck deployment and technology investments. The total number of trucks deployed across all routes must not exceed 100. At least 30 trucks must be deployed for RouteA, and at least 25 trucks for RouteB. The investment in technology for any single route must not exceed $20,000. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=30)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=25)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)    # number of trucks for RouteC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)    # investment in fuel-efficient technology for RouteA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)    # investment in fuel-efficient technology for RouteB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)    # investment in fuel-efficient technology for RouteC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostA = (1000 / (1 + 0.001 * TechA)) * TrucksA\nCostB = (1200 / (1 + 0.0012 * TechB)) * TrucksB\nCostC = (800 / (1 + 0.0008 * TechC)) * TrucksC\n## the objective function is: Minimize (CostA + CostB + CostC)\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n## The company has a budget of $100,000 for both truck deployment and technology investments.\nmodel.addCons(1000 * TrucksA + 1200 * TrucksB + 800 * TrucksC + TechA + TechB + TechC <= 100000)\n## The total number of trucks deployed across all routes must not exceed 100.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100)\n## The investment in technology for any single route must not exceed $20,000.\nmodel.addCons(TechA <= 20000)\nmodel.addCons(TechB <= 20000)\nmodel.addCons(TechC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Investment in Tech for RouteA: \", model.getVal(TechA))\n    print(\"Investment in Tech for RouteB: \", model.getVal(TechB))\n    print(\"Investment in Tech for RouteC: \", model.getVal(TechC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions.\n// Net profit for Region A: Profit_A = (1.5 - 0.5) * Trucks_A\n// Net profit for Region B: Profit_B = (1.6 - 0.6) * Trucks_B\n// Net profit for Region C: Profit_C = (1.7 - 0.7) * Trucks_C\n// Net profit for Region D: Profit_D = (1.8 - 0.8) * Trucks_D\n// Net profit for Region E: Profit_E = (1.9 - 0.9) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs. The cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions. The company has a total of 50 trucks available for allocation. Please help the company to determine the optimal allocation of trucks to each region to maximize the net profit per kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1.5 - 0.5) * Trucks_A\nProfit_B = (1.6 - 0.6) * Trucks_B\nProfit_C = (1.7 - 0.7) * Trucks_C\nProfit_D = (1.8 - 0.8) * Trucks_D\nProfit_E = (1.9 - 0.9) * Trucks_E\nTotal_Trucks = Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Total_Trucks\n## convert the division to multiplication\nmodel.addCons(obj * Total_Trucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles.\n// {\"number of vehicles on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per vehicle is $1000, the fuel cost per vehicle is $200, and the maintenance cost per vehicle is $100.\nFor Route B, the profit per vehicle is $1200, the fuel cost per vehicle is $250, and the maintenance cost per vehicle is $120.\nFor Route C, the profit per vehicle is $1500, the fuel cost per vehicle is $300, and the maintenance cost per vehicle is $150.\nFor Route D, the profit per vehicle is $1800, the fuel cost per vehicle is $350, and the maintenance cost per vehicle is $180.\nFor Route E, the profit per vehicle is $2000, the fuel cost per vehicle is $400, and the maintenance cost per vehicle is $200.\nThe company wants to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost).\n// Net_Profit_A = 1000 * RouteA - 200 * RouteA - 100 * RouteA\n// Net_Profit_B = 1200 * RouteB - 250 * RouteB - 120 * RouteB\n// Net_Profit_C = 1500 * RouteC - 300 * RouteC - 150 * RouteC\n// Net_Profit_D = 1800 * RouteD - 350 * RouteD - 180 * RouteD\n// Net_Profit_E = 2000 * RouteE - 400 * RouteE - 200 * RouteE\n// Total_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 vehicles.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $20,000 for maintenance costs.\n// 100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000\n\n## Generate Constraint-3:\nRoute A has a maximum capacity of 30 vehicles due to local regulations.\n// RouteA <= 30",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five routes (Route A, Route B, Route C, Route D, and Route E) that they can operate with different types of vehicles. The profit per vehicle, fuel cost per vehicle, and maintenance cost per vehicle for each route are given in the following Table.\n\n| Route | Profit per Vehicle | Fuel Cost per Vehicle | Maintenance Cost per Vehicle |\n|-------|--------------------|-----------------------|------------------------------|\n| A     | $1000              | $200                  | $100                         |\n| B     | $1200              | $250                  | $120                         |\n| C     | $1500              | $300                  | $150                         |\n| D     | $1800              | $350                  | $180                         |\n| E     | $2000              | $400                  | $200                         |\n\nThe company has a total fleet size of 100 vehicles. The company has a budget of $20,000 for maintenance costs. Route A has a maximum capacity of 30 vehicles due to local regulations. \n\nPlease help the company to maximize the Net Profit per Fuel Cost (Net Profit divided by the total fuel cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of vehicles on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of vehicles on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of vehicles on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of vehicles on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of vehicles on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_A = (1000 - 200 - 100) * RouteA\nNet_Profit_B = (1200 - 250 - 120) * RouteB\nNet_Profit_C = (1500 - 300 - 150) * RouteC\nNet_Profit_D = (1800 - 350 - 180) * RouteD\nNet_Profit_E = (2000 - 400 - 200) * RouteE\nTotal_Fuel_Cost = 200 * RouteA + 250 * RouteB + 300 * RouteC + 350 * RouteD + 400 * RouteE\n## the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E) / Total_Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Fuel_Cost == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\n## The company has a total fleet size of 100 vehicles.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 100)\n## The company has a budget of $20,000 for maintenance costs.\nmodel.addCons(100 * RouteA + 120 * RouteB + 150 * RouteC + 180 * RouteD + 200 * RouteE <= 20000)\n## Route A has a maximum capacity of 30 vehicles due to local regulations.\nmodel.addCons(RouteA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles on Route A: \", model.getVal(RouteA))\n    print(\"Number of Vehicles on Route B: \", model.getVal(RouteB))\n    print(\"Number of Vehicles on Route C: \", model.getVal(RouteC))\n    print(\"Number of Vehicles on Route D: \", model.getVal(RouteD))\n    print(\"Number of Vehicles on Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\n// {\"number of trucks allocated to Region A\": \"Truck_A\", \"range\": \"Truck_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region B\": \"Truck_B\", \"range\": \"Truck_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region C\": \"Truck_C\", \"range\": \"Truck_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region D\": \"Truck_D\", \"range\": \"Truck_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region E\": \"Truck_E\", \"range\": \"Truck_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company aims to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.\n// Total revenue: Revenue = $100 * Truck_A + $120 * Truck_B + $140 * Truck_C + $160 * Truck_D + $180 * Truck_E\n// Total operational cost: Cost = $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E\n// Total delivery time: Time = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n// So, the objective function is: Maximize (Revenue / (Cost + Time))\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for operational costs.\n// $500 * Truck_A + $600 * Truck_B + $700 * Truck_C + $800 * Truck_D + $900 * Truck_E <= $50000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 100 trucks in total.\n// Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to each region.\n// Truck_A >= 10; Truck_B >= 10; Truck_C >= 10; Truck_D >= 10; Truck_E >= 10\n\n## Generate Constraint-4:\nThe total delivery time across all regions should not exceed 500 hours.\n// 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E <= 500",
        "question": "A logistics company is planning its delivery routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to determine the number of trucks to allocate to each region to optimize efficiency.\nThe cost of operating a truck in Region A is $500 per day, the average delivery time is 4 hours, and the revenue per delivery is $100.\nIn Region B, the cost is $600 per day, the average delivery time is 5 hours, and the revenue per delivery is $120.\nIn Region C, the cost is $700 per day, the average delivery time is 6 hours, and the revenue per delivery is $140.\nIn Region D, the cost is $800 per day, the average delivery time is 7 hours, and the revenue per delivery is $160.\nIn Region E, the cost is $900 per day, the average delivery time is 8 hours, and the revenue per delivery is $180.\nThe company has a total budget of $50,000 for operational costs. The company can allocate a maximum of 100 trucks in total. The company must allocate at least 10 trucks to each region. The total delivery time across all regions should not exceed 500 hours.\nPlease help the company to maximize the efficiency ratio, which is defined as the total revenue generated divided by the total operational cost and delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck_A = model.addVar(vtype=\"INTEGER\", name=\"Truck_A\", lb=10) # number of trucks allocated to Region A\nTruck_B = model.addVar(vtype=\"INTEGER\", name=\"Truck_B\", lb=10) # number of trucks allocated to Region B\nTruck_C = model.addVar(vtype=\"INTEGER\", name=\"Truck_C\", lb=10) # number of trucks allocated to Region C\nTruck_D = model.addVar(vtype=\"INTEGER\", name=\"Truck_D\", lb=10) # number of trucks allocated to Region D\nTruck_E = model.addVar(vtype=\"INTEGER\", name=\"Truck_E\", lb=10) # number of trucks allocated to Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 100 * Truck_A + 120 * Truck_B + 140 * Truck_C + 160 * Truck_D + 180 * Truck_E\nCost = 500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E\nTime = 4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E\n## the objective function is: Maximize (Revenue / (Cost + Time))\n## convert the division to multiplication\nmodel.addCons(obj * (Cost + Time) == Revenue)\n\n# Add constraints\n## The company has a total budget of $50,000 for operational costs.\nmodel.addCons(500 * Truck_A + 600 * Truck_B + 700 * Truck_C + 800 * Truck_D + 900 * Truck_E <= 50000)\n## The company can allocate a maximum of 100 trucks in total.\nmodel.addCons(Truck_A + Truck_B + Truck_C + Truck_D + Truck_E <= 100)\n## The total delivery time across all regions should not exceed 500 hours.\nmodel.addCons(4 * Truck_A + 5 * Truck_B + 6 * Truck_C + 7 * Truck_D + 8 * Truck_E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Allocated to Region A: \", model.getVal(Truck_A))\n    print(\"Number of Trucks Allocated to Region B: \", model.getVal(Truck_B))\n    print(\"Number of Trucks Allocated to Region C: \", model.getVal(Truck_C))\n    print(\"Number of Trucks Allocated to Region D: \", model.getVal(Truck_D))\n    print(\"Number of Trucks Allocated to Region E: \", model.getVal(Truck_E))\n    print(\"Maximized Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas, Mid-range Apartments, and Affordable Homes. The developer needs to determine the number of each type of property to build in the upcoming project. Additionally, the developer needs to decide on the amount of green space to allocate per property type, which affects the construction cost and potential selling price.\n// {\"number of Luxury Villas\": \"Villas\", \"range\": \"Villas >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-range Apartments\": \"Apartments\", \"range\": \"Apartments >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"Homes\", \"range\": \"Homes >= 0\", \"type\": \"integer\"}\n// {\"green space per Luxury Villa\": \"GreenSpaceVilla\", \"range\": \"GreenSpaceVilla >= 0\", \"type\": \"continuous\"}\n// {\"green space per Mid-range Apartment\": \"GreenSpaceApartment\", \"range\": \"GreenSpaceApartment >= 0\", \"type\": \"continuous\"}\n// {\"green space per Affordable Home\": \"GreenSpaceHome\", \"range\": \"GreenSpaceHome >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of each property type is affected by the amount of green space allocated. For Luxury Villas, the base price is $1,000,000, and it increases by $50,000 for every additional square meter of green space. For Mid-range Apartments, the base price is $500,000, and it increases by $20,000 for every additional square meter of green space. For Affordable Homes, the base price is $200,000, and it increases by $10,000 for every additional square meter of green space. The construction cost also increases with green space, with Luxury Villas costing an additional $30,000 per square meter, Mid-range Apartments costing an additional $15,000 per square meter, and Affordable Homes costing an additional $5,000 per square meter. The developer aims to maximize the total profit from the project.\n// Total profit for Luxury Villas: ProfitVilla = (1,000,000 + 50,000 * GreenSpaceVilla) * Villas - (1,000,000 + 30,000 * GreenSpaceVilla) * Villas\n// Total profit for Mid-range Apartments: ProfitApartment = (500,000 + 20,000 * GreenSpaceApartment) * Apartments - (500,000 + 15,000 * GreenSpaceApartment) * Apartments\n// Total profit for Affordable Homes: ProfitHome = (200,000 + 10,000 * GreenSpaceHome) * Homes - (200,000 + 5,000 * GreenSpaceHome) * Homes\n// So, the objective function is: Maximize (ProfitVilla + ProfitApartment + ProfitHome)\n\n## Generate Constraint-1:\nThe total budget for the project is $100,000,000, including all construction costs and green space investments.\n// (1,000,000 + 30,000 * GreenSpaceVilla) * Villas + (500,000 + 15,000 * GreenSpaceApartment) * Apartments + (200,000 + 5,000 * GreenSpaceHome) * Homes <= 100,000,000\n\n## Generate Constraint-2:\nThe total land available for development is 100,000 square meters, and each property type requires a certain amount of land. Luxury Villas require 500 square meters each, Mid-range Apartments require 200 square meters each, and Affordable Homes require 100 square meters each.\n// 500 * Villas + 200 * Apartments + 100 * Homes <= 100,000\n\n## Generate Constraint-3:\nDue to market demand, the developer must build at least 50 Luxury Villas and 100 Affordable Homes.\n// Villas >= 50; Homes >= 100",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas, Mid-range Apartments, and Affordable Homes. The developer needs to determine the number of each type of property to build in the upcoming project and the amount of green space to allocate per property type, which affects the construction cost and potential selling price. The selling price of each property type is affected by the amount of green space allocated. For Luxury Villas, the base price is $1,000,000, and it increases by $50,000 for every additional square meter of green space. For Mid-range Apartments, the base price is $500,000, and it increases by $20,000 for every additional square meter of green space. For Affordable Homes, the base price is $200,000, and it increases by $10,000 for every additional square meter of green space. The construction cost also increases with green space, with Luxury Villas costing an additional $30,000 per square meter, Mid-range Apartments costing an additional $15,000 per square meter, and Affordable Homes costing an additional $5,000 per square meter. The developer aims to maximize the total profit from the project. The total budget for the project is $100,000,000, including all construction costs and green space investments. The total land available for development is 100,000 square meters, and each property type requires a certain amount of land. Luxury Villas require 500 square meters each, Mid-range Apartments require 200 square meters each, and Affordable Homes require 100 square meters each. Due to market demand, the developer must build at least 50 Luxury Villas and 100 Affordable Homes. Please help the developer to maximize the total profit from the project.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nVillas = model.addVar(vtype=\"INTEGER\", name=\"Villas\", lb=0)  # number of Luxury Villas\nApartments = model.addVar(vtype=\"INTEGER\", name=\"Apartments\", lb=0)  # number of Mid-range Apartments\nHomes = model.addVar(vtype=\"INTEGER\", name=\"Homes\", lb=0)  # number of Affordable Homes\nGreenSpaceVilla = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenSpaceVilla\", lb=0)  # green space per Luxury Villa\nGreenSpaceApartment = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenSpaceApartment\", lb=0)  # green space per Mid-range Apartment\nGreenSpaceHome = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenSpaceHome\", lb=0)  # green space per Affordable Home\n\n# Define objective function\nProfitVilla = (1000000 + 50000 * GreenSpaceVilla) * Villas - (1000000 + 30000 * GreenSpaceVilla) * Villas\nProfitApartment = (500000 + 20000 * GreenSpaceApartment) * Apartments - (500000 + 15000 * GreenSpaceApartment) * Apartments\nProfitHome = (200000 + 10000 * GreenSpaceHome) * Homes - (200000 + 5000 * GreenSpaceHome) * Homes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitVilla + ProfitApartment + ProfitHome)\n\n# Add constraints\nmodel.addCons((1000000 + 30000 * GreenSpaceVilla) * Villas + (500000 + 15000 * GreenSpaceApartment) * Apartments + (200000 + 5000 * GreenSpaceHome) * Homes <= 100000000)\nmodel.addCons(500 * Villas + 200 * Apartments + 100 * Homes <= 100000)\nmodel.addCons(Villas >= 50)\nmodel.addCons(Homes >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(Villas))\n    print(\"Number of Mid-range Apartments: \", model.getVal(Apartments))\n    print(\"Number of Affordable Homes: \", model.getVal(Homes))\n    print(\"Green Space per Luxury Villa: \", model.getVal(GreenSpaceVilla))\n    print(\"Green Space per Mid-range Apartment: \", model.getVal(GreenSpaceApartment))\n    print(\"Green Space per Affordable Home: \", model.getVal(GreenSpaceHome))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1735,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints.\n// {\"quantity of device 1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 4\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 5\": \"Q5\", \"range\": \"Q5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is determined by a nonlinear function of its quantity. The profit function for each device is as follows:\n- Device 1: P1 = 100 * Q1 - 0.5 * Q1^2\n- Device 2: P2 = 150 * Q2 - 0.7 * Q2^2\n- Device 3: P3 = 120 * Q3 - 0.6 * Q3^2\n- Device 4: P4 = 130 * Q4 - 0.8 * Q4^2\n- Device 5: P5 = 140 * Q5 - 0.9 * Q5^2\nThe objective is to maximize the total profit from all devices.\n// Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * Q1 - 0.5 * Q1^2) + (150 * Q2 - 0.7 * Q2^2) + (120 * Q3 - 0.6 * Q3^2) + (130 * Q4 - 0.8 * Q4^2) + (140 * Q5 - 0.9 * Q5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// Q1 + Q2 + Q3 + Q4 + Q5 <= 1000\n\n## Generate Constraint-2:\nThe production of each device must not exceed 200 units.\n// Q1 <= 200; Q2 <= 200; Q3 <= 200; Q4 <= 200; Q5 <= 200\n\n## Generate Constraint-3:\nThe demand for each device is limited. Device 1 and Device 2 must not exceed 150 units combined, and Device 3, Device 4, and Device 5 must not exceed 300 units combined.\n// Q1 + Q2 <= 150\n// Q3 + Q4 + Q5 <= 300",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints. The profit from each device is determined by a nonlinear function of its quantity, as shown in the following table:\n\n| Device | Profit Function                |\n|--------|--------------------------------|\n| 1      | P1 = 100 * Q1 - 0.5 * Q1^2     |\n| 2      | P2 = 150 * Q2 - 0.7 * Q2^2     |\n| 3      | P3 = 120 * Q3 - 0.6 * Q3^2     |\n| 4      | P4 = 130 * Q4 - 0.8 * Q4^2     |\n| 5      | P5 = 140 * Q5 - 0.9 * Q5^2     |\n\nThe objective is to maximize the total profit from all devices. The total production capacity is limited to 1000 units across all devices. The production of each device must not exceed 200 units. Additionally, the demand for each device is limited: Device 1 and Device 2 must not exceed 150 units combined, and Device 3, Device 4, and Device 5 must not exceed 300 units combined.\n\nPlease help the company determine the optimal production quantities for each device to maximize total profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=200)  # quantity of device 1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0, ub=200)  # quantity of device 2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0, ub=200)  # quantity of device 3\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0, ub=200)  # quantity of device 4\nQ5 = model.addVar(vtype=\"INTEGER\", name=\"Q5\", lb=0, ub=200)  # quantity of device 5\n\n# Define objective function\n# The profit from each device is determined by a nonlinear function of its quantity.\nP1 = 100 * Q1 - 0.5 * Q1**2\nP2 = 150 * Q2 - 0.7 * Q2**2\nP3 = 120 * Q3 - 0.6 * Q3**2\nP4 = 130 * Q4 - 0.8 * Q4**2\nP5 = 140 * Q5 - 0.9 * Q5**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# Maximize P = P1 + P2 + P3 + P4 + P5\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(Q1 + Q2 + Q3 + Q4 + Q5 <= 1000)\n\n# The production of each device must not exceed 200 units.\nmodel.addCons(Q1 <= 200)\nmodel.addCons(Q2 <= 200)\nmodel.addCons(Q3 <= 200)\nmodel.addCons(Q4 <= 200)\nmodel.addCons(Q5 <= 200)\n\n# The demand for each device is limited. Device 1 and Device 2 must not exceed 150 units combined, and Device 3, Device 4, and Device 5 must not exceed 300 units combined.\nmodel.addCons(Q1 + Q2 <= 150)\nmodel.addCons(Q3 + Q4 + Q5 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device 1: \", model.getVal(Q1))\n    print(\"Quantity of Device 2: \", model.getVal(Q2))\n    print(\"Quantity of Device 3: \", model.getVal(Q3))\n    print(\"Quantity of Device 4: \", model.getVal(Q4))\n    print(\"Quantity of Device 5: \", model.getVal(Q5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to operate for each type of power plant to maximize energy production while minimizing operational costs. Additionally, the company needs to decide on the level of investment in advanced technology for each type of power plant, which can enhance efficiency but also incurs additional costs.\n// {\"number of Solar units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production and operational costs of each power plant are affected by the investment in advanced technology. For Solar, each unit produces 100 MWh of energy without technology, increasing by 5 MWh per $1000 invested. The operational cost is $5000 per unit, decreasing by $200 for every $1000 invested.\nFor Wind, each unit produces 120 MWh without technology, increasing by 6 MWh per $1000 invested. The operational cost is $6000 per unit, decreasing by $250 for every $1000 invested.\nFor Hydro, each unit produces 150 MWh without technology, increasing by 7 MWh per $1000 invested. The operational cost is $7000 per unit, decreasing by $300 for every $1000 invested.\nThe company aims to maximize the net energy production (total energy produced minus operational costs).\n// Net energy production for Solar: NetSolar = (100 + 0.005 * SolarTechInvestment) * SolarUnits - (5000 - 0.002 * SolarTechInvestment) * SolarUnits\n// Net energy production for Wind: NetWind = (120 + 0.006 * WindTechInvestment) * WindUnits - (6000 - 0.0025 * WindTechInvestment) * WindUnits\n// Net energy production for Hydro: NetHydro = (150 + 0.007 * HydroTechInvestment) * HydroUnits - (7000 - 0.003 * HydroTechInvestment) * HydroUnits\n// So, the objective function is: Maximize (NetSolar + NetWind + NetHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and technology investments.\n// 5000 * SolarUnits + 6000 * WindUnits + 7000 * HydroUnits + SolarTechInvestment + WindTechInvestment + HydroTechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total number of power plant units that can be operated is limited to 100.\n// SolarUnits + WindUnits + HydroUnits <= 100",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to operate for each type of power plant and the level of investment in advanced technology for each type to maximize energy production while minimizing operational costs. The energy production and operational costs of each power plant, as well as the impact of technology investment, are detailed in the following Table.\n\n| Power Plant | Energy Production (MWh) without Tech | Operational Cost per Unit | Increase in Energy per $1000 Tech Investment | Decrease in Operational Cost per $1000 Tech Investment |\n|-------------|-------------------------------------|---------------------------|----------------------------------------------|-----------------------------------------------------|\n| Solar       | 100                                 | $5000                     | 5 MWh                                        | $200                                               |\n| Wind        | 120                                 | $6000                     | 6 MWh                                        | $250                                               |\n| Hydro       | 150                                 | $7000                     | 7 MWh                                        | $300                                               |\n\nThe company has a total budget of $100,000 for operational costs and technology investments. The total number of power plant units that can be operated is limited to 100. \n\nPlease help the company to maximize the net energy production (total energy produced minus operational costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)\nSolarTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarTechInvestment\", lb=0)\nWindTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindTechInvestment\", lb=0)\nHydroTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroTechInvestment\", lb=0)\n\n# Define objective function\nNetSolar = (100 + 0.005 * SolarTechInvestment) * SolarUnits - (5000 - 0.002 * SolarTechInvestment) * SolarUnits\nNetWind = (120 + 0.006 * WindTechInvestment) * WindUnits - (6000 - 0.0025 * WindTechInvestment) * WindUnits\nNetHydro = (150 + 0.007 * HydroTechInvestment) * HydroUnits - (7000 - 0.003 * HydroTechInvestment) * HydroUnits\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetSolar + NetWind + NetHydro)\n\n# Add constraints\nmodel.addCons(5000 * SolarUnits + 6000 * WindUnits + 7000 * HydroUnits + SolarTechInvestment + WindTechInvestment + HydroTechInvestment <= 100000)\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind Units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro Units: \", model.getVal(HydroUnits))\n    print(\"Investment in Advanced Technology for Solar: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in Advanced Technology for Wind: \", model.getVal(WindTechInvestment))\n    print(\"Investment in Advanced Technology for Hydro: \", model.getVal(HydroTechInvestment))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1662,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal number of units to produce for each device to maximize profit.\n// {\"number of units of device 1\": \"U1\", \"range\": \"U1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 2\": \"U2\", \"range\": \"U2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 3\": \"U3\", \"range\": \"U3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 4\": \"U4\", \"range\": \"U4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 5\": \"U5\", \"range\": \"U5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and production cost. The profit per unit for device 1 is 50 - 0.1*U1, for device 2 is 60 - 0.2*U2, for device 3 is 70 - 0.3*U3, for device 4 is 80 - 0.4*U4, and for device 5 is 90 - 0.5*U5. The company wants to maximize the total profit.\n// The objective function is: Maximize (50*U1 - 0.1*U1^2 + 60*U2 - 0.2*U2^2 + 70*U3 - 0.3*U3^2 + 80*U4 - 0.4*U4^2 + 90*U5 - 0.5*U5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// U1 + U2 + U3 + U4 + U5 <= 1000\n\n## Generate Constraint-2:\nThe demand for each device is limited. Device 1 cannot exceed 200 units, device 2 cannot exceed 180 units, device 3 cannot exceed 160 units, device 4 cannot exceed 140 units, and device 5 cannot exceed 120 units.\n// U1 <= 200; U2 <= 180; U3 <= 160; U4 <= 140; U5 <= 120",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal number of units to produce for each device to maximize profit. The profit per unit for each device is given by the following formula: for device 1, it is 50 - 0.1*U1; for device 2, it is 60 - 0.2*U2; for device 3, it is 70 - 0.3*U3; for device 4, it is 80 - 0.4*U4; and for device 5, it is 90 - 0.5*U5.\n\n| Device | Profit per Unit Formula |\n|--------|--------------------------|\n| 1      | 50 - 0.1*U1              |\n| 2      | 60 - 0.2*U2              |\n| 3      | 70 - 0.3*U3              |\n| 4      | 80 - 0.4*U4              |\n| 5      | 90 - 0.5*U5              |\n\nThe total production capacity is limited to 1000 units across all devices. The demand for each device is also limited: Device 1 cannot exceed 200 units, device 2 cannot exceed 180 units, device 3 cannot exceed 160 units, device 4 cannot exceed 140 units, and device 5 cannot exceed 120 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nU1 = model.addVar(vtype=\"INTEGER\", name=\"U1\", lb=0, ub=200)  # number of units of device 1\nU2 = model.addVar(vtype=\"INTEGER\", name=\"U2\", lb=0, ub=180)  # number of units of device 2\nU3 = model.addVar(vtype=\"INTEGER\", name=\"U3\", lb=0, ub=160)  # number of units of device 3\nU4 = model.addVar(vtype=\"INTEGER\", name=\"U4\", lb=0, ub=140)  # number of units of device 4\nU5 = model.addVar(vtype=\"INTEGER\", name=\"U5\", lb=0, ub=120)  # number of units of device 5\n\n# Define objective function\n# The objective function is: Maximize (50*U1 - 0.1*U1^2 + 60*U2 - 0.2*U2^2 + 70*U3 - 0.3*U3^2 + 80*U4 - 0.4*U4^2 + 90*U5 - 0.5*U5^2)\n# Convert quadratic terms to linear terms by introducing new variables\nU1_sq = model.addVar(vtype=\"INTEGER\", name=\"U1_sq\")\nU2_sq = model.addVar(vtype=\"INTEGER\", name=\"U2_sq\")\nU3_sq = model.addVar(vtype=\"INTEGER\", name=\"U3_sq\")\nU4_sq = model.addVar(vtype=\"INTEGER\", name=\"U4_sq\")\nU5_sq = model.addVar(vtype=\"INTEGER\", name=\"U5_sq\")\nmodel.addCons(U1_sq == U1 * U1)\nmodel.addCons(U2_sq == U2 * U2)\nmodel.addCons(U3_sq == U3 * U3)\nmodel.addCons(U4_sq == U4 * U4)\nmodel.addCons(U5_sq == U5 * U5)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*U1 - 0.1*U1_sq + 60*U2 - 0.2*U2_sq + 70*U3 - 0.3*U3_sq + 80*U4 - 0.4*U4_sq + 90*U5 - 0.5*U5_sq)\n\n# Add constraints\nmodel.addCons(U1 + U2 + U3 + U4 + U5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(U1))\n    print(\"Number of Device 2: \", model.getVal(U2))\n    print(\"Number of Device 3: \", model.getVal(U3))\n    print(\"Number of Device 4: \", model.getVal(U4))\n    print(\"Number of Device 5: \", model.getVal(U5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, DrugB as 70 * DosageB - 0.4 * DosageB^2, and DrugC as 90 * DosageC - 0.3 * DosageC^2. The side effects are modeled as 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2. The company wants to maximize the net therapeutic effect (therapeutic effect - side effects).\n// Therapeutic_Effect = (50 * DosageA - 0.5 * DosageA^2) + (70 * DosageB - 0.4 * DosageB^2) + (90 * DosageC - 0.3 * DosageC^2)\n// Side_Effects = 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2\n// So, the objective function is: Maximize (Therapeutic_Effect - Side_Effects)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DosageA + DosageB + DosageC <= 300",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range: 0 <= DosageA <= 100 for DrugA, 0 <= DosageB <= 150 for DrugB, and 0 <= DosageC <= 200 for DrugC.\nThe therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, DrugB as 70 * DosageB - 0.4 * DosageB^2, and DrugC as 90 * DosageC - 0.3 * DosageC^2. The side effects are modeled as 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2. The company wants to maximize the net therapeutic effect (therapeutic effect - side effects).\nAdditionally, the total dosage across all drugs must not exceed 300 units.\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to maximize the net therapeutic effect while adhering to the dosage constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The dosage levels are continuous variables within a specified safe range.\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=150) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\n## The therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, etc.\nTherapeutic_Effect = (50 * DosageA - 0.5 * DosageA**2) + (70 * DosageB - 0.4 * DosageB**2) + (90 * DosageC - 0.3 * DosageC**2)\nSide_Effects = 0.1 * DosageA**2 + 0.15 * DosageB**2 + 0.2 * DosageC**2\n## The company wants to maximize the net therapeutic effect (therapeutic effect - side effects).\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Therapeutic_Effect - Side_Effects)\n\n# Add constraints\n## The total dosage across all drugs must not exceed 300 units.\nmodel.addCons(DosageA + DosageB + DosageC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Net Therapeutic Effect: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations.\n// {\"size of the playground (in square meters)\": \"Playground\", \"range\": \"Playground >= 0\", \"type\": \"real\"}\n// {\"size of the sports field (in square meters)\": \"SportsField\", \"range\": \"SportsField >= 0\", \"type\": \"real\"}\n// {\"size of the picnic area (in square meters)\": \"PicnicArea\", \"range\": \"PicnicArea >= 0\", \"type\": \"real\"}\n// {\"size of the botanical garden (in square meters)\": \"BotanicalGarden\", \"range\": \"BotanicalGarden >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe satisfaction derived from each facility is estimated as follows: Playground satisfaction is 0.05 * Playground^2, SportsField satisfaction is 0.08 * SportsField^2, PicnicArea satisfaction is 0.03 * PicnicArea^2, and BotanicalGarden satisfaction is 0.1 * BotanicalGarden^2. The city council aims to maximize the total satisfaction from all facilities.\n// Total satisfaction: Satisfaction = 0.05 * Playground^2 + 0.08 * SportsField^2 + 0.03 * PicnicArea^2 + 0.1 * BotanicalGarden^2\n// So, the objective function is: Maximize Satisfaction\n\n## Generate Constraint-1:\nThe total area available for the park is 10,000 square meters.\n// Playground + SportsField + PicnicArea + BotanicalGarden <= 10000\n\n## Generate Constraint-2:\nThe budget for the park development is $500,000. The cost of developing each facility is as follows: Playground costs $100 per square meter, SportsField costs $150 per square meter, PicnicArea costs $50 per square meter, and BotanicalGarden costs $200 per square meter.\n// 100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000\n\n## Generate Constraint-3:\nThe city council wants to ensure that at least 20% of the park area is dedicated to green spaces, which includes the BotanicalGarden and part of the PicnicArea.\n// BotanicalGarden + 0.5 * PicnicArea >= 0.2 * 10000\n\n## Generate Constraint-4:\nThe minimum size for the playground is set at 500 square meters to accommodate the needs of the local children.\n// Playground >= 500\n\n## Generate Constraint-5:\nThe sports field must be at least twice the size of the playground to cater to various sports activities.\n// SportsField >= 2 * Playground",
        "question": "A city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, and a botanical garden. The city council needs to determine the optimal size of each facility to maximize community satisfaction while adhering to budget constraints and space limitations. The satisfaction derived from each facility and the cost of developing each facility are given in the following Table.\n\n| Facility         | Satisfaction Formula | Cost per Square Meter |\n|------------------|----------------------|----------------------|\n| Playground       | 0.05 * Playground^2  | $100                 |\n| SportsField      | 0.08 * SportsField^2 | $150                 |\n| PicnicArea       | 0.03 * PicnicArea^2  | $50                  |\n| BotanicalGarden  | 0.1 * BotanicalGarden^2 | $200 |\n\nThe total area available for the park is 10,000 square meters. The budget for the park development is $500,000. The city council wants to ensure that at least 20% of the park area is dedicated to green spaces, which includes the BotanicalGarden and part of the PicnicArea. The minimum size for the playground is set at 500 square meters to accommodate the needs of the local children. The sports field must be at least twice the size of the playground to cater to various sports activities.\n\nPlease help the city council to maximize the total satisfaction from all facilities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPlayground = model.addVar(vtype=\"CONTINUOUS\", name=\"Playground\", lb=500)  # size of the playground\nSportsField = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsField\", lb=0)  # size of the sports field\nPicnicArea = model.addVar(vtype=\"CONTINUOUS\", name=\"PicnicArea\", lb=0)  # size of the picnic area\nBotanicalGarden = model.addVar(vtype=\"CONTINUOUS\", name=\"BotanicalGarden\", lb=0)  # size of the botanical garden\n\n# Define objective function\nSatisfaction = 0.05 * Playground**2 + 0.08 * SportsField**2 + 0.03 * PicnicArea**2 + 0.1 * BotanicalGarden**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Satisfaction)\n\n# Add constraints\n# The total area available for the park is 10,000 square meters.\nmodel.addCons(Playground + SportsField + PicnicArea + BotanicalGarden <= 10000)\n# The budget for the park development is $500,000.\nmodel.addCons(100 * Playground + 150 * SportsField + 50 * PicnicArea + 200 * BotanicalGarden <= 500000)\n# The city council wants to ensure that at least 20% of the park area is dedicated to green spaces.\nmodel.addCons(BotanicalGarden + 0.5 * PicnicArea >= 0.2 * 10000)\n# The sports field must be at least twice the size of the playground.\nmodel.addCons(SportsField >= 2 * Playground)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Size of Playground: \", model.getVal(Playground))\n    print(\"Size of SportsField: \", model.getVal(SportsField))\n    print(\"Size of PicnicArea: \", model.getVal(PicnicArea))\n    print(\"Size of BotanicalGarden: \", model.getVal(BotanicalGarden))\n    print(\"Maximized Satisfaction: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1394,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $5000, the production cost is $3000, and the maintenance cost per unit is $500. \nFor Machine M2, the selling price is $7000, the production cost is $4000, and the maintenance cost per unit is $700. \nFor Machine M3, the selling price is $9000, the production cost is $5000, and the maintenance cost per unit is $900.\nFor Machine M4, the selling price is $11000, the production cost is $6000, and the maintenance cost per unit is $1100.\nFor Machine M5, the selling price is $13000, the production cost is $7000, and the maintenance cost per unit is $1300.\nThe company aims to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n// Net profit of M1: Profit_M1 = (5000 - 3000 - 500) * M1\n// Net profit of M2: Profit_M2 = (7000 - 4000 - 700) * M2\n// Net profit of M3: Profit_M3 = (9000 - 5000 - 900) * M3\n// Net profit of M4: Profit_M4 = (11000 - 6000 - 1100) * M4\n// Net profit of M5: Profit_M5 = (13000 - 7000 - 1300) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (M1 + M2 + M3 + M4 + M5)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for production costs next month.\n// 3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine next month.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a maintenance budget of $50,000 for next month.\n// 500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50,000",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce next month to optimize their production strategy. The selling price, production cost, and maintenance cost per unit for each machine are given in the following Table.\n\n| Machine | Selling Price | Production Cost | Maintenance Cost per Unit |\n|---------|---------------|-----------------|---------------------------|\n| M1      | $5000         | $3000           | $500                      |\n| M2      | $7000         | $4000           | $700                      |\n| M3      | $9000         | $5000           | $900                      |\n| M4      | $11000        | $6000           | $1100                     |\n| M5      | $13000        | $7000           | $1300                     |\n\nThe company has a budget of $500,000 for production costs next month. The company wants to produce at least 5 units of each machine next month. The company also has a maintenance budget of $50,000 for next month. \n\nPlease help the company to maximize the net profit per unit of production, which is defined as the selling price minus the production cost and the maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine next month.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (5000 - 3000 - 500) * M1\nProfit_M2 = (7000 - 4000 - 700) * M2\nProfit_M3 = (9000 - 5000 - 900) * M3\nProfit_M4 = (11000 - 6000 - 1100) * M4\nProfit_M5 = (13000 - 7000 - 1300) * M5\nTotalProduction = M1 + M2 + M3 + M4 + M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $500,000 for production costs next month.\nmodel.addCons(3000 * M1 + 4000 * M2 + 5000 * M3 + 6000 * M4 + 7000 * M5 <= 500000)\n## The company has a maintenance budget of $50,000 for next month.\nmodel.addCons(500 * M1 + 700 * M2 + 900 * M3 + 1100 * M4 + 1300 * M5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Net Profit per Unit of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling these products.\n// Profit = 50A + 70B + 60C\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe market demand for product B is at least 15 units per day.\n// B >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling these products.\nThe total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day. The market demand for product B is at least 15 units per day.\nPlease help the company to determine the optimal number of units of each product to produce to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100) # Total production capacity constraint\nmodel.addCons(A >= 20) # Market demand for product A\nmodel.addCons(B >= 15) # Market demand for product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck in Region A is $100, and it decreases by $0.10 for each additional truck allocated. \nThe fuel cost per truck in Region B is $120, and it decreases by $0.15 for each additional truck allocated. \nThe fuel cost per truck in Region C is $90, and it decreases by $0.08 for each additional truck allocated.\nThe fuel cost per truck in Region D is $110, and it decreases by $0.12 for each additional truck allocated.\nThe fuel cost per truck in Region E is $130, and it decreases by $0.20 for each additional truck allocated.\nThe company wants to minimize the total fuel cost across all regions.\n// Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\n// Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\n// Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\n// Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\n// Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\n// So, the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100",
        "question": "A logistics company is planning its routes for delivering goods to different regions. They need to determine the number of trucks to allocate to each region to optimize fuel efficiency and delivery times. The fuel cost per truck in each region decreases as more trucks are allocated, as shown in the following Table.\n\n| Region | Fuel Cost per Truck | Decrease in Cost per Additional Truck |\n|--------|---------------------|--------------------------------------|\n| A      | $100                | $0.10                               |\n| B      | $120                | $0.15                               |\n| C      | $90                 | $0.08                               |\n| D      | $110                | $0.12                               |\n| E      | $130                | $0.20                               |\n\nThe company wants to minimize the total fuel cost across all regions. The company has a total of 100 trucks available for allocation. Please help the company determine the optimal number of trucks to allocate to each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks in Region E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_Cost_A = max(100 - 0.10 * (TruckA - 1), 100) * TruckA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=1)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=1)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TruckA == A1*A_b1 + A2*A_b2)\nFuel_Cost_A = (100 - 0.10 * (A1 - 1)) * A1 * A_b1 + (100 - 0.10 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_Cost_B = max(120 - 0.15 * (TruckB - 1), 120) * TruckB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=1)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TruckB == B1*B_b1 + B2*B_b2)\nFuel_Cost_B = (120 - 0.15 * (B1 - 1)) * B1 * B_b1 + (120 - 0.15 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_Cost_C = max(90 - 0.08 * (TruckC - 1), 90) * TruckC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=1)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TruckC == C1*C_b1 + C2*C_b2)\nFuel_Cost_C = (90 - 0.08 * (C1 - 1)) * C1 * C_b1 + (90 - 0.08 * (C2 - 1)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_Cost_D = max(110 - 0.12 * (TruckD - 1), 110) * TruckD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=1)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=1)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TruckD == D1*D_b1 + D2*D_b2)\nFuel_Cost_D = (110 - 0.12 * (D1 - 1)) * D1 * D_b1 + (110 - 0.12 * (D2 - 1)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_Cost_E = max(130 - 0.20 * (TruckE - 1), 130) * TruckE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=1)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=1)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TruckE == E1*E_b1 + E2*E_b2)\nFuel_Cost_E = (130 - 0.20 * (E1 - 1)) * E1 * E_b1 + (130 - 0.20 * (E2 - 1)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost. The company has a budget of $100,000 for purchasing new trucks.\n\nPlease help the company determine the optimal number of short-distance, medium-distance, and long-distance trucks to add to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define distances and fuel efficiencies\nShortDistance = 1000  # Example value\nMediumDistance = 2000  # Example value\nLongDistance = 3000  # Example value\nShortFuelEfficiency = 5  # Example value\nMediumFuelEfficiency = 10  # Example value\nLongFuelEfficiency = 15  # Example value\n\n## Calculate TotalFuelCost\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + \\\n                (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + \\\n                (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n\n## Calculate TotalMaintenanceCost\nTotalMaintenanceCost = 0.1 * TotalFuelCost\n\n## the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\n## Define truck costs\nShortTruckCost = 20000  # Example value\nMediumTruckCost = 30000  # Example value\nLongTruckCost = 40000  # Example value\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and drones. The company needs to optimize its production to maximize profit while considering various constraints.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of drones produced\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets $150, laptops $200, smartwatches $50, and drones $300. The company wants to maximize the total profit from all devices.\n// Total profit: Profit = 100 * Smartphones + 150 * Tablets + 200 * Laptops + 50 * Smartwatches + 300 * Drones\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000. The cost to produce each smartphone is $50, tablet $75, laptop $100, smartwatch $25, and drone $150.\n// 50 * Smartphones + 75 * Tablets + 100 * Laptops + 25 * Smartwatches + 150 * Drones <= 100000\n\n## Generate Constraint-2:\nThe company has a limited supply of a critical component used in all devices. The supply is enough for 1000 devices in total.\n// Smartphones + Tablets + Laptops + Smartwatches + Drones <= 1000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and drones. The company needs to optimize its production to maximize profit while considering various constraints. The profit per unit and the cost to produce each device are given in the following Table.\n\n| Device       | Profit per Unit | Cost to Produce |\n|--------------|-----------------|-----------------|\n| Smartphones  | $100            | $50             |\n| Tablets      | $150            | $75             |\n| Laptops      | $200            | $100            |\n| Smartwatches | $50             | $25             |\n| Drones       | $300            | $150            |\n\nThe company has a total production budget of $100,000. The company also has a limited supply of a critical component used in all devices, which is enough for 1000 devices in total. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)\n\n# Define objective function\nProfit = 100 * Smartphones + 150 * Tablets + 200 * Laptops + 50 * Smartwatches + 300 * Drones\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a total production budget of $100,000.\nmodel.addCons(50 * Smartphones + 75 * Tablets + 100 * Laptops + 25 * Smartwatches + 150 * Drones <= 100000)\n# The company has a limited supply of a critical component used in all devices. The supply is enough for 1000 devices in total.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Drones <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on Type A buildings\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type B buildings\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type C buildings\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type D buildings\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type E buildings\": \"TypeESolar\", \"range\": \"TypeESolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type due to differences in roof orientation and size. Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city aims to maximize the total energy generated per dollar spent.\n// Total energy generated: Energy = 80% * TypeASolar + 75% * TypeBSolar + 70% * TypeCSolar + 65% * TypeDSolar + 60% * TypeESolar\n// Total cost of installation: Cost = $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar <= $500,000\n\n## Generate Constraint-2:\nDue to building regulations, the number of solar panels on Type A buildings must not exceed 500.\n// TypeASolar <= 500\n\n## Generate Constraint-3:\nThe city aims to install at least 1000 solar panels in total across all building types.\n// TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The efficiency of solar panels varies by building type: Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city has a budget of $500,000 for the installation of solar panels. Due to building regulations, the number of solar panels on Type A buildings must not exceed 500. The city aims to install at least 1000 solar panels in total across all building types.\n\nPlease help the city to maximize the total energy generated per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0, ub=500)  # number of solar panels on Type A buildings\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0)  # number of solar panels on Type B buildings\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0)  # number of solar panels on Type C buildings\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0)  # number of solar panels on Type D buildings\nTypeESolar = model.addVar(vtype=\"INTEGER\", name=\"TypeESolar\", lb=0)  # number of solar panels on Type E buildings\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * TypeASolar + 0.75 * TypeBSolar + 0.7 * TypeCSolar + 0.65 * TypeDSolar + 0.6 * TypeESolar\nCost = 1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar\n## the objective function is: Maximize (Energy / Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar <= 500000)\n## Due to building regulations, the number of solar panels on Type A buildings must not exceed 500.\nmodel.addCons(TypeASolar <= 500)\n## The city aims to install at least 1000 solar panels in total across all building types.\nmodel.addCons(TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Type A Buildings: \", model.getVal(TypeASolar))\n    print(\"Number of Solar Panels on Type B Buildings: \", model.getVal(TypeBSolar))\n    print(\"Number of Solar Panels on Type C Buildings: \", model.getVal(TypeCSolar))\n    print(\"Number of Solar Panels on Type D Buildings: \", model.getVal(TypeDSolar))\n    print(\"Number of Solar Panels on Type E Buildings: \", model.getVal(TypeESolar))\n    print(\"Maximized Energy per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of labor per hour is $20. The investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - 20 * LA) * QA - IA\n// ProfitB = (150 - 20 * LB) * QB - IB\n// ProfitC = (200 - 20 * LC) * QC - IC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 5000 labor hours available for the month.\n// QA * LA + QB * LB + QC * LC <= 5000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// IA + IB + IC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit. The revenue per unit and the cost of labor per hour for each product are given in the following Table.\n\n| Product | Revenue per Unit | Labor Cost per Hour |\n|---------|------------------|---------------------|\n| ProductA | $100             | $20                 |\n| ProductB | $150             | $20                 |\n| ProductC | $200             | $20                 |\n\nThe investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company has a total of 5000 labor hours available for the month. The total investment in automation cannot exceed $50,000. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=0) # labor hours per unit for ProductA\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=0) # labor hours per unit for ProductB\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=0) # labor hours per unit for ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in automation for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in automation for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 - 20 * LA) * QA - IA\nProfitB = (150 - 20 * LB) * QB - IB\nProfitC = (200 - 20 * LC) * QC - IC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QA * LA + QB * LB + QC * LC <= 5000)\nmodel.addCons(IA + IB + IC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Labor hours per unit for ProductA: \", model.getVal(LA))\n    print(\"Labor hours per unit for ProductB: \", model.getVal(LB))\n    print(\"Labor hours per unit for ProductC: \", model.getVal(LC))\n    print(\"Investment in automation for ProductA: \", model.getVal(IA))\n    print(\"Investment in automation for ProductB: \", model.getVal(IB))\n    print(\"Investment in automation for ProductC: \", model.getVal(IC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device for the next month. Additionally, the company must decide on the number of shifts to operate for each device's production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for DeviceD\": \"ShiftsD\", \"range\": \"ShiftsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the profit per unit is $50, the cost per shift is $1000, and the production rate is 10 units per shift.\nFor DeviceB, the profit per unit is $70, the cost per shift is $1200, and the production rate is 12 units per shift.\nFor DeviceC, the profit per unit is $90, the cost per shift is $1500, and the production rate is 15 units per shift.\nFor DeviceD, the profit per unit is $110, the cost per shift is $1800, and the production rate is 18 units per shift.\nThe company aims to maximize the total profit minus the total cost of shifts.\n// Total profit for DeviceA: ProfitA = 50 * UnitsA\n// Total profit for DeviceB: ProfitB = 70 * UnitsB\n// Total profit for DeviceC: ProfitC = 90 * UnitsC\n// Total profit for DeviceD: ProfitD = 110 * UnitsD\n// Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n// Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for shift operations.\n// 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 500 units of each device.\n// UnitsA >= 500; UnitsB >= 500; UnitsC >= 500; UnitsD >= 500",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity of each device and the number of shifts to operate for each device's production line for the next month. The profit per unit, cost per shift, and production rate for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Shift | Production Rate (units per shift) |\n|--------|-----------------|----------------|-----------------------------------|\n| DeviceA | $50             | $1000          | 10                                |\n| DeviceB | $70             | $1200          | 12                                |\n| DeviceC | $90             | $1500          | 15                                |\n| DeviceD | $110            | $1800          | 18                                |\n\nThe company has a total budget of $100,000 for shift operations. The company wants to produce at least 500 units of each device. \nPlease help the company to maximize the total profit minus the total cost of shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=500) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=500) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=500) # number of units of DeviceD\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for DeviceA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for DeviceB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for DeviceC\nShiftsD = model.addVar(vtype=\"INTEGER\", name=\"ShiftsD\", lb=0) # number of shifts for DeviceD\n\n# Define objective function\n## Total profit for DeviceA: ProfitA = 50 * UnitsA\n## Total profit for DeviceB: ProfitB = 70 * UnitsB\n## Total profit for DeviceC: ProfitC = 90 * UnitsC\n## Total profit for DeviceD: ProfitD = 110 * UnitsD\n## Total cost for shifts: CostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\n## Units produced per shift: UnitsA = 10 * ShiftsA, UnitsB = 12 * ShiftsB, UnitsC = 15 * ShiftsC, UnitsD = 18 * ShiftsD\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\nProfitA = 50 * UnitsA\nProfitB = 70 * UnitsB\nProfitC = 90 * UnitsC\nProfitD = 110 * UnitsD\nCostShifts = 1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD\nmodel.addCons(UnitsA == 10 * ShiftsA)\nmodel.addCons(UnitsB == 12 * ShiftsB)\nmodel.addCons(UnitsC == 15 * ShiftsC)\nmodel.addCons(UnitsD == 18 * ShiftsD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD - CostShifts)\n\n# Add constraints\n## The company has a total budget of $100,000 for shift operations.\nmodel.addCons(1000 * ShiftsA + 1200 * ShiftsB + 1500 * ShiftsC + 1800 * ShiftsD <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Units of DeviceD: \", model.getVal(UnitsD))\n    print(\"Number of Shifts for DeviceA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for DeviceB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for DeviceC: \", model.getVal(ShiftsC))\n    print(\"Number of Shifts for DeviceD: \", model.getVal(ShiftsD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Each product requires a specific amount of raw materials and labor hours. Additionally, the company is considering investing in automation technology for each product, which will reduce the labor hours required per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for product A\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product B\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product C\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for product D\": \"AutomationD\", \"range\": \"AutomationD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per unit for each product decreases by 1 hour for every $10,000 invested in automation for that product. The initial labor cost per unit for product A is 5 hours, for product B is 6 hours, for product C is 7 hours, and for product D is 8 hours. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\n// Total profit for product B: ProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\n// Total profit for product C: ProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\n// Total profit for product D: ProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for automation investments.\n// AutomationA + AutomationB + AutomationC + AutomationD <= 100000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and the investment in automation technology for each product. Each product requires a specific amount of raw materials and labor hours, and investing in automation reduces the labor hours required per unit. The initial labor cost per unit for product A is 5 hours, for product B is 6 hours, for product C is 7 hours, and for product D is 8 hours. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for automation investments.\n\nPlease help the company determine the optimal production quantity for each product and the investment in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # investment in automation for product A\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # investment in automation for product B\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # investment in automation for product C\nAutomationD = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationD\", lb=0) # investment in automation for product D\n\n# Define objective function\n## Total profit for product A: ProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\n## Total profit for product B: ProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\n## Total profit for product C: ProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\n## Total profit for product D: ProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nProfitA = (100 - 5 * (1 - 0.0001 * AutomationA)) * A\nProfitB = (120 - 6 * (1 - 0.0001 * AutomationB)) * B\nProfitC = (140 - 7 * (1 - 0.0001 * AutomationC)) * C\nProfitD = (160 - 8 * (1 - 0.0001 * AutomationD)) * D\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total budget of $100,000 for automation investments.\nmodel.addCons(AutomationA + AutomationB + AutomationC + AutomationD <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Automation for Product A: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for Product B: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for Product C: \", model.getVal(AutomationC))\n    print(\"Investment in Automation for Product D: \", model.getVal(AutomationD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency.\n// {\"number of trucks in Region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck varies by region due to different road conditions and distances. In Region A, each truck can deliver 100 packages per day with a fuel cost of $50 per day. In Region B, each truck can deliver 120 packages per day with a fuel cost of $60 per day. In Region C, each truck can deliver 150 packages per day with a fuel cost of $70 per day. In Region D, each truck can deliver 130 packages per day with a fuel cost of $65 per day. In Region E, each truck can deliver 110 packages per day with a fuel cost of $55 per day. The company wants to maximize the total daily delivery volume while minimizing the total daily fuel cost.\n// Total daily delivery volume: Volume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\n// Total daily fuel cost: Cost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n// So, the objective function is: Maximize (Volume - Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $3000 per day for fuel.\n// 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000\n\n## Generate Constraint-2:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30\n\n## Generate Constraint-3:\nEach region must have at least 2 trucks.\n// TruckA >= 2; TruckB >= 2; TruckC >= 2; TruckD >= 2; TruckE >= 2\n\n## Generate Constraint-4:\nNo more than 15 trucks can be allocated to any single region.\n// TruckA <= 15; TruckB <= 15; TruckC <= 15; TruckD <= 15; TruckE <= 15",
        "question": "A logistics company is planning its routes for five different regions (Region A, Region B, Region C, Region D, and Region E). The company needs to decide the number of trucks to allocate to each region to optimize its delivery efficiency. The efficiency of each truck varies by region due to different road conditions and distances. The following table shows the delivery capacity and fuel cost per truck per day for each region.\n\n| Region | Delivery Capacity (packages/day) | Fuel Cost ($/day) |\n|--------|----------------------------------|-------------------|\n| A      | 100                              | 50                |\n| B      | 120                              | 60                |\n| C      | 150                              | 70                |\n| D      | 130                              | 65                |\n| E      | 110                              | 55                |\n\nThe company has a total budget of $3000 per day for fuel. The company has a total of 30 trucks available. Each region must have at least 2 trucks. No more than 15 trucks can be allocated to any single region. Please help the company to maximize the total daily delivery volume while minimizing the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=2, ub=15) # number of trucks in Region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=2, ub=15) # number of trucks in Region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=2, ub=15) # number of trucks in Region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=2, ub=15) # number of trucks in Region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=2, ub=15) # number of trucks in Region E\n\n# Define objective function\nVolume = 100 * TruckA + 120 * TruckB + 150 * TruckC + 130 * TruckD + 110 * TruckE\nCost = 50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE\n# So, the objective function is: Maximize (Volume - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Volume - Cost)\n\n# Add constraints\n# The company has a total budget of $3000 per day for fuel.\nmodel.addCons(50 * TruckA + 60 * TruckB + 70 * TruckC + 65 * TruckD + 55 * TruckE <= 3000)\n# The company has a total of 30 trucks available.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)\n# Each region must have at least 2 trucks.\nmodel.addCons(TruckA >= 2)\nmodel.addCons(TruckB >= 2)\nmodel.addCons(TruckC >= 2)\nmodel.addCons(TruckD >= 2)\nmodel.addCons(TruckE >= 2)\n# No more than 15 trucks can be allocated to any single region.\nmodel.addCons(TruckA <= 15)\nmodel.addCons(TruckB <= 15)\nmodel.addCons(TruckC <= 15)\nmodel.addCons(TruckD <= 15)\nmodel.addCons(TruckE <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the investment in green technology for each type of truck, which affects both the operating cost and the environmental impact.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in green technology for Small trucks\": \"GreenTechSmall\", \"range\": \"GreenTechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for Medium trucks\": \"GreenTechMedium\", \"range\": \"GreenTechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for Large trucks\": \"GreenTechLarge\", \"range\": \"GreenTechLarge >= 0\", \"type\": \"continuous\"}\n// {\"investment in green technology for Extra-Large trucks\": \"GreenTechExtraLarge\", \"range\": \"GreenTechExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit while also minimizing its environmental impact. The profit per truck type increases with the investment in green technology, and the environmental impact decreases. The profit function is nonlinear due to the diminishing returns of green technology investment.\nThe profit per Small truck is $10,000, and it increases by $1,000 for every $5,000 invested in green technology.\nThe profit per Medium truck is $15,000, and it increases by $1,500 for every $5,000 invested in green technology.\nThe profit per Large truck is $20,000, and it increases by $2,000 for every $5,000 invested in green technology.\nThe profit per Extra-Large truck is $25,000, and it increases by $2,500 for every $5,000 invested in green technology.\nThe environmental impact per truck type decreases with the investment in green technology, with a base impact and a reduction rate.\n// Total profit for Small trucks: ProfitSmall = (10000 + 0.2 * GreenTechSmall) * SmallTrucks\n// Total profit for Medium trucks: ProfitMedium = (15000 + 0.3 * GreenTechMedium) * MediumTrucks\n// Total profit for Large trucks: ProfitLarge = (20000 + 0.4 * GreenTechLarge) * LargeTrucks\n// Total profit for Extra-Large trucks: ProfitExtraLarge = (25000 + 0.5 * GreenTechExtraLarge) * ExtraLargeTrucks\n// Total environmental impact: Impact = (100 - 0.1 * GreenTechSmall) * SmallTrucks + (150 - 0.15 * GreenTechMedium) * MediumTrucks + (200 - 0.2 * GreenTechLarge) * LargeTrucks + (250 - 0.25 * GreenTechExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge) / Impact\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing new trucks and investing in green technology.\n// 10000 * SmallTrucks + 15000 * MediumTrucks + 20000 * LargeTrucks + 25000 * ExtraLargeTrucks + GreenTechSmall + GreenTechMedium + GreenTechLarge + GreenTechExtraLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the investment in green technology for each type of truck, which affects both the operating cost and the environmental impact. The company aims to maximize its profit while also minimizing its environmental impact. The profit per truck type increases with the investment in green technology, and the environmental impact decreases. The profit function is nonlinear due to the diminishing returns of green technology investment.\n\nThe profit per Small truck is $10,000, and it increases by $1,000 for every $5,000 invested in green technology.\nThe profit per Medium truck is $15,000, and it increases by $1,500 for every $5,000 invested in green technology.\nThe profit per Large truck is $20,000, and it increases by $2,000 for every $5,000 invested in green technology.\nThe profit per Extra-Large truck is $25,000, and it increases by $2,500 for every $5,000 invested in green technology.\n\nThe environmental impact per truck type decreases with the investment in green technology, with a base impact and a reduction rate.\n\nThe company has a budget of $1,000,000 for purchasing new trucks and investing in green technology. The total number of trucks in the fleet must not exceed 100.\n\nPlease help the company to maximize its profit while also minimizing its environmental impact, considering the objective function that maximizes the total profit divided by the total environmental impact.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nGreenTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechSmall\", lb=0)  # investment in green technology for Small trucks\nGreenTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechMedium\", lb=0)  # investment in green technology for Medium trucks\nGreenTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechLarge\", lb=0)  # investment in green technology for Large trucks\nGreenTechExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"GreenTechExtraLarge\", lb=0)  # investment in green technology for Extra-Large trucks\n\n# Define objective function\nProfitSmall = (10000 + 0.2 * GreenTechSmall) * SmallTrucks\nProfitMedium = (15000 + 0.3 * GreenTechMedium) * MediumTrucks\nProfitLarge = (20000 + 0.4 * GreenTechLarge) * LargeTrucks\nProfitExtraLarge = (25000 + 0.5 * GreenTechExtraLarge) * ExtraLargeTrucks\nImpact = (100 - 0.1 * GreenTechSmall) * SmallTrucks + (150 - 0.15 * GreenTechMedium) * MediumTrucks + (200 - 0.2 * GreenTechLarge) * LargeTrucks + (250 - 0.25 * GreenTechExtraLarge) * ExtraLargeTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge) / Impact\n# convert the division to multiplication\nmodel.addCons(obj * Impact == ProfitSmall + ProfitMedium + ProfitLarge + ProfitExtraLarge)\n\n# Add constraints\n# The company has a budget of $1,000,000 for purchasing new trucks and investing in green technology.\nmodel.addCons(10000 * SmallTrucks + 15000 * MediumTrucks + 20000 * LargeTrucks + 25000 * ExtraLargeTrucks + GreenTechSmall + GreenTechMedium + GreenTechLarge + GreenTechExtraLarge <= 1000000)\n# The total number of trucks in the fleet must not exceed 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Green Tech for Small Trucks: \", model.getVal(GreenTechSmall))\n    print(\"Investment in Green Tech for Medium Trucks: \", model.getVal(GreenTechMedium))\n    print(\"Investment in Green Tech for Large Trucks: \", model.getVal(GreenTechLarge))\n    print(\"Investment in Green Tech for Extra-Large Trucks: \", model.getVal(GreenTechExtraLarge))\n    print(\"Maximized Profit/Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1684,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit.\n// {\"raw materials for production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 4\": \"L4\", \"range\": \"L4 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 5\": \"L5\", \"range\": \"L5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and profit margin per unit of product. The profit function is nonlinear due to economies of scale and varying efficiency rates.\n// Profit from production line 1: P1 = 100 * R1^0.5 * L1^0.6\n// Profit from production line 2: P2 = 120 * R2^0.4 * L2^0.7\n// Profit from production line 3: P3 = 130 * R3^0.3 * L3^0.8\n// Profit from production line 4: P4 = 110 * R4^0.5 * L4^0.6\n// Profit from production line 5: P5 = 140 * R5^0.4 * L5^0.7\n// The objective function is: Maximize Total Profit = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nTotal raw materials available are 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nTotal labor hours available are 800 hours.\n// L1 + L2 + L3 + L4 + L5 <= 800\n\n## Generate Constraint-3:\nEach production line can use a maximum of 200 units of raw materials.\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200\n\n## Generate Constraint-4:\nEach production line can utilize a maximum of 150 labor hours.\n// L1 <= 150; L2 <= 150; L3 <= 150; L4 <= 150; L5 <= 150",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit. Each production line has a different efficiency and profit margin per unit of product, with the profit function being nonlinear due to economies of scale and varying efficiency rates. The profit from each production line is as follows:\n- Production line 1: P1 = 100 * R1^0.5 * L1^0.6\n- Production line 2: P2 = 120 * R2^0.4 * L2^0.7\n- Production line 3: P3 = 130 * R3^0.3 * L3^0.8\n- Production line 4: P4 = 110 * R4^0.5 * L4^0.6\n- Production line 5: P5 = 140 * R5^0.4 * L5^0.7\nThe objective is to maximize the total profit, which is the sum of the profits from all production lines.\n\nThe company has a total of 1000 units of raw materials and 800 labor hours available. Each production line can use a maximum of 200 units of raw materials and 150 labor hours.\n\nPlease help the company determine the optimal allocation of raw materials (R1, R2, R3, R4, R5) and labor hours (L1, L2, L3, L4, L5) to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials for production line 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials for production line 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # raw materials for production line 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # raw materials for production line 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # raw materials for production line 5\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for production line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for production line 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for production line 3\nL4 = model.addVar(vtype=\"CONTINUOUS\", name=\"L4\", lb=0) # labor hours for production line 4\nL5 = model.addVar(vtype=\"CONTINUOUS\", name=\"L5\", lb=0) # labor hours for production line 5\n\n# Define objective function\nP1 = 100 * R1**0.5 * L1**0.6\nP2 = 120 * R2**0.4 * L2**0.7\nP3 = 130 * R3**0.3 * L3**0.8\nP4 = 110 * R4**0.5 * L4**0.6\nP5 = 140 * R5**0.4 * L5**0.7\nTotal_Profit = P1 + P2 + P3 + P4 + P5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000) # Total raw materials available are 1000 units.\nmodel.addCons(L1 + L2 + L3 + L4 + L5 <= 800) # Total labor hours available are 800 hours.\nmodel.addCons(R1 <= 200) # Each production line can use a maximum of 200 units of raw materials.\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\nmodel.addCons(L1 <= 150) # Each production line can utilize a maximum of 150 labor hours.\nmodel.addCons(L2 <= 150)\nmodel.addCons(L3 <= 150)\nmodel.addCons(L4 <= 150)\nmodel.addCons(L5 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for production line 1: \", model.getVal(R1))\n    print(\"Raw materials for production line 2: \", model.getVal(R2))\n    print(\"Raw materials for production line 3: \", model.getVal(R3))\n    print(\"Raw materials for production line 4: \", model.getVal(R4))\n    print(\"Raw materials for production line 5: \", model.getVal(R5))\n    print(\"Labor hours for production line 1: \", model.getVal(L1))\n    print(\"Labor hours for production line 2: \", model.getVal(L2))\n    print(\"Labor hours for production line 3: \", model.getVal(L3))\n    print(\"Labor hours for production line 4: \", model.getVal(L4))\n    print(\"Labor hours for production line 5: \", model.getVal(L5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type.\n// {\"number of trucks for Goods A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Goods C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Goods A (km/liter)\": \"EfficiencyA\", \"range\": \"EfficiencyA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods B (km/liter)\": \"EfficiencyB\", \"range\": \"EfficiencyB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Goods C (km/liter)\": \"EfficiencyC\", \"range\": \"EfficiencyC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency.\n// FuelCostA = 3 * (DistanceA / EfficiencyA) * TrucksA\n// FuelCostB = 3 * (DistanceB / EfficiencyB) * TrucksB\n// FuelCostC = 3 * (DistanceC / EfficiencyC) * TrucksC\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $2000 for daily fuel expenses.\n// (DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks that can be used daily.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three different types of goods (Goods A, Goods B, and Goods C) across different routes. The company needs to determine the number of trucks to allocate for each type of goods and the fuel efficiency of each truck type. The cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the distance each type of truck travels and its fuel efficiency. The company has a total budget of $2000 for daily fuel expenses and a limit of 50 trucks that can be used daily.\n\n| Goods Type | Number of Trucks | Fuel Efficiency (km/liter) | Distance Traveled (km) |\n|------------|------------------|----------------------------|-------------------------|\n| Goods A    | TrucksA          | EfficiencyA                | DistanceA               |\n| Goods B    | TrucksB          | EfficiencyB                | DistanceB               |\n| Goods C    | TrucksC          | EfficiencyC                | DistanceC               |\n\nPlease help the company to determine the optimal number of trucks for each type of goods and their fuel efficiencies to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Goods A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Goods B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Goods C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistanceA = model.addVar(name=\"DistanceA\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods A\nDistanceB = model.addVar(name=\"DistanceB\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods B\nDistanceC = model.addVar(name=\"DistanceC\", vtype=\"CONTINUOUS\", lb=0) # distance for Goods C\nEfficiencyA = model.addVar(name=\"EfficiencyA\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods A\nEfficiencyB = model.addVar(name=\"EfficiencyB\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods B\nEfficiencyC = model.addVar(name=\"EfficiencyC\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency for Goods C\n\nFuelCostA = 3 * (DistanceA / EfficiencyA) * TrucksA\nFuelCostB = 3 * (DistanceB / EfficiencyB) * TrucksB\nFuelCostC = 3 * (DistanceC / EfficiencyC) * TrucksC\n## convert the division to multiplication\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\n## The company has a total budget of $2000 for daily fuel expenses.\nmodel.addCons((DistanceA / EfficiencyA) * TrucksA + (DistanceB / EfficiencyB) * TrucksB + (DistanceC / EfficiencyC) * TrucksC <= 2000 / 3)\n## The company has a limit of 50 trucks that can be used daily.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Goods A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Goods B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Goods C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe company has a budget of $500,000 for raw materials. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 500 units of each device.\n// DeviceAProduction >= 500; DeviceBProduction >= 500; DeviceCProduction >= 500; DeviceDProduction >= 500; DeviceEProduction >= 500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The company has a budget of $500,000 for raw materials. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35. To ensure market presence, the company must produce at least 500 units of each device. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=500)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=500)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=500)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=500)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=500)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Heavy trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"FuelEfficiencyMedium\", \"range\": \"FuelEfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Light trucks\": \"FuelEfficiencyLight\", \"range\": \"FuelEfficiencyLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For every $1000 invested in Heavy trucks, fuel efficiency improves by 0.5 miles per gallon. For Medium trucks, it improves by 0.7 miles per gallon, and for Light trucks, it improves by 1 mile per gallon. The operational cost per mile for Heavy trucks is $1.5, for Medium trucks is $1.2, and for Light trucks is $1.0. The company aims to minimize the total operational cost of the fleet.\n// Operational cost per mile for Heavy trucks: CostHeavy = (1.5 / (0.5 * FuelEfficiencyHeavy / 1000 + 1)) * HeavyTrucks\n// Operational cost per mile for Medium trucks: CostMedium = (1.2 / (0.7 * FuelEfficiencyMedium / 1000 + 1)) * MediumTrucks\n// Operational cost per mile for Light trucks: CostLight = (1.0 / (1 * FuelEfficiencyLight / 1000 + 1)) * LightTrucks\n// So, the objective function is: Minimize (CostHeavy + CostMedium + CostLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// HeavyTrucks + MediumTrucks + LightTrucks + FuelEfficiencyHeavy + FuelEfficiencyMedium + FuelEfficiencyLight <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 500.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 500",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For every $1000 invested in Heavy trucks, fuel efficiency improves by 0.5 miles per gallon. For Medium trucks, it improves by 0.7 miles per gallon, and for Light trucks, it improves by 1 mile per gallon. The operational cost per mile for Heavy trucks is $1.5, for Medium trucks is $1.2, and for Light trucks is $1.0. The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks cannot exceed 500. The company aims to minimize the total operational cost of the fleet. Please help the company determine the optimal number of trucks and the investment in fuel efficiency to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)\nFuelEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyMedium\", lb=0)\nFuelEfficiencyLight = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyLight\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Operational cost per mile for Heavy trucks\nHeavyEfficiency = 0.5 * FuelEfficiencyHeavy / 1000 + 1\nCostHeavy = (1.5 / HeavyEfficiency) * HeavyTrucks\n## Operational cost per mile for Medium trucks\nMediumEfficiency = 0.7 * FuelEfficiencyMedium / 1000 + 1\nCostMedium = (1.2 / MediumEfficiency) * MediumTrucks\n## Operational cost per mile for Light trucks\nLightEfficiency = 1 * FuelEfficiencyLight / 1000 + 1\nCostLight = (1.0 / LightEfficiency) * LightTrucks\n\n## the objective function is: Minimize (CostHeavy + CostMedium + CostLight)\nmodel.addCons(obj == CostHeavy + CostMedium + CostLight)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + FuelEfficiencyHeavy + FuelEfficiencyMedium + FuelEfficiencyLight <= 200000)\n## The total number of trucks cannot exceed 500.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Fuel Efficiency for Heavy Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(FuelEfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Light Trucks: \", model.getVal(FuelEfficiencyLight))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for operational costs.\n// 100 * V1 + 120 * V2 + 140 * V3 <= 10000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company has a limited fuel budget of 500 liters and a budget of $10,000 for operational costs.\nPlease help the company to maximize the profit efficiency (profit per liter of fuel consumed).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(100 * V1 + 120 * V2 + 140 * V3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for V1: \", model.getVal(V1))\n    print(\"Number of Trips for V2: \", model.getVal(V2))\n    print(\"Number of Trips for V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"operational cost per truck\": \"CostPerTruck\", \"range\": \"CostPerTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per van\": \"CostPerVan\", \"range\": \"CostPerVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per motorcycle\": \"CostPerMotorcycle\", \"range\": \"CostPerMotorcycle >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company aims to maximize the net daily profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\n// TotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks + Vans + Motorcycles <= 100000\n\n## Generate Constraint-2:\nThe total operational cost should not exceed $50,000 per day.\n// 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000\n\n## Generate Constraint-3:\nThe number of trucks should be at least 10% of the total number of vehicles.\n// Trucks >= 0.1 * (Trucks + Vans + Motorcycles)",
        "question": "A logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Revenue per Day | Operational Cost per Vehicle |\n|--------------|-----------------|-------------------------------|\n| Trucks       | $5000           | $1000                         |\n| Vans         | $3000           | $500                          |\n| Motorcycles  | $1000           | $200                          |\n\nThe company has a budget of $100,000 for purchasing vehicles. The total operational cost should not exceed $50,000 per day. The number of trucks should be at least 10% of the total number of vehicles. \n\nPlease help the company to maximize the net daily profit, which is the total revenue minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nCostPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck\", lb=0)  # operational cost per truck\nCostPerVan = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerVan\", lb=0)  # operational cost per van\nCostPerMotorcycle = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerMotorcycle\", lb=0)  # operational cost per motorcycle\n\n# Define objective function\nTotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\nTotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks + Vans + Motorcycles <= 100000)\n# The total operational cost should not exceed $50,000 per day.\nmodel.addCons(1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000)\n# The number of trucks should be at least 10% of the total number of vehicles.\nmodel.addCons(Trucks >= 0.1 * (Trucks + Vans + Motorcycles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Operational Cost per Truck: \", model.getVal(CostPerTruck))\n    print(\"Operational Cost per Van: \", model.getVal(CostPerVan))\n    print(\"Operational Cost per Motorcycle: \", model.getVal(CostPerMotorcycle))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize the total cargo transported while minimizing fuel costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A can carry 10 tons per trip and consumes 5 liters of fuel per trip.\nTruck B can carry 15 tons per trip and consumes 7 liters of fuel per trip.\nTruck C can carry 20 tons per trip and consumes 9 liters of fuel per trip.\nThe company wants to maximize the total cargo transported while minimizing the total fuel consumption.\n// Cargo_TruckA = 10 * TruckA\n// Cargo_TruckB = 15 * TruckB\n// Cargo_TruckC = 20 * TruckC\n// Fuel_TruckA = 5 * TruckA\n// Fuel_TruckB = 7 * TruckB\n// Fuel_TruckC = 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 trips available.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-3:\nThe total cargo capacity of all trucks must not exceed 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500\n\n## Generate Constraint-4:\nThe number of Truck A must be at least 10.\n// TruckA >= 10\n\n## Generate Constraint-5:\nThe number of Truck C must not exceed twice the number of Truck B.\n// TruckC <= 2 * TruckB",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. Truck A can carry 10 tons per trip and consumes 5 liters of fuel per trip. Truck B can carry 15 tons per trip and consumes 7 liters of fuel per trip. Truck C can carry 20 tons per trip and consumes 9 liters of fuel per trip. The company wants to maximize the total cargo transported while minimizing the total fuel consumption. The company has a total budget of $10,000 for fuel costs and a total of 100 trips available. The total cargo capacity of all trucks must not exceed 1500 tons. The number of Truck A must be at least 10, and the number of Truck C must not exceed twice the number of Truck B. Please help the company determine the number of each type of truck to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_TruckA = 5 * TruckA\nFuel_TruckB = 7 * TruckB\nFuel_TruckC = 9 * TruckC\n# So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC)^2\n# Convert the square term to a multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC - (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC) * (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC))\n\n# Add constraints\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000) # Total budget for fuel costs\nmodel.addCons(TruckA + TruckB + TruckC <= 100) # Total trips available\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1500) # Total cargo capacity\nmodel.addCons(TruckA >= 10) # Minimum number of Truck A\nmodel.addCons(TruckC <= 2 * TruckB) # Truck C must not exceed twice the number of Truck B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Cargo Transported Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each truck on Route A is 50 liters per trip, on Route B is 60 liters per trip, on Route C is 70 liters per trip, and on Route D is 80 liters per trip. The operational cost per truck on Route A is $100 per trip, on Route B is $120 per trip, on Route C is $140 per trip, and on Route D is $160 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Fuel_Cost_A = 50 * Trucks_A\n// Fuel_Cost_B = 60 * Trucks_B\n// Fuel_Cost_C = 70 * Trucks_C\n// Fuel_Cost_D = 80 * Trucks_D\n// Operational_Cost_A = 100 * Trucks_A\n// Operational_Cost_B = 120 * Trucks_B\n// Operational_Cost_C = 140 * Trucks_C\n// Operational_Cost_D = 160 * Trucks_D\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for operational costs per day.\n// 100 * Trucks_A + 120 * Trucks_B + 140 * Trucks_C + 160 * Trucks_D <= 5000\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of 3000 liters.\n// 50 * Trucks_A + 60 * Trucks_B + 70 * Trucks_C + 80 * Trucks_D <= 3000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the total trucks are allocated to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D)\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A and B.\n// Trucks_D <= Trucks_A + Trucks_B",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route.\nThe fuel consumption for each truck on Route A is 50 liters per trip, on Route B is 60 liters per trip, on Route C is 70 liters per trip, and on Route D is 80 liters per trip. The operational cost per truck on Route A is $100 per trip, on Route B is $120 per trip, on Route C is $140 per trip, and on Route D is $160 per trip. The company has a total of 50 trucks available. The company has a budget of $5000 for operational costs per day. The company has a daily fuel budget of 3000 liters. The company wants to ensure that at least 10% of the total trucks are allocated to Route A. The company also wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A and B.\nPlease help the company to minimize the total fuel consumption and operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Route D\n\n# Define objective function\nFuel_Cost_A = 50 * Trucks_A\nFuel_Cost_B = 60 * Trucks_B\nFuel_Cost_C = 70 * Trucks_C\nFuel_Cost_D = 80 * Trucks_D\nOperational_Cost_A = 100 * Trucks_A\nOperational_Cost_B = 120 * Trucks_B\nOperational_Cost_C = 140 * Trucks_C\nOperational_Cost_D = 160 * Trucks_D\n# So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50)\n# The company has a budget of $5000 for operational costs per day.\nmodel.addCons(100 * Trucks_A + 120 * Trucks_B + 140 * Trucks_C + 160 * Trucks_D <= 5000)\n# The company has a daily fuel budget of 3000 liters.\nmodel.addCons(50 * Trucks_A + 60 * Trucks_B + 70 * Trucks_C + 80 * Trucks_D <= 3000)\n# The company wants to ensure that at least 10% of the total trucks are allocated to Route A.\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D))\n# The company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A and B.\nmodel.addCons(Trucks_D <= Trucks_A + Trucks_B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon.\nFor T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon.\nFor T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon.\nFor T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon.\nFor T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// Total capacity: Capacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities, operational costs per mile, and fuel efficiencies. The details for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Capacity | Fuel Efficiency |\n|------------|---------------------------|----------|-----------------|\n| T1         | $2                        | 10 tons  | 5 miles/gallon  |\n| T2         | $3                        | 15 tons  | 4 miles/gallon  |\n| T3         | $4                        | 20 tons  | 3 miles/gallon  |\n| T4         | $5                        | 25 tons  | 2 miles/gallon  |\n| T5         | $6                        | 30 tons  | 1 mile/gallon   |\n\nThe company has a budget of $500,000 for purchasing trucks. The total capacity of all trucks must be at least 1000 tons. The company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n\nPlease help the company determine the optimal number of each type of truck to purchase to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nCapacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000)\n## The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1282,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 500 units of each device.\n// DeviceAProduction >= 500; DeviceBProduction >= 500; DeviceCProduction >= 500; DeviceDProduction >= 500; DeviceEProduction >= 500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35. To ensure market presence, the company must produce at least 500 units of each device. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=500)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=500)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=500)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=500)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=500)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for B is $30, for C is $40, for D is $50, and for E is $60. The company aims to maximize the total profit from distributing these products. However, due to varying demand and storage capacities, the profit rate per unit of storage space used is considered. The profit rate is defined as the total profit divided by the total volume of products.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Profit of E: Profit_E = 60 * E\n// Volume of A: Volume_A = A\n// Volume of B: Volume_B = 2 * B\n// Volume of C: Volume_C = 3 * C\n// Volume of D: Volume_D = 4 * D\n// Volume of E: Volume_E = 5 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 500 cubic units.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 500\n\n## Generate Constraint-2:\nThe company wants to distribute at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a budget of $1000 for transportation costs, where the cost per unit for A is $5, for B is $10, for C is $15, for D is $20, and for E is $25.\n// 5 * A + 10 * B + 15 * C + 20 * D + 25 * E <= 1000\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, C, and E.\n// D <= A + B + C + E",
        "question": "A logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit and the volume per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Volume per Unit |\n|---------|-----------------|-----------------|\n| A       | $20             | A               |\n| B       | $30             | 2 * B           |\n| C       | $40             | 3 * C           |\n| D       | $50             | 4 * D           |\n| E       | $60             | 5 * E           |\n\nThe company has a total storage capacity of 500 cubic units. The company wants to distribute at least 5 units of each product. The company has a budget of $1000 for transportation costs, where the cost per unit for A is $5, for B is $10, for C is $15, for D is $20, and for E is $25. The company wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, and C. Additionally, the company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, C, and E.\n\nPlease help the company to maximize the profit rate per unit of storage space used, which is defined as the total profit divided by the total volume of products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to distribute at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nProfit_E = 60 * E\nVolume_A = A\nVolume_B = 2 * B\nVolume_C = 3 * C\nVolume_D = 4 * D\nVolume_E = 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total storage capacity of 500 cubic units.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 500)\n## The company has a budget of $1000 for transportation costs, where the cost per unit for A is $5, for B is $10, for C is $15, for D is $20, and for E is $25.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D + 25 * E <= 1000)\n## The company wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, C, and E.\nmodel.addCons(D <= A + B + C + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1415,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and wants to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company needs to decide how many trucks to allocate to each route to maximize efficiency and minimize fuel consumption.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks varies by route due to different road conditions and distances. On RouteA, each truck consumes 100 liters of fuel per trip. On RouteB, each truck consumes 120 liters of fuel per trip. On RouteC, each truck consumes 150 liters of fuel per trip. The company aims to minimize the total fuel consumption while ensuring that all routes are adequately serviced.\n// Total fuel consumption on RouteA: FuelA = 100 * TrucksA\n// Total fuel consumption on RouteB: FuelB = 120 * TrucksB\n// Total fuel consumption on RouteC: FuelC = 150 * TrucksC\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company operates a fleet of trucks and wants to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company needs to decide how many trucks to allocate to each route to maximize efficiency and minimize fuel consumption. The fuel consumption per truck per trip varies by route as shown in the following Table.\n\n| Route   | Fuel Consumption per Truck per Trip |\n|---------|------------------------------------|\n| RouteA  | 100 liters                         |\n| RouteB  | 120 liters                         |\n| RouteC  | 150 liters                         |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to minimize the total fuel consumption while ensuring that all routes are adequately serviced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\nFuelA = 100 * TrucksA\nFuelB = 120 * TrucksB\nFuelC = 150 * TrucksC\n# So, the objective function is: Minimize (FuelA + FuelB + FuelC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company wants to maximize the energy output while minimizing the carbon footprint.\n// Energy Output = 15% * 1000 * Solar1 + 20% * 1500 * Solar2 + 25% * 2000 * Solar3 + 30% * 2500 * Solar4 + 35% * 3000 * Solar5 + 20% * 2000 * Wind1 + 25% * 2500 * Wind2 + 30% * 3000 * Wind3\n// Carbon Footprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n// So, the objective function is: Maximize Energy Output / Carbon Footprint\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a carbon footprint of 50 kg. Solar2 has an efficiency of 20%, cost $1500, and a carbon footprint of 70 kg. Solar3 has an efficiency of 25%, cost $2000, and a carbon footprint of 90 kg. Solar4 has an efficiency of 30%, cost $2500, and a carbon footprint of 110 kg. Solar5 has an efficiency of 35%, cost $3000, and a carbon footprint of 130 kg.\nWind turbines also vary in efficiency, cost, and carbon footprint. Wind1 has an efficiency of 20%, cost $2000, and a carbon footprint of 100 kg. Wind2 has an efficiency of 25%, cost $2500, and a carbon footprint of 120 kg. Wind3 has an efficiency of 30%, cost $3000, and a carbon footprint of 140 kg.\nThe company has a budget of $1,000,000 for the installation.\nThe company wants to maximize the energy output while minimizing the carbon footprint.\nPlease help the company to determine the optimal number of each type of solar panel and wind turbine to install to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of Solar1 panels\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of Solar2 panels\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of Solar3 panels\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of Solar4 panels\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0) # number of Solar5 panels\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of Wind1 turbines\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of Wind2 turbines\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of Wind3 turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput = 0.15 * 1000 * Solar1 + 0.20 * 1500 * Solar2 + 0.25 * 2000 * Solar3 + 0.30 * 2500 * Solar4 + 0.35 * 3000 * Solar5 + 0.20 * 2000 * Wind1 + 0.25 * 2500 * Wind2 + 0.30 * 3000 * Wind3\nCarbonFootprint = 50 * Solar1 + 70 * Solar2 + 90 * Solar3 + 110 * Solar4 + 130 * Solar5 + 100 * Wind1 + 120 * Wind2 + 140 * Wind3\n## the objective function is: Maximize Energy Output / Carbon Footprint\n## convert the division to multiplication\nmodel.addCons(obj * CarbonFootprint == EnergyOutput)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation.\nmodel.addCons(1000 * Solar1 + 1500 * Solar2 + 2000 * Solar3 + 2500 * Solar4 + 3000 * Solar5 + 2000 * Wind1 + 2500 * Wind2 + 3000 * Wind3 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output / Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1291,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Trucks\": \"FuelTruck\", \"range\": \"FuelTruck > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Vans\": \"FuelVan\", \"range\": \"FuelVan > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Bikes\": \"FuelBike\", \"range\": \"FuelBike > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Trucks\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Vans\": \"MaintenanceVan\", \"range\": \"MaintenanceVan > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Bikes\": \"MaintenanceBike\", \"range\": \"MaintenanceBike > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes.\n// Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-3:\nThe number of Trucks must be at least half the number of Vans.\n// Trucks >= 0.5 * Vans\n\n## Generate Constraint-4:\nThe number of Bikes must be at least twice the number of Trucks.\n// Bikes >= 2 * Trucks\n\n## Generate Constraint-5:\nThe fuel consumption rate for Trucks is twice that of Vans, and the fuel consumption rate for Bikes is half that of Vans.\n// FuelTruck = 2 * FuelVan\n// FuelBike = 0.5 * FuelVan",
        "question": "A logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption rates and maintenance costs per vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption Rate | Maintenance Cost per Vehicle |\n|---------|-----------------------|------------------------------|\n| Trucks  | FuelTruck             | MaintenanceTruck             |\n| Vans    | FuelVan               | MaintenanceVan               |\n| Bikes   | FuelBike              | MaintenanceBike              |\n\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. The number of Trucks must be at least half the number of Vans. The number of Bikes must be at least twice the number of Trucks. The fuel consumption rate for Trucks is twice that of Vans, and the fuel consumption rate for Bikes is half that of Vans.\n\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nFuelTruck = model.addVar(name=\"FuelTruck\", lb=0)  # fuel consumption rate for Trucks\nFuelVan = model.addVar(name=\"FuelVan\", lb=0)  # fuel consumption rate for Vans\nFuelBike = model.addVar(name=\"FuelBike\", lb=0)  # fuel consumption rate for Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", lb=0)  # maintenance cost per vehicle for Trucks\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", lb=0)  # maintenance cost per vehicle for Vans\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", lb=0)  # maintenance cost per vehicle for Bikes\nmodel.addCons(obj == FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n# Add constraints\n## The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000)\n## The total number of vehicles cannot exceed 50.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n## The number of Trucks must be at least half the number of Vans.\nmodel.addCons(Trucks >= 0.5 * Vans)\n## The number of Bikes must be at least twice the number of Trucks.\nmodel.addCons(Bikes >= 2 * Trucks)\n## The fuel consumption rate for Trucks is twice that of Vans, and the fuel consumption rate for Bikes is half that of Vans.\nmodel.addCons(FuelTruck == 2 * FuelVan)\nmodel.addCons(FuelBike == 0.5 * FuelVan)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production efficiency by determining the optimal operating hours for each machine.\n// {\"operating hours for machine 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"operating hours for machine 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"operating hours for machine 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n// {\"operating hours for machine 4\": \"H4\", \"range\": \"H4 >= 0\", \"type\": \"real\"}\n// {\"operating hours for machine 5\": \"H5\", \"range\": \"H5 >= 0\", \"type\": \"real\"}\n// {\"operating hours for machine 6\": \"H6\", \"range\": \"H6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different energy efficiency and production rate. The energy consumption per hour for each machine is as follows: Machine 1: 10 kWh, Machine 2: 12 kWh, Machine 3: 15 kWh, Machine 4: 18 kWh, Machine 5: 20 kWh, Machine 6: 25 kWh. The production rate (components per hour) for each machine is: Machine 1: 50, Machine 2: 60, Machine 3: 70, Machine 4: 80, Machine 5: 90, Machine 6: 100. The plant needs to produce at least 1000 components while minimizing the total energy consumption.\n// The total energy consumption: E = 10 * H1 + 12 * H2 + 15 * H3 + 18 * H4 + 20 * H5 + 25 * H6\n// The total production: P = 50 * H1 + 60 * H2 + 70 * H3 + 80 * H4 + 90 * H5 + 100 * H6\n// The objective function is: Minimize E subject to P >= 1000\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours.\n// H1 + H2 + H3 + H4 + H5 + H6 <= 100\n\n## Generate Constraint-2:\nEach machine has a maximum operating capacity: Machine 1: 20 hours, Machine 2: 18 hours, Machine 3: 15 hours, Machine 4: 12 hours, Machine 5: 10 hours, Machine 6: 8 hours.\n// H1 <= 20; H2 <= 18; H3 <= 15; H4 <= 12; H5 <= 10; H6 <= 8\n\n## Generate Constraint-3:\nThe plant must produce at least 1000 components.\n// 50 * H1 + 60 * H2 + 70 * H3 + 80 * H4 + 90 * H5 + 100 * H6 >= 1000",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production efficiency by determining the optimal operating hours for each machine. Each machine has a different energy efficiency and production rate. The energy consumption per hour for each machine is as follows: Machine 1: 10 kWh, Machine 2: 12 kWh, Machine 3: 15 kWh, Machine 4: 18 kWh, Machine 5: 20 kWh, Machine 6: 25 kWh. The production rate (components per hour) for each machine is: Machine 1: 50, Machine 2: 60, Machine 3: 70, Machine 4: 80, Machine 5: 90, Machine 6: 100. The plant needs to produce at least 1000 components while minimizing the total energy consumption. The total operating hours for all machines must not exceed 100 hours. Each machine has a maximum operating capacity: Machine 1: 20 hours, Machine 2: 18 hours, Machine 3: 15 hours, Machine 4: 12 hours, Machine 5: 10 hours, Machine 6: 8 hours. Please help the plant manager to minimize the total energy consumption while ensuring the production of at least 1000 components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # operating hours for machine 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # operating hours for machine 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # operating hours for machine 3\nH4 = model.addVar(vtype=\"CONTINUOUS\", name=\"H4\", lb=0) # operating hours for machine 4\nH5 = model.addVar(vtype=\"CONTINUOUS\", name=\"H5\", lb=0) # operating hours for machine 5\nH6 = model.addVar(vtype=\"CONTINUOUS\", name=\"H6\", lb=0) # operating hours for machine 6\n\n# Define objective function\n## The total energy consumption: E = 10 * H1 + 12 * H2 + 15 * H3 + 18 * H4 + 20 * H5 + 25 * H6\nE = 10 * H1 + 12 * H2 + 15 * H3 + 18 * H4 + 20 * H5 + 25 * H6\n## The objective function is: Minimize E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E)\n\n# Add constraints\n## The total operating hours for all machines must not exceed 100 hours.\nmodel.addCons(H1 + H2 + H3 + H4 + H5 + H6 <= 100)\n## Each machine has a maximum operating capacity: Machine 1: 20 hours, Machine 2: 18 hours, Machine 3: 15 hours, Machine 4: 12 hours, Machine 5: 10 hours, Machine 6: 8 hours.\nmodel.addCons(H1 <= 20)\nmodel.addCons(H2 <= 18)\nmodel.addCons(H3 <= 15)\nmodel.addCons(H4 <= 12)\nmodel.addCons(H5 <= 10)\nmodel.addCons(H6 <= 8)\n## The plant must produce at least 1000 components.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 + 80 * H4 + 90 * H5 + 100 * H6 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Machine 1: \", model.getVal(H1))\n    print(\"Operating hours for Machine 2: \", model.getVal(H2))\n    print(\"Operating hours for Machine 3: \", model.getVal(H3))\n    print(\"Operating hours for Machine 4: \", model.getVal(H4))\n    print(\"Operating hours for Machine 5: \", model.getVal(H5))\n    print(\"Operating hours for Machine 6: \", model.getVal(H6))\n    print(\"Minimized Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a Truck is $100 per day, a Van is $70 per day, and a Bike is $30 per day. The revenue generated by a Truck is $200 per day, a Van is $150 per day, and a Bike is $100 per day. The company aims to maximize the profit rate, which is defined as the total revenue divided by the total operating cost.\n// Operating cost of Trucks: Cost_T = 100 * T\n// Operating cost of Vans: Cost_V = 70 * V\n// Operating cost of Bikes: Cost_B = 30 * B\n// Revenue from Trucks: Revenue_T = 200 * T\n// Revenue from Vans: Revenue_V = 150 * V\n// Revenue from Bikes: Revenue_B = 100 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle operating costs for the month.\n// 100 * T + 70 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 vehicles available.\n// T + V + B <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations. The cost of operating and the revenue generated per day for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operating Cost per Day | Revenue per Day |\n|--------------|------------------------|-----------------|\n| Trucks       | $100                   | $200            |\n| Vans         | $70                    | $150            |\n| Bikes        | $30                    | $100            |\n\nThe company has a budget of $10,000 for vehicle operating costs for the month. The company has a total of 100 vehicles available. The company aims to maximize the profit rate, which is defined as the total revenue divided by the total operating cost.\n\nPlease help the company to determine the optimal number of Trucks (T), Vans (V), and Bikes (B) to deploy to maximize the profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_T = 100 * T\nCost_V = 70 * V\nCost_B = 30 * B\nRevenue_T = 200 * T\nRevenue_V = 150 * V\nRevenue_B = 100 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_T + Cost_V + Cost_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle operating costs for the month.\nmodel.addCons(100 * T + 70 * V + 30 * B <= 10000)\n## The company has a total of 100 vehicles available.\nmodel.addCons(T + V + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EffA\", \"range\": \"EffA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EffB\", \"range\": \"EffB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EffC\", \"range\": \"EffC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency enhancements. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - 100 + 0.001 * EffA) * QA\n// ProfitB = (200 - 150 + 0.0015 * EffB) * QB\n// ProfitC = (250 - 200 + 0.002 * EffC) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// EffA + EffB + EffC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA.\n// QA <= 1000\n\n## Generate Constraint-4:\nDue to resource limitations, the production of ProductB cannot exceed 2000 units.\n// QB <= 2000\n\n## Generate Constraint-5:\nThe company must ensure that at least 500 units of ProductC are produced.\n// QC >= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit. The production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency enhancements. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. The market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA. Due to resource limitations, the production of ProductB cannot exceed 2000 units. The company must ensure that at least 500 units of ProductC are produced.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=1000)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=2000)  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=500, ub=5000)  # quantity of ProductC\nEffA = model.addVar(vtype=\"CONTINUOUS\", name=\"EffA\", lb=0)  # investment in efficiency for ProductA\nEffB = model.addVar(vtype=\"CONTINUOUS\", name=\"EffB\", lb=0)  # investment in efficiency for ProductB\nEffC = model.addVar(vtype=\"CONTINUOUS\", name=\"EffC\", lb=0)  # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.001 * EffA) * QA\nProfitB = (200 - 150 + 0.0015 * EffB) * QB\nProfitC = (250 - 200 + 0.002 * EffC) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for efficiency enhancements.\nmodel.addCons(EffA + EffB + EffC <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QA + QB + QC <= 5000)\n# The market demand for ProductA is 1000 units.\nmodel.addCons(QA <= 1000)\n# Due to resource limitations, the production of ProductB cannot exceed 2000 units.\nmodel.addCons(QB <= 2000)\n# The company must ensure that at least 500 units of ProductC are produced.\nmodel.addCons(QC >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EffA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EffB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EffC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1332,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n// Cost_A = (100 - 5 * Automation) * A\n// Cost_B = (150 - 5 * Automation) * B\n// Cost_C = (200 - 5 * Automation) * C\n// Revenue_A = 150 * A\n// Revenue_B = 200 * B\n// Revenue_C = 250 * C\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for implementing automation.\n// Automation <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit. The company has a budget of $100,000 for implementing automation. Please help the company to determine the optimal production quantities of each product and the level of automation to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (100 - 5 * Automation) * A\nCost_B = (150 - 5 * Automation) * B\nCost_C = (200 - 5 * Automation) * C\nRevenue_A = 150 * A\nRevenue_B = 200 * B\nRevenue_C = 250 * C\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a budget of $100,000 for implementing automation.\nmodel.addCons(Automation <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the marketing budget for each product to enhance sales.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgA\", \"range\": \"MktgA >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductB\": \"MktgB\", \"range\": \"MktgB >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductC\": \"MktgC\", \"range\": \"MktgC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n// Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n// Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 2000 units across all products.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe total marketing budget must not exceed $20,000.\n// MktgA + MktgB + MktgC <= 20,000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA must be at least 20% of the total production.\n// ProdA >= 0.2 * (ProdA + ProdB + ProdC)",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the marketing budget for each product to maximize profit. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company has a total budget of $100,000 for raw materials and labor. The storage capacity is limited to 2000 units across all products. The total marketing budget must not exceed $20,000. Due to market demand, the production of ProductA must be at least 20% of the total production. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMktgA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgA\", lb=0) # marketing budget for ProductA\nMktgB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgB\", lb=0) # marketing budget for ProductB\nMktgC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n## Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n## Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\nProfit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\nProfit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100000)\n## The storage capacity is limited to 2000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n## The total marketing budget must not exceed $20,000.\nmodel.addCons(MktgA + MktgB + MktgC <= 20000)\n## Due to market demand, the production of ProductA must be at least 20% of the total production.\nmodel.addCons(ProdA >= 0.2 * (ProdA + ProdB + ProdC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach component has a different production cost, selling price, and requires a specific amount of labor hours. The firm aims to maximize its profit rate, which is defined as the total profit divided by the total labor hours.\nFor Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours.\nFor Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours.\nFor Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours.\nFor Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours.\n// Profit of A: Profit_A = (30 - 20) * A\n// Profit of B: Profit_B = (35 - 25) * B\n// Profit of C: Profit_C = (40 - 30) * C\n// Profit of D: Profit_D = (45 - 35) * D\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / (3 * A + 4 * B + 5 * C + 6 * D)\n\n## Generate Constraint-1:\nThe firm has a budget of $10,000 for production costs next month.\n// 20 * A + 25 * B + 30 * C + 35 * D <= 10000\n\n## Generate Constraint-2:\nThe firm wants to ensure that at least 50 units of each component are produced next month.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe firm has a maximum of 1500 labor hours available next month.\n// 3 * A + 4 * B + 5 * C + 6 * D <= 1500\n\n## Generate Constraint-4:\nThe firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe firm wants to ensure that the production of Component C does not exceed twice the production of Component A.\n// C <= 2 * A",
        "question": "A manufacturing firm produces four types of electronic components: A, B, C, and D. The firm needs to decide how many units of each component to manufacture next month to optimize its operations.\nFor Component A, the production cost is $20, the selling price is $30, and it requires 3 labor hours.\nFor Component B, the production cost is $25, the selling price is $35, and it requires 4 labor hours.\nFor Component C, the production cost is $30, the selling price is $40, and it requires 5 labor hours.\nFor Component D, the production cost is $35, the selling price is $45, and it requires 6 labor hours.\nThe firm has a budget of $10,000 for production costs next month. The firm wants to ensure that at least 50 units of each component are produced next month. The firm has a maximum of 1500 labor hours available next month. The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C. The firm also wants to ensure that the production of Component C does not exceed twice the production of Component A.\nPlease help the firm to maximize its profit rate, which is defined as the total profit divided by the total labor hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The firm wants to ensure that at least 50 units of each component are produced next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 20) * A\nProfit_B = (35 - 25) * B\nProfit_C = (40 - 30) * C\nProfit_D = (45 - 35) * D\nProductionTime = 3 * A + 4 * B + 5 * C + 6 * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The firm has a budget of $10,000 for production costs next month.\nmodel.addCons(20 * A + 25 * B + 30 * C + 35 * D <= 10000)\n## The firm has a maximum of 1500 labor hours available next month.\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D <= 1500)\n## The firm wants to ensure that the production of Component D does not exceed the combined production of Components A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The firm wants to ensure that the production of Component C does not exceed twice the production of Component A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for fuel and maintenance costs combined.\n// (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to Route A.\n// RouteA >= 5",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company has a total of 50 trucks available for allocation. The company has a budget of $100,000 for fuel and maintenance costs combined. The company must allocate at least 5 trucks to Route A.\nPlease help the company to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=5) # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trucks for Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\n## The company has a budget of $100,000 for fuel and maintenance costs combined.\nmodel.addCons((2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1171,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 150\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 200\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, DrugB as 70 * DosageB - 0.4 * DosageB^2, and DrugC as 90 * DosageC - 0.3 * DosageC^2. The side effects are modeled as 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2. The company wants to maximize the net therapeutic effect (therapeutic effect - side effects).\n// Therapeutic_Effect = (50 * DosageA - 0.5 * DosageA^2) + (70 * DosageB - 0.4 * DosageB^2) + (90 * DosageC - 0.3 * DosageC^2)\n// Side_Effects = 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2\n// So, the objective function is: Maximize (Therapeutic_Effect - Side_Effects)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 300 units.\n// DosageA + DosageB + DosageC <= 300\n\n## Generate Constraint-2:\nThe dosage of DrugA must be at least half the dosage of DrugB.\n// DosageA >= 0.5 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be no more than twice the dosage of DrugA.\n// DosageC <= 2 * DosageA\n\n## Generate Constraint-4:\nThe combined side effects from all drugs should not exceed a threshold of 1000 units.\n// 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2 <= 1000\n\n## Generate Constraint-5:\nThe therapeutic effect of DrugB must be at least 50% of the total therapeutic effect.\n// (70 * DosageB - 0.4 * DosageB^2) >= 0.5 * ((50 * DosageA - 0.5 * DosageA^2) + (70 * DosageB - 0.4 * DosageB^2) + (90 * DosageC - 0.3 * DosageC^2))",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the therapeutic effect while minimizing side effects. The dosage levels are continuous variables within a specified safe range. The therapeutic effect of DrugA is modeled as 50 * DosageA - 0.5 * DosageA^2, DrugB as 70 * DosageB - 0.4 * DosageB^2, and DrugC as 90 * DosageC - 0.3 * DosageC^2. The side effects are modeled as 0.1 * DosageA^2 + 0.15 * DosageB^2 + 0.2 * DosageC^2. The company wants to maximize the net therapeutic effect (therapeutic effect - side effects). The total dosage across all drugs must not exceed 300 units. The dosage of DrugA must be at least half the dosage of DrugB. The dosage of DrugC must be no more than twice the dosage of DrugA. The combined side effects from all drugs should not exceed a threshold of 1000 units. The therapeutic effect of DrugB must be at least 50% of the total therapeutic effect. Please help the company to determine the optimal dosage levels for each drug.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=150) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=200) # dosage level of DrugC\n\n# Define objective function\nTherapeutic_Effect = (50 * DosageA - 0.5 * DosageA**2) + (70 * DosageB - 0.4 * DosageB**2) + (90 * DosageC - 0.3 * DosageC**2)\nSide_Effects = 0.1 * DosageA**2 + 0.15 * DosageB**2 + 0.2 * DosageC**2\nNet_Therapeutic_Effect = Therapeutic_Effect - Side_Effects\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Therapeutic_Effect)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 300)\nmodel.addCons(DosageA >= 0.5 * DosageB)\nmodel.addCons(DosageC <= 2 * DosageA)\nmodel.addCons(0.1 * DosageA**2 + 0.15 * DosageB**2 + 0.2 * DosageC**2 <= 1000)\nmodel.addCons((70 * DosageB - 0.4 * DosageB**2) >= 0.5 * Therapeutic_Effect)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Net Therapeutic Effect: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in advanced machinery that can improve the production efficiency of each product, reducing the resource cost per unit. The investment in advanced machinery for each product is a continuous variable.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 units of resources available for the month.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $20,000.\n// MachineryA + MachineryB + MachineryC <= 20000\n\n## Generate Constraint-3:\nDue to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC.\n// UnitsA <= 500; UnitsB <= 600; UnitsC <= 700\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n// UnitsA >= 100; UnitsB >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in advanced machinery that can improve the production efficiency of each product, reducing the resource cost per unit. The cost of resources per unit decreases by $5 for every $1,000 invested in advanced machinery for that product. The initial resource cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company has a total of 10,000 units of resources available for the month. The total investment in advanced machinery cannot exceed $20,000. Due to market demand, the company can produce no more than 500 units of ProductA, 600 units of ProductB, and 700 units of ProductC. The company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced. \n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100, ub=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=200, ub=600)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=700)     # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0) # investment in advanced machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0) # investment in advanced machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0) # investment in advanced machinery for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * MachineryA) * UnitsA\nProfitB = (250 - 150 + 0.005 * MachineryB) * UnitsB\nProfitC = (300 - 200 + 0.005 * MachineryC) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 20000)\nmodel.addCons(UnitsA <= 500)\nmodel.addCons(UnitsB <= 600)\nmodel.addCons(UnitsC <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal distribution quantities for each product to maximize profit while considering various operational constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, for product D is $50, and for product E is $60. The company aims to maximize the total profit, but due to storage limitations, the profit rate (total profit divided by total storage space used) is also crucial. The storage space required for product A is 5 cubic feet, for product B is 10 cubic feet, for product C is 15 cubic feet, for product D is 20 cubic feet, and for product E is 25 cubic feet.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Profit of E: Profit_E = 60 * E\n// Storage space used: Storage_A = 5 * A, Storage_B = 10 * B, Storage_C = 15 * C, Storage_D = 20 * D, Storage_E = 25 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Storage_A + Storage_B + Storage_C + Storage_D + Storage_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing the products.\n// 20 * A + 30 * B + 40 * C + 50 * D + 60 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a limited storage capacity of 500 cubic feet.\n// 5 * A + 10 * B + 15 * C + 20 * D + 25 * E <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are distributed.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal distribution quantities for each product to maximize profit while considering various operational constraints. The profit per unit and storage space required for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| A       | $20             | 5 cubic feet           |\n| B       | $30             | 10 cubic feet          |\n| C       | $40             | 15 cubic feet          |\n| D       | $50             | 20 cubic feet          |\n| E       | $60             | 25 cubic feet          |\n\nThe company has a total budget of $10,000 for purchasing the products. The company has a limited storage capacity of 500 cubic feet. The company wants to ensure that at least 50 units of each product are distributed. The company also wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, C, and D.\n\nPlease help the company to maximize the total profit, considering the profit rate (total profit divided by total storage space used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are distributed.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # quantity of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # quantity of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nProfit_E = 60 * E\nStorage_A = 5 * A\nStorage_B = 10 * B\nStorage_C = 15 * C\nStorage_D = 20 * D\nStorage_E = 25 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Storage_A + Storage_B + Storage_C + Storage_D + Storage_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Storage_A + Storage_B + Storage_C + Storage_D + Storage_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total budget of $10,000 for purchasing the products.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D + 60 * E <= 10000)\n## The company has a limited storage capacity of 500 cubic feet.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D + 25 * E <= 500)\n## The company wants to ensure that the distribution of product E does not exceed the combined distribution of products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Quantity of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $20, with a production cost of $10 and a resource usage of 3 units.\nFor component B, the profit per unit is $25, with a production cost of $12 and a resource usage of 4 units.\nFor component C, the profit per unit is $30, with a production cost of $15 and a resource usage of 5 units.\nFor component D, the profit per unit is $35, with a production cost of $18 and a resource usage of 6 units.\nFor component E, the profit per unit is $40, with a production cost of $20 and a resource usage of 7 units.\nThe company aims to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (3 * A + 4 * B + 5 * C + 6 * D + 7 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the production quantity of each component to optimize their profit and resource usage.\nThe profit per unit of component A is $20, with a production cost of $10 and a resource usage of 3 units.\nFor component B, the profit per unit is $25, with a production cost of $12 and a resource usage of 4 units.\nFor component C, the profit per unit is $30, with a production cost of $15 and a resource usage of 5 units.\nFor component D, the profit per unit is $35, with a production cost of $18 and a resource usage of 6 units.\nFor component E, the profit per unit is $40, with a production cost of $20 and a resource usage of 7 units.\nThe company has a budget of $10,000 for production costs.\nPlease help the company to maximize the profit-to-resource ratio (which is defined as the total profit divided by the total resource usage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nResourceUsage = 3 * A + 4 * B + 5 * C + 6 * D + 7 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The goal is to minimize the total operational cost while meeting delivery requirements and constraints.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company aims to minimize the total operational cost across all routes.\n// Total operational cost for Route1: Cost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Route3: Cost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its routes for delivering goods to various destinations. The company must decide the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each truck type. The goal is to minimize the total operational cost while meeting delivery requirements and constraints. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases by 0.5% for every $1,000 invested in fuel efficiency upgrades. The initial cost per kilometer for Route1 is $2, Route2 is $3, and Route3 is $4. The company aims to minimize the total operational cost across all routes.\n\n| Route | Initial Cost per Kilometer |\n|-------|-----------------------------|\n| Route1 | $2                         |\n| Route2 | $3                         |\n| Route3 | $4                         |\n\nThe company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades. The total number of trucks available for all routes is limited to 50.\n\nPlease help the company to determine the optimal number of trucks and the appropriate investment in fuel efficiency upgrades for each route to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\n# Total operational cost for Route1: Cost1 = (2 - 0.005 * Efficiency1) * Trucks1 * Distance1\n# Total operational cost for Route2: Cost2 = (3 - 0.005 * Efficiency2) * Trucks2 * Distance2\n# Total operational cost for Route3: Cost3 = (4 - 0.005 * Efficiency3) * Trucks3 * Distance3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = (2 - 0.005 * Efficiency1) * Trucks1 * 1000  # Assuming Distance1 = 1000 km\nCost2 = (3 - 0.005 * Efficiency2) * Trucks2 * 1000  # Assuming Distance2 = 1000 km\nCost3 = (4 - 0.005 * Efficiency3) * Trucks3 * 1000  # Assuming Distance3 = 1000 km\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and fuel efficiency upgrades.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n# The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1282,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD_Units\", \"range\": \"DeviceD_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE_Units\", \"range\": \"DeviceE_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by:\n- Cost_A(x) = 20x^2 + 10x + 5\n- Cost_B(x) = 30x^2 + 20x + 10\n- Cost_C(x) = 40x^2 + 30x + 15\n- Cost_D(x) = 25x^2 + 15x + 8\n- Cost_E(x) = 35x^2 + 25x + 12\nThe company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 - Cost_A(DeviceA_Units)) * DeviceA_Units\n// Total net profit for DeviceB: Profit_B = (70 - Cost_B(DeviceB_Units)) * DeviceB_Units\n// Total net profit for DeviceC: Profit_C = (90 - Cost_C(DeviceC_Units)) * DeviceC_Units\n// Total net profit for DeviceD: Profit_D = (60 - Cost_D(DeviceD_Units)) * DeviceD_Units\n// Total net profit for DeviceE: Profit_E = (80 - Cost_E(DeviceE_Units)) * DeviceE_Units\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units + DeviceE_Units <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least 30% of the total production of DeviceB and DeviceC combined.\n// DeviceA_Units >= 0.3 * (DeviceB_Units + DeviceC_Units)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device and the production cost function for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|--------------------------|\n| DeviceA | $50 | 20x^2 + 10x + 5 |\n| DeviceB | $70 | 30x^2 + 20x + 10 |\n| DeviceC | $90 | 40x^2 + 30x + 15 |\n| DeviceD | $60 | 25x^2 + 15x + 8 |\n| DeviceE | $80 | 35x^2 + 25x + 12 |\n\nThe company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least 30% of the total production of DeviceB and DeviceC combined.\n\nPlease help the company to maximize the total net profit by determining the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)\nDeviceD_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Units\", lb=0)\nDeviceE_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Units\", lb=0)\n\n# Define objective function\n## Calculate the cost functions\nCost_A = lambda x: 20 * x**2 + 10 * x + 5\nCost_B = lambda x: 30 * x**2 + 20 * x + 10\nCost_C = lambda x: 40 * x**2 + 30 * x + 15\nCost_D = lambda x: 25 * x**2 + 15 * x + 8\nCost_E = lambda x: 35 * x**2 + 25 * x + 12\n\n## Calculate the profits\nProfit_A = (50 - Cost_A(DeviceA_Units)) * DeviceA_Units\nProfit_B = (70 - Cost_B(DeviceB_Units)) * DeviceB_Units\nProfit_C = (90 - Cost_C(DeviceC_Units)) * DeviceC_Units\nProfit_D = (60 - Cost_D(DeviceD_Units)) * DeviceD_Units\nProfit_E = (80 - Cost_E(DeviceE_Units)) * DeviceE_Units\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units + DeviceE_Units <= 1000)\n\n## Supplier agreement constraint\nmodel.addCons(DeviceA_Units >= 0.3 * (DeviceB_Units + DeviceC_Units))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceD_Units))\n    print(\"Number of DeviceE Units: \", model.getVal(DeviceE_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows:\n\n| Device   | Profit per Unit |\n|----------|-----------------|\n| DeviceA  | $50             |\n| DeviceB  | $70             |\n| DeviceC  | $90             |\n| DeviceD  | $60             |\n| DeviceE  | $80             |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 6 different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize efficiency while minimizing costs.\n// {\"number of turbines in farm 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach turbine generates a certain amount of electricity per hour, which varies by farm due to differences in wind conditions and turbine technology. The cost of operating each turbine also varies by farm. The company aims to maximize the total electricity generation while minimizing the total operating cost.\n// Electricity generated per hour in farm 1: E1 = 50 * T1^0.7\n// Electricity generated per hour in farm 2: E2 = 60 * T2^0.8\n// Electricity generated per hour in farm 3: E3 = 45 * T3^0.6\n// Electricity generated per hour in farm 4: E4 = 55 * T4^0.75\n// Electricity generated per hour in farm 5: E5 = 65 * T5^0.85\n// Electricity generated per hour in farm 6: E6 = 70 * T6^0.9\n// Operating cost per hour in farm 1: C1 = 10 * T1^1.2\n// Operating cost per hour in farm 2: C2 = 12 * T2^1.3\n// Operating cost per hour in farm 3: C3 = 9 * T3^1.1\n// Operating cost per hour in farm 4: C4 = 11 * T4^1.25\n// Operating cost per hour in farm 5: C5 = 13 * T5^1.35\n// Operating cost per hour in farm 6: C6 = 15 * T6^1.4\n// The objective function is: Maximize (E1 + E2 + E3 + E4 + E5 + E6) - (C1 + C2 + C3 + C4 + C5 + C6)\n// Maximize \u03a3(50 * T1^0.7 + 60 * T2^0.8 + 45 * T3^0.6 + 55 * T4^0.75 + 65 * T5^0.85 + 70 * T6^0.9) - \u03a3(10 * T1^1.2 + 12 * T2^1.3 + 9 * T3^1.1 + 11 * T4^1.25 + 13 * T5^1.35 + 15 * T6^1.4)\n\n## Generate Constraint-1:\nThe total number of turbines that can be installed across all farms is limited to 200.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 200\n\n## Generate Constraint-2:\nEach farm has a maximum capacity for turbines: farm 1 to 6 can install up to 40, 35, 30, 45, 50, and 55 turbines respectively.\n// T1 <= 40; T2 <= 35; T3 <= 30; T4 <= 45; T5 <= 50; T6 <= 55",
        "question": "A company operates 6 different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize efficiency while minimizing costs. The electricity generated per hour and the operating cost per hour for each turbine vary by farm due to differences in wind conditions and turbine technology. The company aims to maximize the total electricity generation while minimizing the total operating cost.\n\n| Farm | Electricity Generated per Hour | Operating Cost per Hour | Maximum Capacity |\n|------|--------------------------------|-------------------------|------------------|\n| 1    | 50 * T1^0.7                    | 10 * T1^1.2             | 40 turbines      |\n| 2    | 60 * T2^0.8                    | 12 * T2^1.3             | 35 turbines      |\n| 3    | 45 * T3^0.6                    | 9 * T3^1.1              | 30 turbines      |\n| 4    | 55 * T4^0.75                   | 11 * T4^1.25            | 45 turbines      |\n| 5    | 65 * T5^0.85                   | 13 * T5^1.35            | 50 turbines      |\n| 6    | 70 * T6^0.9                    | 15 * T6^1.4             | 55 turbines      |\n\nThe total number of turbines that can be installed across all farms is limited to 200. Each farm has a maximum capacity for turbines as specified in the table. Please help the company to maximize the total electricity generation while minimizing the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of turbines in farm 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of turbines in farm 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of turbines in farm 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of turbines in farm 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of turbines in farm 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of turbines in farm 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate electricity and cost for each farm\nE1 = 50 * T1**0.7\nE2 = 60 * T2**0.8\nE3 = 45 * T3**0.6\nE4 = 55 * T4**0.75\nE5 = 65 * T5**0.85\nE6 = 70 * T6**0.9\nC1 = 10 * T1**1.2\nC2 = 12 * T2**1.3\nC3 = 9 * T3**1.1\nC4 = 11 * T4**1.25\nC5 = 13 * T5**1.35\nC6 = 15 * T6**1.4\n\n## The objective function is: Maximize (E1 + E2 + E3 + E4 + E5 + E6) - (C1 + C2 + C3 + C4 + C5 + C6)\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6 - C1 - C2 - C3 - C4 - C5 - C6)\n\n# Add constraints\n## The total number of turbines that can be installed across all farms is limited to 200.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 200)\n## Each farm has a maximum capacity for turbines: farm 1 to 6 can install up to 40, 35, 30, 45, 50, and 55 turbines respectively.\nmodel.addCons(T1 <= 40)\nmodel.addCons(T2 <= 35)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 45)\nmodel.addCons(T5 <= 50)\nmodel.addCons(T6 <= 55)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of turbines in farm 1: \", model.getVal(T1))\n    print(\"Number of turbines in farm 2: \", model.getVal(T2))\n    print(\"Number of turbines in farm 3: \", model.getVal(T3))\n    print(\"Number of turbines in farm 4: \", model.getVal(T4))\n    print(\"Number of turbines in farm 5: \", model.getVal(T5))\n    print(\"Number of turbines in farm 6: \", model.getVal(T6))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1422,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\n// {\"number of Solar1 panels\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar2 panels\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar3 panels\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar4 panels\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of Solar5 panels\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind1 turbines\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind2 turbines\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of Wind3 turbines\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment.\n// Total energy output: Energy = 15% * 1000 * Solar1 + 20% * 1200 * Solar2 + 25% * 1500 * Solar3 + 30% * 2000 * Solar4 + 35% * 2500 * Solar5 + 20% * 3000 * Wind1 + 25% * 3500 * Wind2 + 30% * 4000 * Wind3\n// Total cost: Cost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for this project.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000\n\n## Generate Constraint-2:\nAt least 30% of the budget must be spent on solar panels.\n// 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000\n\n## Generate Constraint-3:\nThe total number of wind turbines must not exceed 20.\n// Wind1 + Wind2 + Wind3 <= 20\n\n## Generate Constraint-4:\nThe number of Solar1 panels must be at least twice the number of Solar5 panels.\n// Solar1 >= 2 * Solar5",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (Solar1, Solar2, Solar3, Solar4, Solar5) and three types of wind turbines (Wind1, Wind2, Wind3).\nEach solar panel type has a different efficiency and cost. Solar1 has an efficiency of 15%, cost $1000, and a lifespan of 10 years. Solar2 has an efficiency of 20%, cost $1200, and a lifespan of 12 years. Solar3 has an efficiency of 25%, cost $1500, and a lifespan of 15 years. Solar4 has an efficiency of 30%, cost $2000, and a lifespan of 20 years. Solar5 has an efficiency of 35%, cost $2500, and a lifespan of 25 years.\nEach wind turbine type also has different characteristics. Wind1 has an efficiency of 20%, cost $3000, and a lifespan of 10 years. Wind2 has an efficiency of 25%, cost $3500, and a lifespan of 15 years. Wind3 has an efficiency of 30%, cost $4000, and a lifespan of 20 years.\nThe company has a budget of $100,000 for this project. At least 30% of the budget must be spent on solar panels. The total number of wind turbines must not exceed 20. The number of Solar1 panels must be at least twice the number of Solar5 panels.\nThe company wants to maximize the total energy output per dollar spent over the lifespan of the equipment. Please help the company determine the optimal number of each type of solar panel and wind turbine to install.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\n\n# Define objective function\nEnergy = 0.15 * 1000 * Solar1 + 0.20 * 1200 * Solar2 + 0.25 * 1500 * Solar3 + 0.30 * 2000 * Solar4 + 0.35 * 2500 * Solar5 + 0.20 * 3000 * Wind1 + 0.25 * 3500 * Wind2 + 0.30 * 4000 * Wind3\nCost = 1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 + 3000 * Wind1 + 3500 * Wind2 + 4000 * Wind3 <= 100000)\nmodel.addCons(1000 * Solar1 + 1200 * Solar2 + 1500 * Solar3 + 2000 * Solar4 + 2500 * Solar5 >= 0.3 * 100000)\nmodel.addCons(Wind1 + Wind2 + Wind3 <= 20)\nmodel.addCons(Solar1 >= 2 * Solar5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar1 panels: \", model.getVal(Solar1))\n    print(\"Number of Solar2 panels: \", model.getVal(Solar2))\n    print(\"Number of Solar3 panels: \", model.getVal(Solar3))\n    print(\"Number of Solar4 panels: \", model.getVal(Solar4))\n    print(\"Number of Solar5 panels: \", model.getVal(Solar5))\n    print(\"Number of Wind1 turbines: \", model.getVal(Wind1))\n    print(\"Number of Wind2 turbines: \", model.getVal(Wind2))\n    print(\"Number of Wind3 turbines: \", model.getVal(Wind3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1420,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. \nThe fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. \nThe fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. \nThe company aims to maximize the total distance covered by all vehicles.\n// Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n// Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n// Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n// So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter.\n// 10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel. The fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. The fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. The fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. The company aims to maximize the total distance covered by all vehicles. The company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter. Please help the company to maximize the total distance covered by all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0) # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0) # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0) # fuel allocation for TruckC\n\n# Define objective function\nDistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\nDistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\nDistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n# So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == DistanceA + DistanceB + DistanceC)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles and allocating fuel.\nmodel.addCons(10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel Allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel Allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel Allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Maximized Total Distance: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. \nFor route 1, each truck consumes 100 liters of fuel and takes 5 hours. \nFor route 2, each truck consumes 120 liters of fuel and takes 6 hours. \nFor route 3, each truck consumes 140 liters of fuel and takes 7 hours. \nFor route 4, each truck consumes 160 liters of fuel and takes 8 hours.\nFor route 5, each truck consumes 180 liters of fuel and takes 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n// Fuel_Cost_R1 = 100 * T1 * fuel_price\n// Fuel_Cost_R2 = 120 * T2 * fuel_price\n// Fuel_Cost_R3 = 140 * T3 * fuel_price\n// Fuel_Cost_R4 = 160 * T4 * fuel_price\n// Fuel_Cost_R5 = 180 * T5 * fuel_price\n// Time_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\n// Time_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\n// Time_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\n// Time_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\n// Time_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n// So, the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 10,000 liters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-3:\nThe total delivery time across all routes must not exceed 500 hours.\n// 5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500\n\n## Generate Constraint-4:\nThe company must deliver at least 500 packages, and each truck can carry 10 packages.\n// 10 * (T1 + T2 + T3 + T4 + T5) >= 500\n\n## Generate Constraint-5:\nThe number of trucks allocated to route 1 must be at least twice the number allocated to route 5.\n// T1 >= 2 * T5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route. The fuel consumption rates and delivery times for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/truck) | Delivery Time (hours/truck) |\n|-------|---------------------------------|-----------------------------|\n| R1    | 100                             | 5                           |\n| R2    | 120                             | 6                           |\n| R3    | 140                             | 7                           |\n| R4    | 160                             | 8                           |\n| R5    | 180                             | 9                           |\n\nThe company has a total of 100 trucks available. The total fuel consumption across all routes must not exceed 10,000 liters. The total delivery time across all routes must not exceed 500 hours. The company must deliver at least 500 packages, and each truck can carry 10 packages. The number of trucks allocated to route 1 must be at least twice the number allocated to route 5.\n\nPlease help the company to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nfuel_price = 1  # assuming fuel price per liter\nhourly_cost_of_downtime = 1  # assuming hourly cost of downtime\n\nFuel_Cost_R1 = 100 * T1 * fuel_price\nFuel_Cost_R2 = 120 * T2 * fuel_price\nFuel_Cost_R3 = 140 * T3 * fuel_price\nFuel_Cost_R4 = 160 * T4 * fuel_price\nFuel_Cost_R5 = 180 * T5 * fuel_price\n\nTime_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\nTime_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\nTime_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\nTime_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\nTime_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5 + Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500)\nmodel.addCons(10 * (T1 + T2 + T3 + T4 + T5) >= 500)\nmodel.addCons(T1 >= 2 * T5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1435,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices. The company needs to decide the number of each device to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of device 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of device 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of device 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"raw material usage for device 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"raw material usage for device 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"raw material usage for device 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of device 1 is $50, device 2 is $70, and device 3 is $90. The company wants to maximize the total profit from selling these devices.\n// The objective function is: Maximize P = 50 * D1 + 70 * D2 + 90 * D3\n\n## Generate Constraint-1:\nThe total raw material usage must not exceed 1000 units. The usage for device 1 is R1 units, device 2 is R2 units, and device 3 is R3 units.\n// R1 * D1 + R2 * D2 + R3 * D3 <= 1000\n\n## Generate Constraint-2:\nThe production capacity for device 1 is limited to 50 units, device 2 to 70 units, and device 3 to 90 units.\n// D1 <= 50; D2 <= 70; D3 <= 90\n\n## Generate Constraint-3:\nThe relationship between the number of devices produced and the raw material usage is nonlinear. For each device, the raw material usage increases nonlinearly with the number of devices produced:\n// R1 = 0.1 * D1^2\n// R2 = 0.2 * D2^2\n// R3 = 0.3 * D3^2\n\n## Generate Constraint-4:\nThe company must produce at least 10 units of each device to meet contractual obligations.\n// D1 >= 10; D2 >= 10; D3 >= 10",
        "question": "A manufacturing company produces three types of electronic devices. The company needs to decide the number of each device to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit per unit of device 1 is $50, device 2 is $70, and device 3 is $90. The company wants to maximize the total profit from selling these devices.\nThe total raw material usage must not exceed 1000 units. The usage for device 1 is R1 units, device 2 is R2 units, and device 3 is R3 units. The production capacity for device 1 is limited to 50 units, device 2 to 70 units, and device 3 to 90 units. The relationship between the number of devices produced and the raw material usage is nonlinear. For each device, the raw material usage increases nonlinearly with the number of devices produced: R1 = 0.1 * D1^2, R2 = 0.2 * D2^2, R3 = 0.3 * D3^2. The company must produce at least 10 units of each device to meet contractual obligations.\nPlease help the company determine the optimal number of each device to produce to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=10, ub=50) # number of device 1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=10, ub=70) # number of device 2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=10, ub=90) # number of device 3\n\n# Define objective function\n## The objective function is: Maximize P = 50 * D1 + 70 * D2 + 90 * D3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * D1 + 70 * D2 + 90 * D3)\n\n# Add constraints\n## R1 = 0.1 * D1^2\n## R2 = 0.2 * D2^2\n## R3 = 0.3 * D3^2\n## R1 * D1 + R2 * D2 + R3 * D3 <= 1000\nmodel.addCons(0.1 * D1**2 * D1 + 0.2 * D2**2 * D2 + 0.3 * D3**2 * D3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(D1))\n    print(\"Number of Device 2: \", model.getVal(D2))\n    print(\"Number of Device 3: \", model.getVal(D3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in kilometers per liter (km/L).\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks\": \"SmallEfficiency\", \"range\": \"SmallEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks\": \"MediumEfficiency\", \"range\": \"MediumEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks\": \"LargeEfficiency\", \"range\": \"LargeEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total annual fuel cost, considering the distance traveled by each type of truck and the fuel price per liter. The fuel price is $1.50 per liter, and the annual distance traveled by each small, medium, and large truck is 100,000 km, 120,000 km, and 150,000 km respectively.\n// FuelCost_Small = 100000 * SmallTrucks / SmallEfficiency * 1.50\n// FuelCost_Medium = 120000 * MediumTrucks / MediumEfficiency * 1.50\n// FuelCost_Large = 150000 * LargeTrucks / LargeEfficiency * 1.50\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// SmallTrucks * 50000 + MediumTrucks * 75000 + LargeTrucks * 100000 <= 2000000\n\n## Generate Constraint-2:\nThe total weight capacity of all trucks must not exceed 500,000 kg.\n// SmallTrucks * 10000 + MediumTrucks * 15000 + LargeTrucks * 20000 <= 500000\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the fleet is composed of small trucks.\n// SmallTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the fuel efficiency of each type of truck. The fuel efficiency is measured in kilometers per liter (km/L). The company aims to minimize the total annual fuel cost, considering the distance traveled by each type of truck and the fuel price per liter. The fuel price is $1.50 per liter, and the annual distance traveled by each small, medium, and large truck is 100,000 km, 120,000 km, and 150,000 km respectively. The company has a budget of $2,000,000 for purchasing trucks. The total weight capacity of all trucks must not exceed 500,000 kg. The company must ensure that at least 10% of the fleet is composed of small trucks. Please help the company to determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total annual fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallEfficiency\", lb=0)\nMediumEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumEfficiency\", lb=0)\nLargeEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeEfficiency\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Small = 100000 * SmallTrucks / SmallEfficiency * 1.50\nFuelCost_Medium = 120000 * MediumTrucks / MediumEfficiency * 1.50\nFuelCost_Large = 150000 * LargeTrucks / LargeEfficiency * 1.50\n## convert the division to multiplication\nmodel.addCons(obj == FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 2000000)\n## The total weight capacity of all trucks must not exceed 500,000 kg.\nmodel.addCons(10000 * SmallTrucks + 15000 * MediumTrucks + 20000 * LargeTrucks <= 500000)\n## The company must ensure that at least 10% of the fleet is composed of small trucks.\nmodel.addCons(SmallTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Fuel Efficiency of Small Trucks: \", model.getVal(SmallEfficiency))\n    print(\"Fuel Efficiency of Medium Trucks: \", model.getVal(MediumEfficiency))\n    print(\"Fuel Efficiency of Large Trucks: \", model.getVal(LargeEfficiency))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: A, B, C, and D. The company needs to determine the optimal production quantities for each component to maximize its profit while considering various constraints.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for component A is $30, for B is $40, for C is $50, and for D is $60. The production cost per unit for A is $10, for B is $20, for C is $30, and for D is $40. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Profit per unit of A: Profit_A = (30 - 10) * A = 20 * A\n// Profit per unit of B: Profit_B = (40 - 20) * B = 20 * B\n// Profit per unit of C: Profit_C = (50 - 30) * C = 20 * C\n// Profit per unit of D: Profit_D = (60 - 40) * D = 20 * D\n// Objective function: Maximize (20 * A + 20 * B + 20 * C + 20 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C + 40 * D <= 5000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 150 hours. The production time for A is 2 hours, for B is 3 hours, for C is 4 hours, and for D is 5 hours.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 150",
        "question": "A manufacturing company produces four types of electronic components: A, B, C, and D. The company needs to determine the optimal production quantities for each component to maximize its profit while considering various constraints. The profit per unit and production cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit |\n|-----------|-----------------|--------------------------|\n| A         | $30             | $10                      |\n| B         | $40             | $20                      |\n| C         | $50             | $30                      |\n| D         | $60             | $40                      |\n\nThe company has a budget of $5000 for production costs. The company also has a limited production capacity of 150 hours, with the production time for A being 2 hours, for B being 3 hours, for C being 4 hours, and for D being 5 hours. \n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Objective function: Maximize (20 * A + 20 * B + 20 * C + 20 * D)\nmodel.addCons(obj == 20 * A + 20 * B + 20 * C + 20 * D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C + 40 * D <= 5000)\n## The company has a limited production capacity of 150 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 5 different machines. The plant manager needs to determine the optimal power settings for each machine to maximize efficiency while minimizing energy consumption.\n// {\"power setting for machine 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"power setting for machine 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"power setting for machine 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n// {\"power setting for machine 4\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"real\"}\n// {\"power setting for machine 5\": \"P5\", \"range\": \"0 <= P5 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine's efficiency increases with power up to a point, then decreases. The efficiency function for each machine is given by:\n- Machine 1: E1 = P1 / (P1^2 + 1)\n- Machine 2: E2 = P2 / (P2^2 + 1)\n- Machine 3: E3 = P3 / (P3^2 + 1)\n- Machine 4: E4 = P4 / (P4^2 + 1)\n- Machine 5: E5 = P5 / (P5^2 + 1)\nThe total energy consumption is given by: C = P1 + P2 + P3 + P4 + P5\nThe objective is to maximize the total efficiency of all machines while keeping the total energy consumption below a certain threshold.\n// Objective function: Maximize E = E1 + E2 + E3 + E4 + E5 subject to C <= 300\n\n## Generate Constraint-1:\nThe total energy consumption must not exceed 300 units.\n// P1 + P2 + P3 + P4 + P5 <= 300\n\n## Generate Constraint-2:\nEach machine must operate within its specified power range.\n// 0 <= P1 <= 100; 0 <= P2 <= 100; 0 <= P3 <= 100; 0 <= P4 <= 100; 0 <= P5 <= 100\n\n## Generate Constraint-3:\nThe plant must maintain a minimum efficiency level for each machine.\n// E1 >= 0.1; E2 >= 0.1; E3 >= 0.1; E4 >= 0.1; E5 >= 0.1",
        "question": "A manufacturing plant produces electronic components using 5 different machines. The plant manager needs to determine the optimal power settings for each machine to maximize efficiency while minimizing energy consumption. The efficiency function for each machine is given by:\n- Machine 1: E1 = P1 / (P1^2 + 1)\n- Machine 2: E2 = P2 / (P2^2 + 1)\n- Machine 3: E3 = P3 / (P3^2 + 1)\n- Machine 4: E4 = P4 / (P4^2 + 1)\n- Machine 5: E5 = P5 / (P5^2 + 1)\nThe total energy consumption is given by: C = P1 + P2 + P3 + P4 + P5\n\nThe plant has the following constraints:\n- The total energy consumption must not exceed 300 units.\n- Each machine must operate within its specified power range (0 to 100 units).\n- The plant must maintain a minimum efficiency level of 0.1 for each machine.\n\nPlease help the plant manager to maximize the total efficiency of all machines (E = E1 + E2 + E3 + E4 + E5) while keeping the total energy consumption below 300 units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # power setting for machine 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # power setting for machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # power setting for machine 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=0, ub=100) # power setting for machine 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=0, ub=100) # power setting for machine 5\n\n# Define objective function\nE1 = P1 / (P1**2 + 1)\nE2 = P2 / (P2**2 + 1)\nE3 = P3 / (P3**2 + 1)\nE4 = P4 / (P4**2 + 1)\nE5 = P5 / (P5**2 + 1)\nE = E1 + E2 + E3 + E4 + E5\nC = P1 + P2 + P3 + P4 + P5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E)\n\n# Add constraints\nmodel.addCons(C <= 300) # total energy consumption must not exceed 300 units\nmodel.addCons(E1 >= 0.1) # minimum efficiency level for each machine\nmodel.addCons(E2 >= 0.1)\nmodel.addCons(E3 >= 0.1)\nmodel.addCons(E4 >= 0.1)\nmodel.addCons(E5 >= 0.1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Power Setting for Machine 1: \", model.getVal(P1))\n    print(\"Power Setting for Machine 2: \", model.getVal(P2))\n    print(\"Power Setting for Machine 3: \", model.getVal(P3))\n    print(\"Power Setting for Machine 4: \", model.getVal(P4))\n    print(\"Power Setting for Machine 5: \", model.getVal(P5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Quantity\", \"range\": \"DeviceD_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceE_Quantity\", \"range\": \"DeviceE_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. \nThe profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units.\nThe profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units.\nThe profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all devices.\n// Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\n// Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\n// Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\n// Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\n// Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for each device decreases as more units are produced beyond certain thresholds, as shown in the following Table.\n\n| Device | Profit per Unit (First Threshold) | Decrease per Unit Beyond Threshold | Threshold |\n|--------|----------------------------------|------------------------------------|-----------|\n| DeviceA | $50                             | $0.1                               | 100 units  |\n| DeviceB | $70                             | $0.2                               | 200 units  |\n| DeviceC | $90                             | $0.3                               | 300 units  |\n| DeviceD | $60                             | $0.15                              | 150 units  |\n| DeviceE | $80                             | $0.25                              | 250 units  |\n\nThe company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\nDeviceD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity\", lb=0)\nDeviceE_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\nDeviceA_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity1\", lb=0, ub=100)\nDeviceA_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA_Quantity == DeviceA_Quantity1*DeviceA_b1 + DeviceA_Quantity2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * (DeviceA_Quantity2 - 100)) * DeviceA_Quantity2 * DeviceA_b2 + 50 * DeviceA_Quantity1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\nDeviceB_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity1\", lb=0, ub=200)\nDeviceB_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB_Quantity == DeviceB_Quantity1*DeviceB_b1 + DeviceB_Quantity2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.2 * (DeviceB_Quantity2 - 200)) * DeviceB_Quantity2 * DeviceB_b2 + 70 * DeviceB_Quantity1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\nDeviceC_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity1\", lb=0, ub=300)\nDeviceC_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity2\", lb=300, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC_Quantity == DeviceC_Quantity1*DeviceC_b1 + DeviceC_Quantity2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.3 * (DeviceC_Quantity2 - 300)) * DeviceC_Quantity2 * DeviceC_b2 + 90 * DeviceC_Quantity1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\nDeviceD_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity1\", lb=0, ub=150)\nDeviceD_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity2\", lb=150, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceD_Quantity == DeviceD_Quantity1*DeviceD_b1 + DeviceD_Quantity2*DeviceD_b2)\nProfit_DeviceD = (60 - 0.15 * (DeviceD_Quantity2 - 150)) * DeviceD_Quantity2 * DeviceD_b2 + 60 * DeviceD_Quantity1 * DeviceD_b1\n## create piecewise variables for piecewise function: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\nDeviceE_Quantity1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity1\", lb=0, ub=250)\nDeviceE_Quantity2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity2\", lb=250, ub=1000)\nDeviceE_b1 = model.addVar(vtype=\"B\", name=\"DeviceE_b1\")\nDeviceE_b2 = model.addVar(vtype=\"B\", name=\"DeviceE_b2\")\nmodel.addCons(DeviceE_b1 + DeviceE_b2 == 1)\nmodel.addCons(DeviceE_Quantity == DeviceE_Quantity1*DeviceE_b1 + DeviceE_Quantity2*DeviceE_b2)\nProfit_DeviceE = (80 - 0.25 * (DeviceE_Quantity2 - 250)) * DeviceE_Quantity2 * DeviceE_b2 + 80 * DeviceE_Quantity1 * DeviceE_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000)\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Quantity of DeviceD: \", model.getVal(DeviceD_Quantity))\n    print(\"Quantity of DeviceE: \", model.getVal(DeviceE_Quantity))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in technology upgrades, which will reduce the cost of production per unit for that product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in technology upgrades for that product. The initial cost of production per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * TechUpgradeA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * TechUpgradeB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * TechUpgradeC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in technology upgrades, which will reduce the cost of production per unit for that product. The cost of production per unit decreases by $5 for every $1000 invested in technology upgrades for that product. The initial cost of production per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products. The total resources available for production are limited to 1000 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0)  # investment in technology upgrades for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # investment in technology upgrades for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0)  # investment in technology upgrades for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * TechUpgradeA) * QuantityA\nProfitB = (250 - 150 + 0.005 * TechUpgradeB) * QuantityB\nProfitC = (300 - 200 + 0.005 * TechUpgradeC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resources allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in technology upgrades for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Investment in technology upgrades for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Investment in technology upgrades for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n// Total energy production: Energy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\n// Total environmental impact: Impact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 for the construction of these facilities.\n// Cost of solar facilities: 100,000 * Solar\n// Cost of wind facilities: 150,000 * Wind\n// Cost of hydro facilities: 200,000 * Hydro\n// Cost of biomass facilities: 80,000 * Biomass\n// Cost of geothermal facilities: 250,000 * Geothermal\n// Total cost: 100,000 * Solar + 150,000 * Wind + 200,000 * Hydro + 80,000 * Biomass + 250,000 * Geothermal <= 5,000,000\n\n## Generate Constraint-2:\nThe city has a land area constraint that limits the total number of facilities to 50.\n// Solar + Wind + Hydro + Biomass + Geothermal <= 50\n\n## Generate Constraint-3:\nThe city wants to ensure a minimum energy production of 2000 MWh.\n// 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal >= 2000\n\n## Generate Constraint-4:\nDue to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5.\n// Geothermal - Hydro <= 5",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact. The energy production per unit and the environmental impact score for each type of facility are given in the following Table.\n\n| Facility Type | Energy Production per Unit (MWh) | Environmental Impact Score |\n|---------------|----------------------------------|----------------------------|\n| Solar         | 50                               | 10                         |\n| Wind          | 60                               | 12                         |\n| Hydro         | 70                               | 15                         |\n| Biomass       | 40                               | 8                          |\n| Geothermal    | 80                               | 18                         |\n\nThe city has a budget of $5,000,000 for the construction of these facilities. The city has a land area constraint that limits the total number of facilities to 50. The city wants to ensure a minimum energy production of 2000 MWh. Due to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5.\n\nPlease help the city to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\nImpact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $5,000,000 for the construction of these facilities.\nmodel.addCons(100000 * Solar + 150000 * Wind + 200000 * Hydro + 80000 * Biomass + 250000 * Geothermal <= 5000000)\n## The city has a land area constraint that limits the total number of facilities to 50.\nmodel.addCons(Solar + Wind + Hydro + Biomass + Geothermal <= 50)\n## The city wants to ensure a minimum energy production of 2000 MWh.\nmodel.addCons(50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal >= 2000)\n## Due to zoning regulations, the number of geothermal facilities must not exceed the number of hydro facilities by more than 5.\nmodel.addCons(Geothermal - Hydro <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Maximized Energy-Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1485,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks assigned. Route 1 has a fuel efficiency of 10 - 0.1 * T1 (in km/liter), Route 2 has 12 - 0.12 * T2, Route 3 has 15 - 0.15 * T3, Route 4 has 11 - 0.11 * T4, and Route 5 has 9 - 0.09 * T5. The delivery time for each route is inversely proportional to the number of trucks, with Route 1 taking 500 / T1 hours, Route 2 taking 450 / T2 hours, Route 3 taking 400 / T3 hours, Route 4 taking 350 / T4 hours, and Route 5 taking 300 / T5 hours. The company wants to minimize the total cost of fuel and time.\n// Fuel_Cost = (1000 / (10 - 0.1 * T1)) * T1 + (1000 / (12 - 0.12 * T2)) * T2 + (1000 / (15 - 0.15 * T3)) * T3 + (1000 / (11 - 0.11 * T4)) * T4 + (1000 / (9 - 0.09 * T5)) * T5\n// Time_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n// So, the objective function is: Minimize (Fuel_Cost + Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 10 trucks.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-3:\nThe minimum fuel efficiency for any route must be at least 5 km/liter.\n// 10 - 0.1 * T1 >= 5; 12 - 0.12 * T2 >= 5; 15 - 0.15 * T3 >= 5; 11 - 0.11 * T4 >= 5; 9 - 0.09 * T5 >= 5",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route varies with the number of trucks assigned, and the delivery time for each route is inversely proportional to the number of trucks. The details for each route are given in the following Table.\n\n| Route | Fuel Efficiency (km/liter) | Delivery Time (hours) |\n|-------|---------------------------|-----------------------|\n| 1     | 10 - 0.1 * T1             | 500 / T1              |\n| 2     | 12 - 0.12 * T2            | 450 / T2              |\n| 3     | 15 - 0.15 * T3            | 400 / T3              |\n| 4     | 11 - 0.11 * T4            | 350 / T4              |\n| 5     | 9 - 0.09 * T5             | 300 / T5              |\n\nThe company has a total of 50 trucks available. Each route can handle a maximum of 10 trucks. The minimum fuel efficiency for any route must be at least 5 km/liter. The company wants to minimize the total cost of fuel and time. Please help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=10) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=10) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=10) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=10) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## calculate fuel efficiency and cost\nFuel_Efficiency_1 = 10 - 0.1 * T1\nFuel_Efficiency_2 = 12 - 0.12 * T2\nFuel_Efficiency_3 = 15 - 0.15 * T3\nFuel_Efficiency_4 = 11 - 0.11 * T4\nFuel_Efficiency_5 = 9 - 0.09 * T5\nFuel_Cost = (1000 / Fuel_Efficiency_1) * T1 + (1000 / Fuel_Efficiency_2) * T2 + (1000 / Fuel_Efficiency_3) * T3 + (1000 / Fuel_Efficiency_4) * T4 + (1000 / Fuel_Efficiency_5) * T5\n\n## calculate delivery time and cost\nTime_Cost = 500 / T1 + 450 / T2 + 400 / T3 + 350 / T4 + 300 / T5\n\n## the objective function is: Minimize (Fuel_Cost + Time_Cost)\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Cost + Time_Cost)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n## Each route can handle a maximum of 10 trucks.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n\n## The minimum fuel efficiency for any route must be at least 5 km/liter.\nmodel.addCons(10 - 0.1 * T1 >= 5)\nmodel.addCons(12 - 0.12 * T2 >= 5)\nmodel.addCons(15 - 0.15 * T3 >= 5)\nmodel.addCons(11 - 0.11 * T4 >= 5)\nmodel.addCons(9 - 0.09 * T5 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, a botanical garden, and a water feature. The city needs to determine the area (in square meters) allocated to each facility.\n// {\"area for playground\": \"Playground\", \"range\": \"Playground >= 0\", \"type\": \"real\"}\n// {\"area for sports field\": \"SportsField\", \"range\": \"SportsField >= 0\", \"type\": \"real\"}\n// {\"area for picnic area\": \"PicnicArea\", \"range\": \"PicnicArea >= 0\", \"type\": \"real\"}\n// {\"area for botanical garden\": \"BotanicalGarden\", \"range\": \"BotanicalGarden >= 0\", \"type\": \"real\"}\n// {\"area for water feature\": \"WaterFeature\", \"range\": \"WaterFeature >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe city wants to maximize the utility of the park. The utility function is defined as follows:\n- Playground: Utility = 10 * sqrt(Playground)\n- SportsField: Utility = 15 * sqrt(SportsField)\n- PicnicArea: Utility = 8 * sqrt(PicnicArea)\n- BotanicalGarden: Utility = 12 * sqrt(BotanicalGarden)\n- WaterFeature: Utility = 9 * sqrt(WaterFeature)\nThe objective is to maximize the total utility of the park.\n// So, the objective function is: Maximize (10 * sqrt(Playground) + 15 * sqrt(SportsField) + 8 * sqrt(PicnicArea) + 12 * sqrt(BotanicalGarden) + 9 * sqrt(WaterFeature))\n\n## Generate Constraint-1:\nThe total area available for the park is 5000 square meters.\n// Playground + SportsField + PicnicArea + BotanicalGarden + WaterFeature <= 5000\n\n## Generate Constraint-2:\nThe minimum area required for the playground is 500 square meters.\n// Playground >= 500\n\n## Generate Constraint-3:\nThe maximum area that can be allocated to the water feature is 1000 square meters.\n// WaterFeature <= 1000",
        "question": "A city is planning to build a new park with various facilities including a playground, a sports field, a picnic area, a botanical garden, and a water feature. The city needs to determine the area (in square meters) allocated to each facility. The city wants to maximize the utility of the park, where the utility function is defined as follows:\n- Playground: Utility = 10 * sqrt(Playground)\n- SportsField: Utility = 15 * sqrt(SportsField)\n- PicnicArea: Utility = 8 * sqrt(PicnicArea)\n- BotanicalGarden: Utility = 12 * sqrt(BotanicalGarden)\n- WaterFeature: Utility = 9 * sqrt(WaterFeature)\nThe total area available for the park is 5000 square meters. The minimum area required for the playground is 500 square meters. The maximum area that can be allocated to the water feature is 1000 square meters.\nPlease help the city to maximize the total utility of the park.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPlayground = model.addVar(vtype=\"CONTINUOUS\", name=\"Playground\", lb=500)  # area for playground\nSportsField = model.addVar(vtype=\"CONTINUOUS\", name=\"SportsField\")  # area for sports field\nPicnicArea = model.addVar(vtype=\"CONTINUOUS\", name=\"PicnicArea\")  # area for picnic area\nBotanicalGarden = model.addVar(vtype=\"CONTINUOUS\", name=\"BotanicalGarden\")  # area for botanical garden\nWaterFeature = model.addVar(vtype=\"CONTINUOUS\", name=\"WaterFeature\", ub=1000)  # area for water feature\n\n# Define objective function\n# The utility function is defined as follows:\n# - Playground: Utility = 10 * sqrt(Playground)\n# - SportsField: Utility = 15 * sqrt(SportsField)\n# - PicnicArea: Utility = 8 * sqrt(PicnicArea)\n# - BotanicalGarden: Utility = 12 * sqrt(BotanicalGarden)\n# - WaterFeature: Utility = 9 * sqrt(WaterFeature)\n# The objective is to maximize the total utility of the park.\nUtility_Playground = 10 * model.addVar(vtype=\"CONTINUOUS\", name=\"Utility_Playground\")\nUtility_SportsField = 15 * model.addVar(vtype=\"CONTINUOUS\", name=\"Utility_SportsField\")\nUtility_PicnicArea = 8 * model.addVar(vtype=\"CONTINUOUS\", name=\"Utility_PicnicArea\")\nUtility_BotanicalGarden = 12 * model.addVar(vtype=\"CONTINUOUS\", name=\"Utility_BotanicalGarden\")\nUtility_WaterFeature = 9 * model.addVar(vtype=\"CONTINUOUS\", name=\"Utility_WaterFeature\")\n\n# Constraints to link utility variables with their respective areas\nmodel.addCons(Utility_Playground**2 == Playground)\nmodel.addCons(Utility_SportsField**2 == SportsField)\nmodel.addCons(Utility_PicnicArea**2 == PicnicArea)\nmodel.addCons(Utility_BotanicalGarden**2 == BotanicalGarden)\nmodel.addCons(Utility_WaterFeature**2 == WaterFeature)\n\n# Set objective as a variable\nobj = model.addVar(vtype=\"CONTINUOUS\", name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Utility_Playground + Utility_SportsField + Utility_PicnicArea + Utility_BotanicalGarden + Utility_WaterFeature)\n\n# Add constraints\nmodel.addCons(Playground + SportsField + PicnicArea + BotanicalGarden + WaterFeature <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Playground: \", model.getVal(Playground))\n    print(\"Area for Sports Field: \", model.getVal(SportsField))\n    print(\"Area for Picnic Area: \", model.getVal(PicnicArea))\n    print(\"Area for Botanical Garden: \", model.getVal(BotanicalGarden))\n    print(\"Area for Water Feature: \", model.getVal(WaterFeature))\n    print(\"Maximized Utility: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin.\n// {\"number of C1 cargo\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of C2 cargo\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of C3 cargo\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of C4 cargo\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of C5 cargo\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per unit is $100, the space required per unit is 5 cubic meters, and the handling cost per unit is $20.\nFor C2, the profit per unit is $150, the space required per unit is 7 cubic meters, and the handling cost per unit is $30.\nFor C3, the profit per unit is $200, the space required per unit is 10 cubic meters, and the handling cost per unit is $40.\nFor C4, the profit per unit is $250, the space required per unit is 12 cubic meters, and the handling cost per unit is $50.\nFor C5, the profit per unit is $300, the space required per unit is 15 cubic meters, and the handling cost per unit is $60.\nThe company wants to maximize the profit per cubic meter of space used.\n// Profit_C1 = 100 * C1 - 20 * C1\n// Profit_C2 = 150 * C2 - 30 * C2\n// Profit_C3 = 200 * C3 - 40 * C3\n// Profit_C4 = 250 * C4 - 50 * C4\n// Profit_C5 = 300 * C5 - 60 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5)\n\n## Generate Constraint-1:\nThe company has a total storage space of 1000 cubic meters.\n// 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10000 for handling costs.\n// 20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000\n\n## Generate Constraint-3:\nThe company can handle a maximum of 200 units of cargo in total.\n// C1 + C2 + C3 + C4 + C5 <= 200\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\n// C1 <= 50",
        "question": "A logistics company needs to optimize its fleet usage for delivering five different types of cargo: C1, C2, C3, C4, and C5. Each type of cargo requires a different amount of space and has a different profit margin.\nFor C1, the profit per unit is $100, the space required per unit is 5 cubic meters, and the handling cost per unit is $20.\nFor C2, the profit per unit is $150, the space required per unit is 7 cubic meters, and the handling cost per unit is $30.\nFor C3, the profit per unit is $200, the space required per unit is 10 cubic meters, and the handling cost per unit is $40.\nFor C4, the profit per unit is $250, the space required per unit is 12 cubic meters, and the handling cost per unit is $50.\nFor C5, the profit per unit is $300, the space required per unit is 15 cubic meters, and the handling cost per unit is $60.\nThe company has a total storage space of 1000 cubic meters. The company has a budget of $10000 for handling costs. The company can handle a maximum of 200 units of cargo in total. The market demand for C1 is 50 units, so the company can only sell a maximum of 50 units of C1.\nPlease help the company to maximize the profit per cubic meter of space used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)  # number of C1 cargo\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0)  # number of C2 cargo\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0)  # number of C3 cargo\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0)  # number of C4 cargo\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0)  # number of C5 cargo\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (100 - 20) * C1\nProfit_C2 = (150 - 30) * C2\nProfit_C3 = (200 - 40) * C3\nProfit_C4 = (250 - 50) * C4\nProfit_C5 = (300 - 60) * C5\nSpaceUsed = 5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / SpaceUsed\n## convert the division to multiplication\nmodel.addCons(obj * SpaceUsed == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total storage space of 1000 cubic meters.\nmodel.addCons(5 * C1 + 7 * C2 + 10 * C3 + 12 * C4 + 15 * C5 <= 1000)\n## The company has a budget of $10000 for handling costs.\nmodel.addCons(20 * C1 + 30 * C2 + 40 * C3 + 50 * C4 + 60 * C5 <= 10000)\n## The company can handle a maximum of 200 units of cargo in total.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of C1 Cargo: \", model.getVal(C1))\n    print(\"Number of C2 Cargo: \", model.getVal(C2))\n    print(\"Number of C3 Cargo: \", model.getVal(C3))\n    print(\"Number of C4 Cargo: \", model.getVal(C4))\n    print(\"Number of C5 Cargo: \", model.getVal(C5))\n    print(\"Maximized Profit per Cubic Meter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"SpecialtyTrucks\", \"range\": \"SpecialtyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type varies with the number of trucks in operation. Small trucks have a base fuel efficiency of 20 km/l, Medium trucks 15 km/l, Large trucks 10 km/l, Extra-Large trucks 8 km/l, and Specialty trucks 5 km/l. The fuel efficiency improves by 0.1 km/l for each additional truck of the same type beyond the first 10 trucks. The company wants to minimize the total fuel consumption while meeting customer demand.\n// Fuel_Small = (20 + 0.1 * max(SmallTrucks - 10, 0)) * SmallTrucks\n// Fuel_Medium = (15 + 0.1 * max(MediumTrucks - 10, 0)) * MediumTrucks\n// Fuel_Large = (10 + 0.1 * max(LargeTrucks - 10, 0)) * LargeTrucks\n// Fuel_ExtraLarge = (8 + 0.1 * max(ExtraLargeTrucks - 10, 0)) * ExtraLargeTrucks\n// Fuel_Specialty = (5 + 0.1 * max(SpecialtyTrucks - 10, 0)) * SpecialtyTrucks\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe company has a total fleet size of 100 trucks.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. They need to determine the optimal number of each type of truck to maximize their operational efficiency while minimizing fuel costs and meeting customer demand. The fuel efficiency of each truck type varies with the number of trucks in operation. The base fuel efficiency and the improvement in fuel efficiency for each additional truck beyond the first 10 are given in the following Table.\n\n| Truck Type        | Base Fuel Efficiency | Improvement in Fuel Efficiency |\n|-------------------|----------------------|--------------------------------|\n| Small             | 20 km/l              | 0.1 km/l for each additional truck beyond 10 |\n| Medium            | 15 km/l              | 0.1 km/l for each additional truck beyond 10 |\n| Large             | 10 km/l              | 0.1 km/l for each additional truck beyond 10 |\n| Extra-Large       | 8 km/l               | 0.1 km/l for each additional truck beyond 10 |\n| Specialty         | 5 km/l               | 0.1 km/l for each additional truck beyond 10 |\n\nThe company has a total fleet size of 100 trucks. The company wants to minimize the total fuel consumption while meeting customer demand. Please help the company to determine the optimal number of each type of truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nSpecialtyTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_Small = (20 + 0.1 * max(SmallTrucks - 10, 0)) * SmallTrucks\nSmallTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks1\", lb=0, ub=10)\nSmallTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks2\", lb=10, ub=100)\nSmall_b1 = model.addVar(vtype=\"B\", name=\"Small_b1\")\nSmall_b2 = model.addVar(vtype=\"B\", name=\"Small_b2\")\nmodel.addCons(Small_b1 + Small_b2 == 1)\nmodel.addCons(SmallTrucks == SmallTrucks1*Small_b1 + SmallTrucks2*Small_b2)\nFuel_Small = (20 + 0.1 * (SmallTrucks2 - 10)) * SmallTrucks2 * Small_b2\n\n## create piecewise variables for piecewise function: Fuel_Medium = (15 + 0.1 * max(MediumTrucks - 10, 0)) * MediumTrucks\nMediumTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks1\", lb=0, ub=10)\nMediumTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks2\", lb=10, ub=100)\nMedium_b1 = model.addVar(vtype=\"B\", name=\"Medium_b1\")\nMedium_b2 = model.addVar(vtype=\"B\", name=\"Medium_b2\")\nmodel.addCons(Medium_b1 + Medium_b2 == 1)\nmodel.addCons(MediumTrucks == MediumTrucks1*Medium_b1 + MediumTrucks2*Medium_b2)\nFuel_Medium = (15 + 0.1 * (MediumTrucks2 - 10)) * MediumTrucks2 * Medium_b2\n\n## create piecewise variables for piecewise function: Fuel_Large = (10 + 0.1 * max(LargeTrucks - 10, 0)) * LargeTrucks\nLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks1\", lb=0, ub=10)\nLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks2\", lb=10, ub=100)\nLarge_b1 = model.addVar(vtype=\"B\", name=\"Large_b1\")\nLarge_b2 = model.addVar(vtype=\"B\", name=\"Large_b2\")\nmodel.addCons(Large_b1 + Large_b2 == 1)\nmodel.addCons(LargeTrucks == LargeTrucks1*Large_b1 + LargeTrucks2*Large_b2)\nFuel_Large = (10 + 0.1 * (LargeTrucks2 - 10)) * LargeTrucks2 * Large_b2\n\n## create piecewise variables for piecewise function: Fuel_ExtraLarge = (8 + 0.1 * max(ExtraLargeTrucks - 10, 0)) * ExtraLargeTrucks\nExtraLargeTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks1\", lb=0, ub=10)\nExtraLargeTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks2\", lb=10, ub=100)\nExtraLarge_b1 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b1\")\nExtraLarge_b2 = model.addVar(vtype=\"B\", name=\"ExtraLarge_b2\")\nmodel.addCons(ExtraLarge_b1 + ExtraLarge_b2 == 1)\nmodel.addCons(ExtraLargeTrucks == ExtraLargeTrucks1*ExtraLarge_b1 + ExtraLargeTrucks2*ExtraLarge_b2)\nFuel_ExtraLarge = (8 + 0.1 * (ExtraLargeTrucks2 - 10)) * ExtraLargeTrucks2 * ExtraLarge_b2\n\n## create piecewise variables for piecewise function: Fuel_Specialty = (5 + 0.1 * max(SpecialtyTrucks - 10, 0)) * SpecialtyTrucks\nSpecialtyTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks1\", lb=0, ub=10)\nSpecialtyTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"SpecialtyTrucks2\", lb=10, ub=100)\nSpecialty_b1 = model.addVar(vtype=\"B\", name=\"Specialty_b1\")\nSpecialty_b2 = model.addVar(vtype=\"B\", name=\"Specialty_b2\")\nmodel.addCons(Specialty_b1 + Specialty_b2 == 1)\nmodel.addCons(SpecialtyTrucks == SpecialtyTrucks1*Specialty_b1 + SpecialtyTrucks2*Specialty_b2)\nFuel_Specialty = (5 + 0.1 * (SpecialtyTrucks2 - 10)) * SpecialtyTrucks2 * Specialty_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The company has a total fleet size of 100 trucks.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + SpecialtyTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Specialty Trucks: \", model.getVal(SpecialtyTrucks))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1358,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. Additionally, the company can invest in route optimization software for each city, which affects the fuel efficiency and travel time.\n// {\"number of trips from City1 to City2\": \"Trips12\", \"range\": \"Trips12 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City3\": \"Trips13\", \"range\": \"Trips13 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City4\": \"Trips14\", \"range\": \"Trips14 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City5\": \"Trips15\", \"range\": \"Trips15 >= 0\", \"type\": \"integer\"}\n// {\"investment in route optimization software for City1\": \"Software1\", \"range\": \"Software1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City2\": \"Software2\", \"range\": \"Software2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City3\": \"Software3\", \"range\": \"Software3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City4\": \"Software4\", \"range\": \"Software4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City5\": \"Software5\", \"range\": \"Software5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is affected by the investment in route optimization software. For each $1,000 invested in software, the fuel consumption per trip decreases by 0.1 liters. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for trips from City1 to City2: Fuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\n// Fuel consumption for trips from City1 to City3: Fuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\n// Fuel consumption for trips from City1 to City4: Fuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\n// Fuel consumption for trips from City1 to City5: Fuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n// So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investing in route optimization software.\n// Software1 + Software2 + Software3 + Software4 + Software5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips that can be made in a month is limited to 500.\n// Trips12 + Trips13 + Trips14 + Trips15 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3.\n// Trips12 >= 100; Trips13 >= 50\n\n## Generate Constraint-4:\nThe investment in software for each city must not exceed $30,000.\n// Software1 <= 30000; Software2 <= 30000; Software3 <= 30000; Software4 <= 30000; Software5 <= 30000",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities and the investment in route optimization software for each city to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. The fuel consumption per trip decreases by 0.1 liters for each $1,000 invested in software. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. The company has a total budget of $100,000 for investing in route optimization software and a limit of 500 total trips that can be made in a month. Due to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3. The investment in software for each city must not exceed $30,000. Please help the company to minimize the total fuel consumption across all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips12 = model.addVar(vtype=\"INTEGER\", name=\"Trips12\", lb=100)  # number of trips from City1 to City2\nTrips13 = model.addVar(vtype=\"INTEGER\", name=\"Trips13\", lb=50)   # number of trips from City1 to City3\nTrips14 = model.addVar(vtype=\"INTEGER\", name=\"Trips14\", lb=0)    # number of trips from City1 to City4\nTrips15 = model.addVar(vtype=\"INTEGER\", name=\"Trips15\", lb=0)    # number of trips from City1 to City5\nSoftware1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software1\", lb=0)  # investment in route optimization software for City1\nSoftware2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software2\", lb=0)  # investment in route optimization software for City2\nSoftware3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software3\", lb=0)  # investment in route optimization software for City3\nSoftware4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software4\", lb=0)  # investment in route optimization software for City4\nSoftware5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software5\", lb=0)  # investment in route optimization software for City5\n\n# Define objective function\nFuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\nFuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\nFuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\nFuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n# So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n# Add constraints\nmodel.addCons(Software1 + Software2 + Software3 + Software4 + Software5 <= 100000)  # total budget for software\nmodel.addCons(Trips12 + Trips13 + Trips14 + Trips15 <= 500)  # total number of trips\nmodel.addCons(Trips12 >= 100)  # minimum trips from City1 to City2\nmodel.addCons(Trips13 >= 50)   # minimum trips from City1 to City3\nmodel.addCons(Software1 <= 30000)  # maximum investment in software for City1\nmodel.addCons(Software2 <= 30000)  # maximum investment in software for City2\nmodel.addCons(Software3 <= 30000)  # maximum investment in software for City3\nmodel.addCons(Software4 <= 30000)  # maximum investment in software for City4\nmodel.addCons(Software5 <= 30000)  # maximum investment in software for City5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips from City1 to City2: \", model.getVal(Trips12))\n    print(\"Number of Trips from City1 to City3: \", model.getVal(Trips13))\n    print(\"Number of Trips from City1 to City4: \", model.getVal(Trips14))\n    print(\"Number of Trips from City1 to City5: \", model.getVal(Trips15))\n    print(\"Investment in Software for City1: \", model.getVal(Software1))\n    print(\"Investment in Software for City2: \", model.getVal(Software2))\n    print(\"Investment in Software for City3: \", model.getVal(Software3))\n    print(\"Investment in Software for City4: \", model.getVal(Software4))\n    print(\"Investment in Software for City5: \", model.getVal(Software5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the number of labor hours allocated to each device to maximize profit while considering various costs and constraints. The profit per unit and labor cost per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Labor Cost per Hour |\n|--------|-----------------|---------------------|\n| DeviceA | $100            | $20                 |\n| DeviceB | $150            | $20                 |\n| DeviceC | $200            | $20                 |\n\nThe company has a total of 1000 labor hours available for the month. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs. Please help the company determine the optimal number of units to produce for each device and the corresponding labor hours to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\n// Corn <= Wheat + Soybeans\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\n// Barley <= Corn + Wheat + Soybeans\n\n## Generate Constraint-5:\nThe farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops.\n// Oats <= Corn + Wheat + Soybeans + Barley",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer wants to maximize his profit per acre of land, considering the profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk. The farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans. The farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans. The farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops. Please help the farmer to maximize the Profit-Risk ratio per acre.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\nmodel.addCons(Corn <= Wheat + Soybeans)\n## The farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\nmodel.addCons(Barley <= Corn + Wheat + Soybeans)\n## The farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops.\nmodel.addCons(Oats <= Corn + Wheat + Soybeans + Barley)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1216,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to small trucks\": \"RoutesSmall\", \"range\": \"RoutesSmall >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to medium trucks\": \"RoutesMedium\", \"range\": \"RoutesMedium >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to large trucks\": \"RoutesLarge\", \"range\": \"RoutesLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company aims to minimize the total daily operational and fuel costs.\n// FuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\n// OperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n// So, the objective function is: Minimize (FuelCost + OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000\n\n## Generate Constraint-2:\nThe total number of routes available is 1000.\n// RoutesSmall + RoutesMedium + RoutesLarge <= 1000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs. The fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company has a total budget of $50,000 for purchasing new trucks. The total number of routes available is 1000. Please help the company to minimize the total daily operational and fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nRoutesSmall = model.addVar(vtype=\"INTEGER\", name=\"RoutesSmall\", lb=0)  # number of routes assigned to small trucks\nRoutesMedium = model.addVar(vtype=\"INTEGER\", name=\"RoutesMedium\", lb=0)  # number of routes assigned to medium trucks\nRoutesLarge = model.addVar(vtype=\"INTEGER\", name=\"RoutesLarge\", lb=0)  # number of routes assigned to large trucks\n\n# Define objective function\nFuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\nOperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n# So, the objective function is: Minimize (FuelCost + OperationalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + OperationalCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000)\n# The total number of routes available is 1000.\nmodel.addCons(RoutesSmall + RoutesMedium + RoutesLarge <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Routes Assigned to Small Trucks: \", model.getVal(RoutesSmall))\n    print(\"Number of Routes Assigned to Medium Trucks: \", model.getVal(RoutesMedium))\n    print(\"Number of Routes Assigned to Large Trucks: \", model.getVal(RoutesLarge))\n    print(\"Minimized Total Daily Operational and Fuel Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for RouteA\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"continuous\"}\n// {\"speed of trucks for RouteB\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks.\n// Fuel cost for RouteA: FuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\n// Fuel cost for RouteB: FuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\n// Depreciation cost for RouteA: DepreciationCostA = 0.01 * TrucksA * SpeedA^2\n// Depreciation cost for RouteB: DepreciationCostB = 0.01 * TrucksB * SpeedB^2\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs.\n// TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route. The company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks. The company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs.\n\nPlease help the company to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for RouteB\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks for RouteA\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for RouteB\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # fuel efficiency of trucks for RouteA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # fuel efficiency of trucks for RouteB\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0)  # investment in fuel efficiency technology for RouteA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0)  # investment in fuel efficiency technology for RouteB\n\n# Define objective function\nFuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\nFuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\nDepreciationCostA = 0.01 * TrucksA * SpeedA**2\nDepreciationCostB = 0.01 * TrucksB * SpeedB**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Speed of Trucks for RouteA: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for RouteB: \", model.getVal(SpeedB))\n    print(\"Fuel Efficiency for RouteA: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency for RouteB: \", model.getVal(FuelEfficiencyB))\n    print(\"Tech Investment for RouteA: \", model.getVal(TechInvestA))\n    print(\"Tech Investment for RouteB: \", model.getVal(TechInvestB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit.\n// {\"hours machine 1 works on product 1\": \"M1P1\", \"range\": \"M1P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 1\": \"M2P1\", \"range\": \"M2P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 1\": \"M3P1\", \"range\": \"M3P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 1\": \"M4P1\", \"range\": \"M4P1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 2\": \"M1P2\", \"range\": \"M1P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 2\": \"M2P2\", \"range\": \"M2P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 2\": \"M3P2\", \"range\": \"M3P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 2\": \"M4P2\", \"range\": \"M4P2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 1 works on product 3\": \"M1P3\", \"range\": \"M1P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 works on product 3\": \"M2P3\", \"range\": \"M2P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 works on product 3\": \"M3P3\", \"range\": \"M3P3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 works on product 3\": \"M4P3\", \"range\": \"M4P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit contribution per hour for each product. The profit per hour for product 1 on machine 1 is $100, on machine 2 is $120, on machine 3 is $110, and on machine 4 is $130. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. The objective is to maximize the total profit from all products.\n// The objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n## Generate Constraint-1:\nEach machine can operate a maximum of 100 hours per week.\n// M1P1 + M1P2 + M1P3 <= 100; M2P1 + M2P2 + M2P3 <= 100; M3P1 + M3P2 + M3P3 <= 100; M4P1 + M4P2 + M4P3 <= 100\n\n## Generate Constraint-2:\nThe total production hours for product 1 must not exceed 150 hours.\n// M1P1 + M2P1 + M3P1 + M4P1 <= 150",
        "question": "A manufacturing plant produces three types of products using four different machines. The plant manager needs to allocate the number of hours each machine works on each product to maximize profit. Each machine has a different efficiency and profit contribution per hour for each product. The profit per hour for product 1 on machine 1 is $100, on machine 2 is $120, on machine 3 is $110, and on machine 4 is $130. For product 2, the profits are $150, $160, $140, and $170 respectively. For product 3, the profits are $200, $210, $190, and $220 respectively. The objective is to maximize the total profit from all products. Each machine can operate a maximum of 100 hours per week. The total production hours for product 1 must not exceed 150 hours. Please help the plant manager to determine the optimal allocation of hours for each machine on each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P1\", lb=0) # hours machine 1 works on product 1\nM2P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P1\", lb=0) # hours machine 2 works on product 1\nM3P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P1\", lb=0) # hours machine 3 works on product 1\nM4P1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P1\", lb=0) # hours machine 4 works on product 1\nM1P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P2\", lb=0) # hours machine 1 works on product 2\nM2P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P2\", lb=0) # hours machine 2 works on product 2\nM3P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P2\", lb=0) # hours machine 3 works on product 2\nM4P2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P2\", lb=0) # hours machine 4 works on product 2\nM1P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1P3\", lb=0) # hours machine 1 works on product 3\nM2P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2P3\", lb=0) # hours machine 2 works on product 3\nM3P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3P3\", lb=0) # hours machine 3 works on product 3\nM4P3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4P3\", lb=0) # hours machine 4 works on product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1) + (150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2) + (200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\nmodel.addCons(obj == 100 * M1P1 + 120 * M2P1 + 110 * M3P1 + 130 * M4P1 + 150 * M1P2 + 160 * M2P2 + 140 * M3P2 + 170 * M4P2 + 200 * M1P3 + 210 * M2P3 + 190 * M3P3 + 220 * M4P3)\n\n# Add constraints\n## Each machine can operate a maximum of 100 hours per week.\nmodel.addCons(M1P1 + M1P2 + M1P3 <= 100)\nmodel.addCons(M2P1 + M2P2 + M2P3 <= 100)\nmodel.addCons(M3P1 + M3P2 + M3P3 <= 100)\nmodel.addCons(M4P1 + M4P2 + M4P3 <= 100)\n## The total production hours for product 1 must not exceed 150 hours.\nmodel.addCons(M1P1 + M2P1 + M3P1 + M4P1 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 works on Product 1: \", model.getVal(M1P1))\n    print(\"Hours Machine 2 works on Product 1: \", model.getVal(M2P1))\n    print(\"Hours Machine 3 works on Product 1: \", model.getVal(M3P1))\n    print(\"Hours Machine 4 works on Product 1: \", model.getVal(M4P1))\n    print(\"Hours Machine 1 works on Product 2: \", model.getVal(M1P2))\n    print(\"Hours Machine 2 works on Product 2: \", model.getVal(M2P2))\n    print(\"Hours Machine 3 works on Product 2: \", model.getVal(M3P2))\n    print(\"Hours Machine 4 works on Product 2: \", model.getVal(M4P2))\n    print(\"Hours Machine 1 works on Product 3: \", model.getVal(M1P3))\n    print(\"Hours Machine 2 works on Product 3: \", model.getVal(M2P3))\n    print(\"Hours Machine 3 works on Product 3: \", model.getVal(M3P3))\n    print(\"Hours Machine 4 works on Product 3: \", model.getVal(M4P3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n// Revenue_A = 50 * A\n// Revenue_B = 70 * B\n// Revenue_C = 60 * C\n// Cost_A = 0.01 * A^2\n// Cost_B = 0.015 * B^2\n// Cost_C = 0.012 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\n// A <= 1000\n// B <= 800\n// C <= 900",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| A       | $50             | 0.01 * A^2                |\n| B       | $70             | 0.015 * B^2               |\n| C       | $60             | 0.012 * C^2               |\n\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C. Please help the company determine the optimal production quantities for products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=900) # production quantity of product C\n\n# Define objective function\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\nmodel.addCons(A <= 1000)\nmodel.addCons(B <= 800)\nmodel.addCons(C <= 900)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1256,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for material costs for the next quarter.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each component in the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company has a maximum of 400 hours available for production in the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\n// E <= A + B + C + D\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Component D does not exceed twice the production of Component A.\n// D <= 2 * A",
        "question": "A manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each component are given in the following Table.\n\n| Component | Selling Price | Material Cost | Production Time |\n|-----------|---------------|---------------|-----------------|\n| A         | 20$           | 10$           | 1 hour          |\n| B         | 25$           | 12$           | 2 hours         |\n| C         | 30$           | 15$           | 3 hours         |\n| D         | 35$           | 18$           | 4 hours         |\n| E         | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $2000 for material costs for the next quarter. The company wants to produce at least 20 units of each component in the next quarter. The company has a maximum of 400 hours available for production in the next quarter. The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D. Additionally, the company wants to ensure that the total production of Component D does not exceed twice the production of Component A.\n\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each component in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $2000 for material costs for the next quarter.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000)\n## The company has a maximum of 400 hours available for production in the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n## The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n## The company wants to ensure that the total production of Component D does not exceed twice the production of Component A.\nmodel.addCons(D <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1430,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000\n\n## Generate Constraint-2:\nDue to space limitations, the total number of trucks cannot exceed 60.\n// SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60\n\n## Generate Constraint-3:\nThe company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations.\n// RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks)",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost and revenue per truck for each type are given in the following Table.\n\n| Truck Type         | Operational Cost | Revenue |\n|--------------------|------------------|---------|\n| Small              | $50,000          | $70,000 |\n| Medium             | $75,000          | $100,000|\n| Large              | $100,000         | $130,000|\n| Refrigerated       | $120,000         | $150,000|\n| Heavy-Duty         | $150,000         | $180,000|\n\nThe company has a budget of $5,000,000 for purchasing new trucks. Due to space limitations, the total number of trucks cannot exceed 60. The company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations. The company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n\nPlease help the company determine the optimal number of each type of truck to purchase to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\n## Due to space limitations, the total number of trucks cannot exceed 60.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60)\n## The company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations.\nmodel.addCons(RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Heavy trucks\": \"FuelEfficiencyHeavy\", \"range\": \"FuelEfficiencyHeavy >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"FuelEfficiencyMedium\", \"range\": \"FuelEfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Light trucks\": \"FuelEfficiencyLight\", \"range\": \"FuelEfficiencyLight >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For every $1000 invested in Heavy trucks, fuel efficiency improves by 0.5 miles per gallon. For Medium trucks, it improves by 0.7 miles per gallon, and for Light trucks, it improves by 1 mile per gallon. The operational cost per mile for Heavy trucks is $1.5, for Medium trucks is $1.2, and for Light trucks is $1.0. The company aims to minimize the total operational cost of the fleet.\n// Operational cost per mile for Heavy trucks: CostHeavy = (1.5 / (0.5 * FuelEfficiencyHeavy / 1000 + 1)) * HeavyTrucks\n// Operational cost per mile for Medium trucks: CostMedium = (1.2 / (0.7 * FuelEfficiencyMedium / 1000 + 1)) * MediumTrucks\n// Operational cost per mile for Light trucks: CostLight = (1.0 / (1 * FuelEfficiencyLight / 1000 + 1)) * LightTrucks\n// So, the objective function is: Minimize (CostHeavy + CostMedium + CostLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// HeavyTrucks + MediumTrucks + LightTrucks + FuelEfficiencyHeavy + FuelEfficiencyMedium + FuelEfficiencyLight <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 500.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 500\n\n## Generate Constraint-3:\nAt least 100 Heavy trucks and 150 Medium trucks must be purchased.\n// HeavyTrucks >= 100; MediumTrucks >= 150\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for each type of truck must not exceed 50% of the total investment in that type of truck.\n// FuelEfficiencyHeavy <= 0.5 * HeavyTrucks\n// FuelEfficiencyMedium <= 0.5 * MediumTrucks\n// FuelEfficiencyLight <= 0.5 * LightTrucks",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in upgrading the fuel efficiency of each type of truck. The operational cost per mile and the improvement in fuel efficiency per $1000 invested for each type of truck are given in the following Table.\n\n| Type       | Operational Cost per Mile | Improvement in Fuel Efficiency per $1000 Invested |\n|------------|---------------------------|--------------------------------------------------|\n| Heavy      | $1.5                      | 0.5 miles per gallon                             |\n| Medium     | $1.2                      | 0.7 miles per gallon                             |\n| Light      | $1.0                      | 1 mile per gallon                                |\n\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. The total number of trucks cannot exceed 500. At least 100 Heavy trucks and 150 Medium trucks must be purchased. The investment in fuel efficiency for each type of truck must not exceed 50% of the total investment in that type of truck.\n\nPlease help the company to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=100)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=150)\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)\nFuelEfficiencyHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHeavy\", lb=0)\nFuelEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyMedium\", lb=0)\nFuelEfficiencyLight = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyLight\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostHeavy = (1.5 / (0.5 * FuelEfficiencyHeavy / 1000 + 1)) * HeavyTrucks\nCostMedium = (1.2 / (0.7 * FuelEfficiencyMedium / 1000 + 1)) * MediumTrucks\nCostLight = (1.0 / (1 * FuelEfficiencyLight / 1000 + 1)) * LightTrucks\n## the objective function is: Minimize (CostHeavy + CostMedium + CostLight)\nmodel.addCons(obj == CostHeavy + CostMedium + CostLight)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks + FuelEfficiencyHeavy + FuelEfficiencyMedium + FuelEfficiencyLight <= 200000)\n## The total number of trucks cannot exceed 500.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 500)\n## At least 100 Heavy trucks and 150 Medium trucks must be purchased.\nmodel.addCons(HeavyTrucks >= 100)\nmodel.addCons(MediumTrucks >= 150)\n## The investment in fuel efficiency for each type of truck must not exceed 50% of the total investment in that type of truck.\nmodel.addCons(FuelEfficiencyHeavy <= 0.5 * HeavyTrucks)\nmodel.addCons(FuelEfficiencyMedium <= 0.5 * MediumTrucks)\nmodel.addCons(FuelEfficiencyLight <= 0.5 * LightTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Fuel Efficiency for Heavy Trucks: \", model.getVal(FuelEfficiencyHeavy))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(FuelEfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Light Trucks: \", model.getVal(FuelEfficiencyLight))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes.\n// Cost per hour for route A: Cost_A = 2 * A * 60\n// Cost per hour for route B: Cost_B = 3 * B * 50\n// Cost per hour for route C: Cost_C = 4 * C * 40\n// Cost per hour for route D: Cost_D = 5 * D * 30\n// Cost per hour for route E: Cost_E = 6 * E * 20\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for all routes.\n// 2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost. The cost per kilometer and average speed for each route are given in the following Table.\n\n| Route | Cost per km | Average Speed |\n|-------|-------------|---------------|\n| A     | $2          | 60 km/h       |\n| B     | $3          | 50 km/h       |\n| C     | $4          | 40 km/h       |\n| D     | $5          | 30 km/h       |\n| E     | $6          | 20 km/h       |\n\nThe company has a total budget of $10,000 per day for all routes. Please help the company to minimize the total cost of transportation per hour across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * A * 60\nCost_B = 3 * B * 50\nCost_C = 4 * C * 40\nCost_D = 5 * D * 30\nCost_E = 6 * E * 20\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to regional regulations, the company must deploy at least 50 trucks in Region1 and 100 trucks in Region2.\n// Trucks1 >= 50; Trucks2 >= 100",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck decreases non-linearly with the amount of fuel optimization, specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel. The total number of trucks that can be deployed is limited to 500. Due to regional regulations, the company must deploy at least 50 trucks in Region1 and 100 trucks in Region2.\n\nPlease help the company determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operating cost per TruckA is $5000, and the revenue per TruckA is $7000. \nThe operating cost per TruckB is $6000, and the revenue per TruckB is $8000. \nThe operating cost per TruckC is $7000, and the revenue per TruckC is $9000.\nThe operating cost per TruckD is $8000, and the revenue per TruckD is $10000.\nThe operating cost per TruckE is $9000, and the revenue per TruckE is $11000.\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company wants to maximize the total net profit from operating the trucks.\n// NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\n// NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\n// NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\n// NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\n// NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\n// So, the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing and maintaining the trucks.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckA <= 2 * TruckB\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can operate, which is 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-4:\nTo ensure diversity in operations, the company wants to ensure that each type of truck is operated at least once.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1\n\n## Generate Constraint-5:\nThe company has a contractual obligation to operate at least 20 TruckC and no more than 30 TruckD.\n// TruckC >= 20; TruckD <= 30",
        "question": "A logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations. The operating cost and revenue per vehicle are given in the following Table.\n\n| Vehicle | Operating Cost | Revenue |\n|---------|----------------|---------|\n| TruckA  | $5000          | $7000   |\n| TruckB  | $6000          | $8000   |\n| TruckC  | $7000          | $9000   |\n| TruckD  | $8000          | $10000  |\n| TruckE  | $9000          | $11000  |\n\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company has a total budget of $500,000 for purchasing and maintaining the trucks. Due to licensing restrictions, the number of TruckA cannot exceed twice the number of TruckB. The company has a limit on the total number of trucks it can operate, which is 100. To ensure diversity in operations, the company wants to ensure that each type of truck is operated at least once. The company also has a contractual obligation to operate at least 20 TruckC and no more than 30 TruckD.\n\nPlease help the company to maximize the total net profit from operating the trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=20)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1, ub=30)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of TruckE\n\n# Define objective function\n# Due to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated.\n# NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\n# NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\n# NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\n# NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\n# NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\n# So, the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\nNetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\nNetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\nNetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\nNetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\nNetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE)\n\n# Add constraints\n# The company has a total budget of $500,000 for purchasing and maintaining the trucks.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500000)\n# Due to licensing restrictions, the number of TruckA cannot exceed twice the number of TruckB.\nmodel.addCons(TruckA <= 2 * TruckB)\n# The company has a limit on the total number of trucks it can operate, which is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n# To ensure diversity in operations, the company wants to ensure that each type of truck is operated at least once.\nmodel.addCons(TruckA >= 1)\nmodel.addCons(TruckB >= 1)\nmodel.addCons(TruckC >= 1)\nmodel.addCons(TruckD >= 1)\nmodel.addCons(TruckE >= 1)\n# The company has a contractual obligation to operate at least 20 TruckC and no more than 30 TruckD.\nmodel.addCons(TruckC >= 20)\nmodel.addCons(TruckD <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1261,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output while considering the cost and efficiency of each type.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8.\nThe energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9.\nThe energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0.\nThe manufacturer wants to maximize the total energy output per dollar spent.\n// Energy_S1 = 100 * S1 * 0.8\n// Energy_S2 = 120 * S2 * 0.9\n// Energy_S3 = 140 * S3 * 1.0\n// Cost_S1 = 50 * S1\n// Cost_S2 = 60 * S2\n// Cost_S3 = 70 * S3\n// So, the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * S1 + 60 * S2 + 70 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 200 units in total.\n// S1 + S2 + S3 <= 200\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 30 units of S2 to fulfill a contract.\n// S2 >= 30\n\n## Generate Constraint-5:\nThe efficiency of S3 is limited to a maximum of 1.0, which means the production of S3 cannot exceed the efficiency of S1 and S2 combined.\n// S3 <= S1 + S2",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the optimal production quantities of each type of solar panel to maximize their energy output per dollar spent. The energy output per unit of S1 is 100 kWh, with a production cost of $50 per unit and an efficiency of 0.8. The energy output per unit of S2 is 120 kWh, with a production cost of $60 per unit and an efficiency of 0.9. The energy output per unit of S3 is 140 kWh, with a production cost of $70 per unit and an efficiency of 1.0. The manufacturer has a budget of $10,000 for production costs and a limited production capacity of 200 units in total. The market demand for S1 is 50 units, and the manufacturer must produce at least 30 units of S2 to fulfill a contract. Additionally, the efficiency of S3 is limited to a maximum of 1.0, which means the production of S3 cannot exceed the efficiency of S1 and S2 combined. Please help the manufacturer to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=30, ub=200)  # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0, ub=200)  # quantity of S3\n\n# Define objective function\nEnergy_S1 = 100 * S1 * 0.8\nEnergy_S2 = 120 * S2 * 0.9\nEnergy_S3 = 140 * S3 * 1.0\nCost_S1 = 50 * S1\nCost_S2 = 60 * S2\nCost_S3 = 70 * S3\n# So, the objective function is: Maximize (Energy_S1 + Energy_S2 + Energy_S3) / (Cost_S1 + Cost_S2 + Cost_S3)\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * (Cost_S1 + Cost_S2 + Cost_S3) == Energy_S1 + Energy_S2 + Energy_S3)\n\n# Add constraints\nmodel.addCons(50 * S1 + 60 * S2 + 70 * S3 <= 10000)  # Budget constraint\nmodel.addCons(S1 + S2 + S3 <= 200)  # Production capacity constraint\nmodel.addCons(S1 <= 50)  # Market demand for S1\nmodel.addCons(S2 >= 30)  # Contract requirement for S2\nmodel.addCons(S3 <= S1 + S2)  # Efficiency constraint for S3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize fuel consumption and maintenance costs by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"5 <= Speed_i <= 100\", \"type\": \"continuous\"}\n// {\"number of trips for truck i\": \"Trips_i\", \"range\": \"Trips_i >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for truck i\": \"Tech_i\", \"range\": \"Tech_i >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by \\( FuelConsumption_i = a_i \\times Speed_i^2 \\), where \\( a_i \\) is a constant specific to each truck. The maintenance cost is also a function of speed and the number of trips, given by \\( MaintenanceCost_i = b_i \\times Speed_i + c_i \\times Trips_i \\), where \\( b_i \\) and \\( c_i \\) are constants. The investment in fuel-efficient technology reduces fuel consumption by a factor of \\( (1 - 0.01 \\times Tech_i) \\). The company aims to minimize the total monthly cost, which includes fuel and maintenance costs.\n// Total cost for truck i: Cost_i = (FuelConsumption_i \\times Trips_i) / (1 - 0.01 \\times Tech_i) + MaintenanceCost_i\n// So, the objective function is: Minimize (Cost_1 + Cost_2 + ... + Cost_n)\n\n## Generate Constraint-1:\nThe total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\n// Tech_1 + Tech_2 + ... + Tech_n <= 100000\n\n## Generate Constraint-2:\nEach truck must complete at least 10 trips per month to meet the minimum service level agreements.\n// Trips_1 >= 10; Trips_2 >= 10; ...; Trips_n >= 10\n\n## Generate Constraint-3:\nThe maximum speed of any truck should not exceed 90 km/h due to safety regulations.\n// Speed_1 <= 90; Speed_2 <= 90; ...; Speed_n <= 90",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize fuel consumption and maintenance costs by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck. The fuel consumption of each truck is a nonlinear function of its speed, given by \\( FuelConsumption_i = a_i \\times Speed_i^2 \\), where \\( a_i \\) is a constant specific to each truck. The maintenance cost is also a function of speed and the number of trips, given by \\( MaintenanceCost_i = b_i \\times Speed_i + c_i \\times Trips_i \\), where \\( b_i \\) and \\( c_i \\) are constants. The investment in fuel-efficient technology reduces fuel consumption by a factor of \\( (1 - 0.01 \\times Tech_i) \\).\n\nThe company aims to minimize the total monthly cost, which includes fuel and maintenance costs. The total investment in fuel-efficient technologies across all trucks must not exceed $100,000. Each truck must complete at least 10 trips per month to meet the minimum service level agreements. The maximum speed of any truck should not exceed 90 km/h due to safety regulations.\n\nPlease help the company to minimize the total monthly cost for all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define Variables:\nn = 2  # number of trucks, for example\nSpeeds = [model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=5, ub=100) for i in range(n)]\nTrips = [model.addVar(vtype=\"INTEGER\", name=f\"Trips_{i}\", lb=0) for i in range(n)]\nTechs = [model.addVar(vtype=\"CONTINUOUS\", name=f\"Tech_{i}\", lb=0) for i in range(n)]\n\n# Define objective function\n## Define Objective Function:\nCosts = []\nfor i in range(n):\n    FuelConsumption = Speeds[i]**2  # assuming a_i = 1 for simplicity\n    MaintenanceCost = Speeds[i] + Trips[i]  # assuming b_i = 1 and c_i = 1 for simplicity\n    Cost = (FuelConsumption * Trips[i]) / (1 - 0.01 * Techs[i]) + MaintenanceCost\n    Costs.append(Cost)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Costs))\n\n# Add constraints\n## Generate Constraint-1:\nmodel.addCons(sum(Techs) <= 100000)\n\n## Generate Constraint-2:\nfor i in range(n):\n    model.addCons(Trips[i] >= 10)\n\n## Generate Constraint-3:\nfor i in range(n):\n    model.addCons(Speeds[i] <= 90)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(n):\n        print(f\"Speed of truck {i+1}: \", model.getVal(Speeds[i]))\n        print(f\"Number of trips for truck {i+1}: \", model.getVal(Trips[i]))\n        print(f\"Investment in fuel-efficient technology for truck {i+1}: \", model.getVal(Techs[i]))\n    print(\"Total Monthly Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 2000 units for all components combined.\n// E1 + E2 + E3 + E4 + E5 <= 2000\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\n// E4 <= E1 + E2\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3.\n// E5 <= E1 + E2 + E3",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations. The production cost, selling price, and storage cost per unit for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Storage Cost per Unit per Month |\n|-----------|-----------------|---------------|--------------------------------|\n| E1        | $10             | $20           | $1                             |\n| E2        | $15             | $25           | $1.5                           |\n| E3        | $20             | $30           | $2                             |\n| E4        | $25             | $35           | $2.5                           |\n| E5        | $30             | $40           | $3                             |\n\nThe company has a budget of $50,000 for production costs next month. The company has a storage capacity of 2000 units for all components combined. The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2. The company also wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3. \n\nPlease help the company to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (20 - 10 - 1 * E1) * E1\nProfit_E2 = (25 - 15 - 1.5 * E2) * E2\nProfit_E3 = (30 - 20 - 2 * E3) * E3\nProfit_E4 = (35 - 25 - 2.5 * E4) * E4\nProfit_E5 = (40 - 30 - 3 * E5) * E5\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n## The company has a storage capacity of 2000 units for all components combined.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 <= 2000)\n## The company wants to ensure that the production of component E4 does not exceed the combined production of components E1 and E2.\nmodel.addCons(E4 <= E1 + E2)\n## The company wants to ensure that the production of component E5 does not exceed the combined production of components E1, E2, and E3.\nmodel.addCons(E5 <= E1 + E2 + E3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1462,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe storage facility can hold a maximum of 500 units at any given time.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nMarket demand for product A is at least 100 units per month.\n// UnitsA >= 100\n\n## Generate Constraint-4:\nDue to labor constraints, the production of product B cannot exceed twice the production of product A.\n// UnitsB <= 2 * UnitsA",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\nThe company has a total production capacity of 1000 units per month. The storage facility can hold a maximum of 500 units at any given time. Market demand for product A is at least 100 units per month. Due to labor constraints, the production of product B cannot exceed twice the production of product A.\nPlease help the company determine the optimal number of units to produce for each product to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000) # total production capacity\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500) # storage capacity\nmodel.addCons(UnitsA >= 100) # market demand for product A\nmodel.addCons(UnitsB <= 2 * UnitsA) # labor constraints for product B\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trucks for destination A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for destination A\": \"FuelBudgetA\", \"range\": \"FuelBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination B\": \"FuelBudgetB\", \"range\": \"FuelBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination C\": \"FuelBudgetC\", \"range\": \"FuelBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination D\": \"FuelBudgetD\", \"range\": \"FuelBudgetD >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination E\": \"FuelBudgetE\", \"range\": \"FuelBudgetE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks. The cost increases at a decreasing rate as the fuel budget increases, reflecting economies of scale in fuel purchasing. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for destination A: CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2)\n// Fuel cost for destination B: CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2)\n// Fuel cost for destination C: CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2)\n// Fuel cost for destination D: CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2)\n// Fuel cost for destination E: CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total fuel budget across all destinations must not exceed $100,000.\n// FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000\n\n## Generate Constraint-2:\nThe company must ensure that at least 50 trucks are dispatched to each destination.\n// TrucksA >= 50; TrucksB >= 50; TrucksC >= 50; TrucksD >= 50; TrucksE >= 50\n\n## Generate Constraint-3:\nThe total number of trucks dispatched across all destinations must not exceed 300.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks, where the cost increases at a decreasing rate as the fuel budget increases. The company aims to minimize the total fuel cost across all routes. The total fuel budget across all destinations must not exceed $100,000. The company must ensure that at least 50 trucks are dispatched to each destination. The total number of trucks dispatched across all destinations must not exceed 300. Please help the company determine the optimal number of trucks and fuel budget for each destination to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=50) # number of trucks for destination A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=50) # number of trucks for destination B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=50) # number of trucks for destination C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=50) # number of trucks for destination D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=50) # number of trucks for destination E\nFuelBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetA\") # fuel budget for destination A\nFuelBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetB\") # fuel budget for destination B\nFuelBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetC\") # fuel budget for destination C\nFuelBudgetD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD\") # fuel budget for destination D\nFuelBudgetE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetE\") # fuel budget for destination E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for destination A: CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2)\n## convert the division to multiplication\nCostA = (FuelBudgetA * TrucksA) * (1 + 0.1 * (FuelBudgetA * FuelBudgetA) / (TrucksA * TrucksA))\n## Fuel cost for destination B: CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2)\nCostB = (FuelBudgetB * TrucksB) * (1 + 0.1 * (FuelBudgetB * FuelBudgetB) / (TrucksB * TrucksB))\n## Fuel cost for destination C: CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2)\nCostC = (FuelBudgetC * TrucksC) * (1 + 0.1 * (FuelBudgetC * FuelBudgetC) / (TrucksC * TrucksC))\n## Fuel cost for destination D: CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2)\nCostD = (FuelBudgetD * TrucksD) * (1 + 0.1 * (FuelBudgetD * FuelBudgetD) / (TrucksD * TrucksD))\n## Fuel cost for destination E: CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2)\nCostE = (FuelBudgetE * TrucksE) * (1 + 0.1 * (FuelBudgetE * FuelBudgetE) / (TrucksE * TrucksE))\n## the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The total fuel budget across all destinations must not exceed $100,000.\nmodel.addCons(FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000)\n## The total number of trucks dispatched across all destinations must not exceed 300.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Destination A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Destination B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Destination C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Destination D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Destination E: \", model.getVal(TrucksE))\n    print(\"Fuel Budget for Destination A: \", model.getVal(FuelBudgetA))\n    print(\"Fuel Budget for Destination B: \", model.getVal(FuelBudgetB))\n    print(\"Fuel Budget for Destination C: \", model.getVal(FuelBudgetC))\n    print(\"Fuel Budget for Destination D: \", model.getVal(FuelBudgetD))\n    print(\"Fuel Budget for Destination E: \", model.getVal(FuelBudgetE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck type\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3, and the distance traveled by each truck to each region varies (Region1: 500 miles, Region2: 700 miles, Region3: 600 miles, Region4: 800 miles, Region5: 900 miles). The company wants to minimize the total fuel cost per day.\n// FuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * $3\n// FuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * $3\n// FuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * $3\n// FuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * $3\n// FuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * $3\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 500 * TrucksRegion1 / FuelEfficiency * $3 + 700 * TrucksRegion2 / FuelEfficiency * $3 + 600 * TrucksRegion3 / FuelEfficiency * $3 + 800 * TrucksRegion4 / FuelEfficiency * $3 + 900 * TrucksRegion5 / FuelEfficiency * $3 <= $10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20\n\n## Generate Constraint-3:\nAt least 3 trucks must be allocated to Region1.\n// TrucksRegion1 >= 3\n\n## Generate Constraint-4:\nNo more than 5 trucks can be allocated to any single region.\n// TrucksRegion1 <= 5\n// TrucksRegion2 <= 5\n// TrucksRegion3 <= 5\n// TrucksRegion4 <= 5\n// TrucksRegion5 <= 5",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The distance traveled by each truck to each region varies as shown in the following Table.\n\n| Region | Distance (miles) |\n|--------|------------------|\n| Region1 | 500             |\n| Region2 | 700             |\n| Region3 | 600             |\n| Region4 | 800             |\n| Region5 | 900             |\n\nThe cost of fuel per gallon is $3, and the fuel efficiency of each truck type is denoted as \"FuelEfficiency\". The company has a total budget of $10,000 for fuel costs per day. The company can allocate a maximum of 20 trucks in total across all regions. At least 3 trucks must be allocated to Region1, and no more than 5 trucks can be allocated to any single region.\n\nPlease help the company to minimize the total fuel cost per day, which is calculated as the sum of the fuel costs for each region, where the fuel cost for each region is the product of the distance, the number of trucks allocated to that region, divided by the fuel efficiency, and the cost of fuel per gallon.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=3, ub=5) # number of trucks for Region1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0, ub=5) # number of trucks for Region2\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0, ub=5) # number of trucks for Region3\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0, ub=5) # number of trucks for Region4\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0, ub=5) # number of trucks for Region5\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=0.01) # fuel efficiency of each truck type\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * 3\nFuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * 3\nFuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * 3\nFuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * 3\nFuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * 3\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(500 * TrucksRegion1 / FuelEfficiency * 3 + 700 * TrucksRegion2 / FuelEfficiency * 3 + 600 * TrucksRegion3 / FuelEfficiency * 3 + 800 * TrucksRegion4 / FuelEfficiency * 3 + 900 * TrucksRegion5 / FuelEfficiency * 3 <= 10000)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000\n\n## Generate Constraint-2:\nThe total production of Component B must be at least 1500 units.\n// H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component. The company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The total production of Component A must be at least 1000 units, and the total production of Component B must be at least 1500 units. Please help the company to minimize the total cost of operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0) # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0) # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0) # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0) # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0) # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0) # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0) # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0) # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0) # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0) # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0) # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0) # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000) # total production of Component A must be at least 1000 units\nmodel.addCons(H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500) # total production of Component B must be at least 1500 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 operates for Component A: \", model.getVal(H1A))\n    print(\"Hours Facility 1 operates for Component B: \", model.getVal(H1B))\n    print(\"Hours Facility 1 operates for Component C: \", model.getVal(H1C))\n    print(\"Hours Facility 2 operates for Component A: \", model.getVal(H2A))\n    print(\"Hours Facility 2 operates for Component B: \", model.getVal(H2B))\n    print(\"Hours Facility 2 operates for Component C: \", model.getVal(H2C))\n    print(\"Hours Facility 3 operates for Component A: \", model.getVal(H3A))\n    print(\"Hours Facility 3 operates for Component B: \", model.getVal(H3B))\n    print(\"Hours Facility 3 operates for Component C: \", model.getVal(H3C))\n    print(\"Hours Facility 4 operates for Component A: \", model.getVal(H4A))\n    print(\"Hours Facility 4 operates for Component B: \", model.getVal(H4B))\n    print(\"Hours Facility 4 operates for Component C: \", model.getVal(H4C))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n// Delivery efficiency of Trucks: Efficiency_T = 10 * T / 100\n// Delivery efficiency of Vans: Efficiency_V = 5 * V / 50\n// Delivery efficiency of Bikes: Efficiency_B = 2 * B / 20\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B) = Maximize (10 * T / 100 + 5 * V / 50 + 2 * B / 20)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for operational costs.\n// 100 * T + 50 * V + 20 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints. The operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs. The company has a budget of $1000 per day for operational costs. The company has a total of 50 drivers available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. Please help the company to maximize the delivery efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = 10 * T / 100\nEfficiency_V = 5 * V / 50\nEfficiency_B = 2 * B / 20\n## convert the division to multiplication\nmodel.addCons(obj * (100 * T + 50 * V + 20 * B) == 10 * T + 5 * V + 2 * B)\n\n# Add constraints\n## The company has a budget of $1000 per day for operational costs.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in advanced technology for each plant, which enhances the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"SolarTechInvestment\", \"range\": \"SolarTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"WindTechInvestment\", \"range\": \"WindTechInvestment >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"HydroTechInvestment\", \"range\": \"HydroTechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%. The company aims to maximize the total energy production.\n// Energy_Solar = (SolarHours * (1 + 0.01 * SolarTechInvestment / 1000))\n// Energy_Wind = (WindHours * (1 + 0.01 * WindTechInvestment / 1000))\n// Energy_Hydro = (HydroHours * (1 + 0.01 * HydroTechInvestment / 1000))\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. For every $1000 invested in Solar technology, the plant's efficiency increases by 10%. For Wind, every $1000 investment increases efficiency by 8%. For Hydro, every $1000 investment increases efficiency by 12%.\n\n| Plant Type | Efficiency Increase per $1000 Investment |\n|------------|------------------------------------------|\n| Solar      | 10%                                      |\n| Wind       | 8%                                       |\n| Hydro      | 12%                                      |\n\nThe company has a total budget of $50,000 for technology investments and operational costs. Please help the company to maximize the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # number of hours Solar plant operates\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # number of hours Wind plant operates\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # number of hours Hydro plant operates\nSolarTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarTechInvestment\", lb=0)  # investment in advanced technology for Solar\nWindTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WindTechInvestment\", lb=0)  # investment in advanced technology for Wind\nHydroTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroTechInvestment\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nEnergy_Solar = SolarHours * (1 + 0.01 * SolarTechInvestment / 1000)\nEnergy_Wind = WindHours * (1 + 0.01 * WindTechInvestment / 1000)\nEnergy_Hydro = HydroHours * (1 + 0.01 * HydroTechInvestment / 1000)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\nmodel.addCons(SolarTechInvestment + WindTechInvestment + HydroTechInvestment + SolarHours + WindHours + HydroHours <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours Solar plant operates: \", model.getVal(SolarHours))\n    print(\"Number of hours Wind plant operates: \", model.getVal(WindHours))\n    print(\"Number of hours Hydro plant operates: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(SolarTechInvestment))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(WindTechInvestment))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(HydroTechInvestment))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit.\n// {\"raw materials for production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 4\": \"L4\", \"range\": \"L4 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 5\": \"L5\", \"range\": \"L5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and profit margin per unit of product. The profit function is nonlinear due to economies of scale and varying efficiency rates.\n// Profit from production line 1: P1 = 100 * R1^0.5 * L1^0.6\n// Profit from production line 2: P2 = 120 * R2^0.4 * L2^0.7\n// Profit from production line 3: P3 = 130 * R3^0.3 * L3^0.8\n// Profit from production line 4: P4 = 110 * R4^0.5 * L4^0.6\n// Profit from production line 5: P5 = 140 * R5^0.4 * L5^0.7\n// The objective function is: Maximize Total Profit = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nTotal raw materials available are 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nTotal labor hours available are 800 hours.\n// L1 + L2 + L3 + L4 + L5 <= 800\n\n## Generate Constraint-3:\nEach production line can use a maximum of 200 units of raw materials.\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit. Each production line has a different efficiency and profit margin per unit of product, and the profit function is nonlinear due to economies of scale and varying efficiency rates. The profit from each production line is calculated as follows:\n\n| Production Line | Profit Calculation |\n|-----------------|--------------------|\n| 1               | 100 * R1^0.5 * L1^0.6 |\n| 2               | 120 * R2^0.4 * L2^0.7 |\n| 3               | 130 * R3^0.3 * L3^0.8 |\n| 4               | 110 * R4^0.5 * L4^0.6 |\n| 5               | 140 * R5^0.4 * L5^0.7 |\n\nThe company has a total of 1000 units of raw materials and 800 labor hours available. Each production line can use a maximum of 200 units of raw materials.\n\nPlease help the company to maximize the total profit by determining the optimal allocation of raw materials (R1, R2, R3, R4, R5) and labor hours (L1, L2, L3, L4, L5) for each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials for production line 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials for production line 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # raw materials for production line 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # raw materials for production line 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # raw materials for production line 5\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for production line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for production line 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for production line 3\nL4 = model.addVar(vtype=\"CONTINUOUS\", name=\"L4\", lb=0) # labor hours for production line 4\nL5 = model.addVar(vtype=\"CONTINUOUS\", name=\"L5\", lb=0) # labor hours for production line 5\n\n# Define objective function\n# Profit from production line 1: P1 = 100 * R1^0.5 * L1^0.6\n# Profit from production line 2: P2 = 120 * R2^0.4 * L2^0.7\n# Profit from production line 3: P3 = 130 * R3^0.3 * L3^0.8\n# Profit from production line 4: P4 = 110 * R4^0.5 * L4^0.6\n# Profit from production line 5: P5 = 140 * R5^0.4 * L5^0.7\n# The objective function is: Maximize Total Profit = P1 + P2 + P3 + P4 + P5\nP1 = 100 * R1**0.5 * L1**0.6\nP2 = 120 * R2**0.4 * L2**0.7\nP3 = 130 * R3**0.3 * L3**0.8\nP4 = 110 * R4**0.5 * L4**0.6\nP5 = 140 * R5**0.4 * L5**0.7\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# Total raw materials available are 1000 units.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000)\n# Total labor hours available are 800 hours.\nmodel.addCons(L1 + L2 + L3 + L4 + L5 <= 800)\n# Each production line can use a maximum of 200 units of raw materials.\nmodel.addCons(R1 <= 200)\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for production line 1: \", model.getVal(R1))\n    print(\"Raw materials for production line 2: \", model.getVal(R2))\n    print(\"Raw materials for production line 3: \", model.getVal(R3))\n    print(\"Raw materials for production line 4: \", model.getVal(R4))\n    print(\"Raw materials for production line 5: \", model.getVal(R5))\n    print(\"Labor hours for production line 1: \", model.getVal(L1))\n    print(\"Labor hours for production line 2: \", model.getVal(L2))\n    print(\"Labor hours for production line 3: \", model.getVal(L3))\n    print(\"Labor hours for production line 4: \", model.getVal(L4))\n    print(\"Labor hours for production line 5: \", model.getVal(L5))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer.\n// {\"number of kilometers driven by Truck1\": \"Truck1Km\", \"range\": \"Truck1Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck2\": \"Truck2Km\", \"range\": \"Truck2Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck3\": \"Truck3Km\", \"range\": \"Truck3Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck4\": \"Truck4Km\", \"range\": \"Truck4Km >= 0\", \"type\": \"real\"}\n// {\"number of kilometers driven by Truck5\": \"Truck5Km\", \"range\": \"Truck5Km >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck1 is 5 km/liter, and the maintenance cost is $0.5 per km.\nThe fuel efficiency of Truck2 is 6 km/liter, and the maintenance cost is $0.4 per km.\nThe fuel efficiency of Truck3 is 7 km/liter, and the maintenance cost is $0.3 per km.\nThe fuel efficiency of Truck4 is 8 km/liter, and the maintenance cost is $0.2 per km.\nThe fuel efficiency of Truck5 is 9 km/liter, and the maintenance cost is $0.1 per km.\nThe company wants to minimize the total cost of fuel and maintenance.\n// FuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\n// MaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe total distance that all trucks can cover is limited to 10,000 km.\n// Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for fuel costs.\n// (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Truck4, and Truck5) to maximize efficiency while minimizing fuel consumption and maintenance costs. Each vehicle has a different fuel efficiency and maintenance cost per kilometer. The fuel efficiency and maintenance cost for each truck are given in the following Table.\n\n| Vehicle  | Fuel Efficiency (km/liter) | Maintenance Cost per km |\n|----------|---------------------------|-------------------------|\n| Truck1   | 5                         | $0.5                    |\n| Truck2   | 6                         | $0.4                    |\n| Truck3   | 7                         | $0.3                    |\n| Truck4   | 8                         | $0.2                    |\n| Truck5   | 9                         | $0.1                    |\n\nThe company wants to minimize the total cost of fuel and maintenance. The total distance that all trucks can cover is limited to 10,000 km. The company has a budget of $5000 for fuel costs. Please help the company determine the optimal number of kilometers each truck should drive to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1Km\", lb=0) # number of kilometers driven by Truck1\nTruck2Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2Km\", lb=0) # number of kilometers driven by Truck2\nTruck3Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3Km\", lb=0) # number of kilometers driven by Truck3\nTruck4Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4Km\", lb=0) # number of kilometers driven by Truck4\nTruck5Km = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5Km\", lb=0) # number of kilometers driven by Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPrice = 1  # Assuming fuel price is $1 per liter for simplicity\nFuelCost = (Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice\nMaintenanceCost = 0.5 * Truck1Km + 0.4 * Truck2Km + 0.3 * Truck3Km + 0.2 * Truck4Km + 0.1 * Truck5Km\n## the objective function is: Minimize (FuelCost + MaintenanceCost)\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The total distance that all trucks can cover is limited to 10,000 km.\nmodel.addCons(Truck1Km + Truck2Km + Truck3Km + Truck4Km + Truck5Km <= 10000)\n## The company has a budget of $5000 for fuel costs.\nmodel.addCons((Truck1Km / 5) * FuelPrice + (Truck2Km / 6) * FuelPrice + (Truck3Km / 7) * FuelPrice + (Truck4Km / 8) * FuelPrice + (Truck5Km / 9) * FuelPrice <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of kilometers driven by Truck1: \", model.getVal(Truck1Km))\n    print(\"Number of kilometers driven by Truck2: \", model.getVal(Truck2Km))\n    print(\"Number of kilometers driven by Truck3: \", model.getVal(Truck3Km))\n    print(\"Number of kilometers driven by Truck4: \", model.getVal(Truck4Km))\n    print(\"Number of kilometers driven by Truck5: \", model.getVal(Truck5Km))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost. The fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing.\n// Profit_Route1 = Revenue_Route1 - FuelCost_Route1 = 1000 * T1 - 0.1 * T1^2\n// Profit_Route2 = Revenue_Route2 - FuelCost_Route2 = 1200 * T2 - 0.12 * T2^2\n// Profit_Route3 = Revenue_Route3 - FuelCost_Route3 = 1500 * T3 - 0.15 * T3^2\n// Profit_Route4 = Revenue_Route4 - FuelCost_Route4 = 1300 * T4 - 0.13 * T4^2\n// Profit_Route5 = Revenue_Route5 - FuelCost_Route5 = 1100 * T5 - 0.11 * T5^2\n// The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks due to road restrictions and operational efficiency.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 22; T5 <= 18",
        "question": "A logistics company operates 5 different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit, which is influenced by the delivery speed and the cost of fuel. The profit per route is calculated as the revenue from deliveries minus the fuel cost, where the fuel cost is a nonlinear function of the number of trucks due to economies of scale in fuel purchasing. Specifically, the profit for each route is as follows:\n- Route 1: Profit_Route1 = 1000 * T1 - 0.1 * T1^2\n- Route 2: Profit_Route2 = 1200 * T2 - 0.12 * T2^2\n- Route 3: Profit_Route3 = 1500 * T3 - 0.15 * T3^2\n- Route 4: Profit_Route4 = 1300 * T4 - 0.13 * T4^2\n- Route 5: Profit_Route5 = 1100 * T5 - 0.11 * T5^2\nThe company has a total of 100 trucks available for allocation. Each route also has a maximum capacity for trucks due to road restrictions and operational efficiency:\n- Route 1: T1 <= 20\n- Route 2: T2 <= 25\n- Route 3: T3 <= 30\n- Route 4: T4 <= 22\n- Route 5: T5 <= 18\nPlease help the company to maximize the total profit across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20)  # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=25)  # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=30)  # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=22)  # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=18)  # number of trucks on route 5\n\n# Define objective function\n# The profit per route is calculated as the revenue from deliveries minus the fuel cost.\nProfit_Route1 = 1000 * T1 - 0.1 * T1**2\nProfit_Route2 = 1200 * T2 - 0.12 * T2**2\nProfit_Route3 = 1500 * T3 - 0.15 * T3**2\nProfit_Route4 = 1300 * T4 - 0.13 * T4**2\nProfit_Route5 = 1100 * T5 - 0.11 * T5**2\n\n# The objective function is: Maximize (Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Route1 + Profit_Route2 + Profit_Route3 + Profit_Route4 + Profit_Route5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Each route has a maximum capacity for trucks due to road restrictions and operational efficiency.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 22)\nmodel.addCons(T5 <= 18)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for perishable goods\": \"PerishableSpeed\", \"range\": \"PerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for non-perishable goods\": \"NonPerishableSpeed\", \"range\": \"NonPerishableSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for hazardous materials\": \"HazardousSpeed\", \"range\": \"HazardousSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// FuelConsumption_Perishable = PerishableTrucks * (PerishableSpeed^2)\n// FuelConsumption_NonPerishable = NonPerishableTrucks * (NonPerishableSpeed^2)\n// FuelConsumption_Hazardous = HazardousTrucks * (HazardousSpeed^2)\n// TimeSpent_Perishable = TotalDistance / PerishableSpeed\n// TimeSpent_NonPerishable = TotalDistance / NonPerishableSpeed\n// TimeSpent_Hazardous = TotalDistance / HazardousSpeed\n// So, the objective function is: Minimize (FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing new trucks.\n// Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100\n\n## Generate Constraint-3:\nThe average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations.\n// HazardousSpeed >= 60\n\n## Generate Constraint-4:\nThe average speed of trucks carrying perishable goods must not exceed 80 km/h to ensure the freshness of the goods.\n// PerishableSpeed <= 80",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo: perishable goods, non-perishable goods, and hazardous materials. The company needs to decide the number of trucks to purchase for each type of cargo and the average speed at which each type of truck should operate to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n\n| Cargo Type          | Number of Trucks | Average Speed |\n|---------------------|------------------|---------------|\n| Perishable Goods    | PerishableTrucks | PerishableSpeed |\n| Non-Perishable Goods| NonPerishableTrucks | NonPerishableSpeed |\n| Hazardous Materials | HazardousTrucks | HazardousSpeed |\n\nThe company has a budget of $500,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The average speed of trucks carrying hazardous materials must be at least 60 km/h due to safety regulations. The average speed of trucks carrying perishable goods must not exceed 80 km/h to ensure the freshness of the goods.\n\nPlease help the company to determine the optimal number of trucks and their average speeds to minimize the total fuel consumption and time spent on the road, while adhering to the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for perishable goods\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0)  # number of trucks for non-perishable goods\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)  # number of trucks for hazardous materials\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=0)  # average speed of trucks for perishable goods\nNonPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"NonPerishableSpeed\", lb=0)  # average speed of trucks for non-perishable goods\nHazardousSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"HazardousSpeed\", lb=0)  # average speed of trucks for hazardous materials\n\n# Define objective function\nFuelConsumption_Perishable = PerishableTrucks * PerishableSpeed**2\nFuelConsumption_NonPerishable = NonPerishableTrucks * NonPerishableSpeed**2\nFuelConsumption_Hazardous = HazardousTrucks * HazardousSpeed**2\nTimeSpent_Perishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Perishable\")  # Time spent by perishable trucks\nTimeSpent_NonPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_NonPerishable\")  # Time spent by non-perishable trucks\nTimeSpent_Hazardous = model.addVar(vtype=\"CONTINUOUS\", name=\"TimeSpent_Hazardous\")  # Time spent by hazardous trucks\nmodel.addCons(TimeSpent_Perishable == 1 / PerishableSpeed)\nmodel.addCons(TimeSpent_NonPerishable == 1 / NonPerishableSpeed)\nmodel.addCons(TimeSpent_Hazardous == 1 / HazardousSpeed)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_Perishable + FuelConsumption_NonPerishable + FuelConsumption_Hazardous + TimeSpent_Perishable + TimeSpent_NonPerishable + TimeSpent_Hazardous)\n\n# Add constraints\nCost_PerishableTrucks = 50000  # Example cost per truck\nCost_NonPerishableTrucks = 60000  # Example cost per truck\nCost_HazardousTrucks = 70000  # Example cost per truck\nmodel.addCons(Cost_PerishableTrucks * PerishableTrucks + Cost_NonPerishableTrucks * NonPerishableTrucks + Cost_HazardousTrucks * HazardousTrucks <= 500000)\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100)\nmodel.addCons(HazardousSpeed >= 60)\nmodel.addCons(PerishableSpeed <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Perishable Speed: \", model.getVal(PerishableSpeed))\n    print(\"Non-Perishable Speed: \", model.getVal(NonPerishableSpeed))\n    print(\"Hazardous Speed: \", model.getVal(HazardousSpeed))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy vehicles\": \"Heavy\", \"range\": \"Heavy >= 0\", \"type\": \"integer\"}\n// {\"number of Specialized vehicles\": \"Specialized\", \"range\": \"Specialized >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for Small vehicles is $100, for Medium vehicles is $200, for Large vehicles is $300, for Heavy vehicles is $400, and for Specialized vehicles is $500. The company wants to minimize the total operational cost while ensuring the fleet can handle the required cargo volume.\n// Total operational cost: Cost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\n// The company also wants to consider the environmental impact, which is modeled as a quadratic function of the total operational cost: Environmental Impact = (Cost)^2\n// So, the objective function is: Minimize Environmental Impact + Cost\n\n## Generate Constraint-1:\nThe total cargo volume that needs to be transported is 10,000 cubic meters. Each Small vehicle can carry 100 cubic meters, each Medium vehicle can carry 200 cubic meters, each Large vehicle can carry 300 cubic meters, each Heavy vehicle can carry 400 cubic meters, and each Specialized vehicle can carry 500 cubic meters.\n// 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $15,000 per day for the total operational cost.\n// 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized <= 15000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. The maximum number of Small vehicles is 50, Medium vehicles is 40, Large vehicles is 30, Heavy vehicles is 20, and Specialized vehicles is 10.\n// Small <= 50; Medium <= 40; Large <= 30; Heavy <= 20; Specialized <= 10",
        "question": "A logistics company is planning its fleet deployment for five different types of vehicles: Small, Medium, Large, Heavy, and Specialized. Each vehicle type has different operational costs and capacities. The operational cost per day for Small vehicles is $100, for Medium vehicles is $200, for Large vehicles is $300, for Heavy vehicles is $400, and for Specialized vehicles is $500. The company wants to minimize the total operational cost while ensuring the fleet can handle the required cargo volume. The total cargo volume that needs to be transported is 10,000 cubic meters. Each Small vehicle can carry 100 cubic meters, each Medium vehicle can carry 200 cubic meters, each Large vehicle can carry 300 cubic meters, each Heavy vehicle can carry 400 cubic meters, and each Specialized vehicle can carry 500 cubic meters. The company has a budget constraint of $15,000 per day for the total operational cost. The company also has a limit on the number of vehicles it can deploy: the maximum number of Small vehicles is 50, Medium vehicles is 40, Large vehicles is 30, Heavy vehicles is 20, and Specialized vehicles is 10. Additionally, the company wants to consider the environmental impact, which is modeled as a quadratic function of the total operational cost. Please help the company to minimize the sum of the environmental impact and the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=0)  # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=0)  # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=0)  # number of Large vehicles\nHeavy = model.addVar(vtype=\"INTEGER\", name=\"Heavy\", lb=0)  # number of Heavy vehicles\nSpecialized = model.addVar(vtype=\"INTEGER\", name=\"Specialized\", lb=0)  # number of Specialized vehicles\n\n# Define objective function\nCost = 100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized\nEnvironmentalImpact = Cost**2\n# So, the objective function is: Minimize Environmental Impact + Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == EnvironmentalImpact + Cost)\n\n# Add constraints\n# The total cargo volume that needs to be transported is 10,000 cubic meters.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized >= 10000)\n# The company has a budget constraint of $15,000 per day for the total operational cost.\nmodel.addCons(100 * Small + 200 * Medium + 300 * Large + 400 * Heavy + 500 * Specialized <= 15000)\n# The company has a limit on the number of vehicles it can deploy.\nmodel.addCons(Small <= 50)\nmodel.addCons(Medium <= 40)\nmodel.addCons(Large <= 30)\nmodel.addCons(Heavy <= 20)\nmodel.addCons(Specialized <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Heavy vehicles: \", model.getVal(Heavy))\n    print(\"Number of Specialized vehicles: \", model.getVal(Specialized))\n    print(\"Minimized Total Cost and Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1370,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five locations (A, B, C, D, E) suitable for these installations.\n// {\"number of solar panels at location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at locations A, B, and C is 15%, 18%, and 20% respectively. The cost per solar panel is $1000, $1200, and $1500 respectively.\nThe efficiency of wind turbines at locations D and E is 30% and 25% respectively. The cost per wind turbine is $5000 and $4500 respectively.\nThe company wants to minimize the total cost of installation while maximizing the total energy output.\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE\n// Total energy output: Output = 15% * 1000 * SolarA + 18% * 1200 * SolarB + 20% * 1500 * SolarC + 30% * 5000 * WindD + 25% * 4500 * WindE\n// So, the objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installations.\n// 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe company aims to generate at least 200,000 kWh of energy.\n// 15% * 1000 * SolarA + 18% * 1200 * SolarB + 20% * 1500 * SolarC + 30% * 5000 * WindD + 25% * 4500 * WindE >= 200000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels in total.\n// SolarA + SolarB + SolarC >= 50",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five locations (A, B, C, D, E). The efficiency of solar panels at locations A, B, and C is 15%, 18%, and 20% respectively, with costs per solar panel of $1000, $1200, and $1500 respectively. The efficiency of wind turbines at locations D and E is 30% and 25% respectively, with costs per wind turbine of $5000 and $4500 respectively. The company has a budget of $1,000,000 for the installations and aims to generate at least 200,000 kWh of energy. Additionally, the company must install at least 50 solar panels in total.\n\nPlease help the company to minimize the total cost of installation while maximizing the total energy output, defined as the ratio of the total cost to the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at location E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE\nOutput = 0.15 * 1000 * SolarA + 0.18 * 1200 * SolarB + 0.20 * 1500 * SolarC + 0.30 * 5000 * WindD + 0.25 * 4500 * WindE\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installations.\nmodel.addCons(1000 * SolarA + 1200 * SolarB + 1500 * SolarC + 5000 * WindD + 4500 * WindE <= 1000000)\n## The company aims to generate at least 200,000 kWh of energy.\nmodel.addCons(0.15 * 1000 * SolarA + 0.18 * 1200 * SolarB + 0.20 * 1500 * SolarC + 0.30 * 5000 * WindD + 0.25 * 4500 * WindE >= 200000)\n## The company must install at least 50 solar panels in total.\nmodel.addCons(SolarA + SolarB + SolarC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Minimized Cost per Unit of Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\n// Total environmental impact: Impact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation.\n// 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 1,000,000 kWh.\n// 200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000\n\n## Generate Constraint-3:\nThe maximum number of solar panels that can be installed at Site A is 1000.\n// SolarA <= 1000\n\n## Generate Constraint-4:\nThe maximum number of wind turbines that can be installed at Site E is 500.\n// WindE <= 500\n\n## Generate Constraint-5:\nThe city wants to ensure a balanced mix of solar and wind energy, so the number of solar panels should not exceed twice the number of wind turbines.\n// SolarA + SolarB + SolarC <= 2 * (WindD + WindE)",
        "question": "A city is planning to install solar panels and wind turbines at five potential sites (Site A, Site B, Site C, Site D, and Site E) to generate renewable energy. The cost, annual energy output, and environmental impact score for each site are given in the following Table.\n\n| Site | Cost per Unit | Annual Energy Output per Unit | Environmental Impact Score |\n|------|---------------|-------------------------------|----------------------------|\n| A    | $1000         | 200 kWh                       | 5                          |\n| B    | $1200         | 220 kWh                       | 6                          |\n| C    | $1100         | 210 kWh                       | 5.5                        |\n| D    | $2000         | 500 kWh                       | 7                          |\n| E    | $2200         | 550 kWh                       | 7.5                        |\n\nThe city has a budget of $1,000,000 for the installation. The total annual energy output must be at least 1,000,000 kWh. The maximum number of solar panels that can be installed at Site A is 1000, and the maximum number of wind turbines that can be installed at Site E is 500. The city wants to ensure a balanced mix of solar and wind energy, so the number of solar panels should not exceed twice the number of wind turbines.\n\nPlease help the city to minimize the Cost-Environmental Impact ratio of the energy generation (defined as the total cost divided by the total environmental impact score).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Site D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Site E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\nImpact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation.\nmodel.addCons(Cost <= 1000000)\n## The total annual energy output must be at least 1,000,000 kWh.\nmodel.addCons(200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000)\n## The maximum number of solar panels that can be installed at Site A is 1000.\nmodel.addCons(SolarA <= 1000)\n## The maximum number of wind turbines that can be installed at Site E is 500.\nmodel.addCons(WindE <= 500)\n## The number of solar panels should not exceed twice the number of wind turbines.\nmodel.addCons(SolarA + SolarB + SolarC <= 2 * (WindD + WindE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Site E: \", model.getVal(WindE))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1472,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare and water usage per hectare for each crop are given in the following Table.\n\n| Crop       | Profit per Hectare | Water Usage per Hectare |\n|------------|--------------------|-------------------------|\n| Wheat      | $300               | 500 liters              |\n| Corn       | $400               | 600 liters              |\n| Soybeans   | $500               | 400 liters              |\n| Barley     | $200               | 300 liters              |\n| Oats       | $150               | 200 liters              |\n\nThe farmer has 100 hectares of land available. The total water available for irrigation is 50,000 liters. The farmer wants to maximize the profit per liter of water used. Please help the farmer determine the optimal area of land to allocate to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # area of land for Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # area of land for Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # area of land for Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The cost function is nonlinear due to varying fuel consumption rates and maintenance costs based on the number of trucks.\n// Fuel cost on route 1: F1 = 0.5 * T1^2\n// Fuel cost on route 2: F2 = 0.6 * T2^2\n// Fuel cost on route 3: F3 = 0.4 * T3^2\n// Fuel cost on route 4: F4 = 0.7 * T4^2\n// Fuel cost on route 5: F5 = 0.55 * T5^2\n// Fuel cost on route 6: F6 = 0.65 * T6^2\n// Maintenance cost: M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n// The objective function is: Minimize (F1 + F2 + F3 + F4 + F5 + F6 + M)\n// Minimize (0.5 * T1^2 + 0.6 * T2^2 + 0.4 * T3^2 + 0.7 * T4^2 + 0.55 * T5^2 + 0.65 * T6^2 + 1000 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\n// T1 + T3 + T5 >= 0.3 * (T1 + T2 + T3 + T4 + T5 + T6)",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost. Each route has different fuel consumption rates and delivery times, and the operational cost includes fuel and maintenance costs. The cost function is nonlinear due to varying fuel consumption rates and maintenance costs based on the number of trucks.\n\nThe company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks. The total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\n## Fuel cost on route 1: F1 = 0.5 * T1^2\n## Fuel cost on route 2: F2 = 0.6 * T2^2\n## Fuel cost on route 3: F3 = 0.4 * T3^2\n## Fuel cost on route 4: F4 = 0.7 * T4^2\n## Fuel cost on route 5: F5 = 0.55 * T5^2\n## Fuel cost on route 6: F6 = 0.65 * T6^2\n## Maintenance cost: M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n## The objective function is: Minimize (F1 + F2 + F3 + F4 + F5 + F6 + M)\nF1 = 0.5 * T1**2\nF2 = 0.6 * T2**2\nF3 = 0.4 * T3**2\nF4 = 0.7 * T4**2\nF5 = 0.55 * T5**2\nF6 = 0.65 * T6**2\nM = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5 + F6 + M)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each route can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n## The total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\nmodel.addCons(T1 + T3 + T5 >= 0.3 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Number of trucks on route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes.\n// {\"number of Truck1 vehicles\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2 vehicles\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck3 vehicles\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of Van1 vehicles\": \"Van1\", \"range\": \"Van1 >= 0\", \"type\": \"integer\"}\n// {\"number of Van2 vehicles\": \"Van2\", \"range\": \"Van2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has a different operational cost and capacity. \n- Truck1 costs $50,000 per year to operate and has a capacity of 10 tons.\n- Truck2 costs $60,000 per year to operate and has a capacity of 15 tons.\n- Truck3 costs $70,000 per year to operate and has a capacity of 20 tons.\n- Van1 costs $30,000 per year to operate and has a capacity of 5 tons.\n- Van2 costs $40,000 per year to operate and has a capacity of 8 tons.\nThe company wants to minimize the total operational cost while ensuring they can handle at least 1000 tons of cargo.\n// Total operational cost: Cost = 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2\n// Total capacity: Capacity = 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $3,000,000 for vehicle operations.\n// 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2 <= 3000000\n\n## Generate Constraint-2:\nThe company must be able to handle at least 1000 tons of cargo.\n// 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2 >= 1000\n\n## Generate Constraint-3:\nThe company can purchase a maximum of 50 vehicles in total.\n// Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 50",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize their delivery routes. The operational cost and capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Year | Capacity (tons) |\n|--------------|---------------------------|-----------------|\n| Truck1       | $50,000                    | 10              |\n| Truck2       | $60,000                    | 15              |\n| Truck3       | $70,000                    | 20              |\n| Van1         | $30,000                    | 5               |\n| Van2         | $40,000                    | 8               |\n\nThe company has a budget of $3,000,000 for vehicle operations. The company must be able to handle at least 1000 tons of cargo. The company can purchase a maximum of 50 vehicles in total. \nPlease help the company to minimize the total operational cost while ensuring they can handle at least 1000 tons of cargo by optimizing the number of each type of vehicle they should purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Truck1 vehicles\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Truck2 vehicles\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Truck3 vehicles\nVan1 = model.addVar(vtype=\"INTEGER\", name=\"Van1\", lb=0) # number of Van1 vehicles\nVan2 = model.addVar(vtype=\"INTEGER\", name=\"Van2\", lb=0) # number of Van2 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2\nCapacity = 10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $3,000,000 for vehicle operations.\nmodel.addCons(50000 * Truck1 + 60000 * Truck2 + 70000 * Truck3 + 30000 * Van1 + 40000 * Van2 <= 3000000)\n## The company must be able to handle at least 1000 tons of cargo.\nmodel.addCons(10 * Truck1 + 15 * Truck2 + 20 * Truck3 + 5 * Van1 + 8 * Van2 >= 1000)\n## The company can purchase a maximum of 50 vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Van1 + Van2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1: \", model.getVal(Truck1))\n    print(\"Number of Truck2: \", model.getVal(Truck2))\n    print(\"Number of Truck3: \", model.getVal(Truck3))\n    print(\"Number of Van1: \", model.getVal(Van1))\n    print(\"Number of Van2: \", model.getVal(Van2))\n    print(\"Minimized Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide the number of trips each truck will make to each region and the fuel efficiency improvements to be made through upgrades.\n// {\"number of trips to North\": \"TripsNorth\", \"range\": \"TripsNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trips to South\": \"TripsSouth\", \"range\": \"TripsSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trips to East\": \"TripsEast\", \"range\": \"TripsEast >= 0\", \"type\": \"integer\"}\n// {\"number of trips to West\": \"TripsWest\", \"range\": \"TripsWest >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Central\": \"TripsCentral\", \"range\": \"TripsCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency improvement for North\": \"EfficiencyNorth\", \"range\": \"EfficiencyNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for South\": \"EfficiencySouth\", \"range\": \"EfficiencySouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for East\": \"EfficiencyEast\", \"range\": \"EfficiencyEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for West\": \"EfficiencyWest\", \"range\": \"EfficiencyWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for Central\": \"EfficiencyCentral\", \"range\": \"EfficiencyCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of each trip varies by region and is affected by fuel efficiency improvements. The initial cost per trip to North is $100, to South is $120, to East is $110, to West is $130, and to Central is $90. For every $1000 invested in fuel efficiency improvements, the cost per trip decreases by $1 for that region. The company aims to minimize the total operational cost across all regions.\n// Cost_North = (100 - 0.001 * EfficiencyNorth) * TripsNorth\n// Cost_South = (120 - 0.001 * EfficiencySouth) * TripsSouth\n// Cost_East = (110 - 0.001 * EfficiencyEast) * TripsEast\n// Cost_West = (130 - 0.001 * EfficiencyWest) * TripsWest\n// Cost_Central = (90 - 0.001 * EfficiencyCentral) * TripsCentral\n// So, the objective function is: Minimize (Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency improvements and operational costs.\n// 100 * TripsNorth + 120 * TripsSouth + 110 * TripsEast + 130 * TripsWest + 90 * TripsCentral + EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral <= 50000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// TripsNorth + TripsSouth + TripsEast + TripsWest + TripsCentral <= 500\n\n## Generate Constraint-3:\nDue to regional demands, the company must make at least 50 trips to North and 70 trips to South.\n// TripsNorth >= 50; TripsSouth >= 70",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide the number of trips each truck will make to each region and the fuel efficiency improvements to be made through upgrades. The initial cost per trip and the impact of fuel efficiency improvements on these costs are given in the following Table.\n\n| Region    | Initial Cost per Trip | Impact of $1000 Investment in Efficiency |\n|-----------|----------------------|-----------------------------------------|\n| North     | $100                 | $1 decrease in cost per trip            |\n| South     | $120                 | $1 decrease in cost per trip            |\n| East      | $110                 | $1 decrease in cost per trip            |\n| West      | $130                 | $1 decrease in cost per trip            |\n| Central   | $90                  | $1 decrease in cost per trip            |\n\nThe company has a budget of $50,000 for fuel efficiency improvements and operational costs. The total number of trips across all regions must not exceed 500. Due to regional demands, the company must make at least 50 trips to North and 70 trips to South. \n\nPlease help the company to minimize the total operational cost across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsNorth = model.addVar(vtype=\"INTEGER\", name=\"TripsNorth\", lb=0)  # number of trips to North\nTripsSouth = model.addVar(vtype=\"INTEGER\", name=\"TripsSouth\", lb=0)  # number of trips to South\nTripsEast = model.addVar(vtype=\"INTEGER\", name=\"TripsEast\", lb=0)  # number of trips to East\nTripsWest = model.addVar(vtype=\"INTEGER\", name=\"TripsWest\", lb=0)  # number of trips to West\nTripsCentral = model.addVar(vtype=\"INTEGER\", name=\"TripsCentral\", lb=0)  # number of trips to Central\nEfficiencyNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyNorth\", lb=0)  # fuel efficiency improvement for North\nEfficiencySouth = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySouth\", lb=0)  # fuel efficiency improvement for South\nEfficiencyEast = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyEast\", lb=0)  # fuel efficiency improvement for East\nEfficiencyWest = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyWest\", lb=0)  # fuel efficiency improvement for West\nEfficiencyCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyCentral\", lb=0)  # fuel efficiency improvement for Central\n\n# Define objective function\nCost_North = (100 - 0.001 * EfficiencyNorth) * TripsNorth\nCost_South = (120 - 0.001 * EfficiencySouth) * TripsSouth\nCost_East = (110 - 0.001 * EfficiencyEast) * TripsEast\nCost_West = (130 - 0.001 * EfficiencyWest) * TripsWest\nCost_Central = (90 - 0.001 * EfficiencyCentral) * TripsCentral\n# So, the objective function is: Minimize (Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\n\n# Add constraints\n# The company has a budget of $50,000 for fuel efficiency improvements and operational costs.\nmodel.addCons(100 * TripsNorth + 120 * TripsSouth + 110 * TripsEast + 130 * TripsWest + 90 * TripsCentral + EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral <= 50000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(TripsNorth + TripsSouth + TripsEast + TripsWest + TripsCentral <= 500)\n# Due to regional demands, the company must make at least 50 trips to North and 70 trips to South.\nmodel.addCons(TripsNorth >= 50)\nmodel.addCons(TripsSouth >= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to North: \", model.getVal(TripsNorth))\n    print(\"Number of Trips to South: \", model.getVal(TripsSouth))\n    print(\"Number of Trips to East: \", model.getVal(TripsEast))\n    print(\"Number of Trips to West: \", model.getVal(TripsWest))\n    print(\"Number of Trips to Central: \", model.getVal(TripsCentral))\n    print(\"Fuel Efficiency Improvement for North: \", model.getVal(EfficiencyNorth))\n    print(\"Fuel Efficiency Improvement for South: \", model.getVal(EfficiencySouth))\n    print(\"Fuel Efficiency Improvement for East: \", model.getVal(EfficiencyEast))\n    print(\"Fuel Efficiency Improvement for West: \", model.getVal(EfficiencyWest))\n    print(\"Fuel Efficiency Improvement for Central: \", model.getVal(EfficiencyCentral))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\n// LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks)\n\n## Generate Constraint-4:\nThe fuel efficiency of each type of truck must be at least 5 km/liter.\n// ShortFuelEfficiency >= 5\n// MediumFuelEfficiency >= 5\n// LongFuelEfficiency >= 5\n\n## Generate Constraint-5:\nThe company wants to ensure that the total distance covered by the fleet per day is at least 5000 km.\n// ShortDistance * ShortDistanceTrucks + MediumDistance * MediumDistanceTrucks + LongDistance * LongDistanceTrucks >= 5000",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n\nThe company has a budget of $100,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The company must ensure that at least 20% of the fleet is dedicated to long-distance routes. The fuel efficiency of each type of truck must be at least 5 km/liter. The company wants to ensure that the total distance covered by the fleet per day is at least 5000 km.\n\nPlease help the company to determine the optimal number of short-distance, medium-distance, and long-distance trucks to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nShortDistance = 100  # Example distance for short-distance trucks\nMediumDistance = 200  # Example distance for medium-distance trucks\nLongDistance = 300  # Example distance for long-distance trucks\nShortFuelEfficiency = 10  # Example fuel efficiency for short-distance trucks\nMediumFuelEfficiency = 8  # Example fuel efficiency for medium-distance trucks\nLongFuelEfficiency = 6  # Example fuel efficiency for long-distance trucks\n\n## TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n## TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n## So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\nTotalMaintenanceCost = 0.1 * TotalFuelCost\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nShortTruckCost = 20000  # Example cost for short-distance trucks\nMediumTruckCost = 30000  # Example cost for medium-distance trucks\nLongTruckCost = 40000  # Example cost for long-distance trucks\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n\n## The total number of trucks cannot exceed 100.\nmodel.addCons(ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100)\n\n## The company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\nmodel.addCons(LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks))\n\n## The fuel efficiency of each type of truck must be at least 5 km/liter.\n# These constraints are not directly applicable in the model as they are not related to the decision variables.\n\n## The company wants to ensure that the total distance covered by the fleet per day is at least 5000 km.\nmodel.addCons(ShortDistance * ShortDistanceTrucks + MediumDistance * MediumDistanceTrucks + LongDistance * LongDistanceTrucks >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of solar panels of type A\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type B\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type C\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type D\": \"PanelD\", \"range\": \"PanelD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years.\nThe efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years.\nThe efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years.\nThe efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years.\nThe city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n// EnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\n// TotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n// So, the objective function is: Maximize (EnergyOutput / TotalCost)\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies, costs, and lifespans. The city needs to determine the number of each type of solar panel to install in each district. The details of each type of solar panel are given in the following Table.\n\n| Solar Panel Type | Efficiency (kWh/day) | Cost ($) | Lifespan (years) |\n|------------------|----------------------|----------|------------------|\n| A                | 0.15                 | 100      | 10               |\n| B                | 0.20                 | 150      | 12               |\n| C                | 0.25                 | 200      | 15               |\n| D                | 0.30                 | 250      | 20               |\n\nThe city has a budget of $50,000 for the installation of solar panels. The city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost. Please help the city to determine the optimal number of each type of solar panel to install to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of solar panels of type A\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of solar panels of type B\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of solar panels of type C\nPanelD = model.addVar(vtype=\"INTEGER\", name=\"PanelD\", lb=0) # number of solar panels of type D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\nTotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == EnergyOutput)\n\n# Add constraints\n## The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels of Type A: \", model.getVal(PanelA))\n    print(\"Number of Solar Panels of Type B: \", model.getVal(PanelB))\n    print(\"Number of Solar Panels of Type C: \", model.getVal(PanelC))\n    print(\"Number of Solar Panels of Type D: \", model.getVal(PanelD))\n    print(\"Maximized Energy Output per Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (TruckX, TruckY, TruckZ), the speed at which each truck operates (SpeedX, SpeedY, SpeedZ), and the fuel efficiency of each truck (FuelEffX, FuelEffY, FuelEffZ).\n// {\"number of trucks in region X\": \"TruckX\", \"range\": \"TruckX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region Y\": \"TruckY\", \"range\": \"TruckY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region Z\": \"TruckZ\", \"range\": \"TruckZ >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in region X\": \"SpeedX\", \"range\": \"0 < SpeedX <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in region Y\": \"SpeedY\", \"range\": \"0 < SpeedY <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in region Z\": \"SpeedZ\", \"range\": \"0 < SpeedZ <= 60\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region X\": \"FuelEffX\", \"range\": \"FuelEffX >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region Y\": \"FuelEffY\", \"range\": \"FuelEffY >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region Z\": \"FuelEffZ\", \"range\": \"FuelEffZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption of each truck is a nonlinear function of its speed and fuel efficiency. The faster the truck, the more fuel it consumes, but the higher the fuel efficiency, the less fuel it consumes per unit distance.\n// Total fuel consumption for region X: FuelConsX = (TruckX * SpeedX^2) / FuelEffX\n// Total fuel consumption for region Y: FuelConsY = (TruckY * SpeedY^2) / FuelEffY\n// Total fuel consumption for region Z: FuelConsZ = (TruckZ * SpeedZ^2) / FuelEffZ\n// So, the objective function is: Minimize (FuelConsX + FuelConsY + FuelConsZ)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across the three regions.\n// TruckX + TruckY + TruckZ <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (TruckX, TruckY, TruckZ), the speed at which each truck operates (SpeedX, SpeedY, SpeedZ), and the fuel efficiency of each truck (FuelEffX, FuelEffY, FuelEffZ). The company wants to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption of each truck is a nonlinear function of its speed and fuel efficiency. The faster the truck, the more fuel it consumes, but the higher the fuel efficiency, the less fuel it consumes per unit distance.\n\n| Variable          | Range/Constraints                     |\n|-------------------|---------------------------------------|\n| TruckX            | TruckX >= 0                           |\n| TruckY            | TruckY >= 0                           |\n| TruckZ            | TruckZ >= 0                           |\n| SpeedX            | 0 < SpeedX <= 60                      |\n| SpeedY            | 0 < SpeedY <= 60                      |\n| SpeedZ            | 0 < SpeedZ <= 60                      |\n| FuelEffX          | FuelEffX >= 0                         |\n| FuelEffY          | FuelEffY >= 0                         |\n| FuelEffZ          | FuelEffZ >= 0                         |\n\nThe company has a total of 50 trucks available for allocation across the three regions. The total fuel consumption for each region is given by the formula: FuelConsX = (TruckX * SpeedX^2) / FuelEffX for region X, FuelConsY = (TruckY * SpeedY^2) / FuelEffY for region Y, and FuelConsZ = (TruckZ * SpeedZ^2) / FuelEffZ for region Z.\n\nPlease help the company to minimize the total fuel consumption (FuelConsX + FuelConsY + FuelConsZ) while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckX = model.addVar(vtype=\"INTEGER\", name=\"TruckX\", lb=0) # number of trucks in region X\nTruckY = model.addVar(vtype=\"INTEGER\", name=\"TruckY\", lb=0) # number of trucks in region Y\nTruckZ = model.addVar(vtype=\"INTEGER\", name=\"TruckZ\", lb=0) # number of trucks in region Z\nSpeedX = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedX\", lb=0, ub=60) # speed of trucks in region X\nSpeedY = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedY\", lb=0, ub=60) # speed of trucks in region Y\nSpeedZ = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedZ\", lb=0, ub=60) # speed of trucks in region Z\nFuelEffX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffX\", lb=0) # fuel efficiency of trucks in region X\nFuelEffY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffY\", lb=0) # fuel efficiency of trucks in region Y\nFuelEffZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffZ\", lb=0) # fuel efficiency of trucks in region Z\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsX = (TruckX * SpeedX**2) / FuelEffX\nFuelConsY = (TruckY * SpeedY**2) / FuelEffY\nFuelConsZ = (TruckZ * SpeedZ**2) / FuelEffZ\n## the objective function is: Minimize (FuelConsX + FuelConsY + FuelConsZ)\nmodel.addCons(obj == FuelConsX + FuelConsY + FuelConsZ)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation across the three regions.\nmodel.addCons(TruckX + TruckY + TruckZ <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region X: \", model.getVal(TruckX))\n    print(\"Number of Trucks in Region Y: \", model.getVal(TruckY))\n    print(\"Number of Trucks in Region Z: \", model.getVal(TruckZ))\n    print(\"Speed of Trucks in Region X: \", model.getVal(SpeedX))\n    print(\"Speed of Trucks in Region Y: \", model.getVal(SpeedY))\n    print(\"Speed of Trucks in Region Z: \", model.getVal(SpeedZ))\n    print(\"Fuel Efficiency of Trucks in Region X: \", model.getVal(FuelEffX))\n    print(\"Fuel Efficiency of Trucks in Region Y: \", model.getVal(FuelEffY))\n    print(\"Fuel Efficiency of Trucks in Region Z: \", model.getVal(FuelEffZ))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1869,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company needs to minimize the total daily operational cost and fuel consumption.\n// Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n// Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (Cost + Fuel)\n\n## Generate Constraint-1:\nThe company has a daily demand of 1000 km of transportation.\n// 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation. The fuel consumption and operational costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/km) | Operational Cost ($/day) |\n|------------|------------------------------|--------------------------|\n| Type 1     | 5                            | 100                      |\n| Type 2     | 4                            | 120                      |\n| Type 3     | 3                            | 150                      |\n| Type 4     | 2.5                          | 180                      |\n| Type 5     | 2                            | 200                      |\n\nThe company has a daily demand of 1000 km of transportation. Please help the company to minimize the total daily operational cost and fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption and operational cost\nFuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\nCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost + Fuel)\nmodel.addCons(obj == Cost + Fuel)\n\n# Add constraints\n## The company has a daily demand of 1000 km of transportation.\nmodel.addCons(5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Daily Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines.\n// {\"cargo weight in truck 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The company aims to minimize the total fuel cost.\n// Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\n// So, the objective function is: Minimize Total fuel cost\n\n## Generate Constraint-1:\nThe total weight of cargo to be delivered is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons.\n// Truck1 <= 20\n// Truck2 <= 30\n// Truck3 <= 25\n// Truck4 <= 20\n// Truck5 <= 15\n\n## Generate Constraint-3:\nThe company has a policy to ensure that no truck carries more than 50% of the total cargo weight.\n// Truck1 <= 0.5 * 100\n// Truck2 <= 0.5 * 100\n// Truck3 <= 0.5 * 100\n// Truck4 <= 0.5 * 100\n// Truck5 <= 0.5 * 100",
        "question": "A logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines. The fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The total weight of cargo to be delivered is 100 tons. Each truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons. The company has a policy to ensure that no truck carries more than 50% of the total cargo weight. Please help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1\", lb=0)  # cargo weight in truck 1\nTruck2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2\", lb=0)  # cargo weight in truck 2\nTruck3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3\", lb=0)  # cargo weight in truck 3\nTruck4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4\", lb=0)  # cargo weight in truck 4\nTruck5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5\", lb=0)  # cargo weight in truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\nmodel.addCons(obj == 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5))\n\n# Add constraints\n## The total weight of cargo to be delivered is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n## Each truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons.\nmodel.addCons(Truck1 <= 20)\nmodel.addCons(Truck2 <= 30)\nmodel.addCons(Truck3 <= 25)\nmodel.addCons(Truck4 <= 20)\nmodel.addCons(Truck5 <= 15)\n## The company has a policy to ensure that no truck carries more than 50% of the total cargo weight.\nmodel.addCons(Truck1 <= 0.5 * 100)\nmodel.addCons(Truck2 <= 0.5 * 100)\nmodel.addCons(Truck3 <= 0.5 * 100)\nmodel.addCons(Truck4 <= 0.5 * 100)\nmodel.addCons(Truck5 <= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo weight in Truck 1: \", model.getVal(Truck1))\n    print(\"Cargo weight in Truck 2: \", model.getVal(Truck2))\n    print(\"Cargo weight in Truck 3: \", model.getVal(Truck3))\n    print(\"Cargo weight in Truck 4: \", model.getVal(Truck4))\n    print(\"Cargo weight in Truck 5: \", model.getVal(Truck5))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000\n\n## Generate Constraint-2:\nThe total production hours available in the Testing department is 800 hours.\n// TestingHours <= 800",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | 100$            |\n| DeviceB | 150$            |\n| DeviceC | 200$            |\n\nThe total production hours available in the Assembly department is 1000 hours. The total production hours available in the Testing department is 800 hours.\n\nPlease help the company to determine the optimal number of units to produce for each device and the number of hours to allocate for production in each department to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0) # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0) # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0) # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(AssemblyHours <= 1000)\nmodel.addCons(TestingHours <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of cars\": \"Cars\", \"range\": \"Cars >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck can carry 5000 kg of cargo and consumes 50 liters of fuel per 100 km. Each van can carry 2000 kg of cargo and consumes 30 liters of fuel per 100 km. Each car can carry 500 kg of cargo and consumes 10 liters of fuel per 100 km. The company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The objective is to maximize the total profit while minimizing the total fuel cost.\n// Profit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\n// FuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n// So, the objective function is: Maximize (Profit - FuelCost)\n// Maximize (0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars) - (50 * Trucks + 30 * Vans + 10 * Cars) * 5)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet or exceed the required 100,000 kg.\n// 5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// (50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000\n\n## Generate Constraint-3:\nThe company can only acquire a maximum of 20 vehicles in total.\n// Trucks + Vans + Cars <= 20",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and cars, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while minimizing fuel costs and meeting customer demand. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Cargo Capacity | Fuel Consumption (liters/100 km) |\n|--------------|----------------|----------------------------------|\n| Trucks       | 5000 kg        | 50                               |\n| Vans         | 2000 kg        | 30                               |\n| Cars         | 500 kg         | 10                               |\n\nThe company needs to transport at least 100,000 kg of cargo over a distance of 500 km. The profit per kg of cargo transported is $0.02. The company has a budget of $10,000 for fuel costs. The company can only acquire a maximum of 20 vehicles in total. \n\nPlease help the company to maximize the total profit while minimizing the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nCars = model.addVar(vtype=\"INTEGER\", name=\"Cars\", lb=0)  # number of cars\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.02 * (5000 * Trucks + 2000 * Vans + 500 * Cars)\nFuelCost = (50 * Trucks + 30 * Vans + 10 * Cars) * 5\n## the objective function is: Maximize (Profit - FuelCost)\nmodel.addCons(obj == Profit - FuelCost)\n\n# Add constraints\n## The total cargo capacity must meet or exceed the required 100,000 kg.\nmodel.addCons(5000 * Trucks + 2000 * Vans + 500 * Cars >= 100000)\n## The company has a budget of $10,000 for fuel costs.\nmodel.addCons((50 * Trucks + 30 * Vans + 10 * Cars) * 5 <= 10000)\n## The company can only acquire a maximum of 20 vehicles in total.\nmodel.addCons(Trucks + Vans + Cars <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Cars: \", model.getVal(Cars))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n// Net profit per truck on route A: Profit_A = (1500 - 1000) * A\n// Net profit per truck on route B: Profit_B = (1800 - 1200) * B\n// Net profit per truck on route C: Profit_C = (2200 - 1500) * C\n// Net profit per truck on route D: Profit_D = (2500 - 1800) * D\n// Net profit per truck on route E: Profit_E = (3000 - 2000) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks allocated cannot exceed 20.\n// A + B + C + D + E <= 20\n\n## Generate Constraint-4:\nThe number of trucks on route D must not exceed the total number of trucks on routes A and B combined.\n// D <= A + B\n\n## Generate Constraint-5:\nThe number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D combined.\n// E <= A + B + C + D",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs. Each route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated. The company has a budget of $10,000 for operational costs. The company must allocate at least 5 trucks to each route. The total number of trucks allocated cannot exceed 20. The number of trucks on route D must not exceed the total number of trucks on routes A and B combined. The number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D combined. Please help the company to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1500 - 1000) * A\nProfit_B = (1800 - 1200) * B\nProfit_C = (2200 - 1500) * C\nProfit_D = (2500 - 1800) * D\nProfit_E = (3000 - 2000) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000)\n## The total number of trucks allocated cannot exceed 20.\nmodel.addCons(A + B + C + D + E <= 20)\n## The number of trucks on route D must not exceed the total number of trucks on routes A and B combined.\nmodel.addCons(D <= A + B)\n## The number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D combined.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck at warehouse 1 incurs a cost of $50 per km and can travel 100 km per day.\nEach truck at warehouse 2 incurs a cost of $60 per km and can travel 90 km per day.\nEach truck at warehouse 3 incurs a cost of $70 per km and can travel 80 km per day.\nEach truck at warehouse 4 incurs a cost of $80 per km and can travel 70 km per day.\nEach truck at warehouse 5 incurs a cost of $90 per km and can travel 60 km per day.\nThe company needs to deliver at least 5000 km worth of goods per day. The objective is to minimize the total daily transportation cost.\n// Total daily cost: Cost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\n// Total daily distance: Distance = 100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe total daily distance must meet or exceed 5000 km.\n// 100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5 >= 5000\n\n## Generate Constraint-4:\nAt least 10 trucks must be allocated to warehouse 1.\n// T1 >= 10",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost per km and daily travel distance for each warehouse are given in the following Table.\n\n| Warehouse | Cost per km | Daily Travel Distance |\n|-----------|-------------|-----------------------|\n| 1         | $50         | 100 km                |\n| 2         | $60         | 90 km                 |\n| 3         | $70         | 80 km                 |\n| 4         | $80         | 70 km                 |\n| 5         | $90         | 60 km                 |\n\nThe company has a total of 100 trucks available. Each warehouse can handle a maximum of 30 trucks. The total daily distance must meet or exceed 5000 km. At least 10 trucks must be allocated to warehouse 1.\nPlease help the company to minimize the total daily transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\nCost = 50 * 100 * T1 + 60 * 90 * T2 + 70 * 80 * T3 + 80 * 70 * T4 + 90 * 60 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100) # Total of 100 trucks available\nmodel.addCons(T1 <= 30) # Each warehouse can handle a maximum of 30 trucks\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\nmodel.addCons(100 * T1 + 90 * T2 + 80 * T3 + 70 * T4 + 60 * T5 >= 5000) # Total daily distance must meet or exceed 5000 km\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation.\n// Cost_T1 = 2 * T1\n// Cost_T2 = 3 * T2\n// Cost_T3 = 4 * T3\n// Cost_T4 = 5 * T4\n// Cost_T5 = 6 * T5\n// The objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe total demand for transportation is 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs. Each type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation. The total demand for transportation is 1000 tons. The company has a budget of $2000 for operational costs. The company can only operate a maximum of 50 trucks in total. Please help the company to minimize the total operational cost per ton transported.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 2 * T1\nCost_T2 = 3 * T2\nCost_T3 = 4 * T3\nCost_T4 = 5 * T4\nCost_T5 = 6 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total demand for transportation is 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n## The company has a budget of $2000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000)\n## The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepsA\", \"range\": \"SalesRepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepsB\", \"range\": \"SalesRepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepsC\", \"range\": \"SalesRepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\n// Total revenue for ProductB: RevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\n// Total revenue for ProductC: RevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 sales representatives available.\n// SalesRepsA + SalesRepsB + SalesRepsC <= 50\n\n## Generate Constraint-3:\nThe production capacity for each product is limited. ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n// QuantityA <= 1000; QuantityB <= 1500; QuantityC <= 2000\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n// QuantityA >= 100; QuantityB >= 200\n\n## Generate Constraint-5:\nThe number of sales representatives assigned to ProductA must be at least twice the number assigned to ProductB.\n// SalesRepsA >= 2 * SalesRepsB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives, and is given by the formula: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n\nThe company has the following constraints:\n1. The total marketing budget for all products cannot exceed $100,000.\n2. The company has a total of 50 sales representatives available.\n3. The production capacity for each product is limited. ProductA can produce up to 1000 units, ProductB up to 1500 units, and ProductC up to 2000 units.\n4. The company must ensure that at least 100 units of ProductA and 200 units of ProductB are produced.\n5. The number of sales representatives assigned to ProductA must be at least twice the number assigned to ProductB.\n\nPlease help the company to determine the optimal production quantity, marketing budget, and number of sales representatives for each product to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=100, ub=1000)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=200, ub=1500)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=2000)  # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nSalesRepsA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsA\", lb=0)  # number of sales representatives for ProductA\nSalesRepsB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsB\", lb=0)  # number of sales representatives for ProductB\nSalesRepsC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsC\", lb=0)  # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\nRevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\nRevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)  # total marketing budget constraint\nmodel.addCons(SalesRepsA + SalesRepsB + SalesRepsC <= 50)  # total sales representatives constraint\nmodel.addCons(SalesRepsA >= 2 * SalesRepsB)  # sales representatives assignment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Sales Reps for ProductA: \", model.getVal(SalesRepsA))\n    print(\"Number of Sales Reps for ProductB: \", model.getVal(SalesRepsB))\n    print(\"Number of Sales Reps for ProductC: \", model.getVal(SalesRepsC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1448,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each truck on Route A\": \"Distance_A\", \"range\": \"Distance_A >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route B\": \"Distance_B\", \"range\": \"Distance_B >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each truck on Route C\": \"Distance_C\", \"range\": \"Distance_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Consumption_A = Trucks_A * Distance_A^2\n// Fuel_Consumption_B = Trucks_B * Distance_B^2\n// Fuel_Consumption_C = Trucks_C * Distance_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for all routes.\n// Trucks_A + Trucks_B + Trucks_C <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks used for each route to minimize fuel consumption and operational costs. The variables include the number of trucks assigned to each route and the distance traveled by each truck on its route. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled, where fuel consumption increases nonlinearly with distance due to factors like engine efficiency and load. The company aims to minimize the total fuel consumption across all routes. The company has a total of 50 trucks available for all routes. Please help the company determine the optimal number of trucks for each route and the distance each truck should travel to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0)  # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0)  # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0)  # number of trucks for Route C\nDistance_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_A\", lb=0)  # distance traveled by each truck on Route A\nDistance_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_B\", lb=0)  # distance traveled by each truck on Route B\nDistance_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_C\", lb=0)  # distance traveled by each truck on Route C\n\n# Define objective function\nFuel_Consumption_A = Trucks_A * Distance_A**2\nFuel_Consumption_B = Trucks_B * Distance_B**2\nFuel_Consumption_C = Trucks_C * Distance_C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\n\n# Add constraints\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Distance Traveled by Each Truck on Route A: \", model.getVal(Distance_A))\n    print(\"Distance Traveled by Each Truck on Route B: \", model.getVal(Distance_B))\n    print(\"Distance Traveled by Each Truck on Route C: \", model.getVal(Distance_C))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n// Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck allocations and technology investments.\n// Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\n// Trucks1 >= 100; Trucks2 >= 150",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands. The operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n\n| Route | Initial Fuel Cost per Kilometer | Decrease in Fuel Cost per $1000 Investment |\n|-------|---------------------------------|-------------------------------------------|\n| Route1 | $0.50                          | $0.05                                     |\n| Route2 | $0.40                          | $0.03                                     |\n\nThe company has a total budget of $100,000 for both truck allocations and technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual agreements, the company must allocate at least 100 trucks to Route1 and 150 trucks to Route2.\n\nPlease help the company to minimize the total operational cost, which includes fuel and technology investment costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=100)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=150)  # number of trucks for Route2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0)  # distance for Route1\nDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0)  # distance for Route2\n## Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n## Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n## So, the objective function is: Minimize (Cost1 + Cost2)\nCost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\nCost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n## The company has a total budget of $100,000 for both truck allocations and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000)\n## The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1459,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines.\n// {\"cargo weight in truck 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The company aims to minimize the total fuel cost.\n// Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\n// So, the objective function is: Minimize Total fuel cost\n\n## Generate Constraint-1:\nThe total weight of cargo to be delivered is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons.\n// Truck1 <= 20\n// Truck2 <= 30\n// Truck3 <= 25\n// Truck4 <= 20\n// Truck5 <= 15",
        "question": "A logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines. The fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The company aims to minimize the total fuel cost.\n\n| Truck | Fuel Cost per Kilometer per Ton | Maximum Capacity |\n|-------|---------------------------------|------------------|\n| 1     | $0.1                            | 20 tons          |\n| 2     | $0.12                           | 30 tons          |\n| 3     | $0.15                           | 25 tons          |\n| 4     | $0.18                           | 20 tons          |\n| 5     | $0.2                            | 15 tons          |\n\nThe total weight of cargo to be delivered is 100 tons. Each truck has a maximum capacity as shown in the table. Please help the company to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1\", lb=0) # cargo weight in truck 1\nTruck2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2\", lb=0) # cargo weight in truck 2\nTruck3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3\", lb=0) # cargo weight in truck 3\nTruck4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4\", lb=0) # cargo weight in truck 4\nTruck5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5\", lb=0) # cargo weight in truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\nTotalFuelCost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n## The total weight of cargo to be delivered is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n## Each truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons.\nmodel.addCons(Truck1 <= 20)\nmodel.addCons(Truck2 <= 30)\nmodel.addCons(Truck3 <= 25)\nmodel.addCons(Truck4 <= 20)\nmodel.addCons(Truck5 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo weight in Truck 1: \", model.getVal(Truck1))\n    print(\"Cargo weight in Truck 2: \", model.getVal(Truck2))\n    print(\"Cargo weight in Truck 3: \", model.getVal(Truck3))\n    print(\"Cargo weight in Truck 4: \", model.getVal(Truck4))\n    print(\"Cargo weight in Truck 5: \", model.getVal(Truck5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1223,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"IB\", \"range\": \"IB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"IC\", \"range\": \"IC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of labor per hour is $20. The investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - 20 * LA) * QA - IA\n// ProfitB = (150 - 20 * LB) * QB - IB\n// ProfitC = (200 - 20 * LC) * QC - IC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 5000 labor hours available for the month.\n// QA * LA + QB * LB + QC * LC <= 5000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// IA + IB + IC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities for each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology for each product line, which will reduce the labor hours required per unit. The revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of labor per hour is $20. The investment in automation reduces the labor hours per unit by 0.1 hours for every $1000 invested. The company aims to maximize the total profit from all products. The company has a total of 5000 labor hours available for the month. The total investment in automation cannot exceed $50,000. Please help the company determine the optimal production quantities and investments in automation to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=0) # labor hours per unit for ProductA\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=0) # labor hours per unit for ProductB\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=0) # labor hours per unit for ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in automation for ProductA\nIB = model.addVar(vtype=\"CONTINUOUS\", name=\"IB\", lb=0) # investment in automation for ProductB\nIC = model.addVar(vtype=\"CONTINUOUS\", name=\"IC\", lb=0) # investment in automation for ProductC\n\n# Define objective function\nProfitA = (100 - 20 * LA) * QA - IA\nProfitB = (150 - 20 * LB) * QB - IB\nProfitC = (200 - 20 * LC) * QC - IC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QA * LA + QB * LB + QC * LC <= 5000)\nmodel.addCons(IA + IB + IC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Labor hours per unit for ProductA: \", model.getVal(LA))\n    print(\"Labor hours per unit for ProductB: \", model.getVal(LB))\n    print(\"Labor hours per unit for ProductC: \", model.getVal(LC))\n    print(\"Investment in automation for ProductA: \", model.getVal(IA))\n    print(\"Investment in automation for ProductB: \", model.getVal(IB))\n    print(\"Investment in automation for ProductC: \", model.getVal(IC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and maintenance costs. Additionally, the company needs to decide on the optimal speed for each truck to further reduce costs, as fuel consumption and maintenance costs are nonlinearly related to speed.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for trucks in Region 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs for each truck are nonlinearly related to the speed at which they operate. The cost function for each region is given by:\nCost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region.\nThe company aims to minimize the total cost across all regions.\n// Total cost for Region 1: Cost1 = Trucks1 * (a1 * (Speed1^2) + b1 * Speed1 + c1)\n// Total cost for Region 2: Cost2 = Trucks2 * (a2 * (Speed2^2) + b2 * Speed2 + c2)\n// Total cost for Region 3: Cost3 = Trucks3 * (a3 * (Speed3^2) + b3 * Speed3 + c3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-2:\nDue to regulatory restrictions, the speed of trucks in each region must not exceed 100 km/h.\n// Speed1 <= 100; Speed2 <= 100; Speed3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the optimal speed for each truck to minimize fuel consumption and maintenance costs. The costs are nonlinearly related to the speed at which the trucks operate. The cost function for each region is given by: Cost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region.\n\n| Region | Constants (a, b, c) | Maximum Speed |\n|--------|----------------------|---------------|\n| 1      | a1, b1, c1          | 100 km/h      |\n| 2      | a2, b2, c2          | 100 km/h      |\n| 3      | a3, b3, c3          | 100 km/h      |\n\nThe company has a total of 100 trucks available for allocation across the three regions. Due to regulatory restrictions, the speed of trucks in each region must not exceed 100 km/h.\n\nPlease help the company to minimize the total cost across all regions by determining the optimal number of trucks for each region (Trucks1, Trucks2, Trucks3) and the optimal speed for each region (Speed1, Speed2, Speed3).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # optimal speed for trucks in Region 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # optimal speed for trucks in Region 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # optimal speed for trucks in Region 3\n\n# Define objective function\n# Constants for the cost function\na1, b1, c1 = 0.01, 0.5, 10  # example values for Region 1\na2, b2, c2 = 0.02, 0.6, 12  # example values for Region 2\na3, b3, c3 = 0.03, 0.7, 14  # example values for Region 3\n\n# Calculate costs for each region\nCost1 = Trucks1 * (a1 * Speed1**2 + b1 * Speed1 + c1)\nCost2 = Trucks2 * (a2 * Speed2**2 + b2 * Speed2 + c2)\nCost3 = Trucks3 * (a3 * Speed3**2 + b3 * Speed3 + c3)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# Total number of trucks available in the fleet is limited to 100\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n# Speed of trucks in each region must not exceed 100 km/h\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\nmodel.addCons(Speed3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Optimal Speed for Region 1: \", model.getVal(Speed1))\n    print(\"Optimal Speed for Region 2: \", model.getVal(Speed2))\n    print(\"Optimal Speed for Region 3: \", model.getVal(Speed3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made.\n// Fuel consumption for Route1: Consumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\n// Fuel consumption for Route2: Consumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and technology investments.\n// Fuel1 + Fuel2 + Investment <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. Additionally, the company is considering investing in a new fuel-efficient technology that can be applied to a portion of the fleet. The fuel consumption of each truck is affected by the new fuel-efficient technology, which reduces fuel usage by a factor of (1 - 0.01 * Investment) for each unit of fuel. The company aims to minimize the total fuel consumption while ensuring all deliveries are made.\n\n| Variable                | Description                          |\n|-------------------------|--------------------------------------|\n| Trucks1                 | Number of trucks for Route1          |\n| Trucks2                 | Number of trucks for Route2          |\n| Fuel1                   | Amount of fuel for Route1            |\n| Fuel2                   | Amount of fuel for Route2            |\n| Investment              | Investment in fuel-efficient technology |\n\nThe company has a budget of $100,000 for fuel and technology investments. Please help the company to minimize the total fuel consumption (Consumption1 + Consumption2) while adhering to the budget constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # amount of fuel for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # amount of fuel for Route2\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0)  # investment in fuel-efficient technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = Fuel1 / (1 - 0.01 * Investment) * Trucks1\nConsumption2 = Fuel2 / (1 - 0.01 * Investment) * Trucks2\n## the objective function is: Minimize (Consumption1 + Consumption2)\n## convert the division to multiplication\nmodel.addCons(obj * (1 - 0.01 * Investment) * Trucks1 == Fuel1)\nmodel.addCons(obj * (1 - 0.01 * Investment) * Trucks2 == Fuel2)\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel and technology investments.\nmodel.addCons(Fuel1 + Fuel2 + Investment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Amount of Fuel for Route1: \", model.getVal(Fuel1))\n    print(\"Amount of Fuel for Route2: \", model.getVal(Fuel2))\n    print(\"Investment in Fuel-Efficient Technology: \", model.getVal(Investment))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-saving technology for product A\": \"EnergyInvestA\", \"range\": \"EnergyInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product B\": \"EnergyInvestB\", \"range\": \"EnergyInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product C\": \"EnergyInvestC\", \"range\": \"EnergyInvestC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product D\": \"EnergyInvestD\", \"range\": \"EnergyInvestD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n// Profit of product A: ProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\n// Profit of product B: ProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\n// Profit of product C: ProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\n// Profit of product D: ProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for energy-saving technology investments.\n// EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000\n\n## Generate Constraint-2:\nThe total raw material cost must not exceed $50,000.\n// 30 * A + 40 * B + 50 * C + 60 * D <= 50000\n\n## Generate Constraint-3:\nThe total labor cost must not exceed $30,000.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 30000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\nThe company has a budget of $100,000 for energy-saving technology investments. The total raw material cost must not exceed $50,000. The total labor cost must not exceed $30,000.\nPlease help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # production quantity of product D\nEnergyInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestA\", lb=0) # investment in energy-saving technology for product A\nEnergyInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestB\", lb=0) # investment in energy-saving technology for product B\nEnergyInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestC\", lb=0) # investment in energy-saving technology for product C\nEnergyInvestD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestD\", lb=0) # investment in energy-saving technology for product D\n\n# Define objective function\nProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\nProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\nProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\nProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for energy-saving technology investments.\nmodel.addCons(EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000)\n# The total raw material cost must not exceed $50,000.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D <= 50000)\n# The total labor cost must not exceed $30,000.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Production Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Energy-Saving Technology for Product A: \", model.getVal(EnergyInvestA))\n    print(\"Investment in Energy-Saving Technology for Product B: \", model.getVal(EnergyInvestB))\n    print(\"Investment in Energy-Saving Technology for Product C: \", model.getVal(EnergyInvestC))\n    print(\"Investment in Energy-Saving Technology for Product D: \", model.getVal(EnergyInvestD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. Trucks generate $1000 per trip, consume 50 liters of fuel, and can make 2 trips per day. Vans generate $500 per trip, consume 20 liters of fuel, and can make 3 trips per day. Bikes generate $100 per trip, consume 1 liter of fuel, and can make 5 trips per day. The company aims to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n// Efficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\n// Efficiency_Van = (500 * 3 * V) / (20 * 3 * V)\n// Efficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 1000 liters per day.\n// 50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 vehicles available in total.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by the revenue generated per unit of fuel consumed. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Trip | Fuel Consumption per Trip | Number of Trips per Day |\n|--------------|------------------|---------------------------|-------------------------|\n| Trucks       | $1000            | 50 liters                 | 2                       |\n| Vans         | $500             | 20 liters                 | 3                       |\n| Bikes        | $100             | 1 liter                   | 5                       |\n\nThe company has a total fuel budget of 1000 liters per day. The company has a maximum of 50 vehicles available in total. Please help the company to maximize the total daily efficiency, which is the sum of the revenue from all vehicles divided by the total fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = (1000 * 2 * T) / (50 * 2 * T)\nEfficiency_Van = (500 * 3 * V) / (20 * 3 * V)\nEfficiency_Bike = (100 * 5 * B) / (1 * 5 * B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * 2 * T + 20 * 3 * V + 1 * 5 * B) == 1000 * 2 * T + 500 * 3 * V + 100 * 5 * B)\n\n# Add constraints\n## The company has a total fuel budget of 1000 liters per day.\nmodel.addCons(50 * 2 * T + 20 * 3 * V + 1 * 5 * B <= 1000)\n## The company has a maximum of 50 vehicles available in total.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Daily Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for furniture\": \"FurnitureTripsPerTruck\", \"range\": \"FurnitureTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishables\": \"PerishablesTripsPerTruck\", \"range\": \"PerishablesTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for electronics is $300, for furniture is $200, and for perishables is $400. The company aims to maximize the total daily profit from all trips.\n// Profit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\n// Profit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\n// Profit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n## Generate Constraint-1:\nThe company has a total of 50 drivers available for the day.\n// ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000. The fuel cost per trip for electronics is $20, for furniture is $30, and for perishables is $40.\n// 20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 30 * FurnitureTrucks * FurnitureTripsPerTruck + 40 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000\n\n## Generate Constraint-3:\nThe total storage capacity of the company is 1000 cubic meters. The space required per trip for electronics is 10 cubic meters, for furniture is 20 cubic meters, and for perishables is 15 cubic meters.\n// 10 * ElectronicsTrucks * ElectronicsTripsPerTruck + 20 * FurnitureTrucks * FurnitureTripsPerTruck + 15 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000\n\n## Generate Constraint-4:\nThe company has a policy to ensure at least 10% of the total trips are for perishables to maintain freshness and customer satisfaction.\n// PerishablesTrucks * PerishablesTripsPerTruck >= 0.10 * (ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck)",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity.\nThe profit per trip for electronics is $300, for furniture is $200, and for perishables is $400. The company aims to maximize the total daily profit from all trips.\nThe company has a total of 50 drivers available for the day. The company has a daily fuel budget of $1000. The fuel cost per trip for electronics is $20, for furniture is $30, and for perishables is $40. The total storage capacity of the company is 1000 cubic meters. The space required per trip for electronics is 10 cubic meters, for furniture is 20 cubic meters, and for perishables is 15 cubic meters. The company has a policy to ensure at least 10% of the total trips are for perishables to maintain freshness and customer satisfaction.\nPlease help the company to maximize the total daily profit from all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nFurnitureTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTripsPerTruck\", lb=0)\nPerishablesTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\nProfit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\nProfit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n# Add constraints\n# Constraint-1: Total drivers available\nmodel.addCons(ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50)\n# Constraint-2: Daily fuel budget\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 30 * FurnitureTrucks * FurnitureTripsPerTruck + 40 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000)\n# Constraint-3: Total storage capacity\nmodel.addCons(10 * ElectronicsTrucks * ElectronicsTripsPerTruck + 20 * FurnitureTrucks * FurnitureTripsPerTruck + 15 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000)\n# Constraint-4: Perishables trip policy\nmodel.addCons(PerishablesTrucks * PerishablesTripsPerTruck >= 0.10 * (ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Furniture: \", model.getVal(FurnitureTripsPerTruck))\n    print(\"Trips per Truck for Perishables: \", model.getVal(PerishablesTripsPerTruck))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"Auto_A\", \"range\": \"Auto_A >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"Auto_B\", \"range\": \"Auto_B >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"Auto_C\", \"range\": \"Auto_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 5 * Auto_A)) * Q_A\n// Profit_B = (180 - (120 - 5 * Auto_B)) * Q_B\n// Profit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation.\n// Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Initial Production Cost | Decrease in Cost per Unit of Automation |\n|---------|---------------|-------------------------|-----------------------------------------|\n| ProductA | $150 | $100 | $5 |\n| ProductB | $180 | $120 | $5 |\n| ProductC | $200 | $150 | $5 |\n\nThe company has a total budget of $100,000 for implementing automation. Please help the company determine the optimal production quantities and levels of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAuto_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_A\", lb=0) # level of automation for ProductA\nAuto_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_B\", lb=0) # level of automation for ProductB\nAuto_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_C\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 5 * Auto_A)) * Q_A\nProfit_B = (180 - (120 - 5 * Auto_B)) * Q_B\nProfit_C = (200 - (150 - 5 * Auto_C)) * Q_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation for ProductA: \", model.getVal(Auto_A))\n    print(\"Level of Automation for ProductB: \", model.getVal(Auto_B))\n    print(\"Level of Automation for ProductC: \", model.getVal(Auto_C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: Truck, Van, and Bike. The company needs to determine the number of trips each vehicle should make to optimize the total transportation cost. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type, which will reduce the fuel cost per trip.\n// {\"number of trips for Truck\": \"TripsTruck\", \"range\": \"TripsTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Van\": \"TripsVan\", \"range\": \"TripsVan >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Bike\": \"TripsBike\", \"range\": \"TripsBike >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Truck\": \"TechTruck\", \"range\": \"TechTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Van\": \"TechVan\", \"range\": \"TechVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bike\": \"TechBike\", \"range\": \"TechBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per trip decreases with the investment in fuel-efficient technology. For Trucks, the initial fuel cost per trip is $100, and for every $500 invested in technology, the cost decreases by $5 per trip. For Vans, the initial fuel cost per trip is $70, and for every $400 invested in technology, the cost decreases by $4 per trip. For Bikes, the initial fuel cost per trip is $20, and for every $200 invested in technology, the cost decreases by $2 per trip. The company aims to minimize the total fuel cost for all vehicles.\n// FuelCostTruck = (100 - 0.01 * TechTruck) * TripsTruck\n// FuelCostVan = (70 - 0.01 * TechVan) * TripsVan\n// FuelCostBike = (20 - 0.01 * TechBike) * TripsBike\n// So, the objective function is: Minimize (FuelCostTruck + FuelCostVan + FuelCostBike)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for investments in fuel-efficient technologies and operational costs.\n// TechTruck + TechVan + TechBike + 100 * TripsTruck + 70 * TripsVan + 20 * TripsBike <= 20000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: Truck, Van, and Bike. The company needs to determine the number of trips each vehicle should make and the investment in fuel-efficient technologies for each vehicle type to optimize the total transportation cost. The initial fuel cost per trip and the reduction in fuel cost per trip with investment in technology for each vehicle type are given in the following Table.\n\n| Vehicle | Initial Fuel Cost per Trip | Reduction in Fuel Cost per $1000 Investment |\n|---------|---------------------------|-------------------------------------------|\n| Truck   | $100                      | $5 per $500 invested                      |\n| Van     | $70                       | $4 per $400 invested                      |\n| Bike    | $20                       | $2 per $200 invested                      |\n\nThe company has a total budget of $20,000 for investments in fuel-efficient technologies and operational costs. The company aims to minimize the total fuel cost for all vehicles. Please help the company determine the optimal number of trips for each vehicle and the investment in fuel-efficient technologies to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsTruck = model.addVar(vtype=\"INTEGER\", name=\"TripsTruck\", lb=0) # number of trips for Truck\nTripsVan = model.addVar(vtype=\"INTEGER\", name=\"TripsVan\", lb=0) # number of trips for Van\nTripsBike = model.addVar(vtype=\"INTEGER\", name=\"TripsBike\", lb=0) # number of trips for Bike\nTechTruck = model.addVar(name=\"TechTruck\", lb=0) # investment in fuel-efficient technology for Truck\nTechVan = model.addVar(name=\"TechVan\", lb=0) # investment in fuel-efficient technology for Van\nTechBike = model.addVar(name=\"TechBike\", lb=0) # investment in fuel-efficient technology for Bike\n\n# Define objective function\nFuelCostTruck = (100 - 0.01 * TechTruck) * TripsTruck\nFuelCostVan = (70 - 0.01 * TechVan) * TripsVan\nFuelCostBike = (20 - 0.01 * TechBike) * TripsBike\n# So, the objective function is: Minimize (FuelCostTruck + FuelCostVan + FuelCostBike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostTruck + FuelCostVan + FuelCostBike)\n\n# Add constraints\n# The company has a total budget of $20,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(TechTruck + TechVan + TechBike + 100 * TripsTruck + 70 * TripsVan + 20 * TripsBike <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck: \", model.getVal(TripsTruck))\n    print(\"Number of Trips for Van: \", model.getVal(TripsVan))\n    print(\"Number of Trips for Bike: \", model.getVal(TripsBike))\n    print(\"Investment in Fuel-Efficient Technology for Truck: \", model.getVal(TechTruck))\n    print(\"Investment in Fuel-Efficient Technology for Van: \", model.getVal(TechVan))\n    print(\"Investment in Fuel-Efficient Technology for Bike: \", model.getVal(TechBike))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities. The operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000. The operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000. The operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000. The operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500. The operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000. The company has a budget of $2,000,000 for purchasing vehicles.\n\nPlease help the company to minimize the total operational and maintenance costs while maximizing the total capacity, with the objective function being the minimization of the ratio of total operational and maintenance costs to total capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=0)  # number of Scooters\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: solar, wind, and hydro. The company needs to determine the optimal number of each type of power plant to maximize energy production while minimizing environmental impact and cost.\n// {\"number of solar power plants\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind power plants\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro power plants\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production per solar plant is 100 MWh, with a maintenance cost of $5000 per plant. The energy production per wind plant is 150 MWh, with a maintenance cost of $7000 per plant. The energy production per hydro plant is 200 MWh, with a maintenance cost of $10000 per plant. The company aims to maximize the net energy production (total energy produced minus the cost of maintenance per MWh).\n// Energy_Solar = 100 * Solar - 5000 / Solar\n// Energy_Wind = 150 * Wind - 7000 / Wind\n// Energy_Hydro = 200 * Hydro - 10000 / Hydro\n// So, the objective function is: Maximize (Energy_Solar + Energy_Wind + Energy_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for maintenance costs.\n// 5000 * Solar + 7000 * Wind + 10000 * Hydro <= 1000000\n\n## Generate Constraint-2:\nThe total energy production capacity should not exceed 10,000 MWh.\n// 100 * Solar + 150 * Wind + 200 * Hydro <= 10000\n\n## Generate Constraint-3:\nThe company has a limit of 50 power plants in total.\n// Solar + Wind + Hydro <= 50\n\n## Generate Constraint-4:\nThe environmental impact score (EIS) for each type of plant is 1 for solar, 2 for wind, and 3 for hydro. The total EIS should not exceed 100.\n// Solar + 2 * Wind + 3 * Hydro <= 100\n\n## Generate Constraint-5:\nThe market demand for solar energy requires at least 10 solar power plants.\n// Solar >= 10",
        "question": "A renewable energy company operates three types of power plants: solar, wind, and hydro. The company needs to determine the optimal number of each type of power plant to maximize energy production while minimizing environmental impact and cost. The energy production per solar plant is 100 MWh, with a maintenance cost of $5000 per plant. The energy production per wind plant is 150 MWh, with a maintenance cost of $7000 per plant. The energy production per hydro plant is 200 MWh, with a maintenance cost of $10000 per plant. The company aims to maximize the net energy production (total energy produced minus the cost of maintenance per MWh). The company has a budget of $1,000,000 for maintenance costs. The total energy production capacity should not exceed 10,000 MWh. The company has a limit of 50 power plants in total. The environmental impact score (EIS) for each type of plant is 1 for solar, 2 for wind, and 3 for hydro. The total EIS should not exceed 100. The market demand for solar energy requires at least 10 solar power plants. Please help the company to maximize the net energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=10) # number of solar power plants\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind power plants\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro power plants\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Solar = 100 * Solar - 5000 / Solar\nEnergy_Wind = 150 * Wind - 7000 / Wind\nEnergy_Hydro = 200 * Hydro - 10000 / Hydro\n## convert the division to multiplication\nmodel.addCons(obj == Energy_Solar + Energy_Wind + Energy_Hydro)\n\n# Add constraints\n## The company has a budget of $1,000,000 for maintenance costs.\nmodel.addCons(5000 * Solar + 7000 * Wind + 10000 * Hydro <= 1000000)\n## The total energy production capacity should not exceed 10,000 MWh.\nmodel.addCons(100 * Solar + 150 * Wind + 200 * Hydro <= 10000)\n## The company has a limit of 50 power plants in total.\nmodel.addCons(Solar + Wind + Hydro <= 50)\n## The environmental impact score (EIS) for each type of plant is 1 for solar, 2 for wind, and 3 for hydro. The total EIS should not exceed 100.\nmodel.addCons(Solar + 2 * Wind + 3 * Hydro <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Power Plants: \", model.getVal(Solar))\n    print(\"Number of Wind Power Plants: \", model.getVal(Wind))\n    print(\"Number of Hydro Power Plants: \", model.getVal(Hydro))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck on RouteA is $500, on RouteB is $600, and on RouteC is $700. The maintenance cost per truck on RouteA is $300, on RouteB is $400, and on RouteC is $500. The revenue per truck on RouteA is $1500, on RouteB is $2000, and on RouteC is $2500. The company aims to maximize the total net profit from all routes.\n// Total net profit for RouteA: Profit_A = (1500 - 500 - 300) * TrucksA\n// Total net profit for RouteB: Profit_B = (2000 - 600 - 400) * TrucksB\n// Total net profit for RouteC: Profit_C = (2500 - 700 - 500) * TrucksC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to road conditions, RouteA can handle a maximum of 20 trucks.\n// TrucksA <= 20\n\n## Generate Constraint-3:\nRouteB requires at least 10% of the total fleet due to contractual obligations.\n// TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC)\n\n## Generate Constraint-4:\nThe total maintenance cost across all routes must not exceed $15,000.\n// 300 * TrucksA + 400 * TrucksB + 500 * TrucksC <= 15000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route. The fuel cost per truck on RouteA is $500, on RouteB is $600, and on RouteC is $700. The maintenance cost per truck on RouteA is $300, on RouteB is $400, and on RouteC is $500. The revenue per truck on RouteA is $1500, on RouteB is $2000, and on RouteC is $2500. The company has a total of 50 trucks available. Due to road conditions, RouteA can handle a maximum of 20 trucks. RouteB requires at least 10% of the total fleet due to contractual obligations. The total maintenance cost across all routes must not exceed $15,000. Please help the company to maximize the total net profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks on RouteC\n\n# Define objective function\nProfit_A = (1500 - 500 - 300) * TrucksA\nProfit_B = (2000 - 600 - 400) * TrucksB\nProfit_C = (2500 - 700 - 500) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)  # Total of 50 trucks available\nmodel.addCons(TrucksA <= 20)  # RouteA can handle a maximum of 20 trucks\nmodel.addCons(TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC))  # RouteB requires at least 10% of the total fleet\nmodel.addCons(300 * TrucksA + 400 * TrucksB + 500 * TrucksC <= 15000)  # Total maintenance cost must not exceed $15,000\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3).\n// {\"number of S1 solar panels\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of S2 solar panels\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of S3 solar panels\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of S4 solar panels\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of S5 solar panels\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of W1 wind turbines\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of W2 wind turbines\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of W3 wind turbines\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total cost of installation while maximizing the energy output. The cost per unit for S1, S2, S3, S4, S5 solar panels are $1000, $1200, $1500, $1800, $2000 respectively. The cost per unit for W1, W2, W3 wind turbines are $2500, $3000, $3500 respectively. The energy output per unit for S1, S2, S3, S4, S5 solar panels are 1.5 kW, 2 kW, 2.5 kW, 3 kW, 3.5 kW respectively. The energy output per unit for W1, W2, W3 wind turbines are 5 kW, 6 kW, 7 kW respectively.\n// Total cost: Cost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\n// Total energy output: Energy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation.\n// 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3 <= 150000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3). The company wants to minimize the total cost of installation while maximizing the energy output. The cost per unit for S1, S2, S3, S4, S5 solar panels are $1000, $1200, $1500, $1800, $2000 respectively. The cost per unit for W1, W2, W3 wind turbines are $2500, $3000, $3500 respectively. The energy output per unit for S1, S2, S3, S4, S5 solar panels are 1.5 kW, 2 kW, 2.5 kW, 3 kW, 3.5 kW respectively. The energy output per unit for W1, W2, W3 wind turbines are 5 kW, 6 kW, 7 kW respectively. The company has a budget of $150,000 for the installation.\n\nPlease help the company to minimize the total cost of installation while maximizing the energy output, defined as the ratio of the total cost to the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of S1 solar panels\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of S2 solar panels\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of S3 solar panels\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of S4 solar panels\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of S5 solar panels\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of W1 wind turbines\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of W2 wind turbines\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of W3 wind turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\nEnergy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for the installation.\nmodel.addCons(1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3 <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of S1 Solar Panels: \", model.getVal(S1))\n    print(\"Number of S2 Solar Panels: \", model.getVal(S2))\n    print(\"Number of S3 Solar Panels: \", model.getVal(S3))\n    print(\"Number of S4 Solar Panels: \", model.getVal(S4))\n    print(\"Number of S5 Solar Panels: \", model.getVal(S5))\n    print(\"Number of W1 Wind Turbines: \", model.getVal(W1))\n    print(\"Number of W2 Wind Turbines: \", model.getVal(W2))\n    print(\"Number of W3 Wind Turbines: \", model.getVal(W3))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route, the fuel efficiency of each truck, and the maintenance cost per truck. The company also needs to determine the investment in new technology to improve fuel efficiency and reduce maintenance costs.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck (miles per gallon)\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost per truck ($)\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in new technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is inversely proportional to the fuel efficiency of the trucks, and the maintenance cost decreases with the investment in new technology.\nThe fuel cost for Route1 is $3 per gallon, and for Route2 is $4 per gallon. The maintenance cost decreases by $100 for every $1000 invested in new technology.\n// Total operational cost for Route1: Cost1 = (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 - 0.1 * TechInvest1\n// Total operational cost for Route2: Cost2 = (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 - 0.1 * TechInvest2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs and technology investments.\n// (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 + (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 + TechInvest1 + TechInvest2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for both routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, Route1 must have at least 10 trucks, and Route2 must have at least 15 trucks.\n// Trucks1 >= 10; Trucks2 >= 15\n\n## Generate Constraint-4:\nThe investment in new technology for each route cannot exceed 20% of the total budget allocated for that route.\n// TechInvest1 <= 0.2 * ((3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1)\n// TechInvest2 <= 0.2 * ((4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2)",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route, the fuel efficiency of each truck, and the maintenance cost per truck. The company also needs to determine the investment in new technology to improve fuel efficiency and reduce maintenance costs. The operational costs, including fuel and maintenance, are influenced by the fuel efficiency and the investment in new technology. The fuel cost for Route1 is $3 per gallon, and for Route2 is $4 per gallon. The maintenance cost decreases by $100 for every $1000 invested in new technology.\n\n| Route | Fuel Cost per Gallon | Minimum Trucks Required |\n|-------|----------------------|-------------------------|\n| Route1 | $3 | 10 |\n| Route2 | $4 | 15 |\n\nThe company has a budget of $100,000 for operational costs and technology investments. The total number of trucks available for both routes is limited to 50. The investment in new technology for each route cannot exceed 20% of the total budget allocated for that route.\n\nPlease help the company to minimize the total operational cost, which includes fuel costs and maintenance costs, while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\")  # fuel efficiency of each truck\nMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost\")  # maintenance cost per truck\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\")  # investment in new technology for Route1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\")  # investment in new technology for Route2\n\n# Define objective function\nCost1 = (3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 - 0.1 * TechInvest1\nCost2 = (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 - 0.1 * TechInvest2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons((3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1 + (4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2 + TechInvest1 + TechInvest2 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons(TechInvest1 <= 0.2 * ((3 / Efficiency) * Trucks1 + MaintenanceCost * Trucks1))\nmodel.addCons(TechInvest2 <= 0.2 * ((4 / Efficiency) * Trucks2 + MaintenanceCost * Trucks2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency: \", model.getVal(Efficiency))\n    print(\"Maintenance Cost: \", model.getVal(MaintenanceCost))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company aims to maximize total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to raw material availability, the production of DeviceA cannot exceed 200 units.\n// UnitsA <= 200\n\n## Generate Constraint-3:\nMarket research indicates that the demand for DeviceB is at least twice the demand for DeviceA.\n// UnitsB >= 2 * UnitsA\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceC to fulfill a contract.\n// UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device to maximize profit while considering production costs and market demand. The profit per unit of DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit of DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a production capacity of 500 units in total. Due to raw material availability, the production of DeviceA cannot exceed 200 units. Market research indicates that the demand for DeviceB is at least twice the demand for DeviceA. The company must produce at least 50 units of DeviceC to fulfill a contract. Please help the company to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.02 * max(UnitsC - 300, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (90 - 0.02 * C2) * C2 * C_b2 + 90 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 200)\nmodel.addCons(UnitsB >= 2 * UnitsA)\nmodel.addCons(UnitsC >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine how many units of each component to produce in the next month.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost of component A is $10 per unit, B is $15 per unit, C is $20 per unit, D is $25 per unit, and E is $30 per unit. The selling price of each component is twice its production cost. The company aims to maximize its profit, which is the difference between the total selling price and the total production cost.\n// Production cost of A: Cost_A = 10 * A\n// Production cost of B: Cost_B = 15 * B\n// Production cost of C: Cost_C = 20 * C\n// Production cost of D: Cost_D = 25 * D\n// Production cost of E: Cost_E = 30 * E\n// Selling price of A: Sell_A = 20 * A\n// Selling price of B: Sell_B = 30 * B\n// Selling price of C: Sell_C = 40 * C\n// Selling price of D: Sell_D = 50 * D\n// Selling price of E: Sell_E = 60 * E\n// Objective function: Maximize (Sell_A + Sell_B + Sell_C + Sell_D + Sell_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs next month.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each component next month.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe company has a limited storage capacity and can store at most 1000 units in total.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine how many units of each component to produce in the next month. The production cost of component A is $10 per unit, B is $15 per unit, C is $20 per unit, D is $25 per unit, and E is $30 per unit. The selling price of each component is twice its production cost. The company aims to maximize its profit, which is the difference between the total selling price and the total production cost. The company has a budget of $10,000 for production costs next month. The company wants to produce at least 50 units of each component next month. The company has a limited storage capacity and can store at most 1000 units in total. Please help the company to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each component next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of component E\n\n# Define objective function\n## Production cost and selling price of each component\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nCost_D = 25 * D\nCost_E = 30 * E\nSell_A = 20 * A\nSell_B = 30 * B\nSell_C = 40 * C\nSell_D = 50 * D\nSell_E = 60 * E\n## Objective function: Maximize (Sell_A + Sell_B + Sell_C + Sell_D + Sell_E) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Sell_A + Sell_B + Sell_C + Sell_D + Sell_E - Cost_A - Cost_B - Cost_C - Cost_D - Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs next month.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n## The company has a limited storage capacity and can store at most 1000 units in total.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours. The profit per unit and the cost of production per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Production per Unit |\n|---------|-----------------|-----------------------------|\n| A       | $50             | $20                         |\n| B       | $70             | $30                         |\n| C       | $60             | $25                         |\n\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55. Please help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency.\n// {\"number of goods shipped from warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of goods shipped from warehouse 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of shipping goods from each warehouse varies with the volume of goods shipped. The cost function is nonlinear and is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.04 * W2^2\n- Cost from warehouse 3: C3 = 0.06 * W3^2\n- Cost from warehouse 4: C4 = 0.03 * W4^2\n- Cost from warehouse 5: C5 = 0.07 * W5^2\nThe company wants to minimize the total shipping cost.\n// The objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\n// Minimize TotalCost = 0.05 * W1^2 + 0.04 * W2^2 + 0.06 * W3^2 + 0.03 * W4^2 + 0.07 * W5^2\n\n## Generate Constraint-1:\nThe total number of goods that can be shipped from all warehouses is limited to 1000 units.\n// W1 + W2 + W3 + W4 + W5 <= 1000",
        "question": "A company operates 5 different warehouses and needs to optimize the distribution of goods to minimize transportation costs and maximize efficiency. The cost of shipping goods from each warehouse varies with the volume of goods shipped, and the cost function for each warehouse is given by the following Table.\n\n| Warehouse | Cost Function       |\n|-----------|---------------------|\n| 1         | 0.05 * W1^2         |\n| 2         | 0.04 * W2^2         |\n| 3         | 0.06 * W3^2         |\n| 4         | 0.03 * W4^2         |\n| 5         | 0.07 * W5^2         |\n\nThe company wants to minimize the total shipping cost, which is the sum of the costs from each warehouse. The total number of goods that can be shipped from all warehouses is limited to 1000 units.\n\nPlease help the company determine the optimal number of goods to be shipped from each warehouse (W1, W2, W3, W4, W5) to minimize the total shipping cost, given that the number of goods shipped from each warehouse must be a non-negative integer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of goods shipped from warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of goods shipped from warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of goods shipped from warehouse 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of goods shipped from warehouse 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of goods shipped from warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 0.05 * W1**2\nC2 = 0.04 * W2**2\nC3 = 0.06 * W3**2\nC4 = 0.03 * W4**2\nC5 = 0.07 * W5**2\n## the objective function is: Minimize TotalCost = C1 + C2 + C3 + C4 + C5\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5)\n\n# Add constraints\n## The total number of goods that can be shipped from all warehouses is limited to 1000 units.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of goods shipped from warehouse 1: \", model.getVal(W1))\n    print(\"Number of goods shipped from warehouse 2: \", model.getVal(W2))\n    print(\"Number of goods shipped from warehouse 3: \", model.getVal(W3))\n    print(\"Number of goods shipped from warehouse 4: \", model.getVal(W4))\n    print(\"Number of goods shipped from warehouse 5: \", model.getVal(W5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for Route1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for Route3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n// Fuel_Cost1 = 1.5 * Fuel1\n// Fuel_Cost2 = 1.5 * Fuel2\n// Fuel_Cost3 = 1.5 * Fuel3\n// So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n## Generate Constraint-1:\nEach route has a specific distance that must be covered. Route1 is 500 km, Route2 is 600 km, and Route3 is 400 km. Each truck must have enough fuel to cover the entire distance of its route.\n// Fuel1 >= 500 / 10 * Trucks1\n// Fuel2 >= 600 / 12 * Trucks2\n// Fuel3 >= 400 / 8 * Trucks3\n\n## Generate Constraint-2:\nThe company has a total fleet size of 50 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $3000.\n// 1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes and fuel consumption for a set of deliveries. The company must decide the number of trucks to use for each route and the amount of fuel to allocate to each truck. The fuel efficiency of trucks varies by route, with Route1 having an efficiency of 10 km/liter, Route2 having 12 km/liter, and Route3 having 8 km/liter. The cost of fuel per liter is $1.5. The company wants to minimize the total fuel cost while ensuring all deliveries are made. The fuel cost is nonlinear due to the varying fuel efficiencies.\n\n| Route | Distance (km) | Fuel Efficiency (km/liter) |\n|-------|---------------|----------------------------|\n| 1     | 500           | 10                         |\n| 2     | 600           | 12                         |\n| 3     | 400           | 8                          |\n\nEach route has a specific distance that must be covered. Each truck must have enough fuel to cover the entire distance of its route. The company has a total fleet size of 50 trucks. The total fuel budget for the company is $3000.\n\nPlease help the company to minimize the total fuel cost while ensuring all deliveries are made.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel allocation for Route1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel allocation for Route2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel allocation for Route3\n\n# Define objective function\nFuel_Cost1 = 1.5 * Fuel1\nFuel_Cost2 = 1.5 * Fuel2\nFuel_Cost3 = 1.5 * Fuel3\n# So, the objective function is: Minimize (Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost1 + Fuel_Cost2 + Fuel_Cost3)\n\n# Add constraints\n# Each route has a specific distance that must be covered.\nmodel.addCons(Fuel1 >= 500 / 10 * Trucks1)\nmodel.addCons(Fuel2 >= 600 / 12 * Trucks2)\nmodel.addCons(Fuel3 >= 400 / 8 * Trucks3)\n# The company has a total fleet size of 50 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n# The total fuel budget for the company is $3000.\nmodel.addCons(1.5 * Fuel1 + 1.5 * Fuel2 + 1.5 * Fuel3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Allocation for Route1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation for Route2: \", model.getVal(Fuel2))\n    print(\"Fuel Allocation for Route3: \", model.getVal(Fuel3))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. In D1, each panel generates 150 kWh annually with a cost of $100 per panel and a carbon offset of 0.5 tons. In D2, each panel generates 120 kWh annually with a cost of $120 per panel and a carbon offset of 0.4 tons. In D3, each panel generates 180 kWh annually with a cost of $110 per panel and a carbon offset of 0.6 tons. In D4, each panel generates 160 kWh annually with a cost of $130 per panel and a carbon offset of 0.5 tons. In D5, each panel generates 140 kWh annually with a cost of $140 per panel and a carbon offset of 0.4 tons. The city aims to maximize the energy production efficiency (total energy generated per total cost).\n// Total_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\n// Total_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n// So, the objective function is: Maximize Total_Energy / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total carbon offset should be at least 200 tons.\n// 0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed in D1 and D2 combined is 500.\n// D1 + D2 <= 500\n\n## Generate Constraint-4:\nThe minimum number of panels that must be installed in D3 and D4 combined is 300.\n// D3 + D4 >= 300",
        "question": "A city is planning to install solar panels on rooftops across different districts (D1, D2, D3, D4, and D5) to optimize energy production and reduce carbon footprint. The city needs to determine the number of solar panels to install in each district. The efficiency of solar panels varies by district due to different sunlight exposure and rooftop angles. The details for each district are given in the following Table.\n\n| District | Annual Energy Generation per Panel | Cost per Panel | Carbon Offset per Panel |\n|----------|------------------------------------|----------------|-------------------------|\n| D1       | 150 kWh                            | $100           | 0.5 tons                |\n| D2       | 120 kWh                            | $120           | 0.4 tons                |\n| D3       | 180 kWh                            | $110           | 0.6 tons                |\n| D4       | 160 kWh                            | $130           | 0.5 tons                |\n| D5       | 140 kWh                            | $140           | 0.4 tons                |\n\nThe city has a budget of $100,000 for the installation of solar panels. The total carbon offset should be at least 200 tons. The maximum number of panels that can be installed in D1 and D2 combined is 500. The minimum number of panels that must be installed in D3 and D4 combined is 300. \nPlease help the city to maximize the energy production efficiency (total energy generated per total cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotal_Energy = 150 * D1 + 120 * D2 + 180 * D3 + 160 * D4 + 140 * D5\nTotal_Cost = 100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5\n## the objective function is: Maximize Total_Energy / Total_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Energy)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * D1 + 120 * D2 + 110 * D3 + 130 * D4 + 140 * D5 <= 100000)\n## The total carbon offset should be at least 200 tons.\nmodel.addCons(0.5 * D1 + 0.4 * D2 + 0.6 * D3 + 0.5 * D4 + 0.4 * D5 >= 200)\n## The maximum number of panels that can be installed in D1 and D2 combined is 500.\nmodel.addCons(D1 + D2 <= 500)\n## The minimum number of panels that must be installed in D3 and D4 combined is 300.\nmodel.addCons(D3 + D4 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Energy Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1467,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit.\n// {\"number of units of component 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component 5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component varies with the number of units produced due to economies of scale and market saturation. The profit function for each component is given by:\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\nThe company wants to maximize the total profit from all components.\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// C1 + C2 + C3 + C4 + C5 <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of component 1 must be at least twice the production of component 2.\n// C1 >= 2 * C2\n\n## Generate Constraint-3:\nThe production of component 3 cannot exceed 30% of the total production.\n// C3 <= 0.3 * (C1 + C2 + C3 + C4 + C5)\n\n## Generate Constraint-4:\nThe company must produce at least 10 units of each component to meet contractual obligations.\n// C1 >= 10; C2 >= 10; C3 >= 10; C4 >= 10; C5 >= 10",
        "question": "A manufacturing company produces 5 different types of electronic components. The company needs to decide the number of units to produce for each component to optimize their profit. The profit from each component varies with the number of units produced due to economies of scale and market saturation. The profit function for each component is given by:\n- Profit from component 1: P1 = 100 * C1 - 0.1 * C1^2\n- Profit from component 2: P2 = 120 * C2 - 0.15 * C2^2\n- Profit from component 3: P3 = 150 * C3 - 0.2 * C3^2\n- Profit from component 4: P4 = 180 * C4 - 0.25 * C4^2\n- Profit from component 5: P5 = 200 * C5 - 0.3 * C5^2\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of component 1 must be at least twice the production of component 2. The production of component 3 cannot exceed 30% of the total production. The company must produce at least 10 units of each component to meet contractual obligations.\nPlease help the company to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=10) # number of units of component 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=10) # number of units of component 2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=10) # number of units of component 3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=10) # number of units of component 4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=10) # number of units of component 5\n\n# Define objective function\n## Profit functions are quadratic, so we need to linearize them\nP1 = model.addVar(name=\"P1\")\nP2 = model.addVar(name=\"P2\")\nP3 = model.addVar(name=\"P3\")\nP4 = model.addVar(name=\"P4\")\nP5 = model.addVar(name=\"P5\")\n\nmodel.addCons(P1 == 100 * C1 - 0.1 * C1**2)\nmodel.addCons(P2 == 120 * C2 - 0.15 * C2**2)\nmodel.addCons(P3 == 150 * C3 - 0.2 * C3**2)\nmodel.addCons(P4 == 180 * C4 - 0.25 * C4**2)\nmodel.addCons(P5 == 200 * C5 - 0.3 * C5**2)\n\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 1000)\nmodel.addCons(C1 >= 2 * C2)\nmodel.addCons(C3 <= 0.3 * (C1 + C2 + C3 + C4 + C5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component 1: \", model.getVal(C1))\n    print(\"Number of Component 2: \", model.getVal(C2))\n    print(\"Number of Component 3: \", model.getVal(C3))\n    print(\"Number of Component 4: \", model.getVal(C4))\n    print(\"Number of Component 5: \", model.getVal(C5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"acres of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"acres of C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $100, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $150, requiring 3 units of water per acre. \nFor C3, the profit per acre is $200, requiring 4 units of water per acre.\nFor C4, the profit per acre is $250, requiring 5 units of water per acre.\nFor C5, the profit per acre is $300, requiring 6 units of water per acre.\nThe farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n// Profit_C1 = 100 * C1\n// Profit_C2 = 150 * C2\n// Profit_C3 = 200 * C3\n// Profit_C4 = 250 * C4\n// Profit_C5 = 300 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 + C4 + C5 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500 units.\n// 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to C1 due to contractual obligations.\n// C1 >= 10\n\n## Generate Constraint-4:\nThe market demand for C4 is limited to 15 acres.\n// C4 <= 15\n\n## Generate Constraint-5:\nThe farm aims to diversify its crops, requiring at least one acre of each crop.\n// C1 >= 1, C2 >= 1, C3 >= 1, C4 >= 1, C5 >= 1",
        "question": "A farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability. The profit per acre for C1 is $100, requiring 2 units of water per acre. For C2, the profit per acre is $150, requiring 3 units of water per acre. For C3, the profit per acre is $200, requiring 4 units of water per acre. For C4, the profit per acre is $250, requiring 5 units of water per acre. For C5, the profit per acre is $300, requiring 6 units of water per acre. The farm has a total of 100 acres available for cultivation and a limited water supply of 500 units. The farm must allocate at least 10 acres to C1 due to contractual obligations, and the market demand for C4 is limited to 15 acres. The farm aims to diversify its crops, requiring at least one acre of each crop. Please help the farm to maximize the profit per unit of water used to ensure sustainable water management.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=1)  # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1)  # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=1)  # acres of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=1, ub=15)  # acres of C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=1)  # acres of C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * C1\nProfit_C2 = 150 * C2\nProfit_C3 = 200 * C3\nProfit_C4 = 250 * C4\nProfit_C5 = 300 * C5\nWaterUsage = 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n## The farm has a limited water supply of 500 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500)\n## The farm must allocate at least 10 acres to C1 due to contractual obligations.\nmodel.addCons(C1 >= 10)\n## The market demand for C4 is limited to 15 acres.\nmodel.addCons(C4 <= 15)\n## The farm aims to diversify its crops, requiring at least one acre of each crop.\nmodel.addCons(C1 >= 1)\nmodel.addCons(C2 >= 1)\nmodel.addCons(C3 >= 1)\nmodel.addCons(C4 >= 1)\nmodel.addCons(C5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Acres of C4: \", model.getVal(C4))\n    print(\"Acres of C5: \", model.getVal(C5))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in automation technology for each product line to reduce production costs.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductD\": \"AutomationD\", \"range\": \"AutomationD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation for each product. The initial production cost per unit for ProductA is $50, for ProductB is $60, for ProductC is $70, and for ProductD is $80. The selling price per unit is $100 for ProductA, $110 for ProductB, $120 for ProductC, and $130 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.005 * AutomationA) * QuantityA\n// Total profit for ProductB: ProfitB = (110 - 60 + 0.005 * AutomationB) * QuantityB\n// Total profit for ProductC: ProfitC = (120 - 70 + 0.005 * AutomationC) * QuantityC\n// Total profit for ProductD: ProfitD = (130 - 80 + 0.005 * AutomationD) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investments.\n// AutomationA + AutomationB + AutomationC + AutomationD <= 100000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 5000 units.\n// QuantityA + QuantityB + QuantityC + QuantityD <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 800 units of ProductB.\n// QuantityA >= 500; QuantityB >= 800",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and is considering investing in automation technology for each product line to reduce production costs. The initial production cost per unit, selling price per unit, and the effect of automation investment on production cost are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price | Automation Effect (Cost Reduction per $1000 Investment) |\n|---------|-------------------------|---------------|-----------------------------------------------------|\n| ProductA | $50                     | $100          | $5 per unit                                         |\n| ProductB | $60                     | $110          | $5 per unit                                         |\n| ProductC | $70                     | $120          | $5 per unit                                         |\n| ProductD | $80                     | $130          | $5 per unit                                         |\n\nThe company has a budget of $100,000 for automation investments. The total production quantity for all products must not exceed 5000 units. The company must produce at least 500 units of ProductA and 800 units of ProductB. \n\nPlease help the company to maximize the total profit from all products by determining the optimal production quantity and automation investment for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=800)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0)  # production quantity of ProductD\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\nAutomationD = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationD\", lb=0)  # investment in automation for ProductD\n\n# Define objective function\nProfitA = (100 - 50 + 0.005 * AutomationA) * QuantityA\nProfitB = (110 - 60 + 0.005 * AutomationB) * QuantityB\nProfitC = (120 - 70 + 0.005 * AutomationC) * QuantityC\nProfitD = (130 - 80 + 0.005 * AutomationD) * QuantityD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(AutomationA + AutomationB + AutomationC + AutomationD <= 100000)  # budget for automation investments\nmodel.addCons(QuantityA + QuantityB + QuantityC + QuantityD <= 5000)  # total production quantity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Investment in Automation for ProductD: \", model.getVal(AutomationD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1496,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Small truck is $50,000, the revenue per Small truck is $70,000.\nThe operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000.\nThe operational cost per Large truck is $100,000, the revenue per Large truck is $130,000.\nThe operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000.\nThe operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// Total net profit: Profit = (70,000 * SmallTrucks - 50,000 * SmallTrucks) + (100,000 * MediumTrucks - 75,000 * MediumTrucks) + (130,000 * LargeTrucks - 100,000 * LargeTrucks) + (150,000 * RefrigeratedTrucks - 120,000 * RefrigeratedTrucks) + (180,000 * HeavyDutyTrucks - 150,000 * HeavyDutyTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing new trucks.\n// 50,000 * SmallTrucks + 75,000 * MediumTrucks + 100,000 * LargeTrucks + 120,000 * RefrigeratedTrucks + 150,000 * HeavyDutyTrucks <= 5,000,000\n\n## Generate Constraint-2:\nDue to space limitations, the total number of trucks cannot exceed 60.\n// SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60\n\n## Generate Constraint-3:\nThe company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations.\n// RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks)\n\n## Generate Constraint-4:\nThe company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts.\n// HeavyDutyTrucks >= 20",
        "question": "A logistics company is planning its fleet for the next year and needs to decide how many trucks to purchase for each of their five different types: Small, Medium, Large, Refrigerated, and Heavy-Duty. Each type of truck has different operational costs and revenue potential. The operational cost per Small truck is $50,000, the revenue per Small truck is $70,000. The operational cost per Medium truck is $75,000, the revenue per Medium truck is $100,000. The operational cost per Large truck is $100,000, the revenue per Large truck is $130,000. The operational cost per Refrigerated truck is $120,000, the revenue per Refrigerated truck is $150,000. The operational cost per Heavy-Duty truck is $150,000, the revenue per Heavy-Duty truck is $180,000. The company wants to maximize the net profit, which is the total revenue minus the total operational costs. The company has a budget of $5,000,000 for purchasing new trucks. Due to space limitations, the total number of trucks cannot exceed 60. The company must have at least 10% of its fleet as Refrigerated trucks to meet contractual obligations. The company aims to have at least 20 Heavy-Duty trucks to handle specific high-load contracts. Please help the company determine the optimal number of each type of truck to purchase to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=0)\n\n# Define objective function\nProfit = (70000 * SmallTrucks - 50000 * SmallTrucks) + (100000 * MediumTrucks - 75000 * MediumTrucks) + (130000 * LargeTrucks - 100000 * LargeTrucks) + (150000 * RefrigeratedTrucks - 120000 * RefrigeratedTrucks) + (180000 * HeavyDutyTrucks - 150000 * HeavyDutyTrucks)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 120000 * RefrigeratedTrucks + 150000 * HeavyDutyTrucks <= 5000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks <= 60)\nmodel.addCons(RefrigeratedTrucks >= 0.10 * (SmallTrucks + MediumTrucks + LargeTrucks + RefrigeratedTrucks + HeavyDutyTrucks))\nmodel.addCons(HeavyDutyTrucks >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to determine how many units of each truck type to deploy for an upcoming project.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the capacity is 10 tons, the fuel consumption is 5 liters per 100 km, and the cost is $100 per day.\nFor Truck B, the capacity is 15 tons, the fuel consumption is 7 liters per 100 km, and the cost is $150 per day.\nFor Truck C, the capacity is 20 tons, the fuel consumption is 9 liters per 100 km, and the cost is $200 per day.\nFor Truck D, the capacity is 25 tons, the fuel consumption is 11 liters per 100 km, and the cost is $250 per day.\nFor Truck E, the capacity is 30 tons, the fuel consumption is 13 liters per 100 km, and the cost is $300 per day.\nThe company aims to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.\n// Total capacity utilized: Capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total fuel consumed: Fuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Maximize Capacity / Fuel\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for truck leasing.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000\n\n## Generate Constraint-2:\nThe total capacity of the trucks must be at least 500 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n// E <= A + B + C + D\n\n## Generate Constraint-5:\nThe company wants to limit the total fuel consumption to 500 liters per 100 km.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 500",
        "question": "A logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity, fuel consumption, and daily cost. The company needs to determine how many units of each truck type to deploy for an upcoming project. The details of each truck type are given in the following Table.\n\n| Truck Type | Capacity (tons) | Fuel Consumption (liters/100 km) | Daily Cost ($) |\n|------------|-----------------|----------------------------------|----------------|\n| A          | 10              | 5                                | 100            |\n| B          | 15              | 7                                | 150            |\n| C          | 20              | 9                                | 200            |\n| D          | 25              | 11                               | 250            |\n| E          | 30              | 13                               | 300            |\n\nThe company has a budget of $10,000 per day for truck leasing. The total capacity of the trucks must be at least 500 tons. The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C, and the number of Truck E does not exceed the combined number of Trucks A, B, C, and D. The company also wants to limit the total fuel consumption to 500 liters per 100 km.\n\nPlease help the company to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nFuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Maximize Capacity / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Capacity)\n\n# Add constraints\n## The company has a budget of $10,000 per day for truck leasing.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n## The total capacity of the trucks must be at least 500 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500)\n## The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n## The company wants to limit the total fuel consumption to 500 liters per 100 km.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1483,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) to transport goods. The company needs to decide how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route is influenced by the number of trucks on that route and the total number of trucks across all routes. Specifically, the cost function is defined as:\nCost_A = 1000 + 50 * TruckA + 0.1 * (TruckA^2) + 0.01 * (TruckA * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_B = 1200 + 60 * TruckB + 0.12 * (TruckB^2) + 0.01 * (TruckB * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_C = 1100 + 55 * TruckC + 0.11 * (TruckC^2) + 0.01 * (TruckC * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_D = 900 + 45 * TruckD + 0.09 * (TruckD^2) + 0.01 * (TruckD * (TruckA + TruckB + TruckC + TruckD + TruckE))\nCost_E = 1300 + 65 * TruckE + 0.13 * (TruckE^2) + 0.01 * (TruckE * (TruckA + TruckB + TruckC + TruckD + TruckE))\nThe company aims to minimize the total cost of operating all trucks across all routes.\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 to allocate for truck operations.\n// 1000 * TruckA + 1200 * TruckB + 1100 * TruckC + 900 * TruckD + 1300 * TruckE <= 50000\n\n## Generate Constraint-2:\nThe company must allocate at least 10 trucks to each route.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10; TruckD >= 10; TruckE >= 10\n\n## Generate Constraint-3:\nThe total number of trucks across all routes must not exceed 50.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50\n\n## Generate Constraint-4:\nThe number of trucks on any single route must not exceed 20.\n// TruckA <= 20; TruckB <= 20; TruckC <= 20; TruckD <= 20; TruckE <= 20",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) to transport goods. The company needs to decide how many trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route is influenced by the number of trucks on that route and the total number of trucks across all routes. The company has a total budget of $50,000 to allocate for truck operations. The company must allocate at least 10 trucks to each route. The total number of trucks across all routes must not exceed 50. The number of trucks on any single route must not exceed 20. Please help the company to minimize the total cost of operating all trucks across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10, ub=20) # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10, ub=20) # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10, ub=20) # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=10, ub=20) # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=10, ub=20) # number of trucks on Route E\n\n# Define objective function\n## The cost of operating a truck on each route is influenced by the number of trucks on that route and the total number of trucks across all routes.\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\nCost_A = 1000 + 50 * TruckA + 0.1 * (TruckA**2) + 0.01 * (TruckA * TotalTrucks)\nCost_B = 1200 + 60 * TruckB + 0.12 * (TruckB**2) + 0.01 * (TruckB * TotalTrucks)\nCost_C = 1100 + 55 * TruckC + 0.11 * (TruckC**2) + 0.01 * (TruckC * TotalTrucks)\nCost_D = 900 + 45 * TruckD + 0.09 * (TruckD**2) + 0.01 * (TruckD * TotalTrucks)\nCost_E = 1300 + 65 * TruckE + 0.13 * (TruckE**2) + 0.01 * (TruckE * TotalTrucks)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $50,000 to allocate for truck operations.\nmodel.addCons(1000 * TruckA + 1200 * TruckB + 1100 * TruckC + 900 * TruckD + 1300 * TruckE <= 50000)\n## The total number of trucks across all routes must not exceed 50.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. Additionally, the company can invest in route optimization software for each city, which affects the fuel efficiency and travel time.\n// {\"number of trips from City1 to City2\": \"Trips12\", \"range\": \"Trips12 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City3\": \"Trips13\", \"range\": \"Trips13 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City4\": \"Trips14\", \"range\": \"Trips14 >= 0\", \"type\": \"integer\"}\n// {\"number of trips from City1 to City5\": \"Trips15\", \"range\": \"Trips15 >= 0\", \"type\": \"integer\"}\n// {\"investment in route optimization software for City1\": \"Software1\", \"range\": \"Software1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City2\": \"Software2\", \"range\": \"Software2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City3\": \"Software3\", \"range\": \"Software3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City4\": \"Software4\", \"range\": \"Software4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software for City5\": \"Software5\", \"range\": \"Software5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is affected by the investment in route optimization software. For each $1,000 invested in software, the fuel consumption per trip decreases by 0.1 liters. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. The company aims to minimize the total fuel consumption across all trips.\n// Fuel consumption for trips from City1 to City2: Fuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\n// Fuel consumption for trips from City1 to City3: Fuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\n// Fuel consumption for trips from City1 to City4: Fuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\n// Fuel consumption for trips from City1 to City5: Fuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n// So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investing in route optimization software.\n// Software1 + Software2 + Software3 + Software4 + Software5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips that can be made in a month is limited to 500.\n// Trips12 + Trips13 + Trips14 + Trips15 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3.\n// Trips12 >= 100; Trips13 >= 50\n\n## Generate Constraint-4:\nThe investment in software for each city must not exceed $30,000.\n// Software1 <= 30000; Software2 <= 30000; Software3 <= 30000; Software4 <= 30000; Software5 <= 30000",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: City1, City2, City3, City4, and City5. The company needs to determine the optimal number of trips each truck should make between these cities and the investment in route optimization software for each city to minimize fuel consumption and operational costs, considering the varying distances and traffic conditions. The initial fuel consumption for trips from City1 to City2 is 50 liters per trip, from City1 to City3 is 60 liters per trip, from City1 to City4 is 70 liters per trip, and from City1 to City5 is 80 liters per trip. For each $1,000 invested in software, the fuel consumption per trip decreases by 0.1 liters.\n\n| Route                     | Initial Fuel Consumption |\n|---------------------------|--------------------------|\n| City1 to City2            | 50 liters per trip       |\n| City1 to City3            | 60 liters per trip       |\n| City1 to City4            | 70 liters per trip       |\n| City1 to City5            | 80 liters per trip       |\n\nThe company has a total budget of $100,000 for investing in route optimization software. The total number of trips that can be made in a month is limited to 500. Due to contractual obligations, at least 100 trips must be made from City1 to City2 and at least 50 trips from City1 to City3. The investment in software for each city must not exceed $30,000.\n\nPlease help the company to minimize the total fuel consumption across all trips by determining the optimal number of trips and the investment in route optimization software for each city.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips12 = model.addVar(vtype=\"INTEGER\", name=\"Trips12\", lb=100)  # number of trips from City1 to City2\nTrips13 = model.addVar(vtype=\"INTEGER\", name=\"Trips13\", lb=50)   # number of trips from City1 to City3\nTrips14 = model.addVar(vtype=\"INTEGER\", name=\"Trips14\", lb=0)    # number of trips from City1 to City4\nTrips15 = model.addVar(vtype=\"INTEGER\", name=\"Trips15\", lb=0)    # number of trips from City1 to City5\nSoftware1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software1\", lb=0)  # investment in route optimization software for City1\nSoftware2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software2\", lb=0)  # investment in route optimization software for City2\nSoftware3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software3\", lb=0)  # investment in route optimization software for City3\nSoftware4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software4\", lb=0)  # investment in route optimization software for City4\nSoftware5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Software5\", lb=0)  # investment in route optimization software for City5\n\n# Define objective function\nFuel12 = (50 - 0.1 * Software2 - 0.1 * Software1) * Trips12\nFuel13 = (60 - 0.1 * Software3 - 0.1 * Software1) * Trips13\nFuel14 = (70 - 0.1 * Software4 - 0.1 * Software1) * Trips14\nFuel15 = (80 - 0.1 * Software5 - 0.1 * Software1) * Trips15\n# So, the objective function is: Minimize (Fuel12 + Fuel13 + Fuel14 + Fuel15)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel12 + Fuel13 + Fuel14 + Fuel15)\n\n# Add constraints\nmodel.addCons(Software1 + Software2 + Software3 + Software4 + Software5 <= 100000)  # total budget for software\nmodel.addCons(Trips12 + Trips13 + Trips14 + Trips15 <= 500)  # total number of trips\nmodel.addCons(Trips12 >= 100)  # minimum trips from City1 to City2\nmodel.addCons(Trips13 >= 50)   # minimum trips from City1 to City3\nmodel.addCons(Software1 <= 30000)  # maximum investment in software for City1\nmodel.addCons(Software2 <= 30000)  # maximum investment in software for City2\nmodel.addCons(Software3 <= 30000)  # maximum investment in software for City3\nmodel.addCons(Software4 <= 30000)  # maximum investment in software for City4\nmodel.addCons(Software5 <= 30000)  # maximum investment in software for City5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips from City1 to City2: \", model.getVal(Trips12))\n    print(\"Number of Trips from City1 to City3: \", model.getVal(Trips13))\n    print(\"Number of Trips from City1 to City4: \", model.getVal(Trips14))\n    print(\"Number of Trips from City1 to City5: \", model.getVal(Trips15))\n    print(\"Investment in Software for City1: \", model.getVal(Software1))\n    print(\"Investment in Software for City2: \", model.getVal(Software2))\n    print(\"Investment in Software for City3: \", model.getVal(Software3))\n    print(\"Investment in Software for City4: \", model.getVal(Software4))\n    print(\"Investment in Software for City5: \", model.getVal(Software5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1600,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in technology for ProductA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechInvestC\", \"range\": \"TechInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total investment budget of $50,000 for advanced manufacturing technologies.\n// TechInvestA + TechInvestB + TechInvestC <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. The investment in technology will improve the efficiency of production, thereby reducing the production cost per unit. The production cost per unit decreases by $5 for every $1000 invested in advanced manufacturing technologies for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price | Initial Production Cost | Technology Investment Impact |\n|---------|---------------|-------------------------|-------------------------------|\n| ProductA | $200          | $100                    | $5 per $1000 invested        |\n| ProductB | $250          | $150                    | $5 per $1000 invested        |\n| ProductC | $300          | $200                    | $5 per $1000 invested        |\n\nThe company has a total investment budget of $50,000 for advanced manufacturing technologies. The total production capacity of the company is limited to 1000 units.\n\nPlease help the company to determine the optimal production quantities and technology investments for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0)  # investment in technology for ProductA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0)  # investment in technology for ProductB\nTechInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestC\", lb=0)  # investment in technology for ProductC\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * TechInvestA)) * QuantityA\nProfitB = (250 - (150 - 0.005 * TechInvestB)) * QuantityB\nProfitC = (300 - (200 - 0.005 * TechInvestC)) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + TechInvestC <= 50000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechInvestA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechInvestB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechInvestC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1501,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major routes (Route A, Route B, Route C, Route D, and Route E) with varying distances and fuel efficiencies.\n// {\"number of trips on Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trips on Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the distance per trip is 500 km, the fuel efficiency is 5 km/liter, and the cost per liter of fuel is $1.2.\nFor Route B, the distance per trip is 600 km, the fuel efficiency is 6 km/liter, and the cost per liter of fuel is $1.2.\nFor Route C, the distance per trip is 700 km, the fuel efficiency is 7 km/liter, and the cost per liter of fuel is $1.2.\nFor Route D, the distance per trip is 800 km, the fuel efficiency is 8 km/liter, and the cost per liter of fuel is $1.2.\nFor Route E, the distance per trip is 900 km, the fuel efficiency is 9 km/liter, and the cost per liter of fuel is $1.2.\nThe company wants to minimize the total fuel cost while maintaining service levels.\n// Fuel_Cost_A = (500 / 5) * 1.2 * RouteA\n// Fuel_Cost_B = (600 / 6) * 1.2 * RouteB\n// Fuel_Cost_C = (700 / 7) * 1.2 * RouteC\n// Fuel_Cost_D = (800 / 8) * 1.2 * RouteD\n// Fuel_Cost_E = (900 / 9) * 1.2 * RouteE\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n## Generate Constraint-1:\nThe company has a total fleet capacity of 1000 trips across all routes.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 1000\n\n## Generate Constraint-2:\nThe company must maintain a minimum service level on each route, requiring at least 100 trips on each route.\n// RouteA >= 100\n// RouteB >= 100\n// RouteC >= 100\n// RouteD >= 100\n// RouteE >= 100\n\n## Generate Constraint-3:\nThe company has a budget constraint that limits the total fuel cost to $100,000.\n// (500 / 5) * 1.2 * RouteA + (600 / 6) * 1.2 * RouteB + (700 / 7) * 1.2 * RouteC + (800 / 8) * 1.2 * RouteD + (900 / 9) * 1.2 * RouteE <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company has identified five major routes (Route A, Route B, Route C, Route D, and Route E) with varying distances and fuel efficiencies.\nFor Route A, the distance per trip is 500 km, the fuel efficiency is 5 km/liter, and the cost per liter of fuel is $1.2.\nFor Route B, the distance per trip is 600 km, the fuel efficiency is 6 km/liter, and the cost per liter of fuel is $1.2.\nFor Route C, the distance per trip is 700 km, the fuel efficiency is 7 km/liter, and the cost per liter of fuel is $1.2.\nFor Route D, the distance per trip is 800 km, the fuel efficiency is 8 km/liter, and the cost per liter of fuel is $1.2.\nFor Route E, the distance per trip is 900 km, the fuel efficiency is 9 km/liter, and the cost per liter of fuel is $1.2.\nThe company has a total fleet capacity of 1000 trips across all routes. The company must maintain a minimum service level on each route, requiring at least 100 trips on each route. The company has a budget constraint that limits the total fuel cost to $100,000.\nPlease help the company to minimize the total fuel cost while maintaining these service levels.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=100) # number of trips on Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=100) # number of trips on Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=100) # number of trips on Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=100) # number of trips on Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=100) # number of trips on Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_A = (500 / 5) * 1.2 * RouteA\nFuel_Cost_B = (600 / 6) * 1.2 * RouteB\nFuel_Cost_C = (700 / 7) * 1.2 * RouteC\nFuel_Cost_D = (800 / 8) * 1.2 * RouteD\nFuel_Cost_E = (900 / 9) * 1.2 * RouteE\n## the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n## The company has a total fleet capacity of 1000 trips across all routes.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 1000)\n## The company has a budget constraint that limits the total fuel cost to $100,000.\nmodel.addCons((500 / 5) * 1.2 * RouteA + (600 / 6) * 1.2 * RouteB + (700 / 7) * 1.2 * RouteC + (800 / 8) * 1.2 * RouteD + (900 / 9) * 1.2 * RouteE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips on Route A: \", model.getVal(RouteA))\n    print(\"Number of Trips on Route B: \", model.getVal(RouteB))\n    print(\"Number of Trips on Route C: \", model.getVal(RouteC))\n    print(\"Number of Trips on Route D: \", model.getVal(RouteD))\n    print(\"Number of Trips on Route E: \", model.getVal(RouteE))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"quantity of goods to City1\": \"City1\", \"range\": \"City1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City2\": \"City2\", \"range\": \"City2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City3\": \"City3\", \"range\": \"City3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City4\": \"City4\", \"range\": \"City4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City5\": \"City5\", \"range\": \"City5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered. The fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time.\n// Fuel_Cost_City1 = (Fuel1^2) * City1\n// Fuel_Cost_City2 = (Fuel2^2) * City2\n// Fuel_Cost_City3 = (Fuel3^2) * City3\n// Fuel_Cost_City4 = (Fuel4^2) * City4\n// Fuel_Cost_City5 = (Fuel5^2) * City5\n// So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n## Generate Constraint-1:\nThe total fuel budget across all cities must not exceed $10,000.\n// Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000\n\n## Generate Constraint-2:\nThe company must deliver at least 500 units of goods to each city.\n// City1 >= 500; City2 >= 500; City3 >= 500; City4 >= 500; City5 >= 500\n\n## Generate Constraint-3:\nThe total quantity of goods delivered across all cities must not exceed 3000 units.\n// City1 + City2 + City3 + City4 + City5 <= 3000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered, increasing quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time. The total fuel budget across all cities must not exceed $10,000. The company must deliver at least 500 units of goods to each city. The total quantity of goods delivered across all cities must not exceed 3000 units. Please help the company to determine the optimal quantity of goods and fuel budget for each city to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deliver at least 500 units of goods to each city.\nCity1 = model.addVar(vtype=\"INTEGER\", name=\"City1\", lb=500) # quantity of goods to City1\nCity2 = model.addVar(vtype=\"INTEGER\", name=\"City2\", lb=500) # quantity of goods to City2\nCity3 = model.addVar(vtype=\"INTEGER\", name=\"City3\", lb=500) # quantity of goods to City3\nCity4 = model.addVar(vtype=\"INTEGER\", name=\"City4\", lb=500) # quantity of goods to City4\nCity5 = model.addVar(vtype=\"INTEGER\", name=\"City5\", lb=500) # quantity of goods to City5\n## Fuel budget for each city\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel budget for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel budget for City2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0) # fuel budget for City3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0) # fuel budget for City4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0) # fuel budget for City5\n\n# Define objective function\n## The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered.\nFuel_Cost_City1 = (Fuel1**2) * City1\nFuel_Cost_City2 = (Fuel2**2) * City2\nFuel_Cost_City3 = (Fuel3**2) * City3\nFuel_Cost_City4 = (Fuel4**2) * City4\nFuel_Cost_City5 = (Fuel5**2) * City5\n## So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n# Add constraints\n## The total fuel budget across all cities must not exceed $10,000.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000)\n## The total quantity of goods delivered across all cities must not exceed 3000 units.\nmodel.addCons(City1 + City2 + City3 + City4 + City5 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of goods to City1: \", model.getVal(City1))\n    print(\"Quantity of goods to City2: \", model.getVal(City2))\n    print(\"Quantity of goods to City3: \", model.getVal(City3))\n    print(\"Quantity of goods to City4: \", model.getVal(City4))\n    print(\"Quantity of goods to City5: \", model.getVal(City5))\n    print(\"Fuel budget for City1: \", model.getVal(Fuel1))\n    print(\"Fuel budget for City2: \", model.getVal(Fuel2))\n    print(\"Fuel budget for City3: \", model.getVal(Fuel3))\n    print(\"Fuel budget for City4: \", model.getVal(Fuel4))\n    print(\"Fuel budget for City5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements.\n// {\"number of trucks of type 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for T1 is 0.5 liters per kilometer, and the maintenance cost is $100 per month.\nFor T2, the fuel consumption rate is 0.4 liters per kilometer, and the maintenance cost is $120 per month.\nFor T3, the fuel consumption rate is 0.3 liters per kilometer, and the maintenance cost is $150 per month.\nFor T4, the fuel consumption rate is 0.25 liters per kilometer, and the maintenance cost is $180 per month.\nFor T5, the fuel consumption rate is 0.2 liters per kilometer, and the maintenance cost is $200 per month.\nThe company wants to minimize the total cost of fuel and maintenance per month.\n// Total fuel cost: FuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\n// Total maintenance cost: MaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for purchasing new trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of the fleet. There are five types of trucks (T1, T2, T3, T4, T5) with varying fuel efficiencies and maintenance requirements. The company wants to minimize the total cost of fuel and maintenance per month. The fuel consumption rate and maintenance cost for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (liters/km) | Maintenance Cost ($/month) |\n|------------|-----------------------------------|----------------------------|\n| T1         | 0.5                               | 100                        |\n| T2         | 0.4                               | 120                        |\n| T3         | 0.3                               | 150                        |\n| T4         | 0.25                              | 180                        |\n| T5         | 0.2                               | 200                        |\n\nThe company has a budget of $50,000 per month for purchasing new trucks. Please help the company determine the optimal number of each type of truck to minimize the total cost of fuel and maintenance per month.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks of type 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks of type 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks of type 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks of type 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks of type 5\n\n# Define objective function\nFuelCost = 0.5 * T1 + 0.4 * T2 + 0.3 * T3 + 0.25 * T4 + 0.2 * T5\nMaintCost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n# So, the objective function is: Minimize (FuelCost + MaintCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintCost)\n\n# Add constraints\n# The company has a budget of $50,000 per month for purchasing new trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 18000 * T4 + 20000 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type 1: \", model.getVal(T1))\n    print(\"Number of Trucks of Type 2: \", model.getVal(T2))\n    print(\"Number of Trucks of Type 3: \", model.getVal(T3))\n    print(\"Number of Trucks of Type 4: \", model.getVal(T4))\n    print(\"Number of Trucks of Type 5: \", model.getVal(T5))\n    print(\"Total Cost of Fuel and Maintenance: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1248,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"quantity of ProductA\": \"ProductAQ\", \"range\": \"ProductAQ >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQ\", \"range\": \"ProductBQ >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQ\", \"range\": \"ProductCQ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (Selling Price - Production Cost) * Quantity, where the selling price is $100 per unit, and the production cost is $60 per unit. For ProductB, the selling price is $150 per unit, and the production cost is $100 per unit. For ProductC, the selling price is $200 per unit, and the production cost is $120 per unit. The company wants to maximize the total profit.\n// Profit_ProductA = (100 - 60) * ProductAQ\n// Profit_ProductB = (150 - 100) * ProductBQ\n// Profit_ProductC = (200 - 120) * ProductCQ\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per month.\n// ProductAQ + ProductBQ + ProductCQ <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\n// ProductAQ >= 2 * ProductBQ\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for production costs per month.\n// 60 * ProductAQ + 100 * ProductBQ + 120 * ProductCQ <= 100,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each product is produced to maintain market presence.\n// ProductAQ >= 1; ProductBQ >= 1; ProductCQ >= 1",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to optimize its profit. The production cost, selling price, and demand for each product vary. The details for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| ProductA | $100 per unit | $60 per unit |\n| ProductB | $150 per unit | $100 per unit |\n| ProductC | $200 per unit | $120 per unit |\n\nThe company has a limited production capacity of 1000 units per month. Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB. The company has a budget of $100,000 for production costs per month. The company wants to ensure that at least one unit of each product is produced to maintain market presence.\n\nPlease help the company to maximize the total profit, which is calculated as (Selling Price - Production Cost) * Quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQ = model.addVar(vtype=\"INTEGER\", name=\"ProductAQ\", lb=1)  # quantity of ProductA\nProductBQ = model.addVar(vtype=\"INTEGER\", name=\"ProductBQ\", lb=1)  # quantity of ProductB\nProductCQ = model.addVar(vtype=\"INTEGER\", name=\"ProductCQ\", lb=1)  # quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (100 - 60) * ProductAQ\nProfit_ProductB = (150 - 100) * ProductBQ\nProfit_ProductC = (200 - 120) * ProductCQ\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per month.\nmodel.addCons(ProductAQ + ProductBQ + ProductCQ <= 1000)\n# Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductAQ >= 2 * ProductBQ)\n# The company has a budget of $100,000 for production costs per month.\nmodel.addCons(60 * ProductAQ + 100 * ProductBQ + 120 * ProductCQ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQ))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQ))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQ))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120\n\n## Generate Constraint-2:\nMachine 1 can operate for a maximum of 50 hours per week.\n// M1 <= 50\n\n## Generate Constraint-3:\nMachine 2 can operate for a maximum of 60 hours per week.\n// M2 <= 60",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit. The total operating hours for all machines must not exceed 120 hours per week. Machine 1 can operate for a maximum of 50 hours per week. Machine 2 can operate for a maximum of 60 hours per week. Please help the company to maximize the total production value of both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB) # objective function\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 120) # total operating hours for all machines must not exceed 120 hours per week\nmodel.addCons(M1 <= 50) # Machine 1 can operate for a maximum of 50 hours per week\nmodel.addCons(M2 <= 60) # Machine 2 can operate for a maximum of 60 hours per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"investment in landscaping\": \"Landscaping\", \"range\": \"Landscaping >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer aims to maximize the total value of all properties.\n// Value_LV = 500000 + 10 * Landscaping * LV\n// Value_MA = 300000 + 5 * Landscaping * MA\n// Value_AH = 150000 + 2 * Landscaping * AH\n// So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\n\n## Generate Constraint-1:\nThe developer has a budget of $1,000,000 for construction and landscaping.\n// 500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000\n\n## Generate Constraint-2:\nThe total area available for construction is limited to 100,000 square meters. Each Luxury Villa requires 1,000 square meters, each Mid-Range Apartment requires 500 square meters, and each Affordable Home requires 200 square meters.\n// 1000 * LV + 500 * MA + 200 * AH <= 100000\n\n## Generate Constraint-3:\nThe developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n// LV >= 5; MA >= 10\n\n## Generate Constraint-4:\nDue to market demand, the number of Affordable Homes cannot exceed 50.\n// AH <= 50",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH), and invest in landscaping to enhance the property values. The developer needs to determine the number of each type of property to build and the amount of money to invest in landscaping. The properties' initial values and the increase in value per $1,000 invested in landscaping are given in the following Table.\n\n| Property Type | Initial Value | Increase in Value per $1,000 Landscaping |\n|---------------|---------------|-----------------------------------------|\n| Luxury Villas | $500,000      | $10,000                                 |\n| Mid-Range Apartments | $300,000 | $5,000                                  |\n| Affordable Homes | $150,000   | $2,000                                  |\n\nThe developer has a budget of $1,000,000 for construction and landscaping. The total area available for construction is limited to 100,000 square meters, with each Luxury Villa requiring 1,000 square meters, each Mid-Range Apartment requiring 500 square meters, and each Affordable Home requiring 200 square meters. The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments. Due to market demand, the number of Affordable Homes cannot exceed 50.\n\nPlease help the developer maximize the total value of all properties.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=5)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0, ub=50)  # number of Affordable Homes\nLandscaping = model.addVar(vtype=\"CONTINUOUS\", name=\"Landscaping\", lb=0)  # investment in landscaping\n\n# Define objective function\nValue_LV = 500000 + 10 * Landscaping * LV\nValue_MA = 300000 + 5 * Landscaping * MA\nValue_AH = 150000 + 2 * Landscaping * AH\n# So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value_LV + Value_MA + Value_AH)\n\n# Add constraints\n# The developer has a budget of $1,000,000 for construction and landscaping.\nmodel.addCons(500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000)\n# The total area available for construction is limited to 100,000 square meters.\nmodel.addCons(1000 * LV + 500 * MA + 200 * AH <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Investment in Landscaping: \", model.getVal(Landscaping))\n    print(\"Total Property Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1391,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering packages. The company needs to determine the number of trucks to assign to each route to optimize delivery times and costs.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different delivery times and costs per truck. The company aims to minimize the total delivery time and cost while ensuring all packages are delivered on time.\n// Delivery time on route 1: D1 = 5 * T1^2\n// Delivery time on route 2: D2 = 4 * T2^2\n// Delivery time on route 3: D3 = 6 * T3^2\n// Delivery time on route 4: D4 = 3 * T4^2\n// Delivery time on route 5: D5 = 7 * T5^2\n// Delivery time on route 6: D6 = 8 * T6^2\n// The objective function is: Minimize (D1 + D2 + D3 + D4 + D5 + D6)\n// Minimize (5 * T1^2 + 4 * T2^2 + 6 * T3^2 + 3 * T4^2 + 7 * T5^2 + 8 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks at a time.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 different routes for delivering packages. The company needs to determine the number of trucks to assign to each route to optimize delivery times and costs. Each route has different delivery times and costs per truck, as shown in the following Table.\n\n| Route | Delivery Time per Truck |\n|-------|-------------------------|\n| 1     | 5 * T1^2                |\n| 2     | 4 * T2^2                |\n| 3     | 6 * T3^2                |\n| 4     | 3 * T4^2                |\n| 5     | 7 * T5^2                |\n| 6     | 8 * T6^2                |\n\nThe company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks at a time. The company aims to minimize the total delivery time and cost while ensuring all packages are delivered on time. Please help the company to minimize the total delivery time and cost by determining the optimal number of trucks to assign to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\nD1 = 5 * T1**2\nD2 = 4 * T2**2\nD3 = 6 * T3**2\nD4 = 3 * T4**2\nD5 = 7 * T5**2\nD6 = 8 * T6**2\n# The objective function is: Minimize (D1 + D2 + D3 + D4 + D5 + D6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == D1 + D2 + D3 + D4 + D5 + D6)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n# Each route can handle a maximum of 20 trucks at a time.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Total Delivery Time and Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient technologies for each product line, which will reduce the energy cost per unit produced.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductD\": \"InvestmentD\", \"range\": \"InvestmentD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $0.5 for every $1,000 invested in energy efficiency for that product. The initial energy cost per unit for ProductA is $5, for ProductB is $6, for ProductC is $7, and for ProductD is $8. The selling price per unit is $15 for ProductA, $20 for ProductB, $25 for ProductC, and $30 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (15 - 5 + 0.0005 * InvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (20 - 6 + 0.0005 * InvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (25 - 7 + 0.0005 * InvestmentC) * QuantityC\n// Total profit for ProductD: ProfitD = (30 - 8 + 0.0005 * InvestmentD) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $40,000 for energy efficiency investments.\n// InvestmentA + InvestmentB + InvestmentC + InvestmentD <= 40000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 10,000 units.\n// QuantityA + QuantityB + QuantityC + QuantityD <= 10000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in energy-efficient technologies for each product line, which will reduce the energy cost per unit produced. The initial energy cost per unit, selling price per unit, and the effect of investment on energy cost are given in the following Table.\n\n| Product | Initial Energy Cost | Selling Price | Reduction in Energy Cost per $1,000 Investment |\n|---------|---------------------|---------------|----------------------------------------------|\n| ProductA | $5                 | $15           | $0.5 per $1,000                              |\n| ProductB | $6                 | $20           | $0.5 per $1,000                              |\n| ProductC | $7                 | $25           | $0.5 per $1,000                              |\n| ProductD | $8                 | $30           | $0.5 per $1,000                              |\n\nThe company has a total budget of $40,000 for energy efficiency investments. The total production capacity for the next quarter is 10,000 units. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal production quantity for each product and the appropriate investment in energy efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0)  # production quantity of ProductD\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # investment in energy efficiency for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # investment in energy efficiency for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # investment in energy efficiency for ProductC\nInvestmentD = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentD\", lb=0)  # investment in energy efficiency for ProductD\n\n# Define objective function\nProfitA = (15 - 5 + 0.0005 * InvestmentA) * QuantityA\nProfitB = (20 - 6 + 0.0005 * InvestmentB) * QuantityB\nProfitC = (25 - 7 + 0.0005 * InvestmentC) * QuantityC\nProfitD = (30 - 8 + 0.0005 * InvestmentD) * QuantityD\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC + InvestmentD <= 40000)\nmodel.addCons(QuantityA + QuantityB + QuantityC + QuantityD <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Investment in ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in ProductC: \", model.getVal(InvestmentC))\n    print(\"Investment in ProductD: \", model.getVal(InvestmentD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1428,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product for the next month. Additionally, the company needs to decide on the number of shifts to operate in their factory for each product type.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of operating a shift for ProductA is $2000, for ProductB is $2500, and for ProductC is $3000. The company wants to maximize the total profit minus the shift operating costs.\n// Total profit for ProductA: Profit_A = 50 * ProdA - 2000 * ShiftsA\n// Total profit for ProductB: Profit_B = 70 * ProdB - 2500 * ShiftsB\n// Total profit for ProductC: Profit_C = 60 * ProdC - 3000 * ShiftsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe factory has a total of 20 shifts available for the month.\n// ShiftsA + ShiftsB + ShiftsC <= 20\n\n## Generate Constraint-2:\nDue to production capacity, the total production quantity for all products cannot exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product for the next month and the number of shifts to operate in their factory for each product type. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of operating a shift for ProductA is $2000, for ProductB is $2500, and for ProductC is $3000. The company wants to maximize the total profit minus the shift operating costs. The factory has a total of 20 shifts available for the month. Due to production capacity, the total production quantity for all products cannot exceed 1000 units. Please help the company to maximize the total profit minus the shift operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for ProductC\n\n# Define objective function\nProfit_A = 50 * ProdA - 2000 * ShiftsA\nProfit_B = 70 * ProdB - 2500 * ShiftsB\nProfit_C = 60 * ProdC - 3000 * ShiftsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The factory has a total of 20 shifts available for the month.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 20)\n# Due to production capacity, the total production quantity for all products cannot exceed 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck is $100,000, the fuel cost per truck is $20,000, and the maintenance cost per truck is $10,000. \nFor T2, the revenue per truck is $120,000, the fuel cost per truck is $25,000, and the maintenance cost per truck is $12,000. \nFor T3, the revenue per truck is $150,000, the fuel cost per truck is $30,000, and the maintenance cost per truck is $15,000.\nFor T4, the revenue per truck is $180,000, the fuel cost per truck is $35,000, and the maintenance cost per truck is $18,000.\nFor T5, the revenue per truck is $200,000, the fuel cost per truck is $40,000, and the maintenance cost per truck is $20,000.\nThe company wants to maximize the total net profit.\n// Total net profit for T1: Profit_T1 = (100,000 - 20,000 - 10,000) * T1\n// Total net profit for T2: Profit_T2 = (120,000 - 25,000 - 12,000) * T2\n// Total net profit for T3: Profit_T3 = (150,000 - 30,000 - 15,000) * T3\n// Total net profit for T4: Profit_T4 = (180,000 - 35,000 - 18,000) * T4\n// Total net profit for T5: Profit_T5 = (200,000 - 40,000 - 20,000) * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 100,000 * T1 + 120,000 * T2 + 150,000 * T3 + 180,000 * T4 + 200,000 * T5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total fuel cost for all trucks must not exceed $200,000.\n// 20,000 * T1 + 25,000 * T2 + 30,000 * T3 + 35,000 * T4 + 40,000 * T5 <= 200,000",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different revenue, fuel cost, and maintenance cost per truck. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints. The details of each type of truck are given in the following Table.\n\n| Truck Type | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|-------------------|---------------------|----------------------------|\n| T1         | $100,000          | $20,000             | $10,000                    |\n| T2         | $120,000          | $25,000             | $12,000                    |\n| T3         | $150,000          | $30,000             | $15,000                    |\n| T4         | $180,000          | $35,000             | $18,000                    |\n| T5         | $200,000          | $40,000             | $20,000                    |\n\nThe company has a total budget of $1,000,000 for purchasing trucks. The total fuel cost for all trucks must not exceed $200,000. Please help the company to maximize the total net profit, which is calculated as the revenue minus the fuel and maintenance costs for each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nProfit_T1 = (100000 - 20000 - 10000) * T1\nProfit_T2 = (120000 - 25000 - 12000) * T2\nProfit_T3 = (150000 - 30000 - 15000) * T3\nProfit_T4 = (180000 - 35000 - 18000) * T4\nProfit_T5 = (200000 - 40000 - 20000) * T5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for purchasing trucks.\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 1000000)\n# The total fuel cost for all trucks must not exceed $200,000.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company wants to maximize the total profit per liter of fuel consumed.\n// Profit_TruckA = (2 - 0.5) * Distance_TruckA / 10\n// Profit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\n// Profit_TruckC = (3 - 0.7) * Distance_TruckC / 15\n// Profit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\n// Profit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n// Distance_TruckA = TruckA * Average_Distance\n// Distance_TruckB = TruckB * Average_Distance\n// Distance_TruckC = TruckC * Average_Distance\n// Distance_TruckD = TruckD * Average_Distance\n// Distance_TruckE = TruckE * Average_Distance\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\n// 0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000\n\n## Generate Constraint-3:\nThe company has a fuel budget of 5000 liters for the season.\n// 10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company has a total of 100 trucks available for deployment. Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000. The company has a fuel budget of 5000 liters for the season.\nPlease help the company to maximize the total profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define distances and profits\nDistance_TruckA = TruckA * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckB = TruckB * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckC = TruckC * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckD = TruckD * model.addVar(name=\"Average_Distance\", lb=0)\nDistance_TruckE = TruckE * model.addVar(name=\"Average_Distance\", lb=0)\n\nProfit_TruckA = (2 - 0.5) * Distance_TruckA / 10\nProfit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\nProfit_TruckC = (3 - 0.7) * Distance_TruckC / 15\nProfit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\nProfit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TruckA + TruckB + TruckC + TruckD + TruckE) == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\nmodel.addCons(0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000)\n\n## The company has a fuel budget of 5000 liters for the season.\nmodel.addCons(10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n// Net profit per truck on route A: Profit_A = (1500 - 1000) * A\n// Net profit per truck on route B: Profit_B = (1800 - 1200) * B\n// Net profit per truck on route C: Profit_C = (2200 - 1500) * C\n// Net profit per truck on route D: Profit_D = (2500 - 1800) * D\n// Net profit per truck on route E: Profit_E = (3000 - 2000) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks allocated cannot exceed 20.\n// A + B + C + D + E <= 20\n\n## Generate Constraint-4:\nThe number of trucks on route D must not exceed the total number of trucks on routes A and B combined.\n// D <= A + B",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs. The operational costs and revenue potentials per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| A     | $1000          | $1500             |\n| B     | $1200          | $1800             |\n| C     | $1500          | $2200             |\n| D     | $1800          | $2500             |\n| E     | $2000          | $3000             |\n\nThe company has a budget of $10,000 for operational costs. The company must allocate at least 5 trucks to each route. The total number of trucks allocated cannot exceed 20. The number of trucks on route D must not exceed the total number of trucks on routes A and B combined. \nPlease help the company to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1500 - 1000) * A\nProfit_B = (1800 - 1200) * B\nProfit_C = (2200 - 1500) * C\nProfit_D = (2500 - 1800) * D\nProfit_E = (3000 - 2000) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000)\n## The total number of trucks allocated cannot exceed 20.\nmodel.addCons(A + B + C + D + E <= 20)\n## The number of trucks on route D must not exceed the total number of trucks on routes A and B combined.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in new machinery for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in new machinery for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of hours of labor required for each product, and the amount of capital investment in new machinery that will increase the production efficiency of each product. The production efficiency of each product increases by 5% for every $10,000 invested in new machinery for that product. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| ProductA | $100                            | $150                   |\n| ProductB | $150                            | $200                   |\n| ProductC | $200                            | $250                   |\n\nThe cost of production per unit decreases by $5 for every $10,000 invested in new machinery for that product. The company has a total of 10,000 labor hours available for the month.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nLaborA = model.addVar(vtype=\"INTEGER\", name=\"LaborA\", lb=0)  # labor hours for ProductA\nLaborB = model.addVar(vtype=\"INTEGER\", name=\"LaborB\", lb=0)  # labor hours for ProductB\nLaborC = model.addVar(vtype=\"INTEGER\", name=\"LaborC\", lb=0)  # labor hours for ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # capital investment in new machinery for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # capital investment in new machinery for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # capital investment in new machinery for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * InvestmentA) * QuantityA\nProfitB = (200 - 150 + 0.0005 * InvestmentB) * QuantityB\nProfitC = (250 - 200 + 0.0005 * InvestmentC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in new machinery for ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in new machinery for ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in new machinery for ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Cargo carried by TruckA: Cargo_A = 10 * TruckA\n// Cargo carried by TruckB: Cargo_B = 15 * TruckB\n// Cargo carried by TruckC: Cargo_C = 20 * TruckC\n// Cargo carried by TruckD: Cargo_D = 25 * TruckD\n// Fuel consumed by all trucks: Fuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel costs per month.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50,000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 50 trucks in total.\n// TruckA + TruckB + TruckC + TruckD <= 50\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB\n\n## Generate Constraint-4:\nThe company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads.\n// TruckD >= 0.1 * (TruckA + TruckB + TruckC + TruckD)",
        "question": "A logistics company operates four types of vehicles: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting operational constraints. Each TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. Each TruckD can carry 25 tons of cargo and consumes 11 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed. The company has a total budget of $50,000 for fuel costs per month. The company can only operate a maximum of 50 trucks in total. Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB. The company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads. Please help the company to determine the optimal number of each type of truck to maximize the total cargo carried per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\n\n# Define objective function\nCargo_A = 10 * TruckA\nCargo_B = 15 * TruckB\nCargo_C = 20 * TruckC\nCargo_D = 25 * TruckD\nFuel_Total = 5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD\n# So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C + Cargo_D) / Fuel_Total\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Fuel_Total == Cargo_A + Cargo_B + Cargo_C + Cargo_D)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel costs per month.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC + 11 * TruckD <= 50000)\n# The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 50)\n# Due to maintenance constraints, the number of TruckC cannot exceed the combined number of TruckA and TruckB.\nmodel.addCons(TruckC <= TruckA + TruckB)\n# The company must ensure that at least 10% of its fleet is composed of TruckD for specialized heavy loads.\nmodel.addCons(TruckD >= 0.1 * (TruckA + TruckB + TruckC + TruckD))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit. The profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material. The profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material. The profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material. The profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material. The profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material. The company has a total of 1000 labor hours available per week. The company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency. Please help the company to maximize the total profit, considering the nonlinear relationship between labor hours and production efficiency, and the constraints on labor hours and raw materials.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=0) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## Convert the nonlinear term to a constraint\nmodel.addCons(obj == Profit - 0.01 * (Labor**2 + RawMaterial**2))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital invested in automation\": \"AutomationCapital\", \"range\": \"AutomationCapital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for the production of all products.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital available for investment in automation is $100,000.\n// AutomationCapital <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\n// QuantityA <= 500; QuantityB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\n// WorkersA >= 20; WorkersB >= 30\n\n## Generate Constraint-5:\nThe production efficiency gain from automation starts to diminish significantly when more than $50,000 is invested.\n// AutomationCapital <= 50000 + 0.001 * (AutomationCapital - 50000)^2",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product, and the amount of capital invested in automation technology to enhance production efficiency. The efficiency gain from automation is non-linear and decreases as more capital is invested. The production cost per unit decreases non-linearly with the investment in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price per Unit | Initial Production Cost per Unit |\n|---------|------------------------|---------------------------------|\n| ProductA | $150                   | $100                             |\n| ProductB | $200                   | $150                             |\n| ProductC | $250                   | $200                             |\n\nThe company has a total of 100 workers available for the production of all products. The total capital available for investment in automation is $100,000. Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units. The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB. The production efficiency gain from automation starts to diminish significantly when more than $50,000 is invested.\n\nPlease help the company to determine the optimal production quantities, worker assignments, and the amount of capital to invest in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationCapital\", lb=0)  # capital invested in automation\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\n## Total profit for ProductB: ProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\n## Total profit for ProductC: ProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (150 - (100 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityA\nProfitB = (200 - (150 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityB\nProfitC = (250 - (200 - 0.0005 * AutomationCapital * (AutomationCapital + 1))) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available for the production of all products.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital available for investment in automation is $100,000.\nmodel.addCons(AutomationCapital <= 100000)\n## Due to market demand, the production quantity of ProductA must not exceed 500 units, and ProductB must not exceed 400 units.\nmodel.addCons(QuantityA <= 500)\nmodel.addCons(QuantityB <= 400)\n## The company must ensure that at least 20 workers are assigned to ProductA and 30 workers to ProductB.\nmodel.addCons(WorkersA >= 20)\nmodel.addCons(WorkersB >= 30)\n## The production efficiency gain from automation starts to diminish significantly when more than $50,000 is invested.\nmodel.addCons(AutomationCapital <= 50000 + 0.001 * (AutomationCapital - 50000)**2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Invested in Automation: \", model.getVal(AutomationCapital))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1783,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon.\nFor T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon.\nFor T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon.\nFor T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon.\nFor T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon.\nThe company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// Total capacity: Capacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of each type.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5\n\n## Generate Constraint-4:\nThe total number of trucks must not exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-5:\nThe number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks.\n// T5 <= T1 + T2 + T3 + T4",
        "question": "A logistics company is planning its fleet for the next quarter and has identified five different types of trucks (T1, T2, T3, T4, T5) to optimize their delivery routes. Each type of truck has different capacities and operational costs. For T1, the operational cost per mile is $2, the capacity is 10 tons, and the fuel efficiency is 5 miles per gallon. For T2, the operational cost per mile is $3, the capacity is 15 tons, and the fuel efficiency is 4 miles per gallon. For T3, the operational cost per mile is $4, the capacity is 20 tons, and the fuel efficiency is 3 miles per gallon. For T4, the operational cost per mile is $5, the capacity is 25 tons, and the fuel efficiency is 2 miles per gallon. For T5, the operational cost per mile is $6, the capacity is 30 tons, and the fuel efficiency is 1 mile per gallon. The company wants to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the operational costs per mile multiplied by the number of trucks, divided by the total capacity of all trucks. The company has a budget of $500,000 for purchasing trucks. The total capacity of all trucks must be at least 1000 tons. The company must have at least 5 trucks of each type. The total number of trucks must not exceed 50. The number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks. Please help the company determine the optimal number of each type of truck to minimize the Total Cost Efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nCapacity = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 25000 * T2 + 30000 * T3 + 35000 * T4 + 40000 * T5 <= 500000)\n## The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 >= 1000)\n## The company must have at least 5 trucks of each type.\nmodel.addCons(T1 >= 5)\nmodel.addCons(T2 >= 5)\nmodel.addCons(T3 >= 5)\nmodel.addCons(T4 >= 5)\nmodel.addCons(T5 >= 5)\n## The total number of trucks must not exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The number of T5 trucks must not exceed the combined number of T1, T2, T3, and T4 trucks.\nmodel.addCons(T5 <= T1 + T2 + T3 + T4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1451,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce, as well as the number of hours to operate each machine per day.\n// {\"number of MachineA\": \"MachineANum\", \"range\": \"MachineANum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBNum\", \"range\": \"MachineBNum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCNum\", \"range\": \"MachineCNum >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for MachineA per day\": \"MachineAHours\", \"range\": \"MachineAHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineB per day\": \"MachineBHours\", \"range\": \"MachineBHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineC per day\": \"MachineCHours\", \"range\": \"MachineCHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production rate of MachineA is 10 units per hour, MachineB is 15 units per hour, and MachineC is 20 units per hour. The company wants to maximize the total daily profit from all machines.\n// Profit_MachineA = MachineANum * MachineAHours * 10 * 500\n// Profit_MachineB = MachineBNum * MachineBHours * 15 * 700\n// Profit_MachineC = MachineCNum * MachineCHours * 20 * 900\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total of 24 hours available per day for all machines combined.\n// MachineAHours + MachineBHours + MachineCHours <= 24\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operational costs. The operational cost per hour for MachineA is $50, for MachineB is $70, and for MachineC is $90.\n// MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000\n\n## Generate Constraint-3:\nThe company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\n// MachineANum <= 5\n// MachineBNum <= 4\n// MachineCNum <= 3",
        "question": "A manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce and the number of hours to operate each machine per day. The profit per unit and the production rate for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Rate (units/hour) |\n|---------|-----------------|------------------------------|\n| MachineA | $500            | 10                           |\n| MachineB | $700            | 15                           |\n| MachineC | $900            | 20                           |\n\nThe company has a total of 24 hours available per day for all machines combined. The company has a budget constraint of $10,000 per day for operational costs, with operational costs per hour for MachineA at $50, for MachineB at $70, and for MachineC at $90. The company also has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\n\nPlease help the company to maximize the total daily profit from all machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineANum = model.addVar(vtype=\"INTEGER\", name=\"MachineANum\", lb=0)  # number of MachineA\nMachineBNum = model.addVar(vtype=\"INTEGER\", name=\"MachineBNum\", lb=0)  # number of MachineB\nMachineCNum = model.addVar(vtype=\"INTEGER\", name=\"MachineCNum\", lb=0)  # number of MachineC\nMachineAHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAHours\", lb=0)  # hours of operation for MachineA per day\nMachineBHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBHours\", lb=0)  # hours of operation for MachineB per day\nMachineCHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCHours\", lb=0)  # hours of operation for MachineC per day\n\n# Define objective function\nProfit_MachineA = MachineANum * MachineAHours * 10 * 500\nProfit_MachineB = MachineBNum * MachineBHours * 15 * 700\nProfit_MachineC = MachineCNum * MachineCHours * 20 * 900\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\nmodel.addCons(MachineAHours + MachineBHours + MachineCHours <= 24)\nmodel.addCons(MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000)\nmodel.addCons(MachineANum <= 5)\nmodel.addCons(MachineBNum <= 4)\nmodel.addCons(MachineCNum <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineANum))\n    print(\"Number of MachineB: \", model.getVal(MachineBNum))\n    print(\"Number of MachineC: \", model.getVal(MachineCNum))\n    print(\"Hours of operation for MachineA: \", model.getVal(MachineAHours))\n    print(\"Hours of operation for MachineB: \", model.getVal(MachineBHours))\n    print(\"Hours of operation for MachineC: \", model.getVal(MachineCHours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for DeviceA is $50, the selling price is $100, and the demand is modeled as 1000 - 5 * UnitsA. For DeviceB, the production cost is $70, the selling price is $120, and the demand is modeled as 1500 - 10 * UnitsB. For DeviceC, the production cost is $80, the selling price is $150, and the demand is modeled as 2000 - 15 * UnitsC. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\n// Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\n// Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a monthly production capacity of 500 units in total.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed half of the total production.\n// UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC)\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary as shown in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand Model |\n|--------|--------------------------|------------------------|--------------|\n| DeviceA | $50                      | $100                   | 1000 - 5 * UnitsA |\n| DeviceB | $70                      | $120                   | 1500 - 10 * UnitsB |\n| DeviceC | $80                      | $150                   | 2000 - 15 * UnitsC |\n\nThe company has a monthly production capacity of 500 units in total. Due to market saturation, the production of DeviceA should not exceed half of the total production. The company has a budget of $30,000 for production costs per month.\n\nPlease help the company to maximize its total profit, considering the constraints and the demand model for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 50) * min(UnitsA, 1000 - 5 * UnitsA)\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=1000)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=0, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nmodel.addCons(A1 <= 1000 - 5 * A1)\nmodel.addCons(A2 <= 1000 - 5 * A2)\nProfit_A = (100 - 50) * A1 * A_b1 + (100 - 50) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (120 - 70) * min(UnitsB, 1500 - 10 * UnitsB)\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=1500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=0, ub=1500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nmodel.addCons(B1 <= 1500 - 10 * B1)\nmodel.addCons(B2 <= 1500 - 10 * B2)\nProfit_B = (120 - 70) * B1 * B_b1 + (120 - 70) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (150 - 80) * min(UnitsC, 2000 - 15 * UnitsC)\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=2000)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0, ub=2000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nmodel.addCons(C1 <= 2000 - 15 * C1)\nmodel.addCons(C2 <= 2000 - 15 * C2)\nProfit_C = (150 - 80) * C1 * C_b1 + (150 - 80) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA <= 0.5 * (UnitsA + UnitsB + UnitsC))\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used\": \"RawMaterial\", \"range\": \"RawMaterial >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company wants to maximize the total profit from selling all devices.\n// Total profit: Profit = (50 * DeviceA + 70 * DeviceB + 60 * DeviceC) - (20 * LaborHours + 10 * RawMaterial)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for the quarter.\n// LaborHours <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for each device and the costs of labor and raw materials are given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $60            |\n\nThe cost of labor per hour is $20, and the cost of raw material per unit is $10. The company has a total of 1000 hours of labor available for the quarter. The company wants to maximize the total profit from selling all devices. Please help the company determine the optimal production quantities for DeviceA, DeviceB, and DeviceC, and the corresponding labor hours and raw material usage to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of DeviceA produced\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of DeviceB produced\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of DeviceC produced\nLaborHours = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHours\", lb=0) # number of hours of labor used\nRawMaterial = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterial\", lb=0) # number of units of raw material used\n\n# Define objective function\n## Total profit: Profit = (50 * DeviceA + 70 * DeviceB + 60 * DeviceC) - (20 * LaborHours + 10 * RawMaterial)\nProfit = 50 * DeviceA + 70 * DeviceB + 60 * DeviceC - 20 * LaborHours - 10 * RawMaterial\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for the quarter.\nmodel.addCons(LaborHours <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceC))\n    print(\"Number of hours of labor used: \", model.getVal(LaborHours))\n    print(\"Number of units of raw material used: \", model.getVal(RawMaterial))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck, which can be improved by investing in fuel-efficient technologies.\n// {\"number of trucks for Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region4\": \"Efficiency4\", \"range\": \"Efficiency4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region5\": \"Efficiency5\", \"range\": \"Efficiency5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies. The initial fuel cost per kilometer for each region is $0.50. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region1: Cost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\n// Fuel cost for Region2: Cost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\n// Fuel cost for Region3: Cost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\n// Fuel cost for Region4: Cost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\n// Fuel cost for Region5: Cost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 20 trucks must be allocated to Region1 and at least 15 trucks to Region2.\n// Trucks1 >= 20; Trucks2 >= 15",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region and the investment in fuel efficiency for each region. The relationship between investment in fuel efficiency and fuel cost per kilometer is as follows: the fuel cost per kilometer decreases by 0.5% for every $1000 invested in fuel efficiency technologies, with an initial fuel cost per kilometer of $0.50.\n\n| Region | Initial Fuel Cost per Kilometer | Fuel Cost Reduction per $1000 Investment |\n|--------|---------------------------------|------------------------------------------|\n| 1      | $0.50                           | 0.5%                                     |\n| 2      | $0.50                           | 0.5%                                     |\n| 3      | $0.50                           | 0.5%                                     |\n| 4      | $0.50                           | 0.5%                                     |\n| 5      | $0.50                           | 0.5%                                     |\n\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 100. Due to contractual obligations, at least 20 trucks must be allocated to Region1 and at least 15 trucks to Region2.\n\nPlease help the company to minimize the total fuel cost across all regions by determining the optimal number of trucks and the investment in fuel efficiency for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks for Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\")  # number of trucks for Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\")  # number of trucks for Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\")  # number of trucks for Region5\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\")  # investment in fuel efficiency for Region1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\")  # investment in fuel efficiency for Region2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\")  # investment in fuel efficiency for Region3\nEfficiency4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency4\")  # investment in fuel efficiency for Region4\nEfficiency5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency5\")  # investment in fuel efficiency for Region5\n\n# Define objective function\nCost1 = 0.50 * (1 - 0.005 * (Efficiency1 / 1000)) * Trucks1\nCost2 = 0.50 * (1 - 0.005 * (Efficiency2 / 1000)) * Trucks2\nCost3 = 0.50 * (1 - 0.005 * (Efficiency3 / 1000)) * Trucks3\nCost4 = 0.50 * (1 - 0.005 * (Efficiency4 / 1000)) * Trucks4\nCost5 = 0.50 * (1 - 0.005 * (Efficiency5 / 1000)) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 + Efficiency1 + Efficiency2 + Efficiency3 + Efficiency4 + Efficiency5 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Trucks5))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(Efficiency3))\n    print(\"Investment in Fuel Efficiency for Region4: \", model.getVal(Efficiency4))\n    print(\"Investment in Fuel Efficiency for Region5: \", model.getVal(Efficiency5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1580,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the energy production and storage.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases nonlinearly with the number of panels due to shading effects, modeled as 1/(1 + 0.01 * S^2). The efficiency of wind turbines decreases nonlinearly with the number of turbines due to interference effects, modeled as 1/(1 + 0.02 * W^2). The energy storage efficiency is linear and increases with the amount of storage. The company wants to maximize the total energy production and storage efficiency.\n// Solar_Efficiency = 1/(1 + 0.01 * S^2)\n// Wind_Efficiency = 1/(1 + 0.02 * W^2)\n// Storage_Efficiency = E\n// Total_Efficiency = Solar_Efficiency * S + Wind_Efficiency * W + Storage_Efficiency * E\n// So, the objective function is: Maximize Total_Efficiency\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of each solar panel is $1,000, each wind turbine is $5,000, and each unit of energy storage is $10,000.\n// 1000 * S + 5000 * W + 10000 * E <= 1000000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 10,000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 20 square meters.\n// 5 * S + 20 * W <= 10000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels and 20 wind turbines to meet the minimum requirements of the energy contract.\n// S >= 50; W >= 20\n\n## Generate Constraint-4:\nThe energy storage must be sufficient to store at least 50% of the total energy produced by the solar panels and wind turbines.\n// E >= 0.5 * (S + W)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the energy production and storage. The efficiency of solar panels decreases nonlinearly with the number of panels due to shading effects, modeled as 1/(1 + 0.01 * S^2). The efficiency of wind turbines decreases nonlinearly with the number of turbines due to interference effects, modeled as 1/(1 + 0.02 * W^2). The energy storage efficiency is linear and increases with the amount of storage. The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of each solar panel is $1,000, each wind turbine is $5,000, and each unit of energy storage is $10,000. The total area available for installation is limited to 10,000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 20 square meters. The company must install at least 50 solar panels and 20 wind turbines to meet the minimum requirements of the energy contract. The energy storage must be sufficient to store at least 50% of the total energy produced by the solar panels and wind turbines. Please help the company to maximize the total energy production and storage efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20)  # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # amount of energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Solar_Efficiency = 1/(1 + 0.01 * S^2)\n## Wind_Efficiency = 1/(1 + 0.02 * W^2)\n## Storage_Efficiency = E\n## Total_Efficiency = Solar_Efficiency * S + Wind_Efficiency * W + Storage_Efficiency * E\n## Convert non-linear terms to linear by introducing new variables and constraints\nSolar_Efficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Solar_Efficiency\")\nWind_Efficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Wind_Efficiency\")\nmodel.addCons(Solar_Efficiency == 1 / (1 + 0.01 * S**2))\nmodel.addCons(Wind_Efficiency == 1 / (1 + 0.02 * W**2))\nmodel.addCons(obj == Solar_Efficiency * S + Wind_Efficiency * W + E)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage.\nmodel.addCons(1000 * S + 5000 * W + 10000 * E <= 1000000)\n## The total area available for installation is limited to 10,000 square meters.\nmodel.addCons(5 * S + 20 * W <= 10000)\n## The company must install at least 50 solar panels and 20 wind turbines.\n## The energy storage must be sufficient to store at least 50% of the total energy produced.\nmodel.addCons(E >= 0.5 * (S + W))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1366,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make.\n// {\"number of trucks for CityA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company wants to maximize the total net profit from all routes.\n// NetProfit_CityA = (1500 - 500) * TrucksA * TripsA\n// NetProfit_CityB = (1800 - 600) * TrucksB * TripsB\n// NetProfit_CityC = (2100 - 700) * TrucksC * TripsC\n// NetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n// So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\n// TripsA <= 20; TripsB <= 20; TripsC <= 20; TripsD <= 20\n\n## Generate Constraint-3:\nThe company has a budget of $200,000 for operational costs per quarter.\n// 500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200,000\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 trips are made to each city per quarter.\n// TrucksA * TripsA >= 10; TrucksB * TripsB >= 10; TrucksC * TripsC >= 10; TrucksD * TripsD >= 10",
        "question": "A logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make. The cost of operating a truck per trip and the revenue generated per trip for each city are given in the following Table.\n\n| City   | Cost per Trip | Revenue per Trip |\n|--------|---------------|------------------|\n| CityA  | $500          | $1500            |\n| CityB  | $600          | $1800            |\n| CityC  | $700          | $2100            |\n| CityD  | $800          | $2400            |\n\nThe company has a total of 50 trucks available. Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter. The company has a budget of $200,000 for operational costs per quarter. The company must ensure that at least 10 trips are made to each city per quarter. \n\nPlease help the company to maximize the total net profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CityA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CityB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CityC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CityD\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips per truck for CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips per truck for CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips per truck for CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0) # number of trips per truck for CityD\n\n# Define objective function\nNetProfit_CityA = (1500 - 500) * TrucksA * TripsA\nNetProfit_CityB = (1800 - 600) * TrucksB * TripsB\nNetProfit_CityC = (2100 - 700) * TrucksC * TripsC\nNetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n# So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\nmodel.addCons(TripsA <= 20)\nmodel.addCons(TripsB <= 20)\nmodel.addCons(TripsC <= 20)\nmodel.addCons(TripsD <= 20)\n# The company has a budget of $200,000 for operational costs per quarter.\nmodel.addCons(500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200000)\n# The company must ensure that at least 10 trips are made to each city per quarter.\nmodel.addCons(TrucksA * TripsA >= 10)\nmodel.addCons(TrucksB * TripsB >= 10)\nmodel.addCons(TrucksC * TripsC >= 10)\nmodel.addCons(TrucksD * TripsD >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CityB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CityC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CityD: \", model.getVal(TrucksD))\n    print(\"Number of Trips per Truck for CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for CityD: \", model.getVal(TripsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (Fragile, Perishable, and General). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time while considering the different speed limits and cargo handling requirements.\n// {\"number of trucks for Fragile cargo\": \"FragileTrucks\", \"range\": \"FragileTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable cargo\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for General cargo\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Fragile cargo\": \"FragileSpeed\", \"range\": \"FragileSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for Perishable cargo\": \"PerishableSpeed\", \"range\": \"PerishableSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for General cargo\": \"GeneralSpeed\", \"range\": \"GeneralSpeed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe delivery time for Fragile cargo is inversely proportional to the speed squared due to the need for careful handling, and the distance is 500 km.\nThe delivery time for Perishable cargo is inversely proportional to the speed, and the distance is 400 km.\nThe delivery time for General cargo is directly proportional to the speed due to less stringent delivery requirements, and the distance is 300 km.\nThe company wants to minimize the total delivery time for all cargos.\n// Time_Fragile = 500 / (FragileSpeed^2) * FragileTrucks\n// Time_Perishable = 400 / PerishableSpeed * PerishableTrucks\n// Time_General = GeneralSpeed * 300 * GeneralTrucks\n// So, the objective function is: Minimize (Time_Fragile + Time_Perishable + Time_General)\n\n## Generate Constraint-1:\nThe company has a total of 10 trucks available.\n// FragileTrucks + PerishableTrucks + GeneralTrucks <= 10\n\n## Generate Constraint-2:\nThe speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns.\n// FragileSpeed <= 60\n\n## Generate Constraint-3:\nThe speed of trucks carrying Perishable cargo must be at least 50 km/h to ensure timely delivery.\n// PerishableSpeed >= 50\n\n## Generate Constraint-4:\nThe company must allocate at least 2 trucks to each type of cargo.\n// FragileTrucks >= 2\n// PerishableTrucks >= 2\n// GeneralTrucks >= 2",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time while considering the different speed limits and cargo handling requirements. The delivery times for each type of cargo are affected by their respective speeds and handling needs, as shown in the following Table.\n\n| Cargo Type | Distance (km) | Speed Impact on Delivery Time |\n|------------|---------------|--------------------------------|\n| Fragile    | 500           | Inversely proportional to speed squared |\n| Perishable | 400           | Inversely proportional to speed |\n| General    | 300           | Directly proportional to speed |\n\nThe company has a total of 10 trucks available. The speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns. The speed of trucks carrying Perishable cargo must be at least 50 km/h to ensure timely delivery. The company must allocate at least 2 trucks to each type of cargo.\n\nPlease help the company to minimize the total delivery time for all cargos.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFragileTrucks = model.addVar(vtype=\"INTEGER\", name=\"FragileTrucks\", lb=2)  # number of trucks for Fragile cargo\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=2)  # number of trucks for Perishable cargo\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=2)  # number of trucks for General cargo\nFragileSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FragileSpeed\", lb=0)  # speed of trucks for Fragile cargo\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=50)  # speed of trucks for Perishable cargo\nGeneralSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"GeneralSpeed\", lb=0)  # speed of trucks for General cargo\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTime_Fragile = 500 / (FragileSpeed**2) * FragileTrucks\nTime_Perishable = 400 / PerishableSpeed * PerishableTrucks\nTime_General = GeneralSpeed * 300 * GeneralTrucks\n## the objective function is: Minimize (Time_Fragile + Time_Perishable + Time_General)\nmodel.addCons(obj == Time_Fragile + Time_Perishable + Time_General)\n\n# Add constraints\n## The company has a total of 10 trucks available.\nmodel.addCons(FragileTrucks + PerishableTrucks + GeneralTrucks <= 10)\n## The speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns.\nmodel.addCons(FragileSpeed <= 60)\n## The speed of trucks carrying Perishable cargo must be at least 50 km/h to ensure timely delivery.\nmodel.addCons(PerishableSpeed >= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Fragile Cargo: \", model.getVal(FragileTrucks))\n    print(\"Number of Trucks for Perishable Cargo: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralTrucks))\n    print(\"Speed of Trucks for Fragile Cargo: \", model.getVal(FragileSpeed))\n    print(\"Speed of Trucks for Perishable Cargo: \", model.getVal(PerishableSpeed))\n    print(\"Speed of Trucks for General Cargo: \", model.getVal(GeneralSpeed))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages.\n// Cost of route A: Cost_A = 100 * A\n// Cost of route B: Cost_B = 120 * B\n// Cost of route C: Cost_C = 150 * C\n// Cost of route D: Cost_D = 180 * D\n// Cost of route E: Cost_E = 200 * E\n// Delivery volume of route A: Vol_A = 50 * A\n// Delivery volume of route B: Vol_B = 60 * B\n// Delivery volume of route C: Vol_C = 70 * C\n// Delivery volume of route D: Vol_D = 80 * D\n// Delivery volume of route E: Vol_E = 90 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n\n## Generate Constraint-1:\nThe total number of trucks available is 10.\n// A + B + C + D + E <= 10",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs per truck and the number of packages delivered per truck for each route are given in the following Table.\n\n| Route | Operational Cost per Truck | Packages Delivered per Truck |\n|-------|----------------------------|------------------------------|\n| A     | $100                       | 50                           |\n| B     | $120                       | 60                           |\n| C     | $150                       | 70                           |\n| D     | $180                       | 80                           |\n| E     | $200                       | 90                           |\n\nThe company aims to minimize the total operational cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages. The total number of trucks available is 10. Please help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 120 * B\nCost_C = 150 * C\nCost_D = 180 * D\nCost_E = 200 * E\nVol_A = 50 * A\nVol_B = 60 * B\nVol_C = 70 * C\nVol_D = 80 * D\nVol_E = 90 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available is 10.\nmodel.addCons(A + B + C + D + E <= 10)\n## Ensure that the total delivery volume meets or exceeds a target of 1000 packages.\nmodel.addCons(Vol_A + Vol_B + Vol_C + Vol_D + Vol_E >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Delivery Volume: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability.\n// {\"number of trucks on route R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different profitability and operational costs. The profit per truck on route R1 is $1000, with an operational cost of $500 per truck. For route R2, the profit is $1200 with a cost of $600. For route R3, the profit is $1500 with a cost of $750. For route R4, the profit is $1800 with a cost of $900. For route R5, the profit is $2000 with a cost of $1000. The company aims to maximize the total net profit while considering the operational costs.\n// Net_Profit_R1 = (1000 - 500) * T1 = 500 * T1\n// Net_Profit_R2 = (1200 - 600) * T2 = 600 * T2\n// Net_Profit_R3 = (1500 - 750) * T3 = 750 * T3\n// Net_Profit_R4 = (1800 - 900) * T4 = 900 * T4\n// Net_Profit_R5 = (2000 - 1000) * T5 = 1000 * T5\n// So, the objective function is: Maximize (500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks.\n// T1 <= 20; T2 <= 15; T3 <= 25; T4 <= 10; T5 <= 30\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the total trucks are allocated to routes R1 and R2 combined to maintain a strong presence in the market.\n// T1 + T2 >= 0.3 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe operational costs must not exceed $70,000 in total.\n// 500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5 <= 70000",
        "question": "A logistics company operates five different routes for transporting goods: R1, R2, R3, R4, and R5. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and profitability. Each route has different profitability and operational costs. The profit per truck on route R1 is $1000, with an operational cost of $500 per truck. For route R2, the profit is $1200 with a cost of $600. For route R3, the profit is $1500 with a cost of $750. For route R4, the profit is $1800 with a cost of $900. For route R5, the profit is $2000 with a cost of $1000. The company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks. Route R1 can handle up to 20 trucks, R2 up to 15 trucks, R3 up to 25 trucks, R4 up to 10 trucks, and R5 up to 30 trucks. The company must ensure that at least 30% of the total trucks are allocated to routes R1 and R2 combined to maintain a strong presence in the market. The operational costs must not exceed $70,000 in total. Please help the company to maximize the total net profit while considering the operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_R1 = 500 * T1\nNet_Profit_R2 = 600 * T2\nNet_Profit_R3 = 750 * T3\nNet_Profit_R4 = 900 * T4\nNet_Profit_R5 = 1000 * T5\n## the objective function is: Maximize (500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5)\nmodel.addCons(obj == Net_Profit_R1 + Net_Profit_R2 + Net_Profit_R3 + Net_Profit_R4 + Net_Profit_R5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 25)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 30)\n## The company must ensure that at least 30% of the total trucks are allocated to routes R1 and R2 combined.\nmodel.addCons(T1 + T2 >= 0.3 * (T1 + T2 + T3 + T4 + T5))\n## The operational costs must not exceed $70,000 in total.\nmodel.addCons(500 * T1 + 600 * T2 + 750 * T3 + 900 * T4 + 1000 * T5 <= 70000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route R1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route R2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route R3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route R4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route R5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and cargo capacity. TruckA has a fuel efficiency of 5 km/liter and a cargo capacity of 10 tons. TruckB has a fuel efficiency of 7 km/liter and a cargo capacity of 15 tons. TruckC has a fuel efficiency of 10 km/liter and a cargo capacity of 20 tons. TruckD has a fuel efficiency of 12 km/liter and a cargo capacity of 25 tons. TruckE has a fuel efficiency of 15 km/liter and a cargo capacity of 30 tons. The company wants to minimize the total fuel consumption while ensuring all cargo is delivered.\n// Total fuel consumption for TruckA: Fuel_TruckA = (Distance / 5) * TruckA\n// Total fuel consumption for TruckB: Fuel_TruckB = (Distance / 7) * TruckB\n// Total fuel consumption for TruckC: Fuel_TruckC = (Distance / 10) * TruckC\n// Total fuel consumption for TruckD: Fuel_TruckD = (Distance / 12) * TruckD\n// Total fuel consumption for TruckE: Fuel_TruckE = (Distance / 15) * TruckE\n// So, the objective function is: Minimize (Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 200 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200",
        "question": "A logistics company operates a fleet of 5 different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints. Each type of truck has different fuel efficiency and cargo capacity. TruckA has a fuel efficiency of 5 km/liter and a cargo capacity of 10 tons. TruckB has a fuel efficiency of 7 km/liter and a cargo capacity of 15 tons. TruckC has a fuel efficiency of 10 km/liter and a cargo capacity of 20 tons. TruckD has a fuel efficiency of 12 km/liter and a cargo capacity of 25 tons. TruckE has a fuel efficiency of 15 km/liter and a cargo capacity of 30 tons. The company wants to minimize the total fuel consumption while ensuring all cargo is delivered. The total cargo to be delivered is 200 tons. Please help the company to minimize the total fuel consumption while ensuring all cargo is delivered.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\") # Distance variable to handle division\n## Total fuel consumption for each type of truck\nFuel_TruckA = (Distance / 5) * TruckA\nFuel_TruckB = (Distance / 7) * TruckB\nFuel_TruckC = (Distance / 10) * TruckC\nFuel_TruckD = (Distance / 12) * TruckD\nFuel_TruckE = (Distance / 15) * TruckE\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_TruckA + Fuel_TruckB + Fuel_TruckC + Fuel_TruckD + Fuel_TruckE)\nmodel.addCons(Distance == 1) # Ensuring Distance is 1 to simplify the objective\n\n# Add constraints\n## The total cargo to be delivered is 200 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Profit_A = (20 - 10) * A\n// Profit_B = (30 - 20) * B\n// Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 50 units, and for device B is at least 40 units.\n// A >= 50; B >= 40\n\n## Generate Constraint-3:\nThe company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit.\n// 5 * A + 10 * B + 15 * C <= 15000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours. The market demand for device A is at least 50 units, and for device B is at least 40 units. The company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit. Please help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The market demand for device A is at least 50 units, and for device B is at least 40 units.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 40)\n## The company has a budget of $15000 for raw materials\nmodel.addCons(5 * A + 10 * B + 15 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region (North, South, East, West, and Central) to optimize their operations.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in each region varies due to fuel prices and maintenance costs. The cost per truck in the North is $100, in the South is $120, in the East is $130, in the West is $110, and in the Central region is $90. The revenue generated per truck also varies, with the North generating $200, the South $220, the East $230, the West $210, and the Central region $190. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Net Profit = (200 * NorthTrucks + 220 * SouthTrucks + 230 * EastTrucks + 210 * WestTrucks + 190 * CentralTrucks) - (100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks)\n// So, the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 trucks are allocated to each region.\n// NorthTrucks >= 10; SouthTrucks >= 10; EastTrucks >= 10; WestTrucks >= 10; CentralTrucks >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\n// 100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions.\n// EastTrucks + WestTrucks <= NorthTrucks + SouthTrucks\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trucks in the Central region does not exceed the combined number of trucks in the North, South, East, and West regions.\n// CentralTrucks <= NorthTrucks + SouthTrucks + EastTrucks + WestTrucks",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region to optimize their operations. The cost and revenue per truck in each region are given in the following Table.\n\n| Region       | Cost per Truck | Revenue per Truck |\n|--------------|----------------|-------------------|\n| North        | $100           | $200              |\n| South        | $120           | $220              |\n| East         | $130           | $230              |\n| West         | $110           | $210              |\n| Central      | $90            | $190              |\n\nThe company has a total of 50 trucks available for allocation. The company wants to ensure that at least 10 trucks are allocated to each region. The company has a budget constraint on the total operating cost, which should not exceed $5000 per day. The company wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions. Additionally, the company wants to ensure that the total number of trucks in the Central region does not exceed the combined number of trucks in the North, South, East, and West regions.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=10)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=10)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=10)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=10)\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=10)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\nmodel.addCons(obj == 100 * NorthTrucks + 100 * SouthTrucks + 100 * EastTrucks + 100 * WestTrucks + 100 * CentralTrucks)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 50)\n## The company has a budget constraint on the total operating cost, which should not exceed $5000 per day.\nmodel.addCons(100 * NorthTrucks + 120 * SouthTrucks + 130 * EastTrucks + 110 * WestTrucks + 90 * CentralTrucks <= 5000)\n## The company wants to ensure that the total number of trucks in the East and West regions does not exceed the combined number of trucks in the North and South regions.\nmodel.addCons(EastTrucks + WestTrucks <= NorthTrucks + SouthTrucks)\n## The company wants to ensure that the total number of trucks in the Central region does not exceed the combined number of trucks in the North, South, East, and West regions.\nmodel.addCons(CentralTrucks <= NorthTrucks + SouthTrucks + EastTrucks + WestTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1411,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000\n\n## Generate Constraint-3:\nThe company has a distribution capacity of 100 units in terms of the number of units it can distribute.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-4:\nThe market demand for P1 is 15 units. So, the company can only sell a maximum of 15 units of P1.\n// P1 <= 15",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit and the required storage space for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| P1      | $30             | 2 square meters       |\n| P2      | $40             | 3 square meters       |\n| P3      | $50             | 4 square meters       |\n\nThe company has a limited storage space of 200 square meters. The company has a budget of $3000 for purchasing the products. The company has a distribution capacity of 100 units in terms of the number of units it can distribute. The market demand for P1 is 15 units, so the company can only sell a maximum of 15 units of P1.\n\nPlease help the company to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=15) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n## The company has a distribution capacity of 100 units in terms of the number of units it can distribute.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company wants to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// Total ton-kilometers: TonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n// So, the objective function is: Minimize Cost / TonKm\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for operational costs next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000",
        "question": "A logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities, operational costs, and fuel efficiencies.\n\n| Vehicle | Capacity (tons) | Operational Cost ($/day) | Fuel Efficiency (km/liter) |\n|---------|-----------------|--------------------------|----------------------------|\n| Truck A | 10              | 500                      | 5                          |\n| Truck B | 15              | 700                      | 7                          |\n| Truck C | 20              | 900                      | 9                          |\n| Truck D | 25              | 1100                     | 11                         |\n| Truck E | 30              | 1300                     | 13                         |\n\nThe company has a total budget of $30,000 for operational costs next month. The company wants to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n\nPlease help the company determine the optimal number of each type of truck to use in order to minimize the total cost per ton-kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of Truck D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nTonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n## the objective function is: Minimize Cost / TonKm\n## convert the division to multiplication\nmodel.addCons(obj * TonKm == Cost)\n\n# Add constraints\n## The company has a total budget of $30,000 for operational costs next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Number of Truck E: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and maintenance costs. Additionally, the company is considering investing in hybrid technology for some of its trucks to further reduce costs and environmental impact.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Region 1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region 2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region 3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs of the trucks are affected by the number of trucks and the level of hybrid technology investment. The cost per truck decreases nonlinearly with the investment in hybrid technology. Specifically, the cost per truck in Region 1 is $1000 - 0.01 * Hybrid1^2, in Region 2 is $1200 - 0.012 * Hybrid2^2, and in Region 3 is $1100 - 0.011 * Hybrid3^2. The company aims to minimize the total operational cost across all regions.\n// Total operational cost for Region 1: Cost1 = (1000 - 0.01 * Hybrid1^2) * Trucks1\n// Total operational cost for Region 2: Cost2 = (1200 - 0.012 * Hybrid2^2) * Trucks2\n// Total operational cost for Region 3: Cost3 = (1100 - 0.011 * Hybrid3^2) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region and the investment in hybrid technology for each region to minimize fuel consumption and maintenance costs. The cost per truck decreases nonlinearly with the investment in hybrid technology. Specifically, the cost per truck in Region 1 is $1000 - 0.01 * Hybrid1^2, in Region 2 is $1200 - 0.012 * Hybrid2^2, and in Region 3 is $1100 - 0.011 * Hybrid3^2. The company has a total budget of $100,000 for truck allocation and hybrid technology investments. Please help the company to minimize the total operational cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for Region 1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for Region 2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for Region 3\n\n# Define objective function\nCost1 = (1000 - 0.01 * Hybrid1**2) * Trucks1\nCost2 = (1200 - 0.012 * Hybrid2**2) * Trucks2\nCost3 = (1100 - 0.011 * Hybrid3**2) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocation and hybrid technology investments.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Hybrid Technology for Region 1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Region 2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Region 3: \", model.getVal(Hybrid3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n// Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n// Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 machines available.\n// MachinesA + MachinesB + MachinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in technology upgrades cannot exceed $50,000.\n// TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n// QuantityA >= 500; QuantityB >= 600\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB.\n// MachinesA >= 10; MachinesB >= 15",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate. The production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company has a total of 40 machines available and the total investment in technology upgrades cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units. The company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB. The company aims to maximize the total profit from all products.\n\nPlease help the company to determine the optimal production quantity, number of machines, and technology upgrade levels for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0)  # technology upgrade for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0)  # technology upgrade for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0)  # technology upgrade for ProductC\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n## Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n## Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = 50 * (100 + 0.05 * TechUpgradeA) * MachinesA\nProfitB = 60 * (120 + 0.05 * TechUpgradeB) * MachinesB\nProfitC = 70 * (150 + 0.05 * TechUpgradeC) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 40 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 40)\n## The total investment in technology upgrades cannot exceed $50,000.\nmodel.addCons(TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000)\n## Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\nmodel.addCons(QuantityA >= 500)\nmodel.addCons(QuantityB >= 600)\n## The company must ensure that at least 10 machines are dedicated to ProductA and 15 machines to ProductB.\nmodel.addCons(MachinesA >= 10)\nmodel.addCons(MachinesB >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Technology Upgrade for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Technology Upgrade for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Technology Upgrade for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1340,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of cameras produced\": \"Cameras\", \"range\": \"Cameras >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is calculated based on the selling price minus the production cost. The selling price and production cost vary per device and are affected by the quantity produced due to economies of scale.\nFor smartphones, the profit per unit is $100 - 0.1 * Smartphones.\nFor tablets, the profit per unit is $150 - 0.2 * Tablets.\nFor laptops, the profit per unit is $200 - 0.3 * Laptops.\nFor smartwatches, the profit per unit is $50 - 0.05 * Smartwatches.\nFor cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company wants to maximize the total profit from all devices.\n// Total profit = (100 - 0.1 * Smartphones) * Smartphones + (150 - 0.2 * Tablets) * Tablets + (200 - 0.3 * Laptops) * Laptops + (50 - 0.05 * Smartwatches) * Smartwatches + (300 - 0.4 * Cameras) * Cameras\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units per month.\n// Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 2,000 units per month.\n// Smartphones >= 2000",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and cameras. The company needs to optimize the production quantities of each device to maximize profit while considering the cost of production and market demand.\nThe profit from each device is calculated based on the selling price minus the production cost, with the profit per unit varying per device and affected by the quantity produced due to economies of scale. For smartphones, the profit per unit is $100 - 0.1 * Smartphones. For tablets, the profit per unit is $150 - 0.2 * Tablets. For laptops, the profit per unit is $200 - 0.3 * Laptops. For smartwatches, the profit per unit is $50 - 0.05 * Smartwatches. For cameras, the profit per unit is $300 - 0.4 * Cameras.\nThe company has a total production capacity of 10,000 units per month. The market demand for smartphones is at least 2,000 units per month.\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=2000)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)  # number of smartwatches produced\nCameras = model.addVar(vtype=\"INTEGER\", name=\"Cameras\", lb=0)  # number of cameras produced\n\n# Define objective function\n## calculate profit per unit for each device\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.2 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.3 * Laptops) * Laptops\nProfit_Smartwatches = (50 - 0.05 * Smartwatches) * Smartwatches\nProfit_Cameras = (300 - 0.4 * Cameras) * Cameras\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_Cameras)\n\n# Add constraints\n## The total production capacity of the company is 10,000 units per month.\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Cameras <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Cameras: \", model.getVal(Cameras))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The company aims to maximize the total profit, but due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company wants to maximize the total profit from selling these devices.\n// Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\n// Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\n// Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\n// Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\n// Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for device A is $5, for device B is $7, for device C is $9, for device D is $11, and for device E is $13.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 units in total.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-3:\nThe market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units.\n// A >= 50; B >= 75; C >= 100; D >= 125; E >= 150",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. However, due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company has a budget of $10,000 for production costs, with the cost per unit for device A being $5, for device B being $7, for device C being $9, for device D being $11, and for device E being $13. The company also has a production capacity of 500 units in total. The market demand for device A is at least 50 units, for device B is at least 75 units, for device C is at least 100 units, for device D is at least 125 units, and for device E is at least 150 units. The company aims to maximize the total profit from selling these devices. Please help the company determine the optimal production quantities for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=125) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=150) # quantity of device E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=75, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.01 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=100, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.01 * (C2 - 100)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=125, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=500)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.01 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=150, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.01 * (E2 - 100)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000)\nmodel.addCons(A + B + C + D + E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost.\n// Revenue_A = 50 * A\n// Revenue_B = 70 * B\n// Revenue_C = 60 * C\n// Cost_A = 0.01 * A^2\n// Cost_B = 0.015 * B^2\n// Cost_C = 0.012 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\n// A <= 1000\n// B <= 800\n// C <= 900",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost per unit for each product varies nonlinearly with the quantity produced due to economies of scale and other factors. The production cost function for product A is 0.01 * A^2, for product B is 0.015 * B^2, and for product C is 0.012 * C^2. The company aims to maximize the total profit, which is the revenue minus the production cost. The company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C. Please help the company to determine the optimal production quantities for products A, B, and C to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=900) # production quantity of product C\n\n# Define objective function\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a limited amount of raw material that can produce a maximum of 1000 units of product A, 800 units of product B, and 900 units of product C.\nmodel.addCons(A <= 1000)\nmodel.addCons(B <= 800)\nmodel.addCons(C <= 900)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints.\n// {\"quantity of M1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company aims to maximize its total profit.\n// Profit_M1 = 100 * Q1 - 0.01 * Q1^2\n// Profit_M2 = 150 * Q2 - 0.02 * Q2^2\n// Profit_M3 = 200 * Q3 - 0.03 * Q3^2\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production costs.\n// 0.01 * Q1^2 + 0.02 * Q2^2 + 0.03 * Q3^2 <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 200 units.\n// Q1 + Q2 + Q3 <= 200\n\n## Generate Constraint-3:\nThe market demand for M1 is at least 50 units.\n// Q1 >= 50\n\n## Generate Constraint-4:\nThe company can only produce up to 100 units of M2 due to supplier constraints.\n// Q2 <= 100",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints. The profit per unit and the production cost for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost Model |\n|--------------|-----------------|-----------------------|\n| M1           | $100            | 0.01 * Q1^2          |\n| M2           | $150            | 0.02 * Q2^2          |\n| M3           | $200            | 0.03 * Q3^2          |\n\nThe company has a limited budget of $10,000 for production costs. The total production capacity of the company is 200 units. The market demand for M1 is at least 50 units. The company can only produce up to 100 units of M2 due to supplier constraints. \n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50)  # quantity of M1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0, ub=100)  # quantity of M2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0)  # quantity of M3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = 100 * Q1 - 0.01 * Q1**2\nProfit_M2 = 150 * Q2 - 0.02 * Q2**2\nProfit_M3 = 200 * Q3 - 0.03 * Q3**2\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production costs.\nmodel.addCons(0.01 * Q1**2 + 0.02 * Q2**2 + 0.03 * Q3**2 <= 10000)\n## The total production capacity of the company is 200 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(Q1))\n    print(\"Quantity of M2: \", model.getVal(Q2))\n    print(\"Quantity of M3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductD\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductE\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, for ProductD is $60, and for ProductE is $80. The company wants to maximize the total profit from all products.\n// Total profit for ProductA: Profit_ProductA = 50 * ProductA\n// Total profit for ProductB: Profit_ProductB = 70 * ProductB\n// Total profit for ProductC: Profit_ProductC = 90 * ProductC\n// Total profit for ProductD: Profit_ProductD = 60 * ProductD\n// Total profit for ProductE: Profit_ProductE = 80 * ProductE\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD + Profit_ProductE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductC cannot exceed 30% of the total production.\n// ProductC <= 0.3 * (ProductA + ProductB + ProductC + ProductD + ProductE)\n\n## Generate Constraint-3:\nThe production of ProductA must be at least twice the production of ProductB.\n// ProductA >= 2 * ProductB\n\n## Generate Constraint-4:\nThe company has a storage constraint where the sum of ProductD and ProductE cannot exceed 400 units.\n// ProductD + ProductE <= 400",
        "question": "A manufacturing company is planning to produce five different types of products: ProductA, ProductB, ProductC, ProductD, and ProductE. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, for ProductD is $60, and for ProductE is $80. The company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductC cannot exceed 30% of the total production. The production of ProductA must be at least twice the production of ProductB. The company has a storage constraint where the sum of ProductD and ProductE cannot exceed 400 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # quantity of ProductD\nProductE = model.addVar(vtype=\"INTEGER\", name=\"ProductE\", lb=0) # quantity of ProductE\n\n# Define objective function\nProfit_ProductA = 50 * ProductA\nProfit_ProductB = 70 * ProductB\nProfit_ProductC = 90 * ProductC\nProfit_ProductD = 60 * ProductD\nProfit_ProductE = 80 * ProductE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC + Profit_ProductD + Profit_ProductE)\n\n# Add constraints\n# The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1000)\n# Due to resource limitations, the production of ProductC cannot exceed 30% of the total production.\nmodel.addCons(ProductC <= 0.3 * (ProductA + ProductB + ProductC + ProductD + ProductE))\n# The production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProductA >= 2 * ProductB)\n# The company has a storage constraint where the sum of ProductD and ProductE cannot exceed 400 units.\nmodel.addCons(ProductD + ProductE <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Quantity of ProductD: \", model.getVal(ProductD))\n    print(\"Quantity of ProductE: \", model.getVal(ProductE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD_Units\", \"range\": \"DeviceD_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE_Units\", \"range\": \"DeviceE_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by:\n- Cost_A(x) = 20x^2 + 10x + 5\n- Cost_B(x) = 30x^2 + 20x + 10\n- Cost_C(x) = 40x^2 + 30x + 15\n- Cost_D(x) = 25x^2 + 15x + 8\n- Cost_E(x) = 35x^2 + 25x + 12\nThe company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 - Cost_A(DeviceA_Units)) * DeviceA_Units\n// Total net profit for DeviceB: Profit_B = (70 - Cost_B(DeviceB_Units)) * DeviceB_Units\n// Total net profit for DeviceC: Profit_C = (90 - Cost_C(DeviceC_Units)) * DeviceC_Units\n// Total net profit for DeviceD: Profit_D = (60 - Cost_D(DeviceD_Units)) * DeviceD_Units\n// Total net profit for DeviceE: Profit_E = (80 - Cost_E(DeviceE_Units)) * DeviceE_Units\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units + DeviceE_Units <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least 30% of the total production of DeviceB and DeviceC combined.\n// DeviceA_Units >= 0.3 * (DeviceB_Units + DeviceC_Units)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by:\n- Cost_A(x) = 20x^2 + 10x + 5\n- Cost_B(x) = 30x^2 + 20x + 10\n- Cost_C(x) = 40x^2 + 30x + 15\n- Cost_D(x) = 25x^2 + 15x + 8\n- Cost_E(x) = 35x^2 + 25x + 12\nThe company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least 30% of the total production of DeviceB and DeviceC combined.\nPlease help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)\nDeviceD_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Units\", lb=0)\nDeviceE_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Units\", lb=0)\n\n# Define objective function\n## Calculate the cost functions\nCost_A = lambda x: 20 * x**2 + 10 * x + 5\nCost_B = lambda x: 30 * x**2 + 20 * x + 10\nCost_C = lambda x: 40 * x**2 + 30 * x + 15\nCost_D = lambda x: 25 * x**2 + 15 * x + 8\nCost_E = lambda x: 35 * x**2 + 25 * x + 12\n\n## Calculate the profits\nProfit_A = (50 - Cost_A(DeviceA_Units)) * DeviceA_Units\nProfit_B = (70 - Cost_B(DeviceB_Units)) * DeviceB_Units\nProfit_C = (90 - Cost_C(DeviceC_Units)) * DeviceC_Units\nProfit_D = (60 - Cost_D(DeviceD_Units)) * DeviceD_Units\nProfit_E = (80 - Cost_E(DeviceE_Units)) * DeviceE_Units\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units + DeviceE_Units <= 1000)\n\n## Supplier agreement constraint\nmodel.addCons(DeviceA_Units >= 0.3 * (DeviceB_Units + DeviceC_Units))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceD_Units))\n    print(\"Number of DeviceE Units: \", model.getVal(DeviceE_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints.\n// {\"production quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_ProductA = (50 - 10) * ProductA\n// Total net profit for ProductB: Profit_ProductB = (70 - 15) * ProductB\n// Total net profit for ProductC: Profit_ProductC = (90 - 20) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a fixed budget for production costs, which is $20,000. The production cost per unit of ProductA is $20, ProductB is $30, and ProductC is $40.\n// 20 * ProductA + 30 * ProductB + 40 * ProductC <= 20,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints. The profit per unit, storage cost per unit, and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit | Production Cost per Unit |\n|---------|-----------------|-----------------------|--------------------------|\n| ProductA | $50            | $10                   | $20                      |\n| ProductB | $70            | $15                   | $30                      |\n| ProductC | $90            | $20                   | $40                      |\n\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total. Due to market demand, the production of ProductB must be at least twice the production of ProductA. The company has a fixed budget for production costs, which is $20,000. \n\nPlease help the company to maximize the total net profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of ProductC\n\n# Define objective function\nProfit_ProductA = (50 - 10) * ProductA\nProfit_ProductB = (70 - 15) * ProductB\nProfit_ProductC = (90 - 20) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 1000) # limited warehouse space\nmodel.addCons(ProductB >= 2 * ProductA) # market demand constraint for ProductB\nmodel.addCons(20 * ProductA + 30 * ProductB + 40 * ProductC <= 20000) # fixed budget for production costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit. Additionally, the company is considering outsourcing some of the production to external contractors.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"OutsourceA\", \"range\": \"OutsourceA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"OutsourceB\", \"range\": \"OutsourceB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"OutsourceC\", \"range\": \"OutsourceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nThe company aims to maximize the total profit, considering both in-house production and outsourcing.\n// Profit from DeviceA: Profit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\n// Profit from DeviceB: Profit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\n// Profit from DeviceC: Profit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units for all devices combined.\n// DeviceA + DeviceB + DeviceC <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $30,000 for outsourcing costs.\n// 80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30,000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is outsourced.\n// OutsourceA >= 0.1 * (DeviceA + OutsourceA)\n// OutsourceB >= 0.1 * (DeviceB + OutsourceB)\n// OutsourceC >= 0.1 * (DeviceC + OutsourceC)\n\n## Generate Constraint-4:\nThe company wants to produce at least 50 units of each device.\n// DeviceA >= 50; DeviceB >= 50; DeviceC >= 50\n\n## Generate Constraint-5:\nThe company wants to ensure that the total outsourced units do not exceed 30% of the total production.\n// OutsourceA + OutsourceB + OutsourceC <= 0.3 * (DeviceA + DeviceB + DeviceC + OutsourceA + OutsourceB + OutsourceC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit, and is also considering outsourcing some of the production to external contractors.\n\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\n\nThe company has a production capacity of 500 units for all devices combined. The company has a budget of $30,000 for outsourcing costs. The company wants to ensure that at least 10% of each device's production is outsourced. The company wants to produce at least 50 units of each device. The company also wants to ensure that the total outsourced units do not exceed 30% of the total production.\n\nPlease help the company to maximize the total profit, considering both in-house production and outsourcing.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=50)  # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=50)  # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=50)  # number of units of DeviceC\nOutsourceA = model.addVar(vtype=\"INTEGER\", name=\"OutsourceA\", lb=0)  # number of units outsourced for DeviceA\nOutsourceB = model.addVar(vtype=\"INTEGER\", name=\"OutsourceB\", lb=0)  # number of units outsourced for DeviceB\nOutsourceC = model.addVar(vtype=\"INTEGER\", name=\"OutsourceC\", lb=0)  # number of units outsourced for DeviceC\n\n# Define objective function\nProfit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\nProfit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\nProfit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)  # Production capacity constraint\nmodel.addCons(80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30000)  # Outsourcing budget constraint\nmodel.addCons(OutsourceA >= 0.1 * (DeviceA + OutsourceA))  # 10% outsourcing for DeviceA\nmodel.addCons(OutsourceB >= 0.1 * (DeviceB + OutsourceB))  # 10% outsourcing for DeviceB\nmodel.addCons(OutsourceC >= 0.1 * (DeviceC + OutsourceC))  # 10% outsourcing for DeviceC\nmodel.addCons(OutsourceA + OutsourceB + OutsourceC <= 0.3 * (DeviceA + DeviceB + DeviceC + OutsourceA + OutsourceB + OutsourceC))  # 30% total outsourcing constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Outsourced for DeviceA: \", model.getVal(OutsourceA))\n    print(\"Outsourced for DeviceB: \", model.getVal(OutsourceB))\n    print(\"Outsourced for DeviceC: \", model.getVal(OutsourceC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity and operating cost.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for V1 is $100, capacity is 10 packages, and the fuel efficiency is 10 miles per gallon.\nFor V2, the cost per trip is $150, capacity is 15 packages, and the fuel efficiency is 15 miles per gallon.\nFor V3, the cost per trip is $200, capacity is 20 packages, and the fuel efficiency is 20 miles per gallon.\nFor V4, the cost per trip is $250, capacity is 25 packages, and the fuel efficiency is 25 miles per gallon.\nFor V5, the cost per trip is $300, capacity is 30 packages, and the fuel efficiency is 30 miles per gallon.\nThe company wants to minimize the total cost per package delivered (cost per trip divided by capacity).\n// Total_Cost_V1 = 100 * V1 / 10\n// Total_Cost_V2 = 150 * V2 / 15\n// Total_Cost_V3 = 200 * V3 / 20\n// Total_Cost_V4 = 250 * V4 / 25\n// Total_Cost_V5 = 300 * V5 / 30\n// So, the objective function is: Minimize (Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n## Generate Constraint-1:\nThe total number of packages to be delivered is 1000.\n// 10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $20,000 for vehicle operations.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 20000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 vehicles in total.\n// V1 + V2 + V3 + V4 + V5 <= 50",
        "question": "A logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity, cost per trip, and fuel efficiency. The details for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Capacity | Fuel Efficiency |\n|---------|---------------|----------|-----------------|\n| V1      | $100          | 10       | 10 miles/gallon |\n| V2      | $150          | 15       | 15 miles/gallon |\n| V3      | $200          | 20       | 20 miles/gallon |\n| V4      | $250          | 25       | 25 miles/gallon |\n| V5      | $300          | 30       | 30 miles/gallon |\n\nThe company wants to deliver a total of 1000 packages. The company has a budget of $20,000 for vehicle operations. The company can only operate a maximum of 50 vehicles in total. \nPlease help the company to minimize the total cost per package delivered (cost per trip divided by capacity).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of V5 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_V1 = 100 * V1 / 10\nTotal_Cost_V2 = 150 * V2 / 15\nTotal_Cost_V3 = 200 * V3 / 20\nTotal_Cost_V4 = 250 * V4 / 25\nTotal_Cost_V5 = 300 * V5 / 30\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n# Add constraints\n## The total number of packages to be delivered is 1000.\nmodel.addCons(10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000)\n## The company has a budget of $20,000 for vehicle operations.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 20000)\n## The company can only operate a maximum of 50 vehicles in total.\nmodel.addCons(V1 + V2 + V3 + V4 + V5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Minimized Cost per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, the number of workers to allocate for each device, and the amount of investment in automation technology to reduce labor costs. The labor cost reduction per unit is affected by the investment in automation technology.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for DeviceC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit for DeviceA is $50, for DeviceB is $60, and for DeviceC is $70. The revenue per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $140. The investment in automation technology reduces the labor cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (100 - 50 + 0.0001 * Automation) * UnitsA - WorkersA * 20\n// Total profit for DeviceB: ProfitB = (120 - 60 + 0.0001 * Automation) * UnitsB - WorkersB * 20\n// Total profit for DeviceC: ProfitC = (140 - 70 + 0.0001 * Automation) * UnitsC - WorkersC * 20\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nThe number of workers allocated to each device must not exceed the number of units produced by that device.\n// WorkersA <= UnitsA; WorkersB <= UnitsB; WorkersC <= UnitsC\n\n## Generate Constraint-5:\nThe company must ensure that at least 20% of the total workers are allocated to DeviceC.\n// WorkersC >= 0.2 * (WorkersA + WorkersB + WorkersC)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, the number of workers to allocate for each device, and the amount of investment in automation technology to reduce labor costs. The labor cost reduction per unit is affected by the investment in automation technology. The labor cost per unit, revenue per unit, and the effect of automation technology on labor costs are given in the following Table.\n\n| Device | Labor Cost per Unit | Revenue per Unit | Automation Effect on Labor Cost |\n|--------|---------------------|------------------|---------------------------------|\n| DeviceA | $50                | $100             | $1 reduction for every $10,000 invested |\n| DeviceB | $60                | $120             | $1 reduction for every $10,000 invested |\n| DeviceC | $70                | $140             | $1 reduction for every $10,000 invested |\n\nThe company has a total of 100 workers available. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 500 units of DeviceA and 300 units of DeviceB. The number of workers allocated to each device must not exceed the number of units produced by that device. The company must ensure that at least 20% of the total workers are allocated to DeviceC.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for DeviceA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for DeviceB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * Automation) * UnitsA - WorkersA * 20\nProfitB = (120 - 60 + 0.0001 * Automation) * UnitsB - WorkersB * 20\nProfitC = (140 - 70 + 0.0001 * Automation) * UnitsC - WorkersC * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(Automation <= 50000)\nmodel.addCons(WorkersA <= UnitsA)\nmodel.addCons(WorkersB <= UnitsB)\nmodel.addCons(WorkersC <= UnitsC)\nmodel.addCons(WorkersC >= 0.2 * (WorkersA + WorkersB + WorkersC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for DeviceA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for DeviceB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for DeviceC: \", model.getVal(WorkersC))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1471,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of M1 machines\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of M2 machines\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of M3 machines\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of M4 machines\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for M1 is $500, for M2 is $700, for M3 is $900, and for M4 is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each machine type is given by: Cost_M1 = 200 + 0.01 * M1^2, Cost_M2 = 300 + 0.015 * M2^2, Cost_M3 = 400 + 0.02 * M3^2, Cost_M4 = 500 + 0.025 * M4^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n// Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n// Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n// Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines for the quarter.\n// M1 + M2 + M3 + M4 <= 500\n\n## Generate Constraint-2:\nThe market demand for M1 and M2 combined should not exceed 300 units.\n// M1 + M2 <= 300\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\n// M3 + M4 <= 200\n\n## Generate Constraint-4:\nDue to strategic planning, the production of M4 should be at least twice the production of M3.\n// M4 >= 2 * M3",
        "question": "A manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for M1 is $500, for M2 is $700, for M3 is $900, and for M4 is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each machine type is given by: Cost_M1 = 200 + 0.01 * M1^2, Cost_M2 = 300 + 0.015 * M2^2, Cost_M3 = 400 + 0.02 * M3^2, Cost_M4 = 500 + 0.025 * M4^2. The company has a total production capacity of 500 machines for the quarter. The market demand for M1 and M2 combined should not exceed 300 units. The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined. Due to strategic planning, the production of M4 should be at least twice the production of M3. Please help the company to maximize the total profit, which is the difference between the total revenue and the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of M1 machines\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of M2 machines\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of M3 machines\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of M4 machines\n\n# Define objective function\n## Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n## Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n## Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n## Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n## So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ((500 - (200 + 0.01 * M1**2)) * M1) + ((700 - (300 + 0.015 * M2**2)) * M2) + ((900 - (400 + 0.02 * M3**2)) * M3) + ((1100 - (500 + 0.025 * M4**2)) * M4))\n\n# Add constraints\n## The company has a total production capacity of 500 machines for the quarter.\nmodel.addCons(M1 + M2 + M3 + M4 <= 500)\n## The market demand for M1 and M2 combined should not exceed 300 units.\nmodel.addCons(M1 + M2 <= 300)\n## The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\nmodel.addCons(M3 + M4 <= 200)\n## Due to strategic planning, the production of M4 should be at least twice the production of M3.\nmodel.addCons(M4 >= 2 * M3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of M1 Machines: \", model.getVal(M1))\n    print(\"Number of M2 Machines: \", model.getVal(M2))\n    print(\"Number of M3 Machines: \", model.getVal(M3))\n    print(\"Number of M4 Machines: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n// Total operational cost for Solar: CostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\n// Total operational cost for Wind: CostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\n// Total operational cost for Hydro: CostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\n// 50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000\n\n## Generate Constraint-2:\nThe total number of power units that can be installed is limited to 20 units.\n// SolarUnits + WindUnits + HydroUnits <= 20",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology. The total number of power units that can be installed is limited to 20 units. The company aims to minimize the total operational cost of all power plants. Please help the company determine the optimal number of units and the investment in advanced technology for each type of power plant.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)    # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)    # investment in advanced technology for Wind\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nCostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\nCostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\nCostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n# So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\nmodel.addCons(50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000)\n# The total number of power units that can be installed is limited to 20 units.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(TechInvestmentHydro))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations.\n// {\"number of trucks allocated to the North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to the Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor the North region, the average fuel consumption per truck is 50 liters per day, the average delivery cost per truck is $300 per day, and the average revenue per truck is $500 per day.\nFor the South region, the average fuel consumption per truck is 45 liters per day, the average delivery cost per truck is $280 per day, and the average revenue per truck is $480 per day.\nFor the East region, the average fuel consumption per truck is 55 liters per day, the average delivery cost per truck is $320 per day, and the average revenue per truck is $520 per day.\nFor the West region, the average fuel consumption per truck is 60 liters per day, the average delivery cost per truck is $350 per day, and the average revenue per truck is $550 per day.\nFor the Central region, the average fuel consumption per truck is 40 liters per day, the average delivery cost per truck is $250 per day, and the average revenue per truck is $450 per day.\nThe company wants to maximize the net profit per liter of fuel consumed.\n// Total net profit for North: Profit_North = (500 - 300) * NorthTrucks\n// Total net profit for South: Profit_South = (480 - 280) * SouthTrucks\n// Total net profit for East: Profit_East = (520 - 320) * EastTrucks\n// Total net profit for West: Profit_West = (550 - 350) * WestTrucks\n// Total net profit for Central: Profit_Central = (450 - 250) * CentralTrucks\n// Total fuel consumption: Fuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n// So, the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\n// NorthTrucks - SouthTrucks <= 10\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 per day for delivery costs across all regions.\n// 300 * NorthTrucks + 280 * SouthTrucks + 320 * EastTrucks + 350 * WestTrucks + 250 * CentralTrucks <= 30000\n\n## Generate Constraint-4:\nThe company wants to ensure that each region has at least one truck allocated.\n// NorthTrucks >= 1; SouthTrucks >= 1; EastTrucks >= 1; WestTrucks >= 1; CentralTrucks >= 1",
        "question": "A logistics company is planning its delivery routes for five different regions: North, South, East, West, and Central. They need to determine the number of trucks allocated to each region to optimize their operations.\nFor the North region, the average fuel consumption per truck is 50 liters per day, the average delivery cost per truck is $300 per day, and the average revenue per truck is $500 per day.\nFor the South region, the average fuel consumption per truck is 45 liters per day, the average delivery cost per truck is $280 per day, and the average revenue per truck is $480 per day.\nFor the East region, the average fuel consumption per truck is 55 liters per day, the average delivery cost per truck is $320 per day, and the average revenue per truck is $520 per day.\nFor the West region, the average fuel consumption per truck is 60 liters per day, the average delivery cost per truck is $350 per day, and the average revenue per truck is $550 per day.\nFor the Central region, the average fuel consumption per truck is 40 liters per day, the average delivery cost per truck is $250 per day, and the average revenue per truck is $450 per day.\nThe company has a total of 100 trucks available for allocation. Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10. The company has a budget of $30,000 per day for delivery costs across all regions. The company wants to ensure that each region has at least one truck allocated.\nPlease help the company to maximize the net profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=1)  # number of trucks allocated to the North region\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=1)  # number of trucks allocated to the South region\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=1)  # number of trucks allocated to the East region\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=1)  # number of trucks allocated to the West region\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=1)  # number of trucks allocated to the Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_North = (500 - 300) * NorthTrucks\nProfit_South = (480 - 280) * SouthTrucks\nProfit_East = (520 - 320) * EastTrucks\nProfit_West = (550 - 350) * WestTrucks\nProfit_Central = (450 - 250) * CentralTrucks\nFuel = 50 * NorthTrucks + 45 * SouthTrucks + 55 * EastTrucks + 60 * WestTrucks + 40 * CentralTrucks\n## the objective function is: Maximize (Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central) / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Profit_North + Profit_South + Profit_East + Profit_West + Profit_Central)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100)\n## Due to regional regulations, the number of trucks in the North region must not exceed the number in the South region by more than 10.\nmodel.addCons(NorthTrucks - SouthTrucks <= 10)\n## The company has a budget of $30,000 per day for delivery costs across all regions.\nmodel.addCons(300 * NorthTrucks + 280 * SouthTrucks + 320 * EastTrucks + 350 * WestTrucks + 250 * CentralTrucks <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1591,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route (RouteA, RouteB, RouteC) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software, which will affect the fuel efficiency and operational costs of each route.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel optimization for RouteA\": \"FuelOptA\", \"range\": \"FuelOptA >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for RouteB\": \"FuelOptB\", \"range\": \"FuelOptB >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel optimization for RouteC\": \"FuelOptC\", \"range\": \"FuelOptC >= 0\", \"type\": \"continuous\"}\n// {\"investment in route optimization software\": \"SoftwareInvest\", \"range\": \"SoftwareInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route improves with the investment in fuel optimization and route optimization software. The company aims to minimize the total operational cost, which includes fuel costs and software investment.\nThe operational cost per truck for RouteA is $1000, but with fuel optimization and software, it decreases by $10 per truck for every $100 invested in fuel optimization and $5 per truck for every $100 invested in software.\nThe operational cost per truck for RouteB is $1200, and with fuel optimization and software, it decreases by $12 per truck for every $100 invested in fuel optimization and $6 per truck for every $100 invested in software.\nThe operational cost per truck for RouteC is $900, and with fuel optimization and software, it decreases by $9 per truck for every $100 invested in fuel optimization and $4.5 per truck for every $100 invested in software.\n// Operational cost for RouteA: CostA = (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA\n// Operational cost for RouteB: CostB = (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB\n// Operational cost for RouteC: CostC = (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operational costs and software investments.\n// (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA + (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB + (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC + SoftwareInvest <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 500.\n// TrucksA + TrucksB + TrucksC <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to RouteA and 150 trucks to RouteB.\n// TrucksA >= 100; TrucksB >= 150",
        "question": "A logistics company is planning its routes for the next quarter. The company needs to decide the number of trucks to allocate for each route (RouteA, RouteB, RouteC) and the amount of fuel to optimize for each route. Additionally, the company is considering investing in route optimization software, which will affect the fuel efficiency and operational costs of each route.\nThe operational cost per truck for RouteA is $1000, but with fuel optimization and software, it decreases by $10 per truck for every $100 invested in fuel optimization and $5 per truck for every $100 invested in software.\nThe operational cost per truck for RouteB is $1200, and with fuel optimization and software, it decreases by $12 per truck for every $100 invested in fuel optimization and $6 per truck for every $100 invested in software.\nThe operational cost per truck for RouteC is $900, and with fuel optimization and software, it decreases by $9 per truck for every $100 invested in fuel optimization and $4.5 per truck for every $100 invested in software.\nThe company has a total budget of $100,000 for operational costs and software investments. The total number of trucks available for all routes is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to RouteA and 150 trucks to RouteB.\nPlease help the company to minimize the total operational cost, which includes fuel costs and software investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=100)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=150)  # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)     # number of trucks for RouteC\nFuelOptA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptA\", lb=0)  # amount of fuel optimization for RouteA\nFuelOptB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptB\", lb=0)  # amount of fuel optimization for RouteB\nFuelOptC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOptC\", lb=0)  # amount of fuel optimization for RouteC\nSoftwareInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareInvest\", lb=0)  # investment in route optimization software\n\n# Define objective function\nCostA = (1000 - 0.1 * FuelOptA - 0.05 * SoftwareInvest) * TrucksA\nCostB = (1200 - 0.12 * FuelOptB - 0.06 * SoftwareInvest) * TrucksB\nCostC = (900 - 0.09 * FuelOptC - 0.045 * SoftwareInvest) * TrucksC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $100,000 for operational costs and software investments.\nmodel.addCons(CostA + CostB + CostC + SoftwareInvest <= 100000)\n# The total number of trucks available for all routes is limited to 500.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Amount of Fuel Optimization for RouteA: \", model.getVal(FuelOptA))\n    print(\"Amount of Fuel Optimization for RouteB: \", model.getVal(FuelOptB))\n    print(\"Amount of Fuel Optimization for RouteC: \", model.getVal(FuelOptC))\n    print(\"Investment in Route Optimization Software: \", model.getVal(SoftwareInvest))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1431,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of trips each type of truck will make per day. The cost of fuel and maintenance varies by truck size, and the revenue generated per trip also differs based on the type of goods transported.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for small trucks\": \"TripsSmall\", \"range\": \"TripsSmall >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for medium trucks\": \"TripsMedium\", \"range\": \"TripsMedium >= 0\", \"type\": \"integer\"}\n// {\"number of trips per day for large trucks\": \"TripsLarge\", \"range\": \"TripsLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel and maintenance for a small truck per trip is $100, for a medium truck is $150, and for a large truck is $200. The revenue generated per trip for a small truck is $200, for a medium truck is $300, and for a large truck is $400. The company aims to maximize its daily net profit.\n// Profit_Small = TripsSmall * (200 - 100) * SmallTrucks\n// Profit_Medium = TripsMedium * (300 - 150) * MediumTrucks\n// Profit_Large = TripsLarge * (400 - 200) * LargeTrucks\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel and maintenance.\n// 100 * TripsSmall * SmallTrucks + 150 * TripsMedium * MediumTrucks + 200 * TripsLarge * LargeTrucks <= 10000\n\n## Generate Constraint-2:\nThe company can only make a maximum of 500 trips per day across all trucks.\n// TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks <= 500\n\n## Generate Constraint-3:\nThe company has a limit on the number of trucks it can purchase, with a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 30% of the trips are made by large trucks to meet specific customer demands.\n// TripsLarge * LargeTrucks >= 0.3 * (TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of trips each type of truck will make per day. The cost of fuel and maintenance for a small truck per trip is $100, for a medium truck is $150, and for a large truck is $200. The revenue generated per trip for a small truck is $200, for a medium truck is $300, and for a large truck is $400. The company has a total budget of $10,000 per day for fuel and maintenance. The company can only make a maximum of 500 trips per day across all trucks. The company has a limit on the number of trucks it can purchase, with a maximum of 20 trucks in total. The company wants to ensure that at least 30% of the trips are made by large trucks to meet specific customer demands. The company aims to maximize its daily net profit.\n\nPlease help the company determine the optimal number of small, medium, and large trucks to purchase and the number of trips each type of truck should make per day to maximize its daily net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nTripsSmall = model.addVar(vtype=\"INTEGER\", name=\"TripsSmall\", lb=0)  # number of trips per day for small trucks\nTripsMedium = model.addVar(vtype=\"INTEGER\", name=\"TripsMedium\", lb=0)  # number of trips per day for medium trucks\nTripsLarge = model.addVar(vtype=\"INTEGER\", name=\"TripsLarge\", lb=0)  # number of trips per day for large trucks\n\n# Define objective function\nProfit_Small = TripsSmall * (200 - 100) * SmallTrucks\nProfit_Medium = TripsMedium * (300 - 150) * MediumTrucks\nProfit_Large = TripsLarge * (400 - 200) * LargeTrucks\n# So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n# The company has a total budget of $10,000 per day for fuel and maintenance.\nmodel.addCons(100 * TripsSmall * SmallTrucks + 150 * TripsMedium * MediumTrucks + 200 * TripsLarge * LargeTrucks <= 10000)\n# The company can only make a maximum of 500 trips per day across all trucks.\nmodel.addCons(TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks <= 500)\n# The company has a limit on the number of trucks it can purchase, with a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n# The company wants to ensure that at least 30% of the trips are made by large trucks to meet specific customer demands.\nmodel.addCons(TripsLarge * LargeTrucks >= 0.3 * (TripsSmall * SmallTrucks + TripsMedium * MediumTrucks + TripsLarge * LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Trips per day for Small Trucks: \", model.getVal(TripsSmall))\n    print(\"Trips per day for Medium Trucks: \", model.getVal(TripsMedium))\n    print(\"Trips per day for Large Trucks: \", model.getVal(TripsLarge))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs.\n// {\"fuel consumption of truck 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled. The cost function is given by C = F^2 * D, where F is the fuel consumption and D is the distance. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost: Cost = (F1^2 * D1) + (F2^2 * D2) + (F3^2 * D3) + (F4^2 * D4) + (F5^2 * D5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nEach truck must cover a minimum distance of 500 km.\n// D1 >= 500; D2 >= 500; D3 >= 500; D4 >= 500; D5 >= 500\n\n## Generate Constraint-2:\nThe total fuel consumption for all trucks must not exceed 1000 liters.\n// F1 + F2 + F3 + F4 + F5 <= 1000",
        "question": "A logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs. The operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled, given by C = F^2 * D, where F is the fuel consumption and D is the distance.\n\nThe company aims to minimize the total operational cost of all trucks. Each truck must cover a minimum distance of 500 km. The total fuel consumption for all trucks must not exceed 1000 liters.\n\nPlease help the company to determine the optimal fuel consumption for each truck to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each truck must cover a minimum distance of 500 km.\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=500) # distance covered by truck 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=500) # distance covered by truck 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=500) # distance covered by truck 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=500) # distance covered by truck 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=500) # distance covered by truck 5\n\n## Fuel consumption of each truck\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of truck 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of truck 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of truck 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of truck 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of truck 5\n\n# Define objective function\n## The operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled.\nCost = F1**2 * D1 + F2**2 * D2 + F3**2 * D3 + F4**2 * D4 + F5**2 * D5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total fuel consumption for all trucks must not exceed 1000 liters.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of truck 1: \", model.getVal(F1))\n    print(\"Fuel consumption of truck 2: \", model.getVal(F2))\n    print(\"Fuel consumption of truck 3: \", model.getVal(F3))\n    print(\"Fuel consumption of truck 4: \", model.getVal(F4))\n    print(\"Fuel consumption of truck 5: \", model.getVal(F5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each product for the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company wants to spend at most 400 hours on production for the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 1 hour          |\n| B       | 30$           | 15$           | 2 hours         |\n| C       | 40$           | 20$           | 3 hours         |\n| D       | 50$           | 25$           | 4 hours         |\n| E       | 60$           | 30$           | 5 hours         |\n\nThe company has $1500 available for material costs for the next quarter. The company wants to produce at least 20 units of each product for the next quarter. The company wants to spend at most 400 hours on production for the next quarter. The company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C. \nPlease help the company to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n## The company wants to spend at most 400 hours on production for the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n## The company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses.\n// {\"number of warehouses at Location A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of warehouses at Location E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each location to the distribution centers is as follows:\n- From Location A: $5 per unit\n- From Location B: $7 per unit\n- From Location C: $6 per unit\n- From Location D: $8 per unit\n- From Location E: $9 per unit\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location.\n// Total transportation cost: Cost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 to build warehouses.\n// Construction cost per warehouse at A: $1000, at B: $1500, at C: $1200, at D: $1800, at E: $2000\n// 1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000\n\n## Generate Constraint-2:\nThe total number of warehouses should not exceed 30.\n// A + B + C + D + E <= 30\n\n## Generate Constraint-3:\nAt least one warehouse must be built at Location A.\n// A >= 1\n\n## Generate Constraint-4:\nNo more than 10 warehouses can be built at Location B.\n// B <= 10",
        "question": "A logistics company needs to optimize the placement of warehouses to minimize transportation costs. They have identified five potential locations (Location A, Location B, Location C, Location D, and Location E) for warehouses. The transportation cost from each location to the distribution centers is as follows:\n\n| Location | Transportation Cost per Unit |\n|----------|------------------------------|\n| A        | $5                           |\n| B        | $7                           |\n| C        | $6                           |\n| D        | $8                           |\n| E        | $9                           |\n\nThe company has a budget of $50,000 to build warehouses. The construction cost per warehouse at each location is as follows:\n\n| Location | Construction Cost per Warehouse |\n|----------|---------------------------------|\n| A        | $1000                           |\n| B        | $1500                           |\n| C        | $1200                           |\n| D        | $1800                           |\n| E        | $2000                           |\n\nThe company wants to minimize the total transportation cost, considering the number of warehouses at each location. The total number of warehouses should not exceed 30. At least one warehouse must be built at Location A, and no more than 10 warehouses can be built at Location B.\n\nPlease help the company to determine the optimal number of warehouses to build at each location to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1)  # number of warehouses at Location A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=10)  # number of warehouses at Location B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)  # number of warehouses at Location C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0)  # number of warehouses at Location D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)  # number of warehouses at Location E\n\n# Define objective function\nCost = 5 * A + 7 * B + 6 * C + 8 * D + 9 * E\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n# The company has a budget of $50,000 to build warehouses.\nmodel.addCons(1000 * A + 1500 * B + 1200 * C + 1800 * D + 2000 * E <= 50000)\n# The total number of warehouses should not exceed 30.\nmodel.addCons(A + B + C + D + E <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of warehouses at Location A: \", model.getVal(A))\n    print(\"Number of warehouses at Location B: \", model.getVal(B))\n    print(\"Number of warehouses at Location C: \", model.getVal(C))\n    print(\"Number of warehouses at Location D: \", model.getVal(D))\n    print(\"Number of warehouses at Location E: \", model.getVal(E))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1498,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on R1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on R5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes.\n// So, the objective function is: Minimize (100 * R1^2 + 120 * R2^2 + 140 * R3^2 + 160 * R4^2 + 180 * R5^2)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// R1 + R2 + R3 + R4 + R5 <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel and maintenance costs. The cost per truck per route is linearly related to the number of trucks on that route.\n// 100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000\n\n## Generate Constraint-3:\nThe demand for transportation on route R1 is at least 5 trucks.\n// R1 >= 5\n\n## Generate Constraint-4:\nThe maximum capacity of route R4 is 10 trucks due to road width and safety regulations.\n// R4 <= 10\n\n## Generate Constraint-5:\nThe company aims to have at least 20% of its trucks on the most profitable route, R5.\n// R5 >= 0.2 * (R1 + R2 + R3 + R4 + R5)",
        "question": "A logistics company operates five different routes: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost of operating a truck on each route varies with the number of trucks allocated due to congestion and wear on the roads. The cost function for each route is given by:\n- Cost_R1 = 100 * R1^2\n- Cost_R2 = 120 * R2^2\n- Cost_R3 = 140 * R3^2\n- Cost_R4 = 160 * R4^2\n- Cost_R5 = 180 * R5^2\nThe company wants to minimize the total operating cost of all routes. The company has a total of 50 trucks available for allocation. The company has a budget of $10,000 for fuel and maintenance costs. The demand for transportation on route R1 is at least 5 trucks. The maximum capacity of route R4 is 10 trucks due to road width and safety regulations. The company aims to have at least 20% of its trucks on the most profitable route, R5.\nPlease help the company to minimize the total operating cost of all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=5)  # number of trucks on R1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0)  # number of trucks on R2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0)  # number of trucks on R3\nR4 = model.addVar(vtype=\"INTEGER\", name=\"R4\", lb=0, ub=10)  # number of trucks on R4\nR5 = model.addVar(vtype=\"INTEGER\", name=\"R5\", lb=0)  # number of trucks on R5\n\n# Define objective function\nCost_R1 = 100 * R1**2\nCost_R2 = 120 * R2**2\nCost_R3 = 140 * R3**2\nCost_R4 = 160 * R4**2\nCost_R5 = 180 * R5**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 50)  # Total trucks available\nmodel.addCons(100 * R1 + 120 * R2 + 140 * R3 + 160 * R4 + 180 * R5 <= 10000)  # Budget for fuel and maintenance\nmodel.addCons(R5 >= 0.2 * (R1 + R2 + R3 + R4 + R5))  # 20% of trucks on R5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on R1: \", model.getVal(R1))\n    print(\"Number of Trucks on R2: \", model.getVal(R2))\n    print(\"Number of Trucks on R3: \", model.getVal(R3))\n    print(\"Number of Trucks on R4: \", model.getVal(R4))\n    print(\"Number of Trucks on R5: \", model.getVal(R5))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the number of each type of truck to deploy for the upcoming quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will reduce fuel consumption but at a cost.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Small trucks\": \"FuelTechSmall\", \"range\": \"FuelTechSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"FuelTechMedium\", \"range\": \"FuelTechMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Large trucks\": \"FuelTechLarge\", \"range\": \"FuelTechLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost savings from investing in fuel-efficient technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces fuel costs by $200 per truck per quarter. For Medium trucks, each $1000 invested reduces fuel costs by $300 per truck per quarter. For Large trucks, each $1000 invested reduces fuel costs by $400 per truck per quarter. The company aims to maximize the total cost savings from fuel and operational efficiency.\n// FuelCostSavingsSmall = 0.2 * FuelTechSmall * SmallTrucks\n// FuelCostSavingsMedium = 0.3 * FuelTechMedium * MediumTrucks\n// FuelCostSavingsLarge = 0.4 * FuelTechLarge * LargeTrucks\n// OperationalCostSavings = (FuelCostSavingsSmall + FuelCostSavingsMedium + FuelCostSavingsLarge) - (FuelTechSmall + FuelTechMedium + FuelTechLarge)\n// So, the objective function is: Maximize OperationalCostSavings\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for investing in fuel-efficient technologies.\n// FuelTechSmall + FuelTechMedium + FuelTechLarge <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of Large trucks cannot exceed the number of Small trucks by more than 10.\n// LargeTrucks - SmallTrucks <= 10\n\n## Generate Constraint-4:\nThe company must operate at least 20 Medium trucks to meet contractual obligations.\n// MediumTrucks >= 20",
        "question": "A logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the number of each type of truck to deploy for the upcoming quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each type of truck, which will reduce fuel consumption but at a cost. The fuel cost savings from investing in fuel-efficient technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces fuel costs by $200 per truck per quarter. For Medium trucks, each $1000 invested reduces fuel costs by $300 per truck per quarter. For Large trucks, each $1000 invested reduces fuel costs by $400 per truck per quarter. The company aims to maximize the total cost savings from fuel and operational efficiency.\n\n| Truck Type | Fuel Cost Savings per $1000 Investment |\n|------------|----------------------------------------|\n| Small      | $200 per truck per quarter              |\n| Medium     | $300 per truck per quarter              |\n| Large      | $400 per truck per quarter              |\n\nThe company has a total budget of $50,000 for investing in fuel-efficient technologies. The total number of trucks cannot exceed 100. Due to maintenance constraints, the number of Large trucks cannot exceed the number of Small trucks by more than 10. The company must operate at least 20 Medium trucks to meet contractual obligations.\n\nPlease help the company to maximize the total cost savings from fuel and operational efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nFuelTechSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechSmall\", lb=0)  # investment in fuel-efficient technology for Small trucks\nFuelTechMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechMedium\", lb=0)  # investment in fuel-efficient technology for Medium trucks\nFuelTechLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTechLarge\", lb=0)  # investment in fuel-efficient technology for Large trucks\n\n# Define objective function\nFuelCostSavingsSmall = 0.2 * FuelTechSmall * SmallTrucks\nFuelCostSavingsMedium = 0.3 * FuelTechMedium * MediumTrucks\nFuelCostSavingsLarge = 0.4 * FuelTechLarge * LargeTrucks\nOperationalCostSavings = (FuelCostSavingsSmall + FuelCostSavingsMedium + FuelCostSavingsLarge) - (FuelTechSmall + FuelTechMedium + FuelTechLarge)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == OperationalCostSavings)\n\n# Add constraints\nmodel.addCons(FuelTechSmall + FuelTechMedium + FuelTechLarge <= 50000)  # total budget for investing in fuel-efficient technologies\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)  # total number of trucks cannot exceed 100\nmodel.addCons(LargeTrucks - SmallTrucks <= 10)  # number of Large trucks cannot exceed the number of Small trucks by more than 10\nmodel.addCons(MediumTrucks >= 20)  # must operate at least 20 Medium trucks\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel-Efficient Tech for Small Trucks: \", model.getVal(FuelTechSmall))\n    print(\"Investment in Fuel-Efficient Tech for Medium Trucks: \", model.getVal(FuelTechMedium))\n    print(\"Investment in Fuel-Efficient Tech for Large Trucks: \", model.getVal(FuelTechLarge))\n    print(\"Maximized Operational Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1561,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of trucks A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons and a fuel efficiency of 13 km/liter.\nThe company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel).\n// Ton-kilometers per liter for A: Tkm_A = 10 * 5 * A\n// Ton-kilometers per liter for B: Tkm_B = 15 * 7 * B\n// Ton-kilometers per liter for C: Tkm_C = 20 * 9 * C\n// Ton-kilometers per liter for D: Tkm_D = 25 * 11 * D\n// Ton-kilometers per liter for E: Tkm_E = 30 * 13 * E\n// So, the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50,000",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to decide how many of each type of truck to deploy for the upcoming month. The capacity and fuel efficiency for each truck are given in the following Table.\n\n| Truck | Capacity (tons) | Fuel Efficiency (km/liter) |\n|-------|-----------------|----------------------------|\n| A     | 10              | 5                          |\n| B     | 15              | 7                          |\n| C     | 20              | 9                          |\n| D     | 25              | 11                         |\n| E     | 30              | 13                         |\n\nThe company has a budget of $50,000 for purchasing fuel for the upcoming month. The company aims to maximize the total ton-kilometers per liter of fuel (which is defined as the sum of the product of each truck's capacity and the distance it can travel on one liter of fuel). Please help the company determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks E\n\n# Define objective function\n## Ton-kilometers per liter for each truck\nTkm_A = 10 * 5 * A\nTkm_B = 15 * 7 * B\nTkm_C = 20 * 9 * C\nTkm_D = 25 * 11 * D\nTkm_E = 30 * 13 * E\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\nmodel.addCons(obj == Tkm_A + Tkm_B + Tkm_C + Tkm_D + Tkm_E)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing fuel for the upcoming month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks A: \", model.getVal(A))\n    print(\"Number of Trucks B: \", model.getVal(B))\n    print(\"Number of Trucks C: \", model.getVal(C))\n    print(\"Number of Trucks D: \", model.getVal(D))\n    print(\"Number of Trucks E: \", model.getVal(E))\n    print(\"Maximized Ton-Kilometers per Liter: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-saving technology for product A\": \"EnergyInvestA\", \"range\": \"EnergyInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product B\": \"EnergyInvestB\", \"range\": \"EnergyInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product C\": \"EnergyInvestC\", \"range\": \"EnergyInvestC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product D\": \"EnergyInvestD\", \"range\": \"EnergyInvestD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n// Profit of product A: ProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\n// Profit of product B: ProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\n// Profit of product C: ProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\n// Profit of product D: ProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for energy-saving technology investments.\n// EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000\n\n## Generate Constraint-2:\nThe total raw material cost must not exceed $50,000.\n// 30 * A + 40 * B + 50 * C + 60 * D <= 50000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\nThe company has a budget of $100,000 for energy-saving technology investments. The total raw material cost must not exceed $50,000.\nPlease help the company to determine the optimal production quantity for each product and the appropriate investment in energy-saving technologies to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # production quantity of product D\nEnergyInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestA\", lb=0) # investment in energy-saving technology for product A\nEnergyInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestB\", lb=0) # investment in energy-saving technology for product B\nEnergyInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestC\", lb=0) # investment in energy-saving technology for product C\nEnergyInvestD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestD\", lb=0) # investment in energy-saving technology for product D\n\n# Define objective function\nProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\nProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\nProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\nProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for energy-saving technology investments.\nmodel.addCons(EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000)\n# The total raw material cost must not exceed $50,000.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Production Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Energy-Saving Technology for Product A: \", model.getVal(EnergyInvestA))\n    print(\"Investment in Energy-Saving Technology for Product B: \", model.getVal(EnergyInvestB))\n    print(\"Investment in Energy-Saving Technology for Product C: \", model.getVal(EnergyInvestC))\n    print(\"Investment in Energy-Saving Technology for Product D: \", model.getVal(EnergyInvestD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They have identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the annual operating cost is $50,000, the fuel efficiency is 5 km/l, and the capacity is 10 tons.\nFor TruckB, the annual operating cost is $60,000, the fuel efficiency is 6 km/l, and the capacity is 12 tons.\nFor TruckC, the annual operating cost is $70,000, the fuel efficiency is 7 km/l, and the capacity is 14 tons.\nFor TruckD, the annual operating cost is $80,000, the fuel efficiency is 8 km/l, and the capacity is 16 tons.\nFor TruckE, the annual operating cost is $90,000, the fuel efficiency is 9 km/l, and the capacity is 18 tons.\nThe company wants to minimize the total cost per ton-kilometer.\n// Total cost for TruckA: Cost_TruckA = 50,000 * TruckA\n// Total cost for TruckB: Cost_TruckB = 60,000 * TruckB\n// Total cost for TruckC: Cost_TruckC = 70,000 * TruckC\n// Total cost for TruckD: Cost_TruckD = 80,000 * TruckD\n// Total cost for TruckE: Cost_TruckE = 90,000 * TruckE\n// Total ton-kilometers for TruckA: TonKm_TruckA = 10 * 5 * TruckA\n// Total ton-kilometers for TruckB: TonKm_TruckB = 12 * 6 * TruckB\n// Total ton-kilometers for TruckC: TonKm_TruckC = 14 * 7 * TruckC\n// Total ton-kilometers for TruckD: TonKm_TruckD = 16 * 8 * TruckD\n// Total ton-kilometers for TruckE: TonKm_TruckE = 18 * 9 * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $1,500,000 for purchasing new trucks.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD + 90,000 * TruckE <= 1,500,000\n\n## Generate Constraint-2:\nThe total capacity of all trucks must be at least 1000 tons.\n// 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 1000\n\n## Generate Constraint-3:\nThe company must have at least 5 trucks of any type.\n// TruckA >= 5 or TruckB >= 5 or TruckC >= 5 or TruckD >= 5 or TruckE >= 5\n\n## Generate Constraint-4:\nThe total fuel efficiency of all trucks must be at least 500 km/l.\n// 5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE >= 500",
        "question": "A logistics company is planning its fleet for the next year and has identified five types of vehicles (TruckA, TruckB, TruckC, TruckD, and TruckE) to optimize their delivery routes.\nFor TruckA, the annual operating cost is $50,000, the fuel efficiency is 5 km/l, and the capacity is 10 tons.\nFor TruckB, the annual operating cost is $60,000, the fuel efficiency is 6 km/l, and the capacity is 12 tons.\nFor TruckC, the annual operating cost is $70,000, the fuel efficiency is 7 km/l, and the capacity is 14 tons.\nFor TruckD, the annual operating cost is $80,000, the fuel efficiency is 8 km/l, and the capacity is 16 tons.\nFor TruckE, the annual operating cost is $90,000, the fuel efficiency is 9 km/l, and the capacity is 18 tons.\nThe company has a budget of $1,500,000 for purchasing new trucks. The total capacity of all trucks must be at least 1000 tons. The company must have at least 5 trucks of any type. The total fuel efficiency of all trucks must be at least 500 km/l.\nPlease help the company to minimize the total cost per ton-kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)\n\n# Define objective function\nCost_TruckA = 50000 * TruckA\nCost_TruckB = 60000 * TruckB\nCost_TruckC = 70000 * TruckC\nCost_TruckD = 80000 * TruckD\nCost_TruckE = 90000 * TruckE\nTonKm_TruckA = 10 * 5 * TruckA\nTonKm_TruckB = 12 * 6 * TruckB\nTonKm_TruckC = 14 * 7 * TruckC\nTonKm_TruckD = 16 * 8 * TruckD\nTonKm_TruckE = 18 * 9 * TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# convert the division to multiplication\nmodel.addCons(obj * (TonKm_TruckA + TonKm_TruckB + TonKm_TruckC + TonKm_TruckD + TonKm_TruckE) == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n# The company has a budget of $1,500,000 for purchasing new trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD + 90000 * TruckE <= 1500000)\n# The total capacity of all trucks must be at least 1000 tons.\nmodel.addCons(10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 1000)\n# The company must have at least 5 trucks of any type.\nmodel.addCons(TruckA >= 5)\nmodel.addCons(TruckB >= 5)\nmodel.addCons(TruckC >= 5)\nmodel.addCons(TruckD >= 5)\nmodel.addCons(TruckE >= 5)\n# The total fuel efficiency of all trucks must be at least 500 km/l.\nmodel.addCons(5 * TruckA + 6 * TruckB + 7 * TruckC + 8 * TruckD + 9 * TruckE >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: Electronics, Clothing, and Food. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Clothing\": \"ClothingTrips\", \"range\": \"ClothingTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Food\": \"FoodTrips\", \"range\": \"FoodTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Electronics, the revenue per trip is $500, and the fuel cost per trip is $100.\nFor Clothing, the revenue per trip is $300, and the fuel cost per trip is $70.\nFor Food, the revenue per trip is $200, and the fuel cost per trip is $50.\nThe company wants to maximize the total net profit per day.\n// NetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (500 - 100)\n// NetProfit_Clothing = ClothingTrucks * ClothingTrips * (300 - 70)\n// NetProfit_Food = FoodTrucks * FoodTrips * (200 - 50)\n// So, the objective function is: Maximize (NetProfit_Electronics + NetProfit_Clothing + NetProfit_Food)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 20\n\n## Generate Constraint-2:\nDue to safety regulations, each truck can make a maximum of 5 trips per day.\n// ElectronicsTrips <= 5; ClothingTrips <= 5; FoodTrips <= 5",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: Electronics, Clothing, and Food. The company needs to determine the number of trucks to allocate for each type of goods and the number of trips each truck should make per day. For Electronics, the revenue per trip is $500, and the fuel cost per trip is $100. For Clothing, the revenue per trip is $300, and the fuel cost per trip is $70. For Food, the revenue per trip is $200, and the fuel cost per trip is $50. The company wants to maximize the total net profit per day. The company has a total of 20 trucks available. Due to safety regulations, each truck can make a maximum of 5 trips per day. Please help the company to determine the optimal allocation of trucks and trips to maximize the total net profit per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nClothingTrips = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrips\", lb=0)\nFoodTrips = model.addVar(vtype=\"INTEGER\", name=\"FoodTrips\", lb=0)\n\n# Define objective function\nNetProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (500 - 100)\nNetProfit_Clothing = ClothingTrucks * ClothingTrips * (300 - 70)\nNetProfit_Food = FoodTrucks * FoodTrips * (200 - 50)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Electronics + NetProfit_Clothing + NetProfit_Food)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 20)\nmodel.addCons(ElectronicsTrips <= 5)\nmodel.addCons(ClothingTrips <= 5)\nmodel.addCons(FoodTrips <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Clothing: \", model.getVal(ClothingTrips))\n    print(\"Number of Trips per Truck for Food: \", model.getVal(FoodTrips))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (25 - 12) * B\n// Profit of C: Profit_C = (30 - 15) * C\n// Profit of D: Profit_D = (35 - 18) * D\n// Profit of E: Profit_E = (40 - 20) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for material costs for the next quarter.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each component in the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company has a maximum of 400 hours available for production in the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturing company produces five different types of electronic components: A, B, C, D, and E. The company needs to decide how many units of each component to produce in the next quarter to optimize their profit margin.\nFor Component A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Component B, the selling price is $25, the material cost is $12, and the production time is 2 hours.\nFor Component C, the selling price is $30, the material cost is $15, and the production time is 3 hours.\nFor Component D, the selling price is $35, the material cost is $18, and the production time is 4 hours.\nFor Component E, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $2000 for material costs for the next quarter. The company wants to produce at least 20 units of each component in the next quarter. The company has a maximum of 400 hours available for production in the next quarter. The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each component in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of component E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (25 - 12) * B\nProfit_C = (30 - 15) * C\nProfit_D = (35 - 18) * D\nProfit_E = (40 - 20) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $2000 for material costs for the next quarter.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E <= 2000)\n## The company has a maximum of 400 hours available for production in the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n## The company wants to ensure that the total production of Component E does not exceed the combined production of Components A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\n// {\"number of trucks for GoodsA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodsA is $500 per trip, for GoodsB is $600 per trip, for GoodsC is $700 per trip, for GoodsD is $800 per trip, and for GoodsE is $900 per trip. The revenue generated by each trip of GoodsA is $1000, GoodsB is $1200, GoodsC is $1400, GoodsD is $1600, and GoodsE is $1800. The company wants to maximize the total net profit from all trips.\n// Net profit for GoodsA: Profit_A = (1000 - 500) * TrucksA\n// Net profit for GoodsB: Profit_B = (1200 - 600) * TrucksB\n// Net profit for GoodsC: Profit_C = (1400 - 700) * TrucksC\n// Net profit for GoodsD: Profit_D = (1600 - 800) * TrucksD\n// Net profit for GoodsE: Profit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network. The cost of operating a truck and the revenue generated per trip for each type of goods are given in the following Table.\n\n| Goods | Cost per Trip | Revenue per Trip |\n|-------|---------------|------------------|\n| GoodsA | $500         | $1000            |\n| GoodsB | $600         | $1200            |\n| GoodsC | $700         | $1400            |\n| GoodsD | $800         | $1600            |\n| GoodsE | $900         | $1800            |\n\nThe company has a total of 50 trucks available for distribution. The company wants to maximize the total net profit from all trips. Please help the company determine the optimal allocation of trucks to each type of goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodsA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodsB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodsC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodsD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodsE\n\n# Define objective function\nProfit_A = (1000 - 500) * TrucksA\nProfit_B = (1200 - 600) * TrucksB\nProfit_C = (1400 - 700) * TrucksC\nProfit_D = (1600 - 800) * TrucksD\nProfit_E = (1800 - 900) * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodsB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodsC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodsD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodsE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4).\n// {\"number of TruckType1 in Region1\": \"Truck1_R1\", \"range\": \"Truck1_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region2\": \"Truck1_R2\", \"range\": \"Truck1_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region3\": \"Truck1_R3\", \"range\": \"Truck1_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType1 in Region4\": \"Truck1_R4\", \"range\": \"Truck1_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region1\": \"Truck2_R1\", \"range\": \"Truck2_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region2\": \"Truck2_R2\", \"range\": \"Truck2_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region3\": \"Truck2_R3\", \"range\": \"Truck2_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType2 in Region4\": \"Truck2_R4\", \"range\": \"Truck2_R4 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region1\": \"Truck3_R1\", \"range\": \"Truck3_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region2\": \"Truck3_R2\", \"range\": \"Truck3_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region3\": \"Truck3_R3\", \"range\": \"Truck3_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of TruckType3 in Region4\": \"Truck3_R4\", \"range\": \"Truck3_R4 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckType1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckType3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The profit function is nonlinear due to the interaction between the number of trucks and the upgrade costs.\n// Profit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\n// Profit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\n// Profit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\n// So, the objective function is: Maximize (Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company is planning its operations for the next quarter and needs to decide on the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The company has three types of trucks (TruckType1, TruckType2, TruckType3) and operates in four regions (Region1, Region2, Region3, Region4). The company aims to maximize its profit, which is affected by the number of trucks allocated and the fuel efficiency upgrades. The profit per truck decreases with the upgrade cost but increases with the improved fuel efficiency. The profit function is nonlinear due to the interaction between the number of trucks and the upgrade costs. The total budget for fuel efficiency upgrades is $100,000.\n\nPlease help the company to maximize its total profit from all truck types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R1\", lb=0)\nTruck1_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R2\", lb=0)\nTruck1_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R3\", lb=0)\nTruck1_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck1_R4\", lb=0)\nTruck2_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R1\", lb=0)\nTruck2_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R2\", lb=0)\nTruck2_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R3\", lb=0)\nTruck2_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck2_R4\", lb=0)\nTruck3_R1 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R1\", lb=0)\nTruck3_R2 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R2\", lb=0)\nTruck3_R3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R3\", lb=0)\nTruck3_R4 = model.addVar(vtype=\"INTEGER\", name=\"Truck3_R4\", lb=0)\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Truck1 = (1000 - 0.1 * Upgrade1) * (Truck1_R1 + Truck1_R2 + Truck1_R3 + Truck1_R4)\nProfit_Truck2 = (1200 - 0.12 * Upgrade2) * (Truck2_R1 + Truck2_R2 + Truck2_R3 + Truck2_R4)\nProfit_Truck3 = (1500 - 0.15 * Upgrade3) * (Truck3_R1 + Truck3_R2 + Truck3_R3 + Truck3_R4)\n## the objective function is: Maximize (Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\nmodel.addCons(obj == Profit_Truck1 + Profit_Truck2 + Profit_Truck3)\n\n# Add constraints\n## The total budget for fuel efficiency upgrades is $100,000.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckType1 in Region1: \", model.getVal(Truck1_R1))\n    print(\"Number of TruckType1 in Region2: \", model.getVal(Truck1_R2))\n    print(\"Number of TruckType1 in Region3: \", model.getVal(Truck1_R3))\n    print(\"Number of TruckType1 in Region4: \", model.getVal(Truck1_R4))\n    print(\"Number of TruckType2 in Region1: \", model.getVal(Truck2_R1))\n    print(\"Number of TruckType2 in Region2: \", model.getVal(Truck2_R2))\n    print(\"Number of TruckType2 in Region3: \", model.getVal(Truck2_R3))\n    print(\"Number of TruckType2 in Region4: \", model.getVal(Truck2_R4))\n    print(\"Number of TruckType3 in Region1: \", model.getVal(Truck3_R1))\n    print(\"Number of TruckType3 in Region2: \", model.getVal(Truck3_R2))\n    print(\"Number of TruckType3 in Region3: \", model.getVal(Truck3_R3))\n    print(\"Number of TruckType3 in Region4: \", model.getVal(Truck3_R4))\n    print(\"Fuel Efficiency Upgrade for TruckType1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for TruckType2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for TruckType3: \", model.getVal(Upgrade3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs.\n// {\"number of containers for air transport\": \"AirContainers\", \"range\": \"AirContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for sea transport\": \"SeaContainers\", \"range\": \"SeaContainers >= 0\", \"type\": \"integer\"}\n// {\"number of containers for rail transport\": \"RailContainers\", \"range\": \"RailContainers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting a container via air is $500, via sea is $200, and via rail is $300. The efficiency of transportation is measured by the time taken to deliver goods, with air taking 1 day, sea taking 5 days, and rail taking 3 days. The company aims to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n// Total cost: Cost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\n// Average delivery time: Time = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n// So, the objective function is: Minimize (Cost + Time)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for transportation costs.\n// 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10,000\n\n## Generate Constraint-2:\nThe total number of containers that can be transported is limited to 50.\n// AirContainers + SeaContainers + RailContainers <= 50\n\n## Generate Constraint-3:\nDue to safety regulations, the number of containers transported by air must not exceed 10.\n// AirContainers <= 10\n\n## Generate Constraint-4:\nThe company has a contractual obligation to transport at least 15 containers by sea.\n// SeaContainers >= 15\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced distribution of containers across all modes, ensuring that the difference in the number of containers between any two modes does not exceed 5.\n// |AirContainers - SeaContainers| <= 5\n// |AirContainers - RailContainers| <= 5\n// |SeaContainers - RailContainers| <= 5",
        "question": "A logistics company is managing the distribution of goods through three different transportation modes: air, sea, and rail. The company needs to determine the number of containers to allocate for each mode of transportation to maximize efficiency while minimizing costs. The cost of transporting a container and the time taken to deliver goods for each mode are given in the following Table.\n\n| Mode        | Cost per Container | Delivery Time |\n|-------------|--------------------|---------------|\n| Air         | $500               | 1 day         |\n| Sea         | $200               | 5 days        |\n| Rail        | $300               | 3 days        |\n\nThe company has a budget of $10,000 for transportation costs. The total number of containers that can be transported is limited to 50. Due to safety regulations, the number of containers transported by air must not exceed 10. The company has a contractual obligation to transport at least 15 containers by sea. The company aims to maintain a balanced distribution of containers across all modes, ensuring that the difference in the number of containers between any two modes does not exceed 5. \n\nPlease help the company to minimize the total cost while ensuring that the average delivery time does not exceed 3 days.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAirContainers = model.addVar(vtype=\"INTEGER\", name=\"AirContainers\", lb=0)\nSeaContainers = model.addVar(vtype=\"INTEGER\", name=\"SeaContainers\", lb=15)\nRailContainers = model.addVar(vtype=\"INTEGER\", name=\"RailContainers\", lb=0)\n\n# Define objective function\nCost = 500 * AirContainers + 200 * SeaContainers + 300 * RailContainers\nDeliveryTime = (AirContainers + 5 * SeaContainers + 3 * RailContainers) / (AirContainers + SeaContainers + RailContainers)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost + DeliveryTime)\n\n# Add constraints\nmodel.addCons(500 * AirContainers + 200 * SeaContainers + 300 * RailContainers <= 10000)\nmodel.addCons(AirContainers + SeaContainers + RailContainers <= 50)\nmodel.addCons(AirContainers <= 10)\nmodel.addCons(SeaContainers >= 15)\n\n# Constraint for balanced distribution\nmodel.addCons(AirContainers - SeaContainers <= 5)\nmodel.addCons(SeaContainers - AirContainers <= 5)\nmodel.addCons(AirContainers - RailContainers <= 5)\nmodel.addCons(RailContainers - AirContainers <= 5)\nmodel.addCons(SeaContainers - RailContainers <= 5)\nmodel.addCons(RailContainers - SeaContainers <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Air Containers: \", model.getVal(AirContainers))\n    print(\"Number of Sea Containers: \", model.getVal(SeaContainers))\n    print(\"Number of Rail Containers: \", model.getVal(RailContainers))\n    print(\"Minimized Cost + Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"ComponentA_Qty\", \"range\": \"ComponentA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"ComponentB_Qty\", \"range\": \"ComponentB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"ComponentC_Qty\", \"range\": \"ComponentC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentD\": \"ComponentD_Qty\", \"range\": \"ComponentD_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentE\": \"ComponentE_Qty\", \"range\": \"ComponentE_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each component depends on its production quantity and market demand. The profit function for each component is given by:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 5000 units per month.\n// ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentA must be at least twice the production of ComponentB.\n// ComponentA_Qty >= 2 * ComponentB_Qty\n\n## Generate Constraint-3:\nThe company has a budget of $1,000,000 for raw materials per month.\n// 100 * ComponentA_Qty + 120 * ComponentB_Qty + 110 * ComponentC_Qty + 130 * ComponentD_Qty + 140 * ComponentE_Qty <= 1,000,000",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. They need to determine the production quantity for each component to optimize their profit. The profit from each component depends on its production quantity and market demand, with the profit function for each component as follows:\n- ComponentA: Profit_A = 50 * ComponentA_Qty * (1 - (ComponentA_Qty / 1000))\n- ComponentB: Profit_B = 70 * ComponentB_Qty * (1 - (ComponentB_Qty / 1500))\n- ComponentC: Profit_C = 60 * ComponentC_Qty * (1 - (ComponentC_Qty / 1200))\n- ComponentD: Profit_D = 80 * ComponentD_Qty * (1 - (ComponentD_Qty / 2000))\n- ComponentE: Profit_E = 90 * ComponentE_Qty * (1 - (ComponentE_Qty / 2500))\nThe company wants to maximize the total profit from all components. The company has a total production capacity of 5000 units per month. Due to resource limitations, the production of ComponentA must be at least twice the production of ComponentB. Additionally, the company has a budget of $1,000,000 for raw materials per month.\nPlease help the company to determine the optimal production quantity for each component to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentA_Qty\", lb=0)\nComponentB_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentB_Qty\", lb=0)\nComponentC_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentC_Qty\", lb=0)\nComponentD_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentD_Qty\", lb=0)\nComponentE_Qty = model.addVar(vtype=\"INTEGER\", name=\"ComponentE_Qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with non-linear terms (1 - (Qty / MaxQty))\n## Convert non-linear terms to linear by introducing new variables and constraints\nComponentA_MaxQty = 1000\nComponentB_MaxQty = 1500\nComponentC_MaxQty = 1200\nComponentD_MaxQty = 2000\nComponentE_MaxQty = 2500\n\nComponentA_Ratio = model.addVar(vtype=\"CONTINUOUS\", name=\"ComponentA_Ratio\", lb=0, ub=1)\nComponentB_Ratio = model.addVar(vtype=\"CONTINUOUS\", name=\"ComponentB_Ratio\", lb=0, ub=1)\nComponentC_Ratio = model.addVar(vtype=\"CONTINUOUS\", name=\"ComponentC_Ratio\", lb=0, ub=1)\nComponentD_Ratio = model.addVar(vtype=\"CONTINUOUS\", name=\"ComponentD_Ratio\", lb=0, ub=1)\nComponentE_Ratio = model.addVar(vtype=\"CONTINUOUS\", name=\"ComponentE_Ratio\", lb=0, ub=1)\n\nmodel.addCons(ComponentA_Qty <= ComponentA_MaxQty)\nmodel.addCons(ComponentB_Qty <= ComponentB_MaxQty)\nmodel.addCons(ComponentC_Qty <= ComponentC_MaxQty)\nmodel.addCons(ComponentD_Qty <= ComponentD_MaxQty)\nmodel.addCons(ComponentE_Qty <= ComponentE_MaxQty)\n\nmodel.addCons(ComponentA_Ratio == 1 - (ComponentA_Qty / ComponentA_MaxQty))\nmodel.addCons(ComponentB_Ratio == 1 - (ComponentB_Qty / ComponentB_MaxQty))\nmodel.addCons(ComponentC_Ratio == 1 - (ComponentC_Qty / ComponentC_MaxQty))\nmodel.addCons(ComponentD_Ratio == 1 - (ComponentD_Qty / ComponentD_MaxQty))\nmodel.addCons(ComponentE_Ratio == 1 - (ComponentE_Qty / ComponentE_MaxQty))\n\nProfit_A = 50 * ComponentA_Qty * ComponentA_Ratio\nProfit_B = 70 * ComponentB_Qty * ComponentB_Ratio\nProfit_C = 60 * ComponentC_Qty * ComponentC_Ratio\nProfit_D = 80 * ComponentD_Qty * ComponentD_Ratio\nProfit_E = 90 * ComponentE_Qty * ComponentE_Ratio\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(ComponentA_Qty + ComponentB_Qty + ComponentC_Qty + ComponentD_Qty + ComponentE_Qty <= 5000)\nmodel.addCons(ComponentA_Qty >= 2 * ComponentB_Qty)\nmodel.addCons(100 * ComponentA_Qty + 120 * ComponentB_Qty + 110 * ComponentC_Qty + 130 * ComponentD_Qty + 140 * ComponentE_Qty <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"ComponentA_Qty: \", model.getVal(ComponentA_Qty))\n    print(\"ComponentB_Qty: \", model.getVal(ComponentB_Qty))\n    print(\"ComponentC_Qty: \", model.getVal(ComponentC_Qty))\n    print(\"ComponentD_Qty: \", model.getVal(ComponentD_Qty))\n    print(\"ComponentE_Qty: \", model.getVal(ComponentE_Qty))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its operations for the next quarter, focusing on three main routes: RouteA, RouteB, and RouteC. The company needs to decide the number of trips to schedule on each route and the level of investment in fuel efficiency technologies for each route. The investment in fuel efficiency directly impacts the fuel cost per trip.\n// {\"number of trips on RouteA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips on RouteB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips on RouteC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for RouteA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for RouteB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for RouteC\": \"FuelEfficiencyC\", \"range\": \"FuelEfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit from all routes. The initial fuel cost per trip on RouteA is $300, but with increased fuel efficiency investment, the cost decreases by $5 for every $100 invested. The initial fuel cost per trip on RouteB is $250, and the cost decreases by $4 for every $100 invested in fuel efficiency. The initial fuel cost per trip on RouteC is $200, and the cost decreases by $3 for every $100 invested. The revenue per trip is constant at $500 for all routes.\n// Net profit for RouteA: ProfitA = 500 * TripsA - (300 - 0.05 * FuelEfficiencyA) * TripsA\n// Net profit for RouteB: ProfitB = 500 * TripsB - (250 - 0.04 * FuelEfficiencyB) * TripsB\n// Net profit for RouteC: ProfitC = 500 * TripsC - (200 - 0.03 * FuelEfficiencyC) * TripsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for both trip scheduling and fuel efficiency investments.\n// 300 * TripsA + 250 * TripsB + 200 * TripsC + FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum operational capacity of 50 trips across all routes.\n// TripsA + TripsB + TripsC <= 50",
        "question": "A logistics company is planning its operations for the next quarter, focusing on three main routes: RouteA, RouteB, and RouteC. The company needs to decide the number of trips to schedule on each route and the level of investment in fuel efficiency technologies for each route. The investment in fuel efficiency directly impacts the fuel cost per trip. The initial fuel cost per trip on RouteA is $300, but with increased fuel efficiency investment, the cost decreases by $5 for every $100 invested. The initial fuel cost per trip on RouteB is $250, and the cost decreases by $4 for every $100 invested in fuel efficiency. The initial fuel cost per trip on RouteC is $200, and the cost decreases by $3 for every $100 invested. The revenue per trip is constant at $500 for all routes. The company has a total budget of $10,000 for both trip scheduling and fuel efficiency investments. The company has a maximum operational capacity of 50 trips across all routes. Please help the company to maximize its net profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0)  # number of trips on RouteA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0)  # number of trips on RouteB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)  # number of trips on RouteC\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # investment in fuel efficiency for RouteA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # investment in fuel efficiency for RouteB\nFuelEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyC\", lb=0)  # investment in fuel efficiency for RouteC\n\n# Define objective function\nProfitA = 500 * TripsA - (300 - 0.05 * FuelEfficiencyA) * TripsA\nProfitB = 500 * TripsB - (250 - 0.04 * FuelEfficiencyB) * TripsB\nProfitC = 500 * TripsC - (200 - 0.03 * FuelEfficiencyC) * TripsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(300 * TripsA + 250 * TripsB + 200 * TripsC + FuelEfficiencyA + FuelEfficiencyB + FuelEfficiencyC <= 10000)\nmodel.addCons(TripsA + TripsB + TripsC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips on RouteA: \", model.getVal(TripsA))\n    print(\"Number of Trips on RouteB: \", model.getVal(TripsB))\n    print(\"Number of Trips on RouteC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for RouteA: \", model.getVal(FuelEfficiencyA))\n    print(\"Investment in Fuel Efficiency for RouteB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Fuel Efficiency for RouteC: \", model.getVal(FuelEfficiencyC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce, as well as the number of hours to operate each machine per day.\n// {\"number of MachineA\": \"MachineANum\", \"range\": \"MachineANum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBNum\", \"range\": \"MachineBNum >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCNum\", \"range\": \"MachineCNum >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for MachineA per day\": \"MachineAHours\", \"range\": \"MachineAHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineB per day\": \"MachineBHours\", \"range\": \"MachineBHours >= 0\", \"type\": \"real\"}\n// {\"hours of operation for MachineC per day\": \"MachineCHours\", \"range\": \"MachineCHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production rate of MachineA is 10 units per hour, MachineB is 15 units per hour, and MachineC is 20 units per hour. The company wants to maximize the total daily profit from all machines.\n// Profit_MachineA = MachineANum * MachineAHours * 10 * 500\n// Profit_MachineB = MachineBNum * MachineBHours * 15 * 700\n// Profit_MachineC = MachineCNum * MachineCHours * 20 * 900\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total of 24 hours available per day for all machines combined.\n// MachineAHours + MachineBHours + MachineCHours <= 24\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 per day for operational costs. The operational cost per hour for MachineA is $50, for MachineB is $70, and for MachineC is $90.\n// MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000\n\n## Generate Constraint-3:\nThe company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\n// MachineANum <= 5\n// MachineBNum <= 4\n// MachineCNum <= 3",
        "question": "A manufacturing company is planning to optimize its production of three different types of machines: MachineA, MachineB, and MachineC. The company needs to determine the optimal number of each type of machine to produce and the number of hours to operate each machine per day. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production rate of MachineA is 10 units per hour, MachineB is 15 units per hour, and MachineC is 20 units per hour. The company wants to maximize the total daily profit from all machines.\n\nThe company has a total of 24 hours available per day for all machines combined. The company also has a budget constraint of $10,000 per day for operational costs, with operational costs per hour for MachineA at $50, for MachineB at $70, and for MachineC at $90. Additionally, the company has a space constraint that allows for a maximum of 5 MachineA, 4 MachineB, and 3 MachineC.\n\nPlease help the company to maximize the total daily profit from all machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineANum = model.addVar(vtype=\"INTEGER\", name=\"MachineANum\", lb=0)  # number of MachineA\nMachineBNum = model.addVar(vtype=\"INTEGER\", name=\"MachineBNum\", lb=0)  # number of MachineB\nMachineCNum = model.addVar(vtype=\"INTEGER\", name=\"MachineCNum\", lb=0)  # number of MachineC\nMachineAHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAHours\", lb=0)  # hours of operation for MachineA per day\nMachineBHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBHours\", lb=0)  # hours of operation for MachineB per day\nMachineCHours = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCHours\", lb=0)  # hours of operation for MachineC per day\n\n# Define objective function\nProfit_MachineA = MachineANum * MachineAHours * 10 * 500\nProfit_MachineB = MachineBNum * MachineBHours * 15 * 700\nProfit_MachineC = MachineCNum * MachineCHours * 20 * 900\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\nmodel.addCons(MachineAHours + MachineBHours + MachineCHours <= 24)\nmodel.addCons(MachineAHours * 50 * MachineANum + MachineBHours * 70 * MachineBNum + MachineCHours * 90 * MachineCNum <= 10000)\nmodel.addCons(MachineANum <= 5)\nmodel.addCons(MachineBNum <= 4)\nmodel.addCons(MachineCNum <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineANum))\n    print(\"Number of MachineB: \", model.getVal(MachineBNum))\n    print(\"Number of MachineC: \", model.getVal(MachineCNum))\n    print(\"Hours of operation for MachineA: \", model.getVal(MachineAHours))\n    print(\"Hours of operation for MachineB: \", model.getVal(MachineBHours))\n    print(\"Hours of operation for MachineC: \", model.getVal(MachineCHours))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 646,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\n// ProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\n// ProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for efficiency investments.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 500 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of money to be invested in enhancing the production efficiency of each product line. The efficiency enhancement reduces the production cost per unit linearly with the investment. The production cost per unit of ProductA is $50, which decreases by $0.01 for every $1 invested in efficiency. The production cost per unit of ProductB is $70, which decreases by $0.015 for every $1 invested in efficiency. The production cost per unit of ProductC is $90, which decreases by $0.02 for every $1 invested in efficiency. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $10,000 for efficiency investments. The total production capacity of the company is 500 units per month. Please help the company determine the optimal production quantities and efficiency investments to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0) # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0) # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * EfficiencyA)) * ProductAQty\nProfitB = (120 - (70 - 0.015 * EfficiencyB)) * ProductBQty\nProfitC = (150 - (90 - 0.02 * EfficiencyC)) * ProductCQty\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $10,000 for efficiency investments.\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 10000)\n# The total production capacity of the company is 500 units per month.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be used per trip. The goal is to minimize the total fuel cost while meeting delivery deadlines and maintaining safety standards.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"speed of Truck1 (km/h)\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"speed of Truck2 (km/h)\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"fuel consumption per trip for Truck1 (liters)\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption per trip for Truck2 (liters)\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, following the formula: Fuel = a * Speed^3 + b * Speed^2 + c * Speed, where a, b, and c are constants. The company aims to minimize the total fuel cost, which is the sum of the fuel consumed by each truck multiplied by the number of trips and the cost per liter of fuel.\n// Fuel consumption for Truck1: Fuel1 = a1 * Speed1^3 + b1 * Speed1^2 + c1 * Speed1\n// Fuel consumption for Truck2: Fuel2 = a2 * Speed2^3 + b2 * Speed2^2 + c2 * Speed2\n// Total fuel cost: Cost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nEach truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips.\n// Trips1 >= 50; Trips2 >= 75\n\n## Generate Constraint-2:\nThe total time spent on the road by all trucks must not exceed 1000 hours. The time per trip is distance divided by speed.\n// (Distance1 / Speed1) * Trips1 + (Distance2 / Speed2) * Trips2 <= 1000\n\n## Generate Constraint-3:\nThe total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5.\n// (Fuel1 * Trips1 + Fuel2 * Trips2) * 1.5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning. The company must decide the number of trips each truck will make on different routes, the speed at which each truck will travel, and the amount of fuel to be used per trip. The goal is to minimize the total fuel cost while meeting delivery deadlines and maintaining safety standards. The fuel consumption of each truck is a nonlinear function of its speed, following the formula: Fuel = a * Speed^3 + b * Speed^2 + c * Speed, where a, b, and c are constants. The company aims to minimize the total fuel cost, which is the sum of the fuel consumed by each truck multiplied by the number of trips and the cost per liter of fuel.\n\nThe company has the following constraints:\n1. Each truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips.\n2. The total time spent on the road by all trucks must not exceed 1000 hours. The time per trip is distance divided by speed.\n3. The total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5.\n\nPlease help the company to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each truck must complete a minimum number of trips to meet delivery deadlines. Truck1 must make at least 50 trips, and Truck2 must make at least 75 trips.\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=50) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=75) # number of trips for Truck2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100) # speed of Truck1 (km/h)\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100) # speed of Truck2 (km/h)\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel consumption per trip for Truck1 (liters)\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel consumption per trip for Truck2 (liters)\n\n# Define objective function\n## Fuel consumption for Truck1: Fuel1 = a1 * Speed1^3 + b1 * Speed1^2 + c1 * Speed1\n## Fuel consumption for Truck2: Fuel2 = a2 * Speed2^3 + b2 * Speed2^2 + c2 * Speed2\n## Total fuel cost: Cost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\n## So, the objective function is: Minimize Cost\na1, b1, c1, a2, b2, c2, CostPerLiter = 0.001, 0.01, 1, 0.001, 0.01, 1, 1.5\nFuel1 = a1 * Speed1**3 + b1 * Speed1**2 + c1 * Speed1\nFuel2 = a2 * Speed2**3 + b2 * Speed2**2 + c2 * Speed2\nCost = (Fuel1 * Trips1 + Fuel2 * Trips2) * CostPerLiter\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total time spent on the road by all trucks must not exceed 1000 hours. The time per trip is distance divided by speed.\nDistance1, Distance2 = 500, 600 # example distances\nmodel.addCons((Distance1 / Speed1) * Trips1 + (Distance2 / Speed2) * Trips2 <= 1000)\n## The total fuel budget for the company is $10,000. The cost of fuel per liter is $1.5.\nmodel.addCons((Fuel1 * Trips1 + Fuel2 * Trips2) * 1.5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Speed of Truck1: \", model.getVal(Speed1))\n    print(\"Speed of Truck2: \", model.getVal(Speed2))\n    print(\"Fuel Consumption per Trip for Truck1: \", model.getVal(Fuel1))\n    print(\"Fuel Consumption per Trip for Truck2: \", model.getVal(Fuel2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1211,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The production cost per unit of product A is $20, product B is $30, and product C is $25. The company aims to maximize the total net profit.\n// NetProfitA = (50 - 20) * UnitsA\n// NetProfitB = (70 - 30) * UnitsB\n// NetProfitC = (60 - 25) * UnitsC\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe storage facility can hold a maximum of 500 units at any given time.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs, storage capacity, and market demand. The profit per unit, production cost per unit, and the net profit per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Net Profit per Unit |\n|---------|-----------------|--------------------------|---------------------|\n| A       | $50             | $20                      | $30                 |\n| B       | $70             | $30                      | $40                 |\n| C       | $60             | $25                      | $35                 |\n\nThe company has a total production capacity of 1000 units per month. The storage facility can hold a maximum of 500 units at any given time. \nPlease help the company to maximize the total net profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfitA = (50 - 20) * UnitsA\nNetProfitB = (70 - 30) * UnitsB\nNetProfitC = (60 - 25) * UnitsC\n## the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC)\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## The storage facility can hold a maximum of 500 units at any given time.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide how many trucks to allocate to each region and the fuel consumption rate for each truck in that region.\n// {\"number of trucks in North region\": \"NorthTrucks\", \"range\": \"NorthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"SouthTrucks\", \"range\": \"SouthTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"EastTrucks\", \"range\": \"EastTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"WestTrucks\", \"range\": \"WestTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"CentralTrucks\", \"range\": \"CentralTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per truck in North region\": \"NorthFuelRate\", \"range\": \"NorthFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in South region\": \"SouthFuelRate\", \"range\": \"SouthFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in East region\": \"EastFuelRate\", \"range\": \"EastFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in West region\": \"WestFuelRate\", \"range\": \"WestFuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate per truck in Central region\": \"CentralFuelRate\", \"range\": \"CentralFuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost while ensuring efficient delivery. The fuel cost per liter is $1.5. The company wants to minimize the total fuel consumption across all regions.\n// Total fuel consumption for North region: Fuel_North = NorthTrucks * NorthFuelRate\n// Total fuel consumption for South region: Fuel_South = SouthTrucks * SouthFuelRate\n// Total fuel consumption for East region: Fuel_East = EastTrucks * EastFuelRate\n// Total fuel consumption for West region: Fuel_West = WestTrucks * WestFuelRate\n// Total fuel consumption for Central region: Fuel_Central = CentralTrucks * CentralFuelRate\n// So, the objective function is: Minimize (1.5 * (Fuel_North + Fuel_South + Fuel_East + Fuel_West + Fuel_Central))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation across all regions.\n// NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100\n\n## Generate Constraint-2:\nDue to environmental regulations, the average fuel consumption rate across all trucks must not exceed 20 liters per truck per day.\n// (NorthTrucks * NorthFuelRate + SouthTrucks * SouthFuelRate + EastTrucks * EastFuelRate + WestTrucks * WestFuelRate + CentralTrucks * CentralFuelRate) / (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks) <= 20",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide how many trucks to allocate to each region and the fuel consumption rate for each truck in that region. The fuel cost per liter is $1.5. The company wants to minimize the total fuel consumption across all regions.\n\n| Region       | Number of Trucks | Fuel Consumption Rate per Truck |\n|--------------|------------------|---------------------------------|\n| North        | NorthTrucks      | NorthFuelRate                   |\n| South        | SouthTrucks      | SouthFuelRate                   |\n| East         | EastTrucks       | EastFuelRate                    |\n| West         | WestTrucks       | WestFuelRate                    |\n| Central      | CentralTrucks    | CentralFuelRate                 |\n\nThe company has a total of 100 trucks available for allocation across all regions. Due to environmental regulations, the average fuel consumption rate across all trucks must not exceed 20 liters per truck per day.\n\nPlease help the company to minimize the total fuel cost while ensuring efficient delivery.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthTrucks = model.addVar(vtype=\"INTEGER\", name=\"NorthTrucks\", lb=0)\nSouthTrucks = model.addVar(vtype=\"INTEGER\", name=\"SouthTrucks\", lb=0)\nEastTrucks = model.addVar(vtype=\"INTEGER\", name=\"EastTrucks\", lb=0)\nWestTrucks = model.addVar(vtype=\"INTEGER\", name=\"WestTrucks\", lb=0)\nCentralTrucks = model.addVar(vtype=\"INTEGER\", name=\"CentralTrucks\", lb=0)\nNorthFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"NorthFuelRate\", lb=0)\nSouthFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"SouthFuelRate\", lb=0)\nEastFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"EastFuelRate\", lb=0)\nWestFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"WestFuelRate\", lb=0)\nCentralFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"CentralFuelRate\", lb=0)\n\n# Define objective function\nFuel_North = NorthTrucks * NorthFuelRate\nFuel_South = SouthTrucks * SouthFuelRate\nFuel_East = EastTrucks * EastFuelRate\nFuel_West = WestTrucks * WestFuelRate\nFuel_Central = CentralTrucks * CentralFuelRate\nTotalFuelConsumption = Fuel_North + Fuel_South + Fuel_East + Fuel_West + Fuel_Central\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 1.5 * TotalFuelConsumption)\n\n# Add constraints\nmodel.addCons(NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks <= 100)\nmodel.addCons((NorthTrucks * NorthFuelRate + SouthTrucks * SouthFuelRate + EastTrucks * EastFuelRate + WestTrucks * WestFuelRate + CentralTrucks * CentralFuelRate) <= 20 * (NorthTrucks + SouthTrucks + EastTrucks + WestTrucks + CentralTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(NorthTrucks))\n    print(\"Number of Trucks in South Region: \", model.getVal(SouthTrucks))\n    print(\"Number of Trucks in East Region: \", model.getVal(EastTrucks))\n    print(\"Number of Trucks in West Region: \", model.getVal(WestTrucks))\n    print(\"Number of Trucks in Central Region: \", model.getVal(CentralTrucks))\n    print(\"Fuel Consumption Rate per Truck in North Region: \", model.getVal(NorthFuelRate))\n    print(\"Fuel Consumption Rate per Truck in South Region: \", model.getVal(SouthFuelRate))\n    print(\"Fuel Consumption Rate per Truck in East Region: \", model.getVal(EastFuelRate))\n    print(\"Fuel Consumption Rate per Truck in West Region: \", model.getVal(WestFuelRate))\n    print(\"Fuel Consumption Rate per Truck in Central Region: \", model.getVal(CentralFuelRate))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: CostA = 20 + 0.05 * UnitsA^2, CostB = 30 + 0.03 * UnitsB^2, CostC = 40 + 0.02 * UnitsC^2, CostD = 50 + 0.01 * UnitsD^2. The company wants to maximize its total net profit.\n// Total net profit for DeviceA: ProfitA = (50 - CostA) * UnitsA = (50 - (20 + 0.05 * UnitsA^2)) * UnitsA\n// Total net profit for DeviceB: ProfitB = (70 - CostB) * UnitsB = (70 - (30 + 0.03 * UnitsB^2)) * UnitsB\n// Total net profit for DeviceC: ProfitC = (90 - CostC) * UnitsC = (90 - (40 + 0.02 * UnitsC^2)) * UnitsC\n// Total net profit for DeviceD: ProfitD = (110 - CostD) * UnitsD = (110 - (50 + 0.01 * UnitsD^2)) * UnitsD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD <= 1000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: CostA = 20 + 0.05 * UnitsA^2, CostB = 30 + 0.03 * UnitsB^2, CostC = 40 + 0.02 * UnitsC^2, CostD = 50 + 0.01 * UnitsD^2. The company has a total production capacity of 1000 units per month. Please help the company to maximize its total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## Calculate the cost and profit for each device\nCostA = 20 + 0.05 * UnitsA**2\nCostB = 30 + 0.03 * UnitsB**2\nCostC = 40 + 0.02 * UnitsC**2\nCostD = 50 + 0.01 * UnitsD**2\n\nProfitA = (50 - CostA) * UnitsA\nProfitB = (70 - CostB) * UnitsB\nProfitC = (90 - CostC) * UnitsC\nProfitD = (110 - CostD) * UnitsD\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Number of DeviceD: \", model.getVal(UnitsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation.\n// Cost_T1 = 2 * T1\n// Cost_T2 = 3 * T2\n// Cost_T3 = 4 * T3\n// Cost_T4 = 5 * T4\n// Cost_T5 = 6 * T5\n// The objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe total demand for transportation is 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-4:\nThe company has a limit on the number of T3 trucks it can operate, which is 10.\n// T3 <= 10",
        "question": "A logistics company is planning its fleet of trucks for transporting goods across different regions. They have five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and operational costs. Each type of truck has a different cost per kilometer and capacity. The costs per kilometer are $2 for T1, $3 for T2, $4 for T3, $5 for T4, and $6 for T5. The capacities are 10 tons for T1, 20 tons for T2, 30 tons for T3, 40 tons for T4, and 50 tons for T5. The company wants to minimize the total operational cost while meeting the demand for transportation. The total demand for transportation is 1000 tons. The company has a budget of $2000 for operational costs. The company can only operate a maximum of 50 trucks in total. The company has a limit on the number of T3 trucks it can operate, which is 10. Please help the company to minimize the total operational cost while meeting the demand for transportation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 2 * T1\nCost_T2 = 3 * T2\nCost_T3 = 4 * T3\nCost_T4 = 5 * T4\nCost_T5 = 6 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total demand for transportation is 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n## The company has a budget of $2000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 2000)\n## The company can only operate a maximum of 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The company has a limit on the number of T3 trucks it can operate, which is 10.\nmodel.addCons(T3 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"TA\", \"range\": \"TA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TB\", \"range\": \"TB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TC\", \"range\": \"TC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TD\", \"range\": \"TD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TE\", \"range\": \"TE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different fuel efficiency and maintenance costs. \n- Truck A has a fuel efficiency of 10 km/l and a maintenance cost of $500 per month.\n- Truck B has a fuel efficiency of 12 km/l and a maintenance cost of $600 per month.\n- Truck C has a fuel efficiency of 15 km/l and a maintenance cost of $700 per month.\n- Truck D has a fuel efficiency of 18 km/l and a maintenance cost of $800 per month.\n- Truck E has a fuel efficiency of 20 km/l and a maintenance cost of $900 per month.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Total fuel cost: FuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / FuelEfficiency)\n// Total maintenance cost: MaintenanceCost = (500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE)\n// Total cost per kilometer: TotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n// So, the objective function is: Minimize TotalCostPerKm\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 per month for all trucks combined.\n// 500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// TA + TB + TC + TD + TE <= 50\n\n## Generate Constraint-3:\nAt least 10 trucks of each type must be operational.\n// TA >= 10; TB >= 10; TC >= 10; TD >= 10; TE >= 10",
        "question": "A logistics company operates five different types of vehicles (Truck A, Truck B, Truck C, Truck D, and Truck E) to transport goods. The company needs to determine the number of each type of truck to maximize efficiency and minimize costs. The fuel efficiency and maintenance costs for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) |\n|------------|-----------------------|---------------------------|\n| Truck A    | 10                    | 500                       |\n| Truck B    | 12                    | 600                       |\n| Truck C    | 15                    | 700                       |\n| Truck D    | 18                    | 800                       |\n| Truck E    | 20                    | 900                       |\n\nThe company has a budget of $50,000 per month for all trucks combined. The total number of trucks cannot exceed 50. At least 10 trucks of each type must be operational. \nPlease help the company to minimize the total cost of fuel and maintenance per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## At least 10 trucks of each type must be operational.\nTA = model.addVar(vtype=\"INTEGER\", name=\"TA\", lb=10) # number of Truck A\nTB = model.addVar(vtype=\"INTEGER\", name=\"TB\", lb=10) # number of Truck B\nTC = model.addVar(vtype=\"INTEGER\", name=\"TC\", lb=10) # number of Truck C\nTD = model.addVar(vtype=\"INTEGER\", name=\"TD\", lb=10) # number of Truck D\nTE = model.addVar(vtype=\"INTEGER\", name=\"TE\", lb=10) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelPricePerLiter = 1.5  # Assuming fuel price per liter\nFuelCost = (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) * (FuelPricePerLiter / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE))\nMaintenanceCost = (500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE)\nTotalCostPerKm = (FuelCost + MaintenanceCost) / (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE)\n## convert the division to multiplication\nmodel.addCons(obj * (10 * TA + 12 * TB + 15 * TC + 18 * TD + 20 * TE) == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $50,000 per month for all trucks combined.\nmodel.addCons(500 * TA + 600 * TB + 700 * TC + 800 * TD + 900 * TE <= 50000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(TA + TB + TC + TD + TE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TA))\n    print(\"Number of Truck B: \", model.getVal(TB))\n    print(\"Number of Truck C: \", model.getVal(TC))\n    print(\"Number of Truck D: \", model.getVal(TD))\n    print(\"Number of Truck E: \", model.getVal(TE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm. Additionally, the company must decide on the level of investment in advanced turbine technology for each type, which affects the energy output and operational costs.\n// {\"number of turbines of Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines of Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines of Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Type1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Type2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Type3\": \"TechInvest3\", \"range\": \"TechInvest3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per turbine is enhanced by the investment in advanced technology. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The company aims to maximize the total energy output from all wind farms.\n// Output1 = (10 + 0.001 * TechInvest1) * Turbines1\n// Output2 = (15 + 0.0015 * TechInvest2) * Turbines2\n// Output3 = (20 + 0.002 * TechInvest3) * Turbines3\n// So, the objective function is: Maximize (Output1 + Output2 + Output3)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for turbine installations and technology investments.\n// 10000 * Turbines1 + 15000 * Turbines2 + 20000 * Turbines3 + TechInvest1 + TechInvest2 + TechInvest3 <= 1000000",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of investment in advanced turbine technology for each type, which affects the energy output and operational costs. The enhancement in energy output per turbine due to investment in advanced technology is as follows:\n\n| Wind Farm Type | Investment Impact per $1000 |\n|----------------|-----------------------------|\n| Type1          | 1 MWh                       |\n| Type2          | 1.5 MWh                     |\n| Type3          | 2 MWh                       |\n\nThe company aims to maximize the total energy output from all wind farms. The company has a budget of $1,000,000 for turbine installations and technology investments.\n\nPlease help the company determine the optimal number of turbines and the appropriate level of investment in advanced technology for each type of wind farm to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=0)  # number of turbines of Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=0)  # number of turbines of Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)  # number of turbines of Type3\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in advanced technology for Type1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=0)  # investment in advanced technology for Type2\nTechInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest3\", lb=0)  # investment in advanced technology for Type3\n\n# Define objective function\nOutput1 = (10 + 0.001 * TechInvest1) * Turbines1\nOutput2 = (15 + 0.0015 * TechInvest2) * Turbines2\nOutput3 = (20 + 0.002 * TechInvest3) * Turbines3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output1 + Output2 + Output3)\n\n# Add constraints\nmodel.addCons(10000 * Turbines1 + 15000 * Turbines2 + 20000 * Turbines3 + TechInvest1 + TechInvest2 + TechInvest3 <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines of Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines of Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines of Type3: \", model.getVal(Turbines3))\n    print(\"Investment in Advanced Technology for Type1: \", model.getVal(TechInvest1))\n    print(\"Investment in Advanced Technology for Type2: \", model.getVal(TechInvest2))\n    print(\"Investment in Advanced Technology for Type3: \", model.getVal(TechInvest3))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"distance from depot to warehouse 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 6\": \"D6\", \"range\": \"D6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe transportation cost is calculated based on the number of trucks and the distance each truck travels. The cost per kilometer is $2. The company aims to minimize the total transportation cost.\n// Total_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n// So, the objective function is: Minimize Total_Cost\n// Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50\n\n## Generate Constraint-2:\nEach warehouse must have at least 2 trucks.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2; T6 >= 2\n\n## Generate Constraint-3:\nThe maximum distance a truck can travel from the depot to any warehouse is 100 km.\n// D1 <= 100; D2 <= 100; D3 <= 100; D4 <= 100; D5 <= 100; D6 <= 100\n\n## Generate Constraint-4:\nThe total distance traveled by all trucks should not exceed 2000 km.\n// T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6 <= 2000",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined. The transportation cost is calculated based on the number of trucks and the distance each truck travels, with a cost of $2 per kilometer. The company aims to minimize the total transportation cost. The total number of trucks available is 50, and each warehouse must have at least 2 trucks. The maximum distance a truck can travel from the depot to any warehouse is 100 km, and the total distance traveled by all trucks should not exceed 2000 km. Please help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=2) # number of trucks at warehouse 6\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance from depot to warehouse 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance from depot to warehouse 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance from depot to warehouse 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance from depot to warehouse 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance from depot to warehouse 5\nD6 = model.addVar(vtype=\"CONTINUOUS\", name=\"D6\", lb=0) # distance from depot to warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nTotal_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n## Each warehouse must have at least 2 trucks.\nmodel.addCons(T1 >= 2)\nmodel.addCons(T2 >= 2)\nmodel.addCons(T3 >= 2)\nmodel.addCons(T4 >= 2)\nmodel.addCons(T5 >= 2)\nmodel.addCons(T6 >= 2)\n## The maximum distance a truck can travel from the depot to any warehouse is 100 km.\nmodel.addCons(D1 <= 100)\nmodel.addCons(D2 <= 100)\nmodel.addCons(D3 <= 100)\nmodel.addCons(D4 <= 100)\nmodel.addCons(D5 <= 100)\nmodel.addCons(D6 <= 100)\n## The total distance traveled by all trucks should not exceed 2000 km.\nmodel.addCons(T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Distance from Depot to Warehouse 1: \", model.getVal(D1))\n    print(\"Distance from Depot to Warehouse 2: \", model.getVal(D2))\n    print(\"Distance from Depot to Warehouse 3: \", model.getVal(D3))\n    print(\"Distance from Depot to Warehouse 4: \", model.getVal(D4))\n    print(\"Distance from Depot to Warehouse 5: \", model.getVal(D5))\n    print(\"Distance from Depot to Warehouse 6: \", model.getVal(D6))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used\": \"RawMaterial\", \"range\": \"RawMaterial >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company wants to maximize the total profit from selling all devices.\n// Total profit: Profit = (50 * DeviceA + 70 * DeviceB + 60 * DeviceC) - (20 * LaborHours + 10 * RawMaterial)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for the quarter.\n// LaborHours <= 1000\n\n## Generate Constraint-2:\nThe production of each device requires a certain amount of labor and raw material: DeviceA requires 2 hours of labor and 3 units of raw material, DeviceB requires 4 hours of labor and 2 units of raw material, and DeviceC requires 3 hours of labor and 4 units of raw material.\n// 2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours\n// 3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial\n\n## Generate Constraint-3:\nThe company has a budget of $15,000 for labor and raw material costs for the quarter.\n// 20 * LaborHours + 10 * RawMaterial <= 15,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The following table summarizes the labor and raw material requirements for each device:\n\n| Device | Labor Hours | Raw Material Units |\n|--------|-------------|---------------------|\n| DeviceA | 2 hours     | 3 units             |\n| DeviceB | 4 hours     | 2 units             |\n| DeviceC | 3 hours     | 4 units             |\n\nThe company has a total of 1000 hours of labor available for the quarter. The company has a budget of $15,000 for labor and raw material costs for the quarter. The production of each device requires a certain amount of labor and raw material as shown in the table. \n\nPlease help the company to maximize the total profit from selling all devices, subject to the constraints on labor hours and budget for labor and raw material costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0)  # number of DeviceA produced\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0)  # number of DeviceB produced\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0)  # number of DeviceC produced\nLaborHours = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHours\", lb=0)  # number of hours of labor used\nRawMaterial = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterial\", lb=0)  # number of units of raw material used\n\n# Define objective function\nProfit = 50 * DeviceA + 70 * DeviceB + 60 * DeviceC - 20 * LaborHours - 10 * RawMaterial\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a total of 1000 hours of labor available for the quarter.\nmodel.addCons(LaborHours <= 1000)\n# The production of each device requires a certain amount of labor and raw material\nmodel.addCons(2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours)\nmodel.addCons(3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial)\n# The company has a budget of $15,000 for labor and raw material costs for the quarter.\nmodel.addCons(20 * LaborHours + 10 * RawMaterial <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceC))\n    print(\"Number of hours of labor used: \", model.getVal(LaborHours))\n    print(\"Number of units of raw material used: \", model.getVal(RawMaterial))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries.\n// {\"trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for Region1\": \"FuelBudget1\", \"range\": \"FuelBudget1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region2\": \"FuelBudget2\", \"range\": \"FuelBudget2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region3\": \"FuelBudget3\", \"range\": \"FuelBudget3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region4\": \"FuelBudget4\", \"range\": \"FuelBudget4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Region5\": \"FuelBudget5\", \"range\": \"FuelBudget5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. Specifically, the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n// FuelCost1 = (FuelBudget1 / Trucks1)^2\n// FuelCost2 = (FuelBudget2 / Trucks2)^2\n// FuelCost3 = (FuelBudget3 / Trucks3)^2\n// FuelCost4 = (FuelBudget4 / Trucks4)^2\n// FuelCost5 = (FuelBudget5 / Trucks5)^2\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring timely deliveries. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost decreases as the fuel budget increases, but at a decreasing rate due to economies of scale in fuel purchases. The company aims to minimize the total fuel cost across all regions.\n\n| Region | Fuel Cost Function |\n|--------|--------------------|\n| Region1 | (FuelBudget1 / Trucks1)^2 |\n| Region2 | (FuelBudget2 / Trucks2)^2 |\n| Region3 | (FuelBudget3 / Trucks3)^2 |\n| Region4 | (FuelBudget4 / Trucks4)^2 |\n| Region5 | (FuelBudget5 / Trucks5)^2 |\n\nThe total fuel budget across all regions must not exceed $100,000. Please help the company determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nFuelBudget1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget1\", lb=0)\nFuelBudget2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget2\", lb=0)\nFuelBudget3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget3\", lb=0)\nFuelBudget4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget4\", lb=0)\nFuelBudget5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudget5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost1 = (FuelBudget1 / Trucks1)**2\nFuelCost2 = (FuelBudget2 / Trucks2)**2\nFuelCost3 = (FuelBudget3 / Trucks3)**2\nFuelCost4 = (FuelBudget4 / Trucks4)**2\nFuelCost5 = (FuelBudget5 / Trucks5)**2\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n## The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudget1 + FuelBudget2 + FuelBudget3 + FuelBudget4 + FuelBudget5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Budget for Region1: \", model.getVal(FuelBudget1))\n    print(\"Fuel Budget for Region2: \", model.getVal(FuelBudget2))\n    print(\"Fuel Budget for Region3: \", model.getVal(FuelBudget3))\n    print(\"Fuel Budget for Region4: \", model.getVal(FuelBudget4))\n    print(\"Fuel Budget for Region5: \", model.getVal(FuelBudget5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck type varies based on the distance traveled and the load capacity. TruckA has an efficiency of 50 units per km, TruckB has 60 units per km, TruckC has 70 units per km, and TruckD has 80 units per km. The company aims to maximize the total efficiency of all trucks.\n// Total efficiency of TruckA: Efficiency_TruckA = 50 * TruckA\n// Total efficiency of TruckB: Efficiency_TruckB = 60 * TruckB\n// Total efficiency of TruckC: Efficiency_TruckC = 70 * TruckC\n// Total efficiency of TruckD: Efficiency_TruckD = 80 * TruckD\n// So, the objective function is: Maximize (Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 to purchase trucks. The cost of TruckA is $50,000, TruckB is $60,000, TruckC is $70,000, and TruckD is $80,000.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD <= 500,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of trucks cannot exceed 10.\n// TruckA + TruckB + TruckC + TruckD <= 10\n\n## Generate Constraint-3:\nThe company must have at least 2 TruckA and 1 TruckB for specific contractual obligations.\n// TruckA >= 2; TruckB >= 1\n\n## Generate Constraint-4:\nThe total number of TruckC and TruckD combined must not exceed the number of TruckA and TruckB combined.\n// TruckC + TruckD <= TruckA + TruckB\n\n## Generate Constraint-5:\nThe company aims to have at least 5 trucks in total to ensure adequate coverage of all routes.\n// TruckA + TruckB + TruckC + TruckD >= 5",
        "question": "A logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints. The efficiency of each truck type varies based on the distance traveled and the load capacity, as shown in the following Table.\n\n| Truck Type | Efficiency (units per km) |\n|------------|---------------------------|\n| TruckA     | 50                        |\n| TruckB     | 60                        |\n| TruckC     | 70                        |\n| TruckD     | 80                        |\n\nThe company has a total budget of $500,000 to purchase trucks. The cost of TruckA is $50,000, TruckB is $60,000, TruckC is $70,000, and TruckD is $80,000. Due to maintenance constraints, the total number of trucks cannot exceed 10. The company must have at least 2 TruckA and 1 TruckB for specific contractual obligations. The total number of TruckC and TruckD combined must not exceed the number of TruckA and TruckB combined. The company aims to have at least 5 trucks in total to ensure adequate coverage of all routes.\n\nPlease help the company to maximize the total efficiency of all trucks by determining the optimal number of each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)\n\n# Define objective function\nEfficiency_TruckA = 50 * TruckA\nEfficiency_TruckB = 60 * TruckB\nEfficiency_TruckC = 70 * TruckC\nEfficiency_TruckD = 80 * TruckD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n# Add constraints\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD <= 500000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 10)\nmodel.addCons(TruckA >= 2)\nmodel.addCons(TruckB >= 1)\nmodel.addCons(TruckC + TruckD <= TruckA + TruckB)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1290,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\n// {\"number of trucks for short distance routes\": \"ShortDistance\", \"range\": \"ShortDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for medium distance routes\": \"MediumDistance\", \"range\": \"MediumDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for long distance routes\": \"LongDistance\", \"range\": \"LongDistance >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company wants to maximize the net daily profit from the fleet expansion.\n// NetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\n// NetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\n// NetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n// So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the fleet expansion.\n// 500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000\n\n## Generate Constraint-2:\nThe company can only accommodate a total of 100 trucks in its current facilities.\n// ShortDistance + MediumDistance + LongDistance <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the new fleet is dedicated to long distance routes.\n// LongDistance >= 0.3 * (ShortDistance + MediumDistance + LongDistance)",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company has a budget of $100,000 for the fleet expansion. The company can only accommodate a total of 100 trucks in its current facilities. The company must ensure that at least 30% of the new fleet is dedicated to long distance routes.\nPlease help the company to maximize the net daily profit from the fleet expansion.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistance = model.addVar(vtype=\"INTEGER\", name=\"ShortDistance\", lb=0) # number of trucks for short distance routes\nMediumDistance = model.addVar(vtype=\"INTEGER\", name=\"MediumDistance\", lb=0) # number of trucks for medium distance routes\nLongDistance = model.addVar(vtype=\"INTEGER\", name=\"LongDistance\", lb=0) # number of trucks for long distance routes\n\n# Define objective function\nNetProfit_Short = (1000 - 500) * ShortDistance\nNetProfit_Medium = (1500 - 800) * MediumDistance\nNetProfit_Long = (2000 - 1200) * LongDistance\n# So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n# Add constraints\n# The company has a budget of $100,000 for the fleet expansion.\nmodel.addCons(500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000)\n# The company can only accommodate a total of 100 trucks in its current facilities.\nmodel.addCons(ShortDistance + MediumDistance + LongDistance <= 100)\n# The company must ensure that at least 30% of the new fleet is dedicated to long distance routes.\nmodel.addCons(LongDistance >= 0.3 * (ShortDistance + MediumDistance + LongDistance))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Short Distance Routes: \", model.getVal(ShortDistance))\n    print(\"Number of Trucks for Medium Distance Routes: \", model.getVal(MediumDistance))\n    print(\"Number of Trucks for Long Distance Routes: \", model.getVal(LongDistance))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient upgrades for their production lines, which will reduce the energy cost per unit produced for each product.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for product A\": \"EnergyEfficiencyA\", \"range\": \"EnergyEfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product B\": \"EnergyEfficiencyB\", \"range\": \"EnergyEfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product C\": \"EnergyEfficiencyC\", \"range\": \"EnergyEfficiencyC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for product D\": \"EnergyEfficiencyD\", \"range\": \"EnergyEfficiencyD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit for product A is $50, for product B is $60, for product C is $70, and for product D is $80. The selling price per unit is $100 for product A, $120 for product B, $140 for product C, and $160 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\n// Total profit for product B: ProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\n// Total profit for product C: ProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\n// Total profit for product D: ProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for energy efficiency upgrades.\n// EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 10,000 units.\n// A + B + C + D <= 10000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and the investment in energy-efficient upgrades for their production lines. The energy cost per unit for each product decreases by $2 for every $10,000 invested in energy efficiency upgrades for that product. The initial energy cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Energy Cost per Unit | Selling Price per Unit |\n|---------|------------------------------|------------------------|\n| A       | $50                          | $100                   |\n| B       | $60                          | $120                   |\n| C       | $70                          | $140                   |\n| D       | $80                          | $160                   |\n\nThe company has a total budget of $100,000 for energy efficiency upgrades. The total production capacity for the next quarter is 10,000 units. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantity for each product and the investment in energy efficiency upgrades to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nEnergyEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyA\", lb=0) # investment in energy efficiency for product A\nEnergyEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyB\", lb=0) # investment in energy efficiency for product B\nEnergyEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyC\", lb=0) # investment in energy efficiency for product C\nEnergyEfficiencyD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiencyD\", lb=0) # investment in energy efficiency for product D\n\n# Define objective function\nProfitA = (100 - 50 + 0.0002 * EnergyEfficiencyA) * A\nProfitB = (120 - 60 + 0.0002 * EnergyEfficiencyB) * B\nProfitC = (140 - 70 + 0.0002 * EnergyEfficiencyC) * C\nProfitD = (160 - 80 + 0.0002 * EnergyEfficiencyD) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $100,000 for energy efficiency upgrades.\nmodel.addCons(EnergyEfficiencyA + EnergyEfficiencyB + EnergyEfficiencyC + EnergyEfficiencyD <= 100000)\n# The total production capacity for the next quarter is 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Investment in Energy Efficiency for Product A: \", model.getVal(EnergyEfficiencyA))\n    print(\"Investment in Energy Efficiency for Product B: \", model.getVal(EnergyEfficiencyB))\n    print(\"Investment in Energy Efficiency for Product C: \", model.getVal(EnergyEfficiencyC))\n    print(\"Investment in Energy Efficiency for Product D: \", model.getVal(EnergyEfficiencyD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1270,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering the cost of operation and maintenance. Additionally, the company needs to decide on the fuel efficiency upgrades for each type of vehicle to further enhance their operational efficiency.\n// {\"number of Trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"VanCount\", \"range\": \"VanCount >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"BikeCount\", \"range\": \"BikeCount >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Trucks\": \"TruckUpgrade\", \"range\": \"TruckUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Vans\": \"VanUpgrade\", \"range\": \"VanUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Bikes\": \"BikeUpgrade\", \"range\": \"BikeUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per vehicle decreases with the investment in fuel efficiency upgrades. For Trucks, the operational cost per mile is $0.50 without upgrades, decreasing by $0.01 for every $100 invested in upgrades. For Vans, the operational cost per mile is $0.30, decreasing by $0.008 for every $100 invested in upgrades. For Bikes, the operational cost per mile is $0.10, decreasing by $0.005 for every $100 invested in upgrades. The company aims to minimize the total operational cost per day.\n// Total operational cost for Trucks: CostTruck = 0.50 - 0.0001 * TruckUpgrade * TruckCount\n// Total operational cost for Vans: CostVan = 0.30 - 0.00008 * VanUpgrade * VanCount\n// Total operational cost for Bikes: CostBike = 0.10 - 0.00005 * BikeUpgrade * BikeCount\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades and vehicle purchases.\n// TruckUpgrade * TruckCount + VanUpgrade * VanCount + BikeUpgrade * BikeCount <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100 due to parking and operational limitations.\n// TruckCount + VanCount + BikeCount <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle and the appropriate fuel efficiency upgrades to maximize operational efficiency while considering the cost of operation and maintenance. For Trucks, the operational cost per mile is $0.50 without upgrades, decreasing by $0.01 for every $100 invested in upgrades. For Vans, the operational cost per mile is $0.30, decreasing by $0.008 for every $100 invested in upgrades. For Bikes, the operational cost per mile is $0.10, decreasing by $0.005 for every $100 invested in upgrades. The company has a budget of $10,000 for fuel efficiency upgrades and vehicle purchases. The total number of vehicles cannot exceed 100 due to parking and operational limitations. The company aims to minimize the total operational cost per day. Please help the company to determine the optimal number of each type of vehicle and the appropriate fuel efficiency upgrades.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of Trucks\nVanCount = model.addVar(vtype=\"INTEGER\", name=\"VanCount\", lb=0)  # number of Vans\nBikeCount = model.addVar(vtype=\"INTEGER\", name=\"BikeCount\", lb=0)  # number of Bikes\nTruckUpgrade = model.addVar(name=\"TruckUpgrade\", lb=0)  # fuel efficiency upgrade for Trucks\nVanUpgrade = model.addVar(name=\"VanUpgrade\", lb=0)  # fuel efficiency upgrade for Vans\nBikeUpgrade = model.addVar(name=\"BikeUpgrade\", lb=0)  # fuel efficiency upgrade for Bikes\n\n# Define objective function\nCostTruck = (0.50 - 0.0001 * TruckUpgrade) * TruckCount\nCostVan = (0.30 - 0.00008 * VanUpgrade) * VanCount\nCostBike = (0.10 - 0.00005 * BikeUpgrade) * BikeCount\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\nmodel.addCons(TruckUpgrade * TruckCount + VanUpgrade * VanCount + BikeUpgrade * BikeCount <= 10000)\nmodel.addCons(TruckCount + VanCount + BikeCount <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Number of Vans: \", model.getVal(VanCount))\n    print(\"Number of Bikes: \", model.getVal(BikeCount))\n    print(\"Truck Upgrade: \", model.getVal(TruckUpgrade))\n    print(\"Van Upgrade: \", model.getVal(VanUpgrade))\n    print(\"Bike Upgrade: \", model.getVal(BikeUpgrade))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route 1 consumes 10 liters of fuel per hour and delivers 50 units of goods per hour.\nEach truck on route 2 consumes 15 liters of fuel per hour and delivers 60 units of goods per hour.\nEach truck on route 3 consumes 20 liters of fuel per hour and delivers 70 units of goods per hour.\nEach truck on route 4 consumes 25 liters of fuel per hour and delivers 80 units of goods per hour.\nEach truck on route 5 consumes 30 liters of fuel per hour and delivers 90 units of goods per hour.\nEach truck on route 6 consumes 35 liters of fuel per hour and delivers 100 units of goods per hour.\nThe company aims to minimize the total fuel consumption while ensuring all goods are delivered within 8 hours.\n// The total fuel consumption: F = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 + 35 * T6\n// The total goods delivered: G = 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6\n// The delivery time constraint: G >= 8 * (50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6)\n// So, the objective function is: Minimize F\n// Minimize (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 + 35 * T6)\n\n## Generate Constraint-1:\nThere are a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle up to 20 trucks at a time.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe total goods delivered must meet or exceed the required delivery within 8 hours.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 >= 8 * (50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6)",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. Each truck on route 1 consumes 10 liters of fuel per hour and delivers 50 units of goods per hour. Each truck on route 2 consumes 15 liters of fuel per hour and delivers 60 units of goods per hour. Each truck on route 3 consumes 20 liters of fuel per hour and delivers 70 units of goods per hour. Each truck on route 4 consumes 25 liters of fuel per hour and delivers 80 units of goods per hour. Each truck on route 5 consumes 30 liters of fuel per hour and delivers 90 units of goods per hour. Each truck on route 6 consumes 35 liters of fuel per hour and delivers 100 units of goods per hour. The company aims to minimize the total fuel consumption while ensuring all goods are delivered within 8 hours. There are a total of 100 trucks available. Each route can handle up to 20 trucks at a time. The total goods delivered must meet or exceed the required delivery within 8 hours. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks on route 6\n\n# Define objective function\n## The total fuel consumption: F = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 + 35 * T6\nF = 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 + 35 * T6\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize F\nmodel.addCons(obj == F)\n\n# Add constraints\n## There are a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each route can handle up to 20 trucks at a time.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n## The total goods delivered must meet or exceed the required delivery within 8 hours.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6 >= 8 * (50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 + 100 * T6))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1141,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5.\nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4.\nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3.\nThe manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_E1 = 30000 * E1 - 20000 * E1\n// NetRevenue_E2 = 40000 * E2 - 25000 * E2\n// NetRevenue_E3 = 50000 * E3 - 30000 * E3\n// So, the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / (5 * E1 + 4 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a limited production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50\n\n## Generate Constraint-3:\nThe market demand for E1 is 20 vehicles. So, the manufacturer can only sell a maximum of 20 units of E1.\n// E1 <= 20",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. For E1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5. For E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4. For E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3. The manufacturer wants to maximize the net revenue while considering the environmental impact. The objective is to maximize the net revenue per environmental impact score. The manufacturer has a total production budget of $1,000,000. The manufacturer has a limited production capacity of 50 vehicles. The market demand for E1 is 20 vehicles. So, the manufacturer can only sell a maximum of 20 units of E1. Please help the manufacturer to determine the optimal production quantities of E1, E2, and E3 to achieve their objective.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=20) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_E1 = 30000 * E1 - 20000 * E1\nNetRevenue_E2 = 40000 * E2 - 25000 * E2\nNetRevenue_E3 = 50000 * E3 - 30000 * E3\nEnvironmentalImpact = 5 * E1 + 4 * E2 + 3 * E3\n## the objective function is: Maximize (NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_E1 + NetRevenue_E2 + NetRevenue_E3)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1000000)\n## The manufacturer has a limited production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Environmental Impact Score: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the average daily energy production per panel is 1.5 kWh, the installation cost per panel is $500, and the maintenance cost per panel is $50 per year.\nFor D2, the average daily energy production per panel is 1.2 kWh, the installation cost per panel is $450, and the maintenance cost per panel is $45 per year.\nFor D3, the average daily energy production per panel is 1.8 kWh, the installation cost per panel is $550, and the maintenance cost per panel is $55 per year.\nFor D4, the average daily energy production per panel is 1.6 kWh, the installation cost per panel is $600, and the maintenance cost per panel is $60 per year.\nFor D5, the average daily energy production per panel is 1.4 kWh, the installation cost per panel is $400, and the maintenance cost per panel is $40 per year.\nThe city wants to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost.\n// Total annual energy production: Energy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\n// Total annual maintenance cost: Maintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\n// Total installation cost: Installation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n// So, the objective function is: Maximize (Energy - Maintenance) / Installation\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all districts is limited to 200.\n// D1 + D2 + D3 + D4 + D5 <= 200\n\n## Generate Constraint-3:\nThe city requires that at least 20% of the total budget be spent on solar panels in D1.\n// 500 * D1 >= 0.2 * 100000\n\n## Generate Constraint-4:\nThe city wants to ensure that no more than 30% of the total number of panels are installed in any single district.\n// D1 <= 0.3 * 200\n// D2 <= 0.3 * 200\n// D3 <= 0.3 * 200\n// D4 <= 0.3 * 200\n// D5 <= 0.3 * 200",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed. The average daily energy production per panel, installation cost per panel, and maintenance cost per panel for each district are given in the following Table.\n\n| District | Average Daily Energy Production (kWh) | Installation Cost per Panel ($) | Maintenance Cost per Panel per Year ($) |\n|----------|---------------------------------------|---------------------------------|----------------------------------------|\n| D1       | 1.5                                   | 500                             | 50                                     |\n| D2       | 1.2                                   | 450                             | 45                                     |\n| D3       | 1.8                                   | 550                             | 55                                     |\n| D4       | 1.6                                   | 600                             | 60                                     |\n| D5       | 1.4                                   | 400                             | 40                                     |\n\nThe city has a budget of $100,000 for the installation of solar panels. The total number of solar panels that can be installed across all districts is limited to 200. The city requires that at least 20% of the total budget be spent on solar panels in D1. The city wants to ensure that no more than 30% of the total number of panels are installed in any single district.\n\nPlease help the city to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\nEnergy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\nMaintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\nInstallation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy - Maintenance) / Installation\n# convert the division to multiplication\nmodel.addCons(obj * Installation == Energy - Maintenance)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000)\n# The total number of solar panels that can be installed across all districts is limited to 200.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 200)\n# The city requires that at least 20% of the total budget be spent on solar panels in D1.\nmodel.addCons(500 * D1 >= 0.2 * 100000)\n# The city wants to ensure that no more than 30% of the total number of panels are installed in any single district.\nmodel.addCons(D1 <= 0.3 * 200)\nmodel.addCons(D2 <= 0.3 * 200)\nmodel.addCons(D3 <= 0.3 * 200)\nmodel.addCons(D4 <= 0.3 * 200)\nmodel.addCons(D5 <= 0.3 * 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Net Energy Yield per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1852,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost.\n// The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n// Minimize (0.05 * T1^2 + 0.07 * T2^2 + 0.06 * T3^2 + 0.08 * T4^2 + 0.04 * T5^2 + 0.09 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe minimum number of trucks required at each warehouse to maintain service level is 5.\n// T1 >= 5; T2 >= 5; T3 >= 5; T4 >= 5; T5 >= 5; T6 >= 5",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company has a total of 100 trucks available. Each warehouse can handle a maximum of 20 trucks, and the minimum number of trucks required at each warehouse to maintain service level is 5.\nPlease help the company to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The minimum number of trucks required at each warehouse to maintain service level is 5.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=5) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=5) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=5) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=5) # number of trucks at warehouse 6\n\n# Define objective function\n## The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1**2\nCost_2 = 0.07 * T2**2\nCost_3 = 0.06 * T3**2\nCost_4 = 0.08 * T4**2\nCost_5 = 0.04 * T5**2\nCost_6 = 0.09 * T6**2\n## The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each warehouse can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Small wind farms\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Medium wind farms\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Large wind farms\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each wind farm type increases with the level of maintenance investment. For Small wind farms, the efficiency increases by 0.1% for every $1,000 invested. For Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested. For Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms.\n// EnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\n// EnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\n// EnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n// So, the objective function is: Maximize (EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both construction and maintenance investments.\n// 100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000\n\n## Generate Constraint-2:\nThe total land available for wind farm construction is limited to 10 farms.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency. The energy production efficiency of each wind farm type increases with the level of maintenance investment. For Small wind farms, the efficiency increases by 0.1% for every $1,000 invested. For Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested. For Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms. The company has a total budget of $1,000,000 for both construction and maintenance investments. The total land available for wind farm construction is limited to 10 farms. Please help the company to determine the optimal number of each type of wind farm and the corresponding maintenance investments to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)  # number of Small wind farms\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)  # number of Medium wind farms\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)  # number of Large wind farms\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)  # maintenance investment for Small wind farms\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)  # maintenance investment for Medium wind farms\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)  # maintenance investment for Large wind farms\n\n# Define objective function\nEnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\nEnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\nEnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n# So, the objective function is: Maximize (EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both construction and maintenance investments.\nmodel.addCons(100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000)\n# The total land available for wind farm construction is limited to 10 farms.\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Maintenance Investment for Small Wind Farms: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Investment for Medium Wind Farms: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Investment for Large Wind Farms: \", model.getVal(MaintenanceLarge))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product. Additionally, the company is considering investing in a new technology that can reduce the production time per unit, but at a cost. The variables include the number of units of each product and the investment in the new technology.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit for ProductA is 5 hours, for ProductB is 7 hours, and for ProductC is 9 hours. The new technology reduces the production time per unit by 0.1 hours for every $1000 invested. The revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The company aims to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// Production time cost for ProductA: TimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\n// Production time cost for ProductB: TimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\n// Production time cost for ProductC: TimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours.\n// (5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// UnitsA >= 50; UnitsB >= 30\n\n## Generate Constraint-4:\nThe total number of units produced should not exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and consider investing in a new technology that can reduce the production time per unit, but at a cost. The production time per unit for ProductA is 5 hours, for ProductB is 7 hours, and for ProductC is 9 hours. The new technology reduces the production time per unit by 0.1 hours for every $1000 invested. The revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The company aims to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n\nThe company has a total production capacity of 1000 hours. The total investment in the new technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 30 units of ProductB. The total number of units produced should not exceed 1000.\n\nPlease help the company to maximize the total revenue minus the production time cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)   # number of units of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\nTimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\nTimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\nTimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n# So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours.\nmodel.addCons((5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000)\n# The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n# The company must produce at least 50 units of ProductA and 30 units of ProductB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 30)\n# The total number of units produced should not exceed 1000.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EffA\", \"range\": \"EffA >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"EffB\", \"range\": \"EffB >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"EffC\", \"range\": \"EffC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, which decreases by $1 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductB is $150, which decreases by $1.5 for every $1000 invested in efficiency enhancements. The production cost per unit of ProductC is $200, which decreases by $2 for every $1000 invested in efficiency enhancements. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - 100 + 0.001 * EffA) * QA\n// ProfitB = (200 - 150 + 0.0015 * EffB) * QB\n// ProfitC = (250 - 200 + 0.002 * EffC) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// EffA + EffB + EffC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QA + QB + QC <= 5000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA.\n// QA <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement reduces the production cost per unit. The production cost per unit, selling price per unit, and the efficiency impact for each product are given in the following Table.\n\n| Product | Production Cost Per Unit | Selling Price Per Unit | Efficiency Impact (Cost Reduction per $1000 Investment) |\n|---------|--------------------------|------------------------|------------------------------------------------------|\n| ProductA | $100                     | $150                   | $1                                                  |\n| ProductB | $150                     | $200                   | $1.5                                                |\n| ProductC | $200                     | $250                   | $2                                                  |\n\nThe company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. The market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA. \nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nEffA = model.addVar(vtype=\"CONTINUOUS\", name=\"EffA\", lb=0) # investment in efficiency for ProductA\nEffB = model.addVar(vtype=\"CONTINUOUS\", name=\"EffB\", lb=0) # investment in efficiency for ProductB\nEffC = model.addVar(vtype=\"CONTINUOUS\", name=\"EffC\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.001 * EffA) * QA\nProfitB = (200 - 150 + 0.0015 * EffB) * QB\nProfitC = (250 - 200 + 0.002 * EffC) * QC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total budget of $100,000 for efficiency enhancements.\nmodel.addCons(EffA + EffB + EffC <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QA + QB + QC <= 5000)\n# The market demand for ProductA is 1000 units. So, the company can only sell a maximum of 1000 units of ProductA.\nmodel.addCons(QA <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EffA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EffB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EffC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1373,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\n// {\"number of trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"fuel-efficient upgrades per truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"maintenance frequency\": \"MaintenanceFreq\", \"range\": \"MaintenanceFreq >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\n// FuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount^2\n// MaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq^2 * TruckCount\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\n// FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\nPlease help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=0)  # number of trucks\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0)  # fuel-efficient upgrades per truck\nMaintenanceFreq = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceFreq\", lb=0)  # maintenance frequency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount**2\nMaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq**2 * TruckCount\n## the objective function is: Minimize (FuelCost + MaintenanceCost)\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\nmodel.addCons(FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Fuel-efficient Upgrades per Truck: \", model.getVal(FuelUpgrade))\n    print(\"Maintenance Frequency: \", model.getVal(MaintenanceFreq))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of workers for smartphones production\": \"WorkersSmartphones\", \"range\": \"WorkersSmartphones >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets production\": \"WorkersTablets\", \"range\": \"WorkersTablets >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops production\": \"WorkersLaptops\", \"range\": \"WorkersLaptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit.\n// Profit_Smartphones = 10 * WorkersSmartphones * 100\n// Profit_Tablets = 5 * WorkersTablets * 150\n// Profit_Laptops = 2 * WorkersLaptops * 200\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe firm has a total of 50 workers available.\n// WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50",
        "question": "A manufacturing firm produces three types of electronic devices: smartphones, tablets, and laptops. The firm needs to decide on the production quantities for each device type and the number of workers dedicated to each production line to optimize its profit while considering various constraints such as labor availability, production capacity, and budget for raw materials. The profit per smartphone is $100, per tablet is $150, and per laptop is $200. The production rate per worker per day is 10 smartphones, 5 tablets, and 2 laptops. The firm aims to maximize its daily profit. The firm has a total of 50 workers available.\nPlease help the firm determine the optimal number of smartphones, tablets, and laptops to produce, and the number of workers to allocate to each production line to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # number of smartphones produced\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # number of tablets produced\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # number of laptops produced\nWorkersSmartphones = model.addVar(vtype=\"INTEGER\", name=\"WorkersSmartphones\", lb=0)  # number of workers for smartphones production\nWorkersTablets = model.addVar(vtype=\"INTEGER\", name=\"WorkersTablets\", lb=0)  # number of workers for tablets production\nWorkersLaptops = model.addVar(vtype=\"INTEGER\", name=\"WorkersLaptops\", lb=0)  # number of workers for laptops production\n\n# Define objective function\nProfit_Smartphones = 10 * WorkersSmartphones * 100\nProfit_Tablets = 5 * WorkersTablets * 150\nProfit_Laptops = 2 * WorkersLaptops * 200\n# So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The firm has a total of 50 workers available.\nmodel.addCons(WorkersSmartphones + WorkersTablets + WorkersLaptops <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Workers for Smartphones: \", model.getVal(WorkersSmartphones))\n    print(\"Number of Workers for Tablets: \", model.getVal(WorkersTablets))\n    print(\"Number of Workers for Laptops: \", model.getVal(WorkersLaptops))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation technology cannot exceed $50,000.\n// IA <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The profit per unit and the initial production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Initial Production Cost per Unit |\n|---------|-----------------|---------------------------------|\n| ProductA | $100            | $60                             |\n| ProductB | $150            | $80                             |\n| ProductC | $200            | $100                            |\n\nThe production cost per unit decreases by $5 for every $1000 invested in automation technology. The total resources available for production are limited to 1000 units. The investment in automation technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30) # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # resources allocated to ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0, ub=50000) # investment in automation technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n## Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n## Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\nProfitA = (100 - 60 + 0.005 * IA) * QA\nProfitB = (150 - 80 + 0.005 * IA) * QB\nProfitC = (200 - 100 + 0.005 * IA) * QC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total resources available for production are limited to 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n## The investment in automation technology cannot exceed $50,000.\nmodel.addCons(IA <= 50000)\n## The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\nmodel.addCons(QA <= 50)\nmodel.addCons(QC <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Automation Technology: \", model.getVal(IA))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1186,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of component C1, with only 500 units available.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 500\n\n## Generate Constraint-2:\nThe supply of component C2 is also limited, with only 200 units available.\n// Q2 + 2 * Q3 <= 200",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints. The profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer has a limited supply of component C1, with only 500 units available, and the supply of component C2 is also limited, with only 200 units available. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n# The manufacturer has a limited supply of component C1, with only 500 units available.\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 500)\n# The supply of component C2 is also limited, with only 200 units available.\nmodel.addCons(Q2 + 2 * Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 690,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter, Truck B has a fuel efficiency of 8 km/liter, and Truck C has a fuel efficiency of 10 km/liter. The company wants to maximize the total distance covered per liter of fuel.\n// FuelEfficiency_A = 5 * TruckA\n// FuelEfficiency_B = 8 * TruckB\n// FuelEfficiency_C = 10 * TruckC\n// So, the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / (TruckA + TruckB + TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000\n\n## Generate Constraint-2:\nThe total weight capacity of all trucks must not exceed 50,000 kg. Truck A can carry 5,000 kg, Truck B can carry 8,000 kg, and Truck C can carry 10,000 kg.\n// 5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000\n\n## Generate Constraint-3:\nThe company must fulfill a delivery demand of at least 100,000 km. Each Truck A can cover 50,000 km, Truck B can cover 80,000 km, and Truck C can cover 100,000 km.\n// 50000 * TruckA + 80000 * TruckB + 100000 * TruckC >= 100000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities, fuel efficiencies, and costs. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands. The details of each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Cost (USD) | Weight Capacity (kg) | Distance Covered (km) |\n|------------|---------------------------|------------|----------------------|----------------------|\n| A          | 5                         | 20,000     | 5,000                | 50,000                |\n| B          | 8                         | 30,000     | 8,000                | 80,000                |\n| C          | 10                        | 40,000     | 10,000               | 100,000               |\n\nThe company has a total budget of $100,000 for purchasing trucks. The total weight capacity of all trucks must not exceed 50,000 kg. The company must fulfill a delivery demand of at least 100,000 km. \n\nPlease help the company to maximize the total distance covered per liter of fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuelEfficiency_A = 5 * TruckA\nFuelEfficiency_B = 8 * TruckB\nFuelEfficiency_C = 10 * TruckC\nTotalTrucks = TruckA + TruckB + TruckC\n## the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000)\n## The total weight capacity of all trucks must not exceed 50,000 kg.\nmodel.addCons(5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000)\n## The company must fulfill a delivery demand of at least 100,000 km.\nmodel.addCons(50000 * TruckA + 80000 * TruckB + 100000 * TruckC >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Fuel Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $50,000, and a large truck is $80,000. The fuel efficiency of a small truck is 10 miles per gallon, a medium truck is 15 miles per gallon, and a large truck is 20 miles per gallon. The company wants to minimize the total cost of purchasing trucks and fuel expenses per year, given that each truck travels an average of 50,000 miles per year.\n// Cost_SmallTrucks = 30000 * SmallTrucks\n// Cost_MediumTrucks = 50000 * MediumTrucks\n// Cost_LargeTrucks = 80000 * LargeTrucks\n// Fuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\n// Fuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\n// Fuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n// So, the objective function is: Minimize (Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost, capacity, and fuel efficiency of each type of truck vary. The details of each type of truck are given in the following Table.\n\n| Type of Truck | Cost | Fuel Efficiency |\n|---------------|------|-----------------|\n| Small         | $30,000 | 10 miles per gallon |\n| Medium        | $50,000 | 15 miles per gallon |\n| Large         | $80,000 | 20 miles per gallon |\n\nEach truck travels an average of 50,000 miles per year. The company has a total budget of $1,000,000 for purchasing trucks.\n\nPlease help the company to minimize the total cost of purchasing trucks and fuel expenses per year.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nCost_SmallTrucks = 30000 * SmallTrucks\nCost_MediumTrucks = 50000 * MediumTrucks\nCost_LargeTrucks = 80000 * LargeTrucks\nFuel_Cost_SmallTrucks = (50000 * SmallTrucks) / 10 * 3\nFuel_Cost_MediumTrucks = (50000 * MediumTrucks) / 15 * 3\nFuel_Cost_LargeTrucks = (50000 * LargeTrucks) / 20 * 3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_SmallTrucks + Cost_MediumTrucks + Cost_LargeTrucks + Fuel_Cost_SmallTrucks + Fuel_Cost_MediumTrucks + Fuel_Cost_LargeTrucks)\n\n# Add constraints\nmodel.addCons(30000 * SmallTrucks + 50000 * MediumTrucks + 80000 * LargeTrucks <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost function is given by: Cost = a * (FuelBudget)^(-b) + c, and a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n\nThe total fuel budget across all regions must not exceed $100,000. Please help the company determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=0)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=0)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=0)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=0)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=0)\nFuelBudgetNorth = model.addVar(name=\"FuelBudgetNorth\", lb=0)\nFuelBudgetSouth = model.addVar(name=\"FuelBudgetSouth\", lb=0)\nFuelBudgetEast = model.addVar(name=\"FuelBudgetEast\", lb=0)\nFuelBudgetWest = model.addVar(name=\"FuelBudgetWest\", lb=0)\nFuelBudgetCentral = model.addVar(name=\"FuelBudgetCentral\", lb=0)\n\n# Define objective function\n# Set constants for the fuel cost function\na_North, b_North, c_North = 100, 0.5, 5\na_South, b_South, c_South = 120, 0.4, 6\na_East, b_East, c_East = 110, 0.6, 7\na_West, b_West, c_West = 90, 0.7, 8\na_Central, b_Central, c_Central = 80, 0.8, 9\n\n# Calculate fuel costs\nFuelCostNorth = a_North * (FuelBudgetNorth**(-b_North)) + c_North\nFuelCostSouth = a_South * (FuelBudgetSouth**(-b_South)) + c_South\nFuelCostEast = a_East * (FuelBudgetEast**(-b_East)) + c_East\nFuelCostWest = a_West * (FuelBudgetWest**(-b_West)) + c_West\nFuelCostCentral = a_Central * (FuelBudgetCentral**(-b_Central)) + c_Central\n\n# Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Add constraints\n# The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget in North: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget in South: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget in East: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget in West: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget in Central: \", model.getVal(FuelBudgetCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region1\": \"FuelEfficiencyRegion1\", \"range\": \"FuelEfficiencyRegion1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region2\": \"FuelEfficiencyRegion2\", \"range\": \"FuelEfficiencyRegion2 > 0\", \"type\": \"real\"}\n// {\"fuel cost per gallon\": \"FuelCost\", \"range\": \"FuelCost > 0\", \"type\": \"real\"}\n// {\"distance traveled per truck per day for Region1\": \"DistanceRegion1\", \"range\": \"DistanceRegion1 > 0\", \"type\": \"real\"}\n// {\"distance traveled per truck per day for Region2\": \"DistanceRegion2\", \"range\": \"DistanceRegion2 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel cost. The fuel cost is calculated based on the distance traveled by each truck and the fuel efficiency of the trucks.\n// FuelCost_Region1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiencyRegion1 * FuelCost\n// FuelCost_Region2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiencyRegion2 * FuelCost\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-2:\nThe company must meet a minimum daily transportation demand of 1000 miles for Region1 and 1500 miles for Region2.\n// TrucksRegion1 * DistanceRegion1 >= 1000\n// TrucksRegion2 * DistanceRegion2 >= 1500",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region. The following table summarizes the relevant parameters:\n\n| Parameter                          | Region1 | Region2 |\n|------------------------------------|---------|---------|\n| Number of Trucks                   | TrucksRegion1 | TrucksRegion2 |\n| Fuel Efficiency (miles per gallon) | FuelEfficiencyRegion1 | FuelEfficiencyRegion2 |\n| Distance Traveled per Truck per Day (miles) | DistanceRegion1 | DistanceRegion2 |\n\nThe company aims to minimize the total daily fuel cost, which is calculated based on the distance traveled by each truck and the fuel efficiency of the trucks. The total number of trucks available in the fleet is limited to 50. The company must meet a minimum daily transportation demand of 1000 miles for Region1 and 1500 miles for Region2.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies to minimize the total daily fuel cost while meeting the transportation demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region2\nFuelEfficiencyRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion1\", lb=0)  # fuel efficiency of trucks for Region1\nFuelEfficiencyRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyRegion2\", lb=0)  # fuel efficiency of trucks for Region2\nFuelCost = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelCost\", lb=0)  # fuel cost per gallon\nDistanceRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion1\", lb=0)  # distance traveled per truck per day for Region1\nDistanceRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion2\", lb=0)  # distance traveled per truck per day for Region2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiencyRegion1 * FuelCost\nFuelCost_Region2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiencyRegion2 * FuelCost\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The company must meet a minimum daily transportation demand of 1000 miles for Region1 and 1500 miles for Region2.\nmodel.addCons(TrucksRegion1 * DistanceRegion1 >= 1000)\nmodel.addCons(TrucksRegion2 * DistanceRegion2 >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region1: \", model.getVal(FuelEfficiencyRegion1))\n    print(\"Fuel Efficiency for Region2: \", model.getVal(FuelEfficiencyRegion2))\n    print(\"Fuel Cost per Gallon: \", model.getVal(FuelCost))\n    print(\"Distance Traveled per Truck per Day for Region1: \", model.getVal(DistanceRegion1))\n    print(\"Distance Traveled per Truck per Day for Region2: \", model.getVal(DistanceRegion2))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The production of each product requires a specific amount of raw materials and labor hours.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit from the sales of all products.\n// Profit_ProductA = ProductA * (50 - 20)\n// Profit_ProductB = ProductB * (70 - 30)\n// Profit_ProductC = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55.\n// 50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours.\n// 8 * ProductA + 10 * ProductB + 9 * ProductC <= 800\n\n## Generate Constraint-3:\nMarket demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units.\n// ProductA <= 50\n// ProductB <= 60\n// ProductC <= 70\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, ensuring that the ratio of Product B to Product A does not exceed 1.5, and the ratio of Product C to Product A does not exceed 1.2.\n// ProductB / ProductA <= 1.5\n// ProductC / ProductA <= 1.2",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit, considering the cost of production, market demand, and resource constraints. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The cost of production per unit of Product A is $20, Product B is $30, and Product C is $25. The company has a total budget of $5000 for raw materials. Each unit of Product A requires $50 of raw materials, Product B requires $60, and Product C requires $55. The company has a total of 800 labor hours available. Each unit of Product A requires 8 labor hours, Product B requires 10 hours, and Product C requires 9 hours. Market demand limits the production of Product A to at most 50 units, Product B to at most 60 units, and Product C to at most 70 units. The company aims to maintain a balanced production, ensuring that the ratio of Product B to Product A does not exceed 1.5, and the ratio of Product C to Product A does not exceed 1.2. Please help the company to maximize the total profit from the sales of all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_ProductA = ProductA * (50 - 20)\nProfit_ProductB = ProductB * (70 - 30)\nProfit_ProductC = ProductC * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# Constraint-1: Raw materials budget\nmodel.addCons(50 * ProductA + 60 * ProductB + 55 * ProductC <= 5000)\n# Constraint-2: Labor hours\nmodel.addCons(8 * ProductA + 10 * ProductB + 9 * ProductC <= 800)\n# Constraint-3: Market demand\nmodel.addCons(ProductA <= 50)\nmodel.addCons(ProductB <= 60)\nmodel.addCons(ProductC <= 70)\n# Constraint-4: Balanced production ratios\nmodel.addCons(ProductB <= 1.5 * ProductA)\nmodel.addCons(ProductC <= 1.2 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit while considering various constraints related to production capacity, market demand, and resource availability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. The company aims to maximize its total profit. However, due to market saturation, the profit per unit decreases nonlinearly with the increase in production. The profit reduction rate is 0.1% for each additional unit produced for all products.\n// Profit_A = 50 * A * (1 - 0.001 * A)\n// Profit_B = 70 * B * (1 - 0.001 * B)\n// Profit_C = 90 * C * (1 - 0.001 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the production of product B to at most 300 units per month.\n// B <= 300\n\n## Generate Constraint-4:\nThe production of product C is constrained by the availability of a specialized machine, which can produce at most 400 units per month.\n// C <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units to produce for each product to optimize its profit while considering various constraints related to production capacity, market demand, and resource availability. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, due to market saturation, the profit per unit decreases nonlinearly with the increase in production. The profit reduction rate is 0.1% for each additional unit produced for all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 90$             |\n\nThe company has a total production capacity of 1000 units per month. The market demand for product A is at least 200 units per month. The company has a limited budget for raw materials, which restricts the production of product B to at most 300 units per month. The production of product C is constrained by the availability of a specialized machine, which can produce at most 400 units per month.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with non-linearity\nProfit_A = 50 * A * (1 - 0.001 * A)\nProfit_B = 70 * B * (1 - 0.001 * B)\nProfit_C = 90 * C * (1 - 0.001 * C)\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at least 200 units per month.\nmodel.addCons(A >= 200)\n## The company has a limited budget for raw materials, which restricts the production of product B to at most 300 units per month.\nmodel.addCons(B <= 300)\n## The production of product C is constrained by the availability of a specialized machine, which can produce at most 400 units per month.\nmodel.addCons(C <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\n// Profit_D1 = 100 * D1\n// Profit_D2 = 150 * D2\n// Profit_D3 = 200 * D3\n// The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 500 units available.\n// 2 * D1 + 3 * D2 + 4 * D3 <= 500\n\n## Generate Constraint-2:\nThe supply of material N is also limited, with only 200 units available.\n// D2 + 2 * D3 <= 200",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer has a limited supply of material M, with only 500 units available, and the supply of material N is also limited, with only 200 units available. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 100 * D1\nProfit_D2 = 150 * D2\nProfit_D3 = 200 * D3\n# The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited supply of material M, with only 500 units available.\nmodel.addCons(2 * D1 + 3 * D2 + 4 * D3 <= 500)\n# The supply of material N is also limited, with only 200 units available.\nmodel.addCons(D2 + 2 * D3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to regional regulations, the company must deploy at least 50 trucks in Region1 and 100 trucks in Region2.\n// Trucks1 >= 50; Trucks2 >= 100\n\n## Generate Constraint-4:\nThe fuel optimization for each region must not exceed 50% to ensure safety and compliance with environmental standards.\n// FuelOpt1 <= 0.5; FuelOpt2 <= 0.5; FuelOpt3 <= 0.5",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck decreases non-linearly with the amount of fuel optimization, specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n\n| Region | Number of Trucks | Fuel Optimization |\n|--------|------------------|-------------------|\n| Region1 | Trucks1         | FuelOpt1          |\n| Region2 | Trucks2         | FuelOpt2          |\n| Region3 | Trucks3         | FuelOpt3          |\n\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel. The total number of trucks that can be deployed is limited to 500. Due to regional regulations, the company must deploy at least 50 trucks in Region1 and 100 trucks in Region2. The fuel optimization for each region must not exceed 50% to ensure safety and compliance with environmental standards.\n\nPlease help the company to determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=50)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=100)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\n# The total number of trucks that can be deployed is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n# Due to regional regulations, the company must deploy at least 50 trucks in Region1 and 100 trucks in Region2.\nmodel.addCons(Trucks1 >= 50)\nmodel.addCons(Trucks2 >= 100)\n# The fuel optimization for each region must not exceed 50% to ensure safety and compliance with environmental standards.\nmodel.addCons(FuelOpt1 <= 0.5)\nmodel.addCons(FuelOpt2 <= 0.5)\nmodel.addCons(FuelOpt3 <= 0.5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1418,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, given by:\nCost_A = 1000 + 0.01 * (ProductA^2)\nCost_B = 1500 + 0.015 * (ProductB^2)\nCost_C = 1200 + 0.012 * (ProductC^2)\nCost_D = 1800 + 0.018 * (ProductD^2)\nCost_E = 2000 + 0.02 * (ProductE^2)\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\n// Total Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 12\n// ProductD >= 20\n// ProductE >= 25\n\n## Generate Constraint-3:\nThe raw material for Product D is limited, and no more than 300 units of Product D can be produced.\n// ProductD <= 300",
        "question": "A manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| A       | $50             | 1000 + 0.01 * (ProductA^2) |\n| B       | $70             | 1500 + 0.015 * (ProductB^2) |\n| C       | $60             | 1200 + 0.012 * (ProductC^2) |\n| D       | $80             | 1800 + 0.018 * (ProductD^2) |\n| E       | $90             | 2000 + 0.02 * (ProductE^2) |\n\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs. The total production capacity of the factory is limited to 1000 units across all products. The company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E. Additionally, the raw material for Product D is limited, and no more than 300 units of Product D can be produced.\n\nPlease help the company determine the optimal amount of each product to produce in order to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=10) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=15) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=12) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=20, ub=300) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=25) # amount of Product E produced\n\n# Define objective function\nCost_A = 1000 + 0.01 * (ProductA**2)\nCost_B = 1500 + 0.015 * (ProductB**2)\nCost_C = 1200 + 0.012 * (ProductC**2)\nCost_D = 1800 + 0.018 * (ProductD**2)\nCost_E = 2000 + 0.02 * (ProductE**2)\nTotalProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for trucks in Region 1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck.\n// Total operational cost for Region 1: Cost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Region 2: Cost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Region 3: Cost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type. The company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck.\n\n| Region | Initial Fuel Cost | Distance (km) |\n|--------|-------------------|---------------|\n| 1      | InitialFuelCost   | Distance1     |\n| 2      | InitialFuelCost   | Distance2     |\n| 3      | InitialFuelCost   | Distance3     |\n\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments. The total number of trucks available is limited to 100. Due to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n\nPlease help the company to minimize the total operational cost, which is defined as the sum of the operational costs for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region 3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for trucks in Region 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for trucks in Region 2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for trucks in Region 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialFuelCost = 0.1  # Assuming initial fuel cost per kilometer\nDistance1 = 1000  # Assuming distance for Region 1\nDistance2 = 1500  # Assuming distance for Region 2\nDistance3 = 2000  # Assuming distance for Region 3\n## Total operational cost for each region\nCost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\nCost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\nCost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n## The total number of trucks available is limited to 100.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region 1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region 2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region 3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the number of hours of labor allocated to each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs. The company has a total of 1000 labor hours available for the month.\nPlease help the company determine the optimal production quantity for each device and the allocation of labor hours to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 733,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Type1 trucks\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type2 trucks\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type3 trucks\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Type1 trucks\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type2 trucks\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Type3 trucks\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet.\n// Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n// Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n// Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\n// Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000",
        "question": "A logistics company is planning its fleet for the next quarter. The company needs to decide the number of trucks to purchase for three different types (Type1, Type2, Type3) and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The fuel efficiency of each type of truck improves with investment. For every $1000 invested, the fuel efficiency of Type1 trucks increases by 1.5%, Type2 by 2%, and Type3 by 1%. The cost of fuel per mile for Type1 trucks is $0.8, Type2 is $0.7, and Type3 is $0.6. The company aims to minimize the total fuel cost for the fleet. The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency. Please help the company determine the optimal number of trucks and the investment in fuel efficiency to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of Type1 trucks\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of Type2 trucks\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of Type3 trucks\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # investment in fuel efficiency for Type1 trucks\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # investment in fuel efficiency for Type2 trucks\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0) # investment in fuel efficiency for Type3 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Fuel cost for Type1 trucks: Cost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\n## Fuel cost for Type2 trucks: Cost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\n## Fuel cost for Type3 trucks: Cost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\n## So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nCost1 = 0.8 * (1 - 0.015 * (Efficiency1 / 1000)) * Truck1\nCost2 = 0.7 * (1 - 0.02 * (Efficiency2 / 1000)) * Truck2\nCost3 = 0.6 * (1 - 0.01 * (Efficiency3 / 1000)) * Truck3\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and upgrading fuel efficiency.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Efficiency1 + Efficiency2 + Efficiency3 <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type1 Trucks: \", model.getVal(Truck1))\n    print(\"Number of Type2 Trucks: \", model.getVal(Truck2))\n    print(\"Number of Type3 Trucks: \", model.getVal(Truck3))\n    print(\"Investment in Fuel Efficiency for Type1 Trucks: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Type2 Trucks: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Type3 Trucks: \", model.getVal(Efficiency3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints.\n// {\"production quantity for ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each product is given by:\n- Cost_ProductA = 20 + 0.05 * (ProductA_Quantity)^2\n- Cost_ProductB = 30 + 0.03 * (ProductB_Quantity)^2\n- Cost_ProductC = 25 + 0.04 * (ProductC_Quantity)^2\nThe company wants to maximize the total profit.\n// Profit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity = (50 - (20 + 0.05 * (ProductA_Quantity)^2)) * ProductA_Quantity\n// Profit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity = (70 - (30 + 0.03 * (ProductB_Quantity)^2)) * ProductB_Quantity\n// Profit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity = (60 - (25 + 0.04 * (ProductC_Quantity)^2)) * ProductC_Quantity\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductB_Quantity <= 2 * ProductA_Quantity\n\n## Generate Constraint-3:\nThe company has a storage constraint that limits the total inventory to 500 units.\n// ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 500\n\n## Generate Constraint-4:\nThe production of ProductC must be at least 10% of the total production.\n// ProductC_Quantity >= 0.1 * (ProductA_Quantity + ProductB_Quantity + ProductC_Quantity)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit while considering various operational constraints. The profit per unit for each product and their respective production cost functions are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| ProductA | $50             | 20 + 0.05 * (Quantity)^2  |\n| ProductB | $70             | 30 + 0.03 * (Quantity)^2  |\n| ProductC | $60             | 25 + 0.04 * (Quantity)^2  |\n\nThe company has a total production capacity of 1000 units per month. Due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA. The company has a storage constraint that limits the total inventory to 500 units. Additionally, the production of ProductC must be at least 10% of the total production.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\n\n# Define objective function\nCost_ProductA = 20 + 0.05 * (ProductA_Quantity**2)\nCost_ProductB = 30 + 0.03 * (ProductB_Quantity**2)\nCost_ProductC = 25 + 0.04 * (ProductC_Quantity**2)\nProfit_ProductA = (50 - Cost_ProductA) * ProductA_Quantity\nProfit_ProductB = (70 - Cost_ProductB) * ProductB_Quantity\nProfit_ProductC = (60 - Cost_ProductC) * ProductC_Quantity\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 1000)\nmodel.addCons(ProductB_Quantity <= 2 * ProductA_Quantity)\nmodel.addCons(ProductA_Quantity + ProductB_Quantity + ProductC_Quantity <= 500)\nmodel.addCons(ProductC_Quantity >= 0.1 * (ProductA_Quantity + ProductB_Quantity + ProductC_Quantity))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates three types of vehicles: Trucks, Vans, and Bikes. Each vehicle type has a different fuel efficiency and maintenance cost. The company also needs to decide on the investment in a new fuel-efficient technology that can be applied to each vehicle type to reduce fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Trucks\": \"TechTrucks\", \"range\": \"TechTrucks >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Vans\": \"TechVans\", \"range\": \"TechVans >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Bikes\": \"TechBikes\", \"range\": \"TechBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in the new technology. For Trucks, the fuel efficiency increases by 0.5% for every $100 invested in technology. For Vans, the increase is 0.7% per $100, and for Bikes, it's 1% per $100. The maintenance cost decreases by $2 for Trucks, $1.5 for Vans, and $1 for Bikes for every $100 invested in technology. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Fuel cost for Trucks: FuelTrucks = (BaseFuelCost * Trucks) / (1 + 0.005 * TechTrucks / 100)\n// Fuel cost for Vans: FuelVans = (BaseFuelCost * Vans) / (1 + 0.007 * TechVans / 100)\n// Fuel cost for Bikes: FuelBikes = (BaseFuelCost * Bikes) / (1 + 0.01 * TechBikes / 100)\n// Maintenance cost for Trucks: MaintTrucks = (BaseMaintCost * Trucks) - (2 * TechTrucks)\n// Maintenance cost for Vans: MaintVans = (BaseMaintCost * Vans) - (1.5 * TechVans)\n// Maintenance cost for Bikes: MaintBikes = (BaseMaintCost * Bikes) - (1 * TechBikes)\n// So, the objective function is: Minimize (FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and technology investments.\n// Trucks + Vans + Bikes + TechTrucks + TechVans + TechBikes <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles must not exceed 500.\n// Trucks + Vans + Bikes <= 500",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of Trucks, Vans, and Bikes to operate, as well as the investment in a new fuel-efficient technology for each vehicle type. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel efficiency and maintenance cost of each vehicle type are affected by the investment in the new technology, as shown in the following Table.\n\n| Vehicle Type | Fuel Efficiency Improvement per $100 Tech Investment | Maintenance Cost Reduction per $100 Tech Investment |\n|--------------|--------------------------------------------------------|------------------------------------------------------|\n| Trucks       | 0.5%                                                   | $2                                                   |\n| Vans         | 0.7%                                                   | $1.5                                                 |\n| Bikes        | 1%                                                     | $1                                                   |\n\nThe company has a budget of $100,000 for vehicle purchases and technology investments. The total number of vehicles must not exceed 500.\n\nPlease help the company determine the optimal number of each vehicle type and the investment in fuel-efficient technology to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nTechTrucks = model.addVar(name=\"TechTrucks\", lb=0)  # investment in fuel-efficient technology for Trucks\nTechVans = model.addVar(name=\"TechVans\", lb=0)  # investment in fuel-efficient technology for Vans\nTechBikes = model.addVar(name=\"TechBikes\", lb=0)  # investment in fuel-efficient technology for Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define fuel and maintenance costs\nBaseFuelCost = 100  # example base fuel cost per vehicle\nBaseMaintCost = 50   # example base maintenance cost per vehicle\n\nFuelTrucks = (BaseFuelCost * Trucks) / (1 + 0.005 * TechTrucks / 100)\nFuelVans = (BaseFuelCost * Vans) / (1 + 0.007 * TechVans / 100)\nFuelBikes = (BaseFuelCost * Bikes) / (1 + 0.01 * TechBikes / 100)\nMaintTrucks = (BaseMaintCost * Trucks) - (2 * TechTrucks)\nMaintVans = (BaseMaintCost * Vans) - (1.5 * TechVans)\nMaintBikes = (BaseMaintCost * Bikes) - (1 * TechBikes)\n\n## the objective function is: Minimize (FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\nmodel.addCons(obj == FuelTrucks + FuelVans + FuelBikes + MaintTrucks + MaintVans + MaintBikes)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and technology investments.\nmodel.addCons(Trucks + Vans + Bikes + TechTrucks + TechVans + TechBikes <= 100000)\n## The total number of vehicles must not exceed 500.\nmodel.addCons(Trucks + Vans + Bikes <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Tech for Trucks: \", model.getVal(TechTrucks))\n    print(\"Investment in Tech for Vans: \", model.getVal(TechVans))\n    print(\"Investment in Tech for Bikes: \", model.getVal(TechBikes))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1412,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be used across all regions.\n// T1 + T2 + T3 + T4 + T5 <= 5",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day. The company has a total budget of $10,000 per day for operating costs. The company also has a limit of 5 trucks that can be used across all regions. Please help the company to maximize the total net profit across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_R1 = (1500 - 1000) # Profit per truck in R1\nProfit_R2 = (1800 - 1200) # Profit per truck in R2\nProfit_R3 = (2100 - 1500) # Profit per truck in R3\nProfit_R4 = (2400 - 1800) # Profit per truck in R4\nProfit_R5 = (2700 - 2000) # Profit per truck in R5\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be used across all regions.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. The profit margin and production time for each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Production Time per Unit |\n|---------|------------------------|--------------------------|\n| A       | $5                     | 1 hour                   |\n| B       | $7                     | 2 hours                  |\n| C       | $9                     | 3 hours                  |\n| D       | $11                    | 4 hours                  |\n| E       | $13                    | 5 hours                  |\n\nThe company has a budget of $1500 for raw materials. The company has a production capacity of 200 hours. Please help the company to maximize the total profit per unit of time (profit rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company aims to minimize the total operational cost per liter of fuel consumed.\n// Operational cost of A: Cost_A = 50 * A\n// Operational cost of B: Cost_B = 70 * B\n// Operational cost of C: Cost_C = 90 * C\n// Operational cost of D: Cost_D = 110 * D\n// Operational cost of E: Cost_E = 130 * E\n// Fuel consumption of A: Fuel_A = 10 * A\n// Fuel consumption of B: Fuel_B = 15 * B\n// Fuel consumption of C: Fuel_C = 20 * C\n// Fuel consumption of D: Fuel_D = 25 * D\n// Fuel consumption of E: Fuel_E = 30 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs this month.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery demand of 500 trips this month.\n// A + B + C + D + E >= 500\n\n## Generate Constraint-3:\nThe total fuel consumption must not exceed 15,000 liters this month.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000\n\n## Generate Constraint-4:\nThe number of trips for Truck D must not exceed the combined trips of Trucks A and B.\n// D <= A + B",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands. Each truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company has a budget of $10,000 for operational costs this month. The company must meet a minimum delivery demand of 500 trips this month. The total fuel consumption must not exceed 15,000 liters this month. The number of trips for Truck D must not exceed the combined trips of Trucks A and B. Please help the company to minimize the total operational cost per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trips for Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trips for Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 50 * A\nCost_B = 70 * B\nCost_C = 90 * C\nCost_D = 110 * D\nCost_E = 130 * E\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs this month.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n## The company must meet a minimum delivery demand of 500 trips this month.\nmodel.addCons(A + B + C + D + E >= 500)\n## The total fuel consumption must not exceed 15,000 liters this month.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n## The number of trips for Truck D must not exceed the combined trips of Trucks A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Minimized Operational Cost per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation technology cannot exceed $50,000.\n// IA <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30\n\n## Generate Constraint-4:\nThe company must allocate at least 200 units of resources to ProductB.\n// RB >= 200\n\n## Generate Constraint-5:\nThe total production quantity of all products must not exceed 100 units.\n// QA + QB + QC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency. The profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Initial Production Cost per Unit |\n|---------|-----------------|----------------------------------|\n| ProductA | $100            | $60                              |\n| ProductB | $150            | $80                              |\n| ProductC | $200            | $100                             |\n\nThe total resources available for production are limited to 1000 units. The investment in automation technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units. The company must allocate at least 200 units of resources to ProductB. The total production quantity of all products must not exceed 100 units.\n\nPlease help the company to determine the optimal production quantities and resource allocations, as well as the appropriate investment in automation technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0)  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30)  # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0)  # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=200)  # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0)  # resources allocated to ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0, ub=50000)  # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 60 + 0.005 * IA) * QA\nProfitB = (150 - 80 + 0.005 * IA) * QB\nProfitC = (200 - 100 + 0.005 * IA) * QC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RA + RB + RC <= 1000)\nmodel.addCons(QA + QB + QC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Automation Technology: \", model.getVal(IA))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1590,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours of machine type 1 used\": \"HoursMachine1\", \"range\": \"HoursMachine1 >= 0\", \"type\": \"real\"}\n// {\"hours of machine type 2 used\": \"HoursMachine2\", \"range\": \"HoursMachine2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// Cost_Machine1 = HoursMachine1 * 20\n// Cost_Machine2 = HoursMachine2 * 30\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n## Generate Constraint-1:\nThe total production time available for machine type 1 is 8 hours per day.\n// UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n\n| Product | Profit per Unit | Machine Type 1 Usage per Unit | Machine Type 2 Usage per Unit |\n|---------|-----------------|-------------------------------|-------------------------------|\n| A       | $50             | 0.5 hours                      | 0 hours                       |\n| B       | $70             | 0.4 hours                      | 0 hours                       |\n| C       | $60             | 0.3 hours                      | 0 hours                       |\n\nThe total production time available for machine type 1 is 8 hours per day. The manufacturer needs to determine the optimal number of units of each product to produce and the optimal number of hours to use each machine type to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nHoursMachine1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine1\", lb=0) # hours of machine type 1 used\nHoursMachine2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine2\", lb=0) # hours of machine type 2 used\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nCost_Machine1 = HoursMachine1 * 20\nCost_Machine2 = HoursMachine2 * 30\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n# Add constraints\n# The total production time available for machine type 1 is 8 hours per day.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1)\n# The total production time available for machine type 2 is 10 hours per day.\nmodel.addCons(UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.2 <= HoursMachine2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours of Machine Type 1 Used: \", model.getVal(HoursMachine1))\n    print(\"Hours of Machine Type 2 Used: \", model.getVal(HoursMachine2))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost.\n// Net profit of A: NetProfit_A = (20 - 5) * A\n// Net profit of B: NetProfit_B = (30 - 10) * B\n// Net profit of C: NetProfit_C = (40 - 15) * C\n// Net profit of D: NetProfit_D = (50 - 20) * D\n// Total transportation cost: TotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for transportation costs.\n// 5 * A + 10 * B + 15 * C + 20 * D <= 5000\n\n## Generate Constraint-2:\nThe company wants to distribute at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a storage capacity limit of 300 units in total.\n// A + B + C + D <= 300\n\n## Generate Constraint-4:\nThe company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize efficiency and profit. The profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The transportation cost per unit for product A is $5, for product B is $10, for product C is $15, and for product D is $20. The company aims to maximize the net profit rate, which is defined as the total net profit divided by the total transportation cost. The company has a budget of $5000 for transportation costs. The company wants to distribute at least 50 units of each product. The company has a storage capacity limit of 300 units in total. The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C. Please help the company to maximize the net profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to distribute at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (20 - 5) * A\nNetProfit_B = (30 - 10) * B\nNetProfit_C = (40 - 15) * C\nNetProfit_D = (50 - 20) * D\nTotalCost = 5 * A + 10 * B + 15 * C + 20 * D\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D)\n\n# Add constraints\n## The company has a budget of $5000 for transportation costs.\nmodel.addCons(5 * A + 10 * B + 15 * C + 20 * D <= 5000)\n## The company has a storage capacity limit of 300 units in total.\nmodel.addCons(A + B + C + D <= 300)\n## The company wants to ensure that the distribution of product D does not exceed the combined distribution of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 50 vehicles.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\n// T <= 0.5 * (V + B)\n\n## Generate Constraint-4:\nThe company has a minimum requirement to operate at least 5 Trucks and 10 Vans.\n// T >= 5; V >= 10\n\n## Generate Constraint-5:\nThe company aims to have at least twice as many Bikes as Trucks.\n// B >= 2 * T",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle | Revenue per Day | Operational Cost per Day |\n|---------|-----------------|--------------------------|\n| Trucks  | $500            | $200                     |\n| Vans    | $300            | $100                     |\n| Bikes   | $100            | $30                      |\n\nThe company has a total budget of $10,000 for daily operational costs. The company has a maximum storage capacity of 50 vehicles. The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined. The company has a minimum requirement to operate at least 5 Trucks and 10 Vans. The company aims to have at least twice as many Bikes as Trucks.\n\nPlease help the company to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5)  # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=10)  # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)  # number of Bikes\n\n# Define objective function\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n# So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n# The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n# The company has a maximum storage capacity of 50 vehicles.\nmodel.addCons(T + V + B <= 50)\n# The company wants to ensure that the number of Trucks does not exceed half the total number of Vans and Bikes combined.\nmodel.addCons(T <= 0.5 * (V + B))\n# The company has a minimum requirement to operate at least 5 Trucks and 10 Vans.\nmodel.addCons(T >= 5)\nmodel.addCons(V >= 10)\n# The company aims to have at least twice as many Bikes as Trucks.\nmodel.addCons(B >= 2 * T)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location1, Location2, Location3, Location4, Location5) where these installations can be made.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local climate conditions. Similarly, the efficiency of wind turbines depends on wind patterns.\nFor Location1, the efficiency of solar panels is 15%, the cost per panel is $500, and the maintenance cost is $50 per panel annually.\nFor Location2, the efficiency is 20%, the cost is $600, and the maintenance cost is $60 per panel annually.\nFor Location3, the efficiency is 10%, the cost is $400, and the maintenance cost is $40 per panel annually.\nFor Location4, the efficiency of wind turbines is 25%, the cost per turbine is $1000, and the maintenance cost is $100 per turbine annually.\nFor Location5, the efficiency is 30%, the cost is $1200, and the maintenance cost is $120 per turbine annually.\nThe company wants to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n// Total energy generated: Energy = 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5\n// Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the initial investment.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000\n\n## Generate Constraint-2:\nThe company aims to generate at least 10,000 kWh of energy annually.\n// 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5 >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 30% of the budget is spent on solar panels.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 >= 0.3 * (500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5)\n\n## Generate Constraint-4:\nNo more than 50% of the total number of installations can be at any single location.\n// Solar1 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5)\n// Solar2 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5)\n// Solar3 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5)\n// Wind4 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5)\n// Wind5 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations (Location1, Location2, Location3, Location4, Location5). The efficiency, cost per unit, and annual maintenance cost for each type of installation at each location are given in the following Table.\n\n| Location  | Type       | Efficiency | Cost per Unit | Annual Maintenance Cost |\n|-----------|------------|------------|---------------|-------------------------|\n| Location1 | Solar Panel| 15%        | $500          | $50                     |\n| Location2 | Solar Panel| 20%        | $600          | $60                     |\n| Location3 | Solar Panel| 10%        | $400          | $40                     |\n| Location4 | Wind Turbine| 25%       | $1000         | $100                    |\n| Location5 | Wind Turbine| 30%       | $1200         | $120                    |\n\nThe company has a budget of $50,000 for the initial investment. The company aims to generate at least 10,000 kWh of energy annually. The company wants to ensure that at least 30% of the budget is spent on solar panels. Additionally, no more than 50% of the total number of installations can be at any single location.\n\nPlease help the company to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at Location4\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\nCost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the initial investment.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000)\n## The company aims to generate at least 10,000 kWh of energy annually.\nmodel.addCons(0.15 * 500 * Solar1 + 0.20 * 600 * Solar2 + 0.10 * 400 * Solar3 + 0.25 * 1000 * Wind4 + 0.30 * 1200 * Wind5 >= 10000)\n## The company wants to ensure that at least 30% of the budget is spent on solar panels.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 >= 0.3 * (500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5))\n## No more than 50% of the total number of installations can be at any single location.\nmodel.addCons(Solar1 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5))\nmodel.addCons(Solar2 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5))\nmodel.addCons(Solar3 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5))\nmodel.addCons(Wind4 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5))\nmodel.addCons(Wind5 <= 0.5 * (Solar1 + Solar2 + Solar3 + Wind4 + Wind5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location4: \", model.getVal(Wind4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1360,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering packages across different regions. The company needs to determine the number of trucks to allocate for each region and the number of packages each truck can carry. The regions are categorized into four: Urban, Suburban, Rural, and Remote.\n// {\"number of trucks for Urban region\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban region\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural region\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Remote region\": \"RemoteTrucks\", \"range\": \"RemoteTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Urban region\": \"UrbanPackagesPerTruck\", \"range\": \"UrbanPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Suburban region\": \"SuburbanPackagesPerTruck\", \"range\": \"SuburbanPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Rural region\": \"RuralPackagesPerTruck\", \"range\": \"RuralPackagesPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of packages per truck for Remote region\": \"RemotePackagesPerTruck\", \"range\": \"RemotePackagesPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in the Urban region is $100 per day, in the Suburban region is $150 per day, in the Rural region is $200 per day, and in the Remote region is $250 per day. The revenue generated per package delivered in each region is $20. The company aims to maximize the net profit, which is the total revenue minus the total operating cost.\n// Revenue_Urban = 20 * UrbanTrucks * UrbanPackagesPerTruck\n// Revenue_Suburban = 20 * SuburbanTrucks * SuburbanPackagesPerTruck\n// Revenue_Rural = 20 * RuralTrucks * RuralPackagesPerTruck\n// Revenue_Remote = 20 * RemoteTrucks * RemotePackagesPerTruck\n// Cost_Urban = 100 * UrbanTrucks\n// Cost_Suburban = 150 * SuburbanTrucks\n// Cost_Rural = 200 * RuralTrucks\n// Cost_Remote = 250 * RemoteTrucks\n// So, the objective function is: Maximize (Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote) - (Cost_Urban + Cost_Suburban + Cost_Rural + Cost_Remote)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks + RemoteTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $5000 for operating costs.\n// 100 * UrbanTrucks + 150 * SuburbanTrucks + 200 * RuralTrucks + 250 * RemoteTrucks <= 5000\n\n## Generate Constraint-3:\nThe company has a daily package delivery capacity of 1000 packages.\n// UrbanTrucks * UrbanPackagesPerTruck + SuburbanTrucks * SuburbanPackagesPerTruck + RuralTrucks * RuralPackagesPerTruck + RemoteTrucks * RemotePackagesPerTruck <= 1000\n\n## Generate Constraint-4:\nThe number of trucks allocated to the Urban region must be at least half the number allocated to the Suburban region.\n// UrbanTrucks >= 0.5 * SuburbanTrucks",
        "question": "A logistics company is planning its routes for delivering packages across different regions. The company needs to determine the number of trucks to allocate for each region and the number of packages each truck can carry. The regions are categorized into four: Urban, Suburban, Rural, and Remote. The cost of operating a truck and the revenue generated per package delivered in each region are given in the following Table.\n\n| Region       | Operating Cost per Truck per Day | Revenue per Package Delivered |\n|--------------|---------------------------------|-------------------------------|\n| Urban        | $100                            | $20                           |\n| Suburban     | $150                            | $20                           |\n| Rural        | $200                            | $20                           |\n| Remote       | $250                            | $20                           |\n\nThe company has a total of 50 trucks available. The company has a daily budget of $5000 for operating costs. The company has a daily package delivery capacity of 1000 packages. The number of trucks allocated to the Urban region must be at least half the number allocated to the Suburban region. \n\nPlease help the company to maximize the net profit, which is the total revenue minus the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)\nRemoteTrucks = model.addVar(vtype=\"INTEGER\", name=\"RemoteTrucks\", lb=0)\nUrbanPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"UrbanPackagesPerTruck\", lb=0)\nSuburbanPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"SuburbanPackagesPerTruck\", lb=0)\nRuralPackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RuralPackagesPerTruck\", lb=0)\nRemotePackagesPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RemotePackagesPerTruck\", lb=0)\n\n# Define objective function\nRevenue_Urban = 20 * UrbanTrucks * UrbanPackagesPerTruck\nRevenue_Suburban = 20 * SuburbanTrucks * SuburbanPackagesPerTruck\nRevenue_Rural = 20 * RuralTrucks * RuralPackagesPerTruck\nRevenue_Remote = 20 * RemoteTrucks * RemotePackagesPerTruck\nCost_Urban = 100 * UrbanTrucks\nCost_Suburban = 150 * SuburbanTrucks\nCost_Rural = 200 * RuralTrucks\nCost_Remote = 250 * RemoteTrucks\n# So, the objective function is: Maximize (Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote) - (Cost_Urban + Cost_Suburban + Cost_Rural + Cost_Remote)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Urban + Revenue_Suburban + Revenue_Rural + Revenue_Remote - Cost_Urban - Cost_Suburban - Cost_Rural - Cost_Remote)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks + RemoteTrucks <= 50)\n# The company has a daily budget of $5000 for operating costs.\nmodel.addCons(100 * UrbanTrucks + 150 * SuburbanTrucks + 200 * RuralTrucks + 250 * RemoteTrucks <= 5000)\n# The company has a daily package delivery capacity of 1000 packages.\nmodel.addCons(UrbanTrucks * UrbanPackagesPerTruck + SuburbanTrucks * SuburbanPackagesPerTruck + RuralTrucks * RuralPackagesPerTruck + RemoteTrucks * RemotePackagesPerTruck <= 1000)\n# The number of trucks allocated to the Urban region must be at least half the number allocated to the Suburban region.\nmodel.addCons(UrbanTrucks >= 0.5 * SuburbanTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Urban Region: \", model.getVal(UrbanTrucks))\n    print(\"Number of Trucks for Suburban Region: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Trucks for Rural Region: \", model.getVal(RuralTrucks))\n    print(\"Number of Trucks for Remote Region: \", model.getVal(RemoteTrucks))\n    print(\"Packages per Truck for Urban Region: \", model.getVal(UrbanPackagesPerTruck))\n    print(\"Packages per Truck for Suburban Region: \", model.getVal(SuburbanPackagesPerTruck))\n    print(\"Packages per Truck for Rural Region: \", model.getVal(RuralPackagesPerTruck))\n    print(\"Packages per Truck for Remote Region: \", model.getVal(RemotePackagesPerTruck))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1332,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption\n\n## Generate Constraint-3:\nThe company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\n// CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption. The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems. Please help the company to minimize its total energy cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # example efficiency for solar panels\nWindEfficiency = 0.3  # example efficiency for wind turbines\nTotalEnergyDemand = 10000  # example total energy demand of the company\nPricePerKWh = 0.15  # example price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**(-1)) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 500  # example average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n## The company has a budget constraint of $500,000 for the installation of solar panels, wind turbines, and energy storage systems.\nCostOfSolarPanel = 1000  # example cost of a solar panel\nCostOfWindTurbine = 2000  # example cost of a wind turbine\nCostOfStorage = 100  # example cost of storage per kWh\nmodel.addCons(CostOfSolarPanel * Solar + CostOfWindTurbine * Wind + CostOfStorage * Storage <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Energy Cost: \", model.getVal(Cost))\n    print(\"Minimized Total Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Due to market demand, the production of ProductA must be at least twice the production of ProductB. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for P1 is $30, but it requires 2 square meters of storage space. For P2, the profit per unit is $40, requiring 3 square meters of storage space. For P3, the profit per unit is $50, requiring 4 square meters of storage space. The company aims to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n// Profit_P1 = 30 * P1\n// Profit_P2 = 40 * P2\n// Profit_P3 = 50 * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (2 * P1 + 3 * P2 + 4 * P3)\n\n## Generate Constraint-1:\nThe company has a limited storage space of 200 square meters.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for purchasing the products.\n// 30 * P1 + 40 * P2 + 50 * P3 <= 3000\n\n## Generate Constraint-3:\nThe company has a distribution capacity of 100 units in terms of the number of units it can distribute.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-4:\nThe market demand for P1 is 15 units. So, the company can only sell a maximum of 15 units of P1.\n// P1 <= 15\n\n## Generate Constraint-5:\nThe company must distribute at least 20 units of P2 to meet contractual obligations.\n// P2 >= 20",
        "question": "A logistics company manages the distribution of three types of products: P1, P2, and P3. They need to determine the optimal distribution quantities to maximize their profit while considering various constraints. The profit per unit and the required storage space for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Space Required |\n|---------|-----------------|------------------------|\n| P1      | $30             | 2 square meters       |\n| P2      | $40             | 3 square meters       |\n| P3      | $50             | 4 square meters       |\n\nThe company has a limited storage space of 200 square meters. The company has a budget of $3000 for purchasing the products. The company has a distribution capacity of 100 units in terms of the number of units it can distribute. The market demand for P1 is 15 units, so the company can only sell a maximum of 15 units of P1. The company must distribute at least 20 units of P2 to meet contractual obligations.\n\nPlease help the company to maximize the total profit while considering the storage efficiency (profit per square meter of storage space).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=15) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=20, ub=100) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=100) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 30 * P1\nProfit_P2 = 40 * P2\nProfit_P3 = 50 * P3\nStorageSpace = 2 * P1 + 3 * P2 + 4 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / StorageSpace\n## convert the division to multiplication\nmodel.addCons(obj * StorageSpace == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a limited storage space of 200 square meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n## The company has a budget of $3000 for purchasing the products.\nmodel.addCons(30 * P1 + 40 * P2 + 50 * P3 <= 3000)\n## The company has a distribution capacity of 100 units in terms of the number of units it can distribute.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The market demand for P1 is 15 units. So, the company can only sell a maximum of 15 units of P1.\nmodel.addCons(P1 <= 15)\n## The company must distribute at least 20 units of P2 to meet contractual obligations.\nmodel.addCons(P2 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location1, Location2, Location3, Location4, Location5) where these installations can be made.\n// {\"number of solar panels at Location1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local climate conditions. Similarly, the efficiency of wind turbines depends on wind patterns.\nFor Location1, the efficiency of solar panels is 15%, the cost per panel is $500, and the maintenance cost is $50 per panel annually.\nFor Location2, the efficiency is 20%, the cost is $600, and the maintenance cost is $60 per panel annually.\nFor Location3, the efficiency is 10%, the cost is $400, and the maintenance cost is $40 per panel annually.\nFor Location4, the efficiency of wind turbines is 25%, the cost per turbine is $1000, and the maintenance cost is $100 per turbine annually.\nFor Location5, the efficiency is 30%, the cost is $1200, and the maintenance cost is $120 per turbine annually.\nThe company wants to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\n// Total energy generated: Energy = 15% * 500 * Solar1 + 20% * 600 * Solar2 + 10% * 400 * Solar3 + 25% * 1000 * Wind4 + 30% * 1200 * Wind5\n// Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the initial investment.\n// 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations (Location1, Location2, Location3, Location4, Location5). The company needs to determine the number of solar panels and wind turbines to install at each location. The efficiency, cost per unit, and annual maintenance cost for each type of installation are given in the following Table.\n\n| Location | Type       | Efficiency | Cost per Unit | Annual Maintenance Cost |\n|----------|------------|------------|---------------|-------------------------|\n| Location1| Solar Panel| 15%        | $500          | $50 per panel           |\n| Location2| Solar Panel| 20%        | $600          | $60 per panel           |\n| Location3| Solar Panel| 10%        | $400          | $40 per panel           |\n| Location4| Wind Turbine| 25% | $1000        | $100 per turbine        |\n| Location5| Wind Turbine| 30% | $1200        | $120 per turbine        |\n\nThe company has a budget of $50,000 for the initial investment. The company wants to minimize the Total Cost of Ownership (TCO), which includes the initial investment and annual maintenance costs.\nPlease help the company determine the optimal number of solar panels and wind turbines to install at each location to minimize the TCO.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at Location1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at Location2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at Location3\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at Location4\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at Location5\n\n# Define objective function\n## Total cost: Cost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\nCost = 500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 + 50 * Solar1 + 60 * Solar2 + 40 * Solar3 + 100 * Wind4 + 120 * Wind5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the initial investment.\nmodel.addCons(500 * Solar1 + 600 * Solar2 + 400 * Solar3 + 1000 * Wind4 + 1200 * Wind5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location1: \", model.getVal(Solar1))\n    print(\"Number of Solar Panels at Location2: \", model.getVal(Solar2))\n    print(\"Number of Solar Panels at Location3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location4: \", model.getVal(Wind4))\n    print(\"Number of Wind Turbines at Location5: \", model.getVal(Wind5))\n    print(\"Minimized Total Cost of Ownership: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases as more money is invested in automation.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. These costs decrease by $1 for every $10,000 invested in automation. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * Automation) * ProductA\n// Total cost for ProductB: CostB = (70 - 0.0001 * Automation) * ProductB\n// Total cost for ProductC: CostC = (90 - 0.0001 * Automation) * ProductC\n// Total revenue for ProductA: RevenueA = 100 * ProductA\n// Total revenue for ProductB: RevenueB = 120 * ProductB\n// Total revenue for ProductC: RevenueC = 150 * ProductC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases by $1 for every $10,000 invested in automation. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for investment in automation.\n\nPlease help the company to determine the optimal production quantities for ProductA, ProductB, and ProductC, and the amount to invest in automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nCostA = (50 - 0.0001 * Automation) * ProductA\nCostB = (70 - 0.0001 * Automation) * ProductB\nCostC = (90 - 0.0001 * Automation) * ProductC\nRevenueA = 100 * ProductA\nRevenueB = 120 * ProductB\nRevenueC = 150 * ProductC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a budget of $100,000 for investment in automation.\nmodel.addCons(Automation <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide on the number of trucks for five different types of cargo (Refrigerated, Heavy, Standard, Light, and Hazardous).\n// {\"number of refrigerated trucks\": \"Refrigerated\", \"range\": \"Refrigerated >= 0\", \"type\": \"integer\"}\n// {\"number of heavy trucks\": \"Heavy\", \"range\": \"Heavy >= 0\", \"type\": \"integer\"}\n// {\"number of standard trucks\": \"Standard\", \"range\": \"Standard >= 0\", \"type\": \"integer\"}\n// {\"number of light trucks\": \"Light\", \"range\": \"Light >= 0\", \"type\": \"integer\"}\n// {\"number of hazardous material trucks\": \"Hazardous\", \"range\": \"Hazardous >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total operational cost, which includes fuel, maintenance, and driver salaries. The operational cost per truck is different for each type: $50,000 for Refrigerated, $40,000 for Heavy, $30,000 for Standard, $20,000 for Light, and $60,000 for Hazardous. The cost function is nonlinear due to economies of scale in maintenance and fuel efficiency.\n// Total operational cost: Cost = 50000 * Refrigerated^0.9 + 40000 * Heavy^0.9 + 30000 * Standard^0.9 + 20000 * Light^0.9 + 60000 * Hazardous^0.9\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// 50000 * Refrigerated + 40000 * Heavy + 30000 * Standard + 20000 * Light + 60000 * Hazardous <= 2000000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide on the number of trucks for five different types of cargo: Refrigerated, Heavy, Standard, Light, and Hazardous. The operational cost per truck varies for each type and includes fuel, maintenance, and driver salaries. The operational cost per truck is $50,000 for Refrigerated, $40,000 for Heavy, $30,000 for Standard, $20,000 for Light, and $60,000 for Hazardous. The cost function is nonlinear due to economies of scale in maintenance and fuel efficiency.\n\n| Type of Cargo | Operational Cost per Truck |\n|---------------|----------------------------|\n| Refrigerated  | $50,000                    |\n| Heavy         | $40,000                    |\n| Standard      | $30,000                    |\n| Light         | $20,000                    |\n| Hazardous     | $60,000                    |\n\nThe company has a budget of $2,000,000 for purchasing trucks. Please help the company to minimize the total operational cost, which is calculated as 50000 * Refrigerated^0.9 + 40000 * Heavy^0.9 + 30000 * Standard^0.9 + 20000 * Light^0.9 + 60000 * Hazardous^0.9.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigerated = model.addVar(vtype=\"INTEGER\", name=\"Refrigerated\", lb=0)  # number of refrigerated trucks\nHeavy = model.addVar(vtype=\"INTEGER\", name=\"Heavy\", lb=0)  # number of heavy trucks\nStandard = model.addVar(vtype=\"INTEGER\", name=\"Standard\", lb=0)  # number of standard trucks\nLight = model.addVar(vtype=\"INTEGER\", name=\"Light\", lb=0)  # number of light trucks\nHazardous = model.addVar(vtype=\"INTEGER\", name=\"Hazardous\", lb=0)  # number of hazardous material trucks\n\n# Define objective function\n# The cost function is nonlinear due to economies of scale in maintenance and fuel efficiency.\n# Total operational cost: Cost = 50000 * Refrigerated^0.9 + 40000 * Heavy^0.9 + 30000 * Standard^0.9 + 20000 * Light^0.9 + 60000 * Hazardous^0.9\n# Convert the exponentiation to multiplication\nRefrigerated_cost = 50000 * (Refrigerated ** 0.9)\nHeavy_cost = 40000 * (Heavy ** 0.9)\nStandard_cost = 30000 * (Standard ** 0.9)\nLight_cost = 20000 * (Light ** 0.9)\nHazardous_cost = 60000 * (Hazardous ** 0.9)\n\nCost = model.addVar(name=\"Cost\")\nmodel.setObjective(Cost, \"minimize\")\nmodel.addCons(Cost == Refrigerated_cost + Heavy_cost + Standard_cost + Light_cost + Hazardous_cost)\n\n# Add constraints\n# The company has a budget of $2,000,000 for purchasing trucks.\nmodel.addCons(50000 * Refrigerated + 40000 * Heavy + 30000 * Standard + 20000 * Light + 60000 * Hazardous <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(Refrigerated))\n    print(\"Number of Heavy Trucks: \", model.getVal(Heavy))\n    print(\"Number of Standard Trucks: \", model.getVal(Standard))\n    print(\"Number of Light Trucks: \", model.getVal(Light))\n    print(\"Number of Hazardous Material Trucks: \", model.getVal(Hazardous))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n// {\"operational cost per Truck\": \"Cost_Truck\", \"range\": \"Cost_Truck >= 0\", \"type\": \"real\"}\n// {\"operational cost per Van\": \"Cost_Van\", \"range\": \"Cost_Van >= 0\", \"type\": \"real\"}\n// {\"operational cost per Bike\": \"Cost_Bike\", \"range\": \"Cost_Bike >= 0\", \"type\": \"real\"}\n// {\"operational cost per Drone\": \"Cost_Drone\", \"range\": \"Cost_Drone >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company wants to minimize the total operational cost while ensuring efficient delivery coverage.\n// Total_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000\n\n## Generate Constraint-2:\nThe company aims to have at least 10 vehicles in total.\n// Trucks + Vans + Bikes + Drones >= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\n// Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones)",
        "question": "A logistics company is planning its fleet expansion to include four types of vehicles: Trucks, Vans, Bikes, and Drones. The company needs to determine the number of each type of vehicle to purchase and the associated operational costs. The operational costs for Trucks, Vans, Bikes, and Drones are $500, $300, $100, and $200 per vehicle per day, respectively. The company has a budget of $100,000 for purchasing vehicles and aims to have at least 10 vehicles in total. Additionally, the company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles. Please help the company to minimize the total operational cost while ensuring efficient delivery coverage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)\n\n# Define objective function\nCost_Truck = 500\nCost_Van = 300\nCost_Bike = 100\nCost_Drone = 200\nTotal_Cost = Trucks * Cost_Truck + Vans * Cost_Van + Bikes * Cost_Bike + Drones * Cost_Drone\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks * 20000 + Vans * 15000 + Bikes * 5000 + Drones * 10000 <= 100000)\n# The company aims to have at least 10 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes + Drones >= 10)\n# The company wants to ensure that the number of Trucks does not exceed 50% of the total number of vehicles.\nmodel.addCons(Trucks <= 0.5 * (Trucks + Vans + Bikes + Drones))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes.\n// Cost per hour for route A: Cost_A = 2 * A * 60\n// Cost per hour for route B: Cost_B = 3 * B * 50\n// Cost per hour for route C: Cost_C = 4 * C * 40\n// Cost per hour for route D: Cost_D = 5 * D * 30\n// Cost per hour for route E: Cost_E = 6 * E * 20\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for all routes.\n// 2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks available is 50.\n// A + B + C + D + E <= 50",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost. The cost per kilometer and average speed for each route are given in the following Table.\n\n| Route | Cost per km | Average Speed |\n|-------|-------------|---------------|\n| A     | $2          | 60 km/h       |\n| B     | $3          | 50 km/h       |\n| C     | $4          | 40 km/h       |\n| D     | $5          | 30 km/h       |\n| E     | $6          | 20 km/h       |\n\nThe company has a total budget of $10,000 per day for all routes. The company must allocate at least 5 trucks to each route. The total number of trucks available is 50. \nPlease help the company to minimize the total cost of transportation per hour across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## Cost per hour for each route\nCost_A = 2 * A * 60\nCost_B = 3 * B * 50\nCost_C = 4 * C * 40\nCost_D = 5 * D * 30\nCost_E = 6 * E * 20\n## So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for all routes.\nmodel.addCons(2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000)\n## The total number of trucks available is 50.\nmodel.addCons(A + B + C + D + E <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe delivery efficiency is measured by the total delivery time per route, which is affected by the number of trucks and the congestion level of each route. The congestion level increases nonlinearly with the number of trucks on the same route. The company aims to minimize the total delivery time across all routes.\n// Delivery_time_1 = C1 * (T1^2) / (T1 + 1)\n// Delivery_time_2 = C2 * (T2^2) / (T2 + 1)\n// Delivery_time_3 = C3 * (T3^2) / (T3 + 1)\n// Delivery_time_4 = C4 * (T4^2) / (T4 + 1)\n// Delivery_time_5 = C5 * (T5^2) / (T5 + 1)\n// Where C1, C2, C3, C4, C5 are constants representing the congestion levels of routes 1 to 5 respectively.\n// So, the objective function is: Minimize (Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks.\n// T1 <= 15; T2 <= 15; T3 <= 15; T4 <= 15; T5 <= 15\n\n## Generate Constraint-3:\nThe minimum number of trucks required on any route is 2.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. The delivery efficiency is measured by the total delivery time per route, which is affected by the number of trucks and the congestion level of each route. The congestion level increases nonlinearly with the number of trucks on the same route. The company aims to minimize the total delivery time across all routes. The company has a total of 50 trucks available. Each route can handle a maximum of 15 trucks. The minimum number of trucks required on any route is 2. Please help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The minimum number of trucks required on any route is 2.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1, C2, C3, C4, C5 = 1, 1, 1, 1, 1  # Placeholder values for congestion levels\nDelivery_time_1 = C1 * (T1**2) / (T1 + 1)\nDelivery_time_2 = C2 * (T2**2) / (T2 + 1)\nDelivery_time_3 = C3 * (T3**2) / (T3 + 1)\nDelivery_time_4 = C4 * (T4**2) / (T4 + 1)\nDelivery_time_5 = C5 * (T5**2) / (T5 + 1)\n## the objective function is: Minimize (Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\n## convert the division to multiplication\nmodel.addCons(obj == Delivery_time_1 + Delivery_time_2 + Delivery_time_3 + Delivery_time_4 + Delivery_time_5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## Each route can handle a maximum of 15 trucks.\nmodel.addCons(T1 <= 15)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 15)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for trucks in Region 1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for trucks in Region 3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck.\n// Total operational cost for Region 1: Cost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\n// Total operational cost for Region 2: Cost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\n// Total operational cost for Region 3: Cost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n// Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the fuel efficiency upgrades to invest in for each truck type. The company aims to minimize the total operational cost, which includes fuel costs and investment in fuel efficiency upgrades. The fuel cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. Specifically, for every $1000 invested in fuel efficiency, the fuel cost per kilometer decreases by 0.01 cents for each truck. The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\n\n| Region | Number of Trucks | Investment in Fuel Efficiency |\n|--------|------------------|--------------------------------|\n| 1      | Trucks1          | Efficiency1                    |\n| 2      | Trucks2          | Efficiency2                    |\n| 3      | Trucks3          | Efficiency3                    |\n\nPlease help the company to minimize the total operational cost, considering the nonlinear relationship between fuel efficiency investments and fuel costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for trucks in Region 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for trucks in Region 2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for trucks in Region 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitialFuelCost = 0.1  # assuming initial fuel cost per kilometer\nDistance1 = 1000  # assuming distance for Region 1\nDistance2 = 1500  # assuming distance for Region 2\nDistance3 = 2000  # assuming distance for Region 3\n## Total operational cost for each region\nCost1 = (InitialFuelCost - 0.00001 * Efficiency1) * Trucks1 * Distance1\nCost2 = (InitialFuelCost - 0.00001 * Efficiency2) * Trucks2 * Distance2\nCost3 = (InitialFuelCost - 0.00001 * Efficiency3) * Trucks3 * Distance3\n## the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck allocation and fuel efficiency investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region 1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Region 2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Region 3: \", model.getVal(Efficiency3))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\n// {\"number of trucks for short distance routes\": \"ShortDistance\", \"range\": \"ShortDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for medium distance routes\": \"MediumDistance\", \"range\": \"MediumDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for long distance routes\": \"LongDistance\", \"range\": \"LongDistance >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company wants to maximize the net daily profit from the fleet expansion.\n// NetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\n// NetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\n// NetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n// So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the fleet expansion.\n// 500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type. The operational cost and revenue generated per truck per day for each route type are given in the following Table.\n\n| Route Type       | Operational Cost per Truck per Day | Revenue Generated per Truck per Day |\n|------------------|------------------------------------|-------------------------------------|\n| Short Distance   | $500                               | $1000                               |\n| Medium Distance  | $800                               | $1500                               |\n| Long Distance    | $1200                              | $2000                               |\n\nThe company has a budget of $100,000 for the fleet expansion. Please help the company to maximize the net daily profit from the fleet expansion.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistance = model.addVar(vtype=\"INTEGER\", name=\"ShortDistance\", lb=0) # number of trucks for short distance routes\nMediumDistance = model.addVar(vtype=\"INTEGER\", name=\"MediumDistance\", lb=0) # number of trucks for medium distance routes\nLongDistance = model.addVar(vtype=\"INTEGER\", name=\"LongDistance\", lb=0) # number of trucks for long distance routes\n\n# Define objective function\nNetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\nNetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\nNetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n# Add constraints\nmodel.addCons(500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Short Distance Routes: \", model.getVal(ShortDistance))\n    print(\"Number of Trucks for Medium Distance Routes: \", model.getVal(MediumDistance))\n    print(\"Number of Trucks for Long Distance Routes: \", model.getVal(LongDistance))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product to optimize their profit. The production cost, selling price, and demand for each product vary.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (Selling Price - Production Cost) * ProductA - 0.01 * ProductA^2, where the selling price is $100 and the production cost is $60.\nThe profit for ProductB is calculated as (Selling Price - Production Cost) * ProductB - 0.02 * ProductB^2, where the selling price is $150 and the production cost is $100.\nThe profit for ProductC is calculated as (Selling Price - Production Cost) * ProductC - 0.015 * ProductC^2, where the selling price is $200 and the production cost is $120.\nThe company wants to maximize the total profit from all products.\n// Objective function: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC) = ((100 - 60) * ProductA - 0.01 * ProductA^2) + ((150 - 100) * ProductB - 0.02 * ProductB^2) + ((200 - 120) * ProductC - 0.015 * ProductC^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units in total for all products.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\n// ProductA >= 2 * ProductB\n\n## Generate Constraint-3:\nThe company has a budget constraint of $80,000 for production costs.\n// 60 * ProductA + 100 * ProductB + 120 * ProductC <= 80,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product to optimize their profit. The profit for ProductA is calculated as (Selling Price - Production Cost) * ProductA - 0.01 * ProductA^2, where the selling price is $100 and the production cost is $60. The profit for ProductB is calculated as (Selling Price - Production Cost) * ProductB - 0.02 * ProductB^2, where the selling price is $150 and the production cost is $100. The profit for ProductC is calculated as (Selling Price - Production Cost) * ProductC - 0.015 * ProductC^2, where the selling price is $200 and the production cost is $120. The company wants to maximize the total profit from all products.\nThe company has a limited production capacity of 1000 units in total for all products. Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB. The company has a budget constraint of $80,000 for production costs.\nPlease help the company to determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\n\n# Define objective function\n## The profit for ProductA is calculated as (Selling Price - Production Cost) * ProductA - 0.01 * ProductA^2\n## The profit for ProductB is calculated as (Selling Price - Production Cost) * ProductB - 0.02 * ProductB^2\n## The profit for ProductC is calculated as (Selling Price - Production Cost) * ProductC - 0.015 * ProductC^2\n## Objective function: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nProfit_ProductA = (100 - 60) * ProductA - 0.01 * ProductA**2\nProfit_ProductB = (150 - 100) * ProductB - 0.02 * ProductB**2\nProfit_ProductC = (200 - 120) * ProductC - 0.015 * ProductC**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n## The company has a limited production capacity of 1000 units in total for all products.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n## Due to market research, the company knows that the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductA >= 2 * ProductB)\n## The company has a budget constraint of $80,000 for production costs.\nmodel.addCons(60 * ProductA + 100 * ProductB + 120 * ProductC <= 80000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs.\n// {\"number of trips for Truck1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck varies with the number of trips it makes. For Truck1, the fuel efficiency is 0.5 + 0.01 * T1 (in gallons per mile). For Truck2, it's 0.6 + 0.01 * T2. For Truck3, it's 0.7 + 0.01 * T3. For Truck4, it's 0.8 + 0.01 * T4. For Truck5, it's 0.9 + 0.01 * T5. The operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost.\n// Fuel efficiency for Truck1: FE1 = 0.5 + 0.01 * T1\n// Fuel efficiency for Truck2: FE2 = 0.6 + 0.01 * T2\n// Fuel efficiency for Truck3: FE3 = 0.7 + 0.01 * T3\n// Fuel efficiency for Truck4: FE4 = 0.8 + 0.01 * T4\n// Fuel efficiency for Truck5: FE5 = 0.9 + 0.01 * T5\n// Total operational cost: Cost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach truck can make at most 30 trips.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nAt least 10 trips must be made by Truck1 and Truck2 combined.\n// T1 + T2 >= 10\n\n## Generate Constraint-4:\nThe total number of trips for Truck3 and Truck4 must be at least 20.\n// T3 + T4 >= 20\n\n## Generate Constraint-5:\nThe number of trips for Truck5 must be at least twice the number of trips for Truck1.\n// T5 >= 2 * T1",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods across different regions. The company needs to decide how many trips each truck should make to optimize fuel efficiency and minimize overall operational costs. The fuel efficiency of each truck, which varies with the number of trips it makes, is given in the following Table.\n\n| Truck | Fuel Efficiency (gallons per mile) |\n|-------|-----------------------------------|\n| Truck1 | 0.5 + 0.01 * T1 |\n| Truck2 | 0.6 + 0.01 * T2 |\n| Truck3 | 0.7 + 0.01 * T3 |\n| Truck4 | 0.8 + 0.01 * T4 |\n| Truck5 | 0.9 + 0.01 * T5 |\n\nThe operational cost is the total fuel consumed per mile multiplied by the total miles traveled. The company wants to minimize the total operational cost. The following constraints apply:\n- The total number of trips across all trucks must not exceed 100.\n- Each truck can make at most 30 trips.\n- At least 10 trips must be made by Truck1 and Truck2 combined.\n- The total number of trips for Truck3 and Truck4 must be at least 20.\n- The number of trips for Truck5 must be at least twice the number of trips for Truck1.\n\nPlease help the company to determine the optimal number of trips for each truck to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=30) # number of trips for Truck1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=30) # number of trips for Truck2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=30) # number of trips for Truck3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=30) # number of trips for Truck4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=30) # number of trips for Truck5\n\n# Define objective function\nFE1 = 0.5 + 0.01 * T1\nFE2 = 0.6 + 0.01 * T2\nFE3 = 0.7 + 0.01 * T3\nFE4 = 0.8 + 0.01 * T4\nFE5 = 0.9 + 0.01 * T5\nCost = (1000 / FE1) * T1 + (1000 / FE2) * T2 + (1000 / FE3) * T3 + (1000 / FE4) * T4 + (1000 / FE5) * T5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 + T2 >= 10)\nmodel.addCons(T3 + T4 >= 20)\nmodel.addCons(T5 >= 2 * T1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck1: \", model.getVal(T1))\n    print(\"Number of trips for Truck2: \", model.getVal(T2))\n    print(\"Number of trips for Truck3: \", model.getVal(T3))\n    print(\"Number of trips for Truck4: \", model.getVal(T4))\n    print(\"Number of trips for Truck5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\n// NetProfit_Small = (200 - 50) * SmallVehicles\n// NetProfit_Medium = (300 - 75) * MediumVehicles\n// NetProfit_Large = (400 - 100) * LargeVehicles\n// So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs.\n// 50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000\n\n## Generate Constraint-2:\nThe company has a limited parking space that can accommodate a maximum of 100 vehicles.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 100\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all vehicles must not exceed 1000 units. The emission rate per vehicle is 5 units for small, 10 units for medium, and 15 units for large.\n// 5 * SmallVehicles + 10 * MediumVehicles + 15 * LargeVehicles <= 1000\n\n## Generate Constraint-4:\nThe company has a contract that requires at least 20 trips per day. Each small vehicle can make 1 trip, each medium vehicle can make 2 trips, and each large vehicle can make 3 trips.\n// SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles >= 20",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The profit per trip and operational cost per vehicle per day for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Profit per Trip | Operational Cost per Day |\n|--------------|-----------------|--------------------------|\n| Small        | $200            | $50                      |\n| Medium       | $300            | $75                      |\n| Large        | $400            | $100                     |\n\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs. The company has a limited parking space that can accommodate a maximum of 100 vehicles. Due to environmental regulations, the total emissions from all vehicles must not exceed 1000 units. The emission rate per vehicle is 5 units for small, 10 units for medium, and 15 units for large. The company has a contract that requires at least 20 trips per day. Each small vehicle can make 1 trip, each medium vehicle can make 2 trips, and each large vehicle can make 3 trips.\n\nPlease help the company to maximize the net daily profit from all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nNetProfit_Small = (200 - 50) * SmallVehicles\nNetProfit_Medium = (300 - 75) * MediumVehicles\nNetProfit_Large = (400 - 100) * LargeVehicles\n# So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n# Add constraints\n# The company has a total budget of $5000 per day for vehicle maintenance and operational costs.\nmodel.addCons(50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000)\n# The company has a limited parking space that can accommodate a maximum of 100 vehicles.\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 100)\n# Due to environmental regulations, the total emissions from all vehicles must not exceed 1000 units.\nmodel.addCons(5 * SmallVehicles + 10 * MediumVehicles + 15 * LargeVehicles <= 1000)\n# The company has a contract that requires at least 20 trips per day.\nmodel.addCons(SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of ProductA: ProfitA = (100 - 40) * QuantityA\n// Profit of ProductB: ProfitB = (120 - 50) * QuantityB\n// Profit of ProductC: ProfitC = (150 - 60) * QuantityC\n// Profit of ProductD: ProfitD = (200 - 80) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / (5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product to maximize profit while considering the cost of raw materials and the time required for production.\nThe selling price of ProductA is $100, the raw material cost is $40, and the production time is 5 hours. For ProductB, the selling price is $120, the raw material cost is $50, and the production time is 6 hours. For ProductC, the selling price is $150, the raw material cost is $60, and the production time is 7 hours. For ProductD, the selling price is $200, the raw material cost is $80, and the production time is 8 hours. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\nThe company has a budget of $10,000 for raw materials.\nPlease help the company determine the optimal production quantities for each product to maximize the profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 40) * QuantityA\nProfitB = (120 - 50) * QuantityB\nProfitC = (150 - 60) * QuantityC\nProfitD = (200 - 80) * QuantityD\nProductionTime = 5 * QuantityA + 6 * QuantityB + 7 * QuantityC + 8 * QuantityD\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(40 * QuantityA + 50 * QuantityB + 60 * QuantityC + 80 * QuantityD <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Production Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs.\n// {\"number of trucks for RegionA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RegionE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck.\n// Total net profit for RegionA: Profit_A = (100,000 - 50,000) * TrucksA\n// Total net profit for RegionB: Profit_B = (120,000 - 60,000) * TrucksB\n// Total net profit for RegionC: Profit_C = (140,000 - 70,000) * TrucksC\n// Total net profit for RegionD: Profit_D = (160,000 - 80,000) * TrucksD\n// Total net profit for RegionE: Profit_E = (180,000 - 90,000) * TrucksE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regional regulations, RegionA must have at least 10% of the total trucks.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-3:\nThe company has a budget of $2,000,000 for operating costs for the quarter.\n// 50,000 * TrucksA + 60,000 * TrucksB + 70,000 * TrucksC + 80,000 * TrucksD + 90,000 * TrucksE <= 2,000,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across five different regions: RegionA, RegionB, RegionC, RegionD, and RegionE. They need to determine the number of trucks to allocate to each region to maximize efficiency while minimizing costs. The cost of operating a truck in RegionA is $50,000, in RegionB is $60,000, in RegionC is $70,000, in RegionD is $80,000, and in RegionE is $90,000. The revenue generated per truck in RegionA is $100,000, in RegionB is $120,000, in RegionC is $140,000, in RegionD is $160,000, and in RegionE is $180,000. The company wants to maximize the net profit per truck. The company has a total of 40 trucks available for allocation. Due to regional regulations, RegionA must have at least 10% of the total trucks. The company has a budget of $2,000,000 for operating costs for the quarter. Please help the company to maximize the net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RegionA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RegionB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RegionC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RegionD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RegionE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100000 - 50000) * TrucksA\nProfit_B = (120000 - 60000) * TrucksB\nProfit_C = (140000 - 70000) * TrucksC\nProfit_D = (160000 - 80000) * TrucksD\nProfit_E = (180000 - 90000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regional regulations, RegionA must have at least 10% of the total trucks.\nmodel.addCons(TrucksA >= 0.1 * TotalTrucks)\n## The company has a budget of $2,000,000 for operating costs for the quarter.\nmodel.addCons(50000 * TrucksA + 60000 * TrucksB + 70000 * TrucksC + 80000 * TrucksD + 90000 * TrucksE <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RegionA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RegionB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RegionC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RegionD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RegionE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints such as production capacity, market demand, and material availability.\n// {\"quantity of Smartphones\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100. For Tablets, it is $150. For Laptops, it is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production exceeds 100 units. The manufacturer wants to maximize the total profit from selling these devices.\n// Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\n// So, the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a rare metal. Smartphones require 5 g, Tablets require 8 g, and Laptops require 10 g of this metal. The total available amount of this metal is 1000 g.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units. For Tablets, it is 300 units. For Laptops, it is 200 units.\n// Smartphone <= 500; Tablet <= 300; Laptop <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 800 units across all device types.\n// Smartphone + Tablet + Laptop <= 800",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints such as production capacity, market demand, and material availability.\nThe profit per unit for Smartphones is $100. For Tablets, it is $150. For Laptops, it is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production exceeds 100 units. The manufacturer wants to maximize the total profit from selling these devices.\nThe production of each device requires a certain amount of a rare metal. Smartphones require 5 g, Tablets require 8 g, and Laptops require 10 g of this metal. The total available amount of this metal is 1000 g.\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units. For Tablets, it is 300 units. For Laptops, it is 200 units.\nThe manufacturer has a total production capacity of 800 units across all device types.\nPlease help the manufacturer to determine the optimal production quantities of Smartphones, Tablets, and Laptops to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # quantity of Smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # quantity of Tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\nSmartphone1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone1\", lb=0, ub=100)\nSmartphone2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone2\", lb=100, ub=500)\nSmartphone_b1 = model.addVar(vtype=\"B\", name=\"Smartphone_b1\")\nSmartphone_b2 = model.addVar(vtype=\"B\", name=\"Smartphone_b2\")\nmodel.addCons(Smartphone_b1 + Smartphone_b2 == 1)\nmodel.addCons(Smartphone == Smartphone1*Smartphone_b1 + Smartphone2*Smartphone_b2)\nProfit_Smartphone = 100 * Smartphone1 * Smartphone_b1 + (100 + 0.5 * (Smartphone2 - 100)) * Smartphone2 * Smartphone_b2\n\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=300)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n\n## create piecewise variables for piecewise function: Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=200)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 200 * Laptop1 * Laptop_b1 + (200 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Smartphone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(Smartphone <= 500)\nmodel.addCons(Tablet <= 300)\nmodel.addCons(Laptop <= 200)\nmodel.addCons(Smartphone + Tablet + Laptop <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(Smartphone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\n// Corn <= Wheat + Soybeans\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\n// Barley <= Corn + Wheat + Soybeans",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The profit per acre and the risk of crop failure for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Risk of Crop Failure |\n|------------|-----------------|----------------------|\n| Corn       | $200            | 5%                   |\n| Wheat      | $180            | 3%                   |\n| Soybeans   | $220            | 4%                   |\n| Barley     | $150            | 6%                   |\n| Oats       | $160            | 2%                   |\n\nThe farmer wants to maximize his Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk. The farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans. The farmer also wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\n\nPlease help the farmer to determine the optimal allocation of acres to each crop to maximize the Profit-Risk ratio per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\nmodel.addCons(Corn <= Wheat + Soybeans)\n## The farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\nmodel.addCons(Barley <= Corn + Wheat + Soybeans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop rotation for the next season and has identified five crops to plant: Wheat, Corn, Soybeans, Barley, and Oats. Each crop has different requirements for land area, water usage, and labor hours.\n// {\"hectares of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"hectares of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"hectares of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"hectares of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"hectares of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize the net profit per labor hour. The net profit for each crop is calculated by subtracting the cost of production from the revenue. The revenue and cost for each crop are as follows:\n- Wheat: Revenue = $200 per hectare, Cost = $100 per hectare\n- Corn: Revenue = $300 per hectare, Cost = $150 per hectare\n- Soybeans: Revenue = $250 per hectare, Cost = $120 per hectare\n- Barley: Revenue = $180 per hectare, Cost = $90 per hectare\n- Oats: Revenue = $150 per hectare, Cost = $75 per hectare\nThe labor hours required for each hectare are:\n- Wheat: 5 hours\n- Corn: 8 hours\n- Soybeans: 6 hours\n- Barley: 4 hours\n- Oats: 3 hours\nThe objective function is to maximize the net profit per labor hour, which is defined as the total net profit divided by the total labor hours.\n// Net profit of Wheat: Profit_Wheat = (200 - 100) * Wheat\n// Net profit of Corn: Profit_Corn = (300 - 150) * Corn\n// Net profit of Soybeans: Profit_Soybeans = (250 - 120) * Soybeans\n// Net profit of Barley: Profit_Barley = (180 - 90) * Barley\n// Net profit of Oats: Profit_Oats = (150 - 75) * Oats\n// Total labor hours: Hours = 5 * Wheat + 8 * Corn + 6 * Soybeans + 4 * Barley + 3 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / Hours\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available for planting.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10,000 for crop production costs.\n// 100 * Wheat + 150 * Corn + 120 * Soybeans + 90 * Barley + 75 * Oats <= 10000",
        "question": "A farmer is planning his crop rotation for the next season and has identified five crops to plant: Wheat, Corn, Soybeans, Barley, and Oats. Each crop has different requirements for land area, water usage, and labor hours. The revenue, cost of production, and labor hours required for each hectare of each crop are given in the following Table.\n\n| Crop       | Revenue per Hectare | Cost per Hectare | Labor Hours per Hectare |\n|------------|---------------------|------------------|-------------------------|\n| Wheat      | $200                | $100             | 5 hours                 |\n| Corn       | $300                | $150             | 8 hours                 |\n| Soybeans   | $250                | $120             | 6 hours                 |\n| Barley     | $180                | $90              | 4 hours                 |\n| Oats       | $150                | $75              | 3 hours                 |\n\nThe farmer has 100 hectares of land available for planting and a budget of $10,000 for crop production costs. The farmer aims to maximize the net profit per labor hour, which is defined as the total net profit divided by the total labor hours. Please help the farmer determine how many hectares of each crop to plant to achieve this objective.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # hectares of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # hectares of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # hectares of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # hectares of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # hectares of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = (200 - 100) * Wheat\nProfit_Corn = (300 - 150) * Corn\nProfit_Soybeans = (250 - 120) * Soybeans\nProfit_Barley = (180 - 90) * Barley\nProfit_Oats = (150 - 75) * Oats\nHours = 5 * Wheat + 8 * Corn + 6 * Soybeans + 4 * Barley + 3 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / Hours\n## convert the division to multiplication\nmodel.addCons(obj * Hours == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The farmer has a budget of $10,000 for crop production costs.\nmodel.addCons(100 * Wheat + 150 * Corn + 120 * Soybeans + 90 * Barley + 75 * Oats <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Wheat: \", model.getVal(Wheat))\n    print(\"Hectares of Corn: \", model.getVal(Corn))\n    print(\"Hectares of Soybeans: \", model.getVal(Soybeans))\n    print(\"Hectares of Barley: \", model.getVal(Barley))\n    print(\"Hectares of Oats: \", model.getVal(Oats))\n    print(\"Maximized Net Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $20, and the storage cost per unit is $5.\nFor Product B, the profit per unit is $30, and the storage cost per unit is $7.\nFor Product C, the profit per unit is $40, and the storage cost per unit is $9.\nFor Product D, the profit per unit is $50, and the storage cost per unit is $11.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Net profit of A: Net_Profit_A = (20 - 5) * A\n// Net profit of B: Net_Profit_B = (30 - 7) * B\n// Net profit of C: Net_Profit_C = (40 - 9) * C\n// Net profit of D: Net_Profit_D = (50 - 11) * D\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 1000 units.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 1000\n\n## Generate Constraint-2:\nThe company has a transportation budget that allows for the distribution of at most 200 units.\n// A + B + C + D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\n// C <= A + B",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\nFor Product A, the profit per unit is $20, and the storage cost per unit is $5.\nFor Product B, the profit per unit is $30, and the storage cost per unit is $7.\nFor Product C, the profit per unit is $40, and the storage cost per unit is $9.\nFor Product D, the profit per unit is $50, and the storage cost per unit is $11.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\nThe company has a total storage capacity of 1000 units. The company has a transportation budget that allows for the distribution of at most 200 units. The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\nPlease help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## Net profit of A: Net_Profit_A = (20 - 5) * A\n## Net profit of B: Net_Profit_B = (30 - 7) * B\n## Net profit of C: Net_Profit_C = (40 - 9) * C\n## Net profit of D: Net_Profit_D = (50 - 11) * D\nNet_Profit_A = (20 - 5) * A\nNet_Profit_B = (30 - 7) * B\nNet_Profit_C = (40 - 9) * C\nNet_Profit_D = (50 - 11) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D)\n\n# Add constraints\n## The company has a total storage capacity of 1000 units.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 1000)\n## The company has a transportation budget that allows for the distribution of at most 200 units.\nmodel.addCons(A + B + C + D <= 200)\n## The company wants to ensure that the distribution of Product C does not exceed the combined distribution of Products A and B.\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates three types of vehicles: TruckA, TruckB, and TruckC. Each vehicle type has different fuel efficiency and capacity. The company needs to decide how many trips each vehicle type will make and the amount of money to be invested in improving the fuel efficiency of each vehicle type.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost for all vehicles. The fuel cost per trip for TruckA is $100, but with investment in fuel efficiency, the cost decreases by $5 for every $100 invested. The fuel cost per trip for TruckB is $150, and with investment in fuel efficiency, the cost decreases by $7 for every $100 invested. The fuel cost per trip for TruckC is $200, and with investment in fuel efficiency, the cost decreases by $10 for every $100 invested.\n// Total fuel cost for TruckA: CostA = (100 - 0.05 * EfficiencyA) * TripsA\n// Total fuel cost for TruckB: CostB = (150 - 0.07 * EfficiencyB) * TripsB\n// Total fuel cost for TruckC: CostC = (200 - 0.1 * EfficiencyC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs.\n// 100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicle types must not exceed 500.\n// TripsA + TripsB + TripsC <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips.\n// TripsA >= 50; TripsB >= 100\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for any vehicle type should not exceed $5,000.\n// EfficiencyA <= 5000\n// EfficiencyB <= 5000\n// EfficiencyC <= 5000",
        "question": "A logistics company is planning its routes for the next quarter and needs to decide how many trips each of its three vehicle types (TruckA, TruckB, and TruckC) will make, as well as the amount of money to be invested in improving the fuel efficiency of each vehicle type. The fuel cost per trip and the impact of investment on fuel efficiency for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Cost per Trip | Investment Impact on Fuel Efficiency |\n|--------------|--------------------|---------------------------------------|\n| TruckA       | $100               | $5 reduction per $100 invested        |\n| TruckB       | $150               | $7 reduction per $100 invested        |\n| TruckC       | $200               | $10 reduction per $100 invested       |\n\nThe company has a budget of $20,000 for investments in fuel efficiency and operational costs. The total number of trips across all vehicle types must not exceed 500. Due to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips. The investment in fuel efficiency for any vehicle type should not exceed $5,000.\n\nPlease help the company to minimize the total fuel cost for all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=50)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=100)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for TruckC\n\n# Define objective function\nCostA = (100 - 0.05 * EfficiencyA) * TripsA\nCostB = (150 - 0.07 * EfficiencyB) * TripsB\nCostC = (200 - 0.1 * EfficiencyC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a budget of $20,000 for investments in fuel efficiency and operational costs.\nmodel.addCons(100 * TripsA + 150 * TripsB + 200 * TripsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n# The total number of trips across all vehicle types must not exceed 500.\nmodel.addCons(TripsA + TripsB + TripsC <= 500)\n# Due to maintenance schedules, TruckA must make at least 50 trips and TruckB must make at least 100 trips.\nmodel.addCons(TripsA >= 50)\nmodel.addCons(TripsB >= 100)\n# The investment in fuel efficiency for any vehicle type should not exceed $5,000.\nmodel.addCons(EfficiencyA <= 5000)\nmodel.addCons(EfficiencyB <= 5000)\nmodel.addCons(EfficiencyC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Fuel Efficiency for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\n// {\"trips of V1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"trips of V2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"trips of V3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed).\n// Profit_V1 = 150 * V1 - 100 * V1\n// Profit_V2 = 180 * V2 - 120 * V2\n// Profit_V3 = 210 * V3 - 140 * V3\n// So, the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / (5 * V1 + 6 * V2 + 7 * V3)\n\n## Generate Constraint-1:\nThe company has a limited fuel budget of 500 liters.\n// 5 * V1 + 6 * V2 + 7 * V3 <= 500",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: V1, V2, and V3. They need to determine the number of trips each vehicle should make to optimize their operations.\nFor V1, the cost per trip is $100, the fuel consumption per trip is 5 liters, and the revenue per trip is $150.\nFor V2, the cost per trip is $120, the fuel consumption per trip is 6 liters, and the revenue per trip is $180.\nFor V3, the cost per trip is $140, the fuel consumption per trip is 7 liters, and the revenue per trip is $210.\nThe company wants to maximize the profit efficiency (profit per liter of fuel consumed). The company has a limited fuel budget of 500 liters.\nPlease help the company determine the optimal number of trips for each vehicle.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # trips of V1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # trips of V2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # trips of V3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_V1 = (150 - 100) * V1\nProfit_V2 = (180 - 120) * V2\nProfit_V3 = (210 - 140) * V3\nFuelConsumption = 5 * V1 + 6 * V2 + 7 * V3\n## the objective function is: Maximize (Profit_V1 + Profit_V2 + Profit_V3) / FuelConsumption\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit_V1 + Profit_V2 + Profit_V3)\n\n# Add constraints\n## The company has a limited fuel budget of 500 liters.\nmodel.addCons(5 * V1 + 6 * V2 + 7 * V3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for V1: \", model.getVal(V1))\n    print(\"Number of Trips for V2: \", model.getVal(V2))\n    print(\"Number of Trips for V3: \", model.getVal(V3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 758,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting service requirements.\n// {\"number of trucks of Type1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of Type2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of Type3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Type1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Type2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Type3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. For Type1 trucks, the operational cost is $100 per km, decreasing by $1 per km for every $100 invested in technology. For Type2 trucks, the operational cost is $120 per km, decreasing by $1.2 per km for every $100 invested in technology. For Type3 trucks, the operational cost is $150 per km, decreasing by $1.5 per km for every $100 invested in technology. The company aims to minimize the total operational cost across all truck types.\n// Operational cost for Type1: Cost1 = (100 - 0.01 * Tech1) * Trucks1\n// Operational cost for Type2: Cost2 = (120 - 0.012 * Tech2) * Trucks2\n// Operational cost for Type3: Cost3 = (150 - 0.015 * Tech3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting service requirements. The operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. The operational costs and the reduction in cost per $100 invested in technology for each truck type are given in the following Table.\n\n| Truck Type | Operational Cost per km | Reduction in Cost per $100 Invested |\n|------------|-------------------------|-------------------------------------|\n| Type1      | $100                    | $1                                  |\n| Type2      | $120                    | $1.2                                |\n| Type3      | $150                    | $1.5                                |\n\nThe company has a total budget of $100,000 for truck allocations and technology investments. The total number of trucks available for allocation is limited to 500. Please help the company to minimize the total operational cost across all truck types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks of Type1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks of Type2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks of Type3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Type1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Type2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for Type3\n\n# Define objective function\nCost1 = (100 - 0.01 * Tech1) * Trucks1\nCost2 = (120 - 0.012 * Tech2) * Trucks2\nCost3 = (150 - 0.015 * Tech3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\n# The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Type1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks Type2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks Type3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech Type1: \", model.getVal(Tech1))\n    print(\"Investment in Tech Type2: \", model.getVal(Tech2))\n    print(\"Investment in Tech Type3: \", model.getVal(Tech3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each city are given in the following Table.\n\n| City | Fuel Consumption per Truck | Travel Time per Truck |\n|------|---------------------------|----------------------|\n| A    | 50 liters                 | 4 hours              |\n| B    | 60 liters                 | 5 hours              |\n| C    | 70 liters                 | 6 hours              |\n| D    | 80 liters                 | 7 hours              |\n| E    | 90 liters                 | 8 hours              |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city. Please help the company to minimize the total fuel consumption and travel time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each city.\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\n## The company aims to minimize the total fuel consumption and travel time.\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n## So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 993,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a revenue per trip of $1000, a fuel cost per trip of $200, and a maintenance cost per trip of $100.\nTruck B has a revenue per trip of $1500, a fuel cost per trip of $300, and a maintenance cost per trip of $150.\nTruck C has a revenue per trip of $2000, a fuel cost per trip of $400, and a maintenance cost per trip of $200.\nThe company wants to maximize the net profit per trip across all vehicles.\n// Profit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\n// Profit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\n// Profit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000\n\n## Generate Constraint-2:\nThe company has a total budget of $5000 for maintenance costs per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-3:\nThe company has a limited fleet size of 50 vehicles in total.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-4:\nThe company has a daily operational limit of 100 trips.\n// TruckA + 1.5 * TruckB + 2 * TruckC <= 100",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different revenue per trip, fuel cost per trip, and maintenance cost per trip. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The details for each vehicle are given in the following Table.\n\n| Vehicle | Revenue per Trip | Fuel Cost per Trip | Maintenance Cost per Trip |\n|---------|------------------|--------------------|---------------------------|\n| Truck A | $1000            | $200               | $100                      |\n| Truck B | $1500            | $300               | $150                      |\n| Truck C | $2000            | $400               | $200                      |\n\nThe company has a total budget of $10,000 for fuel costs per day and $5000 for maintenance costs per day. The company has a limited fleet size of 50 vehicles in total and a daily operational limit of 100 trips. Please help the company to maximize the net profit per trip across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 1000 * TruckA - 200 * TruckA - 100 * TruckA\nProfit_TruckB = 1500 * TruckB - 300 * TruckB - 150 * TruckB\nProfit_TruckC = 2000 * TruckC - 400 * TruckC - 200 * TruckC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(200 * TruckA + 300 * TruckB + 400 * TruckC <= 10000)\n# The company has a total budget of $5000 for maintenance costs per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n# The company has a limited fleet size of 50 vehicles in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# The company has a daily operational limit of 100 trips.\nmodel.addCons(TruckA + 1.5 * TruckB + 2 * TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Net Profit per Trip: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The company aims to maximize the total profit from distributing these products. However, the profit rate is affected by the storage and transportation costs, which are nonlinear functions of the number of units. The storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Storage cost of A: Storage_A = 0.1 * A^2\n// Storage cost of B: Storage_B = 0.1 * B^2\n// Storage cost of C: Storage_C = 0.1 * C^2\n// Storage cost of D: Storage_D = 0.1 * D^2\n// Transportation cost of A: Trans_A = 0.01 * A^3\n// Transportation cost of B: Trans_B = 0.01 * B^3\n// Transportation cost of C: Trans_C = 0.01 * C^3\n// Transportation cost of D: Trans_D = 0.01 * D^3\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\n\n## Generate Constraint-1:\nThe total storage space available for all products is limited to 1000 square units.\n// 0.1 * A^2 + 0.1 * B^2 + 0.1 * C^2 + 0.1 * D^2 <= 1000\n\n## Generate Constraint-2:\nThe total transportation capacity is limited to 5000 cubic units.\n// 0.01 * A^3 + 0.01 * B^3 + 0.01 * C^3 + 0.01 * D^3 <= 5000",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $20             |\n| B       | $30             |\n| C       | $40             |\n| D       | $50             |\n\nThe storage cost for each product is proportional to the square of the number of units, and the transportation cost is proportional to the cube of the number of units. The company wants to maximize the net profit rate, which is the total profit minus the total storage and transportation costs.\n\nThe total storage space available for all products is limited to 1000 square units. The total transportation capacity is limited to 5000 cubic units.\n\nPlease help the company to maximize the net profit rate, considering the nonlinear storage and transportation costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nStorage_A = 0.1 * A**2\nStorage_B = 0.1 * B**2\nStorage_C = 0.1 * C**2\nStorage_D = 0.1 * D**2\nTrans_A = 0.01 * A**3\nTrans_B = 0.01 * B**3\nTrans_C = 0.01 * C**3\nTrans_D = 0.01 * D**3\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D - (Storage_A + Storage_B + Storage_C + Storage_D + Trans_A + Trans_B + Trans_C + Trans_D))\n\n# Add constraints\n## The total storage space available for all products is limited to 1000 square units.\nmodel.addCons(0.1 * A**2 + 0.1 * B**2 + 0.1 * C**2 + 0.1 * D**2 <= 1000)\n## The total transportation capacity is limited to 5000 cubic units.\nmodel.addCons(0.01 * A**3 + 0.01 * B**3 + 0.01 * C**3 + 0.01 * D**3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, clothing, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for clothing\": \"ClothingSpeed\", \"range\": \"ClothingSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road.\n// FuelConsumption_Electronics = ElectronicsTrucks * ElectronicsSpeed^2\n// FuelConsumption_Clothing = ClothingTrucks * ClothingSpeed^2\n// FuelConsumption_Perishables = PerishablesTrucks * PerishablesSpeed^2\n// Time_Electronics = Distance / ElectronicsSpeed\n// Time_Clothing = Distance / ClothingSpeed\n// Time_Perishables = Distance / PerishablesSpeed\n// So, the objective function is: Minimize (FuelConsumption_Electronics + FuelConsumption_Clothing + FuelConsumption_Perishables + Time_Electronics + Time_Clothing + Time_Perishables)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// FuelConsumption_Electronics * CostPerUnitFuel_Electronics + FuelConsumption_Clothing * CostPerUnitFuel_Clothing + FuelConsumption_Perishables * CostPerUnitFuel_Perishables <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available for all types of goods is limited to 50.\n// ElectronicsTrucks + ClothingTrucks + PerishablesTrucks <= 50\n\n## Generate Constraint-3:\nThe average speed of trucks transporting perishables must be at least 60 km/h to ensure timely delivery.\n// PerishablesSpeed >= 60\n\n## Generate Constraint-4:\nThe total time spent on the road for all trucks should not exceed 1000 hours per day.\n// Time_Electronics + Time_Clothing + Time_Perishables <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, clothing, and perishables. The company needs to decide the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption of each truck is modeled as a nonlinear function of its speed, where fuel consumption increases nonlinearly with speed. The company aims to minimize the total fuel consumption and time spent on the road. The company has a total budget of $10,000 for fuel costs per day. The total number of trucks available for all types of goods is limited to 50. The average speed of trucks transporting perishables must be at least 60 km/h to ensure timely delivery. The total time spent on the road for all trucks should not exceed 1000 hours per day.\n\nPlease help the company to minimize the total fuel consumption and time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ElectronicsSpeed\", lb=0)\nClothingSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"ClothingSpeed\", lb=0)\nPerishablesSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishablesSpeed\", lb=60)\n\n# Define objective function\nFuelConsumption_Electronics = ElectronicsTrucks * ElectronicsSpeed**2\nFuelConsumption_Clothing = ClothingTrucks * ClothingSpeed**2\nFuelConsumption_Perishables = PerishablesTrucks * PerishablesSpeed**2\nTime_Electronics = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Electronics\")\nTime_Clothing = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Clothing\")\nTime_Perishables = model.addVar(vtype=\"CONTINUOUS\", name=\"Time_Perishables\")\nmodel.addCons(Time_Electronics == 1 / ElectronicsSpeed)\nmodel.addCons(Time_Clothing == 1 / ClothingSpeed)\nmodel.addCons(Time_Perishables == 1 / PerishablesSpeed)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_Electronics + FuelConsumption_Clothing + FuelConsumption_Perishables + Time_Electronics + Time_Clothing + Time_Perishables)\n\n# Add constraints\nCostPerUnitFuel_Electronics = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerUnitFuel_Electronics\")\nCostPerUnitFuel_Clothing = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerUnitFuel_Clothing\")\nCostPerUnitFuel_Perishables = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerUnitFuel_Perishables\")\nmodel.addCons(FuelConsumption_Electronics * CostPerUnitFuel_Electronics + FuelConsumption_Clothing * CostPerUnitFuel_Clothing + FuelConsumption_Perishables * CostPerUnitFuel_Perishables <= 10000)\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + PerishablesTrucks <= 50)\nmodel.addCons(PerishablesSpeed >= 60)\nmodel.addCons(Time_Electronics + Time_Clothing + Time_Perishables <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Electronics Trucks: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Clothing Trucks: \", model.getVal(ClothingTrucks))\n    print(\"Number of Perishables Trucks: \", model.getVal(PerishablesTrucks))\n    print(\"Electronics Speed: \", model.getVal(ElectronicsSpeed))\n    print(\"Clothing Speed: \", model.getVal(ClothingSpeed))\n    print(\"Perishables Speed: \", model.getVal(PerishablesSpeed))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit. Additionally, the company is considering outsourcing some of the production to external contractors.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"OutsourceA\", \"range\": \"OutsourceA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"OutsourceB\", \"range\": \"OutsourceB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"OutsourceC\", \"range\": \"OutsourceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nThe company aims to maximize the total profit, considering both in-house production and outsourcing.\n// Profit from DeviceA: Profit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\n// Profit from DeviceB: Profit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\n// Profit from DeviceC: Profit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units for all devices combined.\n// DeviceA + DeviceB + DeviceC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit, and is also considering outsourcing some of the production to external contractors. The selling price, production cost, and outsourcing cost for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Outsourcing Cost |\n|--------|---------------|-----------------|------------------|\n| DeviceA | $100          | $60             | $80              |\n| DeviceB | $150          | $90             | $110             |\n| DeviceC | $200          | $120            | $140             |\n\nThe company has a production capacity of 500 units for all devices combined. The company aims to maximize the total profit, considering both in-house production and outsourcing. Please help the company determine the optimal number of units to produce and outsource for each device to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nOutsourceA = model.addVar(vtype=\"INTEGER\", name=\"OutsourceA\", lb=0) # number of units outsourced for DeviceA\nOutsourceB = model.addVar(vtype=\"INTEGER\", name=\"OutsourceB\", lb=0) # number of units outsourced for DeviceB\nOutsourceC = model.addVar(vtype=\"INTEGER\", name=\"OutsourceC\", lb=0) # number of units outsourced for DeviceC\n\n# Define objective function\nProfit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\nProfit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\nProfit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a production capacity of 500 units for all devices combined.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of units outsourced for DeviceA: \", model.getVal(OutsourceA))\n    print(\"Number of units outsourced for DeviceB: \", model.getVal(OutsourceB))\n    print(\"Number of units outsourced for DeviceC: \", model.getVal(OutsourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200\n\n## Generate Constraint-3:\nThe company wants to produce at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15; E >= 15\n\n## Generate Constraint-4:\nThe production of product D should not exceed the combined production of products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe production of product E should not exceed the combined production of products A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. The profit margin and production time for each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Production Time per Unit |\n|---------|------------------------|--------------------------|\n| A       | $5                     | 1 hour                   |\n| B       | $7                     | 2 hours                  |\n| C       | $9                     | 3 hours                  |\n| D       | $11                    | 4 hours                  |\n| E       | $13                    | 5 hours                  |\n\nThe company has a budget of $1500 for raw materials. The company has a production capacity of 200 hours. The company wants to produce at least 15 units of each product. The production of product D should not exceed the combined production of products A, B, and C. The production of product E should not exceed the combined production of products A, B, C, and D. \nPlease help the company to maximize the total profit per unit of time (profit rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 15 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=15) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n## The production of product D should not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The production of product E should not exceed the combined production of products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n// NetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\n// NetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\n// NetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n// So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all wind farms is $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limit of 100 turbines that can be installed across all types.\n// Turbines1 + Turbines2 + Turbines3 <= 100\n\n## Generate Constraint-3:\nDue to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\n// Turbines1 >= 20; Turbines2 >= 30\n\n## Generate Constraint-4:\nThe maximum maintenance investment for Type1 is $50,000, for Type2 is $60,000, and for Type3 is $70,000.\n// Maintenance1 <= 50000; Maintenance2 <= 60000; Maintenance3 <= 70000",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment, with each $1000 investment increasing the output as follows: Type1 by 1 MWh, Type2 by 1.5 MWh, and Type3 by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n\n| Wind Farm Type | Maintenance Investment Impact per $1000 | Operational Cost per MWh |\n|-----------------|-----------------------------------------|--------------------------|\n| Type1           | Increases output by 1 MWh               | $50                      |\n| Type2           | Increases output by 1.5 MWh              | $40                      |\n| Type3           | Increases output by 2 MWh                | $30                      |\n\nThe total maintenance budget for all wind farms is $100,000. The company has a limit of 100 turbines that can be installed across all types. Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2. The maximum maintenance investment for Type1 is $50,000, for Type2 is $60,000, and for Type3 is $70,000.\n\nPlease help the company to maximize the net profit from energy sales by determining the optimal number of turbines and maintenance investments for each type of wind farm.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=20)  # number of turbines for Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=30)  # number of turbines for Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)    # number of turbines for Type3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0, ub=50000)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0, ub=60000)  # maintenance investment for Type2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0, ub=70000)  # maintenance investment for Type3\n\n# Define objective function\nNetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\nNetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\nNetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n# So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit1 + NetProfit2 + NetProfit3)\n\n# Add constraints\n# The total maintenance budget for all wind farms is $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n# The company has a limit of 100 turbines that can be installed across all types.\nmodel.addCons(Turbines1 + Turbines2 + Turbines3 <= 100)\n# Due to regulatory requirements, at least 20 turbines must be of Type1 and 30 turbines must be of Type2.\nmodel.addCons(Turbines1 >= 20)\nmodel.addCons(Turbines2 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines for Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines for Type3: \", model.getVal(Turbines3))\n    print(\"Maintenance Investment for Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment for Type2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Investment for Type3: \", model.getVal(Maintenance3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1602,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance.\n// Distance_TruckA = 10 * TruckA\n// Distance_TruckB = 15 * TruckB\n// Distance_TruckC = 20 * TruckC\n// So, the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / (100 * TruckA + 150 * TruckB + 200 * TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for maintenance per day.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000\n\n## Generate Constraint-2:\nThe company has a limit of 50 trucks in total.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the fleet is Truck A.\n// TruckA >= 0.1 * (TruckA + TruckB + TruckC)",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting operational constraints.\nThe fuel efficiency of Truck A is 10 km/l, Truck B is 15 km/l, and Truck C is 20 km/l. The maintenance cost per day for Truck A is $100, for Truck B is $150, and for Truck C is $200. The company wants to maximize the total distance covered per dollar spent on maintenance.\nThe company has a total budget of $5000 for maintenance per day. The company has a limit of 50 trucks in total. The company must ensure that at least 10% of the fleet is Truck A.\nPlease help the company determine the optimal number of each type of truck to meet these conditions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance_TruckA = 10 * TruckA\nDistance_TruckB = 15 * TruckB\nDistance_TruckC = 20 * TruckC\nMaintenanceCost = 100 * TruckA + 150 * TruckB + 200 * TruckC\n## the objective function is: Maximize (Distance_TruckA + Distance_TruckB + Distance_TruckC) / MaintenanceCost\n## convert the division to multiplication\nmodel.addCons(obj * MaintenanceCost == Distance_TruckA + Distance_TruckB + Distance_TruckC)\n\n# Add constraints\n## The company has a total budget of $5000 for maintenance per day.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 5000)\n## The company has a limit of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## The company must ensure that at least 10% of the fleet is Truck A.\nmodel.addCons(TruckA >= 0.1 * (TruckA + TruckB + TruckC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Distance per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in engine upgrades for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\n// Fuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\n// Fuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\n// Fuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\n// Fuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 5 trucks to Route5.\n// Trucks1 >= 10; Trucks5 >= 5\n\n## Generate Constraint-4:\nThe investment in engine upgrades for each route cannot exceed $20,000.\n// Upgrade1 <= 20000; Upgrade2 <= 20000; Upgrade3 <= 20000; Upgrade4 <= 20000; Upgrade5 <= 20000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency. The fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a budget of $100,000 for engine upgrades and operational costs. The total number of trucks available for all routes is limited to 50. Due to contractual obligations, at least 10 trucks must be assigned to Route1 and at least 5 trucks to Route5. The investment in engine upgrades for each route cannot exceed $20,000.\n\nPlease help the company to determine the optimal number of trucks to assign to each route and the amount to invest in engine upgrades for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks on Route5\n\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0, ub=20000)  # investment in engine upgrades for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0, ub=20000)  # investment in engine upgrades for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0, ub=20000)  # investment in engine upgrades for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0, ub=20000)  # investment in engine upgrades for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0, ub=20000)  # investment in engine upgrades for Route5\n\n# Define objective function\nFuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\nFuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\nFuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\nFuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\nFuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Trucks1 >= 10)\nmodel.addCons(Trucks5 >= 5)\nmodel.addCons(Upgrade1 <= 20000)\nmodel.addCons(Upgrade2 <= 20000)\nmodel.addCons(Upgrade3 <= 20000)\nmodel.addCons(Upgrade4 <= 20000)\nmodel.addCons(Upgrade5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Engine Upgrades for Route1: \", model.getVal(Upgrade1))\n    print(\"Investment in Engine Upgrades for Route2: \", model.getVal(Upgrade2))\n    print(\"Investment in Engine Upgrades for Route3: \", model.getVal(Upgrade3))\n    print(\"Investment in Engine Upgrades for Route4: \", model.getVal(Upgrade4))\n    print(\"Investment in Engine Upgrades for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. The operational costs and the units of goods each vehicle type can transport are given in the following Table.\n\n| Vehicle Type | Operational Cost per Month | Units of Goods Transported |\n|--------------|----------------------------|----------------------------|\n| Truck A      | $1000                      | 1000                       |\n| Truck B      | $1200                      | 1200                       |\n| Truck C      | $1500                      | 1500                       |\n| Truck D      | $1800                      | 1800                       |\n| Truck E      | $2000                      | 2000                       |\n\nThe company has a budget of $100,000 for operational costs for the upcoming month. The company must transport at least 50,000 units of goods. Please help the company to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively.\n// {\"number of packages for Express\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Standard\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of packages for Economy\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is a function of the total number of packages. The penalty is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty.\n// Profit_Express = 5 * E\n// Profit_Standard = 3 * S\n// Profit_Economy = 2 * N\n// Penalty = 0.01 * (E + S + N)^2\n// So, the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n\n## Generate Constraint-1:\nThe company has a daily delivery capacity of 1000 packages.\n// E + S + N <= 1000\n\n## Generate Constraint-2:\nThe company has a limited fleet size, which can handle at most 500 Express packages per day.\n// E <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages.\n// N <= E + S\n\n## Generate Constraint-4:\nThe company has a policy to ensure that at least 20% of the total packages are Express packages.\n// E >= 0.2 * (E + S + N)\n\n## Generate Constraint-5:\nThe company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\n// |E - S| <= 100",
        "question": "A logistics company operates three types of delivery services: Express, Standard, and Economy. The company needs to determine the number of packages to be delivered for each service type. The number of packages for Express, Standard, and Economy services are represented by variables E, S, and N respectively. The company earns a profit of $5 per Express package, $3 per Standard package, and $2 per Economy package. However, the company incurs a penalty for late deliveries, which is $0.01 times the square of the total number of packages. The company aims to maximize its net profit, which is the sum of the profits from all packages minus the penalty.\n\n| Service Type | Profit per Package |\n|--------------|--------------------|\n| Express      | $5                 |\n| Standard     | $3                 |\n| Economy      | $2                 |\n\nThe company has a daily delivery capacity of 1000 packages. The company has a limited fleet size, which can handle at most 500 Express packages per day. The company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages. The company has a policy to ensure that at least 20% of the total packages are Express packages. The company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\n\nPlease help the company to maximize its net profit, considering all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)  # number of packages for Express\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0)  # number of packages for Standard\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=0)  # number of packages for Economy\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Express = 5 * E\nProfit_Standard = 3 * S\nProfit_Economy = 2 * N\nPenalty = 0.01 * (E + S + N)**2\n## the objective function is: Maximize (Profit_Express + Profit_Standard + Profit_Economy - Penalty)\n## convert the square to multiplication\nmodel.addCons(obj == Profit_Express + Profit_Standard + Profit_Economy - 0.01 * (E + S + N) * (E + S + N))\n\n# Add constraints\n## The company has a daily delivery capacity of 1000 packages.\nmodel.addCons(E + S + N <= 1000)\n## The company has a limited fleet size, which can handle at most 500 Express packages per day.\nmodel.addCons(E <= 500)\n## The company wants to ensure that the number of Economy packages does not exceed the combined number of Express and Standard packages.\nmodel.addCons(N <= E + S)\n## The company has a policy to ensure that at least 20% of the total packages are Express packages.\nmodel.addCons(E >= 0.2 * (E + S + N))\n## The company aims to maintain a balance in the service types, ensuring that the difference between the number of Express and Standard packages does not exceed 100.\nmodel.addCons(E - S <= 100)\nmodel.addCons(S - E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Express Packages: \", model.getVal(E))\n    print(\"Number of Standard Packages: \", model.getVal(S))\n    print(\"Number of Economy Packages: \", model.getVal(N))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1479,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network.\n// {\"number of trucks for GoodsA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor GoodsA, the transportation cost per truck is $10,000, the revenue per truck is $15,000, and the storage cost per truck is $2,000. \nFor GoodsB, the transportation cost per truck is $12,000, the revenue per truck is $18,000, and the storage cost per truck is $2,500. \nFor GoodsC, the transportation cost per truck is $14,000, the revenue per truck is $21,000, and the storage cost per truck is $3,000.\nFor GoodsD, the transportation cost per truck is $16,000, the revenue per truck is $24,000, and the storage cost per truck is $3,500.\nFor GoodsE, the transportation cost per truck is $18,000, the revenue per truck is $27,000, and the storage cost per truck is $4,000.\nThe company wants to maximize the net profit per truck.\n// Net profit for GoodsA: Profit_GoodsA = (15,000 - 10,000 - 2,000) * TrucksA\n// Net profit for GoodsB: Profit_GoodsB = (18,000 - 12,000 - 2,500) * TrucksB\n// Net profit for GoodsC: Profit_GoodsC = (21,000 - 14,000 - 3,000) * TrucksC\n// Net profit for GoodsD: Profit_GoodsD = (24,000 - 16,000 - 3,500) * TrucksD\n// Net profit for GoodsE: Profit_GoodsE = (27,000 - 18,000 - 4,000) * TrucksE\n// So, the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 20 trucks available for distribution.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20\n\n## Generate Constraint-2:\nDue to contractual agreements, GoodsA must be transported by at least 3 trucks.\n// TrucksA >= 3\n\n## Generate Constraint-3:\nThe company has a budget of $300,000 for transportation costs.\n// 10,000 * TrucksA + 12,000 * TrucksB + 14,000 * TrucksC + 16,000 * TrucksD + 18,000 * TrucksE <= 300,000\n\n## Generate Constraint-4:\nThe storage capacity of the company is limited to 50 truckloads.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company is managing the distribution of five different types of goods: GoodsA, GoodsB, GoodsC, GoodsD, and GoodsE. They need to determine the number of trucks allocated to each type of goods to optimize their distribution network. The transportation cost, revenue, and storage cost per truck for each type of goods are given in the following Table.\n\n| Goods | Transportation Cost per Truck | Revenue per Truck | Storage Cost per Truck |\n|-------|-------------------------------|-------------------|------------------------|\n| GoodsA | $10,000                       | $15,000           | $2,000                 |\n| GoodsB | $12,000                       | $18,000           | $2,500                 |\n| GoodsC | $14,000                       | $21,000           | $3,000                 |\n| GoodsD | $16,000                       | $24,000           | $3,500                 |\n| GoodsE | $18,000                       | $27,000           | $4,000                 |\n\nThe company has a total of 20 trucks available for distribution. Due to contractual agreements, GoodsA must be transported by at least 3 trucks. The company has a budget of $300,000 for transportation costs. The storage capacity of the company is limited to 50 truckloads. \n\nPlease help the company to maximize the net profit per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodsA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodsB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodsC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodsD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodsE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_GoodsA = (15000 - 10000 - 2000) * TrucksA\nProfit_GoodsB = (18000 - 12000 - 2500) * TrucksB\nProfit_GoodsC = (21000 - 14000 - 3000) * TrucksC\nProfit_GoodsD = (24000 - 16000 - 3500) * TrucksD\nProfit_GoodsE = (27000 - 18000 - 4000) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Maximize (Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_GoodsA + Profit_GoodsB + Profit_GoodsC + Profit_GoodsD + Profit_GoodsE)\n\n# Add constraints\n## The company has a total of 20 trucks available for distribution.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 20)\n## Due to contractual agreements, GoodsA must be transported by at least 3 trucks.\nmodel.addCons(TrucksA >= 3)\n## The company has a budget of $300,000 for transportation costs.\nmodel.addCons(10000 * TrucksA + 12000 * TrucksB + 14000 * TrucksC + 16000 * TrucksD + 18000 * TrucksE <= 300000)\n## The storage capacity of the company is limited to 50 truckloads.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodsB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodsC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodsD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodsE: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits.\n// {\"number of apartments\": \"Apartments\", \"range\": \"Apartments >= 0\", \"type\": \"integer\"}\n// {\"number of townhouses\": \"Townhouses\", \"range\": \"Townhouses >= 0\", \"type\": \"integer\"}\n// {\"number of single-family homes\": \"SingleFamilyHomes\", \"range\": \"SingleFamilyHomes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per apartment is $100,000, and the city receives a tax revenue of $2,000 per apartment annually.\nThe cost per townhouse is $150,000, and the city receives a tax revenue of $2,500 per townhouse annually.\nThe cost per single-family home is $200,000, and the city receives a tax revenue of $3,000 per single-family home annually.\nThe city wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\n// NPV = (2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes) / 0.05 - (100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes)\n// So, the objective function is: Maximize NPV\n\n## Generate Constraint-1:\nThe city has a budget of $10 million for the construction of all housing units.\n// 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes <= 10000000",
        "question": "A city is planning to build a new residential area with three types of housing units: apartments, townhouses, and single-family homes. The city needs to determine the number of each type of housing unit to build and the associated costs and benefits. The cost per unit and the annual tax revenue per unit are given in the following Table.\n\n| Housing Type        | Cost per Unit | Annual Tax Revenue per Unit |\n|---------------------|---------------|-----------------------------|\n| Apartments          | $100,000      | $2,000                      |\n| Townhouses          | $150,000      | $2,500                      |\n| Single-Family Homes | $200,000      | $3,000                      |\n\nThe city has a budget of $10 million for the construction of all housing units. The city wants to maximize the net present value (NPV) of the project, considering a discount rate of 5%.\nPlease help the city determine the optimal number of each type of housing unit to build.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nApartments = model.addVar(vtype=\"INTEGER\", name=\"Apartments\", lb=0)  # number of apartments\nTownhouses = model.addVar(vtype=\"INTEGER\", name=\"Townhouses\", lb=0)  # number of townhouses\nSingleFamilyHomes = model.addVar(vtype=\"INTEGER\", name=\"SingleFamilyHomes\", lb=0)  # number of single-family homes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTaxRevenue = 2000 * Apartments + 2500 * Townhouses + 3000 * SingleFamilyHomes\nConstructionCost = 100000 * Apartments + 150000 * Townhouses + 200000 * SingleFamilyHomes\n## the objective function is: Maximize NPV = (TaxRevenue) / 0.05 - ConstructionCost\n## convert the division to multiplication\nmodel.addCons(obj * 0.05 == TaxRevenue - ConstructionCost)\n\n# Add constraints\n## The city has a budget of $10 million for the construction of all housing units.\nmodel.addCons(ConstructionCost <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Apartments: \", model.getVal(Apartments))\n    print(\"Number of Townhouses: \", model.getVal(Townhouses))\n    print(\"Number of Single-Family Homes: \", model.getVal(SingleFamilyHomes))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, and the environmental impact per unit is 2 kg of CO2.\nThe profit per unit of Product B is $70, and the environmental impact per unit is 3 kg of CO2.\nThe profit per unit of Product C is $60, and the environmental impact per unit is 2.5 kg of CO2.\nThe profit per unit of Product D is $80, and the environmental impact per unit is 4 kg of CO2.\nThe profit per unit of Product E is $90, and the environmental impact per unit is 5 kg of CO2.\nThe company wants to maximize the Profit-Environmental Impact ratio. (The Profit-Environmental Impact ratio is defined as the total profit divided by the total environmental impact.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total environmental impact: Impact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n// So, the objective function is: Maximize Profit / Impact\n\n## Generate Constraint-1:\nThe company has a total production capacity of 2000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 2000\n\n## Generate Constraint-2:\nThe company must produce at least 500 units of Product A.\n// ProductA >= 500\n\n## Generate Constraint-3:\nThe company must produce at least 300 units of Product B.\n// ProductB >= 300\n\n## Generate Constraint-4:\nThe company cannot produce more than 600 units of any single product.\n// ProductA <= 600\n// ProductB <= 600\n// ProductC <= 600\n// ProductD <= 600\n// ProductE <= 600\n\n## Generate Constraint-5:\nThe total environmental impact must not exceed 8000 kg of CO2.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE <= 8000",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit and the environmental impact per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Environmental Impact per Unit |\n|---------|-----------------|-------------------------------|\n| A       | $50             | 2 kg of CO2                   |\n| B       | $70             | 3 kg of CO2                   |\n| C       | $60             | 2.5 kg of CO2                 |\n| D       | $80             | 4 kg of CO2                   |\n| E       | $90             | 5 kg of CO2                   |\n\nThe company has a total production capacity of 2000 units across all products. The company must produce at least 500 units of Product A and at least 300 units of Product B. The company cannot produce more than 600 units of any single product. The total environmental impact must not exceed 8000 kg of CO2. \n\nPlease help the company to maximize the Profit-Environmental Impact ratio (defined as the total profit divided by the total environmental impact).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0)  # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0)  # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0)  # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0)  # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0)  # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nImpact = 2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE\n## the objective function is: Maximize Profit / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Profit)\n\n# Add constraints\n## The company has a total production capacity of 2000 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 2000)\n## The company must produce at least 500 units of Product A.\nmodel.addCons(ProductA >= 500)\n## The company must produce at least 300 units of Product B.\nmodel.addCons(ProductB >= 300)\n## The company cannot produce more than 600 units of any single product.\nmodel.addCons(ProductA <= 600)\nmodel.addCons(ProductB <= 600)\nmodel.addCons(ProductC <= 600)\nmodel.addCons(ProductD <= 600)\nmodel.addCons(ProductE <= 600)\n## The total environmental impact must not exceed 8000 kg of CO2.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC + 4 * ProductD + 5 * ProductE <= 8000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Amount of Product D produced: \", model.getVal(ProductD))\n    print(\"Amount of Product E produced: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\nThe company aims to minimize the total transportation cost.\n// The objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n// Minimize (0.05 * T1^2 + 0.07 * T2^2 + 0.06 * T3^2 + 0.08 * T4^2 + 0.04 * T5^2 + 0.09 * T6^2)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while ensuring timely delivery of goods. The decision variables include the number of trucks allocated to each warehouse. The transportation cost per truck varies depending on the warehouse location and the distance to the delivery points. The cost function is nonlinear and is given by:\nCost_1 = 0.05 * T1^2\nCost_2 = 0.07 * T2^2\nCost_3 = 0.06 * T3^2\nCost_4 = 0.08 * T4^2\nCost_5 = 0.04 * T5^2\nCost_6 = 0.09 * T6^2\n\nThe company aims to minimize the total transportation cost. The company has a total of 100 trucks available. Each warehouse can handle a maximum of 20 trucks.\n\nPlease help the company to determine the optimal number of trucks to allocate to each warehouse to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks at warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_1 = 0.05 * T1**2\nCost_2 = 0.07 * T2**2\nCost_3 = 0.06 * T3**2\nCost_4 = 0.08 * T4**2\nCost_5 = 0.04 * T5**2\nCost_6 = 0.09 * T6**2\n## the objective function is: Minimize (Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\nmodel.addCons(obj == Cost_1 + Cost_2 + Cost_3 + Cost_4 + Cost_5 + Cost_6)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints.\n// {\"quantity of M1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company aims to maximize its total profit.\n// Profit_M1 = 100 * Q1 - 0.01 * Q1^2\n// Profit_M2 = 150 * Q2 - 0.02 * Q2^2\n// Profit_M3 = 200 * Q3 - 0.03 * Q3^2\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production costs.\n// 0.01 * Q1^2 + 0.02 * Q2^2 + 0.03 * Q3^2 <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 200 units.\n// Q1 + Q2 + Q3 <= 200\n\n## Generate Constraint-3:\nThe market demand for M1 is at least 50 units.\n// Q1 >= 50",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. The company needs to decide the production quantities of each machine type to optimize its profit while considering various constraints. The profit per unit of M1 is $100, M2 is $150, and M3 is $200. However, the production cost increases nonlinearly with the quantity produced due to economies of scale and resource utilization. The production cost for M1 is modeled as 0.01 * Q1^2, for M2 as 0.02 * Q2^2, and for M3 as 0.03 * Q3^2. The company has a limited budget of $10,000 for production costs. The total production capacity of the company is 200 units. The market demand for M1 is at least 50 units. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=50) # quantity of M1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of M2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of M3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = 100 * Q1 - 0.01 * Q1**2\nProfit_M2 = 150 * Q2 - 0.02 * Q2**2\nProfit_M3 = 200 * Q3 - 0.03 * Q3**2\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production costs.\nmodel.addCons(0.01 * Q1**2 + 0.02 * Q2**2 + 0.03 * Q3**2 <= 10000)\n## The total production capacity of the company is 200 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(Q1))\n    print(\"Quantity of M2: \", model.getVal(Q2))\n    print(\"Quantity of M3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 733,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"quantity of MaterialX used\": \"MatX\", \"range\": \"MatX >= 0\", \"type\": \"real\"}\n// {\"quantity of MaterialY used\": \"MatY\", \"range\": \"MatY >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = 50 * ProdA\n// Total profit for ProductB: Profit_B = 70 * ProdB\n// Total profit for ProductC: Profit_C = 90 * ProdC\n// Cost of MaterialX: Cost_X = 10 * MatX\n// Cost of MaterialY: Cost_Y = 15 * MatY\n// MaterialX used for ProductA: MatX_A = 0.8 * ProdA\n// MaterialX used for ProductB: MatX_B = 0.9 * ProdB\n// MaterialX used for ProductC: MatX_C = 0.7 * ProdC\n// MaterialY used for ProductA: MatY_A = 0.9 * ProdA\n// MaterialY used for ProductB: MatY_B = 0.8 * ProdB\n// MaterialY used for ProductC: MatY_C = 0.6 * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n## Generate Constraint-1:\nThe total amount of MaterialX available is 100 units.\n// MatX_A + MatX_B + MatX_C <= MatX\n\n## Generate Constraint-2:\nThe total amount of MaterialY available is 100 units.\n// MatY_A + MatY_B + MatY_C <= MatY",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company is considering using two different types of materials: MaterialX and MaterialY, each with different costs and efficiencies. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of MaterialX is $10 per unit, and the cost of MaterialY is $15 per unit. The efficiency of MaterialX in producing ProductA is 0.8, ProductB is 0.9, and ProductC is 0.7. The efficiency of MaterialY in producing ProductA is 0.9, ProductB is 0.8, and ProductC is 0.6. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | MaterialX Efficiency | MaterialY Efficiency |\n|---------|-----------------|----------------------|----------------------|\n| ProductA | $50            | 0.8                  | 0.9                  |\n| ProductB | $70            | 0.9                  | 0.8                  |\n| ProductC | $90            | 0.7                  | 0.6                  |\n\nThe total amount of MaterialX available is 100 units. The total amount of MaterialY available is 100 units. Please help the company to maximize the total profit, considering the constraints on the availability of materials and the efficiencies of these materials in producing each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMatX = model.addVar(vtype=\"CONTINUOUS\", name=\"MatX\", lb=0) # quantity of MaterialX used\nMatY = model.addVar(vtype=\"CONTINUOUS\", name=\"MatY\", lb=0) # quantity of MaterialY used\n\n# Define objective function\nProfit_A = 50 * ProdA\nProfit_B = 70 * ProdB\nProfit_C = 90 * ProdC\nCost_X = 10 * MatX\nCost_Y = 15 * MatY\nMatX_A = 0.8 * ProdA\nMatX_B = 0.9 * ProdB\nMatX_C = 0.7 * ProdC\nMatY_A = 0.9 * ProdA\nMatY_B = 0.8 * ProdB\nMatY_C = 0.6 * ProdC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_X - Cost_Y)\n\n# Add constraints\nmodel.addCons(MatX_A + MatX_B + MatX_C <= MatX)\nmodel.addCons(MatY_A + MatY_B + MatY_C <= MatY)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Quantity of MaterialX Used: \", model.getVal(MatX))\n    print(\"Quantity of MaterialY Used: \", model.getVal(MatY))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1403,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit.\n// Total profit: Profit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month.\n// 2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a fixed monthly budget for production costs, which is $2000.\n// 30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of each device are produced to maintain market presence.\n// UnitsA >= 10; UnitsB >= 10; UnitsC >= 10\n\n## Generate Constraint-5:\nDue to strategic partnerships, the company should produce at least 30 units in total per month.\n// UnitsA + UnitsB + UnitsC >= 30",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability. The profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company has a limited amount of a critical component that is used in the production of all devices, with each unit of DeviceA requiring 2 units of this component, DeviceB requiring 3 units, and DeviceC requiring 4 units, and a total available amount of 150 units per month. The demand for DeviceA is at least twice the demand for DeviceB. The company has a fixed monthly budget for production costs, which is $2000. The company wants to ensure that at least 10 units of each device are produced to maintain market presence and should produce at least 30 units in total per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=10) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=10) # number of units of DeviceC\n\n# Define objective function\nProfit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# Constraint-1: Limited amount of a critical component\nmodel.addCons(2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150)\n# Constraint-2: Demand for DeviceA is at least twice the demand for DeviceB\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# Constraint-3: Fixed monthly budget for production costs\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000)\n# Constraint-4: At least 10 units of each device are produced\nmodel.addCons(UnitsA >= 10)\nmodel.addCons(UnitsB >= 10)\nmodel.addCons(UnitsC >= 10)\n# Constraint-5: Produce at least 30 units in total per month\nmodel.addCons(UnitsA + UnitsB + UnitsC >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. They need to determine the optimal number of each type of truck to maximize their operational efficiency while considering fuel consumption, maintenance costs, and cargo capacity.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel efficiency is 5 km/liter, maintenance cost per month is $1000, and cargo capacity is 10 tons.\nFor T2, the fuel efficiency is 6 km/liter, maintenance cost per month is $1200, and cargo capacity is 12 tons.\nFor T3, the fuel efficiency is 7 km/liter, maintenance cost per month is $1400, and cargo capacity is 14 tons.\nFor T4, the fuel efficiency is 8 km/liter, maintenance cost per month is $1600, and cargo capacity is 16 tons.\nFor T5, the fuel efficiency is 9 km/liter, maintenance cost per month is $1800, and cargo capacity is 18 tons.\nThe company wants to maximize the total cargo transported per liter of fuel consumed (operational efficiency).\n// Efficiency_T1 = 10 * T1 / (5 * T1)\n// Efficiency_T2 = 12 * T2 / (6 * T2)\n// Efficiency_T3 = 14 * T3 / (7 * T3)\n// Efficiency_T4 = 16 * T4 / (8 * T4)\n// Efficiency_T5 = 18 * T5 / (9 * T5)\n// So, the objective function is: Maximize (Efficiency_T1 + Efficiency_T2 + Efficiency_T3 + Efficiency_T4 + Efficiency_T5) - (1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 per month for maintenance costs.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. They need to determine the optimal number of each type of truck to maximize their operational efficiency while considering fuel consumption, maintenance costs, and cargo capacity. The details for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Maintenance Cost per Month | Cargo Capacity (tons) |\n|------------|---------------------------|----------------------------|-----------------------|\n| T1         | 5                         | $1000                      | 10                    |\n| T2         | 6                         | $1200                      | 12                    |\n| T3         | 7                         | $1400                      | 14                    |\n| T4         | 8                         | $1600                      | 16                    |\n| T5         | 9                         | $1800                      | 18                    |\n\nThe company wants to maximize the total cargo transported per liter of fuel consumed (operational efficiency). The company has a budget of $100,000 per month for maintenance costs. The total number of trucks cannot exceed 100.\n\nPlease help the company to determine the optimal number of each type of truck to maximize their operational efficiency while adhering to the budget and total truck limit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T1 = 10 * T1 / (5 * T1)\nEfficiency_T2 = 12 * T2 / (6 * T2)\nEfficiency_T3 = 14 * T3 / (7 * T3)\nEfficiency_T4 = 16 * T4 / (8 * T4)\nEfficiency_T5 = 18 * T5 / (9 * T5)\nMaintenanceCost = 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5\n## the objective function is: Maximize (Efficiency_T1 + Efficiency_T2 + Efficiency_T3 + Efficiency_T4 + Efficiency_T5) - MaintenanceCost\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_T1 + Efficiency_T2 + Efficiency_T3 + Efficiency_T4 + Efficiency_T5 - MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 per month for maintenance costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 100000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency.\n// {\"number of Small solar plants\": \"SmallPlants\", \"range\": \"SmallPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Medium solar plants\": \"MediumPlants\", \"range\": \"MediumPlants >= 0\", \"type\": \"integer\"}\n// {\"number of Large solar plants\": \"LargePlants\", \"range\": \"LargePlants >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Small plants\": \"TechInvestmentSmall\", \"range\": \"TechInvestmentSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Medium plants\": \"TechInvestmentMedium\", \"range\": \"TechInvestmentMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Large plants\": \"TechInvestmentLarge\", \"range\": \"TechInvestmentLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n// EnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\n// EnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\n// EnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\n// So, the objective function is: Maximize (EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $10 million for building new plants and investing in technology.\n// 1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000\n\n## Generate Constraint-2:\nThe total number of plants cannot exceed 50 due to land availability.\n// SmallPlants + MediumPlants + LargePlants <= 50\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must build at least 5 Small plants and 10 Medium plants.\n// SmallPlants >= 5; MediumPlants >= 10\n\n## Generate Constraint-4:\nThe investment in technology for each plant type must not exceed 10% of the construction cost of that type of plant.\n// TechInvestmentSmall <= 0.1 * 1000000 * SmallPlants\n// TechInvestmentMedium <= 0.1 * 2000000 * MediumPlants\n// TechInvestmentLarge <= 0.1 * 3000000 * LargePlants",
        "question": "A renewable energy company operates three types of solar power plants: Small, Medium, and Large. The company needs to determine the number of each type of plant to build and the level of investment in advanced solar technology for each plant type to maximize energy output and efficiency. The energy output of each plant type is affected by the investment in advanced solar technology. For every $100,000 invested in technology, the energy output increases by 5 MWh for Small plants, 7 MWh for Medium plants, and 10 MWh for Large plants. The company aims to maximize the total energy output from all plants.\n\n| Plant Type | Construction Cost per Plant | Base Energy Output per Plant | Technology Investment Impact per $100,000 |\n|------------|------------------------------|-------------------------------|-------------------------------------------|\n| Small      | $1,000,000                   | 100 MWh                       | 5 MWh                                     |\n| Medium     | $2,000,000                   | 200 MWh                       | 7 MWh                                     |\n| Large      | $3,000,000                   | 300 MWh                       | 10 MWh                                    |\n\nThe company has a total budget of $10 million for building new plants and investing in technology. The total number of plants cannot exceed 50 due to land availability. Due to regulatory requirements, the company must build at least 5 Small plants and 10 Medium plants. The investment in technology for each plant type must not exceed 10% of the construction cost of that type of plant.\n\nPlease help the company to determine the optimal number of each type of solar power plant to build and the level of investment in advanced solar technology to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallPlants = model.addVar(vtype=\"INTEGER\", name=\"SmallPlants\", lb=5)  # number of Small solar plants\nMediumPlants = model.addVar(vtype=\"INTEGER\", name=\"MediumPlants\", lb=10)  # number of Medium solar plants\nLargePlants = model.addVar(vtype=\"INTEGER\", name=\"LargePlants\", lb=0)  # number of Large solar plants\nTechInvestmentSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSmall\", lb=0)  # investment in advanced technology for Small plants\nTechInvestmentMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentMedium\", lb=0)  # investment in advanced technology for Medium plants\nTechInvestmentLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentLarge\", lb=0)  # investment in advanced technology for Large plants\n\n# Define objective function\nEnergyOutputSmall = 100 * SmallPlants + 0.05 * TechInvestmentSmall * SmallPlants\nEnergyOutputMedium = 200 * MediumPlants + 0.07 * TechInvestmentMedium * MediumPlants\nEnergyOutputLarge = 300 * LargePlants + 0.1 * TechInvestmentLarge * LargePlants\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSmall + EnergyOutputMedium + EnergyOutputLarge)\n\n# Add constraints\nmodel.addCons(1000000 * SmallPlants + 2000000 * MediumPlants + 3000000 * LargePlants + TechInvestmentSmall + TechInvestmentMedium + TechInvestmentLarge <= 10000000)\nmodel.addCons(SmallPlants + MediumPlants + LargePlants <= 50)\nmodel.addCons(SmallPlants >= 5)\nmodel.addCons(MediumPlants >= 10)\nmodel.addCons(TechInvestmentSmall <= 0.1 * 1000000 * SmallPlants)\nmodel.addCons(TechInvestmentMedium <= 0.1 * 2000000 * MediumPlants)\nmodel.addCons(TechInvestmentLarge <= 0.1 * 3000000 * LargePlants)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Plants: \", model.getVal(SmallPlants))\n    print(\"Number of Medium Plants: \", model.getVal(MediumPlants))\n    print(\"Number of Large Plants: \", model.getVal(LargePlants))\n    print(\"Investment in Technology for Small Plants: \", model.getVal(TechInvestmentSmall))\n    print(\"Investment in Technology for Medium Plants: \", model.getVal(TechInvestmentMedium))\n    print(\"Investment in Technology for Large Plants: \", model.getVal(TechInvestmentLarge))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1798,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\n// Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\n// Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\n// Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\n// So, the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 units in total.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\n// 5 * C1 + 7 * C2 + 9 * C3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for C1 is at least 50 units and at most 200 units.\n// 50 <= C1 <= 200",
        "question": "A manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints. The profit per unit and the cost of raw materials for each component are given in the following Table.\n\n| Component | Profit per Unit | Raw Material Cost per Unit |\n|-----------|-----------------|-----------------------------|\n| C1        | $10 - $0.02 * max(C1 - 100, 0) | $5 |\n| C2        | $15 - $0.03 * max(C2 - 200, 0) | $7 |\n| C3        | $20 - $0.04 * max(C3 - 300, 0) | $9 |\n\nThe company has a limited production capacity of 500 units in total. The company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3, with a total budget of $3000. The market demand for C1 is at least 50 units and at most 200 units.\n\nPlease help the company to maximize the total profit from selling these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\nC1_1 = model.addVar(vtype=\"INTEGER\", name=\"C1_1\", lb=50, ub=100)\nC1_2 = model.addVar(vtype=\"INTEGER\", name=\"C1_2\", lb=100, ub=200)\nC1_b1 = model.addVar(vtype=\"B\", name=\"C1_b1\")\nC1_b2 = model.addVar(vtype=\"B\", name=\"C1_b2\")\nmodel.addCons(C1_b1 + C1_b2 == 1)\nmodel.addCons(C1 == C1_1*C1_b1 + C1_2*C1_b2)\nProfit_C1 = (10 - 0.02 * C1_2) * C1_2 * C1_b2 + 10 * C1_1 * C1_b1\n## create piecewise variables for piecewise function: Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\nC2_1 = model.addVar(vtype=\"INTEGER\", name=\"C2_1\", lb=0, ub=200)\nC2_2 = model.addVar(vtype=\"INTEGER\", name=\"C2_2\", lb=200, ub=500)\nC2_b1 = model.addVar(vtype=\"B\", name=\"C2_b1\")\nC2_b2 = model.addVar(vtype=\"B\", name=\"C2_b2\")\nmodel.addCons(C2_b1 + C2_b2 == 1)\nmodel.addCons(C2 == C2_1*C2_b1 + C2_2*C2_b2)\nProfit_C2 = (15 - 0.03 * C2_2) * C2_2 * C2_b2 + 15 * C2_1 * C2_b1\n## create piecewise variables for piecewise function: Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\nC3_1 = model.addVar(vtype=\"INTEGER\", name=\"C3_1\", lb=0, ub=300)\nC3_2 = model.addVar(vtype=\"INTEGER\", name=\"C3_2\", lb=300, ub=500)\nC3_b1 = model.addVar(vtype=\"B\", name=\"C3_b1\")\nC3_b2 = model.addVar(vtype=\"B\", name=\"C3_b2\")\nmodel.addCons(C3_b1 + C3_b2 == 1)\nmodel.addCons(C3 == C3_1*C3_b1 + C3_2*C3_b2)\nProfit_C3 = (20 - 0.04 * C3_2) * C3_2 * C3_b2 + 20 * C3_1 * C3_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 <= 500)\nmodel.addCons(5 * C1 + 7 * C2 + 9 * C3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000\n\n## Generate Constraint-2:\nThe total production hours available in the Testing department is 800 hours.\n// TestingHours <= 800\n\n## Generate Constraint-3:\nThe total production hours available in the Packaging department is 600 hours.\n// PackagingHours <= 600\n\n## Generate Constraint-4:\nThe company has a constraint that the number of units of DeviceA produced must be at least twice the number of units of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-5:\nThe total number of units produced cannot exceed 5000 units.\n// UnitsA + UnitsB + UnitsC <= 5000",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production. The total production hours available in the Assembly department is 1000 hours, in the Testing department is 800 hours, and in the Packaging department is 600 hours. The company has a constraint that the number of units of DeviceA produced must be at least twice the number of units of DeviceB. Additionally, the total number of units produced cannot exceed 5000 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0)  # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0)  # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0)  # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production hours available in the Assembly department is 1000 hours.\nmodel.addCons(AssemblyHours <= 1000)\n# The total production hours available in the Testing department is 800 hours.\nmodel.addCons(TestingHours <= 800)\n# The total production hours available in the Packaging department is 600 hours.\nmodel.addCons(PackagingHours <= 600)\n# The company has a constraint that the number of units of DeviceA produced must be at least twice the number of units of DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# The total number of units produced cannot exceed 5000 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints.\n// {\"number of solar units\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind units\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro units\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n// {\"number of biomass units\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar unit is $5000 with an annual maintenance cost of $500, and it generates 10 MWh of energy per year.\nThe cost of installing each wind unit is $8000 with an annual maintenance cost of $800, and it generates 15 MWh of energy per year.\nThe cost of installing each hydro unit is $10000 with an annual maintenance cost of $1000, and it generates 20 MWh of energy per year.\nThe cost of installing each geothermal unit is $12000 with an annual maintenance cost of $1200, and it generates 25 MWh of energy per year.\nThe cost of installing each biomass unit is $6000 with an annual maintenance cost of $600, and it generates 12 MWh of energy per year.\nThe company wants to minimize the total cost of installation and maintenance.\n// Total installation cost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n// Total annual maintenance cost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n// So, the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for installation.\n// 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000\n\n## Generate Constraint-2:\nThe company needs to generate at least 1000 MWh of energy per year.\n// 10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000",
        "question": "A company is planning to optimize its energy consumption by installing five different types of renewable energy systems (Solar, Wind, Hydro, Geothermal, and Biomass). The company wants to determine the optimal number of units of each system to install to minimize overall energy costs while meeting certain energy requirements and constraints.\nThe cost of installing each solar unit is $5000 with an annual maintenance cost of $500, and it generates 10 MWh of energy per year.\nThe cost of installing each wind unit is $8000 with an annual maintenance cost of $800, and it generates 15 MWh of energy per year.\nThe cost of installing each hydro unit is $10000 with an annual maintenance cost of $1000, and it generates 20 MWh of energy per year.\nThe cost of installing each geothermal unit is $12000 with an annual maintenance cost of $1200, and it generates 25 MWh of energy per year.\nThe cost of installing each biomass unit is $6000 with an annual maintenance cost of $600, and it generates 12 MWh of energy per year.\nThe company has a budget of $200,000 for installation. The company needs to generate at least 1000 MWh of energy per year.\nPlease help the company to minimize the total cost of installation and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar units\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind units\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro units\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal units\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass units\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total installation cost\nTotalInstallationCost = 5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass\n## Total annual maintenance cost\nTotalAnnualMaintenanceCost = 500 * Solar + 800 * Wind + 1000 * Hydro + 1200 * Geothermal + 600 * Biomass\n## the objective function is: Minimize (Total installation cost + Total annual maintenance cost)\nmodel.addCons(obj == TotalInstallationCost + TotalAnnualMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $200,000 for installation.\nmodel.addCons(5000 * Solar + 8000 * Wind + 10000 * Hydro + 12000 * Geothermal + 6000 * Biomass <= 200000)\n## The company needs to generate at least 1000 MWh of energy per year.\nmodel.addCons(10 * Solar + 15 * Wind + 20 * Hydro + 25 * Geothermal + 12 * Biomass >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Units: \", model.getVal(Solar))\n    print(\"Number of Wind Units: \", model.getVal(Wind))\n    print(\"Number of Hydro Units: \", model.getVal(Hydro))\n    print(\"Number of Geothermal Units: \", model.getVal(Geothermal))\n    print(\"Number of Biomass Units: \", model.getVal(Biomass))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production while considering the varying efficiency of each plant due to weather conditions and maintenance. Additionally, the company needs to decide on the investment in advanced technology for each plant to enhance efficiency.\n// {\"hours of operation for Solar plant\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar plant\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind plant\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro plant\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. The Solar plant produces 100 kWh per hour without technology, increasing by 10 kWh per hour for every $1000 invested. The Wind plant produces 120 kWh per hour initially, increasing by 12 kWh per hour for every $1000 invested. The Hydro plant produces 150 kWh per hour initially, increasing by 15 kWh per hour for every $1000 invested. The company aims to maximize the total daily energy production.\n// Total energy production for Solar: EnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\n// Total energy production for Wind: EnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\n// Total energy production for Hydro: EnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. The initial production rates and the increase in production per $1000 investment for each plant are given in the following Table.\n\n| Plant Type | Initial Production Rate | Increase in Production per $1000 Investment |\n|------------|-------------------------|--------------------------------------------|\n| Solar      | 100 kWh/hour            | 10 kWh/hour                                |\n| Wind       | 120 kWh/hour            | 12 kWh/hour                                |\n| Hydro      | 150 kWh/hour            | 15 kWh/hour                                |\n\nThe company has a total budget of $50,000 for technology investments and operational costs. The company aims to maximize the total daily energy production. Please help the company determine the optimal hours of operation for each plant and the investment in advanced technology to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # hours of operation for Solar plant\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # hours of operation for Wind plant\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # hours of operation for Hydro plant\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar plant\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind plant\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro plant\n\n# Define objective function\nEnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\nEnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\nEnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(SolarHours))\n    print(\"Hours of operation for Wind plant: \", model.getVal(WindHours))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar plant: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind plant: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro plant: \", model.getVal(TechInvestmentHydro))\n    print(\"Total energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the number of workers to assign to each production line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on production line 1 produces 10 units of device 1, 20 units of device 2, and 30 units of device 3 per hour. \nEach worker on production line 2 produces 15 units of device 1, 25 units of device 2, and 35 units of device 3 per hour. \nEach worker on production line 3 produces 20 units of device 1, 30 units of device 2, and 40 units of device 3 per hour. \nEach worker on production line 4 produces 25 units of device 1, 35 units of device 2, and 45 units of device 3 per hour. \nEach worker on production line 5 produces 30 units of device 1, 40 units of device 2, and 50 units of device 3 per hour. \nThe company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3. The production lines can only be opened or closed at the same time. Determine the minimum time to meet the daily demand.\n// The production time for device 1: T1 = 1000 / (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 + 30 * W5)\n// The production time for device 2: T2 = 1500 / (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 + 40 * W5)\n// The production time for device 3: T3 = 2000 / (30 * W1 + 35 * W2 + 40 * W3 + 45 * W4 + 50 * W5)\n// So, the objective function is: Minimize max(T1, T2, T3)\n// Minimize max(1000 / (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 + 30 * W5), 1500 / (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 + 40 * W5), 2000 / (30 * W1 + 35 * W2 + 40 * W3 + 45 * W4 + 50 * W5))\n\n## Generate Constraint-1:\nThere are total 100 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 100",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the number of workers to assign to each production line to optimize production efficiency. Each worker on production line 1 produces 10 units of device 1, 20 units of device 2, and 30 units of device 3 per hour. Each worker on production line 2 produces 15 units of device 1, 25 units of device 2, and 35 units of device 3 per hour. Each worker on production line 3 produces 20 units of device 1, 30 units of device 2, and 40 units of device 3 per hour. Each worker on production line 4 produces 25 units of device 1, 35 units of device 2, and 45 units of device 3 per hour. Each worker on production line 5 produces 30 units of device 1, 40 units of device 2, and 50 units of device 3 per hour. The company needs to produce at least 1000 units of device 1, 1500 units of device 2, and 2000 units of device 3. The production lines can only be opened or closed at the same time. There are total 100 workers available. Please help the company determine the minimum time to meet the daily demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production line 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on production line 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on production line 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for device 1: T1 = 1000 / (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 + 30 * W5)\n## The production time for device 2: T2 = 1500 / (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 + 40 * W5)\n## The production time for device 3: T3 = 2000 / (30 * W1 + 35 * W2 + 40 * W3 + 45 * W4 + 50 * W5)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 == 1000 / (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4 + 30 * W5))\nmodel.addCons(T2 == 1500 / (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4 + 40 * W5))\nmodel.addCons(T3 == 2000 / (30 * W1 + 35 * W2 + 40 * W3 + 45 * W4 + 50 * W5))\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are total 100 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(W3))\n    print(\"Number of Workers on Production Line 4: \", model.getVal(W4))\n    print(\"Number of Workers on Production Line 5: \", model.getVal(W5))\n    print(\"Minimum Time to Meet Daily Demand: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1089,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption.\n// {\"number of trips to D1\": \"TripsD1\", \"range\": \"TripsD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D2\": \"TripsD2\", \"range\": \"TripsD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D3\": \"TripsD3\", \"range\": \"TripsD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D4\": \"TripsD4\", \"range\": \"TripsD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to D5\": \"TripsD5\", \"range\": \"TripsD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for D1\": \"FuelBudgetD1\", \"range\": \"FuelBudgetD1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D2\": \"FuelBudgetD2\", \"range\": \"FuelBudgetD2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D3\": \"FuelBudgetD3\", \"range\": \"FuelBudgetD3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D4\": \"FuelBudgetD4\", \"range\": \"FuelBudgetD4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for D5\": \"FuelBudgetD5\", \"range\": \"FuelBudgetD5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes.\n// FuelConsumptionD1 = (TripsD1 * FuelBudgetD1^0.7)\n// FuelConsumptionD2 = (TripsD2 * FuelBudgetD2^0.7)\n// FuelConsumptionD3 = (TripsD3 * FuelBudgetD3^0.7)\n// FuelConsumptionD4 = (TripsD4 * FuelBudgetD4^0.7)\n// FuelConsumptionD5 = (TripsD5 * FuelBudgetD5^0.7)\n// So, the objective function is: Minimize (FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel across all routes.\n// FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company also needs to decide on the fuel budget for each route to minimize fuel consumption. The fuel consumption per trip is a nonlinear function of the fuel budget allocated, where increasing the fuel budget slightly improves fuel efficiency but at a diminishing rate. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $100,000 for fuel across all routes.\n\nPlease help the company determine the optimal number of trips and fuel budgets for each destination to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsD1 = model.addVar(vtype=\"INTEGER\", name=\"TripsD1\", lb=0)\nTripsD2 = model.addVar(vtype=\"INTEGER\", name=\"TripsD2\", lb=0)\nTripsD3 = model.addVar(vtype=\"INTEGER\", name=\"TripsD3\", lb=0)\nTripsD4 = model.addVar(vtype=\"INTEGER\", name=\"TripsD4\", lb=0)\nTripsD5 = model.addVar(vtype=\"INTEGER\", name=\"TripsD5\", lb=0)\nFuelBudgetD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD1\", lb=0)\nFuelBudgetD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD2\", lb=0)\nFuelBudgetD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD3\", lb=0)\nFuelBudgetD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD4\", lb=0)\nFuelBudgetD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD5\", lb=0)\n\n# Define objective function\nFuelConsumptionD1 = TripsD1 * FuelBudgetD1**0.7\nFuelConsumptionD2 = TripsD2 * FuelBudgetD2**0.7\nFuelConsumptionD3 = TripsD3 * FuelBudgetD3**0.7\nFuelConsumptionD4 = TripsD4 * FuelBudgetD4**0.7\nFuelConsumptionD5 = TripsD5 * FuelBudgetD5**0.7\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionD1 + FuelConsumptionD2 + FuelConsumptionD3 + FuelConsumptionD4 + FuelConsumptionD5)\n\n# Add constraints\nmodel.addCons(FuelBudgetD1 + FuelBudgetD2 + FuelBudgetD3 + FuelBudgetD4 + FuelBudgetD5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to D1: \", model.getVal(TripsD1))\n    print(\"Number of Trips to D2: \", model.getVal(TripsD2))\n    print(\"Number of Trips to D3: \", model.getVal(TripsD3))\n    print(\"Number of Trips to D4: \", model.getVal(TripsD4))\n    print(\"Number of Trips to D5: \", model.getVal(TripsD5))\n    print(\"Fuel Budget for D1: \", model.getVal(FuelBudgetD1))\n    print(\"Fuel Budget for D2: \", model.getVal(FuelBudgetD2))\n    print(\"Fuel Budget for D3: \", model.getVal(FuelBudgetD3))\n    print(\"Fuel Budget for D4: \", model.getVal(FuelBudgetD4))\n    print(\"Fuel Budget for D5: \", model.getVal(FuelBudgetD5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 698,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"E_A\", \"range\": \"E_A >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"E_B\", \"range\": \"E_B >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"E_C\", \"range\": \"E_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is initially $100, which decreases by $1 for every $1000 invested in efficiency enhancement. For ProductB, the initial cost is $150, and for ProductC, it is $200. The selling price per unit of ProductA is $150, ProductB is $200, and ProductC is $250. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 0.001 * E_A)) * Q_A\n// Profit_B = (200 - (150 - 0.001 * E_B)) * Q_B\n// Profit_C = (250 - (200 - 0.001 * E_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// E_A + E_B + E_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// Q_A + Q_B + Q_C <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product (Q_A, Q_B, Q_C) and the amount of money to be invested in enhancing the production efficiency of each product (E_A, E_B, E_C). The efficiency enhancement directly reduces the production cost per unit. The production cost per unit of ProductA is initially $100, which decreases by $1 for every $1000 invested in efficiency enhancement. For ProductB, the initial cost is $150, and for ProductC, it is $200. The selling price per unit of ProductA is $150, ProductB is $200, and ProductC is $250. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nE_A = model.addVar(vtype=\"CONTINUOUS\", name=\"E_A\", lb=0) # investment in efficiency for ProductA\nE_B = model.addVar(vtype=\"CONTINUOUS\", name=\"E_B\", lb=0) # investment in efficiency for ProductB\nE_C = model.addVar(vtype=\"CONTINUOUS\", name=\"E_C\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 0.001 * E_A)) * Q_A\nProfit_B = (200 - (150 - 0.001 * E_B)) * Q_B\nProfit_C = (250 - (200 - 0.001 * E_C)) * Q_C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for efficiency enhancements.\nmodel.addCons(E_A + E_B + E_C <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(Q_A + Q_B + Q_C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(E_A))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(E_B))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(E_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the company must allocate at least 5 trucks to each city.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5; TrucksD >= 5; TrucksE >= 5\n\n## Generate Constraint-3:\nThe total travel time for all routes must not exceed 200 hours.\n// TimeA + TimeB + TimeC + TimeD + TimeE <= 200\n\n## Generate Constraint-4:\nThe total fuel consumption for all routes must not exceed 3000 liters.\n// FuelA + FuelB + FuelC + FuelD + FuelE <= 3000\n\n## Generate Constraint-5:\nThe number of trucks allocated to city E must be less than or equal to the sum of the trucks allocated to cities A, B, and C.\n// TrucksE <= TrucksA + TrucksB + TrucksC",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each city are given in the following Table.\n\n| City | Fuel Consumption per Truck | Travel Time per Truck |\n|------|----------------------------|-----------------------|\n| A    | 50 liters                  | 4 hours               |\n| B    | 60 liters                  | 5 hours               |\n| C    | 70 liters                  | 6 hours               |\n| D    | 80 liters                  | 7 hours               |\n| E    | 90 liters                  | 8 hours               |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, the company must allocate at least 5 trucks to each city. The total travel time for all routes must not exceed 200 hours. The total fuel consumption for all routes must not exceed 3000 liters. The number of trucks allocated to city E must be less than or equal to the sum of the trucks allocated to cities A, B, and C.\n\nPlease help the company to minimize the total fuel consumption and travel time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=5) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=5) # number of trucks for city E\n\n# Define objective function\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n# So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\nmodel.addCons(TimeA + TimeB + TimeC + TimeD + TimeE <= 200)\nmodel.addCons(FuelA + FuelB + FuelC + FuelD + FuelE <= 3000)\nmodel.addCons(TrucksE <= TrucksA + TrucksB + TrucksC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a Truck is $100 per day, a Van is $70 per day, and a Bike is $30 per day. The revenue generated by a Truck is $200 per day, a Van is $150 per day, and a Bike is $100 per day. The company aims to maximize the profit rate, which is defined as the total revenue divided by the total operating cost.\n// Operating cost of Trucks: Cost_T = 100 * T\n// Operating cost of Vans: Cost_V = 70 * V\n// Operating cost of Bikes: Cost_B = 30 * B\n// Revenue from Trucks: Revenue_T = 200 * T\n// Revenue from Vans: Revenue_V = 150 * V\n// Revenue from Bikes: Revenue_B = 100 * B\n// So, the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle operating costs for the month.\n// 100 * T + 70 * V + 30 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 100 vehicles available.\n// T + V + B <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations. The cost of operating a Truck is $100 per day, a Van is $70 per day, and a Bike is $30 per day. The revenue generated by a Truck is $200 per day, a Van is $150 per day, and a Bike is $100 per day. The company aims to maximize the profit rate, which is defined as the total revenue divided by the total operating cost. The company has a budget of $10,000 for vehicle operating costs for the month. The company has a total of 100 vehicles available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. Please help the company to maximize the profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_T = 100 * T\nCost_V = 70 * V\nCost_B = 30 * B\nRevenue_T = 200 * T\nRevenue_V = 150 * V\nRevenue_B = 100 * B\n## the objective function is: Maximize (Revenue_T + Revenue_V + Revenue_B) / (Cost_T + Cost_V + Cost_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_T + Cost_V + Cost_B) == Revenue_T + Revenue_V + Revenue_B)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle operating costs for the month.\nmodel.addCons(100 * T + 70 * V + 30 * B <= 10000)\n## The company has a total of 100 vehicles available.\nmodel.addCons(T + V + B <= 100)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in new machinery that could potentially reduce production costs for each product.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in machinery for product A\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product B\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product C\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product D\": \"MachineryD\", \"range\": \"MachineryD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of product decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n// Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n// Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n// Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for investing in new machinery.\n// MachineryA + MachineryB + MachineryC + MachineryD <= 200000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 1,500 units of product B.\n// A >= 1000; B >= 1500\n\n## Generate Constraint-4:\nThe investment in machinery for product C cannot exceed the combined investment in machinery for products A and B.\n// MachineryC <= MachineryA + MachineryB",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and is considering investing in new machinery that could potentially reduce production costs for each product. The production cost per unit of product decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company has a total budget of $200,000 for investing in new machinery. The total production quantity for all products must not exceed 10,000 units. The company must produce at least 1,000 units of product A and 1,500 units of product B. The investment in machinery for product C cannot exceed the combined investment in machinery for products A and B. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities and investments in machinery for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0) # investment in machinery for product A\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0) # investment in machinery for product B\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0) # investment in machinery for product C\nMachineryD = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryD\", lb=0) # investment in machinery for product D\n\n# Define objective function\n## Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n## Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n## Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n## Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\nProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\nProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\nProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total budget of $200,000 for investing in new machinery.\nmodel.addCons(MachineryA + MachineryB + MachineryC + MachineryD <= 200000)\n## The total production quantity for all products must not exceed 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n## The company must produce at least 1,000 units of product A and 1,500 units of product B.\n## The investment in machinery for product C cannot exceed the combined investment in machinery for products A and B.\nmodel.addCons(MachineryC <= MachineryA + MachineryB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Machinery for Product A: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for Product B: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for Product C: \", model.getVal(MachineryC))\n    print(\"Investment in Machinery for Product D: \", model.getVal(MachineryD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per truck on Route A is $1000, minus a fuel cost of $200 and a maintenance cost of $100.\nThe profit per truck on Route B is $1200, minus a fuel cost of $250 and a maintenance cost of $150.\nThe profit per truck on Route C is $1500, minus a fuel cost of $300 and a maintenance cost of $200.\nThe profit per truck on Route D is $1800, minus a fuel cost of $350 and a maintenance cost of $250.\nThe profit per truck on Route E is $2000, minus a fuel cost of $400 and a maintenance cost of $300.\nThe company aims to maximize the total net profit from all routes.\n// Net_Profit_A = (1000 - 200 - 100) * Trucks_A\n// Net_Profit_B = (1200 - 250 - 150) * Trucks_B\n// Net_Profit_C = (1500 - 300 - 200) * Trucks_C\n// Net_Profit_D = (1800 - 350 - 250) * Trucks_D\n// Net_Profit_E = (2000 - 400 - 300) * Trucks_E\n// So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nThe total fuel cost across all routes must not exceed $10,000.\n// 200 * Trucks_A + 250 * Trucks_B + 300 * Trucks_C + 350 * Trucks_D + 400 * Trucks_E <= 10000\n\n## Generate Constraint-3:\nThe total maintenance cost across all routes must not exceed $5000.\n// 100 * Trucks_A + 150 * Trucks_B + 200 * Trucks_C + 250 * Trucks_D + 300 * Trucks_E <= 5000\n\n## Generate Constraint-4:\nThe demand for Route A is at least 5 trucks.\n// Trucks_A >= 5\n\n## Generate Constraint-5:\nThe demand for Route E is at most twice the number of trucks on Route A.\n// Trucks_E <= 2 * Trucks_A",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes to maximize profit while considering fuel costs, maintenance costs, and demand for each region. The decision variables include the number of trucks assigned to each route.\nThe profit per truck on Route A is $1000, minus a fuel cost of $200 and a maintenance cost of $100.\nThe profit per truck on Route B is $1200, minus a fuel cost of $250 and a maintenance cost of $150.\nThe profit per truck on Route C is $1500, minus a fuel cost of $300 and a maintenance cost of $200.\nThe profit per truck on Route D is $1800, minus a fuel cost of $350 and a maintenance cost of $250.\nThe profit per truck on Route E is $2000, minus a fuel cost of $400 and a maintenance cost of $300.\nThe company has a total of 50 trucks available. The total fuel cost across all routes must not exceed $10,000. The total maintenance cost across all routes must not exceed $5000. The demand for Route A is at least 5 trucks. The demand for Route E is at most twice the number of trucks on Route A.\nPlease help the company to maximize the total net profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Route D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Route E\n\n# Define objective function\nNet_Profit_A = (1000 - 200 - 100) * Trucks_A\nNet_Profit_B = (1200 - 250 - 150) * Trucks_B\nNet_Profit_C = (1500 - 300 - 200) * Trucks_C\nNet_Profit_D = (1800 - 350 - 250) * Trucks_D\nNet_Profit_E = (2000 - 400 - 300) * Trucks_E\n# So, the objective function is: Maximize (Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C + Net_Profit_D + Net_Profit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n# The total fuel cost across all routes must not exceed $10,000.\nmodel.addCons(200 * Trucks_A + 250 * Trucks_B + 300 * Trucks_C + 350 * Trucks_D + 400 * Trucks_E <= 10000)\n# The total maintenance cost across all routes must not exceed $5000.\nmodel.addCons(100 * Trucks_A + 150 * Trucks_B + 200 * Trucks_C + 250 * Trucks_D + 300 * Trucks_E <= 5000)\n# The demand for Route A is at least 5 trucks.\nmodel.addCons(Trucks_A >= 5)\n# The demand for Route E is at most twice the number of trucks on Route A.\nmodel.addCons(Trucks_E <= 2 * Trucks_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Route E: \", model.getVal(Trucks_E))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1207,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"0 <= Automation <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The level of automation reduces the production cost by $1 for every unit produced for every 10% increase in automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n// Cost_A = 100 - 0.1 * Automation * Q_A\n// Cost_B = 150 - 0.1 * Automation * Q_B\n// Cost_C = 200 - 0.1 * Automation * Q_C\n// Revenue_A = 150 * Q_A\n// Revenue_B = 200 * Q_B\n// Revenue_C = 250 * Q_C\n// Net_Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Net_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// Q_A + Q_B + Q_C <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $10,000.\n// Automation <= 10000\n\n## Generate Constraint-3:\nThe demand for ProductA is at least 100 units and for ProductB is at least 150 units.\n// Q_A >= 100\n// Q_B >= 150\n\n## Generate Constraint-4:\nThe company must maintain a minimum level of automation of 30% to ensure quality and efficiency.\n// Automation >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. The level of automation reduces the production cost by $1 for every unit produced for every 10% increase in automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n\nThe company has a total production capacity of 1000 units across all products. The investment in automation cannot exceed $10,000. The demand for ProductA is at least 100 units and for ProductB is at least 150 units. The company must maintain a minimum level of automation of 30% to ensure quality and efficiency.\n\nPlease help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nCost_A = 100 - 0.1 * Automation * Q_A\nCost_B = 150 - 0.1 * Automation * Q_B\nCost_C = 200 - 0.1 * Automation * Q_C\nRevenue_A = 150 * Q_A\nRevenue_B = 200 * Q_B\nRevenue_C = 250 * Q_C\nNet_Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit)\n\n# Add constraints\nmodel.addCons(Q_A + Q_B + Q_C <= 1000) # total production capacity\nmodel.addCons(Automation <= 10000) # investment in automation\nmodel.addCons(Q_A >= 100) # demand for ProductA\nmodel.addCons(Q_B >= 150) # demand for ProductB\nmodel.addCons(Automation >= 30) # minimum level of automation\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in energy-saving technology for product A\": \"EnergyInvestA\", \"range\": \"EnergyInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product B\": \"EnergyInvestB\", \"range\": \"EnergyInvestB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product C\": \"EnergyInvestC\", \"range\": \"EnergyInvestC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy-saving technology for product D\": \"EnergyInvestD\", \"range\": \"EnergyInvestD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n// Profit of product A: ProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\n// Profit of product B: ProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\n// Profit of product C: ProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\n// Profit of product D: ProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for energy-saving technology investments.\n// EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000\n\n## Generate Constraint-2:\nThe total raw material cost must not exceed $50,000.\n// 30 * A + 40 * B + 50 * C + 60 * D <= 50000\n\n## Generate Constraint-3:\nThe total labor cost must not exceed $30,000.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 30000\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of product A and 300 units of product B.\n// A >= 500; B >= 300",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the costs of raw materials, labor, and energy. Additionally, the company is considering investing in energy-saving technologies for each product line to reduce energy costs.\n\nThe selling price of product A is $100, product B is $150, product C is $200, and product D is $250. The raw material cost for product A is $30, product B is $40, product C is $50, and product D is $60. The labor cost for product A is $20, product B is $30, product C is $40, and product D is $50. The energy cost per unit for product A is $10 - 0.001 * EnergyInvestA, product B is $15 - 0.001 * EnergyInvestB, product C is $20 - 0.001 * EnergyInvestC, and product D is $25 - 0.001 * EnergyInvestD. The company aims to maximize its total profit.\n\nThe company has a budget of $100,000 for energy-saving technology investments. The total raw material cost must not exceed $50,000. The total labor cost must not exceed $30,000. The company must produce at least 500 units of product A and 300 units of product B.\n\nPlease help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # production quantity of product D\nEnergyInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestA\", lb=0) # investment in energy-saving technology for product A\nEnergyInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestB\", lb=0) # investment in energy-saving technology for product B\nEnergyInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestC\", lb=0) # investment in energy-saving technology for product C\nEnergyInvestD = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestD\", lb=0) # investment in energy-saving technology for product D\n\n# Define objective function\nProfitA = (100 - 30 - 20 - (10 - 0.001 * EnergyInvestA)) * A\nProfitB = (150 - 40 - 30 - (15 - 0.001 * EnergyInvestB)) * B\nProfitC = (200 - 50 - 40 - (20 - 0.001 * EnergyInvestC)) * C\nProfitD = (250 - 60 - 50 - (25 - 0.001 * EnergyInvestD)) * D\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a budget of $100,000 for energy-saving technology investments.\nmodel.addCons(EnergyInvestA + EnergyInvestB + EnergyInvestC + EnergyInvestD <= 100000)\n# The total raw material cost must not exceed $50,000.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D <= 50000)\n# The total labor cost must not exceed $30,000.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Production Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Energy-Saving Technology for Product A: \", model.getVal(EnergyInvestA))\n    print(\"Investment in Energy-Saving Technology for Product B: \", model.getVal(EnergyInvestB))\n    print(\"Investment in Energy-Saving Technology for Product C: \", model.getVal(EnergyInvestC))\n    print(\"Investment in Energy-Saving Technology for Product D: \", model.getVal(EnergyInvestD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, for ComponentD is $60, and for ComponentE is $80. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is as follows:\n- CostA(UnitsA) = 1000 + 20 * UnitsA + 0.1 * UnitsA^2\n- CostB(UnitsB) = 1500 + 25 * UnitsB + 0.15 * UnitsB^2\n- CostC(UnitsC) = 2000 + 30 * UnitsC + 0.2 * UnitsC^2\n- CostD(UnitsD) = 1200 + 22 * UnitsD + 0.12 * UnitsD^2\n- CostE(UnitsE) = 1800 + 28 * UnitsE + 0.18 * UnitsE^2\nThe company wants to maximize its total net profit.\n// NetProfitA = (50 * UnitsA) - CostA(UnitsA)\n// NetProfitB = (70 * UnitsB) - CostB(UnitsB)\n// NetProfitC = (90 * UnitsC) - CostC(UnitsC)\n// NetProfitD = (60 * UnitsD) - CostD(UnitsD)\n// NetProfitE = (80 * UnitsE) - CostE(UnitsE)\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget constraint of $50,000 for total production costs.\n// CostA(UnitsA) + CostB(UnitsB) + CostC(UnitsC) + CostD(UnitsD) + CostE(UnitsE) <= 50,000",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit. The profit per unit for each component and the production cost function for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|---------------------------|\n| ComponentA | $50             | 1000 + 20 * UnitsA + 0.1 * UnitsA^2 |\n| ComponentB | $70             | 1500 + 25 * UnitsB + 0.15 * UnitsB^2 |\n| ComponentC | $90             | 2000 + 30 * UnitsC + 0.2 * UnitsC^2 |\n| ComponentD | $60             | 1200 + 22 * UnitsD + 0.12 * UnitsD^2 |\n| ComponentE | $80             | 1800 + 28 * UnitsE + 0.18 * UnitsE^2 |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint of $50,000 for total production costs.\n\nPlease help the company to maximize its total net profit, which is calculated as the sum of the profit per unit minus the production cost for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0)  # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0)  # number of units of ComponentE\n\n# Define objective function\n# NetProfitA = (50 * UnitsA) - CostA(UnitsA)\n# NetProfitB = (70 * UnitsB) - CostB(UnitsB)\n# NetProfitC = (90 * UnitsC) - CostC(UnitsC)\n# NetProfitD = (60 * UnitsD) - CostD(UnitsD)\n# NetProfitE = (80 * UnitsE) - CostE(UnitsE)\n# So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\nCostA = 1000 + 20 * UnitsA + 0.1 * UnitsA**2\nCostB = 1500 + 25 * UnitsB + 0.15 * UnitsB**2\nCostC = 2000 + 30 * UnitsC + 0.2 * UnitsC**2\nCostD = 1200 + 22 * UnitsD + 0.12 * UnitsD**2\nCostE = 1800 + 28 * UnitsE + 0.18 * UnitsE**2\nNetProfitA = 50 * UnitsA - CostA\nNetProfitB = 70 * UnitsB - CostB\nNetProfitC = 90 * UnitsC - CostC\nNetProfitD = 60 * UnitsD - CostD\nNetProfitE = 80 * UnitsE - CostE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n# Add constraints\n# The company has a total production capacity of 1000 units across all components.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\n# Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# The company has a budget constraint of $50,000 for total production costs.\nmodel.addCons(CostA + CostB + CostC + CostD + CostE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network.\n// {\"number of trips to CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips to CityE\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for each truck is $0.5, and the distance from CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips.\n// Fuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\n// Fuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\n// Fuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\n// Fuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\n// Fuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\n// Fuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\n// Fuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\n// Fuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\n// Fuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\n// Fuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\n// Fuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\n// Fuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\n// Fuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\n// Fuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\n// Fuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\n// Fuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\n// Fuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\n// Fuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\n// Fuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\n// Fuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n// So, the objective function is: Minimize (Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n## Generate Constraint-1:\nThe company has a total of 1000 trips available per week.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 1000\n\n## Generate Constraint-2:\nDue to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB.\n// TripsA <= 2 * TripsB\n\n## Generate Constraint-3:\nThe company has a limit on the total distance traveled per week, which is 500,000 km.\n// 200 * (TripsA * TripsB + TripsB * TripsA) + 300 * (TripsA * TripsC + TripsC * TripsA + TripsB * TripsC + TripsC * TripsB) + 400 * (TripsA * TripsD + TripsD * TripsA + TripsB * TripsD + TripsD * TripsB + TripsC * TripsD + TripsD * TripsC) + 500 * (TripsA * TripsE + TripsE * TripsA + TripsB * TripsE + TripsE * TripsB + TripsC * TripsE + TripsE * TripsC + TripsD * TripsE + TripsE * TripsD) <= 500000\n\n## Generate Constraint-4:\nThe company wants to ensure that each city receives at least 50 trips per week.\n// TripsA >= 50; TripsB >= 50; TripsC >= 50; TripsD >= 50; TripsE >= 50",
        "question": "A logistics company is managing a fleet of trucks that transport goods between five major cities: CityA, CityB, CityC, CityD, and CityE. The company needs to determine the number of trips each truck should make to each city to optimize their logistics network. The cost of fuel per kilometer for each truck is $0.5, and the distance from CityA to CityB is 200 km, CityA to CityC is 300 km, CityA to CityD is 400 km, and CityA to CityE is 500 km. The company wants to minimize the total fuel cost for all trips. The company has a total of 1000 trips available per week. Due to city regulations, the number of trips to CityA cannot exceed twice the number of trips to CityB. The company has a limit on the total distance traveled per week, which is 500,000 km. The company wants to ensure that each city receives at least 50 trips per week. Please help the company to minimize the total fuel cost for all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=50)  # number of trips to CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=50)  # number of trips to CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=50)  # number of trips to CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=50)  # number of trips to CityD\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=50)  # number of trips to CityE\n\n# Define objective function\nFuel_Cost_AB = 0.5 * 200 * TripsA * TripsB\nFuel_Cost_AC = 0.5 * 300 * TripsA * TripsC\nFuel_Cost_AD = 0.5 * 400 * TripsA * TripsD\nFuel_Cost_AE = 0.5 * 500 * TripsA * TripsE\nFuel_Cost_BA = 0.5 * 200 * TripsB * TripsA\nFuel_Cost_BC = 0.5 * 300 * TripsB * TripsC\nFuel_Cost_BD = 0.5 * 400 * TripsB * TripsD\nFuel_Cost_BE = 0.5 * 500 * TripsB * TripsE\nFuel_Cost_CA = 0.5 * 300 * TripsC * TripsA\nFuel_Cost_CB = 0.5 * 300 * TripsC * TripsB\nFuel_Cost_CD = 0.5 * 400 * TripsC * TripsD\nFuel_Cost_CE = 0.5 * 500 * TripsC * TripsE\nFuel_Cost_DA = 0.5 * 400 * TripsD * TripsA\nFuel_Cost_DB = 0.5 * 400 * TripsD * TripsB\nFuel_Cost_DC = 0.5 * 400 * TripsD * TripsC\nFuel_Cost_DD = 0.5 * 500 * TripsD * TripsE\nFuel_Cost_EA = 0.5 * 500 * TripsE * TripsA\nFuel_Cost_EB = 0.5 * 500 * TripsE * TripsB\nFuel_Cost_EC = 0.5 * 500 * TripsE * TripsC\nFuel_Cost_ED = 0.5 * 500 * TripsE * TripsD\n\n# Objective function is to minimize total fuel cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_AB + Fuel_Cost_AC + Fuel_Cost_AD + Fuel_Cost_AE + Fuel_Cost_BA + Fuel_Cost_BC + Fuel_Cost_BD + Fuel_Cost_BE + Fuel_Cost_CA + Fuel_Cost_CB + Fuel_Cost_CD + Fuel_Cost_CE + Fuel_Cost_DA + Fuel_Cost_DB + Fuel_Cost_DC + Fuel_Cost_DD + Fuel_Cost_EA + Fuel_Cost_EB + Fuel_Cost_EC + Fuel_Cost_ED)\n\n# Add constraints\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 1000)  # Total trips constraint\nmodel.addCons(TripsA <= 2 * TripsB)  # CityA trips constraint\nmodel.addCons(200 * (TripsA * TripsB + TripsB * TripsA) + 300 * (TripsA * TripsC + TripsC * TripsA + TripsB * TripsC + TripsC * TripsB) + 400 * (TripsA * TripsD + TripsD * TripsA + TripsB * TripsD + TripsD * TripsB + TripsC * TripsD + TripsD * TripsC) + 500 * (TripsA * TripsE + TripsE * TripsA + TripsB * TripsE + TripsE * TripsB + TripsC * TripsE + TripsE * TripsC + TripsD * TripsE + TripsE * TripsD) <= 500000)  # Distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to CityA: \", model.getVal(TripsA))\n    print(\"Number of trips to CityB: \", model.getVal(TripsB))\n    print(\"Number of trips to CityC: \", model.getVal(TripsC))\n    print(\"Number of trips to CityD: \", model.getVal(TripsD))\n    print(\"Number of trips to CityE: \", model.getVal(TripsE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer aims to maximize the total profit.\n// Profit_E1 = 100 * Q1\n// Profit_E2 = 150 * Q2\n// Profit_E3 = 200 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of component C1, with only 500 units available.\n// 2 * Q1 + 3 * Q2 + 4 * Q3 <= 500\n\n## Generate Constraint-2:\nThe supply of component C2 is also limited, with only 200 units available.\n// Q2 + 2 * Q3 <= 200\n\n## Generate Constraint-3:\nThe production capacity for E1 is limited to 100 units due to specific machinery constraints.\n// Q1 <= 100\n\n## Generate Constraint-4:\nThe market demand for E3 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E3.\n// Q3 <= 50",
        "question": "A manufacturer produces three types of electronic devices: E1, E2, and E3. They need to determine the optimal production quantities of each device to maximize their profit while considering various constraints. The profit per unit of E1 is $100, but it requires 2 units of a rare component C1. The profit per unit of E2 is $150, requiring 3 units of C1 and 1 unit of another component C2. The profit per unit of E3 is $200, requiring 4 units of C1 and 2 units of C2. The manufacturer has a limited supply of component C1, with only 500 units available, and the supply of component C2 is also limited, with only 200 units available. The production capacity for E1 is limited to 100 units due to specific machinery constraints, and the market demand for E3 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E3. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\nProfit_E1 = 100 * Q1\nProfit_E2 = 150 * Q2\nProfit_E3 = 200 * Q3\n# So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n# The manufacturer has a limited supply of component C1, with only 500 units available.\nmodel.addCons(2 * Q1 + 3 * Q2 + 4 * Q3 <= 500)\n# The supply of component C2 is also limited, with only 200 units available.\nmodel.addCons(Q2 + 2 * Q3 <= 200)\n# The production capacity for E1 is limited to 100 units due to specific machinery constraints.\nmodel.addCons(Q1 <= 100)\n# The market demand for E3 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E3.\nmodel.addCons(Q3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be used across all regions.\n// T1 + T2 + T3 + T4 + T5 <= 5\n\n## Generate Constraint-3:\nThe demand for trucks in R1 is at least 1, and in R5 is at most 2.\n// T1 >= 1\n// T5 <= 2",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck and the revenue generated by each truck in each region are given in the following Table.\n\n| Region | Operating Cost per Truck per Day | Revenue per Truck per Day |\n|--------|----------------------------------|---------------------------|\n| R1     | $1000                            | $1500                     |\n| R2     | $1200                            | $1800                     |\n| R3     | $1500                            | $2100                     |\n| R4     | $1800                            | $2400                     |\n| R5     | $2000                            | $2700                     |\n\nThe company has a total budget of $10,000 per day for operating costs. The company has a limit of 5 trucks that can be used across all regions. The demand for trucks in R1 is at least 1, and in R5 is at most 2. The company wants to maximize the net profit (revenue minus cost) per truck per day. Please help the company determine the optimal allocation of trucks to each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_R1 = (1500 - 1000) # Profit per truck in R1\nProfit_R2 = (1800 - 1200) # Profit per truck in R2\nProfit_R3 = (2100 - 1500) # Profit per truck in R3\nProfit_R4 = (2400 - 1800) # Profit per truck in R4\nProfit_R5 = (2700 - 2000) # Profit per truck in R5\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be used across all regions.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n## The demand for trucks in R1 is at least 1, and in R5 is at most 2.\nmodel.addCons(T1 >= 1)\nmodel.addCons(T5 <= 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel cost per truck per km\": \"FuelCostTruck\", \"range\": \"FuelCostTruck >= 0\", \"type\": \"real\"}\n// {\"fuel cost per van per km\": \"FuelCostVan\", \"range\": \"FuelCostVan >= 0\", \"type\": \"real\"}\n// {\"fuel cost per bike per km\": \"FuelCostBike\", \"range\": \"FuelCostBike >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day, given that each vehicle type covers a different distance per day. Trucks cover 200 km, vans cover 150 km, and bikes cover 50 km. The fuel cost per km for trucks is $0.5, for vans is $0.3, and for bikes is $0.1.\n// TotalFuelCost = Trucks * 200 * FuelCostTruck + Vans * 150 * FuelCostVan + Bikes * 50 * FuelCostBike\n// So, the objective function is: Minimize TotalFuelCost\n// Minimize (Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for vehicle maintenance and fuel.\n// Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1 <= 1000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 20 trucks and 30 vans due to licensing restrictions.\n// Trucks <= 20\n// Vans <= 30",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels. The distance covered and fuel cost per km for each vehicle type are given in the following Table.\n\n| Vehicle Type | Distance Covered per Day | Fuel Cost per km |\n|--------------|-------------------------|------------------|\n| Trucks       | 200 km                  | $0.5             |\n| Vans         | 150 km                  | $0.3             |\n| Bikes        | 50 km                   | $0.1             |\n\nThe company aims to minimize the total fuel cost per day. The company has a budget of $1000 per day for vehicle maintenance and fuel. Due to licensing restrictions, the company can only operate a maximum of 20 trucks and 30 vans. Please help the company to determine the optimal number of trucks, vans, and bikes to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1)\nTotalFuelCost = Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n## The company has a budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1 <= 1000)\n## The company can only operate a maximum of 20 trucks and 30 vans due to licensing restrictions.\nmodel.addCons(Trucks <= 20)\nmodel.addCons(Vans <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Refrigerated trucks\": \"MaintenanceRefrigerated\", \"range\": \"MaintenanceRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Heavy trucks\": \"MaintenanceHeavy\", \"range\": \"MaintenanceHeavy >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Standard trucks\": \"MaintenanceStandard\", \"range\": \"MaintenanceStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Refrigerated trucks: CostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\n// Total operational cost for Heavy trucks: CostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\n// Total operational cost for Standard trucks: CostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and maintenance.\n// 1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks. The operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet.\n\n| Type of Truck | Operational Cost per Truck per Month | Decrease in Cost per $500 Maintenance |\n|---------------|--------------------------------------|---------------------------------------|\n| Refrigerated   | $1000                                | $100                                  |\n| Heavy         | $1500                                | $150                                  |\n| Standard      | $800                                 | $80                                   |\n\nThe company has a budget of $200,000 for purchasing trucks and maintenance. The total number of trucks in the fleet must not exceed 200. Please help the company to determine the optimal number of each type of truck and the appropriate level of maintenance to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nMaintenanceRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceRefrigerated\", lb=0)\nMaintenanceHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHeavy\", lb=0)\nMaintenanceStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\nCostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\nCostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Level for Refrigerated Trucks: \", model.getVal(MaintenanceRefrigerated))\n    print(\"Maintenance Level for Heavy Trucks: \", model.getVal(MaintenanceHeavy))\n    print(\"Maintenance Level for Standard Trucks: \", model.getVal(MaintenanceStandard))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1677,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, with a production cost per unit of $10 and a storage cost per unit of $5. \nThe profit per unit of P2 is $40, with a production cost per unit of $15 and a storage cost per unit of $7. \nThe profit per unit of P3 is $50, with a production cost per unit of $20 and a storage cost per unit of $9. \nThe manufacturer aims to maximize the total net profit (profit minus production and storage costs) while considering the storage space and production time.\n// NetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\n// NetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\n// NetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n// The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited storage space of 200 cubic meters. The storage requirement for P1 is 2 cubic meters per unit, for P2 is 3 cubic meters per unit, and for P3 is 4 cubic meters per unit.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a limited production time of 150 hours. The production time for P1 is 3 hours per unit, for P2 is 4 hours per unit, and for P3 is 5 hours per unit.\n// 3 * P1 + 4 * P2 + 5 * P3 <= 150\n\n## Generate Constraint-3:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * P1 + 15 * P2 + 20 * P3 <= 3000\n\n## Generate Constraint-4:\nThe market demand for P1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of P1.\n// P1 <= 10\n\n## Generate Constraint-5:\nThe manufacturer wants to ensure that at least 20% of the production is of P3 to meet a specific contract requirement.\n// P3 >= 0.2 * (P1 + P2 + P3)",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. They need to determine the quantities of each product to maximize their profit while considering various constraints. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| P1      | $30             | $10                      | $5                    |\n| P2      | $40             | $15                      | $7                    |\n| P3      | $50             | $20                      | $9                    |\n\nThe manufacturer has a limited storage space of 200 cubic meters. The storage requirement for P1 is 2 cubic meters per unit, for P2 is 3 cubic meters per unit, and for P3 is 4 cubic meters per unit. The manufacturer has a limited production time of 150 hours. The production time for P1 is 3 hours per unit, for P2 is 4 hours per unit, and for P3 is 5 hours per unit. The manufacturer has a budget of $3000 for production costs. The market demand for P1 is 10 units. So, the manufacturer can only sell a maximum of 10 units of P1. The manufacturer wants to ensure that at least 20% of the production is of P3 to meet a specific contract requirement.\n\nPlease help the manufacturer to maximize the total net profit (profit minus production and storage costs) while considering the storage space, production time, and other constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = 30 * P1 - 10 * P1 - 5 * P1\nNetProfit_P2 = 40 * P2 - 15 * P2 - 7 * P2\nNetProfit_P3 = 50 * P3 - 20 * P3 - 9 * P3\n# The objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The manufacturer has a limited storage space of 200 cubic meters.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n# The manufacturer has a limited production time of 150 hours.\nmodel.addCons(3 * P1 + 4 * P2 + 5 * P3 <= 150)\n# The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * P1 + 15 * P2 + 20 * P3 <= 3000)\n# The market demand for P1 is 10 units.\nmodel.addCons(P1 <= 10)\n# The manufacturer wants to ensure that at least 20% of the production is of P3.\nmodel.addCons(P3 >= 0.2 * (P1 + P2 + P3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1547,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker. The production rate per worker varies by product type.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"overtime hours per worker\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $80. The cost of labor per worker is $2000 per month, and overtime costs an additional $30 per hour. The production rate per worker for ProductA is 10 units per month, for ProductB is 15 units per month, and for ProductC is 20 units per month. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = 50 * UnitsA - 2000 * WorkersA - 30 * Overtime * WorkersA\n// Total profit for ProductB: ProfitB = 70 * UnitsB - 2000 * WorkersB - 30 * Overtime * WorkersB\n// Total profit for ProductC: ProfitC = 80 * UnitsC - 2000 * WorkersC - 30 * Overtime * WorkersC\n// UnitsA = 10 * WorkersA * (1 + Overtime)\n// UnitsB = 15 * WorkersB * (1 + Overtime)\n// UnitsC = 20 * WorkersC * (1 + Overtime)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe total overtime hours allowed for all workers cannot exceed 100 hours.\n// Overtime * (WorkersA + WorkersB + WorkersC) <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 units of ProductA and 15 units of ProductB are produced.\n// UnitsA >= 10; UnitsB >= 15\n\n## Generate Constraint-4:\nDue to market demand, the number of units of ProductC cannot exceed 200.\n// UnitsC <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker. The production rate per worker varies by product type. The profit per unit, labor cost, and production rate for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Cost per Worker | Production Rate per Worker |\n|---------|-----------------|-----------------------|----------------------------|\n| ProductA | $50             | $2000 per month       | 10 units per month         |\n| ProductB | $70             | $2000 per month       | 15 units per month         |\n| ProductC | $80             | $2000 per month       | 20 units per month         |\n\nThe company has a total of 50 workers available. The total overtime hours allowed for all workers cannot exceed 100 hours. The company must ensure that at least 10 units of ProductA and 15 units of ProductB are produced. Due to market demand, the number of units of ProductC cannot exceed 200. \n\nPlease help the company to maximize the total profit from all products, considering the costs of labor and overtime.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0)  # overtime hours per worker\n\n# Define objective function\nProfitA = 50 * UnitsA - 2000 * WorkersA - 30 * Overtime * WorkersA\nProfitB = 70 * UnitsB - 2000 * WorkersB - 30 * Overtime * WorkersB\nProfitC = 80 * UnitsC - 2000 * WorkersC - 30 * Overtime * WorkersC\nmodel.addCons(UnitsA == 10 * WorkersA * (1 + Overtime))\nmodel.addCons(UnitsB == 15 * WorkersB * (1 + Overtime))\nmodel.addCons(UnitsC == 20 * WorkersC * (1 + Overtime))\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\nmodel.addCons(Overtime * (WorkersA + WorkersB + WorkersC) <= 100)\nmodel.addCons(UnitsA >= 10)\nmodel.addCons(UnitsB >= 15)\nmodel.addCons(UnitsC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Overtime Hours per Worker: \", model.getVal(Overtime))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach product has a different profit margin and requires a different amount of production time. The profit margin for product A is $5 per unit, for B is $7 per unit, for C is $9 per unit, for D is $11 per unit, and for E is $13 per unit. The production time for A is 1 hour per unit, for B is 2 hours per unit, for C is 3 hours per unit, for D is 4 hours per unit, and for E is 5 hours per unit. The company aims to maximize the total profit per unit of time (profit rate).\n// Profit of A: Profit_A = 5 * A\n// Profit of B: Profit_B = 7 * B\n// Profit of C: Profit_C = 9 * C\n// Profit of D: Profit_D = 11 * D\n// Profit of E: Profit_E = 13 * E\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 for raw materials.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 hours.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 200\n\n## Generate Constraint-3:\nThe company wants to produce at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15; E >= 15\n\n## Generate Constraint-4:\nThe production of product D should not exceed the combined production of products A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces five different products: A, B, C, D, and E. The company needs to determine the optimal production quantity for each product to maximize its profit while considering various constraints. The profit margin and production time for each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Production Time per Unit |\n|---------|------------------------|--------------------------|\n| A       | $5                     | 1 hour                   |\n| B       | $7                     | 2 hours                  |\n| C       | $9                     | 3 hours                  |\n| D       | $11                    | 4 hours                  |\n| E       | $13                    | 5 hours                  |\n\nThe company has a budget of $1500 for raw materials. The company has a production capacity of 200 hours. The company wants to produce at least 15 units of each product. The production of product D should not exceed the combined production of products A, B, and C. \nPlease help the company to maximize the total profit per unit of time (profit rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 15 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=15) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nProfit_D = 11 * D\nProfit_E = 13 * E\nProductionTime = A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $1500 for raw materials.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n## The company has a production capacity of 200 hours.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 200)\n## The production of product D should not exceed the combined production of products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations.\n// {\"number of trucks allocated to region A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in region A is $500 per day, with a delivery efficiency of 10 deliveries per day.\nIn region B, the cost is $600 per day, with an efficiency of 12 deliveries per day.\nIn region C, the cost is $700 per day, with an efficiency of 14 deliveries per day.\nIn region D, the cost is $800 per day, with an efficiency of 16 deliveries per day.\nIn region E, the cost is $900 per day, with an efficiency of 18 deliveries per day.\nThe company aims to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).\n// Total operating cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// Total number of deliveries: Deliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n// So, the objective function is: Minimize Cost / Deliveries\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for operating costs.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000\n\n## Generate Constraint-2:\nThe company must ensure that at least 100 deliveries are made each day.\n// 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100\n\n## Generate Constraint-3:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 20",
        "question": "A logistics company is planning its delivery routes for five different regions (A, B, C, D, and E). The company needs to decide how many trucks to allocate to each region to optimize its operations. The cost of operating a truck and the delivery efficiency for each region are given in the following Table.\n\n| Region | Operating Cost per Truck per Day | Delivery Efficiency per Truck per Day |\n|--------|----------------------------------|---------------------------------------|\n| A      | $500                             | 10                                    |\n| B      | $600                             | 12                                    |\n| C      | $700                             | 14                                    |\n| D      | $800                             | 16                                    |\n| E      | $900                             | 18                                    |\n\nThe company has a budget of $10,000 per day for operating costs. The company must ensure that at least 100 deliveries are made each day. The company can allocate a maximum of 20 trucks in total across all regions. \nPlease help the company to minimize the Cost-Efficiency ratio (defined as the total operating cost divided by the total number of deliveries).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks allocated to region A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks allocated to region B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks allocated to region C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks allocated to region D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks allocated to region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nDeliveries = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n## the objective function is: Minimize Cost / Deliveries\n## convert the division to multiplication\nmodel.addCons(obj * Deliveries == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for operating costs.\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 10000)\n## The company must ensure that at least 100 deliveries are made each day.\nmodel.addCons(10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE >= 100)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region A: \", model.getVal(TruckA))\n    print(\"Number of Trucks in Region B: \", model.getVal(TruckB))\n    print(\"Number of Trucks in Region C: \", model.getVal(TruckC))\n    print(\"Number of Trucks in Region D: \", model.getVal(TruckD))\n    print(\"Number of Trucks in Region E: \", model.getVal(TruckE))\n    print(\"Minimized Cost-Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the amount of fuel to be used per truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Route1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Route2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Route3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of the logistics company is influenced by the number of trucks and their fuel consumption rates. The cost of fuel per liter is $1.5, and the cost of operating a truck per route is $100. The company aims to minimize the total operational cost, which includes fuel and truck operation costs.\n// Operational cost for Route1: Cost1 = (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1)\n// Operational cost for Route2: Cost2 = (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2)\n// Operational cost for Route3: Cost3 = (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for operational costs is $10,000.\n// (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1) + (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2) + (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3) <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nDue to contractual agreements, at least 10 trucks must be assigned to Route1, and the fuel consumption rate for Route1 must not exceed 5 liters per truck per route.\n// Trucks1 >= 10; FuelRate1 <= 5\n\n## Generate Constraint-4:\nThe delivery deadlines require that the total distance covered by Route2 and Route3 combined must be at least 1000 kilometers. The distance covered by each route is proportional to the number of trucks and their fuel consumption rates.\n// (Trucks2 * FuelRate2) + (Trucks3 * FuelRate3) >= 1000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the fuel consumption strategy to minimize operational costs while meeting delivery deadlines. The variables include the number of trucks assigned to each route and the amount of fuel to be used per truck. The operational cost of the logistics company is influenced by the number of trucks and their fuel consumption rates. The cost of fuel per liter is $1.5, and the cost of operating a truck per route is $100.\n\n| Route | Number of Trucks | Fuel Consumption Rate |\n|-------|------------------|-----------------------|\n| Route1 | Trucks1 | FuelRate1 |\n| Route2 | Trucks2 | FuelRate2 |\n| Route3 | Trucks3 | FuelRate3 |\n\nThe total budget for operational costs is $10,000. The total number of trucks available is limited to 50. Due to contractual agreements, at least 10 trucks must be assigned to Route1, and the fuel consumption rate for Route1 must not exceed 5 liters per truck per route. The delivery deadlines require that the total distance covered by Route2 and Route3 combined must be at least 1000 kilometers. The distance covered by each route is proportional to the number of trucks and their fuel consumption rates.\n\nPlease help the company to minimize the total operational cost, which includes fuel and truck operation costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0, ub=5)  # fuel consumption rate for Route1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate for Route2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate for Route3\n\n# Define objective function\nCost1 = (100 * Trucks1) + (1.5 * FuelRate1 * Trucks1)\nCost2 = (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2)\nCost3 = (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons((100 * Trucks1) + (1.5 * FuelRate1 * Trucks1) + (100 * Trucks2) + (1.5 * FuelRate2 * Trucks2) + (100 * Trucks3) + (1.5 * FuelRate3 * Trucks3) <= 10000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\nmodel.addCons(Trucks1 >= 10)\nmodel.addCons(FuelRate1 <= 5)\nmodel.addCons((Trucks2 * FuelRate2) + (Trucks3 * FuelRate3) >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Consumption Rate for Route1: \", model.getVal(FuelRate1))\n    print(\"Fuel Consumption Rate for Route2: \", model.getVal(FuelRate2))\n    print(\"Fuel Consumption Rate for Route3: \", model.getVal(FuelRate3))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1406,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to allocate to each region to optimize its operations.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in Region1 is $1000 per day, the revenue per delivery is $500, and the average delivery time is 4 hours.\nIn Region2, the cost is $1200 per day, the revenue is $600, and the average delivery time is 5 hours.\nIn Region3, the cost is $1400 per day, the revenue is $700, and the average delivery time is 6 hours.\nIn Region4, the cost is $1600 per day, the revenue is $800, and the average delivery time is 7 hours.\nIn Region5, the cost is $1800 per day, the revenue is $900, and the average delivery time is 8 hours.\nThe company wants to maximize the profit per hour of operation across all regions.\n// Profit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\n// Profit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\n// Profit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\n// Profit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\n// Profit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n// So, the objective function is: Maximize (Profit_Region1 + Profit_Region2 + Profit_Region3 + Profit_Region4 + Profit_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 per day for operating costs.\n// 1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available across all regions is 100.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100\n\n## Generate Constraint-3:\nThe demand in Region1 requires at least 10 trucks.\n// Truck1 >= 10\n\n## Generate Constraint-4:\nNo more than 30 trucks can be allocated to Region3 due to infrastructure limitations.\n// Truck3 <= 30\n\n## Generate Constraint-5:\nThe company aims to allocate at least 20% of its total trucks to Region5 for strategic market penetration.\n// Truck5 >= 0.2 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)",
        "question": "A logistics company is planning its routes for five different regions (Region1, Region2, Region3, Region4, Region5) and needs to decide the number of trucks to allocate to each region to optimize its operations. The cost of operating a truck in Region1 is $1000 per day, the revenue per delivery is $500, and the average delivery time is 4 hours. In Region2, the cost is $1200 per day, the revenue is $600, and the average delivery time is 5 hours. In Region3, the cost is $1400 per day, the revenue is $700, and the average delivery time is 6 hours. In Region4, the cost is $1600 per day, the revenue is $800, and the average delivery time is 7 hours. In Region5, the cost is $1800 per day, the revenue is $900, and the average delivery time is 8 hours. The company has a total budget of $100,000 per day for operating costs and a total of 100 trucks available across all regions. The demand in Region1 requires at least 10 trucks, and no more than 30 trucks can be allocated to Region3 due to infrastructure limitations. The company aims to allocate at least 20% of its total trucks to Region5 for strategic market penetration. Please help the company to maximize the profit per hour of operation across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks in Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Region1 = (500 * Truck1 - 1000 * Truck1) / 4\nProfit_Region2 = (600 * Truck2 - 1200 * Truck2) / 5\nProfit_Region3 = (700 * Truck3 - 1400 * Truck3) / 6\nProfit_Region4 = (800 * Truck4 - 1600 * Truck4) / 7\nProfit_Region5 = (900 * Truck5 - 1800 * Truck5) / 8\n## the objective function is: Maximize (Profit_Region1 + Profit_Region2 + Profit_Region3 + Profit_Region4 + Profit_Region5)\n## convert the division to multiplication\nmodel.addCons(obj * (4 * Truck1 + 5 * Truck2 + 6 * Truck3 + 7 * Truck4 + 8 * Truck5) == 4 * Profit_Region1 + 5 * Profit_Region2 + 6 * Profit_Region3 + 7 * Profit_Region4 + 8 * Profit_Region5)\n\n# Add constraints\n## The company has a total budget of $100,000 per day for operating costs.\nmodel.addCons(1000 * Truck1 + 1200 * Truck2 + 1400 * Truck3 + 1600 * Truck4 + 1800 * Truck5 <= 100000)\n## The total number of trucks available across all regions is 100.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 100)\n## The demand in Region1 requires at least 10 trucks.\nmodel.addCons(Truck1 >= 10)\n## No more than 30 trucks can be allocated to Region3 due to infrastructure limitations.\nmodel.addCons(Truck3 <= 30)\n## The company aims to allocate at least 20% of its total trucks to Region5 for strategic market penetration.\nmodel.addCons(Truck5 >= 0.2 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1218,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y).\n// {\"number of solar panels A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines X\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines Y\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company wants to minimize the total cost while maximizing the total energy output.\n// Total energy output: Energy = 15% * SolarA + 20% * SolarB + 25% * SolarC + 30% * WindX + 35% * WindY\n// Total cost: Cost = $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC + $2500 * WindX + $3000 * WindY <= 50000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50% of the budget is spent on solar panels.\n// $1000 * SolarA + $1500 * SolarB + $2000 * SolarC >= 0.5 * (50000)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified three types of solar panels (A, B, C) and two types of wind turbines (X, Y). The efficiency of solar panels A, B, and C is 15%, 20%, and 25% respectively, and their costs per unit are $1000, $1500, and $2000 respectively. The efficiency of wind turbines X and Y is 30% and 35% respectively, and their costs per unit are $2500 and $3000 respectively. The company has a budget of $50,000 for the installation. The company wants to ensure that at least 50% of the budget is spent on solar panels. \n\nPlease help the company to minimize the total cost while maximizing the total energy output, with the objective function being the minimization of the total cost divided by the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels C\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=0) # number of wind turbines X\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=0) # number of wind turbines Y\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nEnergy = 0.15 * SolarA + 0.20 * SolarB + 0.25 * SolarC + 0.30 * WindX + 0.35 * WindY\nCost = 1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC + 2500 * WindX + 3000 * WindY <= 50000)\n## The company wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * SolarA + 1500 * SolarB + 2000 * SolarC >= 0.5 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines X: \", model.getVal(WindX))\n    print(\"Number of Wind Turbines Y: \", model.getVal(WindY))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel cost per truck per km\": \"FuelCostTruck\", \"range\": \"FuelCostTruck >= 0\", \"type\": \"real\"}\n// {\"fuel cost per van per km\": \"FuelCostVan\", \"range\": \"FuelCostVan >= 0\", \"type\": \"real\"}\n// {\"fuel cost per bike per km\": \"FuelCostBike\", \"range\": \"FuelCostBike >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day, given that each vehicle type covers a different distance per day. Trucks cover 200 km, vans cover 150 km, and bikes cover 50 km. The fuel cost per km for trucks is $0.5, for vans is $0.3, and for bikes is $0.1.\n// TotalFuelCost = Trucks * 200 * FuelCostTruck + Vans * 150 * FuelCostVan + Bikes * 50 * FuelCostBike\n// So, the objective function is: Minimize TotalFuelCost\n// Minimize (Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for vehicle maintenance and fuel.\n// Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1 <= 1000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 20 trucks and 30 vans due to licensing restrictions.\n// Trucks <= 20\n// Vans <= 30\n\n## Generate Constraint-3:\nTo maintain service levels, the company must ensure that at least 50% of the total vehicles are either trucks or vans.\n// (Trucks + Vans) / (Trucks + Vans + Bikes) >= 0.5\n\n## Generate Constraint-4:\nThe total number of vehicles cannot exceed 50 due to parking space limitations.\n// Trucks + Vans + Bikes <= 50",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel costs and maintaining service levels. Trucks cover 200 km per day with a fuel cost of $0.5 per km, vans cover 150 km per day with a fuel cost of $0.3 per km, and bikes cover 50 km per day with a fuel cost of $0.1 per km. The company aims to minimize the total fuel cost per day. The company has a budget of $1000 per day for vehicle maintenance and fuel. Due to licensing restrictions, the company can only operate a maximum of 20 trucks and 30 vans. To maintain service levels, at least 50% of the total vehicles must be either trucks or vans. Additionally, the total number of vehicles cannot exceed 50 due to parking space limitations. Please help the company to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1)\nTotalFuelCost = Trucks * 200 * 0.5 + Vans * 150 * 0.3 + Bikes * 50 * 0.1\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n## The company has a budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(TotalFuelCost <= 1000)\n## The company can only operate a maximum of 20 trucks and 30 vans due to licensing restrictions.\nmodel.addCons(Trucks <= 20)\nmodel.addCons(Vans <= 30)\n## To maintain service levels, the company must ensure that at least 50% of the total vehicles are either trucks or vans.\nmodel.addCons((Trucks + Vans) / (Trucks + Vans + Bikes) >= 0.5)\n## The total number of vehicles cannot exceed 50 due to parking space limitations.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device for the next month. Additionally, the company must determine the number of hours to allocate for maintenance of each device's production line.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for DeviceA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n// {\"maintenance hours for DeviceD\": \"MD\", \"range\": \"MD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. The cost of maintenance per hour for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, and for DeviceD is $50. The company aims to maximize the total profit minus the total maintenance cost.\n// Profit from DeviceA: Profit_A = 50 * A - 20 * MA\n// Profit from DeviceB: Profit_B = 70 * B - 30 * MB\n// Profit from DeviceC: Profit_C = 90 * C - 40 * MC\n// Profit from DeviceD: Profit_D = 110 * D - 50 * MD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe total maintenance hours available for all devices is 100 hours.\n// MA + MB + MC + MD <= 100\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 500 units for DeviceA, 400 units for DeviceB, 300 units for DeviceC, and 200 units for DeviceD.\n// A <= 500; B <= 400; C <= 300; D <= 200",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide the production quantity for each device and the number of hours to allocate for maintenance of each device's production line for the next month. The profit per unit and the cost of maintenance per hour for each device are given in the following Table.\n\n| Device | Profit per Unit | Maintenance Cost per Hour |\n|--------|-----------------|---------------------------|\n| DeviceA | $50             | $20                       |\n| DeviceB | $70             | $30                       |\n| DeviceC | $90             | $40                       |\n| DeviceD | $110            | $50                       |\n\nThe company aims to maximize the total profit minus the total maintenance cost. The total maintenance hours available for all devices is 100 hours. The company has a production capacity limit of 500 units for DeviceA, 400 units for DeviceB, 300 units for DeviceC, and 200 units for DeviceD.\n\nPlease help the company determine the optimal production quantity for each device and the number of maintenance hours to allocate for each device's production line to maximize the total profit minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=500) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=200) # number of units of DeviceD\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # maintenance hours for DeviceA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # maintenance hours for DeviceB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # maintenance hours for DeviceC\nMD = model.addVar(vtype=\"CONTINUOUS\", name=\"MD\", lb=0) # maintenance hours for DeviceD\n\n# Define objective function\nProfit_A = 50 * A - 20 * MA\nProfit_B = 70 * B - 30 * MB\nProfit_C = 90 * C - 40 * MC\nProfit_D = 110 * D - 50 * MD\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The total maintenance hours available for all devices is 100 hours.\nmodel.addCons(MA + MB + MC + MD <= 100)\n# The company has a production capacity limit of 500 units for DeviceA, 400 units for DeviceB, 300 units for DeviceC, and 200 units for DeviceD.\nmodel.addCons(A <= 500)\nmodel.addCons(B <= 400)\nmodel.addCons(C <= 300)\nmodel.addCons(D <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maintenance hours for DeviceA: \", model.getVal(MA))\n    print(\"Maintenance hours for DeviceB: \", model.getVal(MB))\n    print(\"Maintenance hours for DeviceC: \", model.getVal(MC))\n    print(\"Maintenance hours for DeviceD: \", model.getVal(MD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed.\n// {\"speed of truck 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 120\", \"type\": \"continuous\"}\n// {\"speed of truck 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck 1\": \"Efficiency1\", \"range\": \"Efficiency1 > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of truck 2\": \"Efficiency2\", \"range\": \"Efficiency2 > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by the formula: FuelConsumption = Distance / FuelEfficiency. The fuel efficiency decreases nonlinearly with increasing speed due to aerodynamic drag. The company aims to minimize the total fuel consumption across all trucks and routes.\n// FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n// FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n// TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\n// Speed1 <= 80; Speed2 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/liter) which varies with speed. The fuel consumption of each truck is a nonlinear function of its speed, and the company aims to minimize the total fuel consumption across all trucks and routes.\n\n| Variable          | Description                          | Range/Type       |\n|-------------------|--------------------------------------|------------------|\n| Speed1            | Speed of truck 1                     | 0 < Speed1 <= 120, continuous |\n| Speed2            | Speed of truck 2                     | 0 < Speed2 <= 120, continuous |\n| Trucks1           | Number of trucks on route 1          | Trucks1 >= 0, integer |\n| Trucks2           | Number of trucks on route 2          | Trucks2 >= 0, integer |\n| Efficiency1       | Fuel efficiency of truck 1           | Efficiency1 > 0, continuous |\n| Efficiency2       | Fuel efficiency of truck 2           | Efficiency2 > 0, continuous |\n\nThe total number of trucks available is 50. The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes, given the nonlinear relationship between speed and fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=120) # speed of truck 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=120) # speed of truck 2\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on route 2\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0) # fuel efficiency of truck 1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0) # fuel efficiency of truck 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## FuelConsumption1 = Distance / (Efficiency1 * (1 - 0.005 * (Speed1 - 60)^2))\n## FuelConsumption2 = Distance / (Efficiency2 * (1 - 0.005 * (Speed2 - 60)^2))\n## TotalFuelConsumption = Trucks1 * FuelConsumption1 + Trucks2 * FuelConsumption2\n## convert the division to multiplication\nmodel.addCons(obj == Trucks1 * Efficiency1 * (1 - 0.005 * (Speed1 - 60)**2) + Trucks2 * Efficiency2 * (1 - 0.005 * (Speed2 - 60)**2))\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(Trucks1 + Trucks2 <= 50)\n## The maximum speed limit on route 1 is 80 km/h, and on route 2 is 100 km/h.\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck 1: \", model.getVal(Speed1))\n    print(\"Speed of Truck 2: \", model.getVal(Speed2))\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(Efficiency2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1501,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"fuel cost per gallon\": \"FuelCost\", \"range\": \"FuelCost > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks for Region 1\": \"Distance1\", \"range\": \"Distance1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks for Region 2\": \"Distance2\", \"range\": \"Distance2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The fuel cost is calculated based on the number of trucks, their fuel efficiency, the distance they travel, and the fuel cost per gallon.\n// FuelCost_Region1 = TrucksRegion1 * Distance1 / FuelEfficiency1 * FuelCost\n// FuelCost_Region2 = TrucksRegion2 * Distance2 / FuelEfficiency2 * FuelCost\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// FuelCost_Region1 + FuelCost_Region2 <= 10000\n\n## Generate Constraint-2:\nThe total distance that trucks can travel per day is limited to 5000 miles.\n// Distance1 * TrucksRegion1 + Distance2 * TrucksRegion2 <= 5000\n\n## Generate Constraint-3:\nThe company can only allocate a maximum of 50 trucks across both regions.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-4:\nThe fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\n// FuelEfficiency1 >= 1.1 * FuelEfficiency2",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for each region. The company aims to minimize the total fuel cost per day, which is calculated based on the number of trucks, their fuel efficiency, the distance they travel, and the fuel cost per gallon. The company has a total budget of $10,000 for fuel costs per day. The total distance that trucks can travel per day is limited to 5000 miles. The company can only allocate a maximum of 50 trucks across both regions. The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2. Please help the company to determine the optimal allocation of trucks and their fuel efficiency to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nFuelCost = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelCost\", lb=0)  # fuel cost per gallon\nDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0)  # distance traveled by trucks for Region 1\nDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0)  # distance traveled by trucks for Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = TrucksRegion1 * Distance1 / FuelEfficiency1 * FuelCost\nFuelCost_Region2 = TrucksRegion2 * Distance2 / FuelEfficiency2 * FuelCost\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(FuelCost_Region1 + FuelCost_Region2 <= 10000)\n## The total distance that trucks can travel per day is limited to 5000 miles.\nmodel.addCons(Distance1 * TrucksRegion1 + Distance2 * TrucksRegion2 <= 5000)\n## The company can only allocate a maximum of 50 trucks across both regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\nmodel.addCons(FuelEfficiency1 >= 1.1 * FuelEfficiency2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Fuel Cost per Gallon: \", model.getVal(FuelCost))\n    print(\"Distance Traveled by Trucks for Region 1: \", model.getVal(Distance1))\n    print(\"Distance Traveled by Trucks for Region 2: \", model.getVal(Distance2))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nThe market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\n// TruckA <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. The capacity, fuel consumption per trip, and the cost of fuel per liter for each type of truck are given in the following Table.\n\n| Vehicle | Cargo Capacity (tons) | Fuel Consumption (liters/trip) | Cost of Fuel per Liter ($) |\n|---------|-----------------------|--------------------------------|----------------------------|\n| Truck A | 10                    | 5                              | 2                          |\n| Truck B | 15                    | 7                              | 2                          |\n| Truck C | 20                    | 9                              | 2                          |\n\nThe company has a total budget of $5000 for fuel costs. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a limit of 100 trucks in total. The market demand for Truck A is 50 units, so the company can only operate a maximum of 50 units of Truck A. \n\nPlease help the company to minimize the total fuel cost while maximizing the total cargo carried, expressed as the ratio of the total fuel cost to the total cargo carried.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000)\n## The company has a limit of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\nmodel.addCons(TruckA <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1294,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the labor hours dedicated to each product. The marketing budget affects the sales of each product, and the labor hours determine the production efficiency.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"BudgetA\", \"range\": \"BudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"BudgetB\", \"range\": \"BudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"BudgetC\", \"range\": \"BudgetC >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1,000 spent. The labor hours affect the production cost, which decreases by $5 for every additional hour. The company aims to maximize the total profit from all products.\n// Profit for ProductA: ProfitA = (100 * QuantityA - 0.001 * BudgetA * QuantityA - 5 * HoursA)\n// Profit for ProductB: ProfitB = (150 * QuantityB - 0.001 * BudgetB * QuantityB - 5 * HoursB)\n// Profit for ProductC: ProfitC = (200 * QuantityC - 0.001 * BudgetC * QuantityC - 5 * HoursC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total marketing budget cannot exceed $50,000.\n// BudgetA + BudgetB + BudgetC <= 50000\n\n## Generate Constraint-2:\nThe total labor hours available for the month are 1000 hours.\n// HoursA + HoursB + HoursC <= 1000\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of ProductA and 300 units of ProductB.\n// QuantityA >= 500; QuantityB >= 300\n\n## Generate Constraint-4:\nDue to market saturation, the production of ProductC cannot exceed 200 units.\n// QuantityC <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget allocated to each product, and the labor hours dedicated to each product. The marketing budget affects the sales of each product, and the labor hours determine the production efficiency. The revenue generated per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales by 1% for every $1,000 spent. The labor hours affect the production cost, which decreases by $5 for every additional hour. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit | Marketing Effect | Labor Effect |\n|---------|------------------|------------------|--------------|\n| ProductA | $100            | 1% per $1,000    | -$5 per hour |\n| ProductB | $150            | 1% per $1,000    | -$5 per hour |\n| ProductC | $200            | 1% per $1,000    | -$5 per hour |\n\nThe total marketing budget cannot exceed $50,000. The total labor hours available for the month are 1000 hours. The company must produce at least 500 units of ProductA and 300 units of ProductB. Due to market saturation, the production of ProductC cannot exceed 200 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=200) # production quantity of ProductC\nBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetA\", lb=0) # marketing budget for ProductA\nBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetB\", lb=0) # marketing budget for ProductB\nBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"BudgetC\", lb=0) # marketing budget for ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # labor hours for ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # labor hours for ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # labor hours for ProductC\n\n# Define objective function\nProfitA = (100 * QuantityA - 0.001 * BudgetA * QuantityA - 5 * HoursA)\nProfitB = (150 * QuantityB - 0.001 * BudgetB * QuantityB - 5 * HoursB)\nProfitC = (200 * QuantityC - 0.001 * BudgetC * QuantityC - 5 * HoursC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(BudgetA + BudgetB + BudgetC <= 50000)\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(BudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(BudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(BudgetC))\n    print(\"Labor Hours for ProductA: \", model.getVal(HoursA))\n    print(\"Labor Hours for ProductB: \", model.getVal(HoursB))\n    print(\"Labor Hours for ProductC: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1365,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines.\n// {\"number of trips for Route A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company wants to minimize the total fuel consumption.\n// Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\n// Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\n// Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\n// Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\n// Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 300 trips available across all routes.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 300\n\n## Generate Constraint-2:\nEach route has a minimum required number of trips to meet delivery deadlines. Route A requires at least 20 trips, Route B requires at least 30 trips, Route C requires at least 25 trips, Route D requires at least 40 trips, and Route E requires at least 50 trips.\n// TripsA >= 20; TripsB >= 30; TripsC >= 25; TripsD >= 40; TripsE >= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company has a total of 300 trips available across all routes. Each route has a minimum required number of trips to meet delivery deadlines. Route A requires at least 20 trips, Route B requires at least 30 trips, Route C requires at least 25 trips, Route D requires at least 40 trips, and Route E requires at least 50 trips.\n\nPlease help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=20) # number of trips for Route A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=30) # number of trips for Route B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=25) # number of trips for Route C\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=40) # number of trips for Route D\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=50) # number of trips for Route E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=50)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=50, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TripsA == A1*A_b1 + A2*A_b2)\nFuel_A = 100 * A1 * A_b1 + (100 - 0.1 * (A2 - 50)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=60)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=60, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TripsB == B1*B_b1 + B2*B_b2)\nFuel_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 60)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=55)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=55, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TripsC == C1*C_b1 + C2*C_b2)\nFuel_C = 110 * C1 * C_b1 + (110 - 0.12 * (C2 - 55)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=70)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=70, ub=300)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TripsD == D1*D_b1 + D2*D_b2)\nFuel_D = 130 * D1 * D_b1 + (130 - 0.18 * (D2 - 70)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=80)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=80, ub=300)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TripsE == E1*E_b1 + E2*E_b2)\nFuel_E = 140 * E1 * E_b1 + (140 - 0.2 * (E2 - 80)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Route A: \", model.getVal(TripsA))\n    print(\"Number of Trips for Route B: \", model.getVal(TripsB))\n    print(\"Number of Trips for Route C: \", model.getVal(TripsC))\n    print(\"Number of Trips for Route D: \", model.getVal(TripsD))\n    print(\"Number of Trips for Route E: \", model.getVal(TripsE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1441,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades. The maintenance cost is linearly proportional to the number of trucks.\n// Fuel cost for Route1: FuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\n// Fuel cost for Route2: FuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\n// Fuel cost for Route3: FuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\n// Fuel cost for Route4: FuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\n// Fuel cost for Route5: FuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\n// Maintenance cost: MaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel efficiency upgrades.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50",
        "question": "A logistics company is planning its delivery routes for the next quarter and needs to decide the number of trucks to use for each route (Route1, Route2, Route3, Route4, Route5) and the fuel efficiency upgrades for each truck type. The fuel efficiency upgrades can be varied and are measured in percentage improvements. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The fuel cost is a nonlinear function of the number of trucks and the fuel efficiency upgrades, while the maintenance cost is linearly proportional to the number of trucks.\n\n| Route | Fuel Cost Function | Maintenance Cost |\n|-------|--------------------|-----------------|\n| Route1 | (1000 / (1 + Upgrade1/100)) * Trucks1 | 500 * Trucks1 |\n| Route2 | (1200 / (1 + Upgrade2/100)) * Trucks2 | 500 * Trucks2 |\n| Route3 | (1500 / (1 + Upgrade3/100)) * Trucks3 | 500 * Trucks3 |\n| Route4 | (1300 / (1 + Upgrade4/100)) * Trucks4 | 500 * Trucks4 |\n| Route5 | (1100 / (1 + Upgrade5/100)) * Trucks5 | 500 * Trucks5 |\n\nThe company has a budget of $100,000 for fuel efficiency upgrades. The total number of trucks available is limited to 50.\n\nPlease help the company to minimize the total operational cost, which is the sum of the fuel costs and the maintenance costs for all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Route5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost1 = (1000 / (1 + Upgrade1/100)) * Trucks1\nFuelCost2 = (1200 / (1 + Upgrade2/100)) * Trucks2\nFuelCost3 = (1500 / (1 + Upgrade3/100)) * Trucks3\nFuelCost4 = (1300 / (1 + Upgrade4/100)) * Trucks4\nFuelCost5 = (1100 / (1 + Upgrade5/100)) * Trucks5\nMaintenanceCost = 500 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5 + MaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for fuel efficiency upgrades.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n## The total number of trucks available is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Route5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route5: \", model.getVal(Upgrade5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo.\n// {\"trips for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"trips for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"trips for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"trips for C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"trips for C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per trip is $1000, the fuel cost per trip is $200, and the time per trip is 5 hours.\nFor C2, the profit per trip is $1200, the fuel cost per trip is $250, and the time per trip is 6 hours.\nFor C3, the profit per trip is $1400, the fuel cost per trip is $300, and the time per trip is 7 hours.\nFor C4, the profit per trip is $1600, the fuel cost per trip is $350, and the time per trip is 8 hours.\nFor C5, the profit per trip is $1800, the fuel cost per trip is $400, and the time per trip is 9 hours.\nThe company wants to maximize the profit efficiency (profit per hour of operation).\n// Profit_C1 = 1000 * C1 - 200 * C1\n// Profit_C2 = 1200 * C2 - 250 * C2\n// Profit_C3 = 1400 * C3 - 300 * C3\n// Profit_C4 = 1600 * C4 - 350 * C4\n// Profit_C5 = 1800 * C5 - 400 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5)\n\n## Generate Constraint-1:\nThe company has a total operational time of 500 hours.\n// 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $20000 for fuel costs.\n// 200 * C1 + 250 * C2 + 300 * C3 + 350 * C4 + 400 * C5 <= 20000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trips across all types of cargo.\n// C1 + C2 + C3 + C4 + C5 <= 100\n\n## Generate Constraint-4:\nThe market demand for C1 is 10 trips. So, the company can only make a maximum of 10 trips for C1.\n// C1 <= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo. The profit per trip, fuel cost per trip, and time per trip for each type of cargo are given in the following Table.\n\n| Cargo Type | Profit per Trip | Fuel Cost per Trip | Time per Trip |\n|------------|-----------------|--------------------|---------------|\n| C1         | $1000           | $200               | 5 hours       |\n| C2         | $1200           | $250               | 6 hours       |\n| C3         | $1400           | $300               | 7 hours       |\n| C4         | $1600           | $350               | 8 hours       |\n| C5         | $1800           | $400               | 9 hours       |\n\nThe company has a total operational time of 500 hours. The company has a budget of $20000 for fuel costs. The company has a limit of 100 trips across all types of cargo. The market demand for C1 is 10 trips. So, the company can only make a maximum of 10 trips for C1.\nPlease help the company to maximize the profit efficiency (profit per hour of operation).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=10)  # trips for C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0)  # trips for C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0)  # trips for C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0)  # trips for C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0)  # trips for C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 - 200) * C1\nProfit_C2 = (1200 - 250) * C2\nProfit_C3 = (1400 - 300) * C3\nProfit_C4 = (1600 - 350) * C4\nProfit_C5 = (1800 - 400) * C5\nOperationTime = 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / OperationTime\n## convert the division to multiplication\nmodel.addCons(obj * OperationTime == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total operational time of 500 hours.\nmodel.addCons(5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500)\n## The company has a budget of $20000 for fuel costs.\nmodel.addCons(200 * C1 + 250 * C2 + 300 * C3 + 350 * C4 + 400 * C5 <= 20000)\n## The company has a limit of 100 trips across all types of cargo.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips for C1: \", model.getVal(C1))\n    print(\"Trips for C2: \", model.getVal(C2))\n    print(\"Trips for C3: \", model.getVal(C3))\n    print(\"Trips for C4: \", model.getVal(C4))\n    print(\"Trips for C5: \", model.getVal(C5))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide the number of trips each truck will make to each region and the fuel efficiency improvements to be made through upgrades.\n// {\"number of trips to North\": \"TripsNorth\", \"range\": \"TripsNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trips to South\": \"TripsSouth\", \"range\": \"TripsSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trips to East\": \"TripsEast\", \"range\": \"TripsEast >= 0\", \"type\": \"integer\"}\n// {\"number of trips to West\": \"TripsWest\", \"range\": \"TripsWest >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Central\": \"TripsCentral\", \"range\": \"TripsCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency improvement for North\": \"EfficiencyNorth\", \"range\": \"EfficiencyNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for South\": \"EfficiencySouth\", \"range\": \"EfficiencySouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for East\": \"EfficiencyEast\", \"range\": \"EfficiencyEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for West\": \"EfficiencyWest\", \"range\": \"EfficiencyWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency improvement for Central\": \"EfficiencyCentral\", \"range\": \"EfficiencyCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of each trip varies by region and is affected by fuel efficiency improvements. The initial cost per trip to North is $100, to South is $120, to East is $110, to West is $130, and to Central is $90. For every $1000 invested in fuel efficiency improvements, the cost per trip decreases by $1 for that region. The company aims to minimize the total operational cost across all regions.\n// Cost_North = (100 - 0.001 * EfficiencyNorth) * TripsNorth\n// Cost_South = (120 - 0.001 * EfficiencySouth) * TripsSouth\n// Cost_East = (110 - 0.001 * EfficiencyEast) * TripsEast\n// Cost_West = (130 - 0.001 * EfficiencyWest) * TripsWest\n// Cost_Central = (90 - 0.001 * EfficiencyCentral) * TripsCentral\n// So, the objective function is: Minimize (Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for fuel efficiency improvements and operational costs.\n// 100 * TripsNorth + 120 * TripsSouth + 110 * TripsEast + 130 * TripsWest + 90 * TripsCentral + EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral <= 50000\n\n## Generate Constraint-2:\nThe total number of trips across all regions must not exceed 500.\n// TripsNorth + TripsSouth + TripsEast + TripsWest + TripsCentral <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company must decide the number of trips each truck will make to each region and the fuel efficiency improvements to be made through upgrades. The cost of each trip varies by region and is affected by fuel efficiency improvements. The initial cost per trip to North is $100, to South is $120, to East is $110, to West is $130, and to Central is $90. For every $1000 invested in fuel efficiency improvements, the cost per trip decreases by $1 for that region. The company has a budget of $50,000 for fuel efficiency improvements and operational costs. The total number of trips across all regions must not exceed 500. Please help the company to minimize the total operational cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsNorth = model.addVar(vtype=\"INTEGER\", name=\"TripsNorth\", lb=0)\nTripsSouth = model.addVar(vtype=\"INTEGER\", name=\"TripsSouth\", lb=0)\nTripsEast = model.addVar(vtype=\"INTEGER\", name=\"TripsEast\", lb=0)\nTripsWest = model.addVar(vtype=\"INTEGER\", name=\"TripsWest\", lb=0)\nTripsCentral = model.addVar(vtype=\"INTEGER\", name=\"TripsCentral\", lb=0)\nEfficiencyNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyNorth\", lb=0)\nEfficiencySouth = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySouth\", lb=0)\nEfficiencyEast = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyEast\", lb=0)\nEfficiencyWest = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyWest\", lb=0)\nEfficiencyCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyCentral\", lb=0)\n\n# Define objective function\nCost_North = (100 - 0.001 * EfficiencyNorth) * TripsNorth\nCost_South = (120 - 0.001 * EfficiencySouth) * TripsSouth\nCost_East = (110 - 0.001 * EfficiencyEast) * TripsEast\nCost_West = (130 - 0.001 * EfficiencyWest) * TripsWest\nCost_Central = (90 - 0.001 * EfficiencyCentral) * TripsCentral\n# So, the objective function is: Minimize (Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_North + Cost_South + Cost_East + Cost_West + Cost_Central)\n\n# Add constraints\n# The company has a budget of $50,000 for fuel efficiency improvements and operational costs.\nmodel.addCons(100 * TripsNorth + 120 * TripsSouth + 110 * TripsEast + 130 * TripsWest + 90 * TripsCentral + EfficiencyNorth + EfficiencySouth + EfficiencyEast + EfficiencyWest + EfficiencyCentral <= 50000)\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(TripsNorth + TripsSouth + TripsEast + TripsWest + TripsCentral <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to North: \", model.getVal(TripsNorth))\n    print(\"Number of Trips to South: \", model.getVal(TripsSouth))\n    print(\"Number of Trips to East: \", model.getVal(TripsEast))\n    print(\"Number of Trips to West: \", model.getVal(TripsWest))\n    print(\"Number of Trips to Central: \", model.getVal(TripsCentral))\n    print(\"Fuel Efficiency Improvement for North: \", model.getVal(EfficiencyNorth))\n    print(\"Fuel Efficiency Improvement for South: \", model.getVal(EfficiencySouth))\n    print(\"Fuel Efficiency Improvement for East: \", model.getVal(EfficiencyEast))\n    print(\"Fuel Efficiency Improvement for West: \", model.getVal(EfficiencyWest))\n    print(\"Fuel Efficiency Improvement for Central: \", model.getVal(EfficiencyCentral))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"fuel cost per gallon\": \"FuelCost\", \"range\": \"FuelCost > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks for Region 1\": \"Distance1\", \"range\": \"Distance1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks for Region 2\": \"Distance2\", \"range\": \"Distance2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The fuel cost is calculated based on the number of trucks, their fuel efficiency, the distance they travel, and the fuel cost per gallon.\n// FuelCost_Region1 = TrucksRegion1 * Distance1 / FuelEfficiency1 * FuelCost\n// FuelCost_Region2 = TrucksRegion2 * Distance2 / FuelEfficiency2 * FuelCost\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// FuelCost_Region1 + FuelCost_Region2 <= 10000\n\n## Generate Constraint-2:\nThe total distance that trucks can travel per day is limited to 5000 miles.\n// Distance1 * TrucksRegion1 + Distance2 * TrucksRegion2 <= 5000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate for each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for each region. The company aims to minimize the total fuel cost per day, which is calculated based on the number of trucks, their fuel efficiency, the distance they travel, and the fuel cost per gallon. The company has a total budget of $10,000 for fuel costs per day. The total distance that trucks can travel per day is limited to 5000 miles. Please help the company to determine the optimal number of trucks and their fuel efficiency to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nFuelCost = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelCost\", lb=0)  # fuel cost per gallon\nDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\", lb=0)  # distance traveled by trucks for Region 1\nDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\", lb=0)  # distance traveled by trucks for Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = TrucksRegion1 * Distance1 / FuelEfficiency1 * FuelCost\nFuelCost_Region2 = TrucksRegion2 * Distance2 / FuelEfficiency2 * FuelCost\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(FuelCost_Region1 + FuelCost_Region2 <= 10000)\n## The total distance that trucks can travel per day is limited to 5000 miles.\nmodel.addCons(Distance1 * TrucksRegion1 + Distance2 * TrucksRegion2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Fuel Cost per Gallon: \", model.getVal(FuelCost))\n    print(\"Distance Traveled by Trucks for Region 1: \", model.getVal(Distance1))\n    print(\"Distance Traveled by Trucks for Region 2: \", model.getVal(Distance2))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the cost per solar panel is $1000, the energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor D2, the cost per solar panel is $1200, the energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor D3, the cost per solar panel is $1100, the energy output per panel is 210 kWh, and the environmental impact score is 7.\nFor D4, the cost per solar panel is $900, the energy output per panel is 190 kWh, and the environmental impact score is 4.\nFor D5, the cost per solar panel is $1300, the energy output per panel is 230 kWh, and the environmental impact score is 8.\nThe city wants to minimize the Cost-Environmental Impact ratio of the installation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\n// Total environmental impact score: Impact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000\n\n## Generate Constraint-2:\nThe city aims to generate at least 50,000 kWh of energy from the solar panels.\n// 200 * D1 + 220 * D2 + 210 * D3 + 190 * D4 + 230 * D5 >= 50000\n\n## Generate Constraint-3:\nEach district must have at least 10 solar panels installed.\n// D1 >= 10\n// D2 >= 10\n// D3 >= 10\n// D4 >= 10\n// D5 >= 10\n\n## Generate Constraint-4:\nThe total number of solar panels installed across all districts should not exceed 150.\n// D1 + D2 + D3 + D4 + D5 <= 150\n\n## Generate Constraint-5:\nThe city wants to ensure that no more than 40% of the total budget is spent on solar panels in any single district.\n// 1000 * D1 <= 40000\n// 1200 * D2 <= 40000\n// 1100 * D3 <= 40000\n// 900 * D4 <= 40000\n// 1300 * D5 <= 40000",
        "question": "A city is planning to install solar panels on rooftops across different districts. The city has identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed. The cost per solar panel, energy output per panel, and environmental impact score for each district are given in the following Table.\n\n| District | Cost per Panel | Energy Output per Panel | Environmental Impact Score |\n|----------|----------------|-------------------------|----------------------------|\n| D1       | $1000          | 200 kWh                 | 5                          |\n| D2       | $1200          | 220 kWh                 | 6                          |\n| D3       | $1100          | 210 kWh                 | 7                          |\n| D4       | $900           | 190 kWh                 | 4                          |\n| D5       | $1300          | 230 kWh                 | 8                          |\n\nThe city has a budget of $100,000 for the installation of solar panels. The city aims to generate at least 50,000 kWh of energy from the solar panels. Each district must have at least 10 solar panels installed. The total number of solar panels installed across all districts should not exceed 150. The city wants to ensure that no more than 40% of the total budget is spent on solar panels in any single district.\n\nPlease help the city to minimize the Cost-Environmental Impact ratio of the installation (defined as the total cost divided by the total environmental impact score).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=10) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=10) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=10) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=10) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=10) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5\nImpact = 5 * D1 + 6 * D2 + 7 * D3 + 4 * D4 + 8 * D5\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(1000 * D1 + 1200 * D2 + 1100 * D3 + 900 * D4 + 1300 * D5 <= 100000)\n## The city aims to generate at least 50,000 kWh of energy from the solar panels.\nmodel.addCons(200 * D1 + 220 * D2 + 210 * D3 + 190 * D4 + 230 * D5 >= 50000)\n## Each district must have at least 10 solar panels installed.\nmodel.addCons(D1 >= 10)\nmodel.addCons(D2 >= 10)\nmodel.addCons(D3 >= 10)\nmodel.addCons(D4 >= 10)\nmodel.addCons(D5 >= 10)\n## The total number of solar panels installed across all districts should not exceed 150.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 150)\n## The city wants to ensure that no more than 40% of the total budget is spent on solar panels in any single district.\nmodel.addCons(1000 * D1 <= 40000)\nmodel.addCons(1200 * D2 <= 40000)\nmodel.addCons(1100 * D3 <= 40000)\nmodel.addCons(900 * D4 <= 40000)\nmodel.addCons(1300 * D5 <= 40000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1491,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: R1, R2, R3, R4, and R5. The company needs to determine the number of trips each truck should make to each region to minimize fuel consumption and time spent on the road.\n// {\"trips to R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trips to R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trips to R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trips to R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trips to R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and time spent on the road for each trip vary by region. For R1, the fuel consumption per trip is 50 liters and the time spent is 4 hours. For R2, the fuel consumption per trip is 60 liters and the time spent is 5 hours. For R3, the fuel consumption per trip is 70 liters and the time spent is 6 hours. For R4, the fuel consumption per trip is 80 liters and the time spent is 7 hours. For R5, the fuel consumption per trip is 90 liters and the time spent is 8 hours. The company wants to minimize the total cost of fuel and the total time spent on the road.\n// Cost_R1 = 50 * T1\n// Cost_R2 = 60 * T2\n// Cost_R3 = 70 * T3\n// Cost_R4 = 80 * T4\n// Cost_R5 = 90 * T5\n// Time_R1 = 4 * T1\n// Time_R2 = 5 * T2\n// Time_R3 = 6 * T3\n// Time_R4 = 7 * T4\n// Time_R5 = 8 * T5\n// So, the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) + (Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $5000.\n// 50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: R1, R2, R3, R4, and R5. The company needs to determine the number of trips each truck should make to each region to minimize fuel consumption and time spent on the road.\nFor R1, the fuel consumption per trip is 50 liters and the time spent is 4 hours. For R2, the fuel consumption per trip is 60 liters and the time spent is 5 hours. For R3, the fuel consumption per trip is 70 liters and the time spent is 6 hours. For R4, the fuel consumption per trip is 80 liters and the time spent is 7 hours. For R5, the fuel consumption per trip is 90 liters and the time spent is 8 hours. The company has a total fuel budget of $5000.\nPlease help the company to minimize the total cost of fuel and the total time spent on the road.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trips to R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trips to R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trips to R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trips to R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trips to R5\n\n# Define objective function\nCost_R1 = 50 * T1\nCost_R2 = 60 * T2\nCost_R3 = 70 * T3\nCost_R4 = 80 * T4\nCost_R5 = 90 * T5\nTime_R1 = 4 * T1\nTime_R2 = 5 * T2\nTime_R3 = 6 * T3\nTime_R4 = 7 * T4\nTime_R5 = 8 * T5\n# So, the objective function is: Minimize (Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5) + (Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_R1 + Cost_R2 + Cost_R3 + Cost_R4 + Cost_R5 + Time_R1 + Time_R2 + Time_R3 + Time_R4 + Time_R5)\n\n# Add constraints\n# The company has a total fuel budget of $5000.\nmodel.addCons(50 * T1 + 60 * T2 + 70 * T3 + 80 * T4 + 90 * T5 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to R1: \", model.getVal(T1))\n    print(\"Trips to R2: \", model.getVal(T2))\n    print(\"Trips to R3: \", model.getVal(T3))\n    print(\"Trips to R4: \", model.getVal(T4))\n    print(\"Trips to R5: \", model.getVal(T5))\n    print(\"Minimized Total Cost and Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"available units of resource X\": \"ResourceX\", \"range\": \"ResourceX >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Y\": \"ResourceY\", \"range\": \"ResourceY >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Z\": \"ResourceZ\", \"range\": \"ResourceZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nEach unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively.\n// 2 * ProductA <= ResourceX\n// 3 * ProductB <= ResourceY\n// 4 * ProductC <= ResourceZ\n// ResourceX <= 100\n// ResourceY <= 150\n// ResourceZ <= 200",
        "question": "A manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products. Each unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively. Please help the manufacturer to determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\nResourceX = model.addVar(vtype=\"INTEGER\", name=\"ResourceX\", lb=0, ub=100) # available units of resource X\nResourceY = model.addVar(vtype=\"INTEGER\", name=\"ResourceY\", lb=0, ub=150) # available units of resource Y\nResourceZ = model.addVar(vtype=\"INTEGER\", name=\"ResourceZ\", lb=0, ub=200) # available units of resource Z\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * ProductA <= ResourceX)\nmodel.addCons(3 * ProductB <= ResourceY)\nmodel.addCons(4 * ProductC <= ResourceZ)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 1\": \"DistanceRegion1\", \"range\": \"DistanceRegion1 >= 0\", \"type\": \"real\"}\n// {\"distance traveled by trucks in Region 2\": \"DistanceRegion2\", \"range\": \"DistanceRegion2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all regions. The fuel consumption is calculated based on the number of trucks, their fuel efficiency, and the distance they travel.\n// FuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\n// FuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n// So, the objective function is: Minimize (FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 50.\n// TrucksRegion1 + TrucksRegion2 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\n// DistanceRegion1 + DistanceRegion2 <= 1000\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\n// FuelEfficiency1 >= 1.1 * FuelEfficiency2",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across two regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel consumption while meeting the demand for transportation in each region. The following table summarizes the variables involved:\n\n| Variable                          | Description                          | Range/Type       |\n|-----------------------------------|--------------------------------------|------------------|\n| TrucksRegion1                     | Number of trucks for Region 1        | >= 0, integer    |\n| TrucksRegion2                     | Number of trucks for Region 2        | >= 0, integer    |\n| FuelEfficiency1                   | Fuel efficiency of trucks for Region 1 | > 0, real        |\n| FuelEfficiency2                   | Fuel efficiency of trucks for Region 2 | > 0, real        |\n| DistanceRegion1                   | Distance traveled by trucks in Region 1 | >= 0, real       |\n| DistanceRegion2                   | Distance traveled by trucks in Region 2 | >= 0, real       |\n\nThe company aims to minimize the total fuel consumption across all regions, calculated based on the number of trucks, their fuel efficiency, and the distance they travel. The total number of trucks available in the fleet is limited to 50. The total distance that can be covered by the trucks in a day is limited to 1000 kilometers. The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # fuel efficiency of trucks for Region 1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # fuel efficiency of trucks for Region 2\nDistanceRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion1\", lb=0)  # distance traveled by trucks in Region 1\nDistanceRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"DistanceRegion2\", lb=0)  # distance traveled by trucks in Region 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsumptionRegion1 = TrucksRegion1 * DistanceRegion1 / FuelEfficiency1\nFuelConsumptionRegion2 = TrucksRegion2 * DistanceRegion2 / FuelEfficiency2\n## convert the division to multiplication\nmodel.addCons(obj == FuelConsumptionRegion1 + FuelConsumptionRegion2)\n\n# Add constraints\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 <= 50)\n## The total distance that can be covered by the trucks in a day is limited to 1000 kilometers.\nmodel.addCons(DistanceRegion1 + DistanceRegion2 <= 1000)\n## The fuel efficiency of trucks in Region 1 must be at least 10% better than that in Region 2.\nmodel.addCons(FuelEfficiency1 >= 1.1 * FuelEfficiency2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Distance Traveled in Region 1: \", model.getVal(DistanceRegion1))\n    print(\"Distance Traveled in Region 2: \", model.getVal(DistanceRegion2))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1736,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The decision involves determining the number of solar panels to install in each district.\n// {\"number of solar panels in district A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in district E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent.\n// Energy production: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\n// Total cost: Cost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n// So, the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / (1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000",
        "question": "A city is planning to install solar panels in five different districts (A, B, C, D, and E) to optimize energy production and minimize environmental impact. The efficiency of solar panels in district A is 0.8, in district B is 0.9, in district C is 1.0, in district D is 0.7, and in district E is 0.6. The cost per panel in district A is $1000, in district B is $1200, in district C is $1500, in district D is $900, and in district E is $800. The city aims to maximize the energy production per dollar spent. The city has a budget of $500,000 for the installation of solar panels.\n\nPlease help the city determine the number of solar panels to install in each district to achieve the maximum energy production per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels in district A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels in district B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels in district C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels in district D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels in district E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E\nCost = 1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E\n## the objective function is: Maximize (0.8 * A + 0.9 * B + 1.0 * C + 0.7 * D + 0.6 * E) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 900 * D + 800 * E <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in District A: \", model.getVal(A))\n    print(\"Number of Solar Panels in District B: \", model.getVal(B))\n    print(\"Number of Solar Panels in District C: \", model.getVal(C))\n    print(\"Number of Solar Panels in District D: \", model.getVal(D))\n    print(\"Number of Solar Panels in District E: \", model.getVal(E))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n// Total energy production: Energy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\n// Total environmental impact: Impact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 for the construction of these facilities.\n// Cost of solar facilities: 100,000 * Solar\n// Cost of wind facilities: 150,000 * Wind\n// Cost of hydro facilities: 200,000 * Hydro\n// Cost of biomass facilities: 80,000 * Biomass\n// Cost of geothermal facilities: 250,000 * Geothermal\n// Total cost: 100,000 * Solar + 150,000 * Wind + 200,000 * Hydro + 80,000 * Biomass + 250,000 * Geothermal <= 5,000,000\n\n## Generate Constraint-2:\nThe city has a land area constraint that limits the total number of facilities to 50.\n// Solar + Wind + Hydro + Biomass + Geothermal <= 50",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact. The energy production per unit and the environmental impact score for each type of facility are given in the following Table.\n\n| Facility Type | Energy Production per Unit (MWh) | Environmental Impact Score |\n|---------------|----------------------------------|----------------------------|\n| Solar         | 50                               | 10                         |\n| Wind          | 60                               | 12                         |\n| Hydro         | 70                               | 15                         |\n| Biomass       | 40                               | 8                          |\n| Geothermal    | 80                               | 18                         |\n\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score. The city has a budget of $5,000,000 for the construction of these facilities. The city also has a land area constraint that limits the total number of facilities to 50.\n\nPlease help the city to determine the optimal number of each type of facility to build under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\nImpact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $5,000,000 for the construction of these facilities.\nmodel.addCons(100000 * Solar + 150000 * Wind + 200000 * Hydro + 80000 * Biomass + 250000 * Geothermal <= 5000000)\n## The city has a land area constraint that limits the total number of facilities to 50.\nmodel.addCons(Solar + Wind + Hydro + Biomass + Geothermal <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Maximized Energy-Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1404,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to small trucks\": \"RoutesSmall\", \"range\": \"RoutesSmall >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to medium trucks\": \"RoutesMedium\", \"range\": \"RoutesMedium >= 0\", \"type\": \"integer\"}\n// {\"number of routes assigned to large trucks\": \"RoutesLarge\", \"range\": \"RoutesLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company aims to minimize the total daily operational and fuel costs.\n// FuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\n// OperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n// So, the objective function is: Minimize (FuelCost + OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000\n\n## Generate Constraint-2:\nThe total number of routes available is 1000.\n// RoutesSmall + RoutesMedium + RoutesLarge <= 1000\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads.\n// RoutesMedium + RoutesLarge >= 0.3 * 1000\n\n## Generate Constraint-4:\nThe number of small trucks should not exceed the combined number of medium and large trucks.\n// SmallTrucks <= MediumTrucks + LargeTrucks\n\n## Generate Constraint-5:\nThe company aims to have at least 100 routes covered by large trucks to ensure capacity for bulky deliveries.\n// RoutesLarge >= 100",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of vehicles: small, medium, and large trucks. The company needs to determine the optimal number of each type of truck to purchase and the optimal distribution of routes among them to minimize fuel consumption and operational costs. The fuel consumption for small trucks is 10 liters per route, for medium trucks is 15 liters per route, and for large trucks is 20 liters per route. The operational cost per small truck is $500 per day, for medium trucks is $750 per day, and for large trucks is $1000 per day. The company has a total budget of $50,000 for purchasing new trucks. The total number of routes available is 1000. The company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads. The number of small trucks should not exceed the combined number of medium and large trucks. The company aims to have at least 100 routes covered by large trucks to ensure capacity for bulky deliveries. Please help the company to minimize the total daily operational and fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nRoutesSmall = model.addVar(vtype=\"INTEGER\", name=\"RoutesSmall\", lb=0)\nRoutesMedium = model.addVar(vtype=\"INTEGER\", name=\"RoutesMedium\", lb=0)\nRoutesLarge = model.addVar(vtype=\"INTEGER\", name=\"RoutesLarge\", lb=0)\n\n# Define objective function\nFuelCost = 10 * RoutesSmall + 15 * RoutesMedium + 20 * RoutesLarge\nOperationalCost = 500 * SmallTrucks + 750 * MediumTrucks + 1000 * LargeTrucks\n# So, the objective function is: Minimize (FuelCost + OperationalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + OperationalCost)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks <= 50000)\n# The total number of routes available is 1000.\nmodel.addCons(RoutesSmall + RoutesMedium + RoutesLarge <= 1000)\n# The company must ensure that at least 30% of the routes are covered by medium or large trucks to handle heavier loads.\nmodel.addCons(RoutesMedium + RoutesLarge >= 0.3 * 1000)\n# The number of small trucks should not exceed the combined number of medium and large trucks.\nmodel.addCons(SmallTrucks <= MediumTrucks + LargeTrucks)\n# The company aims to have at least 100 routes covered by large trucks to ensure capacity for bulky deliveries.\nmodel.addCons(RoutesLarge >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Routes Assigned to Small Trucks: \", model.getVal(RoutesSmall))\n    print(\"Routes Assigned to Medium Trucks: \", model.getVal(RoutesMedium))\n    print(\"Routes Assigned to Large Trucks: \", model.getVal(RoutesLarge))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production costs, sales prices, and resource constraints.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resource X used for Product A\": \"ResourceX_A\", \"range\": \"ResourceX_A >= 0\", \"type\": \"real\"}\n// {\"resource X used for Product B\": \"ResourceX_B\", \"range\": \"ResourceX_B >= 0\", \"type\": \"real\"}\n// {\"resource X used for Product C\": \"ResourceX_C\", \"range\": \"ResourceX_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The production cost per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit.\n// Profit_A = ProductA * (50 - 20)\n// Profit_B = ProductB * (70 - 30)\n// Profit_C = ProductC * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited amount of resource X, which is used in the production of each product. The total amount of resource X available is 100 units.\n// ResourceX_A * ProductA + ResourceX_B * ProductB + ResourceX_C * ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a fixed budget for production costs, which is $1000.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 1000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 10 units, and for Product C, it is at most 20 units.\n// ProductA >= 10\n// ProductC <= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit, considering the production costs, sales prices, and resource constraints.\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The production cost per unit of Product A is $20, Product B is $30, and Product C is $25. The company aims to maximize the total profit.\nThe company has a limited amount of resource X, which is used in the production of each product. The total amount of resource X available is 100 units. The company has a fixed budget for production costs, which is $1000. The market demand for Product A is at least 10 units, and for Product C, it is at most 20 units.\nPlease help the company to determine the optimal production quantities of each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit_A = ProductA * (50 - 20)\nProfit_B = ProductB * (70 - 30)\nProfit_C = ProductC * (60 - 25)\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a limited amount of resource X, which is used in the production of each product. The total amount of resource X available is 100 units.\nResourceX_A = 1  # Assuming each unit of Product A uses 1 unit of resource X\nResourceX_B = 2  # Assuming each unit of Product B uses 2 units of resource X\nResourceX_C = 3  # Assuming each unit of Product C uses 3 units of resource X\nmodel.addCons(ResourceX_A * ProductA + ResourceX_B * ProductB + ResourceX_C * ProductC <= 100)\n\n# The company has a fixed budget for production costs, which is $1000.\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 1000)\n\n# The market demand for Product A is at least 10 units, and for Product C, it is at most 20 units.\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is 20$, the transportation cost is 8$, and the storage cost is 3$ per unit.\nFor Product B, the selling price is 30$, the transportation cost is 12$, and the storage cost is 5$ per unit.\nFor Product C, the selling price is 40$, the transportation cost is 16$, and the storage cost is 7$ per unit.\nFor Product D, the selling price is 50$, the transportation cost is 20$, and the storage cost is 9$ per unit.\nThe company aims to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage).\n// Profit of A: Profit_A = (20 - 8 - 3) * A\n// Profit of B: Profit_B = (30 - 12 - 5) * B\n// Profit of C: Profit_C = (40 - 16 - 7) * C\n// Profit of D: Profit_D = (50 - 20 - 9) * D\n// Total cost: Cost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for transportation costs.\n// 8 * A + 12 * B + 16 * C + 20 * D <= 2000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 200 units.\n// A + B + C + D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to distribute at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15\n\n## Generate Constraint-5:\nThe company wants to minimize the risk of overstocking, so the distribution of Product C should not exceed 50% of the total distribution.\n// C <= 0.5 * (A + B + C + D)",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints.\nFor Product A, the selling price is $20, the transportation cost is $8, and the storage cost is $3 per unit.\nFor Product B, the selling price is $30, the transportation cost is $12, and the storage cost is $5 per unit.\nFor Product C, the selling price is $40, the transportation cost is $16, and the storage cost is $7 per unit.\nFor Product D, the selling price is $50, the transportation cost is $20, and the storage cost is $9 per unit.\nThe company has a budget of $2000 for transportation costs. The company has a storage capacity of 200 units. The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C. The company wants to distribute at least 15 units of each product. The company wants to minimize the risk of overstocking, so the distribution of Product C should not exceed 50% of the total distribution.\nPlease help the company to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 8 - 3) * A\nProfit_B = (30 - 12 - 5) * B\nProfit_C = (40 - 16 - 7) * C\nProfit_D = (50 - 20 - 9) * D\nCost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $2000 for transportation costs.\nmodel.addCons(8 * A + 12 * B + 16 * C + 20 * D <= 2000)\n## The company has a storage capacity of 200 units.\nmodel.addCons(A + B + C + D <= 200)\n## The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to distribute at least 15 units of each product.\nmodel.addCons(A >= 15)\nmodel.addCons(B >= 15)\nmodel.addCons(C >= 15)\nmodel.addCons(D >= 15)\n## The company wants to minimize the risk of overstocking, so the distribution of Product C should not exceed 50% of the total distribution.\nmodel.addCons(C <= 0.5 * (A + B + C + D))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1280,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company, LogiCorp, operates 5 different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods from each warehouse is influenced by the number of trucks allocated. The cost function is nonlinear and varies with the number of trucks. The cost per trip from warehouse i to its destinations is given by:\nCost_i = a_i * T_i^2 + b_i * T_i + c_i, where a_i, b_i, c_i are constants.\nThe total transportation cost is the sum of costs from all warehouses.\n// The objective function is: Minimize (a1 * T1^2 + b1 * T1 + c1) + (a2 * T2^2 + b2 * T2 + c2) + (a3 * T3^2 + b3 * T3 + c3) + (a4 * T4^2 + b4 * T4 + c4) + (a5 * T5^2 + b5 * T5 + c5)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company, LogiCorp, operates 5 different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods from each warehouse is influenced by the number of trucks allocated, with a nonlinear cost function that varies with the number of trucks. The cost per trip from warehouse i to its destinations is given by:\nCost_i = a_i * T_i^2 + b_i * T_i + c_i, where a_i, b_i, c_i are constants.\nThe total transportation cost is the sum of costs from all warehouses.\n\nThe total number of trucks available across all warehouses is limited to 100. Each warehouse can handle a maximum of 30 trucks.\n\nPlease help LogiCorp to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n# The cost function is nonlinear and varies with the number of trucks.\n# Cost_i = a_i * T_i^2 + b_i * T_i + c_i, where a_i, b_i, c_i are constants.\n# The objective function is: Minimize (a1 * T1^2 + b1 * T1 + c1) + (a2 * T2^2 + b2 * T2 + c2) + (a3 * T3^2 + b3 * T3 + c3) + (a4 * T4^2 + b4 * T4 + c4) + (a5 * T5^2 + b5 * T5 + c5)\n# Assuming constants a1, a2, a3, a4, a5, b1, b2, b3, b4, b5, c1, c2, c3, c4, c5 are given\na1, a2, a3, a4, a5 = 0.1, 0.2, 0.3, 0.4, 0.5\nb1, b2, b3, b4, b5 = 1, 2, 3, 4, 5\nc1, c2, c3, c4, c5 = 10, 20, 30, 40, 50\n\nCost_T1 = a1 * T1**2 + b1 * T1 + c1\nCost_T2 = a2 * T2**2 + b2 * T2 + c2\nCost_T3 = a3 * T3**2 + b3 * T3 + c3\nCost_T4 = a4 * T4**2 + b4 * T4 + c4\nCost_T5 = a5 * T5**2 + b5 * T5 + c5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks. Route 1 has a base fuel efficiency of 10 km/l, which improves by 0.05 km/l for every additional truck. Route 2 has a base fuel efficiency of 12 km/l, improving by 0.04 km/l per additional truck. Route 3 has a base fuel efficiency of 11 km/l, improving by 0.03 km/l per additional truck. Route 4 has a base fuel efficiency of 9 km/l, improving by 0.06 km/l per additional truck. Route 5 has a base fuel efficiency of 8 km/l, improving by 0.02 km/l per additional truck. The company wants to minimize the total fuel consumption across all routes.\n// Fuel_efficiency_1 = max(10 + 0.05 * (T1 - 1), 10)\n// Fuel_efficiency_2 = max(12 + 0.04 * (T2 - 1), 12)\n// Fuel_efficiency_3 = max(11 + 0.03 * (T3 - 1), 11)\n// Fuel_efficiency_4 = max(9 + 0.06 * (T4 - 1), 9)\n// Fuel_efficiency_5 = max(8 + 0.02 * (T5 - 1), 8)\n// Total_fuel_consumption = (1000 / Fuel_efficiency_1) * T1 + (1000 / Fuel_efficiency_2) * T2 + (1000 / Fuel_efficiency_3) * T3 + (1000 / Fuel_efficiency_4) * T4 + (1000 / Fuel_efficiency_5) * T5\n// So, the objective function is: Minimize Total_fuel_consumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route varies with the number of trucks. Route 1 has a base fuel efficiency of 10 km/l, which improves by 0.05 km/l for every additional truck. Route 2 has a base fuel efficiency of 12 km/l, improving by 0.04 km/l per additional truck. Route 3 has a base fuel efficiency of 11 km/l, improving by 0.03 km/l per additional truck. Route 4 has a base fuel efficiency of 9 km/l, improving by 0.06 km/l per additional truck. Route 5 has a base fuel efficiency of 8 km/l, improving by 0.02 km/l per additional truck. The company wants to minimize the total fuel consumption across all routes. The total number of trucks available is 100. Each route has a maximum capacity of 30 trucks. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_efficiency_1 = max(10 + 0.05 * (T1 - 1), 10)\nT1_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T1_eff1\", lb=0, ub=1)\nT1_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T1_eff2\", lb=1, ub=30)\nT1_b1 = model.addVar(vtype=\"B\", name=\"T1_b1\")\nT1_b2 = model.addVar(vtype=\"B\", name=\"T1_b2\")\nmodel.addCons(T1_b1 + T1_b2 == 1)\nmodel.addCons(T1 == T1_eff1*T1_b1 + T1_eff2*T1_b2)\nFuel_efficiency_1 = 10 * T1_b1 + (10 + 0.05 * (T1_eff2 - 1)) * T1_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_2 = max(12 + 0.04 * (T2 - 1), 12)\nT2_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T2_eff1\", lb=0, ub=1)\nT2_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T2_eff2\", lb=1, ub=30)\nT2_b1 = model.addVar(vtype=\"B\", name=\"T2_b1\")\nT2_b2 = model.addVar(vtype=\"B\", name=\"T2_b2\")\nmodel.addCons(T2_b1 + T2_b2 == 1)\nmodel.addCons(T2 == T2_eff1*T2_b1 + T2_eff2*T2_b2)\nFuel_efficiency_2 = 12 * T2_b1 + (12 + 0.04 * (T2_eff2 - 1)) * T2_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_3 = max(11 + 0.03 * (T3 - 1), 11)\nT3_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T3_eff1\", lb=0, ub=1)\nT3_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T3_eff2\", lb=1, ub=30)\nT3_b1 = model.addVar(vtype=\"B\", name=\"T3_b1\")\nT3_b2 = model.addVar(vtype=\"B\", name=\"T3_b2\")\nmodel.addCons(T3_b1 + T3_b2 == 1)\nmodel.addCons(T3 == T3_eff1*T3_b1 + T3_eff2*T3_b2)\nFuel_efficiency_3 = 11 * T3_b1 + (11 + 0.03 * (T3_eff2 - 1)) * T3_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_4 = max(9 + 0.06 * (T4 - 1), 9)\nT4_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T4_eff1\", lb=0, ub=1)\nT4_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T4_eff2\", lb=1, ub=30)\nT4_b1 = model.addVar(vtype=\"B\", name=\"T4_b1\")\nT4_b2 = model.addVar(vtype=\"B\", name=\"T4_b2\")\nmodel.addCons(T4_b1 + T4_b2 == 1)\nmodel.addCons(T4 == T4_eff1*T4_b1 + T4_eff2*T4_b2)\nFuel_efficiency_4 = 9 * T4_b1 + (9 + 0.06 * (T4_eff2 - 1)) * T4_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_5 = max(8 + 0.02 * (T5 - 1), 8)\nT5_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T5_eff1\", lb=0, ub=1)\nT5_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T5_eff2\", lb=1, ub=30)\nT5_b1 = model.addVar(vtype=\"B\", name=\"T5_b1\")\nT5_b2 = model.addVar(vtype=\"B\", name=\"T5_b2\")\nmodel.addCons(T5_b1 + T5_b2 == 1)\nmodel.addCons(T5 == T5_eff1*T5_b1 + T5_eff2*T5_b2)\nFuel_efficiency_5 = 8 * T5_b1 + (8 + 0.02 * (T5_eff2 - 1)) * T5_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Total_fuel_consumption\nTotal_fuel_consumption = (1000 / Fuel_efficiency_1) * T1 + (1000 / Fuel_efficiency_2) * T2 + (1000 / Fuel_efficiency_3) * T3 + (1000 / Fuel_efficiency_4) * T4 + (1000 / Fuel_efficiency_5) * T5\n## convert the division to multiplication\nmodel.addCons(obj == Total_fuel_consumption)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Total fuel consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit.\n// Total profit: Profit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month.\n// 2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a fixed monthly budget for production costs, which is $2000.\n// 30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of each device are produced to maintain market presence.\n// UnitsA >= 10; UnitsB >= 10; UnitsC >= 10",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability. The profit per unit, production cost per unit, and the required units of a critical component for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Required Units of Critical Component |\n|--------|-----------------|--------------------------|--------------------------------------|\n| DeviceA | $50             | $30                      | 2 units                              |\n| DeviceB | $70             | $40                      | 3 units                              |\n| DeviceC | $60             | $35                      | 4 units                              |\n\nThe company has a limited amount of a critical component that is used in the production of all devices, with a total available amount of 150 units per month. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. The company has a fixed monthly budget for production costs, which is $2000. The company wants to ensure that at least 10 units of each device are produced to maintain market presence.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=10) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=10) # number of units of DeviceC\n\n# Define objective function\nProfit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150) # Constraint-1\nmodel.addCons(UnitsA >= 2 * UnitsB) # Constraint-2\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 35 * UnitsC <= 2000) # Constraint-3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1409,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for production\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The cost of operating an additional shift is $1000. The company aims to maximize the total profit from product sales minus the cost of additional shifts.\n// Profit_ProductA = 50 * ProductAQty\n// Profit_ProductB = 70 * ProductBQty\n// Profit_ProductC = 60 * ProductCQty\n// Cost_Shifts = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n## Generate Constraint-1:\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\n// (50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000\n\n## Generate Constraint-3:\nDue to labor regulations, the number of shifts cannot exceed 3.\n// NumShifts <= 3\n\n## Generate Constraint-4:\nThe demand for ProductA is at least twice the demand for ProductB.\n// ProductAQty >= 2 * ProductBQty\n\n## Generate Constraint-5:\nThe company must produce at least 100 units of ProductC to fulfill a contract.\n// ProductCQty >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the number of shifts to operate in their factory to optimize their profit. The profit per unit and the cost of operating an additional shift are given in the following Table.\n\n| Product | Profit per Unit | Cost per Shift |\n|---------|-----------------|----------------|\n| ProductA | $50             | $1000          |\n| ProductB | $70             | $1000          |\n| ProductC | $60             | $1000          |\n\nThe factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts. The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day. Due to labor regulations, the number of shifts cannot exceed 3. The demand for ProductA is at least twice the demand for ProductB. The company must produce at least 100 units of ProductC to fulfill a contract.\n\nPlease help the company to maximize the total profit from product sales minus the cost of additional shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity of ProductC\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts for production\n\n# Define objective function\nProfit_ProductA = 50 * ProductAQty\nProfit_ProductB = 70 * ProductBQty\nProfit_ProductC = 60 * ProductCQty\nCost_Shifts = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - Cost_Shifts)\n\n# Add constraints\n# The factory has a maximum production capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\n# The company has a budget constraint that limits the total cost of production and shifts to $50,000 per day.\nmodel.addCons((50 * ProductAQty + 70 * ProductBQty + 60 * ProductCQty) + (1000 * NumShifts) <= 50000)\n# Due to labor regulations, the number of shifts cannot exceed 3.\nmodel.addCons(NumShifts <= 3)\n# The demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(ProductAQty >= 2 * ProductBQty)\n# The company must produce at least 100 units of ProductC to fulfill a contract.\nmodel.addCons(ProductCQty >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will improve the product quality and potentially increase the selling price.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductA\": \"RnD_InvestmentA\", \"range\": \"RnD_InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductB\": \"RnD_InvestmentB\", \"range\": \"RnD_InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for ProductC\": \"RnD_InvestmentC\", \"range\": \"RnD_InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 + 0.01 * RnD_InvestmentA - 100 + 5 * AutomationA) * UnitsA\n// Total profit for ProductB: ProfitB = (180 + 0.01 * RnD_InvestmentB - 120 + 5 * AutomationB) * UnitsB\n// Total profit for ProductC: ProfitC = (200 + 0.01 * RnD_InvestmentC - 150 + 5 * AutomationC) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation and R&D cannot exceed $100,000.\n// AutomationA + AutomationB + AutomationC + RnD_InvestmentA + RnD_InvestmentB + RnD_InvestmentC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) for each product, which will improve the product quality and potentially increase the selling price.\n\nThe production cost per unit decreases by $5 for every unit increase in the level of automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit increases by $10 for every $1000 invested in R&D for that product. The initial selling price per unit for ProductA is $150, for ProductB is $180, and for ProductC is $200. The company aims to maximize the total profit from all products.\n\nThe company has a total production capacity of 1000 units per month. The total investment in automation and R&D cannot exceed $100,000.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nRnD_InvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentA\", lb=0) # investment in R&D for ProductA\nRnD_InvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentB\", lb=0) # investment in R&D for ProductB\nRnD_InvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"RnD_InvestmentC\", lb=0) # investment in R&D for ProductC\n\n# Define objective function\nProfitA = (150 + 0.01 * RnD_InvestmentA - 100 + 5 * AutomationA) * UnitsA\nProfitB = (180 + 0.01 * RnD_InvestmentB - 120 + 5 * AutomationB) * UnitsB\nProfitC = (200 + 0.01 * RnD_InvestmentC - 150 + 5 * AutomationC) * UnitsC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# The total investment in automation and R&D cannot exceed $100,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC + RnD_InvestmentA + RnD_InvestmentB + RnD_InvestmentC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Level of Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Level of Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Level of Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"R&D Investment for ProductA: \", model.getVal(RnD_InvestmentA))\n    print(\"R&D Investment for ProductB: \", model.getVal(RnD_InvestmentB))\n    print(\"R&D Investment for ProductC: \", model.getVal(RnD_InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each cargo type and the distance each truck will travel. The cost and revenue associated with each type of cargo vary with the distance traveled.\n// {\"number of trucks for Fragile\": \"FragileTrucks\", \"range\": \"FragileTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for General\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"distance traveled by each Fragile truck\": \"FragileDistance\", \"range\": \"FragileDistance >= 0\", \"type\": \"continuous\"}\n// {\"distance traveled by each Perishable truck\": \"PerishableDistance\", \"range\": \"PerishableDistance >= 0\", \"type\": \"continuous\"}\n// {\"distance traveled by each General truck\": \"GeneralDistance\", \"range\": \"GeneralDistance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of transporting Fragile cargo is $0.5 per mile, and the revenue is $1.5 per mile.\nThe cost of transporting Perishable cargo is $0.4 per mile, and the revenue is $1.2 per mile.\nThe cost of transporting General cargo is $0.3 per mile, and the revenue is $0.9 per mile.\nThe company aims to maximize the total profit from all cargo types.\n// Profit_Fragile = FragileTrucks * FragileDistance * (1.5 - 0.5)\n// Profit_Perishable = PerishableTrucks * PerishableDistance * (1.2 - 0.4)\n// Profit_General = GeneralTrucks * GeneralDistance * (0.9 - 0.3)\n// So, the objective function is: Maximize (Profit_Fragile + Profit_Perishable + Profit_General)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// FragileTrucks + PerishableTrucks + GeneralTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $1000 for transportation costs per day.\n// 0.5 * FragileTrucks * FragileDistance + 0.4 * PerishableTrucks * PerishableDistance + 0.3 * GeneralTrucks * GeneralDistance <= 1000\n\n## Generate Constraint-3:\nThe total distance traveled by all trucks must not exceed 2000 miles per day.\n// FragileTrucks * FragileDistance + PerishableTrucks * PerishableDistance + GeneralTrucks * GeneralDistance <= 2000\n\n## Generate Constraint-4:\nDue to safety regulations, each Fragile truck can travel at most 50 miles per day. Each Perishable truck can travel at most 60 miles per day. Each General truck can travel at most 70 miles per day.\n// FragileDistance <= 50; PerishableDistance <= 60; GeneralDistance <= 70",
        "question": "A logistics company is planning its routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each cargo type and the distance each truck will travel. The cost and revenue associated with each type of cargo vary with the distance traveled.\nThe cost of transporting Fragile cargo is $0.5 per mile, and the revenue is $1.5 per mile.\nThe cost of transporting Perishable cargo is $0.4 per mile, and the revenue is $1.2 per mile.\nThe cost of transporting General cargo is $0.3 per mile, and the revenue is $0.9 per mile.\nThe company aims to maximize the total profit from all cargo types.\nThe company has a total of 50 trucks available. The company has a budget of $1000 for transportation costs per day. The total distance traveled by all trucks must not exceed 2000 miles per day. Due to safety regulations, each Fragile truck can travel at most 50 miles per day. Each Perishable truck can travel at most 60 miles per day. Each General truck can travel at most 70 miles per day.\nPlease help the company to maximize the total profit from all cargo types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFragileTrucks = model.addVar(vtype=\"INTEGER\", name=\"FragileTrucks\", lb=0)\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=0)\nFragileDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"FragileDistance\", lb=0)\nPerishableDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableDistance\", lb=0)\nGeneralDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"GeneralDistance\", lb=0)\n\n# Define objective function\nProfit_Fragile = FragileTrucks * FragileDistance * (1.5 - 0.5)\nProfit_Perishable = PerishableTrucks * PerishableDistance * (1.2 - 0.4)\nProfit_General = GeneralTrucks * GeneralDistance * (0.9 - 0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Fragile + Profit_Perishable + Profit_General)\n\n# Add constraints\nmodel.addCons(FragileTrucks + PerishableTrucks + GeneralTrucks <= 50)\nmodel.addCons(0.5 * FragileTrucks * FragileDistance + 0.4 * PerishableTrucks * PerishableDistance + 0.3 * GeneralTrucks * GeneralDistance <= 1000)\nmodel.addCons(FragileTrucks * FragileDistance + PerishableTrucks * PerishableDistance + GeneralTrucks * GeneralDistance <= 2000)\nmodel.addCons(FragileDistance <= 50)\nmodel.addCons(PerishableDistance <= 60)\nmodel.addCons(GeneralDistance <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Fragile Trucks: \", model.getVal(FragileTrucks))\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of General Trucks: \", model.getVal(GeneralTrucks))\n    print(\"Distance Traveled by Each Fragile Truck: \", model.getVal(FragileDistance))\n    print(\"Distance Traveled by Each Perishable Truck: \", model.getVal(PerishableDistance))\n    print(\"Distance Traveled by Each General Truck: \", model.getVal(GeneralDistance))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo.\n// {\"trips for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"trips for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"trips for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"trips for C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"trips for C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the profit per trip is $1000, the fuel cost per trip is $200, and the time per trip is 5 hours.\nFor C2, the profit per trip is $1200, the fuel cost per trip is $250, and the time per trip is 6 hours.\nFor C3, the profit per trip is $1400, the fuel cost per trip is $300, and the time per trip is 7 hours.\nFor C4, the profit per trip is $1600, the fuel cost per trip is $350, and the time per trip is 8 hours.\nFor C5, the profit per trip is $1800, the fuel cost per trip is $400, and the time per trip is 9 hours.\nThe company wants to maximize the profit efficiency (profit per hour of operation).\n// Profit_C1 = 1000 * C1 - 200 * C1\n// Profit_C2 = 1200 * C2 - 250 * C2\n// Profit_C3 = 1400 * C3 - 300 * C3\n// Profit_C4 = 1600 * C4 - 350 * C4\n// Profit_C5 = 1800 * C5 - 400 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5)\n\n## Generate Constraint-1:\nThe company has a total operational time of 500 hours.\n// 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different types of cargo: C1, C2, C3, C4, and C5. The company must decide how many trips each truck should make for each type of cargo. The profit per trip, fuel cost per trip, and time per trip for each type of cargo are given in the following Table.\n\n| Cargo Type | Profit per Trip | Fuel Cost per Trip | Time per Trip |\n|------------|-----------------|--------------------|---------------|\n| C1         | $1000           | $200               | 5 hours       |\n| C2         | $1200           | $250               | 6 hours       |\n| C3         | $1400           | $300               | 7 hours       |\n| C4         | $1600           | $350               | 8 hours       |\n| C5         | $1800           | $400               | 9 hours       |\n\nThe company has a total operational time of 500 hours. Please help the company to maximize the profit efficiency (profit per hour of operation).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # trips for C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # trips for C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # trips for C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # trips for C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # trips for C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 - 200) * C1\nProfit_C2 = (1200 - 250) * C2\nProfit_C3 = (1400 - 300) * C3\nProfit_C4 = (1600 - 350) * C4\nProfit_C5 = (1800 - 400) * C5\nOperationTime = 5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / OperationTime\n## convert the division to multiplication\nmodel.addCons(obj * OperationTime == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The company has a total operational time of 500 hours.\nmodel.addCons(5 * C1 + 6 * C2 + 7 * C3 + 8 * C4 + 9 * C5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips for C1: \", model.getVal(C1))\n    print(\"Trips for C2: \", model.getVal(C2))\n    print(\"Trips for C3: \", model.getVal(C3))\n    print(\"Trips for C4: \", model.getVal(C4))\n    print(\"Trips for C5: \", model.getVal(C5))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product for the next month. Additionally, the company needs to decide on the number of shifts to operate in their factory for each product type.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductA\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductB\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for ProductC\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of operating a shift for ProductA is $2000, for ProductB is $2500, and for ProductC is $3000. The company wants to maximize the total profit minus the shift operating costs.\n// Total profit for ProductA: Profit_A = 50 * ProdA - 2000 * ShiftsA\n// Total profit for ProductB: Profit_B = 70 * ProdB - 2500 * ShiftsB\n// Total profit for ProductC: Profit_C = 60 * ProdC - 3000 * ShiftsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe factory has a total of 20 shifts available for the month.\n// ShiftsA + ShiftsB + ShiftsC <= 20\n\n## Generate Constraint-2:\nDue to production capacity, the total production quantity for all products cannot exceed 1000 units.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-3:\nThe company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units.\n// ProdA >= 100; ProdC >= 150",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity of each product and the number of shifts to operate in their factory for each product type for the next month. The profit per unit and the cost of operating a shift for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Shift |\n|---------|-----------------|----------------|\n| ProductA | $50             | $2000          |\n| ProductB | $70             | $2500          |\n| ProductC | $60             | $3000          |\n\nThe factory has a total of 20 shifts available for the month. Due to production capacity, the total production quantity for all products cannot exceed 1000 units. The company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units. The company wants to maximize the total profit minus the shift operating costs.\n\nPlease help the company determine the optimal production quantity for each product and the number of shifts to operate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for ProductA\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for ProductB\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for ProductC\n\n# Define objective function\nProfit_A = 50 * ProdA - 2000 * ShiftsA\nProfit_B = 70 * ProdB - 2500 * ShiftsB\nProfit_C = 60 * ProdC - 3000 * ShiftsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The factory has a total of 20 shifts available for the month.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 20)\n# Due to production capacity, the total production quantity for all products cannot exceed 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n# The company has a minimum order requirement for ProductA of 100 units and for ProductC of 150 units.\nmodel.addCons(ProdA >= 100)\nmodel.addCons(ProdC >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Number of Shifts for ProductA: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for ProductB: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for ProductC: \", model.getVal(ShiftsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the marketing budget for each product to enhance sales.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgA\", \"range\": \"MktgA >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductB\": \"MktgB\", \"range\": \"MktgB >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductC\": \"MktgC\", \"range\": \"MktgC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n// Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n// Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 2000 units across all products.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe total marketing budget must not exceed $20,000.\n// MktgA + MktgB + MktgC <= 20,000\n\n## Generate Constraint-4:\nDue to market demand, the production of ProductA must be at least 20% of the total production.\n// ProdA >= 0.2 * (ProdA + ProdB + ProdC)\n\n## Generate Constraint-5:\nThe company aims to produce at least 500 units of ProductB.\n// ProdB >= 500",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the marketing budget for each product to maximize profit while considering the cost of raw materials, labor, and storage. The profit per unit, cost of raw materials per unit, labor cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|----------------------------|---------------------|-----------------------|\n| ProductA | $50             | $20                        | $10                 | $5                    |\n| ProductB | $70             | $30                        | $15                 | $5                    |\n| ProductC | $60             | $25                        | $12                 | $5                    |\n\nThe marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company has a total budget of $100,000 for raw materials and labor. The storage capacity is limited to 2000 units across all products. The total marketing budget must not exceed $20,000. Due to market demand, the production of ProductA must be at least 20% of the total production. The company aims to produce at least 500 units of ProductB.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product and the marketing budget for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMktgA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgA\", lb=0) # marketing budget for ProductA\nMktgB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgB\", lb=0) # marketing budget for ProductB\nMktgC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n## Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n## Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\nProfit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\nProfit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100000)\n## The storage capacity is limited to 2000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n## The total marketing budget must not exceed $20,000.\nmodel.addCons(MktgA + MktgB + MktgC <= 20000)\n## Due to market demand, the production of ProductA must be at least 20% of the total production.\nmodel.addCons(ProdA >= 0.2 * (ProdA + ProdB + ProdC))\n## The company aims to produce at least 500 units of ProductB.\nmodel.addCons(ProdB >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1669,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available across all products cannot exceed 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to production capacity constraints, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 employees are dedicated to ProductA and 30 employees to ProductB.\n// WorkforceA >= 20; WorkforceB >= 30\n\n## Generate Constraint-5:\nThe production of ProductC must be at least 20% of the total production of ProductA and ProductB.\n// QuantityC >= 0.2 * (QuantityA + QuantityB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level. The labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price per Unit | Initial Labor Cost per Unit |\n|---------|-------------------------|-----------------------------|\n| ProductA | $100                    | $50                          |\n| ProductB | $120                    | $60                          |\n| ProductC | $140                    | $70                          |\n\nThe total workforce available across all products cannot exceed 100 employees. The total investment in automation cannot exceed $50,000. Due to production capacity constraints, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 20 employees are dedicated to ProductA and 30 employees to ProductB. The production of ProductC must be at least 20% of the total production of ProductA and ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\nProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\nProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)  # total workforce constraint\nmodel.addCons(Automation <= 50000)  # investment constraint\nmodel.addCons(QuantityA <= 500)  # production capacity constraint for ProductA\nmodel.addCons(QuantityB <= 500)  # production capacity constraint for ProductB\nmodel.addCons(QuantityC <= 500)  # production capacity constraint for ProductC\nmodel.addCons(WorkforceA >= 20)  # workforce constraint for ProductA\nmodel.addCons(WorkforceB >= 30)  # workforce constraint for ProductB\nmodel.addCons(QuantityC >= 0.2 * (QuantityA + QuantityB))  # production ratio constraint for ProductC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce for ProductC: \", model.getVal(WorkforceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1566,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TruckA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TruckC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles.\n// Annual operating cost for TruckA: CostA = 10000 - 0.2 * EfficiencyA\n// Annual operating cost for TruckB: CostB = 15000 - 0.3 * EfficiencyB\n// Annual operating cost for TruckC: CostC = 20000 - 0.4 * EfficiencyC\n// So, the objective function is: Minimize (CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades.\n// TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 vehicles in total.\n// TruckA + TruckB + TruckC >= 50\n\n## Generate Constraint-3:\nDue to operational requirements, the company must have at least 20 TruckA and 15 TruckB.\n// TruckA >= 20; TruckB >= 15\n\n## Generate Constraint-4:\nThe total number of TruckC cannot exceed the combined number of TruckA and TruckB.\n// TruckC <= TruckA + TruckB",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase for the next fiscal year and the level of fuel efficiency upgrades for each vehicle type, which affects the operating cost and range of each vehicle. The operating cost of each vehicle type decreases with the investment in fuel efficiency upgrades. For every $1,000 invested in efficiency upgrades for TruckA, the operating cost decreases by $200 per year. For TruckB, the operating cost decreases by $300 per year for every $1,000 invested. For TruckC, the operating cost decreases by $400 per year for every $1,000 invested. The company aims to minimize the total annual operating cost of all vehicles. The company has a budget of $2,000,000 for purchasing vehicles and investing in fuel efficiency upgrades. The company must purchase at least 50 vehicles in total. Due to operational requirements, the company must have at least 20 TruckA and 15 TruckB. The total number of TruckC cannot exceed the combined number of TruckA and TruckB. Please help the company to determine the optimal number of each type of vehicle and the appropriate level of fuel efficiency upgrades to minimize the total annual operating cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # fuel efficiency upgrade for TruckA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # fuel efficiency upgrade for TruckB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # fuel efficiency upgrade for TruckC\n\n# Define objective function\nCostA = 10000 - 0.2 * EfficiencyA  # Annual operating cost for TruckA\nCostB = 15000 - 0.3 * EfficiencyB  # Annual operating cost for TruckB\nCostC = 20000 - 0.4 * EfficiencyC  # Annual operating cost for TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA * TruckA + CostB * TruckB + CostC * TruckC)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + EfficiencyA + EfficiencyB + EfficiencyC <= 2000000)  # Budget constraint\nmodel.addCons(TruckA + TruckB + TruckC >= 50)  # Minimum total vehicles constraint\nmodel.addCons(TruckA >= 20)  # Minimum TruckA constraint\nmodel.addCons(TruckB >= 15)  # Minimum TruckB constraint\nmodel.addCons(TruckC <= TruckA + TruckB)  # TruckC constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Efficiency Upgrade for TruckA: \", model.getVal(EfficiencyA))\n    print(\"Efficiency Upgrade for TruckB: \", model.getVal(EfficiencyB))\n    print(\"Efficiency Upgrade for TruckC: \", model.getVal(EfficiencyC))\n    print(\"Minimized Total Annual Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation.\n// {\"production quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvest\", \"range\": \"AutomationInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n// Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n// Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvest <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB.\n// DeviceAQty >= 1000; DeviceBQty >= 1500\n\n## Generate Constraint-4:\nThe company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\n// DeviceCQty <= DeviceAQty + DeviceBQty\n\n## Generate Constraint-5:\nThe company has a budget of $3,000,000 for total production costs for the quarter.\n// (100 - 0.0005 * AutomationInvest) * DeviceAQty + (150 - 0.0005 * AutomationInvest) * DeviceBQty + (200 - 0.0005 * AutomationInvest) * DeviceCQty <= 3000000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation. The production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in automation technology cannot exceed $50,000. Due to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB. The company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB. The company has a budget of $3,000,000 for total production costs for the quarter.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=1000)  # production quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=1500)  # production quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0)  # production quantity of DeviceC\nAutomationInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvest\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\nProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\nProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 10000)\n# The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvest <= 50000)\n# Due to market demand, the company must produce at least 1,000 units of DeviceA and 1,500 units of DeviceB.\nmodel.addCons(DeviceAQty >= 1000)\nmodel.addCons(DeviceBQty >= 1500)\n# The company must ensure that the total production of DeviceC does not exceed the combined production of DeviceA and DeviceB.\nmodel.addCons(DeviceCQty <= DeviceAQty + DeviceBQty)\n# The company has a budget of $3,000,000 for total production costs for the quarter.\nmodel.addCons((100 - 0.0005 * AutomationInvest) * DeviceAQty + \n              (150 - 0.0005 * AutomationInvest) * DeviceBQty + \n              (200 - 0.0005 * AutomationInvest) * DeviceCQty <= 3000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Investment in Automation: \", model.getVal(AutomationInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 hectares of Corn.\n// Corn >= 5\n\n## Generate Constraint-5:\nThe farmer must plant at least 15 hectares of Soybeans.\n// Soybeans >= 15",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare and water usage per hectare for each crop are given in the following Table.\n\n| Crop       | Profit per Hectare | Water Usage per Hectare |\n|------------|--------------------|-------------------------|\n| Wheat      | $300               | 500 liters              |\n| Corn       | $400               | 600 liters              |\n| Soybeans   | $500               | 400 liters              |\n| Barley     | $200               | 300 liters              |\n| Oats       | $150               | 200 liters              |\n\nThe farmer has 100 hectares of land available. The total water available for irrigation is 50,000 liters. The farmer must plant at least 10 hectares of Wheat, at least 5 hectares of Corn, and at least 15 hectares of Soybeans. \nPlease help the farmer to maximize the profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\n## The farmer must plant at least 5 hectares of Corn.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5) # area of land for Corn\n## The farmer must plant at least 15 hectares of Soybeans.\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=15) # area of land for Soybeans\n## The area of land for Barley and Oats should be non-negative.\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit Rate per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"SP1\", \"range\": \"SP1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"WT1\", \"range\": \"WT1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"SP2\", \"range\": \"SP2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"WT2\", \"range\": \"WT2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"SP3\", \"range\": \"SP3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"WT3\", \"range\": \"WT3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"SP4\", \"range\": \"SP4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"WT4\", \"range\": \"WT4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"SP5\", \"range\": \"SP5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"WT5\", \"range\": \"WT5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation. The energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations.\n// Total cost: Cost = 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2)\n// Total energy output: Energy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n// So, the objective function is: Minimize (Cost / Energy)\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// 1000 * (SP1^2 + WT1^2 + SP2^2 + WT2^2 + SP3^2 + WT3^2 + SP4^2 + WT4^2 + SP5^2 + WT5^2) <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all locations must not exceed 1000.\n// SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000\n\n## Generate Constraint-3:\nAt each location, the number of solar panels must be at least half the number of wind turbines.\n// SP1 >= 0.5 * WT1; SP2 >= 0.5 * WT2; SP3 >= 0.5 * WT3; SP4 >= 0.5 * WT4; SP5 >= 0.5 * WT5",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The company aims to minimize the total cost of installation and maintenance while maximizing the energy output. The cost function is nonlinear due to economies of scale in production and installation, and the energy output is also nonlinear due to varying efficiencies of solar panels and wind turbines at different locations. The total budget for the project is $500,000. The total number of solar panels and wind turbines across all locations must not exceed 1000. At each location, the number of solar panels must be at least half the number of wind turbines. Please help the company to minimize the ratio of total cost to total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSP1 = model.addVar(vtype=\"INTEGER\", name=\"SP1\", lb=0) # number of solar panels at location 1\nWT1 = model.addVar(vtype=\"INTEGER\", name=\"WT1\", lb=0) # number of wind turbines at location 1\nSP2 = model.addVar(vtype=\"INTEGER\", name=\"SP2\", lb=0) # number of solar panels at location 2\nWT2 = model.addVar(vtype=\"INTEGER\", name=\"WT2\", lb=0) # number of wind turbines at location 2\nSP3 = model.addVar(vtype=\"INTEGER\", name=\"SP3\", lb=0) # number of solar panels at location 3\nWT3 = model.addVar(vtype=\"INTEGER\", name=\"WT3\", lb=0) # number of wind turbines at location 3\nSP4 = model.addVar(vtype=\"INTEGER\", name=\"SP4\", lb=0) # number of solar panels at location 4\nWT4 = model.addVar(vtype=\"INTEGER\", name=\"WT4\", lb=0) # number of wind turbines at location 4\nSP5 = model.addVar(vtype=\"INTEGER\", name=\"SP5\", lb=0) # number of solar panels at location 5\nWT5 = model.addVar(vtype=\"INTEGER\", name=\"WT5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * (SP1**2 + WT1**2 + SP2**2 + WT2**2 + SP3**2 + WT3**2 + SP4**2 + WT4**2 + SP5**2 + WT5**2)\nEnergy = 50 * (SP1 + WT1) + 60 * (SP2 + WT2) + 70 * (SP3 + WT3) + 80 * (SP4 + WT4) + 90 * (SP5 + WT5)\n## the objective function is: Minimize (Cost / Energy)\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(Cost <= 500000)\n## The total number of solar panels and wind turbines across all locations must not exceed 1000.\nmodel.addCons(SP1 + WT1 + SP2 + WT2 + SP3 + WT3 + SP4 + WT4 + SP5 + WT5 <= 1000)\n## At each location, the number of solar panels must be at least half the number of wind turbines.\nmodel.addCons(SP1 >= 0.5 * WT1)\nmodel.addCons(SP2 >= 0.5 * WT2)\nmodel.addCons(SP3 >= 0.5 * WT3)\nmodel.addCons(SP4 >= 0.5 * WT4)\nmodel.addCons(SP5 >= 0.5 * WT5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(SP1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(WT1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(SP2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(WT2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(SP3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(WT3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(SP4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(WT4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(SP5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(WT5))\n    print(\"Minimized Cost/Energy Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy trucks\": \"HeavyTech\", \"range\": \"HeavyTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Medium trucks\": \"MediumTech\", \"range\": \"MediumTech >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Light trucks\": \"LightTech\", \"range\": \"LightTech >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks.\n// Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n// Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n// Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n// So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000.\n// 50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 50\n\n## Generate Constraint-3:\nDue to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\n// HeavyTrucks >= 10; LightTrucks <= 20",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The fuel cost savings per mile for Heavy trucks is $0.50, for Medium trucks is $0.30, and for Light trucks is $0.20. The technology investment improves fuel efficiency by $0.01 per mile for every $1000 invested. The company aims to maximize the total fuel cost savings across all trucks. The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The cost of a Heavy truck is $50,000, a Medium truck is $30,000, and a Light truck is $20,000. The total number of trucks cannot exceed 50. Due to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\n\nPlease help the company to maximize the total fuel cost savings across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of Heavy trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of Light trucks\nHeavyTech = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyTech\", lb=0)  # investment in fuel-efficient technology for Heavy trucks\nMediumTech = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumTech\", lb=0)  # investment in fuel-efficient technology for Medium trucks\nLightTech = model.addVar(vtype=\"CONTINUOUS\", name=\"LightTech\", lb=0)  # investment in fuel-efficient technology for Light trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Fuel cost savings for Heavy trucks: SavingsHeavy = (0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * MilesHeavy\n## Fuel cost savings for Medium trucks: SavingsMedium = (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * MilesMedium\n## Fuel cost savings for Light trucks: SavingsLight = (0.20 + 0.01 * LightTech / 1000) * LightTrucks * MilesLight\n## So, the objective function is: Maximize (SavingsHeavy + SavingsMedium + SavingsLight)\nmodel.addCons(obj == ((0.50 + 0.01 * HeavyTech / 1000) * HeavyTrucks * 10000 + \n                      (0.30 + 0.01 * MediumTech / 1000) * MediumTrucks * 10000 + \n                      (0.20 + 0.01 * LightTech / 1000) * LightTrucks * 10000))\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(50000 * HeavyTrucks + 30000 * MediumTrucks + 20000 * LightTrucks + HeavyTech + MediumTech + LightTech <= 200000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 50)\n## Due to operational requirements, the company must have at least 10 Heavy trucks and no more than 20 Light trucks.\nmodel.addCons(HeavyTrucks >= 10)\nmodel.addCons(LightTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Investment in Heavy Tech: \", model.getVal(HeavyTech))\n    print(\"Investment in Medium Tech: \", model.getVal(MediumTech))\n    print(\"Investment in Light Tech: \", model.getVal(LightTech))\n    print(\"Total Fuel Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision involves choosing the number of solar panels and wind turbines at each site.\n// {\"number of solar panels at site 1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at site 5\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at site 5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation while maximizing the energy output. The cost function is nonlinear due to economies of scale and varying efficiency rates. The energy output is also nonlinear due to varying weather conditions and equipment efficiencies.\n// Total cost: Cost = (1000 * Solar1^0.8 + 2000 * Wind1^0.7) + (1000 * Solar2^0.8 + 2000 * Wind2^0.7) + (1000 * Solar3^0.8 + 2000 * Wind3^0.7) + (1000 * Solar4^0.8 + 2000 * Wind4^0.7) + (1000 * Solar5^0.8 + 2000 * Wind5^0.7)\n// Total energy output: Energy = (50 * Solar1 + 100 * Wind1) + (50 * Solar2 + 100 * Wind2) + (50 * Solar3 + 100 * Wind3) + (50 * Solar4 + 100 * Wind4) + (50 * Solar5 + 100 * Wind5)\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe total budget for the project is $500,000.\n// (1000 * Solar1^0.8 + 2000 * Wind1^0.7) + (1000 * Solar2^0.8 + 2000 * Wind2^0.7) + (1000 * Solar3^0.8 + 2000 * Wind3^0.7) + (1000 * Solar4^0.8 + 2000 * Wind4^0.7) + (1000 * Solar5^0.8 + 2000 * Wind5^0.7) <= 500000\n\n## Generate Constraint-2:\nEach site must have at least one type of renewable energy source.\n// Solar1 + Wind1 >= 1\n// Solar2 + Wind2 >= 1\n// Solar3 + Wind3 >= 1\n// Solar4 + Wind4 >= 1\n// Solar5 + Wind5 >= 1\n\n## Generate Constraint-3:\nThe total energy output must be at least 5000 units.\n// (50 * Solar1 + 100 * Wind1) + (50 * Solar2 + 100 * Wind2) + (50 * Solar3 + 100 * Wind3) + (50 * Solar4 + 100 * Wind4) + (50 * Solar5 + 100 * Wind5) >= 5000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision involves choosing the number of solar panels and wind turbines at each site. The company aims to minimize the total cost of installation and operation while maximizing the energy output. The cost function is nonlinear due to economies of scale and varying efficiency rates. The energy output is also nonlinear due to varying weather conditions and equipment efficiencies. The total budget for the project is $500,000. Each site must have at least one type of renewable energy source. The total energy output must be at least 5000 units.\nPlease help the company to minimize the total cost of installation and operation while maximizing the energy output, defined as the ratio of the total cost to the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0)\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0)\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0)\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0)\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0)\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0)\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0)\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0)\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0)\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost and energy output\nCost = (1000 * Solar1**0.8 + 2000 * Wind1**0.7) + (1000 * Solar2**0.8 + 2000 * Wind2**0.7) + (1000 * Solar3**0.8 + 2000 * Wind3**0.7) + (1000 * Solar4**0.8 + 2000 * Wind4**0.7) + (1000 * Solar5**0.8 + 2000 * Wind5**0.7)\nEnergy = (50 * Solar1 + 100 * Wind1) + (50 * Solar2 + 100 * Wind2) + (50 * Solar3 + 100 * Wind3) + (50 * Solar4 + 100 * Wind4) + (50 * Solar5 + 100 * Wind5)\n\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The total budget for the project is $500,000.\nmodel.addCons(Cost <= 500000)\n## Each site must have at least one type of renewable energy source.\nmodel.addCons(Solar1 + Wind1 >= 1)\nmodel.addCons(Solar2 + Wind2 >= 1)\nmodel.addCons(Solar3 + Wind3 >= 1)\nmodel.addCons(Solar4 + Wind4 >= 1)\nmodel.addCons(Solar5 + Wind5 >= 1)\n## The total energy output must be at least 5000 units.\nmodel.addCons(Energy >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site 1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines at Site 1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels at Site 2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines at Site 2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels at Site 3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Site 3: \", model.getVal(Wind3))\n    print(\"Number of Solar Panels at Site 4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Site 4: \", model.getVal(Wind4))\n    print(\"Number of Solar Panels at Site 5: \", model.getVal(Solar5))\n    print(\"Number of Wind Turbines at Site 5: \", model.getVal(Wind5))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Trucks\": \"FuelEffTrucks\", \"range\": \"FuelEffTrucks >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Vans\": \"FuelEffVans\", \"range\": \"FuelEffVans >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of Bikes\": \"FuelEffBikes\", \"range\": \"FuelEffBikes >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies.\n// DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n// OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n// The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1.\n// 3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its delivery efficiency while considering the operational costs and constraints such as fuel consumption, maintenance costs, and vehicle capacities. The company aims to maximize its total delivery efficiency, which is a function of the number of vehicles and their fuel efficiencies. The efficiency is defined as the number of deliveries per unit of fuel consumed. The company also considers the operational cost, which is a nonlinear function of the number of vehicles and their respective fuel efficiencies. The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance. The cost per unit of fuel for Trucks is $3, for Vans is $2, and for Bikes is $1. Please help the company to maximize the function (DeliveryEfficiency - OperationalCost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nFuelEffTrucks = model.addVar(name=\"FuelEffTrucks\", lb=0)  # fuel efficiency of Trucks\nFuelEffVans = model.addVar(name=\"FuelEffVans\", lb=0)  # fuel efficiency of Vans\nFuelEffBikes = model.addVar(name=\"FuelEffBikes\", lb=0)  # fuel efficiency of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## DeliveryEfficiency = (Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes) / (Trucks^2 + Vans^2 + Bikes^2)\n## OperationalCost = (Trucks * FuelEffTrucks^2 + Vans * FuelEffVans^2 + Bikes * FuelEffBikes^2)\n## The objective function is: Maximize (DeliveryEfficiency - OperationalCost)\n## convert the division to multiplication\nDeliveryEfficiency = Trucks * FuelEffTrucks + Vans * FuelEffVans + Bikes * FuelEffBikes\nOperationalCost = Trucks * FuelEffTrucks**2 + Vans * FuelEffVans**2 + Bikes * FuelEffBikes**2\nmodel.addCons(obj * (Trucks**2 + Vans**2 + Bikes**2) == DeliveryEfficiency * (Trucks**2 + Vans**2 + Bikes**2) - OperationalCost)\n\n# Add constraints\n## The company has a total budget of $100,000 for vehicle operations, including fuel and maintenance.\nmodel.addCons(3 * Trucks * FuelEffTrucks + 2 * Vans * FuelEffVans + Bikes * FuelEffBikes <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Fuel Efficiency of Trucks: \", model.getVal(FuelEffTrucks))\n    print(\"Fuel Efficiency of Vans: \", model.getVal(FuelEffVans))\n    print(\"Fuel Efficiency of Bikes: \", model.getVal(FuelEffBikes))\n    print(\"Maximized Efficiency - Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC.\n\n| Product | Cost per Unit |\n|---------|---------------|\n| ProductA | 50$           |\n| ProductB | 70$           |\n| ProductC | 90$           |\n\nThe total production capacity of the company is 5000 units. The total marketing budget is $50,000. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantity, selling price, and marketing investment for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0)  # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"cost per kilometer for small vehicles\": \"CostPerKmSmall\", \"range\": \"CostPerKmSmall >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for medium vehicles\": \"CostPerKmMedium\", \"range\": \"CostPerKmMedium >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for large vehicles\": \"CostPerKmLarge\", \"range\": \"CostPerKmLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer.\n// Revenue_Small = 10 * SmallVehicles\n// Revenue_Medium = 15 * MediumVehicles\n// Revenue_Large = 20 * LargeVehicles\n// Operational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints. The revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer. The company has a total budget of $10,000 for vehicle operations. Please help the company to determine the optimal number of small, medium, and large vehicles to maximize their profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0)  # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0)  # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0)  # number of large vehicles\n\n# Define objective function\nRevenue_Small = 10 * SmallVehicles\nRevenue_Medium = 15 * MediumVehicles\nRevenue_Large = 20 * LargeVehicles\nOperational_Cost = SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles  # simplified operational cost\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n# Add constraints\n# The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\n// {\"trips to D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"trips to D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"trips to D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"trips to D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"trips to D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company aims to maximize the net profit (total profit minus total costs).\n// NetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1^2\n// NetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2^2\n// NetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3^2\n// NetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4^2\n// NetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5^2\n// So, the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of $10000.\n// 200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance budget that cannot exceed $2000.\n// 0.01 * D1^2 + 0.015 * D2^2 + 0.02 * D3^2 + 0.025 * D4^2 + 0.03 * D5^2 <= 2000\n\n## Generate Constraint-3:\nThe company has a limit of 50 trips per truck.\n// D1 + D2 + D3 + D4 + D5 <= 50\n\n## Generate Constraint-4:\nThe market demand for trips to D1 is 10. So, the company can only make a maximum of 10 trips to D1.\n// D1 <= 10\n\n## Generate Constraint-5:\nThe company must ensure that at least 15 trips are made to D3 to maintain customer loyalty.\n// D3 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide the number of trips each truck will make to each destination.\nEach trip to D1 generates a profit of $1000, but incurs a fuel cost of $200 and a maintenance cost that increases quadratically with the number of trips (0.01 * D1^2).\nEach trip to D2 generates a profit of $1200, with a fuel cost of $250 and a maintenance cost of 0.015 * D2^2.\nEach trip to D3 generates a profit of $1500, with a fuel cost of $300 and a maintenance cost of 0.02 * D3^2.\nEach trip to D4 generates a profit of $1800, with a fuel cost of $350 and a maintenance cost of 0.025 * D4^2.\nEach trip to D5 generates a profit of $2000, with a fuel cost of $400 and a maintenance cost of 0.03 * D5^2.\nThe company has a total fuel budget of $10000. The company has a maintenance budget that cannot exceed $2000. The company has a limit of 50 trips per truck. The market demand for trips to D1 is 10. The company must ensure that at least 15 trips are made to D3 to maintain customer loyalty.\nPlease help the company to maximize the net profit (total profit minus total costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=10)  # trips to D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0)  # trips to D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=15)  # trips to D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0)  # trips to D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0)  # trips to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## NetProfit calculation with quadratic terms\nNetProfit_D1 = 1000 * D1 - 200 * D1 - 0.01 * D1**2\nNetProfit_D2 = 1200 * D2 - 250 * D2 - 0.015 * D2**2\nNetProfit_D3 = 1500 * D3 - 300 * D3 - 0.02 * D3**2\nNetProfit_D4 = 1800 * D4 - 350 * D4 - 0.025 * D4**2\nNetProfit_D5 = 2000 * D5 - 400 * D5 - 0.03 * D5**2\n\n## the objective function is: Maximize (NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\nmodel.addCons(obj == NetProfit_D1 + NetProfit_D2 + NetProfit_D3 + NetProfit_D4 + NetProfit_D5)\n\n# Add constraints\n## The company has a total fuel budget of $10000.\nmodel.addCons(200 * D1 + 250 * D2 + 300 * D3 + 350 * D4 + 400 * D5 <= 10000)\n\n## The company has a maintenance budget that cannot exceed $2000.\nmodel.addCons(0.01 * D1**2 + 0.015 * D2**2 + 0.02 * D3**2 + 0.025 * D4**2 + 0.03 * D5**2 <= 2000)\n\n## The company has a limit of 50 trips per truck.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trips to D1: \", model.getVal(D1))\n    print(\"Trips to D2: \", model.getVal(D2))\n    print(\"Trips to D3: \", model.getVal(D3))\n    print(\"Trips to D4: \", model.getVal(D4))\n    print(\"Trips to D5: \", model.getVal(D5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1203,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily to maximize energy production. Additionally, the company is considering investing in energy storage systems for each type of power plant to enhance efficiency and stability of power output.\n// {\"number of operating hours for Solar\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Wind\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"number of operating hours for Hydro\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Solar\": \"SolarStorage\", \"range\": \"SolarStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Wind\": \"WindStorage\", \"range\": \"WindStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Hydro\": \"HydroStorage\", \"range\": \"HydroStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company aims to maximize the total daily energy production.\n// Total energy for Solar: EnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\n// Total energy for Wind: EnergyWind = (120 + 0.0008 * WindStorage) * WindHours\n// Total energy for Hydro: EnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operating costs and energy storage investments.\n// 1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all power plants must not exceed 24 hours per day.\n// SolarHours + WindHours + HydroHours <= 24\n\n## Generate Constraint-3:\nDue to maintenance schedules, the Solar power plant must operate at least 2 hours per day, the Wind power plant at least 3 hours, and the Hydro power plant at least 4 hours.\n// SolarHours >= 2; WindHours >= 3; HydroHours >= 4\n\n## Generate Constraint-4:\nThe investment in energy storage for each type of power plant is limited by the available technology and infrastructure. The maximum investment for Solar is $5000, for Wind is $6000, and for Hydro is $7000.\n// SolarStorage <= 5000; WindStorage <= 6000; HydroStorage <= 7000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each type of power plant should operate daily and the investment in energy storage systems for each type to maximize energy production. The energy production of each power plant is affected by the investment in energy storage. For every $1000 invested in Solar storage, the energy output increases by 1 MWh per hour of operation. For Wind, every $1000 invested increases the output by 0.8 MWh per hour. For Hydro, every $1000 invested increases the output by 1.2 MWh per hour. The company has a total budget of $100,000 for operating costs and energy storage investments. The total operating hours for all power plants must not exceed 24 hours per day. Due to maintenance schedules, the Solar power plant must operate at least 2 hours per day, the Wind power plant at least 3 hours, and the Hydro power plant at least 4 hours. The investment in energy storage for each type of power plant is limited by the available technology and infrastructure. The maximum investment for Solar is $5000, for Wind is $6000, and for Hydro is $7000. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=2)  # number of operating hours for Solar\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=3)  # number of operating hours for Wind\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=4)  # number of operating hours for Hydro\nSolarStorage = model.addVar(name=\"SolarStorage\", lb=0, ub=5000)  # investment in energy storage for Solar\nWindStorage = model.addVar(name=\"WindStorage\", lb=0, ub=6000)  # investment in energy storage for Wind\nHydroStorage = model.addVar(name=\"HydroStorage\", lb=0, ub=7000)  # investment in energy storage for Hydro\n\n# Define objective function\nEnergySolar = (100 + 0.001 * SolarStorage) * SolarHours\nEnergyWind = (120 + 0.0008 * WindStorage) * WindHours\nEnergyHydro = (150 + 0.0012 * HydroStorage) * HydroHours\n# So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for operating costs and energy storage investments.\nmodel.addCons(1000 * SolarHours + 1200 * WindHours + 1500 * HydroHours + SolarStorage + WindStorage + HydroStorage <= 100000)\n# The total operating hours for all power plants must not exceed 24 hours per day.\nmodel.addCons(SolarHours + WindHours + HydroHours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Operating Hours for Solar: \", model.getVal(SolarHours))\n    print(\"Number of Operating Hours for Wind: \", model.getVal(WindHours))\n    print(\"Number of Operating Hours for Hydro: \", model.getVal(HydroHours))\n    print(\"Investment in Solar Storage: \", model.getVal(SolarStorage))\n    print(\"Investment in Wind Storage: \", model.getVal(WindStorage))\n    print(\"Investment in Hydro Storage: \", model.getVal(HydroStorage))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route 1 has a cost of $2 per mile and an average speed of 50 mph. Route 2 has a cost of $3 per mile and an average speed of 45 mph. Route 3 has a cost of $4 per mile and an average speed of 40 mph. Route 4 has a cost of $5 per mile and an average speed of 35 mph. Route 5 has a cost of $6 per mile and an average speed of 30 mph. The company aims to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed a certain threshold.\n// Cost of route 1: C1 = 2 * T1\n// Cost of route 2: C2 = 3 * T2\n// Cost of route 3: C3 = 4 * T3\n// Cost of route 4: C4 = 5 * T4\n// Cost of route 5: C5 = 6 * T5\n// Total delivery time: T_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n// So, the objective function is: Minimize (C1 + C2 + C3 + C4 + C5) + (T_total * 100)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and average speed for each route are given in the following Table.\n\n| Route | Cost per Mile | Average Speed |\n|-------|---------------|---------------|\n| 1     | $2            | 50 mph        |\n| 2     | $3            | 45 mph        |\n| 3     | $4            | 40 mph        |\n| 4     | $5            | 35 mph        |\n| 5     | $6            | 30 mph        |\n\nThe company has a budget of $1000 for operational costs. The total number of trucks available is 50. The company aims to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed a certain threshold. Please help the company to minimize the objective function, which is the sum of the total cost of operations plus the total delivery time multiplied by 100.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 2 * T1\nC2 = 3 * T2\nC3 = 4 * T3\nC4 = 5 * T4\nC5 = 6 * T5\nT_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n## convert the division to multiplication\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5 + T_total * 100)\n\n# Add constraints\n## The company has a budget of $1000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC.\n// {\"number of TypeA trucks\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB trucks\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC trucks\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for TypeA trucks\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeB trucks\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for TypeC trucks\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and upgrade costs. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The company wants to minimize the total operational cost.\n// Fuel cost per kilometer for TypeA: CostA = 0.5 - 0.0001 * UpgradeA\n// Fuel cost per kilometer for TypeB: CostB = 0.6 - 0.0001 * UpgradeB\n// Fuel cost per kilometer for TypeC: CostC = 0.7 - 0.0001 * UpgradeC\n// Total operational cost: Minimize (CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC)\n\n## Generate Constraint-1:\nThe total budget for fuel efficiency upgrades is $10,000.\n// UpgradeA + UpgradeB + UpgradeC <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks available is 100.\n// TrucksA + TrucksB + TrucksC <= 100\n\n## Generate Constraint-3:\nDue to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks.\n// TrucksA >= 20; TrucksB >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The trucks are of three types: TypeA, TypeB, and TypeC. The fuel cost per kilometer for TypeA trucks is $0.5, for TypeB trucks is $0.6, and for TypeC trucks is $0.7. Upgrading the fuel efficiency of a truck reduces its fuel cost per kilometer by $0.01 for every $100 spent on upgrades. The company wants to minimize the total operational cost, which includes fuel costs and upgrade costs.\n\n| Truck Type | Fuel Cost per Kilometer |\n|------------|-------------------------|\n| TypeA      | 0.5$                    |\n| TypeB      | 0.6$                    |\n| TypeC      | 0.7$                    |\n\nThe company has a total budget of $10,000 for fuel efficiency upgrades. The total number of trucks available is 100. Due to regional demand, there must be at least 20 TypeA trucks and 30 TypeB trucks.\n\nPlease help the company to minimize the total operational cost, which is defined as the sum of the fuel costs for each truck type multiplied by the number of trucks of that type, plus the total cost of fuel efficiency upgrades.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=20) # number of TypeA trucks\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=30) # number of TypeB trucks\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of TypeC trucks\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0) # fuel efficiency upgrade for TypeA trucks\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0) # fuel efficiency upgrade for TypeB trucks\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0) # fuel efficiency upgrade for TypeC trucks\n\n# Define objective function\nCostA = 0.5 - 0.0001 * UpgradeA\nCostB = 0.6 - 0.0001 * UpgradeB\nCostC = 0.7 - 0.0001 * UpgradeC\nTotalCost = CostA * TrucksA + CostB * TrucksB + CostC * TrucksC + UpgradeA + UpgradeB + UpgradeC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC <= 10000) # total budget for fuel efficiency upgrades\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 100) # total number of trucks available\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Trucks: \", model.getVal(TrucksA))\n    print(\"Number of TypeB Trucks: \", model.getVal(TrucksB))\n    print(\"Number of TypeC Trucks: \", model.getVal(TrucksC))\n    print(\"Upgrade for TypeA Trucks: \", model.getVal(UpgradeA))\n    print(\"Upgrade for TypeB Trucks: \", model.getVal(UpgradeB))\n    print(\"Upgrade for TypeC Trucks: \", model.getVal(UpgradeC))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1247,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region3\": \"FuelOpt3\", \"range\": \"FuelOpt3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions.\n// Operational cost for Region1: Cost1 = (100 - 0.1 * FuelOpt1) * Trucks1\n// Operational cost for Region2: Cost2 = (100 - 0.1 * FuelOpt2) * Trucks2\n// Operational cost for Region3: Cost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n// Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000",
        "question": "A logistics company is planning its delivery routes for three different regions: Region1, Region2, and Region3. The company needs to decide the number of trucks to deploy in each region and the amount of fuel to optimize for each truck. The fuel optimization affects the fuel efficiency and thus the operational costs of the trucks. The operational cost of each truck is affected by the fuel optimization. The cost per kilometer decreases non-linearly with the amount of fuel optimization. Specifically, the cost per kilometer decreases by 1% for every 10% increase in fuel optimization, up to a maximum optimization of 50%. The company aims to minimize the total operational cost across all regions. The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\n\nPlease help the company to determine the optimal number of trucks and fuel optimization for each region to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelOpt1 = model.addVar(name=\"FuelOpt1\", lb=0)  # fuel optimization for Region1\nFuelOpt2 = model.addVar(name=\"FuelOpt2\", lb=0)  # fuel optimization for Region2\nFuelOpt3 = model.addVar(name=\"FuelOpt3\", lb=0)  # fuel optimization for Region3\n\n# Define objective function\nCost1 = (100 - 0.1 * FuelOpt1) * Trucks1\nCost2 = (100 - 0.1 * FuelOpt2) * Trucks2\nCost3 = (100 - 0.1 * FuelOpt3) * Trucks3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a total budget of $100,000 for deploying trucks and optimizing fuel.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + FuelOpt1 + FuelOpt2 + FuelOpt3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Region2: \", model.getVal(FuelOpt2))\n    print(\"Fuel Optimization for Region3: \", model.getVal(FuelOpt3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (Small, Medium, Large) and the fuel consumption rate for each trip to minimize overall operational costs while meeting delivery deadlines.\n// {\"number of Small truck trips\": \"TripsS\", \"range\": \"TripsS >= 0\", \"type\": \"integer\"}\n// {\"number of Medium truck trips\": \"TripsM\", \"range\": \"TripsM >= 0\", \"type\": \"integer\"}\n// {\"number of Large truck trips\": \"TripsL\", \"range\": \"TripsL >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Small truck trips\": \"FuelS\", \"range\": \"FuelS >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Medium truck trips\": \"FuelM\", \"range\": \"FuelM >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate for Large truck trips\": \"FuelL\", \"range\": \"FuelL >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each trip is a nonlinear function of the fuel consumption rate and the number of trips. The cost per trip for Small trucks is $100 + $5 * FuelS, for Medium trucks is $200 + $10 * FuelM, and for Large trucks is $300 + $15 * FuelL. The company aims to minimize the total operational cost of all trips.\n// Total operational cost for Small trucks: CostS = (100 + 5 * FuelS) * TripsS\n// Total operational cost for Medium trucks: CostM = (200 + 10 * FuelM) * TripsM\n// Total operational cost for Large trucks: CostL = (300 + 15 * FuelL) * TripsL\n// So, the objective function is: Minimize (CostS + CostM + CostL)\n\n## Generate Constraint-1:\nThe total fuel budget for all trips is $10,000.\n// FuelS * TripsS + FuelM * TripsM + FuelL * TripsL <= 10000\n\n## Generate Constraint-2:\nThe company must make at least 500 trips in total.\n// TripsS + TripsM + TripsL >= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of Large truck trips must not exceed 100.\n// TripsL <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (Small, Medium, Large) and the fuel consumption rate for each trip to minimize overall operational costs while meeting delivery deadlines. The operational cost of each trip is a nonlinear function of the fuel consumption rate and the number of trips. The cost per trip for Small trucks is $100 + $5 * FuelS, for Medium trucks is $200 + $10 * FuelM, and for Large trucks is $300 + $15 * FuelL. The company aims to minimize the total operational cost of all trips. The total fuel budget for all trips is $10,000. The company must make at least 500 trips in total. Due to maintenance schedules, the number of Large truck trips must not exceed 100. Please help the company to minimize the total operational cost of all trips.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsS = model.addVar(vtype=\"INTEGER\", name=\"TripsS\", lb=0) # number of Small truck trips\nTripsM = model.addVar(vtype=\"INTEGER\", name=\"TripsM\", lb=0) # number of Medium truck trips\nTripsL = model.addVar(vtype=\"INTEGER\", name=\"TripsL\", lb=0) # number of Large truck trips\nFuelS = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelS\", lb=0) # fuel consumption rate for Small truck trips\nFuelM = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelM\", lb=0) # fuel consumption rate for Medium truck trips\nFuelL = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelL\", lb=0) # fuel consumption rate for Large truck trips\n\n# Define objective function\nCostS = (100 + 5 * FuelS) * TripsS\nCostM = (200 + 10 * FuelM) * TripsM\nCostL = (300 + 15 * FuelL) * TripsL\n# So, the objective function is: Minimize (CostS + CostM + CostL)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostS + CostM + CostL)\n\n# Add constraints\n# The total fuel budget for all trips is $10,000.\nmodel.addCons(FuelS * TripsS + FuelM * TripsM + FuelL * TripsL <= 10000)\n# The company must make at least 500 trips in total.\nmodel.addCons(TripsS + TripsM + TripsL >= 500)\n# Due to maintenance schedules, the number of Large truck trips must not exceed 100.\nmodel.addCons(TripsL <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small truck trips: \", model.getVal(TripsS))\n    print(\"Number of Medium truck trips: \", model.getVal(TripsM))\n    print(\"Number of Large truck trips: \", model.getVal(TripsL))\n    print(\"Fuel consumption rate for Small truck trips: \", model.getVal(FuelS))\n    print(\"Fuel consumption rate for Medium truck trips: \", model.getVal(FuelM))\n    print(\"Fuel consumption rate for Large truck trips: \", model.getVal(FuelL))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The company also considers the fuel efficiency and maintenance costs of each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for small trucks\": \"DriversSmall\", \"range\": \"DriversSmall >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for medium trucks\": \"DriversMedium\", \"range\": \"DriversMedium >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for large trucks\": \"DriversLarge\", \"range\": \"DriversLarge >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a small truck is $30,000, a medium truck is $45,000, and a large truck is $60,000. The fuel efficiency of a small truck is 15 km/l, a medium truck is 12 km/l, and a large truck is 10 km/l. The maintenance cost per kilometer for a small truck is $0.1, a medium truck is $0.15, and a large truck is $0.2. The company wants to minimize the total cost of purchasing trucks and their operational costs.\n// PurchaseCost = 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks\n// FuelCost = (15 * SmallTrucks * DriversSmall * Distance) + (12 * MediumTrucks * DriversMedium * Distance) + (10 * LargeTrucks * DriversLarge * Distance)\n// MaintenanceCost = (0.1 * SmallTrucks * DriversSmall * Distance) + (0.15 * MediumTrucks * DriversMedium * Distance) + (0.2 * LargeTrucks * DriversLarge * Distance)\n// So, the objective function is: Minimize (PurchaseCost + FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks.\n// 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks <= 1000000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// DriversSmall + DriversMedium + DriversLarge <= 50\n\n## Generate Constraint-3:\nThe total distance that can be covered by the fleet per day is limited to 5000 km.\n// (15 * SmallTrucks * DriversSmall) + (12 * MediumTrucks * DriversMedium) + (10 * LargeTrucks * DriversLarge) <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the fleet is composed of large trucks.\n// LargeTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks)",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The company also considers the fuel efficiency and maintenance costs of each type of truck. The cost of a small truck is $30,000, a medium truck is $45,000, and a large truck is $60,000. The fuel efficiency of a small truck is 15 km/l, a medium truck is 12 km/l, and a large truck is 10 km/l. The maintenance cost per kilometer for a small truck is $0.1, a medium truck is $0.15, and a large truck is $0.2. The company has a budget of $1,000,000 for purchasing trucks. The company has a total of 50 drivers available. The total distance that can be covered by the fleet per day is limited to 5000 km. The company wants to ensure that at least 10% of the fleet is composed of large trucks. Please help the company to minimize the total cost of purchasing trucks and their operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversSmall = model.addVar(vtype=\"INTEGER\", name=\"DriversSmall\", lb=0)\nDriversMedium = model.addVar(vtype=\"INTEGER\", name=\"DriversMedium\", lb=0)\nDriversLarge = model.addVar(vtype=\"INTEGER\", name=\"DriversLarge\", lb=0)\n\n# Define objective function\nPurchaseCost = 30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks\nFuelCost = (15 * SmallTrucks * DriversSmall * 5000) + (12 * MediumTrucks * DriversMedium * 5000) + (10 * LargeTrucks * DriversLarge * 5000)\nMaintenanceCost = (0.1 * SmallTrucks * DriversSmall * 5000) + (0.15 * MediumTrucks * DriversMedium * 5000) + (0.2 * LargeTrucks * DriversLarge * 5000)\nTotalCost = PurchaseCost + FuelCost + MaintenanceCost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(30000 * SmallTrucks + 45000 * MediumTrucks + 60000 * LargeTrucks <= 1000000)\nmodel.addCons(DriversSmall + DriversMedium + DriversLarge <= 50)\nmodel.addCons((15 * SmallTrucks * DriversSmall) + (12 * MediumTrucks * DriversMedium) + (10 * LargeTrucks * DriversLarge) <= 5000)\nmodel.addCons(LargeTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Drivers for Small Trucks: \", model.getVal(DriversSmall))\n    print(\"Number of Drivers for Medium Trucks: \", model.getVal(DriversMedium))\n    print(\"Number of Drivers for Large Trucks: \", model.getVal(DriversLarge))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated.\n// Net profit per truck on route A: Profit_A = (1500 - 1000) * A\n// Net profit per truck on route B: Profit_B = (1800 - 1200) * B\n// Net profit per truck on route C: Profit_C = (2200 - 1500) * C\n// Net profit per truck on route D: Profit_D = (2500 - 1800) * D\n// Net profit per truck on route E: Profit_E = (3000 - 2000) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across five different routes: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to maximize efficiency and minimize costs. Each route has different operational costs and revenue potentials. The cost per truck on route A is $1000, on route B is $1200, on route C is $1500, on route D is $1800, and on route E is $2000. The revenue per truck on route A is $1500, on route B is $1800, on route C is $2200, on route D is $2500, and on route E is $3000. The company aims to maximize the net profit per truck (revenue minus cost) while considering the total number of trucks allocated. The company has a budget of $10,000 for operational costs. The company must allocate at least 5 trucks to each route. Please help the company to maximize the net profit per truck (which is defined as the sum of the net profits divided by the total number of trucks allocated).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1500 - 1000) * A\nProfit_B = (1800 - 1200) * B\nProfit_C = (2200 - 1500) * C\nProfit_D = (2500 - 1800) * D\nProfit_E = (3000 - 2000) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantities for each product to optimize their profit margin.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for ProductB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units.\nThe profit per unit for ProductC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units.\nThe profit per unit for ProductD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all products.\n// Profit for ProductA: Profit_A = (50 - 0.1 * max(0, ProdA - 100)) * ProdA\n// Profit for ProductB: Profit_B = (70 - 0.05 * max(0, ProdB - 200)) * ProdB\n// Profit for ProductC: Profit_C = (60 - 0.08 * max(0, ProdC - 150)) * ProdC\n// Profit for ProductD: Profit_D = (80 - 0.12 * max(0, ProdD - 250)) * ProdD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProdA + ProdB + ProdC + ProdD <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA\n\n## Generate Constraint-3:\nThe company has a storage limit of 500 units for ProductC and ProductD combined.\n// ProdC + ProdD <= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each product are produced to meet minimum market demand.\n// ProdA >= 50; ProdB >= 50; ProdC >= 50; ProdD >= 50",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantities for each product to optimize their profit margin. The profit per unit for each product decreases as more units are produced beyond certain thresholds. The details are given in the following Table.\n\n| Product | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|---------|----------------------------------|------------------------------------|-----------|\n| ProductA | $50                             | $0.1                               | 100 units  |\n| ProductB | $70                             | $0.05                              | 200 units  |\n| ProductC | $60                             | $0.08                              | 150 units  |\n| ProductD | $80                             | $0.12                              | 250 units  |\n\nThe company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a storage limit of 500 units for ProductC and ProductD combined. The company wants to ensure that at least 50 units of each product are produced to meet minimum market demand.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=50) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=50) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=50) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=50) # production quantity for ProductD\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(0, ProdA - 100)) * ProdA\nProdA1 = model.addVar(vtype=\"INTEGER\", name=\"ProdA1\", lb=0, ub=100)\nProdA2 = model.addVar(vtype=\"INTEGER\", name=\"ProdA2\", lb=100, ub=1000)\nProdA_b1 = model.addVar(vtype=\"B\", name=\"ProdA_b1\")\nProdA_b2 = model.addVar(vtype=\"B\", name=\"ProdA_b2\")\nmodel.addCons(ProdA_b1 + ProdA_b2 == 1)\nmodel.addCons(ProdA == ProdA1*ProdA_b1 + ProdA2*ProdA_b2)\nProfit_A = (50 - 0.1 * ProdA2) * ProdA2 * ProdA_b2 + 50 * ProdA1 * ProdA_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(0, ProdB - 200)) * ProdB\nProdB1 = model.addVar(vtype=\"INTEGER\", name=\"ProdB1\", lb=0, ub=200)\nProdB2 = model.addVar(vtype=\"INTEGER\", name=\"ProdB2\", lb=200, ub=1000)\nProdB_b1 = model.addVar(vtype=\"B\", name=\"ProdB_b1\")\nProdB_b2 = model.addVar(vtype=\"B\", name=\"ProdB_b2\")\nmodel.addCons(ProdB_b1 + ProdB_b2 == 1)\nmodel.addCons(ProdB == ProdB1*ProdB_b1 + ProdB2*ProdB_b2)\nProfit_B = (70 - 0.05 * ProdB2) * ProdB2 * ProdB_b2 + 70 * ProdB1 * ProdB_b1\n## create piecewise variables for piecewise function: Profit_C = (60 - 0.08 * max(0, ProdC - 150)) * ProdC\nProdC1 = model.addVar(vtype=\"INTEGER\", name=\"ProdC1\", lb=0, ub=150)\nProdC2 = model.addVar(vtype=\"INTEGER\", name=\"ProdC2\", lb=150, ub=1000)\nProdC_b1 = model.addVar(vtype=\"B\", name=\"ProdC_b1\")\nProdC_b2 = model.addVar(vtype=\"B\", name=\"ProdC_b2\")\nmodel.addCons(ProdC_b1 + ProdC_b2 == 1)\nmodel.addCons(ProdC == ProdC1*ProdC_b1 + ProdC2*ProdC_b2)\nProfit_C = (60 - 0.08 * ProdC2) * ProdC2 * ProdC_b2 + 60 * ProdC1 * ProdC_b1\n## create piecewise variables for piecewise function: Profit_D = (80 - 0.12 * max(0, ProdD - 250)) * ProdD\nProdD1 = model.addVar(vtype=\"INTEGER\", name=\"ProdD1\", lb=0, ub=250)\nProdD2 = model.addVar(vtype=\"INTEGER\", name=\"ProdD2\", lb=250, ub=1000)\nProdD_b1 = model.addVar(vtype=\"B\", name=\"ProdD_b1\")\nProdD_b2 = model.addVar(vtype=\"B\", name=\"ProdD_b2\")\nmodel.addCons(ProdD_b1 + ProdD_b2 == 1)\nmodel.addCons(ProdD == ProdD1*ProdD_b1 + ProdD2*ProdD_b2)\nProfit_D = (80 - 0.12 * ProdD2) * ProdD2 * ProdD_b2 + 80 * ProdD1 * ProdD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC + ProdD <= 1000)\nmodel.addCons(ProdB <= 2 * ProdA)\nmodel.addCons(ProdC + ProdD <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technologies to improve production efficiency. The investment in automation will reduce the labor and material costs per unit of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor and materials per unit for each product decreases by $5 for every $1000 invested in automation for that product. The initial cost of labor and materials per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * AutomationA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * AutomationB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * AutomationC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 units of resources available for the month.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500\n\n## Generate Constraint-4:\nThe company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\n// QuantityA >= 200; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technologies to improve production efficiency. The investment in automation will reduce the labor and material costs per unit of each product. The initial cost of labor and materials per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Cost per Unit | Selling Price per Unit |\n|---------|-----------------------|------------------------|\n| ProductA | $100                 | $200                   |\n| ProductB | $150                 | $250                   |\n| ProductC | $200                 | $300                   |\n\nThe company has a total of 10,000 units of resources available for the month. The total investment in automation cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. The company must ensure that at least 200 units of ProductA and 300 units of ProductB are produced.\n\nPlease help the company to maximize the total profit from all products, considering the impact of automation on the cost of labor and materials per unit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=200, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)     # production quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)       # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)       # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)       # resources allocated to ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)     # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)     # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)     # investment in automation for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * AutomationA) * QuantityA\nProfitB = (250 - 150 + 0.005 * AutomationB) * QuantityB\nProfitC = (300 - 200 + 0.005 * AutomationC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resources allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1363,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands.\n// {\"number of trucks on route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for route 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for route 5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades. The cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes.\n// Operational cost for route 1: Cost1 = (100 + 0.1 * Upgrade1) * Trucks1^2\n// Operational cost for route 2: Cost2 = (120 + 0.12 * Upgrade2) * Trucks2^2\n// Operational cost for route 3: Cost3 = (110 + 0.11 * Upgrade3) * Trucks3^2\n// Operational cost for route 4: Cost4 = (90 + 0.09 * Upgrade4) * Trucks4^2\n// Operational cost for route 5: Cost5 = (130 + 0.13 * Upgrade5) * Trucks5^2\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000",
        "question": "A logistics company operates 5 different routes for cargo transportation. The company needs to determine the number of trucks to allocate to each route and the fuel efficiency upgrades to invest in for each route to minimize operational costs while meeting delivery demands. The operational cost of each route is influenced by the number of trucks and the level of fuel efficiency upgrades, where the cost per kilometer decreases nonlinearly with the investment in fuel efficiency upgrades. The company aims to minimize the total operational cost across all routes.\n\n| Route | Operational Cost Formula |\n|-------|--------------------------|\n| 1     | (100 + 0.1 * Upgrade1) * Trucks1^2 |\n| 2     | (120 + 0.12 * Upgrade2) * Trucks2^2 |\n| 3     | (110 + 0.11 * Upgrade3) * Trucks3^2 |\n| 4     | (90 + 0.09 * Upgrade4) * Trucks4^2 |\n| 5     | (130 + 0.13 * Upgrade5) * Trucks5^2 |\n\nThe company has a total budget of $100,000 for fuel efficiency upgrades across all routes.\n\nPlease help the company to determine the optimal number of trucks and fuel efficiency upgrades for each route to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)\n\n# Define objective function\nCost1 = (100 + 0.1 * Upgrade1) * Trucks1**2\nCost2 = (120 + 0.12 * Upgrade2) * Trucks2**2\nCost3 = (110 + 0.11 * Upgrade3) * Trucks3**2\nCost4 = (90 + 0.09 * Upgrade4) * Trucks4**2\nCost5 = (130 + 0.13 * Upgrade5) * Trucks5**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Route 1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route 2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route 3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Route 4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Route 5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company aims to maximize the total profit from selling all products.\n// Profit_A = 50 * A\n// Profit_B = 70 * B - 0.5 * A * B (cost of A used in B)\n// Profit_C = 90 * C - 0.3 * A * C (cost of A used in C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production of each unit of product B and C requires a certain amount of product A as a component. Specifically, producing one unit of product B requires 0.5 units of product A, and producing one unit of product C requires 0.3 units of product A. The company aims to maximize the total profit from selling all products.\n\n| Product | Profit per Unit | Additional Component Requirement (from Product A) |\n|---------|-----------------|--------------------------------------------------|\n| A       | $50             | -                                                |\n| B       | $70             | 0.5 units of A                                   |\n| C       | $90             | 0.3 units of A                                   |\n\nThe company has a total production capacity of 1000 units per month. Please help the company determine the optimal number of units to produce for each product to maximize profit while considering the production capacity constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B - 0.5 * A * B\nProfit_C = 90 * C - 0.3 * A * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1338,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 646,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionX, RegionY, and RegionZ. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in RegionX\": \"SolarX\", \"range\": \"SolarX >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionX\": \"WindX\", \"range\": \"WindX >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionX\": \"StorageX\", \"range\": \"StorageX >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionY\": \"SolarY\", \"range\": \"SolarY >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionY\": \"WindY\", \"range\": \"WindY >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionY\": \"StorageY\", \"range\": \"StorageY >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionZ\": \"SolarZ\", \"range\": \"SolarZ >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionZ\": \"WindZ\", \"range\": \"WindZ >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionZ\": \"StorageZ\", \"range\": \"StorageZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Energy output from solar panels in RegionX: Energy_SolarX = 1000 * SolarX * (1 + 0.01 * StorageX)^2\n// Energy output from wind turbines in RegionX: Energy_WindX = 2000 * WindX * (1 + 0.02 * StorageX)^3\n// Energy output from solar panels in RegionY: Energy_SolarY = 1200 * SolarY * (1 + 0.01 * StorageY)^2\n// Energy output from wind turbines in RegionY: Energy_WindY = 2200 * WindY * (1 + 0.02 * StorageY)^3\n// Energy output from solar panels in RegionZ: Energy_SolarZ = 1500 * SolarZ * (1 + 0.01 * StorageZ)^2\n// Energy output from wind turbines in RegionZ: Energy_WindZ = 2500 * WindZ * (1 + 0.02 * StorageZ)^3\n// So, the objective function is: Maximize (Energy_SolarX + Energy_WindX + Energy_SolarY + Energy_WindY + Energy_SolarZ + Energy_WindZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for installation and storage investments in all regions.\n// 10000 * SolarX + 20000 * WindX + StorageX + 10000 * SolarY + 20000 * WindY + StorageY + 10000 * SolarZ + 20000 * WindZ + StorageZ <= 1,000,000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines that can be installed across all regions is limited to 500.\n// SolarX + WindX + SolarY + WindY + SolarZ + WindZ <= 500\n\n## Generate Constraint-3:\nDue to regional regulations, the investment in energy storage in each region must not exceed $100,000.\n// StorageX <= 100,000; StorageY <= 100,000; StorageZ <= 100,000\n\n## Generate Constraint-4:\nThe company must install at least 50 solar panels and 20 wind turbines in each region.\n// SolarX >= 50; WindX >= 20; SolarY >= 50; WindY >= 20; SolarZ >= 50; WindZ >= 20",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionX, RegionY, and RegionZ. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\nThe energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\nThe company has a total budget of $1,000,000 for installation and storage investments in all regions. The total number of solar panels and wind turbines that can be installed across all regions is limited to 500. Due to regional regulations, the investment in energy storage in each region must not exceed $100,000. The company must install at least 50 solar panels and 20 wind turbines in each region.\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarX = model.addVar(vtype=\"INTEGER\", name=\"SolarX\", lb=50)  # number of solar panels in RegionX\nWindX = model.addVar(vtype=\"INTEGER\", name=\"WindX\", lb=20)    # number of wind turbines in RegionX\nStorageX = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageX\", lb=0)  # investment in energy storage in RegionX\nSolarY = model.addVar(vtype=\"INTEGER\", name=\"SolarY\", lb=50)  # number of solar panels in RegionY\nWindY = model.addVar(vtype=\"INTEGER\", name=\"WindY\", lb=20)    # number of wind turbines in RegionY\nStorageY = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageY\", lb=0)  # investment in energy storage in RegionY\nSolarZ = model.addVar(vtype=\"INTEGER\", name=\"SolarZ\", lb=50)  # number of solar panels in RegionZ\nWindZ = model.addVar(vtype=\"INTEGER\", name=\"WindZ\", lb=20)    # number of wind turbines in RegionZ\nStorageZ = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageZ\", lb=0)  # investment in energy storage in RegionZ\n\n# Define objective function\n# Energy output from solar panels and wind turbines is affected by the investment in energy storage systems.\n# The energy output from solar panels is modeled as a quadratic function of the storage investment,\n# and the energy output from wind turbines is modeled as a cubic function of the storage investment.\n# The company aims to maximize the total energy output from all regions.\nEnergy_SolarX = 1000 * SolarX * (1 + 0.01 * StorageX)**2\nEnergy_WindX = 2000 * WindX * (1 + 0.02 * StorageX)**3\nEnergy_SolarY = 1200 * SolarY * (1 + 0.01 * StorageY)**2\nEnergy_WindY = 2200 * WindY * (1 + 0.02 * StorageY)**3\nEnergy_SolarZ = 1500 * SolarZ * (1 + 0.01 * StorageZ)**2\nEnergy_WindZ = 2500 * WindZ * (1 + 0.02 * StorageZ)**3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_SolarX + Energy_WindX + Energy_SolarY + Energy_WindY + Energy_SolarZ + Energy_WindZ)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for installation and storage investments in all regions.\nmodel.addCons(10000 * SolarX + 20000 * WindX + StorageX + 10000 * SolarY + 20000 * WindY + StorageY + 10000 * SolarZ + 20000 * WindZ + StorageZ <= 1000000)\n# The total number of solar panels and wind turbines that can be installed across all regions is limited to 500.\nmodel.addCons(SolarX + WindX + SolarY + WindY + SolarZ + WindZ <= 500)\n# Due to regional regulations, the investment in energy storage in each region must not exceed $100,000.\nmodel.addCons(StorageX <= 100000)\nmodel.addCons(StorageY <= 100000)\nmodel.addCons(StorageZ <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionX: \", model.getVal(SolarX))\n    print(\"Number of Wind Turbines in RegionX: \", model.getVal(WindX))\n    print(\"Investment in Energy Storage in RegionX: \", model.getVal(StorageX))\n    print(\"Number of Solar Panels in RegionY: \", model.getVal(SolarY))\n    print(\"Number of Wind Turbines in RegionY: \", model.getVal(WindY))\n    print(\"Investment in Energy Storage in RegionY: \", model.getVal(StorageY))\n    print(\"Number of Solar Panels in RegionZ: \", model.getVal(SolarZ))\n    print(\"Number of Wind Turbines in RegionZ: \", model.getVal(WindZ))\n    print(\"Investment in Energy Storage in RegionZ: \", model.getVal(StorageZ))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment in energy storage systems for each region. The energy storage system investment will affect the efficiency of energy collection and distribution.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionA\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionB\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in RegionC\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of energy collection increases with the investment in energy storage systems. For every $100,000 invested in storage, the efficiency of energy collection increases by 1%. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The revenue generated per unit of energy collected is $100 for solar and $150 for wind. The company aims to maximize the total revenue from all regions.\n// Revenue_RegionA = (0.20 + 0.0001 * StorageA) * SolarA * 100 + (0.30 + 0.0001 * StorageA) * WindA * 150\n// Revenue_RegionB = (0.20 + 0.0001 * StorageB) * SolarB * 100 + (0.30 + 0.0001 * StorageB) * WindB * 150\n// Revenue_RegionC = (0.20 + 0.0001 * StorageC) * SolarC * 100 + (0.30 + 0.0001 * StorageC) * WindC * 150\n// So, the objective function is: Maximize (Revenue_RegionA + Revenue_RegionB + Revenue_RegionC)\n\n## Generate Constraint-1:\nThe total investment in energy storage systems across all regions cannot exceed $300,000.\n// StorageA + StorageB + StorageC <= 300000\n\n## Generate Constraint-2:\nThe company has a limited budget for installing renewable energy infrastructure. The cost of installing one solar panel is $500 and one wind turbine is $1000. The total installation cost across all regions must not exceed $500,000.\n// 500 * (SolarA + SolarB + SolarC) + 1000 * (WindA + WindB + WindC) <= 500000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment in energy storage systems for each region. The energy storage system investment will affect the efficiency of energy collection and distribution. The efficiency of energy collection increases with the investment in energy storage systems. For every $100,000 invested in storage, the efficiency of energy collection increases by 1%. The initial efficiency of solar panels is 20% and of wind turbines is 30%. The revenue generated per unit of energy collected is $100 for solar and $150 for wind. The company aims to maximize the total revenue from all regions. The total investment in energy storage systems across all regions cannot exceed $300,000. The company has a limited budget for installing renewable energy infrastructure. The cost of installing one solar panel is $500 and one wind turbine is $1000. The total installation cost across all regions must not exceed $500,000.\n\nPlease help the company to maximize the total revenue from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in RegionA\nStorageA = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageA\", lb=0) # investment in energy storage in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in RegionB\nStorageB = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageB\", lb=0) # investment in energy storage in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in RegionC\nStorageC = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageC\", lb=0) # investment in energy storage in RegionC\n\n# Define objective function\nRevenue_RegionA = (0.20 + 0.0001 * StorageA) * SolarA * 100 + (0.30 + 0.0001 * StorageA) * WindA * 150\nRevenue_RegionB = (0.20 + 0.0001 * StorageB) * SolarB * 100 + (0.30 + 0.0001 * StorageB) * WindB * 150\nRevenue_RegionC = (0.20 + 0.0001 * StorageC) * SolarC * 100 + (0.30 + 0.0001 * StorageC) * WindC * 150\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_RegionA + Revenue_RegionB + Revenue_RegionC)\n\n# Add constraints\n# The total investment in energy storage systems across all regions cannot exceed $300,000.\nmodel.addCons(StorageA + StorageB + StorageC <= 300000)\n# The company has a limited budget for installing renewable energy infrastructure.\nmodel.addCons(500 * (SolarA + SolarB + SolarC) + 1000 * (WindA + WindB + WindC) <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Investment in Storage in RegionA: \", model.getVal(StorageA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Investment in Storage in RegionB: \", model.getVal(StorageB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in Storage in RegionC: \", model.getVal(StorageC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency.\n// {\"speed setting for machine 1\": \"S1\", \"range\": \"0 < S1 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 2\": \"S2\", \"range\": \"0 < S2 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 3\": \"S3\", \"range\": \"0 < S3 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 4\": \"S4\", \"range\": \"0 < S4 < 100\", \"type\": \"real\"}\n// {\"speed setting for machine 5\": \"S5\", \"range\": \"0 < S5 < 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine's production rate is a nonlinear function of its speed setting. The production rate of each machine is given by the following functions:\n- Machine 1: P1 = 100 * S1 - 0.5 * S1^2\n- Machine 2: P2 = 120 * S2 - 0.6 * S2^2\n- Machine 3: P3 = 110 * S3 - 0.55 * S3^2\n- Machine 4: P4 = 90 * S4 - 0.45 * S4^2\n- Machine 5: P5 = 80 * S5 - 0.4 * S5^2\nThe objective is to maximize the total production rate of all machines.\n// Objective function: Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * S1 - 0.5 * S1^2) + (120 * S2 - 0.6 * S2^2) + (110 * S3 - 0.55 * S3^2) + (90 * S4 - 0.45 * S4^2) + (80 * S5 - 0.4 * S5^2)\n\n## Generate Constraint-1:\nThe total energy consumption of all machines must not exceed 1000 units.\n// 10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000\n\n## Generate Constraint-2:\nThe speed setting of each machine must be within its operational limits.\n// 0 < S1 < 100; 0 < S2 < 100; 0 < S3 < 100; 0 < S4 < 100; 0 < S5 < 100",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the optimal settings for each machine to maximize production efficiency. The production rate of each machine is a nonlinear function of its speed setting, as shown in the following Table.\n\n| Machine | Production Rate Function |\n|---------|--------------------------|\n| 1       | P1 = 100 * S1 - 0.5 * S1^2 |\n| 2       | P2 = 120 * S2 - 0.6 * S2^2 |\n| 3       | P3 = 110 * S3 - 0.55 * S3^2 |\n| 4       | P4 = 90 * S4 - 0.45 * S4^2 |\n| 5       | P5 = 80 * S5 - 0.4 * S5^2 |\n\nThe objective is to maximize the total production rate of all machines. The total energy consumption of all machines must not exceed 1000 units. The speed setting of each machine must be within its operational limits (0 < S1 < 100; 0 < S2 < 100; 0 < S3 < 100; 0 < S4 < 100; 0 < S5 < 100).\n\nPlease help the manager to determine the optimal speed settings for each machine to maximize the total production rate while satisfying the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The speed setting of each machine must be within its operational limits.\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=100) # speed setting for machine 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=0, ub=100) # speed setting for machine 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=0, ub=100) # speed setting for machine 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=0, ub=100) # speed setting for machine 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=0, ub=100) # speed setting for machine 5\n\n# Define objective function\n## Each machine's production rate is a nonlinear function of its speed setting.\nP1 = 100 * S1 - 0.5 * S1**2\nP2 = 120 * S2 - 0.6 * S2**2\nP3 = 110 * S3 - 0.55 * S3**2\nP4 = 90 * S4 - 0.45 * S4**2\nP5 = 80 * S5 - 0.4 * S5**2\n## The objective is to maximize the total production rate of all machines.\n## Objective function: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n## The total energy consumption of all machines must not exceed 1000 units.\nmodel.addCons(10 * S1 + 12 * S2 + 11 * S3 + 9 * S4 + 8 * S5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed Setting for Machine 1: \", model.getVal(S1))\n    print(\"Speed Setting for Machine 2: \", model.getVal(S2))\n    print(\"Speed Setting for Machine 3: \", model.getVal(S3))\n    print(\"Speed Setting for Machine 4: \", model.getVal(S4))\n    print(\"Speed Setting for Machine 5: \", model.getVal(S5))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region: North, South, East, West, and Central.\n// {\"number of trucks in North region\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck generates revenue based on the distance traveled and the load capacity. The revenue function is nonlinear due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions.\n// Revenue in North: R_N = 0.05 * N^2\n// Revenue in South: R_S = 0.06 * S^2\n// Revenue in East: R_E = 0.07 * E^2\n// Revenue in West: R_W = 0.08 * W^2\n// Revenue in Central: R_C = 0.09 * C^2\n// So, the objective function is: Maximize (R_N + R_S + R_E + R_W + R_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck maintenance and fuel costs.\n// 1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each region.\n// N >= 5; S >= 5; E >= 5; W >= 5; C >= 5\n\n## Generate Constraint-3:\nThe total number of trucks cannot exceed 100.\n// N + S + E + W + C <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region. Each truck generates revenue based on the distance traveled and the load capacity, with the revenue function being nonlinear due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions.\n\n| Region    | Revenue Function       |\n|-----------|------------------------|\n| North     | R_N = 0.05 * N^2      |\n| South     | R_S = 0.06 * S^2      |\n| East      | R_E = 0.07 * E^2      |\n| West      | R_W = 0.08 * W^2      |\n| Central   | R_C = 0.09 * C^2      |\n\nThe company has a total budget of $500,000 for truck maintenance and fuel costs. The company must allocate at least 5 trucks to each region. The total number of trucks cannot exceed 100.\n\nPlease help the company to maximize the total revenue from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=5)  # number of trucks in North region\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5)  # number of trucks in South region\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5)  # number of trucks in East region\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=5)  # number of trucks in West region\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5)  # number of trucks in Central region\n\n# Define objective function\nR_N = 0.05 * N**2\nR_S = 0.06 * S**2\nR_E = 0.07 * E**2\nR_W = 0.08 * W**2\nR_C = 0.09 * C**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_N + R_S + R_E + R_W + R_C)\n\n# Add constraints\nmodel.addCons(1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000)\nmodel.addCons(N + S + E + W + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks in North region: \", model.getVal(N))\n    print(\"Number of trucks in South region: \", model.getVal(S))\n    print(\"Number of trucks in East region: \", model.getVal(E))\n    print(\"Number of trucks in West region: \", model.getVal(W))\n    print(\"Number of trucks in Central region: \", model.getVal(C))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines that produce widgets. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"H4\", \"range\": \"H4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"H5\", \"range\": \"H5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine 1 produces 10 widgets per hour at a cost of $5 per hour, Machine 2 produces 15 widgets per hour at a cost of $7 per hour, Machine 3 produces 20 widgets per hour at a cost of $9 per hour, Machine 4 produces 25 widgets per hour at a cost of $11 per hour, and Machine 5 produces 30 widgets per hour at a cost of $13 per hour. The company wants to maximize the total number of widgets produced while keeping the total cost under $1000.\n// The total number of widgets produced: W = 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5\n// The total cost: C = 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5\n// The objective function is: Maximize W - C\n// Maximize (10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5) - (5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5)\n\n## Generate Constraint-1:\nThe total cost must not exceed $1000.\n// 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5 <= 1000\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 40 hours.\n// H1 <= 40; H2 <= 40; H3 <= 40; H4 <= 40; H5 <= 40\n\n## Generate Constraint-3:\nThe company requires at least 1000 widgets to be produced.\n// 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5 >= 1000",
        "question": "A manufacturing company has 5 different machines that produce widgets. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Widgets Produced per Hour | Cost per Hour |\n|---------|---------------------------|---------------|\n| 1       | 10                        | $5            |\n| 2       | 15                        | $7            |\n| 3       | 20                        | $9            |\n| 4       | 25                        | $11           |\n| 5       | 30                        | $13           |\n\nThe company wants to maximize the total number of widgets produced while keeping the total cost under $1000. Each machine can operate for a maximum of 40 hours. The company requires at least 1000 widgets to be produced.\nPlease help the company to maximize the total number of widgets produced while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours machine 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours machine 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours machine 3 operates\nH4 = model.addVar(vtype=\"CONTINUOUS\", name=\"H4\", lb=0) # hours machine 4 operates\nH5 = model.addVar(vtype=\"CONTINUOUS\", name=\"H5\", lb=0) # hours machine 5 operates\n\n# Define objective function\nW = 10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5 # total number of widgets produced\nC = 5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5 # total cost\n# The objective function is: Maximize W - C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == W - C)\n\n# Add constraints\n# The total cost must not exceed $1000.\nmodel.addCons(5 * H1 + 7 * H2 + 9 * H3 + 11 * H4 + 13 * H5 <= 1000)\n# Each machine can operate for a maximum of 40 hours.\nmodel.addCons(H1 <= 40)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 40)\nmodel.addCons(H4 <= 40)\nmodel.addCons(H5 <= 40)\n# The company requires at least 1000 widgets to be produced.\nmodel.addCons(10 * H1 + 15 * H2 + 20 * H3 + 25 * H4 + 30 * H5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(H1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(H2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(H3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(H4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(H5))\n    print(\"Maximized Total Widgets Produced: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Refrigerated trucks\": \"MaintenanceRefrigerated\", \"range\": \"MaintenanceRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Heavy trucks\": \"MaintenanceHeavy\", \"range\": \"MaintenanceHeavy >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Standard trucks\": \"MaintenanceStandard\", \"range\": \"MaintenanceStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Refrigerated trucks: CostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\n// Total operational cost for Heavy trucks: CostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\n// Total operational cost for Standard trucks: CostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n// So, the objective function is: Minimize (CostRefrigerated + CostHeavy + CostStandard)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and maintenance.\n// 1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 200.\n// RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy, and Standard. Additionally, they need to determine the level of maintenance to be performed on each type of truck, which affects the operational cost and efficiency of the trucks. The operational cost of each type of truck decreases with increased maintenance. For Refrigerated trucks, the operational cost is $1000 per truck per month, but it decreases by $100 for every $500 spent on maintenance. For Heavy trucks, the operational cost is $1500 per truck per month, decreasing by $150 for every $500 spent on maintenance. For Standard trucks, the operational cost is $800 per truck per month, decreasing by $80 for every $500 spent on maintenance. The company aims to minimize the total operational cost of the fleet. The company has a budget of $200,000 for purchasing trucks and maintenance. The total number of trucks in the fleet must not exceed 200. Please help the company to minimize the total operational cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nMaintenanceRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceRefrigerated\", lb=0)\nMaintenanceHeavy = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHeavy\", lb=0)\nMaintenanceStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceStandard\", lb=0)\n\n# Define objective function\nCostRefrigerated = 1000 * RefrigeratedTrucks - 0.2 * MaintenanceRefrigerated * RefrigeratedTrucks\nCostHeavy = 1500 * HeavyTrucks - 0.3 * MaintenanceHeavy * HeavyTrucks\nCostStandard = 800 * StandardTrucks - 0.16 * MaintenanceStandard * StandardTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostRefrigerated + CostHeavy + CostStandard)\n\n# Add constraints\nmodel.addCons(1000 * RefrigeratedTrucks + 1500 * HeavyTrucks + 800 * StandardTrucks + 500 * MaintenanceRefrigerated + 500 * MaintenanceHeavy + 500 * MaintenanceStandard <= 200000)\nmodel.addCons(RefrigeratedTrucks + HeavyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Maintenance Level for Refrigerated Trucks: \", model.getVal(MaintenanceRefrigerated))\n    print(\"Maintenance Level for Heavy Trucks: \", model.getVal(MaintenanceHeavy))\n    print(\"Maintenance Level for Standard Trucks: \", model.getVal(MaintenanceStandard))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Profit_A = (20 - 10) * A\n// Profit_B = (30 - 20) * B\n// Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 50 units, and for device B is at least 40 units.\n// A >= 50; B >= 40\n\n## Generate Constraint-3:\nThe company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit.\n// 5 * A + 10 * B + 15 * C <= 15000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\n// C <= A + B\n\n## Generate Constraint-5:\nThe company has a constraint on the total number of devices produced, which should not exceed 300 units.\n// A + B + C <= 300",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit of device A is $20, device B is $30, and device C is $40. The production cost per unit of device A is $10, device B is $20, and device C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\nThe company has a total production capacity of 1000 hours, and the production time for device A is 2 hours, device B is 3 hours, and device C is 4 hours. The market demand for device A is at least 50 units, and for device B is at least 40 units. The company has a budget of $15000 for raw materials, and the cost of raw materials for device A is $5 per unit, device B is $10 per unit, and device C is $15 per unit. The company wants to ensure that the production of device C does not exceed the combined production of devices A and B. Additionally, the company has a constraint on the total number of devices produced, which should not exceed 300 units.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n# The market demand for device A is at least 50 units, and for device B is at least 40 units.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 40)\n# The company has a budget of $15000 for raw materials\nmodel.addCons(5 * A + 10 * B + 15 * C <= 15000)\n# The company wants to ensure that the production of device C does not exceed the combined production of devices A and B.\nmodel.addCons(C <= A + B)\n# The company has a constraint on the total number of devices produced, which should not exceed 300 units.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1288,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has different operational costs and revenue generation capabilities. \nFor Truck A, the operational cost per mile is $2, and it generates $5 per mile.\nFor Truck B, the operational cost per mile is $3, and it generates $6 per mile.\nFor Truck C, the operational cost per mile is $4, and it generates $7 per mile.\nFor Truck D, the operational cost per mile is $5, and it generates $8 per mile.\nFor Truck E, the operational cost per mile is $6, and it generates $9 per mile.\nThe company aims to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).\n// Net profit per mile of A: Profit_A = (5 - 2) * A\n// Net profit per mile of B: Profit_B = (6 - 3) * B\n// Net profit per mile of C: Profit_C = (7 - 4) * C\n// Net profit per mile of D: Profit_D = (8 - 5) * D\n// Net profit per mile of E: Profit_E = (9 - 6) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs for the month.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to deploy at least 5 trucks of each type for the month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks that can be deployed in total.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B.\n// D <= A + B",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month. The operational cost per mile and revenue generation per mile for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Mile | Revenue per Mile |\n|------------|--------------------------|------------------|\n| A          | $2                       | $5               |\n| B          | $3                       | $6               |\n| C          | $4                       | $7               |\n| D          | $5                       | $8               |\n| E          | $6                       | $9               |\n\nThe company has a budget of $10,000 for operational costs for the month. The company wants to deploy at least 5 trucks of each type for the month. The company has a limit of 100 trucks that can be deployed in total. The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B. \nPlease help the company to maximize the net profit per mile across all trucks (which is defined as the sum of the revenue per mile minus the sum of the operational costs per mile).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to deploy at least 5 trucks of each type for the month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 - 2) * A\nProfit_B = (6 - 3) * B\nProfit_C = (7 - 4) * C\nProfit_D = (8 - 5) * D\nProfit_E = (9 - 6) * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs for the month.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 10000)\n## The company has a limit of 100 trucks that can be deployed in total.\nmodel.addCons(A + B + C + D + E <= 100)\n## The company wants to ensure that the total number of Truck D does not exceed the combined number of Trucks A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Net Profit per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"investment in engine upgrades for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in engine upgrades for Route5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\n// Fuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\n// Fuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\n// Fuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\n// Fuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for engine upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routing and scheduling of these trucks to minimize fuel consumption and operational costs. The company has five major routes: Route1, Route2, Route3, Route4, and Route5. Each route has a different distance and traffic condition, affecting the fuel efficiency of the trucks. Additionally, the company can invest in upgrading the trucks' engines to improve fuel efficiency.\nThe fuel consumption per truck on each route is affected by the route's distance and traffic conditions. Investing in engine upgrades reduces the fuel consumption per truck by a certain percentage. The company aims to minimize the total fuel consumption across all routes.\nThe company has a budget of $100,000 for engine upgrades and operational costs. The total number of trucks available for all routes is limited to 50.\nPlease help the company determine the optimal number of trucks to allocate to each route and the amount to invest in engine upgrades for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks on Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks on Route3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0) # number of trucks on Route4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0) # number of trucks on Route5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0) # investment in engine upgrades for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0) # investment in engine upgrades for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0) # investment in engine upgrades for Route3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0) # investment in engine upgrades for Route4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0) # investment in engine upgrades for Route5\n\n# Define objective function\nFuel_consumption_Route1 = (100 - 0.1 * Upgrade1) * Trucks1\nFuel_consumption_Route2 = (120 - 0.12 * Upgrade2) * Trucks2\nFuel_consumption_Route3 = (110 - 0.11 * Upgrade3) * Trucks3\nFuel_consumption_Route4 = (90 - 0.09 * Upgrade4) * Trucks4\nFuel_consumption_Route5 = (130 - 0.13 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_consumption_Route1 + Fuel_consumption_Route2 + Fuel_consumption_Route3 + Fuel_consumption_Route4 + Fuel_consumption_Route5)\n\n# Add constraints\n# The company has a budget of $100,000 for engine upgrades and operational costs.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trucks1 + 120 * Trucks2 + 110 * Trucks3 + 90 * Trucks4 + 130 * Trucks5) <= 100000)\n# The total number of trucks available for all routes is limited to 50.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks on Route3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks on Route4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks on Route5: \", model.getVal(Trucks5))\n    print(\"Investment in Engine Upgrades for Route1: \", model.getVal(Upgrade1))\n    print(\"Investment in Engine Upgrades for Route2: \", model.getVal(Upgrade2))\n    print(\"Investment in Engine Upgrades for Route3: \", model.getVal(Upgrade3))\n    print(\"Investment in Engine Upgrades for Route4: \", model.getVal(Upgrade4))\n    print(\"Investment in Engine Upgrades for Route5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company wants to maximize the net profit, which is the total revenue minus the total fuel cost.\n// Total revenue: Revenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Total fuel cost: FuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n// So, the objective function is: Maximize (Revenue - FuelCost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing trucks.\n// 10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 T1 trucks.\n// T1 >= 10\n\n## Generate Constraint-4:\nThe number of T5 trucks cannot exceed 10.\n// T5 <= 10",
        "question": "A logistics company is planning its fleet usage for the next quarter. They have five types of trucks (T1, T2, T3, T4, T5) with different capacities and fuel efficiencies. The company needs to decide how many of each type of truck to use for maximizing their profit while considering operational costs and revenue from deliveries.\nEach T1 truck generates a revenue of $500 per trip and consumes $100 worth of fuel.\nEach T2 truck generates a revenue of $600 per trip and consumes $120 worth of fuel.\nEach T3 truck generates a revenue of $700 per trip and consumes $140 worth of fuel.\nEach T4 truck generates a revenue of $800 per trip and consumes $160 worth of fuel.\nEach T5 truck generates a revenue of $900 per trip and consumes $180 worth of fuel.\nThe company has a budget of $50,000 for purchasing trucks. The total number of trucks cannot exceed 50. The company must have at least 10 T1 trucks. The number of T5 trucks cannot exceed 10.\nPlease help the company to maximize the net profit, which is the total revenue minus the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=10) # number of T5 trucks\n\n# Define objective function\nRevenue = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nFuelCost = 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5\n# So, the objective function is: Maximize (Revenue - FuelCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - FuelCost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 14000 * T3 + 16000 * T4 + 18000 * T5 <= 50000)\n# The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 trucks: \", model.getVal(T1))\n    print(\"Number of T2 trucks: \", model.getVal(T2))\n    print(\"Number of T3 trucks: \", model.getVal(T3))\n    print(\"Number of T4 trucks: \", model.getVal(T4))\n    print(\"Number of T5 trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1046,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel efficiency upgrades for each truck, which will affect the fuel consumption and thus the overall cost of the routes.\n// {\"number of trips to destination A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips to destination E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for trips to destination A\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination B\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination C\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination D\": \"UpgradeD\", \"range\": \"UpgradeD >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for trips to destination E\": \"UpgradeE\", \"range\": \"UpgradeE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of each trip is affected by the fuel consumption, which is inversely proportional to the amount of fuel efficiency upgrade. The base fuel cost per trip to destination A is $100, and for each $100 spent on upgrades, the cost decreases by $5. The same pattern applies to destinations B, C, D, and E with base costs of $120, $110, $130, and $140 respectively, and upgrade effects of $6, $7, $8, and $9 per $100 spent. The company aims to minimize the total cost of all trips.\n// Total cost for trips to destination A: CostA = (100 - 0.05 * UpgradeA) * TripsA\n// Total cost for trips to destination B: CostB = (120 - 0.06 * UpgradeB) * TripsB\n// Total cost for trips to destination C: CostC = (110 - 0.07 * UpgradeC) * TripsC\n// Total cost for trips to destination D: CostD = (130 - 0.08 * UpgradeD) * TripsD\n// Total cost for trips to destination E: CostE = (140 - 0.09 * UpgradeE) * TripsE\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel efficiency upgrades.\n// UpgradeA + UpgradeB + UpgradeC + UpgradeD + UpgradeE <= 10000\n\n## Generate Constraint-2:\nThe total number of trips across all destinations must not exceed 500.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to destination A and 70 trips to destination B.\n// TripsA >= 50; TripsB >= 70",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel efficiency upgrades for each truck, which will affect the fuel consumption and thus the overall cost of the routes. The base fuel cost per trip and the effect of upgrades on the cost for each destination are given in the following Table.\n\n| Destination | Base Fuel Cost per Trip | Effect of $100 Upgrade on Cost |\n|-------------|-------------------------|--------------------------------|\n| A           | $100                    | $5                             |\n| B           | $120                    | $6                             |\n| C           | $110                    | $7                             |\n| D           | $130                    | $8                             |\n| E           | $140                    | $9                             |\n\nThe company has a budget of $10,000 for fuel efficiency upgrades. The total number of trips across all destinations must not exceed 500. Due to contractual obligations, the company must make at least 50 trips to destination A and 70 trips to destination B. \n\nPlease help the company to minimize the total cost of all trips by determining the optimal number of trips to each destination and the appropriate fuel efficiency upgrades.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=50)  # number of trips to destination A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=70)  # number of trips to destination B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)    # number of trips to destination C\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0)    # number of trips to destination D\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0)    # number of trips to destination E\n\nUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeA\", lb=0)  # fuel efficiency upgrade for trips to destination A\nUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeB\", lb=0)  # fuel efficiency upgrade for trips to destination B\nUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeC\", lb=0)  # fuel efficiency upgrade for trips to destination C\nUpgradeD = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeD\", lb=0)  # fuel efficiency upgrade for trips to destination D\nUpgradeE = model.addVar(vtype=\"CONTINUOUS\", name=\"UpgradeE\", lb=0)  # fuel efficiency upgrade for trips to destination E\n\n# Define objective function\nCostA = (100 - 0.05 * UpgradeA) * TripsA\nCostB = (120 - 0.06 * UpgradeB) * TripsB\nCostC = (110 - 0.07 * UpgradeC) * TripsC\nCostD = (130 - 0.08 * UpgradeD) * TripsD\nCostE = (140 - 0.09 * UpgradeE) * TripsE\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\nmodel.addCons(UpgradeA + UpgradeB + UpgradeC + UpgradeD + UpgradeE <= 10000)\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Destination A: \", model.getVal(TripsA))\n    print(\"Number of Trips to Destination B: \", model.getVal(TripsB))\n    print(\"Number of Trips to Destination C: \", model.getVal(TripsC))\n    print(\"Number of Trips to Destination D: \", model.getVal(TripsD))\n    print(\"Number of Trips to Destination E: \", model.getVal(TripsE))\n    print(\"Upgrade for Destination A: \", model.getVal(UpgradeA))\n    print(\"Upgrade for Destination B: \", model.getVal(UpgradeB))\n    print(\"Upgrade for Destination C: \", model.getVal(UpgradeC))\n    print(\"Upgrade for Destination D: \", model.getVal(UpgradeD))\n    print(\"Upgrade for Destination E: \", model.getVal(UpgradeE))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1373,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 6 different types of electronic devices. The company needs to determine the optimal number of each device to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of device 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of device 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of device 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of device 4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of device 5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n// {\"number of device 6\": \"D6\", \"range\": \"D6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is determined by a nonlinear function of the number produced, considering both production costs and market saturation. The profit function for each device is given by:\n// Profit for device 1: P1 = 100 * D1 - 0.5 * D1^2\n// Profit for device 2: P2 = 120 * D2 - 0.6 * D2^2\n// Profit for device 3: P3 = 110 * D3 - 0.55 * D3^2\n// Profit for device 4: P4 = 90 * D4 - 0.45 * D4^2\n// Profit for device 5: P5 = 80 * D5 - 0.4 * D5^2\n// Profit for device 6: P6 = 70 * D6 - 0.35 * D6^2\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5 + P6\n// Maximize P = 100 * D1 - 0.5 * D1^2 + 120 * D2 - 0.6 * D2^2 + 110 * D3 - 0.55 * D3^2 + 90 * D4 - 0.45 * D4^2 + 80 * D5 - 0.4 * D5^2 + 70 * D6 - 0.35 * D6^2\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// D1 + D2 + D3 + D4 + D5 + D6 <= 1000\n\n## Generate Constraint-2:\nThe market demand for each device is limited, with a maximum demand of 200 units for each device.\n// D1 <= 200; D2 <= 200; D3 <= 200; D4 <= 200; D5 <= 200; D6 <= 200\n\n## Generate Constraint-3:\nThe production of device 1 and device 2 must be at least 10% of the total production.\n// D1 + D2 >= 0.1 * (D1 + D2 + D3 + D4 + D5 + D6)",
        "question": "A manufacturer produces 6 different types of electronic devices. The company needs to determine the optimal number of each device to produce to maximize profit while considering the cost of production and market demand. The profit from each device is determined by a nonlinear function of the number produced, considering both production costs and market saturation. The profit function for each device is given by:\n- Profit for device 1: P1 = 100 * D1 - 0.5 * D1^2\n- Profit for device 2: P2 = 120 * D2 - 0.6 * D2^2\n- Profit for device 3: P3 = 110 * D3 - 0.55 * D3^2\n- Profit for device 4: P4 = 90 * D4 - 0.45 * D4^2\n- Profit for device 5: P5 = 80 * D5 - 0.4 * D5^2\n- Profit for device 6: P6 = 70 * D6 - 0.35 * D6^2\nThe objective function is to maximize the total profit P = P1 + P2 + P3 + P4 + P5 + P6.\nThe total production capacity is limited to 1000 units across all devices. The market demand for each device is limited, with a maximum demand of 200 units for each device. The production of device 1 and device 2 must be at least 10% of the total production.\nPlease help the company to determine the optimal number of each device to produce to maximize profit while satisfying these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=200)  # number of device 1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0, ub=200)  # number of device 2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0, ub=200)  # number of device 3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0, ub=200)  # number of device 4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0, ub=200)  # number of device 5\nD6 = model.addVar(vtype=\"INTEGER\", name=\"D6\", lb=0, ub=200)  # number of device 6\n\n# Define objective function\n# Profit for device 1: P1 = 100 * D1 - 0.5 * D1^2\n# Profit for device 2: P2 = 120 * D2 - 0.6 * D2^2\n# Profit for device 3: P3 = 110 * D3 - 0.55 * D3^2\n# Profit for device 4: P4 = 90 * D4 - 0.45 * D4^2\n# Profit for device 5: P5 = 80 * D5 - 0.4 * D5^2\n# Profit for device 6: P6 = 70 * D6 - 0.35 * D6^2\nP1 = 100 * D1 - 0.5 * D1**2\nP2 = 120 * D2 - 0.6 * D2**2\nP3 = 110 * D3 - 0.55 * D3**2\nP4 = 90 * D4 - 0.45 * D4**2\nP5 = 80 * D5 - 0.4 * D5**2\nP6 = 70 * D6 - 0.35 * D6**2\n\n# The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5 + P6\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5 + P6)\n\n# Add constraints\n# The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 + D6 <= 1000)\n\n# The market demand for each device is limited, with a maximum demand of 200 units for each device.\nmodel.addCons(D1 <= 200)\nmodel.addCons(D2 <= 200)\nmodel.addCons(D3 <= 200)\nmodel.addCons(D4 <= 200)\nmodel.addCons(D5 <= 200)\nmodel.addCons(D6 <= 200)\n\n# The production of device 1 and device 2 must be at least 10% of the total production.\nmodel.addCons(D1 + D2 >= 0.1 * (D1 + D2 + D3 + D4 + D5 + D6))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(D1))\n    print(\"Number of Device 2: \", model.getVal(D2))\n    print(\"Number of Device 3: \", model.getVal(D3))\n    print(\"Number of Device 4: \", model.getVal(D4))\n    print(\"Number of Device 5: \", model.getVal(D5))\n    print(\"Number of Device 6: \", model.getVal(D6))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n// {\"cost per kilometer for small vehicles\": \"CostPerKmSmall\", \"range\": \"CostPerKmSmall >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for medium vehicles\": \"CostPerKmMedium\", \"range\": \"CostPerKmMedium >= 0\", \"type\": \"real\"}\n// {\"cost per kilometer for large vehicles\": \"CostPerKmLarge\", \"range\": \"CostPerKmLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer.\n// Revenue_Small = 10 * SmallVehicles\n// Revenue_Medium = 15 * MediumVehicles\n// Revenue_Large = 20 * LargeVehicles\n// Operational_Cost = CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles\n// So, the objective function is: Maximize (Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// CostPerKmSmall * SmallVehicles + CostPerKmMedium * MediumVehicles + CostPerKmLarge * LargeVehicles <= 10000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 50.\n// SmallVehicles + MediumVehicles + LargeVehicles <= 50",
        "question": "A logistics company is planning to optimize its fleet of vehicles for delivering goods across different regions. The company has three types of vehicles: small, medium, and large, each with different capacities and operational costs. The company needs to determine the number of each type of vehicle to maximize profit while considering operational constraints. The revenue generated per kilometer for small vehicles is $10, for medium vehicles is $15, and for large vehicles is $20. The company wants to maximize the total revenue minus the total operational cost per kilometer. The company has a total budget of $10,000 for vehicle operations. The total number of vehicles cannot exceed 50. Please help the company determine the optimal number of small, medium, and large vehicles to maximize their profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nRevenue_Small = 10 * SmallVehicles\nRevenue_Medium = 15 * MediumVehicles\nRevenue_Large = 20 * LargeVehicles\nOperational_Cost = SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles # Assuming costs per km are 1, 2, and 3 respectively\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Small + Revenue_Medium + Revenue_Large - Operational_Cost)\n\n# Add constraints\nmodel.addCons(SmallVehicles + 2 * MediumVehicles + 3 * LargeVehicles <= 10000) # Assuming costs per km are 1, 2, and 3 respectively\nmodel.addCons(SmallVehicles + MediumVehicles + LargeVehicles <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Quantity\", \"range\": \"DeviceD_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceE_Quantity\", \"range\": \"DeviceE_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. \nThe profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units.\nThe profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units.\nThe profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all devices.\n// Profit for DeviceA: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\n// Profit for DeviceB: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\n// Profit for DeviceC: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\n// Profit for DeviceD: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\n// Profit for DeviceE: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials for all devices.\n// (Cost_per_unit_DeviceA * DeviceA_Quantity) + (Cost_per_unit_DeviceB * DeviceB_Quantity) + (Cost_per_unit_DeviceC * DeviceC_Quantity) + (Cost_per_unit_DeviceD * DeviceD_Quantity) + (Cost_per_unit_DeviceE * DeviceE_Quantity) <= 50,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.3 for each unit produced beyond the first 300 units. The profit per unit for DeviceD is $60, but it decreases by $0.15 for each unit produced beyond the first 150 units. The profit per unit for DeviceE is $80, but it decreases by $0.25 for each unit produced beyond the first 250 units. The company has a total production capacity of 1000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least half of the production of DeviceB. The company has a budget of $50,000 for raw materials for all devices. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\nDeviceD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Quantity\", lb=0)\nDeviceE_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_Quantity\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * max(DeviceA_Quantity - 100, 0)) * DeviceA_Quantity\nDeviceA_1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_1\", lb=0, ub=100)\nDeviceA_2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_2\", lb=100, ub=1000)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA_Quantity == DeviceA_1*DeviceA_b1 + DeviceA_2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.1 * (DeviceA_2 - 100)) * DeviceA_2 * DeviceA_b2 + 50 * DeviceA_1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * max(DeviceB_Quantity - 200, 0)) * DeviceB_Quantity\nDeviceB_1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_1\", lb=0, ub=200)\nDeviceB_2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_2\", lb=200, ub=1000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB_Quantity == DeviceB_1*DeviceB_b1 + DeviceB_2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.2 * (DeviceB_2 - 200)) * DeviceB_2 * DeviceB_b2 + 70 * DeviceB_1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.3 * max(DeviceC_Quantity - 300, 0)) * DeviceC_Quantity\nDeviceC_1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_1\", lb=0, ub=300)\nDeviceC_2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_2\", lb=300, ub=1000)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC_Quantity == DeviceC_1*DeviceC_b1 + DeviceC_2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.3 * (DeviceC_2 - 300)) * DeviceC_2 * DeviceC_b2 + 90 * DeviceC_1 * DeviceC_b1\n## create piecewise variables for piecewise function: Profit_DeviceD = (60 - 0.15 * max(DeviceD_Quantity - 150, 0)) * DeviceD_Quantity\nDeviceD_1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_1\", lb=0, ub=150)\nDeviceD_2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_2\", lb=150, ub=1000)\nDeviceD_b1 = model.addVar(vtype=\"B\", name=\"DeviceD_b1\")\nDeviceD_b2 = model.addVar(vtype=\"B\", name=\"DeviceD_b2\")\nmodel.addCons(DeviceD_b1 + DeviceD_b2 == 1)\nmodel.addCons(DeviceD_Quantity == DeviceD_1*DeviceD_b1 + DeviceD_2*DeviceD_b2)\nProfit_DeviceD = (60 - 0.15 * (DeviceD_2 - 150)) * DeviceD_2 * DeviceD_b2 + 60 * DeviceD_1 * DeviceD_b1\n## create piecewise variables for piecewise function: Profit_DeviceE = (80 - 0.25 * max(DeviceE_Quantity - 250, 0)) * DeviceE_Quantity\nDeviceE_1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_1\", lb=0, ub=250)\nDeviceE_2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceE_2\", lb=250, ub=1000)\nDeviceE_b1 = model.addVar(vtype=\"B\", name=\"DeviceE_b1\")\nDeviceE_b2 = model.addVar(vtype=\"B\", name=\"DeviceE_b2\")\nmodel.addCons(DeviceE_b1 + DeviceE_b2 == 1)\nmodel.addCons(DeviceE_Quantity == DeviceE_1*DeviceE_b1 + DeviceE_2*DeviceE_b2)\nProfit_DeviceE = (80 - 0.25 * (DeviceE_2 - 250)) * DeviceE_2 * DeviceE_b2 + 80 * DeviceE_1 * DeviceE_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity + DeviceD_Quantity + DeviceE_Quantity <= 1000)\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\nmodel.addCons(50 * DeviceA_Quantity + 70 * DeviceB_Quantity + 90 * DeviceC_Quantity + 60 * DeviceD_Quantity + 80 * DeviceE_Quantity <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"DeviceA Quantity: \", model.getVal(DeviceA_Quantity))\n    print(\"DeviceB Quantity: \", model.getVal(DeviceB_Quantity))\n    print(\"DeviceC Quantity: \", model.getVal(DeviceC_Quantity))\n    print(\"DeviceD Quantity: \", model.getVal(DeviceD_Quantity))\n    print(\"DeviceE Quantity: \", model.getVal(DeviceE_Quantity))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints.\n// {\"number of small vehicles\": \"SmallVehicles\", \"range\": \"SmallVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"MediumVehicles\", \"range\": \"MediumVehicles >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"LargeVehicles\", \"range\": \"LargeVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company wants to maximize the net daily profit from all vehicles.\n// NetProfit_Small = (200 - 50) * SmallVehicles\n// NetProfit_Medium = (300 - 75) * MediumVehicles\n// NetProfit_Large = (400 - 100) * LargeVehicles\n// So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 per day for vehicle maintenance and operational costs.\n// 50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational costs and constraints. The profit per trip for small vehicles is $200, for medium vehicles is $300, and for large vehicles is $400. The operational cost per vehicle per day is $50 for small, $75 for medium, and $100 for large. The company has a total budget of $5000 per day for vehicle maintenance and operational costs. Please help the company to maximize the net daily profit from all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallVehicles = model.addVar(vtype=\"INTEGER\", name=\"SmallVehicles\", lb=0) # number of small vehicles\nMediumVehicles = model.addVar(vtype=\"INTEGER\", name=\"MediumVehicles\", lb=0) # number of medium vehicles\nLargeVehicles = model.addVar(vtype=\"INTEGER\", name=\"LargeVehicles\", lb=0) # number of large vehicles\n\n# Define objective function\nNetProfit_Small = (200 - 50) * SmallVehicles\nNetProfit_Medium = (300 - 75) * MediumVehicles\nNetProfit_Large = (400 - 100) * LargeVehicles\n# So, the objective function is: Maximize (NetProfit_Small + NetProfit_Medium + NetProfit_Large)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Small + NetProfit_Medium + NetProfit_Large)\n\n# Add constraints\n# The company has a total budget of $5000 per day for vehicle maintenance and operational costs.\nmodel.addCons(50 * SmallVehicles + 75 * MediumVehicles + 100 * LargeVehicles <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(SmallVehicles))\n    print(\"Number of Medium Vehicles: \", model.getVal(MediumVehicles))\n    print(\"Number of Large Vehicles: \", model.getVal(LargeVehicles))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 600,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on Type A buildings\": \"TypeASolar\", \"range\": \"TypeASolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type B buildings\": \"TypeBSolar\", \"range\": \"TypeBSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type C buildings\": \"TypeCSolar\", \"range\": \"TypeCSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type D buildings\": \"TypeDSolar\", \"range\": \"TypeDSolar >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on Type E buildings\": \"TypeESolar\", \"range\": \"TypeESolar >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type due to differences in roof orientation and size. Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city aims to maximize the total energy generated per dollar spent.\n// Total energy generated: Energy = 80% * TypeASolar + 75% * TypeBSolar + 70% * TypeCSolar + 65% * TypeDSolar + 60% * TypeESolar\n// Total cost of installation: Cost = $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar\n// So, the objective function is: Maximize (Energy / Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// $1000 * TypeASolar + $1200 * TypeBSolar + $1500 * TypeCSolar + $1800 * TypeDSolar + $2000 * TypeESolar <= $500,000\n\n## Generate Constraint-2:\nDue to building regulations, the number of solar panels on Type A buildings must not exceed 500.\n// TypeASolar <= 500\n\n## Generate Constraint-3:\nThe city aims to install at least 1000 solar panels in total across all building types.\n// TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000\n\n## Generate Constraint-4:\nTo ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined.\n// TypeCSolar + TypeDSolar >= 0.10 * (TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar)",
        "question": "A city is planning to install solar panels on rooftops of residential buildings to generate electricity. They have identified five different types of buildings (Type A, Type B, Type C, Type D, and Type E) with varying roof sizes and orientations suitable for solar panel installation. The efficiency of solar panels varies by building type due to differences in roof orientation and size. Type A buildings have an efficiency of 80%, Type B 75%, Type C 70%, Type D 65%, and Type E 60%. The cost of installation per panel is $1000 for Type A, $1200 for Type B, $1500 for Type C, $1800 for Type D, and $2000 for Type E. The city has a budget of $500,000 for the installation of solar panels. Due to building regulations, the number of solar panels on Type A buildings must not exceed 500. The city aims to install at least 1000 solar panels in total across all building types. To ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined.\n\nPlease help the city to maximize the total energy generated per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolar = model.addVar(vtype=\"INTEGER\", name=\"TypeASolar\", lb=0)  # number of solar panels on Type A buildings\nTypeBSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolar\", lb=0)  # number of solar panels on Type B buildings\nTypeCSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolar\", lb=0)  # number of solar panels on Type C buildings\nTypeDSolar = model.addVar(vtype=\"INTEGER\", name=\"TypeDSolar\", lb=0)  # number of solar panels on Type D buildings\nTypeESolar = model.addVar(vtype=\"INTEGER\", name=\"TypeESolar\", lb=0)  # number of solar panels on Type E buildings\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * TypeASolar + 0.75 * TypeBSolar + 0.7 * TypeCSolar + 0.65 * TypeDSolar + 0.6 * TypeESolar\nCost = 1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar\n## the objective function is: Maximize (Energy / Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * TypeASolar + 1200 * TypeBSolar + 1500 * TypeCSolar + 1800 * TypeDSolar + 2000 * TypeESolar <= 500000)\n## Due to building regulations, the number of solar panels on Type A buildings must not exceed 500.\nmodel.addCons(TypeASolar <= 500)\n## The city aims to install at least 1000 solar panels in total across all building types.\nmodel.addCons(TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar >= 1000)\n## To ensure equitable distribution of benefits, the city wants to ensure that at least 10% of the total solar panels are installed on Type C and Type D buildings combined.\nmodel.addCons(TypeCSolar + TypeDSolar >= 0.10 * (TypeASolar + TypeBSolar + TypeCSolar + TypeDSolar + TypeESolar))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Type A Buildings: \", model.getVal(TypeASolar))\n    print(\"Number of Solar Panels on Type B Buildings: \", model.getVal(TypeBSolar))\n    print(\"Number of Solar Panels on Type C Buildings: \", model.getVal(TypeCSolar))\n    print(\"Number of Solar Panels on Type D Buildings: \", model.getVal(TypeDSolar))\n    print(\"Number of Solar Panels on Type E Buildings: \", model.getVal(TypeESolar))\n    print(\"Maximized Energy per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers to allocate to each product line, and the amount of overtime hours to allow for each product line to meet fluctuating demand. The company also needs to decide on the investment in automation technology to reduce labor costs.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductA\": \"OvertimeA\", \"range\": \"OvertimeA >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductB\": \"OvertimeB\", \"range\": \"OvertimeB >= 0\", \"type\": \"integer\"}\n// {\"overtime hours for ProductC\": \"OvertimeC\", \"range\": \"OvertimeC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The labor cost per worker is $20 per hour, and overtime costs are $30 per hour. For every $10,000 invested in automation, labor costs per worker are reduced by $1 per hour. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50) * UnitsA - (20 - 0.0001 * Automation) * (WorkersA * 8 + OvertimeA)\n// Total profit for ProductB: ProfitB = (150 - 70) * UnitsB - (20 - 0.0001 * Automation) * (WorkersB * 8 + OvertimeB)\n// Total profit for ProductC: ProfitC = (200 - 90) * UnitsC - (20 - 0.0001 * Automation) * (WorkersC * 8 + OvertimeC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to equipment limitations, the maximum number of units that can be produced for ProductA is 500, for ProductB is 400, and for ProductC is 300.\n// UnitsA <= 500; UnitsB <= 400; UnitsC <= 300\n\n## Generate Constraint-4:\nThe company must ensure that at least 20 units of ProductA and 30 units of ProductB are produced.\n// UnitsA >= 20; UnitsB >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the number of workers to allocate to each product line, and the amount of overtime hours to allow for each product line to meet fluctuating demand. The company also needs to decide on the investment in automation technology to reduce labor costs. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The labor cost per worker is $20 per hour, and overtime costs are $30 per hour. For every $10,000 invested in automation, labor costs per worker are reduced by $1 per hour. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The company has a total of 100 workers available. The total investment in automation cannot exceed $50,000. Due to equipment limitations, the maximum number of units that can be produced for ProductA is 500, for ProductB is 400, and for ProductC is 300. The company must ensure that at least 20 units of ProductA and 30 units of ProductB are produced. The company aims to maximize the total profit from all products. Please help the company to determine the optimal production and workforce allocation strategy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20, ub=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30, ub=400)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=300)    # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)        # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)        # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)        # number of workers for ProductC\nOvertimeA = model.addVar(vtype=\"INTEGER\", name=\"OvertimeA\", lb=0)      # overtime hours for ProductA\nOvertimeB = model.addVar(vtype=\"INTEGER\", name=\"OvertimeB\", lb=0)      # overtime hours for ProductB\nOvertimeC = model.addVar(vtype=\"INTEGER\", name=\"OvertimeC\", lb=0)      # overtime hours for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfitA = (100 - 50) * UnitsA - (20 - 0.0001 * Automation) * (WorkersA * 8 + OvertimeA)\nProfitB = (150 - 70) * UnitsB - (20 - 0.0001 * Automation) * (WorkersB * 8 + OvertimeB)\nProfitC = (200 - 90) * UnitsC - (20 - 0.0001 * Automation) * (WorkersC * 8 + OvertimeC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(Automation <= 50000)\nmodel.addCons(UnitsA <= 500)\nmodel.addCons(UnitsB <= 400)\nmodel.addCons(UnitsC <= 300)\nmodel.addCons(UnitsA >= 20)\nmodel.addCons(UnitsB >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Overtime Hours for ProductA: \", model.getVal(OvertimeA))\n    print(\"Overtime Hours for ProductB: \", model.getVal(OvertimeB))\n    print(\"Overtime Hours for ProductC: \", model.getVal(OvertimeC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"acres of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"acres of C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $100, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $150, requiring 3 units of water per acre. \nFor C3, the profit per acre is $200, requiring 4 units of water per acre.\nFor C4, the profit per acre is $250, requiring 5 units of water per acre.\nFor C5, the profit per acre is $300, requiring 6 units of water per acre.\nThe farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n// Profit_C1 = 100 * C1\n// Profit_C2 = 150 * C2\n// Profit_C3 = 200 * C3\n// Profit_C4 = 250 * C4\n// Profit_C5 = 300 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 + C4 + C5 <= 100",
        "question": "A farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability. The profit per acre and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Requirement per Acre |\n|------|-----------------|----------------------------|\n| C1   | $100            | 2 units                    |\n| C2   | $150            | 3 units                    |\n| C3   | $200            | 4 units                    |\n| C4   | $250            | 5 units                    |\n| C5   | $300            | 6 units                    |\n\nThe farm has a total of 100 acres available for cultivation. The farm wants to maximize the profit per unit of water used to ensure sustainable water management. Please help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # acres of C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # acres of C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * C1\nProfit_C2 = 150 * C2\nProfit_C3 = 200 * C3\nProfit_C4 = 250 * C4\nProfit_C5 = 300 * C5\nWaterUsage = 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Acres of C4: \", model.getVal(C4))\n    print(\"Acres of C5: \", model.getVal(C5))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n// Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n// Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 machines available.\n// MachinesA + MachinesB + MachinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in technology upgrades cannot exceed $50,000.\n// TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n// QuantityA >= 500; QuantityB >= 600",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate. The production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 40 machines available. The total investment in technology upgrades cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=600) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0) # technology upgrade for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0) # technology upgrade for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0) # technology upgrade for ProductC\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n## Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n## Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = 50 * (100 + 0.05 * TechUpgradeA) * MachinesA\nProfitB = 60 * (120 + 0.05 * TechUpgradeB) * MachinesB\nProfitC = 70 * (150 + 0.05 * TechUpgradeC) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 40 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 40)\n## The total investment in technology upgrades cannot exceed $50,000.\nmodel.addCons(TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Technology Upgrade for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Technology Upgrade for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Technology Upgrade for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost.\n// Revenue from Trucks: Rev_T = 500 * T\n// Revenue from Vans: Rev_V = 300 * V\n// Revenue from Bikes: Rev_B = 100 * B\n// Operational cost of Trucks: Cost_T = 200 * T\n// Operational cost of Vans: Cost_V = 100 * V\n// Operational cost of Bikes: Cost_B = 30 * B\n// So, the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for daily operational costs.\n// 200 * T + 100 * V + 30 * B <= 10000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize its daily revenue while considering various operational constraints. Each Truck generates a revenue of $500 per day with an operational cost of $200 per day. Each Van generates a revenue of $300 per day with an operational cost of $100 per day. Each Bike generates a revenue of $100 per day with an operational cost of $30 per day. The company aims to maximize its net daily revenue, which is the total revenue minus the total operational cost. The company has a total budget of $10,000 for daily operational costs. Please help the company determine the optimal number of Trucks, Vans, and Bikes to maximize their net daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRev_T = 500 * T\nRev_V = 300 * V\nRev_B = 100 * B\nCost_T = 200 * T\nCost_V = 100 * V\nCost_B = 30 * B\n## the objective function is: Maximize (Rev_T + Rev_V + Rev_B) - (Cost_T + Cost_V + Cost_B)\nmodel.addCons(obj == Rev_T + Rev_V + Rev_B - Cost_T - Cost_V - Cost_B)\n\n# Add constraints\n## The company has a total budget of $10,000 for daily operational costs.\nmodel.addCons(200 * T + 100 * V + 30 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Net Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output per unit.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n// Total energy output from solar panels in Region1: EnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\n// Total energy output from solar panels in Region2: EnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\n// Total energy output from solar panels in Region3: EnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\n// Total energy output from wind turbines in Region1: EnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\n// Total energy output from wind turbines in Region2: EnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\n// Total energy output from wind turbines in Region3: EnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n// So, the objective function is: Maximize (EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n## Generate Constraint-1:\nThe total investment in R&D cannot exceed $100,000.\n// RnDInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $2,000,000 for the installation of all solar panels and wind turbines.\n// (SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000\n\n## Generate Constraint-3:\nDue to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region.\n// SolarPanels1 <= WindTurbines1; SolarPanels2 <= WindTurbines2; SolarPanels3 <= WindTurbines3",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment amount in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The energy output per solar panel and wind turbine increases with the investment in R&D. For every $10,000 invested in R&D, the energy output per solar panel increases by 5 kWh, and the energy output per wind turbine increases by 10 kWh. The initial energy output per solar panel is 200 kWh, and per wind turbine is 300 kWh. The company aims to maximize the total energy output from all regions.\n\nThe company has a budget of $2,000,000 for the installation of all solar panels and wind turbines, and the total investment in R&D cannot exceed $100,000. Due to geographical constraints, the number of solar panels in each region must not exceed the number of wind turbines in the same region.\n\nPlease help the company to maximize the total energy output from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)\n\n# Define objective function\nEnergyOutput1_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels1\nEnergyOutput2_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels2\nEnergyOutput3_Solar = (200 + 0.0005 * RnDInvestment) * SolarPanels3\nEnergyOutput1_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines1\nEnergyOutput2_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines2\nEnergyOutput3_Wind = (300 + 0.001 * RnDInvestment) * WindTurbines3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput1_Solar + EnergyOutput2_Solar + EnergyOutput3_Solar + EnergyOutput1_Wind + EnergyOutput2_Wind + EnergyOutput3_Wind)\n\n# Add constraints\nmodel.addCons(RnDInvestment <= 100000)\nmodel.addCons((SolarPanels1 + SolarPanels2 + SolarPanels3) * 1000 + (WindTurbines1 + WindTurbines2 + WindTurbines3) * 2000 + RnDInvestment <= 2000000)\nmodel.addCons(SolarPanels1 <= WindTurbines1)\nmodel.addCons(SolarPanels2 <= WindTurbines2)\nmodel.addCons(SolarPanels3 <= WindTurbines3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in R&D: \", model.getVal(RnDInvestment))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company must determine the amount of money to invest in upgrading the fuel efficiency of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Small trucks\": \"EfficiencySmall\", \"range\": \"EfficiencySmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Medium trucks\": \"EfficiencyMedium\", \"range\": \"EfficiencyMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Large trucks\": \"EfficiencyLarge\", \"range\": \"EfficiencyLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with investment, reducing the operational cost per mile. For Small trucks, the operational cost per mile is initially $0.50, and it decreases by $0.01 for every $100 invested in efficiency. For Medium trucks, the initial cost is $0.70, decreasing by $0.015 per $100 invested. For Large trucks, the initial cost is $0.90, decreasing by $0.02 per $100 invested. The company aims to minimize the total annual operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = 0.50 - 0.0001 * EfficiencySmall\n// Total operational cost for Medium trucks: CostMedium = 0.70 - 0.00015 * EfficiencyMedium\n// Total operational cost for Large trucks: CostLarge = 0.90 - 0.0002 * EfficiencyLarge\n// Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n// So, the objective function is: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\n// SmallTrucks * PriceSmall + MediumTrucks * PriceMedium + LargeTrucks * PriceLarge + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 200\n\n## Generate Constraint-3:\nDue to market demand, the company must have at least 50 Small trucks and 30 Large trucks.\n// SmallTrucks >= 50; LargeTrucks >= 30\n\n## Generate Constraint-4:\nThe investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck.\n// EfficiencySmall <= 0.20 * (SmallTrucks * PriceSmall)\n// EfficiencyMedium <= 0.20 * (MediumTrucks * PriceMedium)\n// EfficiencyLarge <= 0.20 * (LargeTrucks * PriceLarge)",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large, and the amount of money to invest in upgrading the fuel efficiency of each type of truck. The initial operational cost per mile and the rate at which it decreases with investment for each type of truck are given in the following Table.\n\n| Truck Type | Initial Operational Cost per Mile | Decrease per $100 Invested |\n|------------|----------------------------------|----------------------------|\n| Small      | $0.50                            | $0.01                      |\n| Medium     | $0.70                            | $0.015                     |\n| Large      | $0.90                            | $0.02                      |\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency. The total number of trucks cannot exceed 200. Due to market demand, the company must have at least 50 Small trucks and 30 Large trucks. The investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck. \n\nPlease help the company to minimize the total annual operational cost of the fleet, considering the annual miles driven for each type of truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=50)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=30)  # number of Large trucks\nEfficiencySmall = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencySmall\", lb=0)  # investment in fuel efficiency for Small trucks\nEfficiencyMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyMedium\", lb=0)  # investment in fuel efficiency for Medium trucks\nEfficiencyLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyLarge\", lb=0)  # investment in fuel efficiency for Large trucks\n\n# Define objective function\nCostSmall = 0.50 - 0.0001 * EfficiencySmall  # Total operational cost for Small trucks\nCostMedium = 0.70 - 0.00015 * EfficiencyMedium  # Total operational cost for Medium trucks\nCostLarge = 0.90 - 0.0002 * EfficiencyLarge  # Total operational cost for Large trucks\n# Annual miles driven for each type of truck: MilesSmall, MilesMedium, MilesLarge\n# Objective function: Minimize (CostSmall * MilesSmall + CostMedium * MilesMedium + CostLarge * MilesLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing trucks and investing in fuel efficiency.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + EfficiencySmall + EfficiencyMedium + EfficiencyLarge <= 200000)\n# The total number of trucks cannot exceed 200.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 200)\n# Due to market demand, the company must have at least 50 Small trucks and 30 Large trucks.\nmodel.addCons(SmallTrucks >= 50)\nmodel.addCons(LargeTrucks >= 30)\n# The investment in fuel efficiency for each type of truck must not exceed 20% of the total budget allocated for that type of truck.\nmodel.addCons(EfficiencySmall <= 0.20 * SmallTrucks)\nmodel.addCons(EfficiencyMedium <= 0.20 * MediumTrucks)\nmodel.addCons(EfficiencyLarge <= 0.20 * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Fuel Efficiency for Small Trucks: \", model.getVal(EfficiencySmall))\n    print(\"Investment in Fuel Efficiency for Medium Trucks: \", model.getVal(EfficiencyMedium))\n    print(\"Investment in Fuel Efficiency for Large Trucks: \", model.getVal(EfficiencyLarge))\n    print(\"Minimized Total Annual Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1327,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route.\n// {\"number of trucks for D1\": \"TrucksD1\", \"range\": \"TrucksD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D2\": \"TrucksD2\", \"range\": \"TrucksD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D3\": \"TrucksD3\", \"range\": \"TrucksD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D4\": \"TrucksD4\", \"range\": \"TrucksD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D5\": \"TrucksD5\", \"range\": \"TrucksD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for D1\": \"FuelD1\", \"range\": \"FuelD1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D2\": \"FuelD2\", \"range\": \"FuelD2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D3\": \"FuelD3\", \"range\": \"FuelD3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D4\": \"FuelD4\", \"range\": \"FuelD4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for D5\": \"FuelD5\", \"range\": \"FuelD5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company earns a revenue of $1000 per truck per route. The fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed.\n// RevenueD1 = 1000 * TrucksD1\n// RevenueD2 = 1000 * TrucksD2\n// RevenueD3 = 1000 * TrucksD3\n// RevenueD4 = 1000 * TrucksD4\n// RevenueD5 = 1000 * TrucksD5\n// FuelCostD1 = 3 * FuelD1 * TrucksD1\n// FuelCostD2 = 3 * FuelD2 * TrucksD2\n// FuelCostD3 = 3 * FuelD3 * TrucksD3\n// FuelCostD4 = 3 * FuelD4 * TrucksD4\n// FuelCostD5 = 3 * FuelD5 * TrucksD5\n// So, the objective function is: Maximize ((RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)) / (FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 1000 gallons.\n// FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5 <= 1000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to allocate to each route and the fuel consumption rate for each truck on each route. The company earns a revenue of $1000 per truck per route. The fuel cost is $3 per gallon. The company aims to maximize the net profit per gallon of fuel consumed. The company has a total of 50 trucks available. The total fuel consumption across all routes must not exceed 1000 gallons. Please help the company to determine the optimal allocation of trucks and fuel consumption rates to maximize the net profit per gallon of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksD1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD1\", lb=0)\nTrucksD2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD2\", lb=0)\nTrucksD3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD3\", lb=0)\nTrucksD4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD4\", lb=0)\nTrucksD5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD5\", lb=0)\nFuelD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD1\", lb=0)\nFuelD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD2\", lb=0)\nFuelD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD3\", lb=0)\nFuelD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD4\", lb=0)\nFuelD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelD5\", lb=0)\n\n# Define objective function\nRevenueD1 = 1000 * TrucksD1\nRevenueD2 = 1000 * TrucksD2\nRevenueD3 = 1000 * TrucksD3\nRevenueD4 = 1000 * TrucksD4\nRevenueD5 = 1000 * TrucksD5\nFuelCostD1 = 3 * FuelD1 * TrucksD1\nFuelCostD2 = 3 * FuelD2 * TrucksD2\nFuelCostD3 = 3 * FuelD3 * TrucksD3\nFuelCostD4 = 3 * FuelD4 * TrucksD4\nFuelCostD5 = 3 * FuelD5 * TrucksD5\nTotalFuelConsumption = FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5\nNetProfit = (RevenueD1 - FuelCostD1) + (RevenueD2 - FuelCostD2) + (RevenueD3 - FuelCostD3) + (RevenueD4 - FuelCostD4) + (RevenueD5 - FuelCostD5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalFuelConsumption == NetProfit)\n\n# Add constraints\nmodel.addCons(TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50)\nmodel.addCons(FuelD1 * TrucksD1 + FuelD2 * TrucksD2 + FuelD3 * TrucksD3 + FuelD4 * TrucksD4 + FuelD5 * TrucksD5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for D1: \", model.getVal(TrucksD1))\n    print(\"Number of Trucks for D2: \", model.getVal(TrucksD2))\n    print(\"Number of Trucks for D3: \", model.getVal(TrucksD3))\n    print(\"Number of Trucks for D4: \", model.getVal(TrucksD4))\n    print(\"Number of Trucks for D5: \", model.getVal(TrucksD5))\n    print(\"Fuel Consumption Rate for D1: \", model.getVal(FuelD1))\n    print(\"Fuel Consumption Rate for D2: \", model.getVal(FuelD2))\n    print(\"Fuel Consumption Rate for D3: \", model.getVal(FuelD3))\n    print(\"Fuel Consumption Rate for D4: \", model.getVal(FuelD4))\n    print(\"Fuel Consumption Rate for D5: \", model.getVal(FuelD5))\n    print(\"Maximized Net Profit per Gallon: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 701,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and profit per unit of product. \nOn machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C.\nOn machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C.\nOn machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C.\nOn machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C.\nThe company aims to maximize the total profit from all products.\n// The profit from product A: P_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\n// The profit from product B: P_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\n// The profit from product C: P_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n// So, the objective function is: Maximize P = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 + W4 <= 60\n\n## Generate Constraint-2:\nEach machine can be operated by up to 20 workers at a time.\n// W1 <= 20; W2 <= 20; W3 <= 20; W4 <= 20",
        "question": "A manufacturing company produces three types of products using four different machines. The company needs to optimize the allocation of workers to each machine to maximize profit. Each machine has a different efficiency and profit per unit of product. On machine 1, each worker generates 10 units of product A, 15 units of product B, and 20 units of product C per hour, with a profit of $5 per unit of A, $10 per unit of B, and $15 per unit of C. On machine 2, each worker generates 15 units of product A, 20 units of product B, and 25 units of product C per hour, with a profit of $6 per unit of A, $11 per unit of B, and $16 per unit of C. On machine 3, each worker generates 20 units of product A, 25 units of product B, and 30 units of product C per hour, with a profit of $7 per unit of A, $12 per unit of B, and $17 per unit of C. On machine 4, each worker generates 25 units of product A, 30 units of product B, and 35 units of product C per hour, with a profit of $8 per unit of A, $13 per unit of B, and $18 per unit of C. The company aims to maximize the total profit from all products. There are a total of 60 workers available, and each machine can be operated by up to 20 workers at a time. Please help the company determine the optimal number of workers to assign to each machine to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\n\n# Define objective function\nP_A = (10 * W1 + 15 * W2 + 20 * W3 + 25 * W4) * 5\nP_B = (15 * W1 + 20 * W2 + 25 * W3 + 30 * W4) * 10\nP_C = (20 * W1 + 25 * W2 + 30 * W3 + 35 * W4) * 15\n# So, the objective function is: Maximize P = P_A + P_B + P_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 + W4 <= 60)\n# Each machine can be operated by up to 20 workers at a time.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\nmodel.addCons(W4 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Number of workers on machine 4: \", model.getVal(W4))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse. At warehouse 1, the cost per truck is $1000, increasing by $10 for each additional truck beyond the first. At warehouse 2, the cost per truck is $1200, increasing by $12 for each additional truck beyond the first. At warehouse 3, the cost per truck is $1100, increasing by $11 for each additional truck beyond the first. At warehouse 4, the cost per truck is $1300, increasing by $13 for each additional truck beyond the first. At warehouse 5, the cost per truck is $1400, increasing by $14 for each additional truck beyond the first. The company aims to minimize the total operating cost of all trucks.\n// Cost_T1 = 1000 + 10 * (T1 - 1) * T1\n// Cost_T2 = 1200 + 12 * (T2 - 1) * T2\n// Cost_T3 = 1100 + 11 * (T3 - 1) * T3\n// Cost_T4 = 1300 + 13 * (T4 - 1) * T4\n// Cost_T5 = 1400 + 14 * (T5 - 1) * T5\n// So, the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse, as shown in the following Table.\n\n| Warehouse | Cost per Truck (First Truck) | Additional Cost per Truck |\n|-----------|------------------------------|---------------------------|\n| 1         | $1000                        | $10                       |\n| 2         | $1200                        | $12                       |\n| 3         | $1100                        | $11                       |\n| 4         | $1300                        | $13                       |\n| 5         | $1400                        | $14                       |\n\nThe company aims to minimize the total operating cost of all trucks. The total number of trucks available across all warehouses is limited to 100. Please help the company determine the optimal number of trucks to allocate to each warehouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Cost functions\nCost_T1 = 1000 + 10 * (T1 - 1) * T1\nCost_T2 = 1200 + 12 * (T2 - 1) * T2\nCost_T3 = 1100 + 11 * (T3 - 1) * T3\nCost_T4 = 1300 + 13 * (T4 - 1) * T4\nCost_T5 = 1400 + 14 * (T5 - 1) * T5\n## the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for furniture\": \"FurnitureTrucks\", \"range\": \"FurnitureTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for furniture\": \"FurnitureTripsPerTruck\", \"range\": \"FurnitureTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishables\": \"PerishablesTripsPerTruck\", \"range\": \"PerishablesTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for electronics is $300, for furniture is $200, and for perishables is $400. The company aims to maximize the total daily profit from all trips.\n// Profit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\n// Profit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\n// Profit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n## Generate Constraint-1:\nThe company has a total of 50 drivers available for the day.\n// ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000. The fuel cost per trip for electronics is $20, for furniture is $30, and for perishables is $40.\n// 20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 30 * FurnitureTrucks * FurnitureTripsPerTruck + 40 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, furniture, and perishables. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day to maximize efficiency while considering various constraints such as fuel consumption, driver availability, and storage capacity. The profit per trip and fuel cost per trip for each type of goods are given in the following Table.\n\n| Type of Goods | Profit per Trip | Fuel Cost per Trip |\n|---------------|-----------------|--------------------|\n| Electronics   | $300            | $20                |\n| Furniture     | $200            | $30                |\n| Perishables   | $400            | $40                |\n\nThe company has a total of 50 drivers available for the day. The company has a daily fuel budget of $1000. Please help the company to maximize the total daily profit from all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nFurnitureTrucks = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nFurnitureTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FurnitureTripsPerTruck\", lb=0)\nPerishablesTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = 300 * ElectronicsTrucks * ElectronicsTripsPerTruck\nProfit_Furniture = 200 * FurnitureTrucks * FurnitureTripsPerTruck\nProfit_Perishables = 400 * PerishablesTrucks * PerishablesTripsPerTruck\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Furniture + Profit_Perishables)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks * ElectronicsTripsPerTruck + FurnitureTrucks * FurnitureTripsPerTruck + PerishablesTrucks * PerishablesTripsPerTruck <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 30 * FurnitureTrucks * FurnitureTripsPerTruck + 40 * PerishablesTrucks * PerishablesTripsPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Furniture: \", model.getVal(FurnitureTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Furniture: \", model.getVal(FurnitureTripsPerTruck))\n    print(\"Trips per Truck for Perishables: \", model.getVal(PerishablesTripsPerTruck))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the fuel efficiency of each truck type.\n// {\"number of trucks for Good A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Good C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Good A\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Good B\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Good C\": \"FuelEffC\", \"range\": \"FuelEffC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The company wants to minimize the total fuel cost per trip considering the distance each type of truck travels and its fuel efficiency.\n// FuelCostA = 1.5 * DistanceA / FuelEffA * TrucksA\n// FuelCostB = 1.5 * DistanceB / FuelEffB * TrucksB\n// FuelCostC = 1.5 * DistanceC / FuelEffC * TrucksC\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing trucks.\n// CostPerTruckA * TrucksA + CostPerTruckB * TrucksB + CostPerTruckC * TrucksC <= 10000\n\n## Generate Constraint-2:\nThe total weight of goods that can be transported is limited to 5000 kg.\n// WeightPerTruckA * TrucksA + WeightPerTruckB * TrucksB + WeightPerTruckC * TrucksC <= 5000\n\n## Generate Constraint-3:\nThe company has a policy that at least 20% of the fleet should be dedicated to Good A.\n// TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC)",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods (A, B, and C) across different routes. The company needs to determine the number of trucks to allocate for each type of good and the fuel efficiency of each truck type. The cost of fuel per liter is $1.5. The company wants to minimize the total fuel cost per trip considering the distance each type of truck travels and its fuel efficiency. The company has a total budget of $10,000 for purchasing trucks. The total weight of goods that can be transported is limited to 5000 kg. The company has a policy that at least 20% of the fleet should be dedicated to Good A.\n\nPlease help the company to determine the optimal allocation of trucks and their fuel efficiencies to minimize the total fuel cost per trip.\n\n| Good | Number of Trucks | Fuel Efficiency |\n|------|------------------|-----------------|\n| A    | TrucksA          | FuelEffA        |\n| B    | TrucksB          | FuelEffB        |\n| C    | TrucksC          | FuelEffC        |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Good A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Good B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for Good C\n\n# Define objective function\nFuelCostA = 1.5 * model.addVar(name=\"DistanceA\") / model.addVar(name=\"FuelEffA\") * TrucksA\nFuelCostB = 1.5 * model.addVar(name=\"DistanceB\") / model.addVar(name=\"FuelEffB\") * TrucksB\nFuelCostC = 1.5 * model.addVar(name=\"DistanceC\") / model.addVar(name=\"FuelEffC\") * TrucksC\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\n# The company has a total budget of $10,000 for purchasing trucks.\nmodel.addCons(model.addVar(name=\"CostPerTruckA\") * TrucksA + model.addVar(name=\"CostPerTruckB\") * TrucksB + model.addVar(name=\"CostPerTruckC\") * TrucksC <= 10000)\n\n# The total weight of goods that can be transported is limited to 5000 kg.\nmodel.addCons(model.addVar(name=\"WeightPerTruckA\") * TrucksA + model.addVar(name=\"WeightPerTruckB\") * TrucksB + model.addVar(name=\"WeightPerTruckC\") * TrucksC <= 5000)\n\n# The company has a policy that at least 20% of the fleet should be dedicated to Good A.\nmodel.addCons(TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Good A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Good B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Good C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks.\n// {\"fuel consumption of Truck1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel consumption rate and maintenance cost per kilometer. The rates are as follows:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost.\n// Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n// Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n// So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\n\n## Generate Constraint-1:\nThe total distance covered by all trucks should not exceed 10,000 km.\n// F1 + F2 + F3 + F4 + F5 <= 10000\n\n## Generate Constraint-2:\nTruck1 and Truck2 combined should cover at least 3000 km.\n// F1 + F2 >= 3000",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks. Each truck has a different fuel consumption rate and maintenance cost per kilometer:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost. The total distance covered by all trucks should not exceed 10,000 km. Additionally, Truck1 and Truck2 combined should cover at least 3000 km.\nPlease help the company to minimize the total cost (fuel cost plus maintenance cost).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of Truck1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of Truck2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of Truck3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of Truck4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of Truck5\n\n# Define objective function\n## Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n## Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n## So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\nTotalFuelCost = 0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5\nTotalMaintenanceCost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\nTotalCost = TotalFuelCost + TotalMaintenanceCost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The total distance covered by all trucks should not exceed 10,000 km.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 10000)\n## Truck1 and Truck2 combined should cover at least 3000 km.\nmodel.addCons(F1 + F2 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(F1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(F2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(F3))\n    print(\"Fuel consumption of Truck4: \", model.getVal(F4))\n    print(\"Fuel consumption of Truck5: \", model.getVal(F5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Specialty trucks\": \"Sp\", \"range\": \"Sp >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements.\n// Fuel_Small = (S * 20) / 5\n// Fuel_Medium = (M * 15) / 10\n// Fuel_Large = (L * 10) / 15\n// Fuel_ExtraLarge = (XL * 8) / 20\n// Fuel_Specialty = (Sp * 5) / 25\n// So, the objective function is: Minimize Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty\n\n## Generate Constraint-1:\nThe total weight of all deliveries must not exceed 500 tons.\n// 5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500\n\n## Generate Constraint-2:\nThe company has a budget to purchase up to 100 trucks in total.\n// S + M + L + XL + Sp <= 100\n\n## Generate Constraint-3:\nThe number of Specialty trucks cannot exceed 10% of the total number of trucks.\n// Sp <= 0.1 * (S + M + L + XL + Sp)\n\n## Generate Constraint-4:\nThe number of Small trucks must be at least 20% of the total number of trucks.\n// S >= 0.2 * (S + M + L + XL + Sp)",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Specialty. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting delivery requirements. Each type of truck has a different fuel efficiency and capacity. The Small truck has a fuel efficiency of 20 km/l and a capacity of 5 tons. The Medium truck has a fuel efficiency of 15 km/l and a capacity of 10 tons. The Large truck has a fuel efficiency of 10 km/l and a capacity of 15 tons. The Extra-Large truck has a fuel efficiency of 8 km/l and a capacity of 20 tons. The Specialty truck has a fuel efficiency of 5 km/l and a capacity of 25 tons. The company wants to minimize the total fuel consumption while meeting the delivery requirements. The total weight of all deliveries must not exceed 500 tons. The company has a budget to purchase up to 100 trucks in total. The number of Specialty trucks cannot exceed 10% of the total number of trucks. The number of Small trucks must be at least 20% of the total number of trucks. Please help the company to determine the optimal number of each type of truck to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nSp = model.addVar(vtype=\"INTEGER\", name=\"Sp\", lb=0) # number of Specialty trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Small = (S * 20) / 5\nFuel_Medium = (M * 15) / 10\nFuel_Large = (L * 10) / 15\nFuel_ExtraLarge = (XL * 8) / 20\nFuel_Specialty = (Sp * 5) / 25\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Small + Fuel_Medium + Fuel_Large + Fuel_ExtraLarge + Fuel_Specialty)\n\n# Add constraints\n## The total weight of all deliveries must not exceed 500 tons.\nmodel.addCons(5 * S + 10 * M + 15 * L + 20 * XL + 25 * Sp <= 500)\n## The company has a budget to purchase up to 100 trucks in total.\nmodel.addCons(S + M + L + XL + Sp <= 100)\n## The number of Specialty trucks cannot exceed 10% of the total number of trucks.\nmodel.addCons(Sp <= 0.1 * (S + M + L + XL + Sp))\n## The number of Small trucks must be at least 20% of the total number of trucks.\nmodel.addCons(S >= 0.2 * (S + M + L + XL + Sp))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Specialty trucks: \", model.getVal(Sp))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The initial cost per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation technology.\n// AutomationInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the investment in automation technology to maximize profit while considering the cost of raw materials, labor, and the efficiency of production lines. The efficiency of the production lines depends on the investment in automation technology. The profit per unit and the initial cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $100           | $50                   |\n| ProductB | $150           | $70                   |\n| ProductC | $200           | $90                   |\n\nThe cost of raw materials and labor per unit decreases by $1 for every $10,000 invested in automation technology. The company has a budget of $100,000 for investment in automation technology. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nProfitA = (100 - 50 + 0.0001 * AutomationInvestment) * QuantityA\nProfitB = (150 - 70 + 0.0001 * AutomationInvestment) * QuantityB\nProfitC = (200 - 90 + 0.0001 * AutomationInvestment) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation Technology: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality. The quality improvement affects the defect rate and thus the cost of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"RnDInvestment\", \"range\": \"RnDInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost per unit of ProductA is $60, ProductB is $80, and ProductC is $120, but these costs decrease by $0.5 for every $10,000 invested in R&D. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.0005 * RnDInvestment) * QuantityA - MarketingA/1000 * QuantityA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.0005 * RnDInvestment) * QuantityB - MarketingB/1000 * QuantityB\n// Total profit for ProductC: ProfitC = (200 - 120 + 0.0005 * RnDInvestment) * QuantityC - MarketingC/1000 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production quantity for all products cannot exceed 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget for all products must not exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe investment in R&D cannot exceed $100,000.\n// RnDInvestment <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the investment in research and development (R&D) to improve product quality. The quality improvement affects the defect rate and thus the cost of each product. The revenue per unit, cost per unit, and the impact of marketing budget on sales for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost per Unit | Marketing Impact per $1000 |\n|---------|------------------|---------------|----------------------------|\n| ProductA | $100            | $60           | 1% increase in sales       |\n| ProductB | $150            | $80           | 1% increase in sales       |\n| ProductC | $200            | $120          | 1% increase in sales       |\n\nThe cost per unit decreases by $0.5 for every $10,000 invested in R&D. The company aims to maximize the total profit from all products. The total production quantity for all products cannot exceed 10,000 units. The total marketing budget for all products must not exceed $50,000. The investment in R&D cannot exceed $100,000.\n\nPlease help the company determine the optimal production quantities, marketing budgets, and R&D investment to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\nRnDInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"RnDInvestment\", lb=0)  # investment in R&D\n\n# Define objective function\nProfitA = (100 - 60 + 0.0005 * RnDInvestment) * QuantityA - MarketingA / 1000 * QuantityA\nProfitB = (150 - 80 + 0.0005 * RnDInvestment) * QuantityB - MarketingB / 1000 * QuantityB\nProfitC = (200 - 120 + 0.0005 * RnDInvestment) * QuantityC - MarketingC / 1000 * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)  # total production quantity constraint\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)  # total marketing budget constraint\nmodel.addCons(RnDInvestment <= 100000)  # R&D investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"R&D Investment: \", model.getVal(RnDInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency rate based on the number of trucks allocated. The efficiency is calculated as the square root of the number of trucks, which represents the optimal balance between utilization and congestion. The company aims to maximize the total efficiency across all routes.\n// Efficiency of route 1: E1 = sqrt(T1)\n// Efficiency of route 2: E2 = sqrt(T2)\n// Efficiency of route 3: E3 = sqrt(T3)\n// Efficiency of route 4: E4 = sqrt(T4)\n// Efficiency of route 5: E5 = sqrt(T5)\n// Efficiency of route 6: E6 = sqrt(T6)\n// The objective function is: Maximize E1 + E2 + E3 + E4 + E5 + E6\n// Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks to avoid overcrowding.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency rate based on the number of trucks allocated, calculated as the square root of the number of trucks. The company aims to maximize the total efficiency across all routes. The company has a total of 100 trucks available and each route can handle a maximum of 20 trucks to avoid overcrowding.\n\nPlease help the company to maximize the total efficiency by determining the optimal number of trucks to allocate to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\n# The objective function is: Maximize sqrt(T1) + sqrt(T2) + sqrt(T3) + sqrt(T4) + sqrt(T5) + sqrt(T6)\n# Convert square root to a variable\nE1 = model.addVar(name=\"E1\") # Efficiency of route 1\nE2 = model.addVar(name=\"E2\") # Efficiency of route 2\nE3 = model.addVar(name=\"E3\") # Efficiency of route 3\nE4 = model.addVar(name=\"E4\") # Efficiency of route 4\nE5 = model.addVar(name=\"E5\") # Efficiency of route 5\nE6 = model.addVar(name=\"E6\") # Efficiency of route 6\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints for square root relationships\nmodel.addCons(E1**2 == T1)\nmodel.addCons(E2**2 == T2)\nmodel.addCons(E3**2 == T3)\nmodel.addCons(E4**2 == T4)\nmodel.addCons(E5**2 == T5)\nmodel.addCons(E6**2 == T6)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n# Each route can handle a maximum of 20 trucks to avoid overcrowding.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Number of trucks on route 6: \", model.getVal(T6))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 637,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building.\n// {\"number of solar panels on residential buildings\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on commercial buildings\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on industrial buildings\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on government buildings\": \"Government\", \"range\": \"Government >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on educational buildings\": \"Educational\", \"range\": \"Educational >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by building type. Residential buildings have an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels.\n// Total energy output: Energy = 80% * Residential + 85% * Commercial + 90% * Industrial + 95% * Government + 100% * Educational\n// The objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 to spend on solar panel installations. The cost per panel is $1,000 for residential, $1,200 for commercial, $1,500 for industrial, $1,800 for government, and $2,000 for educational buildings.\n// 1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000\n\n## Generate Constraint-2:\nThe city aims to install at least 200 solar panels in total.\n// Residential + Commercial + Industrial + Government + Educational >= 200\n\n## Generate Constraint-3:\nThe number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels.\n// Government <= 0.3 * (Residential + Commercial + Industrial + Government + Educational)\n\n## Generate Constraint-4:\nThe city wants to ensure that at least 25% of the total budget is spent on educational buildings.\n// 2000 * Educational >= 0.25 * (1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational)",
        "question": "A city is planning to install solar panels on five different types of buildings: residential, commercial, industrial, government, and educational. The city needs to determine the number of solar panels to install on each type of building. The efficiency of solar panels varies by building type, with residential buildings having an efficiency of 80%, commercial buildings 85%, industrial buildings 90%, government buildings 95%, and educational buildings 100%. The city aims to maximize the total energy output from the solar panels. The city has a budget of $500,000 to spend on solar panel installations, with the cost per panel being $1,000 for residential, $1,200 for commercial, $1,500 for industrial, $1,800 for government, and $2,000 for educational buildings. The city aims to install at least 200 solar panels in total. The number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels. The city wants to ensure that at least 25% of the total budget is spent on educational buildings. Please help the city determine the optimal number of solar panels to install on each type of building to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0)  # number of solar panels on residential buildings\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0)  # number of solar panels on commercial buildings\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0)  # number of solar panels on industrial buildings\nGovernment = model.addVar(vtype=\"INTEGER\", name=\"Government\", lb=0)  # number of solar panels on government buildings\nEducational = model.addVar(vtype=\"INTEGER\", name=\"Educational\", lb=0)  # number of solar panels on educational buildings\n\n# Define objective function\nEnergy = 0.8 * Residential + 0.85 * Commercial + 0.9 * Industrial + 0.95 * Government + 1 * Educational\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\n# The city has a budget of $500,000 to spend on solar panel installations.\nmodel.addCons(1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational <= 500000)\n# The city aims to install at least 200 solar panels in total.\nmodel.addCons(Residential + Commercial + Industrial + Government + Educational >= 200)\n# The number of solar panels installed on government buildings should not exceed 30% of the total number of solar panels.\nmodel.addCons(Government <= 0.3 * (Residential + Commercial + Industrial + Government + Educational))\n# The city wants to ensure that at least 25% of the total budget is spent on educational buildings.\nmodel.addCons(2000 * Educational >= 0.25 * (1000 * Residential + 1200 * Commercial + 1500 * Industrial + 1800 * Government + 2000 * Educational))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Residential Buildings: \", model.getVal(Residential))\n    print(\"Number of Solar Panels on Commercial Buildings: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels on Industrial Buildings: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels on Government Buildings: \", model.getVal(Government))\n    print(\"Number of Solar Panels on Educational Buildings: \", model.getVal(Educational))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wireless Earbuds\": \"WirelessEarbuds\", \"range\": \"WirelessEarbuds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\n// Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\n// Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\n// Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\n// Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all devices.\n// Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $50 per Smartphone, $70 per Tablet, $100 per Laptop, $20 per Smartwatch, and $15 per Wireless Earbud. The total budget for raw materials is $60,000.\n// 50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units.\n// Smartphones <= 300; Tablets <= 200; Laptops <= 150; Smartwatches <= 250; WirelessEarbuds <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units of each device type to meet the minimum order requirements from distributors.\n// Smartphones >= 100; Tablets >= 100; Laptops >= 100; Smartwatches >= 100; WirelessEarbuds >= 100",
        "question": "A manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints. The profit per unit for each device and the cost of raw materials are given in the following Table.\n\n| Device            | Profit per Unit | Raw Material Cost |\n|-------------------|-----------------|-------------------|\n| Smartphones       | $100            | $50               |\n| Tablets           | $200            | $70               |\n| Laptops           | $300            | $100              |\n| Smartwatches      | $50             | $20               |\n| Wireless Earbuds  | $30             | $15               |\n\nDue to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company has a total production capacity of 1000 units across all devices. The company has a limited budget for raw materials, which costs as shown in the table, with a total budget of $60,000. The market demand for each device type is also limited as shown in the table. The company aims to produce at least 100 units of each device type to meet the minimum order requirements from distributors.\n\nPlease help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for Smartphones is at most 300 units, for Tablets is at most 200 units, for Laptops is at most 150 units, for Smartwatches is at most 250 units, and for Wireless Earbuds is at most 300 units.\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=100, ub=300)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=100, ub=200)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=100, ub=150)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=100, ub=250)\nWirelessEarbuds = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds\", lb=100, ub=300)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=100, ub=300)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=300, ub=300)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(Smartphones == S1*S_b1 + S2*S_b2)\nProfit_Smartphones = 100 * S1 * S_b1 + (100 + 0.1 * (S2 - 100)) * S2 * S_b2\n\n## create piecewise variables for piecewise function: Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=100, ub=200)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=200, ub=200)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(Tablets == T1*T_b1 + T2*T_b2)\nProfit_Tablets = 200 * T1 * T_b1 + (200 + 0.1 * (T2 - 100)) * T2 * T_b2\n\n## create piecewise variables for piecewise function: Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=100, ub=150)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=150, ub=150)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(Laptops == L1*L_b1 + L2*L_b2)\nProfit_Laptops = 300 * L1 * L_b1 + (300 + 0.1 * (L2 - 100)) * L2 * L_b2\n\n## create piecewise variables for piecewise function: Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\nSW1 = model.addVar(vtype=\"INTEGER\", name=\"SW1\", lb=100, ub=250)\nSW2 = model.addVar(vtype=\"INTEGER\", name=\"SW2\", lb=250, ub=250)\nSW_b1 = model.addVar(vtype=\"B\", name=\"SW_b1\")\nSW_b2 = model.addVar(vtype=\"B\", name=\"SW_b2\")\nmodel.addCons(SW_b1 + SW_b2 == 1)\nmodel.addCons(Smartwatches == SW1*SW_b1 + SW2*SW_b2)\nProfit_Smartwatches = 50 * SW1 * SW_b1 + (50 + 0.1 * (SW2 - 100)) * SW2 * SW_b2\n\n## create piecewise variables for piecewise function: Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\nWE1 = model.addVar(vtype=\"INTEGER\", name=\"WE1\", lb=100, ub=300)\nWE2 = model.addVar(vtype=\"INTEGER\", name=\"WE2\", lb=300, ub=300)\nWE_b1 = model.addVar(vtype=\"B\", name=\"WE_b1\")\nWE_b2 = model.addVar(vtype=\"B\", name=\"WE_b2\")\nmodel.addCons(WE_b1 + WE_b2 == 1)\nmodel.addCons(WirelessEarbuds == WE1*WE_b1 + WE2*WE_b2)\nProfit_WirelessEarbuds = 30 * WE1 * WE_b1 + (30 + 0.1 * (WE2 - 100)) * WE2 * WE_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000)\nmodel.addCons(50 * Smartphones + 70 * Tablets + 100 * Laptops + 20 * Smartwatches + 15 * WirelessEarbuds <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Quantity of Wireless Earbuds: \", model.getVal(WirelessEarbuds))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1409,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter, Truck B has a fuel efficiency of 8 km/liter, and Truck C has a fuel efficiency of 10 km/liter. The company wants to maximize the total distance covered per liter of fuel.\n// FuelEfficiency_A = 5 * TruckA\n// FuelEfficiency_B = 8 * TruckB\n// FuelEfficiency_C = 10 * TruckC\n// So, the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / (TruckA + TruckB + TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000\n\n## Generate Constraint-2:\nThe total weight capacity of all trucks must not exceed 50,000 kg. Truck A can carry 5,000 kg, Truck B can carry 8,000 kg, and Truck C can carry 10,000 kg.\n// 5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands. The fuel efficiency and carrying capacity for each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Carrying Capacity (kg) |\n|------------|---------------------------|------------------------|\n| Truck A    | 5                         | 5000                   |\n| Truck B    | 8                         | 8000                   |\n| Truck C    | 10                        | 10000                  |\n\nThe company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000. The total weight capacity of all trucks must not exceed 50,000 kg. \n\nPlease help the company to maximize the total distance covered per liter of fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuelEfficiency_A = 5 * TruckA\nFuelEfficiency_B = 8 * TruckB\nFuelEfficiency_C = 10 * TruckC\nTotalTrucks = TruckA + TruckB + TruckC\n## the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000)\n## The total weight capacity of all trucks must not exceed 50,000 kg.\nmodel.addCons(5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Fuel Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of each route varies with the number of trucks. Route 1 has a base fuel efficiency of 10 km/l, which improves by 0.05 km/l for every additional truck. Route 2 has a base fuel efficiency of 12 km/l, improving by 0.04 km/l per additional truck. Route 3 has a base fuel efficiency of 11 km/l, improving by 0.03 km/l per additional truck. Route 4 has a base fuel efficiency of 9 km/l, improving by 0.06 km/l per additional truck. Route 5 has a base fuel efficiency of 8 km/l, improving by 0.02 km/l per additional truck. The company wants to minimize the total fuel consumption across all routes.\n// Fuel_efficiency_1 = max(10 + 0.05 * (T1 - 1), 10)\n// Fuel_efficiency_2 = max(12 + 0.04 * (T2 - 1), 12)\n// Fuel_efficiency_3 = max(11 + 0.03 * (T3 - 1), 11)\n// Fuel_efficiency_4 = max(9 + 0.06 * (T4 - 1), 9)\n// Fuel_efficiency_5 = max(8 + 0.02 * (T5 - 1), 8)\n// Total_fuel_consumption = (1000 / Fuel_efficiency_1) * T1 + (1000 / Fuel_efficiency_2) * T2 + (1000 / Fuel_efficiency_3) * T3 + (1000 / Fuel_efficiency_4) * T4 + (1000 / Fuel_efficiency_5) * T5\n// So, the objective function is: Minimize Total_fuel_consumption\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity of 30 trucks.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to each route to maintain service levels.\n// T1 >= 10; T2 >= 10; T3 >= 10; T4 >= 10; T5 >= 10\n\n## Generate Constraint-4:\nThe total distance covered by all trucks on route 1 must not exceed 5000 km.\n// T1 * 50 <= 5000",
        "question": "A logistics company operates five different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery times. The fuel efficiency of each route varies with the number of trucks. Route 1 has a base fuel efficiency of 10 km/l, which improves by 0.05 km/l for every additional truck. Route 2 has a base fuel efficiency of 12 km/l, improving by 0.04 km/l per additional truck. Route 3 has a base fuel efficiency of 11 km/l, improving by 0.03 km/l per additional truck. Route 4 has a base fuel efficiency of 9 km/l, improving by 0.06 km/l per additional truck. Route 5 has a base fuel efficiency of 8 km/l, improving by 0.02 km/l per additional truck. The company wants to minimize the total fuel consumption across all routes. The total number of trucks available is 100. Each route has a maximum capacity of 30 trucks. The company must ensure that at least 10 trucks are allocated to each route to maintain service levels. The total distance covered by all trucks on route 1 must not exceed 5000 km.\n\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10, ub=30) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=30) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=10, ub=30) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=10, ub=30) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=10, ub=30) # number of trucks on route 5\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_efficiency_1 = max(10 + 0.05 * (T1 - 1), 10)\nT1_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T1_eff1\", lb=0, ub=1)\nT1_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T1_eff2\", lb=1, ub=30)\nT1_b1 = model.addVar(vtype=\"B\", name=\"T1_b1\")\nT1_b2 = model.addVar(vtype=\"B\", name=\"T1_b2\")\nmodel.addCons(T1_b1 + T1_b2 == 1)\nmodel.addCons(T1 == T1_eff1*T1_b1 + T1_eff2*T1_b2)\nFuel_efficiency_1 = 10 * T1_b1 + (10 + 0.05 * (T1_eff2 - 1)) * T1_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_2 = max(12 + 0.04 * (T2 - 1), 12)\nT2_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T2_eff1\", lb=0, ub=1)\nT2_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T2_eff2\", lb=1, ub=30)\nT2_b1 = model.addVar(vtype=\"B\", name=\"T2_b1\")\nT2_b2 = model.addVar(vtype=\"B\", name=\"T2_b2\")\nmodel.addCons(T2_b1 + T2_b2 == 1)\nmodel.addCons(T2 == T2_eff1*T2_b1 + T2_eff2*T2_b2)\nFuel_efficiency_2 = 12 * T2_b1 + (12 + 0.04 * (T2_eff2 - 1)) * T2_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_3 = max(11 + 0.03 * (T3 - 1), 11)\nT3_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T3_eff1\", lb=0, ub=1)\nT3_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T3_eff2\", lb=1, ub=30)\nT3_b1 = model.addVar(vtype=\"B\", name=\"T3_b1\")\nT3_b2 = model.addVar(vtype=\"B\", name=\"T3_b2\")\nmodel.addCons(T3_b1 + T3_b2 == 1)\nmodel.addCons(T3 == T3_eff1*T3_b1 + T3_eff2*T3_b2)\nFuel_efficiency_3 = 11 * T3_b1 + (11 + 0.03 * (T3_eff2 - 1)) * T3_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_4 = max(9 + 0.06 * (T4 - 1), 9)\nT4_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T4_eff1\", lb=0, ub=1)\nT4_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T4_eff2\", lb=1, ub=30)\nT4_b1 = model.addVar(vtype=\"B\", name=\"T4_b1\")\nT4_b2 = model.addVar(vtype=\"B\", name=\"T4_b2\")\nmodel.addCons(T4_b1 + T4_b2 == 1)\nmodel.addCons(T4 == T4_eff1*T4_b1 + T4_eff2*T4_b2)\nFuel_efficiency_4 = 9 * T4_b1 + (9 + 0.06 * (T4_eff2 - 1)) * T4_b2\n## create piecewise variables for piecewise function: Fuel_efficiency_5 = max(8 + 0.02 * (T5 - 1), 8)\nT5_eff1 = model.addVar(vtype=\"INTEGER\", name=\"T5_eff1\", lb=0, ub=1)\nT5_eff2 = model.addVar(vtype=\"INTEGER\", name=\"T5_eff2\", lb=1, ub=30)\nT5_b1 = model.addVar(vtype=\"B\", name=\"T5_b1\")\nT5_b2 = model.addVar(vtype=\"B\", name=\"T5_b2\")\nmodel.addCons(T5_b1 + T5_b2 == 1)\nmodel.addCons(T5 == T5_eff1*T5_b1 + T5_eff2*T5_b2)\nFuel_efficiency_5 = 8 * T5_b1 + (8 + 0.02 * (T5_eff2 - 1)) * T5_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Total_fuel_consumption\nTotal_fuel_consumption = (1000 / Fuel_efficiency_1) * T1 + (1000 / Fuel_efficiency_2) * T2 + (1000 / Fuel_efficiency_3) * T3 + (1000 / Fuel_efficiency_4) * T4 + (1000 / Fuel_efficiency_5) * T5\nmodel.addCons(obj == Total_fuel_consumption)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(T1 * 50 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\n// Corn <= Wheat + Soybeans",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk. The farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans. Please help the farmer to determine the optimal allocation of acres to each crop to maximize the Profit-Risk ratio per acre.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n## Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\nmodel.addCons(Corn <= Wheat + Soybeans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product to maximize profit while considering the production costs, which vary nonlinearly with the quantity produced. Additionally, the company must allocate a budget for marketing each product to enhance sales.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the production quantity and the marketing budget. The profit function is nonlinear and is given by:\n- Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n- Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n- Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total marketing budget available for all products is $100,000.\n// MA + MB + MC <= 100000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited. The maximum quantities that can be produced are 500 for ProductA, 400 for ProductB, and 300 for ProductC.\n// QA <= 500; QB <= 400; QC <= 300\n\n## Generate Constraint-3:\nThe company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB.\n// MA >= 20000; MB >= 30000\n\n## Generate Constraint-4:\nDue to market saturation, the total quantity of all products produced must not exceed 1000 units.\n// QA + QB + QC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantities of each product and the marketing budgets to maximize profit. The profit from each product is influenced by the production quantity and the marketing budget, and the profit function is nonlinear. The profit functions for each product are given in the following Table.\n\n| Product | Profit Function |\n|---------|-----------------|\n| ProductA | (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA |\n| ProductB | (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB |\n| ProductC | (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC |\n\nThe company has a total marketing budget of $100,000. The production capacity for each product is limited to 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC. The company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB. Due to market saturation, the total quantity of all products produced must not exceed 1000 units.\n\nPlease help the company to maximize the total profit from all products by determining the optimal production quantities and marketing budgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0, ub=400) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=300) # quantity of ProductC\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=20000) # marketing budget for ProductA\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=30000) # marketing budget for ProductB\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## The profit function is nonlinear and is given by:\n## - Profit_A = (100 * QA - 0.01 * QA^2 + 0.1 * MA) * QA\n## - Profit_B = (120 * QB - 0.02 * QB^2 + 0.15 * MB) * QB\n## - Profit_C = (150 * QC - 0.03 * QC^2 + 0.2 * MC) * QC\n## The company aims to maximize the total profit from all products.\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (100 * QA - 0.01 * QA**2 + 0.1 * MA) * QA\nProfit_B = (120 * QB - 0.02 * QB**2 + 0.15 * MB) * QB\nProfit_C = (150 * QC - 0.03 * QC**2 + 0.2 * MC) * QC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total marketing budget available for all products is $100,000.\nmodel.addCons(MA + MB + MC <= 100000)\n## The production capacity for each product is limited.\nmodel.addCons(QA <= 500)\nmodel.addCons(QB <= 400)\nmodel.addCons(QC <= 300)\n## The company must allocate at least $20,000 to marketing ProductA and $30,000 to marketing ProductB.\nmodel.addCons(MA >= 20000)\nmodel.addCons(MB >= 30000)\n## Due to market saturation, the total quantity of all products produced must not exceed 1000 units.\nmodel.addCons(QA + QB + QC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices.\n// Profit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R&D)) * DeviceA\n// Profit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R&D)) * DeviceB\n// Profit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R&D)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation and R&D cannot exceed $50,000.\n// Automation + R&D <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\n// DeviceA <= 500; DeviceB <= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 units of DeviceC are produced to maintain a presence in the high-end market.\n// DeviceC >= 100\n\n## Generate Constraint-5:\nThe level of automation must be at least 50 units to ensure the efficiency of the production process.\n// Automation >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit. The production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices. The company has a total production capacity of 1000 units. The total investment in automation and R&D cannot exceed $50,000. Due to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units. The company must ensure that at least 100 units of DeviceC are produced to maintain a presence in the high-end market. The level of automation must be at least 50 units to ensure the efficiency of the production process. Please help the company to determine the optimal production quantities, level of automation, and investment in R&D to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0, ub=500)  # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0, ub=400)  # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=100, ub=1000)  # quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=50)  # level of automation\nR_and_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0)  # investment in R&D\n\n# Define objective function\nProfit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R_and_D)) * DeviceA\nProfit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R_and_D)) * DeviceB\nProfit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R_and_D)) * DeviceC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)  # total production capacity\nmodel.addCons(Automation + R_and_D <= 50000)  # total investment in automation and R&D\nmodel.addCons(DeviceA <= 500)  # market demand for DeviceA\nmodel.addCons(DeviceB <= 400)  # market demand for DeviceB\nmodel.addCons(DeviceC >= 100)  # maintain presence in high-end market\nmodel.addCons(Automation >= 50)  # level of automation\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Investment in R&D: \", model.getVal(R_and_D))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1557,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the revenue per truck per trip is $1000, the fuel cost per trip is $200, and the maintenance cost per truck per year is $1000. \nFor T2, the revenue per truck per trip is $1200, the fuel cost per trip is $250, and the maintenance cost per truck per year is $1200. \nFor T3, the revenue per truck per trip is $1400, the fuel cost per trip is $300, and the maintenance cost per truck per year is $1400.\nFor T4, the revenue per truck per trip is $1600, the fuel cost per trip is $350, and the maintenance cost per truck per year is $1600.\nFor T5, the revenue per truck per trip is $1800, the fuel cost per trip is $400, and the maintenance cost per truck per year is $1800.\nThe company wants to maximize the net profit per truck per year.\n// Profit_T1 = (1000 - 200) * T1 - 1000 * T1\n// Profit_T2 = (1200 - 250) * T2 - 1200 * T2\n// Profit_T3 = (1400 - 300) * T3 - 1400 * T3\n// Profit_T4 = (1600 - 350) * T4 - 1600 * T4\n// Profit_T5 = (1800 - 400) * T5 - 1800 * T5\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for purchasing new trucks.\n// 1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000\n\n## Generate Constraint-2:\nThe total number of trips available for all trucks is limited to 1000 trips per year.\n// T1 + T2 + T3 + T4 + T5 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the total cargo capacity of all trucks must not exceed 500 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 500\n\n## Generate Constraint-4:\nThe company must ensure at least 10% of its fleet is composed of T1 trucks for local deliveries.\n// T1 >= 0.10 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-5:\nThe company has a maintenance capacity limit of 100 trucks per year.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to maximize profit while considering operational constraints.\nFor T1, the revenue per truck per trip is $1000, the fuel cost per trip is $200, and the maintenance cost per truck per year is $1000. \nFor T2, the revenue per truck per trip is $1200, the fuel cost per trip is $250, and the maintenance cost per truck per year is $1200. \nFor T3, the revenue per truck per trip is $1400, the fuel cost per trip is $300, and the maintenance cost per truck per year is $1400.\nFor T4, the revenue per truck per trip is $1600, the fuel cost per trip is $350, and the maintenance cost per truck per year is $1600.\nFor T5, the revenue per truck per trip is $1800, the fuel cost per trip is $400, and the maintenance cost per truck per year is $1800.\nThe company has a total budget of $50,000 for purchasing new trucks. The total number of trips available for all trucks is limited to 1000 trips per year. Due to safety regulations, the total cargo capacity of all trucks must not exceed 500 tons. The company must ensure at least 10% of its fleet is composed of T1 trucks for local deliveries. The company has a maintenance capacity limit of 100 trucks per year.\nPlease help the company to maximize the net profit per truck per year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\nProfit_T1 = (1000 - 200) * T1 - 1000 * T1\nProfit_T2 = (1200 - 250) * T2 - 1200 * T2\nProfit_T3 = (1400 - 300) * T3 - 1400 * T3\nProfit_T4 = (1600 - 350) * T4 - 1600 * T4\nProfit_T5 = (1800 - 400) * T5 - 1800 * T5\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\n# The company has a total budget of $50,000 for purchasing new trucks.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1400 * T3 + 1600 * T4 + 1800 * T5 <= 50000)\n# The total number of trips available for all trucks is limited to 1000 trips per year.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 1000)\n# Due to safety regulations, the total cargo capacity of all trucks must not exceed 500 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 500)\n# The company must ensure at least 10% of its fleet is composed of T1 trucks for local deliveries.\nmodel.addCons(T1 >= 0.10 * (T1 + T2 + T3 + T4 + T5))\n# The company has a maintenance capacity limit of 100 trucks per year.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Net Profit per Truck per Year: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1461,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods (Electronics, Clothing, and Food). The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries.\n// {\"number of trucks for Electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Clothing\": \"ClothingTrucks\", \"range\": \"ClothingTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Food\": \"FoodTrucks\", \"range\": \"FoodTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Electronics\": \"ElectronicsTripsPerTruck\", \"range\": \"ElectronicsTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Clothing\": \"ClothingTripsPerTruck\", \"range\": \"ClothingTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Food\": \"FoodTripsPerTruck\", \"range\": \"FoodTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for Electronics is $100, for Clothing is $70, and for Food is $50. The fuel cost per trip for Electronics is $20, for Clothing is $15, and for Food is $10. The company aims to maximize its net daily profit.\n// Profit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\n// Profit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\n// Profit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Clothing + Profit_Food)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000\n\n## Generate Constraint-3:\nThe company can handle a maximum of 200 trips per day.\n// ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck <= 200\n\n## Generate Constraint-4:\nThe company must ensure that at least 30% of the trips are for Food, due to contractual obligations.\n// FoodTrucks * FoodTripsPerTruck >= 0.3 * (ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck)",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: Electronics, Clothing, and Food. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The profit and fuel cost per trip for each type of goods are given in the following Table.\n\n| Type of Goods | Profit per Trip | Fuel Cost per Trip |\n|---------------|-----------------|--------------------|\n| Electronics   | $100            | $20                |\n| Clothing      | $70             | $15                |\n| Food          | $50             | $10                |\n\nThe company has a total of 50 trucks available. The company has a daily fuel budget of $1000. The company can handle a maximum of 200 trips per day. The company must ensure that at least 30% of the trips are for Food, due to contractual obligations. \nPlease help the company to maximize its net daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nClothingTrucks = model.addVar(vtype=\"INTEGER\", name=\"ClothingTrucks\", lb=0)\nFoodTrucks = model.addVar(vtype=\"INTEGER\", name=\"FoodTrucks\", lb=0)\nElectronicsTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTripsPerTruck\", lb=0)\nClothingTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"ClothingTripsPerTruck\", lb=0)\nFoodTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"FoodTripsPerTruck\", lb=0)\n\n# Define objective function\nProfit_Electronics = ElectronicsTrucks * ElectronicsTripsPerTruck * (100 - 20)\nProfit_Clothing = ClothingTrucks * ClothingTripsPerTruck * (70 - 15)\nProfit_Food = FoodTrucks * FoodTripsPerTruck * (50 - 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Clothing + Profit_Food)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + ClothingTrucks + FoodTrucks <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTripsPerTruck + 15 * ClothingTrucks * ClothingTripsPerTruck + 10 * FoodTrucks * FoodTripsPerTruck <= 1000)\nmodel.addCons(ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck <= 200)\nmodel.addCons(FoodTrucks * FoodTripsPerTruck >= 0.3 * (ElectronicsTrucks * ElectronicsTripsPerTruck + ClothingTrucks * ClothingTripsPerTruck + FoodTrucks * FoodTripsPerTruck))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Clothing: \", model.getVal(ClothingTrucks))\n    print(\"Number of Trucks for Food: \", model.getVal(FoodTrucks))\n    print(\"Trips per Truck for Electronics: \", model.getVal(ElectronicsTripsPerTruck))\n    print(\"Trips per Truck for Clothing: \", model.getVal(ClothingTripsPerTruck))\n    print(\"Trips per Truck for Food: \", model.getVal(FoodTripsPerTruck))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Smartwatches\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wireless Earbuds\": \"WirelessEarbuds\", \"range\": \"WirelessEarbuds >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company aims to maximize the total profit from the sales of these devices.\n// Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\n// Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\n// Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\n// Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\n// Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all devices.\n// Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000",
        "question": "A manufacturing company produces five types of electronic devices: Smartphones, Tablets, Laptops, Smartwatches, and Wireless Earbuds. The company needs to optimize the production quantities of each device to maximize profit while considering various constraints. The profit per unit for Smartphones is $100, for Tablets is $200, for Laptops is $300, for Smartwatches is $50, and for Wireless Earbuds is $30. Due to economies of scale, the profit per unit increases by $0.1 for each device type for every 100 units produced beyond that threshold. The company has a total production capacity of 1000 units across all devices.\nPlease help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nWirelessEarbuds = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphones = max(100 + 0.1 * (Smartphones - 100), 100) * Smartphones\nSmartphones1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones1\", lb=0, ub=100)\nSmartphones2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphones2\", lb=100, ub=1000)\nSmartphones_b1 = model.addVar(vtype=\"B\", name=\"Smartphones_b1\")\nSmartphones_b2 = model.addVar(vtype=\"B\", name=\"Smartphones_b2\")\nmodel.addCons(Smartphones_b1 + Smartphones_b2 == 1)\nmodel.addCons(Smartphones == Smartphones1*Smartphones_b1 + Smartphones2*Smartphones_b2)\nProfit_Smartphones = 100 * Smartphones1 * Smartphones_b1 + (100 + 0.1 * (Smartphones2 - 100)) * Smartphones2 * Smartphones_b2\n\n## create piecewise variables for piecewise function: Profit_Tablets = max(200 + 0.1 * (Tablets - 100), 200) * Tablets\nTablets1 = model.addVar(vtype=\"INTEGER\", name=\"Tablets1\", lb=0, ub=100)\nTablets2 = model.addVar(vtype=\"INTEGER\", name=\"Tablets2\", lb=100, ub=1000)\nTablets_b1 = model.addVar(vtype=\"B\", name=\"Tablets_b1\")\nTablets_b2 = model.addVar(vtype=\"B\", name=\"Tablets_b2\")\nmodel.addCons(Tablets_b1 + Tablets_b2 == 1)\nmodel.addCons(Tablets == Tablets1*Tablets_b1 + Tablets2*Tablets_b2)\nProfit_Tablets = 200 * Tablets1 * Tablets_b1 + (200 + 0.1 * (Tablets2 - 100)) * Tablets2 * Tablets_b2\n\n## create piecewise variables for piecewise function: Profit_Laptops = max(300 + 0.1 * (Laptops - 100), 300) * Laptops\nLaptops1 = model.addVar(vtype=\"INTEGER\", name=\"Laptops1\", lb=0, ub=100)\nLaptops2 = model.addVar(vtype=\"INTEGER\", name=\"Laptops2\", lb=100, ub=1000)\nLaptops_b1 = model.addVar(vtype=\"B\", name=\"Laptops_b1\")\nLaptops_b2 = model.addVar(vtype=\"B\", name=\"Laptops_b2\")\nmodel.addCons(Laptops_b1 + Laptops_b2 == 1)\nmodel.addCons(Laptops == Laptops1*Laptops_b1 + Laptops2*Laptops_b2)\nProfit_Laptops = 300 * Laptops1 * Laptops_b1 + (300 + 0.1 * (Laptops2 - 100)) * Laptops2 * Laptops_b2\n\n## create piecewise variables for piecewise function: Profit_Smartwatches = max(50 + 0.1 * (Smartwatches - 100), 50) * Smartwatches\nSmartwatches1 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches1\", lb=0, ub=100)\nSmartwatches2 = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches2\", lb=100, ub=1000)\nSmartwatches_b1 = model.addVar(vtype=\"B\", name=\"Smartwatches_b1\")\nSmartwatches_b2 = model.addVar(vtype=\"B\", name=\"Smartwatches_b2\")\nmodel.addCons(Smartwatches_b1 + Smartwatches_b2 == 1)\nmodel.addCons(Smartwatches == Smartwatches1*Smartwatches_b1 + Smartwatches2*Smartwatches_b2)\nProfit_Smartwatches = 50 * Smartwatches1 * Smartwatches_b1 + (50 + 0.1 * (Smartwatches2 - 100)) * Smartwatches2 * Smartwatches_b2\n\n## create piecewise variables for piecewise function: Profit_WirelessEarbuds = max(30 + 0.1 * (WirelessEarbuds - 100), 30) * WirelessEarbuds\nWirelessEarbuds1 = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds1\", lb=0, ub=100)\nWirelessEarbuds2 = model.addVar(vtype=\"INTEGER\", name=\"WirelessEarbuds2\", lb=100, ub=1000)\nWirelessEarbuds_b1 = model.addVar(vtype=\"B\", name=\"WirelessEarbuds_b1\")\nWirelessEarbuds_b2 = model.addVar(vtype=\"B\", name=\"WirelessEarbuds_b2\")\nmodel.addCons(WirelessEarbuds_b1 + WirelessEarbuds_b2 == 1)\nmodel.addCons(WirelessEarbuds == WirelessEarbuds1*WirelessEarbuds_b1 + WirelessEarbuds2*WirelessEarbuds_b2)\nProfit_WirelessEarbuds = 30 * WirelessEarbuds1 * WirelessEarbuds_b1 + (30 + 0.1 * (WirelessEarbuds2 - 100)) * WirelessEarbuds2 * WirelessEarbuds_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Smartwatches + Profit_WirelessEarbuds)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + WirelessEarbuds <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Quantity of Wireless Earbuds: \", model.getVal(WirelessEarbuds))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable, non-perishable, and hazardous materials. The company needs to determine the number of trucks to allocate for each type of goods to maximize efficiency and minimize costs.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"cost per mile for perishable goods\": \"CostPerishable\", \"range\": \"CostPerishable >= 0\", \"type\": \"real\"}\n// {\"cost per mile for non-perishable goods\": \"CostNonPerishable\", \"range\": \"CostNonPerishable >= 0\", \"type\": \"real\"}\n// {\"cost per mile for hazardous materials\": \"CostHazardous\", \"range\": \"CostHazardous >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost per mile for transporting perishable goods is $2, for non-perishable goods is $1.5, and for hazardous materials is $3. The company wants to minimize the total cost of transportation per mile.\n// Total cost for perishable goods: Cost_Perishable = CostPerishable * PerishableTrucks\n// Total cost for non-perishable goods: Cost_NonPerishable = CostNonPerishable * NonPerishableTrucks\n// Total cost for hazardous materials: Cost_Hazardous = CostHazardous * HazardousTrucks\n// So, the objective function is: Minimize (Cost_Perishable + Cost_NonPerishable + Cost_Hazardous)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 50\n\n## Generate Constraint-2:\nDue to safety regulations, the number of trucks carrying hazardous materials must not exceed 20% of the total fleet.\n// HazardousTrucks <= 0.2 * (PerishableTrucks + NonPerishableTrucks + HazardousTrucks)",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: perishable, non-perishable, and hazardous materials. The company needs to determine the number of trucks to allocate for each type of goods to maximize efficiency and minimize costs. The cost per mile for transporting perishable goods is $2, for non-perishable goods is $1.5, and for hazardous materials is $3. The company wants to minimize the total cost of transportation per mile. The company has a total of 50 trucks available. Due to safety regulations, the number of trucks carrying hazardous materials must not exceed 20% of the total fleet. Please help the company to determine the optimal allocation of trucks for each type of goods.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0) # number of trucks for perishable goods\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0) # number of trucks for non-perishable goods\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0) # number of trucks for hazardous materials\n\n# Define objective function\nCostPerishable = 2\nCostNonPerishable = 1.5\nCostHazardous = 3\nCost_Perishable = CostPerishable * PerishableTrucks\nCost_NonPerishable = CostNonPerishable * NonPerishableTrucks\nCost_Hazardous = CostHazardous * HazardousTrucks\n# So, the objective function is: Minimize (Cost_Perishable + Cost_NonPerishable + Cost_Hazardous)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Perishable + Cost_NonPerishable + Cost_Hazardous)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 50)\n# Due to safety regulations, the number of trucks carrying hazardous materials must not exceed 20% of the total fleet.\nmodel.addCons(HazardousTrucks <= 0.2 * (PerishableTrucks + NonPerishableTrucks + HazardousTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Non-Perishable Goods: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Trucks for Hazardous Materials: \", model.getVal(HazardousTrucks))\n    print(\"Minimized Total Cost per Mile: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines.\n// The total production per hour: P = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach machine has a maximum capacity for workers. Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\n// W1 <= 10; W2 <= 12; W3 <= 15; W4 <= 18; W5 <= 20\n\n## Generate Constraint-3:\nThe plant must produce at least 500 units of component 1, 600 units of component 2, and 700 units of component 3. The production rates of components 1, 2, and 3 are proportional to the number of workers on each machine.\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 500 (for component 1)\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 600 (for component 2)\n// 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5 >= 700 (for component 3)",
        "question": "A manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines. There are a total of 50 workers available. Each machine has a maximum capacity for workers: Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers. The plant must produce at least 500 units of component 1, 600 units of component 2, and 700 units of component 3. The production rates of components 1, 2, and 3 are proportional to the number of workers on each machine. Please help the plant manager to determine the optimal number of workers to allocate to each machine to achieve these goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50) # total workers constraint\nmodel.addCons(W1 <= 10) # capacity of machine 1\nmodel.addCons(W2 <= 12) # capacity of machine 2\nmodel.addCons(W3 <= 15) # capacity of machine 3\nmodel.addCons(W4 <= 18) # capacity of machine 4\nmodel.addCons(W5 <= 20) # capacity of machine 5\nmodel.addCons(P >= 500) # minimum production for component 1\nmodel.addCons(P >= 600) # minimum production for component 2\nmodel.addCons(P >= 700) # minimum production for component 3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(W4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(W5))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and technology investments.\n// FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to Route1 and invest at least $10,000 in fuel-efficient technologies for Route2.\n// Trucks1 >= 100; TechInvest2 >= 10000\n\n## Generate Constraint-4:\nThe fuel optimization for each route must not exceed the maximum capacity of the fuel systems, which is 20 units for Route1 and 25 units for Route2.\n// FuelOpt1 <= 20; FuelOpt2 <= 25",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption. The fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\n\nThe company has a total budget of $100,000 for fuel optimization and technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to Route1 and invest at least $10,000 in fuel-efficient technologies for Route2. The fuel optimization for each route must not exceed the maximum capacity of the fuel systems, which is 20 units for Route1 and 25 units for Route2.\n\nPlease help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nFuelOpt1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt1\", lb=0)  # fuel optimization for Route1\nFuelOpt2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelOpt2\", lb=0)  # fuel optimization for Route2\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technology for Route1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=10000)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\nConsumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\nConsumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\nmodel.addCons(FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 <= 500)\nmodel.addCons(Trucks1 >= 100)\nmodel.addCons(FuelOpt1 <= 20)\nmodel.addCons(FuelOpt2 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1287,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for RouteA\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"continuous\"}\n// {\"speed of trucks for RouteB\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteA\": \"FuelEfficiencyA\", \"range\": \"FuelEfficiencyA > 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks for RouteB\": \"FuelEfficiencyB\", \"range\": \"FuelEfficiencyB > 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteA\": \"TechInvestA\", \"range\": \"TechInvestA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency technology for RouteB\": \"TechInvestB\", \"range\": \"TechInvestB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks.\n// Fuel cost for RouteA: FuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\n// Fuel cost for RouteB: FuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\n// Depreciation cost for RouteA: DepreciationCostA = 0.01 * TrucksA * SpeedA^2\n// Depreciation cost for RouteB: DepreciationCostB = 0.01 * TrucksB * SpeedB^2\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs.\n// TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is 50.\n// TrucksA + TrucksB <= 50",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route, the speed at which each truck will travel, and the fuel efficiency of each truck. The company also needs to decide on the investment in new technology to improve fuel efficiency, which varies for each route. The company aims to minimize the total operational cost, which includes fuel cost and depreciation cost due to speed. The fuel cost is inversely proportional to the fuel efficiency and directly proportional to the speed and the number of trucks. The depreciation cost increases quadratically with the speed of the trucks. The company has a total budget of $100,000 for investments in fuel efficiency technology and operational costs. The total number of trucks available for allocation is 50. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for RouteB\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # speed of trucks for RouteA\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # speed of trucks for RouteB\nFuelEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyA\", lb=0)  # fuel efficiency of trucks for RouteA\nFuelEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyB\", lb=0)  # fuel efficiency of trucks for RouteB\nTechInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestA\", lb=0)  # investment in fuel efficiency technology for RouteA\nTechInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestB\", lb=0)  # investment in fuel efficiency technology for RouteB\n\n# Define objective function\nFuelCostA = (TrucksA * SpeedA) / (FuelEfficiencyA + TechInvestA)\nFuelCostB = (TrucksB * SpeedB) / (FuelEfficiencyB + TechInvestB)\nDepreciationCostA = 0.01 * TrucksA * SpeedA**2\nDepreciationCostB = 0.01 * TrucksB * SpeedB**2\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB)\n\n# Add constraints\nmodel.addCons(TechInvestA + TechInvestB + FuelCostA + FuelCostB + DepreciationCostA + DepreciationCostB <= 100000)\nmodel.addCons(TrucksA + TrucksB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Speed of Trucks for RouteA: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for RouteB: \", model.getVal(SpeedB))\n    print(\"Fuel Efficiency of Trucks for RouteA: \", model.getVal(FuelEfficiencyA))\n    print(\"Fuel Efficiency of Trucks for RouteB: \", model.getVal(FuelEfficiencyB))\n    print(\"Investment in Tech for RouteA: \", model.getVal(TechInvestA))\n    print(\"Investment in Tech for RouteB: \", model.getVal(TechInvestB))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company can invest in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"hours of operation for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency upgrade for Solar plant\": \"Efficiency_Solar\", \"range\": \"Efficiency_Solar >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Wind plant\": \"Efficiency_Wind\", \"range\": \"Efficiency_Wind >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Hydro plant\": \"Efficiency_Hydro\", \"range\": \"Efficiency_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company aims to maximize the total daily energy production from all plants.\n// Total energy output for Solar: Output_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\n// Total energy output for Wind: Output_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\n// Total energy output for Hydro: Output_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Output_Solar + Output_Wind + Output_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for daily operations and efficiency upgrades.\n// Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000\n\n## Generate Constraint-2:\nDue to maintenance and operational constraints, each plant can operate for a maximum of 24 hours daily.\n// Hours_Solar <= 24; Hours_Wind <= 24; Hours_Hydro <= 24\n\n## Generate Constraint-3:\nThe total energy output from all plants must meet a minimum daily requirement of 2000 kWh.\n// Output_Solar + Output_Wind + Output_Hydro >= 2000\n\n## Generate Constraint-4:\nThe investment in efficiency upgrades for each plant must not exceed $20,000.\n// Efficiency_Solar <= 20000; Efficiency_Wind <= 20000; Efficiency_Hydro <= 20000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the amount to invest in upgrading the efficiency of each plant to maximize energy production. The energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company has a budget of $100,000 for daily operations and efficiency upgrades. Each plant can operate for a maximum of 24 hours daily. The total energy output from all plants must meet a minimum daily requirement of 2000 kWh. The investment in efficiency upgrades for each plant must not exceed $20,000. Please help the company to maximize the total daily energy production from all plants.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=0)  # hours of operation for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=0)  # hours of operation for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=0)  # hours of operation for Hydro plant\nEfficiency_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Solar\", lb=0)  # investment in efficiency upgrade for Solar plant\nEfficiency_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Wind\", lb=0)  # investment in efficiency upgrade for Wind plant\nEfficiency_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Hydro\", lb=0)  # investment in efficiency upgrade for Hydro plant\n\n# Define objective function\nOutput_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\nOutput_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\nOutput_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n# So, the objective function is: Maximize (Output_Solar + Output_Wind + Output_Hydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output_Solar + Output_Wind + Output_Hydro)\n\n# Add constraints\n# The company has a budget of $100,000 for daily operations and efficiency upgrades.\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000)\n# Due to maintenance and operational constraints, each plant can operate for a maximum of 24 hours daily.\nmodel.addCons(Hours_Solar <= 24)\nmodel.addCons(Hours_Wind <= 24)\nmodel.addCons(Hours_Hydro <= 24)\n# The total energy output from all plants must meet a minimum daily requirement of 2000 kWh.\nmodel.addCons(Output_Solar + Output_Wind + Output_Hydro >= 2000)\n# The investment in efficiency upgrades for each plant must not exceed $20,000.\nmodel.addCons(Efficiency_Solar <= 20000)\nmodel.addCons(Efficiency_Wind <= 20000)\nmodel.addCons(Efficiency_Hydro <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(Hours_Solar))\n    print(\"Hours of operation for Wind plant: \", model.getVal(Hours_Wind))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(Hours_Hydro))\n    print(\"Investment in efficiency upgrade for Solar plant: \", model.getVal(Efficiency_Solar))\n    print(\"Investment in efficiency upgrade for Wind plant: \", model.getVal(Efficiency_Wind))\n    print(\"Investment in efficiency upgrade for Hydro plant: \", model.getVal(Efficiency_Hydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product A\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product B\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product C\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50 - WorkersA * 100\n// Profit_B = UnitsB * 70 - WorkersB * 120\n// Profit_C = UnitsC * 60 - WorkersC * 110\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line. The profit per unit of product A is $50, product B is $70, and product C is $60. The labor cost per worker per day is $100 for product A, $120 for product B, and $110 for product C. The company wants to maximize the total daily profit. The company has a total of 50 workers available.\nPlease help the company determine the optimal production quantity of each product and the number of workers assigned to each product line to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for product A\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for product B\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - WorkersA * 100\nProfit_B = UnitsB * 70 - WorkersB * 120\nProfit_C = UnitsC * 60 - WorkersC * 110\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Workers for Product A: \", model.getVal(WorkersA))\n    print(\"Number of Workers for Product B: \", model.getVal(WorkersB))\n    print(\"Number of Workers for Product C: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 724,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in machine efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $5,000 invested in machine efficiency upgrades. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades.\n// Total revenue for ProductA: RevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductB: RevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\n// Total revenue for ProductC: RevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 20 machines available for the production of all products.\n// MachinesA + MachinesB + MachinesC <= 20\n\n## Generate Constraint-2:\nThe total investment in machine efficiency upgrades cannot exceed $100,000.\n// EfficiencyInvestment <= 100000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units.\n// QuantityA >= 500; QuantityB >= 400\n\n## Generate Constraint-4:\nThe company must ensure that at least 5 machines are allocated to ProductA and 6 machines to ProductB.\n// MachinesA >= 5; MachinesB >= 6",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product, the number of machines dedicated to each product, and the amount of money invested in enhancing machine efficiency. The efficiency of each machine is affected by the investment in upgrades, which reduces the production time per unit. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The production time per unit decreases by 1 minute for every $5,000 invested in machine efficiency upgrades.\n\n| Product | Initial Production Time (minutes) | Revenue per Unit |\n|---------|-----------------------------------|------------------|\n| ProductA | 30                                | $100             |\n| ProductB | 25                                | $120             |\n| ProductC | 20                                | $150             |\n\nThe company has a total of 20 machines available for the production of all products. The total investment in machine efficiency upgrades cannot exceed $100,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 400 units. The company must ensure that at least 5 machines are allocated to ProductA and 6 machines to ProductB.\n\nPlease help the company to maximize the total revenue from all products, considering the reduced production time due to efficiency upgrades.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=400)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)     # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=5)    # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=6)    # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)    # number of machines for ProductC\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in machine efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenueA = (100 * QuantityA) / (30 - 0.0002 * EfficiencyInvestment)\nRevenueB = (120 * QuantityB) / (25 - 0.0002 * EfficiencyInvestment)\nRevenueC = (150 * QuantityC) / (20 - 0.0002 * EfficiencyInvestment)\n## convert the division to multiplication\nmodel.addCons(obj * (30 - 0.0002 * EfficiencyInvestment) == 100 * QuantityA)\nmodel.addCons(obj * (25 - 0.0002 * EfficiencyInvestment) == 120 * QuantityB)\nmodel.addCons(obj * (20 - 0.0002 * EfficiencyInvestment) == 150 * QuantityC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 20)\nmodel.addCons(EfficiencyInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Machine Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1591,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"0 <= Automation <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost per unit by $0.5 for every unit of automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize the total profit.\n// CostA = (100 - 0.5 * Automation) * QA\n// CostB = (150 - 0.5 * Automation) * QB\n// CostC = (200 - 0.5 * Automation) * QC\n// RevenueA = 150 * QA\n// RevenueB = 200 * QB\n// RevenueC = 250 * QC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for implementing automation.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 1000 units.\n// QA + QB + QC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost and revenue for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| ProductA | $100 - $0.5 * Automation | $150 |\n| ProductB | $150 - $0.5 * Automation | $200 |\n| ProductC | $200 - $0.5 * Automation | $250 |\n\nThe company has a budget of $50,000 for implementing automation. The total production capacity for all products is 1000 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nCostA = (100 - 0.5 * Automation) * QA\nCostB = (150 - 0.5 * Automation) * QB\nCostC = (200 - 0.5 * Automation) * QC\nRevenueA = 150 * QA\nRevenueB = 200 * QB\nRevenueC = 250 * QC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a budget of $50,000 for implementing automation.\nmodel.addCons(Automation <= 50000)\n# The total production capacity for all products is 1000 units.\nmodel.addCons(QA + QB + QC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for ProductA\": \"TechUpgradeA\", \"range\": \"TechUpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductB\": \"TechUpgradeB\", \"range\": \"TechUpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for ProductC\": \"TechUpgradeC\", \"range\": \"TechUpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The base production rate for ProductA is 100 units per machine per day, for ProductB is 120 units per machine per day, and for ProductC is 150 units per machine per day. The profit per unit is $50 for ProductA, $60 for ProductB, and $70 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n// Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n// Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 40 machines available.\n// MachinesA + MachinesB + MachinesC <= 40\n\n## Generate Constraint-2:\nThe total investment in technology upgrades cannot exceed $50,000.\n// TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units.\n// QuantityA >= 500; QuantityB >= 600",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of technology upgrade for each product to enhance production efficiency. The technology upgrade cost varies with the type of product and directly affects the production rate. The base production rate and profit per unit for each product are given in the following Table.\n\n| Product | Base Production Rate (units/machine/day) | Profit per Unit |\n|---------|------------------------------------------|-----------------|\n| ProductA | 100                                      | $50             |\n| ProductB | 120                                      | $60             |\n| ProductC | 150                                      | $70             |\n\nThe production rate of each product increases by 5% for every $10,000 invested in technology upgrades. The company has a total of 40 machines available. The total investment in technology upgrades cannot exceed $50,000. Due to market demand, the production quantity of ProductA must be at least 500 units, and ProductB must be at least 600 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=600) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ProductC\nTechUpgradeA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeA\", lb=0) # technology upgrade for ProductA\nTechUpgradeB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeB\", lb=0) # technology upgrade for ProductB\nTechUpgradeC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeC\", lb=0) # technology upgrade for ProductC\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (50 * QuantityA) = (50 * (100 + 0.05 * TechUpgradeA) * MachinesA)\n## Total profit for ProductB: ProfitB = (60 * QuantityB) = (60 * (120 + 0.05 * TechUpgradeB) * MachinesB)\n## Total profit for ProductC: ProfitC = (70 * QuantityC) = (70 * (150 + 0.05 * TechUpgradeC) * MachinesC)\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = 50 * (100 + 0.05 * TechUpgradeA) * MachinesA\nProfitB = 60 * (120 + 0.05 * TechUpgradeB) * MachinesB\nProfitC = 70 * (150 + 0.05 * TechUpgradeC) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 40 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 40)\n## The total investment in technology upgrades cannot exceed $50,000.\nmodel.addCons(TechUpgradeA + TechUpgradeB + TechUpgradeC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Technology Upgrade for ProductA: \", model.getVal(TechUpgradeA))\n    print(\"Technology Upgrade for ProductB: \", model.getVal(TechUpgradeB))\n    print(\"Technology Upgrade for ProductC: \", model.getVal(TechUpgradeC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints.\n// {\"production quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_ProductA = (50 - 10) * ProductA\n// Total net profit for ProductB: Profit_ProductB = (70 - 15) * ProductB\n// Total net profit for ProductC: Profit_ProductC = (90 - 20) * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a limited warehouse space, which can store a maximum of 1000 units in total.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductB must be at least twice the production of ProductA.\n// ProductB >= 2 * ProductA",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product to maximize profit while considering various costs and constraints. The profit per unit of ProductA is $50, but it incurs a storage cost of $10 per unit. The profit per unit of ProductB is $70, with a storage cost of $15 per unit. The profit per unit of ProductC is $90, with a storage cost of $20 per unit. The company aims to maximize the total net profit from all products. The company has a limited warehouse space, which can store a maximum of 1000 units in total. Due to market demand, the production of ProductB must be at least twice the production of ProductA. Please help the company determine the optimal production quantities for ProductA, ProductB, and ProductC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_ProductA = (50 - 10) * ProductA\nProfit_ProductB = (70 - 15) * ProductB\nProfit_ProductC = (90 - 20) * ProductC\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n## The company has a limited warehouse space, which can store a maximum of 1000 units in total.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n## Due to market demand, the production of ProductB must be at least twice the production of ProductA.\nmodel.addCons(ProductB >= 2 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs.\n// {\"number of trucks for ProductA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for ProductE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for ProductA is $500 per trip, and the revenue generated is $1000 per trip. For ProductB, the cost is $600 per trip, and the revenue is $1200 per trip. For ProductC, the cost is $700 per trip, and the revenue is $1400 per trip. For ProductD, the cost is $800 per trip, and the revenue is $1600 per trip. For ProductE, the cost is $900 per trip, and the revenue is $1800 per trip. The company wants to maximize the total net profit from all products.\n// Total net profit for ProductA: Profit_A = (1000 - 500) * TruckA\n// Total net profit for ProductB: Profit_B = (1200 - 600) * TruckB\n// Total net profit for ProductC: Profit_C = (1400 - 700) * TruckC\n// Total net profit for ProductD: Profit_D = (1600 - 800) * TruckD\n// Total net profit for ProductE: Profit_E = (1800 - 900) * TruckE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for truck operations.\n// 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000\n\n## Generate Constraint-2:\nThe company can operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-3:\nDue to regional demand, at least 10 trucks must be allocated for ProductA.\n// TruckA >= 10\n\n## Generate Constraint-4:\nThe company aims to allocate at least 20% of the total trucks to ProductE.\n// TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE)",
        "question": "A logistics company is managing the distribution of five different products (ProductA, ProductB, ProductC, ProductD, ProductE) across various regions. The company needs to determine the optimal number of trucks to allocate for each product to maximize efficiency and minimize costs. The cost and revenue per trip for each product are given in the following Table.\n\n| Product | Cost per Trip | Revenue per Trip |\n|---------|---------------|------------------|\n| ProductA | $500         | $1000            |\n| ProductB | $600         | $1200            |\n| ProductC | $700         | $1400            |\n| ProductD | $800         | $1600            |\n| ProductE | $900         | $1800            |\n\nThe company has a total budget of $50,000 for truck operations. The company can operate a maximum of 100 trucks in total. Due to regional demand, at least 10 trucks must be allocated for ProductA. The company aims to allocate at least 20% of the total trucks to ProductE.\n\nPlease help the company to maximize the total net profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of trucks for ProductA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for ProductB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for ProductC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for ProductD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for ProductE\n\n# Define objective function\nProfit_A = (1000 - 500) * TruckA\nProfit_B = (1200 - 600) * TruckB\nProfit_C = (1400 - 700) * TruckC\nProfit_D = (1600 - 800) * TruckD\nProfit_E = (1800 - 900) * TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE <= 50000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckE >= 0.2 * (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for ProductA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for ProductB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for ProductC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for ProductD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for ProductE: \", model.getVal(TruckE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install a mix of renewable energy sources to power its public transportation system. The options include solar, wind, and hydroelectric power. The city needs to determine the number of solar panels, wind turbines, and hydroelectric plants to install, as well as the capacity of each type of installation.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"HydroPlants\", \"range\": \"HydroPlants >= 0\", \"type\": \"integer\"}\n// {\"capacity of each solar panel (kW)\": \"SolarCapacity\", \"range\": \"SolarCapacity >= 0\", \"type\": \"real\"}\n// {\"capacity of each wind turbine (kW)\": \"WindCapacity\", \"range\": \"WindCapacity >= 0\", \"type\": \"real\"}\n// {\"capacity of each hydroelectric plant (kW)\": \"HydroCapacity\", \"range\": \"HydroCapacity >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, a wind turbine is $2000, and a hydroelectric plant is $5000. The city aims to minimize the total installation cost while ensuring sufficient power generation.\n// TotalCost = 1000 * SolarPanels + 2000 * WindTurbines + 5000 * HydroPlants\n// The power generation from each source is proportional to its capacity: Power_Solar = SolarCapacity * SolarPanels, Power_Wind = WindCapacity * WindTurbines, Power_Hydro = HydroCapacity * HydroPlants\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total power generation must meet or exceed 1000 kW to power the entire public transportation system.\n// SolarCapacity * SolarPanels + WindCapacity * WindTurbines + HydroCapacity * HydroPlants >= 1000\n\n## Generate Constraint-2:\nThe city has a budget of $100,000 for the installation of renewable energy sources.\n// 1000 * SolarPanels + 2000 * WindTurbines + 5000 * HydroPlants <= 100000\n\n## Generate Constraint-3:\nThe city wants to ensure diversity in energy sources, requiring at least one of each type of installation.\n// SolarPanels >= 1\n// WindTurbines >= 1\n// HydroPlants >= 1",
        "question": "A city is planning to install a mix of renewable energy sources to power its public transportation system. The options include solar, wind, and hydroelectric power. The city needs to determine the number of solar panels, wind turbines, and hydroelectric plants to install, as well as the capacity of each type of installation. The cost of installing a solar panel is $1000, a wind turbine is $2000, and a hydroelectric plant is $5000. The city aims to minimize the total installation cost while ensuring sufficient power generation.\n\nThe city has a budget of $100,000 for the installation of renewable energy sources. The total power generation must meet or exceed 1000 kW to power the entire public transportation system. The city wants to ensure diversity in energy sources, requiring at least one of each type of installation.\n\nPlease help the city to determine the optimal number and capacity of solar panels, wind turbines, and hydroelectric plants to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=1)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=1)  # number of wind turbines\nHydroPlants = model.addVar(vtype=\"INTEGER\", name=\"HydroPlants\", lb=1)  # number of hydroelectric plants\nSolarCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarCapacity\", lb=0)  # capacity of each solar panel (kW)\nWindCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"WindCapacity\", lb=0)  # capacity of each wind turbine (kW)\nHydroCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroCapacity\", lb=0)  # capacity of each hydroelectric plant (kW)\n\n# Define objective function\nTotalCost = 1000 * SolarPanels + 2000 * WindTurbines + 5000 * HydroPlants\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# The total power generation must meet or exceed 1000 kW to power the entire public transportation system.\nmodel.addCons(SolarCapacity * SolarPanels + WindCapacity * WindTurbines + HydroCapacity * HydroPlants >= 1000)\n# The city has a budget of $100,000 for the installation of renewable energy sources.\nmodel.addCons(1000 * SolarPanels + 2000 * WindTurbines + 5000 * HydroPlants <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Number of Hydroelectric Plants: \", model.getVal(HydroPlants))\n    print(\"Capacity of Each Solar Panel (kW): \", model.getVal(SolarCapacity))\n    print(\"Capacity of Each Wind Turbine (kW): \", model.getVal(WindCapacity))\n    print(\"Capacity of Each Hydroelectric Plant (kW): \", model.getVal(HydroCapacity))\n    print(\"Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the available resources and market demand. The production quantity for each product is a decision variable.\n// {\"production quantity for ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company aims to maximize the total net profit from all products.\n// NetProfit_ProductA = ProductA * (50 - 30)\n// NetProfit_ProductB = ProductB * (70 - 40)\n// NetProfit_ProductC = ProductC * (60 - 35)\n// So, the objective function is: Maximize (NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductA + ProductB + ProductC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the available resources and market demand. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a total production capacity of 1000 units per day.\nPlease help the company to maximize the total net profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity for ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity for ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity for ProductC\n\n# Define objective function\nNetProfit_ProductA = ProductA * (50 - 30)\nNetProfit_ProductB = ProductB * (70 - 40)\nNetProfit_ProductC = ProductC * (60 - 35)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\nmodel.addCons(obj == NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 577,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter and a maintenance cost of $100 per month.\nTruck B has a fuel efficiency of 7 km/liter and a maintenance cost of $120 per month.\nTruck C has a fuel efficiency of 9 km/liter and a maintenance cost of $140 per month.\nTruck D has a fuel efficiency of 11 km/liter and a maintenance cost of $160 per month.\nTruck E has a fuel efficiency of 13 km/liter and a maintenance cost of $180 per month.\nThe company aims to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).\n// Total maintenance cost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\n// Total kilometers driven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Minimize (100 * A + 120 * B + 140 * C + 160 * D + 180 * E) / (5 * A + 7 * B + 9 * C + 11 * D + 13 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for maintenance costs for the upcoming month.\n// 100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month to optimize fuel efficiency and cost. The fuel efficiency and monthly maintenance cost for each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Monthly Maintenance Cost |\n|------------|---------------------------|--------------------------|\n| A          | 5                         | $100                     |\n| B          | 7                         | $120                     |\n| C          | 9                         | $140                     |\n| D          | 11                        | $160                     |\n| E          | 13                        | $180                     |\n\nThe company has a budget of $5000 for maintenance costs for the upcoming month. The company aims to minimize the total cost per kilometer (defined as the sum of the monthly maintenance costs divided by the sum of the total kilometers driven, which is the sum of the number of trucks of each type multiplied by their respective fuel efficiencies).\nPlease help the company determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalMaintenanceCost = 100 * A + 120 * B + 140 * C + 160 * D + 180 * E\nTotalKilometersDriven = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Minimize (TotalMaintenanceCost) / (TotalKilometersDriven)\n## convert the division to multiplication\nmodel.addCons(obj * TotalKilometersDriven == TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $5000 for maintenance costs for the upcoming month.\nmodel.addCons(100 * A + 120 * B + 140 * C + 160 * D + 180 * E <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1265,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The company needs to optimize its production to maximize profit while considering resource limitations and market demands.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The company aims to maximize the total profit from selling these components.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50.\n// 20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 100 units, B is at least 150 units, C is at least 200 units, D is at least 120 units, and E is at least 80 units.\n// A >= 100\n// B >= 150\n// C >= 200\n// D >= 120\n// E >= 80",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using various resources. The profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The company aims to maximize the total profit from selling these components. The total production cost for all components must not exceed $10,000. The cost per unit for A is $20, B is $30, C is $25, D is $40, and E is $50. The market demand for component A is at least 100 units, B is at least 150 units, C is at least 200 units, D is at least 120 units, and E is at least 80 units.\n\nPlease help the company to determine the optimal number of units to produce for each component to maximize profit while adhering to the given constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=200) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=120) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=80) # number of units of component E\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C + 40 * D + 50 * E <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The company needs to decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day.\nFor a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day.\nFor a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day.\nThe company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs.\n// Profit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000\n// where Cost_Small = $20000, Cost_Medium = $30000, Cost_Large = $40000",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company operates three types of trucks: small, medium, and large. Each type of truck has different operational costs, capacities, and revenue generation capabilities. The operational cost per day for a small truck is $200, with a capacity of 10 tons and a revenue generation of $500 per day. For a medium truck, the operational cost per day is $300, with a capacity of 20 tons and a revenue generation of $700 per day. For a large truck, the operational cost per day is $400, with a capacity of 30 tons and a revenue generation of $900 per day. The company aims to maximize its daily net profit, which is the total revenue generated minus the total operational costs. The company has a budget of $100,000 for purchasing new trucks. Please help the company decide how many trucks of each type to purchase to optimize its operational efficiency and profitability.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nProfit = (500 * SmallTrucks + 700 * MediumTrucks + 900 * LargeTrucks) - (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nCost_Small = 20000\nCost_Medium = 30000\nCost_Large = 40000\nmodel.addCons(Cost_Small * SmallTrucks + Cost_Medium * MediumTrucks + Cost_Large * LargeTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"number of smartwatches produced\": \"Smartwatches\", \"range\": \"Smartwatches >= 0\", \"type\": \"integer\"}\n// {\"number of wireless headphones produced\": \"Headphones\", \"range\": \"Headphones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, tablets $80, laptops $200, smartwatches $50, and headphones $30. The production cost per unit for smartphones is $60, tablets $50, laptops $120, smartwatches $30, and headphones $20. The company wants to maximize the net profit, which is the difference between the revenue and the cost of production.\n// Revenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\n// Cost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production cost should not exceed $100,000.\n// 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000\n\n## Generate Constraint-2:\nThe storage capacity for all devices combined is limited to 2000 units.\n// Smartphones + Tablets + Laptops + Smartwatches + Headphones <= 2000\n\n## Generate Constraint-3:\nThe company can produce at most 500 units of laptops due to component supply constraints.\n// Laptops <= 500",
        "question": "A manufacturing company produces five different types of electronic devices: smartphones, tablets, laptops, smartwatches, and wireless headphones. The company needs to optimize its production to maximize profit while considering the cost of production and storage capacity. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device         | Profit per Unit | Production Cost per Unit |\n|----------------|-----------------|--------------------------|\n| Smartphones    | $100            | $60                      |\n| Tablets        | $80             | $50                      |\n| Laptops        | $200            | $120                     |\n| Smartwatches   | $50             | $30                      |\n| Headphones     | $30             | $20                      |\n\nThe total production cost should not exceed $100,000. The storage capacity for all devices combined is limited to 2000 units. The company can produce at most 500 units of laptops due to component supply constraints. \n\nPlease help the company to maximize the net profit, which is the difference between the revenue and the cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\nSmartwatches = model.addVar(vtype=\"INTEGER\", name=\"Smartwatches\", lb=0)\nHeadphones = model.addVar(vtype=\"INTEGER\", name=\"Headphones\", lb=0)\n\n# Define objective function\nRevenue = 100 * Smartphones + 80 * Tablets + 200 * Laptops + 50 * Smartwatches + 30 * Headphones\nCost = 60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones\nNetProfit = Revenue - Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(60 * Smartphones + 50 * Tablets + 120 * Laptops + 30 * Smartwatches + 20 * Headphones <= 100000)\nmodel.addCons(Smartphones + Tablets + Laptops + Smartwatches + Headphones <= 2000)\nmodel.addCons(Laptops <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Number of Smartwatches: \", model.getVal(Smartwatches))\n    print(\"Number of Headphones: \", model.getVal(Headphones))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n// {\"acres of C4\": \"C4\", \"range\": \"C4 >= 0\", \"type\": \"integer\"}\n// {\"acres of C5\": \"C5\", \"range\": \"C5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $100, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $150, requiring 3 units of water per acre. \nFor C3, the profit per acre is $200, requiring 4 units of water per acre.\nFor C4, the profit per acre is $250, requiring 5 units of water per acre.\nFor C5, the profit per acre is $300, requiring 6 units of water per acre.\nThe farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n// Profit_C1 = 100 * C1\n// Profit_C2 = 150 * C2\n// Profit_C3 = 200 * C3\n// Profit_C4 = 250 * C4\n// Profit_C5 = 300 * C5\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / (2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 + C4 + C5 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500 units.\n// 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500",
        "question": "A farm grows five types of crops: C1, C2, C3, C4, and C5. The farm needs to decide how many acres to allocate to each crop to optimize its profit and sustainability. The profit per acre and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Requirement per Acre |\n|------|-----------------|----------------------------|\n| C1   | $100            | 2 units                    |\n| C2   | $150            | 3 units                    |\n| C3   | $200            | 4 units                    |\n| C4   | $250            | 5 units                    |\n| C5   | $300            | 6 units                    |\n\nThe farm has a total of 100 acres available for cultivation. The farm also has a limited water supply of 500 units. The farm wants to maximize the profit per unit of water used to ensure sustainable water management.\n\nPlease help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\nC4 = model.addVar(vtype=\"INTEGER\", name=\"C4\", lb=0) # acres of C4\nC5 = model.addVar(vtype=\"INTEGER\", name=\"C5\", lb=0) # acres of C5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * C1\nProfit_C2 = 150 * C2\nProfit_C3 = 200 * C3\nProfit_C4 = 250 * C4\nProfit_C5 = 300 * C5\nWaterUsage = 2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3 + Profit_C4 + Profit_C5)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 + C4 + C5 <= 100)\n## The farm has a limited water supply of 500 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 + 5 * C4 + 6 * C5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Acres of C4: \", model.getVal(C4))\n    print(\"Acres of C5: \", model.getVal(C5))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city to maximize profit. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck, which affects the fuel cost per trip.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for each truck\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The company aims to maximize the total profit from all trips.\n// Total profit for City1: Profit1 = (1000 - 0.05 * TechInvestment) * Trips1\n// Total profit for City2: Profit2 = (1200 - 0.05 * TechInvestment) * Trips2\n// Total profit for City3: Profit3 = (1500 - 0.05 * TechInvestment) * Trips3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and technology investments.\n// 0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000\n\n## Generate Constraint-2:\nThe company's fleet can make a maximum of 500 trips in total.\n// Trips1 + Trips2 + Trips3 <= 500",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city and the investment in fuel-efficient technologies for each truck to maximize profit. The profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50.\n\n| City       | Profit Per Trip |\n|------------|-----------------|\n| City1      | 1000$           |\n| City2      | 1200$           |\n| City3      | 1500$           |\n\nThe company has a total budget of $50,000 for fuel and technology investments. The company's fleet can make a maximum of 500 trips in total.\n\nPlease help the company to maximize the total profit from all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in fuel-efficient technology\n\n# Define objective function\nProfit1 = (1000 - 0.05 * TechInvestment) * Trips1\nProfit2 = (1200 - 0.05 * TechInvestment) * Trips2\nProfit3 = (1500 - 0.05 * TechInvestment) * Trips3\n# So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel and technology investments.\nmodel.addCons(0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000)\n# The company's fleet can make a maximum of 500 trips in total.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Investment in Fuel-Efficient Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage.\n// {\"number of Device A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Device B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Device C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Device D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Device E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n// Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity for all devices is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70.\n// 30A + 40B + 50C + 60D + 70E <= 50000\n\n## Generate Constraint-3:\nThe demand for Device A must be met, which is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\n// E <= 0.3 * (A + B + C + D + E)",
        "question": "A manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage. The profit per unit, cost of storage per unit per day, and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Storage Cost per Unit per Day | Production Cost per Unit |\n|--------|-----------------|-------------------------------|--------------------------|\n| A      | $50             | $2                            | $30                      |\n| B      | $70             | $3                            | $40                      |\n| C      | $80             | $4                            | $50                      |\n| D      | $90             | $5                            | $60                      |\n| E      | $100            | $6                            | $70                      |\n\nThe total production capacity for all devices is 1000 units per day. The company has a budget constraint of $50,000 for production costs. The demand for Device A must be met, which is at least 100 units. The company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\n\nPlease help the company to maximize the net profit, which is the total profit minus the total storage cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Device A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Device B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Device C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Device D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Device E produced\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n## Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 80 * C + 90 * D + 100 * E\nStorage = 2 * A + 3 * B + 4 * C + 5 * D + 6 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity for all devices is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a budget constraint of $50,000 for production costs.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D + 70 * E <= 50000)\n## The demand for Device A must be met, which is at least 100 units.\nmodel.addCons(A >= 100)\n## The company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1433,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company, LogiCorp, operates 5 different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting goods from each warehouse is influenced by the number of trucks allocated. The cost function is nonlinear and varies with the number of trucks. The cost per trip from warehouse i to its destinations is given by:\nCost_i = a_i * T_i^2 + b_i * T_i + c_i, where a_i, b_i, c_i are constants.\nThe total transportation cost is the sum of costs from all warehouses.\n// The objective function is: Minimize (a1 * T1^2 + b1 * T1 + c1) + (a2 * T2^2 + b2 * T2 + c2) + (a3 * T3^2 + b3 * T3 + c3) + (a4 * T4^2 + b4 * T4 + c4) + (a5 * T5^2 + b5 * T5 + c5)\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company, LogiCorp, operates 5 different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of transporting goods from each warehouse is influenced by the number of trucks allocated, and the cost function is nonlinear, varying with the number of trucks. The cost per trip from warehouse i to its destinations is given by:\nCost_i = a_i * T_i^2 + b_i * T_i + c_i, where a_i, b_i, c_i are constants.\nThe total transportation cost is the sum of costs from all warehouses.\n\n| Warehouse | Cost Coefficients |\n|-----------|-------------------|\n| 1         | a1, b1, c1        |\n| 2         | a2, b2, c2        |\n| 3         | a3, b3, c3        |\n| 4         | a4, b4, c4        |\n| 5         | a5, b5, c5        |\n\nThe total number of trucks available across all warehouses is limited to 100.\nPlease help LogiCorp minimize the total transportation cost by determining the optimal number of trucks to allocate to each warehouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## The cost function is nonlinear and varies with the number of trucks.\n## The objective function is: Minimize (a1 * T1^2 + b1 * T1 + c1) + (a2 * T2^2 + b2 * T2 + c2) + (a3 * T3^2 + b3 * T3 + c3) + (a4 * T4^2 + b4 * T4 + c4) + (a5 * T5^2 + b5 * T5 + c5)\n## Set constants for the cost function\na1, b1, c1 = 0.1, 1, 50\na2, b2, c2 = 0.2, 2, 60\na3, b3, c3 = 0.3, 3, 70\na4, b4, c4 = 0.4, 4, 80\na5, b5, c5 = 0.5, 5, 90\n\nCost_T1 = a1 * T1**2 + b1 * T1 + c1\nCost_T2 = a2 * T2**2 + b2 * T2 + c2\nCost_T3 = a3 * T3**2 + b3 * T3 + c3\nCost_T4 = a4 * T4**2 + b4 * T4 + c4\nCost_T5 = a5 * T5**2 + b5 * T5 + c5\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company can only use a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe number of large trucks cannot exceed half the number of small trucks.\n// LargeTrucks <= SmallTrucks / 2\n\n## Generate Constraint-5:\nThe number of medium trucks must be at least twice the number of small trucks.\n// MediumTrucks >= 2 * SmallTrucks",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost. The small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L. The medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L. The large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L. The company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n\nThe total capacity of all trucks must meet the delivery requirement of 1500 units. The company has a budget constraint of $10,000 for the total operational costs. The company can only use a maximum of 20 trucks in total. The number of large trucks cannot exceed half the number of small trucks. The number of medium trucks must be at least twice the number of small trucks.\n\nPlease help the company to minimize the total cost of operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n## The company can only use a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The number of large trucks cannot exceed half the number of small trucks.\nmodel.addCons(LargeTrucks <= SmallTrucks / 2)\n## The number of medium trucks must be at least twice the number of small trucks.\nmodel.addCons(MediumTrucks >= 2 * SmallTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules.\n// {\"number of trucks in North region\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"TrucksCentral\", \"range\": \"TrucksCentral >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for North region\": \"FuelBudgetNorth\", \"range\": \"FuelBudgetNorth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for South region\": \"FuelBudgetSouth\", \"range\": \"FuelBudgetSouth >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for East region\": \"FuelBudgetEast\", \"range\": \"FuelBudgetEast >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for West region\": \"FuelBudgetWest\", \"range\": \"FuelBudgetWest >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for Central region\": \"FuelBudgetCentral\", \"range\": \"FuelBudgetCentral >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per truck in each region is a nonlinear function of the fuel budget allocated. As the fuel budget increases, the cost per truck decreases, but at a decreasing rate. The cost function is given by: Cost = a * (FuelBudget)^(-b) + c, where a, b, and c are constants specific to each region. The company aims to minimize the total fuel cost across all regions.\n// FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n// FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n// FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n// FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n// FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n// So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n## Generate Constraint-1:\nThe total fuel budget across all regions must not exceed $100,000.\n// FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000\n\n## Generate Constraint-2:\nEach region must have at least 10 trucks to maintain service levels.\n// TrucksNorth >= 10; TrucksSouth >= 10; TrucksEast >= 10; TrucksWest >= 10; TrucksCentral >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: North, South, East, West, and Central. The company also needs to decide on the fuel budget for each region to minimize fuel costs while ensuring efficient delivery schedules. The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated, where the cost function is given by: Cost = a * (FuelBudget)^(-b) + c, with constants a, b, and c specific to each region. The company aims to minimize the total fuel cost across all regions. The total fuel budget across all regions must not exceed $100,000. Each region must have at least 10 trucks to maintain service levels. Please help the company determine the optimal number of trucks and fuel budget for each region to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=10)\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=10)\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=10)\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=10)\nTrucksCentral = model.addVar(vtype=\"INTEGER\", name=\"TrucksCentral\", lb=10)\nFuelBudgetNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetNorth\", lb=0)\nFuelBudgetSouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetSouth\", lb=0)\nFuelBudgetEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetEast\", lb=0)\nFuelBudgetWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetWest\", lb=0)\nFuelBudgetCentral = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetCentral\", lb=0)\n\n# Define objective function\n# The fuel cost per truck in each region is a nonlinear function of the fuel budget allocated.\n# Cost = a * (FuelBudget)^(-b) + c\n# FuelCostNorth = a_North * (FuelBudgetNorth)^(-b_North) + c_North\n# FuelCostSouth = a_South * (FuelBudgetSouth)^(-b_South) + c_South\n# FuelCostEast = a_East * (FuelBudgetEast)^(-b_East) + c_East\n# FuelCostWest = a_West * (FuelBudgetWest)^(-b_West) + c_West\n# FuelCostCentral = a_Central * (FuelBudgetCentral)^(-b_Central) + c_Central\n# So, the objective function is: Minimize (FuelCostNorth * TrucksNorth + FuelCostSouth * TrucksSouth + FuelCostEast * TrucksEast + FuelCostWest * TrucksWest + FuelCostCentral * TrucksCentral)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Add constraints\n# The total fuel budget across all regions must not exceed $100,000.\nmodel.addCons(FuelBudgetNorth + FuelBudgetSouth + FuelBudgetEast + FuelBudgetWest + FuelBudgetCentral <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks in South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks in East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks in West: \", model.getVal(TrucksWest))\n    print(\"Number of Trucks in Central: \", model.getVal(TrucksCentral))\n    print(\"Fuel Budget in North: \", model.getVal(FuelBudgetNorth))\n    print(\"Fuel Budget in South: \", model.getVal(FuelBudgetSouth))\n    print(\"Fuel Budget in East: \", model.getVal(FuelBudgetEast))\n    print(\"Fuel Budget in West: \", model.getVal(FuelBudgetWest))\n    print(\"Fuel Budget in Central: \", model.getVal(FuelBudgetCentral))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo (A, B, and C). The company needs to decide the number of trucks to purchase for each cargo type and the fuel efficiency of each truck type. The fuel efficiency is a critical factor in determining the operational costs.\n// {\"number of trucks for Cargo A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Cargo B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Cargo C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Cargo A (km/liter)\": \"FuelEffA\", \"range\": \"FuelEffA > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Cargo B (km/liter)\": \"FuelEffB\", \"range\": \"FuelEffB > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Cargo C (km/liter)\": \"FuelEffC\", \"range\": \"FuelEffC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $3. The company wants to minimize the total fuel cost per day, considering the average daily distance each truck travels (1000 km for Cargo A, 1200 km for Cargo B, and 1500 km for Cargo C).\n// FuelCostA = 1000 * TrucksA / FuelEffA * 3\n// FuelCostB = 1200 * TrucksB / FuelEffB * 3\n// FuelCostC = 1500 * TrucksC / FuelEffC * 3\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// TrucksA * 30000 + TrucksB * 35000 + TrucksC * 40000 <= 100000\n\n## Generate Constraint-2:\nThe total weight of cargo that can be carried by the fleet must not exceed 500 tons.\n// TrucksA * 10 + TrucksB * 15 + TrucksC * 20 <= 500\n\n## Generate Constraint-3:\nThe company aims to have at least 10 trucks in total.\n// TrucksA + TrucksB + TrucksC >= 10\n\n## Generate Constraint-4:\nThe fuel efficiency of each type of truck must be at least 5 km/liter.\n// FuelEffA >= 5\n// FuelEffB >= 5\n// FuelEffC >= 5",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for three types of cargo (A, B, and C). The company needs to decide the number of trucks to purchase for each cargo type and the fuel efficiency of each truck type. The fuel efficiency is a critical factor in determining the operational costs. The cost of fuel per liter is $3, and the average daily distance each truck travels is 1000 km for Cargo A, 1200 km for Cargo B, and 1500 km for Cargo C.\n\n| Cargo Type | Number of Trucks | Fuel Efficiency (km/liter) |\n|------------|------------------|----------------------------|\n| A          | TrucksA          | FuelEffA                   |\n| B          | TrucksB          | FuelEffB                   |\n| C          | TrucksC          | FuelEffC                   |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total weight of cargo that can be carried by the fleet must not exceed 500 tons. The company aims to have at least 10 trucks in total. The fuel efficiency of each type of truck must be at least 5 km/liter.\n\nPlease help the company to minimize the total fuel cost per day, considering the given constraints and operational parameters.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks for Cargo A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks for Cargo B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks for Cargo C\nFuelEffA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffA\", lb=5)  # fuel efficiency of trucks for Cargo A\nFuelEffB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffB\", lb=5)  # fuel efficiency of trucks for Cargo B\nFuelEffC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffC\", lb=5)  # fuel efficiency of trucks for Cargo C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostA = 1000 * TrucksA / FuelEffA * 3\nFuelCostB = 1200 * TrucksB / FuelEffB * 3\nFuelCostC = 1500 * TrucksC / FuelEffC * 3\n## convert the division to multiplication\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nmodel.addCons(TrucksA * 30000 + TrucksB * 35000 + TrucksC * 40000 <= 100000)\n## The total weight of cargo that can be carried by the fleet must not exceed 500 tons.\nmodel.addCons(TrucksA * 10 + TrucksB * 15 + TrucksC * 20 <= 500)\n## The company aims to have at least 10 trucks in total.\nmodel.addCons(TrucksA + TrucksB + TrucksC >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TrucksC))\n    print(\"Fuel Efficiency of Trucks for Cargo A: \", model.getVal(FuelEffA))\n    print(\"Fuel Efficiency of Trucks for Cargo B: \", model.getVal(FuelEffB))\n    print(\"Fuel Efficiency of Trucks for Cargo C: \", model.getVal(FuelEffC))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: C1, C2, and C3. They need to determine the optimal production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it requires 2 units of raw material A and 1 unit of raw material B. \nThe profit per unit of C2 is $15, but it requires 1 unit of raw material A and 3 units of raw material B. \nThe profit per unit of C3 is $20, but it requires 3 units of raw material A and 2 units of raw material B. \nThe manufacturer aims to maximize the total profit.\n// Profit_C1 = 10 * Q1 - (2 * Q1 * Cost_A + Q1 * Cost_B)\n// Profit_C2 = 15 * Q2 - (Q2 * Cost_A + 3 * Q2 * Cost_B)\n// Profit_C3 = 20 * Q3 - (3 * Q3 * Cost_A + 2 * Q3 * Cost_B)\n// The objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials: 100 units of A and 120 units of B.\n// 2 * Q1 + Q2 + 3 * Q3 <= 100 (Constraint for raw material A)\n// Q1 + 3 * Q2 + 2 * Q3 <= 120 (Constraint for raw material B)",
        "question": "A manufacturer produces three types of electronic components: C1, C2, and C3. They need to determine the optimal production quantities of each component to maximize their profit while considering various constraints. The profit per unit and the required raw materials for each component are given in the following Table.\n\n| Component | Profit per Unit | Raw Material A Required | Raw Material B Required |\n|-----------|-----------------|-------------------------|-------------------------|\n| C1        | $10             | 2 units                 | 1 unit                  |\n| C2        | $15             | 1 unit                  | 3 units                 |\n| C3        | $20             | 3 units                 | 2 units                 |\n\nThe manufacturer has a limited supply of raw materials: 100 units of A and 120 units of B. The manufacturer aims to maximize the total profit. Please help the manufacturer determine the optimal production quantities of each component (C1, C2, and C3) that satisfy the constraints and maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit calculation\nCost_A = 1  # Assuming cost per unit of raw material A\nCost_B = 1  # Assuming cost per unit of raw material B\nProfit_C1 = 10 * Q1 - (2 * Q1 * Cost_A + Q1 * Cost_B)\nProfit_C2 = 15 * Q2 - (Q2 * Cost_A + 3 * Q2 * Cost_B)\nProfit_C3 = 20 * Q3 - (3 * Q3 * Cost_A + 2 * Q3 * Cost_B)\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## Constraint for raw material A\nmodel.addCons(2 * Q1 + Q2 + 3 * Q3 <= 100)\n## Constraint for raw material B\nmodel.addCons(Q1 + 3 * Q2 + 2 * Q3 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000\n\n## Generate Constraint-2:\nThe total production hours available in the Testing department is 800 hours.\n// TestingHours <= 800\n\n## Generate Constraint-3:\nThe total production hours available in the Packaging department is 600 hours.\n// PackagingHours <= 600",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $100            |\n| DeviceB | $150            |\n| DeviceC | $200            |\n\nThe total production hours available in the Assembly department is 1000 hours. The total production hours available in the Testing department is 800 hours. The total production hours available in the Packaging department is 600 hours.\n\nPlease help the company to determine the optimal number of units to produce for each device and the number of hours to allocate for production in each department to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0) # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0) # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0) # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(AssemblyHours <= 1000)\nmodel.addCons(TestingHours <= 800)\nmodel.addCons(PackagingHours <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1135,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make.\n// {\"number of trucks for CityA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company wants to maximize the total net profit from all routes.\n// NetProfit_CityA = (1500 - 500) * TrucksA * TripsA\n// NetProfit_CityB = (1800 - 600) * TrucksB * TripsB\n// NetProfit_CityC = (2100 - 700) * TrucksC * TripsC\n// NetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n// So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\n// TripsA <= 20; TripsB <= 20; TripsC <= 20; TripsD <= 20\n\n## Generate Constraint-3:\nThe company has a budget of $200,000 for operational costs per quarter.\n// 500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200,000\n\n## Generate Constraint-4:\nThe company must ensure that at least 10 trips are made to each city per quarter.\n// TrucksA * TripsA >= 10; TrucksB * TripsB >= 10; TrucksC * TripsC >= 10; TrucksD * TripsD >= 10\n\n## Generate Constraint-5:\nDue to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter.\n// TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD <= 1000",
        "question": "A logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make. The cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company has a total of 50 trucks available. Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter. The company has a budget of $200,000 for operational costs per quarter. The company must ensure that at least 10 trips are made to each city per quarter. Due to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter. \n\nPlease help the company to maximize the total net profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CityA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CityB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CityC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CityD\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=20) # number of trips per truck for CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=20) # number of trips per truck for CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=20) # number of trips per truck for CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=20) # number of trips per truck for CityD\n\n# Define objective function\nNetProfit_CityA = (1500 - 500) * TrucksA * TripsA\nNetProfit_CityB = (1800 - 600) * TrucksB * TripsB\nNetProfit_CityC = (2100 - 700) * TrucksC * TripsC\nNetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n# So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\nmodel.addCons(TripsA <= 20)\nmodel.addCons(TripsB <= 20)\nmodel.addCons(TripsC <= 20)\nmodel.addCons(TripsD <= 20)\n# The company has a budget of $200,000 for operational costs per quarter.\nmodel.addCons(500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200000)\n# The company must ensure that at least 10 trips are made to each city per quarter.\nmodel.addCons(TrucksA * TripsA >= 10)\nmodel.addCons(TrucksB * TripsB >= 10)\nmodel.addCons(TrucksC * TripsC >= 10)\nmodel.addCons(TrucksD * TripsD >= 10)\n# Due to environmental regulations, the total number of trips across all cities must not exceed 1000 per quarter.\nmodel.addCons(TrucksA * TripsA + TrucksB * TripsB + TrucksC * TripsC + TrucksD * TripsD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CityB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CityC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CityD: \", model.getVal(TrucksD))\n    print(\"Number of Trips per Truck for CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for CityD: \", model.getVal(TripsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck costs $50 per day to operate and can carry 10 tons of cargo. Each Medium truck costs $70 per day and can carry 20 tons. Each Large truck costs $90 per day and can carry 30 tons. Each Extra-Large truck costs $110 per day and can carry 40 tons. Each Refrigerated truck costs $130 per day and can carry 25 tons. The company aims to minimize the total daily operational cost while ensuring all cargo is delivered. The total cargo to be delivered is 1000 tons.\n// The total cost function is: 50S + 70M + 90L + 110XL + 130R\n// The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\n// The objective function is: Minimize (50S + 70M + 90L + 110XL + 130R)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for operational costs.\n// 50S + 70M + 90L + 110XL + 130R <= 5000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The operational cost and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type       | Operational Cost per Day | Cargo Capacity (tons) |\n|------------------|--------------------------|-----------------------|\n| Small            | $50                      | 10                    |\n| Medium           | $70                      | 20                    |\n| Large            | $90                      | 30                    |\n| Extra-Large      | $110                     | 40                    |\n| Refrigerated     | $130                     | 25                    |\n\nThe company has a budget of $5000 per day for operational costs. The total cargo to be delivered is 1000 tons. Please help the company to minimize the total daily operational cost while ensuring all cargo is delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost function is: 50S + 70M + 90L + 110XL + 130R\nmodel.addCons(obj == 50*S + 70*M + 90*L + 110*XL + 130*R)\n\n# Add constraints\n## The total carrying capacity constraint is: 10S + 20M + 30L + 40XL + 25R >= 1000\nmodel.addCons(10*S + 20*M + 30*L + 40*XL + 25*R >= 1000)\n## The company has a budget of $5000 per day for operational costs.\nmodel.addCons(50*S + 70*M + 90*L + 110*XL + 130*R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations.\n// {\"trucks in R1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks in R5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in R1 is $1000 per day, in R2 is $1200 per day, in R3 is $1500 per day, in R4 is $1800 per day, and in R5 is $2000 per day. The revenue generated by each truck in R1 is $1500 per day, in R2 is $1800 per day, in R3 is $2100 per day, in R4 is $2400 per day, and in R5 is $2700 per day. The company wants to maximize the net profit (revenue minus cost) per truck per day.\n// Profit_R1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_R2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_R3 = (2100 * T3 - 1500 * T3) / T3\n// Profit_R4 = (2400 * T4 - 1800 * T4) / T4\n// Profit_R5 = (2700 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for operating costs.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000\n\n## Generate Constraint-2:\nThe company has a limit of 5 trucks that can be used across all regions.\n// T1 + T2 + T3 + T4 + T5 <= 5",
        "question": "A logistics company is planning its routes for five different regions: R1, R2, R3, R4, and R5. They need to determine the number of trucks to allocate to each region to optimize their operations. The cost of operating a truck and the revenue generated by each truck in each region are given in the following Table.\n\n| Region | Operating Cost per Truck per Day | Revenue per Truck per Day |\n|--------|----------------------------------|---------------------------|\n| R1     | $1000                            | $1500                     |\n| R2     | $1200                            | $1800                     |\n| R3     | $1500                            | $2100                     |\n| R4     | $1800                            | $2400                     |\n| R5     | $2000                            | $2700                     |\n\nThe company has a total budget of $10,000 per day for operating costs. The company has a limit of 5 trucks that can be used across all regions. Please help the company to maximize the net profit (revenue minus cost) per truck per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # trucks in R1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # trucks in R2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # trucks in R3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # trucks in R4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # trucks in R5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_R1 = (1500 - 1000) # Profit per truck in R1\nProfit_R2 = (1800 - 1200) # Profit per truck in R2\nProfit_R3 = (2100 - 1500) # Profit per truck in R3\nProfit_R4 = (2400 - 1800) # Profit per truck in R4\nProfit_R5 = (2700 - 2000) # Profit per truck in R5\n## the objective function is: Maximize (Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\nmodel.addCons(obj == Profit_R1 * T1 + Profit_R2 * T2 + Profit_R3 * T3 + Profit_R4 * T4 + Profit_R5 * T5)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for operating costs.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 10000)\n## The company has a limit of 5 trucks that can be used across all regions.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in R1: \", model.getVal(T1))\n    print(\"Number of Trucks in R2: \", model.getVal(T2))\n    print(\"Number of Trucks in R3: \", model.getVal(T3))\n    print(\"Number of Trucks in R4: \", model.getVal(T4))\n    print(\"Number of Trucks in R5: \", model.getVal(T5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide the number of trucks for five different types of cargo (Food, Electronics, Textiles, Chemicals, and Heavy Machinery).\n// {\"number of Food trucks\": \"Food\", \"range\": \"Food >= 0\", \"type\": \"integer\"}\n// {\"number of Electronics trucks\": \"Electronics\", \"range\": \"Electronics >= 0\", \"type\": \"integer\"}\n// {\"number of Textiles trucks\": \"Textiles\", \"range\": \"Textiles >= 0\", \"type\": \"integer\"}\n// {\"number of Chemicals trucks\": \"Chemicals\", \"range\": \"Chemicals >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy Machinery trucks\": \"HeavyMachinery\", \"range\": \"HeavyMachinery >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n// Profit per Food truck: 5000, Operational cost: 0.01 * Food^2, Environmental impact: 0.005 * Food^2\n// Profit per Electronics truck: 7000, Operational cost: 0.015 * Electronics^2, Environmental impact: 0.007 * Electronics^2\n// Profit per Textiles truck: 4000, Operational cost: 0.008 * Textiles^2, Environmental impact: 0.004 * Textiles^2\n// Profit per Chemicals truck: 6000, Operational cost: 0.02 * Chemicals^2, Environmental impact: 0.01 * Chemicals^2\n// Profit per Heavy Machinery truck: 8000, Operational cost: 0.025 * HeavyMachinery^2, Environmental impact: 0.012 * HeavyMachinery^2\n// The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks.\n// 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000\n\n## Generate Constraint-2:\nThe company must have at least 50 trucks in total.\n// Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50\n\n## Generate Constraint-3:\nThe company must have at least 10 trucks for each type of cargo.\n// Food >= 10\n// Electronics >= 10\n// Textiles >= 10\n// Chemicals >= 10\n// HeavyMachinery >= 10\n\n## Generate Constraint-4:\nThe environmental impact of the fleet should not exceed a certain threshold, which is calculated as the sum of the environmental impact of each type of truck.\n// 0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2 <= 1000",
        "question": "A logistics company is planning its fleet for the next year and needs to decide the number of trucks for five different types of cargo: Food, Electronics, Textiles, Chemicals, and Heavy Machinery. The company wants to maximize its profit while considering the operational costs and the environmental impact. The profit per truck varies based on the type of cargo, and the operational cost is a nonlinear function of the number of trucks. The environmental impact is also considered, as it affects the company's taxes.\n\nThe company has a budget of $500,000 for purchasing trucks. The company must have at least 50 trucks in total and at least 10 trucks for each type of cargo. The environmental impact of the fleet should not exceed a certain threshold, which is calculated as the sum of the environmental impact of each type of truck.\n\nPlease help the company to maximize its profit by determining the optimal number of trucks for each type of cargo, considering all the given constraints and the objective function that includes profit, operational costs, and environmental impact.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFood = model.addVar(vtype=\"INTEGER\", name=\"Food\", lb=10)  # number of Food trucks\nElectronics = model.addVar(vtype=\"INTEGER\", name=\"Electronics\", lb=10)  # number of Electronics trucks\nTextiles = model.addVar(vtype=\"INTEGER\", name=\"Textiles\", lb=10)  # number of Textiles trucks\nChemicals = model.addVar(vtype=\"INTEGER\", name=\"Chemicals\", lb=10)  # number of Chemicals trucks\nHeavyMachinery = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachinery\", lb=10)  # number of Heavy Machinery trucks\n\n# Define objective function\n## The objective function is: Maximize (5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery) - (0.01 * Food^2 + 0.015 * Electronics^2 + 0.008 * Textiles^2 + 0.02 * Chemicals^2 + 0.025 * HeavyMachinery^2) - (0.005 * Food^2 + 0.007 * Electronics^2 + 0.004 * Textiles^2 + 0.01 * Chemicals^2 + 0.012 * HeavyMachinery^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery\nOperationalCost = 0.01 * Food**2 + 0.015 * Electronics**2 + 0.008 * Textiles**2 + 0.02 * Chemicals**2 + 0.025 * HeavyMachinery**2\nEnvironmentalImpact = 0.005 * Food**2 + 0.007 * Electronics**2 + 0.004 * Textiles**2 + 0.01 * Chemicals**2 + 0.012 * HeavyMachinery**2\nmodel.addCons(obj == Profit - OperationalCost - EnvironmentalImpact)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks.\nmodel.addCons(5000 * Food + 7000 * Electronics + 4000 * Textiles + 6000 * Chemicals + 8000 * HeavyMachinery <= 500000)\n## The company must have at least 50 trucks in total.\nmodel.addCons(Food + Electronics + Textiles + Chemicals + HeavyMachinery >= 50)\n## The environmental impact of the fleet should not exceed a certain threshold.\nmodel.addCons(EnvironmentalImpact <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Food trucks: \", model.getVal(Food))\n    print(\"Number of Electronics trucks: \", model.getVal(Electronics))\n    print(\"Number of Textiles trucks: \", model.getVal(Textiles))\n    print(\"Number of Chemicals trucks: \", model.getVal(Chemicals))\n    print(\"Number of Heavy Machinery trucks: \", model.getVal(HeavyMachinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total net profit.\n// NetProfit_A = A * (50 - 20)\n// NetProfit_B = B * (70 - 30)\n// NetProfit_C = C * (60 - 25)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\n// A >= 200\n// B >= 300\n\n## Generate Constraint-3:\nThe production process is such that the production of product C is dependent on the production of product A and B. Specifically, for every unit of product A produced, 0.5 units of product C can be produced, and for every unit of product B produced, 0.3 units of product C can be produced.\n// C <= 0.5 * A + 0.3 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n\nThe company has a total production capacity of 1000 units per month. The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month. The production process is such that the production of product C is dependent on the production of product A and B. Specifically, for every unit of product A produced, 0.5 units of product C can be produced, and for every unit of product B produced, 0.3 units of product C can be produced.\n\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nNetProfit_A = A * (50 - 20)\nNetProfit_B = B * (70 - 30)\nNetProfit_C = C * (60 - 25)\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n# The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 300)\n# The production process is such that the production of product C is dependent on the production of product A and B.\nmodel.addCons(C <= 0.5 * A + 0.3 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The regions are categorized into three types: Urban, Suburban, and Rural. The company also needs to consider the fuel efficiency of trucks in different regions, which varies due to traffic conditions and road types.\n// {\"number of trucks for Urban\": \"UrbanTrucks\", \"range\": \"UrbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban\": \"SuburbanTrucks\", \"range\": \"SuburbanTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural\": \"RuralTrucks\", \"range\": \"RuralTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Urban\": \"UrbanTripsPerTruck\", \"range\": \"UrbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Suburban\": \"SuburbanTripsPerTruck\", \"range\": \"SuburbanTripsPerTruck >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for Rural\": \"RuralTripsPerTruck\", \"range\": \"RuralTripsPerTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per liter is $1.5. The fuel efficiency for Urban trucks is 5 km/liter, for Suburban trucks is 8 km/liter, and for Rural trucks is 10 km/liter. The average distance per trip in Urban is 20 km, in Suburban is 40 km, and in Rural is 60 km. The company aims to minimize the total daily fuel cost.\n// FuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\n// FuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\n// FuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n// So, the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily budget of $1000 for fuel costs.\n// (20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000\n\n## Generate Constraint-3:\nThe company has a daily operational limit of 1000 trips across all regions.\n// UrbanTrucks * UrbanTripsPerTruck + SuburbanTrucks * SuburbanTripsPerTruck + RuralTrucks * RuralTripsPerTruck <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the number of trips each truck should make per day. The regions are categorized into three types: Urban, Suburban, and Rural. The cost of fuel per liter is $1.5. The fuel efficiency for Urban trucks is 5 km/liter, for Suburban trucks is 8 km/liter, and for Rural trucks is 10 km/liter. The average distance per trip in Urban is 20 km, in Suburban is 40 km, and in Rural is 60 km. The company aims to minimize the total daily fuel cost. The company has a total of 50 trucks available. The company has a daily budget of $1000 for fuel costs. The company has a daily operational limit of 1000 trips across all regions.\n\nPlease help the company to determine the optimal number of trucks and trips per truck for each region to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"UrbanTrucks\", lb=0)\nSuburbanTrucks = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTrucks\", lb=0)\nRuralTrucks = model.addVar(vtype=\"INTEGER\", name=\"RuralTrucks\", lb=0)\nUrbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"UrbanTripsPerTruck\", lb=0)\nSuburbanTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"SuburbanTripsPerTruck\", lb=0)\nRuralTripsPerTruck = model.addVar(vtype=\"INTEGER\", name=\"RuralTripsPerTruck\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Urban = 1.5 * (20 / 5) * UrbanTrucks * UrbanTripsPerTruck\nFuelCost_Suburban = 1.5 * (40 / 8) * SuburbanTrucks * SuburbanTripsPerTruck\nFuelCost_Rural = 1.5 * (60 / 10) * RuralTrucks * RuralTripsPerTruck\n## the objective function is: Minimize (FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\nmodel.addCons(obj == FuelCost_Urban + FuelCost_Suburban + FuelCost_Rural)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(UrbanTrucks + SuburbanTrucks + RuralTrucks <= 50)\n## The company has a daily budget of $1000 for fuel costs.\nmodel.addCons((20 / 5) * 1.5 * UrbanTrucks * UrbanTripsPerTruck + (40 / 8) * 1.5 * SuburbanTrucks * SuburbanTripsPerTruck + (60 / 10) * 1.5 * RuralTrucks * RuralTripsPerTruck <= 1000)\n## The company has a daily operational limit of 1000 trips across all regions.\nmodel.addCons(UrbanTrucks * UrbanTripsPerTruck + SuburbanTrucks * SuburbanTripsPerTruck + RuralTrucks * RuralTripsPerTruck <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Urban Trucks: \", model.getVal(UrbanTrucks))\n    print(\"Number of Suburban Trucks: \", model.getVal(SuburbanTrucks))\n    print(\"Number of Rural Trucks: \", model.getVal(RuralTrucks))\n    print(\"Number of Urban Trips per Truck: \", model.getVal(UrbanTripsPerTruck))\n    print(\"Number of Suburban Trips per Truck: \", model.getVal(SuburbanTripsPerTruck))\n    print(\"Number of Rural Trips per Truck: \", model.getVal(RuralTripsPerTruck))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphones = 100 * Smartphones\n// Profit_Tablets = 150 * Tablets\n// Profit_Laptops = 200 * Laptops\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. The production time for Smartphones is 2 hours per unit, for Tablets is 3 hours per unit, and for Laptops is 4 hours per unit.\n// 2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000\n\n## Generate Constraint-2:\nThe market demand for Smartphones is at least 20 units per week, for Tablets is at least 15 units per week, and for Laptops is at least 10 units per week.\n// Smartphones >= 20\n// Tablets >= 15\n// Laptops >= 10\n\n## Generate Constraint-3:\nThe company has a budget constraint of $5000 per week for raw materials. The cost of raw materials for Smartphones is $50 per unit, for Tablets is $70 per unit, and for Laptops is $90 per unit.\n// 50 * Smartphones + 70 * Tablets + 90 * Laptops <= 5000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from selling these devices.\n\n| Device       | Profit per Unit | Production Time per Unit | Cost of Raw Materials per Unit |\n|--------------|-----------------|--------------------------|--------------------------------|\n| Smartphones  | $100            | 2 hours                  | $50                            |\n| Tablets      | $150            | 3 hours                  | $70                            |\n| Laptops      | $200            | 4 hours                  | $90                            |\n\nThe company has a limited production capacity of 1000 hours per week. The market demand for Smartphones is at least 20 units per week, for Tablets is at least 15 units per week, and for Laptops is at least 10 units per week. The company has a budget constraint of $5000 per week for raw materials.\n\nPlease help the company to determine the optimal number of Smartphones, Tablets, and Laptops to produce to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of Laptops\n\n# Define objective function\nProfit_Smartphones = 100 * Smartphones\nProfit_Tablets = 150 * Tablets\nProfit_Laptops = 200 * Laptops\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# Constraint-1: Production capacity\nmodel.addCons(2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000)\n# Constraint-2: Market demand\nmodel.addCons(Smartphones >= 20)\nmodel.addCons(Tablets >= 15)\nmodel.addCons(Laptops >= 10)\n# Constraint-3: Budget for raw materials\nmodel.addCons(50 * Smartphones + 70 * Tablets + 90 * Laptops <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1407,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per kilometer for a truck in Region A is $0.5, in Region B is $0.6, in Region C is $0.7, in Region D is $0.8, and in Region E is $0.9. The revenue per kilometer for a truck in Region A is $1.5, in Region B is $1.6, in Region C is $1.7, in Region D is $1.8, and in Region E is $1.9. The company wants to maximize the net profit per kilometer across all regions.\n// Net profit for Region A: Profit_A = (1.5 - 0.5) * Trucks_A\n// Net profit for Region B: Profit_B = (1.6 - 0.6) * Trucks_B\n// Net profit for Region C: Profit_C = (1.7 - 0.7) * Trucks_C\n// Net profit for Region D: Profit_D = (1.8 - 0.8) * Trucks_D\n// Net profit for Region E: Profit_E = (1.9 - 0.9) * Trucks_E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, Region A must have at least 10% of the total trucks.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E)",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) to maximize efficiency while minimizing costs. The cost and revenue per kilometer for each region are given in the following Table.\n\n| Region | Cost per Kilometer | Revenue per Kilometer |\n|--------|--------------------|-----------------------|\n| A      | $0.5               | $1.5                  |\n| B      | $0.6               | $1.6                  |\n| C      | $0.7               | $1.7                  |\n| D      | $0.8               | $1.8                  |\n| E      | $0.9               | $1.9                  |\n\nThe company has a total of 50 trucks available for allocation. Due to regional regulations, Region A must have at least 10% of the total trucks. The company wants to maximize the net profit per kilometer across all regions. Please help the company to determine the optimal allocation of trucks to each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Region E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1.5 - 0.5) * Trucks_A\nProfit_B = (1.6 - 0.6) * Trucks_B\nProfit_C = (1.7 - 0.7) * Trucks_C\nProfit_D = (1.8 - 0.8) * Trucks_D\nProfit_E = (1.9 - 0.9) * Trucks_E\nTotal_Trucks = Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Total_Trucks\n## convert the division to multiplication\nmodel.addCons(obj * Total_Trucks == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 50)\n## Due to regional regulations, Region A must have at least 10% of the total trucks.\nmodel.addCons(Trucks_A >= 0.1 * Total_Trucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary and are influenced by the production quantities of the other products due to market saturation effects.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is given by the function: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty.\nThe profit for ProductB is given by the function: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty.\nThe profit for ProductC is given by the function: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty.\nThe company wants to maximize the total profit from all products.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for each product is influenced by the production quantities of all products due to market saturation effects. The profit functions for each product are as follows:\n\n- Profit for ProductA: Profit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\n- Profit for ProductB: Profit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\n- Profit for ProductC: Profit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nThe company wants to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per month. Additionally, due to raw material availability, the production of ProductB cannot exceed twice the production of ProductA.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # quantity of ProductC\n\n# Define objective function\nProfit_A = (100 - 0.1 * ProductAQty - 0.05 * ProductBQty - 0.05 * ProductCQty) * ProductAQty - 5 * ProductAQty\nProfit_B = (150 - 0.15 * ProductBQty - 0.05 * ProductAQty - 0.05 * ProductCQty) * ProductBQty - 7 * ProductBQty\nProfit_C = (200 - 0.2 * ProductCQty - 0.05 * ProductAQty - 0.05 * ProductBQty) * ProductCQty - 10 * ProductCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 1000)\nmodel.addCons(ProductBQty <= 2 * ProductAQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 541,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and maintenance costs. Additionally, the company needs to decide on the optimal speed for each truck to further reduce costs, as fuel consumption and maintenance costs are nonlinearly related to speed.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for trucks in Region 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 100\", \"type\": \"continuous\"}\n// {\"optimal speed for trucks in Region 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance costs for each truck are nonlinearly related to the speed at which they operate. The cost function for each region is given by:\nCost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region.\nThe company aims to minimize the total cost across all regions.\n// Total cost for Region 1: Cost1 = Trucks1 * (a1 * (Speed1^2) + b1 * Speed1 + c1)\n// Total cost for Region 2: Cost2 = Trucks2 * (a2 * (Speed2^2) + b2 * Speed2 + c2)\n// Total cost for Region 3: Cost3 = Trucks3 * (a3 * (Speed3^2) + b3 * Speed3 + c3)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is limited to 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-2:\nDue to regulatory restrictions, the speed of trucks in each region must not exceed 100 km/h.\n// Speed1 <= 100; Speed2 <= 100; Speed3 <= 100",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region 1, Region 2, and Region 3) and the optimal speed for each truck to minimize fuel consumption and maintenance costs. The costs are nonlinearly related to the speed, with a cost function for each region given by Cost = a * (Speed^2) + b * Speed + c, where a, b, and c are constants specific to each region. The company aims to minimize the total cost across all regions. The total number of trucks available in the fleet is limited to 100, and due to regulatory restrictions, the speed of trucks in each region must not exceed 100 km/h. Please help the company to determine the optimal allocation of trucks and their speeds to minimize the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # optimal speed for trucks in Region 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # optimal speed for trucks in Region 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # optimal speed for trucks in Region 3\n\n# Define objective function\n# Constants for the cost function\na1, b1, c1 = 0.01, 0.5, 10  # example values for Region 1\na2, b2, c2 = 0.02, 0.6, 12  # example values for Region 2\na3, b3, c3 = 0.03, 0.7, 14  # example values for Region 3\n\n# Calculate costs for each region\nCost1 = Trucks1 * (a1 * Speed1**2 + b1 * Speed1 + c1)\nCost2 = Trucks2 * (a2 * Speed2**2 + b2 * Speed2 + c2)\nCost3 = Trucks3 * (a3 * Speed3**2 + b3 * Speed3 + c3)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# Total number of trucks available in the fleet is limited to 100\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n# Speed of trucks in each region must not exceed 100 km/h\nmodel.addCons(Speed1 <= 100)\nmodel.addCons(Speed2 <= 100)\nmodel.addCons(Speed3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Optimal Speed for Region 1: \", model.getVal(Speed1))\n    print(\"Optimal Speed for Region 2: \", model.getVal(Speed2))\n    print(\"Optimal Speed for Region 3: \", model.getVal(Speed3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The variables include the number of units produced for each device and the number of hours of labor allocated to each device.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for DeviceA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"labor hours for DeviceC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company aims to maximize the total profit, considering both the revenue from sales and the labor costs.\n// Total profit for DeviceA: Profit_A = (100 * UnitsA) - (20 * LaborA)\n// Total profit for DeviceB: Profit_B = (150 * UnitsB) - (20 * LaborB)\n// Total profit for DeviceC: Profit_C = (200 * UnitsC) - (20 * LaborC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available for the month.\n// LaborA + LaborB + LaborC <= 1000\n\n## Generate Constraint-2:\nThe production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit.\n// LaborA = 2 * UnitsA\n// LaborB = 3 * UnitsB\n// LaborC = 4 * UnitsC",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The labor cost per hour is $20. The company has a total of 1000 labor hours available for the month. The production of DeviceA requires 2 hours of labor per unit, DeviceB requires 3 hours of labor per unit, and DeviceC requires 4 hours of labor per unit. Please help the company to maximize the total profit, considering both the revenue from sales and the labor costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours for DeviceA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours for DeviceB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours for DeviceC\n\n# Define objective function\nProfit_A = (100 * UnitsA) - (20 * LaborA)\nProfit_B = (150 * UnitsB) - (20 * LaborB)\nProfit_C = (200 * UnitsC) - (20 * LaborC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)  # Total labor hours constraint\nmodel.addCons(LaborA == 2 * UnitsA)  # Labor hours per unit for DeviceA\nmodel.addCons(LaborB == 3 * UnitsB)  # Labor hours per unit for DeviceB\nmodel.addCons(LaborC == 4 * UnitsC)  # Labor hours per unit for DeviceC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Labor Hours for DeviceA: \", model.getVal(LaborA))\n    print(\"Labor Hours for DeviceB: \", model.getVal(LaborB))\n    print(\"Labor Hours for DeviceC: \", model.getVal(LaborC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 690,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product A\": \"InventoryA\", \"range\": \"InventoryA >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product B\": \"InventoryB\", \"range\": \"InventoryB >= 0\", \"type\": \"integer\"}\n// {\"inventory level of product C\": \"InventoryC\", \"range\": \"InventoryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company wants to maximize the total profit, considering both the production and the inventory levels.\n// Profit_ProductA = (ProductA - InventoryA) * (50 - 30)\n// Profit_ProductB = (ProductB - InventoryB) * (70 - 40)\n// Profit_ProductC = (ProductC - InventoryC) * (60 - 35)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day.\n// ProductA + ProductB + ProductC <= 100\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 50 units for each product.\n// InventoryA <= 50\n// InventoryB <= 50\n// InventoryC <= 50\n\n## Generate Constraint-3:\nThe total cost of production and inventory maintenance must not exceed $4000 per day.\n// 30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000\n\n## Generate Constraint-4:\nThe demand for product A is at least 20 units per day, and for product B and C, it is at least 15 units per day.\n// ProductA >= 20\n// ProductB >= 15\n// ProductC >= 15",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit, considering the costs and revenues per unit. Additionally, the company must manage its inventory levels and ensure that the production does not exceed its capacity.\nThe revenue per unit of product A is $50, and the cost is $30.\nThe revenue per unit of product B is $70, and the cost is $40.\nThe revenue per unit of product C is $60, and the cost is $35.\nThe company has a total production capacity of 100 units per day. The company has a storage capacity limit of 50 units for each product. The total cost of production and inventory maintenance must not exceed $4000 per day. The demand for product A is at least 20 units per day, and for product B and C, it is at least 15 units per day.\nPlease help the company to maximize the total profit, considering both the production and the inventory levels.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=20)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=15)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=15)  # production quantity of product C\nInventoryA = model.addVar(vtype=\"INTEGER\", name=\"InventoryA\", lb=0, ub=50)  # inventory level of product A\nInventoryB = model.addVar(vtype=\"INTEGER\", name=\"InventoryB\", lb=0, ub=50)  # inventory level of product B\nInventoryC = model.addVar(vtype=\"INTEGER\", name=\"InventoryC\", lb=0, ub=50)  # inventory level of product C\n\n# Define objective function\nProfit_ProductA = (ProductA - InventoryA) * (50 - 30)\nProfit_ProductB = (ProductB - InventoryB) * (70 - 40)\nProfit_ProductC = (ProductC - InventoryC) * (60 - 35)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 100)  # total production capacity\nmodel.addCons(InventoryA <= 50)  # storage capacity limit for product A\nmodel.addCons(InventoryB <= 50)  # storage capacity limit for product B\nmodel.addCons(InventoryC <= 50)  # storage capacity limit for product C\nmodel.addCons(30 * ProductA + 40 * ProductB + 35 * ProductC + 5 * InventoryA + 7 * InventoryB + 6 * InventoryC <= 4000)  # total cost constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Inventory Level of Product A: \", model.getVal(InventoryA))\n    print(\"Inventory Level of Product B: \", model.getVal(InventoryB))\n    print(\"Inventory Level of Product C: \", model.getVal(InventoryC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold.\n// Cost of route A: Cost_A = 2 * A\n// Cost of route B: Cost_B = 3 * B\n// Cost of route C: Cost_C = 4 * C\n// Cost of route D: Cost_D = 5 * D\n// Cost of route E: Cost_E = 6 * E\n// Time spent on route A: Time_A = 1 / 30 * A\n// Time spent on route B: Time_B = 1 / 40 * B\n// Time spent on route C: Time_C = 1 / 50 * C\n// Time spent on route D: Time_D = 1 / 60 * D\n// Time spent on route E: Time_E = 1 / 70 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to the constraint that Time_A + Time_B + Time_C + Time_D + Time_E <= T_max\n\n## Generate Constraint-1:\nThe total time spent on all routes must not exceed 100 hours.\n// (1 / 30 * A) + (1 / 40 * B) + (1 / 50 * C) + (1 / 60 * D) + (1 / 70 * E) <= 100",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and average speed for each route are given in the following Table.\n\n| Route | Cost per Mile | Average Speed |\n|-------|---------------|---------------|\n| A     | $2            | 30 mph        |\n| B     | $3            | 40 mph        |\n| C     | $4            | 50 mph        |\n| D     | $5            | 60 mph        |\n| E     | $6            | 70 mph        |\n\nThe company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold. The total time spent on all routes must not exceed 100 hours.\n\nPlease help the company to minimize the total cost of operations (which is defined as the sum of the costs of all routes) subject to the constraint that the total time spent on all routes does not exceed 100 hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * A\nCost_B = 3 * B\nCost_C = 4 * C\nCost_D = 5 * D\nCost_E = 6 * E\nTime_A = 1 / 30 * A\nTime_B = 1 / 40 * B\nTime_C = 1 / 50 * C\nTime_D = 1 / 60 * D\nTime_E = 1 / 70 * E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(Time_A + Time_B + Time_C + Time_D + Time_E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"operational cost per truck\": \"CostPerTruck\", \"range\": \"CostPerTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per van\": \"CostPerVan\", \"range\": \"CostPerVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per motorcycle\": \"CostPerMotorcycle\", \"range\": \"CostPerMotorcycle >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company aims to maximize the net daily profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\n// TotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks + Vans + Motorcycles <= 100000\n\n## Generate Constraint-2:\nThe total operational cost should not exceed $50,000 per day.\n// 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000",
        "question": "A logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs. The revenue and operational costs for each type of vehicle are given in the following Table.\n\n| Vehicle Type | Revenue per Day | Operational Cost per Vehicle |\n|--------------|-----------------|------------------------------|\n| Trucks       | $5000           | $1000                        |\n| Vans         | $3000           | $500                         |\n| Motorcycles  | $1000           | $200                         |\n\nThe company has a budget of $100,000 for purchasing vehicles. The total operational cost should not exceed $50,000 per day. Please help the company to maximize the net daily profit, which is the total revenue minus the total operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nCostPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck\", lb=0)  # operational cost per truck\nCostPerVan = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerVan\", lb=0)  # operational cost per van\nCostPerMotorcycle = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerMotorcycle\", lb=0)  # operational cost per motorcycle\n\n# Define objective function\nTotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\nTotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks + Vans + Motorcycles <= 100000)\n# The total operational cost should not exceed $50,000 per day.\nmodel.addCons(1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Operational Cost per Truck: \", model.getVal(CostPerTruck))\n    print(\"Operational Cost per Van: \", model.getVal(CostPerVan))\n    print(\"Operational Cost per Motorcycle: \", model.getVal(CostPerMotorcycle))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates five different factories that produce a certain product. The company needs to optimize the production levels of each factory to maximize profit while considering various constraints.\n// {\"production level of factory 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"production level of factory 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different cost function and revenue function. The profit function for each factory is the difference between the revenue and the cost.\nFor factory 1, the cost function is C1 = 0.05 * F1^2 + 10 * F1 + 500, and the revenue function is R1 = 20 * F1.\nFor factory 2, the cost function is C2 = 0.03 * F2^2 + 15 * F2 + 600, and the revenue function is R2 = 25 * F2.\nFor factory 3, the cost function is C3 = 0.07 * F3^2 + 20 * F3 + 700, and the revenue function is R3 = 30 * F3.\nFor factory 4, the cost function is C4 = 0.04 * F4^2 + 12 * F4 + 550, and the revenue function is R4 = 28 * F4.\nFor factory 5, the cost function is C5 = 0.06 * F5^2 + 18 * F5 + 650, and the revenue function is R5 = 32 * F5.\nThe objective is to maximize the total profit across all factories.\n// Profit = (R1 - C1) + (R2 - C2) + (R3 - C3) + (R4 - C4) + (R5 - C5)\n// So, the objective function is: Maximize Profit = (20 * F1 - (0.05 * F1^2 + 10 * F1 + 500)) + (25 * F2 - (0.03 * F2^2 + 15 * F2 + 600)) + (30 * F3 - (0.07 * F3^2 + 20 * F3 + 700)) + (28 * F4 - (0.04 * F4^2 + 12 * F4 + 550)) + (32 * F5 - (0.06 * F5^2 + 18 * F5 + 650))\n\n## Generate Constraint-1:\nThe total production capacity across all factories should not exceed 1000 units.\n// F1 + F2 + F3 + F4 + F5 <= 1000",
        "question": "A company operates five different factories that produce a certain product. The company needs to optimize the production levels of each factory to maximize profit while considering various constraints. The cost and revenue functions for each factory are given in the following Table.\n\n| Factory | Cost Function (C) | Revenue Function (R) |\n|---------|-------------------|----------------------|\n| 1       | C1 = 0.05 * F1^2 + 10 * F1 + 500 | R1 = 20 * F1 |\n| 2       | C2 = 0.03 * F2^2 + 15 * F2 + 600 | R2 = 25 * F2 |\n| 3       | C3 = 0.07 * F3^2 + 20 * F3 + 700 | R3 = 30 * F3 |\n| 4       | C4 = 0.04 * F4^2 + 12 * F4 + 550 | R4 = 28 * F4 |\n| 5       | C5 = 0.06 * F5^2 + 18 * F5 + 650 | R5 = 32 * F5 |\n\nThe profit function for each factory is the difference between the revenue and the cost. The objective is to maximize the total profit across all factories. The total production capacity across all factories should not exceed 1000 units.\n\nPlease help the company determine the optimal production levels for each factory (F1, F2, F3, F4, F5) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # production level of factory 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # production level of factory 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # production level of factory 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # production level of factory 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # production level of factory 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate profit for each factory\nProfit_F1 = 20 * F1 - (0.05 * F1**2 + 10 * F1 + 500)\nProfit_F2 = 25 * F2 - (0.03 * F2**2 + 15 * F2 + 600)\nProfit_F3 = 30 * F3 - (0.07 * F3**2 + 20 * F3 + 700)\nProfit_F4 = 28 * F4 - (0.04 * F4**2 + 12 * F4 + 550)\nProfit_F5 = 32 * F5 - (0.06 * F5**2 + 18 * F5 + 650)\n\n## the objective function is: Maximize Profit = Profit_F1 + Profit_F2 + Profit_F3 + Profit_F4 + Profit_F5\nmodel.addCons(obj == Profit_F1 + Profit_F2 + Profit_F3 + Profit_F4 + Profit_F5)\n\n# Add constraints\n## The total production capacity across all factories should not exceed 1000 units.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of Factory 1: \", model.getVal(F1))\n    print(\"Production level of Factory 2: \", model.getVal(F2))\n    print(\"Production level of Factory 3: \", model.getVal(F3))\n    print(\"Production level of Factory 4: \", model.getVal(F4))\n    print(\"Production level of Factory 5: \", model.getVal(F5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and wants to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company needs to determine the number of trucks assigned to each route and the fuel consumption rate for each truck.\n// {\"number of trucks for D1\": \"TrucksD1\", \"range\": \"TrucksD1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D2\": \"TrucksD2\", \"range\": \"TrucksD2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D3\": \"TrucksD3\", \"range\": \"TrucksD3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D4\": \"TrucksD4\", \"range\": \"TrucksD4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for D5\": \"TrucksD5\", \"range\": \"TrucksD5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for each truck\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue generated per truck for each destination is as follows: D1: $1000, D2: $1200, D3: $1500, D4: $1800, D5: $2000. The fuel cost per kilometer is $0.5, and the distance to each destination is D1: 100 km, D2: 150 km, D3: 200 km, D4: 250 km, D5: 300 km. The company wants to maximize the net profit per kilometer traveled.\n// NetProfitD1 = (1000 - 0.5 * FuelRate * 100) * TrucksD1\n// NetProfitD2 = (1200 - 0.5 * FuelRate * 150) * TrucksD2\n// NetProfitD3 = (1500 - 0.5 * FuelRate * 200) * TrucksD3\n// NetProfitD4 = (1800 - 0.5 * FuelRate * 250) * TrucksD4\n// NetProfitD5 = (2000 - 0.5 * FuelRate * 300) * TrucksD5\n// So, the objective function is: Maximize ((NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5) / (100 * TrucksD1 + 150 * TrucksD2 + 200 * TrucksD3 + 250 * TrucksD4 + 300 * TrucksD5))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50",
        "question": "A logistics company operates a fleet of trucks and wants to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company needs to determine the number of trucks assigned to each route and the fuel consumption rate for each truck. The revenue generated per truck for each destination is as follows: D1: $1000, D2: $1200, D3: $1500, D4: $1800, D5: $2000. The fuel cost per kilometer is $0.5, and the distance to each destination is D1: 100 km, D2: 150 km, D3: 200 km, D4: 250 km, D5: 300 km. The company wants to maximize the net profit per kilometer traveled. The company has a total of 50 trucks available. Please help the company to maximize the net profit per kilometer traveled.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksD1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD1\", lb=0) # number of trucks for D1\nTrucksD2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD2\", lb=0) # number of trucks for D2\nTrucksD3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD3\", lb=0) # number of trucks for D3\nTrucksD4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD4\", lb=0) # number of trucks for D4\nTrucksD5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksD5\", lb=0) # number of trucks for D5\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0) # fuel consumption rate for each truck\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfitD1 = (1000 - 0.5 * FuelRate * 100) * TrucksD1\nNetProfitD2 = (1200 - 0.5 * FuelRate * 150) * TrucksD2\nNetProfitD3 = (1500 - 0.5 * FuelRate * 200) * TrucksD3\nNetProfitD4 = (1800 - 0.5 * FuelRate * 250) * TrucksD4\nNetProfitD5 = (2000 - 0.5 * FuelRate * 300) * TrucksD5\nTotalDistance = 100 * TrucksD1 + 150 * TrucksD2 + 200 * TrucksD3 + 250 * TrucksD4 + 300 * TrucksD5\n## the objective function is: Maximize ((NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5) / TotalDistance)\n## convert the division to multiplication\nmodel.addCons(obj * TotalDistance == NetProfitD1 + NetProfitD2 + NetProfitD3 + NetProfitD4 + NetProfitD5)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(TrucksD1 + TrucksD2 + TrucksD3 + TrucksD4 + TrucksD5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for D1: \", model.getVal(TrucksD1))\n    print(\"Number of Trucks for D2: \", model.getVal(TrucksD2))\n    print(\"Number of Trucks for D3: \", model.getVal(TrucksD3))\n    print(\"Number of Trucks for D4: \", model.getVal(TrucksD4))\n    print(\"Number of Trucks for D5: \", model.getVal(TrucksD5))\n    print(\"Fuel Consumption Rate: \", model.getVal(FuelRate))\n    print(\"Maximized Net Profit per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 709,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n// Total operational cost for Route1: Cost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\n// Total operational cost for Route2: Cost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck allocations and technology investments.\n// Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type to minimize operational costs while meeting delivery demands. The operational cost of each truck is influenced by the investment in fuel-efficient technology. For each $1000 invested in technology, the fuel cost per kilometer decreases by $0.05 for Route1 and $0.03 for Route2. The initial fuel cost per kilometer for Route1 is $0.50, and for Route2 is $0.40. The company aims to minimize the total operational cost, which includes fuel and technology investment costs.\n\n| Route | Initial Fuel Cost per Kilometer | Decrease in Fuel Cost per $1000 Investment |\n|-------|---------------------------------|-------------------------------------------|\n| Route1 | $0.50                           | $0.05 per kilometer                      |\n| Route2 | $0.40                           | $0.03 per kilometer                      |\n\nThe company has a total budget of $100,000 for both truck allocations and technology investments. The total number of trucks available for allocation is limited to 500. Please help the company to determine the optimal number of trucks for Route1 (Trucks1) and Route2 (Trucks2), and the investment in fuel-efficient technology for each route (Tech1 and Tech2) to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance1\")  # distance for Route1\nDistance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance2\")  # distance for Route2\nCost1 = (0.50 - 0.00005 * Tech1) * Trucks1 * Distance1\nCost2 = (0.40 - 0.00003 * Tech2) * Trucks2 * Distance2\n## the objective function is: Minimize (Cost1 + Cost2)\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n## The company has a total budget of $100,000 for both truck allocations and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Tech1 + Tech2 <= 100000)\n## The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1458,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance.\n// {\"number of solar panels in Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"SE\", \"range\": \"SE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city aims to maximize the total energy production while minimizing the total cost of installation and maintenance.\n// Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n// Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n// So, the objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all zones is limited to 200.\n// SA + SB + SC + SD + SE <= 200\n\n## Generate Constraint-3:\nAt least 30 solar panels must be installed in Zone A.\n// SA >= 30",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance. The efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city has a budget of $100,000 for the installation and maintenance of solar panels. The total number of solar panels that can be installed across all zones is limited to 200. At least 30 solar panels must be installed in Zone A. Please help the city to maximize the total energy production while minimizing the total cost of installation and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=30) # number of solar panels in Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0) # number of solar panels in Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0) # number of solar panels in Zone C\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of solar panels in Zone D\nSE = model.addVar(vtype=\"INTEGER\", name=\"SE\", lb=0) # number of solar panels in Zone E\n\n# Define objective function\nEnergy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\nCost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n# So, the objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000)\n# The total number of solar panels that can be installed across all zones is limited to 200.\nmodel.addCons(SA + SB + SC + SD + SE <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(SA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(SB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(SC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(SD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(SE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\n// {\"number of solar facilities\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind facilities\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydro facilities\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n// {\"number of biomass facilities\": \"Biomass\", \"range\": \"Biomass >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal facilities\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\n// Total energy production: Energy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\n// Total environmental impact: Impact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $5,000,000 for the construction of these facilities.\n// Cost of solar facilities: 100,000 * Solar\n// Cost of wind facilities: 150,000 * Wind\n// Cost of hydro facilities: 200,000 * Hydro\n// Cost of biomass facilities: 80,000 * Biomass\n// Cost of geothermal facilities: 250,000 * Geothermal\n// Total cost: 100,000 * Solar + 150,000 * Wind + 200,000 * Hydro + 80,000 * Biomass + 250,000 * Geothermal <= 5,000,000",
        "question": "A city is planning to build five different types of renewable energy facilities: solar, wind, hydro, biomass, and geothermal. The city needs to determine how many units of each type of facility to build to maximize energy production while minimizing environmental impact.\nFor solar facilities, the energy production per unit is 50 MWh, the environmental impact score is 10.\nFor wind facilities, the energy production per unit is 60 MWh, the environmental impact score is 12.\nFor hydro facilities, the energy production per unit is 70 MWh, the environmental impact score is 15.\nFor biomass facilities, the energy production per unit is 40 MWh, the environmental impact score is 8.\nFor geothermal facilities, the energy production per unit is 80 MWh, the environmental impact score is 18.\nThe city wants to maximize the Energy-Impact ratio, which is defined as the total energy production divided by the total environmental impact score.\nThe city has a budget of $5,000,000 for the construction of these facilities.\nPlease help the city to determine the optimal number of each type of facility to build under these conditions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar facilities\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind facilities\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydro facilities\nBiomass = model.addVar(vtype=\"INTEGER\", name=\"Biomass\", lb=0) # number of biomass facilities\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # number of geothermal facilities\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 50 * Solar + 60 * Wind + 70 * Hydro + 40 * Biomass + 80 * Geothermal\nImpact = 10 * Solar + 12 * Wind + 15 * Hydro + 8 * Biomass + 18 * Geothermal\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $5,000,000 for the construction of these facilities.\nmodel.addCons(100000 * Solar + 150000 * Wind + 200000 * Hydro + 80000 * Biomass + 250000 * Geothermal <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Facilities: \", model.getVal(Solar))\n    print(\"Number of Wind Facilities: \", model.getVal(Wind))\n    print(\"Number of Hydro Facilities: \", model.getVal(Hydro))\n    print(\"Number of Biomass Facilities: \", model.getVal(Biomass))\n    print(\"Number of Geothermal Facilities: \", model.getVal(Geothermal))\n    print(\"Maximized Energy-Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in automation technology, which will reduce the production cost per unit and increase the production rate.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $300 for ProductB, and $400 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * AutomationInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (300 - 150 + 0.005 * AutomationInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (400 - 200 + 0.005 * AutomationInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for automation investments.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 100 units of ProductA and 200 units of ProductB.\n// UnitsA >= 100; UnitsB >= 200\n\n## Generate Constraint-4:\nThe level of automation cannot exceed the current technological limits, which is set at 50% for all products.\n// AutomationLevel <= 0.5\n\n## Generate Constraint-5:\nThe investment in automation technology must be at least $10,000 to implement any automation.\n// AutomationInvestment >= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in automation technology, which will reduce the production cost per unit and increase the production rate. The initial production cost per unit and selling price for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| ProductA | $100                             | $200                   |\n| ProductB | $150                             | $300                   |\n| ProductC | $200                             | $400                   |\n\nThe company has a total budget of $50,000 for automation investments. The total production capacity of the company is limited to 1000 units per month. Due to market demand, the company must produce at least 100 units of ProductA and 200 units of ProductB. The level of automation cannot exceed the current technological limits, which is set at 50% for all products. The investment in automation technology must be at least $10,000 to implement any automation.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=200) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0, ub=0.5) # level of automation\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=10000, ub=50000) # investment in automation\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * AutomationInvestment) * UnitsA\n## Total profit for ProductB: ProfitB = (300 - 150 + 0.005 * AutomationInvestment) * UnitsB\n## Total profit for ProductC: ProfitC = (400 - 200 + 0.005 * AutomationInvestment) * UnitsC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (200 - 100 + 0.005 * AutomationInvestment) * UnitsA\nProfitB = (300 - 150 + 0.005 * AutomationInvestment) * UnitsB\nProfitC = (400 - 200 + 0.005 * AutomationInvestment) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total budget of $50,000 for automation investments.\nmodel.addCons(AutomationInvestment <= 50000)\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market demand, the company must produce at least 100 units of ProductA and 200 units of ProductB.\nmodel.addCons(UnitsA >= 100)\nmodel.addCons(UnitsB >= 200)\n## The level of automation cannot exceed the current technological limits, which is set at 50% for all products.\nmodel.addCons(AutomationLevel <= 0.5)\n## The investment in automation technology must be at least $10,000 to implement any automation.\nmodel.addCons(AutomationInvestment >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1483,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technologies to improve production efficiency. The investment in automation will reduce the labor and material costs per unit of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor and materials per unit for each product decreases by $5 for every $1000 invested in automation for that product. The initial cost of labor and materials per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $200 for ProductA, $250 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.005 * AutomationA) * QuantityA\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.005 * AutomationB) * QuantityB\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.005 * AutomationC) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 units of resources available for the month.\n// ResourcesA + ResourcesB + ResourcesC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of each product cannot exceed 500 units.\n// QuantityA <= 500; QuantityB <= 500; QuantityC <= 500",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the amount of resources (labor and materials) allocated to each product, and the investment in automation technologies to improve production efficiency. The investment in automation will reduce the labor and material costs per unit of each product. The initial cost of labor and materials per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Cost per Unit | Selling Price per Unit |\n|---------|-----------------------|------------------------|\n| ProductA | $100                 | $200                   |\n| ProductB | $150                 | $250                   |\n| ProductC | $200                 | $300                   |\n\nThe company has a total of 10,000 units of resources available for the month. The total investment in automation cannot exceed $50,000. Due to market demand, the production quantity of each product cannot exceed 500 units. \n\nPlease help the company to maximize the total profit from all products, considering the reduction in cost per unit due to automation investments.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0, ub=500)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0, ub=500)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0, ub=500)  # production quantity of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0)  # resources allocated to ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0)  # resources allocated to ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0)  # resources allocated to ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\nProfitA = (200 - 100 + 0.005 * AutomationA) * QuantityA\nProfitB = (250 - 150 + 0.005 * AutomationB) * QuantityB\nProfitC = (300 - 200 + 0.005 * AutomationC) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total of 10,000 units of resources available for the month.\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Resources allocated to ProductA: \", model.getVal(ResourcesA))\n    print(\"Resources allocated to ProductB: \", model.getVal(ResourcesB))\n    print(\"Resources allocated to ProductC: \", model.getVal(ResourcesC))\n    print(\"Investment in automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process for each product. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the marketing budget for each product, which influences the sales rate.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation for that product. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The sales price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The marketing budget increases the sales rate by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\n// Total profit for ProductB: ProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\n// Total profit for ProductC: ProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $30,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 30000\n\n## Generate Constraint-4:\nThe company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced.\n// QuantityA >= 2000; QuantityB >= 3000\n\n## Generate Constraint-5:\nDue to market saturation, the sales rate for ProductC cannot exceed 50% of the production rate.\n// QuantityC <= 2 * MarketingBudgetC / 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the level of automation to be implemented in the production process for each product, and the marketing budget for each product. The level of automation affects the production cost per unit and the production rate, while the marketing budget influences the sales rate. The initial production cost per unit, sales price per unit, and the effect of automation and marketing budget on the products are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Sales Price per Unit | Effect of Automation | Effect of Marketing Budget |\n|---------|----------------------------------|----------------------|----------------------|----------------------------|\n| ProductA | $100                             | $150                 | $5 per $1,000        | 1% increase per $1,000      |\n| ProductB | $120                             | $180                 | $5 per $1,000        | 1% increase per $1,000      |\n| ProductC | $150                             | $200                 | $5 per $1,000        | 1% increase per $1,000      |\n\nThe company has a total production capacity of 10,000 units. The total investment in automation cannot exceed $50,000, and the total marketing budget cannot exceed $30,000. The company must ensure that at least 2,000 units of ProductA and 3,000 units of ProductB are produced. Due to market saturation, the sales rate for ProductC cannot exceed 50% of the production rate.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=2000) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=3000) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0) # level of automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0) # level of automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0) # level of automation for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * AutomationA) * QuantityA - MarketingBudgetA\nProfitB = (180 - 120 + 0.005 * AutomationB) * QuantityB - MarketingBudgetB\nProfitC = (200 - 150 + 0.005 * AutomationC) * QuantityC - MarketingBudgetC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n# The total marketing budget cannot exceed $30,000.\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 30000)\n# Due to market saturation, the sales rate for ProductC cannot exceed 50% of the production rate.\nmodel.addCons(QuantityC <= 2 * MarketingBudgetC / 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1653,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product in the next production cycle. Additionally, the company can outsource production to external contractors.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductA\": \"OutsourcedA\", \"range\": \"OutsourcedA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductB\": \"OutsourcedB\", \"range\": \"OutsourcedB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for ProductC\": \"OutsourcedC\", \"range\": \"OutsourcedC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50 if produced internally and $40 if outsourced. For ProductB, the profit per unit is $70 internally and $55 if outsourced. For ProductC, the profit per unit is $90 internally and $70 if outsourced. The production cost per unit for ProductA is $20 internally and $30 if outsourced. For ProductB, the production cost is $30 internally and $40 if outsourced. For ProductC, the production cost is $40 internally and $50 if outsourced. The company aims to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20) * UnitsA + (40 - 30) * OutsourcedA\n// Total profit for ProductB: Profit_B = (70 - 30) * UnitsB + (55 - 40) * OutsourcedB\n// Total profit for ProductC: Profit_C = (90 - 40) * UnitsC + (70 - 50) * OutsourcedC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units internally.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of units of ProductA produced must be at least twice the number of units of ProductB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for outsourcing costs.\n// 30 * OutsourcedA + 40 * OutsourcedB + 50 * OutsourcedC <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 100 units of each product are produced.\n// UnitsA + OutsourcedA >= 100; UnitsB + OutsourcedB >= 100; UnitsC + OutsourcedC >= 100\n\n## Generate Constraint-5:\nDue to contractual agreements, the company must outsource at least 50 units in total.\n// OutsourcedA + OutsourcedB + OutsourcedC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product in the next production cycle and can also outsource production to external contractors. The profit per unit for ProductA is $50 if produced internally and $40 if outsourced, with a production cost of $20 internally and $30 if outsourced. For ProductB, the profit per unit is $70 internally and $55 if outsourced, with a production cost of $30 internally and $40 if outsourced. For ProductC, the profit per unit is $90 internally and $70 if outsourced, with a production cost of $40 internally and $50 if outsourced. The company has a total production capacity of 1000 units internally. The number of units of ProductA produced must be at least twice the number of units of ProductB. The company has a budget of $50,000 for outsourcing costs. The company wants to ensure that at least 100 units of each product are produced and must outsource at least 50 units in total.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nOutsourcedA = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedA\", lb=0)  # number of units outsourced for ProductA\nOutsourcedB = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedB\", lb=0)  # number of units outsourced for ProductB\nOutsourcedC = model.addVar(vtype=\"INTEGER\", name=\"OutsourcedC\", lb=0)  # number of units outsourced for ProductC\n\n# Define objective function\nProfit_A = (50 - 20) * UnitsA + (40 - 30) * OutsourcedA\nProfit_B = (70 - 30) * UnitsB + (55 - 40) * OutsourcedB\nProfit_C = (90 - 40) * UnitsC + (70 - 50) * OutsourcedC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # Total production capacity of 1000 units internally\nmodel.addCons(UnitsA >= 2 * UnitsB)  # Units of ProductA must be at least twice the units of ProductB\nmodel.addCons(30 * OutsourcedA + 40 * OutsourcedB + 50 * OutsourcedC <= 50000)  # Budget for outsourcing costs\nmodel.addCons(UnitsA + OutsourcedA >= 100)  # At least 100 units of each product are produced\nmodel.addCons(UnitsB + OutsourcedB >= 100)\nmodel.addCons(UnitsC + OutsourcedC >= 100)\nmodel.addCons(OutsourcedA + OutsourcedB + OutsourcedC >= 50)  # Must outsource at least 50 units in total\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Outsourced ProductA: \", model.getVal(OutsourcedA))\n    print(\"Outsourced ProductB: \", model.getVal(OutsourcedB))\n    print(\"Outsourced ProductC: \", model.getVal(OutsourcedC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.1 for each unit produced after the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.05 for each unit produced after the first 200 units. The profit per unit for ComponentC is $80, but it decreases by $0.08 for each unit produced after the first 150 units. The profit per unit for ComponentD is $60, but it decreases by $0.06 for each unit produced after the first 120 units. The profit per unit for ComponentE is $90, but it decreases by $0.1 for each unit produced after the first 180 units. The company wants to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\n// Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\n// Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\n// Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB.\n// UnitsA >= 0.5 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials per month.\n// 10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50,000",
        "question": "A manufacturing company produces five different types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize their profit. The profit per unit for each component decreases as more units are produced beyond certain thresholds, as shown in the following Table.\n\n| Component | Profit per Unit (first threshold) | Decrease per Unit (after threshold) | Threshold |\n|-----------|-----------------------------------|------------------------------------|-----------|\n| ComponentA | $50                              | $0.1                               | 100 units  |\n| ComponentB | $70                              | $0.05                              | 200 units  |\n| ComponentC | $80                              | $0.08                              | 150 units  |\n| ComponentD | $60                              | $0.06                              | 120 units  |\n| ComponentE | $90                              | $0.1                               | 180 units  |\n\nThe company has a total production capacity of 1000 units per month. Due to supplier agreements, the production of ComponentA must be at least half of the production of ComponentB. The company has a budget of $50,000 for raw materials per month. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0)  # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0)  # number of units of ComponentE\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(UnitsB - 200, 0)) * UnitsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=1000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == B1*B_b1 + B2*B_b2)\nProfit_B = (70 - 0.05 * B2) * B2 * B_b2 + 70 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (80 - 0.08 * max(UnitsC - 150, 0)) * UnitsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=150)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=150, ub=1000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == C1*C_b1 + C2*C_b2)\nProfit_C = (80 - 0.08 * C2) * C2 * C_b2 + 80 * C1 * C_b1\n## create piecewise variables for piecewise function: Profit_D = (60 - 0.06 * max(UnitsD - 120, 0)) * UnitsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=120)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=120, ub=1000)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(UnitsD == D1*D_b1 + D2*D_b2)\nProfit_D = (60 - 0.06 * D2) * D2 * D_b2 + 60 * D1 * D_b1\n## create piecewise variables for piecewise function: Profit_E = (90 - 0.1 * max(UnitsE - 180, 0)) * UnitsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=180)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=180, ub=1000)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(UnitsE == E1*E_b1 + E2*E_b2)\nProfit_E = (90 - 0.1 * E2) * E2 * E_b2 + 90 * E1 * E_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\nmodel.addCons(UnitsA >= 0.5 * UnitsB)\nmodel.addCons(10 * UnitsA + 15 * UnitsB + 20 * UnitsC + 12 * UnitsD + 25 * UnitsE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductA\": \"QualityControlA\", \"range\": \"QualityControlA >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductB\": \"QualityControlB\", \"range\": \"QualityControlB >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductC\": \"QualityControlC\", \"range\": \"QualityControlC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n// Total revenue for ProductA: RevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\n// Total cost for ProductA: CostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\n// Total cost for ProductB: CostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\n// Total cost for ProductC: CostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total budget for marketing and quality control cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 1000 units of each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000\n\n## Generate Constraint-3:\nThe company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB.\n// MarketingBudgetA >= 10000; MarketingBudgetB >= 15000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit, production cost, and initial defect rate for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Initial Defect Rate |\n|---------|------------------|--------------------------|---------------------|\n| ProductA | $100            | $50                      | 5%                  |\n| ProductB | $150            | $75                      | 5%                  |\n| ProductC | $200            | $100                     | 5%                  |\n\nThe marketing budget increases the sales linearly at a rate of $5 per $1000 spent, and the quality control investment reduces the defect rate by 1% for every $1000 invested. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n\nThe total budget for marketing and quality control cannot exceed $100,000. The company can produce a maximum of 1000 units of each product. The company must allocate at least $10,000 to marketing for ProductA and $15,000 for ProductB.\n\nPlease help the company to determine the optimal production quantity, marketing budget, and quality control investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nQualityControlA = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlA\", lb=0) # quality control investment for ProductA\nQualityControlB = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlB\", lb=0) # quality control investment for ProductB\nQualityControlC = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlC\", lb=0) # quality control investment for ProductC\n\n# Define objective function\nRevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\nRevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\nRevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\nCostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\nCostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\nCostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\nmodel.addCons(MarketingBudgetA >= 10000)\nmodel.addCons(MarketingBudgetB >= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Quality Control Investment for ProductA: \", model.getVal(QualityControlA))\n    print(\"Quality Control Investment for ProductB: \", model.getVal(QualityControlB))\n    print(\"Quality Control Investment for ProductC: \", model.getVal(QualityControlC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1614,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines.\n// {\"number of trips for Route A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company wants to minimize the total fuel consumption.\n// Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\n// Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\n// Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\n// Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\n// Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 300 trips available across all routes.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 300\n\n## Generate Constraint-2:\nEach route has a minimum required number of trips to meet delivery deadlines. Route A requires at least 20 trips, Route B requires at least 30 trips, Route C requires at least 25 trips, Route D requires at least 40 trips, and Route E requires at least 50 trips.\n// TripsA >= 20; TripsB >= 30; TripsC >= 25; TripsD >= 40; TripsE >= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines. The fuel consumption for each route is nonlinear and depends on the number of trips, as shown in the following Table.\n\n| Route | Fuel Consumption per Trip (liters) | Decrease in Fuel Consumption per Additional Trip After Threshold (liters) | Threshold (trips) |\n|-------|------------------------------------|-------------------------------------------------------------------------|------------------|\n| A     | 100                                | 0.1                                                                     | 50               |\n| B     | 120                                | 0.15                                                                    | 60               |\n| C     | 110                                | 0.12                                                                    | 55               |\n| D     | 130                                | 0.18                                                                    | 70               |\n| E     | 140                                | 0.2                                                                     | 80               |\n\nThe company has a total of 300 trips available across all routes. Each route has a minimum required number of trips to meet delivery deadlines: Route A requires at least 20 trips, Route B requires at least 30 trips, Route C requires at least 25 trips, Route D requires at least 40 trips, and Route E requires at least 50 trips.\n\nPlease help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=20) # number of trips for Route A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=30) # number of trips for Route B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=25) # number of trips for Route C\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=40) # number of trips for Route D\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=50) # number of trips for Route E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=50)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=50, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TripsA == A1*A_b1 + A2*A_b2)\nFuel_A = 100 * A1 * A_b1 + (100 - 0.1 * (A2 - 50)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=60)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=60, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TripsB == B1*B_b1 + B2*B_b2)\nFuel_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 60)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=55)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=55, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TripsC == C1*C_b1 + C2*C_b2)\nFuel_C = 110 * C1 * C_b1 + (110 - 0.12 * (C2 - 55)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=70)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=70, ub=300)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TripsD == D1*D_b1 + D2*D_b2)\nFuel_D = 130 * D1 * D_b1 + (130 - 0.18 * (D2 - 70)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=80)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=80, ub=300)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TripsE == E1*E_b1 + E2*E_b2)\nFuel_E = 140 * E1 * E_b1 + (140 - 0.2 * (E2 - 80)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Route A: \", model.getVal(TripsA))\n    print(\"Number of Trips for Route B: \", model.getVal(TripsB))\n    print(\"Number of Trips for Route C: \", model.getVal(TripsC))\n    print(\"Number of Trips for Route D: \", model.getVal(TripsD))\n    print(\"Number of Trips for Route E: \", model.getVal(TripsE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1960,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trips each truck should make to different regions (Region1, Region2, Region3, Region4, Region5) and the fuel consumption rate for each trip, which varies based on the region and the load.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per trip to Region1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n// Revenue from Region1: Revenue1 = 1000 * Trips1\n// Revenue from Region2: Revenue2 = 1000 * Trips2\n// Revenue from Region3: Revenue3 = 1000 * Trips3\n// Revenue from Region4: Revenue4 = 1000 * Trips4\n// Revenue from Region5: Revenue5 = 1000 * Trips5\n// Fuel cost for Region1: FuelCost1 = FuelRate1^2 * Trips1\n// Fuel cost for Region2: FuelCost2 = FuelRate2^2 * Trips2\n// Fuel cost for Region3: FuelCost3 = FuelRate3^2 * Trips3\n// Fuel cost for Region4: FuelCost4 = FuelRate4^2 * Trips4\n// Fuel cost for Region5: FuelCost5 = FuelRate5^2 * Trips5\n// So, the objective function is: Maximize (Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5) - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of trips each truck should make to these regions and the fuel consumption rate for each trip, which varies based on the region and the load. The revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n\n| Region | Revenue per Trip | Fuel Cost Formula |\n|--------|------------------|-------------------|\n| Region1 | $1000            | FuelRate1^2       |\n| Region2 | $1000            | FuelRate2^2       |\n| Region3 | $1000            | FuelRate3^2       |\n| Region4 | $1000            | FuelRate4^2       |\n| Region5 | $1000            | FuelRate5^2       |\n\nThe total number of trips across all regions must not exceed 500. Please help the company to maximize its net profit by determining the optimal number of trips and fuel consumption rates for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0)  # fuel consumption rate per trip to Region1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate per trip to Region2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate per trip to Region3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0)  # fuel consumption rate per trip to Region4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0)  # fuel consumption rate per trip to Region5\n\n# Define objective function\nRevenue1 = 1000 * Trips1\nRevenue2 = 1000 * Trips2\nRevenue3 = 1000 * Trips3\nRevenue4 = 1000 * Trips4\nRevenue5 = 1000 * Trips5\nFuelCost1 = FuelRate1**2 * Trips1\nFuelCost2 = FuelRate2**2 * Trips2\nFuelCost3 = FuelRate3**2 * Trips3\nFuelCost4 = FuelRate4**2 * Trips4\nFuelCost5 = FuelRate5**2 * Trips5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5) - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nmodel.addCons(obj == Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5 - FuelCost1 - FuelCost2 - FuelCost3 - FuelCost4 - FuelCost5)\n\n# Add constraints\n# The total number of trips across all regions must not exceed 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of trips to Region5: \", model.getVal(Trips5))\n    print(\"Fuel consumption rate per trip to Region1: \", model.getVal(FuelRate1))\n    print(\"Fuel consumption rate per trip to Region2: \", model.getVal(FuelRate2))\n    print(\"Fuel consumption rate per trip to Region3: \", model.getVal(FuelRate3))\n    print(\"Fuel consumption rate per trip to Region4: \", model.getVal(FuelRate4))\n    print(\"Fuel consumption rate per trip to Region5: \", model.getVal(FuelRate5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1154,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (A, B, C, D, and E) to maximize energy production while minimizing the environmental impact.\n// {\"number of solar panels in zone A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in zone E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in zone A is 0.8 kWh/panel, with an environmental impact score of 0.1.\nIn zone B, the efficiency is 0.9 kWh/panel, with an environmental impact score of 0.2.\nIn zone C, the efficiency is 1.0 kWh/panel, with an environmental impact score of 0.3.\nIn zone D, the efficiency is 1.1 kWh/panel, with an environmental impact score of 0.4.\nIn zone E, the efficiency is 1.2 kWh/panel, with an environmental impact score of 0.5.\nThe city aims to maximize the energy production per unit of environmental impact (defined as the total energy produced divided by the total environmental impact).\n// Total energy produced: Energy = 0.8 * A + 0.9 * B + 1.0 * C + 1.1 * D + 1.2 * E\n// Total environmental impact: Impact = 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E\n// So, the objective function is: Maximize Energy / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 to spend on solar panel installations.\n// Cost of panels in zone A: 1000 * A\n// Cost of panels in zone B: 1200 * B\n// Cost of panels in zone C: 1400 * C\n// Cost of panels in zone D: 1600 * D\n// Cost of panels in zone E: 1800 * E\n// 1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E <= 500000\n\n## Generate Constraint-2:\nThe city wants to ensure that at least 50% of the budget is spent on solar panels.\n// 1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E >= 250000\n\n## Generate Constraint-3:\nThe city has a limit of 300 panels that can be installed in total.\n// A + B + C + D + E <= 300",
        "question": "A city is planning to install solar panels on rooftops across different zones (A, B, C, D, and E) to maximize energy production while minimizing the environmental impact. The efficiency of solar panels in zone A is 0.8 kWh/panel, with an environmental impact score of 0.1. In zone B, the efficiency is 0.9 kWh/panel, with an environmental impact score of 0.2. In zone C, the efficiency is 1.0 kWh/panel, with an environmental impact score of 0.3. In zone D, the efficiency is 1.1 kWh/panel, with an environmental impact score of 0.4. In zone E, the efficiency is 1.2 kWh/panel, with an environmental impact score of 0.5. The city aims to maximize the energy production per unit of environmental impact (defined as the total energy produced divided by the total environmental impact). The city has a budget of $500,000 to spend on solar panel installations. The city wants to ensure that at least 50% of the budget is spent on solar panels. The city has a limit of 300 panels that can be installed in total. Please help the city determine the optimal number of solar panels to install in each zone to achieve their goals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of solar panels in zone A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of solar panels in zone B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of solar panels in zone C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of solar panels in zone D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of solar panels in zone E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 0.8 * A + 0.9 * B + 1.0 * C + 1.1 * D + 1.2 * E\nImpact = 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E\n## the objective function is: Maximize Energy / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Energy)\n\n# Add constraints\n## The city has a budget of $500,000 to spend on solar panel installations.\nmodel.addCons(1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E <= 500000)\n## The city wants to ensure that at least 50% of the budget is spent on solar panels.\nmodel.addCons(1000 * A + 1200 * B + 1400 * C + 1600 * D + 1800 * E >= 250000)\n## The city has a limit of 300 panels that can be installed in total.\nmodel.addCons(A + B + C + D + E <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(A))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(B))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(C))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(D))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(E))\n    print(\"Maximized Energy per Unit of Environmental Impact: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity and operational cost.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe small truck has a capacity of 100 units, a daily operational cost of $200, and a fuel efficiency of 5 km/L.\nThe medium truck has a capacity of 200 units, a daily operational cost of $300, and a fuel efficiency of 8 km/L.\nThe large truck has a capacity of 300 units, a daily operational cost of $400, and a fuel efficiency of 10 km/L.\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs.\n// Total operational cost: OperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\n// Total fuel cost: FuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n// So, the objective function is: Minimize (OperationalCost + FuelCost)\n// Minimize (200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks + (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks)\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the delivery requirement of 1500 units.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500\n\n## Generate Constraint-2:\nThe company has a budget constraint of $10,000 for the total operational costs.\n// 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000\n\n## Generate Constraint-3:\nThe company can only use a maximum of 20 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 20\n\n## Generate Constraint-4:\nThe number of large trucks cannot exceed half the number of small trucks.\n// LargeTrucks <= SmallTrucks / 2",
        "question": "A logistics company needs to optimize its delivery routes using three different types of vehicles: small, medium, and large trucks. Each type of truck has a different capacity, daily operational cost, and fuel efficiency. The details for each type of truck are given in the following Table.\n\n| Truck Type | Capacity (units) | Daily Operational Cost ($) | Fuel Efficiency (km/L) |\n|------------|------------------|-----------------------------|-----------------------|\n| Small      | 100              | 200                         | 5                     |\n| Medium     | 200              | 300                         | 8                     |\n| Large      | 300              | 400                         | 10                    |\n\nThe company needs to deliver a total of 1500 units over a distance of 500 km. The objective is to minimize the total cost of operations, which includes both the daily operational costs and the fuel costs. The company has a budget constraint of $10,000 for the total operational costs. The company can only use a maximum of 20 trucks in total. The number of large trucks cannot exceed half the number of small trucks. The total capacity of all trucks must meet the delivery requirement of 1500 units.\n\nPlease help the company to minimize the total cost of operations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperationalCost = 200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks\nFuelCost = (500 / 5) * 200 * SmallTrucks + (500 / 8) * 300 * MediumTrucks + (500 / 10) * 400 * LargeTrucks\n## the objective function is: Minimize (OperationalCost + FuelCost)\nmodel.addCons(obj == OperationalCost + FuelCost)\n\n# Add constraints\n## The total capacity of all trucks must meet the delivery requirement of 1500 units.\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks >= 1500)\n## The company has a budget constraint of $10,000 for the total operational costs.\nmodel.addCons(200 * SmallTrucks + 300 * MediumTrucks + 400 * LargeTrucks <= 10000)\n## The company can only use a maximum of 20 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 20)\n## The number of large trucks cannot exceed half the number of small trucks.\nmodel.addCons(LargeTrucks <= SmallTrucks / 2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 5 different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency while minimizing energy consumption.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different production rate and energy consumption rate per worker. The production rate (units per hour) and energy consumption (kWh per hour) are as follows:\n- Machine 1: 10 units/hour, 5 kWh/hour\n- Machine 2: 15 units/hour, 7 kWh/hour\n- Machine 3: 20 units/hour, 9 kWh/hour\n- Machine 4: 25 units/hour, 11 kWh/hour\n- Machine 5: 30 units/hour, 13 kWh/hour\nThe objective is to maximize the total production while keeping the total energy consumption below a certain threshold.\n// Total production: P = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Total energy consumption: E = 5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5\n// Objective function: Maximize P - (E^2 / 1000)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 50",
        "question": "A manufacturing plant produces electronic components using 5 different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency while minimizing energy consumption. The production rate (units per hour) and energy consumption (kWh per hour) for each machine are given in the following Table.\n\n| Machine | Production Rate (units/hour) | Energy Consumption (kWh/hour) |\n|---------|-------------------------------|-------------------------------|\n| 1       | 10                            | 5                             |\n| 2       | 15                            | 7                             |\n| 3       | 20                            | 9                             |\n| 4       | 25                            | 11                            |\n| 5       | 30                            | 13                            |\n\nThe objective is to maximize the total production while keeping the total energy consumption below a certain threshold. There are a total of 50 workers available. Please help the plant manager to maximize the total production while considering the energy consumption constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\n## Total production: P = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n## Total energy consumption: E = 5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5\n## Objective function: Maximize P - (E^2 / 1000)\nP = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\nE = 5 * M1 + 7 * M2 + 9 * M3 + 11 * M4 + 13 * M5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - (E**2 / 1000))\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(M1))\n    print(\"Number of workers on machine 2: \", model.getVal(M2))\n    print(\"Number of workers on machine 3: \", model.getVal(M3))\n    print(\"Number of workers on machine 4: \", model.getVal(M4))\n    print(\"Number of workers on machine 5: \", model.getVal(M5))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for its trucks to minimize fuel consumption and travel time. The company has five different routes (Route1, Route2, Route3, Route4, Route5) that each truck can take, and each route has a different length and traffic condition. Additionally, the company can invest in upgrading the fuel efficiency of each route by improving road conditions.\n// {\"trucks on Route1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"trucks on Route5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"investment in Route1 efficiency\": \"Invest1\", \"range\": \"Invest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route2 efficiency\": \"Invest2\", \"range\": \"Invest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route3 efficiency\": \"Invest3\", \"range\": \"Invest3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route4 efficiency\": \"Invest4\", \"range\": \"Invest4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in Route5 efficiency\": \"Invest5\", \"range\": \"Invest5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are affected by the investment in road condition improvements. The initial fuel consumption rate for Route1 is 10 liters per truck, but with investment, the rate decreases by 0.1 liters per truck for every $100 invested. Similar effects apply to the other routes with different initial rates and decrease rates. The company aims to minimize the total fuel consumption across all routes.\n// Fuel_Route1 = (10 - 0.001 * Invest1) * Truck1\n// Fuel_Route2 = (12 - 0.0012 * Invest2) * Truck2\n// Fuel_Route3 = (11 - 0.0011 * Invest3) * Truck3\n// Fuel_Route4 = (9 - 0.0009 * Invest4) * Truck4\n// Fuel_Route5 = (13 - 0.0013 * Invest5) * Truck5\n// So, the objective function is: Minimize (Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for route improvements and truck operations.\n// 1000 * Truck1 + 1200 * Truck2 + 1100 * Truck3 + 900 * Truck4 + 1300 * Truck5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for all routes is limited to 500.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for its trucks to minimize fuel consumption and travel time. The company has five different routes (Route1, Route2, Route3, Route4, Route5) that each truck can take, and each route has a different length and traffic condition. Additionally, the company can invest in upgrading the fuel efficiency of each route by improving road conditions. The fuel consumption and travel time for each route are affected by the investment in road condition improvements. The company has a total budget of $100,000 for route improvements and truck operations. The total number of trucks available for all routes is limited to 500.\n\nPlease help the company to minimize the total fuel consumption across all routes, considering the initial fuel consumption rates and the decrease in fuel consumption rate per truck for every $100 invested in road condition improvements for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)  # trucks on Route1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)  # trucks on Route2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0)  # trucks on Route3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0)  # trucks on Route4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0)  # trucks on Route5\nInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest1\", lb=0)  # investment in Route1 efficiency\nInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest2\", lb=0)  # investment in Route2 efficiency\nInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest3\", lb=0)  # investment in Route3 efficiency\nInvest4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest4\", lb=0)  # investment in Route4 efficiency\nInvest5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Invest5\", lb=0)  # investment in Route5 efficiency\n\n# Define objective function\nFuel_Route1 = (10 - 0.001 * Invest1) * Truck1\nFuel_Route2 = (12 - 0.0012 * Invest2) * Truck2\nFuel_Route3 = (11 - 0.0011 * Invest3) * Truck3\nFuel_Route4 = (9 - 0.0009 * Invest4) * Truck4\nFuel_Route5 = (13 - 0.0013 * Invest5) * Truck5\n# So, the objective function is: Minimize (Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Route1 + Fuel_Route2 + Fuel_Route3 + Fuel_Route4 + Fuel_Route5)\n\n# Add constraints\n# The company has a total budget of $100,000 for route improvements and truck operations.\nmodel.addCons(1000 * Truck1 + 1200 * Truck2 + 1100 * Truck3 + 900 * Truck4 + 1300 * Truck5 + Invest1 + Invest2 + Invest3 + Invest4 + Invest5 <= 100000)\n# The total number of trucks available for all routes is limited to 500.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Trucks on Route1: \", model.getVal(Truck1))\n    print(\"Trucks on Route2: \", model.getVal(Truck2))\n    print(\"Trucks on Route3: \", model.getVal(Truck3))\n    print(\"Trucks on Route4: \", model.getVal(Truck4))\n    print(\"Trucks on Route5: \", model.getVal(Truck5))\n    print(\"Investment in Route1 Efficiency: \", model.getVal(Invest1))\n    print(\"Investment in Route2 Efficiency: \", model.getVal(Invest2))\n    print(\"Investment in Route3 Efficiency: \", model.getVal(Invest3))\n    print(\"Investment in Route4 Efficiency: \", model.getVal(Invest4))\n    print(\"Investment in Route5 Efficiency: \", model.getVal(Invest5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a fuel cost of $50 per day, each Van can deliver 50 packages per day with a fuel cost of $30 per day, and each Bike can deliver 20 packages per day with a fuel cost of $10 per day. The company aims to maximize the total number of packages delivered per dollar spent on fuel.\n// Total packages delivered by Trucks: Packages_T = 100 * T\n// Total packages delivered by Vans: Packages_V = 50 * V\n// Total packages delivered by Bikes: Packages_B = 20 * B\n// Total fuel cost: Fuel_Cost = 50 * T + 30 * V + 10 * B\n// So, the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / (Fuel_Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for fuel costs.\n// 50 * T + 30 * V + 10 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. Each Truck can deliver 100 packages per day with a fuel cost of $50 per day, each Van can deliver 50 packages per day with a fuel cost of $30 per day, and each Bike can deliver 20 packages per day with a fuel cost of $10 per day. The company aims to maximize the total number of packages delivered per dollar spent on fuel. The company has a budget of $1000 per day for fuel costs and a total of 50 drivers available. Please help the company to maximize the objective function, which is the total number of packages delivered divided by the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nPackages_T = 100 * T\nPackages_V = 50 * V\nPackages_B = 20 * B\nFuel_Cost = 50 * T + 30 * V + 10 * B\n## the objective function is: Maximize (Packages_T + Packages_V + Packages_B) / Fuel_Cost\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Cost == Packages_T + Packages_V + Packages_B)\n\n# Add constraints\n## The company has a budget of $1000 per day for fuel costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Operating cost of A: CostA = 200 * TrucksA\n// Operating cost of B: CostB = 250 * TrucksB\n// Operating cost of C: CostC = 300 * TrucksC\n// Operating cost of D: CostD = 350 * TrucksD\n// Operating cost of E: CostE = 400 * TrucksE\n// Revenue of A: RevenueA = 500 * TrucksA\n// Revenue of B: RevenueB = 600 * TrucksB\n// Revenue of C: RevenueC = 700 * TrucksC\n// Revenue of D: RevenueD = 800 * TrucksD\n// Revenue of E: RevenueE = 900 * TrucksE\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 30 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of the total trucks are allocated to each route.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)",
        "question": "A logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost. The company has a total budget of $10,000 for operating costs and a maximum of 30 trucks available for allocation. The company wants to ensure that at least 10% of the total trucks are allocated to each route. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for route E\n\n# Define objective function\nCostA = 200 * TrucksA\nCostB = 250 * TrucksB\nCostC = 300 * TrucksC\nCostD = 350 * TrucksD\nCostE = 400 * TrucksE\nRevenueA = 500 * TrucksA\nRevenueB = 600 * TrucksB\nRevenueC = 700 * TrucksC\nRevenueD = 800 * TrucksD\nRevenueE = 900 * TrucksE\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n# Add constraints\n# The company has a total budget of $10,000 for operating costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000)\n# The company has a maximum of 30 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30)\n# The company wants to ensure that at least 10% of the total trucks are allocated to each route.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for truck i\": \"Fuel_Rate_i\", \"range\": \"Fuel_Rate_i >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3. The company aims to minimize the total fuel consumption across all trucks and routes.\n// Total fuel consumption for truck i: Fuel_Consumption_i = Fuel_Rate_i * Distance_j * Trucks_j\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// \u03a3(Trucks_j) for all j <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for each route is 100 km/h.\n// Speed_i <= 100 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel consumption rate (in liters per km) which varies nonlinearly with speed. The fuel consumption rate for each truck is modeled as a nonlinear function of its speed, given by Fuel_Rate_i = 0.05 * Speed_i^2 + 0.001 * Speed_i^3.\n\nThe company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is 50. The maximum speed limit for each route is 100 km/h.\n\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define the speed of each truck (in km/h)\nSpeed = {}\nfor i in range(1, 51):  # Assuming a maximum of 50 trucks\n    Speed[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Speed_{i}\", lb=0, ub=120)\n\n## Define the number of trucks on each route\nTrucks = {}\nfor j in range(1, 11):  # Assuming a maximum of 10 routes\n    Trucks[j] = model.addVar(vtype=\"INTEGER\", name=f\"Trucks_{j}\", lb=0)\n\n## Define the fuel consumption rate for each truck\nFuel_Rate = {}\nfor i in range(1, 51):\n    Fuel_Rate[i] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Fuel_Rate_{i}\", lb=0)\n    model.addCons(Fuel_Rate[i] == 0.05 * Speed[i]**2 + 0.001 * Speed[i]**3)\n\n# Define objective function\n## Calculate the total fuel consumption for each truck on each route\nFuel_Consumption = {}\nfor i in range(1, 51):\n    for j in range(1, 11):\n        Fuel_Consumption[i, j] = model.addVar(vtype=\"CONTINUOUS\", name=f\"Fuel_Consumption_{i}_{j}\", lb=0)\n        model.addCons(Fuel_Consumption[i, j] == Fuel_Rate[i] * Trucks[j])\n\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize \u03a3(Fuel_Consumption_i) for all i and j\nmodel.addCons(obj == sum(Fuel_Consumption[i, j] for i in range(1, 51) for j in range(1, 11)))\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(sum(Trucks[j] for j in range(1, 11)) <= 50)\n\n## The maximum speed limit for each route is 100 km/h.\nfor i in range(1, 51):\n    model.addCons(Speed[i] <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(1, 51):\n        print(f\"Speed of truck {i}: {model.getVal(Speed[i])} km/h\")\n    for j in range(1, 11):\n        print(f\"Number of trucks on route {j}: {model.getVal(Trucks[j])}\")\n    print(f\"Total Fuel Consumption: {model.getObjVal()} liters\")\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component.\n// {\"hours Facility 1 operates for Component A\": \"H1A\", \"range\": \"H1A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component B\": \"H1B\", \"range\": \"H1B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 1 operates for Component C\": \"H1C\", \"range\": \"H1C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component A\": \"H2A\", \"range\": \"H2A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component B\": \"H2B\", \"range\": \"H2B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 2 operates for Component C\": \"H2C\", \"range\": \"H2C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component A\": \"H3A\", \"range\": \"H3A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component B\": \"H3B\", \"range\": \"H3B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 3 operates for Component C\": \"H3C\", \"range\": \"H3C >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component A\": \"H4A\", \"range\": \"H4A >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component B\": \"H4B\", \"range\": \"H4B >= 0\", \"type\": \"real\"}\n// {\"hours Facility 4 operates for Component C\": \"H4C\", \"range\": \"H4C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated. The objective is to minimize the total cost.\n// Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n// Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n// Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n// Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n// Objective function: Minimize C = C1 + C2 + C3 + C4\n// Minimize C = 100 * (H1A^2 + H1B^2 + H1C^2) + 150 * (H2A^2 + H2B^2 + H2C^2) + 200 * (H3A^2 + H3B^2 + H3C^2) + 250 * (H4A^2 + H4B^2 + H4C^2)\n\n## Generate Constraint-1:\nThe total production of Component A must be at least 1000 units.\n// H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000\n\n## Generate Constraint-2:\nThe total production of Component B must be at least 1500 units.\n// H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500\n\n## Generate Constraint-3:\nThe total production of Component C must be at least 2000 units.\n// H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000\n\n## Generate Constraint-4:\nEach facility has a maximum operational limit of 100 hours per week.\n// H1A + H1B + H1C <= 100\n// H2A + H2B + H2C <= 100\n// H3A + H3B + H3C <= 100\n// H4A + H4B + H4C <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production facilities, each with varying capacities and efficiencies. The decision variables are the number of hours each facility operates to produce each type of component. The company aims to minimize the total operational cost while meeting the demand for each component. The cost of operating each facility varies with the type of component produced and the number of hours operated.\n\nThe company needs to ensure the following:\n1. The total production of Component A must be at least 1000 units.\n2. The total production of Component B must be at least 1500 units.\n3. The total production of Component C must be at least 2000 units.\n4. Each facility has a maximum operational limit of 100 hours per week.\n\nPlease help the company to minimize the total operational cost, which is calculated as follows:\n- Cost of Facility 1: C1 = 100 * (H1A^2 + H1B^2 + H1C^2)\n- Cost of Facility 2: C2 = 150 * (H2A^2 + H2B^2 + H2C^2)\n- Cost of Facility 3: C3 = 200 * (H3A^2 + H3B^2 + H3C^2)\n- Cost of Facility 4: C4 = 250 * (H4A^2 + H4B^2 + H4C^2)\n- Objective function: Minimize C = C1 + C2 + C3 + C4\n\nWhere H1A, H1B, H1C, H2A, H2B, H2C, H3A, H3B, H3C, H4A, H4B, and H4C represent the hours each facility operates for each type of component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1A = model.addVar(vtype=\"CONTINUOUS\", name=\"H1A\", lb=0)  # hours Facility 1 operates for Component A\nH1B = model.addVar(vtype=\"CONTINUOUS\", name=\"H1B\", lb=0)  # hours Facility 1 operates for Component B\nH1C = model.addVar(vtype=\"CONTINUOUS\", name=\"H1C\", lb=0)  # hours Facility 1 operates for Component C\nH2A = model.addVar(vtype=\"CONTINUOUS\", name=\"H2A\", lb=0)  # hours Facility 2 operates for Component A\nH2B = model.addVar(vtype=\"CONTINUOUS\", name=\"H2B\", lb=0)  # hours Facility 2 operates for Component B\nH2C = model.addVar(vtype=\"CONTINUOUS\", name=\"H2C\", lb=0)  # hours Facility 2 operates for Component C\nH3A = model.addVar(vtype=\"CONTINUOUS\", name=\"H3A\", lb=0)  # hours Facility 3 operates for Component A\nH3B = model.addVar(vtype=\"CONTINUOUS\", name=\"H3B\", lb=0)  # hours Facility 3 operates for Component B\nH3C = model.addVar(vtype=\"CONTINUOUS\", name=\"H3C\", lb=0)  # hours Facility 3 operates for Component C\nH4A = model.addVar(vtype=\"CONTINUOUS\", name=\"H4A\", lb=0)  # hours Facility 4 operates for Component A\nH4B = model.addVar(vtype=\"CONTINUOUS\", name=\"H4B\", lb=0)  # hours Facility 4 operates for Component B\nH4C = model.addVar(vtype=\"CONTINUOUS\", name=\"H4C\", lb=0)  # hours Facility 4 operates for Component C\n\n# Define objective function\nC1 = 100 * (H1A**2 + H1B**2 + H1C**2)\nC2 = 150 * (H2A**2 + H2B**2 + H2C**2)\nC3 = 200 * (H3A**2 + H3B**2 + H3C**2)\nC4 = 250 * (H4A**2 + H4B**2 + H4C**2)\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C1 + C2 + C3 + C4)\n\n# Add constraints\nmodel.addCons(H1A * 5 + H2A * 10 + H3A * 15 + H4A * 20 >= 1000)  # Constraint-1\nmodel.addCons(H1B * 10 + H2B * 15 + H3B * 20 + H4B * 25 >= 1500)  # Constraint-2\nmodel.addCons(H1C * 15 + H2C * 20 + H3C * 25 + H4C * 30 >= 2000)  # Constraint-3\nmodel.addCons(H1A + H1B + H1C <= 100)  # Constraint-4\nmodel.addCons(H2A + H2B + H2C <= 100)  # Constraint-4\nmodel.addCons(H3A + H3B + H3C <= 100)  # Constraint-4\nmodel.addCons(H4A + H4B + H4C <= 100)  # Constraint-4\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"H1A: \", model.getVal(H1A))\n    print(\"H1B: \", model.getVal(H1B))\n    print(\"H1C: \", model.getVal(H1C))\n    print(\"H2A: \", model.getVal(H2A))\n    print(\"H2B: \", model.getVal(H2B))\n    print(\"H2C: \", model.getVal(H2C))\n    print(\"H3A: \", model.getVal(H3A))\n    print(\"H3B: \", model.getVal(H3B))\n    print(\"H3C: \", model.getVal(H3C))\n    print(\"H4A: \", model.getVal(H4A))\n    print(\"H4B: \", model.getVal(H4B))\n    print(\"H4C: \", model.getVal(H4C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1342,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported.\n// Operational cost of A: Cost_A = 1000 * A\n// Operational cost of B: Cost_B = 1200 * B\n// Operational cost of C: Cost_C = 1500 * C\n// Operational cost of D: Cost_D = 1800 * D\n// Operational cost of E: Cost_E = 2000 * E\n// Units transported by A: Units_A = 1000 * A\n// Units transported by B: Units_B = 1200 * B\n// Units transported by C: Units_C = 1500 * C\n// Units transported by D: Units_D = 1800 * D\n// Units transported by E: Units_E = 2000 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational costs for the upcoming month.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units of goods.\n// 1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\n// E <= 0.2 * (A + B + C + D + E)",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each vehicle type to deploy for the upcoming month to maximize efficiency and minimize costs. Each vehicle type has different operational costs and efficiencies. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1200 per month and can transport 1200 units of goods. Truck C has an operational cost of $1500 per month and can transport 1500 units of goods. Truck D has an operational cost of $1800 per month and can transport 1800 units of goods. Truck E has an operational cost of $2000 per month and can transport 2000 units of goods. The company aims to minimize the total cost per unit of goods transported, which is defined as the sum of the operational costs divided by the sum of the units of goods transported. The company has a budget of $100,000 for operational costs for the upcoming month. The company must transport at least 50,000 units of goods. The company has a limit on the number of vehicles it can deploy, specifically, it can deploy at most 50 vehicles in total. The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed. Please help the company determine the optimal number of each vehicle type to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 1000 * A\nCost_B = 1200 * B\nCost_C = 1500 * C\nCost_D = 1800 * D\nCost_E = 2000 * E\nUnits_A = 1000 * A\nUnits_B = 1200 * B\nUnits_C = 1500 * C\nUnits_D = 1800 * D\nUnits_E = 2000 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Units_A + Units_B + Units_C + Units_D + Units_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Units_A + Units_B + Units_C + Units_D + Units_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for operational costs for the upcoming month.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E <= 100000)\n## The company must transport at least 50,000 units of goods.\nmodel.addCons(1000 * A + 1200 * B + 1500 * C + 1800 * D + 2000 * E >= 50000)\n## The company has a limit on the number of vehicles it can deploy. Specifically, it can deploy at most 50 vehicles in total.\nmodel.addCons(A + B + C + D + E <= 50)\n## The company wants to ensure that the number of Truck E does not exceed 20% of the total number of vehicles deployed.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1425,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency.\n// {\"amount of raw material in reactor 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of each reactor varies with the amount of raw material fed into it. The efficiency is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors.\n// The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited to 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000",
        "question": "A chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency. The efficiency of each reactor varies with the amount of raw material fed into it and is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors. The total amount of raw material available is limited to 1000 units. Please help the company determine the optimal amount of raw material to feed into each reactor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material in reactor 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material in reactor 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material in reactor 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # amount of raw material in reactor 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # amount of raw material in reactor 5\n\n# Define objective function\n## The efficiency functions are nonlinear and are given by:\nEfficiency_R1 = 0.5 * R1**0.7\nEfficiency_R2 = 0.6 * R2**0.6\nEfficiency_R3 = 0.7 * R3**0.5\nEfficiency_R4 = 0.8 * R4**0.4\nEfficiency_R5 = 0.9 * R5**0.3\n## The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n# Add constraints\n## The total amount of raw material available is limited to 1000 units.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material in Reactor 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material in Reactor 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material in Reactor 3: \", model.getVal(R3))\n    print(\"Amount of Raw Material in Reactor 4: \", model.getVal(R4))\n    print(\"Amount of Raw Material in Reactor 5: \", model.getVal(R5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different regions (Region A, Region B, and Region C). The company needs to determine the number of trucks to allocate to each region and the average speed at which these trucks should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for Region A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks in Region A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in Region B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"average speed of trucks in Region C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate of the trucks is a nonlinear function of their speed, given by the formula: FuelConsumption = k * Speed^2, where k is a constant. The company wants to minimize the total fuel consumption and time spent on the road.\n// FuelConsumptionA = k * SpeedA^2 * TrucksA\n// FuelConsumptionB = k * SpeedB^2 * TrucksB\n// FuelConsumptionC = k * SpeedC^2 * TrucksC\n// TimeSpentA = DistanceA / SpeedA * TrucksA\n// TimeSpentB = DistanceB / SpeedB * TrucksB\n// TimeSpentC = DistanceC / SpeedC * TrucksC\n// So, the objective function is: Minimize (FuelConsumptionA + FuelConsumptionB + FuelConsumptionC + TimeSpentA + TimeSpentB + TimeSpentC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nThe total distance covered by all trucks should not exceed 5000 kilometers.\n// DistanceA * TrucksA + DistanceB * TrucksB + DistanceC * TrucksC <= 5000\n\n## Generate Constraint-3:\nThe average speed of trucks in any region should not exceed 100 km/h.\n// SpeedA <= 100\n// SpeedB <= 100\n// SpeedC <= 100\n\n## Generate Constraint-4:\nThe company aims to allocate at least 10 trucks to each region.\n// TrucksA >= 10\n// TrucksB >= 10\n// TrucksC >= 10\n\n## Generate Constraint-5:\nThe total time spent on the road should not exceed 100 hours.\n// TimeSpentA + TimeSpentB + TimeSpentC <= 100",
        "question": "A logistics company is planning to optimize its delivery routes for three different regions (Region A, Region B, and Region C). The company needs to determine the number of trucks to allocate to each region and the average speed at which these trucks should travel to minimize fuel consumption and time spent on the road. The fuel consumption rate of the trucks is a nonlinear function of their speed, given by the formula: FuelConsumption = k * Speed^2, where k is a constant. The company wants to minimize the total fuel consumption and time spent on the road. The following table summarizes the variables and their constraints:\n\n| Variable                | Description                          | Constraints                          |\n|-------------------------|--------------------------------------|--------------------------------------|\n| TrucksA                 | Number of trucks for Region A        | TrucksA >= 0, TrucksA >= 10          |\n| TrucksB                 | Number of trucks for Region B        | TrucksB >= 0, TrucksB >= 10          |\n| TrucksC                 | Number of trucks for Region C        | TrucksC >= 0, TrucksC >= 10          |\n| SpeedA                  | Average speed of trucks in Region A  | SpeedA > 0, SpeedA <= 100            |\n| SpeedB                  | Average speed of trucks in Region B  | SpeedB > 0, SpeedB <= 100            |\n| SpeedC                  | Average speed of trucks in Region C  | SpeedC > 0, SpeedC <= 100            |\n\nThe company has a total of 50 trucks available. The total distance covered by all trucks should not exceed 5000 kilometers. The company aims to allocate at least 10 trucks to each region. The total time spent on the road should not exceed 100 hours.\n\nPlease help the company to minimize the total fuel consumption and time spent on the road, considering the constraints provided.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=10)  # number of trucks for Region A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=10)  # number of trucks for Region B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=10)  # number of trucks for Region C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0)  # average speed of trucks in Region A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0)  # average speed of trucks in Region B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0)  # average speed of trucks in Region C\n\n# Define objective function\nk = 0.01  # constant for fuel consumption rate\nDistanceA = 500  # distance in Region A\nDistanceB = 600  # distance in Region B\nDistanceC = 700  # distance in Region C\n\nFuelConsumptionA = k * SpeedA**2 * TrucksA\nFuelConsumptionB = k * SpeedB**2 * TrucksB\nFuelConsumptionC = k * SpeedC**2 * TrucksC\nTimeSpentA = DistanceA / SpeedA * TrucksA\nTimeSpentB = DistanceB / SpeedB * TrucksB\nTimeSpentC = DistanceC / SpeedC * TrucksC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumptionA + FuelConsumptionB + FuelConsumptionC + TimeSpentA + TimeSpentB + TimeSpentC)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\nmodel.addCons(DistanceA * TrucksA + DistanceB * TrucksB + DistanceC * TrucksC <= 5000)\nmodel.addCons(SpeedA <= 100)\nmodel.addCons(SpeedB <= 100)\nmodel.addCons(SpeedC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Region B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Region C: \", model.getVal(TrucksC))\n    print(\"Average Speed in Region A: \", model.getVal(SpeedA))\n    print(\"Average Speed in Region B: \", model.getVal(SpeedB))\n    print(\"Average Speed in Region C: \", model.getVal(SpeedC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1860,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each truck type varies based on the distance traveled and the load capacity. TruckA has an efficiency of 50 units per km, TruckB has 60 units per km, TruckC has 70 units per km, and TruckD has 80 units per km. The company aims to maximize the total efficiency of all trucks.\n// Total efficiency of TruckA: Efficiency_TruckA = 50 * TruckA\n// Total efficiency of TruckB: Efficiency_TruckB = 60 * TruckB\n// Total efficiency of TruckC: Efficiency_TruckC = 70 * TruckC\n// Total efficiency of TruckD: Efficiency_TruckD = 80 * TruckD\n// So, the objective function is: Maximize (Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 to purchase trucks. The cost of TruckA is $50,000, TruckB is $60,000, TruckC is $70,000, and TruckD is $80,000.\n// 50,000 * TruckA + 60,000 * TruckB + 70,000 * TruckC + 80,000 * TruckD <= 500,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of trucks cannot exceed 10.\n// TruckA + TruckB + TruckC + TruckD <= 10\n\n## Generate Constraint-3:\nThe company must have at least 2 TruckA and 1 TruckB for specific contractual obligations.\n// TruckA >= 2; TruckB >= 1\n\n## Generate Constraint-4:\nThe total number of TruckC and TruckD combined must not exceed the number of TruckA and TruckB combined.\n// TruckC + TruckD <= TruckA + TruckB",
        "question": "A logistics company operates four different types of trucks: TruckA, TruckB, TruckC, and TruckD. The company needs to determine the optimal number of each type of truck to maximize its overall efficiency while meeting certain operational constraints. The efficiency of each truck type varies based on the distance traveled and the load capacity. TruckA has an efficiency of 50 units per km, TruckB has 60 units per km, TruckC has 70 units per km, and TruckD has 80 units per km. The company aims to maximize the total efficiency of all trucks. The company has a total budget of $500,000 to purchase trucks. The cost of TruckA is $50,000, TruckB is $60,000, TruckC is $70,000, and TruckD is $80,000. Due to maintenance constraints, the total number of trucks cannot exceed 10. The company must have at least 2 TruckA and 1 TruckB for specific contractual obligations. The total number of TruckC and TruckD combined must not exceed the number of TruckA and TruckB combined. Please help the company to determine the optimal number of each type of truck to maximize its overall efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\n\n# Define objective function\nEfficiency_TruckA = 50 * TruckA\nEfficiency_TruckB = 60 * TruckB\nEfficiency_TruckC = 70 * TruckC\nEfficiency_TruckD = 80 * TruckD\n# So, the objective function is: Maximize (Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_TruckA + Efficiency_TruckB + Efficiency_TruckC + Efficiency_TruckD)\n\n# Add constraints\n# The company has a total budget of $500,000 to purchase trucks.\nmodel.addCons(50000 * TruckA + 60000 * TruckB + 70000 * TruckC + 80000 * TruckD <= 500000)\n# Due to maintenance constraints, the total number of trucks cannot exceed 10.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 10)\n# The company must have at least 2 TruckA and 1 TruckB for specific contractual obligations.\nmodel.addCons(TruckA >= 2)\nmodel.addCons(TruckB >= 1)\n# The total number of TruckC and TruckD combined must not exceed the number of TruckA and TruckB combined.\nmodel.addCons(TruckC + TruckD <= TruckA + TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000\n\n## Generate Constraint-2:\nThe company has a total of 500 drivers available.\n// RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\n// RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)\n\n## Generate Constraint-4:\nThe company has a fuel budget of $50,000 per month.\n// 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000\n\n## Generate Constraint-5:\nThe company wants to limit the number of Heavy trucks to no more than 30% of the total fleet.\n// HeavyTrucks <= 0.3 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks)",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck. The cost per truck, revenue per trip, and fuel consumption per trip for each type of truck are given in the following Table.\n\n| Type of Truck | Cost per Truck | Revenue per Trip | Fuel Consumption per Trip |\n|---------------|----------------|------------------|---------------------------|\n| Refrigerated  | $100,000       | $2,000           | 100 liters                |\n| Heavy         | $150,000       | $3,000           | 150 liters                |\n| Standard      | $50,000        | $1,000           | 50 liters                 |\n\nThe company has a budget of $10 million for purchasing trucks. The company has a total of 500 drivers available. The company wants to ensure that at least 20% of the fleet is Refrigerated trucks. The company has a fuel budget of $50,000 per month. The company wants to limit the number of Heavy trucks to no more than 30% of the total fleet. \n\nPlease help the company to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n# The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n# The company has a total of 500 drivers available.\nmodel.addCons(RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500)\n# The company wants to ensure that at least 20% of the fleet is Refrigerated trucks.\nmodel.addCons(RefrigeratedTrucks >= 0.2 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n# The company has a fuel budget of $50,000 per month.\nmodel.addCons(100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers <= 50000)\n# The company wants to limit the number of Heavy trucks to no more than 30% of the total fleet.\nmodel.addCons(HeavyTrucks <= 0.3 * (RefrigeratedTrucks + HeavyTrucks + StandardTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1312,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"Auto_A\", \"range\": \"Auto_A >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"Auto_B\", \"range\": \"Auto_B >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"Auto_C\", \"range\": \"Auto_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 5 * Auto_A)) * Q_A\n// Profit_B = (180 - (120 - 5 * Auto_B)) * Q_B\n// Profit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation.\n// Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// Q_A + Q_B + Q_C <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 500 units and for ProductB is 800 units.\n// Q_A <= 500; Q_B <= 800\n\n## Generate Constraint-4:\nThe level of automation for each product must be between 0 and 100 units.\n// 0 <= Auto_A <= 100; 0 <= Auto_B <= 100; 0 <= Auto_C <= 100\n\n## Generate Constraint-5:\nThe company must produce at least 200 units of ProductC.\n// Q_C >= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n\nThe company has a total budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units. The market demand for ProductA is 500 units and for ProductB is 800 units. The level of automation for each product must be between 0 and 100 units. The company must produce at least 200 units of ProductC.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAuto_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_A\", lb=0, ub=100) # level of automation for ProductA\nAuto_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_B\", lb=0, ub=100) # level of automation for ProductB\nAuto_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_C\", lb=0, ub=100) # level of automation for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 5 * Auto_A)) * Q_A\nProfit_B = (180 - (120 - 5 * Auto_B)) * Q_B\nProfit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation.\nmodel.addCons(Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(Q_A + Q_B + Q_C <= 2000)\n# The market demand for ProductA is 500 units and for ProductB is 800 units.\nmodel.addCons(Q_A <= 500)\nmodel.addCons(Q_B <= 800)\n# The company must produce at least 200 units of ProductC.\nmodel.addCons(Q_C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation for ProductA: \", model.getVal(Auto_A))\n    print(\"Level of Automation for ProductB: \", model.getVal(Auto_B))\n    print(\"Level of Automation for ProductC: \", model.getVal(Auto_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements.\n// {\"cargo in truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"cargo in truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck 1 has a fuel efficiency of 10 km/liter and a maximum cargo capacity of 5000 kg.\nTruck 2 has a fuel efficiency of 12 km/liter and a maximum cargo capacity of 4000 kg.\nTruck 3 has a fuel efficiency of 15 km/liter and a maximum cargo capacity of 3000 kg.\nTruck 4 has a fuel efficiency of 18 km/liter and a maximum cargo capacity of 2000 kg.\nTruck 5 has a fuel efficiency of 20 km/liter and a maximum cargo capacity of 1000 kg.\nThe company needs to deliver a total of 10000 kg of cargo over a distance of 1000 km. The objective is to minimize the total fuel consumption.\n// Total fuel consumption: Fuel = (1000 / 10) * T1 + (1000 / 12) * T2 + (1000 / 15) * T3 + (1000 / 18) * T4 + (1000 / 20) * T5\n// So, the objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total cargo to be delivered is 10000 kg.\n// T1 + T2 + T3 + T4 + T5 = 10000\n\n## Generate Constraint-2:\nEach truck has a maximum cargo capacity.\n// T1 <= 5000\n// T2 <= 4000\n// T3 <= 3000\n// T4 <= 2000\n// T5 <= 1000",
        "question": "A logistics company operates a fleet of 5 trucks, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal distribution of cargo across these trucks to minimize fuel consumption while meeting delivery requirements. The fuel efficiency and maximum cargo capacity for each truck are given in the following Table.\n\n| Truck | Fuel Efficiency (km/liter) | Maximum Cargo Capacity (kg) |\n|-------|---------------------------|-----------------------------|\n| 1     | 10                        | 5000                        |\n| 2     | 12                        | 4000                        |\n| 3     | 15                        | 3000                        |\n| 4     | 18                        | 2000                        |\n| 5     | 20                        | 1000                        |\n\nThe company needs to deliver a total of 10000 kg of cargo over a distance of 1000 km. The total cargo to be delivered is 10000 kg. Each truck has a maximum cargo capacity as specified in the table. Please help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # cargo in truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # cargo in truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # cargo in truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # cargo in truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # cargo in truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel consumption: Fuel = (1000 / 10) * T1 + (1000 / 12) * T2 + (1000 / 15) * T3 + (1000 / 18) * T4 + (1000 / 20) * T5\n## convert the division to multiplication\nmodel.addCons(obj == (1000 * T1 / 10) + (1000 * T2 / 12) + (1000 * T3 / 15) + (1000 * T4 / 18) + (1000 * T5 / 20))\n\n# Add constraints\n## The total cargo to be delivered is 10000 kg.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 == 10000)\n## Each truck has a maximum cargo capacity.\nmodel.addCons(T1 <= 5000)\nmodel.addCons(T2 <= 4000)\nmodel.addCons(T3 <= 3000)\nmodel.addCons(T4 <= 2000)\nmodel.addCons(T5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo in Truck 1: \", model.getVal(T1))\n    print(\"Cargo in Truck 2: \", model.getVal(T2))\n    print(\"Cargo in Truck 3: \", model.getVal(T3))\n    print(\"Cargo in Truck 4: \", model.getVal(T4))\n    print(\"Cargo in Truck 5: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $20 in production costs. Product B yields a profit of $70 per unit with a production cost of $30. Product C yields a profit of $100 per unit with a production cost of $40. The company aims to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs.\n// Profit_A = (50 - 20) * A\n// Profit_B = (70 - 30) * B\n// Profit_C = (100 - 40) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production budget of $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production costs and market demand. The profit per unit and production costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost |\n|---------|-----------------|-----------------|\n| A       | $50             | $20             |\n| B       | $70             | $30             |\n| C       | $100            | $40             |\n\nThe company has a total production budget of $10,000. The company aims to maximize the total profit, which is the sum of the profits from each product minus the sum of their production costs. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (100 - 40) * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production budget of $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials.\n// {\"labor hours on line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours on line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"machine hours on line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials on line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rate of device 1 on line 1 is 5 units per labor hour and 10 units per machine hour, and on line 2 is 7 units per labor hour and 12 units per machine hour. The production rate of device 2 on line 1 is 8 units per labor hour and 15 units per machine hour, and on line 2 is 10 units per labor hour and 18 units per machine hour. The raw materials used are proportional to the machine hours.\n// Profit from device 1 on line 1: P1_L1 = 100 * (5 * L1 + 10 * M1)\n// Profit from device 1 on line 2: P1_L2 = 100 * (7 * L2 + 12 * M2)\n// Profit from device 2 on line 1: P2_L1 = 150 * (8 * L1 + 15 * M1)\n// Profit from device 2 on line 2: P2_L2 = 150 * (10 * L2 + 18 * M2)\n// Objective function: Maximize P = P1_L1 + P1_L2 + P2_L1 + P2_L2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L1 + L2 <= 1000",
        "question": "A manufacturing plant produces electronic devices and needs to optimize the allocation of resources across different production lines. The resources include labor hours, machine hours, and raw materials. The plant aims to maximize its profit from producing two types of electronic devices. The profit per unit of device 1 is $100, and for device 2 is $150. The production rates for each device on each line are as follows:\n\n| Device | Line 1 (Units per Hour) | Line 2 (Units per Hour) |\n|--------|-------------------------|-------------------------|\n| 1      | 5 (Labor)               | 7 (Labor)               |\n|        | 10 (Machine)            | 12 (Machine)            |\n| 2      | 8 (Labor)               | 10 (Labor)              |\n|        | 15 (Machine)            | 18 (Machine)            |\n\nThe raw materials used are proportional to the machine hours. The total labor hours available are 1000 hours.\n\nPlease help the plant to maximize its total profit from producing both types of devices while considering the constraints on labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0)  # labor hours on line 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # machine hours on line 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0)  # raw materials on line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0)  # labor hours on line 2\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0)  # machine hours on line 2\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0)  # raw materials on line 2\n\n# Define objective function\nP1_L1 = 100 * (5 * L1 + 10 * M1)  # Profit from device 1 on line 1\nP1_L2 = 100 * (7 * L2 + 12 * M2)  # Profit from device 1 on line 2\nP2_L1 = 150 * (8 * L1 + 15 * M1)  # Profit from device 2 on line 1\nP2_L2 = 150 * (10 * L2 + 18 * M2)  # Profit from device 2 on line 2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1_L1 + P1_L2 + P2_L1 + P2_L2)  # Objective function\n\n# Add constraints\nmodel.addCons(L1 + L2 <= 1000)  # Total labor hours available are 1000 hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours on line 1: \", model.getVal(L1))\n    print(\"Machine hours on line 1: \", model.getVal(M1))\n    print(\"Raw materials on line 1: \", model.getVal(R1))\n    print(\"Labor hours on line 2: \", model.getVal(L2))\n    print(\"Machine hours on line 2: \", model.getVal(M2))\n    print(\"Raw materials on line 2: \", model.getVal(R2))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit for E1 is $30,000, with a production cost per unit of $20,000 and a carbon footprint per unit of 100 kg CO2. \nFor E2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the carbon footprint per unit is 150 kg CO2. \nFor E3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the carbon footprint per unit is 200 kg CO2.\nThe manufacturer aims to maximize the net revenue per unit of carbon footprint.\n// Profit_E1 = (30000 * E1 - 20000 * E1) / 100\n// Profit_E2 = (40000 * E2 - 25000 * E2) / 150\n// Profit_E3 = (50000 * E3 - 30000 * E3) / 200\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production capacity of 50 vehicles.\n// E1 + E2 + E3 <= 50\n\n## Generate Constraint-2:\nThe total carbon footprint allowed for all vehicles is 8000 kg CO2.\n// 100 * E1 + 150 * E2 + 200 * E3 <= 8000\n\n## Generate Constraint-3:\nThe manufacturer has a budget of $1,200,000 for production costs.\n// 20000 * E1 + 25000 * E2 + 30000 * E3 <= 1200000",
        "question": "A manufacturer produces three types of eco-friendly vehicles: E1, E2, and E3. They need to determine the production quantities of each vehicle type to optimize their operations. The revenue per unit, production cost per unit, and carbon footprint per unit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Revenue per Unit | Production Cost per Unit | Carbon Footprint per Unit |\n|--------------|------------------|--------------------------|---------------------------|\n| E1           | $30,000          | $20,000                  | 100 kg CO2                |\n| E2           | $40,000          | $25,000                  | 150 kg CO2                |\n| E3           | $50,000          | $30,000                  | 200 kg CO2                |\n\nThe manufacturer has a total production capacity of 50 vehicles. The total carbon footprint allowed for all vehicles is 8000 kg CO2. The manufacturer has a budget of $1,200,000 for production costs. \n\nPlease help the manufacturer to maximize the net revenue per unit of carbon footprint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30000 * E1 - 20000 * E1) / 100\nProfit_E2 = (40000 * E2 - 25000 * E2) / 150\nProfit_E3 = (50000 * E3 - 30000 * E3) / 200\n## convert the division to multiplication\nmodel.addCons(obj == (Profit_E1 * 100 + Profit_E2 * 150 + Profit_E3 * 200))\n\n# Add constraints\n## The manufacturer has a total production capacity of 50 vehicles.\nmodel.addCons(E1 + E2 + E3 <= 50)\n## The total carbon footprint allowed for all vehicles is 8000 kg CO2.\nmodel.addCons(100 * E1 + 150 * E2 + 200 * E3 <= 8000)\n## The manufacturer has a budget of $1,200,000 for production costs.\nmodel.addCons(20000 * E1 + 25000 * E2 + 30000 * E3 <= 1200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Net Revenue per Unit of Carbon Footprint: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of installation per solar panel is $1000, and it generates 10 kWh of energy per day. The cost of installation per wind turbine is $2000, and it generates 20 kWh of energy per day. The cost of energy storage per kWh is $500, and it can store 1 kWh of energy. The company aims to maximize the net energy output (total energy generated minus the cost of installation and storage) per dollar spent.\n// Energy_S = 10 * S\n// Energy_W = 20 * W\n// Cost_S = 1000 * S\n// Cost_W = 2000 * W\n// Cost_E = 500 * E\n// So, the objective function is: Maximize ((Energy_S + Energy_W) - Cost_E) / (Cost_S + Cost_W + Cost_E)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for installation and energy storage.\n// 1000 * S + 2000 * W + 500 * E <= 100000\n\n## Generate Constraint-2:\nThe total energy storage capacity should not exceed 100 kWh.\n// E <= 100",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different regions. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation. The cost of installation per solar panel is $1000, and it generates 10 kWh of energy per day. The cost of installation per wind turbine is $2000, and it generates 20 kWh of energy per day. The cost of energy storage per kWh is $500, and it can store 1 kWh of energy. The company aims to maximize the net energy output (total energy generated minus the cost of installation and storage) per dollar spent. The company has a budget of $100,000 for installation and energy storage. The total energy storage capacity should not exceed 100 kWh. Please help the company to determine the optimal number of solar panels, wind turbines, and the amount of energy storage to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # amount of energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_S = 10 * S\nEnergy_W = 20 * W\nCost_S = 1000 * S\nCost_W = 2000 * W\nCost_E = 500 * E\n## the objective function is: Maximize ((Energy_S + Energy_W) - Cost_E) / (Cost_S + Cost_W + Cost_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_S + Cost_W + Cost_E) == (Energy_S + Energy_W) - Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for installation and energy storage.\nmodel.addCons(1000 * S + 2000 * W + 500 * E <= 100000)\n## The total energy storage capacity should not exceed 100 kWh.\nmodel.addCons(E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Net Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the amount of money to invest in retrofitting each type of truck to improve their fuel efficiency.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in retrofitting for Small trucks\": \"RetrofitSmall\", \"range\": \"RetrofitSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Medium trucks\": \"RetrofitMedium\", \"range\": \"RetrofitMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Large trucks\": \"RetrofitLarge\", \"range\": \"RetrofitLarge >= 0\", \"type\": \"continuous\"}\n// {\"investment in retrofitting for Extra-Large trucks\": \"RetrofitExtraLarge\", \"range\": \"RetrofitExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type can be improved by investing in retrofitting. For every $1,000 invested in retrofitting, the fuel efficiency of Small trucks increases by 1%, Medium trucks by 0.8%, Large trucks by 0.6%, and Extra-Large trucks by 0.5%. The company aims to minimize the total annual fuel cost, which is a nonlinear function of the number of trucks and their fuel efficiency.\n// Total fuel cost for Small trucks: FuelCostSmall = (10000 * SmallTrucks) / (1 + 0.001 * RetrofitSmall)\n// Total fuel cost for Medium trucks: FuelCostMedium = (12000 * MediumTrucks) / (1 + 0.0008 * RetrofitMedium)\n// Total fuel cost for Large trucks: FuelCostLarge = (15000 * LargeTrucks) / (1 + 0.0006 * RetrofitLarge)\n// Total fuel cost for Extra-Large trucks: FuelCostExtraLarge = (20000 * ExtraLargeTrucks) / (1 + 0.0005 * RetrofitExtraLarge)\n// So, the objective function is: Minimize (FuelCostSmall + FuelCostMedium + FuelCostLarge + FuelCostExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing and retrofitting trucks.\n// 50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 150000 * ExtraLargeTrucks + RetrofitSmall + RetrofitMedium + RetrofitLarge + RetrofitExtraLarge <= 2000000",
        "question": "A logistics company is planning its fleet expansion by purchasing new trucks. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different fuel efficiency, cargo capacity, and purchase cost. The company also needs to decide on the amount of money to invest in retrofitting each type of truck to improve their fuel efficiency. The following table provides the details of the trucks and the potential improvement in fuel efficiency through retrofitting.\n\n| Truck Type        | Initial Fuel Efficiency | Retrofit Efficiency Gain per $1,000 |\n|-------------------|-------------------------|-------------------------------------|\n| Small             | 10000 km/liter          | 1%                                  |\n| Medium            | 12000 km/liter          | 0.8%                                |\n| Large             | 15000 km/liter          | 0.6%                                |\n| Extra-Large       | 20000 km/liter          | 0.5%                                |\n\nThe company has a budget of $2,000,000 for purchasing and retrofitting trucks. The company aims to minimize the total annual fuel cost, which is a nonlinear function of the number of trucks and their fuel efficiency. Please help the company determine the optimal number of each type of truck to purchase and the amount to invest in retrofitting to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nRetrofitSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitSmall\", lb=0)\nRetrofitMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitMedium\", lb=0)\nRetrofitLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitLarge\", lb=0)\nRetrofitExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"RetrofitExtraLarge\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCostSmall = (10000 * SmallTrucks) / (1 + 0.001 * RetrofitSmall)\nFuelCostMedium = (12000 * MediumTrucks) / (1 + 0.0008 * RetrofitMedium)\nFuelCostLarge = (15000 * LargeTrucks) / (1 + 0.0006 * RetrofitLarge)\nFuelCostExtraLarge = (20000 * ExtraLargeTrucks) / (1 + 0.0005 * RetrofitExtraLarge)\n## convert the division to multiplication\nmodel.addCons(obj * (1 + 0.001 * RetrofitSmall) * (1 + 0.0008 * RetrofitMedium) * (1 + 0.0006 * RetrofitLarge) * (1 + 0.0005 * RetrofitExtraLarge) == FuelCostSmall * (1 + 0.001 * RetrofitSmall) + FuelCostMedium * (1 + 0.0008 * RetrofitMedium) + FuelCostLarge * (1 + 0.0006 * RetrofitLarge) + FuelCostExtraLarge * (1 + 0.0005 * RetrofitExtraLarge))\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing and retrofitting trucks.\nmodel.addCons(50000 * SmallTrucks + 75000 * MediumTrucks + 100000 * LargeTrucks + 150000 * ExtraLargeTrucks + RetrofitSmall + RetrofitMedium + RetrofitLarge + RetrofitExtraLarge <= 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Investment in Retrofitting for Small Trucks: \", model.getVal(RetrofitSmall))\n    print(\"Investment in Retrofitting for Medium Trucks: \", model.getVal(RetrofitMedium))\n    print(\"Investment in Retrofitting for Large Trucks: \", model.getVal(RetrofitLarge))\n    print(\"Investment in Retrofitting for Extra-Large Trucks: \", model.getVal(RetrofitExtraLarge))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1396,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\n// {\"number of trucks on CityA to CityB route\": \"Trucks_AB\", \"range\": \"Trucks_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityA to CityC route\": \"Trucks_AC\", \"range\": \"Trucks_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityB to CityC route\": \"Trucks_BC\", \"range\": \"Trucks_BC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Total fuel consumption and operational costs for CityA to CityB: Cost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\n// Total fuel consumption and operational costs for CityA to CityC: Cost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\n// Total fuel consumption and operational costs for CityB to CityC: Cost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n// So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks_AB + Trucks_AC + Trucks_BC <= 50\n\n## Generate Constraint-2:\nThe demand from CityA to CityB requires at least 15 trucks.\n// Trucks_AB >= 15\n\n## Generate Constraint-3:\nThe demand from CityA to CityC requires at least 20 trucks.\n// Trucks_AC >= 20\n\n## Generate Constraint-4:\nThe demand from CityB to CityC requires at least 10 trucks.\n// Trucks_BC >= 10\n\n## Generate Constraint-5:\nDue to maintenance schedules, no more than 30 trucks can be allocated to the CityA to CityC route.\n// Trucks_AC <= 30",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\nThe total number of trucks available is 50. The demand from CityA to CityB requires at least 15 trucks. The demand from CityA to CityC requires at least 20 trucks. The demand from CityB to CityC requires at least 10 trucks. Due to maintenance schedules, no more than 30 trucks can be allocated to the CityA to CityC route.\nPlease help the company to minimize the total fuel consumption and operational costs (which is defined as the sum of the fuel consumption and operational costs for each route).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_AB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AB\", lb=15)  # number of trucks on CityA to CityB route\nTrucks_AC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AC\", lb=20, ub=30)  # number of trucks on CityA to CityC route\nTrucks_BC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_BC\", lb=10)  # number of trucks on CityB to CityC route\n\n# Define objective function\nCost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\nCost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\nCost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n# So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_AB + Cost_AC + Cost_BC)\n\n# Add constraints\nmodel.addCons(Trucks_AB + Trucks_AC + Trucks_BC <= 50)  # The total number of trucks available is 50.\nmodel.addCons(Trucks_AC <= 30)  # Due to maintenance schedules, no more than 30 trucks can be allocated to the CityA to CityC route.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on CityA to CityB route: \", model.getVal(Trucks_AB))\n    print(\"Number of Trucks on CityA to CityC route: \", model.getVal(Trucks_AC))\n    print(\"Number of Trucks on CityB to CityC route: \", model.getVal(Trucks_BC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1286,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily to optimize production. Additionally, the company must determine the number of hours of maintenance each machine requires daily.\n// {\"number of operating hours for MachineA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of operating hours for MachineC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineA\": \"MaintenanceA\", \"range\": \"MaintenanceA >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineB\": \"MaintenanceB\", \"range\": \"MaintenanceB >= 0\", \"type\": \"real\"}\n// {\"number of maintenance hours for MachineC\": \"MaintenanceC\", \"range\": \"MaintenanceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for MachineA produces $500 in revenue and incurs a cost of $200. Each hour of operation for MachineB produces $700 in revenue and incurs a cost of $300. Each hour of operation for MachineC produces $900 in revenue and incurs a cost of $400. Maintenance costs are $100 per hour for each machine. The company aims to maximize the total net revenue per day.\n// Net revenue for MachineA: RevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\n// Net revenue for MachineB: RevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\n// Net revenue for MachineC: RevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total daily operating hours for all machines must not exceed 24 hours.\n// HoursA + HoursB + HoursC <= 24\n\n## Generate Constraint-2:\nThe total daily maintenance hours for all machines must not exceed 8 hours.\n// MaintenanceA + MaintenanceB + MaintenanceC <= 8\n\n## Generate Constraint-3:\nMachineA must operate at least 2 hours daily.\n// HoursA >= 2\n\n## Generate Constraint-4:\nMachineB and MachineC combined must not operate more than 16 hours daily.\n// HoursB + HoursC <= 16\n\n## Generate Constraint-5:\nThe maintenance hours for MachineC must be at least half of its operating hours.\n// MaintenanceC >= 0.5 * HoursC",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide the number of hours each machine should operate daily and the number of hours of maintenance each machine requires daily to optimize production. The revenue and costs associated with each machine's operation and maintenance are given in the following Table.\n\n| Machine | Revenue per Hour | Cost per Hour | Maintenance Cost per Hour |\n|---------|------------------|---------------|---------------------------|\n| MachineA | $500            | $200          | $100                      |\n| MachineB | $700            | $300          | $100                      |\n| MachineC | $900            | $400          | $100                      |\n\nThe company aims to maximize the total net revenue per day. The constraints are as follows:\n1. The total daily operating hours for all machines must not exceed 24 hours.\n2. The total daily maintenance hours for all machines must not exceed 8 hours.\n3. MachineA must operate at least 2 hours daily.\n4. MachineB and MachineC combined must not operate more than 16 hours daily.\n5. The maintenance hours for MachineC must be at least half of its operating hours.\n\nPlease help the company determine the optimal number of operating and maintenance hours for each machine to maximize the total net revenue per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of operating hours for MachineA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of operating hours for MachineB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of operating hours for MachineC\nMaintenanceA = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceA\", lb=0) # number of maintenance hours for MachineA\nMaintenanceB = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceB\", lb=0) # number of maintenance hours for MachineB\nMaintenanceC = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceC\", lb=0) # number of maintenance hours for MachineC\n\n# Define objective function\nRevenueA = (500 * HoursA - 200 * HoursA - 100 * MaintenanceA)\nRevenueB = (700 * HoursB - 300 * HoursB - 100 * MaintenanceB)\nRevenueC = (900 * HoursC - 400 * HoursC - 100 * MaintenanceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 24) # total daily operating hours for all machines must not exceed 24 hours\nmodel.addCons(MaintenanceA + MaintenanceB + MaintenanceC <= 8) # total daily maintenance hours for all machines must not exceed 8 hours\nmodel.addCons(HoursA >= 2) # MachineA must operate at least 2 hours daily\nmodel.addCons(HoursB + HoursC <= 16) # MachineB and MachineC combined must not operate more than 16 hours daily\nmodel.addCons(MaintenanceC >= 0.5 * HoursC) # maintenance hours for MachineC must be at least half of its operating hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating Hours for MachineA: \", model.getVal(HoursA))\n    print(\"Operating Hours for MachineB: \", model.getVal(HoursB))\n    print(\"Operating Hours for MachineC: \", model.getVal(HoursC))\n    print(\"Maintenance Hours for MachineA: \", model.getVal(MaintenanceA))\n    print(\"Maintenance Hours for MachineB: \", model.getVal(MaintenanceB))\n    print(\"Maintenance Hours for MachineC: \", model.getVal(MaintenanceC))\n    print(\"Maximized Net Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a new region. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install. Additionally, the company needs to decide on the investment amount ($) in research and development (R&DInvestment) to improve the efficiency of both solar panels and wind turbines. The efficiency improvements are expected to be nonlinear and depend on the investment.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for efficiency\": \"R&DInvestment\", \"range\": \"R&DInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize the total annual energy output (in MWh). The energy output from each solar panel is initially 2 MWh per year, but with R&D investment, the output increases by 0.1 MWh per year for every $1,000 invested. The energy output from each wind turbine is initially 5 MWh per year, and with R&D investment, the output increases by 0.2 MWh per year for every $1,000 invested. The relationship between investment and efficiency is nonlinear, following a quadratic function.\n// Energy output from solar panels: SolarOutput = 2 * SolarPanels + 0.0001 * R&DInvestment * SolarPanels^2\n// Energy output from wind turbines: WindOutput = 5 * WindTurbines + 0.0002 * R&DInvestment * WindTurbines^2\n// So, the objective function is: Maximize (SolarOutput + WindOutput)\n\n## Generate Constraint-1:\nThe total budget for installation and R&D investment is $1,000,000.\n// Cost of solar panels + Cost of wind turbines + R&DInvestment <= 1000000\n// Assuming the cost of each solar panel is $1,000 and each wind turbine is $5,000:\n// 1000 * SolarPanels + 5000 * WindTurbines + R&DInvestment <= 1000000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a new region. The company needs to determine the number of solar panels (SolarPanels) and wind turbines (WindTurbines) to install, as well as the investment amount ($) in research and development (R&DInvestment) to improve the efficiency of both solar panels and wind turbines. The efficiency improvements are expected to be nonlinear and depend on the investment. The energy output from each solar panel is initially 2 MWh per year, but with R&D investment, the output increases by 0.1 MWh per year for every $1,000 invested. The energy output from each wind turbine is initially 5 MWh per year, and with R&D investment, the output increases by 0.2 MWh per year for every $1,000 invested. The relationship between investment and efficiency is nonlinear, following a quadratic function.\n\n| Component       | Initial Energy Output (MWh/year) | Cost per Unit ($) |\n|-----------------|---------------------------------|-------------------|\n| Solar Panels    | 2                               | 1000              |\n| Wind Turbines   | 5                               | 5000              |\n\nThe company aims to maximize the total annual energy output (in MWh). The total budget for installation and R&D investment is $1,000,000. Please help the company determine the optimal number of solar panels, wind turbines, and the investment in R&D to maximize the total annual energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)  # number of wind turbines\nR_DInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"R_DInvestment\", lb=0)  # investment in R&D for efficiency\n\n# Define objective function\nSolarOutput = 2 * SolarPanels + 0.0001 * R_DInvestment * SolarPanels**2\nWindOutput = 5 * WindTurbines + 0.0002 * R_DInvestment * WindTurbines**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == SolarOutput + WindOutput)\n\n# Add constraints\nmodel.addCons(1000 * SolarPanels + 5000 * WindTurbines + R_DInvestment <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in R&D: \", model.getVal(R_DInvestment))\n    print(\"Maximized Total Annual Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1462,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"operational cost per truck\": \"CostPerTruck\", \"range\": \"CostPerTruck >= 0\", \"type\": \"real\"}\n// {\"operational cost per van\": \"CostPerVan\", \"range\": \"CostPerVan >= 0\", \"type\": \"real\"}\n// {\"operational cost per motorcycle\": \"CostPerMotorcycle\", \"range\": \"CostPerMotorcycle >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company estimates that each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company aims to maximize the net daily profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\n// TotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// Trucks + Vans + Motorcycles <= 100000\n\n## Generate Constraint-2:\nThe total operational cost should not exceed $50,000 per day.\n// 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000\n\n## Generate Constraint-3:\nThe number of trucks should be at least 10% of the total number of vehicles.\n// Trucks >= 0.1 * (Trucks + Vans + Motorcycles)",
        "question": "A logistics company is planning its fleet expansion to include different types of vehicles: trucks, vans, and motorcycles. The company needs to decide on the number of each type of vehicle to purchase and the associated operational costs. Each truck can generate a revenue of $5000 per day, each van $3000 per day, and each motorcycle $1000 per day. The operational costs are estimated to be $1000 per truck, $500 per van, and $200 per motorcycle. The company aims to maximize the net daily profit, which is the total revenue minus the total operational costs. The company has a budget of $100,000 for purchasing vehicles. The total operational cost should not exceed $50,000 per day. The number of trucks should be at least 10% of the total number of vehicles. Please help the company determine the optimal number of each type of vehicle to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nCostPerTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerTruck\", lb=0)  # operational cost per truck\nCostPerVan = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerVan\", lb=0)  # operational cost per van\nCostPerMotorcycle = model.addVar(vtype=\"CONTINUOUS\", name=\"CostPerMotorcycle\", lb=0)  # operational cost per motorcycle\n\n# Define objective function\nTotalRevenue = 5000 * Trucks + 3000 * Vans + 1000 * Motorcycles\nTotalCost = 1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle\n# So, the objective function is: Maximize (TotalRevenue - TotalCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(Trucks + Vans + Motorcycles <= 100000)\n# The total operational cost should not exceed $50,000 per day.\nmodel.addCons(1000 * Trucks * CostPerTruck + 500 * Vans * CostPerVan + 200 * Motorcycles * CostPerMotorcycle <= 50000)\n# The number of trucks should be at least 10% of the total number of vehicles.\nmodel.addCons(Trucks >= 0.1 * (Trucks + Vans + Motorcycles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Operational Cost per Truck: \", model.getVal(CostPerTruck))\n    print(\"Operational Cost per Van: \", model.getVal(CostPerVan))\n    print(\"Operational Cost per Motorcycle: \", model.getVal(CostPerMotorcycle))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, B is $70, C is $60, D is $80, and E is $90. The cost of machine maintenance per unit produced is $10 for A, $15 for B, $20 for C, $25 for D, and $30 for E. The company aims to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n// Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n// Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of all machines combined is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum daily production requirement of 200 units for component A.\n// A >= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E does not exceed 30% of the total production.\n// E <= 0.3 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe total cost of maintenance should not exceed $15,000 per day.\n// 10A + 15B + 20C + 25D + 30E <= 15000\n\n## Generate Constraint-5:\nThe production of component B should be at least twice the production of component A.\n// B >= 2A",
        "question": "A manufacturing company produces five different types of electronic components (A, B, C, D, E) using a set of machines. The company wants to optimize the production process to maximize profit while considering the cost of machine maintenance and the efficiency of each machine. The profit per unit and the cost of machine maintenance per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Maintenance Cost per Unit |\n|-----------|-----------------|---------------------------|\n| A         | $50             | $10                       |\n| B         | $70             | $15                       |\n| C         | $60             | $20                       |\n| D         | $80             | $25                       |\n| E         | $90             | $30                       |\n\nThe company has a total production capacity of 1000 units per day. The company has a minimum daily production requirement of 200 units for component A. The company wants to ensure that the production of component E does not exceed 30% of the total production. The total cost of maintenance should not exceed $15,000 per day. The production of component B should be at least twice the production of component A.\n\nPlease help the company to maximize the net profit, which is the difference between the total profit and the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of component E\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 60C + 80D + 90E\n## Total maintenance cost: Cost = 10A + 15B + 20C + 25D + 30E\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C + 80 * D + 90 * E\nCost = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity of all machines combined is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a minimum daily production requirement of 200 units for component A.\nmodel.addCons(A >= 200)\n## The company wants to ensure that the production of component E does not exceed 30% of the total production.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n## The total cost of maintenance should not exceed $15,000 per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n## The production of component B should be at least twice the production of component A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company has a contract to deliver goods over a total distance of 1000 kilometers. The efficiency of the trucks is such that the cost per kilometer decreases by $0.01 for each additional truck of the same type used. The company aims to minimize the total operational cost while fulfilling the contract.\n// Cost_S = max(2 - 0.01 * (S - 1), 2) * 1000\n// Cost_M = max(3 - 0.01 * (M - 1), 3) * 1000\n// Cost_L = max(4 - 0.01 * (L - 1), 4) * 1000\n// Cost_XL = max(5 - 0.01 * (XL - 1), 5) * 1000\n// Cost_R = max(6 - 0.01 * (R - 1), 6) * 1000\n// So, the objective function is: Minimize Cost_S + Cost_M + Cost_L + Cost_XL + Cost_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $100,000 to purchase trucks. The cost of a Small truck is $10,000, a Medium truck is $15,000, a Large truck is $20,000, an Extra-Large truck is $25,000, and a Refrigerated truck is $30,000.\n// 10000 * S + 15000 * M + 20000 * L + 25000 * XL + 30000 * R <= 100000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 10 trucks in total.\n// S + M + L + XL + R <= 10",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize operational costs. The operational cost per kilometer for Small trucks is $2, for Medium trucks is $3, for Large trucks is $4, for Extra-Large trucks is $5, and for Refrigerated trucks is $6. The company has a contract to deliver goods over a total distance of 1000 kilometers. The efficiency of the trucks is such that the cost per kilometer decreases by $0.01 for each additional truck of the same type used. The company aims to minimize the total operational cost while fulfilling the contract. The company has a total fleet budget of $100,000 to purchase trucks. The cost of a Small truck is $10,000, a Medium truck is $15,000, a Large truck is $20,000, an Extra-Large truck is $25,000, and a Refrigerated truck is $30,000. The company can only operate a maximum of 10 trucks in total. Please help the company to determine the optimal number of each type of truck to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = max(2 - 0.01 * (S - 1), 2) * 1000\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=1)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=1, ub=10)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = (2 - 0.01 * (S1 - 1)) * 1000 * S_b1 + (2 - 0.01 * (S2 - 1)) * 1000 * S_b2\n## create piecewise variables for piecewise function: Cost_M = max(3 - 0.01 * (M - 1), 3) * 1000\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=1)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=1, ub=10)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nCost_M = (3 - 0.01 * (M1 - 1)) * 1000 * M_b1 + (3 - 0.01 * (M2 - 1)) * 1000 * M_b2\n## create piecewise variables for piecewise function: Cost_L = max(4 - 0.01 * (L - 1), 4) * 1000\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=1)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=1, ub=10)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = (4 - 0.01 * (L1 - 1)) * 1000 * L_b1 + (4 - 0.01 * (L2 - 1)) * 1000 * L_b2\n## create piecewise variables for piecewise function: Cost_XL = max(5 - 0.01 * (XL - 1), 5) * 1000\nXL1 = model.addVar(vtype=\"INTEGER\", name=\"XL1\", lb=0, ub=1)\nXL2 = model.addVar(vtype=\"INTEGER\", name=\"XL2\", lb=1, ub=10)\nXL_b1 = model.addVar(vtype=\"B\", name=\"XL_b1\")\nXL_b2 = model.addVar(vtype=\"B\", name=\"XL_b2\")\nmodel.addCons(XL_b1 + XL_b2 == 1)\nmodel.addCons(XL == XL1*XL_b1 + XL2*XL_b2)\nCost_XL = (5 - 0.01 * (XL1 - 1)) * 1000 * XL_b1 + (5 - 0.01 * (XL2 - 1)) * 1000 * XL_b2\n## create piecewise variables for piecewise function: Cost_R = max(6 - 0.01 * (R - 1), 6) * 1000\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=1)\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=1, ub=10)\nR_b1 = model.addVar(vtype=\"B\", name=\"R_b1\")\nR_b2 = model.addVar(vtype=\"B\", name=\"R_b2\")\nmodel.addCons(R_b1 + R_b2 == 1)\nmodel.addCons(R == R1*R_b1 + R2*R_b2)\nCost_R = (6 - 0.01 * (R1 - 1)) * 1000 * R_b1 + (6 - 0.01 * (R2 - 1)) * 1000 * R_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_S + Cost_M + Cost_L + Cost_XL + Cost_R\nmodel.addCons(obj == Cost_S + Cost_M + Cost_L + Cost_XL + Cost_R)\n\n# Add constraints\n## The company has a total fleet budget of $100,000 to purchase trucks.\nmodel.addCons(10000 * S + 15000 * M + 20000 * L + 25000 * XL + 30000 * R <= 100000)\n## The company can only operate a maximum of 10 trucks in total.\nmodel.addCons(S + M + L + XL + R <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product to optimize its profit. Additionally, the company can invest in enhancing the production efficiency of each product, which affects the production cost and the number of units that can be produced.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"real\"}\n// {\"investment in efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"real\"}\n// {\"investment in efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $500, for ProductB is $700, and for ProductC is $600. The production cost per unit decreases with the investment in efficiency: for ProductA, the cost decreases by $10 per unit for every $1000 invested in efficiency; for ProductB, the cost decreases by $15 per unit for every $1000 invested in efficiency; for ProductC, the cost decreases by $12 per unit for every $1000 invested in efficiency. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (500 - (10 * EfficiencyA / 1000)) * UnitsA\n// Total profit for ProductB: Profit_B = (700 - (15 * EfficiencyB / 1000)) * UnitsB\n// Total profit for ProductC: Profit_C = (600 - (12 * EfficiencyC / 1000)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for efficiency investments.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 50,000\n\n## Generate Constraint-2:\nThe production capacity for each product is limited: ProductA can produce up to 100 units, ProductB up to 150 units, and ProductC up to 120 units.\n// UnitsA <= 100; UnitsB <= 150; UnitsC <= 120\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 20 units of ProductA and 30 units of ProductB.\n// UnitsA >= 20; UnitsB >= 30\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production, ensuring that the number of units produced for ProductC is at least half the number produced for ProductA and ProductB combined.\n// UnitsC >= 0.5 * (UnitsA + UnitsB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount to invest in enhancing the production efficiency of each product to optimize its profit. The profit per unit for ProductA is $500, for ProductB is $700, and for ProductC is $600. The production cost per unit decreases with the investment in efficiency: for ProductA, the cost decreases by $10 per unit for every $1000 invested in efficiency; for ProductB, the cost decreases by $15 per unit for every $1000 invested in efficiency; for ProductC, the cost decreases by $12 per unit for every $1000 invested in efficiency. The company has a total budget of $50,000 for efficiency investments. The production capacity for each product is limited: ProductA can produce up to 100 units, ProductB up to 150 units, and ProductC up to 120 units. Due to market demand, the company must produce at least 20 units of ProductA and 30 units of ProductB. The company aims to maintain a balanced production, ensuring that the number of units produced for ProductC is at least half the number produced for ProductA and ProductB combined.\n\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20, ub=100)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30, ub=150)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0, ub=120)    # number of units of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in efficiency for ProductC\n\n# Define objective function\nProfit_A = (500 - (10 * EfficiencyA / 1000)) * UnitsA\nProfit_B = (700 - (15 * EfficiencyB / 1000)) * UnitsB\nProfit_C = (600 - (12 * EfficiencyC / 1000)) * UnitsC\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 50000)  # Total budget for efficiency investments\nmodel.addCons(UnitsA <= 100)  # Production capacity for ProductA\nmodel.addCons(UnitsB <= 150)  # Production capacity for ProductB\nmodel.addCons(UnitsC <= 120)  # Production capacity for ProductC\nmodel.addCons(UnitsA >= 20)  # Minimum production for ProductA\nmodel.addCons(UnitsB >= 30)  # Minimum production for ProductB\nmodel.addCons(UnitsC >= 0.5 * (UnitsA + UnitsB))  # Balanced production constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks.\n// {\"number of trucks for Zone1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Zone5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Zone1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Zone5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades. The initial operational cost per truck is $500. The company aims to minimize the total operational cost across all zones.\n// Operational cost for Zone1: Cost1 = (500 - 0.1 * Upgrade1) * Trucks1\n// Operational cost for Zone2: Cost2 = (500 - 0.1 * Upgrade2) * Trucks2\n// Operational cost for Zone3: Cost3 = (500 - 0.1 * Upgrade3) * Trucks3\n// Operational cost for Zone4: Cost4 = (500 - 0.1 * Upgrade4) * Trucks4\n// Operational cost for Zone5: Cost5 = (500 - 0.1 * Upgrade5) * Trucks5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $100,000.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000\n\n## Generate Constraint-3:\nDue to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\n// Trucks1 >= 20; Trucks2 >= 15",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different delivery zones: Zone1, Zone2, Zone3, Zone4, and Zone5. The company needs to determine the number of trucks to allocate to each zone and the fuel efficiency upgrades to invest in for each zone. The fuel efficiency upgrades directly affect the operational costs of the trucks. The operational cost per truck decreases by $100 for every $1,000 invested in fuel efficiency upgrades, with an initial operational cost per truck of $500. The company aims to minimize the total operational cost across all zones.\n\nThe company has a total of 100 trucks available for allocation and a total budget for fuel efficiency upgrades of $100,000. Due to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\n\nPlease help the company to determine the optimal allocation of trucks and investments in fuel efficiency upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Zone1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Zone2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Zone3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks for Zone4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks for Zone5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Zone1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Zone2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Zone3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # fuel efficiency upgrade for Zone4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # fuel efficiency upgrade for Zone5\n\n# Define objective function\nCost1 = (500 - 0.1 * Upgrade1) * Trucks1\nCost2 = (500 - 0.1 * Upgrade2) * Trucks2\nCost3 = (500 - 0.1 * Upgrade3) * Trucks3\nCost4 = (500 - 0.1 * Upgrade4) * Trucks4\nCost5 = (500 - 0.1 * Upgrade5) * Trucks5\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\n# The company has a total of 100 trucks available for allocation.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 100)\n# The total budget for fuel efficiency upgrades is $100,000.\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 100000)\n# Due to contractual obligations, Zone1 must receive at least 20 trucks and Zone2 must receive at least 15 trucks.\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Zone1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Zone2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Zone3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks for Zone4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks for Zone5: \", model.getVal(Trucks5))\n    print(\"Fuel Efficiency Upgrade for Zone1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Zone2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Zone3: \", model.getVal(Upgrade3))\n    print(\"Fuel Efficiency Upgrade for Zone4: \", model.getVal(Upgrade4))\n    print(\"Fuel Efficiency Upgrade for Zone5: \", model.getVal(Upgrade5))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: perishable goods, non-perishable goods, and hazardous materials. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for non-perishable goods\": \"NonPerishableTrucks\", \"range\": \"NonPerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for hazardous materials\": \"HazardousTrucks\", \"range\": \"HazardousTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for perishable trucks\": \"FuelEfficiencyPerishable\", \"range\": \"FuelEfficiencyPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for non-perishable trucks\": \"FuelEfficiencyNonPerishable\", \"range\": \"FuelEfficiencyNonPerishable >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for hazardous trucks\": \"FuelEfficiencyHazardous\", \"range\": \"FuelEfficiencyHazardous >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each type of truck improves with the investment in fuel-efficient technologies. The cost savings per mile driven is a nonlinear function of the investment, with diminishing returns. The company aims to maximize the total cost savings from fuel efficiency across all types of trucks.\n// Cost savings per mile for perishable trucks: SavingsPerishable = (1 - (1 / (1 + FuelEfficiencyPerishable))^2) * PerishableTrucks\n// Cost savings per mile for non-perishable trucks: SavingsNonPerishable = (1 - (1 / (1 + FuelEfficiencyNonPerishable))^2) * NonPerishableTrucks\n// Cost savings per mile for hazardous trucks: SavingsHazardous = (1 - (1 / (1 + FuelEfficiencyHazardous))^2) * HazardousTrucks\n// So, the objective function is: Maximize (SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\n// PerishableTrucks * TruckCostPerishable + NonPerishableTrucks * TruckCostNonPerishable + HazardousTrucks * TruckCostHazardous + FuelEfficiencyPerishable + FuelEfficiencyNonPerishable + FuelEfficiencyHazardous <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100",
        "question": "A logistics company is planning its fleet for the next quarter. They need to decide the number of trucks to purchase for three different types of cargo: perishable goods, non-perishable goods, and hazardous materials. Additionally, they need to determine the amount of money to invest in fuel-efficient technologies for each type of truck. The company aims to maximize the total cost savings from fuel efficiency across all types of trucks. The cost savings per mile driven is a nonlinear function of the investment, with diminishing returns.\n\nThe company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies. The total number of trucks cannot exceed 100.\n\nPlease help the company determine the optimal number of trucks and the investment in fuel-efficient technologies to maximize the total cost savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nNonPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"NonPerishableTrucks\", lb=0)\nHazardousTrucks = model.addVar(vtype=\"INTEGER\", name=\"HazardousTrucks\", lb=0)\nFuelEfficiencyPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyPerishable\", lb=0)\nFuelEfficiencyNonPerishable = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyNonPerishable\", lb=0)\nFuelEfficiencyHazardous = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyHazardous\", lb=0)\n\n# Define objective function\n## Cost savings per mile for perishable trucks\nSavingsPerishable = (1 - (1 / (1 + FuelEfficiencyPerishable))**2) * PerishableTrucks\n## Cost savings per mile for non-perishable trucks\nSavingsNonPerishable = (1 - (1 / (1 + FuelEfficiencyNonPerishable))**2) * NonPerishableTrucks\n## Cost savings per mile for hazardous trucks\nSavingsHazardous = (1 - (1 / (1 + FuelEfficiencyHazardous))**2) * HazardousTrucks\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\nmodel.addCons(obj == SavingsPerishable + SavingsNonPerishable + SavingsHazardous)\n\n# Add constraints\n## The company has a budget of $200,000 for purchasing trucks and investing in fuel-efficient technologies.\nmodel.addCons(PerishableTrucks * 50000 + NonPerishableTrucks * 40000 + HazardousTrucks * 60000 + FuelEfficiencyPerishable + FuelEfficiencyNonPerishable + FuelEfficiencyHazardous <= 200000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(PerishableTrucks + NonPerishableTrucks + HazardousTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Perishable Trucks: \", model.getVal(PerishableTrucks))\n    print(\"Number of Non-Perishable Trucks: \", model.getVal(NonPerishableTrucks))\n    print(\"Number of Hazardous Trucks: \", model.getVal(HazardousTrucks))\n    print(\"Investment in Fuel Efficiency for Perishable Trucks: \", model.getVal(FuelEfficiencyPerishable))\n    print(\"Investment in Fuel Efficiency for Non-Perishable Trucks: \", model.getVal(FuelEfficiencyNonPerishable))\n    print(\"Investment in Fuel Efficiency for Hazardous Trucks: \", model.getVal(FuelEfficiencyHazardous))\n    print(\"Total Cost Savings: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold.\n// {\"number of solar panels for Residential\": \"ResidentialPanels\", \"range\": \"ResidentialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Commercial\": \"CommercialPanels\", \"range\": \"CommercialPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels for Industrial\": \"IndustrialPanels\", \"range\": \"IndustrialPanels >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage for Residential\": \"ResidentialStorage\", \"range\": \"ResidentialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Commercial\": \"CommercialStorage\", \"range\": \"CommercialStorage >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy storage for Industrial\": \"IndustrialStorage\", \"range\": \"IndustrialStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling energy is affected by the amount of energy storage. For Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms.\n// Total revenue for Residential: Revenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\n// Total revenue for Commercial: Revenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\n// Total revenue for Industrial: Revenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n// So, the objective function is: Maximize (Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for solar panel installations and energy storage investments.\n// ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000\n\n## Generate Constraint-2:\nThe total area available for solar panel installation across all types of farms is limited to 5000 square meters.\n// ResidentialPanels + CommercialPanels + IndustrialPanels <= 5000\n\n## Generate Constraint-3:\nDue to local regulations, the company must install at least 1000 solar panels for Residential and 500 panels for Commercial.\n// ResidentialPanels >= 1000; CommercialPanels >= 500",
        "question": "A renewable energy company operates three types of solar farms: Residential, Commercial, and Industrial. The company needs to determine the number of solar panels to install for each type of farm and the level of energy storage to invest in for each type. The energy storage investment affects the efficiency and the amount of energy that can be stored and sold.\nFor Residential, each solar panel generates $200 of revenue per year, and for every $1000 invested in storage, the revenue increases by $50 per panel. For Commercial, each panel generates $300 of revenue per year, and for every $1000 invested in storage, the revenue increases by $75 per panel. For Industrial, each panel generates $500 of revenue per year, and for every $1000 invested in storage, the revenue increases by $100 per panel. The company aims to maximize the total annual revenue from all solar farms.\nThe company has a total budget of $1,000,000 for solar panel installations and energy storage investments. The total area available for solar panel installation across all types of farms is limited to 5000 square meters. Due to local regulations, the company must install at least 1000 solar panels for Residential and 500 panels for Commercial.\nPlease help the company to maximize the total annual revenue from all solar farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidentialPanels = model.addVar(vtype=\"INTEGER\", name=\"ResidentialPanels\", lb=1000)  # number of solar panels for Residential\nCommercialPanels = model.addVar(vtype=\"INTEGER\", name=\"CommercialPanels\", lb=500)  # number of solar panels for Commercial\nIndustrialPanels = model.addVar(vtype=\"INTEGER\", name=\"IndustrialPanels\", lb=0)  # number of solar panels for Industrial\nResidentialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"ResidentialStorage\", lb=0)  # investment in energy storage for Residential\nCommercialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"CommercialStorage\", lb=0)  # investment in energy storage for Commercial\nIndustrialStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"IndustrialStorage\", lb=0)  # investment in energy storage for Industrial\n\n# Define objective function\nRevenue_Residential = (200 + 0.05 * ResidentialStorage) * ResidentialPanels\nRevenue_Commercial = (300 + 0.075 * CommercialStorage) * CommercialPanels\nRevenue_Industrial = (500 + 0.1 * IndustrialStorage) * IndustrialPanels\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Residential + Revenue_Commercial + Revenue_Industrial)\n\n# Add constraints\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels + ResidentialStorage + CommercialStorage + IndustrialStorage <= 1000000)\nmodel.addCons(ResidentialPanels + CommercialPanels + IndustrialPanels <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Panels: \", model.getVal(ResidentialPanels))\n    print(\"Number of Commercial Panels: \", model.getVal(CommercialPanels))\n    print(\"Number of Industrial Panels: \", model.getVal(IndustrialPanels))\n    print(\"Investment in Residential Storage: \", model.getVal(ResidentialStorage))\n    print(\"Investment in Commercial Storage: \", model.getVal(CommercialStorage))\n    print(\"Investment in Industrial Storage: \", model.getVal(IndustrialStorage))\n    print(\"Total Annual Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting each type of package per truck is given in the following Table.\n\n| Package Type | Cost per Truck |\n|--------------|----------------|\n| Small        | $1000          |\n| Medium       | $1500          |\n| Large        | $2000          |\n| X-Large      | $2500          |\n| Special      | $3000          |\n\nDue to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Please help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=0)\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n## the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Small Packages: \", model.getVal(SmallTrucks))\n    print(\"Number of Trucks for Medium Packages: \", model.getVal(MediumTrucks))\n    print(\"Number of Trucks for Large Packages: \", model.getVal(LargeTrucks))\n    print(\"Number of Trucks for X-Large Packages: \", model.getVal(XL_Trucks))\n    print(\"Number of Trucks for Special Packages: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for ProductA\": \"RawMaterialACost\", \"range\": \"RawMaterialACost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductB\": \"RawMaterialBCost\", \"range\": \"RawMaterialBCost >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for ProductC\": \"RawMaterialCCost\", \"range\": \"RawMaterialCCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductA\": \"LaborACost\", \"range\": \"LaborACost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductB\": \"LaborBCost\", \"range\": \"LaborBCost >= 0\", \"type\": \"real\"}\n// {\"labor cost per unit for ProductC\": \"LaborCCost\", \"range\": \"LaborCCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductA\": \"StorageACost\", \"range\": \"StorageACost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductB\": \"StorageBCost\", \"range\": \"StorageBCost >= 0\", \"type\": \"real\"}\n// {\"storage cost per unit for ProductC\": \"StorageCCost\", \"range\": \"StorageCCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60.\n// Total profit for ProductA: Profit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\n// Total profit for ProductB: Profit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\n// Total profit for ProductC: Profit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for raw materials.\n// RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The company has a budget of $100,000 for raw materials.\n\nPlease help the company to maximize the total profit from selling all products, considering the revenue from each product minus the costs of raw materials, labor, and storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # quantity of ProductC\nRawMaterialACost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialACost\", lb=0)  # cost of raw materials for ProductA\nRawMaterialBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialBCost\", lb=0)  # cost of raw materials for ProductB\nRawMaterialCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterialCCost\", lb=0)  # cost of raw materials for ProductC\nLaborACost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborACost\", lb=0)  # labor cost per unit for ProductA\nLaborBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborBCost\", lb=0)  # labor cost per unit for ProductB\nLaborCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborCCost\", lb=0)  # labor cost per unit for ProductC\nStorageACost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageACost\", lb=0)  # storage cost per unit for ProductA\nStorageBCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageBCost\", lb=0)  # storage cost per unit for ProductB\nStorageCCost = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageCCost\", lb=0)  # storage cost per unit for ProductC\n\n# Define objective function\nProfit_A = (50 - LaborACost - StorageACost) * ProductAQty - RawMaterialACost\nProfit_B = (70 - LaborBCost - StorageBCost) * ProductBQty - RawMaterialBCost\nProfit_C = (60 - LaborCCost - StorageCCost) * ProductCQty - RawMaterialCCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(RawMaterialACost + RawMaterialBCost + RawMaterialCCost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 565,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product. Additionally, the company is considering investing in a new technology that can reduce the production time per unit, but at a cost. The variables include the number of units of each product and the investment in the new technology.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production time per unit for ProductA is 5 hours, for ProductB is 7 hours, and for ProductC is 9 hours. The new technology reduces the production time per unit by 0.1 hours for every $1000 invested. The revenue per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The company aims to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// Production time cost for ProductA: TimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\n// Production time cost for ProductB: TimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\n// Production time cost for ProductC: TimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours.\n// (5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of ProductA and 30 units of ProductB.\n// UnitsA >= 50; UnitsB >= 30\n\n## Generate Constraint-4:\nThe total number of units produced should not exceed 1000.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of ProductC does not exceed the combined production of ProductA and ProductB.\n// UnitsC <= UnitsA + UnitsB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the investment in a new technology that can reduce the production time per unit, but at a cost. The production time per unit, revenue per unit, and the effect of the new technology on production time are given in the following Table.\n\n| Product | Production Time per Unit | Revenue per Unit | Reduction in Production Time per $1000 Invested |\n|---------|--------------------------|------------------|------------------------------------------------|\n| ProductA | 5 hours                  | $100             | 0.1 hours                                      |\n| ProductB | 7 hours                  | $150             | 0.1 hours                                      |\n| ProductC | 9 hours                  | $200             | 0.1 hours                                      |\n\nThe company has a total production capacity of 1000 hours. The total investment in the new technology cannot exceed $50,000. The company must produce at least 50 units of ProductA and 30 units of ProductB. The total number of units produced should not exceed 1000. The company wants to ensure that the production of ProductC does not exceed the combined production of ProductA and ProductB.\n\nPlease help the company to maximize the total revenue minus the production time cost (in dollars, assuming an hourly labor cost of $20).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=30)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)    # number of units of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\nTimeCostA = (5 - 0.0001 * TechInvestment) * UnitsA * 20\nTimeCostB = (7 - 0.0001 * TechInvestment) * UnitsB * 20\nTimeCostC = (9 - 0.0001 * TechInvestment) * UnitsC * 20\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC - TimeCostA - TimeCostB - TimeCostC)\n\n# Add constraints\nmodel.addCons((5 - 0.0001 * TechInvestment) * UnitsA + (7 - 0.0001 * TechInvestment) * UnitsB + (9 - 0.0001 * TechInvestment) * UnitsC <= 1000)\nmodel.addCons(TechInvestment <= 50000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\nmodel.addCons(UnitsC <= UnitsA + UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1478,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy for each region and the amount of fuel to invest in each truck to enhance fuel efficiency. The goal is to minimize the total operational cost while meeting the demand for transportation in each region.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Region1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Region3\": \"FuelEfficiency3\", \"range\": \"FuelEfficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck is influenced by the amount invested in fuel efficiency. The initial operational cost per truck in Region1 is $1000, but with increased fuel efficiency, the cost decreases by $10 for every $50 invested. \nThe initial operational cost per truck in Region2 is $1200, and with increased fuel efficiency, the cost decreases by $12 for every $50 invested. \nThe initial operational cost per truck in Region3 is $1100, and with increased fuel efficiency, the cost decreases by $11 for every $50 invested. \nThe company aims to minimize the total operational cost across all regions.\n// Total operational cost for Region1: Cost1 = (1000 - 0.2 * FuelEfficiency1) * Trucks1\n// Total operational cost for Region2: Cost2 = (1200 - 0.24 * FuelEfficiency2) * Trucks2\n// Total operational cost for Region3: Cost3 = (1100 - 0.22 * FuelEfficiency3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck deployment and fuel efficiency investments.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelEfficiency1 + FuelEfficiency2 + FuelEfficiency3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy for each region and the amount of fuel to invest in each truck to enhance fuel efficiency. The goal is to minimize the total operational cost while meeting the demand for transportation in each region.\nThe operational cost of each truck is influenced by the amount invested in fuel efficiency. The initial operational cost per truck in Region1 is $1000, but with increased fuel efficiency, the cost decreases by $10 for every $50 invested. \nThe initial operational cost per truck in Region2 is $1200, and with increased fuel efficiency, the cost decreases by $12 for every $50 invested. \nThe initial operational cost per truck in Region3 is $1100, and with increased fuel efficiency, the cost decreases by $11 for every $50 invested. \nThe company has a total budget of $100,000 for truck deployment and fuel efficiency investments.\nPlease help the company to minimize the total operational cost across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nFuelEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency1\", lb=0)  # investment in fuel efficiency for Region1\nFuelEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency2\", lb=0)  # investment in fuel efficiency for Region2\nFuelEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency3\", lb=0)  # investment in fuel efficiency for Region3\n\n# Define objective function\nCost1 = (1000 - 0.2 * FuelEfficiency1) * Trucks1\nCost2 = (1200 - 0.24 * FuelEfficiency2) * Trucks2\nCost3 = (1100 - 0.22 * FuelEfficiency3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelEfficiency1 + FuelEfficiency2 + FuelEfficiency3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Region1: \", model.getVal(FuelEfficiency1))\n    print(\"Investment in Fuel Efficiency for Region2: \", model.getVal(FuelEfficiency2))\n    print(\"Investment in Fuel Efficiency for Region3: \", model.getVal(FuelEfficiency3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy-Duty trucks\": \"HeavyDutyTrucks\", \"range\": \"HeavyDutyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in technology upgrades for Refrigerated trucks\": \"TechUpgradeRefrigerated\", \"range\": \"TechUpgradeRefrigerated >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Heavy-Duty trucks\": \"TechUpgradeHeavyDuty\", \"range\": \"TechUpgradeHeavyDuty >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology upgrades for Standard trucks\": \"TechUpgradeStandard\", \"range\": \"TechUpgradeStandard >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs.\n// Fuel cost per Refrigerated truck: FuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\n// Maintenance cost per Refrigerated truck: MaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\n// Similar calculations for Heavy-Duty and Standard trucks.\n// Total annual operating cost: OperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n// So, the objective function is: Minimize OperatingCost\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for purchasing trucks and technology upgrades.\n// RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 200.\n// RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200\n\n## Generate Constraint-3:\nAt least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations.\n// RefrigeratedTrucks >= 50; HeavyDutyTrucks >= 75",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: Refrigerated, Heavy-Duty, and Standard. Additionally, they need to determine the amount of investment in technology upgrades for each type of truck to improve fuel efficiency and reduce maintenance costs. The fuel efficiency and maintenance cost reduction benefits are nonlinearly related to the investment in technology upgrades. For each $1000 invested in technology upgrades, the fuel efficiency improves by 1%, and maintenance costs decrease by 0.5%. The company aims to minimize the total annual operating cost of the fleet, which includes fuel and maintenance costs. The company has a budget of $500,000 for purchasing trucks and technology upgrades. The total number of trucks cannot exceed 200. At least 50 Refrigerated trucks and 75 Heavy-Duty trucks must be purchased to meet contractual obligations. Please help the company to minimize the total annual operating cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=50)\nHeavyDutyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyDutyTrucks\", lb=75)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nTechUpgradeRefrigerated = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeRefrigerated\", lb=0)\nTechUpgradeHeavyDuty = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeHeavyDuty\", lb=0)\nTechUpgradeStandard = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeStandard\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Fuel and maintenance cost calculations\nBaseFuelCost = 10000  # Example base fuel cost per truck\nBaseMaintenanceCost = 2000  # Example base maintenance cost per truck\n\nFuelCostRefrigerated = (BaseFuelCost * RefrigeratedTrucks) / (1 + 0.01 * TechUpgradeRefrigerated)\nMaintenanceCostRefrigerated = (BaseMaintenanceCost * RefrigeratedTrucks) * (1 - 0.005 * TechUpgradeRefrigerated)\nFuelCostHeavyDuty = (BaseFuelCost * HeavyDutyTrucks) / (1 + 0.01 * TechUpgradeHeavyDuty)\nMaintenanceCostHeavyDuty = (BaseMaintenanceCost * HeavyDutyTrucks) * (1 - 0.005 * TechUpgradeHeavyDuty)\nFuelCostStandard = (BaseFuelCost * StandardTrucks) / (1 + 0.01 * TechUpgradeStandard)\nMaintenanceCostStandard = (BaseMaintenanceCost * StandardTrucks) * (1 - 0.005 * TechUpgradeStandard)\n\nOperatingCost = FuelCostRefrigerated + MaintenanceCostRefrigerated + FuelCostHeavyDuty + MaintenanceCostHeavyDuty + FuelCostStandard + MaintenanceCostStandard\n\nmodel.addCons(obj == OperatingCost)\n\n# Add constraints\n## The company has a budget of $500,000 for purchasing trucks and technology upgrades.\nTruckCostRefrigerated = 50000  # Example cost per Refrigerated truck\nTruckCostHeavyDuty = 70000  # Example cost per Heavy-Duty truck\nTruckCostStandard = 30000  # Example cost per Standard truck\nmodel.addCons(RefrigeratedTrucks * TruckCostRefrigerated + HeavyDutyTrucks * TruckCostHeavyDuty + StandardTrucks * TruckCostStandard + TechUpgradeRefrigerated + TechUpgradeHeavyDuty + TechUpgradeStandard <= 500000)\n\n## The total number of trucks cannot exceed 200.\nmodel.addCons(RefrigeratedTrucks + HeavyDutyTrucks + StandardTrucks <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy-Duty Trucks: \", model.getVal(HeavyDutyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Investment in Tech Upgrades for Refrigerated Trucks: \", model.getVal(TechUpgradeRefrigerated))\n    print(\"Investment in Tech Upgrades for Heavy-Duty Trucks: \", model.getVal(TechUpgradeHeavyDuty))\n    print(\"Investment in Tech Upgrades for Standard Trucks: \", model.getVal(TechUpgradeStandard))\n    print(\"Minimized Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region.\n// {\"number of trucks in Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks in Region 1 (km/liter)\": \"EfficiencyRegion1\", \"range\": \"EfficiencyRegion1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in Region 2 (km/liter)\": \"EfficiencyRegion2\", \"range\": \"EfficiencyRegion2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks in Region 3 (km/liter)\": \"EfficiencyRegion3\", \"range\": \"EfficiencyRegion3 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per liter is $1.5. The total distance traveled by trucks in each region is proportional to the number of trucks and the demand in that region. The company aims to minimize the total fuel cost.\n// FuelCostRegion1 = (TrucksRegion1 * DemandRegion1) / EfficiencyRegion1 * 1.5\n// FuelCostRegion2 = (TrucksRegion2 * DemandRegion2) / EfficiencyRegion2 * 1.5\n// FuelCostRegion3 = (TrucksRegion3 * DemandRegion3) / EfficiencyRegion3 * 1.5\n// So, the objective function is: Minimize (FuelCostRegion1 + FuelCostRegion2 + FuelCostRegion3)\n\n## Generate Constraint-1:\nThe total number of trucks available in the fleet is 50.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 <= 50\n\n## Generate Constraint-2:\nThe total budget for purchasing new trucks is $100,000. The cost of a truck in Region 1 is $20,000, in Region 2 is $25,000, and in Region 3 is $30,000.\n// TrucksRegion1 * 20000 + TrucksRegion2 * 25000 + TrucksRegion3 * 30000 <= 100000\n\n## Generate Constraint-3:\nThe company must meet at least 80% of the demand in each region. The demand in Region 1 is 1000 km, in Region 2 is 1500 km, and in Region 3 is 2000 km.\n// (TrucksRegion1 * DemandRegion1) / EfficiencyRegion1 >= 0.8 * 1000\n// (TrucksRegion2 * DemandRegion2) / EfficiencyRegion2 >= 0.8 * 1500\n// (TrucksRegion3 * DemandRegion3) / EfficiencyRegion3 >= 0.8 * 2000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The goal is to minimize the total fuel cost while meeting the demand for transportation in each region. The fuel cost per liter is $1.5. The total distance traveled by trucks in each region is proportional to the number of trucks and the demand in that region. The total number of trucks available in the fleet is 50. The total budget for purchasing new trucks is $100,000. The cost of a truck in Region 1 is $20,000, in Region 2 is $25,000, and in Region 3 is $30,000. The company must meet at least 80% of the demand in each region. The demand in Region 1 is 1000 km, in Region 2 is 1500 km, and in Region 3 is 2000 km.\n\nPlease help the company to minimize the total fuel cost by determining the optimal number of trucks and their fuel efficiencies for each region.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0)\nEfficiencyRegion1 = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyRegion1\", lb=0)\nEfficiencyRegion2 = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyRegion2\", lb=0)\nEfficiencyRegion3 = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyRegion3\", lb=0)\n\n# Define objective function\nFuelCostRegion1 = (TrucksRegion1 * 1000) / EfficiencyRegion1 * 1.5\nFuelCostRegion2 = (TrucksRegion2 * 1500) / EfficiencyRegion2 * 1.5\nFuelCostRegion3 = (TrucksRegion3 * 2000) / EfficiencyRegion3 * 1.5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostRegion1 + FuelCostRegion2 + FuelCostRegion3)\n\n# Add constraints\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 <= 50)\nmodel.addCons(TrucksRegion1 * 20000 + TrucksRegion2 * 25000 + TrucksRegion3 * 30000 <= 100000)\nmodel.addCons((TrucksRegion1 * 1000) / EfficiencyRegion1 >= 0.8 * 1000)\nmodel.addCons((TrucksRegion2 * 1500) / EfficiencyRegion2 >= 0.8 * 1500)\nmodel.addCons((TrucksRegion3 * 2000) / EfficiencyRegion3 >= 0.8 * 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(TrucksRegion3))\n    print(\"Fuel Efficiency in Region 1: \", model.getVal(EfficiencyRegion1))\n    print(\"Fuel Efficiency in Region 2: \", model.getVal(EfficiencyRegion2))\n    print(\"Fuel Efficiency in Region 3: \", model.getVal(EfficiencyRegion3))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of hours each product is processed on a specific machine, and the amount of investment in enhancing the machine's efficiency. The efficiency enhancement directly reduces the processing time per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"processing hours per unit of ProductA\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"continuous\"}\n// {\"processing hours per unit of ProductB\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"continuous\"}\n// {\"processing hours per unit of ProductC\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in machine efficiency for ProductC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe processing time per unit of each product decreases by 1 hour for every $5,000 invested in enhancing the machine's efficiency for that product. The initial processing time for ProductA is 5 hours, for ProductB is 6 hours, and for ProductC is 7 hours. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced processing time due to efficiency enhancements.\n// Total revenue for ProductA: RevenueA = (100 - 5 + 0.0002 * EfficiencyA) * QuantityA\n// Total revenue for ProductB: RevenueB = (120 - 6 + 0.0002 * EfficiencyB) * QuantityB\n// Total revenue for ProductC: RevenueC = (150 - 7 + 0.0002 * EfficiencyC) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total processing hours available on the machine for all products cannot exceed 1000 hours.\n// (5 - 0.0002 * EfficiencyA) * QuantityA + (6 - 0.0002 * EfficiencyB) * QuantityB + (7 - 0.0002 * EfficiencyC) * QuantityC <= 1000\n\n## Generate Constraint-2:\nThe total investment in machine efficiency enhancements cannot exceed $30,000.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 30000\n\n## Generate Constraint-3:\nDue to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units.\n// QuantityA >= 50; QuantityB >= 70\n\n## Generate Constraint-4:\nThe company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements.\n// HoursA >= 3; HoursB >= 3; HoursC >= 3\n// This translates to: 5 - 0.0002 * EfficiencyA >= 3; 6 - 0.0002 * EfficiencyB >= 3; 7 - 0.0002 * EfficiencyC >= 3",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of hours each product is processed on a specific machine, and the amount of investment in enhancing the machine's efficiency. The efficiency enhancement directly reduces the processing time per unit of product. The initial processing time and revenue per unit for each product are given in the following Table.\n\n| Product | Initial Processing Time | Revenue per Unit |\n|---------|-------------------------|------------------|\n| ProductA | 5 hours                 | $100             |\n| ProductB | 6 hours                 | $120             |\n| ProductC | 7 hours                 | $150             |\n\nThe processing time per unit of each product decreases by 1 hour for every $5,000 invested in enhancing the machine's efficiency for that product. The company aims to maximize the total revenue from all products, considering the reduced processing time due to efficiency enhancements. The total processing hours available on the machine for all products cannot exceed 1000 hours. The total investment in machine efficiency enhancements cannot exceed $30,000. Due to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units. The company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements.\n\nPlease help the company to determine the optimal production quantity, processing hours, and investment in machine efficiency to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=70)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)    # production quantity of ProductC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)      # processing hours per unit of ProductA\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)      # processing hours per unit of ProductB\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)      # processing hours per unit of ProductC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in machine efficiency for ProductA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in machine efficiency for ProductB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in machine efficiency for ProductC\n\n# Define objective function\nRevenueA = (100 - 5 + 0.0002 * EfficiencyA) * QuantityA\nRevenueB = (120 - 6 + 0.0002 * EfficiencyB) * QuantityB\nRevenueC = (150 - 7 + 0.0002 * EfficiencyC) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The total processing hours available on the machine for all products cannot exceed 1000 hours.\nmodel.addCons((5 - 0.0002 * EfficiencyA) * QuantityA + (6 - 0.0002 * EfficiencyB) * QuantityB + (7 - 0.0002 * EfficiencyC) * QuantityC <= 1000)\n# The total investment in machine efficiency enhancements cannot exceed $30,000.\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 30000)\n# Due to market demand, the production quantity of ProductA must be at least 50 units, and ProductB must be at least 70 units.\nmodel.addCons(QuantityA >= 50)\nmodel.addCons(QuantityB >= 70)\n# The company must ensure that the processing hours per unit for each product do not fall below 3 hours after efficiency enhancements.\nmodel.addCons(5 - 0.0002 * EfficiencyA >= 3)\nmodel.addCons(6 - 0.0002 * EfficiencyB >= 3)\nmodel.addCons(7 - 0.0002 * EfficiencyC >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(EfficiencyC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1646,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate.\n// {\"number of trips for RouteX\": \"TripsX\", \"range\": \"TripsX >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteY\": \"TripsY\", \"range\": \"TripsY >= 0\", \"type\": \"integer\"}\n// {\"number of trips for RouteZ\": \"TripsZ\", \"range\": \"TripsZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for RouteX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for RouteZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases nonlinearly with the investment in fuel-efficient technology for each route. The initial fuel consumption rate for RouteX is 50 liters per trip, but with technology, it decreases by 0.5 liters per trip for every $100 invested. The initial rate for RouteY is 60 liters per trip, decreasing by 0.6 liters per trip for every $100 invested. The initial rate for RouteZ is 70 liters per trip, decreasing by 0.7 liters per trip for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for RouteX: ConsumptionX = 50 - 0.005 * TechX * TripsX\n// Fuel consumption for RouteY: ConsumptionY = 60 - 0.006 * TechY * TripsY\n// Fuel consumption for RouteZ: ConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n// So, the objective function is: Minimize (ConsumptionX + ConsumptionY + ConsumptionZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for operations and technology investments.\n// 50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all routes must not exceed 2,000.\n// TripsX + TripsY + TripsZ <= 2,000",
        "question": "A logistics company operates a fleet of trucks and aims to optimize its fuel consumption and delivery routes. The company needs to determine the number of trips each truck should make for three different routes: RouteX, RouteY, and RouteZ. Additionally, the company is considering investing in fuel-efficient technologies for each route, which will affect the fuel consumption rate. The initial fuel consumption rate and the reduction in fuel consumption per trip for every $100 invested in technology for each route are given in the following Table.\n\n| Route | Initial Fuel Consumption Rate | Reduction in Fuel Consumption per $100 Investment |\n|-------|-------------------------------|--------------------------------------------------|\n| RouteX | 50 liters per trip           | 0.5 liters per trip                              |\n| RouteY | 60 liters per trip           | 0.6 liters per trip                              |\n| RouteZ | 70 liters per trip           | 0.7 liters per trip                              |\n\nThe company has a total budget of $100,000 for operations and technology investments. The total number of trips across all routes must not exceed 2,000. Please help the company to minimize the total fuel consumption across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsX = model.addVar(vtype=\"INTEGER\", name=\"TripsX\", lb=0)  # number of trips for RouteX\nTripsY = model.addVar(vtype=\"INTEGER\", name=\"TripsY\", lb=0)  # number of trips for RouteY\nTripsZ = model.addVar(vtype=\"INTEGER\", name=\"TripsZ\", lb=0)  # number of trips for RouteZ\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in fuel-efficient technology for RouteX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in fuel-efficient technology for RouteY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for RouteZ\n\n# Define objective function\nConsumptionX = 50 - 0.005 * TechX * TripsX\nConsumptionY = 60 - 0.006 * TechY * TripsY\nConsumptionZ = 70 - 0.007 * TechZ * TripsZ\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == ConsumptionX + ConsumptionY + ConsumptionZ)\n\n# Add constraints\nmodel.addCons(50 * TripsX + 60 * TripsY + 70 * TripsZ + TechX + TechY + TechZ <= 100000)\nmodel.addCons(TripsX + TripsY + TripsZ <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for RouteX: \", model.getVal(TripsX))\n    print(\"Number of Trips for RouteY: \", model.getVal(TripsY))\n    print(\"Number of Trips for RouteZ: \", model.getVal(TripsZ))\n    print(\"Investment in Tech for RouteX: \", model.getVal(TechX))\n    print(\"Investment in Tech for RouteY: \", model.getVal(TechY))\n    print(\"Investment in Tech for RouteZ: \", model.getVal(TechZ))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each truck. The fuel consumption rate is affected by the investment in fuel-efficient technologies for each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases with the investment in fuel-efficient technologies. The initial fuel consumption rate for each truck is 50 liters per 100 km, but with technology investment, the rate decreases by 1 liter per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = 50 - 0.01 * Tech1\n// Fuel consumption for Route2: Consumption2 = 50 - 0.01 * Tech2\n// Fuel consumption for Route3: Consumption3 = 50 - 0.01 * Tech3\n// Total fuel consumption: TotalConsumption = Consumption1 * Trucks1 + Consumption2 * Trucks2 + Consumption3 * Trucks3\n// So, the objective function is: Minimize TotalConsumption\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each truck. The fuel consumption rate is affected by the investment in fuel-efficient technologies for each truck. The initial fuel consumption rate for each truck is 50 liters per 100 km, but with technology investment, the rate decreases by 1 liter per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $100,000 for truck allocation and technology investments.\n\nPlease help the company to determine the optimal number of trucks and the appropriate investment in fuel-efficient technologies for each route to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks for Route3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technologies for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technologies for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technologies for Route3\n\n# Define objective function\nConsumption1 = 50 - 0.01 * Tech1\nConsumption2 = 50 - 0.01 * Tech2\nConsumption3 = 50 - 0.01 * Tech3\nTotalConsumption = Consumption1 * Trucks1 + Consumption2 * Trucks2 + Consumption3 * Trucks3\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalConsumption)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Buses\": \"Buses\", \"range\": \"Buses >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"Sedans\", \"range\": \"Sedans >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of vehicle varies, as does the revenue generated per vehicle. The cost of Trucks is $100,000 with a maintenance cost of $10,000 per year, and they generate $50,000 per year. Vans cost $50,000 with a maintenance cost of $5,000 per year, and they generate $30,000 per year. Buses cost $80,000 with a maintenance cost of $8,000 per year, and they generate $40,000 per year. Sedans cost $30,000 with a maintenance cost of $3,000 per year, and they generate $20,000 per year. Motorcycles cost $10,000 with a maintenance cost of $1,000 per year, and they generate $10,000 per year. The company wants to maximize the net profit per vehicle.\n// Total net profit for Trucks: Profit_Trucks = 50,000 * Trucks - (100,000 * Trucks + 10,000 * Trucks)\n// Total net profit for Vans: Profit_Vans = 30,000 * Vans - (50,000 * Vans + 5,000 * Vans)\n// Total net profit for Buses: Profit_Buses = 40,000 * Buses - (80,000 * Buses + 8,000 * Buses)\n// Total net profit for Sedans: Profit_Sedans = 20,000 * Sedans - (30,000 * Sedans + 3,000 * Sedans)\n// Total net profit for Motorcycles: Profit_Motorcycles = 10,000 * Motorcycles - (10,000 * Motorcycles + 1,000 * Motorcycles)\n// So, the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / (Trucks + Vans + Buses + Sedans + Motorcycles))\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing vehicles.\n// 100,000 * Trucks + 50,000 * Vans + 80,000 * Buses + 30,000 * Sedans + 10,000 * Motorcycles <= 5,000,000\n\n## Generate Constraint-2:\nThe annual maintenance budget is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 8,000 * Buses + 3,000 * Sedans + 1,000 * Motorcycles <= 500,000",
        "question": "A logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation. The cost of purchasing and maintaining each type of vehicle, as well as the revenue generated per vehicle, are given in the following Table.\n\n| Vehicle Type | Purchase Cost | Maintenance Cost per Year | Annual Revenue |\n|--------------|---------------|---------------------------|----------------|\n| Trucks       | $100,000      | $10,000                   | $50,000        |\n| Vans         | $50,000       | $5,000                    | $30,000        |\n| Buses        | $80,000       | $8,000                    | $40,000        |\n| Sedans       | $30,000       | $3,000                    | $20,000        |\n| Motorcycles  | $10,000       | $1,000                    | $10,000        |\n\nThe company has a budget of $5,000,000 for purchasing vehicles and an annual maintenance budget of $500,000. Please help the company to maximize the net profit per vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBuses = model.addVar(vtype=\"INTEGER\", name=\"Buses\", lb=0)  # number of Buses\nSedans = model.addVar(vtype=\"INTEGER\", name=\"Sedans\", lb=0)  # number of Sedans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of Motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Trucks = 50000 * Trucks - (100000 * Trucks + 10000 * Trucks)\nProfit_Vans = 30000 * Vans - (50000 * Vans + 5000 * Vans)\nProfit_Buses = 40000 * Buses - (80000 * Buses + 8000 * Buses)\nProfit_Sedans = 20000 * Sedans - (30000 * Sedans + 3000 * Sedans)\nProfit_Motorcycles = 10000 * Motorcycles - (10000 * Motorcycles + 1000 * Motorcycles)\nTotal_Vehicles = Trucks + Vans + Buses + Sedans + Motorcycles\n## the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / Total_Vehicles)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Vehicles == Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing vehicles.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 80000 * Buses + 30000 * Sedans + 10000 * Motorcycles <= 5000000)\n## The annual maintenance budget is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 8000 * Buses + 3000 * Sedans + 1000 * Motorcycles <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Buses: \", model.getVal(Buses))\n    print(\"Number of Sedans: \", model.getVal(Sedans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Maximized Net Profit per Vehicle: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city to maximize profit. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck, which affects the fuel cost per trip.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for each truck\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The company aims to maximize the total profit from all trips.\n// Total profit for City1: Profit1 = (1000 - 0.05 * TechInvestment) * Trips1\n// Total profit for City2: Profit2 = (1200 - 0.05 * TechInvestment) * Trips2\n// Total profit for City3: Profit3 = (1500 - 0.05 * TechInvestment) * Trips3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and technology investments.\n// 0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000\n\n## Generate Constraint-2:\nThe company's fleet can make a maximum of 500 trips in total.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2.\n// Trips1 >= 100; Trips2 >= 150",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: City1, City2, and City3. The company needs to determine the number of trips each truck should make to each city and the investment in fuel-efficient technologies for each truck to maximize profit. The profit per trip varies by city and is affected by the investment in fuel-efficient technologies. The profit per trip to City1 is $1000, to City2 is $1200, and to City3 is $1500. For every $1000 invested in fuel-efficient technology, the fuel cost per trip decreases by $50. The following table summarizes the profit per trip and the impact of technology investment on fuel cost.\n\n| City       | Profit per Trip | Impact of Tech Investment on Fuel Cost |\n|------------|-----------------|---------------------------------------|\n| City1      | $1000           | $50 decrease per $1000 invested       |\n| City2      | $1200           | $50 decrease per $1000 invested       |\n| City3      | $1500           | $50 decrease per $1000 invested       |\n\nThe company has a total budget of $50,000 for fuel and technology investments. The company's fleet can make a maximum of 500 trips in total. Due to contractual agreements, the company must make at least 100 trips to City1 and 150 trips to City2.\n\nPlease help the company to maximize the total profit from all trips by determining the optimal number of trips to each city and the appropriate investment in fuel-efficient technologies.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=150) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in fuel-efficient technology\n\n# Define objective function\nProfit1 = (1000 - 0.05 * TechInvestment) * Trips1\nProfit2 = (1200 - 0.05 * TechInvestment) * Trips2\nProfit3 = (1500 - 0.05 * TechInvestment) * Trips3\n# So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n# The company has a total budget of $50,000 for fuel and technology investments.\nmodel.addCons(0.05 * TechInvestment * (Trips1 + Trips2 + Trips3) + TechInvestment <= 50000)\n# The company's fleet can make a maximum of 500 trips in total.\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Investment in Fuel-Efficient Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1477,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"labor hours for ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials).\n// RevenueA = 100 * ProductA\n// RevenueB = 150 * ProductB\n// RevenueC = 200 * ProductC\n// LaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\n// LaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\n// LaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\n// RawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n// So, the objective function is: Maximize (RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available.\n// LaborA + LaborB + LaborC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor hours and raw materials) allocated to each product. Additionally, the company is considering investing in automation technology to reduce labor hours required for production. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor cost per hour is $20, and the raw material cost per unit is $30 for all products. Investing $10,000 in automation for a product reduces the labor hours required by 10%. The company aims to maximize its net profit, which is the total revenue minus the total costs (labor and raw materials). The company has a total of 1000 labor hours available. Please help the company to determine the optimal production quantities and investments in automation to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)\n\n# Define objective function\nRevenueA = 100 * ProductA\nRevenueB = 150 * ProductB\nRevenueC = 200 * ProductC\nLaborCostA = (20 * LaborA) - (0.002 * AutomationA * 20 * LaborA)\nLaborCostB = (20 * LaborB) - (0.002 * AutomationB * 20 * LaborB)\nLaborCostC = (20 * LaborC) - (0.002 * AutomationC * 20 * LaborC)\nRawMaterialCost = 30 * (ProductA + ProductB + ProductC)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - LaborCostA - RawMaterialCost + RevenueB - LaborCostB - RawMaterialCost + RevenueC - LaborCostC - RawMaterialCost)\n\n# Add constraints\nmodel.addCons(LaborA + LaborB + LaborC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Labor hours for ProductA: \", model.getVal(LaborA))\n    print(\"Labor hours for ProductB: \", model.getVal(LaborB))\n    print(\"Labor hours for ProductC: \", model.getVal(LaborC))\n    print(\"Investment in automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each truck on Route A is 50 liters per trip, on Route B is 60 liters per trip, on Route C is 70 liters per trip, and on Route D is 80 liters per trip. The operational cost per truck on Route A is $100 per trip, on Route B is $120 per trip, on Route C is $140 per trip, and on Route D is $160 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Fuel_Cost_A = 50 * Trucks_A\n// Fuel_Cost_B = 60 * Trucks_B\n// Fuel_Cost_C = 70 * Trucks_C\n// Fuel_Cost_D = 80 * Trucks_D\n// Operational_Cost_A = 100 * Trucks_A\n// Operational_Cost_B = 120 * Trucks_B\n// Operational_Cost_C = 140 * Trucks_C\n// Operational_Cost_D = 160 * Trucks_D\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for operational costs per day.\n// 100 * Trucks_A + 120 * Trucks_B + 140 * Trucks_C + 160 * Trucks_D <= 5000\n\n## Generate Constraint-3:\nThe company has a daily fuel budget of 3000 liters.\n// 50 * Trucks_A + 60 * Trucks_B + 70 * Trucks_C + 80 * Trucks_D <= 3000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the total trucks are allocated to Route A.\n// Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D)",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the routes and the number of trucks assigned to each route to minimize fuel consumption and operational costs. The company has identified four major routes (Route A, Route B, Route C, and Route D) and needs to determine the number of trucks to allocate to each route.\nThe fuel consumption for each truck on Route A is 50 liters per trip, on Route B is 60 liters per trip, on Route C is 70 liters per trip, and on Route D is 80 liters per trip. The operational cost per truck on Route A is $100 per trip, on Route B is $120 per trip, on Route C is $140 per trip, and on Route D is $160 per trip. The company aims to minimize the total fuel consumption and operational costs.\nThe company has a total of 50 trucks available. The company has a budget of $5000 for operational costs per day. The company has a daily fuel budget of 3000 liters. The company wants to ensure that at least 10% of the total trucks are allocated to Route A.\nPlease help the company to determine the optimal number of trucks to allocate to each route to minimize the total fuel consumption and operational costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Route D\n\n# Define objective function\nFuel_Cost_A = 50 * Trucks_A\nFuel_Cost_B = 60 * Trucks_B\nFuel_Cost_C = 70 * Trucks_C\nFuel_Cost_D = 80 * Trucks_D\nOperational_Cost_A = 100 * Trucks_A\nOperational_Cost_B = 120 * Trucks_B\nOperational_Cost_C = 140 * Trucks_C\nOperational_Cost_D = 160 * Trucks_D\n# So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Operational_Cost_A + Operational_Cost_B + Operational_Cost_C + Operational_Cost_D)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D <= 50)\n# The company has a budget of $5000 for operational costs per day.\nmodel.addCons(100 * Trucks_A + 120 * Trucks_B + 140 * Trucks_C + 160 * Trucks_D <= 5000)\n# The company has a daily fuel budget of 3000 liters.\nmodel.addCons(50 * Trucks_A + 60 * Trucks_B + 70 * Trucks_C + 80 * Trucks_D <= 3000)\n# The company wants to ensure that at least 10% of the total trucks are allocated to Route A.\nmodel.addCons(Trucks_A >= 0.1 * (Trucks_A + Trucks_B + Trucks_C + Trucks_D))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Route D: \", model.getVal(Trucks_D))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Route1\": \"FuelOpt1\", \"range\": \"FuelOpt1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Route2\": \"FuelOpt2\", \"range\": \"FuelOpt2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Route2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\n// Fuel consumption for Route2: Consumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for fuel optimization and technology investments.\n// FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods between different cities. The company needs to decide the number of trucks to allocate to each route and the amount of fuel to optimize for each truck to minimize fuel consumption and operational costs. The company also needs to determine the investment in new fuel-efficient technologies for each route to further reduce fuel consumption.\nThe fuel consumption of each truck is affected by the fuel optimization strategy and the investment in fuel-efficient technologies. The fuel consumption per truck decreases nonlinearly with the increase in fuel optimization and technology investment. The company aims to minimize the total fuel consumption across all routes.\nThe company has a total budget of $100,000 for fuel optimization and technology investments. The total number of trucks available for allocation is limited to 500.\nPlease help the company to minimize the total fuel consumption across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nFuelOpt1 = model.addVar(name=\"FuelOpt1\", lb=0)  # fuel optimization for Route1\nFuelOpt2 = model.addVar(name=\"FuelOpt2\", lb=0)  # fuel optimization for Route2\nTechInvest1 = model.addVar(name=\"TechInvest1\", lb=0)  # investment in fuel-efficient technology for Route1\nTechInvest2 = model.addVar(name=\"TechInvest2\", lb=0)  # investment in fuel-efficient technology for Route2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nConsumption1 = (100 - 0.1 * FuelOpt1 - 0.05 * TechInvest1) * Trucks1\nConsumption2 = (120 - 0.12 * FuelOpt2 - 0.06 * TechInvest2) * Trucks2\n## the objective function is: Minimize (Consumption1 + Consumption2)\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\n## The company has a total budget of $100,000 for fuel optimization and technology investments.\nmodel.addCons(FuelOpt1 + FuelOpt2 + TechInvest1 + TechInvest2 <= 100000)\n## The total number of trucks available for allocation is limited to 500.\nmodel.addCons(Trucks1 + Trucks2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Fuel Optimization for Route1: \", model.getVal(FuelOpt1))\n    print(\"Fuel Optimization for Route2: \", model.getVal(FuelOpt2))\n    print(\"Technology Investment for Route1: \", model.getVal(TechInvest1))\n    print(\"Technology Investment for Route2: \", model.getVal(TechInvest2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 5 different trucks to minimize fuel consumption and travel time. The trucks need to deliver goods to various locations and return to the depot.\n// {\"fuel consumption of truck 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled and the load carried. The function is F = k * d^2 * l, where k is a constant, d is the distance, and l is the load. The company wants to minimize the total fuel consumption of all trucks.\n// Fuel_F1 = k1 * (D1^2) * L1\n// Fuel_F2 = k2 * (D2^2) * L2\n// Fuel_F3 = k3 * (D3^2) * L3\n// Fuel_F4 = k4 * (D4^2) * L4\n// Fuel_F5 = k5 * (D5^2) * L5\n// So, the objective function is: Minimize (Fuel_F1 + Fuel_F2 + Fuel_F3 + Fuel_F4 + Fuel_F5)\n\n## Generate Constraint-1:\nEach truck has a maximum load capacity of 10 tons.\n// L1 <= 10; L2 <= 10; L3 <= 10; L4 <= 10; L5 <= 10",
        "question": "A logistics company operates a fleet of 5 trucks and needs to optimize the routes for these trucks to minimize fuel consumption and travel time. The trucks need to deliver goods to various locations and return to the depot. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled and the load carried, where F = k * d^2 * l, with k being a constant, d the distance, and l the load.\n\nThe company wants to minimize the total fuel consumption of all trucks. Each truck has a maximum load capacity of 10 tons.\n\nPlease help the company determine the optimal fuel consumption for each truck to minimize the total fuel consumption while adhering to the load capacity constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define fuel consumption and load for each truck\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0)  # Fuel consumption of truck 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0)  # Fuel consumption of truck 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0)  # Fuel consumption of truck 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0)  # Fuel consumption of truck 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0)  # Fuel consumption of truck 5\n\n# Define objective function\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define fuel consumption functions\nFuel_F1 = F1\nFuel_F2 = F2\nFuel_F3 = F3\nFuel_F4 = F4\nFuel_F5 = F5\n\n## The objective function is: Minimize (Fuel_F1 + Fuel_F2 + Fuel_F3 + Fuel_F4 + Fuel_F5)\nmodel.addCons(obj == Fuel_F1 + Fuel_F2 + Fuel_F3 + Fuel_F4 + Fuel_F5)\n\n# Add constraints\n## Each truck has a maximum load capacity of 10 tons.\nmodel.addCons(F1 <= 10)\nmodel.addCons(F2 <= 10)\nmodel.addCons(F3 <= 10)\nmodel.addCons(F4 <= 10)\nmodel.addCons(F5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of truck 1: \", model.getVal(F1))\n    print(\"Fuel consumption of truck 2: \", model.getVal(F2))\n    print(\"Fuel consumption of truck 3: \", model.getVal(F3))\n    print(\"Fuel consumption of truck 4: \", model.getVal(F4))\n    print(\"Fuel consumption of truck 5: \", model.getVal(F5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 710,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. Route 1 has a cost per truck of $1000 and generates a revenue of $1500 per truck. Route 2 has a cost per truck of $1200 and generates a revenue of $1800 per truck. Route 3 has a cost per truck of $1100 and generates a revenue of $1600 per truck. Route 4 has a cost per truck of $1300 and generates a revenue of $1900 per truck. Route 5 has a cost per truck of $1400 and generates a revenue of $2000 per truck. The company wants to maximize the total net profit from all routes, where net profit is the revenue minus the cost.\n// Net_Profit_Route1 = (1500 - 1000) * T1\n// Net_Profit_Route2 = (1800 - 1200) * T2\n// Net_Profit_Route3 = (1600 - 1100) * T3\n// Net_Profit_Route4 = (1900 - 1300) * T4\n// Net_Profit_Route5 = (2000 - 1400) * T5\n// So, the objective function is: Maximize Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 15; T5 <= 10\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all trucks must not exceed a certain limit. Each truck on Route 1 emits 5 units of pollution, Route 2 emits 6 units, Route 3 emits 7 units, Route 4 emits 8 units, and Route 5 emits 9 units. The total emissions must not exceed 500 units.\n// 5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500",
        "question": "A logistics company operates five different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck and revenue per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| 1     | $1000          | $1500             |\n| 2     | $1200          | $1800             |\n| 3     | $1100          | $1600             |\n| 4     | $1300          | $1900             |\n| 5     | $1400          | $2000             |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks: Route 1 can handle up to 20 trucks, Route 2 up to 25 trucks, Route 3 up to 30 trucks, Route 4 up to 15 trucks, and Route 5 up to 10 trucks. Due to environmental regulations, the total emissions from all trucks must not exceed 500 units, where each truck on Route 1 emits 5 units of pollution, Route 2 emits 6 units, Route 3 emits 7 units, Route 4 emits 8 units, and Route 5 emits 9 units.\n\nPlease help the company to maximize the total net profit from all routes, where net profit is the revenue minus the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_Route1 = (1500 - 1000) * T1\nNet_Profit_Route2 = (1800 - 1200) * T2\nNet_Profit_Route3 = (1600 - 1100) * T3\nNet_Profit_Route4 = (1900 - 1300) * T4\nNet_Profit_Route5 = (2000 - 1400) * T5\n## the objective function is: Maximize Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5\nmodel.addCons(obj == Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## Each route has a maximum capacity for trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 15)\nmodel.addCons(T5 <= 10)\n## Due to environmental regulations, the total emissions from all trucks must not exceed a certain limit.\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n// Total fuel cost per km: FuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) / (T1 + T2 + T3 + T4 + T5)\n// Total maintenance cost per km: MaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5) / (T1 + T2 + T3 + T4 + T5)\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 to purchase trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The fuel efficiency and maintenance cost per kilometer for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost ($/km) |\n|------------|-----------------------|-------------------------|\n| Type 1     | 10                    | 100                     |\n| Type 2     | 15                    | 80                      |\n| Type 3     | 20                    | 70                      |\n| Type 4     | 25                    | 60                      |\n| Type 5     | 30                    | 50                      |\n\nThe company has a budget of $500,000 to purchase trucks. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks. Please help the company to determine the optimal number of each type of truck to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5)\nMaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5)\nTotalTrucks = T1 + T2 + T3 + T4 + T5\n## the objective function is: Minimize (FuelCost + MaintCost) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $500,000 to purchase trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to deploy for the next quarter to optimize fuel efficiency and delivery capacity. Additionally, the company is considering investing in a new fuel additive that can improve fuel efficiency by a certain percentage based on the investment amount.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel additive\": \"FuelAdditive\", \"range\": \"FuelAdditive >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type is affected by the investment in the fuel additive. The fuel efficiency of TruckA increases by 0.5% for every $100 invested in the additive, TruckB by 0.7% for every $100, and TruckC by 0.6% for every $100. The fuel cost per kilometer for TruckA is $0.5, for TruckB is $0.7, and for TruckC is $0.6. The company aims to minimize the total fuel cost for all vehicles over the next quarter.\n// FuelCost_TruckA = 0.5 * (1 - 0.005 * FuelAdditive/100) * TruckA\n// FuelCost_TruckB = 0.7 * (1 - 0.007 * FuelAdditive/100) * TruckB\n// FuelCost_TruckC = 0.6 * (1 - 0.006 * FuelAdditive/100) * TruckC\n// So, the objective function is: Minimize (FuelCost_TruckA + FuelCost_TruckB + FuelCost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for vehicle deployment and fuel additive investment.\n// TruckA + TruckB + TruckC + FuelAdditive <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles deployed cannot exceed 500.\n// TruckA + TruckB + TruckC <= 500",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to deploy for the next quarter to optimize fuel efficiency and delivery capacity. Additionally, the company is considering investing in a new fuel additive that can improve fuel efficiency by a certain percentage based on the investment amount. The fuel efficiency of each vehicle type is affected by the investment in the fuel additive. The fuel efficiency of TruckA increases by 0.5% for every $100 invested in the additive, TruckB by 0.7% for every $100, and TruckC by 0.6% for every $100. The fuel cost per kilometer for TruckA is $0.5, for TruckB is $0.7, and for TruckC is $0.6. The company aims to minimize the total fuel cost for all vehicles over the next quarter.\n\n| Vehicle Type | Fuel Cost per Kilometer | Fuel Efficiency Improvement per $100 Investment |\n|--------------|-------------------------|-------------------------------------------------|\n| TruckA       | $0.5                    | 0.5%                                            |\n| TruckB       | $0.7                    | 0.7%                                            |\n| TruckC       | $0.6                    | 0.6%                                            |\n\nThe company has a total budget of $100,000 for vehicle deployment and fuel additive investment. The total number of vehicles deployed cannot exceed 500.\n\nPlease help the company to determine the optimal number of each type of vehicle to deploy and the amount to invest in the fuel additive to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nFuelAdditive = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelAdditive\", lb=0) # investment in fuel additive\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_TruckA = 0.5 * (1 - 0.005 * FuelAdditive/100) * TruckA\nFuelCost_TruckB = 0.7 * (1 - 0.007 * FuelAdditive/100) * TruckB\nFuelCost_TruckC = 0.6 * (1 - 0.006 * FuelAdditive/100) * TruckC\n## the objective function is: Minimize (FuelCost_TruckA + FuelCost_TruckB + FuelCost_TruckC)\nmodel.addCons(obj == FuelCost_TruckA + FuelCost_TruckB + FuelCost_TruckC)\n\n# Add constraints\n## The company has a total budget of $100,000 for vehicle deployment and fuel additive investment.\nmodel.addCons(TruckA + TruckB + TruckC + FuelAdditive <= 100000)\n## The total number of vehicles deployed cannot exceed 500.\nmodel.addCons(TruckA + TruckB + TruckC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Investment in Fuel Additive: \", model.getVal(FuelAdditive))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1611,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet deployment for the next quarter. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) and need to decide how many trucks to allocate to each route. Additionally, they need to determine the number of drivers to hire for each route.\n// {\"number of trucks for RouteA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteA\": \"DriverA\", \"range\": \"DriverA >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteB\": \"DriverB\", \"range\": \"DriverB >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteC\": \"DriverC\", \"range\": \"DriverC >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteD\": \"DriverD\", \"range\": \"DriverD >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for RouteE\": \"DriverE\", \"range\": \"DriverE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the estimated profit per truck is $5,000, the operational cost per driver is $3,000, and the maintenance cost per truck is $1,000.\nFor RouteB, the estimated profit per truck is $6,000, the operational cost per driver is $3,500, and the maintenance cost per truck is $1,200.\nFor RouteC, the estimated profit per truck is $7,000, the operational cost per driver is $4,000, and the maintenance cost per truck is $1,500.\nFor RouteD, the estimated profit per truck is $8,000, the operational cost per driver is $4,500, and the maintenance cost per truck is $1,800.\nFor RouteE, the estimated profit per truck is $9,000, the operational cost per driver is $5,000, and the maintenance cost per truck is $2,000.\nThe company wants to maximize the net profit per truck.\n// Total net profit for RouteA: Profit_RouteA = 5000 * TruckA - 3000 * DriverA - 1000 * TruckA\n// Total net profit for RouteB: Profit_RouteB = 6000 * TruckB - 3500 * DriverB - 1200 * TruckB\n// Total net profit for RouteC: Profit_RouteC = 7000 * TruckC - 4000 * DriverC - 1500 * TruckC\n// Total net profit for RouteD: Profit_RouteD = 8000 * TruckD - 4500 * DriverD - 1800 * TruckD\n// Total net profit for RouteE: Profit_RouteE = 9000 * TruckE - 5000 * DriverE - 2000 * TruckE\n// So, the objective function is: Maximize ((Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE) / (TruckA + TruckB + TruckC + TruckD + TruckE))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for the quarter.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $300,000 for driver salaries for the quarter.\n// 3000 * DriverA + 3500 * DriverB + 4000 * DriverC + 4500 * DriverD + 5000 * DriverE <= 300000\n\n## Generate Constraint-3:\nEach route must have at least one truck and one driver.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1\n// DriverA >= 1; DriverB >= 1; DriverC >= 1; DriverD >= 1; DriverE >= 1\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total trucks are allocated to any single route.\n// TruckA <= 0.4 * 100\n// TruckB <= 0.4 * 100\n// TruckC <= 0.4 * 100\n// TruckD <= 0.4 * 100\n// TruckE <= 0.4 * 100\n\n## Generate Constraint-5:\nDue to safety regulations, the number of drivers on each route must not exceed the number of trucks by more than 10%.\n// DriverA <= TruckA * 1.1\n// DriverB <= TruckB * 1.1\n// DriverC <= TruckC * 1.1\n// DriverD <= TruckD * 1.1\n// DriverE <= TruckE * 1.1",
        "question": "A logistics company is planning its fleet deployment for the next quarter. They have identified five major routes (RouteA, RouteB, RouteC, RouteD, and RouteE) and need to decide how many trucks to allocate to each route and how many drivers to hire for each route.\nFor RouteA, the estimated profit per truck is $5,000, the operational cost per driver is $3,000, and the maintenance cost per truck is $1,000.\nFor RouteB, the estimated profit per truck is $6,000, the operational cost per driver is $3,500, and the maintenance cost per truck is $1,200.\nFor RouteC, the estimated profit per truck is $7,000, the operational cost per driver is $4,000, and the maintenance cost per truck is $1,500.\nFor RouteD, the estimated profit per truck is $8,000, the operational cost per driver is $4,500, and the maintenance cost per truck is $1,800.\nFor RouteE, the estimated profit per truck is $9,000, the operational cost per driver is $5,000, and the maintenance cost per truck is $2,000.\nThe company has a total of 100 trucks available for the quarter and a budget of $300,000 for driver salaries for the quarter. Each route must have at least one truck and one driver. The company wants to ensure that no more than 40% of the total trucks are allocated to any single route and that the number of drivers on each route must not exceed the number of trucks by more than 10%.\nPlease help the company to maximize the net profit per truck.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of trucks for RouteA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of trucks for RouteB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of trucks for RouteC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of trucks for RouteD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of trucks for RouteE\nDriverA = model.addVar(vtype=\"INTEGER\", name=\"DriverA\", lb=1)  # number of drivers for RouteA\nDriverB = model.addVar(vtype=\"INTEGER\", name=\"DriverB\", lb=1)  # number of drivers for RouteB\nDriverC = model.addVar(vtype=\"INTEGER\", name=\"DriverC\", lb=1)  # number of drivers for RouteC\nDriverD = model.addVar(vtype=\"INTEGER\", name=\"DriverD\", lb=1)  # number of drivers for RouteD\nDriverE = model.addVar(vtype=\"INTEGER\", name=\"DriverE\", lb=1)  # number of drivers for RouteE\n\n# Define objective function\nProfit_RouteA = 5000 * TruckA - 3000 * DriverA - 1000 * TruckA\nProfit_RouteB = 6000 * TruckB - 3500 * DriverB - 1200 * TruckB\nProfit_RouteC = 7000 * TruckC - 4000 * DriverC - 1500 * TruckC\nProfit_RouteD = 8000 * TruckD - 4500 * DriverD - 1800 * TruckD\nProfit_RouteE = 9000 * TruckE - 5000 * DriverE - 2000 * TruckE\nTotalTrucks = TruckA + TruckB + TruckC + TruckD + TruckE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize ((Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE) / TotalTrucks)\n# convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_RouteA + Profit_RouteB + Profit_RouteC + Profit_RouteD + Profit_RouteE)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)  # total trucks constraint\nmodel.addCons(3000 * DriverA + 3500 * DriverB + 4000 * DriverC + 4500 * DriverD + 5000 * DriverE <= 300000)  # driver salary budget constraint\nmodel.addCons(TruckA <= 0.4 * 100)  # route allocation constraint for RouteA\nmodel.addCons(TruckB <= 0.4 * 100)  # route allocation constraint for RouteB\nmodel.addCons(TruckC <= 0.4 * 100)  # route allocation constraint for RouteC\nmodel.addCons(TruckD <= 0.4 * 100)  # route allocation constraint for RouteD\nmodel.addCons(TruckE <= 0.4 * 100)  # route allocation constraint for RouteE\nmodel.addCons(DriverA <= TruckA * 1.1)  # safety regulation constraint for RouteA\nmodel.addCons(DriverB <= TruckB * 1.1)  # safety regulation constraint for RouteB\nmodel.addCons(DriverC <= TruckC * 1.1)  # safety regulation constraint for RouteC\nmodel.addCons(DriverD <= TruckD * 1.1)  # safety regulation constraint for RouteD\nmodel.addCons(DriverE <= TruckE * 1.1)  # safety regulation constraint for RouteE\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TruckA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TruckB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TruckC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TruckD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TruckE))\n    print(\"Number of Drivers for RouteA: \", model.getVal(DriverA))\n    print(\"Number of Drivers for RouteB: \", model.getVal(DriverB))\n    print(\"Number of Drivers for RouteC: \", model.getVal(DriverC))\n    print(\"Number of Drivers for RouteD: \", model.getVal(DriverD))\n    print(\"Number of Drivers for RouteE: \", model.getVal(DriverE))\n    print(\"Maximized Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1427,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50, ProductionCostA is $30.\nThe profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70, ProductionCostB is $40.\nThe profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60, ProductionCostC is $35.\nThe company wants to maximize the total profit from all products.\n// Objective function: Maximize (ProfitA + ProfitB + ProfitC) = ((50 - 30) * QuantityA - 0.01 * QuantityA^2) + ((70 - 40) * QuantityB - 0.02 * QuantityB^2) + ((60 - 35) * QuantityC - 0.015 * QuantityC^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the demand for ProductA is at least twice the demand for ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $30,000. The cost of raw materials for ProductA is $10 per unit, for ProductB is $15 per unit, and for ProductC is $12 per unit.\n// 10 * QuantityA + 15 * QuantityB + 12 * QuantityC <= 30,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50 and ProductionCostA is $30. The profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70 and ProductionCostB is $40. The profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60 and ProductionCostC is $35. The company wants to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units. Due to market research, the demand for ProductA is at least twice the demand for ProductB. The company has a budget constraint for raw materials, which is $30,000. The cost of raw materials for ProductA is $10 per unit, for ProductB is $15 per unit, and for ProductC is $12 per unit. Please help the company determine the optimal production quantities for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit for each product\nProfitA = (50 - 30) * QuantityA - 0.01 * QuantityA**2\nProfitB = (70 - 40) * QuantityB - 0.02 * QuantityB**2\nProfitC = (60 - 35) * QuantityC - 0.015 * QuantityC**2\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n## Due to market research, the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n## The company has a budget constraint for raw materials, which is $30,000.\nmodel.addCons(10 * QuantityA + 15 * QuantityB + 12 * QuantityC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company also needs to consider the maintenance cost per kilometer for each truck type.\n// {\"number of trucks for Region 1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region 2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency for trucks in Region 1\": \"FuelEfficiency1\", \"range\": \"FuelEfficiency1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency for trucks in Region 2\": \"FuelEfficiency2\", \"range\": \"FuelEfficiency2 > 0\", \"type\": \"real\"}\n// {\"maintenance cost per km for trucks in Region 1\": \"MaintenanceCost1\", \"range\": \"MaintenanceCost1 >= 0\", \"type\": \"real\"}\n// {\"maintenance cost per km for trucks in Region 2\": \"MaintenanceCost2\", \"range\": \"MaintenanceCost2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The cost of fuel per liter is $1.5, and each truck travels an average of 500 km per day.\n// FuelCostRegion1 = 500 * TrucksRegion1 * (1.5 / FuelEfficiency1)\n// FuelCostRegion2 = 500 * TrucksRegion2 * (1.5 / FuelEfficiency2)\n// MaintenanceCostRegion1 = 500 * TrucksRegion1 * MaintenanceCost1\n// MaintenanceCostRegion2 = 500 * TrucksRegion2 * MaintenanceCost2\n// So, the objective function is: Minimize (FuelCostRegion1 + FuelCostRegion2 + MaintenanceCostRegion1 + MaintenanceCostRegion2)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for truck maintenance per day.\n// MaintenanceCostRegion1 + MaintenanceCostRegion2 <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company also needs to consider the maintenance cost per kilometer for each truck type. The company aims to minimize the total operational cost, which includes fuel costs and maintenance costs. The cost of fuel per liter is $1.5, and each truck travels an average of 500 km per day. The company has a total budget of $10,000 for truck maintenance per day.\n\nPlease help the company to determine the optimal number of trucks and their fuel efficiencies and maintenance costs to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=0)  # number of trucks for Region 1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0)  # number of trucks for Region 2\nFuelEfficiency1 = model.addVar(name=\"FuelEfficiency1\", lb=0.001)  # fuel efficiency for trucks in Region 1\nFuelEfficiency2 = model.addVar(name=\"FuelEfficiency2\", lb=0.001)  # fuel efficiency for trucks in Region 2\nMaintenanceCost1 = model.addVar(name=\"MaintenanceCost1\", lb=0)  # maintenance cost per km for trucks in Region 1\nMaintenanceCost2 = model.addVar(name=\"MaintenanceCost2\", lb=0)  # maintenance cost per km for trucks in Region 2\n\n# Define objective function\nFuelCostRegion1 = 500 * TrucksRegion1 * (1.5 / FuelEfficiency1)\nFuelCostRegion2 = 500 * TrucksRegion2 * (1.5 / FuelEfficiency2)\nMaintenanceCostRegion1 = 500 * TrucksRegion1 * MaintenanceCost1\nMaintenanceCostRegion2 = 500 * TrucksRegion2 * MaintenanceCost2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostRegion1 + FuelCostRegion2 + MaintenanceCostRegion1 + MaintenanceCostRegion2)\n\n# Add constraints\nmodel.addCons(MaintenanceCostRegion1 + MaintenanceCostRegion2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region 1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region 2: \", model.getVal(TrucksRegion2))\n    print(\"Fuel Efficiency for Region 1: \", model.getVal(FuelEfficiency1))\n    print(\"Fuel Efficiency for Region 2: \", model.getVal(FuelEfficiency2))\n    print(\"Maintenance Cost per km for Region 1: \", model.getVal(MaintenanceCost1))\n    print(\"Maintenance Cost per km for Region 2: \", model.getVal(MaintenanceCost2))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product line. The advanced machinery reduces the production time per unit and thus increases the production capacity.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in advanced machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in advanced machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The advanced machinery reduces the production time per unit by 10 minutes for every $10,000 invested. The initial production time per unit for ProductA is 60 minutes, for ProductB is 50 minutes, and for ProductC is 40 minutes. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = 50 * ProductAQty - (60 - 0.01 * MachineryA) * WorkersA\n// Total profit for ProductB: ProfitB = 70 * ProductBQty - (50 - 0.01 * MachineryB) * WorkersB\n// Total profit for ProductC: ProfitC = 90 * ProductCQty - (40 - 0.01 * MachineryC) * WorkersC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $100,000.\n// MachineryA + MachineryB + MachineryC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product, and the amount of capital investment in advanced machinery for each product line. The advanced machinery reduces the production time per unit and thus increases the production capacity. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The advanced machinery reduces the production time per unit by 10 minutes for every $10,000 invested. The initial production time per unit for ProductA is 60 minutes, for ProductB is 50 minutes, and for ProductC is 40 minutes. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Initial Production Time per Unit |\n|---------|-----------------|----------------------------------|\n| ProductA | $50             | 60 minutes                       |\n| ProductB | $70             | 50 minutes                       |\n| ProductC | $90             | 40 minutes                       |\n\nThe company has a total of 100 workers available. The total capital investment in advanced machinery cannot exceed $100,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in advanced machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in advanced machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in advanced machinery for ProductC\n\n# Define objective function\nProfitA = 50 * ProductAQty - (60 - 0.01 * MachineryA) * WorkersA\nProfitB = 70 * ProductBQty - (50 - 0.01 * MachineryB) * WorkersB\nProfitC = 90 * ProductCQty - (40 - 0.01 * MachineryC) * WorkersC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1292,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: A, B, C, and D. The company needs to determine the optimal production quantities for each component to maximize its profit while considering various constraints.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for component A is $30, for B is $40, for C is $50, and for D is $60. The production cost per unit for A is $10, for B is $20, for C is $30, and for D is $40. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Profit per unit of A: Profit_A = (30 - 10) * A = 20 * A\n// Profit per unit of B: Profit_B = (40 - 20) * B = 20 * B\n// Profit per unit of C: Profit_C = (50 - 30) * C = 20 * C\n// Profit per unit of D: Profit_D = (60 - 40) * D = 20 * D\n// Objective function: Maximize (20 * A + 20 * B + 20 * C + 20 * D)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C + 40 * D <= 5000",
        "question": "A manufacturing company produces four types of electronic components: A, B, C, and D. The company needs to determine the optimal production quantities for each component to maximize its profit while considering various constraints. The profit per unit and production cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit |\n|-----------|-----------------|--------------------------|\n| A         | $30             | $10                      |\n| B         | $40             | $20                      |\n| C         | $50             | $30                      |\n| D         | $60             | $40                      |\n\nThe company has a budget of $5000 for production costs. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost. Please help the company determine the optimal production quantities for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of component D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Objective function: Maximize (20 * A + 20 * B + 20 * C + 20 * D)\nmodel.addCons(obj == 20 * A + 20 * B + 20 * C + 20 * D)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C + 40 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed1\", \"range\": \"0 < Speed1 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed2\", \"range\": \"0 < Speed2 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed3\", \"range\": \"0 < Speed3 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region4\": \"Speed4\", \"range\": \"0 < Speed4 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region5\": \"Speed5\", \"range\": \"0 < Speed5 < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions.\n// Total fuel consumption in Region1: Fuel1 = 0.05 * Speed1^2 * Trucks1\n// Total fuel consumption in Region2: Fuel2 = 0.055 * Speed2^2 * Trucks2\n// Total fuel consumption in Region3: Fuel3 = 0.06 * Speed3^2 * Trucks3\n// Total fuel consumption in Region4: Fuel4 = 0.065 * Speed4^2 * Trucks4\n// Total fuel consumption in Region5: Fuel5 = 0.07 * Speed5^2 * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the speed of trucks in each region must not exceed 80 km/h.\n// Speed1 <= 80; Speed2 <= 80; Speed3 <= 80; Speed4 <= 80; Speed5 <= 80\n\n## Generate Constraint-3:\nThe company must allocate at least 5 trucks to each region.\n// Trucks1 >= 5; Trucks2 >= 5; Trucks3 >= 5; Trucks4 >= 5; Trucks5 >= 5\n\n## Generate Constraint-4:\nThe total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km.\n// Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs. The fuel consumption of each truck is modeled by a quadratic function of its speed. The company has a total of 50 trucks available for allocation. Due to regional regulations, the speed of trucks in each region must not exceed 80 km/h. The company must allocate at least 5 trucks to each region. The total distance covered by trucks in Region1 and Region2 combined must not exceed 10,000 km. Please help the company to minimize the total fuel consumption across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=5)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=5)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=5)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=5)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=5)  # number of trucks in Region5\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of trucks in Region1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of trucks in Region2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of trucks in Region3\nSpeed4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed4\", lb=0, ub=100)  # speed of trucks in Region4\nSpeed5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed5\", lb=0, ub=100)  # speed of trucks in Region5\n\n# Define objective function\nFuel1 = 0.05 * Speed1**2 * Trucks1\nFuel2 = 0.055 * Speed2**2 * Trucks2\nFuel3 = 0.06 * Speed3**2 * Trucks3\nFuel4 = 0.065 * Speed4**2 * Trucks4\nFuel5 = 0.07 * Speed5**2 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 80)\nmodel.addCons(Speed3 <= 80)\nmodel.addCons(Speed4 <= 80)\nmodel.addCons(Speed5 <= 80)\nmodel.addCons(Speed1 * Trucks1 + Speed2 * Trucks2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed3))\n    print(\"Speed of Trucks in Region4: \", model.getVal(Speed4))\n    print(\"Speed of Trucks in Region5: \", model.getVal(Speed5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems (kWh)\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"real\"}\n// {\"energy consumption (kWh)\": \"Consumption\", \"range\": \"Consumption >= 0\", \"type\": \"real\"}\n// {\"energy cost (per kWh)\": \"Cost\", \"range\": \"Cost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by:\n// Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n// where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\n// Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand\n\n## Generate Constraint-2:\nThe capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\n// Storage >= 2 * AverageDailyConsumption",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision variables include the number of solar panels and wind turbines to be installed, as well as the capacity of energy storage systems. The company aims to minimize the total energy cost, which is a nonlinear function of the energy consumption, the number of solar panels and wind turbines, and the capacity of the energy storage systems. The cost function is given by: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh, where SolarEfficiency and WindEfficiency are the efficiencies of solar panels and wind turbines, respectively, and TotalEnergyDemand is the total energy demand of the company.\nThe total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand. The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nPlease help the company to minimize the total energy cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage\", lb=0)  # capacity of energy storage systems (kWh)\nConsumption = model.addVar(vtype=\"CONTINUOUS\", name=\"Consumption\", lb=0)  # energy consumption (kWh)\nCost = model.addVar(vtype=\"CONTINUOUS\", name=\"Cost\", lb=0)  # energy cost (per kWh)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nSolarEfficiency = 0.2  # example efficiency for solar panels\nWindEfficiency = 0.3  # example efficiency for wind turbines\nTotalEnergyDemand = 1000  # example total energy demand of the company\nPricePerKWh = 0.1  # example price per kWh\n## Total energy cost: Cost = Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) / TotalEnergyDemand) * PricePerKWh\n## convert the division to multiplication\nmodel.addCons(Cost == Consumption * (1 - (Solar * SolarEfficiency + Wind * WindEfficiency) * TotalEnergyDemand**-1) * PricePerKWh)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total energy generated by solar panels and wind turbines must meet at least 50% of the company's total energy demand.\nmodel.addCons(Solar * SolarEfficiency + Wind * WindEfficiency >= 0.5 * TotalEnergyDemand)\n## The capacity of the energy storage systems must be sufficient to store at least 2 days' worth of the company's average energy consumption.\nAverageDailyConsumption = 100  # example average daily consumption\nmodel.addCons(Storage >= 2 * AverageDailyConsumption)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Energy Consumption: \", model.getVal(Consumption))\n    print(\"Minimized Energy Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The company has identified five different locations (Location A, Location B, Location C, Location D, and Location E) for installation.\n// {\"number of solar panels at Location A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Location C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Location E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels at each location varies due to different sunlight exposure and local weather conditions. The efficiency of wind turbines also varies based on wind patterns. The company wants to maximize the total energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe objective is to maximize the total daily energy output while minimizing the total cost of installation.\n// Total energy output: Energy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\n// Total cost: Cost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n// So, the objective function is: Maximize Energy - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations (Location A, Location B, Location C, Location D, and Location E). The company wants to maximize the total daily energy output while minimizing the total cost of installation.\nFor Location A, each solar panel generates 100 kWh per day with a cost of $500 per panel.\nFor Location B, each solar panel generates 120 kWh per day with a cost of $600 per panel.\nFor Location C, each solar panel generates 110 kWh per day with a cost of $550 per panel.\nFor Location D, each wind turbine generates 200 kWh per day with a cost of $1000 per turbine.\nFor Location E, each wind turbine generates 180 kWh per day with a cost of $900 per turbine.\nThe company has a budget of $50,000 for the installation.\nPlease help the company determine the optimal number of solar panels and wind turbines to install at each location to maximize the total daily energy output while staying within the budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Location A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Location B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Location C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Location D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Location E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 100 * SolarA + 120 * SolarB + 110 * SolarC + 200 * WindD + 180 * WindE\nCost = 500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE\n## the objective function is: Maximize Energy - Cost\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * SolarA + 600 * SolarB + 550 * SolarC + 1000 * WindD + 900 * WindE <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Location B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Location C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Location D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Location E: \", model.getVal(WindE))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid trucks\": \"HybridTrucks\", \"range\": \"HybridTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\n// Total fuel cost for Small trucks: Cost_Small = 0.8 * (1000 / 10) * SmallTrucks\n// Total fuel cost for Medium trucks: Cost_Medium = 0.7 * (1000 / 8) * MediumTrucks\n// Total fuel cost for Large trucks: Cost_Large = 0.6 * (1000 / 6) * LargeTrucks\n// Total fuel cost for Extra-Large trucks: Cost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\n// Total fuel cost for Hybrid trucks: Cost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the day.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, at least 10% of the fleet must be Hybrid trucks.\n// HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks)\n\n## Generate Constraint-3:\nThe company has a daily budget of $3000 for fuel costs.\n// (0.8 * (1000 / 10) * SmallTrucks) + (0.7 * (1000 / 8) * MediumTrucks) + (0.6 * (1000 / 6) * LargeTrucks) + (0.5 * (1000 / 5) * ExtraLargeTrucks) + (1.0 * (1000 / 12) * HybridTrucks) <= 3000\n\n## Generate Constraint-4:\nEach type of truck must have at least one truck deployed.\n// SmallTrucks >= 1; MediumTrucks >= 1; LargeTrucks >= 1; ExtraLargeTrucks >= 1; HybridTrucks >= 1",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and route efficiency for their daily deliveries. They have five different types of trucks: Small, Medium, Large, Extra-Large, and Hybrid. The company needs to determine the number of each type of truck to deploy for the upcoming day.\nThe fuel efficiency and cost per kilometer for each type of truck are as follows: Small trucks have a fuel efficiency of 10 km/l and a cost of $0.8 per km; Medium trucks have a fuel efficiency of 8 km/l and a cost of $0.7 per km; Large trucks have a fuel efficiency of 6 km/l and a cost of $0.6 per km; Extra-Large trucks have a fuel efficiency of 5 km/l and a cost of $0.5 per km; Hybrid trucks have a fuel efficiency of 12 km/l and a cost of $1.0 per km. The company wants to minimize the total daily fuel cost while considering the efficiency of each truck type.\nThe company has a total of 50 trucks available for the day. Due to maintenance schedules, at least 10% of the fleet must be Hybrid trucks. The company has a daily budget of $3000 for fuel costs. Each type of truck must have at least one truck deployed.\nPlease help the company to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)\nHybridTrucks = model.addVar(vtype=\"INTEGER\", name=\"HybridTrucks\", lb=0)\n\n# Define objective function\nCost_Small = 0.8 * (1000 / 10) * SmallTrucks\nCost_Medium = 0.7 * (1000 / 8) * MediumTrucks\nCost_Large = 0.6 * (1000 / 6) * LargeTrucks\nCost_ExtraLarge = 0.5 * (1000 / 5) * ExtraLargeTrucks\nCost_Hybrid = 1.0 * (1000 / 12) * HybridTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks <= 50)\nmodel.addCons(HybridTrucks >= 0.1 * (SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks + HybridTrucks))\nmodel.addCons(Cost_Small + Cost_Medium + Cost_Large + Cost_ExtraLarge + Cost_Hybrid <= 3000)\nmodel.addCons(SmallTrucks >= 1)\nmodel.addCons(MediumTrucks >= 1)\nmodel.addCons(LargeTrucks >= 1)\nmodel.addCons(ExtraLargeTrucks >= 1)\nmodel.addCons(HybridTrucks >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Number of Hybrid Trucks: \", model.getVal(HybridTrucks))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to minimize fuel consumption and operational costs. Additionally, the company needs to decide on the level of maintenance for each truck to ensure efficiency and reliability.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance level for Region 1 trucks\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Region 2 trucks\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance level for Region 3 trucks\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks are affected by the number of trucks and the level of maintenance. The fuel efficiency of each truck decreases nonlinearly with the increase in the number of trucks in a region. Higher maintenance levels improve fuel efficiency but also increase costs. The company aims to minimize the total operational cost, which includes fuel and maintenance costs.\n// Total operational cost for Region 1: Cost1 = (100 + 0.1 * Trucks1^2) * Trucks1 + 5 * Maintenance1\n// Total operational cost for Region 2: Cost2 = (120 + 0.12 * Trucks2^2) * Trucks2 + 6 * Maintenance2\n// Total operational cost for Region 3: Cost3 = (150 + 0.15 * Trucks3^2) * Trucks3 + 7 * Maintenance3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for truck operations and maintenance across all regions is $100,000.\n// (100 + 0.1 * Trucks1^2) * Trucks1 + 5 * Maintenance1 + (120 + 0.12 * Trucks2^2) * Trucks2 + 6 * Maintenance2 + (150 + 0.15 * Trucks3^2) * Trucks3 + 7 * Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation across all regions is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional demand, there must be at least 20 trucks in Region 1 and 30 trucks in Region 2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the optimal number of trucks to allocate to each region and the level of maintenance for each truck to minimize fuel consumption and operational costs. The relationship between the number of trucks, maintenance level, and operational costs is detailed in the following table:\n\n| Region | Operational Cost Formula | Maintenance Cost Multiplier |\n|--------|---------------------------|------------------------------|\n| 1      | (100 + 0.1 * Trucks1^2) * Trucks1 + 5 * Maintenance1 | 5 |\n| 2      | (120 + 0.12 * Trucks2^2) * Trucks2 + 6 * Maintenance2 | 6 |\n| 3      | (150 + 0.15 * Trucks3^2) * Trucks3 + 7 * Maintenance3 | 7 |\n\nThe company has a total budget of $100,000 for truck operations and maintenance across all regions. The total number of trucks available for allocation across all regions is 100. Due to regional demand, there must be at least 20 trucks in Region 1 and 30 trucks in Region 2.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks in Region 3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance level for Region 1 trucks\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance level for Region 2 trucks\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance level for Region 3 trucks\n\n# Define objective function\nCost1 = (100 + 0.1 * Trucks1**2) * Trucks1 + 5 * Maintenance1\nCost2 = (120 + 0.12 * Trucks2**2) * Trucks2 + 6 * Maintenance2\nCost3 = (150 + 0.15 * Trucks3**2) * Trucks3 + 7 * Maintenance3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons((100 + 0.1 * Trucks1**2) * Trucks1 + 5 * Maintenance1 +\n              (120 + 0.12 * Trucks2**2) * Trucks2 + 6 * Maintenance2 +\n              (150 + 0.15 * Trucks3**2) * Trucks3 + 7 * Maintenance3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Maintenance Level for Region 1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Level for Region 2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Level for Region 3: \", model.getVal(Maintenance3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company wants to maximize the total profit.\n// Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various costs and constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## Total profit: Profit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\nProfit = (50 - 30) * ProdA + (70 - 40) * ProdB + (60 - 35) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited raw material supply, which allows for a maximum of 1000 units of combined production for all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 603,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic devices using 6 different machines. The plant manager needs to optimize the energy consumption and production efficiency by determining the optimal number of hours each machine should operate.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n// {\"hours machine 6 operates\": \"M6\", \"range\": \"M6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different energy efficiency and production rate. The energy consumption of each machine is a nonlinear function of the operating hours. The production rate also varies with the operating hours, following a nonlinear pattern. The objective is to minimize the total energy consumption while ensuring the production target is met.\n// Energy consumption of machine i: Ei = Ai * M_i^2 + Bi * M_i + Ci, where Ai, Bi, Ci are constants for machine i.\n// Production rate of machine i: Pi = Di * M_i^1.5 + Ei * M_i + Fi, where Di, Ei, Fi are constants for machine i.\n// Total production: P_total = P1 + P2 + P3 + P4 + P5 + P6\n// Objective function: Minimize \u03a3(Ei) subject to P_total >= Target_production\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per day.\n// M1 + M2 + M3 + M4 + M5 + M6 <= 120",
        "question": "A manufacturing plant produces electronic devices using 6 different machines. The plant manager needs to optimize the energy consumption and production efficiency by determining the optimal number of hours each machine should operate. Each machine has a different energy efficiency and production rate, which are nonlinear functions of the operating hours. The energy consumption of each machine is given by the formula Ei = Ai * M_i^2 + Bi * M_i + Ci, and the production rate is given by the formula Pi = Di * M_i^1.5 + Ei * M_i + Fi, where Ai, Bi, Ci, Di, Ei, Fi are constants for machine i.\n\nThe total operating hours for all machines must not exceed 120 hours per day. The objective is to minimize the total energy consumption while ensuring the production target is met.\n\nPlease help the plant manager to determine the optimal number of hours each machine should operate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\nM6 = model.addVar(vtype=\"CONTINUOUS\", name=\"M6\", lb=0) # hours machine 6 operates\n\n# Define objective function\n# Energy consumption of machine i: Ei = Ai * M_i^2 + Bi * M_i + Ci\n# Production rate of machine i: Pi = Di * M_i^1.5 + Ei * M_i + Fi\n# Constants for demonstration purposes (replace with actual values)\nA1, B1, C1, D1, E1, F1 = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6\nA2, B2, C2, D2, E2, F2 = 0.7, 0.8, 0.9, 1.0, 1.1, 1.2\nA3, B3, C3, D3, E3, F3 = 1.3, 1.4, 1.5, 1.6, 1.7, 1.8\nA4, B4, C4, D4, E4, F4 = 1.9, 2.0, 2.1, 2.2, 2.3, 2.4\nA5, B5, C5, D5, E5, F5 = 2.5, 2.6, 2.7, 2.8, 2.9, 3.0\nA6, B6, C6, D6, E6, F6 = 3.1, 3.2, 3.3, 3.4, 3.5, 3.6\n\nE1_val = A1 * M1**2 + B1 * M1 + C1\nE2_val = A2 * M2**2 + B2 * M2 + C2\nE3_val = A3 * M3**2 + B3 * M3 + C3\nE4_val = A4 * M4**2 + B4 * M4 + C4\nE5_val = A5 * M5**2 + B5 * M5 + C5\nE6_val = A6 * M6**2 + B6 * M6 + C6\n\nP1_val = D1 * M1**1.5 + E1_val * M1 + F1\nP2_val = D2 * M2**1.5 + E2_val * M2 + F2\nP3_val = D3 * M3**1.5 + E3_val * M3 + F3\nP4_val = D4 * M4**1.5 + E4_val * M4 + F4\nP5_val = D5 * M5**1.5 + E5_val * M5 + F5\nP6_val = D6 * M6**1.5 + E6_val * M6 + F6\n\nP_total = P1_val + P2_val + P3_val + P4_val + P5_val + P6_val\n\n# Objective function: Minimize \u03a3(Ei) subject to P_total >= Target_production\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1_val + E2_val + E3_val + E4_val + E5_val + E6_val)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 120 hours per day.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 + M6 <= 120)\n# Ensure the production target is met (replace with actual target)\nmodel.addCons(P_total >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Hours Machine 6 Operates: \", model.getVal(M6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company operates five different types of vehicles (Vehicle1, Vehicle2, Vehicle3, Vehicle4, Vehicle5) and needs to decide how many trips each vehicle should make. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for Vehicle1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Vehicle2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Vehicle3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Vehicle4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Vehicle5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Vehicle1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Vehicle2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Vehicle3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Vehicle4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Vehicle5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption per trip for each vehicle decreases with the investment in fuel-efficient upgrades. The initial fuel consumption for Vehicle1 is 100 liters per trip, which decreases by 1 liter for every $100 invested in upgrades. For Vehicle2, the initial consumption is 150 liters per trip, decreasing by 1.5 liters per $100 invested. For Vehicle3, it's 200 liters per trip, decreasing by 2 liters per $100 invested. For Vehicle4, it's 250 liters per trip, decreasing by 2.5 liters per $100 invested. For Vehicle5, it's 300 liters per trip, decreasing by 3 liters per $100 invested. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption for Vehicle1: Consumption1 = (100 - 0.01 * Upgrade1) * Trips1\n// Fuel consumption for Vehicle2: Consumption2 = (150 - 0.015 * Upgrade2) * Trips2\n// Fuel consumption for Vehicle3: Consumption3 = (200 - 0.02 * Upgrade3) * Trips3\n// Fuel consumption for Vehicle4: Consumption4 = (250 - 0.025 * Upgrade4) * Trips4\n// Fuel consumption for Vehicle5: Consumption5 = (300 - 0.03 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs.\n// Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trips1 + 150 * Trips2 + 200 * Trips3 + 250 * Trips4 + 300 * Trips5) <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 5000.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 5000\n\n## Generate Constraint-3:\nEach vehicle type must make at least 100 trips.\n// Trips1 >= 100; Trips2 >= 100; Trips3 >= 100; Trips4 >= 100; Trips5 >= 100\n\n## Generate Constraint-4:\nThe investment in upgrades for any single vehicle type cannot exceed $20,000.\n// Upgrade1 <= 20000\n// Upgrade2 <= 20000\n// Upgrade3 <= 20000\n// Upgrade4 <= 20000\n// Upgrade5 <= 20000",
        "question": "A logistics company is planning its routes for the next quarter and needs to decide how many trips each of its five different types of vehicles (Vehicle1, Vehicle2, Vehicle3, Vehicle4, Vehicle5) should make. The company is also considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip. The initial fuel consumption and the reduction in consumption per $100 invested for each vehicle are given in the following Table.\n\n| Vehicle | Initial Fuel Consumption | Reduction per $100 Invested |\n|---------|--------------------------|-----------------------------|\n| Vehicle1 | 100 liters per trip | 1 liter |\n| Vehicle2 | 150 liters per trip | 1.5 liters |\n| Vehicle3 | 200 liters per trip | 2 liters |\n| Vehicle4 | 250 liters per trip | 2.5 liters |\n| Vehicle5 | 300 liters per trip | 3 liters |\n\nThe company has a budget of $100,000 for fuel-efficient upgrades and operational costs. The total number of trips across all vehicles must not exceed 5000, and each vehicle type must make at least 100 trips. The investment in upgrades for any single vehicle type cannot exceed $20,000. \n\nPlease help the company to minimize the total fuel consumption across all vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100)  # number of trips for Vehicle1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=100)  # number of trips for Vehicle2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=100)  # number of trips for Vehicle3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=100)  # number of trips for Vehicle4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=100)  # number of trips for Vehicle5\n\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0, ub=20000)  # investment in fuel-efficient upgrades for Vehicle1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0, ub=20000)  # investment in fuel-efficient upgrades for Vehicle2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0, ub=20000)  # investment in fuel-efficient upgrades for Vehicle3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0, ub=20000)  # investment in fuel-efficient upgrades for Vehicle4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0, ub=20000)  # investment in fuel-efficient upgrades for Vehicle5\n\n# Define objective function\nConsumption1 = (100 - 0.01 * Upgrade1) * Trips1\nConsumption2 = (150 - 0.015 * Upgrade2) * Trips2\nConsumption3 = (200 - 0.02 * Upgrade3) * Trips3\nConsumption4 = (250 - 0.025 * Upgrade4) * Trips4\nConsumption5 = (300 - 0.03 * Upgrade5) * Trips5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3 + Consumption4 + Consumption5)\n\n# Add constraints\nmodel.addCons(Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 + (100 * Trips1 + 150 * Trips2 + 200 * Trips3 + 250 * Trips4 + 300 * Trips5) <= 100000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Vehicle1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Vehicle2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Vehicle3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Vehicle4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Vehicle5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrades for Vehicle1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Vehicle2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Vehicle3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrades for Vehicle4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrades for Vehicle5: \", model.getVal(Upgrade5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ProductC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 machines available for the month.\n// MachinesA + MachinesB + MachinesC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of machines dedicated to each product, and the level of automation (investment in automation technology) to optimize production efficiency and cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products. The company has a total of 100 machines available for the month. Please help the company determine the optimal production quantities, number of machines, and level of automation to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ProductA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ProductB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * Automation) * QuantityA\nProfitB = (200 - 150 + 0.0005 * Automation) * QuantityB\nProfitC = (250 - 200 + 0.0005 * Automation) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Machines for ProductA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ProductB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ProductC: \", model.getVal(MachinesC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of delivery vehicles. The company has five types of vehicles: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity.\n// {\"number of Small vehicles\": \"Small\", \"range\": \"Small >= 0\", \"type\": \"integer\"}\n// {\"number of Medium vehicles\": \"Medium\", \"range\": \"Medium >= 0\", \"type\": \"integer\"}\n// {\"number of Large vehicles\": \"Large\", \"range\": \"Large >= 0\", \"type\": \"integer\"}\n// {\"number of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"number of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Small vehicle has a fuel efficiency of 20 km/l, a maintenance cost of $500 per month, and a capacity of 500 kg.\nThe Medium vehicle has a fuel efficiency of 15 km/l, a maintenance cost of $700 per month, and a capacity of 1000 kg.\nThe Large vehicle has a fuel efficiency of 10 km/l, a maintenance cost of $1000 per month, and a capacity of 1500 kg.\nThe Electric vehicle has a fuel efficiency equivalent to 30 km/l, a maintenance cost of $800 per month, and a capacity of 750 kg.\nThe Hybrid vehicle has a fuel efficiency of 25 km/l, a maintenance cost of $600 per month, and a capacity of 1250 kg.\nThe company aims to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities.\n// Monthly maintenance costs: Costs = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\n// Sum of vehicle capacities: Capacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n// So, the objective function is: Minimize Costs / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle maintenance.\n// 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid <= 15000\n\n## Generate Constraint-2:\nThe company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\n// 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid >= 10000\n\n## Generate Constraint-3:\nThe company wants to have at least 5 vehicles of each type.\n// Small >= 5; Medium >= 5; Large >= 5; Electric >= 5; Hybrid >= 5",
        "question": "A logistics company needs to optimize its fleet of delivery vehicles, which includes five types: Small, Medium, Large, Electric, and Hybrid. Each vehicle type has different fuel efficiency, maintenance costs, and capacity. The Small vehicle has a fuel efficiency of 20 km/l, a maintenance cost of $500 per month, and a capacity of 500 kg. The Medium vehicle has a fuel efficiency of 15 km/l, a maintenance cost of $700 per month, and a capacity of 1000 kg. The Large vehicle has a fuel efficiency of 10 km/l, a maintenance cost of $1000 per month, and a capacity of 1500 kg. The Electric vehicle has a fuel efficiency equivalent to 30 km/l, a maintenance cost of $800 per month, and a capacity of 750 kg. The Hybrid vehicle has a fuel efficiency of 25 km/l, a maintenance cost of $600 per month, and a capacity of 1250 kg. The company aims to minimize the Total Cost Efficiency (TCE), which is defined as the sum of the monthly maintenance costs divided by the sum of the vehicle capacities. The company has a budget of $15,000 per month for vehicle maintenance. It needs to ensure that the total capacity of the fleet is at least 10,000 kg. Additionally, the company wants to have at least 5 vehicles of each type. Please help the company determine the optimal number of each type of vehicle to minimize the Total Cost Efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmall = model.addVar(vtype=\"INTEGER\", name=\"Small\", lb=5)  # number of Small vehicles\nMedium = model.addVar(vtype=\"INTEGER\", name=\"Medium\", lb=5)  # number of Medium vehicles\nLarge = model.addVar(vtype=\"INTEGER\", name=\"Large\", lb=5)  # number of Large vehicles\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=5)  # number of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=5)  # number of Hybrid vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCosts = 500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid\nCapacity = 500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid\n## the objective function is: Minimize Costs / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Costs)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle maintenance.\nmodel.addCons(500 * Small + 700 * Medium + 1000 * Large + 800 * Electric + 600 * Hybrid <= 15000)\n## The company needs to ensure that the total capacity of the fleet is at least 10,000 kg.\nmodel.addCons(500 * Small + 1000 * Medium + 1500 * Large + 750 * Electric + 1250 * Hybrid >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small vehicles: \", model.getVal(Small))\n    print(\"Number of Medium vehicles: \", model.getVal(Medium))\n    print(\"Number of Large vehicles: \", model.getVal(Large))\n    print(\"Number of Electric vehicles: \", model.getVal(Electric))\n    print(\"Number of Hybrid vehicles: \", model.getVal(Hybrid))\n    print(\"Minimized Total Cost Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1331,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by the ratio of the delivery capacity to the operational cost. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs.\n// Efficiency of Trucks: E_T = 100 * T / 50\n// Efficiency of Vans: E_V = 50 * V / 30\n// Efficiency of Bikes: E_B = 10 * B / 10\n// So, the objective function is: Maximize (E_T + E_V + E_B)\n\n## Generate Constraint-1:\nThe company has a budget of $1500 per day for operational costs.\n// 50 * T + 30 * V + 10 * B <= 1500\n\n## Generate Constraint-2:\nThe company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\n// 100 * T + 50 * V + 10 * B <= 2000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while considering operational costs and constraints. Trucks have a delivery capacity of 100 units and an operational cost of $50 per day. Vans have a delivery capacity of 50 units and an operational cost of $30 per day. Bikes have a delivery capacity of 10 units and an operational cost of $10 per day. The company aims to maximize the total efficiency, which is the sum of the delivery capacities divided by the sum of the operational costs. The company has a budget of $1500 per day for operational costs. The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. Please help the company to maximize the total efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE_T = 100 * T / 50\nE_V = 50 * V / 30\nE_B = 10 * B / 10\n## the objective function is: Maximize (E_T + E_V + E_B)\n## convert the division to multiplication\nmodel.addCons(obj * (50 * T + 30 * V + 10 * B) == 100 * T + 50 * V + 10 * B)\n\n# Add constraints\n## The company has a budget of $1500 per day for operational costs.\nmodel.addCons(50 * T + 30 * V + 10 * B <= 1500)\n## The company has a storage capacity constraint that limits the total delivery capacity to 2000 units per day.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 2000)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost_A = 20A^2, Cost_B = 30B^2, Cost_C = 40C^2, Cost_D = 50D^2, Cost_E = 60E^2. The company aims to maximize its total profit.\n// Profit of A: Profit_A = 50A - 20A^2\n// Profit of B: Profit_B = 70B - 30B^2\n// Profit of C: Profit_C = 90C - 40C^2\n// Profit of D: Profit_D = 110D - 50D^2\n// Profit of E: Profit_E = 130E - 60E^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20A^2 + 30B^2 + 40C^2 + 50D^2 + 60E^2 <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe total production quantity of device E should not exceed the combined production of devices A, B, and C.\n// E <= A + B + C",
        "question": "A manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin. The profit per unit for each device and the production cost function, which increases nonlinearly with the quantity produced, are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|---------------------------|\n| A      | $50             | 20A^2                     |\n| B      | $70             | 30B^2                     |\n| C      | $90             | 40C^2                     |\n| D      | $110            | 50D^2                     |\n| E      | $130            | 60E^2                     |\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device. The total production quantity of device E should not exceed the combined production of devices A, B, and C. \nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = 50A - 20A^2\n## Profit of B: Profit_B = 70B - 30B^2\n## Profit of C: Profit_C = 90C - 40C^2\n## Profit of D: Profit_D = 110D - 50D^2\n## Profit of E: Profit_E = 130E - 60E^2\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == 50*A - 20*A**2 + 70*B - 30*B**2 + 90*C - 40*C**2 + 110*D - 50*D**2 + 130*E - 60*E**2)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(20*A**2 + 30*B**2 + 40*C**2 + 50*D**2 + 60*E**2 <= 10000)\n## The total production quantity of device E should not exceed the combined production of devices A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $60.\n// PriceA >= 60; PriceB >= 60; PriceC >= 60\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of ProductA and 800 units of ProductB.\n// QuantityA >= 500; QuantityB >= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products. The total production capacity of the company is 5000 units. The total marketing budget is $50,000. The price of each product must be at least $60. The company must produce at least 500 units of ProductA and 800 units of ProductB.\n\nPlease help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=60) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=60) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=60) # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total production capacity of the company is 5000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\n# The total marketing budget is $50,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n# The company must produce at least 500 units of ProductA and 800 units of ProductB.\nmodel.addCons(QuantityA >= 500)\nmodel.addCons(QuantityB >= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology to reduce labor costs. The automation technology reduces the number of workers needed per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The automation technology reduces the labor cost per unit by $2 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA * WageRate\n// Total profit for ProductB: ProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB * WageRate\n// Total profit for ProductC: ProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC * WageRate\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total capital investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least 500 units, and ProductB must be at least 300 units.\n// QuantityA >= 500; QuantityB >= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology to reduce labor costs. The automation technology reduces the number of workers needed per unit of product.\nThe cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The revenue per unit of ProductA is $100, ProductB is $120, and ProductC is $150. The automation technology reduces the labor cost per unit by $2 for every $10,000 invested. The company aims to maximize the total profit from all products.\nThe company has a total of 100 workers available. The total capital investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least 500 units, and ProductB must be at least 300 units.\nPlease help the company determine the optimal production quantities, worker allocations, and capital investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=500) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=300) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # capital investment in automation\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA * WageRate\n## Total profit for ProductB: ProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB * WageRate\n## Total profit for ProductC: ProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC * WageRate\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (100 - 50 - 0.0002 * Automation) * QuantityA - WorkersA\nProfitB = (120 - 70 - 0.0002 * Automation) * QuantityB - WorkersB\nProfitC = (150 - 90 - 0.0002 * Automation) * QuantityC - WorkersC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total capital investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours.\n// 10 * T + 8 * V + 2 * B <= 500\n\n## Generate Constraint-3:\nThe company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h). The company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each. The company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours. The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes. Please help the company to maximize the total daily transport capacity in tons per hour (ton-km/h).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\n# So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n# The company has a total of 500 hours of driver work time available per day.\nmodel.addCons(10 * T + 8 * V + 2 * B <= 500)\n# The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type is defined by its speed and capacity. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h).\n// Efficiency_Truck = 60 * 20 * T\n// Efficiency_Van = 40 * 10 * V\n// Efficiency_Bike = 20 * 1 * B\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each.\n// 200 * T + 150 * V + 50 * B <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours.\n// 10 * T + 8 * V + 2 * B <= 500\n\n## Generate Constraint-3:\nThe company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\n// B <= 0.5 * (T + V)\n\n## Generate Constraint-5:\nThe company has a storage capacity constraint where the total number of vehicles cannot exceed 100.\n// T + V + B <= 100",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting operational constraints. Trucks have a speed of 60 km/h and a capacity of 20 tons, Vans have a speed of 40 km/h and a capacity of 10 tons, and Bikes have a speed of 20 km/h and a capacity of 1 ton. The company aims to maximize the total daily transport capacity in tons per hour (ton-km/h). The company has a budget of $10,000 for vehicle maintenance per day. Trucks cost $200 each to maintain, Vans cost $150 each, and Bikes cost $50 each. The company has a total of 500 hours of driver work time available per day. Trucks require 10 hours of driver time per day, Vans require 8 hours, and Bikes require 2 hours. The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes. The company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans. The company has a storage capacity constraint where the total number of vehicles cannot exceed 100. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their total daily transport capacity in tons per hour (ton-km/h).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\nEfficiency_Truck = 60 * 20 * T\nEfficiency_Van = 40 * 10 * V\nEfficiency_Bike = 20 * 1 * B\n# So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance per day.\nmodel.addCons(200 * T + 150 * V + 50 * B <= 10000)\n# The company has a total of 500 hours of driver work time available per day.\nmodel.addCons(10 * T + 8 * V + 2 * B <= 500)\n# The company aims to ensure that the total number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n# The company wants to ensure that the total number of Bikes does not exceed 50% of the total number of Trucks and Vans.\nmodel.addCons(B <= 0.5 * (T + V))\n# The company has a storage capacity constraint where the total number of vehicles cannot exceed 100.\nmodel.addCons(T + V + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency (ton-km/h): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $25. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $6. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceAQty\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceBQty\n// Total net profit for DeviceC: Profit_DeviceC = (60 - 25 - 6) * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $25. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $6. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs. The company has a limited production capacity of 1000 units per day. Please help the company determine the optimal production quantity for each device to maximize its total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceAQty\nProfit_DeviceB = (70 - 30 - 7) * DeviceBQty\nProfit_DeviceC = (60 - 25 - 6) * DeviceCQty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost.\n// Efficiency_Truck = 100 * T / (5 * T)\n// Efficiency_Van = 70 * V / (3 * V)\n// Efficiency_Bike = 30 * B / (0 * B)\n// So, the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for fuel costs per day.\n// 5 * T + 3 * V <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of deliveries does not exceed 2000 per day.\n// 100 * T + 70 * V + 30 * B <= 2000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while meeting operational constraints. The efficiency of each vehicle type varies based on the number of deliveries and the distance covered. Trucks are efficient for long distances but have high fuel costs, Vans are mid-range, and Bikes are efficient for short distances with zero fuel cost. The company aims to maximize the total efficiency, which is defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost. The following table summarizes the delivery capacity and fuel cost for each vehicle type.\n\n| Vehicle Type | Delivery Capacity | Fuel Cost |\n|--------------|-------------------|-----------|\n| Trucks       | 100 deliveries    | 5 units   |\n| Vans         | 70 deliveries     | 3 units   |\n| Bikes        | 30 deliveries     | 0 units   |\n\nThe company has a budget of $1000 for fuel costs per day. The company has a total of 50 drivers available. The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. The company wants to ensure that the total number of deliveries does not exceed 2000 per day.\n\nPlease help the company to maximize the total efficiency (defined as the sum of the delivery capacities of all vehicles divided by the total fuel cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_Truck = 100 * T / (5 * T)\nEfficiency_Van = 70 * V / (3 * V)\nEfficiency_Bike = 30 * B / (0 * B)\n## the objective function is: Maximize (Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n## convert the division to multiplication\nmodel.addCons(obj == Efficiency_Truck + Efficiency_Van + Efficiency_Bike)\n\n# Add constraints\n## The company has a budget of $1000 for fuel costs per day.\nmodel.addCons(5 * T + 3 * V <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company aims to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n## The company wants to ensure that the total number of deliveries does not exceed 2000 per day.\nmodel.addCons(100 * T + 70 * V + 30 * B <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1464,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can handle is limited to 500 per day.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. Additionally, the company needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip. The operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency.\n\n| Truck Type | Initial Cost per Trip | Decrease per $100 Fuel Upgrade |\n|------------|-----------------------|---------------------------------|\n| Small      | $200                  | $5                              |\n| Medium     | $300                  | $7                              |\n| Large      | $400                  | $9                              |\n\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades. The total number of trips the company can handle is limited to 500 per day.\n\nPlease help the company to minimize the total operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0)\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1506,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"speed of TruckA\": \"SpeedA\", \"range\": \"0 < SpeedA <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckB\": \"SpeedB\", \"range\": \"0 < SpeedB <= 60\", \"type\": \"continuous\"}\n// {\"speed of TruckC\": \"SpeedC\", \"range\": \"0 < SpeedC <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks.\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC)\n\n## Generate Constraint-1:\nThe total cargo capacity required for the route is 100 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC >= 100\n\n## Generate Constraint-2:\nThe company has a budget constraint of $5000 for vehicle deployment.\n// 1000 * TruckA + 1500 * TruckB + 2000 * TruckC <= 5000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC, each with different fuel efficiency and cargo capacity. The company needs to determine the number of each type of vehicle to deploy for a specific route to minimize fuel consumption while meeting cargo capacity requirements. Additionally, the company needs to decide on the speed at which each type of vehicle should travel, as this affects fuel consumption. The fuel consumption of each truck is a nonlinear function of its speed, given by:\n- TruckA: FuelA = 0.05 * SpeedA^2 * TruckA\n- TruckB: FuelB = 0.03 * SpeedB^2 * TruckB\n- TruckC: FuelC = 0.04 * SpeedC^2 * TruckC\nThe company aims to minimize the total fuel consumption across all trucks. The total cargo capacity required for the route is 100 tons. The company has a budget constraint of $5000 for vehicle deployment. Please help the company to determine the optimal number of each type of vehicle and their respective speeds to minimize total fuel consumption while adhering to the budget and cargo capacity constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nSpeedA = model.addVar(name=\"SpeedA\", lb=0.01, ub=60)  # speed of TruckA\nSpeedB = model.addVar(name=\"SpeedB\", lb=0.01, ub=60)  # speed of TruckB\nSpeedC = model.addVar(name=\"SpeedC\", lb=0.01, ub=60)  # speed of TruckC\n\n# Define objective function\nFuelA = 0.05 * SpeedA**2 * TruckA\nFuelB = 0.03 * SpeedB**2 * TruckB\nFuelC = 0.04 * SpeedC**2 * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelA + FuelB + FuelC)\n\n# Add constraints\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC >= 100)  # total cargo capacity constraint\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 2000 * TruckC <= 5000)  # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Speed of TruckA: \", model.getVal(SpeedA))\n    print(\"Speed of TruckB: \", model.getVal(SpeedB))\n    print(\"Speed of TruckC: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month. Additionally, the company is considering investing in fuel-efficient technologies for the trucks, which will reduce fuel costs per kilometer.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsW\": \"TrucksW\", \"range\": \"TrucksW >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for GoodsX\": \"TechX\", \"range\": \"TechX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsY\": \"TechY\", \"range\": \"TechY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsZ\": \"TechZ\", \"range\": \"TechZ >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for GoodsW\": \"TechW\", \"range\": \"TechW >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods.\n// Fuel cost for GoodsX: CostX = (0.50 - 0.0001 * TechX) * (TrucksX * DistanceX)\n// Fuel cost for GoodsY: CostY = (0.60 - 0.0001 * TechY) * (TrucksY * DistanceY)\n// Fuel cost for GoodsZ: CostZ = (0.70 - 0.0001 * TechZ) * (TrucksZ * DistanceZ)\n// Fuel cost for GoodsW: CostW = (0.80 - 0.0001 * TechW) * (TrucksW * DistanceW)\n// So, the objective function is: Minimize (CostX + CostY + CostZ + CostW)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TrucksX + TrucksY + TrucksZ + TrucksW <= 50\n\n## Generate Constraint-2:\nThe total investment in fuel-efficient technology cannot exceed $100,000.\n// TechX + TechY + TechZ + TechW <= 100,000\n\n## Generate Constraint-3:\nDue to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks.\n// TrucksX >= 10; TrucksY >= 15\n\n## Generate Constraint-4:\nThe total distance each type of goods needs to be transported varies: GoodsX travels 10,000 km, GoodsY travels 15,000 km, GoodsZ travels 20,000 km, and GoodsW travels 25,000 km.\n// TrucksX * DistanceX = 10,000 * TrucksX\n// TrucksY * DistanceY = 15,000 * TrucksY\n// TrucksZ * DistanceZ = 20,000 * TrucksZ\n// TrucksW * DistanceW = 25,000 * TrucksW\n\n## Generate Constraint-5:\nThe company wants to ensure that each type of goods has at least one truck allocated to it.\n// TrucksX >= 1; TrucksY >= 1; TrucksZ >= 1; TrucksW >= 1",
        "question": "A logistics company is managing the distribution of four different types of goods: GoodsX, GoodsY, GoodsZ, and GoodsW. The company needs to determine the number of trucks allocated to each type of goods for the next month and the investment in fuel-efficient technologies for the trucks. The fuel cost per kilometer decreases by $0.10 for every $1,000 invested in fuel-efficient technology. The initial fuel cost per kilometer for GoodsX is $0.50, for GoodsY is $0.60, for GoodsZ is $0.70, and for GoodsW is $0.80. The company aims to minimize the total fuel cost for all goods.\n\nThe company has a total of 50 trucks available for the month. The total investment in fuel-efficient technology cannot exceed $100,000. Due to contractual obligations, GoodsX must be transported by at least 10 trucks, and GoodsY must be transported by at least 15 trucks. The total distance each type of goods needs to be transported varies: GoodsX travels 10,000 km, GoodsY travels 15,000 km, GoodsZ travels 20,000 km, and GoodsW travels 25,000 km. The company wants to ensure that each type of goods has at least one truck allocated to it.\n\nPlease help the company to determine the optimal allocation of trucks and investment in fuel-efficient technologies to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=1)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=1)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=1)  # number of trucks for GoodsZ\nTrucksW = model.addVar(vtype=\"INTEGER\", name=\"TrucksW\", lb=1)  # number of trucks for GoodsW\nTechX = model.addVar(vtype=\"CONTINUOUS\", name=\"TechX\", lb=0)  # investment in fuel-efficient technology for GoodsX\nTechY = model.addVar(vtype=\"CONTINUOUS\", name=\"TechY\", lb=0)  # investment in fuel-efficient technology for GoodsY\nTechZ = model.addVar(vtype=\"CONTINUOUS\", name=\"TechZ\", lb=0)  # investment in fuel-efficient technology for GoodsZ\nTechW = model.addVar(vtype=\"CONTINUOUS\", name=\"TechW\", lb=0)  # investment in fuel-efficient technology for GoodsW\n\n# Define objective function\nCostX = (0.50 - 0.0001 * TechX) * (10000 * TrucksX)\nCostY = (0.60 - 0.0001 * TechY) * (15000 * TrucksY)\nCostZ = (0.70 - 0.0001 * TechZ) * (20000 * TrucksZ)\nCostW = (0.80 - 0.0001 * TechW) * (25000 * TrucksW)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ + CostW)\n\n# Add constraints\nmodel.addCons(TrucksX + TrucksY + TrucksZ + TrucksW <= 50)\nmodel.addCons(TechX + TechY + TechZ + TechW <= 100000)\nmodel.addCons(TrucksX >= 10)\nmodel.addCons(TrucksY >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Number of Trucks for GoodsW: \", model.getVal(TrucksW))\n    print(\"Investment in Tech for GoodsX: \", model.getVal(TechX))\n    print(\"Investment in Tech for GoodsY: \", model.getVal(TechY))\n    print(\"Investment in Tech for GoodsZ: \", model.getVal(TechZ))\n    print(\"Investment in Tech for GoodsW: \", model.getVal(TechW))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and textiles. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries and the number of trips it makes.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for electronics\": \"ElectronicsTrips\", \"range\": \"ElectronicsTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for perishables\": \"PerishablesTrips\", \"range\": \"PerishablesTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for textiles\": \"TextilesTrips\", \"range\": \"TextilesTrips >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per trip for electronics is $100, for perishables is $70, and for textiles is $50. The fuel cost per trip for electronics is $20, for perishables is $15, and for textiles is $10. The company aims to maximize its daily net profit from all trips.\n// Profit_Electronics = ElectronicsTrucks * ElectronicsTrips * (100 - 20)\n// Profit_Perishables = PerishablesTrucks * PerishablesTrips * (70 - 15)\n// Profit_Textiles = TextilesTrucks * TextilesTrips * (50 - 10)\n// So, the objective function is: Maximize (Profit_Electronics + Profit_Perishables + Profit_Textiles)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50\n\n## Generate Constraint-2:\nThe company has a daily fuel budget of $1000.\n// 20 * ElectronicsTrucks * ElectronicsTrips + 15 * PerishablesTrucks * PerishablesTrips + 10 * TextilesTrucks * TextilesTrips <= 1000",
        "question": "A logistics company is planning to optimize its fleet of trucks to transport three types of goods: electronics, perishables, and textiles. The company needs to decide the number of trucks dedicated to each type of goods and the number of trips each truck should make per day. The efficiency of each truck varies depending on the type of goods it carries and the number of trips it makes. The profit and fuel cost per trip for each type of goods are given in the following Table.\n\n| Type of Goods | Profit per Trip | Fuel Cost per Trip |\n|---------------|-----------------|--------------------|\n| Electronics   | $100            | $20                |\n| Perishables   | $70             | $15                |\n| Textiles      | $50             | $10                |\n\nThe company has a total of 50 trucks available. The company has a daily fuel budget of $1000. The company aims to maximize its daily net profit from all trips. Please help the company determine the optimal number of trucks and trips for each type of goods to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsTrips = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrips\", lb=0)\nPerishablesTrips = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrips\", lb=0)\nTextilesTrips = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrips\", lb=0)\n\n# Define objective function\nProfit_Electronics = ElectronicsTrucks * ElectronicsTrips * (100 - 20)\nProfit_Perishables = PerishablesTrucks * PerishablesTrips * (70 - 15)\nProfit_Textiles = TextilesTrucks * TextilesTrips * (50 - 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Electronics + Profit_Perishables + Profit_Textiles)\n\n# Add constraints\nmodel.addCons(ElectronicsTrucks + PerishablesTrucks + TextilesTrucks <= 50)\nmodel.addCons(20 * ElectronicsTrucks * ElectronicsTrips + 15 * PerishablesTrucks * PerishablesTrips + 10 * TextilesTrucks * TextilesTrips <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Electronics: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Trucks for Perishables: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Trucks for Textiles: \", model.getVal(TextilesTrucks))\n    print(\"Number of Trips per Truck for Electronics: \", model.getVal(ElectronicsTrips))\n    print(\"Number of Trips per Truck for Perishables: \", model.getVal(PerishablesTrips))\n    print(\"Number of Trips per Truck for Textiles: \", model.getVal(TextilesTrips))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. The company needs to determine the number of each type of truck to maximize its profit while considering operational constraints.\n// {\"number of TruckA\": \"TruckANum\", \"range\": \"TruckANum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckBNum\", \"range\": \"TruckBNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckCNum\", \"range\": \"TruckCNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckDNum\", \"range\": \"TruckDNum >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckENum\", \"range\": \"TruckENum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the revenue per trip is $1000, and the operational cost per trip is $500.\nFor TruckB, the revenue per trip is $1500, and the operational cost per trip is $700.\nFor TruckC, the revenue per trip is $2000, and the operational cost per trip is $1000.\nFor TruckD, the revenue per trip is $1200, and the operational cost per trip is $600.\nFor TruckE, the revenue per trip is $1800, and the operational cost per trip is $900.\nThe company wants to maximize the total net profit from all trucks.\n// Total net profit for TruckA: Profit_TruckA = (1000 - 500) * TruckANum\n// Total net profit for TruckB: Profit_TruckB = (1500 - 700) * TruckBNum\n// Total net profit for TruckC: Profit_TruckC = (2000 - 1000) * TruckCNum\n// Total net profit for TruckD: Profit_TruckD = (1200 - 600) * TruckDNum\n// Total net profit for TruckE: Profit_TruckE = (1800 - 900) * TruckENum\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company has five types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. Each type of truck has different capacities and operational costs. For TruckA, the revenue per trip is $1000, and the operational cost per trip is $500. For TruckB, the revenue per trip is $1500, and the operational cost per trip is $700. For TruckC, the revenue per trip is $2000, and the operational cost per trip is $1000. For TruckD, the revenue per trip is $1200, and the operational cost per trip is $600. For TruckE, the revenue per trip is $1800, and the operational cost per trip is $900. The company wants to maximize the total net profit from all trucks. The company has a total of 50 trucks available. Please help the company determine the number of each type of truck to maximize its profit while considering operational constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckANum = model.addVar(vtype=\"INTEGER\", name=\"TruckANum\", lb=0) # number of TruckA\nTruckBNum = model.addVar(vtype=\"INTEGER\", name=\"TruckBNum\", lb=0) # number of TruckB\nTruckCNum = model.addVar(vtype=\"INTEGER\", name=\"TruckCNum\", lb=0) # number of TruckC\nTruckDNum = model.addVar(vtype=\"INTEGER\", name=\"TruckDNum\", lb=0) # number of TruckD\nTruckENum = model.addVar(vtype=\"INTEGER\", name=\"TruckENum\", lb=0) # number of TruckE\n\n# Define objective function\nProfit_TruckA = (1000 - 500) * TruckANum\nProfit_TruckB = (1500 - 700) * TruckBNum\nProfit_TruckC = (2000 - 1000) * TruckCNum\nProfit_TruckD = (1200 - 600) * TruckDNum\nProfit_TruckE = (1800 - 900) * TruckENum\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\nmodel.addCons(TruckANum + TruckBNum + TruckCNum + TruckDNum + TruckENum <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckANum))\n    print(\"Number of TruckB: \", model.getVal(TruckBNum))\n    print(\"Number of TruckC: \", model.getVal(TruckCNum))\n    print(\"Number of TruckD: \", model.getVal(TruckDNum))\n    print(\"Number of TruckE: \", model.getVal(TruckENum))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"quantity of goods to City1\": \"City1\", \"range\": \"City1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City2\": \"City2\", \"range\": \"City2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City3\": \"City3\", \"range\": \"City3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City4\": \"City4\", \"range\": \"City4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of goods to City5\": \"City5\", \"range\": \"City5 >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for City5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered. The fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time.\n// Fuel_Cost_City1 = (Fuel1^2) * City1\n// Fuel_Cost_City2 = (Fuel2^2) * City2\n// Fuel_Cost_City3 = (Fuel3^2) * City3\n// Fuel_Cost_City4 = (Fuel4^2) * City4\n// Fuel_Cost_City5 = (Fuel5^2) * City5\n// So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n## Generate Constraint-1:\nThe total fuel budget across all cities must not exceed $10,000.\n// Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000\n\n## Generate Constraint-2:\nThe company must deliver at least 500 units of goods to each city.\n// City1 >= 500; City2 >= 500; City3 >= 500; City4 >= 500; City5 >= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered, where the fuel cost increases quadratically with the fuel budget and linearly with the quantity of goods. The company aims to minimize the total fuel cost while ensuring all deliveries are made on time. The total fuel budget across all cities must not exceed $10,000. The company must deliver at least 500 units of goods to each city. Please help the company determine the optimal quantity of goods and fuel budget for each city to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deliver at least 500 units of goods to each city.\nCity1 = model.addVar(vtype=\"INTEGER\", name=\"City1\", lb=500) # quantity of goods to City1\nCity2 = model.addVar(vtype=\"INTEGER\", name=\"City2\", lb=500) # quantity of goods to City2\nCity3 = model.addVar(vtype=\"INTEGER\", name=\"City3\", lb=500) # quantity of goods to City3\nCity4 = model.addVar(vtype=\"INTEGER\", name=\"City4\", lb=500) # quantity of goods to City4\nCity5 = model.addVar(vtype=\"INTEGER\", name=\"City5\", lb=500) # quantity of goods to City5\n\n## Fuel budget for each city\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0) # fuel budget for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0) # fuel budget for City2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0) # fuel budget for City3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0) # fuel budget for City4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0) # fuel budget for City5\n\n# Define objective function\n## The fuel cost for each city is a nonlinear function of the fuel budget and the quantity of goods delivered.\nFuel_Cost_City1 = Fuel1**2 * City1\nFuel_Cost_City2 = Fuel2**2 * City2\nFuel_Cost_City3 = Fuel3**2 * City3\nFuel_Cost_City4 = Fuel4**2 * City4\nFuel_Cost_City5 = Fuel5**2 * City5\n## So, the objective function is: Minimize (Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_City1 + Fuel_Cost_City2 + Fuel_Cost_City3 + Fuel_Cost_City4 + Fuel_Cost_City5)\n\n# Add constraints\n## The total fuel budget across all cities must not exceed $10,000.\nmodel.addCons(Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of goods to City1: \", model.getVal(City1))\n    print(\"Quantity of goods to City2: \", model.getVal(City2))\n    print(\"Quantity of goods to City3: \", model.getVal(City3))\n    print(\"Quantity of goods to City4: \", model.getVal(City4))\n    print(\"Quantity of goods to City5: \", model.getVal(City5))\n    print(\"Fuel budget for City1: \", model.getVal(Fuel1))\n    print(\"Fuel budget for City2: \", model.getVal(Fuel2))\n    print(\"Fuel budget for City3: \", model.getVal(Fuel3))\n    print(\"Fuel budget for City4: \", model.getVal(Fuel4))\n    print(\"Fuel budget for City5: \", model.getVal(Fuel5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed.\n// {\"fuel consumption rate of Truck1\": \"Truck1_FuelRate\", \"range\": \"Truck1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck2\": \"Truck2_FuelRate\", \"range\": \"Truck2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Truck3\": \"Truck3_FuelRate\", \"range\": \"Truck3_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van1\": \"Van1_FuelRate\", \"range\": \"Van1_FuelRate >= 0\", \"type\": \"real\"}\n// {\"fuel consumption rate of Van2\": \"Van2_FuelRate\", \"range\": \"Van2_FuelRate >= 0\", \"type\": \"real\"}\n// {\"speed of Truck1\": \"Truck1_Speed\", \"range\": \"Truck1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck2\": \"Truck2_Speed\", \"range\": \"Truck2_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Truck3\": \"Truck3_Speed\", \"range\": \"Truck3_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van1\": \"Van1_Speed\", \"range\": \"Van1_Speed >= 0\", \"type\": \"real\"}\n// {\"speed of Van2\": \"Van2_Speed\", \"range\": \"Van2_Speed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type.\n// Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\n// So, the objective function is: Minimize Objective\n\n## Generate Constraint-1:\nThe total fuel consumption for all vehicles must not exceed 1000 liters.\n// Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000",
        "question": "A logistics company is planning its routes for five different types of vehicles (Truck1, Truck2, Truck3, Van1, and Van2) to optimize fuel consumption and delivery times. Each vehicle has a different fuel efficiency and speed. The company wants to minimize the total time and fuel consumption for all deliveries. The objective is to minimize the product of fuel consumption rate and speed for each vehicle type. The following table provides the fuel consumption rates and speeds for each vehicle.\n\n| Vehicle | Fuel Consumption Rate | Speed |\n|---------|----------------------|-------|\n| Truck1  | Truck1_FuelRate      | Truck1_Speed |\n| Truck2  | Truck2_FuelRate      | Truck2_Speed |\n| Truck3  | Truck3_FuelRate      | Truck3_Speed |\n| Van1    | Van1_FuelRate        | Van1_Speed |\n| Van2    | Van2_FuelRate        | Van2_Speed |\n\nThe total fuel consumption for all vehicles must not exceed 1000 liters. Please help the company determine the optimal fuel consumption rates and speeds for each vehicle to minimize the total time and fuel consumption for all deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_FuelRate\", lb=0)\nTruck2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_FuelRate\", lb=0)\nTruck3_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_FuelRate\", lb=0)\nVan1_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_FuelRate\", lb=0)\nVan2_FuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_FuelRate\", lb=0)\nTruck1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1_Speed\", lb=0)\nTruck2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2_Speed\", lb=0)\nTruck3_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3_Speed\", lb=0)\nVan1_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van1_Speed\", lb=0)\nVan2_Speed = model.addVar(vtype=\"CONTINUOUS\", name=\"Van2_Speed\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Objective = Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed\nmodel.addCons(obj == Truck1_FuelRate * Truck1_Speed + Truck2_FuelRate * Truck2_Speed + Truck3_FuelRate * Truck3_Speed + Van1_FuelRate * Van1_Speed + Van2_FuelRate * Van2_Speed)\n\n# Add constraints\n## The total fuel consumption for all vehicles must not exceed 1000 liters.\nmodel.addCons(Truck1_FuelRate + Truck2_FuelRate + Truck3_FuelRate + Van1_FuelRate + Van2_FuelRate <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Consumption Rate of Truck1: \", model.getVal(Truck1_FuelRate))\n    print(\"Fuel Consumption Rate of Truck2: \", model.getVal(Truck2_FuelRate))\n    print(\"Fuel Consumption Rate of Truck3: \", model.getVal(Truck3_FuelRate))\n    print(\"Fuel Consumption Rate of Van1: \", model.getVal(Van1_FuelRate))\n    print(\"Fuel Consumption Rate of Van2: \", model.getVal(Van2_FuelRate))\n    print(\"Speed of Truck1: \", model.getVal(Truck1_Speed))\n    print(\"Speed of Truck2: \", model.getVal(Truck2_Speed))\n    print(\"Speed of Truck3: \", model.getVal(Truck3_Speed))\n    print(\"Speed of Van1: \", model.getVal(Van1_Speed))\n    print(\"Speed of Van2: \", model.getVal(Van2_Speed))\n    print(\"Minimized Objective Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg and costs $500 per day to operate. Each Van can carry 500 kg and costs $300 per day to operate. Each Bike can carry 100 kg and costs $100 per day to operate. The company aims to maximize the total carrying capacity while minimizing the total daily operational cost.\n// Objective function: Maximize (1000 * Trucks + 500 * Vans + 100 * Bikes) / (500 * Trucks + 300 * Vans + 100 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 per month for vehicle operations.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 15000\n\n## Generate Constraint-2:\nThe total carrying capacity must be at least 50,000 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 vehicles in total.\n// Trucks + Vans + Bikes <= 50\n\n## Generate Constraint-4:\nThe number of Trucks must not exceed the combined number of Vans and Bikes.\n// Trucks <= Vans + Bikes\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles.\n// Bikes <= 0.2 * (Trucks + Vans + Bikes)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many of each vehicle type to deploy for the upcoming month to optimize its operations. The carrying capacity and daily operational cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Carrying Capacity | Daily Operational Cost |\n|--------------|-------------------|------------------------|\n| Trucks       | 1000 kg           | $500                   |\n| Vans         | 500 kg            | $300                   |\n| Bikes        | 100 kg            | $100                   |\n\nThe company has a budget of $15,000 per month for vehicle operations. The total carrying capacity must be at least 50,000 kg. The company can only operate a maximum of 50 vehicles in total. The number of Trucks must not exceed the combined number of Vans and Bikes. The company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles.\n\nPlease help the company to maximize the total carrying capacity while minimizing the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCarryingCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes\nOperationalCost = 500 * Trucks + 300 * Vans + 100 * Bikes\n## the objective function is: Maximize (CarryingCapacity) / (OperationalCost)\n## convert the division to multiplication\nmodel.addCons(obj * OperationalCost == CarryingCapacity)\n\n# Add constraints\n## The company has a budget of $15,000 per month for vehicle operations.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 15000)\n## The total carrying capacity must be at least 50,000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 50000)\n## The company can only operate a maximum of 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes <= 50)\n## The number of Trucks must not exceed the combined number of Vans and Bikes.\nmodel.addCons(Trucks <= Vans + Bikes)\n## The company wants to ensure that the number of Bikes does not exceed 20% of the total number of vehicles.\nmodel.addCons(Bikes <= 0.2 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Carrying Capacity per Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region to optimize fuel efficiency and reduce operational costs. Additionally, the company is considering investing in hybrid technology for some of its trucks to further enhance fuel efficiency.\n// {\"number of trucks allocated to Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Region1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Region3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of trucks increases with the investment in hybrid technology. For every $1000 invested in hybrid technology, the fuel efficiency of a truck improves by 1%. The company aims to minimize the total fuel consumption across all regions.\nThe fuel consumption of a non-hybrid truck in Region1 is 100 liters per 1000 km, in Region2 is 120 liters per 1000 km, and in Region3 is 110 liters per 1000 km.\n// Fuel consumption for Region1: Consumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\n// Fuel consumption for Region2: Consumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\n// Fuel consumption for Region3: Consumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\n// So, the objective function is: Minimize (Consumption1 + Consumption2 + Consumption3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 100 trucks to Region1 and 150 trucks to Region2.\n// Trucks1 >= 100; Trucks2 >= 150",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region and the investment in hybrid technology for each region to optimize fuel efficiency and reduce operational costs. The fuel consumption of a non-hybrid truck in each region and the impact of hybrid technology on fuel efficiency are given in the following Table.\n\n| Region | Fuel Consumption (non-hybrid) | Impact of Hybrid Technology |\n|--------|-------------------------------|-----------------------------|\n| Region1 | 100 liters per 1000 km       | 1% improvement per $1000    |\n| Region2 | 120 liters per 1000 km       | 1% improvement per $1000    |\n| Region3 | 110 liters per 1000 km       | 1% improvement per $1000    |\n\nThe company has a total budget of $100,000 for truck allocation and hybrid technology investments. The total number of trucks available for allocation is limited to 500. Due to contractual obligations, the company must allocate at least 100 trucks to Region1 and 150 trucks to Region2.\nPlease help the company to minimize the total fuel consumption across all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=100)  # number of trucks allocated to Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=150)  # number of trucks allocated to Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks allocated to Region3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for Region1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for Region2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for Region3\n\n# Define objective function\nConsumption1 = 100 * (1 - 0.001 * Hybrid1) * Trucks1\nConsumption2 = 120 * (1 - 0.001 * Hybrid2) * Trucks2\nConsumption3 = 110 * (1 - 0.001 * Hybrid3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2 + Consumption3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Hybrid1 + Hybrid2 + Hybrid3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Hybrid Technology for Region1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Region2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Region3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity and fuel efficiency. The company needs to determine how many units of each truck type to deploy for an upcoming project.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the capacity is 10 tons, the fuel consumption is 5 liters per 100 km, and the cost is $100 per day.\nFor Truck B, the capacity is 15 tons, the fuel consumption is 7 liters per 100 km, and the cost is $150 per day.\nFor Truck C, the capacity is 20 tons, the fuel consumption is 9 liters per 100 km, and the cost is $200 per day.\nFor Truck D, the capacity is 25 tons, the fuel consumption is 11 liters per 100 km, and the cost is $250 per day.\nFor Truck E, the capacity is 30 tons, the fuel consumption is 13 liters per 100 km, and the cost is $300 per day.\nThe company aims to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.\n// Total capacity utilized: Capacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n// Total fuel consumed: Fuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// So, the objective function is: Maximize Capacity / Fuel\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for truck leasing.\n// 100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000\n\n## Generate Constraint-2:\nThe total capacity of the trucks must be at least 500 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates a fleet of five different types of trucks: A, B, C, D, and E. Each truck has a different capacity, fuel consumption, and daily cost. The company needs to determine how many units of each truck type to deploy for an upcoming project. The details for each truck type are given in the following Table.\n\n| Truck Type | Capacity (tons) | Fuel Consumption (liters/100 km) | Daily Cost ($) |\n|------------|-----------------|----------------------------------|----------------|\n| A          | 10              | 5                                | 100            |\n| B          | 15              | 7                                | 150            |\n| C          | 20              | 9                                | 200            |\n| D          | 25              | 11                               | 250            |\n| E          | 30              | 13                               | 300            |\n\nThe company has a budget of $10,000 per day for truck leasing. The total capacity of the trucks must be at least 500 tons. The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C. Additionally, the company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D. \n\nPlease help the company to maximize the efficiency of its fleet, which is defined as the total capacity utilized divided by the total fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCapacity = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\nFuel = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n## the objective function is: Maximize Capacity / Fuel\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Capacity)\n\n# Add constraints\n## The company has a budget of $10,000 per day for truck leasing.\nmodel.addCons(100 * A + 150 * B + 200 * C + 250 * D + 300 * E <= 10000)\n## The total capacity of the trucks must be at least 500 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 500)\n## The company wants to ensure that the number of Truck D does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1443,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per small truck\": \"DriversPerSmallTruck\", \"range\": \"DriversPerSmallTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per medium truck\": \"DriversPerMediumTruck\", \"range\": \"DriversPerMediumTruck >= 0\", \"type\": \"integer\"}\n// {\"number of drivers per large truck\": \"DriversPerLargeTruck\", \"range\": \"DriversPerLargeTruck >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of maintenance per small truck is $100 per day, and the fuel efficiency is 10 miles per gallon.\nThe cost of maintenance per medium truck is $200 per day, and the fuel efficiency is 8 miles per gallon.\nThe cost of maintenance per large truck is $300 per day, and the fuel efficiency is 6 miles per gallon.\nThe company wants to minimize the total daily operational cost, which includes maintenance and fuel costs.\n// Cost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\n// Cost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\n// Cost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for daily operational costs.\n// 100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50\n\n## Generate Constraint-3:\nThe company has a daily delivery capacity of 1000 miles.\n// 10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000\n\n## Generate Constraint-4:\nThe company aims to have at least 10 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks >= 10",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company needs to decide the number of small, medium, and large trucks to purchase, as well as the number of drivers assigned to each type of truck. The cost of maintenance and fuel efficiency varies by truck size. The company wants to minimize the total daily operational cost, which includes maintenance and fuel costs. The details of each type of truck are given in the following Table.\n\n| Truck Type       | Maintenance Cost per Day | Fuel Efficiency (miles per gallon) |\n|------------------|--------------------------|------------------------------------|\n| Small            | $100                     | 10                                 |\n| Medium           | $200                     | 8                                  |\n| Large            | $300                     | 6                                  |\n\nThe company has a total budget of $5000 for daily operational costs. The company has a total of 50 drivers available. The company has a daily delivery capacity of 1000 miles. The company aims to have at least 10 trucks in total.\n\nPlease help the company to determine the optimal number of small, medium, and large trucks, as well as the number of drivers assigned to each type of truck to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nDriversPerSmallTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerSmallTruck\", lb=0)\nDriversPerMediumTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerMediumTruck\", lb=0)\nDriversPerLargeTruck = model.addVar(vtype=\"INTEGER\", name=\"DriversPerLargeTruck\", lb=0)\n\n# Define objective function\nFuelPrice = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelPrice\")\nCost_Small = 100 * SmallTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice\nCost_Medium = 200 * MediumTrucks + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice\nCost_Large = 300 * LargeTrucks + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large)\n\n# Add constraints\nmodel.addCons(100 * SmallTrucks + 200 * MediumTrucks + 300 * LargeTrucks + 10 * SmallTrucks * DriversPerSmallTruck * FuelPrice + 8 * MediumTrucks * DriversPerMediumTruck * FuelPrice + 6 * LargeTrucks * DriversPerLargeTruck * FuelPrice <= 5000)\nmodel.addCons(SmallTrucks * DriversPerSmallTruck + MediumTrucks * DriversPerMediumTruck + LargeTrucks * DriversPerLargeTruck <= 50)\nmodel.addCons(10 * SmallTrucks * DriversPerSmallTruck + 8 * MediumTrucks * DriversPerMediumTruck + 6 * LargeTrucks * DriversPerLargeTruck <= 1000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Drivers per Small Truck: \", model.getVal(DriversPerSmallTruck))\n    print(\"Drivers per Medium Truck: \", model.getVal(DriversPerMediumTruck))\n    print(\"Drivers per Large Truck: \", model.getVal(DriversPerLargeTruck))\n    print(\"Fuel Price: \", model.getVal(FuelPrice))\n    print(\"Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to maximize the efficiency of the renewable energy production.\n// {\"number of solar panels in RegionA\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionA\": \"WindA\", \"range\": \"WindA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionB\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionB\": \"WindB\", \"range\": \"WindB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in RegionC\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in RegionC\": \"WindC\", \"range\": \"WindC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage systems\": \"StorageInvestment\", \"range\": \"StorageInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. The efficiency of wind turbines increases by 0.5% for every $10,000 invested in energy storage systems. The initial efficiency of solar panels is 15%, and the initial efficiency of wind turbines is 30%. The company aims to maximize the total energy production.\n// Total energy production from solar panels in RegionA: EnergyA_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarA\n// Total energy production from wind turbines in RegionA: EnergyA_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindA\n// Total energy production from solar panels in RegionB: EnergyB_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarB\n// Total energy production from wind turbines in RegionB: EnergyB_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindB\n// Total energy production from solar panels in RegionC: EnergyC_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarC\n// Total energy production from wind turbines in RegionC: EnergyC_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindC\n// So, the objective function is: Maximize (EnergyA_Solar + EnergyA_Wind + EnergyB_Solar + EnergyB_Wind + EnergyC_Solar + EnergyC_Wind)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarA + 2000 * WindA + 1000 * SolarB + 2000 * WindB + 1000 * SolarC + 2000 * WindC <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage systems cannot exceed $50,000.\n// StorageInvestment <= 50000\n\n## Generate Constraint-3:\nThe total number of solar panels and wind turbines in each region cannot exceed 100.\n// SolarA + WindA <= 100; SolarB + WindB <= 100; SolarC + WindC <= 100",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: RegionA, RegionB, and RegionC. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to maximize the efficiency of the renewable energy production. The efficiency of solar panels increases by 1% for every $10,000 invested in energy storage systems. The efficiency of wind turbines increases by 0.5% for every $10,000 invested in energy storage systems. The initial efficiency of solar panels is 15%, and the initial efficiency of wind turbines is 30%. The company aims to maximize the total energy production. The company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage systems cannot exceed $50,000. The total number of solar panels and wind turbines in each region cannot exceed 100. Please help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels in RegionA\nWindA = model.addVar(vtype=\"INTEGER\", name=\"WindA\", lb=0) # number of wind turbines in RegionA\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels in RegionB\nWindB = model.addVar(vtype=\"INTEGER\", name=\"WindB\", lb=0) # number of wind turbines in RegionB\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels in RegionC\nWindC = model.addVar(vtype=\"INTEGER\", name=\"WindC\", lb=0) # number of wind turbines in RegionC\nStorageInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"StorageInvestment\", lb=0) # investment in energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergyA_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarA\nEnergyA_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindA\nEnergyB_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarB\nEnergyB_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindB\nEnergyC_Solar = 0.15 * (1 + 0.0001 * StorageInvestment) * SolarC\nEnergyC_Wind = 0.30 * (1 + 0.00005 * StorageInvestment) * WindC\n## the objective function is: Maximize (EnergyA_Solar + EnergyA_Wind + EnergyB_Solar + EnergyB_Wind + EnergyC_Solar + EnergyC_Wind)\nmodel.addCons(obj == EnergyA_Solar + EnergyA_Wind + EnergyB_Solar + EnergyB_Wind + EnergyC_Solar + EnergyC_Wind)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\nmodel.addCons(1000 * SolarA + 2000 * WindA + 1000 * SolarB + 2000 * WindB + 1000 * SolarC + 2000 * WindC <= 1000000)\n## The total investment in energy storage systems cannot exceed $50,000.\nmodel.addCons(StorageInvestment <= 50000)\n## The total number of solar panels and wind turbines in each region cannot exceed 100.\nmodel.addCons(SolarA + WindA <= 100)\nmodel.addCons(SolarB + WindB <= 100)\nmodel.addCons(SolarC + WindC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in RegionA: \", model.getVal(SolarA))\n    print(\"Number of Wind Turbines in RegionA: \", model.getVal(WindA))\n    print(\"Number of Solar Panels in RegionB: \", model.getVal(SolarB))\n    print(\"Number of Wind Turbines in RegionB: \", model.getVal(WindB))\n    print(\"Number of Solar Panels in RegionC: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines in RegionC: \", model.getVal(WindC))\n    print(\"Investment in Energy Storage Systems: \", model.getVal(StorageInvestment))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\n// {\"number of trucks\": \"TruckCount\", \"range\": \"TruckCount >= 0\", \"type\": \"integer\"}\n// {\"fuel-efficient upgrades per truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"maintenance frequency\": \"MaintenanceFreq\", \"range\": \"MaintenanceFreq >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\n// FuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount^2\n// MaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq^2 * TruckCount\n// So, the objective function is: Minimize (FuelCost + MaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\n// FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000\n\n## Generate Constraint-2:\nThe minimum number of trucks required for the route is 10.\n// TruckCount >= 10\n\n## Generate Constraint-3:\nThe maximum number of maintenance checks allowed per truck is 12 per year.\n// MaintenanceFreq <= 12\n\n## Generate Constraint-4:\nThe total weight capacity of all trucks combined must not exceed 1000 tons.\n// TruckCount <= 1000\n\n## Generate Constraint-5:\nThe fuel-efficient upgrades must not exceed $5000 per truck.\n// FuelUpgrade <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and maintenance costs for a long-haul route. The company must decide on the number of trucks to deploy (TruckCount) and the level of fuel-efficient upgrades (FuelUpgrade) for each truck. Additionally, the company must determine the frequency of maintenance checks (MaintenanceFreq) to minimize operational costs while ensuring reliability and safety.\n\nThe fuel consumption of each truck decreases quadratically with the investment in fuel-efficient upgrades, starting at a base rate of 500 gallons per trip and decreasing by 0.001 gallons per dollar invested. The maintenance cost per truck increases linearly with the frequency of checks, starting at a base cost of $1000 per check and increasing by $50 per additional check. The company aims to minimize the total operational cost, which is the sum of fuel and maintenance costs.\n\nThe company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks. The minimum number of trucks required for the route is 10. The maximum number of maintenance checks allowed per truck is 12 per year. The total weight capacity of all trucks combined must not exceed 1000 tons. The fuel-efficient upgrades must not exceed $5000 per truck.\n\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckCount = model.addVar(vtype=\"INTEGER\", name=\"TruckCount\", lb=10)  # number of trucks\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0)  # fuel-efficient upgrades per truck\nMaintenanceFreq = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceFreq\", lb=0, ub=12)  # maintenance frequency\n\n# Define objective function\nFuelCost = 500 * TruckCount - 0.001 * FuelUpgrade * TruckCount**2\nMaintenanceCost = 1000 * MaintenanceFreq * TruckCount + 50 * MaintenanceFreq**2 * TruckCount\n# So, the objective function is: Minimize (FuelCost + MaintenanceCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost + MaintenanceCost)\n\n# Add constraints\n# The company has a budget of $100,000 for fuel-efficient upgrades and maintenance checks.\nmodel.addCons(FuelUpgrade * TruckCount + MaintenanceFreq * TruckCount <= 100000)\n# The minimum number of trucks required for the route is 10.\nmodel.addCons(TruckCount >= 10)\n# The maximum number of maintenance checks allowed per truck is 12 per year.\nmodel.addCons(MaintenanceFreq <= 12)\n# The total weight capacity of all trucks combined must not exceed 1000 tons.\nmodel.addCons(TruckCount <= 1000)\n# The fuel-efficient upgrades must not exceed $5000 per truck.\nmodel.addCons(FuelUpgrade <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(TruckCount))\n    print(\"Fuel-efficient Upgrades per Truck: \", model.getVal(FuelUpgrade))\n    print(\"Maintenance Frequency: \", model.getVal(MaintenanceFreq))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1347,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The revenue per unit of ProductA is $120, ProductB is $180, and ProductC is $220. The new technology reduces the production cost per unit by $1 for every $10,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n// Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n// Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs for all products. The investment cost for the new technology is a variable that affects the overall cost function. The production cost per unit, revenue per unit, and the effect of the new technology on production costs are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit | Reduction in Cost per Unit per $10,000 Tech Investment |\n|---------|--------------------------|------------------|-------------------------------------------------------|\n| ProductA | $100                     | $120             | $1                                                   |\n| ProductB | $150                     | $180             | $1                                                   |\n| ProductC | $200                     | $220             | $1                                                   |\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in the new technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal production quantities for ProductA, ProductB, and ProductC, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\n## Total profit for ProductB: ProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\n## Total profit for ProductC: ProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\nProfitA = (120 - (100 - 0.0001 * TechInvestment)) * QuantityA\nProfitB = (180 - (150 - 0.0001 * TechInvestment)) * QuantityB\nProfitC = (220 - (200 - 0.0001 * TechInvestment)) * QuantityC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC - TechInvestment)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC - TechInvestment)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1609,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. They need to determine the production quantity for each device to optimize their profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceA_Qty\", \"range\": \"DeviceA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_Qty\", \"range\": \"DeviceB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_Qty\", \"range\": \"DeviceC_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceD_Qty\", \"range\": \"DeviceD_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $100, and for DeviceD is $120. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by: Cost_A = 20 * sqrt(DeviceA_Qty), Cost_B = 30 * sqrt(DeviceB_Qty), Cost_C = 40 * sqrt(DeviceC_Qty), Cost_D = 50 * sqrt(DeviceD_Qty). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 - 20 * sqrt(DeviceA_Qty)) * DeviceA_Qty\n// Total net profit for DeviceB: Profit_B = (70 - 30 * sqrt(DeviceB_Qty)) * DeviceB_Qty\n// Total net profit for DeviceC: Profit_C = (100 - 40 * sqrt(DeviceC_Qty)) * DeviceC_Qty\n// Total net profit for DeviceD: Profit_D = (120 - 50 * sqrt(DeviceD_Qty)) * DeviceD_Qty\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// DeviceA_Qty + DeviceB_Qty + DeviceC_Qty + DeviceD_Qty <= 10,000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceA_Qty <= 2 * DeviceB_Qty\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $500,000 per month. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, for DeviceC is $20 per unit, and for DeviceD is $25 per unit.\n// 10 * DeviceA_Qty + 15 * DeviceB_Qty + 20 * DeviceC_Qty + 25 * DeviceD_Qty <= 500,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. They need to determine the production quantity for each device to optimize their profit while considering various constraints. The profit per unit and the cost of raw materials for each device are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit |\n|--------|-----------------|----------------------------|\n| DeviceA | $50             | $10                        |\n| DeviceB | $70             | $15                        |\n| DeviceC | $100            | $20                        |\n| DeviceD | $120            | $25                        |\n\nThe production cost for each device increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each device is given by: Cost_A = 20 * sqrt(DeviceA_Qty), Cost_B = 30 * sqrt(DeviceB_Qty), Cost_C = 40 * sqrt(DeviceC_Qty), Cost_D = 50 * sqrt(DeviceD_Qty). The company wants to maximize the total net profit.\n\nThe company has a total production capacity of 10,000 units per month. Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB. The company has a limited budget for raw materials, which is $500,000 per month.\n\nPlease help the company to determine the optimal production quantity for each device to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Qty\", lb=0)\nDeviceB_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Qty\", lb=0)\nDeviceC_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Qty\", lb=0)\nDeviceD_Qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit for DeviceA: Profit_A = (50 - 20 * sqrt(DeviceA_Qty)) * DeviceA_Qty\n## Total net profit for DeviceB: Profit_B = (70 - 30 * sqrt(DeviceB_Qty)) * DeviceB_Qty\n## Total net profit for DeviceC: Profit_C = (100 - 40 * sqrt(DeviceC_Qty)) * DeviceC_Qty\n## Total net profit for DeviceD: Profit_D = (120 - 50 * sqrt(DeviceD_Qty)) * DeviceD_Qty\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n## Convert square root to a variable to handle non-linearity\nsqrt_DeviceA_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceA_Qty\")\nsqrt_DeviceB_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceB_Qty\")\nsqrt_DeviceC_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceC_Qty\")\nsqrt_DeviceD_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_DeviceD_Qty\")\nmodel.addCons(sqrt_DeviceA_Qty**2 == DeviceA_Qty)\nmodel.addCons(sqrt_DeviceB_Qty**2 == DeviceB_Qty)\nmodel.addCons(sqrt_DeviceC_Qty**2 == DeviceC_Qty)\nmodel.addCons(sqrt_DeviceD_Qty**2 == DeviceD_Qty)\nProfit_A = (50 - 20 * sqrt_DeviceA_Qty) * DeviceA_Qty\nProfit_B = (70 - 30 * sqrt_DeviceB_Qty) * DeviceB_Qty\nProfit_C = (100 - 40 * sqrt_DeviceC_Qty) * DeviceC_Qty\nProfit_D = (120 - 50 * sqrt_DeviceD_Qty) * DeviceD_Qty\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units per month.\nmodel.addCons(DeviceA_Qty + DeviceB_Qty + DeviceC_Qty + DeviceD_Qty <= 10000)\n## Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\nmodel.addCons(DeviceA_Qty <= 2 * DeviceB_Qty)\n## The company has a limited budget for raw materials, which is $500,000 per month.\nmodel.addCons(10 * DeviceA_Qty + 15 * DeviceB_Qty + 20 * DeviceC_Qty + 25 * DeviceD_Qty <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceA_Qty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceB_Qty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceC_Qty))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceD_Qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1411,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good and the frequency of trips per truck. The company also considers investing in fuel-efficient technologies for each type of truck to reduce operational costs.\n// {\"number of trucks for Heavy Machinery\": \"TrucksHM\", \"range\": \"TrucksHM >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Consumer Electronics\": \"TrucksCE\", \"range\": \"TrucksCE >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable Goods\": \"TrucksPG\", \"range\": \"TrucksPG >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Heavy Machinery\": \"TripsHM\", \"range\": \"TripsHM >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Consumer Electronics\": \"TripsCE\", \"range\": \"TripsCE >= 0\", \"type\": \"integer\"}\n// {\"frequency of trips per truck for Perishable Goods\": \"TripsPG\", \"range\": \"TripsPG >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Heavy Machinery\": \"InvestmentHM\", \"range\": \"InvestmentHM >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Consumer Electronics\": \"InvestmentCE\", \"range\": \"InvestmentCE >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Perishable Goods\": \"InvestmentPG\", \"range\": \"InvestmentPG >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its net profit, which is affected by the investment in fuel-efficient technologies. The net profit per trip for Heavy Machinery is $1000, which decreases by $10 for every $100 invested in fuel-efficient technology. The net profit per trip for Consumer Electronics is $800, which decreases by $8 for every $100 invested in fuel-efficient technology. The net profit per trip for Perishable Goods is $1200, which decreases by $12 for every $100 invested in fuel-efficient technology.\n// Net profit for Heavy Machinery: ProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\n// Net profit for Consumer Electronics: ProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\n// Net profit for Perishable Goods: ProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\n// So, the objective function is: Maximize (ProfitHM + ProfitCE + ProfitPG)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies.\n// 1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000\n\n## Generate Constraint-2:\nThe company has a total of 50 trucks available.\n// TrucksHM + TrucksCE + TrucksPG <= 50\n\n## Generate Constraint-3:\nThe operational capacity limits the total number of trips to 500 per day.\n// TrucksHM * TripsHM + TrucksCE * TripsCE + TrucksPG * TripsPG <= 500",
        "question": "A logistics company manages the transportation of three types of goods: Heavy Machinery, Consumer Electronics, and Perishable Goods. The company needs to optimize the number of trucks dedicated to each type of good and the frequency of trips per truck. The company also considers investing in fuel-efficient technologies for each type of truck to reduce operational costs.\nThe company aims to maximize its net profit, which is affected by the investment in fuel-efficient technologies. The net profit per trip for Heavy Machinery is $1000, which decreases by $10 for every $100 invested in fuel-efficient technology. The net profit per trip for Consumer Electronics is $800, which decreases by $8 for every $100 invested in fuel-efficient technology. The net profit per trip for Perishable Goods is $1200, which decreases by $12 for every $100 invested in fuel-efficient technology.\nThe company has a total budget of $100,000 for both truck operations and investments in fuel-efficient technologies. The company has a total of 50 trucks available. The operational capacity limits the total number of trips to 500 per day.\nPlease help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksHM = model.addVar(vtype=\"INTEGER\", name=\"TrucksHM\", lb=0)  # number of trucks for Heavy Machinery\nTrucksCE = model.addVar(vtype=\"INTEGER\", name=\"TrucksCE\", lb=0)  # number of trucks for Consumer Electronics\nTrucksPG = model.addVar(vtype=\"INTEGER\", name=\"TrucksPG\", lb=0)  # number of trucks for Perishable Goods\nTripsHM = model.addVar(vtype=\"INTEGER\", name=\"TripsHM\", lb=0)  # frequency of trips per truck for Heavy Machinery\nTripsCE = model.addVar(vtype=\"INTEGER\", name=\"TripsCE\", lb=0)  # frequency of trips per truck for Consumer Electronics\nTripsPG = model.addVar(vtype=\"INTEGER\", name=\"TripsPG\", lb=0)  # frequency of trips per truck for Perishable Goods\nInvestmentHM = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentHM\", lb=0)  # investment in fuel-efficient technology for Heavy Machinery\nInvestmentCE = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentCE\", lb=0)  # investment in fuel-efficient technology for Consumer Electronics\nInvestmentPG = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentPG\", lb=0)  # investment in fuel-efficient technology for Perishable Goods\n\n# Define objective function\nProfitHM = (1000 - 0.1 * InvestmentHM) * TrucksHM * TripsHM\nProfitCE = (800 - 0.08 * InvestmentCE) * TrucksCE * TripsCE\nProfitPG = (1200 - 0.12 * InvestmentPG) * TrucksPG * TripsPG\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitHM + ProfitCE + ProfitPG)\n\n# Add constraints\nmodel.addCons(1000 * TrucksHM * TripsHM + 800 * TrucksCE * TripsCE + 1200 * TrucksPG * TripsPG + InvestmentHM + InvestmentCE + InvestmentPG <= 100000)\nmodel.addCons(TrucksHM + TrucksCE + TrucksPG <= 50)\nmodel.addCons(TrucksHM * TripsHM + TrucksCE * TripsCE + TrucksPG * TripsPG <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(TrucksHM))\n    print(\"Number of Trucks for Consumer Electronics: \", model.getVal(TrucksCE))\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(TrucksPG))\n    print(\"Frequency of Trips for Heavy Machinery: \", model.getVal(TripsHM))\n    print(\"Frequency of Trips for Consumer Electronics: \", model.getVal(TripsCE))\n    print(\"Frequency of Trips for Perishable Goods: \", model.getVal(TripsPG))\n    print(\"Investment in Fuel-Efficient Technology for Heavy Machinery: \", model.getVal(InvestmentHM))\n    print(\"Investment in Fuel-Efficient Technology for Consumer Electronics: \", model.getVal(InvestmentCE))\n    print(\"Investment in Fuel-Efficient Technology for Perishable Goods: \", model.getVal(InvestmentPG))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs.\n// {\"number of turbines for Type1\": \"Turbines1\", \"range\": \"Turbines1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type2\": \"Turbines2\", \"range\": \"Turbines2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines for Type3\": \"Turbines3\", \"range\": \"Turbines3 >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Type1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Type3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n// NetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\n// NetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\n// NetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n// So, the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\n\n## Generate Constraint-1:\nThe total maintenance budget for all wind farms is $100,000.\n// Maintenance1 + Maintenance2 + Maintenance3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limit of 100 turbines that can be installed across all types.\n// Turbines1 + Turbines2 + Turbines3 <= 100",
        "question": "A renewable energy company operates three types of wind farms: Type1, Type2, and Type3. The company needs to determine the number of turbines to install for each type of wind farm and the level of maintenance investment for each type to optimize energy output and minimize operational costs. The energy output of each turbine type is affected by the maintenance investment. For Type1, each $1000 investment increases the output by 1 MWh. For Type2, each $1000 investment increases the output by 1.5 MWh. For Type3, each $1000 investment increases the output by 2 MWh. The operational cost per MWh is $50 for Type1, $40 for Type2, and $30 for Type3. The company aims to maximize the net profit from energy sales.\n\n| Wind Farm Type | Maintenance Investment Impact per $1000 | Operational Cost per MWh |\n|-----------------|-----------------------------------------|--------------------------|\n| Type1           | 1 MWh                                   | $50                      |\n| Type2           | 1.5 MWh                                 | $40                      |\n| Type3           | 2 MWh                                   | $30                      |\n\nThe total maintenance budget for all wind farms is $100,000. The company has a limit of 100 turbines that can be installed across all types.\n\nPlease help the company to maximize the net profit from energy sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"Turbines1\", lb=0)  # number of turbines for Type1\nTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"Turbines2\", lb=0)  # number of turbines for Type2\nTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"Turbines3\", lb=0)  # number of turbines for Type3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance investment for Type1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance investment for Type2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance investment for Type3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit1 = (1 * Maintenance1 / 1000) * Turbines1 * (100 - 50)\nNetProfit2 = (1.5 * Maintenance2 / 1000) * Turbines2 * (100 - 40)\nNetProfit3 = (2 * Maintenance3 / 1000) * Turbines3 * (100 - 30)\n## the objective function is: Maximize (NetProfit1 + NetProfit2 + NetProfit3)\nmodel.addCons(obj == NetProfit1 + NetProfit2 + NetProfit3)\n\n# Add constraints\n## The total maintenance budget for all wind farms is $100,000.\nmodel.addCons(Maintenance1 + Maintenance2 + Maintenance3 <= 100000)\n## The company has a limit of 100 turbines that can be installed across all types.\nmodel.addCons(Turbines1 + Turbines2 + Turbines3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines for Type1: \", model.getVal(Turbines1))\n    print(\"Number of Turbines for Type2: \", model.getVal(Turbines2))\n    print(\"Number of Turbines for Type3: \", model.getVal(Turbines3))\n    print(\"Maintenance Investment for Type1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Investment for Type2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Investment for Type3: \", model.getVal(Maintenance3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision involves the number of solar panels and wind turbines to install, as well as the capacity of each type of installation.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of each solar panel (kW)\": \"SolarCapacity\", \"range\": \"SolarCapacity > 0\", \"type\": \"real\"}\n// {\"capacity of each wind turbine (kW)\": \"WindCapacity\", \"range\": \"WindCapacity > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of energy installations while ensuring sufficient energy generation. The cost function is nonlinear due to economies of scale and varying installation costs per unit.\n// Total cost of solar panels: CostSolar = 1000 * Solar * SolarCapacity^0.7\n// Total cost of wind turbines: CostWind = 2000 * Wind * WindCapacity^0.6\n// Total energy generation: Energy = Solar * SolarCapacity + Wind * WindCapacity\n// Objective function: Minimize CostSolar + CostWind\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for the installations.\n// 1000 * Solar * SolarCapacity^0.7 + 2000 * Wind * WindCapacity^0.6 <= 500000\n\n## Generate Constraint-2:\nThe total energy generation must meet or exceed 1000 kW.\n// Solar * SolarCapacity + Wind * WindCapacity >= 1000\n\n## Generate Constraint-3:\nThe company must install at least 5 solar panels and 3 wind turbines.\n// Solar >= 5\n// Wind >= 3\n\n## Generate Constraint-4:\nThe capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\n// SolarCapacity <= 20\n// WindCapacity <= 30",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. The decision involves the number of solar panels and wind turbines to install, as well as the capacity of each type of installation. The company aims to minimize the total cost of energy installations while ensuring sufficient energy generation. The cost function is nonlinear due to economies of scale and varying installation costs per unit. The company has a budget of $500,000 for the installations. The total energy generation must meet or exceed 1000 kW. The company must install at least 5 solar panels and 3 wind turbines. The capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\nPlease help the company to determine the optimal number of solar panels and wind turbines, and their respective capacities to minimize the total cost of energy installations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=5)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=3)  # number of wind turbines\nSolarCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarCapacity\", lb=0.01)  # capacity of each solar panel (kW)\nWindCapacity = model.addVar(vtype=\"CONTINUOUS\", name=\"WindCapacity\", lb=0.01)  # capacity of each wind turbine (kW)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostSolar = 1000 * Solar * SolarCapacity**0.7\nCostWind = 2000 * Wind * WindCapacity**0.6\nmodel.addCons(obj == CostSolar + CostWind)\n\n# Add constraints\n## The company has a budget of $500,000 for the installations.\nmodel.addCons(1000 * Solar * SolarCapacity**0.7 + 2000 * Wind * WindCapacity**0.6 <= 500000)\n## The total energy generation must meet or exceed 1000 kW.\nmodel.addCons(Solar * SolarCapacity + Wind * WindCapacity >= 1000)\n## The company must install at least 5 solar panels and 3 wind turbines.\nmodel.addCons(Solar >= 5)\nmodel.addCons(Wind >= 3)\n## The capacity of each solar panel must not exceed 20 kW, and the capacity of each wind turbine must not exceed 30 kW.\nmodel.addCons(SolarCapacity <= 20)\nmodel.addCons(WindCapacity <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Each Solar Panel (kW): \", model.getVal(SolarCapacity))\n    print(\"Capacity of Each Wind Turbine (kW): \", model.getVal(WindCapacity))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the energy production and storage.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases nonlinearly with the number of panels due to shading effects, modeled as 1/(1 + 0.01 * S^2). The efficiency of wind turbines decreases nonlinearly with the number of turbines due to interference effects, modeled as 1/(1 + 0.02 * W^2). The energy storage efficiency is linear and increases with the amount of storage. The company wants to maximize the total energy production and storage efficiency.\n// Solar_Efficiency = 1/(1 + 0.01 * S^2)\n// Wind_Efficiency = 1/(1 + 0.02 * W^2)\n// Storage_Efficiency = E\n// Total_Efficiency = Solar_Efficiency * S + Wind_Efficiency * W + Storage_Efficiency * E\n// So, the objective function is: Maximize Total_Efficiency\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of each solar panel is $1,000, each wind turbine is $5,000, and each unit of energy storage is $10,000.\n// 1000 * S + 5000 * W + 10000 * E <= 1000000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 10,000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 20 square meters.\n// 5 * S + 20 * W <= 10000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels and 20 wind turbines to meet the minimum requirements of the energy contract.\n// S >= 50; W >= 20",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. They need to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency of the energy production and storage. The efficiency of solar panels decreases nonlinearly with the number of panels due to shading effects, modeled as 1/(1 + 0.01 * S^2). The efficiency of wind turbines decreases nonlinearly with the number of turbines due to interference effects, modeled as 1/(1 + 0.02 * W^2). The energy storage efficiency is linear and increases with the amount of storage. The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage. The cost of each solar panel is $1,000, each wind turbine is $5,000, and each unit of energy storage is $10,000. The total area available for installation is limited to 10,000 square meters. Each solar panel requires 5 square meters, and each wind turbine requires 20 square meters. The company must install at least 50 solar panels and 20 wind turbines to meet the minimum requirements of the energy contract. Please help the company to maximize the total energy production and storage efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20)  # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # amount of energy storage\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Solar_Efficiency = 1/(1 + 0.01 * S^2)\n## Wind_Efficiency = 1/(1 + 0.02 * W^2)\n## Storage_Efficiency = E\n## Total_Efficiency = Solar_Efficiency * S + Wind_Efficiency * W + Storage_Efficiency * E\n## Convert non-linear terms to linear by introducing new variables and constraints\nS_squared = model.addVar(vtype=\"CONTINUOUS\", name=\"S_squared\")\nmodel.addCons(S_squared == S * S)\nSolar_Efficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Solar_Efficiency\")\nmodel.addCons(Solar_Efficiency == 1 / (1 + 0.01 * S_squared))\n\nW_squared = model.addVar(vtype=\"CONTINUOUS\", name=\"W_squared\")\nmodel.addCons(W_squared == W * W)\nWind_Efficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Wind_Efficiency\")\nmodel.addCons(Wind_Efficiency == 1 / (1 + 0.02 * W_squared))\n\nmodel.addCons(obj == Solar_Efficiency * S + Wind_Efficiency * W + E)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation of solar panels, wind turbines, and energy storage.\nmodel.addCons(1000 * S + 5000 * W + 10000 * E <= 1000000)\n## The total area available for installation is limited to 10,000 square meters.\nmodel.addCons(5 * S + 20 * W <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n// Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\n// Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\n// Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per day.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand. The profit per unit of product A is $20, product B is $30, and product C is $40. However, due to economies of scale, the profit per unit increases by $0.05 for each product when the production quantity exceeds 100 units. The company aims to maximize the total profit from the production and sale of these products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $20             |\n| B       | $30             |\n| C       | $40             |\n\nThe company has a total production capacity of 500 units per day. Please help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(20 + 0.05 * (ProductA - 100), 20) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 20 * A1 * A_b1 + (20 + 0.05 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(30 + 0.05 * (ProductB - 100), 30) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 30 * B1 * B_b1 + (30 + 0.05 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(40 + 0.05 * (ProductC - 100), 40) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 40 * C1 * C_b1 + (40 + 0.05 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries across different cities. The company must decide the number of trucks to deploy for each city, the amount of fuel to allocate per truck, and the investment in fuel-efficient technologies for each type of truck.\n// {\"number of trucks for City1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for City2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation per truck for City1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation per truck for City2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for City1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for City2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks is improved by investing in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption decreases by 5 liters per 100 km for City1 and 7 liters per 100 km for City2. The company aims to minimize the total fuel consumption across all trucks.\n// Fuel consumption for City1: Consumption1 = (100 - 0.05 * Tech1) * Trucks1 * Fuel1\n// Fuel consumption for City2: Consumption2 = (100 - 0.07 * Tech2) * Trucks2 * Fuel2\n// So, the objective function is: Minimize (Consumption1 + Consumption2)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for fuel and technology investments.\n// Fuel1 * Trucks1 + Fuel2 * Trucks2 + Tech1 + Tech2 <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries across different cities. The company must decide the number of trucks to deploy for each city, the amount of fuel to allocate per truck, and the investment in fuel-efficient technologies for each type of truck. The fuel efficiency of the trucks is improved by investing in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption decreases by 5 liters per 100 km for City1 and 7 liters per 100 km for City2. The company aims to minimize the total fuel consumption across all trucks. The company has a budget of $100,000 for fuel and technology investments. Please help the company to determine the optimal number of trucks, fuel allocation, and investment in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for City1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for City2\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel allocation per truck for City1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel allocation per truck for City2\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technologies for City1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technologies for City2\n\n# Define objective function\nConsumption1 = (100 - 0.05 * Tech1) * Trucks1 * Fuel1\nConsumption2 = (100 - 0.07 * Tech2) * Trucks2 * Fuel2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Consumption1 + Consumption2)\n\n# Add constraints\nmodel.addCons(Fuel1 * Trucks1 + Fuel2 * Trucks2 + Tech1 + Tech2 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for City2: \", model.getVal(Trucks2))\n    print(\"Fuel Allocation per Truck for City1: \", model.getVal(Fuel1))\n    print(\"Fuel Allocation per Truck for City2: \", model.getVal(Fuel2))\n    print(\"Investment in Fuel-Efficient Technologies for City1: \", model.getVal(Tech1))\n    print(\"Investment in Fuel-Efficient Technologies for City2: \", model.getVal(Tech2))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per unit of energy decreases with the investment in advanced technology. For Solar, the initial cost is $50 per unit, and it decreases by $2 for every $100 invested in technology. For Wind, the initial cost is $60 per unit, and it decreases by $3 for every $100 invested in technology. For Hydro, the initial cost is $40 per unit, and it decreases by $1.5 for every $100 invested in technology. The company aims to minimize the total operational cost of all power plants.\n// Total operational cost for Solar: CostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\n// Total operational cost for Wind: CostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\n// Total operational cost for Hydro: CostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n// So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\n// 50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000\n\n## Generate Constraint-2:\nThe total number of power units that can be installed is limited to 20 units.\n// SolarUnits + WindUnits + HydroUnits <= 20\n\n## Generate Constraint-3:\nDue to environmental regulations, the company must install at least 5 units of Hydro power plants.\n// HydroUnits >= 5\n\n## Generate Constraint-4:\nThe investment in technology for each type of power plant cannot exceed $50,000.\n// TechInvestmentSolar <= 50000; TechInvestmentWind <= 50000; TechInvestmentHydro <= 50000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of investment in advanced technology for each type to enhance efficiency. The efficiency of each power plant is affected by the investment in technology, which reduces the operational cost per unit of energy produced. The operational cost per unit of energy decreases with the investment in advanced technology as shown in the following Table.\n\n| Power Plant | Initial Cost per Unit | Decrease in Cost per $100 Tech Investment |\n|-------------|-----------------------|------------------------------------------|\n| Solar       | $50                   | $2                                       |\n| Wind        | $60                   | $3                                       |\n| Hydro       | $40                   | $1.5                                     |\n\nThe company has a total budget of $1,000,000 for both the installation of power units and the investment in technology. The total number of power units that can be installed is limited to 20 units. Due to environmental regulations, the company must install at least 5 units of Hydro power plants. The investment in technology for each type of power plant cannot exceed $50,000.\n\nPlease help the company to minimize the total operational cost of all power plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro\n\n# Define objective function\nCostSolar = (50 - 0.02 * TechInvestmentSolar) * SolarUnits\nCostWind = (60 - 0.03 * TechInvestmentWind) * WindUnits\nCostHydro = (40 - 0.015 * TechInvestmentHydro) * HydroUnits\n# So, the objective function is: Minimize (CostSolar + CostWind + CostHydro)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSolar + CostWind + CostHydro)\n\n# Add constraints\n# The company has a total budget of $1,000,000 for both the installation of power units and the investment in technology.\nmodel.addCons(50 * SolarUnits + 60 * WindUnits + 40 * HydroUnits + TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro <= 1000000)\n# The total number of power units that can be installed is limited to 20 units.\nmodel.addCons(SolarUnits + WindUnits + HydroUnits <= 20)\n# Due to environmental regulations, the company must install at least 5 units of Hydro power plants.\nmodel.addCons(HydroUnits >= 5)\n# The investment in technology for each type of power plant cannot exceed $50,000.\nmodel.addCons(TechInvestmentSolar <= 50000)\nmodel.addCons(TechInvestmentWind <= 50000)\nmodel.addCons(TechInvestmentHydro <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Investment in advanced technology for Solar: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro: \", model.getVal(TechInvestmentHydro))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1418,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck type\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3, and the distance traveled by each truck to each region varies (Region1: 500 miles, Region2: 700 miles, Region3: 600 miles, Region4: 800 miles, Region5: 900 miles). The company wants to minimize the total fuel cost per day.\n// FuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * $3\n// FuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * $3\n// FuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * $3\n// FuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * $3\n// FuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * $3\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 500 * TrucksRegion1 / FuelEfficiency * $3 + 700 * TrucksRegion2 / FuelEfficiency * $3 + 600 * TrucksRegion3 / FuelEfficiency * $3 + 800 * TrucksRegion4 / FuelEfficiency * $3 + 900 * TrucksRegion5 / FuelEfficiency * $3 <= $10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20\n\n## Generate Constraint-3:\nAt least 3 trucks must be allocated to Region1.\n// TrucksRegion1 >= 3\n\n## Generate Constraint-4:\nNo more than 5 trucks can be allocated to any single region.\n// TrucksRegion1 <= 5\n// TrucksRegion2 <= 5\n// TrucksRegion3 <= 5\n// TrucksRegion4 <= 5\n// TrucksRegion5 <= 5\n\n## Generate Constraint-5:\nThe fuel efficiency of each truck type must be at least 10 miles per gallon.\n// FuelEfficiency >= 10",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The distance traveled by each truck to each region varies as shown in the following Table.\n\n| Region | Distance (miles) |\n|--------|------------------|\n| Region1 | 500             |\n| Region2 | 700             |\n| Region3 | 600             |\n| Region4 | 800             |\n| Region5 | 900             |\n\nThe cost of fuel per gallon is $3. The company has a total budget of $10,000 for fuel costs per day. The company can allocate a maximum of 20 trucks in total across all regions. At least 3 trucks must be allocated to Region1. No more than 5 trucks can be allocated to any single region. The fuel efficiency of each truck type must be at least 10 miles per gallon.\n\nPlease help the company to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=3, ub=5) # number of trucks for Region1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0, ub=5) # number of trucks for Region2\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0, ub=5) # number of trucks for Region3\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0, ub=5) # number of trucks for Region4\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0, ub=5) # number of trucks for Region5\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=10) # fuel efficiency of each truck type\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * 3\nFuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * 3\nFuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * 3\nFuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * 3\nFuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * 3\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(500 * TrucksRegion1 / FuelEfficiency * 3 + 700 * TrucksRegion2 / FuelEfficiency * 3 + 600 * TrucksRegion3 / FuelEfficiency * 3 + 800 * TrucksRegion4 / FuelEfficiency * 3 + 900 * TrucksRegion5 / FuelEfficiency * 3 <= 10000)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much of each crop to plant this season.\n// {\"amount of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"amount of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"amount of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"amount of crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"amount of crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the selling price is $20 per unit, the cost of seeds is $5 per unit, and the water usage is 3 liters per unit.\nFor Crop B, the selling price is $25 per unit, the cost of seeds is $7 per unit, and the water usage is 4 liters per unit.\nFor Crop C, the selling price is $30 per unit, the cost of seeds is $9 per unit, and the water usage is 5 liters per unit.\nFor Crop D, the selling price is $35 per unit, the cost of seeds is $11 per unit, and the water usage is 6 liters per unit.\nFor Crop E, the selling price is $40 per unit, the cost of seeds is $13 per unit, and the water usage is 7 liters per unit.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the water usage).\n// Selling profit of A: Profit_A = (20 - 5) * A\n// Selling profit of B: Profit_B = (25 - 7) * B\n// Selling profit of C: Profit_C = (30 - 9) * C\n// Selling profit of D: Profit_D = (35 - 11) * D\n// Selling profit of E: Profit_E = (40 - 13) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (3 * A + 4 * B + 5 * C + 6 * D + 7 * E)\n\n## Generate Constraint-1:\nThe farm has $1500 available for seed costs this season.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500\n\n## Generate Constraint-2:\nThe farm wants to plant at least 20 units of each crop this season.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much of each crop to plant this season. The selling price, cost of seeds, and water usage for each crop are given in the following Table.\n\n| Crop | Selling Price | Cost of Seeds | Water Usage |\n|------|---------------|---------------|-------------|\n| A    | $20 per unit  | $5 per unit   | 3 liters    |\n| B    | $25 per unit  | $7 per unit   | 4 liters    |\n| C    | $30 per unit  | $9 per unit   | 5 liters    |\n| D    | $35 per unit  | $11 per unit  | 6 liters    |\n| E    | $40 per unit  | $13 per unit  | 7 liters    |\n\nThe farm has $1500 available for seed costs this season. The farm wants to plant at least 20 units of each crop this season. Please help the farm to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to plant at least 20 units of each crop this season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # amount of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # amount of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # amount of crop C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # amount of crop D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # amount of crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (25 - 7) * B\nProfit_C = (30 - 9) * C\nProfit_D = (35 - 11) * D\nProfit_E = (40 - 13) * E\nWaterUsage = 3 * A + 4 * B + 5 * C + 6 * D + 7 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has $1500 available for seed costs this season.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Crop A: \", model.getVal(A))\n    print(\"Amount of Crop B: \", model.getVal(B))\n    print(\"Amount of Crop C: \", model.getVal(C))\n    print(\"Amount of Crop D: \", model.getVal(D))\n    print(\"Amount of Crop E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA_Quantity\", \"range\": \"MachineA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB_Quantity\", \"range\": \"MachineB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC_Quantity\", \"range\": \"MachineC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of MachineD\": \"MachineD_Quantity\", \"range\": \"MachineD_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Quantity), Cost_B = 300 * sqrt(MachineB_Quantity), Cost_C = 400 * sqrt(MachineC_Quantity), Cost_D = 500 * sqrt(MachineD_Quantity). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n// Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\n// MachineB_Quantity >= 0.5 * MachineA_Quantity",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each type of machine to optimize their profit while considering various constraints. The profit per unit for each machine and the production cost function, which increases nonlinearly with the quantity produced, are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| MachineA | $500 | 200 * sqrt(MachineA_Quantity) |\n| MachineB | $700 | 300 * sqrt(MachineB_Quantity) |\n| MachineC | $900 | 400 * sqrt(MachineC_Quantity) |\n| MachineD | $1100 | 500 * sqrt(MachineD_Quantity) |\n\nThe company has a total production capacity of 1000 machines per month. Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA. The company wants to maximize the total net profit.\n\nPlease help the company determine the optimal production quantity for each type of machine to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Quantity\", lb=0)\nMachineB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Quantity\", lb=0)\nMachineC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Quantity\", lb=0)\nMachineD_Quantity = model.addVar(vtype=\"INTEGER\", name=\"MachineD_Quantity\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Quantity)) * MachineA_Quantity\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Quantity)) * MachineB_Quantity\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Quantity)) * MachineC_Quantity\n## Total net profit for MachineD: Profit_D = (1100 - 500 * sqrt(MachineD_Quantity)) * MachineD_Quantity\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineA_Quantity\")\nsqrt_MachineB_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineB_Quantity\")\nsqrt_MachineC_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineC_Quantity\")\nsqrt_MachineD_Quantity = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineD_Quantity\")\n\nmodel.addCons(sqrt_MachineA_Quantity**2 == MachineA_Quantity)\nmodel.addCons(sqrt_MachineB_Quantity**2 == MachineB_Quantity)\nmodel.addCons(sqrt_MachineC_Quantity**2 == MachineC_Quantity)\nmodel.addCons(sqrt_MachineD_Quantity**2 == MachineD_Quantity)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Quantity) * MachineA_Quantity\nProfit_B = (700 - 300 * sqrt_MachineB_Quantity) * MachineB_Quantity\nProfit_C = (900 - 400 * sqrt_MachineC_Quantity) * MachineC_Quantity\nProfit_D = (1100 - 500 * sqrt_MachineD_Quantity) * MachineD_Quantity\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_Quantity + MachineB_Quantity + MachineC_Quantity + MachineD_Quantity <= 1000)\n\n## Due to supplier agreements, the production of MachineB must be at least half of the production of MachineA.\nmodel.addCons(MachineB_Quantity >= 0.5 * MachineA_Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA_Quantity))\n    print(\"Number of MachineB: \", model.getVal(MachineB_Quantity))\n    print(\"Number of MachineC: \", model.getVal(MachineC_Quantity))\n    print(\"Number of MachineD: \", model.getVal(MachineD_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each truck to reduce fuel costs and increase the number of trips possible per day.\n// {\"number of trips for Truck 1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck 3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck 1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck 3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips.\n// Fuel cost for Truck 1: Cost1 = (100 - 0.05 * Upgrade1) * Trips1\n// Fuel cost for Truck 2: Cost2 = (120 - 0.06 * Upgrade2) * Trips2\n// Fuel cost for Truck 3: Cost3 = (150 - 0.075 * Upgrade3) * Trips3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and upgrades.\n// (100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000\n\n## Generate Constraint-2:\nEach truck can make at most 50 trips per day.\n// Trips1 <= 50; Trips2 <= 50; Trips3 <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the number of trips each truck should make to different cities and the investment in fuel-efficient upgrades for each truck to optimize its operations. The fuel efficiency of each truck improves with the investment in upgrades, reducing the fuel cost per trip. The fuel cost per trip for Truck 1 is $100, but with upgrades, it decreases by $5 for every $100 invested. The fuel cost per trip for Truck 2 is $120, and with upgrades, it decreases by $6 for every $100 invested. The fuel cost per trip for Truck 3 is $150, and with upgrades, it decreases by $7.5 for every $100 invested. The company aims to minimize the total fuel cost of all trips. The company has a budget of $10,000 for fuel and upgrades. Each truck can make at most 50 trips per day. Please help the company to determine the optimal number of trips and the investment in fuel-efficient upgrades for each truck to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0, ub=50)  # number of trips for Truck 1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0, ub=50)  # number of trips for Truck 2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0, ub=50)  # number of trips for Truck 3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck 1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck 2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck 3\n\n# Define objective function\nCost1 = (100 - 0.05 * Upgrade1) * Trips1\nCost2 = (120 - 0.06 * Upgrade2) * Trips2\nCost3 = (150 - 0.075 * Upgrade3) * Trips3\n# So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\n# The company has a budget of $10,000 for fuel and upgrades.\nmodel.addCons((100 - 0.05 * Upgrade1) * Trips1 + (120 - 0.06 * Upgrade2) * Trips2 + (150 - 0.075 * Upgrade3) * Trips3 + Upgrade1 + Upgrade2 + Upgrade3 <= 10000)\n# Each truck can make at most 50 trips per day.\nmodel.addCons(Trips1 <= 50)\nmodel.addCons(Trips2 <= 50)\nmodel.addCons(Trips3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck 1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck 2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck 3: \", model.getVal(Trips3))\n    print(\"Investment in Upgrade for Truck 1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrade for Truck 2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrade for Truck 3: \", model.getVal(Upgrade3))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. The production cost per unit for each device is a percentage of its selling price, which varies nonlinearly with the production quantity. Specifically, the cost function is modeled as C(x) = 0.4x^2 - 0.2x + 10 for each device, where x is the production quantity. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Profit per unit of A: P_A = 50 - (0.4 * A^2 - 0.2 * A + 10)\n// Profit per unit of B: P_B = 70 - (0.4 * B^2 - 0.2 * B + 10)\n// Profit per unit of C: P_C = 90 - (0.4 * C^2 - 0.2 * C + 10)\n// Profit per unit of D: P_D = 110 - (0.4 * D^2 - 0.2 * D + 10)\n// Profit per unit of E: P_E = 130 - (0.4 * E^2 - 0.2 * E + 10)\n// So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C + P_D * D + P_E * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// (0.4 * A^2 - 0.2 * A + 10) * A + (0.4 * B^2 - 0.2 * B + 10) * B + (0.4 * C^2 - 0.2 * C + 10) * C + (0.4 * D^2 - 0.2 * D + 10) * D + (0.4 * E^2 - 0.2 * E + 10) * E <= 10000\n\n## Generate Constraint-2:\nThe company must produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe total production quantity of all devices must not exceed 1000 units.\n// A + B + C + D + E <= 1000",
        "question": "A manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin. The profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. The production cost per unit for each device is a percentage of its selling price, which varies nonlinearly with the production quantity. Specifically, the cost function is modeled as C(x) = 0.4x^2 - 0.2x + 10 for each device, where x is the production quantity. The company has a budget of $10,000 for production costs. The company must produce at least 50 units of each device. The total production quantity of all devices must not exceed 1000 units. Please help the company to maximize the total profit, which is the difference between the total revenue and the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of device E\n\n# Define objective function\n## Profit per unit of A: P_A = 50 - (0.4 * A^2 - 0.2 * A + 10)\n## Profit per unit of B: P_B = 70 - (0.4 * B^2 - 0.2 * B + 10)\n## Profit per unit of C: P_C = 90 - (0.4 * C^2 - 0.2 * C + 10)\n## Profit per unit of D: P_D = 110 - (0.4 * D^2 - 0.2 * D + 10)\n## Profit per unit of E: P_E = 130 - (0.4 * E^2 - 0.2 * E + 10)\nP_A = 50 - (0.4 * A**2 - 0.2 * A + 10)\nP_B = 70 - (0.4 * B**2 - 0.2 * B + 10)\nP_C = 90 - (0.4 * C**2 - 0.2 * C + 10)\nP_D = 110 - (0.4 * D**2 - 0.2 * D + 10)\nP_E = 130 - (0.4 * E**2 - 0.2 * E + 10)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (P_A * A + P_B * B + P_C * C + P_D * D + P_E * E)\nmodel.addCons(obj == P_A * A + P_B * B + P_C * C + P_D * D + P_E * E)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons((0.4 * A**2 - 0.2 * A + 10) * A + (0.4 * B**2 - 0.2 * B + 10) * B + \n              (0.4 * C**2 - 0.2 * C + 10) * C + (0.4 * D**2 - 0.2 * D + 10) * D + \n              (0.4 * E**2 - 0.2 * E + 10) * E <= 10000)\n## The total production quantity of all devices must not exceed 1000 units.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. \nFor route 1, each truck consumes 100 liters of fuel and takes 5 hours. \nFor route 2, each truck consumes 120 liters of fuel and takes 6 hours. \nFor route 3, each truck consumes 140 liters of fuel and takes 7 hours. \nFor route 4, each truck consumes 160 liters of fuel and takes 8 hours.\nFor route 5, each truck consumes 180 liters of fuel and takes 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n// Fuel_Cost_R1 = 100 * T1 * fuel_price\n// Fuel_Cost_R2 = 120 * T2 * fuel_price\n// Fuel_Cost_R3 = 140 * T3 * fuel_price\n// Fuel_Cost_R4 = 160 * T4 * fuel_price\n// Fuel_Cost_R5 = 180 * T5 * fuel_price\n// Time_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\n// Time_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\n// Time_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\n// Time_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\n// Time_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n// So, the objective function is: Minimize (Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5) + (Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nThe total fuel consumption across all routes must not exceed 10,000 liters.\n// 100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000\n\n## Generate Constraint-3:\nThe total delivery time across all routes must not exceed 500 hours.\n// 5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the fuel consumption and delivery times for different routes. The company has five routes (R1, R2, R3, R4, R5) and needs to decide how many trucks to allocate to each route. The fuel consumption rates and delivery times for each route are given in the following Table.\n\n| Route | Fuel Consumption (liters/truck) | Delivery Time (hours/truck) |\n|-------|---------------------------------|-----------------------------|\n| R1    | 100                             | 5                           |\n| R2    | 120                             | 6                           |\n| R3    | 140                             | 7                           |\n| R4    | 160                             | 8                           |\n| R5    | 180                             | 9                           |\n\nThe company has a total of 100 trucks available. The total fuel consumption across all routes must not exceed 10,000 liters. The total delivery time across all routes must not exceed 500 hours. \n\nPlease help the company to minimize the total cost, which is the sum of the fuel cost (fuel consumption rate * fuel price) and the opportunity cost of time (delivery time * hourly cost of downtime).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nfuel_price = 1  # assuming fuel price per liter\nhourly_cost_of_downtime = 1  # assuming hourly cost of downtime\n\nFuel_Cost_R1 = 100 * T1 * fuel_price\nFuel_Cost_R2 = 120 * T2 * fuel_price\nFuel_Cost_R3 = 140 * T3 * fuel_price\nFuel_Cost_R4 = 160 * T4 * fuel_price\nFuel_Cost_R5 = 180 * T5 * fuel_price\n\nTime_Cost_R1 = 5 * T1 * hourly_cost_of_downtime\nTime_Cost_R2 = 6 * T2 * hourly_cost_of_downtime\nTime_Cost_R3 = 7 * T3 * hourly_cost_of_downtime\nTime_Cost_R4 = 8 * T4 * hourly_cost_of_downtime\nTime_Cost_R5 = 9 * T5 * hourly_cost_of_downtime\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_R1 + Fuel_Cost_R2 + Fuel_Cost_R3 + Fuel_Cost_R4 + Fuel_Cost_R5 + Time_Cost_R1 + Time_Cost_R2 + Time_Cost_R3 + Time_Cost_R4 + Time_Cost_R5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\nmodel.addCons(100 * T1 + 120 * T2 + 140 * T3 + 160 * T4 + 180 * T5 <= 10000)\nmodel.addCons(5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine should be operated in the testing phase.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine A is tested\": \"TestHoursA\", \"range\": \"TestHoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours machine B is tested\": \"TestHoursB\", \"range\": \"TestHoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours machine C is tested\": \"TestHoursC\", \"range\": \"TestHoursC >= 0\", \"type\": \"real\"}\n// {\"number of hours machine D is tested\": \"TestHoursD\", \"range\": \"TestHoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the production cost is $3000, and the testing cost per hour is $50.\nFor machine B, the selling price is $7000, the production cost is $4000, and the testing cost per hour is $70.\nFor machine C, the selling price is $9000, the production cost is $5000, and the testing cost per hour is $90.\nFor machine D, the selling price is $11000, the production cost is $6000, and the testing cost per hour is $110.\nThe company aims to maximize the total profit, which is the sum of the selling profits minus the testing costs.\n// Profit from A: Profit_A = (5000 - 3000) * A - 50 * TestHoursA\n// Profit from B: Profit_B = (7000 - 4000) * B - 70 * TestHoursB\n// Profit from C: Profit_C = (9000 - 5000) * C - 90 * TestHoursC\n// Profit from D: Profit_D = (11000 - 6000) * D - 110 * TestHoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for production costs next month.\n// 3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine should be operated in the testing phase. For machine A, the selling price is $5000, the production cost is $3000, and the testing cost per hour is $50. For machine B, the selling price is $7000, the production cost is $4000, and the testing cost per hour is $70. For machine C, the selling price is $9000, the production cost is $5000, and the testing cost per hour is $90. For machine D, the selling price is $11000, the production cost is $6000, and the testing cost per hour is $110. The company aims to maximize the total profit, which is the sum of the selling profits minus the testing costs. The company has a total budget of $150,000 for production costs next month. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of machine D\nTestHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursA\", lb=0) # number of hours machine A is tested\nTestHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursB\", lb=0) # number of hours machine B is tested\nTestHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursC\", lb=0) # number of hours machine C is tested\nTestHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursD\", lb=0) # number of hours machine D is tested\n\n# Define objective function\nProfit_A = (5000 - 3000) * A - 50 * TestHoursA\nProfit_B = (7000 - 4000) * B - 70 * TestHoursB\nProfit_C = (9000 - 5000) * C - 90 * TestHoursC\nProfit_D = (11000 - 6000) * D - 110 * TestHoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for production costs next month.\nmodel.addCons(3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Hours Machine A is Tested: \", model.getVal(TestHoursA))\n    print(\"Hours Machine B is Tested: \", model.getVal(TestHoursB))\n    print(\"Hours Machine C is Tested: \", model.getVal(TestHoursC))\n    print(\"Hours Machine D is Tested: \", model.getVal(TestHoursD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n// Fuel consumption on route A: Fuel_A = 10 * A\n// Fuel consumption on route B: Fuel_B = 15 * B\n// Fuel consumption on route C: Fuel_C = 20 * C\n// Fuel consumption on route D: Fuel_D = 25 * D\n// Fuel consumption on route E: Fuel_E = 30 * E\n// Total capacity of goods transported: Capacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nEach route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks.\n// A >= 5; B >= 10; C >= 15; D >= 20; E >= 25",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The fuel consumption per truck and the capacity of goods transported per liter of fuel are given in the following Table.\n\n| Route | Fuel Consumption (liters/trip) | Capacity (units/liter) |\n|-------|--------------------------------|------------------------|\n| A     | 10                             | 100                    |\n| B     | 15                             | 100                    |\n| C     | 20                             | 100                    |\n| D     | 25                             | 100                    |\n| E     | 30                             | 100                    |\n\nThe company has a total of 100 trucks available. Each route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks. \n\nPlease help the company to minimize the total fuel consumption while maximizing the total capacity of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=25) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\nCapacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified five districts (North, South, East, West, and Central) where solar panels can be installed. The decision variables include the number of solar panels to be installed in each district.\n// {\"number of solar panels in North district\": \"NorthPanels\", \"range\": \"NorthPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in South district\": \"SouthPanels\", \"range\": \"SouthPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in East district\": \"EastPanels\", \"range\": \"EastPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in West district\": \"WestPanels\", \"range\": \"WestPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Central district\": \"CentralPanels\", \"range\": \"CentralPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel in the North district is $1000, and it generates $200 worth of energy annually.\nIn the South district, the cost is $1200, and it generates $240 worth of energy annually.\nIn the East district, the cost is $900, and it generates $180 worth of energy annually.\nIn the West district, the cost is $1100, and it generates $220 worth of energy annually.\nIn the Central district, the cost is $1300, and it generates $260 worth of energy annually.\nThe city aims to maximize the net annual benefit from the solar panels, which is the total energy generated minus the installation cost.\n// NetBenefit_North = 200 * NorthPanels - 1000 * NorthPanels\n// NetBenefit_South = 240 * SouthPanels - 1200 * SouthPanels\n// NetBenefit_East = 180 * EastPanels - 900 * EastPanels\n// NetBenefit_West = 220 * WestPanels - 1100 * WestPanels\n// NetBenefit_Central = 260 * CentralPanels - 1300 * CentralPanels\n// So, the objective function is: Maximize (NetBenefit_North + NetBenefit_South + NetBenefit_East + NetBenefit_West + NetBenefit_Central)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * NorthPanels + 1200 * SouthPanels + 900 * EastPanels + 1100 * WestPanels + 1300 * CentralPanels <= 500000\n\n## Generate Constraint-2:\nThe total number of solar panels to be installed across all districts must not exceed 500.\n// NorthPanels + SouthPanels + EastPanels + WestPanels + CentralPanels <= 500\n\n## Generate Constraint-3:\nAt least 100 solar panels must be installed in the North district.\n// NorthPanels >= 100",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified five districts (North, South, East, West, and Central) where solar panels can be installed. The cost of installing a solar panel in the North district is $1000, and it generates $200 worth of energy annually. In the South district, the cost is $1200, and it generates $240 worth of energy annually. In the East district, the cost is $900, and it generates $180 worth of energy annually. In the West district, the cost is $1100, and it generates $220 worth of energy annually. In the Central district, the cost is $1300, and it generates $260 worth of energy annually. The city aims to maximize the net annual benefit from the solar panels, which is the total energy generated minus the installation cost. The city has a budget of $500,000 for the installation of solar panels. The total number of solar panels to be installed across all districts must not exceed 500. At least 100 solar panels must be installed in the North district. Please help the city determine the optimal number of solar panels to be installed in each district to maximize the net annual benefit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorthPanels = model.addVar(vtype=\"INTEGER\", name=\"NorthPanels\", lb=100) # number of solar panels in North district\nSouthPanels = model.addVar(vtype=\"INTEGER\", name=\"SouthPanels\", lb=0) # number of solar panels in South district\nEastPanels = model.addVar(vtype=\"INTEGER\", name=\"EastPanels\", lb=0) # number of solar panels in East district\nWestPanels = model.addVar(vtype=\"INTEGER\", name=\"WestPanels\", lb=0) # number of solar panels in West district\nCentralPanels = model.addVar(vtype=\"INTEGER\", name=\"CentralPanels\", lb=0) # number of solar panels in Central district\n\n# Define objective function\nNetBenefit_North = 200 * NorthPanels - 1000 * NorthPanels\nNetBenefit_South = 240 * SouthPanels - 1200 * SouthPanels\nNetBenefit_East = 180 * EastPanels - 900 * EastPanels\nNetBenefit_West = 220 * WestPanels - 1100 * WestPanels\nNetBenefit_Central = 260 * CentralPanels - 1300 * CentralPanels\n# So, the objective function is: Maximize (NetBenefit_North + NetBenefit_South + NetBenefit_East + NetBenefit_West + NetBenefit_Central)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetBenefit_North + NetBenefit_South + NetBenefit_East + NetBenefit_West + NetBenefit_Central)\n\n# Add constraints\n# The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * NorthPanels + 1200 * SouthPanels + 900 * EastPanels + 1100 * WestPanels + 1300 * CentralPanels <= 500000)\n# The total number of solar panels to be installed across all districts must not exceed 500.\nmodel.addCons(NorthPanels + SouthPanels + EastPanels + WestPanels + CentralPanels <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in North District: \", model.getVal(NorthPanels))\n    print(\"Number of Solar Panels in South District: \", model.getVal(SouthPanels))\n    print(\"Number of Solar Panels in East District: \", model.getVal(EastPanels))\n    print(\"Number of Solar Panels in West District: \", model.getVal(WestPanels))\n    print(\"Number of Solar Panels in Central District: \", model.getVal(CentralPanels))\n    print(\"Maximized Net Annual Benefit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wearables\": \"Wearables\", \"range\": \"Wearables >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company wants to maximize the total profit from selling these devices.\n// Profit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\n// Profit_Tablets = (150 - 0.05 * Tablets) * Tablets\n// Profit_Laptops = (200 - 0.08 * Laptops) * Laptops\n// Profit_Wearables = (50 - 0.03 * Wearables) * Wearables\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000.\n// 5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\n// Smartphones <= 500; Tablets <= 300; Laptops <= 200; Wearables <= 400",
        "question": "A manufacturing company produces four types of electronic devices: Smartphones, Tablets, Laptops, and Wearables. They need to determine the production quantities of each device to maximize their profit while considering various constraints.\nThe profit per unit of Smartphones is $100, but it decreases by $0.1 for every additional Smartphone produced. The profit per unit of Tablets is $150, but it decreases by $0.05 for every additional Tablet produced. The profit per unit of Laptops is $200, but it decreases by $0.08 for every additional Laptop produced. The profit per unit of Wearables is $50, but it decreases by $0.03 for every additional Wearable produced. The company has a limited supply of a critical component used in all devices. Each Smartphone requires 5 units, each Tablet requires 8 units, each Laptop requires 10 units, and each Wearable requires 3 units. The total available units of this component are 2000. The market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 300 units, for Laptops is 200 units, and for Wearables is 400 units.\nPlease help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0, ub=500) # quantity of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0, ub=300) # quantity of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0, ub=200) # quantity of Laptops\nWearables = model.addVar(vtype=\"INTEGER\", name=\"Wearables\", lb=0, ub=400) # quantity of Wearables\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Smartphones = (100 - 0.1 * Smartphones) * Smartphones\nProfit_Tablets = (150 - 0.05 * Tablets) * Tablets\nProfit_Laptops = (200 - 0.08 * Laptops) * Laptops\nProfit_Wearables = (50 - 0.03 * Wearables) * Wearables\n## the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops + Profit_Wearables)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices.\nmodel.addCons(5 * Smartphones + 8 * Tablets + 10 * Laptops + 3 * Wearables <= 2000)\n## The market has a demand limit for each device.\nmodel.addCons(Smartphones <= 500)\nmodel.addCons(Tablets <= 300)\nmodel.addCons(Laptops <= 200)\nmodel.addCons(Wearables <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Quantity of Wearables: \", model.getVal(Wearables))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints.\n// {\"number of DeviceA\": \"DeviceANum\", \"range\": \"DeviceANum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB\": \"DeviceBNum\", \"range\": \"DeviceBNum >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC\": \"DeviceCNum\", \"range\": \"DeviceCNum >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company aims to maximize the total profit.\n// Profit_DeviceA = (100 - 50) * DeviceANum\n// Profit_DeviceB = (150 - 75) * DeviceBNum\n// Profit_DeviceC = (200 - 100) * DeviceCNum\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// DeviceANum + DeviceBNum + DeviceCNum <= 500\n\n## Generate Constraint-2:\nDue to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBNum <= 2 * DeviceANum\n\n## Generate Constraint-3:\nThe market demand for DeviceC is limited to 150 units per month.\n// DeviceCNum <= 150\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of DeviceA to fulfill a contract.\n// DeviceANum >= 50\n\n## Generate Constraint-5:\nThe total production cost must not exceed $25,000 per month.\n// 50 * DeviceANum + 75 * DeviceBNum + 100 * DeviceCNum <= 25000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the optimal number of each device to produce to maximize profit, considering the production costs, market demand, and resource constraints. The profit per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The production cost per unit of DeviceA is $50, DeviceB is $75, and DeviceC is $100. The company has a total production capacity of 500 units per month. Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA. The market demand for DeviceC is limited to 150 units per month. The company must produce at least 50 units of DeviceA to fulfill a contract. The total production cost must not exceed $25,000 per month. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceANum = model.addVar(vtype=\"INTEGER\", name=\"DeviceANum\", lb=50) # number of DeviceA\nDeviceBNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceBNum\", lb=0) # number of DeviceB\nDeviceCNum = model.addVar(vtype=\"INTEGER\", name=\"DeviceCNum\", lb=0, ub=150) # number of DeviceC\n\n# Define objective function\nProfit_DeviceA = (100 - 50) * DeviceANum\nProfit_DeviceB = (150 - 75) * DeviceBNum\nProfit_DeviceC = (200 - 100) * DeviceCNum\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 500 units per month.\nmodel.addCons(DeviceANum + DeviceBNum + DeviceCNum <= 500)\n# Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBNum <= 2 * DeviceANum)\n# The market demand for DeviceC is limited to 150 units per month.\nmodel.addCons(DeviceCNum <= 150)\n# The company must produce at least 50 units of DeviceA to fulfill a contract.\nmodel.addCons(DeviceANum >= 50)\n# The total production cost must not exceed $25,000 per month.\nmodel.addCons(50 * DeviceANum + 75 * DeviceBNum + 100 * DeviceCNum <= 25000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceANum))\n    print(\"Number of DeviceB: \", model.getVal(DeviceBNum))\n    print(\"Number of DeviceC: \", model.getVal(DeviceCNum))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The efficiency gain from the machinery is nonlinear and varies with the investment amount.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery. The initial production cost per unit for ProductA is $50, for ProductB is $75, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all production lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nThe number of workers allocated to each product line must not exceed the number of units produced by 10 times.\n// WorkersA <= 10 * UnitsA; WorkersB <= 10 * UnitsB; WorkersC <= 10 * UnitsC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery. The initial production cost per unit for ProductA is $50, for ProductB is $75, and for ProductC is $100. The company has a total of 100 workers available for all production lines and the total investment in advanced machinery cannot exceed $50,000. Due to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB. The number of workers allocated to each product line must not exceed the number of units produced by 10 times. The company aims to maximize the total profit from all products. Please help the company determine the optimal number of units to produce for each product, the number of workers to allocate, and the amount of investment in advanced machinery.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)     # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\nProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\nProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available for all production lines.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(MachineryInvestment <= 50000)\n## The number of workers allocated to each product line must not exceed the number of units produced by 10 times.\nmodel.addCons(WorkersA <= 10 * UnitsA)\nmodel.addCons(WorkersB <= 10 * UnitsB)\nmodel.addCons(WorkersC <= 10 * UnitsC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in Advanced Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different operational cost and efficiency. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1500 per month and can transport 1500 units of goods. Truck C has an operational cost of $2000 per month and can transport 2000 units of goods. Truck D has an operational cost of $2500 per month and can transport 2500 units of goods. Truck E has an operational cost of $3000 per month and can transport 3000 units of goods. The company aims to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks.\n// Efficiency of Truck A: Eff_A = 1000 * A / 1000\n// Efficiency of Truck B: Eff_B = 1500 * B / 1500\n// Efficiency of Truck C: Eff_C = 2000 * C / 2000\n// Efficiency of Truck D: Eff_D = 2500 * D / 2500\n// Efficiency of Truck E: Eff_E = 3000 * E / 3000\n// So, the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations next month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 10 trucks available for deployment.\n// A + B + C + D + E <= 10",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month. Each type of truck has a different operational cost and efficiency. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1500 per month and can transport 1500 units of goods. Truck C has an operational cost of $2000 per month and can transport 2000 units of goods. Truck D has an operational cost of $2500 per month and can transport 2500 units of goods. Truck E has an operational cost of $3000 per month and can transport 3000 units of goods. The company aims to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks. The company has a budget of $10,000 for truck operations next month. The company has a total of 10 trucks available for deployment. Please help the company determine the optimal number of each type of truck to deploy to maximize the total transport efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEff_A = 1000 * A / 1000\nEff_B = 1500 * B / 1500\nEff_C = 2000 * C / 2000\nEff_D = 2500 * D / 2500\nEff_E = 3000 * E / 3000\n## the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n## convert the division to multiplication\nmodel.addCons(obj == Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations next month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000)\n## The company has a total of 10 trucks available for deployment.\nmodel.addCons(A + B + C + D + E <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Transport Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build five types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), Affordable Homes (AH), Condominiums (CO), and Townhouses (TH). The developer needs to determine the number of units of each type to maximize profit while considering various constraints.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"number of Condominiums\": \"CO\", \"range\": \"CO >= 0\", \"type\": \"integer\"}\n// {\"number of Townhouses\": \"TH\", \"range\": \"TH >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Luxury Villas is $200,000, for Mid-Range Apartments is $100,000, for Affordable Homes is $50,000, for Condominiums is $150,000, and for Townhouses is $80,000. Due to economies of scale, the profit per unit increases by 0.1% for each type of property if more than 50 units are built. The developer aims to maximize the total profit from all properties.\n// Profit_LV = max(200000 + 0.001 * (LV - 50), 200000) * LV\n// Profit_MA = max(100000 + 0.001 * (MA - 50), 100000) * MA\n// Profit_AH = max(50000 + 0.001 * (AH - 50), 50000) * AH\n// Profit_CO = max(150000 + 0.001 * (CO - 50), 150000) * CO\n// Profit_TH = max(80000 + 0.001 * (TH - 50), 80000) * TH\n// So, the objective function is: Maximize Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH\n\n## Generate Constraint-1:\nThe total construction budget is $100 million. The cost per unit for Luxury Villas is $150,000, for Mid-Range Apartments is $70,000, for Affordable Homes is $30,000, for Condominiums is $100,000, and for Townhouses is $50,000.\n// 150000 * LV + 70000 * MA + 30000 * AH + 100000 * CO + 50000 * TH <= 100000000\n\n## Generate Constraint-2:\nThe total land available for construction is 100,000 square meters. The land required per unit for Luxury Villas is 1000 sqm, for Mid-Range Apartments is 500 sqm, for Affordable Homes is 300 sqm, for Condominiums is 800 sqm, and for Townhouses is 400 sqm.\n// 1000 * LV + 500 * MA + 300 * AH + 800 * CO + 400 * TH <= 100000\n\n## Generate Constraint-3:\nThe market demand for each type of property is limited. The demand for Luxury Villas is 20 units, for Mid-Range Apartments is 100 units, for Affordable Homes is 200 units, for Condominiums is 80 units, and for Townhouses is 50 units.\n// LV <= 20; MA <= 100; AH <= 200; CO <= 80; TH <= 50\n\n## Generate Constraint-4:\nThe developer aims to maintain a balanced portfolio. The ratio of Luxury Villas to the total number of units should not exceed 5%.\n// LV / (LV + MA + AH + CO + TH) <= 0.05",
        "question": "A real estate developer is planning to build five types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), Affordable Homes (AH), Condominiums (CO), and Townhouses (TH). The developer needs to determine the number of units of each type to maximize profit while considering various constraints. The profit per unit for each type of property and the conditions for increased profit due to economies of scale are given in the following Table.\n\n| Property Type | Profit per Unit (if <= 50 units) | Profit per Unit (if > 50 units) |\n|---------------|----------------------------------|---------------------------------|\n| Luxury Villas | $200,000                         | $200,000 + 0.1% * (LV - 50)     |\n| Mid-Range Apartments | $100,000                       | $100,000 + 0.1% * (MA - 50)     |\n| Affordable Homes | $50,000                         | $50,000 + 0.1% * (AH - 50)     |\n| Condominiums | $150,000                       | $150,000 + 0.1% * (CO - 50)     |\n| Townhouses | $80,000                         | $80,000 + 0.1% * (TH - 50)     |\n\nThe total construction budget is $100 million. The cost per unit for each type of property is as follows: Luxury Villas $150,000, Mid-Range Apartments $70,000, Affordable Homes $30,000, Condominiums $100,000, and Townhouses $50,000. The total land available for construction is 100,000 square meters, with the land required per unit for each type of property as follows: Luxury Villas 1000 sqm, Mid-Range Apartments 500 sqm, Affordable Homes 300 sqm, Condominiums 800 sqm, and Townhouses 400 sqm. The market demand for each type of property is limited: Luxury Villas 20 units, Mid-Range Apartments 100 units, Affordable Homes 200 units, Condominiums 80 units, and Townhouses 50 units. The developer also aims to maintain a balanced portfolio, with the ratio of Luxury Villas to the total number of units not exceeding 5%.\n\nPlease help the developer to maximize the total profit from all properties while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=0, ub=20)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0, ub=100)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0, ub=200)  # number of Affordable Homes\nCO = model.addVar(vtype=\"INTEGER\", name=\"CO\", lb=0, ub=80)  # number of Condominiums\nTH = model.addVar(vtype=\"INTEGER\", name=\"TH\", lb=0, ub=50)  # number of Townhouses\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_LV = max(200000 + 0.001 * (LV - 50), 200000) * LV\nLV1 = model.addVar(vtype=\"INTEGER\", name=\"LV1\", lb=0, ub=50)\nLV2 = model.addVar(vtype=\"INTEGER\", name=\"LV2\", lb=50, ub=20)\nLV_b1 = model.addVar(vtype=\"B\", name=\"LV_b1\")\nLV_b2 = model.addVar(vtype=\"B\", name=\"LV_b2\")\nmodel.addCons(LV_b1 + LV_b2 == 1)\nmodel.addCons(LV == LV1*LV_b1 + LV2*LV_b2)\nProfit_LV = 200000 * LV1 * LV_b1 + (200000 + 0.001 * (LV2 - 50)) * LV2 * LV_b2\n\n## create piecewise variables for piecewise function: Profit_MA = max(100000 + 0.001 * (MA - 50), 100000) * MA\nMA1 = model.addVar(vtype=\"INTEGER\", name=\"MA1\", lb=0, ub=50)\nMA2 = model.addVar(vtype=\"INTEGER\", name=\"MA2\", lb=50, ub=100)\nMA_b1 = model.addVar(vtype=\"B\", name=\"MA_b1\")\nMA_b2 = model.addVar(vtype=\"B\", name=\"MA_b2\")\nmodel.addCons(MA_b1 + MA_b2 == 1)\nmodel.addCons(MA == MA1*MA_b1 + MA2*MA_b2)\nProfit_MA = 100000 * MA1 * MA_b1 + (100000 + 0.001 * (MA2 - 50)) * MA2 * MA_b2\n\n## create piecewise variables for piecewise function: Profit_AH = max(50000 + 0.001 * (AH - 50), 50000) * AH\nAH1 = model.addVar(vtype=\"INTEGER\", name=\"AH1\", lb=0, ub=50)\nAH2 = model.addVar(vtype=\"INTEGER\", name=\"AH2\", lb=50, ub=200)\nAH_b1 = model.addVar(vtype=\"B\", name=\"AH_b1\")\nAH_b2 = model.addVar(vtype=\"B\", name=\"AH_b2\")\nmodel.addCons(AH_b1 + AH_b2 == 1)\nmodel.addCons(AH == AH1*AH_b1 + AH2*AH_b2)\nProfit_AH = 50000 * AH1 * AH_b1 + (50000 + 0.001 * (AH2 - 50)) * AH2 * AH_b2\n\n## create piecewise variables for piecewise function: Profit_CO = max(150000 + 0.001 * (CO - 50), 150000) * CO\nCO1 = model.addVar(vtype=\"INTEGER\", name=\"CO1\", lb=0, ub=50)\nCO2 = model.addVar(vtype=\"INTEGER\", name=\"CO2\", lb=50, ub=80)\nCO_b1 = model.addVar(vtype=\"B\", name=\"CO_b1\")\nCO_b2 = model.addVar(vtype=\"B\", name=\"CO_b2\")\nmodel.addCons(CO_b1 + CO_b2 == 1)\nmodel.addCons(CO == CO1*CO_b1 + CO2*CO_b2)\nProfit_CO = 150000 * CO1 * CO_b1 + (150000 + 0.001 * (CO2 - 50)) * CO2 * CO_b2\n\n## create piecewise variables for piecewise function: Profit_TH = max(80000 + 0.001 * (TH - 50), 80000) * TH\nTH1 = model.addVar(vtype=\"INTEGER\", name=\"TH1\", lb=0, ub=50)\nTH2 = model.addVar(vtype=\"INTEGER\", name=\"TH2\", lb=50, ub=50)\nTH_b1 = model.addVar(vtype=\"B\", name=\"TH_b1\")\nTH_b2 = model.addVar(vtype=\"B\", name=\"TH_b2\")\nmodel.addCons(TH_b1 + TH_b2 == 1)\nmodel.addCons(TH == TH1*TH_b1 + TH2*TH_b2)\nProfit_TH = 80000 * TH1 * TH_b1 + (80000 + 0.001 * (TH2 - 50)) * TH2 * TH_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH\nmodel.addCons(obj == Profit_LV + Profit_MA + Profit_AH + Profit_CO + Profit_TH)\n\n# Add constraints\nmodel.addCons(150000 * LV + 70000 * MA + 30000 * AH + 100000 * CO + 50000 * TH <= 100000000)\nmodel.addCons(1000 * LV + 500 * MA + 300 * AH + 800 * CO + 400 * TH <= 100000)\nmodel.addCons(LV <= 20)\nmodel.addCons(MA <= 100)\nmodel.addCons(AH <= 200)\nmodel.addCons(CO <= 80)\nmodel.addCons(TH <= 50)\nmodel.addCons(LV / (LV + MA + AH + CO + TH) <= 0.05)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Number of Condominiums: \", model.getVal(CO))\n    print(\"Number of Townhouses: \", model.getVal(TH))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 2006,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit. Additionally, the company is considering outsourcing some of the production to external contractors.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceA\": \"OutsourceA\", \"range\": \"OutsourceA >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceB\": \"OutsourceB\", \"range\": \"OutsourceB >= 0\", \"type\": \"integer\"}\n// {\"number of units outsourced for DeviceC\": \"OutsourceC\", \"range\": \"OutsourceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the outsourcing cost is $80.\nFor DeviceB, the selling price is $150, the production cost is $90, and the outsourcing cost is $110.\nFor DeviceC, the selling price is $200, the production cost is $120, and the outsourcing cost is $140.\nThe company aims to maximize the total profit, considering both in-house production and outsourcing.\n// Profit from DeviceA: Profit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\n// Profit from DeviceB: Profit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\n// Profit from DeviceC: Profit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units for all devices combined.\n// DeviceA + DeviceB + DeviceC <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $30,000 for outsourcing costs.\n// 80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce next month to optimize their profit, and is also considering outsourcing some of the production to external contractors. The selling price, production cost, and outsourcing cost for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Outsourcing Cost |\n|--------|---------------|-----------------|------------------|\n| DeviceA | $100 | $60 | $80 |\n| DeviceB | $150 | $90 | $110 |\n| DeviceC | $200 | $120 | $140 |\n\nThe company has a production capacity of 500 units for all devices combined. The company also has a budget of $30,000 for outsourcing costs. Please help the company to maximize the total profit, considering both in-house production and outsourcing.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # number of units of DeviceC\nOutsourceA = model.addVar(vtype=\"INTEGER\", name=\"OutsourceA\", lb=0) # number of units outsourced for DeviceA\nOutsourceB = model.addVar(vtype=\"INTEGER\", name=\"OutsourceB\", lb=0) # number of units outsourced for DeviceB\nOutsourceC = model.addVar(vtype=\"INTEGER\", name=\"OutsourceC\", lb=0) # number of units outsourced for DeviceC\n\n# Define objective function\nProfit_A = (100 - 60) * DeviceA + (100 - 80) * OutsourceA\nProfit_B = (150 - 90) * DeviceB + (150 - 110) * OutsourceB\nProfit_C = (200 - 120) * DeviceC + (200 - 140) * OutsourceC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a production capacity of 500 units for all devices combined.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\n# The company has a budget of $30,000 for outsourcing costs.\nmodel.addCons(80 * OutsourceA + 110 * OutsourceB + 140 * OutsourceC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of units outsourced for DeviceA: \", model.getVal(OutsourceA))\n    print(\"Number of units outsourced for DeviceB: \", model.getVal(OutsourceB))\n    print(\"Number of units outsourced for DeviceC: \", model.getVal(OutsourceC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit per acre of land. The profit per acre for Corn is $200, for Wheat is $180, for Soybeans is $220, for Barley is $150, and for Oats is $160. However, the farmer also needs to consider the risk of crop failure, which is 5% for Corn, 3% for Wheat, 4% for Soybeans, 6% for Barley, and 2% for Oats. The farmer wants to maximize the Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk.\n// Total profit: Profit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\n// Total risk: Risk = 5% * 200 * Corn + 3% * 180 * Wheat + 4% * 220 * Soybeans + 6% * 150 * Barley + 2% * 160 * Oats\n// So, the objective function is: Maximize Profit / Risk\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10; Barley >= 10; Oats >= 10\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\n// Corn <= Wheat + Soybeans\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\n// Barley <= Corn + Wheat + Soybeans\n\n## Generate Constraint-5:\nThe farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops.\n// Oats <= Corn + Wheat + Soybeans + Barley",
        "question": "A farmer is planning his crop allocation for the next season. He has five plots of land and needs to decide how many acres to allocate to each of the following crops: Corn, Wheat, Soybeans, Barley, and Oats. The profit per acre and the risk of crop failure for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Risk of Crop Failure |\n|----------|-----------------|----------------------|\n| Corn     | $200            | 5%                   |\n| Wheat    | $180            | 3%                   |\n| Soybeans | $220            | 4%                   |\n| Barley   | $150            | 6%                   |\n| Oats     | $160            | 2%                   |\n\nThe farmer wants to maximize his Profit-Risk ratio per acre, which is defined as the total profit divided by the total risk. The farmer has a total of 100 acres of land available. The farmer must allocate at least 10 acres to each crop. The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans. The farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans. The farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops.\n\nPlease help the farmer to maximize the Profit-Risk ratio per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=10) # acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=10) # acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * Corn + 180 * Wheat + 220 * Soybeans + 150 * Barley + 160 * Oats\nRisk = 0.05 * 200 * Corn + 0.03 * 180 * Wheat + 0.04 * 220 * Soybeans + 0.06 * 150 * Barley + 0.02 * 160 * Oats\n## the objective function is: Maximize Profit / Risk\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Profit)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer wants to ensure that the total acreage of Corn does not exceed the combined acreage of Wheat and Soybeans.\nmodel.addCons(Corn <= Wheat + Soybeans)\n## The farmer wants to ensure that the total acreage of Barley does not exceed the combined acreage of Corn, Wheat, and Soybeans.\nmodel.addCons(Barley <= Corn + Wheat + Soybeans)\n## The farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of all other crops.\nmodel.addCons(Oats <= Corn + Wheat + Soybeans + Barley)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Acres of Barley: \", model.getVal(Barley))\n    print(\"Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Risk Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company wants to maximize the total profit per liter of fuel consumed.\n// Profit_TruckA = (2 - 0.5) * Distance_TruckA / 10\n// Profit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\n// Profit_TruckC = (3 - 0.7) * Distance_TruckC / 15\n// Profit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\n// Profit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n// Distance_TruckA = TruckA * Average_Distance\n// Distance_TruckB = TruckB * Average_Distance\n// Distance_TruckC = TruckC * Average_Distance\n// Distance_TruckD = TruckD * Average_Distance\n// Distance_TruckE = TruckE * Average_Distance\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for deployment.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\n// 0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000\n\n## Generate Constraint-3:\nThe company has a fuel budget of 5000 liters for the season.\n// 10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of truck is deployed at least once to maintain operational familiarity.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1; TruckD >= 1; TruckE >= 1",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of truck to deploy for the upcoming season.\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost per km is $0.5, and the revenue per km is $2. \nFor TruckB, the fuel efficiency is 12 km/l, the maintenance cost per km is $0.6, and the revenue per km is $2.5. \nFor TruckC, the fuel efficiency is 15 km/l, the maintenance cost per km is $0.7, and the revenue per km is $3. \nFor TruckD, the fuel efficiency is 18 km/l, the maintenance cost per km is $0.8, and the revenue per km is $3.5.\nFor TruckE, the fuel efficiency is 20 km/l, the maintenance cost per km is $0.9, and the revenue per km is $4.\nThe company has a total of 100 trucks available for deployment. Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000. The company has a fuel budget of 5000 liters for the season. The company wants to ensure that each type of truck is deployed at least once to maintain operational familiarity.\nPlease help the company to maximize the total profit per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=1)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=1)  # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n# Calculate distances and profits\nDistance_TruckA = TruckA * model.addVar(name=\"Average_Distance\")\nDistance_TruckB = TruckB * model.addVar(name=\"Average_Distance\")\nDistance_TruckC = TruckC * model.addVar(name=\"Average_Distance\")\nDistance_TruckD = TruckD * model.addVar(name=\"Average_Distance\")\nDistance_TruckE = TruckE * model.addVar(name=\"Average_Distance\")\n\nProfit_TruckA = (2 - 0.5) * Distance_TruckA / 10\nProfit_TruckB = (2.5 - 0.6) * Distance_TruckB / 12\nProfit_TruckC = (3 - 0.7) * Distance_TruckC / 15\nProfit_TruckD = (3.5 - 0.8) * Distance_TruckD / 18\nProfit_TruckE = (4 - 0.9) * Distance_TruckE / 20\n\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE) / (TruckA + TruckB + TruckC + TruckD + TruckE)\n## convert the division to multiplication\nmodel.addCons(obj * (TruckA + TruckB + TruckC + TruckD + TruckE) == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD + Profit_TruckE)\n\n# Add constraints\n## The company has a total of 100 trucks available for deployment.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\n\n## Due to maintenance constraints, the total maintenance cost across all trucks should not exceed $10,000.\nmodel.addCons(0.5 * Distance_TruckA + 0.6 * Distance_TruckB + 0.7 * Distance_TruckC + 0.8 * Distance_TruckD + 0.9 * Distance_TruckE <= 10000)\n\n## The company has a fuel budget of 5000 liters for the season.\nmodel.addCons(10 * Distance_TruckA + 12 * Distance_TruckB + 15 * Distance_TruckC + 18 * Distance_TruckD + 20 * Distance_TruckE <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements.\n// {\"number of trucks for Small packages\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Medium packages\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Large packages\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for X-Large packages\": \"XL_Trucks\", \"range\": \"XL_Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Special packages\": \"SpecialTrucks\", \"range\": \"SpecialTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of transporting Small packages is $1000 per truck, Medium packages is $1500 per truck, Large packages is $2000 per truck, X-Large packages is $2500 per truck, and Special packages is $3000 per truck. Due to fuel efficiency and maintenance, the cost per truck decreases by $10 for every additional truck allocated to the same package type. The company aims to minimize the total transportation cost.\n// Cost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\n// Cost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\n// Cost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\n// Cost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\n// Cost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n// So, the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\n// SpecialTrucks >= 0.5 * LargeTrucks\n\n## Generate Constraint-3:\nThe company must ensure that at least 10 trucks are allocated to Small and Medium packages combined.\n// SmallTrucks + MediumTrucks >= 10\n\n## Generate Constraint-4:\nThe demand for X-Large packages requires at least 5 trucks dedicated to them.\n// XL_Trucks >= 5\n\n## Generate Constraint-5:\nThe total cost of transporting Special packages should not exceed $15,000.\n// Cost_Special <= 15000",
        "question": "A logistics company is managing the distribution of five different types of packages: Small, Medium, Large, X-Large, and Special. They need to determine the optimal number of trucks to allocate for each package type to minimize transportation costs while meeting delivery requirements. The cost of transporting each type of package per truck is given in the following Table.\n\n| Package Type | Cost per Truck |\n|--------------|----------------|\n| Small        | $1000          |\n| Medium       | $1500          |\n| Large        | $2000          |\n| X-Large      | $2500          |\n| Special      | $3000          |\n\nThe cost per truck decreases by $10 for every additional truck allocated to the same package type. The company has a total of 50 trucks available for allocation. Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages. The company must ensure that at least 10 trucks are allocated to Small and Medium packages combined. The demand for X-Large packages requires at least 5 trucks dedicated to them. The total cost of transporting Special packages should not exceed $15,000.\n\nPlease help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nXL_Trucks = model.addVar(vtype=\"INTEGER\", name=\"XL_Trucks\", lb=5)  # Constraint-4: XL_Trucks >= 5\nSpecialTrucks = model.addVar(vtype=\"INTEGER\", name=\"SpecialTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Cost calculation with the decrease in cost per additional truck\nCost_Small = (1000 - 10 * SmallTrucks) * SmallTrucks\nCost_Medium = (1500 - 10 * MediumTrucks) * MediumTrucks\nCost_Large = (2000 - 10 * LargeTrucks) * LargeTrucks\nCost_XL = (2500 - 10 * XL_Trucks) * XL_Trucks\nCost_Special = (3000 - 10 * SpecialTrucks) * SpecialTrucks\n\n## the objective function is: Minimize (Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\nmodel.addCons(obj == Cost_Small + Cost_Medium + Cost_Large + Cost_XL + Cost_Special)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + XL_Trucks + SpecialTrucks <= 50)\n\n## Due to contractual agreements, the number of trucks allocated to Special packages must be at least half the number allocated to Large packages.\nmodel.addCons(SpecialTrucks >= 0.5 * LargeTrucks)\n\n## The company must ensure that at least 10 trucks are allocated to Small and Medium packages combined.\nmodel.addCons(SmallTrucks + MediumTrucks >= 10)\n\n## The total cost of transporting Special packages should not exceed $15,000.\nmodel.addCons(Cost_Special <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Small Packages: \", model.getVal(SmallTrucks))\n    print(\"Number of Trucks for Medium Packages: \", model.getVal(MediumTrucks))\n    print(\"Number of Trucks for Large Packages: \", model.getVal(LargeTrucks))\n    print(\"Number of Trucks for X-Large Packages: \", model.getVal(XL_Trucks))\n    print(\"Number of Trucks for Special Packages: \", model.getVal(SpecialTrucks))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product and the level of automation to be implemented in the production process. Higher levels of automation reduce the labor cost per unit but increase the initial investment cost.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by $5 for every $1000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investments.\n// AutomationLevel <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1000 units of ProductC are produced.\n// QuantityC >= 1000\n\n## Generate Constraint-5:\nThe total labor cost, including the effect of automation, must not exceed $250,000.\n// (50 - 0.005 * AutomationLevel) * QuantityA + (60 - 0.005 * AutomationLevel) * QuantityB + (70 - 0.005 * AutomationLevel) * QuantityC <= 250000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities for each product and the level of automation to be implemented in the production process. Higher levels of automation reduce the labor cost per unit but increase the initial investment cost. The selling price per unit and the initial labor cost per unit for each product are given in the following Table.\n\n| Product | Selling Price per Unit | Initial Labor Cost per Unit |\n|---------|------------------------|-----------------------------|\n| ProductA | $100                   | $50                         |\n| ProductB | $120                   | $60                         |\n| ProductC | $140                   | $70                         |\n\nThe company has a budget of $100,000 for automation investments. The total production capacity for all products is 5000 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must ensure that at least 1000 units of ProductC are produced. The total labor cost, including the effect of automation, must not exceed $250,000.\n\nPlease help the company to maximize the total profit from all products, considering the effect of automation on the labor cost per unit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity for ProductC\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.005 * AutomationLevel) * QuantityA\nProfitB = (120 - 60 + 0.005 * AutomationLevel) * QuantityB\nProfitC = (140 - 70 + 0.005 * AutomationLevel) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(AutomationLevel <= 100000)  # The company has a budget of $100,000 for automation investments.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)  # The total production capacity for all products is 5000 units.\nmodel.addCons(QuantityA >= 2 * QuantityB)  # Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityC >= 1000)  # The company must ensure that at least 1000 units of ProductC are produced.\nmodel.addCons((50 - 0.005 * AutomationLevel) * QuantityA + (60 - 0.005 * AutomationLevel) * QuantityB + (70 - 0.005 * AutomationLevel) * QuantityC <= 250000)  # The total labor cost, including the effect of automation, must not exceed $250,000.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the varying efficiency and cost of each machine.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for each product varies based on the machine used. \nFor product A, machine 1 yields a profit of $50, machine 2 yields $45, and machine 3 yields $40.\nFor product B, machine 1 yields a profit of $60, machine 2 yields $55, and machine 3 yields $50.\nFor product C, machine 1 yields a profit of $70, machine 2 yields $65, and machine 3 yields $60.\nFor product D, machine 1 yields a profit of $80, machine 2 yields $75, and machine 3 yields $70.\nFor product E, machine 1 yields a profit of $90, machine 2 yields $85, and machine 3 yields $80.\nThe company wants to maximize the total profit from all products.\n// Total profit = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\n// So, the objective function is: Maximize Total profit\n\n## Generate Constraint-1:\nThe total production time for all machines is limited to 100 hours.\n// 0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E <= 100\n\n## Generate Constraint-2:\nThe company has a minimum order requirement for each product: at least 10 units of A, 20 units of B, 30 units of C, 40 units of D, and 50 units of E.\n// A >= 10\n// B >= 20\n// C >= 30\n// D >= 40\n// E >= 50\n\n## Generate Constraint-3:\nThe total number of units produced for all products must not exceed 500.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 30% of the total production time is spent on any single product.\n// 0.1 * A <= 0.3 * 100\n// 0.2 * B <= 0.3 * 100\n// 0.3 * C <= 0.3 * 100\n// 0.4 * D <= 0.3 * 100\n// 0.5 * E <= 0.3 * 100",
        "question": "A manufacturing company produces five types of products (A, B, C, D, E) using three different machines. The company needs to optimize the production schedule to maximize profit while considering the varying efficiency and cost of each machine. The profit per unit for each product varies based on the machine used, as shown in the following Table.\n\n| Product | Machine 1 Profit | Machine 2 Profit | Machine 3 Profit |\n|---------|------------------|------------------|------------------|\n| A       | 50$              | 45$              | 40$              |\n| B       | 60$              | 55$              | 50$              |\n| C       | 70$              | 65$              | 60$              |\n| D       | 80$              | 75$              | 70$              |\n| E       | 90$              | 85$              | 80$              |\n\nThe company wants to maximize the total profit from all products. The total production time for all machines is limited to 100 hours. The company has a minimum order requirement for each product: at least 10 units of A, 20 units of B, 30 units of C, 40 units of D, and 50 units of E. The total number of units produced for all products must not exceed 500. The company wants to ensure that no more than 30% of the total production time is spent on any single product.\n\nPlease help the company to determine the optimal number of units of each product to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=30) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=40) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Total profit\nTotal_profit = 50 * A + 60 * B + 70 * C + 80 * D + 90 * E\nmodel.addCons(obj == Total_profit)\n\n# Add constraints\n## The total production time for all machines is limited to 100 hours.\nmodel.addCons(0.1 * A + 0.2 * B + 0.3 * C + 0.4 * D + 0.5 * E <= 100)\n## The total number of units produced for all products must not exceed 500.\nmodel.addCons(A + B + C + D + E <= 500)\n## The company wants to ensure that no more than 30% of the total production time is spent on any single product.\nmodel.addCons(0.1 * A <= 0.3 * 100)\nmodel.addCons(0.2 * B <= 0.3 * 100)\nmodel.addCons(0.3 * C <= 0.3 * 100)\nmodel.addCons(0.4 * D <= 0.3 * 100)\nmodel.addCons(0.5 * E <= 0.3 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1423,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to maximize profit, considering the cost of raw materials, labor, and storage.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, but it incurs a production cost of $20 and a storage cost of $5 per unit. ProductB yields a profit of $70 per unit, with a production cost of $30 and a storage cost of $7 per unit. ProductC yields a profit of $100 per unit, with a production cost of $40 and a storage cost of $10 per unit. The company aims to maximize the total profit.\n// Total profit for ProductA: ProfitA = (50 - 20 - 5) * UnitsA\n// Total profit for ProductB: ProfitB = (70 - 30 - 7) * UnitsB\n// Total profit for ProductC: ProfitC = (100 - 40 - 10) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a monthly budget of $15,000 for production costs.\n// 20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 15,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 500 units per month.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nDue to labor constraints, the total number of units produced cannot exceed 400 per month.\n// UnitsA + UnitsB + UnitsC <= 400",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide how many units of each product to produce per month to maximize profit, considering the cost of raw materials, labor, and storage.\nThe profit per unit of ProductA is $50, but it incurs a production cost of $20 and a storage cost of $5 per unit. ProductB yields a profit of $70 per unit, with a production cost of $30 and a storage cost of $7 per unit. ProductC yields a profit of $100 per unit, with a production cost of $40 and a storage cost of $10 per unit. The company has a monthly budget of $15,000 for production costs. The storage capacity is limited to 500 units per month. Due to labor constraints, the total number of units produced cannot exceed 400 per month.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\n\n# Define objective function\nProfitA = (50 - 20 - 5) * UnitsA\nProfitB = (70 - 30 - 7) * UnitsB\nProfitC = (100 - 40 - 10) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 15000) # Monthly budget constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500) # Storage capacity constraint\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 400) # Labor constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new energy-efficient technology that will reduce the energy cost per unit of production. The investment cost is a one-time fee, and the reduction in energy cost per unit is proportional to the investment.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of ProductA is $5, ProductB is $7, and ProductC is $9. The revenue per unit of ProductA is $15, ProductB is $20, and ProductC is $25. The investment in energy efficiency reduces the energy cost per unit by $0.5 for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (15 - 5 + 0.0005 * EnergyEfficiency) * QuantityA\n// Total profit for ProductB: ProfitB = (20 - 7 + 0.0005 * EnergyEfficiency) * QuantityB\n// Total profit for ProductC: ProfitC = (25 - 9 + 0.0005 * EnergyEfficiency) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product for the next quarter and is considering investing in a new energy-efficient technology that will reduce the energy cost per unit of production. The investment cost is a one-time fee, and the reduction in energy cost per unit is proportional to the investment. The energy cost per unit, revenue per unit, and the effect of the investment on energy cost are given in the following Table.\n\n| Product | Energy Cost per Unit | Revenue per Unit | Reduction in Energy Cost per $1,000 Investment |\n|---------|----------------------|------------------|------------------------------------------------|\n| ProductA | $5                  | $15              | $0.5                                           |\n| ProductB | $7                  | $20              | $0.5                                           |\n| ProductC | $9                  | $25              | $0.5                                           |\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in energy efficiency cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (15 - 5 + 0.0005 * EnergyEfficiency) * QuantityA\nProfitB = (20 - 7 + 0.0005 * EnergyEfficiency) * QuantityB\nProfitC = (25 - 9 + 0.0005 * EnergyEfficiency) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(EnergyEfficiency <= 50000)\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1381,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination.\n// {\"number of trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of sending a truck to D1 is $1000, to D2 is $1200, to D3 is $1500, to D4 is $1800, and to D5 is $2000. The revenue generated by sending a truck to D1 is $1500, to D2 is $1800, to D3 is $2200, to D4 is $2500, and to D5 is $2800. The company wants to maximize the profit (revenue minus cost) per truck sent.\n// Profit_D1 = (1500 * T1 - 1000 * T1) / T1\n// Profit_D2 = (1800 * T2 - 1200 * T2) / T2\n// Profit_D3 = (2200 * T3 - 1500 * T3) / T3\n// Profit_D4 = (2500 * T4 - 1800 * T4) / T4\n// Profit_D5 = (2800 * T5 - 2000 * T5) / T5\n// So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for sending trucks.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe company has a maximum of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company must decide how many trucks to send to each destination. The cost and revenue for sending a truck to each destination are given in the following Table.\n\n| Destination | Cost per Truck | Revenue per Truck |\n|-------------|----------------|-------------------|\n| D1          | $1000          | $1500             |\n| D2          | $1200          | $1800             |\n| D3          | $1500          | $2200             |\n| D4          | $1800          | $2500             |\n| D5          | $2000          | $2800             |\n\nThe company has a total budget of $100,000 for sending trucks. The company has a maximum of 100 trucks available. Please help the company to maximize the profit (revenue minus cost) per truck sent.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks to D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_D1 = (1500 - 1000) * T1\nProfit_D2 = (1800 - 1200) * T2\nProfit_D3 = (2200 - 1500) * T3\nProfit_D4 = (2500 - 1800) * T4\nProfit_D5 = (2800 - 2000) * T5\n## the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3 + Profit_D4 + Profit_D5)\n\n# Add constraints\n## The company has a total budget of $100,000 for sending trucks.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1800 * T4 + 2000 * T5 <= 100000)\n## The company has a maximum of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\n// Total environmental impact: Impact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation.\n// 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 1,000,000 kWh.\n// 200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000\n\n## Generate Constraint-3:\nThe maximum number of solar panels that can be installed at Site A is 1000.\n// SolarA <= 1000\n\n## Generate Constraint-4:\nThe maximum number of wind turbines that can be installed at Site E is 500.\n// WindE <= 500",
        "question": "A city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city has a budget of $1,000,000 for the installation. The total annual energy output must be at least 1,000,000 kWh. The maximum number of solar panels that can be installed at Site A is 1000. The maximum number of wind turbines that can be installed at Site E is 500.\nPlease help the city to minimize the Cost-Environmental Impact ratio of the energy generation (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Site D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Site E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\nImpact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation.\nmodel.addCons(Cost <= 1000000)\n## The total annual energy output must be at least 1,000,000 kWh.\nmodel.addCons(200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000)\n## The maximum number of solar panels that can be installed at Site A is 1000.\nmodel.addCons(SolarA <= 1000)\n## The maximum number of wind turbines that can be installed at Site E is 500.\nmodel.addCons(WindE <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Site E: \", model.getVal(WindE))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1363,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit.\n// Total profit: Profit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month.\n// 2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150\n\n## Generate Constraint-2:\nDue to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to maximize profit, considering the cost of production, market demand, and resource availability. The profit per unit of DeviceA is $50, DeviceB is $70, and DeviceC is $60. The production cost per unit of DeviceA is $30, DeviceB is $40, and DeviceC is $35. The company aims to maximize the total profit. The company has a limited amount of a critical component that is used in the production of all devices. Each unit of DeviceA requires 2 units of this component, DeviceB requires 3 units, and DeviceC requires 4 units. The total available amount of this component is 150 units per month. Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB. Please help the company determine the optimal number of units of each device to produce per month to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\nProfit = (50 - 30) * UnitsA + (70 - 40) * UnitsB + (60 - 35) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited amount of a critical component that is used in the production of all devices.\nmodel.addCons(2 * UnitsA + 3 * UnitsB + 4 * UnitsC <= 150)\n# Due to market research, the company knows that the demand for DeviceA is at least twice the demand for DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices. The company needs to decide the number of units to produce for each device to optimize profits while considering the constraints of production capacity and market demand.\n// {\"number of units of device 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of device 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"production cost per unit of device 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"production cost per unit of device 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"production cost per unit of device 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each device is determined by the selling price minus the production cost per unit. The selling price for device 1 is $100, for device 2 is $150, and for device 3 is $200. The objective is to maximize the total profit.\n// The profit from device 1: P1 = (100 - C1) * D1\n// The profit from device 2: P2 = (150 - C2) * D2\n// The profit from device 3: P3 = (200 - C3) * D3\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total production cost must not exceed $10,000.\n// C1 * D1 + C2 * D2 + C3 * D3 <= 10000\n\n## Generate Constraint-2:\nThe market demand for device 1 is at least 100 units, for device 2 is at least 150 units, and for device 3 is at least 200 units.\n// D1 >= 100; D2 >= 150; D3 >= 200\n\n## Generate Constraint-3:\nThe production capacity allows a maximum of 500 units in total.\n// D1 + D2 + D3 <= 500\n\n## Generate Constraint-4:\nThe production cost per unit for each device is related to the number of units produced, following a nonlinear function: C1 = 0.01 * D1^2, C2 = 0.015 * D2^2, C3 = 0.02 * D3^2.\n// C1 = 0.01 * D1^2; C2 = 0.015 * D2^2; C3 = 0.02 * D3^2",
        "question": "A manufacturing company produces three types of electronic devices. The company needs to decide the number of units to produce for each device to optimize profits while considering the constraints of production capacity and market demand.\nThe profit from each device is determined by the selling price minus the production cost per unit. The selling price for device 1 is $100, for device 2 is $150, and for device 3 is $200. The objective is to maximize the total profit.\nThe total production cost must not exceed $10,000. The market demand for device 1 is at least 100 units, for device 2 is at least 150 units, and for device 3 is at least 200 units. The production capacity allows a maximum of 500 units in total. The production cost per unit for each device is related to the number of units produced, following a nonlinear function: C1 = 0.01 * D1^2, C2 = 0.015 * D2^2, C3 = 0.02 * D3^2.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=100) # number of units of device 1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=150) # number of units of device 2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=200) # number of units of device 3\n\n# Define objective function\nP1 = (100 - 0.01 * D1**2) * D1\nP2 = (150 - 0.015 * D2**2) * D2\nP3 = (200 - 0.02 * D3**2) * D3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(0.01 * D1**2 * D1 + 0.015 * D2**2 * D2 + 0.02 * D3**2 * D3 <= 10000)\nmodel.addCons(D1 + D2 + D3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device 1: \", model.getVal(D1))\n    print(\"Number of Device 2: \", model.getVal(D2))\n    print(\"Number of Device 3: \", model.getVal(D3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit and the production rate. Additionally, the company needs to determine the marketing budget to increase the sales of each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $1,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - 100 + 0.005 * Automation) * QuantityA + 0.001 * MarketingBudget * QuantityA\n// Total profit for ProductB: ProfitB = (200 - 150 + 0.005 * Automation) * QuantityB + 0.001 * MarketingBudget * QuantityB\n// Total profit for ProductC: ProfitC = (250 - 200 + 0.005 * Automation) * QuantityC + 0.001 * MarketingBudget * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $20,000.\n// MarketingBudget <= 20000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit and the production rate. Additionally, the company needs to determine the marketing budget to increase the sales of each product. The production cost per unit decreases by $5 for every $1,000 invested in automation. The initial production cost per unit for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The marketing budget increases the sales by 1% for every $1,000 spent. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units per month. The total investment in automation cannot exceed $50,000. The total marketing budget cannot exceed $20,000.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\n\n# Define objective function\nProfitA = (150 - 100 + 0.005 * Automation) * QuantityA + 0.001 * MarketingBudget * QuantityA\nProfitB = (200 - 150 + 0.005 * Automation) * QuantityB + 0.001 * MarketingBudget * QuantityB\nProfitC = (250 - 200 + 0.005 * Automation) * QuantityC + 0.001 * MarketingBudget * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)  # total production capacity constraint\nmodel.addCons(Automation <= 50000)  # automation investment constraint\nmodel.addCons(MarketingBudget <= 20000)  # marketing budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of product. The profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products.\n// Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n// Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n// Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours.\n// M1 + M2 + M3 + M4 <= 100",
        "question": "A manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production. Each machine has a different efficiency in producing each type of product. The profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products. The total operating hours for all machines must not exceed 100 hours. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\n\n# Define objective function\n# Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\nP1 = (100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2\n# Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\nP2 = (110 - 0.15 * M3**2) * M3 + (130 - 0.25 * M4**2) * M4\n# Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\nP3 = (120 - 0.3 * M1**2) * M1 + (140 - 0.4 * M2**2) * M2 + (150 - 0.5 * M3**2) * M3 + (160 - 0.6 * M4**2) * M4\n# The objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total operating hours for all machines must not exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 + M4 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 571,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit. The profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\n// Total profit for Route1: Profit1 = (1000 + 0.2 * Upgrade1) * Trucks1\n// Total profit for Route2: Profit2 = (1200 + 0.24 * Upgrade2) * Trucks2\n// Total profit for Route3: Profit3 = (900 + 0.18 * Upgrade3) * Trucks3\n// Additional profit from advertising: AdvertisingProfit = 5 * Advertising\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n## Generate Constraint-1:\nThe total budget for trucks, upgrades, and advertising is $100,000.\n// Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000\n\n## Generate Constraint-2:\nThe maximum number of trucks that can be deployed across all routes is 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200",
        "question": "A logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand. The profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. The profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. The profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. The advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\n\n| Route | Profit per Truck | Upgrade Profit per $500 |\n|-------|------------------|-------------------------|\n| Route1 | $1000           | $100 per truck         |\n| Route2 | $1200           | $120 per truck         |\n| Route3 | $900            | $90 per truck          |\n\nThe total budget for trucks, upgrades, and advertising is $100,000. The maximum number of trucks that can be deployed across all routes is 200.\n\nPlease help the company to maximize its quarterly profit by determining the optimal number of trucks for each route, the amount of fuel efficiency upgrades, and the advertising budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\n\n# Define objective function\nProfit1 = (1000 + 0.2 * Upgrade1) * Trucks1\nProfit2 = (1200 + 0.24 * Upgrade2) * Trucks2\nProfit3 = (900 + 0.18 * Upgrade3) * Trucks3\nAdvertisingProfit = 5 * Advertising\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1481,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each truck. The fuel consumption rate is affected by the investment in fuel-efficient technologies for each truck.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Route1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Route2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Route3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate decreases with the investment in fuel-efficient technologies. The initial fuel consumption rate for each truck is 50 liters per 100 km, but with technology investment, the rate decreases by 1 liter per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route1: Consumption1 = 50 - 0.01 * Tech1\n// Fuel consumption for Route2: Consumption2 = 50 - 0.01 * Tech2\n// Fuel consumption for Route3: Consumption3 = 50 - 0.01 * Tech3\n// Total fuel consumption: TotalConsumption = Consumption1 * Trucks1 + Consumption2 * Trucks2 + Consumption3 * Trucks3\n// So, the objective function is: Minimize TotalConsumption\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must allocate at least 10 trucks to Route1 and 15 trucks to Route2.\n// Trucks1 >= 10; Trucks2 >= 15",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company needs to determine the number of trucks to allocate to each route and the fuel consumption rate for each truck. The fuel consumption rate is affected by the investment in fuel-efficient technologies for each truck. The initial fuel consumption rate for each truck is 50 liters per 100 km, but with technology investment, the rate decreases by 1 liter per 100 km for every $100 invested. The company aims to minimize the total fuel consumption across all routes. The company has a total budget of $100,000 for truck allocation and technology investments. The total number of trucks available is limited to 50. Due to contractual obligations, the company must allocate at least 10 trucks to Route1 and 15 trucks to Route2.\n\nPlease help the company to determine the optimal allocation of trucks and investments in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=15)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)    # number of trucks for Route3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)    # investment in fuel-efficient technologies for Route1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)    # investment in fuel-efficient technologies for Route2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)    # investment in fuel-efficient technologies for Route3\n\n# Define objective function\nConsumption1 = 50 - 0.01 * Tech1\nConsumption2 = 50 - 0.01 * Tech2\nConsumption3 = 50 - 0.01 * Tech3\nTotalConsumption = Consumption1 * Trucks1 + Consumption2 * Trucks2 + Consumption3 * Trucks3\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalConsumption)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Tech1 + Tech2 + Tech3 <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Route1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Route2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Route3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good to optimize delivery efficiency. Additionally, the company is considering investing in a new fleet management system that can reduce the operational costs per truck, depending on the level of investment.\n// {\"number of trucks for GoodsX\": \"TrucksX\", \"range\": \"TrucksX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsY\": \"TrucksY\", \"range\": \"TrucksY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodsZ\": \"TrucksZ\", \"range\": \"TrucksZ >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management system for GoodsX\": \"FleetX\", \"range\": \"FleetX >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsY\": \"FleetY\", \"range\": \"FleetY >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management system for GoodsZ\": \"FleetZ\", \"range\": \"FleetZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for GoodsX: CostX = (1000 - 0.1 * FleetX) * TrucksX\n// Total operational cost for GoodsY: CostY = (1200 - 0.12 * FleetY) * TrucksY\n// Total operational cost for GoodsZ: CostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n// So, the objective function is: Minimize (CostX + CostY + CostZ)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and fleet management system investments.\n// (1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for distribution is limited to 500.\n// TrucksX + TrucksY + TrucksZ <= 500",
        "question": "A logistics company manages the distribution of three types of goods: GoodsX, GoodsY, and GoodsZ. The company needs to determine the number of trucks to allocate for each type of good and the level of investment in a fleet management system to optimize delivery efficiency. The operational cost per truck decreases with the investment in the fleet management system. For GoodsX, the initial cost per truck is $1000, and it decreases by $10 for every $100 invested in the fleet management system. For GoodsY, the initial cost per truck is $1200, and it decreases by $12 for every $100 invested. For GoodsZ, the initial cost per truck is $1500, and it decreases by $15 for every $100 invested. The company has a total budget of $100,000 for truck operations and fleet management system investments. The total number of trucks available for distribution is limited to 500. Please help the company to minimize the total operational cost of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksX = model.addVar(vtype=\"INTEGER\", name=\"TrucksX\", lb=0)  # number of trucks for GoodsX\nTrucksY = model.addVar(vtype=\"INTEGER\", name=\"TrucksY\", lb=0)  # number of trucks for GoodsY\nTrucksZ = model.addVar(vtype=\"INTEGER\", name=\"TrucksZ\", lb=0)  # number of trucks for GoodsZ\nFleetX = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetX\", lb=0)  # investment in fleet management system for GoodsX\nFleetY = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetY\", lb=0)  # investment in fleet management system for GoodsY\nFleetZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FleetZ\", lb=0)  # investment in fleet management system for GoodsZ\n\n# Define objective function\nCostX = (1000 - 0.1 * FleetX) * TrucksX\nCostY = (1200 - 0.12 * FleetY) * TrucksY\nCostZ = (1500 - 0.15 * FleetZ) * TrucksZ\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostX + CostY + CostZ)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck operations and fleet management system investments.\nmodel.addCons((1000 - 0.1 * FleetX) * TrucksX + (1200 - 0.12 * FleetY) * TrucksY + (1500 - 0.15 * FleetZ) * TrucksZ + FleetX + FleetY + FleetZ <= 100000)\n\n# The total number of trucks available for distribution is limited to 500.\nmodel.addCons(TrucksX + TrucksY + TrucksZ <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodsX: \", model.getVal(TrucksX))\n    print(\"Number of Trucks for GoodsY: \", model.getVal(TrucksY))\n    print(\"Number of Trucks for GoodsZ: \", model.getVal(TrucksZ))\n    print(\"Investment in Fleet Management System for GoodsX: \", model.getVal(FleetX))\n    print(\"Investment in Fleet Management System for GoodsY: \", model.getVal(FleetY))\n    print(\"Investment in Fleet Management System for GoodsZ: \", model.getVal(FleetZ))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities and fuel efficiencies. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/liter, Truck B has a fuel efficiency of 8 km/liter, and Truck C has a fuel efficiency of 10 km/liter. The company wants to maximize the total distance covered per liter of fuel.\n// FuelEfficiency_A = 5 * TruckA\n// FuelEfficiency_B = 8 * TruckB\n// FuelEfficiency_C = 10 * TruckC\n// So, the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / (TruckA + TruckB + TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for purchasing trucks. The cost of Truck A is $20,000, Truck B is $30,000, and Truck C is $40,000.\n// 20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000\n\n## Generate Constraint-2:\nThe total weight capacity of all trucks must not exceed 50,000 kg. Truck A can carry 5,000 kg, Truck B can carry 8,000 kg, and Truck C can carry 10,000 kg.\n// 5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000\n\n## Generate Constraint-3:\nThe company must fulfill a delivery demand of at least 100,000 km. Each Truck A can cover 50,000 km, Truck B can cover 80,000 km, and Truck C can cover 100,000 km.\n// 50000 * TruckA + 80000 * TruckB + 100000 * TruckC >= 100000\n\n## Generate Constraint-4:\nThe company has a limit on the number of trucks it can operate, which is 10.\n// TruckA + TruckB + TruckC <= 10",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C, each with different capacities, fuel efficiencies, and costs. The company needs to determine the number of each type of truck to maximize their overall fuel efficiency while meeting delivery demands. The specifications for each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Cost (USD) | Weight Capacity (kg) | Distance Capacity (km) |\n|------------|---------------------------|------------|----------------------|------------------------|\n| A          | 5                         | 20,000     | 5,000                | 50,000                 |\n| B          | 8                         | 30,000     | 8,000                | 80,000                 |\n| C          | 10                        | 40,000     | 10,000               | 100,000                |\n\nThe company has a total budget of $100,000 for purchasing trucks. The total weight capacity of all trucks must not exceed 50,000 kg. The company must fulfill a delivery demand of at least 100,000 km. The company has a limit on the number of trucks it can operate, which is 10.\nPlease help the company to maximize the total distance covered per liter of fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nFuelEfficiency_A = 5 * TruckA\nFuelEfficiency_B = 8 * TruckB\nFuelEfficiency_C = 10 * TruckC\nTotalTrucks = TruckA + TruckB + TruckC\n## the objective function is: Maximize (FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelEfficiency_A + FuelEfficiency_B + FuelEfficiency_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * TruckA + 30000 * TruckB + 40000 * TruckC <= 100000)\n## The total weight capacity of all trucks must not exceed 50,000 kg.\nmodel.addCons(5000 * TruckA + 8000 * TruckB + 10000 * TruckC <= 50000)\n## The company must fulfill a delivery demand of at least 100,000 km.\nmodel.addCons(50000 * TruckA + 80000 * TruckB + 100000 * TruckC >= 100000)\n## The company has a limit on the number of trucks it can operate, which is 10.\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Fuel Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000\n\n## Generate Constraint-2:\nThe company has a limited storage space that can hold a maximum of 100 units in total.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company has a total production budget of $100,000. The company also has a limited storage space that can hold a maximum of 100 units in total.\nPlease help the company to maximize the total net profit, which is the revenue minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\n# The company has a total production budget of $100,000.\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n# The company has a limited storage space that can hold a maximum of 100 units in total.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the optimal route length for each type of truck to maximize profit. The route length affects the fuel efficiency and thus the operational cost of each truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"route length for Small trucks\": \"SmallRouteLength\", \"range\": \"SmallRouteLength >= 0\", \"type\": \"continuous\"}\n// {\"route length for Medium trucks\": \"MediumRouteLength\", \"range\": \"MediumRouteLength >= 0\", \"type\": \"continuous\"}\n// {\"route length for Large trucks\": \"LargeRouteLength\", \"range\": \"LargeRouteLength >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the route length, which influences fuel efficiency and operational costs. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The operational cost per mile decreases with increasing route length: for Small trucks, it decreases by $0.01 per mile for every 10 miles increase in route length; for Medium trucks, it decreases by $0.015 per mile for every 10 miles increase in route length; for Large trucks, it decreases by $0.02 per mile for every 10 miles increase in route length. The company aims to maximize the total daily profit from all trucks.\n// Profit_Small = SmallTrucks * SmallRouteLength * (0.50 - 0.01 * (SmallRouteLength / 10))\n// Profit_Medium = MediumTrucks * MediumRouteLength * (0.70 - 0.015 * (MediumRouteLength / 10))\n// Profit_Large = LargeTrucks * LargeRouteLength * (1.00 - 0.02 * (LargeRouteLength / 10))\n// So, the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a Small truck is $20,000, a Medium truck is $30,000, and a Large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000\n\n## Generate Constraint-2:\nThe company has a daily operational limit of 5000 miles for all trucks combined.\n// SmallTrucks * SmallRouteLength + MediumTrucks * MediumRouteLength + LargeTrucks * LargeRouteLength <= 5000",
        "question": "A logistics company operates three different types of trucks: Small, Medium, and Large. The company needs to determine the optimal number of each type of truck to purchase and the optimal route length for each type of truck to maximize profit. The route length affects the fuel efficiency and thus the operational cost of each truck. The profit per mile for Small trucks is $0.50, for Medium trucks is $0.70, and for Large trucks is $1.00. The operational cost per mile decreases with increasing route length: for Small trucks, it decreases by $0.01 per mile for every 10 miles increase in route length; for Medium trucks, it decreases by $0.015 per mile for every 10 miles increase in route length; for Large trucks, it decreases by $0.02 per mile for every 10 miles increase in route length. The company aims to maximize the total daily profit from all trucks.\n\n| Truck Type | Profit per Mile | Cost Decrease per Mile (per 10 miles increase in route length) |\n|------------|-----------------|------------------------------------------------------------------|\n| Small      | $0.50           | $0.01                                                           |\n| Medium     | $0.70           | $0.015                                                          |\n| Large      | $1.00           | $0.02                                                           |\n\nThe company has a budget of $100,000 for purchasing trucks. The cost of a Small truck is $20,000, a Medium truck is $30,000, and a Large truck is $40,000. The company has a daily operational limit of 5000 miles for all trucks combined.\n\nPlease help the company to maximize the total daily profit from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallRouteLength\", lb=0)\nMediumRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumRouteLength\", lb=0)\nLargeRouteLength = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeRouteLength\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit calculations with route length adjustments\nProfit_Small = SmallTrucks * SmallRouteLength * (0.50 - 0.01 * (SmallRouteLength / 10))\nProfit_Medium = MediumTrucks * MediumRouteLength * (0.70 - 0.015 * (MediumRouteLength / 10))\nProfit_Large = LargeTrucks * LargeRouteLength * (1.00 - 0.02 * (LargeRouteLength / 10))\n## the objective function is: Maximize (Profit_Small + Profit_Medium + Profit_Large)\nmodel.addCons(obj == Profit_Small + Profit_Medium + Profit_Large)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n## The company has a daily operational limit of 5000 miles for all trucks combined.\nmodel.addCons(SmallTrucks * SmallRouteLength + MediumTrucks * MediumRouteLength + LargeTrucks * LargeRouteLength <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Route Length for Small Trucks: \", model.getVal(SmallRouteLength))\n    print(\"Route Length for Medium Trucks: \", model.getVal(MediumRouteLength))\n    print(\"Route Length for Large Trucks: \", model.getVal(LargeRouteLength))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1672,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing investment for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * MarketingA, for ProductB as DemandB = 1500 - 10 * PriceB + 0.01 * MarketingB, and for ProductC as DemandC = 2000 - 15 * PriceC + 0.01 * MarketingC. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (PriceA - 50) * (1000 - 5 * PriceA + 0.01 * MarketingA)\n// Total profit for ProductB: ProfitB = (PriceB - 70) * (1500 - 10 * PriceB + 0.01 * MarketingB)\n// Total profit for ProductC: ProfitC = (PriceC - 90) * (2000 - 15 * PriceC + 0.01 * MarketingC)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-2:\nThe total marketing budget is $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $60.\n// PriceA >= 60; PriceB >= 60; PriceC >= 60",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the amount of investment in marketing to increase the demand for each product. The demand for each product is influenced by the marketing investment and the price of the product. The cost of producing each unit of ProductA is $50, ProductB is $70, and ProductC is $90. The company aims to maximize the total profit from all products.\n\n| Product | Cost per Unit |\n|---------|---------------|\n| ProductA | 50$           |\n| ProductB | 70$           |\n| ProductC | 90$           |\n\nThe total production capacity of the company is 5000 units. The total marketing budget is $50,000. The price of each product must be at least $60.\n\nPlease help the company to determine the optimal production quantity, selling price, and marketing investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=60)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=60)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=60)  # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing investment for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing investment for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing investment for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * MarketingA\nDemandB = 1500 - 10 * PriceB + 0.01 * MarketingB\nDemandC = 2000 - 15 * PriceC + 0.01 * MarketingC\nProfitA = (PriceA - 50) * DemandA\nProfitB = (PriceB - 70) * DemandB\nProfitC = (PriceC - 90) * DemandC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Investment for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Investment for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Investment for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 989,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100\n\n## Generate Constraint-2:\nThe total fuel budget per day is $5000.\n// 0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The profit per trip, fuel cost per kilometer, and maintenance cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Cost per Kilometer | Maintenance Cost per Trip |\n|------------|-----------------|-------------------------|---------------------------|\n| A          | $500            | $0.5                    | $100                      |\n| B          | $700            | $0.7                    | $150                      |\n| C          | $900            | $0.9                    | $200                      |\n| D          | $1100           | $1.1                    | $250                      |\n\nThe company aims to maximize the total profit from all trips, considering the costs. The total number of trucks available is 100. The total fuel budget per day is $5000. Please help the company to determine the optimal allocation of trucks to different routes to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the distance dependency in the objective function\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100) # total number of trucks available is 100\nmodel.addCons(0.5 * Distance * TruckA + 0.7 * Distance * TruckB + 0.9 * Distance * TruckC + 1.1 * Distance * TruckD <= 5000) # total fuel budget per day is $5000\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(TruckA))\n    print(\"Number of Trucks of Type B: \", model.getVal(TruckB))\n    print(\"Number of Trucks of Type C: \", model.getVal(TruckC))\n    print(\"Number of Trucks of Type D: \", model.getVal(TruckD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to build five different types of facilities: a hospital, a school, a park, a library, and a community center. The city needs to determine the optimal number of each facility to maximize the overall utility while considering budget and space constraints.\n// {\"number of hospitals\": \"Hospital\", \"range\": \"Hospital >= 0\", \"type\": \"integer\"}\n// {\"number of schools\": \"School\", \"range\": \"School >= 0\", \"type\": \"integer\"}\n// {\"number of parks\": \"Park\", \"range\": \"Park >= 0\", \"type\": \"integer\"}\n// {\"number of libraries\": \"Library\", \"range\": \"Library >= 0\", \"type\": \"integer\"}\n// {\"number of community centers\": \"CommunityCenter\", \"range\": \"CommunityCenter >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe utility of each facility is estimated as follows:\n- Hospital: $100,000 per facility, with a utility factor of 1.2.\n- School: $80,000 per facility, with a utility factor of 1.5.\n- Park: $50,000 per facility, with a utility factor of 0.8.\n- Library: $60,000 per facility, with a utility factor of 1.0.\n- Community Center: $70,000 per facility, with a utility factor of 1.1.\nThe city wants to maximize the total utility of all facilities, which is the sum of the utility factors multiplied by the number of each type of facility.\n// TotalUtility = 1.2 * 100000 * Hospital + 1.5 * 80000 * School + 0.8 * 50000 * Park + 1.0 * 60000 * Library + 1.1 * 70000 * CommunityCenter\n// So, the objective function is: Maximize TotalUtility\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for all facilities.\n// 100000 * Hospital + 80000 * School + 50000 * Park + 60000 * Library + 70000 * CommunityCenter <= 1000000\n\n## Generate Constraint-2:\nThe city has a limited space for construction, with a maximum of 10 facilities in total.\n// Hospital + School + Park + Library + CommunityCenter <= 10\n\n## Generate Constraint-3:\nThe city requires at least 2 hospitals and 3 schools to meet the basic needs.\n// Hospital >= 2\n// School >= 3",
        "question": "A city is planning to build five different types of facilities: a hospital, a school, a park, a library, and a community center. The city needs to determine the optimal number of each facility to maximize the overall utility while considering budget and space constraints. The utility of each facility, along with its cost, is given in the following Table.\n\n| Facility         | Cost per Facility | Utility Factor |\n|------------------|-------------------|----------------|\n| Hospital         | $100,000          | 1.2            |\n| School           | $80,000           | 1.5            |\n| Park             | $50,000           | 0.8            |\n| Library          | $60,000           | 1.0            |\n| Community Center | $70,000           | 1.1            |\n\nThe city has a budget of $1,000,000 for all facilities. The city has a limited space for construction, with a maximum of 10 facilities in total. The city requires at least 2 hospitals and 3 schools to meet the basic needs.\n\nPlease help the city to maximize the total utility of all facilities, which is the sum of the utility factors multiplied by the number of each type of facility.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHospital = model.addVar(vtype=\"INTEGER\", name=\"Hospital\", lb=0)  # number of hospitals\nSchool = model.addVar(vtype=\"INTEGER\", name=\"School\", lb=0)  # number of schools\nPark = model.addVar(vtype=\"INTEGER\", name=\"Park\", lb=0)  # number of parks\nLibrary = model.addVar(vtype=\"INTEGER\", name=\"Library\", lb=0)  # number of libraries\nCommunityCenter = model.addVar(vtype=\"INTEGER\", name=\"CommunityCenter\", lb=0)  # number of community centers\n\n# Define objective function\nTotalUtility = 1.2 * 100000 * Hospital + 1.5 * 80000 * School + 0.8 * 50000 * Park + 1.0 * 60000 * Library + 1.1 * 70000 * CommunityCenter\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalUtility)\n\n# Add constraints\n# The city has a budget of $1,000,000 for all facilities.\nmodel.addCons(100000 * Hospital + 80000 * School + 50000 * Park + 60000 * Library + 70000 * CommunityCenter <= 1000000)\n# The city has a limited space for construction, with a maximum of 10 facilities in total.\nmodel.addCons(Hospital + School + Park + Library + CommunityCenter <= 10)\n# The city requires at least 2 hospitals and 3 schools to meet the basic needs.\nmodel.addCons(Hospital >= 2)\nmodel.addCons(School >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hospitals: \", model.getVal(Hospital))\n    print(\"Number of Schools: \", model.getVal(School))\n    print(\"Number of Parks: \", model.getVal(Park))\n    print(\"Number of Libraries: \", model.getVal(Library))\n    print(\"Number of Community Centers: \", model.getVal(CommunityCenter))\n    print(\"Maximized Total Utility: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and capacities. The company needs to decide how many of each type of truck to deploy.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel consumption rate (gallons per mile) and a different speed (miles per hour). The company wants to minimize the total fuel consumption while ensuring timely deliveries. The fuel consumption rates are as follows: T1 = 0.1 gal/mi, T2 = 0.08 gal/mi, T3 = 0.06 gal/mi, T4 = 0.05 gal/mi, T5 = 0.04 gal/mi. The speeds are: T1 = 50 mph, T2 = 55 mph, T3 = 60 mph, T4 = 65 mph, T5 = 70 mph. The objective is to minimize the total fuel consumption per delivery time.\n// Fuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\n// Delivery_Time = (1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5))\n// So, the objective function is: Minimize Fuel_Consumption / Delivery_Time\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000.\n// 20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe company has a contract that requires at least 15 deliveries per hour.\n// (50 * T1) + (55 * T2) + (60 * T3) + (65 * T4) + (70 * T5) >= 15",
        "question": "A logistics company is planning its fleet of trucks to optimize fuel consumption and delivery times. They have five types of trucks: T1, T2, T3, T4, and T5, each with different fuel efficiencies and speeds. The company needs to decide how many of each type of truck to deploy. The fuel consumption rates (gallons per mile) and speeds (miles per hour) for each truck type are given in the following Table.\n\n| Truck Type | Fuel Consumption Rate (gal/mi) | Speed (mph) |\n|------------|--------------------------------|-------------|\n| T1         | 0.1                             | 50          |\n| T2         | 0.08                            | 55          |\n| T3         | 0.06                            | 60          |\n| T4         | 0.05                            | 65          |\n| T5         | 0.04                            | 70          |\n\nThe company has a budget of $100,000 for purchasing trucks. Each truck type has a different cost: T1 = $20,000, T2 = $22,000, T3 = $24,000, T4 = $26,000, T5 = $28,000. The total number of trucks cannot exceed 50. The company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5. The company has a contract that requires at least 15 deliveries per hour.\n\nPlease help the company to minimize the total fuel consumption per delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption = 0.1 * T1 + 0.08 * T2 + 0.06 * T3 + 0.05 * T4 + 0.04 * T5\nDelivery_Time = 1 / (50 * T1) + 1 / (55 * T2) + 1 / (60 * T3) + 1 / (65 * T4) + 1 / (70 * T5)\n## convert the division to multiplication\nmodel.addCons(obj * Delivery_Time == Fuel_Consumption)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks.\nmodel.addCons(20000 * T1 + 22000 * T2 + 24000 * T3 + 26000 * T4 + 28000 * T5 <= 100000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The company must ensure that at least 10% of the fleet is the most fuel-efficient type, T5.\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n## The company has a contract that requires at least 15 deliveries per hour.\nmodel.addCons((50 * T1) + (55 * T2) + (60 * T3) + (65 * T4) + (70 * T5) >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption per Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"real\"}\n// {\"resource allocation for product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"real\"}\n// {\"resource allocation for product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of these products.\n// Profit_A = ProductA * 50\n// Profit_B = ProductB * 70\n// Profit_C = ProductC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total resource allocation for all products must not exceed 100 units. The resource usage for producing one unit of product A is 2 units, for product B is 3 units, and for product C is 2.5 units.\n// ResourceA + ResourceB + ResourceC <= 100\n\n## Generate Constraint-2:\nThe production of each product must meet the market demand. The demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 20\n\n## Generate Constraint-3:\nThe production capacity of the company limits the total production to 50 units per day.\n// ProductA + ProductB + ProductC <= 50\n\n## Generate Constraint-4:\nThe resource allocation for each product is non-linear and depends on the production quantity. The resource allocation for product A is 0.05 * (ProductA^2), for product B is 0.08 * (ProductB^2), and for product C is 0.06 * (ProductC^2).\n// ResourceA = 0.05 * (ProductA^2)\n// ResourceB = 0.08 * (ProductB^2)\n// ResourceC = 0.06 * (ProductC^2)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from the sales of these products. The total resource allocation for all products must not exceed 100 units. The resource usage for producing one unit of product A is 2 units, for product B is 3 units, and for product C is 2.5 units. The production of each product must meet the market demand. The demand for product A is at least 10 units, for product B is at least 15 units, and for product C is at least 20 units. The production capacity of the company limits the total production to 50 units per day. The resource allocation for each product is non-linear and depends on the production quantity. The resource allocation for product A is 0.05 * (ProductA^2), for product B is 0.08 * (ProductB^2), and for product C is 0.06 * (ProductC^2).\n\nPlease help the company to determine the optimal production quantities of products A, B, and C to maximize their total profit while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=15)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=20)  # production quantity of product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resource allocation for product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resource allocation for product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resource allocation for product C\n\n# Define objective function\nProfit_A = ProductA * 50\nProfit_B = ProductB * 70\nProfit_C = ProductC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The resource allocation for each product is non-linear and depends on the production quantity.\nmodel.addCons(ResourceA == 0.05 * (ProductA**2))\nmodel.addCons(ResourceB == 0.08 * (ProductB**2))\nmodel.addCons(ResourceC == 0.06 * (ProductC**2))\n# The total resource allocation for all products must not exceed 100 units.\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 100)\n# The production of each product must meet the market demand.\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 15)\nmodel.addCons(ProductC >= 20)\n# The production capacity of the company limits the total production to 50 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Resource Allocation for Product A: \", model.getVal(ResourceA))\n    print(\"Resource Allocation for Product B: \", model.getVal(ResourceB))\n    print(\"Resource Allocation for Product C: \", model.getVal(ResourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. \nOn route 1, the cost per truck is $1000 per day.\nOn route 2, the cost per truck is $1200 per day.\nOn route 3, the cost per truck is $1500 per day.\nOn route 4, the cost per truck is $1300 per day.\nOn route 5, the cost per truck is $1100 per day.\nThe company aims to minimize the total cost while ensuring all routes are covered.\n// Cost_T1 = 1000 * T1\n// Cost_T2 = 1200 * T2\n// Cost_T3 = 1500 * T3\n// Cost_T4 = 1300 * T4\n// Cost_T5 = 1100 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe company has a total fleet of 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach route must be covered by at least one truck.\n// T1 >= 1; T2 >= 1; T3 >= 1; T4 >= 1; T5 >= 1\n\n## Generate Constraint-3:\nThe total daily budget for all routes is $50,000.\n// 1000 * T1 + 1200 * T2 + 1500 * T3 + 1300 * T4 + 1100 * T5 <= 50000",
        "question": "A logistics company operates five different routes for delivering packages and needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs, as shown in the following Table.\n\n| Route | Cost per Truck per Day |\n|-------|------------------------|\n| 1     | $1000                  |\n| 2     | $1200                  |\n| 3     | $1500                  |\n| 4     | $1300                  |\n| 5     | $1100                  |\n\nThe company has a total fleet of 50 trucks. Each route must be covered by at least one truck. The total daily budget for all routes is $50,000.\n\nPlease help the company to minimize the total cost while ensuring all routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must be covered by at least one truck.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=1) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=1) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=1) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=1) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=1) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 1000 * T1\nCost_T2 = 1200 * T2\nCost_T3 = 1500 * T3\nCost_T4 = 1300 * T4\nCost_T5 = 1100 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The company has a total fleet of 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The total daily budget for all routes is $50,000.\nmodel.addCons(1000 * T1 + 1200 * T2 + 1500 * T3 + 1300 * T4 + 1100 * T5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. The company needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. Additionally, the company is considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for Truck1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck4\": \"Upgrade4\", \"range\": \"Upgrade4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for Truck5\": \"Upgrade5\", \"range\": \"Upgrade5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck improves with the investment in upgrades, reducing the operational cost per trip. The operational cost per trip decreases by $2 for every $100 invested in upgrades. The initial operational cost per trip for Truck1 is $100, for Truck2 is $120, for Truck3 is $110, for Truck4 is $90, and for Truck5 is $130. The company aims to minimize the total operational cost of all trips.\n// Operational cost for Truck1: Cost1 = (100 - 0.02 * Upgrade1) * Trips1\n// Operational cost for Truck2: Cost2 = (120 - 0.02 * Upgrade2) * Trips2\n// Operational cost for Truck3: Cost3 = (110 - 0.02 * Upgrade3) * Trips3\n// Operational cost for Truck4: Cost4 = (90 - 0.02 * Upgrade4) * Trips4\n// Operational cost for Truck5: Cost5 = (130 - 0.02 * Upgrade5) * Trips5\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 for both trip operations and upgrades.\n// (100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000\n\n## Generate Constraint-2:\nThe total number of trips across all trucks must not exceed 500 trips.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, each truck can make at most 120 trips.\n// Trips1 <= 120; Trips2 <= 120; Trips3 <= 120; Trips4 <= 120; Trips5 <= 120",
        "question": "A logistics company is planning its routes for the next quarter and needs to determine the number of trips for each of its five trucks: Truck1, Truck2, Truck3, Truck4, and Truck5. The company is also considering investing in fuel-efficient upgrades for each truck, which will affect the fuel consumption and operational costs per trip. The initial operational cost per trip and the effect of upgrades on operational costs are given in the following Table.\n\n| Truck | Initial Operational Cost per Trip | Reduction in Cost per $100 Invested |\n|-------|-----------------------------------|--------------------------------------|\n| Truck1 | $100                             | $2                                   |\n| Truck2 | $120                             | $2                                   |\n| Truck3 | $110                             | $2                                   |\n| Truck4 | $90                              | $2                                   |\n| Truck5 | $130                             | $2                                   |\n\nThe company has a budget of $20,000 for both trip operations and upgrades. The total number of trips across all trucks must not exceed 500 trips. Due to maintenance schedules, each truck can make at most 120 trips. The company aims to minimize the total operational cost of all trips.\n\nPlease help the company determine the optimal number of trips for each truck and the amount to invest in fuel-efficient upgrades for each truck to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips for Truck4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips for Truck5\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # investment in fuel-efficient upgrades for Truck1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # investment in fuel-efficient upgrades for Truck2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # investment in fuel-efficient upgrades for Truck3\nUpgrade4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade4\", lb=0)  # investment in fuel-efficient upgrades for Truck4\nUpgrade5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade5\", lb=0)  # investment in fuel-efficient upgrades for Truck5\n\n# Define objective function\nCost1 = (100 - 0.02 * Upgrade1) * Trips1\nCost2 = (120 - 0.02 * Upgrade2) * Trips2\nCost3 = (110 - 0.02 * Upgrade3) * Trips3\nCost4 = (90 - 0.02 * Upgrade4) * Trips4\nCost5 = (130 - 0.02 * Upgrade5) * Trips5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5)\n\n# Add constraints\nmodel.addCons((100 - 0.02 * Upgrade1) * Trips1 + (120 - 0.02 * Upgrade2) * Trips2 + \n              (110 - 0.02 * Upgrade3) * Trips3 + (90 - 0.02 * Upgrade4) * Trips4 + \n              (130 - 0.02 * Upgrade5) * Trips5 + Upgrade1 + Upgrade2 + Upgrade3 + Upgrade4 + Upgrade5 <= 20000)\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(Trips1 <= 120)\nmodel.addCons(Trips2 <= 120)\nmodel.addCons(Trips3 <= 120)\nmodel.addCons(Trips4 <= 120)\nmodel.addCons(Trips5 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Number of Trips for Truck4: \", model.getVal(Trips4))\n    print(\"Number of Trips for Truck5: \", model.getVal(Trips5))\n    print(\"Investment in Upgrades for Truck1: \", model.getVal(Upgrade1))\n    print(\"Investment in Upgrades for Truck2: \", model.getVal(Upgrade2))\n    print(\"Investment in Upgrades for Truck3: \", model.getVal(Upgrade3))\n    print(\"Investment in Upgrades for Truck4: \", model.getVal(Upgrade4))\n    print(\"Investment in Upgrades for Truck5: \", model.getVal(Upgrade5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1521,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The company aims to minimize the total fuel consumption while ensuring that the total capacity of goods transported is maximized. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n// Fuel consumption on route A: Fuel_A = 10 * A\n// Fuel consumption on route B: Fuel_B = 15 * B\n// Fuel consumption on route C: Fuel_C = 20 * C\n// Fuel consumption on route D: Fuel_D = 25 * D\n// Fuel consumption on route E: Fuel_E = 30 * E\n// Total capacity of goods transported: Capacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// A + B + C + D + E <= 100\n\n## Generate Constraint-2:\nEach route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks.\n// A >= 5; B >= 10; C >= 15; D >= 20; E >= 25\n\n## Generate Constraint-3:\nThe total fuel consumption must not exceed 2000 liters per day.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters. The capacity of each truck is proportional to the fuel consumption, with a coefficient of 100 units of capacity per liter of fuel.\n\n| Route | Fuel Consumption (liters/trip) |\n|-------|--------------------------------|\n| A     | 10                              |\n| B     | 15                              |\n| C     | 20                              |\n| D     | 25                              |\n| E     | 30                              |\n\nThe company has a total of 100 trucks available. Each route has a minimum required number of trucks to operate effectively: route A requires at least 5 trucks, route B requires at least 10 trucks, route C requires at least 15 trucks, route D requires at least 20 trucks, and route E requires at least 25 trucks. The total fuel consumption must not exceed 2000 liters per day.\n\nPlease help the company to minimize the total fuel consumption while maximizing the total capacity of goods transported.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=25) # number of trucks on route E\n\n# Define objective function\n## Each truck on route A consumes 10 liters of fuel per trip, route B consumes 15 liters, route C consumes 20 liters, route D consumes 25 liters, and route E consumes 30 liters.\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\n## Total capacity of goods transported: Capacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nCapacity = 100 * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) while maximizing Capacity\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(A + B + C + D + E <= 100)\n## The total fuel consumption must not exceed 2000 liters per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Total Fuel Consumption: \", model.getVal(obj))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1316,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type, which will affect the fuel consumption and operational costs.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Truck1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Truck3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel_Consumption_Truck1 = (Initial_Consumption - 0.0001 * Tech1) * Distance_Per_Trip * Trips1\n// Fuel_Consumption_Truck2 = (Initial_Consumption - 0.0002 * Tech2) * Distance_Per_Trip * Trips2\n// Fuel_Consumption_Truck3 = (Initial_Consumption - 0.0003 * Tech3) * Distance_Per_Trip * Trips3\n// So, the objective function is: Minimize (Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies.\n// Tech1 + Tech2 + Tech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 500.\n// Trips1 + Trips2 + Trips3 <= 500\n\n## Generate Constraint-3:\nDue to maintenance schedules, Truck1 can make at most 150 trips, Truck2 can make at most 200 trips, and Truck3 can make at most 250 trips.\n// Trips1 <= 150; Trips2 <= 200; Trips3 <= 250\n\n## Generate Constraint-4:\nThe company must ensure that at least 100 trips are made by Truck1 and at least 120 trips are made by Truck2 to meet contractual obligations.\n// Trips1 >= 100; Trips2 >= 120",
        "question": "A logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods. The company needs to determine the number of trips each vehicle should make and the investment in fuel-efficient technologies for each vehicle type to optimize its operations. The fuel efficiency of each vehicle improves with the investment in technology. For every $1000 invested in technology for Truck1, the fuel consumption decreases by 0.1 liters per kilometer. For Truck2, the decrease is 0.2 liters per kilometer, and for Truck3, it is 0.3 liters per kilometer. The company aims to minimize the total fuel consumption across all vehicles.\n\n| Vehicle | Fuel Efficiency Improvement per $1000 Investment |\n|---------|-------------------------------------------------|\n| Truck1  | 0.1 liters per kilometer                         |\n| Truck2  | 0.2 liters per kilometer                         |\n| Truck3  | 0.3 liters per kilometer                         |\n\nThe company has a budget of $100,000 for investments in fuel-efficient technologies. The total number of trips across all vehicles must not exceed 500. Due to maintenance schedules, Truck1 can make at most 150 trips, Truck2 can make at most 200 trips, and Truck3 can make at most 250 trips. The company must ensure that at least 100 trips are made by Truck1 and at least 120 trips are made by Truck2 to meet contractual obligations.\n\nPlease help the company to determine the optimal number of trips for each vehicle and the investment in fuel-efficient technologies to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=100) # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=120) # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips for Truck3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0) # investment in fuel-efficient technology for Truck1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0) # investment in fuel-efficient technology for Truck2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0) # investment in fuel-efficient technology for Truck3\n\n# Define objective function\nFuel_Consumption_Truck1 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0001 * Tech1) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips1\nFuel_Consumption_Truck2 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0002 * Tech2) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips2\nFuel_Consumption_Truck3 = (model.addVar(vtype=\"CONTINUOUS\", name=\"Initial_Consumption\") - 0.0003 * Tech3) * model.addVar(vtype=\"CONTINUOUS\", name=\"Distance_Per_Trip\") * Trips3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 <= 100000)\nmodel.addCons(Trips1 + Trips2 + Trips3 <= 500)\nmodel.addCons(Trips1 <= 150)\nmodel.addCons(Trips2 <= 200)\nmodel.addCons(Trips3 <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Tech for Truck1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Truck2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Truck3: \", model.getVal(Tech3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1569,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Type 1 trucks have a fuel efficiency of 5 km/liter and a capacity of 10 tons. Type 2 trucks have a fuel efficiency of 7 km/liter and a capacity of 15 tons. Type 3 trucks have a fuel efficiency of 6 km/liter and a capacity of 12 tons. Type 4 trucks have a fuel efficiency of 8 km/liter and a capacity of 20 tons. Type 5 trucks have a fuel efficiency of 4 km/liter and a capacity of 8 tons. The company aims to minimize the total fuel consumption while ensuring all goods are transported.\n// Total fuel consumption: Fuel = (5000 / (5 * T1)) + (5000 / (7 * T2)) + (5000 / (6 * T3)) + (5000 / (8 * T4)) + (5000 / (4 * T5))\n// The objective function is: Minimize Fuel\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet or exceed the required transport capacity of 100 tons.\n// 10 * T1 + 15 * T2 + 12 * T3 + 20 * T4 + 8 * T5 >= 100\n\n## Generate Constraint-2:\nThe company has a budget to purchase a maximum of 20 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 20\n\n## Generate Constraint-3:\nAt least 3 different types of trucks must be used.\n// T1 + T2 + T3 + T4 + T5 >= 3",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency while meeting specific constraints. The fuel efficiency and capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) | Capacity (tons) |\n|------------|---------------------------|-----------------|\n| Type 1     | 5                         | 10              |\n| Type 2     | 7                         | 15              |\n| Type 3     | 6                         | 12              |\n| Type 4     | 8                         | 20              |\n| Type 5     | 4                         | 8               |\n\nThe company aims to minimize the total fuel consumption while ensuring all goods are transported. The total capacity of all trucks must meet or exceed the required transport capacity of 100 tons. The company has a budget to purchase a maximum of 20 trucks in total. Additionally, at least 3 different types of trucks must be used.\n\nPlease help the company to minimize the total fuel consumption, which is calculated as follows:\nFuel = (5000 / (5 * T1)) + (5000 / (7 * T2)) + (5000 / (6 * T3)) + (5000 / (8 * T4)) + (5000 / (4 * T5))\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel consumption: Fuel = (5000 / (5 * T1)) + (5000 / (7 * T2)) + (5000 / (6 * T3)) + (5000 / (8 * T4)) + (5000 / (4 * T5))\n## convert the division to multiplication\nmodel.addCons(obj == 5000 * (1 / (5 * T1)) + 5000 * (1 / (7 * T2)) + 5000 * (1 / (6 * T3)) + 5000 * (1 / (8 * T4)) + 5000 * (1 / (4 * T5)))\n\n# Add constraints\n## The total capacity of all trucks must meet or exceed the required transport capacity of 100 tons.\nmodel.addCons(10 * T1 + 15 * T2 + 12 * T3 + 20 * T4 + 8 * T5 >= 100)\n## The company has a budget to purchase a maximum of 20 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 20)\n## At least 3 different types of trucks must be used.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1290,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductA\": \"AdvertisingA\", \"range\": \"AdvertisingA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdvertisingB\", \"range\": \"AdvertisingB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdvertisingC\", \"range\": \"AdvertisingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2. The demand for ProductB is modeled as DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2. The demand for ProductC is modeled as DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = PriceA * DemandA\n// Total revenue for ProductB: RevenueB = PriceB * DemandB\n// Total revenue for ProductC: RevenueC = PriceC * DemandC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 3000 units.\n// QuantityA + QuantityB + QuantityC <= 3000\n\n## Generate Constraint-2:\nThe total advertising budget for all products cannot exceed $50,000.\n// AdvertisingA + AdvertisingB + AdvertisingC <= 50000\n\n## Generate Constraint-3:\nThe price of each product must be at least $50.\n// PriceA >= 50; PriceB >= 50; PriceC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the price at which each product is sold, and the advertising budget for each product. The advertising budget affects the demand for each product, and the relationship between advertising and demand is nonlinear. The demand for ProductA is modeled as DemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA^2. The demand for ProductB is modeled as DemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB^2. The demand for ProductC is modeled as DemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC^2. The company aims to maximize the total revenue from all products. The total production capacity of the company is 3000 units. The total advertising budget for all products cannot exceed $50,000. The price of each product must be at least $50. Please help the company to maximize the total revenue from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=50)  # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=50)  # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=50)  # price of ProductC\nAdvertisingA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingA\", lb=0)  # advertising budget for ProductA\nAdvertisingB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingB\", lb=0)  # advertising budget for ProductB\nAdvertisingC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingC\", lb=0)  # advertising budget for ProductC\n\n# Define objective function\nDemandA = 1000 - 5 * PriceA + 0.01 * AdvertisingA**2\nDemandB = 1500 - 10 * PriceB + 0.02 * AdvertisingB**2\nDemandC = 2000 - 15 * PriceC + 0.03 * AdvertisingC**2\nRevenueA = PriceA * DemandA\nRevenueB = PriceB * DemandB\nRevenueC = PriceC * DemandC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 3000)\nmodel.addCons(AdvertisingA + AdvertisingB + AdvertisingC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdvertisingA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdvertisingB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdvertisingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// TotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units per week.\n// ProductA >= 50\n\n## Generate Constraint-4:\nThe market demand for product B is at most 70 units per week.\n// ProductB <= 70\n\n## Generate Constraint-5:\nThe company aims to produce at least twice as many units of product C as product A.\n// ProductC >= 2 * ProductA",
        "question": "A manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The following table summarizes the resource requirements for each product:\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material per Unit (kg) |\n|---------|-----------------|----------------------|---------------------------|\n| A       | $50             | 5                    | 10                        |\n| B       | $70             | 8                    | 15                        |\n| C       | $60             | 6                    | 12                        |\n\nThe total available labor hours per week are 1000, and the total available raw material per week is 1500 kg. The market demand for product A is at least 50 units per week, and for product B is at most 70 units per week. The company aims to produce at least twice as many units of product C as product A.\n\nPlease help the company to maximize the total profit from all products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # number of units of product C\n\n# Define objective function\nTotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total available labor hours per week are 1000.\nmodel.addCons(5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000)\n# The total available raw material per week is 1500 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500)\n# The market demand for product A is at least 50 units per week.\nmodel.addCons(ProductA >= 50)\n# The market demand for product B is at most 70 units per week.\nmodel.addCons(ProductB <= 70)\n# The company aims to produce at least twice as many units of product C as product A.\nmodel.addCons(ProductC >= 2 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage.\n// {\"number of Device A produced\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Device B produced\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Device C produced\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Device D produced\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Device E produced\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n// Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity for all devices is 1000 units per day.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70.\n// 30A + 40B + 50C + 60D + 70E <= 50000\n\n## Generate Constraint-3:\nThe demand for Device A must be met, which is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\n// E <= 0.3 * (A + B + C + D + E)",
        "question": "A manufacturing company produces five different types of electronic devices (Device A, Device B, Device C, Device D, and Device E). The company needs to optimize the production quantities to maximize profit while considering the cost of production and storage. The profit per unit for Device A is $50, for Device B is $70, for Device C is $80, for Device D is $90, and for Device E is $100. The cost of storage per unit per day for Device A is $2, for Device B is $3, for Device C is $4, for Device D is $5, and for Device E is $6. The company aims to maximize the net profit, which is the total profit minus the total storage cost.\n\nThe total production capacity for all devices is 1000 units per day. The company has a budget constraint of $50,000 for production costs. The production cost per unit for Device A is $30, for Device B is $40, for Device C is $50, for Device D is $60, and for Device E is $70. The demand for Device A must be met, which is at least 100 units. The company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\n\nPlease help the company to maximize the net profit, which is the total profit minus the total storage cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Device A produced\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Device B produced\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Device C produced\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Device D produced\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Device E produced\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 80C + 90D + 100E\n## Total storage cost: Storage = 2A + 3B + 4C + 5D + 6E\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 80 * C + 90 * D + 100 * E\nStorage = 2 * A + 3 * B + 4 * C + 5 * D + 6 * E\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity for all devices is 1000 units per day.\nmodel.addCons(A + B + C + D + E <= 1000)\n## The company has a budget constraint of $50,000 for production costs.\nmodel.addCons(30 * A + 40 * B + 50 * C + 60 * D + 70 * E <= 50000)\n## The demand for Device A must be met, which is at least 100 units.\nmodel.addCons(A >= 100)\n## The company wants to ensure that no more than 30% of the total production is of Device E to diversify risk.\nmodel.addCons(E <= 0.3 * (A + B + C + D + E))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the number of units to produce for each product in the next month. The production cost per unit, selling price per unit, and the storage cost per unit for each product are known.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is $50, the selling price per unit is $100, and the storage cost per unit is $5. For ProductB, these values are $60, $120, and $6 respectively. For ProductC, they are $70, $140, and $7. For ProductD, they are $80, $160, and $8. The company wants to maximize the total profit, which is the difference between the total revenue and the total cost (production and storage).\n// Total profit for ProductA: Profit_A = (100 - 50 - 5) * UnitsA\n// Total profit for ProductB: Profit_B = (120 - 60 - 6) * UnitsB\n// Total profit for ProductC: Profit_C = (140 - 70 - 7) * UnitsC\n// Total profit for ProductD: Profit_D = (160 - 80 - 8) * UnitsD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC + UnitsD <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the company must produce at least 100 units of ProductA.\n// UnitsA >= 100",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the number of units to produce for each product in the next month. The production cost per unit for ProductA is $50, the selling price per unit is $100, and the storage cost per unit is $5. For ProductB, these values are $60, $120, and $6 respectively. For ProductC, they are $70, $140, and $7. For ProductD, they are $80, $160, and $8. The company has a limited production capacity of 1000 units in total for all products. Due to market demand, the company must produce at least 100 units of ProductA. The company wants to maximize the total profit, which is the difference between the total revenue and the total cost (production and storage). Please help the company determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of ProductD\n\n# Define objective function\nProfit_A = (100 - 50 - 5) * UnitsA\nProfit_B = (120 - 60 - 6) * UnitsB\nProfit_C = (140 - 70 - 7) * UnitsC\nProfit_D = (160 - 80 - 8) * UnitsD\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of ProductD: \", model.getVal(UnitsD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road.\n// {\"number of trucks for electronics\": \"ElectronicsTrucks\", \"range\": \"ElectronicsTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for perishables\": \"PerishablesTrucks\", \"range\": \"PerishablesTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for textiles\": \"TextilesTrucks\", \"range\": \"TextilesTrucks >= 0\", \"type\": \"integer\"}\n// {\"average speed of trucks for electronics\": \"ElectronicsSpeed\", \"range\": \"ElectronicsSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for perishables\": \"PerishablesSpeed\", \"range\": \"PerishablesSpeed > 0\", \"type\": \"real\"}\n// {\"average speed of trucks for textiles\": \"TextilesSpeed\", \"range\": \"TextilesSpeed > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n// FuelConsumption_Electronics = k1 * ElectronicsSpeed^3 * ElectronicsTrucks\n// FuelConsumption_Perishables = k2 * PerishablesSpeed^3 * PerishablesTrucks\n// FuelConsumption_Textiles = k3 * TextilesSpeed^3 * TextilesTrucks\n// So, the objective function is: Minimize (FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for fuel costs.\n// k1 * ElectronicsSpeed^3 * ElectronicsTrucks + k2 * PerishablesSpeed^3 * PerishablesTrucks + k3 * TextilesSpeed^3 * TextilesTrucks <= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting three types of goods: electronics, perishables, and textiles. The company needs to determine the number of trucks dedicated to each type of good and the average speed at which each type of truck should travel to minimize fuel consumption and time spent on the road. The fuel consumption rate for each type of truck is a nonlinear function of its speed, given by the formula: FuelConsumption = k * Speed^3, where k is a constant specific to each type of truck. The company aims to minimize the total daily fuel consumption across all types of trucks.\n\n| Type of Goods | Number of Trucks | Average Speed |\n|---------------|------------------|---------------|\n| Electronics   | ElectronicsTrucks | ElectronicsSpeed |\n| Perishables   | PerishablesTrucks | PerishablesSpeed |\n| Textiles      | TextilesTrucks | TextilesSpeed |\n\nThe company has a total budget of $10,000 per day for fuel costs. Please help the company to determine the optimal number of trucks and their average speeds to minimize the total daily fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nElectronicsTrucks = model.addVar(vtype=\"INTEGER\", name=\"ElectronicsTrucks\", lb=0)\nPerishablesTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishablesTrucks\", lb=0)\nTextilesTrucks = model.addVar(vtype=\"INTEGER\", name=\"TextilesTrucks\", lb=0)\nElectronicsSpeed = model.addVar(name=\"ElectronicsSpeed\", lb=0.001)  # Ensure positive speed\nPerishablesSpeed = model.addVar(name=\"PerishablesSpeed\", lb=0.001)  # Ensure positive speed\nTextilesSpeed = model.addVar(name=\"TextilesSpeed\", lb=0.001)  # Ensure positive speed\n\n# Define objective function\n# Set constants k1, k2, k3 for fuel consumption rates\nk1 = 0.01  # Example values\nk2 = 0.02\nk3 = 0.015\n\n# Calculate fuel consumption for each type of truck\nFuelConsumption_Electronics = k1 * ElectronicsSpeed**3 * ElectronicsTrucks\nFuelConsumption_Perishables = k2 * PerishablesSpeed**3 * PerishablesTrucks\nFuelConsumption_Textiles = k3 * TextilesSpeed**3 * TextilesTrucks\n\n# Objective function: Minimize total fuel consumption\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption_Electronics + FuelConsumption_Perishables + FuelConsumption_Textiles)\n\n# Add constraints\n# Total budget constraint for fuel costs\nmodel.addCons(k1 * ElectronicsSpeed**3 * ElectronicsTrucks + k2 * PerishablesSpeed**3 * PerishablesTrucks + k3 * TextilesSpeed**3 * TextilesTrucks <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Electronics Trucks: \", model.getVal(ElectronicsTrucks))\n    print(\"Number of Perishables Trucks: \", model.getVal(PerishablesTrucks))\n    print(\"Number of Textiles Trucks: \", model.getVal(TextilesTrucks))\n    print(\"Electronics Speed: \", model.getVal(ElectronicsSpeed))\n    print(\"Perishables Speed: \", model.getVal(PerishablesSpeed))\n    print(\"Textiles Speed: \", model.getVal(TextilesSpeed))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, with a carbon emission of 10 kg per unit.\nThe profit per unit of Product B is $70, with a carbon emission of 15 kg per unit.\nThe profit per unit of Product C is $60, with a carbon emission of 12 kg per unit.\nThe profit per unit of Product D is $80, with a carbon emission of 20 kg per unit.\nThe profit per unit of Product E is $90, with a carbon emission of 25 kg per unit.\nThe company wants to maximize the Profit-Carbon ratio of the production. (The Profit-Carbon ratio is defined as the total profit divided by the total carbon emissions.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total carbon emissions: Carbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n// So, the objective function is: Maximize Profit / Carbon\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1500\n\n## Generate Constraint-2:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit of Product A is $50 with a carbon emission of 10 kg per unit, Product B is $70 with 15 kg per unit, Product C is $60 with 12 kg per unit, Product D is $80 with 20 kg per unit, and Product E is $90 with 25 kg per unit. The company wants to maximize the Profit-Carbon ratio of the production, which is defined as the total profit divided by the total carbon emissions. The company has a total production capacity of 1500 units across all products and must produce at least 200 units of Product A. Please help the company determine the optimal production amounts for each product to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=200) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCarbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n## the objective function is: Maximize Profit / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Amount of Product D produced: \", model.getVal(ProductD))\n    print(\"Amount of Product E produced: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel consumption and time. The fuel consumption rate (in gallons per hour) and average speed (in miles per hour) vary by route.\n- Route 1: Fuel rate = 5 + 0.1 * T1^2, Speed = 40 - 0.5 * T1\n- Route 2: Fuel rate = 6 + 0.15 * T2^2, Speed = 45 - 0.5 * T2\n- Route 3: Fuel rate = 7 + 0.2 * T3^2, Speed = 50 - 0.5 * T3\n- Route 4: Fuel rate = 8 + 0.25 * T4^2, Speed = 55 - 0.5 * T4\n- Route 5: Fuel rate = 9 + 0.3 * T5^2, Speed = 60 - 0.5 * T5\n- Route 6: Fuel rate = 10 + 0.35 * T6^2, Speed = 65 - 0.5 * T6\nThe objective is to minimize the total cost, which is the sum of fuel cost and time cost (assuming a constant rate of $100 per hour of operation).\n// Objective function: Minimize (5 + 0.1 * T1^2) * (distance/speed) + 100 * (distance/speed) + ... + (10 + 0.35 * T6^2) * (distance/speed) + 100 * (distance/speed)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe minimum average speed on any route must be at least 30 miles per hour.\n// 40 - 0.5 * T1 >= 30; 45 - 0.5 * T2 >= 30; 50 - 0.5 * T3 >= 30; 55 - 0.5 * T4 >= 30; 60 - 0.5 * T5 >= 30; 65 - 0.5 * T6 >= 30",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize fuel efficiency and delivery speed. The fuel consumption rate (in gallons per hour) and average speed (in miles per hour) vary by route and are affected by the number of trucks allocated, as shown in the following Table.\n\n| Route | Fuel Rate (gallons/hour) | Speed (miles/hour) |\n|-------|--------------------------|--------------------|\n| 1     | 5 + 0.1 * T1^2           | 40 - 0.5 * T1      |\n| 2     | 6 + 0.15 * T2^2          | 45 - 0.5 * T2      |\n| 3     | 7 + 0.2 * T3^2           | 50 - 0.5 * T3      |\n| 4     | 8 + 0.25 * T4^2          | 55 - 0.5 * T4      |\n| 5     | 9 + 0.3 * T5^2           | 60 - 0.5 * T5      |\n| 6     | 10 + 0.35 * T6^2         | 65 - 0.5 * T6      |\n\nThe company aims to minimize the total operational cost, which is a function of fuel consumption and time (assuming a constant rate of $100 per hour of operation). The company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks. The minimum average speed on any route must be at least 30 miles per hour.\n\nPlease help the company to minimize the total cost, which includes both fuel cost and time cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Calculate fuel consumption and speed for each route\nFuel_T1 = (5 + 0.1 * T1**2)\nSpeed_T1 = 40 - 0.5 * T1\nFuel_T2 = (6 + 0.15 * T2**2)\nSpeed_T2 = 45 - 0.5 * T2\nFuel_T3 = (7 + 0.2 * T3**2)\nSpeed_T3 = 50 - 0.5 * T3\nFuel_T4 = (8 + 0.25 * T4**2)\nSpeed_T4 = 55 - 0.5 * T4\nFuel_T5 = (9 + 0.3 * T5**2)\nSpeed_T5 = 60 - 0.5 * T5\nFuel_T6 = (10 + 0.35 * T6**2)\nSpeed_T6 = 65 - 0.5 * T6\n\n## Objective function: Minimize (Fuel_T1 * (distance/Speed_T1) + 100 * (distance/Speed_T1)) + ... + (Fuel_T6 * (distance/Speed_T6) + 100 * (distance/Speed_T6))\n## Assuming distance is constant, we can simplify the objective function to minimize the sum of fuel cost and time cost\nmodel.addCons(obj == Fuel_T1 * (1/Speed_T1) + 100 * (1/Speed_T1) + Fuel_T2 * (1/Speed_T2) + 100 * (1/Speed_T2) + Fuel_T3 * (1/Speed_T3) + 100 * (1/Speed_T3) + Fuel_T4 * (1/Speed_T4) + 100 * (1/Speed_T4) + Fuel_T5 * (1/Speed_T5) + 100 * (1/Speed_T5) + Fuel_T6 * (1/Speed_T6) + 100 * (1/Speed_T6))\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n\n## Each route can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n\n## The minimum average speed on any route must be at least 30 miles per hour.\nmodel.addCons(40 - 0.5 * T1 >= 30)\nmodel.addCons(45 - 0.5 * T2 >= 30)\nmodel.addCons(50 - 0.5 * T3 >= 30)\nmodel.addCons(55 - 0.5 * T4 >= 30)\nmodel.addCons(60 - 0.5 * T5 >= 30)\nmodel.addCons(65 - 0.5 * T6 >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Number of Trucks on Route 6: \", model.getVal(T6))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much land to allocate to each crop to optimize its profit and resource usage.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per acre is $500, and the water usage is 1000 gallons per acre.\nFor Crop B, the profit per acre is $700, and the water usage is 1500 gallons per acre.\nFor Crop C, the profit per acre is $600, and the water usage is 1200 gallons per acre.\nFor Crop D, the profit per acre is $800, and the water usage is 2000 gallons per acre.\nFor Crop E, the profit per acre is $900, and the water usage is 2500 gallons per acre.\nThe farm aims to maximize the profit per unit of water used (which is defined as the total profit divided by the total water usage).\n// Profit of A: Profit_A = 500 * A\n// Profit of B: Profit_B = 700 * B\n// Profit of C: Profit_C = 600 * C\n// Profit of D: Profit_D = 800 * D\n// Profit of E: Profit_E = 900 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E)\n\n## Generate Constraint-1:\nThe farm has 100 acres available for cultivation.\n// A + B + C + D + E <= 100",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how much land to allocate to each crop to optimize its profit and resource usage.\nFor Crop A, the profit per acre is $500, and the water usage is 1000 gallons per acre.\nFor Crop B, the profit per acre is $700, and the water usage is 1500 gallons per acre.\nFor Crop C, the profit per acre is $600, and the water usage is 1200 gallons per acre.\nFor Crop D, the profit per acre is $800, and the water usage is 2000 gallons per acre.\nFor Crop E, the profit per acre is $900, and the water usage is 2500 gallons per acre.\nThe farm aims to maximize the profit per unit of water used (which is defined as the total profit divided by the total water usage).\nThe farm has 100 acres available for cultivation.\nPlease help the farm determine the optimal allocation of land to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\nD = model.addVar(vtype=\"CONTINUOUS\", name=\"D\", lb=0) # land allocated to crop D\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0) # land allocated to crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 600 * C\nProfit_D = 800 * D\nProfit_E = 900 * E\nWaterUsage = 1000 * A + 1500 * B + 1200 * C + 2000 * D + 2500 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has 100 acres available for cultivation.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Land allocated to Crop D: \", model.getVal(D))\n    print(\"Land allocated to Crop E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. The production cost, revenue, and required machine hours vary for each product.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product A\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a production cost of $50 per unit, a revenue of $100 per unit, and requires 2 machine hours per unit.\nProduct B has a production cost of $70 per unit, a revenue of $140 per unit, and requires 3 machine hours per unit.\nProduct C has a production cost of $90 per unit, a revenue of $180 per unit, and requires 4 machine hours per unit.\nThe company wants to maximize the total daily profit.\n// Profit_A = (100 - 50) * UnitsA - 2000 * MachinesA\n// Profit_B = (140 - 70) * UnitsB - 3000 * MachinesB\n// Profit_C = (180 - 90) * UnitsC - 4000 * MachinesC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nThe total production capacity per day is limited to 100 units across all products.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-3:\nThe company has a daily operational budget of $5000 for machine maintenance.\n// 2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000\n\n## Generate Constraint-4:\nTo ensure product diversity, the company must produce at least 10 units of each product per day.\n// UnitsA >= 10; UnitsB >= 10; UnitsC >= 10\n\n## Generate Constraint-5:\nDue to market demand, the production of product B must not exceed twice the production of product A.\n// UnitsB <= 2 * UnitsA",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of machines dedicated to each product. The production cost, revenue, and required machine hours vary for each product. The details are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit | Machine Hours per Unit |\n|---------|--------------------------|------------------|-------------------------|\n| A       | $50                      | $100             | 2 hours                 |\n| B       | $70                      | $140             | 3 hours                 |\n| C       | $90                      | $180             | 4 hours                 |\n\nThe company has a total of 50 machines available. The total production capacity per day is limited to 100 units across all products. The company has a daily operational budget of $5000 for machine maintenance. To ensure product diversity, the company must produce at least 10 units of each product per day. Due to market demand, the production of product B must not exceed twice the production of product A.\n\nPlease help the company to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=10) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=10) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=10) # number of units of product C\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for product A\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for product B\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for product C\n\n# Define objective function\nProfit_A = (100 - 50) * UnitsA - 2000 * MachinesA\nProfit_B = (140 - 70) * UnitsB - 3000 * MachinesB\nProfit_C = (180 - 90) * UnitsC - 4000 * MachinesC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 50 machines available.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n# The total production capacity per day is limited to 100 units across all products.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n# The company has a daily operational budget of $5000 for machine maintenance.\nmodel.addCons(2000 * MachinesA + 3000 * MachinesB + 4000 * MachinesC <= 5000)\n# To ensure product diversity, the company must produce at least 10 units of each product per day.\nmodel.addCons(UnitsA >= 10)\nmodel.addCons(UnitsB >= 10)\nmodel.addCons(UnitsC >= 10)\n# Due to market demand, the production of product B must not exceed twice the production of product A.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Machines for Product A: \", model.getVal(MachinesA))\n    print(\"Number of Machines for Product B: \", model.getVal(MachinesB))\n    print(\"Number of Machines for Product C: \", model.getVal(MachinesC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $50, the selling price is $100, and the demand is 500 units. For DeviceB, the production cost is $70, the selling price is $120, and the demand is 400 units. For DeviceC, the production cost is $80, the selling price is $150, and the demand is 300 units. The company wants to maximize its total profit.\n// Profit_A = (100 - 50) * UnitsA - 0.01 * UnitsA^2 (due to increasing marginal costs)\n// Profit_B = (120 - 70) * UnitsB - 0.02 * UnitsB^2 (due to increasing marginal costs)\n// Profit_C = (150 - 80) * UnitsC - 0.03 * UnitsC^2 (due to increasing marginal costs)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market saturation, the production of DeviceA should not exceed 500 units.\n// UnitsA <= 500\n\n## Generate Constraint-3:\nThe company has a budget of $60,000 for production costs per month.\n// 50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce per month to optimize its profit. The production cost, selling price, and demand for each device vary. The details are given in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Demand |\n|--------|--------------------------|-------------------------|--------|\n| DeviceA | $50                     | $100                    | 500    |\n| DeviceB | $70                     | $120                    | 400    |\n| DeviceC | $80                     | $150                    | 300    |\n\nThe company wants to maximize its total profit, considering that the profit from each device also depends on a quadratic term due to increasing marginal costs. The company has a total production capacity of 1000 units per month. Due to market saturation, the production of DeviceA should not exceed 500 units. The company has a budget of $60,000 for production costs per month.\n\nPlease help the company determine the optimal number of units to produce for each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with quadratic terms\nProfit_A = (100 - 50) * UnitsA - 0.01 * UnitsA**2\nProfit_B = (120 - 70) * UnitsB - 0.02 * UnitsB**2\nProfit_C = (150 - 80) * UnitsC - 0.03 * UnitsC**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market saturation, the production of DeviceA should not exceed 500 units.\nmodel.addCons(UnitsA <= 500)\n## The company has a budget of $60,000 for production costs per month.\nmodel.addCons(50 * UnitsA + 70 * UnitsB + 80 * UnitsC <= 60000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1180,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands.\n// {\"number of trips for Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company aims to minimize the total operational cost per liter of fuel consumed.\n// Operational cost of A: Cost_A = 50 * A\n// Operational cost of B: Cost_B = 70 * B\n// Operational cost of C: Cost_C = 90 * C\n// Operational cost of D: Cost_D = 110 * D\n// Operational cost of E: Cost_E = 130 * E\n// Fuel consumption of A: Fuel_A = 10 * A\n// Fuel consumption of B: Fuel_B = 15 * B\n// Fuel consumption of C: Fuel_C = 20 * C\n// Fuel consumption of D: Fuel_D = 25 * D\n// Fuel consumption of E: Fuel_E = 30 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for operational costs this month.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-2:\nThe company must meet a minimum delivery demand of 500 trips this month.\n// A + B + C + D + E >= 500\n\n## Generate Constraint-3:\nThe total fuel consumption must not exceed 15,000 liters this month.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000",
        "question": "A logistics company manages a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each type of truck to minimize fuel consumption and operational costs while meeting delivery demands. Each truck type has a different fuel efficiency and operational cost per trip. Truck A consumes 10 liters of fuel per trip and costs $50 per trip. Truck B consumes 15 liters of fuel per trip and costs $70 per trip. Truck C consumes 20 liters of fuel per trip and costs $90 per trip. Truck D consumes 25 liters of fuel per trip and costs $110 per trip. Truck E consumes 30 liters of fuel per trip and costs $130 per trip. The company has a budget of $10,000 for operational costs this month. The company must meet a minimum delivery demand of 500 trips this month. The total fuel consumption must not exceed 15,000 liters this month. Please help the company to minimize the total operational cost per liter of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trips for Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trips for Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trips for Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trips for Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trips for Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 50 * A\nCost_B = 70 * B\nCost_C = 90 * C\nCost_D = 110 * D\nCost_E = 130 * E\nFuel_A = 10 * A\nFuel_B = 15 * B\nFuel_C = 20 * C\nFuel_D = 25 * D\nFuel_E = 30 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $10,000 for operational costs this month.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n## The company must meet a minimum delivery demand of 500 trips this month.\nmodel.addCons(A + B + C + D + E >= 500)\n## The total fuel consumption must not exceed 15,000 liters this month.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Minimized Operational Cost per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n// {\"technicians assigned to machine 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components.\n// Production rate of machine 1: P1 = 100 * (1 + 0.05 * T1) * M1\n// Production rate of machine 2: P2 = 120 * (1 + 0.04 * T2) * M2\n// Production rate of machine 3: P3 = 140 * (1 + 0.03 * T3) * M3\n// Production rate of machine 4: P4 = 160 * (1 + 0.02 * T4) * M4\n// Production rate of machine 5: P5 = 180 * (1 + 0.01 * T5) * M5\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThere are a total of 30 technicians available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 10 hours per day.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10\n\n## Generate Constraint-3:\nThe number of technicians assigned to each machine must not exceed 10.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10\n\n## Generate Constraint-4:\nThe total hours of operation for all machines must not exceed 40 hours.\n// M1 + M2 + M3 + M4 + M5 <= 40",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine. Each machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components. There are a total of 30 technicians available. Each machine can operate for a maximum of 10 hours per day. The number of technicians assigned to each machine must not exceed 10. The total hours of operation for all machines must not exceed 40 hours.\n\nPlease help the plant manager to determine the optimal number of hours each machine should operate and the number of technicians assigned to each machine to maximize the total production of all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # technicians assigned to machine 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # technicians assigned to machine 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # technicians assigned to machine 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # technicians assigned to machine 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # technicians assigned to machine 5\n\n# Define objective function\nP1 = 100 * (1 + 0.05 * T1) * M1\nP2 = 120 * (1 + 0.04 * T2) * M2\nP3 = 140 * (1 + 0.03 * T3) * M3\nP4 = 160 * (1 + 0.02 * T4) * M4\nP5 = 180 * (1 + 0.01 * T5) * M5\n# The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# There are a total of 30 technicians available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n# Each machine can operate for a maximum of 10 hours per day.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n# The number of technicians assigned to each machine must not exceed 10.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n# The total hours of operation for all machines must not exceed 40 hours.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Technicians Assigned to Machine 1: \", model.getVal(T1))\n    print(\"Technicians Assigned to Machine 2: \", model.getVal(T2))\n    print(\"Technicians Assigned to Machine 3: \", model.getVal(T3))\n    print(\"Technicians Assigned to Machine 4: \", model.getVal(T4))\n    print(\"Technicians Assigned to Machine 5: \", model.getVal(T5))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is 20$, the transportation cost is 8$, and the storage cost is 3$ per unit.\nFor Product B, the selling price is 30$, the transportation cost is 12$, and the storage cost is 5$ per unit.\nFor Product C, the selling price is 40$, the transportation cost is 16$, and the storage cost is 7$ per unit.\nFor Product D, the selling price is 50$, the transportation cost is 20$, and the storage cost is 9$ per unit.\nThe company aims to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage).\n// Profit of A: Profit_A = (20 - 8 - 3) * A\n// Profit of B: Profit_B = (30 - 12 - 5) * B\n// Profit of C: Profit_C = (40 - 16 - 7) * C\n// Profit of D: Profit_D = (50 - 20 - 9) * D\n// Total cost: Cost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n\n## Generate Constraint-1:\nThe company has a budget of $2000 for transportation costs.\n// 8 * A + 12 * B + 16 * C + 20 * D <= 2000\n\n## Generate Constraint-2:\nThe company has a storage capacity of 200 units.\n// A + B + C + D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to distribute at least 15 units of each product.\n// A >= 15; B >= 15; C >= 15; D >= 15",
        "question": "A logistics company manages the distribution of four types of products: A, B, C, and D. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering various operational constraints.\nFor Product A, the selling price is $20, the transportation cost is $8, and the storage cost is $3 per unit.\nFor Product B, the selling price is $30, the transportation cost is $12, and the storage cost is $5 per unit.\nFor Product C, the selling price is $40, the transportation cost is $16, and the storage cost is $7 per unit.\nFor Product D, the selling price is $50, the transportation cost is $20, and the storage cost is $9 per unit.\nThe company has a budget of $2000 for transportation costs. The company has a storage capacity of 200 units. The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C. The company wants to distribute at least 15 units of each product.\nPlease help the company to maximize the net profit rate, which is defined as the total profit divided by the total cost (transportation and storage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to distribute at least 15 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=15) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=15) # number of units of product D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 8 - 3) * A\nProfit_B = (30 - 12 - 5) * B\nProfit_C = (40 - 16 - 7) * C\nProfit_D = (50 - 20 - 9) * D\nCost = (8 + 3) * A + (12 + 5) * B + (16 + 7) * C + (20 + 9) * D\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D) / Cost\n## convert the division to multiplication\nmodel.addCons(obj * Cost == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a budget of $2000 for transportation costs.\nmodel.addCons(8 * A + 12 * B + 16 * C + 20 * D <= 2000)\n## The company has a storage capacity of 200 units.\nmodel.addCons(A + B + C + D <= 200)\n## The company wants to ensure that the distribution of Product D does not exceed the combined distribution of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3).\n// {\"number of S1 solar panels\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of S2 solar panels\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of S3 solar panels\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of S4 solar panels\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of S5 solar panels\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of W1 wind turbines\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of W2 wind turbines\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of W3 wind turbines\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total cost of installation while maximizing the energy output. The cost per unit for S1, S2, S3, S4, S5 solar panels are $1000, $1200, $1500, $1800, $2000 respectively. The cost per unit for W1, W2, W3 wind turbines are $2500, $3000, $3500 respectively. The energy output per unit for S1, S2, S3, S4, S5 solar panels are 1.5 kW, 2 kW, 2.5 kW, 3 kW, 3.5 kW respectively. The energy output per unit for W1, W2, W3 wind turbines are 5 kW, 6 kW, 7 kW respectively.\n// Total cost: Cost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\n// Total energy output: Energy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation.\n// 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3 <= 150000\n\n## Generate Constraint-2:\nThe total energy output must be at least 100 kW.\n// 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3 >= 100\n\n## Generate Constraint-3:\nThe company wants to install at least 20 solar panels in total.\n// S1 + S2 + S3 + S4 + S5 >= 20\n\n## Generate Constraint-4:\nThe company wants to ensure diversity in energy sources, so no more than 50% of the total cost can be spent on solar panels.\n// 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 <= 0.5 * (1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3). The company wants to minimize the total cost of installation while maximizing the energy output. The cost per unit for S1, S2, S3, S4, S5 solar panels are $1000, $1200, $1500, $1800, $2000 respectively. The cost per unit for W1, W2, W3 wind turbines are $2500, $3000, $3500 respectively. The energy output per unit for S1, S2, S3, S4, S5 solar panels are 1.5 kW, 2 kW, 2.5 kW, 3 kW, 3.5 kW respectively. The energy output per unit for W1, W2, W3 wind turbines are 5 kW, 6 kW, 7 kW respectively.\n\nThe company has a budget of $150,000 for the installation. The total energy output must be at least 100 kW. The company wants to install at least 20 solar panels in total. The company wants to ensure diversity in energy sources, so no more than 50% of the total cost can be spent on solar panels.\n\nPlease help the company to minimize the total cost of installation while maximizing the energy output, defined as the total cost divided by the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of S1 solar panels\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of S2 solar panels\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of S3 solar panels\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of S4 solar panels\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of S5 solar panels\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of W1 wind turbines\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of W2 wind turbines\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of W3 wind turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\nEnergy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for the installation.\nmodel.addCons(Cost <= 150000)\n## The total energy output must be at least 100 kW.\nmodel.addCons(Energy >= 100)\n## The company wants to install at least 20 solar panels in total.\nmodel.addCons(S1 + S2 + S3 + S4 + S5 >= 20)\n## The company wants to ensure diversity in energy sources, so no more than 50% of the total cost can be spent on solar panels.\nmodel.addCons(1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 <= 0.5 * Cost)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of S1 Solar Panels: \", model.getVal(S1))\n    print(\"Number of S2 Solar Panels: \", model.getVal(S2))\n    print(\"Number of S3 Solar Panels: \", model.getVal(S3))\n    print(\"Number of S4 Solar Panels: \", model.getVal(S4))\n    print(\"Number of S5 Solar Panels: \", model.getVal(S5))\n    print(\"Number of W1 Wind Turbines: \", model.getVal(W1))\n    print(\"Number of W2 Wind Turbines: \", model.getVal(W2))\n    print(\"Number of W3 Wind Turbines: \", model.getVal(W3))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine the production quantity for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the profit per unit is $50, the production cost per unit is $20, and the storage cost per unit is $10.\nFor product B, the profit per unit is $70, the production cost per unit is $30, and the storage cost per unit is $15.\nFor product C, the profit per unit is $90, the production cost per unit is $40, and the storage cost per unit is $20.\nFor product D, the profit per unit is $60, the production cost per unit is $25, and the storage cost per unit is $12.\nFor product E, the profit per unit is $80, the production cost per unit is $35, and the storage cost per unit is $18.\nThe company aims to maximize the total profit per unit of storage space used.\n// Profit of A: Profit_A = (50 - 20 - 10) * A\n// Profit of B: Profit_B = (70 - 30 - 15) * B\n// Profit of C: Profit_C = (90 - 40 - 20) * C\n// Profit of D: Profit_D = (60 - 25 - 12) * D\n// Profit of E: Profit_E = (80 - 35 - 18) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (10 * A + 15 * B + 20 * C + 12 * D + 18 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production costs.\n// 20 * A + 30 * B + 40 * C + 25 * D + 35 * E <= 15,000",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine the production quantity for each product to optimize its operations.\nFor product A, the profit per unit is $50, the production cost per unit is $20, and the storage cost per unit is $10.\nFor product B, the profit per unit is $70, the production cost per unit is $30, and the storage cost per unit is $15.\nFor product C, the profit per unit is $90, the production cost per unit is $40, and the storage cost per unit is $20.\nFor product D, the profit per unit is $60, the production cost per unit is $25, and the storage cost per unit is $12.\nFor product E, the profit per unit is $80, the production cost per unit is $35, and the storage cost per unit is $18.\nThe company has a budget of $15,000 for production costs.\nPlease help the company to maximize the total profit per unit of storage space used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20 - 10) * A\nProfit_B = (70 - 30 - 15) * B\nProfit_C = (90 - 40 - 20) * C\nProfit_D = (60 - 25 - 12) * D\nProfit_E = (80 - 35 - 18) * E\nStorageCost = 10 * A + 15 * B + 20 * C + 12 * D + 18 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 25 * D + 35 * E <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity and operating cost.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for V1 is $100, capacity is 10 packages, and the fuel efficiency is 10 miles per gallon.\nFor V2, the cost per trip is $150, capacity is 15 packages, and the fuel efficiency is 15 miles per gallon.\nFor V3, the cost per trip is $200, capacity is 20 packages, and the fuel efficiency is 20 miles per gallon.\nFor V4, the cost per trip is $250, capacity is 25 packages, and the fuel efficiency is 25 miles per gallon.\nFor V5, the cost per trip is $300, capacity is 30 packages, and the fuel efficiency is 30 miles per gallon.\nThe company wants to minimize the total cost per package delivered (cost per trip divided by capacity).\n// Total_Cost_V1 = 100 * V1 / 10\n// Total_Cost_V2 = 150 * V2 / 15\n// Total_Cost_V3 = 200 * V3 / 20\n// Total_Cost_V4 = 250 * V4 / 25\n// Total_Cost_V5 = 300 * V5 / 30\n// So, the objective function is: Minimize (Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n## Generate Constraint-1:\nThe total number of packages to be delivered is 1000.\n// 10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $20,000 for vehicle operations.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 20000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 50 vehicles in total.\n// V1 + V2 + V3 + V4 + V5 <= 50\n\n## Generate Constraint-4:\nThe fuel efficiency constraint requires that the average fuel efficiency of all vehicles used should be at least 18 miles per gallon.\n// (10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5) / (V1 + V2 + V3 + V4 + V5) >= 18\n\n## Generate Constraint-5:\nThe company must use at least 5 V1 vehicles due to specific contractual obligations.\n// V1 >= 5",
        "question": "A logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity, operating cost, and fuel efficiency. The details for each vehicle are given in the following Table.\n\n| Vehicle | Cost per Trip | Capacity | Fuel Efficiency |\n|---------|---------------|----------|-----------------|\n| V1      | $100          | 10       | 10 miles/gallon |\n| V2      | $150          | 15       | 15 miles/gallon |\n| V3      | $200          | 20       | 20 miles/gallon |\n| V4      | $250          | 25       | 25 miles/gallon |\n| V5      | $300          | 30       | 30 miles/gallon |\n\nThe company wants to minimize the total cost per package delivered (cost per trip divided by capacity). The total number of packages to be delivered is 1000. The company has a budget of $20,000 for vehicle operations. The company can only operate a maximum of 50 vehicles in total. The fuel efficiency constraint requires that the average fuel efficiency of all vehicles used should be at least 18 miles per gallon. The company must use at least 5 V1 vehicles due to specific contractual obligations.\n\nPlease help the company determine the optimal number of each type of vehicle to use to minimize the total cost per package delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=5)  # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0)  # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0)  # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0)  # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0)  # number of V5 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_V1 = 100 * V1 / 10\nTotal_Cost_V2 = 150 * V2 / 15\nTotal_Cost_V3 = 200 * V3 / 20\nTotal_Cost_V4 = 250 * V4 / 25\nTotal_Cost_V5 = 300 * V5 / 30\n## the objective function is: Minimize (Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n# Add constraints\n## The total number of packages to be delivered is 1000.\nmodel.addCons(10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000)\n## The company has a budget of $20,000 for vehicle operations.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 20000)\n## The company can only operate a maximum of 50 vehicles in total.\nmodel.addCons(V1 + V2 + V3 + V4 + V5 <= 50)\n## The fuel efficiency constraint requires that the average fuel efficiency of all vehicles used should be at least 18 miles per gallon.\n## convert the division to multiplication\nmodel.addCons((10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5) * 18 >= (V1 + V2 + V3 + V4 + V5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 vehicles: \", model.getVal(V1))\n    print(\"Number of V2 vehicles: \", model.getVal(V2))\n    print(\"Number of V3 vehicles: \", model.getVal(V3))\n    print(\"Number of V4 vehicles: \", model.getVal(V4))\n    print(\"Number of V5 vehicles: \", model.getVal(V5))\n    print(\"Minimized Cost per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency.\n// {\"amount of raw material in reactor 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material in reactor 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of each reactor varies with the amount of raw material fed into it. The efficiency is defined as the ratio of the chemical produced to the raw material used. The efficiency functions are nonlinear and are given by:\n- Reactor 1: Efficiency = 0.5 * R1^0.7\n- Reactor 2: Efficiency = 0.6 * R2^0.6\n- Reactor 3: Efficiency = 0.7 * R3^0.5\n- Reactor 4: Efficiency = 0.8 * R4^0.4\n- Reactor 5: Efficiency = 0.9 * R5^0.3\nThe company wants to maximize the total efficiency of all reactors.\n// The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited to 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nEach reactor has a maximum capacity for raw material:\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200\n\n## Generate Constraint-3:\nThe company has a policy to use at least 10% of the total available raw material in each reactor.\n// R1 >= 0.1 * (R1 + R2 + R3 + R4 + R5); R2 >= 0.1 * (R1 + R2 + R3 + R4 + R5); R3 >= 0.1 * (R1 + R2 + R3 + R4 + R5); R4 >= 0.1 * (R1 + R2 + R3 + R4 + R5); R5 >= 0.1 * (R1 + R2 + R3 + R4 + R5)",
        "question": "A chemical company has 5 different reactors for producing a certain chemical. The company needs to determine the amount of raw material to feed into each reactor to optimize production efficiency. The efficiency of each reactor varies with the amount of raw material fed into it and is defined as the ratio of the chemical produced to the raw material used. The efficiency functions for each reactor are given in the following Table.\n\n| Reactor | Efficiency Function |\n|---------|---------------------|\n| 1       | 0.5 * R1^0.7       |\n| 2       | 0.6 * R2^0.6       |\n| 3       | 0.7 * R3^0.5       |\n| 4       | 0.8 * R4^0.4       |\n| 5       | 0.9 * R5^0.3       |\n\nThe company wants to maximize the total efficiency of all reactors. The total amount of raw material available is limited to 1000 units. Each reactor has a maximum capacity for raw material of 200 units. The company has a policy to use at least 10% of the total available raw material in each reactor.\n\nPlease help the company determine the optimal amount of raw material to feed into each reactor to maximize the total efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material in reactor 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material in reactor 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material in reactor 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # amount of raw material in reactor 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # amount of raw material in reactor 5\n\n# Define objective function\n## The efficiency functions are nonlinear and are given by:\nEfficiency_R1 = 0.5 * R1**0.7\nEfficiency_R2 = 0.6 * R2**0.6\nEfficiency_R3 = 0.7 * R3**0.5\nEfficiency_R4 = 0.8 * R4**0.4\nEfficiency_R5 = 0.9 * R5**0.3\n## The objective function is: Maximize (0.5 * R1^0.7 + 0.6 * R2^0.6 + 0.7 * R3^0.5 + 0.8 * R4^0.4 + 0.9 * R5^0.3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Efficiency_R1 + Efficiency_R2 + Efficiency_R3 + Efficiency_R4 + Efficiency_R5)\n\n# Add constraints\n## The total amount of raw material available is limited to 1000 units.\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000)\n## Each reactor has a maximum capacity for raw material:\nmodel.addCons(R1 <= 200)\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\n## The company has a policy to use at least 10% of the total available raw material in each reactor.\nmodel.addCons(R1 >= 0.1 * (R1 + R2 + R3 + R4 + R5))\nmodel.addCons(R2 >= 0.1 * (R1 + R2 + R3 + R4 + R5))\nmodel.addCons(R3 >= 0.1 * (R1 + R2 + R3 + R4 + R5))\nmodel.addCons(R4 >= 0.1 * (R1 + R2 + R3 + R4 + R5))\nmodel.addCons(R5 >= 0.1 * (R1 + R2 + R3 + R4 + R5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material in Reactor 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material in Reactor 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material in Reactor 3: \", model.getVal(R3))\n    print(\"Amount of Raw Material in Reactor 4: \", model.getVal(R4))\n    print(\"Amount of Raw Material in Reactor 5: \", model.getVal(R5))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region.\n// {\"number of trucks allocated to region 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks allocated to region 6\": \"Truck6\", \"range\": \"Truck6 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 1\": \"Driver1\", \"range\": \"Driver1 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 2\": \"Driver2\", \"range\": \"Driver2 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 3\": \"Driver3\", \"range\": \"Driver3 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 4\": \"Driver4\", \"range\": \"Driver4 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 5\": \"Driver5\", \"range\": \"Driver5 >= 0\", \"type\": \"integer\"}\n// {\"number of additional drivers hired for region 6\": \"Driver6\", \"range\": \"Driver6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver.\n// Total profit for region 1: Profit1 = (50,000 - 20,000 * Driver1) * Truck1\n// Total profit for region 2: Profit2 = (60,000 - 20,000 * Driver2) * Truck2\n// Total profit for region 3: Profit3 = (70,000 - 20,000 * Driver3) * Truck3\n// Total profit for region 4: Profit4 = (80,000 - 20,000 * Driver4) * Truck4\n// Total profit for region 5: Profit5 = (90,000 - 20,000 * Driver5) * Truck5\n// Total profit for region 6: Profit6 = (100,000 - 20,000 * Driver6) * Truck6\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the number of trucks in region 1 must not exceed 10.\n// Truck1 <= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across 6 different regions. The company must decide how many trucks to allocate to each region and how many additional drivers to hire for each region. The company aims to maximize its profit, which is affected by the number of trucks allocated and the number of additional drivers hired. The profit per truck varies by region due to different operational costs and revenue potentials. The profit per truck in region 1 is $50,000, in region 2 is $60,000, in region 3 is $70,000, in region 4 is $80,000, in region 5 is $90,000, and in region 6 is $100,000. Hiring additional drivers increases operational flexibility but also incurs a cost of $20,000 per driver. The company has a total of 50 trucks available for allocation. Due to regional regulations, the number of trucks in region 1 must not exceed 10.\n\nPlease help the company to maximize its total profit across all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks allocated to region 1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks allocated to region 2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks allocated to region 3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks allocated to region 4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks allocated to region 5\nTruck6 = model.addVar(vtype=\"INTEGER\", name=\"Truck6\", lb=0) # number of trucks allocated to region 6\nDriver1 = model.addVar(vtype=\"INTEGER\", name=\"Driver1\", lb=0) # number of additional drivers hired for region 1\nDriver2 = model.addVar(vtype=\"INTEGER\", name=\"Driver2\", lb=0) # number of additional drivers hired for region 2\nDriver3 = model.addVar(vtype=\"INTEGER\", name=\"Driver3\", lb=0) # number of additional drivers hired for region 3\nDriver4 = model.addVar(vtype=\"INTEGER\", name=\"Driver4\", lb=0) # number of additional drivers hired for region 4\nDriver5 = model.addVar(vtype=\"INTEGER\", name=\"Driver5\", lb=0) # number of additional drivers hired for region 5\nDriver6 = model.addVar(vtype=\"INTEGER\", name=\"Driver6\", lb=0) # number of additional drivers hired for region 6\n\n# Define objective function\nProfit1 = (50000 - 20000 * Driver1) * Truck1\nProfit2 = (60000 - 20000 * Driver2) * Truck2\nProfit3 = (70000 - 20000 * Driver3) * Truck3\nProfit4 = (80000 - 20000 * Driver4) * Truck4\nProfit5 = (90000 - 20000 * Driver5) * Truck5\nProfit6 = (100000 - 20000 * Driver6) * Truck6\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + Profit4 + Profit5 + Profit6)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 + Truck6 <= 50)\n# Due to regional regulations, the number of trucks in region 1 must not exceed 10.\nmodel.addCons(Truck1 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region 4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region 5: \", model.getVal(Truck5))\n    print(\"Number of Trucks in Region 6: \", model.getVal(Truck6))\n    print(\"Number of Drivers in Region 1: \", model.getVal(Driver1))\n    print(\"Number of Drivers in Region 2: \", model.getVal(Driver2))\n    print(\"Number of Drivers in Region 3: \", model.getVal(Driver3))\n    print(\"Number of Drivers in Region 4: \", model.getVal(Driver4))\n    print(\"Number of Drivers in Region 5: \", model.getVal(Driver5))\n    print(\"Number of Drivers in Region 6: \", model.getVal(Driver6))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit.\n// {\"labor on production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each production line depends on the labor and machinery allocated. The profit function is nonlinear and is given by:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\nThe company aims to maximize the total profit from all production lines.\n// Objective function: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total labor available is 100 units.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe total machinery available is 80 units.\n// M1 + M2 + M3 <= 80\n\n## Generate Constraint-3:\nEach production line can utilize a maximum of 40 units of labor.\n// L1 <= 40; L2 <= 40; L3 <= 40\n\n## Generate Constraint-4:\nEach production line can utilize a maximum of 30 units of machinery.\n// M1 <= 30; M2 <= 30; M3 <= 30",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit. The profit from each production line depends on the labor and machinery allocated, with the profit function being nonlinear and given by:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\n\nThe company aims to maximize the total profit from all production lines. The constraints are as follows:\n- The total labor available is 100 units.\n- The total machinery available is 80 units.\n- Each production line can utilize a maximum of 40 units of labor.\n- Each production line can utilize a maximum of 30 units of machinery.\n\nPlease help the company determine the optimal allocation of labor (L1, L2, L3) and machinery (M1, M2, M3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=40)  # labor on production line 1\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=0, ub=40)  # labor on production line 2\nL3 = model.addVar(vtype=\"INTEGER\", name=\"L3\", lb=0, ub=40)  # labor on production line 3\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=30)  # machinery on production line 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0, ub=30)  # machinery on production line 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0, ub=30)  # machinery on production line 3\n\n# Define objective function\n# The profit function is nonlinear, so we need to approximate it using additional variables and constraints\nP1 = model.addVar(name=\"P1\")  # profit from production line 1\nP2 = model.addVar(name=\"P2\")  # profit from production line 2\nP3 = model.addVar(name=\"P3\")  # profit from production line 3\nobj = model.addVar(name=\"obj\")  # overall objective variable\nmodel.setObjective(obj, \"maximize\")\n\n# Constraints to link the profit variables with the labor and machinery variables\nmodel.addCons(P1 == 100 * L1**0.5 * M1**0.5)\nmodel.addCons(P2 == 150 * L2**0.6 * M2**0.4)\nmodel.addCons(P3 == 200 * L3**0.7 * M3**0.3)\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(L1 + L2 + L3 <= 100)  # total labor constraint\nmodel.addCons(M1 + M2 + M3 <= 80)  # total machinery constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor on Production Line 1: \", model.getVal(L1))\n    print(\"Labor on Production Line 2: \", model.getVal(L2))\n    print(\"Labor on Production Line 3: \", model.getVal(L3))\n    print(\"Machinery on Production Line 1: \", model.getVal(M1))\n    print(\"Machinery on Production Line 2: \", model.getVal(M2))\n    print(\"Machinery on Production Line 3: \", model.getVal(M3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 938,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Van C\": \"VanC\", \"range\": \"VanC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle E\": \"MotorcycleE\", \"range\": \"MotorcycleE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating Truck A is $100 per day, and it can carry 1000 kg. Truck B costs $150 per day, and it can carry 1500 kg. Van C costs $75 per day, and it can carry 500 kg. Van D costs $50 per day, and it can carry 300 kg. Motorcycle E costs $20 per day, and it can carry 100 kg. The company wants to minimize the total operating cost while ensuring all deliveries are made. The objective is to minimize the total daily cost of operating all vehicles.\n// TotalCost = 100 * TruckA + 150 * TruckB + 75 * VanC + 50 * VanD + 20 * MotorcycleE\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total weight of all deliveries for the next quarter is 100,000 kg.\n// 1000 * TruckA + 1500 * TruckB + 500 * VanC + 300 * VanD + 100 * MotorcycleE >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 per day for operating the fleet.\n// 100 * TruckA + 150 * TruckB + 75 * VanC + 50 * VanD + 20 * MotorcycleE <= 5000\n\n## Generate Constraint-3:\nThe company has a limit on the number of vehicles it can operate. They can operate a maximum of 20 Truck A, 15 Truck B, 30 Van C, 40 Van D, and 50 Motorcycle E.\n// TruckA <= 20; TruckB <= 15; VanC <= 30; VanD <= 40; MotorcycleE <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced fleet, with no more than 40% of the total vehicles being of any one type.\n// TruckA <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE)\n// TruckB <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE)\n// VanC <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE)\n// VanD <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE)\n// MotorcycleE <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE)",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Van C, Van D, and Motorcycle E) to optimize their delivery routes. The cost of operating Truck A is $100 per day, and it can carry 1000 kg. Truck B costs $150 per day, and it can carry 1500 kg. Van C costs $75 per day, and it can carry 500 kg. Van D costs $50 per day, and it can carry 300 kg. Motorcycle E costs $20 per day, and it can carry 100 kg. The company wants to minimize the total operating cost while ensuring all deliveries are made. The total weight of all deliveries for the next quarter is 100,000 kg. The company has a budget of $5000 per day for operating the fleet. They can operate a maximum of 20 Truck A, 15 Truck B, 30 Van C, 40 Van D, and 50 Motorcycle E. The company wants to ensure a balanced fleet, with no more than 40% of the total vehicles being of any one type. Please help the company to minimize the total daily cost of operating all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)\nVanC = model.addVar(vtype=\"INTEGER\", name=\"VanC\", lb=0)\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0)\nMotorcycleE = model.addVar(vtype=\"INTEGER\", name=\"MotorcycleE\", lb=0)\n\n# Define objective function\nTotalCost = 100 * TruckA + 150 * TruckB + 75 * VanC + 50 * VanD + 20 * MotorcycleE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# The total weight of all deliveries for the next quarter is 100,000 kg.\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 500 * VanC + 300 * VanD + 100 * MotorcycleE >= 100000)\n# The company has a budget of $5000 per day for operating the fleet.\nmodel.addCons(100 * TruckA + 150 * TruckB + 75 * VanC + 50 * VanD + 20 * MotorcycleE <= 5000)\n# The company has a limit on the number of vehicles it can operate.\nmodel.addCons(TruckA <= 20)\nmodel.addCons(TruckB <= 15)\nmodel.addCons(VanC <= 30)\nmodel.addCons(VanD <= 40)\nmodel.addCons(MotorcycleE <= 50)\n# The company wants to ensure a balanced fleet, with no more than 40% of the total vehicles being of any one type.\nmodel.addCons(TruckA <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE))\nmodel.addCons(TruckB <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE))\nmodel.addCons(VanC <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE))\nmodel.addCons(VanD <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE))\nmodel.addCons(MotorcycleE <= 0.4 * (TruckA + TruckB + VanC + VanD + MotorcycleE))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Van C: \", model.getVal(VanC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Motorcycle E: \", model.getVal(MotorcycleE))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The efficiency gain from the machinery is nonlinear and varies with the investment amount.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling each unit of ProductA is $100, ProductB is $150, and ProductC is $200. The cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery. The initial production cost per unit for ProductA is $50, for ProductB is $75, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\n// Total profit for ProductB: ProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available for all production lines.\n// WorkersA + WorkersB + WorkersC <= 100\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB.\n// UnitsA >= 500; UnitsB >= 300\n\n## Generate Constraint-4:\nThe number of workers allocated to each product line must not exceed the number of units produced by 10 times.\n// WorkersA <= 10 * UnitsA; WorkersB <= 10 * UnitsB; WorkersC <= 10 * UnitsC",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the number of workers to allocate to each production line, and the amount of capital to invest in advanced machinery that enhances production efficiency. The efficiency gain from the machinery is nonlinear and varies with the investment amount. The revenue and initial production costs for each product are given in the following Table.\n\n| Product | Revenue per Unit | Initial Production Cost per Unit |\n|---------|------------------|----------------------------------|\n| ProductA | $100             | $50                              |\n| ProductB | $150             | $75                              |\n| ProductC | $200             | $100                             |\n\nThe company has a total of 100 workers available for all production lines. The total investment in advanced machinery cannot exceed $50,000. Due to market demand, the company must produce at least 500 units of ProductA and 300 units of ProductB. The number of workers allocated to each product line must not exceed the number of units produced by 10 times.\n\nPlease help the company to maximize the total profit from all products, considering that the cost of production per unit decreases by $1 for every $10,000 invested in advanced machinery.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=500)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=300)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)     # number of units of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0) # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0) # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0) # number of workers for ProductC\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfitA = (100 - 50 + 0.0001 * MachineryInvestment) * UnitsA\nProfitB = (150 - 75 + 0.0001 * MachineryInvestment) * UnitsB\nProfitC = (200 - 100 + 0.0001 * MachineryInvestment) * UnitsC\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 100 workers available for all production lines.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n## The total investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(MachineryInvestment <= 50000)\n## The number of workers allocated to each product line must not exceed the number of units produced by 10 times.\nmodel.addCons(WorkersA <= 10 * UnitsA)\nmodel.addCons(WorkersB <= 10 * UnitsB)\nmodel.addCons(WorkersC <= 10 * UnitsC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Investment in Advanced Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1385,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"fuel usage per truck in Region1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region4\": \"Fuel4\", \"range\": \"Fuel4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel usage per truck in Region5\": \"Fuel5\", \"range\": \"Fuel5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of fuel per liter varies by region, and the efficiency of trucks also differs. The cost of fuel in Region1 is $1.20/liter, in Region2 is $1.30/liter, in Region3 is $1.40/liter, in Region4 is $1.50/liter, and in Region5 is $1.60/liter. The efficiency of trucks in each region is inversely proportional to the fuel cost. The company aims to minimize the total cost of fuel and truck deployment.\n// Total fuel cost in Region1: Cost1 = 1.20 * Trucks1 * Fuel1\n// Total fuel cost in Region2: Cost2 = 1.30 * Trucks2 * Fuel2\n// Total fuel cost in Region3: Cost3 = 1.40 * Trucks3 * Fuel3\n// Total fuel cost in Region4: Cost4 = 1.50 * Trucks4 * Fuel4\n// Total fuel cost in Region5: Cost5 = 1.60 * Trucks5 * Fuel5\n// Total cost of truck deployment: DeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for fuel and truck deployment.\n// 1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000\n\n## Generate Constraint-2:\nThe total number of trucks available for deployment is 50.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-3:\nDue to regional regulations, the fuel usage per truck must not exceed 1000 liters in any region.\n// Fuel1 <= 1000; Fuel2 <= 1000; Fuel3 <= 1000; Fuel4 <= 1000; Fuel5 <= 1000",
        "question": "A logistics company is planning its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to decide the number of trucks to deploy in each region and the amount of fuel to be used per truck. The cost of fuel per liter varies by region, and the efficiency of trucks also differs. The cost of fuel in Region1 is $1.20/liter, in Region2 is $1.30/liter, in Region3 is $1.40/liter, in Region4 is $1.50/liter, and in Region5 is $1.60/liter. The efficiency of trucks in each region is inversely proportional to the fuel cost. The company aims to minimize the total cost of fuel and truck deployment. The company has a total budget of $50,000 for fuel and truck deployment. The total number of trucks available for deployment is 50. Due to regional regulations, the fuel usage per truck must not exceed 1000 liters in any region.\n\nPlease help the company to minimize the total cost of fuel and truck deployment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0)  # fuel usage per truck in Region1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0)  # fuel usage per truck in Region2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0)  # fuel usage per truck in Region3\nFuel4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel4\", lb=0)  # fuel usage per truck in Region4\nFuel5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel5\", lb=0)  # fuel usage per truck in Region5\n\n# Define objective function\nCost1 = 1.20 * Trucks1 * Fuel1\nCost2 = 1.30 * Trucks2 * Fuel2\nCost3 = 1.40 * Trucks3 * Fuel3\nCost4 = 1.50 * Trucks4 * Fuel4\nCost5 = 1.60 * Trucks5 * Fuel5\nDeploymentCost = 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3 + Cost4 + Cost5 + DeploymentCost)\n\n# Add constraints\nmodel.addCons(1.20 * Trucks1 * Fuel1 + 1.30 * Trucks2 * Fuel2 + 1.40 * Trucks3 * Fuel3 + 1.50 * Trucks4 * Fuel4 + 1.60 * Trucks5 * Fuel5 + 1000 * (Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5) <= 50000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Fuel1 <= 1000)\nmodel.addCons(Fuel2 <= 1000)\nmodel.addCons(Fuel3 <= 1000)\nmodel.addCons(Fuel4 <= 1000)\nmodel.addCons(Fuel5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Fuel Usage per Truck in Region1: \", model.getVal(Fuel1))\n    print(\"Fuel Usage per Truck in Region2: \", model.getVal(Fuel2))\n    print(\"Fuel Usage per Truck in Region3: \", model.getVal(Fuel3))\n    print(\"Fuel Usage per Truck in Region4: \", model.getVal(Fuel4))\n    print(\"Fuel Usage per Truck in Region5: \", model.getVal(Fuel5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 957,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. \nThe fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. \nThe fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. \nThe company aims to maximize the total distance covered by all vehicles.\n// Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n// Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n// Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n// So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter.\n// 10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000\n\n## Generate Constraint-2:\nThe total number of vehicles the company can purchase is limited to 10.\n// TruckA + TruckB + TruckC <= 10\n\n## Generate Constraint-3:\nDue to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it.\n// FuelA >= 1; FuelB >= 1; FuelC >= 1",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle for the upcoming year. The fuel efficiency of each vehicle type varies with the amount of fuel allocated, which affects the total distance each vehicle can travel. The fuel efficiency of TruckA increases by 0.1 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 10 km/liter. The fuel efficiency of TruckB increases by 0.05 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 15 km/liter. The fuel efficiency of TruckC increases by 0.08 km/liter for every additional liter of fuel allocated, starting from an initial efficiency of 20 km/liter. The company aims to maximize the total distance covered by all vehicles. The company has a budget of $100,000 for purchasing vehicles and allocating fuel. The cost of each TruckA is $10,000, TruckB is $15,000, and TruckC is $20,000. The cost of fuel is $1 per liter. The total number of vehicles the company can purchase is limited to 10. Due to maintenance requirements, each type of truck must have at least 1 liter of fuel allocated to it. Please help the company to maximize the total distance covered by all vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=1) # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=1) # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=1) # fuel allocation for TruckC\n\n# Define objective function\n## Total distance for TruckA: DistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\n## Total distance for TruckB: DistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\n## Total distance for TruckC: DistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\n## So, the objective function is: Maximize (DistanceA + DistanceB + DistanceC)\nDistanceA = (10 + 0.1 * FuelA) * FuelA * TruckA\nDistanceB = (15 + 0.05 * FuelB) * FuelB * TruckB\nDistanceC = (20 + 0.08 * FuelC) * FuelC * TruckC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == DistanceA + DistanceB + DistanceC)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles and allocating fuel.\nmodel.addCons(10000 * TruckA + 15000 * TruckB + 20000 * TruckC + FuelA + FuelB + FuelC <= 100000)\n## The total number of vehicles the company can purchase is limited to 10.\nmodel.addCons(TruckA + TruckB + TruckC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Maximized Total Distance: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1361,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trucks to allocate to each region: North, South, East, West, and Central.\n// {\"number of trucks in North region\": \"N\", \"range\": \"N >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck generates revenue based on the distance traveled and the load capacity. The revenue function is nonlinear due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions.\n// Revenue in North: R_N = 0.05 * N^2\n// Revenue in South: R_S = 0.06 * S^2\n// Revenue in East: R_E = 0.07 * E^2\n// Revenue in West: R_W = 0.08 * W^2\n// Revenue in Central: R_C = 0.09 * C^2\n// So, the objective function is: Maximize (R_N + R_S + R_E + R_W + R_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck maintenance and fuel costs.\n// 1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each region.\n// N >= 5; S >= 5; E >= 5; W >= 5; C >= 5\n\n## Generate Constraint-3:\nThe total number of trucks cannot exceed 100.\n// N + S + E + W + C <= 100\n\n## Generate Constraint-4:\nThe number of trucks in the North region must not exceed the combined number of trucks in the South and East regions.\n// N <= S + E",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: North, South, East, West, and Central. The company needs to decide the number of trucks to allocate to each region. Each truck generates revenue based on the distance traveled and the load capacity, with a nonlinear revenue function due to economies of scale in fuel consumption and maintenance. The company aims to maximize the total revenue from all regions. The revenue for each region is given in the following Table.\n\n| Region   | Revenue Function |\n|----------|------------------|\n| North    | 0.05 * N^2       |\n| South    | 0.06 * S^2       |\n| East     | 0.07 * E^2       |\n| West     | 0.08 * W^2       |\n| Central  | 0.09 * C^2       |\n\nThe company has a total budget of $500,000 for truck maintenance and fuel costs. The company must allocate at least 5 trucks to each region. The total number of trucks cannot exceed 100. The number of trucks in the North region must not exceed the combined number of trucks in the South and East regions.\n\nPlease help the company to maximize the total revenue from all regions.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nN = model.addVar(vtype=\"INTEGER\", name=\"N\", lb=5)  # number of trucks in North region\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5)  # number of trucks in South region\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5)  # number of trucks in East region\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=5)  # number of trucks in West region\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5)  # number of trucks in Central region\n\n# Define objective function\nR_N = 0.05 * N**2\nR_S = 0.06 * S**2\nR_E = 0.07 * E**2\nR_W = 0.08 * W**2\nR_C = 0.09 * C**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_N + R_S + R_E + R_W + R_C)\n\n# Add constraints\nmodel.addCons(1000 * N + 1200 * S + 1400 * E + 1600 * W + 1800 * C <= 500000)\nmodel.addCons(N + S + E + W + C <= 100)\nmodel.addCons(N <= S + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North: \", model.getVal(N))\n    print(\"Number of Trucks in South: \", model.getVal(S))\n    print(\"Number of Trucks in East: \", model.getVal(E))\n    print(\"Number of Trucks in West: \", model.getVal(W))\n    print(\"Number of Trucks in Central: \", model.getVal(C))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while considering fuel costs and maintenance.\n// {\"number of trucks for RouteA\": \"RouteATrucks\", \"range\": \"RouteATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"RouteBTrucks\", \"range\": \"RouteBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"RouteCTrucks\", \"range\": \"RouteCTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"RouteDTrucks\", \"range\": \"RouteDTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"RouteETrucks\", \"range\": \"RouteETrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Cost per Truck is $5,000, the Maintenance Cost per Truck is $2,000, and the Revenue per Truck is $10,000.\nFor RouteB, the Fuel Cost per Truck is $6,000, the Maintenance Cost per Truck is $2,500, and the Revenue per Truck is $12,000.\nFor RouteC, the Fuel Cost per Truck is $7,000, the Maintenance Cost per Truck is $3,000, and the Revenue per Truck is $14,000.\nFor RouteD, the Fuel Cost per Truck is $8,000, the Maintenance Cost per Truck is $3,500, and the Revenue per Truck is $16,000.\nFor RouteE, the Fuel Cost per Truck is $9,000, the Maintenance Cost per Truck is $4,000, and the Revenue per Truck is $18,000.\nThe company wants to maximize the average net revenue per truck.\n// Total net revenue for RouteA: Revenue_RouteA = (10,000 - 5,000 - 2,000) * RouteATrucks\n// Total net revenue for RouteB: Revenue_RouteB = (12,000 - 6,000 - 2,500) * RouteBTrucks\n// Total net revenue for RouteC: Revenue_RouteC = (14,000 - 7,000 - 3,000) * RouteCTrucks\n// Total net revenue for RouteD: Revenue_RouteD = (16,000 - 8,000 - 3,500) * RouteDTrucks\n// Total net revenue for RouteE: Revenue_RouteE = (18,000 - 9,000 - 4,000) * RouteETrucks\n// So, the objective function is: Maximize (Revenue_RouteA + Revenue_RouteB + Revenue_RouteC + Revenue_RouteD + Revenue_RouteE) / (RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 50\n\n## Generate Constraint-2:\nDue to route complexities, RouteA must have at least half as many trucks as RouteB.\n// RouteATrucks <= 0.5 * RouteBTrucks\n\n## Generate Constraint-3:\nThe company has a budget of $150,000 for maintenance costs for the quarter.\n// 2,000 * RouteATrucks + 2,500 * RouteBTrucks + 3,000 * RouteCTrucks + 3,500 * RouteDTrucks + 4,000 * RouteETrucks <= 150,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each route has at least one truck assigned.\n// RouteATrucks >= 1; RouteBTrucks >= 1; RouteCTrucks >= 1; RouteDTrucks >= 1; RouteETrucks >= 1",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue. The costs and revenue per truck for each route are given in the following Table.\n\n| Route   | Fuel Cost per Truck | Maintenance Cost per Truck | Revenue per Truck |\n|---------|---------------------|----------------------------|-------------------|\n| RouteA  | $5,000              | $2,000                     | $10,000           |\n| RouteB  | $6,000              | $2,500                     | $12,000           |\n| RouteC  | $7,000              | $3,000                     | $14,000           |\n| RouteD  | $8,000              | $3,500                     | $16,000           |\n| RouteE  | $9,000              | $4,000                     | $18,000           |\n\nThe company has a total of 50 trucks available for allocation. Due to route complexities, RouteA must have at least half as many trucks as RouteB. The company has a budget of $150,000 for maintenance costs for the quarter. The company wants to ensure that each route has at least one truck assigned. \n\nPlease help the company to maximize the average net revenue per truck.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteATrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteATrucks\", lb=1)\nRouteBTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteBTrucks\", lb=1)\nRouteCTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteCTrucks\", lb=1)\nRouteDTrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteDTrucks\", lb=1)\nRouteETrucks = model.addVar(vtype=\"INTEGER\", name=\"RouteETrucks\", lb=1)\n\n# Define objective function\nRevenue_RouteA = (10000 - 5000 - 2000) * RouteATrucks\nRevenue_RouteB = (12000 - 6000 - 2500) * RouteBTrucks\nRevenue_RouteC = (14000 - 7000 - 3000) * RouteCTrucks\nRevenue_RouteD = (16000 - 8000 - 3500) * RouteDTrucks\nRevenue_RouteE = (18000 - 9000 - 4000) * RouteETrucks\nTotalTrucks = RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue_RouteA + Revenue_RouteB + Revenue_RouteC + Revenue_RouteD + Revenue_RouteE) / TotalTrucks\n# convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Revenue_RouteA + Revenue_RouteB + Revenue_RouteC + Revenue_RouteD + Revenue_RouteE)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(RouteATrucks + RouteBTrucks + RouteCTrucks + RouteDTrucks + RouteETrucks <= 50)\n# Due to route complexities, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(RouteATrucks <= 0.5 * RouteBTrucks)\n# The company has a budget of $150,000 for maintenance costs for the quarter.\nmodel.addCons(2000 * RouteATrucks + 2500 * RouteBTrucks + 3000 * RouteCTrucks + 3500 * RouteDTrucks + 4000 * RouteETrucks <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(RouteATrucks))\n    print(\"Number of Trucks for RouteB: \", model.getVal(RouteBTrucks))\n    print(\"Number of Trucks for RouteC: \", model.getVal(RouteCTrucks))\n    print(\"Number of Trucks for RouteD: \", model.getVal(RouteDTrucks))\n    print(\"Number of Trucks for RouteE: \", model.getVal(RouteETrucks))\n    print(\"Maximized Average Net Revenue per Truck: \", model.getObjVal() / TotalTrucks)\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1321,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and the revenue generated per Truck is $150 per day. The operational cost per Van is $70 per day, and the revenue generated per Van is $120 per day. The operational cost per Bike is $30 per day, and the revenue generated per Bike is $60 per day. The company wants to maximize the total daily profit from all vehicles.\n// Profit_Trucks = (150 - 100) * Trucks\n// Profit_Vans = (120 - 70) * Vans\n// Profit_Bikes = (60 - 30) * Bikes\n// So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n## Generate Constraint-1:\nThe company has a limited budget for vehicle maintenance, which is $2000 per day. The maintenance cost per Truck is $150, per Van is $100, and per Bike is $50.\n// 150 * Trucks + 100 * Vans + 50 * Bikes <= 2000\n\n## Generate Constraint-2:\nThe company has a limited number of parking spaces, which is 20. Each Truck requires 3 spaces, each Van requires 2 spaces, and each Bike requires 1 space.\n// 3 * Trucks + 2 * Vans + 1 * Bikes <= 20\n\n## Generate Constraint-3:\nDue to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. Each Truck emits 50 units, each Van emits 30 units, and each Bike emits 10 units.\n// 50 * Trucks + 30 * Vans + 10 * Bikes <= 500",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while minimizing operational costs. The operational cost per Truck is $100 per day, and the revenue generated per Truck is $150 per day. The operational cost per Van is $70 per day, and the revenue generated per Van is $120 per day. The operational cost per Bike is $30 per day, and the revenue generated per Bike is $60 per day. The company wants to maximize the total daily profit from all vehicles. The company has a limited budget for vehicle maintenance, which is $2000 per day. The maintenance cost per Truck is $150, per Van is $100, and per Bike is $50. The company has a limited number of parking spaces, which is 20. Each Truck requires 3 spaces, each Van requires 2 spaces, and each Bike requires 1 space. Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day. Each Truck emits 50 units, each Van emits 30 units, and each Bike emits 10 units. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to maximize their total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nProfit_Trucks = (150 - 100) * Trucks\nProfit_Vans = (120 - 70) * Vans\nProfit_Bikes = (60 - 30) * Bikes\n# So, the objective function is: Maximize (Profit_Trucks + Profit_Vans + Profit_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Trucks + Profit_Vans + Profit_Bikes)\n\n# Add constraints\n# The company has a limited budget for vehicle maintenance, which is $2000 per day.\nmodel.addCons(150 * Trucks + 100 * Vans + 50 * Bikes <= 2000)\n# The company has a limited number of parking spaces, which is 20.\nmodel.addCons(3 * Trucks + 2 * Vans + 1 * Bikes <= 20)\n# Due to environmental regulations, the total emissions from all vehicles must not exceed 500 units per day.\nmodel.addCons(50 * Trucks + 30 * Vans + 10 * Bikes <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit.\n// {\"quantity of MachineA\": \"MachineA_qty\", \"range\": \"MachineA_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineB\": \"MachineB_qty\", \"range\": \"MachineB_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineC\": \"MachineC_qty\", \"range\": \"MachineC_qty >= 0\", \"type\": \"integer\"}\n// {\"quantity of MachineD\": \"MachineD_qty\", \"range\": \"MachineD_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - (0.01 * (MachineA_qty^2) + 20 * MachineA_qty)) * MachineA_qty\n// Total profit for MachineB: Profit_MachineB = (700 - (0.015 * (MachineB_qty^2) + 25 * MachineB_qty)) * MachineB_qty\n// Total profit for MachineC: Profit_MachineC = (900 - (0.02 * (MachineC_qty^2) + 30 * MachineC_qty)) * MachineC_qty\n// Total profit for MachineD: Profit_MachineD = (1100 - (0.025 * (MachineD_qty^2) + 35 * MachineD_qty)) * MachineD_qty\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 machines per month.\n// MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000",
        "question": "A manufacturing company produces four types of machines: MachineA, MachineB, MachineC, and MachineD. They need to determine the production quantity for each machine type to optimize their profit. The profit per unit for MachineA is $500, for MachineB is $700, for MachineC is $900, and for MachineD is $1100. However, the production cost increases nonlinearly with quantity due to economies of scale. The production cost for MachineA is 0.01 * (MachineA_qty^2) + 20 * MachineA_qty, for MachineB is 0.015 * (MachineB_qty^2) + 25 * MachineB_qty, for MachineC is 0.02 * (MachineC_qty^2) + 30 * MachineC_qty, and for MachineD is 0.025 * (MachineD_qty^2) + 35 * MachineD_qty. The company has a total production capacity of 1000 machines per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_qty\", lb=0)\nMachineB_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_qty\", lb=0)\nMachineC_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_qty\", lb=0)\nMachineD_qty = model.addVar(vtype=\"INTEGER\", name=\"MachineD_qty\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for each machine type\nProfit_MachineA = (500 - (0.01 * MachineA_qty**2 + 20 * MachineA_qty)) * MachineA_qty\nProfit_MachineB = (700 - (0.015 * MachineB_qty**2 + 25 * MachineB_qty)) * MachineB_qty\nProfit_MachineC = (900 - (0.02 * MachineC_qty**2 + 30 * MachineC_qty)) * MachineC_qty\nProfit_MachineD = (1100 - (0.025 * MachineD_qty**2 + 35 * MachineD_qty)) * MachineD_qty\n\n## the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC + Profit_MachineD)\n\n# Add constraints\n## The company has a total production capacity of 1000 machines per month.\nmodel.addCons(MachineA_qty + MachineB_qty + MachineC_qty + MachineD_qty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of MachineA: \", model.getVal(MachineA_qty))\n    print(\"Quantity of MachineB: \", model.getVal(MachineB_qty))\n    print(\"Quantity of MachineC: \", model.getVal(MachineC_qty))\n    print(\"Quantity of MachineD: \", model.getVal(MachineD_qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product, as well as the number of shifts to operate in the factory each day. The efficiency of production varies per product and per shift.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product A\": \"ShiftsA\", \"range\": \"ShiftsA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product B\": \"ShiftsB\", \"range\": \"ShiftsB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product C\": \"ShiftsC\", \"range\": \"ShiftsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating a shift for product A is $1000, product B is $1200, and product C is $1100. The company aims to maximize its daily profit.\n// Profit_A = UnitsA * 50 - ShiftsA * 1000\n// Profit_B = UnitsB * 70 - ShiftsB * 1200\n// Profit_C = UnitsC * 60 - ShiftsC * 1100\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe factory has a total capacity of 10 shifts per day.\n// ShiftsA + ShiftsB + ShiftsC <= 10\n\n## Generate Constraint-2:\nThe production rate of product A is 10 units per shift, product B is 15 units per shift, and product C is 12 units per shift.\n// UnitsA <= ShiftsA * 10\n// UnitsB <= ShiftsB * 15\n// UnitsC <= ShiftsC * 12",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product, as well as the number of shifts to operate in the factory each day. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating a shift for product A is $1000, product B is $1200, and product C is $1100. The factory has a total capacity of 10 shifts per day. The production rate of product A is 10 units per shift, product B is 15 units per shift, and product C is 12 units per shift. The company aims to maximize its daily profit. Please help the company determine the optimal number of units and shifts for each product to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nShiftsA = model.addVar(vtype=\"INTEGER\", name=\"ShiftsA\", lb=0) # number of shifts for product A\nShiftsB = model.addVar(vtype=\"INTEGER\", name=\"ShiftsB\", lb=0) # number of shifts for product B\nShiftsC = model.addVar(vtype=\"INTEGER\", name=\"ShiftsC\", lb=0) # number of shifts for product C\n\n# Define objective function\nProfit_A = UnitsA * 50 - ShiftsA * 1000\nProfit_B = UnitsB * 70 - ShiftsB * 1200\nProfit_C = UnitsC * 60 - ShiftsC * 1100\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The factory has a total capacity of 10 shifts per day.\nmodel.addCons(ShiftsA + ShiftsB + ShiftsC <= 10)\n# The production rate of product A is 10 units per shift, product B is 15 units per shift, and product C is 12 units per shift.\nmodel.addCons(UnitsA <= ShiftsA * 10)\nmodel.addCons(UnitsB <= ShiftsB * 15)\nmodel.addCons(UnitsC <= ShiftsC * 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Number of Shifts for Product A: \", model.getVal(ShiftsA))\n    print(\"Number of Shifts for Product B: \", model.getVal(ShiftsB))\n    print(\"Number of Shifts for Product C: \", model.getVal(ShiftsC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor TruckA, the fuel efficiency is 10 km/l, the maintenance cost is $500 per month, and the rental cost is $1000 per month. \nFor TruckB, the fuel efficiency is 15 km/l, the maintenance cost is $700 per month, and the rental cost is $1200 per month. \nFor TruckC, the fuel efficiency is 20 km/l, the maintenance cost is $900 per month, and the rental cost is $1400 per month.\nFor TruckD, the fuel efficiency is 25 km/l, the maintenance cost is $1100 per month, and the rental cost is $1600 per month.\nFor TruckE, the fuel efficiency is 30 km/l, the maintenance cost is $1300 per month, and the rental cost is $1800 per month.\nThe company aims to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance).\n// Total cost for TruckA: Cost_TruckA = (1000 + 500) * TruckA\n// Total cost for TruckB: Cost_TruckB = (1200 + 700) * TruckB\n// Total cost for TruckC: Cost_TruckC = (1400 + 900) * TruckC\n// Total cost for TruckD: Cost_TruckD = (1600 + 1100) * TruckD\n// Total cost for TruckE: Cost_TruckE = (1800 + 1300) * TruckE\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / (10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month.\n// (1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150,000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 10 units of each type of truck are deployed.\n// TruckA >= 10; TruckB >= 10; TruckC >= 10; TruckD >= 10; TruckE >= 10",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and rental cost for each truck are given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/l) | Maintenance Cost per Month | Rental Cost per Month |\n|------------|-----------------------|----------------------------|----------------------|\n| TruckA     | 10                    | $500                       | $1000                |\n| TruckB     | 15                    | $700                       | $1200                |\n| TruckC     | 20                    | $900                       | $1400                |\n| TruckD     | 25                    | $1100                      | $1600                |\n| TruckE     | 30                    | $1300                      | $1800                |\n\nThe company has a budget of $150,000 for truck rentals and maintenance for the next month. The company wants to ensure that at least 10 units of each type of truck are deployed. The company aims to minimize the total cost per kilometer (which is defined as the sum of the rental and maintenance costs divided by the sum of the distances traveled, assuming each truck travels the same distance).\n\nPlease help the company to determine the optimal number of each type of truck to deploy to minimize the total cost per kilometer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 10 units of each type of truck are deployed.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=10) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=10) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=10) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=10) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=10) # number of TruckE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (1000 + 500) * TruckA\nCost_TruckB = (1200 + 700) * TruckB\nCost_TruckC = (1400 + 900) * TruckC\nCost_TruckD = (1600 + 1100) * TruckD\nCost_TruckE = (1800 + 1300) * TruckE\nDistance = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE) / Distance\n## convert the division to multiplication\nmodel.addCons(obj * Distance == Cost_TruckA + Cost_TruckB + Cost_TruckC + Cost_TruckD + Cost_TruckE)\n\n# Add constraints\n## The company has a budget of $150,000 for truck rentals and maintenance for the next month.\nmodel.addCons((1000 * TruckA + 1200 * TruckB + 1400 * TruckC + 1600 * TruckD + 1800 * TruckE) + (500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE) <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1493,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for B is $30, for C is $40, for D is $50, and for E is $60. The company aims to maximize the total profit from distributing these products. However, due to varying demand and storage capacities, the profit rate per unit of storage space used is considered. The profit rate is defined as the total profit divided by the total volume of products.\n// Profit of A: Profit_A = 20 * A\n// Profit of B: Profit_B = 30 * B\n// Profit of C: Profit_C = 40 * C\n// Profit of D: Profit_D = 50 * D\n// Profit of E: Profit_E = 60 * E\n// Volume of A: Volume_A = A\n// Volume of B: Volume_B = 2 * B\n// Volume of C: Volume_C = 3 * C\n// Volume of D: Volume_D = 4 * D\n// Volume of E: Volume_E = 5 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E)\n\n## Generate Constraint-1:\nThe company has a total storage capacity of 500 cubic units.\n// A + 2 * B + 3 * C + 4 * D + 5 * E <= 500\n\n## Generate Constraint-2:\nThe company wants to distribute at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5",
        "question": "A logistics company manages the distribution of five different products: A, B, C, D, and E. The company needs to determine the optimal number of units to distribute for each product to maximize profit while considering storage and transportation constraints. The profit per unit for product A is $20, for B is $30, for C is $40, for D is $50, and for E is $60. The company aims to maximize the total profit from distributing these products. However, due to varying demand and storage capacities, the profit rate per unit of storage space used is considered. The profit rate is defined as the total profit divided by the total volume of products. The company has a total storage capacity of 500 cubic units. The company wants to distribute at least 5 units of each product. Please help the company to maximize the profit rate per unit of storage space used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to distribute at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nProfit_D = 50 * D\nProfit_E = 60 * E\nVolume_A = A\nVolume_B = 2 * B\nVolume_C = 3 * C\nVolume_D = 4 * D\nVolume_E = 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Volume_A + Volume_B + Volume_C + Volume_D + Volume_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a total storage capacity of 500 cubic units.\nmodel.addCons(A + 2 * B + 3 * C + 4 * D + 5 * E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-4:\nThe company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000\n\n## Generate Constraint-5:\nEach device must have a minimum production quantity to meet market demand: DeviceA must produce at least 500 units, DeviceB at least 300 units, DeviceC at least 800 units, DeviceD at least 400 units, and DeviceE at least 600 units.\n// DeviceAProduction >= 500; DeviceBProduction >= 300; DeviceCProduction >= 800; DeviceDProduction >= 400; DeviceEProduction >= 600",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The production of DeviceA must be at least twice the production of DeviceB. The company has a budget constraint for raw materials, which is $500,000. The cost of raw materials per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35. Each device must have a minimum production quantity to meet market demand: DeviceA must produce at least 500 units, DeviceB at least 300 units, DeviceC at least 800 units, DeviceD at least 400 units, and DeviceE at least 600 units.\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Set minimum production quantities\nmodel.addCons(DeviceAProduction >= 500)\nmodel.addCons(DeviceBProduction >= 300)\nmodel.addCons(DeviceCProduction >= 800)\nmodel.addCons(DeviceDProduction >= 400)\nmodel.addCons(DeviceEProduction >= 600)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1160,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Small wind farms\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Medium wind farms\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Large wind farms\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each wind farm type increases with the level of maintenance investment. For Small wind farms, the efficiency increases by 0.1% for every $1,000 invested. For Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested. For Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms.\n// EnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\n// EnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\n// EnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n// So, the objective function is: Maximize (EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both construction and maintenance investments.\n// 100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000\n\n## Generate Constraint-2:\nThe total land available for wind farm construction is limited to 10 farms.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must build at least 2 Small wind farms and 1 Medium wind farm.\n// SmallWindFarms >= 2; MediumWindFarms >= 1\n\n## Generate Constraint-4:\nThe maximum maintenance investment for each type of wind farm is capped at $50,000.\n// MaintenanceSmall <= 50000; MaintenanceMedium <= 50000; MaintenanceLarge <= 50000",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency. The efficiency of each wind farm type increases with the level of maintenance investment as follows: for Small wind farms, the efficiency increases by 0.1% for every $1,000 invested; for Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested; and for Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms.\n\n| Wind Farm Type | Initial Efficiency | Efficiency Increase per $1,000 Investment |\n|----------------|--------------------|------------------------------------------|\n| Small          | 100                | 0.1%                                     |\n| Medium         | 200                | 0.2%                                     |\n| Large          | 300                | 0.3%                                     |\n\nThe company has a total budget of $1,000,000 for both construction and maintenance investments. The total land available for wind farm construction is limited to 10 farms. Due to regulatory requirements, the company must build at least 2 Small wind farms and 1 Medium wind farm. The maximum maintenance investment for each type of wind farm is capped at $50,000.\n\nPlease help the company to maximize the total energy production from all wind farms.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=0)\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)\n\n# Set lower bounds for Small and Medium wind farms\nmodel.addCons(SmallWindFarms >= 2)\nmodel.addCons(MediumWindFarms >= 1)\n\n# Define objective function\nEnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\nEnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\nEnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n# Add constraints\nmodel.addCons(100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000)\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10)\nmodel.addCons(MaintenanceSmall <= 50000)\nmodel.addCons(MaintenanceMedium <= 50000)\nmodel.addCons(MaintenanceLarge <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Maintenance Investment for Small Wind Farms: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Investment for Medium Wind Farms: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Investment for Large Wind Farms: \", model.getVal(MaintenanceLarge))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1558,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time.\n// {\"number of trucks for Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each region are as follows:\n- Region1: Fuel consumption per truck is 100 liters, and travel time is 5 hours.\n- Region2: Fuel consumption per truck is 120 liters, and travel time is 6 hours.\n- Region3: Fuel consumption per truck is 140 liters, and travel time is 7 hours.\n- Region4: Fuel consumption per truck is 160 liters, and travel time is 8 hours.\n- Region5: Fuel consumption per truck is 180 liters, and travel time is 9 hours.\nThe company wants to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate).\n// Total_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\n// Total_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n// So, the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs.\n// 100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000\n\n## Generate Constraint-2:\nThe total travel time across all regions should not exceed 500 hours.\n// 5 * Truck1 + 6 * Truck2 + 7 * Truck3 + 8 * Truck4 + 9 * Truck5 <= 500\n\n## Generate Constraint-3:\nThe company can allocate a maximum of 10 trucks in total.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 10",
        "question": "A logistics company needs to optimize its delivery routes for five different regions (Region1, Region2, Region3, Region4, Region5). The company must decide how many trucks to allocate to each region to minimize fuel consumption and travel time. The fuel consumption per truck and travel time for each region are given in the following Table.\n\n| Region   | Fuel Consumption per Truck | Travel Time per Truck |\n|----------|---------------------------|----------------------|\n| Region1  | 100 liters                | 5 hours              |\n| Region2  | 120 liters                | 6 hours              |\n| Region3  | 140 liters                | 7 hours              |\n| Region4  | 160 liters                | 8 hours              |\n| Region5  | 180 liters                | 9 hours              |\n\nThe company has a total budget of $10,000 for fuel costs. The total travel time across all regions should not exceed 500 hours. The company can allocate a maximum of 10 trucks in total. \nPlease help the company to minimize the total cost, which is the sum of the fuel cost (fuel consumption per truck * fuel price) and the opportunity cost of travel time (travel time per truck * hourly cost rate).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks for Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks for Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks for Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks for Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks for Region5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Price = 3  # Assuming fuel price per liter is $3\nHourly_Cost_Rate = 20  # Assuming hourly cost rate is $20\nTotal_Fuel_Cost = 100 * Fuel_Price * Truck1 + 120 * Fuel_Price * Truck2 + 140 * Fuel_Price * Truck3 + 160 * Fuel_Price * Truck4 + 180 * Fuel_Price * Truck5\nTotal_Time_Cost = 5 * Hourly_Cost_Rate * Truck1 + 6 * Hourly_Cost_Rate * Truck2 + 7 * Hourly_Cost_Rate * Truck3 + 8 * Hourly_Cost_Rate * Truck4 + 9 * Hourly_Cost_Rate * Truck5\n## the objective function is: Minimize (Total_Fuel_Cost + Total_Time_Cost)\nmodel.addCons(obj == Total_Fuel_Cost + Total_Time_Cost)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs.\nmodel.addCons(100 * Truck1 + 120 * Truck2 + 140 * Truck3 + 160 * Truck4 + 180 * Truck5 <= 10000)\n## The total travel time across all regions should not exceed 500 hours.\nmodel.addCons(5 * Truck1 + 6 * Truck2 + 7 * Truck3 + 8 * Truck4 + 9 * Truck5 <= 500)\n## The company can allocate a maximum of 10 trucks in total.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks for Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks for Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks for Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks for Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: small, medium, and large, each with different fuel efficiencies and capacities.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of small trucks (km/liter)\": \"SmallFuelEfficiency\", \"range\": \"SmallFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of large trucks (km/liter)\": \"LargeFuelEfficiency\", \"range\": \"LargeFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day, considering the distance traveled by each type of truck and the current fuel prices. The fuel price is $1.5 per liter.\n// FuelCost_Small = (SmallTrucks * Distance_Small) / SmallFuelEfficiency * 1.5\n// FuelCost_Medium = (MediumTrucks * Distance_Medium) / MediumFuelEfficiency * 1.5\n// FuelCost_Large = (LargeTrucks * Distance_Large) / LargeFuelEfficiency * 1.5\n// So, the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $3000 per day for fuel expenses.\n// FuelCost_Small + FuelCost_Medium + FuelCost_Large <= 3000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: small, medium, and large, each with different fuel efficiencies and capacities. The company aims to minimize the total fuel cost per day, considering the distance traveled by each type of truck and the current fuel prices, which is $1.5 per liter.\n\n| Truck Type | Number of Trucks | Fuel Efficiency (km/liter) |\n|------------|------------------|----------------------------|\n| Small      | SmallTrucks      | SmallFuelEfficiency        |\n| Medium     | MediumTrucks     | MediumFuelEfficiency       |\n| Large      | LargeTrucks      | LargeFuelEfficiency        |\n\nThe company has a total budget of $3000 per day for fuel expenses. Please help the company determine the optimal number of each type of truck and their respective fuel efficiencies to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance_Small = model.addVar(name=\"Distance_Small\")  # distance traveled by small trucks\nDistance_Medium = model.addVar(name=\"Distance_Medium\")  # distance traveled by medium trucks\nDistance_Large = model.addVar(name=\"Distance_Large\")  # distance traveled by large trucks\nSmallFuelEfficiency = model.addVar(name=\"SmallFuelEfficiency\")  # fuel efficiency of small trucks\nMediumFuelEfficiency = model.addVar(name=\"MediumFuelEfficiency\")  # fuel efficiency of medium trucks\nLargeFuelEfficiency = model.addVar(name=\"LargeFuelEfficiency\")  # fuel efficiency of large trucks\n\n## the objective function is: Minimize (FuelCost_Small + FuelCost_Medium + FuelCost_Large)\n## convert the division to multiplication\nmodel.addCons(obj == (SmallTrucks * Distance_Small * 1.5) / SmallFuelEfficiency +\n              (MediumTrucks * Distance_Medium * 1.5) / MediumFuelEfficiency +\n              (LargeTrucks * Distance_Large * 1.5) / LargeFuelEfficiency)\n\n# Add constraints\n## The company has a total budget of $3000 per day for fuel expenses.\nmodel.addCons(obj <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, but it decreases by $0.02 for every unit produced beyond 100 units. The profit per unit of C2 is $15, but it decreases by $0.03 for every unit produced beyond 200 units. The profit per unit of C3 is $20, but it decreases by $0.04 for every unit produced beyond 300 units. The company aims to maximize the total profit from selling these components.\n// Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\n// Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\n// Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\n// So, the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 units in total.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe company has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3. The total budget for raw materials is $3000.\n// 5 * C1 + 7 * C2 + 9 * C3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for C1 is at least 50 units and at most 200 units.\n// 50 <= C1 <= 200\n\n## Generate Constraint-4:\nThe market demand for C2 is at least 100 units and at most 300 units.\n// 100 <= C2 <= 300\n\n## Generate Constraint-5:\nThe market demand for C3 is at least 150 units and at most 400 units.\n// 150 <= C3 <= 400",
        "question": "A manufacturing company produces three types of electronic components: C1, C2, and C3. They need to determine the optimal quantities of each component to maximize their profit while considering various constraints. The profit per unit of each component decreases as production exceeds certain thresholds, as detailed in the following Table.\n\n| Component | Profit per Unit (above threshold) | Decrease per Excess Unit | Threshold |\n|-----------|-----------------------------------|--------------------------|-----------|\n| C1        | $10                               | $0.02                    | 100 units  |\n| C2        | $15                               | $0.03                    | 200 units  |\n| C3        | $20                               | $0.04                    | 300 units  |\n\nThe company has a limited production capacity of 500 units in total. The company also has a limited budget for raw materials, which costs $5 per unit for C1, $7 per unit for C2, and $9 per unit for C3, with a total budget of $3000. The market demand for C1 is at least 50 units and at most 200 units, for C2 is at least 100 units and at most 300 units, and for C3 is at least 150 units and at most 400 units.\n\nPlease help the company to maximize the total profit from selling these components, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200)  # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300)  # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=150, ub=400)  # quantity of C3\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_C1 = (10 - 0.02 * max(C1 - 100, 0)) * C1\nC1_1 = model.addVar(vtype=\"INTEGER\", name=\"C1_1\", lb=50, ub=100)\nC1_2 = model.addVar(vtype=\"INTEGER\", name=\"C1_2\", lb=100, ub=200)\nC1_b1 = model.addVar(vtype=\"B\", name=\"C1_b1\")\nC1_b2 = model.addVar(vtype=\"B\", name=\"C1_b2\")\nmodel.addCons(C1_b1 + C1_b2 == 1)\nmodel.addCons(C1 == C1_1*C1_b1 + C1_2*C1_b2)\nProfit_C1 = (10 - 0.02 * (C1_2 - 100)) * C1_2 * C1_b2 + 10 * C1_1 * C1_b1\n## create piecewise variables for piecewise function: Profit_C2 = (15 - 0.03 * max(C2 - 200, 0)) * C2\nC2_1 = model.addVar(vtype=\"INTEGER\", name=\"C2_1\", lb=100, ub=200)\nC2_2 = model.addVar(vtype=\"INTEGER\", name=\"C2_2\", lb=200, ub=300)\nC2_b1 = model.addVar(vtype=\"B\", name=\"C2_b1\")\nC2_b2 = model.addVar(vtype=\"B\", name=\"C2_b2\")\nmodel.addCons(C2_b1 + C2_b2 == 1)\nmodel.addCons(C2 == C2_1*C2_b1 + C2_2*C2_b2)\nProfit_C2 = (15 - 0.03 * (C2_2 - 200)) * C2_2 * C2_b2 + 15 * C2_1 * C2_b1\n## create piecewise variables for piecewise function: Profit_C3 = (20 - 0.04 * max(C3 - 300, 0)) * C3\nC3_1 = model.addVar(vtype=\"INTEGER\", name=\"C3_1\", lb=150, ub=300)\nC3_2 = model.addVar(vtype=\"INTEGER\", name=\"C3_2\", lb=300, ub=400)\nC3_b1 = model.addVar(vtype=\"B\", name=\"C3_b1\")\nC3_b2 = model.addVar(vtype=\"B\", name=\"C3_b2\")\nmodel.addCons(C3_b1 + C3_b2 == 1)\nmodel.addCons(C3 == C3_1*C3_b1 + C3_2*C3_b2)\nProfit_C3 = (20 - 0.04 * (C3_2 - 300)) * C3_2 * C3_b2 + 20 * C3_1 * C3_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_C1 + Profit_C2 + Profit_C3\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(C1 + C2 + C3 <= 500)\nmodel.addCons(5 * C1 + 7 * C2 + 9 * C3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance.\n// {\"number of solar panels in Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"SE\", \"range\": \"SE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city aims to maximize the total energy production while minimizing the total cost of installation and maintenance.\n// Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n// Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n// So, the objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all zones is limited to 200.\n// SA + SB + SC + SD + SE <= 200\n\n## Generate Constraint-3:\nAt least 30 solar panels must be installed in Zone A.\n// SA >= 30\n\n## Generate Constraint-4:\nNo more than 50 solar panels can be installed in any single zone.\n// SA <= 50; SB <= 50; SC <= 50; SD <= 50; SE <= 50\n\n## Generate Constraint-5:\nThe total energy production must exceed 20,000 kWh.\n// 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE >= 20000",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance. The efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city has a budget of $100,000 for the installation and maintenance of solar panels. The total number of solar panels that can be installed across all zones is limited to 200. At least 30 solar panels must be installed in Zone A. No more than 50 solar panels can be installed in any single zone. The total energy production must exceed 20,000 kWh. Please help the city to maximize the total energy production while minimizing the total cost of installation and maintenance.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=30, ub=50) # number of solar panels in Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0, ub=50) # number of solar panels in Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0, ub=50) # number of solar panels in Zone C\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0, ub=50) # number of solar panels in Zone D\nSE = model.addVar(vtype=\"INTEGER\", name=\"SE\", lb=0, ub=50) # number of solar panels in Zone E\n\n# Define objective function\nEnergy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\nCost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n# So, the objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000)\n# The total number of solar panels that can be installed across all zones is limited to 200.\nmodel.addCons(SA + SB + SC + SD + SE <= 200)\n# At least 30 solar panels must be installed in Zone A.\nmodel.addCons(SA >= 30)\n# No more than 50 solar panels can be installed in any single zone.\nmodel.addCons(SA <= 50)\nmodel.addCons(SB <= 50)\nmodel.addCons(SC <= 50)\nmodel.addCons(SD <= 50)\nmodel.addCons(SE <= 50)\n# The total energy production must exceed 20,000 kWh.\nmodel.addCons(100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(SA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(SB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(SC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(SD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(SE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of truck to minimize the total operational cost while meeting the cargo delivery requirements.\n// {\"number of T1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost of T1 is $100 per km, with a fuel efficiency of 5 km/liter and a maintenance cost of $500 per month.\nThe operational cost of T2 is $120 per km, with a fuel efficiency of 6 km/liter and a maintenance cost of $600 per month.\nThe operational cost of T3 is $140 per km, with a fuel efficiency of 7 km/liter and a maintenance cost of $700 per month.\nThe operational cost of T4 is $160 per km, with a fuel efficiency of 8 km/liter and a maintenance cost of $800 per month.\nThe operational cost of T5 is $180 per km, with a fuel efficiency of 9 km/liter and a maintenance cost of $900 per month.\nThe company wants to minimize the total monthly operational cost, considering both fuel and maintenance costs.\n// Cost_T1 = 100 * distance_T1 / 5 + 500 * T1\n// Cost_T2 = 120 * distance_T2 / 6 + 600 * T2\n// Cost_T3 = 140 * distance_T3 / 7 + 700 * T3\n// Cost_T4 = 160 * distance_T4 / 8 + 800 * T4\n// Cost_T5 = 180 * distance_T5 / 9 + 900 * T5\n// So, the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n## Generate Constraint-1:\nThe total cargo capacity required is 5000 tons, and T1, T2, T3, T4, and T5 can carry 100, 200, 300, 400, and 500 tons respectively.\n// 100 * T1 + 200 * T2 + 300 * T3 + 400 * T4 + 500 * T5 >= 5000\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for monthly operational costs.\n// (100 * distance_T1 / 5 + 500 * T1) + (120 * distance_T2 / 6 + 600 * T2) + (140 * distance_T3 / 7 + 700 * T3) + (160 * distance_T4 / 8 + 800 * T4) + (180 * distance_T5 / 9 + 900 * T5) <= 100000\n\n## Generate Constraint-3:\nThe company has a limit of 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-4:\nThe market demand for T1 is 5 trucks. So, the company can only operate a maximum of 5 trucks of T1.\n// T1 <= 5\n\n## Generate Constraint-5:\nThe fuel efficiency constraint requires that the average fuel efficiency of all trucks is at least 7 km/liter.\n// (5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) / (T1 + T2 + T3 + T4 + T5) >= 7",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has different operational costs, fuel efficiency, and cargo capacity. The company needs to determine the optimal number of each type of truck to minimize the total operational cost while meeting the cargo delivery requirements. The details of each truck are given in the following Table.\n\n| Truck Type | Operational Cost per km | Fuel Efficiency (km/liter) | Maintenance Cost per Month | Cargo Capacity (tons) |\n|------------|-------------------------|----------------------------|----------------------------|-----------------------|\n| T1         | $100                    | 5                          | $500                       | 100                   |\n| T2         | $120                    | 6                          | $600                       | 200                   |\n| T3         | $140                    | 7                          | $700                       | 300                   |\n| T4         | $160                    | 8                          | $800                       | 400                   |\n| T5         | $180                    | 9                          | $900                       | 500                   |\n\nThe company has a total cargo capacity requirement of 5000 tons. The company has a budget of $100,000 for monthly operational costs. The company can operate a maximum of 50 trucks in total. The market demand for T1 is 5 trucks, so the company can only operate a maximum of 5 trucks of T1. The fuel efficiency constraint requires that the average fuel efficiency of all trucks is at least 7 km/liter.\n\nPlease help the company to minimize the total monthly operational cost, considering both fuel and maintenance costs, while meeting all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T1 = 100 * model.addVar(name=\"distance_T1\") / 5 + 500 * T1\nCost_T2 = 120 * model.addVar(name=\"distance_T2\") / 6 + 600 * T2\nCost_T3 = 140 * model.addVar(name=\"distance_T3\") / 7 + 700 * T3\nCost_T4 = 160 * model.addVar(name=\"distance_T4\") / 8 + 800 * T4\nCost_T5 = 180 * model.addVar(name=\"distance_T5\") / 9 + 900 * T5\n## the objective function is: Minimize (Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\nmodel.addCons(obj == Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5)\n\n# Add constraints\n## The total cargo capacity required is 5000 tons\nmodel.addCons(100 * T1 + 200 * T2 + 300 * T3 + 400 * T4 + 500 * T5 >= 5000)\n## The company has a budget of $100,000 for monthly operational costs\nmodel.addCons(Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5 <= 100000)\n## The company has a limit of 50 trucks in total\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The market demand for T1 is 5 trucks\nmodel.addCons(T1 <= 5)\n## The fuel efficiency constraint requires that the average fuel efficiency of all trucks is at least 7 km/liter\nmodel.addCons((5 * T1 + 6 * T2 + 7 * T3 + 8 * T4 + 9 * T5) / (T1 + T2 + T3 + T4 + T5) >= 7)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1799,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives for ProductA\": \"SalesRepsA\", \"range\": \"SalesRepsA >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductB\": \"SalesRepsB\", \"range\": \"SalesRepsB >= 0\", \"type\": \"integer\"}\n// {\"number of sales representatives for ProductC\": \"SalesRepsC\", \"range\": \"SalesRepsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives. The revenue function is nonlinear and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\n// Total revenue for ProductB: RevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\n// Total revenue for ProductC: RevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe total marketing budget for all products cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the marketing budget for each product, and the number of sales representatives assigned to each product. The marketing budget affects the sales of each product, and the number of sales representatives directly influences the sales efficiency. The revenue from each product is influenced by the production quantity, the marketing budget, and the number of sales representatives, and is given by: Revenue = ProductionQuantity * (1 + 0.01 * MarketingBudget) * (1 + 0.02 * SalesReps). The company aims to maximize the total revenue from all products. The total marketing budget for all products cannot exceed $100,000. Please help the company to determine the optimal production quantity, marketing budget, and number of sales representatives for each product to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0)  # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0)  # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0)  # marketing budget for ProductC\nSalesRepsA = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsA\", lb=0)  # number of sales representatives for ProductA\nSalesRepsB = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsB\", lb=0)  # number of sales representatives for ProductB\nSalesRepsC = model.addVar(vtype=\"INTEGER\", name=\"SalesRepsC\", lb=0)  # number of sales representatives for ProductC\n\n# Define objective function\nRevenueA = QuantityA * (1 + 0.01 * MarketingBudgetA) * (1 + 0.02 * SalesRepsA)\nRevenueB = QuantityB * (1 + 0.01 * MarketingBudgetB) * (1 + 0.02 * SalesRepsB)\nRevenueC = QuantityC * (1 + 0.01 * MarketingBudgetC) * (1 + 0.02 * SalesRepsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Number of Sales Reps for ProductA: \", model.getVal(SalesRepsA))\n    print(\"Number of Sales Reps for ProductB: \", model.getVal(SalesRepsB))\n    print(\"Number of Sales Reps for ProductC: \", model.getVal(SalesRepsC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: CityA, CityB, CityC, CityD, and CityE. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for CityA route\": \"Trucks_CityA\", \"range\": \"Trucks_CityA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB route\": \"Trucks_CityB\", \"range\": \"Trucks_CityB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC route\": \"Trucks_CityC\", \"range\": \"Trucks_CityC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD route\": \"Trucks_CityD\", \"range\": \"Trucks_CityD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityE route\": \"Trucks_CityE\", \"range\": \"Trucks_CityE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For CityA, the fuel consumption per truck is 100 liters, and the travel time is 5 hours. For CityB, the fuel consumption per truck is 120 liters, and the travel time is 6 hours. For CityC, the fuel consumption per truck is 150 liters, and the travel time is 7 hours. For CityD, the fuel consumption per truck is 130 liters, and the travel time is 8 hours. For CityE, the fuel consumption per truck is 140 liters, and the travel time is 9 hours. The company wants to minimize the total fuel consumption and travel time.\n// Fuel_CityA = 100 * Trucks_CityA^1.2\n// Fuel_CityB = 120 * Trucks_CityB^1.2\n// Fuel_CityC = 150 * Trucks_CityC^1.2\n// Fuel_CityD = 130 * Trucks_CityD^1.2\n// Fuel_CityE = 140 * Trucks_CityE^1.2\n// Time_CityA = 5 * Trucks_CityA^0.8\n// Time_CityB = 6 * Trucks_CityB^0.8\n// Time_CityC = 7 * Trucks_CityC^0.8\n// Time_CityD = 8 * Trucks_CityD^0.8\n// Time_CityE = 9 * Trucks_CityE^0.8\n// So, the objective function is: Minimize (Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE + Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks_CityA + Trucks_CityB + Trucks_CityC + Trucks_CityD + Trucks_CityE <= 50\n\n## Generate Constraint-2:\nDue to road capacity limitations, the number of trucks on the CityC route must not exceed the number on the CityA route by more than 10.\n// Trucks_CityC - Trucks_CityA <= 10\n\n## Generate Constraint-3:\nThe company must ensure that at least 5 trucks are allocated to each route.\n// Trucks_CityA >= 5; Trucks_CityB >= 5; Trucks_CityC >= 5; Trucks_CityD >= 5; Trucks_CityE >= 5\n\n## Generate Constraint-4:\nThe total travel time across all routes must not exceed 200 hours.\n// Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE <= 200\n\n## Generate Constraint-5:\nThe total fuel consumption across all routes must not exceed 5000 liters.\n// Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE <= 5000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for delivering goods to five different cities: CityA, CityB, CityC, CityD, and CityE. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time. The fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For CityA, the fuel consumption per truck is 100 liters, and the travel time is 5 hours. For CityB, the fuel consumption per truck is 120 liters, and the travel time is 6 hours. For CityC, the fuel consumption per truck is 150 liters, and the travel time is 7 hours. For CityD, the fuel consumption per truck is 130 liters, and the travel time is 8 hours. For CityE, the fuel consumption per truck is 140 liters, and the travel time is 9 hours. The company has a total of 50 trucks available for allocation. Due to road capacity limitations, the number of trucks on the CityC route must not exceed the number on the CityA route by more than 10. The company must ensure that at least 5 trucks are allocated to each route. The total travel time across all routes must not exceed 200 hours. The total fuel consumption across all routes must not exceed 5000 liters. Please help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_CityA = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityA\", lb=5)\nTrucks_CityB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityB\", lb=5)\nTrucks_CityC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityC\", lb=5)\nTrucks_CityD = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityD\", lb=5)\nTrucks_CityE = model.addVar(vtype=\"INTEGER\", name=\"Trucks_CityE\", lb=5)\n\n# Define objective function\n# Nonlinear functions approximated using piecewise linearization\n# Fuel consumption\nFuel_CityA = model.addVar(name=\"Fuel_CityA\")\nFuel_CityB = model.addVar(name=\"Fuel_CityB\")\nFuel_CityC = model.addVar(name=\"Fuel_CityC\")\nFuel_CityD = model.addVar(name=\"Fuel_CityD\")\nFuel_CityE = model.addVar(name=\"Fuel_CityE\")\n# Travel time\nTime_CityA = model.addVar(name=\"Time_CityA\")\nTime_CityB = model.addVar(name=\"Time_CityB\")\nTime_CityC = model.addVar(name=\"Time_CityC\")\nTime_CityD = model.addVar(name=\"Time_CityD\")\nTime_CityE = model.addVar(name=\"Time_CityE\")\n\n# Objective function\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE + Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE)\n\n# Add constraints\n# Total trucks constraint\nmodel.addCons(Trucks_CityA + Trucks_CityB + Trucks_CityC + Trucks_CityD + Trucks_CityE <= 50)\n# CityC vs CityA constraint\nmodel.addCons(Trucks_CityC - Trucks_CityA <= 10)\n# Minimum trucks per route\nmodel.addCons(Trucks_CityA >= 5)\nmodel.addCons(Trucks_CityB >= 5)\nmodel.addCons(Trucks_CityC >= 5)\nmodel.addCons(Trucks_CityD >= 5)\nmodel.addCons(Trucks_CityE >= 5)\n# Total travel time constraint\nmodel.addCons(Time_CityA + Time_CityB + Time_CityC + Time_CityD + Time_CityE <= 200)\n# Total fuel consumption constraint\nmodel.addCons(Fuel_CityA + Fuel_CityB + Fuel_CityC + Fuel_CityD + Fuel_CityE <= 5000)\n\n# Define nonlinear relationships\n# Fuel consumption\nmodel.addCons(Fuel_CityA == 100 * Trucks_CityA**1.2)\nmodel.addCons(Fuel_CityB == 120 * Trucks_CityB**1.2)\nmodel.addCons(Fuel_CityC == 150 * Trucks_CityC**1.2)\nmodel.addCons(Fuel_CityD == 130 * Trucks_CityD**1.2)\nmodel.addCons(Fuel_CityE == 140 * Trucks_CityE**1.2)\n# Travel time\nmodel.addCons(Time_CityA == 5 * Trucks_CityA**0.8)\nmodel.addCons(Time_CityB == 6 * Trucks_CityB**0.8)\nmodel.addCons(Time_CityC == 7 * Trucks_CityC**0.8)\nmodel.addCons(Time_CityD == 8 * Trucks_CityD**0.8)\nmodel.addCons(Time_CityE == 9 * Trucks_CityE**0.8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(Trucks_CityA))\n    print(\"Number of Trucks for CityB: \", model.getVal(Trucks_CityB))\n    print(\"Number of Trucks for CityC: \", model.getVal(Trucks_CityC))\n    print(\"Number of Trucks for CityD: \", model.getVal(Trucks_CityD))\n    print(\"Number of Trucks for CityE: \", model.getVal(Trucks_CityE))\n    print(\"Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1320,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, given by:\nCost_A = 1000 + 0.01 * (ProductA^2)\nCost_B = 1500 + 0.015 * (ProductB^2)\nCost_C = 1200 + 0.012 * (ProductC^2)\nCost_D = 1800 + 0.018 * (ProductD^2)\nCost_E = 2000 + 0.02 * (ProductE^2)\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\n// Total Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E.\n// ProductA >= 10\n// ProductB >= 15\n// ProductC >= 12\n// ProductD >= 20\n// ProductE >= 25\n\n## Generate Constraint-3:\nThe raw material for Product D is limited, and no more than 300 units of Product D can be produced.\n// ProductD <= 300",
        "question": "A manufacturing company produces five different products (Product A, Product B, Product C, Product D, and Product E) using a complex production process. The profit per unit for Product A is $50, for Product B is $70, for Product C is $60, for Product D is $80, and for Product E is $90. The production cost for each product is a nonlinear function of the amount produced, given by:\nCost_A = 1000 + 0.01 * (ProductA^2)\nCost_B = 1500 + 0.015 * (ProductB^2)\nCost_C = 1200 + 0.012 * (ProductC^2)\nCost_D = 1800 + 0.018 * (ProductD^2)\nCost_E = 2000 + 0.02 * (ProductE^2)\nThe company aims to maximize its total profit, which is the sum of the profits from each product minus the production costs.\nThe total production capacity of the factory is limited to 1000 units across all products. The company has a minimum order requirement for each product: at least 10 units of Product A, 15 units of Product B, 12 units of Product C, 20 units of Product D, and 25 units of Product E. The raw material for Product D is limited, and no more than 300 units of Product D can be produced.\nPlease help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=10) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=15) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=12) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=20, ub=300) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=25) # amount of Product E produced\n\n# Define objective function\nCost_A = 1000 + 0.01 * (ProductA**2)\nCost_B = 1500 + 0.015 * (ProductB**2)\nCost_C = 1200 + 0.012 * (ProductC**2)\nCost_D = 1800 + 0.018 * (ProductD**2)\nCost_E = 2000 + 0.02 * (ProductE**2)\nTotalProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE) - (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can handle is limited to 500 per day.\n// SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500\n\n## Generate Constraint-3:\nEach Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day.\n// SmallTrips <= 3; MediumTrips <= 4; LargeTrips <= 5\n\n## Generate Constraint-4:\nThe company must operate at least 5 Small trucks, 10 Medium trucks, and 8 Large trucks.\n// SmallTrucks >= 5; MediumTrucks >= 10; LargeTrucks >= 8",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip. The operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency.\n\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades. The total number of trips the company can handle is limited to 500 per day. Each Small truck can make at most 3 trips per day, each Medium truck can make at most 4 trips per day, and each Large truck can make at most 5 trips per day. The company must operate at least 5 Small trucks, 10 Medium trucks, and 8 Large trucks.\n\nPlease help the company to minimize the total operational cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=5)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=10)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=8)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0, ub=3)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0, ub=4)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0, ub=5)\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\nmodel.addCons(SmallTrucks * SmallTrips + MediumTrucks * MediumTrips + LargeTrucks * LargeTrips <= 500)\nmodel.addCons(SmallTrips <= 3)\nmodel.addCons(MediumTrips <= 4)\nmodel.addCons(LargeTrips <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and delivery speed. \n- Truck 1 consumes 10 liters per trip and delivers in 2 hours.\n- Truck 2 consumes 12 liters per trip and delivers in 1.5 hours.\n- Truck 3 consumes 15 liters per trip and delivers in 1 hour.\n- Truck 4 consumes 18 liters per trip and delivers in 1.2 hours.\n- Truck 5 consumes 20 liters per trip and delivers in 0.8 hours.\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour.\n// Total fuel cost: FuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\n// Total delay time: DelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\n// Total operational cost: OperationalCost = FuelCost + DelayTime * $50\n// So, the objective function is: Minimize OperationalCost\n\n## Generate Constraint-1:\nThe total number of trips required across all trucks must be at least 100.\n// T1 + T2 + T3 + T4 + T5 >= 100\n\n## Generate Constraint-2:\nEach truck can make a maximum of 30 trips due to maintenance and driver availability.\n// T1 <= 30; T2 <= 30; T3 <= 30; T4 <= 30; T5 <= 30",
        "question": "A logistics company operates a fleet of 5 trucks to deliver goods across different regions. The company needs to optimize the fuel consumption and delivery times based on the number of trips each truck makes. The fuel consumption and delivery times for each truck are given in the following Table.\n\n| Truck | Fuel Consumption (liters/trip) | Delivery Time (hours/trip) |\n|-------|--------------------------------|----------------------------|\n| 1     | 10                             | 2                          |\n| 2     | 12                             | 1.5                        |\n| 3     | 15                             | 1                          |\n| 4     | 18                             | 1.2                        |\n| 5     | 20                             | 0.8                        |\n\nThe company aims to minimize the total operational cost, which is the sum of fuel costs and the cost of delayed deliveries. The cost of delayed delivery is calculated as the product of the total delay time and a fixed rate of $50 per hour. The total number of trips required across all trucks must be at least 100. Each truck can make a maximum of 30 trips due to maintenance and driver availability.\n\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trips for truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = 10 * T1 + 12 * T2 + 15 * T3 + 18 * T4 + 20 * T5\nDelayTime = 2 * T1 + 1.5 * T2 + 1 * T3 + 1.2 * T4 + 0.8 * T5\nOperationalCost = FuelCost + DelayTime * 50\n## the objective function is: Minimize OperationalCost\nmodel.addCons(obj == OperationalCost)\n\n# Add constraints\n## The total number of trips required across all trucks must be at least 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 >= 100)\n## Each truck can make a maximum of 30 trips due to maintenance and driver availability.\nmodel.addCons(T1 <= 30)\nmodel.addCons(T2 <= 30)\nmodel.addCons(T3 <= 30)\nmodel.addCons(T4 <= 30)\nmodel.addCons(T5 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency upgrades for each truck type.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for each truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost.\n// Fuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\n// Fuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\n// Fuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\n// Fuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\n// Fuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100\n\n## Generate Constraint-2:\nThe total budget for fuel efficiency upgrades is $10,000.\n// FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) <= 10,000",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency upgrades for each truck type. The cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost. The company has a total of 100 trucks available and a total budget for fuel efficiency upgrades of $10,000. Please help the company to determine the optimal allocation of trucks and the appropriate fuel efficiency upgrades to minimize the total daily fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Region E\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0) # fuel efficiency upgrade for each truck\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\nFuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\nFuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\nFuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\nFuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n## the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100)\n## The total budget for fuel efficiency upgrades is $10,000.\nmodel.addCons(FuelUpgrade * (Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E) <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Fuel Efficiency Upgrade: \", model.getVal(FuelUpgrade))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company needs to minimize the total daily operational cost and fuel consumption.\n// Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n// Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n// So, the objective function is: Minimize (Cost + Fuel)\n\n## Generate Constraint-1:\nThe company has a daily demand of 1000 km of transportation.\n// 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company can only afford to operate a maximum of 20 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 20\n\n## Generate Constraint-3:\nThe number of type 1 trucks cannot exceed 5.\n// T1 <= 5\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 2.\n// T5 >= 2\n\n## Generate Constraint-5:\nThe total operational cost should not exceed $3000 per day.\n// 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 <= 3000",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. The company needs to determine the optimal number of each type of truck to minimize fuel consumption and operational costs while meeting the demand for transportation. Each type of truck has a different fuel efficiency and operational cost. Type 1 trucks consume 5 liters per km and cost $100 per day to operate. Type 2 trucks consume 4 liters per km and cost $120 per day to operate. Type 3 trucks consume 3 liters per km and cost $150 per day to operate. Type 4 trucks consume 2.5 liters per km and cost $180 per day to operate. Type 5 trucks consume 2 liters per km and cost $200 per day to operate. The company has a daily demand of 1000 km of transportation. The company can only afford to operate a maximum of 20 trucks in total. The number of type 1 trucks cannot exceed 5. The number of type 5 trucks must be at least 2. The total operational cost should not exceed $3000 per day. Please help the company to minimize the total daily operational cost and fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of type 5 trucks\n\n# Define objective function\n## Total fuel consumption: Fuel = 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5\n## Total operational cost: Cost = 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5\n## So, the objective function is: Minimize (Cost + Fuel)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 + 5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5)\n\n# Add constraints\n## The company has a daily demand of 1000 km of transportation.\nmodel.addCons(5 * T1 + 4 * T2 + 3 * T3 + 2.5 * T4 + 2 * T5 >= 1000)\n## The company can only afford to operate a maximum of 20 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 20)\n## The number of type 1 trucks cannot exceed 5.\nmodel.addCons(T1 <= 5)\n## The number of type 5 trucks must be at least 2.\nmodel.addCons(T5 >= 2)\n## The total operational cost should not exceed $3000 per day.\nmodel.addCons(100 * T1 + 120 * T2 + 150 * T3 + 180 * T4 + 200 * T5 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Total Cost and Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their profit and resource usage.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The production cost per unit for each device is a percentage of its selling price, which increases nonlinearly with the production quantity. Specifically, the cost function is defined as: Cost = Selling Price * (1 + 0.01 * sqrt(Quantity)). The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Profit_A = 10 * A - 10 * A * (1 + 0.01 * sqrt(A))\n// Profit_B = 15 * B - 15 * B * (1 + 0.01 * sqrt(B))\n// Profit_C = 20 * C - 20 * C * (1 + 0.01 * sqrt(C))\n// Profit_D = 25 * D - 25 * D * (1 + 0.01 * sqrt(D))\n// Profit_E = 30 * E - 30 * E * (1 + 0.01 * sqrt(E))\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a limited budget of $5000 for production costs.\n// 10 * A * (1 + 0.01 * sqrt(A)) + 15 * B * (1 + 0.01 * sqrt(B)) + 20 * C * (1 + 0.01 * sqrt(C)) + 25 * D * (1 + 0.01 * sqrt(D)) + 30 * E * (1 + 0.01 * sqrt(E)) <= 5000\n\n## Generate Constraint-2:\nThe company has a production capacity of 200 units in total.\n// A + B + C + D + E <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of device E does not exceed 20% of the total production.\n// E <= 0.2 * (A + B + C + D + E)\n\n## Generate Constraint-4:\nThe company wants to produce at least 10 units of each device.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of device D does not exceed the combined production of devices A and B.\n// D <= A + B",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their profit and resource usage. The profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The production cost per unit for each device is a percentage of its selling price, which increases nonlinearly with the production quantity. Specifically, the cost function is defined as: Cost = Selling Price * (1 + 0.01 * sqrt(Quantity)). The company aims to maximize the total profit, which is the difference between the total revenue and the total cost. The company has a limited budget of $5000 for production costs. The company has a production capacity of 200 units in total. The company wants to ensure that the production of device E does not exceed 20% of the total production. The company wants to produce at least 10 units of each device. The company wants to ensure that the production of device D does not exceed the combined production of devices A and B. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # quantity of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Define the profit functions with sqrt approximation\n# Approximating sqrt(A) with a piecewise linear function\nsqrt_A = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_A\")\nmodel.addCons(sqrt_A * sqrt_A <= A)\nmodel.addCons(sqrt_A >= 0)\nProfit_A = 10 * A - 10 * A * (1 + 0.01 * sqrt_A)\n\n# Similar approximations for other devices\nsqrt_B = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_B\")\nmodel.addCons(sqrt_B * sqrt_B <= B)\nmodel.addCons(sqrt_B >= 0)\nProfit_B = 15 * B - 15 * B * (1 + 0.01 * sqrt_B)\n\nsqrt_C = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_C\")\nmodel.addCons(sqrt_C * sqrt_C <= C)\nmodel.addCons(sqrt_C >= 0)\nProfit_C = 20 * C - 20 * C * (1 + 0.01 * sqrt_C)\n\nsqrt_D = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_D\")\nmodel.addCons(sqrt_D * sqrt_D <= D)\nmodel.addCons(sqrt_D >= 0)\nProfit_D = 25 * D - 25 * D * (1 + 0.01 * sqrt_D)\n\nsqrt_E = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_E\")\nmodel.addCons(sqrt_E * sqrt_E <= E)\nmodel.addCons(sqrt_E >= 0)\nProfit_E = 30 * E - 30 * E * (1 + 0.01 * sqrt_E)\n\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a limited budget of $5000 for production costs.\nmodel.addCons(10 * A * (1 + 0.01 * sqrt_A) + 15 * B * (1 + 0.01 * sqrt_B) + 20 * C * (1 + 0.01 * sqrt_C) + 25 * D * (1 + 0.01 * sqrt_D) + 30 * E * (1 + 0.01 * sqrt_E) <= 5000)\n\n## The company has a production capacity of 200 units in total.\nmodel.addCons(A + B + C + D + E <= 200)\n\n## The company wants to ensure that the production of device E does not exceed 20% of the total production.\nmodel.addCons(E <= 0.2 * (A + B + C + D + E))\n\n## The company wants to produce at least 10 units of each device.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\nmodel.addCons(D >= 10)\nmodel.addCons(E >= 10)\n\n## The company wants to ensure that the production of device D does not exceed the combined production of devices A and B.\nmodel.addCons(D <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit.\n// {\"raw materials for production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 4\": \"R4\", \"range\": \"R4 >= 0\", \"type\": \"real\"}\n// {\"raw materials for production line 5\": \"R5\", \"range\": \"R5 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 4\": \"L4\", \"range\": \"L4 >= 0\", \"type\": \"real\"}\n// {\"labor hours for production line 5\": \"L5\", \"range\": \"L5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency and profit margin per unit of product. The profit function is nonlinear due to economies of scale and varying efficiency rates.\n// Profit from production line 1: P1 = 100 * R1^0.5 * L1^0.6\n// Profit from production line 2: P2 = 120 * R2^0.4 * L2^0.7\n// Profit from production line 3: P3 = 130 * R3^0.3 * L3^0.8\n// Profit from production line 4: P4 = 110 * R4^0.5 * L4^0.6\n// Profit from production line 5: P5 = 140 * R5^0.4 * L5^0.7\n// The objective function is: Maximize Total Profit = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nTotal raw materials available are 1000 units.\n// R1 + R2 + R3 + R4 + R5 <= 1000\n\n## Generate Constraint-2:\nTotal labor hours available are 800 hours.\n// L1 + L2 + L3 + L4 + L5 <= 800\n\n## Generate Constraint-3:\nEach production line can use a maximum of 200 units of raw materials.\n// R1 <= 200; R2 <= 200; R3 <= 200; R4 <= 200; R5 <= 200\n\n## Generate Constraint-4:\nEach production line can utilize a maximum of 150 labor hours.\n// L1 <= 150; L2 <= 150; L3 <= 150; L4 <= 150; L5 <= 150",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of raw materials and labor hours across its 5 production lines to maximize profit. The profit function for each production line is nonlinear due to economies of scale and varying efficiency rates. The profit from each production line is given in the following Table.\n\n| Production Line | Profit Function |\n|-----------------|-----------------|\n| 1               | 100 * R1^0.5 * L1^0.6 |\n| 2               | 120 * R2^0.4 * L2^0.7 |\n| 3               | 130 * R3^0.3 * L3^0.8 |\n| 4               | 110 * R4^0.5 * L4^0.6 |\n| 5               | 140 * R5^0.4 * L5^0.7 |\n\nThe company has a total of 1000 units of raw materials and 800 labor hours available. Each production line can use a maximum of 200 units of raw materials and utilize a maximum of 150 labor hours. \n\nPlease help the company to maximize the total profit by determining the optimal allocation of raw materials (R1, R2, R3, R4, R5) and labor hours (L1, L2, L3, L4, L5) for each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # raw materials for production line 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # raw materials for production line 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # raw materials for production line 3\nR4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R4\", lb=0) # raw materials for production line 4\nR5 = model.addVar(vtype=\"CONTINUOUS\", name=\"R5\", lb=0) # raw materials for production line 5\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for production line 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for production line 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for production line 3\nL4 = model.addVar(vtype=\"CONTINUOUS\", name=\"L4\", lb=0) # labor hours for production line 4\nL5 = model.addVar(vtype=\"CONTINUOUS\", name=\"L5\", lb=0) # labor hours for production line 5\n\n# Define objective function\nP1 = 100 * R1**0.5 * L1**0.6\nP2 = 120 * R2**0.4 * L2**0.7\nP3 = 130 * R3**0.3 * L3**0.8\nP4 = 110 * R4**0.5 * L4**0.6\nP5 = 140 * R5**0.4 * L5**0.7\nTotal_Profit = P1 + P2 + P3 + P4 + P5\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 + R4 + R5 <= 1000) # Total raw materials available are 1000 units.\nmodel.addCons(L1 + L2 + L3 + L4 + L5 <= 800) # Total labor hours available are 800 hours.\nmodel.addCons(R1 <= 200) # Each production line can use a maximum of 200 units of raw materials.\nmodel.addCons(R2 <= 200)\nmodel.addCons(R3 <= 200)\nmodel.addCons(R4 <= 200)\nmodel.addCons(R5 <= 200)\nmodel.addCons(L1 <= 150) # Each production line can utilize a maximum of 150 labor hours.\nmodel.addCons(L2 <= 150)\nmodel.addCons(L3 <= 150)\nmodel.addCons(L4 <= 150)\nmodel.addCons(L5 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for production line 1: \", model.getVal(R1))\n    print(\"Raw materials for production line 2: \", model.getVal(R2))\n    print(\"Raw materials for production line 3: \", model.getVal(R3))\n    print(\"Raw materials for production line 4: \", model.getVal(R4))\n    print(\"Raw materials for production line 5: \", model.getVal(R5))\n    print(\"Labor hours for production line 1: \", model.getVal(L1))\n    print(\"Labor hours for production line 2: \", model.getVal(L2))\n    print(\"Labor hours for production line 3: \", model.getVal(L3))\n    print(\"Labor hours for production line 4: \", model.getVal(L4))\n    print(\"Labor hours for production line 5: \", model.getVal(L5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance.\n// {\"number of solar panels in Zone A\": \"SA\", \"range\": \"SA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone B\": \"SB\", \"range\": \"SB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone C\": \"SC\", \"range\": \"SC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone D\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone E\": \"SE\", \"range\": \"SE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. In Zone A, each panel produces 100 kWh with a cost of $500 per panel. In Zone B, each panel produces 120 kWh with a cost of $550 per panel. In Zone C, each panel produces 110 kWh with a cost of $520 per panel. In Zone D, each panel produces 90 kWh with a cost of $480 per panel. In Zone E, each panel produces 130 kWh with a cost of $600 per panel. The city aims to maximize the total energy production while minimizing the total cost of installation and maintenance.\n// Total energy production: Energy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\n// Total cost: Cost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n// So, the objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation and maintenance of solar panels.\n// 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all zones is limited to 200.\n// SA + SB + SC + SD + SE <= 200\n\n## Generate Constraint-3:\nAt least 30 solar panels must be installed in Zone A.\n// SA >= 30\n\n## Generate Constraint-4:\nNo more than 50 solar panels can be installed in any single zone.\n// SA <= 50; SB <= 50; SC <= 50; SD <= 50; SE <= 50",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone A, Zone B, Zone C, Zone D, and Zone E) to maximize energy production while minimizing the cost of installation and maintenance. The efficiency of solar panels varies by zone due to different sunlight exposure and weather conditions. The details of energy production and cost per panel for each zone are given in the following Table.\n\n| Zone | Energy Production per Panel (kWh) | Cost per Panel ($) |\n|------|-----------------------------------|--------------------|\n| A    | 100                               | 500                |\n| B    | 120                               | 550                |\n| C    | 110                               | 520                |\n| D    | 90                                | 480                |\n| E    | 130                               | 600                |\n\nThe city has a budget of $100,000 for the installation and maintenance of solar panels. The total number of solar panels that can be installed across all zones is limited to 200. At least 30 solar panels must be installed in Zone A. No more than 50 solar panels can be installed in any single zone.\n\nPlease help the city to maximize the total energy production while minimizing the total cost of installation and maintenance.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSA = model.addVar(vtype=\"INTEGER\", name=\"SA\", lb=30, ub=50) # number of solar panels in Zone A\nSB = model.addVar(vtype=\"INTEGER\", name=\"SB\", lb=0, ub=50) # number of solar panels in Zone B\nSC = model.addVar(vtype=\"INTEGER\", name=\"SC\", lb=0, ub=50) # number of solar panels in Zone C\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0, ub=50) # number of solar panels in Zone D\nSE = model.addVar(vtype=\"INTEGER\", name=\"SE\", lb=0, ub=50) # number of solar panels in Zone E\n\n# Define objective function\nEnergy = 100 * SA + 120 * SB + 110 * SC + 90 * SD + 130 * SE\nCost = 500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE\n# So, the objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation and maintenance of solar panels.\nmodel.addCons(500 * SA + 550 * SB + 520 * SC + 480 * SD + 600 * SE <= 100000)\n# The total number of solar panels that can be installed across all zones is limited to 200.\nmodel.addCons(SA + SB + SC + SD + SE <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone A: \", model.getVal(SA))\n    print(\"Number of Solar Panels in Zone B: \", model.getVal(SB))\n    print(\"Number of Solar Panels in Zone C: \", model.getVal(SC))\n    print(\"Number of Solar Panels in Zone D: \", model.getVal(SD))\n    print(\"Number of Solar Panels in Zone E: \", model.getVal(SE))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company wants to minimize the total fuel cost while maximizing the total cargo carried.\n// FuelCost_A = 5 * TruckA * $2\n// FuelCost_B = 7 * TruckB * $2\n// FuelCost_C = 9 * TruckC * $2\n// CargoCarried_A = 10 * TruckA\n// CargoCarried_B = 15 * TruckB\n// CargoCarried_C = 20 * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for fuel costs.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000\n\n## Generate Constraint-3:\nThe company has a limit of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nThe market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\n// TruckA <= 50",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. The company needs to determine the number of each type of truck to maximize efficiency while meeting certain operational constraints. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The cost of fuel per liter is $2. The company has a total budget of $5000 for fuel costs. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a limit of 100 trucks in total. The market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\nPlease help the company to minimize the total fuel cost while maximizing the total cargo carried, with the objective function defined as the ratio of the total fuel cost to the total cargo carried.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_A = 5 * TruckA * 2\nFuelCost_B = 7 * TruckB * 2\nFuelCost_C = 9 * TruckC * 2\nCargoCarried_A = 10 * TruckA\nCargoCarried_B = 15 * TruckB\nCargoCarried_C = 20 * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C) / (CargoCarried_A + CargoCarried_B + CargoCarried_C)\n## convert the division to multiplication\nmodel.addCons(obj * (CargoCarried_A + CargoCarried_B + CargoCarried_C) == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The company has a total budget of $5000 for fuel costs.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 5000 / 2)\n## The total cargo capacity of all trucks should not exceed 1000 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 1000)\n## The company has a limit of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The market demand for Truck A is 50 units. So, the company can only operate a maximum of 50 units of Truck A.\nmodel.addCons(TruckA <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost per Ton: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trips each truck should make to different regions (Region1, Region2, Region3, Region4, Region5) and the fuel consumption rate for each trip, which varies based on the region and the load.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per trip to Region1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n// Revenue from Region1: Revenue1 = 1000 * Trips1\n// Revenue from Region2: Revenue2 = 1000 * Trips2\n// Revenue from Region3: Revenue3 = 1000 * Trips3\n// Revenue from Region4: Revenue4 = 1000 * Trips4\n// Revenue from Region5: Revenue5 = 1000 * Trips5\n// Fuel cost for Region1: FuelCost1 = FuelRate1^2 * Trips1\n// Fuel cost for Region2: FuelCost2 = FuelRate2^2 * Trips2\n// Fuel cost for Region3: FuelCost3 = FuelRate3^2 * Trips3\n// Fuel cost for Region4: FuelCost4 = FuelRate4^2 * Trips4\n// Fuel cost for Region5: FuelCost5 = FuelRate5^2 * Trips5\n// So, the objective function is: Maximize (Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5) - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// FuelRate1^2 * Trips1 + FuelRate2^2 * Trips2 + FuelRate3^2 * Trips3 + FuelRate4^2 * Trips4 + FuelRate5^2 * Trips5 <= 10000\n\n## Generate Constraint-3:\nDue to regional restrictions, the number of trips to Region3 must be at least twice the number of trips to Region1.\n// Trips3 >= 2 * Trips1",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of trips each truck should make to these regions and the fuel consumption rate for each trip, which varies based on the region and the load. The revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n\n| Region       | Revenue per Trip | Fuel Cost Formula |\n|--------------|------------------|-------------------|\n| Region1      | $1000            | FuelRate1^2       |\n| Region2      | $1000            | FuelRate2^2       |\n| Region3      | $1000            | FuelRate3^2       |\n| Region4      | $1000            | FuelRate4^2       |\n| Region5      | $1000            | FuelRate5^2       |\n\nThe total number of trips across all regions must not exceed 500. The company has a budget of $10,000 for fuel costs. Due to regional restrictions, the number of trips to Region3 must be at least twice the number of trips to Region1.\n\nPlease help the company to maximize its net profit by determining the optimal number of trips and fuel consumption rates for each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0)  # fuel consumption rate per trip to Region1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate per trip to Region2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate per trip to Region3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0)  # fuel consumption rate per trip to Region4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0)  # fuel consumption rate per trip to Region5\n\n# Define objective function\nRevenue1 = 1000 * Trips1\nRevenue2 = 1000 * Trips2\nRevenue3 = 1000 * Trips3\nRevenue4 = 1000 * Trips4\nRevenue5 = 1000 * Trips5\nFuelCost1 = FuelRate1**2 * Trips1\nFuelCost2 = FuelRate2**2 * Trips2\nFuelCost3 = FuelRate3**2 * Trips3\nFuelCost4 = FuelRate4**2 * Trips4\nFuelCost5 = FuelRate5**2 * Trips5\nNetProfit = Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5 - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(FuelRate1**2 * Trips1 + FuelRate2**2 * Trips2 + FuelRate3**2 * Trips3 + FuelRate4**2 * Trips4 + FuelRate5**2 * Trips5 <= 10000)\nmodel.addCons(Trips3 >= 2 * Trips1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of trips to Region5: \", model.getVal(Trips5))\n    print(\"Fuel consumption rate per trip to Region1: \", model.getVal(FuelRate1))\n    print(\"Fuel consumption rate per trip to Region2: \", model.getVal(FuelRate2))\n    print(\"Fuel consumption rate per trip to Region3: \", model.getVal(FuelRate3))\n    print(\"Fuel consumption rate per trip to Region4: \", model.getVal(FuelRate4))\n    print(\"Fuel consumption rate per trip to Region5: \", model.getVal(FuelRate5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1360,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to supplier limitations, the production of DeviceA must be at least twice the production of DeviceB. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 798,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different fuel consumption rates and delivery times. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The cost function is nonlinear due to varying fuel consumption rates and maintenance costs based on the number of trucks.\n// Fuel cost on route 1: F1 = 0.5 * T1^2\n// Fuel cost on route 2: F2 = 0.6 * T2^2\n// Fuel cost on route 3: F3 = 0.4 * T3^2\n// Fuel cost on route 4: F4 = 0.7 * T4^2\n// Fuel cost on route 5: F5 = 0.55 * T5^2\n// Fuel cost on route 6: F6 = 0.65 * T6^2\n// Maintenance cost: M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n// The objective function is: Minimize (F1 + F2 + F3 + F4 + F5 + F6 + M)\n// Minimize (0.5 * T1^2 + 0.6 * T2^2 + 0.4 * T3^2 + 0.7 * T4^2 + 0.55 * T5^2 + 0.65 * T6^2 + 1000 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 100\n\n## Generate Constraint-2:\nEach route can handle a maximum of 20 trucks.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20; T6 <= 20\n\n## Generate Constraint-3:\nThe total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\n// T1 + T3 + T5 >= 0.3 * (T1 + T2 + T3 + T4 + T5 + T6)",
        "question": "A logistics company operates 6 different routes for delivering goods. The company needs to determine the number of trucks to assign to each route to optimize delivery efficiency and cost. Each route has different fuel consumption rates and delivery times. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The cost function is nonlinear due to varying fuel consumption rates and maintenance costs based on the number of trucks. The company has a total of 100 trucks available. Each route can handle a maximum of 20 trucks. The total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\n\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trucks on route 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0, ub=20) # number of trucks on route 6\n\n# Define objective function\n## Fuel cost on route 1: F1 = 0.5 * T1^2\n## Fuel cost on route 2: F2 = 0.6 * T2^2\n## Fuel cost on route 3: F3 = 0.4 * T3^2\n## Fuel cost on route 4: F4 = 0.7 * T4^2\n## Fuel cost on route 5: F5 = 0.55 * T5^2\n## Fuel cost on route 6: F6 = 0.65 * T6^2\n## Maintenance cost: M = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\n## The objective function is: Minimize (F1 + F2 + F3 + F4 + F5 + F6 + M)\nF1 = 0.5 * T1**2\nF2 = 0.6 * T2**2\nF3 = 0.4 * T3**2\nF4 = 0.7 * T4**2\nF5 = 0.55 * T5**2\nF6 = 0.65 * T6**2\nM = 1000 * (T1 + T2 + T3 + T4 + T5 + T6)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5 + F6 + M)\n\n# Add constraints\n## The company has a total of 100 trucks available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 100)\n## Each route can handle a maximum of 20 trucks.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\nmodel.addCons(T4 <= 20)\nmodel.addCons(T5 <= 20)\nmodel.addCons(T6 <= 20)\n## The total number of trucks on routes 1, 3, and 5 must be at least 30% of the total number of trucks.\nmodel.addCons(T1 + T3 + T5 >= 0.3 * (T1 + T2 + T3 + T4 + T5 + T6))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Number of trucks on route 6: \", model.getVal(T6))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is given in the following Table.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| DeviceA | $50            |\n| DeviceB | $70            |\n| DeviceC | $90            |\n| DeviceD | $60            |\n| DeviceE | $80            |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to DeviceA production line\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceB production line\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"hours allocated to DeviceC production line\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (30 * HoursA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (40 * HoursB)\n// Total profit for DeviceC: Profit_C = (90 * UnitsC) - (50 * HoursC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available hours for all production lines is 1000 hours.\n// HoursA + HoursB + HoursC <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate to each production line. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The cost of production per hour for DeviceA is $30, for DeviceB is $40, and for DeviceC is $50. The production rate for DeviceA is 0.5 * HoursA^2, for DeviceB is 0.6 * HoursB^2, and for DeviceC is 0.7 * HoursC^2.\n\n| Device | Profit per Unit | Production Cost per Hour | Production Rate |\n|--------|-----------------|--------------------------|-----------------|\n| DeviceA | $50 | $30 | 0.5 * HoursA^2 |\n| DeviceB | $70 | $40 | 0.6 * HoursB^2 |\n| DeviceC | $90 | $50 | 0.7 * HoursC^2 |\n\nThe company aims to maximize the total profit, considering that the production rate of each device is not linear with respect to the hours allocated. The total available hours for all production lines is 1000 hours.\n\nPlease help the company determine the optimal number of units to produce for each device and the number of hours to allocate to each production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0)  # hours allocated to DeviceA production line\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0)  # hours allocated to DeviceB production line\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0)  # hours allocated to DeviceC production line\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (30 * HoursA)\nProfit_B = (70 * UnitsB) - (40 * HoursB)\nProfit_C = (90 * UnitsC) - (50 * HoursC)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursA + HoursB + HoursC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA units: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB units: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC units: \", model.getVal(UnitsC))\n    print(\"Hours allocated to DeviceA: \", model.getVal(HoursA))\n    print(\"Hours allocated to DeviceB: \", model.getVal(HoursB))\n    print(\"Hours allocated to DeviceC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries.\n// {\"number of trucks for destination A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for destination E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n// {\"fuel budget for destination A\": \"FuelBudgetA\", \"range\": \"FuelBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination B\": \"FuelBudgetB\", \"range\": \"FuelBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination C\": \"FuelBudgetC\", \"range\": \"FuelBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination D\": \"FuelBudgetD\", \"range\": \"FuelBudgetD >= 0\", \"type\": \"continuous\"}\n// {\"fuel budget for destination E\": \"FuelBudgetE\", \"range\": \"FuelBudgetE >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks. The cost increases at a decreasing rate as the fuel budget increases, reflecting economies of scale in fuel purchasing. The company aims to minimize the total fuel cost across all routes.\n// Fuel cost for destination A: CostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)^2)\n// Fuel cost for destination B: CostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)^2)\n// Fuel cost for destination C: CostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)^2)\n// Fuel cost for destination D: CostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)^2)\n// Fuel cost for destination E: CostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)^2)\n// So, the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\n\n## Generate Constraint-1:\nThe total fuel budget across all destinations must not exceed $100,000.\n// FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: A, B, C, D, and E. The company also needs to decide on the fuel budget for each route to minimize fuel costs while ensuring timely deliveries. The fuel cost for each route is a nonlinear function of the fuel budget and the number of trucks, where the cost increases at a decreasing rate as the fuel budget increases. The company aims to minimize the total fuel cost across all routes. The total fuel budget across all destinations must not exceed $100,000.\nPlease help the company determine the optimal number of trucks and fuel budgets for each destination to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0)\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0)\nFuelBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetA\", lb=0)\nFuelBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetB\", lb=0)\nFuelBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetC\", lb=0)\nFuelBudgetD = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetD\", lb=0)\nFuelBudgetE = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelBudgetE\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostA = (FuelBudgetA / TrucksA) * (1 + 0.1 * (FuelBudgetA / TrucksA)**2)\nCostB = (FuelBudgetB / TrucksB) * (1 + 0.1 * (FuelBudgetB / TrucksB)**2)\nCostC = (FuelBudgetC / TrucksC) * (1 + 0.1 * (FuelBudgetC / TrucksC)**2)\nCostD = (FuelBudgetD / TrucksD) * (1 + 0.1 * (FuelBudgetD / TrucksD)**2)\nCostE = (FuelBudgetE / TrucksE) * (1 + 0.1 * (FuelBudgetE / TrucksE)**2)\n## the objective function is: Minimize (CostA + CostB + CostC + CostD + CostE)\nmodel.addCons(obj == CostA + CostB + CostC + CostD + CostE)\n\n# Add constraints\n## The total fuel budget across all destinations must not exceed $100,000.\nmodel.addCons(FuelBudgetA + FuelBudgetB + FuelBudgetC + FuelBudgetD + FuelBudgetE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Destination A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Destination B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Destination C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Destination D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Destination E: \", model.getVal(TrucksE))\n    print(\"Fuel Budget for Destination A: \", model.getVal(FuelBudgetA))\n    print(\"Fuel Budget for Destination B: \", model.getVal(FuelBudgetB))\n    print(\"Fuel Budget for Destination C: \", model.getVal(FuelBudgetC))\n    print(\"Fuel Budget for Destination D: \", model.getVal(FuelBudgetD))\n    print(\"Fuel Budget for Destination E: \", model.getVal(FuelBudgetE))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines.\n// {\"number of trucks in Region 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel optimization for Region 1\": \"Fuel1\", \"range\": \"Fuel1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 2\": \"Fuel2\", \"range\": \"Fuel2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel optimization for Region 3\": \"Fuel3\", \"range\": \"Fuel3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost is a nonlinear function of the fuel optimization level and the number of trucks. The fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions.\n// Fuel cost for Region 1: Cost1 = Trucks1 * (100 - 0.5 * Fuel1^2)\n// Fuel cost for Region 2: Cost2 = Trucks2 * (120 - 0.6 * Fuel2^2)\n// Fuel cost for Region 3: Cost3 = Trucks3 * (110 - 0.4 * Fuel3^2)\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-2:\nThe maximum fuel optimization level for each region is capped at 10 units.\n// Fuel1 <= 10; Fuel2 <= 10; Fuel3 <= 10\n\n## Generate Constraint-3:\nDue to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n// Trucks1 >= 20; Trucks2 >= 30",
        "question": "A logistics company operates a fleet of trucks to transport goods across three regions. The company needs to determine the number of trucks to allocate to each region and the amount of fuel to optimize for each truck to minimize fuel costs while meeting delivery deadlines. The fuel cost per truck decreases as the fuel optimization level increases, but at a decreasing rate. The company aims to minimize the total fuel cost across all regions. The following table summarizes the fuel cost function for each region:\n\n| Region | Fuel Cost Function |\n|--------|--------------------|\n| 1      | Trucks1 * (100 - 0.5 * Fuel1^2) |\n| 2      | Trucks2 * (120 - 0.6 * Fuel2^2) |\n| 3      | Trucks3 * (110 - 0.4 * Fuel3^2) |\n\nThe total number of trucks available is 100. The maximum fuel optimization level for each region is capped at 10 units. Due to regional regulations, at least 20 trucks must be allocated to Region 1 and at least 30 trucks to Region 2.\n\nPlease help the company to determine the optimal number of trucks and fuel optimization levels for each region to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20)  # number of trucks in Region 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30)  # number of trucks in Region 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region 3\nFuel1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel1\", lb=0, ub=10)  # fuel optimization for Region 1\nFuel2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel2\", lb=0, ub=10)  # fuel optimization for Region 2\nFuel3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Fuel3\", lb=0, ub=10)  # fuel optimization for Region 3\n\n# Define objective function\nCost1 = Trucks1 * (100 - 0.5 * Fuel1**2)\nCost2 = Trucks2 * (120 - 0.6 * Fuel2**2)\nCost3 = Trucks3 * (110 - 0.4 * Fuel3**2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region 3: \", model.getVal(Trucks3))\n    print(\"Fuel Optimization for Region 1: \", model.getVal(Fuel1))\n    print(\"Fuel Optimization for Region 2: \", model.getVal(Fuel2))\n    print(\"Fuel Optimization for Region 3: \", model.getVal(Fuel3))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"investment in landscaping\": \"Landscaping\", \"range\": \"Landscaping >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer aims to maximize the total value of all properties.\n// Value_LV = 500000 + 10 * Landscaping * LV\n// Value_MA = 300000 + 5 * Landscaping * MA\n// Value_AH = 150000 + 2 * Landscaping * AH\n// So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\n\n## Generate Constraint-1:\nThe developer has a budget of $1,000,000 for construction and landscaping.\n// 500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000\n\n## Generate Constraint-2:\nThe total area available for construction is limited to 100,000 square meters. Each Luxury Villa requires 1,000 square meters, each Mid-Range Apartment requires 500 square meters, and each Affordable Home requires 200 square meters.\n// 1000 * LV + 500 * MA + 200 * AH <= 100000\n\n## Generate Constraint-3:\nThe developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n// LV >= 5; MA >= 10",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer also needs to determine the amount of money to invest in landscaping to enhance the property values. The value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer has a budget of $1,000,000 for construction and landscaping. The total area available for construction is limited to 100,000 square meters, with each Luxury Villa requiring 1,000 square meters, each Mid-Range Apartment requiring 500 square meters, and each Affordable Home requiring 200 square meters. The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments. Please help the developer maximize the total value of all properties.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=5)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0)  # number of Affordable Homes\nLandscaping = model.addVar(vtype=\"CONTINUOUS\", name=\"Landscaping\", lb=0)  # investment in landscaping\n\n# Define objective function\nValue_LV = 500000 * LV + 10 * Landscaping * LV\nValue_MA = 300000 * MA + 5 * Landscaping * MA\nValue_AH = 150000 * AH + 2 * Landscaping * AH\n# So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value_LV + Value_MA + Value_AH)\n\n# Add constraints\n# The developer has a budget of $1,000,000 for construction and landscaping.\nmodel.addCons(500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000)\n# The total area available for construction is limited to 100,000 square meters.\nmodel.addCons(1000 * LV + 500 * MA + 200 * AH <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Investment in Landscaping: \", model.getVal(Landscaping))\n    print(\"Total Property Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000\n\n## Generate Constraint-2:\nThe production rate from each machine should not be less than 10 units per hour.\n// Pi >= 10 for i = 1, 2, 3, 4, 5, 6\n\n## Generate Constraint-3:\nThe voltage applied to each machine should not exceed 120 units.\n// Vi <= 120 for i = 1, 2, 3, 4, 5, 6\n\n## Generate Constraint-4:\nThe voltage applied to each machine should be greater than 0.\n// Vi > 0 for i = 1, 2, 3, 4, 5, 6",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The voltage applied to each machine affects both its energy consumption and production rate, as shown in the following Table.\n\n| Machine | Voltage (V) | Energy Consumption (Ei) | Production Rate (Pi) |\n|---------|-------------|-------------------------|----------------------|\n| 1       | V1          | V1^2                    | 100 * V1 - V1^2/10   |\n| 2       | V2          | V2^2                    | 100 * V2 - V2^2/10   |\n| 3       | V3          | V3^2                    | 100 * V3 - V3^2/10   |\n| 4       | V4          | V4^2                    | 100 * V4 - V4^2/10   |\n| 5       | V5          | V5^2                    | 100 * V5 - V5^2/10   |\n| 6       | V6          | V6^2                    | 100 * V6 - V6^2/10   |\n\nThe total energy consumption should not exceed 15000 units. The production rate from each machine should not be less than 10 units per hour. The voltage applied to each machine should not exceed 120 units and should be greater than 0. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n\nPlease help the plant manager to determine the optimal voltage settings for each machine to achieve these goals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120) # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120) # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120) # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120) # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120) # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120) # voltage for machine 6\n\n# Define objective function\n## Energy consumption for machine i: Ei = Vi^2\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\n## Production rate for machine i: Pi = 100 * Vi - Vi^2/10\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\n## Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n## The total energy consumption should not exceed 15000 units.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 + E6 <= 15000)\n## The production rate from each machine should not be less than 10 units per hour.\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\nmodel.addCons(P4 >= 10)\nmodel.addCons(P5 >= 10)\nmodel.addCons(P6 >= 10)\n## Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\nmodel.addCons(P1 + P2 + P3 + P4 + P5 + P6 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1417,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter.\n// {\"number of units of machine M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine M5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Machine M1, the selling price is $10,000, the material cost is $5,000, and the production time is 10 hours. \nFor Machine M2, the selling price is $15,000, the material cost is $7,000, and the production time is 15 hours. \nFor Machine M3, the selling price is $20,000, the material cost is $9,000, and the production time is 20 hours.\nFor Machine M4, the selling price is $25,000, the material cost is $11,000, and the production time is 25 hours.\nFor Machine M5, the selling price is $30,000, the material cost is $13,000, and the production time is 30 hours.\nThe company aims to maximize the total profit while considering the efficiency of production time.\n// Profit of M1: Profit_M1 = (10,000 - 5,000) * M1\n// Profit of M2: Profit_M2 = (15,000 - 7,000) * M2\n// Profit of M3: Profit_M3 = (20,000 - 9,000) * M3\n// Profit of M4: Profit_M4 = (25,000 - 11,000) * M4\n// Profit of M5: Profit_M5 = (30,000 - 13,000) * M5\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / (10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for material costs for the quarter.\n// 5,000 * M1 + 7,000 * M2 + 9,000 * M3 + 11,000 * M4 + 13,000 * M5 <= 1,000,000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each machine in the next quarter.\n// M1 >= 5; M2 >= 5; M3 >= 5; M4 >= 5; M5 >= 5\n\n## Generate Constraint-3:\nThe company has a total of 10,000 hours available for production in the next quarter.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 <= 10,000",
        "question": "A manufacturing company produces five types of machines: M1, M2, M3, M4, and M5. The company needs to determine how many units of each machine to produce in the next quarter.\nFor Machine M1, the selling price is $10,000, the material cost is $5,000, and the production time is 10 hours. \nFor Machine M2, the selling price is $15,000, the material cost is $7,000, and the production time is 15 hours. \nFor Machine M3, the selling price is $20,000, the material cost is $9,000, and the production time is 20 hours.\nFor Machine M4, the selling price is $25,000, the material cost is $11,000, and the production time is 25 hours.\nFor Machine M5, the selling price is $30,000, the material cost is $13,000, and the production time is 30 hours.\nThe company has a budget of $1,000,000 for material costs for the quarter. The company wants to produce at least 5 units of each machine in the next quarter. The company has a total of 10,000 hours available for production in the next quarter.\nPlease help the company to maximize the total profit while considering the efficiency of production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each machine in the next quarter.\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=5) # number of units of machine M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=5) # number of units of machine M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=5) # number of units of machine M3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=5) # number of units of machine M4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=5) # number of units of machine M5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_M1 = (10000 - 5000) * M1\nProfit_M2 = (15000 - 7000) * M2\nProfit_M3 = (20000 - 9000) * M3\nProfit_M4 = (25000 - 11000) * M4\nProfit_M5 = (30000 - 13000) * M5\nProductionTime = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n## the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4 + Profit_M5)\n\n# Add constraints\n## The company has a budget of $1,000,000 for material costs for the quarter.\nmodel.addCons(5000 * M1 + 7000 * M2 + 9000 * M3 + 11000 * M4 + 13000 * M5 <= 1000000)\n## The company has a total of 10,000 hours available for production in the next quarter.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine M1: \", model.getVal(M1))\n    print(\"Number of Machine M2: \", model.getVal(M2))\n    print(\"Number of Machine M3: \", model.getVal(M3))\n    print(\"Number of Machine M4: \", model.getVal(M4))\n    print(\"Number of Machine M5: \", model.getVal(M5))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods across different distances. The company needs to determine the number of trips each vehicle should make to optimize fuel efficiency and minimize carbon emissions. Additionally, the company is considering investing in hybrid technology for each vehicle type, which affects fuel consumption and emissions.\n// {\"number of trips for Truck1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Truck3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"investment in hybrid technology for Truck1\": \"Hybrid1\", \"range\": \"Hybrid1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Truck2\": \"Hybrid2\", \"range\": \"Hybrid2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in hybrid technology for Truck3\": \"Hybrid3\", \"range\": \"Hybrid3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in hybrid technology. For every $1000 invested in hybrid technology for Truck1, fuel consumption decreases by 0.1 liters per kilometer. For Truck2, it decreases by 0.15 liters per kilometer, and for Truck3, it decreases by 0.2 liters per kilometer. The company aims to minimize total fuel consumption and carbon emissions, which are proportional to fuel consumption.\n// Fuel_Consumption_Truck1 = (Initial_Consumption - 0.0001 * Hybrid1) * Distance * Trips1\n// Fuel_Consumption_Truck2 = (Initial_Consumption - 0.00015 * Hybrid2) * Distance * Trips2\n// Fuel_Consumption_Truck3 = (Initial_Consumption - 0.0002 * Hybrid3) * Distance * Trips3\n// Total_Fuel_Consumption = Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3\n// So, the objective function is: Minimize Total_Fuel_Consumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for hybrid technology investments.\n// Hybrid1 + Hybrid2 + Hybrid3 <= 100000",
        "question": "A logistics company operates three types of vehicles: Truck1, Truck2, and Truck3, to transport goods across different distances. The company needs to determine the number of trips each vehicle should make and the investment in hybrid technology for each vehicle type to optimize fuel efficiency and minimize carbon emissions. The relationship between investment in hybrid technology and fuel consumption reduction for each vehicle is given in the following Table.\n\n| Vehicle | Hybrid Investment Impact (liters/km per $1000) |\n|---------|-----------------------------------------------|\n| Truck1  | 0.1                                           |\n| Truck2  | 0.15                                          |\n| Truck3  | 0.2                                           |\n\nThe company has a budget of $100,000 for hybrid technology investments. The company aims to minimize total fuel consumption and carbon emissions, which are proportional to fuel consumption. Please help the company determine the optimal number of trips for each vehicle and the appropriate investment in hybrid technology to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips for Truck1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips for Truck2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips for Truck3\nHybrid1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid1\", lb=0)  # investment in hybrid technology for Truck1\nHybrid2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid2\", lb=0)  # investment in hybrid technology for Truck2\nHybrid3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Hybrid3\", lb=0)  # investment in hybrid technology for Truck3\n\n# Define objective function\nFuel_Consumption_Truck1 = (model.addVar(name=\"Initial_Consumption\") - 0.0001 * Hybrid1) * model.addVar(name=\"Distance\") * Trips1\nFuel_Consumption_Truck2 = (model.addVar(name=\"Initial_Consumption\") - 0.00015 * Hybrid2) * model.addVar(name=\"Distance\") * Trips2\nFuel_Consumption_Truck3 = (model.addVar(name=\"Initial_Consumption\") - 0.0002 * Hybrid3) * model.addVar(name=\"Distance\") * Trips3\nTotal_Fuel_Consumption = Fuel_Consumption_Truck1 + Fuel_Consumption_Truck2 + Fuel_Consumption_Truck3\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption)\n\n# Add constraints\nmodel.addCons(Hybrid1 + Hybrid2 + Hybrid3 <= 100000)  # Budget constraint for hybrid technology investments\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Truck1: \", model.getVal(Trips1))\n    print(\"Number of Trips for Truck2: \", model.getVal(Trips2))\n    print(\"Number of Trips for Truck3: \", model.getVal(Trips3))\n    print(\"Investment in Hybrid Technology for Truck1: \", model.getVal(Hybrid1))\n    print(\"Investment in Hybrid Technology for Truck2: \", model.getVal(Hybrid2))\n    print(\"Investment in Hybrid Technology for Truck3: \", model.getVal(Hybrid3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. The company aims to maximize the total profit, but due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company wants to maximize the total profit from selling these devices.\n// Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\n// Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\n// Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\n// Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\n// Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs. The cost per unit for device A is $5, for device B is $7, for device C is $9, for device D is $11, and for device E is $13.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 units in total.\n// A + B + C + D + E <= 500",
        "question": "A manufacturer produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit for device A is $10, for device B is $15, for device C is $20, for device D is $25, and for device E is $30. However, due to market saturation, the profit per unit decreases by $0.01 for each additional unit produced beyond 100 units for each device. The company aims to maximize the total profit from selling these devices. The company has a budget of $10,000 for production costs, with the cost per unit for device A being $5, for device B being $7, for device C being $9, for device D being $11, and for device E being $13. Additionally, the company has a production capacity of 500 units in total. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of device E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.01 * (max(A - 100, 0)), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.01 * (max(B - 100, 0)), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.01 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.01 * (max(C - 100, 0)), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.01 * (C2 - 100)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.01 * (max(D - 100, 0)), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=100)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=100, ub=500)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.01 * (D2 - 100)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.01 * (max(E - 100, 0)), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.01 * (E2 - 100)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 10000)\nmodel.addCons(A + B + C + D + E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Quantity of Device D: \", model.getVal(D))\n    print(\"Quantity of Device E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine.\n// {\"voltage for machine 1\": \"V1\", \"range\": \"0 < V1 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 2\": \"V2\", \"range\": \"0 < V2 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 3\": \"V3\", \"range\": \"0 < V3 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 4\": \"V4\", \"range\": \"0 < V4 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 5\": \"V5\", \"range\": \"0 < V5 <= 120\", \"type\": \"real\"}\n// {\"voltage for machine 6\": \"V6\", \"range\": \"0 < V6 <= 120\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe energy consumption of each machine is modeled as a quadratic function of the voltage applied. The production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour.\n// Energy consumption for machine i: Ei = Vi^2\n// Production rate for machine i: Pi = 100 * Vi - Vi^2/10\n// Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\n// Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\n\n## Generate Constraint-1:\nThe total energy consumption should not exceed 15000 units.\n// E1 + E2 + E3 + E4 + E5 + E6 <= 15000",
        "question": "A manufacturing plant produces electronic components using 6 different machines. The plant manager needs to optimize the energy consumption and production rate by adjusting the operating parameters of each machine. The energy consumption of each machine is modeled as a quadratic function of the voltage applied, and the production rate also increases with voltage but at a decreasing rate. The objective is to minimize the total energy consumption while maintaining a minimum production rate of 1000 units per hour. The total energy consumption should not exceed 15000 units. Please help the plant manager determine the optimal voltage settings for each machine (V1, V2, V3, V4, V5, V6) within the range of 0 < Vi <= 120 for i = 1 to 6.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"CONTINUOUS\", name=\"V1\", lb=0, ub=120) # voltage for machine 1\nV2 = model.addVar(vtype=\"CONTINUOUS\", name=\"V2\", lb=0, ub=120) # voltage for machine 2\nV3 = model.addVar(vtype=\"CONTINUOUS\", name=\"V3\", lb=0, ub=120) # voltage for machine 3\nV4 = model.addVar(vtype=\"CONTINUOUS\", name=\"V4\", lb=0, ub=120) # voltage for machine 4\nV5 = model.addVar(vtype=\"CONTINUOUS\", name=\"V5\", lb=0, ub=120) # voltage for machine 5\nV6 = model.addVar(vtype=\"CONTINUOUS\", name=\"V6\", lb=0, ub=120) # voltage for machine 6\n\n# Define objective function\n## Energy consumption for machine i: Ei = Vi^2\nE1 = V1**2\nE2 = V2**2\nE3 = V3**2\nE4 = V4**2\nE5 = V5**2\nE6 = V6**2\n## Production rate for machine i: Pi = 100 * Vi - Vi^2/10\nP1 = 100 * V1 - V1**2 / 10\nP2 = 100 * V2 - V2**2 / 10\nP3 = 100 * V3 - V3**2 / 10\nP4 = 100 * V4 - V4**2 / 10\nP5 = 100 * V5 - V5**2 / 10\nP6 = 100 * V6 - V6**2 / 10\n## Objective function: Minimize Total Energy = E1 + E2 + E3 + E4 + E5 + E6\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == E1 + E2 + E3 + E4 + E5 + E6)\n\n# Add constraints\n## Subject to Total Production = P1 + P2 + P3 + P4 + P5 + P6 >= 1000\nmodel.addCons(P1 + P2 + P3 + P4 + P5 + P6 >= 1000)\n## The total energy consumption should not exceed 15000 units.\nmodel.addCons(E1 + E2 + E3 + E4 + E5 + E6 <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Voltage for Machine 1: \", model.getVal(V1))\n    print(\"Voltage for Machine 2: \", model.getVal(V2))\n    print(\"Voltage for Machine 3: \", model.getVal(V3))\n    print(\"Voltage for Machine 4: \", model.getVal(V4))\n    print(\"Voltage for Machine 5: \", model.getVal(V5))\n    print(\"Voltage for Machine 6: \", model.getVal(V6))\n    print(\"Total Energy Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks.\n// {\"fuel consumption of Truck1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of Truck5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach truck has a different fuel consumption rate and maintenance cost per kilometer. The rates are as follows:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost.\n// Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n// Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n// So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\n\n## Generate Constraint-1:\nThe total distance covered by all trucks should not exceed 10,000 km.\n// F1 + F2 + F3 + F4 + F5 <= 10000\n\n## Generate Constraint-2:\nTruck1 and Truck2 combined should cover at least 3000 km.\n// F1 + F2 >= 3000\n\n## Generate Constraint-3:\nTruck3 and Truck4 combined should not exceed 4000 km.\n// F3 + F4 <= 4000",
        "question": "A logistics company operates a fleet of 5 trucks (Truck1, Truck2, Truck3, Truck4, Truck5) that transport goods between different cities. The company needs to optimize the fuel consumption and maintenance costs of these trucks. Each truck has a different fuel consumption rate and maintenance cost per kilometer:\n- Truck1: 0.15 liters/km and $2 maintenance cost/km\n- Truck2: 0.20 liters/km and $3 maintenance cost/km\n- Truck3: 0.18 liters/km and $2.5 maintenance cost/km\n- Truck4: 0.22 liters/km and $3.5 maintenance cost/km\n- Truck5: 0.25 liters/km and $4 maintenance cost/km\nThe company wants to minimize the total cost, which is the sum of fuel consumption multiplied by the fuel price ($1/liter) and the maintenance cost. The total distance covered by all trucks should not exceed 10,000 km. Truck1 and Truck2 combined should cover at least 3000 km. Truck3 and Truck4 combined should not exceed 4000 km.\nPlease help the company to minimize the total cost (fuel cost plus maintenance cost) while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of Truck1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of Truck2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of Truck3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of Truck4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of Truck5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total fuel cost = 1 * (0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5)\n## Total maintenance cost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\n## So, the objective function is: Minimize (Total fuel cost + Total maintenance cost)\nTotalFuelCost = 0.15 * F1 + 0.20 * F2 + 0.18 * F3 + 0.22 * F4 + 0.25 * F5\nTotalMaintenanceCost = 2 * F1 + 3 * F2 + 2.5 * F3 + 3.5 * F4 + 4 * F5\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The total distance covered by all trucks should not exceed 10,000 km.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 10000)\n## Truck1 and Truck2 combined should cover at least 3000 km.\nmodel.addCons(F1 + F2 >= 3000)\n## Truck3 and Truck4 combined should not exceed 4000 km.\nmodel.addCons(F3 + F4 <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of Truck1: \", model.getVal(F1))\n    print(\"Fuel consumption of Truck2: \", model.getVal(F2))\n    print(\"Fuel consumption of Truck3: \", model.getVal(F3))\n    print(\"Fuel consumption of Truck4: \", model.getVal(F4))\n    print(\"Fuel consumption of Truck5: \", model.getVal(F5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter.\n// {\"number of units of DeviceA\": \"DeviceATeams\", \"range\": \"DeviceATeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBTeams\", \"range\": \"DeviceBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCTeams\", \"range\": \"DeviceCTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDTeams\", \"range\": \"DeviceDTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceETeams\", \"range\": \"DeviceETeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the Revenue per Unit is $500, the Production Cost per Unit is $300, and the Marketing Cost per Unit is $50. \nFor DeviceB, the Revenue per Unit is $700, the Production Cost per Unit is $400, and the Marketing Cost per Unit is $70. \nFor DeviceC, the Revenue per Unit is $900, the Production Cost per Unit is $500, and the Marketing Cost per Unit is $90.\nFor DeviceD, the Revenue per Unit is $600, the Production Cost per Unit is $350, and the Marketing Cost per Unit is $60.\nFor DeviceE, the Revenue per Unit is $800, the Production Cost per Unit is $450, and the Marketing Cost per Unit is $80.\nThe company wants to maximize the average net profit per unit.\n// Total net profit for DeviceA: Profit_DeviceA = (500 - 300 - 50) * DeviceATeams\n// Total net profit for DeviceB: Profit_DeviceB = (700 - 400 - 70) * DeviceBTeams\n// Total net profit for DeviceC: Profit_DeviceC = (900 - 500 - 90) * DeviceCTeams\n// Total net profit for DeviceD: Profit_DeviceD = (600 - 350 - 60) * DeviceDTeams\n// Total net profit for DeviceE: Profit_DeviceE = (800 - 450 - 80) * DeviceETeams\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE) / (DeviceATeams + DeviceBTeams + DeviceCTeams + DeviceDTeams + DeviceETeams)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the quarter.\n// DeviceATeams + DeviceBTeams + DeviceCTeams + DeviceDTeams + DeviceETeams <= 1000\n\n## Generate Constraint-2:\nDue to supply chain constraints, the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceATeams <= 2 * DeviceBTeams\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for marketing costs for the quarter.\n// 50 * DeviceATeams + 70 * DeviceBTeams + 90 * DeviceCTeams + 60 * DeviceDTeams + 80 * DeviceETeams <= 100,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter. The Revenue per Unit, Production Cost per Unit, and Marketing Cost per Unit for each device are given in the following Table.\n\n| Device | Revenue per Unit | Production Cost per Unit | Marketing Cost per Unit |\n|--------|------------------|-------------------------|-------------------------|\n| DeviceA | $500            | $300                    | $50                     |\n| DeviceB | $700            | $400                    | $70                     |\n| DeviceC | $900            | $500                    | $90                     |\n| DeviceD | $600            | $350                    | $60                     |\n| DeviceE | $800            | $450                    | $80                     |\n\nThe company has a total production capacity of 1000 units for the quarter. Due to supply chain constraints, the production of DeviceA must not exceed twice the production of DeviceB. The company has a budget of $100,000 for marketing costs for the quarter. \n\nPlease help the company to maximize the average net profit per unit, which is defined as the sum of the total net profit for each device divided by the total number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceATeams = model.addVar(vtype=\"INTEGER\", name=\"DeviceATeams\", lb=0) # number of units of DeviceA\nDeviceBTeams = model.addVar(vtype=\"INTEGER\", name=\"DeviceBTeams\", lb=0) # number of units of DeviceB\nDeviceCTeams = model.addVar(vtype=\"INTEGER\", name=\"DeviceCTeams\", lb=0) # number of units of DeviceC\nDeviceDTeams = model.addVar(vtype=\"INTEGER\", name=\"DeviceDTeams\", lb=0) # number of units of DeviceD\nDeviceETeams = model.addVar(vtype=\"INTEGER\", name=\"DeviceETeams\", lb=0) # number of units of DeviceE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_DeviceA = (500 - 300 - 50) * DeviceATeams\nProfit_DeviceB = (700 - 400 - 70) * DeviceBTeams\nProfit_DeviceC = (900 - 500 - 90) * DeviceCTeams\nProfit_DeviceD = (600 - 350 - 60) * DeviceDTeams\nProfit_DeviceE = (800 - 450 - 80) * DeviceETeams\nTotalUnits = DeviceATeams + DeviceBTeams + DeviceCTeams + DeviceDTeams + DeviceETeams\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE) / TotalUnits\n## convert the division to multiplication\nmodel.addCons(obj * TotalUnits == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the quarter.\nmodel.addCons(DeviceATeams + DeviceBTeams + DeviceCTeams + DeviceDTeams + DeviceETeams <= 1000)\n## Due to supply chain constraints, the production of DeviceA must not exceed twice the production of DeviceB.\nmodel.addCons(DeviceATeams <= 2 * DeviceBTeams)\n## The company has a budget of $100,000 for marketing costs for the quarter.\nmodel.addCons(50 * DeviceATeams + 70 * DeviceBTeams + 90 * DeviceCTeams + 60 * DeviceDTeams + 80 * DeviceETeams <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceATeams))\n    print(\"Number of DeviceB: \", model.getVal(DeviceBTeams))\n    print(\"Number of DeviceC: \", model.getVal(DeviceCTeams))\n    print(\"Number of DeviceD: \", model.getVal(DeviceDTeams))\n    print(\"Number of DeviceE: \", model.getVal(DeviceETeams))\n    print(\"Maximized Average Net Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency of Truck A is 10 km/liter, Truck B is 15 km/liter, and Truck C is 20 km/liter. The cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes.\n// FuelCost_A = 1 * (RouteDistance / 10) * TruckA\n// FuelCost_B = 1 * (RouteDistance / 15) * TruckB\n// FuelCost_C = 1 * (RouteDistance / 20) * TruckC\n// So, the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\n\n## Generate Constraint-1:\nThe total distance to be covered by all trucks is 5000 km.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC = 5000\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for fuel costs.\n// (RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000\n\n## Generate Constraint-3:\nThe company can only operate a maximum of 100 trucks in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nThe market demand for Truck A is 30 units. So, the company can only operate a maximum of 30 units of Truck A.\n// TruckA <= 30\n\n## Generate Constraint-5:\nThe company must operate at least 20 units of Truck B to maintain certain delivery routes.\n// TruckB >= 20",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to optimize their delivery routes and fuel consumption. The fuel efficiency of each truck is given in the following Table.\n\n| Vehicle | Fuel Efficiency |\n|---------|-----------------|\n| Truck A | 10 km/liter     |\n| Truck B | 15 km/liter     |\n| Truck C | 20 km/liter     |\n\nThe cost of fuel per liter is $1. The company wants to minimize the total fuel cost while covering all required delivery routes. The total distance to be covered by all trucks is 5000 km. The company has a budget of $3000 for fuel costs. The company can only operate a maximum of 100 trucks in total. The market demand for Truck A is 30 units, so the company can only operate a maximum of 30 units of Truck A. The company must operate at least 20 units of Truck B to maintain certain delivery routes.\n\nPlease help the company to determine the optimal number of each type of truck to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=20)  # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nRouteDistance = model.addVar(name=\"RouteDistance\")  # variable for route distance\nFuelCost_A = 1 * (RouteDistance / 10) * TruckA\nFuelCost_B = 1 * (RouteDistance / 15) * TruckB\nFuelCost_C = 1 * (RouteDistance / 20) * TruckC\n## the objective function is: Minimize (FuelCost_A + FuelCost_B + FuelCost_C)\nmodel.addCons(obj == FuelCost_A + FuelCost_B + FuelCost_C)\n\n# Add constraints\n## The total distance to be covered by all trucks is 5000 km.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC == 5000)\n## The company has a budget of $3000 for fuel costs.\nmodel.addCons((RouteDistance / 10) * TruckA + (RouteDistance / 15) * TruckB + (RouteDistance / 20) * TruckC <= 3000)\n## The company can only operate a maximum of 100 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n## The market demand for Truck A is 30 units. So, the company can only operate a maximum of 30 units of Truck A.\nmodel.addCons(TruckA <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices. The company has a total production capacity of 10,000 units for all devices combined. Please help the company determine the optimal production quantities for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 651,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The company aims to maximize its total revenue from all products.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"price of ProductA\": \"PriceA\", \"range\": \"PriceA >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductB\": \"PriceB\", \"range\": \"PriceB >= 0\", \"type\": \"continuous\"}\n// {\"price of ProductC\": \"PriceC\", \"range\": \"PriceC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe market share of each product increases by 1% for every $10,000 spent on marketing for that product. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The company aims to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production.\n// Total revenue for ProductA: RevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\n// Total revenue for ProductB: RevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\n// Total revenue for ProductC: RevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total marketing budget cannot exceed $100,000.\n// MarketingA + MarketingB + MarketingC <= 100000\n\n## Generate Constraint-3:\nDue to market saturation, the price of each product cannot exceed $200.\n// PriceA <= 200; PriceB <= 200; PriceC <= 200",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the price at which each product will be sold, and the amount of marketing budget allocated to each product to increase its market share. The market share increase is influenced by the marketing budget and the price of the product. The company aims to maximize its total revenue from all products. The cost of production per unit is $50 for ProductA, $75 for ProductB, and $100 for ProductC. The initial market share for ProductA is 5%, for ProductB is 10%, and for ProductC is 15%. The market share of each product increases by 1% for every $10,000 spent on marketing for that product.\n\n| Product | Cost of Production per Unit | Initial Market Share |\n|---------|------------------------------|----------------------|\n| ProductA | $50                         | 5%                   |\n| ProductB | $75                         | 10%                  |\n| ProductC | $100                        | 15%                  |\n\nThe company has a total production capacity of 10,000 units across all products. The total marketing budget cannot exceed $100,000. Due to market saturation, the price of each product cannot exceed $200.\n\nPlease help the company to maximize the total revenue from all products, which is the product of the number of units, the price, and the market share minus the cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nPriceA = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceA\", lb=0) # price of ProductA\nPriceB = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceB\", lb=0) # price of ProductB\nPriceC = model.addVar(vtype=\"CONTINUOUS\", name=\"PriceC\", lb=0) # price of ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nRevenueA = UnitsA * (PriceA * (0.05 + 0.0001 * MarketingA) - 50)\nRevenueB = UnitsB * (PriceB * (0.10 + 0.0001 * MarketingB) - 75)\nRevenueC = UnitsC * (PriceC * (0.15 + 0.0001 * MarketingC) - 100)\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# The total marketing budget cannot exceed $100,000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 100000)\n# Due to market saturation, the price of each product cannot exceed $200.\nmodel.addCons(PriceA <= 200)\nmodel.addCons(PriceB <= 200)\nmodel.addCons(PriceC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(UnitsA))\n    print(\"Number of ProductB Units: \", model.getVal(UnitsB))\n    print(\"Number of ProductC Units: \", model.getVal(UnitsC))\n    print(\"Price of ProductA: \", model.getVal(PriceA))\n    print(\"Price of ProductB: \", model.getVal(PriceB))\n    print(\"Price of ProductC: \", model.getVal(PriceC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1470,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooters\", \"range\": \"Scooters >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drones\", \"range\": \"Drones >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000.\nThe operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000.\nThe operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000.\nThe operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500.\nThe operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000.\nThe company wants to minimize the total operational and maintenance costs while maximizing the total capacity.\n// Total operational and maintenance costs: Cost = 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones + 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones\n// Total capacity: Capacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n// So, the objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing vehicles.\n// 50,000 * Trucks + 30,000 * Vans + 5,000 * Bikes + 3,000 * Scooters + 10,000 * Drones <= 2,000,000\n\n## Generate Constraint-2:\nThe maintenance budget for the year is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes + 500 * Scooters + 2,000 * Drones <= 500,000\n\n## Generate Constraint-3:\nThe company needs to ensure a minimum total capacity of 50,000 units.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50,000\n\n## Generate Constraint-4:\nThe company wants to have at least 5 different types of vehicles.\n// Trucks >= 1; Vans >= 1; Bikes >= 1; Scooters >= 1; Drones >= 1\n\n## Generate Constraint-5:\nNo more than 30% of the budget can be spent on any single type of vehicle.\n// 50,000 * Trucks <= 0.3 * 2,000,000\n// 30,000 * Vans <= 0.3 * 2,000,000\n// 5,000 * Bikes <= 0.3 * 2,000,000\n// 3,000 * Scooters <= 0.3 * 2,000,000\n// 10,000 * Drones <= 0.3 * 2,000,000",
        "question": "A logistics company is planning its fleet for the next year, considering five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each type of vehicle has different operational costs and capacities. The operational cost per Truck is $50,000, the capacity is 1000 units, and the maintenance cost is $10,000. The operational cost per Van is $30,000, the capacity is 500 units, and the maintenance cost is $5,000. The operational cost per Bike is $5,000, the capacity is 100 units, and the maintenance cost is $1,000. The operational cost per Scooter is $3,000, the capacity is 50 units, and the maintenance cost is $500. The operational cost per Drone is $10,000, the capacity is 200 units, and the maintenance cost is $2,000. The company has a budget of $2,000,000 for purchasing vehicles and a maintenance budget for the year of $500,000. The company needs to ensure a minimum total capacity of 50,000 units and wants to have at least 5 different types of vehicles. Additionally, no more than 30% of the budget can be spent on any single type of vehicle. The company wants to minimize the total operational and maintenance costs while maximizing the total capacity. Please help the company determine the optimal number of each type of vehicle to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)\nScooters = model.addVar(vtype=\"INTEGER\", name=\"Scooters\", lb=0)\nDrones = model.addVar(vtype=\"INTEGER\", name=\"Drones\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones + 10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones\nCapacity = 1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones\n## the objective function is: Minimize Cost / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $2,000,000 for purchasing vehicles.\nmodel.addCons(50000 * Trucks + 30000 * Vans + 5000 * Bikes + 3000 * Scooters + 10000 * Drones <= 2000000)\n## The maintenance budget for the year is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 1000 * Bikes + 500 * Scooters + 2000 * Drones <= 500000)\n## The company needs to ensure a minimum total capacity of 50,000 units.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes + 50 * Scooters + 200 * Drones >= 50000)\n## The company wants to have at least 5 different types of vehicles.\nmodel.addCons(Trucks >= 1)\nmodel.addCons(Vans >= 1)\nmodel.addCons(Bikes >= 1)\nmodel.addCons(Scooters >= 1)\nmodel.addCons(Drones >= 1)\n## No more than 30% of the budget can be spent on any single type of vehicle.\nmodel.addCons(50000 * Trucks <= 0.3 * 2000000)\nmodel.addCons(30000 * Vans <= 0.3 * 2000000)\nmodel.addCons(5000 * Bikes <= 0.3 * 2000000)\nmodel.addCons(3000 * Scooters <= 0.3 * 2000000)\nmodel.addCons(10000 * Drones <= 0.3 * 2000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Number of Scooters: \", model.getVal(Scooters))\n    print(\"Number of Drones: \", model.getVal(Drones))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and profit.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Small truck generates a profit of $100 per trip, each Medium truck generates $150 per trip, each Large truck generates $200 per trip, each Extra-Large truck generates $250 per trip, and each Refrigerated truck generates $300 per trip. Due to varying operational efficiencies, the profit per trip for each type of truck decreases nonlinearly as the number of trucks of that type increases. Specifically, the profit per trip decreases by 0.1% for every additional truck of the same type. The company aims to maximize the total profit from all truck operations.\n// Profit_S = (100 - 0.1 * S) * S\n// Profit_M = (150 - 0.1 * M) * M\n// Profit_L = (200 - 0.1 * L) * L\n// Profit_XL = (250 - 0.1 * XL) * XL\n// Profit_R = (300 - 0.1 * R) * R\n// So, the objective function is: Maximize Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $500,000. The cost of each Small truck is $20,000, each Medium truck is $30,000, each Large truck is $40,000, each Extra-Large truck is $50,000, and each Refrigerated truck is $60,000.\n// 20000 * S + 30000 * M + 40000 * L + 50000 * XL + 60000 * R <= 500000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and profit. The profit per trip for each type of truck decreases nonlinearly as the number of trucks of that type increases by 0.1% for every additional truck of the same type. The company aims to maximize the total profit from all truck operations. The cost of each Small truck is $20,000, each Medium truck is $30,000, each Large truck is $40,000, each Extra-Large truck is $50,000, and each Refrigerated truck is $60,000. The company has a total fleet budget of $500,000.\n\n| Truck Type       | Profit per Trip | Cost per Truck |\n|------------------|-----------------|----------------|\n| Small            | $100            | $20,000        |\n| Medium           | $150            | $30,000        |\n| Large            | $200            | $40,000        |\n| Extra-Large      | $250            | $50,000        |\n| Refrigerated     | $300            | $60,000        |\n\nPlease help the company to determine the optimal number of each type of truck to maximize the total profit from all truck operations, given the fleet budget constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R\n## convert the division to multiplication\nProfit_S = (100 - 0.1 * S) * S\nProfit_M = (150 - 0.1 * M) * M\nProfit_L = (200 - 0.1 * L) * L\nProfit_XL = (250 - 0.1 * XL) * XL\nProfit_R = (300 - 0.1 * R) * R\nmodel.addCons(obj == Profit_S + Profit_M + Profit_L + Profit_XL + Profit_R)\n\n# Add constraints\n## The company has a total fleet budget of $500,000.\nmodel.addCons(20000 * S + 30000 * M + 40000 * L + 50000 * XL + 60000 * R <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(S))\n    print(\"Number of Medium Trucks: \", model.getVal(M))\n    print(\"Number of Large Trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated Trucks: \", model.getVal(R))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand.\n// {\"number of trucks on CityA to CityB route\": \"Trucks_AB\", \"range\": \"Trucks_AB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityA to CityC route\": \"Trucks_AC\", \"range\": \"Trucks_AC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on CityB to CityC route\": \"Trucks_BC\", \"range\": \"Trucks_BC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and operational costs of the trucks vary by route. For the CityA to CityB route, each truck consumes 500 liters of fuel and incurs an operational cost of $1000 per trip. For the CityA to CityC route, each truck consumes 600 liters of fuel and incurs an operational cost of $1200 per trip. For the CityB to CityC route, each truck consumes 450 liters of fuel and incurs an operational cost of $900 per trip. The company aims to minimize the total fuel consumption and operational costs.\n// Total fuel consumption and operational costs for CityA to CityB: Cost_AB = 500 * Trucks_AB + 1000 * Trucks_AB\n// Total fuel consumption and operational costs for CityA to CityC: Cost_AC = 600 * Trucks_AC + 1200 * Trucks_AC\n// Total fuel consumption and operational costs for CityB to CityC: Cost_BC = 450 * Trucks_BC + 900 * Trucks_BC\n// So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// Trucks_AB + Trucks_AC + Trucks_BC <= 50\n\n## Generate Constraint-2:\nThe demand from CityA to CityB requires at least 15 trucks.\n// Trucks_AB >= 15",
        "question": "A logistics company operates a fleet of trucks that transport goods between three major cities: CityA, CityB, and CityC. The company needs to determine the optimal number of trucks to allocate to each route to minimize fuel consumption and operational costs while meeting demand. The fuel consumption and operational costs per truck for each route are given in the following Table.\n\n| Route            | Fuel Consumption (liters) | Operational Cost ($) |\n|------------------|--------------------------|----------------------|\n| CityA to CityB   | 500                      | 1000                 |\n| CityA to CityC   | 600                      | 1200                 |\n| CityB to CityC   | 450                      | 900                  |\n\nThe company has a total of 50 trucks available. The demand from CityA to CityB requires at least 15 trucks. Please help the company to minimize the total fuel consumption and operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_AB = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AB\", lb=15) # number of trucks on CityA to CityB route\nTrucks_AC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_AC\", lb=0) # number of trucks on CityA to CityC route\nTrucks_BC = model.addVar(vtype=\"INTEGER\", name=\"Trucks_BC\", lb=0) # number of trucks on CityB to CityC route\n\n# Define objective function\nCost_AB = (500 + 1000) * Trucks_AB\nCost_AC = (600 + 1200) * Trucks_AC\nCost_BC = (450 + 900) * Trucks_BC\n# So, the objective function is: Minimize (Cost_AB + Cost_AC + Cost_BC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_AB + Cost_AC + Cost_BC)\n\n# Add constraints\n# The total number of trucks available is 50.\nmodel.addCons(Trucks_AB + Trucks_AC + Trucks_BC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on CityA to CityB route: \", model.getVal(Trucks_AB))\n    print(\"Number of Trucks on CityA to CityC route: \", model.getVal(Trucks_AC))\n    print(\"Number of Trucks on CityB to CityC route: \", model.getVal(Trucks_BC))\n    print(\"Minimized Total Fuel Consumption and Operational Costs: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines.\n// {\"number of trips for Route A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company wants to minimize the total fuel consumption.\n// Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\n// Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\n// Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\n// Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\n// Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 300 trips available across all routes.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 300",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines.\n\nThe fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company wants to minimize the total fuel consumption.\n\nThe company has a total of 300 trips available across all routes. Please help the company to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for Route A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for Route B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for Route C\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0) # number of trips for Route D\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0) # number of trips for Route E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=50)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=50, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TripsA == A1*A_b1 + A2*A_b2)\nFuel_A = 100 * A1 * A_b1 + (100 - 0.1 * (A2 - 50)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=60)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=60, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TripsB == B1*B_b1 + B2*B_b2)\nFuel_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 60)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=55)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=55, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TripsC == C1*C_b1 + C2*C_b2)\nFuel_C = 110 * C1 * C_b1 + (110 - 0.12 * (C2 - 55)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=70)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=70, ub=300)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TripsD == D1*D_b1 + D2*D_b2)\nFuel_D = 130 * D1 * D_b1 + (130 - 0.18 * (D2 - 70)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=80)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=80, ub=300)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TripsE == E1*E_b1 + E2*E_b2)\nFuel_E = 140 * E1 * E_b1 + (140 - 0.2 * (E2 - 80)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Route A: \", model.getVal(TripsA))\n    print(\"Number of Trips for Route B: \", model.getVal(TripsB))\n    print(\"Number of Trips for Route C: \", model.getVal(TripsC))\n    print(\"Number of Trips for Route D: \", model.getVal(TripsD))\n    print(\"Number of Trips for Route E: \", model.getVal(TripsE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1375,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The goal is to minimize the total operational cost while considering the environmental impact and route capacities.\n// {\"number of trucks of type 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for type 1 trucks\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for type 2 trucks\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for type 3 trucks\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. The cost function for each truck type is modeled as a quadratic function where the cost per mile decreases as more technology is invested.\nThe initial cost per mile for type 1 trucks is $0.8, and it decreases by $0.01 for every $100 invested in technology.\nThe initial cost per mile for type 2 trucks is $0.7, and it decreases by $0.012 for every $100 invested in technology.\nThe initial cost per mile for type 3 trucks is $0.6, and it decreases by $0.015 for every $100 invested in technology.\nThe company aims to minimize the total operational cost across all truck types.\n// Total cost for type 1 trucks: Cost1 = (0.8 - 0.0001 * Tech1) * Trucks1\n// Total cost for type 2 trucks: Cost2 = (0.7 - 0.00012 * Tech2) * Trucks2\n// Total cost for type 3 trucks: Cost3 = (0.6 - 0.00015 * Tech3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for investing in fuel-efficient technologies and operating the fleet is $100,000.\n// Tech1 + Tech2 + Tech3 + (0.8 * Trucks1) + (0.7 * Trucks2) + (0.6 * Trucks3) <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available for allocation is limited to 500.\n// Trucks1 + Trucks2 + Trucks3 <= 500",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The goal is to minimize the total operational cost while considering the environmental impact and route capacities. The operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. The cost function for each truck type is modeled as a quadratic function where the cost per mile decreases as more technology is invested. The initial cost per mile and the rate at which it decreases with technology investment for each truck type are given in the following Table.\n\n| Truck Type | Initial Cost per Mile | Decrease per $100 Investment |\n|------------|-----------------------|------------------------------|\n| Type 1     | $0.8                  | $0.01                        |\n| Type 2     | $0.7                  | $0.012                       |\n| Type 3     | $0.6                  | $0.015                       |\n\nThe company has a total budget of $100,000 for investing in fuel-efficient technologies and operating the fleet. The total number of trucks available for allocation is limited to 500. Please help the company to minimize the total operational cost across all truck types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks of type 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks of type 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks of type 3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for type 1 trucks\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for type 2 trucks\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for type 3 trucks\n\n# Define objective function\nCost1 = (0.8 - 0.0001 * Tech1) * Trucks1\nCost2 = (0.7 - 0.00012 * Tech2) * Trucks2\nCost3 = (0.6 - 0.00015 * Tech3) * Trucks3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 + (0.8 * Trucks1) + (0.7 * Trucks2) + (0.6 * Trucks3) <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Type 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks Type 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks Type 3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech1: \", model.getVal(Tech1))\n    print(\"Investment in Tech2: \", model.getVal(Tech2))\n    print(\"Investment in Tech3: \", model.getVal(Tech3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1367,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to minimize fuel consumption and travel time while meeting delivery deadlines.\n// {\"trucks to D1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"trucks to D5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each truck is a nonlinear function of the distance and load. For D1, the fuel consumption is modeled as 0.5 * T1^2 + 10 * T1. For D2, it's 0.6 * T2^2 + 12 * T2. For D3, it's 0.7 * T3^2 + 14 * T3. For D4, it's 0.8 * T4^2 + 16 * T4. For D5, it's 0.9 * T5^2 + 18 * T5. The company wants to minimize the total fuel consumption.\n// So, the objective function is: Minimize (0.5 * T1^2 + 10 * T1 + 0.6 * T2^2 + 12 * T2 + 0.7 * T3^2 + 14 * T3 + 0.8 * T4^2 + 16 * T4 + 0.9 * T5^2 + 18 * T5)\n\n## Generate Constraint-1:\nThe company has a total fleet size of 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-2:\nEach destination has a minimum delivery requirement. D1 requires at least 5 trucks, D2 requires at least 7 trucks, D3 requires at least 9 trucks, D4 requires at least 11 trucks, and D5 requires at least 13 trucks.\n// T1 >= 5\n// T2 >= 7\n// T3 >= 9\n// T4 >= 11\n// T5 >= 13\n\n## Generate Constraint-3:\nThe total travel time for all routes must not exceed 1000 hours. The travel time for each route is a nonlinear function of the number of trucks and the distance. For D1, it's 0.1 * T1^2 + 2 * T1. For D2, it's 0.12 * T2^2 + 2.4 * T2. For D3, it's 0.14 * T3^2 + 2.8 * T3. For D4, it's 0.16 * T4^2 + 3.2 * T4. For D5, it's 0.18 * T5^2 + 3.6 * T5.\n// 0.1 * T1^2 + 2 * T1 + 0.12 * T2^2 + 2.4 * T2 + 0.14 * T3^2 + 2.8 * T3 + 0.16 * T4^2 + 3.2 * T4 + 0.18 * T5^2 + 3.6 * T5 <= 1000\n\n## Generate Constraint-4:\nThe company must ensure that at least 20% of the trucks are allocated to the most critical route, which is D5.\n// T5 >= 0.2 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: D1, D2, D3, D4, and D5. The company aims to minimize fuel consumption and travel time while meeting delivery deadlines. The fuel consumption and travel time for each destination are nonlinear functions of the number of trucks and the distance, as shown in the following Table.\n\n| Destination | Fuel Consumption Function | Travel Time Function | Minimum Trucks Required |\n|-------------|---------------------------|----------------------|-------------------------|\n| D1          | 0.5 * T1^2 + 10 * T1      | 0.1 * T1^2 + 2 * T1  | 5                       |\n| D2          | 0.6 * T2^2 + 12 * T2      | 0.12 * T2^2 + 2.4 * T2| 7                       |\n| D3          | 0.7 * T3^2 + 14 * T3      | 0.14 * T3^2 + 2.8 * T3| 9                       |\n| D4          | 0.8 * T4^2 + 16 * T4      | 0.16 * T4^2 + 3.2 * T4| 11                      |\n| D5          | 0.9 * T5^2 + 18 * T5      | 0.18 * T5^2 + 3.6 * T5| 13                      |\n\nThe company has a total fleet size of 50 trucks. Each destination has a minimum delivery requirement as specified in the Table. The total travel time for all routes must not exceed 1000 hours. The company must also ensure that at least 20% of the trucks are allocated to the most critical route, which is D5.\n\nPlease help the company to minimize the total fuel consumption and travel time while meeting all the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5) # trucks to D1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=7) # trucks to D2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=9) # trucks to D3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=11) # trucks to D4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=13) # trucks to D5\n\n# Define objective function\n## The fuel consumption for each truck is a nonlinear function of the distance and load.\nFuel_D1 = 0.5 * T1**2 + 10 * T1\nFuel_D2 = 0.6 * T2**2 + 12 * T2\nFuel_D3 = 0.7 * T3**2 + 14 * T3\nFuel_D4 = 0.8 * T4**2 + 16 * T4\nFuel_D5 = 0.9 * T5**2 + 18 * T5\n## The company wants to minimize the total fuel consumption.\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_D1 + Fuel_D2 + Fuel_D3 + Fuel_D4 + Fuel_D5)\n\n# Add constraints\n## The company has a total fleet size of 50 trucks.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The total travel time for all routes must not exceed 1000 hours.\nTravel_D1 = 0.1 * T1**2 + 2 * T1\nTravel_D2 = 0.12 * T2**2 + 2.4 * T2\nTravel_D3 = 0.14 * T3**2 + 2.8 * T3\nTravel_D4 = 0.16 * T4**2 + 3.2 * T4\nTravel_D5 = 0.18 * T5**2 + 3.6 * T5\nmodel.addCons(Travel_D1 + Travel_D2 + Travel_D3 + Travel_D4 + Travel_D5 <= 1000)\n## The company must ensure that at least 20% of the trucks are allocated to the most critical route, which is D5.\nmodel.addCons(T5 >= 0.2 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks to D1: \", model.getVal(T1))\n    print(\"Number of Trucks to D2: \", model.getVal(T2))\n    print(\"Number of Trucks to D3: \", model.getVal(T3))\n    print(\"Number of Trucks to D4: \", model.getVal(T4))\n    print(\"Number of Trucks to D5: \", model.getVal(T5))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1470,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: light, medium, and heavy, each with different fuel efficiencies and capacities.\n// {\"number of light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of light trucks (km/liter)\": \"LightFuelEfficiency\", \"range\": \"LightFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of heavy trucks (km/liter)\": \"HeavyFuelEfficiency\", \"range\": \"HeavyFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel cost, considering the distance traveled by each type of truck and the current fuel prices. The fuel price is $1.5 per liter.\n// FuelCost_Light = (Distance_Light / LightFuelEfficiency) * 1.5 * LightTrucks\n// FuelCost_Medium = (Distance_Medium / MediumFuelEfficiency) * 1.5 * MediumTrucks\n// FuelCost_Heavy = (Distance_Heavy / HeavyFuelEfficiency) * 1.5 * HeavyTrucks\n// So, the objective function is: Minimize (FuelCost_Light + FuelCost_Medium + FuelCost_Heavy)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 per day for fuel expenses.\n// FuelCost_Light + FuelCost_Medium + FuelCost_Heavy <= 1000\n\n## Generate Constraint-2:\nThe total number of trucks available in the fleet is limited to 50.\n// LightTrucks + MediumTrucks + HeavyTrucks <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks: light, medium, and heavy, each with different fuel efficiencies and capacities. The fuel efficiency of each truck type is given in the following Table.\n\n| Truck Type | Fuel Efficiency (km/liter) |\n|------------|----------------------------|\n| Light      | LightFuelEfficiency        |\n| Medium     | MediumFuelEfficiency       |\n| Heavy      | HeavyFuelEfficiency        |\n\nThe company aims to minimize the total daily fuel cost, considering the distance traveled by each type of truck and the current fuel prices, which is $1.5 per liter. The company has a total budget of $1000 per day for fuel expenses. The total number of trucks available in the fleet is limited to 50.\nPlease help the company determine the optimal number of light, medium, and heavy trucks to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)  # number of light trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)  # number of heavy trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Define fuel costs\nDistance_Light = model.addVar(name=\"Distance_Light\")  # distance traveled by light trucks\nDistance_Medium = model.addVar(name=\"Distance_Medium\")  # distance traveled by medium trucks\nDistance_Heavy = model.addVar(name=\"Distance_Heavy\")  # distance traveled by heavy trucks\n\nFuelCost_Light = (Distance_Light / model.addVar(name=\"LightFuelEfficiency\")) * 1.5 * LightTrucks\nFuelCost_Medium = (Distance_Medium / model.addVar(name=\"MediumFuelEfficiency\")) * 1.5 * MediumTrucks\nFuelCost_Heavy = (Distance_Heavy / model.addVar(name=\"HeavyFuelEfficiency\")) * 1.5 * HeavyTrucks\n\n# Objective function constraint\nmodel.addCons(obj == FuelCost_Light + FuelCost_Medium + FuelCost_Heavy)\n\n# Add constraints\n## The company has a total budget of $1000 per day for fuel expenses.\nmodel.addCons(FuelCost_Light + FuelCost_Medium + FuelCost_Heavy <= 1000)\n## The total number of trucks available in the fleet is limited to 50.\nmodel.addCons(LightTrucks + MediumTrucks + HeavyTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Minimized Total Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. The company operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n// {\"number of Scooters\": \"Scooter\", \"range\": \"Scooter >= 0\", \"type\": \"integer\"}\n// {\"number of Drones\": \"Drone\", \"range\": \"Drone >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $1000, maintenance cost is $200, and capacity is 1000 units.\nThe operational cost per Van is $500, maintenance cost is $100, and capacity is 500 units.\nThe operational cost per Bike is $100, maintenance cost is $20, and capacity is 100 units.\nThe operational cost per Scooter is $50, maintenance cost is $10, and capacity is 50 units.\nThe operational cost per Drone is $200, maintenance cost is $50, and capacity is 200 units.\nThe company wants to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized.\n// Total operational cost: OperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// Total maintenance cost: MaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\n// Total capacity utilized: Capacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n// So, the objective function is: Minimize (OperCost + MaintCost) / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for operational and maintenance costs.\n// 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000\n\n## Generate Constraint-2:\nThe company must transport at least 50,000 units.\n// 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone >= 50000\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed the combined number of other vehicles by more than 10.\n// Truck <= (Van + Bike + Scooter + Drone) + 10",
        "question": "A logistics company is planning its fleet for the next quarter. The company operates five types of vehicles: Trucks, Vans, Bikes, Scooters, and Drones. Each vehicle type has different operational costs, maintenance costs, and capacities. The operational cost per Truck is $1000, maintenance cost is $200, and capacity is 1000 units. The operational cost per Van is $500, maintenance cost is $100, and capacity is 500 units. The operational cost per Bike is $100, maintenance cost is $20, and capacity is 100 units. The operational cost per Scooter is $50, maintenance cost is $10, and capacity is 50 units. The operational cost per Drone is $200, maintenance cost is $50, and capacity is 200 units. The company has a budget of $100,000 for operational and maintenance costs. The company must transport at least 50,000 units. The number of Trucks must not exceed the combined number of other vehicles by more than 10. Please help the company to minimize the Total Cost per Unit Shipped, which is defined as the sum of operational and maintenance costs divided by the total capacity utilized.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\nScooter = model.addVar(vtype=\"INTEGER\", name=\"Scooter\", lb=0)  # number of Scooters\nDrone = model.addVar(vtype=\"INTEGER\", name=\"Drone\", lb=0)  # number of Drones\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nOperCost = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\nMaintCost = 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone\nCapacity = 1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone\n## the objective function is: Minimize (OperCost + MaintCost) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == OperCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $100,000 for operational and maintenance costs.\nmodel.addCons(1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone + 200 * Truck + 100 * Van + 20 * Bike + 10 * Scooter + 50 * Drone <= 100000)\n## The company must transport at least 50,000 units.\nmodel.addCons(1000 * Truck + 500 * Van + 100 * Bike + 50 * Scooter + 200 * Drone >= 50000)\n## The number of Trucks must not exceed the combined number of other vehicles by more than 10.\nmodel.addCons(Truck <= Van + Bike + Scooter + Drone + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Number of Scooters: \", model.getVal(Scooter))\n    print(\"Number of Drones: \", model.getVal(Drone))\n    print(\"Minimized Cost per Unit Shipped: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D\": \"R&D\", \"range\": \"R&D >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. The level of automation reduces the production cost per unit by $0.5 for every unit of automation. The investment in R&D reduces the production cost per unit by $0.01 for every $1,000 invested. The selling price per unit of DeviceA is $200, DeviceB is $250, and DeviceC is $300. The company aims to maximize the total profit from all devices.\n// Profit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R&D)) * DeviceA\n// Profit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R&D)) * DeviceB\n// Profit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R&D)) * DeviceC\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// DeviceA + DeviceB + DeviceC <= 1000\n\n## Generate Constraint-2:\nThe total investment in automation and R&D cannot exceed $50,000.\n// Automation + R&D <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\n// DeviceA <= 500; DeviceB <= 400",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantities of each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to determine the investment in research and development (R&D) to improve the efficiency and quality of the devices, which will reduce the production cost per unit. The production cost per unit, selling price per unit, and the impact of automation and R&D on the production cost are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Impact of Automation on Cost | Impact of R&D on Cost |\n|--------|--------------------------|------------------------|------------------------------|-----------------------|\n| DeviceA | 100$                     | 200$                   | -0.5$ per unit of automation | -0.0001$ per $1,000 R&D |\n| DeviceB | 150$                     | 250$                   | -0.5$ per unit of automation | -0.0001$ per $1,000 R&D |\n| DeviceC | 200$                     | 300$                   | -0.5$ per unit of automation | -0.0001$ per $1,000 R&D |\n\nThe company has a total production capacity of 1000 units. The total investment in automation and R&D cannot exceed $50,000. Due to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units. \nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\nR_D = model.addVar(vtype=\"CONTINUOUS\", name=\"R&D\", lb=0) # investment in R&D\n\n# Define objective function\nProfit_DeviceA = (200 - (100 - 0.5 * Automation + 0.0001 * R_D)) * DeviceA\nProfit_DeviceB = (250 - (150 - 0.5 * Automation + 0.0001 * R_D)) * DeviceB\nProfit_DeviceC = (300 - (200 - 0.5 * Automation + 0.0001 * R_D)) * DeviceC\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units.\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 1000)\n# The total investment in automation and R&D cannot exceed $50,000.\nmodel.addCons(Automation + R_D <= 50000)\n# Due to market demand, the production of DeviceA cannot exceed 500 units, and the production of DeviceB cannot exceed 400 units.\nmodel.addCons(DeviceA <= 500)\nmodel.addCons(DeviceB <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Investment in R&D: \", model.getVal(R_D))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1582,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes.\n// Cost per hour for route A: Cost_A = 2 * A * 60\n// Cost per hour for route B: Cost_B = 3 * B * 50\n// Cost per hour for route C: Cost_C = 4 * C * 40\n// Cost per hour for route D: Cost_D = 5 * D * 30\n// Cost per hour for route E: Cost_E = 6 * E * 20\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per day for all routes.\n// 2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000\n\n## Generate Constraint-2:\nThe company must allocate at least 5 trucks to each route.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks available is 50.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-4:\nThe number of trucks on route D must not exceed the total number of trucks on routes A and B.\n// D <= A + B\n\n## Generate Constraint-5:\nThe number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates five different routes for transporting goods: A, B, C, D, and E. The company needs to determine how many trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per kilometer and a different average speed. Route A costs $2 per km and averages 60 km/h. Route B costs $3 per km and averages 50 km/h. Route C costs $4 per km and averages 40 km/h. Route D costs $5 per km and averages 30 km/h. Route E costs $6 per km and averages 20 km/h. The company aims to minimize the total cost of transportation per hour across all routes. The company has a total budget of $10,000 per day for all routes. The company must allocate at least 5 trucks to each route. The total number of trucks available is 50. The number of trucks on route D must not exceed the total number of trucks on routes A and B. The number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D. Please help the company to minimize the total cost of transportation per hour across all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must allocate at least 5 trucks to each route.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## Cost per hour for each route\nCost_A = 2 * A * 60\nCost_B = 3 * B * 50\nCost_C = 4 * C * 40\nCost_D = 5 * D * 30\nCost_E = 6 * E * 20\n## So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total budget of $10,000 per day for all routes.\nmodel.addCons(2 * A * 60 + 3 * B * 50 + 4 * C * 40 + 5 * D * 30 + 6 * E * 20 <= 10000)\n## The total number of trucks available is 50.\nmodel.addCons(A + B + C + D + E <= 50)\n## The number of trucks on route D must not exceed the total number of trucks on routes A and B.\nmodel.addCons(D <= A + B)\n## The number of trucks on route E must not exceed the total number of trucks on routes A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the advertising budget for each product to enhance market penetration.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"real\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10. The storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n// Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n// Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\n// ProdA <= 2000; ProdB <= 3000; ProdC <= 2500",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product (ProdA, ProdB, ProdC) and the advertising budget for each product (AdBudgetA, AdBudgetB, AdBudgetC) to maximize profit. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for all products is $10, and the storage cost per unit for ProductA is $5, for ProductB is $7, and for ProductC is $6. The advertising effectiveness (additional profit per dollar spent) for ProductA is 0.1, for ProductB is 0.15, and for ProductC is 0.12. The company has a total budget of $100,000 for raw materials and labor. The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\n\nPlease help the company to maximize the total profit, which is defined as the sum of the profits from each product considering both production and advertising costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\n## Total profit for ProductB: Profit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\n## Total profit for ProductC: Profit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.1 * AdBudgetA\nProfit_B = (70 - 30 - 10 - 7) * ProdB + 0.15 * AdBudgetB\nProfit_C = (60 - 25 - 10 - 6) * ProdC + 0.12 * AdBudgetC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 10) * ProdB + (25 + 10) * ProdC <= 100000)\n## The storage capacity for ProductA is limited to 2000 units, for ProductB is 3000 units, and for ProductC is 2500 units.\nmodel.addCons(ProdA <= 2000)\nmodel.addCons(ProdB <= 3000)\nmodel.addCons(ProdC <= 2500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\n// Profit_D1 = 100 * D1\n// Profit_D2 = 150 * D2\n// Profit_D3 = 200 * D3\n// The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of material M, with only 500 units available.\n// 2 * D1 + 3 * D2 + 4 * D3 <= 500\n\n## Generate Constraint-2:\nThe supply of material N is also limited, with only 200 units available.\n// D2 + 2 * D3 <= 200\n\n## Generate Constraint-3:\nThe production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively.\n// D1 + 2 * D2 + 3 * D3 <= 150\n\n## Generate Constraint-4:\nThe market demand for D1 is 50 units. Therefore, the manufacturer can only sell a maximum of 50 units of D1.\n// D1 <= 50",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for D1 is $100, but it requires 2 units of a rare material M. For D2, the profit per unit is $150, requiring 3 units of material M and 1 unit of another material N. For D3, the profit per unit is $200, requiring 4 units of material M and 2 units of material N. The manufacturer aims to maximize the total profit.\nThe manufacturer has a limited supply of material M, with only 500 units available. The supply of material N is also limited, with only 200 units available. The production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively. The market demand for D1 is 50 units. Therefore, the manufacturer can only sell a maximum of 50 units of D1.\nPlease help the manufacturer to determine the optimal production quantities for D1, D2, and D3 to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 100 * D1\nProfit_D2 = 150 * D2\nProfit_D3 = 200 * D3\n# The objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited supply of material M, with only 500 units available.\nmodel.addCons(2 * D1 + 3 * D2 + 4 * D3 <= 500)\n# The supply of material N is also limited, with only 200 units available.\nmodel.addCons(D2 + 2 * D3 <= 200)\n# The production line has a total capacity of 150 hours, and each unit of D1, D2, and D3 requires 1, 2, and 3 hours of production time, respectively.\nmodel.addCons(D1 + 2 * D2 + 3 * D3 <= 150)\n# The market demand for D1 is 50 units. Therefore, the manufacturer can only sell a maximum of 50 units of D1.\nmodel.addCons(D1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must determine the number of trips each truck will make to each region. Additionally, the company is considering investing in fuel-efficient technologies for each region, which will affect the fuel consumption and operational costs.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for Region1\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region2\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region3\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region4\": \"Tech4\", \"range\": \"Tech4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for Region5\": \"Tech5\", \"range\": \"Tech5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of the trucks improves with the investment in technology. For each $1000 invested, the fuel consumption decreases by 0.5 liters per trip. The initial fuel consumption per trip to Region1 is 10 liters, to Region2 is 12 liters, to Region3 is 15 liters, to Region4 is 18 liters, and to Region5 is 20 liters. The company aims to minimize the total fuel consumption across all regions.\n// Fuel_Region1 = (10 - 0.0005 * Tech1) * Trips1\n// Fuel_Region2 = (12 - 0.0005 * Tech2) * Trips2\n// Fuel_Region3 = (15 - 0.0005 * Tech3) * Trips3\n// Fuel_Region4 = (18 - 0.0005 * Tech4) * Trips4\n// Fuel_Region5 = (20 - 0.0005 * Tech5) * Trips5\n// So, the objective function is: Minimize (Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The operational cost per trip to Region1 is $500, to Region2 is $600, to Region3 is $750, to Region4 is $900, and to Region5 is $1000.\n// 500 * Trips1 + 600 * Trips2 + 750 * Trips3 + 900 * Trips4 + 1000 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000\n\n## Generate Constraint-2:\nThe total number of trips the company can make in a month is limited to 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-3:\nDue to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3.\n// Trips1 >= 50; Trips3 >= 70\n\n## Generate Constraint-4:\nThe investment in fuel-efficient technology for each region cannot exceed $20,000.\n// Tech1 <= 20000; Tech2 <= 20000; Tech3 <= 20000; Tech4 <= 20000; Tech5 <= 20000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different regions: Region1, Region2, Region3, Region4, and Region5. The company must determine the number of trips each truck will make to each region and the investment in fuel-efficient technologies for each region. The fuel efficiency of the trucks improves with the investment in technology, where for each $1000 invested, the fuel consumption decreases by 0.5 liters per trip. The initial fuel consumption per trip to Region1 is 10 liters, to Region2 is 12 liters, to Region3 is 15 liters, to Region4 is 18 liters, and to Region5 is 20 liters. The company aims to minimize the total fuel consumption across all regions.\n\nThe company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs. The operational cost per trip to Region1 is $500, to Region2 is $600, to Region3 is $750, to Region4 is $900, and to Region5 is $1000. The total number of trips the company can make in a month is limited to 500. Due to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3. The investment in fuel-efficient technology for each region cannot exceed $20,000.\n\nPlease help the company to determine the optimal number of trips and the appropriate investment in fuel-efficient technologies for each region to minimize the total fuel consumption while adhering to the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for Region1\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for Region2\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for Region3\nTech4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech4\", lb=0)  # investment in fuel-efficient technology for Region4\nTech5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech5\", lb=0)  # investment in fuel-efficient technology for Region5\n\n# Define objective function\nFuel_Region1 = (10 - 0.0005 * Tech1) * Trips1\nFuel_Region2 = (12 - 0.0005 * Tech2) * Trips2\nFuel_Region3 = (15 - 0.0005 * Tech3) * Trips3\nFuel_Region4 = (18 - 0.0005 * Tech4) * Trips4\nFuel_Region5 = (20 - 0.0005 * Tech5) * Trips5\n# So, the objective function is: Minimize (Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Region1 + Fuel_Region2 + Fuel_Region3 + Fuel_Region4 + Fuel_Region5)\n\n# Add constraints\n# The company has a total budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(500 * Trips1 + 600 * Trips2 + 750 * Trips3 + 900 * Trips4 + 1000 * Trips5 + Tech1 + Tech2 + Tech3 + Tech4 + Tech5 <= 100000)\n# The total number of trips the company can make in a month is limited to 500.\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\n# Due to contractual obligations, the company must make at least 50 trips to Region1 and 70 trips to Region3.\nmodel.addCons(Trips1 >= 50)\nmodel.addCons(Trips3 >= 70)\n# The investment in fuel-efficient technology for each region cannot exceed $20,000.\nmodel.addCons(Tech1 <= 20000)\nmodel.addCons(Tech2 <= 20000)\nmodel.addCons(Tech3 <= 20000)\nmodel.addCons(Tech4 <= 20000)\nmodel.addCons(Tech5 <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of Trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of Trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of Trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of Trips to Region5: \", model.getVal(Trips5))\n    print(\"Investment in Tech for Region1: \", model.getVal(Tech1))\n    print(\"Investment in Tech for Region2: \", model.getVal(Tech2))\n    print(\"Investment in Tech for Region3: \", model.getVal(Tech3))\n    print(\"Investment in Tech for Region4: \", model.getVal(Tech4))\n    print(\"Investment in Tech for Region5: \", model.getVal(Tech5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1448,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 hectares of Corn.\n// Corn >= 5",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer has 100 hectares of land available and a total of 50,000 liters of water for irrigation. The farmer must plant at least 10 hectares of Wheat and at least 5 hectares of Corn. The farmer wants to maximize the profit per liter of water used. Please help the farmer determine the optimal area of land to allocate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\n## The farmer must plant at least 5 hectares of Corn.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5) # area of land for Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # area of land for Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily.\n// {\"hours for smartphone production line\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n// {\"hours for tablet production line\": \"T\", \"range\": \"T >= 0\", \"type\": \"real\"}\n// {\"hours for laptop production line\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily profit. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour. However, the production of laptops incurs an additional maintenance cost of $50 per hour due to complex machinery. The objective is to maximize the total daily profit.\n// The objective function is: Maximize P = 100S + 150T + (200L - 50L) = 100S + 150T + 150L\n\n## Generate Constraint-1:\nThe total available production hours per day across all lines is 24 hours.\n// S + T + L <= 24\n\n## Generate Constraint-2:\nDue to labor regulations, the tablet production line cannot operate more than 10 hours a day.\n// T <= 10\n\n## Generate Constraint-3:\nThe demand for smartphones requires at least 5 hours of production per day.\n// S >= 5",
        "question": "A manufacturing company produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to optimize the production schedule by determining the number of hours each production line should operate daily. The profit per hour for each device is as follows: smartphones yield $100 per hour, tablets yield $150 per hour, and laptops yield $200 per hour, with an additional maintenance cost of $50 per hour for laptops due to complex machinery. The company aims to maximize its daily profit.\n\n| Device       | Profit per Hour | Additional Cost per Hour |\n|--------------|-----------------|--------------------------|\n| Smartphones  | $100            | None                     |\n| Tablets      | $150            | None                     |\n| Laptops      | $200            | $50                      |\n\nThe total available production hours per day across all lines is 24 hours. Due to labor regulations, the tablet production line cannot operate more than 10 hours a day. The demand for smartphones requires at least 5 hours of production per day.\n\nPlease help the company to maximize its total daily profit by determining the optimal number of hours each production line should operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=5) # hours for smartphone production line\nT = model.addVar(vtype=\"CONTINUOUS\", name=\"T\", lb=0) # hours for tablet production line\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # hours for laptop production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 100S + 150T + 150L\nmodel.addCons(obj == 100 * S + 150 * T + 150 * L)\n\n# Add constraints\n## The total available production hours per day across all lines is 24 hours.\nmodel.addCons(S + T + L <= 24)\n## Due to labor regulations, the tablet production line cannot operate more than 10 hours a day.\nmodel.addCons(T <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Smartphone Production Line: \", model.getVal(S))\n    print(\"Hours for Tablet Production Line: \", model.getVal(T))\n    print(\"Hours for Laptop Production Line: \", model.getVal(L))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1214,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation.\n// Total profit for ProductA: ProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\n// Total profit for ProductB: ProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\n// Total profit for ProductC: ProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the labor hours allocated to each product, and the investment in automation technology for each product line to reduce labor hours. The investment in automation technology reduces the labor hours required per unit of product. The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology for that product line. The initial labor hours per unit for ProductA is 2 hours, for ProductB is 3 hours, and for ProductC is 4 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products, considering the cost of labor and investment in automation. The company has a total of 10,000 labor hours available for the month.\n\nPlease help the company to maximize the total profit from all products, considering the cost of labor and investment in automation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0)  # labor hours per unit of ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0)  # labor hours per unit of ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0)  # labor hours per unit of ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # investment in automation for ProductC\n\n# Define objective function\n## The labor hours per unit of each product decrease by 0.1 hours for every $1,000 invested in automation technology\nLaborHoursA = 2 - 0.1 * AutomationA / 1000\nLaborHoursB = 3 - 0.1 * AutomationB / 1000\nLaborHoursC = 4 - 0.1 * AutomationC / 1000\n## Total profit for each product\nProfitA = (100 - 2 * LaborHoursA) * QuantityA - AutomationA\nProfitB = (150 - 3 * LaborHoursB) * QuantityB - AutomationB\nProfitC = (200 - 4 * LaborHoursC) * QuantityC - AutomationC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 10,000 labor hours available for the month.\nmodel.addCons(LaborHoursA * QuantityA + LaborHoursB * QuantityB + LaborHoursC * QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborHoursC))\n    print(\"Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company aims to maximize the total daily deliveries while minimizing the total cost.\n// TotalCost = 100 * T + 50 * V + 10 * B\n// TotalDeliveries = 100 * T + 75 * V + 20 * B\n// So, the objective function is: Minimize (TotalCost - TotalDeliveries)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 per day for vehicle operations.\n// 100 * T + 50 * V + 10 * B <= 5000",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and bikes, each used for different delivery distances and volumes. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption and maintenance cost per vehicle per day are as follows: Trucks cost $100, Vans cost $50, and Bikes cost $10. The efficiency of each vehicle type is inversely proportional to its cost, with Trucks having an efficiency of 100 deliveries per day, Vans 75 deliveries per day, and Bikes 20 deliveries per day. The company has a budget of $5000 per day for vehicle operations. Please help the company to maximize the total daily deliveries while minimizing the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * T + 50 * V + 10 * B\nTotalDeliveries = 100 * T + 75 * V + 20 * B\n## the objective function is: Minimize (TotalCost - TotalDeliveries)\n## convert the subtraction to addition\nmodel.addCons(obj == TotalCost + (-1) * TotalDeliveries)\n\n# Add constraints\n## The company has a budget of $5000 per day for vehicle operations.\nmodel.addCons(100 * T + 50 * V + 10 * B <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Cost-Efficiency Difference: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The city needs to determine the number of each type of solar panel to install in each district.\n// {\"number of solar panels of type A\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type B\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type C\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels of type D\": \"PanelD\", \"range\": \"PanelD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years.\nThe efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years.\nThe efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years.\nThe efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years.\nThe city wants to maximize the total energy output over the lifespan of the panels while minimizing the total cost.\n// EnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\n// TotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n// So, the objective function is: Maximize (EnergyOutput / TotalCost)\n\n## Generate Constraint-1:\nThe city has a budget of $50,000 for the installation of solar panels.\n// 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000\n\n## Generate Constraint-2:\nThe total number of solar panels installed should not exceed 500.\n// PanelA + PanelB + PanelC + PanelD <= 500\n\n## Generate Constraint-3:\nAt least 20% of the total budget should be spent on the most efficient solar panel (type D).\n// 250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD)",
        "question": "A city is planning to install solar panels on rooftops across different districts to reduce energy costs and carbon emissions. The city has identified four types of solar panels (A, B, C, D) with varying efficiencies and costs. The efficiency of solar panel A is 0.15 kWh/day, cost is $100, and lifespan is 10 years. The efficiency of solar panel B is 0.20 kWh/day, cost is $150, and lifespan is 12 years. The efficiency of solar panel C is 0.25 kWh/day, cost is $200, and lifespan is 15 years. The efficiency of solar panel D is 0.30 kWh/day, cost is $250, and lifespan is 20 years. The city has a budget of $50,000 for the installation of solar panels and wants to ensure that the total number of solar panels installed does not exceed 500. Additionally, at least 20% of the total budget should be spent on the most efficient solar panel (type D). The city aims to maximize the total energy output over the lifespan of the panels while minimizing the total cost. Please help the city determine the number of each type of solar panel to install in each district.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of solar panels of type A\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of solar panels of type B\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of solar panels of type C\nPanelD = model.addVar(vtype=\"INTEGER\", name=\"PanelD\", lb=0) # number of solar panels of type D\n\n# Define objective function\nEnergyOutput = 0.15 * PanelA + 0.20 * PanelB + 0.25 * PanelC + 0.30 * PanelD\nTotalCost = 100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (EnergyOutput / TotalCost)\n# convert the division to multiplication\nmodel.addCons(obj * TotalCost == EnergyOutput)\n\n# Add constraints\n# The city has a budget of $50,000 for the installation of solar panels.\nmodel.addCons(100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD <= 50000)\n# The total number of solar panels installed should not exceed 500.\nmodel.addCons(PanelA + PanelB + PanelC + PanelD <= 500)\n# At least 20% of the total budget should be spent on the most efficient solar panel (type D).\nmodel.addCons(250 * PanelD >= 0.20 * (100 * PanelA + 150 * PanelB + 200 * PanelC + 250 * PanelD))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels of Type A: \", model.getVal(PanelA))\n    print(\"Number of Solar Panels of Type B: \", model.getVal(PanelB))\n    print(\"Number of Solar Panels of Type C: \", model.getVal(PanelC))\n    print(\"Number of Solar Panels of Type D: \", model.getVal(PanelD))\n    print(\"Maximized Energy Output per Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation.\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"amount of energy storage\": \"E\", \"range\": \"E >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects. The efficiency of wind turbines also decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage.\n// Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\n// Installation_cost = 1000 * S + 1500 * W + 2000 * E\n// Storage_cost = 50 * E^2\n// So, the objective function is: Maximize (Energy_output - Installation_cost - Storage_cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for installation and storage costs.\n// 1000 * S + 1500 * W + 2000 * E + 50 * E^2 <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation is limited to 5000 square meters.\n// S + 2 * W <= 5000\n\n## Generate Constraint-3:\nThe company must ensure that at least 50 solar panels and 30 wind turbines are installed.\n// S >= 50; W >= 30",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in different locations. The company needs to determine the number of solar panels (S), wind turbines (W), and the amount of energy storage (E) to maximize the efficiency and profitability of the energy generation. The efficiency of solar panels decreases nonlinearly with the number of installed panels due to shading effects. The efficiency of wind turbines also decreases nonlinearly with the number of installed turbines due to wind interference. The cost of energy storage increases nonlinearly with the amount of storage due to economies of scale. The company aims to maximize the total energy output minus the total cost of installation and storage. The company has a budget of $100,000 for installation and storage costs. The total area available for installation is limited to 5000 square meters. The company must ensure that at least 50 solar panels and 30 wind turbines are installed. Please help the company to determine the optimal number of solar panels, wind turbines, and the amount of energy storage to maximize the total energy output minus the total cost of installation and storage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50)  # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=30)  # number of wind turbines\nE = model.addVar(vtype=\"CONTINUOUS\", name=\"E\", lb=0)  # amount of energy storage\n\n# Define objective function\n# Energy_output = (S * (1 - 0.01 * S^2)) + (W * (1 - 0.02 * W^2))\n# Installation_cost = 1000 * S + 1500 * W + 2000 * E\n# Storage_cost = 50 * E^2\n# Maximize (Energy_output - Installation_cost - Storage_cost)\nEnergy_output = S * (1 - 0.01 * S**2) + W * (1 - 0.02 * W**2)\nInstallation_cost = 1000 * S + 1500 * W + 2000 * E\nStorage_cost = 50 * E**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_output - Installation_cost - Storage_cost)\n\n# Add constraints\n# The company has a budget of $100,000 for installation and storage costs.\nmodel.addCons(1000 * S + 1500 * W + 2000 * E + 50 * E**2 <= 100000)\n# The total area available for installation is limited to 5000 square meters.\nmodel.addCons(S + 2 * W <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Amount of Energy Storage: \", model.getVal(E))\n    print(\"Maximized Energy Output - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day.\n// Fuel_Consumption_Small = 1000 / 10 * SmallTrucks\n// Fuel_Consumption_Medium = 1000 / 15 * MediumTrucks\n// Fuel_Consumption_Large = 1000 / 20 * LargeTrucks\n// So, the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 per day for fuel expenses.\n// (1000 / 10 * SmallTrucks * Fuel_Cost_Small) + (1000 / 15 * MediumTrucks * Fuel_Cost_Medium) + (1000 / 20 * LargeTrucks * Fuel_Cost_Large) <= 50000\n\n## Generate Constraint-2:\nThe total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters.\n// (Capacity_Small * SmallTrucks) + (Capacity_Medium * MediumTrucks) + (Capacity_Large * LargeTrucks) >= 10000\n\n## Generate Constraint-3:\nThe company can only afford to operate a maximum of 50 trucks in total.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. The company operates three types of trucks: small, medium, and large, each with different capacities and fuel efficiencies. The company needs to determine the optimal number of each type of truck to maximize fuel efficiency while meeting delivery demands. The fuel efficiency for small trucks is 10 km/liter, for medium trucks is 15 km/liter, and for large trucks is 20 km/liter. The company wants to minimize the total fuel consumption per day, given that each truck type covers a specific distance per day. The company has a total budget of $50,000 per day for fuel expenses. The total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters. The company can only afford to operate a maximum of 50 trucks in total. Please help the company to determine the optimal number of each type of truck to maximize fuel efficiency while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_Small = 1000 / 10 * SmallTrucks\nFuel_Consumption_Medium = 1000 / 15 * MediumTrucks\nFuel_Consumption_Large = 1000 / 20 * LargeTrucks\n## the objective function is: Minimize (Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\nmodel.addCons(obj == Fuel_Consumption_Small + Fuel_Consumption_Medium + Fuel_Consumption_Large)\n\n# Add constraints\n## The company has a total budget of $50,000 per day for fuel expenses.\nFuel_Cost_Small = 1  # assuming cost per liter for simplicity\nFuel_Cost_Medium = 1  # assuming cost per liter for simplicity\nFuel_Cost_Large = 1  # assuming cost per liter for simplicity\nmodel.addCons((1000 / 10 * SmallTrucks * Fuel_Cost_Small) + (1000 / 15 * MediumTrucks * Fuel_Cost_Medium) + (1000 / 20 * LargeTrucks * Fuel_Cost_Large) <= 50000)\n## The total capacity of the trucks must meet the daily delivery demand of 10,000 cubic meters.\nCapacity_Small = 100  # assuming capacity of small truck\nCapacity_Medium = 200  # assuming capacity of medium truck\nCapacity_Large = 300  # assuming capacity of large truck\nmodel.addCons((Capacity_Small * SmallTrucks) + (Capacity_Medium * MediumTrucks) + (Capacity_Large * LargeTrucks) >= 10000)\n## The company can only afford to operate a maximum of 50 trucks in total.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The efficiency of workers varies per product line, and the company aims to optimize its production strategy.\n// {\"production quantity of ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company wants to maximize the total daily profit, considering both the revenue from product sales and the labor costs.\n// Profit_ProductA = ProductAQty * 50 - WorkersA * 100\n// Profit_ProductB = ProductBQty * 70 - WorkersB * 100\n// Profit_ProductC = ProductCQty * 60 - WorkersC * 100\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// WorkersA + WorkersB + WorkersC <= 50\n\n## Generate Constraint-2:\nThe production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\n// ProductAQty <= 100\n// ProductBQty <= 150\n// ProductCQty <= 120\n\n## Generate Constraint-3:\nDue to the complexity of ProductC, each unit requires at least 2 workers.\n// WorkersC >= 2 * ProductCQty\n\n## Generate Constraint-4:\nThe company has a policy to ensure that at least 10% of the total workers are assigned to ProductA.\n// WorkersA >= 0.1 * (WorkersA + WorkersB + WorkersC)\n\n## Generate Constraint-5:\nThe total production quantity of all products must not exceed 300 units per day.\n// ProductAQty + ProductBQty + ProductCQty <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product per day, as well as the number of workers assigned to each product line. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $60. The labor cost per worker is $100 per day. The company has a total of 50 workers available and a policy to ensure that at least 10% of the total workers are assigned to ProductA. The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day. Due to the complexity of ProductC, each unit requires at least 2 workers. The total production quantity of all products must not exceed 300 units per day.\n\nPlease help the company to maximize the total daily profit, considering both the revenue from product sales and the labor costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity of ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity of ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\n\n# Define objective function\nProfit_ProductA = ProductAQty * 50 - WorkersA * 100\nProfit_ProductB = ProductBQty * 70 - WorkersB * 100\nProfit_ProductC = ProductCQty * 60 - WorkersC * 100\n# So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\n# The company has a total of 50 workers available.\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 50)\n# The production capacity for ProductA is limited to 100 units per day, ProductB to 150 units per day, and ProductC to 120 units per day.\nmodel.addCons(ProductAQty <= 100)\nmodel.addCons(ProductBQty <= 150)\nmodel.addCons(ProductCQty <= 120)\n# Due to the complexity of ProductC, each unit requires at least 2 workers.\nmodel.addCons(WorkersC >= 2 * ProductCQty)\n# The company has a policy to ensure that at least 10% of the total workers are assigned to ProductA.\nmodel.addCons(WorkersA >= 0.1 * (WorkersA + WorkersB + WorkersC))\n# The total production quantity of all products must not exceed 300 units per day.\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductCQty))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company has the option to invest in a new technology that can increase the efficiency of production, but at a cost.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit without the new technology is $30 for ProductA, $40 for ProductB, and $50 for ProductC. If the new technology is invested in, the production cost per unit decreases by $5 for each product. The investment cost for the new technology is $100,000. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_ProductA = (50 - 30 + 0.5 * TechInvestment) * ProductAQty\n// Total profit for ProductB: Profit_ProductB = (70 - 40 + 0.5 * TechInvestment) * ProductBQty\n// Total profit for ProductC: Profit_ProductC = (90 - 50 + 0.5 * TechInvestment) * ProductCQty\n// Total investment cost: InvestmentCost = 100,000 * TechInvestment\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC - InvestmentCost)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month.\n// ProductAQty + ProductBQty + ProductCQty <= 10,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. Additionally, the company has the option to invest in a new technology that can increase the efficiency of production, but at a cost. The profit per unit and the production cost per unit without the new technology, as well as the effect of the new technology on the production cost, are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit (without tech) | Reduction in Cost per Unit (with tech) |\n|---------|-----------------|----------------------------------------|----------------------------------------|\n| ProductA | $50             | $30                                    | $5                                     |\n| ProductB | $70             | $40                                    | $5                                     |\n| ProductC | $90             | $50                                    | $5                                     |\n\nThe investment cost for the new technology is $100,000. The company has a total production capacity of 10,000 units per month. Please help the company to maximize the total profit, considering the investment in the new technology and the production quantities of each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfit_ProductA = (50 - 30 + 0.5 * TechInvestment) * ProductAQty\nProfit_ProductB = (70 - 40 + 0.5 * TechInvestment) * ProductBQty\nProfit_ProductC = (90 - 50 + 0.5 * TechInvestment) * ProductCQty\nInvestmentCost = 100000 * TechInvestment\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC - InvestmentCost)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1341,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"W4\", \"range\": \"W4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"W5\", \"range\": \"W5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines.\n// The total production per hour: P = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 + W4 + W5 <= 50\n\n## Generate Constraint-2:\nEach machine has a maximum capacity for workers. Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\n// W1 <= 10; W2 <= 12; W3 <= 15; W4 <= 18; W5 <= 20",
        "question": "A manufacturing plant produces three types of electronic components using different machines. The plant manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units, Machine 3 produces 15 units, Machine 4 produces 18 units, and Machine 5 produces 20 units. The plant aims to maximize the total production of all machines. There are a total of 50 workers available. Additionally, each machine has a maximum capacity for workers: Machine 1 can handle up to 10 workers, Machine 2 can handle up to 12 workers, Machine 3 can handle up to 15 workers, Machine 4 can handle up to 18 workers, and Machine 5 can handle up to 20 workers.\nPlease help the plant manager determine the optimal number of workers to assign to each machine to maximize the total production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\nW4 = model.addVar(vtype=\"INTEGER\", name=\"W4\", lb=0) # number of workers on machine 4\nW5 = model.addVar(vtype=\"INTEGER\", name=\"W5\", lb=0) # number of workers on machine 5\n\n# Define objective function\nP = 10 * W1 + 12 * W2 + 15 * W3 + 18 * W4 + 20 * W5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 + W4 + W5 <= 50)\nmodel.addCons(W1 <= 10)\nmodel.addCons(W2 <= 12)\nmodel.addCons(W3 <= 15)\nmodel.addCons(W4 <= 18)\nmodel.addCons(W5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Number of Workers on Machine 4: \", model.getVal(W4))\n    print(\"Number of Workers on Machine 5: \", model.getVal(W5))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for ProductA\": \"E_A\", \"range\": \"E_A >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductB\": \"E_B\", \"range\": \"E_B >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for ProductC\": \"E_C\", \"range\": \"E_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is initially $100, which decreases by $1 for every $1000 invested in efficiency enhancement. For ProductB, the initial cost is $150, and for ProductC, it is $200. The selling price per unit of ProductA is $150, ProductB is $200, and ProductC is $250. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 0.001 * E_A)) * Q_A\n// Profit_B = (200 - (150 - 0.001 * E_B)) * Q_B\n// Profit_C = (250 - (200 - 0.001 * E_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for efficiency enhancements.\n// E_A + E_B + E_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// Q_A + Q_B + Q_C <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in enhancing the production efficiency of each product. The efficiency enhancement directly reduces the production cost per unit. The initial production cost per unit, selling price per unit, and the effect of efficiency investment on the production cost are given in the following Table.\n\n| Product | Initial Cost per Unit | Selling Price per Unit | Efficiency Investment Effect |\n|---------|-----------------------|------------------------|------------------------------|\n| ProductA | $100                  | $150                   | $1 reduction per $1000 invested |\n| ProductB | $150                  | $200                   | $1 reduction per $1000 invested |\n| ProductC | $200                  | $250                   | $1 reduction per $1000 invested |\n\nThe company has a total budget of $100,000 for efficiency enhancements. The total production capacity of the company is 5000 units. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities and efficiency investments for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nE_A = model.addVar(vtype=\"CONTINUOUS\", name=\"E_A\", lb=0) # investment in efficiency for ProductA\nE_B = model.addVar(vtype=\"CONTINUOUS\", name=\"E_B\", lb=0) # investment in efficiency for ProductB\nE_C = model.addVar(vtype=\"CONTINUOUS\", name=\"E_C\", lb=0) # investment in efficiency for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 0.001 * E_A)) * Q_A\nProfit_B = (200 - (150 - 0.001 * E_B)) * Q_B\nProfit_C = (250 - (200 - 0.001 * E_C)) * Q_C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for efficiency enhancements.\nmodel.addCons(E_A + E_B + E_C <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(Q_A + Q_B + Q_C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Investment in Efficiency for ProductA: \", model.getVal(E_A))\n    print(\"Investment in Efficiency for ProductB: \", model.getVal(E_B))\n    print(\"Investment in Efficiency for ProductC: \", model.getVal(E_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"daily operating cost for small trucks\": \"SmallCost\", \"range\": \"SmallCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for medium trucks\": \"MediumCost\", \"range\": \"MediumCost >= 0\", \"type\": \"real\"}\n// {\"daily operating cost for large trucks\": \"LargeCost\", \"range\": \"LargeCost >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The volume capacity of a small truck is 1000 units, a medium truck is 2000 units, and a large truck is 3000 units. The daily demand for goods is 10,000 units.\n// TotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\n// The objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\n// 1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company has identified three types of trucks (Small, Medium, and Large) that can be used for transportation. The company needs to determine the number of each type of truck to purchase and the daily operating cost for each type of truck. The volume capacity and daily operating cost for each type of truck are given in the following Table.\n\n| Truck Type | Volume Capacity | Daily Operating Cost |\n|------------|-----------------|----------------------|\n| Small      | 1000 units      | SmallCost            |\n| Medium     | 2000 units      | MediumCost           |\n| Large      | 3000 units      | LargeCost            |\n\nThe company aims to minimize the total daily operating cost while ensuring that the fleet can handle the required daily volume of goods. The daily demand for goods is 10,000 units. The total volume capacity of the fleet must meet or exceed the daily demand of 10,000 units.\nPlease help the company to determine the optimal number of each type of truck to purchase and their respective daily operating costs to minimize the total daily operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\nSmallCost = model.addVar(vtype=\"CONTINUOUS\", name=\"SmallCost\", lb=0)  # daily operating cost for small trucks\nMediumCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumCost\", lb=0)  # daily operating cost for medium trucks\nLargeCost = model.addVar(vtype=\"CONTINUOUS\", name=\"LargeCost\", lb=0)  # daily operating cost for large trucks\n\n# Define objective function\nTotalCost = SmallTrucks * SmallCost + MediumTrucks * MediumCost + LargeTrucks * LargeCost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 2000 * MediumTrucks + 3000 * LargeTrucks >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Daily Operating Cost for Small Trucks: \", model.getVal(SmallCost))\n    print(\"Daily Operating Cost for Medium Trucks: \", model.getVal(MediumCost))\n    print(\"Daily Operating Cost for Large Trucks: \", model.getVal(LargeCost))\n    print(\"Minimized Total Daily Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operating cost per TruckA is $5000, and the revenue per TruckA is $7000. \nThe operating cost per TruckB is $6000, and the revenue per TruckB is $8000. \nThe operating cost per TruckC is $7000, and the revenue per TruckC is $9000.\nThe operating cost per TruckD is $8000, and the revenue per TruckD is $10000.\nThe operating cost per TruckE is $9000, and the revenue per TruckE is $11000.\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company wants to maximize the total net profit from operating the trucks.\n// NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\n// NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\n// NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\n// NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\n// NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\n// So, the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for purchasing and maintaining the trucks.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500,000",
        "question": "A logistics company operates five different types of vehicles: TruckA, TruckB, TruckC, TruckD, and TruckE. They need to determine the number of each type of vehicle to deploy for the next month to optimize their operations.\nThe operating cost per TruckA is $5000, and the revenue per TruckA is $7000. \nThe operating cost per TruckB is $6000, and the revenue per TruckB is $8000. \nThe operating cost per TruckC is $7000, and the revenue per TruckC is $9000.\nThe operating cost per TruckD is $8000, and the revenue per TruckD is $10000.\nThe operating cost per TruckE is $9000, and the revenue per TruckE is $11000.\nDue to economies of scale, the operating cost decreases by $0.001 for each additional Truck of the same type operated. The company has a total budget of $500,000 for purchasing and maintaining the trucks.\nPlease help the company to maximize the total net profit from operating the trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of TruckE\n\n# Define objective function\n## create piecewise variables for piecewise function: NetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA - 1)) * TruckA\nTruckA1 = model.addVar(vtype=\"INTEGER\", name=\"TruckA1\", lb=0, ub=1)\nTruckA2 = model.addVar(vtype=\"INTEGER\", name=\"TruckA2\", lb=1)\nTruckA_b1 = model.addVar(vtype=\"B\", name=\"TruckA_b1\")\nTruckA_b2 = model.addVar(vtype=\"B\", name=\"TruckA_b2\")\nmodel.addCons(TruckA_b1 + TruckA_b2 == 1)\nmodel.addCons(TruckA == TruckA1*TruckA_b1 + TruckA2*TruckA_b2)\nNetProfit_TruckA = (7000 - 5000 - 0.001 * (TruckA2 - 1)) * TruckA2 * TruckA_b2\n## create piecewise variables for piecewise function: NetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB - 1)) * TruckB\nTruckB1 = model.addVar(vtype=\"INTEGER\", name=\"TruckB1\", lb=0, ub=1)\nTruckB2 = model.addVar(vtype=\"INTEGER\", name=\"TruckB2\", lb=1)\nTruckB_b1 = model.addVar(vtype=\"B\", name=\"TruckB_b1\")\nTruckB_b2 = model.addVar(vtype=\"B\", name=\"TruckB_b2\")\nmodel.addCons(TruckB_b1 + TruckB_b2 == 1)\nmodel.addCons(TruckB == TruckB1*TruckB_b1 + TruckB2*TruckB_b2)\nNetProfit_TruckB = (8000 - 6000 - 0.001 * (TruckB2 - 1)) * TruckB2 * TruckB_b2\n## create piecewise variables for piecewise function: NetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC - 1)) * TruckC\nTruckC1 = model.addVar(vtype=\"INTEGER\", name=\"TruckC1\", lb=0, ub=1)\nTruckC2 = model.addVar(vtype=\"INTEGER\", name=\"TruckC2\", lb=1)\nTruckC_b1 = model.addVar(vtype=\"B\", name=\"TruckC_b1\")\nTruckC_b2 = model.addVar(vtype=\"B\", name=\"TruckC_b2\")\nmodel.addCons(TruckC_b1 + TruckC_b2 == 1)\nmodel.addCons(TruckC == TruckC1*TruckC_b1 + TruckC2*TruckC_b2)\nNetProfit_TruckC = (9000 - 7000 - 0.001 * (TruckC2 - 1)) * TruckC2 * TruckC_b2\n## create piecewise variables for piecewise function: NetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD - 1)) * TruckD\nTruckD1 = model.addVar(vtype=\"INTEGER\", name=\"TruckD1\", lb=0, ub=1)\nTruckD2 = model.addVar(vtype=\"INTEGER\", name=\"TruckD2\", lb=1)\nTruckD_b1 = model.addVar(vtype=\"B\", name=\"TruckD_b1\")\nTruckD_b2 = model.addVar(vtype=\"B\", name=\"TruckD_b2\")\nmodel.addCons(TruckD_b1 + TruckD_b2 == 1)\nmodel.addCons(TruckD == TruckD1*TruckD_b1 + TruckD2*TruckD_b2)\nNetProfit_TruckD = (10000 - 8000 - 0.001 * (TruckD2 - 1)) * TruckD2 * TruckD_b2\n## create piecewise variables for piecewise function: NetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE - 1)) * TruckE\nTruckE1 = model.addVar(vtype=\"INTEGER\", name=\"TruckE1\", lb=0, ub=1)\nTruckE2 = model.addVar(vtype=\"INTEGER\", name=\"TruckE2\", lb=1)\nTruckE_b1 = model.addVar(vtype=\"B\", name=\"TruckE_b1\")\nTruckE_b2 = model.addVar(vtype=\"B\", name=\"TruckE_b2\")\nmodel.addCons(TruckE_b1 + TruckE_b2 == 1)\nmodel.addCons(TruckE == TruckE1*TruckE_b1 + TruckE2*TruckE_b2)\nNetProfit_TruckE = (11000 - 9000 - 0.001 * (TruckE2 - 1)) * TruckE2 * TruckE_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE\nmodel.addCons(obj == NetProfit_TruckA + NetProfit_TruckB + NetProfit_TruckC + NetProfit_TruckD + NetProfit_TruckE)\n\n# Add constraints\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC + 8000 * TruckD + 9000 * TruckE <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $100, the water requirement is 5 units, and the labor requirement is 2 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 7 units, and the labor requirement is 3 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 9 units, and the labor requirement is 4 hours.\nFor Crop D, the expected profit per acre is $250, the water requirement is 11 units, and the labor requirement is 5 hours.\nFor Crop E, the expected profit per acre is $300, the water requirement is 13 units, and the labor requirement is 6 hours.\nThe farm aims to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).\n// Expected profit of A: Profit_A = 100 * A\n// Expected profit of B: Profit_B = 150 * B\n// Expected profit of C: Profit_C = 200 * C\n// Expected profit of D: Profit_D = 250 * D\n// Expected profit of E: Profit_E = 300 * E\n// Resource usage of A: Resource_A = 5 * A + 2 * A\n// Resource usage of B: Resource_B = 7 * B + 3 * B\n// Resource usage of C: Resource_C = 9 * C + 4 * C\n// Resource usage of D: Resource_D = 11 * D + 5 * D\n// Resource usage of E: Resource_E = 13 * E + 6 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n\n## Generate Constraint-1:\nThe farm has a total of 1000 units of water available for the season.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000\n\n## Generate Constraint-2:\nThe farm has a total of 400 hours of labor available for the season.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400\n\n## Generate Constraint-3:\nThe farm wants to allocate at least 10 acres to each crop.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10\n\n## Generate Constraint-4:\nThe farm wants to ensure that the total acreage of Crop D does not exceed the combined acreage of Crops A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe farm wants to ensure that the total acreage of Crop E does not exceed the combined acreage of Crops A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\nFor Crop A, the expected profit per acre is $100, the water requirement is 5 units, and the labor requirement is 2 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 7 units, and the labor requirement is 3 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 9 units, and the labor requirement is 4 hours.\nFor Crop D, the expected profit per acre is $250, the water requirement is 11 units, and the labor requirement is 5 hours.\nFor Crop E, the expected profit per acre is $300, the water requirement is 13 units, and the labor requirement is 6 hours.\nThe farm has a total of 1000 units of water available for the season. The farm has a total of 400 hours of labor available for the season. The farm wants to allocate at least 10 acres to each crop. The farm wants to ensure that the total acreage of Crop D does not exceed the combined acreage of Crops A, B, and C. The farm also wants to ensure that the total acreage of Crop E does not exceed the combined acreage of Crops A, B, C, and D.\nPlease help the farm to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 10 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of acres for crop D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of acres for crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nProfit_D = 250 * D\nProfit_E = 300 * E\nResource_A = 5 * A + 2 * A\nResource_B = 7 * B + 3 * B\nResource_C = 9 * C + 4 * C\nResource_D = 11 * D + 5 * D\nResource_E = 13 * E + 6 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has a total of 1000 units of water available for the season.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n## The farm has a total of 400 hours of labor available for the season.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400)\n## The farm wants to ensure that the total acreage of Crop D does not exceed the combined acreage of Crops A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The farm wants to ensure that the total acreage of Crop E does not exceed the combined acreage of Crops A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Number of Acres for Crop D: \", model.getVal(D))\n    print(\"Number of Acres for Crop E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1397,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging).\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of hours for Assembly\": \"AssemblyHours\", \"range\": \"AssemblyHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Testing\": \"TestingHours\", \"range\": \"TestingHours >= 0\", \"type\": \"real\"}\n// {\"number of hours for Packaging\": \"PackagingHours\", \"range\": \"PackagingHours >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production.\n// Profit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\n// Profit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\n// Profit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production hours available in the Assembly department is 1000 hours.\n// AssemblyHours <= 1000",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the number of hours to allocate for production in each department (Assembly, Testing, and Packaging). The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. The cost of assembly per hour is $50, testing per hour is $30, and packaging per hour is $20. The company wants to maximize the total profit while considering the costs of production. The total production hours available in the Assembly department is 1000 hours. Please help the company to determine the optimal number of units to produce for each device and the optimal allocation of hours for each production department to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\nAssemblyHours = model.addVar(vtype=\"CONTINUOUS\", name=\"AssemblyHours\", lb=0) # number of hours for Assembly\nTestingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"TestingHours\", lb=0) # number of hours for Testing\nPackagingHours = model.addVar(vtype=\"CONTINUOUS\", name=\"PackagingHours\", lb=0) # number of hours for Packaging\n\n# Define objective function\nProfit_A = 100 * UnitsA - (AssemblyHours + TestingHours + PackagingHours) * 50\nProfit_B = 150 * UnitsB - (AssemblyHours + TestingHours + PackagingHours) * 30\nProfit_C = 200 * UnitsC - (AssemblyHours + TestingHours + PackagingHours) * 20\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production hours available in the Assembly department is 1000 hours.\nmodel.addCons(AssemblyHours <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Assembly Hours: \", model.getVal(AssemblyHours))\n    print(\"Testing Hours: \", model.getVal(TestingHours))\n    print(\"Packaging Hours: \", model.getVal(PackagingHours))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency.\n// {\"number of small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for small trucks per km\": \"FuelRateSmall\", \"range\": \"FuelRateSmall > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for medium trucks per km\": \"FuelRateMedium\", \"range\": \"FuelRateMedium > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for large trucks per km\": \"FuelRateLarge\", \"range\": \"FuelRateLarge > 0\", \"type\": \"real\"}\n// {\"distance traveled by each small truck per day\": \"DistanceSmall\", \"range\": \"DistanceSmall >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each medium truck per day\": \"DistanceMedium\", \"range\": \"DistanceMedium >= 0\", \"type\": \"real\"}\n// {\"distance traveled by each large truck per day\": \"DistanceLarge\", \"range\": \"DistanceLarge >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily fuel consumption across all trucks.\n// TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\n// So, the objective function is: Minimize TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks of different sizes (small, medium, large) to purchase and the routes each truck will take to minimize fuel consumption and maximize efficiency. The company aims to minimize the total daily fuel consumption across all trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000. The company has a budget of $100,000 for purchasing trucks. The fuel consumption rate and the distance traveled by each type of truck per day are given in the following Table.\n\n| Truck Size | Fuel Consumption Rate per km | Distance Traveled per Day |\n|------------|------------------------------|---------------------------|\n| Small      | FuelRateSmall                | DistanceSmall             |\n| Medium     | FuelRateMedium               | DistanceMedium            |\n| Large      | FuelRateLarge                | DistanceLarge             |\n\nPlease help the company determine the optimal number of small, medium, and large trucks to purchase within the budget while minimizing the total daily fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of large trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelRateSmall = 0.1  # example value, replace with actual data\nFuelRateMedium = 0.15  # example value, replace with actual data\nFuelRateLarge = 0.2  # example value, replace with with actual data\nDistanceSmall = 100  # example value, replace with actual data\nDistanceMedium = 150  # example value, replace with actual data\nDistanceLarge = 200  # example value, replace with actual data\n## TotalFuelConsumption = SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge\nmodel.addCons(obj == SmallTrucks * FuelRateSmall * DistanceSmall + MediumTrucks * FuelRateMedium * DistanceMedium + LargeTrucks * FuelRateLarge * DistanceLarge)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing trucks. The cost of a small truck is $20,000, a medium truck is $30,000, and a large truck is $40,000.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 40000 * LargeTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company has 5 different machines for producing widgets. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency.\n// {\"number of workers on machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 4\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 5\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company produces 3 types of widgets on the 5 machines. \nOn machine 1, each worker produces 10 units of widget 1, 15 units of widget 2, and 20 units of widget 3 per hour. \nOn machine 2, each worker produces 20 units of widget 1, 25 units of widget 2, and 30 units of widget 3 per hour. \nOn machine 3, each worker produces 30 units of widget 1, 35 units of widget 2, and 40 units of widget 3 per hour. \nOn machine 4, each worker produces 40 units of widget 1, 45 units of widget 2, and 50 units of widget 3 per hour. \nOn machine 5, each worker produces 50 units of widget 1, 55 units of widget 2, and 60 units of widget 3 per hour. \nThe company needs to produce at least 300 units of widget 1, at least 400 units of widget 2, and at least 500 units of widget 3. The five machines can only be opened or closed at the same time. Please determine the minimum production time to meet the daily demand.\n// The production time for widget 1: T1 = 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5)\n// The production time for widget 2: T2 = 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5)\n// The production time for widget 3: T3 = 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5)\n// So, the objective function is: Minimize max(T1, T2, T3)\n// Minimize max(300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5), 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5), 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5))\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// M1 + M2 + M3 + M4 + M5 <= 60\n\n## Generate Constraint-2:\nEach machine can be utilized by up to 12 workers at a time.\n// M1 <= 12; M2 <= 12; M3 <= 12; M4 <= 12; M5 <= 12",
        "question": "A manufacturing company has 5 different machines for producing widgets. The manager needs to determine the number of workers to assign to each machine to optimize production efficiency. The production rates for each worker on each machine are given in the following Table.\n\n| Machine | Widget 1 Units/Hour | Widget 2 Units/Hour | Widget 3 Units/Hour |\n|---------|---------------------|---------------------|---------------------|\n| 1       | 10                  | 15                  | 20                  |\n| 2       | 20                  | 25                  | 30                  |\n| 3       | 30                  | 35                  | 40                  |\n| 4       | 40                  | 45                  | 50                  |\n| 5       | 50                  | 55                  | 60                  |\n\nThe company needs to produce at least 300 units of widget 1, at least 400 units of widget 2, and at least 500 units of widget 3. The five machines can only be opened or closed at the same time. There are total 60 workers available, and each machine can be utilized by up to 12 workers at a time. Please determine the minimum production time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of workers on machine 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of workers on machine 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of workers on machine 3\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of workers on machine 4\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of workers on machine 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for widget 1: T1 = 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5)\n## The production time for widget 2: T2 = 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5)\n## The production time for widget 3: T3 = 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 == 300 / (10 * M1 + 20 * M2 + 30 * M3 + 40 * M4 + 50 * M5))\nmodel.addCons(T2 == 400 / (15 * M1 + 25 * M2 + 35 * M3 + 45 * M4 + 55 * M5))\nmodel.addCons(T3 == 500 / (20 * M1 + 30 * M2 + 40 * M3 + 50 * M4 + 60 * M5))\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(M1 + M2 + M3 + M4 + M5 <= 60)\n## Each machine can be utilized by up to 12 workers at a time.\nmodel.addCons(M1 <= 12)\nmodel.addCons(M2 <= 12)\nmodel.addCons(M3 <= 12)\nmodel.addCons(M4 <= 12)\nmodel.addCons(M5 <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(M1))\n    print(\"Number of workers on machine 2: \", model.getVal(M2))\n    print(\"Number of workers on machine 3: \", model.getVal(M3))\n    print(\"Number of workers on machine 4: \", model.getVal(M4))\n    print(\"Number of workers on machine 5: \", model.getVal(M5))\n    print(\"Minimum production time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"available units of resource X\": \"ResourceX\", \"range\": \"ResourceX >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Y\": \"ResourceY\", \"range\": \"ResourceY >= 0\", \"type\": \"integer\"}\n// {\"available units of resource Z\": \"ResourceZ\", \"range\": \"ResourceZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer wants to maximize the total profit from selling all products.\n// Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nEach unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively.\n// 2 * ProductA <= ResourceX\n// 3 * ProductB <= ResourceY\n// 4 * ProductC <= ResourceZ\n// ResourceX <= 100\n// ResourceY <= 150\n// ResourceZ <= 200\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units.\n// ProductA >= 10\n// ProductB >= 20\n// ProductC >= 15\n\n## Generate Constraint-3:\nThe manufacturer has a limit on the total production capacity of 50 units across all products.\n// ProductA + ProductB + ProductC <= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that at least 30% of the total production is of product A.\n// ProductA >= 0.3 * (ProductA + ProductB + ProductC)",
        "question": "A manufacturer produces three types of products (A, B, and C) using three different resources (X, Y, and Z). The manufacturer needs to determine the optimal production quantity for each product to maximize profit while considering the constraints on resource availability and market demand. The profit per unit of product A is $50, product B is $70, and product C is $60. Each unit of product A requires 2 units of resource X, product B requires 3 units of resource Y, and product C requires 4 units of resource Z. The total available units of resource X, Y, and Z are 100, 150, and 200, respectively. The market demand for product A is at least 10 units, for product B is at least 20 units, and for product C is at least 15 units. The manufacturer has a limit on the total production capacity of 50 units across all products. The manufacturer wants to ensure that at least 30% of the total production is of product A. Please help the manufacturer to maximize the total profit from selling all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=20) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=15) # quantity of product C\nResourceX = model.addVar(vtype=\"INTEGER\", name=\"ResourceX\", lb=0, ub=100) # available units of resource X\nResourceY = model.addVar(vtype=\"INTEGER\", name=\"ResourceY\", lb=0, ub=150) # available units of resource Y\nResourceZ = model.addVar(vtype=\"INTEGER\", name=\"ResourceZ\", lb=0, ub=200) # available units of resource Z\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * ProductA <= ResourceX)\nmodel.addCons(3 * ProductB <= ResourceY)\nmodel.addCons(4 * ProductC <= ResourceZ)\nmodel.addCons(ResourceX <= 100)\nmodel.addCons(ResourceY <= 150)\nmodel.addCons(ResourceZ <= 200)\nmodel.addCons(ProductA + ProductB + ProductC <= 50)\nmodel.addCons(ProductA >= 0.3 * (ProductA + ProductB + ProductC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity and operating cost.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per trip for V1 is $100, capacity is 10 packages, and the fuel efficiency is 10 miles per gallon.\nFor V2, the cost per trip is $150, capacity is 15 packages, and the fuel efficiency is 15 miles per gallon.\nFor V3, the cost per trip is $200, capacity is 20 packages, and the fuel efficiency is 20 miles per gallon.\nFor V4, the cost per trip is $250, capacity is 25 packages, and the fuel efficiency is 25 miles per gallon.\nFor V5, the cost per trip is $300, capacity is 30 packages, and the fuel efficiency is 30 miles per gallon.\nThe company wants to minimize the total cost per package delivered (cost per trip divided by capacity).\n// Total_Cost_V1 = 100 * V1 / 10\n// Total_Cost_V2 = 150 * V2 / 15\n// Total_Cost_V3 = 200 * V3 / 20\n// Total_Cost_V4 = 250 * V4 / 25\n// Total_Cost_V5 = 300 * V5 / 30\n// So, the objective function is: Minimize (Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n## Generate Constraint-1:\nThe total number of packages to be delivered is 1000.\n// 10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000",
        "question": "A logistics company operates five different types of vehicles (V1, V2, V3, V4, V5) for delivering packages. Each vehicle has a different capacity and operating cost. The cost per trip for V1 is $100, capacity is 10 packages, and the fuel efficiency is 10 miles per gallon. For V2, the cost per trip is $150, capacity is 15 packages, and the fuel efficiency is 15 miles per gallon. For V3, the cost per trip is $200, capacity is 20 packages, and the fuel efficiency is 20 miles per gallon. For V4, the cost per trip is $250, capacity is 25 packages, and the fuel efficiency is 25 miles per gallon. For V5, the cost per trip is $300, capacity is 30 packages, and the fuel efficiency is 30 miles per gallon. The company wants to minimize the total cost per package delivered (cost per trip divided by capacity). The total number of packages to be delivered is 1000. Please help the company determine the optimal number of each type of vehicle to use for delivering the packages.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of V5 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_V1 = 100 * V1 / 10\nTotal_Cost_V2 = 150 * V2 / 15\nTotal_Cost_V3 = 200 * V3 / 20\nTotal_Cost_V4 = 250 * V4 / 25\nTotal_Cost_V5 = 300 * V5 / 30\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost_V1 + Total_Cost_V2 + Total_Cost_V3 + Total_Cost_V4 + Total_Cost_V5)\n\n# Add constraints\n## The total number of packages to be delivered is 1000.\nmodel.addCons(10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Minimized Cost per Package: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD_Units\", \"range\": \"DeviceD_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, and for DeviceD is $110. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: Cost_DeviceA = 20 * sqrt(DeviceA_Units), Cost_DeviceB = 30 * sqrt(DeviceB_Units), Cost_DeviceC = 40 * sqrt(DeviceC_Units), Cost_DeviceD = 50 * sqrt(DeviceD_Units). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 * sqrt(DeviceA_Units)) * DeviceA_Units\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 * sqrt(DeviceB_Units)) * DeviceB_Units\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 * sqrt(DeviceC_Units)) * DeviceC_Units\n// Total net profit for DeviceD: Profit_DeviceD = (110 - 50 * sqrt(DeviceD_Units)) * DeviceD_Units\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units.\n// DeviceC_Units >= 2 * DeviceA_Units\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, for DeviceC is $20 per unit, and for DeviceD is $25 per unit.\n// 10 * DeviceA_Units + 15 * DeviceB_Units + 20 * DeviceC_Units + 25 * DeviceD_Units <= 30,000",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for each device and the cost of raw materials per unit are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit |\n|--------|-----------------|----------------------------|\n| DeviceA | $50             | $10                        |\n| DeviceB | $70             | $15                        |\n| DeviceC | $90             | $20                        |\n| DeviceD | $110            | $25                        |\n\nThe production cost for each device increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each device is given by: Cost_DeviceA = 20 * sqrt(DeviceA_Units), Cost_DeviceB = 30 * sqrt(DeviceB_Units), Cost_DeviceC = 40 * sqrt(DeviceC_Units), Cost_DeviceD = 50 * sqrt(DeviceD_Units). The company aims to maximize the total net profit.\n\nThe company has a total production capacity of 1000 units per month. Due to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units. The company has a limited budget for raw materials, which is $30,000 per month.\n\nPlease help the company to determine the optimal number of units to produce for each device to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0)\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0)\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0)\nDeviceD_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceD_Units\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit for each device\nProfit_DeviceA = (50 - 20 * pyscipopt.sqrt(DeviceA_Units)) * DeviceA_Units\nProfit_DeviceB = (70 - 30 * pyscipopt.sqrt(DeviceB_Units)) * DeviceB_Units\nProfit_DeviceC = (90 - 40 * pyscipopt.sqrt(DeviceC_Units)) * DeviceC_Units\nProfit_DeviceD = (110 - 50 * pyscipopt.sqrt(DeviceD_Units)) * DeviceD_Units\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units + DeviceD_Units <= 1000)\n## Due to market demand, the number of DeviceC units produced must be at least twice the number of DeviceA units.\nmodel.addCons(DeviceC_Units >= 2 * DeviceA_Units)\n## The company has a limited budget for raw materials, which is $30,000 per month.\nmodel.addCons(10 * DeviceA_Units + 15 * DeviceB_Units + 20 * DeviceC_Units + 25 * DeviceD_Units <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceD_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1480,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints such as production capacity, market demand, and material availability.\n// {\"quantity of Smartphones\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100. For Tablets, it is $150. For Laptops, it is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production exceeds 100 units. The manufacturer wants to maximize the total profit from selling these devices.\n// Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\n// So, the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a rare metal. Smartphones require 5 g, Tablets require 8 g, and Laptops require 10 g of this metal. The total available amount of this metal is 1000 g.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units. For Tablets, it is 300 units. For Laptops, it is 200 units.\n// Smartphone <= 500; Tablet <= 300; Laptop <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 800 units across all device types.\n// Smartphone + Tablet + Laptop <= 800\n\n## Generate Constraint-4:\nTo ensure product quality, the production of Laptops cannot exceed twice the production of Tablets.\n// Laptop <= 2 * Tablet\n\n## Generate Constraint-5:\nThe manufacturer aims to produce at least 100 units of Smartphones to maintain market presence.\n// Smartphone >= 100",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints such as production capacity, market demand, and material availability. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type if the production exceeds 100 units. The production of each device requires a certain amount of a rare metal: Smartphones require 5 g, Tablets require 8 g, and Laptops require 10 g, with a total available amount of 1000 g. The market has a demand limit for each device: Smartphones at 500 units, Tablets at 300 units, and Laptops at 200 units. The manufacturer has a total production capacity of 800 units across all device types. To ensure product quality, the production of Laptops cannot exceed twice the production of Tablets. The manufacturer aims to produce at least 100 units of Smartphones to maintain market presence. Please help the manufacturer to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=100) # quantity of Smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # quantity of Tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\nSmartphone1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone1\", lb=0, ub=100)\nSmartphone2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone2\", lb=100, ub=500)\nSmartphone_b1 = model.addVar(vtype=\"B\", name=\"Smartphone_b1\")\nSmartphone_b2 = model.addVar(vtype=\"B\", name=\"Smartphone_b2\")\nmodel.addCons(Smartphone_b1 + Smartphone_b2 == 1)\nmodel.addCons(Smartphone == Smartphone1*Smartphone_b1 + Smartphone2*Smartphone_b2)\nProfit_Smartphone = 100 * Smartphone1 * Smartphone_b1 + (100 + 0.5 * (Smartphone2 - 100)) * Smartphone2 * Smartphone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=300)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=200)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 200 * Laptop1 * Laptop_b1 + (200 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Smartphone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(Smartphone <= 500)\nmodel.addCons(Tablet <= 300)\nmodel.addCons(Laptop <= 200)\nmodel.addCons(Smartphone + Tablet + Laptop <= 800)\nmodel.addCons(Laptop <= 2 * Tablet)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(Smartphone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck.\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Light trucks\": \"LightTrucks\", \"range\": \"LightTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Heavy trucks\": \"HeavyUpgrade\", \"range\": \"HeavyUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"MediumUpgrade\", \"range\": \"MediumUpgrade >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Light trucks\": \"LightUpgrade\", \"range\": \"LightUpgrade >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n// Revenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\n// Revenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\n// Revenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\n// So, the objective function is: Maximize (Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades.\n// HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks the company can manage is limited to 20.\n// HeavyTrucks + MediumTrucks + LightTrucks <= 20\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must have at least 5 Heavy trucks and cannot have more than 10 Light trucks.\n// HeavyTrucks >= 5; LightTrucks <= 10\n\n## Generate Constraint-4:\nThe company must invest at least $10,000 in total for fuel efficiency upgrades.\n// HeavyUpgrade + MediumUpgrade + LightUpgrade >= 10000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company needs to decide on the number of trucks to purchase for three different types of cargo: Heavy, Medium, and Light. Additionally, the company must determine the fuel efficiency upgrades to invest in for each type of truck, which will affect the operational costs and revenue generated per truck. The revenue generated per truck is affected by the fuel efficiency upgrades. For each $1000 invested in upgrades, the operational cost decreases by $100 per month for Heavy trucks, $150 per month for Medium trucks, and $200 per month for Light trucks. The base revenue per month for Heavy trucks is $5000, for Medium trucks is $3000, and for Light trucks is $2000. The company aims to maximize the total monthly revenue from all trucks.\n\n| Type       | Base Revenue per Month | Cost Reduction per $1000 Upgrade |\n|------------|------------------------|---------------------------------|\n| Heavy      | $5000                  | $100                           |\n| Medium     | $3000                  | $150                           |\n| Light      | $2000                  | $200                           |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fuel efficiency upgrades. The total number of trucks the company can manage is limited to 20. Due to regulatory requirements, the company must have at least 5 Heavy trucks and cannot have more than 10 Light trucks. The company must also invest at least $10,000 in total for fuel efficiency upgrades.\n\nPlease help the company to maximize the total monthly revenue from all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLightTrucks = model.addVar(vtype=\"INTEGER\", name=\"LightTrucks\", lb=0)\nHeavyUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"HeavyUpgrade\", lb=0)\nMediumUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"MediumUpgrade\", lb=0)\nLightUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"LightUpgrade\", lb=0)\n\n# Define objective function\nRevenue_Heavy = 5000 * HeavyTrucks - (100 * HeavyTrucks * HeavyUpgrade / 10)\nRevenue_Medium = 3000 * MediumTrucks - (150 * MediumTrucks * MediumUpgrade / 10)\nRevenue_Light = 2000 * LightTrucks - (200 * LightTrucks * LightUpgrade / 10)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Heavy + Revenue_Medium + Revenue_Light)\n\n# Add constraints\nmodel.addCons(HeavyTrucks * 100000 + MediumTrucks * 80000 + LightTrucks * 50000 + HeavyUpgrade + MediumUpgrade + LightUpgrade <= 1000000)\nmodel.addCons(HeavyTrucks + MediumTrucks + LightTrucks <= 20)\nmodel.addCons(HeavyTrucks >= 5)\nmodel.addCons(LightTrucks <= 10)\nmodel.addCons(HeavyUpgrade + MediumUpgrade + LightUpgrade >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Light Trucks: \", model.getVal(LightTrucks))\n    print(\"Fuel Efficiency Upgrade for Heavy Trucks: \", model.getVal(HeavyUpgrade))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(MediumUpgrade))\n    print(\"Fuel Efficiency Upgrade for Light Trucks: \", model.getVal(LightUpgrade))\n    print(\"Maximized Total Monthly Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1641,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\n// UnitsA <= 8 * RateA\n// UnitsB <= 8 * RateB\n// UnitsC <= 8 * RateC\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\n// UnitsA >= 20\n// UnitsB >= 15\n// UnitsC >= 25",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\nThe total production capacity of the factory is limited to 100 units per day.\nThe production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\nThe market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\nPlease help the manufacturer determine the optimal number of units of each product to produce daily to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=25) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the factory is limited to 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n# The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\nmodel.addCons(UnitsA <= 8 * 2) # Assuming RateA = 2\nmodel.addCons(UnitsB <= 8 * 3) # Assuming RateB = 3\nmodel.addCons(UnitsC <= 8 * 2.5) # Assuming RateC = 2.5\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n// Delivery time for route A: T_A = 1 / (0.8 * A)\n// Delivery time for route B: T_B = 1 / (0.9 * B)\n// Delivery time for route C: T_C = 1 / (1.1 * C)\n// Delivery time for route D: T_D = 1 / (1.2 * D)\n// Delivery time for route E: T_E = 1 / (1.0 * E)\n// So, the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n// Minimize (1 / (0.8 * A) + 1 / (0.9 * B) + 1 / (1.1 * C) + 1 / (1.2 * D) + 1 / (1.0 * E))\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route can handle a maximum of 15 trucks at a time.\n// A <= 15; B <= 15; C <= 15; D <= 15; E <= 15\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-4:\nThe total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\n// 1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B))",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize delivery efficiency. Each route has a different efficiency factor based on distance, traffic, and delivery density. Route A has an efficiency factor of 0.8, Route B of 0.9, Route C of 1.1, Route D of 1.2, and Route E of 1.0. The company aims to minimize the total delivery time, which is the sum of the individual delivery times for each route. The delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\n\nThe company has a total of 50 trucks available for allocation. Each route can handle a maximum of 15 trucks at a time. The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels. Additionally, the total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\n\nPlease help the company to minimize the total delivery time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to ensure that at least 5 trucks are allocated to each route to maintain basic service levels.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Delivery time for each route is inversely proportional to the efficiency factor multiplied by the number of trucks allocated.\nT_A = 1 / (0.8 * A)\nT_B = 1 / (0.9 * B)\nT_C = 1 / (1.1 * C)\nT_D = 1 / (1.2 * D)\nT_E = 1 / (1.0 * E)\n## the objective function is: Minimize (T_A + T_B + T_C + T_D + T_E)\n## convert the division to multiplication\nmodel.addCons(obj == T_A + T_B + T_C + T_D + T_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(A + B + C + D + E <= 50)\n## Each route can handle a maximum of 15 trucks at a time.\nmodel.addCons(A <= 15)\nmodel.addCons(B <= 15)\nmodel.addCons(C <= 15)\nmodel.addCons(D <= 15)\nmodel.addCons(E <= 15)\n## The total delivery time for Route D should not exceed the combined delivery times of Routes A and B.\nmodel.addCons(1 / (1.2 * D) <= (1 / (0.8 * A)) + (1 / (0.9 * B)))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The company aims to maximize the total profit from selling these products.\n// Profit = 50A + 70B + 60C\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe market demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe market demand for product C is at least 25 units per day.\n// C >= 25",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering the production capacity and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a total production capacity of 100 units per day. The market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day. \n\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The market demand for product B is at least 15 units per day.\nmodel.addCons(B >= 15)\n## The market demand for product C is at least 25 units per day.\nmodel.addCons(C >= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\n// {\"number of trucks for city A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for city E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption and travel time for each route are nonlinear functions of the number of trucks. For city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company aims to minimize the total fuel consumption and travel time.\n// Fuel consumption for city A: FuelA = 50 * TrucksA\n// Fuel consumption for city B: FuelB = 60 * TrucksB\n// Fuel consumption for city C: FuelC = 70 * TrucksC\n// Fuel consumption for city D: FuelD = 80 * TrucksD\n// Fuel consumption for city E: FuelE = 90 * TrucksE\n// Travel time for city A: TimeA = 4 * TrucksA\n// Travel time for city B: TimeB = 5 * TrucksB\n// Travel time for city C: TimeC = 6 * TrucksC\n// Travel time for city D: TimeD = 7 * TrucksD\n// Travel time for city E: TimeE = 8 * TrucksE\n// So, the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its delivery routes for five major cities: A, B, C, D, and E. The company must decide how many trucks to allocate to each route to minimize fuel consumption and travel time.\nFor city A, the fuel consumption per truck is 50 liters, and the travel time is 4 hours. For city B, the fuel consumption per truck is 60 liters, and the travel time is 5 hours. For city C, the fuel consumption per truck is 70 liters, and the travel time is 6 hours. For city D, the fuel consumption per truck is 80 liters, and the travel time is 7 hours. For city E, the fuel consumption per truck is 90 liters, and the travel time is 8 hours. The company has a total of 50 trucks available for allocation.\nPlease help the company to minimize the total fuel consumption and travel time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for city A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for city B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for city C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for city D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for city E\n\n# Define objective function\nFuelA = 50 * TrucksA\nFuelB = 60 * TrucksB\nFuelC = 70 * TrucksC\nFuelD = 80 * TrucksD\nFuelE = 90 * TrucksE\nTimeA = 4 * TrucksA\nTimeB = 5 * TrucksB\nTimeC = 6 * TrucksC\nTimeD = 7 * TrucksD\nTimeE = 8 * TrucksE\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n# the objective function is: Minimize (FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\nmodel.addCons(obj == FuelA + FuelB + FuelC + FuelD + FuelE + TimeA + TimeB + TimeC + TimeD + TimeE)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for City A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for City B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for City C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for City D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for City E: \", model.getVal(TrucksE))\n    print(\"Minimized Total Fuel Consumption and Travel Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (Fragile, Perishable, and General). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time while considering the different speed limits and cargo handling requirements.\n// {\"number of trucks for Fragile cargo\": \"FragileTrucks\", \"range\": \"FragileTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Perishable cargo\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for General cargo\": \"GeneralTrucks\", \"range\": \"GeneralTrucks >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for Fragile cargo\": \"FragileSpeed\", \"range\": \"FragileSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for Perishable cargo\": \"PerishableSpeed\", \"range\": \"PerishableSpeed >= 0\", \"type\": \"real\"}\n// {\"speed of trucks for General cargo\": \"GeneralSpeed\", \"range\": \"GeneralSpeed >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe delivery time for Fragile cargo is inversely proportional to the speed squared due to the need for careful handling, and the distance is 500 km.\nThe delivery time for Perishable cargo is inversely proportional to the speed, and the distance is 400 km.\nThe delivery time for General cargo is directly proportional to the speed due to less stringent delivery requirements, and the distance is 300 km.\nThe company wants to minimize the total delivery time for all cargos.\n// Time_Fragile = 500 / (FragileSpeed^2) * FragileTrucks\n// Time_Perishable = 400 / PerishableSpeed * PerishableTrucks\n// Time_General = GeneralSpeed * 300 * GeneralTrucks\n// So, the objective function is: Minimize (Time_Fragile + Time_Perishable + Time_General)\n\n## Generate Constraint-1:\nThe company has a total of 10 trucks available.\n// FragileTrucks + PerishableTrucks + GeneralTrucks <= 10\n\n## Generate Constraint-2:\nThe speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns.\n// FragileSpeed <= 60",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo: Fragile, Perishable, and General. The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each truck should travel to minimize the total delivery time while considering the different speed limits and cargo handling requirements. The delivery times and distances for each type of cargo are as follows:\n\n| Cargo Type    | Distance (km) | Delivery Time Relationship with Speed |\n|---------------|---------------|---------------------------------------|\n| Fragile       | 500           | Inversely proportional to speed squared |\n| Perishable    | 400           | Inversely proportional to speed        |\n| General       | 300           | Directly proportional to speed         |\n\nThe company has a total of 10 trucks available. The speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns. Please help the company to minimize the total delivery time for all cargos.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFragileTrucks = model.addVar(vtype=\"INTEGER\", name=\"FragileTrucks\", lb=0)  # number of trucks for Fragile cargo\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)  # number of trucks for Perishable cargo\nGeneralTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralTrucks\", lb=0)  # number of trucks for General cargo\nFragileSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"FragileSpeed\", lb=0)  # speed of trucks for Fragile cargo\nPerishableSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"PerishableSpeed\", lb=0)  # speed of trucks for Perishable cargo\nGeneralSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"GeneralSpeed\", lb=0)  # speed of trucks for General cargo\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTime_Fragile = 500 / (FragileSpeed**2) * FragileTrucks\nTime_Perishable = 400 / PerishableSpeed * PerishableTrucks\nTime_General = GeneralSpeed * 300 * GeneralTrucks\n## the objective function is: Minimize (Time_Fragile + Time_Perishable + Time_General)\nmodel.addCons(obj == Time_Fragile + Time_Perishable + Time_General)\n\n# Add constraints\n## The company has a total of 10 trucks available.\nmodel.addCons(FragileTrucks + PerishableTrucks + GeneralTrucks <= 10)\n## The speed of trucks carrying Fragile cargo must not exceed 60 km/h due to safety concerns.\nmodel.addCons(FragileSpeed <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Fragile Cargo: \", model.getVal(FragileTrucks))\n    print(\"Number of Trucks for Perishable Cargo: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for General Cargo: \", model.getVal(GeneralTrucks))\n    print(\"Speed of Trucks for Fragile Cargo: \", model.getVal(FragileSpeed))\n    print(\"Speed of Trucks for Perishable Cargo: \", model.getVal(PerishableSpeed))\n    print(\"Speed of Trucks for General Cargo: \", model.getVal(GeneralSpeed))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production while considering the varying efficiency of each plant due to weather conditions and maintenance. Additionally, the company needs to decide on the investment in advanced technology for each plant to enhance efficiency.\n// {\"hours of operation for Solar plant\": \"SolarHours\", \"range\": \"SolarHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"WindHours\", \"range\": \"WindHours >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"HydroHours\", \"range\": \"HydroHours >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for Solar plant\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Wind plant\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for Hydro plant\": \"TechInvestmentHydro\", \"range\": \"TechInvestmentHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the investment in advanced technology. The Solar plant produces 100 kWh per hour without technology, increasing by 10 kWh per hour for every $1000 invested. The Wind plant produces 120 kWh per hour initially, increasing by 12 kWh per hour for every $1000 invested. The Hydro plant produces 150 kWh per hour initially, increasing by 15 kWh per hour for every $1000 invested. The company aims to maximize the total daily energy production.\n// Total energy production for Solar: EnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\n// Total energy production for Wind: EnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\n// Total energy production for Hydro: EnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $50,000 for technology investments and operational costs.\n// TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in advanced technology for each plant to maximize energy production. The efficiency of each plant increases with the investment in advanced technology. The Solar plant produces 100 kWh per hour without technology, increasing by 10 kWh per hour for every $1000 invested. The Wind plant produces 120 kWh per hour initially, increasing by 12 kWh per hour for every $1000 invested. The Hydro plant produces 150 kWh per hour initially, increasing by 15 kWh per hour for every $1000 invested. The company has a total budget of $50,000 for technology investments and operational costs. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarHours = model.addVar(vtype=\"INTEGER\", name=\"SolarHours\", lb=0)  # hours of operation for Solar plant\nWindHours = model.addVar(vtype=\"INTEGER\", name=\"WindHours\", lb=0)  # hours of operation for Wind plant\nHydroHours = model.addVar(vtype=\"INTEGER\", name=\"HydroHours\", lb=0)  # hours of operation for Hydro plant\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for Solar plant\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for Wind plant\nTechInvestmentHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentHydro\", lb=0)  # investment in advanced technology for Hydro plant\n\n# Define objective function\nEnergySolar = (100 + 0.01 * TechInvestmentSolar) * SolarHours\nEnergyWind = (120 + 0.012 * TechInvestmentWind) * WindHours\nEnergyHydro = (150 + 0.015 * TechInvestmentHydro) * HydroHours\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(TechInvestmentSolar + TechInvestmentWind + TechInvestmentHydro + 100 * SolarHours + 120 * WindHours + 150 * HydroHours <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(SolarHours))\n    print(\"Hours of operation for Wind plant: \", model.getVal(WindHours))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(HydroHours))\n    print(\"Investment in advanced technology for Solar plant: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in advanced technology for Wind plant: \", model.getVal(TechInvestmentWind))\n    print(\"Investment in advanced technology for Hydro plant: \", model.getVal(TechInvestmentHydro))\n    print(\"Total energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\n// {\"number of units of component E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E4\": \"E4\", \"range\": \"E4 >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E5\": \"E5\", \"range\": \"E5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost.\n// Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n// Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n// Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n// Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n// Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for production costs next month.\n// 10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50,000",
        "question": "A manufacturing company produces five types of electronic components: E1, E2, E3, E4, and E5. The company needs to determine the production quantity of each component for the next month to optimize its operations.\nFor component E1, the production cost is $10 per unit, the selling price is $20 per unit, and the storage cost is $1 per unit per month. \nFor component E2, the production cost is $15 per unit, the selling price is $25 per unit, and the storage cost is $1.5 per unit per month. \nFor component E3, the production cost is $20 per unit, the selling price is $30 per unit, and the storage cost is $2 per unit per month.\nFor component E4, the production cost is $25 per unit, the selling price is $35 per unit, and the storage cost is $2.5 per unit per month.\nFor component E5, the production cost is $30 per unit, the selling price is $40 per unit, and the storage cost is $3 per unit per month.\nThe company aims to maximize the net profit per unit, which is defined as the selling price minus the production cost and the storage cost. The company has a budget of $50,000 for production costs next month.\nPlease help the company to determine the optimal production quantity for each component to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # number of units of component E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # number of units of component E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # number of units of component E3\nE4 = model.addVar(vtype=\"INTEGER\", name=\"E4\", lb=0) # number of units of component E4\nE5 = model.addVar(vtype=\"INTEGER\", name=\"E5\", lb=0) # number of units of component E5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit per unit of E1: Profit_E1 = (20 - 10 - E1)\n## Net profit per unit of E2: Profit_E2 = (25 - 15 - 1.5 * E2)\n## Net profit per unit of E3: Profit_E3 = (30 - 20 - 2 * E3)\n## Net profit per unit of E4: Profit_E4 = (35 - 25 - 2.5 * E4)\n## Net profit per unit of E5: Profit_E5 = (40 - 30 - 3 * E5)\n## So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\nProfit_E1 = (20 - 10 - E1) * E1\nProfit_E2 = (25 - 15 - 1.5 * E2) * E2\nProfit_E3 = (30 - 20 - 2 * E3) * E3\nProfit_E4 = (35 - 25 - 2.5 * E4) * E4\nProfit_E5 = (40 - 30 - 3 * E5) * E5\nmodel.addCons(obj == Profit_E1 + Profit_E2 + Profit_E3 + Profit_E4 + Profit_E5)\n\n# Add constraints\n## The company has a budget of $50,000 for production costs next month.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 + 25 * E4 + 30 * E5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component E1: \", model.getVal(E1))\n    print(\"Number of Component E2: \", model.getVal(E2))\n    print(\"Number of Component E3: \", model.getVal(E3))\n    print(\"Number of Component E4: \", model.getVal(E4))\n    print(\"Number of Component E5: \", model.getVal(E5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1229,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month. Additionally, the company needs to decide on the number of hours each machine should be operated in the testing phase.\n// {\"number of units of machine A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of machine D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine A is tested\": \"TestHoursA\", \"range\": \"TestHoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours machine B is tested\": \"TestHoursB\", \"range\": \"TestHoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours machine C is tested\": \"TestHoursC\", \"range\": \"TestHoursC >= 0\", \"type\": \"real\"}\n// {\"number of hours machine D is tested\": \"TestHoursD\", \"range\": \"TestHoursD >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor machine A, the selling price is $5000, the production cost is $3000, and the testing cost per hour is $50.\nFor machine B, the selling price is $7000, the production cost is $4000, and the testing cost per hour is $70.\nFor machine C, the selling price is $9000, the production cost is $5000, and the testing cost per hour is $90.\nFor machine D, the selling price is $11000, the production cost is $6000, and the testing cost per hour is $110.\nThe company aims to maximize the total profit, which is the sum of the selling profits minus the testing costs.\n// Profit from A: Profit_A = (5000 - 3000) * A - 50 * TestHoursA\n// Profit from B: Profit_B = (7000 - 4000) * B - 70 * TestHoursB\n// Profit from C: Profit_C = (9000 - 5000) * C - 90 * TestHoursC\n// Profit from D: Profit_D = (11000 - 6000) * D - 110 * TestHoursD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 for production costs next month.\n// 3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000\n\n## Generate Constraint-2:\nThe total testing hours available next month are limited to 1000 hours.\n// TestHoursA + TestHoursB + TestHoursC + TestHoursD <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10 units of each machine are produced next month.\n// A >= 10; B >= 10; C >= 10; D >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\n// TestHoursC >= 2 * TestHoursA",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine how many units of each machine to produce next month and the number of hours each machine should be operated in the testing phase.\nFor machine A, the selling price is $5000, the production cost is $3000, and the testing cost per hour is $50.\nFor machine B, the selling price is $7000, the production cost is $4000, and the testing cost per hour is $70.\nFor machine C, the selling price is $9000, the production cost is $5000, and the testing cost per hour is $90.\nFor machine D, the selling price is $11000, the production cost is $6000, and the testing cost per hour is $110.\nThe company has a total budget of $150,000 for production costs next month. The total testing hours available next month are limited to 1000 hours. The company wants to ensure that at least 10 units of each machine are produced next month. The company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C. The company also wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\nPlease help the company to maximize the total profit, which is the sum of the selling profits minus the testing costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of machine A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of machine B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of machine C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of units of machine D\nTestHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursA\", lb=0) # number of hours machine A is tested\nTestHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursB\", lb=0) # number of hours machine B is tested\nTestHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursC\", lb=0) # number of hours machine C is tested\nTestHoursD = model.addVar(vtype=\"CONTINUOUS\", name=\"TestHoursD\", lb=0) # number of hours machine D is tested\n\n# Define objective function\nProfit_A = (5000 - 3000) * A - 50 * TestHoursA\nProfit_B = (7000 - 4000) * B - 70 * TestHoursB\nProfit_C = (9000 - 5000) * C - 90 * TestHoursC\nProfit_D = (11000 - 6000) * D - 110 * TestHoursD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total budget of $150,000 for production costs next month.\nmodel.addCons(3000 * A + 4000 * B + 5000 * C + 6000 * D <= 150000)\n# The total testing hours available next month are limited to 1000 hours.\nmodel.addCons(TestHoursA + TestHoursB + TestHoursC + TestHoursD <= 1000)\n# The company wants to ensure that the total production of machine D does not exceed the combined production of machines A, B, and C.\nmodel.addCons(D <= A + B + C)\n# The company wants to ensure that the testing hours for machine C are at least twice the testing hours for machine A.\nmodel.addCons(TestHoursC >= 2 * TestHoursA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Test Hours for Machine A: \", model.getVal(TestHoursA))\n    print(\"Test Hours for Machine B: \", model.getVal(TestHoursB))\n    print(\"Test Hours for Machine C: \", model.getVal(TestHoursC))\n    print(\"Test Hours for Machine D: \", model.getVal(TestHoursD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ChipA, ChipB, ChipC, ChipD, and ChipE. The company needs to determine the optimal production quantities for each type of component to maximize profit while considering various constraints.\n// {\"quantity of ChipA\": \"ChipA\", \"range\": \"ChipA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipB\": \"ChipB\", \"range\": \"ChipB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipC\": \"ChipC\", \"range\": \"ChipC >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipD\": \"ChipD\", \"range\": \"ChipD >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipE\": \"ChipE\", \"range\": \"ChipE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChipA is $10, ChipB is $15, ChipC is $20, ChipD is $25, and ChipE is $30. Due to economies of scale, the profit per unit increases by $0.02 for each unit produced beyond 100 units for each type of chip. The company aims to maximize the total profit from the production of these components.\n// Profit_ChipA = max(10 + 0.02 * (ChipA - 100), 10) * ChipA\n// Profit_ChipB = max(15 + 0.02 * (ChipB - 100), 15) * ChipB\n// Profit_ChipC = max(20 + 0.02 * (ChipC - 100), 20) * ChipC\n// Profit_ChipD = max(25 + 0.02 * (ChipD - 100), 25) * ChipD\n// Profit_ChipE = max(30 + 0.02 * (ChipE - 100), 30) * ChipE\n// So, the objective function is: Maximize Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. For each unit of ChipA, 5 units of raw material are required. For ChipB, 7 units are required. For ChipC, 9 units are required. For ChipD, 11 units are required. For ChipE, 13 units are required. The total available raw material is 5000 units.\n// 5 * ChipA + 7 * ChipB + 9 * ChipC + 11 * ChipD + 13 * ChipE <= 5000\n\n## Generate Constraint-2:\nThe production capacity for each type of chip is limited. The maximum production capacity for ChipA is 500 units, for ChipB is 400 units, for ChipC is 300 units, for ChipD is 200 units, and for ChipE is 100 units.\n// ChipA <= 500; ChipB <= 400; ChipC <= 300; ChipD <= 200; ChipE <= 100\n\n## Generate Constraint-3:\nThe total production across all types of chips must not exceed 1000 units due to overall facility limitations.\n// ChipA + ChipB + ChipC + ChipD + ChipE <= 1000",
        "question": "A manufacturing company produces five types of electronic components: ChipA, ChipB, ChipC, ChipD, and ChipE. The company needs to determine the optimal production quantities for each type of component to maximize profit while considering various constraints. The profit per unit of ChipA is $10, ChipB is $15, ChipC is $20, ChipD is $25, and ChipE is $30. Due to economies of scale, the profit per unit increases by $0.02 for each unit produced beyond 100 units for each type of chip. The company has a limited supply of raw materials. For each unit of ChipA, 5 units of raw material are required. For ChipB, 7 units are required. For ChipC, 9 units are required. For ChipD, 11 units are required. For ChipE, 13 units are required. The total available raw material is 5000 units. The production capacity for each type of chip is limited. The maximum production capacity for ChipA is 500 units, for ChipB is 400 units, for ChipC is 300 units, for ChipD is 200 units, and for ChipE is 100 units. The total production across all types of chips must not exceed 1000 units due to overall facility limitations. Please help the company to maximize the total profit from the production of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChipA = model.addVar(vtype=\"INTEGER\", name=\"ChipA\", lb=0, ub=500) # quantity of ChipA\nChipB = model.addVar(vtype=\"INTEGER\", name=\"ChipB\", lb=0, ub=400) # quantity of ChipB\nChipC = model.addVar(vtype=\"INTEGER\", name=\"ChipC\", lb=0, ub=300) # quantity of ChipC\nChipD = model.addVar(vtype=\"INTEGER\", name=\"ChipD\", lb=0, ub=200) # quantity of ChipD\nChipE = model.addVar(vtype=\"INTEGER\", name=\"ChipE\", lb=0, ub=100) # quantity of ChipE\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ChipA = max(10 + 0.02 * (ChipA - 100), 10) * ChipA\nChipA1 = model.addVar(vtype=\"INTEGER\", name=\"ChipA1\", lb=0, ub=100)\nChipA2 = model.addVar(vtype=\"INTEGER\", name=\"ChipA2\", lb=100, ub=500)\nChipA_b1 = model.addVar(vtype=\"B\", name=\"ChipA_b1\")\nChipA_b2 = model.addVar(vtype=\"B\", name=\"ChipA_b2\")\nmodel.addCons(ChipA_b1 + ChipA_b2 == 1)\nmodel.addCons(ChipA == ChipA1*ChipA_b1 + ChipA2*ChipA_b2)\nProfit_ChipA = 10 * ChipA1 * ChipA_b1 + (10 + 0.02 * (ChipA2 - 100)) * ChipA2 * ChipA_b2\n\n## create piecewise variables for piecewise function: Profit_ChipB = max(15 + 0.02 * (ChipB - 100), 15) * ChipB\nChipB1 = model.addVar(vtype=\"INTEGER\", name=\"ChipB1\", lb=0, ub=100)\nChipB2 = model.addVar(vtype=\"INTEGER\", name=\"ChipB2\", lb=100, ub=400)\nChipB_b1 = model.addVar(vtype=\"B\", name=\"ChipB_b1\")\nChipB_b2 = model.addVar(vtype=\"B\", name=\"ChipB_b2\")\nmodel.addCons(ChipB_b1 + ChipB_b2 == 1)\nmodel.addCons(ChipB == ChipB1*ChipB_b1 + ChipB2*ChipB_b2)\nProfit_ChipB = 15 * ChipB1 * ChipB_b1 + (15 + 0.02 * (ChipB2 - 100)) * ChipB2 * ChipB_b2\n\n## create piecewise variables for piecewise function: Profit_ChipC = max(20 + 0.02 * (ChipC - 100), 20) * ChipC\nChipC1 = model.addVar(vtype=\"INTEGER\", name=\"ChipC1\", lb=0, ub=100)\nChipC2 = model.addVar(vtype=\"INTEGER\", name=\"ChipC2\", lb=100, ub=300)\nChipC_b1 = model.addVar(vtype=\"B\", name=\"ChipC_b1\")\nChipC_b2 = model.addVar(vtype=\"B\", name=\"ChipC_b2\")\nmodel.addCons(ChipC_b1 + ChipC_b2 == 1)\nmodel.addCons(ChipC == ChipC1*ChipC_b1 + ChipC2*ChipC_b2)\nProfit_ChipC = 20 * ChipC1 * ChipC_b1 + (20 + 0.02 * (ChipC2 - 100)) * ChipC2 * ChipC_b2\n\n## create piecewise variables for piecewise function: Profit_ChipD = max(25 + 0.02 * (ChipD - 100), 25) * ChipD\nChipD1 = model.addVar(vtype=\"INTEGER\", name=\"ChipD1\", lb=0, ub=100)\nChipD2 = model.addVar(vtype=\"INTEGER\", name=\"ChipD2\", lb=100, ub=200)\nChipD_b1 = model.addVar(vtype=\"B\", name=\"ChipD_b1\")\nChipD_b2 = model.addVar(vtype=\"B\", name=\"ChipD_b2\")\nmodel.addCons(ChipD_b1 + ChipD_b2 == 1)\nmodel.addCons(ChipD == ChipD1*ChipD_b1 + ChipD2*ChipD_b2)\nProfit_ChipD = 25 * ChipD1 * ChipD_b1 + (25 + 0.02 * (ChipD2 - 100)) * ChipD2 * ChipD_b2\n\n## create piecewise variables for piecewise function: Profit_ChipE = max(30 + 0.02 * (ChipE - 100), 30) * ChipE\nChipE1 = model.addVar(vtype=\"INTEGER\", name=\"ChipE1\", lb=0, ub=100)\nChipE2 = model.addVar(vtype=\"INTEGER\", name=\"ChipE2\", lb=100, ub=100)\nChipE_b1 = model.addVar(vtype=\"B\", name=\"ChipE_b1\")\nChipE_b2 = model.addVar(vtype=\"B\", name=\"ChipE_b2\")\nmodel.addCons(ChipE_b1 + ChipE_b2 == 1)\nmodel.addCons(ChipE == ChipE1*ChipE_b1 + ChipE2*ChipE_b2)\nProfit_ChipE = 30 * ChipE1 * ChipE_b1 + (30 + 0.02 * (ChipE2 - 100)) * ChipE2 * ChipE_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE\nmodel.addCons(obj == Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE)\n\n# Add constraints\nmodel.addCons(5 * ChipA + 7 * ChipB + 9 * ChipC + 11 * ChipD + 13 * ChipE <= 5000)\nmodel.addCons(ChipA + ChipB + ChipC + ChipD + ChipE <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChipA: \", model.getVal(ChipA))\n    print(\"Quantity of ChipB: \", model.getVal(ChipB))\n    print(\"Quantity of ChipC: \", model.getVal(ChipC))\n    print(\"Quantity of ChipD: \", model.getVal(ChipD))\n    print(\"Quantity of ChipE: \", model.getVal(ChipE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The production cost, selling price, and demand for each product vary.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50, ProductionCostA is $30.\nThe profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70, ProductionCostB is $40.\nThe profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60, ProductionCostC is $35.\nThe company wants to maximize the total profit from all products.\n// Objective function: Maximize (ProfitA + ProfitB + ProfitC) = ((50 - 30) * QuantityA - 0.01 * QuantityA^2) + ((70 - 40) * QuantityB - 0.02 * QuantityB^2) + ((60 - 35) * QuantityC - 0.015 * QuantityC^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market research, the demand for ProductA is at least twice the demand for ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to optimize its profit. The profit for ProductA is calculated as (SellingPriceA - ProductionCostA) * QuantityA - (0.01 * QuantityA^2), where SellingPriceA is $50 and ProductionCostA is $30. The profit for ProductB is calculated as (SellingPriceB - ProductionCostB) * QuantityB - (0.02 * QuantityB^2), where SellingPriceB is $70 and ProductionCostB is $40. The profit for ProductC is calculated as (SellingPriceC - ProductionCostC) * QuantityC - (0.015 * QuantityC^2), where SellingPriceC is $60 and ProductionCostC is $35. The company wants to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units. Due to market research, the demand for ProductA is at least twice the demand for ProductB. Please help the company determine the optimal production quantities for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate profit for each product\nProfitA = (50 - 30) * QuantityA - 0.01 * QuantityA**2\nProfitB = (70 - 40) * QuantityB - 0.02 * QuantityB**2\nProfitC = (60 - 35) * QuantityC - 0.015 * QuantityC**2\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n\n## Due to market research, the demand for ProductA is at least twice the demand for ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. These investments will reduce the production cost per unit for each product.\n// {\"quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced tech for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced tech for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced tech for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for ProductA is initially $100, for ProductB is $150, and for ProductC is $200. Every $10,000 invested in advanced technologies reduces the production cost per unit by $5 for ProductA, $7 for ProductB, and $9 for ProductC. The selling price per unit is $150 for ProductA, $200 for ProductB, and $250 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (150 - (100 - 0.0005 * InvestmentA)) * QuantityA\n// Total profit for ProductB: ProfitB = (200 - (150 - 0.0007 * InvestmentB)) * QuantityB\n// Total profit for ProductC: ProfitC = (250 - (200 - 0.0009 * InvestmentC)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investments in advanced technologies.\n// InvestmentA + InvestmentB + InvestmentC <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// QuantityA + QuantityB + QuantityC <= 5000\n\n## Generate Constraint-3:\nDue to market demand, the company must produce at least 1000 units of ProductA and 1500 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 1500\n\n## Generate Constraint-4:\nThe company must ensure that the total investment in ProductC does not exceed 40% of the total investment.\n// InvestmentC <= 0.4 * (InvestmentA + InvestmentB + InvestmentC)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of investment in advanced manufacturing technologies for each product. These investments will reduce the production cost per unit for each product. The initial production cost per unit, selling price per unit, and the effect of investment on production cost are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price | Investment Effect on Cost |\n|---------|-------------------------|---------------|---------------------------|\n| ProductA | $100                    | $150          | $5 per $10,000            |\n| ProductB | $150                    | $200          | $7 per $10,000            |\n| ProductC | $200                    | $250          | $9 per $10,000            |\n\nThe company has a total budget of $100,000 for investments in advanced technologies. The total production capacity of the company is 5000 units. Due to market demand, the company must produce at least 1000 units of ProductA and 1500 units of ProductB. The company must ensure that the total investment in ProductC does not exceed 40% of the total investment.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000)  # quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=1500)  # quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # quantity of ProductC\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0)  # investment in advanced tech for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0)  # investment in advanced tech for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0)  # investment in advanced tech for ProductC\n\n# Define objective function\nProfitA = (150 - (100 - 0.0005 * InvestmentA)) * QuantityA\nProfitB = (200 - (150 - 0.0007 * InvestmentB)) * QuantityB\nProfitC = (250 - (200 - 0.0009 * InvestmentC)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC <= 100000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 5000)\nmodel.addCons(InvestmentC <= 0.4 * (InvestmentA + InvestmentB + InvestmentC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in ProductC: \", model.getVal(InvestmentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1318,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000, per Hybrid vehicle is $8,000, and per Hydrogen vehicle is $12,000. Due to economies of scale, the profit per vehicle increases nonlinearly with the quantity produced. Specifically, the profit per vehicle increases by an additional $10 for every 100 vehicles produced beyond the first 100 for each type. The company aims to maximize the total profit from vehicle sales.\n// Profit_E = (10000 + (E - 100) / 100 * 10) * E\n// Profit_H = (8000 + (H - 100) / 100 * 10) * H\n// Profit_Hy = (12000 + (Hy - 100) / 100 * 10) * Hy\n// So, the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 500 vehicles in total.\n// E + H + Hy <= 500\n\n## Generate Constraint-2:\nThe company has a budget constraint for production costs, which is $4,000,000. The cost per Electric vehicle is $5,000, per Hybrid vehicle is $4,500, and per Hydrogen vehicle is $6,000.\n// 5000 * E + 4500 * H + 6000 * Hy <= 4000000",
        "question": "A company manufactures three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their profit while considering various constraints. The profit per vehicle and the production cost per vehicle for each type are given in the following Table.\n\n| Vehicle Type | Profit per Vehicle | Production Cost per Vehicle |\n|--------------|--------------------|-----------------------------|\n| Electric     | $10,000            | $5,000                      |\n| Hybrid       | $8,000             | $4,500                      |\n| Hydrogen     | $12,000            | $6,000                      |\n\nDue to economies of scale, the profit per vehicle increases by an additional $10 for every 100 vehicles produced beyond the first 100 for each type. The company has a limited production capacity of 500 vehicles in total. The company also has a budget constraint for production costs, which is $4,000,000. \n\nPlease help the company to maximize the total profit from vehicle sales.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0) # quantity of Hydrogen vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_E = (10000 + (E - 100) / 100 * 10) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=100)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=100, ub=500)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = (10000 + (E2 - 100) / 100 * 10) * E2 * E_b2 + 10000 * E1 * E_b1\n## create piecewise variables for piecewise function: Profit_H = (8000 + (H - 100) / 100 * 10) * H\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0, ub=100)\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=100, ub=500)\nH_b1 = model.addVar(vtype=\"B\", name=\"H_b1\")\nH_b2 = model.addVar(vtype=\"B\", name=\"H_b2\")\nmodel.addCons(H_b1 + H_b2 == 1)\nmodel.addCons(H == H1*H_b1 + H2*H_b2)\nProfit_H = (8000 + (H2 - 100) / 100 * 10) * H2 * H_b2 + 8000 * H1 * H_b1\n## create piecewise variables for piecewise function: Profit_Hy = (12000 + (Hy - 100) / 100 * 10) * Hy\nHy1 = model.addVar(vtype=\"INTEGER\", name=\"Hy1\", lb=0, ub=100)\nHy2 = model.addVar(vtype=\"INTEGER\", name=\"Hy2\", lb=100, ub=500)\nHy_b1 = model.addVar(vtype=\"B\", name=\"Hy_b1\")\nHy_b2 = model.addVar(vtype=\"B\", name=\"Hy_b2\")\nmodel.addCons(Hy_b1 + Hy_b2 == 1)\nmodel.addCons(Hy == Hy1*Hy_b1 + Hy2*Hy_b2)\nProfit_Hy = (12000 + (Hy2 - 100) / 100 * 10) * Hy2 * Hy_b2 + 12000 * Hy1 * Hy_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_E + Profit_H + Profit_Hy\nmodel.addCons(obj == Profit_E + Profit_H + Profit_Hy)\n\n# Add constraints\nmodel.addCons(E + H + Hy <= 500)\nmodel.addCons(5000 * E + 4500 * H + 6000 * Hy <= 4000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use varies with the amount of investment in automation technology.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $2 for every $1000 invested in automation technology. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products.\n// ProfitA = (150 - (100 - 0.002 * AutomationInvestment)) * UnitsA\n// ProfitB = (225 - (150 - 0.002 * AutomationInvestment)) * UnitsB\n// ProfitC = (300 - (200 - 0.002 * AutomationInvestment)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource allocation for all products cannot exceed 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use varies with the amount of investment in automation technology. The cost of production per unit decreases by $2 for every $1000 invested in automation technology. The initial production cost for ProductA is $100, for ProductB is $150, and for ProductC is $200. The selling price per unit is $150 for ProductA, $225 for ProductB, and $300 for ProductC. The company aims to maximize the total profit from all products. The total resource allocation for all products cannot exceed 1000 units. Please help the company determine the optimal number of units to produce for each product, the resource allocation for each product, and the investment in automation technology to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nResourcesA = model.addVar(name=\"ResourcesA\", lb=0)  # resource allocation for ProductA\nResourcesB = model.addVar(name=\"ResourcesB\", lb=0)  # resource allocation for ProductB\nResourcesC = model.addVar(name=\"ResourcesC\", lb=0)  # resource allocation for ProductC\nAutomationInvestment = model.addVar(name=\"AutomationInvestment\", lb=0)  # investment in automation technology\n\n# Define objective function\nProfitA = (150 - (100 - 0.002 * AutomationInvestment)) * UnitsA\nProfitB = (225 - (150 - 0.002 * AutomationInvestment)) * UnitsB\nProfitC = (300 - (200 - 0.002 * AutomationInvestment)) * UnitsC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resource Allocation for ProductA: \", model.getVal(ResourcesA))\n    print(\"Resource Allocation for ProductB: \", model.getVal(ResourcesB))\n    print(\"Resource Allocation for ProductC: \", model.getVal(ResourcesC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has different operational costs and delivery volumes. Route A costs $100 per truck and delivers 50 packages, Route B costs $120 per truck and delivers 60 packages, Route C costs $150 per truck and delivers 70 packages, Route D costs $180 per truck and delivers 80 packages, and Route E costs $200 per truck and delivers 90 packages. The company aims to minimize the total cost while ensuring that the total delivery volume meets or exceeds a target of 1000 packages.\n// Cost of route A: Cost_A = 100 * A\n// Cost of route B: Cost_B = 120 * B\n// Cost of route C: Cost_C = 150 * C\n// Cost of route D: Cost_D = 180 * D\n// Cost of route E: Cost_E = 200 * E\n// Delivery volume of route A: Vol_A = 50 * A\n// Delivery volume of route B: Vol_B = 60 * B\n// Delivery volume of route C: Vol_C = 70 * C\n// Delivery volume of route D: Vol_D = 80 * D\n// Delivery volume of route E: Vol_E = 90 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n\n## Generate Constraint-1:\nThe total number of trucks available is 10.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-2:\nThe total delivery volume must meet or exceed 1000 packages.\n// 50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E.\n// D <= A + B + C + E",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The operational costs and delivery volumes for each route are given in the following Table.\n\n| Route | Cost per Truck | Delivery Volume per Truck |\n|-------|----------------|---------------------------|\n| A     | $100           | 50 packages               |\n| B     | $120           | 60 packages               |\n| C     | $150           | 70 packages               |\n| D     | $180           | 80 packages               |\n| E     | $200           | 90 packages               |\n\nThe company has a total of 10 trucks available. The total delivery volume must meet or exceed 1000 packages. The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C. Additionally, the company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E. \nPlease help the company to minimize the total cost while ensuring that the total delivery volume meets or exceeds the target of 1000 packages.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 100 * A\nCost_B = 120 * B\nCost_C = 150 * C\nCost_D = 180 * D\nCost_E = 200 * E\nVol_A = 50 * A\nVol_B = 60 * B\nVol_C = 70 * C\nVol_D = 80 * D\nVol_E = 90 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Vol_A + Vol_B + Vol_C + Vol_D + Vol_E) == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The total number of trucks available is 10.\nmodel.addCons(A + B + C + D + E <= 10)\n## The total delivery volume must meet or exceed 1000 packages.\nmodel.addCons(50 * A + 60 * B + 70 * C + 80 * D + 90 * E >= 1000)\n## The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The company wants to ensure that the number of trucks on Route D does not exceed the combined number of trucks on Routes A, B, C, and E.\nmodel.addCons(D <= A + B + C + E)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Cost per Delivery Volume: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1222,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"fuel allocation for TruckA\": \"FuelA\", \"range\": \"FuelA >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckB\": \"FuelB\", \"range\": \"FuelB >= 0\", \"type\": \"continuous\"}\n// {\"fuel allocation for TruckC\": \"FuelC\", \"range\": \"FuelC >= 0\", \"type\": \"continuous\"}\n// {\"investment in routing software\": \"Software\", \"range\": \"Software >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type is affected by the routing software investment. For every $1000 invested in the software, the fuel efficiency of TruckA improves by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter. The company aims to minimize the total fuel consumption while ensuring all delivery routes are covered.\n// Fuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\n// Fuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\n// Fuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\n// So, the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and software investments.\n// TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000\n\n## Generate Constraint-2:\nThe total fuel allocation must not exceed 5000 liters.\n// FuelA + FuelB + FuelC <= 5000\n\n## Generate Constraint-3:\nThe company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\n// TruckA >= 10; TruckB >= 15",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the number of each type of vehicle to purchase and the amount of fuel to allocate to each vehicle to optimize their delivery routes. Additionally, the company is considering investing in a new routing software that could reduce fuel consumption and improve delivery times. The fuel efficiency of each truck type improves with the investment in the software, where every $1000 invested increases the efficiency of TruckA by 0.5 km/liter, TruckB by 0.7 km/liter, and TruckC by 0.6 km/liter.\n\nThe company has a budget of $100,000 for vehicle purchases and software investments. The total fuel allocation must not exceed 5000 liters. The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\n\nPlease help the company to minimize the total fuel consumption while ensuring all delivery routes are covered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0)  # number of TruckC\nFuelA = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelA\", lb=0)  # fuel allocation for TruckA\nFuelB = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelB\", lb=0)  # fuel allocation for TruckB\nFuelC = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelC\", lb=0)  # fuel allocation for TruckC\nSoftware = model.addVar(vtype=\"CONTINUOUS\", name=\"Software\", lb=0)  # investment in routing software\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInitial_efficiency_A = 10  # example initial efficiency for TruckA\nInitial_efficiency_B = 12  # example initial efficiency for TruckB\nInitial_efficiency_C = 15  # example initial efficiency for TruckC\nDistance_A = 1000  # example distance for TruckA\nDistance_B = 1500  # example distance for TruckB\nDistance_C = 2000  # example distance for TruckC\n## the objective function is: Minimize (Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n## convert the division to multiplication\nFuel_consumption_A = (Distance_A / (Initial_efficiency_A + 0.0005 * Software)) * FuelA\nFuel_consumption_B = (Distance_B / (Initial_efficiency_B + 0.0007 * Software)) * FuelB\nFuel_consumption_C = (Distance_C / (Initial_efficiency_C + 0.0006 * Software)) * FuelC\nmodel.addCons(obj == Fuel_consumption_A + Fuel_consumption_B + Fuel_consumption_C)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle purchases and software investments.\nCost_A = 20000  # example cost for TruckA\nCost_B = 25000  # example cost for TruckB\nCost_C = 30000  # example cost for TruckC\nmodel.addCons(TruckA * Cost_A + TruckB * Cost_B + TruckC * Cost_C + Software <= 100000)\n## The total fuel allocation must not exceed 5000 liters.\nmodel.addCons(FuelA + FuelB + FuelC <= 5000)\n## The company must have at least 10 TruckA and 15 TruckB to meet minimum delivery requirements.\nmodel.addCons(TruckA >= 10)\nmodel.addCons(TruckB >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Fuel allocation for TruckA: \", model.getVal(FuelA))\n    print(\"Fuel allocation for TruckB: \", model.getVal(FuelB))\n    print(\"Fuel allocation for TruckC: \", model.getVal(FuelC))\n    print(\"Investment in routing software: \", model.getVal(Software))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (TruckX, TruckY, TruckZ), the speed at which each truck operates (SpeedX, SpeedY, SpeedZ), and the fuel efficiency of each truck (FuelEffX, FuelEffY, FuelEffZ).\n// {\"number of trucks in region X\": \"TruckX\", \"range\": \"TruckX >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region Y\": \"TruckY\", \"range\": \"TruckY >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in region Z\": \"TruckZ\", \"range\": \"TruckZ >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in region X\": \"SpeedX\", \"range\": \"0 < SpeedX <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in region Y\": \"SpeedY\", \"range\": \"0 < SpeedY <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks in region Z\": \"SpeedZ\", \"range\": \"0 < SpeedZ <= 60\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region X\": \"FuelEffX\", \"range\": \"FuelEffX >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region Y\": \"FuelEffY\", \"range\": \"FuelEffY >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency of trucks in region Z\": \"FuelEffZ\", \"range\": \"FuelEffZ >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption of each truck is a nonlinear function of its speed and fuel efficiency. The faster the truck, the more fuel it consumes, but the higher the fuel efficiency, the less fuel it consumes per unit distance.\n// Total fuel consumption for region X: FuelConsX = (TruckX * SpeedX^2) / FuelEffX\n// Total fuel consumption for region Y: FuelConsY = (TruckY * SpeedY^2) / FuelEffY\n// Total fuel consumption for region Z: FuelConsZ = (TruckZ * SpeedZ^2) / FuelEffZ\n// So, the objective function is: Minimize (FuelConsX + FuelConsY + FuelConsZ)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation across the three regions.\n// TruckX + TruckY + TruckZ <= 50\n\n## Generate Constraint-2:\nThe maximum speed limit for trucks in any region is 60 km/h.\n// SpeedX <= 60; SpeedY <= 60; SpeedZ <= 60",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency for each truck. The variables include the number of trucks assigned to each region (TruckX, TruckY, TruckZ), the speed at which each truck operates (SpeedX, SpeedY, SpeedZ), and the fuel efficiency of each truck (FuelEffX, FuelEffY, FuelEffZ). The company wants to minimize the total fuel consumption while ensuring timely delivery. The fuel consumption of each truck is a nonlinear function of its speed and fuel efficiency. The faster the truck, the more fuel it consumes, but the higher the fuel efficiency, the less fuel it consumes per unit distance. The company has a total of 50 trucks available for allocation across the three regions. The maximum speed limit for trucks in any region is 60 km/h.\n\nPlease help the company to minimize the total fuel consumption (which is defined as the sum of the fuel consumption for each region, where the fuel consumption for each region is calculated as the number of trucks in that region times the square of the speed divided by the fuel efficiency).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckX = model.addVar(vtype=\"INTEGER\", name=\"TruckX\", lb=0)  # number of trucks in region X\nTruckY = model.addVar(vtype=\"INTEGER\", name=\"TruckY\", lb=0)  # number of trucks in region Y\nTruckZ = model.addVar(vtype=\"INTEGER\", name=\"TruckZ\", lb=0)  # number of trucks in region Z\nSpeedX = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedX\", lb=0, ub=60)  # speed of trucks in region X\nSpeedY = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedY\", lb=0, ub=60)  # speed of trucks in region Y\nSpeedZ = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedZ\", lb=0, ub=60)  # speed of trucks in region Z\nFuelEffX = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffX\", lb=0)  # fuel efficiency of trucks in region X\nFuelEffY = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffY\", lb=0)  # fuel efficiency of trucks in region Y\nFuelEffZ = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEffZ\", lb=0)  # fuel efficiency of trucks in region Z\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelConsX = (TruckX * SpeedX**2) / FuelEffX\nFuelConsY = (TruckY * SpeedY**2) / FuelEffY\nFuelConsZ = (TruckZ * SpeedZ**2) / FuelEffZ\n## the objective function is: Minimize (FuelConsX + FuelConsY + FuelConsZ)\nmodel.addCons(obj == FuelConsX + FuelConsY + FuelConsZ)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation across the three regions.\nmodel.addCons(TruckX + TruckY + TruckZ <= 50)\n## The maximum speed limit for trucks in any region is 60 km/h.\nmodel.addCons(SpeedX <= 60)\nmodel.addCons(SpeedY <= 60)\nmodel.addCons(SpeedZ <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region X: \", model.getVal(TruckX))\n    print(\"Number of Trucks in Region Y: \", model.getVal(TruckY))\n    print(\"Number of Trucks in Region Z: \", model.getVal(TruckZ))\n    print(\"Speed of Trucks in Region X: \", model.getVal(SpeedX))\n    print(\"Speed of Trucks in Region Y: \", model.getVal(SpeedY))\n    print(\"Speed of Trucks in Region Z: \", model.getVal(SpeedZ))\n    print(\"Fuel Efficiency of Trucks in Region X: \", model.getVal(FuelEffX))\n    print(\"Fuel Efficiency of Trucks in Region Y: \", model.getVal(FuelEffY))\n    print(\"Fuel Efficiency of Trucks in Region Z: \", model.getVal(FuelEffZ))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. The company needs to determine the optimal number of each type of vehicle to maximize profit while considering operational constraints.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons.\nTruck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons.\nTruck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons.\nThe revenue per ton-km is $0.5. The company wants to maximize the net profit per day.\n// Profit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\n// Profit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\n// Profit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n## Generate Constraint-1:\nThe company has a daily fuel budget of $1000.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000\n\n## Generate Constraint-2:\nThe company has a daily maintenance budget of $3000.\n// 100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000\n\n## Generate Constraint-3:\nThe total cargo capacity of all vehicles must not exceed 500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC <= 500",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. Each vehicle has different fuel efficiency, maintenance costs, and cargo capacity. Truck A has a fuel efficiency of 5 km/l, a maintenance cost of $100 per day, and a cargo capacity of 10 tons. Truck B has a fuel efficiency of 7 km/l, a maintenance cost of $150 per day, and a cargo capacity of 15 tons. Truck C has a fuel efficiency of 10 km/l, a maintenance cost of $200 per day, and a cargo capacity of 20 tons. The revenue per ton-km is $0.5. The company wants to maximize the net profit per day. The company has a daily fuel budget of $1000 and a daily maintenance budget of $3000. The total cargo capacity of all vehicles must not exceed 500 tons.\n\nPlease help the company determine the optimal number of each type of vehicle to maximize profit while considering these operational constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\n\n# Define objective function\nProfit_TruckA = 5 * TruckA * (10 * 0.5) - 100 * TruckA\nProfit_TruckB = 7 * TruckB * (15 * 0.5) - 150 * TruckB\nProfit_TruckC = 10 * TruckC * (20 * 0.5) - 200 * TruckC\n# So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC)\n\n# Add constraints\n# The company has a daily fuel budget of $1000.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC <= 1000)\n# The company has a daily maintenance budget of $3000.\nmodel.addCons(100 * TruckA + 150 * TruckB + 200 * TruckC <= 3000)\n# The total cargo capacity of all vehicles must not exceed 500 tons.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of technology upgrade for each type to maximize energy output and minimize operational costs.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade level for Small wind farms\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade level for Medium wind farms\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade level for Large wind farms\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output and operational cost of each wind farm type are affected by the technology upgrade level. The energy output increases and the operational cost decreases with higher technology upgrades. The company aims to maximize the net energy output (energy output minus operational cost) from all wind farms.\n// Net energy output for Small wind farms: NetOutputSmall = (1000 + 50 * TechUpgradeSmall) * SmallWindFarms - (100 + 10 * TechUpgradeSmall) * SmallWindFarms\n// Net energy output for Medium wind farms: NetOutputMedium = (2000 + 70 * TechUpgradeMedium) * MediumWindFarms - (150 + 15 * TechUpgradeMedium) * MediumWindFarms\n// Net energy output for Large wind farms: NetOutputLarge = (3000 + 100 * TechUpgradeLarge) * LargeWindFarms - (200 + 20 * TechUpgradeLarge) * LargeWindFarms\n// So, the objective function is: Maximize (NetOutputSmall + NetOutputMedium + NetOutputLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for building and upgrading wind farms.\n// (100000 * SmallWindFarms + 150000 * MediumWindFarms + 200000 * LargeWindFarms) + (5000 * TechUpgradeSmall + 7000 * TechUpgradeMedium + 10000 * TechUpgradeLarge) <= 1000000\n\n## Generate Constraint-2:\nThe total land available for wind farms is limited to 10 farms.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10\n\n## Generate Constraint-3:\nDue to environmental regulations, the company must ensure that at least 3 farms are of the Small type.\n// SmallWindFarms >= 3",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of technology upgrade for each type to maximize energy output and minimize operational costs. The energy output and operational cost of each wind farm type are affected by the technology upgrade level, with higher upgrades increasing energy output and decreasing operational costs. The company aims to maximize the net energy output (energy output minus operational cost) from all wind farms. The company has a total budget of $1,000,000 for building and upgrading wind farms. The total land available for wind farms is limited to 10 farms. Due to environmental regulations, the company must ensure that at least 3 farms are of the Small type.\n\nPlease help the company to determine the optimal number of each type of wind farm and the appropriate technology upgrade levels to maximize the net energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=3)  # number of Small wind farms\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=0)  # number of Medium wind farms\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)  # number of Large wind farms\nTechUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeSmall\", lb=0)  # technology upgrade level for Small wind farms\nTechUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeMedium\", lb=0)  # technology upgrade level for Medium wind farms\nTechUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"TechUpgradeLarge\", lb=0)  # technology upgrade level for Large wind farms\n\n# Define objective function\nNetOutputSmall = (1000 + 50 * TechUpgradeSmall) * SmallWindFarms - (100 + 10 * TechUpgradeSmall) * SmallWindFarms\nNetOutputMedium = (2000 + 70 * TechUpgradeMedium) * MediumWindFarms - (150 + 15 * TechUpgradeMedium) * MediumWindFarms\nNetOutputLarge = (3000 + 100 * TechUpgradeLarge) * LargeWindFarms - (200 + 20 * TechUpgradeLarge) * LargeWindFarms\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetOutputSmall + NetOutputMedium + NetOutputLarge)\n\n# Add constraints\nmodel.addCons((100000 * SmallWindFarms + 150000 * MediumWindFarms + 200000 * LargeWindFarms) + \n              (5000 * TechUpgradeSmall + 7000 * TechUpgradeMedium + 10000 * TechUpgradeLarge) <= 1000000)\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Technology Upgrade Level for Small: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade Level for Medium: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade Level for Large: \", model.getVal(TechUpgradeLarge))\n    print(\"Maximized Net Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit for product A is $20, for product B is $30, and for product C is $25. The company aims to maximize the total net profit.\n// NetProfit_A = A * (50 - 20)\n// NetProfit_B = B * (70 - 30)\n// NetProfit_C = C * (60 - 25)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\n// A >= 200\n// B >= 300\n\n## Generate Constraint-3:\nThe production process is such that the production of product C is dependent on the production of product A and B. Specifically, for every unit of product A produced, 0.5 units of product C can be produced, and for every unit of product B produced, 0.3 units of product C can be produced.\n// C <= 0.5 * A + 0.3 * B\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which must not exceed $25000 per month.\n// 20 * A + 30 * B + 25 * C <= 25000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $70             | $30                      |\n| C       | $60             | $25                      |\n\nThe company has a total production capacity of 1000 units per month. The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month. The production process is such that the production of product C is dependent on the production of product A and B, with 0.5 units of product C produced for every unit of product A and 0.3 units of product C produced for every unit of product B. The company has a budget constraint for production costs, which must not exceed $25000 per month.\n\nPlease help the company to maximize the total net profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nNetProfit_A = A * (50 - 20)\nNetProfit_B = B * (70 - 30)\nNetProfit_C = C * (60 - 25)\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n# The market demand for product A is at least 200 units per month, and for product B is at least 300 units per month.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 300)\n# The production process is such that the production of product C is dependent on the production of product A and B.\nmodel.addCons(C <= 0.5 * A + 0.3 * B)\n# The company has a budget constraint for production costs, which must not exceed $25000 per month.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 25000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1280,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km.\n// Fuel_Consumption_Trucks = 20 * Trucks\n// Fuel_Consumption_Vans = 15 * Vans\n// Fuel_Consumption_Bikes = 1 * Bikes\n// So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 10000\n\n## Generate Constraint-2:\nThe total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg.\n// 1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each with different fuel efficiency and cargo capacity. The company needs to determine the optimal number of each vehicle type to minimize fuel consumption while meeting delivery demands. The fuel consumption for Trucks is 20 liters per 100 km, for Vans is 15 liters per 100 km, and for Bikes is 1 liter per 100 km. The company wants to minimize the total fuel consumption per 100 km. The company has a total budget of $10,000 for purchasing vehicles. The cost of a Truck is $500, a Van is $300, and a Bike is $100. The total cargo capacity required is 5000 kg. A Truck can carry 1000 kg, a Van can carry 500 kg, and a Bike can carry 100 kg. Please help the company to determine the optimal number of each vehicle type to minimize fuel consumption while meeting the budget and cargo capacity constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nFuel_Consumption_Trucks = 20 * Trucks\nFuel_Consumption_Vans = 15 * Vans\nFuel_Consumption_Bikes = 1 * Bikes\n# So, the objective function is: Minimize (Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_Trucks + Fuel_Consumption_Vans + Fuel_Consumption_Bikes)\n\n# Add constraints\n# The company has a total budget of $10,000 for purchasing vehicles.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 10000)\n# The total cargo capacity required is 5000 kg.\nmodel.addCons(1000 * Trucks + 500 * Vans + 100 * Bikes >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Route1\": \"Upgrade1\", \"range\": \"Upgrade1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route2\": \"Upgrade2\", \"range\": \"Upgrade2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Route3\": \"Upgrade3\", \"range\": \"Upgrade3 >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its quarterly profit. The profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\n// Total profit for Route1: Profit1 = (1000 + 0.2 * Upgrade1) * Trucks1\n// Total profit for Route2: Profit2 = (1200 + 0.24 * Upgrade2) * Trucks2\n// Total profit for Route3: Profit3 = (900 + 0.18 * Upgrade3) * Trucks3\n// Additional profit from advertising: AdvertisingProfit = 5 * Advertising\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n## Generate Constraint-1:\nThe total budget for trucks, upgrades, and advertising is $100,000.\n// Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000\n\n## Generate Constraint-2:\nThe maximum number of trucks that can be deployed across all routes is 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200",
        "question": "A logistics company is planning its routes for the next quarter. They need to determine the number of trucks to allocate for each route (Route1, Route2, Route3) and the fuel efficiency upgrades for each type of truck. The company also needs to decide on the advertising budget to promote their services, which affects customer demand.\nThe profit per truck on Route1 is $1000, but with fuel efficiency upgrades, the profit increases by $100 per truck for every $500 invested in upgrades. \nThe profit per truck on Route2 is $1200, and with upgrades, the profit increases by $120 per truck for every $500 invested in upgrades. \nThe profit per truck on Route3 is $900, and with upgrades, the profit increases by $90 per truck for every $500 invested in upgrades. \nThe advertising budget increases the total demand linearly, adding $5000 in profit for every $1000 spent on advertising.\nThe total budget for trucks, upgrades, and advertising is $100,000. The maximum number of trucks that can be deployed across all routes is 200.\nPlease help the company to maximize its quarterly profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nUpgrade1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade1\", lb=0)  # fuel efficiency upgrade for Route1\nUpgrade2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade2\", lb=0)  # fuel efficiency upgrade for Route2\nUpgrade3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Upgrade3\", lb=0)  # fuel efficiency upgrade for Route3\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\n\n# Define objective function\nProfit1 = (1000 + 0.2 * Upgrade1) * Trucks1\nProfit2 = (1200 + 0.24 * Upgrade2) * Trucks2\nProfit3 = (900 + 0.18 * Upgrade3) * Trucks3\nAdvertisingProfit = 5 * Advertising\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 + AdvertisingProfit)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Upgrade1 + Upgrade2 + Upgrade3 + Advertising <= 100000)\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency Upgrade for Route1: \", model.getVal(Upgrade1))\n    print(\"Fuel Efficiency Upgrade for Route2: \", model.getVal(Upgrade2))\n    print(\"Fuel Efficiency Upgrade for Route3: \", model.getVal(Upgrade3))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type.\n// {\"number of trucks for Route A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for Route A\": \"Efficiency_A\", \"range\": \"Efficiency_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route B\": \"Efficiency_B\", \"range\": \"Efficiency_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for Route C\": \"Efficiency_C\", \"range\": \"Efficiency_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency.\n// Fuel_Consumption_A = Trucks_A / Efficiency_A\n// Fuel_Consumption_B = Trucks_B / Efficiency_B\n// Fuel_Consumption_C = Trucks_C / Efficiency_C\n// Profit_A = 1000 * Trucks_A - Fuel_Consumption_A^2\n// Profit_B = 1500 * Trucks_B - Fuel_Consumption_B^2\n// Profit_C = 2000 * Trucks_C - Fuel_Consumption_C^2\n// So, the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// Trucks_A + Trucks_B + Trucks_C <= 50",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to routes to minimize fuel consumption and maximize profit. The variables include the number of trucks assigned to each route and the fuel efficiency of each truck type. The company aims to minimize the total fuel consumption while maximizing the profit from each route. The profit from each route is a nonlinear function of the number of trucks and the fuel efficiency. The company has a total of 50 trucks available.\n\nPlease help the company to minimize the total fuel consumption (calculated as the number of trucks divided by the fuel efficiency for each route) and maximize the profit from each route (calculated as a function of the number of trucks and the fuel efficiency).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Route A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Route B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Route C\nEfficiency_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_A\", lb=0) # fuel efficiency of trucks for Route A\nEfficiency_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_B\", lb=0) # fuel efficiency of trucks for Route B\nEfficiency_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_C\", lb=0) # fuel efficiency of trucks for Route C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj_fuel = model.addVar('obj_fuel')\nobj_profit = model.addVar('obj_profit')\nmodel.setObjective(obj_fuel, \"minimize\")\nmodel.setObjective(obj_profit, \"maximize\")\n\n## convert the division to multiplication\nFuel_Consumption_A = Trucks_A * Efficiency_A\nFuel_Consumption_B = Trucks_B * Efficiency_B\nFuel_Consumption_C = Trucks_C * Efficiency_C\nProfit_A = 1000 * Trucks_A - Fuel_Consumption_A**2\nProfit_B = 1500 * Trucks_B - Fuel_Consumption_B**2\nProfit_C = 2000 * Trucks_C - Fuel_Consumption_C**2\n\n## the objective function is: Minimize (Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C) and Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj_fuel == Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C)\nmodel.addCons(obj_profit == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Route B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Route C: \", model.getVal(Trucks_C))\n    print(\"Fuel Efficiency for Route A: \", model.getVal(Efficiency_A))\n    print(\"Fuel Efficiency for Route B: \", model.getVal(Efficiency_B))\n    print(\"Fuel Efficiency for Route C: \", model.getVal(Efficiency_C))\n    print(\"Minimized Fuel Consumption: \", model.getVal(obj_fuel))\n    print(\"Maximized Profit: \", model.getVal(obj_profit))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"ExtraLargeTrucks\", \"range\": \"ExtraLargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"maintenance hours for Small trucks\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Medium trucks\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Large trucks\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n// {\"maintenance hours for Extra-Large trucks\": \"MaintenanceExtraLarge\", \"range\": \"MaintenanceExtraLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks.\n// Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n// Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n// Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n// Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\n// So, the objective function is: Maximize (RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100.\n// 50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 20.\n// SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20",
        "question": "A logistics company is planning its fleet expansion by adding new trucks to its existing fleet. The company is considering four types of trucks: Small, Medium, Large, and Extra-Large. Each type of truck has different operational costs, capacities, and expected revenues. The company also needs to decide on the number of maintenance hours to allocate to each type of truck to optimize their performance. The revenue generated by each type of truck is affected by the maintenance hours allocated. For every hour of maintenance, the revenue per truck increases by a certain percentage. Specifically, for Small trucks, each maintenance hour increases revenue by 2%; for Medium trucks, by 3%; for Large trucks, by 4%; and for Extra-Large trucks, by 5%. The company aims to maximize the total revenue from all trucks. The company has a budget of $200,000 for purchasing new trucks and maintenance. The cost of a Small truck is $50,000, a Medium truck is $70,000, a Large truck is $90,000, and an Extra-Large truck is $110,000. The cost of maintenance per hour is $100. The total number of trucks cannot exceed 20.\n\nPlease help the company to determine the optimal number of each type of truck and the maintenance hours to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nExtraLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"ExtraLargeTrucks\", lb=0)  # number of Extra-Large trucks\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)  # maintenance hours for Small trucks\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)  # maintenance hours for Medium trucks\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)  # maintenance hours for Large trucks\nMaintenanceExtraLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceExtraLarge\", lb=0)  # maintenance hours for Extra-Large trucks\n\n# Define objective function\n# Total revenue for Small trucks: RevenueSmall = (BaseRevenueSmall + 0.02 * MaintenanceSmall) * SmallTrucks\n# Total revenue for Medium trucks: RevenueMedium = (BaseRevenueMedium + 0.03 * MaintenanceMedium) * MediumTrucks\n# Total revenue for Large trucks: RevenueLarge = (BaseRevenueLarge + 0.04 * MaintenanceLarge) * LargeTrucks\n# Total revenue for Extra-Large trucks: RevenueExtraLarge = (BaseRevenueExtraLarge + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks\nRevenueSmall = (5000 + 0.02 * MaintenanceSmall) * SmallTrucks  # assuming BaseRevenueSmall = 5000\nRevenueMedium = (7000 + 0.03 * MaintenanceMedium) * MediumTrucks  # assuming BaseRevenueMedium = 7000\nRevenueLarge = (9000 + 0.04 * MaintenanceLarge) * LargeTrucks  # assuming BaseRevenueLarge = 9000\nRevenueExtraLarge = (11000 + 0.05 * MaintenanceExtraLarge) * ExtraLargeTrucks  # assuming BaseRevenueExtraLarge = 11000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueSmall + RevenueMedium + RevenueLarge + RevenueExtraLarge)\n\n# Add constraints\n# The company has a budget of $200,000 for purchasing new trucks and maintenance.\nmodel.addCons(50000 * SmallTrucks + 70000 * MediumTrucks + 90000 * LargeTrucks + 110000 * ExtraLargeTrucks + 100 * (MaintenanceSmall + MaintenanceMedium + MaintenanceLarge + MaintenanceExtraLarge) <= 200000)\n# The total number of trucks cannot exceed 20.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + ExtraLargeTrucks <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Extra-Large Trucks: \", model.getVal(ExtraLargeTrucks))\n    print(\"Maintenance Hours for Small Trucks: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Hours for Medium Trucks: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Hours for Large Trucks: \", model.getVal(MaintenanceLarge))\n    print(\"Maintenance Hours for Extra-Large Trucks: \", model.getVal(MaintenanceExtraLarge))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per Truck is $100 per day, and it can deliver 10 packages. The operational cost per Van is $50 per day, and it can deliver 5 packages. The operational cost per Bike is $20 per day, and it can deliver 2 packages. The company aims to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n// Delivery efficiency of Trucks: Efficiency_T = 10 * T / 100\n// Delivery efficiency of Vans: Efficiency_V = 5 * V / 50\n// Delivery efficiency of Bikes: Efficiency_B = 2 * B / 20\n// So, the objective function is: Maximize (Efficiency_T + Efficiency_V + Efficiency_B) = Maximize (10 * T / 100 + 5 * V / 50 + 2 * B / 20)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 per day for operational costs.\n// 100 * T + 50 * V + 20 * B <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 50 drivers available.\n// T + V + B <= 50\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to determine the optimal number of each vehicle type to maximize efficiency while considering operational costs and constraints. The operational cost and delivery capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Delivery Capacity |\n|--------------|--------------------------|-------------------|\n| Trucks       | $100                     | 10 packages       |\n| Vans         | $50                      | 5 packages        |\n| Bikes        | $20                      | 2 packages        |\n\nThe company has a budget of $1000 per day for operational costs. The company has a total of 50 drivers available. The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes. \nPlease help the company to maximize the delivery efficiency, which is defined as the total number of packages delivered per dollar spent on operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_T = 10 * T / 100\nEfficiency_V = 5 * V / 50\nEfficiency_B = 2 * B / 20\n## convert the division to multiplication\nmodel.addCons(obj * (100 * T + 50 * V + 20 * B) == 10 * T + 5 * V + 2 * B)\n\n# Add constraints\n## The company has a budget of $1000 per day for operational costs.\nmodel.addCons(100 * T + 50 * V + 20 * B <= 1000)\n## The company has a total of 50 drivers available.\nmodel.addCons(T + V + B <= 50)\n## The company wants to ensure that the number of Trucks does not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Delivery Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels and wind turbines to generate renewable energy. They have identified five potential sites (Site A, Site B, Site C, Site D, and Site E) for installation.\n// {\"number of solar panels at Site A\": \"SolarA\", \"range\": \"SolarA >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site B\": \"SolarB\", \"range\": \"SolarB >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at Site C\": \"SolarC\", \"range\": \"SolarC >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site D\": \"WindD\", \"range\": \"WindD >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at Site E\": \"WindE\", \"range\": \"WindE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n// Total cost: Cost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\n// Total environmental impact: Impact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n// So, the objective function is: Minimize Cost / Impact\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for the installation.\n// 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 1,000,000 kWh.\n// 200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000\n\n## Generate Constraint-3:\nThe maximum number of solar panels that can be installed at Site A is 1000.\n// SolarA <= 1000",
        "question": "A city is planning to install solar panels and wind turbines to generate renewable energy at five potential sites (Site A, Site B, Site C, Site D, and Site E). The city has a budget of $1,000,000 for the installation. The total annual energy output must be at least 1,000,000 kWh. The maximum number of solar panels that can be installed at Site A is 1000.\n\nFor Site A, the cost per solar panel is $1000, the annual energy output per panel is 200 kWh, and the environmental impact score is 5.\nFor Site B, the cost per solar panel is $1200, the annual energy output per panel is 220 kWh, and the environmental impact score is 6.\nFor Site C, the cost per solar panel is $1100, the annual energy output per panel is 210 kWh, and the environmental impact score is 5.5.\nFor Site D, the cost per wind turbine is $2000, the annual energy output per turbine is 500 kWh, and the environmental impact score is 7.\nFor Site E, the cost per wind turbine is $2200, the annual energy output per turbine is 550 kWh, and the environmental impact score is 7.5.\n\nThe city wants to minimize the Cost-Environmental Impact ratio of the energy generation. (The Cost-Environmental Impact ratio is defined as the total cost divided by the total environmental impact score.)\n\nPlease help the city determine the optimal number of solar panels and wind turbines to install at each site to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarA = model.addVar(vtype=\"INTEGER\", name=\"SolarA\", lb=0) # number of solar panels at Site A\nSolarB = model.addVar(vtype=\"INTEGER\", name=\"SolarB\", lb=0) # number of solar panels at Site B\nSolarC = model.addVar(vtype=\"INTEGER\", name=\"SolarC\", lb=0) # number of solar panels at Site C\nWindD = model.addVar(vtype=\"INTEGER\", name=\"WindD\", lb=0) # number of wind turbines at Site D\nWindE = model.addVar(vtype=\"INTEGER\", name=\"WindE\", lb=0) # number of wind turbines at Site E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE\nImpact = 5 * SolarA + 6 * SolarB + 5.5 * SolarC + 7 * WindD + 7.5 * WindE\n## the objective function is: Minimize Cost / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for the installation.\nmodel.addCons(1000 * SolarA + 1200 * SolarB + 1100 * SolarC + 2000 * WindD + 2200 * WindE <= 1000000)\n## The total annual energy output must be at least 1,000,000 kWh.\nmodel.addCons(200 * SolarA + 220 * SolarB + 210 * SolarC + 500 * WindD + 550 * WindE >= 1000000)\n## The maximum number of solar panels that can be installed at Site A is 1000.\nmodel.addCons(SolarA <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Site A: \", model.getVal(SolarA))\n    print(\"Number of Solar Panels at Site B: \", model.getVal(SolarB))\n    print(\"Number of Solar Panels at Site C: \", model.getVal(SolarC))\n    print(\"Number of Wind Turbines at Site D: \", model.getVal(WindD))\n    print(\"Number of Wind Turbines at Site E: \", model.getVal(WindE))\n    print(\"Minimized Cost-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1379,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the number of trips each truck should make to different regions (Region1, Region2, Region3, Region4, Region5) and the fuel consumption rate for each trip, which varies based on the region and the load.\n// {\"number of trips to Region1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to Region5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate per trip to Region1\": \"FuelRate1\", \"range\": \"FuelRate1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region2\": \"FuelRate2\", \"range\": \"FuelRate2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region3\": \"FuelRate3\", \"range\": \"FuelRate3 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region4\": \"FuelRate4\", \"range\": \"FuelRate4 >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip to Region5\": \"FuelRate5\", \"range\": \"FuelRate5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n// Revenue from Region1: Revenue1 = 1000 * Trips1\n// Revenue from Region2: Revenue2 = 1000 * Trips2\n// Revenue from Region3: Revenue3 = 1000 * Trips3\n// Revenue from Region4: Revenue4 = 1000 * Trips4\n// Revenue from Region5: Revenue5 = 1000 * Trips5\n// Fuel cost for Region1: FuelCost1 = FuelRate1^2 * Trips1\n// Fuel cost for Region2: FuelCost2 = FuelRate2^2 * Trips2\n// Fuel cost for Region3: FuelCost3 = FuelRate3^2 * Trips3\n// Fuel cost for Region4: FuelCost4 = FuelRate4^2 * Trips4\n// Fuel cost for Region5: FuelCost5 = FuelRate5^2 * Trips5\n// So, the objective function is: Maximize (Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5) - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe total number of trips across all regions must not exceed 500.\n// Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for fuel costs.\n// FuelRate1^2 * Trips1 + FuelRate2^2 * Trips2 + FuelRate3^2 * Trips3 + FuelRate4^2 * Trips4 + FuelRate5^2 * Trips5 <= 10000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of trips each truck should make to these regions and the fuel consumption rate for each trip, which varies based on the region and the load. The revenue from each trip is $1000, and the cost of fuel per trip is a nonlinear function of the fuel consumption rate, which is given by the formula: Cost = FuelRate^2. The company aims to maximize its net profit, which is the total revenue minus the total fuel cost.\n\n| Region | Revenue per Trip | Fuel Cost Formula |\n|--------|------------------|-------------------|\n| Region1 | $1000            | FuelRate1^2       |\n| Region2 | $1000            | FuelRate2^2       |\n| Region3 | $1000            | FuelRate3^2       |\n| Region4 | $1000            | FuelRate4^2       |\n| Region5 | $1000            | FuelRate5^2       |\n\nThe total number of trips across all regions must not exceed 500. The company has a budget of $10,000 for fuel costs. Please help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0)  # number of trips to Region1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0)  # number of trips to Region2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0)  # number of trips to Region3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0)  # number of trips to Region4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0)  # number of trips to Region5\nFuelRate1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate1\", lb=0)  # fuel consumption rate per trip to Region1\nFuelRate2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate2\", lb=0)  # fuel consumption rate per trip to Region2\nFuelRate3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate3\", lb=0)  # fuel consumption rate per trip to Region3\nFuelRate4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate4\", lb=0)  # fuel consumption rate per trip to Region4\nFuelRate5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate5\", lb=0)  # fuel consumption rate per trip to Region5\n\n# Define objective function\nRevenue1 = 1000 * Trips1\nRevenue2 = 1000 * Trips2\nRevenue3 = 1000 * Trips3\nRevenue4 = 1000 * Trips4\nRevenue5 = 1000 * Trips5\nFuelCost1 = FuelRate1**2 * Trips1\nFuelCost2 = FuelRate2**2 * Trips2\nFuelCost3 = FuelRate3**2 * Trips3\nFuelCost4 = FuelRate4**2 * Trips4\nFuelCost5 = FuelRate5**2 * Trips5\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue1 + Revenue2 + Revenue3 + Revenue4 + Revenue5 - (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5))\n\n# Add constraints\nmodel.addCons(Trips1 + Trips2 + Trips3 + Trips4 + Trips5 <= 500)\nmodel.addCons(FuelRate1**2 * Trips1 + FuelRate2**2 * Trips2 + FuelRate3**2 * Trips3 + FuelRate4**2 * Trips4 + FuelRate5**2 * Trips5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to Region1: \", model.getVal(Trips1))\n    print(\"Number of trips to Region2: \", model.getVal(Trips2))\n    print(\"Number of trips to Region3: \", model.getVal(Trips3))\n    print(\"Number of trips to Region4: \", model.getVal(Trips4))\n    print(\"Number of trips to Region5: \", model.getVal(Trips5))\n    print(\"Fuel consumption rate per trip to Region1: \", model.getVal(FuelRate1))\n    print(\"Fuel consumption rate per trip to Region2: \", model.getVal(FuelRate2))\n    print(\"Fuel consumption rate per trip to Region3: \", model.getVal(FuelRate3))\n    print(\"Fuel consumption rate per trip to Region4: \", model.getVal(FuelRate4))\n    print(\"Fuel consumption rate per trip to Region5: \", model.getVal(FuelRate5))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBProduction <= 2 * DeviceAProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\nmodel.addCons(DeviceBProduction <= 2 * DeviceAProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 643,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can carry 1000 kg of cargo and consumes 50 liters of fuel per day, with a daily maintenance cost of $100.\nEach Van can carry 500 kg of cargo and consumes 30 liters of fuel per day, with a daily maintenance cost of $70.\nEach Bike can carry 100 kg of cargo and consumes 5 liters of fuel per day, with a daily maintenance cost of $20.\nThe company aims to minimize the total cost of fuel and maintenance per kg of cargo carried.\n// Fuel and maintenance cost of Trucks: Cost_T = (50 * 30 + 100) * T\n// Fuel and maintenance cost of Vans: Cost_V = (30 * 30 + 70) * V\n// Fuel and maintenance cost of Bikes: Cost_B = (5 * 30 + 20) * B\n// Total cargo carried: Cargo = 1000 * T + 500 * V + 100 * B\n// So, the objective function is: Minimize (Cost_T + Cost_V + Cost_B) / Cargo\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel and maintenance costs for the month.\n// (50 * 30 + 100) * T + (30 * 30 + 70) * V + (5 * 30 + 20) * B <= 10000\n\n## Generate Constraint-2:\nThe company can only handle a maximum of 500,000 kg of cargo for the month.\n// 1000 * T + 500 * V + 100 * B <= 500000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize its operations. The details of each vehicle type are given in the following Table.\n\n| Vehicle Type | Cargo Capacity | Fuel Consumption | Daily Maintenance Cost |\n|--------------|----------------|------------------|-------------------------|\n| Trucks       | 1000 kg        | 50 liters        | $100                    |\n| Vans         | 500 kg         | 30 liters        | $70                     |\n| Bikes        | 100 kg         | 5 liters         | $20                     |\n\nThe company has a budget of $10,000 for fuel and maintenance costs for the month. The company can only handle a maximum of 500,000 kg of cargo for the month. \nPlease help the company to minimize the total cost of fuel and maintenance per kg of cargo carried.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_T = (50 * 30 + 100) * T\nCost_V = (30 * 30 + 70) * V\nCost_B = (5 * 30 + 20) * B\nCargo = 1000 * T + 500 * V + 100 * B\n## the objective function is: Minimize (Cost_T + Cost_V + Cost_B) / Cargo\n## convert the division to multiplication\nmodel.addCons(obj * Cargo == Cost_T + Cost_V + Cost_B)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel and maintenance costs for the month.\nmodel.addCons((50 * 30 + 100) * T + (30 * 30 + 70) * V + (5 * 30 + 20) * B <= 10000)\n## The company can only handle a maximum of 500,000 kg of cargo for the month.\nmodel.addCons(1000 * T + 500 * V + 100 * B <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Cost per kg of Cargo: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of V4 vehicles\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of V5 vehicles\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons.\nFor V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons.\nFor V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons.\nFor V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons.\nFor V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons.\nThe company wants to maximize the operational efficiency (cargo transported per dollar spent on maintenance).\n// Cargo_V1 = 10 * V1\n// Cargo_V2 = 15 * V2\n// Cargo_V3 = 20 * V3\n// Cargo_V4 = 25 * V4\n// Cargo_V5 = 30 * V5\n// Maintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n// So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for maintenance costs.\n// 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 100.\n// V1 + V2 + V3 + V4 + V5 <= 100\n\n## Generate Constraint-3:\nThe company must transport at least 1500 tons of cargo.\n// 10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1500\n\n## Generate Constraint-4:\nThe company must have at least 5 V1 vehicles due to specific contractual obligations.\n// V1 >= 5",
        "question": "A logistics company is planning its fleet for the next quarter. They have five types of vehicles (V1, V2, V3, V4, V5) available for deployment. Each vehicle type has different fuel efficiency, maintenance costs, and cargo capacity.\nFor V1, the fuel efficiency is 10 km/l, the maintenance cost per quarter is $500, and the cargo capacity is 10 tons.\nFor V2, the fuel efficiency is 15 km/l, the maintenance cost per quarter is $600, and the cargo capacity is 15 tons.\nFor V3, the fuel efficiency is 20 km/l, the maintenance cost per quarter is $700, and the cargo capacity is 20 tons.\nFor V4, the fuel efficiency is 25 km/l, the maintenance cost per quarter is $800, and the cargo capacity is 25 tons.\nFor V5, the fuel efficiency is 30 km/l, the maintenance cost per quarter is $900, and the cargo capacity is 30 tons.\nThe company has a budget of $50,000 for maintenance costs. The total number of vehicles cannot exceed 100. The company must transport at least 1500 tons of cargo. The company must have at least 5 V1 vehicles due to specific contractual obligations.\nPlease help the company to maximize the operational efficiency (cargo transported per dollar spent on maintenance).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=5)  # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0)  # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0)  # number of V3 vehicles\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0)  # number of V4 vehicles\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0)  # number of V5 vehicles\n\n# Define objective function\nCargo_V1 = 10 * V1\nCargo_V2 = 15 * V2\nCargo_V3 = 20 * V3\nCargo_V4 = 25 * V4\nCargo_V5 = 30 * V5\nMaintenance_Cost = 500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5\n# So, the objective function is: Maximize (Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5) / Maintenance_Cost\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Maintenance_Cost == Cargo_V1 + Cargo_V2 + Cargo_V3 + Cargo_V4 + Cargo_V5)\n\n# Add constraints\n# The company has a budget of $50,000 for maintenance costs.\nmodel.addCons(500 * V1 + 600 * V2 + 700 * V3 + 800 * V4 + 900 * V5 <= 50000)\n# The total number of vehicles cannot exceed 100.\nmodel.addCons(V1 + V2 + V3 + V4 + V5 <= 100)\n# The company must transport at least 1500 tons of cargo.\nmodel.addCons(10 * V1 + 15 * V2 + 20 * V3 + 25 * V4 + 30 * V5 >= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Number of V4 Vehicles: \", model.getVal(V4))\n    print(\"Number of V5 Vehicles: \", model.getVal(V5))\n    print(\"Maximized Operational Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"cost per unit of product A\": \"CostA\", \"range\": \"CostA >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product B\": \"CostB\", \"range\": \"CostB >= 0\", \"type\": \"real\"}\n// {\"cost per unit of product C\": \"CostC\", \"range\": \"CostC >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product A\": \"RevenueA\", \"range\": \"RevenueA >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product B\": \"RevenueB\", \"range\": \"RevenueB >= 0\", \"type\": \"real\"}\n// {\"revenue per unit of product C\": \"RevenueC\", \"range\": \"RevenueC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, and the revenue per unit is $100.\nThe cost of producing each unit of product B is $70, and the revenue per unit is $140.\nThe cost of producing each unit of product C is $60, and the revenue per unit is $120.\nThe company wants to maximize the total profit.\n// Profit_A = UnitsA * (RevenueA - CostA)\n// Profit_B = UnitsB * (RevenueB - CostB)\n// Profit_C = UnitsC * (RevenueC - CostC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the machines is 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for production costs per day.\n// UnitsA * CostA + UnitsB * CostB + UnitsC * CostC <= 5000\n\n## Generate Constraint-3:\nThe storage capacity for product A is limited to 50 units, for product B is 60 units, and for product C is 40 units.\n// UnitsA <= 50\n// UnitsB <= 60\n// UnitsC <= 40",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials, labor, and storage. The production quantities are influenced by the availability of raw materials and the production capacity of the machines. The cost and revenue per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| A       | $50           | $100             |\n| B       | $70           | $140             |\n| C       | $60           | $120             |\n\nThe company wants to maximize the total profit. The total production capacity of the machines is 100 units per day. The company has a budget of $5000 for production costs per day. The storage capacity for product A is limited to 50 units, for product B is 60 units, and for product C is 40 units.\n\nPlease help the company determine the optimal production quantities of products A, B, and C to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * (100 - 50) # Profit per unit of product A\nProfit_B = UnitsB * (140 - 70) # Profit per unit of product B\nProfit_C = UnitsC * (120 - 60) # Profit per unit of product C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C) # the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100) # The total production capacity of the machines is 100 units per day.\nmodel.addCons(UnitsA * 50 + UnitsB * 70 + UnitsC * 60 <= 5000) # The company has a budget of $5000 for production costs per day.\nmodel.addCons(UnitsA <= 50) # The storage capacity for product A is limited to 50 units.\nmodel.addCons(UnitsB <= 60) # The storage capacity for product B is limited to 60 units.\nmodel.addCons(UnitsC <= 40) # The storage capacity for product C is limited to 40 units.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company needs to decide on the optimal speed for each truck type to minimize fuel consumption per kilometer.\n// {\"number of small truck trips\": \"TripsS\", \"range\": \"TripsS >= 0\", \"type\": \"integer\"}\n// {\"number of medium truck trips\": \"TripsM\", \"range\": \"TripsM >= 0\", \"type\": \"integer\"}\n// {\"number of large truck trips\": \"TripsL\", \"range\": \"TripsL >= 0\", \"type\": \"integer\"}\n// {\"optimal speed for small trucks (km/h)\": \"SpeedS\", \"range\": \"SpeedS >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for medium trucks (km/h)\": \"SpeedM\", \"range\": \"SpeedM >= 0\", \"type\": \"continuous\"}\n// {\"optimal speed for large trucks (km/h)\": \"SpeedL\", \"range\": \"SpeedL >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per trip for each truck type is affected by the speed at which the trucks travel. The faster the trucks travel, the more trips they can make, but the fuel consumption per kilometer increases nonlinearly. The profit per trip for small trucks is $1000 - 0.1 * SpeedS^2, for medium trucks is $1500 - 0.15 * SpeedM^2, and for large trucks is $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types.\n// Total profit for small trucks: ProfitS = (1000 - 0.1 * SpeedS^2) * TripsS\n// Total profit for medium trucks: ProfitM = (1500 - 0.15 * SpeedM^2) * TripsM\n// Total profit for large trucks: ProfitL = (2000 - 0.2 * SpeedL^2) * TripsL\n// So, the objective function is: Maximize (ProfitS + ProfitM + ProfitL)\n\n## Generate Constraint-1:\nThe total number of trips across all truck types must not exceed 500.\n// TripsS + TripsM + TripsL <= 500",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to determine the optimal number of trips for each truck type (small, medium, large) and the optimal speed for each truck type to maximize profit while considering the cost of fuel, maintenance, and driver wages. The profit per trip for each truck type is affected by the speed at which the trucks travel, with the profit per trip for small trucks being $1000 - 0.1 * SpeedS^2, for medium trucks being $1500 - 0.15 * SpeedM^2, and for large trucks being $2000 - 0.2 * SpeedL^2. The company aims to maximize the total profit from all truck types.\n\n| Truck Type | Profit per Trip Formula |\n|------------|-------------------------|\n| Small      | $1000 - 0.1 * SpeedS^2  |\n| Medium     | $1500 - 0.15 * SpeedM^2 |\n| Large      | $2000 - 0.2 * SpeedL^2  |\n\nThe total number of trips across all truck types must not exceed 500. Please help the company to determine the optimal number of trips for each truck type and the optimal speed for each truck type to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsS = model.addVar(vtype=\"INTEGER\", name=\"TripsS\", lb=0)  # number of small truck trips\nTripsM = model.addVar(vtype=\"INTEGER\", name=\"TripsM\", lb=0)  # number of medium truck trips\nTripsL = model.addVar(vtype=\"INTEGER\", name=\"TripsL\", lb=0)  # number of large truck trips\nSpeedS = model.addVar(name=\"SpeedS\", lb=0)  # optimal speed for small trucks (km/h)\nSpeedM = model.addVar(name=\"SpeedM\", lb=0)  # optimal speed for medium trucks (km/h)\nSpeedL = model.addVar(name=\"SpeedL\", lb=0)  # optimal speed for large trucks (km/h)\n\n# Define objective function\nProfitS = (1000 - 0.1 * SpeedS**2) * TripsS\nProfitM = (1500 - 0.15 * SpeedM**2) * TripsM\nProfitL = (2000 - 0.2 * SpeedL**2) * TripsL\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitS + ProfitM + ProfitL)\n\n# Add constraints\nmodel.addCons(TripsS + TripsM + TripsL <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Truck Trips: \", model.getVal(TripsS))\n    print(\"Number of Medium Truck Trips: \", model.getVal(TripsM))\n    print(\"Number of Large Truck Trips: \", model.getVal(TripsL))\n    print(\"Optimal Speed for Small Trucks: \", model.getVal(SpeedS))\n    print(\"Optimal Speed for Medium Trucks: \", model.getVal(SpeedM))\n    print(\"Optimal Speed for Large Trucks: \", model.getVal(SpeedL))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"hours of machine type 1 used\": \"HoursMachine1\", \"range\": \"HoursMachine1 >= 0\", \"type\": \"real\"}\n// {\"hours of machine type 2 used\": \"HoursMachine2\", \"range\": \"HoursMachine2 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// Cost_Machine1 = HoursMachine1 * 20\n// Cost_Machine2 = HoursMachine2 * 30\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n## Generate Constraint-1:\nThe total production time available for machine type 1 is 8 hours per day.\n// UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1\n\n## Generate Constraint-2:\nThe total production time available for machine type 2 is 10 hours per day.\n// UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2",
        "question": "A manufacturer produces three types of products: A, B, and C. The production involves determining the number of units of each product to be produced daily, as well as the number of hours each machine type is utilized. The manufacturer aims to optimize production efficiency and cost. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of machine type 1 per hour is $20, and machine type 2 per hour is $30. The manufacturer wants to maximize the total daily profit.\nThe total production time available for machine type 1 is 8 hours per day. The total production time available for machine type 2 is 10 hours per day.\nPlease help the manufacturer to determine the optimal number of units of products A, B, and C to be produced daily, and the optimal number of hours each machine type should be utilized to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nHoursMachine1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine1\", lb=0) # hours of machine type 1 used\nHoursMachine2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMachine2\", lb=0) # hours of machine type 2 used\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\nCost_Machine1 = HoursMachine1 * 20\nCost_Machine2 = HoursMachine2 * 30\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Cost_Machine1 - Cost_Machine2)\n\n# Add constraints\n# The total production time available for machine type 1 is 8 hours per day.\nmodel.addCons(UnitsA * 0.5 + UnitsB * 0.4 + UnitsC * 0.3 <= HoursMachine1)\nmodel.addCons(HoursMachine1 <= 8)\n# The total production time available for machine type 2 is 10 hours per day.\nmodel.addCons(UnitsA * 0.3 + UnitsB * 0.5 + UnitsC * 0.4 <= HoursMachine2)\nmodel.addCons(HoursMachine2 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Hours of Machine Type 1 Used: \", model.getVal(HoursMachine1))\n    print(\"Hours of Machine Type 2 Used: \", model.getVal(HoursMachine2))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of product. The profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products.\n// Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n// Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n// Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 100 hours.\n// M1 + M2 + M3 + M4 <= 100\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 30 hours due to maintenance constraints.\n// M1 <= 30; M2 <= 30; M3 <= 30; M4 <= 30\n\n## Generate Constraint-3:\nThe production of product 1 must be at least 500 units.\n// (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2 >= 500",
        "question": "A manufacturing company produces 3 types of products using 4 different machines. The company needs to determine the number of hours each machine should operate to optimize production. The efficiency of each machine in producing each type of product varies, and the profit per unit of product decreases non-linearly with increased production due to market saturation. The objective is to maximize the total profit from all products. The profit functions for each product are as follows:\n\n| Product | Profit Function |\n|---------|-----------------|\n| 1       | P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2 |\n| 2       | P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4 |\n| 3       | P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4 |\n\nThe total operating hours for all machines must not exceed 100 hours. Each machine can operate for a maximum of 30 hours due to maintenance constraints. The production of product 1 must be at least 500 units.\n\nPlease help the company to maximize the total profit from all products by determining the optimal number of hours each machine should operate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\n\n# Define objective function\n## Profit from product 1: P1 = (100 - 0.1 * M1^2) * M1 + (120 - 0.2 * M2^2) * M2\n## Profit from product 2: P2 = (110 - 0.15 * M3^2) * M3 + (130 - 0.25 * M4^2) * M4\n## Profit from product 3: P3 = (120 - 0.3 * M1^2) * M1 + (140 - 0.4 * M2^2) * M2 + (150 - 0.5 * M3^2) * M3 + (160 - 0.6 * M4^2) * M4\n## The objective function is: Maximize (P1 + P2 + P3)\nP1 = (100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2\nP2 = (110 - 0.15 * M3**2) * M3 + (130 - 0.25 * M4**2) * M4\nP3 = (120 - 0.3 * M1**2) * M1 + (140 - 0.4 * M2**2) * M2 + (150 - 0.5 * M3**2) * M3 + (160 - 0.6 * M4**2) * M4\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total operating hours for all machines must not exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 + M4 <= 100)\n## Each machine can operate for a maximum of 30 hours due to maintenance constraints.\nmodel.addCons(M1 <= 30)\nmodel.addCons(M2 <= 30)\nmodel.addCons(M3 <= 30)\nmodel.addCons(M4 <= 30)\n## The production of product 1 must be at least 500 units.\nmodel.addCons((100 - 0.1 * M1**2) * M1 + (120 - 0.2 * M2**2) * M2 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n// {\"average daily mileage for trucks\": \"TruckMileage\", \"range\": \"TruckMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for vans\": \"VanMileage\", \"range\": \"VanMileage >= 0\", \"type\": \"real\"}\n// {\"average daily mileage for motorcycles\": \"MotorcycleMileage\", \"range\": \"MotorcycleMileage >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost for trucks is $0.5 per mile, for vans is $0.3 per mile, and for motorcycles is $0.1 per mile. The company aims to minimize the total daily fuel cost.\n// FuelCost_Trucks = Trucks * TruckMileage * 0.5\n// FuelCost_Vans = Vans * VanMileage * 0.3\n// FuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n// So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 per day for vehicle maintenance and fuel.\n// 0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000\n\n## Generate Constraint-2:\nThe company must meet a minimum daily delivery capacity of 5000 miles.\n// Trucks * TruckMileage + Vans * VanMileage + Motorcycles * MotorcycleMileage >= 5000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of vehicles it can operate, which is 100.\n// Trucks + Vans + Motorcycles <= 100",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each used for different delivery purposes. The company needs to optimize the number of each type of vehicle to minimize fuel costs while meeting delivery demands. The variables include the number of trucks, vans, and motorcycles, as well as the average daily mileage for each type of vehicle. The fuel cost per mile for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.1. The company aims to minimize the total daily fuel cost.\n\n| Vehicle Type | Fuel Cost per Mile |\n|--------------|-------------------|\n| Trucks       | $0.5              |\n| Vans         | $0.3              |\n| Motorcycles  | $0.1              |\n\nThe company has a total budget of $1000 per day for vehicle maintenance and fuel. The company must meet a minimum daily delivery capacity of 5000 miles. The company has a limit on the total number of vehicles it can operate, which is 100.\n\nPlease help the company determine the optimal number of trucks, vans, and motorcycles, and their respective average daily mileages to minimize the total daily fuel cost while meeting all constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\nTruckMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"TruckMileage\", lb=0)  # average daily mileage for trucks\nVanMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"VanMileage\", lb=0)  # average daily mileage for vans\nMotorcycleMileage = model.addVar(vtype=\"CONTINUOUS\", name=\"MotorcycleMileage\", lb=0)  # average daily mileage for motorcycles\n\n# Define objective function\nFuelCost_Trucks = Trucks * TruckMileage * 0.5\nFuelCost_Vans = Vans * VanMileage * 0.3\nFuelCost_Motorcycles = Motorcycles * MotorcycleMileage * 0.1\n# So, the objective function is: Minimize (FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost_Trucks + FuelCost_Vans + FuelCost_Motorcycles)\n\n# Add constraints\n# The company has a total budget of $1000 per day for vehicle maintenance and fuel.\nmodel.addCons(0.5 * Trucks * TruckMileage + 0.3 * Vans * VanMileage + 0.1 * Motorcycles * MotorcycleMileage <= 1000)\n# The company must meet a minimum daily delivery capacity of 5000 miles.\nmodel.addCons(Trucks * TruckMileage + Vans * VanMileage + Motorcycles * MotorcycleMileage >= 5000)\n# The company has a limit on the total number of vehicles it can operate, which is 100.\nmodel.addCons(Trucks + Vans + Motorcycles <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Truck Mileage: \", model.getVal(TruckMileage))\n    print(\"Van Mileage: \", model.getVal(VanMileage))\n    print(\"Motorcycle Mileage: \", model.getVal(MotorcycleMileage))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"integer\"}\n// {\"level of automation for ProductA\": \"Auto_A\", \"range\": \"Auto_A >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductB\": \"Auto_B\", \"range\": \"Auto_B >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for ProductC\": \"Auto_C\", \"range\": \"Auto_C >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products.\n// Profit_A = (150 - (100 - 5 * Auto_A)) * Q_A\n// Profit_B = (180 - (120 - 5 * Auto_B)) * Q_B\n// Profit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for implementing automation.\n// Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// Q_A + Q_B + Q_C <= 2000\n\n## Generate Constraint-3:\nThe market demand for ProductA is 500 units and for ProductB is 800 units.\n// Q_A <= 500; Q_B <= 800",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The production cost per unit decreases by $5 for every unit increase in the level of automation. The initial production cost per unit for ProductA is $100, for ProductB is $120, and for ProductC is $150. The selling price per unit is $150 for ProductA, $180 for ProductB, and $200 for ProductC. The company aims to maximize the total profit from all products. The company has a total budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units. The market demand for ProductA is 500 units and for ProductB is 800 units. Please help the company to determine the optimal production quantities and levels of automation for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"INTEGER\", name=\"Q_A\", lb=0) # quantity of ProductA\nQ_B = model.addVar(vtype=\"INTEGER\", name=\"Q_B\", lb=0) # quantity of ProductB\nQ_C = model.addVar(vtype=\"INTEGER\", name=\"Q_C\", lb=0) # quantity of ProductC\nAuto_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_A\", lb=0) # level of automation for ProductA\nAuto_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_B\", lb=0) # level of automation for ProductB\nAuto_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Auto_C\", lb=0) # level of automation for ProductC\n\n# Define objective function\nProfit_A = (150 - (100 - 5 * Auto_A)) * Q_A\nProfit_B = (180 - (120 - 5 * Auto_B)) * Q_B\nProfit_C = (200 - (150 - 5 * Auto_C)) * Q_C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $100,000 for implementing automation.\nmodel.addCons(Auto_A * Q_A + Auto_B * Q_B + Auto_C * Q_C <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(Q_A + Q_B + Q_C <= 2000)\n# The market demand for ProductA is 500 units and for ProductB is 800 units.\nmodel.addCons(Q_A <= 500)\nmodel.addCons(Q_B <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(Q_A))\n    print(\"Quantity of ProductB: \", model.getVal(Q_B))\n    print(\"Quantity of ProductC: \", model.getVal(Q_C))\n    print(\"Level of Automation for ProductA: \", model.getVal(Auto_A))\n    print(\"Level of Automation for ProductB: \", model.getVal(Auto_B))\n    print(\"Level of Automation for ProductC: \", model.getVal(Auto_C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to optimize efficiency and cost.\n// {\"number of trips for truck 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck has a different fuel efficiency and maintenance cost per trip. \nFor truck 1, the fuel efficiency is 10 km/l, and the maintenance cost per trip is $100.\nFor truck 2, the fuel efficiency is 12 km/l, and the maintenance cost per trip is $120.\nFor truck 3, the fuel efficiency is 15 km/l, and the maintenance cost per trip is $150.\nFor truck 4, the fuel efficiency is 18 km/l, and the maintenance cost per trip is $180.\nFor truck 5, the fuel efficiency is 20 km/l, and the maintenance cost per trip is $200.\nThe company wants to minimize the total cost of fuel and maintenance per kilometer.\n// Fuel cost per kilometer for truck 1: F1 = 100 / (10 * T1)\n// Fuel cost per kilometer for truck 2: F2 = 120 / (12 * T2)\n// Fuel cost per kilometer for truck 3: F3 = 150 / (15 * T3)\n// Fuel cost per kilometer for truck 4: F4 = 180 / (18 * T4)\n// Fuel cost per kilometer for truck 5: F5 = 200 / (20 * T5)\n// Total cost per kilometer: Cost = F1 + F2 + F3 + F4 + F5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total number of trips across all trucks must not exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach truck can make a maximum of 20 trips.\n// T1 <= 20; T2 <= 20; T3 <= 20; T4 <= 20; T5 <= 20",
        "question": "A logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to decide the number of trips each truck should make to optimize efficiency and cost. Each truck has a different fuel efficiency and maintenance cost per trip. For truck 1, the fuel efficiency is 10 km/l, and the maintenance cost per trip is $100. For truck 2, the fuel efficiency is 12 km/l, and the maintenance cost per trip is $120. For truck 3, the fuel efficiency is 15 km/l, and the maintenance cost per trip is $150. For truck 4, the fuel efficiency is 18 km/l, and the maintenance cost per trip is $180. For truck 5, the fuel efficiency is 20 km/l, and the maintenance cost per trip is $200. The company wants to minimize the total cost of fuel and maintenance per kilometer. The total number of trips across all trucks must not exceed 100. Each truck can make a maximum of 20 trips. Please help the company to minimize the total cost of fuel and maintenance per kilometer.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=20) # number of trips for truck 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0, ub=20) # number of trips for truck 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0, ub=20) # number of trips for truck 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0, ub=20) # number of trips for truck 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0, ub=20) # number of trips for truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nF1 = 100 / (10 * T1)\nF2 = 120 / (12 * T2)\nF3 = 150 / (15 * T3)\nF4 = 180 / (18 * T4)\nF5 = 200 / (20 * T5)\n## convert the division to multiplication\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5)\n\n# Add constraints\n## The total number of trips across all trucks must not exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for truck 1: \", model.getVal(T1))\n    print(\"Number of trips for truck 2: \", model.getVal(T2))\n    print(\"Number of trips for truck 3: \", model.getVal(T3))\n    print(\"Number of trips for truck 4: \", model.getVal(T4))\n    print(\"Number of trips for truck 5: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 993,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Buses\": \"Buses\", \"range\": \"Buses >= 0\", \"type\": \"integer\"}\n// {\"number of Sedans\": \"Sedans\", \"range\": \"Sedans >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of purchasing and maintaining each type of vehicle varies, as does the revenue generated per vehicle. The cost of Trucks is $100,000 with a maintenance cost of $10,000 per year, and they generate $50,000 per year. Vans cost $50,000 with a maintenance cost of $5,000 per year, and they generate $30,000 per year. Buses cost $80,000 with a maintenance cost of $8,000 per year, and they generate $40,000 per year. Sedans cost $30,000 with a maintenance cost of $3,000 per year, and they generate $20,000 per year. Motorcycles cost $10,000 with a maintenance cost of $1,000 per year, and they generate $10,000 per year. The company wants to maximize the net profit per vehicle.\n// Total net profit for Trucks: Profit_Trucks = 50,000 * Trucks - (100,000 * Trucks + 10,000 * Trucks)\n// Total net profit for Vans: Profit_Vans = 30,000 * Vans - (50,000 * Vans + 5,000 * Vans)\n// Total net profit for Buses: Profit_Buses = 40,000 * Buses - (80,000 * Buses + 8,000 * Buses)\n// Total net profit for Sedans: Profit_Sedans = 20,000 * Sedans - (30,000 * Sedans + 3,000 * Sedans)\n// Total net profit for Motorcycles: Profit_Motorcycles = 10,000 * Motorcycles - (10,000 * Motorcycles + 1,000 * Motorcycles)\n// So, the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / (Trucks + Vans + Buses + Sedans + Motorcycles))\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for purchasing vehicles.\n// 100,000 * Trucks + 50,000 * Vans + 80,000 * Buses + 30,000 * Sedans + 10,000 * Motorcycles <= 5,000,000\n\n## Generate Constraint-2:\nThe annual maintenance budget is $500,000.\n// 10,000 * Trucks + 5,000 * Vans + 8,000 * Buses + 3,000 * Sedans + 1,000 * Motorcycles <= 500,000\n\n## Generate Constraint-3:\nThe company must have at least 10 different vehicles in total.\n// Trucks + Vans + Buses + Sedans + Motorcycles >= 10\n\n## Generate Constraint-4:\nThe number of Trucks must be at least twice the number of Sedans.\n// Trucks >= 2 * Sedans\n\n## Generate Constraint-5:\nThe number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans.\n// Motorcycles <= 0.5 * (Trucks + Vans)",
        "question": "A logistics company is planning its fleet for the next year, focusing on five types of vehicles: Trucks, Vans, Buses, Sedans, and Motorcycles. The company needs to decide how many of each type of vehicle to purchase and maintain for optimal operation. The cost of purchasing and maintaining each type of vehicle, as well as the revenue generated per vehicle, are given in the following Table.\n\n| Vehicle | Purchase Cost | Maintenance Cost | Annual Revenue |\n|---------|---------------|------------------|----------------|\n| Trucks  | $100,000      | $10,000          | $50,000        |\n| Vans    | $50,000       | $5,000           | $30,000        |\n| Buses   | $80,000       | $8,000           | $40,000        |\n| Sedans  | $30,000       | $3,000           | $20,000        |\n| Motorcycles | $10,000     | $1,000           | $10,000        |\n\nThe company has a budget of $5,000,000 for purchasing vehicles and an annual maintenance budget of $500,000. The company must have at least 10 different vehicles in total. The number of Trucks must be at least twice the number of Sedans, and the number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans. \n\nPlease help the company to maximize the net profit per vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBuses = model.addVar(vtype=\"INTEGER\", name=\"Buses\", lb=0)  # number of Buses\nSedans = model.addVar(vtype=\"INTEGER\", name=\"Sedans\", lb=0)  # number of Sedans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of Motorcycles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Trucks = 50000 * Trucks - (100000 * Trucks + 10000 * Trucks)\nProfit_Vans = 30000 * Vans - (50000 * Vans + 5000 * Vans)\nProfit_Buses = 40000 * Buses - (80000 * Buses + 8000 * Buses)\nProfit_Sedans = 20000 * Sedans - (30000 * Sedans + 3000 * Sedans)\nProfit_Motorcycles = 10000 * Motorcycles - (10000 * Motorcycles + 1000 * Motorcycles)\nTotal_Vehicles = Trucks + Vans + Buses + Sedans + Motorcycles\n## the objective function is: Maximize ((Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles) / Total_Vehicles)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Vehicles == Profit_Trucks + Profit_Vans + Profit_Buses + Profit_Sedans + Profit_Motorcycles)\n\n# Add constraints\n## The company has a budget of $5,000,000 for purchasing vehicles.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 80000 * Buses + 30000 * Sedans + 10000 * Motorcycles <= 5000000)\n## The annual maintenance budget is $500,000.\nmodel.addCons(10000 * Trucks + 5000 * Vans + 8000 * Buses + 3000 * Sedans + 1000 * Motorcycles <= 500000)\n## The company must have at least 10 different vehicles in total.\nmodel.addCons(Trucks + Vans + Buses + Sedans + Motorcycles >= 10)\n## The number of Trucks must be at least twice the number of Sedans.\nmodel.addCons(Trucks >= 2 * Sedans)\n## The number of Motorcycles cannot exceed 50% of the total number of Trucks and Vans.\nmodel.addCons(Motorcycles <= 0.5 * (Trucks + Vans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Buses: \", model.getVal(Buses))\n    print(\"Number of Sedans: \", model.getVal(Sedans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Maximized Net Profit per Vehicle: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1236,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Each product requires a different amount of raw materials and labor hours per unit produced.\n// {\"production quantity of product A\": \"A_Quantity\", \"range\": \"A_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B_Quantity\", \"range\": \"B_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C_Quantity\", \"range\": \"C_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"Num_Shifts\", \"range\": \"Num_Shifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $50 per unit, Product B has a profit margin of $70 per unit, and Product C has a profit margin of $60 per unit. Operating an additional shift incurs a cost of $1000 per shift. The company aims to maximize the total daily profit.\n// Profit_A = 50 * A_Quantity\n// Profit_B = 70 * B_Quantity\n// Profit_C = 60 * C_Quantity\n// Shift_Cost = 1000 * Num_Shifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Shift_Cost)\n\n## Generate Constraint-1:\nThe factory has a total of 1000 labor hours available per day. Producing one unit of A requires 2 hours, one unit of B requires 3 hours, and one unit of C requires 4 hours.\n// 2 * A_Quantity + 3 * B_Quantity + 4 * C_Quantity <= 1000\n\n## Generate Constraint-2:\nThe company has a daily raw material budget of $2000. Producing one unit of A requires $30 of raw materials, one unit of B requires $40, and one unit of C requires $50.\n// 30 * A_Quantity + 40 * B_Quantity + 50 * C_Quantity <= 2000\n\n## Generate Constraint-3:\nThe company can operate at most 3 shifts per day.\n// Num_Shifts <= 3",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product per day, as well as the number of shifts to operate in their factory. Product A has a profit margin of $50 per unit, Product B has a profit margin of $70 per unit, and Product C has a profit margin of $60 per unit. Operating an additional shift incurs a cost of $1000 per shift. The factory has a total of 1000 labor hours available per day, with producing one unit of A requiring 2 hours, one unit of B requiring 3 hours, and one unit of C requiring 4 hours. The company has a daily raw material budget of $2000, with producing one unit of A requiring $30 of raw materials, one unit of B requiring $40, and one unit of C requiring $50. The company can operate at most 3 shifts per day. Please help the company to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"A_Quantity\", lb=0) # production quantity of product A\nB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"B_Quantity\", lb=0) # production quantity of product B\nC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"C_Quantity\", lb=0) # production quantity of product C\nNum_Shifts = model.addVar(vtype=\"INTEGER\", name=\"Num_Shifts\", lb=0, ub=3) # number of shifts\n\n# Define objective function\nProfit_A = 50 * A_Quantity\nProfit_B = 70 * B_Quantity\nProfit_C = 60 * C_Quantity\nShift_Cost = 1000 * Num_Shifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - Shift_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - Shift_Cost)\n\n# Add constraints\n# The factory has a total of 1000 labor hours available per day.\nmodel.addCons(2 * A_Quantity + 3 * B_Quantity + 4 * C_Quantity <= 1000)\n# The company has a daily raw material budget of $2000.\nmodel.addCons(30 * A_Quantity + 40 * B_Quantity + 50 * C_Quantity <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A_Quantity))\n    print(\"Production Quantity of Product B: \", model.getVal(B_Quantity))\n    print(\"Production Quantity of Product C: \", model.getVal(C_Quantity))\n    print(\"Number of Shifts: \", model.getVal(Num_Shifts))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck i at speed x\": \"Efficiency_i(x)\", \"range\": \"Efficiency_i(x) > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n// Fuel consumption for truck i on route j: Consumption_ij = Distance_j / Efficiency_i(Speed_i) * Trucks_j\n// Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\n// Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 100.\n// \u03a3(Trucks_j) for all j <= 100\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 120 km/h.\n// Speed_i <= 120 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n\n| Variable                | Description                                                                 | Range/Type       |\n|-------------------------|-----------------------------------------------------------------------------|------------------|\n| Speed_i (km/h)          | Speed of truck i                                                             | 0 < Speed_i < 120, Continuous |\n| Trucks_j                | Number of trucks on route j                                                  | Trucks_j >= 0, Integer |\n| Efficiency_i(x) (km/l)  | Fuel efficiency of truck i at speed x, modeled by a quadratic function      | Efficiency_i(x) > 0, Continuous |\n\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route.\n\nThe company has the following constraints:\n1. The total number of trucks available is limited to 100.\n2. The maximum speed limit for any truck is 120 km/h.\n\nPlease help the company to minimize the total fuel consumption across all trucks and routes, considering the nonlinear relationship between speed and fuel efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## speed of truck i\nSpeed = {}\nfor i in range(1, 101):  # Assuming a maximum of 100 trucks\n    Speed[i] = model.addVar(name=f\"Speed_{i}\", lb=0, ub=120, vtype=\"CONTINUOUS\")\n\n## number of trucks on route j\nTrucks = {}\nfor j in range(1, 11):  # Assuming a maximum of 10 routes\n    Trucks[j] = model.addVar(name=f\"Trucks_{j}\", vtype=\"INTEGER\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\nConsumption = {}\nfor i in range(1, 101):\n    for j in range(1, 11):\n        ## Efficiency_i(x) = a_i * x^2 + b_i * x + c_i\n        a_i = 0.001  # Example coefficients\n        b_i = 0.1\n        c_i = 10\n        Efficiency_i = a_i * Speed[i]**2 + b_i * Speed[i] + c_i\n        Consumption[i, j] = model.addVar(name=f\"Consumption_{i}_{j}\", vtype=\"CONTINUOUS\")\n        model.addCons(Consumption[i, j] == (1 / Efficiency_i) * Trucks[j])  # Assuming Distance_j = 1 for simplicity\n        model.addCons(obj >= Consumption[i, j])\n\n# Add constraints\n## The total number of trucks available is limited to 100.\nmodel.addCons(sum(Trucks[j] for j in range(1, 11)) <= 100)\n\n## The maximum speed limit for any truck is 120 km/h.\nfor i in range(1, 101):\n    model.addCons(Speed[i] <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Optimal fuel consumption: \", model.getObjVal())\n    for i in range(1, 101):\n        print(f\"Speed of truck {i}: \", model.getVal(Speed[i]))\n    for j in range(1, 11):\n        print(f\"Number of trucks on route {j}: \", model.getVal(Trucks[j]))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1742,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse. At warehouse 1, the cost per truck is $1000, increasing by $10 for each additional truck beyond the first. At warehouse 2, the cost per truck is $1200, increasing by $12 for each additional truck beyond the first. At warehouse 3, the cost per truck is $1100, increasing by $11 for each additional truck beyond the first. At warehouse 4, the cost per truck is $1300, increasing by $13 for each additional truck beyond the first. At warehouse 5, the cost per truck is $1400, increasing by $14 for each additional truck beyond the first. The company aims to minimize the total operating cost of all trucks.\n// Cost_T1 = 1000 + 10 * (T1 - 1) * T1\n// Cost_T2 = 1200 + 12 * (T2 - 1) * T2\n// Cost_T3 = 1100 + 11 * (T3 - 1) * T3\n// Cost_T4 = 1300 + 13 * (T4 - 1) * T4\n// Cost_T5 = 1400 + 14 * (T5 - 1) * T5\n// So, the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is limited to 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach warehouse has a minimum requirement for trucks to meet delivery demands. Warehouse 1 requires at least 10 trucks, warehouse 2 requires at least 15 trucks, warehouse 3 requires at least 20 trucks, warehouse 4 requires at least 25 trucks, and warehouse 5 requires at least 30 trucks.\n// T1 >= 10; T2 >= 15; T3 >= 20; T4 >= 25; T5 >= 30",
        "question": "A logistics company operates five different warehouses across the country. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse. The cost per truck and the additional cost for each additional truck beyond the first are given in the following Table.\n\n| Warehouse | Cost per Truck | Additional Cost per Truck Beyond First |\n|-----------|----------------|---------------------------------------|\n| 1         | $1000          | $10                                   |\n| 2         | $1200          | $12                                   |\n| 3         | $1100          | $11                                   |\n| 4         | $1300          | $13                                   |\n| 5         | $1400          | $14                                   |\n\nThe total number of trucks available across all warehouses is limited to 100. Each warehouse has a minimum requirement for trucks to meet delivery demands. Warehouse 1 requires at least 10 trucks, warehouse 2 requires at least 15 trucks, warehouse 3 requires at least 20 trucks, warehouse 4 requires at least 25 trucks, and warehouse 5 requires at least 30 trucks.\nPlease help the company to minimize the total operating cost of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to optimize the allocation of trucks to each warehouse.\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=10) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=15) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=20) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=25) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=30) # number of trucks at warehouse 5\n\n# Define objective function\n## The cost of operating a truck at each warehouse is influenced by the number of trucks at that warehouse.\n## Cost_T1 = 1000 + 10 * (T1 - 1) * T1\n## Cost_T2 = 1200 + 12 * (T2 - 1) * T2\n## Cost_T3 = 1100 + 11 * (T3 - 1) * T3\n## Cost_T4 = 1300 + 13 * (T4 - 1) * T4\n## Cost_T5 = 1400 + 14 * (T5 - 1) * T5\n## So, the objective function is: Minimize Cost_T1 + Cost_T2 + Cost_T3 + Cost_T4 + Cost_T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == (1000 + 10 * (T1 - 1)) * T1 + (1200 + 12 * (T2 - 1)) * T2 + \n                  (1100 + 11 * (T3 - 1)) * T3 + (1300 + 13 * (T4 - 1)) * T4 + \n                  (1400 + 14 * (T5 - 1)) * T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is limited to 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1378,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company wants to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).\n// Total_Cost_T1 = 1.5 * T1\n// Total_Cost_T2 = 2 * T2\n// Total_Cost_T3 = 2.5 * T3\n// Total_Cost_T4 = 3 * T4\n// Total_Cost_T5 = 3.5 * T5\n// So, the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / (10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations.\n// 1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-3:\nThe company must deliver at least 2000 tons of goods.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000",
        "question": "A logistics company needs to optimize its fleet of trucks for delivering goods across different regions. The company operates five types of trucks: T1, T2, T3, T4, and T5, each with different capacities and fuel efficiencies.\nFor T1, the fuel consumption per kilometer is 0.2 liters, the cost per kilometer is $1.5, and the capacity is 10 tons.\nFor T2, the fuel consumption per kilometer is 0.3 liters, the cost per kilometer is $2, and the capacity is 20 tons.\nFor T3, the fuel consumption per kilometer is 0.4 liters, the cost per kilometer is $2.5, and the capacity is 30 tons.\nFor T4, the fuel consumption per kilometer is 0.5 liters, the cost per kilometer is $3, and the capacity is 40 tons.\nFor T5, the fuel consumption per kilometer is 0.6 liters, the cost per kilometer is $3.5, and the capacity is 50 tons.\nThe company has a budget of $10,000 for truck operations. The total number of trucks cannot exceed 100. The company must deliver at least 2000 tons of goods.\nPlease help the company to minimize the total cost per ton-kilometer (cost per kilometer divided by capacity).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost_T1 = 1.5 * T1\nTotal_Cost_T2 = 2 * T2\nTotal_Cost_T3 = 2.5 * T3\nTotal_Cost_T4 = 3 * T4\nTotal_Cost_T5 = 3.5 * T5\nCapacity = 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5\n## the objective function is: Minimize (Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5) / Capacity\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Total_Cost_T1 + Total_Cost_T2 + Total_Cost_T3 + Total_Cost_T4 + Total_Cost_T5)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations.\nmodel.addCons(1.5 * T1 + 2 * T2 + 2.5 * T3 + 3 * T4 + 3.5 * T5 <= 10000)\n## The total number of trucks cannot exceed 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n## The company must deliver at least 2000 tons of goods.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit.\n// The total value of Product A: VA = 20 * (10 * M1 + 8 * M2 + 6 * M3)\n// The total value of Product B: VB = 30 * (5 * M1 + 12 * M2 + 15 * M3)\n// So, the objective function is: Maximize (VA + VB)\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 120 hours per week.\n// M1 + M2 + M3 <= 120\n\n## Generate Constraint-2:\nMachine 1 can operate for a maximum of 50 hours per week.\n// M1 <= 50",
        "question": "A manufacturing company produces two types of products using three different machines. The company needs to determine the number of hours each machine should operate to optimize production. Each machine has a different efficiency in producing both products. Machine 1 produces 10 units of Product A and 5 units of Product B per hour. Machine 2 produces 8 units of Product A and 12 units of Product B per hour. Machine 3 produces 6 units of Product A and 15 units of Product B per hour. The company aims to maximize the total production value, where Product A is valued at $20 per unit and Product B is valued at $30 per unit. The total operating hours for all machines must not exceed 120 hours per week, and Machine 1 can operate for a maximum of 50 hours per week. Please help the company to maximize the total production value (which is the sum of the value of Product A and Product B).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\nVA = 20 * (10 * M1 + 8 * M2 + 6 * M3) # total value of Product A\nVB = 30 * (5 * M1 + 12 * M2 + 15 * M3) # total value of Product B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB) # objective function: Maximize (VA + VB)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 120) # total operating hours for all machines must not exceed 120 hours per week\nmodel.addCons(M1 <= 50) # Machine 1 can operate for a maximum of 50 hours per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker to meet the production demands. The production rate per worker varies by product and overtime hours.\n// {\"production quantity of ProductA\": \"ProductA_Quantity\", \"range\": \"ProductA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"ProductB_Quantity\", \"range\": \"ProductB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"ProductC_Quantity\", \"range\": \"ProductC_Quantity >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"overtime hours per worker\": \"OvertimeHours\", \"range\": \"OvertimeHours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of labor per worker for ProductA is $200 per day, for ProductB is $250 per day, and for ProductC is $300 per day. Overtime hours increase the labor cost by $50 per hour. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = 50 * ProductA_Quantity - (200 + 50 * OvertimeHours) * WorkersA\n// Total profit for ProductB: ProfitB = 70 * ProductB_Quantity - (250 + 50 * OvertimeHours) * WorkersB\n// Total profit for ProductC: ProfitC = 90 * ProductC_Quantity - (300 + 50 * OvertimeHours) * WorkersC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the number of workers assigned to each product line, and the amount of overtime hours allowed for each worker to meet the production demands. The production rate per worker varies by product and overtime hours. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of labor per worker for ProductA is $200 per day, for ProductB is $250 per day, and for ProductC is $300 per day. Overtime hours increase the labor cost by $50 per hour. The company aims to maximize the total profit from all products. The company has a total of 100 workers available.\nPlease help the company determine the optimal production quantities, worker allocations, and overtime hours to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductA_Quantity\", lb=0)\nProductB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductB_Quantity\", lb=0)\nProductC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"ProductC_Quantity\", lb=0)\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)\nOvertimeHours = model.addVar(vtype=\"CONTINUOUS\", name=\"OvertimeHours\", lb=0)\n\n# Define objective function\nProfitA = 50 * ProductA_Quantity - (200 + 50 * OvertimeHours) * WorkersA\nProfitB = 70 * ProductB_Quantity - (250 + 50 * OvertimeHours) * WorkersB\nProfitC = 90 * ProductC_Quantity - (300 + 50 * OvertimeHours) * WorkersC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(ProductA_Quantity))\n    print(\"Production Quantity of ProductB: \", model.getVal(ProductB_Quantity))\n    print(\"Production Quantity of ProductC: \", model.getVal(ProductC_Quantity))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Overtime Hours per Worker: \", model.getVal(OvertimeHours))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to purchase to maximize their operational efficiency.\n// {\"number of T1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of T2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of T3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of T4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of T5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nT1 has a fuel efficiency of 5 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 10 tons.\nT2 has a fuel efficiency of 7 km/l, a maintenance cost of $1200 per month, and a cargo capacity of 15 tons.\nT3 has a fuel efficiency of 9 km/l, a maintenance cost of $1500 per month, and a cargo capacity of 20 tons.\nT4 has a fuel efficiency of 11 km/l, a maintenance cost of $1800 per month, and a cargo capacity of 25 tons.\nT5 has a fuel efficiency of 13 km/l, a maintenance cost of $2000 per month, and a cargo capacity of 30 tons.\nThe company wants to maximize the total profit, which is the revenue from cargo transportation minus the total maintenance and fuel costs.\n// Profit_T1 = (10 * T1 * PricePerTon) - (1000 * T1) - (Distance / 5 * FuelPrice * T1)\n// Profit_T2 = (15 * T2 * PricePerTon) - (1200 * T2) - (Distance / 7 * FuelPrice * T2)\n// Profit_T3 = (20 * T3 * PricePerTon) - (1500 * T3) - (Distance / 9 * FuelPrice * T3)\n// Profit_T4 = (25 * T4 * PricePerTon) - (1800 * T4) - (Distance / 11 * FuelPrice * T4)\n// Profit_T5 = (30 * T5 * PricePerTon) - (2000 * T5) - (Distance / 13 * FuelPrice * T5)\n// So, the objective function is: Maximize (Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// 100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 100000\n\n## Generate Constraint-2:\nThe total cargo capacity of all trucks should not exceed 1000 tons.\n// 10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 1000\n\n## Generate Constraint-3:\nThe company has a maximum parking space for 50 trucks.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-4:\nDue to environmental regulations, the total number of T1 and T2 trucks should not exceed the total number of T3, T4, and T5 trucks.\n// T1 + T2 <= T3 + T4 + T5",
        "question": "A logistics company operates five different types of trucks: T1, T2, T3, T4, and T5. Each truck has a different fuel efficiency, maintenance cost, and cargo capacity. The company needs to determine the optimal number of each type of truck to purchase to maximize their operational efficiency.\nT1 has a fuel efficiency of 5 km/l, a maintenance cost of $1000 per month, and a cargo capacity of 10 tons.\nT2 has a fuel efficiency of 7 km/l, a maintenance cost of $1200 per month, and a cargo capacity of 15 tons.\nT3 has a fuel efficiency of 9 km/l, a maintenance cost of $1500 per month, and a cargo capacity of 20 tons.\nT4 has a fuel efficiency of 11 km/l, a maintenance cost of $1800 per month, and a cargo capacity of 25 tons.\nT5 has a fuel efficiency of 13 km/l, a maintenance cost of $2000 per month, and a cargo capacity of 30 tons.\nThe company has a budget of $100,000 for purchasing new trucks. The total cargo capacity of all trucks should not exceed 1000 tons. The company has a maximum parking space for 50 trucks. Due to environmental regulations, the total number of T1 and T2 trucks should not exceed the total number of T3, T4, and T5 trucks.\nPlease help the company to maximize the total profit, which is the revenue from cargo transportation minus the total maintenance and fuel costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of T1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of T2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of T3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of T4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of T5 trucks\n\n# Define objective function\n# Assume constants for PricePerTon, Distance, and FuelPrice\nPricePerTon = 100  # example value\nDistance = 1000   # example value\nFuelPrice = 1    # example value\n\nProfit_T1 = (10 * T1 * PricePerTon) - (1000 * T1) - (Distance / 5 * FuelPrice * T1)\nProfit_T2 = (15 * T2 * PricePerTon) - (1200 * T2) - (Distance / 7 * FuelPrice * T2)\nProfit_T3 = (20 * T3 * PricePerTon) - (1500 * T3) - (Distance / 9 * FuelPrice * T3)\nProfit_T4 = (25 * T4 * PricePerTon) - (1800 * T4) - (Distance / 11 * FuelPrice * T4)\nProfit_T5 = (30 * T5 * PricePerTon) - (2000 * T5) - (Distance / 13 * FuelPrice * T5)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T1 + Profit_T2 + Profit_T3 + Profit_T4 + Profit_T5)\n\n# Add constraints\nmodel.addCons(100000 * T1 + 120000 * T2 + 150000 * T3 + 180000 * T4 + 200000 * T5 <= 100000)\nmodel.addCons(10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5 <= 1000)\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\nmodel.addCons(T1 + T2 <= T3 + T4 + T5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of T1 Trucks: \", model.getVal(T1))\n    print(\"Number of T2 Trucks: \", model.getVal(T2))\n    print(\"Number of T3 Trucks: \", model.getVal(T3))\n    print(\"Number of T4 Trucks: \", model.getVal(T4))\n    print(\"Number of T5 Trucks: \", model.getVal(T5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The variables include the number of units of ProductA, ProductB, and ProductC to be produced, as well as the amount of raw material R1 and R2 used in the production of each product.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"amount of raw material R1 used for ProductA\": \"R1A\", \"range\": \"R1A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductB\": \"R1B\", \"range\": \"R1B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R1 used for ProductC\": \"R1C\", \"range\": \"R1C >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductA\": \"R2A\", \"range\": \"R2A >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductB\": \"R2B\", \"range\": \"R2B >= 0\", \"type\": \"real\"}\n// {\"amount of raw material R2 used for ProductC\": \"R2C\", \"range\": \"R2C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is determined by the selling price minus the cost of raw materials and production. The selling price for ProductA is $100, for ProductB is $150, and for ProductC is $200. The cost of raw material R1 is $5 per unit, and R2 is $10 per unit. The production cost for each unit of ProductA is $30, for ProductB is $40, and for ProductC is $50. The company aims to maximize the total profit.\n// Profit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\n// Profit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\n// Profit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material R1 available.\n// R1A + R1B + R1C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material R2 available.\n// R2A + R2B + R2C <= 1500\n\n## Generate Constraint-3:\nThe production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\n// R1A >= 2 * R2A\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ProductB.\n// UnitsB >= 50\n\n## Generate Constraint-5:\nThe total production cost should not exceed $10,000.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC <= 10000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit while considering various costs and constraints. The selling price, production cost, and the cost of raw materials for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost | Cost of R1 per Unit | Cost of R2 per Unit |\n|---------|---------------|-----------------|----------------------|---------------------|\n| ProductA | $100         | $30             | $5                   | $10                 |\n| ProductB | $150         | $40             | $5                   | $10                 |\n| ProductC | $200         | $50             | $5                   | $10                 |\n\nThe company has a total of 1000 units of raw material R1 available and 1500 units of raw material R2 available. The production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA. The company must produce at least 50 units of ProductB. The total production cost should not exceed $10,000.\n\nPlease help the company to maximize the total profit by determining the optimal number of units of each product to produce and the amount of raw materials R1 and R2 to use for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nR1A = model.addVar(vtype=\"CONTINUOUS\", name=\"R1A\", lb=0) # amount of raw material R1 used for ProductA\nR1B = model.addVar(vtype=\"CONTINUOUS\", name=\"R1B\", lb=0) # amount of raw material R1 used for ProductB\nR1C = model.addVar(vtype=\"CONTINUOUS\", name=\"R1C\", lb=0) # amount of raw material R1 used for ProductC\nR2A = model.addVar(vtype=\"CONTINUOUS\", name=\"R2A\", lb=0) # amount of raw material R2 used for ProductA\nR2B = model.addVar(vtype=\"CONTINUOUS\", name=\"R2B\", lb=0) # amount of raw material R2 used for ProductB\nR2C = model.addVar(vtype=\"CONTINUOUS\", name=\"R2C\", lb=0) # amount of raw material R2 used for ProductC\n\n# Define objective function\nProfit_A = (100 - 30 - 5 * R1A - 10 * R2A) * UnitsA\nProfit_B = (150 - 40 - 5 * R1B - 10 * R2B) * UnitsB\nProfit_C = (200 - 50 - 5 * R1C - 10 * R2C) * UnitsC\n# The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total of 1000 units of raw material R1 available.\nmodel.addCons(R1A + R1B + R1C <= 1000)\n# The company has a total of 1500 units of raw material R2 available.\nmodel.addCons(R2A + R2B + R2C <= 1500)\n# The production process requires that the amount of R1 used for ProductA must be at least twice the amount of R2 used for ProductA.\nmodel.addCons(R1A >= 2 * R2A)\n# The company must produce at least 50 units of ProductB.\nmodel.addCons(UnitsB >= 50)\n# The total production cost should not exceed $10,000.\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Amount of R1 used for ProductA: \", model.getVal(R1A))\n    print(\"Amount of R1 used for ProductB: \", model.getVal(R1B))\n    print(\"Amount of R1 used for ProductC: \", model.getVal(R1C))\n    print(\"Amount of R2 used for ProductA: \", model.getVal(R2A))\n    print(\"Amount of R2 used for ProductB: \", model.getVal(R2B))\n    print(\"Amount of R2 used for ProductC: \", model.getVal(R2C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1346,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\n// {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes.\nThe fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nThe total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n// So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 50.\n// \u03a3(Trucks_j) <= 50 for all j\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 80 km/h.\n// Speed_i <= 80 for all i\n\n## Generate Constraint-3:\nDue to safety regulations, the minimum speed of any truck must be at least 40 km/h.\n// Speed_i >= 40 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route efficiency of each truck. The variables include the speed of each truck, the number of trucks assigned to each route, and the amount of fuel additive used to enhance fuel efficiency.\nThe fuel consumption of each truck is a nonlinear function of its speed, and the fuel efficiency is enhanced by the use of a fuel additive. The company aims to minimize the total fuel cost across all routes. The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nThe total number of trucks available is limited to 50. The maximum speed limit for any truck is 80 km/h. Due to safety regulations, the minimum speed of any truck must be at least 40 km/h.\nPlease help the company to minimize the total fuel cost across all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of Truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 100\", \"type\": \"continuous\"}\nSpeed_i = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed_i\", lb=0, ub=100)\n## {\"number of trucks on Route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\nTrucks_j = model.addVar(vtype=\"INTEGER\", name=\"Trucks_j\", lb=0)\n## {\"amount of fuel additive for Route j\": \"Additive_j\", \"range\": \"Additive_j >= 0\", \"type\": \"continuous\"}\nAdditive_j = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive_j\", lb=0)\n\n# Define objective function\n## The fuel consumption function for each truck is given by: Fuel_Consumption_i = (Speed_i^2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i.\nFuel_Consumption_i = (Speed_i**2) / (100 - Speed_i) + 0.01 * Additive_j * Speed_i\n## The total fuel cost is the sum of the fuel consumption for all trucks on all routes.\n## So, the objective function is: Minimize \u03a3(Fuel_Consumption_i * Cost_per_Unit_Fuel) for all i and j\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Consumption_i)\n\n# Add constraints\n## The total number of trucks available is limited to 50.\nmodel.addCons(Trucks_j <= 50)\n## The maximum speed limit for any truck is 80 km/h.\nmodel.addCons(Speed_i <= 80)\n## Due to safety regulations, the minimum speed of any truck must be at least 40 km/h.\nmodel.addCons(Speed_i >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of Truck i: \", model.getVal(Speed_i))\n    print(\"Number of Trucks on Route j: \", model.getVal(Trucks_j))\n    print(\"Amount of Fuel Additive for Route j: \", model.getVal(Additive_j))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in advanced technology to enhance the efficiency of each type of installation.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region1\": \"TechInvestmentSolar1\", \"range\": \"TechInvestmentSolar1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region1\": \"TechInvestmentWind1\", \"range\": \"TechInvestmentWind1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region2\": \"TechInvestmentSolar2\", \"range\": \"TechInvestmentSolar2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region2\": \"TechInvestmentWind2\", \"range\": \"TechInvestmentWind2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels in Region3\": \"TechInvestmentSolar3\", \"range\": \"TechInvestmentSolar3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines in Region3\": \"TechInvestmentWind3\", \"range\": \"TechInvestmentWind3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels and wind turbines increases with the investment in advanced technology. For every $1000 invested in technology for solar panels, the energy output increases by 5 MWh. For every $1000 invested in technology for wind turbines, the energy output increases by 8 MWh. The company aims to maximize the total energy output from all regions.\n// EnergyOutputSolar1 = SolarPanels1 * (10 + 0.005 * TechInvestmentSolar1)\n// EnergyOutputWind1 = WindTurbines1 * (15 + 0.008 * TechInvestmentWind1)\n// EnergyOutputSolar2 = SolarPanels2 * (10 + 0.005 * TechInvestmentSolar2)\n// EnergyOutputWind2 = WindTurbines2 * (15 + 0.008 * TechInvestmentWind2)\n// EnergyOutputSolar3 = SolarPanels3 * (10 + 0.005 * TechInvestmentSolar3)\n// EnergyOutputWind3 = WindTurbines3 * (15 + 0.008 * TechInvestmentWind3)\n// So, the objective function is: Maximize (EnergyOutputSolar1 + EnergyOutputWind1 + EnergyOutputSolar2 + EnergyOutputWind2 + EnergyOutputSolar3 + EnergyOutputWind3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for installation and technology investments.\n// 1000 * (SolarPanels1 + WindTurbines1 + SolarPanels2 + WindTurbines2 + SolarPanels3 + WindTurbines3) + TechInvestmentSolar1 + TechInvestmentWind1 + TechInvestmentSolar2 + TechInvestmentWind2 + TechInvestmentSolar3 + TechInvestmentWind3 <= 100000\n\n## Generate Constraint-2:\nThe total number of installations (solar panels and wind turbines) in each region must not exceed 100.\n// SolarPanels1 + WindTurbines1 <= 100\n// SolarPanels2 + WindTurbines2 <= 100\n// SolarPanels3 + WindTurbines3 <= 100\n\n## Generate Constraint-3:\nDue to local regulations, the number of wind turbines in each region must be at least 20% of the total installations in that region.\n// WindTurbines1 >= 0.2 * (SolarPanels1 + WindTurbines1)\n// WindTurbines2 >= 0.2 * (SolarPanels2 + WindTurbines2)\n// WindTurbines3 >= 0.2 * (SolarPanels3 + WindTurbines3)",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in advanced technology to enhance the efficiency of each type of installation. The efficiency of solar panels and wind turbines increases with the investment in advanced technology. For every $1000 invested in technology for solar panels, the energy output increases by 5 MWh. For every $1000 invested in technology for wind turbines, the energy output increases by 8 MWh. The company aims to maximize the total energy output from all regions.\n\nThe company has a total budget of $100,000 for installation and technology investments. The total number of installations (solar panels and wind turbines) in each region must not exceed 100. Due to local regulations, the number of wind turbines in each region must be at least 20% of the total installations in that region.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to install in each region, along with the appropriate investment in advanced technology to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nTechInvestmentSolar1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar1\", lb=0)\nTechInvestmentWind1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind1\", lb=0)\n\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nTechInvestmentSolar2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar2\", lb=0)\nTechInvestmentWind2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind2\", lb=0)\n\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nTechInvestmentSolar3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar3\", lb=0)\nTechInvestmentWind3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind3\", lb=0)\n\n# Define objective function\nEnergyOutputSolar1 = SolarPanels1 * (10 + 0.005 * TechInvestmentSolar1)\nEnergyOutputWind1 = WindTurbines1 * (15 + 0.008 * TechInvestmentWind1)\nEnergyOutputSolar2 = SolarPanels2 * (10 + 0.005 * TechInvestmentSolar2)\nEnergyOutputWind2 = WindTurbines2 * (15 + 0.008 * TechInvestmentWind2)\nEnergyOutputSolar3 = SolarPanels3 * (10 + 0.005 * TechInvestmentSolar3)\nEnergyOutputWind3 = WindTurbines3 * (15 + 0.008 * TechInvestmentWind3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar1 + EnergyOutputWind1 + EnergyOutputSolar2 + EnergyOutputWind2 + EnergyOutputSolar3 + EnergyOutputWind3)\n\n# Add constraints\nmodel.addCons(1000 * (SolarPanels1 + WindTurbines1 + SolarPanels2 + WindTurbines2 + SolarPanels3 + WindTurbines3) + TechInvestmentSolar1 + TechInvestmentWind1 + TechInvestmentSolar2 + TechInvestmentWind2 + TechInvestmentSolar3 + TechInvestmentWind3 <= 100000)\nmodel.addCons(SolarPanels1 + WindTurbines1 <= 100)\nmodel.addCons(SolarPanels2 + WindTurbines2 <= 100)\nmodel.addCons(SolarPanels3 + WindTurbines3 <= 100)\nmodel.addCons(WindTurbines1 >= 0.2 * (SolarPanels1 + WindTurbines1))\nmodel.addCons(WindTurbines2 >= 0.2 * (SolarPanels2 + WindTurbines2))\nmodel.addCons(WindTurbines3 >= 0.2 * (SolarPanels3 + WindTurbines3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Tech Investment for Solar in Region1: \", model.getVal(TechInvestmentSolar1))\n    print(\"Tech Investment for Wind in Region1: \", model.getVal(TechInvestmentWind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Tech Investment for Solar in Region2: \", model.getVal(TechInvestmentSolar2))\n    print(\"Tech Investment for Wind in Region2: \", model.getVal(TechInvestmentWind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Tech Investment for Solar in Region3: \", model.getVal(TechInvestmentSolar3))\n    print(\"Tech Investment for Wind in Region3: \", model.getVal(TechInvestmentWind3))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1253,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide the number of trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type to reduce fuel consumption and operational costs.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for TruckA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for TruckC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel consumption per trip decreases by 0.5 liters for TruckA, 0.7 liters for TruckB, and 0.6 liters for TruckC. The company aims to minimize the total fuel consumption across all vehicles.\n// Fuel consumption per trip for TruckA: ConsumptionA = 10 - 0.0005 * TechA\n// Fuel consumption per trip for TruckB: ConsumptionB = 12 - 0.0007 * TechB\n// Fuel consumption per trip for TruckC: ConsumptionC = 15 - 0.0006 * TechC\n// Total fuel consumption: FuelConsumption = ConsumptionA * TripsA + ConsumptionB * TripsB + ConsumptionC * TripsC\n// So, the objective function is: Minimize FuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs. Each trip of TruckA costs $500, TruckB costs $600, and TruckC costs $700.\n// 500 * TripsA + 600 * TripsB + 700 * TripsC + TechA + TechB + TechC <= 100000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2000.\n// TripsA + TripsB + TripsC <= 2000\n\n## Generate Constraint-3:\nDue to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n// TripsA >= 200; TripsB >= 300",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide the number of trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient technologies for each vehicle type to reduce fuel consumption and operational costs. The fuel efficiency of each vehicle type improves with the investment in fuel-efficient technology. For every $1000 invested in technology, the fuel consumption per trip decreases by 0.5 liters for TruckA, 0.7 liters for TruckB, and 0.6 liters for TruckC. The company aims to minimize the total fuel consumption across all vehicles. The company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs. Each trip of TruckA costs $500, TruckB costs $600, and TruckC costs $700. The total number of trips across all vehicles must not exceed 2000. Due to maintenance schedules, the number of trips for TruckA must be at least 200, and for TruckB, it must be at least 300.\n\nPlease help the company to determine the optimal number of trips for each vehicle and the appropriate investment in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=200)  # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=300)  # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0)     # number of trips for TruckC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)   # investment in fuel-efficient technology for TruckA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)   # investment in fuel-efficient technology for TruckB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)   # investment in fuel-efficient technology for TruckC\n\n# Define objective function\nConsumptionA = 10 - 0.0005 * TechA  # Fuel consumption per trip for TruckA\nConsumptionB = 12 - 0.0007 * TechB  # Fuel consumption per trip for TruckB\nConsumptionC = 15 - 0.0006 * TechC  # Fuel consumption per trip for TruckC\nFuelConsumption = ConsumptionA * TripsA + ConsumptionB * TripsB + ConsumptionC * TripsC\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelConsumption)\n\n# Add constraints\n# The company has a budget of $100,000 for investments in fuel-efficient technologies and operational costs.\nmodel.addCons(500 * TripsA + 600 * TripsB + 700 * TripsC + TechA + TechB + TechC <= 100000)\n# The total number of trips across all vehicles must not exceed 2000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Tech for TruckA: \", model.getVal(TechA))\n    print(\"Investment in Tech for TruckB: \", model.getVal(TechB))\n    print(\"Investment in Tech for TruckC: \", model.getVal(TechC))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1247,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductA\": \"WorkforceA\", \"range\": \"WorkforceA >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductB\": \"WorkforceB\", \"range\": \"WorkforceB >= 0\", \"type\": \"integer\"}\n// {\"workforce size for ProductC\": \"WorkforceC\", \"range\": \"WorkforceC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\n// Total profit for ProductC: ProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total workforce available across all products cannot exceed 100 employees.\n// WorkforceA + WorkforceB + WorkforceC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product, the workforce size dedicated to each product, and the investment in automation technology to reduce labor costs. The cost reduction from automation is nonlinear and depends on the investment level. The labor cost per unit decreases by 0.5% for every $1,000 invested in automation. The initial labor cost per unit for ProductA is $50, for ProductB is $60, and for ProductC is $70. The selling price per unit is $100 for ProductA, $120 for ProductB, and $140 for ProductC. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price per Unit | Initial Labor Cost per Unit |\n|---------|------------------------|-----------------------------|\n| ProductA | $100                   | $50                         |\n| ProductB | $120                   | $60                         |\n| ProductC | $140                   | $70                         |\n\nThe total workforce available across all products cannot exceed 100 employees. Please help the company determine the optimal production quantities, workforce sizes, and investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkforceA = model.addVar(vtype=\"INTEGER\", name=\"WorkforceA\", lb=0)  # workforce size for ProductA\nWorkforceB = model.addVar(vtype=\"INTEGER\", name=\"WorkforceB\", lb=0)  # workforce size for ProductB\nWorkforceC = model.addVar(vtype=\"INTEGER\", name=\"WorkforceC\", lb=0)  # workforce size for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation\n\n# Define objective function\nProfitA = (100 - 50 + 0.0005 * Automation) * QuantityA\nProfitB = (120 - 60 + 0.0005 * Automation) * QuantityB\nProfitC = (140 - 70 + 0.0005 * Automation) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(WorkforceA + WorkforceB + WorkforceC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Workforce Size for ProductA: \", model.getVal(WorkforceA))\n    print(\"Workforce Size for ProductB: \", model.getVal(WorkforceB))\n    print(\"Workforce Size for ProductC: \", model.getVal(WorkforceC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each device, which affects the sales rate.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation for DeviceA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"level of automation for DeviceC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for DeviceC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\n// Total profit for DeviceB: ProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\n// Total profit for DeviceC: ProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// UnitsA + UnitsB + UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationA + AutomationB + AutomationC <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the number of units to produce for each device and the level of automation to implement in the production process. The level of automation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each device, which affects the sales rate. The production cost per unit decreases by $5 for every unit increase in automation level. The initial production cost per unit for DeviceA is $100, for DeviceB is $120, and for DeviceC is $150. The sales rate increases by 1% for every $1000 spent on marketing. The selling price per unit is $200 for DeviceA, $220 for DeviceB, and $250 for DeviceC. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units across all devices. The total investment in automation cannot exceed $50,000. Please help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of DeviceC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # level of automation for DeviceA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # level of automation for DeviceB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # level of automation for DeviceC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for DeviceA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for DeviceB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for DeviceC\n\n# Define objective function\nProfitA = (200 - (100 - 5 * AutomationA)) * UnitsA - MarketingA\nProfitB = (220 - (120 - 5 * AutomationB)) * UnitsB - MarketingB\nProfitC = (250 - (150 - 5 * AutomationC)) * UnitsC - MarketingC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 10000)\n# The total investment in automation cannot exceed $50,000.\nmodel.addCons(AutomationA + AutomationB + AutomationC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Level of Automation for DeviceA: \", model.getVal(AutomationA))\n    print(\"Level of Automation for DeviceB: \", model.getVal(AutomationB))\n    print(\"Level of Automation for DeviceC: \", model.getVal(AutomationC))\n    print(\"Marketing Budget for DeviceA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for DeviceB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for DeviceC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces 3 types of electronic devices. The company needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit.\n// {\"labor on production line 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"integer\"}\n// {\"labor on production line 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"machinery on production line 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each production line depends on the labor and machinery allocated. The profit function is nonlinear and is given by:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\nThe company aims to maximize the total profit from all production lines.\n// Objective function: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total labor available is 100 units.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe total machinery available is 80 units.\n// M1 + M2 + M3 <= 80",
        "question": "A manufacturing company produces 3 types of electronic devices and needs to optimize the allocation of resources (labor and machinery) across different production lines to maximize profit. The profit from each production line depends on the labor and machinery allocated. The profit function is nonlinear and is given by:\n- Production line 1: P1 = 100 * L1^0.5 * M1^0.5\n- Production line 2: P2 = 150 * L2^0.6 * M2^0.4\n- Production line 3: P3 = 200 * L3^0.7 * M3^0.3\nThe company aims to maximize the total profit from all production lines. The total labor available is 100 units, and the total machinery available is 80 units.\nPlease help the company determine the optimal allocation of labor (L1, L2, L3) and machinery (M1, M2, M3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0) # labor on production line 1\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=0) # labor on production line 2\nL3 = model.addVar(vtype=\"INTEGER\", name=\"L3\", lb=0) # labor on production line 3\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # machinery on production line 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # machinery on production line 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # machinery on production line 3\n\n# Define objective function\n## The profit function is nonlinear, so we need to approximate it using piecewise linear functions\nP1 = model.addVar(name=\"P1\")\nP2 = model.addVar(name=\"P2\")\nP3 = model.addVar(name=\"P3\")\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## the objective function is: Maximize P = P1 + P2 + P3\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total labor available is 100 units.\nmodel.addCons(L1 + L2 + L3 <= 100)\n## The total machinery available is 80 units.\nmodel.addCons(M1 + M2 + M3 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor on Production Line 1: \", model.getVal(L1))\n    print(\"Labor on Production Line 2: \", model.getVal(L2))\n    print(\"Labor on Production Line 3: \", model.getVal(L3))\n    print(\"Machinery on Production Line 1: \", model.getVal(M1))\n    print(\"Machinery on Production Line 2: \", model.getVal(M2))\n    print(\"Machinery on Production Line 3: \", model.getVal(M3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials for product A\": \"CostRA\", \"range\": \"CostRA >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product B\": \"CostRB\", \"range\": \"CostRB >= 0\", \"type\": \"real\"}\n// {\"cost of raw materials for product C\": \"CostRC\", \"range\": \"CostRC >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product A\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product B\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"real\"}\n// {\"cost of labor for product C\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe revenue for product A is $50 per unit, for product B is $70 per unit, and for product C is $60 per unit. The cost of raw materials for product A is $10 per unit, for product B is $15 per unit, and for product C is $20 per unit. The cost of labor for product A is $5 per unit, for product B is $10 per unit, and for product C is $15 per unit. The company wants to maximize the total profit.\n// Profit_A = 50 * ProductA - (CostRA * ProductA + LaborA * ProductA)\n// Profit_B = 70 * ProductB - (CostRB * ProductB + LaborB * ProductB)\n// Profit_C = 60 * ProductC - (CostRC * ProductC + LaborC * ProductC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// CostRA * ProductA + CostRB * ProductB + CostRC * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor costs.\n// LaborA * ProductA + LaborB * ProductB + LaborC * ProductC <= 5000\n\n## Generate Constraint-3:\nThe total storage space for all products is limited to 200 cubic meters. Product A requires 1 cubic meter per unit, product B requires 2 cubic meters per unit, and product C requires 3 cubic meters per unit.\n// ProductA + 2 * ProductB + 3 * ProductC <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. The revenue, cost of raw materials, and cost of labor for each product are given in the following Table.\n\n| Product | Revenue per Unit | Cost of Raw Materials per Unit | Cost of Labor per Unit | Storage Space Required per Unit |\n|---------|------------------|--------------------------------|------------------------|---------------------------------|\n| A       | $50              | $10                            | $5                     | 1 cubic meter                   |\n| B       | $70              | $15                            | $10                    | 2 cubic meters                  |\n| C       | $60              | $20                            | $15                    | 3 cubic meters                  |\n\nThe company has a budget of $10,000 for raw materials and $5,000 for labor costs. The total storage space for all products is limited to 200 cubic meters. Product A requires 1 cubic meter per unit, product B requires 2 cubic meters per unit, and product C requires 3 cubic meters per unit. \n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\n\n# Define objective function\nProfit_A = 50 * ProductA - (10 * ProductA + 5 * ProductA)\nProfit_B = 70 * ProductB - (15 * ProductB + 10 * ProductB)\nProfit_C = 60 * ProductC - (20 * ProductC + 15 * ProductC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000) # Budget for raw materials\nmodel.addCons(5 * ProductA + 10 * ProductB + 15 * ProductC <= 5000) # Budget for labor costs\nmodel.addCons(ProductA + 2 * ProductB + 3 * ProductC <= 200) # Storage space constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for delivering goods across different regions. They need to determine the number of trucks to allocate to each region (Region A, Region B, Region C, Region D, and Region E) and the fuel efficiency upgrades for each truck type.\n// {\"number of trucks for Region A\": \"Trucks_A\", \"range\": \"Trucks_A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region B\": \"Trucks_B\", \"range\": \"Trucks_B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region C\": \"Trucks_C\", \"range\": \"Trucks_C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region D\": \"Trucks_D\", \"range\": \"Trucks_D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region E\": \"Trucks_E\", \"range\": \"Trucks_E >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for each truck\": \"FuelUpgrade\", \"range\": \"FuelUpgrade >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost.\n// Fuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\n// Fuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\n// Fuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\n// Fuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\n// Fuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n// So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available.\n// Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100",
        "question": "A logistics company is planning to optimize its fleet of trucks for delivering goods across different regions: Region A, Region B, Region C, Region D, and Region E. They need to determine the number of trucks to allocate to each region and the fuel efficiency upgrades for each truck type. The cost of fuel per kilometer for a standard truck is $0.5, and the cost of fuel per kilometer for a truck with the upgrade is $0.3. The average distance traveled by a truck in each region is 500 km per day. The company wants to minimize the total daily fuel cost.\n\n| Region | Number of Trucks | Fuel Efficiency Upgrade |\n|--------|------------------|-------------------------|\n| A      | Trucks_A         | FuelUpgrade             |\n| B      | Trucks_B         | FuelUpgrade             |\n| C      | Trucks_C         | FuelUpgrade             |\n| D      | Trucks_D         | FuelUpgrade             |\n| E      | Trucks_E         | FuelUpgrade             |\n\nThe company has a total of 100 trucks available. Please help the company to determine the optimal allocation of trucks and the fuel efficiency upgrades to minimize the total daily fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks_A = model.addVar(vtype=\"INTEGER\", name=\"Trucks_A\", lb=0) # number of trucks for Region A\nTrucks_B = model.addVar(vtype=\"INTEGER\", name=\"Trucks_B\", lb=0) # number of trucks for Region B\nTrucks_C = model.addVar(vtype=\"INTEGER\", name=\"Trucks_C\", lb=0) # number of trucks for Region C\nTrucks_D = model.addVar(vtype=\"INTEGER\", name=\"Trucks_D\", lb=0) # number of trucks for Region D\nTrucks_E = model.addVar(vtype=\"INTEGER\", name=\"Trucks_E\", lb=0) # number of trucks for Region E\nFuelUpgrade = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgrade\", lb=0) # fuel efficiency upgrade for each truck\n\n# Define objective function\nFuel_Cost_A = 500 * Trucks_A * (0.5 - FuelUpgrade)\nFuel_Cost_B = 500 * Trucks_B * (0.5 - FuelUpgrade)\nFuel_Cost_C = 500 * Trucks_C * (0.5 - FuelUpgrade)\nFuel_Cost_D = 500 * Trucks_D * (0.5 - FuelUpgrade)\nFuel_Cost_E = 500 * Trucks_E * (0.5 - FuelUpgrade)\n# So, the objective function is: Minimize (Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost_A + Fuel_Cost_B + Fuel_Cost_C + Fuel_Cost_D + Fuel_Cost_E)\n\n# Add constraints\n# The company has a total of 100 trucks available.\nmodel.addCons(Trucks_A + Trucks_B + Trucks_C + Trucks_D + Trucks_E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region A: \", model.getVal(Trucks_A))\n    print(\"Number of Trucks for Region B: \", model.getVal(Trucks_B))\n    print(\"Number of Trucks for Region C: \", model.getVal(Trucks_C))\n    print(\"Number of Trucks for Region D: \", model.getVal(Trucks_D))\n    print(\"Number of Trucks for Region E: \", model.getVal(Trucks_E))\n    print(\"Fuel Efficiency Upgrade: \", model.getVal(FuelUpgrade))\n    print(\"Minimized Daily Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck maintenance\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van maintenance\": \"MaintenanceVan\", \"range\": \"MaintenanceVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike maintenance\": \"MaintenanceBike\", \"range\": \"MaintenanceBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year.\n// Total operational cost for Trucks: CostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)^2\n// Total operational cost for Vans: CostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)^2\n// Total operational cost for Bikes: CostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)^2\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and maintenance.\n// Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 Trucks and 100 Vans to meet contractual obligations.\n// Trucks >= 50; Vans >= 100\n\n## Generate Constraint-3:\nThe total number of vehicles cannot exceed 500 due to storage limitations.\n// Trucks + Vans + Bikes <= 500\n\n## Generate Constraint-4:\nThe investment in Bike maintenance must not exceed the total investment in Truck and Van maintenance combined.\n// MaintenanceBike <= MaintenanceTruck + MaintenanceVan",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs. The operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year. The company has a budget of $1,000,000 for vehicle purchases and maintenance. The company must purchase at least 50 Trucks and 100 Vans to meet contractual obligations. The total number of vehicles cannot exceed 500 due to storage limitations. The investment in Bike maintenance must not exceed the total investment in Truck and Van maintenance combined. Please help the company to minimize the total operational cost over the next year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nMaintenanceTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceTruck\", lb=0)  # investment in Truck maintenance\nMaintenanceVan = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceVan\", lb=0)  # investment in Van maintenance\nMaintenanceBike = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceBike\", lb=0)  # investment in Bike maintenance\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)**2\nCostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)**2\nCostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)**2\n## the objective function is: Minimize (CostTruck + CostVan + CostBike)\nmodel.addCons(obj == CostTruck + CostVan + CostBike)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases and maintenance.\nmodel.addCons(Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000)\n## The total number of vehicles cannot exceed 500 due to storage limitations.\nmodel.addCons(Trucks + Vans + Bikes <= 500)\n## The investment in Bike maintenance must not exceed the total investment in Truck and Van maintenance combined.\nmodel.addCons(MaintenanceBike <= MaintenanceTruck + MaintenanceVan)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Truck maintenance: \", model.getVal(MaintenanceTruck))\n    print(\"Investment in Van maintenance: \", model.getVal(MaintenanceVan))\n    print(\"Investment in Bike maintenance: \", model.getVal(MaintenanceBike))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nPlease help the company determine the optimal production quantities for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good. Additionally, the company needs to decide on the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit.\n// {\"number of units of GoodsA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of GoodsC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for GoodsA\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsB\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for GoodsC\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe transportation cost per unit decreases with the investment in fuel efficiency for each type of good.\nThe initial cost per unit of GoodsA is $30, but with fuel efficiency upgrades, the cost decreases by $1 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsB is $40, and with fuel efficiency upgrades, the cost decreases by $1.5 per unit for every $100 invested in efficiency. \nThe initial cost per unit of GoodsC is $50, and with fuel efficiency upgrades, the cost decreases by $2 per unit for every $100 invested in efficiency. \nThe company aims to minimize the total transportation cost from all goods.\n// Total cost for GoodsA: CostA = (30 - 0.01 * EfficiencyA) * UnitsA\n// Total cost for GoodsB: CostB = (40 - 0.015 * EfficiencyB) * UnitsB\n// Total cost for GoodsC: CostC = (50 - 0.02 * EfficiencyC) * UnitsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades.\n// 30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000\n\n## Generate Constraint-2:\nThe total capacity of the fleet for the next month is limited to 500 units.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-3:\nDue to contractual agreements, the company must transport at least 50 units of GoodsA and 100 units of GoodsB.\n// UnitsA >= 50; UnitsB >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that the total investment in fuel efficiency for GoodsC does not exceed the combined investment for GoodsA and GoodsB.\n// EfficiencyC <= EfficiencyA + EfficiencyB",
        "question": "A logistics company manages the distribution of three types of goods: GoodsA, GoodsB, and GoodsC. The company needs to determine the number of units to transport for each type of good and the level of fuel efficiency upgrades for their fleet, which affects the transportation cost per unit. The initial cost per unit and the effect of fuel efficiency upgrades on the cost for each type of good are given in the following Table.\n\n| Good       | Initial Cost per Unit | Reduction in Cost per Unit per $100 Invested in Efficiency |\n|------------|----------------------|--------------------------------------------------------------|\n| GoodsA     | $30                  | $1                                                           |\n| GoodsB     | $40                  | $1.5                                                         |\n| GoodsC     | $50                  | $2                                                           |\n\nThe company has a total budget of $20,000 for transportation and fuel efficiency upgrades. The total capacity of the fleet for the next month is limited to 500 units. Due to contractual agreements, the company must transport at least 50 units of GoodsA and 100 units of GoodsB. The company wants to ensure that the total investment in fuel efficiency for GoodsC does not exceed the combined investment for GoodsA and GoodsB.\n\nPlease help the company to minimize the total transportation cost from all goods.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of GoodsA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of GoodsB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of GoodsC\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in fuel efficiency for GoodsA\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for GoodsB\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in fuel efficiency for GoodsC\n\n# Define objective function\nCostA = (30 - 0.01 * EfficiencyA) * UnitsA\nCostB = (40 - 0.015 * EfficiencyB) * UnitsB\nCostC = (50 - 0.02 * EfficiencyC) * UnitsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $20,000 for transportation and fuel efficiency upgrades.\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 50 * UnitsC + EfficiencyA + EfficiencyB + EfficiencyC <= 20000)\n# The total capacity of the fleet for the next month is limited to 500 units.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n# Due to contractual agreements, the company must transport at least 50 units of GoodsA and 100 units of GoodsB.\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 100)\n# The company wants to ensure that the total investment in fuel efficiency for GoodsC does not exceed the combined investment for GoodsA and GoodsB.\nmodel.addCons(EfficiencyC <= EfficiencyA + EfficiencyB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of GoodsA: \", model.getVal(UnitsA))\n    print(\"Number of Units of GoodsB: \", model.getVal(UnitsB))\n    print(\"Number of Units of GoodsC: \", model.getVal(UnitsC))\n    print(\"Investment in Fuel Efficiency for GoodsA: \", model.getVal(EfficiencyA))\n    print(\"Investment in Fuel Efficiency for GoodsB: \", model.getVal(EfficiencyB))\n    print(\"Investment in Fuel Efficiency for GoodsC: \", model.getVal(EfficiencyC))\n    print(\"Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1441,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductA\": \"TechA\", \"range\": \"TechA >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductB\": \"TechB\", \"range\": \"TechB >= 0\", \"type\": \"continuous\"}\n// {\"investment in technology for ProductC\": \"TechC\", \"range\": \"TechC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $100 - 0.01 * TechA, for ProductB is $150 - 0.01 * TechB, and for ProductC is $200 - 0.01 * TechC. The revenue per unit of ProductA is $120, for ProductB is $180, and for ProductC is $240. The company aims to maximize the total profit from all products.\n// ProfitA = (120 - (100 - 0.01 * TechA)) * QA\n// ProfitB = (180 - (150 - 0.01 * TechB)) * QB\n// ProfitC = (240 - (200 - 0.01 * TechC)) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe total investment in technology cannot exceed $50,000.\n// TechA + TechB + TechC <= 50000\n\n## Generate Constraint-3:\nThe production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units.\n// QA <= 50; QC <= 30\n\n## Generate Constraint-4:\nThe company must allocate at least 20% of the total resources to ProductB.\n// RB >= 0.2 * (RA + RB + RC)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. The efficiency of resource use can be improved by investing in new technology, which affects the cost and production rate of each product. The production cost per unit, revenue per unit, and the impact of technology investment on production cost for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Revenue per Unit | Impact of Tech Investment on Cost |\n|---------|--------------------------|------------------|----------------------------------|\n| ProductA | $100 - 0.01 * TechA | $120 | 0.01 * TechA |\n| ProductB | $150 - 0.01 * TechB | $180 | 0.01 * TechB |\n| ProductC | $200 - 0.01 * TechC | $240 | 0.01 * TechC |\n\nThe total resources available for production are limited to 1000 units. The total investment in technology cannot exceed $50,000. The production of ProductA must not exceed 50 units, and ProductC must not exceed 30 units. The company must allocate at least 20% of the total resources to ProductB.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=50)  # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0)  # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0, ub=30)  # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0)  # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0)  # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0)  # resources allocated to ProductC\nTechA = model.addVar(vtype=\"CONTINUOUS\", name=\"TechA\", lb=0)  # investment in technology for ProductA\nTechB = model.addVar(vtype=\"CONTINUOUS\", name=\"TechB\", lb=0)  # investment in technology for ProductB\nTechC = model.addVar(vtype=\"CONTINUOUS\", name=\"TechC\", lb=0)  # investment in technology for ProductC\n\n# Define objective function\nProfitA = (120 - (100 - 0.01 * TechA)) * QA\nProfitB = (180 - (150 - 0.01 * TechB)) * QB\nProfitC = (240 - (200 - 0.01 * TechC)) * QC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(RA + RB + RC <= 1000)\nmodel.addCons(TechA + TechB + TechC <= 50000)\nmodel.addCons(QA <= 50)\nmodel.addCons(QC <= 30)\nmodel.addCons(RB >= 0.2 * (RA + RB + RC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Technology for ProductA: \", model.getVal(TechA))\n    print(\"Investment in Technology for ProductB: \", model.getVal(TechB))\n    print(\"Investment in Technology for ProductC: \", model.getVal(TechC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 1 kg of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 kg of raw material. Product C yields a profit of $100 per unit, requiring 4 hours of labor and 3 kg of raw material. The company aims to maximize the total profit while considering the efficiency of resource usage (labor and raw material).\n// Profit_A = 50 * A\n// Profit_B = 70 * B\n// Profit_C = 100 * C\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// A + 2 * B + 3 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit. The profit per unit of product A is $50, which requires 2 hours of labor and 1 kg of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 kg of raw material. Product C yields a profit of $100 per unit, requiring 4 hours of labor and 3 kg of raw material. The company aims to maximize the total profit while considering the efficiency of resource usage (labor and raw material). The company has a budget of $5000 for raw materials. Please help the company to maximize the total profit while considering the efficiency of resource usage (labor and raw material).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (A, B, and C) using different resources. The company needs to determine the optimal production quantities for each product to maximize profit while considering resource constraints and market demand.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products.\n// TotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total available labor hours per week are 1000. Producing one unit of product A requires 5 hours, product B requires 8 hours, and product C requires 6 hours.\n// 5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe total available raw material per week is 1500 kg. Producing one unit of product A requires 10 kg, product B requires 15 kg, and product C requires 12 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500",
        "question": "A manufacturing company produces three types of products (A, B, and C) using different resources. The profit per unit for product A is $50, for product B is $70, and for product C is $60. The company aims to maximize the total profit from all products. The total available labor hours per week are 1000, with producing one unit of product A requiring 5 hours, product B requiring 8 hours, and product C requiring 6 hours. The total available raw material per week is 1500 kg, with producing one unit of product A requiring 10 kg, product B requiring 15 kg, and product C requiring 12 kg. Please help the company determine the optimal production quantities for each product to maximize profit while considering these resource constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\nTotalProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n# The total available labor hours per week are 1000.\nmodel.addCons(5 * ProductA + 8 * ProductB + 6 * ProductC <= 1000)\n# The total available raw material per week is 1500 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. The company aims to maximize the total profit per unit of fuel consumed.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\n// So, the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per week.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trips are made by each type of truck per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 500 hours available for all trucks to operate per week.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of trips made by Truck E does not exceed the combined trips of Trucks A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. For Truck A, the profit per trip is $500, and the fuel consumption is 10 liters. For Truck B, the profit per trip is $700, and the fuel consumption is 15 liters. For Truck C, the profit per trip is $900, and the fuel consumption is 20 liters. For Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters. For Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\nThe company has a budget of $10,000 for fuel costs per week. The company wants to ensure that at least 5 trips are made by each type of truck per week. The company has a total of 500 hours available for all trucks to operate per week. The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C. The company also wants to ensure that the total number of trips made by Truck E does not exceed the combined trips of Trucks A, B, C, and D.\nPlease help the company to maximize the total profit per unit of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trips are made by each type of truck per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\nFuelConsumption = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n## the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n## The company has a total of 500 hours available for all trucks to operate per week.\nmodel.addCons(A + B + C + D + E <= 500)\n## The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total number of trips made by Truck E does not exceed the combined trips of Trucks A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\n// LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks)\n\n## Generate Constraint-4:\nThe fuel efficiency of each type of truck must be at least 5 km/liter.\n// ShortFuelEfficiency >= 5\n// MediumFuelEfficiency >= 5\n// LongFuelEfficiency >= 5",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type, and the maintenance cost is a fixed percentage of the fuel cost.\n\n| Truck Type             | Fuel Efficiency (km/liter) |\n|------------------------|----------------------------|\n| Short-distance trucks  | ShortFuelEfficiency        |\n| Medium-distance trucks | MediumFuelEfficiency       |\n| Long-distance trucks   | LongFuelEfficiency         |\n\nThe company has a budget of $100,000 for purchasing new trucks. The total number of trucks cannot exceed 100. The company must ensure that at least 20% of the fleet is dedicated to long-distance routes. The fuel efficiency of each type of truck must be at least 5 km/liter.\n\nPlease help the company determine the optimal number of short-distance trucks (ShortDistanceTrucks), medium-distance trucks (MediumDistanceTrucks), and long-distance trucks (LongDistanceTrucks) to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nShortDistance = model.addVar(name=\"ShortDistance\")\nMediumDistance = model.addVar(name=\"MediumDistance\")\nLongDistance = model.addVar(name=\"LongDistance\")\nShortFuelEfficiency = model.addVar(name=\"ShortFuelEfficiency\", lb=5)\nMediumFuelEfficiency = model.addVar(name=\"MediumFuelEfficiency\", lb=5)\nLongFuelEfficiency = model.addVar(name=\"LongFuelEfficiency\", lb=5)\n\n## TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n## TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n## So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n## convert the division to multiplication\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks * ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks * MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks * LongFuelEfficiency)\nTotalMaintenanceCost = 0.1 * TotalFuelCost\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nShortTruckCost = model.addVar(name=\"ShortTruckCost\")\nMediumTruckCost = model.addVar(name=\"MediumTruckCost\")\nLongTruckCost = model.addVar(name=\"LongTruckCost\")\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n\n## The total number of trucks cannot exceed 100.\nmodel.addCons(ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks <= 100)\n\n## The company must ensure that at least 20% of the fleet is dedicated to long-distance routes.\nmodel.addCons(LongDistanceTrucks >= 0.2 * (ShortDistanceTrucks + MediumDistanceTrucks + LongDistanceTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter and needs to decide on the number of trucks to allocate for five different routes: Urban, Suburban, Rural, Express, and International. Each route has different operational costs and revenue potentials.\n// {\"number of trucks for Urban route\": \"Urban\", \"range\": \"Urban >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Suburban route\": \"Suburban\", \"range\": \"Suburban >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Rural route\": \"Rural\", \"range\": \"Rural >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Express route\": \"Express\", \"range\": \"Express >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for International route\": \"International\", \"range\": \"International >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per truck for Urban is $2000 per month, Suburban is $2500 per month, Rural is $3000 per month, Express is $3500 per month, and International is $4000 per month. The revenue per truck for Urban is $5000 per month, Suburban is $6000 per month, Rural is $7000 per month, Express is $8000 per month, and International is $9000 per month. The company wants to maximize the net profit, which is the total revenue minus the total operational cost.\n// Total Revenue = 5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International\n// Total Cost = 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International\n// So, the objective function is: Maximize (Total Revenue - Total Cost)\n\n## Generate Constraint-1:\nThe company has a total budget of $150,000 per month for operational costs.\n// 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International <= 150000\n\n## Generate Constraint-2:\nThe company has a limit on the total number of trucks it can deploy, which is 50 trucks.\n// Urban + Suburban + Rural + Express + International <= 50\n\n## Generate Constraint-3:\nThe company must allocate at least 10 trucks to the International route to maintain its international service level.\n// International >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 40% of the total fleet is allocated to any single route.\n// Urban <= 0.4 * 50\n// Suburban <= 0.4 * 50\n// Rural <= 0.4 * 50\n// Express <= 0.4 * 50\n// International <= 0.4 * 50\n\n## Generate Constraint-5:\nThe company has a minimum revenue requirement of $200,000 per month from all routes combined.\n// 5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International >= 200000",
        "question": "A logistics company is planning its fleet for the next quarter and needs to decide on the number of trucks to allocate for five different routes: Urban, Suburban, Rural, Express, and International. Each route has different operational costs and revenue potentials. The operational cost and revenue per truck for each route are given in the following Table.\n\n| Route            | Operational Cost per Truck per Month | Revenue per Truck per Month |\n|------------------|-------------------------------------|-----------------------------|\n| Urban            | $2000                               | $5000                       |\n| Suburban         | $2500                               | $6000                       |\n| Rural            | $3000                               | $7000                       |\n| Express          | $3500                               | $8000                       |\n| International    | $4000                               | $9000                       |\n\nThe company has a total budget of $150,000 per month for operational costs. The company has a limit on the total number of trucks it can deploy, which is 50 trucks. The company must allocate at least 10 trucks to the International route to maintain its international service level. The company wants to ensure that no more than 40% of the total fleet is allocated to any single route. The company has a minimum revenue requirement of $200,000 per month from all routes combined.\n\nPlease help the company to maximize the net profit, which is the total revenue minus the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrban = model.addVar(vtype=\"INTEGER\", name=\"Urban\", lb=0) # number of trucks for Urban route\nSuburban = model.addVar(vtype=\"INTEGER\", name=\"Suburban\", lb=0) # number of trucks for Suburban route\nRural = model.addVar(vtype=\"INTEGER\", name=\"Rural\", lb=0) # number of trucks for Rural route\nExpress = model.addVar(vtype=\"INTEGER\", name=\"Express\", lb=0) # number of trucks for Express route\nInternational = model.addVar(vtype=\"INTEGER\", name=\"International\", lb=0) # number of trucks for International route\n\n# Define objective function\nTotalRevenue = 5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International\nTotalCost = 2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International\n# So, the objective function is: Maximize (Total Revenue - Total Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\n# The company has a total budget of $150,000 per month for operational costs.\nmodel.addCons(2000 * Urban + 2500 * Suburban + 3000 * Rural + 3500 * Express + 4000 * International <= 150000)\n# The company has a limit on the total number of trucks it can deploy, which is 50 trucks.\nmodel.addCons(Urban + Suburban + Rural + Express + International <= 50)\n# The company must allocate at least 10 trucks to the International route to maintain its international service level.\nmodel.addCons(International >= 10)\n# The company wants to ensure that no more than 40% of the total fleet is allocated to any single route.\nmodel.addCons(Urban <= 0.4 * 50)\nmodel.addCons(Suburban <= 0.4 * 50)\nmodel.addCons(Rural <= 0.4 * 50)\nmodel.addCons(Express <= 0.4 * 50)\nmodel.addCons(International <= 0.4 * 50)\n# The company has a minimum revenue requirement of $200,000 per month from all routes combined.\nmodel.addCons(5000 * Urban + 6000 * Suburban + 7000 * Rural + 8000 * Express + 9000 * International >= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks for Urban route: \", model.getVal(Urban))\n    print(\"Number of trucks for Suburban route: \", model.getVal(Suburban))\n    print(\"Number of trucks for Rural route: \", model.getVal(Rural))\n    print(\"Number of trucks for Express route: \", model.getVal(Express))\n    print(\"Number of trucks for International route: \", model.getVal(International))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1575,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\n// {\"number of trucks for Route A\": \"RouteA\", \"range\": \"RouteA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route B\": \"RouteB\", \"range\": \"RouteB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route C\": \"RouteC\", \"range\": \"RouteC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route D\": \"RouteD\", \"range\": \"RouteD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route E\": \"RouteE\", \"range\": \"RouteE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company wants to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).\n// NetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\n// NetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\n// NetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\n// NetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\n// NetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\n// TotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// RouteA + RouteB + RouteC + RouteD + RouteE <= 50",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five routes (Route A, Route B, Route C, Route D, and Route E) and need to decide how many trucks to allocate to each route.\nFor Route A, the profit per truck is $10,000, the fuel cost per truck is $2,000, and the maintenance cost per truck is $1,500.\nFor Route B, the profit per truck is $12,000, the fuel cost per truck is $2,500, and the maintenance cost per truck is $1,800.\nFor Route C, the profit per truck is $15,000, the fuel cost per truck is $3,000, and the maintenance cost per truck is $2,000.\nFor Route D, the profit per truck is $18,000, the fuel cost per truck is $3,500, and the maintenance cost per truck is $2,500.\nFor Route E, the profit per truck is $20,000, the fuel cost per truck is $4,000, and the maintenance cost per truck is $3,000.\nThe company has a total of 50 trucks available for allocation.\nPlease help the company to maximize the net profit per unit of cost (net profit divided by the sum of fuel and maintenance costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRouteA = model.addVar(vtype=\"INTEGER\", name=\"RouteA\", lb=0) # number of trucks for Route A\nRouteB = model.addVar(vtype=\"INTEGER\", name=\"RouteB\", lb=0) # number of trucks for Route B\nRouteC = model.addVar(vtype=\"INTEGER\", name=\"RouteC\", lb=0) # number of trucks for Route C\nRouteD = model.addVar(vtype=\"INTEGER\", name=\"RouteD\", lb=0) # number of trucks for Route D\nRouteE = model.addVar(vtype=\"INTEGER\", name=\"RouteE\", lb=0) # number of trucks for Route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = 10000 * RouteA - 2000 * RouteA - 1500 * RouteA\nNetProfit_B = 12000 * RouteB - 2500 * RouteB - 1800 * RouteB\nNetProfit_C = 15000 * RouteC - 3000 * RouteC - 2000 * RouteC\nNetProfit_D = 18000 * RouteD - 3500 * RouteD - 2500 * RouteD\nNetProfit_E = 20000 * RouteE - 4000 * RouteE - 3000 * RouteE\nTotalCost = (2000 * RouteA + 1500 * RouteA) + (2500 * RouteB + 1800 * RouteB) + (3000 * RouteC + 2000 * RouteC) + (3500 * RouteD + 2500 * RouteD) + (4000 * RouteE + 3000 * RouteE)\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E) / TotalCost\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(RouteA + RouteB + RouteC + RouteD + RouteE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(RouteA))\n    print(\"Number of Trucks for Route B: \", model.getVal(RouteB))\n    print(\"Number of Trucks for Route C: \", model.getVal(RouteC))\n    print(\"Number of Trucks for Route D: \", model.getVal(RouteD))\n    print(\"Number of Trucks for Route E: \", model.getVal(RouteE))\n    print(\"Maximized Net Profit per Unit of Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation.\n// {\"number of trucks for cargo A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks for cargo A\": \"SpeedA\", \"range\": \"SpeedA > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo B\": \"SpeedB\", \"range\": \"SpeedB > 0\", \"type\": \"real\"}\n// {\"speed of trucks for cargo C\": \"SpeedC\", \"range\": \"SpeedC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels.\n// FuelCostA = TrucksA * SpeedA * 2\n// FuelCostB = TrucksB * SpeedB * 3\n// FuelCostC = TrucksC * SpeedC * 4\n// So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $1000 for fuel costs per day.\n// 2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000\n\n## Generate Constraint-2:\nThe company has a maximum of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-3:\nThe average speed of trucks cannot exceed 100 km/h.\n// SpeedA + SpeedB + SpeedC <= 100\n\n## Generate Constraint-4:\nThe total distance covered by all trucks should not exceed 5000 km per day.\n// TrucksA * SpeedA + TrucksB * SpeedB + TrucksC * SpeedC <= 5000",
        "question": "A logistics company is planning to optimize its delivery routes for three different types of cargo (A, B, and C). The company needs to determine the number of trucks to allocate for each type of cargo and the speed at which each type of truck can travel. The speed of travel affects the fuel efficiency and thus the cost of operation. The cost of fuel per kilometer for cargo A is $2, for cargo B is $3, and for cargo C is $4. The company wants to minimize the total fuel cost per day, considering the distance each truck travels. The company has a total budget of $1000 for fuel costs per day. The company has a maximum of 50 trucks available. The average speed of trucks cannot exceed 100 km/h. The total distance covered by all trucks should not exceed 5000 km per day. Please help the company to determine the optimal allocation of trucks and their speeds to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for cargo A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for cargo B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for cargo C\nSpeedA = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedA\", lb=0) # speed of trucks for cargo A\nSpeedB = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedB\", lb=0) # speed of trucks for cargo B\nSpeedC = model.addVar(vtype=\"CONTINUOUS\", name=\"SpeedC\", lb=0) # speed of trucks for cargo C\n\n# Define objective function\nFuelCostA = TrucksA * SpeedA * 2\nFuelCostB = TrucksB * SpeedB * 3\nFuelCostC = TrucksC * SpeedC * 4\n# So, the objective function is: Minimize (FuelCostA + FuelCostB + FuelCostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostA + FuelCostB + FuelCostC)\n\n# Add constraints\n# The company has a total budget of $1000 for fuel costs per day.\nmodel.addCons(2 * TrucksA * SpeedA + 3 * TrucksB * SpeedB + 4 * TrucksC * SpeedC <= 1000)\n# The company has a maximum of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# The average speed of trucks cannot exceed 100 km/h.\nmodel.addCons(SpeedA + SpeedB + SpeedC <= 100)\n# The total distance covered by all trucks should not exceed 5000 km per day.\nmodel.addCons(TrucksA * SpeedA + TrucksB * SpeedB + TrucksC * SpeedC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TrucksC))\n    print(\"Speed of Trucks for Cargo A: \", model.getVal(SpeedA))\n    print(\"Speed of Trucks for Cargo B: \", model.getVal(SpeedB))\n    print(\"Speed of Trucks for Cargo C: \", model.getVal(SpeedC))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\n// {\"number of trucks for short distance routes\": \"ShortDistance\", \"range\": \"ShortDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for medium distance routes\": \"MediumDistance\", \"range\": \"MediumDistance >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for long distance routes\": \"LongDistance\", \"range\": \"LongDistance >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company wants to maximize the net daily profit from the fleet expansion.\n// NetProfit_Short = 1000 * ShortDistance - 500 * ShortDistance\n// NetProfit_Medium = 1500 * MediumDistance - 800 * MediumDistance\n// NetProfit_Long = 2000 * LongDistance - 1200 * LongDistance\n// So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the fleet expansion.\n// 500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000\n\n## Generate Constraint-2:\nThe company can only accommodate a total of 100 trucks in its current facilities.\n// ShortDistance + MediumDistance + LongDistance <= 100\n\n## Generate Constraint-3:\nThe company must ensure that at least 30% of the new fleet is dedicated to long distance routes.\n// LongDistance >= 0.3 * (ShortDistance + MediumDistance + LongDistance)\n\n## Generate Constraint-4:\nThe company aims to have no more than 50 trucks on medium distance routes.\n// MediumDistance <= 50\n\n## Generate Constraint-5:\nThe company wants to maintain a balance between short and medium distance routes, ensuring that the number of trucks on short distance routes is at least half the number on medium distance routes.\n// ShortDistance >= 0.5 * MediumDistance",
        "question": "A logistics company is planning its fleet expansion to optimize its delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. The company needs to determine the number of trucks to add to each route type.\nFor short distance routes, the operational cost per truck is $500 per day, and the revenue generated is $1000 per day.\nFor medium distance routes, the operational cost per truck is $800 per day, and the revenue generated is $1500 per day.\nFor long distance routes, the operational cost per truck is $1200 per day, and the revenue generated is $2000 per day.\nThe company has a budget of $100,000 for the fleet expansion. The company can only accommodate a total of 100 trucks in its current facilities. The company must ensure that at least 30% of the new fleet is dedicated to long distance routes. The company aims to have no more than 50 trucks on medium distance routes. The company wants to maintain a balance between short and medium distance routes, ensuring that the number of trucks on short distance routes is at least half the number on medium distance routes.\nPlease help the company to maximize the net daily profit from the fleet expansion.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistance = model.addVar(vtype=\"INTEGER\", name=\"ShortDistance\", lb=0) # number of trucks for short distance routes\nMediumDistance = model.addVar(vtype=\"INTEGER\", name=\"MediumDistance\", lb=0) # number of trucks for medium distance routes\nLongDistance = model.addVar(vtype=\"INTEGER\", name=\"LongDistance\", lb=0) # number of trucks for long distance routes\n\n# Define objective function\nNetProfit_Short = (1000 - 500) * ShortDistance\nNetProfit_Medium = (1500 - 800) * MediumDistance\nNetProfit_Long = (2000 - 1200) * LongDistance\n# So, the objective function is: Maximize (NetProfit_Short + NetProfit_Medium + NetProfit_Long)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_Short + NetProfit_Medium + NetProfit_Long)\n\n# Add constraints\n# The company has a budget of $100,000 for the fleet expansion.\nmodel.addCons(500 * ShortDistance + 800 * MediumDistance + 1200 * LongDistance <= 100000)\n# The company can only accommodate a total of 100 trucks in its current facilities.\nmodel.addCons(ShortDistance + MediumDistance + LongDistance <= 100)\n# The company must ensure that at least 30% of the new fleet is dedicated to long distance routes.\nmodel.addCons(LongDistance >= 0.3 * (ShortDistance + MediumDistance + LongDistance))\n# The company aims to have no more than 50 trucks on medium distance routes.\nmodel.addCons(MediumDistance <= 50)\n# The company wants to maintain a balance between short and medium distance routes, ensuring that the number of trucks on short distance routes is at least half the number on medium distance routes.\nmodel.addCons(ShortDistance >= 0.5 * MediumDistance)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Short Distance Routes: \", model.getVal(ShortDistance))\n    print(\"Number of Trucks for Medium Distance Routes: \", model.getVal(MediumDistance))\n    print(\"Number of Trucks for Long Distance Routes: \", model.getVal(LongDistance))\n    print(\"Maximized Net Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route 1 has a cost of $2 per mile and an average speed of 50 mph. Route 2 has a cost of $3 per mile and an average speed of 45 mph. Route 3 has a cost of $4 per mile and an average speed of 40 mph. Route 4 has a cost of $5 per mile and an average speed of 35 mph. Route 5 has a cost of $6 per mile and an average speed of 30 mph. The company aims to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed a certain threshold.\n// Cost of route 1: C1 = 2 * T1\n// Cost of route 2: C2 = 3 * T2\n// Cost of route 3: C3 = 4 * T3\n// Cost of route 4: C4 = 5 * T4\n// Cost of route 5: C5 = 6 * T5\n// Total delivery time: T_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n// So, the objective function is: Minimize (C1 + C2 + C3 + C4 + C5) + (T_total * 100)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for operational costs.\n// 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000\n\n## Generate Constraint-2:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nEach route must have at least 2 trucks.\n// T1 >= 2; T2 >= 2; T3 >= 2; T4 >= 2; T5 >= 2\n\n## Generate Constraint-4:\nThe total delivery time must not exceed 10 hours.\n// (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30) <= 10",
        "question": "A logistics company operates five different routes for delivering packages. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost per mile and average speed for each route are given in the following Table.\n\n| Route | Cost per Mile | Average Speed |\n|-------|---------------|---------------|\n| 1     | $2            | 50 mph        |\n| 2     | $3            | 45 mph        |\n| 3     | $4            | 40 mph        |\n| 4     | $5            | 35 mph        |\n| 5     | $6            | 30 mph        |\n\nThe company has a budget of $1000 for operational costs. The total number of trucks available is 50. Each route must have at least 2 trucks. The total delivery time must not exceed 10 hours. \nPlease help the company to minimize the total cost of operations while ensuring that the total delivery time across all routes does not exceed the specified threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=2) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=2) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=2) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=2) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=2) # number of trucks on route 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 2 * T1\nC2 = 3 * T2\nC3 = 4 * T3\nC4 = 5 * T4\nC5 = 6 * T5\nT_total = (T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30)\n## the objective function is: Minimize (C1 + C2 + C3 + C4 + C5) + (T_total * 100)\n## convert the division to multiplication\nmodel.addCons(obj == C1 + C2 + C3 + C4 + C5 + 100 * T_total)\n\n# Add constraints\n## The company has a budget of $1000 for operational costs.\nmodel.addCons(2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5 <= 1000)\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## The total delivery time must not exceed 10 hours.\nmodel.addCons((T1 / 50) + (T2 / 45) + (T3 / 40) + (T4 / 35) + (T5 / 30) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, for product C is $40, and for product D is $50. The production cost per unit for product A is $10, for product B is $15, for product C is $20, and for product D is $25. The company aims to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The cost function is defined as Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2). The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost.\n// Maximize Profit = (20A + 30B + 40C + 50D) - (10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2))\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs in the next quarter.\n// 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2) <= 5000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each product are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50; D >= 50\n\n## Generate Constraint-3:\nThe company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\n// 2A + 3B + 4C + 5D <= 1000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine how many units of each product to produce in the next quarter to optimize their profit margin. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $15                      |\n| C       | $40             | $20                      |\n| D       | $50             | $25                      |\n\nThe company has a budget of $5000 for production costs in the next quarter. The company wants to ensure that at least 50 units of each product are produced in the next quarter. The company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours. The company aims to maximize the total profit while considering the economies of scale where the cost per unit decreases slightly with increased production. The cost function is defined as Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2). The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost.\n\nPlease help the company to determine the optimal number of units of each product to produce in the next quarter to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of product D\n\n# Define objective function\n## The objective is to maximize the profit function: Profit = (20A + 30B + 40C + 50D) - Cost\n## where Cost = 10A + 15B + 20C + 25D - 0.01(A^2 + B^2 + C^2 + D^2)\nCost = 10*A + 15*B + 20*C + 25*D - 0.01*(A**2 + B**2 + C**2 + D**2)\nProfit = 20*A + 30*B + 40*C + 50*D - Cost\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $5000 for production costs in the next quarter.\nmodel.addCons(Cost <= 5000)\n## The company has a limited production capacity of 1000 hours, where product A requires 2 hours to produce, product B requires 3 hours, product C requires 4 hours, and product D requires 5 hours.\nmodel.addCons(2*A + 3*B + 4*C + 5*D <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1492,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities and fuel efficiencies.\n// {\"number of vehicle 1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 4\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 5\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle 1 has a capacity of 100 units, a fuel efficiency of 5 km/liter, and a cost of $100 per day.\nVehicle 2 has a capacity of 150 units, a fuel efficiency of 7 km/liter, and a cost of $150 per day.\nVehicle 3 has a capacity of 200 units, a fuel efficiency of 10 km/liter, and a cost of $200 per day.\nVehicle 4 has a capacity of 250 units, a fuel efficiency of 12 km/liter, and a cost of $250 per day.\nVehicle 5 has a capacity of 300 units, a fuel efficiency of 15 km/liter, and a cost of $300 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\n// Total fuel consumption: FuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n// So, the objective function is: Minimize (VehicleCost + FuelConsumption)\n\n## Generate Constraint-1:\nThe total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000",
        "question": "A logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities, fuel efficiencies, and daily costs. The details of each vehicle are provided in the following Table.\n\n| Vehicle | Capacity (units) | Fuel Efficiency (km/liter) | Daily Cost ($) |\n|---------|------------------|----------------------------|----------------|\n| 1       | 100              | 5                          | 100            |\n| 2       | 150              | 7                          | 150            |\n| 3       | 200              | 10                         | 200            |\n| 4       | 250              | 12                         | 250            |\n| 5       | 300              | 15                         | 300            |\n\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel. The total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\nPlease help the company determine the optimal number of each type of vehicle to use in order to minimize the total cost of vehicles and fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of vehicle 1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of vehicle 2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of vehicle 3\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of vehicle 4\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of vehicle 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nVehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\nFuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n## the objective function is: Minimize (VehicleCost + FuelConsumption)\nmodel.addCons(obj == VehicleCost + FuelConsumption)\n\n# Add constraints\n## The total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicle 1: \", model.getVal(V1))\n    print(\"Number of Vehicle 2: \", model.getVal(V2))\n    print(\"Number of Vehicle 3: \", model.getVal(V3))\n    print(\"Number of Vehicle 4: \", model.getVal(V4))\n    print(\"Number of Vehicle 5: \", model.getVal(V5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company aims to maximize the total profit from the production of these components.\n// Total profit for ComponentA: Profit_A = 50 * A\n// Total profit for ComponentB: Profit_B = 70 * B\n// Total profit for ComponentC: Profit_C = 90 * C\n// Total profit for ComponentD: Profit_D = 110 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 1000\n\n## Generate Constraint-2:\nThe market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\n// A >= 20; D <= 50\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit.\n// 10 * A + 15 * B + 20 * C + 25 * D <= 5000",
        "question": "A manufacturing company produces four types of electronic components: ComponentA, ComponentB, ComponentC, and ComponentD. The company needs to determine the optimal production quantity for each component to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, and for ComponentD is $110. The company has a total production capacity of 1000 hours per week. The production time for ComponentA is 2 hours per unit, for ComponentB is 3 hours per unit, for ComponentC is 4 hours per unit, and for ComponentD is 5 hours per unit. The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week. The company has a limited budget for raw materials, which is $5000 per week. The cost of raw materials for ComponentA is $10 per unit, for ComponentB is $15 per unit, for ComponentC is $20 per unit, and for ComponentD is $25 per unit. Please help the company to maximize the total profit from the production of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=50) # number of units of ComponentD\n\n# Define objective function\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nProfit_D = 110 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 1000)\n# The market demand for ComponentA is at least 20 units per week, and for ComponentD, it should not exceed 50 units per week.\nmodel.addCons(A >= 20)\n# The company has a limited budget for raw materials, which is $5000 per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Number of ComponentD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift.\n// {\"production quantity for product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product A\": \"ShiftA\", \"range\": \"ShiftA >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product B\": \"ShiftB\", \"range\": \"ShiftB >= 0\", \"type\": \"integer\"}\n// {\"number of shifts for product C\": \"ShiftC\", \"range\": \"ShiftC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product A, the production cost per unit is $50, and the revenue per unit is $100. Each shift increases the production capacity by 100 units.\nFor product B, the production cost per unit is $70, and the revenue per unit is $140. Each shift increases the production capacity by 120 units.\nFor product C, the production cost per unit is $60, and the revenue per unit is $120. Each shift increases the production capacity by 110 units.\nThe company wants to maximize the total net profit.\n// NetProfit_A = (100 - 50) * ProdA\n// NetProfit_B = (140 - 70) * ProdB\n// NetProfit_C = (120 - 60) * ProdC\n// TotalProduction_A = ShiftA * 100\n// TotalProduction_B = ShiftB * 120\n// TotalProduction_C = ShiftC * 110\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) subject to the production constraints.\n\n## Generate Constraint-1:\nThe company has a total of 500 units of raw materials available.\n// ProdA + ProdB + ProdC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity for each product, as well as the number of shifts to operate in their factory. The production cost and revenue vary per product and per shift. For product A, the production cost per unit is $50, and the revenue per unit is $100. Each shift increases the production capacity by 100 units. For product B, the production cost per unit is $70, and the revenue per unit is $140. Each shift increases the production capacity by 120 units. For product C, the production cost per unit is $60, and the revenue per unit is $120. Each shift increases the production capacity by 110 units. The company wants to maximize the total net profit. The company has a total of 500 units of raw materials available. Please help the company to determine the optimal production quantity and number of shifts for each product to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for product C\nShiftA = model.addVar(vtype=\"INTEGER\", name=\"ShiftA\", lb=0) # number of shifts for product A\nShiftB = model.addVar(vtype=\"INTEGER\", name=\"ShiftB\", lb=0) # number of shifts for product B\nShiftC = model.addVar(vtype=\"INTEGER\", name=\"ShiftC\", lb=0) # number of shifts for product C\n\n# Define objective function\nNetProfit_A = (100 - 50) * ProdA\nNetProfit_B = (140 - 70) * ProdB\nNetProfit_C = (120 - 60) * ProdC\nTotalProduction_A = ShiftA * 100\nTotalProduction_B = ShiftB * 120\nTotalProduction_C = ShiftC * 110\n\n# Constraint to ensure production quantities do not exceed shift capacities\nmodel.addCons(ProdA <= TotalProduction_A)\nmodel.addCons(ProdB <= TotalProduction_B)\nmodel.addCons(ProdC <= TotalProduction_C)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC <= 500) # total raw materials constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(ProdA))\n    print(\"Production Quantity for Product B: \", model.getVal(ProdB))\n    print(\"Production Quantity for Product C: \", model.getVal(ProdC))\n    print(\"Number of Shifts for Product A: \", model.getVal(ShiftA))\n    print(\"Number of Shifts for Product B: \", model.getVal(ShiftB))\n    print(\"Number of Shifts for Product C: \", model.getVal(ShiftC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next year. They need to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials.\n// {\"number of trucks for perishable goods\": \"PerishableTrucks\", \"range\": \"PerishableTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for heavy machinery\": \"HeavyMachineryTrucks\", \"range\": \"HeavyMachineryTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for general merchandise\": \"GeneralMerchandiseTrucks\", \"range\": \"GeneralMerchandiseTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per truck for perishable goods is $50,000 per year, and the revenue generated per truck is $100,000 per year.\nFor heavy machinery, the operational cost per truck is $70,000 per year, and the revenue generated per truck is $150,000 per year.\nFor general merchandise, the operational cost per truck is $60,000 per year, and the revenue generated per truck is $120,000 per year.\nThe company wants to maximize the net profit, which is the total revenue minus the total operational costs.\n// TotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\n// TotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\n// So, the objective function is: Maximize (TotalRevenue - TotalCost)\n\n## Generate Constraint-1:\nThe company has a budget of $2,000,000 for purchasing trucks.\n// 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000\n\n## Generate Constraint-2:\nThe company can only operate a maximum of 50 trucks in total.\n// PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks <= 50\n\n## Generate Constraint-3:\nAt least 20% of the fleet must be dedicated to perishable goods.\n// PerishableTrucks >= 0.2 * (PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks)",
        "question": "A logistics company is planning its fleet for the next year and needs to decide on the number of trucks to purchase for three different types of cargo: perishable goods, heavy machinery, and general merchandise. Each type of truck has different operational costs and revenue potentials. The operational cost per truck for perishable goods is $50,000 per year, and the revenue generated per truck is $100,000 per year. For heavy machinery, the operational cost per truck is $70,000 per year, and the revenue generated per truck is $150,000 per year. For general merchandise, the operational cost per truck is $60,000 per year, and the revenue generated per truck is $120,000 per year. The company wants to maximize the net profit, which is the total revenue minus the total operational costs. The company has a budget of $2,000,000 for purchasing trucks and can only operate a maximum of 50 trucks in total. Additionally, at least 20% of the fleet must be dedicated to perishable goods. Please help the company determine the optimal number of trucks for each type of cargo to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPerishableTrucks = model.addVar(vtype=\"INTEGER\", name=\"PerishableTrucks\", lb=0)\nHeavyMachineryTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyMachineryTrucks\", lb=0)\nGeneralMerchandiseTrucks = model.addVar(vtype=\"INTEGER\", name=\"GeneralMerchandiseTrucks\", lb=0)\n\n# Define objective function\nTotalRevenue = 100000 * PerishableTrucks + 150000 * HeavyMachineryTrucks + 120000 * GeneralMerchandiseTrucks\nTotalCost = 50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalRevenue - TotalCost)\n\n# Add constraints\nmodel.addCons(50000 * PerishableTrucks + 70000 * HeavyMachineryTrucks + 60000 * GeneralMerchandiseTrucks <= 2000000)\nmodel.addCons(PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks <= 50)\nmodel.addCons(PerishableTrucks >= 0.2 * (PerishableTrucks + HeavyMachineryTrucks + GeneralMerchandiseTrucks))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Perishable Goods: \", model.getVal(PerishableTrucks))\n    print(\"Number of Trucks for Heavy Machinery: \", model.getVal(HeavyMachineryTrucks))\n    print(\"Number of Trucks for General Merchandise: \", model.getVal(GeneralMerchandiseTrucks))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed.\n// {\"speed of truck i\": \"Speed_i\", \"range\": \"0 < Speed_i < 120\", \"type\": \"continuous\"}\n// {\"number of trucks on route j\": \"Trucks_j\", \"range\": \"Trucks_j >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of truck i at speed x\": \"Efficiency_i(x)\", \"range\": \"Efficiency_i(x) > 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption across all trucks and routes. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function.\n// Fuel consumption for truck i on route j: Consumption_ij = Distance_j / Efficiency_i(Speed_i) * Trucks_j\n// Total fuel consumption: Minimize \u03a3(Consumption_ij) for all i and j\n// Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i\n\n## Generate Constraint-1:\nThe total number of trucks available is limited to 100.\n// \u03a3(Trucks_j) for all j <= 100\n\n## Generate Constraint-2:\nThe maximum speed limit for any truck is 120 km/h.\n// Speed_i <= 120 for all i\n\n## Generate Constraint-3:\nThe minimum speed required to maintain stability and safety is 40 km/h.\n// Speed_i >= 40 for all i\n\n## Generate Constraint-4:\nDue to route capacity constraints, the number of trucks on any route must not exceed 20.\n// Trucks_j <= 20 for all j\n\n## Generate Constraint-5:\nThe fuel efficiency of each truck must be at least 5 km/l at any speed.\n// Efficiency_i(Speed_i) >= 5 for all i",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck. The variables include the speed of each truck (in km/h), the number of trucks assigned to each route, and the fuel efficiency of each truck (in km/l) which varies nonlinearly with speed. The fuel consumption of each truck is given by the product of the distance traveled, inversely proportional to the fuel efficiency at the given speed, and the number of trucks on that route. The fuel efficiency of each truck decreases nonlinearly with increasing speed, modeled by a quadratic function Efficiency_i(x) = a_i * x^2 + b_i * x + c_i, where a_i, b_i, c_i are coefficients for truck i.\n\nThe company aims to minimize the total fuel consumption across all trucks and routes. The total number of trucks available is limited to 100. The maximum speed limit for any truck is 120 km/h, and the minimum speed required to maintain stability and safety is 40 km/h. Due to route capacity constraints, the number of trucks on any route must not exceed 20. Additionally, the fuel efficiency of each truck must be at least 5 km/l at any speed.\n\nPlease help the company to determine the optimal speed for each truck and the number of trucks assigned to each route to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Speed of each truck\nSpeed = {}\nfor i in range(10):  # Assuming 10 trucks for example\n    Speed[i] = model.addVar(name=f\"Speed_{i}\", lb=40, ub=120, vtype=\"CONTINUOUS\")\n\n## Number of trucks on each route\nTrucks = {}\nfor j in range(5):  # Assuming 5 routes for example\n    Trucks[j] = model.addVar(name=f\"Trucks_{j}\", vtype=\"INTEGER\", lb=0)\n\n# Define objective function\n## Fuel consumption for each truck on each route\nConsumption = {}\nfor i in range(10):\n    for j in range(5):\n        Efficiency = Speed[i]**2 + 2*Speed[i] + 3  # Example quadratic function for fuel efficiency\n        Consumption[(i, j)] = model.addVar(name=f\"Consumption_{i}_{j}\", vtype=\"CONTINUOUS\")\n        model.addCons(Consumption[(i, j)] == 100 / Efficiency * Trucks[j])  # Assuming distance 100 km for simplicity\n\n## Total fuel consumption\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == sum(Consumption.values()))\n\n# Add constraints\n## Total number of trucks\nmodel.addCons(sum(Trucks.values()) <= 100)\n\n## Speed constraints\nfor i in range(10):\n    model.addCons(Speed[i] <= 120)\n    model.addCons(Speed[i] >= 40)\n\n## Route capacity constraints\nfor j in range(5):\n    model.addCons(Trucks[j] <= 20)\n\n## Fuel efficiency constraint\nfor i in range(10):\n    Efficiency = Speed[i]**2 + 2*Speed[i] + 3  # Example quadratic function for fuel efficiency\n    model.addCons(Efficiency >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    for i in range(10):\n        print(f\"Speed of truck {i}: {model.getVal(Speed[i])} km/h\")\n    for j in range(5):\n        print(f\"Number of trucks on route {j}: {model.getVal(Trucks[j])}\")\n    print(f\"Total fuel consumption: {model.getObjVal()} liters\")\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1366,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations.\n// {\"number of trucks for route A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route D\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for route E\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost.\n// Operating cost of A: CostA = 200 * TrucksA\n// Operating cost of B: CostB = 250 * TrucksB\n// Operating cost of C: CostC = 300 * TrucksC\n// Operating cost of D: CostD = 350 * TrucksD\n// Operating cost of E: CostE = 400 * TrucksE\n// Revenue of A: RevenueA = 500 * TrucksA\n// Revenue of B: RevenueB = 600 * TrucksB\n// Revenue of C: RevenueC = 700 * TrucksC\n// Revenue of D: RevenueD = 800 * TrucksD\n// Revenue of E: RevenueE = 900 * TrucksE\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for operating costs.\n// 200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000\n\n## Generate Constraint-2:\nThe company has a maximum of 30 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of the total trucks are allocated to each route.\n// TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n// TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-4:\nThe company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n// TrucksE <= TrucksA + TrucksB + TrucksC",
        "question": "A logistics company operates five different routes (A, B, C, D, E) for transporting goods. The company needs to determine the number of trucks to allocate to each route to optimize its operations. The cost of operating a truck on each route varies due to different fuel efficiencies and maintenance costs. Route A costs $200 per truck, Route B costs $250 per truck, Route C costs $300 per truck, Route D costs $350 per truck, and Route E costs $400 per truck. The revenue generated by each truck also varies; Route A generates $500 per truck, Route B generates $600 per truck, Route C generates $700 per truck, Route D generates $800 per truck, and Route E generates $900 per truck. The company aims to maximize its net profit, which is the total revenue minus the total operating cost. The company has a total budget of $10,000 for operating costs. The company has a maximum of 30 trucks available for allocation. The company wants to ensure that at least 10% of the total trucks are allocated to each route. The company also wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\n\nPlease help the company to maximize its net profit by determining the optimal allocation of trucks to each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for route A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for route B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for route C\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for route D\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for route E\n\n# Define objective function\nCostA = 200 * TrucksA\nCostB = 250 * TrucksB\nCostC = 300 * TrucksC\nCostD = 350 * TrucksD\nCostE = 400 * TrucksE\nRevenueA = 500 * TrucksA\nRevenueB = 600 * TrucksB\nRevenueC = 700 * TrucksC\nRevenueD = 800 * TrucksD\nRevenueE = 900 * TrucksE\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC + RevenueD - CostD + RevenueE - CostE)\n\n# Add constraints\n# The company has a total budget of $10,000 for operating costs.\nmodel.addCons(200 * TrucksA + 250 * TrucksB + 300 * TrucksC + 350 * TrucksD + 400 * TrucksE <= 10000)\n# The company has a maximum of 30 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 30)\n# The company wants to ensure that at least 10% of the total trucks are allocated to each route.\nmodel.addCons(TrucksA >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksB >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksC >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksD >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\nmodel.addCons(TrucksE >= 0.1 * (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE))\n# The company wants to ensure that the number of trucks on Route E does not exceed the combined number of trucks on Routes A, B, and C.\nmodel.addCons(TrucksE <= TrucksA + TrucksB + TrucksC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Route B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Route C: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for Route D: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for Route E: \", model.getVal(TrucksE))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Trucks4\", \"range\": \"Trucks4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Trucks5\", \"range\": \"Trucks5 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks in Region1\": \"Speed1\", \"range\": \"0 < Speed1 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region2\": \"Speed2\", \"range\": \"0 < Speed2 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region3\": \"Speed3\", \"range\": \"0 < Speed3 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region4\": \"Speed4\", \"range\": \"0 < Speed4 < 100\", \"type\": \"continuous\"}\n// {\"speed of trucks in Region5\": \"Speed5\", \"range\": \"0 < Speed5 < 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions.\n// Total fuel consumption in Region1: Fuel1 = 0.05 * Speed1^2 * Trucks1\n// Total fuel consumption in Region2: Fuel2 = 0.055 * Speed2^2 * Trucks2\n// Total fuel consumption in Region3: Fuel3 = 0.06 * Speed3^2 * Trucks3\n// Total fuel consumption in Region4: Fuel4 = 0.065 * Speed4^2 * Trucks4\n// Total fuel consumption in Region5: Fuel5 = 0.07 * Speed5^2 * Trucks5\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50\n\n## Generate Constraint-2:\nDue to regional regulations, the speed of trucks in each region must not exceed 80 km/h.\n// Speed1 <= 80; Speed2 <= 80; Speed3 <= 80; Speed4 <= 80; Speed5 <= 80",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region (Region1, Region2, Region3, Region4, Region5) and the optimal speed at which each truck should travel to minimize fuel consumption and operational costs. The fuel consumption of each truck is modeled by a quadratic function of its speed. The fuel consumption rate (in gallons per hour) for a truck in Region1 is 0.05 * Speed1^2, in Region2 is 0.055 * Speed2^2, in Region3 is 0.06 * Speed3^2, in Region4 is 0.065 * Speed4^2, and in Region5 is 0.07 * Speed5^2. The company aims to minimize the total fuel consumption across all regions. The company has a total of 50 trucks available for allocation. Due to regional regulations, the speed of trucks in each region must not exceed 80 km/h. Please help the company to determine the optimal allocation of trucks and their speeds to minimize total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks in Region3\nTrucks4 = model.addVar(vtype=\"INTEGER\", name=\"Trucks4\", lb=0)  # number of trucks in Region4\nTrucks5 = model.addVar(vtype=\"INTEGER\", name=\"Trucks5\", lb=0)  # number of trucks in Region5\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=100)  # speed of trucks in Region1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=100)  # speed of trucks in Region2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=100)  # speed of trucks in Region3\nSpeed4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed4\", lb=0, ub=100)  # speed of trucks in Region4\nSpeed5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed5\", lb=0, ub=100)  # speed of trucks in Region5\n\n# Define objective function\nFuel1 = 0.05 * Speed1**2 * Trucks1\nFuel2 = 0.055 * Speed2**2 * Trucks2\nFuel3 = 0.06 * Speed3**2 * Trucks3\nFuel4 = 0.065 * Speed4**2 * Trucks4\nFuel5 = 0.07 * Speed5**2 * Trucks5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3 + Fuel4 + Fuel5)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + Trucks4 + Trucks5 <= 50)\nmodel.addCons(Speed1 <= 80)\nmodel.addCons(Speed2 <= 80)\nmodel.addCons(Speed3 <= 80)\nmodel.addCons(Speed4 <= 80)\nmodel.addCons(Speed5 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Trucks4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Trucks5))\n    print(\"Speed of Trucks in Region1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks in Region2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks in Region3: \", model.getVal(Speed3))\n    print(\"Speed of Trucks in Region4: \", model.getVal(Speed4))\n    print(\"Speed of Trucks in Region5: \", model.getVal(Speed5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The regions are Region1, Region2, Region3, Region4, and Region5.\n// {\"number of trucks in Region1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption rate for trucks in Region1 is 0.5 liters per kilometer, in Region2 is 0.6 liters per kilometer, in Region3 is 0.7 liters per kilometer, in Region4 is 0.8 liters per kilometer, and in Region5 is 0.9 liters per kilometer. The operational cost per truck per day is $100 for all regions. The company wants to minimize the total operational cost plus the total fuel consumption.\n// Total_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\n// Total_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n// So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to optimize the allocation of trucks to minimize fuel consumption and operational costs while meeting delivery demands. The fuel consumption rate for trucks in each region and the operational cost per truck per day are given in the following Table.\n\n| Region   | Fuel Consumption Rate (liters/km) | Operational Cost per Truck per Day ($) |\n|----------|----------------------------------|----------------------------------------|\n| Region1  | 0.5                              | 100                                    |\n| Region2  | 0.6                              | 100                                    |\n| Region3  | 0.7                              | 100                                    |\n| Region4  | 0.8                              | 100                                    |\n| Region5  | 0.9                              | 100                                    |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to minimize the total operational cost plus the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0) # number of trucks in Region1\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0) # number of trucks in Region2\nTruck3 = model.addVar(vtype=\"INTEGER\", name=\"Truck3\", lb=0) # number of trucks in Region3\nTruck4 = model.addVar(vtype=\"INTEGER\", name=\"Truck4\", lb=0) # number of trucks in Region4\nTruck5 = model.addVar(vtype=\"INTEGER\", name=\"Truck5\", lb=0) # number of trucks in Region5\n\n# Define objective function\nTotal_Fuel_Consumption = 0.5 * Truck1 + 0.6 * Truck2 + 0.7 * Truck3 + 0.8 * Truck4 + 0.9 * Truck5\nTotal_Operational_Cost = 100 * (Truck1 + Truck2 + Truck3 + Truck4 + Truck5)\n# So, the objective function is: Minimize (Total_Fuel_Consumption + Total_Operational_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Fuel_Consumption + Total_Operational_Cost)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Truck1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Truck2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Truck3))\n    print(\"Number of Trucks in Region4: \", model.getVal(Truck4))\n    print(\"Number of Trucks in Region5: \", model.getVal(Truck5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1192,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit, considering the costs of raw materials, labor, and storage.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The storage cost per unit is $5 for all products. The company wants to maximize the total profit, which includes the revenue from selling the products minus the production and storage costs.\n// Total profit for ProductA: Profit_A = (50 - 30 - 5) * QuantityA\n// Total profit for ProductB: Profit_B = (70 - 40 - 5) * QuantityB\n// Total profit for ProductC: Profit_C = (90 - 50 - 5) * QuantityC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for raw materials and labor.\n// 30 * QuantityA + 40 * QuantityB + 50 * QuantityC <= 10,000\n\n## Generate Constraint-2:\nThe available storage space limits the total production to 200 units.\n// QuantityA + QuantityB + QuantityC <= 200\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company has a minimum order requirement from a key supplier for ProductC, which must be at least 30 units.\n// QuantityC >= 30",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantities for each product to maximize profit, considering the costs of raw materials, labor, and storage. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $50. The storage cost per unit is $5 for all products. The company has a total budget of $10,000 for raw materials and labor. The available storage space limits the total production to 200 units. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company has a minimum order requirement from a key supplier for ProductC, which must be at least 30 units. Please help the company to maximize the total profit, which includes the revenue from selling the products minus the production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 30 - 5) * QuantityA\n## Total profit for ProductB: Profit_B = (70 - 40 - 5) * QuantityB\n## Total profit for ProductC: Profit_C = (90 - 50 - 5) * QuantityC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 30 - 5) * QuantityA\nProfit_B = (70 - 40 - 5) * QuantityB\nProfit_C = (90 - 50 - 5) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for raw materials and labor.\nmodel.addCons(30 * QuantityA + 40 * QuantityB + 50 * QuantityC <= 10000)\n## The available storage space limits the total production to 200 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 200)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n## The company has a minimum order requirement from a key supplier for ProductC, which must be at least 30 units.\nmodel.addCons(QuantityC >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in new machinery that could potentially reduce production costs for each product.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in machinery for product A\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product B\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product C\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product D\": \"MachineryD\", \"range\": \"MachineryD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of product decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n// Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n// Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n// Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for investing in new machinery.\n// MachineryA + MachineryB + MachineryC + MachineryD <= 200000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 10,000 units.\n// A + B + C + D <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of product A and 1,500 units of product B.\n// A >= 1000; B >= 1500",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and is considering investing in new machinery that could potentially reduce production costs for each product. The production cost per unit of product decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $200,000 for investing in new machinery. The total production quantity for all products must not exceed 10,000 units. The company must produce at least 1,000 units of product A and 1,500 units of product B.\n\nPlease help the company to determine the optimal production quantity for each product and the amount to invest in machinery for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=1000) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=1500) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0) # investment in machinery for product A\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0) # investment in machinery for product B\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0) # investment in machinery for product C\nMachineryD = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryD\", lb=0) # investment in machinery for product D\n\n# Define objective function\n## Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n## Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n## Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n## Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\nProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\nProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\nProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\nProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total budget of $200,000 for investing in new machinery.\nmodel.addCons(MachineryA + MachineryB + MachineryC + MachineryD <= 200000)\n## The total production quantity for all products must not exceed 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Machinery for Product A: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for Product B: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for Product C: \", model.getVal(MachineryC))\n    print(\"Investment in Machinery for Product D: \", model.getVal(MachineryD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The company needs to minimize the total operational cost of the fleet.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the daily demand of 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The company needs to minimize the total operational cost of the fleet. The total capacity of all trucks must meet the daily demand of 1000 tons. The company has a budget to purchase at most 50 trucks in total. Please help the company determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nmodel.addCons(obj == 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5)\n\n# Add constraints\n## The total capacity of all trucks must meet the daily demand of 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n## The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 678,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to ProductA\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductB\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to ProductC\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"IA\", \"range\": \"IA >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n// Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n// Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available for production are limited to 1000 units.\n// RA + RB + RC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of resources (labor and materials) allocated to each product. Additionally, the company is considering investing in automation technology to improve production efficiency.\nThe profit per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The production cost per unit decreases by $5 for every $1000 invested in automation technology. The initial production cost per unit for ProductA is $60, for ProductB is $80, and for ProductC is $100. The company aims to maximize the total profit from all products.\nThe total resources available for production are limited to 1000 units.\nPlease help the company determine the optimal production quantities, resource allocations, and investment in automation technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # resources allocated to ProductA\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # resources allocated to ProductB\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # resources allocated to ProductC\nIA = model.addVar(vtype=\"CONTINUOUS\", name=\"IA\", lb=0) # investment in automation technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (100 - 60 + 0.005 * IA) * QA\n## Total profit for ProductB: ProfitB = (150 - 80 + 0.005 * IA) * QB\n## Total profit for ProductC: ProfitC = (200 - 100 + 0.005 * IA) * QC\nProfitA = (100 - 60 + 0.005 * IA) * QA\nProfitB = (150 - 80 + 0.005 * IA) * QB\nProfitC = (200 - 100 + 0.005 * IA) * QC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The total resources available for production are limited to 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Resources Allocated to ProductA: \", model.getVal(RA))\n    print(\"Resources Allocated to ProductB: \", model.getVal(RB))\n    print(\"Resources Allocated to ProductC: \", model.getVal(RC))\n    print(\"Investment in Automation Technology: \", model.getVal(IA))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 7,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\n// {\"number of solar panels in D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in D5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor D1, the average daily energy production per panel is 1.5 kWh, the installation cost per panel is $500, and the maintenance cost per panel is $50 per year.\nFor D2, the average daily energy production per panel is 1.2 kWh, the installation cost per panel is $450, and the maintenance cost per panel is $45 per year.\nFor D3, the average daily energy production per panel is 1.8 kWh, the installation cost per panel is $550, and the maintenance cost per panel is $55 per year.\nFor D4, the average daily energy production per panel is 1.6 kWh, the installation cost per panel is $600, and the maintenance cost per panel is $60 per year.\nFor D5, the average daily energy production per panel is 1.4 kWh, the installation cost per panel is $400, and the maintenance cost per panel is $40 per year.\nThe city wants to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost.\n// Total annual energy production: Energy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\n// Total annual maintenance cost: Maintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\n// Total installation cost: Installation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n// So, the objective function is: Maximize (Energy - Maintenance) / Installation\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000\n\n## Generate Constraint-2:\nThe total number of solar panels that can be installed across all districts is limited to 200.\n// D1 + D2 + D3 + D4 + D5 <= 200",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. They have identified five districts (D1, D2, D3, D4, D5) where solar panels can be installed.\nFor D1, the average daily energy production per panel is 1.5 kWh, the installation cost per panel is $500, and the maintenance cost per panel is $50 per year.\nFor D2, the average daily energy production per panel is 1.2 kWh, the installation cost per panel is $450, and the maintenance cost per panel is $45 per year.\nFor D3, the average daily energy production per panel is 1.8 kWh, the installation cost per panel is $550, and the maintenance cost per panel is $55 per year.\nFor D4, the average daily energy production per panel is 1.6 kWh, the installation cost per panel is $600, and the maintenance cost per panel is $60 per year.\nFor D5, the average daily energy production per panel is 1.4 kWh, the installation cost per panel is $400, and the maintenance cost per panel is $40 per year.\nThe city has a budget of $100,000 for the installation of solar panels. The total number of solar panels that can be installed across all districts is limited to 200.\nPlease help the city to maximize the Net Energy Yield (NEY) per dollar invested, which is defined as the total annual energy production minus the total annual maintenance cost, divided by the total installation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # number of solar panels in D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # number of solar panels in D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # number of solar panels in D3\nD4 = model.addVar(vtype=\"INTEGER\", name=\"D4\", lb=0) # number of solar panels in D4\nD5 = model.addVar(vtype=\"INTEGER\", name=\"D5\", lb=0) # number of solar panels in D5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy = 1.5 * 365 * D1 + 1.2 * 365 * D2 + 1.8 * 365 * D3 + 1.6 * 365 * D4 + 1.4 * 365 * D5\nMaintenance = 50 * D1 + 45 * D2 + 55 * D3 + 60 * D4 + 40 * D5\nInstallation = 500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5\n## the objective function is: Maximize (Energy - Maintenance) / Installation\n## convert the division to multiplication\nmodel.addCons(obj * Installation == Energy - Maintenance)\n\n# Add constraints\n## The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(500 * D1 + 450 * D2 + 550 * D3 + 600 * D4 + 400 * D5 <= 100000)\n## The total number of solar panels that can be installed across all districts is limited to 200.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in D1: \", model.getVal(D1))\n    print(\"Number of Solar Panels in D2: \", model.getVal(D2))\n    print(\"Number of Solar Panels in D3: \", model.getVal(D3))\n    print(\"Number of Solar Panels in D4: \", model.getVal(D4))\n    print(\"Number of Solar Panels in D5: \", model.getVal(D5))\n    print(\"Maximized Net Energy Yield per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1385,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\n// {\"quantity of M1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of M3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\n// Profit_M1 = (1000 - 600 - 50) * M1\n// Profit_M2 = (1500 - 800 - 75) * M2\n// Profit_M3 = (2000 - 1200 - 100) * M3\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3)\n\n## Generate Constraint-1:\nThe company has a total production budget of $100,000.\n// 600 * M1 + 800 * M2 + 1200 * M3 <= 100,000",
        "question": "A manufacturing company produces three types of machines: M1, M2, and M3. They need to determine the optimal production quantities for each machine type to maximize their profit while considering various constraints.\nFor M1, the revenue per unit is $1000, the production cost per unit is $600, and the storage cost per unit is $50. \nFor M2, the revenue per unit is $1500, the production cost per unit is $800, and the storage cost per unit is $75. \nFor M3, the revenue per unit is $2000, the production cost per unit is $1200, and the storage cost per unit is $100.\nThe company wants to maximize the total net profit, which is the revenue minus the production and storage costs.\nThe company has a total production budget of $100,000.\nPlease help the company to determine the optimal production quantities for M1, M2, and M3 to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # quantity of M1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # quantity of M2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # quantity of M3\n\n# Define objective function\nProfit_M1 = (1000 - 600 - 50) * M1\nProfit_M2 = (1500 - 800 - 75) * M2\nProfit_M3 = (2000 - 1200 - 100) * M3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_M1 + Profit_M2 + Profit_M3)\n\n# Add constraints\nmodel.addCons(600 * M1 + 800 * M2 + 1200 * M3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of M1: \", model.getVal(M1))\n    print(\"Quantity of M2: \", model.getVal(M2))\n    print(\"Quantity of M3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies for each truck.\n// {\"number of trips to City1\": \"Trips1\", \"range\": \"Trips1 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City2\": \"Trips2\", \"range\": \"Trips2 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City3\": \"Trips3\", \"range\": \"Trips3 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City4\": \"Trips4\", \"range\": \"Trips4 >= 0\", \"type\": \"integer\"}\n// {\"number of trips to City5\": \"Trips5\", \"range\": \"Trips5 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for City1\": \"FuelEff1\", \"range\": \"FuelEff1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for City2\": \"FuelEff2\", \"range\": \"FuelEff2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for City3\": \"FuelEff3\", \"range\": \"FuelEff3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for City4\": \"FuelEff4\", \"range\": \"FuelEff4 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for City5\": \"FuelEff5\", \"range\": \"FuelEff5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel cost per trip decreases with the investment in fuel efficiency technologies. The initial fuel cost per trip to City1 is $100, to City2 is $120, to City3 is $110, to City4 is $90, and to City5 is $130. For every $100 invested in fuel efficiency, the fuel cost per trip decreases by $1. The company aims to minimize the total fuel cost across all routes.\n// FuelCost1 = (100 - 0.01 * FuelEff1) * Trips1\n// FuelCost2 = (120 - 0.01 * FuelEff2) * Trips2\n// FuelCost3 = (110 - 0.01 * FuelEff3) * Trips3\n// FuelCost4 = (90 - 0.01 * FuelEff4) * Trips4\n// FuelCost5 = (130 - 0.01 * FuelEff5) * Trips5\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for investing in fuel efficiency technologies for all routes.\n// FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 <= 10000",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the routes for five different destinations: City1, City2, City3, City4, and City5. The company also needs to decide on the fuel consumption rate for each route, which can be adjusted by investing in fuel-efficient technologies for each truck. The initial fuel cost per trip and the effect of investment in fuel efficiency technologies are given in the following Table.\n\n| Destination | Initial Fuel Cost per Trip | Effect of $100 Investment in Fuel Efficiency |\n|-------------|----------------------------|---------------------------------------------|\n| City1       | $100                       | Decrease fuel cost per trip by $1           |\n| City2       | $120                       | Decrease fuel cost per trip by $1           |\n| City3       | $110                       | Decrease fuel cost per trip by $1           |\n| City4       | $90                        | Decrease fuel cost per trip by $1           |\n| City5       | $130                       | Decrease fuel cost per trip by $1           |\n\nThe company has a total budget of $10,000 for investing in fuel efficiency technologies for all routes. The company aims to minimize the total fuel cost across all routes. Please help the company determine the optimal number of trips to each city and the investment in fuel efficiency for each route to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrips1 = model.addVar(vtype=\"INTEGER\", name=\"Trips1\", lb=0) # number of trips to City1\nTrips2 = model.addVar(vtype=\"INTEGER\", name=\"Trips2\", lb=0) # number of trips to City2\nTrips3 = model.addVar(vtype=\"INTEGER\", name=\"Trips3\", lb=0) # number of trips to City3\nTrips4 = model.addVar(vtype=\"INTEGER\", name=\"Trips4\", lb=0) # number of trips to City4\nTrips5 = model.addVar(vtype=\"INTEGER\", name=\"Trips5\", lb=0) # number of trips to City5\nFuelEff1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff1\", lb=0) # investment in fuel efficiency for City1\nFuelEff2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff2\", lb=0) # investment in fuel efficiency for City2\nFuelEff3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff3\", lb=0) # investment in fuel efficiency for City3\nFuelEff4 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff4\", lb=0) # investment in fuel efficiency for City4\nFuelEff5 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff5\", lb=0) # investment in fuel efficiency for City5\n\n# Define objective function\nFuelCost1 = (100 - 0.01 * FuelEff1) * Trips1\nFuelCost2 = (120 - 0.01 * FuelEff2) * Trips2\nFuelCost3 = (110 - 0.01 * FuelEff3) * Trips3\nFuelCost4 = (90 - 0.01 * FuelEff4) * Trips4\nFuelCost5 = (130 - 0.01 * FuelEff5) * Trips5\n# So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + FuelCost4 + FuelCost5)\n\n# Add constraints\n# The company has a total budget of $10,000 for investing in fuel efficiency technologies for all routes.\nmodel.addCons(FuelEff1 + FuelEff2 + FuelEff3 + FuelEff4 + FuelEff5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips to City1: \", model.getVal(Trips1))\n    print(\"Number of Trips to City2: \", model.getVal(Trips2))\n    print(\"Number of Trips to City3: \", model.getVal(Trips3))\n    print(\"Number of Trips to City4: \", model.getVal(Trips4))\n    print(\"Number of Trips to City5: \", model.getVal(Trips5))\n    print(\"Investment in Fuel Efficiency for City1: \", model.getVal(FuelEff1))\n    print(\"Investment in Fuel Efficiency for City2: \", model.getVal(FuelEff2))\n    print(\"Investment in Fuel Efficiency for City3: \", model.getVal(FuelEff3))\n    print(\"Investment in Fuel Efficiency for City4: \", model.getVal(FuelEff4))\n    print(\"Investment in Fuel Efficiency for City5: \", model.getVal(FuelEff5))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1399,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in Truck maintenance\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck >= 0\", \"type\": \"continuous\"}\n// {\"investment in Van maintenance\": \"MaintenanceVan\", \"range\": \"MaintenanceVan >= 0\", \"type\": \"continuous\"}\n// {\"investment in Bike maintenance\": \"MaintenanceBike\", \"range\": \"MaintenanceBike >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year.\n// Total operational cost for Trucks: CostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)^2\n// Total operational cost for Vans: CostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)^2\n// Total operational cost for Bikes: CostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)^2\n// So, the objective function is: Minimize (CostTruck + CostVan + CostBike)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases and maintenance.\n// Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000\n\n## Generate Constraint-2:\nThe company must purchase at least 50 Trucks and 100 Vans to meet contractual obligations.\n// Trucks >= 50; Vans >= 100",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and how much to invest in vehicle maintenance to optimize fuel efficiency and reduce operational costs. The operational cost reduction is quadratically related to the maintenance investment for each vehicle type. The operational cost per Truck is $1000 per month, which decreases by 1% for every $100 invested in maintenance. The operational cost per Van is $500 per month, which decreases by 2% for every $100 invested in maintenance. The operational cost per Bike is $100 per month, which decreases by 5% for every $100 invested in maintenance. The company aims to minimize the total operational cost over the next year. The company has a budget of $1,000,000 for vehicle purchases and maintenance. The company must purchase at least 50 Trucks and 100 Vans to meet contractual obligations. Please help the company to determine the optimal number of each type of vehicle to purchase and the optimal investment in maintenance to minimize the total operational cost over the next year.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=50)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=100)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nMaintenanceTruck = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceTruck\", lb=0)  # investment in Truck maintenance\nMaintenanceVan = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceVan\", lb=0)  # investment in Van maintenance\nMaintenanceBike = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceBike\", lb=0)  # investment in Bike maintenance\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total operational cost for Trucks: CostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)^2\n## Total operational cost for Vans: CostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)^2\n## Total operational cost for Bikes: CostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)^2\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nCostTruck = 12000 * Trucks * (1 - 0.0001 * MaintenanceTruck)\nCostVan = 6000 * Vans * (1 - 0.0002 * MaintenanceVan)\nCostBike = 1200 * Bikes * (1 - 0.0005 * MaintenanceBike)\nmodel.addCons(CostTruck * (1 - 0.0001 * MaintenanceTruck) == obj)\nmodel.addCons(CostVan * (1 - 0.0002 * MaintenanceVan) == obj)\nmodel.addCons(CostBike * (1 - 0.0005 * MaintenanceBike) == obj)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases and maintenance.\nmodel.addCons(Trucks + Vans + Bikes + MaintenanceTruck + MaintenanceVan + MaintenanceBike <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Truck maintenance: \", model.getVal(MaintenanceTruck))\n    print(\"Investment in Van maintenance: \", model.getVal(MaintenanceVan))\n    print(\"Investment in Bike maintenance: \", model.getVal(MaintenanceBike))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of Small trucks\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n// {\"number of Extra-Large trucks\": \"XL\", \"range\": \"XL >= 0\", \"type\": \"integer\"}\n// {\"number of Refrigerated trucks\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks.\n// Objective function: Minimize C_S + C_M + C_L + C_XL + C_R\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\n// 5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000",
        "question": "A logistics company operates five different types of trucks: Small, Medium, Large, Extra-Large, and Refrigerated. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. The cost of operating each type of truck varies and is influenced by the number of trucks in operation. The cost function for each type of truck is nonlinear and is given by:\n- Cost of Small truck: C_S = 1000 * S^0.7\n- Cost of Medium truck: C_M = 1500 * M^0.6\n- Cost of Large truck: C_L = 2000 * L^0.5\n- Cost of Extra-Large truck: C_XL = 2500 * XL^0.4\n- Cost of Refrigerated truck: C_R = 3000 * R^0.3\nThe company aims to minimize the total operating cost of all trucks. The company has a total fleet budget of $100,000 to spend on purchasing trucks. The purchase price for each type of truck is:\n- Small truck: $5,000\n- Medium truck: $7,500\n- Large truck: $10,000\n- Extra-Large truck: $12,500\n- Refrigerated truck: $15,000\nPlease help the company to determine the optimal number of each type of truck to minimize the total operating cost while staying within the fleet budget.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Small trucks\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of Medium trucks\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of Large trucks\nXL = model.addVar(vtype=\"INTEGER\", name=\"XL\", lb=0) # number of Extra-Large trucks\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of Refrigerated trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Cost functions\nC_S = 1000 * S**0.7\nC_M = 1500 * M**0.6\nC_L = 2000 * L**0.5\nC_XL = 2500 * XL**0.4\nC_R = 3000 * R**0.3\n\n## the objective function is: Minimize C_S + C_M + C_L + C_XL + C_R\nmodel.addCons(obj == C_S + C_M + C_L + C_XL + C_R)\n\n# Add constraints\n## The company has a total fleet budget of $100,000 to spend on purchasing trucks.\nmodel.addCons(5000 * S + 7500 * M + 10000 * L + 12500 * XL + 15000 * R <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small trucks: \", model.getVal(S))\n    print(\"Number of Medium trucks: \", model.getVal(M))\n    print(\"Number of Large trucks: \", model.getVal(L))\n    print(\"Number of Extra-Large trucks: \", model.getVal(XL))\n    print(\"Number of Refrigerated trucks: \", model.getVal(R))\n    print(\"Minimized Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device has a different profit margin and production cost. Device A has a profit margin of $50 per unit and a production cost of $20 per unit. Device B has a profit margin of $70 per unit and a production cost of $30 per unit. Device C has a profit margin of $90 per unit and a production cost of $40 per unit. Device D has a profit margin of $110 per unit and a production cost of $50 per unit. The company aims to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// Profit of D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 200 hours. The production time for each device is as follows: Device A takes 2 hours, Device B takes 3 hours, Device C takes 4 hours, and Device D takes 5 hours.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 200\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of electronic devices: A, B, C, and D. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit margin, production cost, and production time for each device are given in the following Table.\n\n| Device | Profit Margin | Production Cost | Production Time |\n|--------|---------------|-----------------|-----------------|\n| A      | $50           | $20             | 2 hours         |\n| B      | $70           | $30             | 3 hours         |\n| C      | $90           | $40             | 4 hours         |\n| D      | $110          | $50             | 5 hours         |\n\nThe company has a budget of $10,000 for production costs. The company has a limited production capacity of 200 hours. The company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C. \nPlease help the company to maximize the total profit, which is the sum of the profit margins minus the sum of the production costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of device D\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 10000)\n# The company has a limited production capacity of 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 200)\n# The company wants to ensure that the production of Device D does not exceed the combined production of Devices A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each with varying efficiency and capacity. The decision variables are the number of hours each unit operates.\n// {\"hours unit 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours unit 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours unit 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n// {\"hours unit 4 operates\": \"H4\", \"range\": \"H4 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from the production of components A, B, and C. The profit per unit of component A produced in unit 1 is $10, in unit 2 is $12, in unit 3 is $15, and in unit 4 is $18. For component B, the profits are $20, $22, $25, and $28 respectively. For component C, the profits are $30, $32, $35, and $40 respectively. The production rate (units per hour) for each component in each unit is different and is given as follows:\n- Unit 1: A = 5, B = 10, C = 15\n- Unit 2: A = 6, B = 12, C = 18\n- Unit 3: A = 7, B = 14, C = 21\n- Unit 4: A = 8, B = 16, C = 24\nThe objective is to maximize the total profit.\n// Profit from A = 10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4\n// Profit from B = 20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4\n// Profit from C = 30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4\n// Objective function: Maximize (10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4) + (20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4) + (30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4)\n\n## Generate Constraint-1:\nThe total operating hours for all units must not exceed 160 hours.\n// H1 + H2 + H3 + H4 <= 160\n\n## Generate Constraint-2:\nEach unit has a maximum capacity of 40 hours of operation.\n// H1 <= 40; H2 <= 40; H3 <= 40; H4 <= 40\n\n## Generate Constraint-3:\nThe demand for component A must be met, which is at least 1000 units.\n// 5 * H1 + 6 * H2 + 7 * H3 + 8 * H4 >= 1000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has four different production units, each with varying efficiency and capacity. The decision variables are the number of hours each unit operates. The company aims to maximize its profit from the production of components A, B, and C. The profit per unit of component A produced in unit 1 is $10, in unit 2 is $12, in unit 3 is $15, and in unit 4 is $18. For component B, the profits are $20, $22, $25, and $28 respectively. For component C, the profits are $30, $32, $35, and $40 respectively. The production rate (units per hour) for each component in each unit is different and is given as follows:\n- Unit 1: A = 5, B = 10, C = 15\n- Unit 2: A = 6, B = 12, C = 18\n- Unit 3: A = 7, B = 14, C = 21\n- Unit 4: A = 8, B = 16, C = 24\nThe total operating hours for all units must not exceed 160 hours. Each unit has a maximum capacity of 40 hours of operation. The demand for component A must be met, which is at least 1000 units.\nPlease help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours unit 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours unit 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours unit 3 operates\nH4 = model.addVar(vtype=\"CONTINUOUS\", name=\"H4\", lb=0) # hours unit 4 operates\n\n# Define objective function\n## The objective is to maximize the total profit.\nProfit_A = 10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4\nProfit_B = 20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4\nProfit_C = 30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4\n## Objective function: Maximize (10 * 5 * H1 + 12 * 6 * H2 + 15 * 7 * H3 + 18 * 8 * H4) + (20 * 10 * H1 + 22 * 12 * H2 + 25 * 14 * H3 + 28 * 16 * H4) + (30 * 15 * H1 + 32 * 18 * H2 + 35 * 21 * H3 + 40 * 24 * H4)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total operating hours for all units must not exceed 160 hours.\nmodel.addCons(H1 + H2 + H3 + H4 <= 160)\n## Each unit has a maximum capacity of 40 hours of operation.\nmodel.addCons(H1 <= 40)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 40)\nmodel.addCons(H4 <= 40)\n## The demand for component A must be met, which is at least 1000 units.\nmodel.addCons(5 * H1 + 6 * H2 + 7 * H3 + 8 * H4 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Unit 1 Operates: \", model.getVal(H1))\n    print(\"Hours Unit 2 Operates: \", model.getVal(H2))\n    print(\"Hours Unit 3 Operates: \", model.getVal(H3))\n    print(\"Hours Unit 4 Operates: \", model.getVal(H4))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1074,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location.\n// {\"number of solar panels at location 1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 4\": \"Solar4\", \"range\": \"Solar4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 4\": \"Wind4\", \"range\": \"Wind4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels at location 5\": \"Solar5\", \"range\": \"Solar5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines at location 5\": \"Wind5\", \"range\": \"Wind5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh.\n// Total cost: Cost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// Total energy generation: Energy = 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total annual energy generation must be at least 100,000 kWh.\n// 100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $100,000 for installation.\n// 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) <= 100000\n\n## Generate Constraint-3:\nThe number of solar panels at any location should not exceed the number of wind turbines by more than 5.\n// Solar1 - Wind1 <= 5\n// Solar2 - Wind2 <= 5\n// Solar3 - Wind3 <= 5\n// Solar4 - Wind4 <= 5\n// Solar5 - Wind5 <= 5",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines at five different locations. The decision variables are the number of solar panels and wind turbines to be installed at each location. The cost of installing a solar panel is $1000, and it generates 100 kWh of energy per year. The cost of installing a wind turbine is $2000, and it generates 200 kWh of energy per year. The company wants to minimize the total cost of installation while ensuring a minimum annual energy generation of 100,000 kWh.\n\n| Equipment | Cost per Unit | Energy Generation per Unit |\n|-----------|---------------|-----------------------------|\n| Solar Panel | $1000 | 100 kWh/year |\n| Wind Turbine | $2000 | 200 kWh/year |\n\nThe company has a budget of $100,000 for installation. The total annual energy generation must be at least 100,000 kWh. Additionally, the number of solar panels at any location should not exceed the number of wind turbines by more than 5.\n\nPlease help the company determine the optimal number of solar panels and wind turbines to install at each location to minimize the total cost of installation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels at location 1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of wind turbines at location 1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels at location 2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of wind turbines at location 2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels at location 3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of wind turbines at location 3\nSolar4 = model.addVar(vtype=\"INTEGER\", name=\"Solar4\", lb=0) # number of solar panels at location 4\nWind4 = model.addVar(vtype=\"INTEGER\", name=\"Wind4\", lb=0) # number of wind turbines at location 4\nSolar5 = model.addVar(vtype=\"INTEGER\", name=\"Solar5\", lb=0) # number of solar panels at location 5\nWind5 = model.addVar(vtype=\"INTEGER\", name=\"Wind5\", lb=0) # number of wind turbines at location 5\n\n# Define objective function\nCost = 1000 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 2000 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5)\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n## The total annual energy generation must be at least 100,000 kWh.\nmodel.addCons(100 * (Solar1 + Solar2 + Solar3 + Solar4 + Solar5) + 200 * (Wind1 + Wind2 + Wind3 + Wind4 + Wind5) >= 100000)\n## The company has a budget of $100,000 for installation.\nmodel.addCons(Cost <= 100000)\n## The number of solar panels at any location should not exceed the number of wind turbines by more than 5.\nmodel.addCons(Solar1 - Wind1 <= 5)\nmodel.addCons(Solar2 - Wind2 <= 5)\nmodel.addCons(Solar3 - Wind3 <= 5)\nmodel.addCons(Solar4 - Wind4 <= 5)\nmodel.addCons(Solar5 - Wind5 <= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels at Location 1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines at Location 1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels at Location 2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines at Location 2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels at Location 3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines at Location 3: \", model.getVal(Wind3))\n    print(\"Number of Solar Panels at Location 4: \", model.getVal(Solar4))\n    print(\"Number of Wind Turbines at Location 4: \", model.getVal(Wind4))\n    print(\"Number of Solar Panels at Location 5: \", model.getVal(Solar5))\n    print(\"Number of Wind Turbines at Location 5: \", model.getVal(Wind5))\n    print(\"Total Installation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The goal is to minimize the total operational cost while considering the environmental impact and route capacities.\n// {\"number of trucks of type 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technology for type 1 trucks\": \"Tech1\", \"range\": \"Tech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for type 2 trucks\": \"Tech2\", \"range\": \"Tech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technology for type 3 trucks\": \"Tech3\", \"range\": \"Tech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. The cost function for each truck type is modeled as a quadratic function where the cost per mile decreases as more technology is invested.\nThe initial cost per mile for type 1 trucks is $0.8, and it decreases by $0.01 for every $100 invested in technology.\nThe initial cost per mile for type 2 trucks is $0.7, and it decreases by $0.012 for every $100 invested in technology.\nThe initial cost per mile for type 3 trucks is $0.6, and it decreases by $0.015 for every $100 invested in technology.\nThe company aims to minimize the total operational cost across all truck types.\n// Total cost for type 1 trucks: Cost1 = (0.8 - 0.0001 * Tech1) * Trucks1\n// Total cost for type 2 trucks: Cost2 = (0.7 - 0.00012 * Tech2) * Trucks2\n// Total cost for type 3 trucks: Cost3 = (0.6 - 0.00015 * Tech3) * Trucks3\n// So, the objective function is: Minimize (Cost1 + Cost2 + Cost3)\n\n## Generate Constraint-1:\nThe total budget for investing in fuel-efficient technologies and operating the fleet is $100,000.\n// Tech1 + Tech2 + Tech3 + (0.8 * Trucks1) + (0.7 * Trucks2) + (0.6 * Trucks3) <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the allocation of trucks to various routes and the investment in fuel-efficient technologies for each truck type. The goal is to minimize the total operational cost while considering the environmental impact and route capacities. The operational cost of each truck type decreases nonlinearly with the investment in fuel-efficient technology. The cost function for each truck type is modeled as a quadratic function where the cost per mile decreases as more technology is invested. The initial cost per mile and the rate at which it decreases with technology investment for each truck type are given in the following Table.\n\n| Truck Type | Initial Cost per Mile | Decrease per $100 Investment |\n|------------|-----------------------|------------------------------|\n| Type 1     | $0.8                  | $0.01                        |\n| Type 2     | $0.7                  | $0.012                       |\n| Type 3     | $0.6                  | $0.015                       |\n\nThe company aims to minimize the total operational cost across all truck types. The total budget for investing in fuel-efficient technologies and operating the fleet is $100,000. Please help the company to determine the optimal number of trucks of each type and the investment in fuel-efficient technology for each type to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks of type 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks of type 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks of type 3\nTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech1\", lb=0)  # investment in fuel-efficient technology for type 1 trucks\nTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech2\", lb=0)  # investment in fuel-efficient technology for type 2 trucks\nTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tech3\", lb=0)  # investment in fuel-efficient technology for type 3 trucks\n\n# Define objective function\nCost1 = (0.8 - 0.0001 * Tech1) * Trucks1\nCost2 = (0.7 - 0.00012 * Tech2) * Trucks2\nCost3 = (0.6 - 0.00015 * Tech3) * Trucks3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2 + Cost3)\n\n# Add constraints\nmodel.addCons(Tech1 + Tech2 + Tech3 + (0.8 * Trucks1) + (0.7 * Trucks2) + (0.6 * Trucks3) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks Type 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks Type 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks Type 3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech1: \", model.getVal(Tech1))\n    print(\"Investment in Tech2: \", model.getVal(Tech2))\n    print(\"Investment in Tech3: \", model.getVal(Tech3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1456,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Small truck\": \"SmallTrips\", \"range\": \"SmallTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Medium truck\": \"MediumTrips\", \"range\": \"MediumTrips >= 0\", \"type\": \"integer\"}\n// {\"number of trips per Large truck\": \"LargeTrips\", \"range\": \"LargeTrips >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency upgrade for Small trucks\": \"FuelUpgradeSmall\", \"range\": \"FuelUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Medium trucks\": \"FuelUpgradeMedium\", \"range\": \"FuelUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency upgrade for Large trucks\": \"FuelUpgradeLarge\", \"range\": \"FuelUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost per trip decreases with the investment in fuel efficiency upgrades. For Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost for Small trucks: CostSmall = 200 - 0.05 * FuelUpgradeSmall * SmallTrucks * SmallTrips\n// Total operational cost for Medium trucks: CostMedium = 300 - 0.07 * FuelUpgradeMedium * MediumTrucks * MediumTrips\n// Total operational cost for Large trucks: CostLarge = 400 - 0.09 * FuelUpgradeLarge * LargeTrucks * LargeTrips\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\n// SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000",
        "question": "A logistics company operates three types of trucks: Small, Medium, and Large, each with different capacities and operational costs. The company needs to determine the number of each type of truck to purchase and the number of trips each truck will make to optimize its logistics operations. The company also needs to decide on the level of fuel efficiency upgrades for each type of truck, which will affect the operational cost per trip.\nFor Small trucks, the initial cost per trip is $200, and it decreases by $5 for every $100 invested in fuel efficiency. For Medium trucks, the initial cost per trip is $300, and it decreases by $7 for every $100 invested in fuel efficiency. For Large trucks, the initial cost per trip is $400, and it decreases by $9 for every $100 invested in fuel efficiency. The company aims to minimize the total operational cost of all trucks.\nThe company has a budget of $100,000 for purchasing trucks and fuel efficiency upgrades.\nPlease help the company to determine the optimal number of each type of truck to purchase, the number of trips each truck should make, and the level of fuel efficiency upgrades to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSmallTrips = model.addVar(vtype=\"INTEGER\", name=\"SmallTrips\", lb=0)\nMediumTrips = model.addVar(vtype=\"INTEGER\", name=\"MediumTrips\", lb=0)\nLargeTrips = model.addVar(vtype=\"INTEGER\", name=\"LargeTrips\", lb=0)\nFuelUpgradeSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeSmall\", lb=0)\nFuelUpgradeMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeMedium\", lb=0)\nFuelUpgradeLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelUpgradeLarge\", lb=0)\n\n# Define objective function\nCostSmall = (200 - 0.05 * FuelUpgradeSmall) * SmallTrucks * SmallTrips\nCostMedium = (300 - 0.07 * FuelUpgradeMedium) * MediumTrucks * MediumTrips\nCostLarge = (400 - 0.09 * FuelUpgradeLarge) * LargeTrucks * LargeTrips\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + FuelUpgradeSmall + FuelUpgradeMedium + FuelUpgradeLarge <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Number of Trips per Small Truck: \", model.getVal(SmallTrips))\n    print(\"Number of Trips per Medium Truck: \", model.getVal(MediumTrips))\n    print(\"Number of Trips per Large Truck: \", model.getVal(LargeTrips))\n    print(\"Fuel Efficiency Upgrade for Small Trucks: \", model.getVal(FuelUpgradeSmall))\n    print(\"Fuel Efficiency Upgrade for Medium Trucks: \", model.getVal(FuelUpgradeMedium))\n    print(\"Fuel Efficiency Upgrade for Large Trucks: \", model.getVal(FuelUpgradeLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH). The developer needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values.\n// {\"number of Luxury Villas\": \"LV\", \"range\": \"LV >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-Range Apartments\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable Homes\": \"AH\", \"range\": \"AH >= 0\", \"type\": \"integer\"}\n// {\"investment in landscaping\": \"Landscaping\", \"range\": \"Landscaping >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer aims to maximize the total value of all properties.\n// Value_LV = 500000 + 10 * Landscaping * LV\n// Value_MA = 300000 + 5 * Landscaping * MA\n// Value_AH = 150000 + 2 * Landscaping * AH\n// So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\n\n## Generate Constraint-1:\nThe developer has a budget of $1,000,000 for construction and landscaping.\n// 500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000\n\n## Generate Constraint-2:\nThe total area available for construction is limited to 100,000 square meters. Each Luxury Villa requires 1,000 square meters, each Mid-Range Apartment requires 500 square meters, and each Affordable Home requires 200 square meters.\n// 1000 * LV + 500 * MA + 200 * AH <= 100000\n\n## Generate Constraint-3:\nThe developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\n// LV >= 5; MA >= 10\n\n## Generate Constraint-4:\nDue to market demand, the number of Affordable Homes cannot exceed 50.\n// AH <= 50\n\n## Generate Constraint-5:\nThe investment in landscaping cannot exceed 20% of the total construction budget.\n// Landscaping <= 0.2 * (500000 * LV + 300000 * MA + 150000 * AH)",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury Villas (LV), Mid-Range Apartments (MA), and Affordable Homes (AH), and needs to determine the number of each type of property to build, as well as the amount of money to invest in landscaping to enhance the property values. The value of Luxury Villas increases by $10,000 for every $1,000 invested in landscaping, with an initial value of $500,000 per unit. Mid-Range Apartments increase in value by $5,000 for every $1,000 invested in landscaping, with an initial value of $300,000 per unit. Affordable Homes increase in value by $2,000 for every $1,000 invested in landscaping, with an initial value of $150,000 per unit. The developer has a budget of $1,000,000 for construction and landscaping. The total area available for construction is limited to 100,000 square meters, with each Luxury Villa requiring 1,000 square meters, each Mid-Range Apartment requiring 500 square meters, and each Affordable Home requiring 200 square meters. The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments. Due to market demand, the number of Affordable Homes cannot exceed 50. The investment in landscaping cannot exceed 20% of the total construction budget. Please help the developer maximize the total value of all properties.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLV = model.addVar(vtype=\"INTEGER\", name=\"LV\", lb=5)  # number of Luxury Villas\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10)  # number of Mid-Range Apartments\nAH = model.addVar(vtype=\"INTEGER\", name=\"AH\", lb=0, ub=50)  # number of Affordable Homes\nLandscaping = model.addVar(vtype=\"CONTINUOUS\", name=\"Landscaping\", lb=0)  # investment in landscaping\n\n# Define objective function\nValue_LV = 500000 + 10 * Landscaping * LV\nValue_MA = 300000 + 5 * Landscaping * MA\nValue_AH = 150000 + 2 * Landscaping * AH\n# So, the objective function is: Maximize (Value_LV + Value_MA + Value_AH)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value_LV + Value_MA + Value_AH)\n\n# Add constraints\n# The developer has a budget of $1,000,000 for construction and landscaping.\nmodel.addCons(500000 * LV + 300000 * MA + 150000 * AH + Landscaping <= 1000000)\n# The total area available for construction is limited to 100,000 square meters.\nmodel.addCons(1000 * LV + 500 * MA + 200 * AH <= 100000)\n# The developer must build at least 5 Luxury Villas and 10 Mid-Range Apartments.\nmodel.addCons(LV >= 5)\nmodel.addCons(MA >= 10)\n# Due to market demand, the number of Affordable Homes cannot exceed 50.\nmodel.addCons(AH <= 50)\n# The investment in landscaping cannot exceed 20% of the total construction budget.\nmodel.addCons(Landscaping <= 0.2 * (500000 * LV + 300000 * MA + 150000 * AH))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Villas: \", model.getVal(LV))\n    print(\"Number of Mid-Range Apartments: \", model.getVal(MA))\n    print(\"Number of Affordable Homes: \", model.getVal(AH))\n    print(\"Investment in Landscaping: \", model.getVal(Landscaping))\n    print(\"Total Property Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1332,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region. Additionally, the company needs to decide on the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines, which will affect the energy output and cost of each installation.\n// {\"number of solar panels in Region1\": \"Solar1\", \"range\": \"Solar1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"Wind1\", \"range\": \"Wind1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region2\": \"Solar2\", \"range\": \"Solar2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"Wind2\", \"range\": \"Wind2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region3\": \"Solar3\", \"range\": \"Solar3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"Wind3\", \"range\": \"Wind3 >= 0\", \"type\": \"integer\"}\n// {\"investment in R&D for solar panels\": \"RDSolar\", \"range\": \"RDSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in R&D for wind turbines\": \"RDWind\", \"range\": \"RDWind >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output of solar panels and wind turbines increases nonlinearly with the investment in R&D. For every $100,000 invested in R&D for solar panels, the energy output increases by 5% per panel. For every $100,000 invested in R&D for wind turbines, the energy output increases by 8% per turbine. The company aims to maximize the total energy output from all installations.\n// Total energy output for solar panels in Region1: EnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region1: EnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region2: EnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region2: EnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\n// Total energy output for solar panels in Region3: EnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\n// Total energy output for wind turbines in Region3: EnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n// So, the objective function is: Maximize (EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for R&D investments.\n// RDSolar + RDWind <= 200000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\n// Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions: Region1, Region2, and Region3. The company needs to determine the number of solar panels and wind turbines to be installed in each region, as well as the investment amount($) in research and development (R&D) to improve the efficiency of both solar panels and wind turbines. The investment in R&D affects the energy output and cost of each installation. The company aims to maximize the total energy output from all installations.\n\nThe energy output of solar panels and wind turbines increases nonlinearly with the investment in R&D. For every $100,000 invested in R&D for solar panels, the energy output increases by 5% per panel. For every $100,000 invested in R&D for wind turbines, the energy output increases by 8% per turbine.\n\nThe company has a total budget of $200,000 for R&D investments. The total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\n\nPlease help the company to determine the optimal number of solar panels and wind turbines to be installed in each region and the optimal investment in R&D to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar1 = model.addVar(vtype=\"INTEGER\", name=\"Solar1\", lb=0) # number of solar panels in Region1\nWind1 = model.addVar(vtype=\"INTEGER\", name=\"Wind1\", lb=0) # number of wind turbines in Region1\nSolar2 = model.addVar(vtype=\"INTEGER\", name=\"Solar2\", lb=0) # number of solar panels in Region2\nWind2 = model.addVar(vtype=\"INTEGER\", name=\"Wind2\", lb=0) # number of wind turbines in Region2\nSolar3 = model.addVar(vtype=\"INTEGER\", name=\"Solar3\", lb=0) # number of solar panels in Region3\nWind3 = model.addVar(vtype=\"INTEGER\", name=\"Wind3\", lb=0) # number of wind turbines in Region3\nRDSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"RDSolar\", lb=0) # investment in R&D for solar panels\nRDWind = model.addVar(vtype=\"CONTINUOUS\", name=\"RDWind\", lb=0) # investment in R&D for wind turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergySolar1 = Solar1 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind1 = Wind1 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar2 = Solar2 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind2 = Wind2 * (1 + 0.08 * (RDWind / 100000))\nEnergySolar3 = Solar3 * (1 + 0.05 * (RDSolar / 100000))\nEnergyWind3 = Wind3 * (1 + 0.08 * (RDWind / 100000))\n## the objective function is: Maximize (EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\nmodel.addCons(obj == EnergySolar1 + EnergyWind1 + EnergySolar2 + EnergyWind2 + EnergySolar3 + EnergyWind3)\n\n# Add constraints\n## The company has a total budget of $200,000 for R&D investments.\nmodel.addCons(RDSolar + RDWind <= 200000)\n## The total number of solar panels and wind turbines that can be installed across all regions is limited to 1,000 units.\nmodel.addCons(Solar1 + Wind1 + Solar2 + Wind2 + Solar3 + Wind3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(Solar1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(Wind1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(Solar2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(Wind2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(Solar3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(Wind3))\n    print(\"Investment in R&D for Solar Panels: \", model.getVal(RDSolar))\n    print(\"Investment in R&D for Wind Turbines: \", model.getVal(RDWind))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1218,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different operational cost and efficiency. Truck A has an operational cost of $1000 per month and can transport 1000 units of goods. Truck B has an operational cost of $1500 per month and can transport 1500 units of goods. Truck C has an operational cost of $2000 per month and can transport 2000 units of goods. Truck D has an operational cost of $2500 per month and can transport 2500 units of goods. Truck E has an operational cost of $3000 per month and can transport 3000 units of goods. The company aims to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks.\n// Efficiency of Truck A: Eff_A = 1000 * A / 1000\n// Efficiency of Truck B: Eff_B = 1500 * B / 1500\n// Efficiency of Truck C: Eff_C = 2000 * C / 2000\n// Efficiency of Truck D: Eff_D = 2500 * D / 2500\n// Efficiency of Truck E: Eff_E = 3000 * E / 3000\n// So, the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for truck operations next month.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000\n\n## Generate Constraint-2:\nThe company has a total of 10 trucks available for deployment.\n// A + B + C + D + E <= 10\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 2 trucks of each type are deployed.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-4:\nThe total transport capacity should not exceed 15,000 units of goods.\n// 1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 15000\n\n## Generate Constraint-5:\nThe company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\n// E <= A + B + C",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to decide how many of each type of truck to deploy for the upcoming month. The operational cost and transport capacity for each type of truck are given in the following Table.\n\n| Truck Type | Operational Cost per Month | Transport Capacity |\n|------------|----------------------------|--------------------|\n| Truck A    | $1000                      | 1000 units         |\n| Truck B    | $1500                      | 1500 units         |\n| Truck C    | $2000                      | 2000 units         |\n| Truck D    | $2500                      | 2500 units         |\n| Truck E    | $3000                      | 3000 units         |\n\nThe company has a budget of $10,000 for truck operations next month. The company has a total of 10 trucks available for deployment. The company wants to ensure that at least 2 trucks of each type are deployed. The total transport capacity should not exceed 15,000 units of goods. The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C. \n\nPlease help the company to maximize the total transport efficiency (units of goods transported per dollar spent) across all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2)  # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2)  # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2)  # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0)  # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0)  # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEff_A = 1000 * A / 1000\nEff_B = 1500 * B / 1500\nEff_C = 2000 * C / 2000\nEff_D = 2500 * D / 2500\nEff_E = 3000 * E / 3000\n## the objective function is: Maximize (Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n## convert the division to multiplication\nmodel.addCons(obj == Eff_A + Eff_B + Eff_C + Eff_D + Eff_E)\n\n# Add constraints\n## The company has a budget of $10,000 for truck operations next month.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 10000)\n## The company has a total of 10 trucks available for deployment.\nmodel.addCons(A + B + C + D + E <= 10)\n## The company wants to ensure that at least 2 trucks of each type are deployed.\nmodel.addCons(A >= 2)\nmodel.addCons(B >= 2)\nmodel.addCons(C >= 2)\n## The total transport capacity should not exceed 15,000 units of goods.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C + 2500 * D + 3000 * E <= 15000)\n## The company wants to ensure that the number of Truck E does not exceed the combined number of Trucks A, B, and C.\nmodel.addCons(E <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Maximized Transport Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1290,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\n// {\"number of Refrigerated trucks\": \"RefrigeratedTrucks\", \"range\": \"RefrigeratedTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Heavy trucks\": \"HeavyTrucks\", \"range\": \"HeavyTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Standard trucks\": \"StandardTrucks\", \"range\": \"StandardTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Refrigerated trucks\": \"RefrigeratedDrivers\", \"range\": \"RefrigeratedDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Heavy trucks\": \"HeavyDrivers\", \"range\": \"HeavyDrivers >= 0\", \"type\": \"integer\"}\n// {\"number of drivers for Standard trucks\": \"StandardDrivers\", \"range\": \"StandardDrivers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption.\n// TotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\n// TotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n// So, the objective function is: Maximize TotalRevenue / TotalFuelConsumption\n\n## Generate Constraint-1:\nThe company has a budget of $10 million for purchasing trucks.\n// 100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000\n\n## Generate Constraint-2:\nThe company has a total of 500 drivers available.\n// RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500",
        "question": "A logistics company is planning its fleet expansion and needs to decide the number of trucks to purchase for three different types of cargo (Refrigerated, Heavy, and Standard). The company also needs to determine the number of drivers to assign to each type of truck.\nFor Refrigerated trucks, the cost per truck is $100,000, the revenue per trip is $2,000, and the fuel consumption per trip is 100 liters.\nFor Heavy trucks, the cost per truck is $150,000, the revenue per trip is $3,000, and the fuel consumption per trip is 150 liters.\nFor Standard trucks, the cost per truck is $50,000, the revenue per trip is $1,000, and the fuel consumption per trip is 50 liters.\nThe company has a budget of $10 million for purchasing trucks. The company has a total of 500 drivers available.\nThe company wants to maximize the Profit-to-Fuel ratio, where the Profit-to-Fuel ratio is defined as the total revenue divided by the total fuel consumption. Please help the company determine the optimal number of trucks and drivers for each type of cargo to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRefrigeratedTrucks = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedTrucks\", lb=0)\nHeavyTrucks = model.addVar(vtype=\"INTEGER\", name=\"HeavyTrucks\", lb=0)\nStandardTrucks = model.addVar(vtype=\"INTEGER\", name=\"StandardTrucks\", lb=0)\nRefrigeratedDrivers = model.addVar(vtype=\"INTEGER\", name=\"RefrigeratedDrivers\", lb=0)\nHeavyDrivers = model.addVar(vtype=\"INTEGER\", name=\"HeavyDrivers\", lb=0)\nStandardDrivers = model.addVar(vtype=\"INTEGER\", name=\"StandardDrivers\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nTotalRevenue = 2000 * RefrigeratedTrucks * RefrigeratedDrivers + 3000 * HeavyTrucks * HeavyDrivers + 1000 * StandardTrucks * StandardDrivers\nTotalFuelConsumption = 100 * RefrigeratedTrucks * RefrigeratedDrivers + 150 * HeavyTrucks * HeavyDrivers + 50 * StandardTrucks * StandardDrivers\n## convert the division to multiplication\nmodel.addCons(obj * TotalFuelConsumption == TotalRevenue)\n\n# Add constraints\n## The company has a budget of $10 million for purchasing trucks.\nmodel.addCons(100000 * RefrigeratedTrucks + 150000 * HeavyTrucks + 50000 * StandardTrucks <= 10000000)\n## The company has a total of 500 drivers available.\nmodel.addCons(RefrigeratedDrivers + HeavyDrivers + StandardDrivers <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Refrigerated Trucks: \", model.getVal(RefrigeratedTrucks))\n    print(\"Number of Heavy Trucks: \", model.getVal(HeavyTrucks))\n    print(\"Number of Standard Trucks: \", model.getVal(StandardTrucks))\n    print(\"Number of Drivers for Refrigerated Trucks: \", model.getVal(RefrigeratedDrivers))\n    print(\"Number of Drivers for Heavy Trucks: \", model.getVal(HeavyDrivers))\n    print(\"Number of Drivers for Standard Trucks: \", model.getVal(StandardDrivers))\n    print(\"Maximized Profit-to-Fuel Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of M1 machines\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of M2 machines\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of M3 machines\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of M4 machines\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for M1 is $500, for M2 is $700, for M3 is $900, and for M4 is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each machine type is given by: Cost_M1 = 200 + 0.01 * M1^2, Cost_M2 = 300 + 0.015 * M2^2, Cost_M3 = 400 + 0.02 * M3^2, Cost_M4 = 500 + 0.025 * M4^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost.\n// Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n// Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n// Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n// Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n// So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 machines for the quarter.\n// M1 + M2 + M3 + M4 <= 500\n\n## Generate Constraint-2:\nThe market demand for M1 and M2 combined should not exceed 300 units.\n// M1 + M2 <= 300\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\n// M3 + M4 <= 200",
        "question": "A manufacturing company produces four types of machines: M1, M2, M3, and M4. The company needs to determine the optimal number of each machine type to produce in the next quarter to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for M1 is $500, for M2 is $700, for M3 is $900, and for M4 is $1100. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function for each machine type is given by: Cost_M1 = 200 + 0.01 * M1^2, Cost_M2 = 300 + 0.015 * M2^2, Cost_M3 = 400 + 0.02 * M3^2, Cost_M4 = 500 + 0.025 * M4^2. The company aims to maximize the total profit, which is the difference between the total revenue and the total production cost. The company has a total production capacity of 500 machines for the quarter. The market demand for M1 and M2 combined should not exceed 300 units. The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of M1 machines\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of M2 machines\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of M3 machines\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of M4 machines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for M1: Profit_M1 = (500 - Cost_M1) * M1 = (500 - (200 + 0.01 * M1^2)) * M1\n## Total profit for M2: Profit_M2 = (700 - Cost_M2) * M2 = (700 - (300 + 0.015 * M2^2)) * M2\n## Total profit for M3: Profit_M3 = (900 - Cost_M3) * M3 = (900 - (400 + 0.02 * M3^2)) * M3\n## Total profit for M4: Profit_M4 = (1100 - Cost_M4) * M4 = (1100 - (500 + 0.025 * M4^2)) * M4\n## So, the objective function is: Maximize (Profit_M1 + Profit_M2 + Profit_M3 + Profit_M4)\nmodel.addCons(obj == ((500 - (200 + 0.01 * M1**2)) * M1 +\n                      (700 - (300 + 0.015 * M2**2)) * M2 +\n                      (900 - (400 + 0.02 * M3**2)) * M3 +\n                      (1100 - (500 + 0.025 * M4**2)) * M4))\n\n# Add constraints\n## The company has a total production capacity of 500 machines for the quarter.\nmodel.addCons(M1 + M2 + M3 + M4 <= 500)\n## The market demand for M1 and M2 combined should not exceed 300 units.\nmodel.addCons(M1 + M2 <= 300)\n## The company has a limited budget for raw materials, which restricts the production of M3 and M4 to a maximum of 200 units combined.\nmodel.addCons(M3 + M4 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of M1 Machines: \", model.getVal(M1))\n    print(\"Number of M2 Machines: \", model.getVal(M2))\n    print(\"Number of M3 Machines: \", model.getVal(M3))\n    print(\"Number of M4 Machines: \", model.getVal(M4))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste.\n// {\"number of solar panels in Region1\": \"SolarPanels1\", \"range\": \"SolarPanels1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region1\": \"WindTurbines1\", \"range\": \"WindTurbines1 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region1\": \"Storage1\", \"range\": \"Storage1 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region2\": \"SolarPanels2\", \"range\": \"SolarPanels2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region2\": \"WindTurbines2\", \"range\": \"WindTurbines2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region2\": \"Storage2\", \"range\": \"Storage2 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region3\": \"SolarPanels3\", \"range\": \"SolarPanels3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region3\": \"WindTurbines3\", \"range\": \"WindTurbines3 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region3\": \"Storage3\", \"range\": \"Storage3 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region4\": \"SolarPanels4\", \"range\": \"SolarPanels4 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region4\": \"WindTurbines4\", \"range\": \"WindTurbines4 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region4\": \"Storage4\", \"range\": \"Storage4 >= 0\", \"type\": \"continuous\"}\n// {\"number of solar panels in Region5\": \"SolarPanels5\", \"range\": \"SolarPanels5 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region5\": \"WindTurbines5\", \"range\": \"WindTurbines5 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage in Region5\": \"Storage5\", \"range\": \"Storage5 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from solar panels and wind turbines is affected by the investment in energy storage systems. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions.\n// Total energy output from Region1: Output1 = (SolarPanels1 * (100 + 0.1 * Storage1^2)) + (WindTurbines1 * (200 + 0.2 * Storage1^3))\n// Total energy output from Region2: Output2 = (SolarPanels2 * (100 + 0.1 * Storage2^2)) + (WindTurbines2 * (200 + 0.2 * Storage2^3))\n// Total energy output from Region3: Output3 = (SolarPanels3 * (100 + 0.1 * Storage3^2)) + (WindTurbines3 * (200 + 0.2 * Storage3^3))\n// Total energy output from Region4: Output4 = (SolarPanels4 * (100 + 0.1 * Storage4^2)) + (WindTurbines4 * (200 + 0.2 * Storage4^3))\n// Total energy output from Region5: Output5 = (SolarPanels5 * (100 + 0.1 * Storage5^2)) + (WindTurbines5 * (200 + 0.2 * Storage5^3))\n// So, the objective function is: Maximize (Output1 + Output2 + Output3 + Output4 + Output5)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all installations and storage investments.\n// SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1,000,000\n\n## Generate Constraint-2:\nThe total number of solar panels and wind turbines across all regions must not exceed 10,000 units.\n// SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10,000\n\n## Generate Constraint-3:\nDue to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1.\n// WindTurbines1 >= 2 * SolarPanels1\n\n## Generate Constraint-4:\nThe company must ensure that each region has at least one solar panel and one wind turbine.\n// SolarPanels1 >= 1; WindTurbines1 >= 1; SolarPanels2 >= 1; WindTurbines2 >= 1; SolarPanels3 >= 1; WindTurbines3 >= 1; SolarPanels4 >= 1; WindTurbines4 >= 1; SolarPanels5 >= 1; WindTurbines5 >= 1",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in five different regions: Region1, Region2, Region3, Region4, and Region5. The company needs to determine the number of solar panels and wind turbines to install in each region, as well as the investment in energy storage systems to optimize energy output and reduce waste. The energy output from solar panels is modeled as a quadratic function of the storage investment, and the energy output from wind turbines is modeled as a cubic function of the storage investment. The company aims to maximize the total energy output from all regions. The company has a total budget of $1,000,000 for all installations and storage investments. The total number of solar panels and wind turbines across all regions must not exceed 10,000 units. Due to regional regulations, the number of wind turbines in Region1 must be at least twice the number of solar panels in Region1. The company must ensure that each region has at least one solar panel and one wind turbine. Please help the company to maximize the total energy output from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0)\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0)\nStorage1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage1\", lb=0)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=0)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=0)\nStorage2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage2\", lb=0)\nSolarPanels3 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels3\", lb=0)\nWindTurbines3 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines3\", lb=0)\nStorage3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage3\", lb=0)\nSolarPanels4 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels4\", lb=0)\nWindTurbines4 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines4\", lb=0)\nStorage4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage4\", lb=0)\nSolarPanels5 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels5\", lb=0)\nWindTurbines5 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines5\", lb=0)\nStorage5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Storage5\", lb=0)\n\n# Define objective function\nOutput1 = SolarPanels1 * (100 + 0.1 * Storage1**2) + WindTurbines1 * (200 + 0.2 * Storage1**3)\nOutput2 = SolarPanels2 * (100 + 0.1 * Storage2**2) + WindTurbines2 * (200 + 0.2 * Storage2**3)\nOutput3 = SolarPanels3 * (100 + 0.1 * Storage3**2) + WindTurbines3 * (200 + 0.2 * Storage3**3)\nOutput4 = SolarPanels4 * (100 + 0.1 * Storage4**2) + WindTurbines4 * (200 + 0.2 * Storage4**3)\nOutput5 = SolarPanels5 * (100 + 0.1 * Storage5**2) + WindTurbines5 * (200 + 0.2 * Storage5**3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output1 + Output2 + Output3 + Output4 + Output5)\n\n# Add constraints\nmodel.addCons(SolarPanels1 + WindTurbines1 + Storage1 + SolarPanels2 + WindTurbines2 + Storage2 + SolarPanels3 + WindTurbines3 + Storage3 + SolarPanels4 + WindTurbines4 + Storage4 + SolarPanels5 + WindTurbines5 + Storage5 <= 1000000)\nmodel.addCons(SolarPanels1 + SolarPanels2 + SolarPanels3 + SolarPanels4 + SolarPanels5 + WindTurbines1 + WindTurbines2 + WindTurbines3 + WindTurbines4 + WindTurbines5 <= 10000)\nmodel.addCons(WindTurbines1 >= 2 * SolarPanels1)\nmodel.addCons(SolarPanels1 >= 1)\nmodel.addCons(WindTurbines1 >= 1)\nmodel.addCons(SolarPanels2 >= 1)\nmodel.addCons(WindTurbines2 >= 1)\nmodel.addCons(SolarPanels3 >= 1)\nmodel.addCons(WindTurbines3 >= 1)\nmodel.addCons(SolarPanels4 >= 1)\nmodel.addCons(WindTurbines4 >= 1)\nmodel.addCons(SolarPanels5 >= 1)\nmodel.addCons(WindTurbines5 >= 1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region1: \", model.getVal(SolarPanels1))\n    print(\"Number of Wind Turbines in Region1: \", model.getVal(WindTurbines1))\n    print(\"Investment in Storage in Region1: \", model.getVal(Storage1))\n    print(\"Number of Solar Panels in Region2: \", model.getVal(SolarPanels2))\n    print(\"Number of Wind Turbines in Region2: \", model.getVal(WindTurbines2))\n    print(\"Investment in Storage in Region2: \", model.getVal(Storage2))\n    print(\"Number of Solar Panels in Region3: \", model.getVal(SolarPanels3))\n    print(\"Number of Wind Turbines in Region3: \", model.getVal(WindTurbines3))\n    print(\"Investment in Storage in Region3: \", model.getVal(Storage3))\n    print(\"Number of Solar Panels in Region4: \", model.getVal(SolarPanels4))\n    print(\"Number of Wind Turbines in Region4: \", model.getVal(WindTurbines4))\n    print(\"Investment in Storage in Region4: \", model.getVal(Storage4))\n    print(\"Number of Solar Panels in Region5: \", model.getVal(SolarPanels5))\n    print(\"Number of Wind Turbines in Region5: \", model.getVal(WindTurbines5))\n    print(\"Investment in Storage in Region5: \", model.getVal(Storage5))\n    print(\"Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 15,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential.\n// {\"number of solar panels in Urban zone\": \"Urban\", \"range\": \"Urban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Suburban zone\": \"Suburban\", \"range\": \"Suburban >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Industrial zone\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Commercial zone\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Residential zone\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by district due to different sun exposure and building heights. In Urban, the efficiency is 80%, in Suburban it's 90%, in Industrial it's 75%, in Commercial it's 85%, and in Residential it's 95%. The cost of installation per panel also varies: $1000 in Urban, $900 in Suburban, $1100 in Industrial, $1050 in Commercial, and $850 in Residential. The city aims to maximize the energy output per dollar spent.\n// Energy_Urban = 0.8 * Urban\n// Energy_Suburban = 0.9 * Suburban\n// Energy_Industrial = 0.75 * Industrial\n// Energy_Commercial = 0.85 * Commercial\n// Energy_Residential = 0.95 * Residential\n// Cost_Urban = 1000 * Urban\n// Cost_Suburban = 900 * Suburban\n// Cost_Industrial = 1100 * Industrial\n// Cost_Commercial = 1050 * Commercial\n// Cost_Residential = 850 * Residential\n// So, the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n\n## Generate Constraint-1:\nThe city has a budget of $500,000 for the installation of solar panels.\n// 1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000\n\n## Generate Constraint-2:\nThere is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\n// Urban <= 500\n// Suburban <= 600\n// Industrial <= 400\n// Commercial <= 550\n// Residential <= 700",
        "question": "A city is planning to install solar panels on rooftops across different districts to optimize energy production. The districts are categorized into five zones: Urban, Suburban, Industrial, Commercial, and Residential. The efficiency of solar panels varies by district due to different sun exposure and building heights. In Urban, the efficiency is 80%, in Suburban it's 90%, in Industrial it's 75%, in Commercial it's 85%, and in Residential it's 95%. The cost of installation per panel also varies: $1000 in Urban, $900 in Suburban, $1100 in Industrial, $1050 in Commercial, and $850 in Residential. The city aims to maximize the energy output per dollar spent. The city has a budget of $500,000 for the installation of solar panels. There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\n\nPlease help the city determine the optimal number of solar panels to install in each zone to maximize the energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUrban = model.addVar(vtype=\"INTEGER\", name=\"Urban\", lb=0) # number of solar panels in Urban zone\nSuburban = model.addVar(vtype=\"INTEGER\", name=\"Suburban\", lb=0) # number of solar panels in Suburban zone\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0) # number of solar panels in Industrial zone\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0) # number of solar panels in Commercial zone\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0) # number of solar panels in Residential zone\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_Urban = 0.8 * Urban\nEnergy_Suburban = 0.9 * Suburban\nEnergy_Industrial = 0.75 * Industrial\nEnergy_Commercial = 0.85 * Commercial\nEnergy_Residential = 0.95 * Residential\nCost_Urban = 1000 * Urban\nCost_Suburban = 900 * Suburban\nCost_Industrial = 1100 * Industrial\nCost_Commercial = 1050 * Commercial\nCost_Residential = 850 * Residential\n## the objective function is: Maximize (Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential) / (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_Urban + Cost_Suburban + Cost_Industrial + Cost_Commercial + Cost_Residential) == Energy_Urban + Energy_Suburban + Energy_Industrial + Energy_Commercial + Energy_Residential)\n\n# Add constraints\n## The city has a budget of $500,000 for the installation of solar panels.\nmodel.addCons(1000 * Urban + 900 * Suburban + 1100 * Industrial + 1050 * Commercial + 850 * Residential <= 500000)\n## There is a maximum capacity for each zone due to space limitations: 500 panels in Urban, 600 in Suburban, 400 in Industrial, 550 in Commercial, and 700 in Residential.\nmodel.addCons(Urban <= 500)\nmodel.addCons(Suburban <= 600)\nmodel.addCons(Industrial <= 400)\nmodel.addCons(Commercial <= 550)\nmodel.addCons(Residential <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Urban Zone: \", model.getVal(Urban))\n    print(\"Number of Solar Panels in Suburban Zone: \", model.getVal(Suburban))\n    print(\"Number of Solar Panels in Industrial Zone: \", model.getVal(Industrial))\n    print(\"Number of Solar Panels in Commercial Zone: \", model.getVal(Commercial))\n    print(\"Number of Solar Panels in Residential Zone: \", model.getVal(Residential))\n    print(\"Maximized Energy Output per Dollar Spent: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs.\n// {\"number of solar panels in Region A\": \"SolarPanels_A\", \"range\": \"SolarPanels_A >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region A\": \"WindTurbines_A\", \"range\": \"WindTurbines_A >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region B\": \"SolarPanels_B\", \"range\": \"SolarPanels_B >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region B\": \"WindTurbines_B\", \"range\": \"WindTurbines_B >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Region C\": \"SolarPanels_C\", \"range\": \"SolarPanels_C >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in Region C\": \"WindTurbines_C\", \"range\": \"WindTurbines_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n// Total cost in Region A: Cost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\n// Total cost in Region B: Cost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\n// Total cost in Region C: Cost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\n// Total energy production in Region A: Energy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\n// Total energy production in Region B: Energy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\n// Total energy production in Region C: Energy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe total daily energy production in each region must be at least 1000 kWh.\n// Energy_A >= 1000; Energy_B >= 1000; Energy_C >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $500,000 for installation costs across all regions.\n// Cost_A + Cost_B + Cost_C <= 500,000\n\n## Generate Constraint-3:\nDue to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines.\n// SolarPanels_A <= 500; WindTurbines_A <= 200\n\n## Generate Constraint-4:\nRegion B has a higher wind potential, so the number of wind turbines must be at least twice the number of solar panels.\n// WindTurbines_B >= 2 * SolarPanels_B\n\n## Generate Constraint-5:\nRegion C has limited space, so the total number of installations (solar panels and wind turbines) must not exceed 600.\n// SolarPanels_C + WindTurbines_C <= 600",
        "question": "A renewable energy company is planning to install solar panels and wind turbines across three different regions: Region A, Region B, and Region C. The company needs to determine the number of solar panels and wind turbines to install in each region to optimize energy production and minimize costs. The cost of installing a solar panel is $500, and the cost of installing a wind turbine is $1000. The energy produced by a solar panel is 100 kWh per day, and by a wind turbine is 200 kWh per day. The company wants to minimize the total cost of installation while ensuring a minimum daily energy production of 1000 kWh per region.\n\n| Region | Installation Type | Cost per Unit | Energy Production per Unit |\n|--------|-------------------|---------------|----------------------------|\n| A      | Solar Panel       | $500          | 100 kWh/day                |\n| A      | Wind Turbine      | $1000         | 200 kWh/day                |\n| B      | Solar Panel       | $500          | 100 kWh/day                |\n| B      | Wind Turbine      | $1000         | 200 kWh/day                |\n| C      | Solar Panel       | $500          | 100 kWh/day                |\n| C      | Wind Turbine      | $1000         | 200 kWh/day                |\n\nThe company has a budget of $500,000 for installation costs across all regions. Due to geographical constraints, Region A can have at most 500 solar panels and 200 wind turbines. Region B has a higher wind potential, so the number of wind turbines must be at least twice the number of solar panels. Region C has limited space, so the total number of installations (solar panels and wind turbines) must not exceed 600.\n\nPlease help the company to minimize the total cost of installation while meeting the energy production requirements and constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels_A = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_A\", lb=0)\nWindTurbines_A = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_A\", lb=0)\nSolarPanels_B = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_B\", lb=0)\nWindTurbines_B = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_B\", lb=0)\nSolarPanels_C = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels_C\", lb=0)\nWindTurbines_C = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines_C\", lb=0)\n\n# Define objective function\nCost_A = 500 * SolarPanels_A + 1000 * WindTurbines_A\nCost_B = 500 * SolarPanels_B + 1000 * WindTurbines_B\nCost_C = 500 * SolarPanels_C + 1000 * WindTurbines_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nEnergy_A = 100 * SolarPanels_A + 200 * WindTurbines_A\nEnergy_B = 100 * SolarPanels_B + 200 * WindTurbines_B\nEnergy_C = 100 * SolarPanels_C + 200 * WindTurbines_C\nmodel.addCons(Energy_A >= 1000)\nmodel.addCons(Energy_B >= 1000)\nmodel.addCons(Energy_C >= 1000)\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 500000)\nmodel.addCons(SolarPanels_A <= 500)\nmodel.addCons(WindTurbines_A <= 200)\nmodel.addCons(WindTurbines_B >= 2 * SolarPanels_B)\nmodel.addCons(SolarPanels_C + WindTurbines_C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region A: \", model.getVal(SolarPanels_A))\n    print(\"Number of Wind Turbines in Region A: \", model.getVal(WindTurbines_A))\n    print(\"Number of Solar Panels in Region B: \", model.getVal(SolarPanels_B))\n    print(\"Number of Wind Turbines in Region B: \", model.getVal(WindTurbines_B))\n    print(\"Number of Solar Panels in Region C: \", model.getVal(SolarPanels_C))\n    print(\"Number of Wind Turbines in Region C: \", model.getVal(WindTurbines_C))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1791,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3).\n// {\"number of S1 solar panels\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of S2 solar panels\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of S3 solar panels\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of S4 solar panels\": \"S4\", \"range\": \"S4 >= 0\", \"type\": \"integer\"}\n// {\"number of S5 solar panels\": \"S5\", \"range\": \"S5 >= 0\", \"type\": \"integer\"}\n// {\"number of W1 wind turbines\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of W2 wind turbines\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of W3 wind turbines\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company wants to minimize the total cost of installation while maximizing the energy output. The cost per unit for S1, S2, S3, S4, S5 solar panels are $1000, $1200, $1500, $1800, $2000 respectively. The cost per unit for W1, W2, W3 wind turbines are $2500, $3000, $3500 respectively. The energy output per unit for S1, S2, S3, S4, S5 solar panels are 1.5 kW, 2 kW, 2.5 kW, 3 kW, 3.5 kW respectively. The energy output per unit for W1, W2, W3 wind turbines are 5 kW, 6 kW, 7 kW respectively.\n// Total cost: Cost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\n// Total energy output: Energy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation.\n// 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3 <= 150000\n\n## Generate Constraint-2:\nThe total energy output must be at least 100 kW.\n// 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3 >= 100\n\n## Generate Constraint-3:\nThe company wants to install at least 20 solar panels in total.\n// S1 + S2 + S3 + S4 + S5 >= 20",
        "question": "A company is planning to optimize its energy consumption by installing solar panels and wind turbines. They have identified five different types of solar panels (S1, S2, S3, S4, S5) and three types of wind turbines (W1, W2, W3). The cost per unit and energy output per unit for each type of solar panel and wind turbine are given in the following Table.\n\n| Type       | Cost per Unit | Energy Output per Unit |\n|------------|---------------|------------------------|\n| S1 Solar   | $1000         | 1.5 kW                 |\n| S2 Solar   | $1200         | 2 kW                   |\n| S3 Solar   | $1500         | 2.5 kW                 |\n| S4 Solar   | $1800         | 3 kW                   |\n| S5 Solar   | $2000         | 3.5 kW                 |\n| W1 Wind    | $2500         | 5 kW                   |\n| W2 Wind    | $3000         | 6 kW                   |\n| W3 Wind    | $3500         | 7 kW                   |\n\nThe company has a budget of $150,000 for the installation. The total energy output must be at least 100 kW. The company wants to install at least 20 solar panels in total.\nPlease help the company to minimize the total cost of installation while maximizing the energy output, defined as the ratio of total cost to total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of S1 solar panels\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of S2 solar panels\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of S3 solar panels\nS4 = model.addVar(vtype=\"INTEGER\", name=\"S4\", lb=0) # number of S4 solar panels\nS5 = model.addVar(vtype=\"INTEGER\", name=\"S5\", lb=0) # number of S5 solar panels\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of W1 wind turbines\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of W2 wind turbines\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of W3 wind turbines\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3\nEnergy = 1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for the installation.\nmodel.addCons(1000 * S1 + 1200 * S2 + 1500 * S3 + 1800 * S4 + 2000 * S5 + 2500 * W1 + 3000 * W2 + 3500 * W3 <= 150000)\n## The total energy output must be at least 100 kW.\nmodel.addCons(1.5 * S1 + 2 * S2 + 2.5 * S3 + 3 * S4 + 3.5 * S5 + 5 * W1 + 6 * W2 + 7 * W3 >= 100)\n## The company wants to install at least 20 solar panels in total.\nmodel.addCons(S1 + S2 + S3 + S4 + S5 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of S1 Solar Panels: \", model.getVal(S1))\n    print(\"Number of S2 Solar Panels: \", model.getVal(S2))\n    print(\"Number of S3 Solar Panels: \", model.getVal(S3))\n    print(\"Number of S4 Solar Panels: \", model.getVal(S4))\n    print(\"Number of S5 Solar Panels: \", model.getVal(S5))\n    print(\"Number of W1 Wind Turbines: \", model.getVal(W1))\n    print(\"Number of W2 Wind Turbines: \", model.getVal(W2))\n    print(\"Number of W3 Wind Turbines: \", model.getVal(W3))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company aims to maximize the total profit from the production of these three products.\n// Profit_A = A * (50 - 20)\n// Profit_B = B * (70 - 30)\n// Profit_C = C * (60 - 25)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for production costs.\n// 20 * A + 30 * B + 25 * C <= 10000\n\n## Generate Constraint-2:\nThe total production capacity of the company is limited to 500 units per day.\n// A + B + C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of production and the limited resources available. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of production per unit for product A is $20, product B is $30, and product C is $25. The company has a total budget of $10,000 for production costs. The total production capacity of the company is limited to 500 units per day. Please help the company to maximize the total profit from the production of these three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = A * (50 - 20)\nProfit_B = B * (70 - 30)\nProfit_C = C * (60 - 25)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total budget of $10,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 10000)\n# The total production capacity of the company is limited to 500 units per day.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 662,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 1 kg of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 kg of raw material. Product C yields a profit of $100 per unit, requiring 4 hours of labor and 3 kg of raw material. The company aims to maximize the total profit while considering the efficiency of resource usage (labor and raw material).\n// Profit_A = 50 * A\n// Profit_B = 70 * B\n// Profit_C = 100 * C\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// A + 2 * B + 3 * C <= 5000\n\n## Generate Constraint-2:\nThe company has a total of 1000 labor hours available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are produced.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the number of units of each product to produce in the next quarter to optimize its profit. The profit per unit, labor hours required, and raw material required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Required |\n|---------|-----------------|----------------------|-----------------------|\n| A       | $50             | 2 hours              | 1 kg                  |\n| B       | $70             | 3 hours              | 2 kg                  |\n| C       | $100            | 4 hours              | 3 kg                  |\n\nThe company has a budget of $5000 for raw materials. The company has a total of 1000 labor hours available. The company wants to ensure that at least 50 units of each product are produced. Please help the company to maximize the total profit while considering the efficiency of resource usage (labor and raw material).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 5000)\n## The company has a total of 1000 labor hours available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, but it requires 2 units of a scarce resource R. The profit per unit of P2 is $150, requiring 3 units of resource R. The profit per unit of P3 is $200, requiring 4 units of resource R. The company aims to maximize the total profit.\n// Profit_P1 = 100 * P1 - 2 * P1^2 (due to diminishing returns)\n// Profit_P2 = 150 * P2 - 3 * P2^2 (due to diminishing returns)\n// Profit_P3 = 200 * P3 - 4 * P3^2 (due to diminishing returns)\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3)\n\n## Generate Constraint-1:\nThe company has a limited supply of resource R, with only 200 units available.\n// 2 * P1 + 3 * P2 + 4 * P3 <= 200\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-3:\nThe market demand for P1 is 30 units. So, the company can only sell a maximum of 30 units of P1.\n// P1 <= 30\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs, which should not exceed $5000.\n// 50 * P1 + 75 * P2 + 100 * P3 <= 5000\n\n## Generate Constraint-5:\nThe company aims to maintain a minimum production of P2 to keep a certain market presence, which is at least 10 units.\n// P2 >= 10",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the optimal production quantities for each product to maximize their profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit and the resource requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Resource R Required |\n|---------|-----------------|---------------------|\n| P1      | $100            | 2 units             |\n| P2      | $150            | 3 units             |\n| P3      | $200            | 4 units             |\n\nThe company has a limited supply of resource R, with only 200 units available. The company has a production capacity constraint of 100 units in total. The market demand for P1 is 30 units, and the company can only sell a maximum of 30 units of P1. The company has a budget constraint for production costs, which should not exceed $5000. The company aims to maintain a minimum production of P2 to keep a certain market presence, which is at least 10 units.\n\nPlease help the company to maximize the total profit, considering the diminishing returns where the profit function for each product is given by:\n- Profit_P1 = 100 * P1 - 2 * P1^2\n- Profit_P2 = 150 * P2 - 3 * P2^2\n- Profit_P3 = 200 * P3 - 4 * P3^2\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=30)  # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10)  # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0)  # quantity of P3\n\n# Define objective function\n# Profit_P1 = 100 * P1 - 2 * P1^2 (due to diminishing returns)\n# Profit_P2 = 150 * P2 - 3 * P2^2 (due to diminishing returns)\n# Profit_P3 = 200 * P3 - 4 * P3^2 (due to diminishing returns)\n# So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3)\n# Convert quadratic terms to linear by introducing new variables and constraints\nP1_sq = model.addVar(vtype=\"INTEGER\", name=\"P1_sq\")\nP2_sq = model.addVar(vtype=\"INTEGER\", name=\"P2_sq\")\nP3_sq = model.addVar(vtype=\"INTEGER\", name=\"P3_sq\")\nmodel.addCons(P1_sq == P1 * P1)\nmodel.addCons(P2_sq == P2 * P2)\nmodel.addCons(P3_sq == P3 * P3)\n\nProfit_P1 = 100 * P1 - 2 * P1_sq\nProfit_P2 = 150 * P2 - 3 * P2_sq\nProfit_P3 = 200 * P3 - 4 * P3_sq\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n# The company has a limited supply of resource R, with only 200 units available.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 <= 200)\n# The company has a production capacity constraint of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# The market demand for P1 is 30 units. So, the company can only sell a maximum of 30 units of P1.\nmodel.addCons(P1 <= 30)\n# The company has a budget constraint for production costs, which should not exceed $5000.\nmodel.addCons(50 * P1 + 75 * P2 + 100 * P3 <= 5000)\n# The company aims to maintain a minimum production of P2 to keep a certain market presence, which is at least 10 units.\nmodel.addCons(P2 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network.\n// {\"number of trucks for GoodA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for GoodE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck for GoodA is $500 per day, and the revenue generated is $1000 per day.\nFor GoodB, the operating cost is $600 per day, and the revenue is $1200 per day.\nFor GoodC, the operating cost is $700 per day, and the revenue is $1400 per day.\nFor GoodD, the operating cost is $800 per day, and the revenue is $1600 per day.\nFor GoodE, the operating cost is $900 per day, and the revenue is $1800 per day.\nThe company wants to maximize the total net profit per day.\n// NetProfit_A = (1000 - 500) * TrucksA\n// NetProfit_B = (1200 - 600) * TrucksB\n// NetProfit_C = (1400 - 700) * TrucksC\n// NetProfit_D = (1600 - 800) * TrucksD\n// NetProfit_E = (1800 - 900) * TrucksE\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50\n\n## Generate Constraint-2:\nDue to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a daily budget of $30,000 for operating costs.\n// 500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30,000",
        "question": "A logistics company is managing the distribution of five different types of goods (GoodA, GoodB, GoodC, GoodD, GoodE) across various regions. The company needs to determine the number of trucks to allocate for each type of good to optimize their distribution network. The operating cost and revenue per day for each type of good are given in the following Table.\n\n| Good | Operating Cost per Day | Revenue per Day |\n|------|------------------------|-----------------|\n| GoodA | $500                  | $1000           |\n| GoodB | $600                  | $1200           |\n| GoodC | $700                  | $1400           |\n| GoodD | $800                  | $1600           |\n| GoodE | $900                  | $1800           |\n\nThe company has a total of 50 trucks available. Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB. The company has a daily budget of $30,000 for operating costs.\nPlease help the company to maximize the total net profit per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for GoodA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for GoodB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for GoodC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for GoodD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for GoodE\n\n# Define objective function\nNetProfit_A = (1000 - 500) * TrucksA\nNetProfit_B = (1200 - 600) * TrucksB\nNetProfit_C = (1400 - 700) * TrucksC\nNetProfit_D = (1600 - 800) * TrucksD\nNetProfit_E = (1800 - 900) * TrucksE\n# So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_A + NetProfit_B + NetProfit_C + NetProfit_D + NetProfit_E)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 50)\n# Due to regional demand, the number of trucks for GoodA must be at least half the number of trucks for GoodB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n# The company has a daily budget of $30,000 for operating costs.\nmodel.addCons(500 * TrucksA + 600 * TrucksB + 700 * TrucksC + 800 * TrucksD + 900 * TrucksE <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for GoodA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for GoodB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for GoodC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for GoodD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for GoodE: \", model.getVal(TrucksE))\n    print(\"Maximized Total Net Profit per Day: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Van D\": \"VanD\", \"range\": \"VanD >= 0\", \"type\": \"integer\"}\n// {\"number of Van E\": \"VanE\", \"range\": \"VanE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Truck A, the cost per kilometer is $2, the fuel efficiency is 5 km/liter, and the maintenance cost is $1000 per quarter.\nFor Truck B, the cost per kilometer is $3, the fuel efficiency is 4 km/liter, and the maintenance cost is $1500 per quarter.\nFor Truck C, the cost per kilometer is $4, the fuel efficiency is 3 km/liter, and the maintenance cost is $2000 per quarter.\nFor Van D, the cost per kilometer is $1.5, the fuel efficiency is 6 km/liter, and the maintenance cost is $800 per quarter.\nFor Van E, the cost per kilometer is $1, the fuel efficiency is 7 km/liter, and the maintenance cost is $500 per quarter.\nThe company wants to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies.\n// Total cost for Truck A: Cost_A = 2 * (5 * TruckA) + 1000\n// Total cost for Truck B: Cost_B = 3 * (4 * TruckB) + 1500\n// Total cost for Truck C: Cost_C = 4 * (3 * TruckC) + 2000\n// Total cost for Van D: Cost_D = 1.5 * (6 * VanD) + 800\n// Total cost for Van E: Cost_E = 1 * (7 * VanE) + 500\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / (5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter.\n// 1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000\n\n## Generate Constraint-2:\nThe company plans to cover at least 50,000 kilometers next quarter.\n// 5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE >= 50000\n\n## Generate Constraint-3:\nThe company wants to ensure that the number of vans (Van D and Van E) does not exceed twice the number of trucks (Truck A, Truck B, and Truck C).\n// VanD + VanE <= 2 * (TruckA + TruckB + TruckC)\n\n## Generate Constraint-4:\nThe company wants to limit the total number of vehicles to 100.\n// TruckA + TruckB + TruckC + VanD + VanE <= 100\n\n## Generate Constraint-5:\nThe company wants to ensure that the total number of Truck C does not exceed the combined number of Truck A and Truck B.\n// TruckC <= TruckA + TruckB",
        "question": "A logistics company is planning its fleet for the next quarter. They have identified five types of vehicles (Truck A, Truck B, Truck C, Van D, and Van E) to optimize their delivery routes.\nFor Truck A, the cost per kilometer is $2, the fuel efficiency is 5 km/liter, and the maintenance cost is $1000 per quarter.\nFor Truck B, the cost per kilometer is $3, the fuel efficiency is 4 km/liter, and the maintenance cost is $1500 per quarter.\nFor Truck C, the cost per kilometer is $4, the fuel efficiency is 3 km/liter, and the maintenance cost is $2000 per quarter.\nFor Van D, the cost per kilometer is $1.5, the fuel efficiency is 6 km/liter, and the maintenance cost is $800 per quarter.\nFor Van E, the cost per kilometer is $1, the fuel efficiency is 7 km/liter, and the maintenance cost is $500 per quarter.\nThe company has a budget of $100,000 for vehicle maintenance for the next quarter. The company plans to cover at least 50,000 kilometers next quarter. The company wants to ensure that the number of vans (Van D and Van E) does not exceed twice the number of trucks (Truck A, Truck B, and Truck C). The company wants to limit the total number of vehicles to 100. The company wants to ensure that the total number of Truck C does not exceed the combined number of Truck A and Truck B.\nPlease help the company to minimize the Total Cost Efficiency Ratio (TCER), which is defined as the sum of the total costs (cost per kilometer * total kilometers + maintenance cost) divided by the sum of the fuel efficiencies.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nVanD = model.addVar(vtype=\"INTEGER\", name=\"VanD\", lb=0) # number of Van D\nVanE = model.addVar(vtype=\"INTEGER\", name=\"VanE\", lb=0) # number of Van E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * (5 * TruckA) + 1000\nCost_B = 3 * (4 * TruckB) + 1500\nCost_C = 4 * (3 * TruckC) + 2000\nCost_D = 1.5 * (6 * VanD) + 800\nCost_E = 1 * (7 * VanE) + 500\nFuelEfficiency = 5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) / FuelEfficiency\n## convert the division to multiplication\nmodel.addCons(obj * FuelEfficiency == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a budget of $100,000 for vehicle maintenance for the next quarter.\nmodel.addCons(1000 * TruckA + 1500 * TruckB + 2000 * TruckC + 800 * VanD + 500 * VanE <= 100000)\n## The company plans to cover at least 50,000 kilometers next quarter.\nmodel.addCons(5 * TruckA + 4 * TruckB + 3 * TruckC + 6 * VanD + 7 * VanE >= 50000)\n## The company wants to ensure that the number of vans (Van D and Van E) does not exceed twice the number of trucks (Truck A, Truck B, and Truck C).\nmodel.addCons(VanD + VanE <= 2 * (TruckA + TruckB + TruckC))\n## The company wants to limit the total number of vehicles to 100.\nmodel.addCons(TruckA + TruckB + TruckC + VanD + VanE <= 100)\n## The company wants to ensure that the total number of Truck C does not exceed the combined number of Truck A and Truck B.\nmodel.addCons(TruckC <= TruckA + TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Van D: \", model.getVal(VanD))\n    print(\"Number of Van E: \", model.getVal(VanE))\n    print(\"Minimized Total Cost Efficiency Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1518,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck.\n// {\"speed of each truck\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n// {\"number of trips per truck\": \"Trips\", \"range\": \"Trips >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n// {\"fuel consumption rate per trip\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost per trip\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2. The maintenance cost per trip also depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips.\n// Total operational cost per truck: Cost = FuelRate * Trips * Speed + MaintenanceCost * Trips\n// So, the objective function is: Minimize \u03a3(Cost) for all trucks\n\n## Generate Constraint-1:\nThe total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\n// \u03a3(Investment) <= 100,000\n\n## Generate Constraint-2:\nThe maximum allowable speed for any truck is 60 mph.\n// Speed <= 60\n\n## Generate Constraint-3:\nEach truck must make at least 10 trips per month.\n// Trips >= 10\n\n## Generate Constraint-4:\nThe total fuel consumption across all trucks must not exceed 50,000 gallons per month.\n// \u03a3(FuelRate * Trips * Speed) <= 50,000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and maintenance costs of the fleet by determining the optimal speed for each truck and the number of trips each truck should make in a month. Additionally, the company needs to decide on the investment in fuel-efficient technologies for each truck. The fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2, and the maintenance cost per trip depends on the speed, given by MaintenanceCost = 0.001 * Speed^3. The company aims to minimize the total monthly operational cost, which is the sum of fuel and maintenance costs for all trips. The total investment in fuel-efficient technologies across all trucks must not exceed $100,000. The maximum allowable speed for any truck is 60 mph. Each truck must make at least 10 trips per month. The total fuel consumption across all trucks must not exceed 50,000 gallons per month. Please help the company to minimize the total monthly operational cost for all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"speed of each truck\": \"Speed\", \"range\": \"Speed >= 0\", \"type\": \"continuous\"}\n## {\"number of trips per truck\": \"Trips\", \"range\": \"Trips >= 0\", \"type\": \"integer\"}\n## {\"investment in fuel-efficient technologies\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n## {\"fuel consumption rate per trip\": \"FuelRate\", \"range\": \"FuelRate >= 0\", \"type\": \"continuous\"}\n## {\"maintenance cost per trip\": \"MaintenanceCost\", \"range\": \"MaintenanceCost >= 0\", \"type\": \"continuous\"}\nSpeed = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed\", lb=0)\nTrips = model.addVar(vtype=\"INTEGER\", name=\"Trips\", lb=0)\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0)\nFuelRate = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelRate\", lb=0)\nMaintenanceCost = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceCost\", lb=0)\n\n# Define objective function\n## The fuel consumption rate per trip is a nonlinear function of the truck's speed, given by FuelRate = 0.005 * Speed^2.\nmodel.addCons(FuelRate == 0.005 * Speed**2)\n## The maintenance cost per trip also depends on the speed, given by MaintenanceCost = 0.001 * Speed^3.\nmodel.addCons(MaintenanceCost == 0.001 * Speed**3)\n## Total operational cost per truck: Cost = FuelRate * Trips * Speed + MaintenanceCost * Trips\nCost = FuelRate * Trips * Speed + MaintenanceCost * Trips\n## So, the objective function is: Minimize \u03a3(Cost) for all trucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total investment in fuel-efficient technologies across all trucks must not exceed $100,000.\nmodel.addCons(Investment <= 100000)\n## The maximum allowable speed for any truck is 60 mph.\nmodel.addCons(Speed <= 60)\n## Each truck must make at least 10 trips per month.\nmodel.addCons(Trips >= 10)\n## The total fuel consumption across all trucks must not exceed 50,000 gallons per month.\nmodel.addCons(FuelRate * Trips * Speed <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Speed of each truck: \", model.getVal(Speed))\n    print(\"Number of trips per truck: \", model.getVal(Trips))\n    print(\"Investment in fuel-efficient technologies: \", model.getVal(Investment))\n    print(\"Fuel consumption rate per trip: \", model.getVal(FuelRate))\n    print(\"Maintenance cost per trip: \", model.getVal(MaintenanceCost))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit.\n// Cost_A = (100 - 5 * Automation) * A\n// Cost_B = (150 - 5 * Automation) * B\n// Cost_C = (200 - 5 * Automation) * C\n// Revenue_A = 150 * A\n// Revenue_B = 200 * B\n// Revenue_C = 250 * C\n// So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for implementing automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 2000 units.\n// A + B + C <= 2000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost of production by $5 per unit for each product for every unit increase in automation level. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize its net profit. The company has a budget of $100,000 for implementing automation. The total production capacity of the company is 2000 units.\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (100 - 5 * Automation) * A\nCost_B = (150 - 5 * Automation) * B\nCost_C = (200 - 5 * Automation) * C\nRevenue_A = 150 * A\nRevenue_B = 200 * B\nRevenue_C = 250 * C\n# So, the objective function is: Maximize (Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A - Cost_A + Revenue_B - Cost_B + Revenue_C - Cost_C)\n\n# Add constraints\n# The company has a budget of $100,000 for implementing automation.\nmodel.addCons(Automation <= 100000)\n# The total production capacity of the company is 2000 units.\nmodel.addCons(A + B + C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected yield is 150 bushels per acre, the price per bushel is $5, and the water requirement is 200 gallons per acre.\nFor Wheat, the expected yield is 100 bushels per acre, the price per bushel is $6, and the water requirement is 150 gallons per acre.\nFor Soybeans, the expected yield is 50 bushels per acre, the price per bushel is $10, and the water requirement is 100 gallons per acre.\nFor Barley, the expected yield is 80 bushels per acre, the price per bushel is $4, and the water requirement is 120 gallons per acre.\nFor Oats, the expected yield is 70 bushels per acre, the price per bushel is $3, and the water requirement is 90 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n// Total profit: Profit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\n// Total water usage: Water = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Corn + Wheat + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe farmer has a total of 15,000 gallons of water available for irrigation.\n// 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000\n\n## Generate Constraint-3:\nThe farmer wants to plant at least 5 acres of each crop.\n// Corn >= 5; Wheat >= 5; Soybeans >= 5; Barley >= 5; Oats >= 5\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total acreage of Soybeans does not exceed the combined acreage of Corn and Wheat.\n// Soybeans <= Corn + Wheat\n\n## Generate Constraint-5:\nThe farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of Corn, Wheat, Soybeans, and Barley.\n// Oats <= Corn + Wheat + Soybeans + Barley",
        "question": "A farmer is planning to plant five different crops: Corn, Wheat, Soybeans, Barley, and Oats. The farmer needs to decide how many acres to allocate to each crop. The expected yield, price per bushel, and water requirement for each crop are given in the following Table.\n\n| Crop       | Expected Yield (bushels/acre) | Price per Bushel | Water Requirement (gallons/acre) |\n|------------|-------------------------------|------------------|---------------------------------|\n| Corn       | 150                           | $5               | 200                             |\n| Wheat      | 100                           | $6               | 150                             |\n| Soybeans   | 50                            | $10              | 100                             |\n| Barley     | 80                            | $4               | 120                             |\n| Oats       | 70                            | $3               | 90                              |\n\nThe farmer has 100 acres available for planting. The farmer has a total of 15,000 gallons of water available for irrigation. The farmer wants to plant at least 5 acres of each crop. The farmer wants to ensure that the total acreage of Soybeans does not exceed the combined acreage of Corn and Wheat. The farmer also wants to ensure that the total acreage of Oats does not exceed the combined acreage of Corn, Wheat, Soybeans, and Barley.\n\nPlease help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5)  # number of acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=5)  # number of acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=5)  # number of acres of Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=5)  # number of acres of Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=5)  # number of acres of Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 150 * 5 * Corn + 100 * 6 * Wheat + 50 * 10 * Soybeans + 80 * 4 * Barley + 70 * 3 * Oats\nWater = 200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Corn + Wheat + Soybeans + Barley + Oats <= 100)\n## The farmer has a total of 15,000 gallons of water available for irrigation.\nmodel.addCons(200 * Corn + 150 * Wheat + 100 * Soybeans + 120 * Barley + 90 * Oats <= 15000)\n## The farmer wants to ensure that the total acreage of Soybeans does not exceed the combined acreage of Corn and Wheat.\nmodel.addCons(Soybeans <= Corn + Wheat)\n## The farmer wants to ensure that the total acreage of Oats does not exceed the combined acreage of Corn, Wheat, Soybeans, and Barley.\nmodel.addCons(Oats <= Corn + Wheat + Soybeans + Barley)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Number of Acres of Barley: \", model.getVal(Barley))\n    print(\"Number of Acres of Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1538,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in fleet management software for Small trucks\": \"SoftwareSmall\", \"range\": \"SoftwareSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Medium trucks\": \"SoftwareMedium\", \"range\": \"SoftwareMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in fleet management software for Large trucks\": \"SoftwareLarge\", \"range\": \"SoftwareLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n// Total operational cost for Small trucks: CostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\n// Total operational cost for Medium trucks: CostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\n// Total operational cost for Large trucks: CostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software.\n// 1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks should not exceed 500.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 500",
        "question": "A logistics company is planning its fleet expansion and needs to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, the company is considering investing in a new fleet management software that will affect the operational efficiency and maintenance costs of each type of truck. The operational cost of each truck type decreases with the investment in fleet management software. For Small trucks, the operational cost is $1000 per truck, decreasing by $50 per truck for every $1000 invested in software. For Medium trucks, the operational cost is $1500 per truck, decreasing by $75 per truck for every $1000 invested in software. For Large trucks, the operational cost is $2000 per truck, decreasing by $100 per truck for every $1000 invested in software. The company aims to minimize the total operational cost of the fleet.\n\n| Truck Type | Operational Cost per Truck | Decrease in Cost per $1000 Software Investment |\n|------------|----------------------------|------------------------------------------------|\n| Small      | $1000                      | $50                                            |\n| Medium     | $1500                      | $75                                            |\n| Large      | $2000                      | $100                                           |\n\nThe company has a budget of $1,000,000 for purchasing trucks and investing in fleet management software. The total number of trucks should not exceed 500.\n\nPlease help the company determine the optimal number of each type of truck to purchase and the investment in fleet management software to minimize the total operational cost of the fleet.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nSoftwareSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareSmall\", lb=0)\nSoftwareMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareMedium\", lb=0)\nSoftwareLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"SoftwareLarge\", lb=0)\n\n# Define objective function\nCostSmall = (1000 - 0.05 * SoftwareSmall) * SmallTrucks\nCostMedium = (1500 - 0.075 * SoftwareMedium) * MediumTrucks\nCostLarge = (2000 - 0.1 * SoftwareLarge) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(1000 * SmallTrucks + 1500 * MediumTrucks + 2000 * LargeTrucks + SoftwareSmall + SoftwareMedium + SoftwareLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Software for Small Trucks: \", model.getVal(SoftwareSmall))\n    print(\"Investment in Software for Medium Trucks: \", model.getVal(SoftwareMedium))\n    print(\"Investment in Software for Large Trucks: \", model.getVal(SoftwareLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1693,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks (Type A, Type B, and Type C) and three regions (Region 1, Region 2, and Region 3).\n// {\"number of Type A trucks in Region 1\": \"A_Trucks_R1\", \"range\": \"A_Trucks_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type A trucks in Region 2\": \"A_Trucks_R2\", \"range\": \"A_Trucks_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type A trucks in Region 3\": \"A_Trucks_R3\", \"range\": \"A_Trucks_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of Type B trucks in Region 1\": \"B_Trucks_R1\", \"range\": \"B_Trucks_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type B trucks in Region 2\": \"B_Trucks_R2\", \"range\": \"B_Trucks_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type B trucks in Region 3\": \"B_Trucks_R3\", \"range\": \"B_Trucks_R3 >= 0\", \"type\": \"integer\"}\n// {\"number of Type C trucks in Region 1\": \"C_Trucks_R1\", \"range\": \"C_Trucks_R1 >= 0\", \"type\": \"integer\"}\n// {\"number of Type C trucks in Region 2\": \"C_Trucks_R2\", \"range\": \"C_Trucks_R2 >= 0\", \"type\": \"integer\"}\n// {\"number of Type C trucks in Region 3\": \"C_Trucks_R3\", \"range\": \"C_Trucks_R3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of Type A trucks\": \"FuelEff_A\", \"range\": \"FuelEff_A > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of Type B trucks\": \"FuelEff_B\", \"range\": \"FuelEff_B > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of Type C trucks\": \"FuelEff_C\", \"range\": \"FuelEff_C > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel cost per day, considering the fuel efficiency of each truck type and the number of trucks in each region. The fuel cost is $3 per gallon.\n// FuelCost_R1 = 3 * (A_Trucks_R1 / FuelEff_A + B_Trucks_R1 / FuelEff_B + C_Trucks_R1 / FuelEff_C)\n// FuelCost_R2 = 3 * (A_Trucks_R2 / FuelEff_A + B_Trucks_R2 / FuelEff_B + C_Trucks_R2 / FuelEff_C)\n// FuelCost_R3 = 3 * (A_Trucks_R3 / FuelEff_A + B_Trucks_R3 / FuelEff_B + C_Trucks_R3 / FuelEff_C)\n// So, the objective function is: Minimize (FuelCost_R1 + FuelCost_R2 + FuelCost_R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A_Trucks_R1 + A_Trucks_R2 + A_Trucks_R3 + B_Trucks_R1 + B_Trucks_R2 + B_Trucks_R3 + C_Trucks_R1 + C_Trucks_R2 + C_Trucks_R3 <= 50",
        "question": "A logistics company is planning to optimize its fleet of trucks for transporting goods across different regions. The company needs to decide the number of trucks to allocate to each region and the fuel efficiency of each truck type. The company is considering three types of trucks (Type A, Type B, and Type C) and three regions (Region 1, Region 2, and Region 3). The company wants to minimize the total fuel cost per day, considering the fuel efficiency of each truck type and the number of trucks in each region. The fuel cost is $3 per gallon.\n\n| Truck Type | Fuel Efficiency |\n|------------|-----------------|\n| Type A     | FuelEff_A       |\n| Type B     | FuelEff_B       |\n| Type C     | FuelEff_C       |\n\nThe company has a total of 50 trucks available.\n\nPlease help the company to minimize the total fuel cost per day, which is calculated as follows:\n- FuelCost_R1 = 3 * (A_Trucks_R1 / FuelEff_A + B_Trucks_R1 / FuelEff_B + C_Trucks_R1 / FuelEff_C)\n- FuelCost_R2 = 3 * (A_Trucks_R2 / FuelEff_A + B_Trucks_R2 / FuelEff_B + C_Trucks_R2 / FuelEff_C)\n- FuelCost_R3 = 3 * (A_Trucks_R3 / FuelEff_A + B_Trucks_R3 / FuelEff_B + C_Trucks_R3 / FuelEff_C)\n\nThe objective function is: Minimize (FuelCost_R1 + FuelCost_R2 + FuelCost_R3).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA_Trucks_R1 = model.addVar(vtype=\"INTEGER\", name=\"A_Trucks_R1\", lb=0) # number of Type A trucks in Region 1\nA_Trucks_R2 = model.addVar(vtype=\"INTEGER\", name=\"A_Trucks_R2\", lb=0) # number of Type A trucks in Region 2\nA_Trucks_R3 = model.addVar(vtype=\"INTEGER\", name=\"A_Trucks_R3\", lb=0) # number of Type A trucks in Region 3\nB_Trucks_R1 = model.addVar(vtype=\"INTEGER\", name=\"B_Trucks_R1\", lb=0) # number of Type B trucks in Region 1\nB_Trucks_R2 = model.addVar(vtype=\"INTEGER\", name=\"B_Trucks_R2\", lb=0) # number of Type B trucks in Region 2\nB_Trucks_R3 = model.addVar(vtype=\"INTEGER\", name=\"B_Trucks_R3\", lb=0) # number of Type B trucks in Region 3\nC_Trucks_R1 = model.addVar(vtype=\"INTEGER\", name=\"C_Trucks_R1\", lb=0) # number of Type C trucks in Region 1\nC_Trucks_R2 = model.addVar(vtype=\"INTEGER\", name=\"C_Trucks_R2\", lb=0) # number of Type C trucks in Region 2\nC_Trucks_R3 = model.addVar(vtype=\"INTEGER\", name=\"C_Trucks_R3\", lb=0) # number of Type C trucks in Region 3\nFuelEff_A = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_A\", lb=0) # fuel efficiency of Type A trucks\nFuelEff_B = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_B\", lb=0) # fuel efficiency of Type B trucks\nFuelEff_C = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEff_C\", lb=0) # fuel efficiency of Type C trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_R1 = 3 * (A_Trucks_R1 / FuelEff_A + B_Trucks_R1 / FuelEff_B + C_Trucks_R1 / FuelEff_C)\nFuelCost_R2 = 3 * (A_Trucks_R2 / FuelEff_A + B_Trucks_R2 / FuelEff_B + C_Trucks_R2 / FuelEff_C)\nFuelCost_R3 = 3 * (A_Trucks_R3 / FuelEff_A + B_Trucks_R3 / FuelEff_B + C_Trucks_R3 / FuelEff_C)\n## the objective function is: Minimize (FuelCost_R1 + FuelCost_R2 + FuelCost_R3)\nmodel.addCons(obj == FuelCost_R1 + FuelCost_R2 + FuelCost_R3)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(A_Trucks_R1 + A_Trucks_R2 + A_Trucks_R3 + B_Trucks_R1 + B_Trucks_R2 + B_Trucks_R3 + C_Trucks_R1 + C_Trucks_R2 + C_Trucks_R3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type A trucks in Region 1: \", model.getVal(A_Trucks_R1))\n    print(\"Number of Type A trucks in Region 2: \", model.getVal(A_Trucks_R2))\n    print(\"Number of Type A trucks in Region 3: \", model.getVal(A_Trucks_R3))\n    print(\"Number of Type B trucks in Region 1: \", model.getVal(B_Trucks_R1))\n    print(\"Number of Type B trucks in Region 2: \", model.getVal(B_Trucks_R2))\n    print(\"Number of Type B trucks in Region 3: \", model.getVal(B_Trucks_R3))\n    print(\"Number of Type C trucks in Region 1: \", model.getVal(C_Trucks_R1))\n    print(\"Number of Type C trucks in Region 2: \", model.getVal(C_Trucks_R2))\n    print(\"Number of Type C trucks in Region 3: \", model.getVal(C_Trucks_R3))\n    print(\"Fuel efficiency of Type A trucks: \", model.getVal(FuelEff_A))\n    print(\"Fuel efficiency of Type B trucks: \", model.getVal(FuelEff_B))\n    print(\"Fuel efficiency of Type C trucks: \", model.getVal(FuelEff_C))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1234,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines.\n// {\"cargo weight in truck 1\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 2\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 3\": \"Truck3\", \"range\": \"Truck3 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 4\": \"Truck4\", \"range\": \"Truck4 >= 0\", \"type\": \"real\"}\n// {\"cargo weight in truck 5\": \"Truck5\", \"range\": \"Truck5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The company aims to minimize the total fuel cost.\n// Total fuel cost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\n// So, the objective function is: Minimize Total fuel cost\n\n## Generate Constraint-1:\nThe total weight of cargo to be delivered is 100 tons.\n// Truck1 + Truck2 + Truck3 + Truck4 + Truck5 = 100\n\n## Generate Constraint-2:\nEach truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons.\n// Truck1 <= 20\n// Truck2 <= 30\n// Truck3 <= 25\n// Truck4 <= 20\n// Truck5 <= 15\n\n## Generate Constraint-3:\nThe company has a policy to ensure that no truck carries more than 50% of the total cargo weight.\n// Truck1 <= 0.5 * 100\n// Truck2 <= 0.5 * 100\n// Truck3 <= 0.5 * 100\n// Truck4 <= 0.5 * 100\n// Truck5 <= 0.5 * 100\n\n## Generate Constraint-4:\nTo balance the workload, the difference in cargo weight between any two trucks should not exceed 10 tons.\n// |Truck1 - Truck2| <= 10\n// |Truck1 - Truck3| <= 10\n// |Truck1 - Truck4| <= 10\n// |Truck1 - Truck5| <= 10\n// |Truck2 - Truck3| <= 10\n// |Truck2 - Truck4| <= 10\n// |Truck2 - Truck5| <= 10\n// |Truck3 - Truck4| <= 10\n// |Truck3 - Truck5| <= 10\n// |Truck4 - Truck5| <= 10",
        "question": "A logistics company operates a fleet of 5 trucks with varying capacities and fuel efficiencies. The company needs to determine the optimal distribution of cargo among the trucks to minimize fuel costs while meeting delivery deadlines. The fuel cost per kilometer for each truck is as follows: Truck 1 costs $0.1 per kilometer per ton, Truck 2 costs $0.12 per kilometer per ton, Truck 3 costs $0.15 per kilometer per ton, Truck 4 costs $0.18 per kilometer per ton, and Truck 5 costs $0.2 per kilometer per ton. The total distance to be covered is 500 kilometers. The total weight of cargo to be delivered is 100 tons. Each truck has a maximum capacity: Truck 1 can carry up to 20 tons, Truck 2 up to 30 tons, Truck 3 up to 25 tons, Truck 4 up to 20 tons, and Truck 5 up to 15 tons. The company has a policy to ensure that no truck carries more than 50% of the total cargo weight. To balance the workload, the difference in cargo weight between any two trucks should not exceed 10 tons.\n\nPlease help the company to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck1\", lb=0)  # cargo weight in truck 1\nTruck2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck2\", lb=0)  # cargo weight in truck 2\nTruck3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck3\", lb=0)  # cargo weight in truck 3\nTruck4 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck4\", lb=0)  # cargo weight in truck 4\nTruck5 = model.addVar(vtype=\"CONTINUOUS\", name=\"Truck5\", lb=0)  # cargo weight in truck 5\n\n# Define objective function\nTotalFuelCost = 500 * (0.1 * Truck1 + 0.12 * Truck2 + 0.15 * Truck3 + 0.18 * Truck4 + 0.2 * Truck5)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalFuelCost)\n\n# Add constraints\n# The total weight of cargo to be delivered is 100 tons.\nmodel.addCons(Truck1 + Truck2 + Truck3 + Truck4 + Truck5 == 100)\n\n# Each truck has a maximum capacity\nmodel.addCons(Truck1 <= 20)\nmodel.addCons(Truck2 <= 30)\nmodel.addCons(Truck3 <= 25)\nmodel.addCons(Truck4 <= 20)\nmodel.addCons(Truck5 <= 15)\n\n# No truck carries more than 50% of the total cargo weight\nmodel.addCons(Truck1 <= 0.5 * 100)\nmodel.addCons(Truck2 <= 0.5 * 100)\nmodel.addCons(Truck3 <= 0.5 * 100)\nmodel.addCons(Truck4 <= 0.5 * 100)\nmodel.addCons(Truck5 <= 0.5 * 100)\n\n# Balance the workload, the difference in cargo weight between any two trucks should not exceed 10 tons\nmodel.addCons(abs(Truck1 - Truck2) <= 10)\nmodel.addCons(abs(Truck1 - Truck3) <= 10)\nmodel.addCons(abs(Truck1 - Truck4) <= 10)\nmodel.addCons(abs(Truck1 - Truck5) <= 10)\nmodel.addCons(abs(Truck2 - Truck3) <= 10)\nmodel.addCons(abs(Truck2 - Truck4) <= 10)\nmodel.addCons(abs(Truck2 - Truck5) <= 10)\nmodel.addCons(abs(Truck3 - Truck4) <= 10)\nmodel.addCons(abs(Truck3 - Truck5) <= 10)\nmodel.addCons(abs(Truck4 - Truck5) <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Cargo weight in Truck 1: \", model.getVal(Truck1))\n    print(\"Cargo weight in Truck 2: \", model.getVal(Truck2))\n    print(\"Cargo weight in Truck 3: \", model.getVal(Truck3))\n    print(\"Cargo weight in Truck 4: \", model.getVal(Truck4))\n    print(\"Cargo weight in Truck 5: \", model.getVal(Truck5))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its fleet usage for delivering goods across five regions: North, South, East, West, and Central. The company has to decide the number of trucks to allocate to each region.\n// {\"number of trucks in North region\": \"North\", \"range\": \"North >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in South region\": \"South\", \"range\": \"South >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in East region\": \"East\", \"range\": \"East >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in West region\": \"West\", \"range\": \"West >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Central region\": \"Central\", \"range\": \"Central >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck in the North region is $100 per day, with a delivery efficiency of 1.2 deliveries per day. In the South region, the cost is $120 per day with an efficiency of 1.5 deliveries per day. In the East region, the cost is $110 per day with an efficiency of 1.3 deliveries per day. In the West region, the cost is $90 per day with an efficiency of 1.1 deliveries per day. In the Central region, the cost is $130 per day with an efficiency of 1.6 deliveries per day. The company wants to minimize the total cost while ensuring a minimum delivery efficiency across all regions.\n// Total Cost = 100 * North + 120 * South + 110 * East + 90 * West + 130 * Central\n// Total Deliveries = 1.2 * North + 1.5 * South + 1.3 * East + 1.1 * West + 1.6 * Central\n// The objective function is: Minimize Total Cost / Total Deliveries\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// North + South + East + West + Central <= 100",
        "question": "A logistics company needs to optimize its fleet usage for delivering goods across five regions: North, South, East, West, and Central. The company has to decide the number of trucks to allocate to each region. The cost of operating a truck in the North region is $100 per day, with a delivery efficiency of 1.2 deliveries per day. In the South region, the cost is $120 per day with an efficiency of 1.5 deliveries per day. In the East region, the cost is $110 per day with an efficiency of 1.3 deliveries per day. In the West region, the cost is $90 per day with an efficiency of 1.1 deliveries per day. In the Central region, the cost is $130 per day with an efficiency of 1.6 deliveries per day. The company wants to minimize the total cost while ensuring a minimum delivery efficiency across all regions. The company has a total of 100 trucks available for allocation.\nPlease help the company to minimize the total cost per delivery (which is defined as the total cost divided by the total number of deliveries).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nNorth = model.addVar(vtype=\"INTEGER\", name=\"North\", lb=0) # number of trucks in North region\nSouth = model.addVar(vtype=\"INTEGER\", name=\"South\", lb=0) # number of trucks in South region\nEast = model.addVar(vtype=\"INTEGER\", name=\"East\", lb=0) # number of trucks in East region\nWest = model.addVar(vtype=\"INTEGER\", name=\"West\", lb=0) # number of trucks in West region\nCentral = model.addVar(vtype=\"INTEGER\", name=\"Central\", lb=0) # number of trucks in Central region\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotalCost = 100 * North + 120 * South + 110 * East + 90 * West + 130 * Central\nTotalDeliveries = 1.2 * North + 1.5 * South + 1.3 * East + 1.1 * West + 1.6 * Central\n## convert the division to multiplication\nmodel.addCons(obj * TotalDeliveries == TotalCost)\n\n# Add constraints\n## The company has a total of 100 trucks available for allocation.\nmodel.addCons(North + South + East + West + Central <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in North Region: \", model.getVal(North))\n    print(\"Number of Trucks in South Region: \", model.getVal(South))\n    print(\"Number of Trucks in East Region: \", model.getVal(East))\n    print(\"Number of Trucks in West Region: \", model.getVal(West))\n    print(\"Number of Trucks in Central Region: \", model.getVal(Central))\n    print(\"Minimized Cost per Delivery: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost.\n// {\"number of short-distance trucks\": \"ShortDistanceTrucks\", \"range\": \"ShortDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of medium-distance trucks\": \"MediumDistanceTrucks\", \"range\": \"MediumDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of long-distance trucks\": \"LongDistanceTrucks\", \"range\": \"LongDistanceTrucks >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of short-distance trucks (km/liter)\": \"ShortFuelEfficiency\", \"range\": \"ShortFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of medium-distance trucks (km/liter)\": \"MediumFuelEfficiency\", \"range\": \"MediumFuelEfficiency > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of long-distance trucks (km/liter)\": \"LongFuelEfficiency\", \"range\": \"LongFuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type. The maintenance cost is a fixed percentage of the fuel cost.\n// TotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n// TotalMaintenanceCost = 0.1 * TotalFuelCost (10% of fuel cost for maintenance)\n// So, the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering adding trucks to three different types of routes: short, medium, and long distance. Each type of truck has a different fuel efficiency and maintenance cost. The company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is calculated based on the distance traveled and the fuel efficiency of each truck type, and the maintenance cost is a fixed percentage of the fuel cost.\n\n| Truck Type             | Fuel Efficiency (km/liter) |\n|------------------------|---------------------------|\n| Short-distance trucks  | ShortFuelEfficiency       |\n| Medium-distance trucks | MediumFuelEfficiency      |\n| Long-distance trucks   | LongFuelEfficiency        |\n\nThe company has a budget of $100,000 for purchasing new trucks. Please help the company determine the optimal number of short-distance, medium-distance, and long-distance trucks to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nShortDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"ShortDistanceTrucks\", lb=0)\nMediumDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumDistanceTrucks\", lb=0)\nLongDistanceTrucks = model.addVar(vtype=\"INTEGER\", name=\"LongDistanceTrucks\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Define distances and fuel efficiencies\nShortDistance = 1000  # Example value\nMediumDistance = 2000  # Example value\nLongDistance = 3000  # Example value\nShortFuelEfficiency = 5  # Example value\nMediumFuelEfficiency = 10  # Example value\nLongFuelEfficiency = 15  # Example value\n\n## Calculate TotalFuelCost\nTotalFuelCost = (ShortDistance * ShortDistanceTrucks / ShortFuelEfficiency) + \\\n                (MediumDistance * MediumDistanceTrucks / MediumFuelEfficiency) + \\\n                (LongDistance * LongDistanceTrucks / LongFuelEfficiency)\n\n## Calculate TotalMaintenanceCost\nTotalMaintenanceCost = 0.1 * TotalFuelCost\n\n## the objective function is: Minimize (TotalFuelCost + TotalMaintenanceCost)\nmodel.addCons(obj == TotalFuelCost + TotalMaintenanceCost)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\n## Define truck costs\nShortTruckCost = 20000  # Example value\nMediumTruckCost = 30000  # Example value\nLongTruckCost = 40000  # Example value\nmodel.addCons(ShortDistanceTrucks * ShortTruckCost + MediumDistanceTrucks * MediumTruckCost + LongDistanceTrucks * LongTruckCost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Short-Distance Trucks: \", model.getVal(ShortDistanceTrucks))\n    print(\"Number of Medium-Distance Trucks: \", model.getVal(MediumDistanceTrucks))\n    print(\"Number of Long-Distance Trucks: \", model.getVal(LongDistanceTrucks))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases as more money is invested in automation.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. These costs decrease by $1 for every $10,000 invested in automation. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * Automation) * ProductA\n// Total cost for ProductB: CostB = (70 - 0.0001 * Automation) * ProductB\n// Total cost for ProductC: CostC = (90 - 0.0001 * Automation) * ProductC\n// Total revenue for ProductA: RevenueA = 100 * ProductA\n// Total revenue for ProductB: RevenueB = 120 * ProductB\n// Total revenue for ProductC: RevenueC = 150 * ProductC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity of the company is 5000 units.\n// ProductA + ProductB + ProductC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product and the amount of money to be invested in automation technology to reduce production costs. The production cost per unit decreases by $1 for every $10,000 invested in automation. The production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The selling price per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company has a budget of $100,000 for investment in automation and a total production capacity of 5000 units. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities and the amount to invest in automation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nCostA = (50 - 0.0001 * Automation) * ProductA\nCostB = (70 - 0.0001 * Automation) * ProductB\nCostC = (90 - 0.0001 * Automation) * ProductC\nRevenueA = 100 * ProductA\nRevenueB = 120 * ProductB\nRevenueC = 150 * ProductC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a budget of $100,000 for investment in automation.\nmodel.addCons(Automation <= 100000)\n# The total production capacity of the company is 5000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company can invest in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"hours of operation for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency upgrade for Solar plant\": \"Efficiency_Solar\", \"range\": \"Efficiency_Solar >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Wind plant\": \"Efficiency_Wind\", \"range\": \"Efficiency_Wind >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Hydro plant\": \"Efficiency_Hydro\", \"range\": \"Efficiency_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company aims to maximize the total daily energy production from all plants.\n// Total energy output for Solar: Output_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\n// Total energy output for Wind: Output_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\n// Total energy output for Hydro: Output_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Output_Solar + Output_Wind + Output_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for daily operations and efficiency upgrades.\n// Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000\n\n## Generate Constraint-2:\nDue to maintenance and operational constraints, each plant can operate for a maximum of 24 hours daily.\n// Hours_Solar <= 24; Hours_Wind <= 24; Hours_Hydro <= 24",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the amount to invest in efficiency upgrades for each plant to maximize energy production. The initial energy output per hour and the increase in output per $1000 invested in upgrades for each plant are given in the following Table.\n\n| Plant Type | Initial Output per Hour | Increase in Output per $1000 Invested |\n|------------|-------------------------|--------------------------------------|\n| Solar      | 100 kWh                 | 5 kWh                                |\n| Wind       | 120 kWh                 | 6 kWh                                |\n| Hydro      | 150 kWh                 | 7 kWh                                |\n\nThe company has a budget of $100,000 for daily operations and efficiency upgrades. Due to maintenance and operational constraints, each plant can operate for a maximum of 24 hours daily. Please help the company to maximize the total daily energy production from all plants.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=0)  # hours of operation for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=0)  # hours of operation for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=0)  # hours of operation for Hydro plant\nEfficiency_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Solar\", lb=0)  # investment in efficiency upgrade for Solar plant\nEfficiency_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Wind\", lb=0)  # investment in efficiency upgrade for Wind plant\nEfficiency_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Hydro\", lb=0)  # investment in efficiency upgrade for Hydro plant\n\n# Define objective function\nOutput_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\nOutput_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\nOutput_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output_Solar + Output_Wind + Output_Hydro)\n\n# Add constraints\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000)\nmodel.addCons(Hours_Solar <= 24)\nmodel.addCons(Hours_Wind <= 24)\nmodel.addCons(Hours_Hydro <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(Hours_Solar))\n    print(\"Hours of operation for Wind plant: \", model.getVal(Hours_Wind))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(Hours_Hydro))\n    print(\"Investment in efficiency upgrade for Solar plant: \", model.getVal(Efficiency_Solar))\n    print(\"Investment in efficiency upgrade for Wind plant: \", model.getVal(Efficiency_Wind))\n    print(\"Investment in efficiency upgrade for Hydro plant: \", model.getVal(Efficiency_Hydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route.\n// {\"number of trucks of type A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different profit per trip, fuel cost per kilometer, and maintenance cost per trip. The profit per trip for Truck A is $500, for Truck B is $700, for Truck C is $900, and for Truck D is $1100. The fuel cost per kilometer for Truck A is $0.5, for Truck B is $0.7, for Truck C is $0.9, and for Truck D is $1.1. The maintenance cost per trip for Truck A is $100, for Truck B is $150, for Truck C is $200, and for Truck D is $250. The company aims to maximize the total profit from all trips, considering the costs.\n// Profit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\n// Profit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\n// Profit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\n// Profit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n// So, the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n## Generate Constraint-1:\nThe total number of trucks available is 100.\n// TruckA + TruckB + TruckC + TruckD <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the allocation of trucks to different routes to maximize profit while considering fuel costs, maintenance costs, and the capacity of each truck. The company has four types of trucks (A, B, C, D) and needs to decide how many trucks of each type to allocate to each route. The profit per trip, fuel cost per kilometer, and maintenance cost per trip for each truck type are given in the following Table.\n\n| Truck Type | Profit per Trip | Fuel Cost per Kilometer | Maintenance Cost per Trip |\n|------------|-----------------|-------------------------|---------------------------|\n| A          | $500            | $0.5                    | $100                      |\n| B          | $700            | $0.7                    | $150                      |\n| C          | $900            | $0.9                    | $200                      |\n| D          | $1100           | $1.1                    | $250                      |\n\nThe total number of trucks available is 100. The company aims to maximize the total profit from all trips, considering the costs. Please help the company determine the optimal number of trucks of each type to allocate to the routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks of type A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks of type B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks of type C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks of type D\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nDistance = model.addVar(name=\"Distance\") # distance variable to handle the fuel cost per kilometer\n## Profit and cost calculations\nProfit_TruckA = 500 * TruckA - (0.5 * Distance * TruckA + 100 * TruckA)\nProfit_TruckB = 700 * TruckB - (0.7 * Distance * TruckB + 150 * TruckB)\nProfit_TruckC = 900 * TruckC - (0.9 * Distance * TruckC + 200 * TruckC)\nProfit_TruckD = 1100 * TruckD - (1.1 * Distance * TruckD + 250 * TruckD)\n## the objective function is: Maximize (Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\nmodel.addCons(obj == Profit_TruckA + Profit_TruckB + Profit_TruckC + Profit_TruckD)\n\n# Add constraints\n## The total number of trucks available is 100.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1281,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A has a fuel efficiency of 10 km/l and a cargo capacity of 5 tons.\n- Truck B has a fuel efficiency of 15 km/l and a cargo capacity of 7 tons.\n- Truck C has a fuel efficiency of 20 km/l and a cargo capacity of 9 tons.\n- Truck D has a fuel efficiency of 25 km/l and a cargo capacity of 11 tons.\n- Truck E has a fuel efficiency of 30 km/l and a cargo capacity of 13 tons.\nThe company aims to maximize the total cargo capacity while minimizing the total fuel consumption. The objective is to maximize the ratio of total cargo capacity to total fuel consumption.\n// Total cargo capacity: Cap = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E\n// Total fuel consumption: Fuel = (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / 1000 (converted to 1000 liters to simplify the ratio)\n// So, the objective function is: Maximize (Cap) / (Fuel)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 for truck deployment. The cost of each truck type is as follows: A = $50,000, B = $60,000, C = $70,000, D = $80,000, E = $90,000.\n// 50000 * A + 60000 * B + 70000 * C + 80000 * D + 90000 * E <= 500000\n\n## Generate Constraint-2:\nThe company must deploy at least 5 trucks of each type.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trucks deployed must not exceed 20.\n// A + B + C + D + E <= 20",
        "question": "A logistics company operates five different types of trucks: A, B, C, D, and E. The company needs to determine how many units of each type of truck to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n- Truck A has a fuel efficiency of 10 km/l and a cargo capacity of 5 tons.\n- Truck B has a fuel efficiency of 15 km/l and a cargo capacity of 7 tons.\n- Truck C has a fuel efficiency of 20 km/l and a cargo capacity of 9 tons.\n- Truck D has a fuel efficiency of 25 km/l and a cargo capacity of 11 tons.\n- Truck E has a fuel efficiency of 30 km/l and a cargo capacity of 13 tons.\nThe company has a budget of $500,000 for truck deployment. The cost of each truck type is as follows: A = $50,000, B = $60,000, C = $70,000, D = $80,000, E = $90,000. The company must deploy at least 5 trucks of each type. The total number of trucks deployed must not exceed 20.\nPlease help the company to maximize the total cargo capacity while minimizing the total fuel consumption, aiming to maximize the ratio of total cargo capacity to total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must deploy at least 5 trucks of each type.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCap = 5 * A + 7 * B + 9 * C + 11 * D + 13 * E # Total cargo capacity\nFuel = (10 * A + 15 * B + 20 * C + 25 * D + 30 * E) / 1000 # Total fuel consumption\n## the objective function is: Maximize (Cap) / (Fuel)\n## convert the division to multiplication\nmodel.addCons(obj * Fuel == Cap)\n\n# Add constraints\n## The company has a budget of $500,000 for truck deployment.\nmodel.addCons(50000 * A + 60000 * B + 70000 * C + 80000 * D + 90000 * E <= 500000)\n## The total number of trucks deployed must not exceed 20.\nmodel.addCons(A + B + C + D + E <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Maximized Cargo Capacity to Fuel Consumption Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in warehouse upgrades\": \"WarehouseInvestment\", \"range\": \"WarehouseInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of the trucks and the warehouse is affected by the warehouse upgrades. For each $1,000 invested in warehouse upgrades, the operational cost per truck decreases by $100. \nThe operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for both truck purchases and warehouse upgrades.\n// 20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100",
        "question": "A logistics company is planning its fleet expansion for the next year. They need to decide on the number of trucks to purchase for three different types: Small, Medium, and Large. Additionally, they need to determine the amount of money to invest in upgrading their warehouse facilities, which affects the storage efficiency and operational costs. The operational cost per truck decreases by $100 for each $1,000 invested in warehouse upgrades. The operational cost per Small truck is $5,000, per Medium truck is $7,000, and per Large truck is $10,000. The company aims to minimize the total operational cost of the fleet.\n\n| Truck Type | Purchase Cost |\n|------------|---------------|\n| Small      | $20,000       |\n| Medium     | $30,000       |\n| Large      | $50,000       |\n\nThe company has a budget of $1,000,000 for both truck purchases and warehouse upgrades. The total number of trucks cannot exceed 100. Please help the company determine the optimal number of each type of truck to purchase and the amount to invest in warehouse upgrades to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)  # number of Small trucks\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)  # number of Medium trucks\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)  # number of Large trucks\nWarehouseInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"WarehouseInvestment\", lb=0)  # investment in warehouse upgrades\n\n# Define objective function\nCostSmall = (5000 - 0.1 * WarehouseInvestment) * SmallTrucks\nCostMedium = (7000 - 0.1 * WarehouseInvestment) * MediumTrucks\nCostLarge = (10000 - 0.1 * WarehouseInvestment) * LargeTrucks\n# So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n# The company has a budget of $1,000,000 for both truck purchases and warehouse upgrades.\nmodel.addCons(20000 * SmallTrucks + 30000 * MediumTrucks + 50000 * LargeTrucks + WarehouseInvestment <= 1000000)\n# The total number of trucks cannot exceed 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Warehouse Investment: \", model.getVal(WarehouseInvestment))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n// Fuel cost per trip for TruckA: CostA = (50 - 0.02 * UpgradeA) * TripsA\n// Fuel cost per trip for TruckB: CostB = (60 - 0.03 * UpgradeB) * TripsB\n// Fuel cost per trip for TruckC: CostC = (70 - 0.04 * UpgradeC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for transportation and upgrades.\n// 50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip. The fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles. The company has a total budget of $30,000 for transportation and upgrades.\n\nPlease help the company to determine the optimal number of trips for each vehicle and the amount to invest in fuel-efficient upgrades to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nUpgradeA = model.addVar(name=\"UpgradeA\", lb=0) # investment in fuel-efficient upgrades for TruckA\nUpgradeB = model.addVar(name=\"UpgradeB\", lb=0) # investment in fuel-efficient upgrades for TruckB\nUpgradeC = model.addVar(name=\"UpgradeC\", lb=0) # investment in fuel-efficient upgrades for TruckC\n\n# Define objective function\nCostA = (50 - 0.02 * UpgradeA) * TripsA\nCostB = (60 - 0.03 * UpgradeB) * TripsB\nCostC = (70 - 0.04 * UpgradeC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $30,000 for transportation and upgrades.\nmodel.addCons(50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Investment in Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Investment in Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks.\n// Total fuel cost per km: FuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5) / (T1 + T2 + T3 + T4 + T5)\n// Total maintenance cost per km: MaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5) / (T1 + T2 + T3 + T4 + T5)\n// So, the objective function is: Minimize (FuelCost + MaintCost)\n\n## Generate Constraint-1:\nThe company has a budget of $500,000 to purchase trucks.\n// 10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000\n\n## Generate Constraint-2:\nThe total number of trucks cannot exceed 50.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nAt least 10% of the fleet must be type 5 trucks for long-distance routes.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods across the country. The company needs to determine the optimal number of each type of truck to maximize efficiency and minimize costs. Each type of truck has a different fuel efficiency and maintenance cost. Type 1 trucks have a fuel efficiency of 10 km/l and a maintenance cost of $100 per km. Type 2 trucks have a fuel efficiency of 15 km/l and a maintenance cost of $80 per km. Type 3 trucks have a fuel efficiency of 20 km/l and a maintenance cost of $70 per km. Type 4 trucks have a fuel efficiency of 25 km/l and a maintenance cost of $60 per km. Type 5 trucks have a fuel efficiency of 30 km/l and a maintenance cost of $50 per km. The company wants to minimize the total cost of fuel and maintenance per kilometer across all trucks. The company has a budget of $500,000 to purchase trucks. The total number of trucks cannot exceed 50. At least 10% of the fleet must be type 5 trucks for long-distance routes. Please help the company to minimize the total cost of fuel and maintenance per kilometer across all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost = (10 * T1 + 15 * T2 + 20 * T3 + 25 * T4 + 30 * T5)\nMaintCost = (100 * T1 + 80 * T2 + 70 * T3 + 60 * T4 + 50 * T5)\nTotalTrucks = T1 + T2 + T3 + T4 + T5\n## the objective function is: Minimize (FuelCost + MaintCost) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FuelCost + MaintCost)\n\n# Add constraints\n## The company has a budget of $500,000 to purchase trucks.\nmodel.addCons(10000 * T1 + 12000 * T2 + 15000 * T3 + 20000 * T4 + 25000 * T5 <= 500000)\n## The total number of trucks cannot exceed 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n## At least 10% of the fleet must be type 5 trucks for long-distance routes.\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Cost per Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device to optimize its profit. Additionally, the company must decide on the number of quality control checks to perform for each device type.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceA\": \"QC_A\", \"range\": \"QC_A >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceB\": \"QC_B\", \"range\": \"QC_B >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceC\": \"QC_C\", \"range\": \"QC_C >= 0\", \"type\": \"integer\"}\n// {\"number of quality control checks for DeviceD\": \"QC_D\", \"range\": \"QC_D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and each quality control check costs $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and each quality control check costs $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and each quality control check costs $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and each quality control check costs $11.\nThe company aims to maximize the total profit per unit of production, considering both the production and quality control costs.\n// Profit of DeviceA: Profit_A = (100 - 60) * A - 5 * QC_A\n// Profit of DeviceB: Profit_B = (150 - 90) * B - 7 * QC_B\n// Profit of DeviceC: Profit_C = (200 - 120) * C - 9 * QC_C\n// Profit of DeviceD: Profit_D = (250 - 150) * D - 11 * QC_D\n// So, the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / (A + B + C + D))\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for quality control checks.\n// 5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10,000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 100 units of each device.\n// A <= 100; B <= 100; C <= 100; D <= 100\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10% of each device's production is checked for quality.\n// QC_A >= 0.1 * A; QC_B >= 0.1 * B; QC_C >= 0.1 * C; QC_D >= 0.1 * D\n\n## Generate Constraint-4:\nThe company has a limited production capacity of 300 hours, with DeviceA requiring 2 hours per unit, DeviceB requiring 3 hours per unit, DeviceC requiring 4 hours per unit, and DeviceD requiring 5 hours per unit.\n// 2 * A + 3 * B + 4 * C + 5 * D <= 300\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n// D <= A + B + C",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the production quantity for each device and the number of quality control checks to perform for each device type to optimize its profit. The selling price, production cost, and cost per quality control check for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Cost per Quality Control Check |\n|--------|---------------|-----------------|--------------------------------|\n| DeviceA | $100 | $60 | $5 |\n| DeviceB | $150 | $90 | $7 |\n| DeviceC | $200 | $120 | $9 |\n| DeviceD | $250 | $150 | $11 |\n\nThe company has a total budget of $10,000 for quality control checks. The company can produce a maximum of 100 units of each device. The company wants to ensure that at least 10% of each device's production is checked for quality. The company has a limited production capacity of 300 hours, with DeviceA requiring 2 hours per unit, DeviceB requiring 3 hours per unit, DeviceC requiring 4 hours per unit, and DeviceD requiring 5 hours per unit. The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\n\nPlease help the company to maximize the total profit per unit of production, considering both the production and quality control costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=100) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0, ub=100) # number of units of DeviceD\nQC_A = model.addVar(vtype=\"INTEGER\", name=\"QC_A\", lb=0) # number of quality control checks for DeviceA\nQC_B = model.addVar(vtype=\"INTEGER\", name=\"QC_B\", lb=0) # number of quality control checks for DeviceB\nQC_C = model.addVar(vtype=\"INTEGER\", name=\"QC_C\", lb=0) # number of quality control checks for DeviceC\nQC_D = model.addVar(vtype=\"INTEGER\", name=\"QC_D\", lb=0) # number of quality control checks for DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * QC_A\nProfit_B = (150 - 90) * B - 7 * QC_B\nProfit_C = (200 - 120) * C - 9 * QC_C\nProfit_D = (250 - 150) * D - 11 * QC_D\nTotalProduction = A + B + C + D\n## the objective function is: Maximize ((Profit_A + Profit_B + Profit_C + Profit_D) / TotalProduction)\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The company has a total budget of $10,000 for quality control checks.\nmodel.addCons(5 * QC_A + 7 * QC_B + 9 * QC_C + 11 * QC_D <= 10000)\n## The company can produce a maximum of 100 units of each device.\nmodel.addCons(A <= 100)\nmodel.addCons(B <= 100)\nmodel.addCons(C <= 100)\nmodel.addCons(D <= 100)\n## The company wants to ensure that at least 10% of each device's production is checked for quality.\nmodel.addCons(QC_A >= 0.1 * A)\nmodel.addCons(QC_B >= 0.1 * B)\nmodel.addCons(QC_C >= 0.1 * C)\nmodel.addCons(QC_D >= 0.1 * D)\n## The company has a limited production capacity of 300 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D <= 300)\n## The company wants to ensure that the production of DeviceD does not exceed the combined production of DeviceA, DeviceB, and DeviceC.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Number of QC checks for DeviceA: \", model.getVal(QC_A))\n    print(\"Number of QC checks for DeviceB: \", model.getVal(QC_B))\n    print(\"Number of QC checks for DeviceC: \", model.getVal(QC_C))\n    print(\"Number of QC checks for DeviceD: \", model.getVal(QC_D))\n    print(\"Maximized Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1390,
        "var_num": 8,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Region1\": \"FuelTech1\", \"range\": \"FuelTech1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region2\": \"FuelTech2\", \"range\": \"FuelTech2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Region3\": \"FuelTech3\", \"range\": \"FuelTech3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n// Total profit for Region1: Profit1 = (1000 + 0.1 * FuelTech1) * Trucks1\n// Total profit for Region2: Profit2 = (1200 + 0.12 * FuelTech2) * Trucks2\n// Total profit for Region3: Profit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed across all regions is limited to 100 trucks.\n// Trucks1 + Trucks2 + Trucks3 <= 100\n\n## Generate Constraint-3:\nDue to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\n// Trucks1 >= 20; Trucks2 >= 30\n\n## Generate Constraint-4:\nThe investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\n// FuelTech1 <= 0.5 * (1000 * Trucks1)\n// FuelTech2 <= 0.5 * (1200 * Trucks2)\n// FuelTech3 <= 0.5 * (1100 * Trucks3)",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the number of trucks to deploy in each region to maximize profit while considering the cost of fuel, maintenance, and driver wages. Additionally, the company is considering investing in alternative fuel technologies for their trucks to reduce operational costs and environmental impact.\n\nThe profit per truck is affected by the investment in alternative fuel technologies, which reduces fuel and maintenance costs. The profit per truck in Region1 is $1000, but with each $1000 invested in alternative fuel technology, the profit increases by $100. The profit per truck in Region2 is $1200, and with each $1000 invested in alternative fuel technology, the profit increases by $120. The profit per truck in Region3 is $1100, and with each $1000 invested in alternative fuel technology, the profit increases by $110. The company aims to maximize the total profit from all regions.\n\nThe company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies. The total number of trucks that can be deployed across all regions is limited to 100 trucks. Due to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2. The investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\n\nPlease help the company to maximize the total profit from all regions.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=20) # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=30) # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Region3\nFuelTech1 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech1\", lb=0) # investment in alternative fuel technology for Region1\nFuelTech2 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech2\", lb=0) # investment in alternative fuel technology for Region2\nFuelTech3 = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelTech3\", lb=0) # investment in alternative fuel technology for Region3\n\n# Define objective function\n## The profit per truck is affected by the investment in alternative fuel technologies\nProfit1 = (1000 + 0.1 * FuelTech1) * Trucks1\nProfit2 = (1200 + 0.12 * FuelTech2) * Trucks2\nProfit3 = (1100 + 0.11 * FuelTech3) * Trucks3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The company has a total budget of $100,000 for truck operations and investments in alternative fuel technologies.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1100 * Trucks3 + FuelTech1 + FuelTech2 + FuelTech3 <= 100000)\n## The total number of trucks that can be deployed across all regions is limited to 100 trucks.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 100)\n## Due to regional regulations, the company must deploy at least 20 trucks in Region1 and 30 trucks in Region2.\nmodel.addCons(Trucks1 >= 20)\nmodel.addCons(Trucks2 >= 30)\n## The investment in alternative fuel technology cannot exceed 50% of the total budget allocated for each region.\nmodel.addCons(FuelTech1 <= 0.5 * (1000 * Trucks1))\nmodel.addCons(FuelTech2 <= 0.5 * (1200 * Trucks2))\nmodel.addCons(FuelTech3 <= 0.5 * (1100 * Trucks3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Alternative Fuel Technology for Region1: \", model.getVal(FuelTech1))\n    print(\"Investment in Alternative Fuel Technology for Region2: \", model.getVal(FuelTech2))\n    print(\"Investment in Alternative Fuel Technology for Region3: \", model.getVal(FuelTech3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1499,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products.\n// {\"number of hours machine M1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"integer\"}\n// {\"number of hours machine M5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine M1 produces 10 units of product A, 20 units of product B, and 30 units of product C per hour, with a cost of $50 per hour. Machine M2 produces 15 units of product A, 25 units of product B, and 35 units of product C per hour, with a cost of $60 per hour. Machine M3 produces 20 units of product A, 30 units of product B, and 40 units of product C per hour, with a cost of $70 per hour. Machine M4 produces 25 units of product A, 35 units of product B, and 45 units of product C per hour, with a cost of $80 per hour. Machine M5 produces 30 units of product A, 40 units of product B, and 50 units of product C per hour, with a cost of $90 per hour. The company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets.\n// Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\n// Production of product A: A = 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5\n// Production of product B: B = 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5\n// Production of product C: C = 30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total production of product A must be at least 1000 units.\n// 10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000\n\n## Generate Constraint-2:\nThe total production of product B must be at least 1500 units.\n// 20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company has five different machines (M1, M2, M3, M4, M5) that can be used to produce these products. Each machine has a different efficiency and cost per hour. Machine M1 produces 10 units of product A, 20 units of product B, and 30 units of product C per hour, with a cost of $50 per hour. Machine M2 produces 15 units of product A, 25 units of product B, and 35 units of product C per hour, with a cost of $60 per hour. Machine M3 produces 20 units of product A, 30 units of product B, and 40 units of product C per hour, with a cost of $70 per hour. Machine M4 produces 25 units of product A, 35 units of product B, and 45 units of product C per hour, with a cost of $80 per hour. Machine M5 produces 30 units of product A, 40 units of product B, and 50 units of product C per hour, with a cost of $90 per hour. The company needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C. The objective is to minimize the total cost of production while meeting the production targets. The total production of product A must be at least 1000 units, and the total production of product B must be at least 1500 units. Please help the company determine the optimal number of hours each machine should operate to minimize the total cost of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of hours machine M1 operates\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of hours machine M2 operates\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of hours machine M3 operates\nM4 = model.addVar(vtype=\"INTEGER\", name=\"M4\", lb=0) # number of hours machine M4 operates\nM5 = model.addVar(vtype=\"INTEGER\", name=\"M5\", lb=0) # number of hours machine M5 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost: Cost = 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5\nmodel.addCons(obj == 50 * M1 + 60 * M2 + 70 * M3 + 80 * M4 + 90 * M5)\n\n# Add constraints\n## The total production of product A must be at least 1000 units.\nmodel.addCons(10 * M1 + 15 * M2 + 20 * M3 + 25 * M4 + 30 * M5 >= 1000)\n## The total production of product B must be at least 1500 units.\nmodel.addCons(20 * M1 + 25 * M2 + 30 * M3 + 35 * M4 + 40 * M5 >= 1500)\n## The total production of product C must be at least 2000 units.\nmodel.addCons(30 * M1 + 35 * M2 + 40 * M3 + 45 * M4 + 50 * M5 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours machine M1 operates: \", model.getVal(M1))\n    print(\"Number of hours machine M2 operates: \", model.getVal(M2))\n    print(\"Number of hours machine M3 operates: \", model.getVal(M3))\n    print(\"Number of hours machine M4 operates: \", model.getVal(M4))\n    print(\"Number of hours machine M5 operates: \", model.getVal(M5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1364,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation.\n// {\"production quantity of DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"AutomationInvest\", \"range\": \"AutomationInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, of DeviceB is $150, and of DeviceC is $200. The investment in automation reduces the production cost per unit by $0.5 for every $1,000 invested. The selling price per unit of DeviceA is $150, of DeviceB is $200, and of DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n// Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n// Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for the quarter.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvest <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to determine the production quantity of each device for the next quarter, as well as the investment in automation technology to reduce production costs. The production costs decrease linearly with the investment in automation. The production cost per unit, selling price per unit, and the effect of automation investment on production costs are given in the following Table.\n\n| Device | Production Cost Per Unit | Selling Price Per Unit | Effect of Automation Investment |\n|--------|--------------------------|------------------------|---------------------------------|\n| DeviceA | $100                     | $150                   | $0.5 reduction per $1,000 invested |\n| DeviceB | $150                     | $200                   | $0.5 reduction per $1,000 invested |\n| DeviceC | $200                     | $250                   | $0.5 reduction per $1,000 invested |\n\nThe company has a total production capacity of 10,000 units for the quarter. The total investment in automation technology cannot exceed $50,000. The company aims to maximize the total profit from all devices. Please help the company determine the optimal production quantities and the investment in automation technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity of DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity of DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity of DeviceC\nAutomationInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvest\", lb=0) # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for DeviceA: ProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\n## Total profit for DeviceB: ProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\n## Total profit for DeviceC: ProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\nProfitA = (150 - (100 - 0.0005 * AutomationInvest)) * DeviceAQty\nProfitB = (200 - (150 - 0.0005 * AutomationInvest)) * DeviceBQty\nProfitC = (250 - (200 - 0.0005 * AutomationInvest)) * DeviceCQty\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for the quarter.\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Investment in Automation: \", model.getVal(AutomationInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1313,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n// {\"hours machine 4 operates\": \"M4\", \"range\": \"M4 >= 0\", \"type\": \"real\"}\n// {\"hours machine 5 operates\": \"M5\", \"range\": \"M5 >= 0\", \"type\": \"real\"}\n// {\"technicians assigned to machine 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"technicians assigned to machine 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components.\n// Production rate of machine 1: P1 = 100 * (1 + 0.05 * T1) * M1\n// Production rate of machine 2: P2 = 120 * (1 + 0.04 * T2) * M2\n// Production rate of machine 3: P3 = 140 * (1 + 0.03 * T3) * M3\n// Production rate of machine 4: P4 = 160 * (1 + 0.02 * T4) * M4\n// Production rate of machine 5: P5 = 180 * (1 + 0.01 * T5) * M5\n// The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\n\n## Generate Constraint-1:\nThere are a total of 30 technicians available.\n// T1 + T2 + T3 + T4 + T5 <= 30\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 10 hours per day.\n// M1 <= 10; M2 <= 10; M3 <= 10; M4 <= 10; M5 <= 10\n\n## Generate Constraint-3:\nThe number of technicians assigned to each machine must not exceed 10.\n// T1 <= 10; T2 <= 10; T3 <= 10; T4 <= 10; T5 <= 10",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to optimize the allocation of resources, specifically the number of hours each machine operates and the number of technicians assigned to each machine. Each machine produces a different quantity of components per hour, and the efficiency varies with the number of technicians assigned. The production rate of each machine is given by a nonlinear function of the number of technicians. The objective is to maximize the total production of all components. There are a total of 30 technicians available. Each machine can operate for a maximum of 10 hours per day. The number of technicians assigned to each machine must not exceed 10. Please help the plant manager to maximize the total production of all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\nM4 = model.addVar(vtype=\"CONTINUOUS\", name=\"M4\", lb=0) # hours machine 4 operates\nM5 = model.addVar(vtype=\"CONTINUOUS\", name=\"M5\", lb=0) # hours machine 5 operates\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # technicians assigned to machine 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # technicians assigned to machine 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # technicians assigned to machine 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # technicians assigned to machine 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # technicians assigned to machine 5\n\n# Define objective function\nP1 = 100 * (1 + 0.05 * T1) * M1\nP2 = 120 * (1 + 0.04 * T2) * M2\nP3 = 140 * (1 + 0.03 * T3) * M3\nP4 = 160 * (1 + 0.02 * T4) * M4\nP5 = 180 * (1 + 0.01 * T5) * M5\n# The objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# There are a total of 30 technicians available.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 30)\n# Each machine can operate for a maximum of 10 hours per day.\nmodel.addCons(M1 <= 10)\nmodel.addCons(M2 <= 10)\nmodel.addCons(M3 <= 10)\nmodel.addCons(M4 <= 10)\nmodel.addCons(M5 <= 10)\n# The number of technicians assigned to each machine must not exceed 10.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\nmodel.addCons(T4 <= 10)\nmodel.addCons(T5 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Hours Machine 4 Operates: \", model.getVal(M4))\n    print(\"Hours Machine 5 Operates: \", model.getVal(M5))\n    print(\"Technicians Assigned to Machine 1: \", model.getVal(T1))\n    print(\"Technicians Assigned to Machine 2: \", model.getVal(T2))\n    print(\"Technicians Assigned to Machine 3: \", model.getVal(T3))\n    print(\"Technicians Assigned to Machine 4: \", model.getVal(T4))\n    print(\"Technicians Assigned to Machine 5: \", model.getVal(T5))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 10,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost per truck on RouteA is $500, on RouteB is $600, and on RouteC is $700. The maintenance cost per truck on RouteA is $300, on RouteB is $400, and on RouteC is $500. The revenue per truck on RouteA is $1500, on RouteB is $2000, and on RouteC is $2500. The company aims to maximize the total net profit from all routes.\n// Total net profit for RouteA: Profit_A = (1500 - 500 - 300) * TrucksA\n// Total net profit for RouteB: Profit_B = (2000 - 600 - 400) * TrucksB\n// Total net profit for RouteC: Profit_C = (2500 - 700 - 500) * TrucksC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of trucks among three different routes: RouteA, RouteB, and RouteC. The company must decide how many trucks to allocate to each route to maximize efficiency while considering fuel costs, maintenance costs, and revenue per route. The fuel cost per truck on RouteA is $500, on RouteB is $600, and on RouteC is $700. The maintenance cost per truck on RouteA is $300, on RouteB is $400, and on RouteC is $500. The revenue per truck on RouteA is $1500, on RouteB is $2000, and on RouteC is $2500. The company aims to maximize the total net profit from all routes. The company has a total of 50 trucks available. Please help the company determine the optimal number of trucks to allocate to each route to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\nProfit_A = (1500 - 500 - 300) * TrucksA\nProfit_B = (2000 - 600 - 400) * TrucksB\nProfit_C = (2500 - 700 - 500) * TrucksC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: Luxury, Mid-range, and Affordable. The developer needs to determine the number of units to build for each property type. Additionally, the developer needs to decide on the level of eco-friendly features to incorporate into each property type, which affects the construction cost and potential selling price.\n// {\"number of Luxury units\": \"LuxuryUnits\", \"range\": \"LuxuryUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Mid-range units\": \"MidRangeUnits\", \"range\": \"MidRangeUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Affordable units\": \"AffordableUnits\", \"range\": \"AffordableUnits >= 0\", \"type\": \"integer\"}\n// {\"eco-friendly features for Luxury\": \"EcoLuxury\", \"range\": \"EcoLuxury >= 0\", \"type\": \"continuous\"}\n// {\"eco-friendly features for Mid-range\": \"EcoMidRange\", \"range\": \"EcoMidRange >= 0\", \"type\": \"continuous\"}\n// {\"eco-friendly features for Affordable\": \"EcoAffordable\", \"range\": \"EcoAffordable >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe selling price of each unit is influenced by the level of eco-friendly features. For Luxury units, the base price is $500,000, and for every $10,000 invested in eco-features, the price increases by $15,000 per unit. For Mid-range units, the base price is $300,000, and for every $10,000 invested in eco-features, the price increases by $10,000 per unit. For Affordable units, the base price is $150,000, and for every $10,000 invested in eco-features, the price increases by $5,000 per unit. The developer aims to maximize the total revenue from selling all units.\n// Revenue_Luxury = (500000 + 1.5 * EcoLuxury) * LuxuryUnits\n// Revenue_MidRange = (300000 + 1.0 * EcoMidRange) * MidRangeUnits\n// Revenue_Affordable = (150000 + 0.5 * EcoAffordable) * AffordableUnits\n// So, the objective function is: Maximize (Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\n\n## Generate Constraint-1:\nThe total construction budget is $20,000,000. The construction cost for Luxury units is $300,000 per unit, for Mid-range units is $200,000 per unit, and for Affordable units is $100,000 per unit. The cost of eco-friendly features for Luxury is $10,000 per unit, for Mid-range is $5,000 per unit, and for Affordable is $2,000 per unit.\n// 300000 * LuxuryUnits + 10000 * EcoLuxury + 200000 * MidRangeUnits + 5000 * EcoMidRange + 100000 * AffordableUnits + 2000 * EcoAffordable <= 20000000\n\n## Generate Constraint-2:\nThe total land available for construction is limited to 200 units.\n// LuxuryUnits + MidRangeUnits + AffordableUnits <= 200\n\n## Generate Constraint-3:\nDue to zoning regulations, the developer must build at least 50 Luxury units and no more than 100 Affordable units.\n// LuxuryUnits >= 50; AffordableUnits <= 100",
        "question": "A real estate developer is planning to build three types of residential properties: Luxury, Mid-range, and Affordable. The developer needs to determine the number of units to build for each property type and the level of eco-friendly features to incorporate into each property type, which affects the construction cost and potential selling price. The base selling price and the impact of eco-friendly features on the selling price for each property type are given in the following Table.\n\n| Property Type | Base Selling Price | Eco-friendly Feature Impact |\n|---------------|--------------------|-----------------------------|\n| Luxury        | $500,000           | $15,000 per $10,000 invested |\n| Mid-range     | $300,000           | $10,000 per $10,000 invested |\n| Affordable    | $150,000           | $5,000 per $10,000 invested |\n\nThe total construction budget is $20,000,000. The construction cost for Luxury units is $300,000 per unit, for Mid-range units is $200,000 per unit, and for Affordable units is $100,000 per unit. The cost of eco-friendly features for Luxury is $10,000 per unit, for Mid-range is $5,000 per unit, and for Affordable is $2,000 per unit. The total land available for construction is limited to 200 units. Due to zoning regulations, the developer must build at least 50 Luxury units and no more than 100 Affordable units.\n\nPlease help the developer to maximize the total revenue from selling all units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLuxuryUnits = model.addVar(vtype=\"INTEGER\", name=\"LuxuryUnits\", lb=0)  # number of Luxury units\nMidRangeUnits = model.addVar(vtype=\"INTEGER\", name=\"MidRangeUnits\", lb=0)  # number of Mid-range units\nAffordableUnits = model.addVar(vtype=\"INTEGER\", name=\"AffordableUnits\", lb=0)  # number of Affordable units\nEcoLuxury = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoLuxury\", lb=0)  # eco-friendly features for Luxury\nEcoMidRange = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoMidRange\", lb=0)  # eco-friendly features for Mid-range\nEcoAffordable = model.addVar(vtype=\"CONTINUOUS\", name=\"EcoAffordable\", lb=0)  # eco-friendly features for Affordable\n\n# Define objective function\nRevenue_Luxury = (500000 + 1.5 * EcoLuxury) * LuxuryUnits\nRevenue_MidRange = (300000 + 1.0 * EcoMidRange) * MidRangeUnits\nRevenue_Affordable = (150000 + 0.5 * EcoAffordable) * AffordableUnits\n# So, the objective function is: Maximize (Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Luxury + Revenue_MidRange + Revenue_Affordable)\n\n# Add constraints\n# The total construction budget is $20,000,000.\nmodel.addCons(300000 * LuxuryUnits + 10000 * EcoLuxury + 200000 * MidRangeUnits + 5000 * EcoMidRange + 100000 * AffordableUnits + 2000 * EcoAffordable <= 20000000)\n# The total land available for construction is limited to 200 units.\nmodel.addCons(LuxuryUnits + MidRangeUnits + AffordableUnits <= 200)\n# Due to zoning regulations, the developer must build at least 50 Luxury units and no more than 100 Affordable units.\nmodel.addCons(LuxuryUnits >= 50)\nmodel.addCons(AffordableUnits <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Luxury Units: \", model.getVal(LuxuryUnits))\n    print(\"Number of Mid-range Units: \", model.getVal(MidRangeUnits))\n    print(\"Number of Affordable Units: \", model.getVal(AffordableUnits))\n    print(\"Eco-friendly features for Luxury: \", model.getVal(EcoLuxury))\n    print(\"Eco-friendly features for Mid-range: \", model.getVal(EcoMidRange))\n    print(\"Eco-friendly features for Affordable: \", model.getVal(EcoAffordable))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1436,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities and fuel efficiencies.\n// {\"number of vehicle 1\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 2\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 3\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 4\": \"V4\", \"range\": \"V4 >= 0\", \"type\": \"integer\"}\n// {\"number of vehicle 5\": \"V5\", \"range\": \"V5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle 1 has a capacity of 100 units, a fuel efficiency of 5 km/liter, and a cost of $100 per day.\nVehicle 2 has a capacity of 150 units, a fuel efficiency of 7 km/liter, and a cost of $150 per day.\nVehicle 3 has a capacity of 200 units, a fuel efficiency of 10 km/liter, and a cost of $200 per day.\nVehicle 4 has a capacity of 250 units, a fuel efficiency of 12 km/liter, and a cost of $250 per day.\nVehicle 5 has a capacity of 300 units, a fuel efficiency of 15 km/liter, and a cost of $300 per day.\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The objective is to minimize the total cost of vehicles and fuel.\n// Total cost of vehicles: VehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\n// Total fuel consumption: FuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n// So, the objective function is: Minimize (VehicleCost + FuelConsumption)\n\n## Generate Constraint-1:\nThe total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for vehicle rental.\n// 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 10000",
        "question": "A logistics company needs to optimize its delivery routes using five different types of vehicles. Each vehicle has different capacities, fuel efficiencies, and daily costs. The details of each vehicle are provided in the following Table.\n\n| Vehicle | Capacity (units) | Fuel Efficiency (km/liter) | Daily Cost ($) |\n|---------|------------------|----------------------------|----------------|\n| 1       | 100              | 5                          | 100            |\n| 2       | 150              | 7                          | 150            |\n| 3       | 200              | 10                         | 200            |\n| 4       | 250              | 12                         | 250            |\n| 5       | 300              | 15                         | 300            |\n\nThe company needs to deliver at least 1000 units of goods over a distance of 500 km. The total capacity of the vehicles must meet or exceed the required delivery of 1000 units. The company has a budget of $10,000 for vehicle rental. \n\nPlease help the company to minimize the total cost of vehicles and fuel.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of vehicle 1\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of vehicle 2\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of vehicle 3\nV4 = model.addVar(vtype=\"INTEGER\", name=\"V4\", lb=0) # number of vehicle 4\nV5 = model.addVar(vtype=\"INTEGER\", name=\"V5\", lb=0) # number of vehicle 5\n\n# Define objective function\n## Total cost of vehicles: VehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\n## Total fuel consumption: FuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\n## So, the objective function is: Minimize (VehicleCost + FuelConsumption)\nVehicleCost = 100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5\nFuelConsumption = (500 / 5) * V1 + (500 / 7) * V2 + (500 / 10) * V3 + (500 / 12) * V4 + (500 / 15) * V5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == VehicleCost + FuelConsumption)\n\n# Add constraints\n## The total capacity of the vehicles must meet or exceed the required delivery of 1000 units.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 >= 1000)\n## The company has a budget of $10,000 for vehicle rental.\nmodel.addCons(100 * V1 + 150 * V2 + 200 * V3 + 250 * V4 + 300 * V5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicle 1: \", model.getVal(V1))\n    print(\"Number of Vehicle 2: \", model.getVal(V2))\n    print(\"Number of Vehicle 3: \", model.getVal(V3))\n    print(\"Number of Vehicle 4: \", model.getVal(V4))\n    print(\"Number of Vehicle 5: \", model.getVal(V5))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints.\n// {\"production rate of component 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 4\": \"P4\", \"range\": \"0 <= P4 <= 100\", \"type\": \"real\"}\n// {\"production rate of component 5\": \"P5\", \"range\": \"0 <= P5 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach component has a different profit margin and production cost. The profit per unit for component 1 is 5 - 0.01 * P1, for component 2 is 7 - 0.02 * P2, for component 3 is 6 - 0.015 * P3, for component 4 is 8 - 0.025 * P4, and for component 5 is 9 - 0.03 * P5. The objective is to maximize the total profit from all components.\n// The objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\n\n## Generate Constraint-1:\nThe total production capacity of the plant is limited to 400 units per day.\n// P1 + P2 + P3 + P4 + P5 <= 400\n\n## Generate Constraint-2:\nThe market demand for each component must be met. The demand for component 1 is at least 50 units, for component 2 is at least 70 units, for component 3 is at least 60 units, for component 4 is at least 80 units, and for component 5 is at least 90 units.\n// P1 >= 50; P2 >= 70; P3 >= 60; P4 >= 80; P5 >= 90\n\n## Generate Constraint-3:\nThe production of component 1 and component 2 cannot exceed 150 units combined.\n// P1 + P2 <= 150\n\n## Generate Constraint-4:\nThe production of component 3 and component 4 must be at least 100 units combined.\n// P3 + P4 >= 100",
        "question": "A manufacturing plant produces 5 different types of electronic components. The plant manager needs to determine the optimal production rate for each component to maximize profit while meeting market demand and resource constraints. The profit per unit and the production cost for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost |\n|-----------|-----------------|-----------------|\n| 1         | 5 - 0.01 * P1   | -               |\n| 2         | 7 - 0.02 * P2   | -               |\n| 3         | 6 - 0.015 * P3  | -               |\n| 4         | 8 - 0.025 * P4  | -               |\n| 5         | 9 - 0.03 * P5   | -               |\n\nThe total production capacity of the plant is limited to 400 units per day. The market demand for each component must be met, with the demand for component 1 being at least 50 units, for component 2 at least 70 units, for component 3 at least 60 units, for component 4 at least 80 units, and for component 5 at least 90 units. The production of component 1 and component 2 cannot exceed 150 units combined. The production of component 3 and component 4 must be at least 100 units combined.\n\nPlease help the plant manager to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of component 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of component 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of component 3\nP4 = model.addVar(vtype=\"CONTINUOUS\", name=\"P4\", lb=0, ub=100) # production rate of component 4\nP5 = model.addVar(vtype=\"CONTINUOUS\", name=\"P5\", lb=0, ub=100) # production rate of component 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (5 - 0.01 * P1) * P1\nProfit_P2 = (7 - 0.02 * P2) * P2\nProfit_P3 = (6 - 0.015 * P3) * P3\nProfit_P4 = (8 - 0.025 * P4) * P4\nProfit_P5 = (9 - 0.03 * P5) * P5\n## the objective function is: Maximize (5 - 0.01 * P1) * P1 + (7 - 0.02 * P2) * P2 + (6 - 0.015 * P3) * P3 + (8 - 0.025 * P4) * P4 + (9 - 0.03 * P5) * P5\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3 + Profit_P4 + Profit_P5)\n\n# Add constraints\n## The total production capacity of the plant is limited to 400 units per day.\nmodel.addCons(P1 + P2 + P3 + P4 + P5 <= 400)\n## The market demand for each component must be met.\nmodel.addCons(P1 >= 50)\nmodel.addCons(P2 >= 70)\nmodel.addCons(P3 >= 60)\nmodel.addCons(P4 >= 80)\nmodel.addCons(P5 >= 90)\n## The production of component 1 and component 2 cannot exceed 150 units combined.\nmodel.addCons(P1 + P2 <= 150)\n## The production of component 3 and component 4 must be at least 100 units combined.\nmodel.addCons(P3 + P4 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Component 1: \", model.getVal(P1))\n    print(\"Production Rate of Component 2: \", model.getVal(P2))\n    print(\"Production Rate of Component 3: \", model.getVal(P3))\n    print(\"Production Rate of Component 4: \", model.getVal(P4))\n    print(\"Production Rate of Component 5: \", model.getVal(P5))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. \nAt warehouse 1, the cost per truck is $500 per day.\nAt warehouse 2, the cost per truck is $600 per day.\nAt warehouse 3, the cost per truck is $700 per day.\nAt warehouse 4, the cost per truck is $800 per day.\nAt warehouse 5, the cost per truck is $900 per day.\nThe company aims to minimize the total daily operational cost of all trucks.\n// Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\n// Objective function: Minimize Total cost\n\n## Generate Constraint-1:\nThe total number of trucks available across all warehouses is 100.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates 5 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery demands. The cost of operating a truck varies per warehouse due to regional fuel prices and maintenance costs. At warehouse 1, the cost per truck is $500 per day. At warehouse 2, the cost per truck is $600 per day. At warehouse 3, the cost per truck is $700 per day. At warehouse 4, the cost per truck is $800 per day. At warehouse 5, the cost per truck is $900 per day. The company aims to minimize the total daily operational cost of all trucks. The total number of trucks available across all warehouses is 100. Please help the company determine the optimal number of trucks to allocate to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5\nmodel.addCons(obj == 500 * T1 + 600 * T2 + 700 * T3 + 800 * T4 + 900 * T5)\n\n# Add constraints\n## The total number of trucks available across all warehouses is 100.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 805,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of device D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of device E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost_A = 20A^2, Cost_B = 30B^2, Cost_C = 40C^2, Cost_D = 50D^2, Cost_E = 60E^2. The company aims to maximize its total profit.\n// Profit of A: Profit_A = 50A - 20A^2\n// Profit of B: Profit_B = 70B - 30B^2\n// Profit of C: Profit_C = 90C - 40C^2\n// Profit of D: Profit_D = 110D - 50D^2\n// Profit of E: Profit_E = 130E - 60E^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20A^2 + 30B^2 + 40C^2 + 50D^2 + 60E^2 <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50\n\n## Generate Constraint-3:\nThe total production quantity of device E should not exceed the combined production of devices A, B, and C.\n// E <= A + B + C\n\n## Generate Constraint-4:\nThe total production quantity of device D should not exceed the combined production of devices A, B, C, and E.\n// D <= A + B + C + E\n\n## Generate Constraint-5:\nThe company has a limited storage capacity and can store at most 500 units of devices in total.\n// A + B + C + D + E <= 500",
        "question": "A manufacturing company produces five types of electronic devices: A, B, C, D, and E. The company needs to determine the production quantity of each device to optimize its profit margin. The profit per unit for device A is $50, for device B is $70, for device C is $90, for device D is $110, and for device E is $130. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost_A = 20A^2, Cost_B = 30B^2, Cost_C = 40C^2, Cost_D = 50D^2, Cost_E = 60E^2. The company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device. The total production quantity of device E should not exceed the combined production of devices A, B, and C. The total production quantity of device D should not exceed the combined production of devices A, B, C, and E. The company has a limited storage capacity and can store at most 500 units of devices in total. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50) # number of units of device D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50) # number of units of device E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = 50A - 20A^2\n## Profit of B: Profit_B = 70B - 30B^2\n## Profit of C: Profit_C = 90C - 40C^2\n## Profit of D: Profit_D = 110D - 50D^2\n## Profit of E: Profit_E = 130E - 60E^2\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\nmodel.addCons(obj == 50*A - 20*A**2 + 70*B - 30*B**2 + 90*C - 40*C**2 + 110*D - 50*D**2 + 130*E - 60*E**2)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(20*A**2 + 30*B**2 + 40*C**2 + 50*D**2 + 60*E**2 <= 10000)\n## The total production quantity of device E should not exceed the combined production of devices A, B, and C.\nmodel.addCons(E <= A + B + C)\n## The total production quantity of device D should not exceed the combined production of devices A, B, C, and E.\nmodel.addCons(D <= A + B + C + E)\n## The company has a limited storage capacity and can store at most 500 units of devices in total.\nmodel.addCons(A + B + C + D + E <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Number of Device D: \", model.getVal(D))\n    print(\"Number of Device E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Trucks\": \"EfficiencyT\", \"range\": \"EfficiencyT >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Vans\": \"EfficiencyV\", \"range\": \"EfficiencyV >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Bikes\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n// Total annual fuel cost for Trucks: CostT = (100 - 0.01 * EfficiencyT) * Trucks\n// Total annual fuel cost for Vans: CostV = (100 - 0.015 * EfficiencyV) * Vans\n// Total annual fuel cost for Bikes: CostB = (100 - 0.02 * EfficiencyB) * Bikes\n// So, the objective function is: Minimize (CostT + CostV + CostB)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades.\n// Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase and also how much to invest in upgrading the fuel efficiency of each type of vehicle. The fuel efficiency of each vehicle type improves with investment, reducing operational costs. The cost reduction per unit of fuel saved is $0.50 for Trucks, $0.30 for Vans, and $0.10 for Bikes. The fuel efficiency improvement is nonlinear, with a diminishing return as more is invested. Specifically, for every $1000 invested, the fuel efficiency of Trucks improves by 1%, Vans by 1.5%, and Bikes by 2%. The company aims to minimize the total annual fuel cost.\n\n| Vehicle Type | Cost Reduction per Unit of Fuel Saved | Fuel Efficiency Improvement per $1000 Invested |\n|--------------|---------------------------------------|----------------------------------------------|\n| Trucks       | $0.50                                 | 1%                                           |\n| Vans         | $0.30                                 | 1.5%                                         |\n| Bikes        | $0.10                                 | 2%                                           |\n\nThe company has a budget of $100,000 for vehicle purchases and fuel efficiency upgrades. Please help the company to determine the optimal number of each type of vehicle to purchase and the investment in fuel efficiency to minimize the total annual fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\nEfficiencyT = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyT\", lb=0)  # investment in fuel efficiency for Trucks\nEfficiencyV = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyV\", lb=0)  # investment in fuel efficiency for Vans\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in fuel efficiency for Bikes\n\n# Define objective function\nCostT = (100 - 0.01 * EfficiencyT) * Trucks\nCostV = (100 - 0.015 * EfficiencyV) * Vans\nCostB = (100 - 0.02 * EfficiencyB) * Bikes\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostT + CostV + CostB)\n\n# Add constraints\nmodel.addCons(Trucks + Vans + Bikes + EfficiencyT + EfficiencyV + EfficiencyB <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Investment in Fuel Efficiency for Trucks: \", model.getVal(EfficiencyT))\n    print(\"Investment in Fuel Efficiency for Vans: \", model.getVal(EfficiencyV))\n    print(\"Investment in Fuel Efficiency for Bikes: \", model.getVal(EfficiencyB))\n    print(\"Minimized Total Annual Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1545,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints such as production capacity, market demand, and raw material availability.\n// {\"number of units of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductD\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $60. The company aims to maximize the total profit from all products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 90 * ProductC + 60 * ProductD\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// ProductA + ProductB + ProductC + ProductD <= 1000\n\n## Generate Constraint-2:\nThe market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week.\n// ProductA >= 200\n// ProductB >= 150\n\n## Generate Constraint-3:\nThe raw material required for producing one unit of ProductC is twice that of ProductA, and the company has only enough raw material to produce 400 units of ProductC.\n// ProductC <= 400",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the optimal production quantity for each product to maximize profit while considering various constraints such as production capacity, market demand, and raw material availability. The profit per unit for ProductA is $50, for ProductB is $70, for ProductC is $90, and for ProductD is $60. The company aims to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per week. The market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week. The raw material required for producing one unit of ProductC is twice that of ProductA, and the company has only enough raw material to produce 400 units of ProductC. Please help the company to determine the optimal production quantities for each product to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of ProductC\nProductD = model.addVar(vtype=\"INTEGER\", name=\"ProductD\", lb=0) # number of units of ProductD\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 90 * ProductC + 60 * ProductD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD <= 1000)\n# The market demand for ProductA is at least 200 units per week, and for ProductB is at least 150 units per week.\nmodel.addCons(ProductA >= 200)\nmodel.addCons(ProductB >= 150)\n# The raw material required for producing one unit of ProductC is twice that of ProductA, and the company has only enough raw material to produce 400 units of ProductC.\nmodel.addCons(ProductC <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(ProductA))\n    print(\"Number of ProductB: \", model.getVal(ProductB))\n    print(\"Number of ProductC: \", model.getVal(ProductC))\n    print(\"Number of ProductD: \", model.getVal(ProductD))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit of ProductA\": \"LaborA\", \"range\": \"LaborA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductB\": \"LaborB\", \"range\": \"LaborB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit of ProductC\": \"LaborC\", \"range\": \"LaborC >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductA\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductB\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in machinery for ProductC\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\n// Total revenue for ProductA: RevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\n// Total revenue for ProductB: RevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\n// Total revenue for ProductC: RevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total capital investment in advanced machinery cannot exceed $100,000.\n// MachineryA + MachineryB + MachineryC <= 100000\n\n## Generate Constraint-3:\nThe total marketing budget cannot exceed $50,000.\n// MarketingA + MarketingB + MarketingC <= 50000\n\n## Generate Constraint-4:\nDue to market demand, the company must produce at least 50 units of ProductA and 100 units of ProductB.\n// UnitsA >= 50; UnitsB >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the labor hours allocated to each product, and the amount of capital investment in advanced machinery for each product. The advanced machinery reduces the labor hours required per unit of product. The company also needs to determine the marketing budget for each product, which affects the sales volume. The labor hours per unit decrease by 1 hour for every $10,000 invested in advanced machinery for that product. The initial labor hours per unit for ProductA is 10 hours, for ProductB is 15 hours, and for ProductC is 20 hours. The revenue per unit is $100 for ProductA, $150 for ProductB, and $200 for ProductC. The marketing budget increases the sales volume by 1 unit for every $100 spent. The company aims to maximize the total revenue from all products.\n\n| Product | Initial Labor Hours per Unit | Revenue per Unit |\n|---------|------------------------------|------------------|\n| ProductA | 10 hours                     | $100             |\n| ProductB | 15 hours                     | $150             |\n| ProductC | 20 hours                     | $200             |\n\nThe company has a total of 10,000 labor hours available for the month. The total capital investment in advanced machinery cannot exceed $100,000. The total marketing budget cannot exceed $50,000. Due to market demand, the company must produce at least 50 units of ProductA and 100 units of ProductB.\n\nPlease help the company to maximize the total revenue from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100)  # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of ProductC\nLaborA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborA\", lb=0)  # labor hours per unit of ProductA\nLaborB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborB\", lb=0)  # labor hours per unit of ProductB\nLaborC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborC\", lb=0)  # labor hours per unit of ProductC\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0)  # capital investment in machinery for ProductA\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0)  # capital investment in machinery for ProductB\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0)  # capital investment in machinery for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0)  # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0)  # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0)  # marketing budget for ProductC\n\n# Define objective function\nRevenueA = (100 * (UnitsA + 0.001 * MarketingA)) - (LaborA * UnitsA)\nRevenueB = (150 * (UnitsB + 0.001 * MarketingB)) - (LaborB * UnitsB)\nRevenueC = (200 * (UnitsC + 0.001 * MarketingC)) - (LaborC * UnitsC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(LaborA * UnitsA + LaborB * UnitsB + LaborC * UnitsC <= 10000)\nmodel.addCons(MachineryA + MachineryB + MachineryC <= 100000)\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 50000)\nmodel.addCons(UnitsA >= 50)\nmodel.addCons(UnitsB >= 100)\n\n# Constraint to link labor hours with machinery investment\nmodel.addCons(LaborA == 10 - MachineryA / 10000)\nmodel.addCons(LaborB == 15 - MachineryB / 10000)\nmodel.addCons(LaborC == 20 - MachineryC / 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of Units of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of Units of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit of ProductA: \", model.getVal(LaborA))\n    print(\"Labor Hours per Unit of ProductB: \", model.getVal(LaborB))\n    print(\"Labor Hours per Unit of ProductC: \", model.getVal(LaborC))\n    print(\"Capital Investment in Machinery for ProductA: \", model.getVal(MachineryA))\n    print(\"Capital Investment in Machinery for ProductB: \", model.getVal(MachineryB))\n    print(\"Capital Investment in Machinery for ProductC: \", model.getVal(MachineryC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1618,
        "var_num": 12,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. The cost per truck on route 1 is $1000, on route 2 is $1200, on route 3 is $1500, on route 4 is $1300, and on route 5 is $1400. The revenue per truck on route 1 is $1800, on route 2 is $2000, on route 3 is $2200, on route 4 is $2100, and on route 5 is $2300. The company wants to maximize the total net profit, which is the difference between the total revenue and the total cost.\n// Cost_1 = 1000 * T1; Cost_2 = 1200 * T2; Cost_3 = 1500 * T3; Cost_4 = 1300 * T4; Cost_5 = 1400 * T5\n// Revenue_1 = 1800 * T1; Revenue_2 = 2000 * T2; Revenue_3 = 2200 * T3; Revenue_4 = 2100 * T4; Revenue_5 = 2300 * T5\n// Net_Profit_1 = Revenue_1 - Cost_1; Net_Profit_2 = Revenue_2 - Cost_2; Net_Profit_3 = Revenue_3 - Cost_3; Net_Profit_4 = Revenue_4 - Cost_4; Net_Profit_5 = Revenue_5 - Cost_5\n// So, the objective function is: Maximize (Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100\n\n## Generate Constraint-2:\nEach route has a maximum capacity for trucks. Route 1 can handle up to 20 trucks, route 2 up to 25 trucks, route 3 up to 30 trucks, route 4 up to 20 trucks, and route 5 up to 15 trucks.\n// T1 <= 20; T2 <= 25; T3 <= 30; T4 <= 20; T5 <= 15\n\n## Generate Constraint-3:\nThe company aims to maintain a minimum service level on each route. Route 1 requires at least 5 trucks, route 2 at least 10 trucks, route 3 at least 15 trucks, route 4 at least 5 trucks, and route 5 at least 3 trucks.\n// T1 >= 5; T2 >= 10; T3 >= 15; T4 >= 5; T5 >= 3",
        "question": "A logistics company operates five different routes for delivering goods and needs to determine the number of trucks to allocate to each route to optimize their operations. The cost and revenue per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck | Maximum Capacity | Minimum Service Level |\n|-------|----------------|-------------------|------------------|-----------------------|\n| 1     | $1000          | $1800             | 20 trucks        | 5 trucks              |\n| 2     | $1200          | $2000             | 25 trucks        | 10 trucks             |\n| 3     | $1500          | $2200             | 30 trucks        | 15 trucks             |\n| 4     | $1300          | $2100             | 20 trucks        | 5 trucks              |\n| 5     | $1400          | $2300             | 15 trucks        | 3 trucks              |\n\nThe company has a total of 100 trucks available for allocation. Each route has a maximum capacity for trucks as specified in the table. The company aims to maintain a minimum service level on each route as also specified in the table. \n\nPlease help the company to maximize the total net profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=5, ub=20) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=10, ub=25) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=15, ub=30) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=5, ub=20) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=3, ub=15) # number of trucks on route 5\n\n# Define objective function\nCost_1 = 1000 * T1\nCost_2 = 1200 * T2\nCost_3 = 1500 * T3\nCost_4 = 1300 * T4\nCost_5 = 1400 * T5\nRevenue_1 = 1800 * T1\nRevenue_2 = 2000 * T2\nRevenue_3 = 2200 * T3\nRevenue_4 = 2100 * T4\nRevenue_5 = 2300 * T5\nNet_Profit_1 = Revenue_1 - Cost_1\nNet_Profit_2 = Revenue_2 - Cost_2\nNet_Profit_3 = Revenue_3 - Cost_3\nNet_Profit_4 = Revenue_4 - Cost_4\nNet_Profit_5 = Revenue_5 - Cost_5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_1 + Net_Profit_2 + Net_Profit_3 + Net_Profit_4 + Net_Profit_5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route 1: \", model.getVal(T1))\n    print(\"Number of Trucks on Route 2: \", model.getVal(T2))\n    print(\"Number of Trucks on Route 3: \", model.getVal(T3))\n    print(\"Number of Trucks on Route 4: \", model.getVal(T4))\n    print(\"Number of Trucks on Route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1248,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in energy-efficient technologies for each product line, which will reduce the energy cost per unit produced.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductD\": \"QuantityD\", \"range\": \"QuantityD >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency for ProductA\": \"InvestmentA\", \"range\": \"InvestmentA >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductB\": \"InvestmentB\", \"range\": \"InvestmentB >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductC\": \"InvestmentC\", \"range\": \"InvestmentC >= 0\", \"type\": \"continuous\"}\n// {\"investment in energy efficiency for ProductD\": \"InvestmentD\", \"range\": \"InvestmentD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit for each product decreases by $0.5 for every $1,000 invested in energy efficiency for that product. The initial energy cost per unit for ProductA is $5, for ProductB is $6, for ProductC is $7, and for ProductD is $8. The selling price per unit is $15 for ProductA, $20 for ProductB, $25 for ProductC, and $30 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (15 - 5 + 0.0005 * InvestmentA) * QuantityA\n// Total profit for ProductB: ProfitB = (20 - 6 + 0.0005 * InvestmentB) * QuantityB\n// Total profit for ProductC: ProfitC = (25 - 7 + 0.0005 * InvestmentC) * QuantityC\n// Total profit for ProductD: ProfitD = (30 - 8 + 0.0005 * InvestmentD) * QuantityD\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $40,000 for energy efficiency investments.\n// InvestmentA + InvestmentB + InvestmentC + InvestmentD <= 40000\n\n## Generate Constraint-2:\nThe total production capacity for the next quarter is 10,000 units.\n// QuantityA + QuantityB + QuantityC + QuantityD <= 10000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\n// QuantityA >= 1000; QuantityB >= 2000\n\n## Generate Constraint-4:\nThe company wants to ensure that the investment in energy efficiency for ProductC does not exceed the combined investment for ProductA and ProductB.\n// InvestmentC <= InvestmentA + InvestmentB",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter and the investment in energy-efficient technologies for each product line. The energy cost per unit for each product decreases by $0.5 for every $1,000 invested in energy efficiency for that product. The initial energy cost per unit for ProductA is $5, for ProductB is $6, for ProductC is $7, and for ProductD is $8. The selling price per unit is $15 for ProductA, $20 for ProductB, $25 for ProductC, and $30 for ProductD. The company aims to maximize the total profit from all products. The company has a total budget of $40,000 for energy efficiency investments. The total production capacity for the next quarter is 10,000 units. The company must produce at least 1,000 units of ProductA and 2,000 units of ProductB. The company wants to ensure that the investment in energy efficiency for ProductC does not exceed the combined investment for ProductA and ProductB. Please help the company determine the optimal production quantities and investments to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=2000) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nQuantityD = model.addVar(vtype=\"INTEGER\", name=\"QuantityD\", lb=0) # production quantity of ProductD\nInvestmentA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentA\", lb=0) # investment in energy efficiency for ProductA\nInvestmentB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentB\", lb=0) # investment in energy efficiency for ProductB\nInvestmentC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentC\", lb=0) # investment in energy efficiency for ProductC\nInvestmentD = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestmentD\", lb=0) # investment in energy efficiency for ProductD\n\n# Define objective function\nProfitA = (15 - 5 + 0.0005 * InvestmentA) * QuantityA\nProfitB = (20 - 6 + 0.0005 * InvestmentB) * QuantityB\nProfitC = (25 - 7 + 0.0005 * InvestmentC) * QuantityC\nProfitD = (30 - 8 + 0.0005 * InvestmentD) * QuantityD\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n# The company has a total budget of $40,000 for energy efficiency investments.\nmodel.addCons(InvestmentA + InvestmentB + InvestmentC + InvestmentD <= 40000)\n# The total production capacity for the next quarter is 10,000 units.\nmodel.addCons(QuantityA + QuantityB + QuantityC + QuantityD <= 10000)\n# The company must produce at least 1,000 units of ProductA and 2,000 units of ProductB.\nmodel.addCons(QuantityA >= 1000)\nmodel.addCons(QuantityB >= 2000)\n# The company wants to ensure that the investment in energy efficiency for ProductC does not exceed the combined investment for ProductA and ProductB.\nmodel.addCons(InvestmentC <= InvestmentA + InvestmentB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Quantity of ProductD: \", model.getVal(QuantityD))\n    print(\"Investment in ProductA: \", model.getVal(InvestmentA))\n    print(\"Investment in ProductB: \", model.getVal(InvestmentB))\n    print(\"Investment in ProductC: \", model.getVal(InvestmentC))\n    print(\"Investment in ProductD: \", model.getVal(InvestmentD))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\n// {\"number of trips for truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips for truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach truck type has different fuel efficiency and cargo capacity. The profit per trip varies based on these factors. The company aims to maximize the total profit per unit of fuel consumed.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\n// So, the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for fuel costs per week.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 5 trips are made by each type of truck per week.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe company has a total of 500 hours available for all trucks to operate per week.\n// A + B + C + D + E <= 500\n\n## Generate Constraint-4:\nThe company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\n// D <= A + B + C",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to decide the number of trips each type of truck should make to optimize its operations. There are five types of trucks: A, B, C, D, and E.\nFor Truck A, the profit per trip is $500, and the fuel consumption is 10 liters.\nFor Truck B, the profit per trip is $700, and the fuel consumption is 15 liters.\nFor Truck C, the profit per trip is $900, and the fuel consumption is 20 liters.\nFor Truck D, the profit per trip is $1100, and the fuel consumption is 25 liters.\nFor Truck E, the profit per trip is $1300, and the fuel consumption is 30 liters.\nThe company has a budget of $10,000 for fuel costs per week. The company wants to ensure that at least 5 trips are made by each type of truck per week. The company has a total of 500 hours available for all trucks to operate per week. The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\nPlease help the company to maximize the total profit per unit of fuel consumed.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 5 trips are made by each type of truck per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips for truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips for truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips for truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips for truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips for truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E\nFuelConsumption = 10 * A + 15 * B + 20 * C + 25 * D + 30 * E\n## the objective function is: Maximize (500 * A + 700 * B + 900 * C + 1100 * D + 1300 * E) / (10 * A + 15 * B + 20 * C + 25 * D + 30 * E)\n## convert the division to multiplication\nmodel.addCons(obj * FuelConsumption == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for fuel costs per week.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 10000)\n## The company has a total of 500 hours available for all trucks to operate per week.\nmodel.addCons(A + B + C + D + E <= 500)\n## The company wants to ensure that the total number of trips made by Truck D does not exceed the combined trips of Trucks A, B, and C.\nmodel.addCons(D <= A + B + C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips for Truck A: \", model.getVal(A))\n    print(\"Number of trips for Truck B: \", model.getVal(B))\n    print(\"Number of trips for Truck C: \", model.getVal(C))\n    print(\"Number of trips for Truck D: \", model.getVal(D))\n    print(\"Number of trips for Truck E: \", model.getVal(E))\n    print(\"Maximized Profit per Unit of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric Cars (EC), Hybrid Cars (HC), and Hydrogen Cars (HC2). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production constraints.\n// {\"quantity of EC\": \"EC\", \"range\": \"EC >= 0\", \"type\": \"integer\"}\n// {\"quantity of HC\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n// {\"quantity of HC2\": \"HC2\", \"range\": \"HC2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured by the reduction in CO2 emissions per unit produced. For Electric Cars, the reduction is 100 kg CO2 per unit, for Hybrid Cars, it's 70 kg CO2 per unit, and for Hydrogen Cars, it's 120 kg CO2 per unit. The production cost per unit for EC is $20,000, for HC is $25,000, and for HC2 is $30,000. The manufacturer aims to maximize the total environmental impact (reduction in CO2 emissions) per dollar spent on production.\n// Impact_EC = 100 * EC - 20000 * EC\n// Impact_HC = 70 * HC - 25000 * HC\n// Impact_HC2 = 120 * HC2 - 30000 * HC2\n// So, the objective function is: Maximize (Impact_EC + Impact_HC + Impact_HC2) / (20000 * EC + 25000 * HC + 30000 * HC2)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * EC + 25000 * HC + 30000 * HC2 <= 1000000\n\n## Generate Constraint-2:\nThe production capacity for each type of vehicle is limited. The maximum production capacity for EC is 30 units, for HC is 40 units, and for HC2 is 20 units.\n// EC <= 30\n// HC <= 40\n// HC2 <= 20",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric Cars (EC), Hybrid Cars (HC), and Hydrogen Cars (HC2). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production constraints. The environmental impact of each vehicle type is measured by the reduction in CO2 emissions per unit produced. For Electric Cars, the reduction is 100 kg CO2 per unit, for Hybrid Cars, it's 70 kg CO2 per unit, and for Hydrogen Cars, it's 120 kg CO2 per unit. The production cost per unit for EC is $20,000, for HC is $25,000, and for HC2 is $30,000. The manufacturer aims to maximize the total environmental impact (reduction in CO2 emissions) per dollar spent on production. The manufacturer has a total production budget of $1,000,000. The production capacity for each type of vehicle is limited. The maximum production capacity for EC is 30 units, for HC is 40 units, and for HC2 is 20 units. Please help the manufacturer to maximize the total environmental impact per dollar spent on production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nEC = model.addVar(vtype=\"INTEGER\", name=\"EC\", lb=0, ub=30) # quantity of EC\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=0, ub=40) # quantity of HC\nHC2 = model.addVar(vtype=\"INTEGER\", name=\"HC2\", lb=0, ub=20) # quantity of HC2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_EC = 100 * EC - 20000 * EC\nImpact_HC = 70 * HC - 25000 * HC\nImpact_HC2 = 120 * HC2 - 30000 * HC2\nProductionCost = 20000 * EC + 25000 * HC + 30000 * HC2\n## the objective function is: Maximize (Impact_EC + Impact_HC + Impact_HC2) / ProductionCost\n## convert the division to multiplication\nmodel.addCons(obj * ProductionCost == Impact_EC + Impact_HC + Impact_HC2)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * EC + 25000 * HC + 30000 * HC2 <= 1000000)\n## The production capacity for each type of vehicle is limited.\nmodel.addCons(EC <= 30)\nmodel.addCons(HC <= 40)\nmodel.addCons(HC2 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric Cars: \", model.getVal(EC))\n    print(\"Quantity of Hybrid Cars: \", model.getVal(HC))\n    print(\"Quantity of Hydrogen Cars: \", model.getVal(HC2))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold.\n// Cost of route A: Cost_A = 2 * A\n// Cost of route B: Cost_B = 3 * B\n// Cost of route C: Cost_C = 4 * C\n// Cost of route D: Cost_D = 5 * D\n// Cost of route E: Cost_E = 6 * E\n// Time spent on route A: Time_A = 1 / 30 * A\n// Time spent on route B: Time_B = 1 / 40 * B\n// Time spent on route C: Time_C = 1 / 50 * C\n// Time spent on route D: Time_D = 1 / 60 * D\n// Time spent on route E: Time_E = 1 / 70 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to the constraint that Time_A + Time_B + Time_C + Time_D + Time_E <= T_max\n\n## Generate Constraint-1:\nThe total time spent on all routes must not exceed 100 hours.\n// (1 / 30 * A) + (1 / 40 * B) + (1 / 50 * C) + (1 / 60 * D) + (1 / 70 * E) <= 100\n\n## Generate Constraint-2:\nThe company has a budget of $2000 for operational costs.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different average speed. Route A costs $2 per mile and averages 30 mph. Route B costs $3 per mile and averages 40 mph. Route C costs $4 per mile and averages 50 mph. Route D costs $5 per mile and averages 60 mph. Route E costs $6 per mile and averages 70 mph. The company aims to minimize the total cost of operations while ensuring that the total time spent on all routes does not exceed a certain threshold. The total time spent on all routes must not exceed 100 hours, and the company has a budget of $2000 for operational costs. Please help the company to minimize the total cost of operations (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E) subject to the constraint that the total time spent on all routes (Time_A + Time_B + Time_C + Time_D + Time_E) does not exceed 100 hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks on route E\n\n# Define objective function\nCost_A = 2 * A\nCost_B = 3 * B\nCost_C = 4 * C\nCost_D = 5 * D\nCost_E = 6 * E\nTime_A = 1 / 30 * A\nTime_B = 1 / 40 * B\nTime_C = 1 / 50 * C\nTime_D = 1 / 60 * D\nTime_E = 1 / 70 * E\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n# The total time spent on all routes must not exceed 100 hours.\nmodel.addCons(Time_A + Time_B + Time_C + Time_D + Time_E <= 100)\n# The company has a budget of $2000 for operational costs.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of machines A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of machines B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of machines C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of machines D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for machine A is $500, for machine B is $700, for machine C is $900, and for machine D is $1100. The company aims to maximize the total profit from the production of these machines.\n// Total profit for machine A: Profit_A = 500 * A\n// Total profit for machine B: Profit_B = 700 * B\n// Total profit for machine C: Profit_C = 900 * C\n// Total profit for machine D: Profit_D = 1100 * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 hours per month. The production time for machine A is 5 hours, for machine B is 7 hours, for machine C is 9 hours, and for machine D is 11 hours.\n// 5 * A + 7 * B + 9 * C + 11 * D <= 500\n\n## Generate Constraint-2:\nThe market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month.\n// A >= 20; D <= 30\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for machine A is $300, for machine B is $400, for machine C is $500, and for machine D is $600.\n// 300 * A + 400 * B + 500 * C + 600 * D <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of machine C does not exceed the combined production of machines A and B.\n// C <= A + B\n\n## Generate Constraint-5:\nThe company has a strategic goal to produce at least twice as many machines B as machines A.\n// B >= 2 * A",
        "question": "A manufacturing company produces four types of machines: A, B, C, and D. The company needs to determine the optimal number of each machine type to produce in the next month to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\nThe profit per unit for machine A is $500, for machine B is $700, for machine C is $900, and for machine D is $1100. The company has a total production capacity of 500 hours per month. The production time for machine A is 5 hours, for machine B is 7 hours, for machine C is 9 hours, and for machine D is 11 hours. The market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month. The company has a limited budget for raw materials, which is $30,000 per month. The cost of raw materials for machine A is $300, for machine B is $400, for machine C is $500, and for machine D is $600. The company wants to ensure that the production of machine C does not exceed the combined production of machines A and B. The company also has a strategic goal to produce at least twice as many machines B as machines A.\nPlease help the company to maximize the total profit from the production of these machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of machines A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of machines B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of machines C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of machines D\n\n# Define objective function\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nProfit_D = 1100 * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a total production capacity of 500 hours per month.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D <= 500)\n# The market demand for machine A is at least 20 units per month, and for machine D is at most 30 units per month.\nmodel.addCons(A >= 20)\nmodel.addCons(D <= 30)\n# The company has a limited budget for raw materials, which is $30,000 per month.\nmodel.addCons(300 * A + 400 * B + 500 * C + 600 * D <= 30000)\n# The company wants to ensure that the production of machine C does not exceed the combined production of machines A and B.\nmodel.addCons(C <= A + B)\n# The company has a strategic goal to produce at least twice as many machines B as machines A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machine A: \", model.getVal(A))\n    print(\"Number of Machine B: \", model.getVal(B))\n    print(\"Number of Machine C: \", model.getVal(C))\n    print(\"Number of Machine D: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric plants\": \"HydroPlants\", \"range\": \"HydroPlants >= 0\", \"type\": \"integer\"}\n// {\"number of biomass generators\": \"BiomassGenerators\", \"range\": \"BiomassGenerators >= 0\", \"type\": \"integer\"}\n// {\"number of geothermal stations\": \"GeothermalStations\", \"range\": \"GeothermalStations >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city wants to minimize the cost per unit of energy produced.\n// Total cost: Cost = 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations\n// Total energy produced: Energy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n// So, the objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe city has a budget of $1,000,000 for installing renewable energy sources.\n// 10,000 * SolarPanels + 15,000 * WindTurbines + 20,000 * HydroPlants + 12,000 * BiomassGenerators + 25,000 * GeothermalStations <= 1,000,000\n\n## Generate Constraint-2:\nThe city aims to produce at least 30,000 MWh of energy annually.\n// 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations >= 30,000\n\n## Generate Constraint-3:\nThe city has space to install a maximum of 100 units of any type of energy source.\n// SolarPanels <= 100; WindTurbines <= 100; HydroPlants <= 100; BiomassGenerators <= 100; GeothermalStations <= 100",
        "question": "A city is planning to install five different types of renewable energy sources: solar panels, wind turbines, hydroelectric plants, biomass generators, and geothermal stations. The city needs to determine how many units of each type of energy source to install to optimize energy production and cost.\nThe cost per unit of solar panels is $10,000, and they produce 20 MWh of energy annually.\nThe cost per unit of wind turbines is $15,000, and they produce 30 MWh of energy annually.\nThe cost per unit of hydroelectric plants is $20,000, and they produce 40 MWh of energy annually.\nThe cost per unit of biomass generators is $12,000, and they produce 25 MWh of energy annually.\nThe cost per unit of geothermal stations is $25,000, and they produce 50 MWh of energy annually.\nThe city has a budget of $1,000,000 for installing renewable energy sources. The city aims to produce at least 30,000 MWh of energy annually. The city has space to install a maximum of 100 units of any type of energy source.\nPlease help the city to minimize the cost per unit of energy produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)\nHydroPlants = model.addVar(vtype=\"INTEGER\", name=\"HydroPlants\", lb=0)\nBiomassGenerators = model.addVar(vtype=\"INTEGER\", name=\"BiomassGenerators\", lb=0)\nGeothermalStations = model.addVar(vtype=\"INTEGER\", name=\"GeothermalStations\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 10000 * SolarPanels + 15000 * WindTurbines + 20000 * HydroPlants + 12000 * BiomassGenerators + 25000 * GeothermalStations\nEnergy = 20 * SolarPanels + 30 * WindTurbines + 40 * HydroPlants + 25 * BiomassGenerators + 50 * GeothermalStations\n## the objective function is: Minimize Cost / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The city has a budget of $1,000,000 for installing renewable energy sources.\nmodel.addCons(Cost <= 1000000)\n## The city aims to produce at least 30,000 MWh of energy annually.\nmodel.addCons(Energy >= 30000)\n## The city has space to install a maximum of 100 units of any type of energy source.\nmodel.addCons(SolarPanels <= 100)\nmodel.addCons(WindTurbines <= 100)\nmodel.addCons(HydroPlants <= 100)\nmodel.addCons(BiomassGenerators <= 100)\nmodel.addCons(GeothermalStations <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Number of Hydro Plants: \", model.getVal(HydroPlants))\n    print(\"Number of Biomass Generators: \", model.getVal(BiomassGenerators))\n    print(\"Number of Geothermal Stations: \", model.getVal(GeothermalStations))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\n// {\"production quantity for ProductA\": \"ProductAQuantity\", \"range\": \"ProductAQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQuantity\", \"range\": \"ProductBQuantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQuantity\", \"range\": \"ProductCQuantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The company aims to maximize the total profit from all products.\n// Profit_ProductA = ProductAQuantity * (50 - 20)\n// Profit_ProductB = ProductBQuantity * (70 - 30)\n// Profit_ProductC = ProductCQuantity * (60 - 25)\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000\n\n## Generate Constraint-2:\nThe market demand for ProductA is at least 200 units per day.\n// ProductAQuantity >= 200\n\n## Generate Constraint-3:\nThe market demand for ProductB is at most 300 units per day.\n// ProductBQuantity <= 300\n\n## Generate Constraint-4:\nThe company has a budget constraint for raw materials, which is $20,000 per day.\n// 20 * ProductAQuantity + 30 * ProductBQuantity + 25 * ProductCQuantity <= 20000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the cost of raw materials, production capacity, and market demand.\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The company has a total production capacity of 1000 units per day. The market demand for ProductA is at least 200 units per day. The market demand for ProductB is at most 300 units per day. The company has a budget constraint for raw materials, which is $20,000 per day.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductAQuantity\", lb=0)\nProductBQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductBQuantity\", lb=0, ub=300)\nProductCQuantity = model.addVar(vtype=\"INTEGER\", name=\"ProductCQuantity\", lb=0)\n\n# Define objective function\nProfit_ProductA = ProductAQuantity * (50 - 20)\nProfit_ProductB = ProductBQuantity * (70 - 30)\nProfit_ProductC = ProductCQuantity * (60 - 25)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAQuantity + ProductBQuantity + ProductCQuantity <= 1000)\nmodel.addCons(ProductAQuantity >= 200)\nmodel.addCons(20 * ProductAQuantity + 30 * ProductBQuantity + 25 * ProductCQuantity <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQuantity))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQuantity))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQuantity))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on Route A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. \nOn Route A, the cost per truck is $500 per day.\nOn Route B, the cost per truck is $600 per day.\nOn Route C, the cost per truck is $700 per day.\nOn Route D, the cost per truck is $800 per day.\nOn Route E, the cost per truck is $900 per day.\nThe company wants to minimize the total daily operational cost while ensuring all routes are covered.\n// Total daily operational cost: Cost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 30",
        "question": "A logistics company operates five different routes (Route A, Route B, Route C, Route D, and Route E) for delivering goods. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. The cost of operating a truck on each route varies due to different fuel consumption rates and maintenance costs. The costs per truck per day for each route are given in the following Table.\n\n| Route | Cost per Truck per Day |\n|-------|-------------------------|\n| A     | $500                    |\n| B     | $600                    |\n| C     | $700                    |\n| D     | $800                    |\n| E     | $900                    |\n\nThe company has a total of 30 trucks available. The company wants to minimize the total daily operational cost while ensuring all routes are covered. Please help the company determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks on Route A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks on Route B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks on Route C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks on Route D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks on Route E\n\n# Define objective function\nCost = 500 * TruckA + 600 * TruckB + 700 * TruckC + 800 * TruckD + 900 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(TruckA))\n    print(\"Number of Trucks on Route B: \", model.getVal(TruckB))\n    print(\"Number of Trucks on Route C: \", model.getVal(TruckC))\n    print(\"Number of Trucks on Route D: \", model.getVal(TruckD))\n    print(\"Number of Trucks on Route E: \", model.getVal(TruckE))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n// {\"fuel consumption rate for Trucks\": \"FuelTruck\", \"range\": \"FuelTruck > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Vans\": \"FuelVan\", \"range\": \"FuelVan > 0\", \"type\": \"real\"}\n// {\"fuel consumption rate for Bikes\": \"FuelBike\", \"range\": \"FuelBike > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Trucks\": \"MaintenanceTruck\", \"range\": \"MaintenanceTruck > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Vans\": \"MaintenanceVan\", \"range\": \"MaintenanceVan > 0\", \"type\": \"real\"}\n// {\"maintenance cost per vehicle for Bikes\": \"MaintenanceBike\", \"range\": \"MaintenanceBike > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes.\n// Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for vehicle operations.\n// FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000",
        "question": "A logistics company operates three types of vehicles (Trucks, Vans, and Bikes) to deliver packages in a city. The company needs to determine the number of each type of vehicle to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption rates and maintenance costs per vehicle for each type are given in the following Table.\n\n| Vehicle | Fuel Consumption Rate | Maintenance Cost per Vehicle |\n|---------|----------------------|------------------------------|\n| Trucks  | FuelTruck            | MaintenanceTruck             |\n| Vans    | FuelVan              | MaintenanceVan               |\n| Bikes   | FuelBike             | MaintenanceBike              |\n\nThe company aims to minimize the total daily operational cost, which includes fuel consumption and maintenance costs. The fuel consumption for Trucks is FuelTruck * Trucks, for Vans is FuelVan * Vans, and for Bikes is FuelBike * Bikes. The maintenance cost for Trucks is MaintenanceTruck * Trucks, for Vans is MaintenanceVan * Vans, and for Bikes is MaintenanceBike * Bikes. The company has a total budget of $10,000 for vehicle operations.\n\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize the total daily operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelTruck = model.addVar(name=\"FuelTruck\", vtype=\"CONTINUOUS\")  # fuel consumption rate for Trucks\nFuelVan = model.addVar(name=\"FuelVan\", vtype=\"CONTINUOUS\")  # fuel consumption rate for Vans\nFuelBike = model.addVar(name=\"FuelBike\", vtype=\"CONTINUOUS\")  # fuel consumption rate for Bikes\nMaintenanceTruck = model.addVar(name=\"MaintenanceTruck\", vtype=\"CONTINUOUS\")  # maintenance cost per vehicle for Trucks\nMaintenanceVan = model.addVar(name=\"MaintenanceVan\", vtype=\"CONTINUOUS\")  # maintenance cost per vehicle for Vans\nMaintenanceBike = model.addVar(name=\"MaintenanceBike\", vtype=\"CONTINUOUS\")  # maintenance cost per vehicle for Bikes\n\n## Objective function: Minimize (FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\nmodel.addCons(obj == FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes)\n\n# Add constraints\n## The company has a total budget of $10,000 for vehicle operations.\nmodel.addCons(FuelTruck * Trucks + FuelVan * Vans + FuelBike * Bikes + MaintenanceTruck * Trucks + MaintenanceVan * Vans + MaintenanceBike * Bikes <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Daily Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1268,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 5 different trucks to minimize fuel consumption and travel time. The trucks need to deliver goods to various locations and return to the depot.\n// {\"fuel consumption of truck 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled as a nonlinear function of the distance traveled and the load carried. The function is F = k * d^2 * l, where k is a constant, d is the distance, and l is the load. The company wants to minimize the total fuel consumption of all trucks.\n// Fuel_F1 = k1 * (D1^2) * L1\n// Fuel_F2 = k2 * (D2^2) * L2\n// Fuel_F3 = k3 * (D3^2) * L3\n// Fuel_F4 = k4 * (D4^2) * L4\n// Fuel_F5 = k5 * (D5^2) * L5\n// So, the objective function is: Minimize (Fuel_F1 + Fuel_F2 + Fuel_F3 + Fuel_F4 + Fuel_F5)\n\n## Generate Constraint-1:\nEach truck has a maximum load capacity of 10 tons.\n// L1 <= 10; L2 <= 10; L3 <= 10; L4 <= 10; L5 <= 10\n\n## Generate Constraint-2:\nThe total distance traveled by all trucks must not exceed 5000 kilometers.\n// D1 + D2 + D3 + D4 + D5 <= 5000\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for fuel costs.\n// k1 * (D1^2) * L1 + k2 * (D2^2) * L2 + k3 * (D3^2) * L3 + k4 * (D4^2) * L4 + k5 * (D5^2) * L5 <= 10000",
        "question": "A logistics company operates a fleet of 5 trucks and needs to optimize the routes for these trucks to minimize fuel consumption and travel time. The trucks need to deliver goods to various locations and return to the depot. The fuel consumption of each truck is modeled as a nonlinear function of the distance traveled and the load carried, where F = k * d^2 * l, with k being a constant, d the distance, and l the load. The company aims to minimize the total fuel consumption of all trucks.\n\n| Truck | Fuel Consumption Model | Maximum Load Capacity |\n|-------|------------------------|-----------------------|\n| 1     | F1 = k1 * (D1^2) * L1  | 10 tons               |\n| 2     | F2 = k2 * (D2^2) * L2  | 10 tons               |\n| 3     | F3 = k3 * (D3^2) * L3  | 10 tons               |\n| 4     | F4 = k4 * (D4^2) * L4  | 10 tons               |\n| 5     | F5 = k5 * (D5^2) * L5  | 10 tons               |\n\nThe company has the following constraints:\n- Each truck has a maximum load capacity of 10 tons.\n- The total distance traveled by all trucks must not exceed 5000 kilometers.\n- The company has a budget of $10,000 for fuel costs.\n\nPlease help the company to determine the optimal routes and loads for each truck to minimize the total fuel consumption while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of truck 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of truck 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of truck 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of truck 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Define distance and load variables\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance traveled by truck 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance traveled by truck 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance traveled by truck 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance traveled by truck 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance traveled by truck 5\n\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # load carried by truck 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # load carried by truck 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # load carried by truck 3\nL4 = model.addVar(vtype=\"CONTINUOUS\", name=\"L4\", lb=0) # load carried by truck 4\nL5 = model.addVar(vtype=\"CONTINUOUS\", name=\"L5\", lb=0) # load carried by truck 5\n\n# Define constants\nk1 = 1  # placeholder for k1\nk2 = 1  # placeholder for k2\nk3 = 1  # placeholder for k3\nk4 = 1  # placeholder for k4\nk5 = 1  # placeholder for k5\n\n# Objective function constraints\nmodel.addCons(F1 == k1 * (D1**2) * L1)\nmodel.addCons(F2 == k2 * (D2**2) * L2)\nmodel.addCons(F3 == k3 * (D3**2) * L3)\nmodel.addCons(F4 == k4 * (D4**2) * L4)\nmodel.addCons(F5 == k5 * (D5**2) * L5)\nmodel.addCons(obj == F1 + F2 + F3 + F4 + F5)\n\n# Add constraints\n## Each truck has a maximum load capacity of 10 tons.\nmodel.addCons(L1 <= 10)\nmodel.addCons(L2 <= 10)\nmodel.addCons(L3 <= 10)\nmodel.addCons(L4 <= 10)\nmodel.addCons(L5 <= 10)\n\n## The total distance traveled by all trucks must not exceed 5000 kilometers.\nmodel.addCons(D1 + D2 + D3 + D4 + D5 <= 5000)\n\n## The company has a budget of $10,000 for fuel costs.\nmodel.addCons(k1 * (D1**2) * L1 + k2 * (D2**2) * L2 + k3 * (D3**2) * L3 + k4 * (D4**2) * L4 + k5 * (D5**2) * L5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of truck 1: \", model.getVal(F1))\n    print(\"Fuel consumption of truck 2: \", model.getVal(F2))\n    print(\"Fuel consumption of truck 3: \", model.getVal(F3))\n    print(\"Fuel consumption of truck 4: \", model.getVal(F4))\n    print(\"Fuel consumption of truck 5: \", model.getVal(F5))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1291,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"area of land for Barley\": \"Barley\", \"range\": \"Barley >= 0\", \"type\": \"integer\"}\n// {\"area of land for Oats\": \"Oats\", \"range\": \"Oats >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per hectare for Wheat is $300, for Corn is $400, for Soybeans is $500, for Barley is $200, and for Oats is $150. The water usage per hectare for Wheat is 500 liters, for Corn is 600 liters, for Soybeans is 400 liters, for Barley is 300 liters, and for Oats is 200 liters. The farmer wants to maximize the profit per liter of water used.\n// Profit_Wheat = 300 * Wheat\n// Profit_Corn = 400 * Corn\n// Profit_Soybeans = 500 * Soybeans\n// Profit_Barley = 200 * Barley\n// Profit_Oats = 150 * Oats\n// Water_Wheat = 500 * Wheat\n// Water_Corn = 600 * Corn\n// Water_Soybeans = 400 * Soybeans\n// Water_Barley = 300 * Barley\n// Water_Oats = 200 * Oats\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans + Barley + Oats <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of Wheat.\n// Wheat >= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 hectares of Corn.\n// Corn >= 5",
        "question": "A farmer is planning to plant five different crops: Wheat, Corn, Soybeans, Barley, and Oats. Each crop requires a specific amount of land and water, and yields a different profit. The profit per hectare and water usage per hectare for each crop are given in the following Table.\n\n| Crop       | Profit per Hectare | Water Usage per Hectare |\n|------------|--------------------|-------------------------|\n| Wheat      | $300               | 500 liters              |\n| Corn       | $400               | 600 liters              |\n| Soybeans   | $500               | 400 liters              |\n| Barley     | $200               | 300 liters              |\n| Oats       | $150               | 200 liters              |\n\nThe farmer has 100 hectares of land available. The total water available for irrigation is 50,000 liters. The farmer must plant at least 10 hectares of Wheat and at least 5 hectares of Corn. \nPlease help the farmer to maximize the profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of Wheat.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # area of land for Wheat\n## The farmer must plant at least 5 hectares of Corn.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=5) # area of land for Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # area of land for Soybeans\nBarley = model.addVar(vtype=\"INTEGER\", name=\"Barley\", lb=0) # area of land for Barley\nOats = model.addVar(vtype=\"INTEGER\", name=\"Oats\", lb=0) # area of land for Oats\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 300 * Wheat\nProfit_Corn = 400 * Corn\nProfit_Soybeans = 500 * Soybeans\nProfit_Barley = 200 * Barley\nProfit_Oats = 150 * Oats\nWater_Wheat = 500 * Wheat\nWater_Corn = 600 * Corn\nWater_Soybeans = 400 * Soybeans\nWater_Barley = 300 * Barley\nWater_Oats = 200 * Oats\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats) / (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans + Water_Barley + Water_Oats) == Profit_Wheat + Profit_Corn + Profit_Soybeans + Profit_Barley + Profit_Oats)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans + Barley + Oats <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 600 * Corn + 400 * Soybeans + 300 * Barley + 200 * Oats <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Area of land for Barley: \", model.getVal(Barley))\n    print(\"Area of land for Oats: \", model.getVal(Oats))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceDUnits\", \"range\": \"DeviceDUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceEUnits\", \"range\": \"DeviceEUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the Selling Price per Unit is $200, the Production Cost per Unit is $120, and the Storage Cost per Unit is $10. \nFor DeviceB, the Selling Price per Unit is $250, the Production Cost per Unit is $150, and the Storage Cost per Unit is $15. \nFor DeviceC, the Selling Price per Unit is $300, the Production Cost per Unit is $180, and the Storage Cost per Unit is $20.\nFor DeviceD, the Selling Price per Unit is $220, the Production Cost per Unit is $130, and the Storage Cost per Unit is $12.\nFor DeviceE, the Selling Price per Unit is $280, the Production Cost per Unit is $160, and the Storage Cost per Unit is $18.\nThe company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (200 - 120 - 10) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (250 - 150 - 15) * DeviceBUnits\n// Total net profit for DeviceC: Profit_DeviceC = (300 - 180 - 20) * DeviceCUnits\n// Total net profit for DeviceD: Profit_DeviceD = (220 - 130 - 12) * DeviceDUnits\n// Total net profit for DeviceE: Profit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the quarter.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB.\n// DeviceAUnits >= 1.5 * DeviceBUnits\n\n## Generate Constraint-3:\nThe company has a budget of $150,000 for production costs for the quarter.\n// 120 * DeviceAUnits + 150 * DeviceBUnits + 180 * DeviceCUnits + 130 * DeviceDUnits + 160 * DeviceEUnits <= 150,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each device type has at least one unit produced.\n// DeviceAUnits >= 1; DeviceBUnits >= 1; DeviceCUnits >= 1; DeviceDUnits >= 1; DeviceEUnits >= 1\n\n## Generate Constraint-5:\nThe storage capacity is limited to 500 units across all devices.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 500",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine how many units of each device to produce for the upcoming quarter to optimize their profit. The selling price per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Selling Price per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|------------------------|--------------------------|-----------------------|\n| DeviceA | $200                   | $120                     | $10                   |\n| DeviceB | $250                   | $150                     | $15                   |\n| DeviceC | $300                   | $180                     | $20                   |\n| DeviceD | $220                   | $130                     | $12                   |\n| DeviceE | $280                   | $160                     | $18                   |\n\nThe company has a total production capacity of 1000 units for the quarter. Due to supplier agreements, the production of DeviceA must be at least 50% more than the production of DeviceB. The company has a budget of $150,000 for production costs for the quarter. The company wants to ensure that each device type has at least one unit produced. The storage capacity is limited to 500 units across all devices.\n\nPlease help the company to maximize the total net profit, which is calculated as the selling price per unit minus the production cost per unit and the storage cost per unit, for each device type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=1)  # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=1)  # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=1)  # number of units of DeviceC\nDeviceDUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceDUnits\", lb=1)  # number of units of DeviceD\nDeviceEUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceEUnits\", lb=1)  # number of units of DeviceE\n\n# Define objective function\nProfit_DeviceA = (200 - 120 - 10) * DeviceAUnits\nProfit_DeviceB = (250 - 150 - 15) * DeviceBUnits\nProfit_DeviceC = (300 - 180 - 20) * DeviceCUnits\nProfit_DeviceD = (220 - 130 - 12) * DeviceDUnits\nProfit_DeviceE = (280 - 160 - 18) * DeviceEUnits\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 1000)  # Total production capacity\nmodel.addCons(DeviceAUnits >= 1.5 * DeviceBUnits)  # DeviceA production must be at least 50% more than DeviceB\nmodel.addCons(120 * DeviceAUnits + 150 * DeviceBUnits + 180 * DeviceCUnits + 130 * DeviceDUnits + 160 * DeviceEUnits <= 150000)  # Budget for production costs\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits + DeviceDUnits + DeviceEUnits <= 500)  # Storage capacity\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Number of DeviceD Units: \", model.getVal(DeviceDUnits))\n    print(\"Number of DeviceE Units: \", model.getVal(DeviceEUnits))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1606,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency.\n// {\"number of trucks on Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route1\": \"Additive1\", \"range\": \"Additive1 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fuel additive used on Route2\": \"Additive2\", \"range\": \"Additive2 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes.\n// Fuel cost on Route1: Cost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\n// Fuel cost on Route2: Cost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\n// So, the objective function is: Minimize (Cost1 + Cost2)\n\n## Generate Constraint-1:\nThe total number of trucks available for both routes is limited to 50.\n// Trucks1 + Trucks2 <= 50\n\n## Generate Constraint-2:\nThe budget for fuel additives is limited to $1000.\n// Additive1 + Additive2 <= 1000\n\n## Generate Constraint-3:\nDue to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h.\n// Speed1 <= 50\n\n## Generate Constraint-4:\nThe demand for goods requires at least 10 trucks to be assigned to Route2.\n// Trucks2 >= 10\n\n## Generate Constraint-5:\nThe fuel efficiency improvement due to additives is capped at 10% for each route.\n// Additive1 <= 0.1 * Speed1; Additive2 <= 0.1 * Speed2",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to optimize the fuel consumption and route selection for each truck to minimize overall operational costs. The variables include the number of trucks assigned to each route, the speed at which each truck travels, and the amount of fuel additive used to enhance fuel efficiency. The fuel consumption of each truck is affected by the speed and the use of fuel additive. The fuel consumption rate decreases with the increase in speed but increases with the use of additive. The company aims to minimize the total fuel cost across both routes. The total number of trucks available for both routes is limited to 50. The budget for fuel additives is limited to $1000. Due to safety regulations, the speed of trucks on Route1 must not exceed 50 km/h. The demand for goods requires at least 10 trucks to be assigned to Route2. The fuel efficiency improvement due to additives is capped at 10% for each route. Please help the company to minimize the total fuel cost across both routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks on Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=10)  # number of trucks on Route2\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route2\nAdditive1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive1\", lb=0)  # amount of fuel additive used on Route1\nAdditive2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Additive2\", lb=0)  # amount of fuel additive used on Route2\n\n# Define objective function\nCost1 = (100 + 0.5 * Speed1 - 0.01 * Additive1) * Trucks1\nCost2 = (120 + 0.4 * Speed2 - 0.015 * Additive2) * Trucks2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 <= 50)\nmodel.addCons(Additive1 + Additive2 <= 1000)\nmodel.addCons(Speed1 <= 50)\nmodel.addCons(Trucks2 >= 10)\nmodel.addCons(Additive1 <= 0.1 * Speed1)\nmodel.addCons(Additive2 <= 0.1 * Speed2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks on Route2: \", model.getVal(Trucks2))\n    print(\"Speed of Trucks on Route1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route2: \", model.getVal(Speed2))\n    print(\"Amount of Additive on Route1: \", model.getVal(Additive1))\n    print(\"Amount of Additive on Route2: \", model.getVal(Additive2))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency.\n// {\"number of Small wind farms\": \"SmallWindFarms\", \"range\": \"SmallWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Medium wind farms\": \"MediumWindFarms\", \"range\": \"MediumWindFarms >= 0\", \"type\": \"integer\"}\n// {\"number of Large wind farms\": \"LargeWindFarms\", \"range\": \"LargeWindFarms >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Small wind farms\": \"MaintenanceSmall\", \"range\": \"MaintenanceSmall >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Medium wind farms\": \"MaintenanceMedium\", \"range\": \"MaintenanceMedium >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Large wind farms\": \"MaintenanceLarge\", \"range\": \"MaintenanceLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each wind farm type increases with the level of maintenance investment. For Small wind farms, the efficiency increases by 0.1% for every $1,000 invested. For Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested. For Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms.\n// EnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\n// EnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\n// EnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n// So, the objective function is: Maximize (EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for both construction and maintenance investments.\n// 100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000\n\n## Generate Constraint-2:\nThe total land available for wind farm construction is limited to 10 farms.\n// SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10\n\n## Generate Constraint-3:\nDue to regulatory requirements, the company must build at least 2 Small wind farms and 1 Medium wind farm.\n// SmallWindFarms >= 2; MediumWindFarms >= 1",
        "question": "A renewable energy company operates three types of wind farms: Small, Medium, and Large. The company needs to determine the number of each type of wind farm to build and the level of maintenance investment for each type to optimize energy production efficiency. The efficiency of each wind farm type increases with the level of maintenance investment as follows: for Small wind farms, the efficiency increases by 0.1% for every $1,000 invested; for Medium wind farms, the efficiency increases by 0.2% for every $1,000 invested; and for Large wind farms, the efficiency increases by 0.3% for every $1,000 invested. The company aims to maximize the total energy production from all wind farms.\n\n| Wind Farm Type | Initial Efficiency | Efficiency Increase per $1,000 Investment |\n|----------------|--------------------|------------------------------------------|\n| Small          | 100%               | 0.1%                                     |\n| Medium         | 200%               | 0.2%                                     |\n| Large          | 300%               | 0.3%                                     |\n\nThe company has a total budget of $1,000,000 for both construction and maintenance investments. The total land available for wind farm construction is limited to 10 farms. Due to regulatory requirements, the company must build at least 2 Small wind farms and 1 Medium wind farm.\n\nPlease help the company to determine the optimal number of each type of wind farm to build and the level of maintenance investment for each type to maximize the total energy production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallWindFarms = model.addVar(vtype=\"INTEGER\", name=\"SmallWindFarms\", lb=2)  # number of Small wind farms\nMediumWindFarms = model.addVar(vtype=\"INTEGER\", name=\"MediumWindFarms\", lb=1)  # number of Medium wind farms\nLargeWindFarms = model.addVar(vtype=\"INTEGER\", name=\"LargeWindFarms\", lb=0)  # number of Large wind farms\nMaintenanceSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSmall\", lb=0)  # maintenance investment for Small wind farms\nMaintenanceMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceMedium\", lb=0)  # maintenance investment for Medium wind farms\nMaintenanceLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceLarge\", lb=0)  # maintenance investment for Large wind farms\n\n# Define objective function\nEnergyProductionSmall = (100 + 0.001 * MaintenanceSmall) * SmallWindFarms\nEnergyProductionMedium = (200 + 0.002 * MaintenanceMedium) * MediumWindFarms\nEnergyProductionLarge = (300 + 0.003 * MaintenanceLarge) * LargeWindFarms\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSmall + EnergyProductionMedium + EnergyProductionLarge)\n\n# Add constraints\nmodel.addCons(100000 * SmallWindFarms + 200000 * MediumWindFarms + 300000 * LargeWindFarms + MaintenanceSmall + MaintenanceMedium + MaintenanceLarge <= 1000000)\nmodel.addCons(SmallWindFarms + MediumWindFarms + LargeWindFarms <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Wind Farms: \", model.getVal(SmallWindFarms))\n    print(\"Number of Medium Wind Farms: \", model.getVal(MediumWindFarms))\n    print(\"Number of Large Wind Farms: \", model.getVal(LargeWindFarms))\n    print(\"Maintenance Investment for Small Wind Farms: \", model.getVal(MaintenanceSmall))\n    print(\"Maintenance Investment for Medium Wind Farms: \", model.getVal(MaintenanceMedium))\n    print(\"Maintenance Investment for Large Wind Farms: \", model.getVal(MaintenanceLarge))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1575,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentD\": \"UnitsD\", \"range\": \"UnitsD >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentE\": \"UnitsE\", \"range\": \"UnitsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, for ComponentC is $90, for ComponentD is $60, and for ComponentE is $80. However, the production cost increases nonlinearly with the number of units produced due to economies of scale and resource limitations. The production cost function for each component is as follows:\n- CostA(UnitsA) = 1000 + 20 * UnitsA + 0.1 * UnitsA^2\n- CostB(UnitsB) = 1500 + 25 * UnitsB + 0.15 * UnitsB^2\n- CostC(UnitsC) = 2000 + 30 * UnitsC + 0.2 * UnitsC^2\n- CostD(UnitsD) = 1200 + 22 * UnitsD + 0.12 * UnitsD^2\n- CostE(UnitsE) = 1800 + 28 * UnitsE + 0.18 * UnitsE^2\nThe company wants to maximize its total net profit.\n// NetProfitA = (50 * UnitsA) - CostA(UnitsA)\n// NetProfitB = (70 * UnitsB) - CostB(UnitsB)\n// NetProfitC = (90 * UnitsC) - CostC(UnitsC)\n// NetProfitD = (60 * UnitsD) - CostD(UnitsD)\n// NetProfitE = (80 * UnitsE) - CostE(UnitsE)\n// So, the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces five types of electronic components: ComponentA, ComponentB, ComponentC, ComponentD, and ComponentE. The company needs to decide how many units of each component to produce to optimize its profit. The profit per unit for each component and their respective production cost functions are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50             | 1000 + 20 * UnitsA + 0.1 * UnitsA^2 |\n| ComponentB | $70             | 1500 + 25 * UnitsB + 0.15 * UnitsB^2 |\n| ComponentC | $90             | 2000 + 30 * UnitsC + 0.2 * UnitsC^2 |\n| ComponentD | $60             | 1200 + 22 * UnitsD + 0.12 * UnitsD^2 |\n| ComponentE | $80             | 1800 + 28 * UnitsE + 0.18 * UnitsE^2 |\n\nThe company has a total production capacity of 1000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company wants to maximize its total net profit.\n\nPlease help the company determine the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\nUnitsD = model.addVar(vtype=\"INTEGER\", name=\"UnitsD\", lb=0) # number of units of ComponentD\nUnitsE = model.addVar(vtype=\"INTEGER\", name=\"UnitsE\", lb=0) # number of units of ComponentE\n\n# Define objective function\n## Calculate the cost functions\nCostA = 1000 + 20 * UnitsA + 0.1 * UnitsA**2\nCostB = 1500 + 25 * UnitsB + 0.15 * UnitsB**2\nCostC = 2000 + 30 * UnitsC + 0.2 * UnitsC**2\nCostD = 1200 + 22 * UnitsD + 0.12 * UnitsD**2\nCostE = 1800 + 28 * UnitsE + 0.18 * UnitsE**2\n\n## Calculate the net profits\nNetProfitA = 50 * UnitsA - CostA\nNetProfitB = 70 * UnitsB - CostB\nNetProfitC = 90 * UnitsC - CostC\nNetProfitD = 60 * UnitsD - CostD\nNetProfitE = 80 * UnitsE - CostE\n\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\nmodel.addCons(obj == NetProfitA + NetProfitB + NetProfitC + NetProfitD + NetProfitE)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all components.\nmodel.addCons(UnitsA + UnitsB + UnitsC + UnitsD + UnitsE <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Number of ComponentD: \", model.getVal(UnitsD))\n    print(\"Number of ComponentE: \", model.getVal(UnitsE))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency.\n// {\"quantity of Drug A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"quantity of Drug E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Drug A is $10, but it decreases by $0.02 for every unit produced above 100. The profit per unit of Drug B is $15, but it decreases by $0.03 for every unit produced above 150. The profit per unit of Drug C is $20, but it decreases by $0.04 for every unit produced above 200. The profit per unit of Drug D is $25, but it decreases by $0.05 for every unit produced above 250. The profit per unit of Drug E is $30, but it decreases by $0.06 for every unit produced above 300. The company wants to maximize the total profit from selling the drugs.\n// Profit_A = max(10 - 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 - 0.03 * (B - 150), 15) * B\n// Profit_C = max(20 - 0.04 * (C - 200), 20) * C\n// Profit_D = max(25 - 0.05 * (D - 250), 25) * D\n// Profit_E = max(30 - 0.06 * (E - 300), 30) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe cost of raw materials for Drug A is $3 per unit, for Drug B is $4 per unit, for Drug C is $5 per unit, for Drug D is $6 per unit, and for Drug E is $7 per unit. The company has a budget of $2000 for raw materials.\n// 3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000\n\n## Generate Constraint-2:\nThe production capacity for each drug is limited. The maximum production capacity for Drug A is 300 units, for Drug B is 250 units, for Drug C is 200 units, for Drug D is 150 units, and for Drug E is 100 units.\n// A <= 300; B <= 250; C <= 200; D <= 150; E <= 100\n\n## Generate Constraint-3:\nThe total production capacity of the company is 600 units.\n// A + B + C + D + E <= 600\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of each drug to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50",
        "question": "A pharmaceutical company produces five different drugs: Drug A, Drug B, Drug C, Drug D, and Drug E. They need to determine the quantities of each drug to produce to maximize their profit while considering the cost of raw materials and production efficiency. The profit per unit of each drug decreases as more units are produced above certain thresholds. The details of the profit structure and production constraints are given in the following Table.\n\n| Drug | Profit per Unit (above threshold) | Cost of Raw Materials per Unit | Maximum Production Capacity | Minimum Production Requirement |\n|------|----------------------------------|--------------------------------|------------------------------|--------------------------------|\n| A    | $10 - $0.02 * (A - 100)          | $3                             | 300 units                    | 50 units                        |\n| B    | $15 - $0.03 * (B - 150)          | $4                             | 250 units                    | 50 units                        |\n| C    | $20 - $0.04 * (C - 200)          | $5                             | 200 units                    | 50 units                        |\n| D    | $25 - $0.05 * (D - 250)          | $6                             | 150 units                    | 50 units                        |\n| E    | $30 - $0.06 * (E - 300)          | $7                             | 100 units                    | 50 units                        |\n\nThe company has a budget of $2000 for raw materials. The total production capacity of the company is 600 units. The company must produce at least 50 units of each drug to meet contractual obligations.\n\nPlease help the company to maximize the total profit from selling the drugs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 50 units of each drug to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=300) # quantity of Drug A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=250) # quantity of Drug B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=200) # quantity of Drug C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50, ub=150) # quantity of Drug D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50, ub=100) # quantity of Drug E\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 - 0.03 * (B - 150), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=50, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.03 * (B2 - 150)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 - 0.04 * (C - 200), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=50, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.04 * (C2 - 200)) * C2 * C_b2\n## create piecewise variables for piecewise function: Profit_D = max(25 - 0.05 * (D - 250), 25) * D\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=50, ub=250)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=250, ub=150)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(D == D1*D_b1 + D2*D_b2)\nProfit_D = 25 * D1 * D_b1 + (25 - 0.05 * (D2 - 250)) * D2 * D_b2\n## create piecewise variables for piecewise function: Profit_E = max(30 - 0.06 * (E - 300), 30) * E\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=50, ub=300)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=300, ub=100)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(E == E1*E_b1 + E2*E_b2)\nProfit_E = 30 * E1 * E_b1 + (30 - 0.06 * (E2 - 300)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\nmodel.addCons(3 * A + 4 * B + 5 * C + 6 * D + 7 * E <= 2000)\nmodel.addCons(A + B + C + D + E <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Drug A: \", model.getVal(A))\n    print(\"Quantity of Drug B: \", model.getVal(B))\n    print(\"Quantity of Drug C: \", model.getVal(C))\n    print(\"Quantity of Drug D: \", model.getVal(D))\n    print(\"Quantity of Drug E: \", model.getVal(E))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1723,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production rate of product A\": \"RateA\", \"range\": \"RateA > 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"RateB\", \"range\": \"RateB > 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"RateC\", \"range\": \"RateC > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The manufacturer aims to maximize the total daily profit.\n// Profit_A = UnitsA * 50\n// Profit_B = UnitsB * 70\n// Profit_C = UnitsC * 60\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 100 units per day.\n// UnitsA + UnitsB + UnitsC <= 100\n\n## Generate Constraint-2:\nThe production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\n// UnitsA <= 8 * RateA\n// UnitsB <= 8 * RateB\n// UnitsC <= 8 * RateC\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\n// UnitsA >= 20\n// UnitsB >= 15\n// UnitsC >= 25\n\n## Generate Constraint-4:\nThe manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day. The cost of raw materials per unit for product A is $20, for product B is $30, and for product C is $25.\n// 20 * UnitsA + 30 * UnitsB + 25 * UnitsC <= 5000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product varies, and the manufacturer needs to determine the optimal number of units to produce daily to maximize profit while considering production constraints and market demand. The profit per unit and the cost of raw materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit |\n|---------|-----------------|--------------------------------|\n| A       | $50             | $20                            |\n| B       | $70             | $30                            |\n| C       | $60             | $25                            |\n\nThe total production capacity of the factory is limited to 100 units per day. The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day. The market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day. The manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day.\n\nPlease help the manufacturer to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=20)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=15)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=25)  # number of units of product C\n\n# Define objective function\nProfit_A = UnitsA * 50\nProfit_B = UnitsB * 70\nProfit_C = UnitsC * 60\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total production capacity of the factory is limited to 100 units per day.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 100)\n\n# The production rates of the products are not equal; product A can be produced at a rate of 2 units per hour, product B at 3 units per hour, and product C at 2.5 units per hour. The factory operates 8 hours a day.\nmodel.addCons(UnitsA <= 8 * 2)  # Assuming RateA = 2\nmodel.addCons(UnitsB <= 8 * 3)  # Assuming RateB = 3\nmodel.addCons(UnitsC <= 8 * 2.5)  # Assuming RateC = 2.5\n\n# The market demand for product A is at least 20 units per day, for product B is at least 15 units per day, and for product C is at least 25 units per day.\nmodel.addCons(UnitsA >= 20)\nmodel.addCons(UnitsB >= 15)\nmodel.addCons(UnitsC >= 25)\n\n# The manufacturer has a budget constraint for raw materials, which limits the total cost of production to $5000 per day. The cost of raw materials per unit for product A is $20, for product B is $30, and for product C is $25.\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 25 * UnitsC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1327,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company is considering four types of vehicles (Truck1, Truck2, Van, and Motorcycle) to add to its fleet. Each vehicle type has different capacities and operational costs.\n// {\"number of Truck1 vehicles\": \"Truck1\", \"range\": \"Truck1 >= 0\", \"type\": \"integer\"}\n// {\"number of Truck2 vehicles\": \"Truck2\", \"range\": \"Truck2 >= 0\", \"type\": \"integer\"}\n// {\"number of Van vehicles\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Motorcycle vehicles\": \"Motorcycle\", \"range\": \"Motorcycle >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per day for Truck1 is $200, for Truck2 is $150, for Van is $100, and for Motorcycle is $50. The delivery capacity per vehicle per day for Truck1 is 100 packages, for Truck2 is 80 packages, for Van is 50 packages, and for Motorcycle is 20 packages. The company wants to minimize the total operational cost while ensuring sufficient delivery capacity.\n// Total operational cost: Cost = 200 * Truck1 + 150 * Truck2 + 100 * Van + 50 * Motorcycle\n// Total delivery capacity: Capacity = 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle\n// The objective function is: Minimize Cost / Capacity\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 to spend on vehicle acquisition.\n// 20000 * Truck1 + 15000 * Truck2 + 10000 * Van + 5000 * Motorcycle <= 100000\n\n## Generate Constraint-2:\nThe company needs to ensure a daily delivery capacity of at least 5000 packages.\n// 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle >= 5000\n\n## Generate Constraint-3:\nThe company aims to have at least 20 vehicles in total.\n// Truck1 + Truck2 + Van + Motorcycle >= 20",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company is considering four types of vehicles (Truck1, Truck2, Van, and Motorcycle) to add to its fleet. Each vehicle type has different capacities and operational costs. The operational cost per day for Truck1 is $200, for Truck2 is $150, for Van is $100, and for Motorcycle is $50. The delivery capacity per vehicle per day for Truck1 is 100 packages, for Truck2 is 80 packages, for Van is 50 packages, and for Motorcycle is 20 packages. The company has a budget of $10,000 to spend on vehicle acquisition. The company needs to ensure a daily delivery capacity of at least 5000 packages. The company aims to have at least 20 vehicles in total. Please help the company to minimize the total operational cost while ensuring sufficient delivery capacity, by minimizing the ratio of total operational cost to total delivery capacity.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck1 = model.addVar(vtype=\"INTEGER\", name=\"Truck1\", lb=0)  # number of Truck1 vehicles\nTruck2 = model.addVar(vtype=\"INTEGER\", name=\"Truck2\", lb=0)  # number of Truck2 vehicles\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Van vehicles\nMotorcycle = model.addVar(vtype=\"INTEGER\", name=\"Motorcycle\", lb=0)  # number of Motorcycle vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 200 * Truck1 + 150 * Truck2 + 100 * Van + 50 * Motorcycle\nCapacity = 100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 to spend on vehicle acquisition.\nmodel.addCons(20000 * Truck1 + 15000 * Truck2 + 10000 * Van + 5000 * Motorcycle <= 100000)\n## The company needs to ensure a daily delivery capacity of at least 5000 packages.\nmodel.addCons(100 * Truck1 + 80 * Truck2 + 50 * Van + 20 * Motorcycle >= 5000)\n## The company aims to have at least 20 vehicles in total.\nmodel.addCons(Truck1 + Truck2 + Van + Motorcycle >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck1 Vehicles: \", model.getVal(Truck1))\n    print(\"Number of Truck2 Vehicles: \", model.getVal(Truck2))\n    print(\"Number of Van Vehicles: \", model.getVal(Van))\n    print(\"Number of Motorcycle Vehicles: \", model.getVal(Motorcycle))\n    print(\"Minimized Cost per Delivery Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The company also needs to decide on the level of investment in fuel-efficient technologies for each region, which affects the fuel consumption rate of the trucks.\n// {\"number of trucks in Region1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks in Region3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient technologies for Region1\": \"TechInvest1\", \"range\": \"TechInvest1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region2\": \"TechInvest2\", \"range\": \"TechInvest2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient technologies for Region3\": \"TechInvest3\", \"range\": \"TechInvest3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of the trucks decreases with the investment in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region. The initial fuel consumption rate is 3 liters per kilometer. The company aims to minimize the total fuel consumption across all regions.\n// Fuel consumption for Region1: Fuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\n// Fuel consumption for Region2: Fuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\n// Fuel consumption for Region3: Fuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocation and technology investments.\n// Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000",
        "question": "A logistics company operates a fleet of trucks to transport goods across different regions. The company needs to determine the optimal number of trucks to allocate to each region and the level of investment in fuel-efficient technologies for each region to maximize efficiency while minimizing fuel consumption and maintenance costs. The fuel consumption rate of the trucks decreases with the investment in fuel-efficient technologies. For every $1000 invested in technology, the fuel consumption rate decreases by 0.1 liters per kilometer for all trucks in that region. The initial fuel consumption rate is 3 liters per kilometer. The company aims to minimize the total fuel consumption across all regions. The company has a total budget of $100,000 for truck allocation and technology investments.\n\nPlease help the company to determine the optimal allocation of trucks and investments in fuel-efficient technologies to minimize the total fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0) # number of trucks in Region1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0) # number of trucks in Region2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0) # number of trucks in Region3\nTechInvest1 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest1\", lb=0) # investment in fuel-efficient technologies for Region1\nTechInvest2 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest2\", lb=0) # investment in fuel-efficient technologies for Region2\nTechInvest3 = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest3\", lb=0) # investment in fuel-efficient technologies for Region3\n\n# Define objective function\nFuel1 = 3 - 0.0001 * TechInvest1 * Trucks1\nFuel2 = 3 - 0.0001 * TechInvest2 * Trucks2\nFuel3 = 3 - 0.0001 * TechInvest3 * Trucks3\n# So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocation and technology investments.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 + TechInvest1 + TechInvest2 + TechInvest3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks in Region1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks in Region2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks in Region3: \", model.getVal(Trucks3))\n    print(\"Investment in Tech for Region1: \", model.getVal(TechInvest1))\n    print(\"Investment in Tech for Region2: \", model.getVal(TechInvest2))\n    print(\"Investment in Tech for Region3: \", model.getVal(TechInvest3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 957,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"number of DeviceA produced\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceB produced\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of DeviceC produced\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor used\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"real\"}\n// {\"number of units of raw material used\": \"RawMaterial\", \"range\": \"RawMaterial >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company wants to maximize the total profit from selling all devices.\n// Total profit: Profit = (50 * DeviceA + 70 * DeviceB + 60 * DeviceC) - (20 * LaborHours + 10 * RawMaterial)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for the quarter.\n// LaborHours <= 1000\n\n## Generate Constraint-2:\nThe production of each device requires a certain amount of labor and raw material: DeviceA requires 2 hours of labor and 3 units of raw material, DeviceB requires 4 hours of labor and 2 units of raw material, and DeviceC requires 3 hours of labor and 4 units of raw material.\n// 2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours\n// 3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial\n\n## Generate Constraint-3:\nThe company has a budget of $15,000 for labor and raw material costs for the quarter.\n// 20 * LaborHours + 10 * RawMaterial <= 15,000\n\n## Generate Constraint-4:\nThe market demand for DeviceA is at least 50 units, for DeviceB is at least 70 units, and for DeviceC is at least 60 units.\n// DeviceA >= 50\n// DeviceB >= 70\n// DeviceC >= 60\n\n## Generate Constraint-5:\nDue to environmental regulations, the total amount of raw material used must not exceed 1200 units.\n// RawMaterial <= 1200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The cost of labor per hour is $20, and the cost of raw material per unit is $10. The company has a total of 1000 hours of labor available for the quarter and a budget of $15,000 for labor and raw material costs for the quarter. The production of each device requires a certain amount of labor and raw material: DeviceA requires 2 hours of labor and 3 units of raw material, DeviceB requires 4 hours of labor and 2 units of raw material, and DeviceC requires 3 hours of labor and 4 units of raw material. The market demand for DeviceA is at least 50 units, for DeviceB is at least 70 units, and for DeviceC is at least 60 units. Due to environmental regulations, the total amount of raw material used must not exceed 1200 units. Please help the company to maximize the total profit from selling all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=50)  # number of DeviceA produced\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=70)  # number of DeviceB produced\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=60)  # number of DeviceC produced\nLaborHours = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHours\", lb=0)  # number of hours of labor used\nRawMaterial = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterial\", lb=0)  # number of units of raw material used\n\n# Define objective function\nProfit = 50 * DeviceA + 70 * DeviceB + 60 * DeviceC - 20 * LaborHours - 10 * RawMaterial\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * DeviceA + 4 * DeviceB + 3 * DeviceC <= LaborHours)\nmodel.addCons(3 * DeviceA + 2 * DeviceB + 4 * DeviceC <= RawMaterial)\nmodel.addCons(20 * LaborHours + 10 * RawMaterial <= 15000)\nmodel.addCons(LaborHours <= 1000)\nmodel.addCons(RawMaterial <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA produced: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB produced: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC produced: \", model.getVal(DeviceC))\n    print(\"Number of hours of labor used: \", model.getVal(LaborHours))\n    print(\"Number of units of raw material used: \", model.getVal(RawMaterial))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize delivery routes. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company also needs to decide on the investment in alternative fuel technologies for each vehicle type to reduce environmental impact and operational costs.\n// {\"number of Small trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"investment in alternative fuel technology for Small trucks\": \"AltFuelSmall\", \"range\": \"AltFuelSmall >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Medium trucks\": \"AltFuelMedium\", \"range\": \"AltFuelMedium >= 0\", \"type\": \"continuous\"}\n// {\"investment in alternative fuel technology for Large trucks\": \"AltFuelLarge\", \"range\": \"AltFuelLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational cost reduction due to alternative fuel technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces the operational cost by $10 per truck per year. For Medium trucks, each $1000 invested reduces the operational cost by $15 per truck per year. For Large trucks, each $1000 invested reduces the operational cost by $20 per truck per year. The company aims to minimize the total operational cost of the fleet.\n// Operational cost for Small trucks: CostSmall = (InitialCostSmall - 0.01 * AltFuelSmall) * SmallTrucks\n// Operational cost for Medium trucks: CostMedium = (InitialCostMedium - 0.015 * AltFuelMedium) * MediumTrucks\n// Operational cost for Large trucks: CostLarge = (InitialCostLarge - 0.02 * AltFuelLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for fleet expansion and alternative fuel technology investments.\n// SmallTrucks + MediumTrucks + LargeTrucks + AltFuelSmall + AltFuelMedium + AltFuelLarge <= 200000\n\n## Generate Constraint-2:\nThe total number of trucks in the fleet must not exceed 100.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 100\n\n## Generate Constraint-3:\nAt least 20% of the fleet must be Large trucks to handle heavy loads.\n// LargeTrucks >= 0.2 * (SmallTrucks + MediumTrucks + LargeTrucks)\n\n## Generate Constraint-4:\nThe investment in alternative fuel technology for each vehicle type must not exceed 50% of the total investment in that type of vehicle.\n// AltFuelSmall <= 0.5 * SmallTrucks\n// AltFuelMedium <= 0.5 * MediumTrucks\n// AltFuelLarge <= 0.5 * LargeTrucks",
        "question": "A logistics company is planning its fleet expansion to optimize delivery routes. The company operates three types of vehicles: Small, Medium, and Large trucks. Each vehicle type has different fuel efficiency, capacity, and operational costs. The company also needs to decide on the investment in alternative fuel technologies for each vehicle type to reduce environmental impact and operational costs. The operational cost reduction due to alternative fuel technology is nonlinear and varies with the investment amount. For Small trucks, each $1000 invested reduces the operational cost by $10 per truck per year. For Medium trucks, each $1000 invested reduces the operational cost by $15 per truck per year. For Large trucks, each $1000 invested reduces the operational cost by $20 per truck per year. The company aims to minimize the total operational cost of the fleet. The company has a budget of $200,000 for fleet expansion and alternative fuel technology investments. The total number of trucks in the fleet must not exceed 100. At least 20% of the fleet must be Large trucks to handle heavy loads. The investment in alternative fuel technology for each vehicle type must not exceed 50% of the total investment in that type of vehicle.\n\nPlease help the company to determine the optimal number of each type of truck and the investment in alternative fuel technology to minimize the total operational cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=0)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=0)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=0)\nAltFuelSmall = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelSmall\", lb=0)\nAltFuelMedium = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelMedium\", lb=0)\nAltFuelLarge = model.addVar(vtype=\"CONTINUOUS\", name=\"AltFuelLarge\", lb=0)\n\n# Define objective function\n## Operational cost for Small trucks: CostSmall = (InitialCostSmall - 0.01 * AltFuelSmall) * SmallTrucks\n## Operational cost for Medium trucks: CostMedium = (InitialCostMedium - 0.015 * AltFuelMedium) * MediumTrucks\n## Operational cost for Large trucks: CostLarge = (InitialCostLarge - 0.02 * AltFuelLarge) * LargeTrucks\n## So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\nCostSmall = (100 - 0.01 * AltFuelSmall) * SmallTrucks\nCostMedium = (100 - 0.015 * AltFuelMedium) * MediumTrucks\nCostLarge = (100 - 0.02 * AltFuelLarge) * LargeTrucks\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\n## The company has a budget of $200,000 for fleet expansion and alternative fuel technology investments.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks + AltFuelSmall + AltFuelMedium + AltFuelLarge <= 200000)\n## The total number of trucks in the fleet must not exceed 100.\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 100)\n## At least 20% of the fleet must be Large trucks to handle heavy loads.\nmodel.addCons(LargeTrucks >= 0.2 * (SmallTrucks + MediumTrucks + LargeTrucks))\n## The investment in alternative fuel technology for each vehicle type must not exceed 50% of the total investment in that type of vehicle.\nmodel.addCons(AltFuelSmall <= 0.5 * SmallTrucks)\nmodel.addCons(AltFuelMedium <= 0.5 * MediumTrucks)\nmodel.addCons(AltFuelLarge <= 0.5 * LargeTrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Investment in Alternative Fuel for Small Trucks: \", model.getVal(AltFuelSmall))\n    print(\"Investment in Alternative Fuel for Medium Trucks: \", model.getVal(AltFuelMedium))\n    print(\"Investment in Alternative Fuel for Large Trucks: \", model.getVal(AltFuelLarge))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1424,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductA\": \"WorkersA\", \"range\": \"WorkersA >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductB\": \"WorkersB\", \"range\": \"WorkersB >= 0\", \"type\": \"integer\"}\n// {\"number of workers for ProductC\": \"WorkersC\", \"range\": \"WorkersC >= 0\", \"type\": \"integer\"}\n// {\"capital investment in automation for ProductA\": \"AutomationA\", \"range\": \"AutomationA >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductB\": \"AutomationB\", \"range\": \"AutomationB >= 0\", \"type\": \"continuous\"}\n// {\"capital investment in automation for ProductC\": \"AutomationC\", \"range\": \"AutomationC >= 0\", \"type\": \"continuous\"}\n// {\"storage capacity for ProductA\": \"StorageA\", \"range\": \"StorageA >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductB\": \"StorageB\", \"range\": \"StorageB >= 0\", \"type\": \"integer\"}\n// {\"storage capacity for ProductC\": \"StorageC\", \"range\": \"StorageC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production time per unit decreases by 1 minute for every $1000 invested in automation for that product. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to automation.\n// Total revenue for ProductA: RevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n// So, the objective function is: Maximize (RevenueA + RevenueB + RevenueC)\n\n## Generate Constraint-1:\nThe company has a total of 100 workers available.\n// WorkersA + WorkersB + WorkersC <= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the number of workers assigned to each product line, and the amount of capital investment in automation technology for each product line. The automation technology reduces the production time per unit of product. The company also needs to consider the storage capacity for each product. The production time per unit decreases by 1 minute for every $1000 invested in automation for that product. The initial production time per unit for ProductA is 30 minutes, for ProductB is 25 minutes, and for ProductC is 20 minutes. The revenue per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total revenue from all products, considering the reduced production time due to automation. The company has a total of 100 workers available. Please help the company determine the optimal production quantities, worker allocations, and capital investments in automation to maximize total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nWorkersA = model.addVar(vtype=\"INTEGER\", name=\"WorkersA\", lb=0)  # number of workers for ProductA\nWorkersB = model.addVar(vtype=\"INTEGER\", name=\"WorkersB\", lb=0)  # number of workers for ProductB\nWorkersC = model.addVar(vtype=\"INTEGER\", name=\"WorkersC\", lb=0)  # number of workers for ProductC\nAutomationA = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationA\", lb=0)  # capital investment in automation for ProductA\nAutomationB = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationB\", lb=0)  # capital investment in automation for ProductB\nAutomationC = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationC\", lb=0)  # capital investment in automation for ProductC\n\n# Define objective function\nRevenueA = (100 - (30 - 0.001 * AutomationA)) * QuantityA\nRevenueB = (120 - (25 - 0.001 * AutomationB)) * QuantityB\nRevenueC = (150 - (20 - 0.001 * AutomationC)) * QuantityC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA + RevenueB + RevenueC)\n\n# Add constraints\nmodel.addCons(WorkersA + WorkersB + WorkersC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Number of Workers for ProductA: \", model.getVal(WorkersA))\n    print(\"Number of Workers for ProductB: \", model.getVal(WorkersB))\n    print(\"Number of Workers for ProductC: \", model.getVal(WorkersC))\n    print(\"Capital Investment in Automation for ProductA: \", model.getVal(AutomationA))\n    print(\"Capital Investment in Automation for ProductB: \", model.getVal(AutomationB))\n    print(\"Capital Investment in Automation for ProductC: \", model.getVal(AutomationC))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1094,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphones = 100 * Smartphones\n// Profit_Tablets = 150 * Tablets\n// Profit_Laptops = 200 * Laptops\n// So, the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. The production time for Smartphones is 2 hours per unit, for Tablets is 3 hours per unit, and for Laptops is 4 hours per unit.\n// 2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the optimal number of each device to produce to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company has a limited production capacity of 1000 hours per week. The production time for Smartphones is 2 hours per unit, for Tablets is 3 hours per unit, and for Laptops is 4 hours per unit. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0) # number of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0) # number of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0) # number of Laptops\n\n# Define objective function\nProfit_Smartphones = 100 * Smartphones\nProfit_Tablets = 150 * Tablets\nProfit_Laptops = 200 * Laptops\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_Smartphones + Profit_Tablets + Profit_Laptops)\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * Smartphones + 3 * Tablets + 4 * Laptops <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 675,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantities for each product to optimize their profit margin.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductD\": \"ProdD\", \"range\": \"ProdD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. \nThe profit per unit for ProductB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units.\nThe profit per unit for ProductC is $60, but it decreases by $0.08 for each unit produced beyond the first 150 units.\nThe profit per unit for ProductD is $80, but it decreases by $0.12 for each unit produced beyond the first 250 units.\nThe company wants to maximize the total profit from all products.\n// Profit for ProductA: Profit_A = (50 - 0.1 * max(0, ProdA - 100)) * ProdA\n// Profit for ProductB: Profit_B = (70 - 0.05 * max(0, ProdB - 200)) * ProdB\n// Profit for ProductC: Profit_C = (60 - 0.08 * max(0, ProdC - 150)) * ProdC\n// Profit for ProductD: Profit_D = (80 - 0.12 * max(0, ProdD - 250)) * ProdD\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProdA + ProdB + ProdC + ProdD <= 1000",
        "question": "A manufacturing company is planning to produce four different types of products: ProductA, ProductB, ProductC, and ProductD. They need to determine the production quantities for each product to optimize their profit margin. The profit per unit for each product decreases as more units are produced beyond certain thresholds, as shown in the following Table.\n\n| Product | Profit per Unit (First Threshold) | Decrease per Unit Beyond Threshold | Threshold |\n|---------|-----------------------------------|------------------------------------|-----------|\n| ProductA | $50 (first 100 units)             | $0.1                               | 100 units  |\n| ProductB | $70 (first 200 units)             | $0.05                              | 200 units  |\n| ProductC | $60 (first 150 units)             | $0.08                              | 150 units  |\n| ProductD | $80 (first 250 units)             | $0.12                              | 250 units  |\n\nThe company has a total production capacity of 1000 units for all products combined. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nProdD = model.addVar(vtype=\"INTEGER\", name=\"ProdD\", lb=0) # production quantity for ProductD\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(0, ProdA - 100)) * ProdA\nProdA1 = model.addVar(vtype=\"INTEGER\", name=\"ProdA1\", lb=0, ub=100)\nProdA2 = model.addVar(vtype=\"INTEGER\", name=\"ProdA2\", lb=100, ub=1000)\nProdA_b1 = model.addVar(vtype=\"B\", name=\"ProdA_b1\")\nProdA_b2 = model.addVar(vtype=\"B\", name=\"ProdA_b2\")\nmodel.addCons(ProdA_b1 + ProdA_b2 == 1)\nmodel.addCons(ProdA == ProdA1*ProdA_b1 + ProdA2*ProdA_b2)\nProfit_A = (50 - 0.1 * ProdA2) * ProdA2 * ProdA_b2 + 50 * ProdA1 * ProdA_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.05 * max(0, ProdB - 200)) * ProdB\nProdB1 = model.addVar(vtype=\"INTEGER\", name=\"ProdB1\", lb=0, ub=200)\nProdB2 = model.addVar(vtype=\"INTEGER\", name=\"ProdB2\", lb=200, ub=1000)\nProdB_b1 = model.addVar(vtype=\"B\", name=\"ProdB_b1\")\nProdB_b2 = model.addVar(vtype=\"B\", name=\"ProdB_b2\")\nmodel.addCons(ProdB_b1 + ProdB_b2 == 1)\nmodel.addCons(ProdB == ProdB1*ProdB_b1 + ProdB2*ProdB_b2)\nProfit_B = (70 - 0.05 * ProdB2) * ProdB2 * ProdB_b2 + 70 * ProdB1 * ProdB_b1\n## create piecewise variables for piecewise function: Profit_C = (60 - 0.08 * max(0, ProdC - 150)) * ProdC\nProdC1 = model.addVar(vtype=\"INTEGER\", name=\"ProdC1\", lb=0, ub=150)\nProdC2 = model.addVar(vtype=\"INTEGER\", name=\"ProdC2\", lb=150, ub=1000)\nProdC_b1 = model.addVar(vtype=\"B\", name=\"ProdC_b1\")\nProdC_b2 = model.addVar(vtype=\"B\", name=\"ProdC_b2\")\nmodel.addCons(ProdC_b1 + ProdC_b2 == 1)\nmodel.addCons(ProdC == ProdC1*ProdC_b1 + ProdC2*ProdC_b2)\nProfit_C = (60 - 0.08 * ProdC2) * ProdC2 * ProdC_b2 + 60 * ProdC1 * ProdC_b1\n## create piecewise variables for piecewise function: Profit_D = (80 - 0.12 * max(0, ProdD - 250)) * ProdD\nProdD1 = model.addVar(vtype=\"INTEGER\", name=\"ProdD1\", lb=0, ub=250)\nProdD2 = model.addVar(vtype=\"INTEGER\", name=\"ProdD2\", lb=250, ub=1000)\nProdD_b1 = model.addVar(vtype=\"B\", name=\"ProdD_b1\")\nProdD_b2 = model.addVar(vtype=\"B\", name=\"ProdD_b2\")\nmodel.addCons(ProdD_b1 + ProdD_b2 == 1)\nmodel.addCons(ProdD == ProdD1*ProdD_b1 + ProdD2*ProdD_b2)\nProfit_D = (80 - 0.12 * ProdD2) * ProdD2 * ProdD_b2 + 80 * ProdD1 * ProdD_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC + ProdD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Production Quantity for ProductD: \", model.getVal(ProdD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product and the amount of resources (labor and materials) allocated to each product. The resource allocation affects the production cost per unit and the production rate. The company also needs to decide on the marketing budget for each product, which influences the sales rate.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"resource allocation for ProductA\": \"ResourcesA\", \"range\": \"ResourcesA >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductB\": \"ResourcesB\", \"range\": \"ResourcesB >= 0\", \"type\": \"continuous\"}\n// {\"resource allocation for ProductC\": \"ResourcesC\", \"range\": \"ResourcesC >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductA\": \"MarketingA\", \"range\": \"MarketingA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingB\", \"range\": \"MarketingB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingC\", \"range\": \"MarketingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * ResourcesA, for ProductB is $60 - 0.01 * ResourcesB, and for ProductC is $70 - 0.01 * ResourcesC. The sales price per unit is $100 for all products. The sales rate per unit is 1 + 0.005 * MarketingA for ProductA, 1 + 0.005 * MarketingB for ProductB, and 1 + 0.005 * MarketingC for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 * (1 + 0.005 * MarketingA) - (50 - 0.01 * ResourcesA)) * UnitsA\n// Total profit for ProductB: ProfitB = (100 * (1 + 0.005 * MarketingB) - (60 - 0.01 * ResourcesB)) * UnitsB\n// Total profit for ProductC: ProfitC = (100 * (1 + 0.005 * MarketingC) - (70 - 0.01 * ResourcesC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resource allocation across all products cannot exceed 1000 units.\n// ResourcesA + ResourcesB + ResourcesC <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products cannot exceed $5000.\n// MarketingA + MarketingB + MarketingC <= 5000\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC.\n// UnitsA <= 500; UnitsB <= 400; UnitsC <= 300",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the number of units to produce for each product, the amount of resources (labor and materials) allocated to each product, and the marketing budget for each product. The resource allocation affects the production cost per unit and the production rate, while the marketing budget influences the sales rate. The production cost per unit, sales price per unit, and sales rate per unit for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Sales Price per Unit | Sales Rate per Unit |\n|---------|--------------------------|----------------------|---------------------|\n| ProductA | $50 - 0.01 * ResourcesA | $100 | 1 + 0.005 * MarketingA |\n| ProductB | $60 - 0.01 * ResourcesB | $100 | 1 + 0.005 * MarketingB |\n| ProductC | $70 - 0.01 * ResourcesC | $100 | 1 + 0.005 * MarketingC |\n\nThe company has a total resource allocation limit of 1000 units across all products. The total marketing budget for all products cannot exceed $5000. The company has a production capacity limit of 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nResourcesA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesA\", lb=0) # resource allocation for ProductA\nResourcesB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesB\", lb=0) # resource allocation for ProductB\nResourcesC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourcesC\", lb=0) # resource allocation for ProductC\nMarketingA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingA\", lb=0) # marketing budget for ProductA\nMarketingB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingB\", lb=0) # marketing budget for ProductB\nMarketingC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\nProfitA = (100 * (1 + 0.005 * MarketingA) - (50 - 0.01 * ResourcesA)) * UnitsA\nProfitB = (100 * (1 + 0.005 * MarketingB) - (60 - 0.01 * ResourcesB)) * UnitsB\nProfitC = (100 * (1 + 0.005 * MarketingC) - (70 - 0.01 * ResourcesC)) * UnitsC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total resource allocation across all products cannot exceed 1000 units.\nmodel.addCons(ResourcesA + ResourcesB + ResourcesC <= 1000)\n# The total marketing budget for all products cannot exceed $5000.\nmodel.addCons(MarketingA + MarketingB + MarketingC <= 5000)\n# The company has a production capacity limit of 500 units for ProductA, 400 units for ProductB, and 300 units for ProductC.\nmodel.addCons(UnitsA <= 500)\nmodel.addCons(UnitsB <= 400)\nmodel.addCons(UnitsC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Resource Allocation for ProductA: \", model.getVal(ResourcesA))\n    print(\"Resource Allocation for ProductB: \", model.getVal(ResourcesB))\n    print(\"Resource Allocation for ProductC: \", model.getVal(ResourcesC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs.\n// {\"number of Small Trucks\": \"SmallTrucks\", \"range\": \"SmallTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Medium Trucks\": \"MediumTrucks\", \"range\": \"MediumTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of Large Trucks\": \"LargeTrucks\", \"range\": \"LargeTrucks >= 0\", \"type\": \"integer\"}\n// {\"technology upgrade for Small Trucks\": \"TechUpgradeSmall\", \"range\": \"TechUpgradeSmall >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Medium Trucks\": \"TechUpgradeMedium\", \"range\": \"TechUpgradeMedium >= 0\", \"type\": \"continuous\"}\n// {\"technology upgrade for Large Trucks\": \"TechUpgradeLarge\", \"range\": \"TechUpgradeLarge >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost.\n// Operational cost for Small Trucks: CostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\n// Operational cost for Medium Trucks: CostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\n// Operational cost for Large Trucks: CostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n// So, the objective function is: Minimize (CostSmall + CostMedium + CostLarge)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for fleet expansion and technology upgrades.\n// 100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000\n\n## Generate Constraint-2:\nThe total number of trucks to be added to the fleet should not exceed 10.\n// SmallTrucks + MediumTrucks + LargeTrucks <= 10\n\n## Generate Constraint-3:\nAt least 3 trucks of each type must be purchased.\n// SmallTrucks >= 3; MediumTrucks >= 3; LargeTrucks >= 3\n\n## Generate Constraint-4:\nThe technology upgrade for any type of truck should not exceed $50,000.\n// TechUpgradeSmall <= 50000; TechUpgradeMedium <= 50000; TechUpgradeLarge <= 50000",
        "question": "A logistics company is planning its fleet expansion for the next year. The company operates three types of vehicles: Small Trucks, Medium Trucks, and Large Trucks. The company needs to decide how many of each type of truck to purchase and the level of technology upgrade for each type to optimize fuel efficiency and operational costs. The fuel efficiency of each truck type improves with the level of technology upgrade. The cost savings per kilometer for Small Trucks is $0.10 less for every $100 invested in technology upgrade. For Medium Trucks, it's $0.15 less per kilometer for every $100 invested. For Large Trucks, it's $0.20 less per kilometer for every $100 invested. The company aims to minimize the total operational cost, which includes the initial purchase cost and the ongoing fuel cost. The company has a budget of $1,000,000 for fleet expansion and technology upgrades. The total number of trucks to be added to the fleet should not exceed 10. At least 3 trucks of each type must be purchased. The technology upgrade for any type of truck should not exceed $50,000. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmallTrucks = model.addVar(vtype=\"INTEGER\", name=\"SmallTrucks\", lb=3)\nMediumTrucks = model.addVar(vtype=\"INTEGER\", name=\"MediumTrucks\", lb=3)\nLargeTrucks = model.addVar(vtype=\"INTEGER\", name=\"LargeTrucks\", lb=3)\nTechUpgradeSmall = model.addVar(name=\"TechUpgradeSmall\", lb=0, ub=50000)\nTechUpgradeMedium = model.addVar(name=\"TechUpgradeMedium\", lb=0, ub=50000)\nTechUpgradeLarge = model.addVar(name=\"TechUpgradeLarge\", lb=0, ub=50000)\n\n# Define objective function\nCostSmall = (100000 + 0.001 * TechUpgradeSmall) * SmallTrucks\nCostMedium = (150000 + 0.0015 * TechUpgradeMedium) * MediumTrucks\nCostLarge = (200000 + 0.002 * TechUpgradeLarge) * LargeTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostSmall + CostMedium + CostLarge)\n\n# Add constraints\nmodel.addCons(100000 * SmallTrucks + 150000 * MediumTrucks + 200000 * LargeTrucks + TechUpgradeSmall + TechUpgradeMedium + TechUpgradeLarge <= 1000000)\nmodel.addCons(SmallTrucks + MediumTrucks + LargeTrucks <= 10)\nmodel.addCons(TechUpgradeSmall <= 50000)\nmodel.addCons(TechUpgradeMedium <= 50000)\nmodel.addCons(TechUpgradeLarge <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Trucks: \", model.getVal(SmallTrucks))\n    print(\"Number of Medium Trucks: \", model.getVal(MediumTrucks))\n    print(\"Number of Large Trucks: \", model.getVal(LargeTrucks))\n    print(\"Technology Upgrade for Small Trucks: \", model.getVal(TechUpgradeSmall))\n    print(\"Technology Upgrade for Medium Trucks: \", model.getVal(TechUpgradeMedium))\n    print(\"Technology Upgrade for Large Trucks: \", model.getVal(TechUpgradeLarge))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $100, for product B is $150, and for product C is $200. The production cost per unit for product A is $50, for product B is $75, and for product C is $100. The company aims to maximize the total profit, which is the difference between the revenue and the cost.\n// Profit_A = (100 - 50) * A = 50 * A\n// Profit_B = (150 - 75) * B = 75 * B\n// Profit_C = (200 - 100) * C = 100 * C\n// So, the objective function is: Maximize (50 * A + 75 * B + 100 * C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for production costs.\n// 50 * A + 75 * B + 100 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal number of units to produce for each product to maximize their profit while considering various constraints. The profit per unit for product A is $100, for product B is $150, and for product C is $200. The production cost per unit for product A is $50, for product B is $75, and for product C is $100. The company has a total budget of $5000 for production costs. Please help the company to maximize the total profit, which is the difference between the revenue and the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * A + 75 * B + 100 * C)\nmodel.addCons(obj == 50 * A + 75 * B + 100 * C)\n\n# Add constraints\n## The company has a total budget of $5000 for production costs.\nmodel.addCons(50 * A + 75 * B + 100 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 580,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 6\": \"T6\", \"range\": \"T6 >= 0\", \"type\": \"integer\"}\n// {\"distance from depot to warehouse 1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 4\": \"D4\", \"range\": \"D4 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 5\": \"D5\", \"range\": \"D5 >= 0\", \"type\": \"real\"}\n// {\"distance from depot to warehouse 6\": \"D6\", \"range\": \"D6 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe transportation cost is calculated based on the number of trucks and the distance each truck travels. The cost per kilometer is $2. The company aims to minimize the total transportation cost.\n// Total_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n// So, the objective function is: Minimize Total_Cost\n// Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\n\n## Generate Constraint-1:\nThe total number of trucks available is 50.\n// T1 + T2 + T3 + T4 + T5 + T6 <= 50",
        "question": "A logistics company operates 6 warehouses across different regions. The company needs to optimize the allocation of trucks to each warehouse to minimize the overall transportation cost while ensuring timely delivery of goods. The number of trucks allocated to each warehouse and the distance each truck travels from the central depot to the warehouse are variables to be determined. The transportation cost is calculated based on the number of trucks and the distance each truck travels, with a cost of $2 per kilometer. The company aims to minimize the total transportation cost. The total number of trucks available is 50. Please help the company determine the optimal allocation of trucks and distances to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks at warehouse 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks at warehouse 5\nT6 = model.addVar(vtype=\"INTEGER\", name=\"T6\", lb=0) # number of trucks at warehouse 6\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=0) # distance from depot to warehouse 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=0) # distance from depot to warehouse 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=0) # distance from depot to warehouse 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=0) # distance from depot to warehouse 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=0) # distance from depot to warehouse 5\nD6 = model.addVar(vtype=\"CONTINUOUS\", name=\"D6\", lb=0) # distance from depot to warehouse 6\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nTotal_Cost = 2 * (T1 * D1 + T2 * D2 + T3 * D3 + T4 * D4 + T5 * D5 + T6 * D6)\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\n## The total number of trucks available is 50.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 + T6 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Number of Trucks at Warehouse 4: \", model.getVal(T4))\n    print(\"Number of Trucks at Warehouse 5: \", model.getVal(T5))\n    print(\"Number of Trucks at Warehouse 6: \", model.getVal(T6))\n    print(\"Distance from Depot to Warehouse 1: \", model.getVal(D1))\n    print(\"Distance from Depot to Warehouse 2: \", model.getVal(D2))\n    print(\"Distance from Depot to Warehouse 3: \", model.getVal(D3))\n    print(\"Distance from Depot to Warehouse 4: \", model.getVal(D4))\n    print(\"Distance from Depot to Warehouse 5: \", model.getVal(D5))\n    print(\"Distance from Depot to Warehouse 6: \", model.getVal(D6))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 12,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"DeviceD\", \"range\": \"DeviceD >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceE\": \"DeviceE\", \"range\": \"DeviceE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, but it requires 2 hours of labor and 1 unit of raw material.\nThe profit per unit for DeviceB is $150, but it requires 3 hours of labor and 2 units of raw material.\nThe profit per unit for DeviceC is $200, but it requires 4 hours of labor and 3 units of raw material.\nThe profit per unit for DeviceD is $120, but it requires 2.5 hours of labor and 1.5 units of raw material.\nThe profit per unit for DeviceE is $180, but it requires 3.5 hours of labor and 2.5 units of raw material.\nThe company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n// Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n// Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n// Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n// The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 labor hours available per week.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 1500 units of raw material available per week.\n// DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE <= 1500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// DeviceA >= 100; DeviceB >= 100; DeviceC >= 100; DeviceD >= 100; DeviceE >= 100\n\n## Generate Constraint-4:\nThe company has a budget of $100,000 for production costs, which includes labor and raw material costs.\n// (2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE) * 10 + (DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE) * 5 <= 100000",
        "question": "A manufacturing company produces five types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. The company needs to decide how many units of each device to produce to optimize their profit. The profit per unit, labor hours, and raw material units required for each device are given in the following Table.\n\n| Device | Profit per Unit | Labor Hours | Raw Material Units |\n|--------|-----------------|-------------|--------------------|\n| DeviceA | $100 | 2 | 1 |\n| DeviceB | $150 | 3 | 2 |\n| DeviceC | $200 | 4 | 3 |\n| DeviceD | $120 | 2.5 | 1.5 |\n| DeviceE | $180 | 3.5 | 2.5 |\n\nThe company has a total of 1000 labor hours and 1500 units of raw material available per week. The company wants to ensure that at least 100 units of each device are produced to maintain market presence. The company has a budget of $100,000 for production costs, which includes labor and raw material costs. The company wants to maximize the total profit while considering the nonlinear relationship between labor hours and production efficiency.\n\nPlease help the company to maximize the total profit, considering the nonlinear relationship between labor hours and production efficiency, as defined by the objective function: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2), where Profit is the total profit, Labor is the total labor hours, and RawMaterial is the total raw material units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=100) # number of units of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=100) # number of units of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=100) # number of units of DeviceC\nDeviceD = model.addVar(vtype=\"INTEGER\", name=\"DeviceD\", lb=100) # number of units of DeviceD\nDeviceE = model.addVar(vtype=\"INTEGER\", name=\"DeviceE\", lb=100) # number of units of DeviceE\n\n# Define objective function\n## Total profit: Profit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\n## Labor constraint: Labor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\n## Raw material constraint: RawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\n## The objective function is: Maximize Profit - 0.01 * (Labor^2 + RawMaterial^2)\n## Convert the nonlinear term to a linear constraint\nLabor = 2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE\nRawMaterial = DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE\nLabor_squared = model.addVar(name=\"Labor_squared\")\nRawMaterial_squared = model.addVar(name=\"RawMaterial_squared\")\nmodel.addCons(Labor_squared == Labor**2)\nmodel.addCons(RawMaterial_squared == RawMaterial**2)\nProfit = 100 * DeviceA + 150 * DeviceB + 200 * DeviceC + 120 * DeviceD + 180 * DeviceE\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - 0.01 * (Labor_squared + RawMaterial_squared))\n\n# Add constraints\n## The company has a total of 1000 labor hours available per week.\nmodel.addCons(Labor <= 1000)\n## The company has a total of 1500 units of raw material available per week.\nmodel.addCons(RawMaterial <= 1500)\n## The company has a budget of $100,000 for production costs, which includes labor and raw material costs.\nmodel.addCons((2 * DeviceA + 3 * DeviceB + 4 * DeviceC + 2.5 * DeviceD + 3.5 * DeviceE) * 10 + (DeviceA + 2 * DeviceB + 3 * DeviceC + 1.5 * DeviceD + 2.5 * DeviceE) * 5 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(DeviceA))\n    print(\"Number of DeviceB: \", model.getVal(DeviceB))\n    print(\"Number of DeviceC: \", model.getVal(DeviceC))\n    print(\"Number of DeviceD: \", model.getVal(DeviceD))\n    print(\"Number of DeviceE: \", model.getVal(DeviceE))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1392,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of ProductA\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"QC\", \"range\": \"QC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"0 <= Automation <= 100\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost per unit by $0.5 for every unit of automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize the total profit.\n// CostA = (100 - 0.5 * Automation) * QA\n// CostB = (150 - 0.5 * Automation) * QB\n// CostC = (200 - 0.5 * Automation) * QC\n// RevenueA = 150 * QA\n// RevenueB = 200 * QB\n// RevenueC = 250 * QC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for implementing automation.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 1000 units.\n// QA + QB + QC <= 1000\n\n## Generate Constraint-3:\nThe market demand for ProductA is at least 100 units and for ProductB is at least 150 units.\n// QA >= 100; QB >= 150",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The cost of producing ProductA is $100 per unit, ProductB is $150 per unit, and ProductC is $200 per unit. Implementing automation reduces the cost per unit by $0.5 for every unit of automation. The revenue for ProductA is $150 per unit, ProductB is $200 per unit, and ProductC is $250 per unit. The company aims to maximize the total profit.\nThe company has a budget of $50,000 for implementing automation. The total production capacity for all products is 1000 units. The market demand for ProductA is at least 100 units and for ProductB is at least 150 units.\nPlease help the company determine the optimal production quantities for each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=100) # quantity of ProductA\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=150) # quantity of ProductB\nQC = model.addVar(vtype=\"INTEGER\", name=\"QC\", lb=0) # quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nCostA = (100 - 0.5 * Automation) * QA\nCostB = (150 - 0.5 * Automation) * QB\nCostC = (200 - 0.5 * Automation) * QC\nRevenueA = 150 * QA\nRevenueB = 200 * QB\nRevenueC = 250 * QC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(QA + QB + QC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QA))\n    print(\"Quantity of ProductB: \", model.getVal(QB))\n    print(\"Quantity of ProductC: \", model.getVal(QC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on route 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 4\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route 5\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost and revenue structure. Route 1 has a cost per truck of $1000 and generates a revenue of $1500 per truck. Route 2 has a cost per truck of $1200 and generates a revenue of $1800 per truck. Route 3 has a cost per truck of $1100 and generates a revenue of $1600 per truck. Route 4 has a cost per truck of $1300 and generates a revenue of $1900 per truck. Route 5 has a cost per truck of $1400 and generates a revenue of $2000 per truck. The company wants to maximize the total net profit from all routes, where net profit is the revenue minus the cost.\n// Net_Profit_Route1 = (1500 - 1000) * T1\n// Net_Profit_Route2 = (1800 - 1200) * T2\n// Net_Profit_Route3 = (1600 - 1100) * T3\n// Net_Profit_Route4 = (1900 - 1300) * T4\n// Net_Profit_Route5 = (2000 - 1400) * T5\n// So, the objective function is: Maximize Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5\n\n## Generate Constraint-1:\nThe company has a total of 100 trucks available for allocation.\n// T1 + T2 + T3 + T4 + T5 <= 100",
        "question": "A logistics company operates five different routes for delivering goods. They need to determine the number of trucks to allocate to each route to optimize their operations. The cost per truck and the revenue generated per truck for each route are given in the following Table.\n\n| Route | Cost per Truck | Revenue per Truck |\n|-------|----------------|-------------------|\n| 1     | $1000          | $1500             |\n| 2     | $1200          | $1800             |\n| 3     | $1100          | $1600             |\n| 4     | $1300          | $1900             |\n| 5     | $1400          | $2000             |\n\nThe company wants to maximize the total net profit from all routes, where net profit is the revenue minus the cost. The company has a total of 100 trucks available for allocation.\n\nPlease help the company to determine the optimal number of trucks to allocate to each route to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks on route 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks on route 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks on route 3\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of trucks on route 4\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of trucks on route 5\n\n# Define objective function\nNet_Profit_Route1 = (1500 - 1000) * T1\nNet_Profit_Route2 = (1800 - 1200) * T2\nNet_Profit_Route3 = (1600 - 1100) * T3\nNet_Profit_Route4 = (1900 - 1300) * T4\nNet_Profit_Route5 = (2000 - 1400) * T5\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_Route1 + Net_Profit_Route2 + Net_Profit_Route3 + Net_Profit_Route4 + Net_Profit_Route5)\n\n# Add constraints\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trucks on route 1: \", model.getVal(T1))\n    print(\"Number of trucks on route 2: \", model.getVal(T2))\n    print(\"Number of trucks on route 3: \", model.getVal(T3))\n    print(\"Number of trucks on route 4: \", model.getVal(T4))\n    print(\"Number of trucks on route 5: \", model.getVal(T5))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost.\n// {\"number of trucks on route A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on route E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route.\n// Cost of route A: Cost_A = 2 * 100 * A\n// Cost of route B: Cost_B = 3 * 150 * B\n// Cost of route C: Cost_C = 4 * 200 * C\n// Cost of route D: Cost_D = 5 * 250 * D\n// Cost of route E: Cost_E = 6 * 300 * E\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// A + B + C + D + E <= 50\n\n## Generate Constraint-2:\nEach route must have at least 2 trucks.\n// A >= 2; B >= 2; C >= 2; D >= 2; E >= 2\n\n## Generate Constraint-3:\nThe total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\n// 250 * D <= (100 * A) + (150 * B) + (200 * C)",
        "question": "A logistics company operates five different routes for delivering packages: A, B, C, D, and E. The company needs to determine the number of trucks to allocate to each route to optimize efficiency and cost. Each route has a different cost per mile and a different distance. Route A costs $2 per mile and is 100 miles long. Route B costs $3 per mile and is 150 miles long. Route C costs $4 per mile and is 200 miles long. Route D costs $5 per mile and is 250 miles long. Route E costs $6 per mile and is 300 miles long. The company aims to minimize the total cost of operations, which is the sum of the product of the cost per mile, distance, and the number of trucks on each route. The company has a total of 50 trucks available. Each route must have at least 2 trucks. The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined. Please help the company to minimize the total cost of operations.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each route must have at least 2 trucks.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=2) # number of trucks on route A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=2) # number of trucks on route B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=2) # number of trucks on route C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=2) # number of trucks on route D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=2) # number of trucks on route E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 2 * 100 * A\nCost_B = 3 * 150 * B\nCost_C = 4 * 200 * C\nCost_D = 5 * 250 * D\nCost_E = 6 * 300 * E\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\n## The company has a total of 50 trucks available.\nmodel.addCons(A + B + C + D + E <= 50)\n## The total distance covered by all trucks on route D must not exceed the total distance covered by trucks on routes A, B, and C combined.\nmodel.addCons(250 * D <= 100 * A + 150 * B + 200 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on Route A: \", model.getVal(A))\n    print(\"Number of Trucks on Route B: \", model.getVal(B))\n    print(\"Number of Trucks on Route C: \", model.getVal(C))\n    print(\"Number of Trucks on Route D: \", model.getVal(D))\n    print(\"Number of Trucks on Route E: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant.\n// {\"number of Solar power units\": \"SolarUnits\", \"range\": \"SolarUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Wind power units\": \"WindUnits\", \"range\": \"WindUnits >= 0\", \"type\": \"integer\"}\n// {\"number of Hydro power units\": \"HydroUnits\", \"range\": \"HydroUnits >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar\": \"SolarMaintenance\", \"range\": \"SolarMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind\": \"WindMaintenance\", \"range\": \"WindMaintenance >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro\": \"HydroMaintenance\", \"range\": \"HydroMaintenance >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe operational efficiency of each power plant type increases with the level of maintenance investment. For every $1000 invested in Solar maintenance, efficiency increases by 1%. For Wind, every $1000 investment increases efficiency by 1.5%. For Hydro, every $1000 investment increases efficiency by 1%. The company aims to maximize the total energy output from all power plants.\n// EnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\n// EnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\n// EnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n// So, the objective function is: Maximize (EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for both installation and maintenance of all power plants.\n// SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of units to install for each type of power plant and the level of maintenance investment for each type to optimize efficiency. The maintenance investment affects the operational efficiency and lifespan of each power plant. The operational efficiency of each power plant type increases with the level of maintenance investment as shown in the following Table.\n\n| Power Plant Type | Efficiency Increase per $1000 Maintenance Investment |\n|------------------|------------------------------------------------------|\n| Solar            | 1%                                                   |\n| Wind             | 1.5%                                                 |\n| Hydro            | 1%                                                   |\n\nThe company has a total budget of $100,000 for both installation and maintenance of all power plants. The company aims to maximize the total energy output from all power plants. Please help the company determine the optimal number of units and maintenance investments for each type of power plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarUnits = model.addVar(vtype=\"INTEGER\", name=\"SolarUnits\", lb=0)  # number of Solar power units\nWindUnits = model.addVar(vtype=\"INTEGER\", name=\"WindUnits\", lb=0)  # number of Wind power units\nHydroUnits = model.addVar(vtype=\"INTEGER\", name=\"HydroUnits\", lb=0)  # number of Hydro power units\nSolarMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"SolarMaintenance\", lb=0)  # maintenance investment for Solar\nWindMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"WindMaintenance\", lb=0)  # maintenance investment for Wind\nHydroMaintenance = model.addVar(vtype=\"CONTINUOUS\", name=\"HydroMaintenance\", lb=0)  # maintenance investment for Hydro\n\n# Define objective function\nEnergyOutput_Solar = SolarUnits * (1 + 0.001 * SolarMaintenance)\nEnergyOutput_Wind = WindUnits * (1 + 0.0015 * WindMaintenance)\nEnergyOutput_Hydro = HydroUnits * (1 + 0.001 * HydroMaintenance)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutput_Solar + EnergyOutput_Wind + EnergyOutput_Hydro)\n\n# Add constraints\nmodel.addCons(SolarUnits + WindUnits + HydroUnits + SolarMaintenance + WindMaintenance + HydroMaintenance <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar power units: \", model.getVal(SolarUnits))\n    print(\"Number of Wind power units: \", model.getVal(WindUnits))\n    print(\"Number of Hydro power units: \", model.getVal(HydroUnits))\n    print(\"Maintenance investment for Solar: \", model.getVal(SolarMaintenance))\n    print(\"Maintenance investment for Wind: \", model.getVal(WindMaintenance))\n    print(\"Maintenance investment for Hydro: \", model.getVal(HydroMaintenance))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of product E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 1 hour.\nFor Product B, the selling price is $30, the material cost is $15, and the production time is 2 hours.\nFor Product C, the selling price is $40, the material cost is $20, and the production time is 3 hours.\nFor Product D, the selling price is $50, the material cost is $25, and the production time is 4 hours.\nFor Product E, the selling price is $60, the material cost is $30, and the production time is 5 hours.\nThe company aims to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n// Selling profit of A: Profit_A = (20 - 10) * A\n// Selling profit of B: Profit_B = (30 - 15) * B\n// Selling profit of C: Profit_C = (40 - 20) * C\n// Selling profit of D: Profit_D = (50 - 25) * D\n// Selling profit of E: Profit_E = (60 - 30) * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (1 * A + 2 * B + 3 * C + 4 * D + 5 * E)\n\n## Generate Constraint-1:\nThe company has $1500 available for material costs for the next quarter.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500\n\n## Generate Constraint-2:\nThe company wants to produce at least 20 units of each product for the next quarter.\n// A >= 20; B >= 20; C >= 20; D >= 20; E >= 20\n\n## Generate Constraint-3:\nThe company wants to spend at most 400 hours on production for the next quarter.\n// 1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400\n\n## Generate Constraint-4:\nThe company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C.\n// D <= A + B + C\n\n## Generate Constraint-5:\nThe company wants to ensure that the total production of Product E does not exceed the combined production of Products A, B, C, and D.\n// E <= A + B + C + D",
        "question": "A manufacturing company produces five types of products: A, B, C, D, and E. The company needs to determine how many units of each product to produce in the next quarter to optimize its resource utilization and profitability. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 1 hour          |\n| B       | 30$           | 15$           | 2 hours         |\n| C       | 40$           | 20$           | 3 hours         |\n| D       | 50$           | 25$           | 4 hours         |\n| E       | 60$           | 30$           | 5 hours         |\n\nThe company has $1500 available for material costs for the next quarter. The company wants to produce at least 20 units of each product for the next quarter. The company wants to spend at most 400 hours on production for the next quarter. The company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C. Additionally, the company wants to ensure that the total production of Product E does not exceed the combined production of Products A, B, C, and D. \n\nPlease help the company to maximize the profit per unit of time (which is defined as the sum of the selling profit divided by the sum of the production times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 20 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=20) # number of units of product D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=20) # number of units of product E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProfit_D = (50 - 25) * D\nProfit_E = (60 - 30) * E\nProductionTime = 1 * A + 2 * B + 3 * C + 4 * D + 5 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has $1500 available for material costs for the next quarter.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E <= 1500)\n## The company wants to spend at most 400 hours on production for the next quarter.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D + 5 * E <= 400)\n## The company wants to ensure that the total production of Product D does not exceed the combined production of Products A, B, and C.\nmodel.addCons(D <= A + B + C)\n## The company wants to ensure that the total production of Product E does not exceed the combined production of Products A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Number of Product D: \", model.getVal(D))\n    print(\"Number of Product E: \", model.getVal(E))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month.\n// {\"number of trucks for G1\": \"TruckG1\", \"range\": \"TruckG1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G2\": \"TruckG2\", \"range\": \"TruckG2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G3\": \"TruckG3\", \"range\": \"TruckG3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G4\": \"TruckG4\", \"range\": \"TruckG4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for G5\": \"TruckG5\", \"range\": \"TruckG5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor good G1, the revenue per truck is $5000, the fuel cost per truck is $1000, and the maintenance cost per truck is $500. \nFor good G2, the revenue per truck is $7000, the fuel cost per truck is $1500, and the maintenance cost per truck is $700. \nFor good G3, the revenue per truck is $9000, the fuel cost per truck is $2000, and the maintenance cost per truck is $900.\nFor good G4, the revenue per truck is $6000, the fuel cost per truck is $1200, and the maintenance cost per truck is $600.\nFor good G5, the revenue per truck is $8000, the fuel cost per truck is $1800, and the maintenance cost per truck is $800.\nThe company aims to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n// Net profit for G1: Profit_G1 = (5000 - 1000 - 500) * TruckG1\n// Net profit for G2: Profit_G2 = (7000 - 1500 - 700) * TruckG2\n// Net profit for G3: Profit_G3 = (9000 - 2000 - 900) * TruckG3\n// Net profit for G4: Profit_G4 = (6000 - 1200 - 600) * TruckG4\n// Net profit for G5: Profit_G5 = (8000 - 1800 - 800) * TruckG5\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / (TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for the month.\n// TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50\n\n## Generate Constraint-2:\nDue to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\n// TruckG3 <= TruckG1 + TruckG2\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for fuel costs for the month.\n// 1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of good has at least one truck allocated.\n// TruckG1 >= 1; TruckG2 >= 1; TruckG3 >= 1; TruckG4 >= 1; TruckG5 >= 1",
        "question": "A logistics company is managing the distribution of five different types of goods: G1, G2, G3, G4, and G5. The company needs to determine the optimal number of trucks to allocate for each type of good for the next month. The revenue, fuel cost, and maintenance cost per truck for each type of good are given in the following Table.\n\n| Good | Revenue per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------|-------------------|---------------------|----------------------------|\n| G1   | $5000             | $1000               | $500                       |\n| G2   | $7000             | $1500               | $700                       |\n| G3   | $9000             | $2000               | $900                       |\n| G4   | $6000             | $1200               | $600                       |\n| G5   | $8000             | $1800               | $800                       |\n\nThe company has a total of 50 trucks available for the month. Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2. The company has a budget of $50,000 for fuel costs for the month. The company wants to ensure that each type of good has at least one truck allocated. \n\nPlease help the company to maximize the average net profit per truck (which is defined as the sum of the revenue minus the sum of the fuel and maintenance costs, divided by the total number of trucks).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckG1 = model.addVar(vtype=\"INTEGER\", name=\"TruckG1\", lb=1)  # number of trucks for G1\nTruckG2 = model.addVar(vtype=\"INTEGER\", name=\"TruckG2\", lb=1)  # number of trucks for G2\nTruckG3 = model.addVar(vtype=\"INTEGER\", name=\"TruckG3\", lb=1)  # number of trucks for G3\nTruckG4 = model.addVar(vtype=\"INTEGER\", name=\"TruckG4\", lb=1)  # number of trucks for G4\nTruckG5 = model.addVar(vtype=\"INTEGER\", name=\"TruckG5\", lb=1)  # number of trucks for G5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = (5000 - 1000 - 500) * TruckG1\nProfit_G2 = (7000 - 1500 - 700) * TruckG2\nProfit_G3 = (9000 - 2000 - 900) * TruckG3\nProfit_G4 = (6000 - 1200 - 600) * TruckG4\nProfit_G5 = (8000 - 1800 - 800) * TruckG5\nTotalTrucks = TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Profit_G1 + Profit_G2 + Profit_G3 + Profit_G4 + Profit_G5)\n\n# Add constraints\n## The company has a total of 50 trucks available for the month.\nmodel.addCons(TruckG1 + TruckG2 + TruckG3 + TruckG4 + TruckG5 <= 50)\n## Due to storage limitations, the number of trucks for G3 must not exceed the combined number of trucks for G1 and G2.\nmodel.addCons(TruckG3 <= TruckG1 + TruckG2)\n## The company has a budget of $50,000 for fuel costs for the month.\nmodel.addCons(1000 * TruckG1 + 1500 * TruckG2 + 2000 * TruckG3 + 1200 * TruckG4 + 1800 * TruckG5 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for G1: \", model.getVal(TruckG1))\n    print(\"Number of Trucks for G2: \", model.getVal(TruckG2))\n    print(\"Number of Trucks for G3: \", model.getVal(TruckG3))\n    print(\"Number of Trucks for G4: \", model.getVal(TruckG4))\n    print(\"Number of Trucks for G5: \", model.getVal(TruckG5))\n    print(\"Maximized Average Net Profit per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1427,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of TruckD\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of TruckE\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and has a maintenance cost of $500 per month. Each TruckB can carry 15 tons of cargo and has a maintenance cost of $700 per month. Each TruckC can carry 20 tons of cargo and has a maintenance cost of $900 per month. Each TruckD can carry 25 tons of cargo and has a maintenance cost of $1100 per month. Each TruckE can carry 30 tons of cargo and has a maintenance cost of $1300 per month. The company aims to maximize the total cargo capacity while minimizing the total maintenance cost.\n// Total cargo capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\n// Total maintenance cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for truck maintenance next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100,000\n\n## Generate Constraint-2:\nThe company must deploy at least 5 trucks of each type next month.\n// TruckA >= 5; TruckB >= 5; TruckC >= 5; TruckD >= 5; TruckE >= 5\n\n## Generate Constraint-3:\nThe total number of trucks deployed must not exceed 100.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 100\n\n## Generate Constraint-4:\nThe total cargo capacity must be at least 1500 tons.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1500\n\n## Generate Constraint-5:\nThe number of TruckE must be at least half the number of TruckD.\n// TruckE >= 0.5 * TruckD",
        "question": "A logistics company operates five different types of trucks: TruckA, TruckB, TruckC, TruckD, and TruckE. The company needs to decide how many of each type of truck to deploy for the next month to optimize their operations. The cargo capacity and monthly maintenance cost for each type of truck are given in the following Table.\n\n| Truck Type | Cargo Capacity (tons) | Monthly Maintenance Cost ($) |\n|------------|-----------------------|------------------------------|\n| TruckA     | 10                    | 500                          |\n| TruckB     | 15                    | 700                          |\n| TruckC     | 20                    | 900                          |\n| TruckD     | 25                    | 1100                         |\n| TruckE     | 30                    | 1300                         |\n\nThe company has a budget of $100,000 for truck maintenance next month. The company must deploy at least 5 trucks of each type next month. The total number of trucks deployed must not exceed 100. The total cargo capacity must be at least 1500 tons. The number of TruckE must be at least half the number of TruckD.\n\nPlease help the company to maximize the total cargo capacity while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=5)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=5)  # number of TruckC\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0)  # number of TruckD\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0)  # number of TruckE\n\n# Define objective function\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 100000)\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 100)\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1500)\nmodel.addCons(TruckE >= 0.5 * TruckD)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Number of TruckD: \", model.getVal(TruckD))\n    print(\"Number of TruckE: \", model.getVal(TruckE))\n    print(\"Maximized Net Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: EV1, EV2, and EV3. They need to determine the production quantities of each vehicle type to optimize their operations.\n// {\"quantity of EV1\": \"EV1\", \"range\": \"EV1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of EV2\": \"EV2\", \"range\": \"EV2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of EV3\": \"EV3\", \"range\": \"EV3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor EV1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5 points.\nFor EV2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4 points.\nFor EV3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3 points.\nThe manufacturer wants to maximize the net revenue while minimizing the environmental impact. The objective is to maximize the net revenue per environmental impact score.\n// NetRevenue_EV1 = 30000 * EV1 - 20000 * EV1\n// NetRevenue_EV2 = 40000 * EV2 - 25000 * EV2\n// NetRevenue_EV3 = 50000 * EV3 - 30000 * EV3\n// So, the objective function is: Maximize (NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3) / (5 * EV1 + 4 * EV2 + 3 * EV3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $1,000,000.\n// 20000 * EV1 + 25000 * EV2 + 30000 * EV3 <= 1000000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 50 vehicles in total.\n// EV1 + EV2 + EV3 <= 50",
        "question": "A manufacturer produces three types of eco-friendly vehicles: EV1, EV2, and EV3. They need to determine the production quantities of each vehicle type to optimize their operations.\nFor EV1, the revenue per unit is $30,000, the production cost per unit is $20,000, and the environmental impact score per unit is 5 points.\nFor EV2, the revenue per unit is $40,000, the production cost per unit is $25,000, and the environmental impact score per unit is 4 points.\nFor EV3, the revenue per unit is $50,000, the production cost per unit is $30,000, and the environmental impact score per unit is 3 points.\nThe manufacturer has a limited production budget of $1,000,000. The manufacturer has a production capacity of 50 vehicles in total.\nPlease help the manufacturer to maximize the net revenue per environmental impact score.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nEV1 = model.addVar(vtype=\"INTEGER\", name=\"EV1\", lb=0) # quantity of EV1\nEV2 = model.addVar(vtype=\"INTEGER\", name=\"EV2\", lb=0) # quantity of EV2\nEV3 = model.addVar(vtype=\"INTEGER\", name=\"EV3\", lb=0) # quantity of EV3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetRevenue_EV1 = (30000 - 20000) * EV1\nNetRevenue_EV2 = (40000 - 25000) * EV2\nNetRevenue_EV3 = (50000 - 30000) * EV3\nEnvironmentalImpact = 5 * EV1 + 4 * EV2 + 3 * EV3\n## the objective function is: Maximize (NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3) / EnvironmentalImpact\n## convert the division to multiplication\nmodel.addCons(obj * EnvironmentalImpact == NetRevenue_EV1 + NetRevenue_EV2 + NetRevenue_EV3)\n\n# Add constraints\n## The manufacturer has a limited production budget of $1,000,000.\nmodel.addCons(20000 * EV1 + 25000 * EV2 + 30000 * EV3 <= 1000000)\n## The manufacturer has a production capacity of 50 vehicles in total.\nmodel.addCons(EV1 + EV2 + EV3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of EV1: \", model.getVal(EV1))\n    print(\"Quantity of EV2: \", model.getVal(EV2))\n    print(\"Quantity of EV3: \", model.getVal(EV3))\n    print(\"Maximized Net Revenue per Environmental Impact Score: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in new machinery that could potentially reduce production costs for each product.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in machinery for product A\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product B\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product C\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"continuous\"}\n// {\"investment in machinery for product D\": \"MachineryD\", \"range\": \"MachineryD >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of product decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n// Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n// Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n// Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for investing in new machinery.\n// MachineryA + MachineryB + MachineryC + MachineryD <= 200000",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product for the next quarter and decide on the investment in new machinery that could reduce production costs for each product. The production cost per unit decreases by $5 for every $100,000 invested in machinery for that product. The initial production cost per unit for product A is $100, for product B is $150, for product C is $200, and for product D is $250. The selling price per unit is $200 for product A, $250 for product B, $300 for product C, and $350 for product D. The company aims to maximize the total profit from all products. The company has a total budget of $200,000 for investing in new machinery.\n\nPlease help the company determine the optimal production quantities for products A, B, C, and D, and the appropriate investments in machinery for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\nMachineryA = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryA\", lb=0) # investment in machinery for product A\nMachineryB = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryB\", lb=0) # investment in machinery for product B\nMachineryC = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryC\", lb=0) # investment in machinery for product C\nMachineryD = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryD\", lb=0) # investment in machinery for product D\n\n# Define objective function\n## Total profit for product A: ProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\n## Total profit for product B: ProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\n## Total profit for product C: ProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\n## Total profit for product D: ProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\nProfitA = (200 - (100 - 0.00005 * MachineryA)) * A\nProfitB = (250 - (150 - 0.00005 * MachineryB)) * B\nProfitC = (300 - (200 - 0.00005 * MachineryC)) * C\nProfitD = (350 - (250 - 0.00005 * MachineryD)) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a total budget of $200,000 for investing in new machinery.\nmodel.addCons(MachineryA + MachineryB + MachineryC + MachineryD <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Investment in Machinery for Product A: \", model.getVal(MachineryA))\n    print(\"Investment in Machinery for Product B: \", model.getVal(MachineryB))\n    print(\"Investment in Machinery for Product C: \", model.getVal(MachineryC))\n    print(\"Investment in Machinery for Product D: \", model.getVal(MachineryD))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: ChipA, ChipB, ChipC, ChipD, and ChipE. The company needs to determine the optimal production quantities for each type of component to maximize profit while considering various constraints.\n// {\"quantity of ChipA\": \"ChipA\", \"range\": \"ChipA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipB\": \"ChipB\", \"range\": \"ChipB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipC\": \"ChipC\", \"range\": \"ChipC >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipD\": \"ChipD\", \"range\": \"ChipD >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChipE\": \"ChipE\", \"range\": \"ChipE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChipA is $10, ChipB is $15, ChipC is $20, ChipD is $25, and ChipE is $30. Due to economies of scale, the profit per unit increases by $0.02 for each unit produced beyond 100 units for each type of chip. The company aims to maximize the total profit from the production of these components.\n// Profit_ChipA = max(10 + 0.02 * (ChipA - 100), 10) * ChipA\n// Profit_ChipB = max(15 + 0.02 * (ChipB - 100), 15) * ChipB\n// Profit_ChipC = max(20 + 0.02 * (ChipC - 100), 20) * ChipC\n// Profit_ChipD = max(25 + 0.02 * (ChipD - 100), 25) * ChipD\n// Profit_ChipE = max(30 + 0.02 * (ChipE - 100), 30) * ChipE\n// So, the objective function is: Maximize Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical material used in the production of these chips. Each unit of ChipA requires 5 units of the material, ChipB requires 8 units, ChipC requires 10 units, ChipD requires 12 units, and ChipE requires 15 units. The total available quantity of this material is 2000 units.\n// 5 * ChipA + 8 * ChipB + 10 * ChipC + 12 * ChipD + 15 * ChipE <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each type of chip. The demand limit for ChipA is 300 units, ChipB is 250 units, ChipC is 200 units, ChipD is 150 units, and ChipE is 100 units.\n// ChipA <= 300; ChipB <= 250; ChipC <= 200; ChipD <= 150; ChipE <= 100",
        "question": "A manufacturing company produces five types of electronic components: ChipA, ChipB, ChipC, ChipD, and ChipE. The company needs to determine the optimal production quantities for each type of component to maximize profit while considering various constraints. The profit per unit of each chip and the additional profit from economies of scale are given in the following Table.\n\n| Component | Base Profit per Unit | Additional Profit per Unit Beyond 100 |\n|-----------|----------------------|--------------------------------------|\n| ChipA     | $10                  | $0.02                                |\n| ChipB     | $15                  | $0.02                                |\n| ChipC     | $20                  | $0.02                                |\n| ChipD     | $25                  | $0.02                                |\n| ChipE     | $30                  | $0.02                                |\n\nThe company has a limited supply of a critical material used in the production of these chips. Each unit of ChipA requires 5 units of the material, ChipB requires 8 units, ChipC requires 10 units, ChipD requires 12 units, and ChipE requires 15 units. The total available quantity of this material is 2000 units. The market has a demand limit for each type of chip. The demand limit for ChipA is 300 units, ChipB is 250 units, ChipC is 200 units, ChipD is 150 units, and ChipE is 100 units.\n\nPlease help the company to maximize the total profit from the production of these components, considering the constraints on material usage and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChipA = model.addVar(vtype=\"INTEGER\", name=\"ChipA\", lb=0, ub=300) # quantity of ChipA\nChipB = model.addVar(vtype=\"INTEGER\", name=\"ChipB\", lb=0, ub=250) # quantity of ChipB\nChipC = model.addVar(vtype=\"INTEGER\", name=\"ChipC\", lb=0, ub=200) # quantity of ChipC\nChipD = model.addVar(vtype=\"INTEGER\", name=\"ChipD\", lb=0, ub=150) # quantity of ChipD\nChipE = model.addVar(vtype=\"INTEGER\", name=\"ChipE\", lb=0, ub=100) # quantity of ChipE\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ChipA = max(10 + 0.02 * (ChipA - 100), 10) * ChipA\nChipA1 = model.addVar(vtype=\"INTEGER\", name=\"ChipA1\", lb=0, ub=100)\nChipA2 = model.addVar(vtype=\"INTEGER\", name=\"ChipA2\", lb=100, ub=300)\nChipA_b1 = model.addVar(vtype=\"B\", name=\"ChipA_b1\")\nChipA_b2 = model.addVar(vtype=\"B\", name=\"ChipA_b2\")\nmodel.addCons(ChipA_b1 + ChipA_b2 == 1)\nmodel.addCons(ChipA == ChipA1*ChipA_b1 + ChipA2*ChipA_b2)\nProfit_ChipA = 10 * ChipA1 * ChipA_b1 + (10 + 0.02 * (ChipA2 - 100)) * ChipA2 * ChipA_b2\n\n## create piecewise variables for piecewise function: Profit_ChipB = max(15 + 0.02 * (ChipB - 100), 15) * ChipB\nChipB1 = model.addVar(vtype=\"INTEGER\", name=\"ChipB1\", lb=0, ub=100)\nChipB2 = model.addVar(vtype=\"INTEGER\", name=\"ChipB2\", lb=100, ub=250)\nChipB_b1 = model.addVar(vtype=\"B\", name=\"ChipB_b1\")\nChipB_b2 = model.addVar(vtype=\"B\", name=\"ChipB_b2\")\nmodel.addCons(ChipB_b1 + ChipB_b2 == 1)\nmodel.addCons(ChipB == ChipB1*ChipB_b1 + ChipB2*ChipB_b2)\nProfit_ChipB = 15 * ChipB1 * ChipB_b1 + (15 + 0.02 * (ChipB2 - 100)) * ChipB2 * ChipB_b2\n\n## create piecewise variables for piecewise function: Profit_ChipC = max(20 + 0.02 * (ChipC - 100), 20) * ChipC\nChipC1 = model.addVar(vtype=\"INTEGER\", name=\"ChipC1\", lb=0, ub=100)\nChipC2 = model.addVar(vtype=\"INTEGER\", name=\"ChipC2\", lb=100, ub=200)\nChipC_b1 = model.addVar(vtype=\"B\", name=\"ChipC_b1\")\nChipC_b2 = model.addVar(vtype=\"B\", name=\"ChipC_b2\")\nmodel.addCons(ChipC_b1 + ChipC_b2 == 1)\nmodel.addCons(ChipC == ChipC1*ChipC_b1 + ChipC2*ChipC_b2)\nProfit_ChipC = 20 * ChipC1 * ChipC_b1 + (20 + 0.02 * (ChipC2 - 100)) * ChipC2 * ChipC_b2\n\n## create piecewise variables for piecewise function: Profit_ChipD = max(25 + 0.02 * (ChipD - 100), 25) * ChipD\nChipD1 = model.addVar(vtype=\"INTEGER\", name=\"ChipD1\", lb=0, ub=100)\nChipD2 = model.addVar(vtype=\"INTEGER\", name=\"ChipD2\", lb=100, ub=150)\nChipD_b1 = model.addVar(vtype=\"B\", name=\"ChipD_b1\")\nChipD_b2 = model.addVar(vtype=\"B\", name=\"ChipD_b2\")\nmodel.addCons(ChipD_b1 + ChipD_b2 == 1)\nmodel.addCons(ChipD == ChipD1*ChipD_b1 + ChipD2*ChipD_b2)\nProfit_ChipD = 25 * ChipD1 * ChipD_b1 + (25 + 0.02 * (ChipD2 - 100)) * ChipD2 * ChipD_b2\n\n## create piecewise variables for piecewise function: Profit_ChipE = max(30 + 0.02 * (ChipE - 100), 30) * ChipE\nChipE1 = model.addVar(vtype=\"INTEGER\", name=\"ChipE1\", lb=0, ub=100)\nChipE2 = model.addVar(vtype=\"INTEGER\", name=\"ChipE2\", lb=100, ub=100)\nChipE_b1 = model.addVar(vtype=\"B\", name=\"ChipE_b1\")\nChipE_b2 = model.addVar(vtype=\"B\", name=\"ChipE_b2\")\nmodel.addCons(ChipE_b1 + ChipE_b2 == 1)\nmodel.addCons(ChipE == ChipE1*ChipE_b1 + ChipE2*ChipE_b2)\nProfit_ChipE = 30 * ChipE1 * ChipE_b1 + (30 + 0.02 * (ChipE2 - 100)) * ChipE2 * ChipE_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE\nmodel.addCons(obj == Profit_ChipA + Profit_ChipB + Profit_ChipC + Profit_ChipD + Profit_ChipE)\n\n# Add constraints\nmodel.addCons(5 * ChipA + 8 * ChipB + 10 * ChipC + 12 * ChipD + 15 * ChipE <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChipA: \", model.getVal(ChipA))\n    print(\"Quantity of ChipB: \", model.getVal(ChipB))\n    print(\"Quantity of ChipC: \", model.getVal(ChipC))\n    print(\"Quantity of ChipD: \", model.getVal(ChipD))\n    print(\"Quantity of ChipE: \", model.getVal(ChipE))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1560,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company aims to maximize the net profit (revenue minus fuel cost) across all routes.\n// Fuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * Distance1 / 100\n// Fuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * Distance2 / 100\n// Fuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * Distance3 / 100\n// Revenue_Route1 = 1000 * Trucks1\n// Revenue_Route2 = 1200 * Trucks2\n// Revenue_Route3 = 1500 * Trucks3\n// So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\n// 1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000\n\n## Generate Constraint-2:\nThe total number of trucks available is limited to 200.\n// Trucks1 + Trucks2 + Trucks3 <= 200\n\n## Generate Constraint-3:\nThe distance for Route1 is 500 kilometers, for Route2 is 600 kilometers, and for Route3 is 700 kilometers.\n// Distance1 = 500; Distance2 = 600; Distance3 = 700",
        "question": "A logistics company operates a fleet of trucks and needs to optimize the distribution of goods across different routes. The company must decide the number of trucks to allocate to each route and the fuel consumption rate for each truck, which can be influenced by an investment in fuel-efficient technologies. The fuel consumption rate of each truck is initially 50 liters per 100 kilometers. With investment in fuel efficiency technologies, the consumption rate decreases by 1 liter per 100 kilometers for every $100 invested. The revenue per truck on Route1 is $1000, on Route2 is $1200, and on Route3 is $1500. The company has a total budget of $100,000 for truck allocations and investments in fuel efficiency. The total number of trucks available is limited to 200. The distance for Route1 is 500 kilometers, for Route2 is 600 kilometers, and for Route3 is 700 kilometers. The company aims to maximize the net profit (revenue minus fuel cost) across all routes. Please help the company determine the optimal number of trucks and the investment in fuel efficiency for each route.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # investment in fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # investment in fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # investment in fuel efficiency for Route3\n\n# Define objective function\nFuel_Cost_Route1 = (50 - 0.01 * Efficiency1) * Trucks1 * 500 / 100\nFuel_Cost_Route2 = (50 - 0.01 * Efficiency2) * Trucks2 * 600 / 100\nFuel_Cost_Route3 = (50 - 0.01 * Efficiency3) * Trucks3 * 700 / 100\nRevenue_Route1 = 1000 * Trucks1\nRevenue_Route2 = 1200 * Trucks2\nRevenue_Route3 = 1500 * Trucks3\n# So, the objective function is: Maximize (Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Route1 - Fuel_Cost_Route1 + Revenue_Route2 - Fuel_Cost_Route2 + Revenue_Route3 - Fuel_Cost_Route3)\n\n# Add constraints\n# The company has a total budget of $100,000 for truck allocations and investments in fuel efficiency.\nmodel.addCons(1000 * Trucks1 + 1200 * Trucks2 + 1500 * Trucks3 + Efficiency1 + Efficiency2 + Efficiency3 <= 100000)\n# The total number of trucks available is limited to 200.\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Investment in Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Investment in Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Investment in Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region to maximize energy production. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in advanced technology for each type of installation to enhance their efficiency.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced technology for solar panels\": \"TechInvestmentSolar\", \"range\": \"TechInvestmentSolar >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced technology for wind turbines\": \"TechInvestmentWind\", \"range\": \"TechInvestmentWind >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of solar panels increases by 2% for every $1000 invested in advanced technology, and the efficiency of wind turbines increases by 3% for every $1000 invested in advanced technology. The initial energy output per solar panel is 500 kWh, and per wind turbine is 1000 kWh. The company aims to maximize the total energy output.\n// EnergyOutputSolar = (500 * (1 + 0.002 * TechInvestmentSolar)) * SolarPanels\n// EnergyOutputWind = (1000 * (1 + 0.003 * TechInvestmentWind)) * WindTurbines\n// So, the objective function is: Maximize (EnergyOutputSolar + EnergyOutputWind)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for both installation and technology investments.\n// CostSolarPanels * SolarPanels + CostWindTurbines * WindTurbines + TechInvestmentSolar + TechInvestmentWind <= 100000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region to maximize energy production. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in advanced technology for each type of installation to enhance their efficiency. The efficiency of solar panels increases by 2% for every $1000 invested in advanced technology, and the efficiency of wind turbines increases by 3% for every $1000 invested in advanced technology. The initial energy output per solar panel is 500 kWh, and per wind turbine is 1000 kWh. The company aims to maximize the total energy output. The company has a budget of $100,000 for both installation and technology investments. Please help the company determine the optimal number of solar panels and wind turbines to install, and the investment in advanced technology for each to maximize the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)  # number of wind turbines\nTechInvestmentSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentSolar\", lb=0)  # investment in advanced technology for solar panels\nTechInvestmentWind = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestmentWind\", lb=0)  # investment in advanced technology for wind turbines\n\n# Define objective function\nEnergyOutputSolar = (500 * (1 + 0.002 * TechInvestmentSolar)) * SolarPanels\nEnergyOutputWind = (1000 * (1 + 0.003 * TechInvestmentWind)) * WindTurbines\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyOutputSolar + EnergyOutputWind)\n\n# Add constraints\n# The company has a budget of $100,000 for both installation and technology investments.\n# Assuming CostSolarPanels and CostWindTurbines are the costs per unit of solar panels and wind turbines respectively\nCostSolarPanels = 1000  # placeholder value\nCostWindTurbines = 2000  # placeholder value\nmodel.addCons(CostSolarPanels * SolarPanels + CostWindTurbines * WindTurbines + TechInvestmentSolar + TechInvestmentWind <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Advanced Technology for Solar Panels: \", model.getVal(TechInvestmentSolar))\n    print(\"Investment in Advanced Technology for Wind Turbines: \", model.getVal(TechInvestmentWind))\n    print(\"Maximized Total Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\n// {\"number of Truck A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company wants to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\n// Total ton-kilometers: TonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n// So, the objective function is: Minimize Cost / TonKm\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for operational costs next month.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000\n\n## Generate Constraint-2:\nThe company needs to transport at least 1000 tons next month.\n// 10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000\n\n## Generate Constraint-3:\nThe company can operate a maximum of 50 trucks in total.\n// TruckA + TruckB + TruckC + TruckD + TruckE <= 50",
        "question": "A logistics company is planning its fleet usage for the next month. The company operates five types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. Each vehicle has different capacities and operational costs.\nTruck A has a capacity of 10 tons, an operational cost of $500 per day, and a fuel efficiency of 5 km/liter.\nTruck B has a capacity of 15 tons, an operational cost of $700 per day, and a fuel efficiency of 7 km/liter.\nTruck C has a capacity of 20 tons, an operational cost of $900 per day, and a fuel efficiency of 9 km/liter.\nTruck D has a capacity of 25 tons, an operational cost of $1100 per day, and a fuel efficiency of 11 km/liter.\nTruck E has a capacity of 30 tons, an operational cost of $1300 per day, and a fuel efficiency of 13 km/liter.\nThe company has a total budget of $30,000 for operational costs next month. The company needs to transport at least 1000 tons next month. The company can operate a maximum of 50 trucks in total.\nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of daily operational costs divided by the product of capacity and fuel efficiency).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of Truck A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of Truck B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of Truck C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of Truck D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE\nTonKm = (10 * 5 * TruckA + 15 * 7 * TruckB + 20 * 9 * TruckC + 25 * 11 * TruckD + 30 * 13 * TruckE)\n## the objective function is: Minimize Cost / TonKm\n## convert the division to multiplication\nmodel.addCons(obj * TonKm == Cost)\n\n# Add constraints\n## The company has a total budget of $30,000 for operational costs next month.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC + 1100 * TruckD + 1300 * TruckE <= 30000)\n## The company needs to transport at least 1000 tons next month.\nmodel.addCons(10 * TruckA + 15 * TruckB + 20 * TruckC + 25 * TruckD + 30 * TruckE >= 1000)\n## The company can operate a maximum of 50 trucks in total.\nmodel.addCons(TruckA + TruckB + TruckC + TruckD + TruckE <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(TruckA))\n    print(\"Number of Truck B: \", model.getVal(TruckB))\n    print(\"Number of Truck C: \", model.getVal(TruckC))\n    print(\"Number of Truck D: \", model.getVal(TruckD))\n    print(\"Number of Truck E: \", model.getVal(TruckE))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type.\n// {\"number of trucks for Region1\": \"TrucksRegion1\", \"range\": \"TrucksRegion1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region2\": \"TrucksRegion2\", \"range\": \"TrucksRegion2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region3\": \"TrucksRegion3\", \"range\": \"TrucksRegion3 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region4\": \"TrucksRegion4\", \"range\": \"TrucksRegion4 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Region5\": \"TrucksRegion5\", \"range\": \"TrucksRegion5 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of each truck type\": \"FuelEfficiency\", \"range\": \"FuelEfficiency > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of fuel per gallon is $3, and the distance traveled by each truck to each region varies (Region1: 500 miles, Region2: 700 miles, Region3: 600 miles, Region4: 800 miles, Region5: 900 miles). The company wants to minimize the total fuel cost per day.\n// FuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * $3\n// FuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * $3\n// FuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * $3\n// FuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * $3\n// FuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * $3\n// So, the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// 500 * TrucksRegion1 / FuelEfficiency * $3 + 700 * TrucksRegion2 / FuelEfficiency * $3 + 600 * TrucksRegion3 / FuelEfficiency * $3 + 800 * TrucksRegion4 / FuelEfficiency * $3 + 900 * TrucksRegion5 / FuelEfficiency * $3 <= $10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20\n\n## Generate Constraint-3:\nAt least 3 trucks must be allocated to Region1.\n// TrucksRegion1 >= 3\n\n## Generate Constraint-4:\nNo more than 5 trucks can be allocated to any single region.\n// TrucksRegion1 <= 5\n// TrucksRegion2 <= 5\n// TrucksRegion3 <= 5\n// TrucksRegion4 <= 5\n// TrucksRegion5 <= 5\n\n## Generate Constraint-5:\nThe fuel efficiency of each truck type must be at least 10 miles per gallon.\n// FuelEfficiency >= 10",
        "question": "A logistics company is planning its routes for delivering goods to five different regions (Region1, Region2, Region3, Region4, Region5). The company needs to determine the number of trucks to allocate to each region and the fuel efficiency of each truck type. The cost of fuel per gallon is $3, and the distance traveled by each truck to each region varies (Region1: 500 miles, Region2: 700 miles, Region3: 600 miles, Region4: 800 miles, Region5: 900 miles). The company wants to minimize the total fuel cost per day. The company has a total budget of $10,000 for fuel costs per day. The company can allocate a maximum of 20 trucks in total across all regions. At least 3 trucks must be allocated to Region1. No more than 5 trucks can be allocated to any single region. The fuel efficiency of each truck type must be at least 10 miles per gallon.\n\nPlease help the company to determine the optimal allocation of trucks and the minimum fuel efficiency required to minimize the total fuel cost per day.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksRegion1 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion1\", lb=3, ub=5) # number of trucks for Region1\nTrucksRegion2 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion2\", lb=0, ub=5) # number of trucks for Region2\nTrucksRegion3 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion3\", lb=0, ub=5) # number of trucks for Region3\nTrucksRegion4 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion4\", lb=0, ub=5) # number of trucks for Region4\nTrucksRegion5 = model.addVar(vtype=\"INTEGER\", name=\"TrucksRegion5\", lb=0, ub=5) # number of trucks for Region5\nFuelEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiency\", lb=10) # fuel efficiency of each truck type\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost_Region1 = 500 * TrucksRegion1 / FuelEfficiency * 3\nFuelCost_Region2 = 700 * TrucksRegion2 / FuelEfficiency * 3\nFuelCost_Region3 = 600 * TrucksRegion3 / FuelEfficiency * 3\nFuelCost_Region4 = 800 * TrucksRegion4 / FuelEfficiency * 3\nFuelCost_Region5 = 900 * TrucksRegion5 / FuelEfficiency * 3\n## the objective function is: Minimize (FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\nmodel.addCons(obj == FuelCost_Region1 + FuelCost_Region2 + FuelCost_Region3 + FuelCost_Region4 + FuelCost_Region5)\n\n# Add constraints\n## The company has a total budget of $10,000 for fuel costs per day.\nmodel.addCons(500 * TrucksRegion1 / FuelEfficiency * 3 + 700 * TrucksRegion2 / FuelEfficiency * 3 + 600 * TrucksRegion3 / FuelEfficiency * 3 + 800 * TrucksRegion4 / FuelEfficiency * 3 + 900 * TrucksRegion5 / FuelEfficiency * 3 <= 10000)\n## The company can allocate a maximum of 20 trucks in total across all regions.\nmodel.addCons(TrucksRegion1 + TrucksRegion2 + TrucksRegion3 + TrucksRegion4 + TrucksRegion5 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Region1: \", model.getVal(TrucksRegion1))\n    print(\"Number of Trucks for Region2: \", model.getVal(TrucksRegion2))\n    print(\"Number of Trucks for Region3: \", model.getVal(TrucksRegion3))\n    print(\"Number of Trucks for Region4: \", model.getVal(TrucksRegion4))\n    print(\"Number of Trucks for Region5: \", model.getVal(TrucksRegion5))\n    print(\"Fuel Efficiency: \", model.getVal(FuelEfficiency))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, with a carbon emission of 10 kg per unit.\nThe profit per unit of Product B is $70, with a carbon emission of 15 kg per unit.\nThe profit per unit of Product C is $60, with a carbon emission of 12 kg per unit.\nThe profit per unit of Product D is $80, with a carbon emission of 20 kg per unit.\nThe profit per unit of Product E is $90, with a carbon emission of 25 kg per unit.\nThe company wants to maximize the Profit-Carbon ratio of the production. (The Profit-Carbon ratio is defined as the total profit divided by the total carbon emissions.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total carbon emissions: Carbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n// So, the objective function is: Maximize Profit / Carbon\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1500\n\n## Generate Constraint-2:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200\n\n## Generate Constraint-3:\nThe total carbon emissions must not exceed 20,000 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit and carbon emission per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Carbon Emission per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 10 kg                    |\n| B       | $70             | 15 kg                    |\n| C       | $60             | 12 kg                    |\n| D       | $80             | 20 kg                    |\n| E       | $90             | 25 kg                    |\n\nThe company has a total production capacity of 1500 units across all products. The company must produce at least 200 units of Product A. The total carbon emissions must not exceed 20,000 kg. \n\nPlease help the company to maximize the Profit-Carbon ratio of the production (defined as the total profit divided by the total carbon emissions).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCarbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n## the objective function is: Maximize Profit / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1500)\n## The company must produce at least 200 units of Product A.\nmodel.addCons(ProductA >= 200)\n## The total carbon emissions must not exceed 20,000 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the level of maintenance investment for each plant, which affects the efficiency of energy production.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"maintenance investment for Solar plant\": \"MaintenanceSolar\", \"range\": \"MaintenanceSolar >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Wind plant\": \"MaintenanceWind\", \"range\": \"MaintenanceWind >= 0\", \"type\": \"continuous\"}\n// {\"maintenance investment for Hydro plant\": \"MaintenanceHydro\", \"range\": \"MaintenanceHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company aims to maximize the total daily energy production.\n// EnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\n// EnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\n// EnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for maintenance investments and operational costs.\n// 1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000\n\n## Generate Constraint-2:\nEach plant has a maximum operational capacity of 24 hours per day.\n// HoursSolar <= 24; HoursWind <= 24; HoursHydro <= 24\n\n## Generate Constraint-3:\nDue to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours.\n// HoursHydro >= 8; HoursWind + HoursSolar <= 40",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the level of maintenance investment for each plant to maximize energy production. The efficiency of each plant increases with the level of maintenance investment. For every $1000 invested in maintenance, the Solar plant's energy production increases by 10 kWh per hour, the Wind plant's production increases by 15 kWh per hour, and the Hydro plant's production increases by 20 kWh per hour. The company has a total budget of $100,000 for maintenance investments and operational costs. Each plant has a maximum operational capacity of 24 hours per day. Due to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours. Please help the company to maximize the total daily energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=0)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nMaintenanceSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceSolar\", lb=0)  # maintenance investment for Solar plant\nMaintenanceWind = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceWind\", lb=0)  # maintenance investment for Wind plant\nMaintenanceHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"MaintenanceHydro\", lb=0)  # maintenance investment for Hydro plant\n\n# Define objective function\nEnergyProductionSolar = (100 + 0.01 * MaintenanceSolar) * HoursSolar\nEnergyProductionWind = (150 + 0.015 * MaintenanceWind) * HoursWind\nEnergyProductionHydro = (200 + 0.02 * MaintenanceHydro) * HoursHydro\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergyProductionSolar + EnergyProductionWind + EnergyProductionHydro)\n\n# Add constraints\n# The company has a total budget of $100,000 for maintenance investments and operational costs.\nmodel.addCons(1000 * MaintenanceSolar + 1000 * MaintenanceWind + 1000 * MaintenanceHydro + 50 * HoursSolar + 70 * HoursWind + 60 * HoursHydro <= 100000)\n\n# Each plant has a maximum operational capacity of 24 hours per day.\nmodel.addCons(HoursSolar <= 24)\nmodel.addCons(HoursWind <= 24)\nmodel.addCons(HoursHydro <= 24)\n\n# Due to environmental regulations, the Hydro plant must operate at least 8 hours per day, and the total daily operation hours of the Wind and Solar plants must not exceed 40 hours.\nmodel.addCons(HoursHydro >= 8)\nmodel.addCons(HoursWind + HoursSolar <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Solar plant: \", model.getVal(HoursSolar))\n    print(\"Hours of Wind plant: \", model.getVal(HoursWind))\n    print(\"Hours of Hydro plant: \", model.getVal(HoursHydro))\n    print(\"Maintenance investment for Solar plant: \", model.getVal(MaintenanceSolar))\n    print(\"Maintenance investment for Wind plant: \", model.getVal(MaintenanceWind))\n    print(\"Maintenance investment for Hydro plant: \", model.getVal(MaintenanceHydro))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering the cost of raw materials, labor, and storage. Additionally, the company needs to decide on the marketing budget for each product to enhance sales.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MktgA\", \"range\": \"MktgA >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductB\": \"MktgB\", \"range\": \"MktgB >= 0\", \"type\": \"real\"}\n// {\"marketing budget for ProductC\": \"MktgC\", \"range\": \"MktgC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company wants to maximize the total profit.\n// Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n// Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n// Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for raw materials and labor.\n// (20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100,000\n\n## Generate Constraint-2:\nThe storage capacity is limited to 2000 units across all products.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe total marketing budget must not exceed $20,000.\n// MktgA + MktgB + MktgC <= 20,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product (ProdA, ProdB, ProdC) and the marketing budget for each product (MktgA, MktgB, MktgC) to maximize profit. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $25. The labor cost per unit for ProductA is $10, for ProductB is $15, and for ProductC is $12. The storage cost per unit for all products is $5. The marketing effectiveness is modeled as a nonlinear function where the additional sales per dollar spent on marketing is 0.1% for ProductA, 0.15% for ProductB, and 0.12% for ProductC. The company has a total budget of $100,000 for raw materials and labor. The storage capacity is limited to 2000 units across all products. The total marketing budget must not exceed $20,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nMktgA = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgA\", lb=0) # marketing budget for ProductA\nMktgB = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgB\", lb=0) # marketing budget for ProductB\nMktgC = model.addVar(vtype=\"CONTINUOUS\", name=\"MktgC\", lb=0) # marketing budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\n## Total profit for ProductB: Profit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\n## Total profit for ProductC: Profit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - 20 - 10 - 5) * ProdA + 0.001 * MktgA * ProdA\nProfit_B = (70 - 30 - 15 - 5) * ProdB + 0.0015 * MktgB * ProdB\nProfit_C = (60 - 25 - 12 - 5) * ProdC + 0.0012 * MktgC * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $100,000 for raw materials and labor.\nmodel.addCons((20 + 10) * ProdA + (30 + 15) * ProdB + (25 + 12) * ProdC <= 100000)\n## The storage capacity is limited to 2000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n## The total marketing budget must not exceed $20,000.\nmodel.addCons(MktgA + MktgB + MktgC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MktgA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MktgB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MktgC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion to optimize the delivery routes for five different types of cargo (A, B, C, D, E). The company needs to decide on the number of trucks to purchase for each type of cargo.\n// {\"number of trucks for cargo A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo D\": \"TruckD\", \"range\": \"TruckD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for cargo E\": \"TruckE\", \"range\": \"TruckE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of cargo has a different profit per delivery and a different fuel consumption rate. Cargo A has a profit of $500 per delivery and consumes 10 liters of fuel. Cargo B has a profit of $600 per delivery and consumes 12 liters of fuel. Cargo C has a profit of $700 per delivery and consumes 14 liters of fuel. Cargo D has a profit of $800 per delivery and consumes 16 liters of fuel. Cargo E has a profit of $900 per delivery and consumes 18 liters of fuel. The company wants to maximize the net profit per liter of fuel consumed.\n// Profit_A = 500 * TruckA\n// Profit_B = 600 * TruckB\n// Profit_C = 700 * TruckC\n// Profit_D = 800 * TruckD\n// Profit_E = 900 * TruckE\n// Fuel_Consumption = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Fuel_Consumption\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing new trucks.\n// Cost_A * TruckA + Cost_B * TruckB + Cost_C * TruckC + Cost_D * TruckD + Cost_E * TruckE <= 100000",
        "question": "A logistics company is planning its fleet expansion to optimize the delivery routes for five different types of cargo (A, B, C, D, E). The company needs to decide on the number of trucks to purchase for each type of cargo. Each type of cargo has a different profit per delivery and a different fuel consumption rate. Cargo A has a profit of $500 per delivery and consumes 10 liters of fuel. Cargo B has a profit of $600 per delivery and consumes 12 liters of fuel. Cargo C has a profit of $700 per delivery and consumes 14 liters of fuel. Cargo D has a profit of $800 per delivery and consumes 16 liters of fuel. Cargo E has a profit of $900 per delivery and consumes 18 liters of fuel. The company wants to maximize the net profit per liter of fuel consumed. The company has a budget of $100,000 for purchasing new trucks. Please help the company determine the optimal number of trucks to purchase for each type of cargo.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for cargo A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for cargo B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for cargo C\nTruckD = model.addVar(vtype=\"INTEGER\", name=\"TruckD\", lb=0) # number of trucks for cargo D\nTruckE = model.addVar(vtype=\"INTEGER\", name=\"TruckE\", lb=0) # number of trucks for cargo E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * TruckA\nProfit_B = 600 * TruckB\nProfit_C = 700 * TruckC\nProfit_D = 800 * TruckD\nProfit_E = 900 * TruckE\nFuel_Consumption = 10 * TruckA + 12 * TruckB + 14 * TruckC + 16 * TruckD + 18 * TruckE\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / Fuel_Consumption\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Consumption == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing new trucks.\nCost_A = 10000 # cost of a truck for cargo A\nCost_B = 12000 # cost of a truck for cargo B\nCost_C = 14000 # cost of a truck for cargo C\nCost_D = 16000 # cost of a truck for cargo D\nCost_E = 18000 # cost of a truck for cargo E\nmodel.addCons(Cost_A * TruckA + Cost_B * TruckB + Cost_C * TruckC + Cost_D * TruckD + Cost_E * TruckE <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Cargo A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Cargo B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Cargo C: \", model.getVal(TruckC))\n    print(\"Number of Trucks for Cargo D: \", model.getVal(TruckD))\n    print(\"Number of Trucks for Cargo E: \", model.getVal(TruckE))\n    print(\"Maximized Net Profit per Liter of Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints.\n// {\"quantity of device 1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 4\": \"Q4\", \"range\": \"Q4 >= 0\", \"type\": \"integer\"}\n// {\"quantity of device 5\": \"Q5\", \"range\": \"Q5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device is determined by a nonlinear function of its quantity. The profit function for each device is as follows:\n- Device 1: P1 = 100 * Q1 - 0.5 * Q1^2\n- Device 2: P2 = 150 * Q2 - 0.7 * Q2^2\n- Device 3: P3 = 120 * Q3 - 0.6 * Q3^2\n- Device 4: P4 = 130 * Q4 - 0.8 * Q4^2\n- Device 5: P5 = 140 * Q5 - 0.9 * Q5^2\nThe objective is to maximize the total profit from all devices.\n// Maximize P = P1 + P2 + P3 + P4 + P5\n// Maximize P = (100 * Q1 - 0.5 * Q1^2) + (150 * Q2 - 0.7 * Q2^2) + (120 * Q3 - 0.6 * Q3^2) + (130 * Q4 - 0.8 * Q4^2) + (140 * Q5 - 0.9 * Q5^2)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all devices.\n// Q1 + Q2 + Q3 + Q4 + Q5 <= 1000",
        "question": "A manufacturer produces 5 different types of electronic devices. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints. The profit from each device is determined by a nonlinear function of its quantity, as shown in the following table:\n\n| Device | Profit Function                |\n|--------|--------------------------------|\n| 1      | P1 = 100 * Q1 - 0.5 * Q1^2     |\n| 2      | P2 = 150 * Q2 - 0.7 * Q2^2     |\n| 3      | P3 = 120 * Q3 - 0.6 * Q3^2     |\n| 4      | P4 = 130 * Q4 - 0.8 * Q4^2     |\n| 5      | P5 = 140 * Q5 - 0.9 * Q5^2     |\n\nThe objective is to maximize the total profit from all devices. The total production capacity is limited to 1000 units across all devices. Please help the company determine the optimal production quantities for each device (Q1, Q2, Q3, Q4, Q5) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of device 1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of device 2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of device 3\nQ4 = model.addVar(vtype=\"INTEGER\", name=\"Q4\", lb=0) # quantity of device 4\nQ5 = model.addVar(vtype=\"INTEGER\", name=\"Q5\", lb=0) # quantity of device 5\n\n# Define objective function\nP1 = 100 * Q1 - 0.5 * Q1**2\nP2 = 150 * Q2 - 0.7 * Q2**2\nP3 = 120 * Q3 - 0.6 * Q3**2\nP4 = 130 * Q4 - 0.8 * Q4**2\nP5 = 140 * Q5 - 0.9 * Q5**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize P = P1 + P2 + P3 + P4 + P5\nmodel.addCons(obj == P1 + P2 + P3 + P4 + P5)\n\n# Add constraints\n# The total production capacity is limited to 1000 units across all devices.\nmodel.addCons(Q1 + Q2 + Q3 + Q4 + Q5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device 1: \", model.getVal(Q1))\n    print(\"Quantity of Device 2: \", model.getVal(Q2))\n    print(\"Quantity of Device 3: \", model.getVal(Q3))\n    print(\"Quantity of Device 4: \", model.getVal(Q4))\n    print(\"Quantity of Device 5: \", model.getVal(Q5))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs, but the investment cost is significant.\n// {\"quantity of ProductA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost for ProductA is $100, for ProductB is $150, for ProductC is $200, and for ProductD is $250. The selling price for each product is $200 for ProductA, $250 for ProductB, $300 for ProductC, and $350 for ProductD. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n// Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n// Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n// Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe total production quantity for all products must not exceed 10,000 units.\n// A + B + C + D <= 10000",
        "question": "A manufacturing company produces four types of products: ProductA, ProductB, ProductC, and ProductD. The company needs to determine the production quantity of each product for the next quarter. Additionally, the company is considering investing in a new technology that could reduce production costs, but the investment cost is significant. The production cost of each product decreases by $5 for every $10,000 invested in the new technology. The initial production cost for ProductA is $100, for ProductB is $150, for ProductC is $200, and for ProductD is $250. The selling price for each product is $200 for ProductA, $250 for ProductB, $300 for ProductC, and $350 for ProductD. The company aims to maximize the total profit from all products. The company has a budget of $100,000 for the investment in the new technology. The total production quantity for all products must not exceed 10,000 units. Please help the company determine the optimal production quantities and the amount to invest in the new technology to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of ProductA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of ProductB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of ProductC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of ProductD\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for ProductA: ProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\n## Total profit for ProductB: ProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\n## Total profit for ProductC: ProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\n## Total profit for ProductD: ProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\nProfitA = (200 - 100 + 0.0005 * TechInvestment) * A\nProfitB = (250 - 150 + 0.0005 * TechInvestment) * B\nProfitC = (300 - 200 + 0.0005 * TechInvestment) * C\nProfitD = (350 - 250 + 0.0005 * TechInvestment) * D\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC + ProfitD)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC + ProfitD)\n\n# Add constraints\n## The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n## The total production quantity for all products must not exceed 10,000 units.\nmodel.addCons(A + B + C + D <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(A))\n    print(\"Quantity of ProductB: \", model.getVal(B))\n    print(\"Quantity of ProductC: \", model.getVal(C))\n    print(\"Quantity of ProductD: \", model.getVal(D))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 5 different trucks to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed.\n// {\"fuel efficiency of truck 1\": \"E1\", \"range\": \"E1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 2\": \"E2\", \"range\": \"E2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 3\": \"E3\", \"range\": \"E3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 4\": \"E4\", \"range\": \"E4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 5\": \"E5\", \"range\": \"E5 > 0\", \"type\": \"real\"}\n// {\"speed of truck 1\": \"S1\", \"range\": \"S1 > 0\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"S2\", \"range\": \"S2 > 0\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"S3\", \"range\": \"S3 > 0\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"S4\", \"range\": \"S4 > 0\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"S5\", \"range\": \"S5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel consumption and travel time for all trucks. The fuel consumption is a nonlinear function of speed and fuel efficiency. The objective is to minimize the total cost, which is the sum of fuel costs and time costs (assuming time has a cost).\n// Fuel_Cost_T1 = (Distance / E1) * (1 / S1)\n// Fuel_Cost_T2 = (Distance / E2) * (1 / S2)\n// Fuel_Cost_T3 = (Distance / E3) * (1 / S3)\n// Fuel_Cost_T4 = (Distance / E4) * (1 / S4)\n// Fuel_Cost_T5 = (Distance / E5) * (1 / S5)\n// Time_Cost_T1 = Distance / S1\n// Time_Cost_T2 = Distance / S2\n// Time_Cost_T3 = Distance / S3\n// Time_Cost_T4 = Distance / S4\n// Time_Cost_T5 = Distance / S5\n// So, the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n## Generate Constraint-1:\nThe total distance each truck can travel is limited to 500 km.\n// Distance / S1 <= 500; Distance / S2 <= 500; Distance / S3 <= 500; Distance / S4 <= 500; Distance / S5 <= 500\n\n## Generate Constraint-2:\nThe fuel efficiency of each truck must be between 5 and 15 km/liter.\n// 5 <= E1 <= 15; 5 <= E2 <= 15; 5 <= E3 <= 15; 5 <= E4 <= 15; 5 <= E5 <= 15\n\n## Generate Constraint-3:\nThe speed of each truck must be between 60 and 120 km/h.\n// 60 <= S1 <= 120; 60 <= S2 <= 120; 60 <= S3 <= 120; 60 <= S4 <= 120; 60 <= S5 <= 120\n\n## Generate Constraint-4:\nThe company has a budget of $5000 for total fuel costs.\n// (Distance / E1) * (1 / S1) + (Distance / E2) * (1 / S2) + (Distance / E3) * (1 / S3) + (Distance / E4) * (1 / S4) + (Distance / E5) * (1 / S5) <= 5000",
        "question": "A logistics company operates a fleet of 5 trucks and needs to optimize the routes for these trucks to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed. The company wants to minimize the total cost, which includes both fuel costs and time costs (assuming time has a cost). The fuel consumption is a nonlinear function of speed and fuel efficiency. The total distance each truck can travel is limited to 500 km. The fuel efficiency of each truck must be between 5 and 15 km/liter, and the speed of each truck must be between 60 and 120 km/h. Additionally, the company has a budget of $5000 for total fuel costs. Please help the company to minimize the total cost, which is the sum of fuel costs and time costs for all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"E1\", lb=5, ub=15) # fuel efficiency of truck 1\nE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"E2\", lb=5, ub=15) # fuel efficiency of truck 2\nE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"E3\", lb=5, ub=15) # fuel efficiency of truck 3\nE4 = model.addVar(vtype=\"CONTINUOUS\", name=\"E4\", lb=5, ub=15) # fuel efficiency of truck 4\nE5 = model.addVar(vtype=\"CONTINUOUS\", name=\"E5\", lb=5, ub=15) # fuel efficiency of truck 5\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=60, ub=120) # speed of truck 1\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=60, ub=120) # speed of truck 2\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=60, ub=120) # speed of truck 3\nS4 = model.addVar(vtype=\"CONTINUOUS\", name=\"S4\", lb=60, ub=120) # speed of truck 4\nS5 = model.addVar(vtype=\"CONTINUOUS\", name=\"S5\", lb=60, ub=120) # speed of truck 5\nDistance = model.addVar(vtype=\"CONTINUOUS\", name=\"Distance\") # total distance\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Cost_T1 = (Distance / E1) * (1 / S1)\nFuel_Cost_T2 = (Distance / E2) * (1 / S2)\nFuel_Cost_T3 = (Distance / E3) * (1 / S3)\nFuel_Cost_T4 = (Distance / E4) * (1 / S4)\nFuel_Cost_T5 = (Distance / E5) * (1 / S5)\nTime_Cost_T1 = Distance / S1\nTime_Cost_T2 = Distance / S2\nTime_Cost_T3 = Distance / S3\nTime_Cost_T4 = Distance / S4\nTime_Cost_T5 = Distance / S5\n## the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\nmodel.addCons(obj == Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n# Add constraints\n## The total distance each truck can travel is limited to 500 km.\nmodel.addCons(Distance / S1 <= 500)\nmodel.addCons(Distance / S2 <= 500)\nmodel.addCons(Distance / S3 <= 500)\nmodel.addCons(Distance / S4 <= 500)\nmodel.addCons(Distance / S5 <= 500)\n## The fuel efficiency of each truck must be between 5 and 15 km/liter.\n## The speed of each truck must be between 60 and 120 km/h.\n## The company has a budget of $5000 for total fuel costs.\nmodel.addCons((Distance / E1) * (1 / S1) + (Distance / E2) * (1 / S2) + (Distance / E3) * (1 / S3) + (Distance / E4) * (1 / S4) + (Distance / E5) * (1 / S5) <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel Efficiency of Truck 1: \", model.getVal(E1))\n    print(\"Fuel Efficiency of Truck 2: \", model.getVal(E2))\n    print(\"Fuel Efficiency of Truck 3: \", model.getVal(E3))\n    print(\"Fuel Efficiency of Truck 4: \", model.getVal(E4))\n    print(\"Fuel Efficiency of Truck 5: \", model.getVal(E5))\n    print(\"Speed of Truck 1: \", model.getVal(S1))\n    print(\"Speed of Truck 2: \", model.getVal(S2))\n    print(\"Speed of Truck 3: \", model.getVal(S3))\n    print(\"Speed of Truck 4: \", model.getVal(S4))\n    print(\"Speed of Truck 5: \", model.getVal(S5))\n    print(\"Total Distance: \", model.getVal(Distance))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 11,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel.\n// {\"number of trucks for Route 1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route 3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"speed of trucks on Route 1\": \"Speed1\", \"range\": \"0 < Speed1 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 2\": \"Speed2\", \"range\": \"0 < Speed2 <= 60\", \"type\": \"continuous\"}\n// {\"speed of trucks on Route 3\": \"Speed3\", \"range\": \"0 < Speed3 <= 60\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes.\n// Fuel consumption for Route 1: Fuel1 = 0.002 * Speed1^2 * Trucks1 * Distance1\n// Fuel consumption for Route 2: Fuel2 = 0.003 * Speed2^2 * Trucks2 * Distance2\n// Fuel consumption for Route 3: Fuel3 = 0.004 * Speed3^2 * Trucks3 * Distance3\n// So, the objective function is: Minimize (Fuel1 + Fuel2 + Fuel3)\n\n## Generate Constraint-1:\nThe total number of trucks available for all routes is 50.\n// Trucks1 + Trucks2 + Trucks3 <= 50\n\n## Generate Constraint-2:\nThe total distance that can be covered by all trucks should not exceed 10,000 kilometers.\n// Speed1 * Trucks1 * Distance1 + Speed2 * Trucks2 * Distance2 + Speed3 * Trucks3 * Distance3 <= 10000\n\n## Generate Constraint-3:\nDue to maintenance schedules, at least 10 trucks must be assigned to Route 1.\n// Trucks1 >= 10",
        "question": "A logistics company operates a fleet of trucks and needs to optimize its fuel consumption and route planning for a set of deliveries. The company must decide the number of trucks to use for each route and the speed at which each truck should travel. The fuel consumption of each truck is modeled by a nonlinear function that depends on the speed of the truck. For Route 1, the fuel consumption is 0.002 * Speed1^2 liters per kilometer. For Route 2, it is 0.003 * Speed2^2 liters per kilometer. For Route 3, it is 0.004 * Speed3^2 liters per kilometer. The company aims to minimize the total fuel consumption across all routes.\n\n| Route | Fuel Consumption Function |\n|-------|---------------------------|\n| 1     | 0.002 * Speed1^2          |\n| 2     | 0.003 * Speed2^2          |\n| 3     | 0.004 * Speed3^2          |\n\nThe total number of trucks available for all routes is 50. The total distance that can be covered by all trucks should not exceed 10,000 kilometers. Due to maintenance schedules, at least 10 trucks must be assigned to Route 1.\n\nPlease help the company to determine the optimal number of trucks and their speeds to minimize the total fuel consumption while satisfying these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=10)  # number of trucks for Route 1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)   # number of trucks for Route 2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)   # number of trucks for Route 3\nSpeed1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed1\", lb=0, ub=60)  # speed of trucks on Route 1\nSpeed2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed2\", lb=0, ub=60)  # speed of trucks on Route 2\nSpeed3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Speed3\", lb=0, ub=60)  # speed of trucks on Route 3\n\n# Define objective function\nFuel1 = 0.002 * Speed1**2 * Trucks1 * model.addVar(name=\"Distance1\")  # Fuel consumption for Route 1\nFuel2 = 0.003 * Speed2**2 * Trucks2 * model.addVar(name=\"Distance2\")  # Fuel consumption for Route 2\nFuel3 = 0.004 * Speed3**2 * Trucks3 * model.addVar(name=\"Distance3\")  # Fuel consumption for Route 3\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel1 + Fuel2 + Fuel3)  # Objective function\n\n# Add constraints\nmodel.addCons(Trucks1 + Trucks2 + Trucks3 <= 50)  # Total number of trucks available\nmodel.addCons(Speed1 * Trucks1 * model.addVar(name=\"Distance1\") + \n              Speed2 * Trucks2 * model.addVar(name=\"Distance2\") + \n              Speed3 * Trucks3 * model.addVar(name=\"Distance3\") <= 10000)  # Total distance constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route 1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route 2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route 3: \", model.getVal(Trucks3))\n    print(\"Speed of Trucks on Route 1: \", model.getVal(Speed1))\n    print(\"Speed of Trucks on Route 2: \", model.getVal(Speed2))\n    print(\"Speed of Trucks on Route 3: \", model.getVal(Speed3))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints.\n// {\"production quantity for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Profit_A = A * (50 - (100 - 0.5A^2))\n// Profit_B = B * (70 - (120 - 0.4B^2))\n// Profit_C = C * (60 - (110 - 0.3C^2))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 500 units per month.\n// A <= 500\n\n## Generate Constraint-3:\nThe market demand for product B is at most 400 units per month.\n// B <= 400\n\n## Generate Constraint-4:\nThe market demand for product C is at most 300 units per month.\n// C <= 300\n\n## Generate Constraint-5:\nThe company has a policy to produce at least 100 units of each product to maintain operational efficiency.\n// A >= 100; B >= 100; C >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $60. However, the production cost per unit increases non-linearly with the quantity produced due to economies of scale. The production cost function for each product is given by: Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost. The total production capacity of the company is limited to 1000 units per month. The market demand for product A is at most 500 units per month. The market demand for product B is at most 400 units per month. The market demand for product C is at most 300 units per month. The company has a policy to produce at least 100 units of each product to maintain operational efficiency. Please help the company to determine the optimal production quantities for products A, B, and C to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company has a policy to produce at least 100 units of each product to maintain operational efficiency.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # production quantity for product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=100) # production quantity for product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # production quantity for product C\n\n# Define objective function\n## The production cost per unit increases non-linearly with the quantity produced due to economies of scale.\n## Cost_A = 100 - 0.5A^2, Cost_B = 120 - 0.4B^2, Cost_C = 110 - 0.3C^2\n## Profit_A = A * (50 - (100 - 0.5A^2))\n## Profit_B = B * (70 - (120 - 0.4B^2))\n## Profit_C = C * (60 - (110 - 0.3C^2))\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = A * (50 - (100 - 0.5 * A**2))\nProfit_B = B * (70 - (120 - 0.4 * B**2))\nProfit_C = C * (60 - (110 - 0.3 * C**2))\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for product A is at most 500 units per month.\nmodel.addCons(A <= 500)\n## The market demand for product B is at most 400 units per month.\nmodel.addCons(B <= 400)\n## The market demand for product C is at most 300 units per month.\nmodel.addCons(C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(A))\n    print(\"Production Quantity for Product B: \", model.getVal(B))\n    print(\"Production Quantity for Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for delivering goods to different regions. The company has identified four regions (North, South, East, West) and needs to decide the number of trucks to allocate to each region. Additionally, the company must determine the fuel efficiency (in miles per gallon) of each truck type used in each region.\n// {\"number of trucks for North\": \"TrucksNorth\", \"range\": \"TrucksNorth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for South\": \"TrucksSouth\", \"range\": \"TrucksSouth >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for East\": \"TrucksEast\", \"range\": \"TrucksEast >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for West\": \"TrucksWest\", \"range\": \"TrucksWest >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency of trucks for North\": \"FuelEfficiencyNorth\", \"range\": \"FuelEfficiencyNorth > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for South\": \"FuelEfficiencySouth\", \"range\": \"FuelEfficiencySouth > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for East\": \"FuelEfficiencyEast\", \"range\": \"FuelEfficiencyEast > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of trucks for West\": \"FuelEfficiencyWest\", \"range\": \"FuelEfficiencyWest > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel cost per day. The cost of fuel is $3 per gallon. Each truck in the North region travels 500 miles per day, in the South region 400 miles per day, in the East region 600 miles per day, and in the West region 550 miles per day.\n// FuelCostNorth = (500 * TrucksNorth) / FuelEfficiencyNorth * 3\n// FuelCostSouth = (400 * TrucksSouth) / FuelEfficiencySouth * 3\n// FuelCostEast = (600 * TrucksEast) / FuelEfficiencyEast * 3\n// FuelCostWest = (550 * TrucksWest) / FuelEfficiencyWest * 3\n// So, the objective function is: Minimize (FuelCostNorth + FuelCostSouth + FuelCostEast + FuelCostWest)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for fuel costs per day.\n// (500 * TrucksNorth) / FuelEfficiencyNorth * 3 + (400 * TrucksSouth) / FuelEfficiencySouth * 3 + (600 * TrucksEast) / FuelEfficiencyEast * 3 + (550 * TrucksWest) / FuelEfficiencyWest * 3 <= 10000\n\n## Generate Constraint-2:\nThe company can allocate a maximum of 20 trucks in total across all regions.\n// TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 20\n\n## Generate Constraint-3:\nThe fuel efficiency of trucks in any region must not exceed 15 miles per gallon.\n// FuelEfficiencyNorth <= 15\n// FuelEfficiencySouth <= 15\n// FuelEfficiencyEast <= 15\n// FuelEfficiencyWest <= 15\n\n## Generate Constraint-4:\nThe company must allocate at least 2 trucks to each region.\n// TrucksNorth >= 2\n// TrucksSouth >= 2\n// TrucksEast >= 2\n// TrucksWest >= 2",
        "question": "A logistics company is planning its routes for delivering goods to different regions. The company has identified four regions (North, South, East, West) and needs to decide the number of trucks to allocate to each region. Additionally, the company must determine the fuel efficiency (in miles per gallon) of each truck type used in each region. Each truck in the North region travels 500 miles per day, in the South region 400 miles per day, in the East region 600 miles per day, and in the West region 550 miles per day. The cost of fuel is $3 per gallon.\nThe company has a total budget of $10,000 for fuel costs per day. The company can allocate a maximum of 20 trucks in total across all regions. The fuel efficiency of trucks in any region must not exceed 15 miles per gallon. The company must allocate at least 2 trucks to each region.\nPlease help the company to minimize the total fuel cost per day.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksNorth = model.addVar(vtype=\"INTEGER\", name=\"TrucksNorth\", lb=2)  # number of trucks for North\nTrucksSouth = model.addVar(vtype=\"INTEGER\", name=\"TrucksSouth\", lb=2)  # number of trucks for South\nTrucksEast = model.addVar(vtype=\"INTEGER\", name=\"TrucksEast\", lb=2)  # number of trucks for East\nTrucksWest = model.addVar(vtype=\"INTEGER\", name=\"TrucksWest\", lb=2)  # number of trucks for West\nFuelEfficiencyNorth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyNorth\", lb=0)  # fuel efficiency of trucks for North\nFuelEfficiencySouth = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencySouth\", lb=0)  # fuel efficiency of trucks for South\nFuelEfficiencyEast = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyEast\", lb=0)  # fuel efficiency of trucks for East\nFuelEfficiencyWest = model.addVar(vtype=\"CONTINUOUS\", name=\"FuelEfficiencyWest\", lb=0)  # fuel efficiency of trucks for West\n\n# Define objective function\nFuelCostNorth = (500 * TrucksNorth) / FuelEfficiencyNorth * 3\nFuelCostSouth = (400 * TrucksSouth) / FuelEfficiencySouth * 3\nFuelCostEast = (600 * TrucksEast) / FuelEfficiencyEast * 3\nFuelCostWest = (550 * TrucksWest) / FuelEfficiencyWest * 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == FuelCostNorth + FuelCostSouth + FuelCostEast + FuelCostWest)\n\n# Add constraints\nmodel.addCons((500 * TrucksNorth) / FuelEfficiencyNorth * 3 + (400 * TrucksSouth) / FuelEfficiencySouth * 3 + (600 * TrucksEast) / FuelEfficiencyEast * 3 + (550 * TrucksWest) / FuelEfficiencyWest * 3 <= 10000)\nmodel.addCons(TrucksNorth + TrucksSouth + TrucksEast + TrucksWest <= 20)\nmodel.addCons(FuelEfficiencyNorth <= 15)\nmodel.addCons(FuelEfficiencySouth <= 15)\nmodel.addCons(FuelEfficiencyEast <= 15)\nmodel.addCons(FuelEfficiencyWest <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for North: \", model.getVal(TrucksNorth))\n    print(\"Number of Trucks for South: \", model.getVal(TrucksSouth))\n    print(\"Number of Trucks for East: \", model.getVal(TrucksEast))\n    print(\"Number of Trucks for West: \", model.getVal(TrucksWest))\n    print(\"Fuel Efficiency for North: \", model.getVal(FuelEfficiencyNorth))\n    print(\"Fuel Efficiency for South: \", model.getVal(FuelEfficiencySouth))\n    print(\"Fuel Efficiency for East: \", model.getVal(FuelEfficiencyEast))\n    print(\"Fuel Efficiency for West: \", model.getVal(FuelEfficiencyWest))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes for the next quarter. The company needs to determine the number of trucks to deploy for each route (Route1, Route2, Route3), the fuel efficiency of each truck (Efficiency1, Efficiency2, Efficiency3), and the maintenance cost per truck (Maintenance1, Maintenance2, Maintenance3). The fuel efficiency and maintenance costs are influenced by the investment in technology upgrades for each route.\n// {\"number of trucks for Route1\": \"Trucks1\", \"range\": \"Trucks1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route2\": \"Trucks2\", \"range\": \"Trucks2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Route3\": \"Trucks3\", \"range\": \"Trucks3 >= 0\", \"type\": \"integer\"}\n// {\"fuel efficiency for Route1\": \"Efficiency1\", \"range\": \"Efficiency1 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency for Route2\": \"Efficiency2\", \"range\": \"Efficiency2 >= 0\", \"type\": \"continuous\"}\n// {\"fuel efficiency for Route3\": \"Efficiency3\", \"range\": \"Efficiency3 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route1\": \"Maintenance1\", \"range\": \"Maintenance1 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route2\": \"Maintenance2\", \"range\": \"Maintenance2 >= 0\", \"type\": \"continuous\"}\n// {\"maintenance cost for Route3\": \"Maintenance3\", \"range\": \"Maintenance3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is a nonlinear function of the fuel efficiency and the number of trucks. The maintenance cost is also a nonlinear function of the investment in technology upgrades.\n// Fuel cost for Route1: FuelCost1 = (1/Efficiency1) * Trucks1\n// Fuel cost for Route2: FuelCost2 = (1/Efficiency2) * Trucks2\n// Fuel cost for Route3: FuelCost3 = (1/Efficiency3) * Trucks3\n// Maintenance cost for Route1: MaintenanceCost1 = Maintenance1 * Trucks1\n// Maintenance cost for Route2: MaintenanceCost2 = Maintenance2 * Trucks2\n// Maintenance cost for Route3: MaintenanceCost3 = Maintenance3 * Trucks3\n// So, the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + MaintenanceCost1 + MaintenanceCost2 + MaintenanceCost3)\n\n## Generate Constraint-1:\nThe total budget for technology upgrades and operational costs is $100,000.\n// (1/Efficiency1) * Trucks1 + (1/Efficiency2) * Trucks2 + (1/Efficiency3) * Trucks3 + Maintenance1 * Trucks1 + Maintenance2 * Trucks2 + Maintenance3 * Trucks3 <= 100000",
        "question": "A logistics company is planning its delivery routes for the next quarter. The company needs to determine the number of trucks to deploy for each route (Route1, Route2, Route3), the fuel efficiency of each truck (Efficiency1, Efficiency2, Efficiency3), and the maintenance cost per truck (Maintenance1, Maintenance2, Maintenance3). The fuel efficiency and maintenance costs are influenced by the investment in technology upgrades for each route.\nThe company aims to minimize the total operational cost, which includes fuel and maintenance costs. The fuel cost is a nonlinear function of the fuel efficiency and the number of trucks. The maintenance cost is also a nonlinear function of the investment in technology upgrades.\nThe total budget for technology upgrades and operational costs is $100,000.\nPlease help the company to minimize the total operational cost, which includes fuel and maintenance costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks1 = model.addVar(vtype=\"INTEGER\", name=\"Trucks1\", lb=0)  # number of trucks for Route1\nTrucks2 = model.addVar(vtype=\"INTEGER\", name=\"Trucks2\", lb=0)  # number of trucks for Route2\nTrucks3 = model.addVar(vtype=\"INTEGER\", name=\"Trucks3\", lb=0)  # number of trucks for Route3\nEfficiency1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency1\", lb=0)  # fuel efficiency for Route1\nEfficiency2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency2\", lb=0)  # fuel efficiency for Route2\nEfficiency3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency3\", lb=0)  # fuel efficiency for Route3\nMaintenance1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance1\", lb=0)  # maintenance cost for Route1\nMaintenance2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance2\", lb=0)  # maintenance cost for Route2\nMaintenance3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Maintenance3\", lb=0)  # maintenance cost for Route3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuelCost1 = (1 / Efficiency1) * Trucks1\nFuelCost2 = (1 / Efficiency2) * Trucks2\nFuelCost3 = (1 / Efficiency3) * Trucks3\nMaintenanceCost1 = Maintenance1 * Trucks1\nMaintenanceCost2 = Maintenance2 * Trucks2\nMaintenanceCost3 = Maintenance3 * Trucks3\n## the objective function is: Minimize (FuelCost1 + FuelCost2 + FuelCost3 + MaintenanceCost1 + MaintenanceCost2 + MaintenanceCost3)\nmodel.addCons(obj == FuelCost1 + FuelCost2 + FuelCost3 + MaintenanceCost1 + MaintenanceCost2 + MaintenanceCost3)\n\n# Add constraints\n## The total budget for technology upgrades and operational costs is $100,000.\nmodel.addCons((1 / Efficiency1) * Trucks1 + (1 / Efficiency2) * Trucks2 + (1 / Efficiency3) * Trucks3 + Maintenance1 * Trucks1 + Maintenance2 * Trucks2 + Maintenance3 * Trucks3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Route1: \", model.getVal(Trucks1))\n    print(\"Number of Trucks for Route2: \", model.getVal(Trucks2))\n    print(\"Number of Trucks for Route3: \", model.getVal(Trucks3))\n    print(\"Fuel Efficiency for Route1: \", model.getVal(Efficiency1))\n    print(\"Fuel Efficiency for Route2: \", model.getVal(Efficiency2))\n    print(\"Fuel Efficiency for Route3: \", model.getVal(Efficiency3))\n    print(\"Maintenance Cost for Route1: \", model.getVal(Maintenance1))\n    print(\"Maintenance Cost for Route2: \", model.getVal(Maintenance2))\n    print(\"Maintenance Cost for Route3: \", model.getVal(Maintenance3))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs.\n// {\"number of trucks for RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for RouteE\": \"TrucksE\", \"range\": \"TrucksE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor RouteA, the Fuel Cost per Truck is $500, the Maintenance Cost per Truck is $300, and the Revenue per Truck is $1000.\nFor RouteB, the Fuel Cost per Truck is $600, the Maintenance Cost per Truck is $350, and the Revenue per Truck is $1200.\nFor RouteC, the Fuel Cost per Truck is $700, the Maintenance Cost per Truck is $400, and the Revenue per Truck is $1400.\nFor RouteD, the Fuel Cost per Truck is $800, the Maintenance Cost per Truck is $450, and the Revenue per Truck is $1600.\nFor RouteE, the Fuel Cost per Truck is $900, the Maintenance Cost per Truck is $500, and the Revenue per Truck is $1800.\nThe company wants to minimize the average cost per truck while ensuring profitability.\n// Total cost for RouteA: Cost_RouteA = (500 + 300) * TrucksA\n// Total cost for RouteB: Cost_RouteB = (600 + 350) * TrucksB\n// Total cost for RouteC: Cost_RouteC = (700 + 400) * TrucksC\n// Total cost for RouteD: Cost_RouteD = (800 + 450) * TrucksD\n// Total cost for RouteE: Cost_RouteE = (900 + 500) * TrucksE\n// So, the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / (TrucksA + TrucksB + TrucksC + TrucksD + TrucksE)\n\n## Generate Constraint-1:\nThe company has a total of 40 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40\n\n## Generate Constraint-2:\nDue to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\n// TrucksC >= 0.5 * TrucksA",
        "question": "A logistics company is planning to optimize its fleet of trucks for five different routes: RouteA, RouteB, RouteC, RouteD, and RouteE. They need to determine how many trucks to allocate to each route to maximize efficiency and minimize costs. The costs and revenues per truck for each route are given in the following Table.\n\n| Route | Fuel Cost per Truck | Maintenance Cost per Truck | Revenue per Truck |\n|-------|---------------------|----------------------------|-------------------|\n| RouteA | $500               | $300                       | $1000             |\n| RouteB | $600               | $350                       | $1200             |\n| RouteC | $700               | $400                       | $1400             |\n| RouteD | $800               | $450                       | $1600             |\n| RouteE | $900               | $500                       | $1800             |\n\nThe company has a total of 40 trucks available for allocation. Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA. The company wants to minimize the average cost per truck while ensuring profitability.\nPlease help the company to determine the optimal allocation of trucks to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for RouteC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for RouteD\nTrucksE = model.addVar(vtype=\"INTEGER\", name=\"TrucksE\", lb=0) # number of trucks for RouteE\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_RouteA = (500 + 300) * TrucksA\nCost_RouteB = (600 + 350) * TrucksB\nCost_RouteC = (700 + 400) * TrucksC\nCost_RouteD = (800 + 450) * TrucksD\nCost_RouteE = (900 + 500) * TrucksE\nTotalTrucks = TrucksA + TrucksB + TrucksC + TrucksD + TrucksE\n## the objective function is: Minimize (Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == Cost_RouteA + Cost_RouteB + Cost_RouteC + Cost_RouteD + Cost_RouteE)\n\n# Add constraints\n## The company has a total of 40 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD + TrucksE <= 40)\n## Due to regulatory requirements, RouteC must have at least half as many trucks as RouteA.\nmodel.addCons(TrucksC >= 0.5 * TrucksA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for RouteC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for RouteD: \", model.getVal(TrucksD))\n    print(\"Number of Trucks for RouteE: \", model.getVal(TrucksE))\n    print(\"Minimized Average Cost per Truck: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines.\n// {\"number of trips for Route A\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route B\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route C\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route D\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n// {\"number of trips for Route E\": \"TripsE\", \"range\": \"TripsE >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel consumption for each route is nonlinear and depends on the number of trips. For Route A, the fuel consumption per trip is 100 liters, but it decreases by 0.1 liters for each additional trip after the 50th trip. For Route B, the fuel consumption per trip is 120 liters, decreasing by 0.15 liters for each additional trip after the 60th trip. For Route C, the fuel consumption per trip is 110 liters, decreasing by 0.12 liters for each additional trip after the 55th trip. For Route D, the fuel consumption per trip is 130 liters, decreasing by 0.18 liters for each additional trip after the 70th trip. For Route E, the fuel consumption per trip is 140 liters, decreasing by 0.2 liters for each additional trip after the 80th trip. The company wants to minimize the total fuel consumption.\n// Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\n// Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\n// Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\n// Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\n// Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n## Generate Constraint-1:\nThe company has a total of 300 trips available across all routes.\n// TripsA + TripsB + TripsC + TripsD + TripsE <= 300",
        "question": "A logistics company operates a fleet of trucks that transport goods between different cities. The company needs to optimize the fuel consumption and route selection for their trucks. They have identified five key routes (Route A, Route B, Route C, Route D, and Route E) that are critical for their operations. The company needs to determine the optimal number of trips for each route to minimize fuel consumption while meeting delivery deadlines. The fuel consumption for each route is nonlinear and depends on the number of trips, as described in the following Table.\n\n| Route | Fuel Consumption per Trip (liters) | Decrease in Fuel Consumption per Additional Trip after Threshold (liters) | Threshold (trips) |\n|-------|------------------------------------|-------------------------------------------------------------------------|------------------|\n| A     | 100                                | 0.1                                                                     | 50               |\n| B     | 120                                | 0.15                                                                    | 60               |\n| C     | 110                                | 0.12                                                                    | 55               |\n| D     | 130                                | 0.18                                                                    | 70               |\n| E     | 140                                | 0.2                                                                     | 80               |\n\nThe company has a total of 300 trips available across all routes. Please help the company to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for Route A\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for Route B\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for Route C\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0) # number of trips for Route D\nTripsE = model.addVar(vtype=\"INTEGER\", name=\"TripsE\", lb=0) # number of trips for Route E\n\n# Define objective function\n## create piecewise variables for piecewise function: Fuel_A = max(100 - 0.1 * (TripsA - 50), 100) * TripsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=50)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=50, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(TripsA == A1*A_b1 + A2*A_b2)\nFuel_A = 100 * A1 * A_b1 + (100 - 0.1 * (A2 - 50)) * A2 * A_b2\n## create piecewise variables for piecewise function: Fuel_B = max(120 - 0.15 * (TripsB - 60), 120) * TripsB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=60)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=60, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(TripsB == B1*B_b1 + B2*B_b2)\nFuel_B = 120 * B1 * B_b1 + (120 - 0.15 * (B2 - 60)) * B2 * B_b2\n## create piecewise variables for piecewise function: Fuel_C = max(110 - 0.12 * (TripsC - 55), 110) * TripsC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=55)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=55, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(TripsC == C1*C_b1 + C2*C_b2)\nFuel_C = 110 * C1 * C_b1 + (110 - 0.12 * (C2 - 55)) * C2 * C_b2\n## create piecewise variables for piecewise function: Fuel_D = max(130 - 0.18 * (TripsD - 70), 130) * TripsD\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0, ub=70)\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=70, ub=300)\nD_b1 = model.addVar(vtype=\"B\", name=\"D_b1\")\nD_b2 = model.addVar(vtype=\"B\", name=\"D_b2\")\nmodel.addCons(D_b1 + D_b2 == 1)\nmodel.addCons(TripsD == D1*D_b1 + D2*D_b2)\nFuel_D = 130 * D1 * D_b1 + (130 - 0.18 * (D2 - 70)) * D2 * D_b2\n## create piecewise variables for piecewise function: Fuel_E = max(140 - 0.2 * (TripsE - 80), 140) * TripsE\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=80)\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=80, ub=300)\nE_b1 = model.addVar(vtype=\"B\", name=\"E_b1\")\nE_b2 = model.addVar(vtype=\"B\", name=\"E_b2\")\nmodel.addCons(E_b1 + E_b2 == 1)\nmodel.addCons(TripsE == E1*E_b1 + E2*E_b2)\nFuel_E = 140 * E1 * E_b1 + (140 - 0.2 * (E2 - 80)) * E2 * E_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Fuel_D + Fuel_E)\n\n# Add constraints\nmodel.addCons(TripsA + TripsB + TripsC + TripsD + TripsE <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for Route A: \", model.getVal(TripsA))\n    print(\"Number of Trips for Route B: \", model.getVal(TripsB))\n    print(\"Number of Trips for Route C: \", model.getVal(TripsC))\n    print(\"Number of Trips for Route D: \", model.getVal(TripsD))\n    print(\"Number of Trips for Route E: \", model.getVal(TripsE))\n    print(\"Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1683,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations.\n// {\"number of trips to city A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trips to city E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per trip varies nonlinearly with the distance traveled and the load carried. The cost function for each city is given by: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips.\n// So, the objective function is: Minimize (0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for fuel costs this month.\n// 0.05 * A^2 + 0.07 * B^2 + 0.09 * C^2 + 0.11 * D^2 + 0.13 * E^2 <= 5000\n\n## Generate Constraint-2:\nThe company must make at least 5 trips to each city this month.\n// A >= 5; B >= 5; C >= 5; D >= 5; E >= 5\n\n## Generate Constraint-3:\nThe total number of trips across all cities must not exceed 100.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates a fleet of trucks that transport goods between five cities: A, B, C, D, and E. The company needs to determine the number of trips each truck should make to each city to optimize its operations.\nThe cost of fuel per trip varies nonlinearly with the distance traveled and the load carried. The cost function for each city is given by: Cost_A = 0.05 * A^2, Cost_B = 0.07 * B^2, Cost_C = 0.09 * C^2, Cost_D = 0.11 * D^2, Cost_E = 0.13 * E^2. The company aims to minimize the total fuel cost across all trips.\nThe company has a budget of $5000 for fuel costs this month. The company must make at least 5 trips to each city this month. The total number of trips across all cities must not exceed 100.\nPlease help the company to minimize the total fuel cost across all trips.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of trips to city A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of trips to city B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of trips to city C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=5) # number of trips to city D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=5) # number of trips to city E\n\n# Define objective function\nCost_A = 0.05 * A**2\nCost_B = 0.07 * B**2\nCost_C = 0.09 * C**2\nCost_D = 0.11 * D**2\nCost_E = 0.13 * E**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C + Cost_D + Cost_E)\n\n# Add constraints\nmodel.addCons(Cost_A + Cost_B + Cost_C + Cost_D + Cost_E <= 5000)\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of trips to city A: \", model.getVal(A))\n    print(\"Number of trips to city B: \", model.getVal(B))\n    print(\"Number of trips to city C: \", model.getVal(C))\n    print(\"Number of trips to city D: \", model.getVal(D))\n    print(\"Number of trips to city E: \", model.getVal(E))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make.\n// {\"number of trucks for CityA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CityD\": \"TrucksD\", \"range\": \"TrucksD >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"number of trips per truck for CityD\": \"TripsD\", \"range\": \"TripsD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company wants to maximize the total net profit from all routes.\n// NetProfit_CityA = (1500 - 500) * TrucksA * TripsA\n// NetProfit_CityB = (1800 - 600) * TrucksB * TripsB\n// NetProfit_CityC = (2100 - 700) * TrucksC * TripsC\n// NetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n// So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available.\n// TrucksA + TrucksB + TrucksC + TrucksD <= 50\n\n## Generate Constraint-2:\nDue to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\n// TripsA <= 20; TripsB <= 20; TripsC <= 20; TripsD <= 20\n\n## Generate Constraint-3:\nThe company has a budget of $200,000 for operational costs per quarter.\n// 500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200,000",
        "question": "A logistics company is planning its routes for the next quarter, focusing on four major cities: CityA, CityB, CityC, and CityD. The company needs to determine the number of trucks to allocate to each route and the number of trips each truck will make. The cost of operating a truck per trip is $500 in CityA, $600 in CityB, $700 in CityC, and $800 in CityD. The revenue generated per trip is $1500 in CityA, $1800 in CityB, $2100 in CityC, and $2400 in CityD. The company has a total of 50 trucks available and a budget of $200,000 for operational costs per quarter. Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter. The company wants to maximize the total net profit from all routes. Please help the company determine the optimal allocation of trucks and trips to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for CityA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for CityB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for CityC\nTrucksD = model.addVar(vtype=\"INTEGER\", name=\"TrucksD\", lb=0) # number of trucks for CityD\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0, ub=20) # number of trips per truck for CityA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0, ub=20) # number of trips per truck for CityB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0, ub=20) # number of trips per truck for CityC\nTripsD = model.addVar(vtype=\"INTEGER\", name=\"TripsD\", lb=0, ub=20) # number of trips per truck for CityD\n\n# Define objective function\nNetProfit_CityA = (1500 - 500) * TrucksA * TripsA\nNetProfit_CityB = (1800 - 600) * TrucksB * TripsB\nNetProfit_CityC = (2100 - 700) * TrucksC * TripsC\nNetProfit_CityD = (2400 - 800) * TrucksD * TripsD\n# So, the objective function is: Maximize (NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_CityA + NetProfit_CityB + NetProfit_CityC + NetProfit_CityD)\n\n# Add constraints\n# The company has a total of 50 trucks available.\nmodel.addCons(TrucksA + TrucksB + TrucksC + TrucksD <= 50)\n# Due to maintenance schedules, each truck can make a maximum of 20 trips per quarter.\nmodel.addCons(TripsA <= 20)\nmodel.addCons(TripsB <= 20)\nmodel.addCons(TripsC <= 20)\nmodel.addCons(TripsD <= 20)\n# The company has a budget of $200,000 for operational costs per quarter.\nmodel.addCons(500 * TrucksA * TripsA + 600 * TrucksB * TripsB + 700 * TrucksC * TripsC + 800 * TrucksD * TripsD <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CityA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for CityB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for CityC: \", model.getVal(TrucksC))\n    print(\"Number of Trucks for CityD: \", model.getVal(TrucksD))\n    print(\"Number of Trips per Truck for CityA: \", model.getVal(TripsA))\n    print(\"Number of Trips per Truck for CityB: \", model.getVal(TripsB))\n    print(\"Number of Trips per Truck for CityC: \", model.getVal(TripsC))\n    print(\"Number of Trips per Truck for CityD: \", model.getVal(TripsD))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 8,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints.\n// {\"production quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. The production cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. The storage cost per unit for DeviceA is $5, for DeviceB is $7, and for DeviceC is $9. The company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per day.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device to maximize profit while considering various costs and constraints. The profit per unit, production cost per unit, and storage cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|--------|-----------------|--------------------------|-----------------------|\n| DeviceA | $50            | $20                      | $5                    |\n| DeviceB | $70            | $30                      | $7                    |\n| DeviceC | $90            | $40                      | $9                    |\n\nThe company aims to maximize the total net profit, which is the sum of the profit minus the production and storage costs. The company has a limited production capacity of 1000 units per day. Please help the company determine the optimal production quantity for each device to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0) # production quantity of DeviceA\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0) # production quantity of DeviceB\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0) # production quantity of DeviceC\n\n# Define objective function\nProfit_DeviceA = (50 - 20 - 5) * DeviceA_Quantity\nProfit_DeviceB = (70 - 30 - 7) * DeviceB_Quantity\nProfit_DeviceC = (90 - 40 - 9) * DeviceC_Quantity\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Production Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Production Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1065,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of trucks and needs to optimize the routes for 5 different trucks to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed.\n// {\"fuel efficiency of truck 1\": \"E1\", \"range\": \"E1 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 2\": \"E2\", \"range\": \"E2 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 3\": \"E3\", \"range\": \"E3 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 4\": \"E4\", \"range\": \"E4 > 0\", \"type\": \"real\"}\n// {\"fuel efficiency of truck 5\": \"E5\", \"range\": \"E5 > 0\", \"type\": \"real\"}\n// {\"speed of truck 1\": \"S1\", \"range\": \"S1 > 0\", \"type\": \"real\"}\n// {\"speed of truck 2\": \"S2\", \"range\": \"S2 > 0\", \"type\": \"real\"}\n// {\"speed of truck 3\": \"S3\", \"range\": \"S3 > 0\", \"type\": \"real\"}\n// {\"speed of truck 4\": \"S4\", \"range\": \"S4 > 0\", \"type\": \"real\"}\n// {\"speed of truck 5\": \"S5\", \"range\": \"S5 > 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe company wants to minimize the total fuel consumption and travel time for all trucks. The fuel consumption is a nonlinear function of speed and fuel efficiency. The objective is to minimize the total cost, which is the sum of fuel costs and time costs (assuming time has a cost).\n// Fuel_Cost_T1 = (Distance / E1) * (1 / S1)\n// Fuel_Cost_T2 = (Distance / E2) * (1 / S2)\n// Fuel_Cost_T3 = (Distance / E3) * (1 / S3)\n// Fuel_Cost_T4 = (Distance / E4) * (1 / S4)\n// Fuel_Cost_T5 = (Distance / E5) * (1 / S5)\n// Time_Cost_T1 = Distance / S1\n// Time_Cost_T2 = Distance / S2\n// Time_Cost_T3 = Distance / S3\n// Time_Cost_T4 = Distance / S4\n// Time_Cost_T5 = Distance / S5\n// So, the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n## Generate Constraint-1:\nThe total distance each truck can travel is limited to 500 km.\n// Distance / S1 <= 500; Distance / S2 <= 500; Distance / S3 <= 500; Distance / S4 <= 500; Distance / S5 <= 500",
        "question": "A logistics company operates a fleet of 5 different trucks and needs to optimize the routes to minimize fuel consumption and travel time. Each truck has a different fuel efficiency and speed. The company wants to minimize the total cost, which includes both fuel costs and time costs. The fuel consumption is a nonlinear function of speed and fuel efficiency. The following table provides the fuel efficiency and speed for each truck.\n\n| Truck | Fuel Efficiency | Speed |\n|-------|-----------------|-------|\n| 1     | E1              | S1    |\n| 2     | E2              | S2    |\n| 3     | E3              | S3    |\n| 4     | E4              | S4    |\n| 5     | E5              | S5    |\n\nThe total distance each truck can travel is limited to 500 km. Please help the company to minimize the total cost, which is the sum of fuel costs and time costs, where fuel costs are calculated as (Distance / Fuel Efficiency) * (1 / Speed) and time costs are calculated as Distance / Speed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define fuel efficiency and speed for each truck\nE1 = model.addVar(name=\"E1\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency of truck 1\nE2 = model.addVar(name=\"E2\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency of truck 2\nE3 = model.addVar(name=\"E3\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency of truck 3\nE4 = model.addVar(name=\"E4\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency of truck 4\nE5 = model.addVar(name=\"E5\", vtype=\"CONTINUOUS\", lb=0) # fuel efficiency of truck 5\nS1 = model.addVar(name=\"S1\", vtype=\"CONTINUOUS\", lb=0) # speed of truck 1\nS2 = model.addVar(name=\"S2\", vtype=\"CONTINUOUS\", lb=0) # speed of truck 2\nS3 = model.addVar(name=\"S3\", vtype=\"CONTINUOUS\", lb=0) # speed of truck 3\nS4 = model.addVar(name=\"S4\", vtype=\"CONTINUOUS\", lb=0) # speed of truck 4\nS5 = model.addVar(name=\"S5\", vtype=\"CONTINUOUS\", lb=0) # speed of truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nDistance = model.addVar(name=\"Distance\", vtype=\"CONTINUOUS\", lb=0) # common distance for all trucks\n## Define fuel and time costs for each truck\nFuel_Cost_T1 = (Distance / E1) * (1 / S1)\nFuel_Cost_T2 = (Distance / E2) * (1 / S2)\nFuel_Cost_T3 = (Distance / E3) * (1 / S3)\nFuel_Cost_T4 = (Distance / E4) * (1 / S4)\nFuel_Cost_T5 = (Distance / E5) * (1 / S5)\nTime_Cost_T1 = Distance / S1\nTime_Cost_T2 = Distance / S2\nTime_Cost_T3 = Distance / S3\nTime_Cost_T4 = Distance / S4\nTime_Cost_T5 = Distance / S5\n## the objective function is: Minimize (Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\nmodel.addCons(obj == Fuel_Cost_T1 + Fuel_Cost_T2 + Fuel_Cost_T3 + Fuel_Cost_T4 + Fuel_Cost_T5 + Time_Cost_T1 + Time_Cost_T2 + Time_Cost_T3 + Time_Cost_T4 + Time_Cost_T5)\n\n# Add constraints\n## The total distance each truck can travel is limited to 500 km.\nmodel.addCons(Distance / S1 <= 500)\nmodel.addCons(Distance / S2 <= 500)\nmodel.addCons(Distance / S3 <= 500)\nmodel.addCons(Distance / S4 <= 500)\nmodel.addCons(Distance / S5 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel efficiency of truck 1: \", model.getVal(E1))\n    print(\"Fuel efficiency of truck 2: \", model.getVal(E2))\n    print(\"Fuel efficiency of truck 3: \", model.getVal(E3))\n    print(\"Fuel efficiency of truck 4: \", model.getVal(E4))\n    print(\"Fuel efficiency of truck 5: \", model.getVal(E5))\n    print(\"Speed of truck 1: \", model.getVal(S1))\n    print(\"Speed of truck 2: \", model.getVal(S2))\n    print(\"Speed of truck 3: \", model.getVal(S3))\n    print(\"Speed of truck 4: \", model.getVal(S4))\n    print(\"Speed of truck 5: \", model.getVal(S5))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of component D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of units of component E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for component A is $10, for B is $15, for C is $20, for D is $25, and for E is $30. The production cost per unit for each component is a percentage of its selling price, which varies with the production volume. Specifically, the cost decreases by 0.1% for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from selling these components.\n// Profit_A = (10 - 0.999^(A/100)) * A\n// Profit_B = (15 - 0.999^(B/100)) * B\n// Profit_C = (20 - 0.999^(C/100)) * C\n// Profit_D = (25 - 0.999^(D/100)) * D\n// Profit_E = (30 - 0.999^(E/100)) * E\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials, which costs $5 per unit for A, $7 for B, $9 for C, $11 for D, and $13 for E. The total budget for raw materials is $3000.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 3000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 1000 units in total.\n// A + B + C + D + E <= 1000\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of component E does not exceed the combined production of components A, B, C, and D.\n// E <= A + B + C + D\n\n## Generate Constraint-4:\nThe company has a minimum production requirement for each component. They must produce at least 50 units of each component.\n// A >= 50; B >= 50; C >= 50; D >= 50; E >= 50",
        "question": "A manufacturing company produces five types of electronic components: A, B, C, D, and E. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit. The profit per unit for component A is $10, for B is $15, for C is $20, for D is $25, and for E is $30. The production cost per unit for each component is a percentage of its selling price, which decreases by 0.1% for every 100 units produced above a threshold of 500 units. The company has a limited budget for raw materials, which costs $5 per unit for A, $7 for B, $9 for C, $11 for D, and $13 for E, with a total budget of $3000. The company has a production capacity limit of 1000 units in total. The company wants to ensure that the production of component E does not exceed the combined production of components A, B, C, and D. Additionally, the company has a minimum production requirement for each component, which is at least 50 units of each component. Please help the company to maximize the total profit from selling these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50)  # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50)  # number of units of component C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=50)  # number of units of component D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=50)  # number of units of component E\n\n# Define objective function\n# The profit per unit for each component decreases by 0.1% for every 100 units produced above a threshold of 500 units.\n# Profit_A = (10 - 0.999^(A/100)) * A\n# Profit_B = (15 - 0.999^(B/100)) * B\n# Profit_C = (20 - 0.999^(C/100)) * C\n# Profit_D = (25 - 0.999^(D/100)) * D\n# Profit_E = (30 - 0.999^(E/100)) * E\n# Objective: Maximize Profit_A + Profit_B + Profit_C + Profit_D + Profit_E\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n# Add constraints\n# The company has a limited budget for raw materials, which costs $5 per unit for A, $7 for B, $9 for C, $11 for D, and $13 for E. The total budget for raw materials is $3000.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 3000)\n\n# The company has a production capacity limit of 1000 units in total.\nmodel.addCons(A + B + C + D + E <= 1000)\n\n# The company wants to ensure that the production of component E does not exceed the combined production of components A, B, C, and D.\nmodel.addCons(E <= A + B + C + D)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Number of Component D: \", model.getVal(D))\n    print(\"Number of Component E: \", model.getVal(E))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs.\n// {\"fuel consumption of truck 1\": \"F1\", \"range\": \"F1 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 2\": \"F2\", \"range\": \"F2 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 3\": \"F3\", \"range\": \"F3 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 4\": \"F4\", \"range\": \"F4 >= 0\", \"type\": \"real\"}\n// {\"fuel consumption of truck 5\": \"F5\", \"range\": \"F5 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe operational cost of each truck is a nonlinear function of its fuel consumption and the distance traveled. The cost function is given by C = F^2 * D, where F is the fuel consumption and D is the distance. The company aims to minimize the total operational cost of all trucks.\n// Total operational cost: Cost = (F1^2 * D1) + (F2^2 * D2) + (F3^2 * D3) + (F4^2 * D4) + (F5^2 * D5)\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nEach truck must cover a minimum distance of 500 km.\n// D1 >= 500; D2 >= 500; D3 >= 500; D4 >= 500; D5 >= 500\n\n## Generate Constraint-2:\nThe total fuel consumption for all trucks must not exceed 1000 liters.\n// F1 + F2 + F3 + F4 + F5 <= 1000\n\n## Generate Constraint-3:\nThe maximum distance any truck can travel is 1000 km.\n// D1 <= 1000; D2 <= 1000; D3 <= 1000; D4 <= 1000; D5 <= 1000\n\n## Generate Constraint-4:\nThe fuel consumption of each truck is inversely proportional to its speed, which is a nonlinear relationship.\n// F1 = k1 / S1; F2 = k2 / S2; F3 = k3 / S3; F4 = k4 / S4; F5 = k5 / S5\n// where k1, k2, k3, k4, k5 are constants and S1, S2, S3, S4, S5 are the speeds of the trucks.",
        "question": "A logistics company operates a fleet of 5 trucks to transport goods across different regions. The company needs to determine the optimal fuel consumption and route for each truck to minimize overall operational costs. The operational cost of each truck is a nonlinear function of its fuel consumption (F) and the distance traveled (D), given by C = F^2 * D. The company aims to minimize the total operational cost of all trucks.\n\n| Truck | Fuel Consumption (F) | Distance (D) |\n|-------|---------------------|--------------|\n| 1     | F1                  | D1           |\n| 2     | F2                  | D2           |\n| 3     | F3                  | D3           |\n| 4     | F4                  | D4           |\n| 5     | F5                  | D5           |\n\nEach truck must cover a minimum distance of 500 km. The total fuel consumption for all trucks must not exceed 1000 liters. The maximum distance any truck can travel is 1000 km. The fuel consumption of each truck is inversely proportional to its speed, which is a nonlinear relationship (F = k / S, where k is a constant and S is the speed of the truck).\n\nPlease help the company to determine the optimal fuel consumption and route for each truck to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Define fuel consumption and distance for each truck\nF1 = model.addVar(vtype=\"CONTINUOUS\", name=\"F1\", lb=0) # fuel consumption of truck 1\nF2 = model.addVar(vtype=\"CONTINUOUS\", name=\"F2\", lb=0) # fuel consumption of truck 2\nF3 = model.addVar(vtype=\"CONTINUOUS\", name=\"F3\", lb=0) # fuel consumption of truck 3\nF4 = model.addVar(vtype=\"CONTINUOUS\", name=\"F4\", lb=0) # fuel consumption of truck 4\nF5 = model.addVar(vtype=\"CONTINUOUS\", name=\"F5\", lb=0) # fuel consumption of truck 5\nD1 = model.addVar(vtype=\"CONTINUOUS\", name=\"D1\", lb=500, ub=1000) # distance of truck 1\nD2 = model.addVar(vtype=\"CONTINUOUS\", name=\"D2\", lb=500, ub=1000) # distance of truck 2\nD3 = model.addVar(vtype=\"CONTINUOUS\", name=\"D3\", lb=500, ub=1000) # distance of truck 3\nD4 = model.addVar(vtype=\"CONTINUOUS\", name=\"D4\", lb=500, ub=1000) # distance of truck 4\nD5 = model.addVar(vtype=\"CONTINUOUS\", name=\"D5\", lb=500, ub=1000) # distance of truck 5\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total operational cost: Cost = (F1^2 * D1) + (F2^2 * D2) + (F3^2 * D3) + (F4^2 * D4) + (F5^2 * D5)\nCost = F1**2 * D1 + F2**2 * D2 + F3**2 * D3 + F4**2 * D4 + F5**2 * D5\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The total fuel consumption for all trucks must not exceed 1000 liters.\nmodel.addCons(F1 + F2 + F3 + F4 + F5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Fuel consumption of truck 1: \", model.getVal(F1))\n    print(\"Fuel consumption of truck 2: \", model.getVal(F2))\n    print(\"Fuel consumption of truck 3: \", model.getVal(F3))\n    print(\"Fuel consumption of truck 4: \", model.getVal(F4))\n    print(\"Fuel consumption of truck 5: \", model.getVal(F5))\n    print(\"Distance of truck 1: \", model.getVal(D1))\n    print(\"Distance of truck 2: \", model.getVal(D2))\n    print(\"Distance of truck 3: \", model.getVal(D3))\n    print(\"Distance of truck 4: \", model.getVal(D4))\n    print(\"Distance of truck 5: \", model.getVal(D5))\n    print(\"Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 10,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n// {\"amount of Product D produced\": \"ProductD\", \"range\": \"ProductD >= 0\", \"type\": \"real\"}\n// {\"amount of Product E produced\": \"ProductE\", \"range\": \"ProductE >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, with a carbon emission of 10 kg per unit.\nThe profit per unit of Product B is $70, with a carbon emission of 15 kg per unit.\nThe profit per unit of Product C is $60, with a carbon emission of 12 kg per unit.\nThe profit per unit of Product D is $80, with a carbon emission of 20 kg per unit.\nThe profit per unit of Product E is $90, with a carbon emission of 25 kg per unit.\nThe company wants to maximize the Profit-Carbon ratio of the production. (The Profit-Carbon ratio is defined as the total profit divided by the total carbon emissions.)\n// total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\n// total carbon emissions: Carbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n// So, the objective function is: Maximize Profit / Carbon\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1500 units across all products.\n// ProductA + ProductB + ProductC + ProductD + ProductE <= 1500\n\n## Generate Constraint-2:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200\n\n## Generate Constraint-3:\nThe total carbon emissions must not exceed 20,000 kg.\n// 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000\n\n## Generate Constraint-4:\nNo more than 500 units of any single product can be produced.\n// ProductA <= 500\n// ProductB <= 500\n// ProductC <= 500\n// ProductD <= 500\n// ProductE <= 500",
        "question": "A company is planning to optimize its production of five different products (Product A, Product B, Product C, Product D, and Product E) to maximize profit while considering the environmental impact of production. The profit per unit and the carbon emission per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Carbon Emission per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 10 kg                    |\n| B       | $70             | 15 kg                    |\n| C       | $60             | 12 kg                    |\n| D       | $80             | 20 kg                    |\n| E       | $90             | 25 kg                    |\n\nThe company has a total production capacity of 1500 units across all products. The company must produce at least 200 units of Product A. The total carbon emissions must not exceed 20,000 kg. No more than 500 units of any single product can be produced.\n\nPlease help the company to maximize the Profit-Carbon ratio of the production (defined as the total profit divided by the total carbon emissions).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\nProductD = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductD\", lb=0) # amount of Product D produced\nProductE = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductE\", lb=0) # amount of Product E produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC + 80 * ProductD + 90 * ProductE\nCarbon = 10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE\n## the objective function is: Maximize Profit / Carbon\n## convert the division to multiplication\nmodel.addCons(obj * Carbon == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1500 units across all products.\nmodel.addCons(ProductA + ProductB + ProductC + ProductD + ProductE <= 1500)\n## The company must produce at least 200 units of Product A.\nmodel.addCons(ProductA >= 200)\n## The total carbon emissions must not exceed 20,000 kg.\nmodel.addCons(10 * ProductA + 15 * ProductB + 12 * ProductC + 20 * ProductD + 25 * ProductE <= 20000)\n## No more than 500 units of any single product can be produced.\nmodel.addCons(ProductA <= 500)\nmodel.addCons(ProductB <= 500)\nmodel.addCons(ProductC <= 500)\nmodel.addCons(ProductD <= 500)\nmodel.addCons(ProductE <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Amount of Product D: \", model.getVal(ProductD))\n    print(\"Amount of Product E: \", model.getVal(ProductE))\n    print(\"Maximized Profit-Carbon Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which is $500,000. The cost per unit for DeviceA is $20, for DeviceB is $30, for DeviceC is $40, for DeviceD is $25, and for DeviceE is $35.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500,000",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit and the cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Cost per Unit |\n|--------|-----------------|---------------|\n| DeviceA | $50            | $20           |\n| DeviceB | $70            | $30           |\n| DeviceC | $90            | $40           |\n| DeviceD | $60            | $25           |\n| DeviceE | $80            | $35           |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to supplier agreements, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget constraint for raw materials, which is $500,000. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0)\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0)\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction + 25 * DeviceDProduction + 35 * DeviceEProduction <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip.\n// {\"number of trips for TruckA\": \"TripsA\", \"range\": \"TripsA >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckB\": \"TripsB\", \"range\": \"TripsB >= 0\", \"type\": \"integer\"}\n// {\"number of trips for TruckC\": \"TripsC\", \"range\": \"TripsC >= 0\", \"type\": \"integer\"}\n// {\"investment in fuel-efficient upgrades for TruckA\": \"UpgradeA\", \"range\": \"UpgradeA >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckB\": \"UpgradeB\", \"range\": \"UpgradeB >= 0\", \"type\": \"continuous\"}\n// {\"investment in fuel-efficient upgrades for TruckC\": \"UpgradeC\", \"range\": \"UpgradeC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe fuel efficiency of each vehicle improves with the investment in upgrades. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n// Fuel cost per trip for TruckA: CostA = (50 - 0.02 * UpgradeA) * TripsA\n// Fuel cost per trip for TruckB: CostB = (60 - 0.03 * UpgradeB) * TripsB\n// Fuel cost per trip for TruckC: CostC = (70 - 0.04 * UpgradeC) * TripsC\n// So, the objective function is: Minimize (CostA + CostB + CostC)\n\n## Generate Constraint-1:\nThe company has a total budget of $30,000 for transportation and upgrades.\n// 50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000\n\n## Generate Constraint-2:\nThe total number of trips across all vehicles must not exceed 2,000.\n// TripsA + TripsB + TripsC <= 2000",
        "question": "A logistics company manages the transportation of goods using three types of vehicles: TruckA, TruckB, and TruckC. The company needs to decide how many trips each vehicle should make in the next quarter to optimize its operations. Additionally, the company is considering investing in fuel-efficient upgrades for each vehicle type, which will reduce fuel consumption per trip. The fuel cost per trip decreases by $2 for every $100 invested in upgrades for TruckA, by $3 for every $100 invested in upgrades for TruckB, and by $4 for every $100 invested in upgrades for TruckC. The company aims to minimize the total fuel cost for all vehicles.\n\n| Vehicle | Fuel Cost per Trip (without upgrades) |\n|---------|--------------------------------------|\n| TruckA  | 50$                                  |\n| TruckB  | 60$                                  |\n| TruckC  | 70$                                  |\n\nThe company has a total budget of $30,000 for transportation and upgrades. The total number of trips across all vehicles must not exceed 2,000.\n\nPlease help the company determine the optimal number of trips for each vehicle and the amount to invest in fuel-efficient upgrades to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTripsA = model.addVar(vtype=\"INTEGER\", name=\"TripsA\", lb=0) # number of trips for TruckA\nTripsB = model.addVar(vtype=\"INTEGER\", name=\"TripsB\", lb=0) # number of trips for TruckB\nTripsC = model.addVar(vtype=\"INTEGER\", name=\"TripsC\", lb=0) # number of trips for TruckC\nUpgradeA = model.addVar(name=\"UpgradeA\", lb=0) # investment in fuel-efficient upgrades for TruckA\nUpgradeB = model.addVar(name=\"UpgradeB\", lb=0) # investment in fuel-efficient upgrades for TruckB\nUpgradeC = model.addVar(name=\"UpgradeC\", lb=0) # investment in fuel-efficient upgrades for TruckC\n\n# Define objective function\nCostA = (50 - 0.02 * UpgradeA) * TripsA\nCostB = (60 - 0.03 * UpgradeB) * TripsB\nCostC = (70 - 0.04 * UpgradeC) * TripsC\n# So, the objective function is: Minimize (CostA + CostB + CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == CostA + CostB + CostC)\n\n# Add constraints\n# The company has a total budget of $30,000 for transportation and upgrades.\nmodel.addCons(50 * TripsA + 60 * TripsB + 70 * TripsC + UpgradeA + UpgradeB + UpgradeC <= 30000)\n# The total number of trips across all vehicles must not exceed 2,000.\nmodel.addCons(TripsA + TripsB + TripsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trips for TruckA: \", model.getVal(TripsA))\n    print(\"Number of Trips for TruckB: \", model.getVal(TripsB))\n    print(\"Number of Trips for TruckC: \", model.getVal(TripsC))\n    print(\"Investment in Upgrade for TruckA: \", model.getVal(UpgradeA))\n    print(\"Investment in Upgrade for TruckB: \", model.getVal(UpgradeB))\n    print(\"Investment in Upgrade for TruckC: \", model.getVal(UpgradeC))\n    print(\"Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the cost of raw materials and the time required for production.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of product D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a production time of 1 hour. Product B sells for $70, with a raw material cost of $30 and a production time of 2 hours. Product C sells for $90, with a raw material cost of $40 and a production time of 3 hours. Product D sells for $110, with a raw material cost of $50 and a production time of 4 hours. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20) * A\n// Profit of product B: Profit_B = (70 - 30) * B\n// Profit of product C: Profit_C = (90 - 40) * C\n// Profit of product D: Profit_D = (110 - 50) * D\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C + 50 * D <= 10000\n\n## Generate Constraint-2:\nThe total production time cannot exceed 500 hours.\n// 1 * A + 2 * B + 3 * C + 4 * D <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of product A and 30 units of product B.\n// A >= 50; B >= 30\n\n## Generate Constraint-4:\nThe production of product C must be at least twice the production of product A.\n// C >= 2 * A",
        "question": "A manufacturing company produces four types of products: A, B, C, and D. The company needs to determine the production quantity of each product to optimize its profit while considering the cost of raw materials and the time required for production. The selling price of product A is $50, with a raw material cost of $20 and a production time of 1 hour. Product B sells for $70, with a raw material cost of $30 and a production time of 2 hours. Product C sells for $90, with a raw material cost of $40 and a production time of 3 hours. Product D sells for $110, with a raw material cost of $50 and a production time of 4 hours. The company has a budget of $10,000 for raw materials. The total production time cannot exceed 500 hours. The company must produce at least 50 units of product A and 30 units of product B. The production of product C must be at least twice the production of product A. Please help the company to maximize the total profit, which is the sum of the profits from each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # quantity of product D\n\n# Define objective function\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nProfit_D = (110 - 50) * D\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C + 50 * D <= 10000)\n# The total production time cannot exceed 500 hours.\nmodel.addCons(1 * A + 2 * B + 3 * C + 4 * D <= 500)\n# The company must produce at least 50 units of product A and 30 units of product B.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 30)\n# The production of product C must be at least twice the production of product A.\nmodel.addCons(C >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Quantity of Product D: \", model.getVal(D))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity.\n// {\"number of trucks of type A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of trucks of type E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and cargo capacity. \n- Truck A consumes 10 liters per 100 km and can carry 10 tons.\n- Truck B consumes 15 liters per 100 km and can carry 15 tons.\n- Truck C consumes 20 liters per 100 km and can carry 20 tons.\n- Truck D consumes 25 liters per 100 km and can carry 25 tons.\n- Truck E consumes 30 liters per 100 km and can carry 30 tons.\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons.\n// Fuel consumption of A: FC_A = 10 * A\n// Fuel consumption of B: FC_B = 15 * B\n// Fuel consumption of C: FC_C = 20 * C\n// Fuel consumption of D: FC_D = 25 * D\n// Fuel consumption of E: FC_E = 30 * E\n// So, the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / (A + B + C + D + E)\n\n## Generate Constraint-1:\nThe total cargo capacity must meet the demand of 1000 tons.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000",
        "question": "A logistics company operates a fleet of 5 different types of trucks: A, B, C, D, and E. The company needs to determine how many trucks of each type to deploy for the upcoming month to optimize fuel efficiency and delivery capacity. The fuel consumption and cargo capacity for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Consumption (liters/100 km) | Cargo Capacity (tons) |\n|------------|----------------------------------|----------------------|\n| A          | 10                               | 10                   |\n| B          | 15                               | 15                   |\n| C          | 20                               | 20                   |\n| D          | 25                               | 25                   |\n| E          | 30                               | 30                   |\n\nThe company aims to minimize the total fuel consumption while ensuring the total cargo capacity meets the demand of 1000 tons. Please help the company to determine the optimal number of trucks of each type to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of trucks of type A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of trucks of type B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of trucks of type C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of trucks of type D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of trucks of type E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFC_A = 10 * A\nFC_B = 15 * B\nFC_C = 20 * C\nFC_D = 25 * D\nFC_E = 30 * E\nTotalTrucks = A + B + C + D + E\n## the objective function is: Minimize (FC_A + FC_B + FC_C + FC_D + FC_E) / TotalTrucks\n## convert the division to multiplication\nmodel.addCons(obj * TotalTrucks == FC_A + FC_B + FC_C + FC_D + FC_E)\n\n# Add constraints\n## The total cargo capacity must meet the demand of 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks of Type A: \", model.getVal(A))\n    print(\"Number of Trucks of Type B: \", model.getVal(B))\n    print(\"Number of Trucks of Type C: \", model.getVal(C))\n    print(\"Number of Trucks of Type D: \", model.getVal(D))\n    print(\"Number of Trucks of Type E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"number of shifts\": \"NumShifts\", \"range\": \"NumShifts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n// Profit_A = 50 * ProductA\n// Profit_B = 70 * ProductB\n// Profit_C = 60 * ProductC\n// ShiftCost = 1000 * NumShifts\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\n\n## Generate Constraint-1:\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can only support up to 3 shifts per day.\n// NumShifts <= 3\n\n## Generate Constraint-3:\nDue to market demand, the production of product A must be at least twice the production of product B.\n// ProductA >= 2 * ProductB\n\n## Generate Constraint-4:\nThe company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day.\n// 50 * ProductA + 70 * ProductB + 60 * ProductC + 1000 * NumShifts <= 5000\n\n## Generate Constraint-5:\nTo maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\n// ProductC <= ProductA + ProductB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to maximize profit. Additionally, the company must decide on the number of shifts to operate in its factory to meet production demands. The profit per unit of product A is $50, product B is $70, and product C is $60. The cost of operating an additional shift is $1000. The company aims to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\nThe factory has a maximum capacity of 1000 units per day, regardless of the number of shifts. The company has a limited workforce that can only support up to 3 shifts per day. Due to market demand, the production of product A must be at least twice the production of product B. The company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day. To maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\nPlease help the company to maximize its total profit, considering both the revenue from product sales and the cost of operating shifts.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nNumShifts = model.addVar(vtype=\"INTEGER\", name=\"NumShifts\", lb=0) # number of shifts\n\n# Define objective function\nProfit_A = 50 * ProductA\nProfit_B = 70 * ProductB\nProfit_C = 60 * ProductC\nShiftCost = 1000 * NumShifts\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - ShiftCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C - ShiftCost)\n\n# Add constraints\n# The factory has a maximum capacity of 1000 units per day, regardless of the number of shifts.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The company has a limited workforce that can only support up to 3 shifts per day.\nmodel.addCons(NumShifts <= 3)\n# Due to market demand, the production of product A must be at least twice the production of product B.\nmodel.addCons(ProductA >= 2 * ProductB)\n# The company has a budget constraint that limits the total cost of production, including shift operations, to $5000 per day.\nmodel.addCons(50 * ProductA + 70 * ProductB + 60 * ProductC + 1000 * NumShifts <= 5000)\n# To maintain a balanced product portfolio, the production of product C must not exceed the combined production of products A and B.\nmodel.addCons(ProductC <= ProductA + ProductB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Number of Shifts: \", model.getVal(NumShifts))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles (A, B, C, D, and E) to transport goods. Each vehicle has a different capacity and operating cost.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a capacity of 10 tons, an operating cost of $50 per day, and a fuel efficiency of 5 km/l.\nVehicle B has a capacity of 15 tons, an operating cost of $70 per day, and a fuel efficiency of 7 km/l.\nVehicle C has a capacity of 20 tons, an operating cost of $90 per day, and a fuel efficiency of 9 km/l.\nVehicle D has a capacity of 25 tons, an operating cost of $110 per day, and a fuel efficiency of 11 km/l.\nVehicle E has a capacity of 30 tons, an operating cost of $130 per day, and a fuel efficiency of 13 km/l.\nThe company wants to minimize the cost per ton-kilometer (defined as the total operating cost divided by the total ton-kilometers transported).\n// Total operating cost: Cost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\n// Total ton-kilometers: TonKM = (10 * 5 * A + 15 * 7 * B + 20 * 9 * C + 25 * 11 * D + 30 * 13 * E) / 1000 (converted to thousands for simplification)\n// So, the objective function is: Minimize Cost / TonKM\n\n## Generate Constraint-1:\nThe total daily budget for operating costs is $10,000.\n// 50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000\n\n## Generate Constraint-2:\nThe company must transport at least 1000 tons per day.\n// 10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000\n\n## Generate Constraint-3:\nThe number of vehicles of type A must not exceed the number of vehicles of type B.\n// A <= B\n\n## Generate Constraint-4:\nThe total number of vehicles must not exceed 200.\n// A + B + C + D + E <= 200",
        "question": "A logistics company operates five different types of vehicles (A, B, C, D, and E) to transport goods. Each vehicle has a different capacity, operating cost, and fuel efficiency. The details for each vehicle are given in the following Table.\n\n| Vehicle | Capacity (tons) | Operating Cost ($/day) | Fuel Efficiency (km/l) |\n|---------|-----------------|------------------------|-----------------------|\n| A       | 10              | 50                     | 5                     |\n| B       | 15              | 70                     | 7                     |\n| C       | 20              | 90                     | 9                     |\n| D       | 25              | 110                    | 11                    |\n| E       | 30              | 130                    | 13                    |\n\nThe company wants to minimize the cost per ton-kilometer (defined as the total operating cost divided by the total ton-kilometers transported). The total daily budget for operating costs is $10,000. The company must transport at least 1000 tons per day. The number of vehicles of type A must not exceed the number of vehicles of type B. The total number of vehicles must not exceed 200.\n\nPlease help the company determine the optimal number of each type of vehicle to operate to achieve this objective.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of vehicles D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of vehicles E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * A + 70 * B + 90 * C + 110 * D + 130 * E\nTonKM = (10 * 5 * A + 15 * 7 * B + 20 * 9 * C + 25 * 11 * D + 30 * 13 * E) / 1000\n## convert the division to multiplication\nmodel.addCons(obj * TonKM == Cost)\n\n# Add constraints\n## The total daily budget for operating costs is $10,000.\nmodel.addCons(50 * A + 70 * B + 90 * C + 110 * D + 130 * E <= 10000)\n## The company must transport at least 1000 tons per day.\nmodel.addCons(10 * A + 15 * B + 20 * C + 25 * D + 30 * E >= 1000)\n## The number of vehicles of type A must not exceed the number of vehicles of type B.\nmodel.addCons(A <= B)\n## The total number of vehicles must not exceed 200.\nmodel.addCons(A + B + C + D + E <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Number of Vehicles D: \", model.getVal(D))\n    print(\"Number of Vehicles E: \", model.getVal(E))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company can invest in upgrading the efficiency of each plant, which affects the energy output per hour of operation.\n// {\"hours of operation for Solar plant\": \"Hours_Solar\", \"range\": \"Hours_Solar >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Wind plant\": \"Hours_Wind\", \"range\": \"Hours_Wind >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for Hydro plant\": \"Hours_Hydro\", \"range\": \"Hours_Hydro >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency upgrade for Solar plant\": \"Efficiency_Solar\", \"range\": \"Efficiency_Solar >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Wind plant\": \"Efficiency_Wind\", \"range\": \"Efficiency_Wind >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency upgrade for Hydro plant\": \"Efficiency_Hydro\", \"range\": \"Efficiency_Hydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output per hour of each plant increases with the investment in efficiency upgrades. For the Solar plant, the initial output is 100 kWh per hour, and it increases by 5 kWh per hour for every $1000 invested in upgrades. For the Wind plant, the initial output is 120 kWh per hour, and it increases by 6 kWh per hour for every $1000 invested in upgrades. For the Hydro plant, the initial output is 150 kWh per hour, and it increases by 7 kWh per hour for every $1000 invested in upgrades. The company aims to maximize the total daily energy production from all plants.\n// Total energy output for Solar: Output_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\n// Total energy output for Wind: Output_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\n// Total energy output for Hydro: Output_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n// So, the objective function is: Maximize (Output_Solar + Output_Wind + Output_Hydro)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for daily operations and efficiency upgrades.\n// Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the amount to invest in efficiency upgrades for each plant to maximize energy production. The initial energy output per hour and the increase in output per hour for every $1000 invested in upgrades for each plant are given in the following Table.\n\n| Plant Type | Initial Output per Hour | Increase in Output per Hour for $1000 Investment |\n|------------|-------------------------|-------------------------------------------------|\n| Solar      | 100 kWh                 | 5 kWh                                           |\n| Wind       | 120 kWh                 | 6 kWh                                           |\n| Hydro      | 150 kWh                 | 7 kWh                                           |\n\nThe company has a budget of $100,000 for daily operations and efficiency upgrades. The company aims to maximize the total daily energy production from all plants. Please help the company determine the optimal number of hours each plant should operate and the investment in efficiency upgrades to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHours_Solar = model.addVar(vtype=\"INTEGER\", name=\"Hours_Solar\", lb=0)  # hours of operation for Solar plant\nHours_Wind = model.addVar(vtype=\"INTEGER\", name=\"Hours_Wind\", lb=0)  # hours of operation for Wind plant\nHours_Hydro = model.addVar(vtype=\"INTEGER\", name=\"Hours_Hydro\", lb=0)  # hours of operation for Hydro plant\nEfficiency_Solar = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Solar\", lb=0)  # investment in efficiency upgrade for Solar plant\nEfficiency_Wind = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Wind\", lb=0)  # investment in efficiency upgrade for Wind plant\nEfficiency_Hydro = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency_Hydro\", lb=0)  # investment in efficiency upgrade for Hydro plant\n\n# Define objective function\nOutput_Solar = (100 + 0.005 * Efficiency_Solar) * Hours_Solar\nOutput_Wind = (120 + 0.006 * Efficiency_Wind) * Hours_Wind\nOutput_Hydro = (150 + 0.007 * Efficiency_Hydro) * Hours_Hydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output_Solar + Output_Wind + Output_Hydro)\n\n# Add constraints\nmodel.addCons(Hours_Solar + Hours_Wind + Hours_Hydro + Efficiency_Solar + Efficiency_Wind + Efficiency_Hydro <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Solar plant: \", model.getVal(Hours_Solar))\n    print(\"Hours of operation for Wind plant: \", model.getVal(Hours_Wind))\n    print(\"Hours of operation for Hydro plant: \", model.getVal(Hours_Hydro))\n    print(\"Investment in efficiency upgrade for Solar plant: \", model.getVal(Efficiency_Solar))\n    print(\"Investment in efficiency upgrade for Wind plant: \", model.getVal(Efficiency_Wind))\n    print(\"Investment in efficiency upgrade for Hydro plant: \", model.getVal(Efficiency_Hydro))\n    print(\"Total daily energy production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Truck D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of Truck E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach type of truck has a different fuel efficiency and capacity. Truck A has a fuel efficiency of 5 km/liter and a capacity of 10 tons. Truck B has a fuel efficiency of 7 km/liter and a capacity of 12 tons. Truck C has a fuel efficiency of 9 km/liter and a capacity of 15 tons. Truck D has a fuel efficiency of 11 km/liter and a capacity of 18 tons. Truck E has a fuel efficiency of 13 km/liter and a capacity of 20 tons. The company aims to minimize the total fuel consumption while ensuring all trucks are utilized to their full capacity. The objective function is to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies.\n// Fuel_Consumption_A = A / 5\n// Fuel_Consumption_B = B / 7\n// Fuel_Consumption_C = C / 9\n// Fuel_Consumption_D = D / 11\n// Fuel_Consumption_E = E / 13\n// So, the objective function is: Minimize Fuel_Consumption_A + Fuel_Consumption_B + Fuel_Consumption_C + Fuel_Consumption_D + Fuel_Consumption_E\n\n## Generate Constraint-1:\nThe total cargo capacity required for the upcoming month is 1000 tons.\n// 10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km.\n// A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000\n\n## Generate Constraint-3:\nThe company has a limit on the total number of trucks it can deploy, which is 100 trucks.\n// A + B + C + D + E <= 100",
        "question": "A logistics company operates five different types of vehicles: Truck A, Truck B, Truck C, Truck D, and Truck E. The company needs to determine the optimal number of each type of truck to deploy for the upcoming month to maximize efficiency and minimize fuel consumption. Each type of truck has a different fuel efficiency and capacity. Truck A has a fuel efficiency of 5 km/liter and a capacity of 10 tons. Truck B has a fuel efficiency of 7 km/liter and a capacity of 12 tons. Truck C has a fuel efficiency of 9 km/liter and a capacity of 15 tons. Truck D has a fuel efficiency of 11 km/liter and a capacity of 18 tons. Truck E has a fuel efficiency of 13 km/liter and a capacity of 20 tons. The company aims to minimize the total fuel consumption while ensuring all trucks are utilized to their full capacity. The total cargo capacity required for the upcoming month is 1000 tons. The company has a budget constraint of $50,000 for purchasing fuel. The cost of fuel for Truck A is $1 per km, for Truck B is $0.8 per km, for Truck C is $0.7 per km, for Truck D is $0.6 per km, and for Truck E is $0.5 per km. The company has a limit on the total number of trucks it can deploy, which is 100 trucks. Please help the company to minimize the total fuel consumption, which is the sum of the product of the number of trucks and their respective fuel efficiencies.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of Truck D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of Truck E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_Consumption_A = A / 5\nFuel_Consumption_B = B / 7\nFuel_Consumption_C = C / 9\nFuel_Consumption_D = D / 11\nFuel_Consumption_E = E / 13\n## convert the division to multiplication\nmodel.addCons(obj == Fuel_Consumption_A * 5 + Fuel_Consumption_B * 7 + Fuel_Consumption_C * 9 + Fuel_Consumption_D * 11 + Fuel_Consumption_E * 13)\n\n# Add constraints\n## The total cargo capacity required for the upcoming month is 1000 tons.\nmodel.addCons(10 * A + 12 * B + 15 * C + 18 * D + 20 * E >= 1000)\n## The company has a budget constraint of $50,000 for purchasing fuel.\nmodel.addCons(A + 0.8 * B + 0.7 * C + 0.6 * D + 0.5 * E <= 50000)\n## The company has a limit on the total number of trucks it can deploy, which is 100 trucks.\nmodel.addCons(A + B + C + D + E <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Number of Truck D: \", model.getVal(D))\n    print(\"Number of Truck E: \", model.getVal(E))\n    print(\"Minimized Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1359,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product and the amount of resources (labor hours and raw materials) allocated to each product. The company also needs to determine the investment in automation technology to reduce the labor hours required per unit.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"labor hours per unit for ProductA\": \"LaborHoursA\", \"range\": \"LaborHoursA >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductB\": \"LaborHoursB\", \"range\": \"LaborHoursB >= 0\", \"type\": \"continuous\"}\n// {\"labor hours per unit for ProductC\": \"LaborHoursC\", \"range\": \"LaborHoursC >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\n// Total cost for ProductB: CostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\n// Total cost for ProductC: CostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\n// Total revenue for ProductA: RevenueA = 100 * UnitsA\n// Total revenue for ProductB: RevenueB = 150 * UnitsB\n// Total revenue for ProductC: RevenueC = 200 * UnitsC\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the month.\n// (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the number of units to produce for each product, the amount of resources (labor hours and raw materials) allocated to each product, and the investment in automation technology to reduce the labor hours required per unit. The cost of labor per hour is $20. The revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The labor hours required per unit decrease by 0.1 hour for every $10,000 invested in automation technology. The company aims to maximize the total profit from all products.\n\n| Product | Revenue per Unit |\n|---------|------------------|\n| ProductA | 100$             |\n| ProductB | 150$             |\n| ProductC | 200$             |\n\nThe company has a total of 10,000 labor hours available for the month. The total investment in automation technology cannot exceed $50,000.\n\nPlease help the company to determine the optimal number of units to produce for each product, the allocation of labor hours per unit, and the investment in automation technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\nLaborHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursA\", lb=0) # labor hours per unit for ProductA\nLaborHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursB\", lb=0) # labor hours per unit for ProductB\nLaborHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"LaborHoursC\", lb=0) # labor hours per unit for ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nCostA = 20 * (LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA\nCostB = 20 * (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB\nCostC = 20 * (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC\nRevenueA = 100 * UnitsA\nRevenueB = 150 * UnitsB\nRevenueC = 200 * UnitsC\n# So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n# Add constraints\n# The company has a total of 10,000 labor hours available for the month.\nmodel.addCons((LaborHoursA - 0.0001 * AutomationInvestment) * UnitsA + \n              (LaborHoursB - 0.0001 * AutomationInvestment) * UnitsB + \n              (LaborHoursC - 0.0001 * AutomationInvestment) * UnitsC <= 10000)\n# The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(AutomationInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Labor Hours per Unit for ProductA: \", model.getVal(LaborHoursA))\n    print(\"Labor Hours per Unit for ProductB: \", model.getVal(LaborHoursB))\n    print(\"Labor Hours per Unit for ProductC: \", model.getVal(LaborHoursC))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1139,
        "var_num": 7,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate.\n// {\"production quantity for ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"marketing budget for ProductA\": \"MarketingBudgetA\", \"range\": \"MarketingBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductB\": \"MarketingBudgetB\", \"range\": \"MarketingBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for ProductC\": \"MarketingBudgetC\", \"range\": \"MarketingBudgetC >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductA\": \"QualityControlA\", \"range\": \"QualityControlA >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductB\": \"QualityControlB\", \"range\": \"QualityControlB >= 0\", \"type\": \"continuous\"}\n// {\"quality control investment for ProductC\": \"QualityControlC\", \"range\": \"QualityControlC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue per unit of ProductA is $100, ProductB is $150, and ProductC is $200. The marketing budget increases the sales linearly at a rate of $5 per $1000 spent. The quality control investment reduces the defect rate by 1% for every $1000 invested. The initial defect rate is 5% for all products. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control).\n// Total revenue for ProductA: RevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\n// Total revenue for ProductB: RevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\n// Total revenue for ProductC: RevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\n// Total cost for ProductA: CostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\n// Total cost for ProductB: CostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\n// Total cost for ProductC: CostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\n// So, the objective function is: Maximize (RevenueA - CostA + RevenueB - CostB + RevenueC - CostC)\n\n## Generate Constraint-1:\nThe total budget for marketing and quality control cannot exceed $100,000.\n// MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000\n\n## Generate Constraint-2:\nThe company can produce a maximum of 1000 units of each product.\n// QuantityA <= 1000; QuantityB <= 1000; QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to decide the production quantity of each product, the marketing budget for each product, and the level of quality control investment for each product. The marketing budget affects the sales directly, and the quality control investment reduces the defect rate. The revenue per unit, production cost, and initial defect rate for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Initial Defect Rate |\n|---------|------------------|--------------------------|---------------------|\n| ProductA | $100            | $50                      | 5%                  |\n| ProductB | $150            | $75                      | 5%                  |\n| ProductC | $200            | $100                     | 5%                  |\n\nThe marketing budget increases the sales linearly at a rate of $5 per $1000 spent, and the quality control investment reduces the defect rate by 1% for every $1000 invested. The company aims to maximize the total profit, which is the total revenue minus the total cost (including production, marketing, and quality control). The total budget for marketing and quality control cannot exceed $100,000. The company can produce a maximum of 1000 units of each product.\n\nPlease help the company determine the optimal production quantity, marketing budget, and quality control investment for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ProductC\nMarketingBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetA\", lb=0) # marketing budget for ProductA\nMarketingBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetB\", lb=0) # marketing budget for ProductB\nMarketingBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudgetC\", lb=0) # marketing budget for ProductC\nQualityControlA = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlA\", lb=0) # quality control investment for ProductA\nQualityControlB = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlB\", lb=0) # quality control investment for ProductB\nQualityControlC = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControlC\", lb=0) # quality control investment for ProductC\n\n# Define objective function\nRevenueA = (100 * (1 - 0.05 + 0.0001 * QualityControlA)) * QuantityA\nRevenueB = (150 * (1 - 0.05 + 0.0001 * QualityControlB)) * QuantityB\nRevenueC = (200 * (1 - 0.05 + 0.0001 * QualityControlC)) * QuantityC\nCostA = (QuantityA * 50 + MarketingBudgetA + QualityControlA)\nCostB = (QuantityB * 75 + MarketingBudgetB + QualityControlB)\nCostC = (QuantityC * 100 + MarketingBudgetC + QualityControlC)\nTotalProfit = RevenueA - CostA + RevenueB - CostB + RevenueC - CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(MarketingBudgetA + MarketingBudgetB + MarketingBudgetC + QualityControlA + QualityControlB + QualityControlC <= 100000)\nmodel.addCons(QuantityA <= 1000)\nmodel.addCons(QuantityB <= 1000)\nmodel.addCons(QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Marketing Budget for ProductA: \", model.getVal(MarketingBudgetA))\n    print(\"Marketing Budget for ProductB: \", model.getVal(MarketingBudgetB))\n    print(\"Marketing Budget for ProductC: \", model.getVal(MarketingBudgetC))\n    print(\"Quality Control Investment for ProductA: \", model.getVal(QualityControlA))\n    print(\"Quality Control Investment for ProductB: \", model.getVal(QualityControlB))\n    print(\"Quality Control Investment for ProductC: \", model.getVal(QualityControlC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1515,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation.\n// {\"number of type 1 trucks\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of type 2 trucks\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of type 3 trucks\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n// {\"number of type 4 trucks\": \"T4\", \"range\": \"T4 >= 0\", \"type\": \"integer\"}\n// {\"number of type 5 trucks\": \"T5\", \"range\": \"T5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The company needs to minimize the total operational cost of the fleet.\n// Total operational cost: Cost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total capacity of all trucks must meet the daily demand of 1000 tons.\n// 10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000\n\n## Generate Constraint-2:\nThe company has a budget to purchase at most 50 trucks in total.\n// T1 + T2 + T3 + T4 + T5 <= 50\n\n## Generate Constraint-3:\nThe number of type 1 trucks must not exceed 20% of the total number of trucks.\n// T1 <= 0.2 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-4:\nThe number of type 5 trucks must be at least 10% of the total number of trucks.\n// T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5)\n\n## Generate Constraint-5:\nThe company must have at least 5 type 3 trucks.\n// T3 >= 5",
        "question": "A logistics company operates a fleet of 5 different types of trucks to transport goods. Each type of truck has different capacities and operational costs. The company needs to determine the optimal number of each type of truck to minimize operational costs while meeting the demand for transportation. The operational cost per kilometer for type 1 trucks is $2, for type 2 trucks is $3, for type 3 trucks is $4, for type 4 trucks is $5, and for type 5 trucks is $6. The total capacity of all trucks must meet the daily demand of 1000 tons. The company has a budget to purchase at most 50 trucks in total. The number of type 1 trucks must not exceed 20% of the total number of trucks. The number of type 5 trucks must be at least 10% of the total number of trucks. The company must have at least 5 type 3 trucks. Please help the company to minimize the total operational cost of the fleet.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of type 1 trucks\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of type 2 trucks\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of type 3 trucks\nT4 = model.addVar(vtype=\"INTEGER\", name=\"T4\", lb=0) # number of type 4 trucks\nT5 = model.addVar(vtype=\"INTEGER\", name=\"T5\", lb=0) # number of type 5 trucks\n\n# Define objective function\nCost = 2 * T1 + 3 * T2 + 4 * T3 + 5 * T4 + 6 * T5\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# The total capacity of all trucks must meet the daily demand of 1000 tons.\nmodel.addCons(10 * T1 + 20 * T2 + 30 * T3 + 40 * T4 + 50 * T5 >= 1000)\n# The company has a budget to purchase at most 50 trucks in total.\nmodel.addCons(T1 + T2 + T3 + T4 + T5 <= 50)\n# The number of type 1 trucks must not exceed 20% of the total number of trucks.\nmodel.addCons(T1 <= 0.2 * (T1 + T2 + T3 + T4 + T5))\n# The number of type 5 trucks must be at least 10% of the total number of trucks.\nmodel.addCons(T5 >= 0.1 * (T1 + T2 + T3 + T4 + T5))\n# The company must have at least 5 type 3 trucks.\nmodel.addCons(T3 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Type 1 Trucks: \", model.getVal(T1))\n    print(\"Number of Type 2 Trucks: \", model.getVal(T2))\n    print(\"Number of Type 3 Trucks: \", model.getVal(T3))\n    print(\"Number of Type 4 Trucks: \", model.getVal(T4))\n    print(\"Number of Type 5 Trucks: \", model.getVal(T5))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceD\": \"DeviceDProduction\", \"range\": \"DeviceDProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceE\": \"DeviceEProduction\", \"range\": \"DeviceEProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, for DeviceC is $90, for DeviceD is $60, and for DeviceE is $80. The company wants to maximize the total profit from all devices.\n// Total profit for DeviceA: Profit_DeviceA = 50 * DeviceAProduction\n// Total profit for DeviceB: Profit_DeviceB = 70 * DeviceBProduction\n// Total profit for DeviceC: Profit_DeviceC = 90 * DeviceCProduction\n// Total profit for DeviceD: Profit_DeviceD = 60 * DeviceDProduction\n// Total profit for DeviceE: Profit_DeviceE = 80 * DeviceEProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for all devices combined.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10,000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\n// DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction)\n\n## Generate Constraint-3:\nThe production of DeviceA must be at least twice the production of DeviceB.\n// DeviceAProduction >= 2 * DeviceBProduction",
        "question": "A manufacturing company is planning to produce five different types of electronic devices: DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE. They need to determine the production quantity for each device to maximize profit while considering various constraints. The profit per unit for each device is as follows:\n\n| Device    | Profit per Unit |\n|-----------|-----------------|\n| DeviceA   | $50             |\n| DeviceB   | $70             |\n| DeviceC   | $90             |\n| DeviceD   | $60             |\n| DeviceE   | $80             |\n\nThe company has a total production capacity of 10,000 units for all devices combined. Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production. The production of DeviceA must be at least twice the production of DeviceB.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\nDeviceDProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceDProduction\", lb=0) # production quantity for DeviceD\nDeviceEProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceEProduction\", lb=0) # production quantity for DeviceE\n\n# Define objective function\nProfit_DeviceA = 50 * DeviceAProduction\nProfit_DeviceB = 70 * DeviceBProduction\nProfit_DeviceC = 90 * DeviceCProduction\nProfit_DeviceD = 60 * DeviceDProduction\nProfit_DeviceE = 80 * DeviceEProduction\n# So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC + Profit_DeviceD + Profit_DeviceE)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for all devices combined.\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction <= 10000)\n# Due to resource limitations, the production of DeviceC cannot exceed 30% of the total production.\nmodel.addCons(DeviceCProduction <= 0.3 * (DeviceAProduction + DeviceBProduction + DeviceCProduction + DeviceDProduction + DeviceEProduction))\n# The production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(DeviceAProduction >= 2 * DeviceBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Production Quantity for DeviceD: \", model.getVal(DeviceDProduction))\n    print(\"Production Quantity for DeviceE: \", model.getVal(DeviceEProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability.\n// {\"number of units of DeviceA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceD\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor DeviceA, the selling price is $100, the production cost is $60, and the storage cost per unit per month is $5.\nFor DeviceB, the selling price is $150, the production cost is $90, and the storage cost per unit per month is $7.\nFor DeviceC, the selling price is $200, the production cost is $120, and the storage cost per unit per month is $9.\nFor DeviceD, the selling price is $250, the production cost is $150, and the storage cost per unit per month is $11.\nThe company aims to maximize the total profit, which is the sum of the selling price minus the production cost and the storage cost.\n// Profit of DeviceA: Profit_A = (100 - 60 - 5 * T) * A\n// Profit of DeviceB: Profit_B = (150 - 90 - 7 * T) * B\n// Profit of DeviceC: Profit_C = (200 - 120 - 9 * T) * C\n// Profit of DeviceD: Profit_D = (250 - 150 - 11 * T) * D\n// Objective function: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\n\n## Generate Constraint-1:\nThe total production capacity for the month is 500 units.\n// A + B + C + D <= 500\n\n## Generate Constraint-2:\nThe market demand for DeviceA is at least 50 units and for DeviceB is at least 30 units.\n// A >= 50; B >= 30\n\n## Generate Constraint-3:\nThe company has a limited budget for production costs, which is $30,000.\n// 60 * A + 90 * B + 120 * C + 150 * D <= 30,000\n\n## Generate Constraint-4:\nThe storage capacity for the month is 400 units.\n// A + B + C + D <= 400\n\n## Generate Constraint-5:\nThe production of DeviceC should not exceed twice the production of DeviceA.\n// C <= 2 * A",
        "question": "A manufacturing company produces four types of electronic devices: DeviceA, DeviceB, DeviceC, and DeviceD. The company needs to determine the optimal production quantity for each device to maximize profit while considering various constraints such as production capacity, market demand, and resource availability. The selling price, production cost, and storage cost per unit per month for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Storage Cost per Unit per Month |\n|--------|---------------|-----------------|---------------------------------|\n| DeviceA | $100          | $60             | $5                              |\n| DeviceB | $150          | $90             | $7                              |\n| DeviceC | $200          | $120            | $9                              |\n| DeviceD | $250          | $150            | $11                             |\n\nThe company aims to maximize the total profit, which is the sum of the selling price minus the production cost and the storage cost. The company has the following constraints:\n1. The total production capacity for the month is 500 units.\n2. The market demand for DeviceA is at least 50 units and for DeviceB is at least 30 units.\n3. The company has a limited budget for production costs, which is $30,000.\n4. The storage capacity for the month is 400 units.\n5. The production of DeviceC should not exceed twice the production of DeviceA.\n\nPlease help the company determine the optimal production quantity for each device to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of DeviceA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of DeviceB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of DeviceC\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=0) # number of units of DeviceD\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60 - 5 * 1) * A # assuming T = 1 month\nProfit_B = (150 - 90 - 7 * 1) * B # assuming T = 1 month\nProfit_C = (200 - 120 - 9 * 1) * C # assuming T = 1 month\nProfit_D = (250 - 150 - 11 * 1) * D # assuming T = 1 month\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C + Profit_D)\n\n# Add constraints\n## The total production capacity for the month is 500 units.\nmodel.addCons(A + B + C + D <= 500)\n## The market demand for DeviceA is at least 50 units and for DeviceB is at least 30 units.\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 30)\n## The company has a limited budget for production costs, which is $30,000.\nmodel.addCons(60 * A + 90 * B + 120 * C + 150 * D <= 30000)\n## The storage capacity for the month is 400 units.\nmodel.addCons(A + B + C + D <= 400)\n## The production of DeviceC should not exceed twice the production of DeviceA.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(A))\n    print(\"Number of DeviceB: \", model.getVal(B))\n    print(\"Number of DeviceC: \", model.getVal(C))\n    print(\"Number of DeviceD: \", model.getVal(D))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1591,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs.\n// {\"number of solar panels in Zone1\": \"Zone1\", \"range\": \"Zone1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone2\": \"Zone2\", \"range\": \"Zone2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone3\": \"Zone3\", \"range\": \"Zone3 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone4\": \"Zone4\", \"range\": \"Zone4 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in Zone5\": \"Zone5\", \"range\": \"Zone5 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels in Zone1 is 80%, with a cost of $100 per panel.\nIn Zone2, the efficiency is 85%, with a cost of $120 per panel.\nIn Zone3, the efficiency is 90%, with a cost of $140 per panel.\nIn Zone4, the efficiency is 95%, with a cost of $160 per panel.\nIn Zone5, the efficiency is 100%, with a cost of $180 per panel.\nThe city aims to maximize the energy production per dollar spent.\n// Energy_Production = 80% * Zone1 * 100 + 85% * Zone2 * 120 + 90% * Zone3 * 140 + 95% * Zone4 * 160 + 100% * Zone5 * 180\n// Total_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n// So, the objective function is: Maximize Energy_Production / Total_Cost\n\n## Generate Constraint-1:\nThe city has a budget of $100,000 for the installation of solar panels.\n// 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000\n\n## Generate Constraint-2:\nEach zone has a limited space for installing solar panels, with Zone1 having space for 500 panels, Zone2 for 400 panels, Zone3 for 300 panels, Zone4 for 200 panels, and Zone5 for 100 panels.\n// Zone1 <= 500\n// Zone2 <= 400\n// Zone3 <= 300\n// Zone4 <= 200\n// Zone5 <= 100\n\n## Generate Constraint-3:\nThe city aims to install at least 1000 solar panels in total across all zones.\n// Zone1 + Zone2 + Zone3 + Zone4 + Zone5 >= 1000\n\n## Generate Constraint-4:\nThe city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone1.\n// 100 * Zone1 >= 0.2 * 100000\n\n## Generate Constraint-5:\nThe city has a policy to not install more than 30% of the total number of panels in any single zone.\n// Zone1 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5)\n// Zone2 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5)\n// Zone3 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5)\n// Zone4 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5)\n// Zone5 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5)",
        "question": "A city is planning to install solar panels on rooftops across different zones (Zone1, Zone2, Zone3, Zone4, and Zone5) to optimize energy production and minimize costs. The efficiency of solar panels in Zone1 is 80%, with a cost of $100 per panel. In Zone2, the efficiency is 85%, with a cost of $120 per panel. In Zone3, the efficiency is 90%, with a cost of $140 per panel. In Zone4, the efficiency is 95%, with a cost of $160 per panel. In Zone5, the efficiency is 100%, with a cost of $180 per panel. The city has a budget of $100,000 for the installation of solar panels. Each zone has a limited space for installing solar panels, with Zone1 having space for 500 panels, Zone2 for 400 panels, Zone3 for 300 panels, Zone4 for 200 panels, and Zone5 for 100 panels. The city aims to install at least 1000 solar panels in total across all zones. The city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone1. The city also has a policy to not install more than 30% of the total number of panels in any single zone. Please help the city to maximize the energy production per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nZone1 = model.addVar(vtype=\"INTEGER\", name=\"Zone1\", lb=0)\nZone2 = model.addVar(vtype=\"INTEGER\", name=\"Zone2\", lb=0)\nZone3 = model.addVar(vtype=\"INTEGER\", name=\"Zone3\", lb=0)\nZone4 = model.addVar(vtype=\"INTEGER\", name=\"Zone4\", lb=0)\nZone5 = model.addVar(vtype=\"INTEGER\", name=\"Zone5\", lb=0)\n\n# Define objective function\nEnergy_Production = 0.8 * Zone1 * 100 + 0.85 * Zone2 * 120 + 0.9 * Zone3 * 140 + 0.95 * Zone4 * 160 + 1.0 * Zone5 * 180\nTotal_Cost = 100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5\n# Maximize Energy_Production / Total_Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * Total_Cost == Energy_Production)\n\n# Add constraints\n# The city has a budget of $100,000 for the installation of solar panels.\nmodel.addCons(100 * Zone1 + 120 * Zone2 + 140 * Zone3 + 160 * Zone4 + 180 * Zone5 <= 100000)\n# Each zone has a limited space for installing solar panels\nmodel.addCons(Zone1 <= 500)\nmodel.addCons(Zone2 <= 400)\nmodel.addCons(Zone3 <= 300)\nmodel.addCons(Zone4 <= 200)\nmodel.addCons(Zone5 <= 100)\n# The city aims to install at least 1000 solar panels in total across all zones.\nmodel.addCons(Zone1 + Zone2 + Zone3 + Zone4 + Zone5 >= 1000)\n# The city wants to ensure that at least 20% of the total budget is spent on solar panels in Zone1.\nmodel.addCons(100 * Zone1 >= 0.2 * 100000)\n# The city has a policy to not install more than 30% of the total number of panels in any single zone.\nmodel.addCons(Zone1 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5))\nmodel.addCons(Zone2 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5))\nmodel.addCons(Zone3 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5))\nmodel.addCons(Zone4 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5))\nmodel.addCons(Zone5 <= 0.3 * (Zone1 + Zone2 + Zone3 + Zone4 + Zone5))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Zone1: \", model.getVal(Zone1))\n    print(\"Number of Solar Panels in Zone2: \", model.getVal(Zone2))\n    print(\"Number of Solar Panels in Zone3: \", model.getVal(Zone3))\n    print(\"Number of Solar Panels in Zone4: \", model.getVal(Zone4))\n    print(\"Number of Solar Panels in Zone5: \", model.getVal(Zone5))\n    print(\"Maximized Energy Production per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the available resources and market demand. The production quantity for each product is a decision variable.\n// {\"production quantity for ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company aims to maximize the total net profit from all products.\n// NetProfit_ProductA = ProductA * (50 - 30)\n// NetProfit_ProductB = ProductB * (70 - 40)\n// NetProfit_ProductC = ProductC * (60 - 35)\n// So, the objective function is: Maximize (NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per day.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nThe market demand for ProductA is at least 200 units per day.\n// ProductA >= 200\n\n## Generate Constraint-3:\nThe market demand for ProductB is at most 300 units per day.\n// ProductB <= 300\n\n## Generate Constraint-4:\nThe company has a limited budget for raw materials, which restricts the total production cost to $30,000 per day.\n// 30 * ProductA + 40 * ProductB + 35 * ProductC <= 30000\n\n## Generate Constraint-5:\nDue to a strategic partnership, the production of ProductC must be at least half of the combined production of ProductA and ProductB.\n// ProductC >= 0.5 * (ProductA + ProductB)",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the optimal production quantity for each product to maximize profit while considering the available resources and market demand. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $60. The production cost per unit for ProductA is $30, for ProductB is $40, and for ProductC is $35. The company has a total production capacity of 1000 units per day. The market demand for ProductA is at least 200 units per day. The market demand for ProductB is at most 300 units per day. The company has a limited budget for raw materials, which restricts the total production cost to $30,000 per day. Due to a strategic partnership, the production of ProductC must be at least half of the combined production of ProductA and ProductB. Please help the company to maximize the total net profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity for ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity for ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity for ProductC\n\n# Define objective function\nNetProfit_ProductA = ProductA * (50 - 30)\nNetProfit_ProductB = ProductB * (70 - 40)\nNetProfit_ProductC = ProductC * (60 - 35)\n# So, the objective function is: Maximize (NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_ProductA + NetProfit_ProductB + NetProfit_ProductC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per day.\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n# The market demand for ProductA is at least 200 units per day.\nmodel.addCons(ProductA >= 200)\n# The market demand for ProductB is at most 300 units per day.\nmodel.addCons(ProductB <= 300)\n# The company has a limited budget for raw materials, which restricts the total production cost to $30,000 per day.\nmodel.addCons(30 * ProductA + 40 * ProductB + 35 * ProductC <= 30000)\n# Due to a strategic partnership, the production of ProductC must be at least half of the combined production of ProductA and ProductB.\nmodel.addCons(ProductC >= 0.5 * (ProductA + ProductB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate for production and marketing for each device.\n// {\"number of units for DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units for DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units for DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"production hours for DeviceA\": \"HoursProdA\", \"range\": \"HoursProdA >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceB\": \"HoursProdB\", \"range\": \"HoursProdB >= 0\", \"type\": \"real\"}\n// {\"production hours for DeviceC\": \"HoursProdC\", \"range\": \"HoursProdC >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceA\": \"HoursMarketA\", \"range\": \"HoursMarketA >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceB\": \"HoursMarketB\", \"range\": \"HoursMarketB >= 0\", \"type\": \"real\"}\n// {\"marketing hours for DeviceC\": \"HoursMarketC\", \"range\": \"HoursMarketC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $60. The production cost per hour is $20, and the marketing cost per hour is $30. The company wants to maximize the total profit, considering both production and marketing costs.\n// Total profit for DeviceA: Profit_A = (50 * UnitsA) - (20 * HoursProdA) - (30 * HoursMarketA)\n// Total profit for DeviceB: Profit_B = (70 * UnitsB) - (20 * HoursProdB) - (30 * HoursMarketB)\n// Total profit for DeviceC: Profit_C = (60 * UnitsC) - (20 * HoursProdC) - (30 * HoursMarketC)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total of 500 production hours available for the quarter.\n// HoursProdA + HoursProdB + HoursProdC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the number of units to produce for each device, as well as the number of hours to allocate for production and marketing for each device. The profit per unit for each device, the production cost per hour, and the marketing cost per hour are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Hour | Marketing Cost per Hour |\n|--------|-----------------|--------------------------|-------------------------|\n| DeviceA | $50 | $20 | $30 |\n| DeviceB | $70 | $20 | $30 |\n| DeviceC | $60 | $20 | $30 |\n\nThe company has a total of 500 production hours available for the quarter. The company wants to maximize the total profit, considering both production and marketing costs. Please help the company determine the optimal number of units and hours to allocate for each device to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units for DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units for DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units for DeviceC\nHoursProdA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdA\", lb=0)  # production hours for DeviceA\nHoursProdB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdB\", lb=0)  # production hours for DeviceB\nHoursProdC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursProdC\", lb=0)  # production hours for DeviceC\nHoursMarketA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketA\", lb=0)  # marketing hours for DeviceA\nHoursMarketB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketB\", lb=0)  # marketing hours for DeviceB\nHoursMarketC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursMarketC\", lb=0)  # marketing hours for DeviceC\n\n# Define objective function\nProfit_A = (50 * UnitsA) - (20 * HoursProdA) - (30 * HoursMarketA)\nProfit_B = (70 * UnitsB) - (20 * HoursProdB) - (30 * HoursMarketB)\nProfit_C = (60 * UnitsC) - (20 * HoursProdC) - (30 * HoursMarketC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(HoursProdA + HoursProdB + HoursProdC <= 500)  # Total production hours constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units for DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of Units for DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of Units for DeviceC: \", model.getVal(UnitsC))\n    print(\"Production Hours for DeviceA: \", model.getVal(HoursProdA))\n    print(\"Production Hours for DeviceB: \", model.getVal(HoursProdB))\n    print(\"Production Hours for DeviceC: \", model.getVal(HoursProdC))\n    print(\"Marketing Hours for DeviceA: \", model.getVal(HoursMarketA))\n    print(\"Marketing Hours for DeviceB: \", model.getVal(HoursMarketB))\n    print(\"Marketing Hours for DeviceC: \", model.getVal(HoursMarketC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily to maximize energy production. Additionally, the company needs to decide on the investment in research and development (R&D) for each type of plant to improve efficiency. The efficiency improvement is nonlinear and depends on the R&D investment.\n// {\"number of hours Solar plant operates\": \"HoursSolar\", \"range\": \"HoursSolar >= 0\", \"type\": \"integer\"}\n// {\"number of hours Wind plant operates\": \"HoursWind\", \"range\": \"HoursWind >= 0\", \"type\": \"integer\"}\n// {\"number of hours Hydro plant operates\": \"HoursHydro\", \"range\": \"HoursHydro >= 0\", \"type\": \"integer\"}\n// {\"R&D investment for Solar\": \"RDSolar\", \"range\": \"RDSolar >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Wind\": \"RDWind\", \"range\": \"RDWind >= 0\", \"type\": \"continuous\"}\n// {\"R&D investment for Hydro\": \"RDHydro\", \"range\": \"RDHydro >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy production efficiency of each plant increases with R&D investment. For Solar, every $1000 invested increases efficiency by 1% up to a maximum of 20%. For Wind, every $1000 invested increases efficiency by 1.5% up to a maximum of 25%. For Hydro, every $1000 invested increases efficiency by 0.8% up to a maximum of 15%. The company aims to maximize the total energy production.\n// EnergySolar = (1 + 0.001 * RDSolar) * HoursSolar\n// EnergyWind = (1 + 0.0015 * RDWind) * HoursWind\n// EnergyHydro = (1 + 0.0008 * RDHydro) * HoursHydro\n// So, the objective function is: Maximize (EnergySolar + EnergyWind + EnergyHydro)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for R&D investments.\n// RDSolar + RDWind + RDHydro <= 100000\n\n## Generate Constraint-2:\nThe total operating hours for all plants must not exceed 24 hours per day.\n// HoursSolar + HoursWind + HoursHydro <= 24\n\n## Generate Constraint-3:\nDue to environmental regulations, the Hydro plant cannot operate more than 8 hours per day.\n// HoursHydro <= 8\n\n## Generate Constraint-4:\nThe Solar plant must operate at least 2 hours per day to maintain equipment.\n// HoursSolar >= 2\n\n## Generate Constraint-5:\nThe Wind plant's R&D investment must not exceed $50,000.\n// RDWind <= 50000",
        "question": "A renewable energy company operates three types of power plants: Solar, Wind, and Hydro. The company needs to determine the number of hours each plant should operate daily and the investment in research and development (R&D) for each type of plant to maximize energy production. The efficiency of each plant increases with R&D investment. For Solar, every $1000 invested increases efficiency by 1% up to a maximum of 20%. For Wind, every $1000 invested increases efficiency by 1.5% up to a maximum of 25%. For Hydro, every $1000 invested increases efficiency by 0.8% up to a maximum of 15%. The company has a total budget of $100,000 for R&D investments. The total operating hours for all plants must not exceed 24 hours per day. Due to environmental regulations, the Hydro plant cannot operate more than 8 hours per day. The Solar plant must operate at least 2 hours per day to maintain equipment. The Wind plant's R&D investment must not exceed $50,000.\n\nPlease help the company to maximize the total energy production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursSolar = model.addVar(vtype=\"INTEGER\", name=\"HoursSolar\", lb=2)  # number of hours Solar plant operates\nHoursWind = model.addVar(vtype=\"INTEGER\", name=\"HoursWind\", lb=0)  # number of hours Wind plant operates\nHoursHydro = model.addVar(vtype=\"INTEGER\", name=\"HoursHydro\", lb=0)  # number of hours Hydro plant operates\nRDSolar = model.addVar(vtype=\"CONTINUOUS\", name=\"RDSolar\", lb=0)  # R&D investment for Solar\nRDWind = model.addVar(vtype=\"CONTINUOUS\", name=\"RDWind\", lb=0, ub=50000)  # R&D investment for Wind\nRDHydro = model.addVar(vtype=\"CONTINUOUS\", name=\"RDHydro\", lb=0)  # R&D investment for Hydro\n\n# Define objective function\nEnergySolar = (1 + 0.001 * RDSolar) * HoursSolar\nEnergyWind = (1 + 0.0015 * RDWind) * HoursWind\nEnergyHydro = (1 + 0.0008 * RDHydro) * HoursHydro\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EnergySolar + EnergyWind + EnergyHydro)\n\n# Add constraints\nmodel.addCons(RDSolar + RDWind + RDHydro <= 100000)  # Total budget for R&D investments\nmodel.addCons(HoursSolar + HoursWind + HoursHydro <= 24)  # Total operating hours for all plants\nmodel.addCons(HoursHydro <= 8)  # Environmental regulations for Hydro plant\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Solar plant: \", model.getVal(HoursSolar))\n    print(\"Hours of Wind plant: \", model.getVal(HoursWind))\n    print(\"Hours of Hydro plant: \", model.getVal(HoursHydro))\n    print(\"R&D Investment for Solar: \", model.getVal(RDSolar))\n    print(\"R&D Investment for Wind: \", model.getVal(RDWind))\n    print(\"R&D Investment for Hydro: \", model.getVal(RDHydro))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop D\": \"D\", \"range\": \"D >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop E\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $100, the water requirement is 5 units, and the labor requirement is 2 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 7 units, and the labor requirement is 3 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 9 units, and the labor requirement is 4 hours.\nFor Crop D, the expected profit per acre is $250, the water requirement is 11 units, and the labor requirement is 5 hours.\nFor Crop E, the expected profit per acre is $300, the water requirement is 13 units, and the labor requirement is 6 hours.\nThe farm aims to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).\n// Expected profit of A: Profit_A = 100 * A\n// Expected profit of B: Profit_B = 150 * B\n// Expected profit of C: Profit_C = 200 * C\n// Expected profit of D: Profit_D = 250 * D\n// Expected profit of E: Profit_E = 300 * E\n// Resource usage of A: Resource_A = 5 * A + 2 * A\n// Resource usage of B: Resource_B = 7 * B + 3 * B\n// Resource usage of C: Resource_C = 9 * C + 4 * C\n// Resource usage of D: Resource_D = 11 * D + 5 * D\n// Resource usage of E: Resource_E = 13 * E + 6 * E\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n\n## Generate Constraint-1:\nThe farm has a total of 1000 units of water available for the season.\n// 5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000\n\n## Generate Constraint-2:\nThe farm has a total of 400 hours of labor available for the season.\n// 2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400\n\n## Generate Constraint-3:\nThe farm wants to allocate at least 10 acres to each crop.\n// A >= 10; B >= 10; C >= 10; D >= 10; E >= 10",
        "question": "A farm grows five types of crops: A, B, C, D, and E. The farm needs to decide how many acres to allocate to each crop for the upcoming season. The expected profit per acre, water requirement, and labor requirement for each crop are given in the following Table.\n\n| Crop | Expected Profit per Acre | Water Requirement per Acre | Labor Requirement per Acre |\n|------|--------------------------|----------------------------|----------------------------|\n| A    | $100                     | 5 units                    | 2 hours                    |\n| B    | $150                     | 7 units                    | 3 hours                    |\n| C    | $200                     | 9 units                    | 4 hours                    |\n| D    | $250                     | 11 units                   | 5 hours                    |\n| E    | $300                     | 13 units                   | 6 hours                    |\n\nThe farm has a total of 1000 units of water available for the season. The farm also has a total of 400 hours of labor available for the season. The farm wants to allocate at least 10 acres to each crop. \n\nPlease help the farm to maximize the profit-to-resource ratio (defined as the total expected profit divided by the total resource usage, where resource usage is the sum of water and labor requirements).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 10 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\nD = model.addVar(vtype=\"INTEGER\", name=\"D\", lb=10) # number of acres for crop D\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=10) # number of acres for crop E\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nProfit_D = 250 * D\nProfit_E = 300 * E\nResource_A = 5 * A + 2 * A\nResource_B = 7 * B + 3 * B\nResource_C = 9 * C + 4 * C\nResource_D = 11 * D + 5 * D\nResource_E = 13 * E + 6 * E\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C + Profit_D + Profit_E) / (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C + Resource_D + Resource_E) == Profit_A + Profit_B + Profit_C + Profit_D + Profit_E)\n\n# Add constraints\n## The farm has a total of 1000 units of water available for the season.\nmodel.addCons(5 * A + 7 * B + 9 * C + 11 * D + 13 * E <= 1000)\n## The farm has a total of 400 hours of labor available for the season.\nmodel.addCons(2 * A + 3 * B + 4 * C + 5 * D + 6 * E <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Number of Acres for Crop D: \", model.getVal(D))\n    print(\"Number of Acres for Crop E: \", model.getVal(E))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1329,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of tomatoes on plot 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"acres of potatoes on plot 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"acres of carrots on plot 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit from selling the crops. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n// Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n// Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n// Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n// So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation across all plots is 100 acres.\n// T1 + P2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// T1 >= 10; P2 >= 10; C3 >= 10\n\n## Generate Constraint-3:\nThe farmer has a limited budget for fertilizers and can only afford to treat up to 80 acres.\n// T1 + 2 * P2 + 3 * C3 <= 80",
        "question": "A farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n\n| Crop     | Profit Per Acre Formula                |\n|----------|----------------------------------------|\n| Tomatoes | $500 - 10 * T1^2                      |\n| Potatoes | $300 - 5 * P2^2                       |\n| Carrots  | $400 - 8 * C3^2                       |\n\nThe total area available for cultivation across all plots is 100 acres. The farmer must allocate at least 10 acres to each crop. The farmer has a limited budget for fertilizers and can only afford to treat up to 80 acres.\n\nPlease help the farmer to maximize his profit from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=10) # acres of tomatoes on plot 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # acres of potatoes on plot 2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=10) # acres of carrots on plot 3\n\n# Define objective function\n## Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n## Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n## Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n## So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\nProfit_T = (500 - 10 * T1**2) * T1\nProfit_P = (300 - 5 * P2**2) * P2\nProfit_C = (400 - 8 * C3**2) * C3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T + Profit_P + Profit_C)\n\n# Add constraints\n## The total area available for cultivation across all plots is 100 acres.\nmodel.addCons(T1 + P2 + C3 <= 100)\n## The farmer has a limited budget for fertilizers and can only afford to treat up to 80 acres.\nmodel.addCons(T1 + 2 * P2 + 3 * C3 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Tomatoes on Plot 1: \", model.getVal(T1))\n    print(\"Acres of Potatoes on Plot 2: \", model.getVal(P2))\n    print(\"Acres of Carrots on Plot 3: \", model.getVal(C3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost.\n// Revenue from product A: RA = 10 * WA * PriceA\n// Revenue from product B: RB = 15 * WB * PriceB\n// Revenue from product C: RC = 20 * WC * PriceC\n// Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n// So, the objective function is: Maximize (RA + RB + RC - PC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nThe demand for product A is at least 500 units per day.\n// 10 * WA >= 500\n\n## Generate Constraint-3:\nThe demand for product B is at least 750 units per day.\n// 15 * WB >= 750\n\n## Generate Constraint-4:\nThe demand for product C is at least 1000 units per day.\n// 20 * WC >= 1000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost. The manufacturer has a total of 50 workers available. The demand for product A is at least 500 units per day. The demand for product B is at least 750 units per day. The demand for product C is at least 1000 units per day.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Revenue from product A: RA = 10 * WA * PriceA\n## Revenue from product B: RB = 15 * WB * PriceB\n## Revenue from product C: RC = 20 * WC * PriceC\n## Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n## So, the objective function is: Maximize (RA + RB + RC - PC)\nRA = 10 * WA\nRB = 15 * WB\nRC = 20 * WC\nPC = 5 * RA + 8 * RB + 10 * RC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RA + RB + RC - PC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## The demand for product A is at least 500 units per day.\nmodel.addCons(10 * WA >= 500)\n## The demand for product B is at least 750 units per day.\nmodel.addCons(15 * WB >= 750)\n## The demand for product C is at least 1000 units per day.\nmodel.addCons(20 * WC >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many units of labor to allocate to each facility to optimize production efficiency.\n// {\"units of labor at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"units of labor at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"integer\"}\n// {\"units of labor at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of labor at facility 1 produces 10 units of chemical A, 15 units of chemical B, and 20 units of chemical C per hour. At facility 2, each unit of labor produces 20 units of chemical A, 25 units of chemical B, and 30 units of chemical C per hour. At facility 3, each unit of labor produces 30 units of chemical A, 35 units of chemical B, and 40 units of chemical C per hour. The company needs to produce at least 300 units of chemical A, 450 units of chemical B, and 600 units of chemical C daily. The facilities operate simultaneously. Determine the minimum total labor hours required to meet the daily demand.\n// The labor hours for chemical A: H1 = 300 / (10 * L1 + 20 * L2 + 30 * L3)\n// The labor hours for chemical B: H2 = 450 / (15 * L1 + 25 * L2 + 35 * L3)\n// The labor hours for chemical C: H3 = 600 / (20 * L1 + 30 * L2 + 40 * L3)\n// So, the objective function is: Minimize max(H1, H2, H3)\n\n## Generate Constraint-1:\nThe company has a total of 60 units of labor available.\n// L1 + L2 + L3 <= 60\n\n## Generate Constraint-2:\nEach facility can handle up to 25 units of labor at a time.\n// L1 <= 25; L2 <= 25; L3 <= 25",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many units of labor to allocate to each facility to optimize production efficiency. Each unit of labor at facility 1 produces 10 units of chemical A, 15 units of chemical B, and 20 units of chemical C per hour. At facility 2, each unit of labor produces 20 units of chemical A, 25 units of chemical B, and 30 units of chemical C per hour. At facility 3, each unit of labor produces 30 units of chemical A, 35 units of chemical B, and 40 units of chemical C per hour. The company needs to produce at least 300 units of chemical A, 450 units of chemical B, and 600 units of chemical C daily. The facilities operate simultaneously.\n\n| Facility | Chemical A Production Rate | Chemical B Production Rate | Chemical C Production Rate |\n|----------|----------------------------|----------------------------|----------------------------|\n| 1        | 10 units/hour              | 15 units/hour              | 20 units/hour              |\n| 2        | 20 units/hour              | 25 units/hour              | 30 units/hour              |\n| 3        | 30 units/hour              | 35 units/hour              | 40 units/hour              |\n\nThe company has a total of 60 units of labor available. Each facility can handle up to 25 units of labor at a time. Please help the company determine the minimum total labor hours required to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0) # units of labor at facility 1\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=0) # units of labor at facility 2\nL3 = model.addVar(vtype=\"INTEGER\", name=\"L3\", lb=0) # units of labor at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The labor hours for chemical A: H1 = 300 / (10 * L1 + 20 * L2 + 30 * L3)\n## The labor hours for chemical B: H2 = 450 / (15 * L1 + 25 * L2 + 35 * L3)\n## The labor hours for chemical C: H3 = 600 / (20 * L1 + 30 * L2 + 40 * L3)\n## So, the objective function is: Minimize max(H1, H2, H3)\n## Convert the division to multiplication\nH1 = model.addVar(name=\"H1\")\nH2 = model.addVar(name=\"H2\")\nH3 = model.addVar(name=\"H3\")\nmodel.addCons(H1 * (10 * L1 + 20 * L2 + 30 * L3) == 300)\nmodel.addCons(H2 * (15 * L1 + 25 * L2 + 35 * L3) == 450)\nmodel.addCons(H3 * (20 * L1 + 30 * L2 + 40 * L3) == 600)\nmodel.addCons(obj >= H1)\nmodel.addCons(obj >= H2)\nmodel.addCons(obj >= H3)\n\n# Add constraints\n## The company has a total of 60 units of labor available.\nmodel.addCons(L1 + L2 + L3 <= 60)\n## Each facility can handle up to 25 units of labor at a time.\nmodel.addCons(L1 <= 25)\nmodel.addCons(L2 <= 25)\nmodel.addCons(L3 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Labor at Facility 1: \", model.getVal(L1))\n    print(\"Units of Labor at Facility 2: \", model.getVal(L2))\n    print(\"Units of Labor at Facility 3: \", model.getVal(L3))\n    print(\"Minimum Total Labor Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1460,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter.\n// Units <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe amount of overtime hours must not exceed 500 hours.\n// Overtime <= 500",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from all units produced. The company has a maximum capacity of 10,000 units that can be produced in the quarter. The total investment in automation technology cannot exceed $50,000. The amount of overtime hours must not exceed 500 hours. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0) # number of units to produce\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0) # amount of overtime hours\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation technology\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\nProfit = (150 - 100 + 0.0005 * Automation) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 10,000 units that can be produced in the quarter.\nmodel.addCons(Units <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The amount of overtime hours must not exceed 500 hours.\nmodel.addCons(Overtime <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 785,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must produce at least 100 units of ProductC to meet contractual obligations.\n// QuantityC >= 100",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit. The production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units across all products. The investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must produce at least 100 units of ProductC to meet contractual obligations. Please help the company to determine the optimal production quantities and level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\nProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\nProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units across all products.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n# The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company must produce at least 100 units of ProductC to meet contractual obligations.\nmodel.addCons(QuantityC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company aims to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * UnitsA) * UnitsB\n// Profit_C = (100 - 0.2 * UnitsB) * UnitsC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total for all devices.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit. The profit per unit for each device is affected by the production of other devices as follows:\n\n| Device | Profit Per Unit | Effect of Other Devices |\n|--------|-----------------|-------------------------|\n| DeviceA | $50, decreasing by $0.1 for each unit produced beyond the first 100 units | None |\n| DeviceB | $70, decreasing by $0.05 for each unit of DeviceA produced | Affected by DeviceA |\n| DeviceC | $100, decreasing by $0.2 for each unit of DeviceB produced | Affected by DeviceB |\n\nThe company has a production capacity of 500 units in total for all devices. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. \n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n\n## Profit_B = (70 - 0.05 * UnitsA) * UnitsB\nProfit_B = (70 - 0.05 * UnitsA) * UnitsB\n\n## Profit_C = (100 - 0.2 * UnitsB) * UnitsC\nProfit_C = (100 - 0.2 * UnitsB) * UnitsC\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a production capacity of 500 units in total for all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n## Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production time per unit is 1 hour. The profit per unit of P2 is $150, and the production time per unit is 2 hours. The cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company aims to maximize the total profit from both products.\n// Profit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\n// Profit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\n// Total profit: Profit = Profit_P1 + Profit_P2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// P1 + 2 * P2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for raw materials.\n// RawMaterials <= 10000\n\n## Generate Constraint-3:\nThe market demand for P1 is 100 units. So, the company can only sell a maximum of 100 units of P1.\n// P1 <= 100\n\n## Generate Constraint-4:\nThe company aims to produce at least 50 units of P2.\n// P2 >= 50\n\n## Generate Constraint-5:\nThe total production quantity should not exceed 150 units.\n// P1 + P2 <= 150",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time. The profit per unit of P1 is $100, and the production time per unit is 1 hour. The profit per unit of P2 is $150, and the production time per unit is 2 hours. The cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company has a total production time of 200 hours and a budget of $10,000 for raw materials. The market demand for P1 is 100 units, and the company can only sell a maximum of 100 units of P1. The company aims to produce at least 50 units of P2. The total production quantity should not exceed 150 units. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=50, ub=150) # quantity of P2\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0, ub=10000) # cost of raw materials\n\n# Define objective function\nProfit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\nProfit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\nProfit = Profit_P1 + Profit_P2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + 2 * P2 <= 200) # total production time of 200 hours\nmodel.addCons(RawMaterials <= 10000) # budget of $10,000 for raw materials\nmodel.addCons(P1 <= 100) # market demand for P1 is 100 units\nmodel.addCons(P2 >= 50) # produce at least 50 units of P2\nmodel.addCons(P1 + P2 <= 150) # total production quantity should not exceed 150 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Cost of Raw Materials: \", model.getVal(RawMaterials))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company wants to maximize the total profit from the production of these machines.\n// Total profit for MachineA: Profit_A = 500 * MachineA\n// Total profit for MachineB: Profit_B = 700 * MachineB\n// Total profit for MachineC: Profit_C = 900 * MachineC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA + MachineB + MachineC <= 100",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints.\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company wants to maximize the total profit from the production of these machines.\nThe company has a total production capacity of 100 machines per month.\nPlease help the company determine the optimal production quantity for each machine type to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0) # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0) # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0) # number of MachineC\n\n# Define objective function\nProfit_A = 500 * MachineA\nProfit_B = 700 * MachineB\nProfit_C = 900 * MachineC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 100 machines per month.\nmodel.addCons(MachineA + MachineB + MachineC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 579,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how many hours each factory should operate daily to meet production targets while minimizing costs.\n// {\"hours of operation for factory 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for factory 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for factory 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different efficiency and cost structure. Factory 1 produces 100 units per hour at a cost of $50 per hour. Factory 2 produces 150 units per hour at a cost of $60 per hour. Factory 3 produces 200 units per hour at a cost of $70 per hour. The company needs to produce at least 3000 units daily. The objective is to minimize the total cost of operation.\n// The total cost of operation: C = 50 * H1 + 60 * H2 + 70 * H3\n// The total production: P = 100 * H1 + 150 * H2 + 200 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total hours of operation across all factories must not exceed 24 hours per day.\n// H1 + H2 + H3 <= 24\n\n## Generate Constraint-2:\nEach factory can operate a maximum of 10 hours per day.\n// H1 <= 10; H2 <= 10; H3 <= 10\n\n## Generate Constraint-3:\nThe total production must meet or exceed the daily requirement of 3000 units.\n// 100 * H1 + 150 * H2 + 200 * H3 >= 3000",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how many hours each factory should operate daily to meet production targets while minimizing costs. Factory 1 produces 100 units per hour at a cost of $50 per hour. Factory 2 produces 150 units per hour at a cost of $60 per hour. Factory 3 produces 200 units per hour at a cost of $70 per hour. The company needs to produce at least 3000 units daily. The total hours of operation across all factories must not exceed 24 hours per day, and each factory can operate a maximum of 10 hours per day. Please help the company to minimize the total cost of operation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours of operation for factory 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours of operation for factory 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours of operation for factory 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 50 * H1 + 60 * H2 + 70 * H3\nmodel.addCons(obj == 50 * H1 + 60 * H2 + 70 * H3)\n\n# Add constraints\n## The total hours of operation across all factories must not exceed 24 hours per day.\nmodel.addCons(H1 + H2 + H3 <= 24)\n## Each factory can operate a maximum of 10 hours per day.\nmodel.addCons(H1 <= 10)\nmodel.addCons(H2 <= 10)\nmodel.addCons(H3 <= 10)\n## The total production must meet or exceed the daily requirement of 3000 units.\nmodel.addCons(100 * H1 + 150 * H2 + 200 * H3 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for factory 1: \", model.getVal(H1))\n    print(\"Hours of operation for factory 2: \", model.getVal(H2))\n    print(\"Hours of operation for factory 3: \", model.getVal(H3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered.\n// Total daily cost: Cost = 500 * T + 300 * V + 100 * B\n// Total packages delivered: Packages = 100 * T + 50 * V + 20 * B\n// The company needs to deliver at least 2000 packages per day.\n// So, the objective function is: Minimize Cost subject to Packages >= 2000\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle operations.\n// 500 * T + 300 * V + 100 * B <= 10,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons.\n// B >= 0.2 * (T + V + B)",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements. The delivery capacity and daily cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity (packages/day) | Daily Cost ($) |\n|--------------|---------------------------------|---------------|\n| Trucks       | 100                             | 500           |\n| Vans         | 50                              | 300           |\n| Bikes        | 20                              | 100           |\n\nThe company has a budget of $10,000 per day for vehicle operations. Due to maintenance constraints, the total number of vehicles cannot exceed 30. The company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons. The company needs to deliver at least 2000 packages per day.\nPlease help the company to minimize the total daily cost while ensuring all packages are delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * T + 300 * V + 100 * B\nPackages = 100 * T + 50 * V + 20 * B\nmodel.addCons(Packages >= 2000) # ensure all packages are delivered\n\n# Add constraints\n## The company has a budget of $10,000 per day for vehicle operations.\nmodel.addCons(500 * T + 300 * V + 100 * B <= 10000)\n## Due to maintenance constraints, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## The company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons.\nmodel.addCons(B >= 0.2 * (T + V + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\n// {\"number of acres for CropA\": \"AcresA\", \"range\": \"AcresA >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"AcresB\", \"range\": \"AcresB >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"AcresC\", \"range\": \"AcresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\n// Net profit for CropA: Profit_A = (500 - 100) * AcresA\n// Net profit for CropB: Profit_B = (700 - 150) * AcresB\n// Net profit for CropC: Profit_C = (900 - 200) * AcresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2000 * AcresA + 3000 * AcresB + 4000 * AcresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// AcresA + AcresB + AcresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, CropA must be planted on at least twice as many acres as CropB.\n// AcresA >= 2 * AcresB",
        "question": "A farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop   | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|--------|-------------------------|----------------------|---------------------|\n| CropA  | $500                    | 2000 gallons         | $100                |\n| CropB  | $700                    | 3000 gallons         | $150                |\n| CropC  | $900                    | 4000 gallons         | $200                |\n\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, CropA must be planted on at least twice as many acres as CropB. The farm aims to maximize the net profit per gallon of water used.\nPlease help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAcresA = model.addVar(vtype=\"INTEGER\", name=\"AcresA\", lb=0) # number of acres for CropA\nAcresB = model.addVar(vtype=\"INTEGER\", name=\"AcresB\", lb=0) # number of acres for CropB\nAcresC = model.addVar(vtype=\"INTEGER\", name=\"AcresC\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * AcresA\nProfit_B = (700 - 150) * AcresB\nProfit_C = (900 - 200) * AcresC\nWaterUsage = 2000 * AcresA + 3000 * AcresB + 4000 * AcresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(AcresA + AcresB + AcresC <= 100)\n## Due to soil conditions, CropA must be planted on at least twice as many acres as CropB.\nmodel.addCons(AcresA >= 2 * AcresB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(AcresA))\n    print(\"Number of Acres for CropB: \", model.getVal(AcresB))\n    print(\"Number of Acres for CropC: \", model.getVal(AcresC))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\n// {\"quantity of Chocolate cake\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Vanilla cake\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"quantity of Strawberry cake\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production capacity and wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_C = 30 * C - 10 * C\n// Profit_V = 25 * V - 8 * V\n// Profit_S = 20 * S - 5 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / (1.5 * C + 1 * V + 0.5 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited production time of 80 hours.\n// 1.5 * C + 1 * V + 0.5 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for ingredient costs.\n// 10 * C + 8 * V + 5 * S <= 2000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce. The revenue per unit, production time per unit, and ingredient cost per unit for each cake are given in the following Table.\n\n| Cake Type     | Revenue per Unit | Production Time per Unit | Ingredient Cost per Unit |\n|---------------|------------------|--------------------------|--------------------------|\n| Chocolate     | $30              | 1.5 hours                | $10                      |\n| Vanilla       | $25              | 1 hour                   | $8                       |\n| Strawberry    | $20              | 0.5 hours                | $5                       |\n\nThe bakery has a limited production time of 80 hours. The bakery also has a budget of $2000 for ingredient costs. The bakery wants to maximize the profit efficiency (profit per hour of production time). Please help the bakery determine the optimal quantities of each cake to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chocolate cake\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # quantity of Vanilla cake\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of Strawberry cake\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (30 - 10) * C\nProfit_V = (25 - 8) * V\nProfit_S = (20 - 5) * S\nProductionTime = 1.5 * C + 1 * V + 0.5 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a limited production time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 0.5 * S <= 80)\n## The bakery has a budget of $2000 for ingredient costs.\nmodel.addCons(10 * C + 8 * V + 5 * S <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chocolate cake: \", model.getVal(C))\n    print(\"Quantity of Vanilla cake: \", model.getVal(V))\n    print(\"Quantity of Strawberry cake: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineAUnits\", \"range\": \"MachineAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineBUnits\", \"range\": \"MachineBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineCUnits\", \"range\": \"MachineCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each unit produced beyond the first. The profit per unit for MachineB is $700, but it decreases by $15 for each unit produced beyond the first. The profit per unit for MachineC is $900, but it decreases by $20 for each unit produced beyond the first. The company wants to maximize the total profit.\n// Profit for MachineA: Profit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\n// Profit for MachineB: Profit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\n// Profit for MachineC: Profit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 units for all machines combined.\n// MachineAUnits + MachineBUnits + MachineCUnits <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineBUnits <= 2 * MachineAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs. The cost per unit for MachineA is $100, for MachineB is $150, and for MachineC is $200.\n// 100 * MachineAUnits + 150 * MachineBUnits + 200 * MachineCUnits <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each machine is produced.\n// MachineAUnits >= 1; MachineBUnits >= 1; MachineCUnits >= 1",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to decide how many units of each machine to produce to optimize their profit. The profit per unit for each machine decreases as more units are produced beyond the first. The profit per unit for MachineA starts at $500 and decreases by $10 for each unit produced beyond the first. The profit per unit for MachineB starts at $700 and decreases by $15 for each unit produced beyond the first. The profit per unit for MachineC starts at $900 and decreases by $20 for each unit produced beyond the first. The company wants to maximize the total profit.\n\n| Machine | Profit per Unit (First Unit) | Decrease per Unit (Beyond First) | Cost per Unit |\n|---------|------------------------------|---------------------------------|---------------|\n| MachineA | $500                         | $10                             | $100          |\n| MachineB | $700                         | $15                             | $150          |\n| MachineC | $900                         | $20                             | $200          |\n\nThe company has a total production capacity of 50 units for all machines combined. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget of $20,000 for production costs. The company wants to ensure that at least one unit of each machine is produced.\n\nPlease help the company determine the optimal number of units to produce for each machine to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineAUnits\", lb=1)  # number of units of MachineA\nMachineBUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineBUnits\", lb=1)  # number of units of MachineB\nMachineCUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineCUnits\", lb=1)  # number of units of MachineC\n\n# Define objective function\n## Profit for MachineA: Profit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\n## Profit for MachineB: Profit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\n## Profit for MachineC: Profit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\nProfit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\nProfit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\nProfit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\n## So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 50 units for all machines combined.\nmodel.addCons(MachineAUnits + MachineBUnits + MachineCUnits <= 50)\n## Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineBUnits <= 2 * MachineAUnits)\n## The company has a budget of $20,000 for production costs.\nmodel.addCons(100 * MachineAUnits + 150 * MachineBUnits + 200 * MachineCUnits <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineAUnits))\n    print(\"Number of MachineB Units: \", model.getVal(MachineBUnits))\n    print(\"Number of MachineC Units: \", model.getVal(MachineCUnits))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1572,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n// Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\n// So, the objective function is: Maximize Revenue\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Production <= 10000\n\n## Generate Constraint-2:\nThe total advertising budget must not exceed $50,000.\n// Advertising <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire. Each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue. The company has a production capacity limit of 10,000 units for the quarter. The total advertising budget must not exceed $50,000. Please help the company to maximize the total sales revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0)\n## {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)\n## {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\nSalesReps = model.addVar(vtype=\"INTEGER\", name=\"SalesReps\", lb=0)\n\n# Define objective function\n## Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\nRevenue = 100 * Production + 0.5 * Advertising + 20000 * SalesReps\n## So, the objective function is: Maximize Revenue\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue)\n\n# Add constraints\n## The company has a production capacity limit of 10,000 units for the quarter.\nmodel.addCons(Production <= 10000)\n## The total advertising budget must not exceed $50,000.\nmodel.addCons(Advertising <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Sales Representatives: \", model.getVal(SalesReps))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 100 units.\n// 2 * C1 + 3 * C2 + 4 * C3 <= 100",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| C1   | $1000           | 2 units                 |\n| C2   | $1200           | 3 units                 |\n| C3   | $1500           | 4 units                 |\n\nThe farm has a total of 50 acres available for cultivation. The farm has a limited water supply of 100 units. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\nPlease help the farmer to determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n## The farm has a limited water supply of 100 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnts\", \"range\": \"DeviceBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnts\", \"range\": \"DeviceCUnts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\n// DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts)\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials for the month.\n// (20 + 0.05 * (DeviceAUnits^2)) * DeviceAUnits + (30 + 0.03 * (DeviceBUnts^2)) * DeviceBUnts + (40 + 0.02 * (DeviceCUnts^2)) * DeviceCUnts <= 50,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company has a total production capacity of 1000 units for the month. Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined. The company has a budget of $50,000 for raw materials for the month. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0)  # number of units of DeviceA\nDeviceBUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnts\", lb=0)  # number of units of DeviceB\nDeviceCUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnts\", lb=0)  # number of units of DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (20 + 0.05 * DeviceAUnits**2)) * DeviceAUnits\nProfit_DeviceB = (70 - (30 + 0.03 * DeviceBUnts**2)) * DeviceBUnts\nProfit_DeviceC = (90 - (40 + 0.02 * DeviceCUnts**2)) * DeviceCUnts\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000)\n## Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\nmodel.addCons(DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts))\n## The company has a budget of $50,000 for raw materials for the month.\nmodel.addCons((20 + 0.05 * DeviceAUnits**2) * DeviceAUnits + (30 + 0.03 * DeviceBUnts**2) * DeviceBUnts + (40 + 0.02 * DeviceCUnts**2) * DeviceCUnts <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnts))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the profit per unit decreases when the production volume exceeds certain thresholds: the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units. The total production capacity of the company is 500 units per day. Please help the company to maximize the total profit from products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n\n## create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n\n## create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_A + P_B + P_C\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 785,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300\n\n## Generate Constraint-2:\nThe soil fertility must remain above 50 points after planting all crops.\n// 2 * A1 + 3 * A2 + 5 * A3 <= 100 (assuming the initial soil fertility is 100 points)\n\n## Generate Constraint-3:\nThe total acreage available for planting is 50 acres.\n// A1 + A2 + A3 <= 50",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm has a limited water supply of 300 units. The soil fertility must remain above 50 points after planting all crops. The total acreage available for planting is 50 acres.\nPlease help the farm to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n## The soil fertility must remain above 50 points after planting all crops.\nmodel.addCons(2 * A1 + 3 * A2 + 5 * A3 <= 100)\n## The total acreage available for planting is 50 acres.\nmodel.addCons(A1 + A2 + A3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n// 5 * A + 8 * B + 10 * C <= 5000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total labor hours available are 2000 hours.\n// 2 * A + 3 * B + 4 * C <= 2000\n\n## Generate Constraint-3:\nThe market demand for each product is limited. The maximum demand for Product A is 1000 units, for Product B is 800 units, and for Product C is 600 units.\n// A <= 1000; B <= 800; C <= 600",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin. Product A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg. The company also has a labor constraint, where Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours, with a total of 2000 labor hours available. Additionally, the market demand for each product is limited, with a maximum demand for Product A of 1000 units, for Product B of 800 units, and for Product C of 600 units.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for each product is limited. The maximum demand for Product A is 1000 units, for Product B is 800 units, and for Product C is 600 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=600) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=500)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=500, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 500) / 100) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=500, ub=800)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 500) / 100) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=500)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=500, ub=600)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 500) / 100) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n## The company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total labor hours available are 2000 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// Qa + Qb + Qc <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| A       | $50             | 0.01 * Qa^2              |\n| B       | $70             | 0.02 * Qb^2              |\n| C       | $60             | 0.015 * Qc^2             |\n\nThe total production capacity of the company is limited to 1000 units per week. Please help the company to maximize the total profit, which is the revenue minus the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\nmodel.addCons(obj == 50 * Qa - 0.01 * Qa**2 + 70 * Qb - 0.02 * Qb**2 + 60 * Qc - 0.015 * Qc**2)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-3:\nThe total available machine hours are 800 hours.\n// M <= 800\n\n## Generate Constraint-4:\nThe plant must maintain a balance in the usage of resources. The ratio of labor hours to machine hours should not exceed 1.5.\n// L / M <= 1.5",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000, the total available labor hours are 1000 hours, and the total available machine hours are 800 hours. Additionally, the plant must maintain a balance in the usage of resources, where the ratio of labor hours to machine hours should not exceed 1.5. Please help the plant manager to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\nP = 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total available machine hours are 800 hours.\nmodel.addCons(M <= 800)\n## The ratio of labor hours to machine hours should not exceed 1.5.\nmodel.addCons(L <= 1.5 * M)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A must be met, which is at least 200 units.\n// A >= 200",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit and storage cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Storage Cost per Unit |\n|-----------|-----------------|-----------------------|\n| A         | $50             | $10                   |\n| B         | $70             | $15                   |\n| C         | $60             | $12                   |\n\nThe manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. The demand for component A must be met, which is at least 200 units.\nPlease help the manufacturer determine the optimal production levels for components A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The demand for component A must be met, which is at least 200 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from the crops. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used.\n// Profit_W = 200 * W - 10 * 2 * W\n// Profit_C = 300 * C - 10 * 3 * C\n// Profit_S = 250 * S - 10 * 2.5 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a budget of $1000 for water costs.\n// 2 * W + 3 * C + 2.5 * S <= 1000 / 10",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used. The total available land is 50 acres, and the farmer has a budget of $1000 for water costs. Please help the farmer to maximize his total profit from the crops while considering the water usage and costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W - 10 * 2 * W\nProfit_C = 300 * C - 10 * 3 * C\nProfit_S = 250 * S - 10 * 2.5 * S\nWaterUsage = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The total available land is 50 acres.\nmodel.addCons(W + C + S <= 50)\n## The farmer has a budget of $1000 for water costs.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 1000 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company wants to maximize the total profit from the production of these machines.\n// Total profit for MachineA: Profit_A = 500 * MachineA\n// Total profit for MachineB: Profit_B = 700 * MachineB\n// Total profit for MachineC: Profit_C = 900 * MachineC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA + MachineB + MachineC <= 100\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineB <= 2 * MachineA\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month. The cost of raw materials per unit for MachineA is $100, for MachineB is $200, and for MachineC is $300.\n// 100 * MachineA + 200 * MachineB + 300 * MachineC <= 50,000\n\n## Generate Constraint-4:\nTo ensure a balanced product portfolio, the company wants to ensure that the production of MachineC is at least half of the combined production of MachineA and MachineB.\n// MachineC >= 0.5 * (MachineA + MachineB)\n\n## Generate Constraint-5:\nThe company wants to ensure that at least one unit of each machine type is produced.\n// MachineA >= 1; MachineB >= 1; MachineC >= 1",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Cost of Raw Materials per Unit |\n|--------------|-----------------|--------------------------------|\n| MachineA     | $500            | $100                           |\n| MachineB     | $700            | $200                           |\n| MachineC     | $900            | $300                           |\n\nThe company has a total production capacity of 100 machines per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month. To ensure a balanced product portfolio, the company wants to ensure that the production of MachineC is at least half of the combined production of MachineA and MachineB. The company wants to ensure that at least one unit of each machine type is produced.\n\nPlease help the company to maximize the total profit from the production of these machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=1)  # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=1)  # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=1)  # number of MachineC\n\n# Define objective function\nProfit_A = 500 * MachineA\nProfit_B = 700 * MachineB\nProfit_C = 900 * MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(MachineA + MachineB + MachineC <= 100)  # Total production capacity constraint\nmodel.addCons(MachineB <= 2 * MachineA)  # Resource limitation constraint for MachineB\nmodel.addCons(100 * MachineA + 200 * MachineB + 300 * MachineC <= 50000)  # Budget constraint for raw materials\nmodel.addCons(MachineC >= 0.5 * (MachineA + MachineB))  # Balanced product portfolio constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1323,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line.\n// {\"number of workers on component A production line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B production line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line can produce 10 units per hour, with a defect rate of 2%. Each worker on the component B line can produce 15 units per hour, with a defect rate of 3%. Each worker on the component C line can produce 20 units per hour, with a defect rate of 4%. The manufacturer wants to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\n// Total production output: Output = 10 * A + 15 * B + 20 * C\n// Total defect rate: Defect = 2% * 10 * A + 3% * 15 * B + 4% * 20 * C\n// So, the objective function is: Maximize Output / Defect\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 skilled workers available.\n// A + B + C <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 20 workers.\n// A <= 20; B <= 20; C <= 20\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily.\n// 10 * A >= 500\n// 15 * B >= 750\n// 20 * C >= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line. The production and defect rates for each component are given in the following Table.\n\n| Component | Production Rate per Worker (units/hour) | Defect Rate |\n|-----------|-----------------------------------------|-------------|\n| A         | 10                                      | 2%          |\n| B         | 15                                      | 3%          |\n| C         | 20                                      | 4%          |\n\nThe manufacturer has a total of 50 skilled workers available. Each production line can handle a maximum of 20 workers. The manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. \n\nPlease help the manufacturer to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on component A production line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on component B production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on component C production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nOutput = 10 * A + 15 * B + 20 * C\nDefect = 0.02 * 10 * A + 0.03 * 15 * B + 0.04 * 20 * C\n## the objective function is: Maximize Output / Defect\n## convert the division to multiplication\nmodel.addCons(obj * Defect == Output)\n\n# Add constraints\n## The manufacturer has a total of 50 skilled workers available.\nmodel.addCons(A + B + C <= 50)\n## Each production line can handle a maximum of 20 workers.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 20)\nmodel.addCons(C <= 20)\n## The manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily.\nmodel.addCons(10 * A >= 500)\nmodel.addCons(15 * B >= 750)\nmodel.addCons(20 * C >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on component A production line: \", model.getVal(A))\n    print(\"Number of workers on component B production line: \", model.getVal(B))\n    print(\"Number of workers on component C production line: \", model.getVal(C))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale.\n// Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n// The nonlinear aspect is introduced by assuming that the cost of raw materials and labor decreases as production increases due to bulk discounts.\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units across all products.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours.\n// Qa + 2 * Qb + 3 * Qc <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale. The total production capacity of the company is limited to 1000 units across all products. Additionally, the company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\nProfit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units across all products.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours.\nmodel.addCons(Qa + 2 * Qb + 3 * Qc <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n// 5 * A + 8 * B + 10 * C <= 5000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total labor hours available are 2000 hours.\n// 2 * A + 3 * B + 4 * C <= 2000\n\n## Generate Constraint-3:\nThe market demand for each product is limited. The maximum demand for Product A is 1000 units, for Product B is 800 units, and for Product C is 600 units.\n// A <= 1000; B <= 800; C <= 600\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production. The ratio of Product A to the total production should not exceed 40%.\n// A <= 0.4 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin. Product A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg. The company also has a labor constraint, with Product A requiring 2 hours of labor per unit, Product B requiring 3 hours, and Product C requiring 4 hours, and a total of 2000 labor hours available. The market demand for each product is limited, with a maximum demand for Product A of 1000 units, for Product B of 800 units, and for Product C of 600 units. The company aims to maintain a balanced production, with the ratio of Product A to the total production not exceeding 40%.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize their total profit, while considering all the constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800)   # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=600)   # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=500)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=500, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 500) / 100) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=500, ub=800)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 500) / 100) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=500)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=500, ub=600)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 500) / 100) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)  # raw material constraint\nmodel.addCons(2 * A + 3 * B + 4 * C <= 2000)   # labor constraint\nmodel.addCons(A <= 0.4 * (A + B + C))          # balanced production constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1389,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe total production capacity of the company is 100 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\nProfit = 10*A + 15*B + 20*C - 0.01*(A_sq + B_sq + C_sq)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of generating energy from solar is $50 per unit, with a reliability of 90%.\nThe cost of generating energy from wind is $70 per unit, with a reliability of 85%.\nThe cost of generating energy from hydro is $60 per unit, with a reliability of 95%.\nThe company wants to minimize the Cost-Reliability ratio of the energy generation. (The Cost-Reliability ratio is defined as the total cost of energy generation divided by the total reliability of the energy sources.)\n// total cost of energy generation: Cost = 50 * Solar + 70 * Wind + 60 * Hydro\n// total reliability of energy sources: Reliability = 90% * Solar + 85% * Wind + 95% * Hydro\n// So, the objective function is: Minimize Cost / Reliability\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for energy investment.\n// 50 * Solar + 70 * Wind + 60 * Hydro <= 150000\n\n## Generate Constraint-2:\nThe company needs to generate at least 2000 units of energy in total.\n// Solar + Wind + Hydro >= 2000\n\n## Generate Constraint-3:\nAt least 500 units of energy must come from solar sources.\n// Solar >= 500\n\n## Generate Constraint-4:\nNo more than 60% of the budget should be spent on any single energy source.\n// 50 * Solar <= 60% * 150000\n// 70 * Wind <= 60% * 150000\n// 60 * Hydro <= 60% * 150000",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro. The cost and reliability of each energy source are given in the following Table.\n\n| Energy Source | Cost per Unit | Reliability |\n|---------------|---------------|-------------|\n| Solar         | $50           | 90%         |\n| Wind          | $70           | 85%         |\n| Hydro         | $60           | 95%         |\n\nThe company has a budget of $150,000 for energy investment. The company needs to generate at least 2000 units of energy in total. At least 500 units of energy must come from solar sources. No more than 60% of the budget should be spent on any single energy source. \n\nPlease help the company to minimize the Cost-Reliability ratio of the energy generation (defined as the total cost of energy generation divided by the total reliability of the energy sources).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=500) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * Solar + 70 * Wind + 60 * Hydro\nReliability = 0.9 * Solar + 0.85 * Wind + 0.95 * Hydro\n## the objective function is: Minimize Cost / Reliability\n## convert the division to multiplication\nmodel.addCons(obj * Reliability == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for energy investment.\nmodel.addCons(50 * Solar + 70 * Wind + 60 * Hydro <= 150000)\n## The company needs to generate at least 2000 units of energy in total.\nmodel.addCons(Solar + Wind + Hydro >= 2000)\n## At least 500 units of energy must come from solar sources.\nmodel.addCons(Solar >= 500)\n## No more than 60% of the budget should be spent on any single energy source.\nmodel.addCons(50 * Solar <= 0.6 * 150000)\nmodel.addCons(70 * Wind <= 0.6 * 150000)\nmodel.addCons(60 * Hydro <= 0.6 * 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Energy from Solar: \", model.getVal(Solar))\n    print(\"Amount of Energy from Wind: \", model.getVal(Wind))\n    print(\"Amount of Energy from Hydro: \", model.getVal(Hydro))\n    print(\"Minimized Cost-Reliability Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the number of hours of labor to employ, and the amount of capital to invest in new machinery.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"integer\"}\n// {\"amount of capital to invest in machinery\": \"Capital\", \"range\": \"Capital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in new machinery. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.00005 * Capital) * Units - LaborHours * 20\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the quarter. The company must ensure that at least 5,000 labor hours are utilized.\n// LaborHours <= 10000; LaborHours >= 5000\n\n## Generate Constraint-2:\nThe total capital investment in new machinery cannot exceed $1,000,000.\n// Capital <= 1000000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the number of hours of labor to employ, and the amount of capital to invest in new machinery. The cost of production per unit decreases by $5 for every $100,000 invested in new machinery, with an initial production cost per unit of $100 and a selling price per unit of $150. The company aims to maximize the total profit from the production.\n\nThe company has a total of 10,000 labor hours available for the quarter and must ensure that at least 5,000 labor hours are utilized. The total capital investment in new machinery cannot exceed $1,000,000.\n\nPlease help the company determine the optimal number of units to produce, the number of hours of labor to employ, and the amount of capital to invest in new machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nLaborHours = model.addVar(vtype=\"INTEGER\", name=\"LaborHours\", lb=5000, ub=10000)  # number of hours of labor\nCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"Capital\", lb=0)  # amount of capital to invest in machinery\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Capital) * Units - LaborHours * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Capital <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Number of Labor Hours: \", model.getVal(LaborHours))\n    print(\"Amount of Capital Invested: \", model.getVal(Capital))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component.\n// The cost function is: Cost = 10 * PA + 15 * PB + 20 * PC\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units.\n// PA >= 500 / 50\n\n## Generate Constraint-2:\nThe demand for component B is at least 750 units, and each hour of production line B produces 60 units.\n// PB >= 750 / 60\n\n## Generate Constraint-3:\nThe demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\n// PC >= 1000 / 75",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs. The cost of producing each component per hour is as follows:\n\n| Component | Cost per Hour |\n|-----------|---------------|\n| A         | $10           |\n| B         | $15           |\n| C         | $20           |\n\nThe company aims to minimize the total cost of production while meeting the demand for each component. The demand for component A is at least 500 units, and each hour of production line A produces 50 units. The demand for component B is at least 750 units, and each hour of production line B produces 60 units. The demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\n\nPlease help the company determine the optimal number of hours each production line should operate to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nCost = 10 * PA + 15 * PB + 20 * PC\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n## The demand for component A is at least 500 units, and each hour of production line A produces 50 units.\nmodel.addCons(PA >= 500 / 50)\n## The demand for component B is at least 750 units, and each hour of production line B produces 60 units.\nmodel.addCons(PB >= 750 / 60)\n## The demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\nmodel.addCons(PC >= 1000 / 75)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000\n\n## Generate Constraint-2:\nDue to production constraints, the total number of machines produced cannot exceed 100 units.\n// MachineA_Units + MachineB_Units + MachineC_Units <= 100",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit and setup cost for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost per Unit |\n|---------|-----------------|---------------------|\n| MachineA | $500           | $100                |\n| MachineB | $700           | $150                |\n| MachineC | $900           | $200                |\n\nThe company has a limited budget for setup costs, which is $10,000. Due to production constraints, the total number of machines produced cannot exceed 100 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=0) # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=0) # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=0) # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n# Due to production constraints, the total number of machines produced cannot exceed 100 units.\nmodel.addCons(MachineA_Units + MachineB_Units + MachineC_Units <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 742,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// Product1 + Product2 <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// Technology <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products. The new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=0) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0) # production quantity of Product 2\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n## Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n## So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\nProfit1 = (150 - (100 - 0.0005 * Technology)) * Product1\nProfit2 = (200 - (150 - 0.0005 * Technology)) * Product2\nTotalProfit = Profit1 + Profit2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(Product1 + Product2 <= 1000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(Technology <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nProduct A requires a minimum production of 50 units to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit from product A is $50 per unit, but it requires a setup cost of $1000. The profit from product B is $70 per unit, but it requires a setup cost of $1500. The profit from product C is $90 per unit, but it requires a setup cost of $2000. The company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Product A requires a minimum production of 50 units to meet contractual obligations. The company aims to produce at least twice as many units of product B as product A.\nPlease help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit from product A: Profit_A = 50 * A - 1000\n## Total profit from product B: Profit_B = 70 * B - 1500\n## Total profit from product C: Profit_C = 90 * C - 2000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * A - 1000 + 70 * B - 1500 + 90 * C - 2000)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## Product A requires a minimum production of 50 units to meet contractual obligations.\nmodel.addCons(A >= 50)\n## The company aims to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The market demand for each device is uncertain, but the manufacturer wants to maximize the total profit while considering the risk of overproduction. The risk is defined as the square of the difference between production and estimated demand.\n// Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n// Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n// So, the objective function is: Maximize Profit - Risk\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for production.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000\n\n## Generate Constraint-2:\nThe estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\n// Smartphones >= 0.5 * 200\n// Tablets >= 0.5 * 150\n// Laptops >= 0.5 * 100\n\n## Generate Constraint-4:\nThe manufacturer wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\n// 100 * Smartphones <= 0.6 * 50000\n// 200 * Tablets <= 0.6 * 50000\n// 300 * Laptops <= 0.6 * 50000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary. The production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units. The manufacturer has a budget of $50,000 for production. The manufacturer wants to ensure at least 50% of the estimated demand is met for each device and wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\n\nPlease help the manufacturer to maximize the total profit while considering the risk of overproduction, where the risk is defined as the square of the difference between production and estimated demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\n\n# Define objective function\n## Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n## Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n## So, the objective function is: Maximize Profit - Risk\nProfit = 0.2 * 100 * Smartphones + 0.15 * 200 * Tablets + 0.1 * 300 * Laptops\nRisk = (Smartphones - 200)**2 + (Tablets - 150)**2 + (Laptops - 100)**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Risk)\n\n# Add constraints\n## The manufacturer has a budget of $50,000 for production.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000)\n## The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\nmodel.addCons(Smartphones >= 0.5 * 200)\nmodel.addCons(Tablets >= 0.5 * 150)\nmodel.addCons(Laptops >= 0.5 * 100)\n## The manufacturer wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\nmodel.addCons(100 * Smartphones <= 0.6 * 50000)\nmodel.addCons(200 * Tablets <= 0.6 * 50000)\nmodel.addCons(300 * Laptops <= 0.6 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit - Risk: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter.\n// Units <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe amount of overtime hours must not exceed 500 hours.\n// Overtime <= 500\n\n## Generate Constraint-4:\nThe number of units produced must be at least 5000 to meet the minimum order requirements.\n// Units >= 5000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency. The initial production cost per unit is $100, and the selling price per unit is $150. The production cost per unit decreases by $5 for every $10,000 invested in automation technology.\n\n| Variable                | Description                          | Range/Type       |\n|-------------------------|--------------------------------------|------------------|\n| Number of units to produce | Units to be produced in the quarter  | Units >= 0 (integer) |\n| Amount of overtime hours | Additional hours beyond regular time | Overtime >= 0 (continuous) |\n| Investment in automation technology | Funds allocated for enhancing efficiency | Automation >= 0 (continuous) |\n\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter. The total investment in automation technology cannot exceed $50,000. The amount of overtime hours must not exceed 500 hours. The number of units produced must be at least 5000 to meet the minimum order requirements.\n\nPlease help the company to maximize the total profit from all units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=5000)  # number of units to produce\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0)  # amount of overtime hours\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\nProfit = (150 - 100 + 0.0005 * Automation) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 10,000 units that can be produced in the quarter.\nmodel.addCons(Units <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The amount of overtime hours must not exceed 500 hours.\nmodel.addCons(Overtime <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1299,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300\n\n## Generate Constraint-3:\nThe company has a total production capacity of 600 units across all chemicals.\n// A + B + C <= 600\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of chemical A and 75 units of chemical B to fulfill existing contracts.\n// A >= 50; B >= 75",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of each chemical and the conditions under which the profit increases are given in the following Table.\n\n| Chemical | Profit per Unit | Profit Increase Condition |\n|----------|-----------------|---------------------------|\n| A        | $10             | $0.02 per 10 units beyond 100 units |\n| B        | $15             | $0.03 per 15 units beyond 150 units |\n| C        | $20             | $0.01 per 20 units beyond 200 units |\n\nThe company has a total of 1000 kg of raw material available, with chemical A requiring 5 kg, chemical B requiring 8 kg, and chemical C requiring 10 kg per unit. The company has a storage capacity limit for each chemical: chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units. The company has a total production capacity of 600 units across all chemicals. Additionally, the company must produce at least 50 units of chemical A and 75 units of chemical B to fulfill existing contracts.\n\nPlease help the company to maximize the total profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75)  # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)   # quantity of chemical C\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n\n# Create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n\n# Create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 300)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. The farmer wants to maximize his total profit. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The objective is to maximize the total profit, which is given by:\n// Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare.\n// 5W + 7C + 6B <= 1500",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit. The profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The farmer wants to maximize his total profit, which is given by:\n\n| Crop | Profit per Unit | Yield Factor | Cost per Hectare |\n|------|-----------------|--------------|------------------|\n| Wheat | $10            | 0.8          | $5               |\n| Corn  | $15            | 0.9          | $7               |\n| Barley| $12            | 0.7          | $6               |\n\nThe total area available for planting is 100 hectares. The farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare. \n\nPlease help the farmer to maximize his total profit while considering the constraints on area and budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\nmodel.addCons(obj == 10 * 0.8 * W + 15 * 0.9 * C + 12 * 0.7 * B)\n\n# Add constraints\n## The total area available for planting is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizers, which is $1500.\nmodel.addCons(5 * W + 7 * C + 6 * B <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from the crops. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used.\n// Profit_W = 200 * W - 10 * 2 * W\n// Profit_C = 300 * C - 10 * 3 * C\n// Profit_S = 250 * S - 10 * 2.5 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a budget of $1000 for water costs.\n// 2 * W + 3 * C + 2.5 * S <= 1000 / 10",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre and water usage for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Water Usage per Acre |\n|----------|-----------------|----------------------|\n| Wheat    | $200            | 2 units              |\n| Corn     | $300            | 3 units              |\n| Soybeans | $250            | 2.5 units            |\n\nThe cost of water per unit is $10. The farmer aims to maximize his total profit from the crops while considering the water usage and its cost. The total available land is 50 acres, and the farmer has a budget of $1000 for water costs. Please help the farmer to maximize the net profit per unit of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W - 10 * 2 * W\nProfit_C = 300 * C - 10 * 3 * C\nProfit_S = 250 * S - 10 * 2.5 * S\nWaterUsage = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The total available land is 50 acres.\nmodel.addCons(W + C + S <= 50)\n## The farmer has a budget of $1000 for water costs.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 1000 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The revenue from component A: R_A = 50 * A\n// The revenue from component B: R_B = 70 * B\n// The revenue from component C: R_C = 60 * C\n// The production cost for component A: C_A = 0.01 * A^2\n// The production cost for component B: C_B = 0.02 * B^2\n// The production cost for component C: C_C = 0.015 * C^2\n// So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe availability of a critical raw material limits the production of component A to at most 50 units.\n// A <= 50\n\n## Generate Constraint-3:\nThe production of component B is limited by a specialized machine that can only handle up to 40 units per day.\n// B <= 40\n\n## Generate Constraint-4:\nThe company has a contract to produce at least 20 units of component C per day.\n// C >= 20",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n\n| Component | Profit per Unit | Production Cost Formula |\n|-----------|-----------------|--------------------------|\n| A         | $50             | 0.01 * A^2               |\n| B         | $70             | 0.02 * B^2               |\n| C         | $60             | 0.015 * C^2              |\n\nThe total production capacity is limited to 100 units per day. The availability of a critical raw material limits the production of component A to at most 50 units. The production of component B is limited by a specialized machine that can only handle up to 40 units per day. The company has a contract to produce at least 20 units of component C per day.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each component A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\n\n# Define objective function\n## The revenue from component A: R_A = 50 * A\n## The revenue from component B: R_B = 70 * B\n## The revenue from component C: R_C = 60 * C\n## The production cost for component A: C_A = 0.01 * A^2\n## The production cost for component B: C_B = 0.02 * B^2\n## The production cost for component C: C_C = 0.015 * C^2\n## So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\nR_A = 50 * A\nR_B = 70 * B\nR_C = 60 * C\nC_A = 0.01 * A**2\nC_B = 0.02 * B**2\nC_C = 0.015 * C**2\nProfit = R_A - C_A + R_B - C_B + R_C - C_C\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The availability of a critical raw material limits the production of component A to at most 50 units.\nmodel.addCons(A <= 50)\n## The production of component B is limited by a specialized machine that can only handle up to 40 units per day.\nmodel.addCons(B <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1430,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 800 units.\n// S + T <= 800",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit from each device varies with the number of units produced due to economies of scale and market saturation, and is given by the following profit functions:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\n\nThe objective is to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L.\n\nThe company faces the following constraints:\n1. The total production capacity of the factory is limited to 1000 units per month.\n2. The market demand for smartphones and tablets combined should not exceed 800 units.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nP_S = 100 * S - 0.1 * S**2\nP_T = 150 * T - 0.2 * T**2\nP_L = 200 * L - 0.3 * L**2\n## the objective function is: Maximize P_total = P_S + P_T + P_L\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n## The market demand for smartphones and tablets combined should not exceed 800 units.\nmodel.addCons(S + T <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the crops require different amounts of water and fertilizer, which affects the overall profitability. Crop A requires 2 units of water and 1 unit of fertilizer per acre, crop B requires 3 units of water and 2 units of fertilizer per acre, and crop C requires 4 units of water and 3 units of fertilizer per acre. The farm aims to maximize the total profit per unit of resource used (water and fertilizer combined).\n// Profit per acre of A: Profit_A = 500 * A\n// Profit per acre of B: Profit_B = 700 * B\n// Profit per acre of C: Profit_C = 900 * C\n// Resource usage for A: Resource_A = 2 * A + 1 * A = 3 * A\n// Resource usage for B: Resource_B = 3 * B + 2 * B = 5 * B\n// Resource usage for C: Resource_C = 4 * C + 3 * C = 7 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of fertilizer available.\n// 1 * A + 2 * B + 3 * C <= 50",
        "question": "A farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop. The profit per acre and the resource requirements (water and fertilizer) for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water per Acre | Fertilizer per Acre |\n|------|-----------------|----------------|----------------------|\n| A    | $500            | 2 units        | 1 unit               |\n| B    | $700            | 3 units        | 2 units              |\n| C    | $900            | 4 units        | 3 units              |\n\nThe farm has a total of 100 units of water available and 50 units of fertilizer available. The farm aims to maximize the total profit per unit of resource used (water and fertilizer combined). Please help the farm determine the optimal allocation of acres for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nResource_A = 3 * A\nResource_B = 5 * B\nResource_C = 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of fertilizer available.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Resource: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnts\", \"range\": \"DeviceBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnts\", \"range\": \"DeviceCUnts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\n// DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company has a total production capacity of 1000 units for the month. Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnts\", lb=0) # number of units of DeviceB\nDeviceCUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnts\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (20 + 0.05 * DeviceAUnits**2)) * DeviceAUnits\nProfit_DeviceB = (70 - (30 + 0.03 * DeviceBUnts**2)) * DeviceBUnts\nProfit_DeviceC = (90 - (40 + 0.02 * DeviceCUnts**2)) * DeviceCUnts\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000)\n## Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\nmodel.addCons(DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnts))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit.\n// {\"number of MachineA\": \"MachineATeams\", \"range\": \"MachineATeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBTeams\", \"range\": \"MachineBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCTeams\", \"range\": \"MachineCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n// Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n// Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 machines.\n// MachineATeams + MachineBTeams + MachineCTeams <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\n// MachineCTeams <= MachineATeams + MachineBTeams\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs. The cost to produce MachineA is $100 per unit, MachineB is $150 per unit, and MachineC is $200 per unit.\n// 100 * MachineATeams + 150 * MachineBTeams + 200 * MachineCTeams <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one of each type of machine is produced.\n// MachineATeams >= 1; MachineBTeams >= 1; MachineCTeams >= 1",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit. The profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company has a total production capacity of 50 machines. Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB. The company has a budget of $20,000 for production costs. The cost to produce MachineA is $100 per unit, MachineB is $150 per unit, and MachineC is $200 per unit. The company wants to ensure that at least one of each type of machine is produced. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineATeams = model.addVar(vtype=\"INTEGER\", name=\"MachineATeams\", lb=1)  # number of MachineA\nMachineBTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineBTeams\", lb=1)  # number of MachineB\nMachineCTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineCTeams\", lb=1)  # number of MachineC\n\n# Define objective function\n## Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n## Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n## Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n## So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nProfit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\nProfit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\nProfit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 50 machines.\nmodel.addCons(MachineATeams + MachineBTeams + MachineCTeams <= 50)\n## Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\nmodel.addCons(MachineCTeams <= MachineATeams + MachineBTeams)\n## The company has a budget of $20,000 for production costs.\nmodel.addCons(100 * MachineATeams + 150 * MachineBTeams + 200 * MachineCTeams <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineATeams))\n    print(\"Number of MachineB: \", model.getVal(MachineBTeams))\n    print(\"Number of MachineC: \", model.getVal(MachineCTeams))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for Wheat is 5 tons, for Corn is 6 tons, and for Soybeans is 4 tons. The price per ton of Wheat is $200, of Corn is $250, and of Soybeans is $300. The farmer wants to maximize the total revenue from the crops.\n// Revenue_Wheat = 5 * $200 * Wheat\n// Revenue_Corn = 6 * $250 * Corn\n// Revenue_Soybeans = 4 * $300 * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total available land for planting is 100 hectares.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80.\n// $100 * Wheat + $120 * Corn + $80 * Soybeans <= 15000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\n// Soybeans >= 0.3 * (Wheat + Corn + Soybeans)\n\n## Generate Constraint-4:\nThe farmer has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares due to limited labor availability.\n// Corn + Soybeans <= 60\n\n## Generate Constraint-5:\nThe farmer wants to ensure that the area of Wheat does not exceed 40% of the total land area.\n// Wheat <= 0.4 * (Wheat + Corn + Soybeans)",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop. The yield per hectare for Wheat is 5 tons, for Corn is 6 tons, and for Soybeans is 4 tons. The price per ton of Wheat is $200, of Corn is $250, and of Soybeans is $300. The farmer wants to maximize the total revenue from the crops. The total available land for planting is 100 hectares. The farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80. The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health. The farmer has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares due to limited labor availability. The farmer also wants to ensure that the area of Wheat does not exceed 40% of the total land area. Please help the farmer to maximize the total revenue from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0)  # area of land for Wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0)  # area of land for Corn\nSoybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Soybeans\", lb=0)  # area of land for Soybeans\n\n# Define objective function\nRevenue_Wheat = 5 * 200 * Wheat\nRevenue_Corn = 6 * 250 * Corn\nRevenue_Soybeans = 4 * 300 * Soybeans\n# So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n# The total available land for planting is 100 hectares.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The farmer has a budget constraint for fertilizers and pesticides, which is $15,000.\nmodel.addCons(100 * Wheat + 120 * Corn + 80 * Soybeans <= 15000)\n# The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\nmodel.addCons(Soybeans >= 0.3 * (Wheat + Corn + Soybeans))\n# The farmer has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares.\nmodel.addCons(Corn + Soybeans <= 60)\n# The farmer wants to ensure that the area of Wheat does not exceed 40% of the total land area.\nmodel.addCons(Wheat <= 0.4 * (Wheat + Corn + Soybeans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly as more acres are planted. Specifically, the profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops.\n// Profit_W = (100 - 0.001 * (W - 50) * W) * W\n// Profit_C = (150 - 0.001 * (C - 50) * C) * C\n// Profit_S = (120 - 0.001 * (S - 50) * S) * S\n// So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Generate Constraint-1:\nThe farm has a total of 200 acres available for planting.\n// W + C + S <= 200",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops. The farm has a total of 200 acres available for planting.\nPlease help the farm determine the optimal allocation of acres to Wheat, Corn, and Soybeans to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of Wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop\n## Profit_W = (100 - 0.001 * (W - 50) * W) * W\n## Profit_C = (150 - 0.001 * (C - 50) * C) * C\n## Profit_S = (120 - 0.001 * (S - 50) * S) * S\n## So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Convert the non-linear objective to a linear one using additional variables and constraints\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=50)\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=50, ub=200)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nmodel.addCons(W_b1 + W_b2 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2)\nProfit_W = (100 - 0.001 * (W1 - 50) * W1) * W1 * W_b1 + (100 - 0.001 * (W2 - 50) * W2) * W2 * W_b2\n\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=50, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (150 - 0.001 * (C1 - 50) * C1) * C1 * C_b1 + (150 - 0.001 * (C2 - 50) * C2) * C2 * C_b2\n\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=50, ub=200)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = (120 - 0.001 * (S1 - 50) * S1) * S1 * S_b1 + (120 - 0.001 * (S2 - 50) * S2) * S2 * S_b2\n\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\nmodel.addCons(W + C + S <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\n// 1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000\n\n## Generate Constraint-4:\nThe farm must allocate at least 20 acres to Crop A.\n// AreaA >= 20\n\n## Generate Constraint-5:\nThe farm must allocate at least 15 acres to Crop B.\n// AreaB >= 15",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and consider investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops. The total area available for cultivation is 100 acres. The farm has a budget of $50,000 for irrigation investments. The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre, with a total water supply of 120,000 gallons. The farm must allocate at least 20 acres to Crop A and at least 15 acres to Crop B. Please help the farm determine the optimal allocation of area and investment in irrigation to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=20)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=15)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)    # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\nmodel.addCons(AreaA + AreaB + AreaC <= 100)  # total area available for cultivation\nmodel.addCons(Irrigation <= 50000)  # budget for irrigation investments\nmodel.addCons(1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000)  # total water supply\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1354,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of raw materials and the market demand.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to the complexity of the components, the profit per unit decreases by $0.02 for each additional unit produced beyond the first 100 units for each component. The manufacturer wants to maximize the total profit from selling the components.\n// Profit_A = (10 - 0.02 * (A - 100)) * A if A > 100 else 10 * A\n// Profit_B = (15 - 0.02 * (B - 100)) * B if B > 100 else 15 * B\n// Profit_C = (20 - 0.02 * (C - 100)) * C if C > 100 else 20 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe cost of raw materials for component A is $3 per unit, for B is $4 per unit, and for C is $5 per unit. The total budget for raw materials is $1000.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 600 units in terms of the number of units it can produce.\n// A + B + C <= 600",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of raw materials and the market demand.\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to the complexity of the components, the profit per unit decreases by $0.02 for each additional unit produced beyond the first 100 units for each component. The manufacturer wants to maximize the total profit from selling the components.\nThe cost of raw materials for component A is $3 per unit, for B is $4 per unit, and for C is $5 per unit. The total budget for raw materials is $1000. The market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units. The manufacturer has a production capacity of 600 units in terms of the number of units it can produce.\nPlease help the manufacturer determine the optimal production quantities for components A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * (A - 100)) * A if A > 100 else 10 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.02 * (B - 100)) * B if B > 100 else 15 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.02 * (C - 100)) * C if C > 100 else 20 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the number of each type of cake to bake in the next month to maximize profit while considering the limited resources.\n// {\"number of chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20, costs $10 to make, and requires 2 hours of labor. Each vanilla cake sells for $15, costs $8 to make, and requires 1.5 hours of labor. Each strawberry cake sells for $18, costs $9 to make, and requires 1.8 hours of labor. The bakery aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from chocolate cakes: Profit_C = (20 - 10) * C\n// Profit from vanilla cakes: Profit_V = (15 - 8) * V\n// Profit from strawberry cakes: Profit_S = (18 - 9) * S\n// Total labor hours: Labor = 2 * C + 1.5 * V + 1.8 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / Labor\n\n## Generate Constraint-1:\nThe bakery has a budget of $2000 for ingredients.\n// 10 * C + 8 * V + 9 * S <= 2000\n\n## Generate Constraint-2:\nThe bakery has a maximum of 150 labor hours available.\n// 2 * C + 1.5 * V + 1.8 * S <= 150\n\n## Generate Constraint-3:\nThe bakery wants to ensure at least 50 cakes of each type are produced.\n// C >= 50; V >= 50; S >= 50",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the number of each type of cake to bake in the next month to maximize profit while considering the limited resources. The selling price, cost to make, and labor hours required for each type of cake are given in the following Table.\n\n| Cake Type | Selling Price | Cost to Make | Labor Hours Required |\n|-----------|---------------|--------------|----------------------|\n| Chocolate | $20           | $10          | 2 hours              |\n| Vanilla   | $15           | $8           | 1.5 hours            |\n| Strawberry| $18           | $9           | 1.8 hours            |\n\nThe bakery has a budget of $2000 for ingredients. The bakery has a maximum of 150 labor hours available. The bakery wants to ensure at least 50 cakes of each type are produced. Please help the bakery to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to ensure at least 50 cakes of each type are produced.\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=50) # number of vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (20 - 10) * C\nProfit_V = (15 - 8) * V\nProfit_S = (18 - 9) * S\nLabor = 2 * C + 1.5 * V + 1.8 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a budget of $2000 for ingredients.\nmodel.addCons(10 * C + 8 * V + 9 * S <= 2000)\n## The bakery has a maximum of 150 labor hours available.\nmodel.addCons(2 * C + 1.5 * V + 1.8 * S <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(C))\n    print(\"Number of Vanilla Cakes: \", model.getVal(V))\n    print(\"Number of Strawberry Cakes: \", model.getVal(S))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide the amount of raw materials (flour) to allocate to each type of bread and the number of hours of labor to invest in each production line.\n// {\"amount of flour for wheat bread\": \"Flour_W\", \"range\": \"Flour_W >= 0\", \"type\": \"continuous\"}\n// {\"amount of flour for rye bread\": \"Flour_R\", \"range\": \"Flour_R >= 0\", \"type\": \"continuous\"}\n// {\"amount of flour for sourdough bread\": \"Flour_S\", \"range\": \"Flour_S >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for wheat bread\": \"Labor_W\", \"range\": \"Labor_W >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for rye bread\": \"Labor_R\", \"range\": \"Labor_R >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for sourdough bread\": \"Labor_S\", \"range\": \"Labor_S >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its profit from selling the bread. The profit from wheat bread is $5 per kg of flour, from rye bread is $6 per kg of flour, and from sourdough bread is $7 per kg of flour. The labor cost is $10 per hour. The bakery's profit function is nonlinear due to the varying profit rates per kg of flour for different bread types.\n// Profit_W = 5 * Flour_W - 10 * Labor_W\n// Profit_R = 6 * Flour_R - 10 * Labor_R\n// Profit_S = 7 * Flour_S - 10 * Labor_S\n// Total Profit = Profit_W + Profit_R + Profit_S\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total amount of flour available is 1000 kg.\n// Flour_W + Flour_R + Flour_S <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available are 500 hours.\n// Labor_W + Labor_R + Labor_S <= 500",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide the amount of raw materials (flour) to allocate to each type of bread and the number of hours of labor to invest in each production line. The profit from wheat bread is $5 per kg of flour, from rye bread is $6 per kg of flour, and from sourdough bread is $7 per kg of flour. The labor cost is $10 per hour. The total amount of flour available is 1000 kg, and the total labor hours available are 500 hours. The bakery's profit function is nonlinear due to the varying profit rates per kg of flour for different bread types. Please help the bakery to maximize its total profit from selling the bread.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlour_W = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_W\", lb=0) # amount of flour for wheat bread\nFlour_R = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_R\", lb=0) # amount of flour for rye bread\nFlour_S = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_S\", lb=0) # amount of flour for sourdough bread\nLabor_W = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_W\", lb=0) # labor hours for wheat bread\nLabor_R = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_R\", lb=0) # labor hours for rye bread\nLabor_S = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_S\", lb=0) # labor hours for sourdough bread\n\n# Define objective function\nProfit_W = 5 * Flour_W - 10 * Labor_W\nProfit_R = 6 * Flour_R - 10 * Labor_R\nProfit_S = 7 * Flour_S - 10 * Labor_S\nTotal_Profit = Profit_W + Profit_R + Profit_S\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(Flour_W + Flour_R + Flour_S <= 1000) # total amount of flour available is 1000 kg\nmodel.addCons(Labor_W + Labor_R + Labor_S <= 500) # total labor hours available are 500 hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Flour for Wheat Bread: \", model.getVal(Flour_W))\n    print(\"Amount of Flour for Rye Bread: \", model.getVal(Flour_R))\n    print(\"Amount of Flour for Sourdough Bread: \", model.getVal(Flour_S))\n    print(\"Labor Hours for Wheat Bread: \", model.getVal(Labor_W))\n    print(\"Labor Hours for Rye Bread: \", model.getVal(Labor_R))\n    print(\"Labor Hours for Sourdough Bread: \", model.getVal(Labor_S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturing plant incurs different costs for producing each component. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The plant also has a fixed overhead cost of $500 per day. The plant aims to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost divided by the total number of units produced.\n// Variable cost of A: Cost_A = 10 * A\n// Variable cost of B: Cost_B = 15 * B\n// Variable cost of C: Cost_C = 20 * C\n// Total cost: Total_Cost = (Cost_A + Cost_B + Cost_C + 500) / (A + B + C)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C + 500 <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each component to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe plant has a limited production capacity, with a maximum of 150 units of all components combined.\n// A + B + C <= 150",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency. The cost of producing each component and the fixed overhead cost are given in the following Table.\n\n| Component | Production Cost per Unit |\n|-----------|--------------------------|\n| A         | $10                      |\n| B         | $15                      |\n| C         | $20                      |\n\nThe plant has a daily budget of $1000 for production costs. The plant must produce at least 50 units of each component to meet contractual obligations. The plant has a limited production capacity, with a maximum of 150 units of all components combined. \n\nPlease help the plant to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost of $500 per day divided by the total number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each component to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nTotal_Cost = Cost_A + Cost_B + Cost_C + 500\nTotal_Units = A + B + C\n## the objective function is: Minimize Total_Cost / Total_Units\n## convert the division to multiplication\nmodel.addCons(obj * Total_Units == Total_Cost)\n\n# Add constraints\n## The plant has a daily budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 500 <= 1000)\n## The plant has a limited production capacity, with a maximum of 150 units of all components combined.\nmodel.addCons(A + B + C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours.\n// {\"number of wheat bread batches\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach batch of wheat bread yields a profit of $10, rye bread yields $15, and sourdough bread yields $20. The bakery aims to maximize the total daily profit from selling these bread types.\n// The objective function is: Maximize P = 10W + 15R + 20S\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available daily. Each batch of wheat bread requires 2 hours, rye bread requires 3 hours, and sourdough bread requires 4 hours of labor.\n// 2W + 3R + 4S <= 100\n\n## Generate Constraint-2:\nThe oven space is limited, allowing for a maximum of 30 batches to be baked daily.\n// W + R + S <= 30",
        "question": "A small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours. The profit per batch for each type of bread is as follows: wheat bread yields $10, rye bread yields $15, and sourdough bread yields $20.\n\n| Bread Type | Profit per Batch | Labor Hours per Batch |\n|------------|------------------|-----------------------|\n| Wheat      | $10              | 2 hours               |\n| Rye        | $15              | 3 hours               |\n| Sourdough  | $20              | 4 hours               |\n\nThe bakery has a total of 100 labor hours available daily. Each batch of wheat bread requires 2 hours, rye bread requires 3 hours, and sourdough bread requires 4 hours of labor. The oven space is limited, allowing for a maximum of 30 batches to be baked daily.\n\nPlease help the bakery to maximize the total daily profit from selling these bread types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread batches\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread batches\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread batches\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 10W + 15R + 20S\nmodel.addCons(obj == 10*W + 15*R + 20*S)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*W + 3*R + 4*S <= 100)\n## The oven space is limited, allowing for a maximum of 30 batches to be baked daily.\nmodel.addCons(W + R + S <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Batches: \", model.getVal(W))\n    print(\"Number of Rye Bread Batches: \", model.getVal(R))\n    print(\"Number of Sourdough Bread Batches: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nThe investment in production efficiency cannot exceed $50,000.\n// Efficiency <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type (Product 1, Product 2, and Product 3) and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency, where for every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product. The total available hours for production in a week is 40 hours, and the investment in production efficiency cannot exceed $50,000. Please help the company to minimize the maximum production time among the three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n## Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n## Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = 1000 * H1 / (10 + 0.001 * Efficiency)\nT2 = 1000 * H2 / (10 + 0.001 * Efficiency)\nT3 = 1000 * H3 / (10 + 0.001 * Efficiency)\n\n## Use auxiliary variables to represent max function\nTmax1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tmax1\")\nTmax2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tmax2\")\nmodel.addCons(Tmax1 >= T1)\nmodel.addCons(Tmax1 >= T2)\nmodel.addCons(Tmax2 >= Tmax1)\nmodel.addCons(Tmax2 >= T3)\nmodel.addCons(obj == Tmax2)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## The investment in production efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\n// {\"hours reactor 1 operates\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 2 operates\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 3 operates\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\n// Total production of chemical A: P_A = 10 * R1 + 7 * R2 + 9 * R3\n// Total production of chemical B: P_B = 5 * R1 + 12 * R2 + 8 * R3\n// Total production of chemical C: P_C = 8 * R1 + 6 * R2 + 10 * R3\n// The objective function is: Maximize (P_A + P_B + P_C) / (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total operational hours for all reactors must not exceed 100 hours.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nEach reactor has a minimum operational requirement of 20 hours to ensure proper functioning.\n// R1 >= 20; R2 >= 20; R3 >= 20\n\n## Generate Constraint-3:\nThe production of chemical B must be at least twice the production of chemical A.\n// P_B >= 2 * P_A\n// 5 * R1 + 12 * R2 + 8 * R3 >= 2 * (10 * R1 + 7 * R2 + 9 * R3)",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. Each hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours. The total operational hours for all reactors must not exceed 100 hours. Each reactor has a minimum operational requirement of 20 hours to ensure proper functioning. The production of chemical B must be at least twice the production of chemical A. Please help the manager decide how many hours each reactor should operate to optimize production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=20) # hours reactor 1 operates\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=20) # hours reactor 2 operates\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=20) # hours reactor 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 10 * R1 + 7 * R2 + 9 * R3\nP_B = 5 * R1 + 12 * R2 + 8 * R3\nP_C = 8 * R1 + 6 * R2 + 10 * R3\nTotalProduction = P_A + P_B + P_C\nTotalHours = R1 + R2 + R3\n## the objective function is: Maximize (P_A + P_B + P_C) / TotalHours\n## convert the division to multiplication\nmodel.addCons(obj * TotalHours == TotalProduction)\n\n# Add constraints\n## The total operational hours for all reactors must not exceed 100 hours.\nmodel.addCons(R1 + R2 + R3 <= 100)\n## The production of chemical B must be at least twice the production of chemical A.\nmodel.addCons(5 * R1 + 12 * R2 + 8 * R3 >= 2 * (10 * R1 + 7 * R2 + 9 * R3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Reactor 1 Operates: \", model.getVal(R1))\n    print(\"Hours Reactor 2 Operates: \", model.getVal(R2))\n    print(\"Hours Reactor 3 Operates: \", model.getVal(R3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $20, for B is $30, and for C is $40. The selling price for A is $50, for B is $60, and for C is $70. The plant has a limited production capacity and aims to maximize the profit per unit of production capacity used.\n// Profit for A: Profit_A = (50 - 20) * A\n// Profit for B: Profit_B = (60 - 30) * B\n// Profit for C: Profit_C = (70 - 40) * C\n// Production capacity used for A: Cap_A = A\n// Production capacity used for B: Cap_B = 2 * B\n// Production capacity used for C: Cap_C = 3 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n\n## Generate Constraint-1:\nThe total production cost must not exceed $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of component A and 30 units of component B.\n// A >= 50; B >= 30",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit. The production cost for component A is $20, for B is $30, and for C is $40. The selling price for A is $50, for B is $60, and for C is $70. The plant has a limited production capacity and aims to maximize the profit per unit of production capacity used. The total production cost must not exceed $10,000. The plant must produce at least 50 units of component A and 30 units of component B.\nPlease help the plant to determine the optimal number of each component to produce to maximize the profit per unit of production capacity used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of component A and 30 units of component B.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (60 - 30) * B\nProfit_C = (70 - 40) * C\nCap_A = A\nCap_B = 2 * B\nCap_C = 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Cap_A + Cap_B + Cap_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production cost must not exceed $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\n// Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\n// Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for each device decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n\n| Device | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|--------|-----------------------------------|------------------------------------|-----------|\n| DeviceA | $50                              | $0.1                               | 100 units  |\n| DeviceB | $70                              | $0.05                              | 200 units  |\n| DeviceC | $90                              | $0.02                              | 300 units  |\n\nThe company has a total production capacity of 500 units. Please help the company determine the optimal production quantity for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAProduction == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBProduction == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCProduction == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 90 * DeviceC1 * DeviceC_b1 + (90 - 0.02 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1360,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. The efficiency rates and the value per unit of each product are given in the following Table.\n\n| Production Line | Units Produced per Hour | Value per Unit |\n|-----------------|-------------------------|----------------|\n| A               | 10                      | $5             |\n| B               | 15                      | $7             |\n| C               | 20                      | $9             |\n\nThe plant aims to maximize the total production value. The total operating hours for all production lines must not exceed 100 hours per week. Please help the plant manager determine the optimal number of hours each production line should operate to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\n## The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize V\nmodel.addCons(obj == V)\n\n# Add constraints\n## The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P_A + P_B + P_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles.\n// Fuel_Cost_Truck = 100 * sqrt(Truck)\n// Fuel_Cost_Van = 70 * sqrt(Van)\n// Fuel_Cost_Bike = 20 * sqrt(Bike)\n// So, the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle.\n// 500 * Truck + 300 * Van + 100 * Bike <= 10000\n\n## Generate Constraint-2:\nThe total capacity of all vehicles must be at least 500 cubic meters. Trucks have a capacity of 50 cubic meters, Vans have a capacity of 20 cubic meters, and Bikes have a capacity of 5 cubic meters.\n// 50 * Truck + 20 * Van + 5 * Bike >= 500",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency, capacity, and maintenance costs. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles. The fuel cost, maintenance cost, and capacity for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Cost per Mile | Maintenance Cost per Vehicle | Capacity |\n|---------|--------------------|------------------------------|----------|\n| Truck   | $100               | $500                         | 50 cubic meters |\n| Van     | $70                | $300                         | 20 cubic meters |\n| Bike    | $20                | $100                         | 5 cubic meters |\n\nThe company has a budget of $10,000 for vehicle maintenance. The total capacity of all vehicles must be at least 500 cubic meters. Please help the company determine the optimal number of each type of vehicle to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n## convert the square root to a variable\nsqrt_Truck = model.addVar(name=\"sqrt_Truck\")\nsqrt_Van = model.addVar(name=\"sqrt_Van\")\nsqrt_Bike = model.addVar(name=\"sqrt_Bike\")\nmodel.addCons(sqrt_Truck * sqrt_Truck == Truck)\nmodel.addCons(sqrt_Van * sqrt_Van == Van)\nmodel.addCons(sqrt_Bike * sqrt_Bike == Bike)\nFuel_Cost_Truck = 100 * sqrt_Truck\nFuel_Cost_Van = 70 * sqrt_Van\nFuel_Cost_Bike = 20 * sqrt_Bike\nmodel.addCons(obj == Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(500 * Truck + 300 * Van + 100 * Bike <= 10000)\n## The total capacity of all vehicles must be at least 500 cubic meters.\nmodel.addCons(50 * Truck + 20 * Van + 5 * Bike >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements from distributors.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for product A is limited to 300 units due to equipment limitations.\n// A <= 300",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. Product A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature. Product B has a unit profit of $70, with a storage cost of $5 per unit. Product C has a unit profit of $60, with no storage cost. The company wants to maximize its net profit, which is the total profit minus the total storage cost. The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively. The company must produce at least 200 units in total to meet the minimum order requirements from distributors. The production capacity for product A is limited to 300 units due to equipment limitations. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Cost = 10 * A + 5 * B\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements from distributors.\nmodel.addCons(A + B + C >= 200)\n## The production capacity for product A is limited to 300 units due to equipment limitations.\nmodel.addCons(A <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company wants to maximize the net profit per dollar invested.\n// Total revenue: Revenue = 200,000 * Trucks + 100,000 * Vans + 20,000 * Bikes\n// Total cost: Cost = (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes) + (10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes)\n// Net profit: Profit = Revenue - Cost\n// So, the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for vehicle purchases.\n// 100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes <= 5,000,000",
        "question": "A logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities. The cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company has a budget of $5,000,000 for vehicle purchases. The company wants to maximize the net profit per dollar invested. Please help the company determine the optimal number of Trucks, Vans, and Bikes to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 200000 * Trucks + 100000 * Vans + 20000 * Bikes\nPurchaseCost = 100000 * Trucks + 50000 * Vans + 10000 * Bikes\nMaintenanceCost = 10000 * Trucks + 5000 * Vans + 1000 * Bikes\nCost = PurchaseCost + MaintenanceCost\nProfit = Revenue - Cost\n## the objective function is: Maximize Profit / PurchaseCost\n## convert the division to multiplication\nmodel.addCons(obj * PurchaseCost == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for vehicle purchases.\nmodel.addCons(PurchaseCost <= 5000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Net Profit per Dollar Invested: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 771,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $300, and the water requirement is 5000 liters.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $500, and the water requirement is 7000 liters.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $700, and the water requirement is 9000 liters.\nThe farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n// Net revenue of A: Net_A = (1000 - 300) * A\n// Net revenue of B: Net_B = (1500 - 500) * B\n// Net revenue of C: Net_C = (2000 - 700) * C\n// So, the objective function is: Maximize (Net_A + Net_B + Net_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $10000 for seeds for the upcoming season.\n// 300 * A + 500 * B + 700 * C <= 10000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season. The expected revenue per hectare, cost of seeds per hectare, and water requirement for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Hectare | Cost of Seeds per Hectare | Water Requirement per Hectare |\n|------|-------------------------------|---------------------------|-------------------------------|\n| A    | $1000                         | $300                      | 5000 liters                   |\n| B    | $1500                         | $500                      | 7000 liters                   |\n| C    | $2000                         | $700                      | 9000 liters                   |\n\nThe farm has a budget of $10000 for seeds for the upcoming season. The farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\nPlease help the farm determine the optimal allocation of hectares to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_A = (1000 - 300) * A\nNet_B = (1500 - 500) * B\nNet_C = (2000 - 700) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_A + Net_B + Net_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_A + Net_B + Net_C)\n\n# Add constraints\n## The farm has a budget of $10000 for seeds for the upcoming season.\nmodel.addCons(300 * A + 500 * B + 700 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\n// {\"area of G1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of G2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of G3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The farm aims to maximize the net profit (yield * price per kg - energy cost). The price per kg of the crop is $2.\n// Profit_G1 = 10 * A1 * 2 - 5 * A1\n// Profit_G2 = 15 * A2 * 2 - 7 * A2\n// Profit_G3 = 20 * A3 * 2 - 9 * A3\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\n\n## Generate Constraint-1:\nThe total area available for all greenhouses is 1000 square meters.\n// A1 + A2 + A3 <= 1000\n\n## Generate Constraint-2:\nThe total energy budget for the farm is $8000.\n// 5 * A1 + 7 * A2 + 9 * A3 <= 8000\n\n## Generate Constraint-3:\nThe farm has a minimum yield requirement of 12000 kg.\n// 10 * A1 + 15 * A2 + 20 * A3 >= 12000",
        "question": "A farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation. The yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The price per kg of the crop is $2. The farm aims to maximize the net profit (yield * price per kg - energy cost). The total area available for all greenhouses is 1000 square meters. The total energy budget for the farm is $8000. The farm has a minimum yield requirement of 12000 kg. Please help the farm to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of G1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of G2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of G3\n\n# Define objective function\nProfit_G1 = 10 * A1 * 2 - 5 * A1\nProfit_G2 = 15 * A2 * 2 - 7 * A2\nProfit_G3 = 20 * A3 * 2 - 9 * A3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_G1 + Profit_G2 + Profit_G3)\n\n# Add constraints\n# The total area available for all greenhouses is 1000 square meters.\nmodel.addCons(A1 + A2 + A3 <= 1000)\n# The total energy budget for the farm is $8000.\nmodel.addCons(5 * A1 + 7 * A2 + 9 * A3 <= 8000)\n# The farm has a minimum yield requirement of 12000 kg.\nmodel.addCons(10 * A1 + 15 * A2 + 20 * A3 >= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of G1: \", model.getVal(A1))\n    print(\"Area of G2: \", model.getVal(A2))\n    print(\"Area of G3: \", model.getVal(A3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product and the level of advertising investment for each product to maximize profit.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"advertising investment for product A\": \"AdInvestA\", \"range\": \"AdInvestA >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product B\": \"AdInvestB\", \"range\": \"AdInvestB >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product C\": \"AdInvestC\", \"range\": \"AdInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Advertising increases the sales of each product nonlinearly, with an increase in sales proportional to the square of the advertising investment. The company aims to maximize total profit.\n// Profit from product A: ProfitA = (50 * ProductA) - AdInvestA + 0.1 * (AdInvestA^2)\n// Profit from product B: ProfitB = (70 * ProductB) - AdInvestB + 0.15 * (AdInvestB^2)\n// Profit from product C: ProfitC = (60 * ProductC) - AdInvestC + 0.12 * (AdInvestC^2)\n// Total profit: TotalProfit = ProfitA + ProfitB + ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total advertising budget is $10,000.\n// AdInvestA + AdInvestB + AdInvestC <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is 1000 units, for product B is 1500 units, and for product C is 1200 units.\n// ProductA <= 1000\n// ProductB <= 1500\n// ProductC <= 1200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product and the level of advertising investment for each product to maximize profit. The profit per unit of product A is $50, product B is $70, and product C is $60. Advertising increases the sales of each product nonlinearly, with an increase in sales proportional to the square of the advertising investment. The company aims to maximize total profit. The total advertising budget is $10,000. The production capacity for product A is 1000 units, for product B is 1500 units, and for product C is 1200 units.\nPlease help the company determine the optimal production quantities and advertising investments for each product to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # production quantity of product C\nAdInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestA\", lb=0) # advertising investment for product A\nAdInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestB\", lb=0) # advertising investment for product B\nAdInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestC\", lb=0) # advertising investment for product C\n\n# Define objective function\n## Profit from product A: ProfitA = (50 * ProductA) - AdInvestA + 0.1 * (AdInvestA^2)\n## Profit from product B: ProfitB = (70 * ProductB) - AdInvestB + 0.15 * (AdInvestB^2)\n## Profit from product C: ProfitC = (60 * ProductC) - AdInvestC + 0.12 * (AdInvestC^2)\n## Total profit: TotalProfit = ProfitA + ProfitB + ProfitC\nProfitA = 50 * ProductA - AdInvestA + 0.1 * AdInvestA**2\nProfitB = 70 * ProductB - AdInvestB + 0.15 * AdInvestB**2\nProfitC = 60 * ProductC - AdInvestC + 0.12 * AdInvestC**2\nTotalProfit = ProfitA + ProfitB + ProfitC\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The total advertising budget is $10,000.\nmodel.addCons(AdInvestA + AdInvestB + AdInvestC <= 10000)\n## The production capacity for product A is 1000 units, for product B is 1500 units, and for product C is 1200 units.\nmodel.addCons(ProductA <= 1000)\nmodel.addCons(ProductB <= 1500)\nmodel.addCons(ProductC <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Advertising Investment for Product A: \", model.getVal(AdInvestA))\n    print(\"Advertising Investment for Product B: \", model.getVal(AdInvestB))\n    print(\"Advertising Investment for Product C: \", model.getVal(AdInvestC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of pastries: Croissant, Danish, and Muffin. They need to determine the quantities of each pastry to produce daily.\n// {\"quantity of Croissant\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"quantity of Danish\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"quantity of Muffin\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Croissant is $2, for Danish is $3, and for Muffin is $2.50. Due to economies of scale, the bakery experiences a 0.5% increase in profit per unit for each pastry type if production exceeds 100 units. The bakery aims to maximize its total daily profit from selling these pastries.\n// Profit_Croissant = max(2 + 0.005 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.005 * (Danish - 100), 3) * Danish\n// Profit_Muffin = max(2.5 + 0.005 * (Muffin - 100), 2.5) * Muffin\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_Muffin\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms.\n// 50 * Croissant + 70 * Danish + 60 * Muffin <= 10000\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 pastries in total.\n// Croissant + Danish + Muffin <= 500\n\n## Generate Constraint-3:\nThe market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units.\n// Croissant <= 250; Danish <= 300; Muffin <= 200\n\n## Generate Constraint-4:\nThe bakery aims to produce at least 100 units of each type of pastry to maintain brand consistency and customer satisfaction.\n// Croissant >= 100; Danish >= 100; Muffin >= 100",
        "question": "A bakery wants to optimize the production of three types of pastries: Croissant, Danish, and Muffin. They need to determine the quantities of each pastry to produce daily. The profit per unit of Croissant is $2, for Danish is $3, and for Muffin is $2.50. Due to economies of scale, the bakery experiences a 0.5% increase in profit per unit for each pastry type if production exceeds 100 units. The bakery aims to maximize its total daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (grams) |\n|----------|-----------------|------------------------|\n| Croissant| 2$              | 50                     |\n| Danish   | 3$              | 70                     |\n| Muffin   | 2.5$            | 60                     |\n\nThe bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms. The bakery has a daily production capacity of 500 pastries in total. The market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units. The bakery aims to produce at least 100 units of each type of pastry to maintain brand consistency and customer satisfaction.\n\nPlease help the bakery to maximize its total daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery aims to produce at least 100 units of each type of pastry to maintain brand consistency and customer satisfaction.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=100) # quantity of Croissant\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=100) # quantity of Danish\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=100) # quantity of Muffin\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.005 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=100, ub=250)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=250)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.005 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.005 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=100, ub=300)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=300)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.005 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_Muffin = max(2.5 + 0.005 * (Muffin - 100), 2.5) * Muffin\nMuffin1 = model.addVar(vtype=\"INTEGER\", name=\"Muffin1\", lb=100, ub=200)\nMuffin2 = model.addVar(vtype=\"INTEGER\", name=\"Muffin2\", lb=100, ub=200)\nMuffin_b1 = model.addVar(vtype=\"B\", name=\"Muffin_b1\")\nMuffin_b2 = model.addVar(vtype=\"B\", name=\"Muffin_b2\")\nmodel.addCons(Muffin_b1 + Muffin_b2 == 1)\nmodel.addCons(Muffin == Muffin1*Muffin_b1 + Muffin2*Muffin_b2)\nProfit_Muffin = 2.5 * Muffin1 * Muffin_b1 + (2.5 + 0.005 * (Muffin2 - 100)) * Muffin2 * Muffin_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_Muffin\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_Muffin)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms.\nmodel.addCons(50 * Croissant + 70 * Danish + 60 * Muffin <= 10000)\n## The bakery has a daily production capacity of 500 pastries in total.\nmodel.addCons(Croissant + Danish + Muffin <= 500)\n## The market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units.\nmodel.addCons(Croissant <= 250)\nmodel.addCons(Danish <= 300)\nmodel.addCons(Muffin <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Croissant: \", model.getVal(Croissant))\n    print(\"Quantity of Danish: \", model.getVal(Danish))\n    print(\"Quantity of Muffin: \", model.getVal(Muffin))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1415,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 100 units.\n// 2 * C1 + 3 * C2 + 4 * C3 <= 100\n\n## Generate Constraint-3:\nThe market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1.\n// C1 <= 20",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for C1 is $1000, but it requires 2 units of water per acre. For C2, the profit per acre is $1200, and it requires 3 units of water per acre. For C3, the profit per acre is $1500, and it requires 4 units of water per acre. The farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water). The farm has a total of 50 acres available for cultivation. The market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1. Please help the farmer to maximize the total profit while considering the water usage efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=20) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n## The farm has a limited water supply of 100 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit from ComponentA: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\n// Profit from ComponentB: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\n// Profit from ComponentC: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// QuantityA + QuantityB + QuantityC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// QuantityB <= 2 * QuantityA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit. The profit from each component decreases as more units are produced beyond certain thresholds. The profit structure for each component is as follows:\n\n| Component | Profit per Unit | Decrease in Profit per Unit Beyond Threshold | Threshold |\n|-----------|-----------------|--------------------------------------------|-----------|\n| ComponentA | $50             | $0.1                                       | 100 units  |\n| ComponentB | $70             | $0.05                                      | 200 units  |\n| ComponentC | $90             | $0.02                                      | 300 units  |\n\nThe company has a total production capacity of 500 units per month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. \n\nPlease help the company to maximize the total profit by determining the optimal production quantities for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ComponentA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ComponentB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(QuantityA == A1*A_b1 + A2*A_b2)\nProfitA = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(QuantityB == B1*B_b1 + B2*B_b2)\nProfitB = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(QuantityC == C1*C_b1 + C2*C_b2)\nProfitC = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 500)\nmodel.addCons(QuantityB <= 2 * QuantityA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(QuantityA))\n    print(\"Quantity of ComponentB: \", model.getVal(QuantityB))\n    print(\"Quantity of ComponentC: \", model.getVal(QuantityC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit.\n// {\"number of units of WidgetA\": \"WidgetAUnits\", \"range\": \"WidgetAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetB\": \"WidgetBUnits\", \"range\": \"WidgetBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetC\": \"WidgetCUnits\", \"range\": \"WidgetCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\n// Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\n// Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetBUnits <= 2 * WidgetAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs, and the cost per unit for WidgetA, WidgetB, and WidgetC are $20, $30, and $40 respectively.\n// 20 * WidgetAUnits + 30 * WidgetBUnits + 40 * WidgetCUnits <= 20,000",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit. The profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. The company has a budget of $20,000 for production costs, and the cost per unit for WidgetA, WidgetB, and WidgetC are $20, $30, and $40 respectively. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetAUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetAUnits\", lb=0) # number of units of WidgetA\nWidgetBUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetBUnits\", lb=0) # number of units of WidgetB\nWidgetCUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetCUnits\", lb=0) # number of units of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetAUnits == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (50 - 0.1 * WidgetA2) * WidgetA2 * WidgetA_b2 + 50 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=200)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=200, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetBUnits == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (70 - 0.05 * WidgetB2) * WidgetB2 * WidgetB_b2 + 70 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=300)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=300, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetCUnits == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (90 - 0.02 * WidgetC2) * WidgetC2 * WidgetC_b2 + 90 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500)\nmodel.addCons(WidgetBUnits <= 2 * WidgetAUnits)\nmodel.addCons(20 * WidgetAUnits + 30 * WidgetBUnits + 40 * WidgetCUnits <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of WidgetA Units: \", model.getVal(WidgetAUnits))\n    print(\"Number of WidgetB Units: \", model.getVal(WidgetBUnits))\n    print(\"Number of WidgetC Units: \", model.getVal(WidgetCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rate of each product, as well as the amount of money invested in improving the production efficiency of each product.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for product 1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5. The company aims to minimize the total production cost while meeting a certain demand.\n// Cost per unit of product 1: C1 = 100 - 0.005 * E1\n// Cost per unit of product 2: C2 = 150 - 0.005 * E2\n// Cost per unit of product 3: C3 = 200 - 0.005 * E3\n// Total production cost: Cost = C1 * P1 + C2 * P2 + C3 * P3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must meet a total demand of at least 1000 units across all products.\n// P1 + P2 + P3 >= 1000\n\n## Generate Constraint-2:\nThe total investment in efficiency improvements cannot exceed $50,000.\n// E1 + E2 + E3 <= 50000\n\n## Generate Constraint-3:\nThe production rate of each product must be at least 10 units per day.\n// P1 >= 10; P2 >= 10; P3 >= 10\n\n## Generate Constraint-4:\nThe company has a budget constraint on the investment in efficiency improvements for each product, with a maximum of $20,000 per product.\n// E1 <= 20000; E2 <= 20000; E3 <= 20000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rate of each product (P1, P2, P3) and the amount of money invested in improving the production efficiency of each product (E1, E2, E3). The cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5. The company aims to minimize the total production cost while meeting a certain demand.\n\n| Product | Cost per Unit | Efficiency Investment Impact |\n|---------|---------------|------------------------------|\n| 1       | 100$          | $1000 reduces cost by $5     |\n| 2       | 150$          | $1000 reduces cost by $5     |\n| 3       | 200$          | $1000 reduces cost by $5     |\n\nThe company must meet a total demand of at least 1000 units across all products. The total investment in efficiency improvements cannot exceed $50,000. The production rate of each product must be at least 10 units per day. The company has a budget constraint on the investment in efficiency improvements for each product, with a maximum of $20,000 per product.\n\nPlease help the company to minimize the total production cost by determining the optimal production rates and efficiency investments for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # production rate of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10) # production rate of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=10) # production rate of product 3\nE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"E1\", lb=0) # investment in efficiency for product 1\nE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"E2\", lb=0) # investment in efficiency for product 2\nE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"E3\", lb=0) # investment in efficiency for product 3\n\n# Define objective function\nC1 = 100 - 0.005 * E1\nC2 = 150 - 0.005 * E2\nC3 = 200 - 0.005 * E3\nCost = C1 * P1 + C2 * P2 + C3 * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 >= 1000) # total demand of at least 1000 units\nmodel.addCons(E1 + E2 + E3 <= 50000) # total investment in efficiency improvements cannot exceed $50,000\nmodel.addCons(E1 <= 20000) # budget constraint on investment in efficiency improvements for product 1\nmodel.addCons(E2 <= 20000) # budget constraint on investment in efficiency improvements for product 2\nmodel.addCons(E3 <= 20000) # budget constraint on investment in efficiency improvements for product 3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of product 1: \", model.getVal(P1))\n    print(\"Production rate of product 2: \", model.getVal(P2))\n    print(\"Production rate of product 3: \", model.getVal(P3))\n    print(\"Investment in efficiency for product 1: \", model.getVal(E1))\n    print(\"Investment in efficiency for product 2: \", model.getVal(E2))\n    print(\"Investment in efficiency for product 3: \", model.getVal(E3))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water usage, where wheat requires 5 units of water per acre, corn requires 8 units, and soybeans require 3 units. The farmer aims to maximize the net profit per unit of water used.\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from soybeans: Profit_S = 150 * S\n// Water usage for wheat: Water_W = 5 * W\n// Water usage for corn: Water_C = 8 * C\n// Water usage for soybeans: Water_S = 3 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (Water_W + Water_C + Water_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// W + C + S <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water usage, where wheat requires 5 units of water per acre, corn requires 8 units, and soybeans require 3 units. The farmer aims to maximize the net profit per unit of water used. The farmer has a total of 100 acres available for cultivation. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_S = 150 * S\nWater_W = 5 * W\nWater_C = 8 * C\nWater_S = 3 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (Water_W + Water_C + Water_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_W + Water_C + Water_S) == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 606,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300\n\n## Generate Constraint-2:\nThe soil fertility must remain above 50 points after planting all crops.\n// 2 * A1 + 3 * A2 + 5 * A3 <= 100 (assuming the initial soil fertility is 100 points)\n\n## Generate Constraint-3:\nThe total acreage available for planting is 50 acres.\n// A1 + A2 + A3 <= 50",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage. The profit per acre, water usage per acre, and soil fertility degradation per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Usage per Acre | Soil Fertility Degradation per Acre |\n|------|-----------------|----------------------|------------------------------------|\n| C1   | $100            | 5 units              | 2 points                           |\n| C2   | $150            | 7 units              | 3 points                           |\n| C3   | $200            | 10 units             | 5 points                           |\n\nThe farm has a limited water supply of 300 units. The soil fertility must remain above 50 points after planting all crops. The total acreage available for planting is 50 acres. \nPlease help the farm to maximize the profit per unit of water used while maintaining soil fertility above the specified threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n## The soil fertility must remain above 50 points after planting all crops.\nmodel.addCons(2 * A1 + 3 * A2 + 5 * A3 <= 100)\n## The total acreage available for planting is 50 acres.\nmodel.addCons(A1 + A2 + A3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production.\n// {\"operating hours for reactor 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach reactor has a different efficiency in producing the chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The plant aims to maximize the total production of all chemicals.\n// Total production of A: P_A = 10 * H1 + 15 * H2 + 20 * H3\n// Total production of B: P_B = 15 * H1 + 20 * H2 + 25 * H3\n// Total production of C: P_C = 20 * H1 + 25 * H2 + 30 * H3\n// The objective function is: Maximize (P_A + P_B + P_C)\n\n## Generate Constraint-1:\nThe total operating hours for all reactors must not exceed 100 hours per week.\n// H1 + H2 + H3 <= 100\n\n## Generate Constraint-2:\nThe maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000. The cost for Reactor 1 is $50 per hour, for Reactor 2 is $60 per hour, and for Reactor 3 is $70 per hour.\n// 50 * H1 + 60 * H2 + 70 * H3 <= 5000",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The manager needs to determine the operating hours for each reactor to optimize production. The total operating hours for all reactors must not exceed 100 hours per week. The maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000. The cost for Reactor 1 is $50 per hour, for Reactor 2 is $60 per hour, and for Reactor 3 is $70 per hour. Please help the manager to maximize the total production of all chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # operating hours for reactor 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # operating hours for reactor 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # operating hours for reactor 3\n\n# Define objective function\nP_A = 10 * H1 + 15 * H2 + 20 * H3 # Total production of A\nP_B = 15 * H1 + 20 * H2 + 25 * H3 # Total production of B\nP_C = 20 * H1 + 25 * H2 + 30 * H3 # Total production of C\n# The objective function is: Maximize (P_A + P_B + P_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# The total operating hours for all reactors must not exceed 100 hours per week.\nmodel.addCons(H1 + H2 + H3 <= 100)\n# The maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Reactor 1: \", model.getVal(H1))\n    print(\"Operating hours for Reactor 2: \", model.getVal(H2))\n    print(\"Operating hours for Reactor 3: \", model.getVal(H3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E).\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation over a 10-year period. The cost function is nonlinear and includes initial installation costs and annual operational costs. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n// Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for initial installation.\n// 1000 * S + 2000 * W + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it.\n// 100 * S + 200 * W >= 50000\n\n## Generate Constraint-3:\nThe total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines.\n// E <= 0.5 * (S + W)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E). The company aims to minimize the total cost of installation and operation over a 10-year period. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit. The company has a budget of $100,000 for initial installation. The total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it. The total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines. Please help the company to minimize the total cost of installation and operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n## convert the division to multiplication\nmodel.addCons(obj == 1000 * S + 2000 * W + 3000 * E + 10 * (50 * S + 100 * W + 150 * E))\n\n# Add constraints\n## The company has a budget of $100,000 for initial installation.\nmodel.addCons(1000 * S + 2000 * W + 3000 * E <= 100000)\n## The total annual energy output must be at least 50,000 kWh.\nmodel.addCons(100 * S + 200 * W >= 50000)\n## The total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines.\nmodel.addCons(E <= 0.5 * (S + W))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Number of Energy Storage Systems: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits.\n// {\"number of units of ComponentA\": \"ComponentATeams\", \"range\": \"ComponentATeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBTeams\", \"range\": \"ComponentBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCTeams\", \"range\": \"ComponentCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company wants to maximize the total profit.\n// Profit for ComponentA: Profit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\n// Profit for ComponentB: Profit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\n// Profit for ComponentC: Profit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBTeams <= 2 * ComponentATeams\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for raw materials for the month.\n// 10 * ComponentATeams + 15 * ComponentBTeams + 20 * ComponentCTeams <= 50,000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits. The profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company wants to maximize the total profit.\nThe company has a total production capacity of 1000 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. The company has a budget of $50,000 for raw materials for the month.\nPlease help the company determine the optimal number of units to produce for each component to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentATeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentATeams\", lb=0) # number of units of ComponentA\nComponentBTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentBTeams\", lb=0) # number of units of ComponentB\nComponentCTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentCTeams\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## Profit for ComponentA: Profit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\n## Profit for ComponentB: Profit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\n## Profit for ComponentC: Profit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n## So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nProfit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\nProfit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\nProfit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000)\n## Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\nmodel.addCons(ComponentBTeams <= 2 * ComponentATeams)\n## The company has a budget of $50,000 for raw materials for the month.\nmodel.addCons(10 * ComponentATeams + 15 * ComponentBTeams + 20 * ComponentCTeams <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(ComponentATeams))\n    print(\"Number of ComponentB: \", model.getVal(ComponentBTeams))\n    print(\"Number of ComponentC: \", model.getVal(ComponentCTeams))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is limited to 200 units.\n// A <= 200\n\n## Generate Constraint-3:\nThe production capacity for product B is limited to 150 units.\n// B <= 150\n\n## Generate Constraint-4:\nThe production capacity for product C is limited to 100 units.\n// C <= 100\n\n## Generate Constraint-5:\nThe company must produce at least 50 units of each product to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor. The profit per unit, cost of raw materials, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost | Labor Cost |\n|---------|-----------------|-------------------|------------|\n| A       | $50             | $10               | $5         |\n| B       | $70             | $15               | $7         |\n| C       | $90             | $20               | $10        |\n\nThe company has a budget of $10,000 for raw materials and labor. The production capacity for product A is limited to 200 units, for product B to 150 units, and for product C to 100 units. The company must produce at least 50 units of each product to meet contractual obligations. \n\nPlease help the company to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=100) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons(10 * A + 5 * A + 15 * B + 7 * B + 20 * C + 10 * C <= 10000)\n## The production capacity for product A is limited to 200 units.\nmodel.addCons(A <= 200)\n## The production capacity for product B is limited to 150 units.\nmodel.addCons(B <= 150)\n## The production capacity for product C is limited to 100 units.\nmodel.addCons(C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe market demand for product B is at least 15 units per day.\n// B >= 15",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $10             |\n| B       | $15             |\n| C       | $20             |\n\nThe total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day, and for product B is at least 15 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C - 0.01*(A**2 + B**2 + C**2))\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit from ComponentA: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\n// Profit from ComponentB: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\n// Profit from ComponentC: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// QuantityA + QuantityB + QuantityC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// QuantityB <= 2 * QuantityA\n\n## Generate Constraint-3:\nThe company has a storage limitation that requires the total production of ComponentA and ComponentC to not exceed 350 units.\n// QuantityA + QuantityC <= 350\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each component are produced to meet minimum customer demand.\n// QuantityA >= 50; QuantityB >= 50; QuantityC >= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit. The profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units per month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. The company has a storage limitation that requires the total production of ComponentA and ComponentC to not exceed 350 units. The company wants to ensure that at least 50 units of each component are produced to meet minimum customer demand. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50)  # production quantity for ComponentA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=50)  # production quantity for ComponentB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=50)  # production quantity for ComponentC\n\n# Define objective function\n# Create piecewise variables for piecewise functions\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(QuantityA == A1*A_b1 + A2*A_b2)\nProfitA = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(QuantityB == B1*B_b1 + B2*B_b2)\nProfitB = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(QuantityC == C1*C_b1 + C2*C_b2)\nProfitC = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 500)\nmodel.addCons(QuantityB <= 2 * QuantityA)\nmodel.addCons(QuantityA + QuantityC <= 350)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(QuantityA))\n    print(\"Quantity of ComponentB: \", model.getVal(QuantityB))\n    print(\"Quantity of ComponentC: \", model.getVal(QuantityC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit.\nThe profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit.\nThe profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit.\nThe company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// Total variable cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120.\n// 100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a labor constraint, with a maximum of 800 labor hours available per month. Each unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2.5 hours.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations. The profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit. The profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit. The profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit. The company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost. The company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120. The company also has a labor constraint, with a maximum of 800 labor hours available per month. Each unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2.5 hours. Please help the company determine the optimal production quantities for Product A, Product B, and Product C to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a limited supply of raw materials, which costs $10,000 per month.\nmodel.addCons(100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000)\n# The company has a labor constraint, with a maximum of 800 labor hours available per month.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\nThe total operational hours for all lines must not exceed 120 hours per week.\nPlease help the company to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (VA + VB + VC)\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 120 hours available.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredient costs.\n// 1 * P1 + 1.5 * P2 + 2 * P3 <= 1500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 1000 pastries.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-4:\nThe bakery has a minimum order requirement of 50 pastries for each type.\n// P1 >= 50; P2 >= 50; P3 >= 50",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season. The selling price, ingredient cost, and baking time for each pastry are given in the following Table.\n\n| Pastry | Selling Price | Ingredient Cost | Baking Time |\n|--------|---------------|-----------------|-------------|\n| P1     | $3            | $1              | 15 minutes  |\n| P2     | $4            | $1.5            | 20 minutes  |\n| P3     | $5            | $2              | 25 minutes  |\n\nThe bakery has a total baking time of 120 hours available. The bakery has a budget of $1500 for ingredient costs. The bakery has a storage capacity of 1000 pastries. The bakery has a minimum order requirement of 50 pastries for each type. The bakery has a single oven and can only bake one type of pastry at a time. \nPlease help the bakery to maximize the profit efficiency (profit per minute of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=50) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=50) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=50) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 120 hours available.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60)\n## The bakery has a budget of $1500 for ingredient costs.\nmodel.addCons(1 * P1 + 1.5 * P2 + 2 * P3 <= 1500)\n## The bakery has a storage capacity of 1000 pastries.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales.\n// {\"amount of chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"amount of vanilla cake\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"amount of strawberry cake\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for chocolate cake\": \"AdChocolate\", \"range\": \"AdChocolate >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for vanilla cake\": \"AdVanilla\", \"range\": \"AdVanilla >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for strawberry cake\": \"AdStrawberry\", \"range\": \"AdStrawberry >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe bakery knows that for every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its total daily profit.\n// Profit from chocolate cake: ProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\n// Profit from vanilla cake: ProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\n// Profit from strawberry cake: ProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\n// So, the objective function is: Maximize (ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n## Generate Constraint-1:\nThe total advertising budget for all cakes cannot exceed $1000.\n// AdChocolate + AdVanilla + AdStrawberry <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 500 cakes of each type daily.\n// Chocolate <= 500; Vanilla <= 500; Strawberry <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of cake daily.\n// Chocolate >= 100; Vanilla >= 100; Strawberry >= 100",
        "question": "A bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. For every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The following table summarizes the profit per cake and the advertising effect.\n\n| Cake Type       | Profit per Cake | Advertising Effect (per $100) |\n|-----------------|-----------------|-------------------------------|\n| Chocolate       | $5              | 5 units                       |\n| Vanilla         | $4              | 5 units                       |\n| Strawberry      | $3              | 5 units                       |\n\nThe bakery has a total advertising budget of $1000. The bakery can produce a maximum of 500 cakes of each type daily. The bakery must also produce at least 100 units of each type of cake daily. \n\nPlease help the bakery to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=100, ub=500)  # amount of chocolate cake\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=100, ub=500)  # amount of vanilla cake\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=100, ub=500)  # amount of strawberry cake\nAdChocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"AdChocolate\", lb=0)  # advertising budget for chocolate cake\nAdVanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"AdVanilla\", lb=0)  # advertising budget for vanilla cake\nAdStrawberry = model.addVar(vtype=\"CONTINUOUS\", name=\"AdStrawberry\", lb=0)  # advertising budget for strawberry cake\n\n# Define objective function\nProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\nProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\nProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\n# So, the objective function is: Maximize (ProfitChocolate + ProfitVanilla + ProfitStrawberry)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n# Add constraints\n# The total advertising budget for all cakes cannot exceed $1000.\nmodel.addCons(AdChocolate + AdVanilla + AdStrawberry <= 1000)\n# The bakery can produce a maximum of 500 cakes of each type daily.\nmodel.addCons(Chocolate <= 500)\nmodel.addCons(Vanilla <= 500)\nmodel.addCons(Strawberry <= 500)\n# The bakery must produce at least 100 units of each type of cake daily.\nmodel.addCons(Chocolate >= 100)\nmodel.addCons(Vanilla >= 100)\nmodel.addCons(Strawberry >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Chocolate Cake: \", model.getVal(Chocolate))\n    print(\"Amount of Vanilla Cake: \", model.getVal(Vanilla))\n    print(\"Amount of Strawberry Cake: \", model.getVal(Strawberry))\n    print(\"Advertising Budget for Chocolate Cake: \", model.getVal(AdChocolate))\n    print(\"Advertising Budget for Vanilla Cake: \", model.getVal(AdVanilla))\n    print(\"Advertising Budget for Strawberry Cake: \", model.getVal(AdStrawberry))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the yield is 5 tons per hectare, and the selling price is $100 per ton. \nFor Crop B, the yield is 7 tons per hectare, and the selling price is $120 per ton. \nFor Crop C, the yield is 6 tons per hectare, and the selling price is $110 per ton.\nThe farm aims to maximize its total revenue from selling the crops.\n// Revenue from Crop A: Revenue_A = 5 * 100 * HA\n// Revenue from Crop B: Revenue_B = 7 * 120 * HB\n// Revenue from Crop C: Revenue_C = 6 * 110 * HC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total land available for cultivation is 100 hectares.\n// HA + HB + HC <= 100",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices. The yield and selling price for each crop are given in the following Table.\n\n| Crop | Yield (tons/hectare) | Selling Price ($/ton) |\n|------|----------------------|-----------------------|\n| A    | 5                    | 100                   |\n| B    | 7                    | 120                   |\n| C    | 6                    | 110                   |\n\nThe farm aims to maximize its total revenue from selling the crops. The total land available for cultivation is 100 hectares. Please help the farm determine the optimal allocation of hectares to each crop to maximize its revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"CONTINUOUS\", name=\"HA\", lb=0) # hectares of crop A\nHB = model.addVar(vtype=\"CONTINUOUS\", name=\"HB\", lb=0) # hectares of crop B\nHC = model.addVar(vtype=\"CONTINUOUS\", name=\"HC\", lb=0) # hectares of crop C\n\n# Define objective function\nRevenue_A = 5 * 100 * HA\nRevenue_B = 7 * 120 * HB\nRevenue_C = 6 * 110 * HC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total land available for cultivation is 100 hectares.\nmodel.addCons(HA + HB + HC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor.\n// 10 * A + 15 * B + 20 * C <= 5000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe production of product A must be at least 20% of the total production.\n// A >= 0.2 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company has a budget of $10,000 for raw materials and $5,000 for labor. The total production capacity is limited to 200 units across all products. The production of product A must be at least 20% of the total production.\nPlease help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n## Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n## Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n## So, the objective function is: Maximize (PA + PB + PC)\nPA = 50 * A - (20 * A + 10 * A)\nPB = 70 * B - (30 * B + 15 * B)\nPC = 90 * C - (40 * C + 20 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a budget of $5,000 for labor.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 5000)\n## The total production capacity is limited to 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(A >= 0.2 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency.\n// {\"production quantity of the product\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe total investment in production efficiency cannot exceed $30,000.\n// Efficiency <= 30000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency. The initial production cost per unit is $10, and the selling price per unit is $15. The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency.\n\n| Variable                | Description                          | Range/Type       |\n|-------------------------|--------------------------------------|------------------|\n| Production Quantity     | Number of units to produce           | Quantity >= 0    |\n| Advertising Budget      | Budget for promoting the product     | Advertising >= 0 |\n| Investment in Efficiency| Money invested in production efficiency | Efficiency >= 0 |\n\nThe company has a budget of $50,000 for advertising and the total investment in production efficiency cannot exceed $30,000. The company aims to maximize the total profit from the product.\n\nPlease help the company determine the optimal values for production quantity, advertising budget, and investment in production efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=0)  # production quantity of the product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # investment in production efficiency\n\n# Define objective function\n## Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\nProfit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n## The total investment in production efficiency cannot exceed $30,000.\nmodel.addCons(Efficiency <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Investment in Efficiency: \", model.getVal(Efficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1243,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that each acre of wheat yields a profit of $500, corn yields $700, and soybeans yields $600. However, the cost of fertilizers varies with the type of crop: wheat requires $100 per acre, corn requires $150 per acre, and soybeans requires $120 per acre. The farmer wants to maximize the net profit per dollar spent on fertilizers.\n// Profit from wheat: P_wheat = 500 * Wheat\n// Profit from corn: P_corn = 700 * Corn\n// Profit from soybeans: P_soybeans = 600 * Soybeans\n// Cost of fertilizers for wheat: C_wheat = 100 * Wheat\n// Cost of fertilizers for corn: C_corn = 150 * Corn\n// Cost of fertilizers for soybeans: C_soybeans = 120 * Soybeans\n// Total profit: Total_P = P_wheat + P_corn + P_soybeans\n// Total cost: Total_C = C_wheat + C_corn + C_soybeans\n// So, the objective function is: Maximize (Total_P / Total_C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 20 acres of wheat to meet a contract obligation.\n// Wheat >= 20",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit and cost of fertilizers per acre for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Cost of Fertilizers per Acre |\n|------------|-----------------|------------------------------|\n| Wheat      | $500            | $100                         |\n| Corn       | $700            | $150                         |\n| Soybeans   | $600            | $120                         |\n\nThe farmer has a total of 100 acres available for planting. The farmer must plant at least 20 acres of wheat to meet a contract obligation. The farmer wants to maximize the net profit per dollar spent on fertilizers.\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 20 acres of wheat to meet a contract obligation.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=20) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_wheat = 500 * Wheat\nP_corn = 700 * Corn\nP_soybeans = 600 * Soybeans\nC_wheat = 100 * Wheat\nC_corn = 150 * Corn\nC_soybeans = 120 * Soybeans\nTotal_P = P_wheat + P_corn + P_soybeans\nTotal_C = C_wheat + C_corn + C_soybeans\n## the objective function is: Maximize (Total_P / Total_C)\n## convert the division to multiplication\nmodel.addCons(obj * Total_C == Total_P)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Net Profit per Dollar Spent on Fertilizers: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production.\n// {\"operating hours for reactor 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach reactor has a different efficiency in producing the chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The plant aims to maximize the total production of all chemicals.\n// Total production of A: P_A = 10 * H1 + 15 * H2 + 20 * H3\n// Total production of B: P_B = 15 * H1 + 20 * H2 + 25 * H3\n// Total production of C: P_C = 20 * H1 + 25 * H2 + 30 * H3\n// The objective function is: Maximize (P_A + P_B + P_C)\n\n## Generate Constraint-1:\nThe total operating hours for all reactors must not exceed 100 hours per week.\n// H1 + H2 + H3 <= 100",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The manager needs to determine the operating hours for each reactor to optimize production. The total operating hours for all reactors must not exceed 100 hours per week. Please help the manager to maximize the total production of all chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # operating hours for reactor 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # operating hours for reactor 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # operating hours for reactor 3\n\n# Define objective function\nP_A = 10 * H1 + 15 * H2 + 20 * H3 # Total production of A\nP_B = 15 * H1 + 20 * H2 + 25 * H3 # Total production of B\nP_C = 20 * H1 + 25 * H2 + 30 * H3 # Total production of C\n# The objective function is: Maximize (P_A + P_B + P_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# The total operating hours for all reactors must not exceed 100 hours per week.\nmodel.addCons(H1 + H2 + H3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Reactor 1: \", model.getVal(H1))\n    print(\"Operating hours for Reactor 2: \", model.getVal(H2))\n    print(\"Operating hours for Reactor 3: \", model.getVal(H3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and meet demand.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA produces 100 units per hour with a defect rate of 5%, ComponentB produces 120 units per hour with a defect rate of 3%, and ComponentC produces 150 units per hour with a defect rate of 2%. The company needs to produce at least 5000 units of ComponentA, 6000 units of ComponentB, and 7500 units of ComponentC daily. The objective is to minimize the total production time while considering the defect rates.\n// Production time for ComponentA: T_A = 5000 / (100 * (1 - 0.05) * MachinesA)\n// Production time for ComponentB: T_B = 6000 / (120 * (1 - 0.03) * MachinesB)\n// Production time for ComponentC: T_C = 7500 / (150 * (1 - 0.02) * MachinesC)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, no more than 10 machines can be allocated to any single component production line.\n// MachinesA <= 10; MachinesB <= 10; MachinesC <= 10\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 20% of the total machines are allocated to ComponentA to maintain a balance in production capabilities.\n// MachinesA >= 0.2 * (MachinesA + MachinesB + MachinesC)\n\n## Generate Constraint-4:\nTo ensure a diversified production, the company wants to ensure that each component has at least one machine allocated.\n// MachinesA >= 1; MachinesB >= 1; MachinesC >= 1",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and meet demand. The production capabilities and defect rates for each component are given in the following Table.\n\n| Component | Units Produced per Hour per Machine | Defect Rate | Daily Demand |\n|-----------|-------------------------------------|-------------|--------------|\n| ComponentA | 100                                 | 5%          | 5000         |\n| ComponentB | 120                                 | 3%          | 6000         |\n| ComponentC | 150                                 | 2%          | 7500         |\n\nThe company has a total of 25 machines available for allocation. Due to space limitations, no more than 10 machines can be allocated to any single component production line. The company has a policy to ensure that at least 20% of the total machines are allocated to ComponentA to maintain a balance in production capabilities. To ensure a diversified production, the company wants to ensure that each component has at least one machine allocated.\n\nPlease help the company to minimize the total production time while considering the defect rates, by determining the optimal allocation of machines to each component production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=1)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=1)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=1)  # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_A = 5000 / (100 * (1 - 0.05) * MachinesA)\nT_B = 6000 / (120 * (1 - 0.03) * MachinesB)\nT_C = 7500 / (150 * (1 - 0.02) * MachinesC)\n## the objective function is: Minimize max(T_A, T_B, T_C)\n## convert the max to a constraint\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n## Due to space limitations, no more than 10 machines can be allocated to any single component production line.\nmodel.addCons(MachinesA <= 10)\nmodel.addCons(MachinesB <= 10)\nmodel.addCons(MachinesC <= 10)\n## The company has a policy to ensure that at least 20% of the total machines are allocated to ComponentA.\nmodel.addCons(MachinesA >= 0.2 * (MachinesA + MachinesB + MachinesC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1389,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal investment in research and development for each drug to maximize their potential return on investment.\n// {\"investment in DrugA\": \"InvestA\", \"range\": \"InvestA >= 0\", \"type\": \"real\"}\n// {\"investment in DrugB\": \"InvestB\", \"range\": \"InvestB >= 0\", \"type\": \"real\"}\n// {\"investment in DrugC\": \"InvestC\", \"range\": \"InvestC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe return on investment for each drug is modeled as a nonlinear function of the investment. For DrugA, the return is given by 0.05 * InvestA^2. For DrugB, the return is 0.07 * InvestB^2. For DrugC, the return is 0.06 * InvestC^2. The company wants to maximize the total return on investment.\n// Total return for DrugA: Return_A = 0.05 * InvestA^2\n// Total return for DrugB: Return_B = 0.07 * InvestB^2\n// Total return for DrugC: Return_C = 0.06 * InvestC^2\n// So, the objective function is: Maximize (Return_A + Return_B + Return_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all three drugs.\n// InvestA + InvestB + InvestC <= 1,000,000\n\n## Generate Constraint-2:\nDue to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC.\n// InvestA >= 0.5 * (InvestB + InvestC)\n\n## Generate Constraint-3:\nThe company has a policy to ensure that no single drug receives more than 60% of the total investment.\n// InvestA <= 0.6 * (InvestA + InvestB + InvestC); InvestB <= 0.6 * (InvestA + InvestB + InvestC); InvestC <= 0.6 * (InvestA + InvestB + InvestC)",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal investment in research and development for each drug to maximize their potential return on investment. The return on investment for each drug is modeled as a nonlinear function of the investment, where the return for DrugA is 0.05 times the square of the investment in DrugA, for DrugB is 0.07 times the square of the investment in DrugB, and for DrugC is 0.06 times the square of the investment in DrugC. The company wants to maximize the total return on investment.\n\nThe company has a total budget of $1,000,000 for all three drugs. Due to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC. Additionally, the company has a policy to ensure that no single drug receives more than 60% of the total investment.\n\nPlease help the company determine the optimal investment in each drug to maximize their total return on investment.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestA\", lb=0) # investment in DrugA\nInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestB\", lb=0) # investment in DrugB\nInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestC\", lb=0) # investment in DrugC\n\n# Define objective function\n## The return on investment for each drug is modeled as a nonlinear function of the investment.\nReturn_A = 0.05 * InvestA**2\nReturn_B = 0.07 * InvestB**2\nReturn_C = 0.06 * InvestC**2\n## So, the objective function is: Maximize (Return_A + Return_B + Return_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Return_A + Return_B + Return_C)\n\n# Add constraints\n## The company has a total budget of $1,000,000 for all three drugs.\nmodel.addCons(InvestA + InvestB + InvestC <= 1000000)\n## Due to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC.\nmodel.addCons(InvestA >= 0.5 * (InvestB + InvestC))\n## The company has a policy to ensure that no single drug receives more than 60% of the total investment.\nmodel.addCons(InvestA <= 0.6 * (InvestA + InvestB + InvestC))\nmodel.addCons(InvestB <= 0.6 * (InvestA + InvestB + InvestC))\nmodel.addCons(InvestC <= 0.6 * (InvestA + InvestB + InvestC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in DrugA: \", model.getVal(InvestA))\n    print(\"Investment in DrugB: \", model.getVal(InvestB))\n    print(\"Investment in DrugC: \", model.getVal(InvestC))\n    print(\"Maximized Total Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The manufacturer needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily. The goal is to minimize the total working hours required to meet the daily production targets.\n// Total working hours for product A: HA = 1000 / (10 * WA)\n// Total working hours for product B: HB = 1500 / (15 * WB)\n// Total working hours for product C: HC = 2000 / (20 * WC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available to allocate among the three production lines.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// WA <= 20; WB <= 20; WC <= 20\n\n## Generate Constraint-3:\nAt least 10 workers must be assigned to the product A line.\n// WA >= 10\n\n## Generate Constraint-4:\nThe number of workers on the product C line must not exceed twice the number of workers on the product A line.\n// WC <= 2 * WA",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rates are as follows:\n\n| Product | Production Rate |\n|---------|-----------------|\n| A       | 10 units/worker/hour |\n| B       | 15 units/worker/hour |\n| C       | 20 units/worker/hour |\n\nThe manufacturer needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily. The goal is to minimize the total working hours required to meet the daily production targets. The manufacturer has a total of 50 workers available to allocate among the three production lines. Each production line can accommodate a maximum of 20 workers. At least 10 workers must be assigned to the product A line. The number of workers on the product C line must not exceed twice the number of workers on the product A line.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to minimize the total working hours required to meet the daily production targets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=10) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Total working hours for product A: HA = 1000 / (10 * WA)\n## Total working hours for product B: HB = 1500 / (15 * WB)\n## Total working hours for product C: HC = 2000 / (20 * WC)\n## So, the objective function is: Minimize max(HA, HB, HC)\n## Convert the division to multiplication\nHA = model.addVar(name=\"HA\")\nHB = model.addVar(name=\"HB\")\nHC = model.addVar(name=\"HC\")\nmodel.addCons(HA == 1000 / (10 * WA))\nmodel.addCons(HB == 1500 / (15 * WB))\nmodel.addCons(HC == 2000 / (20 * WC))\n\n## Minimize the maximum of HA, HB, HC\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available to allocate among the three production lines.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can accommodate a maximum of 20 workers.\nmodel.addCons(WA <= 20)\nmodel.addCons(WB <= 20)\nmodel.addCons(WC <= 20)\n## At least 10 workers must be assigned to the product A line.\nmodel.addCons(WA >= 10)\n## The number of workers on the product C line must not exceed twice the number of workers on the product A line.\nmodel.addCons(WC <= 2 * WA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Minimum Total Working Hours: \", model.getVal(obj))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm aims to maximize the profit efficiency (profit per liter of water used). Please help the farm determine the optimal allocation of hectares to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\n// {\"number of crops in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 units of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 units of energy. \nThe farm aims to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.\n// Profit from greenhouse A: Profit_A = 50 * A\n// Profit from greenhouse B: Profit_B = 70 * B\n// Profit from greenhouse C: Profit_C = 90 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A^2 + 3 * B^2 + 4 * C^2)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available for all greenhouses.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of energy available for all greenhouses.\n// A + 2 * B + 3 * C <= 50",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 unit of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 unit of energy. \nThe farm has a total of 100 units of water available for all greenhouses. The farm also has a total of 50 units of energy available for all greenhouses.\nPlease help the farm to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage, defined as the sum of the profits from all greenhouses divided by the sum of the squared resource usage in each greenhouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of crops in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of crops in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of crops in greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nResourceUsage = 2 * A**2 + 3 * B**2 + 4 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available for all greenhouses.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of energy available for all greenhouses.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of crops in greenhouse A: \", model.getVal(A))\n    print(\"Number of crops in greenhouse B: \", model.getVal(B))\n    print(\"Number of crops in greenhouse C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must be at least twice the production of P2.\n// P1 >= 2 * P2",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company has a total production capacity of 200 units and a budget of $10,000 for production costs. Due to market demand, the production of P1 must be at least twice the production of P2.\nPlease help the company to maximize the total net profit, considering both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must be at least twice the production of P2.\nmodel.addCons(P1 >= 2 * P2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit.\n// {\"raw materials for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for machine 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"production rate adjustment for machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine contributes differently to the profit based on the raw materials and labor hours allocated. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines.\n// The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\n\n## Generate Constraint-1:\nThe total budget for raw materials and labor hours is $5000.\n// 100 * M1 + 150 * L2 + 500 * P3^2 <= 5000",
        "question": "A manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines. The total budget for raw materials and labor hours is $5000.\nPlease help the company determine the optimal allocation of raw materials for Machine 1 (M1), labor hours for Machine 2 (L2), and production rate adjustment for Machine 3 (P3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # raw materials for machine 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0)  # labor hours for machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0)  # production rate adjustment for machine 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\nmodel.addCons(obj == 100 * M1 + 150 * L2 + 500 * P3**2)\n\n# Add constraints\n## The total budget for raw materials and labor hours is $5000.\nmodel.addCons(100 * M1 + 150 * L2 + 500 * P3**2 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for machine 1: \", model.getVal(M1))\n    print(\"Labor hours for machine 2: \", model.getVal(L2))\n    print(\"Production rate adjustment for machine 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 765,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantities for each component to maximize profit while considering various constraints.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, but it decreases by $0.01 for each unit produced above 100. The profit per unit of component B is $15, but it increases by $0.02 for each unit produced above 50. The profit per unit of component C is $20, but it remains constant. The company aims to maximize the total profit from the sale of these components.\n// Profit_A = (10 - 0.01 * max(A - 100, 0)) * A\n// Profit_B = (15 + 0.02 * max(B - 50, 0)) * B\n// Profit_C = 20 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all components must not exceed $1000. The cost per unit of component A is $5, component B is $7, and component C is $9.\n// 5 * A + 7 * B + 9 * C <= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantities for each component to maximize profit while considering various constraints. The profit per unit of component A is $10, but it decreases by $0.01 for each unit produced above 100. The profit per unit of component B is $15, but it increases by $0.02 for each unit produced above 50. The profit per unit of component C is $20, and it remains constant. The total production cost for all components must not exceed $1000, with the cost per unit of component A being $5, component B being $7, and component C being $9. Please help the company to maximize the total profit from the sale of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.01 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.01 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 + 0.02 * max(B - 50, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=50, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 + 0.02 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## Profit_C = 20 * C\nProfit_C = 20 * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company wants to maximize the total profit.\n// The objective function is: Maximize P = 50A + 70B + 60C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n// 2A + 3B + 4C <= 100",
        "question": "A company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand. The profit from each unit of component A is $50, component B is $70, and component C is $60. The following table summarizes the raw material requirements for each component:\n\n| Component | Profit per Unit | Raw Material Requirement (kg) |\n|-----------|-----------------|-------------------------------|\n| A         | $50             | 2                             |\n| B         | $70             | 3                             |\n| C         | $60             | 4                             |\n\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n\nPlease help the company to maximize the total profit, given the constraint on raw material availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\nP = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets.\n// {\"hours for machine A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"hours for machine B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"hours for machine C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget.\n// The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\n// The production constraint for widget A: 5 * MA >= 100\n// The production constraint for widget B: 10 * MB >= 100\n// The production constraint for widget C: 15 * MC >= 100\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 20 hours per day.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nMachine A can operate for a maximum of 8 hours per day.\n// MA <= 8\n\n## Generate Constraint-3:\nMachine B can operate for a maximum of 10 hours per day.\n// MB <= 10\n\n## Generate Constraint-4:\nMachine C can operate for a maximum of 12 hours per day.\n// MC <= 12",
        "question": "A manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Units Produced per Hour | Cost per Hour |\n|---------|-------------------------|---------------|\n| A       | 5 units of widget A     | $10           |\n| B       | 10 units of widget B    | $15           |\n| C       | 15 units of widget C    | $20           |\n\nThe goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget. The total operating hours for all machines must not exceed 20 hours per day. Machine A can operate for a maximum of 8 hours per day, Machine B for a maximum of 10 hours per day, and Machine C for a maximum of 12 hours per day.\n\nPlease help the plant manager to determine the optimal number of hours to operate each machine to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # hours for machine A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # hours for machine B\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # hours for machine C\n\n# Define objective function\nCost = 10 * MA + 15 * MB + 20 * MC\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\n# The production constraint for widget A: 5 * MA >= 100\nmodel.addCons(5 * MA >= 100)\n# The production constraint for widget B: 10 * MB >= 100\nmodel.addCons(10 * MB >= 100)\n# The production constraint for widget C: 15 * MC >= 100\nmodel.addCons(15 * MC >= 100)\n# The total operating hours for all machines must not exceed 20 hours per day.\nmodel.addCons(MA + MB + MC <= 20)\n# Machine A can operate for a maximum of 8 hours per day.\nmodel.addCons(MA <= 8)\n# Machine B can operate for a maximum of 10 hours per day.\nmodel.addCons(MB <= 10)\n# Machine C can operate for a maximum of 12 hours per day.\nmodel.addCons(MC <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Machine A: \", model.getVal(MA))\n    print(\"Hours for Machine B: \", model.getVal(MB))\n    print(\"Hours for Machine C: \", model.getVal(MC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. \nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. \nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n// Cost per ton-km for A: Cost_A = 200 / (5 * 10 * A)\n// Cost per ton-km for B: Cost_B = 300 / (10 * 15 * B)\n// Cost per ton-km for C: Cost_C = 400 / (15 * 20 * C)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C <= 10000",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|---------|-----------------------|---------------------------|----------------------|\n| A       | 10                    | 200                       | 5                    |\n| B       | 15                    | 300                       | 10                   |\n| C       | 20                    | 400                       | 15                   |\n\nThe company has a budget of $10,000 for vehicle maintenance next month. The company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 / (5 * 10 * A)\nCost_B = 300 / (10 * 15 * B)\nCost_C = 400 / (15 * 20 * C)\n## convert the division to multiplication\nmodel.addCons(obj * (5 * 10 * A) * (10 * 15 * B) * (15 * 20 * C) == 200 * (10 * 15 * B) * (15 * 20 * C) + 300 * (5 * 10 * A) * (15 * 20 * C) + 400 * (5 * 10 * A) * (10 * 15 * B))\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield.\n// Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n// Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n// Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm must allocate at least 20 hectares to crop A and 15 hectares to crop B.\n// A >= 20; B >= 15",
        "question": "A farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit. The yield per hectare and the selling price per ton for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton |\n|------|-------------------|-----------------------|\n| A    | 5 tons            | $100                  |\n| B    | 7 tons            | $120                  |\n| C    | 9 tons            | $150                  |\n\nThe farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield. The total available land for farming is 100 hectares. The farm must allocate at least 20 hectares to crop A and 15 hectares to crop B. Please help the farm to maximize the total revenue from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=15) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n## Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n## Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n## So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nRevenue_A = 5 * A**0.8 * 100\nRevenue_B = 7 * B**0.8 * 120\nRevenue_C = 9 * C**0.8 * 150\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The total available land for farming is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to crop A: \", model.getVal(A))\n    print(\"Land allocated to crop B: \", model.getVal(B))\n    print(\"Land allocated to crop C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products.\n// Total profit for product A: PA = 50 * 10 * MA\n// Total profit for product B: PB = 30 * 15 * MB\n// Total profit for product C: PC = 40 * 12 * MC\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nThe production of product A must not exceed 2000 units per hour.\n// 50 * MA <= 2000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product. Each machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products. The manufacturer has a total of 50 machines available. The production of product A must not exceed 2000 units per hour. Please help the manufacturer determine the optimal allocation of machines to each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## Total profit for product A: PA = 50 * 10 * MA\n## Total profit for product B: PB = 30 * 15 * MB\n## Total profit for product C: PC = 40 * 12 * MC\nPA = 50 * 10 * MA\nPB = 30 * 15 * MB\nPC = 40 * 12 * MC\n## So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n## The production of product A must not exceed 2000 units per hour.\nmodel.addCons(50 * MA <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer aims to maximize the profit per hour of production time.\n// Profit_A = (30 - 10) * A\n// Profit_B = (40 - 15) * B\n// Profit_C = (50 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time limit of 150 hours.\n// A + 2 * B + 3 * C <= 150\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 3000",
        "question": "A manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer has a total production time limit of 150 hours and a budget of $3000 for production costs.\nPlease help the manufacturer to maximize the profit per hour of production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a total production time limit of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 150)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit. The total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C - 0.01*(A**2 + B**2 + C**2))\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50\n\n## Generate Constraint-2:\nDue to operational requirements, CargoB must have at least half as many trucks as CargoA.\n// CargoBTrucks >= 0.5 * CargoATrucks\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for maintenance costs for the quarter.\n// 500 * CargoATrucks + 700 * CargoBTrucks + 1,000 * CargoCTrucks <= 100,000",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. For CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. For CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck. The company aims to maximize the total net profit from all cargo types. The company has a total of 50 trucks available for allocation. Due to operational requirements, CargoB must have at least half as many trucks as CargoA. The company has a budget of $100,000 for maintenance costs for the quarter. Please help the company to maximize the total net profit from all cargo types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=0)  # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=0)  # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=0)  # number of trucks for CargoC\n\n# Define objective function\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\n# Due to operational requirements, CargoB must have at least half as many trucks as CargoA.\nmodel.addCons(CargoBTrucks >= 0.5 * CargoATrucks)\n# The company has a budget of $100,000 for maintenance costs for the quarter.\nmodel.addCons(500 * CargoATrucks + 700 * CargoBTrucks + 1000 * CargoCTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type.\n// {\"number of PanelA\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of PanelB\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of PanelC\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nPanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. \nPanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. \nPanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. \nThe company wants to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.\n// Daily energy output for PanelA: Energy_PanelA = 100 * PanelA - 10 * PanelA\n// Daily energy output for PanelB: Energy_PanelB = 150 * PanelB - 15 * PanelB\n// Daily energy output for PanelC: Energy_PanelC = 200 * PanelC - 20 * PanelC\n// Total initial investment cost: Cost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n// So, the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 500 * PanelA + 700 * PanelB + 900 * PanelC <= 100,000\n\n## Generate Constraint-2:\nThe facility has space for a maximum of 150 solar panels.\n// PanelA + PanelB + PanelC <= 150\n\n## Generate Constraint-3:\nDue to local regulations, at least 30% of the panels must be of type PanelA.\n// PanelA >= 0.3 * (PanelA + PanelB + PanelC)",
        "question": "A renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type. PanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. PanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. PanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. The company has a budget of $100,000 for the initial investment. The facility has space for a maximum of 150 solar panels. Due to local regulations, at least 30% of the panels must be of type PanelA. Please help the company to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of PanelA\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of PanelB\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of PanelC\n\n# Define objective function\nEnergy_PanelA = 100 * PanelA - 10 * PanelA\nEnergy_PanelB = 150 * PanelB - 15 * PanelB\nEnergy_PanelC = 200 * PanelC - 20 * PanelC\nCost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n# So, the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_PanelA + Energy_PanelB + Energy_PanelC - Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for the initial investment.\nmodel.addCons(500 * PanelA + 700 * PanelB + 900 * PanelC <= 100000)\n# The facility has space for a maximum of 150 solar panels.\nmodel.addCons(PanelA + PanelB + PanelC <= 150)\n# Due to local regulations, at least 30% of the panels must be of type PanelA.\nmodel.addCons(PanelA >= 0.3 * (PanelA + PanelB + PanelC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of PanelA: \", model.getVal(PanelA))\n    print(\"Number of PanelB: \", model.getVal(PanelB))\n    print(\"Number of PanelC: \", model.getVal(PanelC))\n    print(\"Maximized Net Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of Solar Panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wind Turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"quantity of Electric Vehicles\": \"ElectricVehicles\", \"range\": \"ElectricVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these products.\n// Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\n// Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\n// Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\n// So, the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n// 5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000\n\n## Generate Constraint-2:\nThe market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles.\n// SolarPanels <= 300; WindTurbines <= 200; ElectricVehicles <= 150\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 500 units in total for all products.\n// SolarPanels + WindTurbines + ElectricVehicles <= 500",
        "question": "A manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints. The profit per unit of each product decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Product            | Profit per Unit (beyond threshold) | Decrease per Additional Unit | Threshold |\n|--------------------|-----------------------------------|------------------------------|-----------|\n| Solar Panels       | $1000                             | $0.1                         | 100 units |\n| Wind Turbines      | $1500                             | $0.2                         | 50 units  |\n| Electric Vehicles  | $2000                             | $0.3                         | 20 units  |\n\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component. The market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles. Additionally, the company has a production capacity limit of 500 units in total for all products.\n\nPlease help the company to maximize the total profit from the sales of these products, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=300)  # quantity of Solar Panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=200)  # quantity of Wind Turbines\nElectricVehicles = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles\", lb=0, ub=150)  # quantity of Electric Vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0, ub=100)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=100, ub=300)\nSolarPanels_b1 = model.addVar(vtype=\"B\", name=\"SolarPanels_b1\")\nSolarPanels_b2 = model.addVar(vtype=\"B\", name=\"SolarPanels_b2\")\nmodel.addCons(SolarPanels_b1 + SolarPanels_b2 == 1)\nmodel.addCons(SolarPanels == SolarPanels1*SolarPanels_b1 + SolarPanels2*SolarPanels_b2)\nProfit_SolarPanels = (1000 - 0.1 * (SolarPanels2 - 100)) * SolarPanels2 * SolarPanels_b2\n\n## create piecewise variables for piecewise function: Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0, ub=50)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=50, ub=200)\nWindTurbines_b1 = model.addVar(vtype=\"B\", name=\"WindTurbines_b1\")\nWindTurbines_b2 = model.addVar(vtype=\"B\", name=\"WindTurbines_b2\")\nmodel.addCons(WindTurbines_b1 + WindTurbines_b2 == 1)\nmodel.addCons(WindTurbines == WindTurbines1*WindTurbines_b1 + WindTurbines2*WindTurbines_b2)\nProfit_WindTurbines = (1500 - 0.2 * (WindTurbines2 - 50)) * WindTurbines2 * WindTurbines_b2\n\n## create piecewise variables for piecewise function: Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\nElectricVehicles1 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles1\", lb=0, ub=20)\nElectricVehicles2 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles2\", lb=20, ub=150)\nElectricVehicles_b1 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b1\")\nElectricVehicles_b2 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b2\")\nmodel.addCons(ElectricVehicles_b1 + ElectricVehicles_b2 == 1)\nmodel.addCons(ElectricVehicles == ElectricVehicles1*ElectricVehicles_b1 + ElectricVehicles2*ElectricVehicles_b2)\nProfit_ElectricVehicles = (2000 - 0.3 * (ElectricVehicles2 - 20)) * ElectricVehicles2 * ElectricVehicles_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\nmodel.addCons(obj == Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles)\n\n# Add constraints\nmodel.addCons(5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000)\nmodel.addCons(SolarPanels + WindTurbines + ElectricVehicles <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Quantity of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Quantity of Electric Vehicles: \", model.getVal(ElectricVehicles))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1498,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of ComponentA is $50, but it requires a setup cost of $1000. The profit from each unit of ComponentB is $70, with a setup cost of $1500. The profit from each unit of ComponentC is $90, with a setup cost of $2000. The company wants to maximize their total profit, considering the setup costs.\n// Total profit from ComponentA: ProfitA = (50 * UnitsA) - 1000\n// Total profit from ComponentB: ProfitB = (70 * UnitsB) - 1500\n// Total profit from ComponentC: ProfitC = (90 * UnitsC) - 2000\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentB must be at least twice the production of ComponentA.\n// UnitsB >= 2 * UnitsA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit. The profit from each unit of ComponentA is $50, but it requires a setup cost of $1000. The profit from each unit of ComponentB is $70, with a setup cost of $1500. The profit from each unit of ComponentC is $90, with a setup cost of $2000. The company wants to maximize their total profit, considering the setup costs.\n\n| Component | Profit per Unit | Setup Cost |\n|-----------|-----------------|------------|\n| ComponentA | $50             | $1000      |\n| ComponentB | $70             | $1500      |\n| ComponentC | $90             | $2000      |\n\nThe company has a limited production capacity of 1000 units per month. Due to market demand, the production of ComponentB must be at least twice the production of ComponentA. Please help the company determine the optimal number of units to produce for each component to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfitA = (50 * UnitsA) - 1000\nProfitB = (70 * UnitsB) - 1500\nProfitC = (90 * UnitsC) - 2000\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a limited production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n# Due to market demand, the production of ComponentB must be at least twice the production of ComponentA.\nmodel.addCons(UnitsB >= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nAt least 200 units of product A must be produced.\n// A >= 200",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit, selling price per unit, and the effect of the new technology on production costs are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Reduction in Cost per Unit per $10,000 Investment |\n|---------|--------------------------|------------------------|--------------------------------------------------|\n| A       | $50                      | $100                   | $2                                               |\n| B       | $70                      | $120                   | $2                                               |\n| C       | $60                      | $110                   | $2                                               |\n\nThe manufacturer has a budget of $50,000 for investing in the new production technology. The total production capacity is limited to 1000 units across all products. At least 200 units of product A must be produced. \n\nPlease help the manufacturer to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-4:\nThe farmer has a budget of $5000 for water costs.\n// (100 - 0.1 * Irrigation) * (A + B + C) <= 5000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop and whether to invest in a new irrigation system. The yield and market price for each crop are given in the following Table.\n\n| Crop | Yield (kg/acre) | Market Price ($/kg) |\n|------|-----------------|---------------------|\n| A    | 500             | 2                   |\n| B    | 700             | 3                   |\n| C    | 900             | 4                   |\n\nThe investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n\nThe farmer has a total of 100 acres available for planting. The total investment in the irrigation system cannot exceed $10,000. The farmer wants to ensure that at least 20 acres are dedicated to each crop. The farmer has a budget of $5000 for water costs.\n\nPlease help the farmer to maximize the net profit from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100) # The farmer has a total of 100 acres available for planting.\nmodel.addCons(Irrigation <= 10000) # The total investment in the irrigation system cannot exceed $10,000.\nmodel.addCons((100 - 0.1 * Irrigation) * (A + B + C) <= 5000) # The farmer has a budget of $5000 for water costs.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1084,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// B >= 150\n\n## Generate Constraint-4:\nThe market demand for product C is at least 200 units per week.\n// C >= 200",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\nThe company has a total production capacity of 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at least 150 units per week. The market demand for product C is at least 200 units per week.\nPlease help the company determine the optimal number of units to produce for each product to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=200) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nProfit = 50*A + 70*B + 60*C - 0.01*A_sq - 0.02*B_sq - 0.015*C_sq\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production cost per unit is $60. For P2, the profit per unit is $120, and the production cost per unit is $70. The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company aims to maximize the total profit from both products.\n// Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n// Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 2000 units for P1 and 1500 units for P2.\n// P1 <= 2000\n// P2 <= 1500\n\n## Generate Constraint-3:\nThe total production time for both products cannot exceed 3000 hours. The production time for P1 is 2 hours per unit, and for P2 is 3 hours per unit.\n// 2 * P1 + 3 * P2 <= 3000\n\n## Generate Constraint-4:\nThe market demand for P1 is 1000 units. So, the company can only sell a maximum of 1000 units of P1.\n// P1 <= 1000\n\n## Generate Constraint-5:\nThe company must produce at least 500 units of P2 to meet contractual obligations.\n// P2 >= 500",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs. The profit per unit of P1 is $100, and the production cost per unit is $60. For P2, the profit per unit is $120, and the production cost per unit is $70. The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company aims to maximize the total profit from both products.\n\nThe company has a total budget of $100,000 for investment in the new technology. The company has a production capacity of 2000 units for P1 and 1500 units for P2. The total production time for both products cannot exceed 3000 hours, with P1 taking 2 hours per unit and P2 taking 3 hours per unit. The market demand for P1 is 1000 units, and the company must produce at least 500 units of P2 to meet contractual obligations.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=1000) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=500, ub=1500) # quantity of P2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested.\n## Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n## Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n## So, the objective function is: Maximize (Profit_P1 + Profit_P2)\nProfit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\nProfit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n## The company has a production capacity of 2000 units for P1 and 1500 units for P2.\nmodel.addCons(P1 <= 2000)\nmodel.addCons(P2 <= 1500)\n## The total production time for both products cannot exceed 3000 hours.\nmodel.addCons(2 * P1 + 3 * P2 <= 3000)\n## The market demand for P1 is 1000 units.\nmodel.addCons(P1 <= 1000)\n## The company must produce at least 500 units of P2 to meet contractual obligations.\nmodel.addCons(P2 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1090,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n// Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n// Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n// Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2). The company has a total of 50 trucks available for allocation. Please help the company to maximize its profit from transportation services.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n## Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n## Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n## Convert the quadratic terms to linear terms by introducing new variables\nTrucksASquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksASquared\")\nTrucksBSquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksBSquared\")\nTrucksCSquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksCSquared\")\nmodel.addCons(TrucksASquared == TrucksA * TrucksA)\nmodel.addCons(TrucksBSquared == TrucksB * TrucksB)\nmodel.addCons(TrucksCSquared == TrucksC * TrucksC)\n\nProfitA = (5000 - (2000 + 0.1 * TrucksASquared)) * TrucksA\nProfitB = (7000 - (3000 + 0.15 * TrucksBSquared)) * TrucksB\nProfitC = (9000 - (4000 + 0.2 * TrucksCSquared)) * TrucksC\n\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 716,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit.\n// {\"production rate of machine 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different product with varying profit margins. \nMachine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. \nMachine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. \nMachine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit.\nThe plant aims to maximize the total daily profit from all three products.\n// The daily profit from machine 1: D1 = 10 * P1 * 5\n// The daily profit from machine 2: D2 = 15 * P2 * 7\n// The daily profit from machine 3: D3 = 20 * P3 * 6\n// So, the objective function is: Maximize (D1 + D2 + D3)\n\n## Generate Constraint-1:\nThe total daily production time for all machines is limited to 8 hours.\n// P1 + P2 + P3 <= 8\n\n## Generate Constraint-2:\nThe production capacity of each machine is limited. Machine 1 can produce up to 100 units per day, Machine 2 up to 150 units per day, and Machine 3 up to 200 units per day.\n// 10 * P1 <= 100; 15 * P2 <= 150; 20 * P3 <= 200\n\n## Generate Constraint-3:\nThe plant must produce at least 50 units of product A, 75 units of product B, and 100 units of product C daily to meet minimum customer demands.\n// 10 * P1 >= 50; 15 * P2 >= 75; 20 * P3 >= 100",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit. Machine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit. The plant aims to maximize the total daily profit from all three products. The total daily production time for all machines is limited to 8 hours. The production capacity of each machine is limited: Machine 1 can produce up to 100 units per day, Machine 2 up to 150 units per day, and Machine 3 up to 200 units per day. The plant must also produce at least 50 units of product A, 75 units of product B, and 100 units of product C daily to meet minimum customer demands. Please help the manager determine the optimal production rates for each machine to maximize daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of machine 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of machine 3\n\n# Define objective function\nD1 = 10 * P1 * 5\nD2 = 15 * P2 * 7\nD3 = 20 * P3 * 6\n# So, the objective function is: Maximize (D1 + D2 + D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == D1 + D2 + D3)\n\n# Add constraints\n# The total daily production time for all machines is limited to 8 hours.\nmodel.addCons(P1 + P2 + P3 <= 8)\n# The production capacity of each machine is limited.\nmodel.addCons(10 * P1 <= 100)\nmodel.addCons(15 * P2 <= 150)\nmodel.addCons(20 * P3 <= 200)\n# The plant must produce at least 50 units of product A, 75 units of product B, and 100 units of product C daily to meet minimum customer demands.\nmodel.addCons(10 * P1 >= 50)\nmodel.addCons(15 * P2 >= 75)\nmodel.addCons(20 * P3 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of Machine 1: \", model.getVal(P1))\n    print(\"Production rate of Machine 2: \", model.getVal(P2))\n    print(\"Production rate of Machine 3: \", model.getVal(P3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\n// {\"solar panels in Location A\": \"Solar_A\", \"range\": \"Solar_A >= 0\", \"type\": \"integer\"}\n// {\"wind turbines in Location B\": \"Wind_B\", \"range\": \"Wind_B >= 0\", \"type\": \"integer\"}\n// {\"energy-efficient lighting systems in Location C\": \"Light_C\", \"range\": \"Light_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n// NPV = \u03a3(annual energy savings - maintenance cost) / (1 + discount rate)^year - installation cost\n// So, the objective function is: Maximize NPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05)^1 + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05)^1 + (50 * Light_C - 5 * Light_C) / (1 + 0.05)^1 - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation of all systems.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C). The company needs to determine how many units of each system to install in each location. The cost of installation, estimated annual energy savings, and maintenance cost for each system are given in the following Table.\n\n| System Type       | Location | Installation Cost | Annual Energy Savings | Maintenance Cost |\n|-------------------|----------|-------------------|-----------------------|------------------|\n| Solar Panels      | A        | $500 per unit     | $100 per unit         | $10 per unit     |\n| Wind Turbines     | B        | $1000 per unit    | $200 per unit         | $20 per unit     |\n| Energy-Efficient Lighting | C | $300 per unit     | $50 per unit          | $5 per unit      |\n\nThe company has a budget of $150,000 for the installation of all systems. The company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs. Please help the company determine the optimal number of units to install in each location to maximize the NPV.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar_A = model.addVar(vtype=\"INTEGER\", name=\"Solar_A\", lb=0) # solar panels in Location A\nWind_B = model.addVar(vtype=\"INTEGER\", name=\"Wind_B\", lb=0) # wind turbines in Location B\nLight_C = model.addVar(vtype=\"INTEGER\", name=\"Light_C\", lb=0) # energy-efficient lighting systems in Location C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate NPV\nNPV_Solar_A = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05) - 500 * Solar_A\nNPV_Wind_B = (200 * Wind_B - 20 * Wind_B) / (1 + 0.05) - 1000 * Wind_B\nNPV_Light_C = (50 * Light_C - 5 * Light_C) / (1 + 0.05) - 300 * Light_C\n\n## the objective function is: Maximize NPV = NPV_Solar_A + NPV_Wind_B + NPV_Light_C\nmodel.addCons(obj == NPV_Solar_A + NPV_Wind_B + NPV_Light_C)\n\n# Add constraints\n## The company has a budget of $150,000 for the installation of all systems.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Location A: \", model.getVal(Solar_A))\n    print(\"Number of Wind Turbines in Location B: \", model.getVal(Wind_B))\n    print(\"Number of Energy-Efficient Lighting Systems in Location C: \", model.getVal(Light_C))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The objective is to maximize the total production while meeting these thresholds.\n// Total production of component A: PA = 10 * WA\n// Total production of component B: PB = 15 * WB\n// Total production of component C: PC = 20 * WC\n// Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 25 workers.\n// WA <= 25; WB <= 25; WC <= 25\n\n## Generate Constraint-3:\nThe production of component A must be at least 500 units.\n// PA >= 500\n\n## Generate Constraint-4:\nThe production of component B must be at least 750 units.\n// PB >= 750\n\n## Generate Constraint-5:\nThe production of component C must be at least 1000 units.\n// PC >= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line. The production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The total number of workers available is 50, and each production line can handle a maximum of 25 workers. \n\nPlease help the manufacturer to maximize the total production of components A, B, and C while meeting the thresholds and constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\nPA = 10 * WA\nPB = 15 * WB\nPC = 20 * WC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\nmodel.addCons(WA + WB + WC <= 50) # total number of workers available is 50\nmodel.addCons(WA <= 25) # each production line can handle a maximum of 25 workers\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\nmodel.addCons(PA >= 500) # production of component A must be at least 500 units\nmodel.addCons(PB >= 750) # production of component B must be at least 750 units\nmodel.addCons(PC >= 1000) # production of component C must be at least 1000 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40\n\n## Generate Constraint-3:\nThe demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3.\n// 100 * P1 + 120 * P2 + 140 * P3 >= 2000\n\n## Generate Constraint-4:\nThe demand for component B requires at least 3000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 15 hours on line 3.\n// 150 * P1 + 180 * P2 + 200 * P3 >= 3000\n\n## Generate Constraint-5:\nThe demand for component C requires at least 4000 units to be produced, which is equivalent to 20 hours of production on line 1, 18.18 hours on line 2, and 16.67 hours on line 3.\n// 200 * P1 + 220 * P2 + 240 * P3 >= 4000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit. Each hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. Each hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. Each hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C. The total operating hours for all production lines cannot exceed 100 hours per week, and each production line can operate for a maximum of 40 hours per week. The demand for component A requires at least 2000 units to be produced, the demand for component B requires at least 3000 units to be produced, and the demand for component C requires at least 4000 units to be produced. Please help the company to maximize the total profit from producing these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize PA + PB + PC\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n# The demand for component A requires at least 2000 units to be produced\nmodel.addCons(100 * P1 + 120 * P2 + 140 * P3 >= 2000)\n# The demand for component B requires at least 3000 units to be produced\nmodel.addCons(150 * P1 + 180 * P2 + 200 * P3 >= 3000)\n# The demand for component C requires at least 4000 units to be produced\nmodel.addCons(200 * P1 + 220 * P2 + 240 * P3 >= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily.\n// {\"production rate of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"operating hours of the production line\": \"Hours\", \"range\": \"Hours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily revenue. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n// Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n// Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n// Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production rate of all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe production line can operate for a maximum of 24 hours per day.\n// Hours <= 24",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3. The company aims to maximize its daily revenue. The total production rate of all products cannot exceed 100 units per hour, and the production line can operate for a maximum of 24 hours per day.\n\nPlease help the company to maximize its daily revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of Product 3\nHours = model.addVar(vtype=\"CONTINUOUS\", name=\"Hours\", lb=0) # operating hours of the production line\n\n# Define objective function\nR1 = 100 * P1 * Hours * (1 - 0.01 * P1)\nR2 = 150 * P2 * Hours * (1 - 0.01 * P2)\nR3 = 200 * P3 * Hours * (1 - 0.01 * P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 100)\nmodel.addCons(Hours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Operating Hours of the Production Line: \", model.getVal(Hours))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\n// {\"quantity of Chocolate cake\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Vanilla cake\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"quantity of Strawberry cake\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production capacity and wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_C = 30 * C - 10 * C\n// Profit_V = 25 * V - 8 * V\n// Profit_S = 20 * S - 5 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / (1.5 * C + 1 * V + 0.5 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited production time of 80 hours.\n// 1.5 * C + 1 * V + 0.5 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for ingredient costs.\n// 10 * C + 8 * V + 5 * S <= 2000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production time of 80 hours and a budget of $2000 for ingredient costs.\nPlease help the bakery to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chocolate cake\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # quantity of Vanilla cake\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of Strawberry cake\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (30 - 10) * C\nProfit_V = (25 - 8) * V\nProfit_S = (20 - 5) * S\nProductionTime = 1.5 * C + 1 * V + 0.5 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a limited production time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 0.5 * S <= 80)\n## The bakery has a budget of $2000 for ingredient costs.\nmodel.addCons(10 * C + 8 * V + 5 * S <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chocolate cake: \", model.getVal(C))\n    print(\"Quantity of Vanilla cake: \", model.getVal(V))\n    print(\"Quantity of Strawberry cake: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the investment in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for all products is $50. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\n// Total profit for ProductB: Profit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\n// Total profit for ProductC: Profit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1,000 units of each product are produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000\n\n## Generate Constraint-5:\nThe total cost of energy efficiency upgrades and production costs must not exceed the company's budget of $200,000.\n// 50 * (ProdA + ProdB + ProdC) + EnergyEfficiency <= 200000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They also need to determine the investment in a new energy-efficient technology that reduces the energy cost per unit produced. The revenue generated per unit and the initial energy cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Initial Energy Cost per Unit |\n|---------|------------------|------------------------------|\n| ProductA | $100             | $50                          |\n| ProductB | $120             | $50                          |\n| ProductC | $150             | $50                          |\n\nThe energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades. The company has a total production capacity of 10,000 units across all products. The investment in energy efficiency upgrades cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must ensure that at least 1,000 units of each product are produced. The total cost of energy efficiency upgrades and production costs must not exceed the company's budget of $200,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000)  # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000)  # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000)  # production quantity for ProductC\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\nProfit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\nProfit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)  # total production capacity constraint\nmodel.addCons(EnergyEfficiency <= 50000)  # investment in energy efficiency constraint\nmodel.addCons(ProdA >= 2 * ProdB)  # market demand constraint for ProductA\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a backup generator. The decision involves the number of solar panels, wind turbines, and the capacity of the backup generator.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of the backup generator (in kW)\": \"Generator\", \"range\": \"Generator >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 200 kWh per year. The cost of each wind turbine is $2000, and it generates 500 kWh per year. The cost of the backup generator is $50 per kW, and it consumes 100 kWh per kW per year. The company wants to minimize the total cost of energy generation and consumption.\n// Total cost of solar panels: Cost_Solar = 1000 * Solar\n// Total cost of wind turbines: Cost_Wind = 2000 * Wind\n// Total cost of backup generator: Cost_Generator = 50 * Generator\n// Total energy generated: Energy = 200 * Solar + 500 * Wind - 100 * Generator (negative sign for consumption)\n// So, the objective function is: Minimize Cost_Total = Cost_Solar + Cost_Wind + Cost_Generator\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 50 * Generator <= 50000\n\n## Generate Constraint-2:\nThe total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh.\n// 200 * Solar + 500 * Wind - 100 * Generator >= 20000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a backup generator. The decision involves the number of solar panels, wind turbines, and the capacity of the backup generator. The cost of each solar panel is $1000, and it generates 200 kWh per year. The cost of each wind turbine is $2000, and it generates 500 kWh per year. The cost of the backup generator is $50 per kW, and it consumes 100 kWh per kW per year. The company has a budget of $50,000 for the installation. The total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh. Please help the company to minimize the total cost of energy generation and consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGenerator = model.addVar(vtype=\"CONTINUOUS\", name=\"Generator\", lb=0) # capacity of the backup generator\n\n# Define objective function\nCost_Solar = 1000 * Solar\nCost_Wind = 2000 * Wind\nCost_Generator = 50 * Generator\nCost_Total = Cost_Solar + Cost_Wind + Cost_Generator\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Total)\n\n# Add constraints\n# The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 50 * Generator <= 50000)\n# The total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh.\nmodel.addCons(200 * Solar + 500 * Wind - 100 * Generator >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Backup Generator: \", model.getVal(Generator))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 712,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains.\n// {\"number of solar panels on flat rooftops\": \"FlatPanels\", \"range\": \"FlatPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped rooftops\": \"SlopedPanels\", \"range\": \"SlopedPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on open fields\": \"FieldPanels\", \"range\": \"FieldPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by terrain type. On flat rooftops, each panel produces 150 kWh per day. On sloped rooftops, each panel produces 180 kWh per day due to better sunlight exposure. On open fields, each panel produces 160 kWh per day but requires additional maintenance costs, which are $5 per panel per day. The company aims to maximize the total daily energy production minus the maintenance costs.\n// Total daily energy production: Energy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\n// Total daily maintenance cost: Maintenance = 5 * FieldPanels\n// So, the objective function is: Maximize (Energy - Maintenance)\n\n## Generate Constraint-1:\nThe company has a budget to install a maximum of 1000 solar panels in total.\n// FlatPanels + SlopedPanels + FieldPanels <= 1000",
        "question": "A renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains. The efficiency of solar panels varies by terrain type. On flat rooftops, each panel produces 150 kWh per day. On sloped rooftops, each panel produces 180 kWh per day due to better sunlight exposure. On open fields, each panel produces 160 kWh per day but requires additional maintenance costs, which are $5 per panel per day. The company aims to maximize the total daily energy production minus the maintenance costs. The company has a budget to install a maximum of 1000 solar panels in total. Please help the company to determine the optimal number of solar panels to install on each type of terrain.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlatPanels = model.addVar(vtype=\"INTEGER\", name=\"FlatPanels\", lb=0) # number of solar panels on flat rooftops\nSlopedPanels = model.addVar(vtype=\"INTEGER\", name=\"SlopedPanels\", lb=0) # number of solar panels on sloped rooftops\nFieldPanels = model.addVar(vtype=\"INTEGER\", name=\"FieldPanels\", lb=0) # number of solar panels on open fields\n\n# Define objective function\nEnergy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\nMaintenance = 5 * FieldPanels\n# So, the objective function is: Maximize (Energy - Maintenance)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Maintenance)\n\n# Add constraints\n# The company has a budget to install a maximum of 1000 solar panels in total.\nmodel.addCons(FlatPanels + SlopedPanels + FieldPanels <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Rooftops: \", model.getVal(FlatPanels))\n    print(\"Number of Solar Panels on Sloped Rooftops: \", model.getVal(SlopedPanels))\n    print(\"Number of Solar Panels on Open Fields: \", model.getVal(FieldPanels))\n    print(\"Maximized Daily Energy Production (minus maintenance costs): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit.\n// {\"number of workers on component A line\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B line\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C line\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. \nEach worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. \nEach worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker.\nThe company aims to maximize the total profit from all three components.\n// The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n// The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n// The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of component A, 150 units of component B, and 200 units of component C daily. Each worker can produce 1 unit per hour.\n// W1 >= 100; W2 >= 150; W3 >= 200",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit. Each worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. Each worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. Each worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker. The company has a total of 50 workers available and each production line can accommodate up to 20 workers. The company must produce at least 100 units of component A, 150 units of component B, and 200 units of component C daily. Each worker can produce 1 unit per hour. Please help the company to maximize the total profit from all three components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=100) # number of workers on component A line\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=150) # number of workers on component B line\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=200) # number of workers on component C line\n\n# Define objective function\n## The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n## The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n## The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n## So, the objective function is: Maximize P = P1 + P2 + P3\nP1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\nP2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\nP3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The company has a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n## Each production line can accommodate up to 20 workers.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Component A Line: \", model.getVal(W1))\n    print(\"Number of Workers on Component B Line: \", model.getVal(W2))\n    print(\"Number of Workers on Component C Line: \", model.getVal(W3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, due to market saturation, the profit per unit decreases nonlinearly with an increase in production. The profit function is defined as: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\n// So, the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints.\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, due to market saturation, the profit per unit decreases nonlinearly with an increase in production. The profit function is defined as: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\nThe company has a total production capacity of 1000 units per month.\nPlease help the company determine the optimal number of units of each component to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n## convert the non-linear terms to variables\nA_term = model.addVar(name=\"A_term\")\nB_term = model.addVar(name=\"B_term\")\nC_term = model.addVar(name=\"C_term\")\nmodel.addCons(A_term == A * (1 - 0.01 * A))\nmodel.addCons(B_term == B * (1 - 0.01 * B))\nmodel.addCons(C_term == C * (1 - 0.01 * C))\nmodel.addCons(obj == 50 * A_term + 70 * B_term + 90 * C_term)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations.\n// {\"quantity of ChemX\": \"ChemX\", \"range\": \"ChemX >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemY\": \"ChemY\", \"range\": \"ChemY >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemZ\": \"ChemZ\", \"range\": \"ChemZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nThe profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nThe profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit (profit minus production and storage costs).\n// NetProfit_ChemX = (100 - 50 - 10) * ChemX\n// NetProfit_ChemY = (150 - 70 - 15) * ChemY\n// NetProfit_ChemZ = (200 - 100 - 20) * ChemZ\n// So, the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / (ChemX + ChemY + ChemZ)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// ChemX + ChemY + ChemZ <= 200\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\n// ChemY <= 2 * ChemX\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for production costs.\n// 50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10,000\n\n## Generate Constraint-4:\nThe company must produce at least 10 units of each chemical to meet contractual obligations.\n// ChemX >= 10; ChemY >= 10; ChemZ >= 10",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations. The profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. The profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. The profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20. The company wants to maximize the net profit per unit (profit minus production and storage costs). The company has a total production capacity of 200 units across all chemicals. Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX. The company has a budget of $10,000 for production costs. The company must produce at least 10 units of each chemical to meet contractual obligations. Please help the company to maximize the net profit per unit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemX = model.addVar(vtype=\"INTEGER\", name=\"ChemX\", lb=10) # quantity of ChemX\nChemY = model.addVar(vtype=\"INTEGER\", name=\"ChemY\", lb=10) # quantity of ChemY\nChemZ = model.addVar(vtype=\"INTEGER\", name=\"ChemZ\", lb=10) # quantity of ChemZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_ChemX = (100 - 50 - 10) * ChemX\nNetProfit_ChemY = (150 - 70 - 15) * ChemY\nNetProfit_ChemZ = (200 - 100 - 20) * ChemZ\nTotalProduction = ChemX + ChemY + ChemZ\n## the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(ChemX + ChemY + ChemZ <= 200)\n## Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\nmodel.addCons(ChemY <= 2 * ChemX)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChemX: \", model.getVal(ChemX))\n    print(\"Quantity of ChemY: \", model.getVal(ChemY))\n    print(\"Quantity of ChemZ: \", model.getVal(ChemZ))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investment in production efficiency.\n// Efficiency <= 10000\n\n## Generate Constraint-3:\nThe company has a limited raw material budget of $5000.\n// 30 * A + 50 * B <= 5000",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit, cost of raw materials per unit, and initial production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit | Initial Production Time per Unit |\n|---------|-----------------|--------------------------------|----------------------------------|\n| A       | $100            | $30                            | 5 hours                          |\n| B       | $150            | $50                            | 6 hours                          |\n\nFor every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The company has a total production capacity of 200 hours. The company has a budget of $10,000 for investment in production efficiency. The company has a limited raw material budget of $5000. \n\nPlease help the company to maximize the total profit, considering the efficiency investment and the constraints on production time and raw materials budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n## The company has a budget of $10,000 for investment in production efficiency.\nmodel.addCons(Efficiency <= 10000)\n## The company has a limited raw material budget of $5000.\nmodel.addCons(30 * A + 50 * B <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1254,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $20, for B is $30, and for C is $40. The selling price for A is $50, for B is $60, and for C is $70. The plant has a limited production capacity and aims to maximize the profit per unit of production capacity used.\n// Profit for A: Profit_A = (50 - 20) * A\n// Profit for B: Profit_B = (60 - 30) * B\n// Profit for C: Profit_C = (70 - 40) * C\n// Production capacity used for A: Cap_A = A\n// Production capacity used for B: Cap_B = 2 * B\n// Production capacity used for C: Cap_C = 3 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n\n## Generate Constraint-1:\nThe total production cost must not exceed $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit. The production cost and selling price for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price |\n|-----------|-----------------|---------------|\n| A         | $20             | $50           |\n| B         | $30             | $60           |\n| C         | $40             | $70           |\n\nThe plant has a limited production capacity and aims to maximize the profit per unit of production capacity used. The production capacity used for component A is equal to the number of A produced, for B is twice the number of B produced, and for C is three times the number of C produced. The total production cost must not exceed $10,000.\n\nPlease help the plant to maximize the profit per unit of production capacity used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (60 - 30) * B\nProfit_C = (70 - 40) * C\nCap_A = A\nCap_B = 2 * B\nCap_C = 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Cap_A + Cap_B + Cap_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production cost must not exceed $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit.\n// {\"quantity of WidgetA\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetB\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetC\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets.\n// Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\n// Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\n// Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\n// So, the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all types of widgets.\n// WidgetA + WidgetB + WidgetC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetB <= 2 * WidgetA\n\n## Generate Constraint-3:\nThe company has a minimum order requirement from a key client for WidgetC, which must be at least 50 units.\n// WidgetC >= 50\n\n## Generate Constraint-4:\nThe storage facility has a limited space, and the total volume of all widgets produced must not exceed 1200 cubic units. The volume per unit of WidgetA is 2 cubic units, WidgetB is 3 cubic units, and WidgetC is 4 cubic units.\n// 2 * WidgetA + 3 * WidgetB + 4 * WidgetC <= 1200",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit. The profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company has a total production capacity of 500 units across all types of widgets. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. The company has a minimum order requirement from a key client for WidgetC, which must be at least 50 units. The storage facility has a limited space, and the total volume of all widgets produced must not exceed 1200 cubic units. The volume per unit of WidgetA is 2 cubic units, WidgetB is 3 cubic units, and WidgetC is 4 cubic units. Please help the company to maximize the total profit from the sales of all widgets.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # quantity of WidgetA\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # quantity of WidgetB\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=50) # quantity of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetA == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (10 - 0.01 * WidgetA2) * WidgetA2 * WidgetA_b2 + 10 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=150)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=150, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetB == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (15 - 0.01 * WidgetB2) * WidgetB2 * WidgetB_b2 + 15 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=50, ub=200)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=200, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetC == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (20 - 0.01 * WidgetC2) * WidgetC2 * WidgetC_b2 + 20 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetA + WidgetB + WidgetC <= 500)\nmodel.addCons(WidgetB <= 2 * WidgetA)\nmodel.addCons(2 * WidgetA + 3 * WidgetB + 4 * WidgetC <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of WidgetA: \", model.getVal(WidgetA))\n    print(\"Quantity of WidgetB: \", model.getVal(WidgetB))\n    print(\"Quantity of WidgetC: \", model.getVal(WidgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit margin.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced above 100. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced above 200. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced above 300. The company wants to maximize the total profit.\n// Profit for ProductA: Profit_ProductA = (50 - 0.1 * max(ProductAQty - 100, 0)) * ProductAQty\n// Profit for ProductB: Profit_ProductB = (70 - 0.2 * max(ProductBQty - 200, 0)) * ProductBQty\n// Profit for ProductC: Profit_ProductC = (90 - 0.3 * max(ProductCQty - 300, 0)) * ProductCQty\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all products combined.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit margin. The profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced above 100. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced above 200. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced above 300. The company wants to maximize the total profit. The company has a total production capacity of 500 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. Please help the company determine the optimal production quantities for ProductA, ProductB, and ProductC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0)  # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0)  # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0)  # production quantity for ProductC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ProductA = (50 - 0.1 * max(ProductAQty - 100, 0)) * ProductAQty\nProductAQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty1\", lb=0, ub=100)\nProductAQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty2\", lb=100, ub=500)\nProductA_b1 = model.addVar(vtype=\"B\", name=\"ProductA_b1\")\nProductA_b2 = model.addVar(vtype=\"B\", name=\"ProductA_b2\")\nmodel.addCons(ProductA_b1 + ProductA_b2 == 1)\nmodel.addCons(ProductAQty == ProductAQty1*ProductA_b1 + ProductAQty2*ProductA_b2)\nProfit_ProductA = (50 - 0.1 * (ProductAQty2 - 100)) * ProductAQty2 * ProductA_b2\n\n## create piecewise variables for piecewise function: Profit_ProductB = (70 - 0.2 * max(ProductBQty - 200, 0)) * ProductBQty\nProductBQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty1\", lb=0, ub=200)\nProductBQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty2\", lb=200, ub=500)\nProductB_b1 = model.addVar(vtype=\"B\", name=\"ProductB_b1\")\nProductB_b2 = model.addVar(vtype=\"B\", name=\"ProductB_b2\")\nmodel.addCons(ProductB_b1 + ProductB_b2 == 1)\nmodel.addCons(ProductBQty == ProductBQty1*ProductB_b1 + ProductBQty2*ProductB_b2)\nProfit_ProductB = (70 - 0.2 * (ProductBQty2 - 200)) * ProductBQty2 * ProductB_b2\n\n## create piecewise variables for piecewise function: Profit_ProductC = (90 - 0.3 * max(ProductCQty - 300, 0)) * ProductCQty\nProductCQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty1\", lb=0, ub=300)\nProductCQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty2\", lb=300, ub=500)\nProductC_b1 = model.addVar(vtype=\"B\", name=\"ProductC_b1\")\nProductC_b2 = model.addVar(vtype=\"B\", name=\"ProductC_b2\")\nmodel.addCons(ProductC_b1 + ProductC_b2 == 1)\nmodel.addCons(ProductCQty == ProductCQty1*ProductC_b1 + ProductCQty2*ProductC_b2)\nProfit_ProductC = (90 - 0.3 * (ProductCQty2 - 300)) * ProductCQty2 * ProductC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)\nmodel.addCons(ProductBQty <= 2 * ProductAQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized.\n// {\"production level of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n// Total profit: Profit = 50 * A + 70 * B + 90 * C\n// Environmental cost: Cost = 10 * C\n// So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized. Each unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost. The total production capacity is limited to 1000 units across all products. Please help the manufacturer determine the optimal production levels for products A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 90 * C\n## Environmental cost: Cost = 10 * C\n## So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * C\nNetProfit = Profit - Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of product A: \", model.getVal(A))\n    print(\"Production level of product B: \", model.getVal(B))\n    print(\"Production level of product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 639,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\n// {\"hours reactor 1 operates\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 2 operates\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 3 operates\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\n// Total production of chemical A: P_A = 10 * R1 + 7 * R2 + 9 * R3\n// Total production of chemical B: P_B = 5 * R1 + 12 * R2 + 8 * R3\n// Total production of chemical C: P_C = 8 * R1 + 6 * R2 + 10 * R3\n// The objective function is: Maximize (P_A + P_B + P_C) / (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total operational hours for all reactors must not exceed 100 hours.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nEach reactor has a minimum operational requirement of 20 hours to ensure proper functioning.\n// R1 >= 20; R2 >= 20; R3 >= 20\n\n## Generate Constraint-3:\nThe production of chemical B must be at least twice the production of chemical A.\n// P_B >= 2 * P_A\n// 5 * R1 + 12 * R2 + 8 * R3 >= 2 * (10 * R1 + 7 * R2 + 9 * R3)",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production. The production rates for each reactor are given in the following Table.\n\n| Reactor | Chemical A | Chemical B | Chemical C |\n|---------|------------|------------|------------|\n| 1       | 10 units   | 5 units    | 8 units    |\n| 2       | 7 units    | 12 units   | 6 units    |\n| 3       | 9 units    | 8 units    | 10 units   |\n\nThe total operational hours for all reactors must not exceed 100 hours. Each reactor has a minimum operational requirement of 20 hours to ensure proper functioning. The production of chemical B must be at least twice the production of chemical A. \n\nPlease help the manager to maximize the total production of all chemicals while minimizing the operational hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=20) # hours reactor 1 operates\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=20) # hours reactor 2 operates\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=20) # hours reactor 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 10 * R1 + 7 * R2 + 9 * R3\nP_B = 5 * R1 + 12 * R2 + 8 * R3\nP_C = 8 * R1 + 6 * R2 + 10 * R3\nTotalProduction = P_A + P_B + P_C\nTotalHours = R1 + R2 + R3\n## the objective function is: Maximize (P_A + P_B + P_C) / TotalHours\n## convert the division to multiplication\nmodel.addCons(obj * TotalHours == TotalProduction)\n\n# Add constraints\n## The total operational hours for all reactors must not exceed 100 hours.\nmodel.addCons(R1 + R2 + R3 <= 100)\n## The production of chemical B must be at least twice the production of chemical A.\nmodel.addCons(5 * R1 + 12 * R2 + 8 * R3 >= 2 * (10 * R1 + 7 * R2 + 9 * R3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Reactor 1 Operates: \", model.getVal(R1))\n    print(\"Hours Reactor 2 Operates: \", model.getVal(R2))\n    print(\"Hours Reactor 3 Operates: \", model.getVal(R3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the farmer also knows that the more acres of a single crop are planted, the less efficient the farming becomes. Specifically, for every additional acre of a crop, the profit per acre decreases by 0.1% for that crop. The farmer aims to maximize the total profit from all crops.\n// Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n// Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n// Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n// So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 10 acres of each crop to maintain soil health.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the more acres of a single crop are planted, the less efficient the farming becomes, with the profit per acre decreasing by 0.1% for that crop for each additional acre. The farmer aims to maximize the total profit from all crops. The farmer has a total of 100 acres available for planting and must plant at least 10 acres of each crop to maintain soil health.\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 acres of each crop to maintain soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 100 * (1 - 0.001 * A)\nP_B = 150 * (1 - 0.001 * B)\nP_C = 200 * (1 - 0.001 * C)\n## the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\nmodel.addCons(obj == P_A * A + P_B * B + P_C * C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal production quantity for each product to maximize profit while considering the limited resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a selling price of $50, a material cost of $20, and requires 3 units of labor. \nProduct B has a selling price of $70, a material cost of $30, and requires 4 units of labor. \nProduct C has a selling price of $90, a material cost of $40, and requires 5 units of labor.\nThe plant aims to maximize the total profit per unit of labor used.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for material costs.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal production quantity for each product to maximize profit while considering the limited resources. The selling price, material cost, and labor units required for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Labor Units |\n|---------|---------------|---------------|-------------|\n| A       | $50           | $20           | 3           |\n| B       | $70           | $30           | 4           |\n| C       | $90           | $40           | 5           |\n\nThe plant has a budget of $10,000 for material costs. The plant aims to maximize the total profit per unit of labor used. Please help the plant determine the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nLabor = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $10,000 for material costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a selling price of $50, a material cost of $20, and requires 1 hour of labor. Product B has a selling price of $70, a material cost of $30, and requires 2 hours of labor. Product C has a selling price of $100, a material cost of $40, and requires 3 hours of labor. The company aims to maximize its profit, which is defined as the total revenue minus the total cost.\n// Revenue of A: Revenue_A = 50 * A\n// Revenue of B: Revenue_B = 70 * B\n// Revenue of C: Revenue_C = 100 * C\n// Cost of A: Cost_A = 20 * A + 1 * A\n// Cost of B: Cost_B = 30 * B + 2 * B\n// Cost of C: Cost_C = 40 * C + 3 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a limited labor capacity of 1500 hours for the next quarter.\n// A + 2 * B + 3 * C <= 1500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit. The selling price, material cost, and labor hours required for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Labor Hours |\n|---------|---------------|---------------|-------------|\n| A       | $50           | $20           | 1 hour      |\n| B       | $70           | $30           | 2 hours     |\n| C       | $100          | $40           | 3 hours     |\n\nThe company has a total budget of $10,000 for material costs for the next quarter. The company also has a limited labor capacity of 1500 hours for the next quarter. Please help the company to maximize its profit, which is defined as the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 100 * C\nCost_A = 20 * A + 1 * A\nCost_B = 30 * B + 2 * B\nCost_C = 40 * C + 3 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a limited labor capacity of 1500 hours for the next quarter.\nmodel.addCons(A + 2 * B + 3 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the level of quality control to minimize defects.\n// {\"production quantity\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"quality control level\": \"QualityControl\", \"range\": \"QualityControl >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling each unit of the product is $100. The cost of production per unit is $60, which decreases by $0.5 for every $1,000 spent on quality control. The cost of advertising per $1,000 spent is $100, but it increases the revenue per unit by $2. The company aims to maximize its net profit.\n// Net profit: Profit = (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Quantity <= 10000\n\n## Generate Constraint-2:\nThe total budget for advertising cannot exceed $50,000.\n// Advertising <= 50000\n\n## Generate Constraint-3:\nThe level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate.\n// QualityControl >= 20000\n\n## Generate Constraint-4:\nThe production quantity must be at least 5,000 units to meet contractual obligations.\n// Quantity >= 5000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the level of quality control to minimize defects. The revenue from selling each unit of the product is $100. The cost of production per unit is $60, which decreases by $0.5 for every $1,000 spent on quality control. The cost of advertising per $1,000 spent is $100, but it increases the revenue per unit by $2. The company aims to maximize its net profit.\nThe company has a production capacity limit of 10,000 units for the quarter. The total budget for advertising cannot exceed $50,000. The level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate. The production quantity must be at least 5,000 units to meet contractual obligations.\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=5000, ub=10000)  # production quantity\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0, ub=50000)  # advertising budget\nQualityControl = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControl\", lb=20000)  # quality control level\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit: Profit = (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising\nmodel.addCons(obj == (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising)\n\n# Add constraints\n## The total budget for advertising cannot exceed $50,000.\nmodel.addCons(Advertising <= 50000)\n## The level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate.\nmodel.addCons(QualityControl >= 20000)\n## The production quantity must be at least 5,000 units to meet contractual obligations.\nmodel.addCons(Quantity >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Quality Control Level: \", model.getVal(QualityControl))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The revenue and cost of fertilizer per ton for each crop are given in the following Table.\n\n| Crop | Revenue per Ton | Cost of Fertilizer per Ton |\n|------|-----------------|----------------------------|\n| A    | $100            | $30                        |\n| B    | $150            | $40                        |\n| C    | $200            | $50                        |\n\nThe farmer wants to maximize his net profit (revenue minus cost). The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. Please help the farmer determine the optimal quantity of each crop to plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 40) * B\nProfit_C = (200 - 50) * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to optimize their profit.\n// {\"quantity of Chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chemical A, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor Chemical B, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nFor Chemical C, the revenue per unit is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit of storage space used.\n// NetProfit_A = (100 - 50 - 10) * A\n// NetProfit_B = (150 - 70 - 15) * B\n// NetProfit_C = (200 - 100 - 20) * C\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) / (10 * A + 15 * B + 20 * C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to optimize their profit.\nFor Chemical A, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor Chemical B, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nFor Chemical C, the revenue per unit is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit of storage space used. The company has a total production capacity of 200 units across all chemicals.\nPlease help the company determine the optimal production quantities for each chemical.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chemical C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (100 - 50 - 10) * A\nNetProfit_B = (150 - 70 - 15) * B\nNetProfit_C = (200 - 100 - 20) * C\nStorageCost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to decide the production quantity of each product and the amount of money to be invested in improving the production efficiency, which will reduce the production cost per unit.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of both products decreases by $5 for every $10,000 invested in efficiency upgrades. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Efficiency)) * Prod1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Efficiency)) * Prod2\n// So, the objective function is: Maximize (Profit1 + Profit2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units per month. The total production of both products must not exceed this capacity.\n// Prod1 + Prod2 <= 10000\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 1,000 units of Product 1.\n// Prod1 >= 1000\n\n## Generate Constraint-4:\nThe company must produce at least 500 units of Product 2.\n// Prod2 >= 500",
        "question": "A manufacturing company produces two types of products. The company needs to decide the production quantity of each product and the amount of money to be invested in improving the production efficiency, which will reduce the production cost per unit. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The production cost per unit of both products decreases by $5 for every $10,000 invested in efficiency upgrades. The company aims to maximize the total profit from both products.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| 1       | $100                             | $150                   |\n| 2       | $150                             | $200                   |\n\nThe company has a total production capacity of 10,000 units per month. The total production of both products must not exceed this capacity. The total investment in production efficiency upgrades cannot exceed $50,000. The company must produce at least 1,000 units of Product 1 and at least 500 units of Product 2.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=1000)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=500)   # production quantity of Product 2\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # investment in production efficiency\n\n# Define objective function\nProfit1 = (150 - (100 - 0.0005 * Efficiency)) * Prod1\nProfit2 = (200 - (150 - 0.0005 * Efficiency)) * Prod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2)\n\n# Add constraints\nmodel.addCons(Prod1 + Prod2 <= 10000)  # total production capacity constraint\nmodel.addCons(Efficiency <= 50000)     # investment in efficiency constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1269,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| A       | 50$                      | 100$                   |\n| B       | 70$                      | 120$                   |\n| C       | 60$                      | 110$                   |\n\nThe manufacturer has a budget of $50,000 for investing in the new production technology. Please help the manufacturer determine the optimal production quantities for products A, B, and C, and the investment in the new production technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of each crop (in tons per acre) is affected by the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n// Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n// Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n// Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation improvements.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe farm wants to ensure at least 20 acres are dedicated to each crop.\n// Wheat >= 20; Corn >= 20; Soybeans >= 20\n\n## Generate Constraint-4:\nThe total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\n// Irrigation >= 10000",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop. The yield of each crop (in tons per acre) increases with the investment in irrigation, where every $1000 invested increases the yield by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling prices for the crops are $200 per ton for wheat, $300 per ton for corn, and $400 per ton for soybeans. The farm aims to maximize its total revenue from the crops.\n\n| Crop       | Selling Price per Ton | Yield Increase per $1000 Investment |\n|------------|-----------------------|-------------------------------------|\n| Wheat      | $200                  | 0.1 tons per acre                   |\n| Corn       | $300                  | 0.2 tons per acre                   |\n| Soybeans   | $400                  | 0.15 tons per acre                  |\n\nThe farm has the following constraints:\n- The total acres available for planting are 100.\n- The farm has a budget of $50,000 for irrigation improvements.\n- The farm wants to ensure at least 20 acres are dedicated to each crop.\n- The total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\n\nPlease help the farm to maximize its total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=20)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=20)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=20)  # acres of soybeans\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=10000)  # investment in irrigation\n\n# Define objective function\nRevenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\nRevenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\nRevenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n# So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\nmodel.addCons(Wheat + Corn + Soybeans <= 100)  # total acres available for planting are 100\nmodel.addCons(Irrigation <= 50000)  # farm has a budget of $50,000 for irrigation improvements\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1508,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component.\n// The cost function is: Cost = 10 * PA + 15 * PB + 20 * PC\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units.\n// PA >= 500 / 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs. The cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component. The demand for component A is at least 500 units, and each hour of production line A produces 50 units. Please help the company determine the optimal number of hours for each production line to operate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nCost = 10 * PA + 15 * PB + 20 * PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The demand for component A is at least 500 units, and each hour of production line A produces 50 units.\nmodel.addCons(PA >= 500 / 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 616,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand.\n// Production cost of product 1: C1 = 50 - 0.002 * Automation * P1\n// Production cost of product 2: C2 = 70 - 0.002 * Automation * P2\n// Production cost of product 3: C3 = 90 - 0.002 * Automation * P3\n// Total production cost: Cost = C1 + C2 + C3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3.\n// P1 >= 100; P2 >= 150; P3 >= 200\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 500 units per product type.\n// P1 <= 500; P2 <= 500; P3 <= 500\n\n## Generate Constraint-4:\nThe company has a budget constraint on the total production cost, which should not exceed $100,000.\n// Cost <= 100000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand. The company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3. The total investment in automation cannot exceed $50,000. The total production capacity is limited to 500 units per product type. The company has a budget constraint on the total production cost, which should not exceed $100,000. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=100, ub=500) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=150, ub=500) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=200, ub=500) # production quantity of product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nC1 = 50 - 0.002 * Automation * P1\nC2 = 70 - 0.002 * Automation * P2\nC3 = 90 - 0.002 * Automation * P3\nCost = C1 + C2 + C3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(P1 >= 100)\nmodel.addCons(P2 >= 150)\nmodel.addCons(P3 >= 200)\nmodel.addCons(Automation <= 50000)\nmodel.addCons(P1 <= 500)\nmodel.addCons(P2 <= 500)\nmodel.addCons(P3 <= 500)\nmodel.addCons(Cost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n// Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\n// So, the objective function is: Maximize Revenue\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Production <= 10000\n\n## Generate Constraint-2:\nThe total advertising budget must not exceed $50,000.\n// Advertising <= 50000\n\n## Generate Constraint-3:\nThe number of sales representatives must be at least 5 to maintain adequate customer service.\n// SalesReps >= 5\n\n## Generate Constraint-4:\nThe company has a budget constraint where the sum of the production cost, advertising budget, and salaries for sales representatives must not exceed $1,000,000.\n// Production * 50 + Advertising + SalesReps * 5000 <= 1000000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire. Each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\nThe company has a production capacity limit of 10,000 units for the quarter. The total advertising budget must not exceed $50,000. The number of sales representatives must be at least 5 to maintain adequate customer service. The company has a budget constraint where the sum of the production cost, advertising budget, and salaries for sales representatives must not exceed $1,000,000.\nPlease help the company to maximize the total sales revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nSalesReps = model.addVar(vtype=\"INTEGER\", name=\"SalesReps\", lb=0) # number of sales representatives\n\n# Define objective function\nRevenue = 100 * Production + 0.5 * Advertising + 20000 * SalesReps\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue)\n\n# Add constraints\nmodel.addCons(Production <= 10000) # production capacity limit\nmodel.addCons(Advertising <= 50000) # advertising budget limit\nmodel.addCons(SalesReps >= 5) # minimum number of sales representatives\nmodel.addCons(Production * 50 + Advertising + SalesReps * 5000 <= 1000000) # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Sales Representatives: \", model.getVal(SalesReps))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations. The cost and weekly profit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Purchase Cost | Weekly Profit |\n|--------------|---------------|---------------|\n| Trucks       | $50,000       | $10,000       |\n| Vans         | $30,000       | $7,000        |\n| Bikes        | $5,000        | $3,000        |\n\nThe company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. Please help the company to maximize the total weekly profit while considering the purchase costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit - Cost)\nProfit = 10000 * T + 7000 * V + 3000 * B\nCost = 50000 * T + 30000 * V + 5000 * B\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the level of automation to implement, which affects the production efficiency.\n// {\"hours allocated to product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours allocated to product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours allocated to product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency for each product type increases with the level of automation. Specifically, for product 1, each unit of automation increases efficiency by 5%; for product 2, by 7%; and for product 3, by 6%. The company aims to maximize the total production output, which is the sum of the outputs of each product type.\n// Output of product 1: O1 = H1 * (1 + 0.05 * Automation)\n// Output of product 2: O2 = H2 * (1 + 0.07 * Automation)\n// Output of product 3: O3 = H3 * (1 + 0.06 * Automation)\n// So, the objective function is: Maximize O1 + O2 + O3\n\n## Generate Constraint-1:\nThe total hours available for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe level of automation must be between 0 and 100 units.\n// 0 <= Automation <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product 1, 700 units of product 2, and 600 units of product 3.\n// O1 >= 500\n// O2 >= 700\n// O3 >= 600",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the level of automation to implement, which affects the production efficiency. The production efficiency for each product type increases with the level of automation. Specifically, for product 1, each unit of automation increases efficiency by 5%; for product 2, by 7%; and for product 3, by 6%. The company aims to maximize the total production output, which is the sum of the outputs of each product type.\n\nThe company has a total of 168 hours available for production in a week. The level of automation must be between 0 and 100 units. The company must produce at least 500 units of product 1, 700 units of product 2, and 600 units of product 3.\n\nPlease help the company determine the optimal allocation of hours to each product type and the level of automation to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours allocated to product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours allocated to product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours allocated to product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nO1 = H1 * (1 + 0.05 * Automation)\nO2 = H2 * (1 + 0.07 * Automation)\nO3 = H3 * (1 + 0.06 * Automation)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == O1 + O2 + O3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\nmodel.addCons(O1 >= 500)\nmodel.addCons(O2 >= 700)\nmodel.addCons(O3 >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 979,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000\n\n## Generate Constraint-2:\nDue to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentB <= 2 * ComponentA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints. The profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company has a total production capacity of 1000 units across all components. Due to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA. Please help the company to maximize the total profit from the sales of these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=0) # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=0) # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0) # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * ComponentA_b2 + 10 * ComponentA1 * ComponentA_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * ComponentB_b2 + 15 * ComponentB1 * ComponentB_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=1000)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * ComponentC_b2 + 20 * ComponentC1 * ComponentC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\nmodel.addCons(ComponentB <= 2 * ComponentA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products. The company has a budget of $50,000 for investment in energy efficiency. The total production capacity for all products is limited to 10,000 units. Please help the company determine the optimal production quantities for products A, B, and C, and the amount to invest in energy efficiency to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $50,000 for investment in energy efficiency.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\n// Prod1 <= 1000; Prod2 <= 800\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products. The company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2. The total investment in automation cannot exceed $50,000. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=0) # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0) # production quantity of Product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\nProfit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\nmodel.addCons(Prod1 <= 1000)\nmodel.addCons(Prod2 <= 800)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor C2, the revenue per unit is $120, the production cost per unit is $60, and the storage cost per unit is $15. \nFor C3, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit stored.\n// NetProfit_C1 = (100 - 50 - 10) * C1\n// NetProfit_C2 = (120 - 60 - 15) * C2\n// NetProfit_C3 = (150 - 70 - 20) * C3\n// So, the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / (10 * C1 + 15 * C2 + 20 * C3)\n\n## Generate Constraint-1:\nThe company has a production capacity of 200 units in total.\n// C1 + C2 + C3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 10,000\n\n## Generate Constraint-3:\nThe storage space is limited to 150 units.\n// 10 * C1 + 15 * C2 + 20 * C3 <= 150\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\n// C1 <= 50\n\n## Generate Constraint-5:\nThe company must produce at least 20 units of C2 to fulfill a contract.\n// C2 >= 20",
        "question": "A manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit. For C1, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. For C2, the revenue per unit is $120, the production cost per unit is $60, and the storage cost per unit is $15. For C3, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $20. The company wants to maximize the net profit per unit stored. The company has a production capacity of 200 units in total. The company has a budget of $10,000 for production costs. The storage space is limited to 150 units. The market demand for C1 is 50 units, so the company can only sell a maximum of 50 units of C1. The company must produce at least 20 units of C2 to fulfill a contract. Please help the company to determine the optimal production quantities for each chemical.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)  # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=20)  # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0)  # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_C1 = (100 - 50 - 10) * C1\nNetProfit_C2 = (120 - 60 - 15) * C2\nNetProfit_C3 = (150 - 70 - 20) * C3\nStorageCost = 10 * C1 + 15 * C2 + 20 * C3\n## the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == NetProfit_C1 + NetProfit_C2 + NetProfit_C3)\n\n# Add constraints\n## The company has a production capacity of 200 units in total.\nmodel.addCons(C1 + C2 + C3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 10000)\n## The storage space is limited to 150 units.\nmodel.addCons(10 * C1 + 15 * C2 + 20 * C3 <= 150)\n## The market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\nmodel.addCons(C1 <= 50)\n## The company must produce at least 20 units of C2 to fulfill a contract.\nmodel.addCons(C2 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Unit Stored: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n// Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n// Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n// Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\n// Q1 + Q2 + Q3 <= 1000\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 800 units.\n// Q1 + Q2 + Q3 <= 800",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals. The storage capacity of the plant is limited to 800 units. Please help the plant to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n## Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n## Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n## Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n## Convert quadratic terms to linear terms by introducing new variables and constraints\nQ1_sq = model.addVar(vtype=\"INTEGER\", name=\"Q1_sq\")\nQ2_sq = model.addVar(vtype=\"INTEGER\", name=\"Q2_sq\")\nQ3_sq = model.addVar(vtype=\"INTEGER\", name=\"Q3_sq\")\nmodel.addCons(Q1_sq == Q1 * Q1)\nmodel.addCons(Q2_sq == Q2 * Q2)\nmodel.addCons(Q3_sq == Q3 * Q3)\n\nProfit_C1 = 100 * Q1 - (50 + 0.1 * Q1_sq)\nProfit_C2 = 150 * Q2 - (75 + 0.15 * Q2_sq)\nProfit_C3 = 200 * Q3 - (100 + 0.2 * Q3_sq)\n\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\nmodel.addCons(Q1 + Q2 + Q3 <= 1000)\n## The storage capacity of the plant is limited to 800 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Phone is $100, for Tablet is $200, and for Laptop is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\n// Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. The Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g of this metal. The total available supply of this rare metal is 2000 g.\n// 5 * Phone + 8 * Tablet + 10 * Laptop <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units.\n// Phone <= 500; Tablet <= 400; Laptop <= 300\n\n## Generate Constraint-3:\nThe company has a production capacity of 1000 units in terms of the total number of devices it can produce.\n// Phone + Tablet + Laptop <= 1000\n\n## Generate Constraint-4:\nThe company must produce at least 100 units of each device to maintain its market presence and customer loyalty.\n// Phone >= 100; Tablet >= 100; Laptop >= 100",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand. The profit per unit for each device and the requirements for a rare metal are given in the following Table.\n\n| Device   | Profit per Unit | Rare Metal Requirement (g) |\n|----------|-----------------|----------------------------|\n| Phone    | $100            | 5                          |\n| Tablet   | $200            | 8                          |\n| Laptop   | $300            | 10                         |\n\nThe profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company has a total supply of 2000 g of the rare metal. The market demand limits for Phone, Tablet, and Laptop are 500 units, 400 units, and 300 units, respectively. The company has a production capacity of 1000 units in terms of the total number of devices it can produce. The company must also produce at least 100 units of each device to maintain its market presence and customer loyalty.\n\nPlease help the company to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 100 units of each device to maintain its market presence and customer loyalty.\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=100) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=100) # quantity of Tablet\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=100) # quantity of Laptop\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=500)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=400)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 200 * Tablet1 * Tablet_b1 + (200 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 300 * Laptop1 * Laptop_b1 + (300 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\n## The production of each device requires a specific amount of a rare metal. The Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g of this metal. The total available supply of this rare metal is 2000 g.\nmodel.addCons(5 * Phone + 8 * Tablet + 10 * Laptop <= 2000)\n## The market has a demand limit for each device. The demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units.\nmodel.addCons(Phone <= 500)\nmodel.addCons(Tablet <= 400)\nmodel.addCons(Laptop <= 300)\n## The company has a production capacity of 1000 units in terms of the total number of devices it can produce.\nmodel.addCons(Phone + Tablet + Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize profit.\n// {\"hours of operation for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different mix of components. Machine 1 produces resistors at a rate of 100 units per hour, capacitors at 50 units per hour, and inductors at 25 units per hour. Machine 2 produces resistors at 75 units per hour, capacitors at 100 units per hour, and inductors at 50 units per hour. Machine 3 produces resistors at 50 units per hour, capacitors at 75 units per hour, and inductors at 100 units per hour. The profit from resistors is $0.01 per unit, from capacitors is $0.02 per unit, and from inductors is $0.03 per unit. The objective is to maximize the total profit from all components.\n// Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n// Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n// Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n// Total profit: P = P1 + P2 + P3\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThe total available hours for all machines cannot exceed 100 hours.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nThe production of inductors must be at least 500 units.\n// 25 * M1 + 50 * M2 + 100 * M3 >= 500",
        "question": "A manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. Machine 1 produces resistors at a rate of 100 units per hour, capacitors at 50 units per hour, and inductors at 25 units per hour. Machine 2 produces resistors at 75 units per hour, capacitors at 100 units per hour, and inductors at 50 units per hour. Machine 3 produces resistors at 50 units per hour, capacitors at 75 units per hour, and inductors at 100 units per hour. The profit from resistors is $0.01 per unit, from capacitors is $0.02 per unit, and from inductors is $0.03 per unit. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize the total profit from all components. The total available hours for all machines cannot exceed 100 hours, and the production of inductors must be at least 500 units. Please help the manufacturer to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours of operation for machine 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours of operation for machine 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours of operation for machine 3\n\n# Define objective function\n## Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n## Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n## Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n## Total profit: P = P1 + P2 + P3\nP1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\nP2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\nP3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\nP = P1 + P2 + P3\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total available hours for all machines cannot exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 <= 100)\n## The production of inductors must be at least 500 units.\nmodel.addCons(25 * M1 + 50 * M2 + 100 * M3 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Machine 1: \", model.getVal(M1))\n    print(\"Hours of operation for Machine 2: \", model.getVal(M2))\n    print(\"Hours of operation for Machine 3: \", model.getVal(M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500,000\n\n## Generate Constraint-3:\nThe farm has a budget of $20,000 for fertilizer costs.\n// 200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20,000\n\n## Generate Constraint-4:\nDue to soil conditions, the area for CropA must be at least half of the area for CropB.\n// CropA_Area >= 0.5 * CropB_Area",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. The expected profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|---------|-----------------------------|-------------------------|-----------------------------|\n| CropA   | $1000                       | 5000 liters             | $200                        |\n| CropB   | $1200                       | 6000 liters             | $250                        |\n| CropC   | $1500                       | 7000 liters             | $300                        |\n\nThe farm has a total area of 100 hectares available for cultivation. The farm has a limited water supply of 500,000 liters. The farm has a budget of $20,000 for fertilizer costs. Due to soil conditions, the area for CropA must be at least half of the area for CropB. \nPlease help the farm to maximize the net profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=0) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=0) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=0) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500000)\n## The farm has a budget of $20,000 for fertilizer costs.\nmodel.addCons(200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20000)\n## Due to soil conditions, the area for CropA must be at least half of the area for CropB.\nmodel.addCons(CropA_Area >= 0.5 * CropB_Area)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 20% of the total production.\n// PA >= 0.2 * (PA + PB + PC)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n\n| Product | Profit per Unit | Cost Reduction per Unit (per $10,000 invested) |\n|---------|-----------------|-----------------------------------------------|\n| A       | $100            | $5                                            |\n| B       | $150            | $7                                            |\n| C       | $200            | $10                                           |\n\nThe company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 20% of the total production.\n\nPlease help the company determine the optimal production quantities for products A, B, and C, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nProfit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(PA >= 0.2 * (PA + PB + PC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1352,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components. The total operating hours for all production lines cannot exceed 100 hours per week.\nPlease help the company determine the optimal number of hours to operate each production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize PA + PB + PC\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit.\n// Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\n// Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\n// Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a contract to supply at least 10 acres of wheat.\n// W >= 10\n\n## Generate Constraint-3:\nDue to market demand, the farmer can only sell up to 20 acres of corn.\n// C <= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 15% of his land to soybeans for crop rotation purposes.\n// S >= 0.15 * (W + C + S)",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre and the costs for water and fertilizer for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Water Cost per Acre | Fertilizer Cost per Acre |\n|----------|-----------------|---------------------|--------------------------|\n| Wheat    | $300            | $10 (up to 10 acres) / $15 (over 10 acres) | $20 (up to 15 acres) / $25 (over 15 acres) |\n| Corn     | $400            | $15 (up to 10 acres) / $22.5 (over 10 acres) | $25 (up to 15 acres) / $31.25 (over 15 acres) |\n| Soybeans | $250            | $5 (up to 10 acres) / $7.5 (over 10 acres) | $15 (up to 15 acres) / $18.75 (over 15 acres) |\n\nThe farmer has a total of 50 acres of land available. He has a contract to supply at least 10 acres of wheat. Due to market demand, he can only sell up to 20 acres of corn. The farmer must allocate at least 15% of his land to soybeans for crop rotation purposes.\n\nPlease help the farmer to maximize his total profit, considering the nonlinear costs for water and fertilizer that increase for areas larger than specified thresholds.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=10) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0, ub=20) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0, ub=10)\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=10, ub=15)\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=15, ub=50)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nW_b3 = model.addVar(vtype=\"B\", name=\"W_b3\")\nmodel.addCons(W_b1 + W_b2 + W_b3 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2 + W3*W_b3)\nWaterCost_W = 10 * W1 * W_b1 + 10 * 1.5 * W2 * W_b2 + 10 * 1.5 * W3 * W_b3\nFertilizerCost_W = 20 * W1 * W_b1 + 20 * W2 * W_b2 + 20 * 1.25 * W3 * W_b3\nProfit_W = 300 * W - WaterCost_W - FertilizerCost_W\n\n## create piecewise variables for piecewise function: Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=10, ub=15)\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=15, ub=20)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nC_b3 = model.addVar(vtype=\"B\", name=\"C_b3\")\nmodel.addCons(C_b1 + C_b2 + C_b3 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2 + C3*C_b3)\nWaterCost_C = 15 * C1 * C_b1 + 15 * 1.5 * C2 * C_b2 + 15 * 1.5 * C3 * C_b3\nFertilizerCost_C = 25 * C1 * C_b1 + 25 * C2 * C_b2 + 25 * 1.25 * C3 * C_b3\nProfit_C = 400 * C - WaterCost_C - FertilizerCost_C\n\n## create piecewise variables for piecewise function: Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=10, ub=15)\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=15, ub=50)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nS_b3 = model.addVar(vtype=\"B\", name=\"S_b3\")\nmodel.addCons(S_b1 + S_b2 + S_b3 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2 + S3*S_b3)\nWaterCost_S = 5 * S1 * S_b1 + 5 * 1.5 * S2 * S_b2 + 5 * 1.5 * S3 * S_b3\nFertilizerCost_S = 15 * S1 * S_b1 + 15 * S2 * S_b2 + 15 * 1.25 * S3 * S_b3\nProfit_S = 250 * S - WaterCost_S - FertilizerCost_S\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\nmodel.addCons(W + C + S <= 50)\nmodel.addCons(S >= 0.15 * (W + C + S))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company wants to maximize the total profit.\n// The objective function is: Maximize P = 50A + 70B + 60C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe market demand for component A is at least 10 units, and for component B is at least 15 units.\n// A >= 10\n// B >= 15",
        "question": "A company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg. The market demand for component A is at least 10 units, and for component B is at least 15 units.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for component A is at least 10 units, and for component B is at least 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 659,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\n// Profit per acre of A: Profit_A = (100 - 20) * A\n// Profit per acre of B: Profit_B = (150 - 30) * B\n// Profit per acre of C: Profit_C = (200 - 40) * C\n// Total acres planted: Total_acres = A + B + C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit and cost per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost per Acre |\n|------|-----------------|---------------|\n| A    | $100            | $20           |\n| B    | $150            | $30           |\n| C    | $200            | $40           |\n\nThe farm has a total of 100 acres available for planting. The farmer wants to plant at least 10 acres of each crop. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 20) * A\nProfit_B = (150 - 30) * B\nProfit_C = (200 - 40) * C\nTotal_acres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n## convert the division to multiplication\nmodel.addCons(obj * Total_acres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines.\n// The production rate for machine 1: P1 = 10 * W1\n// The production rate for machine 2: P2 = 12 * W2\n// The production rate for machine 3: P3 = 15 * W3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 30 workers available for allocation.\n// W1 + W2 + W3 <= 30",
        "question": "A manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines. There are a total of 30 workers available for allocation.\nPlease help the manager determine the optimal number of workers to assign to each machine (W1 for Machine 1, W2 for Machine 2, and W3 for Machine 3) to maximize the total production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\n\n# Define objective function\nP1 = 10 * W1\nP2 = 12 * W2\nP3 = 15 * W3\n# So, the objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# There are a total of 30 workers available for allocation.\nmodel.addCons(W1 + W2 + W3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 707,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of energy-efficient lighting systems\": \"Lighting\", \"range\": \"Lighting >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it saves $200 annually in energy costs.\nThe cost of each wind turbine is $2000, and it saves $300 annually in energy costs.\nThe cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// Total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Lighting\n// Total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Lighting\n// So, the objective function is: Minimize Cost - Savings\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000\n\n## Generate Constraint-2:\nThe company aims to save at least $20,000 annually in energy costs.\n// 200 * Solar + 300 * Wind + 100 * Lighting >= 20000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels.\n// Solar >= 50",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities. The cost and annual energy savings for each type of installation are given in the following Table.\n\n| Installation Type | Cost per Unit | Annual Energy Savings per Unit |\n|-------------------|---------------|--------------------------------|\n| Solar Panels      | $1000         | $200                           |\n| Wind Turbines     | $2000         | $300                           |\n| Energy-Efficient Lighting Systems | $500 | $100                           |\n\nThe company has a budget of $100,000 for the installation. The company aims to save at least $20,000 annually in energy costs. The company must install at least 50 solar panels.\nPlease help the company to minimize the total cost of installation while maximizing the annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=50)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nLighting = model.addVar(vtype=\"INTEGER\", name=\"Lighting\", lb=0)  # number of energy-efficient lighting systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Lighting\nSavings = 200 * Solar + 300 * Wind + 100 * Lighting\n## the objective function is: Minimize Cost - Savings\nmodel.addCons(obj == Cost - Savings)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000)\n## The company aims to save at least $20,000 annually in energy costs.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Lighting >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Energy-Efficient Lighting Systems: \", model.getVal(Lighting))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements from distributors.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for product A is limited to 300 units due to equipment limitations.\n// A <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product C as product A.\n// C >= 2 * A",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. Product A has a unit profit of $50 and incurs a storage cost of $10 per unit. Product B has a unit profit of $70 and a storage cost of $5 per unit. Product C has a unit profit of $60 with no storage cost. The company wants to maximize its net profit, which is the total profit minus the total storage cost.\n\nThe company has a budget of $15,000 for production, where the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively. The company must produce at least 200 units in total to meet the minimum order requirements from distributors. The production capacity for product A is limited to 300 units due to equipment limitations. The company aims to produce at least twice as many units of product C as product A.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Cost = 10 * A + 5 * B\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements from distributors.\nmodel.addCons(A + B + C >= 200)\n## The production capacity for product A is limited to 300 units due to equipment limitations.\nmodel.addCons(A <= 300)\n## The company aims to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\n// Cost_A = 10 - 0.5 * Automation\n// Cost_B = 15 - 0.5 * Automation\n// Revenue_A = 20 * QA\n// Revenue_B = 25 * QB\n// Total_Cost = Cost_A * QA + Cost_B * QB\n// Total_Revenue = Revenue_A + Revenue_B\n// Profit = Total_Revenue - Total_Cost\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// QA + QB <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for implementing automation.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\n// QA <= 500",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 1000 units for both products combined. The company has a budget of $5000 for implementing automation. The market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\nPlease help the company to determine the optimal production quantities of Product A and Product B, and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=5000) # level of automation\n\n# Define objective function\nCost_A = 10 - 0.5 * Automation\nCost_B = 15 - 0.5 * Automation\nRevenue_A = 20 * QA\nRevenue_B = 25 * QB\nTotal_Cost = Cost_A * QA + Cost_B * QB\nTotal_Revenue = Revenue_A + Revenue_B\nProfit = Total_Revenue - Total_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QA + QB <= 1000)\nmodel.addCons(Automation <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company wants to maximize the total profit.\n// Profit for ProductA: Profit_A = (50 - 0.1 * max(ProdA - 100, 0)) * ProdA\n// Profit for ProductB: Profit_B = (70 - 0.2 * max(ProdB - 50, 0)) * ProdB\n// Profit for ProductC: Profit_C = (90 - 0.3 * max(ProdC - 20, 0)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units for all products combined.\n// ProdA + ProdB + ProdC <= 200",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. The profit per unit for each product decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company wants to maximize the total profit.\n\n| Product | Profit per Unit | Decrease per Unit Beyond Threshold | Threshold |\n|---------|-----------------|------------------------------------|-----------|\n| ProductA | $50             | $0.1                               | 100 units  |\n| ProductB | $70             | $0.2                               | 50 units   |\n| ProductC | $90             | $0.3                               | 20 units   |\n\nThe company has a total production capacity of 200 units for all products combined. Please help the company determine the optimal production quantity for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(ProdA - 100, 0)) * ProdA\nProdA1 = model.addVar(vtype=\"INTEGER\", name=\"ProdA1\", lb=0, ub=100)\nProdA2 = model.addVar(vtype=\"INTEGER\", name=\"ProdA2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProdA == ProdA1*A_b1 + ProdA2*A_b2)\nProfit_A = (50 - 0.1 * (ProdA2 - 100)) * ProdA2 * A_b2 + 50 * ProdA1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.2 * max(ProdB - 50, 0)) * ProdB\nProdB1 = model.addVar(vtype=\"INTEGER\", name=\"ProdB1\", lb=0, ub=50)\nProdB2 = model.addVar(vtype=\"INTEGER\", name=\"ProdB2\", lb=50, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProdB == ProdB1*B_b1 + ProdB2*B_b2)\nProfit_B = (70 - 0.2 * (ProdB2 - 50)) * ProdB2 * B_b2 + 70 * ProdB1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.3 * max(ProdC - 20, 0)) * ProdC\nProdC1 = model.addVar(vtype=\"INTEGER\", name=\"ProdC1\", lb=0, ub=20)\nProdC2 = model.addVar(vtype=\"INTEGER\", name=\"ProdC2\", lb=20, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProdC == ProdC1*C_b1 + ProdC2*C_b2)\nProfit_C = (90 - 0.3 * (ProdC2 - 20)) * ProdC2 * C_b2 + 90 * ProdC1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1309,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 units of raw material and 1 unit of labor.\nThe profit per unit of product B is $70, but it requires 3 units of raw material and 2 units of labor.\nThe profit per unit of product C is $100, but it requires 4 units of raw material and 3 units of labor.\nThe company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency.\n// Total profit: Profit = 50A + 70B + 100C\n// Resource usage: Raw material = 2A + 3B + 4C; Labor = A + 2B + 3C\n// The objective function is: Maximize Profit - k1 * (Raw material)^2 - k2 * (Labor)^2, where k1 and k2 are constants representing the cost of resource inefficiency.\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material available.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 500 units of labor available.\n// A + 2B + 3C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage. The profit per unit of product A is $50, which requires 2 units of raw material and 1 unit of labor. The profit per unit of product B is $70, which requires 3 units of raw material and 2 units of labor. The profit per unit of product C is $100, which requires 4 units of raw material and 3 units of labor. The company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency. The company has a total of 1000 units of raw material available and a total of 500 units of labor available. Please help the company to maximize its total profit, considering the objective function that includes the total profit minus the squared costs of raw material and labor inefficiencies, where the squared costs are represented by constants k1 and k2.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 4 * C\nLabor = A + 2 * B + 3 * C\n## The objective function is: Maximize Profit - k1 * (RawMaterial)^2 - k2 * (Labor)^2\n## Convert the quadratic terms to linear by introducing new variables and constraints\nRawMaterial_sq = model.addVar('RawMaterial_sq')\nLabor_sq = model.addVar('Labor_sq')\nmodel.addCons(RawMaterial_sq == RawMaterial * RawMaterial)\nmodel.addCons(Labor_sq == Labor * Labor)\nk1 = 0.01  # Example constant for raw material inefficiency cost\nk2 = 0.01  # Example constant for labor inefficiency cost\nmodel.addCons(obj == Profit - k1 * RawMaterial_sq - k2 * Labor_sq)\n\n# Add constraints\n## The company has a total of 1000 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The company has a total of 500 units of labor available.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 994,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of hours each line operates per day, and the level of automation investment to reduce labor costs.\n// {\"number of production lines\": \"Lines\", \"range\": \"Lines >= 0\", \"type\": \"integer\"}\n// {\"hours per day each line operates\": \"Hours\", \"range\": \"Hours >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per hour decreases by $5 for every $10,000 invested in automation. The initial labor cost per hour is $100. The revenue generated per hour of production is $200. The company aims to maximize the total profit from production.\n// Total profit from production: Profit = (200 - 100 + 0.0005 * Automation) * Lines * Hours\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 30 production lines available. The company must ensure that at least 10 lines are operated.\n// Lines <= 30; Lines >= 10\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of hours each line operates per day, and the level of automation investment to reduce labor costs. The labor cost per hour decreases by $5 for every $10,000 invested in automation. The initial labor cost per hour is $100. The revenue generated per hour of production is $200. The company aims to maximize the total profit from production.\nThe company has a total of 30 production lines available and must ensure that at least 10 lines are operated. The total investment in automation cannot exceed $50,000.\nPlease help the company to maximize the total profit from production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to decide on the number of production lines to operate, the number of hours each line operates per day, and the level of automation investment to reduce labor costs.\nLines = model.addVar(vtype=\"INTEGER\", name=\"Lines\", lb=10, ub=30) # number of production lines\nHours = model.addVar(vtype=\"INTEGER\", name=\"Hours\", lb=0) # hours per day each line operates\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## The labor cost per hour decreases by $5 for every $10,000 invested in automation. The initial labor cost per hour is $100. The revenue generated per hour of production is $200.\nLaborCostPerHour = 100 - 0.0005 * Automation\n## The company aims to maximize the total profit from production.\nProfit = (200 - LaborCostPerHour) * Lines * Hours\n## So, the objective function is: Maximize Profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines: \", model.getVal(Lines))\n    print(\"Hours per Day Each Line Operates: \", model.getVal(Hours))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled technicians assigned to each production line.\n// {\"number of technicians on component A line\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians on component B line\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians on component C line\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach technician on the component A line can produce 10 units per hour, on the component B line can produce 15 units per hour, and on the component C line can produce 20 units per hour. The company aims to maximize the total production of all components. However, the efficiency of production decreases as more technicians are assigned due to space constraints and coordination issues. The efficiency function is given by E = 1 / (1 + T), where T is the number of technicians.\n// The production rate for component A: P1 = 10 * T1 * E1 = 10 * T1 / (1 + T1)\n// The production rate for component B: P2 = 15 * T2 * E2 = 15 * T2 / (1 + T2)\n// The production rate for component C: P3 = 20 * T3 * E3 = 20 * T3 / (1 + T3)\n// So, the objective function is: Maximize P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 30 skilled technicians available.\n// T1 + T2 + T3 <= 30\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 10 technicians due to space limitations.\n// T1 <= 10; T2 <= 10; T3 <= 10",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled technicians assigned to each production line. Each technician on the component A line can produce 10 units per hour, on the component B line can produce 15 units per hour, and on the component C line can produce 20 units per hour. The company aims to maximize the total production of all components. However, the efficiency of production decreases as more technicians are assigned due to space constraints and coordination issues. The efficiency function is given by E = 1 / (1 + T), where T is the number of technicians. The company has a total of 30 skilled technicians available. Each production line can accommodate a maximum of 10 technicians due to space limitations. Please help the company determine the optimal number of technicians to assign to each production line to maximize the total production of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of technicians on component A line\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n## {\"number of technicians on component B line\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n## {\"number of technicians on component C line\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of technicians on component A line\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of technicians on component B line\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of technicians on component C line\n\n# Define objective function\n## The production rate for component A: P1 = 10 * T1 * E1 = 10 * T1 / (1 + T1)\n## The production rate for component B: P2 = 15 * T2 * E2 = 15 * T2 / (1 + T2)\n## The production rate for component C: P3 = 20 * T3 * E3 = 20 * T3 / (1 + T3)\n## So, the objective function is: Maximize P1 + P2 + P3\nP1 = 10 * T1 / (1 + T1)\nP2 = 15 * T2 / (1 + T2)\nP3 = 20 * T3 / (1 + T3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## convert the division to multiplication\nmodel.addCons(obj * (1 + T1) == 10 * T1)\nmodel.addCons(obj * (1 + T2) == 15 * T2)\nmodel.addCons(obj * (1 + T3) == 20 * T3)\n\n# Add constraints\n## The company has a total of 30 skilled technicians available.\nmodel.addCons(T1 + T2 + T3 <= 30)\n## Each production line can accommodate a maximum of 10 technicians due to space limitations.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Technicians on Component A Line: \", model.getVal(T1))\n    print(\"Number of Technicians on Component B Line: \", model.getVal(T2))\n    print(\"Number of Technicians on Component C Line: \", model.getVal(T3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize their profit and resource usage.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $30, device B is $40, and device C is $50. The production cost per unit of device A is $10, device B is $20, and device C is $30. The manufacturer has a limited amount of a critical component that is used in the production of all devices. Each unit of device A requires 2 units of the component, device B requires 3 units, and device C requires 4 units. The manufacturer aims to maximize the total profit while considering the efficiency of component usage.\n// Profit of A: Profit_A = (30 - 10) * A = 20 * A\n// Profit of B: Profit_B = (40 - 20) * B = 20 * B\n// Profit of C: Profit_C = (50 - 30) * C = 20 * C\n// Component usage: Component_A = 2 * A, Component_B = 3 * B, Component_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Component_A + Component_B + Component_C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has 1000 units of the critical component available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-3:\nThe manufacturer wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize their profit and resource usage. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | $30             | $10                      |\n| B      | $40             | $20                      |\n| C      | $50             | $30                      |\n\nEach unit of device A requires 2 units of a critical component, device B requires 3 units, and device C requires 4 units. The manufacturer has a budget of $10,000 for production costs and 1000 units of the critical component available. The manufacturer wants to produce at least 50 units of each device. \n\nPlease help the manufacturer to maximize the total profit while considering the efficiency of component usage, which is defined as the sum of the profit from each device divided by the total usage of the critical component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 20) * B\nProfit_C = (50 - 30) * C\nComponent_A = 2 * A\nComponent_B = 3 * B\nComponent_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Component_A + Component_B + Component_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Component_A + Component_B + Component_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n## The manufacturer has 1000 units of the critical component available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Total cargo carried by TruckA: Cargo_TruckA = 10 * TruckA\n// Total cargo carried by TruckB: Cargo_TruckB = 15 * TruckB\n// Total cargo carried by TruckC: Cargo_TruckC = 20 * TruckC\n// Total fuel consumed: Fuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n\n## Generate Constraint-1:\nThe company has a total of 50 vehicles available.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints.\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\nThe company has a total of 50 vehicles available.\nPlease help the company to determine the optimal number of each type of vehicle to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n## the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Consumed == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC)\n\n# Add constraints\n## The company has a total of 50 vehicles available.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs.\n// Fuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\n// Carbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n// So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 5000",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs. The company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100. Please help the company to minimize the total cost, which includes both fuel and carbon footprint costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0) # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0) # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0) # number of Bikes\n\n# Define objective function\nFuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\nCarbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n# So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Carbon_Footprint_Cost)\n\n# Add constraints\n# The company has a budget of $5000 for vehicle maintenance.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least half the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $50,000. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, and for DeviceC is $20 per unit.\n// 10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit. The profit per unit and the cost of raw materials for each device are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit |\n|--------|-----------------|-----------------------------|\n| DeviceA | $50             | $10                         |\n| DeviceB | $70             | $15                         |\n| DeviceC | $90             | $20                         |\n\nThe production cost for each device increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company has a total production capacity of 1000 units for all devices combined. Due to market demand, the production of DeviceA must be at least half the production of DeviceB. The company has a limited budget for raw materials, which is $50,000.\n\nPlease help the company to maximize the total net profit, which is calculated as the sum of the profits from each device minus the respective production costs and raw material costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n## Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n## Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - 0.01 * DeviceA_Quantity**2) * DeviceA_Quantity\nProfit_DeviceB = (70 - 0.02 * DeviceB_Quantity**2) * DeviceB_Quantity\nProfit_DeviceC = (90 - 0.03 * DeviceC_Quantity**2) * DeviceC_Quantity\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n## Due to market demand, the production of DeviceA must be at least half the production of DeviceB.\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\n## The company has a limited budget for raw materials, which is $50,000.\nmodel.addCons(10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1297,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Chocolate cake sells for $20, costs $8 in ingredients, and takes 1.5 hours to bake. \nThe Vanilla cake sells for $18, costs $7 in ingredients, and takes 1 hour to bake. \nThe Strawberry cake sells for $22, costs $9 in ingredients, and takes 2 hours to bake.\nThe bakery aims to maximize the profit efficiency, which is defined as the total profit divided by the total baking time.\n// Profit_Chocolate = 20 * C - 8 * C\n// Profit_Vanilla = 18 * V - 7 * V\n// Profit_Strawberry = 22 * S - 9 * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 2 * S)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1500 for ingredients.\n// 8 * C + 7 * V + 9 * S <= 1500\n\n## Generate Constraint-2:\nThe bakery has a maximum baking capacity of 100 hours.\n// 1.5 * C + 1 * V + 2 * S <= 100",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. The selling price, cost of ingredients, and baking time for each cake are given in the following Table.\n\n| Cake Type     | Selling Price | Cost of Ingredients | Baking Time |\n|---------------|---------------|---------------------|-------------|\n| Chocolate     | $20           | $8                  | 1.5 hours   |\n| Vanilla       | $18           | $7                  | 1 hour      |\n| Strawberry    | $22           | $9                  | 2 hours     |\n\nThe bakery has a budget of $1500 for ingredients. The bakery has a maximum baking capacity of 100 hours. Please help the bakery to maximize the profit efficiency, which is defined as the total profit divided by the total baking time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (20 - 8) * C\nProfit_Vanilla = (18 - 7) * V\nProfit_Strawberry = (22 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(8 * C + 7 * V + 9 * S <= 1500)\n## The bakery has a maximum baking capacity of 100 hours.\nmodel.addCons(1.5 * C + 1 * V + 2 * S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(C))\n    print(\"Number of Vanilla cakes: \", model.getVal(V))\n    print(\"Number of Strawberry cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\n// Profit from A: Profit_A = 500 * HA\n// Profit from B: Profit_B = 700 * HB\n// Profit from C: Profit_C = 1000 * HC\n// Water usage: Water_A = 2 * HA, Water_B = 3 * HB, Water_C = 4 * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * HA + 3 * HB + 4 * HC <= 300\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 hectares to each crop.\n// HA >= 10; HB >= 10; HC >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\nThe farm has a total of 100 hectares available for cultivation. The farm has a total of 300 units of water available for irrigation. The farm must allocate at least 10 hectares to each crop.\nPlease help the farm to maximize its profit while considering water usage efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 hectares to each crop.\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=10) # hectares of crop A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=10) # hectares of crop B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * HA\nProfit_B = 700 * HB\nProfit_C = 1000 * HC\nWater_A = 2 * HA\nWater_B = 3 * HB\nWater_C = 4 * HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HA + HB + HC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * HA + 3 * HB + 4 * HC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Profit per Water Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from A: Revenue_A = 20 * A\n// Revenue from B: Revenue_B = 30 * B\n// Revenue from C: Revenue_C = 40 * C\n// Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\n// Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\n// So, the objective function is: Maximize (Total_Revenue - Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1000 for production costs.\n// 10 * A^0.5 + 15 * B^0.5 + 20 * C^0.5 <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost. The plant has a limited budget of $1000 for production costs. Please help the plant to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Revenue and Cost calculations\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Revenue = Revenue_A + Revenue_B + Revenue_C\n\n## Approximating the square root costs with additional variables\nsqrt_A = model.addVar(name=\"sqrt_A\")\nsqrt_B = model.addVar(name=\"sqrt_B\")\nsqrt_C = model.addVar(name=\"sqrt_C\")\nmodel.addCons(sqrt_A * sqrt_A == A)\nmodel.addCons(sqrt_B * sqrt_B == B)\nmodel.addCons(sqrt_C * sqrt_C == C)\n\nCost_A = 10 * sqrt_A\nCost_B = 15 * sqrt_B\nCost_C = 20 * sqrt_C\nTotal_Cost = Cost_A + Cost_B + Cost_C\n\n## the objective function is: Maximize (Total_Revenue - Total_Cost)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The plant has a limited budget of $1000 for production costs.\nmodel.addCons(10 * sqrt_A + 15 * sqrt_B + 20 * sqrt_C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 758,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how much land to allocate to each crop to maximize yield while considering soil fertility and water usage.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, but it requires 3 units of water per ton. \nFor Crop B, the yield per acre is 7 tons, but it requires 4 units of water per ton. \nFor Crop C, the yield per acre is 9 tons, but it requires 5 units of water per ton.\nThe farmer aims to maximize the total yield of crops (which is defined as the sum of the yields of each crop) while considering the water usage efficiency (which is defined as the total yield divided by the total water used).\n// Yield of A: Yield_A = 5 * A\n// Yield of B: Yield_B = 7 * B\n// Yield of C: Yield_C = 9 * C\n// Total water used: Water_used = 3 * 5 * A + 4 * 7 * B + 5 * 9 * C\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) / Water_used\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint that limits the total cost of seeds to $2000. The cost of seeds for Crop A is $20 per acre, for Crop B is $30 per acre, and for Crop C is $40 per acre.\n// 20 * A + 30 * B + 40 * C <= 2000",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how much land to allocate to each crop to maximize yield while considering soil fertility and water usage. The yield per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Water Required per Ton |\n|------|----------------|------------------------|\n| A    | 5 tons         | 3 units                |\n| B    | 7 tons         | 4 units                |\n| C    | 9 tons         | 5 units                |\n\nThe farmer has 100 acres of land available for cultivation. The farmer also has a budget constraint that limits the total cost of seeds to $2000, with the cost of seeds for Crop A being $20 per acre, for Crop B being $30 per acre, and for Crop C being $40 per acre.\n\nPlease help the farmer to maximize the total yield of crops while considering the water usage efficiency (which is defined as the total yield divided by the total water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nWater_used = 3 * 5 * A + 4 * 7 * B + 5 * 9 * C\n## the objective function is: Maximize (Yield_A + Yield_B + Yield_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n## The farmer has 100 acres of land available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget constraint that limits the total cost of seeds to $2000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Maximized Yield per Water Usage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate based on the number of workers assigned. \nOn production line 1, each worker contributes to a production rate of 10 units per hour. \nOn production line 2, each worker contributes to a production rate of 15 units per hour. \nOn production line 3, each worker contributes to a production rate of 20 units per hour. \nHowever, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). \nThe objective is to maximize the total production rate of all three lines.\n// The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n// The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n// The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n// So, the objective function is: Maximize R1 + R2 + R3\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// P1 + P2 + P3 <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// P1 <= 25; P2 <= 25; P3 <= 25\n\n## Generate Constraint-3:\nThe company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency. The efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead, with the efficiency function given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). The production rate per worker for each line is as follows:\n\n| Production Line | Production Rate per Worker |\n|-----------------|----------------------------|\n| 1               | 10 units per hour          |\n| 2               | 15 units per hour          |\n| 3               | 20 units per hour          |\n\nThe company has a total of 60 workers available. Each production line can be utilized by up to 25 workers at a time. The company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\n\nPlease help the company to maximize the total production rate of all three lines by determining the optimal number of workers to assign to each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=10) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n## convert the division to multiplication\nR1 = model.addVar('R1')\nmodel.addCons(R1 * (1 + 0.1 * P1**2) == 10 * P1)\n## The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\nR2 = model.addVar('R2')\nmodel.addCons(R2 * (1 + 0.1 * P2**2) == 15 * P2)\n## The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\nR3 = model.addVar('R3')\nmodel.addCons(R3 * (1 + 0.1 * P3**2) == 20 * P3)\n## So, the objective function is: Maximize R1 + R2 + R3\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(P1 + P2 + P3 <= 60)\n## Each production line can be utilized by up to 25 workers at a time.\nmodel.addCons(P1 <= 25)\nmodel.addCons(P2 <= 25)\nmodel.addCons(P3 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The manufacturer needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily. The goal is to minimize the total working hours required to meet the daily production targets.\n// Total working hours for product A: HA = 1000 / (10 * WA)\n// Total working hours for product B: HB = 1500 / (15 * WB)\n// Total working hours for product C: HC = 2000 / (20 * WC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available to allocate among the three production lines.\n// WA + WB + WC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The manufacturer needs to produce at least 1000 units of product A, 1500 units of product B, and 2000 units of product C daily. The goal is to minimize the total working hours required to meet the daily production targets. The manufacturer has a total of 50 workers available to allocate among the three production lines.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum of the total working hours for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Total working hours for product A: HA = 1000 / (10 * WA)\n## Total working hours for product B: HB = 1500 / (15 * WB)\n## Total working hours for product C: HC = 2000 / (20 * WC)\n## So, the objective function is: Minimize max(HA, HB, HC)\nHA = 1000 / (10 * WA)\nHB = 1500 / (15 * WB)\nHC = 2000 / (20 * WC)\n## Convert the division to multiplication\nHA = 1000 / (10 * WA)\nHB = 1500 / (15 * WB)\nHC = 2000 / (20 * WC)\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function is to minimize the maximum of HA, HB, HC\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available to allocate among the three production lines.\nmodel.addCons(WA + WB + WC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Minimum Total Working Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity of three different products and the level of automation to implement in the production process. The profit margins and the effect of automation on production costs are detailed in the following table:\n\n| Product | Profit Margin per Unit | Effect of Automation on Production Cost |\n|---------|------------------------|----------------------------------------|\n| 1       | $10                    | $0.5 reduction per $1,000 invested in automation |\n| 2       | $15                    | $0.5 reduction per $1,000 invested in automation |\n| 3       | $20                    | $0.5 reduction per $1,000 invested in automation |\n\nThe company has a total production capacity of 10,000 units across all products. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities for each product and the level of automation to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=0) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0) # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0) # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nmodel.addCons(obj == (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1021,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop.\n// {\"amount of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm owner wants to maximize the total profit from the crops. The profit per acre for corn is $300, for wheat is $250, and for soybeans is $200. However, the cost of fertilization per acre is $50 for corn, $30 for wheat, and $20 for soybeans. The owner wants to maximize the net profit per acre across all crops.\n// Profit_C = (300 - 50) * C\n// Profit_W = (250 - 30) * W\n// Profit_S = (200 - 20) * S\n// So, the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / (C + W + S)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// C + W + S <= 100\n\n## Generate Constraint-2:\nThe farm has a budget constraint for fertilization, which is $4000.\n// 50 * C + 30 * W + 20 * S <= 4000",
        "question": "A farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop. The profit per acre for corn is $300, for wheat is $250, and for soybeans is $200. However, the cost of fertilization per acre is $50 for corn, $30 for wheat, and $20 for soybeans. The owner wants to maximize the net profit per acre across all crops. The total available land for farming is 100 acres. The farm has a budget constraint for fertilization, which is $4000. Please help the farm owner to maximize the total profit from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of land for corn\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of land for wheat\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # amount of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (300 - 50) * C\nProfit_W = (250 - 30) * W\nProfit_S = (200 - 20) * S\nTotalLand = C + W + S\n## the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / TotalLand\n## convert the division to multiplication\nmodel.addCons(obj * TotalLand == Profit_C + Profit_W + Profit_S)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(C + W + S <= 100)\n## The farm has a budget constraint for fertilization, which is $4000.\nmodel.addCons(50 * C + 30 * W + 20 * S <= 4000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for Corn: \", model.getVal(C))\n    print(\"Amount of Land for Wheat: \", model.getVal(W))\n    print(\"Amount of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 608,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases non-linearly with the quantity produced due to economies of scale and resource constraints. The production cost function is given by: Cost_A = 2000 + 0.05 * (DeviceA_Units)^2, Cost_B = 3000 + 0.07 * (DeviceB_Units)^2, Cost_C = 4000 + 0.09 * (DeviceC_Units)^2. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 * DeviceA_Units) - Cost_A\n// Total net profit for DeviceB: Profit_B = (70 * DeviceB_Units) - Cost_B\n// Total net profit for DeviceC: Profit_C = (90 * DeviceC_Units) - Cost_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceA_Units <= 2 * DeviceB_Units\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs per month.\n// Cost_A + Cost_B + Cost_C <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// DeviceA_Units >= 100; DeviceB_Units >= 100; DeviceC_Units >= 100",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases non-linearly with the quantity produced due to economies of scale and resource constraints. The production cost function is given by: Cost_A = 2000 + 0.05 * (DeviceA_Units)^2, Cost_B = 3000 + 0.07 * (DeviceB_Units)^2, Cost_C = 4000 + 0.09 * (DeviceC_Units)^2. The company has a total production capacity of 1000 units per month. Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB. The company has a budget of $50,000 for production costs per month. The company wants to ensure that at least 100 units of each device are produced to maintain market presence. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=100)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=100)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=100)  # number of units of DeviceC\n\n# Define objective function\nCost_A = 2000 + 0.05 * DeviceA_Units**2\nCost_B = 3000 + 0.07 * DeviceB_Units**2\nCost_C = 4000 + 0.09 * DeviceC_Units**2\nProfit_A = 50 * DeviceA_Units - Cost_A\nProfit_B = 70 * DeviceB_Units - Cost_B\nProfit_C = 90 * DeviceC_Units - Cost_C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)  # Total production capacity constraint\nmodel.addCons(DeviceA_Units <= 2 * DeviceB_Units)  # Market demand constraint for DeviceA\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 50000)  # Budget constraint for production costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * P1 = 20 * P1\n// Profit_P2 = (40 - 15) * P2 = 25 * P2\n// Profit_P3 = (50 - 20) * P3 = 30 * P3\n// So, the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\n\n## Generate Constraint-1:\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit. The plant has a limited raw material supply, which allows for a maximum production of 100 units in total. Please help the plant to determine the optimal number of each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\nmodel.addCons(obj == 20 * P1 + 25 * P2 + 30 * P3)\n\n# Add constraints\n## The plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 576,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the production process is such that the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (50 * A / (1 + 0.01 * A^2) + 70 * B / (1 + 0.02 * B^2) + 90 * C / (1 + 0.03 * C^2))\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand. The profit per unit of component A is $50, component B is $70, and component C is $90. However, the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n\n| Component | Profit per Unit |\n|-----------|-----------------|\n| A         | $50             |\n| B         | $70             |\n| C         | $90             |\n\nThe total production capacity of the factory is limited to 1000 units per week. Please help the company determine the optimal number of units of each component to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with nonlinear terms\nProfit_A = 50 * A / (1 + 0.01 * A**2)\nProfit_B = 70 * B / (1 + 0.02 * B**2)\nProfit_C = 90 * C / (1 + 0.03 * C**2)\n\n## Convert the nonlinear terms to linear constraints\n## Introduce new variables and constraints to linearize the denominator\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\n## Update the profit functions with the new variables\nProfit_A = 50 * A / (1 + 0.01 * A_sq)\nProfit_B = 70 * B / (1 + 0.02 * B_sq)\nProfit_C = 90 * C / (1 + 0.03 * C_sq)\n\n## Convert the division to multiplication\nmodel.addCons(obj * (1 + 0.01 * A_sq) == 50 * A)\nmodel.addCons(obj * (1 + 0.02 * B_sq) == 70 * B)\nmodel.addCons(obj * (1 + 0.03 * C_sq) == 90 * C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n// Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n// Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n// Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\n\n## Generate Constraint-1:\nThe total area of land available for farming is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10000 for irrigation and fertilization costs.\n// 50 * W^2 + 60 * C^2 + 40 * B^2 + 30 * W^1.5 + 40 * C^1.5 + 20 * B^1.5 <= 10000",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop. The profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n\n| Crop   | Profit per Hectare | Irrigation Cost | Fertilization Cost |\n|--------|--------------------|-----------------|--------------------|\n| Wheat  | $1000              | $50 * W^2      | $30 * W^1.5        |\n| Corn   | $1200              | $60 * C^2      | $40 * C^1.5        |\n| Barley | $800               | $40 * B^2      | $20 * B^1.5        |\n\nThe total area of land available for farming is 100 hectares. The farmer has a budget of $10000 for irrigation and fertilization costs. Please help the farmer to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for barley\n\n# Define objective function\n## calculate the profit and costs\nProfit_wheat = 1000 * W - 50 * W**2 - 30 * W**1.5\nProfit_corn = 1200 * C - 60 * C**2 - 40 * C**1.5\nProfit_barley = 800 * B - 40 * B**2 - 20 * B**1.5\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_barley)\n\n# Add constraints\n## The total area of land available for farming is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a budget of $10000 for irrigation and fertilization costs.\nmodel.addCons(50 * W**2 + 60 * C**2 + 40 * B**2 + 30 * W**1.5 + 40 * C**1.5 + 20 * B**1.5 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Barley: \", model.getVal(B))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility.\n// {\"labor hours at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility produces a different type of component. The efficiency of production varies with the amount of labor hours invested. \nAt facility 1, the production rate of component 1 is 0.5 units per labor hour, and the production rate of component 2 is 0.3 units per labor hour. \nAt facility 2, the production rate of component 1 is 0.4 units per labor hour, and the production rate of component 2 is 0.6 units per labor hour. \nAt facility 3, the production rate of component 1 is 0.6 units per labor hour, and the production rate of component 2 is 0.4 units per labor hour.\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. Determine the minimum total labor hours required to meet the monthly demand.\n// The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n// The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n// So, the objective function is: Minimize max(T1, T2)\n\n## Generate Constraint-1:\nThe total labor hours available across all facilities is limited to 800 hours.\n// L1 + L2 + L3 <= 800\n\n## Generate Constraint-2:\nEach facility has a maximum capacity of 300 labor hours per month.\n// L1 <= 300; L2 <= 300; L3 <= 300\n\n## Generate Constraint-3:\nThe company aims to maintain a balanced workload across the facilities, requiring that no facility uses less than 20% of its maximum capacity.\n// L1 >= 0.2 * 300; L2 >= 0.2 * 300; L3 >= 0.2 * 300",
        "question": "A company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility. The production rates for each component at each facility are given in the following Table.\n\n| Facility | Component 1 Production Rate (units/hour) | Component 2 Production Rate (units/hour) |\n|----------|-----------------------------------------|-----------------------------------------|\n| 1        | 0.5                                     | 0.3                                     |\n| 2        | 0.4                                     | 0.6                                     |\n| 3        | 0.6                                     | 0.4                                     |\n\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. The total labor hours available across all facilities is limited to 800 hours. Each facility has a maximum capacity of 300 labor hours per month. The company aims to maintain a balanced workload across the facilities, requiring that no facility uses less than 20% of its maximum capacity.\n\nPlease help the company determine the minimum total labor hours required to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours at facility 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours at facility 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n## The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n## So, the objective function is: Minimize max(T1, T2)\n## Convert the division to multiplication\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\")\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\")\nmodel.addCons(T1 * (0.5 * L1 + 0.4 * L2 + 0.6 * L3) == 500)\nmodel.addCons(T2 * (0.3 * L1 + 0.6 * L2 + 0.4 * L3) == 400)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\n\n# Add constraints\n## The total labor hours available across all facilities is limited to 800 hours.\nmodel.addCons(L1 + L2 + L3 <= 800)\n## Each facility has a maximum capacity of 300 labor hours per month.\nmodel.addCons(L1 <= 300)\nmodel.addCons(L2 <= 300)\nmodel.addCons(L3 <= 300)\n## The company aims to maintain a balanced workload across the facilities, requiring that no facility uses less than 20% of its maximum capacity.\nmodel.addCons(L1 >= 0.2 * 300)\nmodel.addCons(L2 >= 0.2 * 300)\nmodel.addCons(L3 >= 0.2 * 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours at facility 1: \", model.getVal(L1))\n    print(\"Labor hours at facility 2: \", model.getVal(L2))\n    print(\"Labor hours at facility 3: \", model.getVal(L3))\n    print(\"Minimum total labor hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1320,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 20.\n// Cap + Res + Ind <= 20\n\n## Generate Constraint-3:\nAt least 5 machines must be dedicated to capacitors.\n// Cap >= 5\n\n## Generate Constraint-4:\nNo more than 10 machines can be used for resistors.\n// Res <= 10",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates and maintenance costs of these components depend on the number of machines dedicated to each type. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3. The following table summarizes the production and maintenance details for each type of component.\n\n| Component | Production Rate per Machine (units/hour) | Maintenance Cost per Machine ($/hour) |\n|-----------|-------------------------------------------|---------------------------------------|\n| Capacitors | 100                                      | 5                                     |\n| Resistors  | 150                                      | 7                                     |\n| Inductors  | 200                                      | 9                                     |\n\nThe manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 20. At least 5 machines must be dedicated to capacitors, and no more than 10 machines can be used for resistors. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. Please help the manufacturer determine the optimal allocation of machines to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=5)  # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0, ub=10)  # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0)  # number of machines for inductors\n\n# Define objective function\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n# So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n# The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n# The total number of machines available is 20.\nmodel.addCons(Cap + Res + Ind <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Capacitors: \", model.getVal(Cap))\n    print(\"Number of Machines for Resistors: \", model.getVal(Res))\n    print(\"Number of Machines for Inductors: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer has a total of 10 acres of land. The yield per acre for C1 is 500 kg, for C2 is 600 kg, and for C3 is 700 kg. The selling price per kg for C1 is $2, for C2 is $3, and for C3 is $4. The farmer wants to maximize his total revenue.\n// Revenue_C1 = 500 * A1 * 2\n// Revenue_C2 = 600 * A2 * 3\n// Revenue_C3 = 700 * A3 * 4\n// So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 10 acres of land.\n// A1 + A2 + A3 <= 10\n\n## Generate Constraint-2:\nDue to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\n// A1 + A2 <= 6",
        "question": "A farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop. The farmer has a total of 10 acres of land. The yield per acre for C1 is 500 kg, for C2 is 600 kg, and for C3 is 700 kg. The selling price per kg for C1 is $2, for C2 is $3, and for C3 is $4. The farmer wants to maximize his total revenue. Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres. Please help the farmer to maximize his total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\nRevenue_C1 = 500 * A1 * 2\nRevenue_C2 = 600 * A2 * 3\nRevenue_C3 = 700 * A3 * 4\n# So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n# Add constraints\n# The farmer has a total of 10 acres of land.\nmodel.addCons(A1 + A2 + A3 <= 10)\n# Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\nmodel.addCons(A1 + A2 <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for C1: \", model.getVal(A1))\n    print(\"Area of land for C2: \", model.getVal(A2))\n    print(\"Area of land for C3: \", model.getVal(A3))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 500,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## The profit function for smartphones is P_S = 500S - 0.1S^2\n## The profit function for tablets is P_T = 600T - 0.15T^2\n## The profit function for laptops is P_L = 800L - 0.2L^2\n## The objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = model.addVar(name=\"P_S\")\nP_T = model.addVar(name=\"P_T\")\nP_L = model.addVar(name=\"P_L\")\nP_total = model.addVar(name=\"P_total\")\n\nmodel.setObjective(P_total, \"maximize\")\n\nmodel.addCons(P_S == 500 * S - 0.1 * S**2)\nmodel.addCons(P_T == 600 * T - 0.15 * T**2)\nmodel.addCons(P_L == 800 * L - 0.2 * L**2)\nmodel.addCons(P_total == P_S + P_T + P_L)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $100,000\nmodel.addCons(200 * S + 300 * T + 500 * L <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 666,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000.\nFor V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000.\nFor V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000.\nThe company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n// Total_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\n// Fuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\n// Total_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n// So, the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// 5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000\n\n## Generate Constraint-2:\nThe total weight of the deliveries should not exceed 10,000 kg.\n// 1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company must use at least 5 vehicles in total.\n// V1 + V2 + V3 >= 5",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity. For V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000. For V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000. For V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000. The company has a budget of $100,000 for purchasing vehicles. The total weight of the deliveries should not exceed 10,000 kg. The company must use at least 5 vehicles in total. Please help the company to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\nFuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\nTotal_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n## the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost + Fuel_Consumption * Total_Weight)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000)\n## The total weight of the deliveries should not exceed 10,000 kg.\nmodel.addCons(1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000)\n## The company must use at least 5 vehicles in total.\nmodel.addCons(V1 + V2 + V3 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Minimized Total Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit.\n// {\"land allocated to crop A\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $1500, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $2000, but it requires 4 units of water per hectare.\nThe farm aims to maximize its total profit while considering the water usage efficiency (profit per unit of water).\n// Profit from A: Profit_A = 1000 * LA\n// Profit from B: Profit_B = 1500 * LB\n// Profit from C: Profit_C = 2000 * LC\n// Total water usage: Water_Total = 2 * LA + 3 * LB + 4 * LC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// LA + LB + LC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * LA + 3 * LB + 4 * LC <= 300",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit. The profit per hectare and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Required per Hectare |\n|------|---------------------|----------------------------|\n| A    | $1000               | 2 units                    |\n| B    | $1500               | 3 units                    |\n| C    | $2000               | 4 units                    |\n\nThe farm has a total of 100 hectares available for cultivation. The farm also has a total of 300 units of water available for irrigation. The farm aims to maximize its total profit while considering the water usage efficiency (profit per unit of water). Please help the farm determine the optimal allocation of land to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=0) # land allocated to crop A\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=0) # land allocated to crop B\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * LA\nProfit_B = 1500 * LB\nProfit_C = 2000 * LC\nWater_Total = 2 * LA + 3 * LB + 4 * LC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(LA + LB + LC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * LA + 3 * LB + 4 * LC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(LA))\n    print(\"Land allocated to Crop B: \", model.getVal(LB))\n    print(\"Land allocated to Crop C: \", model.getVal(LC))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer wants to maximize the total production rate while considering the cost of labor. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The objective is to maximize the net production value (total production rate minus labor cost).\n// Total production rate: Production = 10 * A + 15 * B + 20 * C\n// Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n// So, the objective function is: Maximize (Production - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a total budget of $1000 per hour for labor.\n// 20 * A + 25 * B + 30 * C <= 1000\n\n## Generate Constraint-2:\nThe maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C.\n// A <= 20; B <= 15; C <= 10\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\n// 10 * A >= 100\n// 15 * B >= 150\n// 20 * C >= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. Each worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The manufacturer wants to maximize the net production value (total production rate minus labor cost) while adhering to the following constraints:\n1. The manufacturer has a total budget of $1000 per hour for labor.\n2. The maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C.\n3. The manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\nPlease help the manufacturer determine the optimal number of workers to assign to each product line to achieve the maximum net production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=20) # number of workers on product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=15) # number of workers on product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=10) # number of workers on product C\n\n# Define objective function\n## Total production rate: Production = 10 * A + 15 * B + 20 * C\n## Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n## So, the objective function is: Maximize (Production - Cost)\nProduction = 10 * A + 15 * B + 20 * C\nCost = 20 * A + 25 * B + 30 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Production - Cost)\n\n# Add constraints\n## The manufacturer has a total budget of $1000 per hour for labor.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 1000)\n## The manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\nmodel.addCons(10 * A >= 100)\nmodel.addCons(15 * B >= 150)\nmodel.addCons(20 * C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A: \", model.getVal(A))\n    print(\"Number of Workers on Product B: \", model.getVal(B))\n    print(\"Number of Workers on Product C: \", model.getVal(C))\n    print(\"Maximized Net Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations.\n// {\"production rate of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours.\n// Cost of A: Cost_A = 2 * PA\n// Cost of B: Cost_B = 3 * PB\n// Cost of C: Cost_C = 4 * PC\n// Revenue of A: Revenue_A = 5 * PA\n// Revenue of B: Revenue_B = 7 * PB\n// Revenue of C: Revenue_C = 9 * PC\n// Total Profit: Profit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n// Total Production Time: Time = PA + 2 * PB + 3 * PC\n// So, the objective function is: Maximize Profit / Time\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 2 * PA + 3 * PB + 4 * PC <= 1000\n\n## Generate Constraint-2:\nThe plant can only allocate a maximum of 500 hours for production.\n// PA + 2 * PB + 3 * PC <= 500\n\n## Generate Constraint-3:\nThe plant must produce at least 100 units of each product.\n// PA >= 100; PB >= 100; PC >= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations. The cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The plant has a budget of $1000 for production costs and can only allocate a maximum of 500 hours for production. Additionally, the plant must produce at least 100 units of each product. Please help the plant to maximize its profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=100) # production rate of product A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=100) # production rate of product B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=100) # production rate of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 2 * PA\nCost_B = 3 * PB\nCost_C = 4 * PC\nRevenue_A = 5 * PA\nRevenue_B = 7 * PB\nRevenue_C = 9 * PC\nProfit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nProductionTime = PA + 2 * PB + 3 * PC\n## the objective function is: Maximize Profit / Time\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 1000)\n## The plant can only allocate a maximum of 500 hours for production.\nmodel.addCons(PA + 2 * PB + 3 * PC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product A: \", model.getVal(PA))\n    print(\"Production Rate of Product B: \", model.getVal(PB))\n    print(\"Production Rate of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C.\n// A >= 50; B >= 75\n\n## Generate Constraint-4:\nThe company has a labor constraint where the total hours required for production must not exceed 800 hours. Product A requires 2 hours per unit, product B requires 3 hours per unit, and product C requires 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 800",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The total production cost for all products must not exceed $1000, with the cost per unit of product A being $3, product B being $5, and product C being $7. The company has a storage capacity limit of 500 units for all products combined. The market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C. The company has a labor constraint where the total hours required for production must not exceed 800 hours, with product A requiring 2 hours per unit, product B requiring 3 hours per unit, and product C requiring 4 hours per unit. Please help the company to maximize the total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\nmodel.addCons(2 * A + 3 * B + 4 * C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20 - 10) * A = 20 * A\n// Profit of product B: Profit_B = (70 - 30 - 15) * B = 25 * B\n// Profit of product C: Profit_C = (100 - 40 - 20) * C = 40 * C\n// So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a labor capacity constraint of 500 hours for the next quarter. The labor time required for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\nThe company has a budget of $10,000 for raw materials for the next quarter. The company also has a labor capacity constraint of 500 hours for the next quarter, with the labor time required for product A being 2 hours, for product B being 3 hours, and for product C being 4 hours.\nPlease help the company to maximize the total profit from the production of products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 25 * B\nProfit_C = 40 * C\n## the objective function is: Maximize (20 * A + 25 * B + 40 * C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a labor capacity constraint of 500 hours for the next quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of Solar Panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wind Turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"quantity of Electric Vehicles\": \"ElectricVehicles\", \"range\": \"ElectricVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these products.\n// Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\n// Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\n// Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\n// So, the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n// 5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000\n\n## Generate Constraint-2:\nThe market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles.\n// SolarPanels <= 300; WindTurbines <= 200; ElectricVehicles <= 150\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 500 units in total for all products.\n// SolarPanels + WindTurbines + ElectricVehicles <= 500",
        "question": "A manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints. The profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component. The market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles. The company also has a production capacity limit of 500 units in total for all products. Please help the company to maximize the total profit from the sales of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=300)  # quantity of Solar Panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=200)  # quantity of Wind Turbines\nElectricVehicles = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles\", lb=0, ub=150)  # quantity of Electric Vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0, ub=100)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=100, ub=300)\nSolarPanels_b1 = model.addVar(vtype=\"B\", name=\"SolarPanels_b1\")\nSolarPanels_b2 = model.addVar(vtype=\"B\", name=\"SolarPanels_b2\")\nmodel.addCons(SolarPanels_b1 + SolarPanels_b2 == 1)\nmodel.addCons(SolarPanels == SolarPanels1*SolarPanels_b1 + SolarPanels2*SolarPanels_b2)\nProfit_SolarPanels = (1000 - 0.1 * (SolarPanels2 - 100)) * SolarPanels2 * SolarPanels_b2\n\n## create piecewise variables for piecewise function: Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0, ub=50)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=50, ub=200)\nWindTurbines_b1 = model.addVar(vtype=\"B\", name=\"WindTurbines_b1\")\nWindTurbines_b2 = model.addVar(vtype=\"B\", name=\"WindTurbines_b2\")\nmodel.addCons(WindTurbines_b1 + WindTurbines_b2 == 1)\nmodel.addCons(WindTurbines == WindTurbines1*WindTurbines_b1 + WindTurbines2*WindTurbines_b2)\nProfit_WindTurbines = (1500 - 0.2 * (WindTurbines2 - 50)) * WindTurbines2 * WindTurbines_b2\n\n## create piecewise variables for piecewise function: Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\nElectricVehicles1 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles1\", lb=0, ub=20)\nElectricVehicles2 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles2\", lb=20, ub=150)\nElectricVehicles_b1 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b1\")\nElectricVehicles_b2 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b2\")\nmodel.addCons(ElectricVehicles_b1 + ElectricVehicles_b2 == 1)\nmodel.addCons(ElectricVehicles == ElectricVehicles1*ElectricVehicles_b1 + ElectricVehicles2*ElectricVehicles_b2)\nProfit_ElectricVehicles = (2000 - 0.3 * (ElectricVehicles2 - 20)) * ElectricVehicles2 * ElectricVehicles_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\nmodel.addCons(obj == Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles)\n\n# Add constraints\nmodel.addCons(5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000)\nmodel.addCons(SolarPanels + WindTurbines + ElectricVehicles <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Quantity of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Quantity of Electric Vehicles: \", model.getVal(ElectricVehicles))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a limited budget for production costs, which is $10,000.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company has a total production capacity of 200 units and a limited budget for production costs, which is $10,000.\nPlease help the company to maximize the total net profit, considering both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total delivery time, which is influenced by the number of trucks and the complexity of routes. The delivery time per truck for each warehouse is as follows:\n- Warehouse A: 50 + 10 * TrucksA^2 minutes per truck\n- Warehouse B: 60 + 8 * TrucksB^2 minutes per truck\n- Warehouse C: 70 + 12 * TrucksC^2 minutes per truck\nThe company wants to minimize the total delivery time across all warehouses.\n// Total delivery time for Warehouse A: TimeA = (50 + 10 * TrucksA^2) * TrucksA\n// Total delivery time for Warehouse B: TimeB = (60 + 8 * TrucksB^2) * TrucksB\n// Total delivery time for Warehouse C: TimeC = (70 + 12 * TrucksC^2) * TrucksC\n// So, the objective function is: Minimize (TimeA + TimeB + TimeC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no warehouse can have more than 25 trucks.\n// TrucksA <= 25; TrucksB <= 25; TrucksC <= 25",
        "question": "A logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency. The delivery time per truck for each warehouse is as follows:\n- Warehouse A: 50 + 10 * TrucksA^2 minutes per truck\n- Warehouse B: 60 + 8 * TrucksB^2 minutes per truck\n- Warehouse C: 70 + 12 * TrucksC^2 minutes per truck\nThe company aims to minimize the total delivery time across all warehouses. The company has a total of 50 trucks available for allocation, and due to maintenance constraints, no warehouse can have more than 25 trucks. Please help the company to minimize the total delivery time across all warehouses.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0, ub=25)  # number of trucks for Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0, ub=25)  # number of trucks for Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0, ub=25)  # number of trucks for Warehouse C\n\n# Define objective function\nTimeA = (50 + 10 * TrucksA**2) * TrucksA\nTimeB = (60 + 8 * TrucksB**2) * TrucksB\nTimeC = (70 + 12 * TrucksC**2) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TimeA + TimeB + TimeC)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 717,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\n// {\"hours reactor 1 operates\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 2 operates\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 3 operates\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\n// Total production of chemical A: P_A = 10 * R1 + 7 * R2 + 9 * R3\n// Total production of chemical B: P_B = 5 * R1 + 12 * R2 + 8 * R3\n// Total production of chemical C: P_C = 8 * R1 + 6 * R2 + 10 * R3\n// The objective function is: Maximize (P_A + P_B + P_C) / (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total operational hours for all reactors must not exceed 100 hours.\n// R1 + R2 + R3 <= 100",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. Each hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours. The total operational hours for all reactors must not exceed 100 hours. Please help the manager decide how many hours each reactor should operate to optimize production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # hours reactor 1 operates\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # hours reactor 2 operates\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # hours reactor 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 10 * R1 + 7 * R2 + 9 * R3\nP_B = 5 * R1 + 12 * R2 + 8 * R3\nP_C = 8 * R1 + 6 * R2 + 10 * R3\nTotalProduction = P_A + P_B + P_C\nOperationalHours = R1 + R2 + R3\n## the objective function is: Maximize (P_A + P_B + P_C) / OperationalHours\n## convert the division to multiplication\nmodel.addCons(obj * OperationalHours == TotalProduction)\n\n# Add constraints\n## The total operational hours for all reactors must not exceed 100 hours.\nmodel.addCons(R1 + R2 + R3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Reactor 1 Operates: \", model.getVal(R1))\n    print(\"Hours Reactor 2 Operates: \", model.getVal(R2))\n    print(\"Hours Reactor 3 Operates: \", model.getVal(R3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles.\n// Fuel_Cost_Truck = 100 * sqrt(Truck)\n// Fuel_Cost_Van = 70 * sqrt(Van)\n// Fuel_Cost_Bike = 20 * sqrt(Bike)\n// So, the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle.\n// 500 * Truck + 300 * Van + 100 * Bike <= 10000",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles. The company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle. Please help the company determine the optimal number of each type of vehicle to minimize the total fuel cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## convert the square root to a variable\nsqrt_Truck = model.addVar(name=\"sqrt_Truck\")\nsqrt_Van = model.addVar(name=\"sqrt_Van\")\nsqrt_Bike = model.addVar(name=\"sqrt_Bike\")\nmodel.addCons(sqrt_Truck * sqrt_Truck == Truck)\nmodel.addCons(sqrt_Van * sqrt_Van == Van)\nmodel.addCons(sqrt_Bike * sqrt_Bike == Bike)\nFuel_Cost_Truck = 100 * sqrt_Truck\nFuel_Cost_Van = 70 * sqrt_Van\nFuel_Cost_Bike = 20 * sqrt_Bike\n## the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\nmodel.addCons(obj == Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(500 * Truck + 300 * Van + 100 * Bike <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the marketing budget to promote the product, and the level of automation to be implemented in the production process.\n// {\"production quantity\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"AutomationLevel\", \"range\": \"AutomationLevel >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production decreases by $2 for every unit increase in the level of automation. The initial production cost per unit is $50. The revenue generated per unit is $70. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (70 - 50 + 2 * AutomationLevel) * Quantity - MarketingBudget\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the marketing of the product.\n// MarketingBudget <= 100000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationLevel <= 50000\n\n## Generate Constraint-3:\nThe production quantity must be at least 500 units to meet the minimum order requirements.\n// Quantity >= 500\n\n## Generate Constraint-4:\nThe marketing budget should not be less than 10% of the total expected revenue from the product.\n// MarketingBudget >= 0.1 * (70 - 50 + 2 * AutomationLevel) * Quantity",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the marketing budget to promote the product, and the level of automation to be implemented in the production process. The cost of production decreases by $2 for every unit increase in the level of automation. The initial production cost per unit is $50, and the revenue generated per unit is $70. The company aims to maximize the total profit from the product. The company has a budget of $100,000 for the marketing of the product. The total investment in automation cannot exceed $50,000. The production quantity must be at least 500 units to meet the minimum order requirements. The marketing budget should not be less than 10% of the total expected revenue from the product. Please help the company determine the optimal values for production quantity, marketing budget, and automation level to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=500)  # production quantity\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\nAutomationLevel = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationLevel\", lb=0)  # level of automation\n\n# Define objective function\nProfit = (70 - 50 + 2 * AutomationLevel) * Quantity - MarketingBudget\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(MarketingBudget <= 100000)\nmodel.addCons(AutomationLevel <= 50000)\nmodel.addCons(Quantity >= 500)\nmodel.addCons(MarketingBudget >= 0.1 * (70 - 50 + 2 * AutomationLevel) * Quantity)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Automation Level: \", model.getVal(AutomationLevel))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"size of the geothermal system in units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company wants to minimize the total cost of installation while maximizing the total daily energy generation.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\n// Total daily energy generation: Energy = 100 * Solar + 200 * Wind + 300 * Geothermal\n// The objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000\n\n## Generate Constraint-2:\nThe company requires at least 5000 kWh of energy per day.\n// 100 * Solar + 200 * Wind + 300 * Geothermal >= 5000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 30% of the budget is spent on solar panels.\n// 1000 * Solar >= 0.30 * 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system. The cost and daily energy generation for each type of installation are given in the following Table.\n\n| Installation Type | Cost per Unit | Daily Energy Generation per Unit |\n|-------------------|---------------|----------------------------------|\n| Solar Panels      | $1000         | 100 kWh                          |\n| Wind Turbines     | $2000         | 200 kWh                          |\n| Geothermal System | $5000         | 300 kWh                          |\n\nThe company has a budget of $100,000 for the installation. The company requires at least 5000 kWh of energy per day. The company wants to ensure that at least 30% of the budget is spent on solar panels.\nPlease help the company to minimize the total cost of installation while maximizing the total daily energy generation, expressed as the ratio of total cost to total daily energy generation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # size of the geothermal system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\nEnergy = 100 * Solar + 200 * Wind + 300 * Geothermal\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000)\n## The company requires at least 5000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind + 300 * Geothermal >= 5000)\n## The company wants to ensure that at least 30% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar >= 0.30 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Size of Geothermal System: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\n// Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all devices combined.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500\n\n## Generate Constraint-2:\nDue to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBUnits <= 2 * DeviceAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs, and the cost per unit for each device is $20.\n// 20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// DeviceAUnits >= 50; DeviceBUnits >= 30",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\nThe company has a total production capacity of 500 units for all devices combined. Due to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget of $30,000 for production costs, and the cost per unit for each device is $20. To ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\nPlease help the company determine the optimal number of units to produce for each device to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=50)  # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=30)  # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0)    # number of units of DeviceC\n\n# Define objective function\n# Profit per unit for DeviceA decreases by $0.5 for each unit produced beyond the first 100 units\nDeviceA_100 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_100\", lb=0, ub=100)\nDeviceA_over100 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_over100\", lb=0)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA_100*DeviceA_b1 + DeviceA_over100*DeviceA_b2)\nProfit_DeviceA = (50 - 0.5 * DeviceA_over100) * DeviceAUnits\n\n# Profit per unit for DeviceB decreases by $0.3 for each unit produced beyond the first 150 units\nDeviceB_150 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_150\", lb=0, ub=150)\nDeviceB_over150 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_over150\", lb=0)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB_150*DeviceB_b1 + DeviceB_over150*DeviceB_b2)\nProfit_DeviceB = (70 - 0.3 * DeviceB_over150) * DeviceBUnits\n\n# Profit per unit for DeviceC decreases by $0.2 for each unit produced beyond the first 200 units\nDeviceC_200 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_200\", lb=0, ub=200)\nDeviceC_over200 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_over200\", lb=0)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC_200*DeviceC_b1 + DeviceC_over200*DeviceC_b2)\nProfit_DeviceC = (90 - 0.2 * DeviceC_over200) * DeviceCUnits\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500)\nmodel.addCons(DeviceBUnits <= 2 * DeviceAUnits)\nmodel.addCons(20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z).\n// {\"amount of Material X used\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y used\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n// {\"amount of Material Z used\": \"Z\", \"range\": \"Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n// Total cost of raw materials: Cost = 5 * X + 10 * Y + 15 * Z\n// Total production output: Output = 2 * X + 3 * Y + 4 * Z (assuming each unit of raw material contributes to the output as specified)\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 5 * X + 10 * Y + 15 * Z <= 10000\n\n## Generate Constraint-2:\nThe company must use at least 500 units of Material X.\n// X >= 500\n\n## Generate Constraint-3:\nThe total amount of Material Y and Material Z used must not exceed 700 units.\n// Y + Z <= 700\n\n## Generate Constraint-4:\nThe company aims to produce at least 2000 units of output.\n// 2 * X + 3 * Y + 4 * Z >= 2000",
        "question": "A manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z). The cost of each material and their contribution to the production output are given in the following Table.\n\n| Material | Cost per Unit | Contribution to Output |\n|----------|---------------|------------------------|\n| X        | $5            | 2 units                |\n| Y        | $10           | 3 units                |\n| Z        | $15           | 4 units                |\n\nThe company has a budget of $10,000 for raw materials. The company must use at least 500 units of Material X. The total amount of Material Y and Material Z used must not exceed 700 units. The company aims to produce at least 2000 units of output.\n\nPlease help the company to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=500) # amount of Material X used\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y used\nZ = model.addVar(vtype=\"CONTINUOUS\", name=\"Z\", lb=0) # amount of Material Z used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 5 * X + 10 * Y + 15 * Z\nOutput = 2 * X + 3 * Y + 4 * Z\n## The objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(5 * X + 10 * Y + 15 * Z <= 10000)\n## The total amount of Material Y and Material Z used must not exceed 700 units.\nmodel.addCons(Y + Z <= 700)\n## The company aims to produce at least 2000 units of output.\nmodel.addCons(2 * X + 3 * Y + 4 * Z >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Material X used: \", model.getVal(X))\n    print(\"Amount of Material Y used: \", model.getVal(Y))\n    print(\"Amount of Material Z used: \", model.getVal(Z))\n    print(\"Minimized Cost per Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity for Product A\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product B\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product C\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $90. The company wants to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * QuantityA\n// Total profit for Product B: ProfitB = 70 * QuantityB\n// Total profit for Product C: ProfitC = 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units.\n// 2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\n// QuantityC <= 0.5 * (QuantityA + QuantityB)\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of each product are produced to maintain market presence.\n// QuantityA >= 10; QuantityB >= 10; QuantityC >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand.\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $90. The company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units. Due to market demand, the production of Product A must be at least twice the production of Product B. The company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B. The company wants to ensure that at least 10 units of each product are produced to maintain market presence.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=10) # production quantity for Product A\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=10) # production quantity for Product B\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=10) # production quantity for Product C\n\n# Define objective function\nProfitA = 50 * QuantityA\nProfitB = 70 * QuantityB\nProfitC = 90 * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a limited amount of raw material.\nmodel.addCons(2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000)\n# Due to market demand, the production of Product A must be at least twice the production of Product B.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\nmodel.addCons(QuantityC <= 0.5 * (QuantityA + QuantityB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(QuantityA))\n    print(\"Production Quantity for Product B: \", model.getVal(QuantityB))\n    print(\"Production Quantity for Product C: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains.\n// {\"number of solar panels on flat rooftops\": \"FlatPanels\", \"range\": \"FlatPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped rooftops\": \"SlopedPanels\", \"range\": \"SlopedPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on open fields\": \"FieldPanels\", \"range\": \"FieldPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by terrain type. On flat rooftops, each panel produces 150 kWh per day. On sloped rooftops, each panel produces 180 kWh per day due to better sunlight exposure. On open fields, each panel produces 160 kWh per day but requires additional maintenance costs, which are $5 per panel per day. The company aims to maximize the total daily energy production minus the maintenance costs.\n// Total daily energy production: Energy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\n// Total daily maintenance cost: Maintenance = 5 * FieldPanels\n// So, the objective function is: Maximize (Energy - Maintenance)\n\n## Generate Constraint-1:\nThe company has a budget to install a maximum of 1000 solar panels in total.\n// FlatPanels + SlopedPanels + FieldPanels <= 1000",
        "question": "A renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains. The efficiency of solar panels varies by terrain type as shown in the following Table.\n\n| Terrain Type       | Energy Production per Panel (kWh/day) | Additional Maintenance Cost per Panel (per day) |\n|--------------------|---------------------------------------|-------------------------------------------------|\n| Flat rooftops      | 150                                   | 0                                              |\n| Sloped rooftops    | 180                                   | 0                                              |\n| Open fields        | 160                                   | $5                                             |\n\nThe company has a budget to install a maximum of 1000 solar panels in total. The company aims to maximize the total daily energy production minus the maintenance costs. Please help the company determine the optimal number of solar panels to install on each type of terrain.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlatPanels = model.addVar(vtype=\"INTEGER\", name=\"FlatPanels\", lb=0) # number of solar panels on flat rooftops\nSlopedPanels = model.addVar(vtype=\"INTEGER\", name=\"SlopedPanels\", lb=0) # number of solar panels on sloped rooftops\nFieldPanels = model.addVar(vtype=\"INTEGER\", name=\"FieldPanels\", lb=0) # number of solar panels on open fields\n\n# Define objective function\nEnergy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\nMaintenance = 5 * FieldPanels\n# So, the objective function is: Maximize (Energy - Maintenance)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Maintenance)\n\n# Add constraints\n# The company has a budget to install a maximum of 1000 solar panels in total.\nmodel.addCons(FlatPanels + SlopedPanels + FieldPanels <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Rooftops: \", model.getVal(FlatPanels))\n    print(\"Number of Solar Panels on Sloped Rooftops: \", model.getVal(SlopedPanels))\n    print(\"Number of Solar Panels on Open Fields: \", model.getVal(FieldPanels))\n    print(\"Maximized Daily Energy Production (minus maintenance costs): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for purchasing fertilizer.\n// 30 * A + 40 * B + 50 * C <= 5000\n\n## Generate Constraint-3:\nThe farmer has a storage capacity of 200 tons in total.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe market demand for Crop A is 50 tons. So, the farmer can only sell a maximum of 50 tons of Crop A.\n// A <= 50\n\n## Generate Constraint-5:\nDue to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\n// A + B + C <= 150",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The revenue and cost of fertilizer per ton of each crop are given in the following Table.\n\n| Crop | Revenue per Ton | Cost of Fertilizer per Ton |\n|------|-----------------|----------------------------|\n| A    | $100            | $30                        |\n| B    | $150            | $40                        |\n| C    | $200            | $50                        |\n\nThe farmer wants to maximize his net profit (revenue minus cost). The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. The farmer has a budget of $5000 for purchasing fertilizer. The farmer has a storage capacity of 200 tons in total. The market demand for Crop A is 50 tons. Due to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\n\nPlease help the farmer to maximize his net profit by determining the optimal quantity of each crop to plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50)  # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)  # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)  # quantity of Crop C\n\n# Define objective function\nProfit_A = 100 * A - 30 * A\nProfit_B = 150 * B - 40 * B\nProfit_C = 200 * C - 50 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total area available for planting is 100 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n# The farmer has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n# The farmer has a storage capacity of 200 tons in total.\nmodel.addCons(A + B + C <= 200)\n# The market demand for Crop A is 50 tons.\nmodel.addCons(A <= 50)\n# Due to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\nmodel.addCons(A + B + C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1122,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 units of raw material and 1 unit of labor.\nThe profit per unit of product B is $70, but it requires 3 units of raw material and 2 units of labor.\nThe profit per unit of product C is $100, but it requires 4 units of raw material and 3 units of labor.\nThe company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency.\n// Total profit: Profit = 50A + 70B + 100C\n// Resource usage: Raw material = 2A + 3B + 4C; Labor = A + 2B + 3C\n// The objective function is: Maximize Profit - k1 * (Raw material)^2 - k2 * (Labor)^2, where k1 and k2 are constants representing the cost of resource inefficiency.\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material available.\n// 2A + 3B + 4C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage. The profit per unit of product A is $50 and it requires 2 units of raw material and 1 unit of labor. The profit per unit of product B is $70 and it requires 3 units of raw material and 2 units of labor. The profit per unit of product C is $100 and it requires 4 units of raw material and 3 units of labor. The company has a total of 1000 units of raw material available. The company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency. Please help the company to maximize its total profit, taking into account the nonlinear costs of resource inefficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 4 * C\nLabor = A + 2 * B + 3 * C\n## The objective function is: Maximize Profit - k1 * (RawMaterial)^2 - k2 * (Labor)^2\n## Convert the quadratic terms to linear by introducing new variables and constraints\nRawMaterial_sq = model.addVar('RawMaterial_sq')\nLabor_sq = model.addVar('Labor_sq')\nmodel.addCons(RawMaterial_sq == RawMaterial**2)\nmodel.addCons(Labor_sq == Labor**2)\nk1 = 0.01  # Example constant for raw material inefficiency cost\nk2 = 0.01  # Example constant for labor inefficiency cost\nmodel.addCons(obj == Profit - k1 * RawMaterial_sq - k2 * Labor_sq)\n\n# Add constraints\n## The company has a total of 1000 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach product line has a maximum capacity of 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nTo ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5.\n// W1 / W2 <= 1.5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the total workers are allocated to product line 3.\n// W3 >= 0.2 * (W1 + W2 + W3)",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. Each worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products. The company has a total of 50 workers available. Each product line has a maximum capacity of 20 workers. To ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5. The company wants to ensure that at least 20% of the total workers are allocated to product line 3. Please help the company determine the optimal number of workers to allocate to each product line (W1, W2, and W3) to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Constraint for the ratio of workers on product line 1 to product line 2\nmodel.addCons(W1 <= 1.5 * W2)\n\n# Constraint to ensure at least 20% of the total workers are allocated to product line 3\nmodel.addCons(W3 >= 0.2 * (W1 + W2 + W3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost is $0.1 per unit per day. For Device B, the selling price is $150, the production cost is $90, and the storage cost is $0.15 per unit per day. For Device C, the selling price is $200, the production cost is $120, and the storage cost is $0.2 per unit per day. The storage costs are accumulated daily and affect the net profit. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs over a period of 30 days.\n// Revenue_A = 100 * A\n// Revenue_B = 150 * B\n// Revenue_C = 200 * C\n// Production_Cost_A = 60 * A\n// Production_Cost_B = 90 * B\n// Production_Cost_C = 120 * C\n// Storage_Cost_A = 0.1 * A * 30\n// Storage_Cost_B = 0.15 * B * 30\n// Storage_Cost_C = 0.2 * C * 30\n// So, the objective function is: Maximize (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 200 units.\n// A + B + C <= 200",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin.\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost is $0.1 per unit per day. For Device B, the selling price is $150, the production cost is $90, and the storage cost is $0.15 per unit per day. For Device C, the selling price is $200, the production cost is $120, and the storage cost is $0.2 per unit per day. The storage costs are accumulated daily and affect the net profit. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs over a period of 30 days.\nThe company has a budget of $10,000 for production costs. The company also has a storage capacity limit of 200 units.\nPlease help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\nRevenue_A = 100 * A\nRevenue_B = 150 * B\nRevenue_C = 200 * C\nProduction_Cost_A = 60 * A\nProduction_Cost_B = 90 * B\nProduction_Cost_C = 120 * C\nStorage_Cost_A = 0.1 * A * 30\nStorage_Cost_B = 0.15 * B * 30\nStorage_Cost_C = 0.2 * C * 30\n\n# Calculate net profit for each device\nNet_Profit_A = Revenue_A - Production_Cost_A - Storage_Cost_A\nNet_Profit_B = Revenue_B - Production_Cost_B - Storage_Cost_B\nNet_Profit_C = Revenue_C - Production_Cost_C - Storage_Cost_C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_A + Net_Profit_B + Net_Profit_C)\n\n# Add constraints\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000) # Budget constraint\nmodel.addCons(A + B + C <= 200) # Storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $100, for device B is $150, and for device C is $200. The production cost of each device is proportional to its profit, but with a diminishing return effect. Specifically, the production cost of each device is modeled as the square root of its profit multiplied by the quantity produced. The company aims to maximize the net profit, which is the total profit minus the total production cost.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Cost_A = sqrt(100 * A)\n// Cost_B = sqrt(150 * B)\n// Cost_C = sqrt(200 * C)\n// So, the objective function is: Maximize (Profit_A - Cost_A) + (Profit_B - Cost_B) + (Profit_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// sqrt(100 * A) + sqrt(150 * B) + sqrt(200 * C) <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 100 units in total.\n// A + B + C <= 100",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit for each device is as follows:\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| A      | $100            |\n| B      | $150            |\n| C      | $200            |\n\nThe production cost of each device is modeled as the square root of its profit multiplied by the quantity produced. The company aims to maximize the net profit, which is the total profit minus the total production cost. The company has a budget of $10,000 for production costs and a limited production capacity of 100 units in total. Please help the company determine the optimal production quantities for devices A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\n## approximate the square root function using a piecewise linear function\nepsilon = 1e-6\nsqrt_A = model.addVar(name=\"sqrt_A\")\nsqrt_B = model.addVar(name=\"sqrt_B\")\nsqrt_C = model.addVar(name=\"sqrt_C\")\nmodel.addCons(sqrt_A >= epsilon)\nmodel.addCons(sqrt_B >= epsilon)\nmodel.addCons(sqrt_C >= epsilon)\nmodel.addCons(sqrt_A * sqrt_A <= 100 * A + epsilon)\nmodel.addCons(sqrt_B * sqrt_B <= 150 * B + epsilon)\nmodel.addCons(sqrt_C * sqrt_C <= 200 * C + epsilon)\nCost_A = sqrt_A\nCost_B = sqrt_B\nCost_C = sqrt_C\n## the objective function is: Maximize (Profit_A - Cost_A) + (Profit_B - Cost_B) + (Profit_C - Cost_C)\nmodel.addCons(obj == Profit_A - Cost_A + Profit_B - Cost_B + Profit_C - Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(sqrt_A + sqrt_B + sqrt_C <= 10000)\n## The company has a limited production capacity of 100 units in total.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\n// {\"number of pastries A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of pastries B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of pastries C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n// Profit from A: Profit_A = (2 - 0.5) * A\n// Profit from B: Profit_B = (3 - 1) * B\n// Profit from C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (15 * A + 20 * B + 25 * C)\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients.\n// 0.5 * A + 1 * B + 1.5 * C <= 100",
        "question": "A bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit. Each pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. Each pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. Each pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake. The bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time. The bakery has a daily budget of $100 for ingredients. Please help the bakery to determine the optimal number of each pastry to bake daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of pastries A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of pastries B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of pastries C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nBakingTime = 15 * A + 20 * B + 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(A))\n    print(\"Number of Pastry B: \", model.getVal(B))\n    print(\"Number of Pastry C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 637,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200\n\n## Generate Constraint-2:\nThe total raw material available per day is 250 units.\n// 3A + 2B + C <= 250\n\n## Generate Constraint-3:\nThe market demand for product A is at least 5 units.\n// A >= 5\n\n## Generate Constraint-4:\nThe market demand for product B is at least 10 units.\n// B >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand. The profit per unit of product A is $50, requiring 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The total labor hours available per day are 200 hours. The total raw material available per day is 250 units. The market demand for product A is at least 5 units. The market demand for product B is at least 10 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50 * A + 70 * B + 60 * C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 200)\n## The total raw material available per day is 250 units.\nmodel.addCons(3 * A + 2 * B + C <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n// Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n// Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n// Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total production cost, which must not exceed $30,000 per week.\n// 20 * sqrt(UnitsA) * UnitsA + 30 * sqrt(UnitsB) * UnitsB + 40 * sqrt(UnitsC) * UnitsC <= 30,000\n\n## Generate Constraint-4:\nTo ensure a minimum market presence, the company must produce at least 50 units of each component.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\nThe company has a total production capacity of 1000 units per week. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint on the total production cost, which must not exceed $30,000 per week. To ensure a minimum market presence, the company must produce at least 50 units of each component.\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50)  # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n## Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n## Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n## Convert square root to a variable to handle non-linearity\nsqrt_UnitsA = model.addVar(name=\"sqrt_UnitsA\")\nsqrt_UnitsB = model.addVar(name=\"sqrt_UnitsB\")\nsqrt_UnitsC = model.addVar(name=\"sqrt_UnitsC\")\nmodel.addCons(sqrt_UnitsA * sqrt_UnitsA == UnitsA)\nmodel.addCons(sqrt_UnitsB * sqrt_UnitsB == UnitsB)\nmodel.addCons(sqrt_UnitsC * sqrt_UnitsC == UnitsC)\n\nProfitA = (50 - 20 * sqrt_UnitsA) * UnitsA\nProfitB = (70 - 30 * sqrt_UnitsB) * UnitsB\nProfitC = (90 - 40 * sqrt_UnitsC) * UnitsC\n\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget constraint on the total production cost, which must not exceed $30,000 per week.\nmodel.addCons(20 * sqrt_UnitsA * UnitsA + 30 * sqrt_UnitsB * UnitsB + 40 * sqrt_UnitsC * UnitsC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units of each product to produce daily to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A sells for $20 with a production cost of $10 and requires 1.5 hours of labor. \nEach unit of product B sells for $30 with a production cost of $20 and requires 2 hours of labor. \nEach unit of product C sells for $40 with a production cost of $30 and requires 2.5 hours of labor.\nThe plant aims to maximize the profit rate, which is defined as the total profit divided by the total labor hours.\n// Profit from A: Profit_A = (20 - 10) * A\n// Profit from B: Profit_B = (30 - 20) * B\n// Profit from C: Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1.5 * A + 2 * B + 2.5 * C)\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1500 for production costs.\n// 10 * A + 20 * B + 30 * C <= 1500\n\n## Generate Constraint-2:\nThe plant has a daily labor capacity of 100 hours.\n// 1.5 * A + 2 * B + 2.5 * C <= 100\n\n## Generate Constraint-3:\nThe plant must produce at least 20 units of product A and 15 units of product B daily.\n// A >= 20; B >= 15",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units of each product to produce daily to maximize profit while considering production constraints.\nEach unit of product A sells for $20 with a production cost of $10 and requires 1.5 hours of labor. \nEach unit of product B sells for $30 with a production cost of $20 and requires 2 hours of labor. \nEach unit of product C sells for $40 with a production cost of $30 and requires 2.5 hours of labor.\nThe plant has a daily budget of $1500 for production costs. The plant has a daily labor capacity of 100 hours. The plant must produce at least 20 units of product A and 15 units of product B daily.\nPlease help the plant to maximize the profit rate, which is defined as the total profit divided by the total labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 20) * B\nProfit_C = (40 - 30) * C\nLaborHours = 1.5 * A + 2 * B + 2.5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily budget of $1500 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 1500)\n## The plant has a daily labor capacity of 100 hours.\nmodel.addCons(1.5 * A + 2 * B + 2.5 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\n// Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all devices combined.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500\n\n## Generate Constraint-2:\nDue to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBUnits <= 2 * DeviceAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs, and the cost per unit for each device is $20.\n// 20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// DeviceAUnits >= 50; DeviceBUnits >= 30\n\n## Generate Constraint-5:\nThe production of DeviceC is limited to a maximum of 200 units due to technical constraints.\n// DeviceCUnits <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for each device and the decrease in profit per unit beyond certain production levels are given in the following Table.\n\n| Device | Profit per Unit | Decrease in Profit per Unit Beyond | Threshold Units |\n|--------|-----------------|-----------------------------------|-----------------|\n| DeviceA | $50             | $0.5                              | 100             |\n| DeviceB | $70             | $0.3                              | 150             |\n| DeviceC | $90             | $0.2                              | 200             |\n\nThe company has a total production capacity of 500 units for all devices combined. Due to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget of $30,000 for production costs, and the cost per unit for each device is $20. To ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB. The production of DeviceC is limited to a maximum of 200 units due to technical constraints.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=50)  # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=30)  # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0)    # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.5 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=150)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=150, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.3 * (DeviceB2 - 150)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=200)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=200, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.2 * (DeviceC2 - 200)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500)\nmodel.addCons(DeviceBUnits <= 2 * DeviceAUnits)\nmodel.addCons(20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30000)\nmodel.addCons(DeviceCUnits <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1406,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $6000 for cultivation costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 6000\n\n## Generate Constraint-3:\nThe market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\n// 5 * C1 <= 300",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. For C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. For C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. For C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70. The farmer wants to maximize the net profit per acre. The farmer has a total of 100 acres available for cultivation and a budget of $6000 for cultivation costs. The market demand for C1 is 300 tons, so the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1. Please help the farmer to maximize the net profit per acre.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farmer has a budget of $6000 for cultivation costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 6000)\n## The market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\nmodel.addCons(5 * C1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, corn is $15, and barley is $12. The farmer's goal is to maximize his total profit. However, the yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n// Profit_W = 10 * W * (1 + 0.005 * water_W)\n// Profit_C = 15 * C * (1 + 0.007 * water_C)\n// Profit_B = 12 * B * (1 + 0.006 * water_B)\n// Total_water = water_W + water_C + water_B = 500\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total water used for all crops cannot exceed 500 units.\n// water_W + water_C + water_B <= 500\n\n## Generate Constraint-2:\nThe farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit.\n// 2 * W + 3 * C + 2.5 * B <= 1000\n\n## Generate Constraint-3:\nThe market demand for wheat is limited to 100 units.\n// W <= 100\n\n## Generate Constraint-4:\nThe farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units.\n// W + C + B <= 200",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability. The profit per unit of wheat is $10, corn is $15, and barley is $12. The yield of each crop depends on the amount of water used, which is limited to 500 units. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit. The market demand for wheat is limited to 100 units. The farmer also has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units. Please help the farmer to maximize his total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0)  # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0)  # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0)  # amount of barley\nwater_W = model.addVar(vtype=\"CONTINUOUS\", name=\"water_W\", lb=0)  # water for wheat\nwater_C = model.addVar(vtype=\"CONTINUOUS\", name=\"water_C\", lb=0)  # water for corn\nwater_B = model.addVar(vtype=\"CONTINUOUS\", name=\"water_B\", lb=0)  # water for barley\n\n# Define objective function\nProfit_W = 10 * W * (1 + 0.005 * water_W)\nProfit_C = 15 * C * (1 + 0.007 * water_C)\nProfit_B = 12 * B * (1 + 0.006 * water_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\nmodel.addCons(water_W + water_C + water_B <= 500)  # total water constraint\nmodel.addCons(2 * W + 3 * C + 2.5 * B <= 1000)  # labor constraint\nmodel.addCons(W <= 100)  # market demand for wheat\nmodel.addCons(W + C + B <= 200)  # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit.\n// {\"land allocated to crop A\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $1500, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $2000, but it requires 4 units of water per hectare.\nThe farm aims to maximize its total profit while considering the water usage efficiency (profit per unit of water).\n// Profit from A: Profit_A = 1000 * LA\n// Profit from B: Profit_B = 1500 * LB\n// Profit from C: Profit_C = 2000 * LC\n// Total water usage: Water_Total = 2 * LA + 3 * LB + 4 * LC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// LA + LB + LC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * LA + 3 * LB + 4 * LC <= 300\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 hectares to each crop to maintain crop diversity.\n// LA >= 10; LB >= 10; LC >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit.\nFor Crop A, the profit per hectare is $1000, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $1500, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $2000, but it requires 4 units of water per hectare.\nThe farm aims to maximize its total profit while considering the water usage efficiency (profit per unit of water).\nThe farm has a total of 100 hectares available for cultivation. The farm has a total of 300 units of water available for irrigation. The farm must allocate at least 10 hectares to each crop to maintain crop diversity.\nPlease help the farm to maximize its total profit while considering the water usage efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 hectares to each crop to maintain crop diversity.\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=10) # land allocated to crop A\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=10) # land allocated to crop B\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=10) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * LA\nProfit_B = 1500 * LB\nProfit_C = 2000 * LC\nWater_Total = 2 * LA + 3 * LB + 4 * LC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(LA + LB + LC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * LA + 3 * LB + 4 * LC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(LA))\n    print(\"Land allocated to Crop B: \", model.getVal(LB))\n    print(\"Land allocated to Crop C: \", model.getVal(LC))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nThe investment in production efficiency cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nAt least 10 hours must be allocated for each product.\n// H1 >= 10; H2 >= 10; H3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product. The total available hours for production in a week is 40 hours. The investment in production efficiency cannot exceed $50,000. At least 10 hours must be allocated for each product.\nPlease help the company to minimize the maximum production time for any of the three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=10) # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=10) # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=10) # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n## Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n## Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n## So, the objective function is: Minimize max(T1, T2, T3)\nT1 = 1000 / (10 + 0.001 * Efficiency) * H1\nT2 = 1000 / (10 + 0.001 * Efficiency) * H2\nT3 = 1000 / (10 + 0.001 * Efficiency) * H3\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## The investment in production efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cakes, the selling price is $30, the cost of ingredients is $10, and the baking time is 1.5 hours. \nFor Vanilla cakes, the selling price is $25, the cost of ingredients is $8, and the baking time is 1 hour. \nFor Strawberry cakes, the selling price is $28, the cost of ingredients is $9, and the baking time is 1.2 hours.\nThe bakery has only one oven and can bake one type of cake at a time. The bakery aims to maximize the profit efficiency (profit per hour of baking time).\n// Profit_Chocolate = (30 - 10) * C\n// Profit_Vanilla = (25 - 8) * V\n// Profit_Strawberry = (28 - 9) * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 1.2 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited baking time of 80 hours.\n// 1.5 * C + 1 * V + 1.2 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredients.\n// 10 * C + 8 * V + 9 * S <= 1500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 100 cakes in total.\n// C + V + S <= 100\n\n## Generate Constraint-4:\nThe demand for Chocolate cakes is at most 40 cakes.\n// C <= 40",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event. For Chocolate cakes, the selling price is $30, the cost of ingredients is $10, and the baking time is 1.5 hours. For Vanilla cakes, the selling price is $25, the cost of ingredients is $8, and the baking time is 1 hour. For Strawberry cakes, the selling price is $28, the cost of ingredients is $9, and the baking time is 1.2 hours. The bakery has a limited baking time of 80 hours and a budget of $1500 for ingredients. The bakery also has a storage capacity of 100 cakes in total, and the demand for Chocolate cakes is at most 40 cakes. The bakery has only one oven and can bake one type of cake at a time. Please help the bakery to maximize the profit efficiency (profit per hour of baking time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=40) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (30 - 10) * C\nProfit_Vanilla = (25 - 8) * V\nProfit_Strawberry = (28 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 1.2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited baking time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 1.2 * S <= 80)\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(10 * C + 8 * V + 9 * S <= 1500)\n## The bakery has a storage capacity of 100 cakes in total.\nmodel.addCons(C + V + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(C))\n    print(\"Number of Vanilla cakes: \", model.getVal(V))\n    print(\"Number of Strawberry cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe market demand for Crop A is limited to 20 hectares.\n// A <= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 hectares to Crop B to maintain soil health.\n// B >= 10",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| A    | $1000               | 2 units                       |\n| B    | $1500               | 3 units                       |\n| C    | $2000               | 4 units                       |\n\nThe farmer has access to a total of 100 units of water. The total available land for cultivation is 50 hectares. The market demand for Crop A is limited to 20 hectares. The farmer must allocate at least 10 hectares to Crop B to maintain soil health. \nPlease help the farmer to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=10) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n## The market demand for Crop A is limited to 20 hectares.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for component A\": \"M_A\", \"range\": \"M_A >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M_B\", \"range\": \"M_B >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M_C\", \"range\": \"M_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n// Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n// The objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * M_A + 7 * M_B + 9 * M_C <= 1500",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type. Each machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs.\n\nPlease help the manufacturer to maximize the objective function, which is the total production output minus the total maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM_A = model.addVar(vtype=\"INTEGER\", name=\"M_A\", lb=0) # number of machines for component A\nM_B = model.addVar(vtype=\"INTEGER\", name=\"M_B\", lb=0) # number of machines for component B\nM_C = model.addVar(vtype=\"INTEGER\", name=\"M_C\", lb=0) # number of machines for component C\n\n# Define objective function\n## Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n## Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n## The objective function is: Maximize (Output - Cost)\nOutput = 10 * M_A + 15 * M_B + 20 * M_C\nCost = 5 * M_A + 7 * M_B + 9 * M_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * M_A + 7 * M_B + 9 * M_C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M_A))\n    print(\"Number of Machines for Component B: \", model.getVal(M_B))\n    print(\"Number of Machines for Component C: \", model.getVal(M_C))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of three different products, the investment in new machinery, and the marketing budget for each product.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Prod3\", \"range\": \"Prod3 >= 0\", \"type\": \"integer\"}\n// {\"investment in new machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for each product\": \"Marketing\", \"range\": \"Marketing >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production for each product decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for each product is $100. The revenue generated per unit is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in new machinery and marketing.\n// Machinery + Marketing <= 100000\n\n## Generate Constraint-2:\nThe total production quantity of all products must not exceed 2000 units.\n// Prod1 + Prod2 + Prod3 <= 2000\n\n## Generate Constraint-3:\nThe marketing budget must be at least 10% of the total production cost.\n// Marketing >= 0.1 * (100 * (Prod1 + Prod2 + Prod3))\n\n## Generate Constraint-4:\nThe investment in new machinery cannot exceed $50,000.\n// Machinery <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantities of three different products, the investment in new machinery, and the marketing budget for each product. The initial production cost per unit for each product is $100, and the revenue generated per unit is $150. The cost of production for each product decreases by $5 for every $10,000 invested in new machinery. The company aims to maximize the total profit from all products.\n\n| Variable                | Description                          |\n|-------------------------|--------------------------------------|\n| Prod1                   | Production quantity of Product 1     |\n| Prod2                   | Production quantity of Product 2     |\n| Prod3                   | Production quantity of Product 3     |\n| Machinery               | Investment in new machinery          |\n| Marketing               | Marketing budget for each product    |\n\nThe company has a total budget of $100,000 for investment in new machinery and marketing. The total production quantity of all products must not exceed 2000 units. The marketing budget must be at least 10% of the total production cost. The investment in new machinery cannot exceed $50,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=0)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0)  # production quantity of Product 2\nProd3 = model.addVar(vtype=\"INTEGER\", name=\"Prod3\", lb=0)  # production quantity of Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0)  # investment in new machinery\nMarketing = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing\", lb=0)  # marketing budget for each product\n\n# Define objective function\n# Total profit for the products: Profit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\nProfit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a total budget of $100,000 for investment in new machinery and marketing.\nmodel.addCons(Machinery + Marketing <= 100000)\n# The total production quantity of all products must not exceed 2000 units.\nmodel.addCons(Prod1 + Prod2 + Prod3 <= 2000)\n# The marketing budget must be at least 10% of the total production cost.\nmodel.addCons(Marketing >= 0.1 * (100 * (Prod1 + Prod2 + Prod3)))\n# The investment in new machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Prod3))\n    print(\"Investment in New Machinery: \", model.getVal(Machinery))\n    print(\"Marketing Budget: \", model.getVal(Marketing))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1333,
        "var_num": 5,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a limited budget for production costs, which is $10,000.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must not exceed twice the production of P2.\n// P1 <= 2 * P2",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. For product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. For product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. For product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20. The company has a total production capacity of 200 units and a limited budget for production costs, which is $10,000. Due to market demand, the production of P1 must not exceed twice the production of P2. The company wants to maximize the total net profit, considering both production and storage costs. Please help the company determine the optimal production quantities for P1, P2, and P3.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a limited budget for production costs, which is $10,000.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must not exceed twice the production of P2.\nmodel.addCons(P1 <= 2 * P2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements from distributors.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for product A is limited to 300 units due to equipment limitations.\n// A <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product C as product A.\n// C >= 2 * A\n\n## Generate Constraint-5:\nThe company cannot produce more than 50% of the total units in product B.\n// B <= 0.5 * (A + B + C)",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. The unit profit and storage costs for each product are given in the following Table.\n\n| Product | Unit Profit | Storage Cost |\n|---------|-------------|--------------|\n| A       | $50         | $10          |\n| B       | $70         | $5           |\n| C       | $60         | $0           |\n\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively. The company must produce at least 200 units in total to meet the minimum order requirements from distributors. The production capacity for product A is limited to 300 units due to equipment limitations. The company aims to produce at least twice as many units of product C as product A. The company cannot produce more than 50% of the total units in product B.\n\nPlease help the company to maximize its net profit, which is the total profit minus the total storage cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Cost = 10 * A + 5 * B\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements from distributors.\nmodel.addCons(A + B + C >= 200)\n## The production capacity for product A is limited to 300 units due to equipment limitations.\nmodel.addCons(A <= 300)\n## The company aims to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2 * A)\n## The company cannot produce more than 50% of the total units in product B.\nmodel.addCons(B <= 0.5 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A has a profit of $30, requires 2 hours of labor, and uses 1 unit of raw material. \nEach device B has a profit of $40, requires 3 hours of labor, and uses 2 units of raw material. \nEach device C has a profit of $50, requires 4 hours of labor, and uses 3 units of raw material.\nThe company aims to maximize the profit per unit of labor and raw material used.\n// Profit from A: Profit_A = 30 * A\n// Profit from B: Profit_B = 40 * B\n// Profit from C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for raw materials.\n// A + 2 * B + 3 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources. Each device A has a profit of $30, requires 2 hours of labor, and uses 1 unit of raw material. Each device B has a profit of $40, requires 3 hours of labor, and uses 2 units of raw material. Each device C has a profit of $50, requires 4 hours of labor, and uses 3 units of raw material. The company has a budget of $1000 for raw materials. The company aims to maximize the profit per unit of labor and raw material used. Please help the company determine the optimal production quantities for devices A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nLaborAndMaterial = 2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborAndMaterial\n## convert the division to multiplication\nmodel.addCons(obj * LaborAndMaterial == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to the complexity of the production process, the profit per unit decreases nonlinearly with the increase in production quantity. Specifically, the profit per unit decreases by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products.\n// Profit_A = (10 - 0.005 * A) * A\n// Profit_B = (15 - 0.005 * B) * B\n// Profit_C = (20 - 0.005 * C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units.\n// A <= 200; B <= 150; C <= 100\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 300 units in total.\n// A + B + C <= 300\n\n## Generate Constraint-4:\nTo maintain quality, the production of Product B must be at least twice the production of Product A.\n// B >= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of each product decreases nonlinearly with the increase in production quantity, specifically by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products. The profit per unit for Product A is $10, for Product B is $15, and for Product C is $20.\n\n| Product | Profit per Unit | Raw Material per Unit |\n|---------|-----------------|-----------------------|\n| A       | $10             | 5 kg                  |\n| B       | $15             | 8 kg                  |\n| C       | $20             | 10 kg                 |\n\nThe company has a limited supply of raw materials, with a total of 1000 kg available. The market has a demand limit for each product: 200 units for Product A, 150 units for Product B, and 100 units for Product C. The company also has a production capacity limit of 300 units in total. To maintain quality, the production of Product B must be at least twice the production of Product A.\n\nPlease help the company determine the optimal production quantities for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit per unit decreases by 0.005 times the quantity produced for each product\nProfit_A = (10 - 0.005 * A) * A\nProfit_B = (15 - 0.005 * B) * B\nProfit_C = (20 - 0.005 * C) * C\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n## The market has a demand limit for each product.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 100)\n## The company has a production capacity limit of 300 units in total.\nmodel.addCons(A + B + C <= 300)\n## To maintain quality, the production of Product B must be at least twice the production of Product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1337,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: wheat, corn, and soybeans. The farm needs to determine how many acres to allocate to each crop to optimize its profit.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farm has a limited amount of fertilizer, which affects the yield of each crop. The fertilizer usage per acre for wheat is 2 units, for corn is 3 units, and for soybeans is 2.5 units. The farm aims to maximize its total profit, considering the nonlinear relationship between fertilizer usage and yield.\n// Profit from wheat: Profit_W = 200 * W * (1 - 0.01 * (2 * W / F)^2)\n// Profit from corn: Profit_C = 300 * C * (1 - 0.01 * (3 * C / F)^2)\n// Profit from soybeans: Profit_S = 250 * S * (1 - 0.01 * (2.5 * S / F)^2)\n// Where F is the total fertilizer available.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farm has 500 units of fertilizer available.\n// 2 * W + 3 * C + 2.5 * S <= 500\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop.\n// W >= 10; C >= 10; S >= 10",
        "question": "A farm produces three types of crops: wheat, corn, and soybeans. The farm needs to determine how many acres to allocate to each crop to optimize its profit. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farm has a limited amount of fertilizer, which affects the yield of each crop. The fertilizer usage per acre for wheat is 2 units, for corn is 3 units, and for soybeans is 2.5 units. The farm has a total of 100 acres available for cultivation and 500 units of fertilizer available. The farm must allocate at least 10 acres to each crop. Please help the farm to maximize its total profit, considering the nonlinear relationship between fertilizer usage and yield.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=10) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=10) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit from wheat: Profit_W = 200 * W * (1 - 0.01 * (2 * W / F)^2)\n## Profit from corn: Profit_C = 300 * C * (1 - 0.01 * (3 * C / F)^2)\n## Profit from soybeans: Profit_S = 250 * S * (1 - 0.01 * (2.5 * S / F)^2)\n## Where F is the total fertilizer available.\nF = 500  # Total fertilizer available\n\n# Define quadratic terms for non-linear parts\nQuad_W = (2 * W / F)**2\nQuad_C = (3 * C / F)**2\nQuad_S = (2.5 * S / F)**2\n\n# Define linear parts\nLinear_W = 200 * W\nLinear_C = 300 * C\nLinear_S = 250 * S\n\n# Define profits with non-linear parts\nProfit_W = Linear_W * (1 - 0.01 * Quad_W)\nProfit_C = Linear_C * (1 - 0.01 * Quad_C)\nProfit_S = Linear_S * (1 - 0.01 * Quad_S)\n\n# Add constraints to handle non-linear parts\nmodel.addCons(Quad_W <= 100 * W)\nmodel.addCons(Quad_C <= 100 * C)\nmodel.addCons(Quad_S <= 100 * S)\n\n# Objective function\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(W + C + S <= 100)\n## The farm has 500 units of fertilizer available.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n// Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n// Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n// Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\n\n## Generate Constraint-1:\nThe total area of land available for farming is 100 hectares.\n// W + C + B <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop. The profit per hectare and the costs for irrigation and fertilization for each crop are given in the following Table.\n\n| Crop    | Profit per Hectare | Irrigation Cost | Fertilization Cost |\n|---------|--------------------|-----------------|--------------------|\n| Wheat   | $1000              | $50 * W^2       | $30 * W^1.5        |\n| Corn    | $1200              | $60 * C^2       | $40 * C^1.5        |\n| Barley  | $800               | $40 * B^2       | $20 * B^1.5        |\n\nThe farmer's total area of land available for farming is 100 hectares. Please help the farmer to maximize his net profit, considering the nonlinear costs for irrigation and fertilization.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and cost calculations\nProfit_wheat = 1000 * W - 50 * W**2 - 30 * W**1.5\nProfit_corn = 1200 * C - 60 * C**2 - 40 * C**1.5\nProfit_barley = 800 * B - 40 * B**2 - 20 * B**1.5\n\n## the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_barley)\n\n# Add constraints\n## The total area of land available for farming is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Barley: \", model.getVal(B))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C.\n// A >= 50; B >= 75",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The total production cost for all products must not exceed $1000, with the cost per unit of product A being $3, product B being $5, and product C being $7. The company has a storage capacity limit of 500 units for all products combined. The market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C. Please help the company to maximize the total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\n// Operating hours for product A: HA = 800 / (10 * MA)\n// Operating hours for product B: HB = 1200 / (15 * MB)\n// Operating hours for product C: HC = 1600 / (20 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nEach type of product can be produced by up to 20 machines.\n// MA <= 20; MB <= 20; MC <= 20\n\n## Generate Constraint-3:\nAt least 10 machines must be dedicated to product A.\n// MA >= 10\n\n## Generate Constraint-4:\nThe number of machines for product C must not exceed twice the number of machines for product A.\n// MC <= 2 * MA",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type. Each machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\nThe manufacturer has a total of 50 machines available. Each type of product can be produced by up to 20 machines. At least 10 machines must be dedicated to product A. The number of machines for product C must not exceed twice the number of machines for product A.\nPlease help the manufacturer determine the optimal allocation of machines to minimize the maximum operating hours required to meet the daily demand for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 800 / (10 * MA)\nHB = 1200 / (15 * MB)\nHC = 1600 / (20 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 800)\nmodel.addCons(HB * (15 * MB) == 1200)\nmodel.addCons(HC * (20 * MC) == 1600)\n## the objective function is: Minimize max(HA, HB, HC)\n## convert max to a variable\nmax_hours = model.addVar(name=\"max_hours\")\nmodel.addCons(max_hours >= HA)\nmodel.addCons(max_hours >= HB)\nmodel.addCons(max_hours >= HC)\nmodel.addCons(obj == max_hours)\n\n# Add constraints\nmodel.addCons(MA + MB + MC <= 50)\nmodel.addCons(MA <= 20)\nmodel.addCons(MB <= 20)\nmodel.addCons(MC <= 20)\nmodel.addCons(MC <= 2 * MA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Minimized Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each facility to optimize production efficiency.\n// {\"amount of raw material for facility 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for facility 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for facility 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility has a different efficiency rate at which it converts raw material into the chemical product. Facility 1 converts raw material at a rate of 0.5 kg/liter, Facility 2 at 0.6 kg/liter, and Facility 3 at 0.7 kg/liter. The company wants to maximize the total amount of chemical produced.\n// The total chemical produced by facility 1: C1 = 0.5 * R1\n// The total chemical produced by facility 2: C2 = 0.6 * R2\n// The total chemical produced by facility 3: C3 = 0.7 * R3\n// So, the objective function is: Maximize (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 liters.\n// R1 + R2 + R3 <= 1000\n\n## Generate Constraint-2:\nEach facility has a storage limit for raw material. Facility 1 can store up to 300 liters, Facility 2 up to 400 liters, and Facility 3 up to 500 liters.\n// R1 <= 300; R2 <= 400; R3 <= 500\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 20% of the total raw material is allocated to Facility 1 for research and development purposes.\n// R1 >= 0.2 * (R1 + R2 + R3)",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each facility to optimize production efficiency. Each facility has a different efficiency rate at which it converts raw material into the chemical product: Facility 1 converts at a rate of 0.5 kg/liter, Facility 2 at 0.6 kg/liter, and Facility 3 at 0.7 kg/liter. The company wants to maximize the total amount of chemical produced.\nThe total amount of raw material available is 1000 liters. Each facility has a storage limit for raw material: Facility 1 can store up to 300 liters, Facility 2 up to 400 liters, and Facility 3 up to 500 liters. The company also has a policy to ensure that at least 20% of the total raw material is allocated to Facility 1 for research and development purposes.\nPlease help the company determine the optimal allocation of raw material to each facility.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material for facility 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for facility 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for facility 3\n\n# Define objective function\nC1 = 0.5 * R1\nC2 = 0.6 * R2\nC3 = 0.7 * R3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 <= 1000) # total amount of raw material available is 1000 liters\nmodel.addCons(R1 <= 300) # Facility 1 storage limit\nmodel.addCons(R2 <= 400) # Facility 2 storage limit\nmodel.addCons(R3 <= 500) # Facility 3 storage limit\nmodel.addCons(R1 >= 0.2 * (R1 + R2 + R3)) # at least 20% of the total raw material is allocated to Facility 1\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Facility 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Facility 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Facility 3: \", model.getVal(R3))\n    print(\"Total Chemical Produced: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (80 - 40) * A\n// Profit of B: Profit_B = (120 - 60) * B\n// Profit of C: Profit_C = (160 - 80) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for material costs for the next quarter.\n// 40 * A + 60 * B + 80 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Material Cost | Production Time |\n|--------|---------------|---------------|-----------------|\n| A      | 80$           | 40$           | 1 hour          |\n| B      | 120$          | 60$           | 2 hours         |\n| C      | 160$          | 80$           | 3 hours         |\n\nThe manufacturer has a budget of $10,000 for material costs for the next quarter. The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter. Please help the manufacturer to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (80 - 40) * A\nProfit_B = (120 - 60) * B\nProfit_C = (160 - 80) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for material costs for the next quarter.\nmodel.addCons(40 * A + 60 * B + 80 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000\n\n## Generate Constraint-2:\nThe total production capacity across all devices is limited to 2000 units.\n// S + T + L <= 2000\n\n## Generate Constraint-3:\nThe market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\n// S >= 500; T >= 300; L >= 400",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The production and market constraints are as follows:\n\n| Device       | Profit per Unit | Production Capacity | Market Demand |\n|--------------|-----------------|----------------------|---------------|\n| Smartphones  | $100            | 1000 units           | 500 units     |\n| Tablets      | $150            | 1000 units           | 300 units     |\n| Laptops      | $200            | 1000 units           | 400 units     |\n\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced. The total production capacity across all devices is limited to 2000 units. The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\n\nPlease help the company to maximize its total profit by determining the optimal number of units to produce for each device type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n# The production capacity allows for a maximum of 1000 units of any single device type to be produced.\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n# The total production capacity across all devices is limited to 2000 units.\nmodel.addCons(S + T + L <= 2000)\n# The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\nmodel.addCons(S >= 500)\nmodel.addCons(T >= 300)\nmodel.addCons(L >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1194,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n\n| Product | Profit per Unit | Technology Cost Reduction per Unit |\n|---------|-----------------|------------------------------------|\n| A       | $100            | $5 for every $10,000 invested     |\n| B       | $150            | $7 for every $10,000 invested     |\n| C       | $200            | $10 for every $10,000 invested    |\n\nThe company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. Please help the company determine the optimal production quantities of products A, B, and C, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nmodel.addCons(obj == (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n// Profit_A = (5 * 100 * A) - (200 * A)\n// Profit_B = (8 * 120 * B) - (300 * B)\n// Profit_C = (10 * 150 * C) - (400 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop. The yield per hectare, selling price per ton, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton | Labor Cost per Hectare |\n|------|-------------------|-----------------------|------------------------|\n| A    | 5 tons            | $100                  | $200                   |\n| B    | 8 tons            | $120                  | $300                   |\n| C    | 10 tons           | $150                  | $400                   |\n\nThe farmer has a total of 100 hectares available for cultivation. The farmer has a budget of $20,000 for labor costs. The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity. \nPlease help the farmer to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 * A) - (200 * A)\nProfit_B = (8 * 120 * B) - (300 * B)\nProfit_C = (10 * 150 * C) - (400 * C)\nTotalHectares = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalHectares\n## convert the division to multiplication\nmodel.addCons(obj * TotalHectares == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1010,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit and the cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit | Additional Notes |\n|---------|-----------------|---------------|------------------|\n| A       | $10             | $3            | Profit decreases by $0.02 for each unit produced beyond the first 100 units |\n| B       | $15             | $5            | Profit decreases by $0.015 for each unit produced beyond the first 150 units |\n| C       | $20             | $7            | Profit decreases by $0.01 for each unit produced beyond the first 200 units |\n\nThe total production cost for all products must not exceed $1000. The company aims to maximize the total profit from selling these products. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=model.infinity())\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=model.infinity())\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=model.infinity())\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe market demand for product B is at least 15 units per day.\n// B >= 15\n\n## Generate Constraint-4:\nThe market demand for product C is at least 10 units per day.\n// C >= 10",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day. The market demand for product B is at least 15 units per day. The market demand for product C is at least 10 units per day.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce per day to maximize profit while adhering to the production capacity and market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 10*A + 15*B + 20*C - 0.01*(A**2 + B**2 + C**2)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1136,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. \nEach unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. \nEach unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit.\nThe plant aims to maximize the profit per unit of labor used.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 7 * B\n// Profit from C: Profit_C = 9 * C\n// Total labor used: Labor = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for raw materials.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily limit of 150 hours of labor.\n// 2 * A + 3 * B + 4 * C <= 150\n\n## Generate Constraint-3:\nThe plant must produce at least 20 units of each component daily.\n// A >= 20; B >= 20; C >= 20",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency. The details of labor hours, raw material units, and profit per unit for each component are given in the following Table.\n\n| Component | Labor Hours | Raw Material Units | Profit per Unit |\n|-----------|-------------|--------------------|-----------------|\n| A         | 2 hours     | 3 units            | $5              |\n| B         | 3 hours     | 4 units            | $7              |\n| C         | 4 hours     | 5 units            | $9              |\n\nThe plant has a daily budget of $1000 for raw materials. The plant has a daily limit of 150 hours of labor. The plant must produce at least 20 units of each component daily. \nPlease help the plant to maximize the profit per unit of labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nLabor = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily budget of $1000 for raw materials.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n## The plant has a daily limit of 150 hours of labor.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate per Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost is $0.1 per unit per day. For Device B, the selling price is $150, the production cost is $90, and the storage cost is $0.15 per unit per day. For Device C, the selling price is $200, the production cost is $120, and the storage cost is $0.2 per unit per day. The storage costs are accumulated daily and affect the net profit. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs over a period of 30 days.\n// Revenue_A = 100 * A\n// Revenue_B = 150 * B\n// Revenue_C = 200 * C\n// Production_Cost_A = 60 * A\n// Production_Cost_B = 90 * B\n// Production_Cost_C = 120 * C\n// Storage_Cost_A = 0.1 * A * 30\n// Storage_Cost_B = 0.15 * B * 30\n// Storage_Cost_C = 0.2 * C * 30\n// So, the objective function is: Maximize (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin. The selling price, production cost, and daily storage cost for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Daily Storage Cost |\n|--------|---------------|-----------------|---------------------|\n| A      | $100          | $60             | $0.1 per unit      |\n| B      | $150          | $90             | $0.15 per unit     |\n| C      | $200          | $120            | $0.2 per unit      |\n\nThe storage costs are accumulated daily and affect the net profit over a period of 30 days. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs. The company has a budget of $10,000 for production costs.\n\nPlease help the company to determine the optimal production quantities of devices A, B, and C to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\nRevenue_A = 100 * A\nRevenue_B = 150 * B\nRevenue_C = 200 * C\nProduction_Cost_A = 60 * A\nProduction_Cost_B = 90 * B\nProduction_Cost_C = 120 * C\nStorage_Cost_A = 0.1 * A * 30\nStorage_Cost_B = 0.15 * B * 30\nStorage_Cost_C = 0.2 * C * 30\n# Objective function: Maximize (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C))\n\n# Add constraints\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 20% of the total production.\n// PA >= 0.2 * (PA + PB + PC)\n\n## Generate Constraint-4:\nThe production of product C must not exceed twice the production of product B.\n// PC <= 2 * PB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n\n| Product | Profit per Unit | Technology Cost Reduction per Unit |\n|---------|-----------------|------------------------------------|\n| A       | $100            | $5 for every $10,000 invested     |\n| B       | $150            | $7 for every $10,000 invested     |\n| C       | $200            | $10 for every $10,000 invested    |\n\nThe company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 20% of the total production. The production of product C must not exceed twice the production of product B.\n\nPlease help the company to determine the optimal production quantities of products A, B, and C, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nProfit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(PA >= 0.2 * (PA + PB + PC))\n## The production of product C must not exceed twice the production of product B.\nmodel.addCons(PC <= 2 * PB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1374,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n// Profit of A: Profit_A = 500 * A - 200 * A\n// Profit of B: Profit_B = 700 * B - 300 * B\n// Profit of C: Profit_C = 900 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * A + 1500 * B + 2000 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage. The profit per acre, water usage, and labor cost for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|------|-----------------|----------------------|---------------------|\n| A    | $500            | 1000 gallons         | $200                |\n| B    | $700            | 1500 gallons         | $300                |\n| C    | $900            | 2000 gallons         | $400                |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a budget of $20,000 for labor costs. The farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nWaterUsage = 1000 * A + 1500 * B + 2000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from selling all three products.\n// Profit_A = (10 - 0.001 * (A - 100)) * A\n// Profit_B = (15 - 0.001 * (B - 100)) * B\n// Profit_C = (20 - 0.001 * (C - 100)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours.\n// 2 * A + 3 * B + 4 * C <= 1500\n\n## Generate Constraint-3:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units.\n// A <= 200; B <= 300; C <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg. The company also has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours. Additionally, the market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units. Please help the company to maximize the total profit from selling all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.001 * (A - 100)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.001 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.001 * (B - 100)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.001 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.001 * (C - 100)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=400)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.001 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $30, product B generates $40, and product C generates $50. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. The plant aims to maximize the total profit.\n// Profit of A: Profit_A = 30 * A * (1 - 0.01 * min(A, B, C))\n// Profit of B: Profit_B = 40 * B * (1 - 0.01 * min(A, B, C))\n// Profit of C: Profit_C = 50 * C * (1 - 0.01 * min(A, B, C))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for raw materials. The cost of raw materials for each unit of product A is $10, for product B is $15, and for product C is $20.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe plant has a maximum production capacity of 500 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. The profit per unit for each product decreases as production increases due to economies of scale, with the profit per unit being multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. The plant aims to maximize the total profit. The details of the products are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------------|--------------------------|\n| A       | $30             | $10                         | 2 hours                  |\n| B       | $40             | $15                         | 3 hours                  |\n| C       | $50             | $20                         | 4 hours                  |\n\nThe plant has a budget of $10,000 for raw materials. The plant also has a maximum production capacity of 500 hours. Please help the plant determine the optimal number of units to produce for each product to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit calculation with nonlinear factor\nmin_ABC = model.addVar(vtype=\"CONTINUOUS\", name=\"min_ABC\")\nmodel.addCons(min_ABC <= A)\nmodel.addCons(min_ABC <= B)\nmodel.addCons(min_ABC <= C)\n\nProfit_A = 30 * A * (1 - 0.01 * min_ABC)\nProfit_B = 40 * B * (1 - 0.01 * min_ABC)\nProfit_C = 50 * C * (1 - 0.01 * min_ABC)\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $10,000 for raw materials.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The plant has a maximum production capacity of 500 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed.\n// Efficiency_A = 10 * A / 5\n// Efficiency_B = 15 * B / 7\n// Efficiency_C = 20 * C / 9\n// So, the objective function is: Maximize (Efficiency_A + Efficiency_B + Efficiency_C)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 500 liters per day.\n// 5 * A + 7 * B + 9 * C <= 500\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe company has a daily cargo requirement of at least 1000 tons.\n// 10 * A + 15 * B + 20 * C >= 1000\n\n## Generate Constraint-4:\nThe number of Truck A cannot exceed 20.\n// A <= 20",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency. The capacity and fuel consumption for each truck are given in the following Table.\n\n| Truck Type | Cargo Capacity (tons) | Fuel Consumption (liters/trip) |\n|------------|----------------------|-------------------------------|\n| Truck A    | 10                   | 5                             |\n| Truck B    | 15                   | 7                             |\n| Truck C    | 20                   | 9                             |\n\nThe company has a total fuel budget of 500 liters per day. The total number of trucks that can be deployed is limited to 50. The company has a daily cargo requirement of at least 1000 tons. The number of Truck A cannot exceed 20. \nPlease help the company to maximize the cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_A = 10 * A / 5\nEfficiency_B = 15 * B / 7\nEfficiency_C = 20 * C / 9\n## convert the division to multiplication\nmodel.addCons(obj * (5 * A + 7 * B + 9 * C) == 10 * A + 15 * B + 20 * C)\n\n# Add constraints\n## The company has a total fuel budget of 500 liters per day.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 500)\n## The total number of trucks that can be deployed is limited to 50.\nmodel.addCons(A + B + C <= 50)\n## The company has a daily cargo requirement of at least 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 1000)\n## The number of Truck A cannot exceed 20.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\n// {\"production rate of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The objective is to maximize the total profit, which is the difference between the revenue and the cost.\n// The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n// The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n// The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\n// The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total production rate cannot exceed 200 units per day.\n// P1 + P2 + P3 <= 200",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand. The profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The cost functions for each product are as follows:\n\n| Product | Cost Function |\n|---------|---------------|\n| 1       | C1 = 0.01 * P1^2 + 0.5 * P1 + 2 |\n| 2       | C2 = 0.02 * P2^2 + 0.8 * P2 + 3 |\n| 3       | C3 = 0.03 * P3^2 + 1.0 * P3 + 4 |\n\nThe objective is to maximize the total profit, which is the difference between the revenue and the cost. The total production rate cannot exceed 200 units per day. Please help the company determine the optimal production rates for each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of product 3\n\n# Define objective function\n## The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n## The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n## The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\nC1 = 0.01 * P1**2 + 0.5 * P1 + 2\nC2 = 0.02 * P2**2 + 0.8 * P2 + 3\nC3 = 0.03 * P3**2 + 1.0 * P3 + 4\n## The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3))\n\n# Add constraints\n## The total production rate cannot exceed 200 units per day.\nmodel.addCons(P1 + P2 + P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n// The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 400 units of any product to be produced.\n// A <= 400; B <= 400; C <= 400\n\n## Generate Constraint-3:\nThe company aims to produce at least 100 units of product A and 150 units of product B.\n// A >= 100; B >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2). The company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The raw material constraint allows for a maximum of 400 units of any product to be produced. The company aims to produce at least 100 units of product A and 150 units of product B. Please help the company determine the optimal number of units of products A, B, and C to produce to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100, ub=400) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150, ub=400) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n## Since pyscipopt does not support quadratic objective functions directly, we need to linearize it by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\nProfit = 50 * A + 70 * B + 90 * C - 0.01 * (A_sq + B_sq + C_sq)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. Each worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products. The company has a total of 50 workers available. Please help the company determine the optimal number of workers to assign to each product line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 613,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-3:\nThe total available machine hours are 800 hours.\n// M <= 800",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2, where R is the amount of raw materials, L is the labor hours, and M is the machine hours.\n\nThe total budget for raw materials is $5000. The total available labor hours are 1000 hours. The total available machine hours are 800 hours.\n\nPlease help the plant manager to maximize the total profit given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total available machine hours are 800 hours.\nmodel.addCons(M <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 606,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200\n\n## Generate Constraint-2:\nThe level of automation cannot exceed $5000.\n// Automation <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets. The company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. The level of automation cannot exceed $5000. Please help the company to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(Automation <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of three different products: Product A, Product B, and Product C. Additionally, the company is considering investing in a new technology that could improve the efficiency of production, which would reduce the production costs per unit.\n// {\"production level of Product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production level of Product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $50, Product B is $70, and Product C is $60. The new technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price for each unit of Product A is $100, Product B is $120, and Product C is $110. The company aims to maximize the total profit from the sales of all three products.\n// Total profit: Profit = (100 - (50 - 0.0002 * TechInvest)) * ProdA + (120 - (70 - 0.0002 * TechInvest)) * ProdB + (110 - (60 - 0.0002 * TechInvest)) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 2000 units.\n// ProdA + ProdB + ProdC <= 2000\n\n## Generate Constraint-3:\nThe production of Product A must be at least 500 units.\n// ProdA >= 500\n\n## Generate Constraint-4:\nThe production of Product B must not exceed 800 units.\n// ProdB <= 800",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of three different products: Product A, Product B, and Product C. Additionally, the company is considering investing in a new technology that could improve the efficiency of production, which would reduce the production costs per unit. The cost of producing each unit of Product A is $50, Product B is $70, and Product C is $60. The new technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price for each unit of Product A is $100, Product B is $120, and Product C is $110. The company aims to maximize the total profit from the sales of all three products.\nThe company has a budget of $100,000 for the investment in the new technology. The total production capacity for all products is limited to 2000 units. The production of Product A must be at least 500 units. The production of Product B must not exceed 800 units.\nPlease help the company determine the optimal production levels for Product A, Product B, and Product C, as well as the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=500)  # production level of Product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0, ub=800)  # production level of Product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0)  # production level of Product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0)  # investment in new technology\n\n# Define objective function\n# The cost of producing each unit of Product A is $50, Product B is $70, and Product C is $60.\n# The new technology reduces the production cost per unit by $2 for every $10,000 invested.\n# The selling price for each unit of Product A is $100, Product B is $120, and Product C is $110.\n# Total profit: Profit = (100 - (50 - 0.0002 * TechInvest)) * ProdA + (120 - (70 - 0.0002 * TechInvest)) * ProdB + (110 - (60 - 0.0002 * TechInvest)) * ProdC\n# So, the objective function is: Maximize Profit\nCostA = 50 - 0.0002 * TechInvest\nCostB = 70 - 0.0002 * TechInvest\nCostC = 60 - 0.0002 * TechInvest\nProfit = (100 - CostA) * ProdA + (120 - CostB) * ProdB + (110 - CostC) * ProdC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n# The total production capacity for all products is limited to 2000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of Product A: \", model.getVal(ProdA))\n    print(\"Production level of Product B: \", model.getVal(ProdB))\n    print(\"Production level of Product C: \", model.getVal(ProdC))\n    print(\"Investment in new technology: \", model.getVal(TechInvest))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to operate the production line for each product type and the level of automation to implement, which affects the production rate.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product increases with the level of automation. For Product 1, each hour produces 10 units without automation, increasing by 2 units for every unit increase in automation. For Product 2, each hour produces 15 units without automation, increasing by 3 units for every unit increase in automation. For Product 3, each hour produces 20 units without automation, increasing by 4 units for every unit increase in automation. The company aims to maximize the total production of all products.\n// Total production for Product 1: P1 = (10 + 2 * Automation) * H1\n// Total production for Product 2: P2 = (15 + 3 * Automation) * H2\n// Total production for Product 3: P3 = (20 + 4 * Automation) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total hours available for all products in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe level of automation must be between 0 and 10 units.\n// 0 <= Automation <= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to operate the production line for each product type and the level of automation to implement, which affects the production rate. The production rate for each product increases with the level of automation. For Product 1, each hour produces 10 units without automation, increasing by 2 units for every unit increase in automation. For Product 2, each hour produces 15 units without automation, increasing by 3 units for every unit increase in automation. For Product 3, each hour produces 20 units without automation, increasing by 4 units for every unit increase in automation. The company aims to maximize the total production of all products.\n\n| Product | Production Rate without Automation | Increase per Unit of Automation |\n|---------|-------------------------------------|---------------------------------|\n| 1       | 10 units/hour                       | 2 units/hour                    |\n| 2       | 15 units/hour                       | 3 units/hour                    |\n| 3       | 20 units/hour                       | 4 units/hour                    |\n\nThe total hours available for all products in a week is 168 hours. The level of automation must be between 0 and 10 units. Please help the company to maximize the total production of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0) # hours for Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=0) # hours for Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=0) # hours for Product 3\nAutomation = model.addVar(name=\"Automation\", lb=0, ub=10) # level of automation\n\n# Define objective function\nP1 = (10 + 2 * Automation) * H1\nP2 = (15 + 3 * Automation) * H2\nP3 = (20 + 4 * Automation) * H3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1400,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company aims to maximize its total profit while considering the efficiency of raw material usage. The efficiency is defined as the ratio of total profit to the total raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 100 * C\n// Total raw material usage: RawMaterial = 2 * A + 3 * B + 5 * C\n// So, the objective function is: Maximize Profit / RawMaterial\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\n// 2 * A + 3 * B + 5 * C <= 10000 / 10",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage. The profit from product A is $50 per unit, which requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company aims to maximize its total profit while considering the efficiency of raw material usage, which is defined as the ratio of total profit to the total raw material used. The company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit. Please help the company determine the optimal number of units to produce for each product to maximize the efficiency of raw material usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 5 * C\n## the objective function is: Maximize Profit / RawMaterial\n## convert the division to multiplication\nmodel.addCons(obj * RawMaterial == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\nmodel.addCons(2 * A + 3 * B + 5 * C <= 10000 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15,000\n\n## Generate Constraint-4:\nThe farm wants to ensure that each crop gets at least 5 acres to maintain biodiversity.\n// CropAAcreage >= 5; CropBAcreage >= 5; CropCAcreage >= 5",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop     | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|----------|-------------------------|----------------------|---------------------|\n| CropA    | $500                    | 2000 gallons         | $100               |\n| CropB    | $700                    | 3000 gallons         | $150               |\n| CropC    | $900                    | 4000 gallons         | $200               |\n\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. The farm has a budget of $15,000 for labor costs for the season. The farm wants to ensure that each crop gets at least 5 acres to maintain biodiversity.\n\nPlease help the farm to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=5)  # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=5)  # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=5)  # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1144,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit.\n// {\"amount of resource 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of resources used. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of resource 1 available is 100 units.\n// R1 <= 100\n\n## Generate Constraint-2:\nThe total amount of resource 2 available is 120 units.\n// R2 <= 120",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit. The profit from each product depends on the amount of resources used, with the profit function for each product being nonlinear:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe total amount of resource 1 available is 100 units, and the total amount of resource 2 available is 120 units. The plant manager wants to maximize the total profit from all three products. Please help the plant manager determine the optimal allocation of resources R1, R2, and R3 to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of resource 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of resource 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of resource 3\n\n# Define objective function\n## The profit function for each product is nonlinear and given by:\nP1 = 50 * R1**0.5 - 10 * R1\nP2 = 70 * R2**0.6 - 20 * R2\nP3 = 60 * R3**0.7 - 15 * R3\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total amount of resource 1 available is 100 units.\nmodel.addCons(R1 <= 100)\n## The total amount of resource 2 available is 120 units.\nmodel.addCons(R2 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Resource 1: \", model.getVal(R1))\n    print(\"Amount of Resource 2: \", model.getVal(R2))\n    print(\"Amount of Resource 3: \", model.getVal(R3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\n// A <= 50; B <= 60",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. The profit per unit and the production cost structure for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Structure |\n|--------|-----------------|----------------------------|\n| A      | $20             | 0.01 * A^2                 |\n| B      | $30             | 2 * B                      |\n| C      | $40             | 50 - 0.5 * C               |\n\nThe company has a budget constraint of $1000 for the total production costs. The company also has a production capacity constraint of 50 units for Device A and 60 units for Device B. \n\nPlease help the company to maximize the total profit from selling the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=60) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = 20 * A - 0.01 * A^2\n## convert the quadratic term to a linear term by introducing a new variable\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nmodel.addCons(A_sq == A * A)\nProfit_A = 20 * A - 0.01 * A_sq\n## Profit_B = 30 * B - 2 * B\nProfit_B = 30 * B - 2 * B\n## Profit_C = 40 * C - (50 - 0.5 * C)\nProfit_C = 40 * C - (50 - 0.5 * C)\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A_sq + 2 * B + (50 - 0.5 * C) <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that each acre of wheat yields a profit of $500, corn yields $700, and soybeans yields $600. However, the cost of fertilizers varies with the type of crop: wheat requires $100 per acre, corn requires $150 per acre, and soybeans requires $120 per acre. The farmer wants to maximize the net profit per dollar spent on fertilizers.\n// Profit from wheat: P_wheat = 500 * Wheat\n// Profit from corn: P_corn = 700 * Corn\n// Profit from soybeans: P_soybeans = 600 * Soybeans\n// Cost of fertilizers for wheat: C_wheat = 100 * Wheat\n// Cost of fertilizers for corn: C_corn = 150 * Corn\n// Cost of fertilizers for soybeans: C_soybeans = 120 * Soybeans\n// Total profit: Total_P = P_wheat + P_corn + P_soybeans\n// Total cost: Total_C = C_wheat + C_corn + C_soybeans\n// So, the objective function is: Maximize (Total_P / Total_C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 20 acres of wheat to meet a contract obligation.\n// Wheat >= 20\n\n## Generate Constraint-3:\nDue to soil conditions, the farmer can plant no more than 40 acres of corn.\n// Corn <= 40\n\n## Generate Constraint-4:\nThe farmer wants to ensure that at least 30% of the total acres are dedicated to soybeans to maintain soil health.\n// Soybeans >= 0.3 * (Wheat + Corn + Soybeans)",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit and cost of fertilizers for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Cost of Fertilizers per Acre |\n|------------|-----------------|------------------------------|\n| Wheat      | $500            | $100                         |\n| Corn       | $700            | $150                         |\n| Soybeans   | $600            | $120                         |\n\nThe farmer has a total of 100 acres available for planting. The farmer must plant at least 20 acres of wheat to meet a contract obligation. Due to soil conditions, the farmer can plant no more than 40 acres of corn. The farmer wants to ensure that at least 30% of the total acres are dedicated to soybeans to maintain soil health. \nPlease help the farmer to maximize the net profit per dollar spent on fertilizers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=20) # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0, ub=40) # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_wheat = 500 * Wheat\nP_corn = 700 * Corn\nP_soybeans = 600 * Soybeans\nC_wheat = 100 * Wheat\nC_corn = 150 * Corn\nC_soybeans = 120 * Soybeans\nTotal_P = P_wheat + P_corn + P_soybeans\nTotal_C = C_wheat + C_corn + C_soybeans\n## the objective function is: Maximize (Total_P / Total_C)\n## convert the division to multiplication\nmodel.addCons(obj * Total_C == Total_P)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer must plant at least 20 acres of wheat to meet a contract obligation.\nmodel.addCons(Wheat >= 20)\n## Due to soil conditions, the farmer can plant no more than 40 acres of corn.\nmodel.addCons(Corn <= 40)\n## The farmer wants to ensure that at least 30% of the total acres are dedicated to soybeans to maintain soil health.\nmodel.addCons(Soybeans >= 0.3 * (Wheat + Corn + Soybeans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Net Profit per Dollar Spent on Fertilizers: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products. The total available hours for production in a day is 8 hours. Please help the company determine the optimal allocation of hours to each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=0) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 659,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials.\n// {\"quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, Product B is $150, and Product C is $200. The cost of Material1 per unit of Product A is $20, Material2 per unit of Product B is $30, and Material3 per unit of Product C is $40. The manufacturer wants to maximize the total profit, considering the cost of materials.\n// Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of Material1 available is 1000 units.\n// 20 * ProductA <= 1000\n\n## Generate Constraint-2:\nThe total amount of Material2 available is 1500 units.\n// 30 * ProductB <= 1500",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials. The profit per unit and the cost of materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Material per Unit |\n|---------|-----------------|---------------------------|\n| A       | $100            | $20 (Material1)           |\n| B       | $150            | $30 (Material2)           |\n| C       | $200            | $40 (Material3)           |\n\nThe total amount of Material1 available is 1000 units. The total amount of Material2 available is 1500 units. The manufacturer wants to maximize the total profit, considering the cost of materials. Please help the manufacturer determine the optimal quantities of Product A, Product B, and Product C to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nProfit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of Material1 available is 1000 units.\nmodel.addCons(20 * ProductA <= 1000)\n## The total amount of Material2 available is 1500 units.\nmodel.addCons(30 * ProductB <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe market demand for Crop A is limited to 20 hectares.\n// A <= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 hectares to Crop B to maintain soil health.\n// B >= 10\n\n## Generate Constraint-5:\nDue to labor constraints, the total area for Crop C cannot exceed 30 hectares.\n// C <= 30",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare for Crop A is $1000 and it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer has access to a total of 100 units of water and the total available land for cultivation is 50 hectares. The market demand for Crop A is limited to 20 hectares. The farmer must allocate at least 10 hectares to Crop B to maintain soil health. Due to labor constraints, the total area for Crop C cannot exceed 30 hectares.\nPlease help the farmer to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n## The market demand for Crop A is limited to 20 hectares.\nmodel.addCons(A <= 20)\n## The farmer must allocate at least 10 hectares to Crop B to maintain soil health.\nmodel.addCons(B >= 10)\n## Due to labor constraints, the total area for Crop C cannot exceed 30 hectares.\nmodel.addCons(C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"0 <= P2 <= 150\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"0 <= P3 <= 200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 yields a profit of $50, $70, and $90 respectively. However, the profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation. The profit function for each product is given by: Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit.\n// Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\n\n## Generate Constraint-1:\nThe total daily production capacity of the line is 300 units.\n// P1 + P2 + P3 <= 300\n\n## Generate Constraint-2:\nThe production of product 1 requires a specific raw material that is limited to 120 units per day.\n// P1 <= 120\n\n## Generate Constraint-3:\nThe market demand for product 3 should not exceed 180 units per day to maintain product exclusivity.\n// P3 <= 180",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand. The profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation, and is calculated as Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit. The profit per unit for products 1, 2, and 3 are $50, $70, and $90 respectively.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| 1       | $50             |\n| 2       | $70             |\n| 3       | $90             |\n\nThe total daily production capacity of the line is 300 units. The production of product 1 requires a specific raw material that is limited to 120 units per day. The market demand for product 3 should not exceed 180 units per day to maintain product exclusivity.\n\nPlease help the company to maximize the total daily profit by determining the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=150) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=200) # production quantity of product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\nmodel.addCons(obj == (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90)\n\n# Add constraints\n## The total daily production capacity of the line is 300 units.\nmodel.addCons(P1 + P2 + P3 <= 300)\n## The production of product 1 requires a specific raw material that is limited to 120 units per day.\nmodel.addCons(P1 <= 120)\n## The market demand for product 3 should not exceed 180 units per day to maintain product exclusivity.\nmodel.addCons(P3 <= 180)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $500, but it requires 2 units of water. Crop B yields a profit of $700 per hectare with 3 units of water required. Crop C yields $1000 per hectare but requires 5 units of water. The farmer wants to maximize the total profit per unit of water used (profit/water).\n// Profit of A: Profit_A = 500 * A\n// Profit of B: Profit_B = 700 * B\n// Profit of C: Profit_C = 1000 * C\n// Water used for A: Water_A = 2 * A\n// Water used for B: Water_B = 3 * B\n// Water used for C: Water_C = 5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited water supply and can only use up to 300 units of water.\n// 2 * A + 3 * B + 5 * C <= 300",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage. The profit per hectare and the water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Required per Hectare |\n|------|---------------------|----------------------------|\n| A    | $500                | 2 units                    |\n| B    | $700                | 3 units                    |\n| C    | $1000               | 5 units                    |\n\nThe farmer has a total of 100 hectares available for planting. The farmer also has a limited water supply and can only use up to 300 units of water. \n\nPlease help the farmer to maximize the total profit per unit of water used (profit/water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for planting.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a limited water supply and can only use up to 300 units of water.\nmodel.addCons(2 * A + 3 * B + 5 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total monthly fuel cost. The fuel cost per kilometer for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.2. The expected monthly mileage for trucks is 10,000 km, for vans is 8,000 km, and for motorcycles is 5,000 km.\n// Total fuel cost for trucks: Cost_Trucks = 0.5 * 10,000 * Trucks\n// Total fuel cost for vans: Cost_Vans = 0.3 * 8,000 * Vans\n// Total fuel cost for motorcycles: Cost_Motorcycles = 0.2 * 5,000 * Motorcycles\n// So, the objective function is: Minimize (Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000.\n// 20,000 * Trucks + 15,000 * Vans + 5,000 * Motorcycles <= 100,000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 10.\n// Trucks + Vans + Motorcycles <= 10\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of trucks must be at least twice the number of motorcycles.\n// Trucks >= 2 * Motorcycles",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations. The fuel cost per kilometer and expected monthly mileage for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Cost per Kilometer | Expected Monthly Mileage |\n|--------------|-------------------------|--------------------------|\n| Trucks       | $0.5                    | 10,000 km                |\n| Vans         | $0.3                    | 8,000 km                 |\n| Motorcycles  | $0.2                    | 5,000 km                 |\n\nThe company aims to minimize the total monthly fuel cost. The company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000. The total number of vehicles cannot exceed 10. Due to maintenance constraints, the number of trucks must be at least twice the number of motorcycles.\n\nPlease help the company determine the optimal number of each vehicle type to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\n\n# Define objective function\nCost_Trucks = 0.5 * 10000 * Trucks\nCost_Vans = 0.3 * 8000 * Vans\nCost_Motorcycles = 0.2 * 5000 * Motorcycles\n# So, the objective function is: Minimize (Cost_Trucks + Cost_Vans + Cost_Motorcycles)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n# Add constraints\n# The company has a budget of $100,000 to purchase new vehicles.\nmodel.addCons(20000 * Trucks + 15000 * Vans + 5000 * Motorcycles <= 100000)\n# The total number of vehicles cannot exceed 10.\nmodel.addCons(Trucks + Vans + Motorcycles <= 10)\n# Due to maintenance constraints, the number of trucks must be at least twice the number of motorcycles.\nmodel.addCons(Trucks >= 2 * Motorcycles)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Minimized Total Monthly Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit.\n// {\"raw materials for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. \nProduct 1 requires M1 units of raw material and generates a profit of 10M1. \nProduct 2 requires M2 units of raw material and generates a profit of 15M2. \nProduct 3 requires M3 units of raw material and generates a profit of 20M3.\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 10M1 + 15M2 + 20M3\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 100 units.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nThe production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used. The efficiency function is E1 = 1 / (1 + M1^2).\n// M1 <= 100 * E1\n\n## Generate Constraint-3:\nThe production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used. The efficiency function is E2 = M2^2 / (1 + M2^2).\n// M2 <= 100 * E2\n\n## Generate Constraint-4:\nThe production of product 3 has a constraint that the amount of raw materials used must be at least twice the amount used for product 1.\n// M3 >= 2 * M1",
        "question": "A manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit. Each unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. Product 1 requires M1 units of raw material and generates a profit of 10M1. Product 2 requires M2 units of raw material and generates a profit of 15M2. Product 3 requires M3 units of raw material and generates a profit of 20M3. The total amount of raw materials available is 100 units. The production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used, with an efficiency function E1 = 1 / (1 + M1^2). The production of product 2 is subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used, with an efficiency function E2 = M2^2 / (1 + M2^2). The production of product 3 has a constraint that the amount of raw materials used must be at least twice the amount used for product 1. Please help the plant manager to maximize the total profit from all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # raw materials for product 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0)  # raw materials for product 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0)  # raw materials for product 3\n\n# Define objective function\nP = model.addVar(name=\"P\")  # total profit\nmodel.setObjective(P, \"maximize\")\nmodel.addCons(P == 10 * M1 + 15 * M2 + 20 * M3)\n\n# Add constraints\n# The total amount of raw materials available is 100 units.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# The production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used.\nE1 = model.addVar(name=\"E1\")  # efficiency of product 1\nmodel.addCons(E1 == 1 / (1 + M1**2))\nmodel.addCons(M1 <= 100 * E1)\n\n# The production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used.\nE2 = model.addVar(name=\"E2\")  # efficiency of product 2\nmodel.addCons(E2 == M2**2 / (1 + M2**2))\nmodel.addCons(M2 <= 100 * E2)\n\n# The production of product 3 has a constraint that the amount of raw materials used must be at least twice the amount used for product 1.\nmodel.addCons(M3 >= 2 * M1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for product 1: \", model.getVal(M1))\n    print(\"Raw materials for product 2: \", model.getVal(M2))\n    print(\"Raw materials for product 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations.\n// {\"production rate of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours.\n// Cost of A: Cost_A = 2 * PA\n// Cost of B: Cost_B = 3 * PB\n// Cost of C: Cost_C = 4 * PC\n// Revenue of A: Revenue_A = 5 * PA\n// Revenue of B: Revenue_B = 7 * PB\n// Revenue of C: Revenue_C = 9 * PC\n// Total Profit: Profit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n// Total Production Time: Time = PA + 2 * PB + 3 * PC\n// So, the objective function is: Maximize Profit / Time\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 2 * PA + 3 * PB + 4 * PC <= 1000\n\n## Generate Constraint-2:\nThe plant can only allocate a maximum of 500 hours for production.\n// PA + 2 * PB + 3 * PC <= 500\n\n## Generate Constraint-3:\nThe plant must produce at least 100 units of each product.\n// PA >= 100; PB >= 100; PC >= 100\n\n## Generate Constraint-4:\nThe production rate of product B must be at least twice the production rate of product A.\n// PB >= 2 * PA",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations. The cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The plant has a budget of $1000 for production costs and can only allocate a maximum of 500 hours for production. The plant must produce at least 100 units of each product. Additionally, the production rate of product B must be at least twice the production rate of product A. Please help the plant to maximize its profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=100) # production rate of product A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=100) # production rate of product B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=100) # production rate of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 2 * PA\nCost_B = 3 * PB\nCost_C = 4 * PC\nRevenue_A = 5 * PA\nRevenue_B = 7 * PB\nRevenue_C = 9 * PC\nProfit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nProductionTime = PA + 2 * PB + 3 * PC\n## the objective function is: Maximize Profit / Time\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 1000)\n## The plant can only allocate a maximum of 500 hours for production.\nmodel.addCons(PA + 2 * PB + 3 * PC <= 500)\n## The plant must produce at least 100 units of each product.\nmodel.addCons(PA >= 100)\nmodel.addCons(PB >= 100)\nmodel.addCons(PC >= 100)\n## The production rate of product B must be at least twice the production rate of product A.\nmodel.addCons(PB >= 2 * PA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product A: \", model.getVal(PA))\n    print(\"Production Rate of Product B: \", model.getVal(PB))\n    print(\"Production Rate of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40\n\n## Generate Constraint-3:\nThe demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3.\n// 100 * P1 + 120 * P2 + 140 * P3 >= 2000\n\n## Generate Constraint-4:\nThe demand for component B requires at least 3000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 15 hours on line 3.\n// 150 * P1 + 180 * P2 + 200 * P3 >= 3000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\nThe total operating hours for all production lines cannot exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week.\nThe demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3.\nThe demand for component B requires at least 3000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 15 hours on line 3.\nPlease help the company determine the optimal number of hours to operate each production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n# The demand for component A requires at least 2000 units to be produced.\nmodel.addCons(100 * P1 + 120 * P2 + 140 * P3 >= 2000)\n# The demand for component B requires at least 3000 units to be produced.\nmodel.addCons(150 * P1 + 180 * P2 + 200 * P3 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized.\n// {\"production level of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n// Total profit: Profit = 50 * A + 70 * B + 90 * C\n// Environmental cost: Cost = 10 * C\n// So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe manufacturer has a contract to produce at least 200 units of product A.\n// A >= 200\n\n## Generate Constraint-3:\nDue to market demand, the production of product B should not exceed 300 units.\n// B <= 300\n\n## Generate Constraint-4:\nThe production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced.\n// C <= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized. Each unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost. The total production capacity is limited to 1000 units across all products. The manufacturer has a contract to produce at least 200 units of product A. Due to market demand, the production of product B should not exceed 300 units. The production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced. Please help the manufacturer to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * C\n## the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## The manufacturer has a contract to produce at least 200 units of product A.\nmodel.addCons(A >= 200)\n## Due to market demand, the production of product B should not exceed 300 units.\nmodel.addCons(B <= 300)\n## The production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced.\nmodel.addCons(C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of product A: \", model.getVal(A))\n    print(\"Production level of product B: \", model.getVal(B))\n    print(\"Production level of product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for component A\": \"M_A\", \"range\": \"M_A >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M_B\", \"range\": \"M_B >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M_C\", \"range\": \"M_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n// Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n// The objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * M_A + 7 * M_B + 9 * M_C <= 1500",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type. The production and maintenance costs per machine for each component are given in the following Table.\n\n| Component | Production Rate per Machine | Maintenance Cost per Machine |\n|-----------|------------------------------|------------------------------|\n| A         | 10 units per hour            | $5 per hour                  |\n| B         | 15 units per hour            | $7 per hour                  |\n| C         | 20 units per hour            | $9 per hour                  |\n\nThe manufacturer wants to maximize the total production output while minimizing the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. Please help the manufacturer determine the optimal number of machines for each component to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM_A = model.addVar(vtype=\"INTEGER\", name=\"M_A\", lb=0) # number of machines for component A\nM_B = model.addVar(vtype=\"INTEGER\", name=\"M_B\", lb=0) # number of machines for component B\nM_C = model.addVar(vtype=\"INTEGER\", name=\"M_C\", lb=0) # number of machines for component C\n\n# Define objective function\n## Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n## Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n## The objective function is: Maximize (Output - Cost)\nOutput = 10 * M_A + 15 * M_B + 20 * M_C\nCost = 5 * M_A + 7 * M_B + 9 * M_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * M_A + 7 * M_B + 9 * M_C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M_A))\n    print(\"Number of Machines for Component B: \", model.getVal(M_B))\n    print(\"Number of Machines for Component C: \", model.getVal(M_C))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceA_qty\", \"range\": \"DeviceA_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_qty\", \"range\": \"DeviceB_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_qty\", \"range\": \"DeviceC_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The cost function for DeviceA is 0.01 * (DeviceA_qty)^2 + 20, for DeviceB is 0.015 * (DeviceB_qty)^2 + 30, and for DeviceC is 0.02 * (DeviceC_qty)^2 + 40. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The cost function for DeviceA is 0.01 * (DeviceA_qty)^2 + 20, for DeviceB is 0.015 * (DeviceB_qty)^2 + 30, and for DeviceC is 0.02 * (DeviceC_qty)^2 + 40. The company wants to maximize the total net profit. The company has a total production capacity of 1000 units for all devices combined. Please help the company determine the optimal production quantity for each device to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_qty\", lb=0) # production quantity for DeviceA\nDeviceB_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_qty\", lb=0) # production quantity for DeviceB\nDeviceC_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_qty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\nProfit_DeviceA = (50 - (0.01 * DeviceA_qty**2 + 20)) * DeviceA_qty\nProfit_DeviceB = (70 - (0.015 * DeviceB_qty**2 + 30)) * DeviceB_qty\nProfit_DeviceC = (90 - (0.02 * DeviceC_qty**2 + 40)) * DeviceC_qty\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceA_qty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceB_qty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceC_qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season.\n// {\"number of hectares for CropA\": \"HectaresA\", \"range\": \"HectaresA >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropB\": \"HectaresB\", \"range\": \"HectaresB >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropC\": \"HectaresC\", \"range\": \"HectaresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $500, the water usage per hectare is 1000 liters, and the labor cost per hectare is $200. \nFor CropB, the expected profit per hectare is $700, the water usage per hectare is 1500 liters, and the labor cost per hectare is $300. \nFor CropC, the expected profit per hectare is $900, the water usage per hectare is 2000 liters, and the labor cost per hectare is $400.\nThe farm aims to maximize the profit-to-water usage ratio for the entire farm.\n// Total profit for CropA: Profit_A = 500 * HectaresA - 200 * HectaresA\n// Total profit for CropB: Profit_B = 700 * HectaresB - 300 * HectaresB\n// Total profit for CropC: Profit_C = 900 * HectaresC - 400 * HectaresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HectaresA + HectaresB + HectaresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm can allocate at most 40 hectares to CropA.\n// HectaresA <= 40\n\n## Generate Constraint-3:\nThe farm has a water supply limit of 150,000 liters for the season.\n// 1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC <= 150,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season. The expected profit per hectare, water usage per hectare, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Hectare | Water Usage per Hectare | Labor Cost per Hectare |\n|---------|-----------------------------|-------------------------|------------------------|\n| CropA   | $500                        | 1000 liters             | $200                   |\n| CropB   | $700                        | 1500 liters             | $300                   |\n| CropC   | $900                        | 2000 liters             | $400                   |\n\nThe farm has a total of 100 hectares available for cultivation. Due to soil conditions, the farm can allocate at most 40 hectares to CropA. The farm has a water supply limit of 150,000 liters for the season. \nPlease help the farm to maximize the profit-to-water usage ratio for the entire farm.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHectaresA = model.addVar(vtype=\"INTEGER\", name=\"HectaresA\", lb=0) # number of hectares for CropA\nHectaresB = model.addVar(vtype=\"INTEGER\", name=\"HectaresB\", lb=0) # number of hectares for CropB\nHectaresC = model.addVar(vtype=\"INTEGER\", name=\"HectaresC\", lb=0) # number of hectares for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * HectaresA\nProfit_B = (700 - 300) * HectaresB\nProfit_C = (900 - 400) * HectaresC\nWaterUsage = 1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HectaresA + HectaresB + HectaresC <= 100)\n## Due to soil conditions, the farm can allocate at most 40 hectares to CropA.\nmodel.addCons(HectaresA <= 40)\n## The farm has a water supply limit of 150,000 liters for the season.\nmodel.addCons(1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hectares for CropA: \", model.getVal(HectaresA))\n    print(\"Number of Hectares for CropB: \", model.getVal(HectaresB))\n    print(\"Number of Hectares for CropC: \", model.getVal(HectaresC))\n    print(\"Maximized Profit-to-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\n// Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all devices combined.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500\n\n## Generate Constraint-2:\nDue to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBUnits <= 2 * DeviceAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs, and the cost per unit for each device is $20.\n// 20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// DeviceAUnits >= 50; DeviceBUnits >= 30\n\n## Generate Constraint-5:\nThe production of DeviceC is limited to a maximum of 200 units due to technical constraints.\n// DeviceCUnits <= 200",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company has a total production capacity of 500 units for all devices combined. Due to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget of $30,000 for production costs, and the cost per unit for each device is $20. To ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB. The production of DeviceC is limited to a maximum of 200 units due to technical constraints. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=50)  # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=30)  # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0)    # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.5 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=150)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=150, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.3 * (DeviceB2 - 150)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=200)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=200, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.2 * (DeviceC2 - 200)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500)\nmodel.addCons(DeviceBUnits <= 2 * DeviceAUnits)\nmodel.addCons(20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30000)\nmodel.addCons(DeviceCUnits <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E).\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation over a 10-year period. The cost function is nonlinear and includes initial installation costs and annual operational costs. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n// Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for initial installation.\n// 1000 * S + 2000 * W + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it.\n// 100 * S + 200 * W >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E). The company aims to minimize the total cost of installation and operation over a 10-year period. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n\n| Equipment | Installation Cost per Unit | Annual Maintenance Cost per Unit | Annual Energy Output per Unit |\n|-----------|----------------------------|----------------------------------|--------------------------------|\n| Solar     | $1000                      | $50                              | 100 kWh                        |\n| Wind      | $2000                      | $100                             | 200 kWh                        |\n| Storage   | $3000                      | $150                             | 0 kWh (storage only)           |\n\nThe company has a budget of $100,000 for initial installation. The total annual energy output must be at least 50,000 kWh. Please help the company to minimize the total cost of installation and operation over a 10-year period.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\nTotalCost = 1000 * S + 2000 * W + 3000 * E + 10 * (50 * S + 100 * W + 150 * E)\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $100,000 for initial installation.\nmodel.addCons(1000 * S + 2000 * W + 3000 * E <= 100000)\n## The total annual energy output must be at least 50,000 kWh.\nmodel.addCons(100 * S + 200 * W >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Number of Energy Storage Systems: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1406,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nTo ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\n// T >= 0.5 * V\n\n## Generate Constraint-4:\nThe company must have at least 5 Bikes to handle small, local deliveries.\n// B >= 5",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations. Each Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans. The company must have at least 5 Bikes to handle small, local deliveries. Please help the company to maximize the total weekly profit while considering the purchase costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of Bikes\n\n# Define objective function\n## Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n## Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n## So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000 * T + 7000 * V + 3000 * B - (50000 * T + 30000 * V + 5000 * B))\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\nmodel.addCons(T >= 0.5 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations.\n// Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n// Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n// Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations.\nThe company has a budget of $10,000 for production costs.\nPlease help the company to maximize the total profit after considering both production and storage costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n## Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n## Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (30 - 10 - 5 * A**2) * A + (40 - 15 - 7 * B**2) * B + (50 - 20 - 9 * C**2) * C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost. The farmer has a total of 100 acres available for planting. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $50 - Automation * PA    |\n| B       | $70 - Automation * PB    |\n| C       | $60 - Automation * PC    |\n\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n# No additional constraints are specified in the scenario\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit per unit and the setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| A       | $50             | $1000      |\n| B       | $70             | $1500      |\n| C       | $90             | $2000      |\n\nThe company has a budget of $50,000 for setup costs. Please help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit from product A: Profit_A = 50 * A - 1000\n## Total profit from product B: Profit_B = 70 * B - 1500\n## Total profit from product C: Profit_C = 90 * C - 2000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * A - 1000 + 70 * B - 1500 + 90 * C - 2000)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 608,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. For every $10,000 invested in automation, the production cost per unit decreases by $1 for all products. The selling price per unit of ProductA is $80, ProductB is $100, and ProductC is $120. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\n// Total cost for ProductB: CostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\n// Total cost for ProductC: CostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\n// Total revenue for ProductA: RevenueA = 80 * QuantityA\n// Total revenue for ProductB: RevenueB = 100 * QuantityB\n// Total revenue for ProductC: RevenueC = 120 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs. The production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. For every $10,000 invested in automation, the production cost per unit decreases by $1 for all products. The selling price per unit of ProductA is $80, ProductB is $100, and ProductC is $120. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units across all products. The total investment in automation technology cannot exceed $50,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nCostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\nCostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\nCostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\nRevenueA = 80 * QuantityA\nRevenueB = 100 * QuantityB\nRevenueC = 120 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(AutomationInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation Technology: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C.\n// {\"number of Widget A produced\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost.\n// net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n// net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n// net profit per unit of Widget C: ProfitC = 60 - 25 = 35\n// The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n## Generate Constraint-1:\nThe company has a total budget of $15,000 for production costs.\n// 20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000",
        "question": "A manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C. The profit per unit and the production cost per unit for each widget are given in the following Table.\n\n| Widget | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | $50             | $20                      |\n| B      | $70             | $30                      |\n| C      | $60             | $25                      |\n\nThe company wants to maximize the net profit per unit, which is the profit minus the cost. The company has a total budget of $15,000 for production costs. Please help the company determine the optimal number of each widget to produce to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # number of Widget A produced\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # number of Widget B produced\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0) # number of Widget C produced\n\n# Define objective function\n## net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n## net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n## net profit per unit of Widget C: ProfitC = 60 - 25 = 35\nProfitA = 30\nProfitB = 40\nProfitC = 35\n## The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n# Add constraints\n## The company has a total budget of $15,000 for production costs.\nmodel.addCons(20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(WidgetA))\n    print(\"Number of Widget B produced: \", model.getVal(WidgetB))\n    print(\"Number of Widget C produced: \", model.getVal(WidgetC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\n// Profit per acre of wheat: Profit_W = (200 - 50) * W\n// Profit per acre of corn: Profit_C = (300 - 70) * C\n// Profit per acre of soybeans: Profit_S = (150 - 40) * S\n// Cost of water and fertilizer: Cost_W = 50 * W, Cost_C = 70 * C, Cost_S = 40 * S\n// So, the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 20 acres of each crop.\n// W >= 20; C >= 20; S >= 20\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for water and fertilizer.\n// 50 * W + 70 * C + 40 * S <= 5000",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used). The farmer has a total of 100 acres available for planting. The farmer wants to plant at least 20 acres of each crop. The farmer has a budget of $5000 for water and fertilizer. Please help the farmer to determine the optimal allocation of acres to each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 20 acres of each crop.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 40) * S\nCost_W = 50 * W\nCost_C = 70 * C\nCost_S = 40 * S\n## the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_W + Cost_C + Cost_S) == (Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S))\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget of $5000 for water and fertilizer.\nmodel.addCons(50 * W + 70 * C + 40 * S <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency.\n// {\"number of workers on production unit 1\": \"U1\", \"range\": \"U1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"U2\", \"range\": \"U2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"U3\", \"range\": \"U3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production unit has a different efficiency in producing the components. \nOn production unit 1, each worker can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. \nOn production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. \nOn production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour.\nThe company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. Determine the minimum total production time to meet the daily demand.\n// The production time for component A: T1 = 500 / (10 * U1 + 12 * U2 + 14 * U3)\n// The production time for component B: T2 = 750 / (15 * U1 + 18 * U2 + 20 * U3)\n// The production time for component C: T3 = 1000 / (20 * U1 + 22 * U2 + 24 * U3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// U1 + U2 + U3 <= 60\n\n## Generate Constraint-2:\nEach production unit can be staffed by up to 25 workers at a time.\n// U1 <= 25; U2 <= 25; U3 <= 25",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency. The efficiency of each worker on each production unit is given in the following Table.\n\n| Production Unit | Component A | Component B | Component C |\n|-----------------|-------------|-------------|-------------|\n| 1               | 10 units/hr | 15 units/hr | 20 units/hr |\n| 2               | 12 units/hr | 18 units/hr | 22 units/hr |\n| 3               | 14 units/hr | 20 units/hr | 24 units/hr |\n\nThe company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. There are a total of 60 workers available, and each production unit can be staffed by up to 25 workers at a time. \n\nPlease help the company determine the minimum total production time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nU1 = model.addVar(vtype=\"INTEGER\", name=\"U1\", lb=0, ub=25) # number of workers on production unit 1\nU2 = model.addVar(vtype=\"INTEGER\", name=\"U2\", lb=0, ub=25) # number of workers on production unit 2\nU3 = model.addVar(vtype=\"INTEGER\", name=\"U3\", lb=0, ub=25) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 500 / (10 * U1 + 12 * U2 + 14 * U3)\n## The production time for component B: T2 = 750 / (15 * U1 + 18 * U2 + 20 * U3)\n## The production time for component C: T3 = 1000 / (20 * U1 + 22 * U2 + 24 * U3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * U1 + 12 * U2 + 14 * U3) == 500)\nmodel.addCons(T2 * (15 * U1 + 18 * U2 + 20 * U3) == 750)\nmodel.addCons(T3 * (20 * U1 + 22 * U2 + 24 * U3) == 1000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(U1 + U2 + U3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(U1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(U2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(U3))\n    print(\"Minimum Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to allocate land for three different crops: A, B, and C. The farm needs to determine the area of land to allocate to each crop to optimize its profit and resource usage.\n// {\"area of land for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area of land for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area of land for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $500, for crop B is $700, and for crop C is $900. The water usage per hectare for crop A is 2 units, for crop B is 3 units, and for crop C is 4 units. The farm aims to maximize the profit per unit of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 900 * C\n// Water usage for crop A: Water_A = 2 * A\n// Water usage for crop B: Water_B = 3 * B\n// Water usage for crop C: Water_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe total available land for all crops is 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget constraint that limits the total area of crop C to at most half the area of crop A.\n// C <= 0.5 * A\n\n## Generate Constraint-3:\nThe farm must allocate at least 20 hectares to crop B.\n// B >= 20\n\n## Generate Constraint-4:\nThe total water usage must not exceed 300 units.\n// 2 * A + 3 * B + 4 * C <= 300",
        "question": "A farm is planning to allocate land for three different crops: A, B, and C. The farm needs to determine the area of land to allocate to each crop to optimize its profit and resource usage. The profit per hectare for crop A is $500, for crop B is $700, and for crop C is $900. The water usage per hectare for crop A is 2 units, for crop B is 3 units, and for crop C is 4 units. The farm aims to maximize the profit per unit of water used (which is defined as the sum of the profits divided by the sum of the water usage). The total available land for all crops is 100 hectares. The farm has a budget constraint that limits the total area of crop C to at most half the area of crop A. The farm must allocate at least 20 hectares to crop B. The total water usage must not exceed 300 units. Please help the farm to determine the optimal allocation of land to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area of land for crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=20) # area of land for crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for all crops is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n## The farm has a budget constraint that limits the total area of crop C to at most half the area of crop A.\nmodel.addCons(C <= 0.5 * A)\n## The farm must allocate at least 20 hectares to crop B.\nmodel.addCons(B >= 20)\n## The total water usage must not exceed 300 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for crop A: \", model.getVal(A))\n    print(\"Area of land for crop B: \", model.getVal(B))\n    print(\"Area of land for crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands.\n// The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n// The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n// The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production unit can be staffed by up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit. The productivity of each worker in each production unit is given in the following Table.\n\n| Production Unit | Component A | Component B | Component C |\n|-----------------|-------------|-------------|-------------|\n| 1               | 10 units/hr | 15 units/hr | 20 units/hr |\n| 2               | 12 units/hr | 18 units/hr | 22 units/hr |\n| 3               | 14 units/hr | 20 units/hr | 24 units/hr |\n\nThe company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The company has a total of 50 workers available. Each production unit can be staffed by up to 20 workers. The objective is to minimize the total production time to meet these demands. Please help the manager determine the optimal allocation of workers to each production unit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=20) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0, ub=20) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0, ub=20) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n## The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n## The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * W1 + 12 * W2 + 14 * W3) == 1000)\nmodel.addCons(T2 * (15 * W1 + 18 * W2 + 20 * W3) == 1500)\nmodel.addCons(T3 * (20 * W1 + 22 * W2 + 24 * W3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(W3))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product varies with the quantity produced due to economies of scale and market saturation. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize P_Total = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe production of product B is limited to a maximum of 40 units per day due to raw material constraints.\n// B <= 40",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\n\nThe company has a total production capacity of 100 units per day. The market demand for product A is at least 20 units per day, and the production of product B is limited to a maximum of 40 units per day due to raw material constraints.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=40) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from product A: P_A = 100A - 0.1A^2\n## Profit from product B: P_B = 150B - 0.2B^2\n## Profit from product C: P_C = 200C - 0.3C^2\nP_A = 100 * A - 0.1 * A**2\nP_B = 150 * B - 0.2 * B**2\nP_C = 200 * C - 0.3 * C**2\n## the objective function is: Maximize P_Total = P_A + P_B + P_C\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n## The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 716,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products.\n// Production_Cost_A = (10 - 0.05 * Automation) * A\n// Production_Cost_B = (15 - 0.05 * Automation) * B\n// Production_Cost_C = (20 - 0.05 * Automation) * C\n// Revenue_A = 20 * A\n// Revenue_B = 30 * B\n// Revenue_C = 40 * C\n// Total_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n// So, the objective function is: Maximize Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 100 units and at most 300 units.\n// A >= 100; A <= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 50 units and at most 200 units.\n// B >= 50; B <= 200\n\n## Generate Constraint-4:\nThe market demand for Product C is at least 20 units and at most 150 units.\n// C >= 20; C <= 150\n\n## Generate Constraint-5:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| A       | $10 - $0.05 * Automation | $20                    |\n| B       | $15 - $0.05 * Automation | $30                    |\n| C       | $20 - $0.05 * Automation | $40                    |\n\nThe company has a total production capacity of 1000 units. The market demand for Product A is at least 100 units and at most 300 units. The market demand for Product B is at least 50 units and at most 200 units. The market demand for Product C is at least 20 units and at most 150 units. The investment in automation cannot exceed $50,000.\n\nPlease help the company to determine the optimal production quantities of each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100, ub=300)  # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=200)   # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20, ub=150)   # quantity of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProduction_Cost_A = (10 - 0.05 * Automation) * A\nProduction_Cost_B = (15 - 0.05 * Automation) * B\nProduction_Cost_C = (20 - 0.05 * Automation) * C\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1369,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the cost of raw materials decreases as production increases. For each product, if production exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The company aims to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\n// Cost_A = max(8 - 0.02 * (A - 100), 8) * A\n// Cost_B = max(12 - 0.02 * (B - 100), 12) * B\n// Cost_C = max(16 - 0.02 * (C - 100), 16) * C\n// Profit_A = (10 - Cost_A) * A\n// Profit_B = (15 - Cost_B) * B\n// Profit_C = (20 - Cost_C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg.\n// 5 * A + 7 * B + 9 * C <= 5000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the cost of raw materials decreases as production increases. For each product, if production exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The company aims to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg. The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(8 - 0.02 * (A - 100), 8) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 8 * A1 * A_b1 + (8 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(12 - 0.02 * (B - 100), 12) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 12 * B1 * B_b1 + (12 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(16 - 0.02 * (C - 100), 16) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 16 * C1 * C_b1 + (16 - 0.02 * (C2 - 100)) * C2 * C_b2\n## calculate profits\nProfit_A = (10 - Cost_A) * A\nProfit_B = (15 - Cost_B) * B\nProfit_C = (20 - Cost_C) * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles.\n// Fuel_Cost_Truck = 100 * sqrt(Truck)\n// Fuel_Cost_Van = 70 * sqrt(Van)\n// Fuel_Cost_Bike = 20 * sqrt(Bike)\n// So, the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle.\n// 500 * Truck + 300 * Van + 100 * Bike <= 10000",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and maintenance costs. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles. The fuel and maintenance costs for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Cost per Mile | Maintenance Cost per Vehicle |\n|---------|--------------------|-------------------------------|\n| Truck   | $100               | $500                          |\n| Van     | $70                | $300                          |\n| Bike    | $20                | $100                          |\n\nThe company has a budget of $10,000 for vehicle maintenance. Please help the company determine the optimal number of Trucks, Vans, and Bikes to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=0)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## convert the square root to a variable\nsqrt_Truck = model.addVar(name=\"sqrt_Truck\")\nsqrt_Van = model.addVar(name=\"sqrt_Van\")\nsqrt_Bike = model.addVar(name=\"sqrt_Bike\")\nmodel.addCons(sqrt_Truck * sqrt_Truck == Truck)\nmodel.addCons(sqrt_Van * sqrt_Van == Van)\nmodel.addCons(sqrt_Bike * sqrt_Bike == Bike)\nFuel_Cost_Truck = 100 * sqrt_Truck\nFuel_Cost_Van = 70 * sqrt_Van\nFuel_Cost_Bike = 20 * sqrt_Bike\n## the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\nmodel.addCons(obj == Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(500 * Truck + 300 * Van + 100 * Bike <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand.\n// Production cost of product 1: C1 = 50 - 0.002 * Automation * P1\n// Production cost of product 2: C2 = 70 - 0.002 * Automation * P2\n// Production cost of product 3: C3 = 90 - 0.002 * Automation * P3\n// Total production cost: Cost = C1 + C2 + C3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3.\n// P1 >= 100; P2 >= 150; P3 >= 200\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 500 units per product type.\n// P1 <= 500; P2 <= 500; P3 <= 500\n\n## Generate Constraint-4:\nThe company has a budget constraint on the total production cost, which should not exceed $100,000.\n// Cost <= 100000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| 1       | $50                      |\n| 2       | $70                      |\n| 3       | $90                      |\n\nThe company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3. The total investment in automation cannot exceed $50,000. The total production capacity is limited to 500 units per product type. The company has a budget constraint on the total production cost, which should not exceed $100,000.\n\nPlease help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=100, ub=500) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=150, ub=500) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=200, ub=500) # production quantity of product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nC1 = 50 - 0.002 * Automation * P1\nC2 = 70 - 0.002 * Automation * P2\nC3 = 90 - 0.002 * Automation * P3\nCost = C1 + C2 + C3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(P1 >= 100)\nmodel.addCons(P2 >= 150)\nmodel.addCons(P3 >= 200)\nmodel.addCons(Automation <= 50000)\nmodel.addCons(P1 <= 500)\nmodel.addCons(P2 <= 500)\nmodel.addCons(P3 <= 500)\nmodel.addCons(Cost <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $1000 for material costs.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\nPlease help the company determine the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200\n\n## Generate Constraint-2:\nThe level of automation cannot exceed $5000.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe total production quantity of all products must not exceed 500 units.\n// PA + PB + PC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $50                      |\n| B       | $70                      |\n| C       | $60                      |\n\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. The level of automation cannot exceed $5000. The total production quantity of all products must not exceed 500 units.\n\nPlease help the company to determine the optimal production quantities of products A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(PA >= 100)\nmodel.addCons(PB >= 150)\nmodel.addCons(PC >= 200)\nmodel.addCons(Automation <= 5000)\nmodel.addCons(PA + PB + PC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\n// {\"area of G1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of G2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of G3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The farm aims to maximize the net profit (yield * price per kg - energy cost). The price per kg of the crop is $2.\n// Profit_G1 = 10 * A1 * 2 - 5 * A1\n// Profit_G2 = 15 * A2 * 2 - 7 * A2\n// Profit_G3 = 20 * A3 * 2 - 9 * A3\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\n\n## Generate Constraint-1:\nThe total area available for all greenhouses is 1000 square meters.\n// A1 + A2 + A3 <= 1000\n\n## Generate Constraint-2:\nThe total energy budget for the farm is $8000.\n// 5 * A1 + 7 * A2 + 9 * A3 <= 8000\n\n## Generate Constraint-3:\nThe farm has a minimum yield requirement of 12000 kg.\n// 10 * A1 + 15 * A2 + 20 * A3 >= 12000\n\n## Generate Constraint-4:\nThe area allocated to G1 cannot exceed 300 square meters.\n// A1 <= 300",
        "question": "A farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The price per kg of the crop is $2. The farm aims to maximize the net profit (yield * price per kg - energy cost).\nThe total area available for all greenhouses is 1000 square meters. The total energy budget for the farm is $8000. The farm has a minimum yield requirement of 12000 kg. The area allocated to G1 cannot exceed 300 square meters.\nPlease help the farm to maximize the net profit from the greenhouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of G1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of G2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of G3\n\n# Define objective function\nProfit_G1 = 10 * A1 * 2 - 5 * A1\nProfit_G2 = 15 * A2 * 2 - 7 * A2\nProfit_G3 = 20 * A3 * 2 - 9 * A3\n# So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_G1 + Profit_G2 + Profit_G3)\n\n# Add constraints\n# The total area available for all greenhouses is 1000 square meters.\nmodel.addCons(A1 + A2 + A3 <= 1000)\n# The total energy budget for the farm is $8000.\nmodel.addCons(5 * A1 + 7 * A2 + 9 * A3 <= 8000)\n# The farm has a minimum yield requirement of 12000 kg.\nmodel.addCons(10 * A1 + 15 * A2 + 20 * A3 >= 12000)\n# The area allocated to G1 cannot exceed 300 square meters.\nmodel.addCons(A1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of G1: \", model.getVal(A1))\n    print(\"Area of G2: \", model.getVal(A2))\n    print(\"Area of G3: \", model.getVal(A3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n// Profit of A: Profit_A = 500 * A - 200 * A\n// Profit of B: Profit_B = 700 * B - 300 * B\n// Profit of C: Profit_C = 900 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * A + 1500 * B + 2000 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\nThe farm has a total of 100 acres available for cultivation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nWaterUsage = 1000 * A + 1500 * B + 2000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets.\n// {\"hours for machine A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"hours for machine B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"hours for machine C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget.\n// The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\n// The production constraint for widget A: 5 * MA >= 100\n// The production constraint for widget B: 10 * MB >= 100\n// The production constraint for widget C: 15 * MC >= 100\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 20 hours per day.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nMachine A can operate for a maximum of 8 hours per day.\n// MA <= 8\n\n## Generate Constraint-3:\nMachine B can operate for a maximum of 10 hours per day.\n// MB <= 10",
        "question": "A manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Units Produced per Hour | Cost per Hour |\n|---------|-------------------------|---------------|\n| A       | 5 units of widget A     | $10           |\n| B       | 10 units of widget B    | $15           |\n| C       | 15 units of widget C    | $20           |\n\nThe goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget. The total operating hours for all machines must not exceed 20 hours per day. Machine A can operate for a maximum of 8 hours per day, and Machine B can operate for a maximum of 10 hours per day.\n\nPlease help the plant manager to determine the optimal number of hours to operate each machine to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # hours for machine A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # hours for machine B\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # hours for machine C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\nmodel.addCons(obj == 10 * MA + 15 * MB + 20 * MC)\n\n# Add constraints\n## The production constraint for widget A: 5 * MA >= 100\nmodel.addCons(5 * MA >= 100)\n## The production constraint for widget B: 10 * MB >= 100\nmodel.addCons(10 * MB >= 100)\n## The production constraint for widget C: 15 * MC >= 100\nmodel.addCons(15 * MC >= 100)\n## The total operating hours for all machines must not exceed 20 hours per day.\nmodel.addCons(MA + MB + MC <= 20)\n## Machine A can operate for a maximum of 8 hours per day.\nmodel.addCons(MA <= 8)\n## Machine B can operate for a maximum of 10 hours per day.\nmodel.addCons(MB <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Machine A: \", model.getVal(MA))\n    print(\"Hours for Machine B: \", model.getVal(MB))\n    print(\"Hours for Machine C: \", model.getVal(MC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500,000\n\n## Generate Constraint-3:\nThe farm has a budget of $20,000 for fertilizer costs.\n// 200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. For CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. For CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. The farm has a total area of 100 hectares available for cultivation. The farm has a limited water supply of 500,000 liters. The farm has a budget of $20,000 for fertilizer costs. Please help the farm to maximize the net profit per liter of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=0) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=0) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=0) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500000)\n## The farm has a budget of $20,000 for fertilizer costs.\nmodel.addCons(200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Phone is $100, for Tablet is $200, and for Laptop is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\n// Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. The Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g of this metal. The total available supply of this rare metal is 2000 g.\n// 5 * Phone + 8 * Tablet + 10 * Laptop <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units.\n// Phone <= 500; Tablet <= 400; Laptop <= 300\n\n## Generate Constraint-3:\nThe company has a production capacity of 1000 units in terms of the total number of devices it can produce.\n// Phone + Tablet + Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand. The profit per unit for each device and the additional profit due to economies of scale are given in the following Table.\n\n| Device | Profit per Unit (up to 100 units) | Additional Profit per Unit (over 100 units) |\n|--------|-----------------------------------|-------------------------------------------|\n| Phone  | $100                              | $0.5                                      |\n| Tablet | $200                              | $0.5                                      |\n| Laptop | $300                              | $0.5                                      |\n\nThe production of each device requires a specific amount of a rare metal: Phone requires 5 g, Tablet requires 8 g, and Laptop requires 10 g. The total available supply of this rare metal is 2000 g. The market has a demand limit for each device: Phone is 500 units, Tablet is 400 units, and Laptop is 300 units. The company also has a production capacity of 1000 units in terms of the total number of devices it can produce.\n\nPlease help the company to maximize the total profit from selling these devices, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0, ub=500) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=400) # quantity of Tablet\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0, ub=300) # quantity of Laptop\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=500)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=400)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 200 * Tablet1 * Tablet_b1 + (200 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 300 * Laptop1 * Laptop_b1 + (300 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\nmodel.addCons(5 * Phone + 8 * Tablet + 10 * Laptop <= 2000)\nmodel.addCons(Phone + Tablet + Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n// Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n// Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n// Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\n\n## Generate Constraint-1:\nThe total area of land available for farming is 100 hectares.\n// W + C + B <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop. The farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit. The total area of land available for farming is 100 hectares. Please help the farmer determine the optimal allocation of land to each crop to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit and cost calculations\nProfit_wheat = 1000 * W - 50 * W**2 - 30 * W**1.5\nProfit_corn = 1200 * C - 60 * C**2 - 40 * C**1.5\nProfit_barley = 800 * B - 40 * B**2 - 20 * B**1.5\n\n## the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_barley)\n\n# Add constraints\n## The total area of land available for farming is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Barley: \", model.getVal(B))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 634,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time.\n// Profit_E1 = 30 * E1 - 10 * E1\n// Profit_E2 = 40 * E2 - 15 * E2\n// Profit_E3 = 50 * E3 - 20 * E3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (E1 + 2 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// E1 + 2 * E2 + 3 * E3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for production costs.\n// 10 * E1 + 15 * E2 + 20 * E3 <= 3000",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand. The profit per unit, production cost per unit, and production time per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|--------------------------|\n| E1        | $30             | $10                      | 1 hour                   |\n| E2        | $40             | $15                      | 2 hours                  |\n| E3        | $50             | $20                      | 3 hours                  |\n\nThe company has a total production capacity of 200 hours. The company has a budget of $3000 for production costs. Please help the company to maximize the profit per hour of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * E1\nProfit_E2 = (40 - 15) * E2\nProfit_E3 = (50 - 20) * E3\nProductionTime = E1 + 2 * E2 + 3 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 200)\n## The company has a budget of $3000 for production costs.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1007,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component.\n// The cost function is: Cost = 10 * PA + 15 * PB + 20 * PC\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units.\n// PA >= 500 / 50\n\n## Generate Constraint-2:\nThe demand for component B is at least 750 units, and each hour of production line B produces 60 units.\n// PB >= 750 / 60\n\n## Generate Constraint-3:\nThe demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\n// PC >= 1000 / 75\n\n## Generate Constraint-4:\nThe total operating hours for all production lines cannot exceed 100 hours.\n// PA + PB + PC <= 100\n\n## Generate Constraint-5:\nThe company has a policy to operate each production line for at least 5 hours per day.\n// PA >= 5; PB >= 5; PC >= 5",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs. The cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component.\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units. The demand for component B is at least 750 units, and each hour of production line B produces 60 units. The demand for component C is at least 1000 units, and each hour of production line C produces 75 units. The total operating hours for all production lines cannot exceed 100 hours. The company has a policy to operate each production line for at least 5 hours per day.\nPlease help the company determine the optimal number of hours each production line should operate to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=5) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=5) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=5) # hours for production line C\n\n# Define objective function\nCost = 10 * PA + 15 * PB + 20 * PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The demand for component A is at least 500 units, and each hour of production line A produces 50 units.\nmodel.addCons(PA >= 500 / 50)\n## The demand for component B is at least 750 units, and each hour of production line B produces 60 units.\nmodel.addCons(PB >= 750 / 60)\n## The demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\nmodel.addCons(PC >= 1000 / 75)\n## The total operating hours for all production lines cannot exceed 100 hours.\nmodel.addCons(PA + PB + PC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company needs to determine the number of machines to allocate to each type of component production to optimize efficiency.\n// {\"number of machines for resistors\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of machines for capacitors\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of component. \nA resistor machine produces 100 units per hour, a capacitor machine produces 120 units per hour, and an inductor machine produces 80 units per hour. \nThe company needs to produce at least 1000 units of resistors, 1500 units of capacitors, and 800 units of inductors daily. The machines can only be used for one type of component at a time. Determine the minimum number of hours needed to meet the daily demand.\n// The production time for resistors: T_R = 1000 / (100 * R)\n// The production time for capacitors: T_C = 1500 / (120 * C)\n// The production time for inductors: T_L = 800 / (80 * L)\n// So, the objective function is: Minimize max(T_R, T_C, T_L)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available.\n// R + C + L <= 20",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company needs to determine the number of machines to allocate to each type of component production to optimize efficiency. Each machine has a different efficiency in producing each type of component: a resistor machine produces 100 units per hour, a capacitor machine produces 120 units per hour, and an inductor machine produces 80 units per hour. The company needs to produce at least 1000 units of resistors, 1500 units of capacitors, and 800 units of inductors daily. The machines can only be used for one type of component at a time. There are a total of 20 machines available.\n\nPlease help the company determine the minimum number of hours needed to meet the daily demand by optimizing the allocation of machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of machines for resistors\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of machines for capacitors\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of machines for inductors\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_R = 1000 / (100 * R)\nT_C = 1500 / (120 * C)\nT_L = 800 / (80 * L)\n## the objective function is: Minimize max(T_R, T_C, T_L)\n## convert the division to multiplication\nmodel.addCons(obj >= T_R)\nmodel.addCons(obj >= T_C)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 20 machines available.\nmodel.addCons(R + C + L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Resistors: \", model.getVal(R))\n    print(\"Number of Machines for Capacitors: \", model.getVal(C))\n    print(\"Number of Machines for Inductors: \", model.getVal(L))\n    print(\"Minimum Hours Needed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit. However, due to the different growth rates and harvesting times, the efficiency of land use varies. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\n// Profit_W = 100 * W\n// Profit_C = 150 * C\n// Profit_B = 120 * B\n// Land_Efficiency_W = 0.9 * W\n// Land_Efficiency_C = 1.2 * C\n// Land_Efficiency_B = 1.1 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + B <= 100",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop. The profit per acre and the land efficiency for each crop are given in the following Table.\n\n| Crop   | Profit per Acre | Land Efficiency |\n|--------|-----------------|-----------------|\n| Wheat  | $100            | 0.9             |\n| Corn   | $150            | 1.2             |\n| Barley | $120            | 1.1             |\n\nThe farmer has a total of 100 acres of land available. He wants to maximize his total profit per unit of land efficiency. Please help the farmer determine the optimal number of acres to dedicate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 100 * W\nProfit_C = 150 * C\nProfit_B = 120 * B\nLand_Efficiency_W = 0.9 * W\nLand_Efficiency_C = 1.2 * C\nLand_Efficiency_B = 1.1 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B) == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Land Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 673,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rates of each product and the amount of money to invest in a new production line that will increase the efficiency of all products.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in new production line\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The initial production cost per unit for product 1 is $100, for product 2 is $150, and for product 3 is $200. The selling price per unit for product 1 is $150, for product 2 is $225, and for product 3 is $300. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - 100 + 0.0005 * Investment) * P1\n// Total profit for product 2: Profit2 = (225 - 150 + 0.0005 * Investment) * P2\n// Total profit for product 3: Profit3 = (300 - 200 + 0.0005 * Investment) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total investment in the new production line cannot exceed $500,000.\n// Investment <= 500000\n\n## Generate Constraint-2:\nThe company must produce at least 100 units of each product per day.\n// P1 >= 100; P2 >= 100; P3 >= 100\n\n## Generate Constraint-3:\nThe total production rate of all products must not exceed 500 units per day.\n// P1 + P2 + P3 <= 500\n\n## Generate Constraint-4:\nThe production rate of product 1 must be at least twice the production rate of product 2.\n// P1 >= 2 * P2",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rates of each product and the amount of money to invest in a new production line that will increase the efficiency of all products. The production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| 1       | $100                     | $150                   |\n| 2       | $150                     | $225                   |\n| 3       | $200                     | $300                   |\n\nThe production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The total investment in the new production line cannot exceed $500,000. The company must produce at least 100 units of each product per day. The total production rate of all products must not exceed 500 units per day. The production rate of product 1 must be at least twice the production rate of product 2.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=100) # production rate of product 3\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0) # investment in new production line\n\n# Define objective function\nProfit1 = (150 - 100 + 0.0005 * Investment) * P1\nProfit2 = (225 - 150 + 0.0005 * Investment) * P2\nProfit3 = (300 - 200 + 0.0005 * Investment) * P3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n# The total investment in the new production line cannot exceed $500,000.\nmodel.addCons(Investment <= 500000)\n# The company must produce at least 100 units of each product per day.\nmodel.addCons(P1 >= 100)\nmodel.addCons(P2 >= 100)\nmodel.addCons(P3 >= 100)\n# The total production rate of all products must not exceed 500 units per day.\nmodel.addCons(P1 + P2 + P3 <= 500)\n# The production rate of product 1 must be at least twice the production rate of product 2.\nmodel.addCons(P1 >= 2 * P2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in New Production Line: \", model.getVal(Investment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1163,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The fuel cost is a significant factor in the company's operational costs.\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 15 * B\n// Cargo carried by C: Cargo_C = 20 * C\n// Fuel consumed by A: Fuel_A = 5 * A\n// Fuel consumed by B: Fuel_B = 7 * B\n// Fuel consumed by C: Fuel_C = 9 * C\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle fuel for the month.\n// 5 * A + 7 * B + 9 * C <= 10000",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations. The cargo carrying capacity and fuel consumption per trip for each vehicle are given in the following Table.\n\n| Vehicle | Cargo Capacity | Fuel Consumption |\n|---------|----------------|------------------|\n| A       | 10 tons        | 5 liters         |\n| B       | 15 tons        | 7 liters         |\n| C       | 20 tons        | 9 liters         |\n\nThe company aims to maximize the total cargo carried per liter of fuel consumed, as the fuel cost is a significant factor in the company's operational costs. The company has a budget of $10,000 for vehicle fuel for the month.\n\nPlease help the company to determine the optimal number of each type of vehicle to deploy to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_A = 10 * A\nCargo_B = 15 * B\nCargo_C = 20 * C\nFuel_A = 5 * A\nFuel_B = 7 * B\nFuel_C = 9 * C\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C) == Cargo_A + Cargo_B + Cargo_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle fuel for the month.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of each crop (in tons per acre) is affected by the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n// Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n// Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n// Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation improvements.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe farm wants to ensure at least 20 acres are dedicated to each crop.\n// Wheat >= 20; Corn >= 20; Soybeans >= 20\n\n## Generate Constraint-4:\nThe total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\n// Irrigation >= 10000\n\n## Generate Constraint-5:\nThe farm has a labor constraint that limits the total acres of wheat and corn to 80.\n// Wheat + Corn <= 80",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop. The yield of each crop (in tons per acre) is affected by the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops. The total acres available for planting are 100. The farm has a budget of $50,000 for irrigation improvements. The farm wants to ensure at least 20 acres are dedicated to each crop. The total investment in irrigation should not be less than $10,000 to ensure some basic improvements. The farm has a labor constraint that limits the total acres of wheat and corn to 80. Please help the farm to maximize its total revenue from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to ensure at least 20 acres are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=20)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=20)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=20)  # acres of soybeans\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=10000, ub=50000)  # investment in irrigation\n\n# Define objective function\n## Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n## Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n## Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n## So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nRevenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\nRevenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\nRevenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n## The total acres available for planting are 100.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farm has a budget of $50,000 for irrigation improvements.\nmodel.addCons(Irrigation <= 50000)\n## The total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\nmodel.addCons(Irrigation >= 10000)\n## The farm has a labor constraint that limits the total acres of wheat and corn to 80.\nmodel.addCons(Wheat + Corn <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints.\n// {\"number of machines of type 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine type contributes differently to the profit. Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company wants to maximize the total profit from operating these machines.\n// The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\n// Objective: Maximize P\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available across all types.\n// M1 + M2 + M3 <= 50",
        "question": "A company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints. Each machine type contributes differently to the profit: Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company has a total of 50 machines available across all types. Please help the company to maximize the total profit from operating these machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines of type 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines of type 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines of type 3\n\n# Define objective function\nP = 50 * M1 + 70 * M2 + 60 * M3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines of Type 1: \", model.getVal(M1))\n    print(\"Number of Machines of Type 2: \", model.getVal(M2))\n    print(\"Number of Machines of Type 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 548,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed.\n// Efficiency_A = 10 * A / 5\n// Efficiency_B = 15 * B / 7\n// Efficiency_C = 20 * C / 9\n// So, the objective function is: Maximize (Efficiency_A + Efficiency_B + Efficiency_C)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 500 liters per day.\n// 5 * A + 7 * B + 9 * C <= 500",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed. The company has a total fuel budget of 500 liters per day. Please help the company determine the optimal number of each type of truck to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_A = 10 * A / 5\nEfficiency_B = 15 * B / 7\nEfficiency_C = 20 * C / 9\n## convert the division to multiplication\nmodel.addCons(obj * (5 * A + 7 * B + 9 * C) == 10 * A + 15 * B + 20 * C)\n\n# Add constraints\n## The company has a total fuel budget of 500 liters per day.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 638,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency.\n// {\"hours of operation for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3\n// So, the objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C per week.\n// 10 * P1 + 12 * P2 + 14 * P3 >= 500 (for component A)\n// 15 * P1 + 18 * P2 + 20 * P3 >= 750 (for component B)\n// 20 * P1 + 22 * P2 + 24 * P3 >= 1000 (for component C)",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency. Each production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C. The total operating hours for all production lines must not exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week. The company must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C per week. Please help the company determine the optimal number of hours to operate each production line to meet these requirements.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours of operation for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours of operation for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours of operation for production line 3\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3\nB_total = 15 * P1 + 18 * P2 + 20 * P3\nC_total = 20 * P1 + 22 * P2 + 24 * P3\n# So, the objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n# The company must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C per week.\nmodel.addCons(10 * P1 + 12 * P2 + 14 * P3 >= 500)\nmodel.addCons(15 * P1 + 18 * P2 + 20 * P3 >= 750)\nmodel.addCons(20 * P1 + 22 * P2 + 24 * P3 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line 1: \", model.getVal(P1))\n    print(\"Hours of operation for production line 2: \", model.getVal(P2))\n    print(\"Hours of operation for production line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor C2, the revenue per unit is $120, the production cost per unit is $60, and the storage cost per unit is $15. \nFor C3, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit stored.\n// NetProfit_C1 = (100 - 50 - 10) * C1\n// NetProfit_C2 = (120 - 60 - 15) * C2\n// NetProfit_C3 = (150 - 70 - 20) * C3\n// So, the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / (10 * C1 + 15 * C2 + 20 * C3)\n\n## Generate Constraint-1:\nThe company has a production capacity of 200 units in total.\n// C1 + C2 + C3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 10,000\n\n## Generate Constraint-3:\nThe storage space is limited to 150 units.\n// 10 * C1 + 15 * C2 + 20 * C3 <= 150\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\n// C1 <= 50",
        "question": "A manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit.\nFor C1, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor C2, the revenue per unit is $120, the production cost per unit is $60, and the storage cost per unit is $15. \nFor C3, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit stored.\nThe company has a production capacity of 200 units in total. The company has a budget of $10,000 for production costs. The storage space is limited to 150 units. The market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\nPlease help the company to determine the optimal production quantities of C1, C2, and C3 to maximize the net profit per unit stored.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_C1 = (100 - 50 - 10) * C1\nNetProfit_C2 = (120 - 60 - 15) * C2\nNetProfit_C3 = (150 - 70 - 20) * C3\nStorageCost = 10 * C1 + 15 * C2 + 20 * C3\n## the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == NetProfit_C1 + NetProfit_C2 + NetProfit_C3)\n\n# Add constraints\n## The company has a production capacity of 200 units in total.\nmodel.addCons(C1 + C2 + C3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 10000)\n## The storage space is limited to 150 units.\nmodel.addCons(10 * C1 + 15 * C2 + 20 * C3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Unit Stored: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. \nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. \nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n// Cost per ton-km for A: Cost_A = 200 / (5 * 10 * A)\n// Cost per ton-km for B: Cost_B = 300 / (10 * 15 * B)\n// Cost per ton-km for C: Cost_C = 400 / (15 * 20 * C)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe company needs to transport at least 100 tons of cargo next month.\n// 5 * A + 10 * B + 15 * C >= 100\n\n## Generate Constraint-3:\nThe company has a maximum of 50 vehicles available for deployment.\n// A + B + C <= 50",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|--------------|-----------------------|----------------------------|-----------------------|\n| A            | 10                    | 200                        | 5                     |\n| B            | 15                    | 300                        | 10                    |\n| C            | 20                    | 400                        | 15                    |\n\nThe company has a budget of $10,000 for vehicle maintenance next month. The company needs to transport at least 100 tons of cargo next month. The company has a maximum of 50 vehicles available for deployment. \nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 / (5 * 10 * A)\nCost_B = 300 / (10 * 15 * B)\nCost_C = 400 / (15 * 20 * C)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The company needs to transport at least 100 tons of cargo next month.\nmodel.addCons(5 * A + 10 * B + 15 * C >= 100)\n## The company has a maximum of 50 vehicles available for deployment.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1157,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n// Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n// Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n// Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least half as many trucks as RouteB.\n// TrucksA >= 0.5 * TrucksB",
        "question": "A logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2). The company has a total of 50 trucks available for allocation. Due to contractual agreements, RouteA must have at least half as many trucks as RouteB. Please help the company to maximize the total profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\n## The operational cost increases nonlinearly with the number of trucks on each route\nOperationalCostA = 2000 + 0.1 * TrucksA**2\nOperationalCostB = 3000 + 0.15 * TrucksB**2\nOperationalCostC = 4000 + 0.2 * TrucksC**2\n## Total profit for each route\nProfitA = (5000 - OperationalCostA) * TrucksA\nProfitB = (7000 - OperationalCostB) * TrucksB\nProfitC = (9000 - OperationalCostC) * TrucksC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## Due to contractual agreements, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop.\n// {\"area for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. \nFor C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. \nFor C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140.\nThe farm wants to maximize the net profit per liter of water used (profit per water efficiency).\n// Profit_C1 = 500 * A1 - 100 * A1\n// Profit_C2 = 600 * A2 - 120 * A2\n// Profit_C3 = 700 * A3 - 140 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (1000 * A1 + 1200 * A2 + 1400 * A3)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 acres.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 120,000 liters.\n// 1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000\n\n## Generate Constraint-3:\nThe farm has a budget of $12,000 for fertilizer costs.\n// 100 * A1 + 120 * A2 + 140 * A3 <= 12000",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop. The yield per acre, water consumption per acre, and fertilizer cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Water Consumption per Acre | Fertilizer Cost per Acre |\n|------|----------------|----------------------------|---------------------------|\n| C1   | 500 kg         | 1000 liters                | $100                     |\n| C2   | 600 kg         | 1200 liters                | $120                     |\n| C3   | 700 kg         | 1400 liters                | $140                     |\n\nThe farm has a total area of 100 acres. The farm has a limited water supply of 120,000 liters. The farm has a budget of $12,000 for fertilizer costs. \nPlease help the farm to maximize the net profit per liter of water used (profit per water efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 500 * A1 - 100 * A1\nProfit_C2 = 600 * A2 - 120 * A2\nProfit_C3 = 700 * A3 - 140 * A3\nWaterConsumption = 1000 * A1 + 1200 * A2 + 1400 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total area of 100 acres.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 120,000 liters.\nmodel.addCons(1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000)\n## The farm has a budget of $12,000 for fertilizer costs.\nmodel.addCons(100 * A1 + 120 * A2 + 140 * A3 <= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for C1: \", model.getVal(A1))\n    print(\"Area for C2: \", model.getVal(A2))\n    print(\"Area for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost.\n// The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production.\n// 20A + 0.1A^2 + 30B + 0.15B^2 + 25C + 0.12C^2 <= 10000",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The company has a limited budget of $10,000 for production. Please help the company to maximize the total profit, which is the revenue minus the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\nmodel.addCons(obj == 50*A - 20 - 0.1*A**2 + 70*B - 30 - 0.15*B**2 + 60*C - 25 - 0.12*C**2)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production.\nmodel.addCons(20*A + 0.1*A**2 + 30*B + 0.15*B**2 + 25*C + 0.12*C**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 688,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product varies with the quantity produced due to economies of scale and market saturation. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize P_Total = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit from each product varies with the quantity produced due to economies of scale and market saturation. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\nThe company aims to maximize the total profit from all products. The total production capacity of the company is limited to 100 units per day. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from product A: P_A = 100A - 0.1A^2\n## Profit from product B: P_B = 150B - 0.2B^2\n## Profit from product C: P_C = 200C - 0.3C^2\n## the objective function is: Maximize P_Total = P_A + P_B + P_C\nmodel.addCons(obj == 100*A - 0.1*A**2 + 150*B - 0.2*B**2 + 200*C - 0.3*C**2)\n\n# Add constraints\n## The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 754,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least 20 units to be effective.\n// DosageC >= 20\n\n## Generate Constraint-4:\nThe company has a budget constraint that limits the total dosage cost to $10,000. The cost per unit of dosage for DrugA is $50, for DrugB is $60, and for DrugC is $70.\n// 50 * DosageA + 60 * DosageB + 70 * DosageC <= 10,000",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of each drug is modeled as follows:\n\n| Drug    | Effectiveness Model                          |\n|---------|----------------------------------------------|\n| DrugA   | EffectivenessA = 50 * DosageA - 0.5 * DosageA^2 |\n| DrugB   | EffectivenessB = 60 * DosageB - 0.3 * DosageB^3 |\n| DrugC   | EffectivenessC = 70 * DosageC - 0.2 * DosageC^4 |\n\nThe company wants to maximize the total effectiveness of the drugs. The following constraints must be considered:\n\n1. The total dosage across all drugs must not exceed 150 units to ensure safety.\n2. Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n3. The dosage of DrugC must be at least 20 units to be effective.\n4. The company has a budget constraint that limits the total dosage cost to $10,000. The cost per unit of dosage for DrugA is $50, for DrugB is $60, and for DrugC is $70.\n\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to maximize the total effectiveness under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\n# The total dosage across all drugs must not exceed 150 units to ensure safety.\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\n# Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\nmodel.addCons(DosageA >= 2 * DosageB)\n# The dosage of DrugC must be at least 20 units to be effective.\nmodel.addCons(DosageC >= 20)\n# The company has a budget constraint that limits the total dosage cost to $10,000.\nmodel.addCons(50 * DosageA + 60 * DosageB + 70 * DosageC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost is $0.1 per unit per day. For Device B, the selling price is $150, the production cost is $90, and the storage cost is $0.15 per unit per day. For Device C, the selling price is $200, the production cost is $120, and the storage cost is $0.2 per unit per day. The storage costs are accumulated daily and affect the net profit. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs over a period of 30 days.\n// Revenue_A = 100 * A\n// Revenue_B = 150 * B\n// Revenue_C = 200 * C\n// Production_Cost_A = 60 * A\n// Production_Cost_B = 90 * B\n// Production_Cost_C = 120 * C\n// Storage_Cost_A = 0.1 * A * 30\n// Storage_Cost_B = 0.15 * B * 30\n// Storage_Cost_C = 0.2 * C * 30\n// So, the objective function is: Maximize (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 200 units.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe market demand for Device A is at least 50 units, for Device B is at least 30 units, and for Device C is at least 20 units.\n// A >= 50; B >= 30; C >= 20",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their profit margin. For Device A, the selling price is $100, the production cost is $60, and the storage cost is $0.1 per unit per day. For Device B, the selling price is $150, the production cost is $90, and the storage cost is $0.15 per unit per day. For Device C, the selling price is $200, the production cost is $120, and the storage cost is $0.2 per unit per day. The storage costs are accumulated daily and affect the net profit. The company aims to maximize the net profit, which is the total revenue minus the total production and storage costs over a period of 30 days. The company has a budget of $10,000 for production costs. The company has a storage capacity limit of 200 units. The market demand for Device A is at least 50 units, for Device B is at least 30 units, and for Device C is at least 20 units. Please help the company to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # quantity of device C\n\n# Define objective function\nRevenue_A = 100 * A\nRevenue_B = 150 * B\nRevenue_C = 200 * C\nProduction_Cost_A = 60 * A\nProduction_Cost_B = 90 * B\nProduction_Cost_C = 120 * C\nStorage_Cost_A = 0.1 * A * 30\nStorage_Cost_B = 0.15 * B * 30\nStorage_Cost_C = 0.2 * C * 30\nNet_Profit = (Revenue_A - Production_Cost_A - Storage_Cost_A) + (Revenue_B - Production_Cost_B - Storage_Cost_B) + (Revenue_C - Production_Cost_C - Storage_Cost_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit)\n\n# Add constraints\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000) # budget constraint\nmodel.addCons(A + B + C <= 200) # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The cost per acre for crop A is $100, for crop B is $150, and for crop C is $200. The farmer aims to maximize the total yield while considering the cost-effectiveness of each crop. The objective is to maximize the total yield minus a penalty term that increases with the total cost.\n// Yield of crop A: Yield_A = 5 * A\n// Yield of crop B: Yield_B = 7 * B\n// Yield of crop C: Yield_C = 9 * C\n// Total cost: Cost = 100 * A + 150 * B + 200 * C\n// Penalty term: Penalty = 0.01 * Cost^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - Penalty\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $15,000 for cultivation costs.\n// 100 * A + 150 * B + 200 * C <= 15000\n\n## Generate Constraint-3:\nAt least 20 acres must be allocated to crop A to maintain a certain market presence.\n// A >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints. The yield per acre and the cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Cost per Acre |\n|------|----------------|---------------|\n| A    | 5 tons         | $100          |\n| B    | 7 tons         | $150          |\n| C    | 9 tons         | $200          |\n\nThe farm has a total of 100 acres available for cultivation. The farmer has a budget of $15,000 for cultivation costs. At least 20 acres must be allocated to crop A to maintain a certain market presence. The farmer aims to maximize the total yield while considering the cost-effectiveness of each crop, by maximizing the total yield minus a penalty term that increases with the total cost.\n\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this objective.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nCost = 100 * A + 150 * B + 200 * C\nPenalty = 0.01 * Cost**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Penalty)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(100 * A + 150 * B + 200 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The total number of workers available is 50. The manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\nPlease help the manufacturer to maximize the profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production Line: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production Line: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production Line: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery that can increase production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"integer\"}\n// {\"investment in new machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency increases by 5 units per hour for every $10,000 invested in new machinery. The base production rate is 10 units per hour without overtime. Overtime increases production by 5 units per hour. The company aims to maximize the total production output.\n// Total production output: Output = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a maximum of 1000 overtime hours available for the quarter.\n// Overtime <= 1000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery that can increase production efficiency. The base production rate is 10 units per hour without overtime, and overtime increases production by 5 units per hour. Additionally, every $10,000 invested in new machinery increases production efficiency by 5 units per hour. The company aims to maximize the total production output.\n\n| Factor                | Effect on Production |\n|-----------------------|----------------------|\n| Overtime (hours)      | +5 units per hour    |\n| Investment in Machinery ($10,000) | +5 units per hour |\n\nThe company has a maximum of 1000 overtime hours available for the quarter.\n\nPlease help the company determine the optimal number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0) # number of units to produce\nOvertime = model.addVar(vtype=\"INTEGER\", name=\"Overtime\", lb=0) # amount of overtime hours\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in new machinery\n\n# Define objective function\n## Total production output: Output = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\nOutput = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output)\n\n# Add constraints\n## The company has a maximum of 1000 overtime hours available for the quarter.\nmodel.addCons(Overtime <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Amount of Overtime Hours: \", model.getVal(Overtime))\n    print(\"Investment in New Machinery: \", model.getVal(Machinery))\n    print(\"Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the smartphone production line can produce 20 units per hour, with a defect rate of 2%. Each worker on the tablet production line can produce 15 units per hour, with a defect rate of 1.5%. Each worker on the laptop production line can produce 10 units per hour, with a defect rate of 1%. The manufacturer wants to maximize the total production volume while minimizing the defect rate. The objective is to maximize the production volume per unit of defect risk.\n// Total production volume: Volume = 20 * S + 15 * T + 10 * L\n// Total defect risk: Risk = 2% * 20 * S + 1.5% * 15 * T + 1% * 10 * L\n// So, the objective function is: Maximize (Volume / Risk)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available for all production lines.\n// S + T + L <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. Each worker on the smartphone production line can produce 20 units per hour, with a defect rate of 2%. Each worker on the tablet production line can produce 15 units per hour, with a defect rate of 1.5%. Each worker on the laptop production line can produce 10 units per hour, with a defect rate of 1%. The manufacturer wants to maximize the total production volume while minimizing the defect rate. The objective is to maximize the production volume per unit of defect risk. The manufacturer has a total of 50 workers available for all production lines.\nPlease help the manufacturer determine the optimal allocation of workers to each production line to achieve the maximum production volume per unit of defect risk.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nVolume = 20 * S + 15 * T + 10 * L\nRisk = 0.02 * 20 * S + 0.015 * 15 * T + 0.01 * 10 * L\n## the objective function is: Maximize (Volume / Risk)\n## convert the division to multiplication\nmodel.addCons(obj * Risk == Volume)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available for all production lines.\nmodel.addCons(S + T + L <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Maximized Production Volume per Unit of Defect Risk: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|---------|-------------------------|----------------------|---------------------|\n| CropA   | $500                    | 2000 gallons         | $100                |\n| CropB   | $700                    | 3000 gallons         | $150                |\n| CropC   | $900                    | 4000 gallons         | $200                |\n\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. The farm has a budget of $15,000 for labor costs for the season. \nPlease help the farm to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=0) # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=0) # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season.\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Beans\": \"BeansAcres\", \"range\": \"BeansAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor Beans, the expected profit per acre is $300, the water usage per acre is 1500 gallons, and the labor cost per acre is $75. \nFor Wheat, the expected profit per acre is $400, the water usage per acre is 1800 gallons, and the labor cost per acre is $90.\nThe farmer aims to maximize the net profit per gallon of water used.\n// Net profit for Corn: Profit_Corn = (500 - 100) * CornAcres\n// Net profit for Beans: Profit_Beans = (300 - 75) * BeansAcres\n// Net profit for Wheat: Profit_Wheat = (400 - 90) * WheatAcres\n// So, the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / (2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// CornAcres + BeansAcres + WheatAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\n// BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres)\n\n## Generate Constraint-3:\nThe farmer has a water supply limit of 150,000 gallons for the season.\n// 2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres <= 150,000\n\n## Generate Constraint-4:\nThe farmer wants to ensure that each crop gets at least 5 acres to maintain crop rotation benefits.\n// CornAcres >= 5; BeansAcres >= 5; WheatAcres >= 5",
        "question": "A farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|---------|-------------------------|----------------------|---------------------|\n| Corn    | $500                    | 2000 gallons         | $100                |\n| Beans   | $300                    | 1500 gallons         | $75                 |\n| Wheat   | $400                    | 1800 gallons         | $90                 |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans. The farmer has a water supply limit of 150,000 gallons for the season. The farmer wants to ensure that each crop gets at least 5 acres to maintain crop rotation benefits. \nPlease help the farmer to maximize the net profit per gallon of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=5)  # number of acres for Corn\nBeansAcres = model.addVar(vtype=\"INTEGER\", name=\"BeansAcres\", lb=5)  # number of acres for Beans\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=5)  # number of acres for Wheat\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (500 - 100) * CornAcres\nProfit_Beans = (300 - 75) * BeansAcres\nProfit_Wheat = (400 - 90) * WheatAcres\nWaterUsage = 2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres\n## the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Beans + Profit_Wheat)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(CornAcres + BeansAcres + WheatAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\nmodel.addCons(BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres))\n## The farmer has a water supply limit of 150,000 gallons for the season.\nmodel.addCons(2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Beans: \", model.getVal(BeansAcres))\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $20 per unit.\nThe profit per unit of product B is $30, with a simpler production process costing $10 per unit.\nThe profit per unit of product C is $40, with an intermediate production process costing $15 per unit.\nThe company wants to maximize the total net profit, which is the difference between the total profit and the total production cost.\n// Total profit: Profit = 50 * A + 30 * B + 40 * C\n// Total production cost: Cost = 20 * A + 10 * B + 15 * C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours.\n// 2 * A + 1 * B + 1.5 * C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and the production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $30             | $10                      |\n| C       | $40             | $15                      |\n\nThe company wants to maximize the total net profit, which is the difference between the total profit and the total production cost. The company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 30 * B + 40 * C\nCost = 20 * A + 10 * B + 15 * C\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 1 * B + 1.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products.\n// Production_Cost_A = (10 - 0.05 * Automation) * A\n// Production_Cost_B = (15 - 0.05 * Automation) * B\n// Production_Cost_C = (20 - 0.05 * Automation) * C\n// Revenue_A = 20 * A\n// Revenue_B = 30 * B\n// Revenue_C = 40 * C\n// Total_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n// So, the objective function is: Maximize Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 100 units and at most 300 units.\n// A >= 100; A <= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 50 units and at most 200 units.\n// B >= 50; B <= 200\n\n## Generate Constraint-4:\nThe market demand for Product C is at least 20 units and at most 150 units.\n// C >= 20; C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product (A, B, and C) and the level of automation to implement in the production process. The cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units. The market demand for Product A is at least 100 units and at most 300 units. The market demand for Product B is at least 50 units and at most 200 units. The market demand for Product C is at least 20 units and at most 150 units. Please help the company to determine the optimal production quantities and level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=200) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20, ub=150) # quantity of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProduction_Cost_A = (10 - 0.05 * Automation) * A\nProduction_Cost_B = (15 - 0.05 * Automation) * B\nProduction_Cost_C = (20 - 0.05 * Automation) * C\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The production capacity allows for a maximum of 1000 units of any single device type to be produced.\n\nPlease help the company to maximize its total profit, given the following profit per unit for each device:\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 707,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the distribution of products among the warehouses to minimize transportation costs and meet customer demand.\n// {\"number of products in warehouse 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of products in warehouse 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of products in warehouse 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to customers is based on the number of products stored. The cost function is nonlinear and varies with the square of the number of products. Specifically, the cost from warehouse 1 is 0.05 * P1^2, from warehouse 2 is 0.03 * P2^2, and from warehouse 3 is 0.04 * P3^2. The company aims to minimize the total transportation cost.\n// The objective function is: Minimize (0.05 * P1^2 + 0.03 * P2^2 + 0.04 * P3^2)\n\n## Generate Constraint-1:\nThe total number of products that can be stored across all warehouses is limited to 1000.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nEach warehouse has a maximum storage capacity. Warehouse 1 can store up to 400 products, warehouse 2 up to 500 products, and warehouse 3 up to 300 products.\n// P1 <= 400; P2 <= 500; P3 <= 300\n\n## Generate Constraint-3:\nTo ensure balanced distribution and avoid over-reliance on any single warehouse, the company wants to ensure that no warehouse stores more than 50% of the total products.\n// P1 <= 0.5 * (P1 + P2 + P3); P2 <= 0.5 * (P1 + P2 + P3); P3 <= 0.5 * (P1 + P2 + P3)",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the distribution of products among the warehouses to minimize transportation costs and meet customer demand. The transportation cost from each warehouse to customers is based on the number of products stored, with the cost function being nonlinear and varying with the square of the number of products. Specifically, the cost from warehouse 1 is 0.05 * P1^2, from warehouse 2 is 0.03 * P2^2, and from warehouse 3 is 0.04 * P3^2. The company aims to minimize the total transportation cost.\n\nThe total number of products that can be stored across all warehouses is limited to 1000. Each warehouse has a maximum storage capacity: Warehouse 1 can store up to 400 products, warehouse 2 up to 500 products, and warehouse 3 up to 300 products. To ensure balanced distribution and avoid over-reliance on any single warehouse, the company wants to ensure that no warehouse stores more than 50% of the total products.\n\nPlease help the company determine the optimal number of products to store in each warehouse (P1, P2, P3) to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of products in warehouse 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of products in warehouse 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of products in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize (0.05 * P1^2 + 0.03 * P2^2 + 0.04 * P3^2)\nmodel.addCons(obj == 0.05 * P1**2 + 0.03 * P2**2 + 0.04 * P3**2)\n\n# Add constraints\n## The total number of products that can be stored across all warehouses is limited to 1000.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n## Each warehouse has a maximum storage capacity. Warehouse 1 can store up to 400 products, warehouse 2 up to 500 products, and warehouse 3 up to 300 products.\nmodel.addCons(P1 <= 400)\nmodel.addCons(P2 <= 500)\nmodel.addCons(P3 <= 300)\n## To ensure balanced distribution and avoid over-reliance on any single warehouse, the company wants to ensure that no warehouse stores more than 50% of the total products.\nmodel.addCons(P1 <= 0.5 * (P1 + P2 + P3))\nmodel.addCons(P2 <= 0.5 * (P1 + P2 + P3))\nmodel.addCons(P3 <= 0.5 * (P1 + P2 + P3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Products in Warehouse 1: \", model.getVal(P1))\n    print(\"Number of Products in Warehouse 2: \", model.getVal(P2))\n    print(\"Number of Products in Warehouse 3: \", model.getVal(P3))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n// So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units.\n// A >= 10\n// B >= 20\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product C to meet contractual obligations.\n// C >= 5\n\n## Generate Constraint-4:\nThe total number of units produced (A + B + C) must not exceed 200 units due to storage limitations.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale, with the cost function given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost. The company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively. The market demand for product A is at least 10 units, and for product B is at least 20 units. The company must produce at least 5 units of product C to meet contractual obligations. Additionally, the total number of units produced (A + B + C) must not exceed 200 units due to storage limitations. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50A + 70B + 90C\n## Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n## So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 1000 + 20 * A**2 + 15 * B**2 + 25 * C**2\nNetProfit = Revenue - Cost\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The market demand for product A is at least 10 units, and for product B is at least 20 units\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 20)\n## The company must produce at least 5 units of product C to meet contractual obligations\nmodel.addCons(C >= 5)\n## The total number of units produced (A + B + C) must not exceed 200 units\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop.\n// {\"hectares of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"hectares of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"hectares of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare.\nFor Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare.\nFor Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n// Total profit: Profit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\n// Total water usage: Water = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 30 hectares are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30",
        "question": "A farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop. For Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare. For Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare. For Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops). The farmer has 100 hectares of land available and wants to ensure at least 30 hectares are dedicated to each crop. Please help the farmer determine the optimal allocation of hectares for each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 hectares are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # hectares of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # hectares of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # hectares of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\nWater = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Wheat: \", model.getVal(Wheat))\n    print(\"Hectares of Corn: \", model.getVal(Corn))\n    print(\"Hectares of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process.\n// {\"amount of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy optimization\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\n// Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe investment in energy optimization cannot exceed $50,000.\n// EnergyInvestment <= 50000\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of each product.\n// ProductA >= 10\n// ProductB >= 10\n// ProductC >= 10\n\n## Generate Constraint-4:\nThe total production of products A and B must not exceed twice the production of product C.\n// ProductA + ProductB <= 2 * ProductC",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials and needs to decide on the amount of energy to invest in optimizing the production process. The profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization, with an initial energy cost per unit of $20. The manufacturer aims to maximize the total profit from all products. The total amount of raw material available is 1000 units, with usage of 2 units for product A, 3 units for product B, and 4 units for product C. The investment in energy optimization cannot exceed $50,000. The manufacturer must produce at least 10 units of each product. Additionally, the total production of products A and B must not exceed twice the production of product C. Please help the manufacturer determine the optimal production quantities and energy investment to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # amount of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=10)  # amount of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=10)  # amount of product C\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0)  # investment in energy optimization\n\n# Define objective function\n# Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nProfit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total amount of raw material available is limited.\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\n# The investment in energy optimization cannot exceed $50,000.\nmodel.addCons(EnergyInvestment <= 50000)\n# The manufacturer must produce at least 10 units of each product.\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 10)\nmodel.addCons(ProductC >= 10)\n# The total production of products A and B must not exceed twice the production of product C.\nmodel.addCons(ProductA + ProductB <= 2 * ProductC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Energy Optimization: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per acre is $100, but it requires 2 units of water per acre. \nFor Crop B, the profit per acre is $150, but it requires 3 units of water per acre. \nFor Crop C, the profit per acre is $200, but it requires 4 units of water per acre.\nThe farm aims to maximize the total profit from all crops.\n// Profit from Crop A: Profit_A = 100 * A\n// Profit from Crop B: Profit_B = 150 * B\n// Profit from Crop C: Profit_C = 200 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply, with a maximum of 300 units of water available.\n// 2 * A + 3 * B + 4 * C <= 300",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit. The profit per acre and water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Requirement per Acre |\n|------|-----------------|----------------------------|\n| A    | $100            | 2 units                    |\n| B    | $150            | 3 units                    |\n| C    | $200            | 4 units                    |\n\nThe farm has a total of 100 acres available for cultivation. The farm also has a limited water supply, with a maximum of 300 units of water available. Please help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from Crop A: Profit_A = 100 * A\n## Profit from Crop B: Profit_B = 150 * B\n## Profit from Crop C: Profit_C = 200 * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == 100 * A + 150 * B + 200 * C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a limited water supply, with a maximum of 300 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A has a profit of $30, requires 2 hours of labor, and uses 1 unit of raw material. \nEach device B has a profit of $40, requires 3 hours of labor, and uses 2 units of raw material. \nEach device C has a profit of $50, requires 4 hours of labor, and uses 3 units of raw material.\nThe company aims to maximize the profit per unit of labor and raw material used.\n// Profit from A: Profit_A = 30 * A\n// Profit from B: Profit_B = 40 * B\n// Profit from C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for raw materials.\n// A + 2 * B + 3 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources. The profit, labor hours, and raw material usage for each device are given in the following Table.\n\n| Device | Profit | Labor Hours | Raw Material Usage |\n|--------|--------|-------------|--------------------|\n| A      | $30    | 2 hours     | 1 unit             |\n| B      | $40    | 3 hours     | 2 units            |\n| C      | $50    | 4 hours     | 3 units            |\n\nThe company has a budget of $1000 for raw materials. The company aims to maximize the profit per unit of labor and raw material used. Please help the company determine the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nLaborAndMaterial = 2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborAndMaterial\n## convert the division to multiplication\nmodel.addCons(obj * LaborAndMaterial == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 760,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while maintaining service quality. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. The service quality is measured by the total capacity of all trucks, where each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company wants to maximize the service quality (capacity) while minimizing the operational cost.\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\n// Total capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n// So, the objective function is: Minimize (Cost / Capacity)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 per day for operational costs.\n// 500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20,000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy. The operational cost per day and the capacity of each type of truck are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Capacity (units) |\n|--------------|--------------------------|------------------|\n| TruckA       | $500                     | 10               |\n| TruckB       | $700                     | 15               |\n| TruckC       | $1000                    | 20               |\n\nThe company aims to minimize the total operational cost while maintaining service quality. The service quality is measured by the total capacity of all trucks. The company has a budget of $20,000 per day for operational costs. Please help the company to minimize the ratio of total operational cost to total capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n## the objective function is: Minimize (Cost / Capacity)\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $20,000 per day for operational costs.\nmodel.addCons(500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily.\n// {\"production rate of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"operating hours of the production line\": \"Hours\", \"range\": \"Hours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily revenue. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n// Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n// Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n// Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production rate of all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe production line can operate for a maximum of 24 hours per day.\n// Hours <= 24",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n\n| Product | Revenue per Unit | Efficiency Formula |\n|---------|------------------|--------------------|\n| 1       | $100             | 1 - 0.01 * P1     |\n| 2       | $150             | 1 - 0.01 * P2     |\n| 3       | $200             | 1 - 0.01 * P3     |\n\nThe total production rate of all products cannot exceed 100 units per hour. The production line can operate for a maximum of 24 hours per day. Please help the company to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of Product 3\nHours = model.addVar(vtype=\"CONTINUOUS\", name=\"Hours\", lb=0) # operating hours of the production line\n\n# Define objective function\nR1 = 100 * P1 * Hours * (1 - 0.01 * P1)\nR2 = 150 * P2 * Hours * (1 - 0.01 * P2)\nR3 = 200 * P3 * Hours * (1 - 0.01 * P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 100)\nmodel.addCons(Hours <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Operating Hours of the Production Line: \", model.getVal(Hours))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The company aims to maximize this profit.\n// Formal definition of the objective function: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2, where L represents labor hours, M represents machine hours, and R represents raw materials. The company aims to maximize this profit.\n\n| Resource | Description |\n|----------|-------------|\n| Labor Hours | L (L >= 0) |\n| Machine Hours | M (M >= 0) |\n| Raw Materials | R (R >= 0) |\n\nThe total labor hours available are 1000 hours. Please help the company determine the optimal allocation of labor hours, machine hours, and raw materials to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\nmodel.addCons(obj == 100*L - 0.5*L*L + 150*M - 0.3*M*M + 200*R - 0.4*R*R)\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 757,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// S <= 25; T <= 25; L <= 25\n\n## Generate Constraint-3:\nThe company must produce at least 500 smartphones, 400 tablets, and 300 laptops per day.\n// 10 * S >= 500\n// 8 * T >= 400\n// 5 * L >= 300",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company has a total of 60 workers available. Each production line can be utilized by up to 25 workers at a time. The company must produce at least 500 smartphones, 400 tablets, and 300 laptops per day. Please help the company to decide the optimal allocation of workers to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60) # total 60 workers available\nmodel.addCons(S <= 25) # up to 25 workers on smartphone production\nmodel.addCons(T <= 25) # up to 25 workers on tablet production\nmodel.addCons(L <= 25) # up to 25 workers on laptop production\nmodel.addCons(10 * S >= 500) # at least 500 smartphones\nmodel.addCons(8 * T >= 400) # at least 400 tablets\nmodel.addCons(5 * L >= 300) # at least 300 laptops\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|------------------|--------------------------|-----------------------|\n| P1      | $100             | $60                      | $10                   |\n| P2      | $120             | $70                      | $15                   |\n| P3      | $150             | $90                      | $20                   |\n\nThe company has a total production capacity of 200 units. The company has a budget of $10,000 for production costs. \n\nPlease help the company to maximize the total net profit, considering both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Chocolate cake sells for $20, costs $8 in ingredients, and takes 1.5 hours to bake. \nThe Vanilla cake sells for $18, costs $7 in ingredients, and takes 1 hour to bake. \nThe Strawberry cake sells for $22, costs $9 in ingredients, and takes 2 hours to bake.\nThe bakery aims to maximize the profit efficiency, which is defined as the total profit divided by the total baking time.\n// Profit_Chocolate = 20 * C - 8 * C\n// Profit_Vanilla = 18 * V - 7 * V\n// Profit_Strawberry = 22 * S - 9 * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 2 * S)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1500 for ingredients.\n// 8 * C + 7 * V + 9 * S <= 1500\n\n## Generate Constraint-2:\nThe bakery has a maximum baking capacity of 100 hours.\n// 1.5 * C + 1 * V + 2 * S <= 100\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 100 cakes in total.\n// C + V + S <= 100\n\n## Generate Constraint-4:\nThe demand for Chocolate cakes is at least 20.\n// C >= 20",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\nThe Chocolate cake sells for $20, costs $8 in ingredients, and takes 1.5 hours to bake. \nThe Vanilla cake sells for $18, costs $7 in ingredients, and takes 1 hour to bake. \nThe Strawberry cake sells for $22, costs $9 in ingredients, and takes 2 hours to bake.\nThe bakery has a budget of $1500 for ingredients and a maximum baking capacity of 100 hours. The bakery can only produce a maximum of 100 cakes in total. The demand for Chocolate cakes is at least 20.\nPlease help the bakery to maximize the profit efficiency, which is defined as the total profit divided by the total baking time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (20 - 8) * C\nProfit_Vanilla = (18 - 7) * V\nProfit_Strawberry = (22 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(8 * C + 7 * V + 9 * S <= 1500)\n## The bakery has a maximum baking capacity of 100 hours.\nmodel.addCons(1.5 * C + 1 * V + 2 * S <= 100)\n## The bakery can only produce a maximum of 100 cakes in total.\nmodel.addCons(C + V + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(C))\n    print(\"Number of Vanilla cakes: \", model.getVal(V))\n    print(\"Number of Strawberry cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse.\n// {\"number of goods in warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost.\n// The objective function is: Minimize (C1 + C2 + C3) = Minimize (0.05 * W1^2 + 0.03 * W2^2 + 0.04 * W3^2)\n\n## Generate Constraint-1:\nThe total number of goods available for distribution is 1000 units.\n// W1 + W2 + W3 = 1000\n\n## Generate Constraint-2:\nEach warehouse has a limited storage capacity:\n- Warehouse 1 can store up to 500 units.\n- Warehouse 2 can store up to 400 units.\n- Warehouse 3 can store up to 600 units.\n// W1 <= 500; W2 <= 400; W3 <= 600\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the goods are stored in warehouse 1.\n// W1 >= 0.2 * 1000 = 200",
        "question": "A company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse. The transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\n\n| Warehouse | Cost Function | Storage Capacity |\n|-----------|---------------|------------------|\n| 1         | 0.05 * W1^2   | 500 units        |\n| 2         | 0.03 * W2^2   | 400 units        |\n| 3         | 0.04 * W3^2   | 600 units        |\n\nThe total number of goods available for distribution is 1000 units. Each warehouse has a limited storage capacity as shown in the table. The company wants to ensure that at least 20% of the goods are stored in warehouse 1. Please help the company to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=200)  # number of goods in warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0)  # number of goods in warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0)  # number of goods in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 0.05 * W1**2\nC2 = 0.03 * W2**2\nC3 = 0.04 * W3**2\n## the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The total number of goods available for distribution is 1000 units.\nmodel.addCons(W1 + W2 + W3 == 1000)\n## Each warehouse has a limited storage capacity:\nmodel.addCons(W1 <= 500)\nmodel.addCons(W2 <= 400)\nmodel.addCons(W3 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Goods in Warehouse 1: \", model.getVal(W1))\n    print(\"Number of Goods in Warehouse 2: \", model.getVal(W2))\n    print(\"Number of Goods in Warehouse 3: \", model.getVal(W3))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe company has a constraint on the total number of units produced, which should not exceed 1000 units.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company has a budget of $10,000 for production costs. The total storage space available is limited to 500 units. The company wants to produce at least 50 units of each product. The company has a constraint on the total number of units produced, which should not exceed 1000 units. Please help the company to maximize the total profit after deducting both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10 - 5) * A  # Profit per unit of A: 15 * A\nProfit_B = (45 - 20 - 5) * B  # Profit per unit of B: 20 * B\nProfit_C = (60 - 30 - 5) * C  # Profit per unit of C: 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n## The total storage space available is limited to 500 units.\nmodel.addCons(A + B + C <= 500)\n## The company has a constraint on the total number of units produced, which should not exceed 1000 units.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-3:\nThe total available machine hours are 800 hours.\n// M <= 800\n\n## Generate Constraint-4:\nThe plant must maintain a balance in the usage of resources. The ratio of labor hours to machine hours should not exceed 1.5.\n// L / M <= 1.5\n\n## Generate Constraint-5:\nThe total cost of raw materials, labor, and machine hours should not exceed $10000.\n// R + 10L + 20M <= 10000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2, where R is the amount of raw materials, L is the labor hours, and M is the machine hours.\n\nThe plant has the following constraints:\n1. The total budget for raw materials is $5000.\n2. The total available labor hours are 1000 hours.\n3. The total available machine hours are 800 hours.\n4. The ratio of labor hours to machine hours should not exceed 1.5.\n5. The total cost of raw materials, labor, and machine hours should not exceed $10000.\n\nPlease help the plant manager to maximize the total profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0)  # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0)  # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0)  # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\nP = 100 * R - 0.5 * R**2 + 150 * L - 0.4 * L**2 + 200 * M - 0.3 * M**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total available machine hours are 800 hours.\nmodel.addCons(M <= 800)\n## The ratio of labor hours to machine hours should not exceed 1.5.\nmodel.addCons(L <= 1.5 * M)\n## The total cost of raw materials, labor, and machine hours should not exceed $10000.\nmodel.addCons(R + 10 * L + 20 * M <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line.\n// {\"production quantity of new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of new employees\": \"Employees\", \"range\": \"Employees >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company aims to maximize its profit from the new product.\n// Profit = (100 - 50) * Production - 0.01 * Advertising * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget limit of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe production capacity is limited by the number of employees. Each employee can produce 100 units per quarter.\n// Production <= 100 * Employees\n\n## Generate Constraint-3:\nThe company must hire at least 10 new employees to meet the expected demand.\n// Employees >= 10",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line. The company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company aims to maximize its profit from the new product.\n\nThe company has a budget limit of $50,000 for advertising. The production capacity is limited by the number of employees, with each employee capable of producing 100 units per quarter. The company must hire at least 10 new employees to meet the expected demand.\n\nPlease help the company to maximize its profit from the new product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0)  # production quantity of new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\nEmployees = model.addVar(vtype=\"INTEGER\", name=\"Employees\", lb=0)  # number of new employees\n\n# Define objective function\nProfit = (100 - 50) * Production - 0.01 * Advertising * Production\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Advertising <= 50000)  # advertising budget limit\nmodel.addCons(Production <= 100 * Employees)  # production capacity constraint\nmodel.addCons(Employees >= 10)  # minimum number of employees\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Employees: \", model.getVal(Employees))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time.\n// Profit_E1 = 30 * E1 - 10 * E1\n// Profit_E2 = 40 * E2 - 15 * E2\n// Profit_E3 = 50 * E3 - 20 * E3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (E1 + 2 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// E1 + 2 * E2 + 3 * E3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for production costs.\n// 10 * E1 + 15 * E2 + 20 * E3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for E1 is 50 units, and the company can only sell a maximum of 50 units of E1.\n// E1 <= 50",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand. The profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time. The company has a total production capacity of 200 hours. The company has a budget of $3000 for production costs. The market demand for E1 is 50 units, and the company can only sell a maximum of 50 units of E1. Please help the company to determine the optimal production quantities for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0, ub=50) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * E1\nProfit_E2 = (40 - 15) * E2\nProfit_E3 = (50 - 20) * E3\nProductionTime = E1 + 2 * E2 + 3 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 200)\n## The company has a budget of $3000 for production costs.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production.\n// Impact_E = 1000 * E / 20000\n// Impact_H = 500 * H / 15000\n// Impact_Hy = 800 * Hy / 25000\n// So, the objective function is: Maximize (Impact_E + Impact_H + Impact_Hy)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E + 15000 * H + 25000 * Hy <= 1000000\n\n## Generate Constraint-2:\nThe production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units.\n// E <= 50; H <= 75; Hy <= 40",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand. The environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production. The manufacturer has a total production budget of $1,000,000. The production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units. Please help the manufacturer to maximize the total environmental impact per dollar spent on production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=50) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0, ub=75) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0, ub=40) # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_E = 1000 * E / 20000\nImpact_H = 500 * H / 15000\nImpact_Hy = 800 * Hy / 25000\n## convert the division to multiplication\nmodel.addCons(obj * (20000 * E + 15000 * H + 25000 * Hy) == 1000 * E + 500 * H + 800 * Hy)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E + 15000 * H + 25000 * Hy <= 1000000)\n## The production capacity for each type of vehicle is limited.\nmodel.addCons(E <= 50)\nmodel.addCons(H <= 75)\nmodel.addCons(Hy <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. \nEach unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. \nEach unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material.\nThe plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material).\n// Profit from A: Profit_A = 20 * A\n// Profit from B: Profit_B = 30 * B\n// Profit from C: Profit_C = 40 * C\n// Resource usage: Resource_A = 3 * A + 2 * A = 5 * A; Resource_B = 4 * B + 3 * B = 7 * B; Resource_C = 5 * C + 4 * C = 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe plant has a total of 1000 hours of labor available.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a total of 800 units of raw material available.\n// 2 * A + 3 * B + 4 * C <= 800\n\n## Generate Constraint-3:\nThe plant must produce at least 20 units of each product to meet contractual obligations.\n// A >= 20; B >= 20; C >= 20",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit. Each unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. Each unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. Each unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material. The plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material). The plant has a total of 1000 hours of labor available and 800 units of raw material available. The plant must produce at least 20 units of each product to meet contractual obligations. Please help the plant to maximize its total profit per unit of total resource used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each product to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nResource_A = 5 * A\nResource_B = 7 * B\nResource_C = 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total of 1000 hours of labor available.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n## The plant has a total of 800 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity of three different products and the level of automation to implement in the production process. The profit margin for each product and the impact of automation on production costs are detailed in the following table.\n\n| Product | Profit Margin per Unit | Impact of Automation on Cost |\n|---------|------------------------|------------------------------|\n| 1       | $10                    | $0.5 reduction per $1,000   |\n| 2       | $15                    | $0.5 reduction per $1,000   |\n| 3       | $20                    | $0.5 reduction per $1,000   |\n\nThe company has a total production capacity of 10,000 units across all products. The total investment in automation cannot exceed $50,000. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal production quantities for each product and the appropriate level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=0) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0) # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0) # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nmodel.addCons(obj == (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1034,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 500 units in total.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\n// ProductA >= 100\n// ProductC >= 150",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit of each product is as follows: Product A at $50, Product B at $70, and Product C at $60. The company aims to maximize the total profit from the production of these products.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $50             | $20           |\n| B       | $70             | $30           |\n| C       | $60             | $25           |\n\nThe total production cost must not exceed $15,000. The company has a limited workforce that can produce a maximum of 500 units in total. The market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\n\nPlease help the company determine the optimal production quantities for Product A, Product B, and Product C to maximize profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=100) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=150) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000) # total production cost constraint\nmodel.addCons(ProductA + ProductB + ProductC <= 500) # workforce constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency.\n// {\"number of machines in factory 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The company aims to maximize the total production rate of the chemical while considering the operational costs of each factory, which are nonlinear functions of the number of machines. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The objective is to maximize the net production rate, which is the total production rate minus the total operational cost.\n// The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n// The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n// The objective function is: Maximize (P - C)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total number of machines across all factories to 50.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nEach factory has a limited capacity for machines. Factory 1 can handle up to 20 machines, factory 2 can handle up to 25 machines, and factory 3 can handle up to 30 machines.\n// M1 <= 20; M2 <= 25; M3 <= 30\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 10 machines are allocated to factory 1 to maintain a basic level of production.\n// M1 >= 10",
        "question": "A company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency. Each machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The company aims to maximize the total production rate of the chemical while considering the operational costs of each factory, which are nonlinear functions of the number of machines. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The objective is to maximize the net production rate, which is the total production rate minus the total operational cost. The company has a budget constraint that limits the total number of machines across all factories to 50. Each factory has a limited capacity for machines. Factory 1 can handle up to 20 machines, factory 2 can handle up to 25 machines, and factory 3 can handle up to 30 machines. The company wants to ensure that at least 10 machines are allocated to factory 1 to maintain a basic level of production. Please help the company to maximize the net production rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=10) # number of machines in factory 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines in factory 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines in factory 3\n\n# Define objective function\n## The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n## The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n## The objective function is: Maximize (P - C)\nP = 10 * M1 + 15 * M2 + 20 * M3\nC = 0.1 * M1**2 + 0.15 * M2**2 + 0.2 * M3**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - C)\n\n# Add constraints\n## The company has a budget constraint that limits the total number of machines across all factories to 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n## Each factory has a limited capacity for machines. Factory 1 can handle up to 20 machines, factory 2 can handle up to 25 machines, and factory 3 can handle up to 30 machines.\nmodel.addCons(M1 <= 20)\nmodel.addCons(M2 <= 25)\nmodel.addCons(M3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines in Factory 1: \", model.getVal(M1))\n    print(\"Number of Machines in Factory 2: \", model.getVal(M2))\n    print(\"Number of Machines in Factory 3: \", model.getVal(M3))\n    print(\"Maximized Net Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a plot of land divided into three sections: A, B, and C. The farmer needs to decide how much of each section to allocate for growing three different crops: wheat, corn, and soybeans.\n// {\"area of section A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area of section B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area of section C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for wheat is 5 tons, for corn is 6 tons, and for soybeans is 4 tons. The market prices for these crops are $200 per ton of wheat, $250 per ton of corn, and $300 per ton of soybeans. The farmer aims to maximize the total revenue from selling the crops, but also wants to consider the environmental impact, which is modeled as a quadratic function of the total area used.\n// Revenue from wheat: Rev_wheat = 5 * A * 200\n// Revenue from corn: Rev_corn = 6 * B * 250\n// Revenue from soybeans: Rev_soy = 4 * C * 300\n// Environmental impact: Env_impact = A^2 + B^2 + C^2\n// So, the objective function is: Maximize (Rev_wheat + Rev_corn + Rev_soy) - 0.01 * Env_impact\n\n## Generate Constraint-1:\nThe total area available for farming is 100 hectares.\n// A + B + C <= 100",
        "question": "A farmer has a plot of land divided into three sections: A, B, and C. The farmer needs to decide how much of each section to allocate for growing three different crops: wheat, corn, and soybeans. The yield per hectare and market prices for these crops are given in the following Table.\n\n| Crop     | Yield per Hectare | Market Price per Ton |\n|----------|-------------------|----------------------|\n| Wheat    | 5 tons            | $200                 |\n| Corn     | 6 tons            | $250                 |\n| Soybeans | 4 tons            | $300                 |\n\nThe farmer aims to maximize the total revenue from selling the crops, but also wants to consider the environmental impact, which is modeled as a quadratic function of the total area used. The total area available for farming is 100 hectares. Please help the farmer to maximize the objective function, which is the sum of the revenues from wheat, corn, and soybeans, minus a factor of the environmental impact (0.01 times the sum of the squares of the areas of sections A, B, and C).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area of section A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of section B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of section C\n\n# Define objective function\n## Revenue from wheat: Rev_wheat = 5 * A * 200\n## Revenue from corn: Rev_corn = 6 * B * 250\n## Revenue from soybeans: Rev_soy = 4 * C * 300\n## Environmental impact: Env_impact = A^2 + B^2 + C^2\n## So, the objective function is: Maximize (Rev_wheat + Rev_corn + Rev_soy) - 0.01 * Env_impact\nRev_wheat = 5 * A * 200\nRev_corn = 6 * B * 250\nRev_soy = 4 * C * 300\nEnv_impact = A**2 + B**2 + C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_wheat + Rev_corn + Rev_soy - 0.01 * Env_impact)\n\n# Add constraints\n## The total area available for farming is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of section A: \", model.getVal(A))\n    print(\"Area of section B: \", model.getVal(B))\n    print(\"Area of section C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility.\n// {\"number of technicians at facility 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company produces 3 types of solar panels at the 3 facilities. \nAt facility 1, each technician can produce 10 units of solar panel 1, 15 units of solar panel 2, and 20 units of solar panel 3 per day. \nAt facility 2, each technician can produce 15 units of solar panel 1, 20 units of solar panel 2, and 25 units of solar panel 3 per day. \nAt facility 3, each technician can produce 20 units of solar panel 1, 25 units of solar panel 2, and 30 units of solar panel 3 per day. \nThe company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. Please determine the minimum production time to meet the monthly demand.\n// The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n// The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n// The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are total 60 technicians available.\n// T1 + T2 + T3 <= 60",
        "question": "A company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility. Each technician at facility 1 can produce 10 units of solar panel 1, 15 units of solar panel 2, and 20 units of solar panel 3 per day. At facility 2, each technician can produce 15 units of solar panel 1, 20 units of solar panel 2, and 25 units of solar panel 3 per day. At facility 3, each technician can produce 20 units of solar panel 1, 25 units of solar panel 2, and 30 units of solar panel 3 per day. The company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. There are total 60 technicians available. Please determine the minimum production time to meet the monthly demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of technicians at facility 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of technicians at facility 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of technicians at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n## The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n## The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nmodel.addCons(300 * (10 * T1 + 15 * T2 + 20 * T3) >= 1000 * T1)\nmodel.addCons(450 * (15 * T1 + 20 * T2 + 25 * T3) >= 1000 * T2)\nmodel.addCons(600 * (20 * T1 + 25 * T2 + 30 * T3) >= 1000 * T3)\n\n# Add constraints\n## There are total 60 technicians available.\nmodel.addCons(T1 + T2 + T3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Technicians at Facility 1: \", model.getVal(T1))\n    print(\"Number of Technicians at Facility 2: \", model.getVal(T2))\n    print(\"Number of Technicians at Facility 3: \", model.getVal(T3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency.\n// {\"hours allocated to Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades. The initial production rate for each product is 100 units per hour. The company aims to maximize the total production output.\n// Production output for Product 1: P1 = (100 + 0.005 * Efficiency) * H1\n// Production output for Product 2: P2 = (100 + 0.005 * Efficiency) * H2\n// Production output for Product 3: P3 = (100 + 0.005 * Efficiency) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe investment in production efficiency upgrades cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nAt least 40 hours must be allocated to each product type.\n// H1 >= 40; H2 >= 40; H3 >= 40",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency. The production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades, with an initial production rate of 100 units per hour for each product. The company aims to maximize the total production output.\n\nThe company has a total of 168 hours available for production in a week. The investment in production efficiency upgrades cannot exceed $50,000. Additionally, at least 40 hours must be allocated to each product type.\n\nPlease help the company determine the optimal allocation of hours to each product type and the investment in production efficiency to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=40) # hours allocated to Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=40) # hours allocated to Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=40) # hours allocated to Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\nP1 = (100 + 0.005 * Efficiency) * H1\nP2 = (100 + 0.005 * Efficiency) * H2\nP3 = (100 + 0.005 * Efficiency) * H3\n# So, the objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Investment in production efficiency: \", model.getVal(Efficiency))\n    print(\"Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints.\n// {\"number of machines of type 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine type contributes differently to the profit. Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company wants to maximize the total profit from operating these machines.\n// The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\n// Objective: Maximize P\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available across all types.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 25 machines of any type can be operated simultaneously.\n// M1 <= 25; M2 <= 25; M3 <= 25",
        "question": "A company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints. Each machine type contributes differently to the profit: Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company has a total of 50 machines available across all types. Due to space limitations, no more than 25 machines of any type can be operated simultaneously. Please help the company to maximize the total profit from operating these machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines of type 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines of type 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines of type 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\nmodel.addCons(obj == 50 * M1 + 70 * M2 + 60 * M3)\n\n# Add constraints\n## The company has a total of 50 machines available across all types.\nmodel.addCons(M1 + M2 + M3 <= 50)\n## Due to space limitations, no more than 25 machines of any type can be operated simultaneously.\nmodel.addCons(M1 <= 25)\nmodel.addCons(M2 <= 25)\nmodel.addCons(M3 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines of Type 1: \", model.getVal(M1))\n    print(\"Number of Machines of Type 2: \", model.getVal(M2))\n    print(\"Number of Machines of Type 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 643,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n// Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n// Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 1,000 units of each product are produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units across all products. The investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company wants to ensure that at least 1,000 units of each product are produced. Please help the company determine the optimal production quantities and level of automation to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000) # production quantity for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n## Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n## Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\nProfit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\nProfit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total delivery time, which is influenced by the number of trucks and the complexity of routes. The delivery time per truck for each warehouse is as follows:\n- Warehouse A: 50 + 10 * TrucksA^2 minutes per truck\n- Warehouse B: 60 + 8 * TrucksB^2 minutes per truck\n- Warehouse C: 70 + 12 * TrucksC^2 minutes per truck\nThe company wants to minimize the total delivery time across all warehouses.\n// Total delivery time for Warehouse A: TimeA = (50 + 10 * TrucksA^2) * TrucksA\n// Total delivery time for Warehouse B: TimeB = (60 + 8 * TrucksB^2) * TrucksB\n// Total delivery time for Warehouse C: TimeC = (70 + 12 * TrucksC^2) * TrucksC\n// So, the objective function is: Minimize (TimeA + TimeB + TimeC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no warehouse can have more than 25 trucks.\n// TrucksA <= 25; TrucksB <= 25; TrucksC <= 25",
        "question": "A logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency. The delivery time per truck for each warehouse is influenced by the number of trucks and the complexity of routes, as shown in the following Table.\n\n| Warehouse | Delivery Time per Truck |\n|-----------|-------------------------|\n| A         | 50 + 10 * TrucksA^2    |\n| B         | 60 + 8 * TrucksB^2      |\n| C         | 70 + 12 * TrucksC^2     |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no warehouse can have more than 25 trucks. The company aims to minimize the total delivery time across all warehouses.\n\nPlease help the company determine the optimal number of trucks to allocate to each warehouse to minimize the total delivery time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0, ub=25)  # number of trucks for Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0, ub=25)  # number of trucks for Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0, ub=25)  # number of trucks for Warehouse C\n\n# Define objective function\nTimeA = (50 + 10 * TrucksA**2) * TrucksA\nTimeB = (60 + 8 * TrucksB**2) * TrucksB\nTimeC = (70 + 12 * TrucksC**2) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TimeA + TimeB + TimeC)\n\n# Add constraints\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line.\n// {\"number of workers on component A production line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B production line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line can produce 10 units per hour, with a defect rate of 2%. Each worker on the component B line can produce 15 units per hour, with a defect rate of 3%. Each worker on the component C line can produce 20 units per hour, with a defect rate of 4%. The manufacturer wants to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\n// Total production output: Output = 10 * A + 15 * B + 20 * C\n// Total defect rate: Defect = 2% * 10 * A + 3% * 15 * B + 4% * 20 * C\n// So, the objective function is: Maximize Output / Defect\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 skilled workers available.\n// A + B + C <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 20 workers.\n// A <= 20; B <= 20; C <= 20\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily.\n// 10 * A >= 500\n// 15 * B >= 750\n// 20 * C >= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line. Each worker on the component A line can produce 10 units per hour, with a defect rate of 2%. Each worker on the component B line can produce 15 units per hour, with a defect rate of 3%. Each worker on the component C line can produce 20 units per hour, with a defect rate of 4%. The manufacturer wants to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\nThe manufacturer has a total of 50 skilled workers available. Each production line can handle a maximum of 20 workers. The manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to achieve the maximum production efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on component A production line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on component B production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on component C production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nOutput = 10 * A + 15 * B + 20 * C\nDefect = 0.02 * 10 * A + 0.03 * 15 * B + 0.04 * 20 * C\n## the objective function is: Maximize Output / Defect\n## convert the division to multiplication\nmodel.addCons(obj * Defect == Output)\n\n# Add constraints\n## The manufacturer has a total of 50 skilled workers available.\nmodel.addCons(A + B + C <= 50)\n## Each production line can handle a maximum of 20 workers.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 20)\nmodel.addCons(C <= 20)\n## The manufacturer must produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily.\nmodel.addCons(10 * A >= 500)\nmodel.addCons(15 * B >= 750)\nmodel.addCons(20 * C >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on component A production line: \", model.getVal(A))\n    print(\"Number of workers on component B production line: \", model.getVal(B))\n    print(\"Number of workers on component C production line: \", model.getVal(C))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands.\n// Production time for smartphones: T_S = 1000 / (10 * S)\n// Production time for tablets: T_T = 800 / (8 * T)\n// Production time for laptops: T_L = 500 / (5 * L)\n// So, the objective function is: Minimize max(T_S, T_T, T_L)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for all production lines.\n// S + T + L <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. Each worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands. There are a total of 50 workers available for all production lines. Please help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum production time for any of the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_S = 1000 / (10 * S)\nT_T = 800 / (8 * T)\nT_L = 500 / (5 * L)\n## convert the division to multiplication\nmodel.addCons(obj >= T_S)\nmodel.addCons(obj >= T_T)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 50 workers available for all production lines.\nmodel.addCons(S + T + L <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three different crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach acre of crop A yields a profit of $500 but requires 2 units of water and 3 units of fertilizer. \nEach acre of crop B yields a profit of $700 but requires 4 units of water and 2 units of fertilizer. \nEach acre of crop C yields a profit of $600 but requires 3 units of water and 4 units of fertilizer. \nThe farm aims to maximize its total profit while considering the efficiency of resource usage (defined as the total profit divided by the total resource usage).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 600 * C\n// Resource usage for water: Water_usage = 2 * A + 4 * B + 3 * C\n// Resource usage for fertilizer: Fertilizer_usage = 3 * A + 2 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_usage + Fertilizer_usage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available.\n// 2 * A + 4 * B + 3 * C <= 100",
        "question": "A farm is planning to cultivate three different crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. Each acre of crop A yields a profit of $500 but requires 2 units of water and 3 units of fertilizer. Each acre of crop B yields a profit of $700 but requires 4 units of water and 2 units of fertilizer. Each acre of crop C yields a profit of $600 but requires 3 units of water and 4 units of fertilizer. The farm aims to maximize its total profit while considering the efficiency of resource usage (defined as the total profit divided by the total resource usage). The farm has a total of 100 units of water available. Please help the farm determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 600 * C\nWater_usage = 2 * A + 4 * B + 3 * C\nFertilizer_usage = 3 * A + 2 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_usage + Fertilizer_usage)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_usage + Fertilizer_usage) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available.\nmodel.addCons(2 * A + 4 * B + 3 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit.\n// {\"production quantity for WidgetA\": \"WidgetA_Qty\", \"range\": \"WidgetA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetB\": \"WidgetB_Qty\", \"range\": \"WidgetB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetC\": \"WidgetC_Qty\", \"range\": \"WidgetC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.01 * (WidgetA_Qty^2)) * WidgetA_Qty\n// Profit_WidgetB = (70 - 0.02 * (WidgetB_Qty^2)) * WidgetB_Qty\n// Profit_WidgetC = (90 - 0.03 * (WidgetC_Qty^2)) * WidgetC_Qty\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all widgets combined.\n// WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of WidgetB must be at least half of the production of WidgetA.\n// WidgetB_Qty >= 0.5 * WidgetA_Qty\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the total cost of production to $50,000.\n// 0.01 * (WidgetA_Qty^2) + 0.02 * (WidgetB_Qty^2) + 0.03 * (WidgetC_Qty^2) <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least some quantity of each widget is produced to maintain market presence.\n// WidgetA_Qty >= 10; WidgetB_Qty >= 10; WidgetC_Qty >= 10",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit. The profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company has a total production capacity of 1000 units for all widgets combined. Due to market demand, the production of WidgetB must be at least half of the production of WidgetA. The company has a limited budget for raw materials, which restricts the total cost of production to $50,000. The company wants to ensure that at least some quantity of each widget is produced to maintain market presence. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetA_Qty\", lb=10) # production quantity for WidgetA\nWidgetB_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetB_Qty\", lb=10) # production quantity for WidgetB\nWidgetC_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetC_Qty\", lb=10) # production quantity for WidgetC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_WidgetA = (50 - 0.01 * WidgetA_Qty**2) * WidgetA_Qty\nProfit_WidgetB = (70 - 0.02 * WidgetB_Qty**2) * WidgetB_Qty\nProfit_WidgetC = (90 - 0.03 * WidgetC_Qty**2) * WidgetC_Qty\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all widgets combined.\nmodel.addCons(WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000)\n## Due to market demand, the production of WidgetB must be at least half of the production of WidgetA.\nmodel.addCons(WidgetB_Qty >= 0.5 * WidgetA_Qty)\n## The company has a limited budget for raw materials, which restricts the total cost of production to $50,000.\nmodel.addCons(0.01 * WidgetA_Qty**2 + 0.02 * WidgetB_Qty**2 + 0.03 * WidgetC_Qty**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for WidgetA: \", model.getVal(WidgetA_Qty))\n    print(\"Production Quantity for WidgetB: \", model.getVal(WidgetB_Qty))\n    print(\"Production Quantity for WidgetC: \", model.getVal(WidgetC_Qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter.\n// Units <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe amount of overtime hours must not exceed 500 hours.\n// Overtime <= 500\n\n## Generate Constraint-4:\nThe number of units produced must be at least 5000 to meet the minimum order requirements.\n// Units >= 5000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from all units produced.\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter. The total investment in automation technology cannot exceed $50,000. The amount of overtime hours must not exceed 500 hours. The number of units produced must be at least 5000 to meet the minimum order requirements.\nPlease help the company determine the optimal number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=5000)  # number of units to produce\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0)  # amount of overtime hours\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\nProfit = (150 - 100 + 0.0005 * Automation) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 10,000 units that can be produced in the quarter.\nmodel.addCons(Units <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The amount of overtime hours must not exceed 500 hours.\nmodel.addCons(Overtime <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\n// 1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and the amount to invest in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield, water usage, and selling price for each crop are given in the following Table.\n\n| Crop | Yield (tons/acre) without Irrigation | Yield Increase (tons/acre) per $1000 Irrigation | Water Usage (gallons/acre) | Selling Price ($/ton) |\n|------|--------------------------------------|------------------------------------------------|---------------------------|-----------------------|\n| A    | 0.5                                  | 0.1                                            | 1000                      | 1000                  |\n| B    | 0.6                                  | 0.15                                           | 1200                      | 1200                  |\n| C    | 0.7                                  | 0.2                                            | 1500                      | 1500                  |\n\nThe farm aims to maximize the total revenue from all crops. The total area available for cultivation is 100 acres. The farm has a budget of $50,000 for irrigation investments. The farm has a total water supply of 120,000 gallons.\n\nPlease help the farm to determine the optimal allocation of area for each crop and the investment in irrigation to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=0)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=0)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)  # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total area available for cultivation is 100 acres.\nmodel.addCons(AreaA + AreaB + AreaC <= 100)\n# The farm has a budget of $50,000 for irrigation investments.\nmodel.addCons(Irrigation <= 50000)\n# The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\nmodel.addCons(1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1502,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit.\nThe profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit.\nThe profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit.\nThe company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// Total variable cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120.\n// 100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations. The profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit. The profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit. The profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit. The company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost. The company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120. Please help the company determine the optimal amount of each product to produce to maximize its total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited supply of raw materials, which costs $10,000 per month.\nmodel.addCons(100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to Product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * ProductA\n// Total profit for Product B: ProfitB = 70 * ProductB\n// Total profit for Product C: ProfitC = 60 * ProductC\n// The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000\n\n## Generate Constraint-2:\nThe production of Product A is limited to a maximum of 200 units.\n// ProductA <= 200\n\n## Generate Constraint-3:\nThe production of Product B must be at least 100 units.\n// ProductB >= 100\n\n## Generate Constraint-4:\nThe production of Product C cannot exceed 150 units.\n// ProductC <= 150\n\n## Generate Constraint-5:\nThe resource allocation for each product must be proportional to the number of units produced, with a nonlinear relationship defined as ResourceX = 0.1 * (ProductX)^2, where X is A, B, or C.\n// ResourceA = 0.1 * (ProductA)^2\n// ResourceB = 0.1 * (ProductB)^2\n// ResourceC = 0.1 * (ProductC)^2",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products. The total resources available are limited to 1000 units. The production of Product A is limited to a maximum of 200 units. The production of Product B must be at least 100 units. The production of Product C cannot exceed 150 units. The resource allocation for each product must be proportional to the number of units produced, with a nonlinear relationship defined as ResourceX = 0.1 * (ProductX)^2, where X is A, B, or C.\n\nPlease help the manufacturer to determine the optimal number of units of each product and the corresponding resource allocation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100, ub=None)  # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=150)  # number of units of Product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resources allocated to Product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resources allocated to Product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resources allocated to Product C\n\n# Define objective function\nProfitA = 50 * ProductA\nProfitB = 70 * ProductB\nProfitC = 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\nmodel.addCons(ProductA <= 200)\nmodel.addCons(ProductB >= 100)\nmodel.addCons(ProductC <= 150)\nmodel.addCons(ResourceA == 0.1 * (ProductA ** 2))\nmodel.addCons(ResourceB == 0.1 * (ProductB ** 2))\nmodel.addCons(ResourceC == 0.1 * (ProductC ** 2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Resources Allocated to Product A: \", model.getVal(ResourceA))\n    print(\"Resources Allocated to Product B: \", model.getVal(ResourceB))\n    print(\"Resources Allocated to Product C: \", model.getVal(ResourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of raw materials and the market demand.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to the complexity of the components, the profit per unit decreases by $0.02 for each additional unit produced beyond the first 100 units for each component. The manufacturer wants to maximize the total profit from selling the components.\n// Profit_A = (10 - 0.02 * (A - 100)) * A if A > 100 else 10 * A\n// Profit_B = (15 - 0.02 * (B - 100)) * B if B > 100 else 15 * B\n// Profit_C = (20 - 0.02 * (C - 100)) * C if C > 100 else 20 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe cost of raw materials for component A is $3 per unit, for B is $4 per unit, and for C is $5 per unit. The total budget for raw materials is $1000.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 600 units in terms of the number of units it can produce.\n// A + B + C <= 600",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of raw materials and the market demand. The profit per unit of component A is $10, for B is $15, and for C is $20. However, due to the complexity of the components, the profit per unit decreases by $0.02 for each additional unit produced beyond the first 100 units for each component. The cost of raw materials for component A is $3 per unit, for B is $4 per unit, and for C is $5 per unit. The total budget for raw materials is $1000. The market has a demand limit for each component: for component A, the demand limit is 300 units; for component B, the demand limit is 250 units; and for component C, the demand limit is 200 units. The manufacturer has a production capacity of 600 units in terms of the number of units it can produce.\n\nPlease help the manufacturer to maximize the total profit from selling the components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * (A - 100)) * A if A > 100 else 10 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.02 * (B - 100)) * B if B > 100 else 15 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.02 * (C - 100)) * C if C > 100 else 20 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, with a production cost of $10 per unit and a power consumption of 5 watts per unit. \nThe profit per unit of E2 is $40, with a production cost of $15 per unit and a power consumption of 8 watts per unit. \nThe profit per unit of E3 is $50, with a production cost of $20 per unit and a power consumption of 10 watts per unit.\nThe manufacturer has a limited power supply of 500 watts. The goal is to maximize the profit per watt of power consumed.\n// Profit_E1 = 30 * Q1 - 10 * Q1\n// Profit_E2 = 40 * Q2 - 15 * Q2\n// Profit_E3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (5 * Q1 + 8 * Q2 + 10 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited power supply of 500 watts.\n// 5 * Q1 + 8 * Q2 + 10 * Q3 <= 500",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage. The profit per unit, production cost, and power consumption for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost | Power Consumption |\n|-----------|-----------------|-----------------|-------------------|\n| E1        | $30             | $10             | 5 watts           |\n| E2        | $40             | $15             | 8 watts           |\n| E3        | $50             | $20             | 10 watts          |\n\nThe manufacturer has a limited power supply of 500 watts. Please help the manufacturer to maximize the profit per watt of power consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * Q1\nProfit_E2 = (40 - 15) * Q2\nProfit_E3 = (50 - 20) * Q3\nPowerConsumption = 5 * Q1 + 8 * Q2 + 10 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / PowerConsumption\n## convert the division to multiplication\nmodel.addCons(obj * PowerConsumption == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited power supply of 500 watts.\nmodel.addCons(5 * Q1 + 8 * Q2 + 10 * Q3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit per Watt: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The company aims to maximize this profit.\n// Formal definition of the objective function: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The total labor hours available are 1000 hours, and the total machine hours available are 800 hours. Please help the company to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\nmodel.addCons(obj == 100*L - 0.5*L*L + 150*M - 0.3*M*M + 200*R - 0.4*R*R)\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 451,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit.\n// Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\n// Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\n// Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a contract to supply at least 10 acres of wheat.\n// W >= 10",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit. The total available land is 50 acres, and the farmer has a contract to supply at least 10 acres of wheat. Please help the farmer determine the optimal allocation of land to maximize his profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer has a contract to supply at least 10 acres of wheat.\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=10) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0, ub=10)\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=10, ub=15)\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=15, ub=50)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nW_b3 = model.addVar(vtype=\"B\", name=\"W_b3\")\nmodel.addCons(W_b1 + W_b2 + W_b3 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2 + W3*W_b3)\nWaterCost_W = 10 * W1 * W_b1 + 10 * 1.5 * W2 * W_b2 + 10 * 1.5 * W3 * W_b3\nFertilizerCost_W = 20 * W1 * W_b1 + 20 * 1.25 * W2 * W_b2 + 20 * 1.25 * W3 * W_b3\nProfit_W = 300 * W - WaterCost_W - FertilizerCost_W\n## create piecewise variables for piecewise function: Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=10, ub=15)\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=15, ub=50)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nC_b3 = model.addVar(vtype=\"B\", name=\"C_b3\")\nmodel.addCons(C_b1 + C_b2 + C_b3 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2 + C3*C_b3)\nWaterCost_C = 15 * C1 * C_b1 + 15 * 1.5 * C2 * C_b2 + 15 * 1.5 * C3 * C_b3\nFertilizerCost_C = 25 * C1 * C_b1 + 25 * 1.25 * C2 * C_b2 + 25 * 1.25 * C3 * C_b3\nProfit_C = 400 * C - WaterCost_C - FertilizerCost_C\n## create piecewise variables for piecewise function: Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=10, ub=15)\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=15, ub=50)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nS_b3 = model.addVar(vtype=\"B\", name=\"S_b3\")\nmodel.addCons(S_b1 + S_b2 + S_b3 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2 + S3*S_b3)\nWaterCost_S = 5 * S1 * S_b1 + 5 * 1.5 * S2 * S_b2 + 5 * 1.5 * S3 * S_b3\nFertilizerCost_S = 15 * S1 * S_b1 + 15 * 1.25 * S2 * S_b2 + 15 * 1.25 * S3 * S_b3\nProfit_S = 250 * S - WaterCost_S - FertilizerCost_S\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The total available land is 50 acres.\nmodel.addCons(W + C + S <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit.\n// {\"units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n// The net profit for component A: P_A = 50A - 20A = 30A\n// The net profit for component B: P_B = 70B - 30B = 40B\n// The net profit for component C: P_C = 60C - 25C = 35C\n// The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production of component A must be at least twice the production of component B.\n// A >= 2B",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit. The profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n\n| Component | Selling Price | Production Cost |\n|-----------|---------------|-----------------|\n| A         | $50           | $20             |\n| B         | $70           | $30             |\n| C         | $60           | $25             |\n\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day. Due to market demand, the production of component A must be at least twice the production of component B.\n\nPlease help the company to maximize its net profit by determining the optimal number of units of each component to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # units of component C\n\n# Define objective function\nP_A = 30 * A\nP_B = 40 * B\nP_C = 35 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(A >= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Component A: \", model.getVal(A))\n    print(\"Units of Component B: \", model.getVal(B))\n    print(\"Units of Component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantities for each component to maximize profit while considering various constraints.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, but it decreases by $0.01 for each unit produced above 100. The profit per unit of component B is $15, but it increases by $0.02 for each unit produced above 50. The profit per unit of component C is $20, but it remains constant. The company aims to maximize the total profit from the sale of these components.\n// Profit_A = (10 - 0.01 * max(A - 100, 0)) * A\n// Profit_B = (15 + 0.02 * max(B - 50, 0)) * B\n// Profit_C = 20 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all components must not exceed $1000. The cost per unit of component A is $5, component B is $7, and component C is $9.\n// 5 * A + 7 * B + 9 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a limited supply of a critical raw material. Component A requires 2 units, component B requires 3 units, and component C requires 4 units of this raw material per unit produced. The total available supply of this raw material is 500 units.\n// 2 * A + 3 * B + 4 * C <= 500\n\n## Generate Constraint-3:\nThe market demand for component A is at least 50 units and for component B is at least 75 units. There is no minimum demand specified for component C.\n// A >= 50; B >= 75",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantities for each component to maximize profit while considering various constraints.\nThe profit per unit of component A is $10, but it decreases by $0.01 for each unit produced above 100. The profit per unit of component B is $15, but it increases by $0.02 for each unit produced above 50. The profit per unit of component C is $20, and it remains constant. The company aims to maximize the total profit from the sale of these components.\nThe total production cost for all components must not exceed $1000. The cost per unit of component A is $5, component B is $7, and component C is $9. The company also has a limited supply of a critical raw material. Component A requires 2 units, component B requires 3 units, and component C requires 4 units of this raw material per unit produced. The total available supply of this raw material is 500 units. The market demand for component A is at least 50 units and for component B is at least 75 units. There is no minimum demand specified for component C.\nPlease help the company to determine the optimal production quantities for components A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.01 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.01 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 + 0.02 * max(B - 50, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=75, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=50, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 + 0.02 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## Profit_C = 20 * C\nProfit_C = 20 * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 1000)\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe company has a constraint on the total number of units produced, which should not exceed 1000 units.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | $30             | $10                      | $5                    |\n| B       | $45             | $20                      | $5                    |\n| C       | $60             | $30                      | $5                    |\n\nThe company has a budget of $10,000 for production costs. The total storage space available is limited to 500 units. The company wants to produce at least 50 units of each product. The company also has a constraint on the total number of units produced, which should not exceed 1000 units. \nPlease help the company to maximize the total profit after deducting both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10 - 5) * A  # Profit per unit of A: 15 * A\nProfit_B = (45 - 20 - 5) * B  # Profit per unit of B: 20 * B\nProfit_C = (60 - 30 - 5) * C  # Profit per unit of C: 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n## The total storage space available is limited to 500 units.\nmodel.addCons(A + B + C <= 500)\n## The company has a constraint on the total number of units produced, which should not exceed 1000 units.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate based on the number of workers assigned. \nOn production line 1, each worker contributes to a production rate of 10 units per hour. \nOn production line 2, each worker contributes to a production rate of 15 units per hour. \nOn production line 3, each worker contributes to a production rate of 20 units per hour. \nHowever, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). \nThe objective is to maximize the total production rate of all three lines.\n// The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n// The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n// The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n// So, the objective function is: Maximize R1 + R2 + R3\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// P1 + P2 + P3 <= 60",
        "question": "A manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency. Each production line has a different efficiency rate based on the number of workers assigned. On production line 1, each worker contributes to a production rate of 10 units per hour. On production line 2, each worker contributes to a production rate of 15 units per hour. On production line 3, each worker contributes to a production rate of 20 units per hour. However, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). There are total 60 workers available. Please help the manager to maximize the total production rate of all three lines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n## Convert the division to multiplication\nR1 = model.addVar('R1')\nmodel.addCons(R1 * (1 + 0.1 * P1**2) == 10 * P1)\n\n## The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n## Convert the division to multiplication\nR2 = model.addVar('R2')\nmodel.addCons(R2 * (1 + 0.1 * P2**2) == 15 * P2)\n\n## The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n## Convert the division to multiplication\nR3 = model.addVar('R3')\nmodel.addCons(R3 * (1 + 0.1 * P3**2) == 20 * P3)\n\n## So, the objective function is: Maximize R1 + R2 + R3\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(P1 + P2 + P3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 600 smartphones to be produced.\n// S <= 600\n\n## Generate Constraint-3:\nDue to market research, the company should produce no more than 400 tablets.\n// T <= 400\n\n## Generate Constraint-4:\nThe production line for laptops can handle up to 300 units.\n// L <= 300",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function. The total production capacity of the company is limited to 1000 units per month. The raw material constraint allows for a maximum of 600 smartphones to be produced. Due to market research, the company should produce no more than 400 tablets. The production line for laptops can handle up to 300 units. Please help the company determine the optimal number of each device to produce to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=600) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nS_sq = model.addVar(vtype=\"INTEGER\", name=\"S_sq\")\nT_sq = model.addVar(vtype=\"INTEGER\", name=\"T_sq\")\nL_sq = model.addVar(vtype=\"INTEGER\", name=\"L_sq\")\nmodel.addCons(S_sq == S**2)\nmodel.addCons(T_sq == T**2)\nmodel.addCons(L_sq == L**2)\nmodel.addCons(obj == 50*S + 60*T + 70*L - 0.01*(S_sq + T_sq + L_sq))\n\n# Add constraints\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|------------------|--------------------------|-----------------------|\n| P1      | $100             | $60                      | $10                   |\n| P2      | $120             | $70                      | $15                   |\n| P3      | $150             | $90                      | $20                   |\n\nThe company wants to maximize the total net profit, considering both production and storage costs. The company has a total production capacity of 200 units. Please help the company determine the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit.\n// {\"quantity of WidgetA\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetB\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetC\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets.\n// Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\n// Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\n// Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\n// So, the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all types of widgets.\n// WidgetA + WidgetB + WidgetC <= 500",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit. The profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets. The company has a total production capacity of 500 units across all types of widgets.\nPlease help the company determine the optimal production quantities for WidgetA, WidgetB, and WidgetC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # quantity of WidgetA\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # quantity of WidgetB\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0) # quantity of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetA == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (10 - 0.01 * WidgetA2) * WidgetA\n## create piecewise variables for piecewise function: Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=150)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=150, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetB == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (15 - 0.01 * WidgetB2) * WidgetB\n## create piecewise variables for piecewise function: Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=200)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=200, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetC == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (20 - 0.01 * WidgetC2) * WidgetC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetA + WidgetB + WidgetC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of WidgetA: \", model.getVal(WidgetA))\n    print(\"Quantity of WidgetB: \", model.getVal(WidgetB))\n    print(\"Quantity of WidgetC: \", model.getVal(WidgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\n// A >= 5; B >= 10; C >= 15\n\n## Generate Constraint-3:\nThe plant must produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. Each unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant has a total of 100 hours available for production. The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units. The plant must produce at least twice as many units of product B as product A. Please help the plant to maximize the total profit while considering the production time constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15)  # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The plant must produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300\n\n## Generate Constraint-3:\nThe company has a total production capacity of 600 units across all chemicals.\n// A + B + C <= 600\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of chemical A and 75 units of chemical B to fulfill existing contracts.\n// A >= 50; B >= 75",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company has a total of 1000 kg of raw material available, where chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a storage capacity limit for each chemical: chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units. The company has a total production capacity of 600 units across all chemicals. The company must produce at least 50 units of chemical A and 75 units of chemical B to fulfill existing contracts. Please help the company to maximize the total profit from the production of these chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75)  # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)   # quantity of chemical C\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n\n# Create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n\n# Create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 250)\nmodel.addCons(C <= 300)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1168,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $30, product B generates $40, and product C generates $50. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. The plant aims to maximize the total profit.\n// Profit of A: Profit_A = 30 * A * (1 - 0.01 * min(A, B, C))\n// Profit of B: Profit_B = 40 * B * (1 - 0.01 * min(A, B, C))\n// Profit of C: Profit_C = 50 * C * (1 - 0.01 * min(A, B, C))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for raw materials. The cost of raw materials for each unit of product A is $10, for product B is $15, and for product C is $20.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe plant has a maximum production capacity of 500 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, and for product C is at least 100 units.\n// A >= 50; B >= 75; C >= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. Each unit of product A generates a profit of $30, product B generates $40, and product C generates $50. However, the profit per unit decreases as production increases due to economies of scale; the profit per unit is multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. The plant has a budget of $10,000 for raw materials. The cost of raw materials for each unit of product A is $10, for product B is $15, and for product C is $20. The plant has a maximum production capacity of 500 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The market demand for product A is at least 50 units, for product B is at least 75 units, and for product C is at least 100 units. Please help the plant to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## create a variable for min(A, B, C)\nmin_ABC = model.addVar(vtype=\"CONTINUOUS\", name=\"min_ABC\")\nmodel.addCons(min_ABC <= A)\nmodel.addCons(min_ABC <= B)\nmodel.addCons(min_ABC <= C)\n## Profit of A: Profit_A = 30 * A * (1 - 0.01 * min_ABC)\n## Profit of B: Profit_B = 40 * B * (1 - 0.01 * min_ABC)\n## Profit of C: Profit_C = 50 * C * (1 - 0.01 * min_ABC)\nProfit_A = 30 * A * (1 - 0.01 * min_ABC)\nProfit_B = 40 * B * (1 - 0.01 * min_ABC)\nProfit_C = 50 * C * (1 - 0.01 * min_ABC)\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $10,000 for raw materials.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The plant has a maximum production capacity of 500 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | $30             | $10                      | $5                    |\n| B       | $45             | $20                      | $5                    |\n| C       | $60             | $30                      | $5                    |\n\nThe company has a budget of $10,000 for production costs. The total storage space available is limited to 500 units. The company wants to produce at least 50 units of each product. Please help the company to maximize the total profit after deducting both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 15 * A\nProfit_B = 20 * B\nProfit_C = 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n## The total storage space available is limited to 500 units.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines.\n// The production rate for machine 1: P1 = 10 * W1\n// The production rate for machine 2: P2 = 12 * W2\n// The production rate for machine 3: P3 = 15 * W3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 30 workers available for allocation.\n// W1 + W2 + W3 <= 30\n\n## Generate Constraint-2:\nEach machine can operate with a maximum of 10 workers at a time.\n// W1 <= 10; W2 <= 10; W3 <= 10",
        "question": "A manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines. There are a total of 30 workers available for allocation, and each machine can operate with a maximum of 10 workers at a time.\nPlease help the manager determine the optimal number of workers to assign to each machine (W1 for Machine 1, W2 for Machine 2, and W3 for Machine 3) to maximize the total production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=10) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0, ub=10) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0, ub=10) # number of workers on machine 3\n\n# Define objective function\nP1 = 10 * W1\nP2 = 12 * W2\nP3 = 15 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Total production rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale.\n// Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n// The nonlinear aspect is introduced by assuming that the cost of raw materials and labor decreases as production increases due to bulk discounts.\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units across all products.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours.\n// Qa + 2 * Qb + 3 * Qc <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product A to fulfill a contract.\n// Qa >= 100\n\n## Generate Constraint-4:\nThe raw materials for product B are limited, and the company can only acquire enough for 200 units of product B.\n// Qb <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale.\n\nThe total production capacity of the company is limited to 1000 units across all products. The company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours. The company must produce at least 100 units of product A to fulfill a contract. The raw materials for product B are limited, and the company can only acquire enough for 200 units of product B.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=100) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0, ub=200) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\nProfit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units across all products.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours.\nmodel.addCons(Qa + 2 * Qb + 3 * Qc <= 500)\n## The company must produce at least 100 units of product A to fulfill a contract.\nmodel.addCons(Qa >= 100)\n## The raw materials for product B are limited, and the company can only acquire enough for 200 units of product B.\nmodel.addCons(Qb <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products.\n// Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for both products combined.\n// Prod1 + Prod2 <= 10000\n\n## Generate Constraint-2:\nThe investment in the new technology cannot exceed $50,000.\n// TechInvest <= 50000\n\n## Generate Constraint-3:\nThe production of Product 1 must be at least 2,000 units.\n// Prod1 >= 2000\n\n## Generate Constraint-4:\nThe production of Product 2 must be at least 1,000 units.\n// Prod2 >= 1000",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 10,000 units for both products combined. The investment in the new technology cannot exceed $50,000. The production of Product 1 must be at least 2,000 units. The production of Product 2 must be at least 1,000 units.\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=2000)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=1000)  # production quantity of Product 2\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0)  # investment in production technology\n\n# Define objective function\n# Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\nProfit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units for both products combined.\nmodel.addCons(Prod1 + Prod2 <= 10000)\n# The investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Investment in Production Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\n// 500 * Insulation >= 0.20 * 50000\n\n## Generate Constraint-4:\nNo more than 50% of the budget should be allocated to solar panels.\n// 1000 * Solar <= 0.50 * 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installation and the annual energy savings for each type of upgrade are given in the following Table.\n\n| Upgrade Type       | Installation Cost | Annual Energy Savings |\n|--------------------|-------------------|-----------------------|\n| Solar Panels       | $1000 per panel   | $200 per year         |\n| Wind Turbines      | $2000 per turbine  | $300 per year         |\n| Insulation Upgrades| $500 per upgrade  | $100 per year         |\n\nThe company has a budget of $50,000 for the installation. The company aims to achieve at least $10,000 in annual energy savings. The company wants to ensure that at least 20% of the budget is spent on insulation upgrades. Additionally, no more than 50% of the budget should be allocated to solar panels.\n\nPlease help the company to minimize the total cost of installation while maximizing the annual energy savings, expressed as the ratio of total installation cost to total annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0)  # amount of insulation upgrades\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\n## the objective function is: Minimize Cost / Savings\n## convert the division to multiplication\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n## The company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\nmodel.addCons(500 * Insulation >= 0.20 * 50000)\n## No more than 50% of the budget should be allocated to solar panels.\nmodel.addCons(1000 * Solar <= 0.50 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 70 units per day.\n// B >= 70",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the profit per unit decreases when the production volume exceeds certain thresholds: the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n\n| Product | Profit per Unit | Production Threshold | Decrease Rate |\n|---------|-----------------|----------------------|---------------|\n| A       | $50             | 100 units            | 1% per 10 units |\n| B       | $70             | 200 units            | 1% per 15 units |\n| C       | $90             | 300 units            | 1% per 20 units |\n\nThe total production capacity of the company is 500 units per day. The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day. Please help the company to maximize the total profit (P_A + P_B + P_C) while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=70)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # number of units of product C\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=101, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n\n# Create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=70, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=201, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n\n# Create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=301, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment.\n// {\"production quantity of DeviceA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total cost for DeviceA: CostA = (100 - 0.0001 * Automation) * QuantityA\n// Total cost for DeviceB: CostB = (150 - 0.0001 * Automation) * QuantityB\n// Total cost for DeviceC: CostC = (200 - 0.0001 * Automation) * QuantityC\n// Total revenue for DeviceA: RevenueA = 150 * QuantityA\n// Total revenue for DeviceB: RevenueB = 200 * QuantityB\n// Total revenue for DeviceC: RevenueC = 250 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investment.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all devices is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment. The production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices. The company has a budget of $100,000 for automation investment. The total production capacity for all devices is 10,000 units. Please help the company determine the optimal production quantities for DeviceA, DeviceB, and DeviceC, and the level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of DeviceA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of DeviceB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = (100 - 0.0001 * Automation) * QuantityA\nCostB = (150 - 0.0001 * Automation) * QuantityB\nCostC = (200 - 0.0001 * Automation) * QuantityC\nRevenueA = 150 * QuantityA\nRevenueB = 200 * QuantityB\nRevenueC = 250 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of DeviceB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of DeviceC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm aims to maximize its profit from the crops. The profit per hectare for C1 is $1000, but it requires 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm has a limited water supply and wants to maximize its profit per unit of water used.\n// Profit_C1 = 1000 * A1\n// Profit_C2 = 1500 * A2\n// Profit_C3 = 2000 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * A1 + 3 * A2 + 4 * A3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 300 units.\n// 2 * A1 + 3 * A2 + 4 * A3 <= 300\n\n## Generate Constraint-3:\nThe market demand for C1 is limited to 50 hectares.\n// A1 <= 50\n\n## Generate Constraint-4:\nThe farm must allocate at least 20 hectares to C2 to maintain soil health.\n// A2 >= 20",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The profit per hectare for C1 is $1000, requiring 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm aims to maximize its profit per unit of water used. The farm has a total of 100 hectares of land available and a limited water supply of 300 units. The market demand for C1 is limited to 50 hectares, and the farm must allocate at least 20 hectares to C2 to maintain soil health.\nPlease help the farm to maximize its profit from the crops, considering the profit per unit of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=20) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * A1\nProfit_C2 = 1500 * A2\nProfit_C3 = 2000 * A3\nWaterUsage = 2 * A1 + 3 * A2 + 4 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 300 units.\nmodel.addCons(2 * A1 + 3 * A2 + 4 * A3 <= 300)\n## The market demand for C1 is limited to 50 hectares.\nmodel.addCons(A1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(A1))\n    print(\"Area of Land for C2: \", model.getVal(A2))\n    print(\"Area of Land for C3: \", model.getVal(A3))\n    print(\"Maximized Profit Rate per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 756,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n// Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n// Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n// Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\n\n## Generate Constraint-1:\nThe total area of land available for farming is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10000 for irrigation and fertilization costs.\n// 50 * W^2 + 60 * C^2 + 40 * B^2 + 30 * W^1.5 + 40 * C^1.5 + 20 * B^1.5 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat.\n// W <= 50\n\n## Generate Constraint-4:\nThe farmer must plant at least 20 hectares of corn to meet a contract obligation.\n// C >= 20",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop. The farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit. The total area of land available for farming is 100 hectares. The farmer has a budget of $10000 for irrigation and fertilization costs. The market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat. The farmer must plant at least 20 hectares of corn to meet a contract obligation. Please help the farmer to maximize his net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0, ub=50) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=20) # area of land for corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit and cost calculations\nProfit_wheat = 1000 * W - 50 * W**2 - 30 * W**1.5\nProfit_corn = 1200 * C - 60 * C**2 - 40 * C**1.5\nProfit_barley = 800 * B - 40 * B**2 - 20 * B**1.5\n## the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_barley)\n\n# Add constraints\n## The total area of land available for farming is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a budget of $10000 for irrigation and fertilization costs.\nmodel.addCons(50 * W**2 + 60 * C**2 + 40 * B**2 + 30 * W**1.5 + 40 * C**1.5 + 20 * B**1.5 <= 10000)\n## The market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat.\nmodel.addCons(W <= 50)\n## The farmer must plant at least 20 hectares of corn to meet a contract obligation.\nmodel.addCons(C >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Barley: \", model.getVal(B))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor. The profit per unit, cost of raw materials, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost | Labor Cost |\n|---------|-----------------|-------------------|------------|\n| A       | $50             | $10               | $5         |\n| B       | $70             | $15               | $7         |\n| C       | $90             | $20               | $10        |\n\nThe company has a budget of $10,000 for raw materials and labor. The company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor. Please help the company determine the optimal number of units of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons(10 * A + 5 * A + 15 * B + 7 * B + 20 * C + 10 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit_Corn = 300 * C - 100 * C\n// Profit_Wheat = 250 * W - 80 * W\n// Profit_Soybeans = 200 * S - 60 * S\n// So, the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / (500 * C + 400 * W + 300 * S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C + W + S <= 100",
        "question": "A farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop. For Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. For Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. For Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60. The farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage). The farmer has a total of 100 acres available for cultivation. Please help the farmer determine the optimal allocation of acres to each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Corn\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of Wheat\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (300 - 100) * C\nProfit_Wheat = (250 - 80) * W\nProfit_Soybeans = (200 - 60) * S\nWaterUsage = 500 * C + 400 * W + 300 * S\n## the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C + W + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies based on the production cost and market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company aims to maximize the total profit.\n// The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\n\n## Generate Constraint-1:\nThe company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n// 30S + 70T + 120L <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units.\n// S >= 100; T >= 50; L >= 30",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars. The market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=50) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=30) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S = S * (50 - 0.1 * S)\nProfit_T = T * (100 - 0.2 * T)\nProfit_L = L * (150 - 0.3 * L)\n## the objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L)\n\n# Add constraints\n## The company has a budget constraint of 10000 dollars for production.\nmodel.addCons(30 * S + 70 * T + 120 * L <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component has a different cost and efficiency. \nFor Component A, the production cost is $20 per unit, and the efficiency is 10 units per hour.\nFor Component B, the production cost is $30 per unit, and the efficiency is 15 units per hour.\nFor Component C, the production cost is $40 per unit, and the efficiency is 20 units per hour.\nThe plant aims to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n// Production cost of A: Cost_A = 20 * A\n// Production cost of B: Cost_B = 30 * B\n// Production cost of C: Cost_C = 40 * C\n// Production efficiency of A: Eff_A = 10 * A\n// Production efficiency of B: Eff_B = 15 * B\n// Production efficiency of C: Eff_C = 20 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 per day for production costs.\n// 20 * A + 30 * B + 40 * C <= 1000",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\nFor Component A, the production cost is $20 per unit, and the efficiency is 10 units per hour.\nFor Component B, the production cost is $30 per unit, and the efficiency is 15 units per hour.\nFor Component C, the production cost is $40 per unit, and the efficiency is 20 units per hour.\nThe plant has a budget of $1000 per day for production costs.\nPlease help the plant to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\nEff_A = 10 * A\nEff_B = 15 * B\nEff_C = 20 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Eff_A + Eff_B + Eff_C) == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The plant has a budget of $1000 per day for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 701,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency.\n// {\"production quantity of the product\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe total investment in production efficiency cannot exceed $30,000.\n// Efficiency <= 30000\n\n## Generate Constraint-3:\nThe production quantity must be at least 5000 units to meet the minimum order requirements from key clients.\n// Quantity >= 5000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency. The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10, and the selling price per unit is $15. The company aims to maximize the total profit from the product.\n\nThe company has a budget of $50,000 for advertising. The total investment in production efficiency cannot exceed $30,000. The production quantity must be at least 5000 units to meet the minimum order requirements from key clients.\n\nPlease help the company to maximize the total profit from the product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The production quantity must be at least 5000 units to meet the minimum order requirements from key clients.\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=5000) # production quantity of the product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency.\n## The initial production cost per unit is $10. The selling price per unit is $15.\n## Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\nProfit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n## The total investment in production efficiency cannot exceed $30,000.\nmodel.addCons(Efficiency <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Investment in Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the farmer also knows that the more acres of a single crop are planted, the less efficient the farming becomes. Specifically, for every additional acre of a crop, the profit per acre decreases by 0.1% for that crop. The farmer aims to maximize the total profit from all crops.\n// Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n// Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n// Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n// So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 10 acres of each crop to maintain soil health.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-3:\nDue to market demand, the farmer must plant at least 30 acres of crop A.\n// A >= 30",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the more acres of a single crop are planted, the less efficient the farming becomes, with the profit per acre decreasing by 0.1% for that crop for each additional acre. The farmer has a total of 100 acres available for planting and must plant at least 10 acres of each crop to maintain soil health. Additionally, due to market demand, the farmer must plant at least 30 acres of crop A. The farmer aims to maximize the total profit from all crops. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 acres of each crop to maintain soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=30) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\n\n# Define objective function\n## Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n## Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n## Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n## So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\nP_A = 100 * (1 - 0.001 * A)\nP_B = 150 * (1 - 0.001 * B)\nP_C = 200 * (1 - 0.001 * C)\nTotalProfit = P_A * A + P_B * B + P_C * C\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (80 - 40) * A\n// Profit of B: Profit_B = (120 - 60) * B\n// Profit of C: Profit_C = (160 - 80) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for material costs for the next quarter.\n// 40 * A + 60 * B + 80 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer has a budget of $10,000 for material costs for the next quarter.\nPlease help the manufacturer to maximize the profit rate, which is defined as the total profit divided by the total production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (80 - 40) * A\nProfit_B = (120 - 60) * B\nProfit_C = (160 - 80) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for material costs for the next quarter.\nmodel.addCons(40 * A + 60 * B + 80 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate based on the number of workers assigned. \nOn production line 1, each worker contributes to a production rate of 10 units per hour. \nOn production line 2, each worker contributes to a production rate of 15 units per hour. \nOn production line 3, each worker contributes to a production rate of 20 units per hour. \nHowever, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). \nThe objective is to maximize the total production rate of all three lines.\n// The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n// The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n// The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n// So, the objective function is: Maximize R1 + R2 + R3\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// P1 + P2 + P3 <= 60",
        "question": "A manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency. Each production line has a different efficiency rate based on the number of workers assigned. On production line 1, each worker contributes to a production rate of 10 units per hour. On production line 2, each worker contributes to a production rate of 15 units per hour. On production line 3, each worker contributes to a production rate of 20 units per hour. However, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). The objective is to maximize the total production rate of all three lines.\n\n| Production Line | Production Rate per Worker |\n|-----------------|----------------------------|\n| 1               | 10 units per hour          |\n| 2               | 15 units per hour          |\n| 3               | 20 units per hour          |\n\nThere are total 60 workers available. Please help the manager to maximize the total production rate of all three lines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n## Convert the division to multiplication\nR1 = model.addVar('R1')\nmodel.addCons(R1 * (1 + 0.1 * P1**2) == 10 * P1)\n\n## The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n## Convert the division to multiplication\nR2 = model.addVar('R2')\nmodel.addCons(R2 * (1 + 0.1 * P2**2) == 15 * P2)\n\n## The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n## Convert the division to multiplication\nR3 = model.addVar('R3')\nmodel.addCons(R3 * (1 + 0.1 * P3**2) == 20 * P3)\n\n## So, the objective function is: Maximize R1 + R2 + R3\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(P1 + P2 + P3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency.\n// {\"number of workers on resistor production line\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of workers on capacitor production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of workers on inductor production line\": \"I\", \"range\": \"I >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The company aims to maximize the total production rate of all components. However, due to the nature of the components, the production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%.\n// The production rate of resistors: P_R = 50 * R * (1 - 0.01 * C)\n// The production rate of capacitors: P_C = 40 * C * (1 - 0.01 * I)\n// The production rate of inductors: P_I = 30 * I * (1 + 0.01 * R)\n// The objective function is: Maximize P_total = P_R + P_C + P_I\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// R + C + I <= 60\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 25 workers at a time.\n// R <= 25; C <= 25; I <= 25\n\n## Generate Constraint-3:\nThe company must produce at least 1000 resistors, 800 capacitors, and 600 inductors per day.\n// 50 * R * (1 - 0.01 * C) >= 1000\n// 40 * C * (1 - 0.01 * I) >= 800\n// 30 * I * (1 + 0.01 * R) >= 600",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency. Each worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%.\n\n| Component | Production Rate per Worker |\n|-----------|-----------------------------|\n| Resistors | 50 per hour                 |\n| Capacitors| 40 per hour                 |\n| Inductors | 30 per hour                 |\n\nThe company has a total of 60 workers available. Each production line can be staffed by up to 25 workers at a time. The company must produce at least 1000 resistors, 800 capacitors, and 600 inductors per day.\n\nPlease help the company to maximize the total production rate of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of workers on resistor production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on capacitor production line\nI = model.addVar(vtype=\"INTEGER\", name=\"I\", lb=0) # number of workers on inductor production line\n\n# Define objective function\nP_R = 50 * R * (1 - 0.01 * C)\nP_C = 40 * C * (1 - 0.01 * I)\nP_I = 30 * I * (1 + 0.01 * R)\nP_total = P_R + P_C + P_I\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\nmodel.addCons(R + C + I <= 60)\nmodel.addCons(R <= 25)\nmodel.addCons(C <= 25)\nmodel.addCons(I <= 25)\nmodel.addCons(50 * R * (1 - 0.01 * C) >= 1000)\nmodel.addCons(40 * C * (1 - 0.01 * I) >= 800)\nmodel.addCons(30 * I * (1 + 0.01 * R) >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Resistor Line: \", model.getVal(R))\n    print(\"Number of Workers on Capacitor Line: \", model.getVal(C))\n    print(\"Number of Workers on Inductor Line: \", model.getVal(I))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1430,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while maintaining service quality. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. The service quality is measured by the total capacity of all trucks, where each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company wants to maximize the service quality (capacity) while minimizing the operational cost.\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\n// Total capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n// So, the objective function is: Minimize (Cost / Capacity)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 per day for operational costs.\n// 500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20,000\n\n## Generate Constraint-2:\nThe total number of trucks available is 30.\n// TruckA + TruckB + TruckC <= 30",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. Each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company aims to minimize the total operational cost while maintaining service quality, which is measured by the total capacity of all trucks. The company has a budget of $20,000 per day for operational costs and a total of 30 trucks available. Please help the company to minimize the ratio of total operational cost to total capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n## the objective function is: Minimize (Cost / Capacity)\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $20,000 per day for operational costs.\nmodel.addCons(500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20000)\n## The total number of trucks available is 30.\nmodel.addCons(TruckA + TruckB + TruckC <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering the constraints of raw material availability and market demand.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100), 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical raw material. Product A requires 5 kg per unit, Product B requires 8 kg per unit, and Product C requires 10 kg per unit. The total available raw material is 2000 kg.\n// 5 * A + 8 * B + 10 * C <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 400 units. For Product C, the demand limit is 500 units.\n// A <= 300; B <= 400; C <= 500\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 1000 units in total for all products.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering the constraints of raw material availability and market demand. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sale of these products.\n\n| Product | Profit per Unit | Raw Material per Unit | Market Demand Limit |\n|---------|-----------------|------------------------|---------------------|\n| A       | $10             | 5 kg                   | 300 units           |\n| B       | $15             | 8 kg                   | 400 units           |\n| C       | $20             | 10 kg                  | 500 units           |\n\nThe company has a limited supply of a critical raw material. Product A requires 5 kg per unit, Product B requires 8 kg per unit, and Product C requires 10 kg per unit. The total available raw material is 2000 kg. The market has a demand limit for each product as shown in the table. Additionally, the company has a production capacity limit of 1000 units in total for all products.\n\nPlease help the company to maximize the total profit from the sale of these products while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 400 units. For Product C, the demand limit is 500 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=500) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 2000)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1443,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per hectare is $500, the water requirement is 1000 liters, and the labor hours needed are 50 hours.\nFor Crop B, the expected profit per hectare is $700, the water requirement is 1500 liters, and the labor hours needed are 70 hours.\nFor Crop C, the expected profit per hectare is $900, the water requirement is 2000 liters, and the labor hours needed are 90 hours.\nThe farm aims to maximize the profit per labor hour (which is defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 500 * A\n// Profit from B: Profit_B = 700 * B\n// Profit from C: Profit_C = 900 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (50 * A + 70 * B + 90 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 10000 liters of water available for irrigation.\n// 1000 * A + 1500 * B + 2000 * C <= 10000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\nFor Crop A, the expected profit per hectare is $500, the water requirement is 1000 liters, and the labor hours needed are 50 hours.\nFor Crop B, the expected profit per hectare is $700, the water requirement is 1500 liters, and the labor hours needed are 70 hours.\nFor Crop C, the expected profit per hectare is $900, the water requirement is 2000 liters, and the labor hours needed are 90 hours.\nThe farm has a total of 10000 liters of water available for irrigation.\nPlease help the farm to maximize the profit per labor hour (which is defined as the total profit divided by the total labor hours).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nLaborHours = 50 * A + 70 * B + 90 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 10000 liters of water available for irrigation.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 740,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\n// WheatAcres >= 30\n\n## Generate Constraint-4:\nThe farmer has a budget constraint for seed and fertilizer, which is $15,000. The cost per acre for Wheat is $150, for Corn is $200, and for Soybeans is $180.\n// 150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre and the environmental cost per acre for each crop are given in the following Table.\n\n| Crop        | Profit per Acre | Environmental Cost per Acre |\n|-------------|-----------------|-----------------------------|\n| Wheat       | $200            | $50                         |\n| Corn        | $300            | $70                         |\n| Soybeans    | $250            | $60                         |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. The farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation. The farmer has a budget constraint for seed and fertilizer, which is $15,000. The cost per acre for Wheat is $150, for Corn is $200, and for Soybeans is $180.\n\nPlease help the farmer to maximize the net profit per acre, considering both financial profit and environmental cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=30) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n## The farmer has a budget constraint for seed and fertilizer, which is $15,000.\nmodel.addCons(150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1167,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n\nThe company has a total production capacity of 1000 units per week. The market demand for product A is at least 100 units per week.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce per week to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\nmodel.addCons(obj == 50*A + 70*B + 60*C - 0.01*A**2 - 0.02*B**2 - 0.015*C**2)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit.\n// {\"number of MachineA\": \"MachineATeams\", \"range\": \"MachineATeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBTeams\", \"range\": \"MachineBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCTeams\", \"range\": \"MachineCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n// Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n// Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 machines.\n// MachineATeams + MachineBTeams + MachineCTeams <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\n// MachineCTeams <= MachineATeams + MachineBTeams",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit. The profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company has a total production capacity of 50 machines. Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineATeams = model.addVar(vtype=\"INTEGER\", name=\"MachineATeams\", lb=0) # number of MachineA\nMachineBTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineBTeams\", lb=0) # number of MachineB\nMachineCTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineCTeams\", lb=0) # number of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\nProfit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\nProfit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n## the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 50 machines.\nmodel.addCons(MachineATeams + MachineBTeams + MachineCTeams <= 50)\n## Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\nmodel.addCons(MachineCTeams <= MachineATeams + MachineBTeams)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineATeams))\n    print(\"Number of MachineB: \", model.getVal(MachineBTeams))\n    print(\"Number of MachineC: \", model.getVal(MachineCTeams))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 2,000 units.\n// PA >= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| A       | $50                              | $80                    |\n| B       | $60                              | $90                    |\n| C       | $70                              | $100                   |\n\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The company has a budget of $50,000 for investment in energy efficiency. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 2,000 units. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=2000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $50,000 for investment in energy efficiency.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\n// Profit per acre of A: Profit_A = (100 - 20) * A\n// Profit per acre of B: Profit_B = (150 - 30) * B\n// Profit per acre of C: Profit_C = (200 - 40) * C\n// Total acres planted: Total_acres = A + B + C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for planting.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted). The farm has a total of 100 acres available for planting. Please help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 20) * A\nProfit_B = (150 - 30) * B\nProfit_C = (200 - 40) * C\nTotal_acres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n## convert the division to multiplication\nmodel.addCons(obj * Total_acres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 697,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints. The profit per unit of each component and the decrease in profit per unit beyond certain production levels are given in the following Table.\n\n| Component | Profit per Unit | Decrease in Profit per Unit Beyond | Threshold |\n|-----------|-----------------|-----------------------------------|-----------|\n| ComponentA | $10             | $0.02                             | 100 units  |\n| ComponentB | $15             | $0.015                            | 200 units  |\n| ComponentC | $20             | $0.01                             | 300 units  |\n\nThe company has a total production capacity of 1000 units across all components. Please help the company to maximize the total profit from the sales of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=0) # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=0) # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0) # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * ComponentA_b2 + 10 * ComponentA1 * ComponentA_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * ComponentB_b2 + 15 * ComponentB1 * ComponentB_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=1000)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * ComponentC_b2 + 20 * ComponentC1 * ComponentC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for soybeans is $200. However, the yield of each crop depends on the soil conditions, which are represented by a nonlinear function. The yield function for wheat is Y_W = 100 * W^0.5, for corn is Y_C = 150 * C^0.6, and for soybeans is Y_S = 200 * S^0.7. The farmer aims to maximize the total profit from all crops.\n// Objective function: Maximize P = Y_W * W + Y_C * C + Y_S * S\n// Formal definition: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint for fertilizers and seeds, which is $10,000. The cost per acre for wheat is $20, for corn is $30, and for soybeans is $40.\n// 20 * W + 30 * C + 40 * S <= 10,000",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources. The profit per acre for wheat is $100, for corn is $150, and for soybeans is $200. The yield of each crop depends on the soil conditions, which are represented by a nonlinear function. The yield function for wheat is Y_W = 100 * W^0.5, for corn is Y_C = 150 * C^0.6, and for soybeans is Y_S = 200 * S^0.7. The farmer aims to maximize the total profit from all crops. The total land available for farming is 100 acres. The farmer has a budget constraint for fertilizers and seeds, which is $10,000. The cost per acre for wheat is $20, for corn is $30, and for soybeans is $40.\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n## convert the nonlinear terms to variables\nW_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"W_yield\")\nC_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"C_yield\")\nS_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"S_yield\")\nmodel.addCons(W_yield == W**0.5)\nmodel.addCons(C_yield == C**0.6)\nmodel.addCons(S_yield == S**0.7)\nmodel.addCons(obj == 100 * W_yield * W + 150 * C_yield * C + 200 * S_yield * S)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget constraint for fertilizers and seeds, which is $10,000.\nmodel.addCons(20 * W + 30 * C + 40 * S <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from barley: Profit_B = 150 * B\n// Total water used: Water_Total = 5 * W + 8 * C + 3 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (5 * W + 8 * C + 3 * B)\n\n## Generate Constraint-1:\nThe farmer has a total of 1000 units of water available for irrigation.\n// 5 * W + 8 * C + 3 * B <= 1000",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage. The profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used). The farmer has a total of 1000 units of water available for irrigation. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_B = 150 * B\nWater_Total = 5 * W + 8 * C + 3 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 1000 units of water available for irrigation.\nmodel.addCons(5 * W + 8 * C + 3 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 629,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Watch\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\n// 5 * Phone + 8 * Tablet + 3 * Watch <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\n// Phone <= 300; Tablet <= 250; Watch <= 400\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 800 units across all devices.\n// Phone + Tablet + Watch <= 800\n\n## Generate Constraint-4:\nTo ensure quality control, the production of Watch must not exceed twice the production of Phone.\n// Watch <= 2 * Phone",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand. The profit per unit of each device and the additional profit from economies of scale are given in the following Table.\n\n| Device | Profit per Unit (up to 100 units) | Additional Profit per Unit (over 100 units) |\n|--------|-----------------------------------|-------------------------------------------|\n| Phone  | $100                              | $0.5                                      |\n| Tablet | $150                              | $0.5                                      |\n| Watch  | $75                               | $0.5                                      |\n\nThe production of each device requires a certain amount of a critical component: 5 units for Phone, 8 units for Tablet, and 3 units for Watch. The total available amount of this component is 2000 units. The market has a demand limit for each device: 300 units for Phone, 250 units for Tablet, and 400 units for Watch. The manufacturer has a total production capacity of 800 units across all devices. To ensure quality control, the production of Watch must not exceed twice the production of Phone.\n\nPlease help the manufacturer to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0, ub=300) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=250) # quantity of Tablet\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0, ub=400) # quantity of Watch\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=300)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=250)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\nWatch1 = model.addVar(vtype=\"INTEGER\", name=\"Watch1\", lb=0, ub=100)\nWatch2 = model.addVar(vtype=\"INTEGER\", name=\"Watch2\", lb=100, ub=400)\nWatch_b1 = model.addVar(vtype=\"B\", name=\"Watch_b1\")\nWatch_b2 = model.addVar(vtype=\"B\", name=\"Watch_b2\")\nmodel.addCons(Watch_b1 + Watch_b2 == 1)\nmodel.addCons(Watch == Watch1*Watch_b1 + Watch2*Watch_b2)\nProfit_Watch = 75 * Watch1 * Watch_b1 + (75 + 0.5 * (Watch2 - 100)) * Watch2 * Watch_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Watch)\n\n# Add constraints\nmodel.addCons(5 * Phone + 8 * Tablet + 3 * Watch <= 2000)\nmodel.addCons(Phone + Tablet + Watch <= 800)\nmodel.addCons(Watch <= 2 * Phone)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Watch: \", model.getVal(Watch))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1396,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of hours to operate each production line to maximize profit while considering various constraints.\n// {\"number of hours for ComponentA production\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours for ComponentB production\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours for ComponentC production\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for ComponentA is $500, for ComponentB is $700, and for ComponentC is $900. However, the production process for ComponentC has a diminishing return effect where the profit per hour decreases by $10 for every additional hour worked beyond the first 10 hours. The company aims to maximize the total daily profit from all components.\n// Total profit for ComponentA: ProfitA = 500 * HoursA\n// Total profit for ComponentB: ProfitB = 700 * HoursB\n// Total profit for ComponentC: ProfitC = 900 * HoursC - 10 * max(0, HoursC - 10)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available operational hours for all production lines combined is 12 hours.\n// HoursA + HoursB + HoursC <= 12",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of hours to operate each production line to maximize profit while considering various constraints. The profit per hour for each component is given in the following Table.\n\n| Component | Profit per Hour |\n|-----------|-----------------|\n| ComponentA | $500            |\n| ComponentB | $700            |\n| ComponentC | $900            |\n\nNote: The production process for ComponentC has a diminishing return effect where the profit per hour decreases by $10 for every additional hour worked beyond the first 10 hours.\n\nThe company has a total of 12 hours available for all production lines combined. Please help the company to maximize the total daily profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of hours for ComponentA production\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of hours for ComponentB production\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=0) # number of hours for ComponentC production\n\n# Define objective function\n## Total profit for ComponentA: ProfitA = 500 * HoursA\n## Total profit for ComponentB: ProfitB = 700 * HoursB\n## Total profit for ComponentC: ProfitC = 900 * HoursC - 10 * max(0, HoursC - 10)\n## Create piecewise variables for piecewise function: ProfitC = 900 * HoursC - 10 * max(0, HoursC - 10)\nHoursC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC1\", lb=0, ub=10)\nHoursC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC2\", lb=10, ub=12)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(HoursC == HoursC1*C_b1 + HoursC2*C_b2)\nProfitC = 900 * HoursC1 * C_b1 + (900 - 10 * (HoursC2 - 10)) * HoursC2 * C_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == 500 * HoursA + 700 * HoursB + ProfitC)\n\n# Add constraints\n## The total available operational hours for all production lines combined is 12 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours for ComponentA production: \", model.getVal(HoursA))\n    print(\"Number of hours for ComponentB production: \", model.getVal(HoursB))\n    print(\"Number of hours for ComponentC production: \", model.getVal(HoursC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per week.\n// Qa >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// Qb >= 150\n\n## Generate Constraint-4:\nThe market demand for product C is at least 300 units per week.\n// Qc >= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\nThe total production capacity of the company is limited to 1000 units per week. The market demand for product A is at least 200 units per week. The market demand for product B is at least 150 units per week. The market demand for product C is at least 300 units per week.\nPlease help the company to determine the optimal production quantities of products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=200)  # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=150)  # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=300)  # production quantity of product C\n\n# Define objective function\n# The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n# Convert quadratic terms to linear by introducing new variables and constraints\nQa_sq = model.addVar(name=\"Qa_sq\")\nQb_sq = model.addVar(name=\"Qb_sq\")\nQc_sq = model.addVar(name=\"Qc_sq\")\nmodel.addCons(Qa_sq == Qa * Qa)\nmodel.addCons(Qb_sq == Qb * Qb)\nmodel.addCons(Qc_sq == Qc * Qc)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * Qa - 0.01 * Qa_sq + 70 * Qb - 0.02 * Qb_sq + 60 * Qc - 0.015 * Qc_sq)\n\n# Add constraints\nmodel.addCons(Qa + Qb + Qc <= 1000)  # Total production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach product line has a maximum capacity of 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nTo ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5.\n// W1 / W2 <= 1.5",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. Each worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products. The company has a total of 50 workers available. Each product line has a maximum capacity of 20 workers. To ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5. Please help the company determine the optimal number of workers to allocate to each product line.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# To ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5.\n# Convert the division to multiplication\nmodel.addCons(W1 <= 1.5 * W2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric generators\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year.\nThe cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year.\nThe cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year.\nThe company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n// Total installation cost: Install_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\n// Total annual maintenance cost: Maintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\n// Total annual energy output: Energy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n// So, the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for the installation of all systems.\n// 2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 100,000 kWh.\n// 1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on each type of system.\n// 2000 * Solar >= 0.20 * 200000\n// 5000 * Wind >= 0.20 * 200000\n// 10000 * Hydro >= 0.20 * 200000",
        "question": "A company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators. The company needs to determine how many units of each system to install. The cost of installation, estimated annual energy output, and maintenance cost for each system are given in the following Table.\n\n| System Type       | Installation Cost | Annual Energy Output | Annual Maintenance Cost |\n|-------------------|-------------------|----------------------|-------------------------|\n| Solar Panels      | $2000             | 1000 kWh             | $50 per year            |\n| Wind Turbines     | $5000             | 2500 kWh             | $100 per year           |\n| Hydroelectric Generators | $10000       | 5000 kWh             | $200 per year           |\n\nThe company has a budget of $200,000 for the installation of all systems. The total annual energy output must be at least 100,000 kWh. The company wants to ensure that at least 20% of the budget is spent on each type of system. \nPlease help the company to minimize the total cost of installation and maintenance per unit of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstall_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\nMaintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\nEnergy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n## the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Output == Install_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a budget of $200,000 for the installation of all systems.\nmodel.addCons(2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000)\n## The total annual energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000)\n## The company wants to ensure that at least 20% of the budget is spent on each type of system.\nmodel.addCons(2000 * Solar >= 0.20 * 200000)\nmodel.addCons(5000 * Wind >= 0.20 * 200000)\nmodel.addCons(10000 * Hydro >= 0.20 * 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Generators: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. \nVehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. \nVehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. \nThe company aims to minimize the total cost of maintenance and fuel consumption, considering the total distance traveled by all vehicles is 10000 km.\n// Fuel cost for A: Fuel_A = (10/100) * 10000 * A\n// Fuel cost for B: Fuel_B = (8/100) * 10000 * B\n// Fuel cost for C: Fuel_C = (6/100) * 10000 * C\n// Maintenance cost for A: Maint_A = 5000 * A\n// Maintenance cost for B: Maint_B = 4000 * B\n// Maintenance cost for C: Maint_C = 3000 * C\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n## Generate Constraint-1:\nThe company has a budget of $20000 for vehicle maintenance.\n// 5000 * A + 4000 * B + 3000 * C <= 20000\n\n## Generate Constraint-2:\nThe company can only deploy a maximum of 5 vehicles of each type.\n// A <= 5; B <= 5; C <= 5",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost. Vehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. Vehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. Vehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. The company aims to minimize the total cost of maintenance and fuel consumption, considering the total distance traveled by all vehicles is 10000 km. The company has a budget of $20000 for vehicle maintenance. The company can only deploy a maximum of 5 vehicles of each type. Please help the company to minimize the total cost of maintenance and fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=5) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=5) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=5) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = (10/100) * 10000 * A\nFuel_B = (8/100) * 10000 * B\nFuel_C = (6/100) * 10000 * C\nMaint_A = 5000 * A\nMaint_B = 4000 * B\nMaint_C = 3000 * C\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n# Add constraints\n## The company has a budget of $20000 for vehicle maintenance.\nmodel.addCons(5000 * A + 4000 * B + 3000 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. \nEach unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. \nEach unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit.\nThe company aims to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = 10 * A\n// Profit of B: Profit_B = 15 * B\n// Profit of C: Profit_C = 20 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 2 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a total of 200 kg of raw material available.\n// 2 * A + 4 * B + 3 * C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability. Each unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. Each unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. Each unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit. The company has a total of 200 kg of raw material available. The company aims to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLaborHours = 3 * A + 2 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 200 kg of raw material available.\nmodel.addCons(2 * A + 4 * B + 3 * C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 10$             |\n| B       | 15$             |\n| C       | 20$             |\n\nThe total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day. Please help the company determine the optimal number of units of products A, B, and C to produce daily to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C - 0.01*(A**2 + B**2 + C**2))\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device.\n// {\"number of workers for smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker can produce 10 smartphones, 8 tablets, or 6 laptops per hour. The cost of production per device varies inversely with the number of workers assigned. The cost per smartphone is $50/S, per tablet is $70/T, and per laptop is $100/L. The manufacturer aims to minimize the total production cost while meeting the demand for each device.\n// Total cost of smartphones: Cost_S = 10 * S * (50/S) = 500\n// Total cost of tablets: Cost_T = 8 * T * (70/T) = 560\n// Total cost of laptops: Cost_L = 6 * L * (100/L) = 600\n// Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nThe demand for smartphones is at least 500 units.\n// 10 * S >= 500\n\n## Generate Constraint-3:\nThe demand for tablets is at least 400 units.\n// 8 * T >= 400\n\n## Generate Constraint-4:\nThe demand for laptops is at least 300 units.\n// 6 * L >= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device. Each worker can produce 10 smartphones, 8 tablets, or 6 laptops per hour. The cost of production per device varies inversely with the number of workers assigned. The cost per smartphone is $50/S, per tablet is $70/T, and per laptop is $100/L. The manufacturer aims to minimize the total production cost while meeting the demand for each device. The total number of workers available is 50. The demand for smartphones is at least 500 units. The demand for tablets is at least 400 units. The demand for laptops is at least 300 units.\nPlease help the manufacturer determine the optimal number of workers to assign to each device to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers for smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers for tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers for laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\nCost_S = 500  # Cost of smartphones is constant as it simplifies to 500\nCost_T = 560  # Cost of tablets is constant as it simplifies to 560\nCost_L = 600  # Cost of laptops is constant as it simplifies to 600\nmodel.addCons(obj == Cost_S + Cost_T + Cost_L)\n\n# Add constraints\n## The total number of workers available is 50.\nmodel.addCons(S + T + L <= 50)\n## The demand for smartphones is at least 500 units.\nmodel.addCons(10 * S >= 500)\n## The demand for tablets is at least 400 units.\nmodel.addCons(8 * T >= 400)\n## The demand for laptops is at least 300 units.\nmodel.addCons(6 * L >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers for Smartphones: \", model.getVal(S))\n    print(\"Number of Workers for Tablets: \", model.getVal(T))\n    print(\"Number of Workers for Laptops: \", model.getVal(L))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. However, the production cost per unit for each product varies with the number of units produced due to economies of scale. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n// Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n// Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// UnitsB <= 2 * UnitsA\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the total production cost to $50,000.\n// (40 - 0.1*UnitsA) * UnitsA + (50 - 0.1*UnitsB) * UnitsB + (60 - 0.1*UnitsC) * UnitsC <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 100 units of each product are produced to meet contractual obligations.\n// UnitsA >= 100; UnitsB >= 100; UnitsC >= 100",
        "question": "A manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. However, the production cost per unit for each product varies with the number of units produced due to economies of scale. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a limited budget for raw materials, which restricts the total production cost to $50,000. The company wants to ensure that at least 100 units of each product are produced to meet contractual obligations. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 100 units of each product are produced to meet contractual obligations.\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=100) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=100) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=100) # number of units of ProductC\n\n# Define objective function\n## Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n## Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n## Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\nProfit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\nProfit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n## The company has a limited budget for raw materials, which restricts the total production cost to $50,000.\nmodel.addCons((40 - 0.1*UnitsA) * UnitsA + (50 - 0.1*UnitsB) * UnitsB + (60 - 0.1*UnitsC) * UnitsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many batches of each type of cake to bake to maximize profit while considering the limited oven time and ingredient availability.\n// {\"number of chocolate cake batches\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake batches\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake batches\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach batch of chocolate cake yields a profit of $50, vanilla cake yields $40, and strawberry cake yields $30. The bakery aims to maximize the total profit from selling these cakes.\n// Formal definition of the objective function: Maximize P = 50C + 40V + 30S\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of oven time available per week. Each batch of chocolate cake requires 2 hours, vanilla cake requires 3 hours, and strawberry cake requires 4 hours of oven time.\n// 2C + 3V + 4S <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, vanilla, and strawberry ingredients. The chocolate ingredient allows for a maximum of 30 batches, the vanilla ingredient allows for 25 batches, and the strawberry ingredient allows for 20 batches.\n// C <= 30; V <= 25; S <= 20\n\n## Generate Constraint-3:\nThe bakery has a policy to ensure a balanced variety of cakes. The number of strawberry cake batches must be at least half the number of vanilla cake batches.\n// S >= 0.5V",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many batches of each type of cake to bake to maximize profit while considering the limited oven time and ingredient availability. The profit per batch for each type of cake is as follows: chocolate cake yields $50, vanilla cake yields $40, and strawberry cake yields $30.\n\n| Cake Type | Profit per Batch | Oven Time per Batch |\n|-----------|------------------|---------------------|\n| Chocolate | $50              | 2 hours             |\n| Vanilla   | $40              | 3 hours             |\n| Strawberry| $30              | 4 hours             |\n\nThe bakery has a total of 100 hours of oven time available per week. The bakery has a limited supply of ingredients, allowing for a maximum of 30 batches of chocolate cake, 25 batches of vanilla cake, and 20 batches of strawberry cake. The bakery also has a policy to ensure a balanced variety of cakes, requiring that the number of strawberry cake batches must be at least half the number of vanilla cake batches.\n\nPlease help the bakery to maximize the total profit from selling these cakes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of chocolate cake batches\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vanilla cake batches\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of strawberry cake batches\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50C + 40V + 30S\nmodel.addCons(obj == 50*C + 40*V + 30*S)\n\n# Add constraints\n## The bakery has a total of 100 hours of oven time available per week.\nmodel.addCons(2*C + 3*V + 4*S <= 100)\n## The bakery has a limited supply of chocolate, vanilla, and strawberry ingredients.\nmodel.addCons(C <= 30)\nmodel.addCons(V <= 25)\nmodel.addCons(S <= 20)\n## The number of strawberry cake batches must be at least half the number of vanilla cake batches.\nmodel.addCons(S >= 0.5*V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cake Batches: \", model.getVal(C))\n    print(\"Number of Vanilla Cake Batches: \", model.getVal(V))\n    print(\"Number of Strawberry Cake Batches: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize their profit and resource usage.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $30, device B is $40, and device C is $50. The production cost per unit of device A is $10, device B is $20, and device C is $30. The manufacturer has a limited amount of a critical component that is used in the production of all devices. Each unit of device A requires 2 units of the component, device B requires 3 units, and device C requires 4 units. The manufacturer aims to maximize the total profit while considering the efficiency of component usage.\n// Profit of A: Profit_A = (30 - 10) * A = 20 * A\n// Profit of B: Profit_B = (40 - 20) * B = 20 * B\n// Profit of C: Profit_C = (50 - 30) * C = 20 * C\n// Component usage: Component_A = 2 * A, Component_B = 3 * B, Component_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Component_A + Component_B + Component_C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize their profit and resource usage. The profit per unit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | $30             | $10                      |\n| B      | $40             | $20                      |\n| C      | $50             | $30                      |\n\nEach unit of device A requires 2 units of a critical component, device B requires 3 units, and device C requires 4 units. The manufacturer has a budget of $10,000 for production costs. The manufacturer aims to maximize the total profit while considering the efficiency of component usage.\n\nPlease help the manufacturer to maximize the total profit while considering the efficiency of component usage, defined as the total profit divided by the total usage of the critical component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 20 * B\nProfit_C = 20 * C\nComponent_A = 2 * A\nComponent_B = 3 * B\nComponent_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Component_A + Component_B + Component_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Component_A + Component_B + Component_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 1200 minutes available for the holiday season.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 1200",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery has a total baking time of 1200 minutes available for the holiday season.\nPlease help the bakery to maximize the profit efficiency (profit per minute of baking time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 1200 minutes available for the holiday season.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nOn production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. \nOn production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. \nOn production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. \nThe company aims to maximize the total production of all components. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear.\n// The total production of resistors: P_res = 10 * R1^2 + 8 * R2^2 + 6 * R3^2\n// The total production of capacitors: P_cap = 5 * R1^2 + 7 * R2^2 + 9 * R3^2\n// The total production of inductors: P_ind = 3 * R1^2 + 4 * R2^2 + 5 * R3^2\n// The objective function is: Maximize P_total = P_res + P_cap + P_ind\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// R1 + R2 + R3 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 20 workers.\n// R1 <= 20; R2 <= 20; R3 <= 20",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\nOn production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. \nOn production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. \nOn production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. \nThe company aims to maximize the total production of all components. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear.\nThere are a total of 50 workers available. Each production line can be staffed by up to 20 workers.\nPlease help the company to maximize the total production of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=20) # number of workers on production line 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=20) # number of workers on production line 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=20) # number of workers on production line 3\n\n# Define objective function\n## The objective function is: Maximize P_total = P_res + P_cap + P_ind\nP_res = 10 * R1**2 + 8 * R2**2 + 6 * R3**2\nP_cap = 5 * R1**2 + 7 * R2**2 + 9 * R3**2\nP_ind = 3 * R1**2 + 4 * R2**2 + 5 * R3**2\nP_total = P_res + P_cap + P_ind\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(R1 + R2 + R3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(R1))\n    print(\"Number of workers on production line 2: \", model.getVal(R2))\n    print(\"Number of workers on production line 3: \", model.getVal(R3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit.\n// {\"production rate of machine 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different product with varying profit margins. \nMachine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. \nMachine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. \nMachine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit.\nThe plant aims to maximize the total daily profit from all three products.\n// The daily profit from machine 1: D1 = 10 * P1 * 5\n// The daily profit from machine 2: D2 = 15 * P2 * 7\n// The daily profit from machine 3: D3 = 20 * P3 * 6\n// So, the objective function is: Maximize (D1 + D2 + D3)\n\n## Generate Constraint-1:\nThe total daily production time for all machines is limited to 8 hours.\n// P1 + P2 + P3 <= 8",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit. Machine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit. The plant aims to maximize the total daily profit from all three products. The total daily production time for all machines is limited to 8 hours. Please help the manager to determine the optimal production rates for each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of machine 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of machine 3\n\n# Define objective function\nD1 = 10 * P1 * 5\nD2 = 15 * P2 * 7\nD3 = 20 * P3 * 6\n# So, the objective function is: Maximize (D1 + D2 + D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == D1 + D2 + D3)\n\n# Add constraints\n# The total daily production time for all machines is limited to 8 hours.\nmodel.addCons(P1 + P2 + P3 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of Machine 1: \", model.getVal(P1))\n    print(\"Production rate of Machine 2: \", model.getVal(P2))\n    print(\"Production rate of Machine 3: \", model.getVal(P3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component has a different cost and efficiency. \nFor Component A, the production cost is $20 per unit, and the efficiency is 10 units per hour.\nFor Component B, the production cost is $30 per unit, and the efficiency is 15 units per hour.\nFor Component C, the production cost is $40 per unit, and the efficiency is 20 units per hour.\nThe plant aims to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n// Production cost of A: Cost_A = 20 * A\n// Production cost of B: Cost_B = 30 * B\n// Production cost of C: Cost_C = 40 * C\n// Production efficiency of A: Eff_A = 10 * A\n// Production efficiency of B: Eff_B = 15 * B\n// Production efficiency of C: Eff_C = 20 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 per day for production costs.\n// 20 * A + 30 * B + 40 * C <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each component daily.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe plant has a maximum production capacity of 1000 units per day across all components.\n// A + B + C <= 1000\n\n## Generate Constraint-4:\nThe plant must allocate at least 20% of its total production capacity to Component A.\n// A >= 0.2 * (A + B + C)",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\nFor Component A, the production cost is $20 per unit, and the efficiency is 10 units per hour.\nFor Component B, the production cost is $30 per unit, and the efficiency is 15 units per hour.\nFor Component C, the production cost is $40 per unit, and the efficiency is 20 units per hour.\nThe plant has a budget of $1000 per day for production costs. The plant must produce at least 50 units of each component daily. The plant has a maximum production capacity of 1000 units per day across all components. The plant must allocate at least 20% of its total production capacity to Component A.\nPlease help the plant to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\nEff_A = 10 * A\nEff_B = 15 * B\nEff_C = 20 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Eff_A + Eff_B + Eff_C) == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The plant has a budget of $1000 per day for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 1000)\n## The plant has a maximum production capacity of 1000 units per day across all components.\nmodel.addCons(A + B + C <= 1000)\n## The plant must allocate at least 20% of its total production capacity to Component A.\nmodel.addCons(A >= 0.2 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit of Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit while considering the cost of raw materials and the efficiency of production lines.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of raw materials for P1 is $30 per unit, and for P2 is $40 per unit. The revenue per unit for P1 is $50, and for P2 is $60. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for P1 is 1 hour, and for P2 is 1.5 hours. The company aims to maximize the total profit from both products.\n// Profit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\n// Profit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// P1 + 1.5 * P2 <= 200 - EfficiencyInvestment\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $15,000.\n// EfficiencyInvestment <= 15000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the investment in production efficiency upgrades to optimize their profit. The cost of raw materials for P1 is $30 per unit, and for P2 is $40 per unit. The revenue per unit for P1 is $50, and for P2 is $60. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for P1 is 1 hour, and for P2 is 1.5 hours. The company has a total production capacity of 200 hours and the total investment in production efficiency upgrades cannot exceed $15,000. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in production efficiency\n\n# Define objective function\nProfit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\nProfit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + 1.5 * P2 <= 200 - EfficiencyInvestment)\nmodel.addCons(EfficiencyInvestment <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n// Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n// Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $30                   |\n| ProductB | $70             | $30                   |\n| ProductC | $90             | $30                   |\n\nThe company has a total production capacity of 10,000 units across all products. The investment in automation cannot exceed $50,000.\n\nPlease help the company to determine the optimal production quantities for ProductA, ProductB, and ProductC, and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n## Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n## Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (50 - (30 - 0.0001 * Automation)) * ProdA + (70 - (30 - 0.0001 * Automation)) * ProdB + (90 - (30 - 0.0001 * Automation)) * ProdC)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, due to market saturation, the profit per unit decreases nonlinearly with an increase in production. The profit function is defined as: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\n// So, the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nDue to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB.\n// A <= 2 * B\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of ComponentC to fulfill a contractual obligation.\n// C >= 10\n\n## Generate Constraint-4:\nThe total production cost must not exceed $50,000. The cost per unit for ComponentA is $20, for ComponentB is $30, and for ComponentC is $40.\n// 20 * A + 30 * B + 40 * C <= 50000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints. The profit per unit and the cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Cost per Unit |\n|-----------|-----------------|---------------|\n| ComponentA | $50             | $20           |\n| ComponentB | $70             | $30           |\n| ComponentC | $90             | $40           |\n\nThe profit per unit decreases nonlinearly with an increase in production according to the following functions: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\n\nThe company has a total production capacity of 1000 units per month. Due to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB. The company must produce at least 10 units of ComponentC to fulfill a contractual obligation. The total production cost must not exceed $50,000.\n\nPlease help the company determine the optimal number of units of each component to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n## convert the non-linear terms to linear constraints\nmodel.addCons(obj == 50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n## Due to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB.\nmodel.addCons(A <= 2 * B)\n## The company must produce at least 10 units of ComponentC to fulfill a contractual obligation.\nmodel.addCons(C >= 10)\n## The total production cost must not exceed $50,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit.\n// {\"production quantity for WidgetA\": \"WidgetA_Qty\", \"range\": \"WidgetA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetB\": \"WidgetB_Qty\", \"range\": \"WidgetB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetC\": \"WidgetC_Qty\", \"range\": \"WidgetC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.01 * (WidgetA_Qty^2)) * WidgetA_Qty\n// Profit_WidgetB = (70 - 0.02 * (WidgetB_Qty^2)) * WidgetB_Qty\n// Profit_WidgetC = (90 - 0.03 * (WidgetC_Qty^2)) * WidgetC_Qty\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all widgets combined.\n// WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit. The profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n\n| Widget | Profit per Unit | Cost Function       |\n|--------|-----------------|---------------------|\n| WidgetA| $50             | 0.01 * (WidgetA_Qty^2) |\n| WidgetB| $70             | 0.02 * (WidgetB_Qty^2) |\n| WidgetC| $90             | 0.03 * (WidgetC_Qty^2) |\n\nThe company has a total production capacity of 1000 units for all widgets combined. Please help the company determine the optimal production quantity for each widget to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetA_Qty\", lb=0) # production quantity for WidgetA\nWidgetB_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetB_Qty\", lb=0) # production quantity for WidgetB\nWidgetC_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetC_Qty\", lb=0) # production quantity for WidgetC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with quadratic costs\nProfit_WidgetA = (50 - 0.01 * WidgetA_Qty**2) * WidgetA_Qty\nProfit_WidgetB = (70 - 0.02 * WidgetB_Qty**2) * WidgetB_Qty\nProfit_WidgetC = (90 - 0.03 * WidgetC_Qty**2) * WidgetC_Qty\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all widgets combined.\nmodel.addCons(WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for WidgetA: \", model.getVal(WidgetA_Qty))\n    print(\"Production Quantity for WidgetB: \", model.getVal(WidgetB_Qty))\n    print(\"Production Quantity for WidgetC: \", model.getVal(WidgetC_Qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50\n\n## Generate Constraint-2:\nDue to operational requirements, CargoB must have at least half as many trucks as CargoA.\n// CargoBTrucks >= 0.5 * CargoATrucks\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for maintenance costs for the quarter.\n// 500 * CargoATrucks + 700 * CargoBTrucks + 1,000 * CargoCTrucks <= 100,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of cargo has at least one truck allocated.\n// CargoATrucks >= 1; CargoBTrucks >= 1; CargoCTrucks >= 1",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. For CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. For CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck. The company has a total of 50 trucks available for allocation. Due to operational requirements, CargoB must have at least half as many trucks as CargoA. The company has a budget of $100,000 for maintenance costs for the quarter. The company wants to ensure that each type of cargo has at least one truck allocated. Please help the company to maximize the total net profit from all cargo types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=1)  # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=1)  # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=1)  # number of trucks for CargoC\n\n# Define objective function\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\nmodel.addCons(CargoBTrucks >= 0.5 * CargoATrucks)\nmodel.addCons(500 * CargoATrucks + 700 * CargoBTrucks + 1000 * CargoCTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from selling all three products.\n// Profit_A = (10 - 0.001 * (A - 100)) * A\n// Profit_B = (15 - 0.001 * (B - 100)) * B\n// Profit_C = (20 - 0.001 * (C - 100)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours.\n// 2 * A + 3 * B + 4 * C <= 1500\n\n## Generate Constraint-3:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units.\n// A <= 200; B <= 300; C <= 400\n\n## Generate Constraint-4:\nThe company has a production capacity constraint. The total number of units it can produce across all products is 800 units.\n// A + B + C <= 800",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg. The company also has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours. The market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units. Additionally, the company has a production capacity constraint. The total number of units it can produce across all products is 800 units. Please help the company to maximize the total profit from selling all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.001 * (A - 100)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.001 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.001 * (B - 100)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.001 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.001 * (C - 100)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=400)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.001 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n## The company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1500)\n## The company has a production capacity constraint. The total number of units it can produce across all products is 800 units.\nmodel.addCons(A + B + C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1298,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer wants to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).\n// Profit of A: Profit_A = (50 - 100 / A) * A\n// Profit of B: Profit_B = (70 - 150 / B) * B\n// Profit of C: Profit_C = (90 - 200 / C) * C\n// Storage cost: Storage = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production setup costs.\n// 100 * A + 150 * B + 200 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a storage capacity of 500 units across all products.\n// A + B + C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer has a budget of $10,000 for production setup costs. The manufacturer also has a storage capacity of 500 units across all products.\nPlease help the manufacturer to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 100 / A) * A\nProfit_B = (70 - 150 / B) * B\nProfit_C = (90 - 200 / C) * C\nStorage = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n## convert the division to multiplication\nmodel.addCons(obj * Storage == Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C))\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 10000)\n## The manufacturer has a storage capacity of 500 units across all products.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to decide how many trucks to allocate to each warehouse to optimize delivery efficiency.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach warehouse has different delivery demands and efficiencies. Warehouse 1 has a delivery efficiency of 5 deliveries per truck per day, Warehouse 2 has 7 deliveries per truck per day, and Warehouse 3 has 6 deliveries per truck per day. The company aims to minimize the total delivery time to meet the daily demand of 100 deliveries.\n// The delivery time for warehouse 1: D1 = 100 / (5 * T1)\n// The delivery time for warehouse 2: D2 = 100 / (7 * T2)\n// The delivery time for warehouse 3: D3 = 100 / (6 * T3)\n// So, the objective function is: Minimize max(D1, D2, D3)\n\n## Generate Constraint-1:\nThe company has a total of 15 trucks available for allocation.\n// T1 + T2 + T3 <= 15\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 6 trucks at a time.\n// T1 <= 6; T2 <= 6; T3 <= 6",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to decide how many trucks to allocate to each warehouse to optimize delivery efficiency. Each warehouse has different delivery demands and efficiencies: Warehouse 1 has a delivery efficiency of 5 deliveries per truck per day, Warehouse 2 has 7 deliveries per truck per day, and Warehouse 3 has 6 deliveries per truck per day. The company aims to minimize the total delivery time to meet the daily demand of 100 deliveries. The company has a total of 15 trucks available for allocation, and each warehouse can handle a maximum of 6 trucks at a time.\nPlease help the company to minimize the maximum delivery time among the three warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nD1 = 100 / (5 * T1)\nD2 = 100 / (7 * T2)\nD3 = 100 / (6 * T3)\n## convert the division to multiplication\nmodel.addCons(obj >= D1)\nmodel.addCons(obj >= D2)\nmodel.addCons(obj >= D3)\n\n# Add constraints\n## The company has a total of 15 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 <= 15)\n## Each warehouse can handle a maximum of 6 trucks at a time.\nmodel.addCons(T1 <= 6)\nmodel.addCons(T2 <= 6)\nmodel.addCons(T3 <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Minimized Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000\n\n## Generate Constraint-2:\nThe total production capacity across all devices is limited to 2000 units.\n// S + T + L <= 2000\n\n## Generate Constraint-3:\nThe market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\n// S >= 500; T >= 300; L >= 400",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced. The total production capacity across all devices is limited to 2000 units.\nThe market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n# The production capacity allows for a maximum of 1000 units of any single device type to be produced.\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n# The total production capacity across all devices is limited to 2000 units.\nmodel.addCons(S + T + L <= 2000)\n# The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\nmodel.addCons(S >= 500)\nmodel.addCons(T >= 300)\nmodel.addCons(L >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. \nFor S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. \nFor S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300.\nThe manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n// Net_Revenue_S1 = (100 * S1 - 60 * S1) / 200\n// Net_Revenue_S2 = (120 * S2 - 70 * S2) / 250\n// Net_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n// So, the objective function is: Maximize (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $10,000 for production costs.\n// 60 * S1 + 70 * S2 + 90 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\n// S1 + S2 + S3 <= 150\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce. For S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. For S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. For S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300. The manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year). The manufacturer has a limited production budget of $10,000 for production costs. The manufacturer has a production capacity of 150 units in terms of the number of units it can produce. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1. Please help the manufacturer determine the optimal quantities of S1, S2, and S3 to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0)  # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0)  # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_S1 = (100 * S1 - 60 * S1) / 200\nNet_Revenue_S2 = (120 * S2 - 70 * S2) / 250\nNet_Revenue_S3 = (150 * S3 - 90 * S3) / 300\nEnergy_Efficiency = 200 * S1 + 250 * S2 + 300 * S3\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Efficiency == Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n# Add constraints\n## The manufacturer has a limited production budget of $10,000 for production costs.\nmodel.addCons(60 * S1 + 70 * S2 + 90 * S3 <= 10000)\n## The manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\nmodel.addCons(S1 + S2 + S3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Net Revenue per Unit of Energy Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of hours to allocate to each component to maximize efficiency.\n// {\"number of hours for component A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"real\"}\n// {\"number of hours for component B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"real\"}\n// {\"number of hours for component C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of producing each component varies with the number of hours spent. For component A, the efficiency is given by the function E_A = 100 * HA^0.5. For component B, the efficiency is E_B = 150 * HB^0.5. For component C, the efficiency is E_C = 200 * HC^0.5. The plant aims to maximize the total efficiency of all components.\n// So, the objective function is: Maximize E_A + E_B + E_C = 100 * HA^0.5 + 150 * HB^0.5 + 200 * HC^0.5\n\n## Generate Constraint-1:\nThe total available hours for production are 100 hours.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe plant must allocate at least 10 hours to each component.\n// HA >= 10; HB >= 10; HC >= 10",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of hours to allocate to each component to maximize efficiency. The efficiency of producing each component varies with the number of hours spent. For component A, the efficiency is given by the function E_A = 100 * HA^0.5. For component B, the efficiency is E_B = 150 * HB^0.5. For component C, the efficiency is E_C = 200 * HC^0.5. The plant aims to maximize the total efficiency of all components. The total available hours for production are 100 hours. The plant must allocate at least 10 hours to each component. Please help the plant to determine the optimal allocation of hours to each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must allocate at least 10 hours to each component.\nHA = model.addVar(vtype=\"CONTINUOUS\", name=\"HA\", lb=10) # number of hours for component A\nHB = model.addVar(vtype=\"CONTINUOUS\", name=\"HB\", lb=10) # number of hours for component B\nHC = model.addVar(vtype=\"CONTINUOUS\", name=\"HC\", lb=10) # number of hours for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize E_A + E_B + E_C = 100 * HA^0.5 + 150 * HB^0.5 + 200 * HC^0.5\n## convert the square root to a power of 0.5\nE_A = 100 * HA**0.5\nE_B = 150 * HB**0.5\nE_C = 200 * HC**0.5\nmodel.addCons(obj == E_A + E_B + E_C)\n\n# Add constraints\n## The total available hours for production are 100 hours.\nmodel.addCons(HA + HB + HC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hours for Component A: \", model.getVal(HA))\n    print(\"Number of Hours for Component B: \", model.getVal(HB))\n    print(\"Number of Hours for Component C: \", model.getVal(HC))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least 20 units to be effective.\n// DosageC >= 20\n\n## Generate Constraint-4:\nThe company has a budget constraint that limits the total dosage cost to $10,000. The cost per unit of dosage for DrugA is $50, for DrugB is $60, and for DrugC is $70.\n// 50 * DosageA + 60 * DosageB + 70 * DosageC <= 10,000",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. The effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. The effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. The company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. The dosage of DrugA must be at least twice the dosage of DrugB. The dosage of DrugC must be at least 20 units to be effective. The company has a budget constraint that limits the total dosage cost to $10,000, where the cost per unit of dosage for DrugA is $50, for DrugB is $60, and for DrugC is $70. Please help the company determine the optimal dosage levels for each drug.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\n# The total dosage across all drugs must not exceed 150 units to ensure safety.\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\n# Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\nmodel.addCons(DosageA >= 2 * DosageB)\n# The dosage of DrugC must be at least 20 units to be effective.\nmodel.addCons(DosageC >= 20)\n# The company has a budget constraint that limits the total dosage cost to $10,000.\nmodel.addCons(50 * DosageA + 60 * DosageB + 70 * DosageC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1075,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse.\n// {\"number of goods in warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost.\n// The objective function is: Minimize (C1 + C2 + C3) = Minimize (0.05 * W1^2 + 0.03 * W2^2 + 0.04 * W3^2)\n\n## Generate Constraint-1:\nThe total number of goods available for distribution is 1000 units.\n// W1 + W2 + W3 = 1000",
        "question": "A company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse. The transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost.\n\nThe total number of goods available for distribution is 1000 units. Please help the company determine the optimal number of goods to be stored in each warehouse (W1, W2, W3) to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of goods in warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of goods in warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of goods in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 0.05 * W1**2\nC2 = 0.03 * W2**2\nC3 = 0.04 * W3**2\n## the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The total number of goods available for distribution is 1000 units.\nmodel.addCons(W1 + W2 + W3 == 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Goods in Warehouse 1: \", model.getVal(W1))\n    print(\"Number of Goods in Warehouse 2: \", model.getVal(W2))\n    print(\"Number of Goods in Warehouse 3: \", model.getVal(W3))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 759,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300\n\n## Generate Constraint-3:\nThe company has a total production capacity of 600 units across all chemicals.\n// A + B + C <= 600",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of each chemical and the additional profit for increased production beyond certain thresholds are as follows:\n\n| Chemical | Base Profit per Unit | Additional Profit per Unit (beyond threshold) | Threshold |\n|----------|----------------------|---------------------------------------------|-----------|\n| A        | $10                  | $0.02 for every 10 units beyond 100 units   | 100 units  |\n| B        | $15                  | $0.03 for every 15 units beyond 150 units   | 150 units  |\n| C        | $20                  | $0.01 for every 20 units beyond 200 units   | 200 units  |\n\nThe company has a total of 1000 kg of raw material available, with each chemical requiring a specific amount of raw material: Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company also has storage capacity limits: Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units. Additionally, the company has a total production capacity of 600 units across all chemicals.\n\nPlease help the company to maximize the total profit from the production of these chemicals while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # quantity of chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1413,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints.\n// {\"production rate of ChemicalA\": \"ChemicalARate\", \"range\": \"ChemicalARate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalB\": \"ChemicalBRate\", \"range\": \"ChemicalBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalC\": \"ChemicalCRate\", \"range\": \"ChemicalCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals.\n// Total profit for ChemicalA: Profit_ChemicalA = 50 * ChemicalARate\n// Total profit for ChemicalB: Profit_ChemicalB = 70 * ChemicalBRate\n// Total profit for ChemicalC: Profit_ChemicalC = 90 * ChemicalCRate\n// So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n## Generate Constraint-1:\nThe total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\n// ChemicalARate + ChemicalBRate + ChemicalCRate <= 100",
        "question": "A manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals. The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity. Please help the company determine the optimal production rates for ChemicalA, ChemicalB, and ChemicalC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalARate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalARate\", lb=0) # production rate of ChemicalA\nChemicalBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBRate\", lb=0) # production rate of ChemicalB\nChemicalCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCRate\", lb=0) # production rate of ChemicalC\n\n# Define objective function\nProfit_ChemicalA = 50 * ChemicalARate\nProfit_ChemicalB = 70 * ChemicalBRate\nProfit_ChemicalC = 90 * ChemicalCRate\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n# Add constraints\nmodel.addCons(ChemicalARate + ChemicalBRate + ChemicalCRate <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemicalA: \", model.getVal(ChemicalARate))\n    print(\"Production Rate of ChemicalB: \", model.getVal(ChemicalBRate))\n    print(\"Production Rate of ChemicalC: \", model.getVal(ChemicalCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 654,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit.\n// Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\n// Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\n// Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre and the costs for water and fertilizer for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Water Cost per Acre | Fertilizer Cost per Acre |\n|----------|-----------------|---------------------|--------------------------|\n| Wheat    | $300            | $10 (up to 10 acres), $15 (beyond 10 acres) | $20 (up to 15 acres), $25 (beyond 15 acres) |\n| Corn     | $400            | $15 (up to 10 acres), $22.5 (beyond 10 acres) | $25 (up to 15 acres), $31.25 (beyond 15 acres) |\n| Soybeans | $250            | $5 (up to 10 acres), $7.5 (beyond 10 acres) | $15 (up to 15 acres), $18.75 (beyond 15 acres) |\n\nThe farmer's total available land is 50 acres. The water and fertilizer costs increase by 50% and 25% respectively for areas larger than 10 and 15 acres. The farmer wants to maximize his total profit. Please help the farmer determine the optimal area of land to allocate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_W\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0, ub=10)\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=10, ub=15)\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=15, ub=50)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nW_b3 = model.addVar(vtype=\"B\", name=\"W_b3\")\nmodel.addCons(W_b1 + W_b2 + W_b3 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2 + W3*W_b3)\nWaterCost_W1 = 10 * W1 * W_b1\nWaterCost_W2 = 10 * 1.5 * W2 * W_b2\nWaterCost_W3 = 10 * 1.5 * W3 * W_b3\nFertilizerCost_W1 = 20 * W1 * W_b1\nFertilizerCost_W2 = 20 * 1.25 * W2 * W_b2\nFertilizerCost_W3 = 20 * 1.25 * W3 * W_b3\nProfit_W = 300 * W - (WaterCost_W1 + WaterCost_W2 + WaterCost_W3) - (FertilizerCost_W1 + FertilizerCost_W2 + FertilizerCost_W3)\n\n## create piecewise variables for piecewise function: Profit_C\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=10, ub=15)\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=15, ub=50)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nC_b3 = model.addVar(vtype=\"B\", name=\"C_b3\")\nmodel.addCons(C_b1 + C_b2 + C_b3 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2 + C3*C_b3)\nWaterCost_C1 = 15 * C1 * C_b1\nWaterCost_C2 = 15 * 1.5 * C2 * C_b2\nWaterCost_C3 = 15 * 1.5 * C3 * C_b3\nFertilizerCost_C1 = 25 * C1 * C_b1\nFertilizerCost_C2 = 25 * 1.25 * C2 * C_b2\nFertilizerCost_C3 = 25 * 1.25 * C3 * C_b3\nProfit_C = 400 * C - (WaterCost_C1 + WaterCost_C2 + WaterCost_C3) - (FertilizerCost_C1 + FertilizerCost_C2 + FertilizerCost_C3)\n\n## create piecewise variables for piecewise function: Profit_S\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=10, ub=15)\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=15, ub=50)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nS_b3 = model.addVar(vtype=\"B\", name=\"S_b3\")\nmodel.addCons(S_b1 + S_b2 + S_b3 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2 + S3*S_b3)\nWaterCost_S1 = 5 * S1 * S_b1\nWaterCost_S2 = 5 * 1.5 * S2 * S_b2\nWaterCost_S3 = 5 * 1.5 * S3 * S_b3\nFertilizerCost_S1 = 15 * S1 * S_b1\nFertilizerCost_S2 = 15 * 1.25 * S2 * S_b2\nFertilizerCost_S3 = 15 * 1.25 * S3 * S_b3\nProfit_S = 250 * S - (WaterCost_S1 + WaterCost_S2 + WaterCost_S3) - (FertilizerCost_S1 + FertilizerCost_S2 + FertilizerCost_S3)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\nmodel.addCons(W + C + S <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(W))\n    print(\"Area of land for Corn: \", model.getVal(C))\n    print(\"Area of land for Soybeans: \", model.getVal(S))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20\n\n## Generate Constraint-3:\nThe water supply limits the total land that can be used for corn and barley to 60 acres.\n// C + B <= 60\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn.\n// B <= 0.5 * C",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence. The water supply limits the total land that can be used for corn and barley to 60 acres. The farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn. Please help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with nonlinear terms\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n## The water supply limits the total land that can be used for corn and barley to 60 acres.\nmodel.addCons(C + B <= 60)\n## The farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn.\nmodel.addCons(B <= 0.5 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while maintaining service quality. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. The service quality is measured by the total capacity of all trucks, where each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company wants to maximize the service quality (capacity) while minimizing the operational cost.\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\n// Total capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n// So, the objective function is: Minimize (Cost / Capacity)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 per day for operational costs.\n// 500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20,000\n\n## Generate Constraint-2:\nThe total number of trucks available is 30.\n// TruckA + TruckB + TruckC <= 30\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckA <= 2 * TruckB\n\n## Generate Constraint-4:\nThe company must ensure that at least 5 trucks of each type are deployed to maintain basic service levels.\n// TruckA >= 5; TruckB >= 5; TruckC >= 5",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy. The operational cost per day and the capacity of each type of truck are given in the following Table.\n\n| Vehicle Type | Operational Cost per Day | Capacity (units) |\n|--------------|--------------------------|------------------|\n| TruckA       | $500                     | 10               |\n| TruckB       | $700                     | 15               |\n| TruckC       | $1000                    | 20               |\n\nThe company has a budget of $20,000 per day for operational costs. The total number of trucks available is 30. Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB. The company must ensure that at least 5 trucks of each type are deployed to maintain basic service levels. \n\nPlease help the company to minimize the total operational cost while maximizing the service quality (capacity), which is defined as the ratio of the total operational cost to the total capacity of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=5) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=5) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=5) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n## the objective function is: Minimize (Cost / Capacity)\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $20,000 per day for operational costs.\nmodel.addCons(500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20000)\n## The total number of trucks available is 30.\nmodel.addCons(TruckA + TruckB + TruckC <= 30)\n## Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\nmodel.addCons(TruckA <= 2 * TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n// Profit_A = (5 * 100 * A) - (200 * A)\n// Profit_B = (8 * 120 * B) - (300 * B)\n// Profit_C = (10 * 150 * C) - (400 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for cultivation.\n// A + B + C <= 100",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\nThe farmer has a total of 100 hectares available for cultivation.\nPlease help the farmer determine the optimal allocation of hectares to each crop to maximize the net profit per hectare.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 * A) - (200 * A)\nProfit_B = (8 * 120 * B) - (300 * B)\nProfit_C = (10 * 150 * C) - (400 * C)\nTotalHectares = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalHectares\n## convert the division to multiplication\nmodel.addCons(obj * TotalHectares == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits.\n// {\"number of units of ComponentA\": \"ComponentATeams\", \"range\": \"ComponentATeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBTeams\", \"range\": \"ComponentBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCTeams\", \"range\": \"ComponentCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company wants to maximize the total profit.\n// Profit for ComponentA: Profit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\n// Profit for ComponentB: Profit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\n// Profit for ComponentC: Profit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBTeams <= 2 * ComponentATeams",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits. The profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company has a total production capacity of 1000 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentATeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentATeams\", lb=0) # number of units of ComponentA\nComponentBTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentBTeams\", lb=0) # number of units of ComponentB\nComponentCTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentCTeams\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\nProfit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\nProfit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000)\n## Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\nmodel.addCons(ComponentBTeams <= 2 * ComponentATeams)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(ComponentATeams))\n    print(\"Number of ComponentB: \", model.getVal(ComponentBTeams))\n    print(\"Number of ComponentC: \", model.getVal(ComponentCTeams))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n// Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n// Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n// Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints. The profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit. The company has a total production capacity of 1000 units per week. Please help the company determine the optimal number of units of each component to produce to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n## Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n## Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n## Convert square root to a variable to handle non-linearity\nsqrt_UnitsA = model.addVar(name=\"sqrt_UnitsA\")\nsqrt_UnitsB = model.addVar(name=\"sqrt_UnitsB\")\nsqrt_UnitsC = model.addVar(name=\"sqrt_UnitsC\")\nmodel.addCons(sqrt_UnitsA * sqrt_UnitsA == UnitsA)\nmodel.addCons(sqrt_UnitsB * sqrt_UnitsB == UnitsB)\nmodel.addCons(sqrt_UnitsC * sqrt_UnitsC == UnitsC)\n\nProfitA = (50 - 20 * sqrt_UnitsA) * UnitsA\nProfitB = (70 - 30 * sqrt_UnitsB) * UnitsB\nProfitC = (90 - 40 * sqrt_UnitsC) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The market demand for each device is uncertain, but the manufacturer wants to maximize the total profit while considering the risk of overproduction. The risk is defined as the square of the difference between production and estimated demand.\n// Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n// Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n// So, the objective function is: Maximize Profit - Risk\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for production.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000\n\n## Generate Constraint-2:\nThe estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\n// Smartphones >= 0.5 * 200\n// Tablets >= 0.5 * 150\n// Laptops >= 0.5 * 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The manufacturer has a budget of $50,000 for production. The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units. The manufacturer wants to ensure at least 50% of the estimated demand is met for each device. The market demand for each device is uncertain, but the manufacturer wants to maximize the total profit while considering the risk of overproduction, which is defined as the square of the difference between production and estimated demand.\nPlease help the manufacturer to maximize the total profit while minimizing the risk of overproduction.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\n\n# Define objective function\n## Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n## Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n## So, the objective function is: Maximize Profit - Risk\nProfit = 0.20 * 100 * Smartphones + 0.15 * 200 * Tablets + 0.10 * 300 * Laptops\nRisk = (Smartphones - 200)**2 + (Tablets - 150)**2 + (Laptops - 100)**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Risk)\n\n# Add constraints\n## The manufacturer has a budget of $50,000 for production.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000)\n## The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\nmodel.addCons(Smartphones >= 0.5 * 200)\nmodel.addCons(Tablets >= 0.5 * 150)\nmodel.addCons(Laptops >= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit - Risk: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units.\n// Total profit: Profit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for automation and marketing combined.\n// Automation + MarketingBudget <= 200000\n\n## Generate Constraint-2:\nThe company must produce at least 1000 units to meet the minimum order requirements from key clients.\n// Units >= 1000\n\n## Generate Constraint-3:\nThe marketing budget cannot exceed 50% of the total budget allocated for automation and marketing.\n// MarketingBudget <= 0.5 * (Automation + MarketingBudget)",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product. The cost of production per unit decreases by $5 for every $100,000 invested in automation, with an initial production cost per unit of $100 and a selling price per unit of $150. The company aims to maximize the total profit from the production and sales of the units.\n\nThe company has a total budget of $200,000 for automation and marketing combined. It must produce at least 1000 units to meet the minimum order requirements from key clients. Additionally, the marketing budget cannot exceed 50% of the total budget allocated for automation and marketing.\n\nPlease help the company determine the optimal number of units to produce, the level of automation, and the marketing budget to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=1000)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation + MarketingBudget <= 200000)  # total budget for automation and marketing\nmodel.addCons(MarketingBudget <= 0.5 * (Automation + MarketingBudget))  # marketing budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component involves different costs and profits. Component A has a production cost of $20 and a selling price of $30. Component B has a production cost of $25 and a selling price of $35. Component C has a production cost of $30 and a selling price of $40. The production time for each unit of A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The company aims to maximize the profit-to-production time ratio.\n// Profit of A: Profit_A = (30 - 20) * A\n// Profit of B: Profit_B = (35 - 25) * B\n// Profit of C: Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20 * A + 25 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 hours.\n// A + 2 * B + 3 * C <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure a minimum production of 100 units for each component.\n// A >= 100; B >= 100; C >= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit. The production cost, selling price, and production time for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Production Time |\n|-----------|-----------------|---------------|-----------------|\n| A         | $20             | $30           | 1 hour          |\n| B         | $25             | $35           | 2 hours         |\n| C         | $30             | $40           | 3 hours         |\n\nThe company has a budget of $10,000 for production costs. The company has a production capacity of 500 hours. The company wants to ensure a minimum production of 100 units for each component. \nPlease help the company to maximize the profit-to-production time ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure a minimum production of 100 units for each component.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=100) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 20) * A\nProfit_B = (35 - 25) * B\nProfit_C = (40 - 30) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 10000)\n## The company has a production capacity of 500 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Production Time Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\n// Total energy output: Output = (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage)\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarPanels + 2000 * WindTurbines <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage technology cannot exceed $50,000.\n// EnergyStorage <= 50000\n\n## Generate Constraint-3:\nThe region has space for a maximum of 500 solar panels and 300 wind turbines.\n// SolarPanels <= 500; WindTurbines <= 300\n\n## Generate Constraint-4:\nThe minimum requirement for renewable energy production is 50,000 kWh.\n// (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage) >= 50000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods. The energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\n\n| Component                | Output per Unit | Cost per Unit |\n|--------------------------|-----------------|---------------|\n| Solar Panels             | 100 kWh         | $1000         |\n| Wind Turbines            | 200 kWh         | $2000         |\n| Energy Storage Investment| N/A             | N/A           |\n\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage technology cannot exceed $50,000. The region has space for a maximum of 500 solar panels and 300 wind turbines. The minimum requirement for renewable energy production is 50,000 kWh.\n\nPlease help the company to maximize the total energy output after accounting for the reduced loss due to energy storage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=500)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=300)  # number of wind turbines\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)  # investment in energy storage\n\n# Define objective function\nOutput = model.addVar('Output')\nmodel.setObjective(Output, \"maximize\")\nmodel.addCons(Output == (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage))\n\n# Add constraints\nmodel.addCons(1000 * SolarPanels + 2000 * WindTurbines <= 1000000)  # budget constraint\nmodel.addCons(EnergyStorage <= 50000)  # investment in energy storage constraint\nmodel.addCons(SolarPanels <= 500)  # space constraint for solar panels\nmodel.addCons(WindTurbines <= 300)  # space constraint for wind turbines\nmodel.addCons((100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage) >= 50000)  # minimum energy production requirement\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage: \", model.getVal(EnergyStorage))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1382,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. The farmer wants to maximize his total profit. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The objective is to maximize the total profit, which is given by:\n// Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare.\n// 5W + 7C + 6B <= 1500\n\n## Generate Constraint-3:\nDue to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn.\n// W <= 50\n// C <= 60\n\n## Generate Constraint-4:\nThe farmer must plant at least 10 hectares of barley to maintain the soil quality.\n// B >= 10",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit. The profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The total area available for planting is 100 hectares. The farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare. Due to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn. The farmer must also plant at least 10 hectares of barley to maintain the soil quality. Please help the farmer to maximize his total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0)  # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0)  # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0)  # amount of barley\n\n# Define objective function\nProfit = 10 * 0.8 * W + 15 * 0.9 * C + 12 * 0.7 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total area available for planting is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n# The farmer has a limited budget for seeds and fertilizers, which is $1500.\nmodel.addCons(5 * W + 7 * C + 6 * B <= 1500)\n# Due to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn.\nmodel.addCons(W <= 50)\nmodel.addCons(C <= 60)\n# The farmer must plant at least 10 hectares of barley to maintain the soil quality.\nmodel.addCons(B >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale. Specifically, the profit function is given by P = Q^2, where P is the profit and Q is the quantity produced.\n// Profit_C1 = (100 * C1)^2\n// Profit_C2 = (150 * C2)^2\n// Profit_C3 = (200 * C3)^2\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 300 units.\n// C1 + C2 + C3 <= 300\n\n## Generate Constraint-3:\nThe production of C1 requires a specific catalyst that is limited to 100 units.\n// C1 <= 100",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale, where the profit function is given by P = Q^2, with P being the profit and Q being the quantity produced. The plant has a limited amount of raw material that can produce a total of 500 units of chemicals. The storage capacity of the plant is limited to 300 units. The production of C1 requires a specific catalyst that is limited to 100 units. Please help the plant to maximize the total profit from the production of C1, C2, and C3.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n## Profit_C1 = (100 * C1)^2\n## Profit_C2 = (150 * C2)^2\n## Profit_C3 = (200 * C3)^2\nProfit_C1 = (100 * C1)**2\nProfit_C2 = (150 * C2)**2\nProfit_C3 = (200 * C3)**2\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\nmodel.addCons(C1 + C2 + C3 <= 500)\n## The storage capacity of the plant is limited to 300 units.\nmodel.addCons(C1 + C2 + C3 <= 300)\n## The production of C1 requires a specific catalyst that is limited to 100 units.\nmodel.addCons(C1 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company wants to maximize the total net profit.\n// Total revenue for product A: Revenue_A = 50 * ProductA\n// Total revenue for product B: Revenue_B = 70 * ProductB\n// Total revenue for product C: Revenue_C = 90 * ProductC\n// Total cost for product A: Cost_A = 1000 + 2 * (ProductA)^2\n// Total cost for product B: Cost_B = 1500 + 1.5 * (ProductB)^2\n// Total cost for product C: Cost_C = 2000 + (ProductC)^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 10,000 cubic feet. Each unit of product A requires 10 cubic feet, product B requires 15 cubic feet, and product C requires 20 cubic feet.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $90. The production cost for each product increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company wants to maximize the total net profit.\n\n| Product | Profit per Unit | Storage Space Required per Unit |\n|---------|-----------------|---------------------------------|\n| A       | $50             | 10 cubic feet                   |\n| B       | $70             | 15 cubic feet                   |\n| C       | $90             | 20 cubic feet                   |\n\nThe company has a limited storage capacity of 10,000 cubic feet. Each unit of product A requires 10 cubic feet, product B requires 15 cubic feet, and product C requires 20 cubic feet.\n\nPlease help the company to determine the optimal production quantity for each product to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue and cost for each product\nRevenue_A = 50 * ProductA\nRevenue_B = 70 * ProductB\nRevenue_C = 90 * ProductC\nCost_A = 1000 + 2 * (ProductA**2)\nCost_B = 1500 + 1.5 * (ProductB**2)\nCost_C = 2000 + (ProductC**2)\n## Total net profit\nNetProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\n## The company has a limited storage capacity of 10,000 cubic feet.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// S + T + L <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit from each device varies with the number of units produced due to economies of scale and market saturation, as described in the following Table.\n\n| Device     | Profit Function                |\n|------------|--------------------------------|\n| Smartphones| P_S = 100S - 0.1S^2           |\n| Tablets    | P_T = 150T - 0.2T^2           |\n| Laptops    | P_L = 200L - 0.3L^2           |\n\nThe objective is to maximize the total profit, which is the sum of the profits from each device. The total production capacity of the factory is limited to 1000 units per month. Please help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = 100 * S - 0.1 * S**2\nP_T = 150 * T - 0.2 * T**2\nP_L = 200 * L - 0.3 * L**2\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 947,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production quantity of Product 1 must be at least 1,000 units.\n// Product1 >= 1000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity of three different products and the level of automation to implement in the production process. The profit margin and the effect of automation on production costs are detailed in the following table.\n\n| Product | Profit Margin per Unit | Effect of Automation on Production Cost |\n|---------|------------------------|----------------------------------------|\n| 1       | $10                    | $0.5 reduction per $1,000 invested    |\n| 2       | $15                    | $0.5 reduction per $1,000 invested    |\n| 3       | $20                    | $0.5 reduction per $1,000 invested    |\n\nThe company has a total production capacity of 10,000 units across all products. The total investment in automation cannot exceed $50,000. The production quantity of Product 1 must be at least 1,000 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=1000)  # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0)  # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0)  # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)  # total production capacity constraint\nmodel.addCons(Automation <= 50000)  # investment in automation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit_Corn = 300 * C - 100 * C\n// Profit_Wheat = 250 * W - 80 * W\n// Profit_Soybeans = 200 * S - 60 * S\n// So, the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / (500 * C + 400 * W + 300 * S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C + W + S <= 100",
        "question": "A farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop. The profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|------------|-----------------|----------------------|---------------------|\n| Corn       | $300            | 500 gallons          | $100                |\n| Wheat      | $250            | 400 gallons          | $80                 |\n| Soybeans   | $200            | 300 gallons          | $60                 |\n\nThe farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage). The farmer has a total of 100 acres available for cultivation.\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Corn\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of Wheat\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (300 - 100) * C\nProfit_Wheat = (250 - 80) * W\nProfit_Soybeans = (200 - 60) * S\nWaterUsage = 500 * C + 400 * W + 300 * S\n## the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C + W + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit. The profit per hour for each component on each production line is given in the following Table.\n\n| Production Line | Component A Profit/Hour | Component B Profit/Hour | Component C Profit/Hour |\n|-----------------|-------------------------|-------------------------|-------------------------|\n| 1               | $100                    | $150                    | $200                    |\n| 2               | $120                    | $180                    | $220                    |\n| 3               | $140                    | $200                    | $240                    |\n\nThe company aims to maximize the total profit from producing these components. The total operating hours for all production lines cannot exceed 100 hours per week. Please help the company determine the optimal number of hours to operate each production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize PA + PB + PC\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"fertilizer per acre for wheat\": \"Fertilizer_Wheat\", \"range\": \"Fertilizer_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for corn\": \"Fertilizer_Corn\", \"range\": \"Fertilizer_Corn >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for soybeans\": \"Fertilizer_Soybeans\", \"range\": \"Fertilizer_Soybeans >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of wheat per acre increases by 100 kg for every kg of fertilizer used, up to a maximum of 5000 kg per acre. The yield of corn per acre increases by 150 kg for every kg of fertilizer used, up to a maximum of 6000 kg per acre. The yield of soybeans per acre increases by 80 kg for every kg of fertilizer used, up to a maximum of 4000 kg per acre. The farm aims to maximize the total yield of all crops.\n// Total yield of wheat: Yield_Wheat = (100 * Fertilizer_Wheat) * Wheat\n// Total yield of corn: Yield_Corn = (150 * Fertilizer_Corn) * Corn\n// Total yield of soybeans: Yield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n// So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n## Generate Constraint-1:\nThe total amount of fertilizer available for the season is 10,000 kg.\n// Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000\n\n## Generate Constraint-2:\nThe farm has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-3:\nThe farm wants to ensure that at least 20% of the total acres are dedicated to each crop.\n// Wheat >= 0.2 * (Wheat + Corn + Soybeans)\n// Corn >= 0.2 * (Wheat + Corn + Soybeans)\n// Soybeans >= 0.2 * (Wheat + Corn + Soybeans)\n\n## Generate Constraint-4:\nThe farm has a budget of $50,000 for fertilizer, with the cost of fertilizer per kg being $5.\n// 5 * (Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans) <= 50000",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans, as well as the amount of fertilizer to use per acre for each crop to optimize yield. The relationship between fertilizer use and yield per acre for each crop is shown in the following Table.\n\n| Crop       | Yield Increase per kg of Fertilizer | Maximum Yield per Acre |\n|------------|-------------------------------------|-----------------------|\n| Wheat      | 100 kg                              | 5000 kg               |\n| Corn       | 150 kg                              | 6000 kg               |\n| Soybeans   | 80 kg                               | 4000 kg               |\n\nThe farm aims to maximize the total yield of all crops. The total amount of fertilizer available for the season is 10,000 kg. The farm has a total of 100 acres available for planting. The farm wants to ensure that at least 20% of the total acres are dedicated to each crop. The farm has a budget of $50,000 for fertilizer, with the cost of fertilizer per kg being $5.\n\nPlease help the farm determine the optimal allocation of acres and fertilizer to maximize the total yield of all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of soybeans\nFertilizer_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Wheat\", lb=0)  # fertilizer per acre for wheat\nFertilizer_Corn = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Corn\", lb=0)  # fertilizer per acre for corn\nFertilizer_Soybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Soybeans\", lb=0)  # fertilizer per acre for soybeans\n\n# Define objective function\nYield_Wheat = (100 * Fertilizer_Wheat) * Wheat\nYield_Corn = (150 * Fertilizer_Corn) * Corn\nYield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n# So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n# Add constraints\n# The total amount of fertilizer available for the season is 10,000 kg.\nmodel.addCons(Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000)\n# The farm has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The farm wants to ensure that at least 20% of the total acres are dedicated to each crop.\nmodel.addCons(Wheat >= 0.2 * (Wheat + Corn + Soybeans))\nmodel.addCons(Corn >= 0.2 * (Wheat + Corn + Soybeans))\nmodel.addCons(Soybeans >= 0.2 * (Wheat + Corn + Soybeans))\n# The farm has a budget of $50,000 for fertilizer, with the cost of fertilizer per kg being $5.\nmodel.addCons(5 * (Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans) <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Fertilizer per acre for Wheat: \", model.getVal(Fertilizer_Wheat))\n    print(\"Fertilizer per acre for Corn: \", model.getVal(Fertilizer_Corn))\n    print(\"Fertilizer per acre for Soybeans: \", model.getVal(Fertilizer_Soybeans))\n    print(\"Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space.\n// {\"number of solar panels in region 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000.\n// Total energy production: Energy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\n// Total investment cost: Cost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n// The objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe total investment cost must not exceed $100,000.\n// 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space. The energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000. Please help the company to maximize the total energy production while ensuring the total investment cost does not exceed $100,000.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels in region 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines in region 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels in region 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines in region 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels in region 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines in region 3\n\n# Define objective function\nEnergy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\nCost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n# The objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The total investment cost must not exceed $100,000.\nmodel.addCons(1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines in Region 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels in Region 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines in Region 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels in Region 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines in Region 3: \", model.getVal(W3))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 716,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops.\n// Revenue from Crop A: R_A = 500 * A * 2\n// Revenue from Crop B: R_B = 700 * B * 3\n// Revenue from Crop C: R_C = 600 * C * 2.5\n// So, the objective function is: Maximize R_total = R_A + R_B + R_C\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100",
        "question": "A farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop. The farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops. The farmer has a total of 100 acres available for planting. Please help the farmer determine the optimal allocation of acres to each crop to maximize his revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\nR_A = 500 * A * 2\nR_B = 700 * B * 3\nR_C = 600 * C * 2.5\nR_total = R_A + R_B + R_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_total)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 634,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 2,000 units.\n// PA >= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products. The company has a budget of $50,000 for investment in energy efficiency. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 2,000 units. Please help the company determine the optimal production quantities and investment in energy efficiency to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=2000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $50,000 for investment in energy efficiency.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company aims to maximize the total profit while considering the efficiency of production time.\n// Profit_P1 = 30 * Q1 - 10 * Q1\n// Profit_P2 = 40 * Q2 - 15 * Q2\n// Profit_P3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints.\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company aims to maximize the total profit while considering the efficiency of production time.\nThe company has a total production time of 200 hours. The company also has a budget of $10,000 for production costs.\nPlease help the company to maximize the total profit while considering the efficiency of production time, defined as the sum of the profit per unit minus the production cost per unit, divided by the sum of the production times.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (30 - 10) * Q1\nProfit_P2 = (40 - 15) * Q2\nProfit_P3 = (50 - 20) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C).\n// {\"number of Machinery A units\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery B units\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery C units\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n// Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n// Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing and maintaining the machinery.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000",
        "question": "A manufacturing company is planning to optimize its production by investing in three different types of machinery: Machinery A, Machinery B, and Machinery C. The company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n\n| Machinery | Production Capacity Increase | Maintenance Cost per Unit |\n|-----------|------------------------------|---------------------------|\n| A         | 10%                          | $500                      |\n| B         | 15%                          | $700                      |\n| C         | 20%                          | $1000                     |\n\nThe company has a budget of $50,000 for purchasing and maintaining the machinery. Please help the company determine the optimal number of units of each type of machinery to maximize the net production capacity after deducting the maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineryA = model.addVar(vtype=\"INTEGER\", name=\"MachineryA\", lb=0) # number of Machinery A units\nMachineryB = model.addVar(vtype=\"INTEGER\", name=\"MachineryB\", lb=0) # number of Machinery B units\nMachineryC = model.addVar(vtype=\"INTEGER\", name=\"MachineryC\", lb=0) # number of Machinery C units\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n## Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n## So, the objective function is: Maximize (Capacity - Cost)\nCapacity = 0.1 * MachineryA + 0.15 * MachineryB + 0.2 * MachineryC\nCost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing and maintaining the machinery.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machinery A: \", model.getVal(MachineryA))\n    print(\"Number of Machinery B: \", model.getVal(MachineryB))\n    print(\"Number of Machinery C: \", model.getVal(MachineryC))\n    print(\"Maximized Net Production Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of smartphones\": \"Q_smartphone\", \"range\": \"Q_smartphone >= 0\", \"type\": \"integer\"}\n// {\"production quantity of tablets\": \"Q_tablet\", \"range\": \"Q_tablet >= 0\", \"type\": \"integer\"}\n// {\"production quantity of laptops\": \"Q_laptop\", \"range\": \"Q_laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices.\n// So, the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// Q_smartphone + Q_tablet + Q_laptop <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n// Q_smartphone >= 100; Q_tablet >= 50\n\n## Generate Constraint-3:\nDue to labor constraints, the production of laptops cannot exceed 200 units per month.\n// Q_laptop <= 200",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor. The profit from each device varies with the quantity produced due to economies of scale and market saturation, and is given by the following profit functions:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\n\nThe company aims to maximize the total profit from all devices. The total production capacity of the factory is limited to 1000 units per month. The company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets. Due to labor constraints, the production of laptops cannot exceed 200 units per month.\n\nPlease help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_smartphone = model.addVar(vtype=\"INTEGER\", name=\"Q_smartphone\", lb=100) # production quantity of smartphones\nQ_tablet = model.addVar(vtype=\"INTEGER\", name=\"Q_tablet\", lb=50) # production quantity of tablets\nQ_laptop = model.addVar(vtype=\"INTEGER\", name=\"Q_laptop\", lb=0, ub=200) # production quantity of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n## Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n## Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\n## The objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\nP_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone**2\nP_tablet = 150 * Q_tablet - 0.02 * Q_tablet**2\nP_laptop = 200 * Q_laptop - 0.03 * Q_laptop**2\nmodel.addCons(obj == P_smartphone + P_tablet + P_laptop)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(Q_smartphone + Q_tablet + Q_laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Smartphones: \", model.getVal(Q_smartphone))\n    print(\"Production Quantity of Tablets: \", model.getVal(Q_tablet))\n    print(\"Production Quantity of Laptops: \", model.getVal(Q_laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n// Total operational cost for WarehouseA: Cost_A = TrucksA * (50)^2\n// Total operational cost for WarehouseB: Cost_B = TrucksB * (70)^2\n// Total operational cost for WarehouseC: Cost_C = TrucksC * (60)^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations. The operational cost per truck is a function of the number of trucks and the distance each truck travels, given by the formula: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n\n| Warehouse | Distance to Main Distribution Center |\n|-----------|--------------------------------------|\n| WarehouseA | 50 km                                |\n| WarehouseB | 70 km                                |\n| WarehouseC | 60 km                                |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to minimize the total operational cost, which is the sum of the operational costs for each warehouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for WarehouseC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = TrucksA * (50**2)\nCost_B = TrucksB * (70**2)\nCost_C = TrucksC * (60**2)\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations.\n// {\"production rate of MachineA\": \"MachineARate\", \"range\": \"MachineARate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBRate\", \"range\": \"MachineBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCRate\", \"range\": \"MachineCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit from all machines.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineARate\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBRate\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCRate\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day across all machine types.\n// MachineARate + MachineBRate + MachineCRate <= 100",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit from all machines. The company has a total production capacity of 100 units per day across all machine types. Please help the company to determine the optimal production rates for MachineA, MachineB, and MachineC to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineARate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineARate\", lb=0) # production rate of MachineA\nMachineBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBRate\", lb=0) # production rate of MachineB\nMachineCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCRate\", lb=0) # production rate of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 300) * MachineARate\nProfit_MachineB = (700 - 400) * MachineBRate\nProfit_MachineC = (900 - 500) * MachineCRate\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total production capacity of 100 units per day across all machine types.\nmodel.addCons(MachineARate + MachineBRate + MachineCRate <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineARate))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBRate))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 670,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse.\n// {\"number of goods in warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost.\n// The objective function is: Minimize (C1 + C2 + C3) = Minimize (0.05 * W1^2 + 0.03 * W2^2 + 0.04 * W3^2)\n\n## Generate Constraint-1:\nThe total number of goods available for distribution is 1000 units.\n// W1 + W2 + W3 = 1000",
        "question": "A company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse. The transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost. The total number of goods available for distribution is 1000 units. Please help the company determine the optimal number of goods to be stored in each warehouse to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of goods in warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of goods in warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of goods in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nC1 = 0.05 * W1**2\nC2 = 0.03 * W2**2\nC3 = 0.04 * W3**2\n## the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The total number of goods available for distribution is 1000 units.\nmodel.addCons(W1 + W2 + W3 == 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Goods in Warehouse 1: \", model.getVal(W1))\n    print(\"Number of Goods in Warehouse 2: \", model.getVal(W2))\n    print(\"Number of Goods in Warehouse 3: \", model.getVal(W3))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility.\n// {\"number of technicians at facility 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company produces 3 types of solar panels at the 3 facilities. \nAt facility 1, each technician can produce 10 units of solar panel 1, 15 units of solar panel 2, and 20 units of solar panel 3 per day. \nAt facility 2, each technician can produce 15 units of solar panel 1, 20 units of solar panel 2, and 25 units of solar panel 3 per day. \nAt facility 3, each technician can produce 20 units of solar panel 1, 25 units of solar panel 2, and 30 units of solar panel 3 per day. \nThe company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. Please determine the minimum production time to meet the monthly demand.\n// The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n// The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n// The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are total 60 technicians available.\n// T1 + T2 + T3 <= 60\n\n## Generate Constraint-2:\nEach facility can be staffed by up to 25 technicians at a time.\n// T1 <= 25; T2 <= 25; T3 <= 25",
        "question": "A company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility. The production capacity of each technician at each facility is given in the following Table.\n\n| Facility | Solar Panel 1 | Solar Panel 2 | Solar Panel 3 |\n|----------|---------------|---------------|---------------|\n| 1        | 10 units      | 15 units      | 20 units      |\n| 2        | 15 units      | 20 units      | 25 units      |\n| 3        | 20 units      | 25 units      | 30 units      |\n\nThe company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. There are total 60 technicians available, and each facility can be staffed by up to 25 technicians at a time. \nPlease help the company determine the minimum production time to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of technicians at facility 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of technicians at facility 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of technicians at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n## The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n## The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nProduction1 = 10 * T1 + 15 * T2 + 20 * T3\nProduction2 = 15 * T1 + 20 * T2 + 25 * T3\nProduction3 = 20 * T1 + 25 * T2 + 30 * T3\nmodel.addCons(obj >= 300 / Production1)\nmodel.addCons(obj >= 450 / Production2)\nmodel.addCons(obj >= 600 / Production3)\n\n# Add constraints\n## There are total 60 technicians available.\nmodel.addCons(T1 + T2 + T3 <= 60)\n## Each facility can be staffed by up to 25 technicians at a time.\nmodel.addCons(T1 <= 25)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Technicians at Facility 1: \", model.getVal(T1))\n    print(\"Number of Technicians at Facility 2: \", model.getVal(T2))\n    print(\"Number of Technicians at Facility 3: \", model.getVal(T3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-3:\nThe demand for smartphones is at least 300 units per hour.\n// 10 * Smartphone >= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The total number of workers available is 50. The manufacturer has a budget constraint that limits the total production cost to $1000 per hour. The demand for smartphones is at least 300 units per hour. Please help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(10 * Smartphone >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\n// {\"number of crops in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 units of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 units of energy. \nThe farm aims to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.\n// Profit from greenhouse A: Profit_A = 50 * A\n// Profit from greenhouse B: Profit_B = 70 * B\n// Profit from greenhouse C: Profit_C = 90 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A^2 + 3 * B^2 + 4 * C^2)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available for all greenhouses.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of energy available for all greenhouses.\n// A + 2 * B + 3 * C <= 50\n\n## Generate Constraint-3:\nThe farm wants to ensure that at least 5 crops are grown in each greenhouse.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 unit of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 unit of energy. \nThe farm has a total of 100 units of water available for all greenhouses. The farm also has a total of 50 units of energy available for all greenhouses. The farm wants to ensure that at least 5 crops are grown in each greenhouse.\nPlease help the farm to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to ensure that at least 5 crops are grown in each greenhouse.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of crops in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of crops in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of crops in greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nResourceUsage = 2 * A**2 + 3 * B**2 + 4 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available for all greenhouses.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of energy available for all greenhouses.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Crops in Greenhouse A: \", model.getVal(A))\n    print(\"Number of Crops in Greenhouse B: \", model.getVal(B))\n    print(\"Number of Crops in Greenhouse C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n// Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n// Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 1,000 units of each product are produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $30                   |\n| ProductB | $70             | $30                   |\n| ProductC | $90             | $30                   |\n\nThe company has a total production capacity of 10,000 units across all products. The investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company wants to ensure that at least 1,000 units of each product are produced.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000) # production quantity for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n## Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n## Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\nProfit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\nProfit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The revenue from component A: R_A = 50 * A\n// The revenue from component B: R_B = 70 * B\n// The revenue from component C: R_C = 60 * C\n// The production cost for component A: C_A = 0.01 * A^2\n// The production cost for component B: C_B = 0.02 * B^2\n// The production cost for component C: C_C = 0.015 * C^2\n// So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe availability of a critical raw material limits the production of component A to at most 50 units.\n// A <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n\n| Component | Profit per Unit | Production Cost Formula |\n|-----------|-----------------|-------------------------|\n| A         | $50             | 0.01 * A^2              |\n| B         | $70             | 0.02 * B^2              |\n| C         | $60             | 0.015 * C^2             |\n\nThe total production capacity is limited to 100 units per day. The availability of a critical raw material limits the production of component A to at most 50 units. Please help the company to determine the optimal number of units of each component to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\nR_A = 50 * A\nR_B = 70 * B\nR_C = 60 * C\nC_A = 0.01 * A**2\nC_B = 0.02 * B**2\nC_C = 0.015 * C**2\nProfit_A = R_A - C_A\nProfit_B = R_B - C_B\nProfit_C = R_C - C_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1219,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $20 per unit.\nThe profit per unit of product B is $30, with a simpler production process costing $10 per unit.\nThe profit per unit of product C is $40, with an intermediate production process costing $15 per unit.\nThe company wants to maximize the total net profit, which is the difference between the total profit and the total production cost.\n// Total profit: Profit = 50 * A + 30 * B + 40 * C\n// Total production cost: Cost = 20 * A + 10 * B + 15 * C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours.\n// 2 * A + 1 * B + 1.5 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe company must produce at least twice as many units of product B as product A due to a contractual agreement.\n// B >= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and the production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time | Production Cost per Unit |\n|---------|-----------------|-----------------|--------------------------|\n| A       | $50             | 2 hours         | $20                      |\n| B       | $30             | 1 hour          | $10                      |\n| C       | $40             | 1.5 hours       | $15                      |\n\nThe company has a limited production capacity of 1000 hours per week. The market demand for product A is at least 100 units per week. The company must produce at least twice as many units of product B as product A due to a contractual agreement. \n\nPlease help the company to maximize the total net profit, which is the difference between the total profit and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 30 * B + 40 * C\n## Total production cost: Cost = 20 * A + 10 * B + 15 * C\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 30 * B + 40 * C\nCost = 20 * A + 10 * B + 15 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 1 * B + 1.5 * C <= 1000)\n## The market demand for product A is at least 100 units per week.\nmodel.addCons(A >= 100)\n## The company must produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products.\n// Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for both products combined.\n// Prod1 + Prod2 <= 10000\n\n## Generate Constraint-2:\nThe investment in the new technology cannot exceed $50,000.\n// TechInvest <= 50000",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products. The company has a total production capacity of 10,000 units for both products combined. The investment in the new technology cannot exceed $50,000. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=0) # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0) # production quantity of Product 2\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in production technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\nmodel.addCons(obj == (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for both products combined.\nmodel.addCons(Prod1 + Prod2 <= 10000)\n## The investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Investment in Production Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of hours to allocate to each component to maximize efficiency.\n// {\"number of hours for component A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"real\"}\n// {\"number of hours for component B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"real\"}\n// {\"number of hours for component C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of producing each component varies with the number of hours spent. For component A, the efficiency is given by the function E_A = 100 * HA^0.5. For component B, the efficiency is E_B = 150 * HB^0.5. For component C, the efficiency is E_C = 200 * HC^0.5. The plant aims to maximize the total efficiency of all components.\n// So, the objective function is: Maximize E_A + E_B + E_C = 100 * HA^0.5 + 150 * HB^0.5 + 200 * HC^0.5\n\n## Generate Constraint-1:\nThe total available hours for production are 100 hours.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe plant must allocate at least 10 hours to each component.\n// HA >= 10; HB >= 10; HC >= 10\n\n## Generate Constraint-3:\nThe plant must allocate no more than 50% of the total hours to any single component.\n// HA <= 0.5 * 100; HB <= 0.5 * 100; HC <= 0.5 * 100",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of hours to allocate to each component to maximize efficiency. The efficiency of producing each component varies with the number of hours spent. For component A, the efficiency is given by the function E_A = 100 * HA^0.5. For component B, the efficiency is E_B = 150 * HB^0.5. For component C, the efficiency is E_C = 200 * HC^0.5. The plant aims to maximize the total efficiency of all components.\n\nThe total available hours for production are 100 hours. The plant must allocate at least 10 hours to each component. Additionally, the plant must allocate no more than 50% of the total hours to any single component.\n\nPlease help the plant to maximize the total efficiency of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must allocate at least 10 hours to each component.\nHA = model.addVar(vtype=\"CONTINUOUS\", name=\"HA\", lb=10) # number of hours for component A\nHB = model.addVar(vtype=\"CONTINUOUS\", name=\"HB\", lb=10) # number of hours for component B\nHC = model.addVar(vtype=\"CONTINUOUS\", name=\"HC\", lb=10) # number of hours for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize E_A + E_B + E_C = 100 * HA^0.5 + 150 * HB^0.5 + 200 * HC^0.5\n## convert the square root to a power of 0.5\nE_A = 100 * HA**0.5\nE_B = 150 * HB**0.5\nE_C = 200 * HC**0.5\nmodel.addCons(obj == E_A + E_B + E_C)\n\n# Add constraints\n## The total available hours for production are 100 hours.\nmodel.addCons(HA + HB + HC <= 100)\n## The plant must allocate no more than 50% of the total hours to any single component.\nmodel.addCons(HA <= 0.5 * 100)\nmodel.addCons(HB <= 0.5 * 100)\nmodel.addCons(HC <= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hours for Component A: \", model.getVal(HA))\n    print(\"Number of Hours for Component B: \", model.getVal(HB))\n    print(\"Number of Hours for Component C: \", model.getVal(HC))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute three types of products. The company needs to determine the optimal number of workers to assign to each warehouse to maximize efficiency and minimize costs.\n// {\"number of workers at warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker at warehouse 1 can process 10 units of product 1, 15 units of product 2, and 20 units of product 3 per hour. \nEach worker at warehouse 2 can process 20 units of product 1, 25 units of product 2, and 30 units of product 3 per hour. \nEach worker at warehouse 3 can process 30 units of product 1, 35 units of product 2, and 40 units of product 3 per hour. \nThe company needs to ensure that at least 300 units of product 1, 450 units of product 2, and 600 units of product 3 are processed daily. The goal is to minimize the total hours required to meet these daily targets.\n// The processing time for product 1: T1 = 300 / (10 * W1 + 20 * W2 + 30 * W3)\n// The processing time for product 2: T2 = 450 / (15 * W1 + 25 * W2 + 35 * W3)\n// The processing time for product 3: T3 = 600 / (20 * W1 + 30 * W2 + 40 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 <= 60",
        "question": "A company operates three different warehouses that store and distribute three types of products. The company needs to determine the optimal number of workers to assign to each warehouse to maximize efficiency and minimize costs. Each worker at warehouse 1 can process 10 units of product 1, 15 units of product 2, and 20 units of product 3 per hour. Each worker at warehouse 2 can process 20 units of product 1, 25 units of product 2, and 30 units of product 3 per hour. Each worker at warehouse 3 can process 30 units of product 1, 35 units of product 2, and 40 units of product 3 per hour. The company needs to ensure that at least 300 units of product 1, 450 units of product 2, and 600 units of product 3 are processed daily. The goal is to minimize the total hours required to meet these daily targets. There are a total of 60 workers available. Please help the company to minimize the maximum of the processing times for each product type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers at warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers at warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The processing time for product 1: T1 = 300 / (10 * W1 + 20 * W2 + 30 * W3)\n## The processing time for product 2: T2 = 450 / (15 * W1 + 25 * W2 + 35 * W3)\n## The processing time for product 3: T3 = 600 / (20 * W1 + 30 * W2 + 40 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * W1 + 20 * W2 + 30 * W3) == 300)\nmodel.addCons(T2 * (15 * W1 + 25 * W2 + 35 * W3) == 450)\nmodel.addCons(T3 * (20 * W1 + 30 * W2 + 40 * W3) == 600)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers at Warehouse 1: \", model.getVal(W1))\n    print(\"Number of Workers at Warehouse 2: \", model.getVal(W2))\n    print(\"Number of Workers at Warehouse 3: \", model.getVal(W3))\n    print(\"Minimum Total Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 800 units.\n// S + T <= 800",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L. The total production capacity of the factory is limited to 1000 units per month. The market demand for smartphones and tablets combined should not exceed 800 units. Please help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nP_S = 100 * S - 0.1 * S**2\nP_T = 150 * T - 0.2 * T**2\nP_L = 200 * L - 0.3 * L**2\n## the objective function is: Maximize P_total = P_S + P_T + P_L\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n## The market demand for smartphones and tablets combined should not exceed 800 units.\nmodel.addCons(S + T <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities for each product to optimize their profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 5A^2, for product B is 10B^2, and for product C is 15C^2. The company aims to maximize its total profit.\n// Profit of A: Profit_A = 20A - 5A^2\n// Profit of B: Profit_B = 30B - 10B^2\n// Profit of C: Profit_C = 40C - 15C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (20A - 5A^2 + 30B - 10B^2 + 40C - 15C^2)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 5A^2 + 10B^2 + 15C^2 <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units across all products.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are produced to maintain market presence.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities for each product to optimize their profit margin. The profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 5A^2, for product B is 10B^2, and for product C is 15C^2. The company aims to maximize its total profit. The company has a budget of $10,000 for production costs. The company has a storage capacity limit of 500 units across all products. The company wants to ensure that at least 50 units of each product are produced to maintain market presence. Please help the company to determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced to maintain market presence.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = 20A - 5A^2\n## Profit of B: Profit_B = 30B - 10B^2\n## Profit of C: Profit_C = 40C - 15C^2\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (20A - 5A^2 + 30B - 10B^2 + 40C - 15C^2)\nmodel.addCons(obj == 20*A - 5*A*A + 30*B - 10*B*B + 40*C - 15*C*C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(5*A*A + 10*B*B + 15*C*C <= 10000)\n## The company has a storage capacity limit of 500 units across all products.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\n// Operating hours for product A: HA = 800 / (10 * MA)\n// Operating hours for product B: HB = 1200 / (15 * MB)\n// Operating hours for product C: HC = 1600 / (20 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The production rates for each product are given in the following Table.\n\n| Product | Production Rate per Machine (units/hour) |\n|---------|------------------------------------------|\n| A       | 10                                       |\n| B       | 15                                       |\n| C       | 20                                       |\n\nThe manufacturer has a total of 50 machines available. The objective is to minimize the total operating hours required to meet these demands, where operating hours for product A is calculated as 800 divided by the product of 10 and the number of machines for product A (MA), for product B as 1200 divided by the product of 15 and the number of machines for product B (MB), and for product C as 1600 divided by the product of 20 and the number of machines for product C (MC). Please help the manufacturer to minimize the maximum of these operating hours (HA, HB, HC).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 800 / (10 * MA)\nHB = 1200 / (15 * MB)\nHC = 1600 / (20 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 800)\nmodel.addCons(HB * (15 * MB) == 1200)\nmodel.addCons(HC * (20 * MC) == 1600)\n## the objective function is: Minimize max(HA, HB, HC)\n## convert max to a variable\nmax_hours = model.addVar('max_hours')\nmodel.addCons(max_hours >= HA)\nmodel.addCons(max_hours >= HB)\nmodel.addCons(max_hours >= HC)\nmodel.addCons(obj == max_hours)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Minimum Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1210,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit.\n// {\"amount of resource 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of resources used. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of resource 1 available is 100 units.\n// R1 <= 100",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit. The profit from each product depends on the amount of resources used, and the profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n\nThe total amount of resource 1 available is 100 units.\n\nPlease help the plant manager to determine the optimal allocation of resources R1, R2, and R3 to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of resource 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of resource 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of resource 3\n\n# Define objective function\nP1 = 50 * R1**0.5 - 10 * R1\nP2 = 70 * R2**0.6 - 20 * R2\nP3 = 60 * R3**0.7 - 15 * R3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(R1 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Resource 1: \", model.getVal(R1))\n    print(\"Amount of Resource 2: \", model.getVal(R2))\n    print(\"Amount of Resource 3: \", model.getVal(R3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 682,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales.\n// {\"amount of chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"amount of vanilla cake\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"amount of strawberry cake\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for chocolate cake\": \"AdChocolate\", \"range\": \"AdChocolate >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for vanilla cake\": \"AdVanilla\", \"range\": \"AdVanilla >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for strawberry cake\": \"AdStrawberry\", \"range\": \"AdStrawberry >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe bakery knows that for every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its total daily profit.\n// Profit from chocolate cake: ProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\n// Profit from vanilla cake: ProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\n// Profit from strawberry cake: ProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\n// So, the objective function is: Maximize (ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n## Generate Constraint-1:\nThe total advertising budget for all cakes cannot exceed $1000.\n// AdChocolate + AdVanilla + AdStrawberry <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 500 cakes of each type daily.\n// Chocolate <= 500; Vanilla <= 500; Strawberry <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of cake daily.\n// Chocolate >= 100; Vanilla >= 100; Strawberry >= 100\n\n## Generate Constraint-4:\nThe bakery has a limited storage capacity, which can hold a maximum of 1200 cakes in total.\n// Chocolate + Vanilla + Strawberry <= 1200",
        "question": "A bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. For every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The following table summarizes the profit per cake and the advertising effect:\n\n| Cake Type       | Profit per Cake | Advertising Effect (per $100) |\n|-----------------|-----------------|-------------------------------|\n| Chocolate       | $5              | 5 units                       |\n| Vanilla         | $4              | 5 units                       |\n| Strawberry      | $3              | 5 units                       |\n\nThe bakery has a total advertising budget of $1000. The bakery can produce a maximum of 500 cakes of each type daily. The bakery must produce at least 100 units of each type of cake daily. The bakery has a limited storage capacity, which can hold a maximum of 1200 cakes in total. \n\nPlease help the bakery to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=100, ub=500)  # amount of chocolate cake\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=100, ub=500)  # amount of vanilla cake\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=100, ub=500)  # amount of strawberry cake\nAdChocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"AdChocolate\", lb=0)  # advertising budget for chocolate cake\nAdVanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"AdVanilla\", lb=0)  # advertising budget for vanilla cake\nAdStrawberry = model.addVar(vtype=\"CONTINUOUS\", name=\"AdStrawberry\", lb=0)  # advertising budget for strawberry cake\n\n# Define objective function\nProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\nProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\nProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n# Add constraints\nmodel.addCons(AdChocolate + AdVanilla + AdStrawberry <= 1000)  # total advertising budget constraint\nmodel.addCons(Chocolate <= 500)  # maximum production of chocolate cake\nmodel.addCons(Vanilla <= 500)  # maximum production of vanilla cake\nmodel.addCons(Strawberry <= 500)  # maximum production of strawberry cake\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 1200)  # total storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Chocolate Cake: \", model.getVal(Chocolate))\n    print(\"Amount of Vanilla Cake: \", model.getVal(Vanilla))\n    print(\"Amount of Strawberry Cake: \", model.getVal(Strawberry))\n    print(\"Advertising Budget for Chocolate Cake: \", model.getVal(AdChocolate))\n    print(\"Advertising Budget for Vanilla Cake: \", model.getVal(AdVanilla))\n    print(\"Advertising Budget for Strawberry Cake: \", model.getVal(AdStrawberry))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. However, due to soil degradation, the profit per hectare decreases by 0.1% for each additional hectare of the same crop grown. The farm aims to maximize the total profit from all crops.\n// Profit_A = (1000 - 0.001 * A^2) * A\n// Profit_B = (1500 - 0.001 * B^2) * B\n// Profit_C = (2000 - 0.001 * C^2) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to water availability, the total water usage for all crops must not exceed 1500 cubic meters. Each hectare of crop A requires 10 cubic meters, crop B requires 15 cubic meters, and crop C requires 20 cubic meters.\n// 10 * A + 15 * B + 20 * C <= 1500",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage. The profit per hectare for each crop decreases by 0.1% for each additional hectare of the same crop grown. The profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. The farm aims to maximize the total profit from all crops.\n\n| Crop | Profit per Hectare | Water Usage per Hectare |\n|------|---------------------|-------------------------|\n| A    | $1000               | 10 cubic meters        |\n| B    | $1500               | 15 cubic meters        |\n| C    | $2000               | 20 cubic meters        |\n\nThe farm has a total of 100 hectares available for cultivation. Due to water availability, the total water usage for all crops must not exceed 1500 cubic meters. \n\nPlease help the farm to determine the optimal allocation of hectares to each crop to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (1000 - 0.001 * A^2) * A\n## Profit_B = (1500 - 0.001 * B^2) * B\n## Profit_C = (2000 - 0.001 * C^2) * C\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == (1000 - 0.001 * A**2) * A + (1500 - 0.001 * B**2) * B + (2000 - 0.001 * C**2) * C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## Due to water availability, the total water usage for all crops must not exceed 1500 cubic meters.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of two different products, Product A and Product B, and the amount of money to be invested in a new technology that reduces production costs.\n// {\"production level of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost of each unit by $2 for every $10,000 invested. The initial production cost for Product A is $50 per unit and for Product B is $70 per unit. The selling price for Product A is $100 per unit and for Product B is $120 per unit. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\n// Total profit for Product B: ProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\n// So, the objective function is: Maximize TotalProfit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of two different products, Product A and Product B, and the amount of money to be invested in a new technology that reduces production costs. The new technology reduces the production cost of each unit by $2 for every $10,000 invested. The initial production cost for Product A is $50 per unit and for Product B is $70 per unit. The selling price for Product A is $100 per unit and for Product B is $120 per unit. The company aims to maximize the total profit from both products.\n\n| Product | Selling Price | Initial Production Cost |\n|---------|---------------|--------------------------|\n| A       | 100$          | 50$                      |\n| B       | 120$          | 70$                      |\n\nThe company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. The company must produce at least 200 units of Product A.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200)  # production level of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production level of Product B\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\n## Total profit for Product A: ProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\n## Total profit for Product B: ProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\n## So, the objective function is: Maximize TotalProfit = ProfitA + ProfitB\nProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\nProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(ProductA + ProductB <= 1000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProductA))\n    print(\"Production Level of Product B: \", model.getVal(ProductB))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\n// {\"number of acres for CropA\": \"AcresA\", \"range\": \"AcresA >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"AcresB\", \"range\": \"AcresB >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"AcresC\", \"range\": \"AcresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\n// Net profit for CropA: Profit_A = (500 - 100) * AcresA\n// Net profit for CropB: Profit_B = (700 - 150) * AcresB\n// Net profit for CropC: Profit_C = (900 - 200) * AcresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2000 * AcresA + 3000 * AcresB + 4000 * AcresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// AcresA + AcresB + AcresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, CropA must be planted on at least twice as many acres as CropB.\n// AcresA >= 2 * AcresB\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * AcresA + 150 * AcresB + 200 * AcresC <= 15,000",
        "question": "A farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, CropA must be planted on at least twice as many acres as CropB. The farm has a budget of $15,000 for labor costs for the season.\nPlease help the farm to maximize the net profit per gallon of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAcresA = model.addVar(vtype=\"INTEGER\", name=\"AcresA\", lb=0) # number of acres for CropA\nAcresB = model.addVar(vtype=\"INTEGER\", name=\"AcresB\", lb=0) # number of acres for CropB\nAcresC = model.addVar(vtype=\"INTEGER\", name=\"AcresC\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * AcresA\nProfit_B = (700 - 150) * AcresB\nProfit_C = (900 - 200) * AcresC\nWaterUsage = 2000 * AcresA + 3000 * AcresB + 4000 * AcresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(AcresA + AcresB + AcresC <= 100)\n## Due to soil conditions, CropA must be planted on at least twice as many acres as CropB.\nmodel.addCons(AcresA >= 2 * AcresB)\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * AcresA + 150 * AcresB + 200 * AcresC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(AcresA))\n    print(\"Number of Acres for CropB: \", model.getVal(AcresB))\n    print(\"Number of Acres for CropC: \", model.getVal(AcresC))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor. The profit, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit |\n|---------|-----------------|----------------------------|---------------------|\n| A       | $50             | $20                        | $10                 |\n| B       | $70             | $30                        | $15                 |\n| C       | $90             | $40                        | $20                 |\n\nThe company has a budget of $10,000 for raw materials. Please help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from product A: PA = 50 * A - (20 * A + 10 * A)\nPA = 50 * A - (20 * A + 10 * A)\n## Profit from product B: PB = 70 * B - (30 * B + 15 * B)\nPB = 70 * B - (30 * B + 15 * B)\n## Profit from product C: PC = 90 * C - (40 * C + 20 * C)\nPC = 90 * C - (40 * C + 20 * C)\n## So, the objective function is: Maximize (PA + PB + PC)\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per month.\n// B >= 150\n\n## Generate Constraint-4:\nThe company cannot produce more than 300 units of product C due to limited raw material availability.\n// C <= 300\n\n## Generate Constraint-5:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n\nThe total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month. The market demand for product B is at least 150 units per month. The company cannot produce more than 300 units of product C due to limited raw material availability. The company must produce at least twice as many units of product A as product B.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300)  # number of units of product C\n\n# Define objective function\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nNetProfit = Revenue - Cost\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)  # Total production capacity constraint\nmodel.addCons(A >= 2 * B)  # Production ratio constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The cost per acre for crop A is $100, for crop B is $150, and for crop C is $200. The farmer aims to maximize the total yield while considering the cost-effectiveness of each crop. The objective is to maximize the total yield minus a penalty term that increases with the total cost.\n// Yield of crop A: Yield_A = 5 * A\n// Yield of crop B: Yield_B = 7 * B\n// Yield of crop C: Yield_C = 9 * C\n// Total cost: Cost = 100 * A + 150 * B + 200 * C\n// Penalty term: Penalty = 0.01 * Cost^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - Penalty\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $15,000 for cultivation costs.\n// 100 * A + 150 * B + 200 * C <= 15000\n\n## Generate Constraint-3:\nAt least 20 acres must be allocated to crop A to maintain a certain market presence.\n// A >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints. The yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The cost per acre for crop A is $100, for crop B is $150, and for crop C is $200. The farmer aims to maximize the total yield while considering the cost-effectiveness of each crop. The objective is to maximize the total yield minus a penalty term that increases with the total cost.\nThe farm has a total of 100 acres available for cultivation. The farmer has a budget of $15,000 for cultivation costs. At least 20 acres must be allocated to crop A to maintain a certain market presence.\nPlease help the farmer to maximize the total yield minus the penalty term.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nCost = 100 * A + 150 * B + 200 * C\nPenalty = 0.01 * Cost**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Penalty)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(100 * A + 150 * B + 200 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit.\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product type depends on the labor hours invested. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3 = 100 * L1^0.7 + 150 * L2^0.6 + 200 * L3^0.5\n\n## Generate Constraint-1:\nThe total labor hours available for all products is 1000 hours.\n// L1 + L2 + L3 <= 1000\n\n## Generate Constraint-2:\nThe company has a policy to allocate at least 20% of the total labor hours to product 1.\n// L1 >= 0.2 * (L1 + L2 + L3)",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit. The profit from each product type depends on the labor hours invested:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products. The total labor hours available for all products is 1000 hours. The company has a policy to allocate at least 20% of the total labor hours to product 1.\nPlease help the company determine the optimal allocation of labor hours (L1, L2, L3) to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for product 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for product 3\n\n# Define objective function\n## The profit from each product type depends on the labor hours invested.\nP1 = 100 * L1**0.7\nP2 = 150 * L2**0.6\nP3 = 200 * L3**0.5\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total labor hours available for all products is 1000 hours.\nmodel.addCons(L1 + L2 + L3 <= 1000)\n## The company has a policy to allocate at least 20% of the total labor hours to product 1.\nmodel.addCons(L1 >= 0.2 * (L1 + L2 + L3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours for Product 1: \", model.getVal(L1))\n    print(\"Labor hours for Product 2: \", model.getVal(L2))\n    print(\"Labor hours for Product 3: \", model.getVal(L3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 703,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery, with an initial production cost per unit of $100 and a selling price per unit of $150. The company aims to maximize the total profit from all units produced.\n\n| Variable                     | Description                                      |\n|------------------------------|--------------------------------------------------|\n| Number of units to produce   | Determines the quantity of products to be made   |\n| Amount of overtime hours     | Additional hours beyond regular schedule         |\n| Investment in advanced machinery | Funds allocated to enhance production efficiency |\n\nThe company has a maximum capacity of 1000 units that can be produced in the quarter. The total investment in advanced machinery cannot exceed $50,000.\n\nPlease help the company determine the optimal number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0) # number of units to produce\nOvertime = model.addVar(vtype=\"INTEGER\", name=\"Overtime\", lb=0) # amount of overtime hours\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\nProfit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 1000 units that can be produced in the quarter.\nmodel.addCons(Units <= 1000)\n## The total investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(MachineryInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Amount of Overtime Hours: \", model.getVal(Overtime))\n    print(\"Investment in Advanced Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1284,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for Wheat is 5 tons, for Corn is 6 tons, and for Soybeans is 4 tons. The price per ton of Wheat is $200, of Corn is $250, and of Soybeans is $300. The farmer wants to maximize the total revenue from the crops.\n// Revenue_Wheat = 5 * $200 * Wheat\n// Revenue_Corn = 6 * $250 * Corn\n// Revenue_Soybeans = 4 * $300 * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total available land for planting is 100 hectares.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80.\n// $100 * Wheat + $120 * Corn + $80 * Soybeans <= 15000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\n// Soybeans >= 0.3 * (Wheat + Corn + Soybeans)\n\n## Generate Constraint-4:\nThe farmer has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares due to limited labor availability.\n// Corn + Soybeans <= 60",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop. The yield per hectare for Wheat is 5 tons, for Corn is 6 tons, and for Soybeans is 4 tons. The price per ton of Wheat is $200, of Corn is $250, and of Soybeans is $300. The farmer wants to maximize the total revenue from the crops. The total available land for planting is 100 hectares. The farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80. The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health. The farmer also has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares due to limited labor availability.\nPlease help the farmer to determine the optimal allocation of land to each crop to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for Wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for Corn\nSoybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Soybeans\", lb=0) # area of land for Soybeans\n\n# Define objective function\nRevenue_Wheat = 5 * 200 * Wheat\nRevenue_Corn = 6 * 250 * Corn\nRevenue_Soybeans = 4 * 300 * Soybeans\n# So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n# The total available land for planting is 100 hectares.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The farmer has a budget constraint for fertilizers and pesticides, which is $15,000.\nmodel.addCons(100 * Wheat + 120 * Corn + 80 * Soybeans <= 15000)\n# The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\nmodel.addCons(Soybeans >= 0.3 * (Wheat + Corn + Soybeans))\n# The farmer has a labor constraint that limits the total area of Corn and Soybeans to 60 hectares due to limited labor availability.\nmodel.addCons(Corn + Soybeans <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. However, due to soil conditions, the profit per acre decreases nonlinearly as more acres are planted. Specifically, for each additional acre beyond the first 50 acres, the profit per acre decreases by 0.5% for Wheat, 0.7% for Corn, and 0.6% for Soybeans. The farmer wants to maximize the total profit from the crops.\n// Profit_Wheat = (200 - 0.5% * max(Wheat - 50, 0)) * Wheat\n// Profit_Corn = (300 - 0.7% * max(Corn - 50, 0)) * Corn\n// Profit_Soybeans = (250 - 0.6% * max(Soybeans - 50, 0)) * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe farmer has a total of 200 acres available for planting.\n// Wheat + Corn + Soybeans <= 200\n\n## Generate Constraint-2:\nThe farmer must allocate at least 30 acres to Wheat to maintain a certain level of crop diversity.\n// Wheat >= 30",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. However, due to soil conditions, the profit per acre decreases nonlinearly as more acres are planted. Specifically, for each additional acre beyond the first 50 acres, the profit per acre decreases by 0.5% for Wheat, 0.7% for Corn, and 0.6% for Soybeans. The farmer wants to maximize the total profit from the crops.\n\nThe farmer has a total of 200 acres available for planting. Additionally, the farmer must allocate at least 30 acres to Wheat to maintain a certain level of crop diversity.\n\nPlease help the farmer determine the optimal allocation of acres to Wheat, Corn, and Soybeans to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 30 acres to Wheat to maintain a certain level of crop diversity.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Wheat = (200 - 0.5% * max(Wheat - 50, 0)) * Wheat\nWheat1 = model.addVar(vtype=\"INTEGER\", name=\"Wheat1\", lb=0, ub=50)\nWheat2 = model.addVar(vtype=\"INTEGER\", name=\"Wheat2\", lb=50, ub=200)\nWheat_b1 = model.addVar(vtype=\"B\", name=\"Wheat_b1\")\nWheat_b2 = model.addVar(vtype=\"B\", name=\"Wheat_b2\")\nmodel.addCons(Wheat_b1 + Wheat_b2 == 1)\nmodel.addCons(Wheat == Wheat1*Wheat_b1 + Wheat2*Wheat_b2)\nProfit_Wheat = (200 - 0.005 * (Wheat2 - 50)) * Wheat2 * Wheat_b2\n## create piecewise variables for piecewise function: Profit_Corn = (300 - 0.7% * max(Corn - 50, 0)) * Corn\nCorn1 = model.addVar(vtype=\"INTEGER\", name=\"Corn1\", lb=0, ub=50)\nCorn2 = model.addVar(vtype=\"INTEGER\", name=\"Corn2\", lb=50, ub=200)\nCorn_b1 = model.addVar(vtype=\"B\", name=\"Corn_b1\")\nCorn_b2 = model.addVar(vtype=\"B\", name=\"Corn_b2\")\nmodel.addCons(Corn_b1 + Corn_b2 == 1)\nmodel.addCons(Corn == Corn1*Corn_b1 + Corn2*Corn_b2)\nProfit_Corn = (300 - 0.007 * (Corn2 - 50)) * Corn2 * Corn_b2\n## create piecewise variables for piecewise function: Profit_Soybeans = (250 - 0.6% * max(Soybeans - 50, 0)) * Soybeans\nSoybeans1 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans1\", lb=0, ub=50)\nSoybeans2 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans2\", lb=50, ub=200)\nSoybeans_b1 = model.addVar(vtype=\"B\", name=\"Soybeans_b1\")\nSoybeans_b2 = model.addVar(vtype=\"B\", name=\"Soybeans_b2\")\nmodel.addCons(Soybeans_b1 + Soybeans_b2 == 1)\nmodel.addCons(Soybeans == Soybeans1*Soybeans_b1 + Soybeans2*Soybeans_b2)\nProfit_Soybeans = (250 - 0.006 * (Soybeans2 - 50)) * Soybeans2 * Soybeans_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 200 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 845,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in a new technology that can improve the production efficiency of both products.\n// {\"number of units of Product 1\": \"Units1\", \"range\": \"Units1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"Units2\", \"range\": \"Units2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\n// So, the objective function is: Maximize (Profit1 + Profit2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2.\n// Units1 <= 1000; Units2 <= 800\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet contractual obligations.\n// Units1 >= 200; Units2 >= 150",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the number of units to produce for two different products, as well as the amount of money to invest in a new technology that can improve the production efficiency of both products. The initial production cost per unit, selling price per unit, and the effect of the new technology on production costs are given in the following Table.\n\n| Product | Initial Production Cost | Selling Price | Effect of Tech Investment |\n|---------|-------------------------|---------------|---------------------------|\n| 1       | $100                    | $150          | $5 reduction per $10,000  |\n| 2       | $150                    | $200          | $5 reduction per $10,000  |\n\nThe company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2. The total investment in the new technology cannot exceed $50,000. The company must also produce at least 200 units of Product 1 and 150 units of Product 2 to meet contractual obligations.\n\nPlease help the company to maximize the total profit from both products by determining the optimal number of units to produce for each product and the optimal investment in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits1 = model.addVar(vtype=\"INTEGER\", name=\"Units1\", lb=200)  # number of units of Product 1\nUnits2 = model.addVar(vtype=\"INTEGER\", name=\"Units2\", lb=150)  # number of units of Product 2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\n## Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\nProfit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\nProfit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\n## the objective function is: Maximize (Profit1 + Profit2)\nmodel.addCons(obj == Profit1 + Profit2)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2.\nmodel.addCons(Units1 <= 1000)\nmodel.addCons(Units2 <= 800)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product 1: \", model.getVal(Units1))\n    print(\"Number of Product 2: \", model.getVal(Units2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the number of each type of vehicle to maximize their efficiency while meeting certain operational constraints.\n// {\"number of small vehicles\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each vehicle type varies and is influenced by the number of vehicles in operation. The operating cost for small vehicles is $100 per vehicle, for medium vehicles is $150 per vehicle, and for large vehicles is $200 per vehicle. However, due to economies of scale, the cost per vehicle decreases by $0.5 for each additional vehicle of the same type after the first 10 vehicles. The company aims to minimize the total operating cost.\n// Cost_S = (100 - 0.5 * max(S - 10, 0)) * S\n// Cost_M = (150 - 0.5 * max(M - 10, 0)) * M\n// Cost_L = (200 - 0.5 * max(L - 10, 0)) * L\n// So, the objective function is: Minimize Cost_S + Cost_M + Cost_L\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $10,000. Each small vehicle costs $500, each medium vehicle costs $1000, and each large vehicle costs $1500.\n// 500 * S + 1000 * M + 1500 * L <= 10000\n\n## Generate Constraint-2:\nThe company has a limited number of parking spaces, with a maximum capacity of 20 vehicles.\n// S + M + L <= 20",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the number of each type of vehicle to maximize their efficiency while meeting certain operational constraints. The cost of operating each vehicle type varies and is influenced by the number of vehicles in operation. The operating cost for small vehicles is $100 per vehicle, for medium vehicles is $150 per vehicle, and for large vehicles is $200 per vehicle. However, due to economies of scale, the cost per vehicle decreases by $0.5 for each additional vehicle of the same type after the first 10 vehicles. The company aims to minimize the total operating cost. The company has a total fleet budget of $10,000. Each small vehicle costs $500, each medium vehicle costs $1000, and each large vehicle costs $1500. The company also has a limited number of parking spaces, with a maximum capacity of 20 vehicles. Please help the company to determine the optimal number of each type of vehicle to minimize the total operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of small vehicles\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of medium vehicles\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of large vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = (100 - 0.5 * max(S - 10, 0)) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=10, ub=20)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = (100 - 0.5 * (S2 - 10)) * S2 * S_b2 \n## create piecewise variables for piecewise function: Cost_M = (150 - 0.5 * max(M - 10, 0)) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=10)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=10, ub=20)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nCost_M = (150 - 0.5 * (M2 - 10)) * M2 * M_b2\n## create piecewise variables for piecewise function: Cost_L = (200 - 0.5 * max(L - 10, 0)) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=10)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=10, ub=20)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = (200 - 0.5 * (L2 - 10)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_S + Cost_M + Cost_L\nmodel.addCons(obj == Cost_S + Cost_M + Cost_L)\n\n# Add constraints\nmodel.addCons(500 * S + 1000 * M + 1500 * L <= 10000)\nmodel.addCons(S + M + L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(S))\n    print(\"Number of Medium Vehicles: \", model.getVal(M))\n    print(\"Number of Large Vehicles: \", model.getVal(L))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of E1 is $100, the production time per unit is 1 hour, and the raw material cost per unit is $40. \nFor E2, the revenue per unit is $120, the production time per unit is 2 hours, and the raw material cost per unit is $50. \nFor E3, the revenue per unit is $150, the production time per unit is 3 hours, and the raw material cost per unit is $60.\nThe manufacturer has a limited production capacity and wants to maximize the profit per hour of production time.\n// Profit_E1 = 100 * Q1 - 40 * Q1\n// Profit_E2 = 120 * Q2 - 50 * Q2\n// Profit_E3 = 150 * Q3 - 60 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $10000 for raw materials.\n// 40 * Q1 + 50 * Q2 + 60 * Q3 <= 10000\n\n## Generate Constraint-3:\nThe market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe manufacturer has a production capacity of 350 units in terms of the number of units it can produce.\n// Q1 + Q2 + Q3 <= 350",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time. The revenue per unit, production time per unit, and raw material cost per unit for each component are given in the following Table.\n\n| Component | Revenue per Unit | Production Time per Unit | Raw Material Cost per Unit |\n|-----------|------------------|--------------------------|----------------------------|\n| E1        | $100             | 1 hour                   | $40                        |\n| E2        | $120             | 2 hours                  | $50                        |\n| E3        | $150             | 3 hours                  | $60                        |\n\nThe manufacturer has a total production time of 200 hours. The manufacturer has a budget of $10000 for raw materials. The market demand for E1 is 50 units, so the manufacturer can only sell a maximum of 50 units of E1. The manufacturer has a production capacity of 350 units in terms of the number of units it can produce. \n\nPlease help the manufacturer to maximize the profit per hour of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=50)  # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0)  # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0)  # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (100 - 40) * Q1\nProfit_E2 = (120 - 50) * Q2\nProfit_E3 = (150 - 60) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n## The manufacturer has a budget of $10000 for raw materials.\nmodel.addCons(40 * Q1 + 50 * Q2 + 60 * Q3 <= 10000)\n## The market demand for E1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of E1.\nmodel.addCons(Q1 <= 50)\n## The manufacturer has a production capacity of 350 units in terms of the number of units it can produce.\nmodel.addCons(Q1 + Q2 + Q3 <= 350)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rate of each product, as well as the amount of money invested in improving the production efficiency of each product.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for product 1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5. The company aims to minimize the total production cost while meeting a certain demand.\n// Cost per unit of product 1: C1 = 100 - 0.005 * E1\n// Cost per unit of product 2: C2 = 150 - 0.005 * E2\n// Cost per unit of product 3: C3 = 200 - 0.005 * E3\n// Total production cost: Cost = C1 * P1 + C2 * P2 + C3 * P3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must meet a total demand of at least 1000 units across all products.\n// P1 + P2 + P3 >= 1000\n\n## Generate Constraint-2:\nThe total investment in efficiency improvements cannot exceed $50,000.\n// E1 + E2 + E3 <= 50000\n\n## Generate Constraint-3:\nThe production rate of each product must be at least 10 units per day.\n// P1 >= 10; P2 >= 10; P3 >= 10\n\n## Generate Constraint-4:\nThe company has a budget constraint on the investment in efficiency improvements for each product, with a maximum of $20,000 per product.\n// E1 <= 20000; E2 <= 20000; E3 <= 20000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rate of each product (P1, P2, P3) and the amount of money invested in improving the production efficiency of each product (E1, E2, E3). The cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5. The company aims to minimize the total production cost while meeting a certain demand. The company must meet a total demand of at least 1000 units across all products. The total investment in efficiency improvements cannot exceed $50,000. The production rate of each product must be at least 10 units per day. The company has a budget constraint on the investment in efficiency improvements for each product, with a maximum of $20,000 per product. Please help the company to minimize the total production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # production rate of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10) # production rate of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=10) # production rate of product 3\nE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"E1\", lb=0) # investment in efficiency for product 1\nE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"E2\", lb=0) # investment in efficiency for product 2\nE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"E3\", lb=0) # investment in efficiency for product 3\n\n# Define objective function\nC1 = 100 - 0.005 * E1\nC2 = 150 - 0.005 * E2\nC3 = 200 - 0.005 * E3\nCost = C1 * P1 + C2 * P2 + C3 * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 >= 1000) # total demand of at least 1000 units\nmodel.addCons(E1 + E2 + E3 <= 50000) # total investment in efficiency improvements cannot exceed $50,000\nmodel.addCons(E1 <= 20000) # budget constraint on investment in efficiency improvements for product 1\nmodel.addCons(E2 <= 20000) # budget constraint on investment in efficiency improvements for product 2\nmodel.addCons(E3 <= 20000) # budget constraint on investment in efficiency improvements for product 3\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of product 1: \", model.getVal(P1))\n    print(\"Production rate of product 2: \", model.getVal(P2))\n    print(\"Production rate of product 3: \", model.getVal(P3))\n    print(\"Investment in efficiency for product 1: \", model.getVal(E1))\n    print(\"Investment in efficiency for product 2: \", model.getVal(E2))\n    print(\"Investment in efficiency for product 3: \", model.getVal(E3))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production.\n// {\"amount of chemical produced in factory 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each factory is determined by a nonlinear function of the amount of chemical produced. Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n// The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all factories must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nEach factory has a maximum production capacity. Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\n// P1 <= 400; P2 <= 350; P3 <= 300",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production. The profit from each factory is determined by a nonlinear function of the amount of chemical produced: Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n\nThe total amount of chemical produced across all factories must not exceed 1000 units. Each factory also has a maximum production capacity: Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\n\nPlease help the company determine the optimal production levels for each factory to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # amount of chemical produced in factory 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced in factory 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced in factory 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\nmodel.addCons(obj == 50*P1 - 0.1*P1**2 + 60*P2 - 0.2*P2**2 + 70*P3 - 0.3*P3**2)\n\n# Add constraints\n## The total amount of chemical produced across all factories must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n## Each factory has a maximum production capacity. Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\nmodel.addCons(P1 <= 400)\nmodel.addCons(P2 <= 350)\nmodel.addCons(P3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced in factory 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced in factory 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced in factory 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnts\", \"range\": \"DeviceBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnts\", \"range\": \"DeviceCUnts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit. The company has a total production capacity of 1000 units for the month.\nPlease help the company to determine the optimal number of units to produce for each device to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnts\", lb=0) # number of units of DeviceB\nDeviceCUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnts\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (20 + 0.05 * DeviceAUnits**2)) * DeviceAUnits\nProfit_DeviceB = (70 - (30 + 0.03 * DeviceBUnts**2)) * DeviceBUnts\nProfit_DeviceC = (90 - (40 + 0.02 * DeviceCUnts**2)) * DeviceCUnts\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnts))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. However, due to soil degradation, the profit per hectare decreases by 0.1% for each additional hectare of the same crop grown. The farm aims to maximize the total profit from all crops.\n// Profit_A = (1000 - 0.001 * A^2) * A\n// Profit_B = (1500 - 0.001 * B^2) * B\n// Profit_C = (2000 - 0.001 * C^2) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to water availability, the total water usage for all crops must not exceed 1500 cubic meters. Each hectare of crop A requires 10 cubic meters, crop B requires 15 cubic meters, and crop C requires 20 cubic meters.\n// 10 * A + 15 * B + 20 * C <= 1500\n\n## Generate Constraint-3:\nThe farm must allocate at least 20 hectares to each crop to maintain crop diversity and soil health.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage. The profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. However, due to soil degradation, the profit per hectare decreases by 0.1% for each additional hectare of the same crop grown. The farm aims to maximize the total profit from all crops.\n\n| Crop | Profit per Hectare | Water Usage per Hectare |\n|------|---------------------|-------------------------|\n| A    | $1000               | 10 cubic meters        |\n| B    | $1500               | 15 cubic meters        |\n| C    | $2000               | 20 cubic meters        |\n\nThe farm has a total of 100 hectares available for cultivation. Due to water availability, the total water usage for all crops must not exceed 1500 cubic meters. The farm must allocate at least 20 hectares to each crop to maintain crop diversity and soil health.\n\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=20) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=20) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (1000 - 0.001 * A^2) * A\n## Profit_B = (1500 - 0.001 * B^2) * B\n## Profit_C = (2000 - 0.001 * C^2) * C\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == (1000 - 0.001 * A**2) * A + (1500 - 0.001 * B**2) * B + (2000 - 0.001 * C**2) * C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## Due to water availability, the total water usage for all crops must not exceed 1500 cubic meters.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * P1 = 20 * P1\n// Profit_P2 = (40 - 15) * P2 = 25 * P2\n// Profit_P3 = (50 - 20) * P3 = 30 * P3\n// So, the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\n\n## Generate Constraint-1:\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\n// P1 <= 40; P2 <= 30; P3 <= 50\n\n## Generate Constraint-3:\nThe market demand for P1 is at least 10 units, and the plant must meet this demand.\n// P1 >= 10",
        "question": "A manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50, with production costs of $10, $15, and $20 per unit respectively. The plant aims to maximize the total profit. The plant has a limited raw material supply, which allows for a maximum production of 100 units in total. The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3. The market demand for P1 is at least 10 units, and the plant must meet this demand. Please help the plant determine the optimal quantities of P1, P2, and P3 to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * P1\nProfit_P2 = 25 * P2\nProfit_P3 = 30 * P3\n## the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $10, for component B is $15, and for component C is $20. The selling price for component A is $25, for component B is $30, and for component C is $40. The plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n// Profit for component A: Profit_A = (25 - 10) * A\n// Profit for component B: Profit_B = (30 - 15) * B\n// Profit for component C: Profit_C = (40 - 20) * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 1000",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints. The production cost and selling price for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price |\n|-----------|-----------------|---------------|\n| A         | $10             | $25           |\n| B         | $15             | $30           |\n| C         | $20             | $40           |\n\nThe plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost. The plant has a budget of $1000 for production costs. Please help the plant determine the optimal number of components A, B, and C to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre.\nFor Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre.\nFor Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n// Total profit: Profit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\n// Total water usage: Water = 200 * Wheat + 250 * Corn + 150 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for seeds and fertilizers.\n// (10 * Wheat) + (12 * Corn) + (15 * Soybeans) <= 5000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 30 acres are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30\n\n## Generate Constraint-4:\nThe farmer has access to 20,000 gallons of water for irrigation.\n// 200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season. For Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre. For Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre. For Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops). The farmer has 100 acres of land available for planting. The farmer has a budget of $5000 for seeds and fertilizers. The farmer wants to ensure at least 30 acres are dedicated to each crop. The farmer has access to 20,000 gallons of water for irrigation. Please help the farmer determine the optimal number of acres to plant for each crop to maximize the Profit-Water Usage ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 acres are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # number of acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # number of acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # number of acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\nWater = 200 * Wheat + 250 * Corn + 150 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget of $5000 for seeds and fertilizers.\nmodel.addCons(10 * Wheat + 12 * Corn + 15 * Soybeans <= 5000)\n## The farmer has access to 20,000 gallons of water for irrigation.\nmodel.addCons(200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for both products is $30. The revenue generated per unit of Product A is $100 and for Product B is $150. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\n// Total profit for Product B: ProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\n// So, the objective function is: Maximize Profit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nThe production of Product A must be at least 200 units.\n// ProductA >= 200\n\n## Generate Constraint-4:\nThe production of Product B must be at least 100 units.\n// ProductB >= 100",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced. The energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for both products is $30. The revenue generated per unit of Product A is $100 and for Product B is $150. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 1000 units for both products combined. The total investment in energy efficiency upgrades cannot exceed $50,000. The production of Product A must be at least 200 units. The production of Product B must be at least 100 units.\nPlease help the company to determine the optimal production quantities for Product A and Product B, and the investment in energy efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200)  # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100)  # production quantity of Product B\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\nProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)  # total production capacity constraint\nmodel.addCons(EnergyEfficiency <= 50000)  # investment in energy efficiency constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of Solar Panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wind Turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"quantity of Electric Vehicles\": \"ElectricVehicles\", \"range\": \"ElectricVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these products.\n// Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\n// Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\n// Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\n// So, the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n// 5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000\n\n## Generate Constraint-2:\nThe market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles.\n// SolarPanels <= 300; WindTurbines <= 200; ElectricVehicles <= 150\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 500 units in total for all products.\n// SolarPanels + WindTurbines + ElectricVehicles <= 500\n\n## Generate Constraint-4:\nTo ensure a balanced product portfolio, the company wants to produce at least 10% of the total production as Electric Vehicles.\n// ElectricVehicles >= 0.1 * (SolarPanels + WindTurbines + ElectricVehicles)",
        "question": "A manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints. The profit per unit of each product decreases as production increases beyond certain thresholds, as shown in the following Table.\n\n| Product             | Profit per Unit (beyond threshold) | Decrease per Additional Unit | Threshold |\n|---------------------|-----------------------------------|------------------------------|-----------|\n| Solar Panels        | $1000                             | $0.1                         | 100 units |\n| Wind Turbines       | $1500                             | $0.2                         | 50 units  |\n| Electric Vehicles   | $2000                             | $0.3                         | 20 units  |\n\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component. The market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles. The company has a production capacity limit of 500 units in total for all products. To ensure a balanced product portfolio, the company wants to produce at least 10% of the total production as Electric Vehicles.\n\nPlease help the company to maximize the total profit from the sales of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=300)  # quantity of Solar Panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=200)  # quantity of Wind Turbines\nElectricVehicles = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles\", lb=0, ub=150)  # quantity of Electric Vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0, ub=100)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=100, ub=300)\nSolarPanels_b1 = model.addVar(vtype=\"B\", name=\"SolarPanels_b1\")\nSolarPanels_b2 = model.addVar(vtype=\"B\", name=\"SolarPanels_b2\")\nmodel.addCons(SolarPanels_b1 + SolarPanels_b2 == 1)\nmodel.addCons(SolarPanels == SolarPanels1*SolarPanels_b1 + SolarPanels2*SolarPanels_b2)\nProfit_SolarPanels = (1000 - 0.1 * SolarPanels2) * SolarPanels2 * SolarPanels_b2 + 1000 * SolarPanels1 * SolarPanels_b1\n## create piecewise variables for piecewise function: Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0, ub=50)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=50, ub=200)\nWindTurbines_b1 = model.addVar(vtype=\"B\", name=\"WindTurbines_b1\")\nWindTurbines_b2 = model.addVar(vtype=\"B\", name=\"WindTurbines_b2\")\nmodel.addCons(WindTurbines_b1 + WindTurbines_b2 == 1)\nmodel.addCons(WindTurbines == WindTurbines1*WindTurbines_b1 + WindTurbines2*WindTurbines_b2)\nProfit_WindTurbines = (1500 - 0.2 * WindTurbines2) * WindTurbines2 * WindTurbines_b2 + 1500 * WindTurbines1 * WindTurbines_b1\n## create piecewise variables for piecewise function: Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\nElectricVehicles1 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles1\", lb=0, ub=20)\nElectricVehicles2 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles2\", lb=20, ub=150)\nElectricVehicles_b1 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b1\")\nElectricVehicles_b2 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b2\")\nmodel.addCons(ElectricVehicles_b1 + ElectricVehicles_b2 == 1)\nmodel.addCons(ElectricVehicles == ElectricVehicles1*ElectricVehicles_b1 + ElectricVehicles2*ElectricVehicles_b2)\nProfit_ElectricVehicles = (2000 - 0.3 * ElectricVehicles2) * ElectricVehicles2 * ElectricVehicles_b2 + 2000 * ElectricVehicles1 * ElectricVehicles_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\nmodel.addCons(obj == Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles)\n\n# Add constraints\nmodel.addCons(5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000)\nmodel.addCons(SolarPanels + WindTurbines + ElectricVehicles <= 500)\nmodel.addCons(ElectricVehicles >= 0.1 * (SolarPanels + WindTurbines + ElectricVehicles))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Quantity of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Quantity of Electric Vehicles: \", model.getVal(ElectricVehicles))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1580,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots.\n// Profit_W1 = 300 * 0.8 * W1\n// Profit_C1 = 400 * 1.2 * C1\n// Profit_B1 = 250 * 0.9 * B1\n// So, the objective function is: Maximize (Profit_W1 + Profit_C1 + Profit_B1)\n\n## Generate Constraint-1:\nThe total area of plot 1 is 50 acres.\n// W1 + C1 + B1 <= 50\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40.\n// 50 * W1 + 70 * C1 + 40 * B1 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat from plot 1 is at least 20 acres.\n// W1 >= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 acres to barley on plot 1.\n// B1 >= 10",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots. The total area of plot 1 is 50 acres. The farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40. The market demand for wheat from plot 1 is at least 20 acres. The farmer must allocate at least 10 acres to barley on plot 1. Please help the farmer to maximize the total profit from plot 1.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of corn on plot 1\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=10) # acres of barley on plot 1\n\n# Define objective function\nProfit_W1 = 300 * 0.8 * W1\nProfit_C1 = 400 * 1.2 * C1\nProfit_B1 = 250 * 0.9 * B1\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W1 + Profit_C1 + Profit_B1)\n\n# Add constraints\nmodel.addCons(W1 + C1 + B1 <= 50) # total area of plot 1 is 50 acres\nmodel.addCons(50 * W1 + 70 * C1 + 40 * B1 <= 10000) # limited budget for seeds and fertilizer\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 1: \", model.getVal(C1))\n    print(\"Acres of Barley on Plot 1: \", model.getVal(B1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500,000\n\n## Generate Constraint-3:\nThe farm has a budget of $20,000 for fertilizer costs.\n// 200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20,000\n\n## Generate Constraint-4:\nDue to soil conditions, the area for CropA must be at least half of the area for CropB.\n// CropA_Area >= 0.5 * CropB_Area",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. For CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. For CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. The farm has a total area of 100 hectares available for cultivation. The farm has a limited water supply of 500,000 liters. The farm has a budget of $20,000 for fertilizer costs. Due to soil conditions, the area for CropA must be at least half of the area for CropB. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal allocation of area for each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=0) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=0) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=0) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500000)\n## The farm has a budget of $20,000 for fertilizer costs.\nmodel.addCons(200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20000)\n## Due to soil conditions, the area for CropA must be at least half of the area for CropB.\nmodel.addCons(CropA_Area >= 0.5 * CropB_Area)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\n// Total profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\n// Total profit for DeviceC: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 600",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit. The company has a total production capacity of 600 units for all devices combined. Please help the company determine the optimal production quantity for each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=600)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAQty == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=600)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBQty == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.2 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=600)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCQty == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 100 * DeviceC1 * DeviceC_b1 + (100 - 0.3 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh of energy per day. The cost of each wind turbine is $2000, and it generates 200 kWh of energy per day. The cost of each energy storage system is $5000, and it can store 500 kWh of energy. The company wants to minimize the total cost while maximizing the total energy generated and stored.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Storage\n// Total energy generated: Energy = 100 * Solar + 200 * Wind\n// Total energy stored: Stored = 500 * Storage\n// So, the objective function is: Minimize Cost / (Energy + Stored)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Storage <= 100000\n\n## Generate Constraint-2:\nThe company needs to generate at least 10,000 kWh of energy per day.\n// 100 * Solar + 200 * Wind >= 10000\n\n## Generate Constraint-3:\nThe company needs to store at least 5000 kWh of energy.\n// 500 * Storage >= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 50% of the budget is spent on energy storage systems.\n// 5000 * Storage <= 50% * 100000\n\n## Generate Constraint-5:\nThe company aims to have at least twice as many solar panels as wind turbines.\n// Solar >= 2 * Wind",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The cost, energy generation, and storage capacity for each type of system are given in the following Table.\n\n| System Type | Cost per Unit | Energy Generation per Day | Storage Capacity |\n|-------------|---------------|----------------------------|------------------|\n| Solar       | $1000         | 100 kWh                    | N/A              |\n| Wind        | $2000         | 200 kWh                    | N/A              |\n| Storage     | $5000         | N/A                        | 500 kWh          |\n\nThe company has a budget of $100,000 for the installation. The company needs to generate at least 10,000 kWh of energy per day and store at least 5000 kWh of energy. The company wants to ensure that no more than 50% of the budget is spent on energy storage systems. Additionally, the company aims to have at least twice as many solar panels as wind turbines.\n\nPlease help the company to minimize the total cost while maximizing the total energy generated and stored, as defined by the objective function: Minimize Cost / (Energy + Stored).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # capacity of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Storage\nEnergy = 100 * Solar + 200 * Wind\nStored = 500 * Storage\n## the objective function is: Minimize Cost / (Energy + Stored)\n## convert the division to multiplication\nmodel.addCons(obj * (Energy + Stored) == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Storage <= 100000)\n## The company needs to generate at least 10,000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind >= 10000)\n## The company needs to store at least 5000 kWh of energy.\nmodel.addCons(500 * Storage >= 5000)\n## The company wants to ensure that no more than 50% of the budget is spent on energy storage systems.\nmodel.addCons(5000 * Storage <= 0.5 * 100000)\n## The company aims to have at least twice as many solar panels as wind turbines.\nmodel.addCons(Solar >= 2 * Wind)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit.\n// The objective function is: Maximize Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe market demand for product B is at least 15 units per day.\n// B >= 15",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit from each unit of product A is $10, product B is $15, and product C is $20. However, the production process is nonlinear due to varying efficiency levels at different production volumes. The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2). The company aims to maximize this profit. The total production capacity of the company is 100 units per day. The market demand for product A is at least 20 units per day. The market demand for product B is at least 15 units per day. Please help the company determine the optimal number of units of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The profit function is given by: Profit = 10A + 15B + 20C - 0.01(A^2 + B^2 + C^2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10*A + 15*B + 20*C - 0.01*(A**2 + B**2 + C**2))\n\n# Add constraints\n## The total production capacity of the company is 100 units per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit.\n// {\"quantity of WidgetA\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetB\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetC\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets.\n// Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\n// Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\n// Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\n// So, the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all types of widgets.\n// WidgetA + WidgetB + WidgetC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetB <= 2 * WidgetA",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit. The profit per unit of each widget decreases by $0.01 for each unit produced beyond a certain threshold: 100 units for WidgetA, 150 units for WidgetB, and 200 units for WidgetC. The initial profit per unit for WidgetA is $10, for WidgetB is $15, and for WidgetC is $20.\n\n| Widget | Initial Profit per Unit | Decrease per Unit Beyond Threshold | Threshold |\n|--------|-------------------------|-----------------------------------|-----------|\n| WidgetA| 10$                     | 0.01$                             | 100 units  |\n| WidgetB| 15$                     | 0.01$                             | 150 units  |\n| WidgetC| 20$                     | 0.01$                             | 200 units  |\n\nThe company has a total production capacity of 500 units across all types of widgets. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. Please help the company to maximize the total profit from the sales of all widgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # quantity of WidgetA\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # quantity of WidgetB\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0) # quantity of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetA == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (10 - 0.01 * WidgetA2) * WidgetA2 * WidgetA_b2 + 10 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=150)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=150, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetB == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (15 - 0.01 * WidgetB2) * WidgetB2 * WidgetB_b2 + 15 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=200)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=200, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetC == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (20 - 0.01 * WidgetC2) * WidgetC2 * WidgetC_b2 + 20 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetA + WidgetB + WidgetC <= 500)\nmodel.addCons(WidgetB <= 2 * WidgetA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of WidgetA: \", model.getVal(WidgetA))\n    print(\"Quantity of WidgetB: \", model.getVal(WidgetB))\n    print(\"Quantity of WidgetC: \", model.getVal(WidgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit. The production capacity allows for a maximum of 1000 units of any single device type to be produced. Please help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 595,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120, but these values decrease nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit functions are defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The total land available for farming is 100 acres.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n## convert the division to multiplication\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for purchasing fertilizer.\n// 30 * A + 40 * B + 50 * C <= 5000\n\n## Generate Constraint-3:\nThe farmer has a storage capacity of 200 tons in total.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe market demand for Crop A is 50 tons. So, the farmer can only sell a maximum of 50 tons of Crop A.\n// A <= 50\n\n## Generate Constraint-5:\nDue to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\n// A + B + C <= 150",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. The farmer has a budget of $5000 for purchasing fertilizer. The farmer has a storage capacity of 200 tons in total. The market demand for Crop A is 50 tons. So, the farmer can only sell a maximum of 50 tons of Crop A. Due to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\nPlease help the farmer to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50)  # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)  # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)  # quantity of Crop C\n\n# Define objective function\nProfit_A = 100 * A - 30 * A\nProfit_B = 150 * B - 40 * B\nProfit_C = 200 * C - 50 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total area available for planting is 100 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n# The farmer has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n# The farmer has a storage capacity of 200 tons in total.\nmodel.addCons(A + B + C <= 200)\n# The market demand for Crop A is 50 tons.\nmodel.addCons(A <= 50)\n# Due to labor constraints, the total amount of crops that can be harvested cannot exceed 150 tons.\nmodel.addCons(A + B + C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency.\n// {\"number of machines in factory 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The company aims to maximize the total production rate of the chemical while considering the operational costs of each factory, which are nonlinear functions of the number of machines. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The objective is to maximize the net production rate, which is the total production rate minus the total operational cost.\n// The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n// The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n// The objective function is: Maximize (P - C)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total number of machines across all factories to 50.\n// M1 + M2 + M3 <= 50",
        "question": "A company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency. Each machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The company aims to maximize the net production rate, which is the total production rate minus the total operational cost.\n\n| Factory | Production Rate per Machine (units/hour) | Operational Cost per Machine (cost units) |\n|---------|------------------------------------------|------------------------------------------|\n| 1       | 10                                       | 0.1 * M1^2                              |\n| 2       | 15                                       | 0.15 * M2^2                             |\n| 3       | 20                                       | 0.2 * M3^2                              |\n\nThe company has a budget constraint that limits the total number of machines across all factories to 50. Please help the company to maximize the net production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines in factory 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines in factory 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines in factory 3\n\n# Define objective function\n## The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n## The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n## The objective function is: Maximize (P - C)\nP = 10 * M1 + 15 * M2 + 20 * M3\nC = 0.1 * M1**2 + 0.15 * M2**2 + 0.2 * M3**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - C)\n\n# Add constraints\n## The company has a budget constraint that limits the total number of machines across all factories to 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines in Factory 1: \", model.getVal(M1))\n    print(\"Number of Machines in Factory 2: \", model.getVal(M2))\n    print(\"Number of Machines in Factory 3: \", model.getVal(M3))\n    print(\"Maximized Net Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit.\n// {\"acres of Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yield rates and profit margins for each crop. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops.\n// Total profit from Wheat: Profit_Wheat = 50 * 10 * WheatAcres\n// Total profit from Corn: Profit_Corn = 60 * 12 * CornAcres\n// Total profit from Soybeans: Profit_Soybeans = 40 * 15 * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\n// CornAcres <= 40",
        "question": "A farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn. Please help the farm determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of Soybeans\n\n# Define objective function\nProfit_Wheat = 50 * 10 * WheatAcres\nProfit_Corn = 60 * 12 * CornAcres\nProfit_Soybeans = 40 * 15 * SoybeansAcres\n# So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The farm has a total of 100 acres available for cultivation.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n# Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\nmodel.addCons(CornAcres <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 698,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space.\n// {\"number of solar panels in region 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000.\n// Total energy production: Energy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\n// Total investment cost: Cost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n// The objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe total investment cost must not exceed $100,000.\n// 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70.\n// S1 + W1 <= 50; S2 + W2 <= 60; S3 + W3 <= 70",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space. The energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000. The total investment cost must not exceed $100,000. The total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70. Please help the company to maximize the total energy production while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels in region 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines in region 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels in region 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines in region 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels in region 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines in region 3\n\n# Define objective function\nEnergy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\nCost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n# The objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The total investment cost must not exceed $100,000.\nmodel.addCons(1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000)\n# The total area available for installation in each region is limited.\nmodel.addCons(S1 + W1 <= 50)\nmodel.addCons(S2 + W2 <= 60)\nmodel.addCons(S3 + W3 <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines in Region 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels in Region 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines in Region 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels in Region 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines in Region 3: \", model.getVal(W3))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n// Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\n// So, the objective function is: Maximize Revenue\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Production <= 10000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire. The company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n\n| Variable                | Description                                                                 |\n|-------------------------|-----------------------------------------------------------------------------|\n| Production              | Production quantity of the new product (integer, Production >= 0)           |\n| Advertising             | Advertising budget (continuous, Advertising >= 0)                           |\n| SalesReps               | Number of sales representatives (integer, SalesReps >= 0)                   |\n\nThe company has a production capacity limit of 10,000 units for the quarter. Please help the company determine the optimal values for Production, Advertising, and SalesReps to maximize the total sales revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0, ub=10000) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nSalesReps = model.addVar(vtype=\"INTEGER\", name=\"SalesReps\", lb=0) # number of sales representatives\n\n# Define objective function\n## The company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\nRevenue = 100 * Production + 0.5 * Advertising + 20000 * SalesReps\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Revenue\nmodel.addCons(obj == Revenue)\n\n# Add constraints\n## The company has a production capacity limit of 10,000 units for the quarter.\nmodel.addCons(Production <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Sales Representatives: \", model.getVal(SalesReps))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1410,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hydrogen\", \"range\": \"Hydrogen >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000. For Hybrid vehicles, it is $8,000. For Hydrogen vehicles, it is $12,000. Due to economies of scale, the profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The manufacturer wants to maximize the total profit from selling these vehicles.\n// Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\n// Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\n// Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\n// So, the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\n\n## Generate Constraint-1:\nThe production of each vehicle type requires a specific amount of a rare metal. Electric vehicles require 5 kg, Hybrid vehicles require 8 kg, and Hydrogen vehicles require 10 kg. The total supply of this rare metal is limited to 1000 kg.\n// 5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000\n\n## Generate Constraint-2:\nThere is a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\n// Electric <= 300; Hybrid <= 250; Hydrogen <= 200",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints. The profit per Electric vehicle is $10,000. For Hybrid vehicles, it is $8,000. For Hydrogen vehicles, it is $12,000. Due to economies of scale, the profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The production of each vehicle type requires a specific amount of a rare metal. Electric vehicles require 5 kg, Hybrid vehicles require 8 kg, and Hydrogen vehicles require 10 kg. The total supply of this rare metal is limited to 1000 kg. There is also a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units. Please help the manufacturer to maximize the total profit from selling these vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## There is a market demand constraint for each vehicle type. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0, ub=300) # quantity of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=0, ub=250) # quantity of Hybrid vehicles\nHydrogen = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen\", lb=0, ub=200) # quantity of Hydrogen vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\nElectric1 = model.addVar(vtype=\"INTEGER\", name=\"Electric1\", lb=0, ub=100)\nElectric2 = model.addVar(vtype=\"INTEGER\", name=\"Electric2\", lb=100, ub=300)\nElectric_b1 = model.addVar(vtype=\"B\", name=\"Electric_b1\")\nElectric_b2 = model.addVar(vtype=\"B\", name=\"Electric_b2\")\nmodel.addCons(Electric_b1 + Electric_b2 == 1)\nmodel.addCons(Electric == Electric1*Electric_b1 + Electric2*Electric_b2)\nProfit_Electric = 10000 * Electric1 * Electric_b1 + (10000 + 10 * (Electric2 - 100)) * Electric2 * Electric_b2\n## create piecewise variables for piecewise function: Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\nHybrid1 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid1\", lb=0, ub=100)\nHybrid2 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid2\", lb=100, ub=250)\nHybrid_b1 = model.addVar(vtype=\"B\", name=\"Hybrid_b1\")\nHybrid_b2 = model.addVar(vtype=\"B\", name=\"Hybrid_b2\")\nmodel.addCons(Hybrid_b1 + Hybrid_b2 == 1)\nmodel.addCons(Hybrid == Hybrid1*Hybrid_b1 + Hybrid2*Hybrid_b2)\nProfit_Hybrid = 8000 * Hybrid1 * Hybrid_b1 + (8000 + 10 * (Hybrid2 - 100)) * Hybrid2 * Hybrid_b2\n## create piecewise variables for piecewise function: Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\nHydrogen1 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen1\", lb=0, ub=100)\nHydrogen2 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen2\", lb=100, ub=200)\nHydrogen_b1 = model.addVar(vtype=\"B\", name=\"Hydrogen_b1\")\nHydrogen_b2 = model.addVar(vtype=\"B\", name=\"Hydrogen_b2\")\nmodel.addCons(Hydrogen_b1 + Hydrogen_b2 == 1)\nmodel.addCons(Hydrogen == Hydrogen1*Hydrogen_b1 + Hydrogen2*Hydrogen_b2)\nProfit_Hydrogen = 12000 * Hydrogen1 * Hydrogen_b1 + (12000 + 10 * (Hydrogen2 - 100)) * Hydrogen2 * Hydrogen_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\nmodel.addCons(obj == Profit_Electric + Profit_Hybrid + Profit_Hydrogen)\n\n# Add constraints\nmodel.addCons(5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Quantity of Hybrid Vehicles: \", model.getVal(Hybrid))\n    print(\"Quantity of Hydrogen Vehicles: \", model.getVal(Hydrogen))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of smartphones\": \"Q_smartphone\", \"range\": \"Q_smartphone >= 0\", \"type\": \"integer\"}\n// {\"production quantity of tablets\": \"Q_tablet\", \"range\": \"Q_tablet >= 0\", \"type\": \"integer\"}\n// {\"production quantity of laptops\": \"Q_laptop\", \"range\": \"Q_laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices.\n// So, the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// Q_smartphone + Q_tablet + Q_laptop <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n// Q_smartphone >= 100; Q_tablet >= 50\n\n## Generate Constraint-3:\nDue to labor constraints, the production of laptops cannot exceed 200 units per month.\n// Q_laptop <= 200",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor. The profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices. The total production capacity of the factory is limited to 1000 units per month. The company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets. Due to labor constraints, the production of laptops cannot exceed 200 units per month.\nPlease help the company to determine the optimal production quantities of smartphones, tablets, and laptops to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_smartphone = model.addVar(vtype=\"INTEGER\", name=\"Q_smartphone\", lb=100) # production quantity of smartphones\nQ_tablet = model.addVar(vtype=\"INTEGER\", name=\"Q_tablet\", lb=50) # production quantity of tablets\nQ_laptop = model.addVar(vtype=\"INTEGER\", name=\"Q_laptop\", lb=0, ub=200) # production quantity of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n## Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n## Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\n## The objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\nP_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone**2\nP_tablet = 150 * Q_tablet - 0.02 * Q_tablet**2\nP_laptop = 200 * Q_laptop - 0.03 * Q_laptop**2\nmodel.addCons(obj == P_smartphone + P_tablet + P_laptop)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(Q_smartphone + Q_tablet + Q_laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Smartphones: \", model.getVal(Q_smartphone))\n    print(\"Production Quantity of Tablets: \", model.getVal(Q_tablet))\n    print(\"Production Quantity of Laptops: \", model.getVal(Q_laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1083,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the cost of fertilizers and the labor required for each crop.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 worth of fertilizer and 3 hours of labor. \nThe profit per acre for corn is $300, with a fertilizer cost of $70 and 4 hours of labor. \nThe profit per acre for soybeans is $150, with a fertilizer cost of $30 and 2 hours of labor.\nThe farmer aims to maximize the net profit per labor hour (which is defined as the sum of the profits minus the sum of the fertilizer costs, divided by the total labor hours).\n// Profit from wheat: Profit_W = (200 - 50) * W\n// Profit from corn: Profit_C = (300 - 70) * C\n// Profit from soybeans: Profit_S = (150 - 30) * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S - (50 * W + 70 * C + 30 * S)) / (3 * W + 4 * C + 2 * S)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for fertilizer costs.\n// 50 * W + 70 * C + 30 * S <= 10000\n\n## Generate Constraint-2:\nThe farmer has 100 acres of land available for cultivation.\n// W + C + S <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the cost of fertilizers and the labor required for each crop. The profit per acre, fertilizer cost, and labor hours for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Fertilizer Cost | Labor Hours |\n|----------|-----------------|-----------------|-------------|\n| Wheat    | $200            | $50             | 3 hours     |\n| Corn     | $300            | $70             | 4 hours     |\n| Soybeans | $150            | $30             | 2 hours     |\n\nThe farmer has a budget of $10,000 for fertilizer costs. The farmer has 100 acres of land available for cultivation. \nPlease help the farmer to maximize the net profit per labor hour (which is defined as the sum of the profits minus the sum of the fertilizer costs, divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 30) * S\nFertilizerCost = 50 * W + 70 * C + 30 * S\nLaborHours = 3 * W + 4 * C + 2 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S - FertilizerCost) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_W + Profit_C + Profit_S - FertilizerCost)\n\n# Add constraints\n## The farmer has a budget of $10,000 for fertilizer costs.\nmodel.addCons(FertilizerCost <= 10000)\n## The farmer has 100 acres of land available for cultivation.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield.\n// Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n// Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n// Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm must allocate at least 20 hectares to crop A and 15 hectares to crop B.\n// A >= 20; B >= 15\n\n## Generate Constraint-3:\nThe farm has a water constraint that limits the combined land for crops B and C to no more than 60 hectares.\n// B + C <= 60",
        "question": "A farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit. The yield per hectare and the selling price per ton for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton |\n|------|-------------------|-----------------------|\n| A    | 5 tons            | $100                  |\n| B    | 7 tons            | $120                  |\n| C    | 9 tons            | $150                  |\n\nThe farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield. The total available land for farming is 100 hectares. The farm must allocate at least 20 hectares to crop A and 15 hectares to crop B. The farm has a water constraint that limits the combined land for crops B and C to no more than 60 hectares.\n\nPlease help the farm to maximize the total revenue from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=15) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n## Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n## Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n## So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nRevenue_A = 5 * A**0.8 * 100\nRevenue_B = 7 * B**0.8 * 120\nRevenue_C = 9 * C**0.8 * 150\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The total available land for farming is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n## The farm must allocate at least 20 hectares to crop A and 15 hectares to crop B.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\n## The farm has a water constraint that limits the combined land for crops B and C to no more than 60 hectares.\nmodel.addCons(B + C <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to crop A: \", model.getVal(A))\n    print(\"Land allocated to crop B: \", model.getVal(B))\n    print(\"Land allocated to crop C: \", model.getVal(C))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\n// 1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and the amount to invest in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops. The total area available for cultivation is 100 acres. The farm has a budget of $50,000 for irrigation investments. The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons. Please help the farm to maximize the total revenue from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=0)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=0)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)  # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total area available for cultivation is 100 acres.\nmodel.addCons(AreaA + AreaB + AreaC <= 100)\n# The farm has a budget of $50,000 for irrigation investments.\nmodel.addCons(Irrigation <= 50000)\n# The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\nmodel.addCons(1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n// Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n// Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production rate for each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10\n\n## Generate Constraint-4:\nThe company has a limited workforce that can handle a maximum of 80 units per hour in total.\n// P1 + P2 + P3 <= 80",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost. The initial production cost per unit for each product is $100, and the selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The production cost per unit decreases by $5 for every $10,000 invested in automation. The company aims to maximize the total profit from all products.\n\n| Product | Selling Price per Unit | Initial Production Cost per Unit |\n|---------|------------------------|---------------------------------|\n| 1       | $150                   | $100                            |\n| 2       | $200                   | $100                            |\n| 3       | $250                   | $100                            |\n\nThe total production rate for all products must not exceed 100 units per hour. The investment in automation cannot exceed $50,000. The production rate for each product must be at least 10 units per hour. The company has a limited workforce that can handle a maximum of 80 units per hour in total.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate for product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n## Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n## Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\nProfit1 = (150 - (100 - 0.0005 * Automation)) * P1\nProfit2 = (200 - (100 - 0.0005 * Automation)) * P2\nProfit3 = (250 - (100 - 0.0005 * Automation)) * P3\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total production rate for all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The production rate for each product must be at least 10 units per hour.\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\n## The company has a limited workforce that can handle a maximum of 80 units per hour in total.\nmodel.addCons(P1 + P2 + P3 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1302,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\n// {\"solar panels in Location A\": \"Solar_A\", \"range\": \"Solar_A >= 0\", \"type\": \"integer\"}\n// {\"wind turbines in Location B\": \"Wind_B\", \"range\": \"Wind_B >= 0\", \"type\": \"integer\"}\n// {\"energy-efficient lighting systems in Location C\": \"Light_C\", \"range\": \"Light_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n// NPV = \u03a3(annual energy savings - maintenance cost) / (1 + discount rate)^year - installation cost\n// So, the objective function is: Maximize NPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05)^1 + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05)^1 + (50 * Light_C - 5 * Light_C) / (1 + 0.05)^1 - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation of all systems.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000\n\n## Generate Constraint-2:\nAt least $50,000 must be spent on energy-efficient systems across all locations.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000\n\n## Generate Constraint-3:\nThe installation of solar panels in Location A must not exceed 200 units.\n// Solar_A <= 200",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C). The cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit. The cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit. The cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit. The company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs. The company has a budget of $150,000 for the installation of all systems. At least $50,000 must be spent on energy-efficient systems across all locations. The installation of solar panels in Location A must not exceed 200 units. Please help the company determine the optimal number of solar panels in Location A, wind turbines in Location B, and energy-efficient lighting systems in Location C to maximize the NPV of the investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar_A = model.addVar(vtype=\"INTEGER\", name=\"Solar_A\", lb=0)  # solar panels in Location A\nWind_B = model.addVar(vtype=\"INTEGER\", name=\"Wind_B\", lb=0)  # wind turbines in Location B\nLight_C = model.addVar(vtype=\"INTEGER\", name=\"Light_C\", lb=0)  # energy-efficient lighting systems in Location C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate NPV\nNPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05) + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05) + (50 * Light_C - 5 * Light_C) / (1 + 0.05) - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## convert the division to multiplication\nmodel.addCons(obj * (1 + 0.05) == (100 * Solar_A - 10 * Solar_A) + (200 * Wind_B - 20 * Wind_B) + (50 * Light_C - 5 * Light_C) - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C) * (1 + 0.05))\n\n# Add constraints\n## The company has a budget of $150,000 for the installation of all systems.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000)\n\n## At least $50,000 must be spent on energy-efficient systems across all locations.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000)\n\n## The installation of solar panels in Location A must not exceed 200 units.\nmodel.addCons(Solar_A <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Location A: \", model.getVal(Solar_A))\n    print(\"Number of Wind Turbines in Location B: \", model.getVal(Wind_B))\n    print(\"Number of Energy-Efficient Lighting Systems in Location C: \", model.getVal(Light_C))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1362,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. They need to determine the areas to allocate for each crop.\n// {\"area of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Wheat, the profit per hectare is $1000, but it requires 200 liters of water per hectare. For Corn, the profit per hectare is $1200, but it requires 250 liters of water per hectare. For Soybeans, the profit per hectare is $800, but it requires 150 liters of water per hectare. The farm wants to maximize the profit per unit of water used (profit efficiency).\n// Profit_Wheat = 1000 * Wheat\n// Profit_Corn = 1200 * Corn\n// Profit_Soybeans = 800 * Soybeans\n// Water_Wheat = 200 * Wheat\n// Water_Corn = 250 * Corn\n// Water_Soybeans = 150 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / (Water_Wheat + Water_Corn + Water_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 20000 liters.\n// 200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000\n\n## Generate Constraint-3:\nThe market demand for Wheat is 50 hectares. So, the farm can only sell a maximum of 50 hectares of Wheat.\n// Wheat <= 50",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. They need to determine the areas to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop       | Profit per Hectare | Water Requirement per Hectare |\n|------------|--------------------|-------------------------------|\n| Wheat      | $1000              | 200 liters                    |\n| Corn       | $1200              | 250 liters                    |\n| Soybeans   | $800               | 150 liters                    |\n\nThe farm has a total area of 100 hectares. The farm has a limited water supply of 20000 liters. The market demand for Wheat is 50 hectares. So, the farm can only sell a maximum of 50 hectares of Wheat. \nPlease help the farm to maximize the profit per unit of water used (profit efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0)  # area of Wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0)    # area of Corn\nSoybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Soybeans\", lb=0)  # area of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 1000 * Wheat\nProfit_Corn = 1200 * Corn\nProfit_Soybeans = 800 * Soybeans\nWater_Wheat = 200 * Wheat\nWater_Corn = 250 * Corn\nWater_Soybeans = 150 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / (Water_Wheat + Water_Corn + Water_Soybeans)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans) == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farm has a total area of 100 hectares.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farm has a limited water supply of 20000 liters.\nmodel.addCons(200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000)\n## The market demand for Wheat is 50 hectares.\nmodel.addCons(Wheat <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Wheat: \", model.getVal(Wheat))\n    print(\"Area of Corn: \", model.getVal(Corn))\n    print(\"Area of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer aims to maximize the profit per unit of resource used (either water or labor). The objective is to maximize the ratio of total profit to the sum of water and labor used.\n// Profit from A: Profit_A = 300 * A\n// Profit from B: Profit_B = 400 * B\n// Profit from C: Profit_C = 500 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 10,000 liters of water available for irrigation.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farmer has a total of 500 hours of labor available.\n// 5 * A + 8 * B + 10 * C <= 500\n\n## Generate Constraint-3:\nThe farmer wants to plant at least 5 acres of each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. The expected profit per acre, water requirement, and labor requirement for each crop are given in the following Table.\n\n| Crop | Expected Profit per Acre | Water Requirement per Acre | Labor Requirement per Acre |\n|------|--------------------------|----------------------------|-----------------------------|\n| A    | $300                     | 200 liters                 | 5 hours                     |\n| B    | $400                     | 300 liters                 | 8 hours                     |\n| C    | $500                     | 400 liters                 | 10 hours                    |\n\nThe farmer has a total of 10,000 liters of water available for irrigation. The farmer has a total of 500 hours of labor available. The farmer wants to plant at least 5 acres of each crop. \nPlease help the farmer to maximize the profit per unit of resource used (either water or labor), which is defined as the ratio of total profit to the sum of water and labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 5 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 300 * A\nProfit_B = 400 * B\nProfit_C = 500 * C\nResourceUsage = 200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 10,000 liters of water available for irrigation.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farmer has a total of 500 hours of labor available.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, the labor hours allocated to each product, and the marketing budget for each product.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Prod3\", \"range\": \"Prod3 >= 0\", \"type\": \"integer\"}\n// {\"labor hours for Product 1\": \"Labor1\", \"range\": \"Labor1 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 2\": \"Labor2\", \"range\": \"Labor2 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 3\": \"Labor3\", \"range\": \"Labor3 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 1\": \"Marketing1\", \"range\": \"Marketing1 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 2\": \"Marketing2\", \"range\": \"Marketing2 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 3\": \"Marketing3\", \"range\": \"Marketing3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is affected by the production quantity, labor hours, and marketing budget. The profit function is nonlinear and includes economies of scale and diminishing returns in labor and marketing. The company aims to maximize the total profit from all three products.\n// Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n// Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n// Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\n\n## Generate Constraint-1:\nThe total labor hours available for all products cannot exceed 1000 hours.\n// Labor1 + Labor2 + Labor3 <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products must not exceed $50,000.\n// Marketing1 + Marketing2 + Marketing3 <= 50000\n\n## Generate Constraint-3:\nThe production quantity of each product must be at least 10 units.\n// Prod1 >= 10; Prod2 >= 10; Prod3 >= 10\n\n## Generate Constraint-4:\nThe labor hours allocated to each product must be proportional to the production quantity, with a minimum ratio of 0.1 hours per unit.\n// Labor1 >= 0.1 * Prod1; Labor2 >= 0.1 * Prod2; Labor3 >= 0.1 * Prod3",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity, labor hours, and marketing budget for each of its three products. The company aims to maximize the total profit from all three products, which is affected by the production quantity, labor hours, and marketing budget, considering economies of scale and diminishing returns in labor and marketing. The profit functions for each product are nonlinear.\n\n| Product | Profit Function Components |\n|---------|-----------------------------|\n| 1       | 100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2 |\n| 2       | 150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2 |\n| 3       | 200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2 |\n\nThe company has the following constraints:\n- The total labor hours available for all products cannot exceed 1000 hours.\n- The total marketing budget for all products must not exceed $50,000.\n- The production quantity of each product must be at least 10 units.\n- The labor hours allocated to each product must be proportional to the production quantity, with a minimum ratio of 0.1 hours per unit.\n\nPlease help the company determine the optimal production quantity, labor hours, and marketing budget for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=10)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=10)  # production quantity of Product 2\nProd3 = model.addVar(vtype=\"INTEGER\", name=\"Prod3\", lb=10)  # production quantity of Product 3\nLabor1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor1\", lb=0)  # labor hours for Product 1\nLabor2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor2\", lb=0)  # labor hours for Product 2\nLabor3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor3\", lb=0)  # labor hours for Product 3\nMarketing1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing1\", lb=0)  # marketing budget for Product 1\nMarketing2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing2\", lb=0)  # marketing budget for Product 2\nMarketing3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing3\", lb=0)  # marketing budget for Product 3\n\n# Define objective function\n# Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n# Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n# Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n# So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\nProfit1 = 100 * Prod1 - 0.01 * Prod1**2 + 20 * Labor1 - 0.05 * Labor1**2 + 10 * Marketing1 - 0.1 * Marketing1**2\nProfit2 = 150 * Prod2 - 0.015 * Prod2**2 + 25 * Labor2 - 0.05 * Labor2**2 + 15 * Marketing2 - 0.1 * Marketing2**2\nProfit3 = 200 * Prod3 - 0.02 * Prod3**2 + 30 * Labor3 - 0.05 * Labor3**2 + 20 * Marketing3 - 0.1 * Marketing3**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n# The total labor hours available for all products cannot exceed 1000 hours.\nmodel.addCons(Labor1 + Labor2 + Labor3 <= 1000)\n# The total marketing budget for all products must not exceed $50,000.\nmodel.addCons(Marketing1 + Marketing2 + Marketing3 <= 50000)\n# The labor hours allocated to each product must be proportional to the production quantity, with a minimum ratio of 0.1 hours per unit.\nmodel.addCons(Labor1 >= 0.1 * Prod1)\nmodel.addCons(Labor2 >= 0.1 * Prod2)\nmodel.addCons(Labor3 >= 0.1 * Prod3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Prod3))\n    print(\"Labor Hours for Product 1: \", model.getVal(Labor1))\n    print(\"Labor Hours for Product 2: \", model.getVal(Labor2))\n    print(\"Labor Hours for Product 3: \", model.getVal(Labor3))\n    print(\"Marketing Budget for Product 1: \", model.getVal(Marketing1))\n    print(\"Marketing Budget for Product 2: \", model.getVal(Marketing2))\n    print(\"Marketing Budget for Product 3: \", model.getVal(Marketing3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1443,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. \nEach machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. \nEach machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. \nThe company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The objective is to minimize the total cost of production, including setup and operating costs.\n// Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n// Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n// Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time. Each machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. Each machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. Each machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. The company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The company has a total of 50 machines available for allocation. Please help the company to minimize the total cost of production, including setup and operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## convert the division to multiplication\nCost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\nmodel.addCons(Cost_A == 500 * MachinesA + 100 * (10000 / (100 * MachinesA)))\n\n## Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## convert the division to multiplication\nCost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\nmodel.addCons(Cost_B == 600 * MachinesB + 120 * (15000 / (150 * MachinesB)))\n\n## Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n## convert the division to multiplication\nCost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\nmodel.addCons(Cost_C == 700 * MachinesC + 140 * (20000 / (200 * MachinesC)))\n\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company aims to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n// Profit from A: Profit_A = (30 * A) - 500\n// Profit from B: Profit_B = (40 * B) - 700\n// Profit from C: Profit_C = (50 * C) - 900\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited budget of $2000 for setup costs.\n// 500 * A + 700 * B + 900 * C <= 2000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand. The profit per unit and setup cost for each component are given in the following Table.\n\n| Component | Profit per Unit | Setup Cost |\n|-----------|-----------------|------------|\n| A         | $30             | $500       |\n| B         | $40             | $700       |\n| C         | $50             | $900       |\n\nThe company has a limited budget of $2000 for setup costs. The company aims to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs. Please help the company determine the optimal production quantity for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from A: Profit_A = (30 * A) - 500\n## Profit from B: Profit_B = (40 * B) - 700\n## Profit from C: Profit_C = (50 * C) - 900\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (30 * A - 500) + (40 * B - 700) + (50 * C - 900))\n\n# Add constraints\n## The company has a limited budget of $2000 for setup costs.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit.\n// {\"raw materials for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. \nProduct 1 requires M1 units of raw material and generates a profit of 10M1. \nProduct 2 requires M2 units of raw material and generates a profit of 15M2. \nProduct 3 requires M3 units of raw material and generates a profit of 20M3.\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 10M1 + 15M2 + 20M3\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 100 units.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nThe production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used. The efficiency function is E1 = 1 / (1 + M1^2).\n// M1 <= 100 * E1\n\n## Generate Constraint-3:\nThe production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used. The efficiency function is E2 = M2^2 / (1 + M2^2).\n// M2 <= 100 * E2\n\n## Generate Constraint-4:\nThe production of product 3 has a constraint that the amount of raw materials used must be at least twice the amount used for product 1.\n// M3 >= 2 * M1",
        "question": "A manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit. The profit generated by each product is directly proportional to the amount of raw materials used, with Product 1 generating a profit of 10 times the raw materials used (M1), Product 2 generating a profit of 15 times the raw materials used (M2), and Product 3 generating a profit of 20 times the raw materials used (M3).\n\nThe total amount of raw materials available is 100 units. The production of Product 1 is subject to a nonlinear constraint where the efficiency decreases as more raw materials are used, defined by the function E1 = 1 / (1 + M1^2), and the amount of raw materials used for Product 1 (M1) must be less than or equal to 100 times this efficiency. The production of Product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used, defined by the function E2 = M2^2 / (1 + M2^2), and the amount of raw materials used for Product 2 (M2) must be less than or equal to 100 times this efficiency. Additionally, the amount of raw materials used for Product 3 (M3) must be at least twice the amount used for Product 1 (M1).\n\nPlease help the plant manager to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # raw materials for product 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0)  # raw materials for product 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0)  # raw materials for product 3\n\n# Define objective function\nP = model.addVar(name=\"P\")  # total profit\nmodel.setObjective(P, \"maximize\")\nmodel.addCons(P == 10 * M1 + 15 * M2 + 20 * M3)\n\n# Add constraints\n# The total amount of raw materials available is 100 units.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# The production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used.\nE1 = model.addVar(name=\"E1\")  # efficiency of product 1\nmodel.addCons(E1 == 1 / (1 + M1**2))\nmodel.addCons(M1 <= 100 * E1)\n\n# The production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used.\nE2 = model.addVar(name=\"E2\")  # efficiency of product 2\nmodel.addCons(E2 == M2**2 / (1 + M2**2))\nmodel.addCons(M2 <= 100 * E2)\n\n# The production of product 3 has a constraint that the amount of raw materials used must be at least twice the amount used for product 1.\nmodel.addCons(M3 >= 2 * M1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for product 1: \", model.getVal(M1))\n    print(\"Raw materials for product 2: \", model.getVal(M2))\n    print(\"Raw materials for product 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1349,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the number of hours of labor to employ, and the amount of capital to invest in new machinery.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"number of hours of labor\": \"LaborHours\", \"range\": \"LaborHours >= 0\", \"type\": \"integer\"}\n// {\"amount of capital to invest in machinery\": \"Capital\", \"range\": \"Capital >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in new machinery. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.00005 * Capital) * Units - LaborHours * 20\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 10,000 labor hours available for the quarter. The company must ensure that at least 5,000 labor hours are utilized.\n// LaborHours <= 10000; LaborHours >= 5000\n\n## Generate Constraint-2:\nThe total capital investment in new machinery cannot exceed $1,000,000.\n// Capital <= 1000000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the number of hours of labor to employ, and the amount of capital to invest in new machinery. The cost of production per unit decreases by $5 for every $100,000 invested in new machinery. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production.\nThe company has a total of 10,000 labor hours available for the quarter and must ensure that at least 5,000 labor hours are utilized. The total capital investment in new machinery cannot exceed $1,000,000.\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nLaborHours = model.addVar(vtype=\"INTEGER\", name=\"LaborHours\", lb=5000, ub=10000)  # number of hours of labor\nCapital = model.addVar(vtype=\"CONTINUOUS\", name=\"Capital\", lb=0)  # amount of capital to invest in machinery\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Capital) * Units - LaborHours * 20\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Capital <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Number of Labor Hours: \", model.getVal(LaborHours))\n    print(\"Amount of Capital Invested: \", model.getVal(Capital))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 733,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity for Product A\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product B\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product C\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $90. The company wants to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * QuantityA\n// Total profit for Product B: ProfitB = 70 * QuantityB\n// Total profit for Product C: ProfitC = 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units.\n// 2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\n// QuantityC <= 0.5 * (QuantityA + QuantityB)\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10 units of each product are produced to maintain market presence.\n// QuantityA >= 10; QuantityB >= 10; QuantityC >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $90             |\n\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units. Due to market demand, the production of Product A must be at least twice the production of Product B. The company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B. Additionally, the company wants to ensure that at least 10 units of each product are produced to maintain market presence.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=10) # production quantity for Product A\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=10) # production quantity for Product B\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=10) # production quantity for Product C\n\n# Define objective function\nProfitA = 50 * QuantityA\nProfitB = 70 * QuantityB\nProfitC = 90 * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a limited amount of raw material.\nmodel.addCons(2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000)\n# Due to market demand, the production of Product A must be at least twice the production of Product B.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\nmodel.addCons(QuantityC <= 0.5 * (QuantityA + QuantityB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(QuantityA))\n    print(\"Production Quantity for Product B: \", model.getVal(QuantityB))\n    print(\"Production Quantity for Product C: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\n// Total energy output: Output = (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage)\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarPanels + 2000 * WindTurbines <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage technology cannot exceed $50,000.\n// EnergyStorage <= 50000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods. The energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage. The company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage technology cannot exceed $50,000. Please help the company to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)  # number of wind turbines\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)  # investment in energy storage\n\n# Define objective function\nOutput = model.addVar(name=\"Output\")\nmodel.setObjective(Output, \"maximize\")\nmodel.addCons(Output == (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage))\n\n# Add constraints\nmodel.addCons(1000 * SolarPanels + 2000 * WindTurbines <= 1000000)  # budget constraint\nmodel.addCons(EnergyStorage <= 50000)  # investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage: \", model.getVal(EnergyStorage))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\n// {\"solar panels in Location A\": \"Solar_A\", \"range\": \"Solar_A >= 0\", \"type\": \"integer\"}\n// {\"wind turbines in Location B\": \"Wind_B\", \"range\": \"Wind_B >= 0\", \"type\": \"integer\"}\n// {\"energy-efficient lighting systems in Location C\": \"Light_C\", \"range\": \"Light_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n// NPV = \u03a3(annual energy savings - maintenance cost) / (1 + discount rate)^year - installation cost\n// So, the objective function is: Maximize NPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05)^1 + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05)^1 + (50 * Light_C - 5 * Light_C) / (1 + 0.05)^1 - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation of all systems.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000\n\n## Generate Constraint-2:\nAt least $50,000 must be spent on energy-efficient systems across all locations.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000\n\n## Generate Constraint-3:\nThe installation of solar panels in Location A must not exceed 200 units.\n// Solar_A <= 200\n\n## Generate Constraint-4:\nThe total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined.\n// Wind_B + Light_C <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C). The cost, estimated annual energy savings, and maintenance cost for each type of installation are given in the following Table.\n\n| Installation Type | Location | Cost per Unit | Annual Energy Savings per Unit | Maintenance Cost per Unit |\n|-------------------|----------|---------------|--------------------------------|---------------------------|\n| Solar Panels      | A        | $500          | $100                          | $10                      |\n| Wind Turbines     | B        | $1000         | $200                          | $20                      |\n| Energy-Efficient Lighting Systems | C | $300          | $50                           | $5                       |\n\nThe company has a budget of $150,000 for the installation of all systems. At least $50,000 must be spent on energy-efficient systems across all locations. The installation of solar panels in Location A must not exceed 200 units. The total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined. \n\nPlease help the company to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar_A = model.addVar(vtype=\"INTEGER\", name=\"Solar_A\", lb=0)  # solar panels in Location A\nWind_B = model.addVar(vtype=\"INTEGER\", name=\"Wind_B\", lb=0)  # wind turbines in Location B\nLight_C = model.addVar(vtype=\"INTEGER\", name=\"Light_C\", lb=0)  # energy-efficient lighting systems in Location C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate NPV\nNPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05) + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05) + (50 * Light_C - 5 * Light_C) / (1 + 0.05) - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## convert the division to multiplication\nmodel.addCons(obj * (1 + 0.05) == (100 * Solar_A - 10 * Solar_A) + (200 * Wind_B - 20 * Wind_B) + (50 * Light_C - 5 * Light_C) - obj * (1 + 0.05) * (500 * Solar_A + 1000 * Wind_B + 300 * Light_C))\n\n# Add constraints\n## The company has a budget of $150,000 for the installation of all systems.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000)\n\n## At least $50,000 must be spent on energy-efficient systems across all locations.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000)\n\n## The installation of solar panels in Location A must not exceed 200 units.\nmodel.addCons(Solar_A <= 200)\n\n## The total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined.\nmodel.addCons(Wind_B + Light_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Location A: \", model.getVal(Solar_A))\n    print(\"Number of Wind Turbines in Location B: \", model.getVal(Wind_B))\n    print(\"Number of Energy-Efficient Lighting Systems in Location C: \", model.getVal(Light_C))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1469,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel efficiency and maintenance costs. \nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\n// Operational cost for TruckA: Cost_TruckA = 500 / 10 * TruckA\n// Operational cost for TruckB: Cost_TruckB = 700 / 15 * TruckB\n// Operational cost for TruckC: Cost_TruckC = 900 / 20 * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per month for vehicle maintenance.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC <= 10,000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 100 tons.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC >= 100",
        "question": "A logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity. For TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons. For TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons. For TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons. The operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency). The company has a total budget of $10,000 per month for vehicle maintenance. The total cargo capacity of the fleet must be at least 100 tons. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (500 / 10) * TruckA\nCost_TruckB = (700 / 15) * TruckB\nCost_TruckC = (900 / 20) * TruckC\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n## The company has a total budget of $10,000 per month for vehicle maintenance.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC <= 10000)\n## The total cargo capacity of the fleet must be at least 100 tons.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 500 units in total.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\n// ProductA >= 100\n// ProductC >= 150\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-5:\nThe production of Product C should not exceed 30% of the total production.\n// ProductC <= 0.3 * (ProductA + ProductB + ProductC)",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The total production cost must not exceed $15,000, with the cost per unit of Product A being $20, Product B being $30, and Product C being $25. The company has a limited workforce that can produce a maximum of 500 units in total. The market demand for Product A is at least 100 units, and for Product C, it is at least 150 units. The company aims to produce at least twice as many units of Product B as Product A. Additionally, the production of Product C should not exceed 30% of the total production.\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total production cost must not exceed $15,000.\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000)\n# The company has a limited workforce that can produce a maximum of 500 units in total.\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n# The market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\nmodel.addCons(ProductA >= 100)\nmodel.addCons(ProductC >= 150)\n# The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(ProductB >= 2 * ProductA)\n# The production of Product C should not exceed 30% of the total production.\nmodel.addCons(ProductC <= 0.3 * (ProductA + ProductB + ProductC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit.\n// {\"quantity of WidgetA\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetB\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetC\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets.\n// Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\n// Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\n// Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\n// So, the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all types of widgets.\n// WidgetA + WidgetB + WidgetC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetB <= 2 * WidgetA\n\n## Generate Constraint-3:\nThe company has a minimum order requirement from a key client for WidgetC, which must be at least 50 units.\n// WidgetC >= 50\n\n## Generate Constraint-4:\nThe storage facility has a limited space, and the total volume of all widgets produced must not exceed 1200 cubic units. The volume per unit of WidgetA is 2 cubic units, WidgetB is 3 cubic units, and WidgetC is 4 cubic units.\n// 2 * WidgetA + 3 * WidgetB + 4 * WidgetC <= 1200",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit. The profit per unit and the volume per unit for each widget are given in the following Table.\n\n| Widget | Profit per Unit | Volume per Unit |\n|--------|-----------------|-----------------|\n| WidgetA | $10, decreasing by $0.01 for each unit beyond 100 | 2 cubic units |\n| WidgetB | $15, decreasing by $0.01 for each unit beyond 150 | 3 cubic units |\n| WidgetC | $20, decreasing by $0.01 for each unit beyond 200 | 4 cubic units |\n\nThe company has a total production capacity of 500 units across all types of widgets. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. The company has a minimum order requirement from a key client for WidgetC, which must be at least 50 units. The storage facility has a limited space, and the total volume of all widgets produced must not exceed 1200 cubic units.\n\nPlease help the company to maximize the total profit from the sales of all widgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # quantity of WidgetA\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # quantity of WidgetB\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=50) # quantity of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetA == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (10 - 0.01 * WidgetA2) * WidgetA2 * WidgetA_b2 + 10 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=150)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=150, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetB == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (15 - 0.01 * WidgetB2) * WidgetB2 * WidgetB_b2 + 15 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=50, ub=200)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=200, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetC == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (20 - 0.01 * WidgetC2) * WidgetC2 * WidgetC_b2 + 20 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetA + WidgetB + WidgetC <= 500)\nmodel.addCons(WidgetB <= 2 * WidgetA)\nmodel.addCons(2 * WidgetA + 3 * WidgetB + 4 * WidgetC <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of WidgetA: \", model.getVal(WidgetA))\n    print(\"Quantity of WidgetB: \", model.getVal(WidgetB))\n    print(\"Quantity of WidgetC: \", model.getVal(WidgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\n// Profit per acre of wheat: Profit_W = (200 - 50) * W\n// Profit per acre of corn: Profit_C = (300 - 70) * C\n// Profit per acre of soybeans: Profit_S = (150 - 40) * S\n// Cost of water and fertilizer: Cost_W = 50 * W, Cost_C = 70 * C, Cost_S = 40 * S\n// So, the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 20 acres of each crop.\n// W >= 20; C >= 20; S >= 20",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used). The farmer has a total of 100 acres available for planting. The farmer wants to plant at least 20 acres of each crop.\nPlease help the farmer determine the optimal number of acres to dedicate to each crop to maximize the net profit per unit of water and fertilizer used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 20 acres of each crop.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 40) * S\nCost_W = 50 * W\nCost_C = 70 * C\nCost_S = 40 * S\n## the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_W + Cost_C + Cost_S) == (Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S))\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000\n\n## Generate Constraint-2:\nDue to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentB <= 2 * ComponentA\n\n## Generate Constraint-3:\nThe market demand for ComponentC is limited to 500 units.\n// ComponentC <= 500",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company has a total production capacity of 1000 units across all components. Due to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA. The market demand for ComponentC is limited to 500 units.\nPlease help the company to maximize the total profit from the sales of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=0) # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=0) # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0) # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*A_b1 + ComponentA2*A_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * A_b2 + 10 * ComponentA1 * A_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*B_b1 + ComponentB2*B_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * B_b2 + 15 * ComponentB1 * B_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=1000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*C_b1 + ComponentC2*C_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * C_b2 + 20 * ComponentC1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\nmodel.addCons(ComponentB <= 2 * ComponentA)\nmodel.addCons(ComponentC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// P_A <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 30 hours per week.\n// P_B <= 30",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. Each production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit. The plant aims to maximize the total production value.\nThe total operating hours for all production lines must not exceed 100 hours per week. The production line A can operate for a maximum of 40 hours per week. The production line B can operate for a maximum of 30 hours per week.\nPlease help the plant manager to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == V)\n\n# Add constraints\nmodel.addCons(P_A + P_B + P_C <= 100) # total operating hours for all production lines must not exceed 100 hours per week\nmodel.addCons(P_A <= 40) # production line A can operate for a maximum of 40 hours per week\nmodel.addCons(P_B <= 30) # production line B can operate for a maximum of 30 hours per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands.\n// The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n// The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n// The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit. The productivity of each worker in each unit is given in the following Table.\n\n| Production Unit | Component A | Component B | Component C |\n|-----------------|-------------|-------------|-------------|\n| Unit 1          | 10 units/hr | 15 units/hr | 20 units/hr |\n| Unit 2          | 12 units/hr | 18 units/hr | 22 units/hr |\n| Unit 3          | 14 units/hr | 20 units/hr | 24 units/hr |\n\nThe company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The company has a total of 50 workers available. Please help the manager to minimize the total production time to meet these demands.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n## The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n## The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication and set the objective as the maximum of T1, T2, T3\nT1 = model.addVar('T1')\nT2 = model.addVar('T2')\nT3 = model.addVar('T3')\nmodel.addCons(T1 * (10 * W1 + 12 * W2 + 14 * W3) == 1000)\nmodel.addCons(T2 * (15 * W1 + 18 * W2 + 20 * W3) == 1500)\nmodel.addCons(T3 * (20 * W1 + 22 * W2 + 24 * W3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The company has a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(W3))\n    print(\"Minimum Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit.\n// {\"amount of resource 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of resources used. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of resource 1 available is 100 units.\n// R1 <= 100\n\n## Generate Constraint-2:\nThe total amount of resource 2 available is 120 units.\n// R2 <= 120\n\n## Generate Constraint-3:\nThe total amount of resource 3 available is 150 units.\n// R3 <= 150\n\n## Generate Constraint-4:\nThe plant must produce at least 5 units of each product.\n// P1 >= 5; P2 >= 5; P3 >= 5",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit. The profit from each product depends on the amount of resources used and is given by the following nonlinear profit functions:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\n\nThe plant manager wants to maximize the total profit from all three products. The total amount of each resource available is as follows:\n- Resource 1: 100 units\n- Resource 2: 120 units\n- Resource 3: 150 units\n\nAdditionally, the plant must produce at least 5 units of each product.\n\nPlease help the plant manager to determine the optimal allocation of resources to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of resource 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of resource 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of resource 3\n\n# Define objective function\n## The profit function for each product is nonlinear and given by:\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\")\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\")\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\")\nmodel.addCons(P1 == 50 * R1**0.5 - 10 * R1)\nmodel.addCons(P2 == 70 * R2**0.6 - 20 * R2)\nmodel.addCons(P3 == 60 * R3**0.7 - 15 * R3)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = P1 + P2 + P3\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total amount of resource 1 available is 100 units.\nmodel.addCons(R1 <= 100)\n## The total amount of resource 2 available is 120 units.\nmodel.addCons(R2 <= 120)\n## The total amount of resource 3 available is 150 units.\nmodel.addCons(R3 <= 150)\n## The plant must produce at least 5 units of each product.\nmodel.addCons(P1 >= 5)\nmodel.addCons(P2 >= 5)\nmodel.addCons(P3 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Resource 1: \", model.getVal(R1))\n    print(\"Amount of Resource 2: \", model.getVal(R2))\n    print(\"Amount of Resource 3: \", model.getVal(R3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C).\n// {\"number of Machinery A units\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery B units\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery C units\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n// Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n// Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing and maintaining the machinery.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000",
        "question": "A manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C). Each unit of Machinery A increases the production capacity by 10% and costs $500 in maintenance, each unit of Machinery B increases the capacity by 15% and costs $700 in maintenance, and each unit of Machinery C increases the capacity by 20% and costs $1000 in maintenance. The company wants to maximize the net production capacity after deducting the maintenance costs. The company has a budget of $50,000 for purchasing and maintaining the machinery. How should the company allocate its investment among Machinery A, Machinery B, and Machinery C to achieve this goal?\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineryA = model.addVar(vtype=\"INTEGER\", name=\"MachineryA\", lb=0) # number of Machinery A units\nMachineryB = model.addVar(vtype=\"INTEGER\", name=\"MachineryB\", lb=0) # number of Machinery B units\nMachineryC = model.addVar(vtype=\"INTEGER\", name=\"MachineryC\", lb=0) # number of Machinery C units\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n## Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n## So, the objective function is: Maximize (Capacity - Cost)\nCapacity = 0.1 * MachineryA + 0.15 * MachineryB + 0.2 * MachineryC\nCost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing and maintaining the machinery.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machinery A: \", model.getVal(MachineryA))\n    print(\"Number of Machinery B: \", model.getVal(MachineryB))\n    print(\"Number of Machinery C: \", model.getVal(MachineryC))\n    print(\"Maximized Net Production Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\n// Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\n// Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBProduction <= 2 * DeviceAProduction",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAProduction == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBProduction == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCProduction == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 90 * DeviceC1 * DeviceC_b1 + (90 - 0.02 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500)\nmodel.addCons(DeviceBProduction <= 2 * DeviceAProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\n// {\"number of acres for CropA\": \"AcresA\", \"range\": \"AcresA >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"AcresB\", \"range\": \"AcresB >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"AcresC\", \"range\": \"AcresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\n// Net profit for CropA: Profit_A = (500 - 100) * AcresA\n// Net profit for CropB: Profit_B = (700 - 150) * AcresB\n// Net profit for CropC: Profit_C = (900 - 200) * AcresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2000 * AcresA + 3000 * AcresB + 4000 * AcresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// AcresA + AcresB + AcresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, CropA must be planted on at least twice as many acres as CropB.\n// AcresA >= 2 * AcresB\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * AcresA + 150 * AcresB + 200 * AcresC <= 15,000\n\n## Generate Constraint-4:\nThe farm wants to ensure that each crop is planted on at least 5 acres.\n// AcresA >= 5; AcresB >= 5; AcresC >= 5",
        "question": "A farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations. For CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. For CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. For CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200. The farm has a total of 100 acres available for cultivation. Due to soil conditions, CropA must be planted on at least twice as many acres as CropB. The farm has a budget of $15,000 for labor costs for the season. The farm wants to ensure that each crop is planted on at least 5 acres. Please help the farm to maximize the net profit per gallon of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to ensure that each crop is planted on at least 5 acres.\nAcresA = model.addVar(vtype=\"INTEGER\", name=\"AcresA\", lb=5) # number of acres for CropA\nAcresB = model.addVar(vtype=\"INTEGER\", name=\"AcresB\", lb=5) # number of acres for CropB\nAcresC = model.addVar(vtype=\"INTEGER\", name=\"AcresC\", lb=5) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * AcresA\nProfit_B = (700 - 150) * AcresB\nProfit_C = (900 - 200) * AcresC\nWaterUsage = 2000 * AcresA + 3000 * AcresB + 4000 * AcresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(AcresA + AcresB + AcresC <= 100)\n## Due to soil conditions, CropA must be planted on at least twice as many acres as CropB.\nmodel.addCons(AcresA >= 2 * AcresB)\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * AcresA + 150 * AcresB + 200 * AcresC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(AcresA))\n    print(\"Number of Acres for CropB: \", model.getVal(AcresB))\n    print(\"Number of Acres for CropC: \", model.getVal(AcresC))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the yield is 5 tons per hectare, and the selling price is $100 per ton. \nFor Crop B, the yield is 7 tons per hectare, and the selling price is $120 per ton. \nFor Crop C, the yield is 6 tons per hectare, and the selling price is $110 per ton.\nThe farm aims to maximize its total revenue from selling the crops.\n// Revenue from Crop A: Revenue_A = 5 * 100 * HA\n// Revenue from Crop B: Revenue_B = 7 * 120 * HB\n// Revenue from Crop C: Revenue_C = 6 * 110 * HC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total land available for cultivation is 100 hectares.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply, which affects the yields. For each hectare of Crop A, 2 units of water are required, for Crop B, 3 units are required, and for Crop C, 2.5 units are required. The total water available is 250 units.\n// 2 * HA + 3 * HB + 2.5 * HC <= 250",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices.\nFor Crop A, the yield is 5 tons per hectare, and the selling price is $100 per ton. \nFor Crop B, the yield is 7 tons per hectare, and the selling price is $120 per ton. \nFor Crop C, the yield is 6 tons per hectare, and the selling price is $110 per ton.\nThe farm aims to maximize its total revenue from selling the crops.\nThe total land available for cultivation is 100 hectares. The farm has a limited water supply, which affects the yields. For each hectare of Crop A, 2 units of water are required, for Crop B, 3 units are required, and for Crop C, 2.5 units are required. The total water available is 250 units.\nPlease help the farm to maximize its total revenue from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"CONTINUOUS\", name=\"HA\", lb=0) # hectares of crop A\nHB = model.addVar(vtype=\"CONTINUOUS\", name=\"HB\", lb=0) # hectares of crop B\nHC = model.addVar(vtype=\"CONTINUOUS\", name=\"HC\", lb=0) # hectares of crop C\n\n# Define objective function\nRevenue_A = 5 * 100 * HA\nRevenue_B = 7 * 120 * HB\nRevenue_C = 6 * 110 * HC\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total land available for cultivation is 100 hectares.\nmodel.addCons(HA + HB + HC <= 100)\n# The farm has a limited water supply, which affects the yields. For each hectare of Crop A, 2 units of water are required, for Crop B, 3 units are required, and for Crop C, 2.5 units are required. The total water available is 250 units.\nmodel.addCons(2 * HA + 3 * HB + 2.5 * HC <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. \nFor S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. \nFor S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300.\nThe manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n// Net_Revenue_S1 = (100 * S1 - 60 * S1) / 200\n// Net_Revenue_S2 = (120 * S2 - 70 * S2) / 250\n// Net_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n// So, the objective function is: Maximize (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $10,000 for production costs.\n// 60 * S1 + 70 * S2 + 90 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\n// S1 + S2 + S3 <= 150\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce. The revenue per unit, production cost per unit, and energy efficiency (in kWh per year) for each solar panel are given in the following Table.\n\n| Solar Panel | Revenue per Unit | Production Cost per Unit | Energy Efficiency (kWh/year) |\n|-------------|------------------|--------------------------|------------------------------|\n| S1          | $100             | $60                      | 200                          |\n| S2          | $120             | $70                      | 250                          |\n| S3          | $150             | $90                      | 300                          |\n\nThe manufacturer has a limited production budget of $10,000 for production costs. The manufacturer has a production capacity of 150 units in terms of the number of units it can produce. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\nPlease help the manufacturer to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0)  # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0)  # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_S1 = (100 * S1 - 60 * S1) / 200\nNet_Revenue_S2 = (120 * S2 - 70 * S2) / 250\nNet_Revenue_S3 = (150 * S3 - 90 * S3) / 300\nEnergy_Efficiency = 200 * S1 + 250 * S2 + 300 * S3\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Efficiency == Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n# Add constraints\n## The manufacturer has a limited production budget of $10,000 for production costs.\nmodel.addCons(60 * S1 + 70 * S2 + 90 * S3 <= 10000)\n## The manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\nmodel.addCons(S1 + S2 + S3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Net Revenue per Unit of Energy Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Watch\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\n// 5 * Phone + 8 * Tablet + 3 * Watch <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\n// Phone <= 300; Tablet <= 250; Watch <= 400\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 800 units across all devices.\n// Phone + Tablet + Watch <= 800",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand. The profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The following table summarizes the profit per unit and the required units of a critical component for each device.\n\n| Device | Profit per Unit | Units of Critical Component |\n|--------|-----------------|-----------------------------|\n| Phone  | $100            | 5                           |\n| Tablet | $150            | 8                           |\n| Watch  | $75             | 3                           |\n\nThe manufacturer has a total of 2000 units of the critical component available. The market has a demand limit for each device: 300 units for Phone, 250 units for Tablet, and 400 units for Watch. The manufacturer also has a total production capacity of 800 units across all devices.\n\nPlease help the manufacturer to maximize the total profit from selling these devices, considering the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0, ub=300) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=250) # quantity of Tablet\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0, ub=400) # quantity of Watch\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=300)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=250)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\nWatch1 = model.addVar(vtype=\"INTEGER\", name=\"Watch1\", lb=0, ub=100)\nWatch2 = model.addVar(vtype=\"INTEGER\", name=\"Watch2\", lb=100, ub=400)\nWatch_b1 = model.addVar(vtype=\"B\", name=\"Watch_b1\")\nWatch_b2 = model.addVar(vtype=\"B\", name=\"Watch_b2\")\nmodel.addCons(Watch_b1 + Watch_b2 == 1)\nmodel.addCons(Watch == Watch1*Watch_b1 + Watch2*Watch_b2)\nProfit_Watch = 75 * Watch1 * Watch_b1 + (75 + 0.5 * (Watch2 - 100)) * Watch2 * Watch_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Watch)\n\n# Add constraints\nmodel.addCons(5 * Phone + 8 * Tablet + 3 * Watch <= 2000)\nmodel.addCons(Phone + Tablet + Watch <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Watch: \", model.getVal(Watch))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1250,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for Product A is limited to 300 units due to machinery constraints.\n// A <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// B >= 2 * A\n\n## Generate Constraint-5:\nThe company wants to ensure that no more than 40% of the total production is of Product C.\n// C <= 0.4 * (A + B + C)",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25. The company must produce at least 200 units in total to meet the minimum order requirements. The production capacity for Product A is limited to 300 units due to machinery constraints. The company aims to produce at least twice as many units of Product B as Product A. The company wants to ensure that no more than 40% of the total production is of Product C.\n\nPlease help the company to maximize the total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n# The company must produce at least 200 units in total to meet the minimum order requirements.\nmodel.addCons(A + B + C >= 200)\n# The production capacity for Product A is limited to 300 units due to machinery constraints.\nmodel.addCons(A <= 300)\n# The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(B >= 2 * A)\n# The company wants to ensure that no more than 40% of the total production is of Product C.\nmodel.addCons(C <= 0.4 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 70 units per day.\n// B >= 70\n\n## Generate Constraint-4:\nThe market demand for product C is at least 90 units per day.\n// C >= 90\n\n## Generate Constraint-5:\nThe company must allocate at least 20% of its production capacity to each product.\n// A >= 0.2 * 500; B >= 0.2 * 500; C >= 0.2 * 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\nThe total production capacity of the company is 500 units per day. The market demand for product A is at least 50 units per day. The market demand for product B is at least 70 units per day. The market demand for product C is at least 90 units per day. The company must allocate at least 20% of its production capacity to each product.\nPlease help the company to maximize the total profit from products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=70) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=90) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_A + P_B + P_C\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\nmodel.addCons(A >= 0.2 * 500)\nmodel.addCons(B >= 0.2 * 500)\nmodel.addCons(C >= 0.2 * 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels and the cost of installation per panel vary based on the type of roof, as shown in the following Table.\n\n| Roof Type | Efficiency | Installation Cost per Panel |\n|-----------|------------|-----------------------------|\n| Flat      | 80%        | $1000                       |\n| Sloped    | 90%        | $1200                       |\n| Green     | 75%        | $800                        |\n\nThe company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The total energy output from the solar panels must be at least 100,000 kWh. The company has a budget of $150,000 for the installation.\n\nPlease help the company determine the optimal number of solar panels to install on each type of roof to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0) # number of solar panels on green roofs\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\nmodel.addCons(obj == 1000 * Flat + 1200 * Slope + 800 * Green)\n\n# Add constraints\n## The total energy output must be at least 100,000 kWh.\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000)\n\n## The company has a budget of $150,000 for the installation.\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n\nThe company has the following constraints:\n1. The total production rate for all products cannot exceed 100 units per hour.\n2. The investment in advanced machinery cannot exceed $50,000.\n\nPlease help the company determine the optimal production rates for each product and the investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in Advanced Machinery: \", model.getVal(Machinery))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturer aims to maximize the total profit from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour.\n// The profit for component A: P1 = 50 * 10 * M1\n// The profit for component B: P2 = 70 * 15 * M2\n// The profit for component C: P3 = 60 * 12 * M3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total number of machines available is 50.\n// M1 + M2 + M3 <= 50",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type. The profit per unit and the production rate of each machine for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Rate per Machine |\n|-----------|-----------------|------------------------------|\n| A         | $50             | 10 units per hour            |\n| B         | $70             | 15 units per hour            |\n| C         | $60             | 12 units per hour            |\n\nThe manufacturer aims to maximize the total profit per hour from the sales of these components. The total number of machines available is 50. Please help the manufacturer determine the optimal allocation of machines to each component to maximize the total profit per hour.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\nP1 = 50 * 10 * M1\nP2 = 70 * 15 * M2\nP3 = 60 * 12 * M3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of energy-efficient lighting systems\": \"Lighting\", \"range\": \"Lighting >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it saves $200 annually in energy costs.\nThe cost of each wind turbine is $2000, and it saves $300 annually in energy costs.\nThe cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// Total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Lighting\n// Total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Lighting\n// So, the objective function is: Minimize Cost - Savings\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000\n\n## Generate Constraint-2:\nThe company aims to save at least $20,000 annually in energy costs.\n// 200 * Solar + 300 * Wind + 100 * Lighting >= 20000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels.\n// Solar >= 50",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities. The cost of each solar panel is $1000, and it saves $200 annually in energy costs. The cost of each wind turbine is $2000, and it saves $300 annually in energy costs. The cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs. The company has a budget of $100,000 for the installation and aims to save at least $20,000 annually in energy costs. Additionally, the company must install at least 50 solar panels. Please help the company to minimize the total cost of installation while maximizing the annual energy savings.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=50)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nLighting = model.addVar(vtype=\"INTEGER\", name=\"Lighting\", lb=0)  # number of energy-efficient lighting systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Lighting\nSavings = 200 * Solar + 300 * Wind + 100 * Lighting\n## the objective function is: Minimize Cost - Savings\nmodel.addCons(obj == Cost - Savings)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000)\n## The company aims to save at least $20,000 annually in energy costs.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Lighting >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Energy-Efficient Lighting Systems: \", model.getVal(Lighting))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Watch\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\n// 5 * Phone + 8 * Tablet + 3 * Watch <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\n// Phone <= 300; Tablet <= 250; Watch <= 400",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand.\nThe profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\nThe market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\nPlease help the manufacturer determine the optimal production quantities for each device to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0, ub=300) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=250) # quantity of Tablet\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0, ub=400) # quantity of Watch\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=300)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=250)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\nWatch1 = model.addVar(vtype=\"INTEGER\", name=\"Watch1\", lb=0, ub=100)\nWatch2 = model.addVar(vtype=\"INTEGER\", name=\"Watch2\", lb=100, ub=400)\nWatch_b1 = model.addVar(vtype=\"B\", name=\"Watch_b1\")\nWatch_b2 = model.addVar(vtype=\"B\", name=\"Watch_b2\")\nmodel.addCons(Watch_b1 + Watch_b2 == 1)\nmodel.addCons(Watch == Watch1*Watch_b1 + Watch2*Watch_b2)\nProfit_Watch = 75 * Watch1 * Watch_b1 + (75 + 0.5 * (Watch2 - 100)) * Watch2 * Watch_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Watch)\n\n# Add constraints\n## The production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\nmodel.addCons(5 * Phone + 8 * Tablet + 3 * Watch <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Watch: \", model.getVal(Watch))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. Each production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit. The plant aims to maximize the total production value. The total operating hours for all production lines must not exceed 100 hours per week.\nPlease help the plant manager to determine the optimal number of hours for each production line to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\n## The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize V\nmodel.addCons(obj == V)\n\n# Add constraints\n## The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P_A + P_B + P_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of ComponentA per machine is 10 units per hour, with a defect rate of 5%. ComponentB per machine produces 15 units per hour with a defect rate of 3%. ComponentC per machine produces 20 units per hour with a defect rate of 2%. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate.\n// Effective production rate for ComponentA: RateA = 10 * (1 - 0.05) * MachinesA\n// Effective production rate for ComponentB: RateB = 15 * (1 - 0.03) * MachinesB\n// Effective production rate for ComponentC: RateC = 20 * (1 - 0.02) * MachinesC\n// So, the objective function is: Maximize (RateA + RateB + RateC)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20\n\n## Generate Constraint-3:\nTo maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA.\n// MachinesB >= 0.5 * MachinesA\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the total machines are allocated to ComponentC.\n// MachinesC >= 0.1 * (MachinesA + MachinesB + MachinesC)",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output. The production rate and defect rate for each component per machine are given in the following Table.\n\n| Component | Production Rate per Machine | Defect Rate |\n|-----------|------------------------------|-------------|\n| ComponentA | 10 units per hour            | 5%          |\n| ComponentB | 15 units per hour            | 3%          |\n| ComponentC | 20 units per hour            | 2%          |\n\nThe company has a total of 50 machines available for allocation. Due to space limitations, no more than 20 machines can be allocated to ComponentA. To maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA. The company wants to ensure that at least 10% of the total machines are allocated to ComponentC.\n\nPlease help the company to maximize the total effective production rate, which is the total production rate minus the defect rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ComponentC\n\n# Define objective function\nRateA = 10 * (1 - 0.05) * MachinesA\nRateB = 15 * (1 - 0.03) * MachinesB\nRateC = 20 * (1 - 0.02) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RateA + RateB + RateC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)  # Total machines available\nmodel.addCons(MachinesA <= 20)  # Space limitation for ComponentA\nmodel.addCons(MachinesB >= 0.5 * MachinesA)  # Balanced production for ComponentB\nmodel.addCons(MachinesC >= 0.1 * (MachinesA + MachinesB + MachinesC))  # Minimum allocation for ComponentC\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Effective Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nOn production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. \nOn production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. \nOn production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. \nThe company aims to maximize the total production of all components. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear.\n// The total production of resistors: P_res = 10 * R1^2 + 8 * R2^2 + 6 * R3^2\n// The total production of capacitors: P_cap = 5 * R1^2 + 7 * R2^2 + 9 * R3^2\n// The total production of inductors: P_ind = 3 * R1^2 + 4 * R2^2 + 5 * R3^2\n// The objective function is: Maximize P_total = P_res + P_cap + P_ind\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// R1 + R2 + R3 <= 50",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear. The production rates for each component per worker per hour on each line are given in the following Table.\n\n| Production Line | Resistors | Capacitors | Inductors |\n|-----------------|-----------|------------|-----------|\n| Line 1          | 10 units  | 5 units    | 3 units   |\n| Line 2          | 8 units   | 7 units    | 4 units   |\n| Line 3          | 6 units   | 9 units    | 5 units   |\n\nThe company aims to maximize the total production of all components. There are a total of 50 workers available. Please help the company determine the optimal number of workers to assign to each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0) # number of workers on production line 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0) # number of workers on production line 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0) # number of workers on production line 3\n\n# Define objective function\n## The total production of resistors: P_res = 10 * R1^2 + 8 * R2^2 + 6 * R3^2\n## The total production of capacitors: P_cap = 5 * R1^2 + 7 * R2^2 + 9 * R3^2\n## The total production of inductors: P_ind = 3 * R1^2 + 4 * R2^2 + 5 * R3^2\n## The objective function is: Maximize P_total = P_res + P_cap + P_ind\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10 * R1**2 + 8 * R2**2 + 6 * R3**2 + 5 * R1**2 + 7 * R2**2 + 9 * R3**2 + 3 * R1**2 + 4 * R2**2 + 5 * R3**2)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(R1 + R2 + R3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(R1))\n    print(\"Number of workers on production line 2: \", model.getVal(R2))\n    print(\"Number of workers on production line 3: \", model.getVal(R3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company wants to maximize the net profit per dollar invested.\n// Total revenue: Revenue = 200,000 * Trucks + 100,000 * Vans + 20,000 * Bikes\n// Total cost: Cost = (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes) + (10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes)\n// Net profit: Profit = Revenue - Cost\n// So, the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for vehicle purchases.\n// 100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes <= 5,000,000\n\n## Generate Constraint-2:\nThe company must have at least 50 vehicles in total.\n// Trucks + Vans + Bikes >= 50\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed twice the number of Vans.\n// Trucks <= 2 * Vans\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries.\n// Bikes >= 0.10 * (Trucks + Vans + Bikes)",
        "question": "A logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities. The cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company has a budget of $5,000,000 for vehicle purchases. The company must have at least 50 vehicles in total. The number of Trucks must not exceed twice the number of Vans. The company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries. Please help the company to maximize the net profit per dollar invested.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 200000 * Trucks + 100000 * Vans + 20000 * Bikes\nCost = (100000 * Trucks + 50000 * Vans + 10000 * Bikes) + (10000 * Trucks + 5000 * Vans + 1000 * Bikes)\nProfit = Revenue - Cost\nInvestment = 100000 * Trucks + 50000 * Vans + 10000 * Bikes\n## the objective function is: Maximize Profit / Investment\n## convert the division to multiplication\nmodel.addCons(obj * Investment == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for vehicle purchases.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes <= 5000000)\n## The company must have at least 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes >= 50)\n## The number of Trucks must not exceed twice the number of Vans.\nmodel.addCons(Trucks <= 2 * Vans)\n## The company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries.\nmodel.addCons(Bikes >= 0.10 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Net Profit per Dollar Invested: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\n// {\"hours reactor 1 operates\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 2 operates\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 3 operates\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\n// Total production of chemical A: P_A = 10 * R1 + 7 * R2 + 9 * R3\n// Total production of chemical B: P_B = 5 * R1 + 12 * R2 + 8 * R3\n// Total production of chemical C: P_C = 8 * R1 + 6 * R2 + 10 * R3\n// The objective function is: Maximize (P_A + P_B + P_C) / (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total operational hours for all reactors must not exceed 100 hours.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nEach reactor has a minimum operational requirement of 20 hours to ensure proper functioning.\n// R1 >= 20; R2 >= 20; R3 >= 20",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production. The production rates for each reactor are given in the following Table.\n\n| Reactor | Chemical A | Chemical B | Chemical C |\n|---------|------------|------------|------------|\n| 1       | 10 units   | 5 units    | 8 units    |\n| 2       | 7 units    | 12 units   | 6 units    |\n| 3       | 9 units    | 8 units    | 10 units   |\n\nThe total operational hours for all reactors must not exceed 100 hours. Each reactor has a minimum operational requirement of 20 hours to ensure proper functioning. \nPlease help the manager to maximize the total production of all chemicals while minimizing the operational hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=20) # hours reactor 1 operates\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=20) # hours reactor 2 operates\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=20) # hours reactor 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 10 * R1 + 7 * R2 + 9 * R3\nP_B = 5 * R1 + 12 * R2 + 8 * R3\nP_C = 8 * R1 + 6 * R2 + 10 * R3\nTotalHours = R1 + R2 + R3\n## the objective function is: Maximize (P_A + P_B + P_C) / TotalHours\n## convert the division to multiplication\nmodel.addCons(obj * TotalHours == P_A + P_B + P_C)\n\n# Add constraints\n## The total operational hours for all reactors must not exceed 100 hours.\nmodel.addCons(R1 + R2 + R3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Reactor 1 Operates: \", model.getVal(R1))\n    print(\"Hours Reactor 2 Operates: \", model.getVal(R2))\n    print(\"Hours Reactor 3 Operates: \", model.getVal(R3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs.\n// Fuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\n// Carbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n// So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 5000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 20.\n// Trucks + Vans + Bikes <= 20\n\n## Generate Constraint-3:\nThe company must ensure at least 5 deliveries are made using environmentally friendly vehicles (Bikes).\n// Bikes >= 5",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs. The company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100. The total number of vehicles cannot exceed 20. The company must ensure at least 5 deliveries are made using environmentally friendly vehicles (Bikes). Please help the company to minimize the total cost, which includes both fuel and carbon footprint costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=5)  # number of Bikes\n\n# Define objective function\nFuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\nCarbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\nTotal_Cost = Fuel_Cost + Carbon_Footprint_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Total_Cost)\n\n# Add constraints\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 5000)  # Maintenance budget constraint\nmodel.addCons(Trucks + Vans + Bikes <= 20)  # Total vehicles constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1072,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. The production rate for each product line is as follows:\n\n| Product Line | Production Rate per Worker (units/hour) |\n|--------------|-----------------------------------------|\n| 1            | 10                                      |\n| 2            | 15                                      |\n| 3            | 20                                      |\n\nThe company has a total of 50 workers available. The company aims to maximize the total production rate of all three products. Please help the company determine the optimal number of workers to allocate to each product line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 1200 minutes available for the holiday season.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 1200\n\n## Generate Constraint-2:\nThe bakery has a budget of $800 for ingredient costs.\n// 1 * P1 + 1.5 * P2 + 2 * P3 <= 800\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 500 pastries.\n// P1 + P2 + P3 <= 500\n\n## Generate Constraint-4:\nThe bakery has a minimum order requirement from a client for 50 P1 pastries.\n// P1 >= 50",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season. The selling price, ingredient cost, and baking time for each pastry are given in the following Table.\n\n| Pastry | Selling Price | Ingredient Cost | Baking Time |\n|--------|---------------|-----------------|-------------|\n| P1     | $3            | $1              | 15 minutes  |\n| P2     | $4            | $1.5            | 20 minutes  |\n| P3     | $5            | $2              | 25 minutes  |\n\nThe bakery has a total baking time of 1200 minutes available for the holiday season. The bakery has a budget of $800 for ingredient costs. The bakery has a storage capacity of 500 pastries. The bakery has a minimum order requirement from a client for 50 P1 pastries. The bakery has a single oven and can only bake one type of pastry at a time. \nPlease help the bakery to maximize the profit efficiency (profit per minute of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=50) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 1200 minutes available for the holiday season.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 1200)\n## The bakery has a budget of $800 for ingredient costs.\nmodel.addCons(1 * P1 + 1.5 * P2 + 2 * P3 <= 800)\n## The bakery has a storage capacity of 500 pastries.\nmodel.addCons(P1 + P2 + P3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20 - 10) * A = 20 * A\n// Profit of product B: Profit_B = (70 - 30 - 15) * B = 25 * B\n// Profit of product C: Profit_C = (100 - 40 - 20) * C = 40 * C\n// So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a labor capacity constraint of 500 hours for the next quarter. The labor time required for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\nThe company has a budget of $10,000 for raw materials for the next quarter. The company has a labor capacity constraint of 500 hours for the next quarter, with the labor time required for product A being 2 hours, for product B being 3 hours, and for product C being 4 hours. The company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## The company aims to maximize the total profit, which is the sum of the profits from each product.\nProfit_A = 20 * A\nProfit_B = 25 * B\nProfit_C = 40 * C\n## So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a labor capacity constraint of 500 hours for the next quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints.\n// {\"daily production quantity of ChemicalA\": \"ChemicalAProduction\", \"range\": \"ChemicalAProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalB\": \"ChemicalBProduction\", \"range\": \"ChemicalBProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalC\": \"ChemicalCProduction\", \"range\": \"ChemicalCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals.\n// Total daily profit: Profit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily production capacity of the company is limited to 1000 units.\n// ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\n// ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction)\n\n## Generate Constraint-3:\nThe production of ChemicalA must be at least twice the production of ChemicalB.\n// ChemicalAProduction >= 2 * ChemicalBProduction\n\n## Generate Constraint-4:\nThe company has a daily budget constraint for raw materials, which is $50,000. The cost of raw materials per unit for ChemicalA is $20, ChemicalB is $30, and ChemicalC is $40.\n// 20 * ChemicalAProduction + 30 * ChemicalBProduction + 40 * ChemicalCProduction <= 50,000\n\n## Generate Constraint-5:\nTo ensure a minimum market presence, the company must produce at least 50 units of each chemical daily.\n// ChemicalAProduction >= 50; ChemicalBProduction >= 50; ChemicalCProduction >= 50",
        "question": "A manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Cost of Raw Materials per Unit |\n|----------|-----------------|--------------------------------|\n| ChemicalA | $50             | $20                            |\n| ChemicalB | $70             | $30                            |\n| ChemicalC | $90             | $40                            |\n\nThe company has a total daily production capacity of 1000 units. Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production. The production of ChemicalA must be at least twice the production of ChemicalB. The company has a daily budget constraint for raw materials, which is $50,000. To ensure a minimum market presence, the company must produce at least 50 units of each chemical daily.\n\nPlease help the company to maximize the total daily profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalAProduction\", lb=50) # daily production quantity of ChemicalA\nChemicalBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBProduction\", lb=50) # daily production quantity of ChemicalB\nChemicalCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCProduction\", lb=50) # daily production quantity of ChemicalC\n\n# Define objective function\nProfit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total daily production capacity of the company is limited to 1000 units.\nmodel.addCons(ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000)\n# Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\nmodel.addCons(ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction))\n# The production of ChemicalA must be at least twice the production of ChemicalB.\nmodel.addCons(ChemicalAProduction >= 2 * ChemicalBProduction)\n# The company has a daily budget constraint for raw materials, which is $50,000.\nmodel.addCons(20 * ChemicalAProduction + 30 * ChemicalBProduction + 40 * ChemicalCProduction <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production of ChemicalA: \", model.getVal(ChemicalAProduction))\n    print(\"Daily Production of ChemicalB: \", model.getVal(ChemicalBProduction))\n    print(\"Daily Production of ChemicalC: \", model.getVal(ChemicalCProduction))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company wants to maximize the total profit.\n// The objective function is: Maximize P = 50A + 70B + 60C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe market demand for component A is at least 10 units, and for component B is at least 15 units.\n// A >= 10\n// B >= 15\n\n## Generate Constraint-3:\nThe production capacity is limited. The company can produce at most 20 units of component A, 25 units of component B, and 30 units of component C.\n// A <= 20\n// B <= 25\n// C <= 30\n\n## Generate Constraint-4:\nThe company aims to maintain a balanced production. The ratio of component A to component B should not exceed 1:2, and the ratio of component B to component C should not exceed 3:2.\n// A / B <= 1 / 2\n// B / C <= 3 / 2",
        "question": "A company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand. The profit from each unit of component A is $50, component B is $70, and component C is $60. The company has a limited amount of raw material, with each unit of component A requiring 2 kg, B requiring 3 kg, and C requiring 4 kg, and a total of 100 kg available. The market demand for component A is at least 10 units, and for component B is at least 15 units. The production capacity is limited, with the company able to produce at most 20 units of component A, 25 units of component B, and 30 units of component C. Additionally, the company aims to maintain a balanced production, with the ratio of component A to component B not exceeding 1:2, and the ratio of component B to component C not exceeding 3:2. Please help the company maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * A + 70 * B + 60 * C)\n\n# Add constraints\n# Constraint-1: Raw material constraint\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n# Constraint-2: Market demand constraint\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\n# Constraint-3: Production capacity constraint\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 25)\nmodel.addCons(C <= 30)\n# Constraint-4: Balanced production constraint\nmodel.addCons(A <= 0.5 * B)\nmodel.addCons(B <= 1.5 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per acre is $100, but it requires 2 units of water per acre. \nFor Crop B, the profit per acre is $150, but it requires 3 units of water per acre. \nFor Crop C, the profit per acre is $200, but it requires 4 units of water per acre.\nThe farm aims to maximize the total profit from all crops.\n// Profit from Crop A: Profit_A = 100 * A\n// Profit from Crop B: Profit_B = 150 * B\n// Profit from Crop C: Profit_C = 200 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply, with a maximum of 300 units of water available.\n// 2 * A + 3 * B + 4 * C <= 300\n\n## Generate Constraint-3:\nDue to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\n// A <= 40; B <= 50",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| A    | $100            | 2 units                 |\n| B    | $150            | 3 units                 |\n| C    | $200            | 4 units                 |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a limited water supply, with a maximum of 300 units of water available. Due to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a limited water supply, with a maximum of 300 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n## Due to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\nmodel.addCons(A <= 40)\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements.\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases. The decrease in productivity is modeled as a square root function of the acreage. The farm wants to maximize the total profit from all crops.\n// Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n// Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n// Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n// So, the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// Corn + Wheat + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\n// Corn <= 80; Wheat <= 90; Soybeans <= 70\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10\n\n## Generate Constraint-4:\nDue to market demand, the farm can only sell up to 60 acres of Corn and 50 acres of Wheat.\n// Corn <= 60; Wheat <= 50",
        "question": "A farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements. The profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases, modeled as a square root function of the acreage. The farm wants to maximize the total profit from all crops.\n\n| Crop       | Profit per Acre |\n|------------|-----------------|\n| Corn       | $300            |\n| Wheat      | $250            |\n| Soybeans   | $200            |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans. The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health. Due to market demand, the farm can only sell up to 60 acres of Corn and 50 acres of Wheat.\n\nPlease help the farm determine the optimal acreage for each crop to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10, ub=60) # acreage of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10, ub=50) # acreage of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10, ub=70) # acreage of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n## Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n## Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n## convert the division to multiplication\nsqrt_Corn = model.addVar(name=\"sqrt_Corn\")\nsqrt_Wheat = model.addVar(name=\"sqrt_Wheat\")\nsqrt_Soybeans = model.addVar(name=\"sqrt_Soybeans\")\nmodel.addCons(sqrt_Corn >= 0)\nmodel.addCons(sqrt_Wheat >= 0)\nmodel.addCons(sqrt_Soybeans >= 0)\nmodel.addCons(sqrt_Corn * sqrt_Corn == Corn + 1)\nmodel.addCons(sqrt_Wheat * sqrt_Wheat == Wheat + 1)\nmodel.addCons(sqrt_Soybeans * sqrt_Soybeans == Soybeans + 1)\nProfit_Corn = 300 * Corn / sqrt_Corn\nProfit_Wheat = 250 * Wheat / sqrt_Wheat\nProfit_Soybeans = 200 * Soybeans / sqrt_Soybeans\n## the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\nmodel.addCons(obj == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(Corn + Wheat + Soybeans <= 100)\n## The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\nmodel.addCons(Corn <= 80)\nmodel.addCons(Wheat <= 90)\nmodel.addCons(Soybeans <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\n// {\"number of units of cake A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has only one oven and can only bake one type of cake at a time. The bakery aims to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n// Profit of A: Profit_A = (20 - 5) * A\n// Profit of B: Profit_B = (30 - 10) * B\n// Profit of C: Profit_C = (40 - 15) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1000 for ingredients for the month.\n// 5 * A + 10 * B + 15 * C <= 1000\n\n## Generate Constraint-2:\nThe bakery wants to bake at least 50 units of each cake for the month.\n// A >= 50; B >= 50; C >= 50",
        "question": "A bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources. The selling price, ingredient cost, and baking time for each cake are given in the following Table.\n\n| Cake | Selling Price | Ingredient Cost | Baking Time |\n|------|---------------|-----------------|-------------|\n| A    | $20           | $5              | 1 hour      |\n| B    | $30           | $10             | 2 hours     |\n| C    | $40           | $15             | 3 hours     |\n\nThe bakery has a budget of $1000 for ingredients for the month. The bakery wants to bake at least 50 units of each cake for the month. The bakery has only one oven and can only bake one type of cake at a time. \nPlease help the bakery to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to bake at least 50 units of each cake for the month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of cake A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of cake B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of cake C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (30 - 10) * B\nProfit_C = (40 - 15) * C\nBakingTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a budget of $1000 for ingredients for the month.\nmodel.addCons(5 * A + 10 * B + 15 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(A))\n    print(\"Number of Cake B: \", model.getVal(B))\n    print(\"Number of Cake C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost.\n// Net Profit = 50A - Cost_A(A) + 70B - Cost_B(B) + 90C - Cost_C(C)\n// So, the objective function is: Maximize Net Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per day.\n// A >= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost. The total production capacity of the company is limited to 1000 units per day. The market demand for product A is at least 200 units per day. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate the cost functions\nCost_A = 100 - 0.5 * A**2\nCost_B = 120 - 0.4 * B**2\nCost_C = 150 - 0.3 * C**2\n## calculate the net profit\nNet_Profit = 50 * A - Cost_A + 70 * B - Cost_B + 90 * C - Cost_C\n## the objective function is: Maximize Net Profit\nmodel.addCons(obj == Net_Profit)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"production rate of C1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of C2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of C3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\n// Profit_C1 = 10 * P1 * 0.8 * P1\n// Profit_C2 = 15 * P2 * 0.9 * P2\n// Profit_C3 = 20 * P3 * 1.1 * P3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\n// P1 <= 50; P2 <= 50; P3 <= 50\n\n## Generate Constraint-2:\nThe storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-3:\nThe plant must maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\n// P1 >= 10",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $10, C2 is $15, and C3 is $20. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical. The storage capacity for each chemical is limited, and the total amount of chemicals produced per hour must not exceed 100 units. Additionally, the plant must maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\nPlease help the plant determine the optimal production rates for C1, C2, and C3 to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate of C1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of C2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of C3\n\n# Define objective function\n## The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3.\nProfit_C1 = 10 * P1 * 0.8 * P1\nProfit_C2 = 15 * P2 * 0.9 * P2\nProfit_C3 = 20 * P3 * 1.1 * P3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 50)\nmodel.addCons(P3 <= 50)\n## The storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of C1: \", model.getVal(P1))\n    print(\"Production Rate of C2: \", model.getVal(P2))\n    print(\"Production Rate of C3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company wants to maximize the total profit from the production of these machines.\n// Total profit for MachineA: Profit_A = 500 * MachineA\n// Total profit for MachineB: Profit_B = 700 * MachineB\n// Total profit for MachineC: Profit_C = 900 * MachineC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA + MachineB + MachineC <= 100\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineB <= 2 * MachineA\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month. The cost of raw materials per unit for MachineA is $100, for MachineB is $200, and for MachineC is $300.\n// 100 * MachineA + 200 * MachineB + 300 * MachineC <= 50,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints. The profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company has a total production capacity of 100 machines per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month. The cost of raw materials per unit for MachineA is $100, for MachineB is $200, and for MachineC is $300.\n\nPlease help the company to maximize the total profit from the production of these machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0) # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0) # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0) # number of MachineC\n\n# Define objective function\nProfit_A = 500 * MachineA\nProfit_B = 700 * MachineB\nProfit_C = 900 * MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(MachineA + MachineB + MachineC <= 100) # total production capacity constraint\nmodel.addCons(MachineB <= 2 * MachineA) # resource limitation constraint\nmodel.addCons(100 * MachineA + 200 * MachineB + 300 * MachineC <= 50000) # budget constraint for raw materials\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line.\n// {\"production quantity of new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of new employees\": \"Employees\", \"range\": \"Employees >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company aims to maximize its profit from the new product.\n// Profit = (100 - 50) * Production - 0.01 * Advertising * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget limit of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe production capacity is limited by the number of employees. Each employee can produce 100 units per quarter.\n// Production <= 100 * Employees\n\n## Generate Constraint-3:\nThe company must hire at least 10 new employees to meet the expected demand.\n// Employees >= 10",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line. The company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company has a budget limit of $50,000 for advertising. The production capacity is limited by the number of employees, with each employee capable of producing 100 units per quarter. The company must hire at least 10 new employees to meet the expected demand. Please help the company to maximize its profit from the new product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0)  # production quantity of new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\nEmployees = model.addVar(vtype=\"INTEGER\", name=\"Employees\", lb=0)  # number of new employees\n\n# Define objective function\nProfit = (100 - 50) * Production - 0.01 * Advertising * Production\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Advertising <= 50000)  # advertising budget limit\nmodel.addCons(Production <= 100 * Employees)  # production capacity constraint\nmodel.addCons(Employees >= 10)  # minimum number of employees\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Employees: \", model.getVal(Employees))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company wants to maximize the total profit.\n// Profit for ProductA: Profit_A = (50 - 0.1 * max(ProdA - 100, 0)) * ProdA\n// Profit for ProductB: Profit_B = (70 - 0.2 * max(ProdB - 50, 0)) * ProdB\n// Profit for ProductC: Profit_C = (90 - 0.3 * max(ProdC - 20, 0)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units for all products combined.\n// ProdA + ProdB + ProdC <= 200\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProdB <= 2 * ProdA\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for raw materials, and the cost of raw materials per unit is $20 for ProductA, $30 for ProductB, and $40 for ProductC.\n// 20 * ProdA + 30 * ProdB + 40 * ProdC <= 10,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit. The profit per unit for each product decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Product | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|---------|-----------------------------------|------------------------------------|-----------|\n| ProductA | $50 (first 100 units)             | $0.1                               | 100 units  |\n| ProductB | $70 (first 50 units)              | $0.2                               | 50 units   |\n| ProductC | $90 (first 20 units)              | $0.3                               | 20 units   |\n\nThe company has a total production capacity of 200 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a budget of $10,000 for raw materials, and the cost of raw materials per unit is $20 for ProductA, $30 for ProductB, and $40 for ProductC.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(ProdA - 100, 0)) * ProdA\nProdA1 = model.addVar(vtype=\"INTEGER\", name=\"ProdA1\", lb=0, ub=100)\nProdA2 = model.addVar(vtype=\"INTEGER\", name=\"ProdA2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProdA == ProdA1*A_b1 + ProdA2*A_b2)\nProfit_A = (50 - 0.1 * ProdA2) * ProdA2 * A_b2 + 50 * ProdA1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (70 - 0.2 * max(ProdB - 50, 0)) * ProdB\nProdB1 = model.addVar(vtype=\"INTEGER\", name=\"ProdB1\", lb=0, ub=50)\nProdB2 = model.addVar(vtype=\"INTEGER\", name=\"ProdB2\", lb=50, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProdB == ProdB1*B_b1 + ProdB2*B_b2)\nProfit_B = (70 - 0.2 * ProdB2) * ProdB2 * B_b2 + 70 * ProdB1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (90 - 0.3 * max(ProdC - 20, 0)) * ProdC\nProdC1 = model.addVar(vtype=\"INTEGER\", name=\"ProdC1\", lb=0, ub=20)\nProdC2 = model.addVar(vtype=\"INTEGER\", name=\"ProdC2\", lb=20, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProdC == ProdC1*C_b1 + ProdC2*C_b2)\nProfit_C = (90 - 0.3 * ProdC2) * ProdC2 * C_b2 + 90 * ProdC1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(ProdA + ProdB + ProdC <= 200)\nmodel.addCons(ProdB <= 2 * ProdA)\nmodel.addCons(20 * ProdA + 30 * ProdB + 40 * ProdC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\n// {\"number of crops in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 units of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 units of energy. \nThe farm aims to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.\n// Profit from greenhouse A: Profit_A = 50 * A\n// Profit from greenhouse B: Profit_B = 70 * B\n// Profit from greenhouse C: Profit_C = 90 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A^2 + 3 * B^2 + 4 * C^2)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available for all greenhouses.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of energy available for all greenhouses.\n// A + 2 * B + 3 * C <= 50\n\n## Generate Constraint-3:\nThe farm wants to ensure that at least 5 crops are grown in each greenhouse.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints. The profit, water requirement, and energy requirement for each greenhouse are given in the following Table.\n\n| Greenhouse | Profit per Crop | Water Requirement | Energy Requirement |\n|------------|-----------------|-------------------|--------------------|\n| A          | $50             | 2 units           | 1 unit             |\n| B          | $70             | 3 units           | 2 units            |\n| C          | $90             | 4 units           | 3 units            |\n\nThe farm has a total of 100 units of water available for all greenhouses. The farm also has a total of 50 units of energy available for all greenhouses. The farm wants to ensure that at least 5 crops are grown in each greenhouse. \n\nPlease help the farm to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage, defined as the sum of the profit from each greenhouse divided by the sum of the squared resource usage in each greenhouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to ensure that at least 5 crops are grown in each greenhouse.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of crops in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of crops in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of crops in greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nResourceUsage = 2 * A**2 + 3 * B**2 + 4 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available for all greenhouses.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of energy available for all greenhouses.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Crops in Greenhouse A: \", model.getVal(A))\n    print(\"Number of Crops in Greenhouse B: \", model.getVal(B))\n    print(\"Number of Crops in Greenhouse C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1301,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total monthly fuel cost. The fuel cost per kilometer for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.2. The expected monthly mileage for trucks is 10,000 km, for vans is 8,000 km, and for motorcycles is 5,000 km.\n// Total fuel cost for trucks: Cost_Trucks = 0.5 * 10,000 * Trucks\n// Total fuel cost for vans: Cost_Vans = 0.3 * 8,000 * Vans\n// Total fuel cost for motorcycles: Cost_Motorcycles = 0.2 * 5,000 * Motorcycles\n// So, the objective function is: Minimize (Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000.\n// 20,000 * Trucks + 15,000 * Vans + 5,000 * Motorcycles <= 100,000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 10.\n// Trucks + Vans + Motorcycles <= 10",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations. The company aims to minimize the total monthly fuel cost. The fuel cost per kilometer for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.2. The expected monthly mileage for trucks is 10,000 km, for vans is 8,000 km, and for motorcycles is 5,000 km. The company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000. The total number of vehicles cannot exceed 10. Please help the company determine the optimal number of each vehicle type to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\n\n# Define objective function\nCost_Trucks = 0.5 * 10000 * Trucks\nCost_Vans = 0.3 * 8000 * Vans\nCost_Motorcycles = 0.2 * 5000 * Motorcycles\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n# Add constraints\nmodel.addCons(20000 * Trucks + 15000 * Vans + 5000 * Motorcycles <= 100000)\nmodel.addCons(Trucks + Vans + Motorcycles <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 790,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity for Product A\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product B\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product C\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $90. The company wants to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * QuantityA\n// Total profit for Product B: ProfitB = 70 * QuantityB\n// Total profit for Product C: ProfitC = 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units.\n// 2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $90             |\n\nThe raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units.\n\nPlease help the company to maximize the total profit from all products, given the constraint that the total raw material usage must not exceed 1000 units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for Product A\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for Product B\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for Product C\n\n# Define objective function\nProfitA = 50 * QuantityA\nProfitB = 70 * QuantityB\nProfitC = 90 * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(QuantityA))\n    print(\"Production Quantity for Product B: \", model.getVal(QuantityB))\n    print(\"Production Quantity for Product C: \", model.getVal(QuantityC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is limited to 200 units.\n// A <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor. The profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor. The profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor. The profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor. The company has a budget of $10,000 for raw materials and labor. The production capacity for product A is limited to 200 units. Please help the company to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons((10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C) <= 10000)\n## The production capacity for product A is limited to 200 units.\nmodel.addCons(A <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a plot of land divided into three sections: A, B, and C. The farmer needs to decide how much of each section to allocate for growing three different crops: wheat, corn, and soybeans.\n// {\"area of section A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area of section B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area of section C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for wheat is 5 tons, for corn is 6 tons, and for soybeans is 4 tons. The market prices for these crops are $200 per ton of wheat, $250 per ton of corn, and $300 per ton of soybeans. The farmer aims to maximize the total revenue from selling the crops, but also wants to consider the environmental impact, which is modeled as a quadratic function of the total area used.\n// Revenue from wheat: Rev_wheat = 5 * A * 200\n// Revenue from corn: Rev_corn = 6 * B * 250\n// Revenue from soybeans: Rev_soy = 4 * C * 300\n// Environmental impact: Env_impact = A^2 + B^2 + C^2\n// So, the objective function is: Maximize (Rev_wheat + Rev_corn + Rev_soy) - 0.01 * Env_impact\n\n## Generate Constraint-1:\nThe total area available for farming is 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 hectares to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe farmer has a budget constraint for fertilizers and other inputs, which is $10,000. The cost per hectare for wheat is $100, for corn is $120, and for soybeans is $80.\n// 100 * A + 120 * B + 80 * C <= 10,000",
        "question": "A farmer has a plot of land divided into three sections: A, B, and C. The farmer needs to decide how much of each section to allocate for growing three different crops: wheat, corn, and soybeans. The yield per hectare for wheat is 5 tons, for corn is 6 tons, and for soybeans is 4 tons. The market prices for these crops are $200 per ton of wheat, $250 per ton of corn, and $300 per ton of soybeans. The farmer aims to maximize the total revenue from selling the crops, but also wants to consider the environmental impact, which is modeled as a quadratic function of the total area used. The total area available for farming is 100 hectares. The farmer must allocate at least 20 hectares to each crop. The farmer has a budget constraint for fertilizers and other inputs, which is $10,000. The cost per hectare for wheat is $100, for corn is $120, and for soybeans is $80.\nPlease help the farmer to maximize the total revenue from selling the crops while considering the environmental impact, which is defined as (Revenue from wheat + Revenue from corn + Revenue from soybeans) - 0.01 * (Environmental impact).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # area of section A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=20) # area of section B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=20) # area of section C\n\n# Define objective function\n## Revenue from wheat: Rev_wheat = 5 * A * 200\n## Revenue from corn: Rev_corn = 6 * B * 250\n## Revenue from soybeans: Rev_soy = 4 * C * 300\n## Environmental impact: Env_impact = A^2 + B^2 + C^2\n## So, the objective function is: Maximize (Rev_wheat + Rev_corn + Rev_soy) - 0.01 * Env_impact\nRev_wheat = 5 * A * 200\nRev_corn = 6 * B * 250\nRev_soy = 4 * C * 300\nEnv_impact = A**2 + B**2 + C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Rev_wheat + Rev_corn + Rev_soy - 0.01 * Env_impact)\n\n# Add constraints\n## The total area available for farming is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget constraint for fertilizers and other inputs, which is $10,000.\nmodel.addCons(100 * A + 120 * B + 80 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of section A: \", model.getVal(A))\n    print(\"Area of section B: \", model.getVal(B))\n    print(\"Area of section C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\n// Cost_A = (10 - 0.0001 * Automation) * A\n// Cost_B = (15 - 0.0001 * Automation) * B\n// Cost_C = (20 - 0.0001 * Automation) * C\n// So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A is at least 200 units, and for component B is at least 150 units.\n// A >= 200; B >= 150\n\n## Generate Constraint-3:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of component C.\n// C >= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\nThe total production capacity of the company is 1000 units. The demand for component A is at least 200 units, and for component B is at least 150 units. The investment in automation cannot exceed $50,000. The company must produce at least 50 units of component C.\nPlease help the company determine the optimal production quantities of components A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of component C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (10 - 0.0001 * Automation) * A\nCost_B = (15 - 0.0001 * Automation) * B\nCost_C = (20 - 0.0001 * Automation) * C\n# So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000) # total production capacity\nmodel.addCons(Automation <= 50000) # investment in automation\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 998,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n// Profit from Crop A: Profit_A = (5 * 100 - 300) * A\n// Profit from Crop B: Profit_B = (7 * 120 - 400) * B\n// Profit from Crop C: Profit_C = (6 * 110 - 350) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to cultivate at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-3:\nThe total cost of cultivation should not exceed $35,000.\n// 300 * A + 400 * B + 350 * C <= 35000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The expected yield, selling price, and cost of cultivation for each crop are given in the following Table.\n\n| Crop | Expected Yield (tons/acre) | Selling Price ($/ton) | Cost of Cultivation ($/acre) |\n|------|----------------------------|-----------------------|------------------------------|\n| A    | 5                          | 100                   | 300                          |\n| B    | 7                          | 120                   | 400                          |\n| C    | 6                          | 110                   | 350                          |\n\nThe farm has a total of 100 acres available for cultivation. The farmer wants to cultivate at least 10 acres of each crop. The total cost of cultivation should not exceed $35,000. \nPlease help the farmer to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to cultivate at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 - 300) * A\nProfit_B = (7 * 120 - 400) * B\nProfit_C = (6 * 110 - 350) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total cost of cultivation should not exceed $35,000.\nmodel.addCons(300 * A + 400 * B + 350 * C <= 35000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n// Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n// Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n// Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints. The profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|---------------------------|\n| ComponentA | $50             | 20 * sqrt(UnitsA)         |\n| ComponentB | $70             | 30 * sqrt(UnitsB)         |\n| ComponentC | $90             | 40 * sqrt(UnitsC)         |\n\nThe company has a total production capacity of 1000 units per week. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n## Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n## Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n## Convert the square root terms to variables to linearize the objective\nsqrt_UnitsA = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_UnitsA\")\nsqrt_UnitsB = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_UnitsB\")\nsqrt_UnitsC = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_UnitsC\")\nmodel.addCons(sqrt_UnitsA * sqrt_UnitsA == UnitsA)\nmodel.addCons(sqrt_UnitsB * sqrt_UnitsB == UnitsB)\nmodel.addCons(sqrt_UnitsC * sqrt_UnitsC == UnitsC)\nProfitA = (50 - 20 * sqrt_UnitsA) * UnitsA\nProfitB = (70 - 30 * sqrt_UnitsB) * UnitsB\nProfitC = (90 - 40 * sqrt_UnitsC) * UnitsC\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1150,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility.\n// {\"labor hours at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility produces a different type of component. The efficiency of production varies with the amount of labor hours invested. \nAt facility 1, the production rate of component 1 is 0.5 units per labor hour, and the production rate of component 2 is 0.3 units per labor hour. \nAt facility 2, the production rate of component 1 is 0.4 units per labor hour, and the production rate of component 2 is 0.6 units per labor hour. \nAt facility 3, the production rate of component 1 is 0.6 units per labor hour, and the production rate of component 2 is 0.4 units per labor hour.\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. Determine the minimum total labor hours required to meet the monthly demand.\n// The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n// The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n// So, the objective function is: Minimize max(T1, T2)\n\n## Generate Constraint-1:\nThe total labor hours available across all facilities is limited to 800 hours.\n// L1 + L2 + L3 <= 800",
        "question": "A company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility. The production rates for two types of components at each facility are given in the following Table.\n\n| Facility | Component 1 Production Rate (units/hour) | Component 2 Production Rate (units/hour) |\n|----------|------------------------------------------|------------------------------------------|\n| 1        | 0.5                                      | 0.3                                      |\n| 2        | 0.4                                      | 0.6                                      |\n| 3        | 0.6                                      | 0.4                                      |\n\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. The total labor hours available across all facilities is limited to 800 hours. \nPlease help the company determine the minimum total labor hours required to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours at facility 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours at facility 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n## The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n## So, the objective function is: Minimize max(T1, T2)\n## Convert the division to multiplication\nT1 = model.addVar('T1')\nT2 = model.addVar('T2')\nmodel.addCons(T1 == 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3))\nmodel.addCons(T2 == 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3))\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\n\n# Add constraints\n## The total labor hours available across all facilities is limited to 800 hours.\nmodel.addCons(L1 + L2 + L3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours at facility 1: \", model.getVal(L1))\n    print(\"Labor hours at facility 2: \", model.getVal(L2))\n    print(\"Labor hours at facility 3: \", model.getVal(L3))\n    print(\"Minimum total labor hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Watch\": \"Watch\", \"range\": \"Watch >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\n\n## Generate Constraint-1:\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units.\n// 5 * Phone + 8 * Tablet + 3 * Watch <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units.\n// Phone <= 300; Tablet <= 250; Watch <= 400\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 800 units across all devices.\n// Phone + Tablet + Watch <= 800\n\n## Generate Constraint-4:\nTo ensure quality control, the production of Watch must not exceed twice the production of Phone.\n// Watch <= 2 * Phone",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Watch. They need to determine the production quantities of each device to maximize profit while considering the constraints of resources and market demand. The profit per unit of Phone is $100, for Tablet is $150, and for Watch is $75. Due to economies of scale, the profit per unit increases by $0.5 for each device type when production exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n\nThe production of each device requires a certain amount of a critical component. For Phone, it requires 5 units; for Tablet, 8 units; and for Watch, 3 units. The total available amount of this component is 2000 units. The market has a demand limit for each device. For Phone, the demand limit is 300 units. For Tablet, the demand limit is 250 units. For Watch, the demand limit is 400 units. The manufacturer has a total production capacity of 800 units across all devices. To ensure quality control, the production of Watch must not exceed twice the production of Phone.\n\nPlease help the manufacturer to determine the optimal production quantities of each device to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=0, ub=300) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=250) # quantity of Tablet\nWatch = model.addVar(vtype=\"INTEGER\", name=\"Watch\", lb=0, ub=400) # quantity of Watch\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=300)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=250)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Watch = max(75 + 0.5 * (Watch - 100), 75) * Watch\nWatch1 = model.addVar(vtype=\"INTEGER\", name=\"Watch1\", lb=0, ub=100)\nWatch2 = model.addVar(vtype=\"INTEGER\", name=\"Watch2\", lb=100, ub=400)\nWatch_b1 = model.addVar(vtype=\"B\", name=\"Watch_b1\")\nWatch_b2 = model.addVar(vtype=\"B\", name=\"Watch_b2\")\nmodel.addCons(Watch_b1 + Watch_b2 == 1)\nmodel.addCons(Watch == Watch1*Watch_b1 + Watch2*Watch_b2)\nProfit_Watch = 75 * Watch1 * Watch_b1 + (75 + 0.5 * (Watch2 - 100)) * Watch2 * Watch_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Watch\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Watch)\n\n# Add constraints\nmodel.addCons(5 * Phone + 8 * Tablet + 3 * Watch <= 2000)\nmodel.addCons(Phone + Tablet + Watch <= 800)\nmodel.addCons(Watch <= 2 * Phone)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Watch: \", model.getVal(Watch))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1210,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nProduct A requires a minimum production of 50 units to meet contractual obligations.\n// A >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit from product A is $50 per unit, but it requires a setup cost of $1000. The profit from product B is $70 per unit, but it requires a setup cost of $1500. The profit from product C is $90 per unit, but it requires a setup cost of $2000. The company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Product A requires a minimum production of 50 units to meet contractual obligations. Please help the company to maximize its total profit, considering the setup costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit from product A: Profit_A = 50 * A - 1000\n## Total profit from product B: Profit_B = 70 * B - 1500\n## Total profit from product C: Profit_C = 90 * C - 2000\nProfit_A = 50 * A - 1000\nProfit_B = 70 * B - 1500\nProfit_C = 90 * C - 2000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 708,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nOn production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. \nOn production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. \nOn production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. \nThe company aims to maximize the total production of all components. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear.\n// The total production of resistors: P_res = 10 * R1^2 + 8 * R2^2 + 6 * R3^2\n// The total production of capacitors: P_cap = 5 * R1^2 + 7 * R2^2 + 9 * R3^2\n// The total production of inductors: P_ind = 3 * R1^2 + 4 * R2^2 + 5 * R3^2\n// The objective function is: Maximize P_total = P_res + P_cap + P_ind\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// R1 + R2 + R3 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 20 workers.\n// R1 <= 20; R2 <= 20; R3 <= 20",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear. The production rates for each component per worker per hour on each line are given in the following Table.\n\n| Production Line | Resistors | Capacitors | Inductors |\n|-----------------|-----------|------------|-----------|\n| Line 1          | 10 units  | 5 units    | 3 units   |\n| Line 2          | 8 units   | 7 units    | 4 units   |\n| Line 3          | 6 units   | 9 units    | 5 units   |\n\nThe company aims to maximize the total production of all components. There are a total of 50 workers available. Each production line can be staffed by up to 20 workers. Please help the company determine the optimal number of workers to assign to each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=20) # number of workers on production line 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=20) # number of workers on production line 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=20) # number of workers on production line 3\n\n# Define objective function\n## The objective function is: Maximize P_total = P_res + P_cap + P_ind\nP_res = 10 * R1**2 + 8 * R2**2 + 6 * R3**2\nP_cap = 5 * R1**2 + 7 * R2**2 + 9 * R3**2\nP_ind = 3 * R1**2 + 4 * R2**2 + 5 * R3**2\nP_total = P_res + P_cap + P_ind\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(R1 + R2 + R3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(R1))\n    print(\"Number of workers on production line 2: \", model.getVal(R2))\n    print(\"Number of workers on production line 3: \", model.getVal(R3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations.\n// {\"quantity of ChemX\": \"ChemX\", \"range\": \"ChemX >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemY\": \"ChemY\", \"range\": \"ChemY >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemZ\": \"ChemZ\", \"range\": \"ChemZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nThe profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nThe profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit (profit minus production and storage costs).\n// NetProfit_ChemX = (100 - 50 - 10) * ChemX\n// NetProfit_ChemY = (150 - 70 - 15) * ChemY\n// NetProfit_ChemZ = (200 - 100 - 20) * ChemZ\n// So, the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / (ChemX + ChemY + ChemZ)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// ChemX + ChemY + ChemZ <= 200\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\n// ChemY <= 2 * ChemX",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations. The profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. The profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. The profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20. The company wants to maximize the net profit per unit (profit minus production and storage costs). The company has a total production capacity of 200 units across all chemicals. Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX. Please help the company to maximize the net profit per unit (profit minus production and storage costs) per total unit produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemX = model.addVar(vtype=\"INTEGER\", name=\"ChemX\", lb=0) # quantity of ChemX\nChemY = model.addVar(vtype=\"INTEGER\", name=\"ChemY\", lb=0) # quantity of ChemY\nChemZ = model.addVar(vtype=\"INTEGER\", name=\"ChemZ\", lb=0) # quantity of ChemZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_ChemX = (100 - 50 - 10) * ChemX\nNetProfit_ChemY = (150 - 70 - 15) * ChemY\nNetProfit_ChemZ = (200 - 100 - 20) * ChemZ\nTotalProduction = ChemX + ChemY + ChemZ\n## the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(ChemX + ChemY + ChemZ <= 200)\n## Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\nmodel.addCons(ChemY <= 2 * ChemX)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChemX: \", model.getVal(ChemX))\n    print(\"Quantity of ChemY: \", model.getVal(ChemY))\n    print(\"Quantity of ChemZ: \", model.getVal(ChemZ))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\n// Total energy output: Output = (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage)\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarPanels + 2000 * WindTurbines <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage technology cannot exceed $50,000.\n// EnergyStorage <= 50000\n\n## Generate Constraint-3:\nThe region has space for a maximum of 500 solar panels and 300 wind turbines.\n// SolarPanels <= 500; WindTurbines <= 300",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods.\nThe energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage technology cannot exceed $50,000. The region has space for a maximum of 500 solar panels and 300 wind turbines.\nPlease help the company to maximize the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=500)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=300)  # number of wind turbines\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)  # investment in energy storage\n\n# Define objective function\nOutput = model.addVar('Output')\nmodel.setObjective(Output, \"maximize\")\nEnergyLossReduction = 1 - 0.00005 * EnergyStorage\nmodel.addCons(Output == (100 * SolarPanels + 200 * WindTurbines) * EnergyLossReduction)\n\n# Add constraints\nmodel.addCons(1000 * SolarPanels + 2000 * WindTurbines <= 1000000)  # budget constraint\nmodel.addCons(EnergyStorage <= 50000)  # investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage: \", model.getVal(EnergyStorage))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per quarter. \nFor Product B, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per quarter. \nFor Product C, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per quarter.\nThe company aims to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).\n// Selling profit of A: Profit_A = (50 - 30 - 5) * A\n// Selling profit of B: Profit_B = (70 - 40 - 7) * B\n// Selling profit of C: Profit_C = (90 - 50 - 9) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A + 7 * B + 9 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs for the next quarter.\n// 30 * A + 40 * B + 50 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter.\nFor Product A, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per quarter. \nFor Product B, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per quarter. \nFor Product C, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per quarter.\nThe company has a budget of $10,000 for production costs for the next quarter.\nPlease help the company to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 30 - 5) * A\nProfit_B = (70 - 40 - 7) * B\nProfit_C = (90 - 50 - 9) * C\nStorageCost = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs for the next quarter.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of tomatoes on plot 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"acres of potatoes on plot 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"acres of carrots on plot 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit from selling the crops. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n// Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n// Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n// Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n// So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation across all plots is 100 acres.\n// T1 + P2 + C3 <= 100",
        "question": "A farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops. The total area available for cultivation across all plots is 100 acres.\n\nPlease help the farmer to maximize his profit from selling the crops by determining the optimal number of acres to allocate to each crop on each plot.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # acres of tomatoes on plot 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # acres of potatoes on plot 2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of carrots on plot 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n## Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n## Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n## So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\nmodel.addCons(obj == (500 * T1 - 10 * T1**3 + 300 * P2 - 5 * P2**3 + 400 * C3 - 8 * C3**3))\n\n# Add constraints\n## The total area available for cultivation across all plots is 100 acres.\nmodel.addCons(T1 + P2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Tomatoes on Plot 1: \", model.getVal(T1))\n    print(\"Acres of Potatoes on Plot 2: \", model.getVal(P2))\n    print(\"Acres of Carrots on Plot 3: \", model.getVal(C3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 555,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investment in production efficiency.\n// Efficiency <= 10000\n\n## Generate Constraint-3:\nThe company has a limited raw material budget of $5000.\n// 30 * A + 50 * B <= 5000\n\n## Generate Constraint-4:\nThe market demand for Product A is 100 units. So, the company can only sell a maximum of 100 units of Product A.\n// A <= 100",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company has a total production capacity of 200 hours and a budget of $10,000 for investment in production efficiency. The company has a limited raw material budget of $5000. The market demand for Product A is 100 units. So, the company can only sell a maximum of 100 units of Product A. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n## The company has a budget of $10,000 for investment in production efficiency.\nmodel.addCons(Efficiency <= 10000)\n## The company has a limited raw material budget of $5000.\nmodel.addCons(30 * A + 50 * B <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $10, for component B is $15, and for component C is $20. The selling price for component A is $25, for component B is $30, and for component C is $40. The plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n// Profit for component A: Profit_A = (25 - 10) * A\n// Profit for component B: Profit_B = (30 - 15) * B\n// Profit for component C: Profit_C = (40 - 20) * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 20 units of each component to meet minimum order requirements.\n// A >= 20; B >= 20; C >= 20",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints. The production cost and selling price for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price |\n|-----------|-----------------|---------------|\n| A         | $10             | $25           |\n| B         | $15             | $30           |\n| C         | $20             | $40           |\n\nThe plant has a budget of $1000 for production costs. The plant must produce at least 20 units of each component to meet minimum order requirements. \nPlease help the plant to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each component to meet minimum order requirements.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"quantity of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Device A is $10, for Device B is $15, and for Device C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100), 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. Device A requires 5 grams, Device B requires 8 grams, and Device C requires 10 grams. The total supply of this rare metal is limited to 1500 grams.\n// 5 * A + 8 * B + 10 * C <= 1500\n\n## Generate Constraint-2:\nThere is a market demand limit for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\n// A <= 300; B <= 400; C <= 500\n\n## Generate Constraint-3:\nThe company has a total production capacity of 1000 units across all devices.\n// A + B + C <= 1000\n\n## Generate Constraint-4:\nTo ensure product diversity and market coverage, the company must produce at least 50 units of each device type.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit of each device and the requirements for a rare metal are given in the following Table.\n\n| Device | Profit per Unit | Rare Metal Requirement (grams) |\n|--------|-----------------|--------------------------------|\n| A      | $10             | 5                              |\n| B      | $15             | 8                              |\n| C      | $20             | 10                             |\n\nDue to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The company has a limited supply of 1500 grams of a rare metal. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units. The company has a total production capacity of 1000 units across all devices. To ensure product diversity and market coverage, the company must produce at least 50 units of each device type.\n\nPlease help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## To ensure product diversity and market coverage, the company must produce at least 50 units of each device type.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of Device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The production of each device requires a specific amount of a rare metal. Device A requires 5 grams, Device B requires 8 grams, and Device C requires 10 grams. The total supply of this rare metal is limited to 1500 grams.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1500)\n## There is a market demand limit for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\nmodel.addCons(A <= 300)\nmodel.addCons(B <= 400)\nmodel.addCons(C <= 500)\n## The company has a total production capacity of 1000 units across all devices.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1233,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per month.\n// B >= 150\n\n## Generate Constraint-4:\nThe company cannot produce more than 300 units of product C due to limited raw material availability.\n// C <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n\n| Product | Profit per Unit | Production Cost Model |\n|---------|-----------------|-----------------------|\n| A       | $50             | 0.01 * A^2           |\n| B       | $70             | 0.02 * B^2           |\n| C       | $90             | 0.03 * C^2           |\n\nThe total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month. The market demand for product B is at least 150 units per month. The company cannot produce more than 300 units of product C due to limited raw material availability.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300)  # number of units of product C\n\n# Define objective function\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nNetProfit = Revenue - Cost\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)  # Total production capacity constraint\nmodel.addCons(A >= 200)  # Market demand for product A\nmodel.addCons(B >= 150)  # Market demand for product B\nmodel.addCons(C <= 300)  # Limited raw material availability for product C\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1360,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach product line has a maximum capacity of 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. Each worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products. The company has a total of 50 workers available and each product line has a maximum capacity of 20 workers.\nPlease help the company determine the optimal number of workers to assign to each product line (W1 for product line 1, W2 for product line 2, and W3 for product line 3) to maximize the total production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time.\n// Profit_E1 = 30 * E1 - 10 * E1\n// Profit_E2 = 40 * E2 - 15 * E2\n// Profit_E3 = 50 * E3 - 20 * E3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (E1 + 2 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// E1 + 2 * E2 + 3 * E3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $3000 for production costs.\n// 10 * E1 + 15 * E2 + 20 * E3 <= 3000\n\n## Generate Constraint-3:\nThe market demand for E1 is 50 units, and the company can only sell a maximum of 50 units of E1.\n// E1 <= 50\n\n## Generate Constraint-4:\nThe total production quantity of all components should not exceed 100 units.\n// E1 + E2 + E3 <= 100",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand. The profit per unit, production cost per unit, and production time per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|-----------|-----------------|--------------------------|-------------------------|\n| E1        | $30             | $10                      | 1 hour                   |\n| E2        | $40             | $15                      | 2 hours                  |\n| E3        | $50             | $20                      | 3 hours                  |\n\nThe company has a total production capacity of 200 hours. The company has a budget of $3000 for production costs. The market demand for E1 is 50 units, and the company can only sell a maximum of 50 units of E1. The total production quantity of all components should not exceed 100 units. \n\nPlease help the company to maximize the profit per hour of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * E1\nProfit_E2 = (40 - 15) * E2\nProfit_E3 = (50 - 20) * E3\nProductionTime = E1 + 2 * E2 + 3 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 200)\n## The company has a budget of $3000 for production costs.\nmodel.addCons(10 * E1 + 15 * E2 + 20 * E3 <= 3000)\n## The market demand for E1 is 50 units, and the company can only sell a maximum of 50 units of E1.\nmodel.addCons(E1 <= 50)\n## The total production quantity of all components should not exceed 100 units.\nmodel.addCons(E1 + E2 + E3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1182,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from barley: Profit_B = 150 * B\n// Total water used: Water_Total = 5 * W + 8 * C + 3 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (5 * W + 8 * C + 3 * B)\n\n## Generate Constraint-1:\nThe farmer has a total of 1000 units of water available for irrigation.\n// 5 * W + 8 * C + 3 * B <= 1000",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage. The profit per acre and water usage per acre for each crop are given in the following Table.\n\n| Crop   | Profit per Acre | Water Usage per Acre |\n|--------|-----------------|----------------------|\n| Wheat  | $200            | 5 units              |\n| Corn   | $300            | 8 units              |\n| Barley | $150            | 3 units              |\n\nThe farmer has a total of 1000 units of water available for irrigation. Please help the farmer to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_B = 150 * B\nWater_Total = 5 * W + 8 * C + 3 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 1000 units of water available for irrigation.\nmodel.addCons(5 * W + 8 * C + 3 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 736,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type. Each machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. Please help the manufacturer determine the optimal number of machines for capacitors, resistors, and inductors to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0) # number of machines for inductors\n\n# Define objective function\n## Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n## Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Capacitors: \", model.getVal(Cap))\n    print(\"Number of Machines for Resistors: \", model.getVal(Res))\n    print(\"Number of Machines for Inductors: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E).\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation over a 10-year period. The cost function is nonlinear and includes initial installation costs and annual operational costs. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n// Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for initial installation.\n// 1000 * S + 2000 * W + 3000 * E <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E). The company aims to minimize the total cost of installation and operation over a 10-year period. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit. The company has a budget of $100,000 for initial installation. Please help the company to minimize the total cost of installation and operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n## convert the division to multiplication\nmodel.addCons(obj == 1000 * S + 2000 * W + 3000 * E + 10 * (50 * S + 100 * W + 150 * E))\n\n# Add constraints\n## The company has a budget of $100,000 for initial installation.\nmodel.addCons(1000 * S + 2000 * W + 3000 * E <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Number of Energy Storage Systems: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency. The profit function is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit.\n// Formal definition: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800\n\n## Generate Constraint-3:\nThe total raw materials available are 1200 units.\n// R <= 1200\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of each product. This requirement can be met if the total effective production capacity (considering the nonlinear efficiency) is at least 50.\n// 50 <= 1000 * L^0.5 * M^0.6 * R^0.4",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency, and is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit. The total labor hours available are 1000 hours, the total machine hours available are 800 hours, and the total raw materials available are 1200 units. Additionally, the company must produce at least 50 units of each product, which can be met if the total effective production capacity (considering the nonlinear efficiency) is at least 50. Please help the company determine the optimal allocation of labor hours (L), machine hours (M), and raw materials (R) to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0)  # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0)  # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0)  # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\nmodel.addCons(obj == 1000 * L**0.5 * M**0.6 * R**0.4 - 500 * (L + M + R))\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n## The total raw materials available are 1200 units.\nmodel.addCons(R <= 1200)\n## The company must produce at least 50 units of each product.\nmodel.addCons(50 <= 1000 * L**0.5 * M**0.6 * R**0.4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. Each unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant has a total of 100 hours available for production. Please help the plant to maximize the total profit while considering the production time constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 635,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. Due to economies of scale, the profit per unit increases by $0.1 for each additional 10 units produced for each type of device. The company aims to maximize the total profit from the sales of these devices.\n// Profit_DeviceA = (100 + 0.1 * floor((DeviceA - 1) / 10)) * DeviceA\n// Profit_DeviceB = (150 + 0.1 * floor((DeviceB - 1) / 10)) * DeviceB\n// Profit_DeviceC = (200 + 0.1 * floor((DeviceC - 1) / 10)) * DeviceC\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all devices.\n// DeviceA + DeviceB + DeviceC <= 500\n\n## Generate Constraint-2:\nDue to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceB <= 2 * DeviceA",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities for each device to optimize their profit. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. Due to economies of scale, the profit per unit increases by $0.1 for each additional 10 units produced for each type of device. The company has a total production capacity of 500 units across all devices. Due to limited resources, the production of DeviceB cannot exceed twice the production of DeviceA. Please help the company to maximize the total profit from the sales of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # quantity of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (100 + 0.1 * floor((DeviceA - 1) / 10)) * DeviceA\nDeviceA_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceA_segment_{i}\") for i in range(50)]\nDeviceA_profits = [100 + 0.1 * i for i in range(50)]\nfor i in range(49):\n    model.addCons(DeviceA_segments[i] <= DeviceA_segments[i + 1])\nmodel.addCons(DeviceA == sum(DeviceA_segments))\nProfit_DeviceA = sum(profit * segment for profit, segment in zip(DeviceA_profits, DeviceA_segments))\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (150 + 0.1 * floor((DeviceB - 1) / 10)) * DeviceB\nDeviceB_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceB_segment_{i}\") for i in range(50)]\nDeviceB_profits = [150 + 0.1 * i for i in range(50)]\nfor i in range(49):\n    model.addCons(DeviceB_segments[i] <= DeviceB_segments[i + 1])\nmodel.addCons(DeviceB == sum(DeviceB_segments))\nProfit_DeviceB = sum(profit * segment for profit, segment in zip(DeviceB_profits, DeviceB_segments))\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (200 + 0.1 * floor((DeviceC - 1) / 10)) * DeviceC\nDeviceC_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceC_segment_{i}\") for i in range(50)]\nDeviceC_profits = [200 + 0.1 * i for i in range(50)]\nfor i in range(49):\n    model.addCons(DeviceC_segments[i] <= DeviceC_segments[i + 1])\nmodel.addCons(DeviceC == sum(DeviceC_segments))\nProfit_DeviceC = sum(profit * segment for profit, segment in zip(DeviceC_profits, DeviceC_segments))\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\nmodel.addCons(DeviceB <= 2 * DeviceA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 666,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two different products, Product A and Product B, and the amount of money to be invested in enhancing the production efficiency of Product A.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency for Product A\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of Product A decreases by $5 for every $1000 invested in efficiency upgrades. The initial production cost of Product A is $100 per unit, and for Product B is $80 per unit. The selling price for both products is $150 per unit. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (150 - 100 + 0.005 * EfficiencyInvestment) * ProductA + (150 - 80) * ProductB\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B.\n// ProductA <= 1000; ProductB <= 800\n\n## Generate Constraint-2:\nThe total investment in production efficiency for Product A cannot exceed $50,000.\n// EfficiencyInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two different products, Product A and Product B, and the amount of money to be invested in enhancing the production efficiency of Product A. The production cost of Product A decreases by $5 for every $1000 invested in efficiency upgrades. The initial production cost of Product A is $100 per unit, and for Product B is $80 per unit. The selling price for both products is $150 per unit. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for Product A and 800 units for Product B. The total investment in production efficiency for Product A cannot exceed $50,000. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=1000)  # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=800)  # production quantity of Product B\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0, ub=50000)  # investment in production efficiency for Product A\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * EfficiencyInvestment) * ProductA + (150 - 80) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(ProductA <= 1000)\nmodel.addCons(ProductB <= 800)\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in Production Efficiency for Product A: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// P_A <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 30 hours per week.\n// P_B <= 30\n\n## Generate Constraint-4:\nThe production line C can operate for a maximum of 50 hours per week.\n// P_C <= 50\n\n## Generate Constraint-5:\nThe plant must produce at least 500 units of product A, 600 units of product B, and 800 units of product C per week.\n// 10 * P_A >= 500\n// 15 * P_B >= 600\n// 20 * P_C >= 800",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. The efficiency rates and unit values for each product are given in the following Table.\n\n| Production Line | Units Produced per Hour | Unit Value |\n|-----------------|-------------------------|------------|\n| A               | 10                      | $5         |\n| B               | 15                      | $7         |\n| C               | 20                      | $9         |\n\nThe plant aims to maximize the total production value. The total operating hours for all production lines must not exceed 100 hours per week. The production line A can operate for a maximum of 40 hours per week, line B for a maximum of 30 hours per week, and line C for a maximum of 50 hours per week. The plant must also ensure that it produces at least 500 units of product A, 600 units of product B, and 800 units of product C per week.\n\nPlease help the plant manager to determine the optimal number of hours each production line should operate to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == V)\n\n# Add constraints\nmodel.addCons(P_A + P_B + P_C <= 100) # total operating hours for all production lines must not exceed 100 hours per week\nmodel.addCons(P_A <= 40) # production line A can operate for a maximum of 40 hours per week\nmodel.addCons(P_B <= 30) # production line B can operate for a maximum of 30 hours per week\nmodel.addCons(P_C <= 50) # production line C can operate for a maximum of 50 hours per week\nmodel.addCons(10 * P_A >= 500) # plant must produce at least 500 units of product A per week\nmodel.addCons(15 * P_B >= 600) # plant must produce at least 600 units of product B per week\nmodel.addCons(20 * P_C >= 800) # plant must produce at least 800 units of product C per week\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from A: Revenue_A = 20 * A\n// Revenue from B: Revenue_B = 30 * B\n// Revenue from C: Revenue_C = 40 * C\n// Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\n// Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\n// So, the objective function is: Maximize (Total_Revenue - Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1000 for production costs.\n// 10 * A^0.5 + 15 * B^0.5 + 20 * C^0.5 <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| A       | $20             | 10 * A^0.5                |\n| B       | $30             | 15 * B^0.5                |\n| C       | $40             | 20 * C^0.5                |\n\nThe plant has a limited budget of $1000 for production costs. Please help the plant to determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Revenue and Cost calculations\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Revenue = Revenue_A + Revenue_B + Revenue_C\n\n## Approximating the square root costs with additional variables\nsqrt_A = model.addVar(name=\"sqrt_A\")\nsqrt_B = model.addVar(name=\"sqrt_B\")\nsqrt_C = model.addVar(name=\"sqrt_C\")\nmodel.addCons(sqrt_A * sqrt_A == A)\nmodel.addCons(sqrt_B * sqrt_B == B)\nmodel.addCons(sqrt_C * sqrt_C == C)\n\nCost_A = 10 * sqrt_A\nCost_B = 15 * sqrt_B\nCost_C = 20 * sqrt_C\nTotal_Cost = Cost_A + Cost_B + Cost_C\n\n## the objective function is: Maximize (Total_Revenue - Total_Cost)\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The plant has a limited budget of $1000 for production costs.\nmodel.addCons(10 * sqrt_A + 15 * sqrt_B + 20 * sqrt_C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1118,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 1000 kg, the cost per acre is $500, and the market price per kg is $1. \nFor C2, the yield per acre is 1500 kg, the cost per acre is $600, and the market price per kg is $1.2. \nFor C3, the yield per acre is 2000 kg, the cost per acre is $700, and the market price per kg is $1.5.\nThe farm wants to maximize the profit per acre (revenue minus cost per acre).\n// Profit_C1 = (1000 * C1 * 1) - (500 * C1)\n// Profit_C2 = (1500 * C2 * 1.2) - (600 * C2)\n// Profit_C3 = (2000 * C3 * 1.5) - (700 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres of land available.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for crop production costs.\n// 500 * C1 + 600 * C2 + 700 * C3 <= 50000\n\n## Generate Constraint-3:\nThe market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1.\n// 1000 * C1 <= 50000",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The yield per acre, cost per acre, and market price per kg for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Cost per Acre | Market Price per Kg |\n|------|----------------|---------------|---------------------|\n| C1   | 1000 kg        | $500          | $1                  |\n| C2   | 1500 kg        | $600          | $1.2                |\n| C3   | 2000 kg        | $700          | $1.5                |\n\nThe farm has a total of 100 acres of land available. The farm has a budget of $50,000 for crop production costs. The market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1. \nPlease help the farm to maximize the profit per acre (revenue minus cost per acre).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # area of land for C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # area of land for C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 * C1 * 1) - (500 * C1)\nProfit_C2 = (1500 * C2 * 1.2) - (600 * C2)\nProfit_C3 = (2000 * C3 * 1.5) - (700 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 acres of land available.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farm has a budget of $50,000 for crop production costs.\nmodel.addCons(500 * C1 + 600 * C2 + 700 * C3 <= 50000)\n## The market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1.\nmodel.addCons(1000 * C1 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(C1))\n    print(\"Area of Land for C2: \", model.getVal(C2))\n    print(\"Area of Land for C3: \", model.getVal(C3))\n    print(\"Maximized Profit Per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor hours.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (ProductA - 100), 10) * ProductA\n// Profit_B = max(15 + 0.02 * (ProductB - 100), 15) * ProductB\n// Profit_C = max(20 + 0.02 * (ProductC - 100), 20) * ProductC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Each unit of product A requires 5 kg of raw material, product B requires 8 kg, and product C requires 10 kg. The total available raw material is 2000 kg.\n// 5 * ProductA + 8 * ProductB + 10 * ProductC <= 2000\n\n## Generate Constraint-2:\nThe company has a limited labor force. Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total available labor hours are 1000 hours.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-3:\nThe market demand for product A is at most 300 units, for product B is at most 250 units, and for product C is at most 200 units.\n// ProductA <= 300; ProductB <= 250; ProductC <= 200\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\n// ProductA >= 100; ProductB >= 100; ProductC >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor hours. The profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sale of these products.\n\nThe company has a limited supply of raw materials. Each unit of product A requires 5 kg of raw material, product B requires 8 kg, and product C requires 10 kg. The total available raw material is 2000 kg. The company also has a limited labor force. Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total available labor hours are 1000 hours.\n\nThe market demand for product A is at most 300 units, for product B is at most 250 units, and for product C is at most 200 units. The company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit while adhering to these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=100) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=100) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (ProductA - 100), 10) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=100, ub=300)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=300, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (ProductB - 100), 15) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=100, ub=250)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=250, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (ProductC - 100), 20) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=100, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * ProductA + 8 * ProductB + 10 * ProductC <= 2000)\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\nmodel.addCons(ProductA <= 300)\nmodel.addCons(ProductB <= 250)\nmodel.addCons(ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. For product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. For product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. For product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20. The company wants to maximize the total net profit, considering both production and storage costs. The company has a total production capacity of 200 units and a budget of $10,000 for production costs. Please help the company determine the optimal production quantities for P1, P2, and P3.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. The company needs to decide the daily production quantities of each chemical to optimize its profit.\n// {\"daily production quantity of Chemical A\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of Chemical B\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of Chemical C\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from Chemical A is $50 per unit, but it decreases by 1% for each unit produced beyond the first 100 units. The profit from Chemical B is $70 per unit, but it decreases by 0.5% for each unit produced beyond the first 50 units. The profit from Chemical C is $100 per unit, but it decreases by 0.2% for each unit produced beyond the first 200 units. The company aims to maximize its total daily profit.\n// Profit from Chemical A: Profit_A = 50 * Q_A - 0.01 * Q_A * (Q_A - 100) if Q_A > 100 else 50 * Q_A\n// Profit from Chemical B: Profit_B = 70 * Q_B - 0.005 * Q_B * (Q_B - 50) if Q_B > 50 else 70 * Q_B\n// Profit from Chemical C: Profit_C = 100 * Q_C - 0.002 * Q_C * (Q_C - 200) if Q_C > 200 else 100 * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a daily production capacity of 500 units in total.\n// Q_A + Q_B + Q_C <= 500",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. The company needs to decide the daily production quantities of each chemical to optimize its profit. The profit from each chemical decreases as more units are produced beyond certain thresholds. Specifically, the profit from Chemical A is $50 per unit, but it decreases by 1% for each unit produced beyond the first 100 units. The profit from Chemical B is $70 per unit, but it decreases by 0.5% for each unit produced beyond the first 50 units. The profit from Chemical C is $100 per unit, but it decreases by 0.2% for each unit produced beyond the first 200 units. The company aims to maximize its total daily profit.\n\n| Chemical | Profit per Unit | Decrease Rate | Threshold Units |\n|----------|-----------------|---------------|-----------------|\n| A        | $50             | 1%            | 100             |\n| B        | $70             | 0.5%          | 50              |\n| C        | $100            | 0.2%          | 200             |\n\nThe company has a daily production capacity of 500 units in total. Please help the company determine the optimal daily production quantities of each chemical to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_A\", lb=0) # daily production quantity of Chemical A\nQ_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_B\", lb=0) # daily production quantity of Chemical B\nQ_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_C\", lb=0) # daily production quantity of Chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = 50 * Q_A - 0.01 * Q_A * (Q_A - 100) if Q_A > 100 else 50 * Q_A\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(Q_A == A1*A_b1 + A2*A_b2)\nProfit_A = 50 * A1 * A_b1 + (50 - 0.01 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = 70 * Q_B - 0.005 * Q_B * (Q_B - 50) if Q_B > 50 else 70 * Q_B\nB1 = model.addVar(vtype=\"CONTINUOUS\", name=\"B1\", lb=0, ub=50)\nB2 = model.addVar(vtype=\"CONTINUOUS\", name=\"B2\", lb=50, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(Q_B == B1*B_b1 + B2*B_b2)\nProfit_B = 70 * B1 * B_b1 + (70 - 0.005 * (B2 - 50)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = 100 * Q_C - 0.002 * Q_C * (Q_C - 200) if Q_C > 200 else 100 * Q_C\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(Q_C == C1*C_b1 + C2*C_b2)\nProfit_C = 100 * C1 * C_b1 + (100 - 0.002 * (C2 - 200)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(Q_A + Q_B + Q_C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production Quantity of Chemical A: \", model.getVal(Q_A))\n    print(\"Daily Production Quantity of Chemical B: \", model.getVal(Q_B))\n    print(\"Daily Production Quantity of Chemical C: \", model.getVal(Q_C))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop.\n// {\"area for crop C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yields and costs for each crop. \nFor C1, the yield per hectare is 5 tons, the cost per hectare is $1000, and the market price per ton is $200. \nFor C2, the yield per hectare is 7 tons, the cost per hectare is $1200, and the market price per ton is $250. \nFor C3, the yield per hectare is 9 tons, the cost per hectare is $1500, and the market price per ton is $300.\nThe farmer wants to maximize the profit per hectare (revenue minus cost per hectare).\n// Profit_C1 = (5 * C1 * 200) - (1000 * C1)\n// Profit_C2 = (7 * C2 * 250) - (1200 * C2)\n// Profit_C3 = (9 * C3 * 300) - (1500 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 hectares.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $100,000 for cultivation costs.\n// 1000 * C1 + 1200 * C2 + 1500 * C3 <= 100000",
        "question": "A farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop. The yields, costs, and market prices per ton for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Cost per Hectare | Market Price per Ton |\n|------|-------------------|------------------|----------------------|\n| C1   | 5 tons            | $1000            | $200                 |\n| C2   | 7 tons            | $1200            | $250                 |\n| C3   | 9 tons            | $1500            | $300                 |\n\nThe total available land for cultivation is 100 hectares. The farm has a budget of $100,000 for cultivation costs. The farmer wants to maximize the profit per hectare (revenue minus cost per hectare). Please help the farmer determine the optimal area to allocate for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # area for crop C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # area for crop C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # area for crop C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * C1 * 200) - (1000 * C1)\nProfit_C2 = (7 * C2 * 250) - (1200 * C2)\nProfit_C3 = (9 * C3 * 300) - (1500 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The total available land for cultivation is 100 hectares.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farm has a budget of $100,000 for cultivation costs.\nmodel.addCons(1000 * C1 + 1200 * C2 + 1500 * C3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop C1: \", model.getVal(C1))\n    print(\"Area for Crop C2: \", model.getVal(C2))\n    print(\"Area for Crop C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two different products, Product A and Product B, and the amount of money to be invested in enhancing the production efficiency of Product A.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency for Product A\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of Product A decreases by $5 for every $1000 invested in efficiency upgrades. The initial production cost of Product A is $100 per unit, and for Product B is $80 per unit. The selling price for both products is $150 per unit. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (150 - 100 + 0.005 * EfficiencyInvestment) * ProductA + (150 - 80) * ProductB\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B.\n// ProductA <= 1000; ProductB <= 800\n\n## Generate Constraint-2:\nThe total investment in production efficiency for Product A cannot exceed $50,000.\n// EfficiencyInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two different products, Product A and Product B, and the amount of money to be invested in enhancing the production efficiency of Product A. The production cost of Product A decreases by $5 for every $1000 invested in efficiency upgrades. The initial production cost of Product A is $100 per unit, and for Product B is $80 per unit. The selling price for both products is $150 per unit. The company aims to maximize the total profit from both products.\n\n| Product | Selling Price | Initial Production Cost | Efficiency Impact |\n|---------|---------------|-------------------------|-------------------|\n| A       | 150$          | 100$                    | -5$ per $1000    |\n| B       | 150$          | 80$                     | N/A               |\n\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B. The total investment in production efficiency for Product A cannot exceed $50,000.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=1000)  # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=800)  # production quantity of Product B\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0, ub=50000)  # investment in production efficiency for Product A\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * EfficiencyInvestment) * ProductA + (150 - 80) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(ProductA <= 1000)\nmodel.addCons(ProductB <= 800)\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in Production Efficiency for Product A: \", model.getVal(EfficiencyInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1138,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. Additionally, the bakery is considering investing in a new oven that can reduce baking time per cake.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"investment in new oven\": \"OvenInvestment\", \"range\": \"OvenInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe baking time per cake decreases by 5 minutes for every $1000 invested in the new oven. The initial baking time per cake is 60 minutes. The selling price per cake is $30. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking.\n// Revenue per Chocolate cake: Revenue_Chocolate = 30 * Chocolate\n// Revenue per Vanilla cake: Revenue_Vanilla = 30 * Vanilla\n// Revenue per Strawberry cake: Revenue_Strawberry = 30 * Strawberry\n// Total revenue considering baking time: TotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / (60 - 0.005 * OvenInvestment) * (Chocolate + Vanilla + Strawberry)\n// So, the objective function is: Maximize TotalRevenue\n\n## Generate Constraint-1:\nThe bakery has a budget of $10,000 for the new oven.\n// OvenInvestment <= 10000\n\n## Generate Constraint-2:\nThe bakery can bake a maximum of 1000 cakes in total.\n// Chocolate + Vanilla + Strawberry <= 1000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season and is considering investing in a new oven that can reduce baking time per cake. The baking time per cake decreases by 5 minutes for every $1000 invested in the new oven, with an initial baking time per cake of 60 minutes. The selling price per cake is $30. The bakery has a budget of $10,000 for the new oven and can bake a maximum of 1000 cakes in total. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking. Please help the bakery determine the optimal number of each type of cake to bake and the amount to invest in the new oven to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nOvenInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenInvestment\", lb=0) # investment in new oven\n\n# Define objective function\nRevenue_Chocolate = 30 * Chocolate\nRevenue_Vanilla = 30 * Vanilla\nRevenue_Strawberry = 30 * Strawberry\nBakingTimeReduction = 60 - 0.005 * OvenInvestment\nTotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / BakingTimeReduction * (Chocolate + Vanilla + Strawberry)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * BakingTimeReduction * (Chocolate + Vanilla + Strawberry) == Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry)\n\n# Add constraints\nmodel.addCons(OvenInvestment <= 10000)\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Investment in new oven: \", model.getVal(OvenInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit while considering the cost of raw materials and the efficiency of production lines.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of raw materials for P1 is $30 per unit, and for P2 is $40 per unit. The revenue per unit for P1 is $50, and for P2 is $60. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for P1 is 1 hour, and for P2 is 1.5 hours. The company aims to maximize the total profit from both products.\n// Profit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\n// Profit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// P1 + 1.5 * P2 <= 200 - EfficiencyInvestment\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $15,000.\n// EfficiencyInvestment <= 15000\n\n## Generate Constraint-3:\nThe market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1.\n// P1 <= 50\n\n## Generate Constraint-4:\nThe company has a budget of $2000 for raw materials.\n// 30 * P1 + 40 * P2 <= 2000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the investment in production efficiency upgrades to optimize their profit while considering the cost of raw materials and the efficiency of production lines. The cost of raw materials for P1 is $30 per unit, and for P2 is $40 per unit. The revenue per unit for P1 is $50, and for P2 is $60. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for P1 is 1 hour, and for P2 is 1.5 hours. The company has a total production capacity of 200 hours and a budget of $2000 for raw materials. The total investment in production efficiency upgrades cannot exceed $15,000. The market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=50)  # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0)  # quantity of P2\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in production efficiency\n\n# Define objective function\nProfit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\nProfit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + 1.5 * P2 <= 200 - EfficiencyInvestment)  # total production capacity\nmodel.addCons(EfficiencyInvestment <= 15000)  # investment limit\nmodel.addCons(30 * P1 + 40 * P2 <= 2000)  # budget for raw materials\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\n// TruckB <= 0.5 * TruckA\n\n## Generate Constraint-3:\nThe company has a maximum of 100 trucks available in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nTo ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC.\n// TruckC >= 0.1 * (TruckA + TruckB + TruckC)",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations. The operational costs for each type of truck, including fuel, maintenance, and driver wages, are given in the following Table.\n\n| Truck Type | Fuel Cost | Maintenance Cost | Driver Wages |\n|------------|-----------|------------------|--------------|\n| TruckA     | $5000     | $2000            | $3000        |\n| TruckB     | $6000     | $2500            | $3500        |\n| TruckC     | $7000     | $3000            | $4000        |\n\nThe company has a total budget of $500,000 for truck operations. Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA. The company has a maximum of 100 trucks available in total. To ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC.\n\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n# Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\nmodel.addCons(TruckB <= 0.5 * TruckA)\n# The company has a maximum of 100 trucks available in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n# To ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC.\nmodel.addCons(TruckC >= 0.1 * (TruckA + TruckB + TruckC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. \nEach unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. \nEach unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit.\nThe company aims to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = 10 * A\n// Profit of B: Profit_B = 15 * B\n// Profit of C: Profit_C = 20 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 2 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a total of 200 kg of raw material available.\n// 2 * A + 4 * B + 3 * C <= 200\n\n## Generate Constraint-2:\nThe company has a total of 150 hours of labor available.\n// 3 * A + 2 * B + 5 * C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability. Each unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. Each unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. Each unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit. The company has a total of 200 kg of raw material available and a total of 150 hours of labor available. The company aims to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLaborHours = 3 * A + 2 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 200 kg of raw material available.\nmodel.addCons(2 * A + 4 * B + 3 * C <= 200)\n## The company has a total of 150 hours of labor available.\nmodel.addCons(3 * A + 2 * B + 5 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit.\n// {\"amount of raw material for chemical A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit function for each chemical is nonlinear and given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units.\n// RA + RB + RC <= 1000",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit. The profit from each chemical depends on the amount of raw material used, and the profit functions for each chemical are given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\n\nThe plant manager wants to maximize the total profit from all three chemicals. The total amount of raw material available is 1000 units.\n\nPlease help the plant manager determine the optimal allocation of raw material to each chemical production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # amount of raw material for chemical A\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # amount of raw material for chemical B\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # amount of raw material for chemical C\n\n# Define objective function\n## The profit function for each chemical is nonlinear and given by:\n## Chemical A: PA = 50 * RA^0.7\n## Chemical B: PB = 60 * RB^0.8\n## Chemical C: PC = 70 * RC^0.6\n## The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\nPA = 50 * RA**0.7\nPB = 60 * RB**0.8\nPC = 70 * RC**0.6\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical A: \", model.getVal(RA))\n    print(\"Amount of Raw Material for Chemical B: \", model.getVal(RB))\n    print(\"Amount of Raw Material for Chemical C: \", model.getVal(RC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit.\n// {\"hours for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the production hours. For product A, the profit per hour is 100 - 0.5A (in dollars). For product B, it is 150 - B (in dollars). For product C, it is 200 - 2C (in dollars). The plant manager wants to maximize the total daily profit.\n// The objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 12 hours per day.\n// A + B + C <= 12",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit. The profit per hour for each product is different and depends on the production hours, as shown in the following Table.\n\n| Product | Profit per Hour Formula |\n|---------|-------------------------|\n| A       | 100 - 0.5A (in dollars) |\n| B       | 150 - B (in dollars)    |\n| C       | 200 - 2C (in dollars)   |\n\nThe total operating hours for all production lines cannot exceed 12 hours per day. Please help the plant manager to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hours for product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hours for product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hours for product C\n\n# Define objective function\n## The objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\nProfit_A = (100 - 0.5 * A) * A\nProfit_B = (150 - B) * B\nProfit_C = (200 - 2 * C) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total operating hours for all production lines cannot exceed 12 hours per day.\nmodel.addCons(A + B + C <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product A: \", model.getVal(A))\n    print(\"Hours for Product B: \", model.getVal(B))\n    print(\"Hours for Product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 650,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from Wheat is $100 per acre, from Corn is $150 per acre, and from Soybeans is $120 per acre. However, due to soil degradation, the yield per acre decreases nonlinearly with the increase in the total acres of a crop. The yield reduction factor is 0.95 for each additional acre of the same crop above 100 acres. The farm aims to maximize its total revenue from all crops.\n// Revenue_Wheat = 100 * max(Wheat * 0.95^(Wheat - 100), Wheat)\n// Revenue_Corn = 150 * max(Corn * 0.95^(Corn - 100), Corn)\n// Revenue_Soybeans = 120 * max(Soybeans * 0.95^(Soybeans - 100), Soybeans)\n// So, the objective function is: Maximize Revenue_Wheat + Revenue_Corn + Revenue_Soybeans\n\n## Generate Constraint-1:\nThe farm has a total of 500 acres available for cultivation.\n// Wheat + Corn + Soybeans <= 500\n\n## Generate Constraint-2:\nDue to labor constraints, the farm can only manage a maximum of 200 acres of Wheat.\n// Wheat <= 200",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively. The revenue per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. However, due to soil degradation, the yield per acre decreases nonlinearly with the increase in the total acres of a crop. The yield reduction factor is 0.95 for each additional acre of the same crop above 100 acres. The farm aims to maximize its total revenue from all crops.\n\n| Crop       | Revenue per Acre | Yield Reduction Factor |\n|------------|------------------|------------------------|\n| Wheat      | 100$             | 0.95^(Acres - 100)     |\n| Corn       | 150$             | 0.95^(Acres - 100)     |\n| Soybeans   | 120$             | 0.95^(Acres - 100)     |\n\nThe farm has a total of 500 acres available for cultivation. Due to labor constraints, the farm can only manage a maximum of 200 acres of Wheat. Please help the farm to maximize its total revenue from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0, ub=200) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Revenue_Wheat = 100 * max(Wheat * 0.95^(Wheat - 100), Wheat)\nWheat1 = model.addVar(vtype=\"INTEGER\", name=\"Wheat1\", lb=0, ub=100)\nWheat2 = model.addVar(vtype=\"INTEGER\", name=\"Wheat2\", lb=100, ub=200)\nWheat_b1 = model.addVar(vtype=\"B\", name=\"Wheat_b1\")\nWheat_b2 = model.addVar(vtype=\"B\", name=\"Wheat_b2\")\nmodel.addCons(Wheat_b1 + Wheat_b2 == 1)\nmodel.addCons(Wheat == Wheat1*Wheat_b1 + Wheat2*Wheat_b2)\nRevenue_Wheat = 100 * Wheat1 * Wheat_b1 + 100 * Wheat2 * Wheat_b2\n## create piecewise variables for piecewise function: Revenue_Corn = 150 * max(Corn * 0.95^(Corn - 100), Corn)\nCorn1 = model.addVar(vtype=\"INTEGER\", name=\"Corn1\", lb=0, ub=100)\nCorn2 = model.addVar(vtype=\"INTEGER\", name=\"Corn2\", lb=100, ub=500)\nCorn_b1 = model.addVar(vtype=\"B\", name=\"Corn_b1\")\nCorn_b2 = model.addVar(vtype=\"B\", name=\"Corn_b2\")\nmodel.addCons(Corn_b1 + Corn_b2 == 1)\nmodel.addCons(Corn == Corn1*Corn_b1 + Corn2*Corn_b2)\nRevenue_Corn = 150 * Corn1 * Corn_b1 + 150 * Corn2 * Corn_b2\n## create piecewise variables for piecewise function: Revenue_Soybeans = 120 * max(Soybeans * 0.95^(Soybeans - 100), Soybeans)\nSoybeans1 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans1\", lb=0, ub=100)\nSoybeans2 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans2\", lb=100, ub=500)\nSoybeans_b1 = model.addVar(vtype=\"B\", name=\"Soybeans_b1\")\nSoybeans_b2 = model.addVar(vtype=\"B\", name=\"Soybeans_b2\")\nmodel.addCons(Soybeans_b1 + Soybeans_b2 == 1)\nmodel.addCons(Soybeans == Soybeans1*Soybeans_b1 + Soybeans2*Soybeans_b2)\nRevenue_Soybeans = 120 * Soybeans1 * Soybeans_b1 + 120 * Soybeans2 * Soybeans_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Revenue_Wheat + Revenue_Corn + Revenue_Soybeans\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n## The farm has a total of 500 acres available for cultivation.\nmodel.addCons(Wheat + Corn + Soybeans <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type to maximize profit.\n// {\"hours allocated to product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product type varies and is influenced by market demand and production efficiency. \nFor product 1, the profit per hour is 100 - 5 * H1. \nFor product 2, the profit per hour is 150 - 10 * H2. \nFor product 3, the profit per hour is 200 - 15 * H3.\nThe company aims to maximize the total daily profit from all three products.\n// The objective function is: Maximize (100 - 5 * H1) * H1 + (150 - 10 * H2) * H2 + (200 - 15 * H3) * H3\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H1 + H2 + H3 <= 8\n\n## Generate Constraint-2:\nDue to maintenance and setup requirements, at least 1 hour must be allocated to each product type.\n// H1 >= 1; H2 >= 1; H3 >= 1\n\n## Generate Constraint-3:\nThe production line can only handle a maximum of 3 hours for product 1 and 4 hours for product 2 and 3.\n// H1 <= 3; H2 <= 4; H3 <= 4",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type to maximize profit. The profit per hour for each product type varies and is influenced by market demand and production efficiency. For product 1, the profit per hour is 100 - 5 * H1. For product 2, the profit per hour is 150 - 10 * H2. For product 3, the profit per hour is 200 - 15 * H3. The company aims to maximize the total daily profit from all three products. The total available hours for production in a day is 8 hours. Due to maintenance and setup requirements, at least 1 hour must be allocated to each product type. The production line can only handle a maximum of 3 hours for product 1 and 4 hours for product 2 and 3. Please help the company to maximize the total daily profit from all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=1, ub=3) # hours allocated to product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=1, ub=4) # hours allocated to product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=1, ub=4) # hours allocated to product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_H1 = (100 - 5 * H1) * H1\nProfit_H2 = (150 - 10 * H2) * H2\nProfit_H3 = (200 - 15 * H3) * H3\n## the objective function is: Maximize (100 - 5 * H1) * H1 + (150 - 10 * H2) * H2 + (200 - 15 * H3) * H3\nmodel.addCons(obj == Profit_H1 + Profit_H2 + Profit_H3)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H1 + H2 + H3 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in improving the production efficiency of both products.\n// {\"number of units for Product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units for Product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in efficiency upgrades. The initial production cost per unit for Product A is $100 and for Product B is $150. The selling price per unit for Product A is $200 and for Product B is $250. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (200 - (100 - 0.0005 * EfficiencyInvestment)) * UnitsA\n// Total profit for Product B: ProfitB = (250 - (150 - 0.0005 * EfficiencyInvestment)) * UnitsB\n// So, the objective function is: Maximize (ProfitA + ProfitB)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B.\n// UnitsA <= 1000; UnitsB <= 800\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $50,000.\n// EfficiencyInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product A and 150 units of Product B to meet contractual obligations.\n// UnitsA >= 200; UnitsB >= 150",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the number of units to produce for two different products, Product A and Product B, and the amount of money to invest in improving the production efficiency of both products. The initial production cost per unit, selling price per unit, and the effect of efficiency investment on production cost are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit | Effect of Efficiency Investment on Production Cost |\n|---------|----------------------------------|------------------------|--------------------------------------------------|\n| A       | $100                             | $200                   | $5 decrease for every $10,000 invested           |\n| B       | $150                             | $250                   | $5 decrease for every $10,000 invested           |\n\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B. The total investment in production efficiency upgrades cannot exceed $50,000. The company must produce at least 200 units of Product A and 150 units of Product B to meet contractual obligations.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=200, ub=1000)  # number of units for Product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=150, ub=800)  # number of units for Product B\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0)  # investment in production efficiency\n\n# Define objective function\nProfitA = (200 - (100 - 0.0005 * EfficiencyInvestment)) * UnitsA\nProfitB = (250 - (150 - 0.0005 * EfficiencyInvestment)) * UnitsB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units for Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units for Product B: \", model.getVal(UnitsB))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1290,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project.\n// {\"number of units of CondoX\": \"CondoX\", \"range\": \"CondoX >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoY\": \"CondoY\", \"range\": \"CondoY >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoZ\": \"CondoZ\", \"range\": \"CondoZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoX, the selling price is $200,000, the construction cost is $120,000, and the construction time is 3 months. \nFor CondoY, the selling price is $250,000, the construction cost is $150,000, and the construction time is 4 months. \nFor CondoZ, the selling price is $300,000, the construction cost is $180,000, and the construction time is 5 months.\nThe developer aims to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).\n// Selling profit of CondoX: Profit_CondoX = (200,000 - 120,000) * CondoX\n// Selling profit of CondoY: Profit_CondoY = (250,000 - 150,000) * CondoY\n// Selling profit of CondoZ: Profit_CondoZ = (300,000 - 180,000) * CondoZ\n// So, the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / (3 * CondoX + 4 * CondoY + 5 * CondoZ)\n\n## Generate Constraint-1:\nThe developer has a budget of $10,000,000 for construction costs for the project.\n// 120,000 * CondoX + 150,000 * CondoY + 180,000 * CondoZ <= 10,000,000\n\n## Generate Constraint-2:\nThe developer wants to ensure that at least 50 units of each type of condo are built.\n// CondoX >= 50; CondoY >= 50; CondoZ >= 50\n\n## Generate Constraint-3:\nThe developer has a maximum construction time of 200 months for the entire project.\n// 3 * CondoX + 4 * CondoY + 5 * CondoZ <= 200",
        "question": "A real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project.\nFor CondoX, the selling price is $200,000, the construction cost is $120,000, and the construction time is 3 months. \nFor CondoY, the selling price is $250,000, the construction cost is $150,000, and the construction time is 4 months. \nFor CondoZ, the selling price is $300,000, the construction cost is $180,000, and the construction time is 5 months.\nThe developer has a budget of $10,000,000 for construction costs for the project. The developer wants to ensure that at least 50 units of each type of condo are built. The developer has a maximum construction time of 200 months for the entire project.\nPlease help the developer to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The developer wants to ensure that at least 50 units of each type of condo are built.\nCondoX = model.addVar(vtype=\"INTEGER\", name=\"CondoX\", lb=50) # number of units of CondoX\nCondoY = model.addVar(vtype=\"INTEGER\", name=\"CondoY\", lb=50) # number of units of CondoY\nCondoZ = model.addVar(vtype=\"INTEGER\", name=\"CondoZ\", lb=50) # number of units of CondoZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoX = (200000 - 120000) * CondoX\nProfit_CondoY = (250000 - 150000) * CondoY\nProfit_CondoZ = (300000 - 180000) * CondoZ\nConstructionTime = 3 * CondoX + 4 * CondoY + 5 * CondoZ\n## the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / ConstructionTime\n## convert the division to multiplication\nmodel.addCons(obj * ConstructionTime == Profit_CondoX + Profit_CondoY + Profit_CondoZ)\n\n# Add constraints\n## The developer has a budget of $10,000,000 for construction costs for the project.\nmodel.addCons(120000 * CondoX + 150000 * CondoY + 180000 * CondoZ <= 10000000)\n## The developer has a maximum construction time of 200 months for the entire project.\nmodel.addCons(3 * CondoX + 4 * CondoY + 5 * CondoZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoX: \", model.getVal(CondoX))\n    print(\"Number of CondoY: \", model.getVal(CondoY))\n    print(\"Number of CondoZ: \", model.getVal(CondoZ))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily.\n// {\"production rate of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"operating hours of the production line\": \"Hours\", \"range\": \"Hours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily revenue. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n// Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n// Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n// Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production rate of all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe production line can operate for a maximum of 24 hours per day.\n// Hours <= 24\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\n// P1 * Hours >= 500\n// P2 * Hours >= 300\n// P3 * Hours >= 200",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\nThe company aims to maximize its daily revenue. The total production rate of all products cannot exceed 100 units per hour. The production line can operate for a maximum of 24 hours per day. The company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\nPlease help the company to maximize its daily revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of Product 3\nHours = model.addVar(vtype=\"CONTINUOUS\", name=\"Hours\", lb=0) # operating hours of the production line\n\n# Define objective function\n## Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n## Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n## Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n## So, the objective function is: Maximize (R1 + R2 + R3)\nR1 = 100 * P1 * Hours * (1 - 0.01 * P1)\nR2 = 150 * P2 * Hours * (1 - 0.01 * P2)\nR3 = 200 * P3 * Hours * (1 - 0.01 * P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## The total production rate of all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The production line can operate for a maximum of 24 hours per day.\nmodel.addCons(Hours <= 24)\n## The company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\nmodel.addCons(P1 * Hours >= 500)\nmodel.addCons(P2 * Hours >= 300)\nmodel.addCons(P3 * Hours >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Operating Hours of the Production Line: \", model.getVal(Hours))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 959,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\n// WheatAcres >= 30",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre and the environmental cost per acre for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Environmental Cost per Acre |\n|------------|-----------------|-----------------------------|\n| Wheat      | $200            | $50                         |\n| Corn       | $300            | $70                         |\n| Soybeans   | $250            | $60                         |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. The farmer also wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation. \n\nPlease help the farmer to maximize the net profit per acre, considering both financial profit and environmental cost, by determining the optimal allocation of acres for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to allocate to each crop.\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=30) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1071,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 500 kg, the selling price is $2 per kg, and the water usage is 1000 liters per acre. \nFor Crop B, the yield per acre is 600 kg, the selling price is $2.5 per kg, and the water usage is 1200 liters per acre. \nFor Crop C, the yield per acre is 700 kg, the selling price is $3 per kg, and the water usage is 1500 liters per acre.\nThe farmer aims to maximize the net income per unit of water used (which is defined as the total income from selling the crops divided by the total water used).\n// Income from Crop A: Income_A = 500 * 2 * A\n// Income from Crop B: Income_B = 600 * 2.5 * B\n// Income from Crop C: Income_C = 700 * 3 * C\n// Total water used: Water_Total = 1000 * A + 1200 * B + 1500 * C\n// So, the objective function is: Maximize (Income_A + Income_B + Income_C) / Water_Total\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\nFor Crop A, the yield per acre is 500 kg, the selling price is $2 per kg, and the water usage is 1000 liters per acre. \nFor Crop B, the yield per acre is 600 kg, the selling price is $2.5 per kg, and the water usage is 1200 liters per acre. \nFor Crop C, the yield per acre is 700 kg, the selling price is $3 per kg, and the water usage is 1500 liters per acre.\nThe farmer aims to maximize the net income per unit of water used (which is defined as the total income from selling the crops divided by the total water used).\nThe farm has a total of 100 acres available for cultivation.\nPlease help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nIncome_A = 500 * 2 * A\nIncome_B = 600 * 2.5 * B\nIncome_C = 700 * 3 * C\nWater_Total = 1000 * A + 1200 * B + 1500 * C\n## the objective function is: Maximize (Income_A + Income_B + Income_C) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Income_A + Income_B + Income_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Net Income per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit. However, due to the different growth rates and harvesting times, the efficiency of land use varies. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\n// Profit_W = 100 * W\n// Profit_C = 150 * C\n// Profit_B = 120 * B\n// Land_Efficiency_W = 0.9 * W\n// Land_Efficiency_C = 1.2 * C\n// Land_Efficiency_B = 1.1 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $60.\n// 50 * W + 70 * C + 60 * B <= 10000",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit, considering the different land efficiencies: 0.9 for wheat, 1.2 for corn, and 1.1 for barley. The farmer has a total of 100 acres of land available and a limited budget for seeds and fertilizer of $10,000, with costs per acre of $50 for wheat, $70 for corn, and $60 for barley. Please help the farmer maximize the profit per unit of land efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 100 * W\nProfit_C = 150 * C\nProfit_B = 120 * B\nLand_Efficiency_W = 0.9 * W\nLand_Efficiency_C = 1.2 * C\nLand_Efficiency_B = 1.1 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B) == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizer of $10,000.\nmodel.addCons(50 * W + 70 * C + 60 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Land Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 613,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"production rate of C1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of C2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of C3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\n// Profit_C1 = 10 * P1 * 0.8 * P1\n// Profit_C2 = 15 * P2 * 0.9 * P2\n// Profit_C3 = 20 * P3 * 1.1 * P3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\n// P1 <= 50; P2 <= 50; P3 <= 50",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical. Please help the plant to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of C1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of C2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3.\nProfit_C1 = 10 * P1 * 0.8 * P1\nProfit_C2 = 15 * P2 * 0.9 * P2\nProfit_C3 = 20 * P3 * 1.1 * P3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 50)\nmodel.addCons(P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of C1: \", model.getVal(P1))\n    print(\"Production Rate of C2: \", model.getVal(P2))\n    print(\"Production Rate of C3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 671,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours.\n// {\"number of wheat bread batches\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach batch of wheat bread yields a profit of $10, rye bread yields $15, and sourdough bread yields $20. The bakery aims to maximize the total daily profit from selling these bread types.\n// The objective function is: Maximize P = 10W + 15R + 20S\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available daily. Each batch of wheat bread requires 2 hours, rye bread requires 3 hours, and sourdough bread requires 4 hours of labor.\n// 2W + 3R + 4S <= 100\n\n## Generate Constraint-2:\nThe oven space is limited, allowing for a maximum of 30 batches to be baked daily.\n// W + R + S <= 30\n\n## Generate Constraint-3:\nThe bakery has a minimum daily demand for each type of bread. They must bake at least 5 batches of wheat bread, 3 batches of rye bread, and 4 batches of sourdough bread.\n// W >= 5; R >= 3; S >= 4",
        "question": "A small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours. Each batch of wheat bread yields a profit of $10, rye bread yields $15, and sourdough bread yields $20. The bakery has a total of 100 labor hours available daily, with each batch of wheat bread requiring 2 hours, rye bread requiring 3 hours, and sourdough bread requiring 4 hours of labor. The oven space is limited, allowing for a maximum of 30 batches to be baked daily. The bakery has a minimum daily demand for each type of bread, requiring at least 5 batches of wheat bread, 3 batches of rye bread, and 4 batches of sourdough bread. Please help the bakery to maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=5)  # number of wheat bread batches\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=3)  # number of rye bread batches\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=4)  # number of sourdough bread batches\n\n# Define objective function\nP = 10 * W + 15 * R + 20 * S\nmodel.setObjective(P, \"maximize\")\n\n# Add constraints\n# Constraint-1: Labor hours\nmodel.addCons(2 * W + 3 * R + 4 * S <= 100)\n# Constraint-2: Oven space\nmodel.addCons(W + R + S <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Batches: \", model.getVal(W))\n    print(\"Number of Rye Bread Batches: \", model.getVal(R))\n    print(\"Number of Sourdough Bread Batches: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 hours of labor and generates a profit of $10. \nEach unit of product B requires 3 hours of labor and generates a profit of $15. \nEach unit of product C requires 4 hours of labor and generates a profit of $20.\nThe plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor.\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Total labor hours: Labor_Hours = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n\n## Generate Constraint-1:\nThe plant has a total labor capacity of 1000 hours per week.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships.\n// B >= 30; C >= 40\n\n## Generate Constraint-4:\nThe total production of all products cannot exceed 200 units per week.\n// A + B + C <= 200",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. The labor requirements and profit per unit for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Profit per Unit |\n|---------|----------------------|-----------------|\n| A       | 2 hours              | $10             |\n| B       | 3 hours              | $15             |\n| C       | 4 hours              | $20             |\n\nThe plant has a total labor capacity of 1000 hours per week. The market demand for product A is at least 50 units per week. The plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships. The total production of all products cannot exceed 200 units per week. \n\nPlease help the plant to maximize the total profit while considering the efficiency of labor usage, specifically aiming to maximize the profit per hour of labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_Hours = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n## convert the division to multiplication\nmodel.addCons(obj * Labor_Hours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total labor capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships.\nmodel.addCons(B >= 30)\nmodel.addCons(C >= 40)\n## The total production of all products cannot exceed 200 units per week.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand.\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre. For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre. For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre. The farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting.\n// Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n// Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n// Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe total acreage available for planting is 100 acres.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe soil health index must remain above 50.\n// 50 <= 100 - (0.1 * Wheat * Wheat + 0.2 * Corn * Corn - 0.05 * Soybeans * Soybeans)\n\n## Generate Constraint-3:\nThe market demand for Wheat is 50 acres. So, the farm can only sell a maximum of 50 acres of Wheat.\n// Wheat <= 50\n\n## Generate Constraint-4:\nThe market demand for Corn is 60 acres. So, the farm can only sell a maximum of 60 acres of Corn.\n// Corn <= 60",
        "question": "A farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand. For Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre. For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre. For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre. The farm wants to maximize the total profit while maintaining a soil health index above 50. The total acreage available for planting is 100 acres. The soil health index must remain above 50. The market demand for Wheat is 50 acres. So, the farm can only sell a maximum of 50 acres of Wheat. The market demand for Corn is 60 acres. So, the farm can only sell a maximum of 60 acres of Corn. Please help the farm determine the optimal acreage for each crop to maximize their profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0, ub=50)  # acreage of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0, ub=60)  # acreage of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acreage of Soybeans\n\n# Define objective function\n# For non-linear terms, we need to linearize them using additional variables and constraints\n# Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n# Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n# Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n\n# Linearize quadratic terms\nWheat_squared = model.addVar(name=\"Wheat_squared\")\nCorn_squared = model.addVar(name=\"Corn_squared\")\nSoybeans_squared = model.addVar(name=\"Soybeans_squared\")\n\nmodel.addCons(Wheat_squared == Wheat * Wheat)\nmodel.addCons(Corn_squared == Corn * Corn)\nmodel.addCons(Soybeans_squared == Soybeans * Soybeans)\n\nProfit_Wheat = 300 * Wheat - 0.1 * Wheat_squared\nProfit_Corn = 400 * Corn - 0.2 * Corn_squared\nProfit_Soybeans = 250 * Soybeans + 0.05 * Soybeans_squared\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The total acreage available for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# The soil health index must remain above 50.\nmodel.addCons(50 <= 100 - (0.1 * Wheat_squared + 0.2 * Corn_squared - 0.05 * Soybeans_squared))\n\n# The market demand for Corn is 60 acres.\nmodel.addCons(Corn <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it incurs a storage cost of $5 per unit per month.\nThe profit per unit of product B is $70, but it incurs a storage cost of $7 per unit per month.\nThe profit per unit of product C is $90, but it incurs a storage cost of $9 per unit per month.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total storage cost: Storage = 5A + 7B + 9C\n// So, the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $10,000.\n// 50A + 70B + 90C <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe demand for product A must be met, which is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 30% of the total production is of product B.\n// B >= 0.3 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage. The profit per unit and the storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit |\n|---------|-----------------|-----------------------|\n| A       | $50             | $5                    |\n| B       | $70             | $7                    |\n| C       | $90             | $9                    |\n\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost. The total production cost for all products must not exceed $10,000. The company has a storage capacity limit of 200 units across all products. The demand for product A must be met, which is at least 100 units. The company wants to ensure that at least 30% of the total production is of product B.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total storage cost: Storage = 5A + 7B + 9C\n## So, the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\nmodel.addCons(obj == 45 * A + 63 * B + 81 * C)\n\n# Add constraints\n## The total production cost for all products must not exceed $10,000.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The company has a storage capacity limit of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The demand for product A must be met, which is at least 100 units.\nmodel.addCons(A >= 100)\n## The company wants to ensure that at least 30% of the total production is of product B.\nmodel.addCons(B >= 0.3 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit per acre of land used. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the cost of fertilizers, which is $50 per acre for wheat, $70 per acre for corn, and $60 per acre for soybeans. The objective is to maximize the net profit per acre, which is the profit minus the cost of fertilizers.\n// Net profit per acre of wheat: Profit_W = (200 - 50) * W\n// Net profit per acre of corn: Profit_C = (300 - 70) * C\n// Net profit per acre of soybeans: Profit_S = (250 - 60) * S\n// The objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (W + C + S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + S <= 100",
        "question": "A farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation. The profit per acre and the cost of fertilizers for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Cost of Fertilizers per Acre |\n|------------|-----------------|------------------------------|\n| Wheat      | $200            | $50                          |\n| Corn       | $300            | $70                          |\n| Soybeans   | $250            | $60                          |\n\nThe farmer aims to maximize his total net profit per acre of land used, which is the profit minus the cost of fertilizers. The farmer has a total of 100 acres of land available. Please help the farmer determine the optimal number of acres to dedicate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (250 - 60) * S\nTotalAcres = W + C + S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates and maintenance costs for each type of machine are given in the following Table.\n\n| Component | Production Rate per Machine | Maintenance Cost per Machine | Selling Price per Unit |\n|-----------|------------------------------|------------------------------|-------------------------|\n| Capacitors | 100 units/hour              | $5/hour                      | $0.1                    |\n| Resistors  | 150 units/hour              | $7/hour                      | $0.2                    |\n| Inductors  | 200 units/hour              | $9/hour                      | $0.3                    |\n\nThe manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. Please help the manufacturer determine the optimal number of machines for each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0) # number of machines for inductors\n\n# Define objective function\n## Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n## Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Capacitors: \", model.getVal(Cap))\n    print(\"Number of Machines for Resistors: \", model.getVal(Res))\n    print(\"Number of Machines for Inductors: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize the production of three types of pastries: Croissant, Danish, and Muffin. They need to determine the quantities of each pastry to produce daily.\n// {\"quantity of Croissant\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"quantity of Danish\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"quantity of Muffin\": \"Muffin\", \"range\": \"Muffin >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Croissant is $2, for Danish is $3, and for Muffin is $2.50. Due to economies of scale, the bakery experiences a 0.5% increase in profit per unit for each pastry type if production exceeds 100 units. The bakery aims to maximize its total daily profit from selling these pastries.\n// Profit_Croissant = max(2 + 0.005 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.005 * (Danish - 100), 3) * Danish\n// Profit_Muffin = max(2.5 + 0.005 * (Muffin - 100), 2.5) * Muffin\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_Muffin\n\n## Generate Constraint-1:\nThe bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms.\n// 50 * Croissant + 70 * Danish + 60 * Muffin <= 10000\n\n## Generate Constraint-2:\nThe bakery has a daily production capacity of 500 pastries in total.\n// Croissant + Danish + Muffin <= 500\n\n## Generate Constraint-3:\nThe market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units.\n// Croissant <= 250; Danish <= 300; Muffin <= 200",
        "question": "A bakery wants to optimize the production of three types of pastries: Croissant, Danish, and Muffin. They need to determine the quantities of each pastry to produce daily. The profit per unit of Croissant is $2, for Danish is $3, and for Muffin is $2.50. Due to economies of scale, the bakery experiences a 0.5% increase in profit per unit for each pastry type if production exceeds 100 units. The bakery aims to maximize its total daily profit from selling these pastries.\n\n| Pastry   | Profit per Unit | Flour Required (grams) |\n|----------|-----------------|------------------------|\n| Croissant| 2$              | 50                     |\n| Danish   | 3$              | 70                     |\n| Muffin   | 2.5$            | 60                     |\n\nThe bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms. The bakery has a daily production capacity of 500 pastries in total. The market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units.\n\nPlease help the bakery to maximize its total daily profit from selling these pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to produce at least 0 units of each pastry daily.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0) # quantity of Croissant\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=0) # quantity of Danish\nMuffin = model.addVar(vtype=\"INTEGER\", name=\"Muffin\", lb=0) # quantity of Muffin\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.005 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=250)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.005 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.005 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=0, ub=100)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=300)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.005 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_Muffin = max(2.5 + 0.005 * (Muffin - 100), 2.5) * Muffin\nMuffin1 = model.addVar(vtype=\"INTEGER\", name=\"Muffin1\", lb=0, ub=100)\nMuffin2 = model.addVar(vtype=\"INTEGER\", name=\"Muffin2\", lb=100, ub=200)\nMuffin_b1 = model.addVar(vtype=\"B\", name=\"Muffin_b1\")\nMuffin_b2 = model.addVar(vtype=\"B\", name=\"Muffin_b2\")\nmodel.addCons(Muffin_b1 + Muffin_b2 == 1)\nmodel.addCons(Muffin == Muffin1*Muffin_b1 + Muffin2*Muffin_b2)\nProfit_Muffin = 2.5 * Muffin1 * Muffin_b1 + (2.5 + 0.005 * (Muffin2 - 100)) * Muffin2 * Muffin_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_Muffin\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_Muffin)\n\n# Add constraints\n## The bakery has a limited supply of flour, which is a key ingredient. Each Croissant requires 50 grams of flour, each Danish requires 70 grams, and each Muffin requires 60 grams. The total available flour is 10 kilograms.\nmodel.addCons(50 * Croissant + 70 * Danish + 60 * Muffin <= 10000)\n## The bakery has a daily production capacity of 500 pastries in total.\nmodel.addCons(Croissant + Danish + Muffin <= 500)\n## The market demand for each type of pastry has a limit. The demand for Croissant is at most 250 units, for Danish is 300 units, and for Muffin is 200 units.\nmodel.addCons(Croissant <= 250)\nmodel.addCons(Danish <= 300)\nmodel.addCons(Muffin <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Croissant: \", model.getVal(Croissant))\n    print(\"Quantity of Danish: \", model.getVal(Danish))\n    print(\"Quantity of Muffin: \", model.getVal(Muffin))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. \nEach unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. \nEach unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit.\nThe company aims to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = 10 * A\n// Profit of B: Profit_B = 15 * B\n// Profit of C: Profit_C = 20 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 2 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a total of 200 kg of raw material available.\n// 2 * A + 4 * B + 3 * C <= 200\n\n## Generate Constraint-2:\nThe company has a total of 150 hours of labor available.\n// 3 * A + 2 * B + 5 * C <= 150\n\n## Generate Constraint-3:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its resource usage and profitability.\nEach unit of product A requires 2 kg of raw material and 3 hours of labor, with a profit of $10 per unit. \nEach unit of product B requires 4 kg of raw material and 2 hours of labor, with a profit of $15 per unit. \nEach unit of product C requires 3 kg of raw material and 5 hours of labor, with a profit of $20 per unit.\nThe company has a total of 200 kg of raw material available and a total of 150 hours of labor available. The company wants to produce at least 5 units of each product.\nPlease help the company to maximize the profit per unit of labor used, which is defined as the total profit divided by the total labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLaborHours = 3 * A + 2 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total of 200 kg of raw material available.\nmodel.addCons(2 * A + 4 * B + 3 * C <= 200)\n## The company has a total of 150 hours of labor available.\nmodel.addCons(3 * A + 2 * B + 5 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 units of raw material and 1 unit of labor.\nThe profit per unit of product B is $70, but it requires 3 units of raw material and 2 units of labor.\nThe profit per unit of product C is $100, but it requires 4 units of raw material and 3 units of labor.\nThe company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency.\n// Total profit: Profit = 50A + 70B + 100C\n// Resource usage: Raw material = 2A + 3B + 4C; Labor = A + 2B + 3C\n// The objective function is: Maximize Profit - k1 * (Raw material)^2 - k2 * (Labor)^2, where k1 and k2 are constants representing the cost of resource inefficiency.\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material available.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 500 units of labor available.\n// A + 2B + 3C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 10 units.\n// A >= 10\n\n## Generate Constraint-4:\nThe company aims to produce at least 5 units of product B and 5 units of product C to maintain market presence.\n// B >= 5; C >= 5\n\n## Generate Constraint-5:\nThe total production of all products should not exceed 200 units.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage. The profit per unit and the required resources for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Required | Labor Required |\n|---------|-----------------|-----------------------|----------------|\n| A       | $50             | 2 units               | 1 unit         |\n| B       | $70             | 3 units               | 2 units         |\n| C       | $100            | 4 units               | 3 units         |\n\nThe company has a total of 1000 units of raw material available and 500 units of labor available. The market demand for product A is at least 10 units. The company aims to produce at least 5 units of product B and 5 units of product C to maintain market presence. The total production of all products should not exceed 200 units. \n\nPlease help the company to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency, by determining the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 4 * C\nLabor = A + 2 * B + 3 * C\n## The objective function is: Maximize Profit - k1 * (RawMaterial)^2 - k2 * (Labor)^2\n## Convert the quadratic terms to linear by introducing new variables and constraints\nRawMaterial_sq = model.addVar(name=\"RawMaterial_sq\")\nLabor_sq = model.addVar(name=\"Labor_sq\")\nmodel.addCons(RawMaterial_sq == RawMaterial * RawMaterial)\nmodel.addCons(Labor_sq == Labor * Labor)\nk1 = 0.01  # Example constant for RawMaterial inefficiency cost\nk2 = 0.01  # Example constant for Labor inefficiency cost\nmodel.addCons(obj == Profit - k1 * RawMaterial_sq - k2 * Labor_sq)\n\n# Add constraints\n## The company has a total of 1000 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The company has a total of 500 units of labor available.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n## The market demand for product A is at least 10 units.\nmodel.addCons(A >= 10)\n## The company aims to produce at least 5 units of product B and 5 units of product C to maintain market presence.\nmodel.addCons(B >= 5)\nmodel.addCons(C >= 5)\n## The total production of all products should not exceed 200 units.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage. For C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. For C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. For C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points. The farm has a limited water supply of 300 units. The farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold. Please help the farm determine the optimal acreage for each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n// Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n// Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n// Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations. The profit per truck and the operational cost for each route are given in the following Table.\n\n| Route   | Profit per Truck | Operational Cost Formula                  |\n|---------|------------------|------------------------------------------|\n| RouteA  | $5000            | $2000 + 0.1 * (TrucksA^2)               |\n| RouteB  | $7000            | $3000 + 0.15 * (TrucksB^2)              |\n| RouteC  | $9000            | $4000 + 0.2 * (TrucksC^2)               |\n\nThe company aims to maximize its profit from transportation services. The company has a total of 50 trucks available for allocation. Please help the company to maximize the total profit from all routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks on RouteC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n## Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n## Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n## Convert the quadratic terms to linear terms by introducing new variables\nTrucksASquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksASquared\")\nTrucksBSquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksBSquared\")\nTrucksCSquared = model.addVar(vtype=\"INTEGER\", name=\"TrucksCSquared\")\nmodel.addCons(TrucksASquared == TrucksA * TrucksA)\nmodel.addCons(TrucksBSquared == TrucksB * TrucksB)\nmodel.addCons(TrucksCSquared == TrucksC * TrucksC)\n\nProfitA = (5000 - (2000 + 0.1 * TrucksASquared)) * TrucksA\nProfitB = (7000 - (3000 + 0.15 * TrucksBSquared)) * TrucksB\nProfitC = (9000 - (4000 + 0.2 * TrucksCSquared)) * TrucksC\n\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\n// Profit per acre of A: Profit_A = (100 - 20) * A\n// Profit per acre of B: Profit_B = (150 - 30) * B\n// Profit per acre of C: Profit_C = (200 - 40) * C\n// Total acres planted: Total_acres = A + B + C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for planting.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and the cost per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost per Acre |\n|------|-----------------|---------------|\n| A    | $100            | $20           |\n| B    | $150            | $30           |\n| C    | $200            | $40           |\n\nThe farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted). The farm has a total of 100 acres available for planting.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 20) * A\nProfit_B = (150 - 30) * B\nProfit_C = (200 - 40) * C\nTotal_acres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n## convert the division to multiplication\nmodel.addCons(obj * Total_acres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 750,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per week.\n// Qa >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// Qb >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\nThe total production capacity of the company is limited to 1000 units per week. The market demand for product A is at least 200 units per week. The market demand for product B is at least 150 units per week.\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=200) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=150) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\nmodel.addCons(obj == 50 * Qa - 0.01 * Qa**2 + 70 * Qb - 0.02 * Qb**2 + 60 * Qc - 0.015 * Qc**2)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units.\n// Total profit: Profit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for automation and marketing combined.\n// Automation + MarketingBudget <= 200000\n\n## Generate Constraint-2:\nThe company must produce at least 1000 units to meet the minimum order requirements from key clients.\n// Units >= 1000\n\n## Generate Constraint-3:\nThe marketing budget cannot exceed 50% of the total budget allocated for automation and marketing.\n// MarketingBudget <= 0.5 * (Automation + MarketingBudget)",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product. The cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units. The company has a total budget of $200,000 for automation and marketing combined. The company must produce at least 1000 units to meet the minimum order requirements from key clients. The marketing budget cannot exceed 50% of the total budget allocated for automation and marketing. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=1000)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation + MarketingBudget <= 200000)  # total budget for automation and marketing\nmodel.addCons(MarketingBudget <= 0.5 * (Automation + MarketingBudget))  # marketing budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements.\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases. The decrease in productivity is modeled as a square root function of the acreage. The farm wants to maximize the total profit from all crops.\n// Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n// Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n// Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n// So, the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// Corn + Wheat + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\n// Corn <= 80; Wheat <= 90; Soybeans <= 70\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10",
        "question": "A farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements. The profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases, modeled as a square root function of the acreage. The farm has a total of 100 acres available for cultivation. The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans. The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health. Please help the farm to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10) # acreage of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acreage of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10) # acreage of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n## Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n## Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n## convert the division to multiplication\nsqrt_Corn = model.addVar(name=\"sqrt_Corn\")\nsqrt_Wheat = model.addVar(name=\"sqrt_Wheat\")\nsqrt_Soybeans = model.addVar(name=\"sqrt_Soybeans\")\nmodel.addCons(sqrt_Corn * sqrt_Corn == Corn + 1)\nmodel.addCons(sqrt_Wheat * sqrt_Wheat == Wheat + 1)\nmodel.addCons(sqrt_Soybeans * sqrt_Soybeans == Soybeans + 1)\nProfit_Corn = 300 * Corn / sqrt_Corn\nProfit_Wheat = 250 * Wheat / sqrt_Wheat\nProfit_Soybeans = 200 * Soybeans / sqrt_Soybeans\n## the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\nmodel.addCons(obj == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(Corn + Wheat + Soybeans <= 100)\n## The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\nmodel.addCons(Corn <= 80)\nmodel.addCons(Wheat <= 90)\nmodel.addCons(Soybeans <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand.\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\nThe total production capacity of the factory is limited to 1000 units per week.\nPlease help the company to maximize the total profit, which is the difference between the revenue and the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop.\n// {\"area of land for Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of land for Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of land for Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for Wheat is 5 tons, for Corn is 6 tons, and for Soybeans is 4 tons. The price per ton of Wheat is $200, of Corn is $250, and of Soybeans is $300. The farmer wants to maximize the total revenue from the crops.\n// Revenue_Wheat = 5 * $200 * Wheat\n// Revenue_Corn = 6 * $250 * Corn\n// Revenue_Soybeans = 4 * $300 * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total available land for planting is 100 hectares.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80.\n// $100 * Wheat + $120 * Corn + $80 * Soybeans <= 15000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\n// Soybeans >= 0.3 * (Wheat + Corn + Soybeans)",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide the area of land to allocate to each crop. The yield per hectare and the price per ton for each crop are given in the following Table.\n\n| Crop       | Yield per Hectare | Price per Ton |\n|------------|-------------------|---------------|\n| Wheat      | 5 tons            | $200          |\n| Corn       | 6 tons            | $250          |\n| Soybeans   | 4 tons            | $300          |\n\nThe total available land for planting is 100 hectares. The farmer has a budget constraint for fertilizers and pesticides, which is $15,000. The cost per hectare for Wheat is $100, for Corn is $120, and for Soybeans is $80. The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health. \nPlease help the farmer to maximize the total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide the area of land to allocate to each crop.\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of land for Wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of land for Corn\nSoybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Soybeans\", lb=0) # area of land for Soybeans\n\n# Define objective function\n## The farmer wants to maximize the total revenue from the crops.\nRevenue_Wheat = 5 * 200 * Wheat\nRevenue_Corn = 6 * 250 * Corn\nRevenue_Soybeans = 4 * 300 * Soybeans\n## So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n## The total available land for planting is 100 hectares.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget constraint for fertilizers and pesticides, which is $15,000.\nmodel.addCons(100 * Wheat + 120 * Corn + 80 * Soybeans <= 15000)\n## The farmer wants to ensure that at least 30% of the land is dedicated to Soybeans to maintain soil health.\nmodel.addCons(Soybeans >= 0.3 * (Wheat + Corn + Soybeans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(Wheat))\n    print(\"Area of land for Corn: \", model.getVal(Corn))\n    print(\"Area of land for Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C). The profit per unit and the required units of raw material for each product are given in the following Table.\n\n| Product | Profit per Unit | Units of Raw Material Required |\n|---------|-----------------|--------------------------------|\n| A       | $50             | 2                              |\n| B       | $70             | 3                              |\n| C       | $100            | 5                              |\n\nThe company has a budget of $5000 for raw materials. The company wants to maximize the total profit while considering the cost of raw materials. Please help the company determine the optimal amount of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n## Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency.\n// {\"production quantity of the product\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe total investment in production efficiency cannot exceed $30,000.\n// Efficiency <= 30000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency. The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10, and the selling price per unit is $15. The company aims to maximize the total profit from the product. The company has a budget of $50,000 for advertising, and the total investment in production efficiency cannot exceed $30,000. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=0)  # production quantity of the product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # investment in production efficiency\n\n# Define objective function\n## Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\nProfit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n## The total investment in production efficiency cannot exceed $30,000.\nmodel.addCons(Efficiency <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Investment in Efficiency: \", model.getVal(Efficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type.\n// {\"number of PanelA\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of PanelB\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of PanelC\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nPanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. \nPanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. \nPanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. \nThe company wants to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.\n// Daily energy output for PanelA: Energy_PanelA = 100 * PanelA - 10 * PanelA\n// Daily energy output for PanelB: Energy_PanelB = 150 * PanelB - 15 * PanelB\n// Daily energy output for PanelC: Energy_PanelC = 200 * PanelC - 20 * PanelC\n// Total initial investment cost: Cost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n// So, the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 500 * PanelA + 700 * PanelB + 900 * PanelC <= 100,000\n\n## Generate Constraint-2:\nThe facility has space for a maximum of 150 solar panels.\n// PanelA + PanelB + PanelC <= 150\n\n## Generate Constraint-3:\nDue to local regulations, at least 30% of the panels must be of type PanelA.\n// PanelA >= 0.3 * (PanelA + PanelB + PanelC)\n\n## Generate Constraint-4:\nThe company aims to have at least 50% more energy output from PanelB compared to PanelA.\n// 150 * PanelB >= 1.5 * (100 * PanelA)",
        "question": "A renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type.\nPanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. \nPanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. \nPanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. \nThe company has a budget of $100,000 for the initial investment. The facility has space for a maximum of 150 solar panels. Due to local regulations, at least 30% of the panels must be of type PanelA. The company aims to have at least 50% more energy output from PanelB compared to PanelA.\nPlease help the company to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of PanelA\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of PanelB\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of PanelC\n\n# Define objective function\nEnergy_PanelA = 100 * PanelA - 10 * PanelA\nEnergy_PanelB = 150 * PanelB - 15 * PanelB\nEnergy_PanelC = 200 * PanelC - 20 * PanelC\nCost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n# So, the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy_PanelA + Energy_PanelB + Energy_PanelC - Cost)\n\n# Add constraints\n# The company has a budget of $100,000 for the initial investment.\nmodel.addCons(500 * PanelA + 700 * PanelB + 900 * PanelC <= 100000)\n# The facility has space for a maximum of 150 solar panels.\nmodel.addCons(PanelA + PanelB + PanelC <= 150)\n# Due to local regulations, at least 30% of the panels must be of type PanelA.\nmodel.addCons(PanelA >= 0.3 * (PanelA + PanelB + PanelC))\n# The company aims to have at least 50% more energy output from PanelB compared to PanelA.\nmodel.addCons(150 * PanelB >= 1.5 * (100 * PanelA))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of PanelA: \", model.getVal(PanelA))\n    print(\"Number of PanelB: \", model.getVal(PanelB))\n    print(\"Number of PanelC: \", model.getVal(PanelC))\n    print(\"Maximized Net Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of two different products, Product A and Product B, and the amount of money to be invested in a new technology that reduces production costs.\n// {\"production level of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost of each unit by $2 for every $10,000 invested. The initial production cost for Product A is $50 per unit and for Product B is $70 per unit. The selling price for Product A is $100 per unit and for Product B is $120 per unit. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\n// Total profit for Product B: ProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\n// So, the objective function is: Maximize TotalProfit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of two different products, Product A and Product B, and the amount of money to be invested in a new technology that reduces production costs. The new technology reduces the production cost of each unit by $2 for every $10,000 invested. The initial production cost for Product A is $50 per unit and for Product B is $70 per unit. The selling price for Product A is $100 per unit and for Product B is $120 per unit. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. The company must produce at least 200 units of Product A. Please help the company determine the optimal production levels for Product A and Product B, and the amount to invest in the new technology to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200)  # production level of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production level of Product B\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\n## Total profit for Product A: ProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\n## Total profit for Product B: ProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\n## So, the objective function is: Maximize TotalProfit = ProfitA + ProfitB\nProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\nProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(ProductA + ProductB <= 1000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProductA))\n    print(\"Production Level of Product B: \", model.getVal(ProductB))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\n// Cost_A = 10 - 0.5 * Automation\n// Cost_B = 15 - 0.5 * Automation\n// Revenue_A = 20 * QA\n// Revenue_B = 25 * QB\n// Total_Cost = Cost_A * QA + Cost_B * QB\n// Total_Revenue = Revenue_A + Revenue_B\n// Profit = Total_Revenue - Total_Cost\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// QA + QB <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for implementing automation.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\n// QA <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 200 units of Product B to meet contractual obligations.\n// QB >= 200",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The cost and revenue per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| A       | 10$ - 0.5$ * Automation | 20$ |\n| B       | 15$ - 0.5$ * Automation | 25$ |\n\nThe company has a total production capacity of 1000 units for both products combined. The company has a budget of $5000 for implementing automation. The market demand for Product A is 500 units. The company must produce at least 200 units of Product B to meet contractual obligations.\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=200, ub=1000) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=5000) # level of automation\n\n# Define objective function\nCost_A = 10 - 0.5 * Automation\nCost_B = 15 - 0.5 * Automation\nRevenue_A = 20 * QA\nRevenue_B = 25 * QB\nTotal_Cost = Cost_A * QA + Cost_B * QB\nTotal_Revenue = Revenue_A + Revenue_B\nProfit = Total_Revenue - Total_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QA + QB <= 1000)\nmodel.addCons(Automation <= 5000)\nmodel.addCons(QA <= 500)\nmodel.addCons(QB >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 836,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage per unit of product A is 2 units, product B is 3 units, and product C is 4 units. The company wants to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total resource usage: Resource = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize Profit / Resource\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of resources available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage. The profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage per unit of product A is 2 units, product B is 3 units, and product C is 4 units. The company wants to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage. The company has a total of 1000 units of resources available. The company must produce at least 10 units of each product to meet contractual obligations. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 10 units of each product to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C\nResource = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize Profit / Resource\n## convert the division to multiplication\nmodel.addCons(obj * Resource == Profit)\n\n# Add constraints\n## The company has a total of 1000 units of resources available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize profit.\n// {\"hours of operation for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different mix of components. Machine 1 produces resistors at a rate of 100 units per hour, capacitors at 50 units per hour, and inductors at 25 units per hour. Machine 2 produces resistors at 75 units per hour, capacitors at 100 units per hour, and inductors at 50 units per hour. Machine 3 produces resistors at 50 units per hour, capacitors at 75 units per hour, and inductors at 100 units per hour. The profit from resistors is $0.01 per unit, from capacitors is $0.02 per unit, and from inductors is $0.03 per unit. The objective is to maximize the total profit from all components.\n// Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n// Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n// Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n// Total profit: P = P1 + P2 + P3\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThe total available hours for all machines cannot exceed 100 hours.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nThe production of inductors must be at least 500 units.\n// 25 * M1 + 50 * M2 + 100 * M3 >= 500\n\n## Generate Constraint-3:\nThe production of capacitors must be at least 750 units.\n// 50 * M1 + 100 * M2 + 75 * M3 >= 750\n\n## Generate Constraint-4:\nThe production of resistors must be at least 1000 units.\n// 100 * M1 + 75 * M2 + 50 * M3 >= 1000",
        "question": "A manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize profit. The production rates and profit per unit for each component are given in the following Table.\n\n| Machine | Resistors (units/hour) | Capacitors (units/hour) | Inductors (units/hour) | Profit per Unit |\n|---------|------------------------|-------------------------|-------------------------|-----------------|\n| 1       | 100                    | 50                      | 25                     | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n| 2       | 75                     | 100                     | 50                     | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n| 3       | 50                     | 75                      | 100                    | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n\nThe total available hours for all machines cannot exceed 100 hours. The production of inductors must be at least 500 units. The production of capacitors must be at least 750 units. The production of resistors must be at least 1000 units.\n\nPlease help the manufacturer to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours of operation for machine 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours of operation for machine 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours of operation for machine 3\n\n# Define objective function\n## Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n## Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n## Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n## Total profit: P = P1 + P2 + P3\nP1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\nP2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\nP3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\nP = P1 + P2 + P3\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total available hours for all machines cannot exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 <= 100)\n## The production of inductors must be at least 500 units.\nmodel.addCons(25 * M1 + 50 * M2 + 100 * M3 >= 500)\n## The production of capacitors must be at least 750 units.\nmodel.addCons(50 * M1 + 100 * M2 + 75 * M3 >= 750)\n## The production of resistors must be at least 1000 units.\nmodel.addCons(100 * M1 + 75 * M2 + 50 * M3 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Machine 1: \", model.getVal(M1))\n    print(\"Hours of operation for Machine 2: \", model.getVal(M2))\n    print(\"Hours of operation for Machine 3: \", model.getVal(M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various constraints.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company wants to maximize the total profit from all products.\n// Total profit for ProductA: Profit_ProductA = 50 * ProductA\n// Total profit for ProductB: Profit_ProductB = 70 * ProductB\n// Total profit for ProductC: Profit_ProductC = 90 * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA + ProductB + ProductC <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductB <= 2 * ProductA\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000. The cost per unit of raw material for ProductA is $10, for ProductB is $20, and for ProductC is $30.\n// 10 * ProductA + 20 * ProductB + 30 * ProductC <= 50,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of each product.\n// ProductA >= 50; ProductB >= 50; ProductC >= 50",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various constraints. The profit per unit and the cost per unit of raw material for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit of Raw Material |\n|---------|-----------------|-------------------------------|\n| ProductA | $50             | $10                           |\n| ProductB | $70             | $20                           |\n| ProductC | $90             | $30                           |\n\nThe company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000. To ensure market presence, the company must produce at least 50 units of each product.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50) # quantity of ProductC\n\n# Define objective function\nProfit_ProductA = 50 * ProductA\nProfit_ProductB = 70 * ProductB\nProfit_ProductC = 90 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 1000) # Total production capacity constraint\nmodel.addCons(ProductB <= 2 * ProductA) # Resource limitation constraint\nmodel.addCons(10 * ProductA + 20 * ProductB + 30 * ProductC <= 50000) # Budget constraint for raw materials\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C.\n// A >= 50; B >= 75",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit and cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $10, decreasing by $0.02 for each unit beyond 100 | $3 |\n| B       | $15, decreasing by $0.015 for each unit beyond 150 | $5 |\n| C       | $20, decreasing by $0.01 for each unit beyond 200 | $7 |\n\nThe total production cost for all products must not exceed $1000. The company has a storage capacity limit of 500 units for all products combined. The market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C.\n\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit.\n// {\"hours of operation for production line A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The goal is to maximize the total profit from all three lines.\n// The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\n\n## Generate Constraint-1:\nThe total hours of operation for all three lines cannot exceed 100 hours per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A.\n// A >= 5\n\n## Generate Constraint-3:\nThe minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B.\n// B >= 5\n\n## Generate Constraint-4:\nThe minimum daily production requirement for component C is 1000 units, which can be produced in 5 hours on line C.\n// C >= 5",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit. The profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function for each line is given in the following Table.\n\n| Production Line | Profit Function |\n|-----------------|-----------------|\n| A               | P(x) = 100x - 0.1x^2 |\n| B               | P(y) = 150y - 0.2y^2 |\n| C               | P(z) = 200z - 0.3z^2 |\n\nThe total hours of operation for all three lines cannot exceed 100 hours per day. The minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A. The minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B. The minimum daily production requirement for component C is 1000 units, which can be produced in 5 hours on line C.\n\nPlease help the plant manager to maximize the total profit from all three lines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=5)  # hours of operation for production line A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=5)  # hours of operation for production line B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=5)  # hours of operation for production line C\n\n# Define objective function\n# The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\nProfit_A = 100 * A - 0.1 * A**2\nProfit_B = 150 * B - 0.2 * B**2\nProfit_C = 200 * C - 0.3 * C**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total hours of operation for all three lines cannot exceed 100 hours per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line A: \", model.getVal(A))\n    print(\"Hours of operation for production line B: \", model.getVal(B))\n    print(\"Hours of operation for production line C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment.\n// {\"production quantity of DeviceA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total cost for DeviceA: CostA = (100 - 0.0001 * Automation) * QuantityA\n// Total cost for DeviceB: CostB = (150 - 0.0001 * Automation) * QuantityB\n// Total cost for DeviceC: CostC = (200 - 0.0001 * Automation) * QuantityC\n// Total revenue for DeviceA: RevenueA = 150 * QuantityA\n// Total revenue for DeviceB: RevenueB = 200 * QuantityB\n// Total revenue for DeviceC: RevenueC = 250 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investment.\n// Automation <= 100000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment. The production cost per unit, selling price per unit, and the effect of automation on production costs are given in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Effect of Automation on Production Cost |\n|--------|--------------------------|------------------------|----------------------------------------|\n| DeviceA | $100                     | $150                   | $1 reduction for every $10,000 in automation |\n| DeviceB | $150                     | $200                   | $1 reduction for every $10,000 in automation |\n| DeviceC | $200                     | $250                   | $1 reduction for every $10,000 in automation |\n\nThe company has a budget of $100,000 for automation investment. The company aims to maximize the total profit from all devices. Please help the company determine the optimal production quantity for each device and the level of automation to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of DeviceA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of DeviceB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nCostA = (100 - 0.0001 * Automation) * QuantityA\nCostB = (150 - 0.0001 * Automation) * QuantityB\nCostC = (200 - 0.0001 * Automation) * QuantityC\nRevenueA = 150 * QuantityA\nRevenueB = 200 * QuantityB\nRevenueC = 250 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of DeviceB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of DeviceC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1257,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// Qa + Qb + Qc <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost. The total production capacity of the company is limited to 1000 units per week. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\nmodel.addCons(obj == 50 * Qa - 0.01 * Qa**2 + 70 * Qb - 0.02 * Qb**2 + 60 * Qc - 0.015 * Qc**2)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 810,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available. The company also has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units. Please help the company to maximize the total profit from the production of these chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # quantity of chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"fertilizer per acre for wheat\": \"Fertilizer_Wheat\", \"range\": \"Fertilizer_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for corn\": \"Fertilizer_Corn\", \"range\": \"Fertilizer_Corn >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for soybeans\": \"Fertilizer_Soybeans\", \"range\": \"Fertilizer_Soybeans >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of wheat per acre increases by 100 kg for every kg of fertilizer used, up to a maximum of 5000 kg per acre. The yield of corn per acre increases by 150 kg for every kg of fertilizer used, up to a maximum of 6000 kg per acre. The yield of soybeans per acre increases by 80 kg for every kg of fertilizer used, up to a maximum of 4000 kg per acre. The farm aims to maximize the total yield of all crops.\n// Total yield of wheat: Yield_Wheat = (100 * Fertilizer_Wheat) * Wheat\n// Total yield of corn: Yield_Corn = (150 * Fertilizer_Corn) * Corn\n// Total yield of soybeans: Yield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n// So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n## Generate Constraint-1:\nThe total amount of fertilizer available for the season is 10,000 kg.\n// Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000\n\n## Generate Constraint-2:\nThe farm has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100",
        "question": "A farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield. The yield of wheat per acre increases by 100 kg for every kg of fertilizer used, up to a maximum of 5000 kg per acre. The yield of corn per acre increases by 150 kg for every kg of fertilizer used, up to a maximum of 6000 kg per acre. The yield of soybeans per acre increases by 80 kg for every kg of fertilizer used, up to a maximum of 4000 kg per acre. The farm aims to maximize the total yield of all crops. The total amount of fertilizer available for the season is 10,000 kg. The farm has a total of 100 acres available for planting. Please help the farm to maximize the total yield of all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of soybeans\nFertilizer_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Wheat\", lb=0)  # fertilizer per acre for wheat\nFertilizer_Corn = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Corn\", lb=0)  # fertilizer per acre for corn\nFertilizer_Soybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Soybeans\", lb=0)  # fertilizer per acre for soybeans\n\n# Define objective function\nYield_Wheat = (100 * Fertilizer_Wheat) * Wheat\nYield_Corn = (150 * Fertilizer_Corn) * Corn\nYield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n# So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n# Add constraints\n# The total amount of fertilizer available for the season is 10,000 kg.\nmodel.addCons(Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000)\n# The farm has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Fertilizer per acre for Wheat: \", model.getVal(Fertilizer_Wheat))\n    print(\"Fertilizer per acre for Corn: \", model.getVal(Fertilizer_Corn))\n    print(\"Fertilizer per acre for Soybeans: \", model.getVal(Fertilizer_Soybeans))\n    print(\"Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. Additionally, the bakery is considering investing in a new oven that can reduce baking time per cake.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"investment in new oven\": \"OvenInvestment\", \"range\": \"OvenInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe baking time per cake decreases by 5 minutes for every $1000 invested in the new oven. The initial baking time per cake is 60 minutes. The selling price per cake is $30. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking.\n// Revenue per Chocolate cake: Revenue_Chocolate = 30 * Chocolate\n// Revenue per Vanilla cake: Revenue_Vanilla = 30 * Vanilla\n// Revenue per Strawberry cake: Revenue_Strawberry = 30 * Strawberry\n// Total revenue considering baking time: TotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / (60 - 0.005 * OvenInvestment) * (Chocolate + Vanilla + Strawberry)\n// So, the objective function is: Maximize TotalRevenue\n\n## Generate Constraint-1:\nThe bakery has a budget of $10,000 for the new oven.\n// OvenInvestment <= 10000\n\n## Generate Constraint-2:\nThe bakery can bake a maximum of 1000 cakes in total.\n// Chocolate + Vanilla + Strawberry <= 1000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season and is considering investing in a new oven that can reduce baking time per cake. The selling price per cake is $30. The baking time per cake decreases by 5 minutes for every $1000 invested in the new oven, with an initial baking time per cake of 60 minutes. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking.\n\n| Cake Type       | Selling Price | Initial Baking Time |\n|-----------------|---------------|---------------------|\n| Chocolate       | $30           | 60 minutes          |\n| Vanilla         | $30           | 60 minutes          |\n| Strawberry      | $30           | 60 minutes          |\n\nThe bakery has a budget of $10,000 for the new oven. The bakery can bake a maximum of 1000 cakes in total.\n\nPlease help the bakery to maximize the total revenue considering the baking time and the investment in the new oven.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nOvenInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenInvestment\", lb=0) # investment in new oven\n\n# Define objective function\nRevenue_Chocolate = 30 * Chocolate\nRevenue_Vanilla = 30 * Vanilla\nRevenue_Strawberry = 30 * Strawberry\nBakingTimeReduction = 60 - 0.005 * OvenInvestment\nTotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / BakingTimeReduction * (Chocolate + Vanilla + Strawberry)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * BakingTimeReduction * (Chocolate + Vanilla + Strawberry) == Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry)\n\n# Add constraints\nmodel.addCons(OvenInvestment <= 10000)\nmodel.addCons(Chocolate + Vanilla + Strawberry <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry cakes: \", model.getVal(Strawberry))\n    print(\"Investment in new oven: \", model.getVal(OvenInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300\n\n## Generate Constraint-2:\nThe soil fertility must remain above 50 points after planting all crops.\n// 2 * A1 + 3 * A2 + 5 * A3 <= 100 (assuming the initial soil fertility is 100 points)\n\n## Generate Constraint-3:\nThe total acreage available for planting is 50 acres.\n// A1 + A2 + A3 <= 50\n\n## Generate Constraint-4:\nThe market demand for C1 is 10 acres. So, the farm can only plant a maximum of 10 acres of C1.\n// A1 <= 10",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage. For C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. For C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. For C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points. The farm has a limited water supply of 300 units and wants to maintain soil fertility above 50 points after planting all crops. The total acreage available for planting is 50 acres, and the market demand for C1 is 10 acres. The farm wants to maximize the profit per unit of water used. Please help the farm determine the optimal acreage for each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n## The soil fertility must remain above 50 points after planting all crops.\nmodel.addCons(2 * A1 + 3 * A2 + 5 * A3 <= 100)\n## The total acreage available for planting is 50 acres.\nmodel.addCons(A1 + A2 + A3 <= 50)\n## The market demand for C1 is 10 acres. So, the farm can only plant a maximum of 10 acres of C1.\nmodel.addCons(A1 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of his land with soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for fertilization.\n// 30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000\n\n## Generate Constraint-4:\nThe farmer wants to ensure that each crop has at least 5 acres dedicated to it.\n// WheatAcres >= 5; CornAcres >= 5; SoybeansAcres >= 5",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization. The profit per acre and the costs for irrigation and fertilization for each crop are given in the following Table.\n\n| Crop         | Profit per Acre | Irrigation Cost per Acre | Fertilization Cost per Acre |\n|--------------|-----------------|--------------------------|----------------------------|\n| Wheat        | $200            | $50                      | $30                        |\n| Corn         | $300            | $70                      | $40                        |\n| Soybeans     | $150            | $30                      | $20                        |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of his land with soybeans. The farmer has a budget of $5000 for fertilization. The farmer wants to ensure that each crop has at least 5 acres dedicated to it. \nPlease help the farmer to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=5)  # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=5)  # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=5)  # acres of soybeans\n\n# Define objective function\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n# So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans))\n\n# Add constraints\n# The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n# Due to soil conditions, the farmer must plant at least 20% of his land with soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n# The farmer has a budget of $5000 for fertilization.\nmodel.addCons(30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1205,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hydrogen\", \"range\": \"Hydrogen >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000. For Hybrid vehicles, it is $8,000. For Hydrogen vehicles, it is $12,000. Due to economies of scale, the profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The manufacturer wants to maximize the total profit from selling these vehicles.\n// Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\n// Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\n// Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\n// So, the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\n\n## Generate Constraint-1:\nThe production of each vehicle type requires a specific amount of a rare metal. Electric vehicles require 5 kg, Hybrid vehicles require 8 kg, and Hydrogen vehicles require 10 kg. The total supply of this rare metal is limited to 1000 kg.\n// 5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000\n\n## Generate Constraint-2:\nThere is a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\n// Electric <= 300; Hybrid <= 250; Hydrogen <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 700 units across all vehicle types.\n// Electric + Hybrid + Hydrogen <= 700\n\n## Generate Constraint-4:\nTo encourage diversity in eco-friendly vehicles, the manufacturer must produce at least 50 units of each type.\n// Electric >= 50; Hybrid >= 50; Hydrogen >= 50",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints. The profit per Electric vehicle is $10,000. For Hybrid vehicles, it is $8,000. For Hydrogen vehicles, it is $12,000. Due to economies of scale, the profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The production of each vehicle type requires a specific amount of a rare metal. Electric vehicles require 5 kg, Hybrid vehicles require 8 kg, and Hydrogen vehicles require 10 kg. The total supply of this rare metal is limited to 1000 kg. There is a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units. The manufacturer has a total production capacity of 700 units across all vehicle types. To encourage diversity in eco-friendly vehicles, the manufacturer must produce at least 50 units of each type. Please help the manufacturer to maximize the total profit from selling these vehicles.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## There is a market demand constraint for each vehicle type. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=50, ub=300) # quantity of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=50, ub=250) # quantity of Hybrid vehicles\nHydrogen = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen\", lb=50, ub=200) # quantity of Hydrogen vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\nElectric1 = model.addVar(vtype=\"INTEGER\", name=\"Electric1\", lb=0, ub=100)\nElectric2 = model.addVar(vtype=\"INTEGER\", name=\"Electric2\", lb=100, ub=300)\nElectric_b1 = model.addVar(vtype=\"B\", name=\"Electric_b1\")\nElectric_b2 = model.addVar(vtype=\"B\", name=\"Electric_b2\")\nmodel.addCons(Electric_b1 + Electric_b2 == 1)\nmodel.addCons(Electric == Electric1*Electric_b1 + Electric2*Electric_b2)\nProfit_Electric = 10000 * Electric1 * Electric_b1 + (10000 + 10 * (Electric2 - 100)) * Electric2 * Electric_b2\n## create piecewise variables for piecewise function: Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\nHybrid1 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid1\", lb=0, ub=100)\nHybrid2 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid2\", lb=100, ub=250)\nHybrid_b1 = model.addVar(vtype=\"B\", name=\"Hybrid_b1\")\nHybrid_b2 = model.addVar(vtype=\"B\", name=\"Hybrid_b2\")\nmodel.addCons(Hybrid_b1 + Hybrid_b2 == 1)\nmodel.addCons(Hybrid == Hybrid1*Hybrid_b1 + Hybrid2*Hybrid_b2)\nProfit_Hybrid = 8000 * Hybrid1 * Hybrid_b1 + (8000 + 10 * (Hybrid2 - 100)) * Hybrid2 * Hybrid_b2\n## create piecewise variables for piecewise function: Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\nHydrogen1 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen1\", lb=0, ub=100)\nHydrogen2 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen2\", lb=100, ub=200)\nHydrogen_b1 = model.addVar(vtype=\"B\", name=\"Hydrogen_b1\")\nHydrogen_b2 = model.addVar(vtype=\"B\", name=\"Hydrogen_b2\")\nmodel.addCons(Hydrogen_b1 + Hydrogen_b2 == 1)\nmodel.addCons(Hydrogen == Hydrogen1*Hydrogen_b1 + Hydrogen2*Hydrogen_b2)\nProfit_Hydrogen = 12000 * Hydrogen1 * Hydrogen_b1 + (12000 + 10 * (Hydrogen2 - 100)) * Hydrogen2 * Hydrogen_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\nmodel.addCons(obj == Profit_Electric + Profit_Hybrid + Profit_Hydrogen)\n\n# Add constraints\nmodel.addCons(5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000)\nmodel.addCons(Electric + Hybrid + Hydrogen <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Quantity of Hybrid Vehicles: \", model.getVal(Hybrid))\n    print(\"Quantity of Hydrogen Vehicles: \", model.getVal(Hydrogen))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. However, the production cost per unit for each product varies with the number of units produced due to economies of scale. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n// Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n// Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// UnitsB <= 2 * UnitsA",
        "question": "A manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints. The profit per unit and the production cost per unit for each product, which varies with the number of units produced due to economies of scale, are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|---------------------------|\n| ProductA | $50             | 40 - 0.1*UnitsA          |\n| ProductB | $70             | 50 - 0.1*UnitsB          |\n| ProductC | $90             | 60 - 0.1*UnitsC          |\n\nThe company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. \n\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\n\n# Define objective function\n## Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n## Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n## Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\nProfit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\nProfit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\nProfit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is limited to 200 units.\n// A <= 200\n\n## Generate Constraint-3:\nThe production capacity for product B is limited to 150 units.\n// B <= 150\n\n## Generate Constraint-4:\nThe production capacity for product C is limited to 100 units.\n// C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company has a budget of $10,000 for raw materials and labor. The production capacity for product A is limited to 200 units. The production capacity for product B is limited to 150 units. The production capacity for product C is limited to 100 units.\nPlease help the company to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons(15 * A + 22 * B + 30 * C <= 10000)\n## The production capacity for product A is limited to 200 units.\nmodel.addCons(A <= 200)\n## The production capacity for product B is limited to 150 units.\nmodel.addCons(B <= 150)\n## The production capacity for product C is limited to 100 units.\nmodel.addCons(C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-4:\nThe farmer has a budget of $5000 for water costs.\n// (100 - 0.1 * Irrigation) * (A + B + C) <= 5000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop and whether to invest in a new irrigation system that will affect the water usage and yield of each crop. The yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer has a total of 100 acres available for planting and a budget of $5000 for water costs. The total investment in the irrigation system cannot exceed $10,000. The farmer wants to ensure that at least 20 acres are dedicated to each crop. Please help the farmer to maximize the net profit from the crops, considering both the revenue and the water cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100) # The farmer has a total of 100 acres available for planting.\nmodel.addCons(Irrigation <= 10000) # The total investment in the irrigation system cannot exceed $10,000.\nmodel.addCons((100 - 0.1 * Irrigation) * (A + B + C) <= 5000) # The farmer has a budget of $5000 for water costs.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand.\n// {\"quantity of E1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time.\n// Profit_E1 = 30 * E1 - 10 * E1\n// Profit_E2 = 40 * E2 - 15 * E2\n// Profit_E3 = 50 * E3 - 20 * E3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (E1 + 2 * E2 + 3 * E3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// E1 + 2 * E2 + 3 * E3 <= 200",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. The company needs to determine the optimal production quantities for each component to maximize profit while considering the constraints of production capacity and market demand. The profit per unit of E1 is $30, E2 is $40, and E3 is $50. The production cost per unit of E1 is $10, E2 is $15, and E3 is $20. The production time per unit of E1 is 1 hour, E2 is 2 hours, and E3 is 3 hours. The company aims to maximize the profit per hour of production time. The company has a total production capacity of 200 hours. Please help the company determine the optimal production quantities for E1, E2, and E3.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE1 = model.addVar(vtype=\"INTEGER\", name=\"E1\", lb=0) # quantity of E1\nE2 = model.addVar(vtype=\"INTEGER\", name=\"E2\", lb=0) # quantity of E2\nE3 = model.addVar(vtype=\"INTEGER\", name=\"E3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * E1\nProfit_E2 = (40 - 15) * E2\nProfit_E3 = (50 - 20) * E3\nProductionTime = E1 + 2 * E2 + 3 * E3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons(E1 + 2 * E2 + 3 * E3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(E1))\n    print(\"Quantity of E2: \", model.getVal(E2))\n    print(\"Quantity of E3: \", model.getVal(E3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 680,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (80 - 40) * A\n// Profit of B: Profit_B = (120 - 60) * B\n// Profit of C: Profit_C = (160 - 80) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for material costs for the next quarter.\n// 40 * A + 60 * B + 80 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe manufacturer has a maximum of 500 hours available for production in the next quarter.\n// A + 2 * B + 3 * C <= 500",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin. The selling price, material cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Material Cost | Production Time |\n|--------|---------------|---------------|-----------------|\n| A      | 80$           | 40$           | 1 hour          |\n| B      | 120$          | 60$           | 2 hours         |\n| C      | 160$          | 80$           | 3 hours         |\n\nThe manufacturer has a budget of $10,000 for material costs for the next quarter. The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter. The manufacturer has a maximum of 500 hours available for production in the next quarter. \nPlease help the manufacturer to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (80 - 40) * A\nProfit_B = (120 - 60) * B\nProfit_C = (160 - 80) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for material costs for the next quarter.\nmodel.addCons(40 * A + 60 * B + 80 * C <= 10000)\n## The manufacturer has a maximum of 500 hours available for production in the next quarter.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1020,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water per Acre |\n|------|-----------------|----------------|\n| C1   | $1000           | 2 units        |\n| C2   | $1200           | 3 units        |\n| C3   | $1500           | 4 units        |\n\nThe farm has a total of 50 acres available for cultivation and a limited water supply of 100 units. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water). Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z).\n// {\"amount of Material X used\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y used\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n// {\"amount of Material Z used\": \"Z\", \"range\": \"Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n// Total cost of raw materials: Cost = 5 * X + 10 * Y + 15 * Z\n// Total production output: Output = 2 * X + 3 * Y + 4 * Z (assuming each unit of raw material contributes to the output as specified)\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 5 * X + 10 * Y + 15 * Z <= 10000",
        "question": "A manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z). The cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials. The total production output is calculated as 2 * X + 3 * Y + 4 * Z, where X, Y, and Z represent the amounts of Material X, Material Y, and Material Z used, respectively. The company has a budget of $10,000 for raw materials. Please help the company determine the optimal amounts of each raw material to use.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X used\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y used\nZ = model.addVar(vtype=\"CONTINUOUS\", name=\"Z\", lb=0) # amount of Material Z used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 5 * X + 10 * Y + 15 * Z\nOutput = 2 * X + 3 * Y + 4 * Z\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(5 * X + 10 * Y + 15 * Z <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Material X used: \", model.getVal(X))\n    print(\"Amount of Material Y used: \", model.getVal(Y))\n    print(\"Amount of Material Z used: \", model.getVal(Z))\n    print(\"Minimized Cost per Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm aims to maximize the profit efficiency (profit per liter of water used). Please help the farm determine the optimal allocation of hectares to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit from product A is $50 per unit, but it requires a setup cost of $1000. The profit from product B is $70 per unit, but it requires a setup cost of $1500. The profit from product C is $90 per unit, but it requires a setup cost of $2000. The company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Please help the company to maximize its total profit, considering the setup costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A - 1000\nProfit_B = 70 * B - 1500\nProfit_C = 90 * C - 2000\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 623,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n// So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units.\n// A >= 10\n// B >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $90             | 4 hours                  |\n\nThe company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively. The market demand for product A is at least 10 units, and for product B is at least 20 units.\n\nPlease help the company to maximize its net profit, which is the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 1000 + 20 * A**2 + 15 * B**2 + 25 * C**2\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit_Corn = 300 * C - 100 * C\n// Profit_Wheat = 250 * W - 80 * W\n// Profit_Soybeans = 200 * S - 60 * S\n// So, the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / (500 * C + 400 * W + 300 * S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C + W + S <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10,000 for labor costs.\n// 100 * C + 80 * W + 60 * S <= 10000\n\n## Generate Constraint-3:\nThe farmer has access to a maximum of 40,000 gallons of water for irrigation.\n// 500 * C + 400 * W + 300 * S <= 40000\n\n## Generate Constraint-4:\nThe farmer must plant at least 10 acres of each crop to maintain the soil quality.\n// C >= 10; W >= 10; S >= 10",
        "question": "A farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer has a total of 100 acres available for cultivation. The farmer has a budget of $10,000 for labor costs. The farmer has access to a maximum of 40,000 gallons of water for irrigation. The farmer must plant at least 10 acres of each crop to maintain the soil quality.\nPlease help the farmer to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 acres of each crop to maintain the soil quality.\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of Corn\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=10) # acres of Wheat\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=10) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (300 - 100) * C\nProfit_Wheat = (250 - 80) * W\nProfit_Soybeans = (200 - 60) * S\nWaterUsage = 500 * C + 400 * W + 300 * S\n## the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C + W + S <= 100)\n## The farmer has a budget of $10,000 for labor costs.\nmodel.addCons(100 * C + 80 * W + 60 * S <= 10000)\n## The farmer has access to a maximum of 40,000 gallons of water for irrigation.\nmodel.addCons(500 * C + 400 * W + 300 * S <= 40000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The cost of cultivation per acre for crop A is $300, for crop B is $400, and for crop C is $500. The farmer aims to maximize the profit per acre (which is defined as the total revenue per acre minus the cost of cultivation per acre).\n// Revenue per acre of crop A: Rev_A = 5 * 100 = 500\n// Revenue per acre of crop B: Rev_B = 7 * 120 = 840\n// Revenue per acre of crop C: Rev_C = 9 * 150 = 1350\n// Cost per acre of crop A: Cost_A = 300\n// Cost per acre of crop B: Cost_B = 400\n// Cost per acre of crop C: Cost_C = 500\n// Profit per acre of crop A: Profit_A = Rev_A - Cost_A = 500 - 300 = 200\n// Profit per acre of crop B: Profit_B = Rev_B - Cost_B = 840 - 400 = 440\n// Profit per acre of crop C: Profit_C = Rev_C - Cost_C = 1350 - 500 = 850\n// So, the objective function is: Maximize (200 * A + 440 * B + 850 * C) / (A + B + C)\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to allocate at least 20 acres to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe total cost of cultivation should not exceed $40,000.\n// 300 * A + 400 * B + 500 * C <= 40000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The cost of cultivation per acre for crop A is $300, for crop B is $400, and for crop C is $500. The farmer aims to maximize the profit per acre (which is defined as the total revenue per acre minus the cost of cultivation per acre). The total available land for cultivation is 100 acres. The farmer wants to allocate at least 20 acres to each crop. The total cost of cultivation should not exceed $40,000. Please help the farmer to maximize the profit per acre.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to allocate at least 20 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 200 * A\nProfit_B = 440 * B\nProfit_C = 850 * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (200 * A + 440 * B + 850 * C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n## The total cost of cultivation should not exceed $40,000.\nmodel.addCons(300 * A + 400 * B + 500 * C <= 40000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 757,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $300, and the water requirement is 5000 liters.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $500, and the water requirement is 7000 liters.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $700, and the water requirement is 9000 liters.\nThe farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n// Net revenue of A: Net_A = (1000 - 300) * A\n// Net revenue of B: Net_B = (1500 - 500) * B\n// Net revenue of C: Net_C = (2000 - 700) * C\n// So, the objective function is: Maximize (Net_A + Net_B + Net_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $10000 for seeds for the upcoming season.\n// 300 * A + 500 * B + 700 * C <= 10000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 5 hectares to each crop for the upcoming season.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe farm has a water supply of 150000 liters for the upcoming season.\n// 5000 * A + 7000 * B + 9000 * C <= 150000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season. The expected revenue per hectare, cost of seeds per hectare, and water requirement for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Hectare | Cost of Seeds per Hectare | Water Requirement per Hectare |\n|------|-------------------------------|---------------------------|--------------------------------|\n| A    | $1000                         | $300                      | 5000 liters                    |\n| B    | $1500                         | $500                      | 7000 liters                    |\n| C    | $2000                         | $700                      | 9000 liters                    |\n\nThe farm has a budget of $10000 for seeds for the upcoming season. The farm wants to allocate at least 5 hectares to each crop for the upcoming season. The farm has a water supply of 150000 liters for the upcoming season. \nPlease help the farm to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 hectares to each crop for the upcoming season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_A = (1000 - 300) * A\nNet_B = (1500 - 500) * B\nNet_C = (2000 - 700) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_A + Net_B + Net_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_A + Net_B + Net_C)\n\n# Add constraints\n## The farm has a budget of $10000 for seeds for the upcoming season.\nmodel.addCons(300 * A + 500 * B + 700 * C <= 10000)\n## The farm has a water supply of 150000 liters for the upcoming season.\nmodel.addCons(5000 * A + 7000 * B + 9000 * C <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products.\n// Total profit: Profit = P_a + P_b + P_c = 100Q_a - 0.5Q_a^2 + 150Q_b - 0.6Q_b^2 + 200Q_c - 0.7Q_c^2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\n// Qa + Qb + Qc <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products. The company has a limited budget for raw materials, which restricts the total production quantity to 1000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit from each product depends on the production quantity and a nonlinear relationship between production and cost.\n## The profit for product A is given by P_a = 100Q_a - 0.5Q_a^2\nP_a = 100 * Qa - 0.5 * Qa**2\n## The profit for product B is given by P_b = 150Q_b - 0.6Q_b^2\nP_b = 150 * Qb - 0.6 * Qb**2\n## The profit for product C is given by P_c = 200Q_c - 0.7Q_c^2\nP_c = 200 * Qc - 0.7 * Qc**2\n## Total profit: Profit = P_a + P_b + P_c = 100Q_a - 0.5Q_a^2 + 150Q_b - 0.6Q_b^2 + 200Q_c - 0.7Q_c^2\nmodel.addCons(obj == P_a + P_b + P_c)\n\n# Add constraints\n## The company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains.\n// {\"number of solar panels on flat rooftops\": \"FlatPanels\", \"range\": \"FlatPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped rooftops\": \"SlopedPanels\", \"range\": \"SlopedPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on open fields\": \"FieldPanels\", \"range\": \"FieldPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by terrain type. On flat rooftops, each panel produces 150 kWh per day. On sloped rooftops, each panel produces 180 kWh per day due to better sunlight exposure. On open fields, each panel produces 160 kWh per day but requires additional maintenance costs, which are $5 per panel per day. The company aims to maximize the total daily energy production minus the maintenance costs.\n// Total daily energy production: Energy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\n// Total daily maintenance cost: Maintenance = 5 * FieldPanels\n// So, the objective function is: Maximize (Energy - Maintenance)\n\n## Generate Constraint-1:\nThe company has a budget to install a maximum of 1000 solar panels in total.\n// FlatPanels + SlopedPanels + FieldPanels <= 1000\n\n## Generate Constraint-2:\nDue to space limitations, the number of panels that can be installed on flat rooftops is limited to 400.\n// FlatPanels <= 400\n\n## Generate Constraint-3:\nThe number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints.\n// SlopedPanels <= 300\n\n## Generate Constraint-4:\nThe company must install at least 100 panels on open fields to meet local renewable energy targets.\n// FieldPanels >= 100",
        "question": "A renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains. The efficiency of solar panels varies by terrain type as shown in the following Table.\n\n| Terrain Type       | Energy Production per Panel (kWh/day) | Additional Maintenance Cost per Panel (per day) |\n|--------------------|--------------------------------------|------------------------------------------------|\n| Flat rooftops      | 150                                  | 0                                              |\n| Sloped rooftops    | 180                                  | 0                                              |\n| Open fields        | 160                                  | $5                                             |\n\nThe company has a budget to install a maximum of 1000 solar panels in total. Due to space limitations, the number of panels that can be installed on flat rooftops is limited to 400. The number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints. The company must install at least 100 panels on open fields to meet local renewable energy targets. \n\nPlease help the company to maximize the total daily energy production minus the maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlatPanels = model.addVar(vtype=\"INTEGER\", name=\"FlatPanels\", lb=0) # number of solar panels on flat rooftops\nSlopedPanels = model.addVar(vtype=\"INTEGER\", name=\"SlopedPanels\", lb=0) # number of solar panels on sloped rooftops\nFieldPanels = model.addVar(vtype=\"INTEGER\", name=\"FieldPanels\", lb=100) # number of solar panels on open fields\n\n# Define objective function\nEnergy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\nMaintenance = 5 * FieldPanels\n# So, the objective function is: Maximize (Energy - Maintenance)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Maintenance)\n\n# Add constraints\nmodel.addCons(FlatPanels + SlopedPanels + FieldPanels <= 1000) # The company has a budget to install a maximum of 1000 solar panels in total.\nmodel.addCons(FlatPanels <= 400) # Due to space limitations, the number of panels that can be installed on flat rooftops is limited to 400.\nmodel.addCons(SlopedPanels <= 300) # The number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Rooftops: \", model.getVal(FlatPanels))\n    print(\"Number of Solar Panels on Sloped Rooftops: \", model.getVal(SlopedPanels))\n    print(\"Number of Solar Panels on Open Fields: \", model.getVal(FieldPanels))\n    print(\"Maximized Daily Energy Production (minus maintenance costs): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1486,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints.\n// {\"production rate of ChemicalA\": \"ChemicalARate\", \"range\": \"ChemicalARate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalB\": \"ChemicalBRate\", \"range\": \"ChemicalBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalC\": \"ChemicalCRate\", \"range\": \"ChemicalCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals.\n// Total profit for ChemicalA: Profit_ChemicalA = 50 * ChemicalARate\n// Total profit for ChemicalB: Profit_ChemicalB = 70 * ChemicalBRate\n// Total profit for ChemicalC: Profit_ChemicalC = 90 * ChemicalCRate\n// So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n## Generate Constraint-1:\nThe total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\n// ChemicalARate + ChemicalBRate + ChemicalCRate <= 100\n\n## Generate Constraint-2:\nThe production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\n// ChemicalBRate >= 2 * ChemicalARate",
        "question": "A manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints. The profit per unit for each chemical is as follows: ChemicalA at $50, ChemicalB at $70, and ChemicalC at $90.\n\n| Chemical | Profit per Unit |\n|----------|-----------------|\n| ChemicalA | $50            |\n| ChemicalB | $70            |\n| ChemicalC | $90            |\n\nThe company has the following constraints:\n1. The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\n2. The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\n\nPlease help the company to maximize the total profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalARate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalARate\", lb=0) # production rate of ChemicalA\nChemicalBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBRate\", lb=0) # production rate of ChemicalB\nChemicalCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCRate\", lb=0) # production rate of ChemicalC\n\n# Define objective function\nProfit_ChemicalA = 50 * ChemicalARate\nProfit_ChemicalB = 70 * ChemicalBRate\nProfit_ChemicalC = 90 * ChemicalCRate\n# So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n# Add constraints\n# The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\nmodel.addCons(ChemicalARate + ChemicalBRate + ChemicalCRate <= 100)\n# The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\nmodel.addCons(ChemicalBRate >= 2 * ChemicalARate)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemicalA: \", model.getVal(ChemicalARate))\n    print(\"Production Rate of ChemicalB: \", model.getVal(ChemicalBRate))\n    print(\"Production Rate of ChemicalC: \", model.getVal(ChemicalCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 200 units per week, and for device B is at least 150 units per week.\n// A >= 200; B >= 150\n\n## Generate Constraint-3:\nThe company has a strategic goal to produce at least twice as many units of device C as the combined production of devices A and B.\n// C >= 2 * (A + B)",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand. The profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost. The total production capacity of the factory is limited to 1000 units per week. The market demand for device A is at least 200 units per week, and for device B is at least 150 units per week. The company has a strategic goal to produce at least twice as many units of device C as the combined production of devices A and B. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## Revenue and cost calculation\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## Objective function: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## Total production capacity of the factory is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## Market demand for device A is at least 200 units per week, and for device B is at least 150 units per week.\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 150)\n## Company has a strategic goal to produce at least twice as many units of device C as the combined production of devices A and B.\nmodel.addCons(C >= 2 * (A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\n// Total profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\n// Total profit for DeviceC: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 600\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBQty <= 2 * DeviceAQty",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit. The company has a total production capacity of 600 units for all devices combined. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. Please help the company determine the optimal production quantities for DeviceA, DeviceB, and DeviceC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=600)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAQty == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=600)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBQty == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.2 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=600)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCQty == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 100 * DeviceC1 * DeviceC_b1 + (100 - 0.3 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 600)\nmodel.addCons(DeviceBQty <= 2 * DeviceAQty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 800 units.\n// S + T <= 800\n\n## Generate Constraint-3:\nThe company has a minimum production requirement for laptops to maintain its market presence, which is at least 100 units.\n// L >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L.\nThe total production capacity of the factory is limited to 1000 units per month. The market demand for smartphones and tablets combined should not exceed 800 units. The company has a minimum production requirement for laptops to maintain its market presence, which is at least 100 units.\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=100) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nS_sq = model.addVar(vtype=\"INTEGER\", name=\"S_sq\")\nT_sq = model.addVar(vtype=\"INTEGER\", name=\"T_sq\")\nL_sq = model.addVar(vtype=\"INTEGER\", name=\"L_sq\")\nmodel.addCons(S_sq == S**2)\nmodel.addCons(T_sq == T**2)\nmodel.addCons(L_sq == L**2)\nP_S = 100 * S - 0.1 * S_sq\nP_T = 150 * T - 0.2 * T_sq\nP_L = 200 * L - 0.3 * L_sq\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 1000)\nmodel.addCons(S + T <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production.\n// {\"number of solar panels on flat roof\": \"SF\", \"range\": \"SF >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on pitched roof\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on domed roof\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies based on the type of roof. On a flat roof, each panel produces 100 kWh. On a pitched roof, each panel produces 120 kWh. On a domed roof, each panel produces 150 kWh. The company aims to maximize the total energy production from all roofs.\n// Total energy production: Energy = 100 * SF + 120 * SP + 150 * SD\n// So, the objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe total number of solar panels that can be installed is limited to 1000.\n// SF + SP + SD <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the number of panels that can be installed on each type of roof. The budget allows for at most 400 panels on flat roofs, 500 panels on pitched roofs, and 300 panels on domed roofs.\n// SF <= 400; SP <= 500; SD <= 300",
        "question": "A solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production. The energy production from each solar panel varies based on the type of roof, as shown in the following Table.\n\n| Roof Type | Energy Production per Panel |\n|-----------|------------------------------|\n| Flat      | 100 kWh                      |\n| Pitched   | 120 kWh                      |\n| Domed     | 150 kWh                      |\n\nThe total number of solar panels that can be installed is limited to 1000. The company has a budget constraint that limits the number of panels that can be installed on each type of roof. The budget allows for at most 400 panels on flat roofs, 500 panels on pitched roofs, and 300 panels on domed roofs.\n\nPlease help the company to maximize the total energy production from all roofs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSF = model.addVar(vtype=\"INTEGER\", name=\"SF\", lb=0, ub=400) # number of solar panels on flat roof\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0, ub=500) # number of solar panels on pitched roof\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0, ub=300) # number of solar panels on domed roof\n\n# Define objective function\nEnergy = 100 * SF + 120 * SP + 150 * SD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\nmodel.addCons(SF + SP + SD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roof: \", model.getVal(SF))\n    print(\"Number of Solar Panels on Pitched Roof: \", model.getVal(SP))\n    print(\"Number of Solar Panels on Domed Roof: \", model.getVal(SD))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered.\n// Total daily cost: Cost = 500 * T + 300 * V + 100 * B\n// Total packages delivered: Packages = 100 * T + 50 * V + 20 * B\n// The company needs to deliver at least 2000 packages per day.\n// So, the objective function is: Minimize Cost subject to Packages >= 2000\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle operations.\n// 500 * T + 300 * V + 100 * B <= 10,000",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements. The delivery capacity and daily cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity (packages/day) | Daily Cost ($) |\n|--------------|---------------------------------|---------------|\n| Trucks       | 100                             | 500           |\n| Vans         | 50                              | 300           |\n| Bikes        | 20                              | 100           |\n\nThe company has a budget of $10,000 per day for vehicle operations. The company needs to deliver at least 2000 packages per day. Please help the company to minimize the total daily cost while ensuring all packages are delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * T + 300 * V + 100 * B\nPackages = 100 * T + 50 * V + 20 * B\n## the objective function is: Minimize Cost subject to Packages >= 2000\nmodel.addCons(Packages >= 2000)\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for vehicle operations.\nmodel.addCons(500 * T + 300 * V + 100 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000.\nFor V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000.\nFor V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000.\nThe company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n// Total_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\n// Fuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\n// Total_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n// So, the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// 5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency, capacity, and cost. The details for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/km) | Capacity (kg) | Cost per Vehicle ($) |\n|---------|------------------------------|---------------|----------------------|\n| V1      | 0.1                          | 1000          | 5000                 |\n| V2      | 0.08                         | 1500          | 6000                 |\n| V3      | 0.06                         | 2000          | 7000                 |\n\nThe company has a budget of $100,000 for purchasing vehicles. The company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries. Please help the company determine the optimal number of each type of vehicle to purchase.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\nFuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\nTotal_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n## the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost + Fuel_Consumption * Total_Weight)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Minimized Total Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. However, due to soil conditions, the profit per acre decreases nonlinearly as more acres are planted. Specifically, for each additional acre beyond the first 50 acres, the profit per acre decreases by 0.5% for Wheat, 0.7% for Corn, and 0.6% for Soybeans. The farmer wants to maximize the total profit from the crops.\n// Profit_Wheat = (200 - 0.5% * max(Wheat - 50, 0)) * Wheat\n// Profit_Corn = (300 - 0.7% * max(Corn - 50, 0)) * Corn\n// Profit_Soybeans = (250 - 0.6% * max(Soybeans - 50, 0)) * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe farmer has a total of 200 acres available for planting.\n// Wheat + Corn + Soybeans <= 200",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for each crop is given in the following Table.\n\n| Crop       | Profit per Acre |\n|------------|-----------------|\n| Wheat      | $200            |\n| Corn       | $300            |\n| Soybeans   | $250            |\n\nHowever, due to soil conditions, the profit per acre decreases nonlinearly as more acres are planted. Specifically, for each additional acre beyond the first 50 acres, the profit per acre decreases by 0.5% for Wheat, 0.7% for Corn, and 0.6% for Soybeans. The farmer wants to maximize the total profit from the crops. The farmer has a total of 200 acres available for planting.\n\nPlease help the farmer determine the optimal allocation of acres to Wheat, Corn, and Soybeans to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)    # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of Soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Wheat = (200 - 0.5% * max(Wheat - 50, 0)) * Wheat\nWheat1 = model.addVar(vtype=\"INTEGER\", name=\"Wheat1\", lb=0, ub=50)\nWheat2 = model.addVar(vtype=\"INTEGER\", name=\"Wheat2\", lb=50, ub=200)\nWheat_b1 = model.addVar(vtype=\"B\", name=\"Wheat_b1\")\nWheat_b2 = model.addVar(vtype=\"B\", name=\"Wheat_b2\")\nmodel.addCons(Wheat_b1 + Wheat_b2 == 1)\nmodel.addCons(Wheat == Wheat1*Wheat_b1 + Wheat2*Wheat_b2)\nProfit_Wheat = (200 - 0.005 * (Wheat2 - 50)) * Wheat2 * Wheat_b2 + 200 * Wheat1 * Wheat_b1\n## create piecewise variables for piecewise function: Profit_Corn = (300 - 0.7% * max(Corn - 50, 0)) * Corn\nCorn1 = model.addVar(vtype=\"INTEGER\", name=\"Corn1\", lb=0, ub=50)\nCorn2 = model.addVar(vtype=\"INTEGER\", name=\"Corn2\", lb=50, ub=200)\nCorn_b1 = model.addVar(vtype=\"B\", name=\"Corn_b1\")\nCorn_b2 = model.addVar(vtype=\"B\", name=\"Corn_b2\")\nmodel.addCons(Corn_b1 + Corn_b2 == 1)\nmodel.addCons(Corn == Corn1*Corn_b1 + Corn2*Corn_b2)\nProfit_Corn = (300 - 0.007 * (Corn2 - 50)) * Corn2 * Corn_b2 + 300 * Corn1 * Corn_b1\n## create piecewise variables for piecewise function: Profit_Soybeans = (250 - 0.6% * max(Soybeans - 50, 0)) * Soybeans\nSoybeans1 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans1\", lb=0, ub=50)\nSoybeans2 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans2\", lb=50, ub=200)\nSoybeans_b1 = model.addVar(vtype=\"B\", name=\"Soybeans_b1\")\nSoybeans_b2 = model.addVar(vtype=\"B\", name=\"Soybeans_b2\")\nmodel.addCons(Soybeans_b1 + Soybeans_b2 == 1)\nmodel.addCons(Soybeans == Soybeans1*Soybeans_b1 + Soybeans2*Soybeans_b2)\nProfit_Soybeans = (250 - 0.006 * (Soybeans2 - 50)) * Soybeans2 * Soybeans_b2 + 250 * Soybeans1 * Soybeans_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\nmodel.addCons(Wheat + Corn + Soybeans <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $20, and product C is $30. The plant aims to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost.\n// Profit of A: Profit_A = (20 - 10) * A = 10 * A\n// Profit of B: Profit_B = (30 - 20) * B = 10 * B\n// Profit of C: Profit_C = (40 - 30) * C = 10 * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 20 * B + 30 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 5000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each product to meet the minimum order requirements.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe total production capacity of the plant is limited to 200 units.\n// A + B + C <= 200",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations. The profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $20, and product C is $30. The plant aims to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost. The plant has a budget of $5000 for production costs. The plant must produce at least 50 units of each product to meet the minimum order requirements. The total production capacity of the plant is limited to 200 units.\nPlease help the plant to maximize the ratio of total profit to the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each product to meet the minimum order requirements.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 10 * B\nProfit_C = 10 * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 5000)\n## The total production capacity of the plant is limited to 200 units.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"production rate of C1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of C2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of C3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\n// Profit_C1 = 10 * P1 * 0.8 * P1\n// Profit_C2 = 15 * P2 * 0.9 * P2\n// Profit_C3 = 20 * P3 * 1.1 * P3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\n// P1 <= 50; P2 <= 50; P3 <= 50\n\n## Generate Constraint-2:\nThe storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-3:\nThe plant must maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\n// P1 >= 10",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit and the efficiency of production for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Efficiency |\n|----------|-----------------|-----------------------|\n| C1       | $10             | 0.8 * P1              |\n| C2       | $15             | 0.9 * P2              |\n| C3       | $20             | 1.1 * P3              |\n\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical. The storage capacity for each chemical is limited, and the total amount of chemicals produced per hour must not exceed 100 units. The plant must also maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\n\nPlease help the plant to maximize the total profit by determining the optimal production rates for C1, C2, and C3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must maintain a minimum production rate of 10 units per hour for C1 to meet contractual obligations.\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate of C1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of C2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of C3\n\n# Define objective function\n## The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3.\nProfit_C1 = 10 * P1 * 0.8 * P1\nProfit_C2 = 15 * P2 * 0.9 * P2\nProfit_C3 = 20 * P3 * 1.1 * P3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 50)\nmodel.addCons(P3 <= 50)\n## The storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of C1: \", model.getVal(P1))\n    print(\"Production Rate of C2: \", model.getVal(P2))\n    print(\"Production Rate of C3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 70 units per day.\n// B >= 70\n\n## Generate Constraint-4:\nThe market demand for product C is at least 90 units per day.\n// C >= 90",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the profit per unit decreases when the production volume exceeds certain thresholds: product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units. The total production capacity of the company is 500 units per day. The market demand for product A is at least 50 units per day, for product B is at least 70 units per day, and for product C is at least 90 units per day. Please help the company to maximize the total profit from products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=70)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=90)  # number of units of product C\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=101, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n\n# Create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=201, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n\n# Create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=301, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the number of machines and workers to optimize production.\n// {\"number of machines for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe plant produces three products. The efficiency of machines and workers varies per product. \nFor product 1, each machine can produce 10 units per hour, and each worker can assemble 5 units per hour. \nFor product 2, each machine can produce 15 units per hour, and each worker can assemble 7 units per hour. \nThe plant aims to maximize the total production rate while considering the cost of labor and machine usage.\n// The production rate for product 1: P1 = 10 * M1 + 5 * W1\n// The production rate for product 2: P2 = 15 * M2 + 7 * W2\n// The objective function is: Maximize (P1 + P2) / (M1 + M2 + W1 + W2)\n\n## Generate Constraint-1:\nThe plant has a total of 30 machines available.\n// M1 + M2 <= 30\n\n## Generate Constraint-2:\nThere are 50 workers available in total.\n// W1 + W2 <= 50\n\n## Generate Constraint-3:\nThe cost of operating a machine is $100 per hour, and the labor cost is $50 per hour. The total operational budget is $1500 per hour.\n// 100 * (M1 + M2) + 50 * (W1 + W2) <= 1500\n\n## Generate Constraint-4:\nEach product must meet a minimum production quota. Product 1 must produce at least 200 units per day, and product 2 must produce at least 300 units per day.\n// 10 * M1 + 5 * W1 >= 200 / (8 hours per day)\n// 15 * M2 + 7 * W2 >= 300 / (8 hours per day)",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the number of machines and workers to optimize production. The efficiency of machines and workers varies per product, as shown in the following Table.\n\n| Product | Machine Efficiency (units/hour) | Worker Efficiency (units/hour) |\n|---------|---------------------------------|--------------------------------|\n| 1       | 10                              | 5                              |\n| 2       | 15                              | 7                              |\n\nThe plant has a total of 30 machines available and 50 workers. The cost of operating a machine is $100 per hour, and the labor cost is $50 per hour. The total operational budget is $1500 per hour. Each product must meet a minimum production quota: Product 1 must produce at least 200 units per day, and product 2 must produce at least 300 units per day.\n\nPlease help the plant manager to maximize the total production rate while considering the cost of labor and machine usage, defined as the sum of the production rates for both products divided by the total number of machines and workers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for product 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers for product 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for product 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers for product 2\n\n# Define objective function\nP1 = 10 * M1 + 5 * W1\nP2 = 15 * M2 + 7 * W2\nTotalResources = M1 + M2 + W1 + W2\n# The objective function is: Maximize (P1 + P2) / TotalResources\n# Convert the division to multiplication\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj * TotalResources == P1 + P2)\n\n# Add constraints\n# The plant has a total of 30 machines available.\nmodel.addCons(M1 + M2 <= 30)\n# There are 50 workers available in total.\nmodel.addCons(W1 + W2 <= 50)\n# The cost of operating a machine is $100 per hour, and the labor cost is $50 per hour. The total operational budget is $1500 per hour.\nmodel.addCons(100 * (M1 + M2) + 50 * (W1 + W2) <= 1500)\n# Each product must meet a minimum production quota. Product 1 must produce at least 200 units per day, and product 2 must produce at least 300 units per day.\nmodel.addCons(10 * M1 + 5 * W1 >= 200 / 8)\nmodel.addCons(15 * M2 + 7 * W2 >= 300 / 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product 1: \", model.getVal(M1))\n    print(\"Number of Workers for Product 1: \", model.getVal(W1))\n    print(\"Number of Machines for Product 2: \", model.getVal(M2))\n    print(\"Number of Workers for Product 2: \", model.getVal(W2))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products.\n// Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units for both products combined.\n// Prod1 + Prod2 <= 10000\n\n## Generate Constraint-2:\nThe investment in the new technology cannot exceed $50,000.\n// TechInvest <= 50000\n\n## Generate Constraint-3:\nThe production of Product 1 must be at least 2,000 units.\n// Prod1 >= 2000",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of both products and the investment in a new technology that enhances the production efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. The new technology reduces the production cost by $0.01 for each $1,000 invested. The selling price for each unit of Product 1 is $120, and for Product 2 is $180. The company aims to maximize the total profit from both products.\n\n| Product | Cost per Unit | Selling Price per Unit |\n|---------|---------------|------------------------|\n| 1       | 100$          | 120$                   |\n| 2       | 150$          | 180$                   |\n\nThe company has a total production capacity of 10,000 units for both products combined. The investment in the new technology cannot exceed $50,000. The production of Product 1 must be at least 2,000 units.\n\nPlease help the company to determine the optimal production quantities of both products and the investment in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=2000) # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0) # production quantity of Product 2\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in production technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2\nmodel.addCons(obj == (120 - 100 + 0.0001 * TechInvest) * Prod1 + (180 - 150 + 0.0001 * TechInvest) * Prod2)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units for both products combined.\nmodel.addCons(Prod1 + Prod2 <= 10000)\n## The investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvest <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Investment in Production Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1108,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow.\n// {\"number of units of product\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"number of workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every 10 overtime hours allowed. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the product.\n// Total profit for the product: Profit = (150 - 100 + 0.5 * Overtime) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired.\n// Workers <= 50; Workers >= 10\n\n## Generate Constraint-3:\nThe total amount of overtime hours allowed cannot exceed 100 hours.\n// Overtime <= 100\n\n## Generate Constraint-4:\nThe number of units produced must be at least 200.\n// Units >= 200",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow. The cost of production per unit decreases by $5 for every 10 overtime hours allowed. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the product.\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter. The total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired. The total amount of overtime hours allowed cannot exceed 100 hours. The number of units produced must be at least 200.\nPlease help the company to maximize its total profit from the product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=200)  # number of units of product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=10, ub=50)  # number of workers\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0, ub=100)  # amount of overtime hours\n\n# Define objective function\nProfit = (150 - 100 + 0.5 * Overtime) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Units <= 1000)\nmodel.addCons(Workers <= 50)\nmodel.addCons(Workers >= 10)\nmodel.addCons(Overtime <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of solar power plants. The company needs to decide how many solar panels to install in each plant to maximize energy production while considering the cost and efficiency of each type of panel.\n// {\"number of solar panels in plant 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in plant 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in plant 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel in plant 1 produces 100 kWh per day with an installation cost of $500 per panel. Each panel in plant 2 produces 120 kWh per day with an installation cost of $600 per panel. Each panel in plant 3 produces 150 kWh per day with an installation cost of $700 per panel. The company wants to maximize daily energy production while keeping the total installation cost below $100,000.\n// Daily energy production: E = 100 * P1 + 120 * P2 + 150 * P3\n// Total installation cost: C = 500 * P1 + 600 * P2 + 700 * P3\n// Objective function: Maximize E - 0.01 * C\n\n## Generate Constraint-1:\nThe total installation cost must not exceed $100,000.\n// 500 * P1 + 600 * P2 + 700 * P3 <= 100000\n\n## Generate Constraint-2:\nThe company has a limited area to install solar panels, with a maximum capacity of 200 panels across all plants.\n// P1 + P2 + P3 <= 200",
        "question": "A company operates three different types of solar power plants. The company needs to decide how many solar panels to install in each plant to maximize energy production while considering the cost and efficiency of each type of panel. Each solar panel in plant 1 produces 100 kWh per day with an installation cost of $500 per panel. Each panel in plant 2 produces 120 kWh per day with an installation cost of $600 per panel. Each panel in plant 3 produces 150 kWh per day with an installation cost of $700 per panel. The company wants to maximize daily energy production while keeping the total installation cost below $100,000. The total installation cost must not exceed $100,000, and the company has a limited area to install solar panels, with a maximum capacity of 200 panels across all plants. Please help the company to maximize daily energy production while considering the total installation cost and the limited area for solar panel installation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels in plant 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels in plant 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels in plant 3\n\n# Define objective function\n## Daily energy production: E = 100 * P1 + 120 * P2 + 150 * P3\n## Total installation cost: C = 500 * P1 + 600 * P2 + 700 * P3\n## Objective function: Maximize E - 0.01 * C\nE = 100 * P1 + 120 * P2 + 150 * P3\nC = 500 * P1 + 600 * P2 + 700 * P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == E - 0.01 * C)\n\n# Add constraints\n## The total installation cost must not exceed $100,000.\nmodel.addCons(500 * P1 + 600 * P2 + 700 * P3 <= 100000)\n## The company has a limited area to install solar panels, with a maximum capacity of 200 panels across all plants.\nmodel.addCons(P1 + P2 + P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Plant 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels in Plant 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels in Plant 3: \", model.getVal(P3))\n    print(\"Maximized Daily Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000\n\n## Generate Constraint-3:\nThe production rate for Product 1 must be at least 10 units per hour.\n// P1 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\nThe total production rate for all products cannot exceed 100 units per hour. The investment in advanced machinery cannot exceed $50,000. The production rate for Product 1 must be at least 10 units per hour.\nPlease help the company to determine the optimal production rates and investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in Advanced Machinery: \", model.getVal(Machinery))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n// The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $50,000.\n// 0.05 * S^2 + 0.07 * T^2 + 0.1 * L^2 <= 50000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company has a budget constraint that limits the total production cost to $50,000. Please help the company to maximize the total profit after deducting the production costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.07 * T**2 + 200 * L - 0.1 * L**2)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $50,000.\nmodel.addCons(0.05 * S**2 + 0.07 * T**2 + 0.1 * L**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 649,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost.\n// Cost_A = max(10 - 0.02 * (A - 100), 10) * A\n// Cost_B = max(15 - 0.02 * (B - 100), 15) * B\n// Cost_C = max(20 - 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\n// 5 * A + 8 * B + 10 * C <= 5000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand. The profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost. The manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units. Please help the manufacturer determine the optimal production quantities for components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = (10 - 0.02 * (A1 - 100)) * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(15 - 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = (15 - 0.02 * (B1 - 100)) * B1 * B_b1 + (15 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(20 - 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = (20 - 0.02 * (C1 - 100)) * C1 * C_b1 + (20 - 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The manufacturer has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized.\n// {\"production level of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n// Total profit: Profit = 50 * A + 70 * B + 90 * C\n// Environmental cost: Cost = 10 * C\n// So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe manufacturer has a contract to produce at least 200 units of product A.\n// A >= 200\n\n## Generate Constraint-3:\nDue to market demand, the production of product B should not exceed 300 units.\n// B <= 300",
        "question": "A manufacturer produces three types of products: A, B, and C. Each unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost. The total production capacity is limited to 1000 units across all products. The manufacturer has a contract to produce at least 200 units of product A. Due to market demand, the production of product B should not exceed 300 units. Please help the manufacturer to determine the optimal production levels for products A, B, and C to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production level of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # production level of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50 * A + 70 * B + 90 * C\n## Environmental cost: Cost = 10 * C\n## So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\nmodel.addCons(obj == 50 * A + 70 * B + 80 * C)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of product A: \", model.getVal(A))\n    print(\"Production level of product B: \", model.getVal(B))\n    print(\"Production level of product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 736,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for the new product\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of skilled workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that the profit per unit of the product is $100, but this increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe maximum number of skilled workers that can be hired is 50.\n// Workers <= 50",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line. The company estimates that the profit per unit of the product is $100, which increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product.\n\nThe company has a budget of $50,000 for advertising. The maximum number of skilled workers that can be hired is 50.\n\nPlease help the company to maximize the total profit from the product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget for the new product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of skilled workers\n\n# Define objective function\n## Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n## The maximum number of skilled workers that can be hired is 50.\nmodel.addCons(Workers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The manufacturer wants to maximize the total profit from selling these devices.\n// Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\n// Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\n// Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing Smartphones is $50 per unit, Tablets is $75 per unit, and Laptops is $100 per unit. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\n// S <= 500; T <= 300; L <= 200",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The following table summarizes the cost per unit and the demand limit for each device.\n\n| Device     | Profit per Unit | Cost per Unit | Demand Limit |\n|------------|-----------------|---------------|--------------|\n| Smartphones| 100$            | 50$           | 500 units    |\n| Tablets    | 150$            | 75$           | 300 units    |\n| Laptops    | 200$            | 100$          | 200 units    |\n\nThe manufacturer has a limited budget for production, with a total budget of $15,000. The cost of producing Smartphones is $50 per unit, Tablets is $75 per unit, and Laptops is $100 per unit. The market has a demand limit for each device: 500 units for Smartphones, 300 units for Tablets, and 200 units for Laptops.\n\nPlease help the manufacturer to maximize the total profit from selling these devices, considering the cost of production and the market demand constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_Smartphones = 100 * S1 * S_b1 + (100 - 1 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_Tablets = 150 * T1 * T_b1 + (150 - 1 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_Laptops = 200 * L1 * L_b1 + (200 - 1 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\nmodel.addCons(obj == (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1447,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of three different products: Product A, Product B, and Product C. Additionally, the company is considering investing in a new technology that could improve the efficiency of production, which would reduce the production costs per unit.\n// {\"production level of Product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production level of Product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $50, Product B is $70, and Product C is $60. The new technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price for each unit of Product A is $100, Product B is $120, and Product C is $110. The company aims to maximize the total profit from the sales of all three products.\n// Total profit: Profit = (100 - (50 - 0.0002 * TechInvest)) * ProdA + (120 - (70 - 0.0002 * TechInvest)) * ProdB + (110 - (60 - 0.0002 * TechInvest)) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the investment in the new technology.\n// TechInvest <= 100000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of three different products: Product A, Product B, and Product C. The company is also considering investing in a new technology that could improve the efficiency of production, which would reduce the production costs per unit. The cost of producing each unit of Product A is $50, Product B is $70, and Product C is $60. The new technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price for each unit of Product A is $100, Product B is $120, and Product C is $110. The company aims to maximize the total profit from the sales of all three products. The company has a budget of $100,000 for the investment in the new technology.\n\n| Product | Selling Price | Production Cost |\n|---------|---------------|-----------------|\n| A       | 100$          | 50$             |\n| B       | 120$          | 70$             |\n| C       | 110$          | 60$             |\n\nPlease help the company determine the optimal production levels of Product A, Product B, and Product C, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production level of Product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production level of Product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production level of Product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - (50 - 0.0002 * TechInvest)) * ProdA + (120 - (70 - 0.0002 * TechInvest)) * ProdB + (110 - (60 - 0.0002 * TechInvest)) * ProdC\nCostA = 50 - 0.0002 * TechInvest\nCostB = 70 - 0.0002 * TechInvest\nCostC = 60 - 0.0002 * TechInvest\nProfit = (100 - CostA) * ProdA + (120 - CostB) * ProdB + (110 - CostC) * ProdC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for the investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of Product A: \", model.getVal(ProdA))\n    print(\"Production level of Product B: \", model.getVal(ProdB))\n    print(\"Production level of Product C: \", model.getVal(ProdC))\n    print(\"Investment in new technology: \", model.getVal(TechInvest))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1198,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least 20 units to be effective.\n// DosageC >= 20",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of each drug is modeled as follows:\n\n| Drug    | Effectiveness Model                          |\n|---------|----------------------------------------------|\n| DrugA   | EffectivenessA = 50 * DosageA - 0.5 * DosageA^2 |\n| DrugB   | EffectivenessB = 60 * DosageB - 0.3 * DosageB^3 |\n| DrugC   | EffectivenessC = 70 * DosageC - 0.2 * DosageC^4 |\n\nThe company wants to maximize the total effectiveness of the drugs. The following constraints apply:\n1. The total dosage across all drugs must not exceed 150 units to ensure safety.\n2. Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n3. The dosage of DrugC must be at least 20 units to be effective.\n\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC within the ranges 0 <= DosageA, DosageB, DosageC <= 100 to maximize the total effectiveness.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\nmodel.addCons(DosageA >= 2 * DosageB)\nmodel.addCons(DosageC >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for purchasing fertilizer.\n// 30 * A + 40 * B + 50 * C <= 5000",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The revenue and cost per ton of each crop are given in the following Table.\n\n| Crop | Revenue per Ton | Cost per Ton |\n|------|-----------------|--------------|\n| A    | $100            | $30          |\n| B    | $150            | $40          |\n| C    | $200            | $50          |\n\nThe farmer wants to maximize his net profit (revenue minus cost). The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. The farmer has a budget of $5000 for purchasing fertilizer.\n\nPlease help the farmer determine the optimal quantity of each crop to plant to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Crop C\n\n# Define objective function\nProfit_A = 100 * A - 30 * A\nProfit_B = 150 * B - 40 * B\nProfit_C = 200 * C - 50 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total area available for planting is 100 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n# The farmer has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled technicians assigned to each production line.\n// {\"number of technicians on component A line\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians on component B line\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians on component C line\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach technician on the component A line can produce 10 units per hour, on the component B line can produce 15 units per hour, and on the component C line can produce 20 units per hour. The company aims to maximize the total production of all components. However, the efficiency of production decreases as more technicians are assigned due to space constraints and coordination issues. The efficiency function is given by E = 1 / (1 + T), where T is the number of technicians.\n// The production rate for component A: P1 = 10 * T1 * E1 = 10 * T1 / (1 + T1)\n// The production rate for component B: P2 = 15 * T2 * E2 = 15 * T2 / (1 + T2)\n// The production rate for component C: P3 = 20 * T3 * E3 = 20 * T3 / (1 + T3)\n// So, the objective function is: Maximize P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 30 skilled technicians available.\n// T1 + T2 + T3 <= 30\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 10 technicians due to space limitations.\n// T1 <= 10; T2 <= 10; T3 <= 10\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of component A, 300 units of component B, and 400 units of component C daily.\n// 10 * T1 / (1 + T1) >= 200\n// 15 * T2 / (1 + T2) >= 300\n// 20 * T3 / (1 + T3) >= 400",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled technicians assigned to each production line. Each technician on the component A line can produce 10 units per hour, on the component B line can produce 15 units per hour, and on the component C line can produce 20 units per hour. The company aims to maximize the total production of all components. However, the efficiency of production decreases as more technicians are assigned due to space constraints and coordination issues. The efficiency function is given by E = 1 / (1 + T), where T is the number of technicians.\nThe company has a total of 30 skilled technicians available. Each production line can accommodate a maximum of 10 technicians due to space limitations. The company must produce at least 200 units of component A, 300 units of component B, and 400 units of component C daily.\nPlease help the company to maximize the total production of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of technicians on component A line\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of technicians on component B line\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of technicians on component C line\n\n# Define objective function\n## The production rate for component A: P1 = 10 * T1 * E1 = 10 * T1 / (1 + T1)\n## The production rate for component B: P2 = 15 * T2 * E2 = 15 * T2 / (1 + T2)\n## The production rate for component C: P3 = 20 * T3 * E3 = 20 * T3 / (1 + T3)\n## So, the objective function is: Maximize P1 + P2 + P3\nP1 = model.addVar(name=\"P1\")\nP2 = model.addVar(name=\"P2\")\nP3 = model.addVar(name=\"P3\")\nmodel.setObjective(P1 + P2 + P3, \"maximize\")\nmodel.addCons(P1 == 10 * T1 / (1 + T1))\nmodel.addCons(P2 == 15 * T2 / (1 + T2))\nmodel.addCons(P3 == 20 * T3 / (1 + T3))\n\n# Add constraints\n## The company has a total of 30 skilled technicians available.\nmodel.addCons(T1 + T2 + T3 <= 30)\n## Each production line can accommodate a maximum of 10 technicians due to space limitations.\nmodel.addCons(T1 <= 10)\nmodel.addCons(T2 <= 10)\nmodel.addCons(T3 <= 10)\n## The company must produce at least 200 units of component A, 300 units of component B, and 400 units of component C daily.\nmodel.addCons(10 * T1 / (1 + T1) >= 200)\nmodel.addCons(15 * T2 / (1 + T2) >= 300)\nmodel.addCons(20 * T3 / (1 + T3) >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Technicians on Component A Line: \", model.getVal(T1))\n    print(\"Number of Technicians on Component B Line: \", model.getVal(T2))\n    print(\"Number of Technicians on Component C Line: \", model.getVal(T3))\n    print(\"Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. \nFor S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. \nFor S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300.\nThe manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n// Net_Revenue_S1 = (100 * S1 - 60 * S1) / 200\n// Net_Revenue_S2 = (120 * S2 - 70 * S2) / 250\n// Net_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n// So, the objective function is: Maximize (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $10,000 for production costs.\n// 60 * S1 + 70 * S2 + 90 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\n// S1 + S2 + S3 <= 150",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce. For S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. For S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. For S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300. The manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year). The manufacturer has a limited production budget of $10,000 for production costs and a production capacity of 150 units in terms of the number of units it can produce. Please help the manufacturer to maximize the net revenue per unit of energy efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_S1 = (100 * S1 - 60 * S1) / 200\nNet_Revenue_S2 = (120 * S2 - 70 * S2) / 250\nNet_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n## convert the division to multiplication\nmodel.addCons(obj * (200 + 250 + 300) == (100 * S1 - 60 * S1) + (120 * S2 - 70 * S2) + (150 * S3 - 90 * S3))\n\n# Add constraints\n## The manufacturer has a limited production budget of $10,000 for production costs.\nmodel.addCons(60 * S1 + 70 * S2 + 90 * S3 <= 10000)\n## The manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\nmodel.addCons(S1 + S2 + S3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Net Revenue per Unit of Energy Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production cost per unit is $60. For P2, the profit per unit is $120, and the production cost per unit is $70. The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company aims to maximize the total profit from both products.\n// Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n// Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 2000 units for P1 and 1500 units for P2.\n// P1 <= 2000\n// P2 <= 1500",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs. The profit per unit of P1 is $100, and the production cost per unit is $60. For P2, the profit per unit is $120, and the production cost per unit is $70. The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company has a total budget of $100,000 for investment in the new technology. The company has a production capacity of 2000 units for P1 and 1500 units for P2. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=2000) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=1500) # quantity of P2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n## Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n## So, the objective function is: Maximize (Profit_P1 + Profit_P2)\nProfit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\nProfit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 761,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit from ComponentA: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\n// Profit from ComponentB: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\n// Profit from ComponentC: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// QuantityA + QuantityB + QuantityC <= 500",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit. The profit per unit for each component decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Component | Profit per Unit (first threshold) | Decrease per Unit (beyond threshold) | Threshold |\n|-----------|-----------------------------------|-------------------------------------|-----------|\n| ComponentA | $50                              | $0.1                                | 100 units  |\n| ComponentB | $70                              | $0.05                               | 200 units  |\n| ComponentC | $90                              | $0.02                               | 300 units  |\n\nThe company has a total production capacity of 500 units per month. Please help the company to maximize the total profit from the production of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ComponentA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ComponentB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(QuantityA == A1*A_b1 + A2*A_b2)\nProfitA = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(QuantityB == B1*B_b1 + B2*B_b2)\nProfitB = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(QuantityC == C1*C_b1 + C2*C_b2)\nProfitC = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ComponentA: \", model.getVal(QuantityA))\n    print(\"Production Quantity for ComponentB: \", model.getVal(QuantityB))\n    print(\"Production Quantity for ComponentC: \", model.getVal(QuantityC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1003,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\n// {\"area of G1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of G2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of G3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The farm aims to maximize the net profit (yield * price per kg - energy cost). The price per kg of the crop is $2.\n// Profit_G1 = 10 * A1 * 2 - 5 * A1\n// Profit_G2 = 15 * A2 * 2 - 7 * A2\n// Profit_G3 = 20 * A3 * 2 - 9 * A3\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\n\n## Generate Constraint-1:\nThe total area available for all greenhouses is 1000 square meters.\n// A1 + A2 + A3 <= 1000\n\n## Generate Constraint-2:\nThe total energy budget for the farm is $8000.\n// 5 * A1 + 7 * A2 + 9 * A3 <= 8000\n\n## Generate Constraint-3:\nThe farm has a minimum yield requirement of 12000 kg.\n// 10 * A1 + 15 * A2 + 20 * A3 >= 12000",
        "question": "A farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation. The yield per square meter and energy cost per square meter for each greenhouse are given in the following Table.\n\n| Greenhouse | Yield per Square Meter | Energy Cost per Square Meter |\n|------------|------------------------|------------------------------|\n| G1         | 10 kg                  | $5                           |\n| G2         | 15 kg                  | $7                           |\n| G3         | 20 kg                  | $9                           |\n\nThe price per kg of the crop is $2. The farm aims to maximize the net profit (yield * price per kg - energy cost). The total area available for all greenhouses is 1000 square meters. The total energy budget for the farm is $8000. The farm has a minimum yield requirement of 12000 kg.\n\nPlease help the farm to maximize the net profit from the greenhouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of G1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of G2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of G3\n\n# Define objective function\nProfit_G1 = 10 * A1 * 2 - 5 * A1\nProfit_G2 = 15 * A2 * 2 - 7 * A2\nProfit_G3 = 20 * A3 * 2 - 9 * A3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_G1 + Profit_G2 + Profit_G3)\n\n# Add constraints\n# The total area available for all greenhouses is 1000 square meters.\nmodel.addCons(A1 + A2 + A3 <= 1000)\n# The total energy budget for the farm is $8000.\nmodel.addCons(5 * A1 + 7 * A2 + 9 * A3 <= 8000)\n# The farm has a minimum yield requirement of 12000 kg.\nmodel.addCons(10 * A1 + 15 * A2 + 20 * A3 >= 12000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of G1: \", model.getVal(A1))\n    print(\"Area of G2: \", model.getVal(A2))\n    print(\"Area of G3: \", model.getVal(A3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1102,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed on flat roofs is 100.\n// Flat <= 100\n\n## Generate Constraint-4:\nThe maximum number of panels that can be installed on sloped roofs is 120.\n// Slope <= 120",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels and the cost of installation per panel vary based on the type of roof, as shown in the following Table.\n\n| Roof Type | Efficiency | Installation Cost per Panel |\n|-----------|------------|-----------------------------|\n| Flat      | 80%        | $1000                       |\n| Sloped    | 90%        | $1200                       |\n| Green     | 75%        | $800                        |\n\nThe company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The company has a budget of $150,000 for the installation. The maximum number of panels that can be installed on flat roofs is 100, and on sloped roofs is 120.\n\nPlease help the company determine the optimal number of solar panels to install on each type of roof to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0, ub=100) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0, ub=120) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0) # number of solar panels on green roofs\n\n# Define objective function\nCost = 1000 * Flat + 1200 * Slope + 800 * Green\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000) # The total energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000) # The company has a budget of $150,000 for the installation.\nmodel.addCons(Flat <= 100) # The maximum number of panels that can be installed on flat roofs is 100.\nmodel.addCons(Slope <= 120) # The maximum number of panels that can be installed on sloped roofs is 120.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company aims to maximize the net profit per unit of storage space used.\n// Net profit of A: Profit_A = (100 - 60) * A - 5 * A^2\n// Net profit of B: Profit_B = (150 - 90) * B - 10 * B^2\n// Net profit of C: Profit_C = (200 - 120) * C - 15 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A^2 + 10 * B^2 + 15 * C^2)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin. The selling price, production cost, and storage cost per unit for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Storage Cost per Unit |\n|--------|---------------|-----------------|-----------------------|\n| A      | $100          | $60             | $5                    |\n| B      | $150          | $90             | $10                   |\n| C      | $200          | $120            | $15                   |\n\nThe company aims to maximize the net profit per unit of storage space used. The company has a budget of $10,000 for production costs. Please help the company determine the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * A**2\nProfit_B = (150 - 90) * B - 10 * B**2\nProfit_C = (200 - 120) * C - 15 * C**2\nStorageCost = 5 * A**2 + 10 * B**2 + 15 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 855,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how much of a certain resource to allocate to each facility to optimize production efficiency.\n// {\"resource allocation for facility 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"resource allocation for facility 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"resource allocation for facility 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility's production efficiency is affected by the amount of resource allocated to it. The efficiency is modeled as a nonlinear function of the resource allocation. Specifically, the efficiency of facility 1 is given by E1 = R1^2 / (1 + R1), facility 2 by E2 = R2^2 / (1 + R2), and facility 3 by E3 = R3^2 / (1 + R3). The company aims to maximize the total efficiency of all facilities.\n// The objective function is: Maximize E = E1 + E2 + E3 = R1^2 / (1 + R1) + R2^2 / (1 + R2) + R3^2 / (1 + R3)\n\n## Generate Constraint-1:\nThe total amount of resource available for allocation is limited to 100 units.\n// R1 + R2 + R3 <= 100",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how much of a certain resource to allocate to each facility to optimize production efficiency. The efficiency of each facility is modeled as a nonlinear function of the resource allocation: for facility 1, efficiency E1 = R1^2 / (1 + R1); for facility 2, efficiency E2 = R2^2 / (1 + R2); and for facility 3, efficiency E3 = R3^2 / (1 + R3). The company aims to maximize the total efficiency of all facilities.\n\n| Facility | Efficiency Function |\n|----------|---------------------|\n| 1        | E1 = R1^2 / (1 + R1)|\n| 2        | E2 = R2^2 / (1 + R2)|\n| 3        | E3 = R3^2 / (1 + R3)|\n\nThe total amount of resource available for allocation is limited to 100 units. Please help the company determine the optimal allocation of resources (R1, R2, R3) to maximize the total efficiency of all facilities.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # resource allocation for facility 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # resource allocation for facility 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # resource allocation for facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nE1 = R1**2 / (1 + R1)\nE2 = R2**2 / (1 + R2)\nE3 = R3**2 / (1 + R3)\n## the objective function is: Maximize E = E1 + E2 + E3\nmodel.addCons(obj == E1 + E2 + E3)\n\n# Add constraints\n## The total amount of resource available for allocation is limited to 100 units.\nmodel.addCons(R1 + R2 + R3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Resource Allocation for Facility 1: \", model.getVal(R1))\n    print(\"Resource Allocation for Facility 2: \", model.getVal(R2))\n    print(\"Resource Allocation for Facility 3: \", model.getVal(R3))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of D1 is $30, D2 is $40, and D3 is $50. The production cost per unit of D1 is $10, D2 is $15, and D3 is $20. The manufacturer wants to maximize the total profit.\n// Profit_D1 = 30 * D1 - 10 * D1\n// Profit_D2 = 40 * D2 - 15 * D2\n// Profit_D3 = 50 * D3 - 20 * D3\n// So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget of $5000 for production costs.\n// 10 * D1 + 15 * D2 + 20 * D3 <= 5000",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints. The profit and production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| D1     | $30             | $10                      |\n| D2     | $40             | $15                      |\n| D3     | $50             | $20                      |\n\nThe manufacturer has a limited budget of $5000 for production costs. Please help the manufacturer to maximize the total profit by determining the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 30 * D1 - 10 * D1\nProfit_D2 = 40 * D2 - 15 * D2\nProfit_D3 = 50 * D3 - 20 * D3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited budget of $5000 for production costs.\nmodel.addCons(10 * D1 + 15 * D2 + 20 * D3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, the selling price is $100 per ton, and the water cost is $20 per ton. \nFor Crop B, the yield per acre is 7 tons, the selling price is $120 per ton, and the water cost is $25 per ton. \nFor Crop C, the yield per acre is 9 tons, the selling price is $150 per ton, and the water cost is $30 per ton.\nThe farm has limited water resources and aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n// Revenue of A: Revenue_A = 5 * A * (100 - 20)\n// Revenue of B: Revenue_B = 7 * B * (120 - 25)\n// Revenue of C: Revenue_C = 9 * C * (150 - 30)\n// Water cost of A: Water_cost_A = 5 * A * 20\n// Water cost of B: Water_cost_B = 7 * B * 25\n// Water cost of C: Water_cost_C = 9 * C * 30\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe total water cost must not exceed $2000.\n// 20 * A + 25 * B + 30 * C <= 2000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\nFor Crop A, the yield per acre is 5 tons, the selling price is $100 per ton, and the water cost is $20 per ton. \nFor Crop B, the yield per acre is 7 tons, the selling price is $120 per ton, and the water cost is $25 per ton. \nFor Crop C, the yield per acre is 9 tons, the selling price is $150 per ton, and the water cost is $30 per ton.\nThe farm has a total of 100 acres available for cultivation. The farmer wants to ensure at least 20 acres are dedicated to each crop. The total water cost must not exceed $2000.\nPlease help the farmer to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 5 * A * (100 - 20)\nRevenue_B = 7 * B * (120 - 25)\nRevenue_C = 9 * C * (150 - 30)\nWater_cost_A = 5 * A * 20\nWater_cost_B = 7 * B * 25\nWater_cost_C = 9 * C * 30\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_cost_A + Water_cost_B + Water_cost_C) == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total water cost must not exceed $2000.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n// Profit_A = (5 * 100 * A) - (200 * A)\n// Profit_B = (8 * 120 * B) - (300 * B)\n// Profit_C = (10 * 150 * C) - (400 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-4:\nThe market demand for Crop A is limited to 50 tons. Since each hectare of Crop A yields 5 tons, the maximum hectares of Crop A should not exceed 10.\n// A <= 10",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer has a total of 100 hectares available for cultivation. The farmer has a budget of $20,000 for labor costs. The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity. The market demand for Crop A is limited to 50 tons, which means the maximum hectares of Crop A should not exceed 10.\nPlease help the farmer to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=10) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 * A) - (200 * A)\nProfit_B = (8 * 120 * B) - (300 * B)\nProfit_C = (10 * 150 * C) - (400 * C)\nTotalHectares = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalHectares\n## convert the division to multiplication\nmodel.addCons(obj * TotalHectares == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials.\n// {\"quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, Product B is $150, and Product C is $200. The cost of Material1 per unit of Product A is $20, Material2 per unit of Product B is $30, and Material3 per unit of Product C is $40. The manufacturer wants to maximize the total profit, considering the cost of materials.\n// Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of Material1 available is 1000 units.\n// 20 * ProductA <= 1000\n\n## Generate Constraint-2:\nThe total amount of Material2 available is 1500 units.\n// 30 * ProductB <= 1500\n\n## Generate Constraint-3:\nThe total amount of Material3 available is 2000 units.\n// 40 * ProductC <= 2000\n\n## Generate Constraint-4:\nThe manufacturer has a budget constraint of $5000 for the total cost of materials.\n// 20 * ProductA + 30 * ProductB + 40 * ProductC <= 5000",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials. The profit per unit and the cost of materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Material per Unit |\n|---------|-----------------|---------------------------|\n| A       | $100            | $20                       |\n| B       | $150            | $30                       |\n| C       | $200            | $40                       |\n\nThe total amount of Material1 available is 1000 units, Material2 is 1500 units, and Material3 is 2000 units. The manufacturer has a budget constraint of $5000 for the total cost of materials. \n\nPlease help the manufacturer to maximize the total profit, considering the cost of materials and the constraints on material availability and budget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nProfit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of Material1 available is 1000 units.\nmodel.addCons(20 * ProductA <= 1000)\n## The total amount of Material2 available is 1500 units.\nmodel.addCons(30 * ProductB <= 1500)\n## The total amount of Material3 available is 2000 units.\nmodel.addCons(40 * ProductC <= 2000)\n## The manufacturer has a budget constraint of $5000 for the total cost of materials.\nmodel.addCons(20 * ProductA + 30 * ProductB + 40 * ProductC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\n// {\"production rate of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The objective is to maximize the total profit, which is the difference between the revenue and the cost.\n// The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n// The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n// The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\n// The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total production rate cannot exceed 200 units per day.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe market demand for product 1 is at least 50 units per day.\n// P1 >= 50",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand. The profit per unit for each product and the cost function for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost Function |\n|---------|-----------------|---------------|\n| 1       | $5              | 0.01 * P1^2 + 0.5 * P1 + 2 |\n| 2       | $10             | 0.02 * P2^2 + 0.8 * P2 + 3 |\n| 3       | $15             | 0.03 * P3^2 + 1.0 * P3 + 4 |\n\nThe total production rate cannot exceed 200 units per day. The market demand for product 1 is at least 50 units per day. Please help the company to maximize the total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of product 3\n\n# Define objective function\nC1 = 0.01 * P1**2 + 0.5 * P1 + 2\nC2 = 0.02 * P2**2 + 0.8 * P2 + 3\nC3 = 0.03 * P3**2 + 1.0 * P3 + 4\nProfit = 5 * P1 + 10 * P2 + 15 * P3 - (C1 + C2 + C3)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200) # total production rate cannot exceed 200 units per day\nmodel.addCons(P1 >= 50) # market demand for product 1 is at least 50 units per day\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of units to produce for each type of machine to optimize their profit.\n// {\"number of units of MachineA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, but it decreases by $10 for each unit produced beyond the first 100 units. The profit per unit of MachineB is $700, but it decreases by $15 for each unit produced beyond the first 50 units. The profit per unit of MachineC is $900, but it decreases by $20 for each unit produced beyond the first 20 units. The company wants to maximize the total profit.\n// Profit for MachineA: ProfitA = (500 - 10 * max(UnitsA - 100, 0)) * UnitsA\n// Profit for MachineB: ProfitB = (700 - 15 * max(UnitsB - 50, 0)) * UnitsB\n// Profit for MachineC: ProfitC = (900 - 20 * max(UnitsC - 20, 0)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units per month.\n// UnitsA + UnitsB + UnitsC <= 200\n\n## Generate Constraint-2:\nDue to limited resources, the production of MachineB cannot exceed half the production of MachineA.\n// UnitsB <= 0.5 * UnitsA\n\n## Generate Constraint-3:\nThe company must produce at least 30 units of MachineC to fulfill a contract.\n// UnitsC >= 30\n\n## Generate Constraint-4:\nThe total cost of production for all machines cannot exceed $100,000. The cost per unit for MachineA is $200, for MachineB is $300, and for MachineC is $400.\n// 200 * UnitsA + 300 * UnitsB + 400 * UnitsC <= 100,000",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of units to produce for each type of machine to optimize their profit. The profit per unit of MachineA is $500, but it decreases by $10 for each unit produced beyond the first 100 units. The profit per unit of MachineB is $700, but it decreases by $15 for each unit produced beyond the first 50 units. The profit per unit of MachineC is $900, but it decreases by $20 for each unit produced beyond the first 20 units. The company has a total production capacity of 200 units per month. Due to limited resources, the production of MachineB cannot exceed half the production of MachineA. The company must produce at least 30 units of MachineC to fulfill a contract. The total cost of production for all machines cannot exceed $100,000. The cost per unit for MachineA is $200, for MachineB is $300, and for MachineC is $400. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of MachineA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of MachineB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=30) # number of units of MachineC\n\n# Define objective function\n## create piecewise variables for piecewise function: ProfitA = (500 - 10 * max(UnitsA - 100, 0)) * UnitsA\nUnitsA1 = model.addVar(vtype=\"INTEGER\", name=\"UnitsA1\", lb=0, ub=100)\nUnitsA2 = model.addVar(vtype=\"INTEGER\", name=\"UnitsA2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == UnitsA1*A_b1 + UnitsA2*A_b2)\nProfitA = (500 - 10 * UnitsA2) * UnitsA2 * A_b2 + 500 * UnitsA1 * A_b1\n## create piecewise variables for piecewise function: ProfitB = (700 - 15 * max(UnitsB - 50, 0)) * UnitsB\nUnitsB1 = model.addVar(vtype=\"INTEGER\", name=\"UnitsB1\", lb=0, ub=50)\nUnitsB2 = model.addVar(vtype=\"INTEGER\", name=\"UnitsB2\", lb=50, ub=200)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(UnitsB == UnitsB1*B_b1 + UnitsB2*B_b2)\nProfitB = (700 - 15 * UnitsB2) * UnitsB2 * B_b2 + 700 * UnitsB1 * B_b1\n## create piecewise variables for piecewise function: ProfitC = (900 - 20 * max(UnitsC - 20, 0)) * UnitsC\nUnitsC1 = model.addVar(vtype=\"INTEGER\", name=\"UnitsC1\", lb=0, ub=20)\nUnitsC2 = model.addVar(vtype=\"INTEGER\", name=\"UnitsC2\", lb=20, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(UnitsC == UnitsC1*C_b1 + UnitsC2*C_b2)\nProfitC = (900 - 20 * UnitsC2) * UnitsC2 * C_b2 + 900 * UnitsC1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 200)\nmodel.addCons(UnitsB <= 0.5 * UnitsA)\nmodel.addCons(200 * UnitsA + 300 * UnitsB + 400 * UnitsC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(UnitsA))\n    print(\"Number of MachineB: \", model.getVal(UnitsB))\n    print(\"Number of MachineC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer aims to maximize the profit per unit of resource used (either water or labor). The objective is to maximize the ratio of total profit to the sum of water and labor used.\n// Profit from A: Profit_A = 300 * A\n// Profit from B: Profit_B = 400 * B\n// Profit from C: Profit_C = 500 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 10,000 liters of water available for irrigation.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farmer has a total of 500 hours of labor available.\n// 5 * A + 8 * B + 10 * C <= 500",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer has a total of 10,000 liters of water available for irrigation. The farmer also has a total of 500 hours of labor available.\nPlease help the farmer to maximize the profit per unit of resource used (either water or labor), which is defined as the ratio of total profit to the sum of water and labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 300 * A\nProfit_B = 400 * B\nProfit_C = 500 * C\nResourceUsage = 200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 10,000 liters of water available for irrigation.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farmer has a total of 500 hours of labor available.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Device A, Device B, and Device C. The company needs to decide the production quantities of each device to maximize profit while considering the cost of raw materials and production capacity.\n// {\"quantity of Device A\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device B\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device C\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Device A is $100, for Device B is $150, and for Device C is $200. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each device, the cost per unit decreases by $0.5 for every 100 units produced above 1000 units. The company aims to maximize the total profit from the sale of these devices.\n// Cost_DeviceA = max(100 - 0.5 * (DeviceA - 1000) / 100, 100) * DeviceA\n// Cost_DeviceB = max(150 - 0.5 * (DeviceB - 1000) / 100, 150) * DeviceB\n// Cost_DeviceC = max(200 - 0.5 * (DeviceC - 1000) / 100, 200) * DeviceC\n// So, the objective function is: Maximize (Cost_DeviceA + Cost_DeviceB + Cost_DeviceC)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in the production of all devices. Device A requires 2 units, Device B requires 3 units, and Device C requires 4 units of this component per device. The total available supply of this component is 5000 units.\n// 2 * DeviceA + 3 * DeviceB + 4 * DeviceC <= 5000\n\n## Generate Constraint-2:\nThe market demand for each device type imposes a limit on production. The maximum demand for Device A is 1500 units, for Device B is 2000 units, and for Device C is 2500 units.\n// DeviceA <= 1500; DeviceB <= 2000; DeviceC <= 2500\n\n## Generate Constraint-3:\nThe company has a total production capacity of 5000 units across all devices.\n// DeviceA + DeviceB + DeviceC <= 5000",
        "question": "A manufacturing company produces three types of electronic devices: Device A, Device B, and Device C. The company needs to decide the production quantities of each device to maximize profit while considering the cost of raw materials and production capacity. The profit per unit of Device A is $100, for Device B is $150, and for Device C is $200. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each device, the cost per unit decreases by $0.5 for every 100 units produced above 1000 units. The company has a limited supply of a critical component used in the production of all devices. Device A requires 2 units, Device B requires 3 units, and Device C requires 4 units of this component per device. The total available supply of this component is 5000 units. The market demand for each device type imposes a limit on production. The maximum demand for Device A is 1500 units, for Device B is 2000 units, and for Device C is 2500 units. The company has a total production capacity of 5000 units across all devices. Please help the company to maximize the total profit from the sale of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0, ub=1500) # quantity of Device A\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0, ub=2000) # quantity of Device B\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0, ub=2500) # quantity of Device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_DeviceA = max(100 - 0.5 * (DeviceA - 1000) / 100, 100) * DeviceA\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=1000)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=1000, ub=1500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceA == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nCost_DeviceA = 100 * DeviceA1 * DeviceA_b1 + (100 - 0.5 * (DeviceA2 - 1000) / 100) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Cost_DeviceB = max(150 - 0.5 * (DeviceB - 1000) / 100, 150) * DeviceB\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=1000)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=1000, ub=2000)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceB == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nCost_DeviceB = 150 * DeviceB1 * DeviceB_b1 + (150 - 0.5 * (DeviceB2 - 1000) / 100) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Cost_DeviceC = max(200 - 0.5 * (DeviceC - 1000) / 100, 200) * DeviceC\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=1000)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=1000, ub=2500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceC == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nCost_DeviceC = 200 * DeviceC1 * DeviceC_b1 + (200 - 0.5 * (DeviceC2 - 1000) / 100) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Cost_DeviceA + Cost_DeviceB + Cost_DeviceC)\nmodel.addCons(obj == Cost_DeviceA + Cost_DeviceB + Cost_DeviceC)\n\n# Add constraints\nmodel.addCons(2 * DeviceA + 3 * DeviceB + 4 * DeviceC <= 5000)\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(DeviceA))\n    print(\"Quantity of Device B: \", model.getVal(DeviceB))\n    print(\"Quantity of Device C: \", model.getVal(DeviceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1164,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25\n\n## Generate Constraint-3:\nTo ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n// TruckB >= 0.5 * TruckA\n\n## Generate Constraint-4:\nThe company wants to ensure that each warehouse has at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1\n\n## Generate Constraint-5:\nThe total daily operational budget for fuel is $20,000.\n// 5 * 100 * TruckA + 6 * 100 * TruckB + 7 * 100 * TruckC <= 20,000",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. Each truck is estimated to travel an average of 100 kilometers per day.\n\n| Warehouse | Fuel Consumption Rate (liters/km) |\n|-----------|-----------------------------------|\n| A         | 5                                 |\n| B         | 6                                 |\n| C         | 7                                 |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A. The company wants to ensure that each warehouse has at least one truck assigned. The total daily operational budget for fuel is $20,000.\n\nPlease help the company to minimize the total fuel consumption of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that each warehouse has at least one truck assigned.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1) # number of trucks for Warehouse C\n\n# Define objective function\n## The company aims to minimize the total fuel consumption of all trucks.\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n## So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n## To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\nmodel.addCons(TruckB >= 0.5 * TruckA)\n## The total daily operational budget for fuel is $20,000.\nmodel.addCons(5 * 100 * TruckA + 6 * 100 * TruckB + 7 * 100 * TruckC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1224,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. \nFor S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. \nFor S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300.\nThe manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n// Net_Revenue_S1 = (100 * S1 - 60 * S1) / 200\n// Net_Revenue_S2 = (120 * S2 - 70 * S2) / 250\n// Net_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n// So, the objective function is: Maximize (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $10,000 for production costs.\n// 60 * S1 + 70 * S2 + 90 * S3 <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\n// S1 + S2 + S3 <= 150\n\n## Generate Constraint-3:\nThe market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\n// S1 <= 50\n\n## Generate Constraint-4:\nThe energy efficiency of the total production should not exceed 30,000 kWh per year.\n// 200 * S1 + 250 * S2 + 300 * S3 <= 30000",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce. For S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. For S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. For S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300. The manufacturer has a limited production budget of $10,000 for production costs. The manufacturer has a production capacity of 150 units in terms of the number of units it can produce. The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1. The energy efficiency of the total production should not exceed 30,000 kWh per year. Please help the manufacturer to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)  # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0)  # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0)  # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_S1 = (100 * S1 - 60 * S1) / 200\nNet_Revenue_S2 = (120 * S2 - 70 * S2) / 250\nNet_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n## convert the division to multiplication\nmodel.addCons(obj * (200 * S1 + 250 * S2 + 300 * S3) == (100 * S1 - 60 * S1) * (250 * S2 + 300 * S3) + (120 * S2 - 70 * S2) * (300 * S3) + (150 * S3 - 90 * S3) * (200 * S1 + 250 * S2))\n\n# Add constraints\n## The manufacturer has a limited production budget of $10,000 for production costs.\nmodel.addCons(60 * S1 + 70 * S2 + 90 * S3 <= 10000)\n## The manufacturer has a production capacity of 150 units in terms of the number of units it can produce.\nmodel.addCons(S1 + S2 + S3 <= 150)\n## The market demand for S1 is 50 units. So, the manufacturer can only sell a maximum of 50 units of S1.\nmodel.addCons(S1 <= 50)\n## The energy efficiency of the total production should not exceed 30,000 kWh per year.\nmodel.addCons(200 * S1 + 250 * S2 + 300 * S3 <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Net Revenue per Unit of Energy Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit.\nThe profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit.\nThe profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit.\nThe company wants to maximize its net profit, which is the total profit minus the total cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = 10A + 5B + 3C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10A + 5B + 3C <= 5000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 100 units across all products.\n// A + B + C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $10                      |\n| B       | $70             | $5                       |\n| C       | $90             | $3                       |\n\nThe company has a budget of $5000 for production costs. The total production capacity is limited to 100 units across all products. The company wants to maximize its net profit, which is the total profit minus the total cost.\n\nPlease help the company determine the optimal number of units to produce for each product A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * A + 5 * B + 3 * C\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 5 * B + 3 * C <= 5000)\n## The total production capacity is limited to 100 units across all products.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n// Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n// Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n// Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least half as many trucks as RouteB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a maintenance budget that limits the total operational cost to $150,000.\n// (2000 + 0.1 * (TrucksA^2)) * TrucksA + (3000 + 0.15 * (TrucksB^2)) * TrucksB + (4000 + 0.2 * (TrucksC^2)) * TrucksC <= 150,000\n\n## Generate Constraint-4:\nTo ensure service quality, each route must have at least one truck.\n// TrucksA >= 1; TrucksB >= 1; TrucksC >= 1",
        "question": "A logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations. The company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, RouteA must have at least half as many trucks as RouteB. The company has a maintenance budget that limits the total operational cost to $150,000. To ensure service quality, each route must have at least one truck.\n\nPlease help the company to maximize the total profit from all routes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=1)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=1)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=1)  # number of trucks on RouteC\n\n# Define objective function\n## Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n## Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n## Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (5000 - (2000 + 0.1 * TrucksA**2)) * TrucksA\nProfitB = (7000 - (3000 + 0.15 * TrucksB**2)) * TrucksB\nProfitC = (9000 - (4000 + 0.2 * TrucksC**2)) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## Due to contractual agreements, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n## The company has a maintenance budget that limits the total operational cost to $150,000.\nmodel.addCons((2000 + 0.1 * TrucksA**2) * TrucksA + (3000 + 0.15 * TrucksB**2) * TrucksB + (4000 + 0.2 * TrucksC**2) * TrucksC <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer wants to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).\n// Profit of A: Profit_A = (50 - 100 / A) * A\n// Profit of B: Profit_B = (70 - 150 / B) * B\n// Profit of C: Profit_C = (90 - 200 / C) * C\n// Storage cost: Storage = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production setup costs.\n// 100 * A + 150 * B + 200 * C <= 10000",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations. The profit per unit, storage cost per unit, and production setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit | Production Setup Cost |\n|---------|-----------------|-----------------------|-----------------------|\n| A       | $50             | $5                    | $100                  |\n| B       | $70             | $7                    | $150                  |\n| C       | $90             | $9                    | $200                  |\n\nThe manufacturer wants to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs). The manufacturer has a budget of $10,000 for production setup costs.\nPlease help the manufacturer determine the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 100 / A) * A\nProfit_B = (70 - 150 / B) * B\nProfit_C = (90 - 200 / C) * C\nStorage = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n## convert the division to multiplication\nmodel.addCons(obj * Storage == Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C))\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands.\n// The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n// The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n// The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production unit can be staffed by up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nThe production of component A must not exceed 1200 units.\n// 10 * W1 + 12 * W2 + 14 * W3 <= 1200",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit. The productivity of each worker in each production unit is given in the following Table.\n\n| Production Unit | Component A | Component B | Component C |\n|-----------------|-------------|-------------|-------------|\n| 1               | 10 units/hr | 15 units/hr | 20 units/hr |\n| 2               | 12 units/hr | 18 units/hr | 22 units/hr |\n| 3               | 14 units/hr | 20 units/hr | 24 units/hr |\n\nThe company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands. There are a total of 50 workers available. Each production unit can be staffed by up to 20 workers. The production of component A must not exceed 1200 units.\n\nPlease help the company to minimize the maximum of the production times for each component (A, B, and C).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n## The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n## The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * W1 + 12 * W2 + 14 * W3) == 1000)\nmodel.addCons(T2 * (15 * W1 + 18 * W2 + 20 * W3) == 1500)\nmodel.addCons(T3 * (20 * W1 + 22 * W2 + 24 * W3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n## Each production unit can be staffed by up to 20 workers.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n## The production of component A must not exceed 1200 units.\nmodel.addCons(10 * W1 + 12 * W2 + 14 * W3 <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(W3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * P1 = 20 * P1\n// Profit_P2 = (40 - 15) * P2 = 25 * P2\n// Profit_P3 = (50 - 20) * P3 = 30 * P3\n// So, the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\n\n## Generate Constraint-1:\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\n// P1 <= 40; P2 <= 30; P3 <= 50\n\n## Generate Constraint-3:\nThe market demand for P1 is at least 10 units, and the plant must meet this demand.\n// P1 >= 10\n\n## Generate Constraint-4:\nThe plant must produce at least twice as many units of P2 as P1 to maintain a balanced product line.\n// P2 >= 2 * P1",
        "question": "A manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50, with production costs of $10, $15, and $20 per unit respectively. The plant has a limited raw material supply, which allows for a maximum production of 100 units in total. The plant has specific production capacities: 40 units for P1, 30 units for P2, and 50 units for P3. The market demand for P1 is at least 10 units, and the plant must meet this demand. Additionally, the plant must produce at least twice as many units of P2 as P1 to maintain a balanced product line. Please help the plant to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nProfit_P1 = 20 * P1\nProfit_P2 = 25 * P2\nProfit_P3 = 30 * P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 50)\n## The market demand for P1 is at least 10 units, and the plant must meet this demand.\nmodel.addCons(P1 >= 10)\n## The plant must produce at least twice as many units of P2 as P1 to maintain a balanced product line.\nmodel.addCons(P2 >= 2 * P1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer aims to maximize the profit per hour of production time.\n// Profit_A = (30 - 10) * A\n// Profit_B = (40 - 15) * B\n// Profit_C = (50 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time limit of 150 hours.\n// A + 2 * B + 3 * C <= 150\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 3000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units.\n// A >= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that the production of Product B does not exceed twice the production of Product A.\n// B <= 2 * A",
        "question": "A manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations. The revenue per unit, production cost per unit, and production time per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|------------------|--------------------------|--------------------------|\n| A       | $30              | $10                      | 1 hour                   |\n| B       | $40              | $15                      | 2 hours                  |\n| C       | $50              | $20                      | 3 hours                  |\n\nThe manufacturer has a total production time limit of 150 hours. The manufacturer has a budget of $3000 for production costs. The market demand for Product A is at least 50 units. The manufacturer wants to ensure that the production of Product B does not exceed twice the production of Product A. \nPlease help the manufacturer to maximize the profit per hour of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a total production time limit of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 150)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 3000)\n## The market demand for Product A is at least 50 units.\nmodel.addCons(A >= 50)\n## The manufacturer wants to ensure that the production of Product B does not exceed twice the production of Product A.\nmodel.addCons(B <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n\n| Chemical | Profit per Unit | Additional Profit per Unit Beyond Threshold | Threshold |\n|----------|-----------------|--------------------------------------------|-----------|\n| A        | 10$             | 0.02$ per 10 units                         | 100 units  |\n| B        | 15$             | 0.03$ per 15 units                         | 150 units  |\n| C        | 20$             | 0.01$ per 20 units                         | 200 units  |\n\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n\nPlease help the company determine the optimal quantities of chemicals A, B, and C to maximize their total profit while ensuring that the total raw material usage does not exceed 1000 kg.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1509,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of each drug is modeled as follows:\n\n| Drug    | Effectiveness Model                          |\n|---------|----------------------------------------------|\n| DrugA   | EffectivenessA = 50 * DosageA - 0.5 * DosageA^2 |\n| DrugB   | EffectivenessB = 60 * DosageB - 0.3 * DosageB^3 |\n| DrugC   | EffectivenessC = 70 * DosageC - 0.2 * DosageC^4 |\n\nThe company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB. The dosage levels for each drug must be between 0 and 100 units.\n\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to maximize the total effectiveness while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\nmodel.addCons(DosageA >= 2 * DosageB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25\n\n## Generate Constraint-3:\nTo ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n// TruckB >= 0.5 * TruckA",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n\n| Warehouse | Fuel Consumption Rate (liters/km) |\n|-----------|-----------------------------------|\n| A         | 5                                 |\n| B         | 6                                 |\n| C         | 7                                 |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n\nPlease help the company to minimize the total fuel consumption of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Warehouse C\n\n# Define objective function\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n# So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n# To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\nmodel.addCons(TruckB >= 0.5 * TruckA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000\n\n## Generate Constraint-2:\nThe company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units.\n// S + T + L <= 500",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500. Additionally, the company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize total profit, subject to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## The profit from each device varies nonlinearly with the quantity produced\nP_S = 500 * S - 0.1 * S**2\nP_T = 600 * T - 0.15 * T**2\nP_L = 800 * L - 0.2 * L**2\nP_total = P_S + P_T + P_L\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $100,000\nmodel.addCons(200 * S + 300 * T + 500 * L <= 100000)\n## The company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units\nmodel.addCons(S + T + L <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 965,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor.\n// 10 * A + 15 * B + 20 * C <= 5000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 200 units across all products.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company has a budget of $10,000 for raw materials and $5,000 for labor. The total production capacity is limited to 200 units across all products.\nPlease help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n## Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n## Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n## So, the objective function is: Maximize (PA + PB + PC)\nPA = 50 * A - (20 * A + 10 * A)\nPB = 70 * B - (30 * B + 15 * B)\nPC = 90 * C - (40 * C + 20 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a budget of $5,000 for labor.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 5000)\n## The total production capacity is limited to 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A sells for $100, costs $60 to produce, and requires 1.5 hours of labor. \nEach device B sells for $150, costs $80 to produce, and requires 2 hours of labor. \nEach device C sells for $200, costs $100 to produce, and requires 2.5 hours of labor.\nThe company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = (100 - 60) * A = 40 * A\n// Profit of B: Profit_B = (150 - 80) * B = 70 * B\n// Profit of C: Profit_C = (200 - 100) * C = 100 * C\n// Total labor hours: L = 1.5 * A + 2 * B + 2.5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / L = (40 * A + 70 * B + 100 * C) / (1.5 * A + 2 * B + 2.5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs next month.\n// 60 * A + 80 * B + 100 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device next month.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources. Each device A sells for $100, costs $60 to produce, and requires 1.5 hours of labor. Each device B sells for $150, costs $80 to produce, and requires 2 hours of labor. Each device C sells for $200, costs $100 to produce, and requires 2.5 hours of labor. The company has a budget of $10,000 for production costs next month. The company wants to produce at least 50 units of each device next month. The company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours. Please help the company determine the optimal number of units of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 40 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nLaborHours = 1.5 * A + 2 * B + 2.5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs next month.\nmodel.addCons(60 * A + 80 * B + 100 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to optimize their profit.\n// {\"quantity of Chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chemical A, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor Chemical B, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nFor Chemical C, the revenue per unit is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit of storage space used.\n// NetProfit_A = (100 - 50 - 10) * A\n// NetProfit_B = (150 - 70 - 15) * B\n// NetProfit_C = (200 - 100 - 20) * C\n// So, the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) / (10 * A + 15 * B + 20 * C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. They need to determine the production quantities of each chemical to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each chemical are given in the following Table.\n\n| Chemical | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|----------|------------------|--------------------------|-----------------------|\n| A        | $100             | $50                      | $10                   |\n| B        | $150             | $70                      | $15                   |\n| C        | $200             | $100                     | $20                   |\n\nThe company wants to maximize the net profit per unit of storage space used. The company has a total production capacity of 200 units across all chemicals.\nPlease help the company determine the optimal production quantities for each chemical.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chemical C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_A = (100 - 50 - 10) * A\nNetProfit_B = (150 - 70 - 15) * B\nNetProfit_C = (200 - 100 - 20) * C\nStorageCost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (NetProfit_A + NetProfit_B + NetProfit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == NetProfit_A + NetProfit_B + NetProfit_C)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe production capacity for Product A is limited to 100 units.\n// ProductA <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product B.\n// ProductB >= 50\n\n## Generate Constraint-4:\nThe total production of all products must not exceed 200 units.\n// ProductA + ProductB + ProductC <= 200",
        "question": "A company is planning to optimize its production of three different products: Product A, Product B, and Product C. The profit per unit and the required units of raw material for each product are given in the following Table.\n\n| Product | Profit per Unit | Units of Raw Material Required |\n|---------|-----------------|--------------------------------|\n| A       | $50             | 2                              |\n| B       | $70             | 3                              |\n| C       | $100            | 5                              |\n\nThe company has a budget of $5000 for raw materials. The production capacity for Product A is limited to 100 units. The company must produce at least 50 units of Product B. The total production of all products must not exceed 200 units.\n\nPlease help the company to maximize the total profit while considering the cost of raw materials by determining the optimal amounts of Product A, Product B, and Product C to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n## The production capacity for Product A is limited to 100 units.\nmodel.addCons(ProductA <= 100)\n## The company must produce at least 50 units of Product B.\nmodel.addCons(ProductB >= 50)\n## The total production of all products must not exceed 200 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit after Raw Material Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 962,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\n// A <= 50; B <= 60\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\n// C - (A + B) <= 20",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. For Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices. The company has a budget constraint of $1000 for the total production costs. The company has a production capacity constraint of 50 units for Device A and 60 units for Device B. The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units. Please help the company to maximize the total profit from selling the devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50)  # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=60)  # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)  # quantity of device C\n\n# Define objective function\n# For Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2).\nProfit_A = 20 * A - 0.01 * A**2\n# For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B).\nProfit_B = 30 * B - 2 * B\n# For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C).\nProfit_C = 40 * C - (50 - 0.5 * C)\n# So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A**2 + 2 * B + (50 - 0.5 * C) <= 1000)\n# The company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 60)\n# The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\nmodel.addCons(C - (A + B) <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n// Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n// Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total advertising budget for all products cannot exceed $100,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 5000 units for each product.\n// ProdA <= 5000; ProdB <= 5000; ProdC <= 5000\n\n## Generate Constraint-3:\nDue to market research, the company knows that ProductA must have at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company wants to ensure that each product has at least 1000 units produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000\n\n## Generate Constraint-5:\nThe advertising budget for each product must be at least $5000.\n// AdBudgetA >= 5000; AdBudgetB >= 5000; AdBudgetC >= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit. The profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company has a total advertising budget of $100,000 for all products. The company has a production capacity of 5000 units for each product. ProductA must have at least twice the production of ProductB. Each product must have at least 1000 units produced. The advertising budget for each product must be at least $5000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=5000) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=5000) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=5000) # advertising budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n## Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n## Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 + 0.0005 * AdBudgetA) * ProdA\nProfit_B = (70 + 0.0007 * AdBudgetB) * ProdB\nProfit_C = (90 + 0.0009 * AdBudgetC) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total advertising budget for all products cannot exceed $100,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 100000)\n## The company has a production capacity of 5000 units for each product.\nmodel.addCons(ProdA <= 5000)\nmodel.addCons(ProdB <= 5000)\nmodel.addCons(ProdC <= 5000)\n## Due to market research, the company knows that ProductA must have at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n## The company wants to ensure that each product has at least 1000 units produced.\nmodel.addCons(ProdA >= 1000)\nmodel.addCons(ProdB >= 1000)\nmodel.addCons(ProdC >= 1000)\n## The advertising budget for each product must be at least $5000.\nmodel.addCons(AdBudgetA >= 5000)\nmodel.addCons(AdBudgetB >= 5000)\nmodel.addCons(AdBudgetC >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $10, product B is $15, and product C is $20. The revenue generated from selling each unit of product A is $20, product B is $30, and product C is $40. The plant has a limited production capacity and aims to maximize the profit-to-production cost ratio.\n// Cost of A: Cost_A = 10 * A\n// Cost of B: Cost_B = 15 * B\n// Cost of C: Cost_C = 20 * C\n// Revenue of A: Rev_A = 20 * A\n// Revenue of B: Rev_B = 30 * B\n// Revenue of C: Rev_C = 40 * C\n// Profit of A: Profit_A = Rev_A - Cost_A\n// Profit of B: Profit_B = Rev_B - Cost_B\n// Profit of C: Profit_C = Rev_C - Cost_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe plant must produce at least 500 units of product A, 300 units of product B, and 200 units of product C.\n// A >= 500; B >= 300; C >= 200\n\n## Generate Constraint-3:\nThe total production capacity is limited to 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. The cost of producing each unit, the revenue generated from selling each unit, and the production time for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit | Production Time per Unit |\n|---------|---------------|------------------|--------------------------|\n| A       | $10           | $20              | 2 hours                  |\n| B       | $15           | $30              | 3 hours                  |\n| C       | $20           | $40              | 4 hours                  |\n\nThe plant has a budget of $10,000 for production costs. The plant must produce at least 500 units of product A, 300 units of product B, and 200 units of product C. The total production capacity is limited to 1000 hours. \n\nPlease help the plant to maximize the profit-to-production cost ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=200) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nRev_A = 20 * A\nRev_B = 30 * B\nRev_C = 40 * C\nProfit_A = Rev_A - Cost_A\nProfit_B = Rev_B - Cost_B\nProfit_C = Rev_C - Cost_C\nTotalCost = Cost_A + Cost_B + Cost_C\nTotalProfit = Profit_A + Profit_B + Profit_C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cost_A + Cost_B + Cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == TotalProfit)\n\n# Add constraints\n## The plant has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The total production capacity is limited to 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\n// {\"number of pastries A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of pastries B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of pastries C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n// Profit from A: Profit_A = (2 - 0.5) * A\n// Profit from B: Profit_B = (3 - 1) * B\n// Profit from C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (15 * A + 20 * B + 25 * C)\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients.\n// 0.5 * A + 1 * B + 1.5 * C <= 100",
        "question": "A bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit. The selling price, cost to make, and baking time for each pastry are given in the following Table.\n\n| Pastry | Selling Price | Cost to Make | Baking Time |\n|--------|---------------|--------------|-------------|\n| A      | $2            | $0.5         | 15 minutes  |\n| B      | $3            | $1           | 20 minutes  |\n| C      | $4            | $1.5         | 25 minutes  |\n\nThe bakery has a daily budget of $100 for ingredients. The bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time. Please help the bakery determine the optimal number of each pastry to bake daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of pastries A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of pastries B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of pastries C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nBakingTime = 15 * A + 20 * B + 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(A))\n    print(\"Number of Pastry B: \", model.getVal(B))\n    print(\"Number of Pastry C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. The yield per acre, price per ton, and cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Price per Ton | Cost per Acre |\n|------|----------------|---------------|---------------|\n| C1   | 5 tons         | $100          | $50           |\n| C2   | 6 tons         | $120          | $60           |\n| C3   | 7 tons         | $140          | $70           |\n\nThe farmer wants to maximize the net profit per acre. The farmer has a total of 100 acres available for cultivation. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\nThe farmer has a total of 100 acres available for planting.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n## the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\nmodel.addCons(obj == (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans))\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n// Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n// Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n// Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\n// Q1 + Q2 + Q3 <= 1000\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 800 units.\n// Q1 + Q2 + Q3 <= 800\n\n## Generate Constraint-3:\nThe market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\n// Q2 >= 2 * Q1\n\n## Generate Constraint-5:\nThe plant must produce at least 10 units of C3 to fulfill a contractual obligation.\n// Q3 >= 10",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity. The profit per unit and the cost function for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Cost Function          |\n|----------|-----------------|------------------------|\n| C1       | $100            | 50 + 0.1 * Q1^2       |\n| C2       | $150            | 75 + 0.15 * Q2^2      |\n| C3       | $200            | 100 + 0.2 * Q3^2      |\n\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals. The storage capacity of the plant is limited to 800 units. The market demand for C1 is 50 units, and the plant can only sell a maximum of 50 units of C1. The plant has a safety regulation that requires the production of C2 to be at least twice the production of C1. Additionally, the plant must produce at least 10 units of C3 to fulfill a contractual obligation.\n\nPlease help the plant to maximize total profit by determining the optimal production quantities of C1, C2, and C3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=50)  # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0)  # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=10)  # quantity of C3\n\n# Define objective function\n# Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n# Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n# Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n# So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nProfit_C1 = 100 * Q1 - 50 - 0.1 * Q1**2\nProfit_C2 = 150 * Q2 - 75 - 0.15 * Q2**2\nProfit_C3 = 200 * Q3 - 100 - 0.2 * Q3**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\nmodel.addCons(Q1 + Q2 + Q3 <= 1000)  # Raw material constraint\nmodel.addCons(Q1 + Q2 + Q3 <= 800)  # Storage capacity constraint\nmodel.addCons(Q2 >= 2 * Q1)  # Safety regulation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements.\n// A + B + C >= 200",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25. The company must produce at least 200 units in total to meet the minimum order requirements. Please help the company to maximize the total profit from selling these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\nProfit = 50 * A + 70 * B + 60 * C\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements.\nmodel.addCons(A + B + C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 591,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit.\n// {\"production rate of machine 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different product with varying profit margins. \nMachine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. \nMachine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. \nMachine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit.\nThe plant aims to maximize the total daily profit from all three products.\n// The daily profit from machine 1: D1 = 10 * P1 * 5\n// The daily profit from machine 2: D2 = 15 * P2 * 7\n// The daily profit from machine 3: D3 = 20 * P3 * 6\n// So, the objective function is: Maximize (D1 + D2 + D3)\n\n## Generate Constraint-1:\nThe total daily production time for all machines is limited to 8 hours.\n// P1 + P2 + P3 <= 8",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit. The profit per unit and production rate for each machine are given in the following Table.\n\n| Machine | Product | Production Rate (units/hour) | Profit per Unit ($) |\n|---------|---------|-------------------------------|---------------------|\n| 1       | A       | 10                            | 5                   |\n| 2       | B       | 15                            | 7                   |\n| 3       | C       | 20                            | 6                   |\n\nThe plant aims to maximize the total daily profit from all three products. The total daily production time for all machines is limited to 8 hours. Please help the manager determine the optimal production rates for each machine to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of machine 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of machine 3\n\n# Define objective function\nD1 = 10 * P1 * 5\nD2 = 15 * P2 * 7\nD3 = 20 * P3 * 6\n# So, the objective function is: Maximize (D1 + D2 + D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == D1 + D2 + D3)\n\n# Add constraints\n# The total daily production time for all machines is limited to 8 hours.\nmodel.addCons(P1 + P2 + P3 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of Machine 1: \", model.getVal(P1))\n    print(\"Production rate of Machine 2: \", model.getVal(P2))\n    print(\"Production rate of Machine 3: \", model.getVal(P3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\n// A <= 50; B <= 60",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\nThe company has a budget constraint of $1000 for the total production costs. The company also has a production capacity constraint of 50 units for Device A and 60 units for Device B.\nPlease help the company to maximize the total profit from selling the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=60) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = 20 * A - 0.01 * A^2\n## convert the quadratic term to a linear term by introducing a new variable\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nmodel.addCons(A_sq == A * A)\nProfit_A = 20 * A - 0.01 * A_sq\n## Profit_B = 30 * B - 2 * B\nProfit_B = 30 * B - 2 * B\n## Profit_C = 40 * C - (50 - 0.5 * C)\nProfit_C = 40 * C - (50 - 0.5 * C)\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A_sq + 2 * B + (50 - 0.5 * C) <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs.\n// {\"hours facility 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours facility 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours facility 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility has a different cost per hour and efficiency in producing the chemical. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The objective is to minimize the total cost of operation while meeting the production target.\n// The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\n// The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total operating hours for all facilities combined must not exceed 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nEach facility can operate for a maximum of 20 hours.\n// H1 <= 20; H2 <= 20; H3 <= 20",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs. The cost per hour and the production efficiency for each facility are given in the following Table.\n\n| Facility | Cost per Hour | Units Produced per Hour |\n|----------|---------------|-------------------------|\n| 1        | $100          | 50                      |\n| 2        | $120          | 60                      |\n| 3        | $150          | 70                      |\n\nThe company needs to produce at least 3000 units of the chemical. The total operating hours for all facilities combined must not exceed 40 hours. Each facility can operate for a maximum of 20 hours. Please help the company to minimize the total cost of operation while meeting the production target.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours facility 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours facility 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours facility 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\nmodel.addCons(obj == 100 * H1 + 120 * H2 + 150 * H3)\n\n# Add constraints\n## The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n## The company needs to produce at least 3000 units of the chemical.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 >= 3000)\n## The total operating hours for all facilities combined must not exceed 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## Each facility can operate for a maximum of 20 hours.\nmodel.addCons(H1 <= 20)\nmodel.addCons(H2 <= 20)\nmodel.addCons(H3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 Operates: \", model.getVal(H1))\n    print(\"Hours Facility 2 Operates: \", model.getVal(H2))\n    print(\"Hours Facility 3 Operates: \", model.getVal(H3))\n    print(\"Total Cost of Operation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering the constraints of raw material availability and market demand.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100), 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical raw material. Product A requires 5 kg per unit, Product B requires 8 kg per unit, and Product C requires 10 kg per unit. The total available raw material is 2000 kg.\n// 5 * A + 8 * B + 10 * C <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 400 units. For Product C, the demand limit is 500 units.\n// A <= 300; B <= 400; C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize its profit while considering the constraints of raw material availability and market demand. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each product type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sale of these products.\n\n| Product | Profit per Unit | Raw Material per Unit | Market Demand Limit |\n|---------|-----------------|------------------------|---------------------|\n| A       | $10             | 5 kg                   | 300 units           |\n| B       | $15             | 8 kg                   | 400 units           |\n| C       | $20             | 10 kg                  | 500 units           |\n\nThe company has a limited supply of a critical raw material. Product A requires 5 kg per unit, Product B requires 8 kg per unit, and Product C requires 10 kg per unit. The total available raw material is 2000 kg. The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 400 units. For Product C, the demand limit is 500 units.\n\nPlease help the company to maximize the total profit from the sale of these products while adhering to the constraints of raw material availability and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 400 units. For Product C, the demand limit is 500 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=500) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of a critical raw material. Product A requires 5 kg per unit, Product B requires 8 kg per unit, and Product C requires 10 kg per unit. The total available raw material is 2000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1505,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor, machinery, and raw materials) to maximize profit.\n// {\"labor allocation for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"machinery allocation for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"raw materials allocation for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product depends on the allocated resources. Product 1 generates a profit of 10L1 + 5M1 - 2R1 per unit. The company aims to maximize the total profit from Product 1.\n// The objective function is: Maximize P1 = 10L1 + 5M1 - 2R1\n\n## Generate Constraint-1:\nThe total labor available is 100 hours.\n// L1 <= 100\n\n## Generate Constraint-2:\nThe total machinery available is 50 units.\n// M1 <= 50\n\n## Generate Constraint-3:\nThe total raw materials available is 200 units.\n// R1 <= 200\n\n## Generate Constraint-4:\nThe production process for Product 1 is subject to a nonlinear efficiency factor that decreases as more resources are allocated. The efficiency factor is given by E1 = 1 / (1 + L1^2 + M1^2 + R1^2). The company must ensure that the efficiency does not drop below 0.5.\n// 1 / (1 + L1^2 + M1^2 + R1^2) >= 0.5",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor, machinery, and raw materials) to maximize profit for Product 1. The profit from each product depends on the allocated resources, with Product 1 generating a profit of 10L1 + 5M1 - 2R1 per unit.\n\nThe company has the following constraints:\n- The total labor available is 100 hours.\n- The total machinery available is 50 units.\n- The total raw materials available is 200 units.\n- The production process for Product 1 is subject to a nonlinear efficiency factor that decreases as more resources are allocated. The efficiency factor is given by E1 = 1 / (1 + L1^2 + M1^2 + R1^2). The company must ensure that the efficiency does not drop below 0.5.\n\nPlease help the company to maximize the total profit from Product 1, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0) # labor allocation for product 1\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # machinery allocation for product 1\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0) # raw materials allocation for product 1\n\n# Define objective function\nP1 = model.addVar('P1') # profit from Product 1\nmodel.setObjective(P1, \"maximize\")\nmodel.addCons(P1 == 10*L1 + 5*M1 - 2*R1) # objective function: Maximize P1 = 10L1 + 5M1 - 2R1\n\n# Add constraints\n## The total labor available is 100 hours.\nmodel.addCons(L1 <= 100)\n## The total machinery available is 50 units.\nmodel.addCons(M1 <= 50)\n## The total raw materials available is 200 units.\nmodel.addCons(R1 <= 200)\n## The production process for Product 1 is subject to a nonlinear efficiency factor.\n## The efficiency factor is given by E1 = 1 / (1 + L1^2 + M1^2 + R1^2). The company must ensure that the efficiency does not drop below 0.5.\nmodel.addCons(1 / (1 + L1**2 + M1**2 + R1**2) >= 0.5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Allocation for Product 1: \", model.getVal(L1))\n    print(\"Machinery Allocation for Product 1: \", model.getVal(M1))\n    print(\"Raw Materials Allocation for Product 1: \", model.getVal(R1))\n    print(\"Maximized Profit for Product 1: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the cost of irrigation per acre is $100 for crop A, $150 for crop B, and $200 for crop C. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The water usage per acre is 5 units for crop A, 7 units for crop B, and 9 units for crop C.\n// Profit of crop A: Profit_A = (500 - 100) * A\n// Profit of crop B: Profit_B = (700 - 150) * B\n// Profit of crop C: Profit_C = (900 - 200) * C\n// Total water used: Water_used = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and the cost of irrigation per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost of Irrigation per Acre | Water Usage per Acre |\n|------|-----------------|-----------------------------|----------------------|\n| A    | $500            | $100                        | 5 units              |\n| B    | $700            | $150                        | 7 units              |\n| C    | $900            | $200                        | 9 units              |\n\nThe farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The total available land for cultivation is 100 acres. Please help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * A\nProfit_B = (700 - 150) * B\nProfit_C = (900 - 200) * C\nWater_used = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production cost per unit is $60. For P2, the profit per unit is $120, and the production cost per unit is $70. The new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company aims to maximize the total profit from both products.\n// Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n// Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in the new technology.\n// TechInvestment <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 2000 units for P1 and 1500 units for P2.\n// P1 <= 2000\n// P2 <= 1500",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit. Additionally, the company is considering investing in a new technology that could reduce production costs. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| P1      | $100            | $60                      |\n| P2      | $120            | $70                      |\n\nThe new technology reduces the production cost per unit of both products by $0.5 for every $1000 invested. The company has a total budget of $100,000 for investment in the new technology. The company has a production capacity of 2000 units for P1 and 1500 units for P2. \n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=2000) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=1500) # quantity of P2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\n## Profit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\n## So, the objective function is: Maximize (Profit_P1 + Profit_P2)\nProfit_P1 = (100 - (60 - 0.0005 * TechInvestment)) * P1\nProfit_P2 = (120 - (70 - 0.0005 * TechInvestment)) * P2\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvestment <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, the labor hours allocated to each product, and the marketing budget for each product.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Prod3\", \"range\": \"Prod3 >= 0\", \"type\": \"integer\"}\n// {\"labor hours for Product 1\": \"Labor1\", \"range\": \"Labor1 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 2\": \"Labor2\", \"range\": \"Labor2 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 3\": \"Labor3\", \"range\": \"Labor3 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 1\": \"Marketing1\", \"range\": \"Marketing1 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 2\": \"Marketing2\", \"range\": \"Marketing2 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 3\": \"Marketing3\", \"range\": \"Marketing3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is affected by the production quantity, labor hours, and marketing budget. The profit function is nonlinear and includes economies of scale and diminishing returns in labor and marketing. The company aims to maximize the total profit from all three products.\n// Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n// Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n// Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\n\n## Generate Constraint-1:\nThe total labor hours available for all products cannot exceed 1000 hours.\n// Labor1 + Labor2 + Labor3 <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products must not exceed $50,000.\n// Marketing1 + Marketing2 + Marketing3 <= 50000\n\n## Generate Constraint-3:\nThe production quantity of each product must be at least 10 units.\n// Prod1 >= 10; Prod2 >= 10; Prod3 >= 10",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantity, labor hours, and marketing budget for each of its three products. The company aims to maximize the total profit from all three products, which is affected by the production quantity, labor hours, and marketing budget, considering economies of scale and diminishing returns in labor and marketing. The profit functions for each product are nonlinear.\n\n| Product | Profit Function Components |\n|---------|-----------------------------|\n| 1       | 100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2 |\n| 2       | 150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2 |\n| 3       | 200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2 |\n\nThe company has the following constraints:\n- The total labor hours available for all products cannot exceed 1000 hours.\n- The total marketing budget for all products must not exceed $50,000.\n- The production quantity of each product must be at least 10 units.\n\nPlease help the company determine the optimal production quantity, labor hours, and marketing budget for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=10)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=10)  # production quantity of Product 2\nProd3 = model.addVar(vtype=\"INTEGER\", name=\"Prod3\", lb=10)  # production quantity of Product 3\nLabor1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor1\", lb=0)  # labor hours for Product 1\nLabor2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor2\", lb=0)  # labor hours for Product 2\nLabor3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor3\", lb=0)  # labor hours for Product 3\nMarketing1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing1\", lb=0)  # marketing budget for Product 1\nMarketing2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing2\", lb=0)  # marketing budget for Product 2\nMarketing3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing3\", lb=0)  # marketing budget for Product 3\n\n# Define objective function\n# Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n# Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n# Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n# So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\nProfit1 = 100 * Prod1 - 0.01 * Prod1**2 + 20 * Labor1 - 0.05 * Labor1**2 + 10 * Marketing1 - 0.1 * Marketing1**2\nProfit2 = 150 * Prod2 - 0.015 * Prod2**2 + 25 * Labor2 - 0.05 * Labor2**2 + 15 * Marketing2 - 0.1 * Marketing2**2\nProfit3 = 200 * Prod3 - 0.02 * Prod3**2 + 30 * Labor3 - 0.05 * Labor3**2 + 20 * Marketing3 - 0.1 * Marketing3**2\nTotalProfit = Profit1 + Profit2 + Profit3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(Labor1 + Labor2 + Labor3 <= 1000)  # total labor hours available for all products cannot exceed 1000 hours\nmodel.addCons(Marketing1 + Marketing2 + Marketing3 <= 50000)  # total marketing budget for all products must not exceed $50,000\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Prod3))\n    print(\"Labor Hours for Product 1: \", model.getVal(Labor1))\n    print(\"Labor Hours for Product 2: \", model.getVal(Labor2))\n    print(\"Labor Hours for Product 3: \", model.getVal(Labor3))\n    print(\"Marketing Budget for Product 1: \", model.getVal(Marketing1))\n    print(\"Marketing Budget for Product 2: \", model.getVal(Marketing2))\n    print(\"Marketing Budget for Product 3: \", model.getVal(Marketing3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1306,
        "var_num": 9,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C).\n// {\"number of Machinery A units\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery B units\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery C units\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n// Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n// Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing and maintaining the machinery.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000\n\n## Generate Constraint-2:\nThe company must invest at least $20,000 in machinery to meet production demands.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 3 units of each type of machinery are purchased.\n// MachineryA >= 3\n// MachineryB >= 3\n// MachineryC >= 3\n\n## Generate Constraint-4:\nThe company aims to limit the investment in any single type of machinery to no more than 40% of the total budget.\n// 500 * MachineryA <= 40% * 50000\n// 700 * MachineryB <= 40% * 50000\n// 1000 * MachineryC <= 40% * 50000",
        "question": "A manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C). Each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs. The company has a budget of $50,000 for purchasing and maintaining the machinery and must invest at least $20,000 in machinery to meet production demands. The company wants to ensure that at least 3 units of each type of machinery are purchased and aims to limit the investment in any single type of machinery to no more than 40% of the total budget. Please help the company determine the optimal number of units of each type of machinery to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineryA = model.addVar(vtype=\"INTEGER\", name=\"MachineryA\", lb=3)  # number of Machinery A units\nMachineryB = model.addVar(vtype=\"INTEGER\", name=\"MachineryB\", lb=3)  # number of Machinery B units\nMachineryC = model.addVar(vtype=\"INTEGER\", name=\"MachineryC\", lb=3)  # number of Machinery C units\n\n# Define objective function\nCapacity = 0.1 * MachineryA + 0.15 * MachineryB + 0.2 * MachineryC\nCost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n# So, the objective function is: Maximize (Capacity - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing and maintaining the machinery.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000)\n# The company must invest at least $20,000 in machinery to meet production demands.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000)\n# The company wants to ensure that at least 3 units of each type of machinery are purchased.\nmodel.addCons(MachineryA >= 3)\nmodel.addCons(MachineryB >= 3)\nmodel.addCons(MachineryC >= 3)\n# The company aims to limit the investment in any single type of machinery to no more than 40% of the total budget.\nmodel.addCons(500 * MachineryA <= 0.4 * 50000)\nmodel.addCons(700 * MachineryB <= 0.4 * 50000)\nmodel.addCons(1000 * MachineryC <= 0.4 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machinery A units: \", model.getVal(MachineryA))\n    print(\"Number of Machinery B units: \", model.getVal(MachineryB))\n    print(\"Number of Machinery C units: \", model.getVal(MachineryC))\n    print(\"Maximized Net Production Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products.\n// Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n// So, the objective function is: Maximize \\(P_{total}\\)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// \\(Q_a + Q_b + Q_c \\leq 1000\\)\n\n## Generate Constraint-2:\nThe production of product A must not exceed 400 units due to limited raw materials.\n// \\(Q_a \\leq 400\\)\n\n## Generate Constraint-3:\nThe production of product B must be at least 200 units to meet contractual obligations.\n// \\(Q_b \\geq 200\\)\n\n## Generate Constraint-4:\nThe production of product C is capped at 300 units due to labor constraints.\n// \\(Q_c \\leq 300\\)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products.\n\nThe company has the following constraints:\n1. The total production capacity of the company is limited to 1000 units per month.\n2. The production of product A must not exceed 400 units due to limited raw materials.\n3. The production of product B must be at least 200 units to meet contractual obligations.\n4. The production of product C is capped at 300 units due to labor constraints.\n\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## The profit from each product is influenced by a nonlinear relationship between production quantity and market demand.\nPa = 100 * Qa - 0.1 * Qa**2\nPb = 150 * Qb - 0.2 * Qb**2\nPc = 200 * Qc - 0.3 * Qc**2\nPtotal = Pa + Pb + Pc\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Ptotal\nmodel.addCons(obj == Ptotal)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The production of product A must not exceed 400 units due to limited raw materials.\nmodel.addCons(Qa <= 400)\n## The production of product B must be at least 200 units to meet contractual obligations.\nmodel.addCons(Qb >= 200)\n## The production of product C is capped at 300 units due to labor constraints.\nmodel.addCons(Qc <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. The effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. The effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. The company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. Please help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 788,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce.\n// {\"quantity of S1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of S3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. \nFor S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. \nFor S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300.\nThe manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year).\n// Net_Revenue_S1 = (100 * S1 - 60 * S1) / 200\n// Net_Revenue_S2 = (120 * S2 - 70 * S2) / 250\n// Net_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n// So, the objective function is: Maximize (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited production budget of $10,000 for production costs.\n// 60 * S1 + 70 * S2 + 90 * S3 <= 10000",
        "question": "A manufacturer produces three types of solar panels: S1, S2, and S3. They need to determine the quantities of each solar panel to produce. For S1, the revenue per unit is $100, the production cost per unit is $60, and the energy efficiency (in kWh per year) is 200. For S2, the revenue per unit is $120, the production cost per unit is $70, and the energy efficiency is 250. For S3, the revenue per unit is $150, the production cost per unit is $90, and the energy efficiency is 300. The manufacturer wants to maximize the net revenue per unit of energy efficiency (net revenue per kWh per year). The manufacturer has a limited production budget of $10,000 for production costs. Please help the manufacturer determine the optimal quantities of S1, S2, and S3 to maximize the net revenue per unit of energy efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # quantity of S1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # quantity of S2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # quantity of S3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_S1 = (100 * S1 - 60 * S1) / 200\nNet_Revenue_S2 = (120 * S2 - 70 * S2) / 250\nNet_Revenue_S3 = (150 * S3 - 90 * S3) / 300\n## convert the division to multiplication\nmodel.addCons(obj * (200 + 250 + 300) == (Net_Revenue_S1 + Net_Revenue_S2 + Net_Revenue_S3) * (200 + 250 + 300))\n\n# Add constraints\n## The manufacturer has a limited production budget of $10,000 for production costs.\nmodel.addCons(60 * S1 + 70 * S2 + 90 * S3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of S1: \", model.getVal(S1))\n    print(\"Quantity of S2: \", model.getVal(S2))\n    print(\"Quantity of S3: \", model.getVal(S3))\n    print(\"Maximized Net Revenue per kWh per year: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 120 hours available.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredient costs.\n// 1 * P1 + 1.5 * P2 + 2 * P3 <= 1500",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery has a total baking time of 120 hours available and a budget of $1500 for ingredient costs.\nPlease help the bakery to maximize the profit efficiency (profit per minute of baking time).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 120 hours available.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60)\n## The bakery has a budget of $1500 for ingredient costs.\nmodel.addCons(1 * P1 + 1.5 * P2 + 2 * P3 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost.\n// Cost_S = max(100 - 0.5 * (S - 100), 100) * S\n// Cost_T = max(150 - 0.5 * (T - 100), 150) * T\n// Cost_L = max(200 - 0.5 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\n// S <= 500; T <= 300; L <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 800 units in total.\n// S + T + L <= 800\n\n## Generate Constraint-4:\nTo ensure quality, the manufacturer must produce at least 50 units of each device.\n// S >= 50; T >= 50; L >= 50",
        "question": "A manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\nThe profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost.\nThe manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000.\nThe market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\nThe manufacturer has a production capacity limit of 800 units in total.\nTo ensure quality, the manufacturer must produce at least 50 units of each device.\nPlease help the manufacturer to determine the optimal production quantities of Smartphones (S), Tablets (T), and Laptops (L) to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=50, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=50, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = max(100 - 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = 100 * S1 * S_b1 + (100 - 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_T = max(150 - 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_T = 150 * T1 * T_b1 + (150 - 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_L = max(200 - 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = 200 * L1 * L_b1 + (200 - 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\nmodel.addCons(obj == (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S + T + L <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 600 smartphones to be produced.\n// S <= 600\n\n## Generate Constraint-3:\nDue to market research, the company should produce no more than 400 tablets.\n// T <= 400",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation, and is given by the function: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively.\n\nThe company has the following constraints:\n1. The total production capacity of the company is limited to 1000 units per month.\n2. The raw material constraint allows for a maximum of 600 smartphones to be produced.\n3. Due to market research, the company should produce no more than 400 tablets.\n\nPlease help the company to maximize the profit function given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\nmodel.addCons(obj == 50*S + 60*T + 70*L - 0.01*(S**2 + T**2 + L**2))\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n## The raw material constraint allows for a maximum of 600 smartphones to be produced.\nmodel.addCons(S <= 600)\n## Due to market research, the company should produce no more than 400 tablets.\nmodel.addCons(T <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device.\n// {\"number of workers for smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker can produce 10 smartphones, 8 tablets, or 6 laptops per hour. The cost of production per device varies inversely with the number of workers assigned. The cost per smartphone is $50/S, per tablet is $70/T, and per laptop is $100/L. The manufacturer aims to minimize the total production cost while meeting the demand for each device.\n// Total cost of smartphones: Cost_S = 10 * S * (50/S) = 500\n// Total cost of tablets: Cost_T = 8 * T * (70/T) = 560\n// Total cost of laptops: Cost_L = 6 * L * (100/L) = 600\n// Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nThe demand for smartphones is at least 500 units.\n// 10 * S >= 500\n\n## Generate Constraint-3:\nThe demand for tablets is at least 400 units.\n// 8 * T >= 400\n\n## Generate Constraint-4:\nThe demand for laptops is at least 300 units.\n// 6 * L >= 300\n\n## Generate Constraint-5:\nNo more than 20 workers can be assigned to laptops.\n// L <= 20",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device. Each worker can produce 10 smartphones, 8 tablets, or 6 laptops per hour. The cost of production per device varies inversely with the number of workers assigned. The cost per smartphone is $50/S, per tablet is $70/T, and per laptop is $100/L. The manufacturer aims to minimize the total production cost while meeting the demand for each device.\nThe total number of workers available is 50. The demand for smartphones is at least 500 units. The demand for tablets is at least 400 units. The demand for laptops is at least 300 units. No more than 20 workers can be assigned to laptops.\nPlease help the manufacturer determine the optimal number of workers to assign to each device to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers for smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers for tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers for laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\nCost_S = 500  # Cost of smartphones is constant as it simplifies to 500\nCost_T = 560  # Cost of tablets is constant as it simplifies to 560\nCost_L = 600  # Cost of laptops is constant as it simplifies to 600\nmodel.addCons(obj == Cost_S + Cost_T + Cost_L)\n\n# Add constraints\n## The total number of workers available is 50.\nmodel.addCons(S + T + L <= 50)\n## The demand for smartphones is at least 500 units.\nmodel.addCons(10 * S >= 500)\n## The demand for tablets is at least 400 units.\nmodel.addCons(8 * T >= 400)\n## The demand for laptops is at least 300 units.\nmodel.addCons(6 * L >= 300)\n## No more than 20 workers can be assigned to laptops.\nmodel.addCons(L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers for Smartphones: \", model.getVal(S))\n    print(\"Number of Workers for Tablets: \", model.getVal(T))\n    print(\"Number of Workers for Laptops: \", model.getVal(L))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total delivery time, which is influenced by the number of trucks and the complexity of routes. The delivery time per truck for each warehouse is as follows:\n- Warehouse A: 50 + 10 * TrucksA^2 minutes per truck\n- Warehouse B: 60 + 8 * TrucksB^2 minutes per truck\n- Warehouse C: 70 + 12 * TrucksC^2 minutes per truck\nThe company wants to minimize the total delivery time across all warehouses.\n// Total delivery time for Warehouse A: TimeA = (50 + 10 * TrucksA^2) * TrucksA\n// Total delivery time for Warehouse B: TimeB = (60 + 8 * TrucksB^2) * TrucksB\n// Total delivery time for Warehouse C: TimeC = (70 + 12 * TrucksC^2) * TrucksC\n// So, the objective function is: Minimize (TimeA + TimeB + TimeC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50",
        "question": "A logistics company operates three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to determine the number of trucks to allocate to each warehouse for optimal delivery efficiency. The delivery time per truck for each warehouse is as follows:\n- Warehouse A: 50 + 10 * TrucksA^2 minutes per truck\n- Warehouse B: 60 + 8 * TrucksB^2 minutes per truck\n- Warehouse C: 70 + 12 * TrucksC^2 minutes per truck\nThe company aims to minimize the total delivery time across all warehouses. The company has a total of 50 trucks available for allocation.\nPlease help the company to minimize the total delivery time across all warehouses.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for Warehouse A\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for Warehouse B\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for Warehouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total delivery time for Warehouse A: TimeA = (50 + 10 * TrucksA^2) * TrucksA\n## Total delivery time for Warehouse B: TimeB = (60 + 8 * TrucksB^2) * TrucksB\n## Total delivery time for Warehouse C: TimeC = (70 + 12 * TrucksC^2) * TrucksC\n## So, the objective function is: Minimize (TimeA + TimeB + TimeC)\nmodel.addCons(obj == (50 + 10 * TrucksA**2) * TrucksA + (60 + 8 * TrucksB**2) * TrucksB + (70 + 12 * TrucksC**2) * TrucksC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TrucksC))\n    print(\"Minimized Total Delivery Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 638,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of resources (labor and equipment) to maximize efficiency and minimize costs.\n// {\"labor and equipment allocation for warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"real\"}\n// {\"labor and equipment allocation for warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"real\"}\n// {\"labor and equipment allocation for warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe efficiency of each warehouse is determined by a nonlinear function of the allocated resources. Warehouse 1's efficiency is modeled as E1 = 100 * W1 / (1 + W1^2). Warehouse 2's efficiency is modeled as E2 = 120 * W2 / (1 + W2^2). Warehouse 3's efficiency is modeled as E3 = 150 * W3 / (1 + W3^2). The company aims to maximize the total efficiency of all warehouses.\n// The objective function is: Maximize E = E1 + E2 + E3 = 100 * W1 / (1 + W1^2) + 120 * W2 / (1 + W2^2) + 150 * W3 / (1 + W3^2)\n\n## Generate Constraint-1:\nThe total budget for resource allocation across all warehouses is limited to $300,000.\n// W1 + W2 + W3 <= 300,000\n\n## Generate Constraint-2:\nEach warehouse has a maximum capacity for resource allocation. Warehouse 1 can handle up to $100,000, Warehouse 2 up to $150,000, and Warehouse 3 up to $200,000.\n// W1 <= 100,000; W2 <= 150,000; W3 <= 200,000\n\n## Generate Constraint-3:\nThe company aims to ensure that at least 20% of the total budget is allocated to each warehouse.\n// W1 >= 0.2 * (W1 + W2 + W3); W2 >= 0.2 * (W1 + W2 + W3); W3 >= 0.2 * (W1 + W2 + W3)",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of resources (labor and equipment) to maximize efficiency and minimize costs. The efficiency of each warehouse is determined by a nonlinear function of the allocated resources. Warehouse 1's efficiency is modeled as E1 = 100 * W1 / (1 + W1^2). Warehouse 2's efficiency is modeled as E2 = 120 * W2 / (1 + W2^2). Warehouse 3's efficiency is modeled as E3 = 150 * W3 / (1 + W3^2). The company aims to maximize the total efficiency of all warehouses. The total budget for resource allocation across all warehouses is limited to $300,000. Each warehouse has a maximum capacity for resource allocation. Warehouse 1 can handle up to $100,000, Warehouse 2 up to $150,000, and Warehouse 3 up to $200,000. The company aims to ensure that at least 20% of the total budget is allocated to each warehouse. Please help the company to determine the optimal allocation of resources to each warehouse.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0) # labor and equipment allocation for warehouse 1\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=0) # labor and equipment allocation for warehouse 2\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=0) # labor and equipment allocation for warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The efficiency of each warehouse is determined by a nonlinear function of the allocated resources.\nE1 = 100 * W1 / (1 + W1**2)\nE2 = 120 * W2 / (1 + W2**2)\nE3 = 150 * W3 / (1 + W3**2)\n## The objective function is: Maximize E = E1 + E2 + E3\nmodel.addCons(obj == E1 + E2 + E3)\n\n# Add constraints\n## The total budget for resource allocation across all warehouses is limited to $300,000.\nmodel.addCons(W1 + W2 + W3 <= 300000)\n## Each warehouse has a maximum capacity for resource allocation.\nmodel.addCons(W1 <= 100000)\nmodel.addCons(W2 <= 150000)\nmodel.addCons(W3 <= 200000)\n## The company aims to ensure that at least 20% of the total budget is allocated to each warehouse.\nmodel.addCons(W1 >= 0.2 * (W1 + W2 + W3))\nmodel.addCons(W2 >= 0.2 * (W1 + W2 + W3))\nmodel.addCons(W3 >= 0.2 * (W1 + W2 + W3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor and Equipment Allocation for Warehouse 1: \", model.getVal(W1))\n    print(\"Labor and Equipment Allocation for Warehouse 2: \", model.getVal(W2))\n    print(\"Labor and Equipment Allocation for Warehouse 3: \", model.getVal(W3))\n    print(\"Maximized Total Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted. The risk function is R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost.\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from soybeans: Profit_S = 150 * S\n// Risk cost: Risk = 0.01 * (W^2 + C^2 + S^2)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk) = Maximize (200W + 300C + 150S - 0.01(W^2 + C^2 + S^2))\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity.\n// W >= 20; C >= 20; S >= 20\n\n## Generate Constraint-3:\nThe farmer has a budget constraint for seed and fertilizer, which costs $100 per acre for wheat, $120 per acre for corn, and $80 per acre for soybeans. The total budget for this is $11,000.\n// 100W + 120C + 80S <= 11000",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted, with the risk function R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost. The farmer has a total of 100 acres available for planting. The farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity. The farmer has a budget constraint for seed and fertilizer, which costs $100 per acre for wheat, $120 per acre for corn, and $80 per acre for soybeans, with a total budget of $11,000. Please help the farmer to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of acres for wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of acres for corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # number of acres for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_S = 150 * S\nRisk = 0.01 * (W**2 + C**2 + S**2)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S - Risk)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget constraint for seed and fertilizer, which costs $100 per acre for wheat, $120 per acre for corn, and $80 per acre for soybeans. The total budget for this is $11,000.\nmodel.addCons(100 * W + 120 * C + 80 * S <= 11000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(W))\n    print(\"Number of Acres for Corn: \", model.getVal(C))\n    print(\"Number of Acres for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n// The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $50,000.\n// 0.05 * S^2 + 0.07 * T^2 + 0.1 * L^2 <= 50000\n\n## Generate Constraint-2:\nThe production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\n// S <= 500; T <= 300; L <= 200",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company has a budget constraint that limits the total production cost to $50,000. The production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units. Please help the company to maximize the total profit after deducting the production costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.07 * T**2 + 200 * L - 0.1 * L**2)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $50,000.\nmodel.addCons(0.05 * S**2 + 0.07 * T**2 + 0.1 * L**2 <= 50000)\n## The production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n// Profit_A = (5 * 100 * A) - (200 * A)\n// Profit_B = (8 * 120 * B) - (300 * B)\n// Profit_C = (10 * 150 * C) - (400 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop. The yield per hectare, selling price per ton, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton | Labor Cost per Hectare |\n|------|-------------------|-----------------------|------------------------|\n| A    | 5 tons            | $100                  | $200                   |\n| B    | 8 tons            | $120                  | $300                   |\n| C    | 10 tons           | $150                  | $400                   |\n\nThe farmer has a total of 100 hectares available for cultivation. The farmer has a budget of $20,000 for labor costs. Please help the farmer to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 * A) - (200 * A)\nProfit_B = (8 * 120 * B) - (300 * B)\nProfit_C = (10 * 150 * C) - (400 * C)\nTotalHectares = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalHectares\n## convert the division to multiplication\nmodel.addCons(obj * TotalHectares == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to the complexity of the production process, the profit per unit decreases nonlinearly with the increase in production quantity. Specifically, the profit per unit decreases by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products.\n// Profit_A = (10 - 0.005 * A) * A\n// Profit_B = (15 - 0.005 * B) * B\n// Profit_C = (20 - 0.005 * C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units.\n// A <= 200; B <= 150; C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of each product decreases nonlinearly with the increase in production quantity, specifically by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products. The profit per unit for Product A is $10, for Product B is $15, and for Product C is $20.\n\n| Product | Profit per Unit | Raw Material Required per Unit |\n|---------|-----------------|--------------------------------|\n| A       | $10             | 5 kg                           |\n| B       | $15             | 8 kg                           |\n| C       | $20             | 10 kg                          |\n\nThe company has a limited supply of raw materials, with a total of 1000 kg available. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. Additionally, the market has a demand limit for each product: the demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units.\n\nPlease help the company determine the optimal production quantities of products A, B, and C to maximize their total profit while adhering to the constraints of raw material availability and market demand limits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit per unit decreases by 0.005 times the quantity produced for each product\nProfit_A = (10 - 0.005 * A) * A\nProfit_B = (15 - 0.005 * B) * B\nProfit_C = (20 - 0.005 * C) * C\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1449,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products. The total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25. Please help the company determine the optimal amount of each product to produce to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 633,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $10,000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-3:\nThe farm has a total land capacity of 100 hectares.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm has a budget of $10,000 for fertilizer costs. The farm has a total land capacity of 100 hectares. \nPlease help the farm to maximize the profit efficiency (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $10,000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farm has a total land capacity of 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours.\n// {\"number of wheat bread batches\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of rye bread batches\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of sourdough bread batches\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach batch of wheat bread yields a profit of $10, rye bread yields $15, and sourdough bread yields $20. The bakery aims to maximize the total daily profit from selling these bread types.\n// The objective function is: Maximize P = 10W + 15R + 20S\n\n## Generate Constraint-1:\nThe bakery has a total of 100 labor hours available daily. Each batch of wheat bread requires 2 hours, rye bread requires 3 hours, and sourdough bread requires 4 hours of labor.\n// 2W + 3R + 4S <= 100\n\n## Generate Constraint-2:\nThe oven space is limited, allowing for a maximum of 30 batches to be baked daily.\n// W + R + S <= 30",
        "question": "A small bakery wants to optimize the production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide how many batches of each type of bread to bake daily to maximize profit while considering the limited oven space and labor hours. Each batch of wheat bread yields a profit of $10, rye bread yields $15, and sourdough bread yields $20. The bakery has a total of 100 labor hours available daily. Each batch of wheat bread requires 2 hours, rye bread requires 3 hours, and sourdough bread requires 4 hours of labor. The oven space is limited, allowing for a maximum of 30 batches to be baked daily. Please help the bakery to maximize the total daily profit from selling these bread types.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wheat bread batches\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of rye bread batches\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of sourdough bread batches\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 10W + 15R + 20S\nmodel.addCons(obj == 10*W + 15*R + 20*S)\n\n# Add constraints\n## The bakery has a total of 100 labor hours available daily.\nmodel.addCons(2*W + 3*R + 4*S <= 100)\n## The oven space is limited, allowing for a maximum of 30 batches to be baked daily.\nmodel.addCons(W + R + S <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Wheat Bread Batches: \", model.getVal(W))\n    print(\"Number of Rye Bread Batches: \", model.getVal(R))\n    print(\"Number of Sourdough Bread Batches: \", model.getVal(S))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 711,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 2,000 units.\n// PA >= 2000\n\n## Generate Constraint-4:\nThe production of product B must not exceed 3,000 units.\n// PB <= 3000\n\n## Generate Constraint-5:\nThe production of product C must be at least twice the production of product A.\n// PC >= 2 * PA",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| A       | $50                              | $80                    |\n| B       | $60                              | $90                    |\n| C       | $70                              | $100                   |\n\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The company has a budget of $50,000 for investment in energy efficiency. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 2,000 units. The production of product B must not exceed 3,000 units. The production of product C must be at least twice the production of product A. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=2000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0, ub=3000) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $50,000 for investment in energy efficiency.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n# The production of product A must be at least 2,000 units.\nmodel.addCons(PA >= 2000)\n# The production of product B must not exceed 3,000 units.\nmodel.addCons(PB <= 3000)\n# The production of product C must be at least twice the production of product A.\nmodel.addCons(PC >= 2 * PA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1262,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season.\n// {\"number of hectares for CropA\": \"HectaresA\", \"range\": \"HectaresA >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropB\": \"HectaresB\", \"range\": \"HectaresB >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropC\": \"HectaresC\", \"range\": \"HectaresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $500, the water usage per hectare is 1000 liters, and the labor cost per hectare is $200. \nFor CropB, the expected profit per hectare is $700, the water usage per hectare is 1500 liters, and the labor cost per hectare is $300. \nFor CropC, the expected profit per hectare is $900, the water usage per hectare is 2000 liters, and the labor cost per hectare is $400.\nThe farm aims to maximize the profit-to-water usage ratio for the entire farm.\n// Total profit for CropA: Profit_A = 500 * HectaresA - 200 * HectaresA\n// Total profit for CropB: Profit_B = 700 * HectaresB - 300 * HectaresB\n// Total profit for CropC: Profit_C = 900 * HectaresC - 400 * HectaresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HectaresA + HectaresB + HectaresC <= 100",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season. The expected profit per hectare, water usage per hectare, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Hectare | Water Usage per Hectare | Labor Cost per Hectare |\n|---------|-----------------------------|-------------------------|------------------------|\n| CropA   | $500                        | 1000 liters             | $200                   |\n| CropB   | $700                        | 1500 liters             | $300                   |\n| CropC   | $900                        | 2000 liters             | $400                   |\n\nThe farm has a total of 100 hectares available for cultivation. The farm aims to maximize the profit-to-water usage ratio for the entire farm. Please help the farm determine the optimal allocation of hectares to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHectaresA = model.addVar(vtype=\"INTEGER\", name=\"HectaresA\", lb=0) # number of hectares for CropA\nHectaresB = model.addVar(vtype=\"INTEGER\", name=\"HectaresB\", lb=0) # number of hectares for CropB\nHectaresC = model.addVar(vtype=\"INTEGER\", name=\"HectaresC\", lb=0) # number of hectares for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * HectaresA\nProfit_B = (700 - 300) * HectaresB\nProfit_C = (900 - 400) * HectaresC\nWaterUsage = 1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HectaresA + HectaresB + HectaresC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hectares for CropA: \", model.getVal(HectaresA))\n    print(\"Number of Hectares for CropB: \", model.getVal(HectaresB))\n    print(\"Number of Hectares for CropC: \", model.getVal(HectaresC))\n    print(\"Maximized Profit-to-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 1000 kg, the cost per acre is $500, and the market price per kg is $1. \nFor C2, the yield per acre is 1500 kg, the cost per acre is $600, and the market price per kg is $1.2. \nFor C3, the yield per acre is 2000 kg, the cost per acre is $700, and the market price per kg is $1.5.\nThe farm wants to maximize the profit per acre (revenue minus cost per acre).\n// Profit_C1 = (1000 * C1 * 1) - (500 * C1)\n// Profit_C2 = (1500 * C2 * 1.2) - (600 * C2)\n// Profit_C3 = (2000 * C3 * 1.5) - (700 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres of land available.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for crop production costs.\n// 500 * C1 + 600 * C2 + 700 * C3 <= 50000\n\n## Generate Constraint-3:\nThe market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1.\n// 1000 * C1 <= 50000\n\n## Generate Constraint-4:\nThe farm must allocate at least 20% of its land to C2 to maintain biodiversity.\n// C2 >= 0.2 * (C1 + C2 + C3)",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. For C1, the yield per acre is 1000 kg, the cost per acre is $500, and the market price per kg is $1. For C2, the yield per acre is 1500 kg, the cost per acre is $600, and the market price per kg is $1.2. For C3, the yield per acre is 2000 kg, the cost per acre is $700, and the market price per kg is $1.5. The farm wants to maximize the profit per acre (revenue minus cost per acre). The farm has a total of 100 acres of land available. The farm has a budget of $50,000 for crop production costs. The market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1. The farm must allocate at least 20% of its land to C2 to maintain biodiversity. Please help the farm to maximize the profit per acre (revenue minus cost per acre).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # area of land for C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # area of land for C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 * C1 * 1) - (500 * C1)\nProfit_C2 = (1500 * C2 * 1.2) - (600 * C2)\nProfit_C3 = (2000 * C3 * 1.5) - (700 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 acres of land available.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farm has a budget of $50,000 for crop production costs.\nmodel.addCons(500 * C1 + 600 * C2 + 700 * C3 <= 50000)\n## The market demand for C1 is 50,000 kg. So, the farm can only sell a maximum of 50,000 kg of C1.\nmodel.addCons(1000 * C1 <= 50000)\n## The farm must allocate at least 20% of its land to C2 to maintain biodiversity.\nmodel.addCons(C2 >= 0.2 * (C1 + C2 + C3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(C1))\n    print(\"Area of Land for C2: \", model.getVal(C2))\n    print(\"Area of Land for C3: \", model.getVal(C3))\n    print(\"Maximized Profit Per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The objective is to maximize the total profit after deducting the production cost.\n// The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n// The profit from tablets: P_T = 150 * T - 0.03 * T^2\n// The profit from laptops: P_L = 200 * L - 0.02 * L^2\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 devices.\n// S + T + L <= 1000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The objective is to maximize the total profit after deducting the production cost.\n\n| Device     | Profit per Unit | Production Cost Formula |\n|------------|-----------------|-------------------------|\n| Smartphones| $100            | 0.05 * S^2             |\n| Tablets    | $150            | 0.03 * T^2             |\n| Laptops    | $200            | 0.02 * L^2             |\n\nThe total production capacity is limited to 1000 devices. Please help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n## The profit from tablets: P_T = 150 * T - 0.03 * T^2\n## The profit from laptops: P_L = 200 * L - 0.02 * L^2\n## So, the objective function is: Maximize P = P_S + P_T + P_L\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.03 * T**2 + 200 * L - 0.02 * L**2)\n\n# Add constraints\n## The total production capacity is limited to 1000 devices.\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nProduct A requires a minimum production of 50 units to meet contractual obligations.\n// A >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit per unit and the setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| A       | $50             | $1000      |\n| B       | $70             | $1500      |\n| C       | $90             | $2000      |\n\nThe company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Product A requires a minimum production of 50 units to meet contractual obligations.\nPlease help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit from product A: Profit_A = 50 * A - 1000\n## Total profit from product B: Profit_B = 70 * B - 1500\n## Total profit from product C: Profit_C = 90 * C - 2000\nProfit_A = 50 * A - 1000\nProfit_B = 70 * B - 1500\nProfit_C = 90 * C - 2000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 769,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized.\n// {\"production level of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n// Total profit: Profit = 50 * A + 70 * B + 90 * C\n// Environmental cost: Cost = 10 * C\n// So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe manufacturer has a contract to produce at least 200 units of product A.\n// A >= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n\n| Product | Profit per Unit | Environmental Cost per Unit |\n|---------|-----------------|-----------------------------|\n| A       | 50$             | 0$                          |\n| B       | 70$             | 0$                          |\n| C       | 90$             | 10$                         |\n\nThe total production capacity is limited to 1000 units across all products. The manufacturer has a contract to produce at least 200 units of product A.\n\nPlease help the manufacturer to determine the optimal production levels of products A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer has a contract to produce at least 200 units of product A.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production level of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of product C\n\n# Define objective function\n## Each unit of product A yields a profit of $50, product B yields $70, and product C yields $90.\n## However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management.\n## Total profit: Profit = 50 * A + 70 * B + 90 * C\n## Environmental cost: Cost = 10 * C\n## So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of product A: \", model.getVal(A))\n    print(\"Production level of product B: \", model.getVal(B))\n    print(\"Production level of product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company wants to maximize the total net profit.\n// Total revenue for product A: Revenue_A = 50 * ProductA\n// Total revenue for product B: Revenue_B = 70 * ProductB\n// Total revenue for product C: Revenue_C = 90 * ProductC\n// Total cost for product A: Cost_A = 1000 + 2 * (ProductA)^2\n// Total cost for product B: Cost_B = 1500 + 1.5 * (ProductB)^2\n// Total cost for product C: Cost_C = 2000 + (ProductC)^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 10,000 cubic feet. Each unit of product A requires 10 cubic feet, product B requires 15 cubic feet, and product C requires 20 cubic feet.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company has a limited storage capacity of 10,000 cubic feet. Each unit of product A requires 10 cubic feet, product B requires 15 cubic feet, and product C requires 20 cubic feet. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue and cost for each product\nRevenue_A = 50 * ProductA\nRevenue_B = 70 * ProductB\nRevenue_C = 90 * ProductC\nCost_A = 1000 + 2 * (ProductA**2)\nCost_B = 1500 + 1.5 * (ProductB**2)\nCost_C = 2000 + (ProductC**2)\n## Total net profit\nNetProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\n## The company has a limited storage capacity of 10,000 cubic feet.\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, component B is $40, and component C is $50. The production cost per unit of component A is $10, component B is $20, and component C is $30. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost.\n// Revenue from A: Revenue_A = 30 * A\n// Revenue from B: Revenue_B = 40 * B\n// Revenue from C: Revenue_C = 50 * C\n// Cost of A: Cost_A = 10 * A\n// Cost of B: Cost_B = 20 * B\n// Cost of C: Cost_C = 30 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of component A requires 2 hours, component B requires 3 hours, and component C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 20 units per week, and for component B and C, it is at least 15 units per week.\n// A >= 20; B >= 15; C >= 15",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand.\nThe profit per unit of component A is $30, component B is $40, and component C is $50. The production cost per unit of component A is $10, component B is $20, and component C is $30. The company has a limited production capacity of 1000 hours per week. Producing one unit of component A requires 2 hours, component B requires 3 hours, and component C requires 4 hours. The market demand for component A is at least 20 units per week, and for component B and C, it is at least 15 units per week.\nPlease help the company to maximize its total profit, which is the difference between the total revenue and the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of component C\n\n# Define objective function\nRevenue_A = 30 * A\nRevenue_B = 40 * B\nRevenue_C = 50 * C\nCost_A = 10 * A\nCost_B = 20 * B\nCost_C = 30 * C\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n# The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, corn is $15, and barley is $12. The farmer's goal is to maximize his total profit. However, the yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n// Profit_W = 10 * W * (1 + 0.005 * water_W)\n// Profit_C = 15 * C * (1 + 0.007 * water_C)\n// Profit_B = 12 * B * (1 + 0.006 * water_B)\n// Total_water = water_W + water_C + water_B = 500\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total water used for all crops cannot exceed 500 units.\n// water_W + water_C + water_B <= 500\n\n## Generate Constraint-2:\nThe farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit.\n// 2 * W + 3 * C + 2.5 * B <= 1000",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability. The profit per unit of wheat is $10, corn is $15, and barley is $12. The yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n\n| Crop   | Profit per Unit | Water Yield Increase | Labor Hours per Unit |\n|--------|-----------------|----------------------|----------------------|\n| Wheat  | $10             | 0.5%                 | 2 hours              |\n| Corn   | $15             | 0.7%                 | 3 hours              |\n| Barley | $12             | 0.6%                 | 2.5 hours            |\n\nThe total water used for all crops cannot exceed 500 units. The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit.\n\nPlease help the farmer to maximize his total profit by determining the optimal amount of wheat (W), corn (C), and barley (B) to plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of barley\nwater_W = model.addVar(vtype=\"CONTINUOUS\", name=\"water_W\", lb=0) # water for wheat\nwater_C = model.addVar(vtype=\"CONTINUOUS\", name=\"water_C\", lb=0) # water for corn\nwater_B = model.addVar(vtype=\"CONTINUOUS\", name=\"water_B\", lb=0) # water for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 10 * W * (1 + 0.005 * water_W)\nProfit_C = 15 * C * (1 + 0.007 * water_C)\nProfit_B = 12 * B * (1 + 0.006 * water_B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total water used for all crops cannot exceed 500 units.\nmodel.addCons(water_W + water_C + water_B <= 500)\n## The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours.\nmodel.addCons(2 * W + 3 * C + 2.5 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company wants to maximize the total profit.\n// The objective function is: Maximize P = 50A + 70B + 60C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe market demand for component A is at least 10 units, and for component B is at least 15 units.\n// A >= 10\n// B >= 15",
        "question": "A company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand. The profit from each unit of component A is $50, component B is $70, and component C is $60. The following table summarizes the raw material requirements for each component:\n\n| Component | Profit per Unit | Raw Material Requirement (kg) |\n|-----------|-----------------|-------------------------------|\n| A         | 50$             | 2                             |\n| B         | 70$             | 3                             |\n| C         | 60$             | 4                             |\n\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg. The market demand for component A is at least 10 units, and for component B is at least 15 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each component A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for component A is at least 10 units, and for component B is at least 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\n// Total profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\n// Total profit for DeviceC: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 600",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for each device decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Device | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|--------|----------------------------------|------------------------------------|-----------|\n| DeviceA | $50                             | $0.1                               | 100 units |\n| DeviceB | $70                             | $0.2                               | 200 units |\n| DeviceC | $100                            | $0.3                               | 300 units |\n\nThe company has a total production capacity of 600 units for all devices combined. Please help the company to maximize the total profit while considering the decreasing profit per unit and the production capacity constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=600)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAQty == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=600)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBQty == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.2 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=600)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCQty == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 100 * DeviceC1 * DeviceC_b1 + (100 - 0.3 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1029,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend.\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of Danishes\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"number of \u00c9clairs\": \"\u00c9clair\", \"range\": \"\u00c9clair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n// Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\n// Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\n\n## Generate Constraint-1:\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\n// 50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\n// Croissant <= 300; Danish <= 250; \u00c9clair <= 200",
        "question": "A bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend. The profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries. The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g. The bakery also has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200. Please help the bakery maximize its total profit from selling the pastries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0, ub=300) # number of Croissants\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=0, ub=250) # number of Danishes\n\u00c9clair = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair\", lb=0, ub=200) # number of \u00c9clairs\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=300)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.02 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=0, ub=100)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=250)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.02 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n\u00c9clair1 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair1\", lb=0, ub=100)\n\u00c9clair2 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair2\", lb=100, ub=200)\n\u00c9clair_b1 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b1\")\n\u00c9clair_b2 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b2\")\nmodel.addCons(\u00c9clair_b1 + \u00c9clair_b2 == 1)\nmodel.addCons(\u00c9clair == \u00c9clair1*\u00c9clair_b1 + \u00c9clair2*\u00c9clair_b2)\nProfit_\u00c9clair = 4 * \u00c9clair1 * \u00c9clair_b1 + (4 + 0.02 * (\u00c9clair2 - 100)) * \u00c9clair2 * \u00c9clair_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_\u00c9clair)\n\n# Add constraints\n## The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\nmodel.addCons(50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Danishes: \", model.getVal(Danish))\n    print(\"Number of \u00c9clairs: \", model.getVal(\u00c9clair))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost per acre is $500, and the water usage per acre is 5000 gallons. \nFor Crop B, the expected revenue per acre is $1500, the cost per acre is $700, and the water usage per acre is 7000 gallons. \nFor Crop C, the expected revenue per acre is $2000, the cost per acre is $900, and the water usage per acre is 9000 gallons.\nThe farm aims to maximize the net revenue per gallon of water used (which is defined as the sum of the net revenues divided by the sum of the water usages).\n// Net revenue of A: Net_Revenue_A = (1000 - 500) * A\n// Net revenue of B: Net_Revenue_B = (1500 - 700) * B\n// Net revenue of C: Net_Revenue_C = (2000 - 900) * C\n// So, the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for costs this season.\n// 500 * A + 700 * B + 900 * C <= 100000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season. The expected revenue per acre, cost per acre, and water usage per acre for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Acre | Cost per Acre | Water Usage per Acre |\n|------|---------------------------|---------------|----------------------|\n| A    | $1000                     | $500          | 5000 gallons         |\n| B    | $1500                     | $700          | 7000 gallons         |\n| C    | $2000                     | $900          | 9000 gallons         |\n\nThe farm has a budget of $100,000 for costs this season. The farm aims to maximize the net revenue per gallon of water used (which is defined as the sum of the net revenues divided by the sum of the water usages). Please help the farm determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_A = (1000 - 500) * A\nNet_Revenue_B = (1500 - 700) * B\nNet_Revenue_C = (2000 - 900) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Revenue_A + Net_Revenue_B + Net_Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for costs this season.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 950,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe company has a total of 150 hours available for production.\n// 3 * A + 4 * B + 5 * C <= 150\n\n## Generate Constraint-4:\nThe production of Product C cannot exceed twice the production of Product A.\n// C <= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. The company has a total of 150 hours available for production. The production of Product C cannot exceed twice the production of Product A.\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The company has a total of 150 hours available for production.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 150)\n## The production of Product C cannot exceed twice the production of Product A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n// The production time for component A: TA = 800 / (10 * WA)\n// The production time for component B: TB = 1200 / (15 * WB)\n// The production time for component C: TC = 1600 / (20 * WC)\n// So, the objective function is: Minimize max(TA, TB, TC)\n\n## Generate Constraint-1:\nThere are a total of 50 skilled workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 25 workers.\n// WA <= 25; WB <= 25; WC <= 25",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line. The production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n\n| Component | Production Rate per Worker (units/hour) |\n|-----------|-----------------------------------------|\n| A         | 10                                      |\n| B         | 15                                      |\n| C         | 20                                      |\n\nThere are a total of 50 skilled workers available. Each production line can accommodate up to 25 workers. Please help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum production time required to meet the weekly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## The production time for component A: TA = 800 / (10 * WA)\n## The production time for component B: TB = 1200 / (15 * WB)\n## The production time for component C: TC = 1600 / (20 * WC)\n## So, the objective function is: Minimize max(TA, TB, TC)\nTA = model.addVar(name=\"TA\")\nTB = model.addVar(name=\"TB\")\nTC = model.addVar(name=\"TC\")\nmodel.addCons(TA == 800 / (10 * WA))\nmodel.addCons(TB == 1200 / (15 * WB))\nmodel.addCons(TC == 1600 / (20 * WC))\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj >= TA)\nmodel.addCons(obj >= TB)\nmodel.addCons(obj >= TC)\n\n# Add constraints\n## There are a total of 50 skilled workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can accommodate up to 25 workers.\nmodel.addCons(WA <= 25)\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the yield is 5 tons per hectare, and the selling price is $100 per ton. \nFor Crop B, the yield is 7 tons per hectare, and the selling price is $120 per ton. \nFor Crop C, the yield is 6 tons per hectare, and the selling price is $110 per ton.\nThe farm aims to maximize its total revenue from selling the crops.\n// Revenue from Crop A: Revenue_A = 5 * 100 * HA\n// Revenue from Crop B: Revenue_B = 7 * 120 * HB\n// Revenue from Crop C: Revenue_C = 6 * 110 * HC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total land available for cultivation is 100 hectares.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply, which affects the yields. For each hectare of Crop A, 2 units of water are required, for Crop B, 3 units are required, and for Crop C, 2.5 units are required. The total water available is 250 units.\n// 2 * HA + 3 * HB + 2.5 * HC <= 250\n\n## Generate Constraint-3:\nThe farm wants to ensure diversity in its crops to mitigate risk. It decides to allocate at least 20% of the land to each crop.\n// HA >= 0.2 * (HA + HB + HC); HB >= 0.2 * (HA + HB + HC); HC >= 0.2 * (HA + HB + HC)",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to maximize its profit while considering the varying yields and market prices. The yield and selling price for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton |\n|------|-------------------|-----------------------|\n| A    | 5 tons            | $100                  |\n| B    | 7 tons            | $120                  |\n| C    | 6 tons            | $110                  |\n\nThe farm aims to maximize its total revenue from selling the crops. The total land available for cultivation is 100 hectares. The farm has a limited water supply, which affects the yields. For each hectare of Crop A, 2 units of water are required, for Crop B, 3 units are required, and for Crop C, 2.5 units are required. The total water available is 250 units. The farm wants to ensure diversity in its crops to mitigate risk. It decides to allocate at least 20% of the land to each crop.\n\nPlease help the farm to maximize its total revenue from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"CONTINUOUS\", name=\"HA\", lb=0) # hectares of crop A\nHB = model.addVar(vtype=\"CONTINUOUS\", name=\"HB\", lb=0) # hectares of crop B\nHC = model.addVar(vtype=\"CONTINUOUS\", name=\"HC\", lb=0) # hectares of crop C\n\n# Define objective function\nRevenue_A = 5 * 100 * HA\nRevenue_B = 7 * 120 * HB\nRevenue_C = 6 * 110 * HC\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total land available for cultivation is 100 hectares.\nmodel.addCons(HA + HB + HC <= 100)\n# The farm has a limited water supply, which affects the yields.\nmodel.addCons(2 * HA + 3 * HB + 2.5 * HC <= 250)\n# The farm wants to ensure diversity in its crops to mitigate risk.\nmodel.addCons(HA >= 0.2 * (HA + HB + HC))\nmodel.addCons(HB >= 0.2 * (HA + HB + HC))\nmodel.addCons(HC >= 0.2 * (HA + HB + HC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin.\n// {\"production quantity of MachineA\": \"MachineA_Qty\", \"range\": \"MachineA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineB\": \"MachineB_Qty\", \"range\": \"MachineB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineC\": \"MachineC_Qty\", \"range\": \"MachineC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Qty), Cost_B = 300 * sqrt(MachineB_Qty), Cost_C = 400 * sqrt(MachineC_Qty). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Qty), Cost_B = 300 * sqrt(MachineB_Qty), Cost_C = 400 * sqrt(MachineC_Qty). The company wants to maximize the total net profit. The company has a total production capacity of 100 machines per month. Please help the company determine the optimal production quantity for each machine to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Qty\", lb=0) # production quantity of MachineA\nMachineB_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Qty\", lb=0) # production quantity of MachineB\nMachineC_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Qty\", lb=0) # production quantity of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Qty = model.addVar(name=\"sqrt_MachineA_Qty\")\nsqrt_MachineB_Qty = model.addVar(name=\"sqrt_MachineB_Qty\")\nsqrt_MachineC_Qty = model.addVar(name=\"sqrt_MachineC_Qty\")\nmodel.addCons(sqrt_MachineA_Qty**2 == MachineA_Qty)\nmodel.addCons(sqrt_MachineB_Qty**2 == MachineB_Qty)\nmodel.addCons(sqrt_MachineC_Qty**2 == MachineC_Qty)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Qty) * MachineA_Qty\nProfit_B = (700 - 300 * sqrt_MachineB_Qty) * MachineB_Qty\nProfit_C = (900 - 400 * sqrt_MachineC_Qty) * MachineC_Qty\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 100 machines per month.\nmodel.addCons(MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of MachineA: \", model.getVal(MachineA_Qty))\n    print(\"Production Quantity of MachineB: \", model.getVal(MachineB_Qty))\n    print(\"Production Quantity of MachineC: \", model.getVal(MachineC_Qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations. The costs for fuel, maintenance, and driver wages for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Cost | Maintenance Cost | Driver Wages |\n|------------|-----------|-----------------|--------------|\n| TruckA     | $5000     | $2000           | $3000        |\n| TruckB     | $6000     | $2500           | $3500        |\n| TruckC     | $7000     | $3000           | $4000        |\n\nThe company has a total budget of $500,000 for truck operations. Please help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 743,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit.\n// {\"number of units of WidgetA\": \"WidgetAUnits\", \"range\": \"WidgetAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetB\": \"WidgetBUnits\", \"range\": \"WidgetBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetC\": \"WidgetCUnits\", \"range\": \"WidgetCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\n// Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\n// Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit. The profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit. The company has a total production capacity of 500 units.\nPlease help the company determine the optimal number of units to produce for each widget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetAUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetAUnits\", lb=0) # number of units of WidgetA\nWidgetBUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetBUnits\", lb=0) # number of units of WidgetB\nWidgetCUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetCUnits\", lb=0) # number of units of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetAUnits == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (50 - 0.1 * WidgetA2) * WidgetA2 * WidgetA_b2 + 50 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=200)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=200, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetBUnits == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (70 - 0.05 * WidgetB2) * WidgetB2 * WidgetB_b2 + 70 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=300)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=300, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetCUnits == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (90 - 0.02 * WidgetC2) * WidgetC2 * WidgetC_b2 + 90 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of WidgetA Units: \", model.getVal(WidgetAUnits))\n    print(\"Number of WidgetB Units: \", model.getVal(WidgetBUnits))\n    print(\"Number of WidgetC Units: \", model.getVal(WidgetCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands.\n// Production time for smartphones: T_S = 1000 / (10 * S)\n// Production time for tablets: T_T = 800 / (8 * T)\n// Production time for laptops: T_L = 500 / (5 * L)\n// So, the objective function is: Minimize max(T_S, T_T, T_L)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for all production lines.\n// S + T + L <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The efficiency of each production line is as follows:\n\n| Device     | Production Efficiency per Worker (per hour) |\n|------------|---------------------------------------------|\n| Smartphones| 10 smartphones                             |\n| Tablets    | 8 tablets                                  |\n| Laptops    | 5 laptops                                  |\n\nThe manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands. There are a total of 50 workers available for all production lines.\n\nPlease help the manufacturer determine the optimal allocation of workers to each production line to minimize the maximum production time required to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_S = 1000 / (10 * S)\nT_T = 800 / (8 * T)\nT_L = 500 / (5 * L)\n## convert the division to multiplication\nmodel.addCons(obj >= T_S)\nmodel.addCons(obj >= T_T)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 50 workers available for all production lines.\nmodel.addCons(S + T + L <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company aims to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * UnitsA) * UnitsB\n// Profit_C = (100 - 0.2 * UnitsB) * UnitsC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total for all devices.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC.\n// 20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company has a production capacity of 500 units in total for all devices. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n\n## Profit_B = (70 - 0.05 * UnitsA) * UnitsB\nProfit_B = (70 - 0.05 * UnitsA) * UnitsB\n\n## Profit_C = (100 - 0.2 * UnitsB) * UnitsC\nProfit_C = (100 - 0.2 * UnitsB) * UnitsC\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a production capacity of 500 units in total for all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n## Due to market demand, the production of DeviceA must be at least twice the production of DeviceB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC.\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is limited to 200 units.\n// A <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor. The profit per unit, cost of raw materials, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost | Labor Cost |\n|---------|-----------------|-------------------|------------|\n| A       | $50             | $10               | $5         |\n| B       | $70             | $15               | $7         |\n| C       | $90             | $20               | $10        |\n\nThe company has a budget of $10,000 for raw materials and labor. The production capacity for product A is limited to 200 units. \nPlease help the company to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons((10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C) <= 10000)\n## The production capacity for product A is limited to 200 units.\nmodel.addCons(A <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 873,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\n// Cost_A = 10 - 0.5 * Automation\n// Cost_B = 15 - 0.5 * Automation\n// Revenue_A = 20 * QA\n// Revenue_B = 25 * QB\n// Total_Cost = Cost_A * QA + Cost_B * QB\n// Total_Revenue = Revenue_A + Revenue_B\n// Profit = Total_Revenue - Total_Cost\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// QA + QB <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for implementing automation.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\n// QA <= 500",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The cost and revenue per unit for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| A       | $10           | $20              |\n| B       | $15           | $25              |\n\nImplementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company has a total production capacity of 1000 units for both products combined. The company has a budget of $5000 for implementing automation. The market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=5000) # level of automation\n\n# Define objective function\nCost_A = 10 - 0.5 * Automation\nCost_B = 15 - 0.5 * Automation\nRevenue_A = 20 * QA\nRevenue_B = 25 * QB\nTotal_Cost = Cost_A * QA + Cost_B * QB\nTotal_Revenue = Revenue_A + Revenue_B\nProfit = Total_Revenue - Total_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QA + QB <= 1000)\nmodel.addCons(Automation <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBUnits <= 2 * ComponentAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ComponentA is $20, for ComponentB is $30, and for ComponentC is $40.\n// 20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30,000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for each component and the conditions under which the profit decreases are as follows:\n\n| Component | Profit per Unit | Decrease in Profit | Threshold Units |\n|-----------|-----------------|--------------------|-----------------|\n| ComponentA | $50             | $1 per unit       | 100 units       |\n| ComponentB | $70             | $0.5 per unit     | 200 units       |\n| ComponentC | $100            | $2 per unit       | 150 units       |\n\nThe company has a total production capacity of 500 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. The company has a budget of $30,000 for raw materials for the month, with the cost of raw materials per unit for ComponentA being $20, for ComponentB being $30, and for ComponentC being $40.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=0) # number of units of ComponentA\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=0) # number of units of ComponentB\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2 + 50 * ComponentA1 * ComponentA_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2 + 70 * ComponentB1 * ComponentB_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2 + 100 * ComponentC1 * ComponentC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\nmodel.addCons(ComponentBUnits <= 2 * ComponentAUnits)\nmodel.addCons(20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\n// Profit_A = 20 * A - 0.05 * (3 * A)\n// Profit_B = 30 * B - 0.05 * (2 * B)\n// Profit_C = 40 * C - 0.05 * (4 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of the critical component, with only 1000 units available.\n// 3 * A + 2 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each device are produced to maintain market presence.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 300 units across all devices.\n// A + B + C <= 300\n\n## Generate Constraint-4:\nThe company has a policy to produce no more than twice the quantity of any device compared to another.\n// |A - B| <= 50; |A - C| <= 50; |B - C| <= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. For Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices. The company has a limited supply of the critical component, with only 1000 units available. The company wants to ensure that at least 50 units of each device are produced to maintain market presence. The total production capacity of the company is limited to 300 units across all devices. The company has a policy to produce no more than twice the quantity of any device compared to another. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of device C\n\n# Define objective function\nProfit_A = 20 * A - 0.05 * (3 * A)\nProfit_B = 30 * B - 0.05 * (2 * B)\nProfit_C = 40 * C - 0.05 * (4 * C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 2 * B + 4 * C <= 1000) # Constraint-1\nmodel.addCons(A + B + C <= 300) # Constraint-3\n\n# Constraint-2: Ensure at least 50 units of each device are produced\nmodel.addCons(A >= 50)\nmodel.addCons(B >= 50)\nmodel.addCons(C >= 50)\n\n# Constraint-4: Produce no more than twice the quantity of any device compared to another\nmodel.addCons(abs(A - B) <= 50)\nmodel.addCons(abs(A - C) <= 50)\nmodel.addCons(abs(B - C) <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer aims to maximize the profit per unit of energy consumed.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer has a budget of $10,000 for production costs.\nPlease help the manufacturer to maximize the profit per unit of energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nEnergyConsumption = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / EnergyConsumption\n## convert the division to multiplication\nmodel.addCons(obj * EnergyConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Energy Consumed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 676,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200\n\n## Generate Constraint-2:\nThe level of automation cannot exceed $5000.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe total production quantity of all products must not exceed 500 units.\n// PA + PB + PC <= 500\n\n## Generate Constraint-4:\nThe company has a budget constraint for automation, which cannot exceed $3000.\n// Automation <= 3000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | 50 - Automation          |\n| B       | 70 - Automation          |\n| C       | 60 - Automation          |\n\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. The level of automation cannot exceed $5000. The total production quantity of all products must not exceed 500 units. The company has a budget constraint for automation, which cannot exceed $3000.\n\nPlease help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(PA >= 100)\nmodel.addCons(PB >= 150)\nmodel.addCons(PC >= 200)\nmodel.addCons(Automation <= 5000)\nmodel.addCons(PA + PB + PC <= 500)\nmodel.addCons(Automation <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\n// {\"temperature setting for greenhouse A\": \"T_A\", \"range\": \"0 <= T_A <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse B\": \"T_B\", \"range\": \"0 <= T_B <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse C\": \"T_C\", \"range\": \"0 <= T_C <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n// Yield of greenhouse A: Yield_A = (T_A^2 / 100) - (T_A - 50)^2\n// Yield of greenhouse B: Yield_B = (T_B^2 / 100) - (T_B - 70)^2\n// Yield of greenhouse C: Yield_C = (T_C^2 / 100) - (T_C - 60)^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\n\n## Generate Constraint-1:\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2.\n// T_A^2 + T_B^2 + T_C^2 <= 150\n\n## Generate Constraint-2:\nThe temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\n// T_A >= T_B + 10",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield. The yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The total energy consumption for all greenhouses must not exceed 150 energy units, where the energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2. Additionally, the temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B. Please help the farm to maximize the total yield from all greenhouses.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0, ub=100) # temperature setting for greenhouse A\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0, ub=100) # temperature setting for greenhouse B\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0, ub=100) # temperature setting for greenhouse C\n\n# Define objective function\nYield_A = (T_A**2 / 100) - (T_A - 50)**2\nYield_B = (T_B**2 / 100) - (T_B - 70)**2\nYield_C = (T_C**2 / 100) - (T_C - 60)**2\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n# The total energy consumption for all greenhouses must not exceed 150 energy units.\nmodel.addCons(T_A**2 + T_B**2 + T_C**2 <= 150)\n# The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\nmodel.addCons(T_A >= T_B + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Temperature Setting for Greenhouse A: \", model.getVal(T_A))\n    print(\"Temperature Setting for Greenhouse B: \", model.getVal(T_B))\n    print(\"Temperature Setting for Greenhouse C: \", model.getVal(T_C))\n    print(\"Maximized Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 937,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * P1 = 20 * P1\n// Profit_P2 = (40 - 15) * P2 = 25 * P2\n// Profit_P3 = (50 - 20) * P3 = 30 * P3\n// So, the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\n\n## Generate Constraint-1:\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\n// P1 <= 40; P2 <= 30; P3 <= 50\n\n## Generate Constraint-3:\nThe market demand for P1 is at least 10 units, and the plant must meet this demand.\n// P1 >= 10",
        "question": "A manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| P1      | $30             | $10                      |\n| P2      | $40             | $15                      |\n| P3      | $50             | $20                      |\n\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total. The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3. The market demand for P1 is at least 10 units, and the plant must meet this demand.\nPlease help the plant to maximize the total profit by determining the optimal number of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = 20 * P1\nProfit_P2 = 25 * P2\nProfit_P3 = 30 * P3\n## the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season.\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Beans\": \"BeansAcres\", \"range\": \"BeansAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor Beans, the expected profit per acre is $300, the water usage per acre is 1500 gallons, and the labor cost per acre is $75. \nFor Wheat, the expected profit per acre is $400, the water usage per acre is 1800 gallons, and the labor cost per acre is $90.\nThe farmer aims to maximize the net profit per gallon of water used.\n// Net profit for Corn: Profit_Corn = (500 - 100) * CornAcres\n// Net profit for Beans: Profit_Beans = (300 - 75) * BeansAcres\n// Net profit for Wheat: Profit_Wheat = (400 - 90) * WheatAcres\n// So, the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / (2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// CornAcres + BeansAcres + WheatAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\n// BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres)",
        "question": "A farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop   | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|--------|--------------------------|----------------------|---------------------|\n| Corn   | $500                     | 2000 gallons         | $100                |\n| Beans  | $300                     | 1500 gallons         | $75                 |\n| Wheat  | $400                     | 1800 gallons         | $90                 |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans. The farmer aims to maximize the net profit per gallon of water used. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nBeansAcres = model.addVar(vtype=\"INTEGER\", name=\"BeansAcres\", lb=0) # number of acres for Beans\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # number of acres for Wheat\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (500 - 100) * CornAcres\nProfit_Beans = (300 - 75) * BeansAcres\nProfit_Wheat = (400 - 90) * WheatAcres\nWaterUsage = 2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres\n## the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Beans + Profit_Wheat)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(CornAcres + BeansAcres + WheatAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\nmodel.addCons(BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Beans: \", model.getVal(BeansAcres))\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, component B is $40, and component C is $50. The production cost per unit of component A is $10, component B is $20, and component C is $30. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost.\n// Revenue from A: Revenue_A = 30 * A\n// Revenue from B: Revenue_B = 40 * B\n// Revenue from C: Revenue_C = 50 * C\n// Cost of A: Cost_A = 10 * A\n// Cost of B: Cost_B = 20 * B\n// Cost of C: Cost_C = 30 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of component A requires 2 hours, component B requires 3 hours, and component C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 20 units per week, and for component B and C, it is at least 15 units per week.\n// A >= 20; B >= 15; C >= 15",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand. The profit per unit, production cost per unit, and production time for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Production Time |\n|-----------|-----------------|--------------------------|-----------------|\n| A         | $30             | $10                      | 2 hours         |\n| B         | $40             | $20                      | 3 hours         |\n| C         | $50             | $30                      | 4 hours         |\n\nThe company has a limited production capacity of 1000 hours per week. The market demand for component A is at least 20 units per week, and for component B and C, it is at least 15 units per week. Please help the company to maximize its total profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of component C\n\n# Define objective function\nRevenue_A = 30 * A\nRevenue_B = 40 * B\nRevenue_C = 50 * C\nCost_A = 10 * A\nCost_B = 20 * B\nCost_C = 30 * C\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n# The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1073,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n// Profit from Crop A: Profit_A = (5 * 100 - 300) * A\n// Profit from Crop B: Profit_B = (7 * 120 - 400) * B\n// Profit from Crop C: Profit_C = (6 * 110 - 350) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\nThe farm has a total of 100 acres available for cultivation.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 - 300) * A\nProfit_B = (7 * 120 - 400) * B\nProfit_C = (6 * 110 - 350) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of E1 is $100, the production time per unit is 1 hour, and the raw material cost per unit is $40. \nFor E2, the revenue per unit is $120, the production time per unit is 2 hours, and the raw material cost per unit is $50. \nFor E3, the revenue per unit is $150, the production time per unit is 3 hours, and the raw material cost per unit is $60.\nThe manufacturer has a limited production capacity and wants to maximize the profit per hour of production time.\n// Profit_E1 = 100 * Q1 - 40 * Q1\n// Profit_E2 = 120 * Q2 - 50 * Q2\n// Profit_E3 = 150 * Q3 - 60 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time. The revenue per unit, production time per unit, and raw material cost per unit for each component are given in the following Table.\n\n| Component | Revenue per Unit | Production Time per Unit | Raw Material Cost per Unit |\n|-----------|------------------|--------------------------|----------------------------|\n| E1        | $100             | 1 hour                   | $40                        |\n| E2        | $120             | 2 hours                  | $50                        |\n| E3        | $150             | 3 hours                  | $60                        |\n\nThe manufacturer has a total production time of 200 hours. The manufacturer wants to maximize the profit per hour of production time. Please help the manufacturer determine the optimal production quantities for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (100 - 40) * Q1\nProfit_E2 = (120 - 50) * Q2\nProfit_E3 = (150 - 60) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop and whether to invest in a new irrigation system that will affect the water usage and yield of each crop. The yield and market price for each crop are given in the following Table.\n\n| Crop | Yield (kg/acre) | Market Price ($/kg) |\n|------|-----------------|---------------------|\n| A    | 500             | 2                   |\n| B    | 700             | 3                   |\n| C    | 900             | 4                   |\n\nThe investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n\nThe farmer has a total of 100 acres available for planting. The total investment in the irrigation system cannot exceed $10,000.\n\nPlease help the farmer to maximize the net profit from the crops, considering both the revenue and the water cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\n# The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n# The total investment in the irrigation system cannot exceed $10,000.\nmodel.addCons(Irrigation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company has a total budget of $500,000 for truck operations.\nPlease help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 639,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost. The total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month. Please help the company to determine the optimal production quantities for products A, B, and C to maximize their total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n## Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500,000\n\n## Generate Constraint-3:\nThe farm has a budget of $20,000 for fertilizer costs.\n// 200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20,000\n\n## Generate Constraint-4:\nDue to soil conditions, the area for CropA must be at least half of the area for CropB.\n// CropA_Area >= 0.5 * CropB_Area\n\n## Generate Constraint-5:\nThe farm must allocate at least 10 hectares to each crop to maintain crop diversity.\n// CropA_Area >= 10; CropB_Area >= 10; CropC_Area >= 10",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. The expected profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop   | Expected Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|--------|-----------------------------|-------------------------|-----------------------------|\n| CropA  | $1000                       | 5000 liters             | $200                        |\n| CropB  | $1200                       | 6000 liters             | $250                        |\n| CropC  | $1500                       | 7000 liters             | $300                        |\n\nThe farm has a total area of 100 hectares available for cultivation. The farm has a limited water supply of 500,000 liters. The farm has a budget of $20,000 for fertilizer costs. Due to soil conditions, the area for CropA must be at least half of the area for CropB. The farm must allocate at least 10 hectares to each crop to maintain crop diversity.\n\nPlease help the farm to maximize the net profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=10) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=10) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=10) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500000)\n## The farm has a budget of $20,000 for fertilizer costs.\nmodel.addCons(200 * CropA_Area + 250 * CropB_Area + 300 * CropC_Area <= 20000)\n## Due to soil conditions, the area for CropA must be at least half of the area for CropB.\nmodel.addCons(CropA_Area >= 0.5 * CropB_Area)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency.\n// Profit_A = 50 * A * (1 - 0.01 * A)\n// Profit_B = 70 * B * (1 - 0.01 * B)\n// Profit_C = 90 * C * (1 - 0.01 * C)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe production capacity is limited to a total of 300 units across all products.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nAt least 50 units of product A must be produced to meet contractual obligations.\n// A >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency.\n\n| Product | Profit per Unit | Raw Material Cost |\n|---------|-----------------|-------------------|\n| A       | $50             | $20               |\n| B       | $70             | $30               |\n| C       | $90             | $40               |\n\nThe company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40. The production capacity is limited to a total of 300 units across all products. At least 50 units of product A must be produced to meet contractual obligations.\n\nPlease help the company to maximize the total profit considering these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = 50 * A * (1 - 0.01 * A)\n## Profit_B = 70 * B * (1 - 0.01 * B)\n## Profit_C = 90 * C * (1 - 0.01 * C)\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == 50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n\n# Add constraints\n## The company has a total budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The production capacity is limited to a total of 300 units across all products.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1235,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements from distributors.\n// A + B + C >= 200",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. Product A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature. Product B has a unit profit of $70, with a storage cost of $5 per unit. Product C has a unit profit of $60, with no storage cost. The company wants to maximize its net profit, which is the total profit minus the total storage cost. The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively. The company must also produce at least 200 units in total to meet the minimum order requirements from distributors. Please help the company determine the optimal number of units to produce for each product to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements from distributors.\nmodel.addCons(A + B + C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// Product1 + Product2 <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// Technology <= 50000\n\n## Generate Constraint-3:\nThe production quantity of Product 1 must be at least 200 units.\n// Product1 >= 200\n\n## Generate Constraint-4:\nThe production quantity of Product 2 must be at least 150 units.\n// Product2 >= 150",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products. The new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. The production quantity of Product 1 must be at least 200 units. The production quantity of Product 2 must be at least 150 units. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=200)  # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=150)  # production quantity of Product 2\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0)  # investment in new technology\n\n# Define objective function\n# Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n# Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n# So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\nProfit1 = (150 - (100 - 0.0005 * Technology)) * Product1\nProfit2 = (200 - (150 - 0.0005 * Technology)) * Product2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2)\n\n# Add constraints\n# The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(Product1 + Product2 <= 1000)\n# The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(Technology <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products.\n// Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n// So, the objective function is: Maximize \\(P_{total}\\)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// \\(Q_a + Q_b + Q_c \\leq 1000\\)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per month. Please help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## The profit from each product is influenced by a nonlinear relationship between production quantity and market demand.\nPa = 100 * Qa - 0.1 * Qa**2\nPb = 150 * Qb - 0.2 * Qb**2\nPc = 200 * Qc - 0.3 * Qc**2\nPtotal = Pa + Pb + Pc\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Ptotal\nmodel.addCons(obj == Ptotal)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A has a profit of $30, requires 2 hours of labor, and uses 1 unit of raw material. \nEach device B has a profit of $40, requires 3 hours of labor, and uses 2 units of raw material. \nEach device C has a profit of $50, requires 4 hours of labor, and uses 3 units of raw material.\nThe company aims to maximize the profit per unit of labor and raw material used.\n// Profit from A: Profit_A = 30 * A\n// Profit from B: Profit_B = 40 * B\n// Profit from C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for raw materials.\n// A + 2 * B + 3 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a total of 150 labor hours available.\n// 2 * A + 3 * B + 4 * C <= 150",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity of each device to optimize its resources. Each device A has a profit of $30, requires 2 hours of labor, and uses 1 unit of raw material. Each device B has a profit of $40, requires 3 hours of labor, and uses 2 units of raw material. Each device C has a profit of $50, requires 4 hours of labor, and uses 3 units of raw material. The company has a budget of $1000 for raw materials and a total of 150 labor hours available. The company aims to maximize the profit per unit of labor and raw material used. Please help the company determine the optimal production quantities for devices A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nTotalLaborAndMaterial = 2 * A + 3 * B + 4 * C + A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalLaborAndMaterial\n## convert the division to multiplication\nmodel.addCons(obj * TotalLaborAndMaterial == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for raw materials.\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n## The company has a total of 150 labor hours available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 723,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize their total power output while considering the limitations of each farm and the total budget.\n// {\"number of turbines in farm 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach turbine in farm 1 generates 50 units of power, in farm 2 generates 60 units of power, and in farm 3 generates 70 units of power. The company aims to maximize the total power output from all farms.\n// Total power output = 50 * T1 + 60 * T2 + 70 * T3\n// Objective function: Maximize (50 * T1 + 60 * T2 + 70 * T3)\n\n## Generate Constraint-1:\nThe total budget allows for a maximum of 50 turbines across all farms.\n// T1 + T2 + T3 <= 50\n\n## Generate Constraint-2:\nEach farm has a limited space, allowing for a maximum of 20 turbines.\n// T1 <= 20; T2 <= 20; T3 <= 20",
        "question": "A company operates three different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize their total power output while considering the limitations of each farm and the total budget. The power output per turbine in each farm is given in the following Table.\n\n| Farm | Power Output per Turbine |\n|------|--------------------------|\n| 1    | 50 units                  |\n| 2    | 60 units                  |\n| 3    | 70 units                  |\n\nThe total budget allows for a maximum of 50 turbines across all farms. Each farm has a limited space, allowing for a maximum of 20 turbines. Please help the company to maximize the total power output from all farms.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of turbines in farm 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of turbines in farm 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of turbines in farm 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * T1 + 60 * T2 + 70 * T3)\nmodel.addCons(obj == 50 * T1 + 60 * T2 + 70 * T3)\n\n# Add constraints\n## The total budget allows for a maximum of 50 turbines across all farms.\nmodel.addCons(T1 + T2 + T3 <= 50)\n## Each farm has a limited space, allowing for a maximum of 20 turbines.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 20)\nmodel.addCons(T3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines in Farm 1: \", model.getVal(T1))\n    print(\"Number of Turbines in Farm 2: \", model.getVal(T2))\n    print(\"Number of Turbines in Farm 3: \", model.getVal(T3))\n    print(\"Maximized Total Power Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 727,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand.\n// Production cost of product 1: C1 = 50 - 0.002 * Automation * P1\n// Production cost of product 2: C2 = 70 - 0.002 * Automation * P2\n// Production cost of product 3: C3 = 90 - 0.002 * Automation * P3\n// Total production cost: Cost = C1 + C2 + C3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3.\n// P1 >= 100; P2 >= 150; P3 >= 200",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand. The company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=100) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=150) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=200) # production quantity of product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nC1 = 50 - 0.002 * Automation * P1\nC2 = 70 - 0.002 * Automation * P2\nC3 = 90 - 0.002 * Automation * P3\nCost = C1 + C2 + C3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n# No additional constraints are provided in the scenario\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of properties: residential, commercial, and industrial. They need to determine the number of each type of property to build in a new development area.\n// {\"number of residential properties\": \"Residential\", \"range\": \"Residential >= 0\", \"type\": \"integer\"}\n// {\"number of commercial properties\": \"Commercial\", \"range\": \"Commercial >= 0\", \"type\": \"integer\"}\n// {\"number of industrial properties\": \"Industrial\", \"range\": \"Industrial >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe developer estimates that each residential property will generate a profit of $50,000, each commercial property will generate a profit of $100,000, and each industrial property will generate a profit of $75,000. However, the profit per property decreases nonlinearly as the number of properties of each type increases due to market saturation. The profit function is given by:\n- Residential Profit = 50,000 * Residential / (1 + 0.05 * Residential)\n- Commercial Profit = 100,000 * Commercial / (1 + 0.03 * Commercial)\n- Industrial Profit = 75,000 * Industrial / (1 + 0.04 * Industrial)\nThe developer wants to maximize the total profit from all properties.\n// So, the objective function is: Maximize (Residential Profit + Commercial Profit + Industrial Profit)\n\n## Generate Constraint-1:\nThe developer has a budget of $5,000,000 for construction costs. The cost to build each residential property is $30,000, each commercial property is $60,000, and each industrial property is $45,000.\n// 30,000 * Residential + 60,000 * Commercial + 45,000 * Industrial <= 5,000,000\n\n## Generate Constraint-2:\nDue to zoning regulations, the total number of commercial and industrial properties cannot exceed the number of residential properties.\n// Commercial + Industrial <= Residential",
        "question": "A real estate developer is planning to build three types of properties: residential, commercial, and industrial. They need to determine the number of each type of property to build in a new development area. The developer estimates that each residential property will generate a profit of $50,000, each commercial property will generate a profit of $100,000, and each industrial property will generate a profit of $75,000. However, the profit per property decreases nonlinearly as the number of properties of each type increases due to market saturation. The profit function is given by:\n- Residential Profit = 50,000 * Residential / (1 + 0.05 * Residential)\n- Commercial Profit = 100,000 * Commercial / (1 + 0.03 * Commercial)\n- Industrial Profit = 75,000 * Industrial / (1 + 0.04 * Industrial)\nThe developer has a budget of $5,000,000 for construction costs. The cost to build each residential property is $30,000, each commercial property is $60,000, and each industrial property is $45,000. Due to zoning regulations, the total number of commercial and industrial properties cannot exceed the number of residential properties.\nPlease help the developer to maximize the total profit from all properties.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nResidential = model.addVar(vtype=\"INTEGER\", name=\"Residential\", lb=0)  # number of residential properties\nCommercial = model.addVar(vtype=\"INTEGER\", name=\"Commercial\", lb=0)  # number of commercial properties\nIndustrial = model.addVar(vtype=\"INTEGER\", name=\"Industrial\", lb=0)  # number of industrial properties\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Residential Profit = 50,000 * Residential / (1 + 0.05 * Residential)\n## convert the division to multiplication\nResidential_Profit = model.addVar('Residential_Profit')\nmodel.addCons(Residential_Profit * (1 + 0.05 * Residential) == 50000 * Residential)\n\n## Commercial Profit = 100,000 * Commercial / (1 + 0.03 * Commercial)\n## convert the division to multiplication\nCommercial_Profit = model.addVar('Commercial_Profit')\nmodel.addCons(Commercial_Profit * (1 + 0.03 * Commercial) == 100000 * Commercial)\n\n## Industrial Profit = 75,000 * Industrial / (1 + 0.04 * Industrial)\n## convert the division to multiplication\nIndustrial_Profit = model.addVar('Industrial_Profit')\nmodel.addCons(Industrial_Profit * (1 + 0.04 * Industrial) == 75000 * Industrial)\n\n## the objective function is: Maximize (Residential Profit + Commercial Profit + Industrial Profit)\nmodel.addCons(obj == Residential_Profit + Commercial_Profit + Industrial_Profit)\n\n# Add constraints\n## The developer has a budget of $5,000,000 for construction costs.\nmodel.addCons(30000 * Residential + 60000 * Commercial + 45000 * Industrial <= 5000000)\n\n## Due to zoning regulations, the total number of commercial and industrial properties cannot exceed the number of residential properties.\nmodel.addCons(Commercial + Industrial <= Residential)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Residential Properties: \", model.getVal(Residential))\n    print(\"Number of Commercial Properties: \", model.getVal(Commercial))\n    print(\"Number of Industrial Properties: \", model.getVal(Industrial))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1206,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost). The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. Please help the farmer determine the optimal quantity of each crop to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 40) * B\nProfit_C = (200 - 50) * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 676,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000\n\n## Generate Constraint-3:\nThe production rate for Product 1 must be at least 10 units per hour.\n// P1 >= 10\n\n## Generate Constraint-4:\nThe production rate for Product 2 must be at least 20 units per hour.\n// P2 >= 20",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| 1       | $100                    | $150          |\n| 2       | $100                    | $150          |\n| 3       | $100                    | $150          |\n\nThe company aims to maximize the total profit from all products. The total production rate for all products cannot exceed 100 units per hour. The investment in advanced machinery cannot exceed $50,000. The production rate for Product 1 must be at least 10 units per hour, and the production rate for Product 2 must be at least 20 units per hour.\n\nPlease help the company to determine the optimal production rates for each product and the investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=20) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in Advanced Machinery: \", model.getVal(Machinery))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit.\n// {\"hours of operation for production line A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The goal is to maximize the total profit from all three lines.\n// The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\n\n## Generate Constraint-1:\nThe total hours of operation for all three lines cannot exceed 100 hours per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A.\n// A >= 5\n\n## Generate Constraint-3:\nThe minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B.\n// B >= 5",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit. Each hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The total hours of operation for all three lines cannot exceed 100 hours per day. The minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A. The minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B. Please help the plant manager to maximize the total profit from all three lines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"hours of operation for production line A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n## {\"hours of operation for production line B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n## {\"hours of operation for production line C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=5) # hours of operation for production line A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=5) # hours of operation for production line B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hours of operation for production line C\n\n# Define objective function\n## The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C.\nProfit_A = 100 * A - 0.1 * A**2\nProfit_B = 150 * B - 0.2 * B**2\nProfit_C = 200 * C - 0.3 * C**2\n## The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total hours of operation for all three lines cannot exceed 100 hours per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Production Line A: \", model.getVal(A))\n    print(\"Hours of Operation for Production Line B: \", model.getVal(B))\n    print(\"Hours of Operation for Production Line C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency.\n// Profit_A = 50 * A * (1 - 0.01 * A)\n// Profit_B = 70 * B * (1 - 0.01 * B)\n// Profit_C = 90 * C * (1 - 0.01 * C)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe production capacity is limited to a total of 300 units across all products.\n// A + B + C <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency. The company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40. The production capacity is limited to a total of 300 units across all products. Please help the company to maximize the total profit (Profit_A + Profit_B + Profit_C).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit per unit is multiplied by a factor of (1 - 0.01 * quantity)\nProfit_A = 50 * A * (1 - 0.01 * A)\nProfit_B = 70 * B * (1 - 0.01 * B)\nProfit_C = 90 * C * (1 - 0.01 * C)\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The production capacity is limited to a total of 300 units across all products.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow crops: Plot A, Plot B, and Plot C. He needs to decide how many acres to allocate to each crop type.\n// {\"acres on Plot A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres on Plot B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres on Plot C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer grows wheat, corn, and soybeans on these plots. The profit per acre varies with the plot and crop type. \nOn Plot A, the profit per acre for wheat is $100, for corn is $120, and for soybeans is $90. \nOn Plot B, the profit per acre for wheat is $110, for corn is $130, and for soybeans is $100. \nOn Plot C, the profit per acre for wheat is $90, for corn is $100, and for soybeans is $80. \nThe farmer wants to maximize the total profit from all plots.\n// Profit_A = 100 * A + 120 * A + 90 * A\n// Profit_B = 110 * B + 130 * B + 100 * B\n// Profit_C = 90 * C + 100 * C + 80 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available land is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seed and fertilizer, which is $10,000. The cost per acre for Plot A is $50, for Plot B is $60, and for Plot C is $40.\n// 50 * A + 60 * B + 40 * C <= 10000",
        "question": "A farmer has three plots of land where he can grow crops: Plot A, Plot B, and Plot C. He needs to decide how many acres to allocate to each crop type. The farmer grows wheat, corn, and soybeans on these plots. The profit per acre varies with the plot and crop type. On Plot A, the profit per acre for wheat is $100, for corn is $120, and for soybeans is $90. On Plot B, the profit per acre for wheat is $110, for corn is $130, and for soybeans is $100. On Plot C, the profit per acre for wheat is $90, for corn is $100, and for soybeans is $80. The farmer wants to maximize the total profit from all plots. The total available land is 100 acres. The farmer has a limited budget for seed and fertilizer, which is $10,000. The cost per acre for Plot A is $50, for Plot B is $60, and for Plot C is $40. Please help the farmer determine the optimal allocation of acres to maximize his total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres on Plot A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres on Plot B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres on Plot C\n\n# Define objective function\nProfit_A = 100 * A + 120 * A + 90 * A\nProfit_B = 110 * B + 130 * B + 100 * B\nProfit_C = 90 * C + 100 * C + 80 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total available land is 100 acres.\nmodel.addCons(A + B + C <= 100)\n# The farmer has a limited budget for seed and fertilizer, which is $10,000.\nmodel.addCons(50 * A + 60 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres on Plot A: \", model.getVal(A))\n    print(\"Acres on Plot B: \", model.getVal(B))\n    print(\"Acres on Plot C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations.\n// {\"number of trucks on RouteA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks on RouteC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to maximize its profit from transportation services. The profit per truck on RouteA is $5000, on RouteB is $7000, and on RouteC is $9000. However, the operational cost increases nonlinearly with the number of trucks on each route due to congestion and maintenance issues. The operational cost for RouteA is $2000 + 0.1 * (TrucksA^2), for RouteB is $3000 + 0.15 * (TrucksB^2), and for RouteC is $4000 + 0.2 * (TrucksC^2).\n// Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n// Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n// Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, RouteA must have at least half as many trucks as RouteB.\n// TrucksA >= 0.5 * TrucksB\n\n## Generate Constraint-3:\nThe company has a maintenance budget that limits the total operational cost to $150,000.\n// (2000 + 0.1 * (TrucksA^2)) * TrucksA + (3000 + 0.15 * (TrucksB^2)) * TrucksB + (4000 + 0.2 * (TrucksC^2)) * TrucksC <= 150,000",
        "question": "A logistics company is managing three different routes for cargo transportation: RouteA, RouteB, and RouteC. They need to determine the number of trucks to allocate to each route to optimize their operations. The profit per truck and the operational cost for each route are given in the following Table.\n\n| Route   | Profit per Truck | Operational Cost Formula                  |\n|---------|------------------|------------------------------------------|\n| RouteA  | $5000            | $2000 + 0.1 * (TrucksA^2)               |\n| RouteB  | $7000            | $3000 + 0.15 * (TrucksB^2)              |\n| RouteC  | $9000            | $4000 + 0.2 * (TrucksC^2)               |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, RouteA must have at least half as many trucks as RouteB. The company has a maintenance budget that limits the total operational cost to $150,000.\n\nPlease help the company to maximize its profit from transportation services by determining the optimal number of trucks to allocate to each route.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0)  # number of trucks on RouteA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0)  # number of trucks on RouteB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0)  # number of trucks on RouteC\n\n# Define objective function\n## Total profit for RouteA: ProfitA = (5000 - (2000 + 0.1 * (TrucksA^2))) * TrucksA\n## Total profit for RouteB: ProfitB = (7000 - (3000 + 0.15 * (TrucksB^2))) * TrucksB\n## Total profit for RouteC: ProfitC = (9000 - (4000 + 0.2 * (TrucksC^2))) * TrucksC\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nProfitA = (5000 - (2000 + 0.1 * TrucksA**2)) * TrucksA\nProfitB = (7000 - (3000 + 0.15 * TrucksB**2)) * TrucksB\nProfitC = (9000 - (4000 + 0.2 * TrucksC**2)) * TrucksC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## Due to contractual agreements, RouteA must have at least half as many trucks as RouteB.\nmodel.addCons(TrucksA >= 0.5 * TrucksB)\n## The company has a maintenance budget that limits the total operational cost to $150,000.\nmodel.addCons((2000 + 0.1 * TrucksA**2) * TrucksA + (3000 + 0.15 * TrucksB**2) * TrucksB + (4000 + 0.2 * TrucksC**2) * TrucksC <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks on RouteA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks on RouteB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks on RouteC: \", model.getVal(TrucksC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production line efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate of all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in enhancing the production line efficiency cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nThe production rate of each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| 1       | $100                    | $150          |\n| 2       | $100                    | $150          |\n| 3       | $100                    | $150          |\n\nThe company aims to maximize the total profit from all products. The total production rate of all products must not exceed 100 units per hour. The investment in enhancing the production line efficiency cannot exceed $50,000. The production rate of each product must be at least 10 units per hour.\n\nPlease help the company determine the optimal production rates for each product and the investment in enhancing the production line efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate of product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production line efficiency\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate of all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in enhancing the production line efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in Production Line Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production.\n// {\"operating hours for reactor 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach reactor has a different efficiency in producing the chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The plant aims to maximize the total production of all chemicals.\n// Total production of A: P_A = 10 * H1 + 15 * H2 + 20 * H3\n// Total production of B: P_B = 15 * H1 + 20 * H2 + 25 * H3\n// Total production of C: P_C = 20 * H1 + 25 * H2 + 30 * H3\n// The objective function is: Maximize (P_A + P_B + P_C)\n\n## Generate Constraint-1:\nThe total operating hours for all reactors must not exceed 100 hours per week.\n// H1 + H2 + H3 <= 100\n\n## Generate Constraint-2:\nThe maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000. The cost for Reactor 1 is $50 per hour, for Reactor 2 is $60 per hour, and for Reactor 3 is $70 per hour.\n// 50 * H1 + 60 * H2 + 70 * H3 <= 5000\n\n## Generate Constraint-3:\nDue to safety regulations, no reactor can operate for more than 40 hours per week.\n// H1 <= 40; H2 <= 40; H3 <= 40",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production. The efficiency of each reactor in producing the chemicals is given in the following Table.\n\n| Reactor | Units of A per Hour | Units of B per Hour | Units of C per Hour |\n|---------|---------------------|---------------------|---------------------|\n| 1       | 10                  | 15                  | 20                  |\n| 2       | 15                  | 20                  | 25                  |\n| 3       | 20                  | 25                  | 30                  |\n\nThe total operating hours for all reactors must not exceed 100 hours per week. The maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000. The cost for Reactor 1 is $50 per hour, for Reactor 2 is $60 per hour, and for Reactor 3 is $70 per hour. Due to safety regulations, no reactor can operate for more than 40 hours per week.\n\nPlease help the manager to maximize the total production of all chemicals (A, B, and C).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # operating hours for reactor 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # operating hours for reactor 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # operating hours for reactor 3\n\n# Define objective function\nP_A = 10 * H1 + 15 * H2 + 20 * H3\nP_B = 15 * H1 + 20 * H2 + 25 * H3\nP_C = 20 * H1 + 25 * H2 + 30 * H3\n# The objective function is: Maximize (P_A + P_B + P_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# The total operating hours for all reactors must not exceed 100 hours per week.\nmodel.addCons(H1 + H2 + H3 <= 100)\n# The maintenance cost of each reactor is proportional to its operating hours, and the total maintenance budget is limited to $5000.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 <= 5000)\n# Due to safety regulations, no reactor can operate for more than 40 hours per week.\nmodel.addCons(H1 <= 40)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Reactor 1: \", model.getVal(H1))\n    print(\"Operating hours for Reactor 2: \", model.getVal(H2))\n    print(\"Operating hours for Reactor 3: \", model.getVal(H3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre.\nFor Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre.\nFor Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n// Total profit: Profit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\n// Total water usage: Water = 200 * Wheat + 250 * Corn + 150 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for seeds and fertilizers.\n// (10 * Wheat) + (12 * Corn) + (15 * Soybeans) <= 5000",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season. For Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre. For Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre. For Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops). The farmer has 100 acres of land available for planting and a budget of $5000 for seeds and fertilizers. Please help the farmer determine the optimal number of acres to plant for each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # number of acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # number of acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\nWater = 200 * Wheat + 250 * Corn + 150 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget of $5000 for seeds and fertilizers.\nmodel.addCons(10 * Wheat + 12 * Corn + 15 * Soybeans <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n// Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n// So, the objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs. Each machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost. The company has a total of 25 machines available for allocation. Please help the company to maximize the total production output minus the total maintenance cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\n## Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n## Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n## So, the objective function is: Maximize (Output - Cost)\nOutput = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\nCost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product.\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints.\n// {\"production rate of ChemX\": \"ChemXRate\", \"range\": \"ChemXRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemY\": \"ChemYRate\", \"range\": \"ChemYRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemZ\": \"ChemZRate\", \"range\": \"ChemZRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, ChemY is $150, and ChemZ is $200. The production cost per unit of ChemX is $50, ChemY is $70, and ChemZ is $100. The company wants to maximize the total profit.\n// Profit_ChemX = (100 - 50) * ChemXRate\n// Profit_ChemY = (150 - 70) * ChemYRate\n// Profit_ChemZ = (200 - 100) * ChemZRate\n// So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per hour.\n// ChemXRate + ChemYRate + ChemZRate <= 100\n\n## Generate Constraint-2:\nDue to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\n// ChemYRate <= 2 * ChemXRate\n\n## Generate Constraint-3:\nThe company has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units.\n// ChemXRate + ChemZRate <= 120",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints. The profit per unit and production cost per unit for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Cost per Unit |\n|----------|-----------------|--------------------------|\n| ChemX    | $100            | $50                      |\n| ChemY    | $150            | $70                      |\n| ChemZ    | $200            | $100                     |\n\nThe total production capacity of the company is limited to 100 units per hour. Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX. The company also has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units.\n\nPlease help the company to maximize the total profit by determining the optimal production rates for ChemX, ChemY, and ChemZ.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemXRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemXRate\", lb=0) # production rate of ChemX\nChemYRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemYRate\", lb=0) # production rate of ChemY\nChemZRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemZRate\", lb=0) # production rate of ChemZ\n\n# Define objective function\nProfit_ChemX = (100 - 50) * ChemXRate\nProfit_ChemY = (150 - 70) * ChemYRate\nProfit_ChemZ = (200 - 100) * ChemZRate\n# So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per hour.\nmodel.addCons(ChemXRate + ChemYRate + ChemZRate <= 100)\n# Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\nmodel.addCons(ChemYRate <= 2 * ChemXRate)\n# The company has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units.\nmodel.addCons(ChemXRate + ChemZRate <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemX: \", model.getVal(ChemXRate))\n    print(\"Production Rate of ChemY: \", model.getVal(ChemYRate))\n    print(\"Production Rate of ChemZ: \", model.getVal(ChemZRate))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n// Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\n// Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\n// Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation.\nPlease help the farm determine the optimal allocation of acres to each crop to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=1, ub=100)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=1, ub=100)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 1)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 598,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of ComponentA per machine is 10 units per hour, with a defect rate of 5%. ComponentB per machine produces 15 units per hour with a defect rate of 3%. ComponentC per machine produces 20 units per hour with a defect rate of 2%. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate.\n// Effective production rate for ComponentA: RateA = 10 * (1 - 0.05) * MachinesA\n// Effective production rate for ComponentB: RateB = 15 * (1 - 0.03) * MachinesB\n// Effective production rate for ComponentC: RateC = 20 * (1 - 0.02) * MachinesC\n// So, the objective function is: Maximize (RateA + RateB + RateC)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output. The production rate and defect rate per machine for each component are given in the following Table.\n\n| Component | Production Rate per Machine | Defect Rate |\n|-----------|------------------------------|-------------|\n| ComponentA | 10 units per hour           | 5%          |\n| ComponentB | 15 units per hour           | 3%          |\n| ComponentC | 20 units per hour           | 2%          |\n\nThe company aims to maximize the total effective production rate, which is the total production rate minus the defect rate. The company has a total of 50 machines available for allocation.\nPlease help the company determine the optimal allocation of machines to each component production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\nRateA = 10 * (1 - 0.05) * MachinesA\nRateB = 15 * (1 - 0.03) * MachinesB\nRateC = 20 * (1 - 0.02) * MachinesC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RateA + RateB + RateC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Effective Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of two different products, Product A and Product B, and the amount of money to be invested in a new technology that reduces production costs.\n// {\"production level of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost of each unit by $2 for every $10,000 invested. The initial production cost for Product A is $50 per unit and for Product B is $70 per unit. The selling price for Product A is $100 per unit and for Product B is $120 per unit. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\n// Total profit for Product B: ProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\n// So, the objective function is: Maximize TotalProfit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product A.\n// ProductA >= 200\n\n## Generate Constraint-4:\nThe company must produce at least 150 units of Product B.\n// ProductB >= 150",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of two different products, Product A and Product B, as well as the amount of money to be invested in a new technology that reduces production costs. The initial production cost, selling price, and the effect of the new technology on production costs are detailed in the following Table.\n\n| Product | Initial Production Cost | Selling Price | Effect of Tech Investment |\n|---------|-------------------------|---------------|---------------------------|\n| A       | $50 per unit            | $100 per unit | $2 reduction per $10,000  |\n| B       | $70 per unit            | $120 per unit | $2 reduction per $10,000  |\n\nThe company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. The company must produce at least 200 units of Product A and at least 150 units of Product B. \n\nPlease help the company to maximize the total profit from both products, considering the reduction in production costs due to the investment in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200)  # production level of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=150)  # production level of Product B\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfitA = (100 - (50 - 0.0002 * TechInvestment)) * ProductA\nProfitB = (120 - (70 - 0.0002 * TechInvestment)) * ProductB\nTotalProfit = ProfitA + ProfitB\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)  # total production capacity constraint\nmodel.addCons(TechInvestment <= 50000)  # investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProductA))\n    print(\"Production Level of Product B: \", model.getVal(ProductB))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands.\n// Production time for smartphones: T_S = 1000 / (10 * S)\n// Production time for tablets: T_T = 800 / (8 * T)\n// Production time for laptops: T_L = 500 / (5 * L)\n// So, the objective function is: Minimize max(T_S, T_T, T_L)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for all production lines.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// S <= 20; T <= 20; L <= 20\n\n## Generate Constraint-3:\nThe manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\n// S >= 5; T >= 5; L >= 5",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. Each worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands.\n\n| Device     | Production Efficiency per Worker (per hour) |\n|------------|---------------------------------------------|\n| Smartphones| 10                                          |\n| Tablets    | 8                                           |\n| Laptops    | 5                                           |\n\nThere are a total of 50 workers available for all production lines. Each production line can accommodate a maximum of 20 workers. The manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to minimize the total production time required to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=5) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production time for smartphones: T_S = 1000 / (10 * S)\n## Production time for tablets: T_T = 800 / (8 * T)\n## Production time for laptops: T_L = 500 / (5 * L)\n## So, the objective function is: Minimize max(T_S, T_T, T_L)\n## Convert the division to multiplication\nT_S = model.addVar(vtype=\"CONTINUOUS\", name=\"T_S\")\nT_T = model.addVar(vtype=\"CONTINUOUS\", name=\"T_T\")\nT_L = model.addVar(vtype=\"CONTINUOUS\", name=\"T_L\")\nmodel.addCons(T_S == 1000 / (10 * S))\nmodel.addCons(T_T == 800 / (8 * T))\nmodel.addCons(T_L == 500 / (5 * L))\n## Minimize the maximum of T_S, T_T, T_L\nmodel.addCons(obj >= T_S)\nmodel.addCons(obj >= T_T)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 50 workers available for all production lines.\nmodel.addCons(S + T + L <= 50)\n## Each production line can accommodate a maximum of 20 workers.\nmodel.addCons(S <= 20)\nmodel.addCons(T <= 20)\nmodel.addCons(L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1296,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for Product A is limited to 300 units due to machinery constraints.\n// A <= 300",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit and the cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $50             | $20           |\n| B       | $70             | $30           |\n| C       | $60             | $25           |\n\nThe company has a limited budget of $15,000 for production costs. The company must produce at least 200 units in total to meet the minimum order requirements. The production capacity for Product A is limited to 300 units due to machinery constraints.\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n# The company must produce at least 200 units in total to meet the minimum order requirements.\nmodel.addCons(A + B + C >= 200)\n# The production capacity for Product A is limited to 300 units due to machinery constraints.\nmodel.addCons(A <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturing plant incurs different costs for producing each component. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The plant also has a fixed overhead cost of $500 per day. The plant aims to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost divided by the total number of units produced.\n// Variable cost of A: Cost_A = 10 * A\n// Variable cost of B: Cost_B = 15 * B\n// Variable cost of C: Cost_C = 20 * C\n// Total cost: Total_Cost = (Cost_A + Cost_B + Cost_C + 500) / (A + B + C)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C + 500 <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each component to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency. The cost of producing each component and the fixed overhead cost are given in the following Table.\n\n| Component | Production Cost per Unit |\n|-----------|--------------------------|\n| A         | $10                      |\n| B         | $15                      |\n| C         | $20                      |\n\nThe plant has a daily budget of $1000 for production costs, including a fixed overhead cost of $500 per day. The plant must produce at least 50 units of each component to meet contractual obligations. \n\nPlease help the plant to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost divided by the total number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each component to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nTotal_Cost = Cost_A + Cost_B + Cost_C + 500\nTotal_Units = A + B + C\n## the objective function is: Minimize Total_Cost / Total_Units\n## convert the division to multiplication\nmodel.addCons(obj * Total_Units == Total_Cost)\n\n# Add constraints\n## The plant has a daily budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 500 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000\n\n## Generate Constraint-2:\nDue to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentB <= 2 * ComponentA\n\n## Generate Constraint-3:\nThe market demand for ComponentC is limited to 500 units.\n// ComponentC <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ComponentA and 100 units of ComponentB to fulfill contractual obligations.\n// ComponentA >= 50; ComponentB >= 100",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company has a total production capacity of 1000 units across all components. Due to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA. The market demand for ComponentC is limited to 500 units. The company must produce at least 50 units of ComponentA and 100 units of ComponentB to fulfill contractual obligations.\nPlease help the company to maximize the total profit from the sales of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=50)  # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=100)  # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0, ub=500)  # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * ComponentA_b2 + 10 * ComponentA1 * ComponentA_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * ComponentB_b2 + 15 * ComponentB1 * ComponentB_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * ComponentC_b2 + 20 * ComponentC1 * ComponentC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\nmodel.addCons(ComponentB <= 2 * ComponentA)\nmodel.addCons(ComponentC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide the amount of raw materials (flour) to allocate to each type of bread and the number of hours of labor to invest in each production line.\n// {\"amount of flour for wheat bread\": \"Flour_W\", \"range\": \"Flour_W >= 0\", \"type\": \"continuous\"}\n// {\"amount of flour for rye bread\": \"Flour_R\", \"range\": \"Flour_R >= 0\", \"type\": \"continuous\"}\n// {\"amount of flour for sourdough bread\": \"Flour_S\", \"range\": \"Flour_S >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for wheat bread\": \"Labor_W\", \"range\": \"Labor_W >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for rye bread\": \"Labor_R\", \"range\": \"Labor_R >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for sourdough bread\": \"Labor_S\", \"range\": \"Labor_S >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe bakery aims to maximize its profit from selling the bread. The profit from wheat bread is $5 per kg of flour, from rye bread is $6 per kg of flour, and from sourdough bread is $7 per kg of flour. The labor cost is $10 per hour. The bakery's profit function is nonlinear due to the varying profit rates per kg of flour for different bread types.\n// Profit_W = 5 * Flour_W - 10 * Labor_W\n// Profit_R = 6 * Flour_R - 10 * Labor_R\n// Profit_S = 7 * Flour_S - 10 * Labor_S\n// Total Profit = Profit_W + Profit_R + Profit_S\n// So, the objective function is: Maximize Total Profit\n\n## Generate Constraint-1:\nThe total amount of flour available is 1000 kg.\n// Flour_W + Flour_R + Flour_S <= 1000",
        "question": "A bakery wants to optimize its production of three types of bread: wheat, rye, and sourdough. The bakery needs to decide the amount of raw materials (flour) to allocate to each type of bread and the number of hours of labor to invest in each production line. The profit from wheat bread is $5 per kg of flour, from rye bread is $6 per kg of flour, and from sourdough bread is $7 per kg of flour. The labor cost is $10 per hour. The bakery's profit function is nonlinear due to the varying profit rates per kg of flour for different bread types.\n\n| Bread Type | Profit per kg of Flour | Labor Cost per Hour |\n|------------|-------------------------|---------------------|\n| Wheat      | $5                      | $10                 |\n| Rye        | $6                      | $10                 |\n| Sourdough  | $7                      | $10                 |\n\nThe total amount of flour available is 1000 kg. The bakery aims to maximize its profit from selling the bread. Please help the bakery determine the optimal allocation of flour and labor hours to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlour_W = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_W\", lb=0) # amount of flour for wheat bread\nFlour_R = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_R\", lb=0) # amount of flour for rye bread\nFlour_S = model.addVar(vtype=\"CONTINUOUS\", name=\"Flour_S\", lb=0) # amount of flour for sourdough bread\nLabor_W = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_W\", lb=0) # labor hours for wheat bread\nLabor_R = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_R\", lb=0) # labor hours for rye bread\nLabor_S = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor_S\", lb=0) # labor hours for sourdough bread\n\n# Define objective function\nProfit_W = 5 * Flour_W - 10 * Labor_W\nProfit_R = 6 * Flour_R - 10 * Labor_R\nProfit_S = 7 * Flour_S - 10 * Labor_S\nTotal_Profit = Profit_W + Profit_R + Profit_S\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\n# The total amount of flour available is 1000 kg.\nmodel.addCons(Flour_W + Flour_R + Flour_S <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Flour for Wheat Bread: \", model.getVal(Flour_W))\n    print(\"Amount of Flour for Rye Bread: \", model.getVal(Flour_R))\n    print(\"Amount of Flour for Sourdough Bread: \", model.getVal(Flour_S))\n    print(\"Labor Hours for Wheat Bread: \", model.getVal(Labor_W))\n    print(\"Labor Hours for Rye Bread: \", model.getVal(Labor_R))\n    print(\"Labor Hours for Sourdough Bread: \", model.getVal(Labor_S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per month.\n// B >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost. The total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month. The market demand for product B is at least 150 units per month. Please help the company to determine the optimal production quantities for products A, B, and C to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n## Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// PA <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 50 hours per week.\n// PB <= 50\n\n## Generate Constraint-4:\nThe production line C can operate for a maximum of 60 hours per week.\n// PC <= 60",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production. Each hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit. The total operational hours for all lines must not exceed 120 hours per week. The production line A can operate for a maximum of 40 hours per week. The production line B can operate for a maximum of 50 hours per week. The production line C can operate for a maximum of 60 hours per week. Please help the company to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# So, the objective function is: Maximize (VA + VB + VC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n# The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(PA <= 40)\n# The production line B can operate for a maximum of 50 hours per week.\nmodel.addCons(PB <= 50)\n# The production line C can operate for a maximum of 60 hours per week.\nmodel.addCons(PC <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Maximized Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for both products is $30. The revenue generated per unit of Product A is $100 and for Product B is $150. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\n// Total profit for Product B: ProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\n// So, the objective function is: Maximize Profit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced. The energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for both products is $30. The revenue generated per unit of Product A is $100 and for Product B is $150. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined. The total investment in energy efficiency upgrades cannot exceed $50,000. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of Product B\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\nProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// Product1 + Product2 <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// Technology <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantities of two different products and the investment in a new technology that can improve the efficiency of both products. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|----------------------------------|------------------------|\n| 1       | $100                             | $150                   |\n| 2       | $150                             | $200                   |\n\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. \n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=0) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0) # production quantity of Product 2\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * Technology)) * Product1\n## Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * Technology)) * Product2\n## So, the objective function is: Maximize TotalProfit = Profit1 + Profit2\nProfit1 = (150 - (100 - 0.0005 * Technology)) * Product1\nProfit2 = (200 - (150 - 0.0005 * Technology)) * Product2\nTotalProfit = Profit1 + Profit2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(Product1 + Product2 <= 1000)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(Technology <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\n// Profit_A = 20 * A - 0.05 * (3 * A)\n// Profit_B = 30 * B - 0.05 * (2 * B)\n// Profit_C = 40 * C - 0.05 * (4 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of the critical component, with only 1000 units available.\n// 3 * A + 2 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to ensure that at least 50 units of each device are produced to maintain market presence.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 300 units across all devices.\n// A + B + C <= 300",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. The profit per unit and the required units of a critical component for each device are given in the following Table.\n\n| Device | Profit per Unit | Units of Critical Component |\n|--------|-----------------|-----------------------------|\n| A      | $20             | 3                           |\n| B      | $30             | 2                           |\n| C      | $40             | 4                           |\n\nThe company has a limited supply of the critical component, with only 1000 units available. The company wants to ensure that at least 50 units of each device are produced to maintain market presence. The total production capacity of the company is limited to 300 units across all devices. \nPlease help the company to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each device are produced to maintain market presence.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of device C\n\n# Define objective function\n## For Device A, the profit per unit is $20, but it requires 3 units of a critical component.\n## For Device B, the profit per unit is $30, requiring 2 units of the same critical component.\n## For Device C, the profit per unit is $40, requiring 4 units of the critical component.\n## The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\nProfit_A = 20 * A - 0.05 * (3 * A)\nProfit_B = 30 * B - 0.05 * (2 * B)\nProfit_C = 40 * C - 0.05 * (4 * C)\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of the critical component, with only 1000 units available.\nmodel.addCons(3 * A + 2 * B + 4 * C <= 1000)\n## The total production capacity of the company is limited to 300 units across all devices.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1077,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue from Wheat is $100 per acre, from Corn is $150 per acre, and from Soybeans is $120 per acre. However, due to soil degradation, the yield per acre decreases nonlinearly with the increase in the total acres of a crop. The yield reduction factor is 0.95 for each additional acre of the same crop above 100 acres. The farm aims to maximize its total revenue from all crops.\n// Revenue_Wheat = 100 * max(Wheat * 0.95^(Wheat - 100), Wheat)\n// Revenue_Corn = 150 * max(Corn * 0.95^(Corn - 100), Corn)\n// Revenue_Soybeans = 120 * max(Soybeans * 0.95^(Soybeans - 100), Soybeans)\n// So, the objective function is: Maximize Revenue_Wheat + Revenue_Corn + Revenue_Soybeans\n\n## Generate Constraint-1:\nThe farm has a total of 500 acres available for cultivation.\n// Wheat + Corn + Soybeans <= 500\n\n## Generate Constraint-2:\nDue to labor constraints, the farm can only manage a maximum of 200 acres of Wheat.\n// Wheat <= 200",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively. The revenue from Wheat is $100 per acre, from Corn is $150 per acre, and from Soybeans is $120 per acre. However, due to soil degradation, the yield per acre decreases nonlinearly with the increase in the total acres of a crop. The yield reduction factor is 0.95 for each additional acre of the same crop above 100 acres. The farm aims to maximize its total revenue from all crops. The farm has a total of 500 acres available for cultivation. Due to labor constraints, the farm can only manage a maximum of 200 acres of Wheat. Please help the farm to determine the optimal allocation of acres to Wheat, Corn, and Soybeans to maximize its total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm needs to decide how many acres to allocate to each crop to optimize its revenue and manage resources effectively.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0, ub=200) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Revenue_Wheat = 100 * max(Wheat * 0.95^(Wheat - 100), Wheat)\nWheat1 = model.addVar(vtype=\"INTEGER\", name=\"Wheat1\", lb=0, ub=100)\nWheat2 = model.addVar(vtype=\"INTEGER\", name=\"Wheat2\", lb=100, ub=200)\nWheat_b1 = model.addVar(vtype=\"B\", name=\"Wheat_b1\")\nWheat_b2 = model.addVar(vtype=\"B\", name=\"Wheat_b2\")\nmodel.addCons(Wheat_b1 + Wheat_b2 == 1)\nmodel.addCons(Wheat == Wheat1*Wheat_b1 + Wheat2*Wheat_b2)\nRevenue_Wheat = 100 * Wheat1 * Wheat_b1 + 100 * Wheat2 * Wheat_b2\n## create piecewise variables for piecewise function: Revenue_Corn = 150 * max(Corn * 0.95^(Corn - 100), Corn)\nCorn1 = model.addVar(vtype=\"INTEGER\", name=\"Corn1\", lb=0, ub=100)\nCorn2 = model.addVar(vtype=\"INTEGER\", name=\"Corn2\", lb=100, ub=500)\nCorn_b1 = model.addVar(vtype=\"B\", name=\"Corn_b1\")\nCorn_b2 = model.addVar(vtype=\"B\", name=\"Corn_b2\")\nmodel.addCons(Corn_b1 + Corn_b2 == 1)\nmodel.addCons(Corn == Corn1*Corn_b1 + Corn2*Corn_b2)\nRevenue_Corn = 150 * Corn1 * Corn_b1 + 150 * Corn2 * Corn_b2\n## create piecewise variables for piecewise function: Revenue_Soybeans = 120 * max(Soybeans * 0.95^(Soybeans - 100), Soybeans)\nSoybeans1 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans1\", lb=0, ub=100)\nSoybeans2 = model.addVar(vtype=\"INTEGER\", name=\"Soybeans2\", lb=100, ub=500)\nSoybeans_b1 = model.addVar(vtype=\"B\", name=\"Soybeans_b1\")\nSoybeans_b2 = model.addVar(vtype=\"B\", name=\"Soybeans_b2\")\nmodel.addCons(Soybeans_b1 + Soybeans_b2 == 1)\nmodel.addCons(Soybeans == Soybeans1*Soybeans_b1 + Soybeans2*Soybeans_b2)\nRevenue_Soybeans = 120 * Soybeans1 * Soybeans_b1 + 120 * Soybeans2 * Soybeans_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Revenue_Wheat + Revenue_Corn + Revenue_Soybeans\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n## The farm has a total of 500 acres available for cultivation.\nmodel.addCons(Wheat + Corn + Soybeans <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency. The profit function is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit.\n// Formal definition: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency, and is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit. The total labor hours available are 1000 hours and the total machine hours available are 800 hours. Please help the company determine the optimal allocation of labor hours (L), machine hours (M), and raw materials (R) to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\nmodel.addCons(obj == 1000 * L**0.5 * M**0.6 * R**0.4 - 500 * (L + M + R))\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 697,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of ComponentA is $50, but it requires a setup cost of $1000. The profit from each unit of ComponentB is $70, with a setup cost of $1500. The profit from each unit of ComponentC is $90, with a setup cost of $2000. The company wants to maximize their total profit, considering the setup costs.\n// Total profit from ComponentA: ProfitA = (50 * UnitsA) - 1000\n// Total profit from ComponentB: ProfitB = (70 * UnitsB) - 1500\n// Total profit from ComponentC: ProfitC = (90 * UnitsC) - 2000\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit. The profit per unit and the setup costs for each component are given in the following Table.\n\n| Component | Profit per Unit | Setup Cost |\n|-----------|-----------------|------------|\n| ComponentA | $50             | $1000      |\n| ComponentB | $70             | $1500      |\n| ComponentC | $90             | $2000      |\n\nThe company has a limited production capacity of 1000 units per month. The company wants to maximize their total profit, considering the setup costs. Please help the company determine the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit from ComponentA: ProfitA = (50 * UnitsA) - 1000\n## Total profit from ComponentB: ProfitB = (70 * UnitsB) - 1500\n## Total profit from ComponentC: ProfitC = (90 * UnitsC) - 2000\nProfitA = 50 * UnitsA - 1000\nProfitB = 70 * UnitsB - 1500\nProfitC = 90 * UnitsC - 2000\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a limited production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 774,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nTo ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\n// T >= 0.5 * V",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\nPlease help the company to maximize the total weekly profit while considering the purchase costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n## Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n## So, the objective function is: Maximize (Profit - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000 * T + 7000 * V + 3000 * B - (50000 * T + 30000 * V + 5000 * B))\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\nmodel.addCons(T >= 0.5 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 786,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the production process is such that the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (50 * A / (1 + 0.01 * A^2) + 70 * B / (1 + 0.02 * B^2) + 90 * C / (1 + 0.03 * C^2))\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand. The profit per unit of component A is $50, component B is $70, and component C is $90. However, the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components. The total production capacity of the factory is limited to 1000 units per week. Please help the company to maximize the total profit from all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with nonlinear terms\nProfit_A = 50 * A / (1 + 0.01 * A**2)\nProfit_B = 70 * B / (1 + 0.02 * B**2)\nProfit_C = 90 * C / (1 + 0.03 * C**2)\n\n## Convert the nonlinear terms to linear constraints\n## Introduce new variables and constraints to linearize the denominator\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\n## Update the profit functions with the new variables\nProfit_A = 50 * A / (1 + 0.01 * A_sq)\nProfit_B = 70 * B / (1 + 0.02 * B_sq)\nProfit_C = 90 * C / (1 + 0.03 * C_sq)\n\n## Convert the division to multiplication\nmodel.addCons(obj * (1 + 0.01 * A_sq) == 50 * A)\nmodel.addCons(obj * (1 + 0.02 * B_sq) == 70 * B)\nmodel.addCons(obj * (1 + 0.03 * C_sq) == 90 * C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters.\nFor Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters.\nFor Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters.\nThe farmer wants to maximize the profit-to-water ratio (profit per liter of water used).\n// Profit_Wheat = 500 * 0.20 * Wheat\n// Profit_Corn = 700 * 0.25 * Corn\n// Profit_Soybeans = 400 * 0.30 * Soybeans\n// Water_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 800 * Corn + 300 * Soybeans <= 50000",
        "question": "A farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\nFor Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters.\nFor Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters.\nFor Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters.\nThe farmer has 100 acres available for planting and a total of 50,000 liters of water available for irrigation.\nPlease help the farmer to maximize the profit-to-water ratio (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to dedicate to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 500 * 0.20 * Wheat\nProfit_Corn = 700 * 0.25 * Corn\nProfit_Soybeans = 400 * 0.30 * Soybeans\nWater_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n## convert the division to multiplication\nmodel.addCons(obj * Water_Used == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 800 * Corn + 300 * Soybeans <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow crops: Plot A, Plot B, and Plot C. He needs to decide how many acres to allocate to each crop type.\n// {\"acres on Plot A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres on Plot B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres on Plot C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer grows wheat, corn, and soybeans on these plots. The profit per acre varies with the plot and crop type. \nOn Plot A, the profit per acre for wheat is $100, for corn is $120, and for soybeans is $90. \nOn Plot B, the profit per acre for wheat is $110, for corn is $130, and for soybeans is $100. \nOn Plot C, the profit per acre for wheat is $90, for corn is $100, and for soybeans is $80. \nThe farmer wants to maximize the total profit from all plots.\n// Profit_A = 100 * A + 120 * A + 90 * A\n// Profit_B = 110 * B + 130 * B + 100 * B\n// Profit_C = 90 * C + 100 * C + 80 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total available land is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seed and fertilizer, which is $10,000. The cost per acre for Plot A is $50, for Plot B is $60, and for Plot C is $40.\n// 50 * A + 60 * B + 40 * C <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat is limited to 50 acres.\n// A + B + C <= 50\n\n## Generate Constraint-4:\nThe farmer must allocate at least 20 acres to soybeans.\n// A + B + C >= 20",
        "question": "A farmer has three plots of land where he can grow crops: Plot A, Plot B, and Plot C. He needs to decide how many acres to allocate to each crop type. The profit per acre and the cost per acre for each plot are given in the following Table.\n\n| Plot | Profit per Acre for Wheat | Profit per Acre for Corn | Profit per Acre for Soybeans | Cost per Acre |\n|------|---------------------------|--------------------------|------------------------------|---------------|\n| A    | $100                      | $120                     | $90                          | $50           |\n| B    | $110                      | $130                     | $100                         | $60           |\n| C    | $90                       | $100                     | $80                          | $40           |\n\nThe farmer wants to maximize the total profit from all plots. The total available land is 100 acres. The farmer has a limited budget for seed and fertilizer, which is $10,000. The market demand for wheat is limited to 50 acres. The farmer must allocate at least 20 acres to soybeans.\n\nPlease help the farmer determine the optimal allocation of acres to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres on Plot A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres on Plot B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres on Plot C\n\n# Define objective function\nProfit_A = 100 * A + 120 * A + 90 * A\nProfit_B = 110 * B + 130 * B + 100 * B\nProfit_C = 90 * C + 100 * C + 80 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total available land is 100 acres.\nmodel.addCons(A + B + C <= 100)\n# The farmer has a limited budget for seed and fertilizer, which is $10,000.\nmodel.addCons(50 * A + 60 * B + 40 * C <= 10000)\n# The market demand for wheat is limited to 50 acres.\nmodel.addCons(A + B + C <= 50)\n# The farmer must allocate at least 20 acres to soybeans.\nmodel.addCons(A + B + C >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres on Plot A: \", model.getVal(A))\n    print(\"Acres on Plot B: \", model.getVal(B))\n    print(\"Acres on Plot C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1177,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of chemicals in their factory. They need to decide the amount of raw materials to allocate to each chemical production process to optimize their profit.\n// {\"amount of raw material for chemical 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit functions are nonlinear and are given by:\n- Profit from chemical 1: P1 = 100 * R1 - 0.5 * R1^2\n- Profit from chemical 2: P2 = 150 * R2 - 0.7 * R2^2\n- Profit from chemical 3: P3 = 200 * R3 - 0.9 * R3^2\nThe company wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of raw material available is 100 units.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nThe production of chemical 1 requires at least 10 units of raw material.\n// R1 >= 10",
        "question": "A company produces three types of chemicals in their factory and needs to decide the amount of raw materials to allocate to each chemical production process to optimize their profit. The profit from each chemical depends on the amount of raw material used, with the following profit functions:\n- Profit from chemical 1: P1 = 100 * R1 - 0.5 * R1^2\n- Profit from chemical 2: P2 = 150 * R2 - 0.7 * R2^2\n- Profit from chemical 3: P3 = 200 * R3 - 0.9 * R3^2\nThe company wants to maximize the total profit from all three chemicals. The total amount of raw material available is 100 units. The production of chemical 1 requires at least 10 units of raw material.\nPlease help the company determine the optimal allocation of raw materials to each chemical to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=10) # amount of raw material for chemical 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for chemical 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for chemical 3\n\n# Define objective function\nP1 = 100 * R1 - 0.5 * R1**2\nP2 = 150 * R2 - 0.7 * R2**2\nP3 = 200 * R3 - 0.9 * R3**2\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize P = P1 + P2 + P3\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total amount of raw material available is 100 units.\nmodel.addCons(R1 + R2 + R3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Chemical 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Chemical 3: \", model.getVal(R3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season. For CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. For CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. For CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200. The farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage). The farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. Please help the farm determine the optimal allocation of acres to each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=0) # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=0) # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products.\n// Total profit for product A: PA = 50 * 10 * MA\n// Total profit for product B: PB = 30 * 15 * MB\n// Total profit for product C: PC = 40 * 12 * MC\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nThe production of product A must not exceed 2000 units per hour.\n// 50 * MA <= 2000\n\n## Generate Constraint-3:\nThe production of product B must not exceed 1500 units per hour.\n// 30 * MB <= 1500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product. Each machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products. The manufacturer has a total of 50 machines available. The production of product A must not exceed 2000 units per hour. The production of product B must not exceed 1500 units per hour. Please help the manufacturer determine the optimal number of machines for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\nPA = 50 * 10 * MA\nPB = 30 * 15 * MB\nPC = 40 * 12 * MC\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n# The production of product A must not exceed 2000 units per hour.\nmodel.addCons(50 * MA <= 2000)\n# The production of product B must not exceed 1500 units per hour.\nmodel.addCons(30 * MB <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"fertilizer per acre for wheat\": \"Fertilizer_Wheat\", \"range\": \"Fertilizer_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for corn\": \"Fertilizer_Corn\", \"range\": \"Fertilizer_Corn >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for soybeans\": \"Fertilizer_Soybeans\", \"range\": \"Fertilizer_Soybeans >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of wheat per acre increases by 100 kg for every kg of fertilizer used, up to a maximum of 5000 kg per acre. The yield of corn per acre increases by 150 kg for every kg of fertilizer used, up to a maximum of 6000 kg per acre. The yield of soybeans per acre increases by 80 kg for every kg of fertilizer used, up to a maximum of 4000 kg per acre. The farm aims to maximize the total yield of all crops.\n// Total yield of wheat: Yield_Wheat = (100 * Fertilizer_Wheat) * Wheat\n// Total yield of corn: Yield_Corn = (150 * Fertilizer_Corn) * Corn\n// Total yield of soybeans: Yield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n// So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n## Generate Constraint-1:\nThe total amount of fertilizer available for the season is 10,000 kg.\n// Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000\n\n## Generate Constraint-2:\nThe farm has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-3:\nThe farm wants to ensure that at least 20% of the total acres are dedicated to each crop.\n// Wheat >= 0.2 * (Wheat + Corn + Soybeans)\n// Corn >= 0.2 * (Wheat + Corn + Soybeans)\n// Soybeans >= 0.2 * (Wheat + Corn + Soybeans)",
        "question": "A farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans, and the amount of fertilizer to use per acre for each crop to optimize yield. The yield of each crop per acre increases with the amount of fertilizer used, as shown in the following Table.\n\n| Crop       | Yield Increase per kg of Fertilizer | Maximum Yield per Acre |\n|------------|------------------------------------|-----------------------|\n| Wheat      | 100 kg                             | 5000 kg               |\n| Corn       | 150 kg                             | 6000 kg               |\n| Soybeans   | 80 kg                              | 4000 kg               |\n\nThe farm has a total of 10,000 kg of fertilizer available for the season. The farm has 100 acres available for planting. The farm wants to ensure that at least 20% of the total acres are dedicated to each crop. Please help the farm to maximize the total yield of all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of soybeans\nFertilizer_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Wheat\", lb=0)  # fertilizer per acre for wheat\nFertilizer_Corn = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Corn\", lb=0)  # fertilizer per acre for corn\nFertilizer_Soybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Soybeans\", lb=0)  # fertilizer per acre for soybeans\n\n# Define objective function\nYield_Wheat = (100 * Fertilizer_Wheat) * Wheat\nYield_Corn = (150 * Fertilizer_Corn) * Corn\nYield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n# So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n# Add constraints\n# The total amount of fertilizer available for the season is 10,000 kg.\nmodel.addCons(Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000)\n# The farm has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The farm wants to ensure that at least 20% of the total acres are dedicated to each crop.\nmodel.addCons(Wheat >= 0.2 * (Wheat + Corn + Soybeans))\nmodel.addCons(Corn >= 0.2 * (Wheat + Corn + Soybeans))\nmodel.addCons(Soybeans >= 0.2 * (Wheat + Corn + Soybeans))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Fertilizer per acre for Wheat: \", model.getVal(Fertilizer_Wheat))\n    print(\"Fertilizer per acre for Corn: \", model.getVal(Fertilizer_Corn))\n    print(\"Fertilizer per acre for Soybeans: \", model.getVal(Fertilizer_Soybeans))\n    print(\"Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300\n\n## Generate Constraint-3:\nThe company has a total production capacity of 600 units across all chemicals.\n// A + B + C <= 600",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available. The company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units. The company also has a total production capacity of 600 units across all chemicals. Please help the company to maximize the total profit from the production of these chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # quantity of chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1128,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit.\n// {\"number of workers on component A line\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B line\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C line\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. \nEach worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. \nEach worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker.\nThe company aims to maximize the total profit from all three components.\n// The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n// The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n// The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit. Each worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. Each worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. Each worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker. The company has a total of 50 workers available and each production line can accommodate up to 20 workers. Please help the company to maximize the total profit from all three components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on component A line\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on component B line\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on component C line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n## The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n## The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n## Convert the non-linear terms to linear by introducing additional variables and constraints\nP1 = model.addVar(name=\"P1\")\nP2 = model.addVar(name=\"P2\")\nP3 = model.addVar(name=\"P3\")\nmodel.addCons(P1 == 100 * W1 * (1 - 0.01 * (W1 - 1)))\nmodel.addCons(P2 == 120 * W2 * (1 - 0.005 * (W2 - 1)))\nmodel.addCons(P3 == 150 * W3 * (1 - 0.02 * (W3 - 1)))\n\n## the objective function is: Maximize P = P1 + P2 + P3\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The company has a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n## Each production line can accommodate up to 20 workers.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Component A Line: \", model.getVal(W1))\n    print(\"Number of Workers on Component B Line: \", model.getVal(W2))\n    print(\"Number of Workers on Component C Line: \", model.getVal(W3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 797,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company wants to maximize the total net profit. The company has a total production capacity of 1000 units for all devices combined.\nPlease help the company determine the optimal quantity of each device to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n## Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n## Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nDeviceA_Cost = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Cost\")\nDeviceB_Cost = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Cost\")\nDeviceC_Cost = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Cost\")\n\nmodel.addCons(DeviceA_Cost == 0.01 * DeviceA_Quantity**2)\nmodel.addCons(DeviceB_Cost == 0.02 * DeviceB_Quantity**2)\nmodel.addCons(DeviceC_Cost == 0.03 * DeviceC_Quantity**2)\n\nProfit_DeviceA = (50 - DeviceA_Cost) * DeviceA_Quantity\nProfit_DeviceB = (70 - DeviceB_Cost) * DeviceB_Quantity\nProfit_DeviceC = (90 - DeviceC_Cost) * DeviceC_Quantity\n\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000\n\n## Generate Constraint-2:\nThe total production capacity across all devices is limited to 2000 units.\n// S + T + L <= 2000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced. The total production capacity across all devices is limited to 2000 units.\n\nPlease help the company determine the optimal number of units to produce for each device type to maximize profit within these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\nmodel.addCons(S + T + L <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop.\n// {\"area of land for CropA\": \"CropAArea\", \"range\": \"CropAArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropB\": \"CropBArea\", \"range\": \"CropBArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropC\": \"CropCArea\", \"range\": \"CropCArea >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400.\nThe farm wants to maximize the net profit per liter of water used.\n// Profit_CropA = 1000 * CropAArea - 200 * CropAArea\n// Profit_CropB = 1500 * CropBArea - 300 * CropBArea\n// Profit_CropC = 2000 * CropCArea - 400 * CropCArea\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// CropAArea + CropBArea + CropCArea <= 100",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop   | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|--------|---------------------|-------------------------|-----------------------------|\n| CropA  | $1000               | 5000 liters             | $200                        |\n| CropB  | $1500               | 7000 liters             | $300                        |\n| CropC  | $2000               | 9000 liters             | $400                        |\n\nThe farm has a total of 100 hectares of land available. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal area of land to allocate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropAArea\", lb=0) # area of land for CropA\nCropBArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropBArea\", lb=0) # area of land for CropB\nCropCArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropCArea\", lb=0) # area of land for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (1000 - 200) * CropAArea\nProfit_CropB = (1500 - 300) * CropBArea\nProfit_CropC = (2000 - 400) * CropCArea\nWaterUsage = 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(CropAArea + CropBArea + CropCArea <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for CropA: \", model.getVal(CropAArea))\n    print(\"Area of land for CropB: \", model.getVal(CropBArea))\n    print(\"Area of land for CropC: \", model.getVal(CropCArea))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin.\n// {\"production quantity of MachineA\": \"MachineA_Qty\", \"range\": \"MachineA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineB\": \"MachineB_Qty\", \"range\": \"MachineB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineC\": \"MachineC_Qty\", \"range\": \"MachineC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Qty), Cost_B = 300 * sqrt(MachineB_Qty), Cost_C = 400 * sqrt(MachineC_Qty). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineB_Qty <= 2 * MachineA_Qty\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs per month.\n// 200 * sqrt(MachineA_Qty) * MachineA_Qty + 300 * sqrt(MachineB_Qty) * MachineB_Qty + 400 * sqrt(MachineC_Qty) * MachineC_Qty <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each machine is produced to maintain market presence.\n// MachineA_Qty >= 1; MachineB_Qty >= 1; MachineC_Qty >= 1",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin. The profit per unit for each machine and the cost function due to economies of scale are given in the following Table.\n\n| Machine | Profit per Unit | Cost Function                |\n|---------|-----------------|------------------------------|\n| MachineA | $500           | 200 * sqrt(MachineA_Qty)     |\n| MachineB | $700           | 300 * sqrt(MachineB_Qty)     |\n| MachineC | $900           | 400 * sqrt(MachineC_Qty)     |\n\nThe company has a total production capacity of 100 machines per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget of $20,000 for production costs per month. The company wants to ensure that at least one unit of each machine is produced to maintain market presence.\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Qty\", lb=1)  # production quantity of MachineA\nMachineB_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Qty\", lb=1)  # production quantity of MachineB\nMachineC_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Qty\", lb=1)  # production quantity of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n# Approximating the square root function using a piecewise linear function\nMachineA_Sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineA_Sqrt\")\nMachineB_Sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineB_Sqrt\")\nMachineC_Sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineC_Sqrt\")\nmodel.addCons(MachineA_Sqrt * MachineA_Sqrt <= MachineA_Qty)\nmodel.addCons(MachineB_Sqrt * MachineB_Sqrt <= MachineB_Qty)\nmodel.addCons(MachineC_Sqrt * MachineC_Sqrt <= MachineC_Qty)\n\nProfit_A = (500 - 200 * MachineA_Sqrt) * MachineA_Qty\nProfit_B = (700 - 300 * MachineB_Sqrt) * MachineB_Qty\nProfit_C = (900 - 400 * MachineC_Sqrt) * MachineC_Qty\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 100 machines per month.\nmodel.addCons(MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100)\n## Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineB_Qty <= 2 * MachineA_Qty)\n## The company has a budget of $20,000 for production costs per month.\nmodel.addCons(200 * MachineA_Sqrt * MachineA_Qty + 300 * MachineB_Sqrt * MachineB_Qty + 400 * MachineC_Sqrt * MachineC_Qty <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of MachineA: \", model.getVal(MachineA_Qty))\n    print(\"Production Quantity of MachineB: \", model.getVal(MachineB_Qty))\n    print(\"Production Quantity of MachineC: \", model.getVal(MachineC_Qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000\n\n## Generate Constraint-2:\nDue to production constraints, the total number of machines produced cannot exceed 100 units.\n// MachineA_Units + MachineB_Units + MachineC_Units <= 100",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company has a limited budget for setup costs, which is $10,000. Due to production constraints, the total number of machines produced cannot exceed 100 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=0) # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=0) # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=0) # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n# Due to production constraints, the total number of machines produced cannot exceed 100 units.\nmodel.addCons(MachineA_Units + MachineB_Units + MachineC_Units <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 661,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20\n\n## Generate Constraint-3:\nThe water supply limits the total land that can be used for corn and barley to 60 acres.\n// C + B <= 60\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn.\n// B <= 0.5 * C",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120, but these profits decrease nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit functions are defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B).\n\n| Crop   | Profit per Acre |\n|--------|-----------------|\n| Wheat  | 100$            |\n| Corn   | 150$            |\n| Barley | 120$            |\n\nThe total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence. The water supply limits the total land that can be used for corn and barley to 60 acres. The farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with nonlinear terms\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n## The water supply limits the total land that can be used for corn and barley to 60 acres.\nmodel.addCons(C + B <= 60)\n## The farmer wants to ensure that the land allocated to barley does not exceed half of the land allocated to corn.\nmodel.addCons(B <= 0.5 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit.\n// {\"quantity of WidgetA\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetB\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"quantity of WidgetC\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of WidgetA is $10, but it decreases by $0.01 for each unit produced beyond the first 100 units. The profit per unit of WidgetB is $15, but it decreases by $0.01 for each unit produced beyond the first 150 units. The profit per unit of WidgetC is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from the sales of all widgets.\n// Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\n// Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\n// Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\n// So, the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all types of widgets.\n// WidgetA + WidgetB + WidgetC <= 500",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantities for each type of widget to optimize their profit. The profit per unit of each widget decreases by $0.01 for each unit produced beyond a certain threshold: 100 units for WidgetA, 150 units for WidgetB, and 200 units for WidgetC. The initial profit per unit for WidgetA is $10, for WidgetB is $15, and for WidgetC is $20.\n\n| Widget | Initial Profit Per Unit | Decrease in Profit Per Unit Beyond Threshold | Threshold |\n|--------|-------------------------|--------------------------------------------|-----------|\n| WidgetA| 10$                    | 0.01$                                      | 100 units  |\n| WidgetB| 15$                    | 0.01$                                      | 150 units  |\n| WidgetC| 20$                    | 0.01$                                      | 200 units  |\n\nThe company has a total production capacity of 500 units across all types of widgets. Please help the company to maximize the total profit from the sales of all widgets.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # quantity of WidgetA\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # quantity of WidgetB\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0) # quantity of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (10 - 0.01 * max(WidgetA - 100, 0)) * WidgetA\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetA == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (10 - 0.01 * WidgetA2) * WidgetA\n## create piecewise variables for piecewise function: Profit_WidgetB = (15 - 0.01 * max(WidgetB - 150, 0)) * WidgetB\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=150)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=150, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetB == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (15 - 0.01 * WidgetB2) * WidgetB\n## create piecewise variables for piecewise function: Profit_WidgetC = (20 - 0.01 * max(WidgetC - 200, 0)) * WidgetC\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=200)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=200, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetC == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (20 - 0.01 * WidgetC2) * WidgetC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_WidgetA + Profit_WidgetB + Profit_WidgetC\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetA + WidgetB + WidgetC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of WidgetA: \", model.getVal(WidgetA))\n    print(\"Quantity of WidgetB: \", model.getVal(WidgetB))\n    print(\"Quantity of WidgetC: \", model.getVal(WidgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\n// A >= 5; B >= 10; C >= 15\n\n## Generate Constraint-3:\nThe plant must produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. The profit per unit and the production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time |\n|---------|-----------------|-----------------|\n| A       | $30             | 2 hours         |\n| B       | $40             | 3 hours         |\n| C       | $50             | 4 hours         |\n\nThe plant has a total of 100 hours available for production. The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units. The plant must produce at least twice as many units of product B as product A. \n\nPlease help the plant to maximize the total profit while considering the production time constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15)  # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The plant must produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The company aims to maximize this profit.\n// Formal definition of the objective function: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2, where L represents labor hours, M represents machine hours, and R represents raw materials. The company aims to maximize this profit.\n\nThe company has a total of 1000 labor hours and 800 machine hours available. Please help the company determine the optimal allocation of labor hours, machine hours, and raw materials to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\nmodel.addCons(obj == 100*L - 0.5*L*L + 150*M - 0.3*M*M + 200*R - 0.4*R*R)\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// S <= 25; T <= 25; L <= 25\n\n## Generate Constraint-3:\nThe company must produce at least 500 smartphones, 400 tablets, and 300 laptops per day.\n// 10 * S >= 500\n// 8 * T >= 400\n// 5 * L >= 300",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company aims to maximize its total profit.\n\n| Device     | Production Rate per Worker per Hour | Profit per Device |\n|------------|------------------------------------|-------------------|\n| Smartphones| 10                                 | $50               |\n| Tablets    | 8                                  | $70               |\n| Laptops    | 5                                  | $100              |\n\nThere are total 60 workers available. Each production line can be utilized by up to 25 workers at a time. The company must produce at least 500 smartphones, 400 tablets, and 300 laptops per day.\n\nPlease help the company to decide the optimal allocation of workers to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60) # total 60 workers available\nmodel.addCons(S <= 25) # up to 25 workers on smartphone production\nmodel.addCons(T <= 25) # up to 25 workers on tablet production\nmodel.addCons(L <= 25) # up to 25 workers on laptop production\nmodel.addCons(10 * S >= 500) # at least 500 smartphones\nmodel.addCons(8 * T >= 400) # at least 400 tablets\nmodel.addCons(5 * L >= 300) # at least 300 laptops\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1200,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line.\n// {\"production quantity of new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of new employees\": \"Employees\", \"range\": \"Employees >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company aims to maximize its profit from the new product.\n// Profit = (100 - 50) * Production - 0.01 * Advertising * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget limit of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe production capacity is limited by the number of employees. Each employee can produce 100 units per quarter.\n// Production <= 100 * Employees\n\n## Generate Constraint-3:\nThe company must hire at least 10 new employees to meet the expected demand.\n// Employees >= 10\n\n## Generate Constraint-4:\nThe total production quantity must not exceed 5,000 units due to market saturation.\n// Production <= 5000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of new employees to hire for the production line. The company estimates that for every $1,000 spent on advertising, the sales increase by 10 units. The production cost per unit is $50, and the selling price per unit is $100. The company aims to maximize its profit from the new product.\n\nThe company has a budget limit of $50,000 for advertising. The production capacity is limited by the number of employees, where each employee can produce 100 units per quarter. The company must hire at least 10 new employees to meet the expected demand. Additionally, the total production quantity must not exceed 5,000 units due to market saturation.\n\nPlease help the company to maximize its profit from the new product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0)  # production quantity of new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0)  # advertising budget\nEmployees = model.addVar(vtype=\"INTEGER\", name=\"Employees\", lb=0)  # number of new employees\n\n# Define objective function\nProfit = (100 - 50) * Production - 0.01 * Advertising * Production\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Advertising <= 50000)  # advertising budget limit\nmodel.addCons(Production <= 100 * Employees)  # production capacity constraint\nmodel.addCons(Employees >= 10)  # minimum number of employees\nmodel.addCons(Production <= 5000)  # maximum production due to market saturation\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Employees: \", model.getVal(Employees))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company aims to maximize the net profit per unit of storage space used.\n// Net profit of A: Profit_A = (100 - 60) * A - 5 * A^2\n// Net profit of B: Profit_B = (150 - 90) * B - 10 * B^2\n// Net profit of C: Profit_C = (200 - 120) * C - 15 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A^2 + 10 * B^2 + 15 * C^2)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device.\nPlease help the company to maximize the net profit per unit of storage space used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * A**2\nProfit_B = (150 - 90) * B - 10 * B**2\nProfit_C = (200 - 120) * C - 15 * C**2\nStorageCost = 5 * A**2 + 10 * B**2 + 15 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\n// 1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000\n\n## Generate Constraint-4:\nThe farm must allocate at least 20 acres to Crop A.\n// AreaA >= 20\n\n## Generate Constraint-5:\nThe farm must allocate at least 15 acres to Crop B.\n// AreaB >= 15",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and consider investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield and water usage for each crop without irrigation are as follows:\n\n| Crop | Yield Without Irrigation | Water Usage per Acre |\n|------|--------------------------|----------------------|\n| A    | 0.5 tons per acre        | 1000 gallons         |\n| B    | 0.6 tons per acre        | 1200 gallons         |\n| C    | 0.7 tons per acre        | 1500 gallons         |\n\nThe yield of each crop increases with the investment in irrigation: Crop A increases by 0.1 tons per acre for every $1000 invested, Crop B by 0.15 tons per acre, and Crop C by 0.2 tons per acre. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n\nThe farm has the following constraints:\n- The total area available for cultivation is 100 acres.\n- The farm has a budget of $50,000 for irrigation investments.\n- The farm has a total water supply of 120,000 gallons.\n- The farm must allocate at least 20 acres to Crop A.\n- The farm must allocate at least 15 acres to Crop B.\n\nPlease help the farm determine the optimal allocation of area for each crop and the amount to invest in irrigation to maximize the total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=20)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=15)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)    # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\nmodel.addCons(AreaA + AreaB + AreaC <= 100)  # total area available for cultivation\nmodel.addCons(Irrigation <= 50000)  # budget for irrigation investments\nmodel.addCons(1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000)  # total water supply\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1488,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products.\n// Production_Cost_A = (10 - 0.05 * Automation) * A\n// Production_Cost_B = (15 - 0.05 * Automation) * B\n// Production_Cost_C = (20 - 0.05 * Automation) * C\n// Revenue_A = 20 * A\n// Revenue_B = 30 * B\n// Revenue_C = 40 * C\n// Total_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n// So, the objective function is: Maximize Total_Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for Product A is at least 100 units and at most 300 units.\n// A >= 100; A <= 300\n\n## Generate Constraint-3:\nThe market demand for Product B is at least 50 units and at most 200 units.\n// B >= 50; B <= 200\n\n## Generate Constraint-4:\nThe market demand for Product C is at least 20 units and at most 150 units.\n// C >= 20; C <= 150\n\n## Generate Constraint-5:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product and the level of automation to implement in the production process. The cost of producing each unit of Product A is $10, Product B is $15, and Product C is $20. The level of automation reduces the production cost per unit by $0.05 for every unit of automation. The selling price of each unit of Product A is $20, Product B is $30, and Product C is $40. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units. The market demand for Product A is at least 100 units and at most 300 units. The market demand for Product B is at least 50 units and at most 200 units. The market demand for Product C is at least 20 units and at most 150 units. The investment in automation cannot exceed $50,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100, ub=300)  # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=200)   # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20, ub=150)   # quantity of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProduction_Cost_A = (10 - 0.05 * Automation) * A\nProduction_Cost_B = (15 - 0.05 * Automation) * B\nProduction_Cost_C = (20 - 0.05 * Automation) * C\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Profit = (Revenue_A - Production_Cost_A) + (Revenue_B - Production_Cost_B) + (Revenue_C - Production_Cost_C)\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C).\n// {\"number of Machinery A units\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery B units\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery C units\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n// Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n// Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing and maintaining the machinery.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000\n\n## Generate Constraint-2:\nThe company must invest at least $20,000 in machinery to meet production demands.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000",
        "question": "A manufacturing company is planning to optimize its production by investing in three different types of machinery: Machinery A, Machinery B, and Machinery C. The company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n\n| Machinery | Production Capacity Increase | Maintenance Cost per Unit |\n|-----------|------------------------------|---------------------------|\n| A         | 10%                          | $500                      |\n| B         | 15%                          | $700                      |\n| C         | 20%                          | $1000                     |\n\nThe company has a budget of $50,000 for purchasing and maintaining the machinery. The company must also invest at least $20,000 in machinery to meet production demands.\n\nPlease help the company determine the optimal number of units of each type of machinery to invest in to maximize the net production capacity after deducting the maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineryA = model.addVar(vtype=\"INTEGER\", name=\"MachineryA\", lb=0) # number of Machinery A units\nMachineryB = model.addVar(vtype=\"INTEGER\", name=\"MachineryB\", lb=0) # number of Machinery B units\nMachineryC = model.addVar(vtype=\"INTEGER\", name=\"MachineryC\", lb=0) # number of Machinery C units\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n## Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n## So, the objective function is: Maximize (Capacity - Cost)\nCapacity = 0.1 * MachineryA + 0.15 * MachineryB + 0.2 * MachineryC\nCost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for purchasing and maintaining the machinery.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000)\n## The company must invest at least $20,000 in machinery to meet production demands.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machinery A: \", model.getVal(MachineryA))\n    print(\"Number of Machinery B: \", model.getVal(MachineryB))\n    print(\"Number of Machinery C: \", model.getVal(MachineryC))\n    print(\"Maximized Net Production Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1276,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n// Total operational cost for WarehouseA: Cost_A = TrucksA * (50)^2\n// Total operational cost for WarehouseB: Cost_B = TrucksB * (70)^2\n// Total operational cost for WarehouseC: Cost_C = TrucksC * (60)^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, WarehouseA must have at least 20% of the total trucks.\n// TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC)",
        "question": "A logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2, where the distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n\n| Warehouse | Distance to Main Distribution Center |\n|-----------|--------------------------------------|\n| WarehouseA | 50 km                                |\n| WarehouseB | 70 km                                |\n| WarehouseC | 60 km                                |\n\nThe company has a total of 50 trucks available for allocation. Due to contractual agreements, WarehouseA must have at least 20% of the total trucks. Please help the company to minimize the total operational cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for WarehouseC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = TrucksA * (50**2)\nCost_B = TrucksB * (70**2)\nCost_C = TrucksC * (60**2)\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## Due to contractual agreements, WarehouseA must have at least 20% of the total trucks.\nmodel.addCons(TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations.\n// {\"production rate of MachineA\": \"MachineARate\", \"range\": \"MachineARate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBRate\", \"range\": \"MachineBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCRate\", \"range\": \"MachineCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit from all machines.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineARate\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBRate\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCRate\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day across all machine types.\n// MachineARate + MachineBRate + MachineCRate <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production rate of MachineB must be at least twice the production rate of MachineA.\n// MachineBRate >= 2 * MachineARate\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials of $30,000 per day.\n// 300 * MachineARate + 400 * MachineBRate + 500 * MachineCRate <= 30,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit from all machines. The company has a total production capacity of 100 units per day across all machine types. Due to market demand, the production rate of MachineB must be at least twice the production rate of MachineA. The company has a budget constraint for raw materials of $30,000 per day. Please help the company to determine the optimal production rates for MachineA, MachineB, and MachineC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineARate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineARate\", lb=0) # production rate of MachineA\nMachineBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBRate\", lb=0) # production rate of MachineB\nMachineCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCRate\", lb=0) # production rate of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 300) * MachineARate\nProfit_MachineB = (700 - 400) * MachineBRate\nProfit_MachineC = (900 - 500) * MachineCRate\n# So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total production capacity of 100 units per day across all machine types.\nmodel.addCons(MachineARate + MachineBRate + MachineCRate <= 100)\n# Due to market demand, the production rate of MachineB must be at least twice the production rate of MachineA.\nmodel.addCons(MachineBRate >= 2 * MachineARate)\n# The company has a budget constraint for raw materials of $30,000 per day.\nmodel.addCons(300 * MachineARate + 400 * MachineBRate + 500 * MachineCRate <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineARate))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBRate))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\n// Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all devices combined.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500\n\n## Generate Constraint-2:\nDue to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBUnits <= 2 * DeviceAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs, and the cost per unit for each device is $20.\n// 20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company has a total production capacity of 500 units for all devices combined. Due to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget of $30,000 for production costs, and the cost per unit for each device is $20. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=0) # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = (50 - 0.5 * DeviceA2) * DeviceA2 * DeviceA_b2 + 50 * DeviceA1 * DeviceA_b1\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=150)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=150, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = (70 - 0.3 * DeviceB2) * DeviceB2 * DeviceB_b2 + 70 * DeviceB1 * DeviceB_b1\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=200)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=200, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = (90 - 0.2 * DeviceC2) * DeviceC2 * DeviceC_b2 + 90 * DeviceC1 * DeviceC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500)\nmodel.addCons(DeviceBUnits <= 2 * DeviceAUnits)\nmodel.addCons(20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceA_qty\", \"range\": \"DeviceA_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_qty\", \"range\": \"DeviceB_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_qty\", \"range\": \"DeviceC_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The cost function for DeviceA is 0.01 * (DeviceA_qty)^2 + 20, for DeviceB is 0.015 * (DeviceB_qty)^2 + 30, and for DeviceC is 0.02 * (DeviceC_qty)^2 + 40. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC.\n// DeviceA_qty >= 0.5 * (DeviceB_qty + DeviceC_qty)",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The cost function for DeviceA is 0.01 * (DeviceA_qty)^2 + 20, for DeviceB is 0.015 * (DeviceB_qty)^2 + 30, and for DeviceC is 0.02 * (DeviceC_qty)^2 + 40. The company wants to maximize the total net profit. The company has a total production capacity of 1000 units for all devices combined. Due to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC. Please help the company determine the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_qty\", lb=0) # production quantity for DeviceA\nDeviceB_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_qty\", lb=0) # production quantity for DeviceB\nDeviceC_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_qty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (0.01 * DeviceA_qty**2 + 20)) * DeviceA_qty\nProfit_DeviceB = (70 - (0.015 * DeviceB_qty**2 + 30)) * DeviceB_qty\nProfit_DeviceC = (90 - (0.02 * DeviceC_qty**2 + 40)) * DeviceC_qty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000)\n## Due to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC.\nmodel.addCons(DeviceA_qty >= 0.5 * (DeviceB_qty + DeviceC_qty))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceA_qty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceB_qty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceC_qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 899,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\n// {\"hours reactor 1 operates\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 2 operates\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"hours reactor 3 operates\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\n// Total production of chemical A: P_A = 10 * R1 + 7 * R2 + 9 * R3\n// Total production of chemical B: P_B = 5 * R1 + 12 * R2 + 8 * R3\n// Total production of chemical C: P_C = 8 * R1 + 6 * R2 + 10 * R3\n// The objective function is: Maximize (P_A + P_B + P_C) / (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total operational hours for all reactors must not exceed 100 hours.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nEach reactor has a minimum operational requirement of 20 hours to ensure proper functioning.\n// R1 >= 20; R2 >= 20; R3 >= 20",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to decide how many hours each reactor should operate to optimize production.\nEach hour, reactor 1 produces 10 units of chemical A, 5 units of chemical B, and 8 units of chemical C. Reactor 2 produces 7 units of chemical A, 12 units of chemical B, and 6 units of chemical C. Reactor 3 produces 9 units of chemical A, 8 units of chemical B, and 10 units of chemical C. The plant aims to maximize the total production of all chemicals while minimizing the operational hours.\nThe total operational hours for all reactors must not exceed 100 hours. Each reactor has a minimum operational requirement of 20 hours to ensure proper functioning.\nPlease help the manager to determine the optimal operational hours for each reactor to maximize the total production of all chemicals (defined as the sum of the production of each chemical divided by the total operational hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=20) # hours reactor 1 operates\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=20) # hours reactor 2 operates\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=20) # hours reactor 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 10 * R1 + 7 * R2 + 9 * R3\nP_B = 5 * R1 + 12 * R2 + 8 * R3\nP_C = 8 * R1 + 6 * R2 + 10 * R3\nTotalHours = R1 + R2 + R3\n## the objective function is: Maximize (P_A + P_B + P_C) / TotalHours\n## convert the division to multiplication\nmodel.addCons(obj * TotalHours == P_A + P_B + P_C)\n\n# Add constraints\n## The total operational hours for all reactors must not exceed 100 hours.\nmodel.addCons(R1 + R2 + R3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Reactor 1 Operates: \", model.getVal(R1))\n    print(\"Hours Reactor 2 Operates: \", model.getVal(R2))\n    print(\"Hours Reactor 3 Operates: \", model.getVal(R3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1048,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least half the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $50,000. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, and for DeviceC is $20 per unit.\n// 10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of each device.\n// DeviceA_Quantity >= 50; DeviceB_Quantity >= 50; DeviceC_Quantity >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit. The profit per unit and the cost of raw materials for each device are given in the following Table.\n\n| Device | Profit per Unit | Raw Material Cost per Unit |\n|--------|-----------------|----------------------------|\n| DeviceA | $50             | $10                        |\n| DeviceB | $70             | $15                        |\n| DeviceC | $90             | $20                        |\n\nThe production cost for each device increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company has a total production capacity of 1000 units for all devices combined. Due to market demand, the production of DeviceA must be at least half the production of DeviceB. The company has a limited budget for raw materials, which is $50,000. To ensure market presence, the company must produce at least 50 units of each device.\n\nPlease help the company to maximize the total net profit by determining the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=50)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=50)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=50)\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n## Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n## Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - 0.01 * DeviceA_Quantity**2) * DeviceA_Quantity\nProfit_DeviceB = (70 - 0.02 * DeviceB_Quantity**2) * DeviceB_Quantity\nProfit_DeviceC = (90 - 0.03 * DeviceC_Quantity**2) * DeviceC_Quantity\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n## Due to market demand, the production of DeviceA must be at least half the production of DeviceB.\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\n## The company has a limited budget for raw materials, which is $50,000.\nmodel.addCons(10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1317,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company aims to maximize the net profit per unit of storage space used.\n// Net profit of A: Profit_A = (100 - 60) * A - 5 * A^2\n// Net profit of B: Profit_B = (150 - 90) * B - 10 * B^2\n// Net profit of C: Profit_C = (200 - 120) * C - 15 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A^2 + 10 * B^2 + 15 * C^2)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe total storage space available is limited to 1000 cubic feet, and the storage requirement for each device is proportional to the square of the quantity produced.\n// 5 * A^2 + 10 * B^2 + 15 * C^2 <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device. The total storage space available is limited to 1000 cubic feet, and the storage requirement for each device is proportional to the square of the quantity produced.\nPlease help the company to maximize the net profit per unit of storage space used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * A**2\nProfit_B = (150 - 90) * B - 10 * B**2\nProfit_C = (200 - 120) * C - 15 * C**2\nStorage = 5 * A**2 + 10 * B**2 + 15 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Storage\n## convert the division to multiplication\nmodel.addCons(obj * Storage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000)\n## The total storage space available is limited to 1000 cubic feet, and the storage requirement for each device is proportional to the square of the quantity produced.\nmodel.addCons(5 * A**2 + 10 * B**2 + 15 * C**2 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $5 per unit, Product B has a profit margin of $10 per unit, and Product C has a profit margin of $15 per unit. The production of each product requires a different amount of energy: Product A requires 2 units of energy, Product B requires 3 units of energy, and Product C requires 4 units of energy. The plant aims to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 10 * B\n// Profit from C: Profit_C = 15 * C\n// Total energy consumption: Energy = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit.\n// 3 * A + 6 * B + 9 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily production capacity of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe plant aims to produce at least 50 units of each product to meet market demand.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe total energy consumption should not exceed 500 units per day.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit. The profit margin per unit and the energy required for production of each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Energy Required per Unit |\n|---------|------------------------|--------------------------|\n| A       | $5                     | 2 units                  |\n| B       | $10                    | 3 units                  |\n| C       | $15                    | 4 units                  |\n\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit. The plant has a daily production capacity of 200 units across all products. The plant aims to produce at least 50 units of each product to meet market demand. The total energy consumption should not exceed 500 units per day.\n\nPlease help the plant to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10 * B\nProfit_C = 15 * C\nEnergy = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $1000 for raw materials.\nmodel.addCons(3 * A + 6 * B + 9 * C <= 1000)\n## The plant has a daily production capacity of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The total energy consumption should not exceed 500 units per day.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1187,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. For every $10,000 invested in automation, the production cost per unit decreases by $1 for all products. The selling price per unit of ProductA is $80, ProductB is $100, and ProductC is $120. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\n// Total cost for ProductB: CostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\n// Total cost for ProductC: CostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\n// Total revenue for ProductA: RevenueA = 80 * QuantityA\n// Total revenue for ProductB: RevenueB = 100 * QuantityB\n// Total revenue for ProductC: RevenueC = 120 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs. The production cost per unit, selling price per unit, and the effect of automation investment on production costs are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit | Effect of $10,000 Automation Investment |\n|---------|--------------------------|------------------------|-----------------------------------------|\n| ProductA | $50                      | $80                    | $1 decrease in cost per unit            |\n| ProductB | $70                      | $100                   | $1 decrease in cost per unit            |\n| ProductC | $90                      | $120                   | $1 decrease in cost per unit            |\n\nThe company has a total production capacity of 10,000 units across all products. The total investment in automation technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0) # investment in automation technology\n\n# Define objective function\nCostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\nCostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\nCostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\nRevenueA = 80 * QuantityA\nRevenueB = 100 * QuantityB\nRevenueC = 120 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(AutomationInvestment <= 50000)\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation Technology: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1241,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric generators\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year.\nThe cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year.\nThe cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year.\nThe company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n// Total installation cost: Install_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\n// Total annual maintenance cost: Maintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\n// Total annual energy output: Energy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n// So, the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for the installation of all systems.\n// 2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 100,000 kWh.\n// 1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on each type of system.\n// 2000 * Solar >= 0.20 * 200000\n// 5000 * Wind >= 0.20 * 200000\n// 10000 * Hydro >= 0.20 * 200000",
        "question": "A company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators. The cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year. The cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year. The cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year. The company has a budget of $200,000 for the installation of all systems and wants the total annual energy output to be at least 100,000 kWh. The company also wants to ensure that at least 20% of the budget is spent on each type of system. Please help the company to minimize the total cost of installation and maintenance per unit of energy produced.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstall_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\nMaintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\nEnergy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n## the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Output == Install_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a budget of $200,000 for the installation of all systems.\nmodel.addCons(2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000)\n## The total annual energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000)\n## The company wants to ensure that at least 20% of the budget is spent on each type of system.\nmodel.addCons(2000 * Solar >= 0.20 * 200000)\nmodel.addCons(5000 * Wind >= 0.20 * 200000)\nmodel.addCons(10000 * Hydro >= 0.20 * 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Generators: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n// Total production cost for product 1: Cost1 = 50 * P1 / (1 - 0.005 * Automation)\n// Total production cost for product 2: Cost2 = 70 * P2 / (1 - 0.005 * Automation)\n// Total daily production cost: TotalCost = Cost1 + Cost2\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\n// P1 <= 50; P2 <= 40",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line. The cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n\n| Product | Cost per Unit | Maximum Production Rate (units/hour) |\n|---------|---------------|--------------------------------------|\n| 1       | $50           | 50                                   |\n| 2       | $70           | 40                                   |\n\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2. Please help the company to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 50 * P1 / (1 - 0.005 * Automation)\nCost2 = 70 * P2 / (1 - 0.005 * Automation)\n## the objective function is: Minimize TotalCost\nmodel.addCons(obj == Cost1 + Cost2)\n\n# Add constraints\n## The production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is considering the optimal allocation of resources to grow three types of crops: wheat, corn, and soybeans. The farm needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm aims to maximize its profit per acre, considering the varying yields and market prices of each crop. The profit per acre for wheat is $300 - 0.5 * W^2, for corn is $400 - 0.4 * C^2, and for soybeans is $250 - 0.3 * S^2. The objective is to maximize the total profit per acre across all crops.\n// Objective function: Maximize (300 - 0.5 * W^2) * W + (400 - 0.4 * C^2) * C + (250 - 0.3 * S^2) * S\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farm must allocate at least 20 acres to each crop to maintain operational efficiency.\n// W >= 20; C >= 20; S >= 20",
        "question": "A farm is considering the optimal allocation of resources to grow three types of crops: wheat, corn, and soybeans. The farm needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $300 - 0.5 * W^2, for corn is $400 - 0.4 * C^2, and for soybeans is $250 - 0.3 * S^2. The farm aims to maximize its total profit per acre across all crops. The farm has a total of 100 acres available for cultivation. Additionally, the farm must allocate at least 20 acres to each crop to maintain operational efficiency. Please help the farm determine the optimal number of acres to dedicate to each crop to maximize its profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (300 - 0.5 * W^2) * W + (400 - 0.4 * C^2) * C + (250 - 0.3 * S^2) * S\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nW_sq = model.addVar(vtype=\"INTEGER\", name=\"W_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nS_sq = model.addVar(vtype=\"INTEGER\", name=\"S_sq\")\nmodel.addCons(W_sq == W**2)\nmodel.addCons(C_sq == C**2)\nmodel.addCons(S_sq == S**2)\nProfit_W = (300 - 0.5 * W_sq) * W\nProfit_C = (400 - 0.4 * C_sq) * C\nProfit_S = (250 - 0.3 * S_sq) * S\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 651,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency. The profit function is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit.\n// Formal definition: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800\n\n## Generate Constraint-3:\nThe total raw materials available are 1200 units.\n// R <= 1200\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of each product. This requirement can be met if the total effective production capacity (considering the nonlinear efficiency) is at least 50.\n// 50 <= 1000 * L^0.5 * M^0.6 * R^0.4",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit function is influenced by a nonlinear relationship between resource allocation and production efficiency, and is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R), where L represents labor hours, M represents machine hours, and R represents raw materials.\n\nThe company has the following constraints:\n- The total labor hours available are 1000 hours.\n- The total machine hours available are 800 hours.\n- The total raw materials available are 1200 units.\n- The company must produce at least 50 units of each product, which requires that the total effective production capacity (considering the nonlinear efficiency) is at least 50.\n\nPlease help the company to maximize its profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0)  # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0)  # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0)  # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\nmodel.addCons(obj == 1000 * L**0.5 * M**0.6 * R**0.4 - 500 * (L + M + R))\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n## The total raw materials available are 1200 units.\nmodel.addCons(R <= 1200)\n## The company must produce at least 50 units of each product.\nmodel.addCons(50 <= 1000 * L**0.5 * M**0.6 * R**0.4)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices.\n// Profit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\n// Profit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\n// Profit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// Smartphones + Tablets + Laptops <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units.\n// Smartphones <= 5000; Tablets <= 3000; Laptops <= 2000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit. The selling price and initial energy cost per unit for each device are given in the following Table.\n\n| Device       | Selling Price | Initial Energy Cost |\n|--------------|---------------|---------------------|\n| Smartphones  | 100$          | 10$                 |\n| Tablets      | 150$          | 15$                 |\n| Laptops      | 200$          | 20$                 |\n\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The company has a total production capacity of 10,000 units across all devices. The total investment in energy efficiency upgrades cannot exceed $50,000. The market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # quantity of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # quantity of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # quantity of Laptops\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\nProfit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\nProfit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n# So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all devices.\nmodel.addCons(Smartphones + Tablets + Laptops <= 10000)\n# The total investment in energy efficiency upgrades cannot exceed $50,000.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units.\nmodel.addCons(Smartphones <= 5000)\nmodel.addCons(Tablets <= 3000)\nmodel.addCons(Laptops <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1130,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day.\n// A >= 50\n\n## Generate Constraint-3:\nThe market demand for product B is at least 70 units per day.\n// B >= 70",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the profit per unit decreases when the production volume exceeds certain thresholds: the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units. The total production capacity of the company is 500 units per day. The market demand for product A is at least 50 units per day, and for product B is at least 70 units per day.\nPlease help the company to maximize the total profit from products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=70)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # number of units of product C\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=101, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n\n# Create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=70, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=201, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n\n# Create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=301, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. \nEach machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. \nEach machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. \nThe company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The objective is to minimize the total cost of production, including setup and operating costs.\n// Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n// Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n// Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time. Each machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. Each machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. Each machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. The company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The company has a total of 50 machines available for allocation and due to space limitations, no more than 20 machines can be allocated to ComponentA. Please help the company to minimize the total cost of production, including setup and operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## convert the division to multiplication\nCost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## convert the division to multiplication\nCost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n## convert the division to multiplication\nCost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n## Due to space limitations, no more than 20 machines can be allocated to ComponentA.\nmodel.addCons(MachinesA <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\n// 1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000\n\n## Generate Constraint-4:\nThe farm must allocate at least 20 acres to Crop A.\n// AreaA >= 20",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and the investment in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops. The total area available for cultivation is 100 acres. The farm has a budget of $50,000 for irrigation investments. The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre, with a total water supply of 120,000 gallons. The farm must allocate at least 20 acres to Crop A. Please help the farm determine the optimal allocation of area and investment in irrigation to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=20)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=0)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)  # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n# The total area available for cultivation is 100 acres.\nmodel.addCons(AreaA + AreaB + AreaC <= 100)\n# The farm has a budget of $50,000 for irrigation investments.\nmodel.addCons(Irrigation <= 50000)\n# The water usage for Crop A is 1000 gallons per acre, for Crop B is 1200 gallons per acre, and for Crop C is 1500 gallons per acre. The farm has a total water supply of 120,000 gallons.\nmodel.addCons(1000 * AreaA + 1200 * AreaB + 1500 * AreaC <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1318,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company aims to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n// Profit from A: Profit_A = (30 * A) - 500\n// Profit from B: Profit_B = (40 * B) - 700\n// Profit from C: Profit_C = (50 * C) - 900\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited budget of $2000 for setup costs.\n// 500 * A + 700 * B + 900 * C <= 2000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 20 units, and for component B and C is at least 15 units each.\n// A >= 20; B >= 15; C >= 15\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 50 units.\n// A + B + C <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that the production of component C does not exceed twice the combined production of components A and B.\n// C <= 2 * (A + B)",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company has a limited budget of $2000 for setup costs. The market demand for component A is at least 20 units, and for component B and C is at least 15 units each. The total production capacity of the company is limited to 50 units. The company wants to ensure that the production of component C does not exceed twice the combined production of components A and B.\nPlease help the company to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 * A) - 500\nProfit_B = (40 * B) - 700\nProfit_C = (50 * C) - 900\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited budget of $2000 for setup costs.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 2000)\n## The market demand for component A is at least 20 units, and for component B and C is at least 15 units each.\nmodel.addCons(A >= 20)\nmodel.addCons(B >= 15)\nmodel.addCons(C >= 15)\n## The total production capacity of the company is limited to 50 units.\nmodel.addCons(A + B + C <= 50)\n## The company wants to ensure that the production of component C does not exceed twice the combined production of components A and B.\nmodel.addCons(C <= 2 * (A + B))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit.\n// {\"number of MachineA\": \"MachineATeams\", \"range\": \"MachineATeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBTeams\", \"range\": \"MachineBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCTeams\", \"range\": \"MachineCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n// Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n// Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 machines.\n// MachineATeams + MachineBTeams + MachineCTeams <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\n// MachineCTeams <= MachineATeams + MachineBTeams\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs. The cost to produce MachineA is $100 per unit, MachineB is $150 per unit, and MachineC is $200 per unit.\n// 100 * MachineATeams + 150 * MachineBTeams + 200 * MachineCTeams <= 20,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit. The profit per unit and production costs for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|---------------------------|\n| MachineA | $500 - $10 * MachineBTeams | $100 |\n| MachineB | $800 - $20 * MachineATeams | $150 |\n| MachineC | $1000 - $15 * (MachineATeams + MachineBTeams) | $200 |\n\nThe company has a total production capacity of 50 machines. Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB. The company has a budget of $20,000 for production costs. \n\nPlease help the company to maximize the total profit by determining the optimal number of each type of machine to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineATeams = model.addVar(vtype=\"INTEGER\", name=\"MachineATeams\", lb=0) # number of MachineA\nMachineBTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineBTeams\", lb=0) # number of MachineB\nMachineCTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineCTeams\", lb=0) # number of MachineC\n\n# Define objective function\n## Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n## Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n## Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n## So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (500 - 10 * MachineBTeams) * MachineATeams + (800 - 20 * MachineATeams) * MachineBTeams + (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams)\n\n# Add constraints\n## The company has a total production capacity of 50 machines.\nmodel.addCons(MachineATeams + MachineBTeams + MachineCTeams <= 50)\n## Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\nmodel.addCons(MachineCTeams <= MachineATeams + MachineBTeams)\n## The company has a budget of $20,000 for production costs.\nmodel.addCons(100 * MachineATeams + 150 * MachineBTeams + 200 * MachineCTeams <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineATeams))\n    print(\"Number of MachineB: \", model.getVal(MachineBTeams))\n    print(\"Number of MachineC: \", model.getVal(MachineCTeams))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 20A + 30B + 40C\n// Total cost: Cost = 10A + 20B + 30C\n// So, the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1500 for production costs.\n// 10A + 20B + 30C <= 1500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $20                      |\n| C       | $40             | $30                      |\n\nThe plant has a limited budget of $1500 for production costs. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost. Please help the plant determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 20 * A + 30 * B + 40 * C\nCost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The plant has a limited budget of $1500 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of Solar Panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wind Turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"quantity of Electric Vehicles\": \"ElectricVehicles\", \"range\": \"ElectricVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these products.\n// Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\n// Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\n// Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\n// So, the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n// 5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000\n\n## Generate Constraint-2:\nThe market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles.\n// SolarPanels <= 300; WindTurbines <= 200; ElectricVehicles <= 150",
        "question": "A manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints. The profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component. The market demand for each product has a cap: 300 units for Solar Panels, 200 units for Wind Turbines, and 150 units for Electric Vehicles. Please help the company to maximize the total profit from the sales of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=300)  # quantity of Solar Panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=200)  # quantity of Wind Turbines\nElectricVehicles = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles\", lb=0, ub=150)  # quantity of Electric Vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0, ub=100)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=100, ub=300)\nSolarPanels_b1 = model.addVar(vtype=\"B\", name=\"SolarPanels_b1\")\nSolarPanels_b2 = model.addVar(vtype=\"B\", name=\"SolarPanels_b2\")\nmodel.addCons(SolarPanels_b1 + SolarPanels_b2 == 1)\nmodel.addCons(SolarPanels == SolarPanels1*SolarPanels_b1 + SolarPanels2*SolarPanels_b2)\nProfit_SolarPanels = 1000 * SolarPanels1 * SolarPanels_b1 + (1000 - 0.1 * (SolarPanels2 - 100)) * SolarPanels2 * SolarPanels_b2\n## create piecewise variables for piecewise function: Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0, ub=50)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=50, ub=200)\nWindTurbines_b1 = model.addVar(vtype=\"B\", name=\"WindTurbines_b1\")\nWindTurbines_b2 = model.addVar(vtype=\"B\", name=\"WindTurbines_b2\")\nmodel.addCons(WindTurbines_b1 + WindTurbines_b2 == 1)\nmodel.addCons(WindTurbines == WindTurbines1*WindTurbines_b1 + WindTurbines2*WindTurbines_b2)\nProfit_WindTurbines = 1500 * WindTurbines1 * WindTurbines_b1 + (1500 - 0.2 * (WindTurbines2 - 50)) * WindTurbines2 * WindTurbines_b2\n## create piecewise variables for piecewise function: Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\nElectricVehicles1 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles1\", lb=0, ub=20)\nElectricVehicles2 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles2\", lb=20, ub=150)\nElectricVehicles_b1 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b1\")\nElectricVehicles_b2 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b2\")\nmodel.addCons(ElectricVehicles_b1 + ElectricVehicles_b2 == 1)\nmodel.addCons(ElectricVehicles == ElectricVehicles1*ElectricVehicles_b1 + ElectricVehicles2*ElectricVehicles_b2)\nProfit_ElectricVehicles = 2000 * ElectricVehicles1 * ElectricVehicles_b1 + (2000 - 0.3 * (ElectricVehicles2 - 20)) * ElectricVehicles2 * ElectricVehicles_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\nmodel.addCons(obj == Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles)\n\n# Add constraints\nmodel.addCons(5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Quantity of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Quantity of Electric Vehicles: \", model.getVal(ElectricVehicles))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1149,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products.\n// Total profit: Profit = P_a + P_b + P_c = 100Q_a - 0.5Q_a^2 + 150Q_b - 0.6Q_b^2 + 200Q_c - 0.7Q_c^2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of product A must not exceed 300 units.\n// Qa <= 300\n\n## Generate Constraint-3:\nTo maintain quality standards, the production of product B must be at least 100 units.\n// Qb >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products.\n\nThe company has a limited budget for raw materials, which restricts the total production quantity to 1000 units. Due to market demand, the production of product A must not exceed 300 units. To maintain quality standards, the production of product B must be at least 100 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0, ub=300) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=100, ub=1000) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0, ub=1000) # production quantity of product C\n\n# Define objective function\n## The profit from each product depends on the production quantity and a nonlinear relationship between production and cost.\nP_a = 100 * Qa - 0.5 * Qa**2\nP_b = 150 * Qb - 0.6 * Qb**2\nP_c = 200 * Qc - 0.7 * Qc**2\nProfit = P_a + P_b + P_c\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. \nEach unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. \nEach unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit.\nThe plant aims to maximize the profit per unit of labor used.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 7 * B\n// Profit from C: Profit_C = 9 * C\n// Total labor used: Labor = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for raw materials.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily limit of 150 hours of labor.\n// 2 * A + 3 * B + 4 * C <= 150\n\n## Generate Constraint-3:\nThe plant must produce at least 20 units of each component daily.\n// A >= 20; B >= 20; C >= 20",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\nEach unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. \nEach unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. \nEach unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit.\nThe plant has a daily budget of $1000 for raw materials. The plant has a daily limit of 150 hours of labor. The plant must produce at least 20 units of each component daily.\nPlease help the plant to maximize the profit per unit of labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nLabor = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily budget of $1000 for raw materials.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n## The plant has a daily limit of 150 hours of labor.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate per Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\n// {\"area of G1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of G2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of G3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The farm aims to maximize the net profit (yield * price per kg - energy cost). The price per kg of the crop is $2.\n// Profit_G1 = 10 * A1 * 2 - 5 * A1\n// Profit_G2 = 15 * A2 * 2 - 7 * A2\n// Profit_G3 = 20 * A3 * 2 - 9 * A3\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\n\n## Generate Constraint-1:\nThe total area available for all greenhouses is 1000 square meters.\n// A1 + A2 + A3 <= 1000",
        "question": "A farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation. The yield per square meter and energy cost per square meter for each greenhouse are given in the following Table.\n\n| Greenhouse | Yield per Square Meter | Energy Cost per Square Meter |\n|------------|------------------------|------------------------------|\n| G1         | 10 kg                  | $5                           |\n| G2         | 15 kg                  | $7                           |\n| G3         | 20 kg                  | $9                           |\n\nThe price per kg of the crop is $2. The farm aims to maximize the net profit (yield * price per kg - energy cost). The total area available for all greenhouses is 1000 square meters. Please help the farm determine the optimal area to allocate to each greenhouse type to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of G1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of G2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of G3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_G1 = 10 * A1 * 2 - 5 * A1\nProfit_G2 = 15 * A2 * 2 - 7 * A2\nProfit_G3 = 20 * A3 * 2 - 9 * A3\n## the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\nmodel.addCons(obj == Profit_G1 + Profit_G2 + Profit_G3)\n\n# Add constraints\n## The total area available for all greenhouses is 1000 square meters.\nmodel.addCons(A1 + A2 + A3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of G1: \", model.getVal(A1))\n    print(\"Area of G2: \", model.getVal(A2))\n    print(\"Area of G3: \", model.getVal(A3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the product A line can produce 10 units per hour, with a cost of $5 per unit.\nEach worker on the product B line can produce 15 units per hour, with a cost of $7 per unit.\nEach worker on the product C line can produce 20 units per hour, with a cost of $9 per unit.\nThe manufacturer wants to maximize the profit, which is the total revenue minus the total cost. The selling price for each product is $10.\n// Total revenue: Revenue = 10 * (10 * A + 15 * B + 20 * C)\n// Total cost: Cost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// A + B + C <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 20 workers.\n// A <= 20; B <= 20; C <= 20\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\n// 10 * A >= 200\n// 15 * B >= 300\n// 20 * C >= 400",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. Each worker on the product A line can produce 10 units per hour, with a cost of $5 per unit. Each worker on the product B line can produce 15 units per hour, with a cost of $7 per unit. Each worker on the product C line can produce 20 units per hour, with a cost of $9 per unit. The selling price for each product is $10. The manufacturer wants to maximize the profit, which is the total revenue minus the total cost.\n\nThere are a total of 50 workers available. Each production line can handle a maximum of 20 workers. The manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on product A line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on product B line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Total revenue: Revenue = 10 * (10 * A + 15 * B + 20 * C)\n## Total cost: Cost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 10 * (10 * A + 15 * B + 20 * C)\nCost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(A + B + C <= 50)\n## Each production line can handle a maximum of 20 workers.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 20)\nmodel.addCons(C <= 20)\n## The manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\nmodel.addCons(10 * A >= 200)\nmodel.addCons(15 * B >= 300)\nmodel.addCons(20 * C >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on product A line: \", model.getVal(A))\n    print(\"Number of workers on product B line: \", model.getVal(B))\n    print(\"Number of workers on product C line: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for component A\": \"M_A\", \"range\": \"M_A >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M_B\", \"range\": \"M_B >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M_C\", \"range\": \"M_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n// Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n// The objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * M_A + 7 * M_B + 9 * M_C <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 100.\n// M_A + M_B + M_C <= 100\n\n## Generate Constraint-3:\nAt least 20% of the machines must be dedicated to component A.\n// M_A >= 0.2 * (M_A + M_B + M_C)\n\n## Generate Constraint-4:\nNo more than 50 machines can be used for component C.\n// M_C <= 50",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type. Each machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 100. At least 20% of the machines must be dedicated to component A. No more than 50 machines can be used for component C. Please help the manufacturer determine the optimal number of machines for each component to achieve the objective.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM_A = model.addVar(vtype=\"INTEGER\", name=\"M_A\", lb=0) # number of machines for component A\nM_B = model.addVar(vtype=\"INTEGER\", name=\"M_B\", lb=0) # number of machines for component B\nM_C = model.addVar(vtype=\"INTEGER\", name=\"M_C\", lb=0, ub=50) # number of machines for component C\n\n# Define objective function\nOutput = 10 * M_A + 15 * M_B + 20 * M_C\nCost = 5 * M_A + 7 * M_B + 9 * M_C\n# The objective function is: Maximize (Output - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n# The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * M_A + 7 * M_B + 9 * M_C <= 1500)\n# The total number of machines available is 100.\nmodel.addCons(M_A + M_B + M_C <= 100)\n# At least 20% of the machines must be dedicated to component A.\nmodel.addCons(M_A >= 0.2 * (M_A + M_B + M_C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M_A))\n    print(\"Number of Machines for Component B: \", model.getVal(M_B))\n    print(\"Number of Machines for Component C: \", model.getVal(M_C))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300\n\n## Generate Constraint-2:\nThe soil fertility must remain above 50 points after planting all crops.\n// 2 * A1 + 3 * A2 + 5 * A3 <= 100 (assuming the initial soil fertility is 100 points)\n\n## Generate Constraint-3:\nThe total acreage available for planting is 50 acres.\n// A1 + A2 + A3 <= 50\n\n## Generate Constraint-4:\nThe market demand for C1 is 10 acres. So, the farm can only plant a maximum of 10 acres of C1.\n// A1 <= 10",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage. The profit per acre, water usage per acre, and soil fertility degradation per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Usage per Acre | Soil Fertility Degradation per Acre |\n|------|-----------------|----------------------|------------------------------------|\n| C1   | $100            | 5 units              | 2 points                           |\n| C2   | $150            | 7 units              | 3 points                           |\n| C3   | $200            | 10 units             | 5 points                           |\n\nThe farm has a limited water supply of 300 units. The soil fertility must remain above 50 points after planting all crops. The total acreage available for planting is 50 acres. The market demand for C1 is 10 acres. So, the farm can only plant a maximum of 10 acres of C1.\nPlease help the farm to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n## The soil fertility must remain above 50 points after planting all crops.\nmodel.addCons(2 * A1 + 3 * A2 + 5 * A3 <= 100)\n## The total acreage available for planting is 50 acres.\nmodel.addCons(A1 + A2 + A3 <= 50)\n## The market demand for C1 is 10 acres. So, the farm can only plant a maximum of 10 acres of C1.\nmodel.addCons(A1 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1152,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer aims to maximize the profit per hour of production time.\n// Profit_A = (30 - 10) * A\n// Profit_B = (40 - 15) * B\n// Profit_C = (50 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time limit of 150 hours.\n// A + 2 * B + 3 * C <= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations. The revenue per unit, production cost per unit, and production time per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|------------------|--------------------------|--------------------------|\n| A       | $30              | $10                      | 1 hour                    |\n| B       | $40              | $15                      | 2 hours                   |\n| C       | $50              | $20                      | 3 hours                   |\n\nThe manufacturer has a total production time limit of 150 hours. Please help the manufacturer to maximize the profit per hour of production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a total production time limit of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 863,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency.\n// {\"number of workers on product line 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product line 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n// The production rate for product 1: R1 = 10 * W1\n// The production rate for product 2: R2 = 15 * W2\n// The production rate for product 3: R3 = 20 * W3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach product line has a maximum capacity of 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nTo ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5.\n// W1 / W2 <= 1.5\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the total workers are allocated to product line 3.\n// W3 >= 0.2 * (W1 + W2 + W3)",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of workers to each product line to maximize efficiency. Each worker on product line 1 can produce 10 units of product 1 per hour, on product line 2 can produce 15 units of product 2 per hour, and on product line 3 can produce 20 units of product 3 per hour. The company aims to maximize the total production rate of all three products.\n\n| Product Line | Production Rate per Worker (units/hour) |\n|--------------|-----------------------------------------|\n| 1            | 10                                      |\n| 2            | 15                                      |\n| 3            | 20                                      |\n\nThe company has a total of 50 workers available. Each product line has a maximum capacity of 20 workers. To ensure balanced production, the ratio of workers on product line 1 to product line 2 should not exceed 1.5. The company wants to ensure that at least 20% of the total workers are allocated to product line 3.\n\nPlease help the company determine the optimal number of workers to allocate to each product line (W1 for product line 1, W2 for product line 2, and W3 for product line 3) to maximize the total production rate while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on product line 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on product line 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on product line 3\n\n# Define objective function\nR1 = 10 * W1\nR2 = 15 * W2\nR3 = 20 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 50)\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Constraint for the ratio of workers on product line 1 to product line 2\nmodel.addCons(W1 <= 1.5 * W2)\n\n# Constraint to ensure at least 20% of the total workers are allocated to product line 3\nmodel.addCons(W3 >= 0.2 * (W1 + W2 + W3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product Line 1: \", model.getVal(W1))\n    print(\"Number of Workers on Product Line 2: \", model.getVal(W2))\n    print(\"Number of Workers on Product Line 3: \", model.getVal(W3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1326,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit.\n// {\"units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n// The net profit for component A: P_A = 50A - 20A = 30A\n// The net profit for component B: P_B = 70B - 30B = 40B\n// The net profit for component C: P_C = 60C - 25C = 35C\n// The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production of component A must be at least twice the production of component B.\n// A >= 2B",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit. The profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit. The company has a limited production capacity and can produce a maximum of 100 units in total per day. Due to market demand, the production of component A must be at least twice the production of component B. Please help the company to maximize its net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # units of component C\n\n# Define objective function\nP_A = 30 * A\nP_B = 40 * B\nP_C = 35 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(A >= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Component A: \", model.getVal(A))\n    print(\"Units of Component B: \", model.getVal(B))\n    print(\"Units of Component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 698,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company needs to determine the number of machines to allocate to each type of component production to optimize efficiency.\n// {\"number of machines for resistors\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of machines for capacitors\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing each type of component. \nA resistor machine produces 100 units per hour, a capacitor machine produces 120 units per hour, and an inductor machine produces 80 units per hour. \nThe company needs to produce at least 1000 units of resistors, 1500 units of capacitors, and 800 units of inductors daily. The machines can only be used for one type of component at a time. Determine the minimum number of hours needed to meet the daily demand.\n// The production time for resistors: T_R = 1000 / (100 * R)\n// The production time for capacitors: T_C = 1500 / (120 * C)\n// The production time for inductors: T_L = 800 / (80 * L)\n// So, the objective function is: Minimize max(T_R, T_C, T_L)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available.\n// R + C + L <= 20\n\n## Generate Constraint-2:\nEach type of machine can be utilized by up to 10 machines at a time.\n// R <= 10; C <= 10; L <= 10",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company needs to determine the number of machines to allocate to each type of component production to optimize efficiency. Each machine has a different efficiency in producing each type of component: a resistor machine produces 100 units per hour, a capacitor machine produces 120 units per hour, and an inductor machine produces 80 units per hour. The company needs to produce at least 1000 units of resistors, 1500 units of capacitors, and 800 units of inductors daily. The machines can only be used for one type of component at a time.\n\n| Component | Units Produced per Hour | Daily Demand |\n|-----------|-------------------------|--------------|\n| Resistors | 100                     | 1000         |\n| Capacitors| 120                     | 1500         |\n| Inductors | 80                      | 800          |\n\nThere are a total of 20 machines available. Each type of machine can be utilized by up to 10 machines at a time. Determine the minimum number of hours needed to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of machines for resistors\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of machines for capacitors\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of machines for inductors\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_R = 1000 / (100 * R)\nT_C = 1500 / (120 * C)\nT_L = 800 / (80 * L)\n## convert the division to multiplication\nmodel.addCons(obj >= T_R)\nmodel.addCons(obj >= T_C)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 20 machines available.\nmodel.addCons(R + C + L <= 20)\n## Each type of machine can be utilized by up to 10 machines at a time.\nmodel.addCons(R <= 10)\nmodel.addCons(C <= 10)\nmodel.addCons(L <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Resistors: \", model.getVal(R))\n    print(\"Number of Machines for Capacitors: \", model.getVal(C))\n    print(\"Number of Machines for Inductors: \", model.getVal(L))\n    print(\"Minimum Hours Needed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1112,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 20.\n// Cap + Res + Ind <= 20\n\n## Generate Constraint-3:\nAt least 5 machines must be dedicated to capacitors.\n// Cap >= 5\n\n## Generate Constraint-4:\nNo more than 10 machines can be used for resistors.\n// Res <= 10\n\n## Generate Constraint-5:\nThe production of inductors must not exceed 3000 units per hour.\n// 200 * Ind <= 3000",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates and maintenance costs for each type of machine are given in the following Table.\n\n| Component | Units Produced per Hour per Machine | Maintenance Cost per Hour per Machine | Selling Price per Unit |\n|-----------|-------------------------------------|---------------------------------------|------------------------|\n| Capacitors | 100                                 | $5                                    | $0.1                   |\n| Resistors  | 150                                 | $7                                    | $0.2                   |\n| Inductors  | 200                                 | $9                                    | $0.3                   |\n\nThe manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 20. At least 5 machines must be dedicated to capacitors. No more than 10 machines can be used for resistors. The production of inductors must not exceed 3000 units per hour.\n\nPlease help the manufacturer determine the optimal number of machines to dedicate to each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=5)  # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0, ub=10)  # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0)  # number of machines for inductors\n\n# Define objective function\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n# So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n# The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n# The total number of machines available is 20.\nmodel.addCons(Cap + Res + Ind <= 20)\n# No more than 10 machines can be used for resistors.\nmodel.addCons(Res <= 10)\n# The production of inductors must not exceed 3000 units per hour.\nmodel.addCons(200 * Ind <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Inductor Machines: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1324,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit.\n// {\"acres of Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yield rates and profit margins for each crop. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops.\n// Total profit from Wheat: Profit_Wheat = 50 * 10 * WheatAcres\n// Total profit from Corn: Profit_Corn = 60 * 12 * CornAcres\n// Total profit from Soybeans: Profit_Soybeans = 40 * 15 * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\n// CornAcres <= 40\n\n## Generate Constraint-3:\nTo maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop.\n// WheatAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)\n// CornAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)\n// SoybeansAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn. To maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop. Please help the farm determine the optimal allocation of acres to Wheat, Corn, and Soybeans to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of Soybeans\n\n# Define objective function\nProfit_Wheat = 50 * 10 * WheatAcres\nProfit_Corn = 60 * 12 * CornAcres\nProfit_Soybeans = 40 * 15 * SoybeansAcres\n# So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The farm has a total of 100 acres available for cultivation.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n# Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\nmodel.addCons(CornAcres <= 40)\n# To maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop.\nmodel.addCons(WheatAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\nmodel.addCons(CornAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\nmodel.addCons(SoybeansAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 856,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the production process is such that the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (50 * A / (1 + 0.01 * A^2) + 70 * B / (1 + 0.02 * B^2) + 90 * C / (1 + 0.03 * C^2))\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 200 units per week.\n// A >= 200\n\n## Generate Constraint-3:\nThe company has a policy to produce at least twice as many units of component B as component C.\n// B >= 2 * C",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand. The profit per unit of component A is $50, component B is $70, and component C is $90. However, the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n\nThe total production capacity of the factory is limited to 1000 units per week. The market demand for component A is at least 200 units per week. The company has a policy to produce at least twice as many units of component B as component C.\n\nPlease help the company to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)    # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with nonlinear decrease\nProfit_A = 50 * A / (1 + 0.01 * A**2)\nProfit_B = 70 * B / (1 + 0.02 * B**2)\nProfit_C = 90 * C / (1 + 0.03 * C**2)\n\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n## The market demand for component A is at least 200 units per week.\nmodel.addCons(A >= 200)\n## The company has a policy to produce at least twice as many units of component B as component C.\nmodel.addCons(B >= 2 * C)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2, where R is the amount of raw materials, L is the labor hours, and M is the machine hours.\n\nThe total budget for raw materials is $5000, and the total available labor hours are 1000 hours. Please help the plant manager to maximize the total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 572,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit.\n// {\"amount of raw material for chemical A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit function for each chemical is nonlinear and given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units.\n// RA + RB + RC <= 1000",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit. The profit from each chemical depends on the amount of raw material used. The profit function for each chemical is nonlinear and given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals. The total amount of raw material available is 1000 units.\nPlease help the plant manager to determine the optimal allocation of raw material to each chemical production line to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # amount of raw material for chemical A\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # amount of raw material for chemical B\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # amount of raw material for chemical C\n\n# Define objective function\n## The profit function for each chemical is nonlinear and given by:\n## Chemical A: PA = 50 * RA^0.7\n## Chemical B: PB = 60 * RB^0.8\n## Chemical C: PC = 70 * RC^0.6\n## The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\nPA = 50 * RA**0.7\nPB = 60 * RB**0.8\nPC = 70 * RC**0.6\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical A: \", model.getVal(RA))\n    print(\"Amount of Raw Material for Chemical B: \", model.getVal(RB))\n    print(\"Amount of Raw Material for Chemical C: \", model.getVal(RC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000. Please help the plant manager to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\nP = 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 483,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale. Specifically, the profit function is given by P = Q^2, where P is the profit and Q is the quantity produced.\n// Profit_C1 = (100 * C1)^2\n// Profit_C2 = (150 * C2)^2\n// Profit_C3 = (200 * C3)^2\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\n// C1 + C2 + C3 <= 500",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale, where the profit function is given by P = Q^2, with P being the profit and Q being the quantity produced.\n\n| Chemical | Profit per Unit |\n|----------|-----------------|\n| C1       | 100$            |\n| C2       | 150$            |\n| C3       | 200$            |\n\nThe plant has a limited amount of raw material that can produce a total of 500 units of chemicals. Please help the plant to maximize the total profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n## Profit_C1 = (100 * C1)^2\n## Profit_C2 = (150 * C2)^2\n## Profit_C3 = (200 * C3)^2\nProfit_C1 = (100 * C1)**2\nProfit_C2 = (150 * C2)**2\nProfit_C3 = (200 * C3)**2\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\nmodel.addCons(C1 + C2 + C3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets.\n// {\"hours for machine A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"hours for machine B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"hours for machine C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget.\n// The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\n// The production constraint for widget A: 5 * MA >= 100\n// The production constraint for widget B: 10 * MB >= 100\n// The production constraint for widget C: 15 * MC >= 100\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 20 hours per day.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nMachine A can operate for a maximum of 8 hours per day.\n// MA <= 8",
        "question": "A manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets. Each machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget. The total operating hours for all machines must not exceed 20 hours per day, and Machine A can operate for a maximum of 8 hours per day. Please help the plant manager to minimize the total cost of production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # hours for machine A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # hours for machine B\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # hours for machine C\n\n# Define objective function\n## The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\nCost = 10 * MA + 15 * MB + 20 * MC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The production constraint for widget A: 5 * MA >= 100\nmodel.addCons(5 * MA >= 100)\n## The production constraint for widget B: 10 * MB >= 100\nmodel.addCons(10 * MB >= 100)\n## The production constraint for widget C: 15 * MC >= 100\nmodel.addCons(15 * MC >= 100)\n## The total operating hours for all machines must not exceed 20 hours per day.\nmodel.addCons(MA + MB + MC <= 20)\n## Machine A can operate for a maximum of 8 hours per day.\nmodel.addCons(MA <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Machine A: \", model.getVal(MA))\n    print(\"Hours for Machine B: \", model.getVal(MB))\n    print(\"Hours for Machine C: \", model.getVal(MC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n// The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $50,000.\n// 0.05 * S^2 + 0.07 * T^2 + 0.1 * L^2 <= 50000\n\n## Generate Constraint-2:\nThe production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\n// S <= 500; T <= 300; L <= 200\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of each device to meet contractual obligations.\n// S >= 100; T >= 100; L >= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n\n| Device     | Profit per Unit | Production Cost Formula |\n|------------|-----------------|-------------------------|\n| Smartphones| $100            | 0.05 * S^2             |\n| Tablets    | $150            | 0.07 * T^2             |\n| Laptops    | $200            | 0.1 * L^2              |\n\nThe company has a budget constraint that limits the total production cost to $50,000. The production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units. The company must produce at least 100 units of each device to meet contractual obligations.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize profit under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100, ub=500)  # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=100, ub=300)  # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=100, ub=200)  # number of laptops\n\n# Define objective function\n# The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.07 * T**2 + 200 * L - 0.1 * L**2)\n\n# Add constraints\n# The company has a budget constraint that limits the total production cost to $50,000.\nmodel.addCons(0.05 * S**2 + 0.07 * T**2 + 0.1 * L**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm has a limited water supply of 500,000 liters.\nPlease help the farm to maximize the profit efficiency (profit per liter of water used).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. \nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. \nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n// Cost per ton-km for A: Cost_A = 200 / (5 * 10 * A)\n// Cost per ton-km for B: Cost_B = 300 / (10 * 15 * B)\n// Cost per ton-km for C: Cost_C = 400 / (15 * 20 * C)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe company needs to transport at least 100 tons of cargo next month.\n// 5 * A + 10 * B + 15 * C >= 100",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|---------|-----------------------|---------------------------|----------------------|\n| A       | 10                    | 200                       | 5                    |\n| B       | 15                    | 300                       | 10                   |\n| C       | 20                    | 400                       | 15                   |\n\nThe company has a budget of $10,000 for vehicle maintenance next month. The company needs to transport at least 100 tons of cargo next month. Please help the company to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 / (5 * 10 * A)\nCost_B = 300 / (10 * 15 * B)\nCost_C = 400 / (15 * 20 * C)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The company needs to transport at least 100 tons of cargo next month.\nmodel.addCons(5 * A + 10 * B + 15 * C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\n// {\"number of TypeA solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company wants to maximize the total energy output per dollar spent.\n// Total energy output for TypeA: Energy_TypeA = 100 * 365 * 10 * TypeASolarPanels\n// Total energy output for TypeB: Energy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\n// Total energy output for TypeC: Energy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\n// Total cost for TypeA: Cost_TypeA = 500 * TypeASolarPanels\n// Total cost for TypeB: Cost_TypeB = 750 * TypeBSolarPanels\n// Total cost for TypeC: Cost_TypeC = 1000 * TypeCSolarPanels\n// So, the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1,000,000\n\n## Generate Constraint-2:\nThe facility has space for a maximum of 1500 solar panels.\n// TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500\n\n## Generate Constraint-3:\nDue to local regulations, at least 20% of the panels must be TypeA.\n// TypeASolarPanels >= 0.2 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)\n\n## Generate Constraint-4:\nThe company wants to ensure a balanced mix of technologies, so no more than 50% of the panels can be of any single type.\n// TypeASolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)\n// TypeBSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)\n// TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)",
        "question": "A renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company has a budget of $1,000,000 for the installation. The facility has space for a maximum of 1500 solar panels. Due to local regulations, at least 20% of the panels must be TypeA. The company wants to ensure a balanced mix of technologies, so no more than 50% of the panels can be of any single type.\nPlease help the company to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergy_TypeA = 100 * 365 * 10 * TypeASolarPanels\nEnergy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\nEnergy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\nCost_TypeA = 500 * TypeASolarPanels\nCost_TypeB = 750 * TypeBSolarPanels\nCost_TypeC = 1000 * TypeCSolarPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n# convert the division to multiplication\nmodel.addCons(obj * (Cost_TypeA + Cost_TypeB + Cost_TypeC) == Energy_TypeA + Energy_TypeB + Energy_TypeC)\n\n# Add constraints\n# The company has a budget of $1,000,000 for the installation.\nmodel.addCons(500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1000000)\n# The facility has space for a maximum of 1500 solar panels.\nmodel.addCons(TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500)\n# Due to local regulations, at least 20% of the panels must be TypeA.\nmodel.addCons(TypeASolarPanels >= 0.2 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\n# The company wants to ensure a balanced mix of technologies, so no more than 50% of the panels can be of any single type.\nmodel.addCons(TypeASolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\nmodel.addCons(TypeBSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\nmodel.addCons(TypeCSolarPanels <= 0.5 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of TypeB Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of TypeC Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 945,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies based on the production cost and market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company aims to maximize the total profit.\n// The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\n\n## Generate Constraint-1:\nThe company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n// 30S + 70T + 120L <= 10000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\nmodel.addCons(obj == S * (50 - 0.1 * S) + T * (100 - 0.2 * T) + L * (150 - 0.3 * L))\n\n# Add constraints\n## The company has a budget constraint of 10000 dollars for production.\nmodel.addCons(30 * S + 70 * T + 120 * L <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 597,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor.\nThe profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor.\nThe profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor.\nThe company aims to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = (10A + 5A) + (15B + 7B) + (20C + 10C)\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials and labor.\n// 10A + 5A + 15B + 7B + 20C + 10C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company wants to optimize its production to maximize profit while considering the costs of raw materials and labor. The profit per unit of product A is $50, but it requires $10 worth of raw materials and $5 of labor. The profit per unit of product B is $70, but it requires $15 worth of raw materials and $7 of labor. The profit per unit of product C is $90, but it requires $20 worth of raw materials and $10 of labor. The company has a budget of $10,000 for raw materials and labor. Please help the company to maximize the net profit, which is the total profit minus the total cost of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = (10 * A + 5 * A) + (15 * B + 7 * B) + (20 * C + 10 * C)\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials and labor.\nmodel.addCons(10 * A + 5 * A + 15 * B + 7 * B + 20 * C + 10 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 686,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations.\n// Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n// Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n// Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 50 units, and for component B and C is at least 30 units each.\n// A >= 50; B >= 30; C >= 30\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 200 units per month.\n// A + B + C <= 200",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company has a budget of $10,000 for production costs. The market demand for component A is at least 50 units, and for component B and C is at least 30 units each. The total production capacity of the company is limited to 200 units per month.\nThe company aims to maximize the total profit after considering both production and storage costs, where the storage cost is a function of the square of the production quantity due to space limitations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=30) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n## Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n## Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (30 - 10 - 5 * A**2) * A + (40 - 15 - 7 * B**2) * B + (50 - 20 - 9 * C**2) * C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The total production capacity of the company is limited to 200 units per month.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1047,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The revenue from component A: R_A = 50 * A\n// The revenue from component B: R_B = 70 * B\n// The revenue from component C: R_C = 60 * C\n// The production cost for component A: C_A = 0.01 * A^2\n// The production cost for component B: C_B = 0.02 * B^2\n// The production cost for component C: C_C = 0.015 * C^2\n// So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe availability of a critical raw material limits the production of component A to at most 50 units.\n// A <= 50\n\n## Generate Constraint-3:\nThe production of component B is limited by a specialized machine that can only handle up to 40 units per day.\n// B <= 40\n\n## Generate Constraint-4:\nThe company has a contract to produce at least 20 units of component C per day.\n// C >= 20",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost. The total production capacity is limited to 100 units per day. The availability of a critical raw material limits the production of component A to at most 50 units. The production of component B is limited by a specialized machine that can only handle up to 40 units per day. The company has a contract to produce at least 20 units of component C per day. Please help the company determine the optimal number of units to produce for each component to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of component C\n\n# Define objective function\n## The revenue from component A: R_A = 50 * A\n## The revenue from component B: R_B = 70 * B\n## The revenue from component C: R_C = 60 * C\n## The production cost for component A: C_A = 0.01 * A^2\n## The production cost for component B: C_B = 0.02 * B^2\n## The production cost for component C: C_C = 0.015 * C^2\n## So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\nR_A = 50 * A\nR_B = 70 * B\nR_C = 60 * C\nC_A = 0.01 * A**2\nC_B = 0.02 * B**2\nC_C = 0.015 * C**2\nProfit = R_A - C_A + R_B - C_B + R_C - C_C\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The availability of a critical raw material limits the production of component A to at most 50 units.\nmodel.addCons(A <= 50)\n## The production of component B is limited by a specialized machine that can only handle up to 40 units per day.\nmodel.addCons(B <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of generating energy from solar is $50 per unit, with a reliability of 90%.\nThe cost of generating energy from wind is $70 per unit, with a reliability of 85%.\nThe cost of generating energy from hydro is $60 per unit, with a reliability of 95%.\nThe company wants to minimize the Cost-Reliability ratio of the energy generation. (The Cost-Reliability ratio is defined as the total cost of energy generation divided by the total reliability of the energy sources.)\n// total cost of energy generation: Cost = 50 * Solar + 70 * Wind + 60 * Hydro\n// total reliability of energy sources: Reliability = 90% * Solar + 85% * Wind + 95% * Hydro\n// So, the objective function is: Minimize Cost / Reliability\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for energy investment.\n// 50 * Solar + 70 * Wind + 60 * Hydro <= 150000",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro. The cost and reliability of each energy source are given in the following Table.\n\n| Energy Source | Cost per Unit | Reliability |\n|---------------|---------------|-------------|\n| Solar         | $50           | 90%         |\n| Wind          | $70           | 85%         |\n| Hydro         | $60           | 95%         |\n\nThe company has a budget of $150,000 for energy investment. The company wants to minimize the Cost-Reliability ratio of the energy generation. (The Cost-Reliability ratio is defined as the total cost of energy generation divided by the total reliability of the energy sources.)\nPlease help the company determine the optimal amount of energy to generate from each source.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * Solar + 70 * Wind + 60 * Hydro\nReliability = 0.9 * Solar + 0.85 * Wind + 0.95 * Hydro\n## the objective function is: Minimize Cost / Reliability\n## convert the division to multiplication\nmodel.addCons(obj * Reliability == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for energy investment.\nmodel.addCons(50 * Solar + 70 * Wind + 60 * Hydro <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Energy from Solar: \", model.getVal(Solar))\n    print(\"Amount of Energy from Wind: \", model.getVal(Wind))\n    print(\"Amount of Energy from Hydro: \", model.getVal(Hydro))\n    print(\"Minimized Cost-Reliability Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $300, and the water requirement is 5000 liters.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $500, and the water requirement is 7000 liters.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $700, and the water requirement is 9000 liters.\nThe farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n// Net revenue of A: Net_A = (1000 - 300) * A\n// Net revenue of B: Net_B = (1500 - 500) * B\n// Net revenue of C: Net_C = (2000 - 700) * C\n// So, the objective function is: Maximize (Net_A + Net_B + Net_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $10000 for seeds for the upcoming season.\n// 300 * A + 500 * B + 700 * C <= 10000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $300, and the water requirement is 5000 liters.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $500, and the water requirement is 7000 liters.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $700, and the water requirement is 9000 liters.\nThe farm has a budget of $10000 for seeds for the upcoming season.\nThe farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\nPlease help the farm determine the optimal allocation of hectares to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_A = (1000 - 300) * A\nNet_B = (1500 - 500) * B\nNet_C = (2000 - 700) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_A + Net_B + Net_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_A + Net_B + Net_C)\n\n# Add constraints\n## The farm has a budget of $10000 for seeds for the upcoming season.\nmodel.addCons(300 * A + 500 * B + 700 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A generates a revenue of $100 per unit and requires 2 labor hours per unit, while Product B generates a revenue of $150 per unit and requires 3 labor hours per unit. The labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company aims to maximize the total profit from both products.\n// Profit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\n// Profit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total of 200 labor hours available for the month.\n// 2 * A + 3 * B <= 200\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials.\n// 30 * A + 40 * B <= 5000\n\n## Generate Constraint-4:\nThe market demand for Product A is 50 units. So, the company can only sell a maximum of 50 units of Product A.\n// A <= 50",
        "question": "A manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs. Product A generates a revenue of $100 per unit and requires 2 labor hours per unit, while Product B generates a revenue of $150 per unit and requires 3 labor hours per unit. The labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company aims to maximize the total profit from both products. The company has a total of 200 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. The raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials. The market demand for Product A is 50 units. So, the company can only sell a maximum of 50 units of Product A. Please help the company to determine the optimal production quantities of both products and the investment in automation technology to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\nProfit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B <= 200) # Constraint-1: Total labor hours\nmodel.addCons(Automation <= 50000) # Constraint-2: Investment in automation\nmodel.addCons(30 * A + 40 * B <= 5000) # Constraint-3: Raw material budget\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1178,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\n// TruckB <= 0.5 * TruckA\n\n## Generate Constraint-3:\nThe company has a maximum of 100 trucks available in total.\n// TruckA + TruckB + TruckC <= 100",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations. The company incurs different costs for fuel, maintenance, and driver wages for each type of truck. For TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. For TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. For TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. The company has a total budget of $500,000 for truck operations. Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA. The company has a maximum of 100 trucks available in total. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n# Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\nmodel.addCons(TruckB <= 0.5 * TruckA)\n# The company has a maximum of 100 trucks available in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. For CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. For CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. The farm has a total area of 100 hectares available for cultivation and a limited water supply of 500,000 liters. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal allocation of area for each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=0) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=0) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=0) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. For Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. For Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400. The farm has a limited water supply of 500,000 liters. Please help the farm to maximize the profit efficiency (profit per liter of water used).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 663,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of each drug is modeled as follows:\n\n| Drug    | Effectiveness Model                          |\n|---------|----------------------------------------------|\n| DrugA   | EffectivenessA = 50 * DosageA - 0.5 * DosageA^2 |\n| DrugB   | EffectivenessB = 60 * DosageB - 0.3 * DosageB^3 |\n| DrugC   | EffectivenessC = 70 * DosageC - 0.2 * DosageC^4 |\n\nThe company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. The dosage levels for each drug must be between 0 and 100 units.\n\nPlease help the company determine the optimal dosage levels for DrugA, DrugB, and DrugC to maximize the total effectiveness while adhering to the safety constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 500 units in total.\n// ProductA + ProductB + ProductC <= 500\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\n// ProductA >= 100\n// ProductC >= 150\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// ProductB >= 2 * ProductA\n\n## Generate Constraint-5:\nThe production of Product C should not exceed 30% of the total production.\n// ProductC <= 0.3 * (ProductA + ProductB + ProductC)",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The following table summarizes the cost per unit for each product.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $50             | $20           |\n| B       | $70             | $30           |\n| C       | $60             | $25           |\n\nThe company has a budget of $15,000 for total production costs. The company's workforce can produce a maximum of 500 units in total. The market demand for Product A is at least 100 units, and for Product C, it is at least 150 units. The company aims to produce at least twice as many units of Product B as Product A. Additionally, the production of Product C should not exceed 30% of the total production.\n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total production cost must not exceed $15,000.\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000)\n# The company has a limited workforce that can produce a maximum of 500 units in total.\nmodel.addCons(ProductA + ProductB + ProductC <= 500)\n# The market demand for Product A is at least 100 units, and for Product C, it is at least 150 units.\nmodel.addCons(ProductA >= 100)\nmodel.addCons(ProductC >= 150)\n# The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(ProductB >= 2 * ProductA)\n# The production of Product C should not exceed 30% of the total production.\nmodel.addCons(ProductC <= 0.3 * (ProductA + ProductB + ProductC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products. The total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7. The company also has a storage capacity limit of 500 units for all products combined. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Soil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + 50)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units. The farmer has a total of 100 acres available for cultivation.\nPlease help the farmer to maximize his total profit while ensuring the soil's nitrogen level does not fall below 50 units.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nSoil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Soil_Nitrogen_Depletion + 50)\n## convert the division to multiplication\nmodel.addCons(obj * (Soil_Nitrogen_Depletion + 50) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| A    | $1000               | 2 units                       |\n| B    | $1500               | 3 units                       |\n| C    | $2000               | 4 units                       |\n\nThe farmer has access to a total of 100 units of water. The total available land for cultivation is 50 hectares. Please help the farmer to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n// Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n// Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total advertising budget for all products cannot exceed $100,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 5000 units for each product.\n// ProdA <= 5000; ProdB <= 5000; ProdC <= 5000\n\n## Generate Constraint-3:\nDue to market research, the company knows that ProductA must have at least twice the production of ProductB.\n// ProdA >= 2 * ProdB",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit. The profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company aims to maximize the total profit from all products. The total advertising budget for all products cannot exceed $100,000. The company has a production capacity of 5000 units for each product. Due to market research, the company knows that ProductA must have at least twice the production of ProductB. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\nProfit_A = (50 + 0.0005 * AdBudgetA) * ProdA\nProfit_B = (70 + 0.0007 * AdBudgetB) * ProdB\nProfit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total advertising budget for all products cannot exceed $100,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 100000)\n# The company has a production capacity of 5000 units for each product.\nmodel.addCons(ProdA <= 5000)\nmodel.addCons(ProdB <= 5000)\nmodel.addCons(ProdC <= 5000)\n# Due to market research, the company knows that ProductA must have at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency.\n// {\"hours of operation for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3\n// So, the objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency. The efficiency of each production line in producing each component is given in the following Table.\n\n| Production Line | Units of A per Hour | Units of B per Hour | Units of C per Hour |\n|-----------------|---------------------|---------------------|---------------------|\n| 1               | 10                  | 15                  | 20                  |\n| 2               | 12                  | 18                  | 22                  |\n| 3               | 14                  | 20                  | 24                  |\n\nThe total operating hours for all production lines must not exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week. \nPlease help the company to maximize the total production of components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours of operation for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours of operation for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours of operation for production line 3\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3\nB_total = 15 * P1 + 18 * P2 + 20 * P3\nC_total = 20 * P1 + 22 * P2 + 24 * P3\n# So, the objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line 1: \", model.getVal(P1))\n    print(\"Hours of operation for production line 2: \", model.getVal(P2))\n    print(\"Hours of operation for production line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 985,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the investment in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for all products is $50. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\n// Total profit for ProductB: Profit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\n// Total profit for ProductC: Profit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They also need to determine the investment in a new energy-efficient technology that reduces the energy cost per unit produced. The initial energy cost per unit for all products is $50, and the revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades.\n\n| Product | Revenue per Unit | Initial Energy Cost per Unit |\n|---------|------------------|------------------------------|\n| ProductA | $100             | $50                          |\n| ProductB | $120             | $50                          |\n| ProductC | $150             | $50                          |\n\nThe company has a total production capacity of 10,000 units across all products. The investment in energy efficiency upgrades cannot exceed $50,000. The company aims to maximize the total profit from all products.\n\nPlease help the company determine the optimal production quantity for each product and the appropriate investment in energy efficiency to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\n## Total profit for ProductB: Profit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\n## Total profit for ProductC: Profit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\nProfit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\nProfit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n## The investment in energy efficiency upgrades cannot exceed $50,000.\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1195,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\n// WheatAcres >= 30",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost. The farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. The farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to allocate to each crop.\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=30) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the cost of raw materials decreases as production increases. For each product, if production exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The company aims to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\n// Cost_A = max(8 - 0.02 * (A - 100), 8) * A\n// Cost_B = max(12 - 0.02 * (B - 100), 12) * B\n// Cost_C = max(16 - 0.02 * (C - 100), 16) * C\n// Profit_A = (10 - Cost_A) * A\n// Profit_B = (15 - Cost_B) * B\n// Profit_C = (20 - Cost_C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg.\n// 5 * A + 7 * B + 9 * C <= 5000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200\n\n## Generate Constraint-3:\nThe company has a production capacity of 700 units in terms of the total number of units it can produce.\n// A + B + C <= 700",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity. The profit per unit and the cost of raw materials for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit (if production exceeds 100 units) |\n|---------|-----------------|------------------------------------------------|\n| A       | $10             | $8 - $0.02 * (A - 100)                         |\n| B       | $15             | $12 - $0.02 * (B - 100)                       |\n| C       | $20             | $16 - $0.02 * (C - 100)                       |\n\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg. The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units. The company has a production capacity of 700 units in terms of the total number of units it can produce.\n\nPlease help the company to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(8 - 0.02 * (A - 100), 8) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 8 * A1 * A_b1 + (8 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(12 - 0.02 * (B - 100), 12) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 12 * B1 * B_b1 + (12 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(16 - 0.02 * (C - 100), 16) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 16 * C1 * C_b1 + (16 - 0.02 * (C2 - 100)) * C2 * C_b2\n## calculate profits\nProfit_A = (10 - Cost_A) * A\nProfit_B = (15 - Cost_B) * B\nProfit_C = (20 - Cost_C) * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 5000)\nmodel.addCons(A + B + C <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1393,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each factory to optimize production efficiency.\n// {\"amount of raw material for factory 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for factory 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for factory 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different efficiency rate in converting raw material into the chemical product. Factory 1 has an efficiency of 0.5 kg product per kg of raw material, Factory 2 has an efficiency of 0.7 kg product per kg of raw material, and Factory 3 has an efficiency of 0.6 kg product per kg of raw material. The company wants to maximize the total amount of product produced.\n// The total product produced by Factory 1: P1 = 0.5 * R1\n// The total product produced by Factory 2: P2 = 0.7 * R2\n// The total product produced by Factory 3: P3 = 0.6 * R3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 kg.\n// R1 + R2 + R3 <= 1000\n\n## Generate Constraint-2:\nFactory 1 can handle up to 400 kg of raw material.\n// R1 <= 400",
        "question": "A company operates three different factories that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each factory to optimize production efficiency. Each factory has a different efficiency rate in converting raw material into the chemical product: Factory 1 has an efficiency of 0.5 kg product per kg of raw material, Factory 2 has an efficiency of 0.7 kg product per kg of raw material, and Factory 3 has an efficiency of 0.6 kg product per kg of raw material. The company wants to maximize the total amount of product produced. The total amount of raw material available is 1000 kg, and Factory 1 can handle up to 400 kg of raw material. Please help the company determine the optimal allocation of raw material to each factory.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material for factory 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for factory 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for factory 3\n\n# Define objective function\nP1 = 0.5 * R1\nP2 = 0.7 * R2\nP3 = 0.6 * R3\n# So, the objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total amount of raw material available is 1000 kg.\nmodel.addCons(R1 + R2 + R3 <= 1000)\n# Factory 1 can handle up to 400 kg of raw material.\nmodel.addCons(R1 <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Factory 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Factory 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Factory 3: \", model.getVal(R3))\n    print(\"Maximized Total Product: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop.\n// {\"area for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. \nFor C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. \nFor C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140.\nThe farm wants to maximize the net profit per liter of water used (profit per water efficiency).\n// Profit_C1 = 500 * A1 - 100 * A1\n// Profit_C2 = 600 * A2 - 120 * A2\n// Profit_C3 = 700 * A3 - 140 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (1000 * A1 + 1200 * A2 + 1400 * A3)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 acres.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 120,000 liters.\n// 1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000\n\n## Generate Constraint-3:\nThe farm has a budget of $12,000 for fertilizer costs.\n// 100 * A1 + 120 * A2 + 140 * A3 <= 12000\n\n## Generate Constraint-4:\nThe market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1.\n// A1 <= 30",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop. For C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. For C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. For C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140. The farm wants to maximize the net profit per liter of water used (profit per water efficiency). The farm has a total area of 100 acres. The farm has a limited water supply of 120,000 liters. The farm has a budget of $12,000 for fertilizer costs. The market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1. Please help the farm determine the optimal allocation of areas for each crop to achieve the maximum profit per liter of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 500 * A1 - 100 * A1\nProfit_C2 = 600 * A2 - 120 * A2\nProfit_C3 = 700 * A3 - 140 * A3\nWaterConsumption = 1000 * A1 + 1200 * A2 + 1400 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total area of 100 acres.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 120,000 liters.\nmodel.addCons(1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000)\n## The farm has a budget of $12,000 for fertilizer costs.\nmodel.addCons(100 * A1 + 120 * A2 + 140 * A3 <= 12000)\n## The market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1.\nmodel.addCons(A1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for C1: \", model.getVal(A1))\n    print(\"Area for C2: \", model.getVal(A2))\n    print(\"Area for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\n// {\"temperature setting for greenhouse A\": \"T_A\", \"range\": \"0 <= T_A <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse B\": \"T_B\", \"range\": \"0 <= T_B <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse C\": \"T_C\", \"range\": \"0 <= T_C <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n// Yield of greenhouse A: Yield_A = (T_A^2 / 100) - (T_A - 50)^2\n// Yield of greenhouse B: Yield_B = (T_B^2 / 100) - (T_B - 70)^2\n// Yield of greenhouse C: Yield_C = (T_C^2 / 100) - (T_C - 60)^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\n\n## Generate Constraint-1:\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2.\n// T_A^2 + T_B^2 + T_C^2 <= 150\n\n## Generate Constraint-2:\nThe temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\n// T_A >= T_B + 10",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield. The yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n\n| Greenhouse | Temperature Effect on Yield |\n|------------|------------------------------|\n| A          | Increases up to 50\u00b0, then decreases |\n| B          | Increases up to 70\u00b0, then decreases |\n| C          | Increases up to 60\u00b0, then decreases |\n\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2. The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\n\nPlease help the farm to determine the optimal temperature settings (T_A, T_B, T_C) for each greenhouse within the range of 0 to 100 degrees to maximize the total yield from all greenhouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0, ub=100) # temperature setting for greenhouse A\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0, ub=100) # temperature setting for greenhouse B\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0, ub=100) # temperature setting for greenhouse C\n\n# Define objective function\nYield_A = (T_A**2 / 100) - (T_A - 50)**2\nYield_B = (T_B**2 / 100) - (T_B - 70)**2\nYield_C = (T_C**2 / 100) - (T_C - 60)**2\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n# The total energy consumption for all greenhouses must not exceed 150 energy units.\nmodel.addCons(T_A**2 + T_B**2 + T_C**2 <= 150)\n# The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\nmodel.addCons(T_A >= T_B + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Temperature Setting for Greenhouse A: \", model.getVal(T_A))\n    print(\"Temperature Setting for Greenhouse B: \", model.getVal(T_B))\n    print(\"Temperature Setting for Greenhouse C: \", model.getVal(T_C))\n    print(\"Maximized Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1353,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200\n\n## Generate Constraint-2:\nThe total raw material available per day is 250 units.\n// 3A + 2B + C <= 250\n\n## Generate Constraint-3:\nThe market demand for product A is at least 5 units.\n// A >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand. The profit per unit, labor hours required, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Units Required |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $50             | 2                    | 3                           |\n| B       | $70             | 3                    | 2                           |\n| C       | $60             | 4                    | 1                           |\n\nThe company has a total labor hours available per day of 200 hours. The total raw material available per day is 250 units. The market demand for product A is at least 5 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The total raw material available per day is 250 units.\nmodel.addCons(3*A + 2*B + C <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases non-linearly with the quantity produced due to economies of scale and resource constraints. The production cost function is given by: Cost_A = 2000 + 0.05 * (DeviceA_Units)^2, Cost_B = 3000 + 0.07 * (DeviceB_Units)^2, Cost_C = 4000 + 0.09 * (DeviceC_Units)^2. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 * DeviceA_Units) - Cost_A\n// Total net profit for DeviceB: Profit_B = (70 * DeviceB_Units) - Cost_B\n// Total net profit for DeviceC: Profit_C = (90 * DeviceC_Units) - Cost_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must not exceed twice the production of DeviceB.\n// DeviceA_Units <= 2 * DeviceB_Units\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs per month.\n// Cost_A + Cost_B + Cost_C <= 50,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n// DeviceA_Units >= 100; DeviceB_Units >= 100; DeviceC_Units >= 100",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for each device and their respective production cost functions are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|--------------------------|\n| DeviceA | $50            | Cost_A = 2000 + 0.05 * (DeviceA_Units)^2 |\n| DeviceB | $70            | Cost_B = 3000 + 0.07 * (DeviceB_Units)^2 |\n| DeviceC | $90            | Cost_C = 4000 + 0.09 * (DeviceC_Units)^2 |\n\nThe company has a total production capacity of 1000 units per month. Due to market demand, the production of DeviceA must not exceed twice the production of DeviceB. The company has a budget of $50,000 for production costs per month. The company wants to ensure that at least 100 units of each device are produced to maintain market presence.\n\nPlease help the company to maximize the total net profit by determining the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=100)  # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=100)  # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=100)  # number of units of DeviceC\n\n# Define objective function\nCost_A = 2000 + 0.05 * DeviceA_Units**2\nCost_B = 3000 + 0.07 * DeviceB_Units**2\nCost_C = 4000 + 0.09 * DeviceC_Units**2\nProfit_A = 50 * DeviceA_Units - Cost_A\nProfit_B = 70 * DeviceB_Units - Cost_B\nProfit_C = 90 * DeviceC_Units - Cost_C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)  # Total production capacity constraint\nmodel.addCons(DeviceA_Units <= 2 * DeviceB_Units)  # Market demand constraint for DeviceA\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 50000)  # Budget constraint for production costs\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1101,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale.\n// Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n// The nonlinear aspect is introduced by assuming that the cost of raw materials and labor decreases as production increases due to bulk discounts.\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units across all products.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours.\n// Qa + 2 * Qb + 3 * Qc <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product A to fulfill a contract.\n// Qa >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from product A is $10 per unit, but it requires $2 of raw materials and $1 of labor per unit. Product B yields $15 per unit, with $3 of raw materials and $2 of labor per unit. Product C yields $20 per unit, with $4 of raw materials and $3 of labor per unit. The company aims to maximize the total profit, considering the nonlinear relationship between production and profit due to economies of scale.\n\nThe total production capacity of the company is limited to 1000 units across all products. The company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours. Each unit of product A requires 1 hour, product B requires 2 hours, and product C requires 3 hours. The company must also produce at least 100 units of product A to fulfill a contract.\n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=100) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit: Profit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\nProfit = (10 - 2 - 1) * Qa + (15 - 3 - 2) * Qb + (20 - 4 - 3) * Qc\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units across all products.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The company has a labor constraint, where the total labor hours required for all products cannot exceed 500 hours.\nmodel.addCons(Qa + 2 * Qb + 3 * Qc <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of P1 is $15, and for P2 is $20. The new energy-efficient technology reduces the energy cost per unit by $0.5 for every $1000 invested. The revenue per unit of P1 is $30, and for P2 is $40. The company aims to maximize the total profit from both products.\n// Profit_P1 = (30 - 15 + 0.0005 * EnergyEfficiency) * P1\n// Profit_P2 = (40 - 20 + 0.0005 * EnergyEfficiency) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// P1 + P2 <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for the investment in energy efficiency.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the energy cost per unit produced. The energy cost per unit of P1 is $15, and for P2 is $20. The new energy-efficient technology reduces the energy cost per unit by $0.5 for every $1000 invested. The revenue per unit of P1 is $30, and for P2 is $40. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined and a budget of $50,000 for the investment in energy efficiency. Please help the company determine the optimal production quantities for P1 and P2, and the amount to invest in energy efficiency to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfit_P1 = (30 - 15 + 0.0005 * EnergyEfficiency) * P1\nProfit_P2 = (40 - 20 + 0.0005 * EnergyEfficiency) * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + P2 <= 1000)\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of generating energy from solar is $50 per unit, with a reliability of 90%.\nThe cost of generating energy from wind is $70 per unit, with a reliability of 85%.\nThe cost of generating energy from hydro is $60 per unit, with a reliability of 95%.\nThe company wants to minimize the Cost-Reliability ratio of the energy generation. (The Cost-Reliability ratio is defined as the total cost of energy generation divided by the total reliability of the energy sources.)\n// total cost of energy generation: Cost = 50 * Solar + 70 * Wind + 60 * Hydro\n// total reliability of energy sources: Reliability = 90% * Solar + 85% * Wind + 95% * Hydro\n// So, the objective function is: Minimize Cost / Reliability\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for energy investment.\n// 50 * Solar + 70 * Wind + 60 * Hydro <= 150000\n\n## Generate Constraint-2:\nThe company needs to generate at least 2000 units of energy in total.\n// Solar + Wind + Hydro >= 2000\n\n## Generate Constraint-3:\nAt least 500 units of energy must come from solar sources.\n// Solar >= 500",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro. The cost and reliability of each energy source are given in the following Table.\n\n| Energy Source | Cost per Unit | Reliability |\n|---------------|---------------|-------------|\n| Solar         | $50           | 90%         |\n| Wind          | $70           | 85%         |\n| Hydro         | $60           | 95%         |\n\nThe company has a budget of $150,000 for energy investment. The company needs to generate at least 2000 units of energy in total. At least 500 units of energy must come from solar sources. \nPlease help the company to minimize the Cost-Reliability ratio of the energy generation (defined as the total cost of energy generation divided by the total reliability of the energy sources).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=500) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * Solar + 70 * Wind + 60 * Hydro\nReliability = 0.9 * Solar + 0.85 * Wind + 0.95 * Hydro\n## convert the division to multiplication\nmodel.addCons(obj * Reliability == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for energy investment.\nmodel.addCons(50 * Solar + 70 * Wind + 60 * Hydro <= 150000)\n## The company needs to generate at least 2000 units of energy in total.\nmodel.addCons(Solar + Wind + Hydro >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Energy from Solar: \", model.getVal(Solar))\n    print(\"Amount of Energy from Wind: \", model.getVal(Wind))\n    print(\"Amount of Energy from Hydro: \", model.getVal(Hydro))\n    print(\"Minimized Cost-Reliability Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal investment in research and development for each drug to maximize their potential return on investment.\n// {\"investment in DrugA\": \"InvestA\", \"range\": \"InvestA >= 0\", \"type\": \"real\"}\n// {\"investment in DrugB\": \"InvestB\", \"range\": \"InvestB >= 0\", \"type\": \"real\"}\n// {\"investment in DrugC\": \"InvestC\", \"range\": \"InvestC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe return on investment for each drug is modeled as a nonlinear function of the investment. For DrugA, the return is given by 0.05 * InvestA^2. For DrugB, the return is 0.07 * InvestB^2. For DrugC, the return is 0.06 * InvestC^2. The company wants to maximize the total return on investment.\n// Total return for DrugA: Return_A = 0.05 * InvestA^2\n// Total return for DrugB: Return_B = 0.07 * InvestB^2\n// Total return for DrugC: Return_C = 0.06 * InvestC^2\n// So, the objective function is: Maximize (Return_A + Return_B + Return_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $1,000,000 for all three drugs.\n// InvestA + InvestB + InvestC <= 1,000,000\n\n## Generate Constraint-2:\nDue to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC.\n// InvestA >= 0.5 * (InvestB + InvestC)\n\n## Generate Constraint-3:\nThe company has a policy to ensure that no single drug receives more than 60% of the total investment.\n// InvestA <= 0.6 * (InvestA + InvestB + InvestC); InvestB <= 0.6 * (InvestA + InvestB + InvestC); InvestC <= 0.6 * (InvestA + InvestB + InvestC)",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal investment in research and development for each drug to maximize their potential return on investment. The return on investment for each drug is modeled as a nonlinear function of the investment. For DrugA, the return is given by 0.05 * InvestA^2. For DrugB, the return is 0.07 * InvestB^2. For DrugC, the return is 0.06 * InvestC^2. The company has a total budget of $1,000,000 for all three drugs. Due to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC. The company also has a policy to ensure that no single drug receives more than 60% of the total investment. Please help the company to maximize the total return on investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestA\", lb=0) # investment in DrugA\nInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestB\", lb=0) # investment in DrugB\nInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"InvestC\", lb=0) # investment in DrugC\n\n# Define objective function\n## The return on investment for each drug is modeled as a nonlinear function of the investment.\nReturn_A = 0.05 * InvestA**2\nReturn_B = 0.07 * InvestB**2\nReturn_C = 0.06 * InvestC**2\n## So, the objective function is: Maximize (Return_A + Return_B + Return_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Return_A + Return_B + Return_C)\n\n# Add constraints\n## The company has a total budget of $1,000,000 for all three drugs.\nmodel.addCons(InvestA + InvestB + InvestC <= 1000000)\n## Due to regulatory requirements, the investment in DrugA must be at least half of the total investment in DrugB and DrugC.\nmodel.addCons(InvestA >= 0.5 * (InvestB + InvestC))\n## The company has a policy to ensure that no single drug receives more than 60% of the total investment.\nmodel.addCons(InvestA <= 0.6 * (InvestA + InvestB + InvestC))\nmodel.addCons(InvestB <= 0.6 * (InvestA + InvestB + InvestC))\nmodel.addCons(InvestC <= 0.6 * (InvestA + InvestB + InvestC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Investment in DrugA: \", model.getVal(InvestA))\n    print(\"Investment in DrugB: \", model.getVal(InvestB))\n    print(\"Investment in DrugC: \", model.getVal(InvestC))\n    print(\"Maximized Total Return: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters.\nFor Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters.\nFor Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters.\nThe farmer wants to maximize the profit-to-water ratio (profit per liter of water used).\n// Profit_Wheat = 500 * 0.20 * Wheat\n// Profit_Corn = 700 * 0.25 * Corn\n// Profit_Soybeans = 400 * 0.30 * Soybeans\n// Water_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100",
        "question": "A farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop. For Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters. For Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters. For Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters. The farmer wants to maximize the profit-to-water ratio (profit per liter of water used). The farmer has 100 acres available for planting. Please help the farmer determine the optimal allocation of acres to each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to dedicate to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 500 * 0.20 * Wheat\nProfit_Corn = 700 * 0.25 * Corn\nProfit_Soybeans = 400 * 0.30 * Soybeans\nWater_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n## convert the division to multiplication\nmodel.addCons(obj * Water_Used == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 750,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs.\n// {\"hours facility 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours facility 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours facility 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility has a different cost per hour and efficiency in producing the chemical. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The objective is to minimize the total cost of operation while meeting the production target.\n// The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\n// The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total operating hours for all facilities combined must not exceed 40 hours.\n// H1 + H2 + H3 <= 40",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs. The cost per hour and production efficiency for each facility are given in the following Table.\n\n| Facility | Cost per Hour | Units Produced per Hour |\n|----------|---------------|-------------------------|\n| 1        | $100          | 50                      |\n| 2        | $120          | 60                      |\n| 3        | $150          | 70                      |\n\nThe company needs to produce at least 3000 units of the chemical. The total operating hours for all facilities combined must not exceed 40 hours. Please help the company to minimize the total cost of operation while meeting the production target.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours facility 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours facility 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours facility 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\nmodel.addCons(obj == 100 * H1 + 120 * H2 + 150 * H3)\n\n# Add constraints\n## The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n## The company needs to produce at least 3000 units of the chemical.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 >= 3000)\n## The total operating hours for all facilities combined must not exceed 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 Operates: \", model.getVal(H1))\n    print(\"Hours Facility 2 Operates: \", model.getVal(H2))\n    print(\"Hours Facility 3 Operates: \", model.getVal(H3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of three products: Product A, Product B, and Product C. Additionally, the company is considering investing in automation technology to reduce production costs.\n// {\"production level of Product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production level of Product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A, B, and C is $100, $150, and $200 respectively. The company can reduce these costs by $1 for every $1000 invested in automation. The selling price for each unit of Product A, B, and C is $150, $200, and $250 respectively. The company aims to maximize the total profit from the sales of all products.\n// Total profit for the products: Profit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 1000 units.\n// ProdA + ProdB + ProdC <= 1000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of three products: Product A, Product B, and Product C. The company is also considering investing in automation technology to reduce production costs. The cost of producing each unit of Product A, B, and C, and the selling price for each unit are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| A       | $100                     | $150                   |\n| B       | $150                     | $200                   |\n| C       | $200                     | $250                   |\n\nThe company can reduce these costs by $1 for every $1000 invested in automation. The company has a budget of $100,000 for investment in automation. The total production capacity for all products is limited to 1000 units. \n\nPlease help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production level of Product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production level of Product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production level of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\nProfit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in automation.\nmodel.addCons(Automation <= 100000)\n## The total production capacity for all products is limited to 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProdA))\n    print(\"Production Level of Product B: \", model.getVal(ProdB))\n    print(\"Production Level of Product C: \", model.getVal(ProdC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n// Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n// Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production rate for each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products. The total production rate for all products must not exceed 100 units per hour. The investment in automation cannot exceed $50,000. The production rate for each product must be at least 10 units per hour.\nPlease help the company to determine the optimal production rates and level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate for product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n## Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n## Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\nProfit1 = (150 - (100 - 0.0005 * Automation)) * P1\nProfit2 = (200 - (100 - 0.0005 * Automation)) * P2\nProfit3 = (250 - (100 - 0.0005 * Automation)) * P3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total production rate for all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 500 units.\n// A + B + C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | $30             | $10                      | $5                    |\n| B       | $45             | $20                      | $5                    |\n| C       | $60             | $30                      | $5                    |\n\nThe company has a budget of $10,000 for production costs. The total storage space available is limited to 500 units. Please help the company to maximize the total profit after deducting both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\nProfit_A = 15 * A\nProfit_B = 20 * B\nProfit_C = 25 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000) # Budget constraint for production costs\nmodel.addCons(A + B + C <= 500) # Storage space constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production quantity of Product 1 must be at least 1,000 units.\n// Product1 >= 1000\n\n## Generate Constraint-4:\nThe production quantity of Product 2 must be at least 500 units.\n// Product2 >= 500",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products (Product 1, Product 2, and Product 3) and the level of automation to implement in the production process. The profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n\nThe company has a total production capacity of 10,000 units across all products. The total investment in automation cannot exceed $50,000. The production quantity of Product 1 must be at least 1,000 units, and the production quantity of Product 2 must be at least 500 units.\n\nPlease help the company determine the optimal production quantities for Product 1, Product 2, and Product 3, and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=1000) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=500) # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0) # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nProfit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of ComponentA is $50, but it requires a setup cost of $1000. The profit from each unit of ComponentB is $70, with a setup cost of $1500. The profit from each unit of ComponentC is $90, with a setup cost of $2000. The company wants to maximize their total profit, considering the setup costs.\n// Total profit from ComponentA: ProfitA = (50 * UnitsA) - 1000\n// Total profit from ComponentB: ProfitB = (70 * UnitsB) - 1500\n// Total profit from ComponentC: ProfitC = (90 * UnitsC) - 2000\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 units per month.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit. The profit from each unit of ComponentA is $50, but it requires a setup cost of $1000. The profit from each unit of ComponentB is $70, with a setup cost of $1500. The profit from each unit of ComponentC is $90, with a setup cost of $2000. The company wants to maximize their total profit, considering the setup costs. The company has a limited production capacity of 1000 units per month. Please help the company determine the optimal number of units of each component to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit from ComponentA: ProfitA = (50 * UnitsA) - 1000\n## Total profit from ComponentB: ProfitB = (70 * UnitsB) - 1500\n## Total profit from ComponentC: ProfitC = (90 * UnitsC) - 2000\nProfitA = 50 * UnitsA - 1000\nProfitB = 70 * UnitsB - 1500\nProfitC = 90 * UnitsC - 2000\n## So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a limited production capacity of 1000 units per month.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 689,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products.\n// Total profit for product A: PA = 50 * 10 * MA\n// Total profit for product B: PB = 30 * 15 * MB\n// Total profit for product C: PC = 40 * 12 * MC\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nThe production of product A must not exceed 2000 units per hour.\n// 50 * MA <= 2000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product. The productivity and profit per unit for each product are given in the following Table.\n\n| Product | Units Produced per Hour per Machine | Profit per Unit |\n|---------|-------------------------------------|-----------------|\n| A       | 50                                  | $10             |\n| B       | 30                                  | $15             |\n| C       | 40                                  | $12             |\n\nThe manufacturer has a total of 50 machines available. The production of product A must not exceed 2000 units per hour. The manufacturer wants to maximize the total profit from the production of these three products. Please help the manufacturer determine the optimal number of machines for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## Total profit for product A: PA = 50 * 10 * MA\n## Total profit for product B: PB = 30 * 15 * MB\n## Total profit for product C: PC = 40 * 12 * MC\nPA = 50 * 10 * MA\nPB = 30 * 15 * MB\nPC = 40 * 12 * MC\n## So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n## The production of product A must not exceed 2000 units per hour.\nmodel.addCons(50 * MA <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 925,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop.\n// {\"amount of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm owner wants to maximize the total profit from the crops. The profit per acre for corn is $300, for wheat is $250, and for soybeans is $200. However, the cost of fertilization per acre is $50 for corn, $30 for wheat, and $20 for soybeans. The owner wants to maximize the net profit per acre across all crops.\n// Profit_C = (300 - 50) * C\n// Profit_W = (250 - 30) * W\n// Profit_S = (200 - 20) * S\n// So, the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / (C + W + S)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// C + W + S <= 100\n\n## Generate Constraint-2:\nThe farm has a budget constraint for fertilization, which is $4000.\n// 50 * C + 30 * W + 20 * S <= 4000\n\n## Generate Constraint-3:\nDue to market demand, the farm can only sell up to 50 acres of corn.\n// C <= 50",
        "question": "A farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop. The profit per acre and the cost of fertilization per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Cost of Fertilization per Acre |\n|----------|-----------------|--------------------------------|\n| Corn     | $300            | $50                            |\n| Wheat    | $250            | $30                            |\n| Soybeans | $200            | $20                            |\n\nThe farm owner wants to maximize the total profit from the crops. The total available land for farming is 100 acres. The farm has a budget constraint for fertilization, which is $4000. Due to market demand, the farm can only sell up to 50 acres of corn. Please help the farm owner to maximize the net profit per acre across all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of land for corn\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of land for wheat\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # amount of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (300 - 50) * C\nProfit_W = (250 - 30) * W\nProfit_S = (200 - 20) * S\nTotalLand = C + W + S\n## the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / TotalLand\n## convert the division to multiplication\nmodel.addCons(obj * TotalLand == Profit_C + Profit_W + Profit_S)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(C + W + S <= 100)\n## The farm has a budget constraint for fertilization, which is $4000.\nmodel.addCons(50 * C + 30 * W + 20 * S <= 4000)\n## Due to market demand, the farm can only sell up to 50 acres of corn.\nmodel.addCons(C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for Corn: \", model.getVal(C))\n    print(\"Amount of Land for Wheat: \", model.getVal(W))\n    print(\"Amount of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of his land with soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization. The profit per acre and the costs for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Irrigation Cost | Fertilization Cost |\n|------------|-----------------|-----------------|--------------------|\n| Wheat      | $200            | $50             | $30                |\n| Corn       | $300            | $70             | $40                |\n| Soybeans   | $150            | $30             | $20                |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of his land with soybeans. The farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of soybeans\n\n# Define objective function\n## Total profit and cost for each crop\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n## Objective function: Maximize net profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans))\n\n# Add constraints\n## Total acres constraint\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Soybeans planting constraint\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. The farm has a budget of $15,000 for labor costs for the season.\nPlease help the farm to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=0) # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=0) # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n// Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n// Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total advertising budget for all products cannot exceed $100,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 5000 units for each product.\n// ProdA <= 5000; ProdB <= 5000; ProdC <= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit. The profit per unit of each product and the effect of advertising on the profit per unit are given in the following Table.\n\n| Product | Profit per Unit | Advertising Effect |\n|---------|-----------------|--------------------|\n| ProductA | $50 | $0.5 increase per $1000 spent |\n| ProductB | $70 | $0.7 increase per $1000 spent |\n| ProductC | $90 | $0.9 increase per $1000 spent |\n\nThe total advertising budget for all products cannot exceed $100,000. The company has a production capacity of 5000 units for each product. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=0) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=0) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=0) # advertising budget for ProductC\n\n# Define objective function\nProfit_A = (50 + 0.0005 * AdBudgetA) * ProdA\nProfit_B = (70 + 0.0007 * AdBudgetB) * ProdB\nProfit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total advertising budget for all products cannot exceed $100,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 100000)\n# The company has a production capacity of 5000 units for each product.\nmodel.addCons(ProdA <= 5000)\nmodel.addCons(ProdB <= 5000)\nmodel.addCons(ProdC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor hours.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (ProductA - 100), 10) * ProductA\n// Profit_B = max(15 + 0.02 * (ProductB - 100), 15) * ProductB\n// Profit_C = max(20 + 0.02 * (ProductC - 100), 20) * ProductC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Each unit of product A requires 5 kg of raw material, product B requires 8 kg, and product C requires 10 kg. The total available raw material is 2000 kg.\n// 5 * ProductA + 8 * ProductB + 10 * ProductC <= 2000\n\n## Generate Constraint-2:\nThe company has a limited labor force. Each unit of product A requires 2 labor hours, product B requires 3 labor hours, and product C requires 4 labor hours. The total available labor hours are 1000 hours.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-3:\nThe market demand for product A is at most 300 units, for product B is at most 250 units, and for product C is at most 200 units.\n// ProductA <= 300; ProductB <= 250; ProductC <= 200\n\n## Generate Constraint-4:\nThe company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\n// ProductA >= 100; ProductB >= 100; ProductC >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor hours. The profit per unit for product A is $10, for product B is $15, and for product C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from the sale of these products. The details of raw material requirements, labor hours, and market demand are given in the following Table.\n\n| Product | Raw Material (kg) | Labor Hours | Market Demand (units) |\n|---------|-------------------|-------------|-----------------------|\n| A       | 5                 | 2           | 300                   |\n| B       | 8                 | 3           | 250                   |\n| C       | 10                | 4           | 200                   |\n\nThe company has a limited supply of raw materials, with a total of 2000 kg available. The company also has a limited labor force, with a total of 1000 labor hours available. The market demand for product A is at most 300 units, for product B is at most 250 units, and for product C is at most 200 units. The company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company aims to produce at least 100 units of each product to meet the minimum order quantities from key clients.\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=100) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=100) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (ProductA - 100), 10) * ProductA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=100, ub=300)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=300, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ProductA == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (ProductB - 100), 15) * ProductB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=100, ub=250)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=250, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ProductB == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (ProductC - 100), 20) * ProductC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=100, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ProductC == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * ProductA + 8 * ProductB + 10 * ProductC <= 2000)\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\nmodel.addCons(ProductA <= 300)\nmodel.addCons(ProductB <= 250)\nmodel.addCons(ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1451,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"PA\", \"range\": \"0 <= PA <= 1000\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"0 <= PB <= 1500\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"0 <= PC <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $5, product B yields $7, and product C yields $9. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The profit function is given by:\n// Profit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2)\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of product A, B, and C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 5000 kg.\n// 2 * PA + 3 * PB + 4 * PC <= 5000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 800 units, and for product B is at most 1200 units.\n// PA <= 800; PB <= 1200\n\n## Generate Constraint-3:\nTo maintain product quality, the production of product C should not exceed twice the sum of the production of product A and B.\n// PC <= 2 * (PA + PB)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. Each unit of product A yields a profit of $5, product B yields $7, and product C yields $9. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The company has a limited amount of raw material. The raw material required for producing one unit of product A, B, and C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 5000 kg. The market demand for product A is at most 800 units, and for product B is at most 1200 units. To maintain product quality, the production of product C should not exceed twice the sum of the production of product A and B. Please help the company to maximize the profit, which is given by the function: Profit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0, ub=1000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0, ub=1500) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0, ub=2000) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2)\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nPA_sq = model.addVar(vtype=\"INTEGER\", name=\"PA_sq\")\nPB_sq = model.addVar(vtype=\"INTEGER\", name=\"PB_sq\")\nPC_sq = model.addVar(vtype=\"INTEGER\", name=\"PC_sq\")\nmodel.addCons(PA_sq == PA * PA)\nmodel.addCons(PB_sq == PB * PB)\nmodel.addCons(PC_sq == PC * PC)\nProfit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA_sq + PB_sq + PC_sq)\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited amount of raw material.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 5000)\n## The market demand for product A is at most 800 units, and for product B is at most 1200 units.\nmodel.addCons(PA <= 800)\nmodel.addCons(PB <= 1200)\n## To maintain product quality, the production of product C should not exceed twice the sum of the production of product A and B.\nmodel.addCons(PC <= 2 * (PA + PB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production time per unit is 1 hour. The profit per unit of P2 is $150, and the production time per unit is 2 hours. The cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company aims to maximize the total profit from both products.\n// Profit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\n// Profit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\n// Total profit: Profit = Profit_P1 + Profit_P2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// P1 + 2 * P2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for raw materials.\n// RawMaterials <= 10000\n\n## Generate Constraint-3:\nThe market demand for P1 is 100 units. So, the company can only sell a maximum of 100 units of P1.\n// P1 <= 100\n\n## Generate Constraint-4:\nThe company aims to produce at least 50 units of P2.\n// P2 >= 50\n\n## Generate Constraint-5:\nThe total production quantity should not exceed 150 units.\n// P1 + P2 <= 150",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time. The profit per unit and production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| P1      | $100            | 1 hour                   |\n| P2      | $150            | 2 hours                  |\n\nThe cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company has a total production time of 200 hours. The company has a budget of $10,000 for raw materials. The market demand for P1 is 100 units, so the company can only sell a maximum of 100 units of P1. The company aims to produce at least 50 units of P2. The total production quantity should not exceed 150 units.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=50, ub=150) # quantity of P2\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0, ub=10000) # cost of raw materials\n\n# Define objective function\nProfit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\nProfit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\nProfit = Profit_P1 + Profit_P2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + 2 * P2 <= 200) # total production time of 200 hours\nmodel.addCons(RawMaterials <= 10000) # budget of $10,000 for raw materials\nmodel.addCons(P1 <= 100) # market demand for P1 is 100 units\nmodel.addCons(P2 >= 50) # produce at least 50 units of P2\nmodel.addCons(P1 + P2 <= 150) # total production quantity should not exceed 150 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Cost of Raw Materials: \", model.getVal(RawMaterials))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. However, the production cost per unit for each product varies with the number of units produced due to economies of scale. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n// Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n// Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// UnitsB <= 2 * UnitsA\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the total production cost to $50,000.\n// (40 - 0.1*UnitsA) * UnitsA + (50 - 0.1*UnitsB) * UnitsB + (60 - 0.1*UnitsC) * UnitsC <= 50,000",
        "question": "A manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints.\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company wants to maximize the total net profit.\nThe company has a total production capacity of 1000 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a limited budget for raw materials, which restricts the total production cost to $50,000.\nPlease help the company to determine the optimal number of units of each product to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\n\n# Define objective function\n## Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n## Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n## Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\nProfit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\nProfit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\nmodel.addCons(UnitsB <= 2 * UnitsA)\n## The company has a limited budget for raw materials, which restricts the total production cost to $50,000.\nmodel.addCons((40 - 0.1*UnitsA) * UnitsA + (50 - 0.1*UnitsB) * UnitsB + (60 - 0.1*UnitsC) * UnitsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\n// TruckB <= 0.5 * TruckA\n\n## Generate Constraint-3:\nThe company has a maximum of 100 trucks available in total.\n// TruckA + TruckB + TruckC <= 100\n\n## Generate Constraint-4:\nTo ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC.\n// TruckC >= 0.1 * (TruckA + TruckB + TruckC)",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations. The company incurs different costs for fuel, maintenance, and driver wages for each type of truck. For TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. For TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. For TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. The company has a total budget of $500,000 for truck operations. Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA. The company has a maximum of 100 trucks available in total. To ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n# Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\nmodel.addCons(TruckB <= 0.5 * TruckA)\n# The company has a maximum of 100 trucks available in total.\nmodel.addCons(TruckA + TruckB + TruckC <= 100)\n# To ensure a balanced fleet, the company wants at least 10% of its trucks to be TruckC.\nmodel.addCons(TruckC >= 0.1 * (TruckA + TruckB + TruckC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand.\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre. For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre. For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre. The farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting.\n// Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n// Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n// Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe total acreage available for planting is 100 acres.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe soil health index must remain above 50.\n// 50 <= 100 - (0.1 * Wheat * Wheat + 0.2 * Corn * Corn - 0.05 * Soybeans * Soybeans)\n\n## Generate Constraint-3:\nThe market demand for Wheat is 50 acres. So, the farm can only sell a maximum of 50 acres of Wheat.\n// Wheat <= 50\n\n## Generate Constraint-4:\nThe market demand for Corn is 60 acres. So, the farm can only sell a maximum of 60 acres of Corn.\n// Corn <= 60",
        "question": "A farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand. The profit per acre and the effect on soil health for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Soil Health Effect |\n|------------|-----------------|--------------------|\n| Wheat      | $300            | -0.1 units per acre |\n| Corn       | $400            | -0.2 units per acre |\n| Soybeans   | $250            | +0.05 units per acre |\n\nThe farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting. The total acreage available for planting is 100 acres. The market demand for Wheat is 50 acres, and for Corn is 60 acres. Please help the farm determine the optimal acreage for each crop to maximize profit while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0, ub=50)  # acreage of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0, ub=60)  # acreage of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acreage of Soybeans\n\n# Define objective function\n# For non-linear terms, we need to linearize them using additional variables and constraints\n# Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n# Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n# Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n\n# Linearize quadratic terms\nWheat_squared = model.addVar(name=\"Wheat_squared\")\nCorn_squared = model.addVar(name=\"Corn_squared\")\nSoybeans_squared = model.addVar(name=\"Soybeans_squared\")\n\nmodel.addCons(Wheat_squared == Wheat * Wheat)\nmodel.addCons(Corn_squared == Corn * Corn)\nmodel.addCons(Soybeans_squared == Soybeans * Soybeans)\n\nProfit_Wheat = 300 * Wheat - 0.1 * Wheat_squared\nProfit_Corn = 400 * Corn - 0.2 * Corn_squared\nProfit_Soybeans = 250 * Soybeans + 0.05 * Soybeans_squared\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The total acreage available for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# The soil health index must remain above 50.\nmodel.addCons(50 <= 100 - (0.1 * Wheat_squared + 0.2 * Corn_squared - 0.05 * Soybeans_squared))\n\n# The market demand for Corn is 60 acres.\nmodel.addCons(Corn <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 967,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit per acre of land used. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the cost of fertilizers, which is $50 per acre for wheat, $70 per acre for corn, and $60 per acre for soybeans. The objective is to maximize the net profit per acre, which is the profit minus the cost of fertilizers.\n// Net profit per acre of wheat: Profit_W = (200 - 50) * W\n// Net profit per acre of corn: Profit_C = (300 - 70) * C\n// Net profit per acre of soybeans: Profit_S = (250 - 60) * S\n// The objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (W + C + S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer must dedicate at least 20 acres to soybeans due to a contract.\n// S >= 20",
        "question": "A farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation. The profit per acre and the cost of fertilizers for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Cost of Fertilizers per Acre |\n|------------|-----------------|------------------------------|\n| Wheat      | $200            | $50                          |\n| Corn       | $300            | $70                          |\n| Soybeans   | $250            | $60                          |\n\nThe farmer aims to maximize his total net profit per acre of land used, which is the profit minus the cost of fertilizers. The farmer has a total of 100 acres of land available. Additionally, due to a contract, the farmer must dedicate at least 20 acres to soybeans. Please help the farmer to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (250 - 60) * S\nTotalAcres = W + C + S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of each crop (in tons per acre) is affected by the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n// Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n// Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n// Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation improvements.\n// Irrigation <= 50000",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop. The yield of each crop (in tons per acre) increases with the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n\n| Crop       | Selling Price per Ton | Yield Increase per $1000 Investment |\n|------------|-----------------------|-------------------------------------|\n| Wheat      | $200                  | 0.1 tons per acre                   |\n| Corn       | $300                  | 0.2 tons per acre                   |\n| Soybeans   | $400                  | 0.15 tons per acre                  |\n\nThe total acres available for planting are 100. The farm has a budget of $50,000 for irrigation improvements. Please help the farm to maximize its total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)    # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of soybeans\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\nRevenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\nRevenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n# So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n# The total acres available for planting are 100.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The farm has a budget of $50,000 for irrigation improvements.\nmodel.addCons(Irrigation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1275,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\n// Profit from A: Profit_A = 500 * HA\n// Profit from B: Profit_B = 700 * HB\n// Profit from C: Profit_C = 1000 * HC\n// Water usage: Water_A = 2 * HA, Water_B = 3 * HB, Water_C = 4 * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * HA + 3 * HB + 4 * HC <= 300\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 hectares to each crop.\n// HA >= 10; HB >= 10; HC >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| A    | $500                | 2 units                       |\n| B    | $700                | 3 units                       |\n| C    | $1000               | 4 units                       |\n\nThe farm has a total of 100 hectares available for cultivation. The farm has a total of 300 units of water available for irrigation. The farm must allocate at least 10 hectares to each crop. \nPlease help the farm to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 hectares to each crop.\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=10) # hectares of crop A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=10) # hectares of crop B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * HA\nProfit_B = 700 * HB\nProfit_C = 1000 * HC\nWater_A = 2 * HA\nWater_B = 3 * HB\nWater_C = 4 * HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HA + HB + HC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * HA + 3 * HB + 4 * HC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Profit per Water Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage per unit of product A is 2 units, product B is 3 units, and product C is 4 units. The company wants to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total resource usage: Resource = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize Profit / Resource\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of resources available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n\n## Generate Constraint-3:\nThe total production of products A and B must not exceed twice the production of product C.\n// A + B <= 2 * C\n\n## Generate Constraint-4:\nThe company aims to invest at least 40% of its resources in product A.\n// 2 * A >= 0.4 * (2 * A + 3 * B + 4 * C)",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage. The profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage per unit of product A is 2 units, product B is 3 units, and product C is 4 units. The company wants to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage. The company has a total of 1000 units of resources available. The company must produce at least 10 units of each product to meet contractual obligations. The total production of products A and B must not exceed twice the production of product C. The company aims to invest at least 40% of its resources in product A.\nPlease help the company determine the optimal number of units to produce for each product A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 10 units of each product to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C\nResource = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize Profit / Resource\n## convert the division to multiplication\nmodel.addCons(obj * Resource == Profit)\n\n# Add constraints\n## The company has a total of 1000 units of resources available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The total production of products A and B must not exceed twice the production of product C.\nmodel.addCons(A + B <= 2 * C)\n## The company aims to invest at least 40% of its resources in product A.\nmodel.addCons(2 * A >= 0.4 * (2 * A + 3 * B + 4 * C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering production costs and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the production cost decreases as the quantity produced increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer aims to maximize the total profit, which is the revenue minus the cost.\n// Revenue_S = 100 * S\n// Cost_S = max(50 - 0.5 * (S - 100), 50) * S\n// Revenue_T = 150 * T\n// Cost_T = max(75 - 0.5 * (T - 100), 75) * T\n// Revenue_L = 200 * L\n// Cost_L = max(100 - 0.5 * (L - 100), 100) * L\n// So, the objective function is: Maximize (Revenue_S - Cost_S) + (Revenue_T - Cost_T) + (Revenue_L - Cost_L)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production materials, which costs $30 per Smartphone, $40 per Tablet, and $50 per Laptop. The total budget for materials is $15,000.\n// 30 * S + 40 * T + 50 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\n// S <= 500; T <= 300; L <= 200",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering production costs and market demand. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the production cost decreases as the quantity produced increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer aims to maximize the total profit, which is the revenue minus the cost.\n\n| Device     | Profit per Unit | Cost per Unit (if production > 100) |\n|------------|-----------------|------------------------------------|\n| Smartphones | $100            | $50 - $0.5 * (S - 100)             |\n| Tablets    | $150            | $75 - $0.5 * (T - 100)             |\n| Laptops    | $200            | $100 - $0.5 * (L - 100)            |\n\nThe manufacturer has a limited budget for production materials, which costs $30 per Smartphone, $40 per Tablet, and $50 per Laptop. The total budget for materials is $15,000. The market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\n\nPlease help the manufacturer to maximize the total profit by determining the optimal production quantities for Smartphones (S), Tablets (T), and Laptops (L) under these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = max(50 - 0.5 * (S - 100), 50) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = 50 * S1 * S_b1 + (50 - 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_T = max(75 - 0.5 * (T - 100), 75) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_T = 75 * T1 * T_b1 + (75 - 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_L = max(100 - 0.5 * (L - 100), 100) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = 100 * L1 * L_b1 + (100 - 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Revenue_S - Cost_S) + (Revenue_T - Cost_T) + (Revenue_L - Cost_L)\nRevenue_S = 100 * S\nRevenue_T = 150 * T\nRevenue_L = 200 * L\nmodel.addCons(obj == (Revenue_S - Cost_S) + (Revenue_T - Cost_T) + (Revenue_L - Cost_L))\n\n# Add constraints\nmodel.addCons(30 * S + 40 * T + 50 * L <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1531,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnits\", \"range\": \"ProductBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnits\", \"range\": \"ProductCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.3 for each unit produced beyond the first 200 units. The profit per unit for ProductC is $90, but it decreases by $0.2 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\n// Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\n// Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for the month.\n// ProductAUnits + ProductBUnits + ProductCUnits <= 600\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBUnits <= 2 * ProductAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20.\n// 10 * ProductAUnits + 15 * ProductBUnits + 20 * ProductCUnits <= 30,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit. The profit per unit for ProductA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.3 for each unit produced beyond the first 200 units. The profit per unit for ProductC is $90, but it decreases by $0.2 for each unit produced beyond the first 300 units. The company has a total production capacity of 600 units for the month. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a budget of $30,000 for raw materials for the month, with the cost of raw materials per unit for ProductA being $10, for ProductB being $15, and for ProductC being $20. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0)  # number of units of ProductA\nProductBUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnits\", lb=0)  # number of units of ProductB\nProductCUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnits\", lb=0)  # number of units of ProductC\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\nProductA1 = model.addVar(vtype=\"INTEGER\", name=\"ProductA1\", lb=0, ub=100)\nProductA2 = model.addVar(vtype=\"INTEGER\", name=\"ProductA2\", lb=100, ub=600)\nProductA_b1 = model.addVar(vtype=\"B\", name=\"ProductA_b1\")\nProductA_b2 = model.addVar(vtype=\"B\", name=\"ProductA_b2\")\nmodel.addCons(ProductA_b1 + ProductA_b2 == 1)\nmodel.addCons(ProductAUnits == ProductA1*ProductA_b1 + ProductA2*ProductA_b2)\nProfit_ProductA = (50 - 0.5 * (ProductA2 - 100)) * ProductA2 * ProductA_b2\n\n# Create piecewise variables for piecewise function: Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\nProductB1 = model.addVar(vtype=\"INTEGER\", name=\"ProductB1\", lb=0, ub=200)\nProductB2 = model.addVar(vtype=\"INTEGER\", name=\"ProductB2\", lb=200, ub=600)\nProductB_b1 = model.addVar(vtype=\"B\", name=\"ProductB_b1\")\nProductB_b2 = model.addVar(vtype=\"B\", name=\"ProductB_b2\")\nmodel.addCons(ProductB_b1 + ProductB_b2 == 1)\nmodel.addCons(ProductBUnits == ProductB1*ProductB_b1 + ProductB2*ProductB_b2)\nProfit_ProductB = (70 - 0.3 * (ProductB2 - 200)) * ProductB2 * ProductB_b2\n\n# Create piecewise variables for piecewise function: Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\nProductC1 = model.addVar(vtype=\"INTEGER\", name=\"ProductC1\", lb=0, ub=300)\nProductC2 = model.addVar(vtype=\"INTEGER\", name=\"ProductC2\", lb=300, ub=600)\nProductC_b1 = model.addVar(vtype=\"B\", name=\"ProductC_b1\")\nProductC_b2 = model.addVar(vtype=\"B\", name=\"ProductC_b2\")\nmodel.addCons(ProductC_b1 + ProductC_b2 == 1)\nmodel.addCons(ProductCUnits == ProductC1*ProductC_b1 + ProductC2*ProductC_b2)\nProfit_ProductC = (90 - 0.2 * (ProductC2 - 300)) * ProductC2 * ProductC_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAUnits + ProductBUnits + ProductCUnits <= 600)\nmodel.addCons(ProductBUnits <= 2 * ProductAUnits)\nmodel.addCons(10 * ProductAUnits + 15 * ProductBUnits + 20 * ProductCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnits))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility.\n// {\"labor hours at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility produces a different type of component. The efficiency of production varies with the amount of labor hours invested. \nAt facility 1, the production rate of component 1 is 0.5 units per labor hour, and the production rate of component 2 is 0.3 units per labor hour. \nAt facility 2, the production rate of component 1 is 0.4 units per labor hour, and the production rate of component 2 is 0.6 units per labor hour. \nAt facility 3, the production rate of component 1 is 0.6 units per labor hour, and the production rate of component 2 is 0.4 units per labor hour.\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. Determine the minimum total labor hours required to meet the monthly demand.\n// The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n// The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n// So, the objective function is: Minimize max(T1, T2)\n\n## Generate Constraint-1:\nThe total labor hours available across all facilities is limited to 800 hours.\n// L1 + L2 + L3 <= 800",
        "question": "A company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility.\nAt facility 1, the production rate of component 1 is 0.5 units per labor hour, and the production rate of component 2 is 0.3 units per labor hour. \nAt facility 2, the production rate of component 1 is 0.4 units per labor hour, and the production rate of component 2 is 0.6 units per labor hour. \nAt facility 3, the production rate of component 1 is 0.6 units per labor hour, and the production rate of component 2 is 0.4 units per labor hour.\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. The total labor hours available across all facilities is limited to 800 hours.\nPlease help the company determine the minimum total labor hours required to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours at facility 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours at facility 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n## The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n## So, the objective function is: Minimize max(T1, T2)\n## Convert the division to multiplication\nT1 = model.addVar('T1')\nT2 = model.addVar('T2')\nmodel.addCons(T1 == 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3))\nmodel.addCons(T2 == 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3))\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\n\n# Add constraints\n## The total labor hours available across all facilities is limited to 800 hours.\nmodel.addCons(L1 + L2 + L3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours at facility 1: \", model.getVal(L1))\n    print(\"Labor hours at facility 2: \", model.getVal(L2))\n    print(\"Labor hours at facility 3: \", model.getVal(L3))\n    print(\"Minimum total labor hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 972,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Soil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + 50)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total soil nitrogen depletion must not exceed 100 units.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units.\nThe farmer has a total of 100 acres available for cultivation. The total soil nitrogen depletion must not exceed 100 units.\nPlease help the farmer to maximize his total profit while considering the soil's nutrient depletion.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nSoil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Soil_Nitrogen_Depletion + 50)\n## convert the division to multiplication\nmodel.addCons(obj * (Soil_Nitrogen_Depletion + 50) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total soil nitrogen depletion must not exceed 100 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand.\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre. For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre. For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre. The farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting.\n// Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n// Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n// Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe total acreage available for planting is 100 acres.\n// Wheat + Corn + Soybeans <= 100",
        "question": "A farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand. The profit per acre and the effect on soil health for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Soil Health Effect |\n|------------|-----------------|--------------------|\n| Wheat      | $300            | Depletes 0.1 units per acre |\n| Corn       | $400            | Depletes 0.2 units per acre |\n| Soybeans   | $250            | Replenishes 0.05 units per acre |\n\nThe farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting. The total acreage available for planting is 100 acres. Please help the farm determine the optimal acreage for each crop to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acreage of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acreage of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acreage of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n## Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n## Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n## Convert quadratic terms to linear terms by introducing new variables\nWheat_sq = model.addVar(name=\"Wheat_sq\")\nCorn_sq = model.addVar(name=\"Corn_sq\")\nSoybeans_sq = model.addVar(name=\"Soybeans_sq\")\nmodel.addCons(Wheat_sq == Wheat * Wheat)\nmodel.addCons(Corn_sq == Corn * Corn)\nmodel.addCons(Soybeans_sq == Soybeans * Soybeans)\nProfit_Wheat = 300 * Wheat - 0.1 * Wheat_sq\nProfit_Corn = 400 * Corn - 0.2 * Corn_sq\nProfit_Soybeans = 250 * Soybeans + 0.05 * Soybeans_sq\n## the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The total acreage available for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints.\n// {\"number of MachineA\": \"MachineA\", \"range\": \"MachineA >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineB\", \"range\": \"MachineB >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineC\", \"range\": \"MachineC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of MachineA is $500, MachineB is $700, and MachineC is $900. The company wants to maximize the total profit from the production of these machines.\n// Total profit for MachineA: Profit_A = 500 * MachineA\n// Total profit for MachineB: Profit_B = 700 * MachineB\n// Total profit for MachineC: Profit_C = 900 * MachineC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA + MachineB + MachineC <= 100\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineB <= 2 * MachineA\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month. The cost of raw materials per unit for MachineA is $100, for MachineB is $200, and for MachineC is $300.\n// 100 * MachineA + 200 * MachineB + 300 * MachineC <= 50,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine type to maximize profit while considering various constraints. The profit per unit and the cost of raw materials per unit for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Cost of Raw Materials per Unit |\n|---------|-----------------|--------------------------------|\n| MachineA | $500           | $100                           |\n| MachineB | $700           | $200                           |\n| MachineC | $900           | $300                           |\n\nThe company has a total production capacity of 100 machines per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget constraint for raw materials, which limits the total cost of raw materials to $50,000 per month.\n\nPlease help the company to maximize the total profit from the production of these machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA = model.addVar(vtype=\"INTEGER\", name=\"MachineA\", lb=0) # number of MachineA\nMachineB = model.addVar(vtype=\"INTEGER\", name=\"MachineB\", lb=0) # number of MachineB\nMachineC = model.addVar(vtype=\"INTEGER\", name=\"MachineC\", lb=0) # number of MachineC\n\n# Define objective function\nProfit_A = 500 * MachineA\nProfit_B = 700 * MachineB\nProfit_C = 900 * MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(MachineA + MachineB + MachineC <= 100) # total production capacity constraint\nmodel.addCons(MachineB <= 2 * MachineA) # resource limitation constraint\nmodel.addCons(100 * MachineA + 200 * MachineB + 300 * MachineC <= 50000) # budget constraint for raw materials\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineA))\n    print(\"Number of MachineB: \", model.getVal(MachineB))\n    print(\"Number of MachineC: \", model.getVal(MachineC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency.\n// {\"hours allocated to Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades. The initial production rate for each product is 100 units per hour. The company aims to maximize the total production output.\n// Production output for Product 1: P1 = (100 + 0.005 * Efficiency) * H1\n// Production output for Product 2: P2 = (100 + 0.005 * Efficiency) * H2\n// Production output for Product 3: P3 = (100 + 0.005 * Efficiency) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe investment in production efficiency upgrades cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nAt least 40 hours must be allocated to each product type.\n// H1 >= 40; H2 >= 40; H3 >= 40\n\n## Generate Constraint-4:\nThe total production hours for Product 1 and Product 2 must not exceed 100 hours.\n// H1 + H2 <= 100",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type (Product 1, Product 2, and Product 3) and the amount of money to invest in enhancing the production line's efficiency. The production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades, with an initial production rate of 100 units per hour. The company aims to maximize the total production output. The total available hours for production in a week is 168 hours. The investment in production efficiency upgrades cannot exceed $50,000. At least 40 hours must be allocated to each product type. The total production hours for Product 1 and Product 2 must not exceed 100 hours.\n\nPlease help the company to maximize the total production output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=40) # hours allocated to Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=40) # hours allocated to Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=40) # hours allocated to Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\nP1 = (100 + 0.005 * Efficiency) * H1\nP2 = (100 + 0.005 * Efficiency) * H2\nP3 = (100 + 0.005 * Efficiency) * H3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\nmodel.addCons(Efficiency <= 50000)\nmodel.addCons(H1 + H2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Investment in production efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in advertising\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit: Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for advertising.\n// Advertising <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 2000 units.\n// ProductA + ProductB + ProductC <= 2000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit. The profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a budget of $100,000 for advertising. The total production capacity for all products is 2000 units. Please help the company determine the optimal production quantities for products A, B, and C, and the optimal advertising investment to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # investment in advertising\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n## convert the multiplication inside the parentheses to a constraint\nmodel.addCons(obj == (50 * ProductA + 70 * ProductB + 60 * ProductC))\nmodel.addCons(obj <= (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising))\n\n# Add constraints\n## The company has a budget of $100,000 for advertising.\nmodel.addCons(Advertising <= 100000)\n## The total production capacity for all products is 2000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Advertising: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed on flat roofs is 100.\n// Flat <= 100\n\n## Generate Constraint-4:\nThe maximum number of panels that can be installed on sloped roofs is 120.\n// Slope <= 120",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The company has a budget of $150,000 for the installation. The maximum number of panels that can be installed on flat roofs is 100, and the maximum number of panels that can be installed on sloped roofs is 120.\nPlease help the company to determine the optimal number of solar panels to install on each type of roof to minimize the total cost of installation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0, ub=100) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0, ub=120) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0) # number of solar panels on green roofs\n\n# Define objective function\nCost = 1000 * Flat + 1200 * Slope + 800 * Green\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000) # The total energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000) # The company has a budget of $150,000 for the installation.\nmodel.addCons(Flat <= 100) # The maximum number of panels that can be installed on flat roofs is 100.\nmodel.addCons(Slope <= 120) # The maximum number of panels that can be installed on sloped roofs is 120.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery that can increase production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"integer\"}\n// {\"investment in new machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency increases by 5 units per hour for every $10,000 invested in new machinery. The base production rate is 10 units per hour without overtime. Overtime increases production by 5 units per hour. The company aims to maximize the total production output.\n// Total production output: Output = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a maximum of 1000 overtime hours available for the quarter.\n// Overtime <= 1000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery that can increase production efficiency. The production efficiency increases by 5 units per hour for every $10,000 invested in new machinery. The base production rate is 10 units per hour without overtime. Overtime increases production by 5 units per hour. The company aims to maximize the total production output. The company has a maximum of 1000 overtime hours available for the quarter. Please help the company determine the optimal number of units to produce, the amount of overtime hours to utilize, and the investment in new machinery to maximize the total production output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0) # number of units to produce\nOvertime = model.addVar(vtype=\"INTEGER\", name=\"Overtime\", lb=0) # amount of overtime hours\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in new machinery\n\n# Define objective function\n## Total production output: Output = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\nOutput = (10 + 5 * Overtime + 0.0005 * Machinery) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output)\n\n# Add constraints\n## The company has a maximum of 1000 overtime hours available for the quarter.\nmodel.addCons(Overtime <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Amount of Overtime Hours: \", model.getVal(Overtime))\n    print(\"Investment in New Machinery: \", model.getVal(Machinery))\n    print(\"Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\n// Total net profit for ComponentA: Profit_A = (50 - 30 - 5) * UnitsA\n// Total net profit for ComponentB: Profit_B = (70 - 40 - 10) * UnitsB\n// Total net profit for ComponentC: Profit_C = (100 - 60 - 15) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units per type of component.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\nThe company has a production capacity limit of 1000 units per type of component.\nPlease help the company determine the optimal number of units of each component to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * UnitsA\nProfit_B = (70 - 40 - 10) * UnitsB\nProfit_C = (100 - 60 - 15) * UnitsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C).\n// {\"number of Machinery A units\": \"MachineryA\", \"range\": \"MachineryA >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery B units\": \"MachineryB\", \"range\": \"MachineryB >= 0\", \"type\": \"integer\"}\n// {\"number of Machinery C units\": \"MachineryC\", \"range\": \"MachineryC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n// Production capacity: Capacity = 10% * MachineryA + 15% * MachineryB + 20% * MachineryC\n// Maintenance cost: Cost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n// So, the objective function is: Maximize (Capacity - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for purchasing and maintaining the machinery.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000\n\n## Generate Constraint-2:\nThe company must invest at least $20,000 in machinery to meet production demands.\n// 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 3 units of each type of machinery are purchased.\n// MachineryA >= 3\n// MachineryB >= 3\n// MachineryC >= 3\n\n## Generate Constraint-4:\nThe company aims to limit the investment in any single type of machinery to no more than 40% of the total budget.\n// 500 * MachineryA <= 40% * 50000\n// 700 * MachineryB <= 40% * 50000\n// 1000 * MachineryC <= 40% * 50000",
        "question": "A manufacturing company is planning to optimize its production by investing in three different types of machinery (Machinery A, Machinery B, and Machinery C). The company estimates that each unit of Machinery A will increase the production capacity by 10%, each unit of Machinery B by 15%, and each unit of Machinery C by 20%. However, the maintenance cost for Machinery A is $500 per unit, for Machinery B is $700 per unit, and for Machinery C is $1000 per unit. The company wants to maximize the net production capacity after deducting the maintenance costs.\n\n| Machinery | Production Capacity Increase | Maintenance Cost per Unit |\n|-----------|------------------------------|--------------------------|\n| A         | 10%                          | $500                     |\n| B         | 15%                          | $700                     |\n| C         | 20%                          | $1000                    |\n\nThe company has a budget of $50,000 for purchasing and maintaining the machinery. The company must invest at least $20,000 in machinery to meet production demands. The company wants to ensure that at least 3 units of each type of machinery are purchased. The company aims to limit the investment in any single type of machinery to no more than 40% of the total budget.\n\nPlease help the company determine the optimal number of units of each type of machinery to purchase to maximize the net production capacity after deducting the maintenance costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineryA = model.addVar(vtype=\"INTEGER\", name=\"MachineryA\", lb=3)  # number of Machinery A units\nMachineryB = model.addVar(vtype=\"INTEGER\", name=\"MachineryB\", lb=3)  # number of Machinery B units\nMachineryC = model.addVar(vtype=\"INTEGER\", name=\"MachineryC\", lb=3)  # number of Machinery C units\n\n# Define objective function\nCapacity = 0.1 * MachineryA + 0.15 * MachineryB + 0.2 * MachineryC\nCost = 500 * MachineryA + 700 * MachineryB + 1000 * MachineryC\n# So, the objective function is: Maximize (Capacity - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Capacity - Cost)\n\n# Add constraints\n# The company has a budget of $50,000 for purchasing and maintaining the machinery.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC <= 50000)\n# The company must invest at least $20,000 in machinery to meet production demands.\nmodel.addCons(500 * MachineryA + 700 * MachineryB + 1000 * MachineryC >= 20000)\n# The company wants to ensure that at least 3 units of each type of machinery are purchased.\nmodel.addCons(MachineryA >= 3)\nmodel.addCons(MachineryB >= 3)\nmodel.addCons(MachineryC >= 3)\n# The company aims to limit the investment in any single type of machinery to no more than 40% of the total budget.\nmodel.addCons(500 * MachineryA <= 0.4 * 50000)\nmodel.addCons(700 * MachineryB <= 0.4 * 50000)\nmodel.addCons(1000 * MachineryC <= 0.4 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machinery A units: \", model.getVal(MachineryA))\n    print(\"Number of Machinery B units: \", model.getVal(MachineryB))\n    print(\"Number of Machinery C units: \", model.getVal(MachineryC))\n    print(\"Maximized Net Production Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1472,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8\n\n## Generate Constraint-2:\nThe production of product A requires at least 1 hour per day due to contractual obligations.\n// H_A >= 1",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different: $50 per hour for product A, $70 per hour for product B, and $60 per hour for product C. The company has a total of 8 hours available for production in a day. Due to contractual obligations, the production of product A requires at least 1 hour per day. Please help the company maximize the total profit from all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=1) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 569,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost.\n// Cost_S = max(100 - 0.5 * (S - 100), 100) * S\n// Cost_T = max(150 - 0.5 * (T - 100), 150) * T\n// Cost_L = max(200 - 0.5 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\n// S <= 500; T <= 300; L <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 800 units in total.\n// S + T + L <= 800\n\n## Generate Constraint-4:\nTo ensure quality, the manufacturer must produce at least 50 units of each device.\n// S >= 50; T >= 50; L >= 50",
        "question": "A manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost.\n\n| Device     | Profit per Unit | Cost per Unit (if production > 100) |\n|------------|-----------------|-------------------------------------|\n| Smartphone | 100$            | 100$ - 0.5$ * (S - 100)             |\n| Tablet     | 150$            | 150$ - 0.5$ * (T - 100)             |\n| Laptop     | 200$            | 200$ - 0.5$ * (L - 100)             |\n\nThe manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000. The market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units. The manufacturer has a production capacity limit of 800 units in total. To ensure quality, the manufacturer must produce at least 50 units of each device.\n\nPlease help the manufacturer to maximize the net profit by determining the optimal production quantities for Smartphones (S), Tablets (T), and Laptops (L).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=50, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=50, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=50, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = max(100 - 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = 100 * S1 * S_b1 + (100 - 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_T = max(150 - 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_T = 150 * T1 * T_b1 + (150 - 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_L = max(200 - 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = 200 * L1 * L_b1 + (200 - 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\nmodel.addCons(obj == (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S + T + L <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1642,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $10,000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 10000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm has a budget of $10,000 for fertilizer costs. \nPlease help the farm to maximize the profit efficiency (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $10,000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the acreage for each crop to maximize his profit while considering the soil fertility and water requirements.\n// {\"acreage of wheat\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage of corn\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage of soybeans\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $300, but it requires 2 units of water per acre. \nThe profit per acre for corn is $400, but it requires 3 units of water per acre. \nThe profit per acre for soybeans is $250, but it requires 1 unit of water per acre. \nThe farmer wants to maximize his total profit.\n// Profit_wheat = 300 * A1\n// Profit_corn = 400 * A2\n// Profit_soybeans = 250 * A3\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_soybeans)\n\n## Generate Constraint-1:\nThe total available water for irrigation is 500 units.\n// 2 * A1 + 3 * A2 + 1 * A3 <= 500",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the acreage for each crop to maximize his profit while considering the soil fertility and water requirements. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Water Requirement per Acre |\n|------------|-----------------|----------------------------|\n| Wheat      | $300            | 2 units                    |\n| Corn       | $400            | 3 units                    |\n| Soybeans   | $250            | 1 unit                     |\n\nThe total available water for irrigation is 500 units. Please help the farmer to maximize his total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage of wheat\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage of corn\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage of soybeans\n\n# Define objective function\nProfit_wheat = 300 * A1\nProfit_corn = 400 * A2\nProfit_soybeans = 250 * A3\n# So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_soybeans)\n\n# Add constraints\n# The total available water for irrigation is 500 units.\nmodel.addCons(2 * A1 + 3 * A2 + 1 * A3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(A1))\n    print(\"Acreage of Corn: \", model.getVal(A2))\n    print(\"Acreage of Soybeans: \", model.getVal(A3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 706,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per quarter. \nFor Product B, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per quarter. \nFor Product C, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per quarter.\nThe company aims to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).\n// Selling profit of A: Profit_A = (50 - 30 - 5) * A\n// Selling profit of B: Profit_B = (70 - 40 - 7) * B\n// Selling profit of C: Profit_C = (90 - 50 - 9) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A + 7 * B + 9 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs for the next quarter.\n// 30 * A + 40 * B + 50 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product for the next quarter.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter. The selling price, production cost, and storage cost per unit per quarter for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost | Storage Cost per Unit per Quarter |\n|---------|---------------|-----------------|-----------------------------------|\n| A       | $50           | $30             | $5                                |\n| B       | $70           | $40             | $7                                |\n| C       | $90           | $50             | $9                                |\n\nThe company has a budget of $10,000 for production costs for the next quarter. The company wants to produce at least 50 units of each product for the next quarter. \n\nPlease help the company to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 30 - 5) * A\nProfit_B = (70 - 40 - 7) * B\nProfit_C = (90 - 50 - 9) * C\nStorageCost = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs for the next quarter.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1081,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer wants to maximize the total production rate while considering the cost of labor. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The objective is to maximize the net production value (total production rate minus labor cost).\n// Total production rate: Production = 10 * A + 15 * B + 20 * C\n// Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n// So, the objective function is: Maximize (Production - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a total budget of $1000 per hour for labor.\n// 20 * A + 25 * B + 30 * C <= 1000\n\n## Generate Constraint-2:\nThe maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C.\n// A <= 20; B <= 15; C <= 10",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rate and labor cost per hour for each product are given in the following Table.\n\n| Product | Production Rate per Worker (units/hour) | Labor Cost per Worker (dollars/hour) |\n|---------|-----------------------------------------|------------------------------------|\n| A       | 10                                      | 20                                 |\n| B       | 15                                      | 25                                 |\n| C       | 20                                      | 30                                 |\n\nThe manufacturer has a total budget of $1000 per hour for labor. The maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C. \nPlease help the manufacturer to maximize the net production value (total production rate minus labor cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=20) # number of workers on product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=15) # number of workers on product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=10) # number of workers on product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProduction = 10 * A + 15 * B + 20 * C\nCost = 20 * A + 25 * B + 30 * C\n## the objective function is: Maximize (Production - Cost)\nmodel.addCons(obj == Production - Cost)\n\n# Add constraints\n## The manufacturer has a total budget of $1000 per hour for labor.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A: \", model.getVal(A))\n    print(\"Number of Workers on Product B: \", model.getVal(B))\n    print(\"Number of Workers on Product C: \", model.getVal(C))\n    print(\"Maximized Net Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1058,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 20A + 30B + 40C\n// Total cost: Cost = 10A + 20B + 30C\n// So, the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1500 for production costs.\n// 10A + 20B + 30C <= 1500\n\n## Generate Constraint-2:\nThe plant has a maximum production capacity of 100 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-3:\nThe market demand for product A is at least 20 units, for product B is at least 15 units, and for product C is at least 10 units.\n// A >= 20; B >= 15; C >= 10",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant has a limited budget of $1500 for production costs. The plant has a maximum production capacity of 100 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours. The market demand for product A is at least 20 units, for product B is at least 15 units, and for product C is at least 10 units. Please help the plant to maximize the total profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 20 * A + 30 * B + 40 * C\nCost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The plant has a limited budget of $1500 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 1500)\n## The plant has a maximum production capacity of 100 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of P1 is $15, and for P2 is $20. The new energy-efficient technology reduces the energy cost per unit by $0.5 for every $1000 invested. The revenue per unit of P1 is $30, and for P2 is $40. The company aims to maximize the total profit from both products.\n// Profit_P1 = (30 - 15 + 0.0005 * EnergyEfficiency) * P1\n// Profit_P2 = (40 - 20 + 0.0005 * EnergyEfficiency) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// P1 + P2 <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for the investment in energy efficiency.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the energy cost per unit produced. The energy cost per unit of P1 is $15, and for P2 is $20. The new energy-efficient technology reduces the energy cost per unit by $0.5 for every $1000 invested. The revenue per unit of P1 is $30, and for P2 is $40. The company aims to maximize the total profit from both products.\n\n| Product | Revenue per Unit | Energy Cost per Unit |\n|---------|------------------|----------------------|\n| P1      | $30              | $15                  |\n| P2      | $40              | $20                  |\n\nThe company has a total production capacity of 1000 units for both products combined. The company also has a budget of $50,000 for the investment in energy efficiency.\n\nPlease help the company determine the optimal production quantities for P1 and P2, and the amount to invest in energy efficiency to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfit_P1 = (30 - 15 + 0.0005 * EnergyEfficiency) * P1\nProfit_P2 = (40 - 20 + 0.0005 * EnergyEfficiency) * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + P2 <= 1000)\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company wants to maximize the net profit per dollar invested.\n// Total revenue: Revenue = 200,000 * Trucks + 100,000 * Vans + 20,000 * Bikes\n// Total cost: Cost = (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes) + (10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes)\n// Net profit: Profit = Revenue - Cost\n// So, the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for vehicle purchases.\n// 100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes <= 5,000,000\n\n## Generate Constraint-2:\nThe company must have at least 50 vehicles in total.\n// Trucks + Vans + Bikes >= 50\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed twice the number of Vans.\n// Trucks <= 2 * Vans",
        "question": "A logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities. The cost, annual maintenance cost, and annual revenue for each type of vehicle are given in the following Table.\n\n| Vehicle | Purchase Cost | Annual Maintenance Cost | Annual Revenue |\n|---------|---------------|-------------------------|----------------|\n| Trucks  | $100,000      | $10,000                 | $200,000       |\n| Vans    | $50,000       | $5,000                  | $100,000       |\n| Bikes   | $10,000       | $1,000                  | $20,000        |\n\nThe company has a budget of $5,000,000 for vehicle purchases. The company must have at least 50 vehicles in total. The number of Trucks must not exceed twice the number of Vans. \nPlease help the company to maximize the net profit per dollar invested.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 200000 * Trucks + 100000 * Vans + 20000 * Bikes\nCost = (100000 * Trucks + 50000 * Vans + 10000 * Bikes) + (10000 * Trucks + 5000 * Vans + 1000 * Bikes)\nProfit = Revenue - Cost\n## the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n## convert the division to multiplication\nmodel.addCons(obj * (100000 * Trucks + 50000 * Vans + 10000 * Bikes) == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for vehicle purchases.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes <= 5000000)\n## The company must have at least 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes >= 50)\n## The number of Trucks must not exceed twice the number of Vans.\nmodel.addCons(Trucks <= 2 * Vans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Net Profit per Dollar Invested: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products, A and B. The company needs to decide the production quantity of each product and the amount of investment in a new technology that can improve the production efficiency of both products.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product A is $100 and for Product B is $150. The selling price per unit for Product A is $150 and for Product B is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (150 - 100 + 0.0005 * TechnologyInvestment) * ProductA\n// Total profit for Product B: ProfitB = (200 - 150 + 0.0005 * TechnologyInvestment) * ProductB\n// So, the objective function is: Maximize Profit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechnologyInvestment <= 50000\n\n## Generate Constraint-3:\nThe production quantity of Product A must be at least 200 units.\n// ProductA >= 200",
        "question": "A manufacturing company produces two types of products, A and B, and is considering investing in a new technology to improve the production efficiency of both products. The company needs to decide the production quantity of each product and the amount of investment in this new technology. The initial production cost per unit for Product A is $100 and for Product B is $150, while the selling price per unit for Product A is $150 and for Product B is $200. The new technology reduces the production cost per unit of both products by $5 for every $10,000 invested.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| A       | $100                    | $150          |\n| B       | $150                    | $200          |\n\nThe company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000. Additionally, the production quantity of Product A must be at least 200 units.\n\nPlease help the company to maximize the total profit from both products by determining the optimal production quantities of Product A and Product B, and the appropriate investment in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200) # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of Product B\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * TechnologyInvestment) * ProductA\nProfitB = (200 - 150 + 0.0005 * TechnologyInvestment) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in New Technology: \", model.getVal(TechnologyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n// 5 * A + 8 * B + 10 * C <= 5000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total labor hours available are 2000 hours.\n// 2 * A + 3 * B + 4 * C <= 2000\n\n## Generate Constraint-3:\nThe market demand for each product is limited. The maximum demand for Product A is 1000 units, for Product B is 800 units, and for Product C is 600 units.\n// A <= 1000; B <= 800; C <= 600",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin. The profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products. The details of each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Raw Material Required (kg) | Labor Required (hours) |\n|---------|-------------------------|----------------------------|-------------------------|\n| A       | $10 + 0.02 * (A - 500) / 100 | 5                          | 2                       |\n| B       | $15 + 0.02 * (B - 500) / 100 | 8                          | 3                       |\n| C       | $20 + 0.02 * (C - 500) / 100 | 10                         | 4                       |\n\nThe company has a limited supply of raw materials, with a total of 5000 kg available. The company also has a labor constraint, with a total of 2000 hours available. The market demand for each product is limited, with the maximum demand for Product A being 1000 units, for Product B being 800 units, and for Product C being 600 units.\n\nPlease help the company determine the optimal number of units of each product to produce in order to maximize the total profit, while considering the constraints on raw materials, labor, and market demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for each product is limited. The maximum demand for Product A is 1000 units, for Product B is 800 units, and for Product C is 600 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=1000) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=800) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=600) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=500)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=500, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 500) / 100) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=500, ub=800)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 500) / 100) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=500)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=500, ub=600)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 500) / 100) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n## The company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total labor hours available are 2000 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1457,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost. The company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours. The company must produce at least 10 units of each product to meet contractual obligations.\nPlease help the company to maximize its total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nCost = Cost_A + Cost_B + Cost_C\n## the objective function is: Maximize Profit = Revenue - Cost\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 983,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop.\n// {\"area of land for CropA\": \"CropAArea\", \"range\": \"CropAArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropB\": \"CropBArea\", \"range\": \"CropBArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropC\": \"CropCArea\", \"range\": \"CropCArea >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400.\nThe farm wants to maximize the net profit per liter of water used.\n// Profit_CropA = 1000 * CropAArea - 200 * CropAArea\n// Profit_CropB = 1500 * CropBArea - 300 * CropBArea\n// Profit_CropC = 2000 * CropCArea - 400 * CropCArea\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// CropAArea + CropBArea + CropCArea <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 600,000 liters.\n// 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea <= 600,000",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop. For CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. For CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400. The farm has a total of 100 hectares of land available and a limited water supply of 600,000 liters. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal allocation of land to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropAArea\", lb=0) # area of land for CropA\nCropBArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropBArea\", lb=0) # area of land for CropB\nCropCArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropCArea\", lb=0) # area of land for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (1000 - 200) * CropAArea\nProfit_CropB = (1500 - 300) * CropBArea\nProfit_CropC = (2000 - 400) * CropCArea\nWaterUsage = 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(CropAArea + CropBArea + CropCArea <= 100)\n## The farm has a limited water supply of 600,000 liters.\nmodel.addCons(5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea <= 600000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for CropA: \", model.getVal(CropAArea))\n    print(\"Area of land for CropB: \", model.getVal(CropBArea))\n    print(\"Area of land for CropC: \", model.getVal(CropCArea))\n    print(\"Maximized Net Profit per Liter of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"size of the geothermal system in units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company wants to minimize the total cost of installation while maximizing the total daily energy generation.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\n// Total daily energy generation: Energy = 100 * Solar + 200 * Wind + 300 * Geothermal\n// The objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000\n\n## Generate Constraint-2:\nThe company requires at least 5000 kWh of energy per day.\n// 100 * Solar + 200 * Wind + 300 * Geothermal >= 5000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 30% of the budget is spent on solar panels.\n// 1000 * Solar >= 0.30 * 100000\n\n## Generate Constraint-4:\nThe company wants to limit the number of wind turbines to no more than 20% of the total number of energy units installed.\n// Wind <= 0.20 * (Solar + Wind + Geothermal)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system. The cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company has a budget of $100,000 for the installation and requires at least 5000 kWh of energy per day. The company wants to ensure that at least 30% of the budget is spent on solar panels and to limit the number of wind turbines to no more than 20% of the total number of energy units installed. Please help the company to minimize the total cost of installation while maximizing the total daily energy generation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # size of the geothermal system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\nEnergy = 100 * Solar + 200 * Wind + 300 * Geothermal\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000)\n## The company requires at least 5000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind + 300 * Geothermal >= 5000)\n## The company wants to ensure that at least 30% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar >= 0.30 * 100000)\n## The company wants to limit the number of wind turbines to no more than 20% of the total number of energy units installed.\nmodel.addCons(Wind <= 0.20 * (Solar + Wind + Geothermal))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Size of Geothermal System: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n// Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\n// Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\n// Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n\n| Crop | Profit per Acre |\n|------|-----------------|\n| A    | $100            |\n| B    | $150            |\n| C    | $200            |\n\nThe farm has a total of 100 acres available for cultivation. Please help the farm determine the optimal allocation of acres to each crop to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=1, ub=100)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=1, ub=100)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 1)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40\n\n## Generate Constraint-3:\nThe demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3.\n// 100 * P1 + 120 * P2 + 140 * P3 >= 2000\n\n## Generate Constraint-4:\nThe demand for component B requires at least 3000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 15 hours on line 3.\n// 150 * P1 + 180 * P2 + 200 * P3 >= 3000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit. The profit per hour for each component on each production line is given in the following Table.\n\n| Production Line | Component A Profit/Hour | Component B Profit/Hour | Component C Profit/Hour |\n|-----------------|-------------------------|-------------------------|-------------------------|\n| 1               | $100                    | $150                    | $200                    |\n| 2               | $120                    | $180                    | $220                    |\n| 3               | $140                    | $200                    | $240                    |\n\nThe total operating hours for all production lines cannot exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week. The demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3. The demand for component B requires at least 3000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 15 hours on line 3.\n\nPlease help the company to maximize the total profit from producing these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n# The demand for component A requires at least 2000 units to be produced.\nmodel.addCons(100 * P1 + 120 * P2 + 140 * P3 >= 2000)\n# The demand for component B requires at least 3000 units to be produced.\nmodel.addCons(150 * P1 + 180 * P2 + 200 * P3 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1381,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 500 units.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company has a budget of $10,000 for production costs. The total storage space available is limited to 500 units. The company wants to produce at least 50 units of each product. Please help the company to maximize the total profit after deducting both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 15 * A\nProfit_B = 20 * B\nProfit_C = 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n## The total storage space available is limited to 500 units.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n\n## Generate Constraint-3:\nThe market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\n// A <= 200\n// B <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours. The company must produce at least 10 units of each product to meet contractual obligations. The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\nPlease help the company to maximize its total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=200) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=150) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # production quantity of product C\n\n# Define objective function\n## Revenue = 50 * A + 70 * B + 60 * C\n## Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n## Objective function: Maximize Profit = Revenue - Cost\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nProfit = Revenue - (Cost_A + Cost_B + Cost_C)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1095,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $15000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 15000\n\n## Generate Constraint-3:\nThe farm has a total land area of 100 hectares.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm has a budget of $15000 for fertilizer costs. The farm has a total land area of 100 hectares. \nPlease help the farm to maximize the profit efficiency (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $15000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 15000)\n## The farm has a total land area of 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse.\n// {\"number of climate control systems in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe effectiveness of each climate control system varies by greenhouse. In greenhouse A, each system increases crop yield by 10 kg per week. In greenhouse B, each system increases yield by 15 kg per week. In greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\n// Yield increase from greenhouse A: Yield_A = 10 * A\n// Yield increase from greenhouse B: Yield_B = 15 * B\n// Yield increase from greenhouse C: Yield_C = 20 * C\n// Cost of systems in greenhouse A: Cost_A = 500 * A\n// Cost of systems in greenhouse B: Cost_B = 700 * B\n// Cost of systems in greenhouse C: Cost_C = 900 * C\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe farm has a budget of $15,000 for installing climate control systems.\n// 500 * A + 700 * B + 900 * C <= 15000",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse.\nThe effectiveness of each climate control system varies by greenhouse. In greenhouse A, each system increases crop yield by 10 kg per week. In greenhouse B, each system increases yield by 15 kg per week. In greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\nThe farm has a budget of $15,000 for installing climate control systems.\nPlease help the farm to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of climate control systems in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of climate control systems in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of climate control systems in greenhouse C\n\n# Define objective function\nYield_A = 10 * A\nYield_B = 15 * B\nYield_C = 20 * C\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n# The farm has a budget of $15,000 for installing climate control systems.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of climate control systems in greenhouse A: \", model.getVal(A))\n    print(\"Number of climate control systems in greenhouse B: \", model.getVal(B))\n    print(\"Number of climate control systems in greenhouse C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of energy-efficient lighting systems\": \"Lighting\", \"range\": \"Lighting >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it saves $200 annually in energy costs.\nThe cost of each wind turbine is $2000, and it saves $300 annually in energy costs.\nThe cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// Total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Lighting\n// Total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Lighting\n// So, the objective function is: Minimize Cost - Savings\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities. The cost and annual energy savings for each type of installation are given in the following Table.\n\n| Installation Type | Cost per Unit | Annual Energy Savings per Unit |\n|-------------------|---------------|--------------------------------|\n| Solar Panels      | $1000         | $200                           |\n| Wind Turbines     | $2000         | $300                           |\n| Energy-Efficient Lighting Systems | $500 | $100                           |\n\nThe company has a budget of $100,000 for the installation. The company wants to minimize the total cost of installation while maximizing the annual energy savings. Please help the company determine the optimal number of solar panels, wind turbines, and energy-efficient lighting systems to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nLighting = model.addVar(vtype=\"INTEGER\", name=\"Lighting\", lb=0) # number of energy-efficient lighting systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Lighting\nSavings = 200 * Solar + 300 * Wind + 100 * Lighting\n## the objective function is: Minimize Cost - Savings\nmodel.addCons(obj == Cost - Savings)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Energy-Efficient Lighting Systems: \", model.getVal(Lighting))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\n// Profit_A = 20 * A - 0.05 * (3 * A)\n// Profit_B = 30 * B - 0.05 * (2 * B)\n// Profit_C = 40 * C - 0.05 * (4 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of the critical component, with only 1000 units available.\n// 3 * A + 2 * B + 4 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. For Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices. The company has a limited supply of the critical component, with only 1000 units available. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate profits\nProfit_A = 20 * A - 0.05 * (3 * A)\nProfit_B = 30 * B - 0.05 * (2 * B)\nProfit_C = 40 * C - 0.05 * (4 * C)\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of the critical component, with only 1000 units available.\nmodel.addCons(3 * A + 2 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 782,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a limited budget for production costs, which is $10,000.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must not exceed twice the production of P2.\n// P1 <= 2 * P2\n\n## Generate Constraint-4:\nThe company has a storage capacity constraint of 150 units.\n// P1 + P2 + P3 <= 150",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company has a total production capacity of 200 units and a limited budget for production costs, which is $10,000. Due to market demand, the production of P1 must not exceed twice the production of P2. The company also has a storage capacity constraint of 150 units.\nPlease help the company to maximize the total net profit, considering both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a limited budget for production costs, which is $10,000.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must not exceed twice the production of P2.\nmodel.addCons(P1 <= 2 * P2)\n# The company has a storage capacity constraint of 150 units.\nmodel.addCons(P1 + P2 + P3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of raw materials and labor per unit of ProductA is $20, ProductB is $30, and ProductC is $40. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 20) * QuantityA\n// Total profit for ProductB: ProfitB = (70 - 30) * QuantityB\n// Total profit for ProductC: ProfitC = (90 - 40) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials and labor, which cannot exceed $10,000.\n// 20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10,000\n\n## Generate Constraint-2:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe total production capacity of the company is 300 units.\n// QuantityA + QuantityB + QuantityC <= 300\n\n## Generate Constraint-4:\nTo maintain a balanced product portfolio, the company wants to ensure that at least 50 units of each product are produced.\n// QuantityA >= 50; QuantityB >= 50; QuantityC >= 50",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of raw materials and labor per unit of ProductA is $20, ProductB is $30, and ProductC is $40. The company has a limited budget for raw materials and labor, which cannot exceed $10,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The total production capacity of the company is 300 units. To maintain a balanced product portfolio, the company wants to ensure that at least 50 units of each product are produced.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=50) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=50) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=50) # production quantity of ProductC\n\n# Define objective function\nProfitA = (50 - 20) * QuantityA\nProfitB = (70 - 30) * QuantityB\nProfitC = (90 - 40) * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10000) # budget constraint\nmodel.addCons(QuantityA >= 2 * QuantityB) # market demand constraint\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 300) # production capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations.\n// {\"number of trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of motorcycles\": \"Motorcycles\", \"range\": \"Motorcycles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total monthly fuel cost. The fuel cost per kilometer for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.2. The expected monthly mileage for trucks is 10,000 km, for vans is 8,000 km, and for motorcycles is 5,000 km.\n// Total fuel cost for trucks: Cost_Trucks = 0.5 * 10,000 * Trucks\n// Total fuel cost for vans: Cost_Vans = 0.3 * 8,000 * Vans\n// Total fuel cost for motorcycles: Cost_Motorcycles = 0.2 * 5,000 * Motorcycles\n// So, the objective function is: Minimize (Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000.\n// 20,000 * Trucks + 15,000 * Vans + 5,000 * Motorcycles <= 100,000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 10.\n// Trucks + Vans + Motorcycles <= 10\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of trucks must be at least twice the number of motorcycles.\n// Trucks >= 2 * Motorcycles\n\n## Generate Constraint-4:\nThe company needs to ensure that at least 3 vehicles of any type are deployed.\n// Trucks >= 3 or Vans >= 3 or Motorcycles >= 3",
        "question": "A logistics company operates three types of vehicles: trucks, vans, and motorcycles, each with different fuel efficiency and cargo capacity. The company needs to decide how many of each vehicle type to deploy for the next month to optimize its operations. The company aims to minimize the total monthly fuel cost. The fuel cost per kilometer for trucks is $0.5, for vans is $0.3, and for motorcycles is $0.2. The expected monthly mileage for trucks is 10,000 km, for vans is 8,000 km, and for motorcycles is 5,000 km.\nThe company has a budget of $100,000 to purchase new vehicles. The cost of a truck is $20,000, a van is $15,000, and a motorcycle is $5,000. The total number of vehicles cannot exceed 10. Due to maintenance constraints, the number of trucks must be at least twice the number of motorcycles. The company needs to ensure that at least 3 vehicles of any type are deployed.\nPlease help the company determine the optimal number of trucks, vans, and motorcycles to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of vans\nMotorcycles = model.addVar(vtype=\"INTEGER\", name=\"Motorcycles\", lb=0)  # number of motorcycles\n\n# Define objective function\nCost_Trucks = 0.5 * 10000 * Trucks\nCost_Vans = 0.3 * 8000 * Vans\nCost_Motorcycles = 0.2 * 5000 * Motorcycles\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Trucks + Cost_Vans + Cost_Motorcycles)\n\n# Add constraints\nmodel.addCons(20000 * Trucks + 15000 * Vans + 5000 * Motorcycles <= 100000)  # Budget constraint\nmodel.addCons(Trucks + Vans + Motorcycles <= 10)  # Total vehicles constraint\nmodel.addCons(Trucks >= 2 * Motorcycles)  # Maintenance constraint\n\n# Ensure at least 3 vehicles of any type\nmodel.addCons(Trucks >= 3)\nmodel.addCons(Vans >= 3)\nmodel.addCons(Motorcycles >= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Motorcycles: \", model.getVal(Motorcycles))\n    print(\"Minimized Total Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|------------------|--------------------------|-----------------------|\n| P1      | $100             | $60                      | $10                   |\n| P2      | $120             | $70                      | $15                   |\n| P3      | $150             | $90                      | $20                   |\n\nThe company wants to maximize the total net profit, considering both production and storage costs. The company has a total production capacity of 200 units. Please help the company determine the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal production quantity for each product to maximize profit while considering the limited resources.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a selling price of $50, a material cost of $20, and requires 3 units of labor. \nProduct B has a selling price of $70, a material cost of $30, and requires 4 units of labor. \nProduct C has a selling price of $90, a material cost of $40, and requires 5 units of labor.\nThe plant aims to maximize the total profit per unit of labor used.\n// Profit of A: Profit_A = (50 - 20) * A\n// Profit of B: Profit_B = (70 - 30) * B\n// Profit of C: Profit_C = (90 - 40) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for material costs.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe plant has a maximum of 800 units of labor available.\n// 3 * A + 4 * B + 5 * C <= 800",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal production quantity for each product to maximize profit while considering the limited resources. The selling price, material cost, and labor units required for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Labor Units Required |\n|---------|---------------|---------------|----------------------|\n| A       | $50           | $20           | 3                    |\n| B       | $70           | $30           | 4                    |\n| C       | $90           | $40           | 5                    |\n\nThe plant has a budget of $10,000 for material costs. The plant has a maximum of 800 units of labor available. Please help the plant to maximize the total profit per unit of labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (70 - 30) * B\nProfit_C = (90 - 40) * C\nLabor = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $10,000 for material costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The plant has a maximum of 800 units of labor available.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200\n\n## Generate Constraint-2:\nThe total raw material available per day is 250 units.\n// 3A + 2B + C <= 250",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand. The profit per unit, labor hours required, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Units Required |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $50             | 2                    | 3                           |\n| B       | $70             | 3                    | 2                           |\n| C       | $60             | 4                    | 1                           |\n\nThe total labor hours available per day are 200 hours. The total raw material available per day is 250 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The total raw material available per day is 250 units.\nmodel.addCons(3*A + 2*B + C <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year. The cost of each wind turbine is $2000, and it provides an energy saving of $300 per year. The cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year. The company has a budget of $50,000 for the installation and aims to achieve at least $10,000 in annual energy savings. Please help the company to minimize the total cost of installation while maximizing the annual energy savings, defined as the ratio of total installation cost to total annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0) # amount of insulation upgrades\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\n## the objective function is: Minimize Cost / Savings\n## convert the division to multiplication\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 728,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\n// Total net profit for ComponentA: Profit_A = (50 - 30 - 5) * UnitsA\n// Total net profit for ComponentB: Profit_B = (70 - 40 - 10) * UnitsB\n// Total net profit for ComponentC: Profit_C = (100 - 60 - 15) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units per type of component.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 2000 units across all components.\n// UnitsA + UnitsB + UnitsC <= 2000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand. The profit, production cost, and storage cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|-----------|-----------------|--------------------------|-----------------------|\n| ComponentA | $50             | $30                      | $5                    |\n| ComponentB | $70             | $40                      | $10                   |\n| ComponentC | $100            | $60                      | $15                   |\n\nThe company has a production capacity limit of 1000 units per type of component. The total storage space available is limited to 2000 units across all components. Please help the company to maximize the total net profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * UnitsA\nProfit_B = (70 - 40 - 10) * UnitsB\nProfit_C = (100 - 60 - 15) * UnitsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1030,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost.\n// Net Profit = 50A - Cost_A(A) + 70B - Cost_B(B) + 90C - Cost_C(C)\n// So, the objective function is: Maximize Net Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per day.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per day.\n// B >= 150\n\n## Generate Constraint-4:\nThe market demand for product C is at least 100 units per day.\n// C >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. The production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost.\n\nThe company has a total production capacity of 1000 units per day. The market demand for product A is at least 200 units per day, for product B is at least 150 units per day, and for product C is at least 100 units per day.\n\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100)  # number of units of product C\n\n# Define objective function\n# Cost functions\nCost_A = 100 - 0.5 * A**2\nCost_B = 120 - 0.4 * B**2\nCost_C = 150 - 0.3 * C**2\n\n# Net Profit\nNet_Profit = 50 * A - Cost_A + 70 * B - Cost_B + 90 * C - Cost_C\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit)\n\n# Add constraints\n# Total production capacity\nmodel.addCons(A + B + C <= 1000)\n\n# Market demand constraints\nmodel.addCons(A >= 200)\nmodel.addCons(B >= 150)\nmodel.addCons(C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters.\nFor Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters.\nFor Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters.\nThe farmer wants to maximize the profit-to-water ratio (profit per liter of water used).\n// Profit_Wheat = 500 * 0.20 * Wheat\n// Profit_Corn = 700 * 0.25 * Corn\n// Profit_Soybeans = 400 * 0.30 * Soybeans\n// Water_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe total water available for irrigation is 50,000 liters.\n// 500 * Wheat + 800 * Corn + 300 * Soybeans <= 50000\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 acres of Wheat to meet a contract obligation.\n// Wheat >= 10",
        "question": "A farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop. The expected yield per acre, price per kg, and water usage per acre for each crop are given in the following Table.\n\n| Crop       | Expected Yield per Acre | Price per Kg | Water Usage per Acre |\n|------------|-------------------------|--------------|----------------------|\n| Wheat      | 500 kg                  | $0.20        | 500 liters           |\n| Corn       | 700 kg                  | $0.25        | 800 liters           |\n| Soybeans   | 400 kg                  | $0.30        | 300 liters           |\n\nThe farmer has 100 acres available for planting. The total water available for irrigation is 50,000 liters. The farmer must plant at least 10 acres of Wheat to meet a contract obligation. \nPlease help the farmer to maximize the profit-to-water ratio (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to dedicate to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 500 * 0.20 * Wheat\nProfit_Corn = 700 * 0.25 * Corn\nProfit_Soybeans = 400 * 0.30 * Soybeans\nWater_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n## convert the division to multiplication\nmodel.addCons(obj * Water_Used == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The total water available for irrigation is 50,000 liters.\nmodel.addCons(500 * Wheat + 800 * Corn + 300 * Soybeans <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. \nEach machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. \nEach machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. \nThe company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The objective is to minimize the total cost of production, including setup and operating costs.\n// Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n// Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n// Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20\n\n## Generate Constraint-3:\nTo ensure a balanced production, at least 10 machines must be allocated to ComponentB.\n// MachinesB >= 10\n\n## Generate Constraint-4:\nThe company wants to ensure that each component has at least one machine allocated to it.\n// MachinesA >= 1; MachinesB >= 1; MachinesC >= 1",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time. Each machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. Each machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. Each machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. The company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The company has a total of 50 machines available for allocation. Due to space limitations, no more than 20 machines can be allocated to ComponentA. To ensure a balanced production, at least 10 machines must be allocated to ComponentB. The company wants to ensure that each component has at least one machine allocated to it. Please help the company to minimize the total cost of production, including setup and operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=1)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=1, ub=50)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=1)  # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## convert the division to multiplication\nCost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## convert the division to multiplication\nCost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n## convert the division to multiplication\nCost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n## Due to space limitations, no more than 20 machines can be allocated to ComponentA.\nmodel.addCons(MachinesA <= 20)\n## To ensure a balanced production, at least 10 machines must be allocated to ComponentB.\nmodel.addCons(MachinesB >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Chocolate cake is $10, per Vanilla cake is $8, and per Strawberry cake is $9. Due to the holiday demand, the profit per cake increases by $0.02 for each additional cake produced beyond 100 cakes of each type. The bakery aims to maximize the total profit from selling the cakes.\n// Profit_Chocolate = max(10 + 0.02 * (Chocolate - 100), 10) * Chocolate\n// Profit_Vanilla = max(8 + 0.02 * (Vanilla - 100), 8) * Vanilla\n// Profit_Strawberry = max(9 + 0.02 * (Strawberry - 100), 9) * Strawberry\n// So, the objective function is: Maximize Profit_Chocolate + Profit_Vanilla + Profit_Strawberry\n\n## Generate Constraint-1:\nThe bakery has a limited supply of premium ingredients that are required for each type of cake. For Chocolate, it requires 500 grams per cake, for Vanilla, 400 grams per cake, and for Strawberry, 350 grams per cake. The total supply of premium ingredients is 15 kilograms.\n// 500 * Chocolate + 400 * Vanilla + 350 * Strawberry <= 15000\n\n## Generate Constraint-2:\nThe bakery has a storage capacity limit for each type of cake. For Chocolate, the storage limit is 300 cakes, for Vanilla, it is 250 cakes, and for Strawberry, it is 200 cakes.\n// Chocolate <= 300; Vanilla <= 250; Strawberry <= 200",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. The profit per Chocolate cake is $10, per Vanilla cake is $8, and per Strawberry cake is $9. Due to the holiday demand, the profit per cake increases by $0.02 for each additional cake produced beyond 100 cakes of each type. The bakery aims to maximize the total profit from selling the cakes.\n\n| Cake Type     | Profit per Cake | Premium Ingredient Required (grams) | Storage Limit |\n|---------------|-----------------|------------------------------------|---------------|\n| Chocolate     | $10             | 500                                | 300           |\n| Vanilla       | $8              | 400                                | 250           |\n| Strawberry    | $9              | 350                                | 200           |\n\nThe bakery has a limited supply of premium ingredients that are required for each type of cake. The total supply of premium ingredients is 15 kilograms. The bakery also has a storage capacity limit for each type of cake as specified in the table.\n\nPlease help the bakery to maximize the total profit from selling the cakes, considering the constraints on premium ingredient supply and storage capacity.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a storage capacity limit for each type of cake.\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0, ub=300) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0, ub=250) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0, ub=200) # number of Strawberry cakes\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Chocolate = max(10 + 0.02 * (Chocolate - 100), 10) * Chocolate\nChocolate1 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate1\", lb=0, ub=100)\nChocolate2 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate2\", lb=100, ub=300)\nChocolate_b1 = model.addVar(vtype=\"B\", name=\"Chocolate_b1\")\nChocolate_b2 = model.addVar(vtype=\"B\", name=\"Chocolate_b2\")\nmodel.addCons(Chocolate_b1 + Chocolate_b2 == 1)\nmodel.addCons(Chocolate == Chocolate1*Chocolate_b1 + Chocolate2*Chocolate_b2)\nProfit_Chocolate = 10 * Chocolate1 * Chocolate_b1 + (10 + 0.02 * (Chocolate2 - 100)) * Chocolate2 * Chocolate_b2\n## create piecewise variables for piecewise function: Profit_Vanilla = max(8 + 0.02 * (Vanilla - 100), 8) * Vanilla\nVanilla1 = model.addVar(vtype=\"INTEGER\", name=\"Vanilla1\", lb=0, ub=100)\nVanilla2 = model.addVar(vtype=\"INTEGER\", name=\"Vanilla2\", lb=100, ub=250)\nVanilla_b1 = model.addVar(vtype=\"B\", name=\"Vanilla_b1\")\nVanilla_b2 = model.addVar(vtype=\"B\", name=\"Vanilla_b2\")\nmodel.addCons(Vanilla_b1 + Vanilla_b2 == 1)\nmodel.addCons(Vanilla == Vanilla1*Vanilla_b1 + Vanilla2*Vanilla_b2)\nProfit_Vanilla = 8 * Vanilla1 * Vanilla_b1 + (8 + 0.02 * (Vanilla2 - 100)) * Vanilla2 * Vanilla_b2\n## create piecewise variables for piecewise function: Profit_Strawberry = max(9 + 0.02 * (Strawberry - 100), 9) * Strawberry\nStrawberry1 = model.addVar(vtype=\"INTEGER\", name=\"Strawberry1\", lb=0, ub=100)\nStrawberry2 = model.addVar(vtype=\"INTEGER\", name=\"Strawberry2\", lb=100, ub=200)\nStrawberry_b1 = model.addVar(vtype=\"B\", name=\"Strawberry_b1\")\nStrawberry_b2 = model.addVar(vtype=\"B\", name=\"Strawberry_b2\")\nmodel.addCons(Strawberry_b1 + Strawberry_b2 == 1)\nmodel.addCons(Strawberry == Strawberry1*Strawberry_b1 + Strawberry2*Strawberry_b2)\nProfit_Strawberry = 9 * Strawberry1 * Strawberry_b1 + (9 + 0.02 * (Strawberry2 - 100)) * Strawberry2 * Strawberry_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Chocolate + Profit_Vanilla + Profit_Strawberry\nmodel.addCons(obj == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited supply of premium ingredients that are required for each type of cake.\nmodel.addCons(500 * Chocolate + 400 * Vanilla + 350 * Strawberry <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla Cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry Cakes: \", model.getVal(Strawberry))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1322,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000\n\n## Generate Constraint-3:\nThe amount of overtime hours must not exceed 500 hours.\n// Overtime <= 500\n\n## Generate Constraint-4:\nThe number of units produced must be at least twice the amount of overtime hours.\n// Units >= 2 * Overtime",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from all units produced. The company has a maximum capacity of 1000 units that can be produced in the quarter. The total investment in advanced machinery cannot exceed $50,000. The amount of overtime hours must not exceed 500 hours. The number of units produced must be at least twice the amount of overtime hours. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nOvertime = model.addVar(vtype=\"INTEGER\", name=\"Overtime\", lb=0)  # amount of overtime hours\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0)  # investment in advanced machinery\n\n# Define objective function\nProfit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Units <= 1000)  # maximum capacity of 1000 units\nmodel.addCons(MachineryInvestment <= 50000)  # total investment in advanced machinery cannot exceed $50,000\nmodel.addCons(Overtime <= 500)  # overtime hours must not exceed 500 hours\nmodel.addCons(Units >= 2 * Overtime)  # number of units produced must be at least twice the amount of overtime hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Investment in Advanced Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for labor costs for the season.\n// 100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15,000\n\n## Generate Constraint-4:\nThe farm wants to ensure that each crop gets at least 5 acres to maintain biodiversity.\n// CropAAcreage >= 5; CropBAcreage >= 5; CropCAcreage >= 5",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season. For CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. For CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. For CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200. The farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. The farm has a budget of $15,000 for labor costs for the season. The farm wants to ensure that each crop gets at least 5 acres to maintain biodiversity. The farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage). Please help the farm determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=5)  # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=5)  # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=5)  # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n## The farm has a budget of $15,000 for labor costs for the season.\nmodel.addCons(100 * CropAAcreage + 150 * CropBAcreage + 200 * CropCAcreage <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. Additionally, the bakery is considering investing in a new oven that can reduce baking time per cake.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"investment in new oven\": \"OvenInvestment\", \"range\": \"OvenInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe baking time per cake decreases by 5 minutes for every $1000 invested in the new oven. The initial baking time per cake is 60 minutes. The selling price per cake is $30. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking.\n// Revenue per Chocolate cake: Revenue_Chocolate = 30 * Chocolate\n// Revenue per Vanilla cake: Revenue_Vanilla = 30 * Vanilla\n// Revenue per Strawberry cake: Revenue_Strawberry = 30 * Strawberry\n// Total revenue considering baking time: TotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / (60 - 0.005 * OvenInvestment) * (Chocolate + Vanilla + Strawberry)\n// So, the objective function is: Maximize TotalRevenue\n\n## Generate Constraint-1:\nThe bakery has a budget of $10,000 for the new oven.\n// OvenInvestment <= 10000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season and is considering investing in a new oven that can reduce baking time per cake. The baking time per cake decreases by 5 minutes for every $1000 invested in the new oven, with an initial baking time per cake of 60 minutes. The selling price per cake is $30. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking. The bakery has a budget of $10,000 for the new oven.\n\nPlease help the bakery to maximize the total revenue considering the baking time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nOvenInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenInvestment\", lb=0) # investment in new oven\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_Chocolate = 30 * Chocolate\nRevenue_Vanilla = 30 * Vanilla\nRevenue_Strawberry = 30 * Strawberry\nBakingTimeReduction = 60 - 0.005 * OvenInvestment\nTotalBakingTime = (Chocolate + Vanilla + Strawberry) * BakingTimeReduction\n## the objective function is: Maximize (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / TotalBakingTime\n## convert the division to multiplication\nmodel.addCons(obj * TotalBakingTime == Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry)\n\n# Add constraints\n## The bakery has a budget of $10,000 for the new oven.\nmodel.addCons(OvenInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla Cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry Cakes: \", model.getVal(Strawberry))\n    print(\"Investment in New Oven: \", model.getVal(OvenInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 668,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit. However, due to the different growth rates and harvesting times, the efficiency of land use varies. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\n// Profit_W = 100 * W\n// Profit_C = 150 * C\n// Profit_B = 120 * B\n// Land_Efficiency_W = 0.9 * W\n// Land_Efficiency_C = 1.2 * C\n// Land_Efficiency_B = 1.1 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $60.\n// 50 * W + 70 * C + 60 * B <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat is 50 acres. So, the farmer can only sell a maximum of 50 acres of wheat.\n// W <= 50",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit, considering the different land efficiencies: 0.9 for wheat, 1.2 for corn, and 1.1 for barley. The farmer has a total of 100 acres of land available and a budget of $10,000 for seeds and fertilizer, with costs per acre of $50 for wheat, $70 for corn, and $60 for barley. Additionally, the market demand for wheat is 50 acres, limiting the farmer to a maximum of 50 acres of wheat. Please help the farmer maximize the profit per unit of land efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=50) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 100 * W\nProfit_C = 150 * C\nProfit_B = 120 * B\nLand_Efficiency_W = 0.9 * W\nLand_Efficiency_C = 1.2 * C\nLand_Efficiency_B = 1.1 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B) == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizer of $10,000.\nmodel.addCons(50 * W + 70 * C + 60 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Land Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost.\n// Cost_A = max(10 - 0.02 * (A - 100), 10) * A\n// Cost_B = max(15 - 0.02 * (B - 100), 15) * B\n// Cost_C = max(20 - 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\n// 5 * A + 8 * B + 10 * C <= 5000\n\n## Generate Constraint-2:\nThe market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 700 units in terms of the number of units it can produce.\n// A + B + C <= 700",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand. The profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost. The manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units. The market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units. The manufacturer has a production capacity of 700 units in terms of the number of units it can produce. Please help the manufacturer to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(15 - 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 15 * B1 * B_b1 + (15 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(20 - 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 20 * C1 * C_b1 + (20 - 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n## The manufacturer has a production capacity of 700 units in terms of the number of units it can produce.\nmodel.addCons(A + B + C <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1272,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit.\n// {\"hours of operation for greenhouse A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach greenhouse has different efficiency and cost structures. \nGreenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. \nGreenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. \nGreenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. \nThe farm aims to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n// Profit from A: Profit_A = (10 * 15 - 5) * HA\n// Profit from B: Profit_B = (15 * 20 - 7) * HB\n// Profit from C: Profit_C = (20 * 25 - 9) * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (HA + HB + HC)\n\n## Generate Constraint-1:\nThe farm has a total budget of $300 per day for operating the greenhouses.\n// 5 * HA + 7 * HB + 9 * HC <= 300\n\n## Generate Constraint-2:\nEach greenhouse must operate at least 4 hours per day.\n// HA >= 4; HB >= 4; HC >= 4\n\n## Generate Constraint-3:\nThe total operating hours for all greenhouses combined must not exceed 20 hours per day.\n// HA + HB + HC <= 20",
        "question": "A farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit. Each greenhouse has different efficiency and cost structures. Greenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. Greenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. Greenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. The farm has a total budget of $300 per day for operating the greenhouses. Each greenhouse must operate at least 4 hours per day. The total operating hours for all greenhouses combined must not exceed 20 hours per day. Please help the farm to maximize the profit rate, which is defined as the total profit divided by the total operating hours.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=4) # hours of operation for greenhouse A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=4) # hours of operation for greenhouse B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=4) # hours of operation for greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 * 15 - 5) * HA\nProfit_B = (15 * 20 - 7) * HB\nProfit_C = (20 * 25 - 9) * HC\nOperatingHours = HA + HB + HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / OperatingHours\n## convert the division to multiplication\nmodel.addCons(obj * OperatingHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total budget of $300 per day for operating the greenhouses.\nmodel.addCons(5 * HA + 7 * HB + 9 * HC <= 300)\n## The total operating hours for all greenhouses combined must not exceed 20 hours per day.\nmodel.addCons(HA + HB + HC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Greenhouse A: \", model.getVal(HA))\n    print(\"Hours of Operation for Greenhouse B: \", model.getVal(HB))\n    print(\"Hours of Operation for Greenhouse C: \", model.getVal(HC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $100, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of device B is $150, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit of device C is $200, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\n// Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\n// Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all devices must not exceed $10,000. The cost per unit of device A is $20, device B is $30, and device C is $40.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\nThe profit per unit of device A is $100, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of device B is $150, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit of device C is $200, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these devices.\nThe total production cost for all devices must not exceed $10,000. The cost per unit of device A is $20, device B is $30, and device C is $40.\nPlease help the company to determine the optimal production quantities for devices A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (100 - 0.1 * A2) * A2 * A_b2 + 100 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=50, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (150 - 0.2 * B2) * B2 * B_b2 + 150 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=20)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=20, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (200 - 0.3 * C2) * C2 * C_b2 + 200 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations.\n// Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n// Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n// Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand. The profit per unit, production cost, and storage cost per unit per month for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost | Storage Cost per Unit per Month |\n|-----------|-----------------|-----------------|---------------------------------|\n| A         | $30             | $10             | $5                              |\n| B         | $40             | $15             | $7                              |\n| C         | $50             | $20             | $9                              |\n\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations. The company has a budget of $10,000 for production costs.\n\nPlease help the company determine the optimal production quantity of each component to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n## Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n## Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (30 - 10 - 5 * A**2) * A + (40 - 15 - 7 * B**2) * B + (50 - 20 - 9 * C**2) * C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product varies with the quantity produced due to economies of scale and market saturation. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\nThe company aims to maximize the total profit from all products.\n// So, the objective function is: Maximize P_Total = P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 20 units per day.\n// A >= 20\n\n## Generate Constraint-3:\nThe production of product B is limited to a maximum of 40 units per day due to raw material constraints.\n// B <= 40\n\n## Generate Constraint-4:\nThe company must produce at least 10 units of product C to fulfill a contractual obligation.\n// C >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\nThe profit from each product varies with the quantity produced due to economies of scale and market saturation. The profit function for each product is given by:\n- Profit from product A: P_A = 100A - 0.1A^2\n- Profit from product B: P_B = 150B - 0.2B^2\n- Profit from product C: P_C = 200C - 0.3C^2\nThe company aims to maximize the total profit from all products.\nThe total production capacity of the company is limited to 100 units per day. The market demand for product A is at least 20 units per day. The production of product B is limited to a maximum of 40 units per day due to raw material constraints. The company must produce at least 10 units of product C to fulfill a contractual obligation.\nPlease help the company determine the optimal production quantities for products A, B, and C to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=40) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from product A: P_A = 100A - 0.1A^2\n## Profit from product B: P_B = 150B - 0.2B^2\n## Profit from product C: P_C = 200C - 0.3C^2\nP_A = 100 * A - 0.1 * A**2\nP_B = 150 * B - 0.2 * B**2\nP_C = 200 * C - 0.3 * C**2\n## the objective function is: Maximize P_Total = P_A + P_B + P_C\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n## The total production capacity of the company is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The market demand for product A is at least 20 units per day.\nmodel.addCons(A >= 20)\n## The production of product B is limited to a maximum of 40 units per day due to raw material constraints.\nmodel.addCons(B <= 40)\n## The company must produce at least 10 units of product C to fulfill a contractual obligation.\nmodel.addCons(C >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1039,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce for each of its two products, Product A and Product B. Additionally, the company is considering investing in a new technology that could reduce production costs for both products.\n// {\"number of units of Product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $50, and for Product B is $70. The new technology reduces the production cost by $1 for every $10,000 invested. The selling price for each unit of Product A is $100, and for Product B is $120. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units for Product A and 800 units for Product B.\n// UnitsA <= 1000; UnitsB <= 800\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce for each of its two products, Product A and Product B. Additionally, the company is considering investing in a new technology that could reduce production costs for both products. The cost of producing each unit of Product A is $50, and for Product B is $70. The new technology reduces the production cost by $1 for every $10,000 invested. The selling price for each unit of Product A is $100, and for Product B is $120. The company aims to maximize the total profit from both products. The company has a production capacity of 1000 units for Product A and 800 units for Product B. The total investment in the new technology cannot exceed $50,000. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of Product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of Product B\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for the products: Profit = (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB\nmodel.addCons(obj == (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB)\n\n# Add constraints\n## The company has a production capacity of 1000 units for Product A and 800 units for Product B.\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 800)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Product B: \", model.getVal(UnitsB))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 833,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit.\n// {\"production time for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production time for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production time for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The plant aims to maximize the total daily profit.\n// The profit from product 1: R1 = 50 * 10 * P1\n// The profit from product 2: R2 = 70 * 15 * P2\n// The profit from product 3: R3 = 60 * 12 * P3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production time available in a day is 24 hours.\n// P1 + P2 + P3 <= 24",
        "question": "A manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit. The profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The total production time available in a day is 24 hours. Please help the plant manager to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production time for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production time for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production time for product 3\n\n# Define objective function\nR1 = 50 * 10 * P1 # profit from product 1\nR2 = 70 * 15 * P2 # profit from product 2\nR3 = 60 * 12 * P3 # profit from product 3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (R1 + R2 + R3)\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n# The total production time available in a day is 24 hours.\nmodel.addCons(P1 + P2 + P3 <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production time for product 1: \", model.getVal(P1))\n    print(\"Production time for product 2: \", model.getVal(P2))\n    print(\"Production time for product 3: \", model.getVal(P3))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 513,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs.\n// {\"hours facility 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours facility 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours facility 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility has a different cost per hour and efficiency in producing the chemical. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The objective is to minimize the total cost of operation while meeting the production target.\n// The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\n// The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total operating hours for all facilities combined must not exceed 40 hours.\n// H1 + H2 + H3 <= 40",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs. Each facility has a different cost per hour and efficiency in producing the chemical. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The total operating hours for all facilities combined must not exceed 40 hours. Please help the company to minimize the total cost of operation while meeting the production target.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours facility 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours facility 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours facility 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\nmodel.addCons(obj == 100 * H1 + 120 * H2 + 150 * H3)\n\n# Add constraints\n## The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n## The company needs to produce at least 3000 units of the chemical.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 >= 3000)\n## The total operating hours for all facilities combined must not exceed 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 Operates: \", model.getVal(H1))\n    print(\"Hours Facility 2 Operates: \", model.getVal(H2))\n    print(\"Hours Facility 3 Operates: \", model.getVal(H3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The manufacturer wants to maximize the total profit from selling these devices.\n// Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\n// Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\n// Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing Smartphones is $50 per unit, Tablets is $75 per unit, and Laptops is $100 per unit. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\n// S <= 500; T <= 300; L <= 200",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\nThe profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The manufacturer has a limited budget for production. The cost of producing Smartphones is $50 per unit, Tablets is $75 per unit, and Laptops is $100 per unit. The total budget for production is $15,000. The market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\nPlease help the manufacturer to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_Smartphones = 100 * S1 * S_b1 + (100 - 1 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_Tablets = 150 * T1 * T_b1 + (150 - 1 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_Laptops = 200 * L1 * L_b1 + (200 - 1 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\nmodel.addCons(obj == (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1038,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\n// Total profit for ProductB: Profit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\n// Total profit for ProductC: Profit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 1,000 units of each product are produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000\n\n## Generate Constraint-5:\nThe total cost of automation and production should not exceed the company's budget of $200,000.\n// (30 - 0.0001 * Automation) * (ProdA + ProdB + ProdC) + Automation <= 200000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantities for each product and the level of automation to be implemented in the production process. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The cost of production per unit decreases by $1 for every $10,000 invested in automation. The initial cost per unit for all products is $30. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Initial Cost per Unit |\n|---------|-----------------|-----------------------|\n| ProductA | $50             | $30                   |\n| ProductB | $70             | $30                   |\n| ProductC | $90             | $30                   |\n\nThe company has a total production capacity of 10,000 units across all products. The investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company wants to ensure that at least 1,000 units of each product are produced. The total cost of automation and production should not exceed the company's budget of $200,000.\n\nPlease help the company to determine the optimal production quantities for each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000)  # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000)  # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000)  # production quantity for ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit_A = (50 - (30 - 0.0001 * Automation)) * ProdA\nProfit_B = (70 - (30 - 0.0001 * Automation)) * ProdB\nProfit_C = (90 - (30 - 0.0001 * Automation)) * ProdC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n# The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n# The company wants to ensure that at least 1,000 units of each product are produced.\nmodel.addCons(ProdA >= 1000)\nmodel.addCons(ProdB >= 1000)\nmodel.addCons(ProdC >= 1000)\n# The total cost of automation and production should not exceed the company's budget of $200,000.\nmodel.addCons((30 - 0.0001 * Automation) * (ProdA + ProdB + ProdC) + Automation <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1372,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\n// Profit from A: Profit_A = 500 * HA\n// Profit from B: Profit_B = 700 * HB\n// Profit from C: Profit_C = 1000 * HC\n// Water usage: Water_A = 2 * HA, Water_B = 3 * HB, Water_C = 4 * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HA + HB + HC <= 100",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\nThe farm has a total of 100 hectares available for cultivation.\nPlease help the farm to determine the optimal allocation of hectares to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=0) # hectares of crop A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=0) # hectares of crop B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * HA\nProfit_B = 700 * HB\nProfit_C = 1000 * HC\nWater_A = 2 * HA\nWater_B = 3 * HB\nWater_C = 4 * HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HA + HB + HC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Profit per Water Usage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 717,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n// Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n// Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n// Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\n// Q1 + Q2 + Q3 <= 1000\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 800 units.\n// Q1 + Q2 + Q3 <= 800\n\n## Generate Constraint-3:\nThe market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\n// Q2 >= 2 * Q1",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity. The profit per unit and the cost function for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Cost Function          |\n|----------|-----------------|------------------------|\n| C1       | $100            | 50 + 0.1 * Q1^2       |\n| C2       | $150            | 75 + 0.15 * Q2^2      |\n| C3       | $200            | 100 + 0.2 * Q3^2      |\n\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals. The storage capacity of the plant is limited to 800 units. The market demand for C1 is 50 units, and therefore, the plant can only sell a maximum of 50 units of C1. Additionally, the plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\n\nPlease help the plant to maximize the total profit by determining the optimal production quantities of C1, C2, and C3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of C3\n\n# Define objective function\n## The cost function for each chemical is quadratic\nCost_C1 = 50 + 0.1 * Q1**2\nCost_C2 = 75 + 0.15 * Q2**2\nCost_C3 = 100 + 0.2 * Q3**2\n## Calculate profit for each chemical\nProfit_C1 = 100 * Q1 - Cost_C1\nProfit_C2 = 150 * Q2 - Cost_C2\nProfit_C3 = 200 * Q3 - Cost_C3\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\nmodel.addCons(Q1 + Q2 + Q3 <= 1000)\n## The storage capacity of the plant is limited to 800 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 800)\n## The market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1.\nmodel.addCons(Q1 <= 50)\n## The plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\nmodel.addCons(Q2 >= 2 * Q1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The fuel cost is a significant factor in the company's operational costs.\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 15 * B\n// Cargo carried by C: Cargo_C = 20 * C\n// Fuel consumed by A: Fuel_A = 5 * A\n// Fuel consumed by B: Fuel_B = 7 * B\n// Fuel consumed by C: Fuel_C = 9 * C\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle fuel for the month.\n// 5 * A + 7 * B + 9 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance capacity for at most 50 vehicles per month.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 500 tons of cargo are carried each month.\n// 10 * A + 15 * B + 20 * C >= 500",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations. The capacity and fuel consumption for each vehicle are given in the following Table.\n\n| Vehicle | Cargo Capacity | Fuel Consumption |\n|---------|----------------|------------------|\n| A       | 10 tons        | 5 liters         |\n| B       | 15 tons        | 7 liters         |\n| C       | 20 tons        | 9 liters         |\n\nThe company has a budget of $10,000 for vehicle fuel for the month. The company has a maintenance capacity for at most 50 vehicles per month. The company needs to ensure that at least 500 tons of cargo are carried each month. \nPlease help the company to maximize the total cargo carried per liter of fuel consumed, which is a significant factor in the company's operational costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_A = 10 * A\nCargo_B = 15 * B\nCargo_C = 20 * C\nFuel_A = 5 * A\nFuel_B = 7 * B\nFuel_C = 9 * C\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C) == Cargo_A + Cargo_B + Cargo_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle fuel for the month.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 10000)\n## The company has a maintenance capacity for at most 50 vehicles per month.\nmodel.addCons(A + B + C <= 50)\n## The company needs to ensure that at least 500 tons of cargo are carried each month.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency.\n// {\"hours of operation for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3\n// So, the objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency. Each production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C. The total operating hours for all production lines must not exceed 100 hours per week, and each production line can operate for a maximum of 40 hours per week.\nPlease help the company determine the optimal number of hours to operate each production line to maximize the total production of components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours of operation for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours of operation for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours of operation for production line 3\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3\nB_total = 15 * P1 + 18 * P2 + 20 * P3\nC_total = 20 * P1 + 22 * P2 + 24 * P3\n# So, the objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line 1: \", model.getVal(P1))\n    print(\"Hours of operation for production line 2: \", model.getVal(P2))\n    print(\"Hours of operation for production line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 935,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 20% of the total production.\n// PA >= 0.2 * (PA + PB + PC)\n\n## Generate Constraint-4:\nThe production of product C must not exceed twice the production of product B.\n// PC <= 2 * PB",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit. The company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 20% of the total production. The production of product C must not exceed twice the production of product B. Please help the company determine the optimal production quantities and the investment in the new technology to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nProfit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(PA >= 0.2 * (PA + PB + PC))\n## The production of product C must not exceed twice the production of product B.\nmodel.addCons(PC <= 2 * PB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of machines to allocate to each type of component to optimize production efficiency.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate for producing each type of component. Machine 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Machine 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Machine 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The company needs to produce at least 1000 units of A, 1500 units of B, and 2000 units of C daily. The machines can only operate or be idle simultaneously. Determine the minimum operating time to meet the daily demand.\n// The operating time for component A: T1 = 1000 / (10 * M1 + 15 * M2 + 20 * M3)\n// The operating time for component B: T2 = 1500 / (15 * M1 + 20 * M2 + 25 * M3)\n// The operating time for component C: T3 = 2000 / (20 * M1 + 25 * M2 + 30 * M3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 30 machines available.\n// M1 + M2 + M3 <= 30",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of machines to allocate to each type of component to optimize production efficiency. Each machine has a different efficiency rate for producing each type of component, as shown in the following Table.\n\n| Machine | Efficiency (Units/Hour) |\n|---------|-------------------------|\n| 1       | A: 10, B: 15, C: 20     |\n| 2       | A: 15, B: 20, C: 25     |\n| 3       | A: 20, B: 25, C: 30     |\n\nThe company needs to produce at least 1000 units of A, 1500 units of B, and 2000 units of C daily. The machines can only operate or be idle simultaneously. There are a total of 30 machines available. Determine the minimum operating time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The operating time for component A: T1 = 1000 / (10 * M1 + 15 * M2 + 20 * M3)\n## The operating time for component B: T2 = 1500 / (15 * M1 + 20 * M2 + 25 * M3)\n## The operating time for component C: T3 = 2000 / (20 * M1 + 25 * M2 + 30 * M3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * M1 + 15 * M2 + 20 * M3) == 1000)\nmodel.addCons(T2 * (15 * M1 + 20 * M2 + 25 * M3) == 1500)\nmodel.addCons(T3 * (20 * M1 + 25 * M2 + 30 * M3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 30 machines available.\nmodel.addCons(M1 + M2 + M3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Minimum Operating Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the farmer also knows that the more acres of a single crop are planted, the less efficient the farming becomes. Specifically, for every additional acre of a crop, the profit per acre decreases by 0.1% for that crop. The farmer aims to maximize the total profit from all crops.\n// Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n// Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n// Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n// So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 10 acres of each crop to maintain soil health.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the more acres of a single crop are planted, the less efficient the farming becomes, with the profit per acre decreasing by 0.1% for each additional acre of that crop. The farmer aims to maximize the total profit from all crops.\n\n| Crop | Profit per Acre |\n|------|-----------------|\n| A    | $100            |\n| B    | $150            |\n| C    | $200            |\n\nThe farmer has a total of 100 acres available for planting. The farmer must plant at least 10 acres of each crop to maintain soil health. Please help the farmer determine the optimal allocation of acres to each crop to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 acres of each crop to maintain soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_A = 100 * (1 - 0.001 * A)\nP_B = 150 * (1 - 0.001 * B)\nP_C = 200 * (1 - 0.001 * C)\n## the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\nmodel.addCons(obj == P_A * A + P_B * B + P_C * C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility.\n// {\"labor hours at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility produces a different type of component. The efficiency of production varies with the amount of labor hours invested. \nAt facility 1, the production rate of component 1 is 0.5 units per labor hour, and the production rate of component 2 is 0.3 units per labor hour. \nAt facility 2, the production rate of component 1 is 0.4 units per labor hour, and the production rate of component 2 is 0.6 units per labor hour. \nAt facility 3, the production rate of component 1 is 0.6 units per labor hour, and the production rate of component 2 is 0.4 units per labor hour.\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. Determine the minimum total labor hours required to meet the monthly demand.\n// The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n// The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n// So, the objective function is: Minimize max(T1, T2)\n\n## Generate Constraint-1:\nThe total labor hours available across all facilities is limited to 800 hours.\n// L1 + L2 + L3 <= 800\n\n## Generate Constraint-2:\nEach facility has a maximum capacity of 300 labor hours per month.\n// L1 <= 300; L2 <= 300; L3 <= 300",
        "question": "A company operates 3 different facilities for producing electronic components. The manager needs to determine the amount of resources (in terms of labor hours) to allocate to each facility. The production rates for each component at each facility are given in the following Table.\n\n| Facility | Component 1 Production Rate (units/hour) | Component 2 Production Rate (units/hour) |\n|----------|-----------------------------------------|-----------------------------------------|\n| 1        | 0.5                                     | 0.3                                     |\n| 2        | 0.4                                     | 0.6                                     |\n| 3        | 0.6                                     | 0.4                                     |\n\nThe company needs to produce at least 500 units of component 1 and at least 400 units of component 2. The three facilities can only be operated simultaneously. The total labor hours available across all facilities is limited to 800 hours, and each facility has a maximum capacity of 300 labor hours per month. \nPlease help the company determine the minimum total labor hours required to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours at facility 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours at facility 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total labor hours for component 1: T1 = 500 / (0.5 * L1 + 0.4 * L2 + 0.6 * L3)\n## The total labor hours for component 2: T2 = 400 / (0.3 * L1 + 0.6 * L2 + 0.4 * L3)\n## So, the objective function is: Minimize max(T1, T2)\n## Convert the division to multiplication\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\")\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\")\nmodel.addCons(T1 * (0.5 * L1 + 0.4 * L2 + 0.6 * L3) == 500)\nmodel.addCons(T2 * (0.3 * L1 + 0.6 * L2 + 0.4 * L3) == 400)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\n\n# Add constraints\n## The total labor hours available across all facilities is limited to 800 hours.\nmodel.addCons(L1 + L2 + L3 <= 800)\n## Each facility has a maximum capacity of 300 labor hours per month.\nmodel.addCons(L1 <= 300)\nmodel.addCons(L2 <= 300)\nmodel.addCons(L3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours at facility 1: \", model.getVal(L1))\n    print(\"Labor hours at facility 2: \", model.getVal(L2))\n    print(\"Labor hours at facility 3: \", model.getVal(L3))\n    print(\"Minimum total labor hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product to maximize profit while considering the cost of overtime.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for Product 1 is $50, for Product 2 is $70, and for Product 3 is $60. The overtime cost per hour is $100. The production line operates for 8 hours a day, and any overtime is charged at the rate of $100 per hour. The company aims to maximize the total daily profit.\n// Total profit for Product 1: Profit1 = 50 * P1 * 8\n// Total profit for Product 2: Profit2 = 70 * P2 * 8\n// Total profit for Product 3: Profit3 = 60 * P3 * 8\n// Overtime cost: Overtime = 100 * max(0, P1 + P2 + P3 - 8)\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 - Overtime)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed the production capacity of 10 units per hour.\n// P1 + P2 + P3 <= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product to maximize profit while considering the cost of overtime. The profit per unit for each product and the overtime cost per hour are given in the following Table.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| 1       | $50             |\n| 2       | $70             |\n| 3       | $60             |\n\nThe production line operates for 8 hours a day, and any overtime is charged at the rate of $100 per hour. The company aims to maximize the total daily profit. The total production rate for all products must not exceed the production capacity of 10 units per hour. Please help the company to determine the optimal production rates for each product to maximize the total daily profit, considering the overtime costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\n\n# Define objective function\n## Total profit for Product 1: Profit1 = 50 * P1 * 8\n## Total profit for Product 2: Profit2 = 70 * P2 * 8\n## Total profit for Product 3: Profit3 = 60 * P3 * 8\nProfit1 = 50 * P1 * 8\nProfit2 = 70 * P2 * 8\nProfit3 = 60 * P3 * 8\n## Overtime cost: Overtime = 100 * max(0, P1 + P2 + P3 - 8)\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\")\nmodel.addCons(Overtime >= P1 + P2 + P3 - 8)\nmodel.addCons(Overtime >= 0)\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 - Overtime)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 - Overtime)\n\n# Add constraints\n## The total production rate for all products must not exceed the production capacity of 10 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate for Product 1: \", model.getVal(P1))\n    print(\"Production rate for Product 2: \", model.getVal(P2))\n    print(\"Production rate for Product 3: \", model.getVal(P3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the level of quality control to minimize defects.\n// {\"production quantity\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"quality control level\": \"QualityControl\", \"range\": \"QualityControl >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe revenue from selling each unit of the product is $100. The cost of production per unit is $60, which decreases by $0.5 for every $1,000 spent on quality control. The cost of advertising per $1,000 spent is $100, but it increases the revenue per unit by $2. The company aims to maximize its net profit.\n// Net profit: Profit = (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Quantity <= 10000\n\n## Generate Constraint-2:\nThe total budget for advertising cannot exceed $50,000.\n// Advertising <= 50000\n\n## Generate Constraint-3:\nThe level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate.\n// QualityControl >= 20000\n\n## Generate Constraint-4:\nThe production quantity must be at least 5,000 units to meet contractual obligations.\n// Quantity >= 5000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the level of quality control to minimize defects. The revenue from selling each unit of the product is $100. The cost of production per unit is $60, which decreases by $0.5 for every $1,000 spent on quality control. The cost of advertising per $1,000 spent is $100, but it increases the revenue per unit by $2. The company aims to maximize its net profit.\n\nThe company has a production capacity limit of 10,000 units for the quarter. The total budget for advertising cannot exceed $50,000. The level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate. The production quantity must be at least 5,000 units to meet contractual obligations.\n\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=5000, ub=10000)  # production quantity\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0, ub=50000)  # advertising budget\nQualityControl = model.addVar(vtype=\"CONTINUOUS\", name=\"QualityControl\", lb=20000)  # quality control level\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Net profit: Profit = (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising\nmodel.addCons(obj == (100 + 0.002 * Advertising - 60 + 0.0005 * QualityControl) * Quantity - Advertising)\n\n# Add constraints\n## The total budget for advertising cannot exceed $50,000.\nmodel.addCons(Advertising <= 50000)\n## The level of quality control must be at least $20,000 to ensure a minimum acceptable defect rate.\nmodel.addCons(QualityControl >= 20000)\n## The production quantity must be at least 5,000 units to meet contractual obligations.\nmodel.addCons(Quantity >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Quality Control Level: \", model.getVal(QualityControl))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\n// Operating hours for product A: HA = 800 / (10 * MA)\n// Operating hours for product B: HB = 1200 / (15 * MB)\n// Operating hours for product C: HC = 1600 / (20 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type. Each machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The manufacturer has a total of 50 machines available.\nPlease help the manufacturer to minimize the total operating hours required to meet these demands, where the operating hours are defined as the maximum of the individual operating hours for each product (HA for product A, HB for product B, and HC for product C).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 800 / (10 * MA)\nHB = 1200 / (15 * MB)\nHC = 1600 / (20 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 800)\nmodel.addCons(HB * (15 * MB) == 1200)\nmodel.addCons(HC * (20 * MC) == 1600)\n## the objective function is: Minimize max(HA, HB, HC)\n## convert max to a variable\nmax_hours = model.addVar('max_hours')\nmodel.addCons(max_hours >= HA)\nmodel.addCons(max_hours >= HB)\nmodel.addCons(max_hours >= HC)\nmodel.addCons(obj == max_hours)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Minimum Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 747,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse.\n// {\"number of climate control systems in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe effectiveness of each climate control system varies by greenhouse. In greenhouse A, each system increases crop yield by 10 kg per week. In greenhouse B, each system increases yield by 15 kg per week. In greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\n// Yield increase from greenhouse A: Yield_A = 10 * A\n// Yield increase from greenhouse B: Yield_B = 15 * B\n// Yield increase from greenhouse C: Yield_C = 20 * C\n// Cost of systems in greenhouse A: Cost_A = 500 * A\n// Cost of systems in greenhouse B: Cost_B = 700 * B\n// Cost of systems in greenhouse C: Cost_C = 900 * C\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe farm has a budget of $15,000 for installing climate control systems.\n// 500 * A + 700 * B + 900 * C <= 15000",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse. The effectiveness of each climate control system varies by greenhouse: in greenhouse A, each system increases crop yield by 10 kg per week; in greenhouse B, each system increases yield by 15 kg per week; in greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\n\n| Greenhouse | Yield Increase per System (kg/week) | Cost per System ($) |\n|------------|-------------------------------------|---------------------|\n| A          | 10                                  | 500                 |\n| B          | 15                                  | 700                 |\n| C          | 20                                  | 900                 |\n\nThe farm has a budget of $15,000 for installing climate control systems. Please help the farm determine the optimal number of climate control systems to install in each greenhouse to maximize net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of climate control systems in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of climate control systems in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of climate control systems in greenhouse C\n\n# Define objective function\nYield_A = 10 * A\nYield_B = 15 * B\nYield_C = 20 * C\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n# The farm has a budget of $15,000 for installing climate control systems.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of climate control systems in greenhouse A: \", model.getVal(A))\n    print(\"Number of climate control systems in greenhouse B: \", model.getVal(B))\n    print(\"Number of climate control systems in greenhouse C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit.\n// {\"units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n// The net profit for component A: P_A = 50A - 20A = 30A\n// The net profit for component B: P_B = 70B - 30B = 40B\n// The net profit for component C: P_C = 60C - 25C = 35C\n// The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production of component A must be at least twice the production of component B.\n// A >= 2B\n\n## Generate Constraint-3:\nThe production of component C cannot exceed the combined production of components A and B.\n// C <= A + B",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit. The profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit. The company has a limited production capacity and can produce a maximum of 100 units in total per day. Due to market demand, the production of component A must be at least twice the production of component B. Additionally, the production of component C cannot exceed the combined production of components A and B. Please help the company determine the optimal number of units to produce for each component to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # units of component C\n\n# Define objective function\nP_A = 30 * A\nP_B = 40 * B\nP_C = 35 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(A >= 2 * B)\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Component A: \", model.getVal(A))\n    print(\"Units of Component B: \", model.getVal(B))\n    print(\"Units of Component C: \", model.getVal(C))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Truck\", \"range\": \"Truck >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Van\", \"range\": \"Van >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bike\", \"range\": \"Bike >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles.\n// Fuel_Cost_Truck = 100 * sqrt(Truck)\n// Fuel_Cost_Van = 70 * sqrt(Van)\n// Fuel_Cost_Bike = 20 * sqrt(Bike)\n// So, the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle.\n// 500 * Truck + 300 * Van + 100 * Bike <= 10000\n\n## Generate Constraint-2:\nThe total capacity of all vehicles must be at least 500 cubic meters. Trucks have a capacity of 50 cubic meters, Vans have a capacity of 20 cubic meters, and Bikes have a capacity of 5 cubic meters.\n// 50 * Truck + 20 * Van + 5 * Bike >= 500\n\n## Generate Constraint-3:\nThe company must use at least 5 Trucks.\n// Truck >= 5\n\n## Generate Constraint-4:\nThe number of Vans cannot exceed 20.\n// Van <= 20\n\n## Generate Constraint-5:\nThe total number of vehicles must not exceed 50.\n// Truck + Van + Bike <= 50",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile. The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles. The company has a budget of $10,000 for vehicle maintenance. The maintenance cost for Trucks is $500 per vehicle, for Vans is $300 per vehicle, and for Bikes is $100 per vehicle. The total capacity of all vehicles must be at least 500 cubic meters. Trucks have a capacity of 50 cubic meters, Vans have a capacity of 20 cubic meters, and Bikes have a capacity of 5 cubic meters. The company must use at least 5 Trucks. The number of Vans cannot exceed 20. The total number of vehicles must not exceed 50.\nPlease help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize the total fuel cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruck = model.addVar(vtype=\"INTEGER\", name=\"Truck\", lb=5)  # number of Trucks\nVan = model.addVar(vtype=\"INTEGER\", name=\"Van\", lb=0, ub=20)  # number of Vans\nBike = model.addVar(vtype=\"INTEGER\", name=\"Bike\", lb=0)  # number of Bikes\n\n# Define objective function\n# The fuel cost for Trucks is $100 per mile, for Vans is $70 per mile, and for Bikes is $20 per mile.\n# The company wants to minimize the total fuel cost while considering the nonlinear relationship between the number of vehicles and the total distance traveled, which is inversely proportional to the square root of the number of vehicles.\n# Fuel_Cost_Truck = 100 * sqrt(Truck)\n# Fuel_Cost_Van = 70 * sqrt(Van)\n# Fuel_Cost_Bike = 20 * sqrt(Bike)\n# So, the objective function is: Minimize Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n# Convert square root to a variable\nsqrt_Truck = model.addVar(name=\"sqrt_Truck\")\nsqrt_Van = model.addVar(name=\"sqrt_Van\")\nsqrt_Bike = model.addVar(name=\"sqrt_Bike\")\n\n# Constraints for square root variables\nmodel.addCons(sqrt_Truck * sqrt_Truck == Truck)\nmodel.addCons(sqrt_Van * sqrt_Van == Van)\nmodel.addCons(sqrt_Bike * sqrt_Bike == Bike)\n\n# Objective function\nFuel_Cost_Truck = 100 * sqrt_Truck\nFuel_Cost_Van = 70 * sqrt_Van\nFuel_Cost_Bike = 20 * sqrt_Bike\nmodel.addCons(obj == Fuel_Cost_Truck + Fuel_Cost_Van + Fuel_Cost_Bike)\n\n# Add constraints\n# The company has a budget of $10,000 for vehicle maintenance.\nmodel.addCons(500 * Truck + 300 * Van + 100 * Bike <= 10000)\n# The total capacity of all vehicles must be at least 500 cubic meters.\nmodel.addCons(50 * Truck + 20 * Van + 5 * Bike >= 500)\n# The company must use at least 5 Trucks.\nmodel.addCons(Truck >= 5)\n# The number of Vans cannot exceed 20.\nmodel.addCons(Van <= 20)\n# The total number of vehicles must not exceed 50.\nmodel.addCons(Truck + Van + Bike <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Truck))\n    print(\"Number of Vans: \", model.getVal(Van))\n    print(\"Number of Bikes: \", model.getVal(Bike))\n    print(\"Minimized Fuel Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000\n\n## Generate Constraint-2:\nThe company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units.\n// S + T + L <= 500\n\n## Generate Constraint-3:\nThe company has a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce.\n// S + T + L <= 400\n\n## Generate Constraint-4:\nThe company has a market demand constraint for each device. The maximum market demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// S <= 200; T <= 150; L <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500. The company also has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units. Additionally, there is a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce. Finally, the company has a market demand constraint for each device. The maximum market demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize total profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=200)  # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=150)  # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=100)  # number of laptops\n\n# Define objective function\nP_S = 500 * S - 0.1 * S**2\nP_T = 600 * T - 0.15 * T**2\nP_L = 800 * L - 0.2 * L**2\nP_total = P_S + P_T + P_L\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\nmodel.addCons(200 * S + 300 * T + 500 * L <= 100000)  # budget constraint\nmodel.addCons(S + T + L <= 500)  # warehouse capacity constraint\nmodel.addCons(S + T + L <= 400)  # labor constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily.\n// {\"production rate of Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"operating hours of the production line\": \"Hours\", \"range\": \"Hours >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe company aims to maximize its daily revenue. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n// Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n// Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n// Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production rate of all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe production line can operate for a maximum of 24 hours per day.\n// Hours <= 24\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\n// P1 * Hours >= 500\n// P2 * Hours >= 300\n// P3 * Hours >= 200",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product (units per hour) and the number of hours the production line operates daily. The revenue generated from each unit of Product 1 is $100, from Product 2 is $150, and from Product 3 is $200. However, the production line has a nonlinear efficiency curve where the efficiency decreases as the production rate increases. The efficiency of the line for Product 1 is 1 - 0.01 * P1, for Product 2 is 1 - 0.01 * P2, and for Product 3 is 1 - 0.01 * P3.\n\n| Product | Revenue per Unit | Efficiency Formula |\n|---------|------------------|--------------------|\n| 1       | $100             | 1 - 0.01 * P1      |\n| 2       | $150             | 1 - 0.01 * P2      |\n| 3       | $200             | 1 - 0.01 * P3      |\n\nThe total production rate of all products cannot exceed 100 units per hour. The production line can operate for a maximum of 24 hours per day. The company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\n\nPlease help the company to maximize its daily revenue by determining the optimal production rates and operating hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of Product 3\nHours = model.addVar(vtype=\"CONTINUOUS\", name=\"Hours\", lb=0) # operating hours of the production line\n\n# Define objective function\n## Daily revenue from Product 1: R1 = 100 * P1 * Hours * (1 - 0.01 * P1)\n## Daily revenue from Product 2: R2 = 150 * P2 * Hours * (1 - 0.01 * P2)\n## Daily revenue from Product 3: R3 = 200 * P3 * Hours * (1 - 0.01 * P3)\n## So, the objective function is: Maximize (R1 + R2 + R3)\nR1 = 100 * P1 * Hours * (1 - 0.01 * P1)\nR2 = 150 * P2 * Hours * (1 - 0.01 * P2)\nR3 = 200 * P3 * Hours * (1 - 0.01 * P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## The total production rate of all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The production line can operate for a maximum of 24 hours per day.\nmodel.addCons(Hours <= 24)\n## The company must produce at least 500 units of Product 1, 300 units of Product 2, and 200 units of Product 3 daily.\nmodel.addCons(P1 * Hours >= 500)\nmodel.addCons(P2 * Hours >= 300)\nmodel.addCons(P3 * Hours >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Operating Hours of the Production Line: \", model.getVal(Hours))\n    print(\"Maximized Daily Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit.\n// {\"number of workers on component A line\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B line\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C line\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. \nEach worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. \nEach worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker.\nThe company aims to maximize the total profit from all three components.\n// The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n// The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n// The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit. Each worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. Each worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. Each worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker.\n\nThe company has a total of 50 workers available. Each production line can accommodate up to 20 workers. Please help the company to maximize the total profit from all three components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on component A line\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on component B line\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on component C line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n## The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n## The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n## Convert the non-linear terms to linear by introducing additional variables and constraints\nP1 = model.addVar(name=\"P1\")\nP2 = model.addVar(name=\"P2\")\nP3 = model.addVar(name=\"P3\")\nmodel.addCons(P1 == 100 * W1 * (1 - 0.01 * (W1 - 1)))\nmodel.addCons(P2 == 120 * W2 * (1 - 0.005 * (W2 - 1)))\nmodel.addCons(P3 == 150 * W3 * (1 - 0.02 * (W3 - 1)))\n\n## the objective function is: Maximize P = P1 + P2 + P3\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The company has a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n## Each production line can accommodate up to 20 workers.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Component A Line: \", model.getVal(W1))\n    print(\"Number of Workers on Component B Line: \", model.getVal(W2))\n    print(\"Number of Workers on Component C Line: \", model.getVal(W3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production.\n// {\"operating hours for reactor 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"operating hours for reactor 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach reactor has a different efficiency in producing the chemicals. Reactor 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Reactor 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Reactor 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The plant aims to maximize the total production of all chemicals.\n// Total production of A: P_A = 10 * H1 + 15 * H2 + 20 * H3\n// Total production of B: P_B = 15 * H1 + 20 * H2 + 25 * H3\n// Total production of C: P_C = 20 * H1 + 25 * H2 + 30 * H3\n// The objective function is: Maximize (P_A + P_B + P_C)\n\n## Generate Constraint-1:\nThe total operating hours for all reactors must not exceed 100 hours per week.\n// H1 + H2 + H3 <= 100",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant has three reactors, each capable of producing different amounts of these chemicals. The manager needs to determine the operating hours for each reactor to optimize production. The efficiency of each reactor in producing the chemicals is given in the following Table.\n\n| Reactor | Units of A per Hour | Units of B per Hour | Units of C per Hour |\n|---------|---------------------|---------------------|---------------------|\n| 1       | 10                  | 15                  | 20                  |\n| 2       | 15                  | 20                  | 25                  |\n| 3       | 20                  | 25                  | 30                  |\n\nThe plant aims to maximize the total production of all chemicals. The total operating hours for all reactors must not exceed 100 hours per week. Please help the manager determine the optimal operating hours for each reactor to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # operating hours for reactor 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # operating hours for reactor 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # operating hours for reactor 3\n\n# Define objective function\nP_A = 10 * H1 + 15 * H2 + 20 * H3 # Total production of A\nP_B = 15 * H1 + 20 * H2 + 25 * H3 # Total production of B\nP_C = 20 * H1 + 25 * H2 + 30 * H3 # Total production of C\n# The objective function is: Maximize (P_A + P_B + P_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\n# The total operating hours for all reactors must not exceed 100 hours per week.\nmodel.addCons(H1 + H2 + H3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Operating hours for Reactor 1: \", model.getVal(H1))\n    print(\"Operating hours for Reactor 2: \", model.getVal(H2))\n    print(\"Operating hours for Reactor 3: \", model.getVal(H3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 984,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per hour, component B is $15 per hour, and component C is $20 per hour. The company aims to minimize the total cost of production while meeting the demand for each component.\n// The cost function is: Cost = 10 * PA + 15 * PB + 20 * PC\n// The objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units.\n// PA >= 500 / 50\n\n## Generate Constraint-2:\nThe demand for component B is at least 750 units, and each hour of production line B produces 60 units.\n// PB >= 750 / 60\n\n## Generate Constraint-3:\nThe demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\n// PC >= 1000 / 75\n\n## Generate Constraint-4:\nThe total operating hours for all production lines cannot exceed 100 hours.\n// PA + PB + PC <= 100\n\n## Generate Constraint-5:\nThe company has a policy to operate each production line for at least 5 hours per day.\n// PA >= 5; PB >= 5; PC >= 5",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours each production line should operate to optimize production costs. The cost of producing each component per hour is as follows:\n\n| Component | Cost per Hour |\n|-----------|---------------|\n| A         | $10           |\n| B         | $15           |\n| C         | $20           |\n\nThe demand for component A is at least 500 units, and each hour of production line A produces 50 units. The demand for component B is at least 750 units, and each hour of production line B produces 60 units. The demand for component C is at least 1000 units, and each hour of production line C produces 75 units. The total operating hours for all production lines cannot exceed 100 hours. The company has a policy to operate each production line for at least 5 hours per day.\n\nPlease help the company to minimize the total cost of production while meeting the demand for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=5) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=5) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=5) # hours for production line C\n\n# Define objective function\nCost = 10 * PA + 15 * PB + 20 * PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The demand for component A is at least 500 units, and each hour of production line A produces 50 units.\nmodel.addCons(PA >= 500 / 50)\n## The demand for component B is at least 750 units, and each hour of production line B produces 60 units.\nmodel.addCons(PB >= 750 / 60)\n## The demand for component C is at least 1000 units, and each hour of production line C produces 75 units.\nmodel.addCons(PC >= 1000 / 75)\n## The total operating hours for all production lines cannot exceed 100 hours.\nmodel.addCons(PA + PB + PC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\n// {\"number of acres for CropA\": \"AcresA\", \"range\": \"AcresA >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"AcresB\", \"range\": \"AcresB >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"AcresC\", \"range\": \"AcresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\n// Net profit for CropA: Profit_A = (500 - 100) * AcresA\n// Net profit for CropB: Profit_B = (700 - 150) * AcresB\n// Net profit for CropC: Profit_C = (900 - 200) * AcresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2000 * AcresA + 3000 * AcresB + 4000 * AcresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// AcresA + AcresB + AcresC <= 100",
        "question": "A farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop   | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|--------|--------------------------|----------------------|---------------------|\n| CropA  | $500                     | 2000 gallons         | $100                |\n| CropB  | $700                     | 3000 gallons         | $150                |\n| CropC  | $900                     | 4000 gallons         | $200                |\n\nThe farm has a total of 100 acres available for cultivation. The farm aims to maximize the net profit per gallon of water used. Please help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm needs to decide how many acres to allocate to each crop to optimize its operations.\nAcresA = model.addVar(vtype=\"INTEGER\", name=\"AcresA\", lb=0) # number of acres for CropA\nAcresB = model.addVar(vtype=\"INTEGER\", name=\"AcresB\", lb=0) # number of acres for CropB\nAcresC = model.addVar(vtype=\"INTEGER\", name=\"AcresC\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * AcresA\nProfit_B = (700 - 150) * AcresB\nProfit_C = (900 - 200) * AcresC\nWaterUsage = 2000 * AcresA + 3000 * AcresB + 4000 * AcresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(AcresA + AcresB + AcresC <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(AcresA))\n    print(\"Number of Acres for CropB: \", model.getVal(AcresB))\n    print(\"Number of Acres for CropC: \", model.getVal(AcresC))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\n// Total net profit for ComponentA: Profit_A = (50 - 30 - 5) * UnitsA\n// Total net profit for ComponentB: Profit_B = (70 - 40 - 10) * UnitsB\n// Total net profit for ComponentC: Profit_C = (100 - 60 - 15) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units per type of component.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 2000 units across all components.\n// UnitsA + UnitsB + UnitsC <= 2000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company has a production capacity limit of 1000 units per type of component. The total storage space available is limited to 2000 units across all components.\nPlease help the company to maximize the total net profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * UnitsA\nProfit_B = (70 - 40 - 10) * UnitsB\nProfit_C = (100 - 60 - 15) * UnitsC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-3:\nThe demand for smartphones is at least 300 units per hour.\n// 10 * Smartphone >= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The selling price for each smartphone is $20, each tablet is $30, and each laptop is $40.\n\n| Device     | Production Rate per Worker per Hour | Cost per Unit | Selling Price per Unit |\n|------------|-------------------------------------|---------------|------------------------|\n| Smartphones| 10                                  | $5            | $20                    |\n| Tablets    | 15                                  | $8            | $30                    |\n| Laptops    | 20                                  | $10           | $40                    |\n\nThe manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The total number of workers available is 50. The manufacturer has a budget constraint that limits the total production cost to $1000 per hour. The demand for smartphones is at least 300 units per hour.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(10 * Smartphone >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1464,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency.\n// {\"number of machines in factory 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines in factory 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The company aims to maximize the total production rate of the chemical while considering the operational costs of each factory, which are nonlinear functions of the number of machines. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The objective is to maximize the net production rate, which is the total production rate minus the total operational cost.\n// The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n// The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n// The objective function is: Maximize (P - C)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total number of machines across all factories to 50.\n// M1 + M2 + M3 <= 50",
        "question": "A company operates three different factories that produce a specific chemical. The company needs to decide how many machines to allocate to each factory to optimize production efficiency. Each machine in factory 1 produces 10 units of the chemical per hour, factory 2 produces 15 units per hour, and factory 3 produces 20 units per hour. The company aims to maximize the total production rate of the chemical while considering the operational costs of each factory, which are nonlinear functions of the number of machines. The operational cost in factory 1 is 0.1 * M1^2, in factory 2 is 0.15 * M2^2, and in factory 3 is 0.2 * M3^2. The objective is to maximize the net production rate, which is the total production rate minus the total operational cost. The company has a budget constraint that limits the total number of machines across all factories to 50. Please help the company to maximize the net production rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines in factory 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines in factory 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines in factory 3\n\n# Define objective function\n## The total production rate: P = 10 * M1 + 15 * M2 + 20 * M3\n## The total operational cost: C = 0.1 * M1^2 + 0.15 * M2^2 + 0.2 * M3^2\n## The objective function is: Maximize (P - C)\nP = 10 * M1 + 15 * M2 + 20 * M3\nC = 0.1 * M1**2 + 0.15 * M2**2 + 0.2 * M3**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - C)\n\n# Add constraints\n## The company has a budget constraint that limits the total number of machines across all factories to 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines in Factory 1: \", model.getVal(M1))\n    print(\"Number of Machines in Factory 2: \", model.getVal(M2))\n    print(\"Number of Machines in Factory 3: \", model.getVal(M3))\n    print(\"Maximized Net Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nTo ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\n// T >= 0.5 * V",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations. The cost and weekly profit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Purchase Cost | Weekly Profit |\n|--------------|---------------|---------------|\n| Trucks       | $50,000       | $10,000       |\n| Vans         | $30,000       | $7,000        |\n| Bikes        | $5,000        | $3,000        |\n\nThe company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans. \nPlease help the company to maximize the total weekly profit while considering the purchase costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n## Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n## So, the objective function is: Maximize (Profit - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000 * T + 7000 * V + 3000 * B - (50000 * T + 30000 * V + 5000 * B))\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\nmodel.addCons(T >= 0.5 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor.\n// {\"amount of land for C1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. \nEach unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. \nEach unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor.\nThe farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n// Profit_C1 = 100 * L1\n// Profit_C2 = 150 * L2\n// Profit_C3 = 200 * L3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of land available.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 200 units of water available.\n// 2 * L1 + 3 * L2 + 4 * L3 <= 200\n\n## Generate Constraint-3:\nThe farm has a total of 150 units of labor available.\n// L1 + 2 * L2 + 3 * L3 <= 150\n\n## Generate Constraint-4:\nThe market demand for C1 is limited to 50 units of land.\n// L1 <= 50",
        "question": "A farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor. The profit, water requirement, and labor requirement for each crop per unit of land are given in the following Table.\n\n| Crop | Profit per Unit of Land | Water per Unit of Land | Labor per Unit of Land |\n|------|-------------------------|------------------------|------------------------|\n| C1   | $100                    | 2 units                | 1 unit                 |\n| C2   | $150                    | 3 units                | 2 units                |\n| C3   | $200                    | 4 units                | 3 units                |\n\nThe farm has a total of 100 units of land available. The farm has a total of 200 units of water available. The farm has a total of 150 units of labor available. The market demand for C1 is limited to 50 units of land. \nPlease help the farm to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # amount of land for C1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # amount of land for C2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # amount of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * L1\nProfit_C2 = 150 * L2\nProfit_C3 = 200 * L3\nResource_Use = 2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / Resource_Use\n## convert the division to multiplication\nmodel.addCons(obj * Resource_Use == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 units of land available.\nmodel.addCons(L1 + L2 + L3 <= 100)\n## The farm has a total of 200 units of water available.\nmodel.addCons(2 * L1 + 3 * L2 + 4 * L3 <= 200)\n## The farm has a total of 150 units of labor available.\nmodel.addCons(L1 + 2 * L2 + 3 * L3 <= 150)\n## The market demand for C1 is limited to 50 units of land.\nmodel.addCons(L1 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for C1: \", model.getVal(L1))\n    print(\"Amount of Land for C2: \", model.getVal(L2))\n    print(\"Amount of Land for C3: \", model.getVal(L3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50\n\n## Generate Constraint-2:\nDue to operational requirements, CargoB must have at least half as many trucks as CargoA.\n// CargoBTrucks >= 0.5 * CargoATrucks\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for maintenance costs for the quarter.\n// 500 * CargoATrucks + 700 * CargoBTrucks + 1,000 * CargoCTrucks <= 100,000\n\n## Generate Constraint-4:\nThe company wants to ensure that each type of cargo has at least one truck allocated.\n// CargoATrucks >= 1; CargoBTrucks >= 1; CargoCTrucks >= 1",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The earnings, fuel cost, and maintenance cost per truck for each cargo type are given in the following Table.\n\n| Cargo Type | Earnings per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|--------------------|---------------------|----------------------------|\n| CargoA     | $5,000             | $1,000              | $500                       |\n| CargoB     | $7,000             | $1,500              | $700                       |\n| CargoC     | $10,000            | $2,000              | $1,000                     |\n\nThe company has a total of 50 trucks available for allocation. Due to operational requirements, CargoB must have at least half as many trucks as CargoA. The company has a budget of $100,000 for maintenance costs for the quarter. The company wants to ensure that each type of cargo has at least one truck allocated. \nPlease help the company to maximize the total net profit from all cargo types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=1)  # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=1)  # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=1)  # number of trucks for CargoC\n\n# Define objective function\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\nmodel.addCons(CargoBTrucks >= 0.5 * CargoATrucks)\nmodel.addCons(500 * CargoATrucks + 700 * CargoBTrucks + 1000 * CargoCTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installation and the annual energy savings for each type of upgrade are given in the following Table.\n\n| Upgrade Type       | Installation Cost | Annual Energy Savings |\n|--------------------|-------------------|-----------------------|\n| Solar Panels       | $1000 per unit    | $200 per unit         |\n| Wind Turbines      | $2000 per unit    | $300 per unit         |\n| Insulation Upgrades| $500 per unit     | $100 per unit         |\n\nThe company has a budget of $50,000 for the installation. The company aims to achieve at least $10,000 in annual energy savings. Please help the company to minimize the total cost of installation while maximizing the annual energy savings, expressed as the ratio of total installation cost to total annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0) # amount of insulation upgrades\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\n## the objective function is: Minimize Cost / Savings\n## convert the division to multiplication\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z).\n// {\"amount of Material X used\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y used\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n// {\"amount of Material Z used\": \"Z\", \"range\": \"Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n// Total cost of raw materials: Cost = 5 * X + 10 * Y + 15 * Z\n// Total production output: Output = 2 * X + 3 * Y + 4 * Z (assuming each unit of raw material contributes to the output as specified)\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 5 * X + 10 * Y + 15 * Z <= 10000",
        "question": "A manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z). The company needs to determine the amount of each raw material to use. The cost per unit of Material X is $5, Material Y is $10, and Material Z is $15. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials. The total production output is calculated as 2 units of output for each unit of Material X, 3 units for each unit of Material Y, and 4 units for each unit of Material Z.\n\n| Material | Cost per Unit | Output per Unit |\n|----------|---------------|-----------------|\n| X        | 5$            | 2 units         |\n| Y        | 10$           | 3 units         |\n| Z        | 15$           | 4 units         |\n\nThe company has a budget of $10,000 for raw materials. Please help the company to determine the optimal amounts of Material X, Material Y, and Material Z to use in order to minimize the total cost of raw materials while maximizing the production efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=0) # amount of Material X used\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y used\nZ = model.addVar(vtype=\"CONTINUOUS\", name=\"Z\", lb=0) # amount of Material Z used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 5 * X + 10 * Y + 15 * Z\nOutput = 2 * X + 3 * Y + 4 * Z\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(5 * X + 10 * Y + 15 * Z <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Material X used: \", model.getVal(X))\n    print(\"Amount of Material Y used: \", model.getVal(Y))\n    print(\"Amount of Material Z used: \", model.getVal(Z))\n    print(\"Minimized Cost per Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1191,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop.\n// {\"hectares of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"hectares of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"hectares of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare.\nFor Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare.\nFor Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n// Total profit: Profit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\n// Total water usage: Water = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 30 hectares are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30\n\n## Generate Constraint-3:\nThe total water usage should not exceed 100,000 liters.\n// 1000 * Wheat + 1200 * Corn + 800 * Soybeans <= 100000",
        "question": "A farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop. The expected yield, selling price, and water usage for each crop are given in the following Table.\n\n| Crop       | Expected Yield (tons/hectare) | Selling Price ($/ton) | Water Usage (liters/hectare) |\n|------------|-------------------------------|-----------------------|-----------------------------|\n| Wheat      | 5                             | 200                   | 1000                        |\n| Corn       | 6                             | 250                   | 1200                        |\n| Soybeans   | 4                             | 300                   | 800                         |\n\nThe farmer has 100 hectares of land available. The farmer wants to ensure at least 30 hectares are dedicated to each crop. The total water usage should not exceed 100,000 liters. \nPlease help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 hectares are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # hectares of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # hectares of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # hectares of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\nWater = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The total water usage should not exceed 100,000 liters.\nmodel.addCons(1000 * Wheat + 1200 * Corn + 800 * Soybeans <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Wheat: \", model.getVal(Wheat))\n    print(\"Hectares of Corn: \", model.getVal(Corn))\n    print(\"Hectares of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints.\n// {\"daily production quantity of ChemicalA\": \"ChemicalAProduction\", \"range\": \"ChemicalAProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalB\": \"ChemicalBProduction\", \"range\": \"ChemicalBProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalC\": \"ChemicalCProduction\", \"range\": \"ChemicalCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals.\n// Total daily profit: Profit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily production capacity of the company is limited to 1000 units.\n// ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000",
        "question": "A manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals. The total daily production capacity of the company is limited to 1000 units. Please help the company determine the optimal daily production quantities for each chemical to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalAProduction\", lb=0) # daily production quantity of ChemicalA\nChemicalBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBProduction\", lb=0) # daily production quantity of ChemicalB\nChemicalCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCProduction\", lb=0) # daily production quantity of ChemicalC\n\n# Define objective function\nProfit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production Quantity of ChemicalA: \", model.getVal(ChemicalAProduction))\n    print(\"Daily Production Quantity of ChemicalB: \", model.getVal(ChemicalBProduction))\n    print(\"Daily Production Quantity of ChemicalC: \", model.getVal(ChemicalCProduction))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 640,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit margin.\n// {\"production quantity for ProductA\": \"ProductAQty\", \"range\": \"ProductAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProductBQty\", \"range\": \"ProductBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProductCQty\", \"range\": \"ProductCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced above 100. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced above 200. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced above 300. The company wants to maximize the total profit.\n// Profit for ProductA: Profit_ProductA = (50 - 0.1 * max(ProductAQty - 100, 0)) * ProductAQty\n// Profit for ProductB: Profit_ProductB = (70 - 0.2 * max(ProductBQty - 200, 0)) * ProductBQty\n// Profit for ProductC: Profit_ProductC = (90 - 0.3 * max(ProductCQty - 300, 0)) * ProductCQty\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all products combined.\n// ProductAQty + ProductBQty + ProductCQty <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBQty <= 2 * ProductAQty\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for raw materials. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $40.\n// 20 * ProductAQty + 30 * ProductBQty + 40 * ProductCQty <= 20,000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to optimize their profit margin. The profit per unit for ProductA is $50, but it decreases by $0.1 for each unit produced above 100. The profit per unit for ProductB is $70, but it decreases by $0.2 for each unit produced above 200. The profit per unit for ProductC is $90, but it decreases by $0.3 for each unit produced above 300. The company wants to maximize the total profit. The company has a total production capacity of 500 units for all products combined. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a budget of $20,000 for raw materials. The cost of raw materials per unit for ProductA is $20, for ProductB is $30, and for ProductC is $40. Please help the company determine the optimal production quantities for ProductA, ProductB, and ProductC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAQty = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty\", lb=0) # production quantity for ProductA\nProductBQty = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty\", lb=0) # production quantity for ProductB\nProductCQty = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty\", lb=0) # production quantity for ProductC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ProductA = (50 - 0.1 * max(ProductAQty - 100, 0)) * ProductAQty\nProductAQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty1\", lb=0, ub=100)\nProductAQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductAQty2\", lb=100, ub=500)\nProductA_b1 = model.addVar(vtype=\"B\", name=\"ProductA_b1\")\nProductA_b2 = model.addVar(vtype=\"B\", name=\"ProductA_b2\")\nmodel.addCons(ProductA_b1 + ProductA_b2 == 1)\nmodel.addCons(ProductAQty == ProductAQty1*ProductA_b1 + ProductAQty2*ProductA_b2)\nProfit_ProductA = (50 - 0.1 * ProductAQty2) * ProductAQty2 * ProductA_b2 + 50 * ProductAQty1 * ProductA_b1\n## create piecewise variables for piecewise function: Profit_ProductB = (70 - 0.2 * max(ProductBQty - 200, 0)) * ProductBQty\nProductBQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty1\", lb=0, ub=200)\nProductBQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductBQty2\", lb=200, ub=500)\nProductB_b1 = model.addVar(vtype=\"B\", name=\"ProductB_b1\")\nProductB_b2 = model.addVar(vtype=\"B\", name=\"ProductB_b2\")\nmodel.addCons(ProductB_b1 + ProductB_b2 == 1)\nmodel.addCons(ProductBQty == ProductBQty1*ProductB_b1 + ProductBQty2*ProductB_b2)\nProfit_ProductB = (70 - 0.2 * ProductBQty2) * ProductBQty2 * ProductB_b2 + 70 * ProductBQty1 * ProductB_b1\n## create piecewise variables for piecewise function: Profit_ProductC = (90 - 0.3 * max(ProductCQty - 300, 0)) * ProductCQty\nProductCQty1 = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty1\", lb=0, ub=300)\nProductCQty2 = model.addVar(vtype=\"INTEGER\", name=\"ProductCQty2\", lb=300, ub=500)\nProductC_b1 = model.addVar(vtype=\"B\", name=\"ProductC_b1\")\nProductC_b2 = model.addVar(vtype=\"B\", name=\"ProductC_b2\")\nmodel.addCons(ProductC_b1 + ProductC_b2 == 1)\nmodel.addCons(ProductCQty == ProductCQty1*ProductC_b1 + ProductCQty2*ProductC_b2)\nProfit_ProductC = (90 - 0.3 * ProductCQty2) * ProductCQty2 * ProductC_b2 + 90 * ProductCQty1 * ProductC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAQty + ProductBQty + ProductCQty <= 500)\nmodel.addCons(ProductBQty <= 2 * ProductAQty)\nmodel.addCons(20 * ProductAQty + 30 * ProductBQty + 40 * ProductCQty <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProductAQty))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProductBQty))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProductCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\n// Profit per acre of A: Profit_A = (100 - 20) * A\n// Profit per acre of B: Profit_B = (150 - 30) * B\n// Profit per acre of C: Profit_C = (200 - 40) * C\n// Total acres planted: Total_acres = A + B + C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-3:\nThe total cost of fertilizers should not exceed $2500.\n// 20 * A + 30 * B + 40 * C <= 2500",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted). The farm has a total of 100 acres available for planting. The farmer wants to plant at least 10 acres of each crop. The total cost of fertilizers should not exceed $2500. Please help the farmer to determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 20) * A\nProfit_B = (150 - 30) * B\nProfit_C = (200 - 40) * C\nTotal_acres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n## convert the division to multiplication\nmodel.addCons(obj * Total_acres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n## The total cost of fertilizers should not exceed $2500.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 2500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 813,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains.\n// {\"number of solar panels on flat rooftops\": \"FlatPanels\", \"range\": \"FlatPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped rooftops\": \"SlopedPanels\", \"range\": \"SlopedPanels >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on open fields\": \"FieldPanels\", \"range\": \"FieldPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies by terrain type. On flat rooftops, each panel produces 150 kWh per day. On sloped rooftops, each panel produces 180 kWh per day due to better sunlight exposure. On open fields, each panel produces 160 kWh per day but requires additional maintenance costs, which are $5 per panel per day. The company aims to maximize the total daily energy production minus the maintenance costs.\n// Total daily energy production: Energy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\n// Total daily maintenance cost: Maintenance = 5 * FieldPanels\n// So, the objective function is: Maximize (Energy - Maintenance)\n\n## Generate Constraint-1:\nThe company has a budget to install a maximum of 1000 solar panels in total.\n// FlatPanels + SlopedPanels + FieldPanels <= 1000\n\n## Generate Constraint-2:\nDue to space limitations, the number of panels that can be installed on flat rooftops is limited to 400.\n// FlatPanels <= 400\n\n## Generate Constraint-3:\nThe number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints.\n// SlopedPanels <= 300",
        "question": "A renewable energy company is planning to install solar panels on three different types of terrains: flat rooftops, sloped rooftops, and open fields. The company needs to determine the number of solar panels to install on each type of terrain to maximize energy production while considering the varying efficiency of panels on different terrains. The efficiency of solar panels varies by terrain type as shown in the following Table.\n\n| Terrain Type       | Energy Production per Panel (kWh/day) | Additional Maintenance Cost per Panel (per day) |\n|--------------------|---------------------------------------|-------------------------------------------------|\n| Flat Rooftops      | 150                                   | 0                                               |\n| Sloped Rooftops    | 180                                   | 0                                               |\n| Open Fields        | 160                                   | $5                                             |\n\nThe company has a budget to install a maximum of 1000 solar panels in total. Due to space limitations, the number of panels that can be installed on flat rooftops is limited to 400. The number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints. The company aims to maximize the total daily energy production minus the maintenance costs.\n\nPlease help the company determine the optimal number of solar panels to install on each type of terrain.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlatPanels = model.addVar(vtype=\"INTEGER\", name=\"FlatPanels\", lb=0) # number of solar panels on flat rooftops\nSlopedPanels = model.addVar(vtype=\"INTEGER\", name=\"SlopedPanels\", lb=0) # number of solar panels on sloped rooftops\nFieldPanels = model.addVar(vtype=\"INTEGER\", name=\"FieldPanels\", lb=0) # number of solar panels on open fields\n\n# Define objective function\nEnergy = 150 * FlatPanels + 180 * SlopedPanels + 160 * FieldPanels\nMaintenance = 5 * FieldPanels\n# So, the objective function is: Maximize (Energy - Maintenance)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Maintenance)\n\n# Add constraints\n# The company has a budget to install a maximum of 1000 solar panels in total.\nmodel.addCons(FlatPanels + SlopedPanels + FieldPanels <= 1000)\n# Due to space limitations, the number of panels that can be installed on flat rooftops is limited to 400.\nmodel.addCons(FlatPanels <= 400)\n# The number of panels that can be installed on sloped rooftops is limited to 300 due to structural constraints.\nmodel.addCons(SlopedPanels <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Rooftops: \", model.getVal(FlatPanels))\n    print(\"Number of Solar Panels on Sloped Rooftops: \", model.getVal(SlopedPanels))\n    print(\"Number of Solar Panels on Open Fields: \", model.getVal(FieldPanels))\n    print(\"Maximized Daily Energy Production (minus maintenance costs): \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1490,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The cost of fertilizing each acre is $50 for wheat, $70 for corn, and $60 for soybeans. The farmer aims to maximize the net profit per unit of labor (defined as the total net profit divided by the total labor hours). Labor hours required per acre are 2 hours for wheat, 3 hours for corn, and 2.5 hours for soybeans.\n// Net profit of wheat: Net_Profit_W = (200 - 50) * W\n// Net profit of corn: Net_Profit_C = (300 - 70) * C\n// Net profit of soybeans: Net_Profit_S = (250 - 60) * S\n// So, the objective function is: Maximize (Net_Profit_W + Net_Profit_C + Net_Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for fertilizing the crops this season.\n// 50 * W + 70 * C + 60 * S <= 10000",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres of each crop to plant this season. The profit per acre and the cost of fertilizing each acre, as well as the labor hours required per acre, are given in the following Table.\n\n| Crop     | Profit per Acre | Cost of Fertilizing per Acre | Labor Hours per Acre |\n|----------|-----------------|------------------------------|----------------------|\n| Wheat    | $200            | $50                          | 2 hours              |\n| Corn     | $300            | $70                          | 3 hours              |\n| Soybeans | $250            | $60                          | 2.5 hours            |\n\nThe farmer has a budget of $10,000 for fertilizing the crops this season. The farmer aims to maximize the net profit per unit of labor (defined as the total net profit divided by the total labor hours).\nPlease help the farmer determine the optimal number of acres to plant for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_W = (200 - 50) * W\nNet_Profit_C = (300 - 70) * C\nNet_Profit_S = (250 - 60) * S\nLaborHours = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Net_Profit_W + Net_Profit_C + Net_Profit_S) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Net_Profit_W + Net_Profit_C + Net_Profit_S)\n\n# Add constraints\n## The farmer has a budget of $10,000 for fertilizing the crops this season.\nmodel.addCons(50 * W + 70 * C + 60 * S <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies based on the production cost and market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company aims to maximize the total profit.\n// The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\n\n## Generate Constraint-1:\nThe company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n// 30S + 70T + 120L <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units.\n// S >= 100; T >= 50; L >= 30\n\n## Generate Constraint-3:\nThe total number of devices produced should not exceed 200 units.\n// S + T + L <= 200",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\nThe profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars. The market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units. The total number of devices produced should not exceed 200 units.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=50) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=30) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S = S * (50 - 0.1 * S)\nProfit_T = T * (100 - 0.2 * T)\nProfit_L = L * (150 - 0.3 * L)\n## the objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L)\n\n# Add constraints\n## The company has a budget constraint of 10000 dollars for production.\nmodel.addCons(30 * S + 70 * T + 120 * L <= 10000)\n## The total number of devices produced should not exceed 200 units.\nmodel.addCons(S + T + L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints.\n// {\"number of units of ProductA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. However, the production cost per unit for each product varies with the number of units produced due to economies of scale. The production cost per unit for ProductA is modeled as 40 - 0.1*UnitsA, for ProductB as 50 - 0.1*UnitsB, and for ProductC as 60 - 0.1*UnitsC. The company wants to maximize the total net profit.\n// Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n// Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n// Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company is planning to optimize its production of three types of products: ProductA, ProductB, and ProductC. They need to determine the optimal number of units to produce for each product to maximize profit while considering various constraints. The profit per unit and the production cost per unit for each product, which varies with the number of units produced due to economies of scale, are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| ProductA | $50            | 40 - 0.1*UnitsA         |\n| ProductB | $70            | 50 - 0.1*UnitsB         |\n| ProductC | $90            | 60 - 0.1*UnitsC         |\n\nThe company has a total production capacity of 1000 units for all products combined. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ProductA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ProductB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ProductC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total net profit for ProductA: Profit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\n## Total net profit for ProductB: Profit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\n## Total net profit for ProductC: Profit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\nProfit_A = (50 - (40 - 0.1*UnitsA)) * UnitsA\nProfit_B = (70 - (50 - 0.1*UnitsB)) * UnitsB\nProfit_C = (90 - (60 - 0.1*UnitsC)) * UnitsC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all products combined.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA: \", model.getVal(UnitsA))\n    print(\"Number of ProductB: \", model.getVal(UnitsB))\n    print(\"Number of ProductC: \", model.getVal(UnitsC))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. \nVehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. \nVehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. \nThe company aims to minimize the total cost of maintenance and fuel consumption, considering the total distance traveled by all vehicles is 10000 km.\n// Fuel cost for A: Fuel_A = (10/100) * 10000 * A\n// Fuel cost for B: Fuel_B = (8/100) * 10000 * B\n// Fuel cost for C: Fuel_C = (6/100) * 10000 * C\n// Maintenance cost for A: Maint_A = 5000 * A\n// Maintenance cost for B: Maint_B = 4000 * B\n// Maintenance cost for C: Maint_C = 3000 * C\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n## Generate Constraint-1:\nThe company has a budget of $20000 for vehicle maintenance.\n// 5000 * A + 4000 * B + 3000 * C <= 20000",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost.\nVehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. \nVehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. \nVehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. \nThe total distance traveled by all vehicles is 10000 km. The company has a budget of $20000 for vehicle maintenance.\nPlease help the company to minimize the total cost of maintenance and fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = (10/100) * 10000 * A\nFuel_B = (8/100) * 10000 * B\nFuel_C = (6/100) * 10000 * C\nMaint_A = 5000 * A\nMaint_B = 4000 * B\nMaint_C = 3000 * C\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n# Add constraints\n## The company has a budget of $20000 for vehicle maintenance.\nmodel.addCons(5000 * A + 4000 * B + 3000 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 666,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots.\n// Profit_W1 = 300 * 0.8 * W1\n// Profit_C1 = 400 * 1.2 * C1\n// Profit_B1 = 250 * 0.9 * B1\n// So, the objective function is: Maximize (Profit_W1 + Profit_C1 + Profit_B1)\n\n## Generate Constraint-1:\nThe total area of plot 1 is 50 acres.\n// W1 + C1 + B1 <= 50\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40.\n// 50 * W1 + 70 * C1 + 40 * B1 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat from plot 1 is at least 20 acres.\n// W1 >= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 acres to barley on plot 1.\n// B1 >= 10",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for wheat is $300, for corn is $400, and for barley is $250. The yield per acre varies with the plot and the crop: the yield for wheat is 0.8 times the acres, for corn is 1.2 times the acres, and for barley is 0.9 times the acres. The farmer wants to maximize the total profit from all plots.\n\n| Crop   | Profit per Acre | Yield per Acre | Cost per Acre |\n|--------|-----------------|----------------|---------------|\n| Wheat  | $300            | 0.8 * W1       | $50           |\n| Corn   | $400            | 1.2 * C1       | $70           |\n| Barley | $250            | 0.9 * B1       | $40           |\n\nThe total area of plot 1 is 50 acres. The farmer has a limited budget for seeds and fertilizer of $10,000. The market demand for wheat from plot 1 is at least 20 acres. The farmer must allocate at least 10 acres to barley on plot 1.\n\nPlease help the farmer determine the optimal allocation of acres to each crop on plot 1 to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of corn on plot 1\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=10) # acres of barley on plot 1\n\n# Define objective function\nProfit_W1 = 300 * 0.8 * W1\nProfit_C1 = 400 * 1.2 * C1\nProfit_B1 = 250 * 0.9 * B1\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W1 + Profit_C1 + Profit_B1)\n\n# Add constraints\nmodel.addCons(W1 + C1 + B1 <= 50) # total area of plot 1 is 50 acres\nmodel.addCons(50 * W1 + 70 * C1 + 40 * B1 <= 10000) # limited budget for seeds and fertilizer\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 1: \", model.getVal(C1))\n    print(\"Acres of Barley on Plot 1: \", model.getVal(B1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for the new product\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of skilled workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that the profit per unit of the product is $100, but this increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line. The company estimates that the profit per unit of the product is $100, but this increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product. The company has a budget of $50,000 for advertising. Please help the company determine the optimal production quantity, advertising budget, and number of skilled workers to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget for the new product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of skilled workers\n\n# Define objective function\n## Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 784,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit.\n// {\"number of units of WidgetA\": \"WidgetAUnits\", \"range\": \"WidgetAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetB\": \"WidgetBUnits\", \"range\": \"WidgetBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetC\": \"WidgetCUnits\", \"range\": \"WidgetCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\n// Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\n// Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetBUnits <= 2 * WidgetAUnits",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit. The profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetAUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetAUnits\", lb=0) # number of units of WidgetA\nWidgetBUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetBUnits\", lb=0) # number of units of WidgetB\nWidgetCUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetCUnits\", lb=0) # number of units of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetAUnits == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (50 - 0.1 * WidgetA2) * WidgetA2 * WidgetA_b2 + 50 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=200)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=200, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetBUnits == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (70 - 0.05 * WidgetB2) * WidgetB2 * WidgetB_b2 + 70 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=300)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=300, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetCUnits == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (90 - 0.02 * WidgetC2) * WidgetC2 * WidgetC_b2 + 90 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500)\nmodel.addCons(WidgetBUnits <= 2 * WidgetAUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of WidgetA Units: \", model.getVal(WidgetAUnits))\n    print(\"Number of WidgetB Units: \", model.getVal(WidgetBUnits))\n    print(\"Number of WidgetC Units: \", model.getVal(WidgetCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for Capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Diodes\": \"Dio\", \"range\": \"Dio >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180.\n// Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n// Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $5000 per hour for operating the machines.\n// 100 * Cap + 120 * Res + 110 * Dio <= 5000\n\n## Generate Constraint-2:\nThe total number of machines available is 40.\n// Cap + Res + Dio <= 40\n\n## Generate Constraint-3:\nAt least 1000 units of each component must be produced per hour.\n// 50 * Cap >= 1000\n// 70 * Res >= 1000\n// 60 * Dio >= 1000",
        "question": "A manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type. The production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The manufacturer has a budget of $5000 per hour for operating the machines. The total number of machines available is 40. At least 1000 units of each component must be produced per hour. Please help the manufacturer determine the optimal number of machines for each component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for Capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for Resistors\nDio = model.addVar(vtype=\"INTEGER\", name=\"Dio\", lb=0) # number of machines for Diodes\n\n# Define objective function\n## Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n## Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\nValue = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\nCost = 100 * Cap + 120 * Res + 110 * Dio\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $5000 per hour for operating the machines.\nmodel.addCons(100 * Cap + 120 * Res + 110 * Dio <= 5000)\n## The total number of machines available is 40.\nmodel.addCons(Cap + Res + Dio <= 40)\n## At least 1000 units of each component must be produced per hour.\nmodel.addCons(50 * Cap >= 1000)\nmodel.addCons(70 * Res >= 1000)\nmodel.addCons(60 * Dio >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Diode Machines: \", model.getVal(Dio))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 982,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// B >= 150",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n\nThe company has a total production capacity of 1000 units per week. The market demand for product A is at least 100 units per week, and the market demand for product B is at least 150 units per week.\n\nPlease help the company determine the optimal number of units of products A, B, and C to produce per week to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.015 * C**2\n## the objective function is: Maximize Profit - (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Profit - (Cost_A + Cost_B + Cost_C))\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials.\n// {\"quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, Product B is $150, and Product C is $200. The cost of Material1 per unit of Product A is $20, Material2 per unit of Product B is $30, and Material3 per unit of Product C is $40. The manufacturer wants to maximize the total profit, considering the cost of materials.\n// Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of Material1 available is 1000 units.\n// 20 * ProductA <= 1000",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials. The profit per unit and the cost of materials per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Material per Unit |\n|---------|-----------------|---------------------------|\n| A       | $100            | $20 (Material1)           |\n| B       | $150            | $30 (Material2)           |\n| C       | $200            | $40 (Material3)           |\n\nThe total amount of Material1 available is 1000 units. The manufacturer wants to maximize the total profit, considering the cost of materials. Please help the manufacturer determine the optimal quantities of each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nProfit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of Material1 available is 1000 units.\nmodel.addCons(20 * ProductA <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit.\n// {\"hours for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the production hours. For product A, the profit per hour is 100 - 0.5A (in dollars). For product B, it is 150 - B (in dollars). For product C, it is 200 - 2C (in dollars). The plant manager wants to maximize the total daily profit.\n// The objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 12 hours per day.\n// A + B + C <= 12\n\n## Generate Constraint-2:\nThe production line for product A can operate for a maximum of 5 hours due to equipment limitations.\n// A <= 5\n\n## Generate Constraint-3:\nThe production line for product B can operate for a maximum of 6 hours due to labor constraints.\n// B <= 6",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit. The profit per hour for each product is different and depends on the production hours. For product A, the profit per hour is 100 - 0.5A (in dollars). For product B, it is 150 - B (in dollars). For product C, it is 200 - 2C (in dollars). The plant manager wants to maximize the total daily profit.\n\n| Product | Profit per Hour Formula |\n|---------|-------------------------|\n| A       | 100 - 0.5A (in dollars)|\n| B       | 150 - B (in dollars)    |\n| C       | 200 - 2C (in dollars)   |\n\nThe total operating hours for all production lines cannot exceed 12 hours per day. The production line for product A can operate for a maximum of 5 hours due to equipment limitations. The production line for product B can operate for a maximum of 6 hours due to labor constraints.\n\nPlease help the plant manager determine the optimal number of hours each production line should operate to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hours for product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hours for product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hours for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 0.5 * A) * A\nProfit_B = (150 - B) * B\nProfit_C = (200 - 2 * C) * C\n## the objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total operating hours for all production lines cannot exceed 12 hours per day.\nmodel.addCons(A + B + C <= 12)\n## The production line for product A can operate for a maximum of 5 hours due to equipment limitations.\nmodel.addCons(A <= 5)\n## The production line for product B can operate for a maximum of 6 hours due to labor constraints.\nmodel.addCons(B <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for product A: \", model.getVal(A))\n    print(\"Hours for product B: \", model.getVal(B))\n    print(\"Hours for product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\n// {\"temperature setting for greenhouse A\": \"T_A\", \"range\": \"0 <= T_A <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse B\": \"T_B\", \"range\": \"0 <= T_B <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse C\": \"T_C\", \"range\": \"0 <= T_C <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n// Yield of greenhouse A: Yield_A = (T_A^2 / 100) - (T_A - 50)^2\n// Yield of greenhouse B: Yield_B = (T_B^2 / 100) - (T_B - 70)^2\n// Yield of greenhouse C: Yield_C = (T_C^2 / 100) - (T_C - 60)^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\n\n## Generate Constraint-1:\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2.\n// T_A^2 + T_B^2 + T_C^2 <= 150\n\n## Generate Constraint-2:\nThe temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\n// T_A >= T_B + 10\n\n## Generate Constraint-3:\nThe temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\n// T_C <= T_A + 20",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2. The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B. The temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\nPlease help the farm to determine the optimal temperature settings for each greenhouse (T_A, T_B, T_C) within the range of 0 to 100 degrees to maximize the total yield from all greenhouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0, ub=100) # temperature setting for greenhouse A\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0, ub=100) # temperature setting for greenhouse B\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0, ub=100) # temperature setting for greenhouse C\n\n# Define objective function\nYield_A = (T_A**2 / 100) - (T_A - 50)**2\nYield_B = (T_B**2 / 100) - (T_B - 70)**2\nYield_C = (T_C**2 / 100) - (T_C - 60)**2\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n# The total energy consumption for all greenhouses must not exceed 150 energy units.\nmodel.addCons(T_A**2 + T_B**2 + T_C**2 <= 150)\n# The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\nmodel.addCons(T_A >= T_B + 10)\n# The temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\nmodel.addCons(T_C <= T_A + 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Temperature Setting for Greenhouse A: \", model.getVal(T_A))\n    print(\"Temperature Setting for Greenhouse B: \", model.getVal(T_B))\n    print(\"Temperature Setting for Greenhouse C: \", model.getVal(T_C))\n    print(\"Maximized Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// P_A <= 40",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. The efficiency rates and the value per unit of each product are given in the following Table.\n\n| Production Line | Units Produced per Hour | Value per Unit |\n|-----------------|-------------------------|----------------|\n| A               | 10                      | $5             |\n| B               | 15                      | $7             |\n| C               | 20                      | $9             |\n\nThe plant aims to maximize the total production value. The total operating hours for all production lines must not exceed 100 hours per week. Additionally, the production line A can operate for a maximum of 40 hours per week. Please help the plant manager determine the optimal number of hours for each production line to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\n## The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == V)\n\n# Add constraints\n## The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P_A + P_B + P_C <= 100)\n## The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(P_A <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. \nEach unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. \nEach unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit.\nThe plant aims to maximize the profit per unit of labor used.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 7 * B\n// Profit from C: Profit_C = 9 * C\n// Total labor used: Labor = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for raw materials.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily limit of 150 hours of labor.\n// 2 * A + 3 * B + 4 * C <= 150",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency. Each unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. Each unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. Each unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit. The plant aims to maximize the profit per unit of labor used. The plant has a daily budget of $1000 for raw materials. The plant also has a daily limit of 150 hours of labor. Please help the plant to determine the optimal number of each component to produce daily to maximize the profit per unit of labor used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nLabor = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily budget of $1000 for raw materials.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n## The plant has a daily limit of 150 hours of labor.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"0 <= P2 <= 150\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"0 <= P3 <= 200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 yields a profit of $50, $70, and $90 respectively. However, the profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation. The profit function for each product is given by: Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit.\n// Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\n\n## Generate Constraint-1:\nThe total daily production capacity of the line is 300 units.\n// P1 + P2 + P3 <= 300\n\n## Generate Constraint-2:\nThe production of product 1 requires a specific raw material that is limited to 120 units per day.\n// P1 <= 120\n\n## Generate Constraint-3:\nThe market demand for product 3 should not exceed 180 units per day to maintain product exclusivity.\n// P3 <= 180",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand. Each unit of product 1, 2, and 3 yields a profit of $50, $70, and $90 respectively, but the profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation. The profit function for each product is given by: Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit. The total daily production capacity of the line is 300 units. The production of product 1 requires a specific raw material that is limited to 120 units per day. The market demand for product 3 should not exceed 180 units per day to maintain product exclusivity. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=150) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=200) # production quantity of product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\nmodel.addCons(obj == (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90)\n\n# Add constraints\n## The total daily production capacity of the line is 300 units.\nmodel.addCons(P1 + P2 + P3 <= 300)\n## The production of product 1 requires a specific raw material that is limited to 120 units per day.\nmodel.addCons(P1 <= 120)\n## The market demand for product 3 should not exceed 180 units per day to maintain product exclusivity.\nmodel.addCons(P3 <= 180)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost.\n// Revenue from product A: RA = 10 * WA * PriceA\n// Revenue from product B: RB = 15 * WB * PriceB\n// Revenue from product C: RC = 20 * WC * PriceC\n// Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n// So, the objective function is: Maximize (RA + RB + RC - PC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nThe demand for product A is at least 500 units per day.\n// 10 * WA >= 500\n\n## Generate Constraint-3:\nThe demand for product B is at least 750 units per day.\n// 15 * WB >= 750",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost. The manufacturer has a total of 50 workers available. The demand for product A is at least 500 units per day, and the demand for product B is at least 750 units per day.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Revenue from product A: RA = 10 * WA * PriceA\n## Revenue from product B: RB = 15 * WB * PriceB\n## Revenue from product C: RC = 20 * WC * PriceC\n## Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n## So, the objective function is: Maximize (RA + RB + RC - PC)\nRA = 10 * WA\nRB = 15 * WB\nRC = 20 * WC\nPC = 5 * RA + 8 * RB + 10 * RC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RA + RB + RC - PC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## The demand for product A is at least 500 units per day.\nmodel.addCons(10 * WA >= 500)\n## The demand for product B is at least 750 units per day.\nmodel.addCons(15 * WB >= 750)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 721,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit.\n// {\"production time for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production time for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production time for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The plant aims to maximize the total daily profit.\n// The profit from product 1: R1 = 50 * 10 * P1\n// The profit from product 2: R2 = 70 * 15 * P2\n// The profit from product 3: R3 = 60 * 12 * P3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production time available in a day is 24 hours.\n// P1 + P2 + P3 <= 24\n\n## Generate Constraint-2:\nThe production line requires a minimum setup time of 2 hours for each product type.\n// P1 >= 2; P2 >= 2; P3 >= 2\n\n## Generate Constraint-3:\nDue to market demand, the production of product 1 must not exceed 8 hours, and product 3 must not exceed 10 hours.\n// P1 <= 8; P3 <= 10",
        "question": "A manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit. The profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The total production time available in a day is 24 hours. The production line requires a minimum setup time of 2 hours for each product type. Due to market demand, the production of product 1 must not exceed 8 hours, and product 3 must not exceed 10 hours. Please help the plant manager to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=2, ub=8) # production time for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=2) # production time for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=2, ub=10) # production time for product 3\n\n# Define objective function\nR1 = 50 * 10 * P1 # profit from product 1\nR2 = 70 * 15 * P2 # profit from product 2\nR3 = 60 * 12 * P3 # profit from product 3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3) # objective function: Maximize (R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 24) # total production time available in a day is 24 hours\nmodel.addCons(P1 >= 2) # minimum setup time for product 1\nmodel.addCons(P2 >= 2) # minimum setup time for product 2\nmodel.addCons(P3 >= 2) # minimum setup time for product 3\nmodel.addCons(P1 <= 8) # production of product 1 must not exceed 8 hours\nmodel.addCons(P3 <= 10) # production of product 3 must not exceed 10 hours\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Time for Product 1: \", model.getVal(P1))\n    print(\"Production Time for Product 2: \", model.getVal(P2))\n    print(\"Production Time for Product 3: \", model.getVal(P3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 712,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000\n\n## Generate Constraint-2:\nThe company must produce at least 200 units in total to meet the minimum order requirements from distributors.\n// A + B + C >= 200\n\n## Generate Constraint-3:\nThe production capacity for product A is limited to 300 units due to equipment limitations.\n// A <= 300\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product C as product A.\n// C >= 2 * A\n\n## Generate Constraint-5:\nThe company cannot produce more than 50% of the total units in product B.\n// B <= 0.5 * (A + B + C)",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. Product A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature. Product B has a unit profit of $70, with a storage cost of $5 per unit. Product C has a unit profit of $60, with no storage cost. The company wants to maximize its net profit, which is the total profit minus the total storage cost.\n\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively. The company must produce at least 200 units in total to meet the minimum order requirements from distributors. The production capacity for product A is limited to 300 units due to equipment limitations. The company aims to produce at least twice as many units of product C as product A. The company cannot produce more than 50% of the total units in product B.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Cost = 10 * A + 5 * B\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n## The company must produce at least 200 units in total to meet the minimum order requirements from distributors.\nmodel.addCons(A + B + C >= 200)\n## The production capacity for product A is limited to 300 units due to equipment limitations.\nmodel.addCons(A <= 300)\n## The company aims to produce at least twice as many units of product C as product A.\nmodel.addCons(C >= 2 * A)\n## The company cannot produce more than 50% of the total units in product B.\nmodel.addCons(B <= 0.5 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $5 per unit, Product B has a profit margin of $10 per unit, and Product C has a profit margin of $15 per unit. The production of each product requires a different amount of energy: Product A requires 2 units of energy, Product B requires 3 units of energy, and Product C requires 4 units of energy. The plant aims to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 10 * B\n// Profit from C: Profit_C = 15 * C\n// Total energy consumption: Energy = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit.\n// 3 * A + 6 * B + 9 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily production capacity of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe plant aims to produce at least 50 units of each product to meet market demand.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit. The profit margin and energy consumption for each product are given in the following Table.\n\n| Product | Profit Margin per Unit | Energy Consumption per Unit |\n|---------|------------------------|-----------------------------|\n| A       | $5                     | 2 units                     |\n| B       | $10                    | 3 units                     |\n| C       | $15                    | 4 units                     |\n\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit. The plant has a daily production capacity of 200 units across all products. The plant aims to produce at least 50 units of each product to meet market demand. \n\nPlease help the plant to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant aims to produce at least 50 units of each product to meet market demand.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10 * B\nProfit_C = 15 * C\nEnergy = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $1000 for raw materials.\nmodel.addCons(3 * A + 6 * B + 9 * C <= 1000)\n## The plant has a daily production capacity of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1113,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantities of three different products, the investment in new machinery, and the marketing budget for each product.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Prod3\", \"range\": \"Prod3 >= 0\", \"type\": \"integer\"}\n// {\"investment in new machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for each product\": \"Marketing\", \"range\": \"Marketing >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production for each product decreases by $5 for every $10,000 invested in new machinery. The initial production cost per unit for each product is $100. The revenue generated per unit is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $100,000 for investment in new machinery and marketing.\n// Machinery + Marketing <= 100000\n\n## Generate Constraint-2:\nThe total production quantity of all products must not exceed 2000 units.\n// Prod1 + Prod2 + Prod3 <= 2000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production quantities of three different products, the investment in new machinery, and the marketing budget for each product. The company aims to maximize the total profit from all products. The cost of production for each product decreases by $5 for every $10,000 invested in new machinery, with an initial production cost per unit of $100 and a revenue per unit of $150.\n\nThe company has a total budget of $100,000 for investment in new machinery and marketing. The total production quantity of all products must not exceed 2000 units.\n\nPlease help the company determine the optimal production quantities for each product, the investment in new machinery, and the marketing budget to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=0) # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0) # production quantity of Product 2\nProd3 = model.addVar(vtype=\"INTEGER\", name=\"Prod3\", lb=0) # production quantity of Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in new machinery\nMarketing = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing\", lb=0) # marketing budget for each product\n\n# Define objective function\n## Total profit for the products: Profit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\nProfit = (150 - 100 + 0.0005 * Machinery) * (Prod1 + Prod2 + Prod3) - Marketing\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total budget of $100,000 for investment in new machinery and marketing.\nmodel.addCons(Machinery + Marketing <= 100000)\n## The total production quantity of all products must not exceed 2000 units.\nmodel.addCons(Prod1 + Prod2 + Prod3 <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Prod3))\n    print(\"Investment in New Machinery: \", model.getVal(Machinery))\n    print(\"Marketing Budget: \", model.getVal(Marketing))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 5,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit and the cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $50             | $20           |\n| B       | $70             | $30           |\n| C       | $60             | $25           |\n\nThe company has a limited budget of $15,000 for production costs. Please help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 645,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 500 units across all products.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of Product A to meet contractual obligations.\n// A >= 100",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25. The company has a maximum storage capacity of 500 units across all products. The company must produce at least 100 units of Product A to meet contractual obligations. Please help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\nmodel.addCons(obj == 50 * A + 70 * B + 60 * C)\n\n# Add constraints\n## The company has a limited budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n## The company has a maximum storage capacity of 500 units across all products.\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50\n\n## Generate Constraint-2:\nDue to operational requirements, CargoB must have at least half as many trucks as CargoA.\n// CargoBTrucks >= 0.5 * CargoATrucks",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The earnings, fuel cost, and maintenance cost per truck for each cargo type are given in the following Table.\n\n| Cargo Type | Earnings per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|--------------------|---------------------|----------------------------|\n| CargoA     | $5,000             | $1,000              | $500                       |\n| CargoB     | $7,000             | $1,500              | $700                       |\n| CargoC     | $10,000            | $2,000              | $1,000                     |\n\nThe company has a total of 50 trucks available for allocation. Due to operational requirements, CargoB must have at least half as many trucks as CargoA. The company aims to maximize the total net profit from all cargo types.\n\nPlease help the company determine the optimal number of trucks to allocate for each cargo type to maximize their total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=0) # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=0) # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=0) # number of trucks for CargoC\n\n# Define objective function\n## Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n## Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n## Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n## So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\n## Due to operational requirements, CargoB must have at least half as many trucks as CargoA.\nmodel.addCons(CargoBTrucks >= 0.5 * CargoATrucks)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1096,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $10,000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-3:\nThe farm has a total land capacity of 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-4:\nThe market demand for Crop A is 10 hectares. So, the farm can only sell a maximum of 10 hectares of Crop A.\n// A <= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. For Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. For Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400. The farm has a limited water supply of 500,000 liters and a budget of $10,000 for fertilizer costs. The farm has a total land capacity of 100 hectares. The market demand for Crop A is 10 hectares. The farm aims to maximize the profit efficiency (profit per liter of water used). Please help the farm determine the optimal allocation of hectares to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=10) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $10,000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farm has a total land capacity of 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 878,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The objective is to maximize the total production while meeting these thresholds.\n// Total production of component A: PA = 10 * WA\n// Total production of component B: PB = 15 * WB\n// Total production of component C: PC = 20 * WC\n// Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 25 workers.\n// WA <= 25; WB <= 25; WC <= 25\n\n## Generate Constraint-3:\nThe production of component A must be at least 500 units.\n// PA >= 500",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line. The production rate for component A is 10 units per worker per hour, for component B is 15 units per worker per hour, and for component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units.\n\n| Component | Production Rate per Worker per Hour |\n|-----------|-------------------------------------|\n| A         | 10                                  |\n| B         | 15                                  |\n| C         | 20                                  |\n\nThe total number of workers available is 50. Each production line can handle a maximum of 25 workers. The production of component A must be at least 500 units.\n\nPlease help the manufacturer to maximize the total production of components A, B, and C while meeting the specified thresholds and constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## Total production of component A: PA = 10 * WA\n## Total production of component B: PB = 15 * WB\n## Total production of component C: PC = 20 * WC\n## Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\nPA = 10 * WA\nPB = 15 * WB\nPC = 20 * WC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total number of workers available is 50.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can handle a maximum of 25 workers.\nmodel.addCons(WA <= 25)\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\n## The production of component A must be at least 500 units.\nmodel.addCons(PA >= 500)\n## The production of component B must be at least 750 units.\nmodel.addCons(PB >= 750)\n## The production of component C must be at least 1000 units.\nmodel.addCons(PC >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n// The production time for component A: TA = 800 / (10 * WA)\n// The production time for component B: TB = 1200 / (15 * WB)\n// The production time for component C: TC = 1600 / (20 * WC)\n// So, the objective function is: Minimize max(TA, TB, TC)\n\n## Generate Constraint-1:\nThere are a total of 50 skilled workers available.\n// WA + WB + WC <= 50",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line. The production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n\n| Component | Production Rate per Worker (units/hour) |\n|-----------|-----------------------------------------|\n| A         | 10                                      |\n| B         | 15                                      |\n| C         | 20                                      |\n\nThere are a total of 50 skilled workers available. Please help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum production time required to meet the weekly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTA = 800 / (10 * WA)\nTB = 1200 / (15 * WB)\nTC = 1600 / (20 * WC)\n## the objective function is: Minimize max(TA, TB, TC)\n## convert the division to multiplication\nmodel.addCons(obj >= TA)\nmodel.addCons(obj >= TB)\nmodel.addCons(obj >= TC)\n\n# Add constraints\n## There are a total of 50 skilled workers available.\nmodel.addCons(WA + WB + WC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1175,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n// 5 * A + 8 * B + 10 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin. The profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products. The profit margins for each product are as follows:\n\n| Product | Profit Margin per Unit |\n|---------|-------------------------|\n| A       | $10 + 0.02 * (A - 500) / 100 |\n| B       | $15 + 0.02 * (B - 500) / 100 |\n| C       | $20 + 0.02 * (C - 500) / 100 |\n\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n\nPlease help the company determine the optimal number of units of each product to produce in order to maximize the total profit, given the constraint on raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=500)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=500, ub=10000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 500) / 100) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=500, ub=10000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 500) / 100) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=500)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=500, ub=10000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 500) / 100) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cakes, the selling price is $30, the cost of ingredients is $10, and the baking time is 1.5 hours. \nFor Vanilla cakes, the selling price is $25, the cost of ingredients is $8, and the baking time is 1 hour. \nFor Strawberry cakes, the selling price is $28, the cost of ingredients is $9, and the baking time is 1.2 hours.\nThe bakery has only one oven and can bake one type of cake at a time. The bakery aims to maximize the profit efficiency (profit per hour of baking time).\n// Profit_Chocolate = (30 - 10) * C\n// Profit_Vanilla = (25 - 8) * V\n// Profit_Strawberry = (28 - 9) * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 1.2 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited baking time of 80 hours.\n// 1.5 * C + 1 * V + 1.2 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredients.\n// 10 * C + 8 * V + 9 * S <= 1500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 100 cakes in total.\n// C + V + S <= 100\n\n## Generate Constraint-4:\nThe demand for Chocolate cakes is at most 40 cakes.\n// C <= 40",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event. The selling price, cost of ingredients, and baking time for each cake are given in the following Table.\n\n| Cake Type | Selling Price | Cost of Ingredients | Baking Time |\n|-----------|---------------|---------------------|-------------|\n| Chocolate | $30           | $10                 | 1.5 hours   |\n| Vanilla   | $25           | $8                  | 1 hour      |\n| Strawberry| $28           | $9                  | 1.2 hours   |\n\nThe bakery has a limited baking time of 80 hours. The bakery has a budget of $1500 for ingredients. The bakery has a storage capacity of 100 cakes in total. The demand for Chocolate cakes is at most 40 cakes. The bakery has only one oven and can bake one type of cake at a time. \nPlease help the bakery to maximize the profit efficiency (profit per hour of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=40) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (30 - 10) * C\nProfit_Vanilla = (25 - 8) * V\nProfit_Strawberry = (28 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 1.2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited baking time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 1.2 * S <= 80)\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(10 * C + 8 * V + 9 * S <= 1500)\n## The bakery has a storage capacity of 100 cakes in total.\nmodel.addCons(C + V + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate cakes: \", model.getVal(C))\n    print(\"Number of Vanilla cakes: \", model.getVal(V))\n    print(\"Number of Strawberry cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n// Total operational cost for WarehouseA: Cost_A = TrucksA * (50)^2\n// Total operational cost for WarehouseB: Cost_B = TrucksB * (70)^2\n// Total operational cost for WarehouseC: Cost_C = TrucksC * (60)^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, WarehouseA must have at least 20% of the total trucks.\n// TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC)\n\n## Generate Constraint-3:\nTo maintain service levels, each warehouse must have at least 5 trucks.\n// TrucksA >= 5; TrucksB >= 5; TrucksC >= 5",
        "question": "A logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations. The company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC. The company has a total of 50 trucks available for allocation. Due to contractual agreements, WarehouseA must have at least 20% of the total trucks. To maintain service levels, each warehouse must have at least 5 trucks.\nPlease help the company to minimize the total operational cost (Cost_A + Cost_B + Cost_C).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=5)  # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=5)  # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=5)  # number of trucks for WarehouseC\n\n# Define objective function\nCost_A = TrucksA * (50 ** 2)\nCost_B = TrucksB * (70 ** 2)\nCost_C = TrucksC * (60 ** 2)\n# So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n# Due to contractual agreements, WarehouseA must have at least 20% of the total trucks.\nmodel.addCons(TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from selling the crops. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. However, the yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer wants to maximize the total profit, which is the product of the profit per acre and the yield per acre.\n// Profit from wheat: Profit_W = 500 * 0.8 * W1\n// Profit from corn: Profit_C = 700 * 0.9 * C2\n// Profit from barley: Profit_B = 600 * 0.75 * B3\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total available land for all three plots is 100 acres.\n// W1 + C2 + B3 <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat and 15 acres to barley.\n// W1 >= 20; B3 >= 15\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres.\n// C2 <= (W1 + B3) + 10",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. However, the yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer aims to maximize his total profit from selling the crops, which is the product of the profit per acre and the yield per acre. The total available land for all three plots is 100 acres. The farmer must allocate at least 20 acres to wheat and 15 acres to barley. The farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres. Please help the farmer to maximize his total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of corn on plot 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=15) # acres of barley on plot 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 500 * 0.8 * W1\nProfit_C = 700 * 0.9 * C2\nProfit_B = 600 * 0.75 * B3\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total available land for all three plots is 100 acres.\nmodel.addCons(W1 + C2 + B3 <= 100)\n## The farmer must allocate at least 20 acres to wheat and 15 acres to barley.\nmodel.addCons(W1 >= 20)\nmodel.addCons(B3 >= 15)\n## The farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres.\nmodel.addCons(C2 <= (W1 + B3) + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 2: \", model.getVal(C2))\n    print(\"Acres of Barley on Plot 3: \", model.getVal(B3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly as more acres are planted. Specifically, the profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops.\n// Profit_W = (100 - 0.001 * (W - 50) * W) * W\n// Profit_C = (150 - 0.001 * (C - 50) * C) * C\n// Profit_S = (120 - 0.001 * (S - 50) * S) * S\n// So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Generate Constraint-1:\nThe farm has a total of 200 acres available for planting.\n// W + C + S <= 200\n\n## Generate Constraint-2:\nThe farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health.\n// W >= 30; C >= 30; S >= 30\n\n## Generate Constraint-3:\nDue to water availability, the total acres of Corn and Soybeans must not exceed 120 acres.\n// C + S <= 120\n\n## Generate Constraint-4:\nThe farm has a budget constraint for seed and fertilizer. The cost per acre for Wheat is $20, for Corn is $30, and for Soybeans is $25. The total budget for seed and fertilizer is $5000.\n// 20 * W + 30 * C + 25 * S <= 5000",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly as more acres are planted. Specifically, the profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops. The farm has a total of 200 acres available for planting. The farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health. Due to water availability, the total acres of Corn and Soybeans must not exceed 120 acres. The farm has a budget constraint for seed and fertilizer. The cost per acre for Wheat is $20, for Corn is $30, and for Soybeans is $25. The total budget for seed and fertilizer is $5000. Please help the farm to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=30) # acres of Wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=30) # acres of Corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=30) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_W = (100 - 0.001 * (W - 50) * W) * W\n## Profit_C = (150 - 0.001 * (C - 50) * C) * C\n## Profit_S = (120 - 0.001 * (S - 50) * S) * S\n## So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\nProfit_W = (100 - 0.001 * (W - 50) * W) * W\nProfit_C = (150 - 0.001 * (C - 50) * C) * C\nProfit_S = (120 - 0.001 * (S - 50) * S) * S\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farm has a total of 200 acres available for planting.\nmodel.addCons(W + C + S <= 200)\n## Due to water availability, the total acres of Corn and Soybeans must not exceed 120 acres.\nmodel.addCons(C + S <= 120)\n## The farm has a budget constraint for seed and fertilizer. The cost per acre for Wheat is $20, for Corn is $30, and for Soybeans is $25. The total budget for seed and fertilizer is $5000.\nmodel.addCons(20 * W + 30 * C + 25 * S <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Soil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + 50)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion. The profit per acre and the soil nitrogen depletion per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Soil Nitrogen Depletion per Acre |\n|------|-----------------|----------------------------------|\n| A    | $100            | 2 units                          |\n| B    | $150            | 3 units                          |\n| C    | $200            | 4 units                          |\n\nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units. The farmer has a total of 100 acres available for cultivation. Please help the farmer to maximize his total profit while considering the soil's nutrient depletion.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nSoil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Soil_Nitrogen_Depletion + 50)\n## convert the division to multiplication\nmodel.addCons(obj * (Soil_Nitrogen_Depletion + 50) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand.\n// {\"number of machines for component A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands.\n// The operating hours for component A: HA = 500 / (10 * MA)\n// The operating hours for component B: HB = 600 / (12 * MB)\n// The operating hours for component C: HC = 750 / (15 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available in the plant.\n// MA + MB + MC <= 20",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand. Each machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands. There are a total of 20 machines available in the plant. Please help the plant manager to determine the optimal allocation of machines to minimize the maximum operating hours required for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for component A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for component B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 500 / (10 * MA)\nHB = 600 / (12 * MB)\nHC = 750 / (15 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 500)\nmodel.addCons(HB * (12 * MB) == 600)\nmodel.addCons(HC * (15 * MC) == 750)\n## the objective function is: Minimize max(HA, HB, HC)\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## There are a total of 20 machines available in the plant.\nmodel.addCons(MA + MB + MC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(MA))\n    print(\"Number of Machines for Component B: \", model.getVal(MB))\n    print(\"Number of Machines for Component C: \", model.getVal(MC))\n    print(\"Minimized Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 786,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, component B is $40, and component C is $50. The production cost per unit of component A is $10, component B is $20, and component C is $30. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost.\n// Revenue from A: Revenue_A = 30 * A\n// Revenue from B: Revenue_B = 40 * B\n// Revenue from C: Revenue_C = 50 * C\n// Cost of A: Cost_A = 10 * A\n// Cost of B: Cost_B = 20 * B\n// Cost of C: Cost_C = 30 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of component A requires 2 hours, component B requires 3 hours, and component C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize its profit while considering the production capacity and market demand. The profit per unit of component A is $30, component B is $40, and component C is $50. The production cost per unit of component A is $10, component B is $20, and component C is $30. The company aims to maximize its total profit, which is the difference between the total revenue and the total cost. The company has a limited production capacity of 1000 hours per week. Producing one unit of component A requires 2 hours, component B requires 3 hours, and component C requires 4 hours. Please help the company to determine the optimal number of units of each component to produce to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 30 * A\nRevenue_B = 40 * B\nRevenue_C = 50 * C\nCost_A = 10 * A\nCost_B = 20 * B\nCost_C = 30 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The cost of fertilization per acre for wheat is $50, for corn is $70, and for soybeans is $60. The farmer aims to maximize the net profit per unit of fertilization cost (which is defined as the sum of the profits minus the sum of the fertilization costs divided by the sum of the fertilization costs).\n// Profit of wheat: Profit_W = (200 - 50) * W\n// Profit of corn: Profit_C = (300 - 70) * C\n// Profit of soybeans: Profit_S = (250 - 60) * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (50 * W + 70 * C + 60 * S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage. The profit per acre and the cost of fertilization per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Fertilization Cost per Acre |\n|----------|-----------------|-----------------------------|\n| Wheat    | $200            | $50                         |\n| Corn     | $300            | $70                         |\n| Soybeans | $250            | $60                         |\n\nThe farmer aims to maximize the net profit per unit of fertilization cost (which is defined as the sum of the profits minus the sum of the fertilization costs divided by the sum of the fertilization costs). The farmer has a total of 100 acres available for planting. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (250 - 60) * S\nFertilizationCost = 50 * W + 70 * C + 60 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / FertilizationCost\n## convert the division to multiplication\nmodel.addCons(obj * FertilizationCost == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Fertilization Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor, machinery, and raw materials) to maximize profit.\n// {\"labor allocation for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"machinery allocation for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"raw materials allocation for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product depends on the allocated resources. Product 1 generates a profit of 10L1 + 5M1 - 2R1 per unit. The company aims to maximize the total profit from Product 1.\n// The objective function is: Maximize P1 = 10L1 + 5M1 - 2R1\n\n## Generate Constraint-1:\nThe total labor available is 100 hours.\n// L1 <= 100\n\n## Generate Constraint-2:\nThe total machinery available is 50 units.\n// M1 <= 50\n\n## Generate Constraint-3:\nThe total raw materials available is 200 units.\n// R1 <= 200",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor, machinery, and raw materials) to maximize profit. Product 1 generates a profit of 10L1 + 5M1 - 2R1 per unit, where L1 is the labor allocation, M1 is the machinery allocation, and R1 is the raw materials allocation for Product 1. The company aims to maximize the total profit from Product 1. The total labor available is 100 hours, the total machinery available is 50 units, and the total raw materials available is 200 units. Please help the company determine the optimal allocation of labor, machinery, and raw materials for Product 1 to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0) # labor allocation for product 1\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # machinery allocation for product 1\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0) # raw materials allocation for product 1\n\n# Define objective function\nP1 = 10 * L1 + 5 * M1 - 2 * R1\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1)\n\n# Add constraints\nmodel.addCons(L1 <= 100) # total labor available is 100 hours\nmodel.addCons(M1 <= 50) # total machinery available is 50 units\nmodel.addCons(R1 <= 200) # total raw materials available is 200 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Allocation for Product 1: \", model.getVal(L1))\n    print(\"Machinery Allocation for Product 1: \", model.getVal(M1))\n    print(\"Raw Materials Allocation for Product 1: \", model.getVal(R1))\n    print(\"Maximized Profit for Product 1: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space.\n// {\"number of solar panels in region 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000.\n// Total energy production: Energy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\n// Total investment cost: Cost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n// The objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe total investment cost must not exceed $100,000.\n// 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70.\n// S1 + W1 <= 50; S2 + W2 <= 60; S3 + W3 <= 70\n\n## Generate Constraint-3:\nThe company must install at least 10 solar panels and 5 wind turbines across all regions.\n// S1 + S2 + S3 >= 10; W1 + W2 + W3 >= 5",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space. The energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000. The total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70. The company must install at least 10 solar panels and 5 wind turbines across all regions. Please help the company to maximize the total energy production while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels in region 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines in region 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels in region 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines in region 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels in region 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines in region 3\n\n# Define objective function\nEnergy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\nCost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n# The objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The total investment cost must not exceed $100,000.\nmodel.addCons(1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000)\n# The total area available for installation in each region is limited.\nmodel.addCons(S1 + W1 <= 50)\nmodel.addCons(S2 + W2 <= 60)\nmodel.addCons(S3 + W3 <= 70)\n# The company must install at least 10 solar panels and 5 wind turbines across all regions.\nmodel.addCons(S1 + S2 + S3 >= 10)\nmodel.addCons(W1 + W2 + W3 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines in Region 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels in Region 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines in Region 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels in Region 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines in Region 3: \", model.getVal(W3))\n    print(\"Maximized Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production.\n// Impact_E = 1000 * E / 20000\n// Impact_H = 500 * H / 15000\n// Impact_Hy = 800 * Hy / 25000\n// So, the objective function is: Maximize (Impact_E + Impact_H + Impact_Hy)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E + 15000 * H + 25000 * Hy <= 1000000\n\n## Generate Constraint-2:\nThe production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units.\n// E <= 50; H <= 75; Hy <= 40\n\n## Generate Constraint-3:\nThe market demand for each type of vehicle is also limited. The demand for Electric vehicles is at least 30 units, for Hybrid vehicles is at least 50 units, and for Hydrogen vehicles is at least 20 units.\n// E >= 30; H >= 50; Hy >= 20",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand. The environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit, and the production cost per unit for each type is given in the following Table.\n\n| Vehicle Type | CO2e Saved per Unit | Production Cost per Unit |\n|--------------|---------------------|--------------------------|\n| Electric     | 1000 kg             | $20,000                  |\n| Hybrid       | 500 kg              | $15,000                  |\n| Hydrogen     | 800 kg              | $25,000                  |\n\nThe manufacturer has a total production budget of $1,000,000. The production capacity for each type of vehicle is limited: the maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units. The market demand for each type of vehicle is also limited: the demand for Electric vehicles is at least 30 units, for Hybrid vehicles is at least 50 units, and for Hydrogen vehicles is at least 20 units.\n\nPlease help the manufacturer to maximize the total environmental impact per dollar spent on production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=30, ub=50) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=50, ub=75) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=20, ub=40) # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_E = 1000 * E / 20000\nImpact_H = 500 * H / 15000\nImpact_Hy = 800 * Hy / 25000\n## convert the division to multiplication\nmodel.addCons(obj * (20000 * E + 15000 * H + 25000 * Hy) == 1000 * E + 500 * H + 800 * Hy)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E + 15000 * H + 25000 * Hy <= 1000000)\n## The production capacity for each type of vehicle is limited.\nmodel.addCons(E <= 50)\nmodel.addCons(H <= 75)\nmodel.addCons(Hy <= 40)\n## The market demand for each type of vehicle is also limited.\nmodel.addCons(E >= 30)\nmodel.addCons(H >= 50)\nmodel.addCons(Hy >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1385,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints.\n// {\"production rate of ChemX\": \"ChemXRate\", \"range\": \"ChemXRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemY\": \"ChemYRate\", \"range\": \"ChemYRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemZ\": \"ChemZRate\", \"range\": \"ChemZRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, ChemY is $150, and ChemZ is $200. The production cost per unit of ChemX is $50, ChemY is $70, and ChemZ is $100. The company wants to maximize the total profit.\n// Profit_ChemX = (100 - 50) * ChemXRate\n// Profit_ChemY = (150 - 70) * ChemYRate\n// Profit_ChemZ = (200 - 100) * ChemZRate\n// So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per hour.\n// ChemXRate + ChemYRate + ChemZRate <= 100\n\n## Generate Constraint-2:\nDue to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\n// ChemYRate <= 2 * ChemXRate\n\n## Generate Constraint-3:\nThe company has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units.\n// ChemXRate + ChemZRate <= 120",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints. The profit per unit of ChemX is $100, ChemY is $150, and ChemZ is $200. The production cost per unit of ChemX is $50, ChemY is $70, and ChemZ is $100. The company wants to maximize the total profit. The total production capacity of the company is limited to 100 units per hour. Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX. The company also has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units. Please help the company determine the optimal production rates for ChemX, ChemY, and ChemZ.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemXRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemXRate\", lb=0) # production rate of ChemX\nChemYRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemYRate\", lb=0) # production rate of ChemY\nChemZRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemZRate\", lb=0) # production rate of ChemZ\n\n# Define objective function\nProfit_ChemX = (100 - 50) * ChemXRate\nProfit_ChemY = (150 - 70) * ChemYRate\nProfit_ChemZ = (200 - 100) * ChemZRate\n# So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per hour.\nmodel.addCons(ChemXRate + ChemYRate + ChemZRate <= 100)\n# Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\nmodel.addCons(ChemYRate <= 2 * ChemXRate)\n# The company has a storage constraint that limits the combined storage of ChemX and ChemZ to 120 units.\nmodel.addCons(ChemXRate + ChemZRate <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemX: \", model.getVal(ChemXRate))\n    print(\"Production Rate of ChemY: \", model.getVal(ChemYRate))\n    print(\"Production Rate of ChemZ: \", model.getVal(ChemZRate))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\n// Prod1 <= 1000; Prod2 <= 800\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements.\n// Prod1 >= 200; Prod2 >= 150\n\n## Generate Constraint-4:\nThe total production quantity of both products must not exceed 1200 units.\n// Prod1 + Prod2 <= 1200",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n\n| Product | Cost per Unit | Selling Price | Automation Cost Reduction |\n|---------|---------------|---------------|---------------------------|\n| 1       | $100          | $200          | $5 per $10,000            |\n| 2       | $150          | $250          | $10 per $10,000           |\n\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2. The total investment in automation cannot exceed $50,000. The company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements. The total production quantity of both products must not exceed 1200 units.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=200, ub=1000)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=150, ub=800)  # production quantity of Product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Prod1 + Prod2 <= 1200)  # total production quantity constraint\nmodel.addCons(Automation <= 50000)  # investment in automation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1345,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit.\n// {\"number of MachineA\": \"MachineATeams\", \"range\": \"MachineATeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineB\": \"MachineBTeams\", \"range\": \"MachineBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of MachineC\": \"MachineCTeams\", \"range\": \"MachineCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each MachineB produced. The profit per unit for MachineB is $800, but it decreases by $20 for each MachineA produced. The profit per unit for MachineC is $1000, but it decreases by $15 for each MachineA and MachineB produced. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\n// Total profit for MachineB: Profit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\n// Total profit for MachineC: Profit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 machines.\n// MachineATeams + MachineBTeams + MachineCTeams <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\n// MachineCTeams <= MachineATeams + MachineBTeams",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the number of each type of machine to produce to optimize their profit. The profit per unit for each machine is affected by the production of other machines as follows:\n\n| Machine | Profit per Unit | Effect of Other Machines |\n|---------|-----------------|---------------------------|\n| MachineA | $500 | Decreases by $10 for each MachineB produced |\n| MachineB | $800 | Decreases by $20 for each MachineA produced |\n| MachineC | $1000 | Decreases by $15 for each MachineA and MachineB produced |\n\nThe company has a total production capacity of 50 machines. Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\n\nPlease help the company to maximize the total profit by determining the optimal number of each type of machine to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineATeams = model.addVar(vtype=\"INTEGER\", name=\"MachineATeams\", lb=0) # number of MachineA\nMachineBTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineBTeams\", lb=0) # number of MachineB\nMachineCTeams = model.addVar(vtype=\"INTEGER\", name=\"MachineCTeams\", lb=0) # number of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_MachineA = (500 - 10 * MachineBTeams) * MachineATeams\nProfit_MachineB = (800 - 20 * MachineATeams) * MachineBTeams\nProfit_MachineC = (1000 - 15 * (MachineATeams + MachineBTeams)) * MachineCTeams\n## the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 50 machines.\nmodel.addCons(MachineATeams + MachineBTeams + MachineCTeams <= 50)\n## Due to resource limitations, the number of MachineC produced cannot exceed the combined number of MachineA and MachineB.\nmodel.addCons(MachineCTeams <= MachineATeams + MachineBTeams)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA: \", model.getVal(MachineATeams))\n    print(\"Number of MachineB: \", model.getVal(MachineBTeams))\n    print(\"Number of MachineC: \", model.getVal(MachineCTeams))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n// The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 400 units of any product to be produced.\n// A <= 400; B <= 400; C <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2).\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                   |\n| B       | $70             | 3 hours                   |\n| C       | $90             | 4 hours                   |\n\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The raw material constraint allows for a maximum of 400 units of any product to be produced.\n\nPlease help the company to maximize the profit function given the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=400) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n## Since pyscipopt does not support quadratic objective functions directly, we need to linearize the quadratic terms\n## Introduce new variables for the squares and constraints to ensure they are equal to the squares of the original variables\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\n\n## Calculate the profit\nProfit = 50 * A + 70 * B + 90 * C - 0.01 * (A_sq + B_sq + C_sq)\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for production\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit.\n// {\"hours of operation for greenhouse A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach greenhouse has different efficiency and cost structures. \nGreenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. \nGreenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. \nGreenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. \nThe farm aims to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n// Profit from A: Profit_A = (10 * 15 - 5) * HA\n// Profit from B: Profit_B = (15 * 20 - 7) * HB\n// Profit from C: Profit_C = (20 * 25 - 9) * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (HA + HB + HC)\n\n## Generate Constraint-1:\nThe farm has a total budget of $300 per day for operating the greenhouses.\n// 5 * HA + 7 * HB + 9 * HC <= 300\n\n## Generate Constraint-2:\nEach greenhouse must operate at least 4 hours per day.\n// HA >= 4; HB >= 4; HC >= 4",
        "question": "A farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit. The efficiency, cost, and selling price per kg for each greenhouse are given in the following Table.\n\n| Greenhouse | Production per Hour | Cost per Hour | Selling Price per kg |\n|------------|---------------------|---------------|----------------------|\n| A          | 10 kg               | 5$            | 15$                  |\n| B          | 15 kg               | 7$            | 20$                  |\n| C          | 20 kg               | 9$            | 25$                  |\n\nThe farm has a total budget of $300 per day for operating the greenhouses. Each greenhouse must operate at least 4 hours per day. Please help the farm to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## Each greenhouse must operate at least 4 hours per day.\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=4) # hours of operation for greenhouse A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=4) # hours of operation for greenhouse B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=4) # hours of operation for greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 * 15 - 5) * HA\nProfit_B = (15 * 20 - 7) * HB\nProfit_C = (20 * 25 - 9) * HC\nOperatingHours = HA + HB + HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / OperatingHours\n## convert the division to multiplication\nmodel.addCons(obj * OperatingHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total budget of $300 per day for operating the greenhouses.\nmodel.addCons(5 * HA + 7 * HB + 9 * HC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Greenhouse A: \", model.getVal(HA))\n    print(\"Hours of Operation for Greenhouse B: \", model.getVal(HB))\n    print(\"Hours of Operation for Greenhouse C: \", model.getVal(HC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, the selling price is $100 per ton, and the water cost is $20 per ton. \nFor Crop B, the yield per acre is 7 tons, the selling price is $120 per ton, and the water cost is $25 per ton. \nFor Crop C, the yield per acre is 9 tons, the selling price is $150 per ton, and the water cost is $30 per ton.\nThe farm has limited water resources and aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n// Revenue of A: Revenue_A = 5 * A * (100 - 20)\n// Revenue of B: Revenue_B = 7 * B * (120 - 25)\n// Revenue of C: Revenue_C = 9 * C * (150 - 30)\n// Water cost of A: Water_cost_A = 5 * A * 20\n// Water cost of B: Water_cost_B = 7 * B * 25\n// Water cost of C: Water_cost_C = 9 * C * 30\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe total water cost must not exceed $2000.\n// 20 * A + 25 * B + 30 * C <= 2000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The yield per acre, selling price, and water cost for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Selling Price per Ton | Water Cost per Ton |\n|------|----------------|-----------------------|---------------------|\n| A    | 5 tons         | $100                  | $20                 |\n| B    | 7 tons         | $120                  | $25                 |\n| C    | 9 tons         | $150                  | $30                 |\n\nThe farm has a total of 100 acres available for cultivation. The farmer wants to ensure at least 20 acres are dedicated to each crop. The total water cost must not exceed $2000. \nPlease help the farmer to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 5 * A * (100 - 20)\nRevenue_B = 7 * B * (120 - 25)\nRevenue_C = 9 * C * (150 - 30)\nWater_cost_A = 5 * A * 20\nWater_cost_B = 7 * B * 25\nWater_cost_C = 9 * C * 30\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_cost_A + Water_cost_B + Water_cost_C) == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total water cost must not exceed $2000.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit.\nThe profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit.\nThe profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit.\nThe company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// Total variable cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120.\n// 100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations. The profit per unit, variable cost per unit, and raw material cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Variable Cost per Unit | Raw Material Cost per Unit |\n|---------|-----------------|------------------------|----------------------------|\n| A       | $50             | $20                    | $100                       |\n| B       | $70             | $30                    | $150                       |\n| C       | $60             | $25                    | $120                       |\n\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120. The company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n\nPlease help the company determine the optimal amount of each product to produce to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited supply of raw materials, which costs $10,000 per month.\nmodel.addCons(100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1169,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of energy storage systems\": \"Storage\", \"range\": \"Storage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh of energy per day. The cost of each wind turbine is $2000, and it generates 200 kWh of energy per day. The cost of each energy storage system is $5000, and it can store 500 kWh of energy. The company wants to minimize the total cost while maximizing the total energy generated and stored.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Storage\n// Total energy generated: Energy = 100 * Solar + 200 * Wind\n// Total energy stored: Stored = 500 * Storage\n// So, the objective function is: Minimize Cost / (Energy + Stored)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Storage <= 100000\n\n## Generate Constraint-2:\nThe company needs to generate at least 10,000 kWh of energy per day.\n// 100 * Solar + 200 * Wind >= 10000\n\n## Generate Constraint-3:\nThe company needs to store at least 5000 kWh of energy.\n// 500 * Storage >= 5000\n\n## Generate Constraint-4:\nThe company wants to ensure that no more than 50% of the budget is spent on energy storage systems.\n// 5000 * Storage <= 50% * 100000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The cost, energy generation, and storage capacity for each type of system are given in the following Table.\n\n| System Type | Cost per Unit | Energy Generation per Day | Storage Capacity |\n|-------------|---------------|----------------------------|------------------|\n| Solar       | $1000         | 100 kWh                    | N/A              |\n| Wind        | $2000         | 200 kWh                    | N/A              |\n| Storage     | $5000         | N/A                        | 500 kWh          |\n\nThe company has a budget of $100,000 for the installation. The company needs to generate at least 10,000 kWh of energy per day and store at least 5000 kWh of energy. The company wants to ensure that no more than 50% of the budget is spent on energy storage systems. \nPlease help the company to minimize the total cost while maximizing the total energy generated and stored, using the objective function defined as the total cost divided by the sum of the total energy generated and stored.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nStorage = model.addVar(vtype=\"INTEGER\", name=\"Storage\", lb=0) # capacity of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Storage\nEnergy = 100 * Solar + 200 * Wind\nStored = 500 * Storage\n## the objective function is: Minimize Cost / (Energy + Stored)\n## convert the division to multiplication\nmodel.addCons(obj * (Energy + Stored) == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Storage <= 100000)\n## The company needs to generate at least 10,000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind >= 10000)\n## The company needs to store at least 5000 kWh of energy.\nmodel.addCons(500 * Storage >= 5000)\n## The company wants to ensure that no more than 50% of the budget is spent on energy storage systems.\nmodel.addCons(5000 * Storage <= 0.5 * 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Energy Storage Systems: \", model.getVal(Storage))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend.\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of Danishes\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"number of \u00c9clairs\": \"\u00c9clair\", \"range\": \"\u00c9clair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n// Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\n// Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\n\n## Generate Constraint-1:\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\n// 50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\n// Croissant <= 300; Danish <= 250; \u00c9clair <= 200\n\n## Generate Constraint-3:\nThe bakery has a total production capacity of 700 pastries for the weekend.\n// Croissant + Danish + \u00c9clair <= 700",
        "question": "A bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend. The profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries. The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g. The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200. The bakery also has a total production capacity of 700 pastries for the weekend. Please help the bakery to maximize its total profit from selling the pastries.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0, ub=300) # number of Croissants\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=0, ub=250) # number of Danishes\n\u00c9clair = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair\", lb=0, ub=200) # number of \u00c9clairs\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=300)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.02 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=0, ub=100)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=250)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.02 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n\u00c9clair1 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair1\", lb=0, ub=100)\n\u00c9clair2 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair2\", lb=100, ub=200)\n\u00c9clair_b1 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b1\")\n\u00c9clair_b2 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b2\")\nmodel.addCons(\u00c9clair_b1 + \u00c9clair_b2 == 1)\nmodel.addCons(\u00c9clair == \u00c9clair1*\u00c9clair_b1 + \u00c9clair2*\u00c9clair_b2)\nProfit_\u00c9clair = 4 * \u00c9clair1 * \u00c9clair_b1 + (4 + 0.02 * (\u00c9clair2 - 100)) * \u00c9clair2 * \u00c9clair_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_\u00c9clair)\n\n# Add constraints\n## The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\nmodel.addCons(50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000)\n## The bakery has a total production capacity of 700 pastries for the weekend.\nmodel.addCons(Croissant + Danish + \u00c9clair <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Danishes: \", model.getVal(Danish))\n    print(\"Number of \u00c9clairs: \", model.getVal(\u00c9clair))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed on flat roofs is 100.\n// Flat <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels and the cost of installation per panel vary based on the type of roof, as shown in the following Table.\n\n| Roof Type | Efficiency | Installation Cost per Panel |\n|-----------|------------|-----------------------------|\n| Flat      | 80%        | $1000                       |\n| Sloped    | 90%        | $1200                       |\n| Green     | 75%        | $800                        |\n\nThe company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The company has a budget of $150,000 for the installation. The maximum number of panels that can be installed on flat roofs is 100.\n\nPlease help the company determine the optimal number of solar panels to install on each type of roof to meet these requirements.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0, ub=100) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0) # number of solar panels on green roofs\n\n# Define objective function\nCost = 1000 * Flat + 1200 * Slope + 800 * Green\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000) # The total energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000) # The company has a budget of $150,000 for the installation.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1026,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of tomatoes on plot 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"acres of potatoes on plot 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"acres of carrots on plot 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit from selling the crops. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n// Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n// Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n// Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n// So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation across all plots is 100 acres.\n// T1 + P2 + C3 <= 100",
        "question": "A farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops. The total area available for cultivation across all plots is 100 acres. Please help the farmer to maximize his profit from selling the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0) # acres of tomatoes on plot 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # acres of potatoes on plot 2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of carrots on plot 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n## Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n## Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n## So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\nmodel.addCons(obj == (500 * T1 - 10 * T1**3 + 300 * P2 - 5 * P2**3 + 400 * C3 - 8 * C3**3))\n\n# Add constraints\n## The total area available for cultivation across all plots is 100 acres.\nmodel.addCons(T1 + P2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Tomatoes on Plot 1: \", model.getVal(T1))\n    print(\"Acres of Potatoes on Plot 2: \", model.getVal(P2))\n    print(\"Acres of Carrots on Plot 3: \", model.getVal(C3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 473,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop.\n// {\"area for crop C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yields and costs for each crop. \nFor C1, the yield per hectare is 5 tons, the cost per hectare is $1000, and the market price per ton is $200. \nFor C2, the yield per hectare is 7 tons, the cost per hectare is $1200, and the market price per ton is $250. \nFor C3, the yield per hectare is 9 tons, the cost per hectare is $1500, and the market price per ton is $300.\nThe farmer wants to maximize the profit per hectare (revenue minus cost per hectare).\n// Profit_C1 = (5 * C1 * 200) - (1000 * C1)\n// Profit_C2 = (7 * C2 * 250) - (1200 * C2)\n// Profit_C3 = (9 * C3 * 300) - (1500 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 hectares.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $100,000 for cultivation costs.\n// 1000 * C1 + 1200 * C2 + 1500 * C3 <= 100000",
        "question": "A farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop.\nFor C1, the yield per hectare is 5 tons, the cost per hectare is $1000, and the market price per ton is $200. \nFor C2, the yield per hectare is 7 tons, the cost per hectare is $1200, and the market price per ton is $250. \nFor C3, the yield per hectare is 9 tons, the cost per hectare is $1500, and the market price per ton is $300.\nThe farmer wants to maximize the profit per hectare (revenue minus cost per hectare).\nThe total available land for cultivation is 100 hectares. The farm has a budget of $100,000 for cultivation costs.\nPlease help the farmer determine the optimal area to allocate for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # area for crop C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # area for crop C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # area for crop C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * C1 * 200) - (1000 * C1)\nProfit_C2 = (7 * C2 * 250) - (1200 * C2)\nProfit_C3 = (9 * C3 * 300) - (1500 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The total available land for cultivation is 100 hectares.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farm has a budget of $100,000 for cultivation costs.\nmodel.addCons(1000 * C1 + 1200 * C2 + 1500 * C3 <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop C1: \", model.getVal(C1))\n    print(\"Area for Crop C2: \", model.getVal(C2))\n    print(\"Area for Crop C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200\n\n## Generate Constraint-2:\nThe level of automation cannot exceed $5000.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe total production quantity of all products must not exceed 500 units.\n// PA + PB + PC <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets. The company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. The level of automation cannot exceed $5000. The total production quantity of all products must not exceed 500 units. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(PA >= 100)\nmodel.addCons(PB >= 150)\nmodel.addCons(PC >= 200)\nmodel.addCons(Automation <= 5000)\nmodel.addCons(PA + PB + PC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations. Each Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. Please help the company to maximize the total weekly profit while considering the purchase costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit - Cost)\nProfit = 10000 * T + 7000 * V + 3000 * B\nCost = 50000 * T + 30000 * V + 5000 * B\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 695,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize their total power output while considering the limitations of each farm and the total budget.\n// {\"number of turbines in farm 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach turbine in farm 1 generates 50 units of power, in farm 2 generates 60 units of power, and in farm 3 generates 70 units of power. The company aims to maximize the total power output from all farms.\n// Total power output = 50 * T1 + 60 * T2 + 70 * T3\n// Objective function: Maximize (50 * T1 + 60 * T2 + 70 * T3)\n\n## Generate Constraint-1:\nThe total budget allows for a maximum of 50 turbines across all farms.\n// T1 + T2 + T3 <= 50",
        "question": "A company operates three different wind farms to generate electricity. The company needs to decide the number of turbines to install in each farm to maximize their total power output while considering the limitations of each farm and the total budget. Each turbine in farm 1 generates 50 units of power, in farm 2 generates 60 units of power, and in farm 3 generates 70 units of power. The total budget allows for a maximum of 50 turbines across all farms. Please help the company to maximize the total power output from all farms.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of turbines in farm 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of turbines in farm 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of turbines in farm 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * T1 + 60 * T2 + 70 * T3)\nmodel.addCons(obj == 50 * T1 + 60 * T2 + 70 * T3)\n\n# Add constraints\n## The total budget allows for a maximum of 50 turbines across all farms.\nmodel.addCons(T1 + T2 + T3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines in Farm 1: \", model.getVal(T1))\n    print(\"Number of Turbines in Farm 2: \", model.getVal(T2))\n    print(\"Number of Turbines in Farm 3: \", model.getVal(T3))\n    print(\"Maximized Total Power Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 531,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company incurs different costs for fuel, maintenance, and driver wages for each type of truck. \nFor TruckA, the cost per truck is $5000 for fuel, $2000 for maintenance, and $3000 for driver wages. \nFor TruckB, the cost per truck is $6000 for fuel, $2500 for maintenance, and $3500 for driver wages. \nFor TruckC, the cost per truck is $7000 for fuel, $3000 for maintenance, and $4000 for driver wages. \nThe company wants to minimize the total operational cost.\n// Total cost for TruckA: Cost_TruckA = (5000 + 2000 + 3000) * TruckA\n// Total cost for TruckB: Cost_TruckB = (6000 + 2500 + 3500) * TruckB\n// Total cost for TruckC: Cost_TruckC = (7000 + 3000 + 4000) * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $500,000 for truck operations.\n// 5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500,000\n\n## Generate Constraint-2:\nDue to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\n// TruckB <= 0.5 * TruckA",
        "question": "A logistics company operates three different types of trucks: TruckA, TruckB, and TruckC. They need to determine the number of each type of truck to deploy for the next month to optimize their operations. The costs for fuel, maintenance, and driver wages for each type of truck are given in the following Table.\n\n| Truck Type | Fuel Cost | Maintenance Cost | Driver Wages |\n|------------|-----------|------------------|--------------|\n| TruckA     | $5000     | $2000            | $3000        |\n| TruckB     | $6000     | $2500            | $3500        |\n| TruckC     | $7000     | $3000            | $4000        |\n\nThe company has a total budget of $500,000 for truck operations. Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA. The company wants to minimize the total operational cost. Please help the company determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\nCost_TruckA = (5000 + 2000 + 3000) * TruckA\nCost_TruckB = (6000 + 2500 + 3500) * TruckB\nCost_TruckC = (7000 + 3000 + 4000) * TruckC\n# So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n# The company has a total budget of $500,000 for truck operations.\nmodel.addCons(5000 * TruckA + 6000 * TruckB + 7000 * TruckC <= 500000)\n# Due to licensing restrictions, the number of TruckB cannot exceed half the number of TruckA.\nmodel.addCons(TruckB <= 0.5 * TruckA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Total Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency.\n// {\"production quantity of the product\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency. The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10, and the selling price per unit is $15. The company aims to maximize the total profit from the product.\n\n| Variable                | Description                          |\n|-------------------------|--------------------------------------|\n| Production Quantity     | Quantity of the product to be produced |\n| Advertising Budget      | Budget for promoting the product     |\n| Investment in Efficiency| Money invested in production efficiency |\n\nThe company has a budget of $50,000 for advertising. Please help the company determine the optimal values for production quantity, advertising budget, and investment in production efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=0) # production quantity of the product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\nProfit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Investment in Efficiency: \", model.getVal(Efficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products.\n// The objective function is: Maximize Profit1\n\n## Generate Constraint-1:\nThe total raw materials available for all products is limited to 1000 units.\n// R1 <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for all products is limited to 800 hours.\n// L1 <= 800",
        "question": "A manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products. The total raw materials available for all products is limited to 1000 units. The total labor hours available for all products is limited to 800 hours. Please help the company determine the optimal allocation of raw materials (R1), labor hours (L1), and machine hours (M1) for product 1 to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0)  # raw materials for product 1\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0)  # labor hours for product 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # machine hours for product 1\n\n# Define objective function\n# The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2\n# Since pyscipopt does not support non-linear objective, we need to linearize it\n# Let's introduce new variables to handle the powers\nR1_sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"R1_sqrt\")\nL1_pow03 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1_pow03\")\nM1_pow02 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1_pow02\")\n\n# Constraints to link the new variables with the original ones\nmodel.addCons(R1_sqrt == R1**0.5)\nmodel.addCons(L1_pow03 == L1**0.3)\nmodel.addCons(M1_pow02 == M1**0.2)\n\n# Calculate the profit\nProfit1 = 100 * R1_sqrt * L1_pow03 * M1_pow02\n\n# Set objective as a variable\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1)\n\n# Add constraints\n# The total raw materials available for all products is limited to 1000 units\nmodel.addCons(R1 <= 1000)\n# The total labor hours available for all products is limited to 800 hours\nmodel.addCons(L1 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for product 1: \", model.getVal(R1))\n    print(\"Labor hours for product 1: \", model.getVal(L1))\n    print(\"Machine hours for product 1: \", model.getVal(M1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 686,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB\n\n## Generate Constraint-3:\nThe dosage of DrugC must be at least 20 units to be effective.\n// DosageC >= 20",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. The effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. The effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. The company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB. The dosage of DrugC must be at least 20 units to be effective. Please help the company determine the optimal dosage levels for each drug.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\nmodel.addCons(DosageA >= 2 * DosageB)\nmodel.addCons(DosageC >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of three products: Product A, Product B, and Product C. Additionally, the company is considering investing in automation technology to reduce production costs.\n// {\"production level of Product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production level of Product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A, B, and C is $100, $150, and $200 respectively. The company can reduce these costs by $1 for every $1000 invested in automation. The selling price for each unit of Product A, B, and C is $150, $200, and $250 respectively. The company aims to maximize the total profit from the sales of all products.\n// Total profit for the products: Profit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 1000 units.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-3:\nThe production of Product A must be at least 200 units.\n// ProdA >= 200\n\n## Generate Constraint-4:\nThe production of Product B must be at least 150 units.\n// ProdB >= 150",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of three products: Product A, Product B, and Product C. Additionally, the company is considering investing in automation technology to reduce production costs. The cost of producing each unit of Product A, B, and C before automation is $100, $150, and $200 respectively, and the selling price for each unit is $150, $200, and $250 respectively. The company can reduce these costs by $1 for every $1000 invested in automation.\n\n| Product | Cost Before Automation | Selling Price |\n|---------|------------------------|---------------|\n| A       | $100                   | $150          |\n| B       | $150                   | $200          |\n| C       | $200                   | $250          |\n\nThe company has a budget of $100,000 for investment in automation. The total production capacity for all products is limited to 1000 units. The production of Product A must be at least 200 units, and the production of Product B must be at least 150 units.\n\nPlease help the company to maximize the total profit from the sales of all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=200) # production level of Product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=150) # production level of Product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production level of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## The cost of producing each unit of Product A, B, and C is $100, $150, and $200 respectively.\n## The company can reduce these costs by $1 for every $1000 invested in automation.\n## The selling price for each unit of Product A, B, and C is $150, $200, and $250 respectively.\n## Total profit for the products: Profit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\nProfit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in automation.\nmodel.addCons(Automation <= 100000)\n## The total production capacity for all products is limited to 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProdA))\n    print(\"Production Level of Product B: \", model.getVal(ProdB))\n    print(\"Production Level of Product C: \", model.getVal(ProdC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1151,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm aims to maximize its profit from the crops. The profit per hectare for C1 is $1000, but it requires 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm has a limited water supply and wants to maximize its profit per unit of water used.\n// Profit_C1 = 1000 * A1\n// Profit_C2 = 1500 * A2\n// Profit_C3 = 2000 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * A1 + 3 * A2 + 4 * A3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 300 units.\n// 2 * A1 + 3 * A2 + 4 * A3 <= 300",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|--------------------|-------------------------------|\n| C1   | $1000              | 2 units                       |\n| C2   | $1500              | 3 units                       |\n| C3   | $2000              | 4 units                       |\n\nThe farm has a total of 100 hectares of land available. The farm has a limited water supply of 300 units. The farm aims to maximize its profit from the crops by maximizing its profit per unit of water used.\nPlease help the farm determine the optimal area of land to allocate to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * A1\nProfit_C2 = 1500 * A2\nProfit_C3 = 2000 * A3\nWaterUsage = 2 * A1 + 3 * A2 + 4 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 300 units.\nmodel.addCons(2 * A1 + 3 * A2 + 4 * A3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(A1))\n    print(\"Area of Land for C2: \", model.getVal(A2))\n    print(\"Area of Land for C3: \", model.getVal(A3))\n    print(\"Maximized Profit Rate per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 838,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product and the level of advertising investment for each product to maximize profit.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"advertising investment for product A\": \"AdInvestA\", \"range\": \"AdInvestA >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product B\": \"AdInvestB\", \"range\": \"AdInvestB >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product C\": \"AdInvestC\", \"range\": \"AdInvestC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Advertising increases the sales of each product nonlinearly, with an increase in sales proportional to the square of the advertising investment. The company aims to maximize total profit.\n// Profit from product A: ProfitA = (50 * ProductA) - AdInvestA + 0.1 * (AdInvestA^2)\n// Profit from product B: ProfitB = (70 * ProductB) - AdInvestB + 0.15 * (AdInvestB^2)\n// Profit from product C: ProfitC = (60 * ProductC) - AdInvestC + 0.12 * (AdInvestC^2)\n// Total profit: TotalProfit = ProfitA + ProfitB + ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe total advertising budget is $10,000.\n// AdInvestA + AdInvestB + AdInvestC <= 10000\n\n## Generate Constraint-2:\nThe production capacity for product A is 1000 units, for product B is 1500 units, and for product C is 1200 units.\n// ProductA <= 1000\n// ProductB <= 1500\n// ProductC <= 1200\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product A, 600 units of product B, and 700 units of product C.\n// ProductA >= 500\n// ProductB >= 600\n// ProductC >= 700",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product and the level of advertising investment for each product to maximize profit. The profit per unit of product A is $50, product B is $70, and product C is $60. Advertising increases the sales of each product nonlinearly, with an increase in sales proportional to the square of the advertising investment. The company aims to maximize total profit.\n\n| Product | Profit per Unit | Production Capacity | Minimum Production |\n|---------|-----------------|---------------------|--------------------|\n| A       | 50$             | 1000 units          | 500 units          |\n| B       | 70$             | 1500 units          | 600 units          |\n| C       | 60$             | 1200 units          | 700 units          |\n\nThe total advertising budget is $10,000. The company must adhere to the production capacities and minimum production requirements for each product. Please help the company determine the optimal production quantities and advertising investments to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=500, ub=1000)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=600, ub=1500)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=700, ub=1200)  # production quantity of product C\nAdInvestA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestA\", lb=0)  # advertising investment for product A\nAdInvestB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestB\", lb=0)  # advertising investment for product B\nAdInvestC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdInvestC\", lb=0)  # advertising investment for product C\n\n# Define objective function\n## Profit from product A: ProfitA = (50 * ProductA) - AdInvestA + 0.1 * (AdInvestA^2)\n## Profit from product B: ProfitB = (70 * ProductB) - AdInvestB + 0.15 * (AdInvestB^2)\n## Profit from product C: ProfitC = (60 * ProductC) - AdInvestC + 0.12 * (AdInvestC^2)\n## Total profit: TotalProfit = ProfitA + ProfitB + ProfitC\nProfitA = 50 * ProductA - AdInvestA + 0.1 * AdInvestA**2\nProfitB = 70 * ProductB - AdInvestB + 0.15 * AdInvestB**2\nProfitC = 60 * ProductC - AdInvestC + 0.12 * AdInvestC**2\nTotalProfit = ProfitA + ProfitB + ProfitC\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\n## The total advertising budget is $10,000.\nmodel.addCons(AdInvestA + AdInvestB + AdInvestC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Advertising Investment for Product A: \", model.getVal(AdInvestA))\n    print(\"Advertising Investment for Product B: \", model.getVal(AdInvestB))\n    print(\"Advertising Investment for Product C: \", model.getVal(AdInvestC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer wants to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).\n// Profit of A: Profit_A = (50 - 100 / A) * A\n// Profit of B: Profit_B = (70 - 150 / B) * B\n// Profit of C: Profit_C = (90 - 200 / C) * C\n// Storage cost: Storage = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production setup costs.\n// 100 * A + 150 * B + 200 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer has a storage capacity of 500 units across all products.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe manufacturer wants to produce at least 50 units of each product.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe manufacturer wants to ensure that the production of Product C does not exceed 30% of the total production.\n// C <= 0.3 * (A + B + C)",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer has a budget of $10,000 for production setup costs. The manufacturer has a storage capacity of 500 units across all products. The manufacturer wants to produce at least 50 units of each product. The manufacturer wants to ensure that the production of Product C does not exceed 30% of the total production.\nPlease help the manufacturer to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 100 / A) * A\nProfit_B = (70 - 150 / B) * B\nProfit_C = (90 - 200 / C) * C\nStorage = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n## convert the division to multiplication\nmodel.addCons(obj * Storage == Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C))\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 10000)\n## The manufacturer has a storage capacity of 500 units across all products.\nmodel.addCons(A + B + C <= 500)\n## The manufacturer wants to ensure that the production of Product C does not exceed 30% of the total production.\nmodel.addCons(C <= 0.3 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost.\n// Cost_A = max(10 - 0.02 * (A - 100), 10) * A\n// Cost_B = max(15 - 0.02 * (B - 100), 15) * B\n// Cost_C = max(20 - 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\n// 5 * A + 8 * B + 10 * C <= 5000\n\n## Generate Constraint-2:\nThe market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. They need to determine the production quantities of each component to maximize their profit while considering the cost of production and the market demand. The profit per unit of component A is $10, for B is $15, and for C is $20. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each component, if the production quantity exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the total revenue minus the total cost.\n\nThe manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\n\nThe market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\n\nPlease help the manufacturer to determine the optimal production quantities of components A, B, and C to maximize their net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each component. For component A, the demand limit is 300 units. For component B, the demand limit is 250 units. For component C, the demand limit is 200 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(10 - 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 10 * A1 * A_b1 + (10 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(15 - 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 15 * B1 * B_b1 + (15 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(20 - 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 20 * C1 * C_b1 + (20 - 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The manufacturer has a limited supply of raw materials. For component A, 5 units of raw material are required per unit. For component B, 8 units are required per unit. For component C, 10 units are required per unit. The total available raw material is 5000 units.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1244,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: Corn, Wheat, and Soybeans. Additionally, the farm needs to determine the amount of fertilizer to use for each crop.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"amount of fertilizer for each crop\": \"Fertilizer\", \"range\": \"Fertilizer >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield per acre of Corn is 1000 kg, Wheat is 800 kg, and Soybeans is 600 kg. The selling price per kg of Corn is $0.20, Wheat is $0.25, and Soybeans is $0.30. The cost of fertilizer per kg is $0.10, and it increases the yield by 5% per kg used. The farm aims to maximize its total revenue from the crops.\n// Revenue from Corn: Revenue_Corn = 0.20 * (1000 + 0.05 * Fertilizer) * Corn\n// Revenue from Wheat: Revenue_Wheat = 0.25 * (800 + 0.05 * Fertilizer) * Wheat\n// Revenue from Soybeans: Revenue_Soybeans = 0.30 * (600 + 0.05 * Fertilizer) * Soybeans\n// So, the objective function is: Maximize (Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Corn + Wheat + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $5000 for purchasing fertilizer.\n// Fertilizer <= 5000",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate to three different crops: Corn, Wheat, and Soybeans. Additionally, the farm needs to determine the amount of fertilizer to use for each crop. The yield per acre and the selling price per kg for each crop are given in the following Table.\n\n| Crop     | Yield per Acre | Selling Price per kg |\n|----------|----------------|----------------------|\n| Corn     | 1000 kg        | $0.20                |\n| Wheat    | 800 kg         | $0.25                |\n| Soybeans | 600 kg         | $0.30                |\n\nThe cost of fertilizer per kg is $0.10, and it increases the yield by 5% per kg used. The farm aims to maximize its total revenue from the crops. The total acres available for planting are 100, and the farm has a budget of $5000 for purchasing fertilizer. Please help the farm to maximize its total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of Soybeans\nFertilizer = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer\", lb=0)  # amount of fertilizer\n\n# Define objective function\nRevenue_Corn = 0.20 * (1000 + 0.05 * Fertilizer) * Corn\nRevenue_Wheat = 0.25 * (800 + 0.05 * Fertilizer) * Wheat\nRevenue_Soybeans = 0.30 * (600 + 0.05 * Fertilizer) * Soybeans\n# So, the objective function is: Maximize (Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\n\n# Add constraints\n# The total acres available for planting are 100.\nmodel.addCons(Corn + Wheat + Soybeans <= 100)\n# The farm has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(Fertilizer <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Amount of Fertilizer: \", model.getVal(Fertilizer))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n// Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n// So, the objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\n// MachinesA <= 10; MachinesB <= 12; MachinesC <= 8",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs. The production rate and maintenance cost for each machine type are given in the following Table.\n\n| Component | Production Rate (units/hour) | Maintenance Cost ($/hour) |\n|-----------|-------------------------------|---------------------------|\n| ComponentA | 100                           | 50                        |\n| ComponentB | 150                           | 75                        |\n| ComponentC | 200                           | 100                       |\n\nThe company has a total of 25 machines available for allocation. Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8. \n\nPlease help the company to maximize the total production output while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0, ub=10)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0, ub=12)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0, ub=8)    # number of machines for ComponentC\n\n# Define objective function\nOutput = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\nCost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n# So, the objective function is: Maximize (Output - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n# The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1045,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe production capacity for Product A is limited to 100 units.\n// ProductA <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product B.\n// ProductB >= 50\n\n## Generate Constraint-4:\nThe total production of all products must not exceed 200 units.\n// ProductA + ProductB + ProductC <= 200",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C). The profit per unit of Product A is $50 and it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company has a budget of $5000 for raw materials. The production capacity for Product A is limited to 100 units. The company must produce at least 50 units of Product B. The total production of all products must not exceed 200 units. Please help the company to maximize the total profit while considering the cost of raw materials, which is defined as the difference between the total profit and the cost of raw materials.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n## The production capacity for Product A is limited to 100 units.\nmodel.addCons(ProductA <= 100)\n## The company must produce at least 50 units of Product B.\nmodel.addCons(ProductB >= 50)\n## The total production of all products must not exceed 200 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit after Raw Material Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\n// Profit per acre of wheat: Profit_W = (200 - 50) * W\n// Profit per acre of corn: Profit_C = (300 - 70) * C\n// Profit per acre of soybeans: Profit_S = (150 - 40) * S\n// Cost of water and fertilizer: Cost_W = 50 * W, Cost_C = 70 * C, Cost_S = 40 * S\n// So, the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop. The profit per acre and the cost of water and fertilizer per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Cost of Water and Fertilizer per Acre |\n|----------|-----------------|--------------------------------------|\n| Wheat    | $200            | $50                                  |\n| Corn     | $300            | $70                                  |\n| Soybeans | $150            | $40                                  |\n\nThe farmer has a total of 100 acres available for planting. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\nPlease help the farmer determine the optimal number of acres to dedicate to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 40) * S\nCost_W = 50 * W\nCost_C = 70 * C\nCost_S = 40 * S\n## the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_W + Cost_C + Cost_S) == (Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S))\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 997,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n// Production cost of product A: CostA = 50 - Automation * PA\n// Production cost of product B: CostB = 70 - Automation * PB\n// Production cost of product C: CostC = 60 - Automation * PC\n// Total production cost: TotalCost = CostA + CostB + CostC\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C.\n// PA >= 100\n// PB >= 150\n// PC >= 200\n\n## Generate Constraint-2:\nThe level of automation cannot exceed $5000.\n// Automation <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product A is $50, product B is $70, and product C is $60. Implementing higher levels of automation reduces the production cost linearly by $1 for every unit of automation. The company aims to minimize the total production cost while meeting certain production targets.\n\n| Product | Production Cost per Unit |\n|---------|--------------------------|\n| A       | $50 - Automation * PA    |\n| B       | $70 - Automation * PB    |\n| C       | $60 - Automation * PC    |\n\nThe company must produce at least 100 units of product A, 150 units of product B, and 200 units of product C. The level of automation cannot exceed $5000.\n\nPlease help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=100) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=150) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=200) # production quantity of product C\nAutomation = model.addVar(name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = 50 - Automation * PA\nCostB = 70 - Automation * PB\nCostC = 60 - Automation * PC\nTotalCost = CostA + CostB + CostC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\nmodel.addCons(Automation <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 933,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n// Net revenue of A: Revenue_A = (1000 - 400) * A\n// Net revenue of B: Revenue_B = (1500 - 600) * B\n// Net revenue of C: Revenue_C = (2000 - 800) * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for seed costs for the upcoming season.\n// 400 * A + 600 * B + 800 * C <= 100000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season. The expected revenue per acre, cost of seeds per acre, and required labor hours per acre for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Acre | Cost of Seeds per Acre | Required Labor Hours per Acre |\n|------|---------------------------|------------------------|-------------------------------|\n| A    | $1000                     | $400                   | 5 hours                       |\n| B    | $1500                     | $600                   | 8 hours                       |\n| C    | $2000                     | $800                   | 10 hours                      |\n\nThe farm has a budget of $100,000 for seed costs for the upcoming season. The farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\nPlease help the farm determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = (1000 - 400) * A\nRevenue_B = (1500 - 600) * B\nRevenue_C = (2000 - 800) * C\nLaborHours = 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for seed costs for the upcoming season.\nmodel.addCons(400 * A + 600 * B + 800 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements.\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases. The decrease in productivity is modeled as a square root function of the acreage. The farm wants to maximize the total profit from all crops.\n// Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n// Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n// Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n// So, the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// Corn + Wheat + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\n// Corn <= 80; Wheat <= 90; Soybeans <= 70\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\n// Corn >= 10; Wheat >= 10; Soybeans >= 10\n\n## Generate Constraint-4:\nDue to market demand, the farm can only sell up to 60 acres of Corn and 50 acres of Wheat.\n// Corn <= 60; Wheat <= 50",
        "question": "A farm grows three types of crops: Corn, Wheat, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil fertility and water requirements. The profit per acre for Corn is $300, for Wheat is $250, and for Soybeans is $200. However, due to varying soil fertility and water needs, the productivity of each crop decreases nonlinearly as the acreage increases, modeled as a square root function of the acreage. The farm has a total of 100 acres available for cultivation. The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans. The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health. Due to market demand, the farm can only sell up to 60 acres of Corn and 50 acres of Wheat. Please help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop to maintain crop rotation and soil health.\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=10, ub=60) # acreage of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=10, ub=50) # acreage of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=10, ub=70) # acreage of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_Corn = 300 * Corn / sqrt(Corn + 1)\n## Profit_Wheat = 250 * Wheat / sqrt(Wheat + 1)\n## Profit_Soybeans = 200 * Soybeans / sqrt(Soybeans + 1)\n## convert the division to multiplication\nsqrt_Corn = model.addVar(name=\"sqrt_Corn\")\nsqrt_Wheat = model.addVar(name=\"sqrt_Wheat\")\nsqrt_Soybeans = model.addVar(name=\"sqrt_Soybeans\")\nmodel.addCons(sqrt_Corn >= 0)\nmodel.addCons(sqrt_Wheat >= 0)\nmodel.addCons(sqrt_Soybeans >= 0)\nmodel.addCons(sqrt_Corn * sqrt_Corn == Corn + 1)\nmodel.addCons(sqrt_Wheat * sqrt_Wheat == Wheat + 1)\nmodel.addCons(sqrt_Soybeans * sqrt_Soybeans == Soybeans + 1)\nProfit_Corn = 300 * Corn / sqrt_Corn\nProfit_Wheat = 250 * Wheat / sqrt_Wheat\nProfit_Soybeans = 200 * Soybeans / sqrt_Soybeans\n## the objective function is: Maximize Profit_Corn + Profit_Wheat + Profit_Soybeans\nmodel.addCons(obj == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(Corn + Wheat + Soybeans <= 100)\n## The farm has a limited water supply that can support up to 80 acres of Corn, 90 acres of Wheat, and 70 acres of Soybeans.\nmodel.addCons(Corn <= 80)\nmodel.addCons(Wheat <= 90)\nmodel.addCons(Soybeans <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 3 hours         |\n| B       | 30$           | 15$           | 4 hours         |\n| C       | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. Please help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 827,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for component A\": \"M_A\", \"range\": \"M_A >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M_B\", \"range\": \"M_B >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M_C\", \"range\": \"M_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n// Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n// The objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * M_A + 7 * M_B + 9 * M_C <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 100.\n// M_A + M_B + M_C <= 100",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type. Each machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 100. Please help the manufacturer determine the optimal number of machines for each component to maximize the total production output minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM_A = model.addVar(vtype=\"INTEGER\", name=\"M_A\", lb=0) # number of machines for component A\nM_B = model.addVar(vtype=\"INTEGER\", name=\"M_B\", lb=0) # number of machines for component B\nM_C = model.addVar(vtype=\"INTEGER\", name=\"M_C\", lb=0) # number of machines for component C\n\n# Define objective function\n## Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n## Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n## The objective function is: Maximize (Output - Cost)\nOutput = 10 * M_A + 15 * M_B + 20 * M_C\nCost = 5 * M_A + 7 * M_B + 9 * M_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * M_A + 7 * M_B + 9 * M_C <= 1500)\n## The total number of machines available is 100.\nmodel.addCons(M_A + M_B + M_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M_A))\n    print(\"Number of Machines for Component B: \", model.getVal(M_B))\n    print(\"Number of Machines for Component C: \", model.getVal(M_C))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints.\n// {\"number of machines of type 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine type contributes differently to the profit. Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company wants to maximize the total profit from operating these machines.\n// The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\n// Objective: Maximize P\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available across all types.\n// M1 + M2 + M3 <= 50",
        "question": "A company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints. The profit generated per hour by each machine type is as follows:\n\n| Machine Type | Profit per Hour |\n|--------------|-----------------|\n| Type 1       | $50             |\n| Type 2       | $70             |\n| Type 3       | $60             |\n\nThe company has a total of 50 machines available across all types. Please help the company to maximize the total profit from operating these machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines of type 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines of type 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines of type 3\n\n# Define objective function\nP = 50 * M1 + 70 * M2 + 60 * M3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(M1 + M2 + M3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines of Type 1: \", model.getVal(M1))\n    print(\"Number of Machines of Type 2: \", model.getVal(M2))\n    print(\"Number of Machines of Type 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 601,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// PA <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 50 hours per week.\n// PB <= 50\n\n## Generate Constraint-4:\nThe production line C can operate for a maximum of 60 hours per week.\n// PC <= 60\n\n## Generate Constraint-5:\nThe company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C.\n// 10 * PA >= 500\n// 15 * PB >= 600\n// 20 * PC >= 700",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production. Each hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\nThe total operational hours for all lines must not exceed 120 hours per week. The production line A can operate for a maximum of 40 hours per week. The production line B can operate for a maximum of 50 hours per week. The production line C can operate for a maximum of 60 hours per week. The company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C.\nPlease help the company to maximize the total production value.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# So, the objective function is: Maximize (VA + VB + VC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n# The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(PA <= 40)\n# The production line B can operate for a maximum of 50 hours per week.\nmodel.addCons(PB <= 50)\n# The production line C can operate for a maximum of 60 hours per week.\nmodel.addCons(PC <= 60)\n# The company must produce at least 500 units of component A, 600 units of component B, and 700 units of component C.\nmodel.addCons(10 * PA >= 500)\nmodel.addCons(15 * PB >= 600)\nmodel.addCons(20 * PC >= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Maximized Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The objective is to maximize the total profit after deducting the production cost.\n// The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n// The profit from tablets: P_T = 150 * T - 0.03 * T^2\n// The profit from laptops: P_L = 200 * L - 0.02 * L^2\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 devices.\n// S + T + L <= 1000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The total production capacity is limited to 1000 devices. Please help the company to maximize the total profit after deducting the production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n## The profit from tablets: P_T = 150 * T - 0.03 * T^2\n## The profit from laptops: P_L = 200 * L - 0.02 * L^2\n## So, the objective function is: Maximize P = P_S + P_T + P_L\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.03 * T**2 + 200 * L - 0.02 * L**2)\n\n# Add constraints\n## The total production capacity is limited to 1000 devices.\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 645,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: Croissant, \u00c9clair, and Macaron. The bakery needs to determine the number of each pastry to bake for the upcoming weekend.\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of \u00c9clairs\": \"\u00c9clair\", \"range\": \"\u00c9clair >= 0\", \"type\": \"integer\"}\n// {\"number of Macarons\": \"Macaron\", \"range\": \"Macaron >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Croissant is $2, per \u00c9clair is $3, and per Macaron is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each type of pastry. The bakery aims to maximize the total profit from selling the pastries.\n// Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\n// Profit_\u00c9clair = max(3 + 0.02 * (\u00c9clair - 100), 3) * \u00c9clair\n// Profit_Macaron = max(4 + 0.02 * (Macaron - 100), 4) * Macaron\n// So, the objective function is: Maximize Profit_Croissant + Profit_\u00c9clair + Profit_Macaron\n\n## Generate Constraint-1:\nThe bakery has a limited supply of chocolate, which is used in all three pastries. Each Croissant requires 50 g of chocolate, each \u00c9clair requires 75 g, and each Macaron requires 40 g. The total chocolate available is 2000 g.\n// 50 * Croissant + 75 * \u00c9clair + 40 * Macaron <= 2000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for \u00c9clairs is at most 250, and for Macarons is at most 200.\n// Croissant <= 300; \u00c9clair <= 250; Macaron <= 200\n\n## Generate Constraint-3:\nThe bakery has a total production capacity of 700 pastries for the weekend.\n// Croissant + \u00c9clair + Macaron <= 700",
        "question": "A bakery produces three types of pastries: Croissant, \u00c9clair, and Macaron. The bakery needs to determine the number of each pastry to bake for the upcoming weekend. The profit per unit for each pastry is as follows:\n\n| Pastry    | Profit per Unit |\n|-----------|-----------------|\n| Croissant | $2              |\n| \u00c9clair    | $3              |\n| Macaron   | $4              |\n\nDue to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for each type of pastry. The bakery aims to maximize the total profit from selling the pastries.\n\nThe bakery has a limited supply of chocolate, which is used in all three pastries. Each Croissant requires 50 g of chocolate, each \u00c9clair requires 75 g, and each Macaron requires 40 g. The total chocolate available is 2000 g.\n\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for \u00c9clairs is at most 250, and for Macarons is at most 200.\n\nThe bakery has a total production capacity of 700 pastries for the weekend.\n\nPlease help the bakery to maximize the total profit from selling the pastries while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for \u00c9clairs is at most 250, and for Macarons is at most 200.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0, ub=300) # number of Croissants\n\u00c9clair = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair\", lb=0, ub=250) # number of \u00c9clairs\nMacaron = model.addVar(vtype=\"INTEGER\", name=\"Macaron\", lb=0, ub=200) # number of Macarons\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=300)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.02 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_\u00c9clair = max(3 + 0.02 * (\u00c9clair - 100), 3) * \u00c9clair\n\u00c9clair1 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair1\", lb=0, ub=100)\n\u00c9clair2 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair2\", lb=100, ub=250)\n\u00c9clair_b1 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b1\")\n\u00c9clair_b2 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b2\")\nmodel.addCons(\u00c9clair_b1 + \u00c9clair_b2 == 1)\nmodel.addCons(\u00c9clair == \u00c9clair1*\u00c9clair_b1 + \u00c9clair2*\u00c9clair_b2)\nProfit_\u00c9clair = 3 * \u00c9clair1 * \u00c9clair_b1 + (3 + 0.02 * (\u00c9clair2 - 100)) * \u00c9clair2 * \u00c9clair_b2\n## create piecewise variables for piecewise function: Profit_Macaron = max(4 + 0.02 * (Macaron - 100), 4) * Macaron\nMacaron1 = model.addVar(vtype=\"INTEGER\", name=\"Macaron1\", lb=0, ub=100)\nMacaron2 = model.addVar(vtype=\"INTEGER\", name=\"Macaron2\", lb=100, ub=200)\nMacaron_b1 = model.addVar(vtype=\"B\", name=\"Macaron_b1\")\nMacaron_b2 = model.addVar(vtype=\"B\", name=\"Macaron_b2\")\nmodel.addCons(Macaron_b1 + Macaron_b2 == 1)\nmodel.addCons(Macaron == Macaron1*Macaron_b1 + Macaron2*Macaron_b2)\nProfit_Macaron = 4 * Macaron1 * Macaron_b1 + (4 + 0.02 * (Macaron2 - 100)) * Macaron2 * Macaron_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_\u00c9clair + Profit_Macaron\nmodel.addCons(obj == Profit_Croissant + Profit_\u00c9clair + Profit_Macaron)\n\n# Add constraints\nmodel.addCons(50 * Croissant + 75 * \u00c9clair + 40 * Macaron <= 2000)\nmodel.addCons(Croissant + \u00c9clair + Macaron <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of \u00c9clairs: \", model.getVal(\u00c9clair))\n    print(\"Number of Macarons: \", model.getVal(Macaron))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm aims to maximize its profit from the crops. The profit per hectare for C1 is $1000, but it requires 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm has a limited water supply and wants to maximize its profit per unit of water used.\n// Profit_C1 = 1000 * A1\n// Profit_C2 = 1500 * A2\n// Profit_C3 = 2000 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * A1 + 3 * A2 + 4 * A3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 300 units.\n// 2 * A1 + 3 * A2 + 4 * A3 <= 300",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The profit per hectare for C1 is $1000, requiring 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm has a total of 100 hectares of land available and a limited water supply of 300 units. The farm aims to maximize its profit per unit of water used. Please help the farm determine the optimal allocation of land to each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * A1\nProfit_C2 = 1500 * A2\nProfit_C3 = 2000 * A3\nWaterUsage = 2 * A1 + 3 * A2 + 4 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 300 units.\nmodel.addCons(2 * A1 + 3 * A2 + 4 * A3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(A1))\n    print(\"Area of Land for C2: \", model.getVal(A2))\n    print(\"Area of Land for C3: \", model.getVal(A3))\n    print(\"Maximized Profit Rate per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 615,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit.\n// {\"production quantity for WidgetA\": \"WidgetA_Qty\", \"range\": \"WidgetA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetB\": \"WidgetB_Qty\", \"range\": \"WidgetB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetC\": \"WidgetC_Qty\", \"range\": \"WidgetC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.01 * (WidgetA_Qty^2)) * WidgetA_Qty\n// Profit_WidgetB = (70 - 0.02 * (WidgetB_Qty^2)) * WidgetB_Qty\n// Profit_WidgetC = (90 - 0.03 * (WidgetC_Qty^2)) * WidgetC_Qty\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all widgets combined.\n// WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of WidgetB must be at least half of the production of WidgetA.\n// WidgetB_Qty >= 0.5 * WidgetA_Qty",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit. The profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n\n| Widget | Profit per Unit | Cost Function       |\n|--------|-----------------|---------------------|\n| WidgetA| $50             | 0.01 * (WidgetA_Qty^2) |\n| WidgetB| $70             | 0.02 * (WidgetB_Qty^2) |\n| WidgetC| $90             | 0.03 * (WidgetC_Qty^2) |\n\nThe company has a total production capacity of 1000 units for all widgets combined. Due to market demand, the production of WidgetB must be at least half of the production of WidgetA. Please help the company determine the optimal production quantities for WidgetA, WidgetB, and WidgetC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetA_Qty\", lb=0) # production quantity for WidgetA\nWidgetB_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetB_Qty\", lb=0) # production quantity for WidgetB\nWidgetC_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetC_Qty\", lb=0) # production quantity for WidgetC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_WidgetA = (50 - 0.01 * WidgetA_Qty**2) * WidgetA_Qty\nProfit_WidgetB = (70 - 0.02 * WidgetB_Qty**2) * WidgetB_Qty\nProfit_WidgetC = (90 - 0.03 * WidgetC_Qty**2) * WidgetC_Qty\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all widgets combined.\nmodel.addCons(WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000)\n## Due to market demand, the production of WidgetB must be at least half of the production of WidgetA.\nmodel.addCons(WidgetB_Qty >= 0.5 * WidgetA_Qty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for WidgetA: \", model.getVal(WidgetA_Qty))\n    print(\"Production Quantity for WidgetB: \", model.getVal(WidgetB_Qty))\n    print(\"Production Quantity for WidgetC: \", model.getVal(WidgetC_Qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\n// {\"number of TypeA solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company wants to maximize the total energy output per dollar spent.\n// Total energy output for TypeA: Energy_TypeA = 100 * 365 * 10 * TypeASolarPanels\n// Total energy output for TypeB: Energy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\n// Total energy output for TypeC: Energy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\n// Total cost for TypeA: Cost_TypeA = 500 * TypeASolarPanels\n// Total cost for TypeB: Cost_TypeB = 750 * TypeBSolarPanels\n// Total cost for TypeC: Cost_TypeC = 1000 * TypeCSolarPanels\n// So, the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1,000,000\n\n## Generate Constraint-2:\nThe facility has space for a maximum of 1500 solar panels.\n// TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500",
        "question": "A renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company has a budget of $1,000,000 for the installation. The facility has space for a maximum of 1500 solar panels.\nPlease help the company to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergy_TypeA = 100 * 365 * 10 * TypeASolarPanels\nEnergy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\nEnergy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\nCost_TypeA = 500 * TypeASolarPanels\nCost_TypeB = 750 * TypeBSolarPanels\nCost_TypeC = 1000 * TypeCSolarPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n# convert the division to multiplication\nmodel.addCons(obj * (Cost_TypeA + Cost_TypeB + Cost_TypeC) == Energy_TypeA + Energy_TypeB + Energy_TypeC)\n\n# Add constraints\n# The company has a budget of $1,000,000 for the installation.\nmodel.addCons(500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1000000)\n# The facility has space for a maximum of 1500 solar panels.\nmodel.addCons(TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of TypeB Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of TypeC Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 756,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the number of hours each machine should operate daily to optimize production.\n// {\"number of hours for machine 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine 1 produces 10 units per hour at a cost of $5 per hour, Machine 2 produces 15 units per hour at a cost of $7 per hour, and Machine 3 produces 20 units per hour at a cost of $10 per hour. The goal is to maximize the total production units while minimizing the total cost.\n// The total production units: P = 10 * H1 + 15 * H2 + 20 * H3\n// The total cost: C = 5 * H1 + 7 * H2 + 10 * H3\n// So, the objective function is: Maximize (P - C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 80 hours per day.\n// H1 + H2 + H3 <= 80\n\n## Generate Constraint-2:\nEach machine has a maximum operating capacity. Machine 1 can operate up to 30 hours, Machine 2 up to 40 hours, and Machine 3 up to 50 hours per day.\n// H1 <= 30; H2 <= 40; H3 <= 50\n\n## Generate Constraint-3:\nThe plant must produce at least 1000 units of product per day.\n// 10 * H1 + 15 * H2 + 20 * H3 >= 1000",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the number of hours each machine should operate daily to optimize production. Each machine has a different efficiency and cost per hour. Machine 1 produces 10 units per hour at a cost of $5 per hour, Machine 2 produces 15 units per hour at a cost of $7 per hour, and Machine 3 produces 20 units per hour at a cost of $10 per hour. The goal is to maximize the total production units while minimizing the total cost. The total operating hours for all machines cannot exceed 80 hours per day. Each machine has a maximum operating capacity. Machine 1 can operate up to 30 hours, Machine 2 up to 40 hours, and Machine 3 up to 50 hours per day. The plant must produce at least 1000 units of product per day. Please help the manager to maximize the total production units while minimizing the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # number of hours for machine 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # number of hours for machine 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # number of hours for machine 3\n\n# Define objective function\n## The total production units: P = 10 * H1 + 15 * H2 + 20 * H3\n## The total cost: C = 5 * H1 + 7 * H2 + 10 * H3\n## So, the objective function is: Maximize (P - C)\nP = 10 * H1 + 15 * H2 + 20 * H3\nC = 5 * H1 + 7 * H2 + 10 * H3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - C)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 80 hours per day.\nmodel.addCons(H1 + H2 + H3 <= 80)\n## Each machine has a maximum operating capacity. Machine 1 can operate up to 30 hours, Machine 2 up to 40 hours, and Machine 3 up to 50 hours per day.\nmodel.addCons(H1 <= 30)\nmodel.addCons(H2 <= 40)\nmodel.addCons(H3 <= 50)\n## The plant must produce at least 1000 units of product per day.\nmodel.addCons(10 * H1 + 15 * H2 + 20 * H3 >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours for Machine 1: \", model.getVal(H1))\n    print(\"Number of hours for Machine 2: \", model.getVal(H2))\n    print(\"Number of hours for Machine 3: \", model.getVal(H3))\n    print(\"Maximized Production Units - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops.\n// Revenue from Crop A: R_A = 500 * A * 2\n// Revenue from Crop B: R_B = 700 * B * 3\n// Revenue from Crop C: R_C = 600 * C * 2.5\n// So, the objective function is: Maximize R_total = R_A + R_B + R_C\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100",
        "question": "A farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop. The yield per acre and the market prices for these crops are given in the following Table.\n\n| Crop | Yield per Acre | Market Price per kg |\n|------|----------------|---------------------|\n| A    | 500 kg         | $2                  |\n| B    | 700 kg         | $3                  |\n| C    | 600 kg         | $2.5                |\n\nThe farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops. The farmer has a total of 100 acres available for planting.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize his total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\nR_A = 500 * A * 2\nR_B = 700 * B * 3\nR_C = 600 * C * 2.5\nR_total = R_A + R_B + R_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_total)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products.\n// The objective function is: Maximize Profit1\n\n## Generate Constraint-1:\nThe total raw materials available for all products is limited to 1000 units.\n// R1 <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for all products is limited to 800 hours.\n// L1 <= 800\n\n## Generate Constraint-3:\nThe total machine hours available for all products is limited to 500 hours.\n// M1 <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of product 1.\n// R1 >= 50",
        "question": "A manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products.\n\nThe company has the following constraints:\n- The total raw materials available for all products is limited to 1000 units.\n- The total labor hours available for all products is limited to 800 hours.\n- The total machine hours available for all products is limited to 500 hours.\n- The company must produce at least 50 units of product 1.\n\nPlease help the company to determine the optimal allocation of raw materials (R1), labor hours (L1), and machine hours (M1) for product 1 to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=50) # raw materials for product 1\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # machine hours for product 1\n\n# Define objective function\n## The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2\n## Convert the nonlinear objective to a linear constraint by introducing new variables and constraints\nR1_sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"R1_sqrt\")\nL1_pow03 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1_pow03\")\nM1_pow02 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1_pow02\")\nmodel.addCons(R1_sqrt * R1_sqrt == R1)\nmodel.addCons(L1_pow03 * L1_pow03 * L1_pow03 == L1)\nmodel.addCons(M1_pow02 * M1_pow02 == M1)\nProfit1 = 100 * R1_sqrt * L1_pow03 * M1_pow02\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit1\nmodel.addCons(obj == Profit1)\n\n# Add constraints\n## The total raw materials available for all products is limited to 1000 units.\nmodel.addCons(R1 <= 1000)\n## The total labor hours available for all products is limited to 800 hours.\nmodel.addCons(L1 <= 800)\n## The total machine hours available for all products is limited to 500 hours.\nmodel.addCons(M1 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials for Product 1: \", model.getVal(R1))\n    print(\"Labor Hours for Product 1: \", model.getVal(L1))\n    print(\"Machine Hours for Product 1: \", model.getVal(M1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe revenue per unit of E1 is $100, the production time per unit is 1 hour, and the raw material cost per unit is $40. \nFor E2, the revenue per unit is $120, the production time per unit is 2 hours, and the raw material cost per unit is $50. \nFor E3, the revenue per unit is $150, the production time per unit is 3 hours, and the raw material cost per unit is $60.\nThe manufacturer has a limited production capacity and wants to maximize the profit per hour of production time.\n// Profit_E1 = 100 * Q1 - 40 * Q1\n// Profit_E2 = 120 * Q2 - 50 * Q2\n// Profit_E3 = 150 * Q3 - 60 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit while considering the costs of raw materials and production time. The revenue per unit of E1 is $100, the production time per unit is 1 hour, and the raw material cost per unit is $40. For E2, the revenue per unit is $120, the production time per unit is 2 hours, and the raw material cost per unit is $50. For E3, the revenue per unit is $150, the production time per unit is 3 hours, and the raw material cost per unit is $60. The manufacturer has a limited production capacity and wants to maximize the profit per hour of production time. The manufacturer has a total production time of 200 hours. Please help the manufacturer to determine the optimal production quantities of E1, E2, and E3 to maximize the profit per hour of production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (100 - 40) * Q1\nProfit_E2 = (120 - 50) * Q2\nProfit_E3 = (150 - 60) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 916,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// PA <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 50 hours per week.\n// PB <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production. The production rates and unit values for each component are given in the following Table.\n\n| Component | Production Rate per Hour | Unit Value |\n|-----------|--------------------------|------------|\n| A         | 10 units                 | $5         |\n| B         | 15 units                 | $7         |\n| C         | 20 units                 | $9         |\n\nThe company aims to maximize the total production value. The total operational hours for all lines must not exceed 120 hours per week. The production line A can operate for a maximum of 40 hours per week, and the production line B can operate for a maximum of 50 hours per week. Please help the company determine the optimal number of hours to operate each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# So, the objective function is: Maximize (VA + VB + VC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n# The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(PA <= 40)\n# The production line B can operate for a maximum of 50 hours per week.\nmodel.addCons(PB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"quantity of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Device A is $10, for Device B is $15, and for Device C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100), 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. Device A requires 5 grams, Device B requires 8 grams, and Device C requires 10 grams. The total supply of this rare metal is limited to 1500 grams.\n// 5 * A + 8 * B + 10 * C <= 1500\n\n## Generate Constraint-2:\nThere is a market demand limit for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\n// A <= 300; B <= 400; C <= 500",
        "question": "A manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit of Device A is $10, for Device B is $15, and for Device C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n\n| Device | Profit per Unit | Additional Profit per Unit over 100 |\n|--------|-----------------|-------------------------------------|\n| A      | $10             | $0.02                               |\n| B      | $15             | $0.02                               |\n| C      | $20             | $0.02                               |\n\nThe production of each device requires a specific amount of a rare metal. Device A requires 5 grams, Device B requires 8 grams, and Device C requires 10 grams. The total supply of this rare metal is limited to 1500 grams. There is also a market demand limit for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\n\nPlease help the company determine the optimal production quantities for each device to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## There is a market demand constraint for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # quantity of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=500) # quantity of Device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1364,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre.\nFor Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre.\nFor Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n// Total profit: Profit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\n// Total water usage: Water = 200 * Wheat + 250 * Corn + 150 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for seeds and fertilizers.\n// (10 * Wheat) + (12 * Corn) + (15 * Soybeans) <= 5000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 30 acres are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season. The expected yield, selling price, and water requirement for each crop are given in the following Table.\n\n| Crop       | Expected Yield (bushels/acre) | Selling Price ($/bushel) | Water Requirement (gallons/acre) |\n|------------|------------------------------|--------------------------|---------------------------------|\n| Wheat      | 50                           | 10                       | 200                             |\n| Corn       | 60                           | 12                       | 250                             |\n| Soybeans   | 40                           | 15                       | 150                             |\n\nThe farmer has 100 acres of land available for planting. The farmer has a budget of $5000 for seeds and fertilizers. The farmer wants to ensure at least 30 acres are dedicated to each crop. \nPlease help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 acres are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # number of acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # number of acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # number of acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\nWater = 200 * Wheat + 250 * Corn + 150 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget of $5000 for seeds and fertilizers.\nmodel.addCons(10 * Wheat + 12 * Corn + 15 * Soybeans <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000\n\n## Generate Constraint-2:\nDue to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentB <= 2 * ComponentA\n\n## Generate Constraint-3:\nThe market demand for ComponentC is limited to 500 units.\n// ComponentC <= 500",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints. The profit per unit of each component and the decrease in profit per unit beyond certain production levels are given in the following Table.\n\n| Component | Profit per Unit | Decrease in Profit per Unit Beyond |\n|-----------|-----------------|-----------------------------------|\n| ComponentA | $10             | $0.02 per unit beyond 100 units  |\n| ComponentB | $15             | $0.015 per unit beyond 200 units |\n| ComponentC | $20             | $0.01 per unit beyond 300 units  |\n\nThe company has a total production capacity of 1000 units across all components. Due to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA. The market demand for ComponentC is limited to 500 units.\n\nPlease help the company to maximize the total profit from the sales of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=0) # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=0) # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0) # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*A_b1 + ComponentA2*A_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * A_b2 + 10 * ComponentA1 * A_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*B_b1 + ComponentB2*B_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * B_b2 + 15 * ComponentB1 * B_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=1000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*C_b1 + ComponentC2*C_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * C_b2 + 20 * ComponentC1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\nmodel.addCons(ComponentB <= 2 * ComponentA)\nmodel.addCons(ComponentC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of his land with soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of his land with soybeans.\nPlease help the farmer determine the optimal allocation of acres for wheat, corn, and soybeans to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of soybeans\n\n# Define objective function\n## Total profit and cost for each crop\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n## Objective function: Maximize net profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans))\n\n# Add constraints\n## Total acres constraint\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Soybeans planting constraint\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_S = max(100 + 0.5 * (S - 100), 100) * S\n// Profit_T = max(150 + 0.5 * (T - 100), 150) * T\n// Profit_L = max(200 + 0.5 * (L - 100), 200) * L\n// So, the objective function is: Maximize Profit_S + Profit_T + Profit_L\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of a critical component used in all devices, which totals 5000 units. Each smartphone requires 5 units, each tablet requires 8 units, and each laptop requires 10 units of this component.\n// 5 * S + 8 * T + 10 * L <= 5000\n\n## Generate Constraint-2:\nThere is a market demand limit for each device type. The demand limit for smartphones is 500 units, for tablets is 400 units, and for laptops is 300 units.\n// S <= 500; T <= 400; L <= 300\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 1000 units in total across all device types.\n// S + T + L <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The manufacturer has a limited supply of a critical component used in all devices, which totals 5000 units. Each smartphone requires 5 units, each tablet requires 8 units, and each laptop requires 10 units of this component. There is a market demand limit for each device type. The demand limit for smartphones is 500 units, for tablets is 400 units, and for laptops is 300 units. The manufacturer also has a production capacity limit of 1000 units in total across all device types. Please help the manufacturer to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # quantity of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # quantity of laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_S = max(100 + 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 100 * S1 * S_b1 + (100 + 0.5 * (S2 - 100)) * S2 * S_b2 \n## create piecewise variables for piecewise function: Profit_T = max(150 + 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=400)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nProfit_T = 150 * T1 * T_b1 + (150 + 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Profit_L = max(200 + 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=300)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nProfit_L = 200 * L1 * L_b1 + (200 + 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_S + Profit_T + Profit_L\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L)\n\n# Add constraints\nmodel.addCons(5 * S + 8 * T + 10 * L <= 5000)\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1009,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $10, for component B is $15, and for component C is $20. The selling price for component A is $25, for component B is $30, and for component C is $40. The plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n// Profit for component A: Profit_A = (25 - 10) * A\n// Profit for component B: Profit_B = (30 - 15) * B\n// Profit for component C: Profit_C = (40 - 20) * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 20 units of each component to meet minimum order requirements.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe plant has a limited production capacity, with a maximum of 50 hours available for production. The production time for component A is 1 hour, for component B is 2 hours, and for component C is 3 hours.\n// A + 2 * B + 3 * C <= 50",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints. The production cost, selling price, and production time for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Production Time |\n|-----------|-----------------|---------------|-----------------|\n| A         | $10             | $25           | 1 hour          |\n| B         | $15             | $30           | 2 hours         |\n| C         | $20             | $40           | 3 hours         |\n\nThe plant has a budget of $1000 for production costs. The plant must produce at least 20 units of each component to meet minimum order requirements. The plant has a limited production capacity, with a maximum of 50 hours available for production. \n\nPlease help the plant to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each component to meet minimum order requirements.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The plant has a limited production capacity, with a maximum of 50 hours available for production.\nmodel.addCons(A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer wants to maximize the total production rate while considering the cost of labor. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The objective is to maximize the net production value (total production rate minus labor cost).\n// Total production rate: Production = 10 * A + 15 * B + 20 * C\n// Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n// So, the objective function is: Maximize (Production - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a total budget of $1000 per hour for labor.\n// 20 * A + 25 * B + 30 * C <= 1000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. Each worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The manufacturer wants to maximize the net production value (total production rate minus labor cost) while staying within a total budget of $1000 per hour for labor.\nPlease help the manufacturer determine the optimal number of workers to assign to each product line to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProduction = 10 * A + 15 * B + 20 * C\nCost = 20 * A + 25 * B + 30 * C\n## the objective function is: Maximize (Production - Cost)\nmodel.addCons(obj == Production - Cost)\n\n# Add constraints\n## The manufacturer has a total budget of $1000 per hour for labor.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A: \", model.getVal(A))\n    print(\"Number of Workers on Product B: \", model.getVal(B))\n    print(\"Number of Workers on Product C: \", model.getVal(C))\n    print(\"Maximized Net Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 685,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120, but these profits decrease nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit functions are defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B).\n\n| Crop   | Profit per Acre |\n|--------|-----------------|\n| Wheat  | 100$            |\n| Corn   | 150$            |\n| Barley | 120$            |\n\nThe total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with division converted to multiplication\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## Convert divisions to multiplications\nmodel.addCons(obj * (1 + 0.01 * W) == 100 * W)\nmodel.addCons(obj * (1 + 0.02 * C) == 150 * C)\nmodel.addCons(obj * (1 + 0.015 * B) == 120 * B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop.\n// {\"area for crop C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"area for crop C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yields and costs for each crop. \nFor C1, the yield per hectare is 5 tons, the cost per hectare is $1000, and the market price per ton is $200. \nFor C2, the yield per hectare is 7 tons, the cost per hectare is $1200, and the market price per ton is $250. \nFor C3, the yield per hectare is 9 tons, the cost per hectare is $1500, and the market price per ton is $300.\nThe farmer wants to maximize the profit per hectare (revenue minus cost per hectare).\n// Profit_C1 = (5 * C1 * 200) - (1000 * C1)\n// Profit_C2 = (7 * C2 * 250) - (1200 * C2)\n// Profit_C3 = (9 * C3 * 300) - (1500 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 hectares.\n// C1 + C2 + C3 <= 100",
        "question": "A farm is cultivating three types of crops: C1, C2, and C3. The farmer needs to decide the area to allocate for each crop.\nFor C1, the yield per hectare is 5 tons, the cost per hectare is $1000, and the market price per ton is $200. \nFor C2, the yield per hectare is 7 tons, the cost per hectare is $1200, and the market price per ton is $250. \nFor C3, the yield per hectare is 9 tons, the cost per hectare is $1500, and the market price per ton is $300.\nThe farmer wants to maximize the profit per hectare (revenue minus cost per hectare).\nThe total available land for cultivation is 100 hectares.\nPlease help the farmer determine the optimal area to allocate for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # area for crop C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # area for crop C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # area for crop C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * C1 * 200) - (1000 * C1)\nProfit_C2 = (7 * C2 * 250) - (1200 * C2)\nProfit_C3 = (9 * C3 * 300) - (1500 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The total available land for cultivation is 100 hectares.\nmodel.addCons(C1 + C2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop C1: \", model.getVal(C1))\n    print(\"Area for Crop C2: \", model.getVal(C2))\n    print(\"Area for Crop C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow.\n// {\"number of units of product\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"number of workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every 10 overtime hours allowed. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the product.\n// Total profit for the product: Profit = (150 - 100 + 0.5 * Overtime) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired.\n// Workers <= 50; Workers >= 10\n\n## Generate Constraint-3:\nThe total amount of overtime hours allowed cannot exceed 100 hours.\n// Overtime <= 100\n\n## Generate Constraint-4:\nThe number of units produced must be at least 200.\n// Units >= 200",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow. The cost of production per unit decreases by $5 for every 10 overtime hours allowed, with an initial production cost per unit of $100 and a selling price per unit of $150. The company aims to maximize the total profit from the product.\n\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter. The total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired. The total amount of overtime hours allowed cannot exceed 100 hours. Additionally, the number of units produced must be at least 200.\n\nPlease help the company to maximize the total profit from the product, considering the constraints provided.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=200)  # number of units of product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=10, ub=50)  # number of workers\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0, ub=100)  # amount of overtime hours\n\n# Define objective function\nProfit = (150 - 100 + 0.5 * Overtime) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Units <= 1000)\nmodel.addCons(Workers <= 50)\nmodel.addCons(Workers >= 10)\nmodel.addCons(Overtime <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 913,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product to optimize their profit while considering the cost of raw materials and the efficiency of production lines.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of raw materials for P1 is $30 per unit, and for P2 is $40 per unit. The revenue per unit for P1 is $50, and for P2 is $60. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. The initial production time per unit for P1 is 1 hour, and for P2 is 1.5 hours. The company aims to maximize the total profit from both products.\n// Profit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\n// Profit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// P1 + 1.5 * P2 <= 200 - EfficiencyInvestment\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $15,000.\n// EfficiencyInvestment <= 15000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the investment in production efficiency upgrades to optimize their profit while considering the cost of raw materials and the efficiency of production lines. The cost of raw materials, revenue per unit, and initial production time per unit for each product are given in the following Table.\n\n| Product | Cost of Raw Materials | Revenue per Unit | Initial Production Time per Unit |\n|---------|-----------------------|------------------|---------------------------------|\n| P1      | $30                   | $50              | 1 hour                           |\n| P2      | $40                   | $60              | 1.5 hours                        |\n\nThe company has a total production capacity of 200 hours. The total investment in production efficiency upgrades cannot exceed $15,000. The company can invest in production efficiency upgrades, which reduce the production time per unit by 0.1 hours for every $1000 invested. \n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in production efficiency\n\n# Define objective function\nProfit_P1 = (50 - 30) * P1 - 0.1 * EfficiencyInvestment * P1\nProfit_P2 = (60 - 40) * P2 - 0.15 * EfficiencyInvestment * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + 1.5 * P2 <= 200 - EfficiencyInvestment)\nmodel.addCons(EfficiencyInvestment <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1137,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from the crops. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used.\n// Profit_W = 200 * W - 10 * 2 * W\n// Profit_C = 300 * C - 10 * 3 * C\n// Profit_S = 250 * S - 10 * 2.5 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a budget of $1000 for water costs.\n// 2 * W + 3 * C + 2.5 * S <= 1000 / 10\n\n## Generate Constraint-3:\nThe market demand for wheat is 10 acres. So, the farmer can only plant a maximum of 10 acres of wheat.\n// W <= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 acres of soybeans to maintain soil health.\n// S >= 5",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre and water usage for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Water Usage per Acre |\n|----------|-----------------|----------------------|\n| Wheat    | $200            | 2 units              |\n| Corn     | $300            | 3 units              |\n| Soybeans | $250            | 2.5 units            |\n\nThe farmer aims to maximize his total profit from the crops while considering the water usage and its cost. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used. The total available land is 50 acres. The farmer has a budget of $1000 for water costs. The market demand for wheat is 10 acres, so the farmer can only plant a maximum of 10 acres of wheat. The farmer must also plant at least 5 acres of soybeans to maintain soil health.\n\nPlease help the farmer to determine the optimal allocation of land to each crop to maximize the net profit per unit of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W - 10 * 2 * W\nProfit_C = 300 * C - 10 * 3 * C\nProfit_S = 250 * S - 10 * 2.5 * S\nWaterUsage = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The total available land is 50 acres.\nmodel.addCons(W + C + S <= 50)\n## The farmer has a budget of $1000 for water costs.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 1000 / 10)\n## The market demand for wheat is 10 acres. So, the farmer can only plant a maximum of 10 acres of wheat.\nmodel.addCons(W <= 10)\n## The farmer must plant at least 5 acres of soybeans to maintain soil health.\nmodel.addCons(S >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale. Specifically, the profit function is given by P = Q^2, where P is the profit and Q is the quantity produced.\n// Profit_C1 = (100 * C1)^2\n// Profit_C2 = (150 * C2)^2\n// Profit_C3 = (200 * C3)^2\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\n// C1 + C2 + C3 <= 500\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 300 units.\n// C1 + C2 + C3 <= 300",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process for each chemical involves a nonlinear relationship between the quantity produced and the profit due to economies of scale, where the profit function is given by P = Q^2, with P being the profit and Q being the quantity produced. The plant has a limited amount of raw material that can produce a total of 500 units of chemicals. Additionally, the storage capacity of the plant is limited to 300 units. Please help the plant to maximize the total profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n## Profit_C1 = (100 * C1)^2\n## Profit_C2 = (150 * C2)^2\n## Profit_C3 = (200 * C3)^2\nProfit_C1 = (100 * C1)**2\nProfit_C2 = (150 * C2)**2\nProfit_C3 = (200 * C3)**2\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a total of 500 units of chemicals.\nmodel.addCons(C1 + C2 + C3 <= 500)\n## The storage capacity of the plant is limited to 300 units.\nmodel.addCons(C1 + C2 + C3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n// Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\n// So, the objective function is: Maximize Revenue\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Production <= 10000\n\n## Generate Constraint-2:\nThe total advertising budget must not exceed $50,000.\n// Advertising <= 50000\n\n## Generate Constraint-3:\nThe number of sales representatives must be at least 5 to maintain adequate customer service.\n// SalesReps >= 5",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire. Each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue. The company has a production capacity limit of 10,000 units for the quarter. The total advertising budget must not exceed $50,000. The number of sales representatives must be at least 5 to maintain adequate customer service. Please help the company to maximize the total sales revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nSalesReps = model.addVar(vtype=\"INTEGER\", name=\"SalesReps\", lb=0) # number of sales representatives\n\n# Define objective function\nRevenue = 100 * Production + 0.5 * Advertising + 20000 * SalesReps\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue)\n\n# Add constraints\nmodel.addCons(Production <= 10000) # production capacity limit\nmodel.addCons(Advertising <= 50000) # advertising budget limit\nmodel.addCons(SalesReps >= 5) # minimum number of sales representatives\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Sales Representatives: \", model.getVal(SalesReps))\n    print(\"Total Sales Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Chocolate cake is $10, per Vanilla cake is $8, and per Strawberry cake is $9. Due to the holiday demand, the profit per cake increases by $0.02 for each additional cake produced beyond 100 cakes of each type. The bakery aims to maximize the total profit from selling the cakes.\n// Profit_Chocolate = max(10 + 0.02 * (Chocolate - 100), 10) * Chocolate\n// Profit_Vanilla = max(8 + 0.02 * (Vanilla - 100), 8) * Vanilla\n// Profit_Strawberry = max(9 + 0.02 * (Strawberry - 100), 9) * Strawberry\n// So, the objective function is: Maximize Profit_Chocolate + Profit_Vanilla + Profit_Strawberry\n\n## Generate Constraint-1:\nThe bakery has a limited supply of premium ingredients that are required for each type of cake. For Chocolate, it requires 500 grams per cake, for Vanilla, 400 grams per cake, and for Strawberry, 350 grams per cake. The total supply of premium ingredients is 15 kilograms.\n// 500 * Chocolate + 400 * Vanilla + 350 * Strawberry <= 15000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. The profit per Chocolate cake is $10, per Vanilla cake is $8, and per Strawberry cake is $9. Due to the holiday demand, the profit per cake increases by $0.02 for each additional cake produced beyond 100 cakes of each type. The bakery aims to maximize the total profit from selling the cakes. The bakery has a limited supply of premium ingredients that are required for each type of cake. For Chocolate, it requires 500 grams per cake, for Vanilla, 400 grams per cake, and for Strawberry, 350 grams per cake. The total supply of premium ingredients is 15 kilograms. Please help the bakery to maximize the total profit from selling the cakes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Chocolate = max(10 + 0.02 * (Chocolate - 100), 10) * Chocolate\nChocolate1 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate1\", lb=0, ub=100)\nChocolate2 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate2\", lb=100, ub=model.infinity())\nChocolate_b1 = model.addVar(vtype=\"B\", name=\"Chocolate_b1\")\nChocolate_b2 = model.addVar(vtype=\"B\", name=\"Chocolate_b2\")\nmodel.addCons(Chocolate_b1 + Chocolate_b2 == 1)\nmodel.addCons(Chocolate == Chocolate1*Chocolate_b1 + Chocolate2*Chocolate_b2)\nProfit_Chocolate = 10 * Chocolate1 * Chocolate_b1 + (10 + 0.02 * (Chocolate2 - 100)) * Chocolate2 * Chocolate_b2\n\n## create piecewise variables for piecewise function: Profit_Vanilla = max(8 + 0.02 * (Vanilla - 100), 8) * Vanilla\nVanilla1 = model.addVar(vtype=\"INTEGER\", name=\"Vanilla1\", lb=0, ub=100)\nVanilla2 = model.addVar(vtype=\"INTEGER\", name=\"Vanilla2\", lb=100, ub=model.infinity())\nVanilla_b1 = model.addVar(vtype=\"B\", name=\"Vanilla_b1\")\nVanilla_b2 = model.addVar(vtype=\"B\", name=\"Vanilla_b2\")\nmodel.addCons(Vanilla_b1 + Vanilla_b2 == 1)\nmodel.addCons(Vanilla == Vanilla1*Vanilla_b1 + Vanilla2*Vanilla_b2)\nProfit_Vanilla = 8 * Vanilla1 * Vanilla_b1 + (8 + 0.02 * (Vanilla2 - 100)) * Vanilla2 * Vanilla_b2\n\n## create piecewise variables for piecewise function: Profit_Strawberry = max(9 + 0.02 * (Strawberry - 100), 9) * Strawberry\nStrawberry1 = model.addVar(vtype=\"INTEGER\", name=\"Strawberry1\", lb=0, ub=100)\nStrawberry2 = model.addVar(vtype=\"INTEGER\", name=\"Strawberry2\", lb=100, ub=model.infinity())\nStrawberry_b1 = model.addVar(vtype=\"B\", name=\"Strawberry_b1\")\nStrawberry_b2 = model.addVar(vtype=\"B\", name=\"Strawberry_b2\")\nmodel.addCons(Strawberry_b1 + Strawberry_b2 == 1)\nmodel.addCons(Strawberry == Strawberry1*Strawberry_b1 + Strawberry2*Strawberry_b2)\nProfit_Strawberry = 9 * Strawberry1 * Strawberry_b1 + (9 + 0.02 * (Strawberry2 - 100)) * Strawberry2 * Strawberry_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Chocolate + Profit_Vanilla + Profit_Strawberry\nmodel.addCons(obj == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited supply of premium ingredients that are required for each type of cake.\nmodel.addCons(500 * Chocolate + 400 * Vanilla + 350 * Strawberry <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla Cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry Cakes: \", model.getVal(Strawberry))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for both products is $30. The revenue generated per unit of Product A is $100 and for Product B is $150. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\n// Total profit for Product B: ProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\n// So, the objective function is: Maximize Profit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nThe production of Product A must be at least 200 units.\n// ProductA >= 200\n\n## Generate Constraint-4:\nThe production of Product B must be at least 100 units.\n// ProductB >= 100",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of two products, Product A and Product B, and the amount of money to be invested in a new energy-efficient technology that reduces the energy cost per unit produced. The initial energy cost per unit for both products is $30, and the revenue generated per unit of Product A is $100 and for Product B is $150. The energy cost per unit produced decreases by $5 for every $10,000 invested in energy efficiency upgrades.\n\n| Product | Revenue per Unit | Initial Energy Cost per Unit |\n|---------|------------------|------------------------------|\n| A       | 100$             | 30$                          |\n| B       | 150$             | 30$                          |\n\nThe company has a total production capacity of 1000 units for both products combined. The total investment in energy efficiency upgrades cannot exceed $50,000. The production of Product A must be at least 200 units, and the production of Product B must be at least 100 units.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=200)  # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100)  # production quantity of Product B\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfitA = (100 - 30 + 0.0005 * EnergyEfficiency) * ProductA\nProfitB = (150 - 30 + 0.0005 * EnergyEfficiency) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)  # total production capacity constraint\nmodel.addCons(EnergyEfficiency <= 50000)  # investment in energy efficiency constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The revenue from component A: R_A = 50 * A\n// The revenue from component B: R_B = 70 * B\n// The revenue from component C: R_C = 60 * C\n// The production cost for component A: C_A = 0.01 * A^2\n// The production cost for component B: C_B = 0.02 * B^2\n// The production cost for component C: C_C = 0.015 * C^2\n// So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe availability of a critical raw material limits the production of component A to at most 50 units.\n// A <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The total production capacity is limited to 100 units per day. The availability of a critical raw material limits the production of component A to at most 50 units. Please help the company to maximize the total profit, which is the revenue minus the production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\nR_A = 50 * A\nR_B = 70 * B\nR_C = 60 * C\nC_A = 0.01 * A**2\nC_B = 0.02 * B**2\nC_C = 0.015 * C**2\nProfit_A = R_A - C_A\nProfit_B = R_B - C_B\nProfit_C = R_C - C_C\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 810,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\n// {\"production rate of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The objective is to maximize the total profit, which is the difference between the revenue and the cost.\n// The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n// The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n// The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\n// The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total production rate cannot exceed 200 units per day.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe market demand for product 1 is at least 50 units per day.\n// P1 >= 50",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The cost for product 1 is C1 = 0.01 * P1^2 + 0.5 * P1 + 2, for product 2 is C2 = 0.02 * P2^2 + 0.8 * P2 + 3, and for product 3 is C3 = 0.03 * P3^2 + 1.0 * P3 + 4.\nThe total production rate cannot exceed 200 units per day. The market demand for product 1 is at least 50 units per day.\nPlease help the company to maximize the total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of product 3\n\n# Define objective function\nC1 = 0.01 * P1**2 + 0.5 * P1 + 2\nC2 = 0.02 * P2**2 + 0.8 * P2 + 3\nC3 = 0.03 * P3**2 + 1.0 * P3 + 4\nProfit = 5 * P1 + 10 * P2 + 15 * P3 - (C1 + C2 + C3)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200) # total production rate cannot exceed 200 units per day\nmodel.addCons(P1 >= 50) # market demand for product 1 is at least 50 units per day\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must be at least twice the production of P2.\n// P1 >= 2 * P2\n\n## Generate Constraint-4:\nThe company has a storage capacity limit of 150 units.\n// P1 + P2 + P3 <= 150",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. For product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. For product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. For product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20. The company wants to maximize the total net profit, considering both production and storage costs. The company has a total production capacity of 200 units and a budget of $10,000 for production costs. Due to market demand, the production of P1 must be at least twice the production of P2. Additionally, the company has a storage capacity limit of 150 units. Please help the company to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must be at least twice the production of P2.\nmodel.addCons(P1 >= 2 * P2)\n# The company has a storage capacity limit of 150 units.\nmodel.addCons(P1 + P2 + P3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe market demand for Crop A is limited to 20 hectares.\n// A <= 20",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop   | Profit per Hectare | Water Requirement per Hectare |\n|--------|--------------------|------------------------------|\n| A      | $1000              | 2 units                      |\n| B      | $1500              | 3 units                      |\n| C      | $2000              | 4 units                      |\n\nThe farmer has access to a total of 100 units of water. The total available land for cultivation is 50 hectares. The market demand for Crop A is limited to 20 hectares. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\nPlease help the farmer determine the optimal area to allocate for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n## The market demand for Crop A is limited to 20 hectares.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the production process is such that the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (50 * A / (1 + 0.01 * A^2) + 70 * B / (1 + 0.02 * B^2) + 90 * C / (1 + 0.03 * C^2))\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 200 units per week.\n// A >= 200",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand. The profit per unit of component A is $50, component B is $70, and component C is $90. However, the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n\n| Component | Profit per Unit |\n|-----------|-----------------|\n| A         | $50             |\n| B         | $70             |\n| C         | $90             |\n\nThe total production capacity of the factory is limited to 1000 units per week. The market demand for component A is at least 200 units per week. Please help the company to determine the optimal number of each component to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)    # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with nonlinear decrease\nProfit_A = 50 * A / (1 + 0.01 * A**2)\nProfit_B = 70 * B / (1 + 0.02 * B**2)\nProfit_C = 90 * C / (1 + 0.03 * C**2)\n\n## Convert the division to multiplication\nmodel.addCons(obj * (1 + 0.01 * A**2) == 50 * A)\nmodel.addCons(obj * (1 + 0.02 * B**2) == 70 * B)\nmodel.addCons(obj * (1 + 0.03 * C**2) == 90 * C)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1070,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\n// A >= 5; B >= 10; C >= 15\n\n## Generate Constraint-3:\nThe plant must produce at least twice as many units of product B as product A.\n// B >= 2 * A\n\n## Generate Constraint-4:\nThe total number of units produced for all products must not exceed 30 units.\n// A + B + C <= 30",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. Each unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant has a total of 100 hours available for production. The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units. The plant must produce at least twice as many units of product B as product A. The total number of units produced for all products must not exceed 30 units. Please help the plant to maximize the total profit while considering the production time constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15)  # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The plant must produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n## The total number of units produced for all products must not exceed 30 units.\nmodel.addCons(A + B + C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20\n\n## Generate Constraint-3:\nThe water supply limits the total land that can be used for corn and barley to 60 acres.\n// C + B <= 60",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for each crop decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit functions for each crop are as follows: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B).\n\n| Crop   | Profit Per Acre |\n|--------|-----------------|\n| Wheat  | $100            |\n| Corn   | $150            |\n| Barley | $120            |\n\nThe total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence. The water supply limits the total land that can be used for corn and barley to 60 acres.\n\nPlease help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with nonlinear decrease\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n## The water supply limits the total land that can be used for corn and barley to 60 acres.\nmodel.addCons(C + B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots.\n// Profit_W1 = 300 * 0.8 * W1\n// Profit_C1 = 400 * 1.2 * C1\n// Profit_B1 = 250 * 0.9 * B1\n// So, the objective function is: Maximize (Profit_W1 + Profit_C1 + Profit_B1)\n\n## Generate Constraint-1:\nThe total area of plot 1 is 50 acres.\n// W1 + C1 + B1 <= 50\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40.\n// 50 * W1 + 70 * C1 + 40 * B1 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat from plot 1 is at least 20 acres.\n// W1 >= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 acres to barley on plot 1.\n// B1 >= 10\n\n## Generate Constraint-5:\nThe farmer wants to ensure that the ratio of corn to wheat does not exceed 2:1 on plot 1.\n// C1 / W1 <= 2",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 times the acres of wheat, for corn is 1.2 times the acres of corn, and for barley is 0.9 times the acres of barley. The farmer wants to maximize the total profit from all plots.\n\n| Crop   | Profit per Acre | Yield Multiplier | Cost per Acre |\n|--------|-----------------|------------------|---------------|\n| Wheat  | $300            | 0.8              | $50           |\n| Corn   | $400            | 1.2              | $70           |\n| Barley | $250            | 0.9              | $40           |\n\nThe total area of plot 1 is 50 acres. The farmer has a limited budget for seeds and fertilizer of $10,000. The market demand for wheat from plot 1 is at least 20 acres. The farmer must allocate at least 10 acres to barley on plot 1. The farmer wants to ensure that the ratio of corn to wheat does not exceed 2:1 on plot 1.\n\nPlease help the farmer to maximize the total profit from plot 1 by determining the optimal number of acres to allocate to wheat (W1), corn (C1), and barley (B1).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of corn on plot 1\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=10) # acres of barley on plot 1\n\n# Define objective function\nProfit_W1 = 300 * 0.8 * W1\nProfit_C1 = 400 * 1.2 * C1\nProfit_B1 = 250 * 0.9 * B1\n# So, the objective function is: Maximize (Profit_W1 + Profit_C1 + Profit_B1)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W1 + Profit_C1 + Profit_B1)\n\n# Add constraints\n# The total area of plot 1 is 50 acres.\nmodel.addCons(W1 + C1 + B1 <= 50)\n# The farmer has a limited budget for seeds and fertilizer of $10,000.\nmodel.addCons(50 * W1 + 70 * C1 + 40 * B1 <= 10000)\n# The market demand for wheat from plot 1 is at least 20 acres.\nmodel.addCons(W1 >= 20)\n# The farmer must allocate at least 10 acres to barley on plot 1.\nmodel.addCons(B1 >= 10)\n# The farmer wants to ensure that the ratio of corn to wheat does not exceed 2:1 on plot 1.\nmodel.addCons(C1 <= 2 * W1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 1: \", model.getVal(C1))\n    print(\"Acres of Barley on Plot 1: \", model.getVal(B1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1305,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 units of raw material and 1 unit of labor.\nThe profit per unit of product B is $70, but it requires 3 units of raw material and 2 units of labor.\nThe profit per unit of product C is $100, but it requires 4 units of raw material and 3 units of labor.\nThe company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency.\n// Total profit: Profit = 50A + 70B + 100C\n// Resource usage: Raw material = 2A + 3B + 4C; Labor = A + 2B + 3C\n// The objective function is: Maximize Profit - k1 * (Raw material)^2 - k2 * (Labor)^2, where k1 and k2 are constants representing the cost of resource inefficiency.\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of raw material available.\n// 2A + 3B + 4C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit and resource usage. The profit per unit and the required resources for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Required | Labor Required |\n|---------|-----------------|-----------------------|----------------|\n| A       | $50             | 2 units               | 1 unit         |\n| B       | $70             | 3 units               | 2 units        |\n| C       | $100            | 4 units               | 3 units        |\n\nThe company has a total of 1000 units of raw material available. The company wants to maximize its total profit, considering the nonlinear relationship between production quantity and resource usage efficiency. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 4 * C\nLabor = A + 2 * B + 3 * C\n## The objective function is: Maximize Profit - k1 * (RawMaterial)^2 - k2 * (Labor)^2\n## Convert the quadratic terms to linear by introducing new variables and constraints\nRawMaterial_sq = model.addVar('RawMaterial_sq')\nLabor_sq = model.addVar('Labor_sq')\nmodel.addCons(RawMaterial_sq == RawMaterial**2)\nmodel.addCons(Labor_sq == Labor**2)\nk1 = 0.01  # Example constant for raw material inefficiency cost\nk2 = 0.01  # Example constant for labor inefficiency cost\nmodel.addCons(obj == Profit - k1 * RawMaterial_sq - k2 * Labor_sq)\n\n# Add constraints\n## The company has a total of 1000 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 943,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 20.\n// Cap + Res + Ind <= 20\n\n## Generate Constraint-3:\nAt least 5 machines must be dedicated to capacitors.\n// Cap >= 5\n\n## Generate Constraint-4:\nNo more than 10 machines can be used for resistors.\n// Res <= 10\n\n## Generate Constraint-5:\nThe production of inductors must not exceed 3000 units per hour.\n// 200 * Ind <= 3000",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type. Each machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 20. At least 5 machines must be dedicated to capacitors. No more than 10 machines can be used for resistors. The production of inductors must not exceed 3000 units per hour. Please help the manufacturer determine the optimal allocation of machines to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=5)  # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0, ub=10)  # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0)  # number of machines for inductors\n\n# Define objective function\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n# So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n# The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n# The total number of machines available is 20.\nmodel.addCons(Cap + Res + Ind <= 20)\n# No more than 10 machines can be used for resistors.\nmodel.addCons(Res <= 10)\n# The production of inductors must not exceed 3000 units per hour.\nmodel.addCons(200 * Ind <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Inductor Machines: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1088,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin.\n// {\"production quantity of MachineA\": \"MachineA_Qty\", \"range\": \"MachineA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineB\": \"MachineB_Qty\", \"range\": \"MachineB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity of MachineC\": \"MachineC_Qty\", \"range\": \"MachineC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Qty), Cost_B = 300 * sqrt(MachineB_Qty), Cost_C = 400 * sqrt(MachineC_Qty). The company wants to maximize the total net profit.\n// Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n// Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n// Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 machines per month.\n// MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineB_Qty <= 2 * MachineA_Qty",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production quantity of each machine to optimize their profit margin. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each machine is given by: Cost_A = 200 * sqrt(MachineA_Qty), Cost_B = 300 * sqrt(MachineB_Qty), Cost_C = 400 * sqrt(MachineC_Qty). The company wants to maximize the total net profit. The company has a total production capacity of 100 machines per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Qty\", lb=0) # production quantity of MachineA\nMachineB_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Qty\", lb=0) # production quantity of MachineB\nMachineC_Qty = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Qty\", lb=0) # production quantity of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for MachineA: Profit_A = (500 - 200 * sqrt(MachineA_Qty)) * MachineA_Qty\n## Total net profit for MachineB: Profit_B = (700 - 300 * sqrt(MachineB_Qty)) * MachineB_Qty\n## Total net profit for MachineC: Profit_C = (900 - 400 * sqrt(MachineC_Qty)) * MachineC_Qty\n## Convert square root to a variable to handle non-linearity\nsqrt_MachineA_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineA_Qty\")\nsqrt_MachineB_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineB_Qty\")\nsqrt_MachineC_Qty = model.addVar(vtype=\"CONTINUOUS\", name=\"sqrt_MachineC_Qty\")\nmodel.addCons(sqrt_MachineA_Qty**2 == MachineA_Qty)\nmodel.addCons(sqrt_MachineB_Qty**2 == MachineB_Qty)\nmodel.addCons(sqrt_MachineC_Qty**2 == MachineC_Qty)\n\nProfit_A = (500 - 200 * sqrt_MachineA_Qty) * MachineA_Qty\nProfit_B = (700 - 300 * sqrt_MachineB_Qty) * MachineB_Qty\nProfit_C = (900 - 400 * sqrt_MachineC_Qty) * MachineC_Qty\n\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 100 machines per month.\nmodel.addCons(MachineA_Qty + MachineB_Qty + MachineC_Qty <= 100)\n## Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineB_Qty <= 2 * MachineA_Qty)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of MachineA: \", model.getVal(MachineA_Qty))\n    print(\"Production Quantity of MachineB: \", model.getVal(MachineB_Qty))\n    print(\"Production Quantity of MachineC: \", model.getVal(MachineC_Qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (workers, machines, and raw materials) to maximize profit.\n// {\"number of workers for product 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"amount of raw materials for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is dependent on the number of workers, machines, and the amount of raw materials used. The profit function is nonlinear and is given by:\nProduct 1 Profit = P1 = 100 * W1^0.5 * M1^0.6 * R1^0.4\nThe company aims to maximize the total profit from product 1.\n// Formal definition: Maximize P1 = 100 * (W1^0.5) * (M1^0.6) * (R1^0.4)\n\n## Generate Constraint-1:\nThe total number of workers available across all products is 100.\n// W1 <= 100\n\n## Generate Constraint-2:\nThe total number of machines available across all products is 50.\n// M1 <= 50\n\n## Generate Constraint-3:\nThe total amount of raw materials available for all products is 200 units.\n// R1 <= 200",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (workers, machines, and raw materials) to maximize profit. The profit from each product is dependent on the number of workers, machines, and the amount of raw materials used. The profit function for product 1 is given by: Product 1 Profit = P1 = 100 * W1^0.5 * M1^0.6 * R1^0.4, where W1 is the number of workers for product 1, M1 is the number of machines for product 1, and R1 is the amount of raw materials for product 1. The company aims to maximize the total profit from product 1. The total number of workers available across all products is 100, the total number of machines available across all products is 50, and the total amount of raw materials available for all products is 200 units. Please help the company determine the optimal allocation of workers, machines, and raw materials for product 1 to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=100) # number of workers for product 1\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=50) # number of machines for product 1\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0, ub=200) # amount of raw materials for product 1\n\n# Define objective function\n## The profit function is nonlinear and is given by: P1 = 100 * (W1^0.5) * (M1^0.6) * (R1^0.4)\n## Convert the nonlinear objective to a linear form using auxiliary variables\nW1_sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"W1_sqrt\")\nM1_pow6 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1_pow6\")\nR1_pow4 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1_pow4\")\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\")\n\nmodel.setObjective(P1, \"maximize\")\n\n# Add constraints to link auxiliary variables with original variables\nmodel.addCons(W1_sqrt**2 == W1)\nmodel.addCons(M1_pow6**(1/0.6) == M1)\nmodel.addCons(R1_pow4**(1/0.4) == R1)\nmodel.addCons(P1 == 100 * W1_sqrt * M1_pow6 * R1_pow4)\n\n# Add constraints\nmodel.addCons(W1 <= 100)\nmodel.addCons(M1 <= 50)\nmodel.addCons(R1 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers for Product 1: \", model.getVal(W1))\n    print(\"Number of Machines for Product 1: \", model.getVal(M1))\n    print(\"Amount of Raw Materials for Product 1: \", model.getVal(R1))\n    print(\"Maximized Profit for Product 1: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 977,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n// Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n// So, the objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\n// MachinesA <= 10; MachinesB <= 12; MachinesC <= 8\n\n## Generate Constraint-3:\nThe company has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\n// 100 * MachinesA >= 1000\n// 150 * MachinesB >= 1500\n// 200 * MachinesC >= 2000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs. Each machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\nThe company has a total of 25 machines available for allocation. Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8. The company also has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\nPlease help the company to maximize the total production output minus the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\n## Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n## Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n## So, the objective function is: Maximize (Output - Cost)\nOutput = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\nCost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n## Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\nmodel.addCons(MachinesA <= 10)\nmodel.addCons(MachinesB <= 12)\nmodel.addCons(MachinesC <= 8)\n## The company has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\nmodel.addCons(100 * MachinesA >= 1000)\nmodel.addCons(150 * MachinesB >= 1500)\nmodel.addCons(200 * MachinesC >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear, as the profit per unit decreases when the production volume exceeds certain thresholds. Specifically, the profit per unit of product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units.\n// Profit from product A: P_A = 50 * A - 0.5 * (A - 100) / 10 if A > 100 else 50 * A\n// Profit from product B: P_B = 70 * B - 0.5 * (B - 200) / 15 if B > 200 else 70 * B\n// Profit from product C: P_C = 90 * C - 0.5 * (C - 300) / 20 if C > 300 else 90 * C\n// The objective function is: Maximize P_A + P_B + P_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 500 units per day.\n// A + B + C <= 500\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per day.\n// A >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand. The profit per unit of product A is $50, product B is $70, and product C is $90. However, the profit per unit decreases when the production volume exceeds certain thresholds: product A decreases by 1% for every 10 units produced beyond 100 units, product B decreases by 1% for every 15 units produced beyond 200 units, and product C decreases by 1% for every 20 units produced beyond 300 units. The total production capacity of the company is 500 units per day, and the market demand for product A is at least 50 units per day. Please help the company maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit from product A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=101, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nP_A = 50 * A1 * A_b1 + (50 - 0.5 * (A2 - 100) / 10) * A2 * A_b2\n\n## create piecewise variables for piecewise function: Profit from product B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=201, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nP_B = 70 * B1 * B_b1 + (70 - 0.5 * (B2 - 200) / 15) * B2 * B_b2\n\n## create piecewise variables for piecewise function: Profit from product C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=301, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nP_C = 90 * C1 * C_b1 + (90 - 0.5 * (C2 - 300) / 20) * C2 * C_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_A + P_B + P_C\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 793,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production.\n// {\"amount of chemical produced in factory 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each factory is determined by a nonlinear function of the amount of chemical produced. Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n// The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all factories must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nEach factory has a maximum production capacity. Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\n// P1 <= 400; P2 <= 350; P3 <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of the chemical to meet contractual obligations.\n// P1 + P2 + P3 >= 200",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production. The profit from each factory is determined by a nonlinear function of the amount of chemical produced: Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n\nThe company has the following constraints:\n1. The total amount of chemical produced across all factories must not exceed 1000 units.\n2. Each factory has a maximum production capacity: Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\n3. The company must produce at least 200 units of the chemical to meet contractual obligations.\n\nPlease help the company determine the optimal production levels for each factory to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # amount of chemical produced in factory 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced in factory 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced in factory 3\n\n# Define objective function\n## The profit from each factory is determined by a nonlinear function of the amount of chemical produced.\nProfit_P1 = 50 * P1 - 0.1 * P1**2\nProfit_P2 = 60 * P2 - 0.2 * P2**2\nProfit_P3 = 70 * P3 - 0.3 * P3**2\n## The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The total amount of chemical produced across all factories must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n## Each factory has a maximum production capacity.\nmodel.addCons(P1 <= 400)\nmodel.addCons(P2 <= 350)\nmodel.addCons(P3 <= 300)\n## The company must produce at least 200 units of the chemical to meet contractual obligations.\nmodel.addCons(P1 + P2 + P3 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Chemical Produced in Factory 1: \", model.getVal(P1))\n    print(\"Amount of Chemical Produced in Factory 2: \", model.getVal(P2))\n    print(\"Amount of Chemical Produced in Factory 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season.\n// {\"number of hectares for CropA\": \"HectaresA\", \"range\": \"HectaresA >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropB\": \"HectaresB\", \"range\": \"HectaresB >= 0\", \"type\": \"integer\"}\n// {\"number of hectares for CropC\": \"HectaresC\", \"range\": \"HectaresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $500, the water usage per hectare is 1000 liters, and the labor cost per hectare is $200. \nFor CropB, the expected profit per hectare is $700, the water usage per hectare is 1500 liters, and the labor cost per hectare is $300. \nFor CropC, the expected profit per hectare is $900, the water usage per hectare is 2000 liters, and the labor cost per hectare is $400.\nThe farm aims to maximize the profit-to-water usage ratio for the entire farm.\n// Total profit for CropA: Profit_A = 500 * HectaresA - 200 * HectaresA\n// Total profit for CropB: Profit_B = 700 * HectaresB - 300 * HectaresB\n// Total profit for CropC: Profit_C = 900 * HectaresC - 400 * HectaresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HectaresA + HectaresB + HectaresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm can allocate at most 40 hectares to CropA.\n// HectaresA <= 40",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many hectares to allocate to each crop for the next growing season. The expected profit per hectare, water usage per hectare, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Hectare | Water Usage per Hectare | Labor Cost per Hectare |\n|---------|-----------------------------|-------------------------|------------------------|\n| CropA   | $500                        | 1000 liters             | $200                   |\n| CropB   | $700                        | 1500 liters             | $300                   |\n| CropC   | $900                        | 2000 liters             | $400                   |\n\nThe farm has a total of 100 hectares available for cultivation. Due to soil conditions, the farm can allocate at most 40 hectares to CropA. The farm aims to maximize the profit-to-water usage ratio for the entire farm.\nPlease help the farm determine the optimal allocation of hectares to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHectaresA = model.addVar(vtype=\"INTEGER\", name=\"HectaresA\", lb=0) # number of hectares for CropA\nHectaresB = model.addVar(vtype=\"INTEGER\", name=\"HectaresB\", lb=0) # number of hectares for CropB\nHectaresC = model.addVar(vtype=\"INTEGER\", name=\"HectaresC\", lb=0) # number of hectares for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * HectaresA\nProfit_B = (700 - 300) * HectaresB\nProfit_C = (900 - 400) * HectaresC\nWaterUsage = 1000 * HectaresA + 1500 * HectaresB + 2000 * HectaresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HectaresA + HectaresB + HectaresC <= 100)\n## Due to soil conditions, the farm can allocate at most 40 hectares to CropA.\nmodel.addCons(HectaresA <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hectares for CropA: \", model.getVal(HectaresA))\n    print(\"Number of Hectares for CropB: \", model.getVal(HectaresB))\n    print(\"Number of Hectares for CropC: \", model.getVal(HectaresC))\n    print(\"Maximized Profit-to-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. Additionally, the bakery is considering investing in a new oven that can reduce baking time per cake.\n// {\"number of Chocolate cakes\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"investment in new oven\": \"OvenInvestment\", \"range\": \"OvenInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe baking time per cake decreases by 5 minutes for every $1000 invested in the new oven. The initial baking time per cake is 60 minutes. The selling price per cake is $30. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking.\n// Revenue per Chocolate cake: Revenue_Chocolate = 30 * Chocolate\n// Revenue per Vanilla cake: Revenue_Vanilla = 30 * Vanilla\n// Revenue per Strawberry cake: Revenue_Strawberry = 30 * Strawberry\n// Total revenue considering baking time: TotalRevenue = (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / (60 - 0.005 * OvenInvestment) * (Chocolate + Vanilla + Strawberry)\n// So, the objective function is: Maximize TotalRevenue\n\n## Generate Constraint-1:\nThe bakery has a budget of $10,000 for the new oven.\n// OvenInvestment <= 10000",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season and whether to invest in a new oven that can reduce baking time per cake. The selling price per cake is $30. The initial baking time per cake is 60 minutes, and investing in the new oven reduces the baking time by 5 minutes for every $1000 invested.\n\n| Cake Type | Selling Price | Initial Baking Time |\n|-----------|---------------|---------------------|\n| Chocolate | 30$           | 60 minutes          |\n| Vanilla   | 30$           | 60 minutes          |\n| Strawberry| 30$           | 60 minutes          |\n\nThe bakery has a budget of $10,000 for the new oven. The bakery aims to maximize the total revenue from all cakes, considering the time spent baking. Please help the bakery determine the optimal number of each type of cake to bake and the investment in the new oven.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0) # number of Chocolate cakes\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=0) # number of Vanilla cakes\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=0) # number of Strawberry cakes\nOvenInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"OvenInvestment\", lb=0) # investment in new oven\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_Chocolate = 30 * Chocolate\nRevenue_Vanilla = 30 * Vanilla\nRevenue_Strawberry = 30 * Strawberry\nBakingTimeReduction = 60 - 0.005 * OvenInvestment\nTotalBakingTime = (Chocolate + Vanilla + Strawberry) * BakingTimeReduction\n## the objective function is: Maximize (Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry) / TotalBakingTime\n## convert the division to multiplication\nmodel.addCons(obj * TotalBakingTime == Revenue_Chocolate + Revenue_Vanilla + Revenue_Strawberry)\n\n# Add constraints\n## The bakery has a budget of $10,000 for the new oven.\nmodel.addCons(OvenInvestment <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(Chocolate))\n    print(\"Number of Vanilla Cakes: \", model.getVal(Vanilla))\n    print(\"Number of Strawberry Cakes: \", model.getVal(Strawberry))\n    print(\"Investment in New Oven: \", model.getVal(OvenInvestment))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company wants to maximize the net profit per dollar invested.\n// Total revenue: Revenue = 200,000 * Trucks + 100,000 * Vans + 20,000 * Bikes\n// Total cost: Cost = (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes) + (10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes)\n// Net profit: Profit = Revenue - Cost\n// So, the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for vehicle purchases.\n// 100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes <= 5,000,000\n\n## Generate Constraint-2:\nThe company must have at least 50 vehicles in total.\n// Trucks + Vans + Bikes >= 50\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed twice the number of Vans.\n// Trucks <= 2 * Vans\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries.\n// Bikes >= 0.10 * (Trucks + Vans + Bikes)",
        "question": "A logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities. The cost, annual maintenance cost, and annual revenue for each type of vehicle are given in the following Table.\n\n| Vehicle | Purchase Cost | Annual Maintenance Cost | Annual Revenue |\n|---------|---------------|-------------------------|----------------|\n| Trucks  | $100,000      | $10,000                 | $200,000       |\n| Vans    | $50,000       | $5,000                  | $100,000       |\n| Bikes   | $10,000       | $1,000                  | $20,000        |\n\nThe company has a budget of $5,000,000 for vehicle purchases. The company must have at least 50 vehicles in total. The number of Trucks must not exceed twice the number of Vans. The company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries. \n\nPlease help the company to maximize the net profit per dollar invested, which is defined as the net profit divided by the total investment in vehicle purchases.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 200000 * Trucks + 100000 * Vans + 20000 * Bikes\nCost = (100000 * Trucks + 50000 * Vans + 10000 * Bikes) + (10000 * Trucks + 5000 * Vans + 1000 * Bikes)\nProfit = Revenue - Cost\nInvestment = 100000 * Trucks + 50000 * Vans + 10000 * Bikes\n## the objective function is: Maximize Profit / Investment\n## convert the division to multiplication\nmodel.addCons(obj * Investment == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for vehicle purchases.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes <= 5000000)\n## The company must have at least 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes >= 50)\n## The number of Trucks must not exceed twice the number of Vans.\nmodel.addCons(Trucks <= 2 * Vans)\n## The company wants to ensure that at least 10% of the fleet is composed of Bikes for urban deliveries.\nmodel.addCons(Bikes >= 0.10 * (Trucks + Vans + Bikes))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Net Profit per Dollar Invested: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1141,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize resource usage and profit.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $15, and product C is $20. The plant aims to maximize the total profit, which is the difference between the revenue and the cost. However, due to market saturation, the profit per unit decreases nonlinearly with the increase in production quantity. The profit function is defined as: Profit = (Revenue - Cost) * (1 - (Quantity / Market_Capacity)^2), where Market_Capacity is 1000 units for each product.\n// Revenue of A: Revenue_A = 20 * A\n// Cost of A: Cost_A = 10 * A\n// Revenue of B: Revenue_B = 30 * B\n// Cost of B: Cost_B = 15 * B\n// Revenue of C: Revenue_C = 40 * C\n// Cost of C: Cost_C = 20 * C\n// Objective function: Maximize (Revenue_A - Cost_A) * (1 - (A / 1000)^2) + (Revenue_B - Cost_B) * (1 - (B / 1000)^2) + (Revenue_C - Cost_C) * (1 - (C / 1000)^2)\n\n## Generate Constraint-1:\nThe plant has a budget of $15,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 15000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize resource usage and profit. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $15                      |\n| C       | $40             | $20                      |\n\nThe plant aims to maximize the total profit, which is the difference between the revenue and the cost. However, due to market saturation, the profit per unit decreases nonlinearly with the increase in production quantity. The profit function is defined as: Profit = (Revenue - Cost) * (1 - (Quantity / Market_Capacity)^2), where Market_Capacity is 1000 units for each product.\n\nThe plant has a budget of $15,000 for production costs. Please help the plant to determine the optimal production quantity for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 20 * A\nCost_A = 10 * A\nRevenue_B = 30 * B\nCost_B = 15 * B\nRevenue_C = 40 * C\nCost_C = 20 * C\n## Objective function: Maximize (Revenue_A - Cost_A) * (1 - (A / 1000)^2) + (Revenue_B - Cost_B) * (1 - (B / 1000)^2) + (Revenue_C - Cost_C) * (1 - (C / 1000)^2)\n## Convert the nonlinear terms to constraints\nA_squared = model.addVar(vtype=\"CONTINUOUS\", name=\"A_squared\")\nB_squared = model.addVar(vtype=\"CONTINUOUS\", name=\"B_squared\")\nC_squared = model.addVar(vtype=\"CONTINUOUS\", name=\"C_squared\")\nmodel.addCons(A_squared == A**2)\nmodel.addCons(B_squared == B**2)\nmodel.addCons(C_squared == C**2)\n## Add the objective function constraints\nmodel.addCons(obj == (Revenue_A - Cost_A) * (1 - A_squared / 1000**2) + (Revenue_B - Cost_B) * (1 - B_squared / 1000**2) + (Revenue_C - Cost_C) * (1 - C_squared / 1000**2))\n\n# Add constraints\n## The plant has a budget of $15,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1111,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z).\n// {\"amount of Material X used\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y used\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n// {\"amount of Material Z used\": \"Z\", \"range\": \"Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n// Total cost of raw materials: Cost = 5 * X + 10 * Y + 15 * Z\n// Total production output: Output = 2 * X + 3 * Y + 4 * Z (assuming each unit of raw material contributes to the output as specified)\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 5 * X + 10 * Y + 15 * Z <= 10000\n\n## Generate Constraint-2:\nThe company must use at least 500 units of Material X.\n// X >= 500\n\n## Generate Constraint-3:\nThe total amount of Material Y and Material Z used must not exceed 700 units.\n// Y + Z <= 700\n\n## Generate Constraint-4:\nThe company aims to produce at least 2000 units of output.\n// 2 * X + 3 * Y + 4 * Z >= 2000",
        "question": "A manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z). The cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials. The company has a budget of $10,000 for raw materials. The company must use at least 500 units of Material X. The total amount of Material Y and Material Z used must not exceed 700 units. The company aims to produce at least 2000 units of output. Please help the company determine the optimal amounts of Material X, Material Y, and Material Z to use.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=500) # amount of Material X used\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y used\nZ = model.addVar(vtype=\"CONTINUOUS\", name=\"Z\", lb=0) # amount of Material Z used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 5 * X + 10 * Y + 15 * Z\nOutput = 2 * X + 3 * Y + 4 * Z\n## The objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(5 * X + 10 * Y + 15 * Z <= 10000)\n## The total amount of Material Y and Material Z used must not exceed 700 units.\nmodel.addCons(Y + Z <= 700)\n## The company aims to produce at least 2000 units of output.\nmodel.addCons(2 * X + 3 * Y + 4 * Z >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Material X used: \", model.getVal(X))\n    print(\"Amount of Material Y used: \", model.getVal(Y))\n    print(\"Amount of Material Z used: \", model.getVal(Z))\n    print(\"Minimized Cost per Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for Capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Diodes\": \"Dio\", \"range\": \"Dio >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180.\n// Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n// Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $5000 per hour for operating the machines.\n// 100 * Cap + 120 * Res + 110 * Dio <= 5000\n\n## Generate Constraint-2:\nThe total number of machines available is 40.\n// Cap + Res + Dio <= 40\n\n## Generate Constraint-3:\nAt least 1000 units of each component must be produced per hour.\n// 50 * Cap >= 1000\n// 70 * Res >= 1000\n// 60 * Dio >= 1000",
        "question": "A manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type. The production rates and operating costs for each type of machine are given in the following Table.\n\n| Component | Production Rate (units/hour/machine) | Operating Cost ($/hour/machine) | Selling Price ($/unit) |\n|-----------|---------------------------------------|---------------------------------|-----------------------|\n| Capacitors | 50                                   | 100                             | 150                   |\n| Resistors  | 70                                   | 120                             | 200                   |\n| Diodes     | 60                                   | 110                             | 180                   |\n\nThe manufacturer has a budget of $5000 per hour for operating the machines. The total number of machines available is 40. At least 1000 units of each component must be produced per hour. \n\nPlease help the manufacturer to maximize the profit, which is the total production value minus the operating cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for Capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for Resistors\nDio = model.addVar(vtype=\"INTEGER\", name=\"Dio\", lb=0) # number of machines for Diodes\n\n# Define objective function\n## Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n## Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\nValue = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\nCost = 100 * Cap + 120 * Res + 110 * Dio\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $5000 per hour for operating the machines.\nmodel.addCons(100 * Cap + 120 * Res + 110 * Dio <= 5000)\n## The total number of machines available is 40.\nmodel.addCons(Cap + Res + Dio <= 40)\n## At least 1000 units of each component must be produced per hour.\nmodel.addCons(50 * Cap >= 1000)\nmodel.addCons(70 * Res >= 1000)\nmodel.addCons(60 * Dio >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Diode Machines: \", model.getVal(Dio))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop and whether to invest in a new irrigation system that affects water usage and yield. The yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer has a total of 100 acres available for planting and the total investment in the irrigation system cannot exceed $10,000. The farmer wants to ensure that at least 20 acres are dedicated to each crop. Please help the farmer to maximize the net profit from the crops, considering both the revenue and the water cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(Irrigation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: solar, wind, and hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar energy is $500, wind energy is $300, and hydro energy is $400. The efficiency of each source is 80% for solar, 90% for wind, and 75% for hydro. The company wants to minimize the total cost of energy while maximizing the total energy output.\n// Total cost: Cost = 500 * Solar + 300 * Wind + 400 * Hydro\n// Total energy output: Output = 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for energy investments.\n// 500 * Solar + 300 * Wind + 400 * Hydro <= 1000000\n\n## Generate Constraint-2:\nThe company aims to produce at least 2000 units of energy in total.\n// 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro >= 2000",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: solar, wind, and hydro. The cost per unit of solar energy is $500, wind energy is $300, and hydro energy is $400. The efficiency of each source is 80% for solar, 90% for wind, and 75% for hydro. The company has a budget of $1,000,000 for energy investments and aims to produce at least 2000 units of energy in total. The company wants to minimize the total cost of energy while maximizing the total energy output. Please help the company to minimize the total cost of energy divided by the total energy output.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * Solar + 300 * Wind + 400 * Hydro\nOutput = 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for energy investments.\nmodel.addCons(500 * Solar + 300 * Wind + 400 * Hydro <= 1000000)\n## The company aims to produce at least 2000 units of energy in total.\nmodel.addCons(0.8 * Solar + 0.9 * Wind + 0.75 * Hydro >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Energy: \", model.getVal(Solar))\n    print(\"Amount of Wind Energy: \", model.getVal(Wind))\n    print(\"Amount of Hydro Energy: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 625,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200\n\n## Generate Constraint-2:\nThe total raw material available per day is 250 units.\n// 3A + 2B + C <= 250\n\n## Generate Constraint-3:\nThe market demand for product A is at least 5 units.\n// A >= 5\n\n## Generate Constraint-4:\nThe market demand for product B is at least 10 units.\n// B >= 10\n\n## Generate Constraint-5:\nThe market demand for product C is at least 8 units.\n// C >= 8",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand. The profit per unit, labor hours required, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Units Required |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $50             | 2                    | 3                           |\n| B       | $70             | 3                    | 2                           |\n| C       | $60             | 4                    | 1                           |\n\nThe total labor hours available per day are 200 hours. The total raw material available per day is 250 units. The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 8 units. \n\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=8)  # number of units of product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 4 * C <= 200)  # Total labor hours constraint\nmodel.addCons(3 * A + 2 * B + C <= 250)  # Total raw material constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1063,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20 - 10) * A = 20 * A\n// Profit of product B: Profit_B = (70 - 30 - 15) * B = 25 * B\n// Profit of product C: Profit_C = (100 - 40 - 20) * C = 40 * C\n// So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a labor capacity constraint of 500 hours for the next quarter. The labor time required for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor. The selling price, raw material cost, labor cost, and labor time for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Labor Cost | Labor Time |\n|---------|---------------|-------------------|------------|------------|\n| A       | $50           | $20               | $10        | 2 hours    |\n| B       | $70           | $30               | $15        | 3 hours    |\n| C       | $100          | $40               | $20        | 4 hours    |\n\nThe company has a budget of $10,000 for raw materials for the next quarter. The company has a labor capacity constraint of 500 hours for the next quarter. The labor time required for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n\nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 25 * B\nProfit_C = 40 * C\n## the objective function is: Maximize (20 * A + 25 * B + 40 * C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a labor capacity constraint of 500 hours for the next quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process.\n// {\"amount of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy optimization\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\n// Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe investment in energy optimization cannot exceed $50,000.\n// EnergyInvestment <= 50000\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of each product.\n// ProductA >= 10\n// ProductB >= 10\n// ProductC >= 10",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process. The profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\nThe total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units. The investment in energy optimization cannot exceed $50,000. The manufacturer must produce at least 10 units of each product.\nPlease help the manufacturer to determine the optimal production quantities of products A, B, and C, and the optimal investment in energy optimization to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # amount of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=10) # amount of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=10) # amount of product C\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0) # investment in energy optimization\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of raw material available is limited.\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\n## The investment in energy optimization cannot exceed $50,000.\nmodel.addCons(EnergyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Energy Optimization: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer has a total of 10 acres of land. The yield per acre for C1 is 500 kg, for C2 is 600 kg, and for C3 is 700 kg. The selling price per kg for C1 is $2, for C2 is $3, and for C3 is $4. The farmer wants to maximize his total revenue.\n// Revenue_C1 = 500 * A1 * 2\n// Revenue_C2 = 600 * A2 * 3\n// Revenue_C3 = 700 * A3 * 4\n// So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 10 acres of land.\n// A1 + A2 + A3 <= 10\n\n## Generate Constraint-2:\nDue to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\n// A1 + A2 <= 6\n\n## Generate Constraint-3:\nThe farmer must allocate at least 1 acre to C3.\n// A3 >= 1\n\n## Generate Constraint-4:\nThe farmer has a limited water supply, which affects the yield. The yield per acre for C1 decreases by 10% for each acre of C2, and the yield per acre for C2 decreases by 15% for each acre of C1.\n// 500 * A1 * (1 - 0.1 * A2) >= 0\n// 600 * A2 * (1 - 0.15 * A1) >= 0",
        "question": "A farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop. The farmer has a total of 10 acres of land. The yield per acre for C1 is 500 kg, for C2 is 600 kg, and for C3 is 700 kg. The selling price per kg for C1 is $2, for C2 is $3, and for C3 is $4. The farmer wants to maximize his total revenue. Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres. The farmer must allocate at least 1 acre to C3. The farmer has a limited water supply, which affects the yield. The yield per acre for C1 decreases by 10% for each acre of C2, and the yield per acre for C2 decreases by 15% for each acre of C1. Please help the farmer to maximize his total revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\nRevenue_C1 = 500 * A1 * 2\nRevenue_C2 = 600 * A2 * 3\nRevenue_C3 = 700 * A3 * 4\n# So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n# Add constraints\n# The farmer has a total of 10 acres of land.\nmodel.addCons(A1 + A2 + A3 <= 10)\n# Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\nmodel.addCons(A1 + A2 <= 6)\n# The farmer must allocate at least 1 acre to C3.\nmodel.addCons(A3 >= 1)\n# The farmer has a limited water supply, which affects the yield. The yield per acre for C1 decreases by 10% for each acre of C2, and the yield per acre for C2 decreases by 15% for each acre of C1.\nmodel.addCons(500 * A1 * (1 - 0.1 * A2) >= 0)\nmodel.addCons(600 * A2 * (1 - 0.15 * A1) >= 0)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for C1: \", model.getVal(A1))\n    print(\"Area of land for C2: \", model.getVal(A2))\n    print(\"Area of land for C3: \", model.getVal(A3))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| A    | $1000               | 2 units                       |\n| B    | $1500               | 3 units                       |\n| C    | $2000               | 4 units                       |\n\nThe farmer has access to a total of 100 units of water. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\nPlease help the farmer determine the optimal area to allocate for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the amount of money to invest in improving the production efficiency of each product.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency for product A\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency for product B\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency for product C\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of each product decreases by $5 for every $1,000 invested in efficiency improvements. The initial production cost for product A is $100, for product B is $150, and for product C is $200. The selling price for each product is $200. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (200 - (100 - 0.005 * EfficiencyA)) * ProductA\n// Total profit for product B: ProfitB = (200 - (150 - 0.005 * EfficiencyB)) * ProductB\n// Total profit for product C: ProfitC = (200 - (200 - 0.005 * EfficiencyC)) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in production efficiency improvements cannot exceed $100,000.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 10,000 units for product A, 8,000 units for product B, and 5,000 units for product C.\n// ProductA <= 10000\n// ProductB <= 8000\n// ProductC <= 5000\n\n## Generate Constraint-3:\nThe company must produce at least 2,000 units of product A, 1,500 units of product B, and 1,000 units of product C.\n// ProductA >= 2000\n// ProductB >= 1500\n// ProductC >= 1000\n\n## Generate Constraint-4:\nThe total production quantity of all products must not exceed 15,000 units.\n// ProductA + ProductB + ProductC <= 15000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the amount of money to invest in improving the production efficiency of each product. The production cost of each product decreases by $5 for every $1,000 invested in efficiency improvements. The initial production cost for product A is $100, for product B is $150, and for product C is $200. The selling price for each product is $200. The company aims to maximize the total profit from all products. The total investment in production efficiency improvements cannot exceed $100,000. The company has a production capacity limit of 10,000 units for product A, 8,000 units for product B, and 5,000 units for product C. The company must produce at least 2,000 units of product A, 1,500 units of product B, and 1,000 units of product C. The total production quantity of all products must not exceed 15,000 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=2000, ub=10000)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=1500, ub=8000)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=1000, ub=5000)  # quantity of product C\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in production efficiency for product A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in production efficiency for product B\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in production efficiency for product C\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * EfficiencyA)) * ProductA\nProfitB = (200 - (150 - 0.005 * EfficiencyB)) * ProductB\nProfitC = (200 - (200 - 0.005 * EfficiencyC)) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 100000)  # total investment in production efficiency improvements\nmodel.addCons(ProductA + ProductB + ProductC <= 15000)  # total production quantity of all products\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Efficiency A: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency B: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency C: \", model.getVal(EfficiencyC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre.\nFor Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre.\nFor Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n// Total profit: Profit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\n// Total water usage: Water = 200 * Wheat + 250 * Corn + 150 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for seeds and fertilizers.\n// (10 * Wheat) + (12 * Corn) + (15 * Soybeans) <= 5000",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season. The expected yield, selling price, and water requirement for each crop are given in the following Table.\n\n| Crop       | Expected Yield (bushels/acre) | Selling Price ($/bushel) | Water Requirement (gallons/acre) |\n|------------|-------------------------------|--------------------------|---------------------------------|\n| Wheat      | 50                            | 10                       | 200                             |\n| Corn       | 60                            | 12                       | 250                             |\n| Soybeans   | 40                            | 15                       | 150                             |\n\nThe farmer has 100 acres of land available for planting. The farmer also has a budget of $5000 for seeds and fertilizers. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\nPlease help the farmer determine the optimal number of acres to plant for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # number of acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # number of acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # number of acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\nWater = 200 * Wheat + 250 * Corn + 150 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget of $5000 for seeds and fertilizers.\nmodel.addCons(10 * Wheat + 12 * Corn + 15 * Soybeans <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n// Profit per unit of product A: ProfitA = 50 - 2 * Automation\n// Profit per unit of product B: ProfitB = 70 - 2 * Automation\n// Profit per unit of product C: ProfitC = 60 - 2 * Automation\n// Total profit: TotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process. The profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50 - 2 * Automation |\n| B       | 70 - 2 * Automation |\n| C       | 60 - 2 * Automation |\n\nThe company has a production capacity limit of 1000 units in total for all products. The investment in automation cannot exceed $50,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = 50 - 2 * Automation\nProfitB = 70 - 2 * Automation\nProfitC = 60 - 2 * Automation\nTotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E).\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation over a 10-year period. The cost function is nonlinear and includes initial installation costs and annual operational costs. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n// Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for initial installation.\n// 1000 * S + 2000 * W + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it.\n// 100 * S + 200 * W >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E). The company aims to minimize the total cost of installation and operation over a 10-year period. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit. The company has a budget of $100,000 for initial installation. The total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it. Please help the company to minimize the total cost of installation and operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\nTotalCost = 1000 * S + 2000 * W + 3000 * E + 10 * (50 * S + 100 * W + 150 * E)\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $100,000 for initial installation.\nmodel.addCons(1000 * S + 2000 * W + 3000 * E <= 100000)\n## The total annual energy output must be at least 50,000 kWh.\nmodel.addCons(100 * S + 200 * W >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Number of Energy Storage Systems: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $20 per unit.\nThe profit per unit of product B is $30, with a simpler production process costing $10 per unit.\nThe profit per unit of product C is $40, with an intermediate production process costing $15 per unit.\nThe company wants to maximize the total net profit, which is the difference between the total profit and the total production cost.\n// Total profit: Profit = 50 * A + 30 * B + 40 * C\n// Total production cost: Cost = 20 * A + 10 * B + 15 * C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours.\n// 2 * A + 1 * B + 1.5 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe company must produce at least twice as many units of product B as product A due to a contractual agreement.\n// B >= 2 * A\n\n## Generate Constraint-4:\nThe company cannot produce more than 500 units of product C due to storage limitations.\n// C <= 500",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit of product A is $50, but it requires a complex production process with a cost of $20 per unit. The profit per unit of product B is $30, with a simpler production process costing $10 per unit. The profit per unit of product C is $40, with an intermediate production process costing $15 per unit. The company wants to maximize the total net profit, which is the difference between the total profit and the total production cost.\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours. The market demand for product A is at least 100 units per week. The company must produce at least twice as many units of product B as product A due to a contractual agreement. The company cannot produce more than 500 units of product C due to storage limitations.\nPlease help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=500) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 30 * B + 40 * C\n## Total production cost: Cost = 20 * A + 10 * B + 15 * C\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 30 * B + 40 * C\nCost = 20 * A + 10 * B + 15 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 1 * B + 1.5 * C <= 1000)\n## The company must produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n// Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n// Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n// Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints. The profit per unit for each component and the production cost per unit as a function of the number of units produced are given in the following Table.\n\n| Component | Profit per Unit | Production Cost Function |\n|-----------|-----------------|--------------------------|\n| ComponentA | $50 | 20 * sqrt(UnitsA) |\n| ComponentB | $70 | 30 * sqrt(UnitsB) |\n| ComponentC | $90 | 40 * sqrt(UnitsC) |\n\nThe company has a total production capacity of 1000 units per week. Please help the company to maximize the total net profit, which is the sum of the net profit for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n## Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n## Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n## Convert square root to a variable to handle non-linearity\nsqrt_UnitsA = model.addVar(name=\"sqrt_UnitsA\")\nsqrt_UnitsB = model.addVar(name=\"sqrt_UnitsB\")\nsqrt_UnitsC = model.addVar(name=\"sqrt_UnitsC\")\nmodel.addCons(sqrt_UnitsA * sqrt_UnitsA == UnitsA)\nmodel.addCons(sqrt_UnitsB * sqrt_UnitsB == UnitsB)\nmodel.addCons(sqrt_UnitsC * sqrt_UnitsC == UnitsC)\n\nProfitA = (50 - 20 * sqrt_UnitsA) * UnitsA\nProfitB = (70 - 30 * sqrt_UnitsB) * UnitsB\nProfitC = (90 - 40 * sqrt_UnitsC) * UnitsC\n\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit.\n// {\"acres of Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yield rates and profit margins for each crop. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops.\n// Total profit from Wheat: Profit_Wheat = 50 * 10 * WheatAcres\n// Total profit from Corn: Profit_Corn = 60 * 12 * CornAcres\n// Total profit from Soybeans: Profit_Soybeans = 40 * 15 * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\n// CornAcres <= 40\n\n## Generate Constraint-3:\nTo maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop.\n// WheatAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)\n// CornAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)\n// SoybeansAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit. The yield rates and profit margins for each crop are given in the following Table.\n\n| Crop       | Yield Rate (bushels/acre) | Profit per Bushel |\n|------------|--------------------------|-------------------|\n| Wheat      | 50                       | $10               |\n| Corn       | 60                       | $12               |\n| Soybeans   | 40                       | $15               |\n\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn. To maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop. \n\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of Soybeans\n\n# Define objective function\nProfit_Wheat = 50 * 10 * WheatAcres\nProfit_Corn = 60 * 12 * CornAcres\nProfit_Soybeans = 40 * 15 * SoybeansAcres\n# So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The farm has a total of 100 acres available for cultivation.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n# Due to soil conditions, the farm can only allocate a maximum of 40 acres to Corn.\nmodel.addCons(CornAcres <= 40)\n# To maintain crop diversity and reduce risk, the farm must allocate at least 20% of the total acres to each crop.\nmodel.addCons(WheatAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\nmodel.addCons(CornAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\nmodel.addCons(SoybeansAcres >= 0.2 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA_Quantity\", \"range\": \"DeviceA_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB_Quantity\", \"range\": \"DeviceB_Quantity >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC_Quantity\", \"range\": \"DeviceC_Quantity >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n// Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n// Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least half the production of DeviceB.\n// DeviceA_Quantity >= 0.5 * DeviceB_Quantity\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which is $50,000. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, and for DeviceC is $20 per unit.\n// 10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50,000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to decide the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for DeviceA is modeled as 0.01 * (DeviceA_Quantity^2), for DeviceB as 0.02 * (DeviceB_Quantity^2), and for DeviceC as 0.03 * (DeviceC_Quantity^2). The company has a total production capacity of 1000 units for all devices combined. Due to market demand, the production of DeviceA must be at least half the production of DeviceB. The company has a limited budget for raw materials, which is $50,000. The cost of raw materials for DeviceA is $10 per unit, for DeviceB is $15 per unit, and for DeviceC is $20 per unit.\n\nPlease help the company to maximize the total net profit from the production of these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Quantity\", lb=0)\nDeviceB_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Quantity\", lb=0)\nDeviceC_Quantity = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Quantity\", lb=0)\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - 0.01 * (DeviceA_Quantity^2)) * DeviceA_Quantity\n## Total net profit for DeviceB: Profit_DeviceB = (70 - 0.02 * (DeviceB_Quantity^2)) * DeviceB_Quantity\n## Total net profit for DeviceC: Profit_DeviceC = (90 - 0.03 * (DeviceC_Quantity^2)) * DeviceC_Quantity\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - 0.01 * DeviceA_Quantity**2) * DeviceA_Quantity\nProfit_DeviceB = (70 - 0.02 * DeviceB_Quantity**2) * DeviceB_Quantity\nProfit_DeviceC = (90 - 0.03 * DeviceC_Quantity**2) * DeviceC_Quantity\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_Quantity + DeviceB_Quantity + DeviceC_Quantity <= 1000)\n## Due to market demand, the production of DeviceA must be at least half the production of DeviceB.\nmodel.addCons(DeviceA_Quantity >= 0.5 * DeviceB_Quantity)\n## The company has a limited budget for raw materials, which is $50,000.\nmodel.addCons(10 * DeviceA_Quantity + 15 * DeviceB_Quantity + 20 * DeviceC_Quantity <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA_Quantity))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB_Quantity))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC_Quantity))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit.\n// Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n// Profit from product B: Profit_B = 70 * B - 5 * B\n// Profit from product C: Profit_C = 100 * C - 1000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe production of product A cannot exceed 300 units due to limited raw material availability.\n// A <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit. The profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit. The company has a total production capacity of 1000 units across all products. The production of product A cannot exceed 300 units due to limited raw material availability. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n## Profit from product B: Profit_B = 70 * B - 5 * B\n## Profit from product C: Profit_C = 100 * C - 1000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 50 * A - 0.1 * A**2\nProfit_B = 70 * B - 5 * B\nProfit_C = 100 * C - 1000\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit.\n// {\"hours of operation for greenhouse A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach greenhouse has different efficiency and cost structures. \nGreenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. \nGreenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. \nGreenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. \nThe farm aims to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n// Profit from A: Profit_A = (10 * 15 - 5) * HA\n// Profit from B: Profit_B = (15 * 20 - 7) * HB\n// Profit from C: Profit_C = (20 * 25 - 9) * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (HA + HB + HC)\n\n## Generate Constraint-1:\nThe farm has a total budget of $300 per day for operating the greenhouses.\n// 5 * HA + 7 * HB + 9 * HC <= 300\n\n## Generate Constraint-2:\nEach greenhouse must operate at least 4 hours per day.\n// HA >= 4; HB >= 4; HC >= 4\n\n## Generate Constraint-3:\nThe total operating hours for all greenhouses combined must not exceed 20 hours per day.\n// HA + HB + HC <= 20",
        "question": "A farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit. The efficiency, cost, and selling price per kg for each greenhouse are given in the following Table.\n\n| Greenhouse | Produce per Hour | Cost per Hour | Selling Price per kg |\n|------------|------------------|---------------|----------------------|\n| A          | 10 kg            | 5$            | 15$                  |\n| B          | 15 kg            | 7$            | 20$                  |\n| C          | 20 kg            | 9$            | 25$                  |\n\nThe farm has a total budget of $300 per day for operating the greenhouses. Each greenhouse must operate at least 4 hours per day. The total operating hours for all greenhouses combined must not exceed 20 hours per day. \nPlease help the farm to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=4) # hours of operation for greenhouse A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=4) # hours of operation for greenhouse B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=4) # hours of operation for greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 * 15 - 5) * HA\nProfit_B = (15 * 20 - 7) * HB\nProfit_C = (20 * 25 - 9) * HC\nOperatingHours = HA + HB + HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / OperatingHours\n## convert the division to multiplication\nmodel.addCons(obj * OperatingHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total budget of $300 per day for operating the greenhouses.\nmodel.addCons(5 * HA + 7 * HB + 9 * HC <= 300)\n## The total operating hours for all greenhouses combined must not exceed 20 hours per day.\nmodel.addCons(HA + HB + HC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Greenhouse A: \", model.getVal(HA))\n    print(\"Hours of Operation for Greenhouse B: \", model.getVal(HB))\n    print(\"Hours of Operation for Greenhouse C: \", model.getVal(HC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 980,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using three different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit.\n// {\"hours machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and production cost. Machine 1 produces 10 units per hour with a cost of $5 per hour. Machine 2 produces 15 units per hour with a cost of $7 per hour. Machine 3 produces 20 units per hour with a cost of $9 per hour. The selling price for each unit is $10. The company aims to maximize the profit from the production.\n// Profit from machine 1: P1 = 10 * (10 * M1) - 5 * M1\n// Profit from machine 2: P2 = 15 * (10 * M2) - 7 * M2\n// Profit from machine 3: P3 = 20 * (10 * M3) - 9 * M3\n// The objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 100 hours per day.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing company produces three types of products using three different machines. The company needs to determine the optimal number of hours each machine should operate to maximize profit. Each machine has a different efficiency and production cost. Machine 1 produces 10 units per hour with a cost of $5 per hour. Machine 2 produces 15 units per hour with a cost of $7 per hour. Machine 3 produces 20 units per hour with a cost of $9 per hour. The selling price for each unit is $10. The company aims to maximize the profit from the production. The total operating hours for all machines cannot exceed 100 hours per day. Please help the company to determine the optimal number of hours each machine should operate to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours machine 3 operates\n\n# Define objective function\n## Profit from machine 1: P1 = 10 * (10 * M1) - 5 * M1\n## Profit from machine 2: P2 = 15 * (10 * M2) - 7 * M2\n## Profit from machine 3: P3 = 20 * (10 * M3) - 9 * M3\nP1 = 10 * (10 * M1) - 5 * M1\nP2 = 15 * (10 * M2) - 7 * M2\nP3 = 20 * (10 * M3) - 9 * M3\n## The objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 100 hours per day.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 Operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 Operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 Operates: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season.\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Beans\": \"BeansAcres\", \"range\": \"BeansAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor Beans, the expected profit per acre is $300, the water usage per acre is 1500 gallons, and the labor cost per acre is $75. \nFor Wheat, the expected profit per acre is $400, the water usage per acre is 1800 gallons, and the labor cost per acre is $90.\nThe farmer aims to maximize the net profit per gallon of water used.\n// Net profit for Corn: Profit_Corn = (500 - 100) * CornAcres\n// Net profit for Beans: Profit_Beans = (300 - 75) * BeansAcres\n// Net profit for Wheat: Profit_Wheat = (400 - 90) * WheatAcres\n// So, the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / (2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// CornAcres + BeansAcres + WheatAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\n// BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres)\n\n## Generate Constraint-3:\nThe farmer has a water supply limit of 150,000 gallons for the season.\n// 2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres <= 150,000",
        "question": "A farmer is planning to plant three types of crops: Corn, Beans, and Wheat. The farmer needs to decide how many acres to allocate to each crop for the upcoming growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop   | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|--------|--------------------------|----------------------|---------------------|\n| Corn   | $500                     | 2000 gallons         | $100                |\n| Beans  | $300                     | 1500 gallons         | $75                 |\n| Wheat  | $400                     | 1800 gallons         | $90                 |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans. The farmer has a water supply limit of 150,000 gallons for the season. \nPlease help the farmer to maximize the net profit per gallon of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nBeansAcres = model.addVar(vtype=\"INTEGER\", name=\"BeansAcres\", lb=0) # number of acres for Beans\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # number of acres for Wheat\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (500 - 100) * CornAcres\nProfit_Beans = (300 - 75) * BeansAcres\nProfit_Wheat = (400 - 90) * WheatAcres\nWaterUsage = 2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres\n## the objective function is: Maximize (Profit_Corn + Profit_Beans + Profit_Wheat) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Beans + Profit_Wheat)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(CornAcres + BeansAcres + WheatAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 30% of the total acres in Beans.\nmodel.addCons(BeansAcres >= 0.3 * (CornAcres + BeansAcres + WheatAcres))\n## The farmer has a water supply limit of 150,000 gallons for the season.\nmodel.addCons(2000 * CornAcres + 1500 * BeansAcres + 1800 * WheatAcres <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Beans: \", model.getVal(BeansAcres))\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel efficiency and maintenance costs. \nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\n// Operational cost for TruckA: Cost_TruckA = 500 / 10 * TruckA\n// Operational cost for TruckB: Cost_TruckB = 700 / 15 * TruckB\n// Operational cost for TruckC: Cost_TruckC = 900 / 20 * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per month for vehicle maintenance.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC <= 10,000",
        "question": "A logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\nThe company has a total budget of $10,000 per month for vehicle maintenance.\nPlease help the company to minimize the total operational cost (which is the sum of the operational costs for each type of truck).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = 500 / 10 * TruckA\nCost_TruckB = 700 / 15 * TruckB\nCost_TruckC = 900 / 20 * TruckC\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n## The company has a total budget of $10,000 per month for vehicle maintenance.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate based on the number of workers assigned. \nOn production line 1, each worker contributes to a production rate of 10 units per hour. \nOn production line 2, each worker contributes to a production rate of 15 units per hour. \nOn production line 3, each worker contributes to a production rate of 20 units per hour. \nHowever, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). \nThe objective is to maximize the total production rate of all three lines.\n// The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n// The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\n// The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\n// So, the objective function is: Maximize R1 + R2 + R3\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// P1 + P2 + P3 <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// P1 <= 25; P2 <= 25; P3 <= 25\n\n## Generate Constraint-3:\nThe company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of electronic components on three different production lines. The manager needs to determine the optimal number of workers to assign to each production line to maximize efficiency. Each production line has a different efficiency rate based on the number of workers assigned. On production line 1, each worker contributes to a production rate of 10 units per hour. On production line 2, each worker contributes to a production rate of 15 units per hour. On production line 3, each worker contributes to a production rate of 20 units per hour. However, the efficiency of each line decreases nonlinearly as more workers are added due to congestion and management overhead. The efficiency function is given by: Efficiency = (Number of Workers) / (1 + 0.1 * (Number of Workers)^2). The objective is to maximize the total production rate of all three lines.\nThere are total 60 workers available. Each production line can be utilized by up to 25 workers at a time. The company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\nPlease help the manager to maximize the total production rate of all three lines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company requires that at least 10 workers are assigned to each production line to ensure basic operational capabilities.\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=10) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The production rate for production line 1: R1 = 10 * P1 / (1 + 0.1 * P1^2)\n## convert the division to multiplication\nR1 = model.addVar('R1')\nmodel.addCons(R1 * (1 + 0.1 * P1**2) == 10 * P1)\n## The production rate for production line 2: R2 = 15 * P2 / (1 + 0.1 * P2^2)\nR2 = model.addVar('R2')\nmodel.addCons(R2 * (1 + 0.1 * P2**2) == 15 * P2)\n## The production rate for production line 3: R3 = 20 * P3 / (1 + 0.1 * P3^2)\nR3 = model.addVar('R3')\nmodel.addCons(R3 * (1 + 0.1 * P3**2) == 20 * P3)\n## So, the objective function is: Maximize R1 + R2 + R3\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\n## There are total 60 workers available.\nmodel.addCons(P1 + P2 + P3 <= 60)\n## Each production line can be utilized by up to 25 workers at a time.\nmodel.addCons(P1 <= 25)\nmodel.addCons(P2 <= 25)\nmodel.addCons(P3 <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25\n\n## Generate Constraint-3:\nTo ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n// TruckB >= 0.5 * TruckA",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day. The company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A. Please help the company to minimize the total fuel consumption of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Warehouse C\n\n# Define objective function\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n# So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n# To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\nmodel.addCons(TruckB >= 0.5 * TruckA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per hectare for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield.\n// Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n// Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n// Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm must allocate at least 20 hectares to crop A and 15 hectares to crop B.\n// A >= 20; B >= 15",
        "question": "A farm needs to allocate land for three different crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its yield and profit. The yield per hectare for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The farm aims to maximize the total revenue from selling the crops, considering the nonlinear relationship between land allocation and yield. The total available land for farming is 100 hectares. The farm must allocate at least 20 hectares to crop A and 15 hectares to crop B. Please help the farm to maximize the total revenue from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=15) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Revenue from crop A: Revenue_A = 5 * A^0.8 * 100\n## Revenue from crop B: Revenue_B = 7 * B^0.8 * 120\n## Revenue from crop C: Revenue_C = 9 * C^0.8 * 150\n## So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\nRevenue_A = 5 * A**0.8 * 100\nRevenue_B = 7 * B**0.8 * 120\nRevenue_C = 9 * C**0.8 * 150\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The total available land for farming is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to crop A: \", model.getVal(A))\n    print(\"Land allocated to crop B: \", model.getVal(B))\n    print(\"Land allocated to crop C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 704,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production.\n// Impact_E = 1000 * E / 20000\n// Impact_H = 500 * H / 15000\n// Impact_Hy = 800 * Hy / 25000\n// So, the objective function is: Maximize (Impact_E + Impact_H + Impact_Hy)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E + 15000 * H + 25000 * Hy <= 1000000",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand. The environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production. The manufacturer has a total production budget of $1,000,000. Please help the manufacturer to determine the optimal production quantities for each type of vehicle.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0) # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_E = 1000 * E / 20000\nImpact_H = 500 * H / 15000\nImpact_Hy = 800 * Hy / 25000\n## convert the division to multiplication\nmodel.addCons(obj * (20000 * E + 15000 * H + 25000 * Hy) == 1000 * E + 500 * H + 800 * Hy)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E + 15000 * H + 25000 * Hy <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for component A\": \"M_A\", \"range\": \"M_A >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M_B\", \"range\": \"M_B >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M_C\", \"range\": \"M_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, with a maintenance cost of $5 per hour. Each machine for component B produces 15 units per hour, with a maintenance cost of $7 per hour. Each machine for component C produces 20 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n// Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n// The objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * M_A + 7 * M_B + 9 * M_C <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 100.\n// M_A + M_B + M_C <= 100",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of machines dedicated to each type. The production and maintenance costs for each component are given in the following Table.\n\n| Component | Production Rate (units/hour) | Maintenance Cost ($/hour) |\n|-----------|-------------------------------|---------------------------|\n| A         | 10                            | 5                         |\n| B         | 15                            | 7                         |\n| C         | 20                            | 9                         |\n\nThe manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 100. The manufacturer wants to maximize the total production output while minimizing the total maintenance cost. Please help the manufacturer determine the optimal number of machines for each component to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM_A = model.addVar(vtype=\"INTEGER\", name=\"M_A\", lb=0) # number of machines for component A\nM_B = model.addVar(vtype=\"INTEGER\", name=\"M_B\", lb=0) # number of machines for component B\nM_C = model.addVar(vtype=\"INTEGER\", name=\"M_C\", lb=0) # number of machines for component C\n\n# Define objective function\n## Total production output: Output = 10 * M_A + 15 * M_B + 20 * M_C\n## Total maintenance cost: Cost = 5 * M_A + 7 * M_B + 9 * M_C\n## The objective function is: Maximize (Output - Cost)\nOutput = 10 * M_A + 15 * M_B + 20 * M_C\nCost = 5 * M_A + 7 * M_B + 9 * M_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * M_A + 7 * M_B + 9 * M_C <= 1500)\n## The total number of machines available is 100.\nmodel.addCons(M_A + M_B + M_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M_A))\n    print(\"Number of Machines for Component B: \", model.getVal(M_B))\n    print(\"Number of Machines for Component C: \", model.getVal(M_C))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency.\n// {\"number of workers on production unit 1\": \"U1\", \"range\": \"U1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"U2\", \"range\": \"U2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"U3\", \"range\": \"U3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production unit has a different efficiency in producing the components. \nOn production unit 1, each worker can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. \nOn production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. \nOn production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour.\nThe company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. Determine the minimum total production time to meet the daily demand.\n// The production time for component A: T1 = 500 / (10 * U1 + 12 * U2 + 14 * U3)\n// The production time for component B: T2 = 750 / (15 * U1 + 18 * U2 + 20 * U3)\n// The production time for component C: T3 = 1000 / (20 * U1 + 22 * U2 + 24 * U3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// U1 + U2 + U3 <= 60",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency. Each production unit has a different efficiency in producing the components. On production unit 1, each worker can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. On production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. On production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. There are a total of 60 workers available. Please help the company determine the minimum total production time to meet the daily demand.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nU1 = model.addVar(vtype=\"INTEGER\", name=\"U1\", lb=0) # number of workers on production unit 1\nU2 = model.addVar(vtype=\"INTEGER\", name=\"U2\", lb=0) # number of workers on production unit 2\nU3 = model.addVar(vtype=\"INTEGER\", name=\"U3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT1 = model.addVar('T1') # production time for component A\nT2 = model.addVar('T2') # production time for component B\nT3 = model.addVar('T3') # production time for component C\nmodel.addCons(T1 == 500 / (10 * U1 + 12 * U2 + 14 * U3))\nmodel.addCons(T2 == 750 / (15 * U1 + 18 * U2 + 20 * U3))\nmodel.addCons(T3 == 1000 / (20 * U1 + 22 * U2 + 24 * U3))\n## the objective function is: Minimize max(T1, T2, T3)\n## convert the division to multiplication\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(U1 + U2 + U3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(U1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(U2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(U3))\n    print(\"Minimum Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1031,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n// Profit of A: Profit_A = 500 * A - 200 * A\n// Profit of B: Profit_B = 700 * B - 300 * B\n// Profit of C: Profit_C = 900 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * A + 1500 * B + 2000 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000\n\n## Generate Constraint-3:\nThe farm has a water supply limit of 150,000 gallons.\n// 1000 * A + 1500 * B + 2000 * C <= 150000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage. The profit per acre, water usage, and labor cost for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|------|-----------------|----------------------|---------------------|\n| A    | $500            | 1000 gallons         | $200                |\n| B    | $700            | 1500 gallons         | $300                |\n| C    | $900            | 2000 gallons         | $400                |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a budget of $20,000 for labor costs. The farm has a water supply limit of 150,000 gallons. \nPlease help the farmer to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nWaterUsage = 1000 * A + 1500 * B + 2000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n## The farm has a water supply limit of 150,000 gallons.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 150000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 969,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production line efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate of all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in enhancing the production line efficiency cannot exceed $50,000.\n// Efficiency <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency. The production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products. The total production rate of all products must not exceed 100 units per hour, and the investment in enhancing the production line efficiency cannot exceed $50,000. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production line efficiency\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate of all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in enhancing the production line efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in Production Line Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 500 units in total.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit and cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $50             | $20           |\n| B       | $70             | $30           |\n| C       | $60             | $25           |\n\nThe total production cost must not exceed $15,000. The company has a limited workforce that can produce a maximum of 500 units in total. \n\nPlease help the company to maximize the total profit from the production of these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000) # Total production cost must not exceed $15,000\nmodel.addCons(ProductA + ProductB + ProductC <= 500) # Limited workforce can produce a maximum of 500 units in total\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 765,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company aims to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * UnitsA) * UnitsB\n// Profit_C = (100 - 0.2 * UnitsB) * UnitsC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total for all devices.\n// UnitsA + UnitsB + UnitsC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit. The profit per unit for each device and the conditions affecting these profits are detailed in the following Table.\n\n| Device | Profit Per Unit | Conditions Affecting Profit |\n|--------|-----------------|-----------------------------|\n| DeviceA | $50 | Profit decreases by $0.1 for each unit produced beyond the first 100 units |\n| DeviceB | $70 | Profit decreases by $0.05 for each unit of DeviceA produced |\n| DeviceC | $100 | Profit decreases by $0.2 for each unit of DeviceB produced |\n\nThe company has a production capacity of 500 units in total for all devices. Please help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## Profit_B = (70 - 0.05 * UnitsA) * UnitsB\nProfit_B = (70 - 0.05 * UnitsA) * UnitsB\n## Profit_C = (100 - 0.2 * UnitsB) * UnitsC\nProfit_C = (100 - 0.2 * UnitsB) * UnitsC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a production capacity of 500 units in total for all devices.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 901,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The company aims to maximize the total profit from the production of these products.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production cost must not exceed $15,000. The cost per unit of Product A is $20, Product B is $30, and Product C is $25.\n// 20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000\n\n## Generate Constraint-2:\nThe company has a limited workforce that can produce a maximum of 500 units in total.\n// ProductA + ProductB + ProductC <= 500",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering various constraints related to resource availability and market demand. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The total production cost must not exceed $15,000, with the cost per unit of Product A being $20, Product B being $30, and Product C being $25. Additionally, the company has a limited workforce that can produce a maximum of 500 units in total. Please help the company to maximize the total profit from the production of these products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\nProfit = 50 * ProductA + 70 * ProductB + 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(20 * ProductA + 30 * ProductB + 25 * ProductC <= 15000) # Total production cost must not exceed $15,000\nmodel.addCons(ProductA + ProductB + ProductC <= 500) # Limited workforce can produce a maximum of 500 units in total\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 630,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of smartphones\": \"Q_smartphone\", \"range\": \"Q_smartphone >= 0\", \"type\": \"integer\"}\n// {\"production quantity of tablets\": \"Q_tablet\", \"range\": \"Q_tablet >= 0\", \"type\": \"integer\"}\n// {\"production quantity of laptops\": \"Q_laptop\", \"range\": \"Q_laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices.\n// So, the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// Q_smartphone + Q_tablet + Q_laptop <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n// Q_smartphone >= 100; Q_tablet >= 50\n\n## Generate Constraint-3:\nDue to labor constraints, the production of laptops cannot exceed 200 units per month.\n// Q_laptop <= 200\n\n## Generate Constraint-4:\nThe company must maintain a balance in production to avoid over-reliance on any single product. The ratio of smartphones to tablets must be at least 2:1.\n// Q_smartphone >= 2 * Q_tablet",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor. The profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices. The total production capacity of the factory is limited to 1000 units per month. The company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets. Due to labor constraints, the production of laptops cannot exceed 200 units per month. The company must maintain a balance in production to avoid over-reliance on any single product. The ratio of smartphones to tablets must be at least 2:1.\nPlease help the company to determine the optimal production quantities of smartphones, tablets, and laptops to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_smartphone = model.addVar(vtype=\"INTEGER\", name=\"Q_smartphone\", lb=0)  # production quantity of smartphones\nQ_tablet = model.addVar(vtype=\"INTEGER\", name=\"Q_tablet\", lb=0)  # production quantity of tablets\nQ_laptop = model.addVar(vtype=\"INTEGER\", name=\"Q_laptop\", lb=0)  # production quantity of laptops\n\n# Define objective function\nP_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone**2\nP_tablet = 150 * Q_tablet - 0.02 * Q_tablet**2\nP_laptop = 200 * Q_laptop - 0.03 * Q_laptop**2\nTotal_Profit = P_smartphone + P_tablet + P_laptop\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(Q_smartphone + Q_tablet + Q_laptop <= 1000)  # Total production capacity constraint\nmodel.addCons(Q_smartphone >= 100)  # Minimum order requirement for smartphones\nmodel.addCons(Q_tablet >= 50)  # Minimum order requirement for tablets\nmodel.addCons(Q_laptop <= 200)  # Labor constraint for laptops\nmodel.addCons(Q_smartphone >= 2 * Q_tablet)  # Ratio constraint for smartphones to tablets\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Smartphones: \", model.getVal(Q_smartphone))\n    print(\"Production Quantity of Tablets: \", model.getVal(Q_tablet))\n    print(\"Production Quantity of Laptops: \", model.getVal(Q_laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1237,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor.\n// {\"amount of land for C1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. \nEach unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. \nEach unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor.\nThe farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n// Profit_C1 = 100 * L1\n// Profit_C2 = 150 * L2\n// Profit_C3 = 200 * L3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of land available.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 200 units of water available.\n// 2 * L1 + 3 * L2 + 4 * L3 <= 200\n\n## Generate Constraint-3:\nThe farm has a total of 150 units of labor available.\n// L1 + 2 * L2 + 3 * L3 <= 150",
        "question": "A farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor. Each unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. Each unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. Each unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor. The farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource). The farm has a total of 100 units of land available. The farm has a total of 200 units of water available. The farm has a total of 150 units of labor available. Please help the farm determine the optimal allocation of land for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # amount of land for C1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # amount of land for C2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # amount of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * L1\nProfit_C2 = 150 * L2\nProfit_C3 = 200 * L3\nResourceUse = 2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / ResourceUse\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUse == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 units of land available.\nmodel.addCons(L1 + L2 + L3 <= 100)\n## The farm has a total of 200 units of water available.\nmodel.addCons(2 * L1 + 3 * L2 + 4 * L3 <= 200)\n## The farm has a total of 150 units of labor available.\nmodel.addCons(L1 + 2 * L2 + 3 * L3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for C1: \", model.getVal(L1))\n    print(\"Amount of Land for C2: \", model.getVal(L2))\n    print(\"Amount of Land for C3: \", model.getVal(L3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. The company wants to maximize the total profit.\n// The objective function is: Maximize P = 50A + 70B + 60C\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe market demand for component A is at least 10 units, and for component B is at least 15 units.\n// A >= 10\n// B >= 15\n\n## Generate Constraint-3:\nThe production capacity is limited. The company can produce at most 20 units of component A, 25 units of component B, and 30 units of component C.\n// A <= 20\n// B <= 25\n// C <= 30",
        "question": "A company manufactures three types of electronic components: A, B, and C. The company must decide how many units of each component to produce to maximize profit while considering the constraints on resources and market demand. The profit from each unit of component A is $50, component B is $70, and component C is $60. The company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg. The market demand for component A is at least 10 units, and for component B is at least 15 units. The production capacity is limited. The company can produce at most 20 units of component A, 25 units of component B, and 30 units of component C. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=25) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=30) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The company has a limited amount of raw material. Each unit of component A requires 2 kg of raw material, B requires 3 kg, and C requires 4 kg. The total available raw material is 100 kg.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The market demand for component A is at least 10 units, and for component B is at least 15 units.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 15)\n## The production capacity is limited. The company can produce at most 20 units of component A, 25 units of component B, and 30 units of component C.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 25)\nmodel.addCons(C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n// So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 10 units, and for product B is at least 20 units.\n// A >= 10\n// B >= 20\n\n## Generate Constraint-3:\nThe company must produce at least 5 units of product C to meet contractual obligations.\n// C >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively. The market demand for product A is at least 10 units, and for product B is at least 20 units. The company must produce at least 5 units of product C to meet contractual obligations. Please help the company to maximize its net profit, which is the total revenue minus the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50A + 70B + 90C\n## Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n## So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 1000 + 20 * A**2 + 15 * B**2 + 25 * C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 904,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. \nEach unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. \nEach unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material.\nThe plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material).\n// Profit from A: Profit_A = 20 * A\n// Profit from B: Profit_B = 30 * B\n// Profit from C: Profit_C = 40 * C\n// Resource usage: Resource_A = 3 * A + 2 * A = 5 * A; Resource_B = 4 * B + 3 * B = 7 * B; Resource_C = 5 * C + 4 * C = 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe plant has a total of 1000 hours of labor available.\n// 3 * A + 4 * B + 5 * C <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit. Each unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. Each unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. Each unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material. The plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material). The plant has a total of 1000 hours of labor available. Please help the plant to determine the optimal number of units to produce for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nResource_A = 5 * A\nResource_B = 7 * B\nResource_C = 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total of 1000 hours of labor available.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season.\n// {\"number of acres for CropA\": \"CropAAcreage\", \"range\": \"CropAAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"CropBAcreage\", \"range\": \"CropBAcreage >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"CropCAcreage\", \"range\": \"CropCAcreage >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage).\n// Profit for CropA: Profit_CropA = 500 * CropAAcreage - 100 * CropAAcreage\n// Profit for CropB: Profit_CropB = 700 * CropBAcreage - 150 * CropBAcreage\n// Profit for CropC: Profit_CropC = 900 * CropCAcreage - 200 * CropCAcreage\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// CropAAcreage + CropBAcreage + CropCAcreage <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\n// CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage)",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop for the next growing season. The expected profit per acre, water usage per acre, and labor cost per acre for each crop are given in the following Table.\n\n| Crop    | Expected Profit per Acre | Water Usage per Acre | Labor Cost per Acre |\n|---------|--------------------------|----------------------|---------------------|\n| CropA   | $500                     | 2000 gallons         | $100                |\n| CropB   | $700                     | 3000 gallons         | $150                |\n| CropC   | $900                     | 4000 gallons         | $200                |\n\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA. The farm aims to maximize the profit-to-water ratio (which is defined as the total profit divided by the total water usage). Please help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropAAcreage\", lb=0) # number of acres for CropA\nCropBAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropBAcreage\", lb=0) # number of acres for CropB\nCropCAcreage = model.addVar(vtype=\"INTEGER\", name=\"CropCAcreage\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (500 - 100) * CropAAcreage\nProfit_CropB = (700 - 150) * CropBAcreage\nProfit_CropC = (900 - 200) * CropCAcreage\nWaterUsage = 2000 * CropAAcreage + 3000 * CropBAcreage + 4000 * CropCAcreage\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(CropAAcreage + CropBAcreage + CropCAcreage <= 100)\n## Due to soil conditions, the farm must allocate at least 20% of its total acreage to CropA.\nmodel.addCons(CropAAcreage >= 0.2 * (CropAAcreage + CropBAcreage + CropCAcreage))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(CropAAcreage))\n    print(\"Number of Acres for CropB: \", model.getVal(CropBAcreage))\n    print(\"Number of Acres for CropC: \", model.getVal(CropCAcreage))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 2.5 hours                |\n\nThe company has a limited production capacity of 1000 hours. The company must produce at least 10 units of each product to meet contractual obligations. Please help the company to maximize its total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nCost = Cost_A + Cost_B + Cost_C\n## the objective function is: Maximize Profit = Revenue - Cost\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1161,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\n// 500 * Insulation >= 0.20 * 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installation and the annual energy savings for each type of upgrade are given in the following Table.\n\n| Upgrade Type       | Installation Cost | Annual Energy Savings |\n|--------------------|-------------------|-----------------------|\n| Solar Panels       | $1000 per panel   | $200 per panel        |\n| Wind Turbines      | $2000 per turbine  | $300 per turbine      |\n| Insulation Upgrades| $500 per upgrade  | $100 per upgrade      |\n\nThe company has a budget of $50,000 for the installation. The company aims to achieve at least $10,000 in annual energy savings. The company wants to ensure that at least 20% of the budget is spent on insulation upgrades. \nPlease help the company to minimize the total cost of installation while maximizing the annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0) # amount of insulation upgrades\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\n## the objective function is: Minimize Cost / Savings\n## convert the division to multiplication\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n## The company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\nmodel.addCons(500 * Insulation >= 0.20 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit and setup cost for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost per Unit |\n|---------|-----------------|---------------------|\n| MachineA | $500           | $100                |\n| MachineB | $700           | $150                |\n| MachineC | $900           | $200                |\n\nThe company has a limited budget for setup costs, which is $10,000. The company wants to maximize the total profit, which is calculated by subtracting the setup cost from the profit per unit for each machine and then summing these profits.\n\nPlease help the company determine the optimal number of units to produce for each machine to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=0) # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=0) # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=0) # number of units of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n## the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops.\n// Revenue from Crop A: R_A = 500 * A * 2\n// Revenue from Crop B: R_B = 700 * B * 3\n// Revenue from Crop C: R_C = 600 * C * 2.5\n// So, the objective function is: Maximize R_total = R_A + R_B + R_C\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, at least 20% of the land must be allocated to Crop A.\n// A >= 0.2 * 100\n\n## Generate Constraint-3:\nThe farmer must allocate at least 30 acres to Crop B to meet a contract requirement.\n// B >= 30",
        "question": "A farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop. The farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops. The farmer has a total of 100 acres available for planting. Due to soil conditions, at least 20% of the land must be allocated to Crop A. The farmer must allocate at least 30 acres to Crop B to meet a contract requirement. Please help the farmer determine the optimal allocation of acres to each crop to maximize his total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\nR_A = 500 * A * 2\nR_B = 700 * B * 3\nR_C = 600 * C * 2.5\nR_total = R_A + R_B + R_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_total)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(A >= 0.2 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The objective is to maximize the total production while meeting these thresholds.\n// Total production of component A: PA = 10 * WA\n// Total production of component B: PB = 15 * WB\n// Total production of component C: PC = 20 * WC\n// Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 25 workers.\n// WA <= 25; WB <= 25; WC <= 25\n\n## Generate Constraint-3:\nThe production of component A must be at least 500 units.\n// PA >= 500\n\n## Generate Constraint-4:\nThe production of component B must be at least 750 units.\n// PB >= 750\n\n## Generate Constraint-5:\nThe production of component C must be at least 1000 units.\n// PC >= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line. The production rate for component A is 10 units per worker per hour, for component B is 15 units per worker per hour, and for component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units.\n\n| Component | Production Rate per Worker per Hour |\n|-----------|-------------------------------------|\n| A         | 10                                  |\n| B         | 15                                  |\n| C         | 20                                  |\n\nThe total number of workers available is 50. Each production line can handle a maximum of 25 workers. The production of component A must be at least 500 units, component B must be at least 750 units, and component C must be at least 1000 units.\n\nPlease help the manufacturer to maximize the total production of all components (PA + PB + PC) while meeting these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\nPA = 10 * WA\nPB = 15 * WB\nPC = 20 * WC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\nmodel.addCons(WA + WB + WC <= 50) # total number of workers available is 50\nmodel.addCons(WA <= 25) # each production line can handle a maximum of 25 workers\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\nmodel.addCons(PA >= 500) # production of component A must be at least 500 units\nmodel.addCons(PB >= 750) # production of component B must be at least 750 units\nmodel.addCons(PC >= 1000) # production of component C must be at least 1000 units\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1258,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the production time is 1 hour. \nFor Device B, the selling price is $150, the production cost is $70, and the production time is 2 hours. \nFor Device C, the selling price is $200, the production cost is $90, and the production time is 3 hours.\nThe company aims to maximize its profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability. The selling price, production cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Production Time |\n|--------|---------------|-----------------|-----------------|\n| A      | 100$          | 50$             | 1 hour          |\n| B      | 150$          | 70$             | 2 hours         |\n| C      | 200$          | 90$             | 3 hours         |\n\nThe company has a budget of $10,000 for production costs. The company aims to maximize its profit rate, which is defined as the total profit divided by the total production time. Please help the company determine the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 20% of the total production.\n// PA >= 0.2 * (PA + PB + PC)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit. The company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 20% of the total production. Please help the company determine the optimal production quantities and the investment in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nProfit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(PA >= 0.2 * (PA + PB + PC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 hours of labor and generates a profit of $10. \nEach unit of product B requires 3 hours of labor and generates a profit of $15. \nEach unit of product C requires 4 hours of labor and generates a profit of $20.\nThe plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor.\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Total labor hours: Labor_Hours = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n\n## Generate Constraint-1:\nThe plant has a total labor capacity of 1000 hours per week.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50\n\n## Generate Constraint-3:\nThe plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships.\n// B >= 30; C >= 40",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. The labor requirements and profit per unit for each product are given in the following Table.\n\n| Product | Labor Hours per Unit | Profit per Unit |\n|---------|----------------------|-----------------|\n| A       | 2 hours              | $10             |\n| B       | 3 hours              | $15             |\n| C       | 4 hours              | $20             |\n\nThe plant has a total labor capacity of 1000 hours per week. The market demand for product A is at least 50 units per week. The plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships. \nPlease help the plant to maximize the total profit while considering the efficiency of labor usage, specifically to maximize the profit per hour of labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n## {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n## {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_Hours = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n## convert the division to multiplication\nmodel.addCons(obj * Labor_Hours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total labor capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n## The market demand for product A is at least 50 units per week.\nmodel.addCons(A >= 50)\n## The plant must produce at least 30 units of product B and 40 units of product C to maintain customer relationships.\nmodel.addCons(B >= 30)\nmodel.addCons(C >= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Total cargo carried by TruckA: Cargo_TruckA = 10 * TruckA\n// Total cargo carried by TruckB: Cargo_TruckB = 15 * TruckB\n// Total cargo carried by TruckC: Cargo_TruckC = 20 * TruckC\n// Total fuel consumed: Fuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n\n## Generate Constraint-1:\nThe company has a total of 50 vehicles available.\n// TruckA + TruckB + TruckC <= 50",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints. The capacity and fuel consumption for each type of vehicle are given in the following Table.\n\n| Vehicle | Cargo Capacity | Fuel Consumption per Trip |\n|---------|----------------|---------------------------|\n| TruckA  | 10 tons        | 5 liters                  |\n| TruckB  | 15 tons        | 7 liters                  |\n| TruckC  | 20 tons        | 9 liters                  |\n\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The company has a total of 50 vehicles available. Please help the company determine the optimal number of each type of vehicle to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n## the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Consumed == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC)\n\n# Add constraints\n## The company has a total of 50 vehicles available.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand.\n// {\"quantity of Classic cake\": \"Classic\", \"range\": \"Classic >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"quantity of Fruit cake\": \"Fruit\", \"range\": \"Fruit >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The bakery aims to maximize the total daily profit from selling the cakes.\n// Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\n// Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\n// Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\n// So, the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg.\n// 200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000\n\n## Generate Constraint-2:\nThe market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units.\n// Classic <= 150; Chocolate <= 200; Fruit <= 180",
        "question": "A bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand. The profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The following table summarizes the profit structure and ingredient requirements for each cake.\n\n| Cake Type     | Profit per Cake | Flour Required (g) |\n|---------------|-----------------|--------------------|\n| Classic       | $10 + $0.02 * (Classic - 30) | 200 |\n| Chocolate     | $15 + $0.02 * (Chocolate - 30) | 250 |\n| Fruit         | $12 + $0.02 * (Fruit - 30) | 220 |\n\nThe bakery has a limited supply of ingredients. The total available flour is 7 kg. The market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units.\n\nPlease help the bakery to maximize the total daily profit from selling the cakes while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each type of cake.\nClassic = model.addVar(vtype=\"INTEGER\", name=\"Classic\", lb=0, ub=150) # quantity of Classic cake\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0, ub=200) # quantity of Chocolate cake\nFruit = model.addVar(vtype=\"INTEGER\", name=\"Fruit\", lb=0, ub=180) # quantity of Fruit cake\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\nClassic1 = model.addVar(vtype=\"INTEGER\", name=\"Classic1\", lb=0, ub=30)\nClassic2 = model.addVar(vtype=\"INTEGER\", name=\"Classic2\", lb=30, ub=150)\nClassic_b1 = model.addVar(vtype=\"B\", name=\"Classic_b1\")\nClassic_b2 = model.addVar(vtype=\"B\", name=\"Classic_b2\")\nmodel.addCons(Classic_b1 + Classic_b2 == 1)\nmodel.addCons(Classic == Classic1*Classic_b1 + Classic2*Classic_b2)\nProfit_Classic = 10 * Classic1 * Classic_b1 + (10 + 0.02 * (Classic2 - 30)) * Classic2 * Classic_b2\n## create piecewise variables for piecewise function: Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\nChocolate1 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate1\", lb=0, ub=30)\nChocolate2 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate2\", lb=30, ub=200)\nChocolate_b1 = model.addVar(vtype=\"B\", name=\"Chocolate_b1\")\nChocolate_b2 = model.addVar(vtype=\"B\", name=\"Chocolate_b2\")\nmodel.addCons(Chocolate_b1 + Chocolate_b2 == 1)\nmodel.addCons(Chocolate == Chocolate1*Chocolate_b1 + Chocolate2*Chocolate_b2)\nProfit_Chocolate = 15 * Chocolate1 * Chocolate_b1 + (15 + 0.02 * (Chocolate2 - 30)) * Chocolate2 * Chocolate_b2\n## create piecewise variables for piecewise function: Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\nFruit1 = model.addVar(vtype=\"INTEGER\", name=\"Fruit1\", lb=0, ub=30)\nFruit2 = model.addVar(vtype=\"INTEGER\", name=\"Fruit2\", lb=30, ub=180)\nFruit_b1 = model.addVar(vtype=\"B\", name=\"Fruit_b1\")\nFruit_b2 = model.addVar(vtype=\"B\", name=\"Fruit_b2\")\nmodel.addCons(Fruit_b1 + Fruit_b2 == 1)\nmodel.addCons(Fruit == Fruit1*Fruit_b1 + Fruit2*Fruit_b2)\nProfit_Fruit = 12 * Fruit1 * Fruit_b1 + (12 + 0.02 * (Fruit2 - 30)) * Fruit2 * Fruit_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\nmodel.addCons(obj == Profit_Classic + Profit_Chocolate + Profit_Fruit)\n\n# Add constraints\n## The bakery has a limited supply of ingredients.\nmodel.addCons(200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Classic cake: \", model.getVal(Classic))\n    print(\"Quantity of Chocolate cake: \", model.getVal(Chocolate))\n    print(\"Quantity of Fruit cake: \", model.getVal(Fruit))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1228,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000.\nFor V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000.\nFor V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000.\nThe company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n// Total_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\n// Fuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\n// Total_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n// So, the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// 5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000\n\n## Generate Constraint-2:\nThe total weight of the deliveries should not exceed 10,000 kg.\n// 1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company must use at least 5 vehicles in total.\n// V1 + V2 + V3 >= 5",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency, capacity, and cost. The details for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/km) | Capacity (kg) | Cost per Vehicle ($) |\n|---------|------------------------------|---------------|----------------------|\n| V1      | 0.1                          | 1000          | 5000                 |\n| V2      | 0.08                         | 1500          | 6000                 |\n| V3      | 0.06                         | 2000          | 7000                 |\n\nThe company has a budget of $100,000 for purchasing vehicles. The total weight of the deliveries should not exceed 10,000 kg. The company must use at least 5 vehicles in total. \n\nPlease help the company to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\nFuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\nTotal_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n## the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n## convert the division to multiplication\nmodel.addCons(obj == Total_Cost + Fuel_Consumption * Total_Weight)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000)\n## The total weight of the deliveries should not exceed 10,000 kg.\nmodel.addCons(1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000)\n## The company must use at least 5 vehicles in total.\nmodel.addCons(V1 + V2 + V3 >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Minimized Total Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. For product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. For product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. For product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20. The company wants to maximize the total net profit, considering both production and storage costs. The company has a total production capacity of 200 units. Please help the company determine the optimal production quantities for P1, P2, and P3.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 772,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceA_Units\", \"range\": \"DeviceA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceB_Units\", \"range\": \"DeviceB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceC_Units\", \"range\": \"DeviceC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases non-linearly with the quantity produced due to economies of scale and resource constraints. The production cost function is given by: Cost_A = 2000 + 0.05 * (DeviceA_Units)^2, Cost_B = 3000 + 0.07 * (DeviceB_Units)^2, Cost_C = 4000 + 0.09 * (DeviceC_Units)^2. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_A = (50 * DeviceA_Units) - Cost_A\n// Total net profit for DeviceB: Profit_B = (70 * DeviceB_Units) - Cost_B\n// Total net profit for DeviceC: Profit_C = (90 * DeviceC_Units) - Cost_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost increases non-linearly with the quantity produced due to economies of scale and resource constraints. The production cost function is given by: Cost_A = 2000 + 0.05 * (DeviceA_Units)^2, Cost_B = 3000 + 0.07 * (DeviceB_Units)^2, Cost_C = 4000 + 0.09 * (DeviceC_Units)^2. The company has a total production capacity of 1000 units per month. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_Units\", lb=0) # number of units of DeviceA\nDeviceB_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_Units\", lb=0) # number of units of DeviceB\nDeviceC_Units = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_Units\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## calculate the production cost\nCost_A = 2000 + 0.05 * DeviceA_Units**2\nCost_B = 3000 + 0.07 * DeviceB_Units**2\nCost_C = 4000 + 0.09 * DeviceC_Units**2\n## calculate the total net profit\nProfit_A = 50 * DeviceA_Units - Cost_A\nProfit_B = 70 * DeviceB_Units - Cost_B\nProfit_C = 90 * DeviceC_Units - Cost_C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(DeviceA_Units + DeviceB_Units + DeviceC_Units <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceA_Units))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceB_Units))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceC_Units))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 697,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in a new technology that can improve the production efficiency of both products.\n// {\"number of units of Product 1\": \"Units1\", \"range\": \"Units1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"Units2\", \"range\": \"Units2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\n// So, the objective function is: Maximize (Profit1 + Profit2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2.\n// Units1 <= 1000; Units2 <= 800\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet contractual obligations.\n// Units1 >= 200; Units2 >= 150",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in a new technology that can improve the production efficiency of both products. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2. The total investment in the new technology cannot exceed $50,000. The company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet contractual obligations.\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits1 = model.addVar(vtype=\"INTEGER\", name=\"Units1\", lb=200)  # number of units of Product 1\nUnits2 = model.addVar(vtype=\"INTEGER\", name=\"Units2\", lb=150)  # number of units of Product 2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\n## Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\nProfit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\nProfit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\n## the objective function is: Maximize (Profit1 + Profit2)\nmodel.addCons(obj == Profit1 + Profit2)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2.\nmodel.addCons(Units1 <= 1000)\nmodel.addCons(Units2 <= 800)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product 1: \", model.getVal(Units1))\n    print(\"Number of Product 2: \", model.getVal(Units2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A generates a revenue of $100 per unit and requires 2 labor hours per unit, while Product B generates a revenue of $150 per unit and requires 3 labor hours per unit. The labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company aims to maximize the total profit from both products.\n// Profit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\n// Profit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total of 200 labor hours available for the month.\n// 2 * A + 3 * B <= 200\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials.\n// 30 * A + 40 * B <= 5000\n\n## Generate Constraint-4:\nThe market demand for Product A is 50 units. So, the company can only sell a maximum of 50 units of Product A.\n// A <= 50",
        "question": "A manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs. The revenue, labor hours, and raw material costs for each product are given in the following Table.\n\n| Product | Revenue per Unit | Labor Hours per Unit | Raw Material Cost per Unit |\n|---------|------------------|----------------------|---------------------------|\n| A       | $100             | 2                    | $30                       |\n| B       | $150             | 3                    | $40                       |\n\nThe company has a total of 200 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. The raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials. The market demand for Product A is 50 units. So, the company can only sell a maximum of 50 units of Product A. \n\nPlease help the company to maximize the total profit from both products, considering that for every $10,000 invested in automation, the labor cost per hour decreases by $1.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\nProfit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B <= 200) # Constraint-1: Total labor hours\nmodel.addCons(Automation <= 50000) # Constraint-2: Investment in automation\nmodel.addCons(30 * A + 40 * B <= 5000) # Constraint-3: Raw material budget\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1263,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations.\n// {\"production rate of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours.\n// Cost of A: Cost_A = 2 * PA\n// Cost of B: Cost_B = 3 * PB\n// Cost of C: Cost_C = 4 * PC\n// Revenue of A: Revenue_A = 5 * PA\n// Revenue of B: Revenue_B = 7 * PB\n// Revenue of C: Revenue_C = 9 * PC\n// Total Profit: Profit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n// Total Production Time: Time = PA + 2 * PB + 3 * PC\n// So, the objective function is: Maximize Profit / Time\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 2 * PA + 3 * PB + 4 * PC <= 1000\n\n## Generate Constraint-2:\nThe plant can only allocate a maximum of 500 hours for production.\n// PA + 2 * PB + 3 * PC <= 500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations. The cost, revenue, and production time for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit | Production Time per Unit |\n|---------|---------------|------------------|--------------------------|\n| A       | $2            | $5               | 1 hour                   |\n| B       | $3            | $7               | 2 hours                  |\n| C       | $4            | $9               | 3 hours                  |\n\nThe plant has a budget of $1000 for production costs. The plant can only allocate a maximum of 500 hours for production. Please help the plant to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # production rate of product A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # production rate of product B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # production rate of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 2 * PA\nCost_B = 3 * PB\nCost_C = 4 * PC\nRevenue_A = 5 * PA\nRevenue_B = 7 * PB\nRevenue_C = 9 * PC\nProfit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nTime = PA + 2 * PB + 3 * PC\n## the objective function is: Maximize Profit / Time\n## convert the division to multiplication\nmodel.addCons(obj * Time == Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 1000)\n## The plant can only allocate a maximum of 500 hours for production.\nmodel.addCons(PA + 2 * PB + 3 * PC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product A: \", model.getVal(PA))\n    print(\"Production Rate of Product B: \", model.getVal(PB))\n    print(\"Production Rate of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\n// Cost_A = (10 - 0.0001 * Automation) * A\n// Cost_B = (15 - 0.0001 * Automation) * B\n// Cost_C = (20 - 0.0001 * Automation) * C\n// So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A is at least 200 units, and for component B is at least 150 units.\n// A >= 200; B >= 150",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process. The cost of producing each component and the impact of automation on production costs are given in the following Table.\n\n| Component | Production Cost per Unit |\n|-----------|--------------------------|\n| A         | $10 - 0.0001 * Automation |\n| B         | $15 - 0.0001 * Automation |\n| C         | $20 - 0.0001 * Automation |\n\nThe company aims to minimize the total production cost. The total production capacity of the company is 1000 units. The demand for component A is at least 200 units, and for component B is at least 150 units. Please help the company determine the optimal production quantities of components A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (10 - 0.0001 * Automation) * A\nCost_B = (15 - 0.0001 * Automation) * B\nCost_C = (20 - 0.0001 * Automation) * C\n# So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 932,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nAt least 200 units of product A must be produced.\n// A >= 200\n\n## Generate Constraint-4:\nThe production of product B must not exceed 300 units.\n// B <= 300",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------|------------------------|\n| A       | 50$                       | 100$                   |\n| B       | 70$                       | 120$                   |\n| C       | 60$                       | 110$                   |\n\nThe manufacturer has a budget of $50,000 for investing in the new production technology. The total production capacity is limited to 1000 units across all products. At least 200 units of product A must be produced. The production of product B must not exceed 300 units.\n\nPlease help the manufacturer to determine the optimal production quantities for products A, B, and C, and the investment in the new production technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1413,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000.\nFor V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000.\nFor V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000.\nThe company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n// Total_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\n// Fuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\n// Total_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n// So, the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// 5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000\n\n## Generate Constraint-2:\nThe total weight of the deliveries should not exceed 10,000 kg.\n// 1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency, capacity, and cost. The details for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Consumption (liters/km) | Capacity (kg) | Cost per Vehicle ($) |\n|---------|------------------------------|---------------|----------------------|\n| V1      | 0.1                          | 1000          | 5000                 |\n| V2      | 0.08                         | 1500          | 6000                 |\n| V3      | 0.06                         | 2000          | 7000                 |\n\nThe company has a budget of $100,000 for purchasing vehicles. The total weight of the deliveries should not exceed 10,000 kg. The company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\nPlease help the company determine the optimal number of each type of vehicle to use for their delivery routes.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\nFuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\nTotal_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n## the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n## convert the multiplication to addition\nmodel.addCons(obj == Total_Cost + Fuel_Consumption * Total_Weight)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000)\n## The total weight of the deliveries should not exceed 10,000 kg.\nmodel.addCons(1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Minimized Total Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1016,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// S <= 25; T <= 25; L <= 25",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n\n| Device | Production Rate per Worker (per hour) | Profit per Device |\n|--------|---------------------------------------|-------------------|\n| Smartphone | 10 | $50 |\n| Tablet | 8 | $70 |\n| Laptop | 5 | $100 |\n\nThere are total 60 workers available. Each production line can be utilized by up to 25 workers at a time. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60)\nmodel.addCons(S <= 25)\nmodel.addCons(T <= 25)\nmodel.addCons(L <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1008,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit.\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product type depends on the labor hours invested. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3 = 100 * L1^0.7 + 150 * L2^0.6 + 200 * L3^0.5\n\n## Generate Constraint-1:\nThe total labor hours available for all products is 1000 hours.\n// L1 + L2 + L3 <= 1000\n\n## Generate Constraint-2:\nThe company has a policy to allocate at least 20% of the total labor hours to product 1.\n// L1 >= 0.2 * (L1 + L2 + L3)",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit. The profit from each product type depends on the labor hours invested and is given by the following nonlinear profit functions:\n\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\n\nThe company aims to maximize the total profit from all three products. The total labor hours available for all products is 1000 hours. The company has a policy to allocate at least 20% of the total labor hours to product 1.\n\nPlease help the company determine the optimal allocation of labor hours (L1, L2, L3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for product 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for product 3\n\n# Define objective function\n## The profit from each product type depends on the labor hours invested.\nP1 = 100 * L1**0.7\nP2 = 150 * L2**0.6\nP3 = 200 * L3**0.5\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total labor hours available for all products is 1000 hours.\nmodel.addCons(L1 + L2 + L3 <= 1000)\n## The company has a policy to allocate at least 20% of the total labor hours to product 1.\nmodel.addCons(L1 >= 0.2 * (L1 + L2 + L3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours for Product 1: \", model.getVal(L1))\n    print(\"Labor hours for Product 2: \", model.getVal(L2))\n    print(\"Labor hours for Product 3: \", model.getVal(L3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water and fertilizer, which are $50 per acre for wheat, $70 per acre for corn, and $40 per acre for soybeans. The farmer aims to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\n// Profit per acre of wheat: Profit_W = (200 - 50) * W\n// Profit per acre of corn: Profit_C = (300 - 70) * C\n// Profit per acre of soybeans: Profit_S = (150 - 40) * S\n// Cost of water and fertilizer: Cost_W = 50 * W, Cost_C = 70 * C, Cost_S = 40 * S\n// So, the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 20 acres of each crop.\n// W >= 20; C >= 20; S >= 20\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for water and fertilizer.\n// 50 * W + 70 * C + 40 * S <= 5000",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to dedicate to each crop. The profit per acre and the cost of water and fertilizer per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Cost of Water and Fertilizer per Acre |\n|----------|-----------------|--------------------------------------|\n| Wheat    | $200            | $50                                  |\n| Corn     | $300            | $70                                  |\n| Soybeans | $150            | $40                                  |\n\nThe farmer has a total of 100 acres available for planting. The farmer wants to plant at least 20 acres of each crop. The farmer has a budget of $5000 for water and fertilizer. \nPlease help the farmer to maximize the net profit per unit of water and fertilizer used (defined as the total profit minus the total cost of water and fertilizer, divided by the total amount of water and fertilizer used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 20 acres of each crop.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 40) * S\nCost_W = 50 * W\nCost_C = 70 * C\nCost_S = 40 * S\n## the objective function is: Maximize ((Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S)) / (Cost_W + Cost_C + Cost_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_W + Cost_C + Cost_S) == (Profit_W + Profit_C + Profit_S) - (Cost_W + Cost_C + Cost_S))\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget of $5000 for water and fertilizer.\nmodel.addCons(50 * W + 70 * C + 40 * S <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit.\n// {\"land allocated to crop A\": \"LA\", \"range\": \"LA >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"LB\", \"range\": \"LB >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"LC\", \"range\": \"LC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $1500, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $2000, but it requires 4 units of water per hectare.\nThe farm aims to maximize its total profit while considering the water usage efficiency (profit per unit of water).\n// Profit from A: Profit_A = 1000 * LA\n// Profit from B: Profit_B = 1500 * LB\n// Profit from C: Profit_C = 2000 * LC\n// Total water usage: Water_Total = 2 * LA + 3 * LB + 4 * LC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// LA + LB + LC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * LA + 3 * LB + 4 * LC <= 300\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 hectares to each crop to maintain crop diversity.\n// LA >= 10; LB >= 10; LC >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to optimize its profit. The profit per hectare and the water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Required per Hectare |\n|------|---------------------|----------------------------|\n| A    | $1000               | 2 units                    |\n| B    | $1500               | 3 units                    |\n| C    | $2000               | 4 units                    |\n\nThe farm has a total of 100 hectares available for cultivation. The farm has a total of 300 units of water available for irrigation. The farm must allocate at least 10 hectares to each crop to maintain crop diversity. \nPlease help the farm to maximize its total profit while considering the water usage efficiency (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 hectares to each crop to maintain crop diversity.\nLA = model.addVar(vtype=\"CONTINUOUS\", name=\"LA\", lb=10) # land allocated to crop A\nLB = model.addVar(vtype=\"CONTINUOUS\", name=\"LB\", lb=10) # land allocated to crop B\nLC = model.addVar(vtype=\"CONTINUOUS\", name=\"LC\", lb=10) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * LA\nProfit_B = 1500 * LB\nProfit_C = 2000 * LC\nWater_Total = 2 * LA + 3 * LB + 4 * LC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(LA + LB + LC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * LA + 3 * LB + 4 * LC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(LA))\n    print(\"Land allocated to Crop B: \", model.getVal(LB))\n    print(\"Land allocated to Crop C: \", model.getVal(LC))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\n// {\"number of pastries A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of pastries B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of pastries C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n// Profit from A: Profit_A = (2 - 0.5) * A\n// Profit from B: Profit_B = (3 - 1) * B\n// Profit from C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (15 * A + 20 * B + 25 * C)\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients.\n// 0.5 * A + 1 * B + 1.5 * C <= 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure it bakes at least 50 pastries of each type daily.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe bakery has a maximum of 8 hours (480 minutes) available for baking each day.\n// 15 * A + 20 * B + 25 * C <= 480",
        "question": "A bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit. The selling price, cost to make, and baking time for each pastry are given in the following Table.\n\n| Pastry | Selling Price | Cost to Make | Baking Time |\n|--------|---------------|--------------|-------------|\n| A      | $2            | $0.5         | 15 minutes  |\n| B      | $3            | $1           | 20 minutes  |\n| C      | $4            | $1.5         | 25 minutes  |\n\nThe bakery has a daily budget of $100 for ingredients. The bakery wants to ensure it bakes at least 50 pastries of each type daily. The bakery has a maximum of 8 hours (480 minutes) available for baking each day. \nPlease help the bakery to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to ensure it bakes at least 50 pastries of each type daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of pastries A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of pastries B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of pastries C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nBakingTime = 15 * A + 20 * B + 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 100)\n## The bakery has a maximum of 8 hours (480 minutes) available for baking each day.\nmodel.addCons(15 * A + 20 * B + 25 * C <= 480)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(A))\n    print(\"Number of Pastry B: \", model.getVal(B))\n    print(\"Number of Pastry C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices.\n// Profit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\n// Profit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\n// Profit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// Smartphones + Tablets + Laptops <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units.\n// Smartphones <= 5000; Tablets <= 3000; Laptops <= 2000\n\n## Generate Constraint-4:\nThe company must produce at least 1000 units of each device type to maintain market presence.\n// Smartphones >= 1000; Tablets >= 1000; Laptops >= 1000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit. The selling price per unit and the initial energy cost per unit for each device are given in the following Table.\n\n| Device       | Selling Price per Unit | Initial Energy Cost per Unit |\n|--------------|-----------------------|-----------------------------|\n| Smartphones  | $100                  | $10                         |\n| Tablets      | $150                  | $15                         |\n| Laptops      | $200                  | $20                         |\n\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The company has a total production capacity of 10,000 units across all devices. The total investment in energy efficiency upgrades cannot exceed $50,000. The market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units. The company must produce at least 1000 units of each device type to maintain market presence.\n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=1000)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1000)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=1000)\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)\n\n# Define objective function\nProfit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\nProfit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\nProfit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops <= 10000)\nmodel.addCons(EnergyEfficiency <= 50000)\nmodel.addCons(Smartphones <= 5000)\nmodel.addCons(Tablets <= 3000)\nmodel.addCons(Laptops <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1319,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit.\n// {\"raw materials for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for machine 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"production rate adjustment for machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine contributes differently to the profit based on the raw materials and labor hours allocated. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines.\n// The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\n\n## Generate Constraint-1:\nThe total budget for raw materials and labor hours is $5000.\n// 100 * M1 + 150 * L2 + 500 * P3^2 <= 5000\n\n## Generate Constraint-2:\nThe maximum capacity for raw materials on Machine 1 is 30 units.\n// M1 <= 30\n\n## Generate Constraint-3:\nThe maximum labor hours available for Machine 2 is 20 hours.\n// L2 <= 20",
        "question": "A manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines. The total budget for raw materials and labor hours is $5000. The maximum capacity for raw materials on Machine 1 is 30 units. The maximum labor hours available for Machine 2 is 20 hours. Please help the company determine the optimal allocation of resources to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # raw materials for machine 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0)  # labor hours for machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0)  # production rate adjustment for machine 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\nmodel.addCons(obj == 100 * M1 + 150 * L2 + 500 * P3**2)\n\n# Add constraints\n## The total budget for raw materials and labor hours is $5000.\nmodel.addCons(100 * M1 + 150 * L2 + 500 * P3**2 <= 5000)\n## The maximum capacity for raw materials on Machine 1 is 30 units.\nmodel.addCons(M1 <= 30)\n## The maximum labor hours available for Machine 2 is 20 hours.\nmodel.addCons(L2 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for Machine 1: \", model.getVal(M1))\n    print(\"Labor hours for Machine 2: \", model.getVal(L2))\n    print(\"Production rate adjustment for Machine 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 779,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The manufacturer wants to maximize the total profit from selling these devices.\n// Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\n// Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\n// Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing Smartphones is $50 per unit, Tablets is $75 per unit, and Laptops is $100 per unit. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Smartphones, the demand limit is 500 units. For Tablets, the demand limit is 300 units. For Laptops, the demand limit is 200 units.\n// S <= 500; T <= 300; L <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 800 units in total.\n// S + T + L <= 800",
        "question": "A manufacturer produces three types of electronic devices: Smartphones, Tablets, and Laptops. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit per unit of Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production quantity exceeds 100 units, the cost per unit decreases by $1 for every additional unit produced. The following table summarizes the cost per unit and the demand limit for each device.\n\n| Device     | Profit per Unit | Cost per Unit | Demand Limit |\n|------------|-----------------|---------------|--------------|\n| Smartphones| 100$            | 50$           | 500 units    |\n| Tablets    | 150$            | 75$           | 300 units    |\n| Laptops    | 200$            | 100$          | 200 units    |\n\nThe manufacturer has a limited budget for production, with a total budget of $15,000. The market has a demand limit for each device as specified in the table. Additionally, the manufacturer has a production capacity limit of 800 units in total. Please help the manufacturer to maximize the total profit from selling these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_Smartphones = max(100 - 1 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_Smartphones = 100 * S1 * S_b1 + (100 - 1 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_Tablets = max(150 - 1 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_Tablets = 150 * T1 * T_b1 + (150 - 1 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_Laptops = max(200 - 1 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_Laptops = 200 * L1 * L_b1 + (200 - 1 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops)\nmodel.addCons(obj == (100 * S - Cost_Smartphones) + (150 * T - Cost_Tablets) + (200 * L - Cost_Laptops))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\nmodel.addCons(S + T + L <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1305,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturer aims to maximize the total profit from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour.\n// The profit for component A: P1 = 50 * 10 * M1\n// The profit for component B: P2 = 70 * 15 * M2\n// The profit for component C: P3 = 60 * 12 * M3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total number of machines available is 50.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nThe production facility has a limited power supply that can support up to 25 machines running simultaneously.\n// M1^2 + M2^2 + M3^2 <= 25^2\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day.\n// 10 * M1 >= 500 / (24 * 60)\n// 15 * M2 >= 600 / (24 * 60)\n// 12 * M3 >= 700 / (24 * 60)",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type. The manufacturer aims to maximize the total profit per hour from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The total number of machines available is 50. The production facility has a limited power supply that can support up to 25 machines running simultaneously. The manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day. Please help the manufacturer to maximize the total profit per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\nP1 = 50 * 10 * M1\nP2 = 70 * 15 * M2\nP3 = 60 * 12 * M3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total number of machines available is 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n# The production facility has a limited power supply that can support up to 25 machines running simultaneously.\nmodel.addCons(M1**2 + M2**2 + M3**2 <= 25**2)\n# The manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day.\nmodel.addCons(10 * M1 >= 500 / (24 * 60))\nmodel.addCons(15 * M2 >= 600 / (24 * 60))\nmodel.addCons(12 * M3 >= 700 / (24 * 60))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of smartphones\": \"Q_smartphone\", \"range\": \"Q_smartphone >= 0\", \"type\": \"integer\"}\n// {\"production quantity of tablets\": \"Q_tablet\", \"range\": \"Q_tablet >= 0\", \"type\": \"integer\"}\n// {\"production quantity of laptops\": \"Q_laptop\", \"range\": \"Q_laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices.\n// So, the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// Q_smartphone + Q_tablet + Q_laptop <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n// Q_smartphone >= 100; Q_tablet >= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor. The profit from each device varies with the quantity produced due to economies of scale and market saturation, as described in the following table:\n\n| Device       | Profit Function                          |\n|--------------|------------------------------------------|\n| Smartphones  | P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2 |\n| Tablets      | P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2 |\n| Laptops      | P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2 |\n\nThe company aims to maximize the total profit from all devices. The total production capacity of the factory is limited to 1000 units per month. Additionally, the company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n\nPlease help the company determine the optimal production quantities for smartphones, tablets, and laptops to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_smartphone = model.addVar(vtype=\"INTEGER\", name=\"Q_smartphone\", lb=100) # production quantity of smartphones\nQ_tablet = model.addVar(vtype=\"INTEGER\", name=\"Q_tablet\", lb=50) # production quantity of tablets\nQ_laptop = model.addVar(vtype=\"INTEGER\", name=\"Q_laptop\", lb=0) # production quantity of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n## Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n## Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nP_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone**2\nP_tablet = 150 * Q_tablet - 0.02 * Q_tablet**2\nP_laptop = 200 * Q_laptop - 0.03 * Q_laptop**2\n## the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\nmodel.addCons(obj == P_smartphone + P_tablet + P_laptop)\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per month.\nmodel.addCons(Q_smartphone + Q_tablet + Q_laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Smartphones: \", model.getVal(Q_smartphone))\n    print(\"Production Quantity of Tablets: \", model.getVal(Q_tablet))\n    print(\"Production Quantity of Laptops: \", model.getVal(Q_laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from selling the crops. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. However, the yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer wants to maximize the total profit, which is the product of the profit per acre and the yield per acre.\n// Profit from wheat: Profit_W = 500 * 0.8 * W1\n// Profit from corn: Profit_C = 700 * 0.9 * C2\n// Profit from barley: Profit_B = 600 * 0.75 * B3\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total available land for all three plots is 100 acres.\n// W1 + C2 + B3 <= 100",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. However, the yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer aims to maximize his total profit from selling the crops, which is the product of the profit per acre and the yield per acre. The total available land for all three plots is 100 acres. Please help the farmer to maximize his total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # acres of wheat on plot 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of corn on plot 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=0) # acres of barley on plot 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from wheat: Profit_W = 500 * 0.8 * W1\n## Profit from corn: Profit_C = 700 * 0.9 * C2\n## Profit from barley: Profit_B = 600 * 0.75 * B3\n## So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == 500 * 0.8 * W1 + 700 * 0.9 * C2 + 600 * 0.75 * B3)\n\n# Add constraints\n## The total available land for all three plots is 100 acres.\nmodel.addCons(W1 + C2 + B3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 2: \", model.getVal(C2))\n    print(\"Acres of Barley on Plot 3: \", model.getVal(B3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 610,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $5 per unit, Product B has a profit margin of $10 per unit, and Product C has a profit margin of $15 per unit. The production of each product requires a different amount of energy: Product A requires 2 units of energy, Product B requires 3 units of energy, and Product C requires 4 units of energy. The plant aims to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 10 * B\n// Profit from C: Profit_C = 15 * C\n// Total energy consumption: Energy = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit.\n// 3 * A + 6 * B + 9 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a daily production capacity of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe plant aims to produce at least 50 units of each product to meet market demand.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-4:\nThe total energy consumption should not exceed 500 units per day.\n// 2 * A + 3 * B + 4 * C <= 500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantity of each product to optimize its resource usage and profit. Product A has a profit margin of $5 per unit, Product B has a profit margin of $10 per unit, and Product C has a profit margin of $15 per unit. The production of each product requires a different amount of energy: Product A requires 2 units of energy, Product B requires 3 units of energy, and Product C requires 4 units of energy. The plant aims to maximize its profit while considering the energy efficiency of production, which is defined as the ratio of total profit to total energy consumed.\n\nThe plant has a budget of $1000 for raw materials. The cost of raw materials for Product A is $3 per unit, for Product B is $6 per unit, and for Product C is $9 per unit. The plant has a daily production capacity of 200 units across all products. The plant aims to produce at least 50 units of each product to meet market demand. The total energy consumption should not exceed 500 units per day.\n\nPlease help the plant to determine the optimal production quantities of products A, B, and C to maximize the ratio of total profit to total energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 10 * B\nProfit_C = 15 * C\nEnergy = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Energy\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $1000 for raw materials.\nmodel.addCons(3 * A + 6 * B + 9 * C <= 1000)\n## The plant has a daily production capacity of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The total energy consumption should not exceed 500 units per day.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of D1 is $30, D2 is $40, and D3 is $50. The production cost per unit of D1 is $10, D2 is $15, and D3 is $20. The manufacturer wants to maximize the total profit.\n// Profit_D1 = 30 * D1 - 10 * D1\n// Profit_D2 = 40 * D2 - 15 * D2\n// Profit_D3 = 50 * D3 - 20 * D3\n// So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget of $5000 for production costs.\n// 10 * D1 + 15 * D2 + 20 * D3 <= 5000",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints.\nThe profit per unit of D1 is $30, D2 is $40, and D3 is $50. The production cost per unit of D1 is $10, D2 is $15, and D3 is $20. The manufacturer wants to maximize the total profit.\nThe manufacturer has a limited budget of $5000 for production costs.\nPlease help the manufacturer to determine the optimal production quantities for D1, D2, and D3 to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=0) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 30 * D1 - 10 * D1\nProfit_D2 = 40 * D2 - 15 * D2\nProfit_D3 = 50 * D3 - 20 * D3\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited budget of $5000 for production costs.\nmodel.addCons(10 * D1 + 15 * D2 + 20 * D3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 589,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand.\n// {\"quantity of Classic cake\": \"Classic\", \"range\": \"Classic >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"quantity of Fruit cake\": \"Fruit\", \"range\": \"Fruit >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The bakery aims to maximize the total daily profit from selling the cakes.\n// Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\n// Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\n// Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\n// So, the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg.\n// 200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000\n\n## Generate Constraint-2:\nThe market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units.\n// Classic <= 150; Chocolate <= 200; Fruit <= 180\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 450 cakes in total.\n// Classic + Chocolate + Fruit <= 450",
        "question": "A bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand. The profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg. The market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units. The bakery has a daily production capacity of 450 cakes in total. Please help the bakery to maximize the total daily profit from selling the cakes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units.\nClassic = model.addVar(vtype=\"INTEGER\", name=\"Classic\", lb=0, ub=150) # quantity of Classic cake\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=0, ub=200) # quantity of Chocolate cake\nFruit = model.addVar(vtype=\"INTEGER\", name=\"Fruit\", lb=0, ub=180) # quantity of Fruit cake\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\nClassic1 = model.addVar(vtype=\"INTEGER\", name=\"Classic1\", lb=0, ub=30)\nClassic2 = model.addVar(vtype=\"INTEGER\", name=\"Classic2\", lb=30, ub=150)\nClassic_b1 = model.addVar(vtype=\"B\", name=\"Classic_b1\")\nClassic_b2 = model.addVar(vtype=\"B\", name=\"Classic_b2\")\nmodel.addCons(Classic_b1 + Classic_b2 == 1)\nmodel.addCons(Classic == Classic1*Classic_b1 + Classic2*Classic_b2)\nProfit_Classic = 10 * Classic1 * Classic_b1 + (10 + 0.02 * (Classic2 - 30)) * Classic2 * Classic_b2\n## create piecewise variables for piecewise function: Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\nChocolate1 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate1\", lb=0, ub=30)\nChocolate2 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate2\", lb=30, ub=200)\nChocolate_b1 = model.addVar(vtype=\"B\", name=\"Chocolate_b1\")\nChocolate_b2 = model.addVar(vtype=\"B\", name=\"Chocolate_b2\")\nmodel.addCons(Chocolate_b1 + Chocolate_b2 == 1)\nmodel.addCons(Chocolate == Chocolate1*Chocolate_b1 + Chocolate2*Chocolate_b2)\nProfit_Chocolate = 15 * Chocolate1 * Chocolate_b1 + (15 + 0.02 * (Chocolate2 - 30)) * Chocolate2 * Chocolate_b2\n## create piecewise variables for piecewise function: Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\nFruit1 = model.addVar(vtype=\"INTEGER\", name=\"Fruit1\", lb=0, ub=30)\nFruit2 = model.addVar(vtype=\"INTEGER\", name=\"Fruit2\", lb=30, ub=180)\nFruit_b1 = model.addVar(vtype=\"B\", name=\"Fruit_b1\")\nFruit_b2 = model.addVar(vtype=\"B\", name=\"Fruit_b2\")\nmodel.addCons(Fruit_b1 + Fruit_b2 == 1)\nmodel.addCons(Fruit == Fruit1*Fruit_b1 + Fruit2*Fruit_b2)\nProfit_Fruit = 12 * Fruit1 * Fruit_b1 + (12 + 0.02 * (Fruit2 - 30)) * Fruit2 * Fruit_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\nmodel.addCons(obj == Profit_Classic + Profit_Chocolate + Profit_Fruit)\n\n# Add constraints\n## The bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg.\nmodel.addCons(200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000)\n## The bakery has a daily production capacity of 450 cakes in total.\nmodel.addCons(Classic + Chocolate + Fruit <= 450)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Classic cake: \", model.getVal(Classic))\n    print(\"Quantity of Chocolate cake: \", model.getVal(Chocolate))\n    print(\"Quantity of Fruit cake: \", model.getVal(Fruit))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield per acre is 500 kg, the price per kg is $0.20, and the water usage per acre is 500 liters.\nFor Corn, the expected yield per acre is 700 kg, the price per kg is $0.25, and the water usage per acre is 800 liters.\nFor Soybeans, the expected yield per acre is 400 kg, the price per kg is $0.30, and the water usage per acre is 300 liters.\nThe farmer wants to maximize the profit-to-water ratio (profit per liter of water used).\n// Profit_Wheat = 500 * 0.20 * Wheat\n// Profit_Corn = 700 * 0.25 * Corn\n// Profit_Soybeans = 400 * 0.30 * Soybeans\n// Water_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n\n## Generate Constraint-1:\nThe farmer has 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100",
        "question": "A farmer is planning to plant three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop. The expected yield per acre, price per kg, and water usage per acre for each crop are given in the following Table.\n\n| Crop       | Expected Yield per Acre | Price per Kg | Water Usage per Acre |\n|------------|-------------------------|--------------|----------------------|\n| Wheat      | 500 kg                  | $0.20        | 500 liters           |\n| Corn       | 700 kg                  | $0.25        | 800 liters           |\n| Soybeans   | 400 kg                  | $0.30        | 300 liters           |\n\nThe farmer has 100 acres available for planting. The farmer wants to maximize the profit-to-water ratio (profit per liter of water used). Please help the farmer determine the optimal number of acres to dedicate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer needs to decide how many acres to dedicate to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0) # acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0) # acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 500 * 0.20 * Wheat\nProfit_Corn = 700 * 0.25 * Corn\nProfit_Soybeans = 400 * 0.30 * Soybeans\nWater_Used = 500 * Wheat + 800 * Corn + 300 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / Water_Used\n## convert the division to multiplication\nmodel.addCons(obj * Water_Used == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farmer has 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-to-Water Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost.\n// Revenue from product A: RA = 10 * WA * PriceA\n// Revenue from product B: RB = 15 * WB * PriceB\n// Revenue from product C: RC = 20 * WC * PriceC\n// Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n// So, the objective function is: Maximize (RA + RB + RC - PC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nThe demand for product A is at least 500 units per day.\n// 10 * WA >= 500\n\n## Generate Constraint-3:\nThe demand for product B is at least 750 units per day.\n// 15 * WB >= 750\n\n## Generate Constraint-4:\nThe demand for product C is at least 1000 units per day.\n// 20 * WC >= 1000",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rates and unit production costs for each product are given in the following Table.\n\n| Product | Production Rate (units/worker/hour) | Unit Production Cost |\n|---------|-------------------------------------|----------------------|\n| A       | 10                                  | $5                   |\n| B       | 15                                  | $8                   |\n| C       | 20                                  | $10                  |\n\nThe manufacturer has a total of 50 workers available. The demand for product A is at least 500 units per day, for product B is at least 750 units per day, and for product C is at least 1000 units per day. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Revenue from product A: RA = 10 * WA * PriceA\n## Revenue from product B: RB = 15 * WB * PriceB\n## Revenue from product C: RC = 20 * WC * PriceC\n## Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n## So, the objective function is: Maximize (RA + RB + RC - PC)\nRA = 10 * WA\nRB = 15 * WB\nRC = 20 * WC\nPC = 5 * RA + 8 * RB + 10 * RC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RA + RB + RC - PC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## The demand for product A is at least 500 units per day.\nmodel.addCons(10 * WA >= 500)\n## The demand for product B is at least 750 units per day.\nmodel.addCons(15 * WB >= 750)\n## The demand for product C is at least 1000 units per day.\nmodel.addCons(20 * WC >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations.\n// {\"quantity of ChemX\": \"ChemX\", \"range\": \"ChemX >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemY\": \"ChemY\", \"range\": \"ChemY >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemZ\": \"ChemZ\", \"range\": \"ChemZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nThe profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nThe profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit (profit minus production and storage costs).\n// NetProfit_ChemX = (100 - 50 - 10) * ChemX\n// NetProfit_ChemY = (150 - 70 - 15) * ChemY\n// NetProfit_ChemZ = (200 - 100 - 20) * ChemZ\n// So, the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / (ChemX + ChemY + ChemZ)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// ChemX + ChemY + ChemZ <= 200\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\n// ChemY <= 2 * ChemX\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for production costs.\n// 50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10,000",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations. The profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. The profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. The profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20. The company wants to maximize the net profit per unit (profit minus production and storage costs). The company has a total production capacity of 200 units across all chemicals. Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX. The company has a budget of $10,000 for production costs. Please help the company to maximize the net profit per unit (profit minus production and storage costs) while considering these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemX = model.addVar(vtype=\"INTEGER\", name=\"ChemX\", lb=0) # quantity of ChemX\nChemY = model.addVar(vtype=\"INTEGER\", name=\"ChemY\", lb=0) # quantity of ChemY\nChemZ = model.addVar(vtype=\"INTEGER\", name=\"ChemZ\", lb=0) # quantity of ChemZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_ChemX = (100 - 50 - 10) * ChemX\nNetProfit_ChemY = (150 - 70 - 15) * ChemY\nNetProfit_ChemZ = (200 - 100 - 20) * ChemZ\nTotalProduction = ChemX + ChemY + ChemZ\n## the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(ChemX + ChemY + ChemZ <= 200)\n## Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\nmodel.addCons(ChemY <= 2 * ChemX)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChemX: \", model.getVal(ChemX))\n    print(\"Quantity of ChemY: \", model.getVal(ChemY))\n    print(\"Quantity of ChemZ: \", model.getVal(ChemZ))\n    print(\"Maximized Net Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 992,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day. The company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. Please help the company to minimize the total fuel consumption of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Warehouse C\n\n# Define objective function\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n# So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 823,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it incurs a storage cost of $5 per unit per month.\nThe profit per unit of product B is $70, but it incurs a storage cost of $7 per unit per month.\nThe profit per unit of product C is $90, but it incurs a storage cost of $9 per unit per month.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total storage cost: Storage = 5A + 7B + 9C\n// So, the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $10,000.\n// 50A + 70B + 90C <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe demand for product A must be met, which is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 30% of the total production is of product B.\n// B >= 0.3 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage.\nThe profit per unit of product A is $50, but it incurs a storage cost of $5 per unit per month.\nThe profit per unit of product B is $70, but it incurs a storage cost of $7 per unit per month.\nThe profit per unit of product C is $90, but it incurs a storage cost of $9 per unit per month.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\nThe total production cost for all products must not exceed $10,000.\nThe company has a storage capacity limit of 200 units across all products.\nThe demand for product A must be met, which is at least 100 units.\nThe company wants to ensure that at least 30% of the total production is of product B.\nPlease help the company to determine the optimal production quantities for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 90C\n## Total storage cost: Storage = 5A + 7B + 9C\n## So, the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\nmodel.addCons(obj == 45 * A + 63 * B + 81 * C)\n\n# Add constraints\n## The total production cost for all products must not exceed $10,000.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The company has a storage capacity limit of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The demand for product A must be met, which is at least 100 units.\nmodel.addCons(A >= 100)\n## The company wants to ensure that at least 30% of the total production is of product B.\nmodel.addCons(B >= 0.3 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1000,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand.\n// {\"production quantity for Product A\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product B\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for Product C\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $90. The company wants to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * QuantityA\n// Total profit for Product B: ProfitB = 70 * QuantityB\n// Total profit for Product C: ProfitC = 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units.\n// 2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of Product A must be at least twice the production of Product B.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-3:\nThe company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\n// QuantityC <= 0.5 * (QuantityA + QuantityB)",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantity of each product to maximize profit while considering the constraints of raw material availability and market demand. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $90             |\n\nThe company has a limited amount of raw material. The raw material required for producing one unit of Product A is 2 units, for Product B is 3 units, and for Product C is 4 units. The total raw material available is 1000 units. Due to market demand, the production of Product A must be at least twice the production of Product B. Additionally, the company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for Product A\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for Product B\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for Product C\n\n# Define objective function\nProfitA = 50 * QuantityA\nProfitB = 70 * QuantityB\nProfitC = 90 * QuantityC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a limited amount of raw material.\nmodel.addCons(2 * QuantityA + 3 * QuantityB + 4 * QuantityC <= 1000)\n# Due to market demand, the production of Product A must be at least twice the production of Product B.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company has a policy to ensure that the production of Product C does not exceed 50% of the total production of Product A and Product B.\nmodel.addCons(QuantityC <= 0.5 * (QuantityA + QuantityB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for Product A: \", model.getVal(QuantityA))\n    print(\"Production Quantity for Product B: \", model.getVal(QuantityB))\n    print(\"Production Quantity for Product C: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 995,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe production capacity for Product A is limited to 100 units.\n// ProductA <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product B.\n// ProductB >= 50\n\n## Generate Constraint-4:\nThe total production of all products must not exceed 200 units.\n// ProductA + ProductB + ProductC <= 200\n\n## Generate Constraint-5:\nThe company aims to use at least 80% of its raw material budget.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC >= 0.8 * 5000",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C). The profit per unit of Product A is $50 and it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company has a budget of $5000 for raw materials. The production capacity for Product A is limited to 100 units. The company must produce at least 50 units of Product B. The total production of all products must not exceed 200 units. The company aims to use at least 80% of its raw material budget. Please help the company to maximize the total profit while considering the cost of raw materials.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n## Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n## The production capacity for Product A is limited to 100 units.\nmodel.addCons(ProductA <= 100)\n## The company must produce at least 50 units of Product B.\nmodel.addCons(ProductB >= 50)\n## The total production of all products must not exceed 200 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 200)\n## The company aims to use at least 80% of its raw material budget.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC >= 0.8 * 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 757,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of energy-efficient lighting systems\": \"Lighting\", \"range\": \"Lighting >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it saves $200 annually in energy costs.\nThe cost of each wind turbine is $2000, and it saves $300 annually in energy costs.\nThe cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// Total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Lighting\n// Total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Lighting\n// So, the objective function is: Minimize Cost - Savings\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000\n\n## Generate Constraint-2:\nThe company aims to save at least $20,000 annually in energy costs.\n// 200 * Solar + 300 * Wind + 100 * Lighting >= 20000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities. The cost and annual energy savings for each type of installation are given in the following Table.\n\n| Installation Type | Cost per Unit | Annual Energy Savings per Unit |\n|-------------------|---------------|--------------------------------|\n| Solar Panels      | $1000         | $200                           |\n| Wind Turbines     | $2000         | $300                           |\n| Energy-Efficient Lighting Systems | $500 | $100                           |\n\nThe company has a budget of $100,000 for the installation. The company aims to save at least $20,000 annually in energy costs. Please help the company to minimize the total cost of installation while maximizing the annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nLighting = model.addVar(vtype=\"INTEGER\", name=\"Lighting\", lb=0) # number of energy-efficient lighting systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Lighting\nSavings = 200 * Solar + 300 * Wind + 100 * Lighting\n## the objective function is: Minimize Cost - Savings\nmodel.addCons(obj == Cost - Savings)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000)\n## The company aims to save at least $20,000 annually in energy costs.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Lighting >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Energy-Efficient Lighting Systems: \", model.getVal(Lighting))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\n// Cost_A = (10 - 0.0001 * Automation) * A\n// Cost_B = (15 - 0.0001 * Automation) * B\n// Cost_C = (20 - 0.0001 * Automation) * C\n// So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost. The total production capacity of the company is 1000 units. Please help the company determine the optimal production quantities of components A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (10 - 0.0001 * Automation) * A\nCost_B = (15 - 0.0001 * Automation) * B\nCost_C = (20 - 0.0001 * Automation) * C\n# So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-3:\nThe demand for smartphones is at least 300 units per hour.\n// 10 * Smartphone >= 300\n\n## Generate Constraint-4:\nThe demand for tablets is at least 450 units per hour.\n// 15 * Tablet >= 450\n\n## Generate Constraint-5:\nThe demand for laptops is at least 600 units per hour.\n// 20 * Laptop >= 600",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The total number of workers available is 50. The manufacturer has a budget constraint that limits the total production cost to $1000 per hour. The demand for smartphones is at least 300 units per hour. The demand for tablets is at least 450 units per hour. The demand for laptops is at least 600 units per hour.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(10 * Smartphone >= 300)\nmodel.addCons(15 * Tablet >= 450)\nmodel.addCons(20 * Laptop >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production Line: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production Line: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production Line: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production line efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate of all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in enhancing the production line efficiency cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nThe production rate of each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate of each product and the investment in enhancing the production line efficiency. The production cost per unit decreases by $5 for every $10,000 invested in enhancing the production line efficiency. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\nThe total production rate of all products must not exceed 100 units per hour. The investment in enhancing the production line efficiency cannot exceed $50,000. The production rate of each product must be at least 10 units per hour.\nPlease help the company to determine the optimal production rates and investment in production line efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate of product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production line efficiency\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Efficiency)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate of all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in enhancing the production line efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in Production Line Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n// Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n// Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production rate for each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10\n\n## Generate Constraint-4:\nThe company has a limited workforce that can handle a maximum of 80 units per hour in total.\n// P1 + P2 + P3 <= 80",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\nThe total production rate for all products must not exceed 100 units per hour. The investment in automation cannot exceed $50,000. The production rate for each product must be at least 10 units per hour. The company has a limited workforce that can handle a maximum of 80 units per hour in total.\nPlease help the company to determine the optimal production rates and level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate for product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n## Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n## Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\nProfit1 = (150 - (100 - 0.0005 * Automation)) * P1\nProfit2 = (200 - (100 - 0.0005 * Automation)) * P2\nProfit3 = (250 - (100 - 0.0005 * Automation)) * P3\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total production rate for all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The production rate for each product must be at least 10 units per hour.\nmodel.addCons(P1 >= 10)\nmodel.addCons(P2 >= 10)\nmodel.addCons(P3 >= 10)\n## The company has a limited workforce that can handle a maximum of 80 units per hour in total.\nmodel.addCons(P1 + P2 + P3 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 987,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company aims to maximize the total profit while considering the efficiency of production time.\n// Profit_P1 = 30 * Q1 - 10 * Q1\n// Profit_P2 = 40 * Q2 - 15 * Q2\n// Profit_P3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit, production cost per unit, and production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|--------------------------|\n| P1      | $30             | $10                      | 1 hour                   |\n| P2      | $40             | $15                      | 2 hours                  |\n| P3      | $50             | $20                      | 3 hours                  |\n\nThe company has a total production time of 200 hours. The company also has a budget of $10,000 for production costs. Please help the company to maximize the total profit while considering the efficiency of production time, which is defined as the sum of the profit from each product divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (30 - 10) * Q1\nProfit_P2 = (40 - 15) * Q2\nProfit_P3 = (50 - 20) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines.\n// The production rate for machine 1: P1 = 10 * W1\n// The production rate for machine 2: P2 = 12 * W2\n// The production rate for machine 3: P3 = 15 * W3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 30 workers available for allocation.\n// W1 + W2 + W3 <= 30\n\n## Generate Constraint-2:\nEach machine can operate with a maximum of 10 workers at a time.\n// W1 <= 10; W2 <= 10; W3 <= 10\n\n## Generate Constraint-3:\nThe plant must produce at least 200 units per hour.\n// 10 * W1 + 12 * W2 + 15 * W3 >= 200",
        "question": "A manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency. Each machine has a different efficiency rate per worker: Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines. There are a total of 30 workers available for allocation, and each machine can operate with a maximum of 10 workers at a time. Additionally, the plant must produce at least 200 units per hour. Please help the manager determine the optimal number of workers to assign to each machine.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on machine 3\n\n# Define objective function\nP1 = 10 * W1\nP2 = 12 * W2\nP3 = 15 * W3\n# So, the objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# There are a total of 30 workers available for allocation.\nmodel.addCons(W1 + W2 + W3 <= 30)\n# Each machine can operate with a maximum of 10 workers at a time.\nmodel.addCons(W1 <= 10)\nmodel.addCons(W2 <= 10)\nmodel.addCons(W3 <= 10)\n# The plant must produce at least 200 units per hour.\nmodel.addCons(10 * W1 + 12 * W2 + 15 * W3 >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Machine 1: \", model.getVal(W1))\n    print(\"Number of Workers on Machine 2: \", model.getVal(W2))\n    print(\"Number of Workers on Machine 3: \", model.getVal(W3))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of energy-efficient lighting systems\": \"Lighting\", \"range\": \"Lighting >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it saves $200 annually in energy costs.\nThe cost of each wind turbine is $2000, and it saves $300 annually in energy costs.\nThe cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// Total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Lighting\n// Total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Lighting\n// So, the objective function is: Minimize Cost - Savings\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000\n\n## Generate Constraint-2:\nThe company aims to save at least $20,000 annually in energy costs.\n// 200 * Solar + 300 * Wind + 100 * Lighting >= 20000\n\n## Generate Constraint-3:\nThe company must install at least 50 solar panels.\n// Solar >= 50\n\n## Generate Constraint-4:\nThe number of wind turbines should not exceed 30% of the total number of solar panels and wind turbines.\n// Wind <= 0.3 * (Solar + Wind)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in its facilities. The cost of each solar panel is $1000, and it saves $200 annually in energy costs. The cost of each wind turbine is $2000, and it saves $300 annually in energy costs. The cost of each energy-efficient lighting system is $500, and it saves $100 annually in energy costs. The company has a budget of $100,000 for the installation and aims to save at least $20,000 annually in energy costs. The company must install at least 50 solar panels, and the number of wind turbines should not exceed 30% of the total number of solar panels and wind turbines. Please help the company to minimize the total cost of installation while maximizing the annual energy savings.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=50)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nLighting = model.addVar(vtype=\"INTEGER\", name=\"Lighting\", lb=0)  # number of energy-efficient lighting systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 500 * Lighting\nSavings = 200 * Solar + 300 * Wind + 100 * Lighting\n## the objective function is: Minimize Cost - Savings\nmodel.addCons(obj == Cost - Savings)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Lighting <= 100000)\n## The company aims to save at least $20,000 annually in energy costs.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Lighting >= 20000)\n## The company must install at least 50 solar panels.\nmodel.addCons(Solar >= 50)\n## The number of wind turbines should not exceed 30% of the total number of solar panels and wind turbines.\nmodel.addCons(Wind <= 0.3 * (Solar + Wind))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Energy-Efficient Lighting Systems: \", model.getVal(Lighting))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\n// {\"number of units of cake A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has only one oven and can only bake one type of cake at a time. The bakery aims to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n// Profit of A: Profit_A = (20 - 5) * A\n// Profit of B: Profit_B = (30 - 10) * B\n// Profit of C: Profit_C = (40 - 15) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1000 for ingredients for the month.\n// 5 * A + 10 * B + 15 * C <= 1000",
        "question": "A bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has only one oven and can only bake one type of cake at a time. The bakery has a budget of $1000 for ingredients for the month.\nPlease help the bakery to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of cake A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of cake B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of cake C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (30 - 10) * B\nProfit_C = (40 - 15) * C\nBakingTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a budget of $1000 for ingredients for the month.\nmodel.addCons(5 * A + 10 * B + 15 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(A))\n    print(\"Number of Cake B: \", model.getVal(B))\n    print(\"Number of Cake C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company aims to maximize the total profit from both products.\n// Profit_A = (100 - (60 - 2 * Automation)) * ProductA\n// Profit_B = (150 - (80 - 3 * Automation)) * ProductB\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for both products combined.\n// ProductA + ProductB <= 500\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $10,000.\n// Automation <= 10000",
        "question": "A manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. Product A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80.\n\nThe company has a total production capacity of 500 units for both products combined. The investment in automation cannot exceed $10,000. The company aims to maximize the total profit from both products.\n\nPlease help the company determine the optimal production quantities of Product A and Product B, and the level of automation to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfit_A = (100 - (60 - 2 * Automation)) * ProductA\nProfit_B = (150 - (80 - 3 * Automation)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 500)\nmodel.addCons(Automation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various constraints.\n// {\"quantity of ProductA\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductB\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ProductC\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company wants to maximize the total profit from all products.\n// Total profit for ProductA: Profit_ProductA = 50 * ProductA\n// Total profit for ProductB: Profit_ProductB = 70 * ProductB\n// Total profit for ProductC: Profit_ProductC = 90 * ProductC\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all products combined.\n// ProductA + ProductB + ProductC <= 1000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product to maximize profit while considering various constraints. The profit per unit for ProductA is $50, for ProductB is $70, and for ProductC is $90. The company wants to maximize the total profit from all products. The company has a total production capacity of 1000 units for all products combined. Please help the company determine the optimal production quantities for ProductA, ProductB, and ProductC to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of ProductA\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of ProductB\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of ProductC\n\n# Define objective function\nProfit_ProductA = 50 * ProductA\nProfit_ProductB = 70 * ProductB\nProfit_ProductC = 90 * ProductC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB + ProductC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ProductA: \", model.getVal(ProductA))\n    print(\"Quantity of ProductB: \", model.getVal(ProductB))\n    print(\"Quantity of ProductC: \", model.getVal(ProductC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 602,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Crop A is $100, but it depletes the soil's nitrogen by 2 units. \nThe profit per acre for Crop B is $150, but it depletes the soil's nitrogen by 3 units. \nThe profit per acre for Crop C is $200, but it depletes the soil's nitrogen by 4 units. \nThe farmer wants to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Soil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + 50)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total soil nitrogen depletion must not exceed 100 units.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-3:\nThe farmer must allocate at least 10 acres to Crop A.\n// A >= 10\n\n## Generate Constraint-4:\nThe farmer must allocate at least 20 acres to either Crop B or Crop C, but not both.\n// B + C >= 20\n// B * C = 0 (This ensures that either B or C is 0, not both)",
        "question": "A farmer grows three types of crops: Crop A, Crop B, and Crop C. He needs to decide how many acres to allocate to each crop to maximize his profit while considering the soil's nutrient depletion. The profit per acre and the soil nitrogen depletion per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Soil Nitrogen Depletion per Acre |\n|------|-----------------|---------------------------------|\n| A    | $100            | 2 units                         |\n| B    | $150            | 3 units                         |\n| C    | $200            | 4 units                         |\n\nThe farmer has a total of 100 acres available for cultivation. The total soil nitrogen depletion must not exceed 100 units. The farmer must allocate at least 10 acres to Crop A. The farmer must allocate at least 20 acres to either Crop B or Crop C, but not both. \n\nPlease help the farmer to maximize his total profit while maintaining a minimum soil nitrogen level of 50 units, considering the constraints mentioned above.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nSoil_Nitrogen_Depletion = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C + 50)\n## convert the division to multiplication\nmodel.addCons(obj * (2 * A + 3 * B + 4 * C + 50) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total soil nitrogen depletion must not exceed 100 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farmer must allocate at least 20 acres to either Crop B or Crop C, but not both.\nmodel.addCons(B + C >= 20)\nmodel.addCons(B * C == 0) # This ensures that either B or C is 0, not both\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production.\n// {\"number of solar panels on flat roof\": \"SF\", \"range\": \"SF >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on pitched roof\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on domed roof\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies based on the type of roof. On a flat roof, each panel produces 100 kWh. On a pitched roof, each panel produces 120 kWh. On a domed roof, each panel produces 150 kWh. The company aims to maximize the total energy production from all roofs.\n// Total energy production: Energy = 100 * SF + 120 * SP + 150 * SD\n// So, the objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe total number of solar panels that can be installed is limited to 1000.\n// SF + SP + SD <= 1000\n\n## Generate Constraint-2:\nThe company has a budget constraint that limits the number of panels that can be installed on each type of roof. The budget allows for at most 400 panels on flat roofs, 500 panels on pitched roofs, and 300 panels on domed roofs.\n// SF <= 400; SP <= 500; SD <= 300\n\n## Generate Constraint-3:\nThe company wants to ensure a balanced distribution of panels across all types of roofs. The ratio of panels on flat roofs to pitched roofs should be at least 1:2, and the ratio of panels on domed roofs to pitched roofs should be at least 1:3.\n// SF >= 0.5 * SP; SD >= 0.33 * SP",
        "question": "A solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production. The energy production from each solar panel varies based on the type of roof. On a flat roof, each panel produces 100 kWh. On a pitched roof, each panel produces 120 kWh. On a domed roof, each panel produces 150 kWh.\nThe total number of solar panels that can be installed is limited to 1000. The company has a budget constraint that limits the number of panels that can be installed on each type of roof. The budget allows for at most 400 panels on flat roofs, 500 panels on pitched roofs, and 300 panels on domed roofs. The company wants to ensure a balanced distribution of panels across all types of roofs. The ratio of panels on flat roofs to pitched roofs should be at least 1:2, and the ratio of panels on domed roofs to pitched roofs should be at least 1:3.\nPlease help the company to maximize the total energy production from all roofs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSF = model.addVar(vtype=\"INTEGER\", name=\"SF\", lb=0, ub=400) # number of solar panels on flat roof\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0, ub=500) # number of solar panels on pitched roof\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0, ub=300) # number of solar panels on domed roof\n\n# Define objective function\nEnergy = 100 * SF + 120 * SP + 150 * SD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\nmodel.addCons(SF + SP + SD <= 1000)\nmodel.addCons(SF <= 400)\nmodel.addCons(SP <= 500)\nmodel.addCons(SD <= 300)\nmodel.addCons(SF >= 0.5 * SP)\nmodel.addCons(SD >= 0.33 * SP)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roof: \", model.getVal(SF))\n    print(\"Number of Solar Panels on Pitched Roof: \", model.getVal(SP))\n    print(\"Number of Solar Panels on Domed Roof: \", model.getVal(SD))\n    print(\"Maximized Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand.\n// {\"quantity of Smartphones\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\n// So, the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 2 units, each Tablet requires 3 units, and each Laptop requires 4 units of this component. The total available units of this component are 1000.\n// 2 * Smartphone + 3 * Tablet + 4 * Laptop <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 400 units, and for Laptops is 300 units.\n// Smartphone <= 500; Tablet <= 400; Laptop <= 300",
        "question": "A manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company has a limited supply of a critical component used in all devices, with each Smartphone requiring 2 units, each Tablet requiring 3 units, and each Laptop requiring 4 units of this component, totaling 1000 units. The market has a demand limit for each device, with the demand limit for Smartphones being 500 units, for Tablets being 400 units, and for Laptops being 300 units. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 400 units, and for Laptops is 300 units.\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0, ub=500) # quantity of Smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=400) # quantity of Tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0, ub=300) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\nSmartphone1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone1\", lb=0, ub=100)\nSmartphone2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone2\", lb=100, ub=500)\nSmartphone_b1 = model.addVar(vtype=\"B\", name=\"Smartphone_b1\")\nSmartphone_b2 = model.addVar(vtype=\"B\", name=\"Smartphone_b2\")\nmodel.addCons(Smartphone_b1 + Smartphone_b2 == 1)\nmodel.addCons(Smartphone == Smartphone1*Smartphone_b1 + Smartphone2*Smartphone_b2)\nProfit_Smartphone = 100 * Smartphone1 * Smartphone_b1 + (100 + 0.5 * (Smartphone2 - 100)) * Smartphone2 * Smartphone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=400)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 200 * Laptop1 * Laptop_b1 + (200 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Smartphone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\n## The company has a limited supply of a critical component used in all devices. Each Smartphone requires 2 units, each Tablet requires 3 units, and each Laptop requires 4 units of this component. The total available units of this component are 1000.\nmodel.addCons(2 * Smartphone + 3 * Tablet + 4 * Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(Smartphone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit.\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product type depends on the labor hours invested. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3 = 100 * L1^0.7 + 150 * L2^0.6 + 200 * L3^0.5\n\n## Generate Constraint-1:\nThe total labor hours available for all products is 1000 hours.\n// L1 + L2 + L3 <= 1000\n\n## Generate Constraint-2:\nThe company has a policy to allocate at least 20% of the total labor hours to product 1.\n// L1 >= 0.2 * (L1 + L2 + L3)\n\n## Generate Constraint-3:\nThe labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\n// L3 <= 2 * L1",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit. The profit from each product type depends on the labor hours invested, with the profit functions being:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products. The total labor hours available for all products is 1000 hours. The company has a policy to allocate at least 20% of the total labor hours to product 1. Additionally, the labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\nPlease help the company determine the optimal allocation of labor hours (L1, L2, L3) to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for product 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for product 3\n\n# Define objective function\n## The profit from each product type depends on the labor hours invested.\nP1 = 100 * L1**0.7\nP2 = 150 * L2**0.6\nP3 = 200 * L3**0.5\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total labor hours available for all products is 1000 hours.\nmodel.addCons(L1 + L2 + L3 <= 1000)\n## The company has a policy to allocate at least 20% of the total labor hours to product 1.\nmodel.addCons(L1 >= 0.2 * (L1 + L2 + L3))\n## The labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\nmodel.addCons(L3 <= 2 * L1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours for Product 1: \", model.getVal(L1))\n    print(\"Labor hours for Product 2: \", model.getVal(L2))\n    print(\"Labor hours for Product 3: \", model.getVal(L3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"size of the geothermal system in units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company wants to minimize the total cost of installation while maximizing the total daily energy generation.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\n// Total daily energy generation: Energy = 100 * Solar + 200 * Wind + 300 * Geothermal\n// The objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000\n\n## Generate Constraint-2:\nThe company requires at least 5000 kWh of energy per day.\n// 100 * Solar + 200 * Wind + 300 * Geothermal >= 5000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system. The cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company has a budget of $100,000 for the installation and requires at least 5000 kWh of energy per day. Please help the company to minimize the total cost of installation while maximizing the total daily energy generation, defined as the total cost divided by the total daily energy generation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # size of the geothermal system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\nEnergy = 100 * Solar + 200 * Wind + 300 * Geothermal\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000)\n## The company requires at least 5000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind + 300 * Geothermal >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Size of Geothermal System: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 657,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs.\n// {\"hours facility 1 operates\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours facility 2 operates\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours facility 3 operates\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach facility has a different cost per hour and efficiency in producing the chemical. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The objective is to minimize the total cost of operation while meeting the production target.\n// The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\n// The total production: P = 50 * H1 + 60 * H2 + 70 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total operating hours for all facilities combined must not exceed 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nEach facility can operate for a maximum of 20 hours.\n// H1 <= 20; H2 <= 20; H3 <= 20\n\n## Generate Constraint-3:\nThe total production must meet or exceed the target of 3000 units.\n// 50 * H1 + 60 * H2 + 70 * H3 >= 3000",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many hours each facility should operate to meet production targets while minimizing costs. Facility 1 costs $100 per hour and produces 50 units per hour, Facility 2 costs $120 per hour and produces 60 units per hour, and Facility 3 costs $150 per hour and produces 70 units per hour. The company needs to produce at least 3000 units of the chemical. The total operating hours for all facilities combined must not exceed 40 hours, and each facility can operate for a maximum of 20 hours. Please help the company to minimize the total cost of operation while meeting the production target.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours facility 1 operates\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours facility 2 operates\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours facility 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 100 * H1 + 120 * H2 + 150 * H3\nmodel.addCons(obj == 100 * H1 + 120 * H2 + 150 * H3)\n\n# Add constraints\n## The total operating hours for all facilities combined must not exceed 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## Each facility can operate for a maximum of 20 hours.\nmodel.addCons(H1 <= 20)\nmodel.addCons(H2 <= 20)\nmodel.addCons(H3 <= 20)\n## The total production must meet or exceed the target of 3000 units.\nmodel.addCons(50 * H1 + 60 * H2 + 70 * H3 >= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Facility 1 Operates: \", model.getVal(H1))\n    print(\"Hours Facility 2 Operates: \", model.getVal(H2))\n    print(\"Hours Facility 3 Operates: \", model.getVal(H3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 702,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints.\n// {\"number of units of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The company wants to maximize the total profit from selling these products.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25.\n// 20 * A + 30 * B + 25 * C <= 15000\n\n## Generate Constraint-2:\nThe company has a maximum storage capacity of 500 units across all products.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of Product A to meet contractual obligations.\n// A >= 100\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of Product B as Product A.\n// B >= 2 * A\n\n## Generate Constraint-5:\nThe company wants to ensure that the production of Product C does not exceed 30% of the total production.\n// C <= 0.3 * (A + B + C)",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C) to maximize profit while considering various constraints. The profit per unit for each product is as follows:\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a limited budget of $15,000 for production costs. The cost per unit for Product A is $20, for Product B is $30, and for Product C is $25. The company has a maximum storage capacity of 500 units across all products. The company must produce at least 100 units of Product A to meet contractual obligations. The company aims to produce at least twice as many units of Product B as Product A. The company wants to ensure that the production of Product C does not exceed 30% of the total production.\n\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of Product C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited budget of $15,000 for production costs.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 15000)\n# The company has a maximum storage capacity of 500 units across all products.\nmodel.addCons(A + B + C <= 500)\n# The company must produce at least 100 units of Product A to meet contractual obligations.\nmodel.addCons(A >= 100)\n# The company aims to produce at least twice as many units of Product B as Product A.\nmodel.addCons(B >= 2 * A)\n# The company wants to ensure that the production of Product C does not exceed 30% of the total production.\nmodel.addCons(C <= 0.3 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\n// A <= 50; B <= 60\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\n// C - (A + B) <= 20\n\n## Generate Constraint-4:\nThe market demand for Device C is limited to 80 units.\n// C <= 80",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\nThe company has a budget constraint of $1000 for the total production costs. The company has a production capacity constraint of 50 units for Device A and 60 units for Device B. The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units. The market demand for Device C is limited to 80 units.\nPlease help the company to maximize the total profit from selling the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50)  # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=60)  # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=80)  # quantity of device C\n\n# Define objective function\n## For Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2).\nProfit_A = 20 * A - 0.01 * A**2\n## For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B).\nProfit_B = 30 * B - 2 * B\n## For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C).\nProfit_C = 40 * C - (50 - 0.5 * C)\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A**2 + 2 * B + (50 - 0.5 * C) <= 1000)\n## The company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 60)\n## The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\nmodel.addCons(C - (A + B) <= 20)\n## The market demand for Device C is limited to 80 units.\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit.\nThe profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit.\nThe profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit.\nThe company wants to maximize its net profit, which is the total profit minus the total cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = 10A + 5B + 3C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10A + 5B + 3C <= 5000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 100 units across all products.\n// A + B + C <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of product A to fulfill a contract.\n// A >= 20",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit. The profit per unit and the production cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|---------------------------|\n| A       | $50             | $10                       |\n| B       | $70             | $5                        |\n| C       | $90             | $3                        |\n\nThe company has a budget of $5000 for production costs. The total production capacity is limited to 100 units across all products. The company must produce at least 20 units of product A to fulfill a contract. \nPlease help the company to maximize its net profit, which is the total profit minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 20 units of product A to fulfill a contract.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * A + 5 * B + 3 * C\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 5 * B + 3 * C <= 5000)\n## The total production capacity is limited to 100 units across all products.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. The profit per unit and the production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $30             | 2 hours                  |\n| B       | $40             | 3 hours                  |\n| C       | $50             | 4 hours                  |\n\nThe plant has a total of 100 hours available for production. The plant aims to maximize the total profit while considering the production time constraints. Please help the plant determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit.\n// {\"acres of Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farm has different yield rates and profit margins for each crop. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops.\n// Total profit from Wheat: Profit_Wheat = 50 * 10 * WheatAcres\n// Total profit from Corn: Profit_Corn = 60 * 12 * CornAcres\n// Total profit from Soybeans: Profit_Soybeans = 40 * 15 * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// WheatAcres + CornAcres + SoybeansAcres <= 100",
        "question": "A farm is cultivating three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its yield and profit. The yield rate for Wheat is 50 bushels per acre, with a profit of $10 per bushel. For Corn, the yield rate is 60 bushels per acre, with a profit of $12 per bushel. For Soybeans, the yield rate is 40 bushels per acre, with a profit of $15 per bushel. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation. Please help the farm determine the optimal allocation of acres to each crop to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of Soybeans\n\n# Define objective function\nProfit_Wheat = 50 * 10 * WheatAcres\nProfit_Corn = 60 * 12 * CornAcres\nProfit_Soybeans = 40 * 15 * SoybeansAcres\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 645,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnits\", \"range\": \"ProductBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnits\", \"range\": \"ProductCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.3 for each unit produced beyond the first 200 units. The profit per unit for ProductC is $90, but it decreases by $0.2 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\n// Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\n// Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for the month.\n// ProductAUnits + ProductBUnits + ProductCUnits <= 600\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ProductB cannot exceed twice the production of ProductA.\n// ProductBUnits <= 2 * ProductAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20.\n// 10 * ProductAUnits + 15 * ProductBUnits + 20 * ProductCUnits <= 30,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit. The profit per unit for each product decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Product | Profit per Unit (first threshold) | Decrease per Unit beyond threshold | Threshold |\n|---------|-----------------------------------|------------------------------------|-----------|\n| ProductA | $50                              | $0.5                               | 100 units  |\n| ProductB | $70                              | $0.3                               | 200 units  |\n| ProductC | $90                              | $0.2                               | 300 units  |\n\nThe company has a total production capacity of 600 units for the month. Due to resource limitations, the production of ProductB cannot exceed twice the production of ProductA. The company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ProductA is $10, for ProductB is $15, and for ProductC is $20.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0)  # number of units of ProductA\nProductBUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnits\", lb=0)  # number of units of ProductB\nProductCUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnits\", lb=0)  # number of units of ProductC\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\nProductA1 = model.addVar(vtype=\"INTEGER\", name=\"ProductA1\", lb=0, ub=100)\nProductA2 = model.addVar(vtype=\"INTEGER\", name=\"ProductA2\", lb=100, ub=600)\nProductA_b1 = model.addVar(vtype=\"B\", name=\"ProductA_b1\")\nProductA_b2 = model.addVar(vtype=\"B\", name=\"ProductA_b2\")\nmodel.addCons(ProductA_b1 + ProductA_b2 == 1)\nmodel.addCons(ProductAUnits == ProductA1*ProductA_b1 + ProductA2*ProductA_b2)\nProfit_ProductA = (50 - 0.5 * (ProductA2 - 100)) * ProductA2 * ProductA_b2\n\n# Create piecewise variables for piecewise function: Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\nProductB1 = model.addVar(vtype=\"INTEGER\", name=\"ProductB1\", lb=0, ub=200)\nProductB2 = model.addVar(vtype=\"INTEGER\", name=\"ProductB2\", lb=200, ub=600)\nProductB_b1 = model.addVar(vtype=\"B\", name=\"ProductB_b1\")\nProductB_b2 = model.addVar(vtype=\"B\", name=\"ProductB_b2\")\nmodel.addCons(ProductB_b1 + ProductB_b2 == 1)\nmodel.addCons(ProductBUnits == ProductB1*ProductB_b1 + ProductB2*ProductB_b2)\nProfit_ProductB = (70 - 0.3 * (ProductB2 - 200)) * ProductB2 * ProductB_b2\n\n# Create piecewise variables for piecewise function: Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\nProductC1 = model.addVar(vtype=\"INTEGER\", name=\"ProductC1\", lb=0, ub=300)\nProductC2 = model.addVar(vtype=\"INTEGER\", name=\"ProductC2\", lb=300, ub=600)\nProductC_b1 = model.addVar(vtype=\"B\", name=\"ProductC_b1\")\nProductC_b2 = model.addVar(vtype=\"B\", name=\"ProductC_b2\")\nmodel.addCons(ProductC_b1 + ProductC_b2 == 1)\nmodel.addCons(ProductCUnits == ProductC1*ProductC_b1 + ProductC2*ProductC_b2)\nProfit_ProductC = (90 - 0.2 * (ProductC2 - 300)) * ProductC2 * ProductC_b2\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAUnits + ProductBUnits + ProductCUnits <= 600)\nmodel.addCons(ProductBUnits <= 2 * ProductAUnits)\nmodel.addCons(10 * ProductAUnits + 15 * ProductBUnits + 20 * ProductCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnits))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1289,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe company has a maximum of 150 hours available for production.\n// 3 * A + 4 * B + 5 * C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. The company has a maximum of 150 hours available for production.\nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The company has a maximum of 150 hours available for production.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 786,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop.\n// {\"acres of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that Crop A will yield 500 kg per acre, Crop B will yield 700 kg per acre, and Crop C will yield 600 kg per acre. The market prices for these crops are $2 per kg for Crop A, $3 per kg for Crop B, and $2.5 per kg for Crop C. The farmer wants to maximize his total revenue from selling these crops.\n// Revenue from Crop A: R_A = 500 * A * 2\n// Revenue from Crop B: R_B = 700 * B * 3\n// Revenue from Crop C: R_C = 600 * C * 2.5\n// So, the objective function is: Maximize R_total = R_A + R_B + R_C\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, at least 20% of the land must be allocated to Crop A.\n// A >= 0.2 * 100",
        "question": "A farmer is planning to plant three different crops (Crop A, Crop B, and Crop C) on his land. He needs to decide how many acres to allocate to each crop. The yield per acre and the market prices for these crops are given in the following Table.\n\n| Crop | Yield per Acre | Market Price per kg |\n|------|----------------|---------------------|\n| A    | 500 kg         | $2                  |\n| B    | 700 kg         | $3                  |\n| C    | 600 kg         | $2.5                |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, at least 20% of the land must be allocated to Crop A. The farmer wants to maximize his total revenue from selling these crops. Please help the farmer determine the optimal allocation of acres to each crop to maximize his revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Crop C\n\n# Define objective function\nR_A = 500 * A * 2\nR_B = 700 * B * 3\nR_C = 600 * C * 2.5\n# So, the objective function is: Maximize R_total = R_A + R_B + R_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R_A + R_B + R_C)\n\n# Add constraints\n# The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n# Due to soil conditions, at least 20% of the land must be allocated to Crop A.\nmodel.addCons(A >= 0.2 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production.\n// Impact_E = 1000 * E / 20000\n// Impact_H = 500 * H / 15000\n// Impact_Hy = 800 * Hy / 25000\n// So, the objective function is: Maximize (Impact_E + Impact_H + Impact_Hy)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E + 15000 * H + 25000 * Hy <= 1000000\n\n## Generate Constraint-2:\nThe production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units.\n// E <= 50; H <= 75; Hy <= 40\n\n## Generate Constraint-3:\nThe market demand for each type of vehicle is also limited. The demand for Electric vehicles is at least 30 units, for Hybrid vehicles is at least 50 units, and for Hydrogen vehicles is at least 20 units.\n// E >= 30; H >= 50; Hy >= 20\n\n## Generate Constraint-4:\nThe total number of vehicles produced cannot exceed 150 units due to overall market saturation.\n// E + H + Hy <= 150",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand. The environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production. The manufacturer has a total production budget of $1,000,000. The production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units. The market demand for each type of vehicle is also limited. The demand for Electric vehicles is at least 30 units, for Hybrid vehicles is at least 50 units, and for Hydrogen vehicles is at least 20 units. The total number of vehicles produced cannot exceed 150 units due to overall market saturation. Please help the manufacturer to determine the optimal production quantities for each type of vehicle to maximize their environmental impact per dollar spent on production.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=30, ub=50)  # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=50, ub=75)  # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=20, ub=40)  # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_E = 1000 * E / 20000\nImpact_H = 500 * H / 15000\nImpact_Hy = 800 * Hy / 25000\n## convert the division to multiplication\nmodel.addCons(obj * (20000 * E + 15000 * H + 25000 * Hy) == 1000 * E + 500 * H + 800 * Hy)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E + 15000 * H + 25000 * Hy <= 1000000)\n## The production capacity for each type of vehicle is limited.\nmodel.addCons(E <= 50)\nmodel.addCons(H <= 75)\nmodel.addCons(Hy <= 40)\n## The market demand for each type of vehicle is also limited.\nmodel.addCons(E >= 30)\nmodel.addCons(H >= 50)\nmodel.addCons(Hy >= 20)\n## The total number of vehicles produced cannot exceed 150 units due to overall market saturation.\nmodel.addCons(E + H + Hy <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1542,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device.\n// {\"number of workers for smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers for tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers for laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker can produce 10 smartphones, 8 tablets, or 6 laptops per hour. The cost of production per device varies inversely with the number of workers assigned. The cost per smartphone is $50/S, per tablet is $70/T, and per laptop is $100/L. The manufacturer aims to minimize the total production cost while meeting the demand for each device.\n// Total cost of smartphones: Cost_S = 10 * S * (50/S) = 500\n// Total cost of tablets: Cost_T = 8 * T * (70/T) = 560\n// Total cost of laptops: Cost_L = 6 * L * (100/L) = 600\n// Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nThe demand for smartphones is at least 500 units.\n// 10 * S >= 500\n\n## Generate Constraint-3:\nThe demand for tablets is at least 400 units.\n// 8 * T >= 400",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies with the number of workers assigned to each device. The number of devices each worker can produce per hour and the cost of production per device are given in the following Table.\n\n| Device     | Devices Produced per Worker per Hour | Cost per Device |\n|------------|-------------------------------------|-----------------|\n| Smartphones| 10                                  | $50/S           |\n| Tablets    | 8                                   | $70/T           |\n| Laptops    | 6                                   | $100/L          |\n\nThe manufacturer has a total of 50 workers available. The demand for smartphones is at least 500 units, and the demand for tablets is at least 400 units. The manufacturer aims to minimize the total production cost while meeting the demand for each device.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each device to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers for smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers for tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers for laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Objective function: Minimize Cost = Cost_S + Cost_T + Cost_L\nmodel.addCons(obj == 500 + 560 + 600)\n\n# Add constraints\n## The total number of workers available is 50.\nmodel.addCons(S + T + L <= 50)\n## The demand for smartphones is at least 500 units.\nmodel.addCons(10 * S >= 500)\n## The demand for tablets is at least 400 units.\nmodel.addCons(8 * T >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers for Smartphones: \", model.getVal(S))\n    print(\"Number of Workers for Tablets: \", model.getVal(T))\n    print(\"Number of Workers for Laptops: \", model.getVal(L))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit.\n// {\"hours for product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours for product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours for product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the production hours. For product A, the profit per hour is 100 - 0.5A (in dollars). For product B, it is 150 - B (in dollars). For product C, it is 200 - 2C (in dollars). The plant manager wants to maximize the total daily profit.\n// The objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 12 hours per day.\n// A + B + C <= 12\n\n## Generate Constraint-2:\nThe production line for product A can operate for a maximum of 5 hours due to equipment limitations.\n// A <= 5\n\n## Generate Constraint-3:\nThe production line for product B can operate for a maximum of 6 hours due to labor constraints.\n// B <= 6",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the optimal number of hours each production line should operate to maximize profit. The profit per hour for each product is different and depends on the production hours. For product A, the profit per hour is 100 - 0.5A (in dollars). For product B, it is 150 - B (in dollars). For product C, it is 200 - 2C (in dollars). The total operating hours for all production lines cannot exceed 12 hours per day. The production line for product A can operate for a maximum of 5 hours due to equipment limitations. The production line for product B can operate for a maximum of 6 hours due to labor constraints. Please help the plant manager to maximize the total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hours for product A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hours for product B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hours for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 0.5 * A) * A\nProfit_B = (150 - B) * B\nProfit_C = (200 - 2 * C) * C\n## the objective function is: Maximize P = (100 - 0.5A) * A + (150 - B) * B + (200 - 2C) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total operating hours for all production lines cannot exceed 12 hours per day.\nmodel.addCons(A + B + C <= 12)\n## The production line for product A can operate for a maximum of 5 hours due to equipment limitations.\nmodel.addCons(A <= 5)\n## The production line for product B can operate for a maximum of 6 hours due to labor constraints.\nmodel.addCons(B <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for product A: \", model.getVal(A))\n    print(\"Hours for product B: \", model.getVal(B))\n    print(\"Hours for product C: \", model.getVal(C))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 773,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type.\n// {\"number of PanelA\": \"PanelA\", \"range\": \"PanelA >= 0\", \"type\": \"integer\"}\n// {\"number of PanelB\": \"PanelB\", \"range\": \"PanelB >= 0\", \"type\": \"integer\"}\n// {\"number of PanelC\": \"PanelC\", \"range\": \"PanelC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nPanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. \nPanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. \nPanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. \nThe company wants to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.\n// Daily energy output for PanelA: Energy_PanelA = 100 * PanelA - 10 * PanelA\n// Daily energy output for PanelB: Energy_PanelB = 150 * PanelB - 15 * PanelB\n// Daily energy output for PanelC: Energy_PanelC = 200 * PanelC - 20 * PanelC\n// Total initial investment cost: Cost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n// So, the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the initial investment.\n// 500 * PanelA + 700 * PanelB + 900 * PanelC <= 100,000",
        "question": "A renewable energy company is planning to install three types of solar panels: PanelA, PanelB, and PanelC. They need to determine the number of each type of panel to install in a new facility to maximize energy output while considering the cost and efficiency of each panel type. PanelA generates 100 kWh per day, costs $500 per unit, and has a maintenance cost of $10 per day. PanelB generates 150 kWh per day, costs $700 per unit, and has a maintenance cost of $15 per day. PanelC generates 200 kWh per day, costs $900 per unit, and has a maintenance cost of $20 per day. The company has a budget of $100,000 for the initial investment. Please help the company to maximize the net daily energy output (energy generated minus maintenance costs) while considering the initial investment cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPanelA = model.addVar(vtype=\"INTEGER\", name=\"PanelA\", lb=0) # number of PanelA\nPanelB = model.addVar(vtype=\"INTEGER\", name=\"PanelB\", lb=0) # number of PanelB\nPanelC = model.addVar(vtype=\"INTEGER\", name=\"PanelC\", lb=0) # number of PanelC\n\n# Define objective function\n## Daily energy output for PanelA: Energy_PanelA = 100 * PanelA - 10 * PanelA\n## Daily energy output for PanelB: Energy_PanelB = 150 * PanelB - 15 * PanelB\n## Daily energy output for PanelC: Energy_PanelC = 200 * PanelC - 20 * PanelC\nEnergy_PanelA = 100 * PanelA - 10 * PanelA\nEnergy_PanelB = 150 * PanelB - 15 * PanelB\nEnergy_PanelC = 200 * PanelC - 20 * PanelC\n## Total initial investment cost: Cost = 500 * PanelA + 700 * PanelB + 900 * PanelC\nCost = 500 * PanelA + 700 * PanelB + 900 * PanelC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Energy_PanelA + Energy_PanelB + Energy_PanelC) - Cost\nmodel.addCons(obj == Energy_PanelA + Energy_PanelB + Energy_PanelC - Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the initial investment.\nmodel.addCons(500 * PanelA + 700 * PanelB + 900 * PanelC <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of PanelA: \", model.getVal(PanelA))\n    print(\"Number of PanelB: \", model.getVal(PanelB))\n    print(\"Number of PanelC: \", model.getVal(PanelC))\n    print(\"Maximized Net Daily Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while maintaining service quality. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. The service quality is measured by the total capacity of all trucks, where each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company wants to maximize the service quality (capacity) while minimizing the operational cost.\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\n// Total capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n// So, the objective function is: Minimize (Cost / Capacity)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 per day for operational costs.\n// 500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20,000\n\n## Generate Constraint-2:\nThe total number of trucks available is 30.\n// TruckA + TruckB + TruckC <= 30\n\n## Generate Constraint-3:\nDue to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckA <= 2 * TruckB",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. Each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company has a budget of $20,000 per day for operational costs and a total of 30 trucks available. Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB. The company aims to maximize the service quality (capacity) while minimizing the operational cost. Please help the company to minimize the total operational cost while maintaining service quality, measured by the total capacity of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n## the objective function is: Minimize (Cost / Capacity)\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $20,000 per day for operational costs.\nmodel.addCons(500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20000)\n## The total number of trucks available is 30.\nmodel.addCons(TruckA + TruckB + TruckC <= 30)\n## Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\nmodel.addCons(TruckA <= 2 * TruckB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number of units produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_S = 100S - 0.1S^2\n- Profit from tablets: P_T = 150T - 0.2T^2\n- Profit from laptops: P_L = 200L - 0.3L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe market demand for smartphones and tablets combined should not exceed 800 units.\n// S + T <= 800\n\n## Generate Constraint-3:\nThe company has a minimum production requirement for laptops to maintain its market presence, which is at least 100 units.\n// L >= 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit from each device varies with the number of units produced due to economies of scale and market saturation, as described in the following table:\n\n| Device     | Profit Function                |\n|------------|--------------------------------|\n| Smartphones| P_S = 100S - 0.1S^2           |\n| Tablets    | P_T = 150T - 0.2T^2           |\n| Laptops    | P_L = 200L - 0.3L^2           |\n\nThe total production capacity of the factory is limited to 1000 units per month. The market demand for smartphones and tablets combined should not exceed 800 units. The company has a minimum production requirement for laptops to maintain its market presence, which is at least 100 units.\n\nPlease help the company to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=100) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P_total = P_S + P_T + P_L = (100S - 0.1S^2) + (150T - 0.2T^2) + (200L - 0.3L^2)\n## convert the quadratic terms to linear terms by introducing new variables and constraints\nS_sq = model.addVar(vtype=\"INTEGER\", name=\"S_sq\")\nT_sq = model.addVar(vtype=\"INTEGER\", name=\"T_sq\")\nL_sq = model.addVar(vtype=\"INTEGER\", name=\"L_sq\")\nmodel.addCons(S_sq == S**2)\nmodel.addCons(T_sq == T**2)\nmodel.addCons(L_sq == L**2)\nP_S = 100 * S - 0.1 * S_sq\nP_T = 150 * T - 0.2 * T_sq\nP_L = 200 * L - 0.3 * L_sq\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 1000)\nmodel.addCons(S + T <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1056,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, the production cost per unit for each component is a nonlinear function of the number of units produced: CostA(UnitsA) = 20 * sqrt(UnitsA), CostB(UnitsB) = 30 * sqrt(UnitsB), and CostC(UnitsC) = 40 * sqrt(UnitsC). The company aims to maximize the total net profit.\n// Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n// Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n// Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget constraint on the total production cost, which must not exceed $30,000 per week.\n// 20 * sqrt(UnitsA) * UnitsA + 30 * sqrt(UnitsB) * UnitsB + 40 * sqrt(UnitsC) * UnitsC <= 30,000\n\n## Generate Constraint-4:\nTo ensure a minimum market presence, the company must produce at least 50 units of each component.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering production constraints. The profit per unit and the production cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit |\n|-----------|-----------------|---------------------------|\n| ComponentA | $50             | 20 * sqrt(UnitsA)         |\n| ComponentB | $70             | 30 * sqrt(UnitsB)         |\n| ComponentC | $90             | 40 * sqrt(UnitsC)         |\n\nThe company has a total production capacity of 1000 units per week. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint on the total production cost, which must not exceed $30,000 per week. To ensure a minimum market presence, the company must produce at least 50 units of each component.\n\nPlease help the company to maximize the total net profit, considering all the given constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50)  # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50)  # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50)  # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Total net profit for ComponentA: ProfitA = (50 - 20 * sqrt(UnitsA)) * UnitsA\n## Total net profit for ComponentB: ProfitB = (70 - 30 * sqrt(UnitsB)) * UnitsB\n## Total net profit for ComponentC: ProfitC = (90 - 40 * sqrt(UnitsC)) * UnitsC\n## Convert square root to a variable to handle non-linearity\nsqrt_UnitsA = model.addVar(name=\"sqrt_UnitsA\")\nsqrt_UnitsB = model.addVar(name=\"sqrt_UnitsB\")\nsqrt_UnitsC = model.addVar(name=\"sqrt_UnitsC\")\nmodel.addCons(sqrt_UnitsA * sqrt_UnitsA == UnitsA)\nmodel.addCons(sqrt_UnitsB * sqrt_UnitsB == UnitsB)\nmodel.addCons(sqrt_UnitsC * sqrt_UnitsC == UnitsC)\n\nProfitA = (50 - 20 * sqrt_UnitsA) * UnitsA\nProfitB = (70 - 30 * sqrt_UnitsB) * UnitsB\nProfitC = (90 - 40 * sqrt_UnitsC) * UnitsC\n\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n## Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n## The company has a budget constraint on the total production cost, which must not exceed $30,000 per week.\nmodel.addCons(20 * sqrt_UnitsA * UnitsA + 30 * sqrt_UnitsB * UnitsB + 40 * sqrt_UnitsC * UnitsC <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1134,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cakes, the selling price is $30, the cost of ingredients is $10, and the baking time is 1.5 hours. \nFor Vanilla cakes, the selling price is $25, the cost of ingredients is $8, and the baking time is 1 hour. \nFor Strawberry cakes, the selling price is $28, the cost of ingredients is $9, and the baking time is 1.2 hours.\nThe bakery has only one oven and can bake one type of cake at a time. The bakery aims to maximize the profit efficiency (profit per hour of baking time).\n// Profit_Chocolate = (30 - 10) * C\n// Profit_Vanilla = (25 - 8) * V\n// Profit_Strawberry = (28 - 9) * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 1.2 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited baking time of 80 hours.\n// 1.5 * C + 1 * V + 1.2 * S <= 80",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event. The selling price, cost of ingredients, and baking time for each type of cake are given in the following Table.\n\n| Cake Type     | Selling Price | Cost of Ingredients | Baking Time |\n|---------------|---------------|---------------------|-------------|\n| Chocolate     | $30           | $10                 | 1.5 hours   |\n| Vanilla       | $25           | $8                  | 1 hour      |\n| Strawberry    | $28           | $9                  | 1.2 hours   |\n\nThe bakery has a limited baking time of 80 hours. The bakery has only one oven and can bake one type of cake at a time. \nPlease help the bakery to maximize the profit efficiency (profit per hour of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (30 - 10) * C\nProfit_Vanilla = (25 - 8) * V\nProfit_Strawberry = (28 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 1.2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited baking time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 1.2 * S <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(C))\n    print(\"Number of Vanilla Cakes: \", model.getVal(V))\n    print(\"Number of Strawberry Cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products.\n// The objective function is: Maximize Profit1\n\n## Generate Constraint-1:\nThe total raw materials available for all products is limited to 1000 units.\n// R1 <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for all products is limited to 800 hours.\n// L1 <= 800\n\n## Generate Constraint-3:\nThe total machine hours available for all products is limited to 500 hours.\n// M1 <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of product 1.\n// R1 >= 50",
        "question": "A manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products. The total raw materials available for all products is limited to 1000 units. The total labor hours available for all products is limited to 800 hours. The total machine hours available for all products is limited to 500 hours. The company must produce at least 50 units of product 1. Please help the company determine the optimal allocation of resources to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=50) # raw materials for product 1\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # machine hours for product 1\n\n# Define objective function\n## The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2\n## Convert the nonlinear objective to a linear constraint by introducing new variables and constraints\nR1_sqrt = model.addVar(vtype=\"CONTINUOUS\", name=\"R1_sqrt\")\nL1_pow03 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1_pow03\")\nM1_pow02 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1_pow02\")\nmodel.addCons(R1_sqrt * R1_sqrt == R1)\nmodel.addCons(L1_pow03 * L1_pow03 * L1_pow03 == L1)\nmodel.addCons(M1_pow02 * M1_pow02 == M1)\nProfit1 = 100 * R1_sqrt * L1_pow03 * M1_pow02\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit1\nmodel.addCons(obj == Profit1)\n\n# Add constraints\n## The total raw materials available for all products is limited to 1000 units.\nmodel.addCons(R1 <= 1000)\n## The total labor hours available for all products is limited to 800 hours.\nmodel.addCons(L1 <= 800)\n## The total machine hours available for all products is limited to 500 hours.\nmodel.addCons(M1 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials for Product 1: \", model.getVal(R1))\n    print(\"Labor Hours for Product 1: \", model.getVal(L1))\n    print(\"Machine Hours for Product 1: \", model.getVal(M1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 750,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must be at least twice the production of P2.\n// P1 >= 2 * P2",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|------------------|--------------------------|-----------------------|\n| P1      | $100             | $60                      | $10                   |\n| P2      | $120             | $70                      | $15                   |\n| P3      | $150             | $90                      | $20                   |\n\nThe company has a total production capacity of 200 units. The company has a budget of $10,000 for production costs. Due to market demand, the production of P1 must be at least twice the production of P2. \n\nPlease help the company to maximize the total net profit, considering both production and storage costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must be at least twice the production of P2.\nmodel.addCons(P1 >= 2 * P2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company aims to maximize the net profit per unit of storage space used.\n// Net profit of A: Profit_A = (100 - 60) * A - 5 * A^2\n// Net profit of B: Profit_B = (150 - 90) * B - 10 * B^2\n// Net profit of C: Profit_C = (200 - 120) * C - 15 * C^2\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A^2 + 10 * B^2 + 15 * C^2)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 60 * A + 90 * B + 120 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their profit margin.\nFor Device A, the selling price is $100, the production cost is $60, and the storage cost per unit is $5. \nFor Device B, the selling price is $150, the production cost is $90, and the storage cost per unit is $10. \nFor Device C, the selling price is $200, the production cost is $120, and the storage cost per unit is $15.\nThe company has a budget of $10,000 for production costs.\nThe company aims to maximize the net profit per unit of storage space used.\nPlease help the company to determine the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 60) * A - 5 * A**2\nProfit_B = (150 - 90) * B - 10 * B**2\nProfit_C = (200 - 120) * C - 15 * C**2\nStorageCost = 5 * A**2 + 10 * B**2 + 15 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(60 * A + 90 * B + 120 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 722,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit.\n// {\"production time for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production time for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production time for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The plant aims to maximize the total daily profit.\n// The profit from product 1: R1 = 50 * 10 * P1\n// The profit from product 2: R2 = 70 * 15 * P2\n// The profit from product 3: R3 = 60 * 12 * P3\n// So, the objective function is: Maximize (R1 + R2 + R3)\n\n## Generate Constraint-1:\nThe total production time available in a day is 24 hours.\n// P1 + P2 + P3 <= 24\n\n## Generate Constraint-2:\nThe production line requires a minimum setup time of 2 hours for each product type.\n// P1 >= 2; P2 >= 2; P3 >= 2",
        "question": "A manufacturing plant produces three types of products using a single production line. The plant manager needs to allocate the production time for each product type to maximize profit. The profit per unit of product 1 is $50, product 2 is $70, and product 3 is $60. The production rate for product 1 is 10 units per hour, product 2 is 15 units per hour, and product 3 is 12 units per hour. The plant aims to maximize the total daily profit. The total production time available in a day is 24 hours. The production line requires a minimum setup time of 2 hours for each product type. Please help the plant manager determine the optimal allocation of production time for each product type.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=2) # production time for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=2) # production time for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=2) # production time for product 3\n\n# Define objective function\nR1 = 50 * 10 * P1\nR2 = 70 * 15 * P2\nR3 = 60 * 12 * P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == R1 + R2 + R3)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 24)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production time for product 1: \", model.getVal(P1))\n    print(\"Production time for product 2: \", model.getVal(P2))\n    print(\"Production time for product 3: \", model.getVal(P3))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 687,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line.\n// {\"number of workers on component A production line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B production line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line can produce 10 units per hour, with a defect rate of 2%. Each worker on the component B line can produce 15 units per hour, with a defect rate of 3%. Each worker on the component C line can produce 20 units per hour, with a defect rate of 4%. The manufacturer wants to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\n// Total production output: Output = 10 * A + 15 * B + 20 * C\n// Total defect rate: Defect = 2% * 10 * A + 3% * 15 * B + 4% * 20 * C\n// So, the objective function is: Maximize Output / Defect\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 skilled workers available.\n// A + B + C <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 20 workers.\n// A <= 20; B <= 20; C <= 20",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component depends on the number of skilled workers assigned to each production line. The production and defect rates for each component are given in the following Table.\n\n| Component | Production Rate per Worker | Defect Rate |\n|-----------|-----------------------------|-------------|\n| A         | 10 units per hour          | 2%          |\n| B         | 15 units per hour          | 3%          |\n| C         | 20 units per hour          | 4%          |\n\nThe manufacturer has a total of 50 skilled workers available. Each production line can handle a maximum of 20 workers. The manufacturer wants to maximize the production efficiency, which is defined as the total production output divided by the total defect rate.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=20) # number of workers on component A production line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=20) # number of workers on component B production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=20) # number of workers on component C production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nOutput = 10 * A + 15 * B + 20 * C\nDefect = 0.02 * 10 * A + 0.03 * 15 * B + 0.04 * 20 * C\n## the objective function is: Maximize Output / Defect\n## convert the division to multiplication\nmodel.addCons(obj * Defect == Output)\n\n# Add constraints\n## The manufacturer has a total of 50 skilled workers available.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on component A production line: \", model.getVal(A))\n    print(\"Number of workers on component B production line: \", model.getVal(B))\n    print(\"Number of workers on component C production line: \", model.getVal(C))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 949,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit.\n// Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n// Profit from product B: Profit_B = 70 * B - 5 * B\n// Profit from product C: Profit_C = 100 * C - 1000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe production of product A cannot exceed 300 units due to limited raw material availability.\n// A <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product B to fulfill a contractual obligation.\n// B >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit. The profit and maintenance costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Maintenance Cost |\n|---------|-----------------|------------------|\n| A       | $50             | Quadratic (0.1 * A^2) |\n| B       | $70             | Linear (5 * B)   |\n| C       | $100            | Fixed ($1000)    |\n\nThe company has a total production capacity of 1000 units across all products. The production of product A cannot exceed 300 units due to limited raw material availability. The company must produce at least 100 units of product B to fulfill a contractual obligation.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=100) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n## Profit from product B: Profit_B = 70 * B - 5 * B\n## Profit from product C: Profit_C = 100 * C - 1000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 50 * A - 0.1 * A**2\nProfit_B = 70 * B - 5 * B\nProfit_C = 100 * C - 1000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## The production of product A cannot exceed 300 units due to limited raw material availability.\nmodel.addCons(A <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 822,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantities of each device to optimize their operations.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A has a production cost of $100 and a selling price of $150. Each device B has a production cost of $120 and a selling price of $180. Each device C has a production cost of $140 and a selling price of $200. The manufacturer aims to maximize the total profit, which is the sum of the profits from selling each device. However, due to market saturation, the profit from selling device A decreases by 1% for every unit of device B produced, and the profit from selling device B decreases by 1% for every unit of device C produced.\n// Profit from A: Profit_A = (150 - 100) * A * (1 - 0.01 * B)\n// Profit from B: Profit_B = (180 - 120) * B * (1 - 0.01 * C)\n// Profit from C: Profit_C = (200 - 140) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 100 * A + 120 * B + 140 * C <= 10000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantities of each device to optimize their operations. The production cost and selling price for each device are given in the following Table.\n\n| Device | Production Cost | Selling Price |\n|--------|-----------------|---------------|\n| A      | $100            | $150          |\n| B      | $120            | $180          |\n| C      | $140            | $200          |\n\nEach device A has a production cost of $100 and a selling price of $150. Each device B has a production cost of $120 and a selling price of $180. Each device C has a production cost of $140 and a selling price of $200. The manufacturer aims to maximize the total profit, which is the sum of the profits from selling each device. However, due to market saturation, the profit from selling device A decreases by 1% for every unit of device B produced, and the profit from selling device B decreases by 1% for every unit of device C produced.\n\nThe manufacturer has a budget of $10,000 for production costs. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from A: Profit_A = (150 - 100) * A * (1 - 0.01 * B)\n## Profit from B: Profit_B = (180 - 120) * B * (1 - 0.01 * C)\n## Profit from C: Profit_C = (200 - 140) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (150 - 100) * A * (1 - 0.01 * B) + (180 - 120) * B * (1 - 0.01 * C) + (200 - 140) * C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(100 * A + 120 * B + 140 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer aims to maximize the profit per hour of production time.\n// Profit_A = (30 - 10) * A\n// Profit_B = (40 - 15) * B\n// Profit_C = (50 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a total production time limit of 150 hours.\n// A + 2 * B + 3 * C <= 150\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 3000\n\n## Generate Constraint-3:\nThe market demand for Product A is at least 50 units.\n// A >= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. They need to decide the number of units to produce for each product to optimize their operations.\nFor Product A, the revenue per unit is $30, the production cost per unit is $10, and the production time per unit is 1 hour. \nFor Product B, the revenue per unit is $40, the production cost per unit is $15, and the production time per unit is 2 hours. \nFor Product C, the revenue per unit is $50, the production cost per unit is $20, and the production time per unit is 3 hours.\nThe manufacturer has a total production time limit of 150 hours and a budget of $3000 for production costs. The market demand for Product A is at least 50 units.\nPlease help the manufacturer to maximize the profit per hour of production time.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for Product A is at least 50 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 10) * A\nProfit_B = (40 - 15) * B\nProfit_C = (50 - 20) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a total production time limit of 150 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 150)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 781,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop.\n// {\"hectares of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"hectares of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"hectares of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare.\nFor Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare.\nFor Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n// Total profit: Profit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\n// Total water usage: Water = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 30 hectares are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30\n\n## Generate Constraint-3:\nThe total water usage should not exceed 100,000 liters.\n// 1000 * Wheat + 1200 * Corn + 800 * Soybeans <= 100000\n\n## Generate Constraint-4:\nThe farmer wants to earn at least $50,000 from selling the crops.\n// 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans >= 50000",
        "question": "A farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop. For Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare. For Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare. For Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare. The farmer has 100 hectares of land available and wants to ensure at least 30 hectares are dedicated to each crop. The total water usage should not exceed 100,000 liters, and the farmer wants to earn at least $50,000 from selling the crops. Please help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 hectares are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # hectares of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # hectares of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # hectares of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\nWater = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The total water usage should not exceed 100,000 liters.\nmodel.addCons(1000 * Wheat + 1200 * Corn + 800 * Soybeans <= 100000)\n## The farmer wants to earn at least $50,000 from selling the crops.\nmodel.addCons(5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Wheat: \", model.getVal(Wheat))\n    print(\"Hectares of Corn: \", model.getVal(Corn))\n    print(\"Hectares of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and meet demand.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA produces 100 units per hour with a defect rate of 5%, ComponentB produces 120 units per hour with a defect rate of 3%, and ComponentC produces 150 units per hour with a defect rate of 2%. The company needs to produce at least 5000 units of ComponentA, 6000 units of ComponentB, and 7500 units of ComponentC daily. The objective is to minimize the total production time while considering the defect rates.\n// Production time for ComponentA: T_A = 5000 / (100 * (1 - 0.05) * MachinesA)\n// Production time for ComponentB: T_B = 6000 / (120 * (1 - 0.03) * MachinesB)\n// Production time for ComponentC: T_C = 7500 / (150 * (1 - 0.02) * MachinesC)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, no more than 10 machines can be allocated to any single component production line.\n// MachinesA <= 10; MachinesB <= 10; MachinesC <= 10\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 20% of the total machines are allocated to ComponentA to maintain a balance in production capabilities.\n// MachinesA >= 0.2 * (MachinesA + MachinesB + MachinesC)",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and meet demand. The production capabilities and defect rates for each component are given in the following Table.\n\n| Component | Units Produced per Hour | Defect Rate | Daily Demand |\n|-----------|-------------------------|-------------|--------------|\n| ComponentA | 100 | 5% | 5000 |\n| ComponentB | 120 | 3% | 6000 |\n| ComponentC | 150 | 2% | 7500 |\n\nThe company has a total of 25 machines available for allocation. Due to space limitations, no more than 10 machines can be allocated to any single component production line. The company also has a policy to ensure that at least 20% of the total machines are allocated to ComponentA to maintain a balance in production capabilities. \n\nPlease help the company to minimize the total production time while considering the defect rates and meeting the daily demand for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Production time for ComponentA: T_A = 5000 / (100 * (1 - 0.05) * MachinesA)\n## Production time for ComponentB: T_B = 6000 / (120 * (1 - 0.03) * MachinesB)\n## Production time for ComponentC: T_C = 7500 / (150 * (1 - 0.02) * MachinesC)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\nT_A = 5000 / (100 * (1 - 0.05) * MachinesA)\nT_B = 6000 / (120 * (1 - 0.03) * MachinesB)\nT_C = 7500 / (150 * (1 - 0.02) * MachinesC)\n\n## convert the division to multiplication\nmodel.addCons(T_A * (100 * (1 - 0.05) * MachinesA) == 5000)\nmodel.addCons(T_B * (120 * (1 - 0.03) * MachinesB) == 6000)\nmodel.addCons(T_C * (150 * (1 - 0.02) * MachinesC) == 7500)\n\n## Minimize max(T_A, T_B, T_C)\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n## Due to space limitations, no more than 10 machines can be allocated to any single component production line.\nmodel.addCons(MachinesA <= 10)\nmodel.addCons(MachinesB <= 10)\nmodel.addCons(MachinesC <= 10)\n## The company has a policy to ensure that at least 20% of the total machines are allocated to ComponentA.\nmodel.addCons(MachinesA >= 0.2 * (MachinesA + MachinesB + MachinesC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1067,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $10,000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-3:\nThe farm has a total land capacity of 100 hectares.\n// A + B + C <= 100\n\n## Generate Constraint-4:\nThe market demand for Crop A is 10 hectares. So, the farm can only sell a maximum of 10 hectares of Crop A.\n// A <= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|------|---------------------|-------------------------|-----------------------------|\n| A    | $1000               | 5000 liters             | $200                        |\n| B    | $1500               | 7000 liters             | $300                        |\n| C    | $2000               | 10000 liters            | $400                        |\n\nThe farm has a limited water supply of 500,000 liters. The farm has a budget of $10,000 for fertilizer costs. The farm has a total land capacity of 100 hectares. The market demand for Crop A is 10 hectares. So, the farm can only sell a maximum of 10 hectares of Crop A.\nPlease help the farm to maximize the profit efficiency (profit per liter of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=10) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $10,000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farm has a total land capacity of 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\n// {\"hectares of crop A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\n// Profit from A: Profit_A = 500 * HA\n// Profit from B: Profit_B = 700 * HB\n// Profit from C: Profit_C = 1000 * HC\n// Water usage: Water_A = 2 * HA, Water_B = 3 * HB, Water_C = 4 * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// HA + HB + HC <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 300 units of water available for irrigation.\n// 2 * HA + 3 * HB + 4 * HC <= 300",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many hectares to allocate to each crop to optimize its profit.\nFor Crop A, the profit per hectare is $500, but it requires 2 units of water per hectare. \nFor Crop B, the profit per hectare is $700, but it requires 3 units of water per hectare. \nFor Crop C, the profit per hectare is $1000, but it requires 4 units of water per hectare.\nThe farm aims to maximize the total profit while considering the water usage efficiency (defined as the total profit divided by the total water usage).\nThe farm has a total of 100 hectares available for cultivation.\nThe farm has a total of 300 units of water available for irrigation.\nPlease help the farm to maximize the total profit while considering the water usage efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=0) # hectares of crop A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=0) # hectares of crop B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * HA\nProfit_B = 700 * HB\nProfit_C = 1000 * HC\nWater_A = 2 * HA\nWater_B = 3 * HB\nWater_C = 4 * HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(HA + HB + HC <= 100)\n## The farm has a total of 300 units of water available for irrigation.\nmodel.addCons(2 * HA + 3 * HB + 4 * HC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(HA))\n    print(\"Hectares of Crop B: \", model.getVal(HB))\n    print(\"Hectares of Crop C: \", model.getVal(HC))\n    print(\"Maximized Profit per Water Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints.\n// {\"quantity of Solar Panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"quantity of Wind Turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"quantity of Electric Vehicles\": \"ElectricVehicles\", \"range\": \"ElectricVehicles >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these products.\n// Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\n// Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\n// Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\n// So, the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n// 5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000",
        "question": "A manufacturing company produces three types of eco-friendly products: Solar Panels, Wind Turbines, and Electric Vehicles. They need to determine the production quantities of each product to maximize their profit while considering various constraints. The profit per unit of each product decreases as more units are produced beyond certain thresholds. The profit per unit of Solar Panels is $1000, but it decreases by $0.1 for each additional Solar Panel produced beyond the first 100 units. The profit per unit of Wind Turbines is $1500, but it decreases by $0.2 for each additional Wind Turbine produced beyond the first 50 units. The profit per unit of Electric Vehicles is $2000, but it decreases by $0.3 for each additional Electric Vehicle produced beyond the first 20 units.\n\n| Product            | Profit per Unit (Base) | Decrease per Additional Unit | Threshold |\n|--------------------|------------------------|------------------------------|-----------|\n| Solar Panels       | $1000                  | $0.1                        | 100       |\n| Wind Turbines      | $1500                  | $0.2                        | 50        |\n| Electric Vehicles  | $2000                  | $0.3                        | 20        |\n\nThe company has a limited supply of a critical component used in all three products, totaling 5000 units. Each Solar Panel requires 5 units, each Wind Turbine requires 10 units, and each Electric Vehicle requires 15 units of this component.\n\nPlease help the company to maximize the total profit from the sales of these products while adhering to the constraint on the critical component supply.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0)\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0)\nElectricVehicles = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles\", lb=0)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit_SolarPanels = (1000 - 0.1 * max(SolarPanels - 100, 0)) * SolarPanels\nSolarPanels1 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels1\", lb=0, ub=100)\nSolarPanels2 = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels2\", lb=100, ub=5000)\nSolarPanels_b1 = model.addVar(vtype=\"B\", name=\"SolarPanels_b1\")\nSolarPanels_b2 = model.addVar(vtype=\"B\", name=\"SolarPanels_b2\")\nmodel.addCons(SolarPanels_b1 + SolarPanels_b2 == 1)\nmodel.addCons(SolarPanels == SolarPanels1*SolarPanels_b1 + SolarPanels2*SolarPanels_b2)\nProfit_SolarPanels = (1000 - 0.1 * (SolarPanels2 - 100)) * SolarPanels2 * SolarPanels_b2 + 1000 * SolarPanels1 * SolarPanels_b1\n\n## Profit_WindTurbines = (1500 - 0.2 * max(WindTurbines - 50, 0)) * WindTurbines\nWindTurbines1 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines1\", lb=0, ub=50)\nWindTurbines2 = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines2\", lb=50, ub=5000)\nWindTurbines_b1 = model.addVar(vtype=\"B\", name=\"WindTurbines_b1\")\nWindTurbines_b2 = model.addVar(vtype=\"B\", name=\"WindTurbines_b2\")\nmodel.addCons(WindTurbines_b1 + WindTurbines_b2 == 1)\nmodel.addCons(WindTurbines == WindTurbines1*WindTurbines_b1 + WindTurbines2*WindTurbines_b2)\nProfit_WindTurbines = (1500 - 0.2 * (WindTurbines2 - 50)) * WindTurbines2 * WindTurbines_b2 + 1500 * WindTurbines1 * WindTurbines_b1\n\n## Profit_ElectricVehicles = (2000 - 0.3 * max(ElectricVehicles - 20, 0)) * ElectricVehicles\nElectricVehicles1 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles1\", lb=0, ub=20)\nElectricVehicles2 = model.addVar(vtype=\"INTEGER\", name=\"ElectricVehicles2\", lb=20, ub=5000)\nElectricVehicles_b1 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b1\")\nElectricVehicles_b2 = model.addVar(vtype=\"B\", name=\"ElectricVehicles_b2\")\nmodel.addCons(ElectricVehicles_b1 + ElectricVehicles_b2 == 1)\nmodel.addCons(ElectricVehicles == ElectricVehicles1*ElectricVehicles_b1 + ElectricVehicles2*ElectricVehicles_b2)\nProfit_ElectricVehicles = (2000 - 0.3 * (ElectricVehicles2 - 20)) * ElectricVehicles2 * ElectricVehicles_b2 + 2000 * ElectricVehicles1 * ElectricVehicles_b1\n\n## the objective function is: Maximize Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles\nmodel.addCons(obj == Profit_SolarPanels + Profit_WindTurbines + Profit_ElectricVehicles)\n\n# Add constraints\nmodel.addCons(5 * SolarPanels + 10 * WindTurbines + 15 * ElectricVehicles <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Quantity of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Quantity of Electric Vehicles: \", model.getVal(ElectricVehicles))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1630,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (80 - 40) * A\n// Profit of B: Profit_B = (120 - 60) * B\n// Profit of C: Profit_C = (160 - 80) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for material costs for the next quarter.\n// 40 * A + 60 * B + 80 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe manufacturer has a maximum of 500 hours available for production in the next quarter.\n// A + 2 * B + 3 * C <= 500",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to decide how many units of each device to produce in the next quarter to optimize their profit margin.\nFor Device A, the selling price is $80, the material cost is $40, and the production time is 1 hour.\nFor Device B, the selling price is $120, the material cost is $60, and the production time is 2 hours.\nFor Device C, the selling price is $160, the material cost is $80, and the production time is 3 hours.\nThe manufacturer has a budget of $10,000 for material costs for the next quarter. The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter. The manufacturer has a maximum of 500 hours available for production in the next quarter.\nPlease help the manufacturer to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to ensure that at least 50 units of each device are produced in the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (80 - 40) * A\nProfit_B = (120 - 60) * B\nProfit_C = (160 - 80) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for material costs for the next quarter.\nmodel.addCons(40 * A + 60 * B + 80 * C <= 10000)\n## The manufacturer has a maximum of 500 hours available for production in the next quarter.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. However, due to soil degradation, the profit per hectare decreases by 0.1% for each additional hectare of the same crop grown. The farm aims to maximize the total profit from all crops.\n// Profit_A = (1000 - 0.001 * A^2) * A\n// Profit_B = (1500 - 0.001 * B^2) * B\n// Profit_C = (2000 - 0.001 * C^2) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop to optimize their profit and resource usage. The profit per hectare for crop A is $1000, for crop B is $1500, and for crop C is $2000. However, due to soil degradation, the profit per hectare decreases by 0.1% for each additional hectare of the same crop grown. The farm aims to maximize the total profit from all crops. The farm has a total of 100 hectares available for cultivation.\n\n| Crop | Profit per Hectare |\n|------|---------------------|\n| A    | $1000 - 0.001 * A^2 |\n| B    | $1500 - 0.001 * B^2 |\n| C    | $2000 - 0.001 * C^2 |\n\nPlease help the farm to maximize the total profit from all crops, given that the total hectares allocated to all crops should not exceed 100 hectares.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = (1000 - 0.001 * A^2) * A\n## Profit_B = (1500 - 0.001 * B^2) * B\n## Profit_C = (2000 - 0.001 * C^2) * C\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == (1000 - 0.001 * A**2) * A + (1500 - 0.001 * B**2) * B + (2000 - 0.001 * C**2) * C)\n\n# Add constraints\n## The farm has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 807,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations.\n// {\"number of trucks for WarehouseA\": \"TrucksA\", \"range\": \"TrucksA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseB\": \"TrucksB\", \"range\": \"TrucksB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for WarehouseC\": \"TrucksC\", \"range\": \"TrucksC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC.\n// Total operational cost for WarehouseA: Cost_A = TrucksA * (50)^2\n// Total operational cost for WarehouseB: Cost_B = TrucksB * (70)^2\n// Total operational cost for WarehouseC: Cost_C = TrucksC * (60)^2\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TrucksA + TrucksB + TrucksC <= 50\n\n## Generate Constraint-2:\nDue to contractual agreements, WarehouseA must have at least 20% of the total trucks.\n// TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC)",
        "question": "A logistics company is managing three warehouses: WarehouseA, WarehouseB, and WarehouseC. They need to optimize the number of trucks to allocate to each warehouse for efficient delivery operations. The company aims to minimize the total operational cost, which is a function of the number of trucks and the distance each truck travels. The operational cost per truck is given by a nonlinear function: Cost = (Number of Trucks) * (Distance)^2. The distances from each warehouse to the main distribution center are 50 km for WarehouseA, 70 km for WarehouseB, and 60 km for WarehouseC. The company has a total of 50 trucks available for allocation. Due to contractual agreements, WarehouseA must have at least 20% of the total trucks. Please help the company to minimize the total operational cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucksA = model.addVar(vtype=\"INTEGER\", name=\"TrucksA\", lb=0) # number of trucks for WarehouseA\nTrucksB = model.addVar(vtype=\"INTEGER\", name=\"TrucksB\", lb=0) # number of trucks for WarehouseB\nTrucksC = model.addVar(vtype=\"INTEGER\", name=\"TrucksC\", lb=0) # number of trucks for WarehouseC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = TrucksA * (50**2)\nCost_B = TrucksB * (70**2)\nCost_C = TrucksC * (60**2)\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TrucksA + TrucksB + TrucksC <= 50)\n## Due to contractual agreements, WarehouseA must have at least 20% of the total trucks.\nmodel.addCons(TrucksA >= 0.2 * (TrucksA + TrucksB + TrucksC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for WarehouseA: \", model.getVal(TrucksA))\n    print(\"Number of Trucks for WarehouseB: \", model.getVal(TrucksB))\n    print(\"Number of Trucks for WarehouseC: \", model.getVal(TrucksC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company has a budget of $100,000 for investment in the new technology. The total production capacity for all products is limited to 10,000 units. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nmodel.addCons(obj == (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n## The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for Capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Diodes\": \"Dio\", \"range\": \"Dio >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180.\n// Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n// Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $5000 per hour for operating the machines.\n// 100 * Cap + 120 * Res + 110 * Dio <= 5000\n\n## Generate Constraint-2:\nThe total number of machines available is 40.\n// Cap + Res + Dio <= 40",
        "question": "A manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type. The production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The manufacturer has a budget of $5000 per hour for operating the machines and a total of 40 machines available.\nPlease help the manufacturer determine the optimal number of machines to dedicate to each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for Capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for Resistors\nDio = model.addVar(vtype=\"INTEGER\", name=\"Dio\", lb=0) # number of machines for Diodes\n\n# Define objective function\n## Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n## Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n## So, the objective function is: Maximize (Value - Cost)\nValue = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\nCost = 100 * Cap + 120 * Res + 110 * Dio\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $5000 per hour for operating the machines.\nmodel.addCons(100 * Cap + 120 * Res + 110 * Dio <= 5000)\n## The total number of machines available is 40.\nmodel.addCons(Cap + Res + Dio <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Diode Machines: \", model.getVal(Dio))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company wants to maximize the total profit, which is the sum of the profits from each product.\n// Total profit: Profit = 50A + 70B + 100C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 100 hours of labor available per week.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe company has a total of 70 hours of machine time available per week.\n// A + 2B + 3C <= 70\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product B.\n// B >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit for product A is $50, which requires 2 hours of labor and 1 hour of machine time. The profit per unit for product B is $70, which requires 3 hours of labor and 2 hours of machine time. The profit per unit for product C is $100, which requires 4 hours of labor and 3 hours of machine time. The company has a total of 100 hours of labor and 70 hours of machine time available per week. The company must produce at least 10 units of product A and at least 5 units of product B. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 100C\nmodel.addCons(obj == 50*A + 70*B + 100*C)\n\n# Add constraints\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The company has a total of 70 hours of machine time available per week.\nmodel.addCons(A + 2*B + 3*C <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the number of hours each machine should operate daily to optimize production.\n// {\"number of hours for machine 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine 1 produces 10 units per hour at a cost of $5 per hour, Machine 2 produces 15 units per hour at a cost of $7 per hour, and Machine 3 produces 20 units per hour at a cost of $10 per hour. The goal is to maximize the total production units while minimizing the total cost.\n// The total production units: P = 10 * H1 + 15 * H2 + 20 * H3\n// The total cost: C = 5 * H1 + 7 * H2 + 10 * H3\n// So, the objective function is: Maximize (P - C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 80 hours per day.\n// H1 + H2 + H3 <= 80",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the number of hours each machine should operate daily to optimize production. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Units Produced per Hour | Cost per Hour |\n|---------|-------------------------|---------------|\n| 1       | 10                      | $5            |\n| 2       | 15                      | $7            |\n| 3       | 20                      | $10           |\n\nThe goal is to maximize the total production units while minimizing the total cost. The total operating hours for all machines cannot exceed 80 hours per day. Please help the manager to determine the optimal number of hours each machine should operate daily to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # number of hours for machine 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # number of hours for machine 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # number of hours for machine 3\n\n# Define objective function\n## The total production units: P = 10 * H1 + 15 * H2 + 20 * H3\n## The total cost: C = 5 * H1 + 7 * H2 + 10 * H3\n## So, the objective function is: Maximize (P - C)\nP = 10 * H1 + 15 * H2 + 20 * H3\nC = 5 * H1 + 7 * H2 + 10 * H3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P - C)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 80 hours per day.\nmodel.addCons(H1 + H2 + H3 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours for Machine 1: \", model.getVal(H1))\n    print(\"Number of hours for Machine 2: \", model.getVal(H2))\n    print(\"Number of hours for Machine 3: \", model.getVal(H3))\n    print(\"Maximized Production Units - Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 831,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit.\n// {\"amount of raw material for chemical A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit function for each chemical is nonlinear and given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe production of chemical A must be at least 10% of the total production of all chemicals.\n// RA >= 0.1 * (RA + RB + RC)",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit. The profit from each chemical depends on the amount of raw material used, with the profit functions being:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals. The total amount of raw material available is 1000 units. Additionally, the production of chemical A must be at least 10% of the total production of all chemicals.\nPlease help the plant manager determine the optimal allocation of raw materials to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # amount of raw material for chemical A\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # amount of raw material for chemical B\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # amount of raw material for chemical C\n\n# Define objective function\n## The profit function for each chemical is nonlinear and given by:\n## - Chemical A: PA = 50 * RA^0.7\n## - Chemical B: PB = 60 * RB^0.8\n## - Chemical C: PC = 70 * RC^0.6\n## The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\nPA = 50 * RA**0.7\nPB = 60 * RB**0.8\nPC = 70 * RC**0.6\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n\n## The production of chemical A must be at least 10% of the total production of all chemicals.\nmodel.addCons(RA >= 0.1 * (RA + RB + RC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical A: \", model.getVal(RA))\n    print(\"Amount of Raw Material for Chemical B: \", model.getVal(RB))\n    print(\"Amount of Raw Material for Chemical C: \", model.getVal(RC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 752,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand.\n// {\"quantity of Smartphones\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\n// Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\n// Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\n// So, the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. Each Smartphone requires 2 units, each Tablet requires 3 units, and each Laptop requires 4 units of this component. The total available units of this component are 1000.\n// 2 * Smartphone + 3 * Tablet + 4 * Laptop <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Smartphones is 500 units, for Tablets is 400 units, and for Laptops is 300 units.\n// Smartphone <= 500; Tablet <= 400; Laptop <= 300\n\n## Generate Constraint-3:\nThe company has a total production capacity of 1000 units across all devices.\n// Smartphone + Tablet + Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand. The profit per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company has a limited supply of a critical component used in all devices, with each Smartphone requiring 2 units, each Tablet requiring 3 units, and each Laptop requiring 4 units of this component, totaling 1000 units. The market has a demand limit for each device, with the demand limit for Smartphones being 500 units, for Tablets being 400 units, and for Laptops being 300 units. The company also has a total production capacity of 1000 units across all devices. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0, ub=500) # quantity of Smartphones\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0, ub=400) # quantity of Tablets\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0, ub=300) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Smartphone = max(100 + 0.5 * (Smartphone - 100), 100) * Smartphone\nSmartphone1 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone1\", lb=0, ub=100)\nSmartphone2 = model.addVar(vtype=\"INTEGER\", name=\"Smartphone2\", lb=100, ub=500)\nSmartphone_b1 = model.addVar(vtype=\"B\", name=\"Smartphone_b1\")\nSmartphone_b2 = model.addVar(vtype=\"B\", name=\"Smartphone_b2\")\nmodel.addCons(Smartphone_b1 + Smartphone_b2 == 1)\nmodel.addCons(Smartphone == Smartphone1*Smartphone_b1 + Smartphone2*Smartphone_b2)\nProfit_Smartphone = 100 * Smartphone1 * Smartphone_b1 + (100 + 0.5 * (Smartphone2 - 100)) * Smartphone2 * Smartphone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(150 + 0.5 * (Tablet - 100), 150) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=400)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 150 * Tablet1 * Tablet_b1 + (150 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(200 + 0.5 * (Laptop - 100), 200) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 200 * Laptop1 * Laptop_b1 + (200 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Smartphone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Smartphone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\nmodel.addCons(2 * Smartphone + 3 * Tablet + 4 * Laptop <= 1000)\nmodel.addCons(Smartphone + Tablet + Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(Smartphone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1027,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n\nThe company has a total production capacity of 1000 units per week. Please help the company determine the optimal number of units of products A, B, and C to produce to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nProfit = 50*A + 70*B + 60*C - 0.01*A_sq - 0.02*B_sq - 0.015*C_sq\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 20 units per worker per hour, tablets are 15 units per worker per hour, and laptops are 10 units per worker per hour. The manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required.\n// Total hours for smartphones: H_S = 1000 / (20 * S)\n// Total hours for tablets: H_T = 800 / (15 * T)\n// Total hours for laptops: H_L = 500 / (10 * L)\n// The objective function is: Minimize max(H_S, H_T, H_L)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// S + T + L <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rates are as follows:\n\n| Device     | Production Rate per Worker per Hour |\n|------------|-------------------------------------|\n| Smartphones| 20 units                            |\n| Tablets    | 15 units                            |\n| Laptops    | 10 units                            |\n\nThe manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required. The manufacturer has a total of 50 workers available. Please help the manufacturer determine the optimal number of workers to assign to each production line to meet the demand while minimizing the maximum labor hours required for any device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nH_S = 1000 / (20 * S)\nH_T = 800 / (15 * T)\nH_L = 500 / (10 * L)\n## convert the division to multiplication\nmodel.addCons(obj >= H_S)\nmodel.addCons(obj >= H_T)\nmodel.addCons(obj >= H_L)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(S + T + L <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimum Labor Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit.\n// Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n// Profit from product B: Profit_B = 70 * B - 5 * B\n// Profit from product C: Profit_C = 100 * C - 1000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe production of product A cannot exceed 300 units due to limited raw material availability.\n// A <= 300\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product B to fulfill a contractual obligation.\n// B >= 100\n\n## Generate Constraint-4:\nThe production of product C is limited to 200 units due to market demand constraints.\n// C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit. The profit and maintenance costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Maintenance Cost |\n|---------|-----------------|------------------|\n| A       | $50             | Quadratic (0.1 * A^2) |\n| B       | $70             | Linear (5 * B)   |\n| C       | $100            | Fixed ($1000)    |\n\nThe company has a total production capacity of 1000 units across all products. The production of product A cannot exceed 300 units due to limited raw material availability. The company must produce at least 100 units of product B to fulfill a contractual obligation. The production of product C is limited to 200 units due to market demand constraints.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n## Profit from product B: Profit_B = 70 * B - 5 * B\n## Profit from product C: Profit_C = 100 * C - 1000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = 50 * A - 0.1 * A**2\nProfit_B = 70 * B - 5 * B\nProfit_C = 100 * C - 1000\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## The production of product A cannot exceed 300 units due to limited raw material availability.\nmodel.addCons(A <= 300)\n## The company must produce at least 100 units of product B to fulfill a contractual obligation.\nmodel.addCons(B >= 100)\n## The production of product C is limited to 200 units due to market demand constraints.\nmodel.addCons(C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The revenue from selling smartphones is $20 per unit, tablets is $30 per unit, and laptops is $40 per unit. The total number of workers available is 50. Please help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers assigned to the smartphone production line: \", model.getVal(Smartphone))\n    print(\"Number of workers assigned to the tablet production line: \", model.getVal(Tablet))\n    print(\"Number of workers assigned to the laptop production line: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit and the cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit |\n|---------|-----------------|---------------|\n| A       | $10, decreasing by $0.02 for each unit beyond 100 | $3 |\n| B       | $15, decreasing by $0.015 for each unit beyond 150 | $5 |\n| C       | $20, decreasing by $0.01 for each unit beyond 200 | $7 |\n\nThe total production cost for all products must not exceed $1000. The company also has a storage capacity limit of 500 units for all products combined. Please help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C.\n// {\"number of Widget A produced\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost.\n// net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n// net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n// net profit per unit of Widget C: ProfitC = 60 - 25 = 35\n// The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n## Generate Constraint-1:\nThe company has a total budget of $15,000 for production costs.\n// 20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000",
        "question": "A manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C. The profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost. The company has a total budget of $15,000 for production costs. Please help the company determine the optimal number of each widget to produce to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0) # number of Widget A produced\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0) # number of Widget B produced\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0) # number of Widget C produced\n\n# Define objective function\n## net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n## net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n## net profit per unit of Widget C: ProfitC = 60 - 25 = 35\nProfitA = 30\nProfitB = 40\nProfitC = 35\n## The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n# Add constraints\n## The company has a total budget of $15,000 for production costs.\nmodel.addCons(20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(WidgetA))\n    print(\"Number of Widget B produced: \", model.getVal(WidgetB))\n    print(\"Number of Widget C produced: \", model.getVal(WidgetC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 542,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40\n\n## Generate Constraint-3:\nThe demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3.\n// 100 * P1 + 120 * P2 + 140 * P3 >= 2000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit. Each hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. Each hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. Each hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C. The total operating hours for all production lines cannot exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week. The demand for component A requires at least 2000 units to be produced, which is equivalent to 20 hours of production on line 1, 16.67 hours on line 2, and 14.29 hours on line 3. Please help the company to maximize the total profit from producing these components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n# The demand for component A requires at least 2000 units to be produced.\nmodel.addCons(100 * P1 + 120 * P2 + 140 * P3 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20\n\n## Generate Constraint-3:\nThe water supply limits the total land that can be used for corn and barley to 60 acres.\n// C + B <= 60",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops. The total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence. The water supply limits the total land that can be used for corn and barley to 60 acres. Please help the farmer to maximize the total profit from all crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with nonlinear decrease\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n## The water supply limits the total land that can be used for corn and barley to 60 acres.\nmodel.addCons(C + B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n// Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n// Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n// Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\n// Q1 + Q2 + Q3 <= 1000\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 800 units.\n// Q1 + Q2 + Q3 <= 800",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The cost function for each chemical is quadratic, with the cost per unit decreasing as the quantity produced increases. Specifically, the cost function for C1 is 50 + 0.1 * Q1^2, for C2 is 75 + 0.15 * Q2^2, and for C3 is 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n\n| Chemical | Profit per Unit | Cost Function          |\n|----------|-----------------|------------------------|\n| C1       | $100            | 50 + 0.1 * Q1^2       |\n| C2       | $150            | 75 + 0.15 * Q2^2      |\n| C3       | $200            | 100 + 0.2 * Q3^2      |\n\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals. The storage capacity of the plant is limited to 800 units. Please help the plant to determine the optimal production quantities of C1, C2, and C3 to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n## Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n## Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n## Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n## Convert quadratic terms to linear terms by introducing new variables and constraints\nQ1_sq = model.addVar(vtype=\"INTEGER\", name=\"Q1_sq\")\nQ2_sq = model.addVar(vtype=\"INTEGER\", name=\"Q2_sq\")\nQ3_sq = model.addVar(vtype=\"INTEGER\", name=\"Q3_sq\")\nmodel.addCons(Q1_sq == Q1 * Q1)\nmodel.addCons(Q2_sq == Q2 * Q2)\nmodel.addCons(Q3_sq == Q3 * Q3)\n\nProfit_C1 = 100 * Q1 - (50 + 0.1 * Q1_sq)\nProfit_C2 = 150 * Q2 - (75 + 0.15 * Q2_sq)\nProfit_C3 = 200 * Q3 - (100 + 0.2 * Q3_sq)\n\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\nmodel.addCons(Q1 + Q2 + Q3 <= 1000)\n## The storage capacity of the plant is limited to 800 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1185,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n// Net revenue of A: Revenue_A = (1000 - 400) * A\n// Net revenue of B: Revenue_B = (1500 - 600) * B\n// Net revenue of C: Revenue_C = (2000 - 800) * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for seed costs for the upcoming season.\n// 400 * A + 600 * B + 800 * C <= 100000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 50 acres to each crop for the upcoming season.\n// A >= 50; B >= 50; C >= 50",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season. The expected revenue per acre, cost of seeds per acre, and required labor hours per acre for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Acre | Cost of Seeds per Acre | Required Labor Hours per Acre |\n|------|---------------------------|------------------------|-------------------------------|\n| A    | $1000                     | $400                   | 5                             |\n| B    | $1500                     | $600                   | 8                             |\n| C    | $2000                     | $800                   | 10                            |\n\nThe farm has a budget of $100,000 for seed costs for the upcoming season. The farm wants to allocate at least 50 acres to each crop for the upcoming season. \nPlease help the farm to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 50 acres to each crop for the upcoming season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = (1000 - 400) * A\nRevenue_B = (1500 - 600) * B\nRevenue_C = (2000 - 800) * C\nLaborHours = 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for seed costs for the upcoming season.\nmodel.addCons(400 * A + 600 * B + 800 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1061,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor.\n// 10 * A + 15 * B + 20 * C <= 5000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe production of product A must be at least 20% of the total production.\n// A >= 0.2 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor. The profit, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit |\n|---------|-----------------|----------------------------|---------------------|\n| A       | $50             | $20                        | $10                 |\n| B       | $70             | $30                        | $15                 |\n| C       | $90             | $40                        | $20                 |\n\nThe company has a budget of $10,000 for raw materials and $5,000 for labor. The total production capacity is limited to 200 units across all products. The production of product A must be at least 20% of the total production. Please help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n## Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n## Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n## So, the objective function is: Maximize (PA + PB + PC)\nPA = 50 * A - (20 * A + 10 * A)\nPB = 70 * B - (30 * B + 15 * B)\nPC = 90 * C - (40 * C + 20 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a budget of $5,000 for labor.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 5000)\n## The total production capacity is limited to 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The production of product A must be at least 20% of the total production.\nmodel.addCons(A >= 0.2 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-3:\nThe total available machine hours are 800 hours.\n// M <= 800\n\n## Generate Constraint-4:\nThe plant must maintain a balance in the usage of resources. The ratio of labor hours to machine hours should not exceed 1.5.\n// L / M <= 1.5\n\n## Generate Constraint-5:\nThe total cost of raw materials, labor, and machine hours should not exceed $10000.\n// R + 10L + 20M <= 10000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000, the total available labor hours are 1000 hours, and the total available machine hours are 800 hours. The plant must maintain a balance in the usage of resources, where the ratio of labor hours to machine hours should not exceed 1.5. Additionally, the total cost of raw materials, labor, and machine hours should not exceed $10000. Please help the plant manager to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0)  # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0)  # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0)  # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\nP = 100 * R - 0.5 * R**2 + 150 * L - 0.4 * L**2 + 200 * M - 0.3 * M**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total available machine hours are 800 hours.\nmodel.addCons(M <= 800)\n## The ratio of labor hours to machine hours should not exceed 1.5.\nmodel.addCons(L <= 1.5 * M)\n## The total cost of raw materials, labor, and machine hours should not exceed $10000.\nmodel.addCons(R + 10 * L + 20 * M <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant has three production lines, each capable of producing any of the components but with varying efficiencies. The manager needs to decide how many workers to allocate to each production line to optimize production.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on production line 1 can produce 5 units of component A, 10 units of component B, and 15 units of component C per hour. Each worker on production line 2 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. Each worker on production line 3 can produce 15 units of component A, 20 units of component B, and 25 units of component C per hour. The plant needs to meet a daily demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The goal is to minimize the total production time required to meet these demands.\n// The production time for component A: T_A = 1000 / (5 * P1 + 10 * P2 + 15 * P3)\n// The production time for component B: T_B = 1500 / (10 * P1 + 15 * P2 + 20 * P3)\n// The production time for component C: T_C = 2000 / (15 * P1 + 20 * P2 + 25 * P3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// P1 + P2 + P3 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 20 workers at a time.\n// P1 <= 20; P2 <= 20; P3 <= 20",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant has three production lines, each capable of producing any of the components but with varying efficiencies. The manager needs to decide how many workers to allocate to each production line to optimize production. Each worker on production line 1 can produce 5 units of component A, 10 units of component B, and 15 units of component C per hour. Each worker on production line 2 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. Each worker on production line 3 can produce 15 units of component A, 20 units of component B, and 25 units of component C per hour. The plant needs to meet a daily demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The goal is to minimize the total production time required to meet these demands. There are a total of 50 workers available, and each production line can be staffed by up to 20 workers at a time. Please help the manager to minimize the maximum of the production times for components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T_A = 1000 / (5 * P1 + 10 * P2 + 15 * P3)\n## The production time for component B: T_B = 1500 / (10 * P1 + 15 * P2 + 20 * P3)\n## The production time for component C: T_C = 2000 / (15 * P1 + 20 * P2 + 25 * P3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication and use max function\nT_A = model.addVar(name=\"T_A\")\nT_B = model.addVar(name=\"T_B\")\nT_C = model.addVar(name=\"T_C\")\nmodel.addCons(T_A * (5 * P1 + 10 * P2 + 15 * P3) == 1000)\nmodel.addCons(T_B * (10 * P1 + 15 * P2 + 20 * P3) == 1500)\nmodel.addCons(T_C * (15 * P1 + 20 * P2 + 25 * P3) == 2000)\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(P1 + P2 + P3 <= 50)\n## Each production line can be staffed by up to 20 workers at a time.\nmodel.addCons(P1 <= 20)\nmodel.addCons(P2 <= 20)\nmodel.addCons(P3 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(P1))\n    print(\"Number of workers on production line 2: \", model.getVal(P2))\n    print(\"Number of workers on production line 3: \", model.getVal(P3))\n    print(\"Minimum production time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1133,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200\n\n## Generate Constraint-2:\nThe total raw material available per day is 250 units.\n// 3A + 2B + C <= 250",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\nThe total labor hours available per day are 200 hours. The total raw material available per day is 250 units.\nPlease help the company determine the optimal number of units to produce for each product to maximize their profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n## The total raw material available per day is 250 units.\nmodel.addCons(3*A + 2*B + C <= 250)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit.\n// {\"amount of raw material for chemical A\": \"RA\", \"range\": \"RA >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical B\": \"RB\", \"range\": \"RB >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical C\": \"RC\", \"range\": \"RC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit function for each chemical is nonlinear and given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\nThe plant manager wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 units.\n// RA + RB + RC <= 1000\n\n## Generate Constraint-2:\nThe production of chemical A must be at least 10% of the total production of all chemicals.\n// RA >= 0.1 * (RA + RB + RC)\n\n## Generate Constraint-3:\nThe production of chemical C must not exceed 50% of the total production of all chemicals.\n// RC <= 0.5 * (RA + RB + RC)",
        "question": "A manufacturing plant produces three types of chemicals: A, B, and C. The plant manager needs to decide the amount of raw material to allocate to each chemical production line to optimize the profit. The profit from each chemical depends on the amount of raw material used, and the profit function for each chemical is given by:\n- Chemical A: PA = 50 * RA^0.7\n- Chemical B: PB = 60 * RB^0.8\n- Chemical C: PC = 70 * RC^0.6\n\nThe plant manager wants to maximize the total profit from all three chemicals. The total amount of raw material available is 1000 units. The production of chemical A must be at least 10% of the total production of all chemicals, and the production of chemical C must not exceed 50% of the total production of all chemicals.\n\nPlease help the plant manager to determine the optimal allocation of raw material to each chemical production line to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nRA = model.addVar(vtype=\"CONTINUOUS\", name=\"RA\", lb=0) # amount of raw material for chemical A\nRB = model.addVar(vtype=\"CONTINUOUS\", name=\"RB\", lb=0) # amount of raw material for chemical B\nRC = model.addVar(vtype=\"CONTINUOUS\", name=\"RC\", lb=0) # amount of raw material for chemical C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit function for each chemical is nonlinear and given by:\nPA = 50 * RA**0.7\nPB = 60 * RB**0.8\nPC = 70 * RC**0.6\n## The objective function is: Maximize P = PA + PB + PC = 50 * RA^0.7 + 60 * RB^0.8 + 70 * RC^0.6\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total amount of raw material available is 1000 units.\nmodel.addCons(RA + RB + RC <= 1000)\n## The production of chemical A must be at least 10% of the total production of all chemicals.\nmodel.addCons(RA >= 0.1 * (RA + RB + RC))\n## The production of chemical C must not exceed 50% of the total production of all chemicals.\nmodel.addCons(RC <= 0.5 * (RA + RB + RC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical A: \", model.getVal(RA))\n    print(\"Amount of Raw Material for Chemical B: \", model.getVal(RB))\n    print(\"Amount of Raw Material for Chemical C: \", model.getVal(RC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from A: Revenue_A = 20 * A\n// Revenue from B: Revenue_B = 30 * B\n// Revenue from C: Revenue_C = 40 * C\n// Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\n// Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\n// So, the objective function is: Maximize (Total_Revenue - Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1000 for production costs.\n// 10 * A^0.5 + 15 * B^0.5 + 20 * C^0.5 <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 20 units of product A, 15 units of product B, and 10 units of product C to meet contractual obligations.\n// A >= 20; B >= 15; C >= 10",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|--------------------------|\n| A       | $20             | 10 * A^0.5               |\n| B       | $30             | 15 * B^0.5               |\n| C       | $40             | 20 * C^0.5               |\n\nThe plant has a limited budget of $1000 for production costs. The plant must produce at least 20 units of product A, 15 units of product B, and 10 units of product C to meet contractual obligations.\n\nPlease help the plant to maximize the total profit, which is the difference between the revenue and the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of product A, 15 units of product B, and 10 units of product C to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## Revenue from A: Revenue_A = 20 * A\n## Revenue from B: Revenue_B = 30 * B\n## Revenue from C: Revenue_C = 40 * C\n## Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\nRevenue_A = 20 * A\nRevenue_B = 30 * B\nRevenue_C = 40 * C\nTotal_Revenue = Revenue_A + Revenue_B + Revenue_C\n\n## Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5\n## Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\nCost_A = 10 * A**0.5\nCost_B = 15 * B**0.5\nCost_C = 20 * C**0.5\nTotal_Cost = Cost_A + Cost_B + Cost_C\n\n## So, the objective function is: Maximize (Total_Revenue - Total_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Revenue - Total_Cost)\n\n# Add constraints\n## The plant has a limited budget of $1000 for production costs.\nmodel.addCons(10 * A**0.5 + 15 * B**0.5 + 20 * C**0.5 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1252,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"fertilizer per acre for wheat\": \"Fertilizer_Wheat\", \"range\": \"Fertilizer_Wheat >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for corn\": \"Fertilizer_Corn\", \"range\": \"Fertilizer_Corn >= 0\", \"type\": \"continuous\"}\n// {\"fertilizer per acre for soybeans\": \"Fertilizer_Soybeans\", \"range\": \"Fertilizer_Soybeans >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of wheat per acre increases by 100 kg for every kg of fertilizer used, up to a maximum of 5000 kg per acre. The yield of corn per acre increases by 150 kg for every kg of fertilizer used, up to a maximum of 6000 kg per acre. The yield of soybeans per acre increases by 80 kg for every kg of fertilizer used, up to a maximum of 4000 kg per acre. The farm aims to maximize the total yield of all crops.\n// Total yield of wheat: Yield_Wheat = (100 * Fertilizer_Wheat) * Wheat\n// Total yield of corn: Yield_Corn = (150 * Fertilizer_Corn) * Corn\n// Total yield of soybeans: Yield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n// So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n## Generate Constraint-1:\nThe total amount of fertilizer available for the season is 10,000 kg.\n// Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000\n\n## Generate Constraint-2:\nThe farm has a total of 100 acres available for planting.\n// Wheat + Corn + Soybeans <= 100",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate for three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of fertilizer to use per acre for each crop to optimize yield. The yield of each crop per acre increases with the amount of fertilizer used, as shown in the following Table.\n\n| Crop        | Yield Increase per kg of Fertilizer | Maximum Yield per Acre |\n|-------------|------------------------------------|-----------------------|\n| Wheat       | 100 kg                             | 5000 kg               |\n| Corn        | 150 kg                             | 6000 kg               |\n| Soybeans    | 80 kg                              | 4000 kg               |\n\nThe farm aims to maximize the total yield of all crops. The total amount of fertilizer available for the season is 10,000 kg. The farm has a total of 100 acres available for planting.\n\nPlease help the farm determine the optimal allocation of acres and the amount of fertilizer per acre to maximize the total yield of all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of soybeans\nFertilizer_Wheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Wheat\", lb=0)  # fertilizer per acre for wheat\nFertilizer_Corn = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Corn\", lb=0)  # fertilizer per acre for corn\nFertilizer_Soybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer_Soybeans\", lb=0)  # fertilizer per acre for soybeans\n\n# Define objective function\nYield_Wheat = (100 * Fertilizer_Wheat) * Wheat\nYield_Corn = (150 * Fertilizer_Corn) * Corn\nYield_Soybeans = (80 * Fertilizer_Soybeans) * Soybeans\n# So, the objective function is: Maximize (Yield_Wheat + Yield_Corn + Yield_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_Wheat + Yield_Corn + Yield_Soybeans)\n\n# Add constraints\n# The total amount of fertilizer available for the season is 10,000 kg.\nmodel.addCons(Wheat * Fertilizer_Wheat + Corn * Fertilizer_Corn + Soybeans * Fertilizer_Soybeans <= 10000)\n# The farm has a total of 100 acres available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Fertilizer per acre for Wheat: \", model.getVal(Fertilizer_Wheat))\n    print(\"Fertilizer per acre for Corn: \", model.getVal(Fertilizer_Corn))\n    print(\"Fertilizer per acre for Soybeans: \", model.getVal(Fertilizer_Soybeans))\n    print(\"Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe company has a maximum of 150 hours available for production.\n// 3 * A + 4 * B + 5 * C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 3 hours         |\n| B       | 30$           | 15$           | 4 hours         |\n| C       | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. The company has a maximum of 150 hours available for production. \nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The company has a maximum of 150 hours available for production.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000\n\n## Generate Constraint-3:\nThe demand for smartphones is at least 300 units per hour.\n// 10 * Smartphone >= 300\n\n## Generate Constraint-4:\nThe demand for tablets is at least 450 units per hour.\n// 15 * Tablet >= 450",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost. The total number of workers available is 50. The manufacturer has a budget constraint that limits the total production cost to $1000 per hour. The demand for smartphones is at least 300 units per hour. The demand for tablets is at least 450 units per hour. Please help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\nmodel.addCons(10 * Smartphone >= 300)\nmodel.addCons(15 * Tablet >= 450)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production Line: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production Line: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production Line: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 956,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit.\nThe profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit.\nThe profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit.\nThe company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// Total variable cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120.\n// 100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a labor constraint, with a maximum of 800 labor hours available per month. Each unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2.5 hours.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of each product to meet contractual obligations.\n// ProductA >= 50\n// ProductB >= 50\n// ProductC >= 50",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations. The profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit. The profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit. The profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit. The company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120. The company also has a labor constraint, with a maximum of 800 labor hours available per month. Each unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2.5 hours. Additionally, the company must produce at least 50 units of each product to meet contractual obligations.\n\nPlease help the company determine the optimal amount of each product to produce to maximize its total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50) # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50) # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50) # amount of Product C produced\n\n# Define objective function\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a limited supply of raw materials, which costs $10,000 per month.\nmodel.addCons(100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000)\n# The company has a labor constraint, with a maximum of 800 labor hours available per month.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1190,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant has three production lines, each capable of producing any of the components but with varying efficiencies. The manager needs to decide how many workers to allocate to each production line to optimize production.\n// {\"number of workers on production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on production line 1 can produce 5 units of component A, 10 units of component B, and 15 units of component C per hour. Each worker on production line 2 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. Each worker on production line 3 can produce 15 units of component A, 20 units of component B, and 25 units of component C per hour. The plant needs to meet a daily demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The goal is to minimize the total production time required to meet these demands.\n// The production time for component A: T_A = 1000 / (5 * P1 + 10 * P2 + 15 * P3)\n// The production time for component B: T_B = 1500 / (10 * P1 + 15 * P2 + 20 * P3)\n// The production time for component C: T_C = 2000 / (15 * P1 + 20 * P2 + 25 * P3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// P1 + P2 + P3 <= 50",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant has three production lines, each capable of producing any of the components but with varying efficiencies. The manager needs to decide how many workers to allocate to each production line to optimize production. Each worker on production line 1 can produce 5 units of component A, 10 units of component B, and 15 units of component C per hour. Each worker on production line 2 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. Each worker on production line 3 can produce 15 units of component A, 20 units of component B, and 25 units of component C per hour. The plant needs to meet a daily demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The goal is to minimize the total production time required to meet these demands. There are a total of 50 workers available. Please help the manager determine the optimal allocation of workers to each production line.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of workers on production line 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of workers on production line 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of workers on production line 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T_A = 1000 / (5 * P1 + 10 * P2 + 15 * P3)\n## The production time for component B: T_B = 1500 / (10 * P1 + 15 * P2 + 20 * P3)\n## The production time for component C: T_C = 2000 / (15 * P1 + 20 * P2 + 25 * P3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication and use max function\nT_A = model.addVar(name=\"T_A\")\nT_B = model.addVar(name=\"T_B\")\nT_C = model.addVar(name=\"T_C\")\nmodel.addCons(T_A >= 1000 / (5 * P1 + 10 * P2 + 15 * P3))\nmodel.addCons(T_B >= 1500 / (10 * P1 + 15 * P2 + 20 * P3))\nmodel.addCons(T_C >= 2000 / (15 * P1 + 20 * P2 + 25 * P3))\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(P1 + P2 + P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line 1: \", model.getVal(P1))\n    print(\"Number of Workers on Production Line 2: \", model.getVal(P2))\n    print(\"Number of Workers on Production Line 3: \", model.getVal(P3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency.\n// Profit_A = 50 * A * (1 - 0.01 * A)\n// Profit_B = 70 * B * (1 - 0.01 * B)\n// Profit_C = 90 * C * (1 - 0.01 * C)\n// The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe production capacity is limited to a total of 300 units across all products.\n// A + B + C <= 300\n\n## Generate Constraint-3:\nAt least 50 units of product A must be produced to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product B as product A.\n// B >= 2 * A\n\n## Generate Constraint-5:\nNo more than 100 units of product C can be produced due to market saturation.\n// C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90, but due to economies of scale, the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * quantity) to account for the decreasing efficiency.\n\n| Product | Profit per Unit | Raw Material Cost |\n|---------|-----------------|-------------------|\n| A       | 50$             | 20$               |\n| B       | 70$             | 30$               |\n| C       | 90$             | 40$               |\n\nThe company has a total budget of $10,000 for raw materials. Each unit of product A requires $20 of raw materials, product B requires $30, and product C requires $40. The production capacity is limited to a total of 300 units across all products. At least 50 units of product A must be produced to meet contractual obligations. The company aims to produce at least twice as many units of product B as product A. No more than 100 units of product C can be produced due to market saturation.\n\nPlease help the company to maximize the total profit (which is calculated as the sum of the profit per unit multiplied by the factor (1 - 0.01 * quantity) for each product).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = 50 * A * (1 - 0.01 * A)\n## Profit_B = 70 * B * (1 - 0.01 * B)\n## Profit_C = 90 * C * (1 - 0.01 * C)\n## The objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n## Convert the nonlinear terms to linear by introducing new variables and constraints\nA_factor = model.addVar(vtype=\"CONTINUOUS\", name=\"A_factor\")\nB_factor = model.addVar(vtype=\"CONTINUOUS\", name=\"B_factor\")\nC_factor = model.addVar(vtype=\"CONTINUOUS\", name=\"C_factor\")\nmodel.addCons(A_factor == 1 - 0.01 * A)\nmodel.addCons(B_factor == 1 - 0.01 * B)\nmodel.addCons(C_factor == 1 - 0.01 * C)\nProfit_A = 50 * A * A_factor\nProfit_B = 70 * B * B_factor\nProfit_C = 90 * C * C_factor\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The production capacity is limited to a total of 300 units across all products.\nmodel.addCons(A + B + C <= 300)\n## At least 50 units of product A must be produced to meet contractual obligations.\nmodel.addCons(A >= 50)\n## The company aims to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1446,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor.\n// 10 * A + 15 * B + 20 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor. The profit, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Labor Cost per Unit |\n|---------|-----------------|----------------------------|---------------------|\n| A       | $50             | $20                        | $10                 |\n| B       | $70             | $30                        | $15                 |\n| C       | $90             | $40                        | $20                 |\n\nThe company has a budget of $10,000 for raw materials and $5,000 for labor. Please help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n## Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n## Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n## So, the objective function is: Maximize (PA + PB + PC)\nPA = 50 * A - (20 * A + 10 * A)\nPB = 70 * B - (30 * B + 15 * B)\nPC = 90 * C - (40 * C + 20 * C)\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a budget of $5,000 for labor.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit.\n// {\"number of units of WidgetA\": \"WidgetAUnits\", \"range\": \"WidgetAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetB\": \"WidgetBUnits\", \"range\": \"WidgetBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetC\": \"WidgetCUnits\", \"range\": \"WidgetCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\n// Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\n// Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit. The profit per unit for each widget decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n\n| Widget | Profit per Unit | Decrease per Unit Beyond Threshold | Threshold |\n|--------|-----------------|-----------------------------------|-----------|\n| WidgetA | $50             | $0.1                              | 100 units  |\n| WidgetB | $70             | $0.05                             | 200 units  |\n| WidgetC | $90             | $0.02                             | 300 units  |\n\nThe company has a total production capacity of 500 units. Please help the company determine the optimal number of units to produce for each widget to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetAUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetAUnits\", lb=0) # number of units of WidgetA\nWidgetBUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetBUnits\", lb=0) # number of units of WidgetB\nWidgetCUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetCUnits\", lb=0) # number of units of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetAUnits == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (50 - 0.1 * WidgetA2) * WidgetA2 * WidgetA_b2 + 50 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=200)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=200, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetBUnits == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (70 - 0.05 * WidgetB2) * WidgetB2 * WidgetB_b2 + 70 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=300)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=300, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetCUnits == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (90 - 0.02 * WidgetC2) * WidgetC2 * WidgetC_b2 + 90 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of WidgetA Units: \", model.getVal(WidgetAUnits))\n    print(\"Number of WidgetB Units: \", model.getVal(WidgetBUnits))\n    print(\"Number of WidgetC Units: \", model.getVal(WidgetCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1259,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type (Product 1, Product 2, and Product 3) and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency, where for every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product. The total available hours for production in a week is 40 hours. Please help the company to minimize the maximum production time among the three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0)  # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0)  # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0)  # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Production time for each product\nT1 = 1000 / (10 + 0.001 * Efficiency) * H1\nT2 = 1000 / (10 + 0.001 * Efficiency) * H2\nT3 = 1000 / (10 + 0.001 * Efficiency) * H3\n\n## Convert the max function to a constraint\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 744,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the number of each type of vehicle to maximize their efficiency while meeting certain operational constraints.\n// {\"number of small vehicles\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of medium vehicles\": \"M\", \"range\": \"M >= 0\", \"type\": \"integer\"}\n// {\"number of large vehicles\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of operating each vehicle type varies and is influenced by the number of vehicles in operation. The operating cost for small vehicles is $100 per vehicle, for medium vehicles is $150 per vehicle, and for large vehicles is $200 per vehicle. However, due to economies of scale, the cost per vehicle decreases by $0.5 for each additional vehicle of the same type after the first 10 vehicles. The company aims to minimize the total operating cost.\n// Cost_S = (100 - 0.5 * max(S - 10, 0)) * S\n// Cost_M = (150 - 0.5 * max(M - 10, 0)) * M\n// Cost_L = (200 - 0.5 * max(L - 10, 0)) * L\n// So, the objective function is: Minimize Cost_S + Cost_M + Cost_L\n\n## Generate Constraint-1:\nThe company has a total fleet budget of $10,000. Each small vehicle costs $500, each medium vehicle costs $1000, and each large vehicle costs $1500.\n// 500 * S + 1000 * M + 1500 * L <= 10000",
        "question": "A logistics company operates three types of vehicles: small, medium, and large. The company needs to determine the number of each type of vehicle to maximize their efficiency while meeting certain operational constraints. The cost of operating each vehicle type varies and is influenced by the number of vehicles in operation. The operating cost for small vehicles is $100 per vehicle, for medium vehicles is $150 per vehicle, and for large vehicles is $200 per vehicle. However, due to economies of scale, the cost per vehicle decreases by $0.5 for each additional vehicle of the same type after the first 10 vehicles. The company aims to minimize the total operating cost. The company has a total fleet budget of $10,000. Each small vehicle costs $500, each medium vehicle costs $1000, and each large vehicle costs $1500. Please help the company to minimize the total operating cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of small vehicles\nM = model.addVar(vtype=\"INTEGER\", name=\"M\", lb=0) # number of medium vehicles\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of large vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = (100 - 0.5 * max(S - 10, 0)) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=10, ub=1000)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = (100 - 0.5 * (S2 - 10)) * S2 * S_b2 + 100 * S1 * S_b1\n## create piecewise variables for piecewise function: Cost_M = (150 - 0.5 * max(M - 10, 0)) * M\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0, ub=10)\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=10, ub=1000)\nM_b1 = model.addVar(vtype=\"B\", name=\"M_b1\")\nM_b2 = model.addVar(vtype=\"B\", name=\"M_b2\")\nmodel.addCons(M_b1 + M_b2 == 1)\nmodel.addCons(M == M1*M_b1 + M2*M_b2)\nCost_M = (150 - 0.5 * (M2 - 10)) * M2 * M_b2 + 150 * M1 * M_b1\n## create piecewise variables for piecewise function: Cost_L = (200 - 0.5 * max(L - 10, 0)) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=10)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=10, ub=1000)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = (200 - 0.5 * (L2 - 10)) * L2 * L_b2 + 200 * L1 * L_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## the objective function is: Minimize Cost_S + Cost_M + Cost_L\nmodel.addCons(obj == Cost_S + Cost_M + Cost_L)\n\n# Add constraints\nmodel.addCons(500 * S + 1000 * M + 1500 * L <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Small Vehicles: \", model.getVal(S))\n    print(\"Number of Medium Vehicles: \", model.getVal(M))\n    print(\"Number of Large Vehicles: \", model.getVal(L))\n    print(\"Total Operating Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of raw materials and labor per unit of ProductA is $20, ProductB is $30, and ProductC is $40. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 20) * QuantityA\n// Total profit for ProductB: ProfitB = (70 - 30) * QuantityB\n// Total profit for ProductC: ProfitC = (90 - 40) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials and labor, which cannot exceed $10,000.\n// 20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor. The profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of raw materials and labor per unit of ProductA is $20, ProductB is $30, and ProductC is $40. The company has a limited budget for raw materials and labor, which cannot exceed $10,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\n\n# Define objective function\nProfitA = (50 - 20) * QuantityA\nProfitB = (70 - 30) * QuantityB\nProfitC = (90 - 40) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 582,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturer aims to maximize the total profit from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour.\n// The profit for component A: P1 = 50 * 10 * M1\n// The profit for component B: P2 = 70 * 15 * M2\n// The profit for component C: P3 = 60 * 12 * M3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total number of machines available is 50.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nThe production facility has a limited power supply that can support up to 25 machines running simultaneously.\n// M1^2 + M2^2 + M3^2 <= 25^2\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day.\n// 10 * M1 >= 500 / (24 * 60)\n// 15 * M2 >= 600 / (24 * 60)\n// 12 * M3 >= 700 / (24 * 60)",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour.\n\n| Component | Profit per Unit | Production Rate per Machine (units/hour) |\n|-----------|-----------------|------------------------------------------|\n| A         | $50             | 10                                       |\n| B         | $70             | 15                                       |\n| C         | $60             | 12                                       |\n\nThe manufacturer has a total of 50 machines available. The production facility has a limited power supply that can support up to 25 machines running simultaneously. The manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day.\n\nPlease help the manufacturer determine the optimal allocation of machines to each component to maximize the total profit per hour.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\nP1 = 50 * 10 * M1\nP2 = 70 * 15 * M2\nP3 = 60 * 12 * M3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total number of machines available is 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n# The production facility has a limited power supply that can support up to 25 machines running simultaneously.\nmodel.addCons(M1**2 + M2**2 + M3**2 <= 25**2)\n# The manufacturer must produce at least 500 units of component A, 600 units of component B, and 700 units of component C per day.\nmodel.addCons(10 * M1 >= 500 / (24 * 60))\nmodel.addCons(15 * M2 >= 600 / (24 * 60))\nmodel.addCons(12 * M3 >= 700 / (24 * 60))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1249,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to the complexity of the production process, the profit per unit decreases nonlinearly with the increase in production quantity. Specifically, the profit per unit decreases by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products.\n// Profit_A = (10 - 0.005 * A) * A\n// Profit_B = (15 - 0.005 * B) * B\n// Profit_C = (20 - 0.005 * C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units.\n// A <= 200; B <= 150; C <= 100\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 300 units in total.\n// A + B + C <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to the complexity of the production process, the profit per unit decreases nonlinearly with the increase in production quantity. Specifically, the profit per unit decreases by 0.005 times the quantity produced for each product. The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg. The market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units. The company also has a production capacity limit of 300 units in total. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 - 0.005 * A) * A\nProfit_B = (15 - 0.005 * B) * B\nProfit_C = (20 - 0.005 * C) * C\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n## The market has a demand limit for each product.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 100)\n## The company has a production capacity limit of 300 units in total.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"amount of raw materials to stock\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for automation upgrades.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 10,000 units.\n// Units <= 10000\n\n## Generate Constraint-3:\nThe amount of raw materials stocked must be sufficient to produce at least 5,000 units.\n// RawMaterials >= 5000 * Units\n\n## Generate Constraint-4:\nThe level of automation must be at least 10% of the total budget allocated for automation.\n// Automation >= 0.1 * 50000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on three key variables: the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock. The company aims to maximize its total profit from the production. The cost of production per unit decreases by $5 for every $1000 invested in automation, with an initial production cost per unit of $100 and a selling price per unit of $150.\n\nThe company has a budget of $50,000 for automation upgrades. The total number of units produced must not exceed 10,000 units. The amount of raw materials stocked must be sufficient to produce at least 5,000 units. Additionally, the level of automation must be at least 10% of the total budget allocated for automation.\n\nPlease help the company determine the optimal values for the number of units to produce, the level of automation, and the amount of raw materials to stock to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0)  # amount of raw materials to stock\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * Automation) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a budget of $50,000 for automation upgrades.\nmodel.addCons(Automation <= 50000)\n# The total number of units produced must not exceed 10,000 units.\nmodel.addCons(Units <= 10000)\n# The amount of raw materials stocked must be sufficient to produce at least 5,000 units.\nmodel.addCons(RawMaterials >= 5000 * Units)\n# The level of automation must be at least 10% of the total budget allocated for automation.\nmodel.addCons(Automation >= 0.1 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Amount of Raw Materials: \", model.getVal(RawMaterials))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1001,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C.\n// {\"number of Widget A produced\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost.\n// net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n// net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n// net profit per unit of Widget C: ProfitC = 60 - 25 = 35\n// The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n## Generate Constraint-1:\nThe company has a total budget of $15,000 for production costs.\n// 20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000\n\n## Generate Constraint-2:\nThe production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\n// WidgetA <= 200\n// WidgetB <= 300\n// WidgetC <= 250\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of any product.\n// WidgetA + WidgetB + WidgetC >= 100",
        "question": "A manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C. The profit per unit and production cost per unit for each widget are given in the following Table.\n\n| Widget | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | $50             | $20                      |\n| B      | $70             | $30                      |\n| C      | $60             | $25                      |\n\nThe company has a total budget of $15,000 for production costs. The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units. The company must produce at least 100 units of any product. \nPlease help the company to maximize the net profit per unit, which is the profit minus the cost, by determining the optimal number of units to produce for each widget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0)  # number of Widget A produced\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0)  # number of Widget B produced\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0)  # number of Widget C produced\n\n# Define objective function\nProfitA = 30  # net profit per unit of Widget A\nProfitB = 40  # net profit per unit of Widget B\nProfitC = 35  # net profit per unit of Widget C\n# The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n# Add constraints\n# The company has a total budget of $15,000 for production costs.\nmodel.addCons(20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000)\n# The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\nmodel.addCons(WidgetA <= 200)\nmodel.addCons(WidgetB <= 300)\nmodel.addCons(WidgetC <= 250)\n# The company must produce at least 100 units of any product.\nmodel.addCons(WidgetA + WidgetB + WidgetC >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A: \", model.getVal(WidgetA))\n    print(\"Number of Widget B: \", model.getVal(WidgetB))\n    print(\"Number of Widget C: \", model.getVal(WidgetC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 903,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe market demand for Crop A is limited to 20 hectares.\n// A <= 20\n\n## Generate Constraint-4:\nThe farmer must allocate at least 10 hectares to Crop B to maintain soil health.\n// B >= 10\n\n## Generate Constraint-5:\nDue to labor constraints, the total area for Crop C cannot exceed 30 hectares.\n// C <= 30",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| A    | $1000               | 2 units                       |\n| B    | $1500               | 3 units                       |\n| C    | $2000               | 4 units                       |\n\nThe farmer has access to a total of 100 units of water. The total available land for cultivation is 50 hectares. The market demand for Crop A is limited to 20 hectares. The farmer must allocate at least 10 hectares to Crop B to maintain soil health. Due to labor constraints, the total area for Crop C cannot exceed 30 hectares.\n\nPlease help the farmer to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n## The market demand for Crop A is limited to 20 hectares.\nmodel.addCons(A <= 20)\n## The farmer must allocate at least 10 hectares to Crop B to maintain soil health.\nmodel.addCons(B >= 10)\n## Due to labor constraints, the total area for Crop C cannot exceed 30 hectares.\nmodel.addCons(C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1035,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products.\n// Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n// So, the objective function is: Maximize \\(P_{total}\\)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// \\(Q_a + Q_b + Q_c \\leq 1000\\)\n\n## Generate Constraint-2:\nThe production of product A must not exceed 400 units due to limited raw materials.\n// \\(Q_a \\leq 400\\)\n\n## Generate Constraint-3:\nThe production of product B must be at least 200 units to meet contractual obligations.\n// \\(Q_b \\geq 200\\)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit from each product is influenced by a nonlinear relationship between production quantity and market demand, as shown in the following Table.\n\n| Product | Profit Formula                |\n|---------|-------------------------------|\n| A       | \\(P_a = 100Q_a - 0.1Q_a^2\\)  |\n| B       | \\(P_b = 150Q_b - 0.2Q_b^2\\)  |\n| C       | \\(P_c = 200Q_c - 0.3Q_c^2\\)  |\n\nThe total production capacity of the company is limited to 1000 units per month. The production of product A must not exceed 400 units due to limited raw materials. The production of product B must be at least 200 units to meet contractual obligations.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## The profit from each product is influenced by a nonlinear relationship between production quantity and market demand.\n## The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\).\n## Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n## So, the objective function is: Maximize \\(P_{total}\\)\nPa = 100 * Qa - 0.1 * Qa**2\nPb = 150 * Qb - 0.2 * Qb**2\nPc = 200 * Qc - 0.3 * Qc**2\nPtotal = Pa + Pb + Pc\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Ptotal)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The production of product A must not exceed 400 units due to limited raw materials.\nmodel.addCons(Qa <= 400)\n## The production of product B must be at least 200 units to meet contractual obligations.\nmodel.addCons(Qb >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor.\n// {\"amount of land for C1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. \nEach unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. \nEach unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor.\nThe farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n// Profit_C1 = 100 * L1\n// Profit_C2 = 150 * L2\n// Profit_C3 = 200 * L3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of land available.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 200 units of water available.\n// 2 * L1 + 3 * L2 + 4 * L3 <= 200",
        "question": "A farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor. The profit, water requirement, and labor requirement for each crop per unit of land are given in the following Table.\n\n| Crop | Profit per Unit of Land | Water Requirement per Unit of Land | Labor Requirement per Unit of Land |\n|------|-------------------------|------------------------------------|------------------------------------|\n| C1   | $100                    | 2 units                            | 1 unit                             |\n| C2   | $150                    | 3 units                            | 2 units                            |\n| C3   | $200                    | 4 units                            | 3 units                            |\n\nThe farm has a total of 100 units of land available. The farm also has a total of 200 units of water available. The farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n\nPlease help the farm determine the optimal allocation of land for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # amount of land for C1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # amount of land for C2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # amount of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * L1\nProfit_C2 = 150 * L2\nProfit_C3 = 200 * L3\nResource_Use = 2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / Resource_Use\n## convert the division to multiplication\nmodel.addCons(obj * Resource_Use == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 units of land available.\nmodel.addCons(L1 + L2 + L3 <= 100)\n## The farm has a total of 200 units of water available.\nmodel.addCons(2 * L1 + 3 * L2 + 4 * L3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for C1: \", model.getVal(L1))\n    print(\"Amount of Land for C2: \", model.getVal(L2))\n    print(\"Amount of Land for C3: \", model.getVal(L3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The company aims to maximize this profit.\n// Formal definition of the objective function: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800\n\n## Generate Constraint-3:\nThe total raw materials available are 1200 units.\n// R <= 1200\n\n## Generate Constraint-4:\nThe company must maintain a balance in the usage of resources. The ratio of labor hours to machine hours should not exceed 1.5.\n// L / M <= 1.5",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The total labor hours available are 1000 hours, the total machine hours available are 800 hours, and the total raw materials available are 1200 units. The company must maintain a balance in the usage of resources, where the ratio of labor hours to machine hours should not exceed 1.5.\nPlease help the company to maximize its profit based on these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\nmodel.addCons(obj == 100*L - 0.5*L*L + 150*M - 0.3*M*M + 200*R - 0.4*R*R)\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n## The total raw materials available are 1200 units.\nmodel.addCons(R <= 1200)\n## The company must maintain a balance in the usage of resources. The ratio of labor hours to machine hours should not exceed 1.5.\nmodel.addCons(L <= 1.5 * M)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 662,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre and the environmental cost per acre for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Environmental Cost per Acre |\n|------------|-----------------|-----------------------------|\n| Wheat      | $200            | $50                         |\n| Corn       | $300            | $70                         |\n| Soybeans   | $250            | $60                         |\n\nThe farmer has a total of 100 acres available for planting. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost. Please help the farmer determine the optimal allocation of acres for Wheat, Corn, and Soybeans.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n// The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $50,000.\n// 0.05 * S^2 + 0.07 * T^2 + 0.1 * L^2 <= 50000\n\n## Generate Constraint-2:\nThe production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\n// S <= 500; T <= 300; L <= 200",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of units produced. The production cost for smartphones is 0.05 * S^2, for tablets is 0.07 * T^2, and for laptops is 0.1 * L^2. The company aims to maximize the total profit after deducting the production costs.\n\nThe company has a budget constraint that limits the total production cost to $50,000. The production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize profit, given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (100 * S - 0.05 * S^2) + (150 * T - 0.07 * T^2) + (200 * L - 0.1 * L^2)\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.07 * T**2 + 200 * L - 0.1 * L**2)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $50,000.\nmodel.addCons(0.05 * S**2 + 0.07 * T**2 + 0.1 * L**2 <= 50000)\n## The production capacity for smartphones is limited to 500 units, for tablets to 300 units, and for laptops to 200 units.\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 923,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A must be met, which is at least 200 units.\n// A >= 200\n\n## Generate Constraint-3:\nThe production of component B must not exceed 50% of the total production.\n// B <= 0.5 * (A + B + C)\n\n## Generate Constraint-4:\nThe manufacturer has a budget constraint that limits the total cost of production to $50,000. The cost of producing each unit of A, B, and C is $20, $30, and $25 respectively.\n// 20 * A + 30 * B + 25 * C <= 50000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. The demand for component A must be met, which is at least 200 units. The production of component B must not exceed 50% of the total production. The manufacturer has a budget constraint that limits the total cost of production to $50,000. The cost of producing each unit of A, B, and C is $20, $30, and $25 respectively. Please help the manufacturer determine the optimal production levels for components A, B, and C to maximize net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n## The demand for component A must be met, which is at least 200 units.\nmodel.addCons(A >= 200)\n## The production of component B must not exceed 50% of the total production.\nmodel.addCons(B <= 0.5 * (A + B + C))\n## The manufacturer has a budget constraint that limits the total cost of production to $50,000.\nmodel.addCons(20 * A + 30 * B + 25 * C <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1068,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\n// Operating hours for product A: HA = 800 / (10 * MA)\n// Operating hours for product B: HB = 1200 / (15 * MB)\n// Operating hours for product C: HC = 1600 / (20 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nEach type of product can be produced by up to 20 machines.\n// MA <= 20; MB <= 20; MC <= 20\n\n## Generate Constraint-3:\nAt least 10 machines must be dedicated to product A.\n// MA >= 10",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The production rates for each product are given in the following Table.\n\n| Product | Production Rate per Machine (units/hour) |\n|---------|------------------------------------------|\n| A       | 10                                       |\n| B       | 15                                       |\n| C       | 20                                       |\n\nThe manufacturer has a total of 50 machines available. Each type of product can be produced by up to 20 machines. At least 10 machines must be dedicated to product A. The objective is to minimize the total operating hours required to meet these demands. Please help the manufacturer determine the optimal allocation of machines to each product to achieve this objective.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=10) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 800 / (10 * MA)\nHB = 1200 / (15 * MB)\nHC = 1600 / (20 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 800)\nmodel.addCons(HB * (15 * MB) == 1200)\nmodel.addCons(HC * (20 * MC) == 1600)\n## the objective function is: Minimize max(HA, HB, HC)\n## convert the max function to a constraint\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n## Each type of product can be produced by up to 20 machines.\nmodel.addCons(MA <= 20)\nmodel.addCons(MB <= 20)\nmodel.addCons(MC <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Minimized Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints.\n// {\"quantity of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The manufacturer aims to maximize the total profit from selling these devices.\n// Profit_S = max(100 + 0.5 * (S - 100), 100) * S\n// Profit_T = max(150 + 0.5 * (T - 100), 150) * T\n// Profit_L = max(200 + 0.5 * (L - 100), 200) * L\n// So, the objective function is: Maximize Profit_S + Profit_T + Profit_L\n\n## Generate Constraint-1:\nThe manufacturer has a limited supply of a critical component used in all devices, which totals 5000 units. Each smartphone requires 5 units, each tablet requires 8 units, and each laptop requires 10 units of this component.\n// 5 * S + 8 * T + 10 * L <= 5000\n\n## Generate Constraint-2:\nThere is a market demand limit for each device type. The demand limit for smartphones is 500 units, for tablets is 400 units, and for laptops is 300 units.\n// S <= 500; T <= 400; L <= 300",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. They need to determine the production quantities of each device to maximize profit while considering various constraints. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The manufacturer has a limited supply of a critical component used in all devices, which totals 5000 units. Each smartphone requires 5 units, each tablet requires 8 units, and each laptop requires 10 units of this component. There is also a market demand limit for each device type. The demand limit for smartphones is 500 units, for tablets is 400 units, and for laptops is 300 units. Please help the manufacturer to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # quantity of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # quantity of laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_S = max(100 + 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = 100 * S1 * S_b1 + (100 + 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Profit_T = max(150 + 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=400)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nProfit_T = 150 * T1 * T_b1 + (150 + 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Profit_L = max(200 + 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=300)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nProfit_L = 200 * L1 * L_b1 + (200 + 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_S + Profit_T + Profit_L\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L)\n\n# Add constraints\nmodel.addCons(5 * S + 8 * T + 10 * L <= 5000)\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 400)\nmodel.addCons(L <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints.\n// {\"amount of chemical produced at facility 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from producing the chemical at each facility depends on the amount produced and the cost of production. The profit function is nonlinear and is given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\nThe company wants to maximize the total profit from all facilities.\n// The objective function is: Maximize F = F1 + F2 + F3\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all facilities must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nThe demand for the chemical at facility 1 is at least 200 units.\n// P1 >= 200\n\n## Generate Constraint-3:\nThe demand for the chemical at facility 2 is at least 150 units.\n// P2 >= 150",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints. The profit from producing the chemical at each facility depends on the amount produced and the cost of production, with the profit function being nonlinear and given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\n\nThe company wants to maximize the total profit from all facilities. The constraints are as follows:\n1. The total amount of chemical produced across all facilities must not exceed 1000 units.\n2. The demand for the chemical at facility 1 is at least 200 units.\n3. The demand for the chemical at facility 2 is at least 150 units.\n\nPlease help the company determine the optimal production amounts for each facility to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=200) # amount of chemical produced at facility 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=150) # amount of chemical produced at facility 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced at facility 3\n\n# Define objective function\n## The profit function is nonlinear and is given by:\nF1 = 100 * P1 - 0.5 * P1**2\nF2 = 120 * P2 - 0.6 * P2**2\nF3 = 110 * P3 - 0.4 * P3**2\n## The objective function is: Maximize F = F1 + F2 + F3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == F1 + F2 + F3)\n\n# Add constraints\n## The total amount of chemical produced across all facilities must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced at facility 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced at facility 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced at facility 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process.\n// {\"amount of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy optimization\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\n// Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe investment in energy optimization cannot exceed $50,000.\n// EnergyInvestment <= 50000",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process. The profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products. The total amount of raw material available is limited to 1000 units, with product A using 2 units, product B using 3 units, and product C using 4 units. The investment in energy optimization cannot exceed $50,000. Please help the manufacturer determine the optimal amounts of products A, B, and C to produce and the optimal investment in energy optimization to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # amount of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # amount of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # amount of product C\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0) # investment in energy optimization\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nProfit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units.\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\n## The investment in energy optimization cannot exceed $50,000.\nmodel.addCons(EnergyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Energy Optimization: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three different machines to produce these components. The manager needs to determine the number of hours to operate each machine.\n// {\"number of hours for machine 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"number of hours for machine 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency in producing the components. \nMachine 1 produces 10 units of component A, 20 units of component B, and 30 units of component C per hour. \nMachine 2 produces 15 units of component A, 25 units of component B, and 35 units of component C per hour. \nMachine 3 produces 20 units of component A, 30 units of component B, and 40 units of component C per hour. \nThe company needs to produce at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The three machines can only be operated or shut down at the same time. Please determine the minimum total operating time to meet the monthly demand.\n// The production time for component A: T1 = 1000 / (10 * H1 + 15 * H2 + 20 * H3)\n// The production time for component B: T2 = 1500 / (20 * H1 + 25 * H2 + 30 * H3)\n// The production time for component C: T3 = 2000 / (30 * H1 + 35 * H2 + 40 * H3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for all machines per month is 300 hours.\n// H1 + H2 + H3 <= 300",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three different machines to produce these components. The manager needs to determine the number of hours to operate each machine. The efficiency of each machine in producing the components per hour is given in the following Table.\n\n| Machine | Component A | Component B | Component C |\n|---------|-------------|-------------|-------------|\n| 1       | 10 units    | 20 units    | 30 units    |\n| 2       | 15 units    | 25 units    | 35 units    |\n| 3       | 20 units    | 30 units    | 40 units    |\n\nThe company needs to produce at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The three machines can only be operated or shut down at the same time. The total available hours for all machines per month is 300 hours. Please help the manager determine the minimum total operating time to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # number of hours for machine 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # number of hours for machine 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # number of hours for machine 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * H1 + 15 * H2 + 20 * H3)\n## The production time for component B: T2 = 1500 / (20 * H1 + 25 * H2 + 30 * H3)\n## The production time for component C: T3 = 2000 / (30 * H1 + 35 * H2 + 40 * H3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=0)\nT2 = model.addVar(vtype=\"CONTINUOUS\", name=\"T2\", lb=0)\nT3 = model.addVar(vtype=\"CONTINUOUS\", name=\"T3\", lb=0)\nmodel.addCons(T1 * (10 * H1 + 15 * H2 + 20 * H3) == 1000)\nmodel.addCons(T2 * (20 * H1 + 25 * H2 + 30 * H3) == 1500)\nmodel.addCons(T3 * (30 * H1 + 35 * H2 + 40 * H3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The total available hours for all machines per month is 300 hours.\nmodel.addCons(H1 + H2 + H3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of hours for machine 1: \", model.getVal(H1))\n    print(\"Number of hours for machine 2: \", model.getVal(H2))\n    print(\"Number of hours for machine 3: \", model.getVal(H3))\n    print(\"Minimum total operating time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 958,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 50 units per hour, with a profit of $10 per unit. Each machine for product B produces 30 units per hour, with a profit of $15 per unit. Each machine for product C produces 40 units per hour, with a profit of $12 per unit. The manufacturer wants to maximize the total profit from the production of these three products.\n// Total profit for product A: PA = 50 * 10 * MA\n// Total profit for product B: PB = 30 * 15 * MB\n// Total profit for product C: PC = 40 * 12 * MC\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nThe production of product A must not exceed 2000 units per hour.\n// 50 * MA <= 2000\n\n## Generate Constraint-3:\nThe production of product B must not exceed 1500 units per hour.\n// 30 * MB <= 1500",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are determined by the number of machines dedicated to each product. The productivity and profit per unit for each product are given in the following Table.\n\n| Product | Units Produced per Hour per Machine | Profit per Unit |\n|---------|-------------------------------------|-----------------|\n| A       | 50                                  | $10             |\n| B       | 30                                  | $15             |\n| C       | 40                                  | $12             |\n\nThe manufacturer has a total of 50 machines available. The production of product A must not exceed 2000 units per hour, and the production of product B must not exceed 1500 units per hour. \n\nPlease help the manufacturer to maximize the total profit from the production of these three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for product C\n\n# Define objective function\nPA = 50 * 10 * MA\nPB = 30 * 15 * MB\nPC = 40 * 12 * MC\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n# The production of product A must not exceed 2000 units per hour.\nmodel.addCons(50 * MA <= 2000)\n# The production of product B must not exceed 1500 units per hour.\nmodel.addCons(30 * MB <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 893,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 100 units.\n// 2 * C1 + 3 * C2 + 4 * C3 <= 100\n\n## Generate Constraint-3:\nThe market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1.\n// C1 <= 20\n\n## Generate Constraint-4:\nThe farmer must plant at least 10 acres of C2 to maintain soil fertility.\n// C2 >= 10",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for C1 is $1000, but it requires 2 units of water per acre. For C2, the profit per acre is $1200, and it requires 3 units of water per acre. For C3, the profit per acre is $1500, and it requires 4 units of water per acre. The farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water). The farm has a total of 50 acres available for cultivation. The market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1. The farmer must plant at least 10 acres of C2 to maintain soil fertility. Please help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=20) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=10, ub=50) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0, ub=50) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n## The farm has a limited water supply of 100 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 <= 100)\n## The market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1.\nmodel.addCons(C1 <= 20)\n## The farmer must plant at least 10 acres of C2 to maintain soil fertility.\nmodel.addCons(C2 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"size of the geothermal system in units\": \"Geothermal\", \"range\": \"Geothermal >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 100 kWh per day. The cost of each wind turbine is $2000, and it generates 200 kWh per day. The cost of the geothermal system is $5000 per unit, and it generates 300 kWh per day. The company wants to minimize the total cost of installation while maximizing the total daily energy generation.\n// Total cost: Cost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\n// Total daily energy generation: Energy = 100 * Solar + 200 * Wind + 300 * Geothermal\n// The objective function is: Minimize Cost / Energy\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000\n\n## Generate Constraint-2:\nThe company requires at least 5000 kWh of energy per day.\n// 100 * Solar + 200 * Wind + 300 * Geothermal >= 5000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 30% of the budget is spent on solar panels.\n// 1000 * Solar >= 0.30 * 100000\n\n## Generate Constraint-4:\nThe company wants to limit the number of wind turbines to no more than 20% of the total number of energy units installed.\n// Wind <= 0.20 * (Solar + Wind + Geothermal)",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a geothermal system. The cost and daily energy generation for each type of unit are given in the following Table.\n\n| Unit Type       | Cost per Unit | Daily Energy Generation |\n|-----------------|---------------|-------------------------|\n| Solar Panel     | $1000         | 100 kWh                 |\n| Wind Turbine    | $2000         | 200 kWh                 |\n| Geothermal Unit | $5000         | 300 kWh                 |\n\nThe company has a budget of $100,000 for the installation. The company requires at least 5000 kWh of energy per day. The company wants to ensure that at least 30% of the budget is spent on solar panels. The company also wants to limit the number of wind turbines to no more than 20% of the total number of energy units installed.\n\nPlease help the company to minimize the total cost of installation while maximizing the total daily energy generation, expressed as the ratio of total cost to total daily energy generation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGeothermal = model.addVar(vtype=\"INTEGER\", name=\"Geothermal\", lb=0) # size of the geothermal system\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 1000 * Solar + 2000 * Wind + 5000 * Geothermal\nEnergy = 100 * Solar + 200 * Wind + 300 * Geothermal\n## convert the division to multiplication\nmodel.addCons(obj * Energy == Cost)\n\n# Add constraints\n## The company has a budget of $100,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 5000 * Geothermal <= 100000)\n## The company requires at least 5000 kWh of energy per day.\nmodel.addCons(100 * Solar + 200 * Wind + 300 * Geothermal >= 5000)\n## The company wants to ensure that at least 30% of the budget is spent on solar panels.\nmodel.addCons(1000 * Solar >= 0.30 * 100000)\n## The company wants to limit the number of wind turbines to no more than 20% of the total number of energy units installed.\nmodel.addCons(Wind <= 0.20 * (Solar + Wind + Geothermal))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Size of Geothermal System: \", model.getVal(Geothermal))\n    print(\"Minimized Cost per Energy Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1050,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n// Profit per unit of product A: ProfitA = 50 - 2 * Automation\n// Profit per unit of product B: ProfitB = 70 - 2 * Automation\n// Profit per unit of product C: ProfitC = 60 - 2 * Automation\n// Total profit: TotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nAt least 200 units of product A must be produced.\n// UnitsA >= 200\n\n## Generate Constraint-4:\nThe number of units of product B must not exceed the number of units of product A by more than 100 units.\n// UnitsB <= UnitsA + 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process. The profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50 - 2 * Automation |\n| B       | 70 - 2 * Automation |\n| C       | 60 - 2 * Automation |\n\nThe company has a production capacity limit of 1000 units in total for all products. The investment in automation cannot exceed $50,000. At least 200 units of product A must be produced. The number of units of product B must not exceed the number of units of product A by more than 100 units.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=200)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = 50 - 2 * Automation\nProfitB = 70 - 2 * Automation\nProfitC = 60 - 2 * Automation\nTotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # Production capacity limit\nmodel.addCons(Automation <= 50000)  # Investment in automation limit\nmodel.addCons(UnitsB <= UnitsA + 100)  # Product B units constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 986,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the acreage for each crop to maximize his profit while considering the soil fertility and water requirements.\n// {\"acreage of wheat\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage of corn\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage of soybeans\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $300, but it requires 2 units of water per acre. \nThe profit per acre for corn is $400, but it requires 3 units of water per acre. \nThe profit per acre for soybeans is $250, but it requires 1 unit of water per acre. \nThe farmer wants to maximize his total profit.\n// Profit_wheat = 300 * A1\n// Profit_corn = 400 * A2\n// Profit_soybeans = 250 * A3\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_soybeans)\n\n## Generate Constraint-1:\nThe total available water for irrigation is 500 units.\n// 2 * A1 + 3 * A2 + 1 * A3 <= 500\n\n## Generate Constraint-2:\nThe total land available for cultivation is 100 acres.\n// A1 + A2 + A3 <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the acreage for each crop to maximize his profit while considering the soil fertility and water requirements. The profit per acre for wheat is $300 and requires 2 units of water per acre. The profit per acre for corn is $400 and requires 3 units of water per acre. The profit per acre for soybeans is $250 and requires 1 unit of water per acre. The total available water for irrigation is 500 units, and the total land available for cultivation is 100 acres. Please help the farmer maximize his total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage of wheat\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage of corn\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage of soybeans\n\n# Define objective function\nProfit_wheat = 300 * A1\nProfit_corn = 400 * A2\nProfit_soybeans = 250 * A3\n# So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_wheat + Profit_corn + Profit_soybeans)\n\n# Add constraints\n# The total available water for irrigation is 500 units.\nmodel.addCons(2 * A1 + 3 * A2 + 1 * A3 <= 500)\n# The total land available for cultivation is 100 acres.\nmodel.addCons(A1 + A2 + A3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(A1))\n    print(\"Acreage of Corn: \", model.getVal(A2))\n    print(\"Acreage of Soybeans: \", model.getVal(A3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 594,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\n// Cost_A = (10 - 0.0001 * Automation) * A\n// Cost_B = (15 - 0.0001 * Automation) * B\n// Cost_C = (20 - 0.0001 * Automation) * C\n// So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A is at least 200 units, and for component B is at least 150 units.\n// A >= 200; B >= 150\n\n## Generate Constraint-3:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\nThe total production capacity of the company is 1000 units. The demand for component A is at least 200 units, and for component B is at least 150 units. The investment in automation cannot exceed $50,000.\nPlease help the company to determine the optimal production quantities of components A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of component C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = (10 - 0.0001 * Automation) * A\nCost_B = (15 - 0.0001 * Automation) * B\nCost_C = (20 - 0.0001 * Automation) * C\n# So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n# The total production capacity of the company is 1000 units.\nmodel.addCons(A + B + C <= 1000)\n# The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit per acre of land used. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the cost of fertilizers, which is $50 per acre for wheat, $70 per acre for corn, and $60 per acre for soybeans. The objective is to maximize the net profit per acre, which is the profit minus the cost of fertilizers.\n// Net profit per acre of wheat: Profit_W = (200 - 50) * W\n// Net profit per acre of corn: Profit_C = (300 - 70) * C\n// Net profit per acre of soybeans: Profit_S = (250 - 60) * S\n// The objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (W + C + S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer must dedicate at least 20 acres to soybeans due to a contract.\n// S >= 20\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for fertilizers.\n// 50 * W + 70 * C + 60 * S <= 5000\n\n## Generate Constraint-4:\nThe farmer wants to ensure that the total acreage of wheat and corn does not exceed 70 acres.\n// W + C <= 70",
        "question": "A farmer has a plot of land where he can grow three different crops: wheat, corn, and soybeans. He needs to decide how many acres to dedicate to each crop to optimize his farming operation. The profit per acre and the cost of fertilizers for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Cost of Fertilizers per Acre |\n|------------|-----------------|------------------------------|\n| Wheat      | $200            | $50                          |\n| Corn       | $300            | $70                          |\n| Soybeans   | $250            | $60                          |\n\nThe farmer aims to maximize his total profit per acre of land used, which is the profit minus the cost of fertilizers. The farmer has a total of 100 acres of land available. He must dedicate at least 20 acres to soybeans due to a contract. The farmer has a budget of $5000 for fertilizers. The farmer wants to ensure that the total acreage of wheat and corn does not exceed 70 acres.\n\nPlease help the farmer to maximize the net profit per acre, which is the profit minus the cost of fertilizers, by determining the optimal number of acres to dedicate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (250 - 60) * S\nTotalAcreage = W + C + S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / TotalAcreage\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcreage == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget of $5000 for fertilizers.\nmodel.addCons(50 * W + 70 * C + 60 * S <= 5000)\n## The farmer wants to ensure that the total acreage of wheat and corn does not exceed 70 acres.\nmodel.addCons(W + C <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1172,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\n// Total profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\n// Total profit for DeviceC: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 600\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBQty <= 2 * DeviceAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for raw materials, which limits the production of DeviceC to at most 300 units.\n// DeviceCQty <= 300",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for each device decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Device | Profit per Unit (first X units) | Decrease in Profit per Unit (beyond X units) | X (threshold units) |\n|--------|---------------------------------|--------------------------------------------|---------------------|\n| DeviceA | $50                             | $0.1                                       | 100                 |\n| DeviceB | $70                             | $0.2                                       | 200                 |\n| DeviceC | $100                            | $0.3                                       | 300                 |\n\nThe company has a total production capacity of 600 units for all devices combined. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. Additionally, the company has a fixed budget for raw materials, which limits the production of DeviceC to at most 300 units.\n\nPlease help the company to maximize the total profit from the production of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=600)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAQty == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=600)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBQty == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.2 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=600)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCQty == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 100 * DeviceC1 * DeviceC_b1 + (100 - 0.3 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 600)\nmodel.addCons(DeviceBQty <= 2 * DeviceAQty)\nmodel.addCons(DeviceCQty <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1295,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand.\n// The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n// The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n// The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 100 hours per day.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 40 hours per day.\n// M1 <= 40; M2 <= 40; M3 <= 40\n\n## Generate Constraint-3:\nThe operating hours must be non-negative.\n// M1 >= 0; M2 >= 0; M3 >= 0",
        "question": "A manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production. Each machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand. The total operating hours for all machines cannot exceed 100 hours per day. Each machine can operate for a maximum of 40 hours per day. The operating hours must be non-negative. Please help the plant manager to minimize the maximum of the total hours needed for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n## The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n## The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication and use max function\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\")\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\")\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\")\nmodel.addCons(T_A * (10 * M1 + 7 * M2 + 12 * M3) >= 500)\nmodel.addCons(T_B * (5 * M1 + 9 * M2 + 4 * M3) >= 400)\nmodel.addCons(T_C * (8 * M1 + 6 * M2 + 10 * M3) >= 600)\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 100 hours per day.\nmodel.addCons(M1 + M2 + M3 <= 100)\n## Each machine can operate for a maximum of 40 hours per day.\nmodel.addCons(M1 <= 40)\nmodel.addCons(M2 <= 40)\nmodel.addCons(M3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Minimized Total Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1037,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost while maintaining service quality. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. The service quality is measured by the total capacity of all trucks, where each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company wants to maximize the service quality (capacity) while minimizing the operational cost.\n// Total operational cost: Cost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\n// Total capacity: Capacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n// So, the objective function is: Minimize (Cost / Capacity)\n\n## Generate Constraint-1:\nThe company has a budget of $20,000 per day for operational costs.\n// 500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20,000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. They need to determine how many of each type of truck to deploy for a new route optimization strategy. The operational cost per TruckA is $500 per day, for TruckB is $700 per day, and for TruckC is $1000 per day. Each TruckA has a capacity of 10 units, TruckB has 15 units, and TruckC has 20 units. The company aims to maximize the service quality (capacity) while minimizing the operational cost. The company has a budget of $20,000 per day for operational costs. Please help the company to minimize the total operational cost while maintaining service quality, measured by the total capacity of all trucks.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * TruckA + 700 * TruckB + 1000 * TruckC\nCapacity = 10 * TruckA + 15 * TruckB + 20 * TruckC\n## the objective function is: Minimize (Cost / Capacity)\n## convert the division to multiplication\nmodel.addCons(obj * Capacity == Cost)\n\n# Add constraints\n## The company has a budget of $20,000 per day for operational costs.\nmodel.addCons(500 * TruckA + 700 * TruckB + 1000 * TruckC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Cost per Unit of Capacity: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 690,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand.\n// The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n// The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n// The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 100 hours per day.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nEach machine can operate for a maximum of 40 hours per day.\n// M1 <= 40; M2 <= 40; M3 <= 40",
        "question": "A manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production. Each machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand. The total operating hours for all machines cannot exceed 100 hours per day, and each machine can operate for a maximum of 40 hours per day. Please help the plant manager to minimize the maximum of the total hours needed for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n## The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n## The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0)\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0)\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0)\nmodel.addCons(T_A * (10 * M1 + 7 * M2 + 12 * M3) == 500)\nmodel.addCons(T_B * (5 * M1 + 9 * M2 + 4 * M3) == 400)\nmodel.addCons(T_C * (8 * M1 + 6 * M2 + 10 * M3) == 600)\n\n## Minimize max(T_A, T_B, T_C)\nmodel.addCons(obj >= T_A)\nmodel.addCons(obj >= T_B)\nmodel.addCons(obj >= T_C)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 100 hours per day.\nmodel.addCons(M1 + M2 + M3 <= 100)\n## Each machine can operate for a maximum of 40 hours per day.\nmodel.addCons(M1 <= 40)\nmodel.addCons(M2 <= 40)\nmodel.addCons(M3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Minimized Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n// Profit from Crop A: Profit_A = (5 * 100 - 300) * A\n// Profit from Crop B: Profit_B = (7 * 120 - 400) * B\n// Profit from Crop C: Profit_C = (6 * 110 - 350) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to cultivate at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The expected yield, selling price, and cost of cultivation for each crop are given in the following Table.\n\n| Crop | Expected Yield (tons/acre) | Selling Price ($/ton) | Cost of Cultivation ($/acre) |\n|------|---------------------------|----------------------|-----------------------------|\n| A    | 5                         | 100                  | 300                         |\n| B    | 7                         | 120                  | 400                         |\n| C    | 6                         | 110                  | 350                         |\n\nThe farm has a total of 100 acres available for cultivation. The farmer wants to cultivate at least 10 acres of each crop. Please help the farmer to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to cultivate at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 - 300) * A\nProfit_B = (7 * 120 - 400) * B\nProfit_C = (6 * 110 - 350) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit.\n// Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n// Profit from product B: Profit_B = 70 * B - 5 * B\n// Profit from product C: Profit_C = 100 * C - 1000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit. The profit and maintenance costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Maintenance Cost |\n|---------|-----------------|------------------|\n| A       | $50             | Quadratic (0.1 * A^2) |\n| B       | $70             | Linear (5 * B)   |\n| C       | $100            | Fixed ($1000)    |\n\nThe company has a total production capacity of 1000 units across all products. Please help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n## Profit from product B: Profit_B = 70 * B - 5 * B\n## Profit from product C: Profit_C = 100 * C - 1000\nProfit_A = 50 * A - 0.1 * A**2\nProfit_B = 70 * B - 5 * B\nProfit_C = 100 * C - 1000\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 633,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, the selling price is $100 per ton, and the water cost is $20 per ton. \nFor Crop B, the yield per acre is 7 tons, the selling price is $120 per ton, and the water cost is $25 per ton. \nFor Crop C, the yield per acre is 9 tons, the selling price is $150 per ton, and the water cost is $30 per ton.\nThe farm has limited water resources and aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n// Revenue of A: Revenue_A = 5 * A * (100 - 20)\n// Revenue of B: Revenue_B = 7 * B * (120 - 25)\n// Revenue of C: Revenue_C = 9 * C * (150 - 30)\n// Water cost of A: Water_cost_A = 5 * A * 20\n// Water cost of B: Water_cost_B = 7 * B * 25\n// Water cost of C: Water_cost_C = 9 * C * 30\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The yield per acre, selling price, and water cost for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Selling Price per Ton | Water Cost per Ton |\n|------|----------------|-----------------------|---------------------|\n| A    | 5 tons         | $100                  | $20                 |\n| B    | 7 tons         | $120                  | $25                 |\n| C    | 9 tons         | $150                  | $30                 |\n\nThe farm has a total of 100 acres available for cultivation. The farmer wants to ensure at least 20 acres are dedicated to each crop. The farm has limited water resources and aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\nPlease help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 5 * A * (100 - 20)\nRevenue_B = 7 * B * (120 - 25)\nRevenue_C = 9 * C * (150 - 30)\nWater_cost_A = 5 * A * 20\nWater_cost_B = 7 * B * 25\nWater_cost_C = 9 * C * 30\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_cost_A + Water_cost_B + Water_cost_C) == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company wants to maximize the total profit, which is the sum of the profits from each product.\n// Total profit: Profit = 50A + 70B + 100C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 100 hours of labor available per week.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe company has a total of 70 hours of machine time available per week.\n// A + 2B + 3C <= 70\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product B.\n// B >= 5",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and the required labor and machine time for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Time | Machine Time |\n|---------|-----------------|------------|--------------|\n| A       | $50             | 2 hours    | 1 hour       |\n| B       | $70             | 3 hours    | 2 hours      |\n| C       | $100            | 4 hours    | 3 hours      |\n\nThe company has a total of 100 hours of labor available per week and 70 hours of machine time available per week. The company must produce at least 10 units of product A and at least 5 units of product B. \nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 100C\nmodel.addCons(obj == 50*A + 70*B + 100*C)\n\n# Add constraints\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The company has a total of 70 hours of machine time available per week.\nmodel.addCons(A + 2*B + 3*C <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to Product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * ProductA\n// Total profit for Product B: ProfitB = 70 * ProductB\n// Total profit for Product C: ProfitC = 60 * ProductC\n// The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000\n\n## Generate Constraint-2:\nThe production of Product A is limited to a maximum of 200 units.\n// ProductA <= 200",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n\nThe total resources available are limited to 1000 units. The production of Product A is limited to a maximum of 200 units. Please help the manufacturer determine the optimal number of units of each product and the amount of resources allocated to each to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # number of units of Product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resources allocated to Product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resources allocated to Product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resources allocated to Product C\n\n# Define objective function\nProfitA = 50 * ProductA\nProfitB = 70 * ProductB\nProfitC = 60 * ProductC\n# The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The total resources available are limited to 1000 units.\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Resources Allocated to Product A: \", model.getVal(ResourceA))\n    print(\"Resources Allocated to Product B: \", model.getVal(ResourceB))\n    print(\"Resources Allocated to Product C: \", model.getVal(ResourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the production time is 1 hour. \nFor Device B, the selling price is $150, the production cost is $70, and the production time is 2 hours. \nFor Device C, the selling price is $200, the production cost is $90, and the production time is 3 hours.\nThe company aims to maximize its profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability.\nFor Device A, the selling price is $100, the production cost is $50, and the production time is 1 hour. \nFor Device B, the selling price is $150, the production cost is $70, and the production time is 2 hours. \nFor Device C, the selling price is $200, the production cost is $90, and the production time is 3 hours.\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device.\nPlease help the company to maximize its profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// PA <= 40",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production. Each hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit. The total operational hours for all lines must not exceed 120 hours per week, and the production line A can operate for a maximum of 40 hours per week. Please help the company to maximize the total production value.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# So, the objective function is: Maximize (VA + VB + VC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n# The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(PA <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for production line A: \", model.getVal(PA))\n    print(\"Hours for production line B: \", model.getVal(PB))\n    print(\"Hours for production line C: \", model.getVal(PC))\n    print(\"Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\n// {\"temperature setting for greenhouse A\": \"T_A\", \"range\": \"0 <= T_A <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse B\": \"T_B\", \"range\": \"0 <= T_B <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse C\": \"T_C\", \"range\": \"0 <= T_C <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n// Yield of greenhouse A: Yield_A = (T_A^2 / 100) - (T_A - 50)^2\n// Yield of greenhouse B: Yield_B = (T_B^2 / 100) - (T_B - 70)^2\n// Yield of greenhouse C: Yield_C = (T_C^2 / 100) - (T_C - 60)^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\n\n## Generate Constraint-1:\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2.\n// T_A^2 + T_B^2 + T_C^2 <= 150\n\n## Generate Constraint-2:\nThe temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\n// T_A >= T_B + 10\n\n## Generate Constraint-3:\nThe temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\n// T_C <= T_A + 20",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield. The yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2. The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B. The temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\n\nPlease help the farm to maximize the total yield from all greenhouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0, ub=100) # temperature setting for greenhouse A\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0, ub=100) # temperature setting for greenhouse B\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0, ub=100) # temperature setting for greenhouse C\n\n# Define objective function\nYield_A = (T_A**2 / 100) - (T_A - 50)**2\nYield_B = (T_B**2 / 100) - (T_B - 70)**2\nYield_C = (T_C**2 / 100) - (T_C - 60)**2\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n# The total energy consumption for all greenhouses must not exceed 150 energy units.\nmodel.addCons(T_A**2 + T_B**2 + T_C**2 <= 150)\n# The temperature in greenhouse A must be at least 10 degrees higher than the temperature in greenhouse B.\nmodel.addCons(T_A >= T_B + 10)\n# The temperature in greenhouse C must be no more than 20 degrees higher than the temperature in greenhouse A.\nmodel.addCons(T_C <= T_A + 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Temperature Setting for Greenhouse A: \", model.getVal(T_A))\n    print(\"Temperature Setting for Greenhouse B: \", model.getVal(T_B))\n    print(\"Temperature Setting for Greenhouse C: \", model.getVal(T_C))\n    print(\"Maximized Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1092,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $100, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of device B is $150, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit of device C is $200, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\n// Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\n// Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all devices must not exceed $10,000. The cost per unit of device A is $20, device B is $30, and device C is $40.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity. The production time for device A is 1 hour, device B is 2 hours, and device C is 3 hours. The total production time must not exceed 1000 hours.\n// A + 2 * B + 3 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit and production costs for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|--------|-----------------|--------------------------|-------------------------|\n| A      | $100 - $0.1 * max(A - 100, 0) | $20 | 1 hour |\n| B      | $150 - $0.2 * max(B - 50, 0) | $30 | 2 hours |\n| C      | $200 - $0.3 * max(C - 20, 0) | $40 | 3 hours |\n\nThe total production cost for all devices must not exceed $10,000. The company has a limited production capacity, and the total production time must not exceed 1000 hours. Please help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (100 - 0.1 * A2) * A2 * A_b2 + 100 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=50, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (150 - 0.2 * B2) * B2 * B_b2 + 150 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=20)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=20, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (200 - 0.3 * C2) * C2 * C_b2 + 200 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production cost for all devices must not exceed $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a limited production capacity.\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in improving the production efficiency of both products.\n// {\"number of units for Product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units for Product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"EfficiencyInvestment\", \"range\": \"EfficiencyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in efficiency upgrades. The initial production cost per unit for Product A is $100 and for Product B is $150. The selling price per unit for Product A is $200 and for Product B is $250. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (200 - (100 - 0.0005 * EfficiencyInvestment)) * UnitsA\n// Total profit for Product B: ProfitB = (250 - (150 - 0.0005 * EfficiencyInvestment)) * UnitsB\n// So, the objective function is: Maximize (ProfitA + ProfitB)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product A and 800 units for Product B.\n// UnitsA <= 1000; UnitsB <= 800\n\n## Generate Constraint-2:\nThe total investment in production efficiency upgrades cannot exceed $50,000.\n// EfficiencyInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, Product A and Product B, and the amount of money to invest in improving the production efficiency of both products. The production cost per unit decreases by $5 for every $10,000 invested in efficiency upgrades. The initial production cost per unit for Product A is $100 and for Product B is $150. The selling price per unit for Product A is $200 and for Product B is $250. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for Product A and 800 units for Product B. The total investment in production efficiency upgrades cannot exceed $50,000. Please help the company determine the optimal number of units to produce for each product and the optimal investment in production efficiency to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units for Product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units for Product B\nEfficiencyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyInvestment\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for Product A: ProfitA = (200 - (100 - 0.0005 * EfficiencyInvestment)) * UnitsA\n## Total profit for Product B: ProfitB = (250 - (150 - 0.0005 * EfficiencyInvestment)) * UnitsB\n## So, the objective function is: Maximize (ProfitA + ProfitB)\nProfitA = (200 - (100 - 0.0005 * EfficiencyInvestment)) * UnitsA\nProfitB = (250 - (150 - 0.0005 * EfficiencyInvestment)) * UnitsB\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for Product A and 800 units for Product B.\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 800)\n## The total investment in production efficiency upgrades cannot exceed $50,000.\nmodel.addCons(EfficiencyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units for Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units for Product B: \", model.getVal(UnitsB))\n    print(\"Investment in Production Efficiency: \", model.getVal(EfficiencyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many batches of each type of cake to bake to maximize profit while considering the limited oven time and ingredient availability.\n// {\"number of chocolate cake batches\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cake batches\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cake batches\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach batch of chocolate cake yields a profit of $50, vanilla cake yields $40, and strawberry cake yields $30. The bakery aims to maximize the total profit from selling these cakes.\n// Formal definition of the objective function: Maximize P = 50C + 40V + 30S\n\n## Generate Constraint-1:\nThe bakery has a total of 100 hours of oven time available per week. Each batch of chocolate cake requires 2 hours, vanilla cake requires 3 hours, and strawberry cake requires 4 hours of oven time.\n// 2C + 3V + 4S <= 100\n\n## Generate Constraint-2:\nThe bakery has a limited supply of chocolate, vanilla, and strawberry ingredients. The chocolate ingredient allows for a maximum of 30 batches, the vanilla ingredient allows for 25 batches, and the strawberry ingredient allows for 20 batches.\n// C <= 30; V <= 25; S <= 20",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide how many batches of each type of cake to bake to maximize profit while considering the limited oven time and ingredient availability. The profit per batch for each type of cake is as follows: chocolate cake yields $50, vanilla cake yields $40, and strawberry cake yields $30.\n\n| Cake Type | Profit per Batch | Oven Time per Batch |\n|-----------|------------------|---------------------|\n| Chocolate | $50              | 2 hours             |\n| Vanilla   | $40              | 3 hours             |\n| Strawberry| $30              | 4 hours             |\n\nThe bakery has a total of 100 hours of oven time available per week. The bakery also has a limited supply of ingredients: the chocolate ingredient allows for a maximum of 30 batches, the vanilla ingredient allows for 25 batches, and the strawberry ingredient allows for 20 batches.\n\nPlease help the bakery to maximize the total profit from selling these cakes while adhering to the constraints of oven time and ingredient availability.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of chocolate cake batches\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vanilla cake batches\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of strawberry cake batches\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50C + 40V + 30S\nmodel.addCons(obj == 50*C + 40*V + 30*S)\n\n# Add constraints\n## The bakery has a total of 100 hours of oven time available per week.\nmodel.addCons(2*C + 3*V + 4*S <= 100)\n## The bakery has a limited supply of chocolate, vanilla, and strawberry ingredients.\nmodel.addCons(C <= 30)\nmodel.addCons(V <= 25)\nmodel.addCons(S <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cake Batches: \", model.getVal(C))\n    print(\"Number of Vanilla Cake Batches: \", model.getVal(V))\n    print(\"Number of Strawberry Cake Batches: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer aims to maximize the profit per unit of resource used (either water or labor). The objective is to maximize the ratio of total profit to the sum of water and labor used.\n// Profit from A: Profit_A = 300 * A\n// Profit from B: Profit_B = 400 * B\n// Profit from C: Profit_C = 500 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 10,000 liters of water available for irrigation.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farmer has a total of 500 hours of labor available.\n// 5 * A + 8 * B + 10 * C <= 500\n\n## Generate Constraint-3:\nThe farmer wants to plant at least 5 acres of each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer has a total of 10,000 liters of water available for irrigation. The farmer has a total of 500 hours of labor available. The farmer wants to plant at least 5 acres of each crop.\nPlease help the farmer to maximize the profit per unit of resource used (either water or labor), which is defined as the ratio of total profit to the sum of water and labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 5 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 300 * A\nProfit_B = 400 * B\nProfit_C = 500 * C\nResourceUsage = 200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 10,000 liters of water available for irrigation.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farmer has a total of 500 hours of labor available.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. \nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. \nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n// Cost per ton-km for A: Cost_A = 200 / (5 * 10 * A)\n// Cost per ton-km for B: Cost_B = 300 / (10 * 15 * B)\n// Cost per ton-km for C: Cost_C = 400 / (15 * 20 * C)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe company needs to transport at least 100 tons of cargo next month.\n// 5 * A + 10 * B + 15 * C >= 100\n\n## Generate Constraint-3:\nThe company has a maximum of 50 vehicles available for deployment.\n// A + B + C <= 50\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 20% of the vehicles deployed are type A.\n// A >= 0.2 * (A + B + C)",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle type are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|--------------|-----------------------|---------------------------|----------------------|\n| A            | 10                    | 200                       | 5                    |\n| B            | 15                    | 300                       | 10                   |\n| C            | 20                    | 400                       | 15                   |\n\nThe company has a budget of $10,000 for vehicle maintenance next month. The company needs to transport at least 100 tons of cargo next month. The company has a maximum of 50 vehicles available for deployment. The company wants to ensure that at least 20% of the vehicles deployed are type A. \nPlease help the company to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 / (5 * 10 * A)\nCost_B = 300 / (10 * 15 * B)\nCost_C = 400 / (15 * 20 * C)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The company needs to transport at least 100 tons of cargo next month.\nmodel.addCons(5 * A + 10 * B + 15 * C >= 100)\n## The company has a maximum of 50 vehicles available for deployment.\nmodel.addCons(A + B + C <= 50)\n## The company wants to ensure that at least 20% of the vehicles deployed are type A.\nmodel.addCons(A >= 0.2 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. The profit per unit and the production cost function for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|---------------------------|\n| A      | $20             | 0.01 * A^2                |\n| B      | $30             | 2 * B                     |\n| C      | $40             | 50 - 0.5 * C              |\n\nThe company has a budget constraint of $1000 for the total production costs. Please help the company to maximize the total profit from selling the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_A = 20 * A - 0.01 * A^2\n## convert quadratic term to linear by introducing a new variable\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nmodel.addCons(A_sq == A * A)\nProfit_A = 20 * A - 0.01 * A_sq\n## Profit_B = 30 * B - 2 * B\nProfit_B = 30 * B - 2 * B\n## Profit_C = 40 * C - (50 - 0.5 * C)\nProfit_C = 40 * C - (50 - 0.5 * C)\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A_sq + 2 * B + (50 - 0.5 * C) <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 718,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products. The total production rate for all products cannot exceed 100 units per hour, and the investment in advanced machinery cannot exceed $50,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in Advanced Machinery: \", model.getVal(Machinery))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 742,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit.\n// Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\n// Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\n// Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a contract to supply at least 10 acres of wheat.\n// W >= 10\n\n## Generate Constraint-3:\nDue to market demand, the farmer can only sell up to 20 acres of corn.\n// C <= 20",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The farmer's profit per acre for wheat is $300, for corn is $400, and for soybeans is $250. The farmer also incurs costs for water and fertilizer, which are nonlinear functions of the area planted. The water cost is $10 per acre for wheat, $15 per acre for corn, and $5 per acre for soybeans, but increases by 50% for areas larger than 10 acres. The fertilizer cost is $20 per acre for wheat, $25 per acre for corn, and $15 per acre for soybeans, but increases by 25% for areas larger than 15 acres. The farmer wants to maximize his total profit. The total available land is 50 acres. The farmer has a contract to supply at least 10 acres of wheat. Due to market demand, the farmer can only sell up to 20 acres of corn. Please help the farmer determine the optimal allocation of land to maximize his profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=10) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0, ub=20) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_W = 300 * W - (10 * W if W <= 10 else 10 * 1.5 * W) - (20 * W if W <= 15 else 20 * 1.25 * W)\nW1 = model.addVar(vtype=\"CONTINUOUS\", name=\"W1\", lb=0, ub=10)\nW2 = model.addVar(vtype=\"CONTINUOUS\", name=\"W2\", lb=10, ub=15)\nW3 = model.addVar(vtype=\"CONTINUOUS\", name=\"W3\", lb=15, ub=50)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nW_b3 = model.addVar(vtype=\"B\", name=\"W_b3\")\nmodel.addCons(W_b1 + W_b2 + W_b3 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2 + W3*W_b3)\nWaterCost_W = 10 * W1 * W_b1 + 10 * 1.5 * W2 * W_b2 + 10 * 1.5 * W3 * W_b3\nFertilizerCost_W = 20 * W1 * W_b1 + 20 * 1.25 * W2 * W_b2 + 20 * 1.25 * W3 * W_b3\nProfit_W = 300 * W - WaterCost_W - FertilizerCost_W\n## create piecewise variables for piecewise function: Profit_C = 400 * C - (15 * C if C <= 10 else 15 * 1.5 * C) - (25 * C if C <= 15 else 25 * 1.25 * C)\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=10, ub=15)\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=15, ub=20)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nC_b3 = model.addVar(vtype=\"B\", name=\"C_b3\")\nmodel.addCons(C_b1 + C_b2 + C_b3 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2 + C3*C_b3)\nWaterCost_C = 15 * C1 * C_b1 + 15 * 1.5 * C2 * C_b2 + 15 * 1.5 * C3 * C_b3\nFertilizerCost_C = 25 * C1 * C_b1 + 25 * 1.25 * C2 * C_b2 + 25 * 1.25 * C3 * C_b3\nProfit_C = 400 * C - WaterCost_C - FertilizerCost_C\n## create piecewise variables for piecewise function: Profit_S = 250 * S - (5 * S if S <= 10 else 5 * 1.5 * S) - (15 * S if S <= 15 else 15 * 1.25 * S)\nS1 = model.addVar(vtype=\"CONTINUOUS\", name=\"S1\", lb=0, ub=10)\nS2 = model.addVar(vtype=\"CONTINUOUS\", name=\"S2\", lb=10, ub=15)\nS3 = model.addVar(vtype=\"CONTINUOUS\", name=\"S3\", lb=15, ub=50)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nS_b3 = model.addVar(vtype=\"B\", name=\"S_b3\")\nmodel.addCons(S_b1 + S_b2 + S_b3 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2 + S3*S_b3)\nWaterCost_S = 5 * S1 * S_b1 + 5 * 1.5 * S2 * S_b2 + 5 * 1.5 * S3 * S_b3\nFertilizerCost_S = 15 * S1 * S_b1 + 15 * 1.25 * S2 * S_b2 + 15 * 1.25 * S3 * S_b3\nProfit_S = 250 * S - WaterCost_S - FertilizerCost_S\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\nmodel.addCons(W + C + S <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for Wheat: \", model.getVal(W))\n    print(\"Area of land for Corn: \", model.getVal(C))\n    print(\"Area of land for Soybeans: \", model.getVal(S))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company aims to maximize its total profit.\n\n| Device | Production Rate per Worker (per hour) | Profit per Device |\n|--------|---------------------------------------|-------------------|\n| Smartphone | 10 | $50 |\n| Tablet | 8 | $70 |\n| Laptop | 5 | $100 |\n\nThere are a total of 60 workers available. Please help the company decide the optimal allocation of workers to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 894,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) = Maximize (100 * W / (1 + 0.01 * W) + 150 * C / (1 + 0.02 * C) + 120 * B / (1 + 0.015 * B))\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat to maintain a market presence.\n// W >= 20",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil's nutrient depletion and water usage. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. However, the profit per acre decreases nonlinearly with the amount of land allocated due to soil nutrient depletion and varying water requirements. The profit function is defined as: Profit_W = 100 * W / (1 + 0.01 * W), Profit_C = 150 * C / (1 + 0.02 * C), Profit_B = 120 * B / (1 + 0.015 * B). The farmer aims to maximize the total profit from all crops. The total land available for farming is 100 acres. The farmer must allocate at least 20 acres to wheat to maintain a market presence. Please help the farmer determine the optimal allocation of land to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=20) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions with division converted to multiplication\nProfit_W = 100 * W / (1 + 0.01 * W)\nProfit_C = 150 * C / (1 + 0.02 * C)\nProfit_B = 120 * B / (1 + 0.015 * B)\n## Convert divisions to multiplications\nmodel.addCons(obj * (1 + 0.01 * W) == 100 * W)\nmodel.addCons(obj * (1 + 0.02 * C) == 150 * C)\nmodel.addCons(obj * (1 + 0.015 * B) == 120 * B)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Barley: \", model.getVal(B))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand.\n// The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n// The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n// The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 100 hours per day.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production. The production rates of each product per hour for each machine are given in the following Table.\n\n| Machine | Product A | Product B | Product C |\n|---------|-----------|-----------|-----------|\n| 1       | 10 units  | 5 units   | 8 units   |\n| 2       | 7 units   | 9 units   | 6 units   |\n| 3       | 12 units  | 4 units   | 10 units  |\n\nThe plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand. The total operating hours for all machines cannot exceed 100 hours per day.\n\nPlease help the plant manager to determine the optimal allocation of operating hours for each machine to meet the daily production requirements while minimizing the total operating hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n## The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n## The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication and use max function\nT_A = 500\nT_B = 400\nT_C = 600\nmodel.addCons(T_A <= (10 * M1 + 7 * M2 + 12 * M3) * obj)\nmodel.addCons(T_B <= (5 * M1 + 9 * M2 + 4 * M3) * obj)\nmodel.addCons(T_C <= (8 * M1 + 6 * M2 + 10 * M3) * obj)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 100 hours per day.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Minimized Total Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $10, product B is $15, and product C is $20. The revenue generated from selling each unit of product A is $20, product B is $30, and product C is $40. The plant has a limited production capacity and aims to maximize the profit-to-production cost ratio.\n// Cost of A: Cost_A = 10 * A\n// Cost of B: Cost_B = 15 * B\n// Cost of C: Cost_C = 20 * C\n// Revenue of A: Rev_A = 20 * A\n// Revenue of B: Rev_B = 30 * B\n// Revenue of C: Rev_C = 40 * C\n// Profit of A: Profit_A = Rev_A - Cost_A\n// Profit of B: Profit_B = Rev_B - Cost_B\n// Profit of C: Profit_C = Rev_C - Cost_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe plant must produce at least 500 units of product A, 300 units of product B, and 200 units of product C.\n// A >= 500; B >= 300; C >= 200\n\n## Generate Constraint-3:\nThe total production capacity is limited to 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. The cost of producing each unit of product A is $10, product B is $15, and product C is $20. The revenue generated from selling each unit of product A is $20, product B is $30, and product C is $40. The plant has a budget of $10,000 for production costs. The plant must produce at least 500 units of product A, 300 units of product B, and 200 units of product C. The total production capacity is limited to 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours. \nPlease help the plant to maximize the profit-to-production cost ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=500) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=200) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nRev_A = 20 * A\nRev_B = 30 * B\nRev_C = 40 * C\nProfit_A = Rev_A - Cost_A\nProfit_B = Rev_B - Cost_B\nProfit_C = Rev_C - Cost_C\nTotalCost = Cost_A + Cost_B + Cost_C\nTotalProfit = Profit_A + Profit_B + Profit_C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cost_A + Cost_B + Cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * TotalCost == TotalProfit)\n\n# Add constraints\n## The plant has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The total production capacity is limited to 1000 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Cost Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $500, but it requires 2 units of water. Crop B yields a profit of $700 per hectare with 3 units of water required. Crop C yields $1000 per hectare but requires 5 units of water. The farmer wants to maximize the total profit per unit of water used (profit/water).\n// Profit of A: Profit_A = 500 * A\n// Profit of B: Profit_B = 700 * B\n// Profit of C: Profit_C = 1000 * C\n// Water used for A: Water_A = 2 * A\n// Water used for B: Water_B = 3 * B\n// Water used for C: Water_C = 5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for planting.\n// A + B + C <= 100",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage. The profit per hectare and the water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Required per Hectare |\n|------|---------------------|----------------------------|\n| A    | $500                | 2 units                    |\n| B    | $700                | 3 units                    |\n| C    | $1000               | 5 units                    |\n\nThe farmer wants to maximize the total profit per unit of water used (profit/water). The farmer has a total of 100 hectares available for planting. Please help the farmer determine the optimal allocation of hectares to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand.\n// {\"number of solar panels on building 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building 1 generates 2 kWh per day, on building 2 generates 3 kWh per day, and on building 3 generates 4 kWh per day. The cost of installing a solar panel on building 1 is $500, on building 2 is $600, and on building 3 is $700. The company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh.\n// Total daily energy generated: E = 2 * P1 + 3 * P2 + 4 * P3\n// Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\n// So, the objective function is: Minimize C\n\n## Generate Constraint-1:\nThe total daily energy generated must meet or exceed 100 kWh.\n// 2 * P1 + 3 * P2 + 4 * P3 >= 100\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for the installation.\n// 500 * P1 + 600 * P2 + 700 * P3 <= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand. The energy generation and installation cost for each building are given in the following Table.\n\n| Building | Energy Generation per Panel (kWh/day) | Installation Cost per Panel ($) |\n|----------|--------------------------------------|---------------------------------|\n| 1        | 2                                    | 500                             |\n| 2        | 3                                    | 600                             |\n| 3        | 4                                    | 700                             |\n\nThe company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh. The company has a budget of $50,000 for the installation.\nPlease help the company determine the optimal number of solar panels to install on each building.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels on building 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels on building 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels on building 3\n\n# Define objective function\n## Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\n## So, the objective function is: Minimize C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500 * P1 + 600 * P2 + 700 * P3)\n\n# Add constraints\n## The total daily energy generated must meet or exceed 100 kWh.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 >= 100)\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * P1 + 600 * P2 + 700 * P3 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels on Building 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels on Building 3: \", model.getVal(P3))\n    print(\"Minimized Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The selling price per ton for crop A is $100, for crop B is $120, and for crop C is $150. The cost of cultivation per acre for crop A is $300, for crop B is $400, and for crop C is $500. The farmer aims to maximize the profit per acre (which is defined as the total revenue per acre minus the cost of cultivation per acre).\n// Revenue per acre of crop A: Rev_A = 5 * 100 = 500\n// Revenue per acre of crop B: Rev_B = 7 * 120 = 840\n// Revenue per acre of crop C: Rev_C = 9 * 150 = 1350\n// Cost per acre of crop A: Cost_A = 300\n// Cost per acre of crop B: Cost_B = 400\n// Cost per acre of crop C: Cost_C = 500\n// Profit per acre of crop A: Profit_A = Rev_A - Cost_A = 500 - 300 = 200\n// Profit per acre of crop B: Profit_B = Rev_B - Cost_B = 840 - 400 = 440\n// Profit per acre of crop C: Profit_C = Rev_C - Cost_C = 1350 - 500 = 850\n// So, the objective function is: Maximize (200 * A + 440 * B + 850 * C) / (A + B + C)\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to allocate at least 20 acres to each crop.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The yield per acre, selling price per ton, and cost of cultivation per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Selling Price per Ton | Cost of Cultivation per Acre |\n|------|----------------|-----------------------|------------------------------|\n| A    | 5 tons         | $100                  | $300                         |\n| B    | 7 tons         | $120                  | $400                         |\n| C    | 9 tons         | $150                  | $500                         |\n\nThe total available land for cultivation is 100 acres. The farmer wants to allocate at least 20 acres to each crop. The farmer aims to maximize the profit per acre (which is defined as the total revenue per acre minus the cost of cultivation per acre).\nPlease help the farmer to determine the optimal allocation of acres to each crop to maximize the profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to allocate at least 20 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 200 * A\nProfit_B = 440 * B\nProfit_C = 850 * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (200 * A + 440 * B + 850 * C) / (A + B + C)\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company aims to maximize the total profit while considering the efficiency of production time.\n// Profit_P1 = 30 * Q1 - 10 * Q1\n// Profit_P2 = 40 * Q2 - 15 * Q2\n// Profit_P3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units.\n// Q1 + Q2 + Q3 <= 500\n\n## Generate Constraint-4:\nThe market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1.\n// Q1 <= 50\n\n## Generate Constraint-5:\nThe company must produce at least 10 units of P2 to fulfill a contract.\n// Q2 >= 10",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company has a total production time of 200 hours and a budget of $10,000 for production costs. The company has a storage capacity of 500 units. The market demand for P1 is 50 units, and the company must produce at least 10 units of P2 to fulfill a contract. Please help the company to maximize the total profit while considering the efficiency of production time, defined as the sum of the profit per unit minus the production cost per unit, divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0, ub=50) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=10, ub=500) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0, ub=500) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (30 - 10) * Q1\nProfit_P2 = (40 - 15) * Q2\nProfit_P3 = (50 - 20) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 500)\n## The market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1.\nmodel.addCons(Q1 <= 50)\n## The company must produce at least 10 units of P2 to fulfill a contract.\nmodel.addCons(Q2 >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 884,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2). The company has a total production capacity of 1000 units per week. The market demand for product A is at least 100 units per week. Please help the company determine the optimal number of units to produce for each product to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\nmodel.addCons(obj == 50*A + 70*B + 60*C - 0.01*A**2 - 0.02*B**2 - 0.015*C**2)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of tomatoes on plot 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"real\"}\n// {\"acres of potatoes on plot 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"acres of carrots on plot 3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer wants to maximize his profit from selling the crops. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n// Profit from tomatoes: Profit_T = (500 - 10 * T1^2) * T1\n// Profit from potatoes: Profit_P = (300 - 5 * P2^2) * P2\n// Profit from carrots: Profit_C = (400 - 8 * C3^2) * C3\n// So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation across all plots is 100 acres.\n// T1 + P2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 10 acres to each crop.\n// T1 >= 10; P2 >= 10; C3 >= 10",
        "question": "A farmer has three plots of land where he can grow tomatoes, potatoes, and carrots. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for tomatoes is $500 - 10T1^2, for potatoes is $300 - 5P2^2, and for carrots is $400 - 8C3^2. The farmer aims to maximize the total profit from all crops.\n\n| Crop     | Profit Per Acre Formula          |\n|----------|----------------------------------|\n| Tomatoes | $500 - 10 * T1^2                |\n| Potatoes | $300 - 5 * P2^2                 |\n| Carrots  | $400 - 8 * C3^2                 |\n\nThe total area available for cultivation across all plots is 100 acres. The farmer must allocate at least 10 acres to each crop. Please help the farmer to maximize his profit from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 10 acres to each crop.\nT1 = model.addVar(vtype=\"CONTINUOUS\", name=\"T1\", lb=10) # acres of tomatoes on plot 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # acres of potatoes on plot 2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=10) # acres of carrots on plot 3\n\n# Define objective function\n## The farmer wants to maximize his profit from selling the crops.\nProfit_T = (500 - 10 * T1**2) * T1\nProfit_P = (300 - 5 * P2**2) * P2\nProfit_C = (400 - 8 * C3**2) * C3\n## So, the objective function is: Maximize (Profit_T + Profit_P + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_T + Profit_P + Profit_C)\n\n# Add constraints\n## The total area available for cultivation across all plots is 100 acres.\nmodel.addCons(T1 + P2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Tomatoes on Plot 1: \", model.getVal(T1))\n    print(\"Acres of Potatoes on Plot 2: \", model.getVal(P2))\n    print(\"Acres of Carrots on Plot 3: \", model.getVal(C3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 769,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop.\n// {\"area for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. \nFor C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. \nFor C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140.\nThe farm wants to maximize the net profit per liter of water used (profit per water efficiency).\n// Profit_C1 = 500 * A1 - 100 * A1\n// Profit_C2 = 600 * A2 - 120 * A2\n// Profit_C3 = 700 * A3 - 140 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (1000 * A1 + 1200 * A2 + 1400 * A3)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 acres.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 120,000 liters.\n// 1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop.\nFor C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. \nFor C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. \nFor C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140.\nThe farm wants to maximize the net profit per liter of water used (profit per water efficiency).\nThe farm has a total area of 100 acres. The farm has a limited water supply of 120,000 liters.\nPlease help the farm determine the optimal allocation of areas for each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 500 * A1 - 100 * A1\nProfit_C2 = 600 * A2 - 120 * A2\nProfit_C3 = 700 * A3 - 140 * A3\nWaterConsumption = 1000 * A1 + 1200 * A2 + 1400 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total area of 100 acres.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 120,000 liters.\nmodel.addCons(1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for C1: \", model.getVal(A1))\n    print(\"Area for C2: \", model.getVal(A2))\n    print(\"Area for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 787,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnts\", \"range\": \"DeviceBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnts\", \"range\": \"DeviceCUnts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\n// DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts)",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n\n| Device | Profit per Unit | Cost Function                |\n|--------|-----------------|------------------------------|\n| DeviceA| $50             | 20 + 0.05 * (DeviceAUnits^2)|\n| DeviceB| $70             | 30 + 0.03 * (DeviceBUnts^2) |\n| DeviceC| $90             | 40 + 0.02 * (DeviceCUnts^2) |\n\nThe company has a total production capacity of 1000 units for the month. Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined. Please help the company to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnts\", lb=0) # number of units of DeviceB\nDeviceCUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnts\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (20 + 0.05 * DeviceAUnits**2)) * DeviceAUnits\nProfit_DeviceB = (70 - (30 + 0.03 * DeviceBUnts**2)) * DeviceBUnts\nProfit_DeviceC = (90 - (40 + 0.02 * DeviceCUnts**2)) * DeviceCUnts\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000)\n## Due to market demand, the number of DeviceA units produced must be at least 20% of the total units of DeviceB and DeviceC combined.\nmodel.addCons(DeviceAUnits >= 0.2 * (DeviceBUnts + DeviceCUnts))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnts))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1188,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"0 <= P2 <= 150\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"0 <= P3 <= 200\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 yields a profit of $50, $70, and $90 respectively. However, the profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation. The profit function for each product is given by: Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit.\n// Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\n\n## Generate Constraint-1:\nThe total daily production capacity of the line is 300 units.\n// P1 + P2 + P3 <= 300\n\n## Generate Constraint-2:\nThe production of product 1 requires a specific raw material that is limited to 120 units per day.\n// P1 <= 120",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the daily production quantities of each product to maximize profit while considering the limited resources and market demand. Each unit of product 1, 2, and 3 yields a profit of $50, $70, and $90 respectively. However, the profit per unit decreases nonlinearly with increased production due to market saturation and resource degradation. The profit function for each product is given by: Profit = (100 - P) * Price, where P is the production quantity and Price is the profit per unit. The total daily production capacity of the line is 300 units. The production of product 1 requires a specific raw material that is limited to 120 units per day. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0, ub=150) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0, ub=200) # production quantity of product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Objective function: Maximize Profit = (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90\nmodel.addCons(obj == (100 - P1) * 50 + (100 - P2) * 70 + (100 - P3) * 90)\n\n# Add constraints\n## The total daily production capacity of the line is 300 units.\nmodel.addCons(P1 + P2 + P3 <= 300)\n## The production of product 1 requires a specific raw material that is limited to 120 units per day.\nmodel.addCons(P1 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 819,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop. The yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost. The farmer has a total of 100 acres available for planting. The total investment in the irrigation system cannot exceed $10,000.\nPlease help the farmer to maximize the net profit from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\n# The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n# The total investment in the irrigation system cannot exceed $10,000.\nmodel.addCons(Irrigation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the production time is 1 hour. \nFor Device B, the selling price is $150, the production cost is $70, and the production time is 2 hours. \nFor Device C, the selling price is $200, the production cost is $90, and the production time is 3 hours.\nThe company aims to maximize its profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe company has a maximum of 1000 hours available for production.\n// A + 2 * B + 3 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantity for each device to optimize its resource allocation and profitability. The selling price, production cost, and production time for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Production Time |\n|--------|---------------|-----------------|-----------------|\n| A      | 100$          | 50$             | 1 hour          |\n| B      | 150$          | 70$             | 2 hours         |\n| C      | 200$          | 90$             | 3 hours         |\n\nThe company has a budget of $10,000 for production costs. The company wants to produce at least 50 units of each device. The company has a maximum of 1000 hours available for production. \nPlease help the company to maximize its profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The company has a maximum of 1000 hours available for production.\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 936,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The objective is to maximize the total production while meeting these thresholds.\n// Total production of component A: PA = 10 * WA\n// Total production of component B: PB = 15 * WB\n// Total production of component C: PC = 20 * WC\n// Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// WA + WB + WC <= 50",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line. The production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The total number of workers available is 50.\nPlease help the manufacturer to maximize the total production of components A, B, and C while meeting the specified thresholds and not exceeding the total number of available workers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\nPA = 10 * WA\nPB = 15 * WB\nPC = 20 * WC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units.\nmodel.addCons(PA >= 500)\nmodel.addCons(PB >= 750)\nmodel.addCons(PC >= 1000)\n\n# The total number of workers available is 50.\nmodel.addCons(WA + WB + WC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints.\n// {\"quantity of ComponentA\": \"ComponentA\", \"range\": \"ComponentA >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentB\": \"ComponentB\", \"range\": \"ComponentB >= 0\", \"type\": \"integer\"}\n// {\"quantity of ComponentC\": \"ComponentC\", \"range\": \"ComponentC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $10, but it decreases by $0.02 for each unit produced beyond 100. The profit per unit of ComponentB is $15, but it decreases by $0.015 for each unit produced beyond 200. The profit per unit of ComponentC is $20, but it decreases by $0.01 for each unit produced beyond 300. The company aims to maximize the total profit from the sales of these components.\n// Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\n// Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\n// Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\n// So, the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all components.\n// ComponentA + ComponentB + ComponentC <= 1000\n\n## Generate Constraint-2:\nDue to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentB <= 2 * ComponentA\n\n## Generate Constraint-3:\nThe market demand for ComponentC is limited to 500 units.\n// ComponentC <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of ComponentA and 100 units of ComponentB to fulfill contractual obligations.\n// ComponentA >= 50; ComponentB >= 100",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities of each component to maximize their profit while considering various constraints. The profit per unit of each component and the decrease in profit per unit beyond certain production levels are given in the following Table.\n\n| Component | Profit per Unit | Decrease in Profit per Unit Beyond | Threshold |\n|-----------|-----------------|-----------------------------------|-----------|\n| ComponentA | $10             | $0.02                             | 100 units  |\n| ComponentB | $15             | $0.015                            | 200 units  |\n| ComponentC | $20             | $0.01                             | 300 units  |\n\nThe company has a total production capacity of 1000 units across all components. Due to limited resources, the production of ComponentB cannot exceed twice the production of ComponentA. The market demand for ComponentC is limited to 500 units. The company must produce at least 50 units of ComponentA and 100 units of ComponentB to fulfill contractual obligations.\n\nPlease help the company to maximize the total profit from the sales of these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentA = model.addVar(vtype=\"INTEGER\", name=\"ComponentA\", lb=50)  # quantity of ComponentA\nComponentB = model.addVar(vtype=\"INTEGER\", name=\"ComponentB\", lb=100)  # quantity of ComponentB\nComponentC = model.addVar(vtype=\"INTEGER\", name=\"ComponentC\", lb=0, ub=500)  # quantity of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (10 - 0.02 * max(ComponentA - 100, 0)) * ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=1000)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentA == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (10 - 0.02 * ComponentA2) * ComponentA2 * ComponentA_b2 + 10 * ComponentA1 * ComponentA_b1\n## create piecewise variables for piecewise function: Profit_ComponentB = (15 - 0.015 * max(ComponentB - 200, 0)) * ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=1000)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentB == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (15 - 0.015 * ComponentB2) * ComponentB2 * ComponentB_b2 + 15 * ComponentB1 * ComponentB_b1\n## create piecewise variables for piecewise function: Profit_ComponentC = (20 - 0.01 * max(ComponentC - 300, 0)) * ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=300)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=300, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentC == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (20 - 0.01 * ComponentC2) * ComponentC2 * ComponentC_b2 + 20 * ComponentC1 * ComponentC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_ComponentA + Profit_ComponentB + Profit_ComponentC\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentA + ComponentB + ComponentC <= 1000)\nmodel.addCons(ComponentB <= 2 * ComponentA)\nmodel.addCons(ComponentC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(ComponentA))\n    print(\"Quantity of ComponentB: \", model.getVal(ComponentB))\n    print(\"Quantity of ComponentC: \", model.getVal(ComponentC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The market demand for each device is uncertain, but the manufacturer wants to maximize the total profit while considering the risk of overproduction. The risk is defined as the square of the difference between production and estimated demand.\n// Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n// Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n// So, the objective function is: Maximize Profit - Risk\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for production.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000\n\n## Generate Constraint-2:\nThe estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\n// Smartphones >= 0.5 * 200\n// Tablets >= 0.5 * 150\n// Laptops >= 0.5 * 100",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary. The manufacturer wants to maximize the total profit while considering the risk of overproduction, which is defined as the square of the difference between production and estimated demand. The production cost, profit margin, and estimated demand for each device are given in the following Table.\n\n| Device       | Production Cost | Profit Margin | Estimated Demand |\n|--------------|-----------------|---------------|------------------|\n| Smartphones  | $100            | 20%           | 200 units        |\n| Tablets      | $200            | 15%           | 150 units        |\n| Laptops      | $300            | 10%           | 100 units        |\n\nThe manufacturer has a budget of $50,000 for production. The manufacturer wants to ensure at least 50% of the estimated demand is met for each device. The constraints are as follows:\n- The number of smartphones produced should not exceed 200 units.\n- The number of tablets produced should not exceed 150 units.\n- The number of laptops produced should not exceed 100 units.\n\nPlease help the manufacturer to maximize the total profit while minimizing the risk of overproduction.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\n\n# Define objective function\n## Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n## Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n## So, the objective function is: Maximize Profit - Risk\nProfit = 0.20 * 100 * Smartphones + 0.15 * 200 * Tablets + 0.10 * 300 * Laptops\nRisk = (Smartphones - 200)**2 + (Tablets - 150)**2 + (Laptops - 100)**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Risk)\n\n# Add constraints\n## The manufacturer has a budget of $50,000 for production.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000)\n## The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\nmodel.addCons(Smartphones >= 0.5 * 200)\nmodel.addCons(Tablets >= 0.5 * 150)\nmodel.addCons(Laptops >= 0.5 * 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit - Risk: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1293,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop.\n// {\"area for CropA\": \"CropA_Area\", \"range\": \"CropA_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropB\": \"CropB_Area\", \"range\": \"CropB_Area >= 0\", \"type\": \"real\"}\n// {\"area for CropC\": \"CropC_Area\", \"range\": \"CropC_Area >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. \nFor CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300.\nThe farm wants to maximize the net profit per liter of water used.\n// Net_Profit_CropA = 1000 * CropA_Area - 200 * CropA_Area\n// Net_Profit_CropB = 1200 * CropB_Area - 250 * CropB_Area\n// Net_Profit_CropC = 1500 * CropC_Area - 300 * CropC_Area\n// So, the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / (5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares available for cultivation.\n// CropA_Area + CropB_Area + CropC_Area <= 100",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area in hectares to allocate for each crop. For CropA, the expected profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the expected profit per hectare is $1200, the water usage per hectare is 6000 liters, and the fertilizer cost per hectare is $250. For CropC, the expected profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. The farm has a total area of 100 hectares available for cultivation. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal allocation of area for each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropA_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropA_Area\", lb=0) # area for CropA\nCropB_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropB_Area\", lb=0) # area for CropB\nCropC_Area = model.addVar(vtype=\"CONTINUOUS\", name=\"CropC_Area\", lb=0) # area for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_CropA = (1000 - 200) * CropA_Area\nNet_Profit_CropB = (1200 - 250) * CropB_Area\nNet_Profit_CropC = (1500 - 300) * CropC_Area\nWaterUsage = 5000 * CropA_Area + 6000 * CropB_Area + 7000 * CropC_Area\n## the objective function is: Maximize (Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Profit_CropA + Net_Profit_CropB + Net_Profit_CropC)\n\n# Add constraints\n## The farm has a total area of 100 hectares available for cultivation.\nmodel.addCons(CropA_Area + CropB_Area + CropC_Area <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for CropA: \", model.getVal(CropA_Area))\n    print(\"Area for CropB: \", model.getVal(CropB_Area))\n    print(\"Area for CropC: \", model.getVal(CropC_Area))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 799,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company wants to maximize the total profit, which is the sum of the profits from each product.\n// Total profit: Profit = 50A + 70B + 100C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 100 hours of labor available per week.\n// 2A + 3B + 4C <= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company has a total of 100 hours of labor available per week.\nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 100C\nmodel.addCons(obj == 50*A + 70*B + 100*C)\n\n# Add constraints\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 649,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the investment in production efficiency to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit, cost of raw materials per unit, and initial production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit | Initial Production Time per Unit |\n|---------|-----------------|--------------------------------|---------------------------------|\n| A       | $100            | $30                            | 5 hours                         |\n| B       | $150            | $50                            | 6 hours                         |\n\nFor every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The company has a total production capacity of 200 hours. Please help the company to maximize the total profit, considering the production time and investment in efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers assigned to the smartphone production line\": \"Smartphone\", \"range\": \"Smartphone >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the tablet production line\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"number of workers assigned to the laptop production line\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 10 units per worker per hour, tablets is 15 units per worker per hour, and laptops is 20 units per worker per hour. The cost of production per unit for smartphones is $5, tablets is $8, and laptops is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the devices minus the production cost.\n// Revenue from smartphones: R_smartphone = 10 * Smartphone * $20\n// Revenue from tablets: R_tablet = 15 * Tablet * $30\n// Revenue from laptops: R_laptop = 20 * Laptop * $40\n// Production cost for smartphones: C_smartphone = 10 * Smartphone * $5\n// Production cost for tablets: C_tablet = 15 * Tablet * $8\n// Production cost for laptops: C_laptop = 20 * Laptop * $10\n// Total profit: Profit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// Smartphone + Tablet + Laptop <= 50\n\n## Generate Constraint-2:\nThe manufacturer has a budget constraint that limits the total production cost to $1000 per hour.\n// 5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. The production rate and cost per unit for each device are given in the following Table.\n\n| Device     | Production Rate (units/worker/hour) | Cost per Unit | Selling Price per Unit |\n|------------|------------------------------------|---------------|------------------------|\n| Smartphones| 10                                 | $5            | $20                    |\n| Tablets    | 15                                 | $8            | $30                    |\n| Laptops    | 20                                 | $10           | $40                    |\n\nThe manufacturer has a total of 50 workers available. The manufacturer also has a budget constraint that limits the total production cost to $1000 per hour. \n\nPlease help the manufacturer to maximize the profit, which is the revenue from selling the devices minus the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphone = model.addVar(vtype=\"INTEGER\", name=\"Smartphone\", lb=0) # number of workers assigned to the smartphone production line\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=0) # number of workers assigned to the tablet production line\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=0) # number of workers assigned to the laptop production line\n\n# Define objective function\nR_smartphone = 10 * Smartphone * 20\nR_tablet = 15 * Tablet * 30\nR_laptop = 20 * Laptop * 40\nC_smartphone = 10 * Smartphone * 5\nC_tablet = 15 * Tablet * 8\nC_laptop = 20 * Laptop * 10\nProfit = (R_smartphone + R_tablet + R_laptop) - (C_smartphone + C_tablet + C_laptop)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Smartphone + Tablet + Laptop <= 50)\nmodel.addCons(5 * Smartphone + 8 * Tablet + 10 * Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers Assigned to Smartphone Production Line: \", model.getVal(Smartphone))\n    print(\"Number of Workers Assigned to Tablet Production Line: \", model.getVal(Tablet))\n    print(\"Number of Workers Assigned to Laptop Production Line: \", model.getVal(Laptop))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000\n\n## Generate Constraint-3:\nThe production rate for Product 1 must be at least 10 units per hour.\n// P1 >= 10\n\n## Generate Constraint-4:\nThe production rate for Product 2 must be at least 20 units per hour.\n// P2 >= 20\n\n## Generate Constraint-5:\nThe production rate for Product 3 must be at least 15 units per hour.\n// P3 >= 15",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\nThe total production rate for all products cannot exceed 100 units per hour. The investment in advanced machinery cannot exceed $50,000. The production rate for Product 1 must be at least 10 units per hour, for Product 2 must be at least 20 units per hour, and for Product 3 must be at least 15 units per hour.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=20) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=15) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0, ub=50000) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate for Product 1: \", model.getVal(P1))\n    print(\"Production rate for Product 2: \", model.getVal(P2))\n    print(\"Production rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in advanced machinery: \", model.getVal(Machinery))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow.\n// {\"number of units of product\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"number of workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every 10 overtime hours allowed. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the product.\n// Total profit for the product: Profit = (150 - 100 + 0.5 * Overtime) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired.\n// Workers <= 50; Workers >= 10\n\n## Generate Constraint-3:\nThe total amount of overtime hours allowed cannot exceed 100 hours.\n// Overtime <= 100",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units of a product to produce, the number of workers to hire, and the amount of overtime hours to allow. The initial production cost per unit is $100, and the selling price per unit is $150. The cost of production per unit decreases by $5 for every 10 overtime hours allowed. The company aims to maximize the total profit from the product.\n\nThe company has a maximum capacity of 1000 units that can be produced in the next quarter. The total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired. The total amount of overtime hours allowed cannot exceed 100 hours.\n\nPlease help the company to maximize the total profit from the product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units of product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=10, ub=50)  # number of workers\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0, ub=100)  # amount of overtime hours\n\n# Define objective function\n## Total profit for the product: Profit = (150 - 100 + 0.5 * Overtime) * Units\nProfit = (150 - 100 + 0.5 * Overtime) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 1000 units that can be produced in the next quarter.\nmodel.addCons(Units <= 1000)\n## The total number of workers available for hiring is 50, and the company must ensure that at least 10 workers are hired.\nmodel.addCons(Workers <= 50)\nmodel.addCons(Workers >= 10)\n## The total amount of overtime hours allowed cannot exceed 100 hours.\nmodel.addCons(Overtime <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 809,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands.\n// Production time for smartphones: T_S = 1000 / (10 * S)\n// Production time for tablets: T_T = 800 / (8 * T)\n// Production time for laptops: T_L = 500 / (5 * L)\n// So, the objective function is: Minimize max(T_S, T_T, T_L)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available for all production lines.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// S <= 20; T <= 20; L <= 20",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line. Each worker on the smartphone production line can produce 10 smartphones per hour, on the tablet line, 8 tablets per hour, and on the laptop line, 5 laptops per hour. The manufacturer needs to meet a daily demand of at least 1000 smartphones, 800 tablets, and 500 laptops. The goal is to minimize the total production time required to meet these demands. There are a total of 50 workers available for all production lines, and each production line can accommodate a maximum of 20 workers. Please help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum production time for any of the devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=20) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=20) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=20) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT_S = 1000 / (10 * S)\nT_T = 800 / (8 * T)\nT_L = 500 / (5 * L)\n## the objective function is: Minimize max(T_S, T_T, T_L)\n## convert the max function to a constraint\nmodel.addCons(obj >= T_S)\nmodel.addCons(obj >= T_T)\nmodel.addCons(obj >= T_L)\n\n# Add constraints\n## There are a total of 50 workers available for all production lines.\nmodel.addCons(S + T + L <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimized Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\n// Prod1 <= 1000; Prod2 <= 800\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements.\n// Prod1 >= 200; Prod2 >= 150",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n\n| Product | Cost per Unit | Selling Price | Automation Cost Reduction |\n|---------|---------------|---------------|---------------------------|\n| 1       | 100$          | 200$          | 5$ per $10,000 Automation |\n| 2       | 150$          | 250$          | 10$ per $10,000 Automation |\n\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2. The total investment in automation cannot exceed $50,000. The company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=200, ub=1000)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=150, ub=800)  # production quantity of Product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\n## Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\nProfit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\nmodel.addCons(Prod1 <= 1000)\nmodel.addCons(Prod2 <= 800)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n## The company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements.\nmodel.addCons(Prod1 >= 200)\nmodel.addCons(Prod2 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1271,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nProduct A requires a minimum production of 50 units to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product B as product A.\n// B >= 2 * A\n\n## Generate Constraint-5:\nThe production of product C should not exceed 30% of the total production.\n// C <= 0.3 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit per unit and the setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| A       | $50             | $1000      |\n| B       | $70             | $1500      |\n| C       | $90             | $2000      |\n\nThe company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Product A requires a minimum production of 50 units to meet contractual obligations. The company aims to produce at least twice as many units of product B as product A. The production of product C should not exceed 30% of the total production.\n\nPlease help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nProfit_A = 50 * A - 1000\nProfit_B = 70 * B - 1500\nProfit_C = 90 * C - 2000\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n# The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n# Product A requires a minimum production of 50 units to meet contractual obligations.\nmodel.addCons(A >= 50)\n# The company aims to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n# The production of product C should not exceed 30% of the total production.\nmodel.addCons(C <= 0.3 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods.\n// {\"number of solar panels\": \"SolarPanels\", \"range\": \"SolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"WindTurbines\", \"range\": \"WindTurbines >= 0\", \"type\": \"integer\"}\n// {\"investment in energy storage\": \"EnergyStorage\", \"range\": \"EnergyStorage >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested. The company aims to maximize the total energy output after accounting for the reduced loss due to energy storage.\n// Total energy output: Output = (100 * SolarPanels + 200 * WindTurbines) * (1 - 0.00005 * EnergyStorage)\n// So, the objective function is: Maximize Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines.\n// 1000 * SolarPanels + 2000 * WindTurbines <= 1000000\n\n## Generate Constraint-2:\nThe total investment in energy storage technology cannot exceed $50,000.\n// EnergyStorage <= 50000\n\n## Generate Constraint-3:\nThe region has space for a maximum of 500 solar panels and 300 wind turbines.\n// SolarPanels <= 500; WindTurbines <= 300",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in a region. The company needs to determine the number of solar panels and wind turbines to install, as well as the investment in energy storage technology to optimize the energy output and reduce energy loss during peak demand periods. The energy output from each solar panel is 100 kWh, and from each wind turbine is 200 kWh. The investment in energy storage technology reduces the energy loss by 0.5% for every $10,000 invested.\n\n| Component             | Output per Unit | Cost per Unit |\n|-----------------------|-----------------|---------------|\n| Solar Panels          | 100 kWh         | $1000         |\n| Wind Turbines         | 200 kWh         | $2000         |\n| Energy Storage (per $10,000) | Reduces energy loss by 0.5% | - |\n\nThe company has a budget of $1,000,000 for the installation of solar panels and wind turbines. The total investment in energy storage technology cannot exceed $50,000. The region has space for a maximum of 500 solar panels and 300 wind turbines.\n\nPlease help the company to maximize the total energy output after accounting for the reduced loss due to energy storage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"SolarPanels\", lb=0, ub=500)  # number of solar panels\nWindTurbines = model.addVar(vtype=\"INTEGER\", name=\"WindTurbines\", lb=0, ub=300)  # number of wind turbines\nEnergyStorage = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyStorage\", lb=0)  # investment in energy storage\n\n# Define objective function\nOutput = model.addVar('Output')\nmodel.setObjective(Output, \"maximize\")\nEnergyLossReduction = 1 - 0.00005 * EnergyStorage\nmodel.addCons(Output == (100 * SolarPanels + 200 * WindTurbines) * EnergyLossReduction)\n\n# Add constraints\nmodel.addCons(1000 * SolarPanels + 2000 * WindTurbines <= 1000000)  # budget constraint\nmodel.addCons(EnergyStorage <= 50000)  # investment constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(SolarPanels))\n    print(\"Number of Wind Turbines: \", model.getVal(WindTurbines))\n    print(\"Investment in Energy Storage: \", model.getVal(EnergyStorage))\n    print(\"Maximized Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1189,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit.\n// {\"units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n// The net profit for component A: P_A = 50A - 20A = 30A\n// The net profit for component B: P_B = 70B - 30B = 40B\n// The net profit for component C: P_C = 60C - 25C = 35C\n// The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day.\n// A + B + C <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit. The profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit. The company has a limited production capacity and can produce a maximum of 100 units in total per day.\nPlease help the company to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # units of component C\n\n# Define objective function\n## The net profit for component A: P_A = 50A - 20A = 30A\n## The net profit for component B: P_B = 70B - 30B = 40B\n## The net profit for component C: P_C = 60C - 25C = 35C\n## The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 30*A + 40*B + 35*C)\n\n# Add constraints\n## The company has a limited production capacity. It can produce a maximum of 100 units in total per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Component A: \", model.getVal(A))\n    print(\"Units of Component B: \", model.getVal(B))\n    print(\"Units of Component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 592,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 20.\n// Cap + Res + Ind <= 20",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type. Each machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 20. Please help the manufacturer determine the optimal number of machines for each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0) # number of machines for inductors\n\n# Define objective function\n## Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n## Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\nCost = 5 * Cap + 7 * Res + 9 * Ind\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n## The total number of machines available is 20.\nmodel.addCons(Cap + Res + Ind <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Inductor Machines: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin.\n// {\"production rate of MachineA\": \"MachineAProduction\", \"range\": \"MachineAProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBProduction\", \"range\": \"MachineBProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCProduction\", \"range\": \"MachineCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineAProduction\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBProduction\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCProduction\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// MachineAProduction + MachineBProduction + MachineCProduction <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineBProduction <= 2 * MachineAProduction",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin. The profit per unit and production cost per unit for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| MachineA | $500           | $300                     |\n| MachineB | $700           | $400                     |\n| MachineC | $900           | $500                     |\n\nThe company has a total production capacity of 1000 units per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. \nPlease help the company to maximize the total profit by determining the optimal production rates for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAProduction\", lb=0) # production rate of MachineA\nMachineBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBProduction\", lb=0) # production rate of MachineB\nMachineCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCProduction\", lb=0) # production rate of MachineC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineAProduction\n## Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBProduction\n## Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCProduction\nProfit_MachineA = (500 - 300) * MachineAProduction\nProfit_MachineB = (700 - 400) * MachineBProduction\nProfit_MachineC = (900 - 500) * MachineCProduction\n## So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(MachineAProduction + MachineBProduction + MachineCProduction <= 1000)\n## Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineBProduction <= 2 * MachineAProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineAProduction))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBProduction))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: solar, wind, and hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost per unit of solar energy is $500, wind energy is $300, and hydro energy is $400. The efficiency of each source is 80% for solar, 90% for wind, and 75% for hydro. The company wants to minimize the total cost of energy while maximizing the total energy output.\n// Total cost: Cost = 500 * Solar + 300 * Wind + 400 * Hydro\n// Total energy output: Output = 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for energy investments.\n// 500 * Solar + 300 * Wind + 400 * Hydro <= 1000000\n\n## Generate Constraint-2:\nThe company aims to produce at least 2000 units of energy in total.\n// 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro >= 2000",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: solar, wind, and hydro. The cost per unit and efficiency of each energy source are given in the following Table.\n\n| Energy Source | Cost per Unit | Efficiency |\n|---------------|---------------|------------|\n| Solar         | $500          | 80%        |\n| Wind          | $300          | 90%        |\n| Hydro         | $400          | 75%        |\n\nThe company has a budget of $1,000,000 for energy investments. The company aims to produce at least 2000 units of energy in total. Please help the company to minimize the total cost of energy while maximizing the total energy output, defined as the ratio of the total cost to the total energy output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * Solar + 300 * Wind + 400 * Hydro\nOutput = 0.8 * Solar + 0.9 * Wind + 0.75 * Hydro\n## the objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $1,000,000 for energy investments.\nmodel.addCons(500 * Solar + 300 * Wind + 400 * Hydro <= 1000000)\n## The company aims to produce at least 2000 units of energy in total.\nmodel.addCons(0.8 * Solar + 0.9 * Wind + 0.75 * Hydro >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Energy: \", model.getVal(Solar))\n    print(\"Amount of Wind Energy: \", model.getVal(Wind))\n    print(\"Amount of Hydro Energy: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 765,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z).\n// {\"amount of Material X used\": \"X\", \"range\": \"X >= 0\", \"type\": \"real\"}\n// {\"amount of Material Y used\": \"Y\", \"range\": \"Y >= 0\", \"type\": \"real\"}\n// {\"amount of Material Z used\": \"Z\", \"range\": \"Z >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of Material X is $5 per unit, Material Y is $10 per unit, and Material Z is $15 per unit. The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials.\n// Total cost of raw materials: Cost = 5 * X + 10 * Y + 15 * Z\n// Total production output: Output = 2 * X + 3 * Y + 4 * Z (assuming each unit of raw material contributes to the output as specified)\n// The objective function is: Minimize Cost / Output\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 5 * X + 10 * Y + 15 * Z <= 10000\n\n## Generate Constraint-2:\nThe company must use at least 500 units of Material X.\n// X >= 500",
        "question": "A manufacturing company produces three types of products (Product A, Product B, and Product C) using three different raw materials (Material X, Material Y, and Material Z). The company aims to minimize the total cost of raw materials while maximizing the production efficiency, which is defined as the ratio of the total production output to the total cost of raw materials. The cost of each material and the output contribution per unit are given in the following Table.\n\n| Material | Cost per Unit | Output Contribution per Unit |\n|----------|---------------|------------------------------|\n| X        | $5            | 2                            |\n| Y        | $10           | 3                            |\n| Z        | $15           | 4                            |\n\nThe company has a budget of $10,000 for raw materials. The company must use at least 500 units of Material X. Please help the company determine the optimal amounts of Material X, Material Y, and Material Z to use in order to minimize the total cost of raw materials while maximizing production efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nX = model.addVar(vtype=\"CONTINUOUS\", name=\"X\", lb=500) # amount of Material X used\nY = model.addVar(vtype=\"CONTINUOUS\", name=\"Y\", lb=0) # amount of Material Y used\nZ = model.addVar(vtype=\"CONTINUOUS\", name=\"Z\", lb=0) # amount of Material Z used\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 5 * X + 10 * Y + 15 * Z\nOutput = 2 * X + 3 * Y + 4 * Z\n## The objective function is: Minimize Cost / Output\n## convert the division to multiplication\nmodel.addCons(obj * Output == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(5 * X + 10 * Y + 15 * Z <= 10000)\n## The company must use at least 500 units of Material X.\nmodel.addCons(X >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Material X used: \", model.getVal(X))\n    print(\"Amount of Material Y used: \", model.getVal(Y))\n    print(\"Amount of Material Z used: \", model.getVal(Z))\n    print(\"Minimized Cost per Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1079,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E).\n// {\"number of solar panels\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of energy storage systems\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total cost of installation and operation over a 10-year period. The cost function is nonlinear and includes initial installation costs and annual operational costs. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\n// Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\n// So, the objective function is: Minimize Total cost\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for initial installation.\n// 1000 * S + 2000 * W + 3000 * E <= 100000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it.\n// 100 * S + 200 * W >= 50000\n\n## Generate Constraint-3:\nThe total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines.\n// E <= 0.5 * (S + W)\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 30% of the total energy production comes from renewable sources.\n// 0.3 * (100 * S + 200 * W) >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy storage systems. The decision variables are the number of solar panels (S), wind turbines (W), and energy storage systems (E). The company aims to minimize the total cost of installation and operation over a 10-year period. The cost of solar panels is $1000 per unit with an annual maintenance cost of $50 per unit. The cost of wind turbines is $2000 per unit with an annual maintenance cost of $100 per unit. The cost of energy storage systems is $3000 per unit with an annual maintenance cost of $150 per unit.\nThe company has a budget of $100,000 for initial installation. The total annual energy output must be at least 50,000 kWh. The solar panels produce 100 kWh per unit annually, wind turbines produce 200 kWh per unit annually, and energy storage systems do not produce energy but store it. The total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines. The company wants to ensure that at least 30% of the total energy production comes from renewable sources.\nPlease help the company to minimize the total cost of installation and operation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of solar panels\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of wind turbines\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0) # number of energy storage systems\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost = (1000 * S + 2000 * W + 3000 * E) + (50 * S + 100 * W + 150 * E) * 10\nTotalCost = 1000 * S + 2000 * W + 3000 * E + 10 * (50 * S + 100 * W + 150 * E)\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The company has a budget of $100,000 for initial installation.\nmodel.addCons(1000 * S + 2000 * W + 3000 * E <= 100000)\n## The total annual energy output must be at least 50,000 kWh.\nmodel.addCons(100 * S + 200 * W >= 50000)\n## The total number of energy storage systems must not exceed 50% of the total number of solar panels and wind turbines.\nmodel.addCons(E <= 0.5 * (S + W))\n## The company wants to ensure that at least 30% of the total energy production comes from renewable sources.\nmodel.addCons(0.3 * (100 * S + 200 * W) >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(S))\n    print(\"Number of Wind Turbines: \", model.getVal(W))\n    print(\"Number of Energy Storage Systems: \", model.getVal(E))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1217,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of sales representatives\": \"SalesReps\", \"range\": \"SalesReps >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n// Total sales revenue: Revenue = (100 * Production + 0.5 * Advertising + 20000 * SalesReps)\n// So, the objective function is: Maximize Revenue\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 10,000 units for the quarter.\n// Production <= 10000\n\n## Generate Constraint-2:\nThe total advertising budget must not exceed $50,000.\n// Advertising <= 50000\n\n## Generate Constraint-3:\nThe number of sales representatives must be at least 5 to maintain adequate customer service.\n// SalesReps >= 5\n\n## Generate Constraint-4:\nThe company has a budget constraint where the sum of the production cost, advertising budget, and salaries for sales representatives must not exceed $1,000,000.\n// Production * 50 + Advertising + SalesReps * 5000 <= 1000000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget to promote the product, and the number of sales representatives to hire. The company estimates that each unit of the product sold will generate a profit of $100. The advertising budget increases the awareness and thus the sales of the product, with an effectiveness of $500 in sales per $1,000 spent on advertising. The number of sales representatives also affects the sales, with each representative contributing an additional $20,000 in sales. The company aims to maximize the total sales revenue.\n\nThe company has a production capacity limit of 10,000 units for the quarter. The total advertising budget must not exceed $50,000. The number of sales representatives must be at least 5 to maintain adequate customer service. The company has a budget constraint where the sum of the production cost, advertising budget, and salaries for sales representatives must not exceed $1,000,000.\n\nPlease help the company to maximize the total sales revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nSalesReps = model.addVar(vtype=\"INTEGER\", name=\"SalesReps\", lb=0) # number of sales representatives\n\n# Define objective function\nRevenue = 100 * Production + 0.5 * Advertising + 20000 * SalesReps\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue)\n\n# Add constraints\nmodel.addCons(Production <= 10000) # production capacity limit\nmodel.addCons(Advertising <= 50000) # advertising budget limit\nmodel.addCons(SalesReps >= 5) # minimum number of sales representatives\nmodel.addCons(Production * 50 + Advertising + SalesReps * 5000 <= 1000000) # budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Sales Representatives: \", model.getVal(SalesReps))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1117,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company aims to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * UnitsA) * UnitsB\n// Profit_C = (100 - 0.2 * UnitsB) * UnitsC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total for all devices.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC.\n// 20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each device are produced to meet minimum market requirements.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company has a production capacity of 500 units in total for all devices. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC. The company wants to ensure that at least 50 units of each device are produced to meet minimum market requirements. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## Profit_B = (70 - 0.05 * UnitsA) * UnitsB\nProfit_B = (70 - 0.05 * UnitsA) * UnitsB\n## Profit_C = (100 - 0.2 * UnitsB) * UnitsC\nProfit_C = (100 - 0.2 * UnitsB) * UnitsC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA >= 2 * UnitsB)\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of ComponentA per machine is 10 units per hour, with a defect rate of 5%. ComponentB per machine produces 15 units per hour with a defect rate of 3%. ComponentC per machine produces 20 units per hour with a defect rate of 2%. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate.\n// Effective production rate for ComponentA: RateA = 10 * (1 - 0.05) * MachinesA\n// Effective production rate for ComponentB: RateB = 15 * (1 - 0.03) * MachinesB\n// Effective production rate for ComponentC: RateC = 20 * (1 - 0.02) * MachinesC\n// So, the objective function is: Maximize (RateA + RateB + RateC)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20\n\n## Generate Constraint-3:\nTo maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA.\n// MachinesB >= 0.5 * MachinesA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output. The production rate and defect rate per machine for each component are given in the following Table.\n\n| Component | Production Rate per Machine | Defect Rate |\n|-----------|------------------------------|-------------|\n| ComponentA | 10 units per hour           | 5%          |\n| ComponentB | 15 units per hour           | 3%          |\n| ComponentC | 20 units per hour           | 2%          |\n\nThe company has a total of 50 machines available for allocation. Due to space limitations, no more than 20 machines can be allocated to ComponentA. To maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate.\n\nPlease help the company to determine the optimal allocation of machines to maximize the total effective production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ComponentC\n\n# Define objective function\nRateA = 10 * (1 - 0.05) * MachinesA\nRateB = 15 * (1 - 0.03) * MachinesB\nRateC = 20 * (1 - 0.02) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RateA + RateB + RateC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\nmodel.addCons(MachinesA <= 20)\nmodel.addCons(MachinesB >= 0.5 * MachinesA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Effective Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit.\n// {\"production quantity for WidgetA\": \"WidgetA_Qty\", \"range\": \"WidgetA_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetB\": \"WidgetB_Qty\", \"range\": \"WidgetB_Qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for WidgetC\": \"WidgetC_Qty\", \"range\": \"WidgetC_Qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.01 * (WidgetA_Qty^2)) * WidgetA_Qty\n// Profit_WidgetB = (70 - 0.02 * (WidgetB_Qty^2)) * WidgetB_Qty\n// Profit_WidgetC = (90 - 0.03 * (WidgetC_Qty^2)) * WidgetC_Qty\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all widgets combined.\n// WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of WidgetB must be at least half of the production of WidgetA.\n// WidgetB_Qty >= 0.5 * WidgetA_Qty\n\n## Generate Constraint-3:\nThe company has a limited budget for raw materials, which restricts the total cost of production to $50,000.\n// 0.01 * (WidgetA_Qty^2) + 0.02 * (WidgetB_Qty^2) + 0.03 * (WidgetC_Qty^2) <= 50,000",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to determine the production quantity for each widget to optimize their profit. The profit per unit for WidgetA is $50, for WidgetB is $70, and for WidgetC is $90. However, the production cost per unit increases nonlinearly with the quantity produced due to economies of scale. The cost function for WidgetA is 0.01 * (WidgetA_Qty^2), for WidgetB is 0.02 * (WidgetB_Qty^2), and for WidgetC is 0.03 * (WidgetC_Qty^2). The company has a total production capacity of 1000 units for all widgets combined. Due to market demand, the production of WidgetB must be at least half of the production of WidgetA. The company has a limited budget for raw materials, which restricts the total cost of production to $50,000. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetA_Qty\", lb=0) # production quantity for WidgetA\nWidgetB_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetB_Qty\", lb=0) # production quantity for WidgetB\nWidgetC_Qty = model.addVar(vtype=\"INTEGER\", name=\"WidgetC_Qty\", lb=0) # production quantity for WidgetC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_WidgetA = (50 - 0.01 * WidgetA_Qty**2) * WidgetA_Qty\nProfit_WidgetB = (70 - 0.02 * WidgetB_Qty**2) * WidgetB_Qty\nProfit_WidgetC = (90 - 0.03 * WidgetC_Qty**2) * WidgetC_Qty\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all widgets combined.\nmodel.addCons(WidgetA_Qty + WidgetB_Qty + WidgetC_Qty <= 1000)\n## Due to market demand, the production of WidgetB must be at least half of the production of WidgetA.\nmodel.addCons(WidgetB_Qty >= 0.5 * WidgetA_Qty)\n## The company has a limited budget for raw materials, which restricts the total cost of production to $50,000.\nmodel.addCons(0.01 * WidgetA_Qty**2 + 0.02 * WidgetB_Qty**2 + 0.03 * WidgetC_Qty**2 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for WidgetA: \", model.getVal(WidgetA_Qty))\n    print(\"Production Quantity for WidgetB: \", model.getVal(WidgetB_Qty))\n    print(\"Production Quantity for WidgetC: \", model.getVal(WidgetC_Qty))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season.\n// {\"amount of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"amount of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"amount of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the selling price is $2 per unit, the cost of seeds is $0.5 per unit, and the water consumption is 3 liters per unit. \nFor Crop B, the selling price is $3 per unit, the cost of seeds is $1 per unit, and the water consumption is 5 liters per unit. \nFor Crop C, the selling price is $4 per unit, the cost of seeds is $1.5 per unit, and the water consumption is 7 liters per unit.\nThe farmer aims to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\n// Net profit of A: Profit_A = (2 - 0.5) * A\n// Net profit of B: Profit_B = (3 - 1) * B\n// Net profit of C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 5 * B + 7 * C)\n\n## Generate Constraint-1:\nThe farmer has a budget of $500 for seeds.\n// 0.5 * A + 1 * B + 1.5 * C <= 500",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season. The selling price, cost of seeds, and water consumption for each crop are given in the following Table.\n\n| Crop | Selling Price | Cost of Seeds | Water Consumption |\n|------|---------------|---------------|-------------------|\n| A    | $2            | $0.5          | 3 liters          |\n| B    | $3            | $1            | 5 liters          |\n| C    | $4            | $1.5          | 7 liters          |\n\nThe farmer has a budget of $500 for seeds. The farmer aims to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\nPlease help the farmer determine the optimal amount of each crop to plant to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # amount of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nWaterConsumption = 3 * A + 5 * B + 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a budget of $500 for seeds.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Crop A: \", model.getVal(A))\n    print(\"Amount of Crop B: \", model.getVal(B))\n    print(\"Amount of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 842,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. The production cost for each product increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n\n| Product | Profit per Unit | Production Cost Model |\n|---------|-----------------|-----------------------|\n| A       | $50             | 0.01 * A^2           |\n| B       | $70             | 0.02 * B^2           |\n| C       | $90             | 0.03 * C^2           |\n\nThe total production capacity of the company is 1000 units per month. Please help the company determine the optimal number of units of products A, B, and C to produce each month to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n## Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1147,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of chemicals in their factory. They need to decide the amount of raw materials to allocate to each chemical production process to optimize their profit.\n// {\"amount of raw material for chemical 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit functions are nonlinear and are given by:\n- Profit from chemical 1: P1 = 100 * R1 - 0.5 * R1^2\n- Profit from chemical 2: P2 = 150 * R2 - 0.7 * R2^2\n- Profit from chemical 3: P3 = 200 * R3 - 0.9 * R3^2\nThe company wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of raw material available is 100 units.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nThe production of chemical 1 requires at least 10 units of raw material.\n// R1 >= 10\n\n## Generate Constraint-3:\nThe production of chemical 3 cannot exceed 50% of the total raw material used.\n// R3 <= 0.5 * (R1 + R2 + R3)",
        "question": "A company produces three types of chemicals in their factory and needs to decide the amount of raw materials to allocate to each chemical production process to optimize their profit. The profit from each chemical depends on the amount of raw material used, with the following profit functions:\n- Profit from chemical 1: P1 = 100 * R1 - 0.5 * R1^2\n- Profit from chemical 2: P2 = 150 * R2 - 0.7 * R2^2\n- Profit from chemical 3: P3 = 200 * R3 - 0.9 * R3^2\nThe company wants to maximize the total profit from all three chemicals. The total amount of raw material available is 100 units. The production of chemical 1 requires at least 10 units of raw material. The production of chemical 3 cannot exceed 50% of the total raw material used.\nPlease help the company determine the optimal allocation of raw materials to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material for chemical 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for chemical 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for chemical 3\n\n# Define objective function\nP1 = 100 * R1 - 0.5 * R1**2\nP2 = 150 * R2 - 0.7 * R2**2\nP3 = 200 * R3 - 0.9 * R3**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 <= 100) # total amount of raw material available is 100 units\nmodel.addCons(R1 >= 10) # production of chemical 1 requires at least 10 units of raw material\nmodel.addCons(R3 <= 0.5 * (R1 + R2 + R3)) # production of chemical 3 cannot exceed 50% of the total raw material used\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Chemical 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Chemical 3: \", model.getVal(R3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to the complexity of the production process, the profit per unit decreases nonlinearly with the increase in production quantity. Specifically, the profit per unit decreases by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products.\n// Profit_A = (10 - 0.005 * A) * A\n// Profit_B = (15 - 0.005 * B) * B\n// Profit_C = (20 - 0.005 * C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 150 units, and for Product C is 100 units.\n// A <= 200; B <= 150; C <= 100\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 300 units in total.\n// A + B + C <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of each product decreases nonlinearly with the increase in production quantity, specifically by 0.005 times the quantity produced for each product. The company aims to maximize the total profit from all products. The profit per unit for Product A is $10, for Product B is $15, and for Product C is $20.\n\n| Product | Profit per Unit | Raw Material per Unit | Demand Limit |\n|---------|-----------------|-----------------------|--------------|\n| A       | 10$             | 5 kg                  | 200 units    |\n| B       | 15$             | 8 kg                  | 150 units    |\n| C       | 20$             | 10 kg                 | 100 units    |\n\nThe company has a limited supply of raw materials, with a total of 1000 kg available. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The market has a demand limit for each product as specified in the table. Additionally, the company has a production capacity limit of 300 units in total.\n\nPlease help the company to determine the optimal production quantities of each product to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=100) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 - 0.005 * A) * A\nProfit_B = (15 - 0.005 * B) * B\nProfit_C = (20 - 0.005 * C) * C\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n## The market has a demand limit for each product.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\nmodel.addCons(C <= 100)\n## The company has a production capacity limit of 300 units in total.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1374,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for Capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Diodes\": \"Dio\", \"range\": \"Dio >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180.\n// Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n// Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $5000 per hour for operating the machines.\n// 100 * Cap + 120 * Res + 110 * Dio <= 5000",
        "question": "A manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type. The production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180. The manufacturer has a budget of $5000 per hour for operating the machines.\n\nPlease help the manufacturer to maximize the profit, which is the total production value minus the operating cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for Capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for Resistors\nDio = model.addVar(vtype=\"INTEGER\", name=\"Dio\", lb=0) # number of machines for Diodes\n\n# Define objective function\n## Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n## Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\nValue = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\nCost = 100 * Cap + 120 * Res + 110 * Dio\n## So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $5000 per hour for operating the machines.\nmodel.addCons(100 * Cap + 120 * Res + 110 * Dio <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Diode Machines: \", model.getVal(Dio))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 769,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost.\n// The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production.\n// 20A + 0.1A^2 + 30B + 0.15B^2 + 25C + 0.12C^2 <= 10000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units.\n// A <= 200; B <= 150; C <= 180\n\n## Generate Constraint-3:\nThe company has a limited workforce, and the total number of units produced cannot exceed 300.\n// A + B + C <= 300",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The company has a limited budget of $10,000 for production. The market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units. The company also has a limited workforce, and the total number of units produced cannot exceed 300.\n\nPlease help the company to maximize the total profit, which is the revenue minus the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=180) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\nProfit_A = 50 * A - (20 + 0.1 * A_sq)\nProfit_B = 70 * B - (30 + 0.15 * B_sq)\nProfit_C = 60 * C - (25 + 0.12 * C_sq)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production.\nmodel.addCons(20 * A + 0.1 * A_sq + 30 * B + 0.15 * B_sq + 25 * C + 0.12 * C_sq <= 10000)\n## The total number of units produced cannot exceed 300.\nmodel.addCons(A + B + C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop.\n// {\"area for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 500 kg, the water consumption per acre is 1000 liters, and the fertilizer cost per acre is $100. \nFor C2, the yield per acre is 600 kg, the water consumption per acre is 1200 liters, and the fertilizer cost per acre is $120. \nFor C3, the yield per acre is 700 kg, the water consumption per acre is 1400 liters, and the fertilizer cost per acre is $140.\nThe farm wants to maximize the net profit per liter of water used (profit per water efficiency).\n// Profit_C1 = 500 * A1 - 100 * A1\n// Profit_C2 = 600 * A2 - 120 * A2\n// Profit_C3 = 700 * A3 - 140 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (1000 * A1 + 1200 * A2 + 1400 * A3)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 acres.\n// A1 + A2 + A3 <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 120,000 liters.\n// 1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000\n\n## Generate Constraint-3:\nThe farm has a budget of $12,000 for fertilizer costs.\n// 100 * A1 + 120 * A2 + 140 * A3 <= 12000\n\n## Generate Constraint-4:\nThe market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1.\n// A1 <= 30",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the areas to allocate for each crop. The yield per acre, water consumption per acre, and fertilizer cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Water Consumption per Acre | Fertilizer Cost per Acre |\n|------|----------------|----------------------------|---------------------------|\n| C1   | 500 kg         | 1000 liters                | $100                     |\n| C2   | 600 kg         | 1200 liters                | $120                     |\n| C3   | 700 kg         | 1400 liters                | $140                     |\n\nThe farm has a total area of 100 acres. The farm has a limited water supply of 120,000 liters. The farm has a budget of $12,000 for fertilizer costs. The market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1.\nPlease help the farm to maximize the net profit per liter of water used (profit per water efficiency).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 500 * A1 - 100 * A1\nProfit_C2 = 600 * A2 - 120 * A2\nProfit_C3 = 700 * A3 - 140 * A3\nWaterConsumption = 1000 * A1 + 1200 * A2 + 1400 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total area of 100 acres.\nmodel.addCons(A1 + A2 + A3 <= 100)\n## The farm has a limited water supply of 120,000 liters.\nmodel.addCons(1000 * A1 + 1200 * A2 + 1400 * A3 <= 120000)\n## The farm has a budget of $12,000 for fertilizer costs.\nmodel.addCons(100 * A1 + 120 * A2 + 140 * A3 <= 12000)\n## The market demand for C1 is 30 acres. So, the farm can only plant a maximum of 30 acres of C1.\nmodel.addCons(A1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for C1: \", model.getVal(A1))\n    print(\"Area for C2: \", model.getVal(A2))\n    print(\"Area for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the product A line can produce 10 units per hour, with a cost of $5 per unit.\nEach worker on the product B line can produce 15 units per hour, with a cost of $7 per unit.\nEach worker on the product C line can produce 20 units per hour, with a cost of $9 per unit.\nThe manufacturer wants to maximize the profit, which is the total revenue minus the total cost. The selling price for each product is $10.\n// Total revenue: Revenue = 10 * (10 * A + 15 * B + 20 * C)\n// Total cost: Cost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// A + B + C <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. Each worker on the product A line can produce 10 units per hour, with a cost of $5 per unit. Each worker on the product B line can produce 15 units per hour, with a cost of $7 per unit. Each worker on the product C line can produce 20 units per hour, with a cost of $9 per unit. The selling price for each product is $10. The manufacturer wants to maximize the profit, which is the total revenue minus the total cost. There are a total of 50 workers available. Please help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on product A line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on product B line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on product C line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 10 * (10 * A + 15 * B + 20 * C)\nCost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(A))\n    print(\"Number of Workers on Product B Line: \", model.getVal(B))\n    print(\"Number of Workers on Product C Line: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per hectare is 5 tons, the selling price per ton is $100, and the labor cost per hectare is $200. \nFor Crop B, the yield per hectare is 8 tons, the selling price per ton is $120, and the labor cost per hectare is $300. \nFor Crop C, the yield per hectare is 10 tons, the selling price per ton is $150, and the labor cost per hectare is $400.\nThe farmer aims to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n// Profit_A = (5 * 100 * A) - (200 * A)\n// Profit_B = (8 * 120 * B) - (300 * B)\n// Profit_C = (10 * 150 * C) - (400 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-4:\nThe market demand for Crop A is limited to 50 tons. Since each hectare of Crop A yields 5 tons, the maximum hectares of Crop A should not exceed 10.\n// A <= 10",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop. The yield per hectare, selling price per ton, and labor cost per hectare for each crop are given in the following Table.\n\n| Crop | Yield per Hectare | Selling Price per Ton | Labor Cost per Hectare |\n|------|-------------------|-----------------------|------------------------|\n| A    | 5 tons            | $100                  | $200                   |\n| B    | 8 tons            | $120                  | $300                   |\n| C    | 10 tons           | $150                  | $400                   |\n\nThe farmer has a total of 100 hectares available for cultivation. The farmer has a budget of $20,000 for labor costs. The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity. The market demand for Crop A is limited to 50 tons. Since each hectare of Crop A yields 5 tons, the maximum hectares of Crop A should not exceed 10.\nPlease help the farmer to maximize the net profit per hectare (which is defined as the total revenue minus the total cost, divided by the total hectares).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 10 hectares are dedicated to each crop to maintain crop diversity.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=10) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 * A) - (200 * A)\nProfit_B = (8 * 120 * B) - (300 * B)\nProfit_C = (10 * 150 * C) - (400 * C)\nTotalHectares = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalHectares\n## convert the division to multiplication\nmodel.addCons(obj * TotalHectares == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Hectare: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1158,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"production rate of C1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of C2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of C3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\n// Profit_C1 = 10 * P1 * 0.8 * P1\n// Profit_C2 = 15 * P2 * 0.9 * P2\n// Profit_C3 = 20 * P3 * 1.1 * P3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\n// P1 <= 50; P2 <= 50; P3 <= 50",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit and the efficiency of production for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Efficiency |\n|----------|-----------------|-----------------------|\n| C1       | $10             | 0.8 * P1              |\n| C2       | $15             | 0.9 * P2              |\n| C3       | $20             | 1.1 * P3              |\n\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical. Please help the plant to maximize the total profit by determining the optimal production rates for C1, C2, and C3.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of C1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of C2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3.\nProfit_C1 = 10 * P1 * 0.8 * P1\nProfit_C2 = 15 * P2 * 0.9 * P2\nProfit_C3 = 20 * P3 * 1.1 * P3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 50)\nmodel.addCons(P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of C1: \", model.getVal(P1))\n    print(\"Production Rate of C2: \", model.getVal(P2))\n    print(\"Production Rate of C3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They need to determine the production quantity for each product and the investment in a new energy-efficient technology that reduces the energy cost per unit produced.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for all products is $50. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\n// Total profit for ProductB: Profit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\n// Total profit for ProductC: Profit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// ProdA + ProdB + ProdC <= 10000\n\n## Generate Constraint-2:\nThe investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company is planning to produce three types of products: ProductA, ProductB, and ProductC. They also need to determine the investment in a new energy-efficient technology that reduces the energy cost per unit produced. The energy cost per unit produced decreases by $2 for every $10,000 invested in energy efficiency upgrades. The initial energy cost per unit for all products is $50. The revenue generated per unit is $100 for ProductA, $120 for ProductB, and $150 for ProductC. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units across all products. The investment in energy efficiency upgrades cannot exceed $50,000. Please help the company determine the optimal production quantity for each product and the investment in energy efficiency to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=0) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=0) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=0) # production quantity for ProductC\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\n## Total profit for ProductB: Profit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\n## Total profit for ProductC: Profit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (100 - 50 + 0.0002 * EnergyEfficiency) * ProdA\nProfit_B = (120 - 50 + 0.0002 * EnergyEfficiency) * ProdB\nProfit_C = (150 - 50 + 0.0002 * EnergyEfficiency) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(ProdA + ProdB + ProdC <= 10000)\n## The investment in energy efficiency upgrades cannot exceed $50,000.\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 861,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company aims to maximize the total profit from both products.\n// Profit_A = (100 - (60 - 2 * Automation)) * ProductA\n// Profit_B = (150 - (80 - 3 * Automation)) * ProductB\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for both products combined.\n// ProductA + ProductB <= 500\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $10,000.\n// Automation <= 10000\n\n## Generate Constraint-3:\nThe minimum production quantity for Product A must be at least 10 units.\n// ProductA >= 10\n\n## Generate Constraint-4:\nThe market demand for Product B is limited to 200 units.\n// ProductB <= 200",
        "question": "A manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. Product A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company has a total production capacity of 500 units for both products combined. The investment in automation cannot exceed $10,000. The minimum production quantity for Product A must be at least 10 units. The market demand for Product B is limited to 200 units.\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=200)  # quantity of product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit_A = (100 - (60 - 2 * Automation)) * ProductA\nProfit_B = (150 - (80 - 3 * Automation)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 500)\nmodel.addCons(Automation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 917,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\n// Cost_A = 10 - 0.5 * Automation\n// Cost_B = 15 - 0.5 * Automation\n// Revenue_A = 20 * QA\n// Revenue_B = 25 * QB\n// Total_Cost = Cost_A * QA + Cost_B * QB\n// Total_Revenue = Revenue_A + Revenue_B\n// Profit = Total_Revenue - Total_Cost\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// QA + QB <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for implementing automation.\n// Automation <= 5000\n\n## Generate Constraint-3:\nThe market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A.\n// QA <= 500\n\n## Generate Constraint-4:\nThe company must produce at least 200 units of Product B to meet contractual obligations.\n// QB >= 200",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 1000 units for both products combined. The company has a budget of $5000 for implementing automation. The market demand for Product A is 500 units. So, the company can only sell a maximum of 500 units of Product A. The company must produce at least 200 units of Product B to meet contractual obligations.\nPlease help the company to determine the optimal production quantities and automation level to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0, ub=500) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=200, ub=1000) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=5000) # level of automation\n\n# Define objective function\nCost_A = 10 - 0.5 * Automation\nCost_B = 15 - 0.5 * Automation\nRevenue_A = 20 * QA\nRevenue_B = 25 * QB\nTotal_Cost = Cost_A * QA + Cost_B * QB\nTotal_Revenue = Revenue_A + Revenue_B\nProfit = Total_Revenue - Total_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QA + QB <= 1000)\nmodel.addCons(Automation <= 5000)\nmodel.addCons(QA <= 500)\nmodel.addCons(QB >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1069,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The revenue from component A: R_A = 50 * A\n// The revenue from component B: R_B = 70 * B\n// The revenue from component C: R_C = 60 * C\n// The production cost for component A: C_A = 0.01 * A^2\n// The production cost for component B: C_B = 0.02 * B^2\n// The production cost for component C: C_C = 0.015 * C^2\n// So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 100 units per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe availability of a critical raw material limits the production of component A to at most 50 units.\n// A <= 50\n\n## Generate Constraint-3:\nThe production of component B is limited by a specialized machine that can only handle up to 40 units per day.\n// B <= 40",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide how many units of each component to produce to maximize profit while considering the constraints on raw materials and production capacity. The profit from each unit of component A is $50, component B is $70, and component C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for A is 0.01 * A^2, for B is 0.02 * B^2, and for C is 0.015 * C^2. The total production capacity is limited to 100 units per day. The availability of a critical raw material limits the production of component A to at most 50 units. The production of component B is limited by a specialized machine that can only handle up to 40 units per day. Please help the company to maximize the total profit, which is the revenue minus the production cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## The revenue from component A: R_A = 50 * A\n## The revenue from component B: R_B = 70 * B\n## The revenue from component C: R_C = 60 * C\n## The production cost for component A: C_A = 0.01 * A^2\n## The production cost for component B: C_B = 0.02 * B^2\n## The production cost for component C: C_C = 0.015 * C^2\n## So, the objective function is: Maximize (R_A - C_A) + (R_B - C_B) + (R_C - C_C)\nR_A = 50 * A\nR_B = 70 * B\nR_C = 60 * C\nC_A = 0.01 * A**2\nC_B = 0.02 * B**2\nC_C = 0.015 * C**2\nProfit_A = R_A - C_A\nProfit_B = R_B - C_B\nProfit_C = R_C - C_C\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production capacity is limited to 100 units per day.\nmodel.addCons(A + B + C <= 100)\n## The availability of a critical raw material limits the production of component A to at most 50 units.\nmodel.addCons(A <= 50)\n## The production of component B is limited by a specialized machine that can only handle up to 40 units per day.\nmodel.addCons(B <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 921,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the crops require different amounts of water and fertilizer, which affects the overall profitability. Crop A requires 2 units of water and 1 unit of fertilizer per acre, crop B requires 3 units of water and 2 units of fertilizer per acre, and crop C requires 4 units of water and 3 units of fertilizer per acre. The farm aims to maximize the total profit per unit of resource used (water and fertilizer combined).\n// Profit per acre of A: Profit_A = 500 * A\n// Profit per acre of B: Profit_B = 700 * B\n// Profit per acre of C: Profit_C = 900 * C\n// Resource usage for A: Resource_A = 2 * A + 1 * A = 3 * A\n// Resource usage for B: Resource_B = 3 * B + 2 * B = 5 * B\n// Resource usage for C: Resource_C = 4 * C + 3 * C = 7 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of fertilizer available.\n// 1 * A + 2 * B + 3 * C <= 50\n\n## Generate Constraint-3:\nThe farm wants to allocate at least 5 acres to each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop. The profit per acre and the resource requirements (water and fertilizer) for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water per Acre | Fertilizer per Acre |\n|------|-----------------|----------------|----------------------|\n| A    | $500            | 2 units        | 1 unit               |\n| B    | $700            | 3 units        | 2 units              |\n| C    | $900            | 4 units        | 3 units              |\n\nThe farm has a total of 100 units of water available and 50 units of fertilizer available. The farm wants to allocate at least 5 acres to each crop. \nPlease help the farm to maximize the total profit per unit of resource used (water and fertilizer combined).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nResource_A = 3 * A\nResource_B = 5 * B\nResource_C = 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of fertilizer available.\nmodel.addCons(1 * A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to Product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * ProductA\n// Total profit for Product B: ProfitB = 70 * ProductB\n// Total profit for Product C: ProfitC = 60 * ProductC\n// The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product. The profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products. The total resources available are limited to 1000 units. Please help the manufacturer determine the optimal number of units of each product and the amount of resources allocated to each to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of Product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0) # resources allocated to Product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0) # resources allocated to Product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0) # resources allocated to Product C\n\n# Define objective function\nProfitA = 50 * ProductA\nProfitB = 70 * ProductB\nProfitC = 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Resources Allocated to Product A: \", model.getVal(ResourceA))\n    print(\"Resources Allocated to Product B: \", model.getVal(ResourceB))\n    print(\"Resources Allocated to Product C: \", model.getVal(ResourceC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer aims to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit_Corn = 300 * C - 100 * C\n// Profit_Wheat = 250 * W - 80 * W\n// Profit_Soybeans = 200 * S - 60 * S\n// So, the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / (500 * C + 400 * W + 300 * S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C + W + S <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10,000 for labor costs.\n// 100 * C + 80 * W + 60 * S <= 10000",
        "question": "A farmer grows three types of crops: Corn, Wheat, and Soybeans. The farmer needs to decide how many acres to dedicate to each crop.\nFor Corn, the profit per acre is $300, the water usage per acre is 500 gallons, and the labor cost per acre is $100. \nFor Wheat, the profit per acre is $250, the water usage per acre is 400 gallons, and the labor cost per acre is $80. \nFor Soybeans, the profit per acre is $200, the water usage per acre is 300 gallons, and the labor cost per acre is $60.\nThe farmer has a total of 100 acres available for cultivation. The farmer has a budget of $10,000 for labor costs.\nPlease help the farmer to maximize the profit per gallon of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Corn\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of Wheat\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Corn = (300 - 100) * C\nProfit_Wheat = (250 - 80) * W\nProfit_Soybeans = (200 - 60) * S\nWaterUsage = 500 * C + 400 * W + 300 * S\n## the objective function is: Maximize (Profit_Corn + Profit_Wheat + Profit_Soybeans) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_Corn + Profit_Wheat + Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C + W + S <= 100)\n## The farmer has a budget of $10,000 for labor costs.\nmodel.addCons(100 * C + 80 * W + 60 * S <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 757,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly as more acres are planted. Specifically, the profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops.\n// Profit_W = (100 - 0.001 * (W - 50) * W) * W\n// Profit_C = (150 - 0.001 * (C - 50) * C) * C\n// Profit_S = (120 - 0.001 * (S - 50) * S) * S\n// So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Generate Constraint-1:\nThe farm has a total of 200 acres available for planting.\n// W + C + S <= 200",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. However, due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops.\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $100            |\n| Corn     | $150            |\n| Soybeans | $120            |\n\nThe farm has a total of 200 acres available for planting. Please help the farm determine the optimal number of acres to allocate to each crop to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of Wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of Corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop\n## Profit_W = (100 - 0.001 * (W - 50) * W) * W\n## Profit_C = (150 - 0.001 * (C - 50) * C) * C\n## Profit_S = (120 - 0.001 * (S - 50) * S) * S\n## So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Convert the non-linear objective to a linear one using additional variables and constraints\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=50)\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=50, ub=200)\nW_b1 = model.addVar(vtype=\"B\", name=\"W_b1\")\nW_b2 = model.addVar(vtype=\"B\", name=\"W_b2\")\nmodel.addCons(W_b1 + W_b2 == 1)\nmodel.addCons(W == W1*W_b1 + W2*W_b2)\nProfit_W = (100 - 0.001 * (W1 - 50) * W1) * W1 * W_b1 + (100 - 0.001 * (W2 - 50) * W2) * W2 * W_b2\n\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=50, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (150 - 0.001 * (C1 - 50) * C1) * C1 * C_b1 + (150 - 0.001 * (C2 - 50) * C2) * C2 * C_b2\n\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=50)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=50, ub=200)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nProfit_S = (120 - 0.001 * (S1 - 50) * S1) * S1 * S_b1 + (120 - 0.001 * (S2 - 50) * S2) * S2 * S_b2\n\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\nmodel.addCons(W + C + S <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 835,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency.\n// {\"hours allocated to Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades. The initial production rate for each product is 100 units per hour. The company aims to maximize the total production output.\n// Production output for Product 1: P1 = (100 + 0.005 * Efficiency) * H1\n// Production output for Product 2: P2 = (100 + 0.005 * Efficiency) * H2\n// Production output for Product 3: P3 = (100 + 0.005 * Efficiency) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe investment in production efficiency upgrades cannot exceed $50,000.\n// Efficiency <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency. The production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades, with an initial production rate of 100 units per hour for each product. The company aims to maximize the total production output.\n\nThe company has a total of 168 hours available for production in a week. The investment in production efficiency upgrades cannot exceed $50,000.\n\nPlease help the company determine the optimal allocation of hours to each product type (Product 1, Product 2, Product 3) and the optimal investment in production efficiency to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0) # hours allocated to Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=0) # hours allocated to Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=0) # hours allocated to Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\nP1 = (100 + 0.005 * Efficiency) * H1\nP2 = (100 + 0.005 * Efficiency) * H2\nP3 = (100 + 0.005 * Efficiency) * H3\n# So, the objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total available hours for production in a week is 168 hours.\nmodel.addCons(H1 + H2 + H3 <= 168)\n# The investment in production efficiency upgrades cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Investment in production efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 864,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the amount of money to invest in improving the production efficiency of each product.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency for product A\": \"EfficiencyA\", \"range\": \"EfficiencyA >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency for product B\": \"EfficiencyB\", \"range\": \"EfficiencyB >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency for product C\": \"EfficiencyC\", \"range\": \"EfficiencyC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost of each product decreases by $5 for every $1,000 invested in efficiency improvements. The initial production cost for product A is $100, for product B is $150, and for product C is $200. The selling price for each product is $200. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (200 - (100 - 0.005 * EfficiencyA)) * ProductA\n// Total profit for product B: ProfitB = (200 - (150 - 0.005 * EfficiencyB)) * ProductB\n// Total profit for product C: ProfitC = (200 - (200 - 0.005 * EfficiencyC)) * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total investment in production efficiency improvements cannot exceed $100,000.\n// EfficiencyA + EfficiencyB + EfficiencyC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity limit of 10,000 units for product A, 8,000 units for product B, and 5,000 units for product C.\n// ProductA <= 10000\n// ProductB <= 8000\n// ProductC <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the amount of money to invest in improving the production efficiency of each product. The production cost of each product decreases by $5 for every $1,000 invested in efficiency improvements. The initial production cost for product A is $100, for product B is $150, and for product C is $200. The selling price for each product is $200. The company aims to maximize the total profit from all products. The total investment in production efficiency improvements cannot exceed $100,000. The company has a production capacity limit of 10,000 units for product A, 8,000 units for product B, and 5,000 units for product C.\nPlease help the company determine the optimal production quantity and investment in efficiency improvements for each product to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # quantity of product C\nEfficiencyA = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyA\", lb=0)  # investment in production efficiency for product A\nEfficiencyB = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyB\", lb=0)  # investment in production efficiency for product B\nEfficiencyC = model.addVar(vtype=\"CONTINUOUS\", name=\"EfficiencyC\", lb=0)  # investment in production efficiency for product C\n\n# Define objective function\nProfitA = (200 - (100 - 0.005 * EfficiencyA)) * ProductA\nProfitB = (200 - (150 - 0.005 * EfficiencyB)) * ProductB\nProfitC = (200 - (200 - 0.005 * EfficiencyC)) * ProductC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EfficiencyA + EfficiencyB + EfficiencyC <= 100000)\nmodel.addCons(ProductA <= 10000)\nmodel.addCons(ProductB <= 8000)\nmodel.addCons(ProductC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Efficiency A: \", model.getVal(EfficiencyA))\n    print(\"Investment in Efficiency B: \", model.getVal(EfficiencyB))\n    print(\"Investment in Efficiency C: \", model.getVal(EfficiencyC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, but it requires 2 units of water per acre. \nFor crop B, the profit per acre is $700, requiring 3 units of water per acre. \nFor crop C, the profit per acre is $1000, requiring 4 units of water per acre.\nThe farm has a limited water supply and must balance the use of water with the desire to maximize profits. The objective is to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 1000 * C\n// Water usage for crops: Water_A = 2 * A, Water_B = 3 * B, Water_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a water supply of 300 units.\n// 2 * A + 3 * B + 4 * C <= 300",
        "question": "A farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands.\nThe profit per acre for crop A is $500, but it requires 2 units of water per acre. \nFor crop B, the profit per acre is $700, requiring 3 units of water per acre. \nFor crop C, the profit per acre is $1000, requiring 4 units of water per acre.\nThe farm has a limited water supply and must balance the use of water with the desire to maximize profits. The objective is to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\nThe farm has a total of 100 acres available for cultivation. The farm also has a water supply of 300 units.\nPlease help the farmer to maximize the total profit while considering the water usage efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a water supply of 300 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to allocate land for three different crops: A, B, and C. The farm needs to determine the area of land to allocate to each crop to optimize its profit and resource usage.\n// {\"area of land for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area of land for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area of land for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $500, for crop B is $700, and for crop C is $900. The water usage per hectare for crop A is 2 units, for crop B is 3 units, and for crop C is 4 units. The farm aims to maximize the profit per unit of water used (which is defined as the sum of the profits divided by the sum of the water usage).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 900 * C\n// Water usage for crop A: Water_A = 2 * A\n// Water usage for crop B: Water_B = 3 * B\n// Water usage for crop C: Water_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe total available land for all crops is 100 hectares.\n// A + B + C <= 100",
        "question": "A farm is planning to allocate land for three different crops: A, B, and C. The farm needs to determine the area of land to allocate to each crop to optimize its profit and resource usage. The profit per hectare for crop A is $500, for crop B is $700, and for crop C is $900. The water usage per hectare for crop A is 2 units, for crop B is 3 units, and for crop C is 4 units. The farm aims to maximize the profit per unit of water used (which is defined as the sum of the profits divided by the sum of the water usage). The total available land for all crops is 100 hectares. Please help the farm determine the optimal allocation of land to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area of land for crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for all crops is 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for crop A: \", model.getVal(A))\n    print(\"Area of land for crop B: \", model.getVal(B))\n    print(\"Area of land for crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 652,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\n// WheatAcres >= 30\n\n## Generate Constraint-4:\nThe farmer has a budget constraint for seed and fertilizer, which is $15,000. The cost per acre for Wheat is $150, for Corn is $200, and for Soybeans is $180.\n// 150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The environmental impact costs are $50 per acre for Wheat, $70 per acre for Corn, and $60 per acre for Soybeans. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost. The farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. The farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation. The farmer has a budget constraint for seed and fertilizer, which is $15,000, with costs per acre of $150 for Wheat, $200 for Corn, and $180 for Soybeans. Please help the farmer to maximize the net profit per acre, considering both financial profit and environmental cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=30) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n## The farmer has a budget constraint for seed and fertilizer, which is $15,000.\nmodel.addCons(150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1044,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\n// {\"number of acres for CropA\": \"AcresA\", \"range\": \"AcresA >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropB\": \"AcresB\", \"range\": \"AcresB >= 0\", \"type\": \"integer\"}\n// {\"number of acres for CropC\": \"AcresC\", \"range\": \"AcresC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\n// Net profit for CropA: Profit_A = (500 - 100) * AcresA\n// Net profit for CropB: Profit_B = (700 - 150) * AcresB\n// Net profit for CropC: Profit_C = (900 - 200) * AcresC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2000 * AcresA + 3000 * AcresB + 4000 * AcresC)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// AcresA + AcresB + AcresC <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, CropA must be planted on at least twice as many acres as CropB.\n// AcresA >= 2 * AcresB",
        "question": "A farm is planning to cultivate three types of crops: CropA, CropB, and CropC. The farm needs to decide how many acres to allocate to each crop to optimize its operations.\nFor CropA, the expected profit per acre is $500, the water usage per acre is 2000 gallons, and the labor cost per acre is $100. \nFor CropB, the expected profit per acre is $700, the water usage per acre is 3000 gallons, and the labor cost per acre is $150. \nFor CropC, the expected profit per acre is $900, the water usage per acre is 4000 gallons, and the labor cost per acre is $200.\nThe farm aims to maximize the net profit per gallon of water used.\nThe farm has a total of 100 acres available for cultivation. Due to soil conditions, CropA must be planted on at least twice as many acres as CropB.\nPlease help the farm determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAcresA = model.addVar(vtype=\"INTEGER\", name=\"AcresA\", lb=0) # number of acres for CropA\nAcresB = model.addVar(vtype=\"INTEGER\", name=\"AcresB\", lb=0) # number of acres for CropB\nAcresC = model.addVar(vtype=\"INTEGER\", name=\"AcresC\", lb=0) # number of acres for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * AcresA\nProfit_B = (700 - 150) * AcresB\nProfit_C = (900 - 200) * AcresC\nWaterUsage = 2000 * AcresA + 3000 * AcresB + 4000 * AcresC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(AcresA + AcresB + AcresC <= 100)\n## Due to soil conditions, CropA must be planted on at least twice as many acres as CropB.\nmodel.addCons(AcresA >= 2 * AcresB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for CropA: \", model.getVal(AcresA))\n    print(\"Number of Acres for CropB: \", model.getVal(AcresB))\n    print(\"Number of Acres for CropC: \", model.getVal(AcresC))\n    print(\"Maximized Net Profit per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer aims to maximize the profit per unit of energy consumed.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe manufacturer has a total energy limit of 1000 kWh for production.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit. The selling price, production cost, and energy consumption for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Energy Consumption (kWh) |\n|--------|---------------|-----------------|--------------------------|\n| A      | 100$          | 50$             | 2                        |\n| B      | 150$          | 70$             | 3                        |\n| C      | 200$          | 90$             | 4                        |\n\nThe manufacturer has a budget of $10,000 for production costs. The manufacturer wants to produce at least 50 units of each device. The manufacturer has a total energy limit of 1000 kWh for production. \nPlease help the manufacturer to maximize the profit per unit of energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nEnergyConsumption = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / EnergyConsumption\n## convert the division to multiplication\nmodel.addCons(obj * EnergyConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The manufacturer has a total energy limit of 1000 kWh for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer aims to maximize the profit per unit of resource used (either water or labor). The objective is to maximize the ratio of total profit to the sum of water and labor used.\n// Profit from A: Profit_A = 300 * A\n// Profit from B: Profit_B = 400 * B\n// Profit from C: Profit_C = 500 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 10,000 liters of water available for irrigation.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farmer has a total of 500 hours of labor available.\n// 5 * A + 8 * B + 10 * C <= 500",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. The expected profit per acre, water requirement, and labor requirement for each crop are given in the following Table.\n\n| Crop | Expected Profit per Acre | Water Requirement per Acre | Labor Requirement per Acre |\n|------|--------------------------|----------------------------|----------------------------|\n| A    | $300                     | 200 liters                 | 5 hours                    |\n| B    | $400                     | 300 liters                 | 8 hours                    |\n| C    | $500                     | 400 liters                 | 10 hours                   |\n\nThe farmer has a total of 10,000 liters of water available for irrigation. The farmer also has a total of 500 hours of labor available. \n\nPlease help the farmer to maximize the profit per unit of resource used (either water or labor), which is defined as the ratio of total profit to the sum of water and labor used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 300 * A\nProfit_B = 400 * B\nProfit_C = 500 * C\nResourceUsage = 200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 10,000 liters of water available for irrigation.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The farmer has a total of 500 hours of labor available.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1041,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand.\n// {\"quantity of Phone\": \"Phone\", \"range\": \"Phone >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"Tablet\", \"range\": \"Tablet >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"Laptop\", \"range\": \"Laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Phone is $100, for Tablet is $200, and for Laptop is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from selling these devices.\n// Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\n// Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\n// Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\n// So, the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. The Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g of this metal. The total available supply of this rare metal is 2000 g.\n// 5 * Phone + 8 * Tablet + 10 * Laptop <= 2000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units.\n// Phone <= 500; Tablet <= 400; Laptop <= 300\n\n## Generate Constraint-3:\nThe company has a production capacity of 1000 units in terms of the total number of devices it can produce.\n// Phone + Tablet + Laptop <= 1000\n\n## Generate Constraint-4:\nThe company must produce at least 100 units of each device to maintain its market presence and customer loyalty.\n// Phone >= 100; Tablet >= 100; Laptop >= 100",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. The company needs to determine the production quantities of each device to maximize profit while considering the constraints of raw materials and market demand. The profit per unit for Phone is $100, for Tablet is $200, and for Laptop is $300. Due to economies of scale, the profit per unit increases by $0.5 for each device type when the production quantity exceeds 100 units. The production of each device requires a specific amount of a rare metal: the Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g, with a total available supply of 2000 g. The market has a demand limit for each device: the demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units. The company has a production capacity of 1000 units in terms of the total number of devices it can produce. The company must also produce at least 100 units of each device to maintain its market presence and customer loyalty. Please help the company to maximize the total profit from selling these devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 100 units of each device to maintain its market presence and customer loyalty.\nPhone = model.addVar(vtype=\"INTEGER\", name=\"Phone\", lb=100) # quantity of Phone\nTablet = model.addVar(vtype=\"INTEGER\", name=\"Tablet\", lb=100) # quantity of Tablet\nLaptop = model.addVar(vtype=\"INTEGER\", name=\"Laptop\", lb=100) # quantity of Laptop\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Phone = max(100 + 0.5 * (Phone - 100), 100) * Phone\nPhone1 = model.addVar(vtype=\"INTEGER\", name=\"Phone1\", lb=0, ub=100)\nPhone2 = model.addVar(vtype=\"INTEGER\", name=\"Phone2\", lb=100, ub=500)\nPhone_b1 = model.addVar(vtype=\"B\", name=\"Phone_b1\")\nPhone_b2 = model.addVar(vtype=\"B\", name=\"Phone_b2\")\nmodel.addCons(Phone_b1 + Phone_b2 == 1)\nmodel.addCons(Phone == Phone1*Phone_b1 + Phone2*Phone_b2)\nProfit_Phone = 100 * Phone1 * Phone_b1 + (100 + 0.5 * (Phone2 - 100)) * Phone2 * Phone_b2\n## create piecewise variables for piecewise function: Profit_Tablet = max(200 + 0.5 * (Tablet - 100), 200) * Tablet\nTablet1 = model.addVar(vtype=\"INTEGER\", name=\"Tablet1\", lb=0, ub=100)\nTablet2 = model.addVar(vtype=\"INTEGER\", name=\"Tablet2\", lb=100, ub=400)\nTablet_b1 = model.addVar(vtype=\"B\", name=\"Tablet_b1\")\nTablet_b2 = model.addVar(vtype=\"B\", name=\"Tablet_b2\")\nmodel.addCons(Tablet_b1 + Tablet_b2 == 1)\nmodel.addCons(Tablet == Tablet1*Tablet_b1 + Tablet2*Tablet_b2)\nProfit_Tablet = 200 * Tablet1 * Tablet_b1 + (200 + 0.5 * (Tablet2 - 100)) * Tablet2 * Tablet_b2\n## create piecewise variables for piecewise function: Profit_Laptop = max(300 + 0.5 * (Laptop - 100), 300) * Laptop\nLaptop1 = model.addVar(vtype=\"INTEGER\", name=\"Laptop1\", lb=0, ub=100)\nLaptop2 = model.addVar(vtype=\"INTEGER\", name=\"Laptop2\", lb=100, ub=300)\nLaptop_b1 = model.addVar(vtype=\"B\", name=\"Laptop_b1\")\nLaptop_b2 = model.addVar(vtype=\"B\", name=\"Laptop_b2\")\nmodel.addCons(Laptop_b1 + Laptop_b2 == 1)\nmodel.addCons(Laptop == Laptop1*Laptop_b1 + Laptop2*Laptop_b2)\nProfit_Laptop = 300 * Laptop1 * Laptop_b1 + (300 + 0.5 * (Laptop2 - 100)) * Laptop2 * Laptop_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Phone + Profit_Tablet + Profit_Laptop\nmodel.addCons(obj == Profit_Phone + Profit_Tablet + Profit_Laptop)\n\n# Add constraints\n## The production of each device requires a specific amount of a rare metal. The Phone requires 5 g, the Tablet requires 8 g, and the Laptop requires 10 g of this metal. The total available supply of this rare metal is 2000 g.\nmodel.addCons(5 * Phone + 8 * Tablet + 10 * Laptop <= 2000)\n## The market has a demand limit for each device. The demand limit for Phone is 500 units, for Tablet is 400 units, and for Laptop is 300 units.\nmodel.addCons(Phone <= 500)\nmodel.addCons(Tablet <= 400)\nmodel.addCons(Laptop <= 300)\n## The company has a production capacity of 1000 units in terms of the total number of devices it can produce.\nmodel.addCons(Phone + Tablet + Laptop <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(Phone))\n    print(\"Quantity of Tablet: \", model.getVal(Tablet))\n    print(\"Quantity of Laptop: \", model.getVal(Laptop))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"amount of raw materials to stock\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for automation upgrades.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 10,000 units.\n// Units <= 10000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock. The cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production. The company has a budget of $50,000 for automation upgrades, and the total number of units produced must not exceed 10,000 units. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0)  # amount of raw materials to stock\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * Automation) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(Units <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Amount of Raw Materials to Stock: \", model.getVal(RawMaterials))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 663,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from device A: Revenue_A = 50 * A\n// Revenue from device B: Revenue_B = 70 * B\n// Revenue from device C: Revenue_C = 90 * C\n// Production cost for device A: Cost_A = 0.01 * A^2\n// Production cost for device B: Cost_B = 0.02 * B^2\n// Production cost for device C: Cost_C = 0.03 * C^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for device A is at least 200 units per week, and for device B is at least 150 units per week.\n// A >= 200; B >= 150",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine how many units of each device to produce to optimize their profit margin while considering the production capacity and market demand.\nThe profit per unit for device A is $50, for device B is $70, and for device C is $90. The production cost for device A is modeled as 0.01 * A^2, for device B as 0.02 * B^2, and for device C as 0.03 * C^2. The company aims to maximize the total profit, which is the difference between the revenue and the production cost.\nThe total production capacity of the factory is limited to 1000 units per week. The market demand for device A is at least 200 units per week, and for device B is at least 150 units per week.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 90 * C\nCost_A = 0.01 * A**2\nCost_B = 0.02 * B**2\nCost_C = 0.03 * C**2\n## the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## The total production capacity of the factory is limited to 1000 units per week.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 804,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from barley: Profit_B = 150 * B\n// Total water used: Water_Total = 5 * W + 8 * C + 3 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (5 * W + 8 * C + 3 * B)\n\n## Generate Constraint-1:\nThe farmer has a total of 1000 units of water available for irrigation.\n// 5 * W + 8 * C + 3 * B <= 1000\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to each crop to maintain the quality of the land.\n// W >= 20; C >= 20; B >= 20",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage. The profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used). The farmer has a total of 1000 units of water available for irrigation. The farmer must allocate at least 20 acres to each crop to maintain the quality of the land. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 20 acres to each crop to maintain the quality of the land.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_B = 150 * B\nWater_Total = 5 * W + 8 * C + 3 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 1000 units of water available for irrigation.\nmodel.addCons(5 * W + 8 * C + 3 * B <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 722,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceA_qty\", \"range\": \"DeviceA_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceB_qty\", \"range\": \"DeviceB_qty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceC_qty\", \"range\": \"DeviceC_qty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the quantity produced, following a quadratic function. The cost function for DeviceA is 0.01 * (DeviceA_qty)^2 + 20, for DeviceB is 0.015 * (DeviceB_qty)^2 + 30, and for DeviceC is 0.02 * (DeviceC_qty)^2 + 40. The company wants to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for all devices combined.\n// DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC.\n// DeviceA_qty >= 0.5 * (DeviceB_qty + DeviceC_qty)\n\n## Generate Constraint-3:\nThe company has a budget of $50,000 for production costs.\n// (0.01 * (DeviceA_qty)^2 + 20) * DeviceA_qty + (0.015 * (DeviceB_qty)^2 + 30) * DeviceB_qty + (0.02 * (DeviceC_qty)^2 + 40) * DeviceC_qty <= 50,000",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit and the production cost per unit for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|---------------------------|\n| DeviceA | $50 | 0.01 * (DeviceA_qty)^2 + 20 |\n| DeviceB | $70 | 0.015 * (DeviceB_qty)^2 + 30 |\n| DeviceC | $90 | 0.02 * (DeviceC_qty)^2 + 40 |\n\nThe company has a total production capacity of 1000 units for all devices combined. Due to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC. The company has a budget of $50,000 for production costs. \n\nPlease help the company to maximize the total net profit, which is calculated as the profit per unit minus the production cost per unit, multiplied by the production quantity for each device, and summed across all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_qty\", lb=0)\nDeviceB_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_qty\", lb=0)\nDeviceC_qty = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_qty\", lb=0)\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (0.01 * (DeviceA_qty)^2 + 20)) * DeviceA_qty\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (0.015 * (DeviceB_qty)^2 + 30)) * DeviceB_qty\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (0.02 * (DeviceC_qty)^2 + 40)) * DeviceC_qty\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (0.01 * DeviceA_qty**2 + 20)) * DeviceA_qty\nProfit_DeviceB = (70 - (0.015 * DeviceB_qty**2 + 30)) * DeviceB_qty\nProfit_DeviceC = (90 - (0.02 * DeviceC_qty**2 + 40)) * DeviceC_qty\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for all devices combined.\nmodel.addCons(DeviceA_qty + DeviceB_qty + DeviceC_qty <= 1000)\n## Due to market demand, the production of DeviceA must be at least half of the combined production of DeviceB and DeviceC.\nmodel.addCons(DeviceA_qty >= 0.5 * (DeviceB_qty + DeviceC_qty))\n## The company has a budget of $50,000 for production costs.\nmodel.addCons((0.01 * DeviceA_qty**2 + 20) * DeviceA_qty + (0.015 * DeviceB_qty**2 + 30) * DeviceB_qty + (0.02 * DeviceC_qty**2 + 40) * DeviceC_qty <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceA_qty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceB_qty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceC_qty))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Initial Production Cost per Unit | Selling Price per Unit |\n|---------|---------------------------------|------------------------|\n| A       | $50                             | $80                    |\n| B       | $60                             | $90                    |\n| C       | $70                             | $100                   |\n\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The company has a budget of $50,000 for investment in energy efficiency. The company aims to maximize the total profit from all products. Please help the company determine the optimal production quantities for products A, B, and C, and the amount to invest in energy efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(EnergyEfficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1120,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints.\n// {\"production rate of ChemX\": \"ChemXRate\", \"range\": \"ChemXRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemY\": \"ChemYRate\", \"range\": \"ChemYRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemZ\": \"ChemZRate\", \"range\": \"ChemZRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, ChemY is $150, and ChemZ is $200. The production cost per unit of ChemX is $50, ChemY is $70, and ChemZ is $100. The company wants to maximize the total profit.\n// Profit_ChemX = (100 - 50) * ChemXRate\n// Profit_ChemY = (150 - 70) * ChemYRate\n// Profit_ChemZ = (200 - 100) * ChemZRate\n// So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per hour.\n// ChemXRate + ChemYRate + ChemZRate <= 100",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints. The profit per unit and production cost per unit for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Cost per Unit |\n|----------|-----------------|--------------------------|\n| ChemX    | $100            | $50                      |\n| ChemY    | $150            | $70                      |\n| ChemZ    | $200            | $100                     |\n\nThe company wants to maximize the total profit. The total production capacity of the company is limited to 100 units per hour. Please help the company determine the optimal production rates for ChemX, ChemY, and ChemZ.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemXRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemXRate\", lb=0) # production rate of ChemX\nChemYRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemYRate\", lb=0) # production rate of ChemY\nChemZRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemZRate\", lb=0) # production rate of ChemZ\n\n# Define objective function\nProfit_ChemX = (100 - 50) * ChemXRate\nProfit_ChemY = (150 - 70) * ChemYRate\nProfit_ChemZ = (200 - 100) * ChemZRate\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n# Add constraints\nmodel.addCons(ChemXRate + ChemYRate + ChemZRate <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemX: \", model.getVal(ChemXRate))\n    print(\"Production Rate of ChemY: \", model.getVal(ChemYRate))\n    print(\"Production Rate of ChemZ: \", model.getVal(ChemZRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component involves different costs and profits. Component A has a production cost of $20 and a selling price of $30. Component B has a production cost of $25 and a selling price of $35. Component C has a production cost of $30 and a selling price of $40. The production time for each unit of A, B, and C is 1 hour, 2 hours, and 3 hours, respectively. The company aims to maximize the profit-to-production time ratio.\n// Profit of A: Profit_A = (30 - 20) * A\n// Profit of B: Profit_B = (35 - 25) * B\n// Profit of C: Profit_C = (40 - 30) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 20 * A + 25 * B + 30 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a production capacity of 500 hours.\n// A + 2 * B + 3 * C <= 500",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize efficiency and profit. The production cost, selling price, and production time for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Production Time |\n|-----------|-----------------|---------------|-----------------|\n| A         | $20             | $30           | 1 hour          |\n| B         | $25             | $35           | 2 hours         |\n| C         | $30             | $40           | 3 hours         |\n\nThe company has a budget of $10,000 for production costs. The company has a production capacity of 500 hours. Please help the company to maximize the profit-to-production time ratio.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 - 20) * A\nProfit_B = (35 - 25) * B\nProfit_C = (40 - 30) * C\nProductionTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 10000)\n## The company has a production capacity of 500 hours.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Production Time Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects.\n// {\"dosage level of DrugA\": \"DosageA\", \"range\": \"0 <= DosageA <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugB\": \"DosageB\", \"range\": \"0 <= DosageB <= 100\", \"type\": \"real\"}\n// {\"dosage level of DrugC\": \"DosageC\", \"range\": \"0 <= DosageC <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. \nThe effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. \nThe effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. \nThe company wants to maximize the total effectiveness of the drugs.\n// So, the objective function is: Maximize (EffectivenessA + EffectivenessB + EffectivenessC)\n\n## Generate Constraint-1:\nThe total dosage across all drugs must not exceed 150 units to ensure safety.\n// DosageA + DosageB + DosageC <= 150\n\n## Generate Constraint-2:\nDue to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB.\n// DosageA >= 2 * DosageB",
        "question": "A pharmaceutical company is developing three new drugs: DrugA, DrugB, and DrugC. They need to determine the optimal dosage levels for each drug to maximize the combined effectiveness while minimizing potential side effects. The effectiveness of DrugA is modeled as a quadratic function: EffectivenessA = 50 * DosageA - 0.5 * DosageA^2. The effectiveness of DrugB is modeled as a cubic function: EffectivenessB = 60 * DosageB - 0.3 * DosageB^3. The effectiveness of DrugC is modeled as a quartic function: EffectivenessC = 70 * DosageC - 0.2 * DosageC^4. The company wants to maximize the total effectiveness of the drugs. The total dosage across all drugs must not exceed 150 units to ensure safety. Due to interactions between the drugs, the dosage of DrugA must be at least twice the dosage of DrugB. Please help the company to determine the optimal dosage levels for each drug.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDosageA = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageA\", lb=0, ub=100) # dosage level of DrugA\nDosageB = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageB\", lb=0, ub=100) # dosage level of DrugB\nDosageC = model.addVar(vtype=\"CONTINUOUS\", name=\"DosageC\", lb=0, ub=100) # dosage level of DrugC\n\n# Define objective function\nEffectivenessA = 50 * DosageA - 0.5 * DosageA**2\nEffectivenessB = 60 * DosageB - 0.3 * DosageB**3\nEffectivenessC = 70 * DosageC - 0.2 * DosageC**4\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == EffectivenessA + EffectivenessB + EffectivenessC)\n\n# Add constraints\nmodel.addCons(DosageA + DosageB + DosageC <= 150)\nmodel.addCons(DosageA >= 2 * DosageB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Dosage Level of DrugA: \", model.getVal(DosageA))\n    print(\"Dosage Level of DrugB: \", model.getVal(DosageB))\n    print(\"Dosage Level of DrugC: \", model.getVal(DosageC))\n    print(\"Maximized Total Effectiveness: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost per acre is $500, and the water usage per acre is 5000 gallons. \nFor Crop B, the expected revenue per acre is $1500, the cost per acre is $700, and the water usage per acre is 7000 gallons. \nFor Crop C, the expected revenue per acre is $2000, the cost per acre is $900, and the water usage per acre is 9000 gallons.\nThe farm aims to maximize the net revenue per gallon of water used (which is defined as the sum of the net revenues divided by the sum of the water usages).\n// Net revenue of A: Net_Revenue_A = (1000 - 500) * A\n// Net revenue of B: Net_Revenue_B = (1500 - 700) * B\n// Net revenue of C: Net_Revenue_C = (2000 - 900) * C\n// So, the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for costs this season.\n// 500 * A + 700 * B + 900 * C <= 100000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 10 acres to each crop this season.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season. The expected revenue per acre, cost per acre, and water usage per acre for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Acre | Cost per Acre | Water Usage per Acre |\n|------|---------------------------|---------------|----------------------|\n| A    | $1000                     | $500          | 5000 gallons         |\n| B    | $1500                     | $700          | 7000 gallons         |\n| C    | $2000                     | $900          | 9000 gallons         |\n\nThe farm has a budget of $100,000 for costs this season. The farm wants to allocate at least 10 acres to each crop this season. Please help the farm to maximize the net revenue per gallon of water used (which is defined as the sum of the net revenues divided by the sum of the water usages).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 10 acres to each crop this season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_A = (1000 - 500) * A\nNet_Revenue_B = (1500 - 700) * B\nNet_Revenue_C = (2000 - 900) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_Revenue_A + Net_Revenue_B + Net_Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for costs this season.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Gallon of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, but it requires 2 units of water per acre. \nFor crop B, the profit per acre is $700, requiring 3 units of water per acre. \nFor crop C, the profit per acre is $1000, requiring 4 units of water per acre.\nThe farm has a limited water supply and must balance the use of water with the desire to maximize profits. The objective is to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 1000 * C\n// Water usage for crops: Water_A = 2 * A, Water_B = 3 * B, Water_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a water supply of 300 units.\n// 2 * A + 3 * B + 4 * C <= 300\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 10 acres are dedicated to each crop to maintain crop diversity and soil health.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| A    | $500            | 2 units                 |\n| B    | $700            | 3 units                 |\n| C    | $1000           | 4 units                 |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a water supply of 300 units. The farmer wants to ensure at least 10 acres are dedicated to each crop to maintain crop diversity and soil health. \nPlease help the farmer to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 10 acres are dedicated to each crop to maintain crop diversity and soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a water supply of 300 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the farmer also knows that the more acres of a single crop are planted, the less efficient the farming becomes. Specifically, for every additional acre of a crop, the profit per acre decreases by 0.1% for that crop. The farmer aims to maximize the total profit from all crops.\n// Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n// Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n// Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n// So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer must plant at least 10 acres of each crop to maintain soil health.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-3:\nDue to market demand, the farmer must plant at least 30 acres of crop A.\n// A >= 30\n\n## Generate Constraint-4:\nThe farmer has a limited budget and can only afford to plant a maximum of 50 acres of crop B.\n// B <= 50",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The farmer estimates that crop A will yield a profit of $100 per acre, crop B will yield a profit of $150 per acre, and crop C will yield a profit of $200 per acre. However, the more acres of a single crop are planted, the less efficient the farming becomes, with the profit per acre decreasing by 0.1% for each additional acre of that crop. The farmer aims to maximize the total profit from all crops.\n\n| Crop | Profit per Acre |\n|------|-----------------|\n| A    | $100            |\n| B    | $150            |\n| C    | $200            |\n\nThe farmer has a total of 100 acres available for planting. The farmer must plant at least 10 acres of each crop to maintain soil health. Due to market demand, the farmer must plant at least 30 acres of crop A. The farmer has a limited budget and can only afford to plant a maximum of 50 acres of crop B.\n\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 acres of each crop to maintain soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=50) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\n\n# Define objective function\n## Profit per acre of crop A: P_A = 100 * (1 - 0.001 * A)\n## Profit per acre of crop B: P_B = 150 * (1 - 0.001 * B)\n## Profit per acre of crop C: P_C = 200 * (1 - 0.001 * C)\n## So, the objective function is: Maximize (P_A * A + P_B * B + P_C * C)\nP_A = 100 * (1 - 0.001 * A)\nP_B = 150 * (1 - 0.001 * B)\nP_C = 200 * (1 - 0.001 * C)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A * A + P_B * B + P_C * C)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n## Due to market demand, the farmer must plant at least 30 acres of crop A.\nmodel.addCons(A >= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1087,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe company has a total of 150 hours available for production.\n// 3 * A + 4 * B + 5 * C <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 3 hours         |\n| B       | 30$           | 15$           | 4 hours         |\n| C       | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. The company has a total of 150 hours available for production. \nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The company has a total of 150 hours available for production.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25\n\n## Generate Constraint-3:\nTo ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n// TruckB >= 0.5 * TruckA\n\n## Generate Constraint-4:\nThe company wants to ensure that each warehouse has at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A. The company wants to ensure that each warehouse has at least one truck assigned.\nPlease help the company to determine the optimal number of trucks to allocate to each warehouse to minimize the total fuel consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that each warehouse has at least one truck assigned.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1) # number of trucks for Warehouse C\n\n# Define objective function\n## The company aims to minimize the total fuel consumption of all trucks.\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n## So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n## To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\nmodel.addCons(TruckB >= 0.5 * TruckA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1060,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency.\n// {\"number of workers on production line 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nOn production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. \nOn production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. \nOn production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. \nThe company aims to maximize the total production of all components. The production efficiency is affected by the number of workers assigned to each line, and the relationship is nonlinear.\n// The total production of resistors: P_res = 10 * R1^2 + 8 * R2^2 + 6 * R3^2\n// The total production of capacitors: P_cap = 5 * R1^2 + 7 * R2^2 + 9 * R3^2\n// The total production of inductors: P_ind = 3 * R1^2 + 4 * R2^2 + 5 * R3^2\n// The objective function is: Maximize P_total = P_res + P_cap + P_ind\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// R1 + R2 + R3 <= 50\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 20 workers.\n// R1 <= 20; R2 <= 20; R3 <= 20\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of resistors, 400 units of capacitors, and 300 units of inductors daily.\n// 10 * R1^2 + 8 * R2^2 + 6 * R3^2 >= 500\n// 5 * R1^2 + 7 * R2^2 + 9 * R3^2 >= 400\n// 3 * R1^2 + 4 * R2^2 + 5 * R3^2 >= 300",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines and needs to determine the number of workers to assign to each line to optimize production efficiency. On production line 1, each worker can produce 10 units of resistors, 5 units of capacitors, and 3 units of inductors per hour. On production line 2, each worker can produce 8 units of resistors, 7 units of capacitors, and 4 units of inductors per hour. On production line 3, each worker can produce 6 units of resistors, 9 units of capacitors, and 5 units of inductors per hour. The company aims to maximize the total production of all components. The company has a total of 50 workers available and each production line can be staffed by up to 20 workers. Additionally, the company must produce at least 500 units of resistors, 400 units of capacitors, and 300 units of inductors daily. Please help the company to maximize the total production of all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"INTEGER\", name=\"R1\", lb=0, ub=20) # number of workers on production line 1\nR2 = model.addVar(vtype=\"INTEGER\", name=\"R2\", lb=0, ub=20) # number of workers on production line 2\nR3 = model.addVar(vtype=\"INTEGER\", name=\"R3\", lb=0, ub=20) # number of workers on production line 3\n\n# Define objective function\nP_res = 10 * R1**2 + 8 * R2**2 + 6 * R3**2\nP_cap = 5 * R1**2 + 7 * R2**2 + 9 * R3**2\nP_ind = 3 * R1**2 + 4 * R2**2 + 5 * R3**2\nP_total = P_res + P_cap + P_ind\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 <= 50)\nmodel.addCons(10 * R1**2 + 8 * R2**2 + 6 * R3**2 >= 500)\nmodel.addCons(5 * R1**2 + 7 * R2**2 + 9 * R3**2 >= 400)\nmodel.addCons(3 * R1**2 + 4 * R2**2 + 5 * R3**2 >= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on production line 1: \", model.getVal(R1))\n    print(\"Number of workers on production line 2: \", model.getVal(R2))\n    print(\"Number of workers on production line 3: \", model.getVal(R3))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1024,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse and the number of trucks allocated. \nAt warehouse 1, each truck incurs a cost of $500 per day, plus an additional $10 for each additional truck beyond the first. \nAt warehouse 2, each truck costs $600 per day, plus an additional $15 for each additional truck beyond the first. \nAt warehouse 3, each truck costs $700 per day, plus an additional $20 for each additional truck beyond the first. \nThe company aims to minimize the total daily transportation cost.\n// The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n// The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n// The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n// So, the objective function is: Minimize (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available for allocation.\n// T1 + T2 + T3 <= 30",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines.\nAt warehouse 1, each truck incurs a cost of $500 per day, plus an additional $10 for each additional truck beyond the first. \nAt warehouse 2, each truck costs $600 per day, plus an additional $15 for each additional truck beyond the first. \nAt warehouse 3, each truck costs $700 per day, plus an additional $20 for each additional truck beyond the first. \nThe company has a total of 30 trucks available for allocation.\nPlease help the company to minimize the total daily transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n## Convert the quadratic term to a linear term\nC1 = 500 * T1 + 10 * (T1**2 - 2*T1 + 1)\n## The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n## Convert the quadratic term to a linear term\nC2 = 600 * T2 + 15 * (T2**2 - 2*T2 + 1)\n## The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n## Convert the quadratic term to a linear term\nC3 = 700 * T3 + 20 * (T3**2 - 2*T3 + 1)\n\n## So, the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The company has a total of 30 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Minimized Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 713,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company aims to maximize the total profit from both products.\n// Profit_A = (100 - (60 - 2 * Automation)) * ProductA\n// Profit_B = (150 - (80 - 3 * Automation)) * ProductB\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for both products combined.\n// ProductA + ProductB <= 500\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $10,000.\n// Automation <= 10000\n\n## Generate Constraint-3:\nThe minimum production quantity for Product A must be at least 10 units.\n// ProductA >= 10",
        "question": "A manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. Product A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company has a total production capacity of 500 units for both products combined. The investment in automation cannot exceed $10,000. The minimum production quantity for Product A must be at least 10 units. The company aims to maximize the total profit from both products. Please help the company determine the optimal production quantities and level of automation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfit_A = (100 - (60 - 2 * Automation)) * ProductA\nProfit_B = (150 - (80 - 3 * Automation)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 500)\nmodel.addCons(Automation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 946,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit.\n// {\"hours of operation for greenhouse A\": \"HA\", \"range\": \"HA >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse B\": \"HB\", \"range\": \"HB >= 0\", \"type\": \"integer\"}\n// {\"hours of operation for greenhouse C\": \"HC\", \"range\": \"HC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach greenhouse has different efficiency and cost structures. \nGreenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. \nGreenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. \nGreenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. \nThe farm aims to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\n// Profit from A: Profit_A = (10 * 15 - 5) * HA\n// Profit from B: Profit_B = (15 * 20 - 7) * HB\n// Profit from C: Profit_C = (20 * 25 - 9) * HC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (HA + HB + HC)\n\n## Generate Constraint-1:\nThe farm has a total budget of $300 per day for operating the greenhouses.\n// 5 * HA + 7 * HB + 9 * HC <= 300",
        "question": "A farm operates three different types of greenhouses: A, B, and C. The farm needs to decide how many hours each greenhouse should operate daily to maximize its profit.\nGreenhouse A produces 10 kg of produce per hour, with a cost of 5$ per hour and a selling price of 15$ per kg. \nGreenhouse B produces 15 kg of produce per hour, with a cost of 7$ per hour and a selling price of 20$ per kg. \nGreenhouse C produces 20 kg of produce per hour, with a cost of 9$ per hour and a selling price of 25$ per kg. \nThe farm aims to maximize the profit rate, which is defined as the total profit divided by the total operating hours.\nThe farm has a total budget of $300 per day for operating the greenhouses.\nPlease help the farm determine the optimal number of hours each greenhouse should operate daily to maximize its profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHA = model.addVar(vtype=\"INTEGER\", name=\"HA\", lb=0) # hours of operation for greenhouse A\nHB = model.addVar(vtype=\"INTEGER\", name=\"HB\", lb=0) # hours of operation for greenhouse B\nHC = model.addVar(vtype=\"INTEGER\", name=\"HC\", lb=0) # hours of operation for greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (10 * 15 - 5) * HA\nProfit_B = (15 * 20 - 7) * HB\nProfit_C = (20 * 25 - 9) * HC\nOperatingHours = HA + HB + HC\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / OperatingHours\n## convert the division to multiplication\nmodel.addCons(obj * OperatingHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total budget of $300 per day for operating the greenhouses.\nmodel.addCons(5 * HA + 7 * HB + 9 * HC <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Greenhouse A: \", model.getVal(HA))\n    print(\"Hours of Operation for Greenhouse B: \", model.getVal(HB))\n    print(\"Hours of Operation for Greenhouse C: \", model.getVal(HC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse and the number of trucks allocated. \nAt warehouse 1, each truck incurs a cost of $500 per day, plus an additional $10 for each additional truck beyond the first. \nAt warehouse 2, each truck costs $600 per day, plus an additional $15 for each additional truck beyond the first. \nAt warehouse 3, each truck costs $700 per day, plus an additional $20 for each additional truck beyond the first. \nThe company aims to minimize the total daily transportation cost.\n// The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n// The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n// The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n// So, the objective function is: Minimize (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available for allocation.\n// T1 + T2 + T3 <= 30\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 15 trucks.\n// T1 <= 15; T2 <= 15; T3 <= 15",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines. The transportation cost per truck varies depending on the warehouse and the number of trucks allocated. At warehouse 1, each truck incurs a cost of $500 per day, plus an additional $10 for each additional truck beyond the first. At warehouse 2, each truck costs $600 per day, plus an additional $15 for each additional truck beyond the first. At warehouse 3, each truck costs $700 per day, plus an additional $20 for each additional truck beyond the first. The company has a total of 30 trucks available for allocation, and each warehouse can handle a maximum of 15 trucks. Please help the company to minimize the total daily transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT1_sq = model.addVar(vtype=\"INTEGER\", name=\"T1_sq\")\nmodel.addCons(T1_sq == (T1 - 1)**2)\nC1 = 500 * T1 + 10 * T1_sq\n\n## The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT2_sq = model.addVar(vtype=\"INTEGER\", name=\"T2_sq\")\nmodel.addCons(T2_sq == (T2 - 1)**2)\nC2 = 600 * T2 + 15 * T2_sq\n\n## The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT3_sq = model.addVar(vtype=\"INTEGER\", name=\"T3_sq\")\nmodel.addCons(T3_sq == (T3 - 1)**2)\nC3 = 700 * T3 + 20 * T3_sq\n\n## the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The company has a total of 30 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 <= 30)\n## Each warehouse can handle a maximum of 15 trucks.\nmodel.addCons(T1 <= 15)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Minimized Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for barley is $150. The water usage per acre for wheat is 5 units, for corn is 8 units, and for barley is 3 units. The farmer aims to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from barley: Profit_B = 150 * B\n// Total water used: Water_Total = 5 * W + 8 * C + 3 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (5 * W + 8 * C + 3 * B)\n\n## Generate Constraint-1:\nThe farmer has a total of 1000 units of water available for irrigation.\n// 5 * W + 8 * C + 3 * B <= 1000\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to each crop to maintain the quality of the land.\n// W >= 20; C >= 20; B >= 20\n\n## Generate Constraint-3:\nThe farmer wants to limit the total acreage to 100 acres to manage labor and equipment efficiently.\n// W + C + B <= 100",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop to optimize his profit and resource usage. The profit per acre and water usage per acre for each crop are given in the following Table.\n\n| Crop   | Profit per Acre | Water Usage per Acre |\n|--------|-----------------|----------------------|\n| Wheat  | $200            | 5 units              |\n| Corn   | $300            | 8 units              |\n| Barley | $150            | 3 units              |\n\nThe farmer has a total of 1000 units of water available for irrigation. The farmer must allocate at least 20 acres to each crop to maintain the quality of the land. The farmer wants to limit the total acreage to 100 acres to manage labor and equipment efficiently. \nPlease help the farmer to maximize his profit per unit of water used (defined as the total profit divided by the total water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must allocate at least 20 acres to each crop to maintain the quality of the land.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_B = 150 * B\nWater_Total = 5 * W + 8 * C + 3 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / Water_Total\n## convert the division to multiplication\nmodel.addCons(obj * Water_Total == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 1000 units of water available for irrigation.\nmodel.addCons(5 * W + 8 * C + 3 * B <= 1000)\n## The farmer wants to limit the total acreage to 100 acres to manage labor and equipment efficiently.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 930,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process.\n// {\"quantity of Product A\": \"QA\", \"range\": \"QA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"QB\", \"range\": \"QB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing Product A is $10 per unit, and the cost of producing Product B is $15 per unit. The revenue from Product A is $20 per unit, and from Product B is $25 per unit. Implementing automation reduces the production cost by $0.5 per unit for both products for every unit increase in automation level. The company aims to maximize the total profit from both products.\n// Cost_A = 10 - 0.5 * Automation\n// Cost_B = 15 - 0.5 * Automation\n// Revenue_A = 20 * QA\n// Revenue_B = 25 * QB\n// Total_Cost = Cost_A * QA + Cost_B * QB\n// Total_Revenue = Revenue_A + Revenue_B\n// Profit = Total_Revenue - Total_Cost\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// QA + QB <= 1000\n\n## Generate Constraint-2:\nThe company has a budget of $5000 for implementing automation.\n// Automation <= 5000",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The cost and revenue for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit |\n|---------|---------------|------------------|\n| A       | $10 - $0.5 * Automation | $20 |\n| B       | $15 - $0.5 * Automation | $25 |\n\nThe company has a total production capacity of 1000 units for both products combined. The company also has a budget of $5000 for implementing automation. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQA = model.addVar(vtype=\"INTEGER\", name=\"QA\", lb=0) # quantity of Product A\nQB = model.addVar(vtype=\"INTEGER\", name=\"QB\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCost_A = 10 - 0.5 * Automation\nCost_B = 15 - 0.5 * Automation\nRevenue_A = 20 * QA\nRevenue_B = 25 * QB\nTotal_Cost = Cost_A * QA + Cost_B * QB\nTotal_Revenue = Revenue_A + Revenue_B\nProfit = Total_Revenue - Total_Cost\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QA + QB <= 1000)\nmodel.addCons(Automation <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(QA))\n    print(\"Quantity of Product B: \", model.getVal(QB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 696,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\n// {\"quantity of Chocolate cake\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Vanilla cake\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"quantity of Strawberry cake\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production capacity and wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_C = 30 * C - 10 * C\n// Profit_V = 25 * V - 8 * V\n// Profit_S = 20 * S - 5 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / (1.5 * C + 1 * V + 0.5 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited production time of 80 hours.\n// 1.5 * C + 1 * V + 0.5 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for ingredient costs.\n// 10 * C + 8 * V + 5 * S <= 2000\n\n## Generate Constraint-3:\nThe bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce.\n// C + V + S <= 200\n\n## Generate Constraint-4:\nThe market demand for Vanilla cake is 50 cakes. So, the bakery can only sell a maximum of 50 cakes of Vanilla.\n// V <= 50",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce. The revenue per unit, production time per unit, and ingredient cost per unit for each cake are given in the following Table.\n\n| Cake Type       | Revenue per Unit | Production Time per Unit | Ingredient Cost per Unit |\n|------------------|------------------|--------------------------|--------------------------|\n| Chocolate        | $30              | 1.5 hours                | $10                      |\n| Vanilla          | $25              | 1 hour                   | $8                       |\n| Strawberry       | $20              | 0.5 hours                | $5                       |\n\nThe bakery has a limited production time of 80 hours. The bakery has a budget of $2000 for ingredient costs. The bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce. The market demand for Vanilla cake is 50 cakes. So, the bakery can only sell a maximum of 50 cakes of Vanilla.\n\nPlease help the bakery to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chocolate cake\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0, ub=50) # quantity of Vanilla cake\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of Strawberry cake\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (30 - 10) * C\nProfit_V = (25 - 8) * V\nProfit_S = (20 - 5) * S\nProductionTime = 1.5 * C + 1 * V + 0.5 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a limited production time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 0.5 * S <= 80)\n## The bakery has a budget of $2000 for ingredient costs.\nmodel.addCons(10 * C + 8 * V + 5 * S <= 2000)\n## The bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce.\nmodel.addCons(C + V + S <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chocolate cake: \", model.getVal(C))\n    print(\"Quantity of Vanilla cake: \", model.getVal(V))\n    print(\"Quantity of Strawberry cake: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1148,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit.\n// {\"hours of operation for production line A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The goal is to maximize the total profit from all three lines.\n// The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\n\n## Generate Constraint-1:\nThe total hours of operation for all three lines cannot exceed 100 hours per day.\n// A + B + C <= 100",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit. Each hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The goal is to maximize the total profit from all three lines. The total hours of operation for all three lines cannot exceed 100 hours per day. Please help the plant manager to determine the optimal number of hours to operate each production line to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # hours of operation for production line A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # hours of operation for production line B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # hours of operation for production line C\n\n# Define objective function\n## The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C.\nProfit_A = 100 * A - 0.1 * A**2\nProfit_B = 150 * B - 0.2 * B**2\nProfit_C = 200 * C - 0.3 * C**2\n## The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total hours of operation for all three lines cannot exceed 100 hours per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of Operation for Production Line A: \", model.getVal(A))\n    print(\"Hours of Operation for Production Line B: \", model.getVal(B))\n    print(\"Hours of Operation for Production Line C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of ComponentA per machine is 10 units per hour, with a defect rate of 5%. ComponentB per machine produces 15 units per hour with a defect rate of 3%. ComponentC per machine produces 20 units per hour with a defect rate of 2%. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate.\n// Effective production rate for ComponentA: RateA = 10 * (1 - 0.05) * MachinesA\n// Effective production rate for ComponentB: RateB = 15 * (1 - 0.03) * MachinesB\n// Effective production rate for ComponentC: RateC = 20 * (1 - 0.02) * MachinesC\n// So, the objective function is: Maximize (RateA + RateB + RateC)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20\n\n## Generate Constraint-3:\nTo maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA.\n// MachinesB >= 0.5 * MachinesA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and output. The production rate of ComponentA per machine is 10 units per hour, with a defect rate of 5%. ComponentB per machine produces 15 units per hour with a defect rate of 3%. ComponentC per machine produces 20 units per hour with a defect rate of 2%. The company aims to maximize the total effective production rate, which is the total production rate minus the defect rate. The company has a total of 50 machines available for allocation. Due to space limitations, no more than 20 machines can be allocated to ComponentA. To maintain a balanced production, the number of machines allocated to ComponentB must be at least half the number allocated to ComponentA. Please help the company to maximize the total effective production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0)  # number of machines for ComponentC\n\n# Define objective function\nRateA = 10 * (1 - 0.05) * MachinesA\nRateB = 15 * (1 - 0.03) * MachinesB\nRateC = 20 * (1 - 0.02) * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RateA + RateB + RateC)\n\n# Add constraints\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\nmodel.addCons(MachinesA <= 20)\nmodel.addCons(MachinesB >= 0.5 * MachinesA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Effective Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency.\n// {\"hours of operation for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3\n// So, the objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency. Each production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C. The total operating hours for all production lines must not exceed 100 hours per week. Please help the company determine the optimal number of hours to operate each production line.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours of operation for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours of operation for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours of operation for production line 3\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3\nB_total = 15 * P1 + 18 * P2 + 20 * P3\nC_total = 20 * P1 + 22 * P2 + 24 * P3\n# So, the objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line 1: \", model.getVal(P1))\n    print(\"Hours of operation for production line 2: \", model.getVal(P2))\n    print(\"Hours of operation for production line 3: \", model.getVal(P3))\n    print(\"Maximized total production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for soybeans is $200. However, the yield of each crop depends on the soil conditions, which are represented by a nonlinear function. The yield function for wheat is Y_W = 100 * W^0.5, for corn is Y_C = 150 * C^0.6, and for soybeans is Y_S = 200 * S^0.7. The farmer aims to maximize the total profit from all crops.\n// Objective function: Maximize P = Y_W * W + Y_C * C + Y_S * S\n// Formal definition: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + S <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources. The profit per acre for each crop and the yield function based on soil conditions are given in the following Table.\n\n| Crop     | Profit per Acre | Yield Function       |\n|----------|-----------------|----------------------|\n| Wheat    | $100            | Y_W = 100 * W^0.5   |\n| Corn     | $150            | Y_C = 150 * C^0.6   |\n| Soybeans | $200            | Y_S = 200 * S^0.7   |\n\nThe farmer aims to maximize the total profit from all crops. The total land available for farming is 100 acres. Please help the farmer determine the optimal allocation of land to each crop to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n## convert the nonlinear terms to linear terms\nY_W = model.addVar(vtype=\"CONTINUOUS\", name=\"Y_W\")\nY_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Y_C\")\nY_S = model.addVar(vtype=\"CONTINUOUS\", name=\"Y_S\")\nmodel.addCons(Y_W == 100 * W**0.5)\nmodel.addCons(Y_C == 150 * C**0.6)\nmodel.addCons(Y_S == 200 * S**0.7)\nmodel.addCons(obj == Y_W * W + Y_C * C + Y_S * S)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 815,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and yields a profit of $10. \nEach unit of component B requires 3 hours of labor and yields a profit of $15. \nEach unit of component C requires 4 hours of labor and yields a profit of $20.\nThe plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Labor hours for A: Labor_A = 2 * A\n// Labor hours for B: Labor_B = 3 * B\n// Labor hours for C: Labor_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n\n## Generate Constraint-1:\nThe plant has a daily labor budget of 100 hours.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe plant must produce at least 5 units of each component daily.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit. The labor requirements and profits for each component are given in the following Table.\n\n| Component | Labor Hours | Profit per Unit |\n|-----------|-------------|-----------------|\n| A         | 2 hours     | $10             |\n| B         | 3 hours     | $15             |\n| C         | 4 hours     | $20             |\n\nThe plant has a daily labor budget of 100 hours. The plant must produce at least 5 units of each component daily. Please help the plant to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 5 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_A = 2 * A\nLabor_B = 3 * B\nLabor_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor_A + Labor_B + Labor_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily labor budget of 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 746,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales.\n// {\"amount of chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"amount of vanilla cake\": \"Vanilla\", \"range\": \"Vanilla >= 0\", \"type\": \"integer\"}\n// {\"amount of strawberry cake\": \"Strawberry\", \"range\": \"Strawberry >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for chocolate cake\": \"AdChocolate\", \"range\": \"AdChocolate >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for vanilla cake\": \"AdVanilla\", \"range\": \"AdVanilla >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for strawberry cake\": \"AdStrawberry\", \"range\": \"AdStrawberry >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe bakery knows that for every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its total daily profit.\n// Profit from chocolate cake: ProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\n// Profit from vanilla cake: ProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\n// Profit from strawberry cake: ProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\n// So, the objective function is: Maximize (ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n## Generate Constraint-1:\nThe total advertising budget for all cakes cannot exceed $1000.\n// AdChocolate + AdVanilla + AdStrawberry <= 1000\n\n## Generate Constraint-2:\nThe bakery can produce a maximum of 500 cakes of each type daily.\n// Chocolate <= 500; Vanilla <= 500; Strawberry <= 500\n\n## Generate Constraint-3:\nThe bakery must produce at least 100 units of each type of cake daily.\n// Chocolate >= 100; Vanilla >= 100; Strawberry >= 100",
        "question": "A bakery wants to optimize its production of three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to decide the amount of each type of cake to produce daily and the amount of advertising budget to allocate to each type of cake to increase sales. The bakery knows that for every $100 spent on advertising a cake, the sales of that cake increase by 5 units. The profit from each chocolate cake is $5, from each vanilla cake is $4, and from each strawberry cake is $3. The bakery aims to maximize its total daily profit. The total advertising budget for all cakes cannot exceed $1000. The bakery can produce a maximum of 500 cakes of each type daily. The bakery must also produce at least 100 units of each type of cake daily. Please help the bakery determine the optimal production and advertising budget allocation to maximize its total daily profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=100, ub=500)  # amount of chocolate cake\nVanilla = model.addVar(vtype=\"INTEGER\", name=\"Vanilla\", lb=100, ub=500)  # amount of vanilla cake\nStrawberry = model.addVar(vtype=\"INTEGER\", name=\"Strawberry\", lb=100, ub=500)  # amount of strawberry cake\nAdChocolate = model.addVar(vtype=\"CONTINUOUS\", name=\"AdChocolate\", lb=0)  # advertising budget for chocolate cake\nAdVanilla = model.addVar(vtype=\"CONTINUOUS\", name=\"AdVanilla\", lb=0)  # advertising budget for vanilla cake\nAdStrawberry = model.addVar(vtype=\"CONTINUOUS\", name=\"AdStrawberry\", lb=0)  # advertising budget for strawberry cake\n\n# Define objective function\nProfitChocolate = 5 * (Chocolate + 0.05 * AdChocolate)\nProfitVanilla = 4 * (Vanilla + 0.05 * AdVanilla)\nProfitStrawberry = 3 * (Strawberry + 0.05 * AdStrawberry)\n# So, the objective function is: Maximize (ProfitChocolate + ProfitVanilla + ProfitStrawberry)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitChocolate + ProfitVanilla + ProfitStrawberry)\n\n# Add constraints\n# The total advertising budget for all cakes cannot exceed $1000.\nmodel.addCons(AdChocolate + AdVanilla + AdStrawberry <= 1000)\n# The bakery can produce a maximum of 500 cakes of each type daily.\nmodel.addCons(Chocolate <= 500)\nmodel.addCons(Vanilla <= 500)\nmodel.addCons(Strawberry <= 500)\n# The bakery must produce at least 100 units of each type of cake daily.\nmodel.addCons(Chocolate >= 100)\nmodel.addCons(Vanilla >= 100)\nmodel.addCons(Strawberry >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Chocolate Cake: \", model.getVal(Chocolate))\n    print(\"Amount of Vanilla Cake: \", model.getVal(Vanilla))\n    print(\"Amount of Strawberry Cake: \", model.getVal(Strawberry))\n    print(\"Advertising Budget for Chocolate Cake: \", model.getVal(AdChocolate))\n    print(\"Advertising Budget for Vanilla Cake: \", model.getVal(AdVanilla))\n    print(\"Advertising Budget for Strawberry Cake: \", model.getVal(AdStrawberry))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit.\n// {\"number of units of ProductA\": \"ProductAUnits\", \"range\": \"ProductAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductB\": \"ProductBUnits\", \"range\": \"ProductBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ProductC\": \"ProductCUnits\", \"range\": \"ProductCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ProductA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for ProductB is $70, but it decreases by $0.3 for each unit produced beyond the first 200 units. The profit per unit for ProductC is $90, but it decreases by $0.2 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\n// Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\n// Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\n// So, the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for the month.\n// ProductAUnits + ProductBUnits + ProductCUnits <= 600",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. They need to decide how many units of each product to produce in the next month to optimize their profit. The profit per unit for each product decreases as more units are produced beyond certain thresholds. The details are as follows:\n\n| Product | Profit per Unit (first threshold) | Decrease per Unit (beyond threshold) | Threshold |\n|---------|-----------------------------------|-------------------------------------|-----------|\n| ProductA | $50                              | $0.5                                | 100 units  |\n| ProductB | $70                              | $0.3                                | 200 units  |\n| ProductC | $90                              | $0.2                                | 300 units  |\n\nThe company has a total production capacity of 600 units for the month. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductAUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductAUnits\", lb=0) # number of units of ProductA\nProductBUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductBUnits\", lb=0) # number of units of ProductB\nProductCUnits = model.addVar(vtype=\"INTEGER\", name=\"ProductCUnits\", lb=0) # number of units of ProductC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ProductA = (50 - 0.5 * max(ProductAUnits - 100, 0)) * ProductAUnits\nProductA1 = model.addVar(vtype=\"INTEGER\", name=\"ProductA1\", lb=0, ub=100)\nProductA2 = model.addVar(vtype=\"INTEGER\", name=\"ProductA2\", lb=100, ub=600)\nProductA_b1 = model.addVar(vtype=\"B\", name=\"ProductA_b1\")\nProductA_b2 = model.addVar(vtype=\"B\", name=\"ProductA_b2\")\nmodel.addCons(ProductA_b1 + ProductA_b2 == 1)\nmodel.addCons(ProductAUnits == ProductA1*ProductA_b1 + ProductA2*ProductA_b2)\nProfit_ProductA = (50 - 0.5 * (ProductA2 - 100)) * ProductA2 * ProductA_b2 + 50 * ProductA1 * ProductA_b1\n## create piecewise variables for piecewise function: Profit_ProductB = (70 - 0.3 * max(ProductBUnits - 200, 0)) * ProductBUnits\nProductB1 = model.addVar(vtype=\"INTEGER\", name=\"ProductB1\", lb=0, ub=200)\nProductB2 = model.addVar(vtype=\"INTEGER\", name=\"ProductB2\", lb=200, ub=600)\nProductB_b1 = model.addVar(vtype=\"B\", name=\"ProductB_b1\")\nProductB_b2 = model.addVar(vtype=\"B\", name=\"ProductB_b2\")\nmodel.addCons(ProductB_b1 + ProductB_b2 == 1)\nmodel.addCons(ProductBUnits == ProductB1*ProductB_b1 + ProductB2*ProductB_b2)\nProfit_ProductB = (70 - 0.3 * (ProductB2 - 200)) * ProductB2 * ProductB_b2 + 70 * ProductB1 * ProductB_b1\n## create piecewise variables for piecewise function: Profit_ProductC = (90 - 0.2 * max(ProductCUnits - 300, 0)) * ProductCUnits\nProductC1 = model.addVar(vtype=\"INTEGER\", name=\"ProductC1\", lb=0, ub=300)\nProductC2 = model.addVar(vtype=\"INTEGER\", name=\"ProductC2\", lb=300, ub=600)\nProductC_b1 = model.addVar(vtype=\"B\", name=\"ProductC_b1\")\nProductC_b2 = model.addVar(vtype=\"B\", name=\"ProductC_b2\")\nmodel.addCons(ProductC_b1 + ProductC_b2 == 1)\nmodel.addCons(ProductCUnits == ProductC1*ProductC_b1 + ProductC2*ProductC_b2)\nProfit_ProductC = (90 - 0.2 * (ProductC2 - 300)) * ProductC2 * ProductC_b2 + 90 * ProductC1 * ProductC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ProductA + Profit_ProductB + Profit_ProductC)\nmodel.addCons(obj == Profit_ProductA + Profit_ProductB + Profit_ProductC)\n\n# Add constraints\nmodel.addCons(ProductAUnits + ProductBUnits + ProductCUnits <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ProductA Units: \", model.getVal(ProductAUnits))\n    print(\"Number of ProductB Units: \", model.getVal(ProductBUnits))\n    print(\"Number of ProductC Units: \", model.getVal(ProductCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 948,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $500, but it requires $200 per acre for maintenance. \nFor Crop B, the expected profit per acre is $700, but it requires $300 per acre for maintenance. \nFor Crop C, the expected profit per acre is $900, but it requires $400 per acre for maintenance.\nThe farmer aims to maximize the net profit per acre (which is defined as the difference between the expected profit and the maintenance cost per acre).\n// Net profit per acre of A: Profit_A = (500 - 200) * A\n// Net profit per acre of B: Profit_B = (700 - 300) * B\n// Net profit per acre of C: Profit_C = (900 - 400) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for maintenance costs.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 5 acres of each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. The expected profit per acre and the maintenance cost per acre for each crop are given in the following Table.\n\n| Crop | Expected Profit per Acre | Maintenance Cost per Acre |\n|------|--------------------------|---------------------------|\n| A    | $500                     | $200                      |\n| B    | $700                     | $300                      |\n| C    | $900                     | $400                      |\n\nThe farmer has a budget of $10,000 for maintenance costs. The farmer wants to plant at least 5 acres of each crop. \nPlease help the farmer to maximize the net profit per acre (which is defined as the difference between the expected profit and the maintenance cost per acre).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 5 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a budget of $10,000 for maintenance costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n// Profit per unit of product A: ProfitA = 50 - 2 * Automation\n// Profit per unit of product B: ProfitB = 70 - 2 * Automation\n// Profit per unit of product C: ProfitC = 60 - 2 * Automation\n// Total profit: TotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nAt least 200 units of product A must be produced.\n// UnitsA >= 200\n\n## Generate Constraint-4:\nThe number of units of product B must not exceed the number of units of product A by more than 100 units.\n// UnitsB <= UnitsA + 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process. The profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products. The company has a production capacity limit of 1000 units in total for all products. The investment in automation cannot exceed $50,000. At least 200 units of product A must be produced. The number of units of product B must not exceed the number of units of product A by more than 100 units.\nPlease help the company to determine the optimal number of units of each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=200)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = 50 - 2 * Automation\nProfitB = 70 - 2 * Automation\nProfitC = 60 - 2 * Automation\nTotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)  # Production capacity limit\nmodel.addCons(Automation <= 50000)  # Investment in automation limit\nmodel.addCons(UnitsB <= UnitsA + 100)  # Product B units constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type.\n// {\"number of machines for Capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for Diodes\": \"Dio\", \"range\": \"Dio >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of Capacitors is 50 units per hour per machine, Resistors is 70 units per hour per machine, and Diodes is 60 units per hour per machine. The cost of operating a Capacitor machine is $100 per hour, a Resistor machine is $120 per hour, and a Diode machine is $110 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. The selling price for each Capacitor is $150, each Resistor is $200, and each Diode is $180.\n// Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n// Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $5000 per hour for operating the machines.\n// 100 * Cap + 120 * Res + 110 * Dio <= 5000\n\n## Generate Constraint-2:\nThe total number of machines available is 40.\n// Cap + Res + Dio <= 40",
        "question": "A manufacturer produces three types of electronic components: Capacitors, Resistors, and Diodes. The production rate of each component depends on the number of machines dedicated to each type. The production rate, operating cost, and selling price for each component are given in the following Table.\n\n| Component | Production Rate (units/hour/machine) | Operating Cost ($/hour/machine) | Selling Price ($/unit) |\n|-----------|---------------------------------------|---------------------------------|-----------------------|\n| Capacitors| 50                                    | 100                             | 150                   |\n| Resistors | 70                                    | 120                             | 200                   |\n| Diodes    | 60                                    | 110                             | 180                   |\n\nThe manufacturer has a budget of $5000 per hour for operating the machines. The total number of machines available is 40. The manufacturer wants to maximize the profit, which is the total production value minus the operating cost. Please help the manufacturer determine the optimal number of machines for each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=0) # number of machines for Capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0) # number of machines for Resistors\nDio = model.addVar(vtype=\"INTEGER\", name=\"Dio\", lb=0) # number of machines for Diodes\n\n# Define objective function\n## Total production value: Value = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\n## Total operating cost: Cost = 100 * Cap + 120 * Res + 110 * Dio\n## So, the objective function is: Maximize (Value - Cost)\nValue = 50 * 150 * Cap + 70 * 200 * Res + 60 * 180 * Dio\nCost = 100 * Cap + 120 * Res + 110 * Dio\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n## The manufacturer has a budget of $5000 per hour for operating the machines.\nmodel.addCons(100 * Cap + 120 * Res + 110 * Dio <= 5000)\n## The total number of machines available is 40.\nmodel.addCons(Cap + Res + Dio <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Capacitor Machines: \", model.getVal(Cap))\n    print(\"Number of Resistor Machines: \", model.getVal(Res))\n    print(\"Number of Diode Machines: \", model.getVal(Dio))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1210,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials.\n// {\"quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, Product B is $150, and Product C is $200. The cost of Material1 per unit of Product A is $20, Material2 per unit of Product B is $30, and Material3 per unit of Product C is $40. The manufacturer wants to maximize the total profit, considering the cost of materials.\n// Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of Material1 available is 1000 units.\n// 20 * ProductA <= 1000\n\n## Generate Constraint-2:\nThe total amount of Material2 available is 1500 units.\n// 30 * ProductB <= 1500",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different materials (Material1, Material2, and Material3). The manufacturer needs to decide the quantities of each product to maximize profit while considering the availability and cost of materials. The profit per unit of Product A is $100, Product B is $150, and Product C is $200. The cost of Material1 per unit of Product A is $20, Material2 per unit of Product B is $30, and Material3 per unit of Product C is $40. The total amount of Material1 available is 1000 units, and the total amount of Material2 available is 1500 units. Please help the manufacturer to maximize the total profit, considering the cost of materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of Product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nProfit = (100 - 20) * ProductA + (150 - 30) * ProductB + (200 - 40) * ProductC\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total amount of Material1 available is 1000 units.\nmodel.addCons(20 * ProductA <= 1000)\n## The total amount of Material2 available is 1500 units.\nmodel.addCons(30 * ProductB <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 715,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs.\n// Fuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\n// Carbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n// So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 5000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 20.\n// Trucks + Vans + Bikes <= 20\n\n## Generate Constraint-3:\nThe company must ensure at least 5 deliveries are made using environmentally friendly vehicles (Bikes).\n// Bikes >= 5\n\n## Generate Constraint-4:\nThe capacity constraint requires that the total capacity of all vehicles (measured in tons) does not exceed 100. Trucks have a capacity of 10 tons, Vans have a capacity of 5 tons, and Bikes have a capacity of 1 ton.\n// 10 * Trucks + 5 * Vans + 1 * Bikes <= 100",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs. The company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100. The total number of vehicles cannot exceed 20. The company must ensure at least 5 deliveries are made using environmentally friendly vehicles (Bikes). The capacity constraint requires that the total capacity of all vehicles (measured in tons) does not exceed 100. Trucks have a capacity of 10 tons, Vans have a capacity of 5 tons, and Bikes have a capacity of 1 ton. Please help the company to minimize the total cost, which includes both fuel and carbon footprint costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=5)  # number of Bikes\n\n# Define objective function\nFuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\nCarbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n# So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Carbon_Footprint_Cost)\n\n# Add constraints\n# The company has a budget of $5000 for vehicle maintenance.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 5000)\n# The total number of vehicles cannot exceed 20.\nmodel.addCons(Trucks + Vans + Bikes <= 20)\n# The company must ensure at least 5 deliveries are made using environmentally friendly vehicles (Bikes).\nmodel.addCons(Bikes >= 5)\n# The capacity constraint requires that the total capacity of all vehicles (measured in tons) does not exceed 100.\nmodel.addCons(10 * Trucks + 5 * Vans + 1 * Bikes <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1288,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space.\n// {\"number of solar panels in region 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000.\n// Total energy production: Energy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\n// Total investment cost: Cost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n// The objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe total investment cost must not exceed $100,000.\n// 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space. The energy production and installation cost for each type of equipment are given in the following Table.\n\n| Equipment | Energy Production | Installation Cost |\n|-----------|-------------------|-------------------|\n| Solar Panel | 500 kWh | $1000 |\n| Wind Turbine | 1000 kWh | $2000 |\n\nThe company aims to maximize the total energy production while keeping the total investment cost below $100,000. Please help the company to determine the optimal number of solar panels and wind turbines to install in each region.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels in region 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines in region 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels in region 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines in region 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels in region 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines in region 3\n\n# Define objective function\nEnergy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\nCost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n# The objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The total investment cost must not exceed $100,000.\nmodel.addCons(1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines in Region 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels in Region 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines in Region 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels in Region 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines in Region 3: \", model.getVal(W3))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n// Total production cost for product 1: Cost1 = 50 * P1 / (1 - 0.005 * Automation)\n// Total production cost for product 2: Cost2 = 70 * P2 / (1 - 0.005 * Automation)\n// Total daily production cost: TotalCost = Cost1 + Cost2\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\n// P1 <= 50; P2 <= 40\n\n## Generate Constraint-2:\nThe level of automation must not exceed 80%.\n// Automation <= 0.8\n\n## Generate Constraint-3:\nThe company must meet the daily demand of 100 units for product 1 and 150 units for product 2.\n// P1 * 24 >= 100; P2 * 24 >= 150\n\n## Generate Constraint-4:\nThe total production rate for both products must not exceed the production line's capacity of 80 units per hour.\n// P1 + P2 <= 80",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line. The cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n\n| Product | Cost per Unit | Daily Demand |\n|---------|---------------|--------------|\n| 1       | $50           | 100 units    |\n| 2       | $70           | 150 units    |\n\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2. The level of automation must not exceed 80%. The company must meet the daily demand of 100 units for product 1 and 150 units for product 2. The total production rate for both products must not exceed the production line's capacity of 80 units per hour.\n\nPlease help the company to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 50 * P1 / (1 - 0.005 * Automation)\nCost2 = 70 * P2 / (1 - 0.005 * Automation)\nTotalCost = Cost1 + Cost2\n## the objective function is: Minimize TotalCost\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 40)\n## The level of automation must not exceed 80%.\nmodel.addCons(Automation <= 0.8)\n## The company must meet the daily demand of 100 units for product 1 and 150 units for product 2.\nmodel.addCons(P1 * 24 >= 100)\nmodel.addCons(P2 * 24 >= 150)\n## The total production rate for both products must not exceed the production line's capacity of 80 units per hour.\nmodel.addCons(P1 + P2 <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit.\n// {\"raw materials for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. \nProduct 1 requires M1 units of raw material and generates a profit of 10M1. \nProduct 2 requires M2 units of raw material and generates a profit of 15M2. \nProduct 3 requires M3 units of raw material and generates a profit of 20M3.\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 10M1 + 15M2 + 20M3\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 100 units.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit. The requirements and profits for each product are given in the following Table.\n\n| Product | Raw Material Required | Profit per Unit |\n|---------|-----------------------|-----------------|\n| 1       | M1 units              | 10M1            |\n| 2       | M2 units              | 15M2            |\n| 3       | M3 units              | 20M3            |\n\nThe total amount of raw materials available is 100 units. Please help the plant manager to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # raw materials for product 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # raw materials for product 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # raw materials for product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 10M1 + 15M2 + 20M3\nmodel.addCons(obj == 10*M1 + 15*M2 + 20*M3)\n\n# Add constraints\n## The total amount of raw materials available is 100 units.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for product 1: \", model.getVal(M1))\n    print(\"Raw materials for product 2: \", model.getVal(M2))\n    print(\"Raw materials for product 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 662,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency. The profit function is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit.\n// Formal definition: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-2:\nThe total machine hours available are 800 hours.\n// M <= 800\n\n## Generate Constraint-3:\nThe total raw materials available are 1200 units.\n// R <= 1200",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit from each product is influenced by the nonlinear relationship between resource allocation and production efficiency, and is given by: Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R). The company aims to maximize this profit. The total labor hours available are 1000 hours, the total machine hours available are 800 hours, and the total raw materials available are 1200 units.\nPlease help the company determine the optimal allocation of labor hours (L), machine hours (M), and raw materials (R) to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 1000 * L^0.5 * M^0.6 * R^0.4 - 500 * (L + M + R)\nmodel.addCons(obj == 1000 * L**0.5 * M**0.6 * R**0.4 - 500 * (L + M + R))\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total machine hours available are 800 hours.\nmodel.addCons(M <= 800)\n## The total raw materials available are 1200 units.\nmodel.addCons(R <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of smartphones\": \"Q_smartphone\", \"range\": \"Q_smartphone >= 0\", \"type\": \"integer\"}\n// {\"production quantity of tablets\": \"Q_tablet\", \"range\": \"Q_tablet >= 0\", \"type\": \"integer\"}\n// {\"production quantity of laptops\": \"Q_laptop\", \"range\": \"Q_laptop >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the quantity produced due to economies of scale and market saturation. The profit function is given by:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\nThe company aims to maximize the total profit from all devices.\n// So, the objective function is: Maximize Total_Profit = P_smartphone + P_tablet + P_laptop\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per month.\n// Q_smartphone + Q_tablet + Q_laptop <= 1000\n\n## Generate Constraint-2:\nThe company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n// Q_smartphone >= 100; Q_tablet >= 50\n\n## Generate Constraint-3:\nDue to labor constraints, the production of laptops cannot exceed 200 units per month.\n// Q_laptop <= 200\n\n## Generate Constraint-4:\nThe company must maintain a balance in production to avoid over-reliance on any single product. The ratio of smartphones to tablets must be at least 2:1.\n// Q_smartphone >= 2 * Q_tablet",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the production quantities of each device to maximize profit while considering the cost of raw materials and labor. The profit from each device varies with the quantity produced due to economies of scale and market saturation, and is given by the following profit functions:\n- Profit from smartphones: P_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone^2\n- Profit from tablets: P_tablet = 150 * Q_tablet - 0.02 * Q_tablet^2\n- Profit from laptops: P_laptop = 200 * Q_laptop - 0.03 * Q_laptop^2\n\nThe company aims to maximize the total profit from all devices. The following constraints apply:\n- The total production capacity of the factory is limited to 1000 units per month.\n- The company has a minimum order requirement from a key client for at least 100 smartphones and 50 tablets.\n- Due to labor constraints, the production of laptops cannot exceed 200 units per month.\n- The company must maintain a balance in production to avoid over-reliance on any single product. The ratio of smartphones to tablets must be at least 2:1.\n\nPlease help the company determine the optimal production quantities for each device to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_smartphone = model.addVar(vtype=\"INTEGER\", name=\"Q_smartphone\", lb=0)  # production quantity of smartphones\nQ_tablet = model.addVar(vtype=\"INTEGER\", name=\"Q_tablet\", lb=0)  # production quantity of tablets\nQ_laptop = model.addVar(vtype=\"INTEGER\", name=\"Q_laptop\", lb=0)  # production quantity of laptops\n\n# Define objective function\nP_smartphone = 100 * Q_smartphone - 0.01 * Q_smartphone**2\nP_tablet = 150 * Q_tablet - 0.02 * Q_tablet**2\nP_laptop = 200 * Q_laptop - 0.03 * Q_laptop**2\nTotal_Profit = P_smartphone + P_tablet + P_laptop\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Total_Profit)\n\n# Add constraints\nmodel.addCons(Q_smartphone + Q_tablet + Q_laptop <= 1000)  # Total production capacity constraint\nmodel.addCons(Q_smartphone >= 100)  # Minimum order requirement for smartphones\nmodel.addCons(Q_tablet >= 50)  # Minimum order requirement for tablets\nmodel.addCons(Q_laptop <= 200)  # Labor constraint for laptops\nmodel.addCons(Q_smartphone >= 2 * Q_tablet)  # Ratio constraint for smartphones to tablets\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Smartphones: \", model.getVal(Q_smartphone))\n    print(\"Production Quantity of Tablets: \", model.getVal(Q_tablet))\n    print(\"Production Quantity of Laptops: \", model.getVal(Q_laptop))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1267,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $100, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of device B is $150, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit of device C is $200, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\n// Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\n// Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all devices must not exceed $10,000. The cost per unit of device A is $20, device B is $30, and device C is $40.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity. The production time for device A is 1 hour, device B is 2 hours, and device C is 3 hours. The total production time must not exceed 1000 hours.\n// A + 2 * B + 3 * C <= 1000\n\n## Generate Constraint-3:\nThe market demand for device A is at least 50 units, for device B is at least 30 units, and for device C is at least 20 units.\n// A >= 50; B >= 30; C >= 20",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\nThe profit per unit of device A is $100, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit of device B is $150, but it decreases by $0.2 for each unit produced beyond the first 50 units. The profit per unit of device C is $200, but it decreases by $0.3 for each unit produced beyond the first 20 units. The company aims to maximize the total profit from the sales of these devices.\nThe total production cost for all devices must not exceed $10,000. The cost per unit of device A is $20, device B is $30, and device C is $40.\nThe company has a limited production capacity. The production time for device A is 1 hour, device B is 2 hours, and device C is 3 hours. The total production time must not exceed 1000 hours.\nThe market demand for device A is at least 50 units, for device B is at least 30 units, and for device C is at least 20 units.\nPlease help the company to determine the optimal production quantities for each device to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of units of device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.1 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=50, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=101, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (100 - 0.1 * A2) * A\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.2 * max(B - 50, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=30, ub=50)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=51, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (150 - 0.2 * B2) * B\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.3 * max(C - 20, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=20, ub=20)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=21, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (200 - 0.3 * C2) * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\nmodel.addCons(A + 2 * B + 3 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1206,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units.\n// Total profit: Profit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for automation and marketing combined.\n// Automation + MarketingBudget <= 200000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product. The cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units. The company has a total budget of $200,000 for automation and marketing combined.\nPlease help the company determine the optimal number of units to produce, the level of automation, and the marketing budget to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation + MarketingBudget <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand.\n// {\"number of machines for component A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands.\n// The operating hours for component A: HA = 500 / (10 * MA)\n// The operating hours for component B: HB = 600 / (12 * MB)\n// The operating hours for component C: HC = 750 / (15 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available in the plant.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nEach type of machine can operate for a maximum of 10 hours per day.\n// HA <= 10; HB <= 10; HC <= 10\n\n## Generate Constraint-3:\nThe number of machines allocated to each component type cannot exceed 10.\n// MA <= 10; MB <= 10; MC <= 10",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand. Each machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands. There are a total of 20 machines available in the plant. Each type of machine can operate for a maximum of 10 hours per day. The number of machines allocated to each component type cannot exceed 10. Please help the plant manager to determine the optimal allocation of machines to minimize the maximum operating hours required for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for component A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for component B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = model.addVar(name=\"HA\") # operating hours for component A\nHB = model.addVar(name=\"HB\") # operating hours for component B\nHC = model.addVar(name=\"HC\") # operating hours for component C\nmodel.addCons(HA == 500 / (10 * MA))\nmodel.addCons(HB == 600 / (12 * MB))\nmodel.addCons(HC == 750 / (15 * MC))\n## the objective function is: Minimize max(HA, HB, HC)\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## There are a total of 20 machines available in the plant.\nmodel.addCons(MA + MB + MC <= 20)\n## Each type of machine can operate for a maximum of 10 hours per day.\nmodel.addCons(HA <= 10)\nmodel.addCons(HB <= 10)\nmodel.addCons(HC <= 10)\n## The number of machines allocated to each component type cannot exceed 10.\nmodel.addCons(MA <= 10)\nmodel.addCons(MB <= 10)\nmodel.addCons(MC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(MA))\n    print(\"Number of Machines for Component B: \", model.getVal(MB))\n    print(\"Number of Machines for Component C: \", model.getVal(MC))\n    print(\"Minimized Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 928,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nThe investment in production efficiency cannot exceed $50,000.\n// Efficiency <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency, where for every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n\nThe company has a total of 40 hours available for production in a week. The investment in production efficiency cannot exceed $50,000.\n\nPlease help the company to determine the optimal allocation of hours for each product type and the investment in production efficiency to minimize the maximum production time for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n## Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n## Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = 1000 * H1 / (10 + 0.001 * Efficiency)\nT2 = 1000 * H2 / (10 + 0.001 * Efficiency)\nT3 = 1000 * H3 / (10 + 0.001 * Efficiency)\n\n## Use auxiliary variables to represent max function\nTmax1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tmax1\")\nTmax2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Tmax2\")\nmodel.addCons(Tmax1 >= T1)\nmodel.addCons(Tmax1 >= T2)\nmodel.addCons(Tmax2 >= Tmax1)\nmodel.addCons(Tmax2 >= T3)\nmodel.addCons(obj == Tmax2)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## The investment in production efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n// The production time for component A: TA = 800 / (10 * WA)\n// The production time for component B: TB = 1200 / (15 * WB)\n// The production time for component C: TC = 1600 / (20 * WC)\n// So, the objective function is: Minimize max(TA, TB, TC)\n\n## Generate Constraint-1:\nThere are a total of 50 skilled workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 25 workers.\n// WA <= 25; WB <= 25; WC <= 25",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line. Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands. There are a total of 50 skilled workers available, and each production line can accommodate up to 25 workers.\nPlease help the manufacturer to minimize the maximum of the production times for components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## The production time for component A: TA = 800 / (10 * WA)\n## The production time for component B: TB = 1200 / (15 * WB)\n## The production time for component C: TC = 1600 / (20 * WC)\n## So, the objective function is: Minimize max(TA, TB, TC)\nTA = model.addVar(name=\"TA\")\nTB = model.addVar(name=\"TB\")\nTC = model.addVar(name=\"TC\")\nmodel.addCons(TA == 800 / (10 * WA))\nmodel.addCons(TB == 1200 / (15 * WB))\nmodel.addCons(TC == 1600 / (20 * WC))\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj >= TA)\nmodel.addCons(obj >= TB)\nmodel.addCons(obj >= TC)\n\n# Add constraints\n## There are a total of 50 skilled workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can accommodate up to 25 workers.\nmodel.addCons(WA <= 25)\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck costs $50,000 to purchase and can make $10,000 in profit per week. Each Van costs $30,000 to purchase and can make $7,000 in profit per week. Each Bike costs $5,000 to purchase and can make $3,000 in profit per week. The company wants to maximize the total weekly profit while considering the purchase costs.\n// Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n// Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n// So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for vehicle purchases.\n// 50,000 * T + 30,000 * V + 5,000 * B <= 1,000,000\n\n## Generate Constraint-2:\nDue to storage limitations, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nTo ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\n// T >= 0.5 * V\n\n## Generate Constraint-4:\nThe company must have at least 5 Bikes to handle small, local deliveries.\n// B >= 5",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, each used for different types of deliveries. The company needs to decide how many of each vehicle type to purchase to optimize their delivery operations. The cost and weekly profit for each vehicle type are given in the following Table.\n\n| Vehicle Type | Purchase Cost | Weekly Profit |\n|--------------|---------------|---------------|\n| Trucks       | $50,000       | $10,000       |\n| Vans         | $30,000       | $7,000        |\n| Bikes        | $5,000        | $3,000        |\n\nThe company has a budget of $1,000,000 for vehicle purchases. Due to storage limitations, the total number of vehicles cannot exceed 30. To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans. The company must have at least 5 Bikes to handle small, local deliveries. \nPlease help the company to maximize the total weekly profit while considering the purchase costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of Bikes\n\n# Define objective function\n## Total purchase cost: Cost = 50,000 * T + 30,000 * V + 5,000 * B\n## Total weekly profit: Profit = 10,000 * T + 7,000 * V + 3,000 * B\n## So, the objective function is: Maximize (Profit - Cost) = 10,000 * T + 7,000 * V + 3,000 * B - (50,000 * T + 30,000 * V + 5,000 * B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 10000 * T + 7000 * V + 3000 * B - (50000 * T + 30000 * V + 5000 * B))\n\n# Add constraints\n## The company has a budget of $1,000,000 for vehicle purchases.\nmodel.addCons(50000 * T + 30000 * V + 5000 * B <= 1000000)\n## Due to storage limitations, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## To ensure a balanced fleet, the number of Trucks must be at least half the number of Vans.\nmodel.addCons(T >= 0.5 * V)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Maximized Weekly Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit.\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product type depends on the labor hours invested. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\nThe company aims to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3 = 100 * L1^0.7 + 150 * L2^0.6 + 200 * L3^0.5\n\n## Generate Constraint-1:\nThe total labor hours available for all products is 1000 hours.\n// L1 + L2 + L3 <= 1000\n\n## Generate Constraint-2:\nThe company has a policy to allocate at least 20% of the total labor hours to product 1.\n// L1 >= 0.2 * (L1 + L2 + L3)\n\n## Generate Constraint-3:\nThe labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\n// L3 <= 2 * L1",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours) to each product type to maximize profit. The profit from each product type depends on the labor hours invested and is given by the following nonlinear profit functions:\n\n- Product 1: P1 = 100 * L1^0.7\n- Product 2: P2 = 150 * L2^0.6\n- Product 3: P3 = 200 * L3^0.5\n\nThe company aims to maximize the total profit from all three products. The total labor hours available for all products is 1000 hours. The company has a policy to allocate at least 20% of the total labor hours to product 1. Additionally, the labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\n\nPlease help the company determine the optimal allocation of labor hours (L1, L2, L3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # labor hours for product 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for product 2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # labor hours for product 3\n\n# Define objective function\n## The profit from each product type depends on the labor hours invested.\nP1 = 100 * L1**0.7\nP2 = 150 * L2**0.6\nP3 = 200 * L3**0.5\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total labor hours available for all products is 1000 hours.\nmodel.addCons(L1 + L2 + L3 <= 1000)\n## The company has a policy to allocate at least 20% of the total labor hours to product 1.\nmodel.addCons(L1 >= 0.2 * (L1 + L2 + L3))\n## The labor hours for product 3 should not exceed twice the labor hours allocated to product 1.\nmodel.addCons(L3 <= 2 * L1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor hours for Product 1: \", model.getVal(L1))\n    print(\"Labor hours for Product 2: \", model.getVal(L2))\n    print(\"Labor hours for Product 3: \", model.getVal(L3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company wants to minimize the total fuel cost for all vehicles. However, due to environmental regulations, the company must also consider the carbon footprint, which is proportional to the fuel consumption. The carbon footprint cost per unit of fuel is $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs.\n// Fuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\n// Carbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n// So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for vehicle maintenance. Each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100.\n// 500 * Trucks + 300 * Vans + 100 * Bikes <= 5000\n\n## Generate Constraint-2:\nThe total number of vehicles cannot exceed 20.\n// Trucks + Vans + Bikes <= 20",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: Trucks, Vans, and Bikes. Each vehicle has different fuel efficiency and capacity. The cost of fuel per mile for Trucks is $0.5, for Vans is $0.3, and for Bikes is $0.1. The company must also consider the carbon footprint, which is proportional to the fuel consumption, with a carbon footprint cost per unit of fuel of $0.02 for Trucks, $0.015 for Vans, and $0.01 for Bikes. The company aims to minimize the total cost, which includes both fuel and carbon footprint costs. The company has a budget of $5000 for vehicle maintenance, where each Truck requires $500 for maintenance, each Van requires $300, and each Bike requires $100. Additionally, the total number of vehicles cannot exceed 20. Please help the company to determine the optimal number of Trucks, Vans, and Bikes to minimize the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\nFuel_Cost = 0.5 * Trucks + 0.3 * Vans + 0.1 * Bikes\nCarbon_Footprint_Cost = 0.02 * Trucks + 0.015 * Vans + 0.01 * Bikes\n# So, the objective function is: Minimize Fuel_Cost + Carbon_Footprint_Cost\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_Cost + Carbon_Footprint_Cost)\n\n# Add constraints\n# The company has a budget of $5000 for vehicle maintenance.\nmodel.addCons(500 * Trucks + 300 * Vans + 100 * Bikes <= 5000)\n# The total number of vehicles cannot exceed 20.\nmodel.addCons(Trucks + Vans + Bikes <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 886,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment for each product to maximize profit.\n// {\"production quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"advertising investment for product A\": \"AdvertisingA\", \"range\": \"AdvertisingA >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product B\": \"AdvertisingB\", \"range\": \"AdvertisingB >= 0\", \"type\": \"continuous\"}\n// {\"advertising investment for product C\": \"AdvertisingC\", \"range\": \"AdvertisingC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from product A is $10 per unit, and an additional $2 is gained for every $100 spent on advertising. The profit from product B is $15 per unit, and an additional $3 is gained for every $100 spent on advertising. The profit from product C is $20 per unit, and an additional $4 is gained for every $100 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = 10 * ProductA + 0.02 * AdvertisingA * ProductA\n// Total profit for product B: ProfitB = 15 * ProductB + 0.03 * AdvertisingB * ProductB\n// Total profit for product C: ProfitC = 20 * ProductC + 0.04 * AdvertisingC * ProductC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total production cost for all products cannot exceed $50,000.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC <= 50000\n\n## Generate Constraint-2:\nThe total advertising budget for all products is $10,000.\n// AdvertisingA + AdvertisingB + AdvertisingC <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment for each product to maximize profit. The profit from each product and the additional profit gained from advertising are given in the following Table.\n\n| Product | Profit per Unit | Additional Profit per $100 Advertising |\n|---------|-----------------|----------------------------------------|\n| A       | $10             | $2                                     |\n| B       | $15             | $3                                     |\n| C       | $20             | $4                                     |\n\nThe total production cost for all products cannot exceed $50,000. The total advertising budget for all products is $10,000. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0)  # production quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0)  # production quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0)  # production quantity of product C\nAdvertisingA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingA\", lb=0)  # advertising investment for product A\nAdvertisingB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingB\", lb=0)  # advertising investment for product B\nAdvertisingC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdvertisingC\", lb=0)  # advertising investment for product C\n\n# Define objective function\nProfitA = 10 * ProductA + 0.02 * AdvertisingA * ProductA\nProfitB = 15 * ProductB + 0.03 * AdvertisingB * ProductB\nProfitC = 20 * ProductC + 0.04 * AdvertisingC * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 50000)  # total production cost constraint\nmodel.addCons(AdvertisingA + AdvertisingB + AdvertisingC <= 10000)  # total advertising budget constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Production Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Advertising Investment for Product A: \", model.getVal(AdvertisingA))\n    print(\"Advertising Investment for Product B: \", model.getVal(AdvertisingB))\n    print(\"Advertising Investment for Product C: \", model.getVal(AdvertisingC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 881,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints.\n// {\"number of machines of type 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine type contributes differently to the profit. Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company wants to maximize the total profit from operating these machines.\n// The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\n// Objective: Maximize P\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available across all types.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 25 machines of any type can be operated simultaneously.\n// M1 <= 25; M2 <= 25; M3 <= 25\n\n## Generate Constraint-3:\nThe demand for widgets requires that at least 100 widgets are produced per hour. Each machine of type 1 produces 2 widgets per hour, type 2 produces 3 widgets per hour, and type 3 produces 2 widgets per hour.\n// 2 * M1 + 3 * M2 + 2 * M3 >= 100",
        "question": "A company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints. Each machine type contributes differently to the profit: Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company has a total of 50 machines available across all types. Due to space limitations, no more than 25 machines of any type can be operated simultaneously. The demand for widgets requires that at least 100 widgets are produced per hour, with each machine of type 1 producing 2 widgets per hour, type 2 producing 3 widgets per hour, and type 3 producing 2 widgets per hour. Please help the company to maximize the total profit from operating these machines.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines of type 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines of type 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines of type 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\nmodel.addCons(obj == 50 * M1 + 70 * M2 + 60 * M3)\n\n# Add constraints\n## The company has a total of 50 machines available across all types.\nmodel.addCons(M1 + M2 + M3 <= 50)\n## Due to space limitations, no more than 25 machines of any type can be operated simultaneously.\nmodel.addCons(M1 <= 25)\nmodel.addCons(M2 <= 25)\nmodel.addCons(M3 <= 25)\n## The demand for widgets requires that at least 100 widgets are produced per hour.\nmodel.addCons(2 * M1 + 3 * M2 + 2 * M3 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines of Type 1: \", model.getVal(M1))\n    print(\"Number of Machines of Type 2: \", model.getVal(M2))\n    print(\"Number of Machines of Type 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how many acres of each crop to plant this season.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $200, and the water usage per acre is 500 liters. \nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $300, and the water usage per acre is 700 liters. \nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $400, and the water usage per acre is 900 liters.\nThe farm has a limited water supply and aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water usages).\n// Net revenue of A: Net_A = (1000 - 200) * A\n// Net revenue of B: Net_B = (1500 - 300) * B\n// Net revenue of C: Net_C = (2000 - 400) * C\n// So, the objective function is: Maximize (Net_A + Net_B + Net_C) / (500 * A + 700 * B + 900 * C)\n\n## Generate Constraint-1:\nThe farm has $10000 available for seed costs this season.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe farm wants to plant at least 10 acres of each crop this season.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how many acres of each crop to plant this season. The expected revenue per acre, cost of seeds per acre, and water usage per acre for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Acre | Cost of Seeds per Acre | Water Usage per Acre |\n|------|--------------------------|------------------------|----------------------|\n| A    | $1000                    | $200                   | 500 liters           |\n| B    | $1500                    | $300                   | 700 liters           |\n| C    | $2000                    | $400                   | 900 liters           |\n\nThe farm has $10000 available for seed costs this season. The farm wants to plant at least 10 acres of each crop this season. The farm has a limited water supply and aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water usages).\nPlease help the farm to determine the optimal number of acres for each crop to maximize the net revenue per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to plant at least 10 acres of each crop this season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_A = (1000 - 200) * A\nNet_B = (1500 - 300) * B\nNet_C = (2000 - 400) * C\nWaterUsage = 500 * A + 700 * B + 900 * C\n## the objective function is: Maximize (Net_A + Net_B + Net_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_A + Net_B + Net_C)\n\n# Add constraints\n## The farm has $10000 available for seed costs this season.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1121,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. \nVehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. \nVehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. \nThe company aims to minimize the total cost of maintenance and fuel consumption, considering the total distance traveled by all vehicles is 10000 km.\n// Fuel cost for A: Fuel_A = (10/100) * 10000 * A\n// Fuel cost for B: Fuel_B = (8/100) * 10000 * B\n// Fuel cost for C: Fuel_C = (6/100) * 10000 * C\n// Maintenance cost for A: Maint_A = 5000 * A\n// Maintenance cost for B: Maint_B = 4000 * B\n// Maintenance cost for C: Maint_C = 3000 * C\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n## Generate Constraint-1:\nThe company has a budget of $20000 for vehicle maintenance.\n// 5000 * A + 4000 * B + 3000 * C <= 20000\n\n## Generate Constraint-2:\nThe company can only deploy a maximum of 5 vehicles of each type.\n// A <= 5; B <= 5; C <= 5\n\n## Generate Constraint-3:\nThe total number of vehicles deployed must not exceed 12.\n// A + B + C <= 12",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the upcoming month to optimize fuel efficiency and cost. Vehicle A consumes 10 liters of fuel per 100 km and costs $5000 per month to maintain. Vehicle B consumes 8 liters of fuel per 100 km and costs $4000 per month to maintain. Vehicle C consumes 6 liters of fuel per 100 km and costs $3000 per month to maintain. The company aims to minimize the total cost of maintenance and fuel consumption, considering the total distance traveled by all vehicles is 10000 km. The company has a budget of $20000 for vehicle maintenance. The company can only deploy a maximum of 5 vehicles of each type. The total number of vehicles deployed must not exceed 12. Please help the company to minimize the total cost of maintenance and fuel consumption.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=5) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=5) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=5) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nFuel_A = (10/100) * 10000 * A\nFuel_B = (8/100) * 10000 * B\nFuel_C = (6/100) * 10000 * C\nMaint_A = 5000 * A\nMaint_B = 4000 * B\nMaint_C = 3000 * C\n## the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C + Maint_A + Maint_B + Maint_C)\n\n# Add constraints\n## The company has a budget of $20000 for vehicle maintenance.\nmodel.addCons(5000 * A + 4000 * B + 3000 * C <= 20000)\n## The company can only deploy a maximum of 5 vehicles of each type.\nmodel.addCons(A <= 5)\nmodel.addCons(B <= 5)\nmodel.addCons(C <= 5)\n## The total number of vehicles deployed must not exceed 12.\nmodel.addCons(A + B + C <= 12)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 880,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget\": \"MarketingBudget\", \"range\": \"MarketingBudget >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $100,000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production and sales of the units.\n// Total profit: Profit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total budget of $200,000 for automation and marketing combined.\n// Automation + MarketingBudget <= 200000\n\n## Generate Constraint-2:\nThe company must produce at least 1000 units to meet the minimum order requirements from key clients.\n// Units >= 1000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the number of units to produce, the level of automation to implement in the production process, and the marketing budget to allocate for promoting the product. The cost of production per unit decreases by $5 for every $100,000 invested in automation, with an initial production cost per unit of $100 and a selling price per unit of $150. The company aims to maximize the total profit from the production and sales of the units.\n\nThe company has a total budget of $200,000 for automation and marketing combined. Additionally, the company must produce at least 1000 units to meet the minimum order requirements from key clients.\n\nPlease help the company determine the optimal number of units to produce, the level of automation, and the marketing budget to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=1000)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nMarketingBudget = model.addVar(vtype=\"CONTINUOUS\", name=\"MarketingBudget\", lb=0)  # marketing budget\n\n# Define objective function\nProfit = (150 - 100 + 0.00005 * Automation) * Units - MarketingBudget\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation + MarketingBudget <= 200000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Marketing Budget: \", model.getVal(MarketingBudget))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 876,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company aims to maximize its total profit while considering the efficiency of raw material usage. The efficiency is defined as the ratio of total profit to the total raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 100 * C\n// Total raw material usage: RawMaterial = 2 * A + 3 * B + 5 * C\n// So, the objective function is: Maximize Profit / RawMaterial\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\n// 2 * A + 3 * B + 5 * C <= 10000 / 10\n\n## Generate Constraint-2:\nThe company must produce at least 100 units in total across all products to meet the minimum order requirements.\n// A + B + C >= 100",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage. The profit and raw material requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Required per Unit |\n|---------|-----------------|--------------------------------|\n| A       | $50             | 2 units                        |\n| B       | $70             | 3 units                        |\n| C       | $100            | 5 units                        |\n\nThe company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit. The company must produce at least 100 units in total across all products to meet the minimum order requirements. \n\nPlease help the company to maximize its total profit while considering the efficiency of raw material usage, which is defined as the ratio of total profit to the total raw material used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 5 * C\n## the objective function is: Maximize Profit / RawMaterial\n## convert the division to multiplication\nmodel.addCons(obj * RawMaterial == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\nmodel.addCons(2 * A + 3 * B + 5 * C <= 10000 / 10)\n## The company must produce at least 100 units in total across all products to meet the minimum order requirements.\nmodel.addCons(A + B + C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 990,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n// The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 400 units of any product to be produced.\n// A <= 400; B <= 400; C <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2). The company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The raw material constraint allows for a maximum of 400 units of any product to be produced. Please help the company to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=400) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n## Since pyscipopt does not support quadratic objective functions directly, we need to linearize the quadratic terms\n## Introduce new variables for the squares and constraints to ensure they are equal to the squares of the original variables\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A * A)\nmodel.addCons(B_sq == B * B)\nmodel.addCons(C_sq == C * C)\n\n## Calculate the profit\nProfit = 50 * A + 70 * B + 90 * C - 0.01 * (A_sq + B_sq + C_sq)\n\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for production\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 803,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 hours of labor and generates a profit of $10. \nEach unit of product B requires 3 hours of labor and generates a profit of $15. \nEach unit of product C requires 4 hours of labor and generates a profit of $20.\nThe plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor.\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Total labor hours: Labor_Hours = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n\n## Generate Constraint-1:\nThe plant has a total labor capacity of 1000 hours per week.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 50 units per week.\n// A >= 50",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. Each unit of product A requires 2 hours of labor and generates a profit of $10. Each unit of product B requires 3 hours of labor and generates a profit of $15. Each unit of product C requires 4 hours of labor and generates a profit of $20. The plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor. The plant has a total labor capacity of 1000 hours per week. The market demand for product A is at least 50 units per week. Please help the plant to determine the optimal production quantities of products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for product A is at least 50 units per week.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_Hours = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n## convert the division to multiplication\nmodel.addCons(obj * Labor_Hours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total labor capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 777,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer aims to maximize the profit per unit of resource used (either water or labor). The objective is to maximize the ratio of total profit to the sum of water and labor used.\n// Profit from A: Profit_A = 300 * A\n// Profit from B: Profit_B = 400 * B\n// Profit from C: Profit_C = 500 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 10,000 liters of water available for irrigation.\n// 200 * A + 300 * B + 400 * C <= 10000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\nFor Crop A, the expected profit per acre is $300, the water requirement is 200 liters per acre, and the labor requirement is 5 hours per acre.\nFor Crop B, the expected profit per acre is $400, the water requirement is 300 liters per acre, and the labor requirement is 8 hours per acre.\nFor Crop C, the expected profit per acre is $500, the water requirement is 400 liters per acre, and the labor requirement is 10 hours per acre.\nThe farmer has a total of 10,000 liters of water available for irrigation.\nPlease help the farmer to maximize the profit per unit of resource used (either water or labor), which is defined as the ratio of total profit to the sum of water and labor used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 300 * A\nProfit_B = 400 * B\nProfit_C = 500 * C\nResourceUsage = 200 * A + 300 * B + 400 * C + 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 10,000 liters of water available for irrigation.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n// Profit per unit of product A: ProfitA = 50 - 2 * Automation\n// Profit per unit of product B: ProfitB = 70 - 2 * Automation\n// Profit per unit of product C: ProfitC = 60 - 2 * Automation\n// Total profit: TotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process. The profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products. The company has a production capacity limit of 1000 units in total for all products. Please help the company determine the optimal number of units of each product and the level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfitA = 50 - 2 * Automation\nProfitB = 70 - 2 * Automation\nProfitC = 60 - 2 * Automation\nTotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and yields a profit of $10. \nEach unit of component B requires 3 hours of labor and yields a profit of $15. \nEach unit of component C requires 4 hours of labor and yields a profit of $20.\nThe plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Labor hours for A: Labor_A = 2 * A\n// Labor hours for B: Labor_B = 3 * B\n// Labor hours for C: Labor_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n\n## Generate Constraint-1:\nThe plant has a daily labor budget of 100 hours.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit. The labor requirements and profit per unit for each component are given in the following Table.\n\n| Component | Labor Hours | Profit per Unit |\n|-----------|-------------|-----------------|\n| A         | 2 hours     | $10             |\n| B         | 3 hours     | $15             |\n| C         | 4 hours     | $20             |\n\nThe plant has a daily labor budget of 100 hours. Please help the plant to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_A = 2 * A\nLabor_B = 3 * B\nLabor_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor_A + Labor_B + Labor_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily labor budget of 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 689,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe Chocolate cake sells for $20, costs $8 in ingredients, and takes 1.5 hours to bake. \nThe Vanilla cake sells for $18, costs $7 in ingredients, and takes 1 hour to bake. \nThe Strawberry cake sells for $22, costs $9 in ingredients, and takes 2 hours to bake.\nThe bakery aims to maximize the profit efficiency, which is defined as the total profit divided by the total baking time.\n// Profit_Chocolate = 20 * C - 8 * C\n// Profit_Vanilla = 18 * V - 7 * V\n// Profit_Strawberry = 22 * S - 9 * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 2 * S)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1500 for ingredients.\n// 8 * C + 7 * V + 9 * S <= 1500\n\n## Generate Constraint-2:\nThe bakery has a maximum baking capacity of 100 hours.\n// 1.5 * C + 1 * V + 2 * S <= 100\n\n## Generate Constraint-3:\nThe bakery can only produce a maximum of 100 cakes in total.\n// C + V + S <= 100",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for the upcoming holiday season. The Chocolate cake sells for $20, costs $8 in ingredients, and takes 1.5 hours to bake. The Vanilla cake sells for $18, costs $7 in ingredients, and takes 1 hour to bake. The Strawberry cake sells for $22, costs $9 in ingredients, and takes 2 hours to bake. The bakery aims to maximize the profit efficiency, which is defined as the total profit divided by the total baking time. The bakery has a budget of $1500 for ingredients and a maximum baking capacity of 100 hours. Additionally, the bakery can only produce a maximum of 100 cakes in total. Please help the bakery determine the optimal number of each type of cake to bake to maximize their profit efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (20 - 8) * C\nProfit_Vanilla = (18 - 7) * V\nProfit_Strawberry = (22 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(8 * C + 7 * V + 9 * S <= 1500)\n## The bakery has a maximum baking capacity of 100 hours.\nmodel.addCons(1.5 * C + 1 * V + 2 * S <= 100)\n## The bakery can only produce a maximum of 100 cakes in total.\nmodel.addCons(C + V + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(C))\n    print(\"Number of Vanilla Cakes: \", model.getVal(V))\n    print(\"Number of Strawberry Cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n// Total revenue: Revenue = 50A + 70B + 90C\n// Total cost: Cost = 1000 + 20A^2 + 15B^2 + 25C^2\n// So, the objective function is: Maximize (Revenue - Cost) = 50A + 70B + 90C - (1000 + 20A^2 + 15B^2 + 25C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\n// 2A + 3B + 4C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units to produce for each product to optimize its profit. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost = 1000 + 20A^2 + 15B^2 + 25C^2. The company aims to maximize its net profit, which is the total revenue minus the total cost.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $90             | 4 hours                  |\n\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\n\nPlease help the company to maximize its net profit, which is the total revenue minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 1000 + 20 * A**2 + 15 * B**2 + 25 * C**2\n## the objective function is: Maximize (Revenue - Cost)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours, and the production time for each unit of product A, B, and C is 2 hours, 3 hours, and 4 hours, respectively.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"number of acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre.\nFor Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre.\nFor Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops).\n// Total profit: Profit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\n// Total water usage: Water = 200 * Wheat + 250 * Corn + 150 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for planting.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for seeds and fertilizers.\n// (10 * Wheat) + (12 * Corn) + (15 * Soybeans) <= 5000\n\n## Generate Constraint-3:\nThe farmer wants to ensure at least 30 acres are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres of each crop to plant this season. For Wheat, the expected yield is 50 bushels per acre, the selling price is $10 per bushel, and the water requirement is 200 gallons per acre. For Corn, the expected yield is 60 bushels per acre, the selling price is $12 per bushel, and the water requirement is 250 gallons per acre. For Soybeans, the expected yield is 40 bushels per acre, the selling price is $15 per bushel, and the water requirement is 150 gallons per acre. The farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water used for all crops). The farmer has 100 acres of land available for planting and a budget of $5000 for seeds and fertilizers. The farmer also wants to ensure at least 30 acres are dedicated to each crop. Please help the farmer determine the optimal number of acres to plant for each crop to maximize the Profit-Water Usage ratio.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 acres are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # number of acres of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # number of acres of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # number of acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * 10 * Wheat + 60 * 12 * Corn + 40 * 15 * Soybeans\nWater = 200 * Wheat + 250 * Corn + 150 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 acres of land available for planting.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farmer has a budget of $5000 for seeds and fertilizers.\nmodel.addCons(10 * Wheat + 12 * Corn + 15 * Soybeans <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Number of Acres of Corn: \", model.getVal(Corn))\n    print(\"Number of Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1042,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the number of machines and workers to optimize production.\n// {\"number of machines for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers for product 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe plant produces three products. The efficiency of machines and workers varies per product. \nFor product 1, each machine can produce 10 units per hour, and each worker can assemble 5 units per hour. \nFor product 2, each machine can produce 15 units per hour, and each worker can assemble 7 units per hour. \nThe plant aims to maximize the total production rate while considering the cost of labor and machine usage.\n// The production rate for product 1: P1 = 10 * M1 + 5 * W1\n// The production rate for product 2: P2 = 15 * M2 + 7 * W2\n// The objective function is: Maximize (P1 + P2) / (M1 + M2 + W1 + W2)\n\n## Generate Constraint-1:\nThe plant has a total of 30 machines available.\n// M1 + M2 <= 30\n\n## Generate Constraint-2:\nThere are 50 workers available in total.\n// W1 + W2 <= 50",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the number of machines and workers to optimize production. The efficiency of machines and workers varies per product. For product 1, each machine can produce 10 units per hour, and each worker can assemble 5 units per hour. For product 2, each machine can produce 15 units per hour, and each worker can assemble 7 units per hour. The plant aims to maximize the total production rate while considering the cost of labor and machine usage.\n\n| Product | Machine Efficiency (units/hour) | Worker Efficiency (units/hour) |\n|---------|---------------------------------|--------------------------------|\n| 1       | 10                              | 5                              |\n| 2       | 15                              | 7                              |\n\nThe plant has a total of 30 machines available. There are 50 workers available in total. Please help the plant manager to maximize the total production rate, which is defined as the sum of the production rates of both products divided by the total number of machines and workers.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for product 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers for product 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for product 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers for product 2\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP1 = 10 * M1 + 5 * W1\nP2 = 15 * M2 + 7 * W2\nTotalResources = M1 + M2 + W1 + W2\n## the objective function is: Maximize (P1 + P2) / TotalResources\n## convert the division to multiplication\nmodel.addCons(obj * TotalResources == P1 + P2)\n\n# Add constraints\n## The plant has a total of 30 machines available.\nmodel.addCons(M1 + M2 <= 30)\n## There are 50 workers available in total.\nmodel.addCons(W1 + W2 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product 1: \", model.getVal(M1))\n    print(\"Number of Workers for Product 1: \", model.getVal(W1))\n    print(\"Number of Machines for Product 2: \", model.getVal(M2))\n    print(\"Number of Workers for Product 2: \", model.getVal(W2))\n    print(\"Maximized Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. \nFor product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. \nFor product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20.\nThe company wants to maximize the total net profit, considering both production and storage costs.\n// NetProfit_P1 = (100 - 60 - 10) * P1\n// NetProfit_P2 = (120 - 70 - 15) * P2\n// NetProfit_P3 = (150 - 90 - 20) * P3\n// So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe company has a limited budget for production costs, which is $10,000.\n// 60 * P1 + 70 * P2 + 90 * P3 <= 10,000\n\n## Generate Constraint-3:\nDue to market demand, the production of P1 must not exceed twice the production of P2.\n// P1 <= 2 * P2\n\n## Generate Constraint-4:\nThe company has a storage capacity constraint of 150 units.\n// P1 + P2 + P3 <= 150\n\n## Generate Constraint-5:\nThe company must produce at least 10 units of each product to meet minimum order requirements.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of products: P1, P2, and P3. They need to determine the production quantities of each product to optimize their profit. For product P1, the revenue per unit is $100, the production cost per unit is $60, and the storage cost per unit is $10. For product P2, the revenue per unit is $120, the production cost per unit is $70, and the storage cost per unit is $15. For product P3, the revenue per unit is $150, the production cost per unit is $90, and the storage cost per unit is $20. The company has a total production capacity of 200 units and a limited budget for production costs, which is $10,000. Due to market demand, the production of P1 must not exceed twice the production of P2. The company also has a storage capacity constraint of 150 units and must produce at least 10 units of each product to meet minimum order requirements. Please help the company to maximize the total net profit, considering both production and storage costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=10) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=10) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=10) # quantity of P3\n\n# Define objective function\nNetProfit_P1 = (100 - 60 - 10) * P1\nNetProfit_P2 = (120 - 70 - 15) * P2\nNetProfit_P3 = (150 - 90 - 20) * P3\n# So, the objective function is: Maximize (NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit_P1 + NetProfit_P2 + NetProfit_P3)\n\n# Add constraints\n# The company has a total production capacity of 200 units.\nmodel.addCons(P1 + P2 + P3 <= 200)\n# The company has a limited budget for production costs, which is $10,000.\nmodel.addCons(60 * P1 + 70 * P2 + 90 * P3 <= 10000)\n# Due to market demand, the production of P1 must not exceed twice the production of P2.\nmodel.addCons(P1 <= 2 * P2)\n# The company has a storage capacity constraint of 150 units.\nmodel.addCons(P1 + P2 + P3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 988,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency.\n// {\"hours allocated to Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours allocated to Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades. The initial production rate for each product is 100 units per hour. The company aims to maximize the total production output.\n// Production output for Product 1: P1 = (100 + 0.005 * Efficiency) * H1\n// Production output for Product 2: P2 = (100 + 0.005 * Efficiency) * H2\n// Production output for Product 3: P3 = (100 + 0.005 * Efficiency) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe investment in production efficiency upgrades cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nAt least 40 hours must be allocated to each product type.\n// H1 >= 40; H2 >= 40; H3 >= 40\n\n## Generate Constraint-4:\nThe total production hours for Product 1 and Product 2 must not exceed 100 hours.\n// H1 + H2 <= 100",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the amount of money to invest in enhancing the production line's efficiency. The production rate for each product type increases by 5 units per hour for every $10,000 invested in efficiency upgrades, with an initial production rate of 100 units per hour for each product. The company aims to maximize the total production output.\n\n| Product | Initial Production Rate | Efficiency Impact |\n|---------|-------------------------|-------------------|\n| 1       | 100 units/hour          | 5 units/hour per $10,000 |\n| 2       | 100 units/hour          | 5 units/hour per $10,000 |\n| 3       | 100 units/hour          | 5 units/hour per $10,000 |\n\nThe company has a total of 168 hours available for production in a week. The investment in production efficiency upgrades cannot exceed $50,000. At least 40 hours must be allocated to each product type. The total production hours for Product 1 and Product 2 must not exceed 100 hours.\n\nPlease help the company determine the optimal allocation of hours to each product type and the investment in production efficiency to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=40) # hours allocated to Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=40) # hours allocated to Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=40) # hours allocated to Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\nP1 = (100 + 0.005 * Efficiency) * H1\nP2 = (100 + 0.005 * Efficiency) * H2\nP3 = (100 + 0.005 * Efficiency) * H3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\nmodel.addCons(Efficiency <= 50000)\nmodel.addCons(H1 + H2 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Investment in production efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1274,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency.\n// {\"hours for production line A\": \"P_A\", \"range\": \"P_A >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"P_B\", \"range\": \"P_B >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"P_C\", \"range\": \"P_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The plant aims to maximize the total production value, where the value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit.\n// The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n// The objective function is: Maximize V\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P_A + P_B + P_C <= 100\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// P_A <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 30 hours per week.\n// P_B <= 30\n\n## Generate Constraint-4:\nThe production line C can operate for a maximum of 50 hours per week.\n// P_C <= 50",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant manager needs to determine the number of hours each production line should operate to optimize production efficiency. Each production line has a different efficiency rate. Production line A produces 10 units of product A per hour, line B produces 15 units of product B per hour, and line C produces 20 units of product C per hour. The value of product A is $5 per unit, product B is $7 per unit, and product C is $9 per unit. The plant aims to maximize the total production value. The total operating hours for all production lines must not exceed 100 hours per week. The production line A can operate for a maximum of 40 hours per week. The production line B can operate for a maximum of 30 hours per week. The production line C can operate for a maximum of 50 hours per week. Please help the plant manager to maximize the total production value.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP_A = model.addVar(vtype=\"CONTINUOUS\", name=\"P_A\", lb=0) # hours for production line A\nP_B = model.addVar(vtype=\"CONTINUOUS\", name=\"P_B\", lb=0) # hours for production line B\nP_C = model.addVar(vtype=\"CONTINUOUS\", name=\"P_C\", lb=0) # hours for production line C\n\n# Define objective function\n## The total production value is: V = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\nV = 10 * P_A * 5 + 15 * P_B * 7 + 20 * P_C * 9\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize V\nmodel.addCons(obj == V)\n\n# Add constraints\n## The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P_A + P_B + P_C <= 100)\n## The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(P_A <= 40)\n## The production line B can operate for a maximum of 30 hours per week.\nmodel.addCons(P_B <= 30)\n## The production line C can operate for a maximum of 50 hours per week.\nmodel.addCons(P_C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(P_A))\n    print(\"Hours for Production Line B: \", model.getVal(P_B))\n    print(\"Hours for Production Line C: \", model.getVal(P_C))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from selling all three products.\n// Profit_A = (10 - 0.001 * (A - 100)) * A\n// Profit_B = (15 - 0.001 * (B - 100)) * B\n// Profit_C = (20 - 0.001 * (C - 100)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours.\n// 2 * A + 3 * B + 4 * C <= 1500\n\n## Generate Constraint-3:\nThe market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units.\n// A <= 200; B <= 300; C <= 400",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from selling all three products.\n\n| Product | Profit per Unit | Raw Material per Unit | Labor Hours per Unit |\n|---------|-----------------|------------------------|----------------------|\n| A       | 10$             | 5 kg                   | 2 hours              |\n| B       | 15$             | 8 kg                   | 3 hours              |\n| C       | 20$             | 10 kg                  | 4 hours              |\n\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg. The company also has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours. Additionally, the market has a demand limit for each product. The demand limit for Product A is 200 units, for Product B is 300 units, and for Product C is 400 units.\n\nPlease help the company to determine the optimal production quantities of products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.001 * (A - 100)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 - 0.001 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.001 * (B - 100)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=300)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 - 0.001 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.001 * (C - 100)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=400)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 - 0.001 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1685,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe company wants to produce at least 5 units of each product.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe company has a maximum of 150 hours available for production.\n// 3 * A + 4 * B + 5 * C <= 150\n\n## Generate Constraint-4:\nThe production of Product C cannot exceed twice the production of Product A.\n// C <= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 3 hours         |\n| B       | 30$           | 15$           | 4 hours         |\n| C       | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $1000 for material costs. The company wants to produce at least 5 units of each product. The company has a maximum of 150 hours available for production. The production of Product C cannot exceed twice the production of Product A. \nPlease help the company to maximize the profit rate, which is defined as the total profit divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 5 units of each product.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n## The company has a maximum of 150 hours available for production.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 150)\n## The production of Product C cannot exceed twice the production of Product A.\nmodel.addCons(C <= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 970,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The objective is to maximize the total profit after deducting the production cost.\n// The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n// The profit from tablets: P_T = 150 * T - 0.03 * T^2\n// The profit from laptops: P_L = 200 * L - 0.02 * L^2\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 devices.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe company has a marketing budget that allows it to effectively market up to 500 smartphones.\n// S <= 500",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit. The profit from each smartphone is $100, from each tablet is $150, and from each laptop is $200. However, the production cost increases nonlinearly with the number of devices produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.03 * T^2, and for laptops is 0.02 * L^2. The objective is to maximize the total profit after deducting the production cost.\n\n| Device     | Profit per Unit | Production Cost Formula |\n|------------|-----------------|-------------------------|\n| Smartphones| $100            | 0.05 * S^2              |\n| Tablets    | $150            | 0.03 * T^2              |\n| Laptops    | $200            | 0.02 * L^2              |\n\nThe total production capacity is limited to 1000 devices. The company has a marketing budget that allows it to effectively market up to 500 smartphones.\n\nPlease help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit from smartphones: P_S = 100 * S - 0.05 * S^2\n## The profit from tablets: P_T = 150 * T - 0.03 * T^2\n## The profit from laptops: P_L = 200 * L - 0.02 * L^2\n## So, the objective function is: Maximize P = P_S + P_T + P_L\nmodel.addCons(obj == 100 * S - 0.05 * S**2 + 150 * T - 0.03 * T**2 + 200 * L - 0.02 * L**2)\n\n# Add constraints\n## The total production capacity is limited to 1000 devices.\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n// Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\n// Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\n// Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $5000 for seeds and fertilizers. The cost per acre for crop A is $30, for crop B is $40, and for crop C is $50.\n// 30 * A + 40 * B + 50 * C <= 5000\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre and the cost per acre for seeds and fertilizers for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost per Acre for Seeds and Fertilizers |\n|------|-----------------|-----------------------------------------|\n| A    | $100            | $30                                     |\n| B    | $150            | $40                                     |\n| C    | $200            | $50                                     |\n\nDue to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm has a total of 100 acres available for cultivation and a budget of $5000 for seeds and fertilizers. The farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health. Please help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=10)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=10, ub=100)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=10)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=10, ub=100)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=10, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 1)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1015,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the cost of fertilizers and the labor required for each crop.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 worth of fertilizer and 3 hours of labor. \nThe profit per acre for corn is $300, with a fertilizer cost of $70 and 4 hours of labor. \nThe profit per acre for soybeans is $150, with a fertilizer cost of $30 and 2 hours of labor.\nThe farmer aims to maximize the net profit per labor hour (which is defined as the sum of the profits minus the sum of the fertilizer costs, divided by the total labor hours).\n// Profit from wheat: Profit_W = (200 - 50) * W\n// Profit from corn: Profit_C = (300 - 70) * C\n// Profit from soybeans: Profit_S = (150 - 30) * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S - (50 * W + 70 * C + 30 * S)) / (3 * W + 4 * C + 2 * S)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for fertilizer costs.\n// 50 * W + 70 * C + 30 * S <= 10000",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the cost of fertilizers and the labor required for each crop.\nThe profit per acre for wheat is $200, but it requires $50 worth of fertilizer and 3 hours of labor. \nThe profit per acre for corn is $300, with a fertilizer cost of $70 and 4 hours of labor. \nThe profit per acre for soybeans is $150, with a fertilizer cost of $30 and 2 hours of labor.\nThe farmer aims to maximize the net profit per labor hour (which is defined as the sum of the profits minus the sum of the fertilizer costs, divided by the total labor hours).\nThe farmer has a budget of $10,000 for fertilizer costs.\nPlease help the farmer determine the optimal allocation of land to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = (200 - 50) * W\nProfit_C = (300 - 70) * C\nProfit_S = (150 - 30) * S\nFertilizerCost = 50 * W + 70 * C + 30 * S\nLaborHours = 3 * W + 4 * C + 2 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S - FertilizerCost) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_W + Profit_C + Profit_S - FertilizerCost)\n\n# Add constraints\n## The farmer has a budget of $10,000 for fertilizer costs.\nmodel.addCons(50 * W + 70 * C + 30 * S <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investment in production efficiency.\n// Efficiency <= 10000",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product and the investment in production efficiency to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit, cost of raw materials per unit, and initial production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit | Initial Production Time per Unit |\n|---------|-----------------|--------------------------------|----------------------------------|\n| A       | $100            | $30                            | 5 hours                          |\n| B       | $150            | $50                            | 6 hours                          |\n\nFor every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The company has a total production capacity of 200 hours and a budget of $10,000 for investment in production efficiency. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n## The company has a budget of $10,000 for investment in production efficiency.\nmodel.addCons(Efficiency <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints.\n// {\"daily production quantity of ChemicalA\": \"ChemicalAProduction\", \"range\": \"ChemicalAProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalB\": \"ChemicalBProduction\", \"range\": \"ChemicalBProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalC\": \"ChemicalCProduction\", \"range\": \"ChemicalCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals.\n// Total daily profit: Profit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily production capacity of the company is limited to 1000 units.\n// ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\n// ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction)\n\n## Generate Constraint-3:\nThe production of ChemicalA must be at least twice the production of ChemicalB.\n// ChemicalAProduction >= 2 * ChemicalBProduction\n\n## Generate Constraint-4:\nThe company has a daily budget constraint for raw materials, which is $50,000. The cost of raw materials per unit for ChemicalA is $20, ChemicalB is $30, and ChemicalC is $40.\n// 20 * ChemicalAProduction + 30 * ChemicalBProduction + 40 * ChemicalCProduction <= 50,000",
        "question": "A manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals. The total daily production capacity of the company is limited to 1000 units. Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production. The production of ChemicalA must be at least twice the production of ChemicalB. The company has a daily budget constraint for raw materials, which is $50,000. The cost of raw materials per unit for ChemicalA is $20, ChemicalB is $30, and ChemicalC is $40. Please help the company to maximize the total daily profit from the production of these chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalAProduction\", lb=0) # daily production quantity of ChemicalA\nChemicalBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBProduction\", lb=0) # daily production quantity of ChemicalB\nChemicalCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCProduction\", lb=0) # daily production quantity of ChemicalC\n\n# Define objective function\nProfit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total daily production capacity of the company is limited to 1000 units.\nmodel.addCons(ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000)\n# Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\nmodel.addCons(ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction))\n# The production of ChemicalA must be at least twice the production of ChemicalB.\nmodel.addCons(ChemicalAProduction >= 2 * ChemicalBProduction)\n# The company has a daily budget constraint for raw materials, which is $50,000.\nmodel.addCons(20 * ChemicalAProduction + 30 * ChemicalBProduction + 40 * ChemicalCProduction <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production of ChemicalA: \", model.getVal(ChemicalAProduction))\n    print(\"Daily Production of ChemicalB: \", model.getVal(ChemicalBProduction))\n    print(\"Daily Production of ChemicalC: \", model.getVal(ChemicalCProduction))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and yields a profit of $10. \nEach unit of component B requires 3 hours of labor and yields a profit of $15. \nEach unit of component C requires 4 hours of labor and yields a profit of $20.\nThe plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Labor hours for A: Labor_A = 2 * A\n// Labor hours for B: Labor_B = 3 * B\n// Labor hours for C: Labor_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n\n## Generate Constraint-1:\nThe plant has a daily labor budget of 100 hours.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe plant must produce at least 5 units of each component daily.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe plant has a storage capacity limit that allows for a maximum of 20 units of component A, 15 units of component B, and 10 units of component C.\n// A <= 20; B <= 15; C <= 10",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit. Each unit of component A requires 2 hours of labor and yields a profit of $10. Each unit of component B requires 3 hours of labor and yields a profit of $15. Each unit of component C requires 4 hours of labor and yields a profit of $20. The plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours). The plant has a daily labor budget of 100 hours. The plant must produce at least 5 units of each component daily. The plant has a storage capacity limit that allows for a maximum of 20 units of component A, 15 units of component B, and 10 units of component C. Please help the plant determine the optimal number of each component to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 5 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_A = 2 * A\nLabor_B = 3 * B\nLabor_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor_A + Labor_B + Labor_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily labor budget of 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The plant has a storage capacity limit that allows for a maximum of 20 units of component A, 15 units of component B, and 10 units of component C.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 15)\nmodel.addCons(C <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 890,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Revenue from product A: R_A = 20 * A\n// Revenue from product B: R_B = 30 * B\n// Revenue from product C: R_C = 40 * C\n// Cost of product A: C_A = 10 * A\n// Cost of product B: C_B = 20 * B\n// Cost of product C: C_C = 30 * C\n// Total profit: P = (R_A + R_B + R_C) - (C_A + C_B + C_C)\n// So, the objective function is: Maximize P = (20 * A + 30 * B + 40 * C) - (10 * A + 20 * B + 30 * C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $20                      |\n| C       | $40             | $30                      |\n\nThe company has a total budget of $5000 for production costs. Please help the company to maximize the total profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = (20 * A + 30 * B + 40 * C) - (10 * A + 20 * B + 30 * C)\nmodel.addCons(obj == (20 * A + 30 * B + 40 * C) - (10 * A + 20 * B + 30 * C))\n\n# Add constraints\n## The company has a total budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 791,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and the amount to invest in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops. The total area available for cultivation is 100 acres, and the farm has a budget of $50,000 for irrigation investments. Please help the farm determine the optimal allocation of area and investment to maximize the total revenue.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=0)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=0)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)  # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\nmodel.addCons(AreaA + AreaB + AreaC <= 100)\nmodel.addCons(Irrigation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1085,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor.\nThe profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor.\nThe profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor.\nThe company wants to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.\n// Profit from product A: PA = 50 * A - (20 * A + 10 * A)\n// Profit from product B: PB = 70 * B - (30 * B + 15 * B)\n// Profit from product C: PC = 90 * C - (40 * C + 20 * C)\n// So, the objective function is: Maximize (PA + PB + PC)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a budget of $5,000 for labor.\n// 10 * A + 15 * B + 20 * C <= 5000\n\n## Generate Constraint-3:\nThe total production capacity is limited to 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe production of product A must be at least 20% of the total production.\n// A >= 0.2 * (A + B + C)\n\n## Generate Constraint-5:\nThe production of product C must not exceed 50% of the total production.\n// C <= 0.5 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the costs of raw materials and labor. The profit from product A is $50 per unit, but it requires $20 per unit in raw materials and $10 per unit in labor. The profit from product B is $70 per unit, but it requires $30 per unit in raw materials and $15 per unit in labor. The profit from product C is $90 per unit, but it requires $40 per unit in raw materials and $20 per unit in labor. The company has a budget of $10,000 for raw materials and $5,000 for labor. The total production capacity is limited to 200 units across all products. The production of product A must be at least 20% of the total production, and the production of product C must not exceed 50% of the total production. Please help the company to maximize the total profit, which is the sum of the profits from all products minus the total cost of raw materials and labor.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\nPA = 50 * A - (20 * A + 10 * A)\nPB = 70 * B - (30 * B + 15 * B)\nPC = 90 * C - (40 * C + 20 * C)\n# So, the objective function is: Maximize (PA + PB + PC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The company has a budget of $10,000 for raw materials.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n# The company has a budget of $5,000 for labor.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 5000)\n# The total production capacity is limited to 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n# The production of product A must be at least 20% of the total production.\nmodel.addCons(A >= 0.2 * (A + B + C))\n# The production of product C must not exceed 50% of the total production.\nmodel.addCons(C <= 0.5 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted).\n// Profit per acre of A: Profit_A = (100 - 20) * A\n// Profit per acre of B: Profit_B = (150 - 30) * B\n// Profit per acre of C: Profit_C = (200 - 40) * C\n// Total acres planted: Total_acres = A + B + C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, the cost of fertilizers varies with the type of crop and the total acres planted. The cost per acre for crop A is $20, for crop B is $30, and for crop C is $40. The farmer aims to maximize the net profit per acre (which is defined as the profit per acre minus the cost per acre, divided by the total acres planted). The farm has a total of 100 acres available for planting. The farmer wants to plant at least 10 acres of each crop. Please help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 20) * A\nProfit_B = (150 - 30) * B\nProfit_C = (200 - 40) * C\nTotal_acres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Total_acres\n## convert the division to multiplication\nmodel.addCons(obj * Total_acres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for planting.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 755,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop.\n// {\"area of land for CropA\": \"CropAArea\", \"range\": \"CropAArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropB\": \"CropBArea\", \"range\": \"CropBArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropC\": \"CropCArea\", \"range\": \"CropCArea >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400.\nThe farm wants to maximize the net profit per liter of water used.\n// Profit_CropA = 1000 * CropAArea - 200 * CropAArea\n// Profit_CropB = 1500 * CropBArea - 300 * CropBArea\n// Profit_CropC = 2000 * CropCArea - 400 * CropCArea\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// CropAArea + CropBArea + CropCArea <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 600,000 liters.\n// 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea <= 600,000\n\n## Generate Constraint-3:\nThe farm has a budget of $15,000 for fertilizer costs.\n// 200 * CropAArea + 300 * CropBArea + 400 * CropCArea <= 15,000\n\n## Generate Constraint-4:\nDue to soil conditions, the area allocated to CropB must be at least half of the area allocated to CropA.\n// CropBArea >= 0.5 * CropAArea",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop. The profit per hectare, water usage per hectare, and fertilizer cost per hectare for each crop are given in the following Table.\n\n| Crop   | Profit per Hectare | Water Usage per Hectare | Fertilizer Cost per Hectare |\n|--------|---------------------|-------------------------|-----------------------------|\n| CropA  | $1000               | 5000 liters             | $200                        |\n| CropB  | $1500               | 7000 liters             | $300                        |\n| CropC  | $2000               | 9000 liters             | $400                        |\n\nThe farm has a total of 100 hectares of land available. The farm has a limited water supply of 600,000 liters. The farm has a budget of $15,000 for fertilizer costs. Due to soil conditions, the area allocated to CropB must be at least half of the area allocated to CropA. \nPlease help the farm to maximize the net profit per liter of water used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropAArea\", lb=0) # area of land for CropA\nCropBArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropBArea\", lb=0) # area of land for CropB\nCropCArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropCArea\", lb=0) # area of land for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (1000 - 200) * CropAArea\nProfit_CropB = (1500 - 300) * CropBArea\nProfit_CropC = (2000 - 400) * CropCArea\nWaterUsage = 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(CropAArea + CropBArea + CropCArea <= 100)\n## The farm has a limited water supply of 600,000 liters.\nmodel.addCons(5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea <= 600000)\n## The farm has a budget of $15,000 for fertilizer costs.\nmodel.addCons(200 * CropAArea + 300 * CropBArea + 400 * CropCArea <= 15000)\n## Due to soil conditions, the area allocated to CropB must be at least half of the area allocated to CropA.\nmodel.addCons(CropBArea >= 0.5 * CropAArea)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of CropA: \", model.getVal(CropAArea))\n    print(\"Area of CropB: \", model.getVal(CropBArea))\n    print(\"Area of CropC: \", model.getVal(CropCArea))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\n// {\"production rate of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The objective is to maximize the total profit, which is the difference between the revenue and the cost.\n// The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n// The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n// The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\n// The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total production rate cannot exceed 200 units per day.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe market demand for product 1 is at least 50 units per day.\n// P1 >= 50\n\n## Generate Constraint-3:\nThe production line can handle a maximum of 120 units of product 2 per day.\n// P2 <= 120",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand. The profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The total production rate cannot exceed 200 units per day. The market demand for product 1 is at least 50 units per day. The production line can handle a maximum of 120 units of product 2 per day. Please help the company to maximize the total profit, which is the difference between the revenue and the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of product 3\n\n# Define objective function\nC1 = 0.01 * P1**2 + 0.5 * P1 + 2\nC2 = 0.02 * P2**2 + 0.8 * P2 + 3\nC3 = 0.03 * P3**2 + 1.0 * P3 + 4\nProfit = 5 * P1 + 10 * P2 + 15 * P3 - (C1 + C2 + C3)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200)\nmodel.addCons(P1 >= 50)\nmodel.addCons(P2 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 844,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000, and the total available labor hours are 1000 hours. Please help the plant manager to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 535,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8\n\n## Generate Constraint-2:\nThe production of product A requires at least 1 hour per day due to contractual obligations.\n// H_A >= 1\n\n## Generate Constraint-3:\nThe production of product B cannot exceed 3 hours per day due to limited raw materials.\n// H_B <= 3\n\n## Generate Constraint-4:\nThe production of product C must be at least twice the production of product A to maintain market share.\n// H_C >= 2 * H_A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different and depends on the market demand and production costs. The details are given in the following Table.\n\n| Product | Profit per Hour |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a total of 8 hours available for production in a day. The production of product A requires at least 1 hour per day due to contractual obligations. The production of product B cannot exceed 3 hours per day due to limited raw materials. The production of product C must be at least twice the production of product A to maintain market share.\n\nPlease help the company to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=0) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n## The production of product A requires at least 1 hour per day due to contractual obligations.\nmodel.addCons(H_A >= 1)\n## The production of product B cannot exceed 3 hours per day due to limited raw materials.\nmodel.addCons(H_B <= 3)\n## The production of product C must be at least twice the production of product A to maintain market share.\nmodel.addCons(H_C >= 2 * H_A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 929,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand.\n// {\"number of solar panels on building 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building 1 generates 2 kWh per day, on building 2 generates 3 kWh per day, and on building 3 generates 4 kWh per day. The cost of installing a solar panel on building 1 is $500, on building 2 is $600, and on building 3 is $700. The company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh.\n// Total daily energy generated: E = 2 * P1 + 3 * P2 + 4 * P3\n// Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\n// So, the objective function is: Minimize C\n\n## Generate Constraint-1:\nThe total daily energy generated must meet or exceed 100 kWh.\n// 2 * P1 + 3 * P2 + 4 * P3 >= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand. The energy generation and installation cost for each building are given in the following Table.\n\n| Building | Energy Generation per Panel (kWh/day) | Installation Cost per Panel ($) |\n|----------|--------------------------------------|---------------------------------|\n| 1        | 2                                    | 500                             |\n| 2        | 3                                    | 600                             |\n| 3        | 4                                    | 700                             |\n\nThe company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh. Please help the company determine the optimal number of solar panels to install on each building.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels on building 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels on building 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels on building 3\n\n# Define objective function\n## Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\n## So, the objective function is: Minimize C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == 500 * P1 + 600 * P2 + 700 * P3)\n\n# Add constraints\n## The total daily energy generated must meet or exceed 100 kWh.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels on Building 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels on Building 3: \", model.getVal(P3))\n    print(\"Minimized Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1033,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit.\nThe profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit.\nThe profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit.\nThe company wants to maximize its net profit, which is the total profit minus the total cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = 10A + 5B + 3C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10A + 5B + 3C <= 5000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 100 units across all products.\n// A + B + C <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of product A to fulfill a contract.\n// A >= 20\n\n## Generate Constraint-4:\nThe demand for product C is limited, and the company can only sell up to 30 units.\n// C <= 30\n\n## Generate Constraint-5:\nThe company aims to produce at least twice as many units of product B as product A.\n// B >= 2A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit. The profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit. The profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit. The profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit. The company has a budget of $5000 for production costs. The total production capacity is limited to 100 units across all products. The company must produce at least 20 units of product A to fulfill a contract. The demand for product C is limited, and the company can only sell up to 30 units. The company aims to produce at least twice as many units of product B as product A. Please help the company to maximize its net profit, which is the total profit minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=30) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50A + 70B + 90C\n## Total cost: Cost = 10A + 5B + 3C\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * A + 5 * B + 3 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 5 * B + 3 * C <= 5000)\n## The total production capacity is limited to 100 units across all products.\nmodel.addCons(A + B + C <= 100)\n## The company must produce at least 20 units of product A to fulfill a contract.\nmodel.addCons(A >= 20)\n## The demand for product C is limited, and the company can only sell up to 30 units.\nmodel.addCons(C <= 30)\n## The company aims to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 975,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000\n\n## Generate Constraint-2:\nDue to production constraints, the total number of machines produced cannot exceed 100 units.\n// MachineA_Units + MachineB_Units + MachineC_Units <= 100\n\n## Generate Constraint-3:\nMarket research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\n// MachineC_Units >= 0.5 * MachineA_Units",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n\n| Machine | Profit per Unit | Setup Cost per Unit |\n|---------|-----------------|---------------------|\n| MachineA | $500            | $100                |\n| MachineB | $700            | $150                |\n| MachineC | $900            | $200                |\n\nThe company has a limited budget for setup costs, which is $10,000. Due to production constraints, the total number of machines produced cannot exceed 100 units. Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each type of machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=0) # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=0) # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=0) # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n# Due to production constraints, the total number of machines produced cannot exceed 100 units.\nmodel.addCons(MachineA_Units + MachineB_Units + MachineC_Units <= 100)\n# Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\nmodel.addCons(MachineC_Units >= 0.5 * MachineA_Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: wheat, corn, and soybeans. The farm needs to determine how many acres to allocate to each crop to optimize its profit.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farm has a limited amount of fertilizer, which affects the yield of each crop. The fertilizer usage per acre for wheat is 2 units, for corn is 3 units, and for soybeans is 2.5 units. The farm aims to maximize its total profit, considering the nonlinear relationship between fertilizer usage and yield.\n// Profit from wheat: Profit_W = 200 * W * (1 - 0.01 * (2 * W / F)^2)\n// Profit from corn: Profit_C = 300 * C * (1 - 0.01 * (3 * C / F)^2)\n// Profit from soybeans: Profit_S = 250 * S * (1 - 0.01 * (2.5 * S / F)^2)\n// Where F is the total fertilizer available.\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farm has 500 units of fertilizer available.\n// 2 * W + 3 * C + 2.5 * S <= 500",
        "question": "A farm produces three types of crops: wheat, corn, and soybeans. The farm needs to determine how many acres to allocate to each crop to optimize its profit. The profit per acre and the fertilizer usage per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Fertilizer Usage per Acre |\n|----------|-----------------|---------------------------|\n| Wheat    | $200            | 2 units                   |\n| Corn     | $300            | 3 units                   |\n| Soybeans | $250            | 2.5 units                 |\n\nThe farm has a total of 100 acres available for cultivation and 500 units of fertilizer available. The farm aims to maximize its total profit, considering the nonlinear relationship between fertilizer usage and yield. Please help the farm to determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Calculate Profit_W, Profit_C, Profit_S considering the nonlinear relationship between fertilizer usage and yield\nF = 500 # total fertilizer available\nProfit_W = 200 * W * (1 - 0.01 * (2 * W / F)**2)\nProfit_C = 300 * C * (1 - 0.01 * (3 * C / F)**2)\nProfit_S = 250 * S * (1 - 0.01 * (2.5 * S / F)**2)\n\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(W + C + S <= 100)\n## The farm has 500 units of fertilizer available.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"amount of raw materials to stock\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for automation upgrades.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 10,000 units.\n// Units <= 10000\n\n## Generate Constraint-3:\nThe amount of raw materials stocked must be sufficient to produce at least 5,000 units.\n// RawMaterials >= 5000 * Units",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock. The cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production.\n\nThe company has a budget of $50,000 for automation upgrades. The total number of units produced must not exceed 10,000 units. The amount of raw materials stocked must be sufficient to produce at least 5,000 units.\n\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0)  # amount of raw materials to stock\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * Automation) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(Units <= 10000)\nmodel.addCons(RawMaterials >= 5000 * Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Amount of Raw Materials to Stock: \", model.getVal(RawMaterials))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 749,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the distribution of products among the warehouses to minimize transportation costs and meet customer demand.\n// {\"number of products in warehouse 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of products in warehouse 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of products in warehouse 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to customers is based on the number of products stored. The cost function is nonlinear and varies with the square of the number of products. Specifically, the cost from warehouse 1 is 0.05 * P1^2, from warehouse 2 is 0.03 * P2^2, and from warehouse 3 is 0.04 * P3^2. The company aims to minimize the total transportation cost.\n// The objective function is: Minimize (0.05 * P1^2 + 0.03 * P2^2 + 0.04 * P3^2)\n\n## Generate Constraint-1:\nThe total number of products that can be stored across all warehouses is limited to 1000.\n// P1 + P2 + P3 <= 1000",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the distribution of products among the warehouses to minimize transportation costs and meet customer demand. The number of products in each warehouse is denoted as P1 for warehouse 1, P2 for warehouse 2, and P3 for warehouse 3. The transportation cost from each warehouse to customers is based on the number of products stored, with the cost function being nonlinear and varying with the square of the number of products. Specifically, the cost from warehouse 1 is 0.05 * P1^2, from warehouse 2 is 0.03 * P2^2, and from warehouse 3 is 0.04 * P3^2. The company aims to minimize the total transportation cost.\n\n| Warehouse | Cost Function       |\n|-----------|---------------------|\n| 1         | 0.05 * P1^2         |\n| 2         | 0.03 * P2^2         |\n| 3         | 0.04 * P3^2         |\n\nThe total number of products that can be stored across all warehouses is limited to 1000. Please help the company determine the optimal number of products to store in each warehouse to minimize the total transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of products in warehouse 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of products in warehouse 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of products in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize (0.05 * P1^2 + 0.03 * P2^2 + 0.04 * P3^2)\nmodel.addCons(obj == 0.05 * P1**2 + 0.03 * P2**2 + 0.04 * P3**2)\n\n# Add constraints\n## The total number of products that can be stored across all warehouses is limited to 1000.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Products in Warehouse 1: \", model.getVal(P1))\n    print(\"Number of Products in Warehouse 2: \", model.getVal(P2))\n    print(\"Number of Products in Warehouse 3: \", model.getVal(P3))\n    print(\"Minimized Total Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1126,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit and storage cost per unit for each component are given in the following Table.\n\n| Component | Profit per Unit | Storage Cost per Unit |\n|-----------|-----------------|-----------------------|\n| A         | $50             | $10                   |\n| B         | $70             | $15                   |\n| C         | $60             | $12                   |\n\nThe manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. Please help the manufacturer determine the optimal production levels for components A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 875,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function for each device is nonlinear:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\n// S <= 100; T <= 100; L <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies with the number produced due to economies of scale and market saturation, and is given by the following nonlinear profit functions:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\n\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type. Please help the company to maximize the total profit, which is the sum of the profits from each device:\nP_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2)\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=100) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=100) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nP_S = 100 * S - 0.5 * S**2\nP_T = 150 * T - 0.6 * T**2\nP_L = 200 * L - 0.7 * L**2\n## the objective function is: Maximize P_total = P_S + P_T + P_L\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\n## The company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\nmodel.addCons(S <= 100)\nmodel.addCons(T <= 100)\nmodel.addCons(L <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 778,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n// Profit from Crop A: Profit_A = (5 * 100 - 300) * A\n// Profit from Crop B: Profit_B = (7 * 120 - 400) * B\n// Profit from Crop C: Profit_C = (6 * 110 - 350) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The expected yield, selling price, and cost of cultivation for each crop are given in the following Table.\n\n| Crop | Expected Yield (tons/acre) | Selling Price ($/ton) | Cost of Cultivation ($/acre) |\n|------|---------------------------|----------------------|------------------------------|\n| A    | 5                         | 100                  | 300                          |\n| B    | 7                         | 120                  | 400                          |\n| C    | 6                         | 110                  | 350                          |\n\nThe farm has a total of 100 acres available for cultivation. The farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used). Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 - 300) * A\nProfit_B = (7 * 120 - 400) * B\nProfit_C = (6 * 110 - 350) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 968,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, with a production cost of $10 per unit and a power consumption of 5 watts per unit. \nThe profit per unit of E2 is $40, with a production cost of $15 per unit and a power consumption of 8 watts per unit. \nThe profit per unit of E3 is $50, with a production cost of $20 per unit and a power consumption of 10 watts per unit.\nThe manufacturer has a limited power supply of 500 watts. The goal is to maximize the profit per watt of power consumed.\n// Profit_E1 = 30 * Q1 - 10 * Q1\n// Profit_E2 = 40 * Q2 - 15 * Q2\n// Profit_E3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (5 * Q1 + 8 * Q2 + 10 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited power supply of 500 watts.\n// 5 * Q1 + 8 * Q2 + 10 * Q3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 200 units in total.\n// Q1 + Q2 + Q3 <= 200",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage. The profit per unit, production cost, and power consumption for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost | Power Consumption |\n|-----------|-----------------|-----------------|-------------------|\n| E1        | $30             | $10             | 5 watts           |\n| E2        | $40             | $15             | 8 watts           |\n| E3        | $50             | $20             | 10 watts          |\n\nThe manufacturer has a limited power supply of 500 watts. The manufacturer has a budget of $3000 for production costs. The manufacturer has a production capacity of 200 units in total. \nPlease help the manufacturer to maximize the profit per watt of power consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * Q1\nProfit_E2 = (40 - 15) * Q2\nProfit_E3 = (50 - 20) * Q3\nPowerConsumption = 5 * Q1 + 8 * Q2 + 10 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / PowerConsumption\n## convert the division to multiplication\nmodel.addCons(obj * PowerConsumption == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited power supply of 500 watts.\nmodel.addCons(5 * Q1 + 8 * Q2 + 10 * Q3 <= 500)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000)\n## The manufacturer has a production capacity of 200 units in total.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit per Watt: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 920,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\n// {\"number of pastries A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of pastries B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of pastries C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n// Profit from A: Profit_A = (2 - 0.5) * A\n// Profit from B: Profit_B = (3 - 1) * B\n// Profit from C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (15 * A + 20 * B + 25 * C)\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients.\n// 0.5 * A + 1 * B + 1.5 * C <= 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure it bakes at least 50 pastries of each type daily.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe bakery has a maximum of 8 hours (480 minutes) available for baking each day.\n// 15 * A + 20 * B + 25 * C <= 480",
        "question": "A bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery has a daily budget of $100 for ingredients. The bakery wants to ensure it bakes at least 50 pastries of each type daily. The bakery has a maximum of 8 hours (480 minutes) available for baking each day.\nPlease help the bakery to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to ensure it bakes at least 50 pastries of each type daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of pastries A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of pastries B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of pastries C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nBakingTime = 15 * A + 20 * B + 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 100)\n## The bakery has a maximum of 8 hours (480 minutes) available for baking each day.\nmodel.addCons(15 * A + 20 * B + 25 * C <= 480)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(A))\n    print(\"Number of Pastry B: \", model.getVal(B))\n    print(\"Number of Pastry C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 719,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of Wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of Corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $100, for Corn is $150, and for Soybeans is $120. Due to the soil quality and weather conditions, the profit per acre for each crop decreases nonlinearly as more acres are planted. Specifically, the profit per acre decreases by 0.1% for each additional acre planted beyond the first 50 acres for each crop. The farm aims to maximize the total profit from all crops.\n// Profit_W = (100 - 0.001 * (W - 50) * W) * W\n// Profit_C = (150 - 0.001 * (C - 50) * C) * C\n// Profit_S = (120 - 0.001 * (S - 50) * S) * S\n// So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\n\n## Generate Constraint-1:\nThe farm has a total of 200 acres available for planting.\n// W + C + S <= 200\n\n## Generate Constraint-2:\nThe farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health.\n// W >= 30; C >= 30; S >= 30\n\n## Generate Constraint-3:\nDue to water availability, the total acres of Corn and Soybeans must not exceed 120 acres.\n// C + S <= 120\n\n## Generate Constraint-4:\nThe farm has a budget constraint for seed and fertilizer. The cost per acre for Wheat is $20, for Corn is $30, and for Soybeans is $25. The total budget for seed and fertilizer is $5000.\n// 20 * W + 30 * C + 25 * S <= 5000",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for each crop decreases nonlinearly as more acres are planted beyond the first 50 acres, with a decrease of 0.1% for each additional acre. The farm aims to maximize the total profit from all crops. The cost per acre for seed and fertilizer is given in the following Table.\n\n| Crop     | Profit per Acre | Cost per Acre for Seed and Fertilizer |\n|----------|-----------------|---------------------------------------|\n| Wheat    | $100            | $20                                   |\n| Corn     | $150            | $30                                   |\n| Soybeans | $120            | $25                                   |\n\nThe farm has a total of 200 acres available for planting. The farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health. Due to water availability, the total acres of Corn and Soybeans must not exceed 120 acres. The farm has a budget constraint for seed and fertilizer, with a total budget of $5000.\n\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 30 acres to each crop to maintain crop diversity and soil health.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=30) # acres of Wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=30) # acres of Corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=30) # acres of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_W = (100 - 0.001 * (W - 50) * W) * W\n## Profit_C = (150 - 0.001 * (C - 50) * C) * C\n## Profit_S = (120 - 0.001 * (S - 50) * S) * S\n## So, the objective function is: Maximize Profit_W + Profit_C + Profit_S\nProfit_W = (100 - 0.001 * (W - 50) * W) * W\nProfit_C = (150 - 0.001 * (C - 50) * C) * C\nProfit_S = (120 - 0.001 * (S - 50) * S) * S\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farm has a total of 200 acres available for planting.\nmodel.addCons(W + C + S <= 200)\n## Due to water availability, the total acres of Corn and Soybeans must not exceed 120 acres.\nmodel.addCons(C + S <= 120)\n## The farm has a budget constraint for seed and fertilizer. The cost per acre for Wheat is $20, for Corn is $30, and for Soybeans is $25. The total budget for seed and fertilizer is $5000.\nmodel.addCons(20 * W + 30 * C + 25 * S <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1221,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function for each device is nonlinear:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\n// S <= 100; T <= 100; L <= 100\n\n## Generate Constraint-2:\nThe total number of units produced across all devices cannot exceed 200 due to overall resource constraints.\n// S + T + L <= 200\n\n## Generate Constraint-3:\nThe company must produce at least 20 smartphones and 15 tablets to meet contractual obligations.\n// S >= 20; T >= 15",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function for each device is nonlinear:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type. The total number of units produced across all devices cannot exceed 200 due to overall resource constraints. The company must produce at least 20 smartphones and 15 tablets to meet contractual obligations.\nPlease help the company to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20, ub=100)  # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=15, ub=100)  # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=100)    # number of laptops\n\n# Define objective function\n# Profit from smartphones: P_S = 100S - 0.5S^2\n# Profit from tablets: P_T = 150T - 0.6T^2\n# Profit from laptops: P_L = 200L - 0.7L^2\n# Maximize P_total = P_S + P_T + P_L\nP_S = 100 * S - 0.5 * S**2\nP_T = 150 * T - 0.6 * T**2\nP_L = 200 * L - 0.7 * L**2\nP_total = P_S + P_T + P_L\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\nmodel.addCons(S + T + L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 976,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend.\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of Danishes\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"number of \u00c9clairs\": \"\u00c9clair\", \"range\": \"\u00c9clair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n// Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\n// Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\n\n## Generate Constraint-1:\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\n// 50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\n// Croissant <= 300; Danish <= 250; \u00c9clair <= 200\n\n## Generate Constraint-3:\nThe bakery has a total production capacity of 700 pastries for the weekend.\n// Croissant + Danish + \u00c9clair <= 700",
        "question": "A bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend. The profit per unit for each pastry is as follows: $2 for Croissant, $3 for Danish, and $4 for \u00c9clair. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n\n| Pastry   | Profit per Unit | Butter Required (g) | Daily Demand Limit |\n|----------|-----------------|---------------------|--------------------|\n| Croissant| $2              | 50                  | 300                |\n| Danish   | $3              | 40                  | 250                |\n| \u00c9clair   | $4              | 30                  | 200                |\n\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g. The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200. The bakery has a total production capacity of 700 pastries for the weekend.\n\nPlease help the bakery to maximize the total profit from selling the pastries while adhering to the constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0, ub=300) # number of Croissants\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=0, ub=250) # number of Danishes\n\u00c9clair = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair\", lb=0, ub=200) # number of \u00c9clairs\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=300)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.02 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=0, ub=100)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=250)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.02 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n\u00c9clair1 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair1\", lb=0, ub=100)\n\u00c9clair2 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair2\", lb=100, ub=200)\n\u00c9clair_b1 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b1\")\n\u00c9clair_b2 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b2\")\nmodel.addCons(\u00c9clair_b1 + \u00c9clair_b2 == 1)\nmodel.addCons(\u00c9clair == \u00c9clair1*\u00c9clair_b1 + \u00c9clair2*\u00c9clair_b2)\nProfit_\u00c9clair = 4 * \u00c9clair1 * \u00c9clair_b1 + (4 + 0.02 * (\u00c9clair2 - 100)) * \u00c9clair2 * \u00c9clair_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_\u00c9clair)\n\n# Add constraints\n## The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\nmodel.addCons(50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000)\n## The bakery has a total production capacity of 700 pastries for the weekend.\nmodel.addCons(Croissant + Danish + \u00c9clair <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Danishes: \", model.getVal(Danish))\n    print(\"Number of \u00c9clairs: \", model.getVal(\u00c9clair))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1396,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies based on the production cost and market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company aims to maximize the total profit.\n// The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\n\n## Generate Constraint-1:\nThe company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n// 30S + 70T + 120L <= 10000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n\n| Device     | Production Cost | Profit per Unit Formula |\n|------------|-----------------|-------------------------|\n| Smartphones | 30$             | 50 - 0.1S dollars      |\n| Tablets     | 70$             | 100 - 0.2T dollars     |\n| Laptops     | 120$            | 150 - 0.3L dollars     |\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\nmodel.addCons(obj == S * (50 - 0.1 * S) + T * (100 - 0.2 * T) + L * (150 - 0.3 * L))\n\n# Add constraints\n## The company has a budget constraint of 10000 dollars for production.\nmodel.addCons(30 * S + 70 * T + 120 * L <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 964,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products.\n// Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\n// Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\n// Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\n// 5 * A + 8 * B + 10 * C <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. Each product requires a different amount of raw materials and labor, and generates a different profit margin. Product A has a profit margin of $10 per unit, Product B has a profit margin of $15 per unit, and Product C has a profit margin of $20 per unit. Due to economies of scale, the profit margin for each product increases by $0.02 for every 100 units produced above a threshold of 500 units. The company aims to maximize the total profit from the sale of these products. The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg. Please help the company determine the optimal number of units of each product to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 500) / 100, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=500)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=500, ub=10000)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 500) / 100) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 500) / 100, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=500)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=500, ub=10000)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 500) / 100) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 500) / 100, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=500)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=500, ub=10000)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 500) / 100) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total raw material available is 5000 kg.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 857,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets.\n// {\"hours for machine A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"hours for machine B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"hours for machine C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget.\n// The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\n// The production constraint for widget A: 5 * MA >= 100\n// The production constraint for widget B: 10 * MB >= 100\n// The production constraint for widget C: 15 * MC >= 100\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 20 hours per day.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nMachine A can operate for a maximum of 8 hours per day.\n// MA <= 8\n\n## Generate Constraint-3:\nMachine B can operate for a maximum of 10 hours per day.\n// MB <= 10",
        "question": "A manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets. Each machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget. The total operating hours for all machines must not exceed 20 hours per day. Machine A can operate for a maximum of 8 hours per day. Machine B can operate for a maximum of 10 hours per day. Please help the plant manager to minimize the total cost of production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # hours for machine A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # hours for machine B\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # hours for machine C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\nmodel.addCons(obj == 10 * MA + 15 * MB + 20 * MC)\n\n# Add constraints\n## The production constraint for widget A: 5 * MA >= 100\nmodel.addCons(5 * MA >= 100)\n## The production constraint for widget B: 10 * MB >= 100\nmodel.addCons(10 * MB >= 100)\n## The production constraint for widget C: 15 * MC >= 100\nmodel.addCons(15 * MC >= 100)\n## The total operating hours for all machines must not exceed 20 hours per day.\nmodel.addCons(MA + MB + MC <= 20)\n## Machine A can operate for a maximum of 8 hours per day.\nmodel.addCons(MA <= 8)\n## Machine B can operate for a maximum of 10 hours per day.\nmodel.addCons(MB <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Machine A: \", model.getVal(MA))\n    print(\"Hours for Machine B: \", model.getVal(MB))\n    print(\"Hours for Machine C: \", model.getVal(MC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit.\n// {\"amount of resource 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of resources used. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of resource 1 available is 100 units.\n// R1 <= 100\n\n## Generate Constraint-2:\nThe total amount of resource 2 available is 120 units.\n// R2 <= 120",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit. The profit from each product depends on the amount of resources used, and the profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n\nThe total amount of resource 1 available is 100 units, and the total amount of resource 2 available is 120 units.\n\nPlease help the plant manager determine the optimal allocation of resources R1, R2, and R3 to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of resource 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of resource 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of resource 3\n\n# Define objective function\n## The profit function for each product is nonlinear and given by:\nP1 = 50 * R1**0.5 - 10 * R1\nP2 = 70 * R2**0.6 - 20 * R2\nP3 = 60 * R3**0.7 - 15 * R3\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total amount of resource 1 available is 100 units.\nmodel.addCons(R1 <= 100)\n## The total amount of resource 2 available is 120 units.\nmodel.addCons(R2 <= 120)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Resource 1: \", model.getVal(R1))\n    print(\"Amount of Resource 2: \", model.getVal(R2))\n    print(\"Amount of Resource 3: \", model.getVal(R3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 738,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The company aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Revenue from product A: R_A = 20 * A\n// Revenue from product B: R_B = 30 * B\n// Revenue from product C: R_C = 40 * C\n// Cost of product A: C_A = 10 * A\n// Cost of product B: C_B = 20 * B\n// Cost of product C: C_C = 30 * C\n// Total profit: P = (R_A + R_B + R_C) - (C_A + C_B + C_C)\n// So, the objective function is: Maximize P = (20 * A + 30 * B + 40 * C) - (10 * A + 20 * B + 30 * C)\n\n## Generate Constraint-1:\nThe company has a total budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 5000\n\n## Generate Constraint-2:\nThe production capacity for product A is limited to 200 units, for product B is 300 units, and for product C is 400 units.\n// A <= 200; B <= 300; C <= 400\n\n## Generate Constraint-3:\nThe company aims to produce at least 50 units of each product to meet the minimum market demand.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit and production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $20                      |\n| C       | $40             | $30                      |\n\nThe company has a total budget of $5000 for production costs. The production capacity for product A is limited to 200 units, for product B is 300 units, and for product C is 400 units. The company aims to produce at least 50 units of each product to meet the minimum market demand.\n\nPlease help the company to maximize the total profit, which is the difference between the total revenue and the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50, ub=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50, ub=400) # number of units of product C\n\n# Define objective function\nR_A = 20 * A\nR_B = 30 * B\nR_C = 40 * C\nC_A = 10 * A\nC_B = 20 * B\nC_C = 30 * C\nP = (R_A + R_B + R_C) - (C_A + C_B + C_C)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\nmodel.addCons(10 * A + 20 * B + 30 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies based on the production cost and market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company aims to maximize the total profit.\n// The objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\n\n## Generate Constraint-1:\nThe company has a budget constraint of 10000 dollars for production. The cost of producing a smartphone is 30 dollars, a tablet is 70 dollars, and a laptop is 120 dollars.\n// 30S + 70T + 120L <= 10000\n\n## Generate Constraint-2:\nThe market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units.\n// S >= 100; T >= 50; L >= 30\n\n## Generate Constraint-3:\nThe total number of devices produced should not exceed 200 units.\n// S + T + L <= 200",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit, considering the cost of production and the market demand. The profit per unit for smartphones is 50 - 0.1S dollars, for tablets is 100 - 0.2T dollars, and for laptops is 150 - 0.3L dollars. The company has a budget constraint of 10000 dollars for production, with the cost of producing a smartphone being 30 dollars, a tablet being 70 dollars, and a laptop being 120 dollars.\n\n| Device     | Production Cost | Profit per Unit Formula |\n|------------|-----------------|-------------------------|\n| Smartphones| 30$             | 50 - 0.1S              |\n| Tablets    | 70$             | 100 - 0.2T             |\n| Laptops    | 120$            | 150 - 0.3L             |\n\nThe market demand for smartphones is at least 100 units, for tablets is at least 50 units, and for laptops is at least 30 units. The total number of devices produced should not exceed 200 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=100) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=50) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=30) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_S = S * (50 - 0.1 * S)\nProfit_T = T * (100 - 0.2 * T)\nProfit_L = L * (150 - 0.3 * L)\n## the objective function is: Maximize P = S * (50 - 0.1S) + T * (100 - 0.2T) + L * (150 - 0.3L)\nmodel.addCons(obj == Profit_S + Profit_T + Profit_L)\n\n# Add constraints\n## The company has a budget constraint of 10000 dollars for production.\nmodel.addCons(30 * S + 70 * T + 120 * L <= 10000)\n## The total number of devices produced should not exceed 200 units.\nmodel.addCons(S + T + L <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize profit.\n// {\"hours of operation for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for machine 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different mix of components. Machine 1 produces resistors at a rate of 100 units per hour, capacitors at 50 units per hour, and inductors at 25 units per hour. Machine 2 produces resistors at 75 units per hour, capacitors at 100 units per hour, and inductors at 50 units per hour. Machine 3 produces resistors at 50 units per hour, capacitors at 75 units per hour, and inductors at 100 units per hour. The profit from resistors is $0.01 per unit, from capacitors is $0.02 per unit, and from inductors is $0.03 per unit. The objective is to maximize the total profit from all components.\n// Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n// Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n// Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n// Total profit: P = P1 + P2 + P3\n// So, the objective function is: Maximize P\n\n## Generate Constraint-1:\nThe total available hours for all machines cannot exceed 100 hours.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturer produces three types of electronic components: resistors, capacitors, and inductors. The production is managed across three different machines. The manufacturer needs to determine the optimal number of hours to operate each machine to maximize profit. The production rates and profit per unit for each component are given in the following Table.\n\n| Machine | Resistors (units/hour) | Capacitors (units/hour) | Inductors (units/hour) | Profit per Unit |\n|---------|------------------------|-------------------------|------------------------|-----------------|\n| 1       | 100                    | 50                      | 25                     | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n| 2       | 75                     | 100                     | 50                     | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n| 3       | 50                     | 75                      | 100                    | Resistors: $0.01, Capacitors: $0.02, Inductors: $0.03 |\n\nThe total available hours for all machines cannot exceed 100 hours. Please help the manufacturer to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours of operation for machine 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours of operation for machine 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours of operation for machine 3\n\n# Define objective function\n## Profit from resistors: P1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\n## Profit from capacitors: P2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\n## Profit from inductors: P3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\n## Total profit: P = P1 + P2 + P3\nP1 = 0.01 * (100 * M1 + 75 * M2 + 50 * M3)\nP2 = 0.02 * (50 * M1 + 100 * M2 + 75 * M3)\nP3 = 0.03 * (25 * M1 + 50 * M2 + 100 * M3)\nP = P1 + P2 + P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total available hours for all machines cannot exceed 100 hours.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for Machine 1: \", model.getVal(M1))\n    print(\"Hours of operation for Machine 2: \", model.getVal(M2))\n    print(\"Hours of operation for Machine 3: \", model.getVal(M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1153,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type.\n// {\"number of machines for product A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for product C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for product A produces 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The objective is to minimize the total operating hours required to meet these demands.\n// Operating hours for product A: HA = 800 / (10 * MA)\n// Operating hours for product B: HB = 1200 / (15 * MB)\n// Operating hours for product C: HC = 1600 / (20 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 machines available.\n// MA + MB + MC <= 50\n\n## Generate Constraint-2:\nEach type of product can be produced by up to 20 machines.\n// MA <= 20; MB <= 20; MC <= 20",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of machines dedicated to each type. The manufacturer needs to meet a daily demand of at least 800 units for product A, 1200 units for product B, and 1600 units for product C. The production rates for each product are given in the following Table.\n\n| Product | Production Rate per Machine |\n|---------|-----------------------------|\n| A       | 10 units per hour           |\n| B       | 15 units per hour           |\n| C       | 20 units per hour           |\n\nThe manufacturer has a total of 50 machines available. Each type of product can be produced by up to 20 machines. The objective is to minimize the total operating hours required to meet these demands, which is defined as the maximum of the operating hours for each product.\n\nPlease help the manufacturer determine the optimal allocation of machines to minimize the total operating hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0, ub=20) # number of machines for product A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0, ub=20) # number of machines for product B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0, ub=20) # number of machines for product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = 800 / (10 * MA)\nHB = 1200 / (15 * MB)\nHC = 1600 / (20 * MC)\n## convert the division to multiplication\nmodel.addCons(HA * (10 * MA) == 800)\nmodel.addCons(HB * (15 * MB) == 1200)\nmodel.addCons(HC * (20 * MC) == 1600)\n## the objective function is: Minimize max(HA, HB, HC)\n## convert max to a variable\nmax_hours = model.addVar('max_hours')\nmodel.addCons(max_hours >= HA)\nmodel.addCons(max_hours >= HB)\nmodel.addCons(max_hours >= HC)\nmodel.addCons(obj == max_hours)\n\n# Add constraints\n## The manufacturer has a total of 50 machines available.\nmodel.addCons(MA + MB + MC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Product A: \", model.getVal(MA))\n    print(\"Number of Machines for Product B: \", model.getVal(MB))\n    print(\"Number of Machines for Product C: \", model.getVal(MC))\n    print(\"Minimum Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 966,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit. The selling price per unit and the production cost per unit (adjusted by the level of automation) for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost (adjusted by Automation) |\n|---------|---------------|-----------------------------------------|\n| ProductA | $100          | $50 - 0.01 * Automation                 |\n| ProductB | $120          | $70 - 0.015 * Automation                |\n| ProductC | $150          | $90 - 0.02 * Automation                 |\n\nThe company has a total production capacity of 1000 units across all products. The investment in automation cannot exceed $50,000. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\nProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\nProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. The farmer wants to maximize his total profit. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The objective is to maximize the total profit, which is given by:\n// Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares.\n// W + C + B <= 100",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit. The profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The objective is to maximize the total profit, which is given by:\n\n| Crop   | Profit per Unit | Yield Factor |\n|--------|-----------------|--------------|\n| Wheat  | $10             | 0.8          |\n| Corn   | $15             | 0.9          |\n| Barley | $12             | 0.7          |\n\nThe total area available for planting is 100 hectares. Please help the farmer determine the optimal amount of wheat (W), corn (C), and barley (B) to plant to maximize his profit, given that the amounts must be non-negative and the total area used does not exceed 100 hectares.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\nmodel.addCons(obj == 10 * 0.8 * W + 15 * 0.9 * C + 12 * 0.7 * B)\n\n# Add constraints\n## The total area available for planting is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints.\n// {\"quantity of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Device A is $10, for Device B is $15, and for Device C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The company aims to maximize the total profit from the sales of these devices.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.02 * (B - 100), 15) * B\n// Profit_C = max(20 + 0.02 * (C - 100), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each device requires a specific amount of a rare metal. Device A requires 5 grams, Device B requires 8 grams, and Device C requires 10 grams. The total supply of this rare metal is limited to 1500 grams.\n// 5 * A + 8 * B + 10 * C <= 1500\n\n## Generate Constraint-2:\nThere is a market demand limit for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\n// A <= 300; B <= 400; C <= 500\n\n## Generate Constraint-3:\nThe company has a total production capacity of 1000 units across all devices.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: Device A, Device B, and Device C. The company needs to determine the optimal production quantities for each device to maximize profit while considering various constraints. The profit per unit of Device A is $10, for Device B is $15, and for Device C is $20. Due to economies of scale, the profit per unit increases by $0.02 for each device type when the production quantity exceeds 100 units. The following table summarizes the requirements for each device:\n\n| Device | Profit per Unit | Rare Metal Required (grams) |\n|--------|-----------------|-----------------------------|\n| A      | 10$             | 5                           |\n| B      | 15$             | 8                           |\n| C      | 20$             | 10                          |\n\nThe total supply of the rare metal is limited to 1500 grams. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units. The company has a total production capacity of 1000 units across all devices. Please help the company to maximize the total profit from the sales of these devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## There is a market demand constraint for each device. The demand for Device A is capped at 300 units, for Device B at 400 units, and for Device C at 500 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # quantity of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=500) # quantity of Device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.02 * (B - 100), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.02 * (C - 100), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.02 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1500)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1145,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost.\n// Cost_S = max(100 - 0.5 * (S - 100), 100) * S\n// Cost_T = max(150 - 0.5 * (T - 100), 150) * T\n// Cost_L = max(200 - 0.5 * (L - 100), 200) * L\n// So, the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000.\n// 50 * S + 75 * T + 100 * L <= 15000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units.\n// S <= 500; T <= 300; L <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 800 units in total.\n// S + T + L <= 800",
        "question": "A manufacturer produces three types of electronic devices: Smartphone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit per unit of Smartphone is $100, for Tablet is $150, and for Laptop is $200. Due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the net profit, which is the revenue minus the cost. The manufacturer has a limited budget for production. The cost of producing a Smartphone is $50, a Tablet is $75, and a Laptop is $100. The total budget for production is $15,000. The market has a demand limit for each device. The demand for Smartphones is capped at 500 units, for Tablets at 300 units, and for Laptops at 200 units. The manufacturer also has a production capacity limit of 800 units in total. Please help the manufacturer to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=500) # quantity of Smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=300) # quantity of Tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=200) # quantity of Laptops\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_S = max(100 - 0.5 * (S - 100), 100) * S\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0, ub=100)\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=100, ub=500)\nS_b1 = model.addVar(vtype=\"B\", name=\"S_b1\")\nS_b2 = model.addVar(vtype=\"B\", name=\"S_b2\")\nmodel.addCons(S_b1 + S_b2 == 1)\nmodel.addCons(S == S1*S_b1 + S2*S_b2)\nCost_S = 100 * S1 * S_b1 + (100 - 0.5 * (S2 - 100)) * S2 * S_b2\n## create piecewise variables for piecewise function: Cost_T = max(150 - 0.5 * (T - 100), 150) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=300)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_T = 150 * T1 * T_b1 + (150 - 0.5 * (T2 - 100)) * T2 * T_b2\n## create piecewise variables for piecewise function: Cost_L = max(200 - 0.5 * (L - 100), 200) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=200)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_L = 200 * L1 * L_b1 + (200 - 0.5 * (L2 - 100)) * L2 * L_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L)\nmodel.addCons(obj == (100 * S - Cost_S) + (150 * T - Cost_T) + (200 * L - Cost_L))\n\n# Add constraints\nmodel.addCons(50 * S + 75 * T + 100 * L <= 15000)\nmodel.addCons(S <= 500)\nmodel.addCons(T <= 300)\nmodel.addCons(L <= 200)\nmodel.addCons(S + T + L <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphone: \", model.getVal(S))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, with a production cost of $10 per unit and a power consumption of 5 watts per unit. \nThe profit per unit of E2 is $40, with a production cost of $15 per unit and a power consumption of 8 watts per unit. \nThe profit per unit of E3 is $50, with a production cost of $20 per unit and a power consumption of 10 watts per unit.\nThe manufacturer has a limited power supply of 500 watts. The goal is to maximize the profit per watt of power consumed.\n// Profit_E1 = 30 * Q1 - 10 * Q1\n// Profit_E2 = 40 * Q2 - 15 * Q2\n// Profit_E3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (5 * Q1 + 8 * Q2 + 10 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited power supply of 500 watts.\n// 5 * Q1 + 8 * Q2 + 10 * Q3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity of 200 units in total.\n// Q1 + Q2 + Q3 <= 200",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage.\nThe profit per unit of E1 is $30, with a production cost of $10 per unit and a power consumption of 5 watts per unit. \nThe profit per unit of E2 is $40, with a production cost of $15 per unit and a power consumption of 8 watts per unit. \nThe profit per unit of E3 is $50, with a production cost of $20 per unit and a power consumption of 10 watts per unit.\nThe manufacturer has a limited power supply of 500 watts. The goal is to maximize the profit per watt of power consumed.\nThe manufacturer has a budget of $3000 for production costs. The manufacturer has a production capacity of 200 units in total.\nPlease help the manufacturer to determine the optimal production quantities of E1, E2, and E3 to maximize the profit per watt of power consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * Q1\nProfit_E2 = (40 - 15) * Q2\nProfit_E3 = (50 - 20) * Q3\nPowerConsumption = 5 * Q1 + 8 * Q2 + 10 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / PowerConsumption\n## convert the division to multiplication\nmodel.addCons(obj * PowerConsumption == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited power supply of 500 watts.\nmodel.addCons(5 * Q1 + 8 * Q2 + 10 * Q3 <= 500)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000)\n## The manufacturer has a production capacity of 200 units in total.\nmodel.addCons(Q1 + Q2 + Q3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit per Watt: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 939,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility.\n// {\"number of technicians at facility 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of technicians at facility 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company produces 3 types of solar panels at the 3 facilities. \nAt facility 1, each technician can produce 10 units of solar panel 1, 15 units of solar panel 2, and 20 units of solar panel 3 per day. \nAt facility 2, each technician can produce 15 units of solar panel 1, 20 units of solar panel 2, and 25 units of solar panel 3 per day. \nAt facility 3, each technician can produce 20 units of solar panel 1, 25 units of solar panel 2, and 30 units of solar panel 3 per day. \nThe company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. Please determine the minimum production time to meet the monthly demand.\n// The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n// The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n// The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are total 60 technicians available.\n// T1 + T2 + T3 <= 60",
        "question": "A company operates 3 different facilities for producing solar panels. The manager needs to determine the number of technicians to assign to each facility. The production capabilities of each technician at each facility are as follows:\n\n| Facility | Solar Panel 1 Units/Day | Solar Panel 2 Units/Day | Solar Panel 3 Units/Day |\n|----------|-------------------------|-------------------------|-------------------------|\n| 1        | 10                      | 15                      | 20                      |\n| 2        | 15                      | 20                      | 25                      |\n| 3        | 20                      | 25                      | 30                      |\n\nThe company needs to produce at least 300 units of solar panel 1, at least 450 units of solar panel 2, and at least 600 units of solar panel 3. The three facilities can only be opened or closed at the same time. There are a total of 60 technicians available. Please help the manager determine the minimum production time to meet the monthly demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of technicians at facility 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of technicians at facility 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of technicians at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for solar panel 1: T1 = 300 / (10 * T1 + 15 * T2 + 20 * T3)\n## The production time for solar panel 2: T2 = 450 / (15 * T1 + 20 * T2 + 25 * T3)\n## The production time for solar panel 3: T3 = 600 / (20 * T1 + 25 * T2 + 30 * T3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nmodel.addCons(300 * (10 * T1 + 15 * T2 + 20 * T3) >= 1000 * T1)\nmodel.addCons(450 * (15 * T1 + 20 * T2 + 25 * T3) >= 1000 * T2)\nmodel.addCons(600 * (20 * T1 + 25 * T2 + 30 * T3) >= 1000 * T3)\n\n# Add constraints\n## There are total 60 technicians available.\nmodel.addCons(T1 + T2 + T3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Technicians at Facility 1: \", model.getVal(T1))\n    print(\"Number of Technicians at Facility 2: \", model.getVal(T2))\n    print(\"Number of Technicians at Facility 3: \", model.getVal(T3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency.\n// {\"number of workers on resistor production line\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of workers on capacitor production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of workers on inductor production line\": \"I\", \"range\": \"I >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The company aims to maximize the total production rate of all components. However, due to the nature of the components, the production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%.\n// The production rate of resistors: P_R = 50 * R * (1 - 0.01 * C)\n// The production rate of capacitors: P_C = 40 * C * (1 - 0.01 * I)\n// The production rate of inductors: P_I = 30 * I * (1 + 0.01 * R)\n// The objective function is: Maximize P_total = P_R + P_C + P_I\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// R + C + I <= 60",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency. Each worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The company aims to maximize the total production rate of all components. However, due to the nature of the components, the production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%. There are a total of 60 workers available. Please help the company to maximize the total production rate of all components.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of workers on resistor production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on capacitor production line\nI = model.addVar(vtype=\"INTEGER\", name=\"I\", lb=0) # number of workers on inductor production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_R = 50 * R * (1 - 0.01 * C)\nP_C = 40 * C * (1 - 0.01 * I)\nP_I = 30 * I * (1 + 0.01 * R)\n## the objective function is: Maximize P_total = P_R + P_C + P_I\nmodel.addCons(obj == P_R + P_C + P_I)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(R + C + I <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Resistor Line: \", model.getVal(R))\n    print(\"Number of Workers on Capacitor Line: \", model.getVal(C))\n    print(\"Number of Workers on Inductor Line: \", model.getVal(I))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1162,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production.\n// {\"hours Machine 1 operates\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 2 operates\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"hours Machine 3 operates\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand.\n// The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n// The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n// The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n// So, the objective function is: Minimize max(T_A, T_B, T_C)\n\n## Generate Constraint-1:\nThe total operating hours for all machines cannot exceed 100 hours per day.\n// M1 + M2 + M3 <= 100",
        "question": "A manufacturing plant produces three types of products using three different machines. The plant manager needs to allocate the number of hours each machine operates to optimize production. Each machine produces different amounts of each product per hour. Machine 1 produces 10 units of Product A, 5 units of Product B, and 8 units of Product C per hour. Machine 2 produces 7 units of Product A, 9 units of Product B, and 6 units of Product C per hour. Machine 3 produces 12 units of Product A, 4 units of Product B, and 10 units of Product C per hour. The plant needs to produce at least 500 units of Product A, 400 units of Product B, and 600 units of Product C daily. The goal is to minimize the total operating hours of the machines to meet the daily demand. The total operating hours for all machines cannot exceed 100 hours per day. Please help the plant manager to determine the optimal allocation of operating hours for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # hours Machine 1 operates\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # hours Machine 2 operates\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # hours Machine 3 operates\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The total hours needed for Product A: T_A = 500 / (10 * M1 + 7 * M2 + 12 * M3)\n## The total hours needed for Product B: T_B = 400 / (5 * M1 + 9 * M2 + 4 * M3)\n## The total hours needed for Product C: T_C = 600 / (8 * M1 + 6 * M2 + 10 * M3)\n## So, the objective function is: Minimize max(T_A, T_B, T_C)\n## Convert the division to multiplication and use max function\nT_A = 500\nT_B = 400\nT_C = 600\nmodel.addCons(T_A <= (10 * M1 + 7 * M2 + 12 * M3) * obj)\nmodel.addCons(T_B <= (5 * M1 + 9 * M2 + 4 * M3) * obj)\nmodel.addCons(T_C <= (8 * M1 + 6 * M2 + 10 * M3) * obj)\n\n# Add constraints\n## The total operating hours for all machines cannot exceed 100 hours per day.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours Machine 1 operates: \", model.getVal(M1))\n    print(\"Hours Machine 2 operates: \", model.getVal(M2))\n    print(\"Hours Machine 3 operates: \", model.getVal(M3))\n    print(\"Minimized Total Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute three types of products. The company needs to determine the optimal number of workers to assign to each warehouse to maximize efficiency and minimize costs.\n// {\"number of workers at warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers at warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker at warehouse 1 can process 10 units of product 1, 15 units of product 2, and 20 units of product 3 per hour. \nEach worker at warehouse 2 can process 20 units of product 1, 25 units of product 2, and 30 units of product 3 per hour. \nEach worker at warehouse 3 can process 30 units of product 1, 35 units of product 2, and 40 units of product 3 per hour. \nThe company needs to ensure that at least 300 units of product 1, 450 units of product 2, and 600 units of product 3 are processed daily. The goal is to minimize the total hours required to meet these daily targets.\n// The processing time for product 1: T1 = 300 / (10 * W1 + 20 * W2 + 30 * W3)\n// The processing time for product 2: T2 = 450 / (15 * W1 + 25 * W2 + 35 * W3)\n// The processing time for product 3: T3 = 600 / (20 * W1 + 30 * W2 + 40 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// W1 + W2 + W3 <= 60",
        "question": "A company operates three different warehouses that store and distribute three types of products. The company needs to determine the optimal number of workers to assign to each warehouse to maximize efficiency and minimize costs. Each worker at each warehouse can process different units of products per hour as shown in the following Table.\n\n| Warehouse | Product 1 Units/Hour | Product 2 Units/Hour | Product 3 Units/Hour |\n|-----------|----------------------|----------------------|----------------------|\n| 1         | 10                   | 15                   | 20                   |\n| 2         | 20                   | 25                   | 30                   |\n| 3         | 30                   | 35                   | 40                   |\n\nThe company needs to ensure that at least 300 units of product 1, 450 units of product 2, and 600 units of product 3 are processed daily. The goal is to minimize the total hours required to meet these daily targets. There are a total of 60 workers available.\n\nPlease help the company to minimize the maximum processing time for any product among the three warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers at warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers at warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The processing time for product 1: T1 = 300 / (10 * W1 + 20 * W2 + 30 * W3)\n## The processing time for product 2: T2 = 450 / (15 * W1 + 25 * W2 + 35 * W3)\n## The processing time for product 3: T3 = 600 / (20 * W1 + 30 * W2 + 40 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * W1 + 20 * W2 + 30 * W3) == 300)\nmodel.addCons(T2 * (15 * W1 + 25 * W2 + 35 * W3) == 450)\nmodel.addCons(T3 * (20 * W1 + 30 * W2 + 40 * W3) == 600)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(W1 + W2 + W3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers at Warehouse 1: \", model.getVal(W1))\n    print(\"Number of Workers at Warehouse 2: \", model.getVal(W2))\n    print(\"Number of Workers at Warehouse 3: \", model.getVal(W3))\n    print(\"Minimum Total Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1125,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 600 smartphones to be produced.\n// S <= 600\n\n## Generate Constraint-3:\nDue to market research, the company should produce no more than 400 tablets.\n// T <= 400",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function. The total production capacity of the company is limited to 1000 units per month. The raw material constraint allows for a maximum of 600 smartphones to be produced. Due to market research, the company should produce no more than 400 tablets. Please help the company determine the optimal number of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\nmodel.addCons(obj == 50*S + 60*T + 70*L - 0.01*(S**2 + T**2 + L**2))\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n## The raw material constraint allows for a maximum of 600 smartphones to be produced.\nmodel.addCons(S <= 600)\n## Due to market research, the company should produce no more than 400 tablets.\nmodel.addCons(T <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 912,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\n// WheatAcres >= 30\n\n## Generate Constraint-4:\nThe farmer has a budget constraint for seed and fertilizer, which is $15,000. The cost per acre for Wheat is $150, for Corn is $200, and for Soybeans is $180.\n// 150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000\n\n## Generate Constraint-5:\nTo maintain ecological balance, the farmer decides not to plant more than 50% of the total acres in Corn.\n// CornAcres <= 0.50 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre and the environmental cost per acre for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Environmental Cost per Acre |\n|------------|-----------------|-----------------------------|\n| Wheat      | $200            | $50                         |\n| Corn       | $300            | $70                         |\n| Soybeans   | $250            | $60                         |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. The farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation. The farmer has a budget constraint for seed and fertilizer, which is $15,000. The cost per acre for Wheat is $150, for Corn is $200, and for Soybeans is $180. To maintain ecological balance, the farmer decides not to plant more than 50% of the total acres in Corn.\n\nPlease help the farmer to maximize the net profit per acre, considering both financial profit and environmental cost, by determining the optimal number of acres for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=30)  # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0)  # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0)  # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n## The farmer wants to ensure that at least 30 acres are dedicated to Wheat to maintain a diverse crop rotation.\nmodel.addCons(WheatAcres >= 30)\n## The farmer has a budget constraint for seed and fertilizer, which is $15,000.\nmodel.addCons(150 * WheatAcres + 200 * CornAcres + 180 * SoybeansAcres <= 15000)\n## To maintain ecological balance, the farmer decides not to plant more than 50% of the total acres in Corn.\nmodel.addCons(CornAcres <= 0.50 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1326,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation technology\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. For every $10,000 invested in automation, the production cost per unit decreases by $1 for all products. The selling price per unit of ProductA is $80, ProductB is $100, and ProductC is $120. The company aims to maximize the total profit from all products.\n// Total cost for ProductA: CostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\n// Total cost for ProductB: CostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\n// Total cost for ProductC: CostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\n// Total revenue for ProductA: RevenueA = 80 * QuantityA\n// Total revenue for ProductB: RevenueB = 100 * QuantityB\n// Total revenue for ProductC: RevenueC = 120 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1000 units of each product are produced.\n// QuantityA >= 1000; QuantityB >= 1000; QuantityC >= 1000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the investment in automation technology to reduce production costs. The production cost per unit of ProductA is $50, ProductB is $70, and ProductC is $90. For every $10,000 invested in automation, the production cost per unit decreases by $1 for all products. The selling price per unit of ProductA is $80, ProductB is $100, and ProductC is $120. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units across all products. The total investment in automation technology cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must ensure that at least 1000 units of each product are produced. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=1000)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=1000)  # production quantity of ProductC\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # investment in automation technology\n\n# Define objective function\nCostA = (50 - 0.0001 * AutomationInvestment) * QuantityA\nCostB = (70 - 0.0001 * AutomationInvestment) * QuantityB\nCostC = (90 - 0.0001 * AutomationInvestment) * QuantityC\nRevenueA = 80 * QuantityA\nRevenueB = 100 * QuantityB\nRevenueC = 120 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(AutomationInvestment <= 50000)\nmodel.addCons(QuantityA >= 2 * QuantityB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Investment in Automation Technology: \", model.getVal(AutomationInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 961,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. \nEach unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. \nEach unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material.\nThe plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material).\n// Profit from A: Profit_A = 20 * A\n// Profit from B: Profit_B = 30 * B\n// Profit from C: Profit_C = 40 * C\n// Resource usage: Resource_A = 3 * A + 2 * A = 5 * A; Resource_B = 4 * B + 3 * B = 7 * B; Resource_C = 5 * C + 4 * C = 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe plant has a total of 1000 hours of labor available.\n// 3 * A + 4 * B + 5 * C <= 1000\n\n## Generate Constraint-2:\nThe plant has a total of 800 units of raw material available.\n// 2 * A + 3 * B + 4 * C <= 800",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit. The profit, labor hours, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $20             | 3                    | 2                           |\n| B       | $30             | 4                    | 3                           |\n| C       | $40             | 5                    | 4                           |\n\nThe plant has a total of 1000 hours of labor available. The plant also has a total of 800 units of raw material available. The plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material).\n\nPlease help the plant determine the optimal number of units to produce for each product to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nResource_A = 5 * A\nResource_B = 7 * B\nResource_C = 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total of 1000 hours of labor available.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n## The plant has a total of 800 units of raw material available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Resource: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1130,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company aims to maximize the total profit from selling all three products.\n// Profit_A = (10 - 0.001 * (A - 100)) * A\n// Profit_B = (15 - 0.001 * (B - 100)) * B\n// Profit_C = (20 - 0.001 * (C - 100)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours.\n// 2 * A + 3 * B + 4 * C <= 1500",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. However, due to economies of scale, the cost of production decreases nonlinearly as production increases. Specifically, the cost per unit decreases by 0.1% for each additional unit produced beyond 100 units for each product. The company has a limited supply of raw materials. Product A requires 5 kg of raw material per unit, Product B requires 8 kg, and Product C requires 10 kg. The total available raw material is 1000 kg. The company also has a labor constraint. Product A requires 2 hours of labor per unit, Product B requires 3 hours, and Product C requires 4 hours. The total available labor hours are 1500 hours. Please help the company to maximize the total profit from selling all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.001 * (A - 100)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=math.inf)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.001 * (A1 - 100)) * A1 * A_b1 + (10 - 0.001 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.001 * (B - 100)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=math.inf)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.001 * (B1 - 100)) * B1 * B_b1 + (15 - 0.001 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.001 * (C - 100)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=math.inf)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.001 * (C1 - 100)) * C1 * C_b1 + (20 - 0.001 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of raw materials.\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n## The company has a labor constraint.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency.\n// {\"production quantity of the product\": \"Quantity\", \"range\": \"Quantity >= 0\", \"type\": \"integer\"}\n// {\"advertising budget\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a certain product, the advertising budget to promote the product, and the amount of money to be invested in improving the production efficiency. The cost of production per unit decreases by $0.5 for every $1000 invested in production efficiency. The initial production cost per unit is $10, and the selling price per unit is $15. The company aims to maximize the total profit from the product. The company has a budget of $50,000 for advertising. Please help the company determine the optimal production quantity, advertising budget, and investment in production efficiency to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantity = model.addVar(vtype=\"INTEGER\", name=\"Quantity\", lb=0) # production quantity of the product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## Total profit: Profit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\nProfit = (15 - 10 + 0.0005 * Efficiency) * Quantity - Advertising\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Quantity))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Investment in Efficiency: \", model.getVal(Efficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 734,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\n// {\"number of TypeA solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company wants to maximize the total energy output per dollar spent.\n// Total energy output for TypeA: Energy_TypeA = 100 * 365 * 10 * TypeASolarPanels\n// Total energy output for TypeB: Energy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\n// Total energy output for TypeC: Energy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\n// Total cost for TypeA: Cost_TypeA = 500 * TypeASolarPanels\n// Total cost for TypeB: Cost_TypeB = 750 * TypeBSolarPanels\n// Total cost for TypeC: Cost_TypeC = 1000 * TypeCSolarPanels\n// So, the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1,000,000",
        "question": "A renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company has a budget of $1,000,000 for the installation.\nPlease help the company to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0) # number of TypeA solar panels\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0) # number of TypeB solar panels\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0) # number of TypeC solar panels\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEnergy_TypeA = 100 * 365 * 10 * TypeASolarPanels\nEnergy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\nEnergy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\nCost_TypeA = 500 * TypeASolarPanels\nCost_TypeB = 750 * TypeBSolarPanels\nCost_TypeC = 1000 * TypeCSolarPanels\n## the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n## convert the division to multiplication\nmodel.addCons(obj * (Cost_TypeA + Cost_TypeB + Cost_TypeC) == Energy_TypeA + Energy_TypeB + Energy_TypeC)\n\n# Add constraints\n## The company has a budget of $1,000,000 for the installation.\nmodel.addCons(500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of TypeB Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of TypeC Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 697,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations.\n// {\"quantity of ChemX\": \"ChemX\", \"range\": \"ChemX >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemY\": \"ChemY\", \"range\": \"ChemY >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemZ\": \"ChemZ\", \"range\": \"ChemZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nThe profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nThe profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit (profit minus production and storage costs).\n// NetProfit_ChemX = (100 - 50 - 10) * ChemX\n// NetProfit_ChemY = (150 - 70 - 15) * ChemY\n// NetProfit_ChemZ = (200 - 100 - 20) * ChemZ\n// So, the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / (ChemX + ChemY + ChemZ)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// ChemX + ChemY + ChemZ <= 200",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations. The profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. The profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. The profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20. The company wants to maximize the net profit per unit (profit minus production and storage costs). The company has a total production capacity of 200 units across all chemicals. Please help the company to maximize the net profit per unit (which is defined as the sum of the net profits divided by the total quantity of chemicals produced).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemX = model.addVar(vtype=\"INTEGER\", name=\"ChemX\", lb=0) # quantity of ChemX\nChemY = model.addVar(vtype=\"INTEGER\", name=\"ChemY\", lb=0) # quantity of ChemY\nChemZ = model.addVar(vtype=\"INTEGER\", name=\"ChemZ\", lb=0) # quantity of ChemZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_ChemX = (100 - 50 - 10) * ChemX\nNetProfit_ChemY = (150 - 70 - 15) * ChemY\nNetProfit_ChemZ = (200 - 100 - 20) * ChemZ\nTotalProduction = ChemX + ChemY + ChemZ\n## the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(ChemX + ChemY + ChemZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChemX: \", model.getVal(ChemX))\n    print(\"Quantity of ChemY: \", model.getVal(ChemY))\n    print(\"Quantity of ChemZ: \", model.getVal(ChemZ))\n    print(\"Maximized Net Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2). For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B). For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C). The company aims to maximize the total profit from selling the devices.\n// Profit_A = 20 * A - 0.01 * A^2\n// Profit_B = 30 * B - 2 * B\n// Profit_C = 40 * C - (50 - 0.5 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a budget constraint of $1000 for the total production costs.\n// 0.01 * A^2 + 2 * B + (50 - 0.5 * C) <= 1000\n\n## Generate Constraint-2:\nThe company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\n// A <= 50; B <= 60\n\n## Generate Constraint-3:\nThe company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\n// C - (A + B) <= 20\n\n## Generate Constraint-4:\nThe market demand for Device C is limited to 80 units.\n// C <= 80",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. The profit per unit and the production cost function for each device are given in the following Table.\n\n| Device | Profit per Unit | Production Cost Function |\n|--------|-----------------|--------------------------|\n| A      | $20             | 0.01 * A^2               |\n| B      | $30             | 2 * B                    |\n| C      | $40             | 50 - 0.5 * C             |\n\nThe company has a budget constraint of $1000 for the total production costs. The company has a production capacity constraint of 50 units for Device A and 60 units for Device B. The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units. The market demand for Device C is limited to 80 units.\n\nPlease help the company to maximize the total profit from selling the devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=50)  # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=60)  # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=80)  # quantity of device C\n\n# Define objective function\n## For Device A, the profit per unit is $20, but the production cost increases quadratically with the number of units produced (cost = 0.01 * A^2).\nProfit_A = 20 * A - 0.01 * A**2\n## For Device B, the profit per unit is $30, and the production cost increases linearly with the number of units produced (cost = 2 * B).\nProfit_B = 30 * B - 2 * B\n## For Device C, the profit per unit is $40, and the production cost decreases linearly with the number of units produced (cost = 50 - 0.5 * C).\nProfit_C = 40 * C - (50 - 0.5 * C)\n## So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget constraint of $1000 for the total production costs.\nmodel.addCons(0.01 * A**2 + 2 * B + (50 - 0.5 * C) <= 1000)\n## The company has a production capacity constraint of 50 units for Device A and 60 units for Device B.\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 60)\n## The company wants to ensure that the production of Device C does not exceed the combined production of Devices A and B by more than 20 units.\nmodel.addCons(C - (A + B) <= 20)\n## The market demand for Device C is limited to 80 units.\nmodel.addCons(C <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1013,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. However, due to market saturation, the profit per unit decreases nonlinearly with an increase in production. The profit function is defined as: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\n// So, the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nDue to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB.\n// A <= 2 * B",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to optimize their profit while considering various constraints. The profit per unit for each component decreases nonlinearly with an increase in production, as follows: Profit_A = 50 * A * (1 - 0.01 * A), Profit_B = 70 * B * (1 - 0.01 * B), and Profit_C = 90 * C * (1 - 0.01 * C). The company aims to maximize the total profit.\n\nThe company has a total production capacity of 1000 units per month. Due to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB.\n\nPlease help the company determine the optimal number of units of each component to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (50 * A * (1 - 0.01 * A) + 70 * B * (1 - 0.01 * B) + 90 * C * (1 - 0.01 * C))\n## convert the non-linear objective to a linear one by introducing new variables and constraints\nA_profit = model.addVar(name=\"A_profit\")\nB_profit = model.addVar(name=\"B_profit\")\nC_profit = model.addVar(name=\"C_profit\")\nmodel.addCons(A_profit == 50 * A * (1 - 0.01 * A))\nmodel.addCons(B_profit == 70 * B * (1 - 0.01 * B))\nmodel.addCons(C_profit == 90 * C * (1 - 0.01 * C))\nmodel.addCons(obj == A_profit + B_profit + C_profit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n## Due to raw material limitations, the production of ComponentA cannot exceed twice the production of ComponentB.\nmodel.addCons(A <= 2 * B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 785,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the product A line can produce 10 units per hour, with a cost of $5 per unit.\nEach worker on the product B line can produce 15 units per hour, with a cost of $7 per unit.\nEach worker on the product C line can produce 20 units per hour, with a cost of $9 per unit.\nThe manufacturer wants to maximize the profit, which is the total revenue minus the total cost. The selling price for each product is $10.\n// Total revenue: Revenue = 10 * (10 * A + 15 * B + 20 * C)\n// Total cost: Cost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// A + B + C <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 20 workers.\n// A <= 20; B <= 20; C <= 20\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\n// 10 * A >= 200\n// 15 * B >= 300\n// 20 * C >= 400",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rates and costs per unit for each product are given in the following Table.\n\n| Product | Production Rate per Worker (units/hour) | Cost per Unit ($) | Selling Price per Unit ($) |\n|---------|-----------------------------------------|-------------------|----------------------------|\n| A       | 10                                      | 5                 | 10                         |\n| B       | 15                                      | 7                 | 10                         |\n| C       | 20                                      | 9                 | 10                         |\n\nThe manufacturer wants to maximize the profit, which is the total revenue minus the total cost. There are a total of 50 workers available. Each production line can handle a maximum of 20 workers. The manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\n\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of workers on product A line\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of workers on product B line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Total revenue: Revenue = 10 * (10 * A + 15 * B + 20 * C)\n## Total cost: Cost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 10 * (10 * A + 15 * B + 20 * C)\nCost = 5 * 10 * A + 7 * 15 * B + 9 * 20 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(A + B + C <= 50)\n## Each production line can handle a maximum of 20 workers.\nmodel.addCons(A <= 20)\nmodel.addCons(B <= 20)\nmodel.addCons(C <= 20)\n## The manufacturer must produce at least 200 units of product A, 300 units of product B, and 400 units of product C daily.\nmodel.addCons(10 * A >= 200)\nmodel.addCons(15 * B >= 300)\nmodel.addCons(20 * C >= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on product A line: \", model.getVal(A))\n    print(\"Number of workers on product B line: \", model.getVal(B))\n    print(\"Number of workers on product C line: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1213,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered.\n// Total daily cost: Cost = 500 * T + 300 * V + 100 * B\n// Total packages delivered: Packages = 100 * T + 50 * V + 20 * B\n// The company needs to deliver at least 2000 packages per day.\n// So, the objective function is: Minimize Cost subject to Packages >= 2000\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle operations.\n// 500 * T + 300 * V + 100 * B <= 10,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30\n\n## Generate Constraint-3:\nThe company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons.\n// B >= 0.2 * (T + V + B)\n\n## Generate Constraint-4:\nTo maintain a balanced fleet, the number of Trucks must not exceed the combined number of Vans and Bikes.\n// T <= V + B",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements. Each Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered. The company has a budget of $10,000 per day for vehicle operations. Due to maintenance constraints, the total number of vehicles cannot exceed 30. The company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons. To maintain a balanced fleet, the number of Trucks must not exceed the combined number of Vans and Bikes. The company needs to deliver at least 2000 packages per day. Please help the company to minimize the total daily cost while meeting all these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## Total daily cost: Cost = 500 * T + 300 * V + 100 * B\nCost = 500 * T + 300 * V + 100 * B\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The company has a budget of $10,000 per day for vehicle operations.\nmodel.addCons(500 * T + 300 * V + 100 * B <= 10000)\n## Due to maintenance constraints, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n## The company has a policy to ensure that at least 20% of the total vehicles are Bikes for environmental reasons.\nmodel.addCons(B >= 0.2 * (T + V + B))\n## To maintain a balanced fleet, the number of Trucks must not exceed the combined number of Vans and Bikes.\nmodel.addCons(T <= V + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1059,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency.\n// {\"number of workers on production unit 1\": \"U1\", \"range\": \"U1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"U2\", \"range\": \"U2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"U3\", \"range\": \"U3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach production unit has a different efficiency in producing the components. \nOn production unit 1, each worker can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. \nOn production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. \nOn production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour.\nThe company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. Determine the minimum total production time to meet the daily demand.\n// The production time for component A: T1 = 500 / (10 * U1 + 12 * U2 + 14 * U3)\n// The production time for component B: T2 = 750 / (15 * U1 + 18 * U2 + 20 * U3)\n// The production time for component C: T3 = 1000 / (20 * U1 + 22 * U2 + 24 * U3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// U1 + U2 + U3 <= 60",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, and the manager needs to decide how many workers to allocate to each unit to optimize production efficiency. The efficiency of each production unit in producing the components is as follows:\n\n| Production Unit | Efficiency per Worker (Units/Hour) |\n|-----------------|------------------------------------|\n| 1               | A: 10, B: 15, C: 20                |\n| 2               | A: 12, B: 18, C: 22                |\n| 3               | A: 14, B: 20, C: 24                |\n\nThe company needs to produce at least 500 units of component A, 750 units of component B, and 1000 units of component C daily. The three production units must operate simultaneously. There are a total of 60 workers available.\n\nPlease help the company determine the minimum total production time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nU1 = model.addVar(vtype=\"INTEGER\", name=\"U1\", lb=0) # number of workers on production unit 1\nU2 = model.addVar(vtype=\"INTEGER\", name=\"U2\", lb=0) # number of workers on production unit 2\nU3 = model.addVar(vtype=\"INTEGER\", name=\"U3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nT1 = model.addVar('T1') # production time for component A\nT2 = model.addVar('T2') # production time for component B\nT3 = model.addVar('T3') # production time for component C\nmodel.addCons(T1 == 500 / (10 * U1 + 12 * U2 + 14 * U3))\nmodel.addCons(T2 == 750 / (15 * U1 + 18 * U2 + 20 * U3))\nmodel.addCons(T3 == 1000 / (20 * U1 + 22 * U2 + 24 * U3))\n## the objective function is: Minimize max(T1, T2, T3)\n## convert the division to multiplication\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(U1 + U2 + U3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(U1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(U2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(U3))\n    print(\"Minimum Total Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000\n\n## Generate Constraint-2:\nThe company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units.\n// S + T + L <= 500\n\n## Generate Constraint-3:\nThe company has a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce.\n// S + T + L <= 400",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company has a budget constraint that limits the total production cost to $100,000, where the cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500. The company also has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units. Additionally, there is a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## The profit function for smartphones is P_S = 500S - 0.1S^2\n## The profit function for tablets is P_T = 600T - 0.15T^2\n## The profit function for laptops is P_L = 800L - 0.2L^2\n## The objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = model.addVar(name=\"P_S\")\nP_T = model.addVar(name=\"P_T\")\nP_L = model.addVar(name=\"P_L\")\nP_total = model.addVar(name=\"P_total\")\nmodel.setObjective(P_total, \"maximize\")\nmodel.addCons(P_S == 500*S - 0.1*S**2)\nmodel.addCons(P_T == 600*T - 0.15*T**2)\nmodel.addCons(P_L == 800*L - 0.2*L**2)\nmodel.addCons(P_total == P_S + P_T + P_L)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $100,000\nmodel.addCons(200*S + 300*T + 500*L <= 100000)\n## The company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units\nmodel.addCons(S + T + L <= 500)\n## The company has a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce\nmodel.addCons(S + T + L <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Total Profit: \", model.getVal(P_total))\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rates of each product and the amount of money to invest in a new production line that will increase the efficiency of all products.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in new production line\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The initial production cost per unit for product 1 is $100, for product 2 is $150, and for product 3 is $200. The selling price per unit for product 1 is $150, for product 2 is $225, and for product 3 is $300. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - 100 + 0.0005 * Investment) * P1\n// Total profit for product 2: Profit2 = (225 - 150 + 0.0005 * Investment) * P2\n// Total profit for product 3: Profit3 = (300 - 200 + 0.0005 * Investment) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total investment in the new production line cannot exceed $500,000.\n// Investment <= 500000\n\n## Generate Constraint-2:\nThe company must produce at least 100 units of each product per day.\n// P1 >= 100; P2 >= 100; P3 >= 100\n\n## Generate Constraint-3:\nThe total production rate of all products must not exceed 500 units per day.\n// P1 + P2 + P3 <= 500",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rates of each product (P1, P2, P3) and the amount of money to invest in a new production line (Investment) that will increase the efficiency of all products. The production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The initial production cost per unit for product 1 is $100, for product 2 is $150, and for product 3 is $200. The selling price per unit for product 1 is $150, for product 2 is $225, and for product 3 is $300. The company aims to maximize the total profit from all products. The total investment in the new production line cannot exceed $500,000. The company must produce at least 100 units of each product per day. The total production rate of all products must not exceed 500 units per day.\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=100) # production rate of product 3\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0) # investment in new production line\n\n# Define objective function\n## The production efficiency of each product increases by 5% for every $100,000 invested in the new production line.\n## Total profit for product 1: Profit1 = (150 - 100 + 0.0005 * Investment) * P1\n## Total profit for product 2: Profit2 = (225 - 150 + 0.0005 * Investment) * P2\n## Total profit for product 3: Profit3 = (300 - 200 + 0.0005 * Investment) * P3\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nProfit1 = (150 - 100 + 0.0005 * Investment) * P1\nProfit2 = (225 - 150 + 0.0005 * Investment) * P2\nProfit3 = (300 - 200 + 0.0005 * Investment) * P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total investment in the new production line cannot exceed $500,000.\nmodel.addCons(Investment <= 500000)\n## The company must produce at least 100 units of each product per day.\nmodel.addCons(P1 >= 100)\nmodel.addCons(P2 >= 100)\nmodel.addCons(P3 >= 100)\n## The total production rate of all products must not exceed 500 units per day.\nmodel.addCons(P1 + P2 + P3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in New Production Line: \", model.getVal(Investment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per month.\n// B >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n\n| Product | Profit per Unit | Production Cost Model |\n|---------|-----------------|-----------------------|\n| A       | $50             | 0.01 * A^2           |\n| B       | $70             | 0.02 * B^2           |\n| C       | $90             | 0.03 * C^2           |\n\nThe total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month, and for product B is at least 150 units per month. Please help the company determine the optimal production quantities for products A, B, and C to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n## Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1240,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\n// {\"number of units of cake A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has only one oven and can only bake one type of cake at a time. The bakery aims to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n// Profit of A: Profit_A = (20 - 5) * A\n// Profit of B: Profit_B = (30 - 10) * B\n// Profit of C: Profit_C = (40 - 15) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1000 for ingredients for the month.\n// 5 * A + 10 * B + 15 * C <= 1000\n\n## Generate Constraint-2:\nThe bakery wants to bake at least 50 units of each cake for the month.\n// A >= 50; B >= 50; C >= 50",
        "question": "A bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has a budget of $1000 for ingredients for the month. The bakery wants to bake at least 50 units of each cake for the month. The bakery has only one oven and can only bake one type of cake at a time. \nPlease help the bakery to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to bake at least 50 units of each cake for the month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of cake A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of cake B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of cake C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (30 - 10) * B\nProfit_C = (40 - 15) * C\nBakingTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a budget of $1000 for ingredients for the month.\nmodel.addCons(5 * A + 10 * B + 15 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(A))\n    print(\"Number of Cake B: \", model.getVal(B))\n    print(\"Number of Cake C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 849,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of component A is 10 units per worker per hour, component B is 15 units per worker per hour, and component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units. The objective is to maximize the total production while meeting these thresholds.\n// Total production of component A: PA = 10 * WA\n// Total production of component B: PB = 15 * WB\n// Total production of component C: PC = 20 * WC\n// Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\n\n## Generate Constraint-1:\nThe total number of workers available is 50.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can handle a maximum of 25 workers.\n// WA <= 25; WB <= 25; WC <= 25",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rates of these components depend on the number of skilled workers assigned to each production line. The production rate for component A is 10 units per worker per hour, for component B is 15 units per worker per hour, and for component C is 20 units per worker per hour. The manufacturer aims to maximize the total production of all components while ensuring that the production of each component meets a certain threshold. The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units.\n\n| Component | Production Rate per Worker per Hour |\n|-----------|-------------------------------------|\n| A         | 10                                  |\n| B         | 15                                  |\n| C         | 20                                  |\n\nThe total number of workers available is 50. Each production line can handle a maximum of 25 workers. Please help the manufacturer to maximize the total production of components A, B, and C while meeting the specified thresholds and constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## Total production of component A: PA = 10 * WA\n## Total production of component B: PB = 15 * WB\n## Total production of component C: PC = 20 * WC\n## Objective function: Maximize PA + PB + PC, subject to PA >= 500, PB >= 750, PC >= 1000\nPA = 10 * WA\nPB = 15 * WB\nPC = 20 * WC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n## The total number of workers available is 50.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can handle a maximum of 25 workers.\nmodel.addCons(WA <= 25)\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\n## The threshold for component A is 500 units, for component B is 750 units, and for component C is 1000 units.\nmodel.addCons(PA >= 500)\nmodel.addCons(PB >= 750)\nmodel.addCons(PC >= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Maximized Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1130,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin.\n// {\"production rate of MachineA\": \"MachineAProduction\", \"range\": \"MachineAProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBProduction\", \"range\": \"MachineBProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCProduction\", \"range\": \"MachineCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineAProduction\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBProduction\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCProduction\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// MachineAProduction + MachineBProduction + MachineCProduction <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineBProduction <= 2 * MachineAProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials of $450,000 per month.\n// 300 * MachineAProduction + 400 * MachineBProduction + 500 * MachineCProduction <= 450,000\n\n## Generate Constraint-4:\nTo maintain market presence, the company must produce at least 50 units of each machine type per month.\n// MachineAProduction >= 50; MachineBProduction >= 50; MachineCProduction >= 50",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company has a total production capacity of 1000 units per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget constraint for raw materials of $450,000 per month. To maintain market presence, the company must produce at least 50 units of each machine type per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAProduction\", lb=50) # production rate of MachineA\nMachineBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBProduction\", lb=50) # production rate of MachineB\nMachineCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCProduction\", lb=50) # production rate of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 300) * MachineAProduction\nProfit_MachineB = (700 - 400) * MachineBProduction\nProfit_MachineC = (900 - 500) * MachineCProduction\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(MachineAProduction + MachineBProduction + MachineCProduction <= 1000)\n# Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineBProduction <= 2 * MachineAProduction)\n# The company has a budget constraint for raw materials of $450,000 per month.\nmodel.addCons(300 * MachineAProduction + 400 * MachineBProduction + 500 * MachineCProduction <= 450000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineAProduction))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBProduction))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 780,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 20A + 30B + 40C\n// Total cost: Cost = 10A + 20B + 30C\n// So, the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1500 for production costs.\n// 10A + 20B + 30C <= 1500",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost.\nThe plant has a limited budget of $1500 for production costs.\nPlease help the plant to determine the optimal number of units of each product to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 20 * A + 30 * B + 40 * C\nCost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The plant has a limited budget of $1500 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm aims to maximize the profit efficiency (profit per liter of water used).\n// Profit_A = 1000 * A - 200 * A\n// Profit_B = 1500 * B - 300 * B\n// Profit_C = 2000 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5000 * A + 7000 * B + 10000 * C)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 500,000 liters.\n// 5000 * A + 7000 * B + 10000 * C <= 500000\n\n## Generate Constraint-2:\nThe farm has a budget of $15000 for fertilizer costs.\n// 200 * A + 300 * B + 400 * C <= 15000\n\n## Generate Constraint-3:\nThe farm has a total land area of 100 hectares.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop.\nFor Crop A, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor Crop B, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor Crop C, the profit per hectare is $2000, the water usage per hectare is 10000 liters, and the fertilizer cost per hectare is $400.\nThe farm has a limited water supply of 500,000 liters. The farm has a budget of $15000 for fertilizer costs. The farm has a total land area of 100 hectares.\nPlease help the farm to maximize the profit efficiency (profit per liter of water used).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (1000 - 200) * A\nProfit_B = (1500 - 300) * B\nProfit_C = (2000 - 400) * C\nWaterUsage = 5000 * A + 7000 * B + 10000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a limited water supply of 500,000 liters.\nmodel.addCons(5000 * A + 7000 * B + 10000 * C <= 500000)\n## The farm has a budget of $15000 for fertilizer costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 15000)\n## The farm has a total land area of 100 hectares.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints.\n// {\"quantity of D1\": \"D1\", \"range\": \"D1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D2\": \"D2\", \"range\": \"D2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of D3\": \"D3\", \"range\": \"D3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of D1 is $30, D2 is $40, and D3 is $50. The production cost per unit of D1 is $10, D2 is $15, and D3 is $20. The manufacturer wants to maximize the total profit.\n// Profit_D1 = 30 * D1 - 10 * D1\n// Profit_D2 = 40 * D2 - 15 * D2\n// Profit_D3 = 50 * D3 - 20 * D3\n// So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget of $5000 for production costs.\n// 10 * D1 + 15 * D2 + 20 * D3 <= 5000\n\n## Generate Constraint-2:\nThe production capacity for D1 is 100 units, D2 is 150 units, and D3 is 200 units.\n// D1 <= 100; D2 <= 150; D3 <= 200\n\n## Generate Constraint-3:\nThe total production quantity must not exceed 300 units due to market demand constraints.\n// D1 + D2 + D3 <= 300\n\n## Generate Constraint-4:\nThe manufacturer must produce at least 50 units of D1 to fulfill a contract.\n// D1 >= 50",
        "question": "A manufacturer produces three types of electronic devices: D1, D2, and D3. They need to determine the optimal production quantities for each device to maximize their profit while considering various constraints. The profit per unit of D1 is $30, D2 is $40, and D3 is $50. The production cost per unit of D1 is $10, D2 is $15, and D3 is $20. The manufacturer has a limited budget of $5000 for production costs. The production capacity for D1 is 100 units, D2 is 150 units, and D3 is 200 units. The total production quantity must not exceed 300 units due to market demand constraints. The manufacturer must produce at least 50 units of D1 to fulfill a contract. Please help the manufacturer to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nD1 = model.addVar(vtype=\"INTEGER\", name=\"D1\", lb=50) # quantity of D1\nD2 = model.addVar(vtype=\"INTEGER\", name=\"D2\", lb=0) # quantity of D2\nD3 = model.addVar(vtype=\"INTEGER\", name=\"D3\", lb=0) # quantity of D3\n\n# Define objective function\nProfit_D1 = 30 * D1 - 10 * D1\nProfit_D2 = 40 * D2 - 15 * D2\nProfit_D3 = 50 * D3 - 20 * D3\n# So, the objective function is: Maximize (Profit_D1 + Profit_D2 + Profit_D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_D1 + Profit_D2 + Profit_D3)\n\n# Add constraints\n# The manufacturer has a limited budget of $5000 for production costs.\nmodel.addCons(10 * D1 + 15 * D2 + 20 * D3 <= 5000)\n# The production capacity for D1 is 100 units, D2 is 150 units, and D3 is 200 units.\nmodel.addCons(D1 <= 100)\nmodel.addCons(D2 <= 150)\nmodel.addCons(D3 <= 200)\n# The total production quantity must not exceed 300 units due to market demand constraints.\nmodel.addCons(D1 + D2 + D3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of D1: \", model.getVal(D1))\n    print(\"Quantity of D2: \", model.getVal(D2))\n    print(\"Quantity of D3: \", model.getVal(D3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 718,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand.\n// {\"quantity of Classic cake\": \"Classic\", \"range\": \"Classic >= 0\", \"type\": \"integer\"}\n// {\"quantity of Chocolate cake\": \"Chocolate\", \"range\": \"Chocolate >= 0\", \"type\": \"integer\"}\n// {\"quantity of Fruit cake\": \"Fruit\", \"range\": \"Fruit >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The bakery aims to maximize the total daily profit from selling the cakes.\n// Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\n// Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\n// Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\n// So, the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\n\n## Generate Constraint-1:\nThe bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg.\n// 200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000\n\n## Generate Constraint-2:\nThe market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units.\n// Classic <= 150; Chocolate <= 200; Fruit <= 180\n\n## Generate Constraint-3:\nThe bakery has a daily production capacity of 450 cakes in total.\n// Classic + Chocolate + Fruit <= 450\n\n## Generate Constraint-4:\nThe bakery must produce at least 20 units of each type of cake to maintain its reputation and customer base.\n// Classic >= 20; Chocolate >= 20; Fruit >= 20",
        "question": "A bakery produces three types of cakes: Classic, Chocolate, and Fruit. The bakery needs to determine the quantities of each cake to produce daily to maximize profit while considering the constraints of ingredients and market demand. The profit per Classic cake is $10, per Chocolate cake is $15, and per Fruit cake is $12. Due to the popularity of the cakes, the profit per unit increases by $0.02 for each additional cake produced beyond 30 units for that type. The bakery has a limited supply of ingredients. Each Classic cake requires 200 g of flour, each Chocolate cake requires 250 g of flour, and each Fruit cake requires 220 g of flour. The total available flour is 7 kg. The market has a demand limit for each type of cake. The demand for Classic cakes is at most 150 units, for Chocolate cakes is at most 200 units, and for Fruit cakes is at most 180 units. The bakery has a daily production capacity of 450 cakes in total. The bakery must produce at least 20 units of each type of cake to maintain its reputation and customer base. Please help the bakery to maximize the total daily profit from selling the cakes.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery must produce at least 20 units of each type of cake to maintain its reputation and customer base.\nClassic = model.addVar(vtype=\"INTEGER\", name=\"Classic\", lb=20) # quantity of Classic cake\nChocolate = model.addVar(vtype=\"INTEGER\", name=\"Chocolate\", lb=20) # quantity of Chocolate cake\nFruit = model.addVar(vtype=\"INTEGER\", name=\"Fruit\", lb=20) # quantity of Fruit cake\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Classic = max(10 + 0.02 * (Classic - 30), 10) * Classic\nClassic1 = model.addVar(vtype=\"INTEGER\", name=\"Classic1\", lb=0, ub=30)\nClassic2 = model.addVar(vtype=\"INTEGER\", name=\"Classic2\", lb=30, ub=150)\nClassic_b1 = model.addVar(vtype=\"B\", name=\"Classic_b1\")\nClassic_b2 = model.addVar(vtype=\"B\", name=\"Classic_b2\")\nmodel.addCons(Classic_b1 + Classic_b2 == 1)\nmodel.addCons(Classic == Classic1*Classic_b1 + Classic2*Classic_b2)\nProfit_Classic = 10 * Classic1 * Classic_b1 + (10 + 0.02 * (Classic2 - 30)) * Classic2 * Classic_b2\n## create piecewise variables for piecewise function: Profit_Chocolate = max(15 + 0.02 * (Chocolate - 30), 15) * Chocolate\nChocolate1 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate1\", lb=0, ub=30)\nChocolate2 = model.addVar(vtype=\"INTEGER\", name=\"Chocolate2\", lb=30, ub=200)\nChocolate_b1 = model.addVar(vtype=\"B\", name=\"Chocolate_b1\")\nChocolate_b2 = model.addVar(vtype=\"B\", name=\"Chocolate_b2\")\nmodel.addCons(Chocolate_b1 + Chocolate_b2 == 1)\nmodel.addCons(Chocolate == Chocolate1*Chocolate_b1 + Chocolate2*Chocolate_b2)\nProfit_Chocolate = 15 * Chocolate1 * Chocolate_b1 + (15 + 0.02 * (Chocolate2 - 30)) * Chocolate2 * Chocolate_b2\n## create piecewise variables for piecewise function: Profit_Fruit = max(12 + 0.02 * (Fruit - 30), 12) * Fruit\nFruit1 = model.addVar(vtype=\"INTEGER\", name=\"Fruit1\", lb=0, ub=30)\nFruit2 = model.addVar(vtype=\"INTEGER\", name=\"Fruit2\", lb=30, ub=180)\nFruit_b1 = model.addVar(vtype=\"B\", name=\"Fruit_b1\")\nFruit_b2 = model.addVar(vtype=\"B\", name=\"Fruit_b2\")\nmodel.addCons(Fruit_b1 + Fruit_b2 == 1)\nmodel.addCons(Fruit == Fruit1*Fruit_b1 + Fruit2*Fruit_b2)\nProfit_Fruit = 12 * Fruit1 * Fruit_b1 + (12 + 0.02 * (Fruit2 - 30)) * Fruit2 * Fruit_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Classic + Profit_Chocolate + Profit_Fruit\nmodel.addCons(obj == Profit_Classic + Profit_Chocolate + Profit_Fruit)\n\n# Add constraints\nmodel.addCons(200 * Classic + 250 * Chocolate + 220 * Fruit <= 7000)\nmodel.addCons(Classic <= 150)\nmodel.addCons(Chocolate <= 200)\nmodel.addCons(Fruit <= 180)\nmodel.addCons(Classic + Chocolate + Fruit <= 450)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Classic cake: \", model.getVal(Classic))\n    print(\"Quantity of Chocolate cake: \", model.getVal(Chocolate))\n    print(\"Quantity of Fruit cake: \", model.getVal(Fruit))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1123,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop. Additionally, the farm is considering investing in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop.\n// {\"area for Crop A\": \"AreaA\", \"range\": \"AreaA >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop B\": \"AreaB\", \"range\": \"AreaB >= 0\", \"type\": \"continuous\"}\n// {\"area for Crop C\": \"AreaC\", \"range\": \"AreaC >= 0\", \"type\": \"continuous\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of Crop A is 0.5 tons per acre without irrigation and increases by 0.1 tons per acre for every $1000 invested in irrigation. The yield of Crop B is 0.6 tons per acre without irrigation and increases by 0.15 tons per acre for every $1000 invested in irrigation. The yield of Crop C is 0.7 tons per acre without irrigation and increases by 0.2 tons per acre for every $1000 invested in irrigation. The selling price for each ton of Crop A, Crop B, and Crop C is $1000, $1200, and $1500 respectively. The farm aims to maximize the total revenue from all crops.\n// Revenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\n// Revenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\n// Revenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C)\n\n## Generate Constraint-1:\nThe total area available for cultivation is 100 acres.\n// AreaA + AreaB + AreaC <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation investments.\n// Irrigation <= 50000",
        "question": "A farm is planning to cultivate three types of crops: Crop A, Crop B, and Crop C. The farm needs to decide on the area (in acres) to allocate for each crop and the amount to invest in irrigation systems to improve water efficiency, which will affect the water usage and yield of each crop. The yield and the effect of irrigation on each crop are given in the following Table.\n\n| Crop | Yield without Irrigation | Increase in Yield per $1000 of Irrigation | Selling Price per Ton |\n|------|--------------------------|------------------------------------------|-----------------------|\n| A    | 0.5 tons/acre            | 0.1 tons/acre                            | $1000                 |\n| B    | 0.6 tons/acre            | 0.15 tons/acre                           | $1200                 |\n| C    | 0.7 tons/acre            | 0.2 tons/acre                            | $1500                 |\n\nThe total area available for cultivation is 100 acres. The farm has a budget of $50,000 for irrigation investments. The farm aims to maximize the total revenue from all crops. Please help the farm determine the optimal allocation of area for each crop and the investment in irrigation to maximize revenue.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nAreaA = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaA\", lb=0)  # area for Crop A\nAreaB = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaB\", lb=0)  # area for Crop B\nAreaC = model.addVar(vtype=\"CONTINUOUS\", name=\"AreaC\", lb=0)  # area for Crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0)  # investment in irrigation\n\n# Define objective function\nRevenue_A = 1000 * (0.5 + 0.0001 * Irrigation) * AreaA\nRevenue_B = 1200 * (0.6 + 0.00015 * Irrigation) * AreaB\nRevenue_C = 1500 * (0.7 + 0.0002 * Irrigation) * AreaC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\nmodel.addCons(AreaA + AreaB + AreaC <= 100)\nmodel.addCons(Irrigation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(AreaA))\n    print(\"Area for Crop B: \", model.getVal(AreaB))\n    print(\"Area for Crop C: \", model.getVal(AreaC))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1199,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function for each device is nonlinear:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\nThe objective is to maximize the total profit, which is the sum of the profits from each device:\n// Maximize P_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\n// S <= 100; T <= 100; L <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function for each device is nonlinear:\n- Profit from smartphones: P_S = 100S - 0.5S^2\n- Profit from tablets: P_T = 150T - 0.6T^2\n- Profit from laptops: P_L = 200L - 0.7L^2\nThe company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\nPlease help the company to maximize the total profit, which is the sum of the profits from each device: P_total = P_S + P_T + P_L = (100S - 0.5S^2) + (150T - 0.6T^2) + (200L - 0.7L^2).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=100) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=100) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=100) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit functions\nP_S = 100 * S - 0.5 * S**2\nP_T = 150 * T - 0.6 * T**2\nP_L = 200 * L - 0.7 * L**2\n## the objective function is: Maximize P_total = P_S + P_T + P_L\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\n## The company has a limited production capacity. It can produce a maximum of 100 units of any single device type.\nmodel.addCons(S <= 100)\nmodel.addCons(T <= 100)\nmodel.addCons(L <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices.\n// Profit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\n// Profit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\n// Profit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// Smartphones + Tablets + Laptops <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit. The energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units across all devices. The total investment in energy efficiency upgrades cannot exceed $50,000.\nPlease help the company to determine the optimal production quantities of Smartphones, Tablets, and Laptops, and the investment in energy efficiency to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # quantity of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # quantity of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # quantity of Laptops\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\nProfit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\nProfit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops <= 10000)  # total production capacity constraint\nmodel.addCons(EnergyEfficiency <= 50000)  # investment in energy efficiency constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n\n| Device     | Profit Function                | Production Cost |\n|------------|--------------------------------|-----------------|\n| Smartphones| P_S = 500S - 0.1S^2           | $200            |\n| Tablets    | P_T = 600T - 0.15T^2          | $300            |\n| Laptops    | P_L = 800L - 0.2L^2           | $500            |\n\nThe company has a budget constraint that limits the total production cost to $100,000. Please help the company determine the optimal number of smartphones (S), tablets (T), and laptops (L) to produce to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## The profit function for smartphones is P_S = 500S - 0.1S^2\n## The profit function for tablets is P_T = 600T - 0.15T^2\n## The profit function for laptops is P_L = 800L - 0.2L^2\n## The objective function is: Maximize P_total = P_S + P_T + P_L\nP_S = model.addVar(name=\"P_S\")\nP_T = model.addVar(name=\"P_T\")\nP_L = model.addVar(name=\"P_L\")\nP_total = model.addVar(name=\"P_total\")\n\nmodel.setObjective(P_total, \"maximize\")\n\nmodel.addCons(P_S == 500 * S - 0.1 * S**2)\nmodel.addCons(P_T == 600 * T - 0.15 * T**2)\nmodel.addCons(P_L == 800 * L - 0.2 * L**2)\nmodel.addCons(P_total == P_S + P_T + P_L)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $100,000\nmodel.addCons(200 * S + 300 * T + 500 * L <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment.\n// {\"production quantity of DeviceA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total cost for DeviceA: CostA = (100 - 0.0001 * Automation) * QuantityA\n// Total cost for DeviceB: CostB = (150 - 0.0001 * Automation) * QuantityB\n// Total cost for DeviceC: CostC = (200 - 0.0001 * Automation) * QuantityC\n// Total revenue for DeviceA: RevenueA = 150 * QuantityA\n// Total revenue for DeviceB: RevenueB = 200 * QuantityB\n// Total revenue for DeviceC: RevenueC = 250 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investment.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all devices is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment. The production cost per unit, selling price per unit, and the effect of automation on production costs are given in the following Table.\n\n| Device | Production Cost per Unit | Selling Price per Unit | Effect of Automation on Production Cost |\n|--------|--------------------------|------------------------|----------------------------------------|\n| DeviceA | $100                     | $150                   | $1 reduction for every $10,000 in automation |\n| DeviceB | $150                     | $200                   | $1 reduction for every $10,000 in automation |\n| DeviceC | $200                     | $250                   | $1 reduction for every $10,000 in automation |\n\nThe company has a budget of $100,000 for automation investment. The total production capacity for all devices is 10,000 units. Please help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of DeviceA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of DeviceB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = (100 - 0.0001 * Automation) * QuantityA\nCostB = (150 - 0.0001 * Automation) * QuantityB\nCostC = (200 - 0.0001 * Automation) * QuantityC\nRevenueA = 150 * QuantityA\nRevenueB = 200 * QuantityB\nRevenueC = 250 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of DeviceA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of DeviceB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of DeviceC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1197,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The fuel cost is a significant factor in the company's operational costs.\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 15 * B\n// Cargo carried by C: Cargo_C = 20 * C\n// Fuel consumed by A: Fuel_A = 5 * A\n// Fuel consumed by B: Fuel_B = 7 * B\n// Fuel consumed by C: Fuel_C = 9 * C\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle fuel for the month.\n// 5 * A + 7 * B + 9 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance capacity for at most 50 vehicles per month.\n// A + B + C <= 50",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The fuel cost is a significant factor in the company's operational costs.\nThe company has a budget of $10,000 for vehicle fuel for the month. The company also has a maintenance capacity for at most 50 vehicles per month.\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_A = 10 * A\nCargo_B = 15 * B\nCargo_C = 20 * C\nFuel_A = 5 * A\nFuel_B = 7 * B\nFuel_C = 9 * C\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C) == Cargo_A + Cargo_B + Cargo_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle fuel for the month.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 10000)\n## The company has a maintenance capacity for at most 50 vehicles per month.\nmodel.addCons(A + B + C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands.\n// The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n// The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n// The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 <= 50\n\n## Generate Constraint-2:\nEach production unit can be staffed by up to 20 workers.\n// W1 <= 20; W2 <= 20; W3 <= 20\n\n## Generate Constraint-3:\nThe production of component A must not exceed 1200 units.\n// 10 * W1 + 12 * W2 + 14 * W3 <= 1200",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit. Each worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The company has a total of 50 workers available and each production unit can be staffed by up to 20 workers. The production of component A must not exceed 1200 units. Please help the company to minimize the total production time to meet these demands, which is defined as the maximum of the production times for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n## The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n## The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * W1 + 12 * W2 + 14 * W3) == 1000)\nmodel.addCons(T2 * (15 * W1 + 18 * W2 + 20 * W3) == 1500)\nmodel.addCons(T3 * (20 * W1 + 22 * W2 + 24 * W3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n## Each production unit can be staffed by up to 20 workers.\nmodel.addCons(W1 <= 20)\nmodel.addCons(W2 <= 20)\nmodel.addCons(W3 <= 20)\n## The production of component A must not exceed 1200 units.\nmodel.addCons(10 * W1 + 12 * W2 + 14 * W3 <= 1200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(W3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints.\n// {\"production rate of ChemX\": \"ChemXRate\", \"range\": \"ChemXRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemY\": \"ChemYRate\", \"range\": \"ChemYRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemZ\": \"ChemZRate\", \"range\": \"ChemZRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, ChemY is $150, and ChemZ is $200. The production cost per unit of ChemX is $50, ChemY is $70, and ChemZ is $100. The company wants to maximize the total profit.\n// Profit_ChemX = (100 - 50) * ChemXRate\n// Profit_ChemY = (150 - 70) * ChemYRate\n// Profit_ChemZ = (200 - 100) * ChemZRate\n// So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 100 units per hour.\n// ChemXRate + ChemYRate + ChemZRate <= 100\n\n## Generate Constraint-2:\nDue to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\n// ChemYRate <= 2 * ChemXRate",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production rates of each chemical to optimize their profit while considering safety and efficiency constraints. The profit and production cost per unit for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Cost per Unit |\n|----------|-----------------|--------------------------|\n| ChemX    | $100            | $50                      |\n| ChemY    | $150            | $70                      |\n| ChemZ    | $200            | $100                     |\n\nThe company has a total production capacity of 100 units per hour. Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX. \n\nPlease help the company to maximize the total profit by determining the optimal production rates for ChemX, ChemY, and ChemZ.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemXRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemXRate\", lb=0) # production rate of ChemX\nChemYRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemYRate\", lb=0) # production rate of ChemY\nChemZRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemZRate\", lb=0) # production rate of ChemZ\n\n# Define objective function\nProfit_ChemX = (100 - 50) * ChemXRate\nProfit_ChemY = (150 - 70) * ChemYRate\nProfit_ChemZ = (200 - 100) * ChemZRate\n# So, the objective function is: Maximize (Profit_ChemX + Profit_ChemY + Profit_ChemZ)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemX + Profit_ChemY + Profit_ChemZ)\n\n# Add constraints\n# The total production capacity of the company is limited to 100 units per hour.\nmodel.addCons(ChemXRate + ChemYRate + ChemZRate <= 100)\n# Due to safety regulations, the production rate of ChemY must not exceed twice the production rate of ChemX.\nmodel.addCons(ChemYRate <= 2 * ChemXRate)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemX: \", model.getVal(ChemXRate))\n    print(\"Production Rate of ChemY: \", model.getVal(ChemYRate))\n    print(\"Production Rate of ChemZ: \", model.getVal(ChemZRate))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $30, product B generates $40, and product C generates $50. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. Specifically, the profit per unit is multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. The plant aims to maximize the total profit.\n// Profit of A: Profit_A = 30 * A * (1 - 0.01 * min(A, B, C))\n// Profit of B: Profit_B = 40 * B * (1 - 0.01 * min(A, B, C))\n// Profit of C: Profit_C = 50 * C * (1 - 0.01 * min(A, B, C))\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $10,000 for raw materials. The cost of raw materials for each unit of product A is $10, for product B is $15, and for product C is $20.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe plant has a maximum production capacity of 500 hours. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units, for product B is at least 75 units, and for product C is at least 100 units.\n// A >= 50; B >= 75; C >= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand. The profit per unit and the production requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Cost per Unit | Production Time per Unit |\n|---------|-----------------|-----------------------------|--------------------------|\n| A       | $30             | $10                         | 2 hours                  |\n| B       | $40             | $15                         | 3 hours                  |\n| C       | $50             | $20                         | 4 hours                  |\n\nThe plant has a budget of $10,000 for raw materials. The plant has a maximum production capacity of 500 hours. The market demand for product A is at least 50 units, for product B is at least 75 units, and for product C is at least 100 units. The profit per unit decreases as production increases due to economies of scale; the profit per unit is multiplied by a factor of (1 - 0.01 * min(A, B, C)) for each product. \n\nPlease help the plant to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=100) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## create a variable for min(A, B, C)\nmin_ABC = model.addVar(vtype=\"CONTINUOUS\", name=\"min_ABC\")\nmodel.addCons(min_ABC <= A)\nmodel.addCons(min_ABC <= B)\nmodel.addCons(min_ABC <= C)\n## Profit of A: Profit_A = 30 * A * (1 - 0.01 * min_ABC)\n## Profit of B: Profit_B = 40 * B * (1 - 0.01 * min_ABC)\n## Profit of C: Profit_C = 50 * C * (1 - 0.01 * min_ABC)\nProfit_A = 30 * A * (1 - 0.01 * min_ABC)\nProfit_B = 40 * B * (1 - 0.01 * min_ABC)\nProfit_C = 50 * C * (1 - 0.01 * min_ABC)\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $10,000 for raw materials.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The plant has a maximum production capacity of 500 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1311,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for each component decreases after a certain threshold of units produced, as shown in the following Table.\n\n| Component | Profit per Unit | Decrease per Unit After Threshold | Threshold |\n|-----------|-----------------|----------------------------------|-----------|\n| ComponentA | $50             | $1                               | 100 units  |\n| ComponentB | $70             | $0.5                             | 200 units  |\n| ComponentC | $100            | $2                               | 150 units  |\n\nThe company has a total production capacity of 500 units for the month. Please help the company to maximize the total profit, considering the decreasing profit per unit after each component's threshold.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=0)\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=0)\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = 50 * ComponentA1 * ComponentA_b1 + (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = 70 * ComponentB1 * ComponentB_b1 + (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = 100 * ComponentC1 * ComponentC_b1 + (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency.\n// {\"hours of operation for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach production line has a different efficiency in producing each component. Production line 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Production line 2 produces 12 units of A, 18 units of B, and 22 units of C per hour. Production line 3 produces 14 units of A, 20 units of B, and 24 units of C per hour. The company aims to maximize the total production of components A, B, and C.\n// The total production of component A: A_total = 10 * P1 + 12 * P2 + 14 * P3\n// The total production of component B: B_total = 15 * P1 + 18 * P2 + 20 * P3\n// The total production of component C: C_total = 20 * P1 + 22 * P2 + 24 * P3\n// So, the objective function is: Maximize (A_total + B_total + C_total)\n\n## Generate Constraint-1:\nThe total operating hours for all production lines must not exceed 100 hours per week.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize production efficiency. The efficiency of each production line in producing each component per hour is given in the following Table.\n\n| Production Line | Units of A Produced per Hour | Units of B Produced per Hour | Units of C Produced per Hour |\n|-----------------|------------------------------|------------------------------|------------------------------|\n| 1               | 10                           | 15                           | 20                           |\n| 2               | 12                           | 18                           | 22                           |\n| 3               | 14                           | 20                           | 24                           |\n\nThe company aims to maximize the total production of components A, B, and C. The total operating hours for all production lines must not exceed 100 hours per week.\nPlease help the company determine the optimal number of hours to operate each production line to maximize the total production of components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours of operation for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours of operation for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours of operation for production line 3\n\n# Define objective function\nA_total = 10 * P1 + 12 * P2 + 14 * P3\nB_total = 15 * P1 + 18 * P2 + 20 * P3\nC_total = 20 * P1 + 22 * P2 + 24 * P3\n# So, the objective function is: Maximize (A_total + B_total + C_total)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == A_total + B_total + C_total)\n\n# Add constraints\n# The total operating hours for all production lines must not exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line 1: \", model.getVal(P1))\n    print(\"Hours of operation for production line 2: \", model.getVal(P2))\n    print(\"Hours of operation for production line 3: \", model.getVal(P3))\n    print(\"Maximized total production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1206,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A generates a revenue of $100 per unit and requires 2 labor hours per unit, while Product B generates a revenue of $150 per unit and requires 3 labor hours per unit. The labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company aims to maximize the total profit from both products.\n// Profit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\n// Profit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total of 200 labor hours available for the month.\n// 2 * A + 3 * B <= 200\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials.\n// 30 * A + 40 * B <= 5000",
        "question": "A manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs. The revenue and labor requirements for each product are given in the following Table.\n\n| Product | Revenue per Unit | Labor Hours per Unit |\n|---------|------------------|----------------------|\n| A       | $100             | 2                    |\n| B       | $150             | 3                    |\n\nThe labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company has a total of 200 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. The raw material cost for producing A and B is $30 per unit for A and $40 per unit for B, and the company has a budget of $5000 for raw materials.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\nProfit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\nProfit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B <= 200) # Constraint-1: Total labor hours\nmodel.addCons(Automation <= 50000) # Constraint-2: Investment in automation\nmodel.addCons(30 * A + 40 * B <= 5000) # Constraint-3: Raw material cost\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse.\n// {\"number of goods in warehouse 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of goods in warehouse 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost.\n// The objective function is: Minimize (C1 + C2 + C3) = Minimize (0.05 * W1^2 + 0.03 * W2^2 + 0.04 * W3^2)\n\n## Generate Constraint-1:\nThe total number of goods available for distribution is 1000 units.\n// W1 + W2 + W3 = 1000\n\n## Generate Constraint-2:\nEach warehouse has a limited storage capacity:\n- Warehouse 1 can store up to 500 units.\n- Warehouse 2 can store up to 400 units.\n- Warehouse 3 can store up to 600 units.\n// W1 <= 500; W2 <= 400; W3 <= 600",
        "question": "A company operates three different warehouses and needs to optimize the distribution of goods among them to minimize transportation costs. The decision variables are the number of goods to be stored in each warehouse. The transportation cost from each warehouse to the market is nonlinear and depends on the volume of goods. The cost function is given by:\n- Cost from warehouse 1: C1 = 0.05 * W1^2\n- Cost from warehouse 2: C2 = 0.03 * W2^2\n- Cost from warehouse 3: C3 = 0.04 * W3^2\nThe objective is to minimize the total transportation cost. The total number of goods available for distribution is 1000 units. Each warehouse has a limited storage capacity:\n- Warehouse 1 can store up to 500 units.\n- Warehouse 2 can store up to 400 units.\n- Warehouse 3 can store up to 600 units.\nPlease help the company to determine the optimal number of goods to be stored in each warehouse to minimize the total transportation cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of goods in warehouse 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of goods in warehouse 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of goods in warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The objective function is: Minimize (C1 + C2 + C3) = Minimize (0.05 * W1^2 + 0.03 * W2^2 + 0.04 * W3^2)\nmodel.addCons(obj == 0.05 * W1**2 + 0.03 * W2**2 + 0.04 * W3**2)\n\n# Add constraints\n## The total number of goods available for distribution is 1000 units.\nmodel.addCons(W1 + W2 + W3 == 1000)\n## Each warehouse has a limited storage capacity:\nmodel.addCons(W1 <= 500)\nmodel.addCons(W2 <= 400)\nmodel.addCons(W3 <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of goods in Warehouse 1: \", model.getVal(W1))\n    print(\"Number of goods in Warehouse 2: \", model.getVal(W2))\n    print(\"Number of goods in Warehouse 3: \", model.getVal(W3))\n    print(\"Minimized Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 918,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"amount of raw materials to stock\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for automation upgrades.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 10,000 units.\n// Units <= 10000\n\n## Generate Constraint-3:\nThe amount of raw materials stocked must be sufficient to produce at least 5,000 units.\n// RawMaterials >= 5000 * Units",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock. The cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production. The company has a budget of $50,000 for automation upgrades. The total number of units produced must not exceed 10,000 units. The amount of raw materials stocked must be sufficient to produce at least 5,000 units. Please help the company determine the optimal number of units to produce, the level of automation, and the amount of raw materials to stock to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0)  # amount of raw materials to stock\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * Automation) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\nmodel.addCons(Units <= 10000)\nmodel.addCons(RawMaterials >= 5000 * Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Amount of Raw Materials to Stock: \", model.getVal(RawMaterials))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nDue to market demand, the production of ProductA must be at least twice the production of ProductB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must produce at least 100 units of ProductC to meet contractual obligations.\n// QuantityC >= 100\n\n## Generate Constraint-5:\nThe total production cost, including automation costs, must not exceed $80,000.\n// (50 - 0.01 * Automation) * QuantityA + (70 - 0.015 * Automation) * QuantityB + (90 - 0.02 * Automation) * QuantityC + Automation <= 80000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit. The selling price per unit and the production cost per unit (adjusted by the level of automation) for each product are given in the following Table.\n\n| Product | Selling Price | Production Cost (adjusted by Automation) |\n|---------|---------------|------------------------------------------|\n| ProductA | $100          | $50 - 0.01 * Automation                  |\n| ProductB | $120          | $70 - 0.015 * Automation                 |\n| ProductC | $150          | $90 - 0.02 * Automation                  |\n\nThe company has a total production capacity of 1000 units across all products. The investment in automation cannot exceed $50,000. Due to market demand, the production of ProductA must be at least twice the production of ProductB. The company must produce at least 100 units of ProductC to meet contractual obligations. The total production cost, including automation costs, must not exceed $80,000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0)  # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0)  # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0)  # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\nProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\nProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units across all products.\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\n# The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n# Due to market demand, the production of ProductA must be at least twice the production of ProductB.\nmodel.addCons(QuantityA >= 2 * QuantityB)\n# The company must produce at least 100 units of ProductC to meet contractual obligations.\nmodel.addCons(QuantityC >= 100)\n# The total production cost, including automation costs, must not exceed $80,000.\nmodel.addCons((50 - 0.01 * Automation) * QuantityA + (70 - 0.015 * Automation) * QuantityB + (90 - 0.02 * Automation) * QuantityC + Automation <= 80000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1279,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function. The total production capacity of the company is limited to 1000 units per month. Please help the company determine the optimal number of each device to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\nmodel.addCons(obj == 50*S + 60*T + 70*L - 0.01*(S**2 + T**2 + L**2))\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(S + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a selling price of $50, a material cost of $20, and requires 1 hour of labor. Product B has a selling price of $70, a material cost of $30, and requires 2 hours of labor. Product C has a selling price of $100, a material cost of $40, and requires 3 hours of labor. The company aims to maximize its profit, which is defined as the total revenue minus the total cost.\n// Revenue of A: Revenue_A = 50 * A\n// Revenue of B: Revenue_B = 70 * B\n// Revenue of C: Revenue_C = 100 * C\n// Cost of A: Cost_A = 20 * A + 1 * A\n// Cost of B: Cost_B = 30 * B + 2 * B\n// Cost of C: Cost_C = 40 * C + 3 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit.\nProduct A has a selling price of $50, a material cost of $20, and requires 1 hour of labor. Product B has a selling price of $70, a material cost of $30, and requires 2 hours of labor. Product C has a selling price of $100, a material cost of $40, and requires 3 hours of labor. The company aims to maximize its profit, which is defined as the total revenue minus the total cost. The company has a total budget of $10,000 for material costs for the next quarter.\nPlease help the company to determine the optimal production quantities of products A, B, and C to maximize its profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 100 * C\nCost_A = 20 * A + 1 * A\nCost_B = 30 * B + 2 * B\nCost_C = 40 * C + 3 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 770,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process.\n// {\"amount of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy optimization\": \"EnergyInvestment\", \"range\": \"EnergyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\n// Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total amount of raw material available is limited. The usage of raw material for product A is 2 units, for product B is 3 units, and for product C is 4 units. The total raw material available is 1000 units.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000\n\n## Generate Constraint-2:\nThe investment in energy optimization cannot exceed $50,000.\n// EnergyInvestment <= 50000\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 10 units of each product.\n// ProductA >= 10\n// ProductB >= 10\n// ProductC >= 10\n\n## Generate Constraint-4:\nThe total production of products A and B must not exceed twice the production of product C.\n// ProductA + ProductB <= 2 * ProductC",
        "question": "A manufacturer is planning to produce three types of products (A, B, and C) using three different raw materials. The manufacturer also needs to decide on the amount of energy to invest in optimizing the production process. The profit per unit of product A is $100, product B is $150, and product C is $200. The energy cost per unit decreases by $1 for every $1000 invested in energy optimization. The initial energy cost per unit is $20. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Profit per Unit | Raw Material Usage |\n|---------|-----------------|--------------------|\n| A       | $100            | 2 units            |\n| B       | $150            | 3 units            |\n| C       | $200            | 4 units            |\n\nThe total amount of raw material available is limited to 1000 units. The investment in energy optimization cannot exceed $50,000. The manufacturer must produce at least 10 units of each product. The total production of products A and B must not exceed twice the production of product C.\n\nPlease help the manufacturer to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # amount of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=10)  # amount of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=10)  # amount of product C\nEnergyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyInvestment\", lb=0)  # investment in energy optimization\n\n# Define objective function\n# Total profit: Profit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nProfit = (100 - 20 + 0.001 * EnergyInvestment) * ProductA + (150 - 20 + 0.001 * EnergyInvestment) * ProductB + (200 - 20 + 0.001 * EnergyInvestment) * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total amount of raw material available is limited.\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 1000)\n# The investment in energy optimization cannot exceed $50,000.\nmodel.addCons(EnergyInvestment <= 50000)\n# The manufacturer must produce at least 10 units of each product.\nmodel.addCons(ProductA >= 10)\nmodel.addCons(ProductB >= 10)\nmodel.addCons(ProductC >= 10)\n# The total production of products A and B must not exceed twice the production of product C.\nmodel.addCons(ProductA + ProductB <= 2 * ProductC)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Energy Optimization: \", model.getVal(EnergyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a backup generator. The decision involves the number of solar panels, wind turbines, and the capacity of the backup generator.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"capacity of the backup generator (in kW)\": \"Generator\", \"range\": \"Generator >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of each solar panel is $1000, and it generates 200 kWh per year. The cost of each wind turbine is $2000, and it generates 500 kWh per year. The cost of the backup generator is $50 per kW, and it consumes 100 kWh per kW per year. The company wants to minimize the total cost of energy generation and consumption.\n// Total cost of solar panels: Cost_Solar = 1000 * Solar\n// Total cost of wind turbines: Cost_Wind = 2000 * Wind\n// Total cost of backup generator: Cost_Generator = 50 * Generator\n// Total energy generated: Energy = 200 * Solar + 500 * Wind - 100 * Generator (negative sign for consumption)\n// So, the objective function is: Minimize Cost_Total = Cost_Solar + Cost_Wind + Cost_Generator\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 50 * Generator <= 50000\n\n## Generate Constraint-2:\nThe total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh.\n// 200 * Solar + 500 * Wind - 100 * Generator >= 20000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and a backup generator. The decision involves the number of solar panels, wind turbines, and the capacity of the backup generator. The cost and energy generation details for each type of equipment are given in the following Table.\n\n| Equipment       | Cost per Unit | Energy Generation per Unit (kWh/year) |\n|-----------------|---------------|--------------------------------------|\n| Solar Panels    | $1000         | 200                                  |\n| Wind Turbines   | $2000         | 500                                  |\n| Backup Generator| $50 per kW   | -100 (Consumption per kW per year)   |\n\nThe company has a budget of $50,000 for the installation. The total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh. Please help the company to minimize the total cost of energy generation and consumption.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nGenerator = model.addVar(vtype=\"CONTINUOUS\", name=\"Generator\", lb=0) # capacity of the backup generator\n\n# Define objective function\nCost_Solar = 1000 * Solar\nCost_Wind = 2000 * Wind\nCost_Generator = 50 * Generator\nCost_Total = Cost_Solar + Cost_Wind + Cost_Generator\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_Total)\n\n# Add constraints\n# The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 50 * Generator <= 50000)\n# The total energy generated must meet or exceed the company's annual energy demand of 20,000 kWh.\nmodel.addCons(200 * Solar + 500 * Wind - 100 * Generator >= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Capacity of Backup Generator: \", model.getVal(Generator))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units of each product to produce daily to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for product A is $10 + 0.1 * A^2, for product B is $15 + 0.15 * B^2, and for product C is $20 + 0.2 * C^2. The plant aims to maximize daily net profit.\n// Net profit of A: Profit_A = (20 - (10 + 0.1 * A^2)) * A\n// Net profit of B: Profit_B = (30 - (15 + 0.15 * B^2)) * B\n// Net profit of C: Profit_C = (40 - (20 + 0.2 * C^2)) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe plant has a daily production capacity of 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe plant has a limited budget for raw materials, which is $5000 per day. The cost of raw materials for product A is $5 per unit, for product B is $7 per unit, and for product C is $9 per unit.\n// 5 * A + 7 * B + 9 * C <= 5000\n\n## Generate Constraint-3:\nThe plant must produce at least 50 units of each product daily to meet contractual obligations.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units of each product to produce daily to maximize profit while considering production constraints. The profit per unit of product A is $20, product B is $30, and product C is $40. However, the production cost increases non-linearly with the number of units produced due to economies of scale. The production cost for product A is $10 + 0.1 * A^2, for product B is $15 + 0.15 * B^2, and for product C is $20 + 0.2 * C^2. The plant aims to maximize daily net profit. The plant has a daily production capacity of 1000 units across all products. The plant has a limited budget for raw materials, which is $5000 per day. The cost of raw materials for product A is $5 per unit, for product B is $7 per unit, and for product C is $9 per unit. The plant must produce at least 50 units of each product daily to meet contractual obligations. Please help the plant to determine the optimal number of units of each product to produce daily to maximize daily net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each product daily to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## Net profit of A: Profit_A = (20 - (10 + 0.1 * A^2)) * A\n## Net profit of B: Profit_B = (30 - (15 + 0.15 * B^2)) * B\n## Net profit of C: Profit_C = (40 - (20 + 0.2 * C^2)) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (20 - (10 + 0.1 * A**2)) * A\nProfit_B = (30 - (15 + 0.15 * B**2)) * B\nProfit_C = (40 - (20 + 0.2 * C**2)) * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## The plant has a limited budget for raw materials, which is $5000 per day.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Daily Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1078,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer has a total of 10 acres of land. The yield per acre for C1 is 500 kg, for C2 is 600 kg, and for C3 is 700 kg. The selling price per kg for C1 is $2, for C2 is $3, and for C3 is $4. The farmer wants to maximize his total revenue.\n// Revenue_C1 = 500 * A1 * 2\n// Revenue_C2 = 600 * A2 * 3\n// Revenue_C3 = 700 * A3 * 4\n// So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 10 acres of land.\n// A1 + A2 + A3 <= 10\n\n## Generate Constraint-2:\nDue to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\n// A1 + A2 <= 6\n\n## Generate Constraint-3:\nThe farmer must allocate at least 1 acre to C3.\n// A3 >= 1",
        "question": "A farmer grows three types of crops: C1, C2, and C3. He needs to determine the area of land to allocate to each crop. The yield per acre and the selling price per kg for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Selling Price per Kg |\n|------|----------------|----------------------|\n| C1   | 500 kg         | $2                   |\n| C2   | 600 kg         | $3                   |\n| C3   | 700 kg         | $4                   |\n\nThe farmer has a total of 10 acres of land. Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres. The farmer must also allocate at least 1 acre to C3. \n\nPlease help the farmer to maximize his total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=1) # area of land for C3\n\n# Define objective function\nRevenue_C1 = 500 * A1 * 2\nRevenue_C2 = 600 * A2 * 3\nRevenue_C3 = 700 * A3 * 4\n# So, the objective function is: Maximize (Revenue_C1 + Revenue_C2 + Revenue_C3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_C1 + Revenue_C2 + Revenue_C3)\n\n# Add constraints\n# The farmer has a total of 10 acres of land.\nmodel.addCons(A1 + A2 + A3 <= 10)\n# Due to soil conditions, the area of land for C1 and C2 combined must not exceed 6 acres.\nmodel.addCons(A1 + A2 <= 6)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for C1: \", model.getVal(A1))\n    print(\"Area of land for C2: \", model.getVal(A2))\n    print(\"Area of land for C3: \", model.getVal(A3))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 717,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A requires 2 hours of labor and generates a profit of $10. \nEach unit of product B requires 3 hours of labor and generates a profit of $15. \nEach unit of product C requires 4 hours of labor and generates a profit of $20.\nThe plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor.\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Total labor hours: Labor_Hours = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n\n## Generate Constraint-1:\nThe plant has a total labor capacity of 1000 hours per week.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities of each product to optimize its operations. The labor requirements and profit generated per unit for each product are given in the following Table.\n\n| Product | Labor Hours Required | Profit per Unit |\n|---------|----------------------|-----------------|\n| A       | 2 hours              | $10             |\n| B       | 3 hours              | $15             |\n| C       | 4 hours              | $20             |\n\nThe plant has a total labor capacity of 1000 hours per week. The plant aims to maximize the total profit while considering the efficiency of labor usage. The objective is to maximize the profit per hour of labor.\nPlease help the plant determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_Hours = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor_Hours\n## convert the division to multiplication\nmodel.addCons(obj * Labor_Hours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total labor capacity of 1000 hours per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000\n\n## Generate Constraint-2:\nDue to production constraints, the total number of machines produced cannot exceed 100 units.\n// MachineA_Units + MachineB_Units + MachineC_Units <= 100\n\n## Generate Constraint-3:\nMarket research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\n// MachineC_Units >= 0.5 * MachineA_Units\n\n## Generate Constraint-4:\nTo ensure a balanced production line, the company wants to ensure that at least one unit of each machine is produced.\n// MachineA_Units >= 1; MachineB_Units >= 1; MachineC_Units >= 1",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company has a limited budget for setup costs, which is $10,000. Due to production constraints, the total number of machines produced cannot exceed 100 units. Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced. To ensure a balanced production line, the company wants to ensure that at least one unit of each machine is produced. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=1)  # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=1)  # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=1)  # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n# So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n# Due to production constraints, the total number of machines produced cannot exceed 100 units.\nmodel.addCons(MachineA_Units + MachineB_Units + MachineC_Units <= 100)\n# Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\nmodel.addCons(MachineC_Units >= 0.5 * MachineA_Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 909,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nProduct A requires a minimum production of 50 units to meet contractual obligations.\n// A >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product B as product A.\n// B >= 2 * A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit per unit and the setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| A       | $50             | $1000      |\n| B       | $70             | $1500      |\n| C       | $90             | $2000      |\n\nThe company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Product A requires a minimum production of 50 units to meet contractual obligations. The company aims to produce at least twice as many units of product B as product A.\nPlease help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Total profit from product A: Profit_A = 50 * A - 1000\n## Total profit from product B: Profit_B = 70 * B - 1500\n## Total profit from product C: Profit_C = 90 * C - 2000\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * A - 1000 + 70 * B - 1500 + 90 * C - 2000)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## Product A requires a minimum production of 50 units to meet contractual obligations.\nmodel.addCons(A >= 50)\n## The company aims to produce at least twice as many units of product B as product A.\nmodel.addCons(B >= 2 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n\n## Generate Constraint-3:\nThe market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\n// A <= 200\n// B <= 150\n\n## Generate Constraint-4:\nThe company aims to balance its product portfolio. No more than 40% of the total production can be of one type of product.\n// A <= 0.4 * (A + B + C)\n// B <= 0.4 * (A + B + C)\n// C <= 0.4 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost for each product increases nonlinearly with the quantity produced, with the cost function for each product given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 2.5 hours                |\n\nThe company has a limited production capacity of 1000 hours. The company must produce at least 10 units of each product to meet contractual obligations. The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units. The company aims to balance its product portfolio, with no more than 40% of the total production being of one type of product.\n\nPlease help the company determine the optimal production quantities of products A, B, and C to maximize its total profit while adhering to these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=200)  # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=150)  # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10)  # production quantity of product C\n\n# Define objective function\n# Revenue = 50 * A + 70 * B + 60 * C\n# Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n# Objective function: Maximize Profit = Revenue - Cost\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nProfit = Revenue - (Cost_A + Cost_B + Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# The company must produce at least 10 units of each product.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\n\n# The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\n\n# The company aims to balance its product portfolio.\nmodel.addCons(A <= 0.4 * (A + B + C))\nmodel.addCons(B <= 0.4 * (A + B + C))\nmodel.addCons(C <= 0.4 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1431,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations.\n// {\"production rate of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours.\n// Cost of A: Cost_A = 2 * PA\n// Cost of B: Cost_B = 3 * PB\n// Cost of C: Cost_C = 4 * PC\n// Revenue of A: Revenue_A = 5 * PA\n// Revenue of B: Revenue_B = 7 * PB\n// Revenue of C: Revenue_C = 9 * PC\n// Total Profit: Profit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n// Total Production Time: Time = PA + 2 * PB + 3 * PC\n// So, the objective function is: Maximize Profit / Time\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 2 * PA + 3 * PB + 4 * PC <= 1000\n\n## Generate Constraint-2:\nThe plant can only allocate a maximum of 500 hours for production.\n// PA + 2 * PB + 3 * PC <= 500\n\n## Generate Constraint-3:\nThe plant must produce at least 100 units of each product.\n// PA >= 100; PB >= 100; PC >= 100\n\n## Generate Constraint-4:\nThe production rate of product B must be at least twice the production rate of product A.\n// PB >= 2 * PA",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations. The cost, revenue, and production time for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit | Production Time per Unit |\n|---------|---------------|------------------|--------------------------|\n| A       | $2            | $5               | 1 hour                   |\n| B       | $3            | $7               | 2 hours                  |\n| C       | $4            | $9               | 3 hours                  |\n\nThe plant has a budget of $1000 for production costs. The plant can only allocate a maximum of 500 hours for production. The plant must produce at least 100 units of each product. The production rate of product B must be at least twice the production rate of product A. \nPlease help the plant to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=100) # production rate of product A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=100) # production rate of product B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=100) # production rate of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 2 * PA\nCost_B = 3 * PB\nCost_C = 4 * PC\nRevenue_A = 5 * PA\nRevenue_B = 7 * PB\nRevenue_C = 9 * PC\nProfit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nProductionTime = PA + 2 * PB + 3 * PC\n## the objective function is: Maximize Profit / Time\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 1000)\n## The plant can only allocate a maximum of 500 hours for production.\nmodel.addCons(PA + 2 * PB + 3 * PC <= 500)\n## The plant must produce at least 100 units of each product.\nmodel.addCons(PA >= 100)\nmodel.addCons(PB >= 100)\nmodel.addCons(PC >= 100)\n## The production rate of product B must be at least twice the production rate of product A.\nmodel.addCons(PB >= 2 * PA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product A: \", model.getVal(PA))\n    print(\"Production Rate of Product B: \", model.getVal(PB))\n    print(\"Production Rate of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant aims to maximize the total profit while considering the production time constraints.\n// Profit from product A: Profit_A = 30 * A\n// Profit from product B: Profit_B = 40 * B\n// Profit from product C: Profit_C = 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a total of 100 hours available for production.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\n// A >= 5; B >= 10; C >= 15",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering the limited resources and market demand.\nEach unit of product A yields a profit of $30, product B yields $40, and product C yields $50. The production process is such that producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours. The plant has a total of 100 hours available for production. The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\nPlease help the plant to maximize the total profit while considering the production time constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for product A is at least 5 units, for product B is at least 10 units, and for product C is at least 15 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 30 * A\nProfit_B = 40 * B\nProfit_C = 50 * C\nProductionTime = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) - (2 * A^2 + 3 * B^2 + 4 * C^2) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C - (2 * A**2 + 3 * B**2 + 4 * C**2))\n\n# Add constraints\n## The plant has a total of 100 hours available for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 764,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach TruckA can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each TruckB can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each TruckC can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company aims to maximize the total cargo carried per liter of fuel consumed.\n// Total cargo carried by TruckA: Cargo_TruckA = 10 * TruckA\n// Total cargo carried by TruckB: Cargo_TruckB = 15 * TruckB\n// Total cargo carried by TruckC: Cargo_TruckC = 20 * TruckC\n// Total fuel consumed: Fuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n// So, the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n\n## Generate Constraint-1:\nThe company has a total of 50 vehicles available.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\n// TruckA <= 2 * TruckB\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for fuel costs per day.\n// 5 * TruckA + 7 * TruckB + 9 * TruckC <= 10,000",
        "question": "A logistics company operates three types of vehicles: TruckA, TruckB, and TruckC. The company needs to determine the optimal number of each type of vehicle to maximize efficiency while meeting certain operational constraints. The capacity and fuel consumption for each type of vehicle are given in the following Table.\n\n| Vehicle | Cargo Capacity | Fuel Consumption |\n|---------|----------------|------------------|\n| TruckA  | 10 tons        | 5 liters         |\n| TruckB  | 15 tons        | 7 liters         |\n| TruckC  | 20 tons        | 9 liters         |\n\nThe company has a total of 50 vehicles available. Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB. The company has a budget of $10,000 for fuel costs per day.\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_TruckA = 10 * TruckA\nCargo_TruckB = 15 * TruckB\nCargo_TruckC = 20 * TruckC\nFuel_Consumed = 5 * TruckA + 7 * TruckB + 9 * TruckC\n## the objective function is: Maximize (Cargo_TruckA + Cargo_TruckB + Cargo_TruckC) / Fuel_Consumed\n## convert the division to multiplication\nmodel.addCons(obj * Fuel_Consumed == Cargo_TruckA + Cargo_TruckB + Cargo_TruckC)\n\n# Add constraints\n## The company has a total of 50 vehicles available.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## Due to maintenance constraints, the number of TruckA cannot exceed twice the number of TruckB.\nmodel.addCons(TruckA <= 2 * TruckB)\n## The company has a budget of $10,000 for fuel costs per day.\nmodel.addCons(5 * TruckA + 7 * TruckB + 9 * TruckC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit. However, due to the different growth rates and harvesting times, the efficiency of land use varies. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\n// Profit_W = 100 * W\n// Profit_C = 150 * C\n// Profit_B = 120 * B\n// Land_Efficiency_W = 0.9 * W\n// Land_Efficiency_C = 1.2 * C\n// Land_Efficiency_B = 1.1 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $60.\n// 50 * W + 70 * C + 60 * B <= 10000",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop. The profit per acre and the cost per acre for each crop are given in the following Table.\n\n| Crop   | Profit per Acre | Cost per Acre | Land Efficiency |\n|--------|-----------------|---------------|-----------------|\n| Wheat  | $100            | $50           | 0.9             |\n| Corn   | $150            | $70           | 1.2             |\n| Barley | $120            | $60           | 1.1             |\n\nThe farmer has a total of 100 acres of land available. He also has a limited budget for seeds and fertilizer of $10,000. The farmer wants to maximize his total profit per unit of land efficiency. Please help the farmer determine the optimal number of acres to dedicate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 100 * W\nProfit_C = 150 * C\nProfit_B = 120 * B\nLand_Efficiency_W = 0.9 * W\nLand_Efficiency_C = 1.2 * C\nLand_Efficiency_B = 1.1 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B) == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizer of $10,000.\nmodel.addCons(50 * W + 70 * C + 60 * B <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Land Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 825,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each factory to optimize production efficiency.\n// {\"amount of raw material for factory 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for factory 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for factory 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different efficiency rate in converting raw material into the chemical product. Factory 1 has an efficiency of 0.5 kg product per kg of raw material, Factory 2 has an efficiency of 0.7 kg product per kg of raw material, and Factory 3 has an efficiency of 0.6 kg product per kg of raw material. The company wants to maximize the total amount of product produced.\n// The total product produced by Factory 1: P1 = 0.5 * R1\n// The total product produced by Factory 2: P2 = 0.7 * R2\n// The total product produced by Factory 3: P3 = 0.6 * R3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of raw material available is 1000 kg.\n// R1 + R2 + R3 <= 1000\n\n## Generate Constraint-2:\nFactory 1 can handle up to 400 kg of raw material.\n// R1 <= 400\n\n## Generate Constraint-3:\nFactory 2 can handle up to 500 kg of raw material.\n// R2 <= 500",
        "question": "A company operates three different factories that produce a specialized chemical. The company needs to determine the amount of raw material to allocate to each factory to optimize production efficiency. Each factory has a different efficiency rate in converting raw material into the chemical product: Factory 1 has an efficiency of 0.5 kg product per kg of raw material, Factory 2 has an efficiency of 0.7 kg product per kg of raw material, and Factory 3 has an efficiency of 0.6 kg product per kg of raw material. The company wants to maximize the total amount of product produced. The total amount of raw material available is 1000 kg. Factory 1 can handle up to 400 kg of raw material, and Factory 2 can handle up to 500 kg of raw material. Please help the company determine the optimal allocation of raw material to each factory.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material for factory 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for factory 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for factory 3\n\n# Define objective function\nP1 = 0.5 * R1\nP2 = 0.7 * R2\nP3 = 0.6 * R3\n# So, the objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total amount of raw material available is 1000 kg.\nmodel.addCons(R1 + R2 + R3 <= 1000)\n# Factory 1 can handle up to 400 kg of raw material.\nmodel.addCons(R1 <= 400)\n# Factory 2 can handle up to 500 kg of raw material.\nmodel.addCons(R2 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Factory 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Factory 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Factory 3: \", model.getVal(R3))\n    print(\"Maximized Total Product: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"integer\"}\n// {\"investment in advanced machinery\": \"MachineryInvestment\", \"range\": \"MachineryInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 1000 units that can be produced in the quarter.\n// Units <= 1000\n\n## Generate Constraint-2:\nThe total investment in advanced machinery cannot exceed $50,000.\n// MachineryInvestment <= 50000\n\n## Generate Constraint-3:\nThe amount of overtime hours must not exceed 500 hours.\n// Overtime <= 500",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to improve production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n\nThe company has a maximum capacity of 1000 units that can be produced in the quarter. The total investment in advanced machinery cannot exceed $50,000. The amount of overtime hours must not exceed 500 hours.\n\nPlease help the company determine the optimal number of units to produce, the amount of overtime hours to utilize, and the level of investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0) # number of units to produce\nOvertime = model.addVar(vtype=\"INTEGER\", name=\"Overtime\", lb=0) # amount of overtime hours\nMachineryInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineryInvestment\", lb=0) # investment in advanced machinery\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\nProfit = (150 - 100 + 0.0005 * MachineryInvestment) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 1000 units that can be produced in the quarter.\nmodel.addCons(Units <= 1000)\n## The total investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(MachineryInvestment <= 50000)\n## The amount of overtime hours must not exceed 500 hours.\nmodel.addCons(Overtime <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Amount of Overtime: \", model.getVal(Overtime))\n    print(\"Investment in Machinery: \", model.getVal(MachineryInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\n// {\"quantity of Chocolate cake\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Vanilla cake\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"quantity of Strawberry cake\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production capacity and wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_C = 30 * C - 10 * C\n// Profit_V = 25 * V - 8 * V\n// Profit_S = 20 * S - 5 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / (1.5 * C + 1 * V + 0.5 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited production time of 80 hours.\n// 1.5 * C + 1 * V + 0.5 * S <= 80",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce. The revenue per unit, production time per unit, and ingredient cost per unit for each cake are given in the following Table.\n\n| Cake Type       | Revenue per Unit | Production Time per Unit | Ingredient Cost per Unit |\n|-----------------|------------------|--------------------------|---------------------------|\n| Chocolate       | $30              | 1.5 hours                | $10                      |\n| Vanilla         | $25              | 1 hour                   | $8                       |\n| Strawberry      | $20              | 0.5 hours                | $5                       |\n\nThe bakery has a limited production time of 80 hours. The bakery wants to maximize the profit efficiency (profit per hour of production time). Please help the bakery determine the optimal quantities of each cake to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chocolate cake\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # quantity of Vanilla cake\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of Strawberry cake\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (30 - 10) * C\nProfit_V = (25 - 8) * V\nProfit_S = (20 - 5) * S\nProductionTime = 1.5 * C + 1 * V + 0.5 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a limited production time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 0.5 * S <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chocolate cake: \", model.getVal(C))\n    print(\"Quantity of Vanilla cake: \", model.getVal(V))\n    print(\"Quantity of Strawberry cake: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\n// 500 * Insulation >= 0.20 * 50000\n\n## Generate Constraint-4:\nNo more than 50% of the budget should be allocated to solar panels.\n// 1000 * Solar <= 0.50 * 50000\n\n## Generate Constraint-5:\nThe number of wind turbines should not exceed twice the number of solar panels.\n// Wind <= 2 * Solar",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installation and the annual energy savings for each type of upgrade are given in the following Table.\n\n| Upgrade Type | Installation Cost | Annual Energy Savings |\n|--------------|-------------------|-----------------------|\n| Solar Panels | $1000 per panel   | $200 per year         |\n| Wind Turbines| $2000 per turbine | $300 per year         |\n| Insulation   | $500 per upgrade  | $100 per year         |\n\nThe company has a budget of $50,000 for the installation. The company aims to achieve at least $10,000 in annual energy savings. The company wants to ensure that at least 20% of the budget is spent on insulation upgrades. No more than 50% of the budget should be allocated to solar panels. The number of wind turbines should not exceed twice the number of solar panels.\n\nPlease help the company to minimize the total cost of installation while maximizing the annual energy savings.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0) # amount of insulation upgrades\n\n# Define objective function\n## total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n## total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n## So, the objective function is: Minimize Cost / Savings\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n## The company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\nmodel.addCons(500 * Insulation >= 0.20 * 50000)\n## No more than 50% of the budget should be allocated to solar panels.\nmodel.addCons(1000 * Solar <= 0.50 * 50000)\n## The number of wind turbines should not exceed twice the number of solar panels.\nmodel.addCons(Wind <= 2 * Solar)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1032,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\nThe total labor hours available per day are 200 hours.\nPlease help the company determine the optimal number of units of products A, B, and C to produce to maximize their profit, given the constraint on labor hours.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 789,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost.\n// The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production.\n// 20A + 0.1A^2 + 30B + 0.15B^2 + 25C + 0.12C^2 <= 10000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units.\n// A <= 200; B <= 150; C <= 180",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The company has a limited budget of $10,000 for production. The market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units. Please help the company to maximize the total profit, which is the revenue minus the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=180) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\nmodel.addCons(obj == 50*A - 20*A - 0.1*A**2 + 70*B - 30*B - 0.15*B**2 + 60*C - 25*C - 0.12*C**2)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production.\nmodel.addCons(20*A + 0.1*A**2 + 30*B + 0.15*B**2 + 25*C + 0.12*C**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. Please help the manufacturer determine the optimal production levels for components A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\n// The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// B >= 150\n\n## Generate Constraint-4:\nThe market demand for product C is at least 200 units per week.\n// C >= 200\n\n## Generate Constraint-5:\nThe company has a budget constraint that limits the total cost to $5000 per week.\n// 0.01A^2 + 0.02B^2 + 0.015C^2 <= 5000",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the limited resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost is nonlinear and depends on the number of units produced. The cost function is given by: Cost_A = 0.01 * A^2, Cost_B = 0.02 * B^2, and Cost_C = 0.015 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost: Profit = (50A + 70B + 60C) - (0.01A^2 + 0.02B^2 + 0.015C^2).\nThe company has a total production capacity of 1000 units per week. The market demand for product A is at least 100 units per week. The market demand for product B is at least 150 units per week. The market demand for product C is at least 200 units per week. The company has a budget constraint that limits the total cost to $5000 per week.\nPlease help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=200) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 60C - 0.01A^2 - 0.02B^2 - 0.015C^2\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\nProfit = 50*A + 70*B + 60*C - 0.01*A_sq - 0.02*B_sq - 0.015*C_sq\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\nmodel.addCons(0.01*A_sq + 0.02*B_sq + 0.015*C_sq <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1022,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $20 per unit.\nThe profit per unit of product B is $30, with a simpler production process costing $10 per unit.\nThe profit per unit of product C is $40, with an intermediate production process costing $15 per unit.\nThe company wants to maximize the total net profit, which is the difference between the total profit and the total production cost.\n// Total profit: Profit = 50 * A + 30 * B + 40 * C\n// Total production cost: Cost = 20 * A + 10 * B + 15 * C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours.\n// 2 * A + 1 * B + 1.5 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 100 units per week.\n// A >= 100",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit and the production cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20                      |\n| B       | $30             | $10                      |\n| C       | $40             | $15                      |\n\nThe company has a limited production capacity of 1000 hours per week. Producing one unit of A requires 2 hours, one unit of B requires 1 hour, and one unit of C requires 1.5 hours. The market demand for product A is at least 100 units per week.\n\nPlease help the company to maximize the total net profit, which is the difference between the total profit and the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 30 * B + 40 * C\nCost = 20 * A + 10 * B + 15 * C\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours per week.\nmodel.addCons(2 * A + 1 * B + 1.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 941,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time. The company has a budget of $1000 for material costs.\nPlease help the company determine the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company aims to maximize its total profit while considering the efficiency of raw material usage. The efficiency is defined as the ratio of total profit to the total raw material used.\n// Total profit: Profit = 50 * A + 70 * B + 100 * C\n// Total raw material usage: RawMaterial = 2 * A + 3 * B + 5 * C\n// So, the objective function is: Maximize Profit / RawMaterial\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\n// 2 * A + 3 * B + 5 * C <= 10000 / 10",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profits and resource usage. The profit and raw material requirements for each product are given in the following Table.\n\n| Product | Profit per Unit | Raw Material Required per Unit |\n|---------|-----------------|--------------------------------|\n| A       | $50             | 2 units                        |\n| B       | $70             | 3 units                        |\n| C       | $100            | 5 units                        |\n\nThe company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit. The company aims to maximize its total profit while considering the efficiency of raw material usage. The efficiency is defined as the ratio of total profit to the total raw material used.\n\nPlease help the company determine the optimal number of units to produce for each product to maximize the efficiency of raw material usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 100 * C\nRawMaterial = 2 * A + 3 * B + 5 * C\n## the objective function is: Maximize Profit / RawMaterial\n## convert the division to multiplication\nmodel.addCons(obj * RawMaterial == Profit)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials, and the cost of raw material is $10 per unit.\nmodel.addCons(2 * A + 3 * B + 5 * C <= 10000 / 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1018,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro.\n// {\"amount of energy from solar\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from wind\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of energy from hydro\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of generating energy from solar is $50 per unit, with a reliability of 90%.\nThe cost of generating energy from wind is $70 per unit, with a reliability of 85%.\nThe cost of generating energy from hydro is $60 per unit, with a reliability of 95%.\nThe company wants to minimize the Cost-Reliability ratio of the energy generation. (The Cost-Reliability ratio is defined as the total cost of energy generation divided by the total reliability of the energy sources.)\n// total cost of energy generation: Cost = 50 * Solar + 70 * Wind + 60 * Hydro\n// total reliability of energy sources: Reliability = 90% * Solar + 85% * Wind + 95% * Hydro\n// So, the objective function is: Minimize Cost / Reliability\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for energy investment.\n// 50 * Solar + 70 * Wind + 60 * Hydro <= 150000\n\n## Generate Constraint-2:\nThe company needs to generate at least 2000 units of energy in total.\n// Solar + Wind + Hydro >= 2000",
        "question": "A company is planning to optimize its energy consumption by investing in three different renewable energy sources: Solar, Wind, and Hydro. The cost and reliability of generating energy from each source are given in the following Table.\n\n| Energy Source | Cost per Unit | Reliability |\n|---------------|---------------|-------------|\n| Solar         | $50           | 90%         |\n| Wind          | $70           | 85%         |\n| Hydro         | $60           | 95%         |\n\nThe company has a budget of $150,000 for energy investment. The company needs to generate at least 2000 units of energy in total. Please help the company to minimize the Cost-Reliability ratio of the energy generation (defined as the total cost of energy generation divided by the total reliability of the energy sources).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of energy from solar\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of energy from wind\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # amount of energy from hydro\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 50 * Solar + 70 * Wind + 60 * Hydro\nReliability = 0.9 * Solar + 0.85 * Wind + 0.95 * Hydro\n## the objective function is: Minimize Cost / Reliability\n## convert the division to multiplication\nmodel.addCons(obj * Reliability == Cost)\n\n# Add constraints\n## The company has a budget of $150,000 for energy investment.\nmodel.addCons(50 * Solar + 70 * Wind + 60 * Hydro <= 150000)\n## The company needs to generate at least 2000 units of energy in total.\nmodel.addCons(Solar + Wind + Hydro >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Energy from Solar: \", model.getVal(Solar))\n    print(\"Amount of Energy from Wind: \", model.getVal(Wind))\n    print(\"Amount of Energy from Hydro: \", model.getVal(Hydro))\n    print(\"Minimized Cost-Reliability Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 800,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints.\n// {\"amount of chemical produced at facility 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from producing the chemical at each facility depends on the amount produced and the cost of production. The profit function is nonlinear and is given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\nThe company wants to maximize the total profit from all facilities.\n// The objective function is: Maximize F = F1 + F2 + F3\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all facilities must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nThe demand for the chemical at facility 1 is at least 200 units.\n// P1 >= 200\n\n## Generate Constraint-3:\nThe demand for the chemical at facility 2 is at least 150 units.\n// P2 >= 150\n\n## Generate Constraint-4:\nThe demand for the chemical at facility 3 is at least 250 units.\n// P3 >= 250",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints. The profit from producing the chemical at each facility depends on the amount produced and the cost of production, with the profit function being nonlinear and given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\n\nThe company wants to maximize the total profit from all facilities. The constraints are as follows:\n- The total amount of chemical produced across all facilities must not exceed 1000 units.\n- The demand for the chemical at facility 1 is at least 200 units.\n- The demand for the chemical at facility 2 is at least 150 units.\n- The demand for the chemical at facility 3 is at least 250 units.\n\nPlease help the company determine the optimal production amounts for each facility to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=200) # amount of chemical produced at facility 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=150) # amount of chemical produced at facility 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=250) # amount of chemical produced at facility 3\n\n# Define objective function\n## The profit function is nonlinear and is given by:\nF1 = 100 * P1 - 0.5 * P1**2\nF2 = 120 * P2 - 0.6 * P2**2\nF3 = 110 * P3 - 0.4 * P3**2\n## The objective function is: Maximize F = F1 + F2 + F3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == F1 + F2 + F3)\n\n# Add constraints\n## The total amount of chemical produced across all facilities must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced at facility 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced at facility 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced at facility 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1080,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity.\n// {\"quantity of C1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant aims to maximize total profit.\n// Profit_C1 = 100 * Q1 - (50 + 0.1 * Q1^2)\n// Profit_C2 = 150 * Q2 - (75 + 0.15 * Q2^2)\n// Profit_C3 = 200 * Q3 - (100 + 0.2 * Q3^2)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\n// Q1 + Q2 + Q3 <= 1000\n\n## Generate Constraint-2:\nThe storage capacity of the plant is limited to 800 units.\n// Q1 + Q2 + Q3 <= 800\n\n## Generate Constraint-3:\nThe market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1.\n// Q1 <= 50\n\n## Generate Constraint-4:\nThe plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\n// Q2 >= 2 * Q1",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production quantities of each chemical to maximize its profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $100, C2 is $150, and C3 is $200. The production process is nonlinear due to economies of scale; the cost per unit decreases as the quantity produced increases. Specifically, the cost function for each chemical is quadratic: Cost_C1 = 50 + 0.1 * Q1^2, Cost_C2 = 75 + 0.15 * Q2^2, and Cost_C3 = 100 + 0.2 * Q3^2. The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals. The storage capacity of the plant is limited to 800 units. The market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1. The plant has a safety regulation that requires the production of C2 to be at least twice the production of C1. Please help the plant to maximize total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of C1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of C2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of C3\n\n# Define objective function\n## The cost function for each chemical is quadratic\nCost_C1 = 50 + 0.1 * Q1**2\nCost_C2 = 75 + 0.15 * Q2**2\nCost_C3 = 100 + 0.2 * Q3**2\n## Calculate profit for each chemical\nProfit_C1 = 100 * Q1 - Cost_C1\nProfit_C2 = 150 * Q2 - Cost_C2\nProfit_C3 = 200 * Q3 - Cost_C3\n## Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited amount of raw material that can produce a maximum of 1000 units of any combination of the three chemicals.\nmodel.addCons(Q1 + Q2 + Q3 <= 1000)\n## The storage capacity of the plant is limited to 800 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 800)\n## The market demand for C1 is 50 units. Therefore, the plant can only sell a maximum of 50 units of C1.\nmodel.addCons(Q1 <= 50)\n## The plant has a safety regulation that requires the production of C2 to be at least twice the production of C1.\nmodel.addCons(Q2 >= 2 * Q1)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(Q1))\n    print(\"Quantity of C2: \", model.getVal(Q2))\n    print(\"Quantity of C3: \", model.getVal(Q3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1053,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted. The risk function is R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost.\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from soybeans: Profit_S = 150 * S\n// Risk cost: Risk = 0.01 * (W^2 + C^2 + S^2)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk) = Maximize (200W + 300C + 150S - 0.01(W^2 + C^2 + S^2))\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity.\n// W >= 20; C >= 20; S >= 20",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted, with the risk function R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost.\n\n| Crop     | Profit per Acre |\n|----------|-----------------|\n| Wheat    | $200            |\n| Corn     | $300            |\n| Soybeans | $150            |\n\nThe farmer has a total of 100 acres available for planting. The farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity. Please help the farmer to maximize the net profit, considering the risk cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop to maintain soil diversity.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=20) # number of acres for wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of acres for corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=20) # number of acres for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_S = 150 * S\nRisk = 0.01 * (W**2 + C**2 + S**2)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S - Risk)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(W))\n    print(\"Number of Acres for Corn: \", model.getVal(C))\n    print(\"Number of Acres for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer aims to maximize the profit per unit of energy consumed.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe manufacturer has a total energy limit of 1000 kWh for production.\n// 2 * A + 3 * B + 4 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer has a budget of $10,000 for production costs. The manufacturer wants to produce at least 50 units of each device. The manufacturer has a total energy limit of 1000 kWh for production.\nPlease help the manufacturer to maximize the profit per unit of energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nEnergyConsumption = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / EnergyConsumption\n## convert the division to multiplication\nmodel.addCons(obj * EnergyConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The manufacturer has a total energy limit of 1000 kWh for production.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 814,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs.\n// {\"number of production lines\": \"Lines\", \"range\": \"Lines >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per line\": \"Shifts\", \"range\": \"Shifts >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per shift decreases by $5 for every $10,000 invested in automation. The initial labor cost per shift is $150. The revenue generated per shift is $300. The company aims to maximize the total profit from all production lines.\n// Total profit for the production: Profit = (300 - 150 + 0.0005 * Automation) * Lines * Shifts\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 30 production lines available for the quarter. The company must ensure that at least 10 production lines are operated.\n// Lines <= 30; Lines >= 10\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe number of shifts per production line must be at least 5.\n// Shifts >= 5",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs. The labor cost per shift decreases by $5 for every $10,000 invested in automation. The initial labor cost per shift is $150, and the revenue generated per shift is $300. The company aims to maximize the total profit from all production lines.\nThe company has a total of 30 production lines available for the quarter and must ensure that at least 10 production lines are operated. The total investment in automation cannot exceed $50,000. The number of shifts per production line must be at least 5.\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs.\nLines = model.addVar(vtype=\"INTEGER\", name=\"Lines\", lb=10, ub=30) # number of production lines\nShifts = model.addVar(vtype=\"INTEGER\", name=\"Shifts\", lb=5) # number of shifts per line\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## The labor cost per shift decreases by $5 for every $10,000 invested in automation. The initial labor cost per shift is $150. The revenue generated per shift is $300.\nLaborCostPerShift = 150 - 0.0005 * Automation\n## The company aims to maximize the total profit from all production lines.\nProfit = (300 - LaborCostPerShift) * Lines * Shifts\n## So, the objective function is: Maximize Profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines: \", model.getVal(Lines))\n    print(\"Number of Shifts per Line: \", model.getVal(Shifts))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 792,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A line\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B line\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C line\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost.\n// Revenue from product A: RA = 10 * WA * PriceA\n// Revenue from product B: RB = 15 * WB * PriceB\n// Revenue from product C: RC = 20 * WC * PriceC\n// Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n// So, the objective function is: Maximize (RA + RB + RC - PC)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// WA + WB + WC <= 50",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rate of product A is 10 units per worker per hour, product B is 15 units per worker per hour, and product C is 20 units per worker per hour. The cost of producing each unit of product A is $5, product B is $8, and product C is $10. The manufacturer aims to maximize the profit, which is the revenue from selling the products minus the production cost. The manufacturer has a total of 50 workers available. Please help the manufacturer determine the optimal number of workers to assign to each production line to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on product A line\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on product B line\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on product C line\n\n# Define objective function\n## Revenue from product A: RA = 10 * WA * PriceA\n## Revenue from product B: RB = 15 * WB * PriceB\n## Revenue from product C: RC = 20 * WC * PriceC\n## Production cost: PC = 5 * 10 * WA + 8 * 15 * WB + 10 * 20 * WC\n## So, the objective function is: Maximize (RA + RB + RC - PC)\nRA = 10 * WA\nRB = 15 * WB\nRC = 20 * WC\nPC = 5 * RA + 8 * RB + 10 * RC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == RA + RB + RC - PC)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(WA + WB + WC <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A Line: \", model.getVal(WA))\n    print(\"Number of Workers on Product B Line: \", model.getVal(WB))\n    print(\"Number of Workers on Product C Line: \", model.getVal(WC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 708,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nFor P1, the revenue per unit is $100, and the production cost per unit is $50 - 0.01 * Automation. \nFor P2, the revenue per unit is $120, and the production cost per unit is $60 - 0.015 * Automation.\nThe company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (100 - (50 - 0.01 * Automation)) * P1 + (120 - (60 - 0.015 * Automation)) * P2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// P1 + P2 <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. For P1, the revenue per unit is $100, and the production cost per unit is $50 - 0.01 * Automation. For P2, the revenue per unit is $120, and the production cost per unit is $60 - 0.015 * Automation. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for both products combined. The investment in automation cannot exceed $50,000. Please help the company to determine the optimal production quantities of P1 and P2, and the level of automation to maximize their total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nAutomation = model.addVar(name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for the products: Profit = (100 - (50 - 0.01 * Automation)) * P1 + (120 - (60 - 0.015 * Automation)) * P2\nProfit = (100 - (50 - 0.01 * Automation)) * P1 + (120 - (60 - 0.015 * Automation)) * P2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for both products combined.\nmodel.addCons(P1 + P2 <= 1000)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit.\n// {\"units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n// The net profit for component A: P_A = 50A - 20A = 30A\n// The net profit for component B: P_B = 70B - 30B = 40B\n// The net profit for component C: P_C = 60C - 25C = 35C\n// The objective function is: Maximize (P_A + P_B + P_C) = Maximize (30A + 40B + 35C)\n\n## Generate Constraint-1:\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production of component A must be at least twice the production of component B.\n// A >= 2B\n\n## Generate Constraint-3:\nThe production of component C cannot exceed the combined production of components A and B.\n// C <= A + B",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company must decide how many units of each component to produce daily to optimize its profit. The profit from selling each unit of component A is $50, component B is $70, and component C is $60. However, the production cost for each unit of component A is $20, component B is $30, and component C is $25. The company aims to maximize its net profit.\n\n| Component | Selling Price | Production Cost | Net Profit per Unit |\n|-----------|---------------|-----------------|---------------------|\n| A         | $50           | $20             | $30                 |\n| B         | $70           | $30             | $40                 |\n| C         | $60           | $25             | $35                 |\n\nThe company has a limited production capacity. It can produce a maximum of 100 units in total per day. Due to market demand, the production of component A must be at least twice the production of component B. The production of component C cannot exceed the combined production of components A and B.\n\nPlease help the company to maximize its net profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # units of component C\n\n# Define objective function\nP_A = 30 * A\nP_B = 40 * B\nP_C = 35 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_A + P_B + P_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(A >= 2 * B)\nmodel.addCons(C <= A + B)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Component A: \", model.getVal(A))\n    print(\"Units of Component B: \", model.getVal(B))\n    print(\"Units of Component C: \", model.getVal(C))\n    print(\"Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1215,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in advanced machinery\": \"Machinery\", \"range\": \"Machinery >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in advanced machinery. The initial production cost per unit for each product is $100. The selling price per unit for each product is $150. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production rate for all products cannot exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in advanced machinery cannot exceed $50,000.\n// Machinery <= 50000\n\n## Generate Constraint-3:\nThe production rate for Product 1 must be at least 10 units per hour.\n// P1 >= 10\n\n## Generate Constraint-4:\nThe production rate for Product 2 must be at least 20 units per hour.\n// P2 >= 20\n\n## Generate Constraint-5:\nThe production rate for Product 3 must be at least 15 units per hour.\n// P3 >= 15",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the investment in advanced machinery to optimize production efficiency. The initial production cost per unit for each product is $100, and the selling price per unit for each product is $150. The production cost per unit decreases by $5 for every $10,000 invested in advanced machinery.\n\n| Product | Initial Production Cost | Selling Price |\n|---------|-------------------------|---------------|\n| 1       | $100                    | $150          |\n| 2       | $100                    | $150          |\n| 3       | $100                    | $150          |\n\nThe company aims to maximize the total profit from all products. The total production rate for all products cannot exceed 100 units per hour. The investment in advanced machinery cannot exceed $50,000. The production rate for Product 1 must be at least 10 units per hour, for Product 2 at least 20 units per hour, and for Product 3 at least 15 units per hour.\n\nPlease help the company to determine the optimal production rates for each product and the investment in advanced machinery to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=20) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=15) # production rate for Product 3\nMachinery = model.addVar(vtype=\"CONTINUOUS\", name=\"Machinery\", lb=0, ub=50000) # investment in advanced machinery\n\n# Define objective function\n## Total profit for the products: Profit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\nProfit = (150 - (100 - 0.0005 * Machinery)) * (P1 + P2 + P3)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total production rate for all products cannot exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in advanced machinery cannot exceed $50,000.\nmodel.addCons(Machinery <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate for Product 1: \", model.getVal(P1))\n    print(\"Production rate for Product 2: \", model.getVal(P2))\n    print(\"Production rate for Product 3: \", model.getVal(P3))\n    print(\"Investment in advanced machinery: \", model.getVal(Machinery))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n// The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2A + 3B + 4C <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 400 units of any product to be produced.\n// A <= 400; B <= 400; C <= 400\n\n## Generate Constraint-3:\nThe company aims to produce at least 100 units of product A and 150 units of product B.\n// A >= 100; B >= 150\n\n## Generate Constraint-4:\nThe total production of products B and C should not exceed twice the production of product A.\n// B + C <= 2A",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2).\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $90             | 4 hours                  |\n\nThe company has a total of 1000 hours of labor available for production. The raw material constraint allows for a maximum of 400 units of any product to be produced. The company aims to produce at least 100 units of product A and 150 units of product B. The total production of products B and C should not exceed twice the production of product A.\n\nPlease help the company to maximize the profit function: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100, ub=400) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150, ub=400) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=400) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n## Since pyscipopt does not support quadratic objective, we need to linearize the quadratic terms\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\nProfit = 50*A + 70*B + 90*C - 0.01*(A_sq + B_sq + C_sq)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for production.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n## The total production of products B and C should not exceed twice the production of product A.\nmodel.addCons(B + C <= 2*A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1222,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit.\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials. The profit function is given by: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The company aims to maximize this profit.\n// Formal definition of the objective function: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\n\n## Generate Constraint-1:\nThe total labor hours available are 1000 hours.\n// L <= 1000",
        "question": "A manufacturing company produces three types of products using a complex assembly line. The company needs to optimize the allocation of resources (labor hours, machine hours, and raw materials) to maximize profit. The profit from the products is dependent on the allocation of labor hours, machine hours, and raw materials, and is given by the function: Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2. The total labor hours available are 1000 hours. Please help the company to maximize this profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100L - 0.5L^2 + 150M - 0.3M^2 + 200R - 0.4R^2\nmodel.addCons(obj == 100*L - 0.5*L*L + 150*M - 0.3*M*M + 200*R - 0.4*R*R)\n\n# Add constraints\n## The total labor hours available are 1000 hours.\nmodel.addCons(L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 506,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit.\n// {\"amount of resource 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of resource 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of resources used. The profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of resource 1 available is 100 units.\n// R1 <= 100\n\n## Generate Constraint-2:\nThe total amount of resource 2 available is 120 units.\n// R2 <= 120\n\n## Generate Constraint-3:\nThe total amount of resource 3 available is 150 units.\n// R3 <= 150",
        "question": "A manufacturing plant produces three types of products using different resources. The plant manager needs to allocate the amount of each resource to maximize profit. The profit from each product depends on the amount of resources used, and the profit function for each product is nonlinear and given by:\n- Product 1: P1 = 50 * R1^0.5 - 10 * R1\n- Product 2: P2 = 70 * R2^0.6 - 20 * R2\n- Product 3: P3 = 60 * R3^0.7 - 15 * R3\nThe plant manager wants to maximize the total profit from all three products.\n\nThe total amount of each resource available is as follows:\n- Resource 1: 100 units\n- Resource 2: 120 units\n- Resource 3: 150 units\n\nPlease help the plant manager determine the optimal allocation of resources to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of resource 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of resource 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of resource 3\n\n# Define objective function\n## The profit function for each product is nonlinear and given by:\nP1 = 50 * R1**0.5 - 10 * R1\nP2 = 70 * R2**0.6 - 20 * R2\nP3 = 60 * R3**0.7 - 15 * R3\n## The objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The total amount of resource 1 available is 100 units.\nmodel.addCons(R1 <= 100)\n## The total amount of resource 2 available is 120 units.\nmodel.addCons(R2 <= 120)\n## The total amount of resource 3 available is 150 units.\nmodel.addCons(R3 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Resource 1: \", model.getVal(R1))\n    print(\"Amount of Resource 2: \", model.getVal(R2))\n    print(\"Amount of Resource 3: \", model.getVal(R3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 740,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop.\n// {\"acres of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of each crop (in tons per acre) is affected by the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n// Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n// Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n// Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n// So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for irrigation improvements.\n// Irrigation <= 50000\n\n## Generate Constraint-3:\nThe farm wants to ensure at least 20 acres are dedicated to each crop.\n// Wheat >= 20; Corn >= 20; Soybeans >= 20\n\n## Generate Constraint-4:\nThe total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\n// Irrigation >= 10000\n\n## Generate Constraint-5:\nThe farm has a labor constraint that limits the total acres of wheat and corn to 80.\n// Wheat + Corn <= 80",
        "question": "A farm is planning its crop production for the next season and needs to decide how many acres to allocate to three different crops: wheat, corn, and soybeans. Additionally, the farm needs to determine the amount of money to invest in irrigation improvements, which will affect the water usage and yield of each crop. The yield of each crop (in tons per acre) increases with the investment in irrigation. For every $1000 invested, the yield increases by 0.1 tons per acre for wheat, 0.2 tons per acre for corn, and 0.15 tons per acre for soybeans. The selling price for wheat is $200 per ton, for corn is $300 per ton, and for soybeans is $400 per ton. The farm aims to maximize its total revenue from the crops.\n\n| Crop       | Selling Price per Ton | Yield Increase per $1000 Investment |\n|------------|-----------------------|-------------------------------------|\n| Wheat      | $200                  | 0.1 tons per acre                   |\n| Corn       | $300                  | 0.2 tons per acre                   |\n| Soybeans   | $400                  | 0.15 tons per acre                  |\n\nThe farm has the following constraints:\n- The total acres available for planting are 100.\n- The farm has a budget of $50,000 for irrigation improvements.\n- The farm wants to ensure at least 20 acres are dedicated to each crop.\n- The total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\n- The farm has a labor constraint that limits the total acres of wheat and corn to 80.\n\nPlease help the farm to maximize its total revenue from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to ensure at least 20 acres are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=20)  # acres of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=20)  # acres of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=20)  # acres of soybeans\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=10000, ub=50000)  # investment in irrigation\n\n# Define objective function\n## Revenue from wheat: Revenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\n## Revenue from corn: Revenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\n## Revenue from soybeans: Revenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\n## So, the objective function is: Maximize (Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\nRevenue_Wheat = 200 * (0.1 * Irrigation + 1) * Wheat\nRevenue_Corn = 300 * (0.2 * Irrigation + 1) * Corn\nRevenue_Soybeans = 400 * (0.15 * Irrigation + 1) * Soybeans\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Wheat + Revenue_Corn + Revenue_Soybeans)\n\n# Add constraints\n## The total acres available for planting are 100.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farm has a budget of $50,000 for irrigation improvements.\nmodel.addCons(Irrigation <= 50000)\n## The total investment in irrigation should not be less than $10,000 to ensure some basic improvements.\nmodel.addCons(Irrigation >= 10000)\n## The farm has a labor constraint that limits the total acres of wheat and corn to 80.\nmodel.addCons(Wheat + Corn <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Investment in Irrigation: \", model.getVal(Irrigation))\n    print(\"Maximized Total Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1584,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project.\n// {\"number of units of CondoX\": \"CondoX\", \"range\": \"CondoX >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoY\": \"CondoY\", \"range\": \"CondoY >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoZ\": \"CondoZ\", \"range\": \"CondoZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoX, the selling price is $200,000, the construction cost is $120,000, and the construction time is 3 months. \nFor CondoY, the selling price is $250,000, the construction cost is $150,000, and the construction time is 4 months. \nFor CondoZ, the selling price is $300,000, the construction cost is $180,000, and the construction time is 5 months.\nThe developer aims to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).\n// Selling profit of CondoX: Profit_CondoX = (200,000 - 120,000) * CondoX\n// Selling profit of CondoY: Profit_CondoY = (250,000 - 150,000) * CondoY\n// Selling profit of CondoZ: Profit_CondoZ = (300,000 - 180,000) * CondoZ\n// So, the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / (3 * CondoX + 4 * CondoY + 5 * CondoZ)\n\n## Generate Constraint-1:\nThe developer has a budget of $10,000,000 for construction costs for the project.\n// 120,000 * CondoX + 150,000 * CondoY + 180,000 * CondoZ <= 10,000,000",
        "question": "A real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project.\nFor CondoX, the selling price is $200,000, the construction cost is $120,000, and the construction time is 3 months. \nFor CondoY, the selling price is $250,000, the construction cost is $150,000, and the construction time is 4 months. \nFor CondoZ, the selling price is $300,000, the construction cost is $180,000, and the construction time is 5 months.\nThe developer has a budget of $10,000,000 for construction costs for the project.\nPlease help the developer to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCondoX = model.addVar(vtype=\"INTEGER\", name=\"CondoX\", lb=0) # number of units of CondoX\nCondoY = model.addVar(vtype=\"INTEGER\", name=\"CondoY\", lb=0) # number of units of CondoY\nCondoZ = model.addVar(vtype=\"INTEGER\", name=\"CondoZ\", lb=0) # number of units of CondoZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoX = (200000 - 120000) * CondoX\nProfit_CondoY = (250000 - 150000) * CondoY\nProfit_CondoZ = (300000 - 180000) * CondoZ\nConstructionTime = 3 * CondoX + 4 * CondoY + 5 * CondoZ\n## the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / ConstructionTime\n## convert the division to multiplication\nmodel.addCons(obj * ConstructionTime == Profit_CondoX + Profit_CondoY + Profit_CondoZ)\n\n# Add constraints\n## The developer has a budget of $10,000,000 for construction costs for the project.\nmodel.addCons(120000 * CondoX + 150000 * CondoY + 180000 * CondoZ <= 10000000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoX: \", model.getVal(CondoX))\n    print(\"Number of CondoY: \", model.getVal(CondoY))\n    print(\"Number of CondoZ: \", model.getVal(CondoZ))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit.\n// {\"hours for production line 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"hours for production line 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation on production line 1 yields a profit of $100 for component A, $150 for component B, and $200 for component C. \nEach hour of operation on production line 2 yields a profit of $120 for component A, $180 for component B, and $220 for component C. \nEach hour of operation on production line 3 yields a profit of $140 for component A, $200 for component B, and $240 for component C.\nThe company aims to maximize the total profit from producing these components.\n// The profit from component A: PA = (100 * P1 + 120 * P2 + 140 * P3)\n// The profit from component B: PB = (150 * P1 + 180 * P2 + 200 * P3)\n// The profit from component C: PC = (200 * P1 + 220 * P2 + 240 * P3)\n// So, the objective function is: Maximize PA + PB + PC\n\n## Generate Constraint-1:\nThe total operating hours for all production lines cannot exceed 100 hours per week.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nEach production line can operate for a maximum of 40 hours per week.\n// P1 <= 40; P2 <= 40; P3 <= 40",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to maximize profit. The profit per hour for each component on each production line is given in the following Table.\n\n| Production Line | Component A Profit/Hour | Component B Profit/Hour | Component C Profit/Hour |\n|-----------------|-------------------------|-------------------------|-------------------------|\n| 1               | $100                    | $150                    | $200                    |\n| 2               | $120                    | $180                    | $220                    |\n| 3               | $140                    | $200                    | $240                    |\n\nThe total operating hours for all production lines cannot exceed 100 hours per week. Each production line can operate for a maximum of 40 hours per week. Please help the company to maximize the total profit from producing these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # hours for production line 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # hours for production line 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # hours for production line 3\n\n# Define objective function\nPA = 100 * P1 + 120 * P2 + 140 * P3 # profit from component A\nPB = 150 * P1 + 180 * P2 + 200 * P3 # profit from component B\nPC = 200 * P1 + 220 * P2 + 240 * P3 # profit from component C\n# So, the objective function is: Maximize PA + PB + PC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == PA + PB + PC)\n\n# Add constraints\n# The total operating hours for all production lines cannot exceed 100 hours per week.\nmodel.addCons(P1 + P2 + P3 <= 100)\n# Each production line can operate for a maximum of 40 hours per week.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 40)\nmodel.addCons(P3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line 1: \", model.getVal(P1))\n    print(\"Hours for Production Line 2: \", model.getVal(P2))\n    print(\"Hours for Production Line 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1025,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits.\n// {\"number of units of ComponentA\": \"ComponentATeams\", \"range\": \"ComponentATeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBTeams\", \"range\": \"ComponentBTeams >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCTeams\", \"range\": \"ComponentCTeams >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company wants to maximize the total profit.\n// Profit for ComponentA: Profit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\n// Profit for ComponentB: Profit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\n// Profit for ComponentC: Profit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profits. The profit per unit for ComponentA is $50, but it decreases by $0.5 for each additional unit produced. The profit per unit for ComponentB is $70, but it decreases by $0.7 for each additional unit produced. The profit per unit for ComponentC is $90, but it decreases by $1 for each additional unit produced. The company wants to maximize the total profit. The company has a total production capacity of 1000 units for the month. Please help the company determine the optimal number of units to produce for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentATeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentATeams\", lb=0) # number of units of ComponentA\nComponentBTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentBTeams\", lb=0) # number of units of ComponentB\nComponentCTeams = model.addVar(vtype=\"INTEGER\", name=\"ComponentCTeams\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit for ComponentA: Profit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\n## Profit for ComponentB: Profit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\n## Profit for ComponentC: Profit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\nProfit_ComponentA = (50 - 0.5 * ComponentATeams) * ComponentATeams\nProfit_ComponentB = (70 - 0.7 * ComponentBTeams) * ComponentBTeams\nProfit_ComponentC = (90 - 1 * ComponentCTeams) * ComponentCTeams\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(ComponentATeams + ComponentBTeams + ComponentCTeams <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(ComponentATeams))\n    print(\"Number of ComponentB: \", model.getVal(ComponentBTeams))\n    print(\"Number of ComponentC: \", model.getVal(ComponentCTeams))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 740,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of his land with soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for fertilization.\n// 30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000\n\n## Generate Constraint-4:\nThe farmer wants to ensure that each crop has at least 5 acres dedicated to it.\n// WheatAcres >= 5; CornAcres >= 5; SoybeansAcres >= 5",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization. The profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization. The profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization. The profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization. The farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization. The farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of his land with soybeans. The farmer has a budget of $5000 for fertilization. The farmer wants to ensure that each crop has at least 5 acres dedicated to it. Please help the farmer to maximize his net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=5)  # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=5)  # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=5)  # acres of soybeans\n\n# Define objective function\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n# So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans))\n\n# Add constraints\n# The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n# Due to soil conditions, the farmer must plant at least 20% of his land with soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n# The farmer has a budget of $5000 for fertilization.\nmodel.addCons(30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for soybeans is $200. However, the yield of each crop depends on the soil conditions, which are represented by a nonlinear function. The yield function for wheat is Y_W = 100 * W^0.5, for corn is Y_C = 150 * C^0.6, and for soybeans is Y_S = 200 * S^0.7. The farmer aims to maximize the total profit from all crops.\n// Objective function: Maximize P = Y_W * W + Y_C * C + Y_S * S\n// Formal definition: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + S <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint for fertilizers and seeds, which is $10,000. The cost per acre for wheat is $20, for corn is $30, and for soybeans is $40.\n// 20 * W + 30 * C + 40 * S <= 10,000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 20% of the land is allocated to each crop to maintain soil diversity.\n// W >= 0.2 * (W + C + S); C >= 0.2 * (W + C + S); S >= 0.2 * (W + C + S)",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to maximize profit while considering the soil conditions and available resources. The profit per acre for wheat is $100, for corn is $150, and for soybeans is $200. The yield of each crop depends on the soil conditions, which are represented by a nonlinear function. The yield function for wheat is Y_W = 100 * W^0.5, for corn is Y_C = 150 * C^0.6, and for soybeans is Y_S = 200 * S^0.7. The total land available for farming is 100 acres. The farmer has a budget constraint for fertilizers and seeds, which is $10,000. The cost per acre for wheat is $20, for corn is $30, and for soybeans is $40. The farmer wants to ensure that at least 20% of the land is allocated to each crop to maintain soil diversity. Please help the farmer to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 100 * W^0.5 * W + 150 * C^0.6 * C + 200 * S^0.7 * S\n## convert the nonlinear terms to variables\nW_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"W_yield\")\nC_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"C_yield\")\nS_yield = model.addVar(vtype=\"CONTINUOUS\", name=\"S_yield\")\nmodel.addCons(W_yield == W**0.5)\nmodel.addCons(C_yield == C**0.6)\nmodel.addCons(S_yield == S**0.7)\nmodel.addCons(obj == 100 * W * W_yield + 150 * C * C_yield + 200 * S * S_yield)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + S <= 100)\n## The farmer has a budget constraint for fertilizers and seeds, which is $10,000.\nmodel.addCons(20 * W + 30 * C + 40 * S <= 10000)\n## The farmer wants to ensure that at least 20% of the land is allocated to each crop to maintain soil diversity.\nmodel.addCons(W >= 0.2 * (W + C + S))\nmodel.addCons(C >= 0.2 * (W + C + S))\nmodel.addCons(S >= 0.2 * (W + C + S))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 905,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and 3 units of raw material, with a profit of $5 per unit. \nEach unit of component B requires 3 hours of labor and 4 units of raw material, with a profit of $7 per unit. \nEach unit of component C requires 4 hours of labor and 5 units of raw material, with a profit of $9 per unit.\nThe plant aims to maximize the profit per unit of labor used.\n// Profit from A: Profit_A = 5 * A\n// Profit from B: Profit_B = 7 * B\n// Profit from C: Profit_C = 9 * C\n// Total labor used: Labor = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for raw materials.\n// 3 * A + 4 * B + 5 * C <= 1000",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency. The labor hours, raw material units, and profit per unit for each component are given in the following Table.\n\n| Component | Labor Hours | Raw Material Units | Profit per Unit |\n|-----------|-------------|--------------------|-----------------|\n| A         | 2 hours     | 3 units            | $5              |\n| B         | 3 hours     | 4 units            | $7              |\n| C         | 4 hours     | 5 units            | $9              |\n\nThe plant has a daily budget of $1000 for raw materials. The plant aims to maximize the profit per unit of labor used. Please help the plant determine the optimal number of each component to produce daily.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 5 * A\nProfit_B = 7 * B\nProfit_C = 9 * C\nLabor = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily budget of $1000 for raw materials.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnts\", \"range\": \"DeviceBUnts >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnts\", \"range\": \"DeviceCUnts >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n// Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n// Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n// Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for the month.\n// DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize their profit. The profit per unit for DeviceA is $50, for DeviceB is $70, and for DeviceC is $90. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The cost function for each device is given by: CostA = 20 + 0.05 * (DeviceAUnits^2), CostB = 30 + 0.03 * (DeviceBUnts^2), CostC = 40 + 0.02 * (DeviceCUnts^2). The company aims to maximize the total net profit.\n\n| Device | Profit per Unit | Cost Function                |\n|--------|-----------------|------------------------------|\n| DeviceA| $50             | 20 + 0.05 * (DeviceAUnits^2) |\n| DeviceB| $70             | 30 + 0.03 * (DeviceBUnts^2)  |\n| DeviceC| $90             | 40 + 0.02 * (DeviceCUnts^2)  |\n\nThe company has a total production capacity of 1000 units for the month. Please help the company determine the optimal number of units to produce for each device to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=0) # number of units of DeviceA\nDeviceBUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnts\", lb=0) # number of units of DeviceB\nDeviceCUnts = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnts\", lb=0) # number of units of DeviceC\n\n# Define objective function\n## Total net profit for DeviceA: Profit_DeviceA = (50 - (20 + 0.05 * (DeviceAUnits^2))) * DeviceAUnits\n## Total net profit for DeviceB: Profit_DeviceB = (70 - (30 + 0.03 * (DeviceBUnts^2))) * DeviceBUnts\n## Total net profit for DeviceC: Profit_DeviceC = (90 - (40 + 0.02 * (DeviceCUnts^2))) * DeviceCUnts\n## So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nProfit_DeviceA = (50 - (20 + 0.05 * DeviceAUnits**2)) * DeviceAUnits\nProfit_DeviceB = (70 - (30 + 0.03 * DeviceBUnts**2)) * DeviceBUnts\nProfit_DeviceC = (90 - (40 + 0.02 * DeviceCUnts**2)) * DeviceCUnts\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\n## The company has a total production capacity of 1000 units for the month.\nmodel.addCons(DeviceAUnits + DeviceBUnts + DeviceCUnts <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnts))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnts))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1124,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The production time per unit of P1 is 1 hour, P2 is 2 hours, and P3 is 3 hours. The company aims to maximize the total profit while considering the efficiency of production time.\n// Profit_P1 = 30 * Q1 - 10 * Q1\n// Profit_P2 = 40 * Q2 - 15 * Q2\n// Profit_P3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (Q1 + 2 * Q2 + 3 * Q3)\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// Q1 + 2 * Q2 + 3 * Q3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000\n\n## Generate Constraint-3:\nThe company has a storage capacity of 500 units.\n// Q1 + Q2 + Q3 <= 500",
        "question": "A manufacturer produces three types of products: P1, P2, and P3. The company needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit, production cost per unit, and production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|--------------------------|\n| P1      | $30             | $10                      | 1 hour                    |\n| P2      | $40             | $15                      | 2 hours                   |\n| P3      | $50             | $20                      | 3 hours                   |\n\nThe company has a total production time of 200 hours. The company has a budget of $10,000 for production costs. The company also has a storage capacity of 500 units. \nPlease help the company to maximize the total profit while considering the efficiency of production time, which is defined as the sum of the profit per unit minus the production cost per unit, divided by the sum of the production times per unit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of P1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of P2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (30 - 10) * Q1\nProfit_P2 = (40 - 15) * Q2\nProfit_P3 = (50 - 20) * Q3\nProductionTime = Q1 + 2 * Q2 + 3 * Q3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(Q1 + 2 * Q2 + 3 * Q3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 10000)\n## The company has a storage capacity of 500 units.\nmodel.addCons(Q1 + Q2 + Q3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(Q1))\n    print(\"Quantity of P2: \", model.getVal(Q2))\n    print(\"Quantity of P3: \", model.getVal(Q3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineA_Units\", \"range\": \"MachineA_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineB_Units\", \"range\": \"MachineB_Units >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineC_Units\", \"range\": \"MachineC_Units >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each unit of MachineA is $500, but it requires a setup cost of $100 per unit. MachineB yields a profit of $700 per unit with a setup cost of $150 per unit. MachineC yields a profit of $900 per unit with a setup cost of $200 per unit. The company wants to maximize the total profit.\n// Total profit from MachineA: Profit_MachineA = (500 - 100) * MachineA_Units\n// Total profit from MachineB: Profit_MachineB = (700 - 150) * MachineB_Units\n// Total profit from MachineC: Profit_MachineC = (900 - 200) * MachineC_Units\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a limited budget for setup costs, which is $10,000.\n// 100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10,000\n\n## Generate Constraint-2:\nDue to production constraints, the total number of machines produced cannot exceed 100 units.\n// MachineA_Units + MachineB_Units + MachineC_Units <= 100\n\n## Generate Constraint-3:\nMarket research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\n// MachineC_Units >= 0.5 * MachineA_Units\n\n## Generate Constraint-4:\nTo ensure a balanced production line, the company wants to ensure that at least one unit of each machine is produced.\n// MachineA_Units >= 1; MachineB_Units >= 1; MachineC_Units >= 1",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. The company needs to decide how many units of each machine to produce to optimize their profit. The profit and setup cost for each machine are given in the following Table.\n\n| Machine | Profit per Unit | Setup Cost per Unit |\n|---------|-----------------|---------------------|\n| MachineA | $500           | $100                |\n| MachineB | $700           | $150                |\n| MachineC | $900           | $200                |\n\nThe company has a limited budget for setup costs, which is $10,000. Due to production constraints, the total number of machines produced cannot exceed 100 units. Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced. To ensure a balanced production line, the company wants to ensure that at least one unit of each machine is produced.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each machine.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineA_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineA_Units\", lb=1)  # number of units of MachineA\nMachineB_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineB_Units\", lb=1)  # number of units of MachineB\nMachineC_Units = model.addVar(vtype=\"INTEGER\", name=\"MachineC_Units\", lb=1)  # number of units of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 100) * MachineA_Units\nProfit_MachineB = (700 - 150) * MachineB_Units\nProfit_MachineC = (900 - 200) * MachineC_Units\n# So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a limited budget for setup costs, which is $10,000.\nmodel.addCons(100 * MachineA_Units + 150 * MachineB_Units + 200 * MachineC_Units <= 10000)\n# Due to production constraints, the total number of machines produced cannot exceed 100 units.\nmodel.addCons(MachineA_Units + MachineB_Units + MachineC_Units <= 100)\n# Market research indicates that the number of MachineC units produced must be at least half the number of MachineA units produced.\nmodel.addCons(MachineC_Units >= 0.5 * MachineA_Units)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineA_Units))\n    print(\"Number of MachineB Units: \", model.getVal(MachineB_Units))\n    print(\"Number of MachineC Units: \", model.getVal(MachineC_Units))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources.\n// {\"number of units of cake A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of cake C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Cake A, the selling price is $20, the ingredient cost is $5, and the baking time is 1 hour. \nFor Cake B, the selling price is $30, the ingredient cost is $10, and the baking time is 2 hours. \nFor Cake C, the selling price is $40, the ingredient cost is $15, and the baking time is 3 hours.\nThe bakery has only one oven and can only bake one type of cake at a time. The bakery aims to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n// Profit of A: Profit_A = (20 - 5) * A\n// Profit of B: Profit_B = (30 - 10) * B\n// Profit of C: Profit_C = (40 - 15) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + 2 * B + 3 * C)\n\n## Generate Constraint-1:\nThe bakery has a budget of $1000 for ingredients for the month.\n// 5 * A + 10 * B + 15 * C <= 1000",
        "question": "A bakery produces three types of cakes: A, B, and C. The bakery needs to determine how many units of each cake to bake in the upcoming month to maximize profit while considering the limited resources. The selling price, ingredient cost, and baking time for each cake are given in the following Table.\n\n| Cake | Selling Price | Ingredient Cost | Baking Time |\n|------|---------------|-----------------|-------------|\n| A    | $20           | $5              | 1 hour      |\n| B    | $30           | $10             | 2 hours     |\n| C    | $40           | $15             | 3 hours     |\n\nThe bakery has a budget of $1000 for ingredients for the month. The bakery has only one oven and can only bake one type of cake at a time. \nPlease help the bakery to maximize the profit rate (which is defined as the sum of the profit per cake divided by the sum of the baking times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of cake A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of cake B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of cake C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 5) * A\nProfit_B = (30 - 10) * B\nProfit_C = (40 - 15) * C\nBakingTime = A + 2 * B + 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a budget of $1000 for ingredients for the month.\nmodel.addCons(5 * A + 10 * B + 15 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Cake A: \", model.getVal(A))\n    print(\"Number of Cake B: \", model.getVal(B))\n    print(\"Number of Cake C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 871,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n\n| Warehouse | Fuel Consumption Rate (liters/km) |\n|-----------|-----------------------------------|\n| A         | 5                                 |\n| B         | 6                                 |\n| C         | 7                                 |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nPlease help the company to minimize the total fuel consumption of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of trucks for Warehouse C\n\n# Define objective function\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n# So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n# Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. The cost of fertilizing each acre is $50 for wheat, $70 for corn, and $60 for soybeans. The farmer aims to maximize the net profit per unit of labor (defined as the total net profit divided by the total labor hours). Labor hours required per acre are 2 hours for wheat, 3 hours for corn, and 2.5 hours for soybeans.\n// Net profit of wheat: Net_Profit_W = (200 - 50) * W\n// Net profit of corn: Net_Profit_C = (300 - 70) * C\n// Net profit of soybeans: Net_Profit_S = (250 - 60) * S\n// So, the objective function is: Maximize (Net_Profit_W + Net_Profit_C + Net_Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for fertilizing the crops this season.\n// 50 * W + 70 * C + 60 * S <= 10000\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 10 acres of each crop this season.\n// W >= 10; C >= 10; S >= 10\n\n## Generate Constraint-3:\nThe farmer can allocate a maximum of 500 labor hours this season.\n// 2 * W + 3 * C + 2.5 * S <= 500",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres of each crop to plant this season. The profit per acre, cost of fertilizing each acre, and labor hours required per acre for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Cost of Fertilizing per Acre | Labor Hours per Acre |\n|----------|-----------------|------------------------------|----------------------|\n| Wheat    | $200            | $50                          | 2 hours              |\n| Corn     | $300            | $70                          | 3 hours              |\n| Soybeans | $250            | $60                          | 2.5 hours            |\n\nThe farmer has a budget of $10,000 for fertilizing the crops this season. The farmer wants to plant at least 10 acres of each crop this season. The farmer can allocate a maximum of 500 labor hours this season. \nPlease help the farmer to maximize the net profit per unit of labor (defined as the total net profit divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 10 acres of each crop this season.\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=10) # number of acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=10) # number of acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Profit_W = (200 - 50) * W\nNet_Profit_C = (300 - 70) * C\nNet_Profit_S = (250 - 60) * S\nLaborHours = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Net_Profit_W + Net_Profit_C + Net_Profit_S) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Net_Profit_W + Net_Profit_C + Net_Profit_S)\n\n# Add constraints\n## The farmer has a budget of $10,000 for fertilizing the crops this season.\nmodel.addCons(50 * W + 70 * C + 60 * S <= 10000)\n## The farmer can allocate a maximum of 500 labor hours this season.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Wheat: \", model.getVal(W))\n    print(\"Number of Acres of Corn: \", model.getVal(C))\n    print(\"Number of Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Labor: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1064,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production.\n// {\"number of solar panels on flat roof\": \"SF\", \"range\": \"SF >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on pitched roof\": \"SP\", \"range\": \"SP >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on domed roof\": \"SD\", \"range\": \"SD >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel varies based on the type of roof. On a flat roof, each panel produces 100 kWh. On a pitched roof, each panel produces 120 kWh. On a domed roof, each panel produces 150 kWh. The company aims to maximize the total energy production from all roofs.\n// Total energy production: Energy = 100 * SF + 120 * SP + 150 * SD\n// So, the objective function is: Maximize Energy\n\n## Generate Constraint-1:\nThe total number of solar panels that can be installed is limited to 1000.\n// SF + SP + SD <= 1000",
        "question": "A solar energy company is planning to install solar panels on three different types of roofs: flat, pitched, and domed. The company needs to determine the number of solar panels to install on each type of roof to maximize energy production. The energy production from each solar panel varies based on the type of roof. On a flat roof, each panel produces 100 kWh. On a pitched roof, each panel produces 120 kWh. On a domed roof, each panel produces 150 kWh. The total number of solar panels that can be installed is limited to 1000. Please help the company to maximize the total energy production from all roofs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSF = model.addVar(vtype=\"INTEGER\", name=\"SF\", lb=0) # number of solar panels on flat roof\nSP = model.addVar(vtype=\"INTEGER\", name=\"SP\", lb=0) # number of solar panels on pitched roof\nSD = model.addVar(vtype=\"INTEGER\", name=\"SD\", lb=0) # number of solar panels on domed roof\n\n# Define objective function\nEnergy = 100 * SF + 120 * SP + 150 * SD\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy)\n\n# Add constraints\nmodel.addCons(SF + SP + SD <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roof: \", model.getVal(SF))\n    print(\"Number of Solar Panels on Pitched Roof: \", model.getVal(SP))\n    print(\"Number of Solar Panels on Domed Roof: \", model.getVal(SD))\n    print(\"Total Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 612,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new technology that reduces production costs.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing P1 is $30 per unit, and the cost of producing P2 is $40 per unit. The revenue for P1 is $50 per unit, and for P2 is $60 per unit. The new technology reduces the production cost by $1 for every $10,000 invested. The company aims to maximize the total profit from both products.\n// Total profit for P1: Profit_P1 = (50 - 30 + 0.0001 * TechnologyInvestment) * P1\n// Total profit for P2: Profit_P2 = (60 - 40 + 0.0001 * TechnologyInvestment) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units for both products combined.\n// P1 + P2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for investing in the new technology.\n// TechnologyInvestment <= 50000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new technology that reduces production costs. The cost, revenue, and the effect of the new technology on production costs are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit | Effect of Technology Investment |\n|---------|---------------|------------------|---------------------------------|\n| P1      | $30           | $50              | $1 reduction per $10,000 invested |\n| P2      | $40           | $60              | $1 reduction per $10,000 invested |\n\nThe company has a total production capacity of 200 units for both products combined. The company has a budget of $50,000 for investing in the new technology. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for P1: Profit_P1 = (50 - 30 + 0.0001 * TechnologyInvestment) * P1\n## Total profit for P2: Profit_P2 = (60 - 40 + 0.0001 * TechnologyInvestment) * P2\nProfit_P1 = (50 - 30 + 0.0001 * TechnologyInvestment) * P1\nProfit_P2 = (60 - 40 + 0.0001 * TechnologyInvestment) * P2\n## So, the objective function is: Maximize (Profit_P1 + Profit_P2)\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\n## The company has a total production capacity of 200 units for both products combined.\nmodel.addCons(P1 + P2 <= 200)\n## The company has a budget of $50,000 for investing in the new technology.\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in New Technology: \", model.getVal(TechnologyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 887,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for crop A is $500, but it requires 2 units of water. Crop B yields a profit of $700 per hectare with 3 units of water required. Crop C yields $1000 per hectare but requires 5 units of water. The farmer wants to maximize the total profit per unit of water used (profit/water).\n// Profit of A: Profit_A = 500 * A\n// Profit of B: Profit_B = 700 * B\n// Profit of C: Profit_C = 1000 * C\n// Water used for A: Water_A = 2 * A\n// Water used for B: Water_B = 3 * B\n// Water used for C: Water_C = 5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 hectares available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited water supply and can only use up to 300 units of water.\n// 2 * A + 3 * B + 5 * C <= 300\n\n## Generate Constraint-3:\nThe farmer must plant at least 10 hectares of each crop to maintain crop diversity and soil health.\n// A >= 10; B >= 10; C >= 10",
        "question": "A farmer is planning to plant three different crops: A, B, and C. The farmer needs to decide how many hectares to allocate to each crop to optimize the farm's profitability and resource usage. The profit per hectare and the water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Required per Hectare |\n|------|---------------------|----------------------------|\n| A    | $500                | 2 units                    |\n| B    | $700                | 3 units                    |\n| C    | $1000               | 5 units                    |\n\nThe farmer has a total of 100 hectares available for planting. The farmer has a limited water supply and can only use up to 300 units of water. The farmer must plant at least 10 hectares of each crop to maintain crop diversity and soil health. \nPlease help the farmer to maximize the total profit per unit of water used (profit/water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer must plant at least 10 hectares of each crop to maintain crop diversity and soil health.\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=10) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=10) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=10) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 100 hectares available for planting.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a limited water supply and can only use up to 300 units of water.\nmodel.addCons(2 * A + 3 * B + 5 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices.\n// Profit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\n// Profit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\n// Profit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// Smartphones + Tablets + Laptops <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit. The selling price per unit and the initial energy cost per unit for each device are given in the following Table.\n\n| Device       | Selling Price per Unit | Initial Energy Cost per Unit |\n|--------------|------------------------|------------------------------|\n| Smartphones  | $100                   | $10                          |\n| Tablets      | $150                   | $15                          |\n| Laptops      | $200                   | $20                          |\n\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The company has a total production capacity of 10,000 units across all devices. The total investment in energy efficiency upgrades cannot exceed $50,000. \n\nPlease help the company to maximize the total profit from all devices.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)  # quantity of Smartphones\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)  # quantity of Tablets\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)  # quantity of Laptops\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)  # investment in energy efficiency\n\n# Define objective function\nProfit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\nProfit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\nProfit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops <= 10000)  # total production capacity constraint\nmodel.addCons(EnergyEfficiency <= 50000)  # investment in energy efficiency constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1103,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric generators\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year.\nThe cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year.\nThe cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year.\nThe company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n// Total installation cost: Install_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\n// Total annual maintenance cost: Maintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\n// Total annual energy output: Energy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n// So, the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for the installation of all systems.\n// 2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 100,000 kWh.\n// 1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000",
        "question": "A company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators. The cost of installation, estimated annual energy output, and maintenance cost for each system are given in the following Table.\n\n| System          | Installation Cost | Annual Energy Output | Annual Maintenance Cost |\n|-----------------|-------------------|----------------------|-------------------------|\n| Solar Panels    | $2000             | 1000 kWh             | $50 per year            |\n| Wind Turbines   | $5000             | 2500 kWh             | $100 per year           |\n| Hydroelectric Generators | $10000 | 5000 kWh             | $200 per year           |\n\nThe company has a budget of $200,000 for the installation of all systems. The total annual energy output must be at least 100,000 kWh. Please help the company to minimize the total cost of installation and maintenance per unit of energy produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstall_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\nMaintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\nEnergy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n## the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Output == Install_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a budget of $200,000 for the installation of all systems.\nmodel.addCons(2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000)\n## The total annual energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Generators: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials for product 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for product 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"machine hours for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products.\n// The objective function is: Maximize Profit1\n\n## Generate Constraint-1:\nThe total raw materials available for all products is limited to 1000 units.\n// R1 <= 1000\n\n## Generate Constraint-2:\nThe total labor hours available for all products is limited to 800 hours.\n// L1 <= 800\n\n## Generate Constraint-3:\nThe total machine hours available for all products is limited to 500 hours.\n// M1 <= 500",
        "question": "A manufacturing company produces three types of products using a complex production line. The company needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2. The company aims to maximize the total profit from all three products. The total raw materials available for all products is limited to 1000 units. The total labor hours available for all products is limited to 800 hours. The total machine hours available for all products is limited to 500 hours.\nPlease help the company determine the optimal allocation of raw materials (R1), labor hours (L1), and machine hours (M1) for product 1 to maximize its profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0)  # raw materials for product 1\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0)  # labor hours for product 1\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # machine hours for product 1\n\n# Define objective function\n## The profit from product 1 is given by a nonlinear function: Profit1 = 100 * R1^0.5 * L1^0.3 * M1^0.2\n## Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100 * R1**0.5 * L1**0.3 * M1**0.2)\n\n# Add constraints\n## The total raw materials available for all products is limited to 1000 units.\nmodel.addCons(R1 <= 1000)\n## The total labor hours available for all products is limited to 800 hours.\nmodel.addCons(L1 <= 800)\n## The total machine hours available for all products is limited to 500 hours.\nmodel.addCons(M1 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials for Product 1: \", model.getVal(R1))\n    print(\"Labor Hours for Product 1: \", model.getVal(L1))\n    print(\"Machine Hours for Product 1: \", model.getVal(M1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 762,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed.\n// Efficiency_A = 10 * A / 5\n// Efficiency_B = 15 * B / 7\n// Efficiency_C = 20 * C / 9\n// So, the objective function is: Maximize (Efficiency_A + Efficiency_B + Efficiency_C)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 500 liters per day.\n// 5 * A + 7 * B + 9 * C <= 500\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe company has a daily cargo requirement of at least 1000 tons.\n// 10 * A + 15 * B + 20 * C >= 1000\n\n## Generate Constraint-4:\nThe number of Truck A cannot exceed 20.\n// A <= 20\n\n## Generate Constraint-5:\nThe number of Truck B must be at least 10.\n// B >= 10",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed. The company has a total fuel budget of 500 liters per day. The total number of trucks that can be deployed is limited to 50. The company has a daily cargo requirement of at least 1000 tons. The number of Truck A cannot exceed 20. The number of Truck B must be at least 10. Please help the company determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_A = 10 * A / 5\nEfficiency_B = 15 * B / 7\nEfficiency_C = 20 * C / 9\n## convert the division to multiplication\nmodel.addCons(obj * (5 * A + 7 * B + 9 * C) == 10 * A + 15 * B + 20 * C)\n\n# Add constraints\n## The company has a total fuel budget of 500 liters per day.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 500)\n## The total number of trucks that can be deployed is limited to 50.\nmodel.addCons(A + B + C <= 50)\n## The company has a daily cargo requirement of at least 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 1000)\n## The number of Truck A cannot exceed 20.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to Product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * ProductA\n// Total profit for Product B: ProfitB = 70 * ProductB\n// Total profit for Product C: ProfitC = 60 * ProductC\n// The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000\n\n## Generate Constraint-2:\nThe production of Product A is limited to a maximum of 200 units.\n// ProductA <= 200\n\n## Generate Constraint-3:\nThe production of Product B must be at least 100 units.\n// ProductB >= 100\n\n## Generate Constraint-4:\nThe production of Product C cannot exceed 150 units.\n// ProductC <= 150\n\n## Generate Constraint-5:\nThe resource allocation for each product must be proportional to the number of units produced, with a nonlinear relationship defined as ResourceX = 0.1 * (ProductX)^2, where X is A, B, or C.\n// ResourceA = 0.1 * (ProductA)^2\n// ResourceB = 0.1 * (ProductB)^2\n// ResourceC = 0.1 * (ProductC)^2",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n\nThe total resources available are limited to 1000 units. The production of Product A is limited to a maximum of 200 units. The production of Product B must be at least 100 units. The production of Product C cannot exceed 150 units. The resource allocation for each product must be proportional to the number of units produced, with a nonlinear relationship defined as ResourceX = 0.1 * (ProductX)^2, where X is A, B, or C.\n\nPlease help the manufacturer to determine the optimal number of units to produce for each product and the corresponding resource allocation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100, ub=None)  # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=150)  # number of units of Product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resources allocated to Product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resources allocated to Product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resources allocated to Product C\n\n# Define objective function\nProfitA = 50 * ProductA\nProfitB = 70 * ProductB\nProfitC = 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\nmodel.addCons(ProductA <= 200)\nmodel.addCons(ProductB >= 100)\nmodel.addCons(ProductC <= 150)\nmodel.addCons(ResourceA == 0.1 * (ProductA ** 2))\nmodel.addCons(ResourceB == 0.1 * (ProductB ** 2))\nmodel.addCons(ResourceC == 0.1 * (ProductC ** 2))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Resources Allocated to Product A: \", model.getVal(ResourceA))\n    print(\"Resources Allocated to Product B: \", model.getVal(ResourceB))\n    print(\"Resources Allocated to Product C: \", model.getVal(ResourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1278,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $20, the material cost is $10, and the production time is 3 hours. \nFor Product B, the selling price is $30, the material cost is $15, and the production time is 4 hours. \nFor Product C, the selling price is $40, the material cost is $20, and the production time is 5 hours.\nThe company aims to maximize the profit rate, which is defined as the total profit divided by the total production time.\n// Profit of A: Profit_A = (20 - 10) * A\n// Profit of B: Profit_B = (30 - 15) * B\n// Profit of C: Profit_C = (40 - 20) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 4 * B + 5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $1000 for material costs.\n// 10 * A + 15 * B + 20 * C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product to optimize its profit. The selling price, material cost, and production time for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Production Time |\n|---------|---------------|---------------|-----------------|\n| A       | 20$           | 10$           | 3 hours         |\n| B       | 30$           | 15$           | 4 hours         |\n| C       | 40$           | 20$           | 5 hours         |\n\nThe company has a budget of $1000 for material costs. The company aims to maximize the profit rate, which is defined as the total profit divided by the total production time. Please help the company determine the optimal production quantity for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (20 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nProductionTime = 3 * A + 4 * B + 5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $1000 for material costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 841,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n// Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\n// Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\n// Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $5000 for seeds and fertilizers. The cost per acre for crop A is $30, for crop B is $40, and for crop C is $50.\n// 30 * A + 40 * B + 50 * C <= 5000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation. The farm has a budget of $5000 for seeds and fertilizers, with a cost per acre for crop A being $30, for crop B being $40, and for crop C being $50.\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=1, ub=100)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=1, ub=100)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=1, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 1)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 707,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of ComponentA\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. The company wants to maximize the total profit from selling these components.\n// Total profit: Profit = 50A + 70B + 90C\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nDue to raw material availability, the production of ComponentA cannot exceed 400 units.\n// A <= 400\n\n## Generate Constraint-3:\nThe market demand for ComponentB is such that the company can only sell up to 300 units per month.\n// B <= 300\n\n## Generate Constraint-4:\nThe company has a strategic goal to produce at least 10% more ComponentC than ComponentA.\n// C >= 1.1 * A",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce to maximize their profit while considering the production capacity and market demand. The profit per unit for ComponentA is $50, for ComponentB is $70, and for ComponentC is $90. The company wants to maximize the total profit from selling these components. The total production capacity of the company is limited to 1000 units per month. Due to raw material availability, the production of ComponentA cannot exceed 400 units. The market demand for ComponentB is such that the company can only sell up to 300 units per month. The company has a strategic goal to produce at least 10% more ComponentC than ComponentA. Please help the company determine the optimal number of units to produce for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of ComponentA\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of ComponentB\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit = 50 * A + 70 * B + 90 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000) # Total production capacity constraint\nmodel.addCons(A <= 400) # ComponentA production limit\nmodel.addCons(B <= 300) # ComponentB market demand limit\nmodel.addCons(C >= 1.1 * A) # Strategic goal for ComponentC production\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(A))\n    print(\"Number of ComponentB: \", model.getVal(B))\n    print(\"Number of ComponentC: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 882,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric generators\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year.\nThe cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year.\nThe cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year.\nThe company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n// Total installation cost: Install_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\n// Total annual maintenance cost: Maintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\n// Total annual energy output: Energy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n// So, the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for the installation of all systems.\n// 2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 100,000 kWh.\n// 1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000",
        "question": "A company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators. The cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year. The cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year. The cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year. The company has a budget of $200,000 for the installation of all systems and requires that the total annual energy output must be at least 100,000 kWh. The company wants to minimize the total cost of installation and maintenance per unit of energy produced. Please help the company determine the optimal number of each type of system to install.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0) # number of hydroelectric generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstall_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\nMaintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\nEnergy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n## the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Output == Install_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a budget of $200,000 for the installation of all systems.\nmodel.addCons(2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000)\n## The total annual energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Generators: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company aims to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n// Profit from A: Profit_A = (30 * A) - 500\n// Profit from B: Profit_B = (40 * B) - 700\n// Profit from C: Profit_C = (50 * C) - 900\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited budget of $2000 for setup costs.\n// 500 * A + 700 * B + 900 * C <= 2000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company has a limited budget of $2000 for setup costs.\nPlease help the company to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit from A: Profit_A = (30 * A) - 500\n## Profit from B: Profit_B = (40 * B) - 700\n## Profit from C: Profit_C = (50 * C) - 900\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == (30 * A - 500) + (40 * B - 700) + (50 * C - 900))\n\n# Add constraints\n## The company has a limited budget of $2000 for setup costs.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 658,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20 - 10) * A = 20 * A\n// Profit of product B: Profit_B = (70 - 30 - 15) * B = 25 * B\n// Profit of product C: Profit_C = (100 - 40 - 20) * C = 40 * C\n// So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor. The selling price, raw material cost, and labor cost for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Labor Cost |\n|---------|---------------|-------------------|------------|\n| A       | $50           | $20               | $10        |\n| B       | $70           | $30               | $15        |\n| C       | $100          | $40               | $20        |\n\nThe company has a budget of $10,000 for raw materials for the next quarter. The company aims to maximize the total profit, which is the sum of the profits from each product. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (20 * A + 25 * B + 40 * C)\nmodel.addCons(obj == 20 * A + 25 * B + 40 * C)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 922,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event.\n// {\"number of Chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of Vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cakes, the selling price is $30, the cost of ingredients is $10, and the baking time is 1.5 hours. \nFor Vanilla cakes, the selling price is $25, the cost of ingredients is $8, and the baking time is 1 hour. \nFor Strawberry cakes, the selling price is $28, the cost of ingredients is $9, and the baking time is 1.2 hours.\nThe bakery has only one oven and can bake one type of cake at a time. The bakery aims to maximize the profit efficiency (profit per hour of baking time).\n// Profit_Chocolate = (30 - 10) * C\n// Profit_Vanilla = (25 - 8) * V\n// Profit_Strawberry = (28 - 9) * S\n// So, the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / (1.5 * C + 1 * V + 1.2 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited baking time of 80 hours.\n// 1.5 * C + 1 * V + 1.2 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredients.\n// 10 * C + 8 * V + 9 * S <= 1500\n\n## Generate Constraint-3:\nThe bakery has a storage capacity of 100 cakes in total.\n// C + V + S <= 100",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. The bakery needs to determine the number of each type of cake to bake for an upcoming event. The selling price, cost of ingredients, and baking time for each type of cake are given in the following Table.\n\n| Cake Type | Selling Price | Cost of Ingredients | Baking Time |\n|-----------|---------------|---------------------|-------------|\n| Chocolate | $30           | $10                 | 1.5 hours   |\n| Vanilla   | $25           | $8                  | 1 hour      |\n| Strawberry| $28           | $9                  | 1.2 hours   |\n\nThe bakery has a limited baking time of 80 hours. The bakery has a budget of $1500 for ingredients. The bakery has a storage capacity of 100 cakes in total. The bakery has only one oven and can bake one type of cake at a time. \nPlease help the bakery to maximize the profit efficiency (profit per hour of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of Strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Chocolate = (30 - 10) * C\nProfit_Vanilla = (25 - 8) * V\nProfit_Strawberry = (28 - 9) * S\nBakingTime = 1.5 * C + 1 * V + 1.2 * S\n## the objective function is: Maximize (Profit_Chocolate + Profit_Vanilla + Profit_Strawberry) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_Chocolate + Profit_Vanilla + Profit_Strawberry)\n\n# Add constraints\n## The bakery has a limited baking time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 1.2 * S <= 80)\n## The bakery has a budget of $1500 for ingredients.\nmodel.addCons(10 * C + 8 * V + 9 * S <= 1500)\n## The bakery has a storage capacity of 100 cakes in total.\nmodel.addCons(C + V + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(C))\n    print(\"Number of Vanilla Cakes: \", model.getVal(V))\n    print(\"Number of Strawberry Cakes: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 931,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 100 units.\n// 2 * C1 + 3 * C2 + 4 * C3 <= 100\n\n## Generate Constraint-3:\nThe market demand for C1 is 20 acres. So, the farmer can only plant a maximum of 20 acres of C1.\n// C1 <= 20",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| C1   | $1000           | 2 units                 |\n| C2   | $1200           | 3 units                 |\n| C3   | $1500           | 4 units                 |\n\nThe farm has a total of 50 acres available for cultivation. The farm has a limited water supply of 100 units. The market demand for C1 is 20 acres, so the farmer can only plant a maximum of 20 acres of C1. \n\nPlease help the farmer to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=20) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n## The farm has a limited water supply of 100 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized.\n// {\"production level of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $50, product B yields $70, and product C yields $90. However, the production of product C incurs an additional environmental cost of $10 per unit due to waste management. The manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost.\n// Total profit: Profit = 50 * A + 70 * B + 90 * C\n// Environmental cost: Cost = 10 * C\n// So, the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe manufacturer has a contract to produce at least 200 units of product A.\n// A >= 200\n\n## Generate Constraint-3:\nDue to market demand, the production of product B should not exceed 300 units.\n// B <= 300\n\n## Generate Constraint-4:\nThe production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced.\n// C <= 150",
        "question": "A manufacturer produces three types of products: A, B, and C. The production levels of these products are to be optimized. The profit per unit and additional costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Additional Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | $0                       |\n| B       | $70             | $0                       |\n| C       | $90             | $10                      |\n\nThe manufacturer aims to maximize the net profit, which is the total profit minus the environmental cost. The total production capacity is limited to 1000 units across all products. The manufacturer has a contract to produce at least 200 units of product A. Due to market demand, the production of product B should not exceed 300 units. The production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced.\n\nPlease help the manufacturer to determine the optimal production levels for products A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production level of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * C\n## the objective function is: Maximize (Profit - Cost) = 50 * A + 70 * B + 80 * C\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n## The manufacturer has a contract to produce at least 200 units of product A.\nmodel.addCons(A >= 200)\n## Due to market demand, the production of product B should not exceed 300 units.\nmodel.addCons(B <= 300)\n## The production of product C is limited by the availability of a special component, which allows for a maximum of 150 units of product C to be produced.\nmodel.addCons(C <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of product A: \", model.getVal(A))\n    print(\"Production level of product B: \", model.getVal(B))\n    print(\"Production level of product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1116,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A must be met, which is at least 200 units.\n// A >= 200",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. The demand for component A must be met, which is at least 200 units. Please help the manufacturer determine the optimal production levels for components A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The demand for component A must be met, which is at least 200 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n## So, the objective function is: Maximize (Profit - Storage)\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n## The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 794,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand.\n// {\"number of machines for component A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands.\n// The operating hours for component A: HA = 500 / (10 * MA)\n// The operating hours for component B: HB = 600 / (12 * MB)\n// The operating hours for component C: HC = 750 / (15 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available in the plant.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nEach type of machine can operate for a maximum of 10 hours per day.\n// HA <= 10; HB <= 10; HC <= 10",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand. Each machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands.\n\n| Component | Units Produced per Hour | Daily Demand |\n|-----------|-------------------------|--------------|\n| A         | 10                      | 500          |\n| B         | 12                      | 600          |\n| C         | 15                      | 750          |\n\nThere are a total of 20 machines available in the plant. Each type of machine can operate for a maximum of 10 hours per day.\n\nPlease help the plant manager to minimize the maximum operating hours required to meet the daily demand for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for component A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for component B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = model.addVar(name=\"HA\") # operating hours for component A\nHB = model.addVar(name=\"HB\") # operating hours for component B\nHC = model.addVar(name=\"HC\") # operating hours for component C\nmodel.addCons(HA == 500 / (10 * MA))\nmodel.addCons(HB == 600 / (12 * MB))\nmodel.addCons(HC == 750 / (15 * MC))\n## the objective function is: Minimize max(HA, HB, HC)\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## There are a total of 20 machines available in the plant.\nmodel.addCons(MA + MB + MC <= 20)\n## Each type of machine can operate for a maximum of 10 hours per day.\nmodel.addCons(HA <= 10)\nmodel.addCons(HB <= 10)\nmodel.addCons(HC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(MA))\n    print(\"Number of Machines for Component B: \", model.getVal(MB))\n    print(\"Number of Machines for Component C: \", model.getVal(MC))\n    print(\"Minimum Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1109,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost. The total production capacity of the company is 1000 units per month. Please help the company to determine the optimal production quantity for each product to maximize the total net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n## Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n## So, the objective function is: Maximize (Revenue - Cost)\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The total production capacity of the company is 1000 units per month.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"PA\", \"range\": \"0 <= PA <= 1000\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"0 <= PB <= 1500\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"0 <= PC <= 2000\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A yields a profit of $5, product B yields $7, and product C yields $9. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The profit function is given by:\n// Profit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2)\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited amount of raw material. The raw material required for producing one unit of product A, B, and C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 5000 kg.\n// 2 * PA + 3 * PB + 4 * PC <= 5000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. Each unit of product A yields a profit of $5, product B yields $7, and product C yields $9. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The profit function is given by:\nProfit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2)\nThe company has a limited amount of raw material. The raw material required for producing one unit of product A, B, and C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 5000 kg.\nPlease help the company to maximize its profit while ensuring that the total raw material used does not exceed 5000 kg.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0, ub=1000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0, ub=1500) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0, ub=2000) # production quantity of product C\n\n# Define objective function\n## Profit = 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA^2 + PB^2 + PC^2)\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 5 * PA + 7 * PB + 9 * PC - 0.01 * (PA**2 + PB**2 + PC**2))\n\n# Add constraints\n## The company has a limited amount of raw material. The raw material required for producing one unit of product A, B, and C is 2 kg, 3 kg, and 4 kg, respectively. The total raw material available is 5000 kg.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n// Net revenue of A: Revenue_A = (1000 - 400) * A\n// Net revenue of B: Revenue_B = (1500 - 600) * B\n// Net revenue of C: Revenue_C = (2000 - 800) * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for seed costs for the upcoming season.\n// 400 * A + 600 * B + 800 * C <= 100000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 50 acres to each crop for the upcoming season.\n// A >= 50; B >= 50; C >= 50",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm has a budget of $100,000 for seed costs for the upcoming season. The farm wants to allocate at least 50 acres to each crop for the upcoming season.\nPlease help the farm to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 50 acres to each crop for the upcoming season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = (1000 - 400) * A\nRevenue_B = (1500 - 600) * B\nRevenue_C = (2000 - 800) * C\nLaborHours = 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for seed costs for the upcoming season.\nmodel.addCons(400 * A + 600 * B + 800 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 848,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a unit profit of $50, but it incurs a storage cost of $10 per unit due to its perishable nature.\nProduct B has a unit profit of $70, with a storage cost of $5 per unit.\nProduct C has a unit profit of $60, with no storage cost.\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Cost = 10 * A + 5 * B\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\n// 30 * A + 40 * B + 50 * C <= 15000",
        "question": "A manufacturing company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's revenue and costs. The unit profit and storage costs for each product are given in the following Table.\n\n| Product | Unit Profit | Storage Cost |\n|---------|-------------|--------------|\n| A       | $50         | $10          |\n| B       | $70         | $5           |\n| C       | $60         | $0           |\n\nThe company wants to maximize its net profit, which is the total profit minus the total storage cost. The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nPlease help the company determine the optimal number of units to produce for each product to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## Total profit: Profit = 50 * A + 70 * B + 60 * C\n## Total storage cost: Cost = 10 * A + 5 * B\n## So, the objective function is: Maximize (Profit - Cost)\nProfit = 50 * A + 70 * B + 60 * C\nCost = 10 * A + 5 * B\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $15,000 for production, and the cost to produce one unit of A, B, and C is $30, $40, and $50 respectively.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 830,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost.\n// The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\n\n## Generate Constraint-1:\nThe company has a limited budget of $10,000 for production.\n// 20A + 0.1A^2 + 30B + 0.15B^2 + 25C + 0.12C^2 <= 10000\n\n## Generate Constraint-2:\nThe market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units.\n// A <= 200; B <= 150; C <= 180",
        "question": "A company manufactures three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the available resources and market demand. The profit from each unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for product A is $20 + 0.1 * A^2, for product B is $30 + 0.15 * B^2, and for product C is $25 + 0.12 * C^2. The objective is to maximize the total profit, which is the revenue minus the cost.\n\n| Product | Profit per Unit | Production Cost Formula |\n|---------|-----------------|--------------------------|\n| A       | $50             | $20 + 0.1A^2            |\n| B       | $70             | $30 + 0.15B^2           |\n| C       | $60             | $25 + 0.12C^2           |\n\nThe company has a limited budget of $10,000 for production. The market demand for product A is at most 200 units, for product B is at most 150 units, and for product C is at most 180 units.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=180) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50A - (20 + 0.1A^2)) + (70B - (30 + 0.15B^2)) + (60C - (25 + 0.12C^2))\nmodel.addCons(obj == 50*A - 20*A - 0.1*A**2 + 70*B - 30*B - 0.15*B**2 + 60*C - 25*C - 0.12*C**2)\n\n# Add constraints\n## The company has a limited budget of $10,000 for production.\nmodel.addCons(20*A + 0.1*A**2 + 30*B + 0.15*B**2 + 25*C + 0.12*C**2 <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1220,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand.\n// {\"acreage of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acreage of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acreage of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre. For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre. For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre. The farm wants to maximize the total profit while maintaining a soil health index above 50. The soil health is affected by the cumulative effect of crop planting.\n// Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n// Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n// Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n// So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n\n## Generate Constraint-1:\nThe total acreage available for planting is 100 acres.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe soil health index must remain above 50.\n// 50 <= 100 - (0.1 * Wheat * Wheat + 0.2 * Corn * Corn - 0.05 * Soybeans * Soybeans)\n\n## Generate Constraint-3:\nThe market demand for Wheat is 50 acres. So, the farm can only sell a maximum of 50 acres of Wheat.\n// Wheat <= 50",
        "question": "A farm produces three types of crops: Wheat, Corn, and Soybeans. They need to determine the acreage for each crop to maximize their profit while considering the soil health and market demand. The profit per acre and the effect on soil health for each crop are given in the following Table.\n\n| Crop       | Profit per Acre | Soil Health Effect |\n|------------|-----------------|--------------------|\n| Wheat      | $300            | Depletes 0.1 units per acre |\n| Corn       | $400            | Depletes 0.2 units per acre |\n| Soybeans   | $250            | Replenishes 0.05 units per acre |\n\nThe farm has a total of 100 acres available for planting. The soil health index must remain above 50. The market demand for Wheat is 50 acres, so the farm can only sell a maximum of 50 acres of Wheat. \n\nPlease help the farm to maximize the total profit while maintaining the soil health index above 50.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0, ub=50)  # acreage of Wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acreage of Corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acreage of Soybeans\n\n# Define objective function\n# For Wheat, the profit per acre is $300, but it depletes the soil at a rate of 0.1 units per acre.\n# For Corn, the profit per acre is $400, and it depletes the soil at a rate of 0.2 units per acre.\n# For Soybeans, the profit per acre is $250, and it replenishes the soil at a rate of 0.05 units per acre.\n# The farm wants to maximize the total profit while maintaining a soil health index above 50.\n# Profit_Wheat = 300 * Wheat - 0.1 * Wheat * Wheat\n# Profit_Corn = 400 * Corn - 0.2 * Corn * Corn\n# Profit_Soybeans = 250 * Soybeans + 0.05 * Soybeans * Soybeans\n# So, the objective function is: Maximize Profit_Wheat + Profit_Corn + Profit_Soybeans\n# Since PySCIPOpt does not support quadratic objective functions directly, we need to linearize the quadratic terms.\n# We introduce new variables and constraints to handle the quadratic terms.\nWheat_squared = model.addVar(name=\"Wheat_squared\")\nCorn_squared = model.addVar(name=\"Corn_squared\")\nSoybeans_squared = model.addVar(name=\"Soybeans_squared\")\nmodel.addCons(Wheat_squared == Wheat * Wheat)\nmodel.addCons(Corn_squared == Corn * Corn)\nmodel.addCons(Soybeans_squared == Soybeans * Soybeans)\n\nProfit_Wheat = 300 * Wheat - 0.1 * Wheat_squared\nProfit_Corn = 400 * Corn - 0.2 * Corn_squared\nProfit_Soybeans = 250 * Soybeans + 0.05 * Soybeans_squared\n\nobj = model.addVar(name=\"obj\")\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n# The total acreage available for planting is 100 acres.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n# The soil health index must remain above 50.\nmodel.addCons(50 <= 100 - (0.1 * Wheat_squared + 0.2 * Corn_squared - 0.05 * Soybeans_squared))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage of Wheat: \", model.getVal(Wheat))\n    print(\"Acreage of Corn: \", model.getVal(Corn))\n    print(\"Acreage of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 895,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. However, the production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant aims to maximize the total profit, which is the difference between the revenue and the production cost.\n// Revenue from A: Revenue_A = 20 * A\n// Revenue from B: Revenue_B = 30 * B\n// Revenue from C: Revenue_C = 40 * C\n// Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\n// Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\n// So, the objective function is: Maximize (Total_Revenue - Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1000 for production costs.\n// 10 * A^0.5 + 15 * B^0.5 + 20 * C^0.5 <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 20 units of product A, 15 units of product B, and 10 units of product C to meet contractual obligations.\n// A >= 20; B >= 15; C >= 10\n\n## Generate Constraint-3:\nThe total production time for all products cannot exceed 100 hours. The production time per unit for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit and the production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | 2 hours                  |\n| B       | $30             | 3 hours                  |\n| C       | $40             | 4 hours                  |\n\nThe production cost per unit increases nonlinearly with the number of units produced due to economies of scale. The production cost function is given by: Cost_A = 10 * A^0.5, Cost_B = 15 * B^0.5, Cost_C = 20 * C^0.5. The plant has a limited budget of $1000 for production costs. The plant must produce at least 20 units of product A, 15 units of product B, and 10 units of product C to meet contractual obligations. The total production time for all products cannot exceed 100 hours. \n\nPlease help the plant to maximize the total profit, which is the difference between the revenue and the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## Revenue from A: Revenue_A = 20 * A\n## Revenue from B: Revenue_B = 30 * B\n## Revenue from C: Revenue_C = 40 * C\n## Total Revenue: Total_Revenue = Revenue_A + Revenue_B + Revenue_C\n## Cost from A: Cost_A = 10 * A^0.5\n## Cost from B: Cost_B = 15 * B^0.5\n## Cost from C: Cost_C = 20 * C^0.5\n## Total Cost: Total_Cost = Cost_A + Cost_B + Cost_C\n## Objective function: Maximize (Total_Revenue - Total_Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 20 * A + 30 * B + 40 * C - (10 * A**0.5 + 15 * B**0.5 + 20 * C**0.5))\n\n# Add constraints\n## The plant has a limited budget of $1000 for production costs.\nmodel.addCons(10 * A**0.5 + 15 * B**0.5 + 20 * C**0.5 <= 1000)\n## The total production time for all products cannot exceed 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1212,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed on flat roofs is 100.\n// Flat <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The company has a budget of $150,000 for the installation. The maximum number of panels that can be installed on flat roofs is 100. Please help the company determine the optimal number of solar panels to install on each type of roof.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0, ub=100) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0) # number of solar panels on green roofs\n\n# Define objective function\nCost = 1000 * Flat + 1200 * Slope + 800 * Green\nmodel.setObjective(Cost, \"minimize\")\n\n# Add constraints\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000) # The total energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000) # The company has a budget of $150,000 for the installation.\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Total Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 870,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit.\nThe profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit.\nThe profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit.\nThe company wants to maximize its net profit, which is the total profit minus the total cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total cost: Cost = 10A + 5B + 3C\n// So, the objective function is: Maximize (Profit - Cost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for production costs.\n// 10A + 5B + 3C <= 5000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 100 units across all products.\n// A + B + C <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 20 units of product A to fulfill a contract.\n// A >= 20\n\n## Generate Constraint-4:\nThe demand for product C is limited, and the company can only sell up to 30 units.\n// C <= 30",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize its profit. The profit per unit of product A is $50, but it requires a complex production process with a cost of $10 per unit. The profit per unit of product B is $70, but it requires a less complex process with a cost of $5 per unit. The profit per unit of product C is $90, but it requires the least complex process with a cost of $3 per unit. The company has a budget of $5000 for production costs. The total production capacity is limited to 100 units across all products. The company must produce at least 20 units of product A to fulfill a contract. The demand for product C is limited, and the company can only sell up to 30 units. Please help the company to maximize its net profit, which is the total profit minus the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=30) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nCost = 10 * A + 5 * B + 3 * C\n## the objective function is: Maximize (Profit - Cost)\nmodel.addCons(obj == Profit - Cost)\n\n# Add constraints\n## The company has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 5 * B + 3 * C <= 5000)\n## The total production capacity is limited to 100 units across all products.\nmodel.addCons(A + B + C <= 100)\n## The company must produce at least 20 units of product A to fulfill a contract.\nmodel.addCons(A >= 20)\n## The demand for product C is limited, and the company can only sell up to 30 units.\nmodel.addCons(C <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 891,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop.\n// {\"area of land for CropA\": \"CropAArea\", \"range\": \"CropAArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropB\": \"CropBArea\", \"range\": \"CropBArea >= 0\", \"type\": \"real\"}\n// {\"area of land for CropC\": \"CropCArea\", \"range\": \"CropCArea >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. \nFor CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. \nFor CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400.\nThe farm wants to maximize the net profit per liter of water used.\n// Profit_CropA = 1000 * CropAArea - 200 * CropAArea\n// Profit_CropB = 1500 * CropBArea - 300 * CropBArea\n// Profit_CropC = 2000 * CropCArea - 400 * CropCArea\n// So, the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / (5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// CropAArea + CropBArea + CropCArea <= 100",
        "question": "A farm is cultivating three types of crops: CropA, CropB, and CropC. They need to determine the area of land to allocate to each crop. For CropA, the profit per hectare is $1000, the water usage per hectare is 5000 liters, and the fertilizer cost per hectare is $200. For CropB, the profit per hectare is $1500, the water usage per hectare is 7000 liters, and the fertilizer cost per hectare is $300. For CropC, the profit per hectare is $2000, the water usage per hectare is 9000 liters, and the fertilizer cost per hectare is $400. The farm has a total of 100 hectares of land available. The farm wants to maximize the net profit per liter of water used. Please help the farm determine the optimal allocation of land to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCropAArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropAArea\", lb=0) # area of land for CropA\nCropBArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropBArea\", lb=0) # area of land for CropB\nCropCArea = model.addVar(vtype=\"CONTINUOUS\", name=\"CropCArea\", lb=0) # area of land for CropC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CropA = (1000 - 200) * CropAArea\nProfit_CropB = (1500 - 300) * CropBArea\nProfit_CropC = (2000 - 400) * CropCArea\nWaterUsage = 5000 * CropAArea + 7000 * CropBArea + 9000 * CropCArea\n## the objective function is: Maximize (Profit_CropA + Profit_CropB + Profit_CropC) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_CropA + Profit_CropB + Profit_CropC)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(CropAArea + CropBArea + CropCArea <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for CropA: \", model.getVal(CropAArea))\n    print(\"Area of land for CropB: \", model.getVal(CropBArea))\n    print(\"Area of land for CropC: \", model.getVal(CropCArea))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce.\n// {\"quantity of Chocolate cake\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"quantity of Vanilla cake\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"quantity of Strawberry cake\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Chocolate cake, the revenue per unit is $30, the production time per unit is 1.5 hours, and the ingredient cost per unit is $10. \nFor Vanilla cake, the revenue per unit is $25, the production time per unit is 1 hour, and the ingredient cost per unit is $8. \nFor Strawberry cake, the revenue per unit is $20, the production time per unit is 0.5 hours, and the ingredient cost per unit is $5.\nThe bakery has a limited production capacity and wants to maximize the profit efficiency (profit per hour of production time).\n// Profit_C = 30 * C - 10 * C\n// Profit_V = 25 * V - 8 * V\n// Profit_S = 20 * S - 5 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / (1.5 * C + 1 * V + 0.5 * S)\n\n## Generate Constraint-1:\nThe bakery has a limited production time of 80 hours.\n// 1.5 * C + 1 * V + 0.5 * S <= 80\n\n## Generate Constraint-2:\nThe bakery has a budget of $2000 for ingredient costs.\n// 10 * C + 8 * V + 5 * S <= 2000\n\n## Generate Constraint-3:\nThe bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce.\n// C + V + S <= 200",
        "question": "A bakery produces three types of cakes: Chocolate, Vanilla, and Strawberry. They need to determine the quantities of each cake to produce. The revenue per unit, production time per unit, and ingredient cost per unit for each cake are given in the following Table.\n\n| Cake Type     | Revenue per Unit | Production Time per Unit | Ingredient Cost per Unit |\n|---------------|------------------|--------------------------|--------------------------|\n| Chocolate     | $30              | 1.5 hours                | $10                      |\n| Vanilla       | $25              | 1 hour                   | $8                       |\n| Strawberry    | $20              | 0.5 hours                | $5                       |\n\nThe bakery has a limited production time of 80 hours. The bakery has a budget of $2000 for ingredient costs. The bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce. \nPlease help the bakery to maximize the profit efficiency (profit per hour of production time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Chocolate cake\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # quantity of Vanilla cake\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # quantity of Strawberry cake\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (30 - 10) * C\nProfit_V = (25 - 8) * V\nProfit_S = (20 - 5) * S\nProductionTime = 1.5 * C + 1 * V + 0.5 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / ProductionTime\n## convert the division to multiplication\nmodel.addCons(obj * ProductionTime == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a limited production time of 80 hours.\nmodel.addCons(1.5 * C + 1 * V + 0.5 * S <= 80)\n## The bakery has a budget of $2000 for ingredient costs.\nmodel.addCons(10 * C + 8 * V + 5 * S <= 2000)\n## The bakery has a production capacity of 200 cakes in terms of the number of cakes it can produce.\nmodel.addCons(C + V + S <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chocolate cake: \", model.getVal(C))\n    print(\"Quantity of Vanilla cake: \", model.getVal(V))\n    print(\"Quantity of Strawberry cake: \", model.getVal(S))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000\n\n## Generate Constraint-2:\nThe total available labor hours are 1000 hours.\n// L <= 1000\n\n## Generate Constraint-3:\nThe total available machine hours are 800 hours.\n// M <= 800",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000, the total available labor hours are 1000 hours, and the total available machine hours are 800 hours. Please help the plant manager to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n## The total available labor hours are 1000 hours.\nmodel.addCons(L <= 1000)\n## The total available machine hours are 800 hours.\nmodel.addCons(M <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 584,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization.\n// {\"acres of wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, but it requires $50 for irrigation and $30 for fertilization.\nThe profit per acre for corn is $300, but it requires $70 for irrigation and $40 for fertilization.\nThe profit per acre for soybeans is $150, but it requires $30 for irrigation and $20 for fertilization.\nThe farmer wants to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n// Total profit for wheat: Profit_Wheat = 200 * WheatAcres\n// Total cost for wheat: Cost_Wheat = (50 + 30) * WheatAcres\n// Total profit for corn: Profit_Corn = 300 * CornAcres\n// Total cost for corn: Cost_Corn = (70 + 40) * CornAcres\n// Total profit for soybeans: Profit_Soybeans = 150 * SoybeansAcres\n// Total cost for soybeans: Cost_Soybeans = (30 + 20) * SoybeansAcres\n// So, the objective function is: Maximize (Profit_Wheat - Cost_Wheat) + (Profit_Corn - Cost_Corn) + (Profit_Soybeans - Cost_Soybeans)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of his land with soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-3:\nThe farmer has a budget of $5000 for fertilization.\n// 30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000",
        "question": "A farmer is planning to plant three types of crops: wheat, corn, and soybeans. He needs to decide how many acres to allocate to each crop to optimize his profit while considering the costs of irrigation and fertilization. The profit per acre and the costs for each crop are given in the following Table.\n\n| Crop         | Profit per Acre | Irrigation Cost per Acre | Fertilization Cost per Acre |\n|--------------|-----------------|--------------------------|----------------------------|\n| Wheat        | $200            | $50                      | $30                        |\n| Corn         | $300            | $70                      | $40                        |\n| Soybeans     | $150            | $30                      | $20                        |\n\nThe farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of his land with soybeans. The farmer has a budget of $5000 for fertilization. \n\nPlease help the farmer to maximize his net profit, which is the total profit minus the total costs of irrigation and fertilization.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # acres of wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # acres of corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # acres of soybeans\n\n# Define objective function\n## Total profit and cost for each crop\nProfit_Wheat = 200 * WheatAcres\nCost_Wheat = (50 + 30) * WheatAcres\nProfit_Corn = 300 * CornAcres\nCost_Corn = (70 + 40) * CornAcres\nProfit_Soybeans = 150 * SoybeansAcres\nCost_Soybeans = (30 + 20) * SoybeansAcres\n## Net profit for each crop\nNet_Profit_Wheat = Profit_Wheat - Cost_Wheat\nNet_Profit_Corn = Profit_Corn - Cost_Corn\nNet_Profit_Soybeans = Profit_Soybeans - Cost_Soybeans\n## Objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Net_Profit_Wheat + Net_Profit_Corn + Net_Profit_Soybeans)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of his land with soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n## The farmer has a budget of $5000 for fertilization.\nmodel.addCons(30 * WheatAcres + 40 * CornAcres + 20 * SoybeansAcres <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(WheatAcres))\n    print(\"Acres of Corn: \", model.getVal(CornAcres))\n    print(\"Acres of Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1093,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop.\n// {\"number of acres for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"number of acres for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of acres for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted. The risk function is R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost.\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from soybeans: Profit_S = 150 * S\n// Risk cost: Risk = 0.01 * (W^2 + C^2 + S^2)\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk) = Maximize (200W + 300C + 150S - 0.01(W^2 + C^2 + S^2))\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// W + C + S <= 100",
        "question": "A farmer is planning to plant three different crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also needs to consider the risk of crop failure, which is modeled as a quadratic function of the number of acres planted, with the risk function R = 0.01 * (W^2 + C^2 + S^2). The farmer aims to maximize the net profit, which is the total profit minus the risk cost. The farmer has a total of 100 acres available for planting. Please help the farmer to maximize the net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # number of acres for wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of acres for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_S = 150 * S\nRisk = 0.01 * (W**2 + C**2 + S**2)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S - Risk)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_S - Risk)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(W))\n    print(\"Number of Acres for Corn: \", model.getVal(C))\n    print(\"Number of Acres for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 618,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\n// Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\n// Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit. The company has a total production capacity of 500 units. Please help the company determine the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0) # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0) # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAProduction == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBProduction == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCProduction == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 90 * DeviceC1 * DeviceC_b1 + (90 - 0.02 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 730,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type to maximize profit.\n// {\"hours allocated to product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product type varies and is influenced by market demand and production efficiency. \nFor product 1, the profit per hour is 100 - 5 * H1. \nFor product 2, the profit per hour is 150 - 10 * H2. \nFor product 3, the profit per hour is 200 - 15 * H3.\nThe company aims to maximize the total daily profit from all three products.\n// The objective function is: Maximize (100 - 5 * H1) * H1 + (150 - 10 * H2) * H2 + (200 - 15 * H3) * H3\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H1 + H2 + H3 <= 8",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type to maximize profit. The profit per hour for each product type varies and is influenced by market demand and production efficiency. For product 1, the profit per hour is 100 - 5 * H1. For product 2, the profit per hour is 150 - 10 * H2. For product 3, the profit per hour is 200 - 15 * H3. The company aims to maximize the total daily profit from all three products. The total available hours for production in a day is 8 hours. Please help the company determine the optimal allocation of hours to each product type.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours allocated to product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours allocated to product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours allocated to product 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (100 - 5 * H1) * H1 + (150 - 10 * H2) * H2 + (200 - 15 * H3) * H3\nmodel.addCons(obj == (100 - 5 * H1) * H1 + (150 - 10 * H2) * H2 + (200 - 15 * H3) * H3)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H1 + H2 + H3 <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to product 1: \", model.getVal(H1))\n    print(\"Hours allocated to product 2: \", model.getVal(H2))\n    print(\"Hours allocated to product 3: \", model.getVal(H3))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 685,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n// Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n// Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost. The production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products. The total production rate for all products must not exceed 100 units per hour. The investment in automation cannot exceed $50,000. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n## Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n## Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\nProfit1 = (150 - (100 - 0.0005 * Automation)) * P1\nProfit2 = (200 - (100 - 0.0005 * Automation)) * P2\nProfit3 = (250 - (100 - 0.0005 * Automation)) * P3\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total production rate for all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 773,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators.\n// {\"number of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"number of hydroelectric generators\": \"Hydro\", \"range\": \"Hydro >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year.\nThe cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year.\nThe cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year.\nThe company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n// Total installation cost: Install_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\n// Total annual maintenance cost: Maintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\n// Total annual energy output: Energy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n// So, the objective function is: Minimize (Install_Cost + Maintenance_Cost) / Energy_Output\n\n## Generate Constraint-1:\nThe company has a budget of $200,000 for the installation of all systems.\n// 2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000\n\n## Generate Constraint-2:\nThe total annual energy output must be at least 100,000 kWh.\n// 1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on each type of system.\n// 2000 * Solar >= 0.20 * 200000\n// 5000 * Wind >= 0.20 * 200000\n// 10000 * Hydro >= 0.20 * 200000\n\n## Generate Constraint-4:\nThe number of wind turbines must not exceed twice the number of solar panels.\n// Wind <= 2 * Solar\n\n## Generate Constraint-5:\nThe number of hydroelectric generators must be at least half the number of wind turbines.\n// Hydro >= 0.5 * Wind",
        "question": "A company is planning to optimize its energy consumption by installing three types of renewable energy systems: solar panels, wind turbines, and hydroelectric generators. The cost of installing each solar panel is $2000, with an estimated annual energy output of 1000 kWh and a maintenance cost of $50 per year. The cost of installing each wind turbine is $5000, with an estimated annual energy output of 2500 kWh and a maintenance cost of $100 per year. The cost of installing each hydroelectric generator is $10000, with an estimated annual energy output of 5000 kWh and a maintenance cost of $200 per year. The company wants to minimize the total cost of installation and maintenance per unit of energy produced.\n\nThe company has a budget of $200,000 for the installation of all systems. The total annual energy output must be at least 100,000 kWh. The company wants to ensure that at least 20% of the budget is spent on each type of system. The number of wind turbines must not exceed twice the number of solar panels. The number of hydroelectric generators must be at least half the number of wind turbines.\n\nPlease help the company determine the optimal number of solar panels, wind turbines, and hydroelectric generators to install.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0)  # number of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0)  # number of wind turbines\nHydro = model.addVar(vtype=\"INTEGER\", name=\"Hydro\", lb=0)  # number of hydroelectric generators\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nInstall_Cost = 2000 * Solar + 5000 * Wind + 10000 * Hydro\nMaintenance_Cost = 50 * Solar + 100 * Wind + 200 * Hydro\nEnergy_Output = 1000 * Solar + 2500 * Wind + 5000 * Hydro\n## convert the division to multiplication\nmodel.addCons(obj * Energy_Output == Install_Cost + Maintenance_Cost)\n\n# Add constraints\n## The company has a budget of $200,000 for the installation of all systems.\nmodel.addCons(2000 * Solar + 5000 * Wind + 10000 * Hydro <= 200000)\n## The total annual energy output must be at least 100,000 kWh.\nmodel.addCons(1000 * Solar + 2500 * Wind + 5000 * Hydro >= 100000)\n## The company wants to ensure that at least 20% of the budget is spent on each type of system.\nmodel.addCons(2000 * Solar >= 0.20 * 200000)\nmodel.addCons(5000 * Wind >= 0.20 * 200000)\nmodel.addCons(10000 * Hydro >= 0.20 * 200000)\n## The number of wind turbines must not exceed twice the number of solar panels.\nmodel.addCons(Wind <= 2 * Solar)\n## The number of hydroelectric generators must be at least half the number of wind turbines.\nmodel.addCons(Hydro >= 0.5 * Wind)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels: \", model.getVal(Solar))\n    print(\"Number of Wind Turbines: \", model.getVal(Wind))\n    print(\"Number of Hydroelectric Generators: \", model.getVal(Hydro))\n    print(\"Minimized Cost per Unit of Energy: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1239,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three different crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach acre of crop A yields a profit of $500 but requires 2 units of water and 3 units of fertilizer. \nEach acre of crop B yields a profit of $700 but requires 4 units of water and 2 units of fertilizer. \nEach acre of crop C yields a profit of $600 but requires 3 units of water and 4 units of fertilizer. \nThe farm aims to maximize its total profit while considering the efficiency of resource usage (defined as the total profit divided by the total resource usage).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 600 * C\n// Resource usage for water: Water_usage = 2 * A + 4 * B + 3 * C\n// Resource usage for fertilizer: Fertilizer_usage = 3 * A + 2 * B + 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_usage + Fertilizer_usage)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available.\n// 2 * A + 4 * B + 3 * C <= 100",
        "question": "A farm is planning to cultivate three different crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit, water requirements, and fertilizer requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required | Fertilizer Required |\n|------|-----------------|----------------|---------------------|\n| A    | $500            | 2 units        | 3 units             |\n| B    | $700            | 4 units        | 2 units             |\n| C    | $600            | 3 units        | 4 units             |\n\nThe farm has a total of 100 units of water available. The farm aims to maximize its total profit while considering the efficiency of resource usage (defined as the total profit divided by the total resource usage). Please help the farm determine the optimal number of acres to allocate to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 600 * C\nWater_usage = 2 * A + 4 * B + 3 * C\nFertilizer_usage = 3 * A + 2 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_usage + Fertilizer_usage)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_usage + Fertilizer_usage) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available.\nmodel.addCons(2 * A + 4 * B + 3 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"amount of overtime hours\": \"Overtime\", \"range\": \"Overtime >= 0\", \"type\": \"continuous\"}\n// {\"investment in automation technology\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from all units produced.\n// Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a maximum capacity of 10,000 units that can be produced in the quarter.\n// Units <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce, the amount of overtime hours to utilize, and the level of investment in automation technology to enhance production efficiency. The production cost per unit decreases by $5 for every $10,000 invested in automation technology. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from all units produced. The company has a maximum capacity of 10,000 units that can be produced in the quarter. The total investment in automation technology cannot exceed $50,000.\nPlease help the company to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\", lb=0)  # amount of overtime hours\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # investment in automation technology\n\n# Define objective function\n## Total profit from units: Profit = (150 - 100 + 0.0005 * Automation) * Units\nProfit = (150 - 100 + 0.0005 * Automation) * Units\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a maximum capacity of 10,000 units that can be produced in the quarter.\nmodel.addCons(Units <= 10000)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units to Produce: \", model.getVal(Units))\n    print(\"Amount of Overtime Hours: \", model.getVal(Overtime))\n    print(\"Investment in Automation Technology: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 729,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it incurs a storage cost of $5 per unit per month.\nThe profit per unit of product B is $70, but it incurs a storage cost of $7 per unit per month.\nThe profit per unit of product C is $90, but it incurs a storage cost of $9 per unit per month.\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50A + 70B + 90C\n// Total storage cost: Storage = 5A + 7B + 9C\n// So, the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $10,000.\n// 50A + 70B + 90C <= 10000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 200 units across all products.\n// A + B + C <= 200\n\n## Generate Constraint-3:\nThe demand for product A must be met, which is at least 100 units.\n// A >= 100\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 30% of the total production is of product B.\n// B >= 0.3 * (A + B + C)\n\n## Generate Constraint-5:\nThe production of product C should not exceed 50% of the total production.\n// C <= 0.5 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering the cost of production and storage. The profit per unit and the storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Storage Cost per Unit |\n|---------|-----------------|-----------------------|\n| A       | $50             | $5                    |\n| B       | $70             | $7                    |\n| C       | $90             | $9                    |\n\nThe company aims to maximize the net profit, which is the total profit minus the total storage cost. The total production cost for all products must not exceed $10,000. The company has a storage capacity limit of 200 units across all products. The demand for product A must be met, which is at least 100 units. The company wants to ensure that at least 30% of the total production is of product B. The production of product C should not exceed 50% of the total production.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=100) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 90 * C\nStorage = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit - Storage) = Maximize (45A + 63B + 81C)\nmodel.addCons(obj == 45 * A + 63 * B + 81 * C)\n\n# Add constraints\n## The total production cost for all products must not exceed $10,000.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n## The company has a storage capacity limit of 200 units across all products.\nmodel.addCons(A + B + C <= 200)\n## The demand for product A must be met, which is at least 100 units.\nmodel.addCons(A >= 100)\n## The company wants to ensure that at least 30% of the total production is of product B.\nmodel.addCons(B >= 0.3 * (A + B + C))\n## The production of product C should not exceed 50% of the total production.\nmodel.addCons(C <= 0.5 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1196,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, corn is $15, and barley is $12. The farmer's goal is to maximize his total profit. However, the yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n// Profit_W = 10 * W * (1 + 0.005 * water_W)\n// Profit_C = 15 * C * (1 + 0.007 * water_C)\n// Profit_B = 12 * B * (1 + 0.006 * water_B)\n// Total_water = water_W + water_C + water_B = 500\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total water used for all crops cannot exceed 500 units.\n// water_W + water_C + water_B <= 500\n\n## Generate Constraint-2:\nThe farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit.\n// 2 * W + 3 * C + 2.5 * B <= 1000\n\n## Generate Constraint-3:\nThe market demand for wheat is limited to 100 units.\n// W <= 100\n\n## Generate Constraint-4:\nThe farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units.\n// W + C + B <= 200\n\n## Generate Constraint-5:\nThe soil fertility for corn is limited, and the farmer can only plant up to 50 units of corn.\n// C <= 50",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability. The profit per unit of wheat is $10, corn is $15, and barley is $12. The yield of each crop depends on the amount of water used, which is limited to 500 units. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit. The market demand for wheat is limited to 100 units. The farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units. The soil fertility for corn is limited, and the farmer can only plant up to 50 units of corn. Please help the farmer to maximize his total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of barley\nwater_W = model.addVar(vtype=\"CONTINUOUS\", name=\"water_W\", lb=0) # water for wheat\nwater_C = model.addVar(vtype=\"CONTINUOUS\", name=\"water_C\", lb=0) # water for corn\nwater_B = model.addVar(vtype=\"CONTINUOUS\", name=\"water_B\", lb=0) # water for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 10 * W * (1 + 0.005 * water_W)\nProfit_C = 15 * C * (1 + 0.007 * water_C)\nProfit_B = 12 * B * (1 + 0.006 * water_B)\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total water used for all crops cannot exceed 500 units.\nmodel.addCons(water_W + water_C + water_B <= 500)\n## The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours.\nmodel.addCons(2 * W + 3 * C + 2.5 * B <= 1000)\n## The market demand for wheat is limited to 100 units.\nmodel.addCons(W <= 100)\n## The farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units.\nmodel.addCons(W + C + B <= 200)\n## The soil fertility for corn is limited, and the farmer can only plant up to 50 units of corn.\nmodel.addCons(C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1019,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor.\n// {\"amount of land for C1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. \nEach unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. \nEach unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor.\nThe farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n// Profit_C1 = 100 * L1\n// Profit_C2 = 150 * L2\n// Profit_C3 = 200 * L3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of land available.\n// L1 + L2 + L3 <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 200 units of water available.\n// 2 * L1 + 3 * L2 + 4 * L3 <= 200",
        "question": "A farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor. Each unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. Each unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. Each unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor. The farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource). The farm has a total of 100 units of land available and a total of 200 units of water available.\nPlease help the farm determine the optimal allocation of land for each crop to maximize the total profit while considering the efficiency of resource use.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # amount of land for C1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # amount of land for C2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # amount of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * L1\nProfit_C2 = 150 * L2\nProfit_C3 = 200 * L3\nResource_Use = 2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / Resource_Use\n## convert the division to multiplication\nmodel.addCons(obj * Resource_Use == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 units of land available.\nmodel.addCons(L1 + L2 + L3 <= 100)\n## The farm has a total of 200 units of water available.\nmodel.addCons(2 * L1 + 3 * L2 + 4 * L3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for C1: \", model.getVal(L1))\n    print(\"Amount of Land for C2: \", model.getVal(L2))\n    print(\"Amount of Land for C3: \", model.getVal(L3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 846,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products.\n// Total profit for product A: ProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\n// Total profit for product B: ProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\n// Total profit for product C: ProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for investment in energy efficiency.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 10,000 units.\n// PA + PB + PC <= 10000\n\n## Generate Constraint-3:\nThe production of product A must be at least 2,000 units.\n// PA >= 2000\n\n## Generate Constraint-4:\nThe production of product B must not exceed 3,000 units.\n// PB <= 3000\n\n## Generate Constraint-5:\nThe production of product C must be at least twice the production of product A.\n// PC >= 2 * PA",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new energy-efficient technology that reduces the production cost per unit. The production cost per unit of each product decreases by $2 for every $10,000 invested in energy efficiency. The initial production cost per unit for product A is $50, for product B is $60, and for product C is $70. The selling price per unit for product A is $80, for product B is $90, and for product C is $100. The company aims to maximize the total profit from all products. The company has a budget of $50,000 for investment in energy efficiency. The total production capacity for all products is limited to 10,000 units. The production of product A must be at least 2,000 units. The production of product B must not exceed 3,000 units. The production of product C must be at least twice the production of product A. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=2000) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0, ub=3000) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0) # investment in energy efficiency\n\n# Define objective function\nProfitA = (80 - 50 + 0.0002 * EnergyEfficiency) * PA\nProfitB = (90 - 60 + 0.0002 * EnergyEfficiency) * PB\nProfitC = (100 - 70 + 0.0002 * EnergyEfficiency) * PC\n# So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\n# The company has a budget of $50,000 for investment in energy efficiency.\nmodel.addCons(EnergyEfficiency <= 50000)\n# The total production capacity for all products is limited to 10,000 units.\nmodel.addCons(PA + PB + PC <= 10000)\n# The production of product A must be at least 2,000 units.\nmodel.addCons(PA >= 2000)\n# The production of product B must not exceed 3,000 units.\nmodel.addCons(PB <= 3000)\n# The production of product C must be at least twice the production of product A.\nmodel.addCons(PC >= 2 * PA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1049,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products (Product 1, Product 2, and Product 3) and the level of automation to implement in the production process. The profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products. The company has a total production capacity of 10,000 units across all products, and the total investment in automation cannot exceed $50,000.\n\nPlease help the company to determine the optimal production quantities for each product and the appropriate level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=0) # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0) # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0) # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nmodel.addCons(obj == (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3)\n\n# Add constraints\n## The company has a total production capacity of 10,000 units across all products.\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 853,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of component A requires 2 hours of labor and yields a profit of $10. \nEach unit of component B requires 3 hours of labor and yields a profit of $15. \nEach unit of component C requires 4 hours of labor and yields a profit of $20.\nThe plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 10 * A\n// Profit from B: Profit_B = 15 * B\n// Profit from C: Profit_C = 20 * C\n// Labor hours for A: Labor_A = 2 * A\n// Labor hours for B: Labor_B = 3 * B\n// Labor hours for C: Labor_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n\n## Generate Constraint-1:\nThe plant has a daily labor budget of 100 hours.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe plant must produce at least 5 units of each component daily.\n// A >= 5; B >= 5; C >= 5",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency and profit. Each unit of component A requires 2 hours of labor and yields a profit of $10. Each unit of component B requires 3 hours of labor and yields a profit of $15. Each unit of component C requires 4 hours of labor and yields a profit of $20. The plant aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours). The plant has a daily labor budget of 100 hours. The plant must produce at least 5 units of each component daily. Please help the plant determine the optimal number of each component to produce daily.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 5 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 15 * B\nProfit_C = 20 * C\nLabor_A = 2 * A\nLabor_B = 3 * B\nLabor_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Labor_A + Labor_B + Labor_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Labor_A + Labor_B + Labor_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a daily labor budget of 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 743,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $20, for B is $30, and for C is $40. The selling price for A is $50, for B is $60, and for C is $70. The plant has a limited production capacity and aims to maximize the profit per unit of production capacity used.\n// Profit for A: Profit_A = (50 - 20) * A\n// Profit for B: Profit_B = (60 - 30) * B\n// Profit for C: Profit_C = (70 - 40) * C\n// Production capacity used for A: Cap_A = A\n// Production capacity used for B: Cap_B = 2 * B\n// Production capacity used for C: Cap_C = 3 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n\n## Generate Constraint-1:\nThe total production cost must not exceed $10,000.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of component A and 30 units of component B.\n// A >= 50; B >= 30\n\n## Generate Constraint-3:\nThe total production capacity used must not exceed 500 units.\n// A + 2 * B + 3 * C <= 500",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency and profit. The production cost, selling price, and production capacity for each component are given in the following Table.\n\n| Component | Production Cost | Selling Price | Production Capacity |\n|-----------|-----------------|---------------|---------------------|\n| A         | $20             | $50           | 1 unit              |\n| B         | $30             | $60           | 2 units             |\n| C         | $40             | $70           | 3 units             |\n\nThe total production cost must not exceed $10,000. The plant must produce at least 50 units of component A and 30 units of component B. The total production capacity used must not exceed 500 units. \nPlease help the plant to maximize the profit per unit of production capacity used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of component A and 30 units of component B.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 20) * A\nProfit_B = (60 - 30) * B\nProfit_C = (70 - 40) * C\nCap_A = A\nCap_B = 2 * B\nCap_C = 3 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Cap_A + Cap_B + Cap_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Cap_A + Cap_B + Cap_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total production cost must not exceed $10,000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The total production capacity used must not exceed 500 units.\nmodel.addCons(A + 2 * B + 3 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A has a revenue per unit of $100, and Product B has a revenue per unit of $150. The cost of production per unit of Product A decreases by $2 for every unit increase in Automation, and the cost of production per unit of Product B decreases by $3 for every unit increase in Automation. The initial cost of production per unit for Product A is $60, and for Product B is $80. The company aims to maximize the total profit from both products.\n// Profit_A = (100 - (60 - 2 * Automation)) * ProductA\n// Profit_B = (150 - (80 - 3 * Automation)) * ProductB\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for both products combined.\n// ProductA + ProductB <= 500\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $10,000.\n// Automation <= 10000\n\n## Generate Constraint-3:\nThe minimum production quantity for Product A must be at least 10 units.\n// ProductA >= 10\n\n## Generate Constraint-4:\nThe market demand for Product B is limited to 200 units.\n// ProductB <= 200",
        "question": "A manufacturing company produces two types of products: A and B. They need to determine the production quantities of each product and the level of automation to implement in the production process. The level of automation affects the production cost and efficiency. The revenue per unit for Product A is $100, and for Product B is $150. The initial cost of production per unit for Product A is $60, and for Product B is $80. The cost of production per unit decreases by $2 for Product A and by $3 for Product B for every unit increase in Automation.\n\n| Product | Revenue per Unit | Initial Cost per Unit | Cost Reduction per Unit Increase in Automation |\n|---------|------------------|-----------------------|-----------------------------------------------|\n| A       | 100$             | 60$                   | 2$                                            |\n| B       | 150$             | 80$                   | 3$                                            |\n\nThe company has a total production capacity of 500 units for both products combined. The investment in automation cannot exceed $10,000. The minimum production quantity for Product A must be at least 10 units. The market demand for Product B is limited to 200 units.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=10)  # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0, ub=200)  # quantity of product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit_A = (100 - (60 - 2 * Automation)) * ProductA\nProfit_B = (150 - (80 - 3 * Automation)) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 500)\nmodel.addCons(Automation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1305,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from the crops. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used.\n// Profit_W = 200 * W - 10 * 2 * W\n// Profit_C = 300 * C - 10 * 3 * C\n// Profit_S = 250 * S - 10 * 2.5 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (2 * W + 3 * C + 2.5 * S)\n\n## Generate Constraint-1:\nThe total available land is 50 acres.\n// W + C + S <= 50\n\n## Generate Constraint-2:\nThe farmer has a budget of $1000 for water costs.\n// 2 * W + 3 * C + 2.5 * S <= 1000 / 10\n\n## Generate Constraint-3:\nThe market demand for wheat is 10 acres. So, the farmer can only plant a maximum of 10 acres of wheat.\n// W <= 10\n\n## Generate Constraint-4:\nThe farmer must plant at least 5 acres of soybeans to maintain soil health.\n// S >= 5",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. He needs to determine the area of land to allocate to each crop. The profit per acre for wheat is $200, for corn is $300, and for soybeans is $250. However, the farmer also needs to consider the water usage for each crop, which affects the overall cost. Wheat requires 2 units of water per acre, corn requires 3 units, and soybeans require 2.5 units. The cost of water per unit is $10. The farmer wants to maximize the net profit per unit of water used. The total available land is 50 acres. The farmer has a budget of $1000 for water costs. The market demand for wheat is 10 acres. So, the farmer can only plant a maximum of 10 acres of wheat. The farmer must plant at least 5 acres of soybeans to maintain soil health. Please help the farmer to maximize his total profit from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # area of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W - 10 * 2 * W\nProfit_C = 300 * C - 10 * 3 * C\nProfit_S = 250 * S - 10 * 2.5 * S\nWaterUsage = 2 * W + 3 * C + 2.5 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The total available land is 50 acres.\nmodel.addCons(W + C + S <= 50)\n## The farmer has a budget of $1000 for water costs.\nmodel.addCons(2 * W + 3 * C + 2.5 * S <= 1000 / 10)\n## The market demand for wheat is 10 acres. So, the farmer can only plant a maximum of 10 acres of wheat.\nmodel.addCons(W <= 10)\n## The farmer must plant at least 5 acres of soybeans to maintain soil health.\nmodel.addCons(S >= 5)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 852,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand.\n// {\"production rate of product 1\": \"P1\", \"range\": \"0 <= P1 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"0 <= P2 <= 100\", \"type\": \"real\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"0 <= P3 <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for product 1 is $5, for product 2 is $10, and for product 3 is $15. The production cost per unit increases nonlinearly with the production rate due to economies of scale. The cost function for each product is given by: Cost = a * P^2 + b * P + c, where a, b, and c are constants. The objective is to maximize the total profit, which is the difference between the revenue and the cost.\n// The cost for product 1: C1 = 0.01 * P1^2 + 0.5 * P1 + 2\n// The cost for product 2: C2 = 0.02 * P2^2 + 0.8 * P2 + 3\n// The cost for product 3: C3 = 0.03 * P3^2 + 1.0 * P3 + 4\n// The objective function is: Maximize (5 * P1 + 10 * P2 + 15 * P3) - (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe total production rate cannot exceed 200 units per day.\n// P1 + P2 + P3 <= 200\n\n## Generate Constraint-2:\nThe market demand for product 1 is at least 50 units per day.\n// P1 >= 50\n\n## Generate Constraint-3:\nThe production line can handle a maximum of 120 units of product 2 per day.\n// P2 <= 120\n\n## Generate Constraint-4:\nThe company has a policy to produce at least 30 units of product 3 per day to maintain brand presence.\n// P3 >= 30",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate for each product to maximize profit while considering the limited resources and market demand. The profit per unit for each product and the cost function for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost Function |\n|---------|-----------------|---------------|\n| 1       | $5              | C1 = 0.01 * P1^2 + 0.5 * P1 + 2 |\n| 2       | $10             | C2 = 0.02 * P2^2 + 0.8 * P2 + 3 |\n| 3       | $15             | C3 = 0.03 * P3^2 + 1.0 * P3 + 4 |\n\nThe total production rate cannot exceed 200 units per day. The market demand for product 1 is at least 50 units per day. The production line can handle a maximum of 120 units of product 2 per day. The company has a policy to produce at least 30 units of product 3 per day to maintain brand presence.\n\nPlease help the company to maximize the total profit, which is the difference between the revenue and the cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0, ub=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0, ub=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0, ub=100) # production rate of product 3\n\n# Define objective function\nC1 = 0.01 * P1**2 + 0.5 * P1 + 2\nC2 = 0.02 * P2**2 + 0.8 * P2 + 3\nC3 = 0.03 * P3**2 + 1.0 * P3 + 4\nProfit = 5 * P1 + 10 * P2 + 15 * P3 - (C1 + C2 + C3)\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 <= 200) # total production rate cannot exceed 200 units per day\nmodel.addCons(P1 >= 50) # market demand for product 1 is at least 50 units per day\nmodel.addCons(P2 <= 120) # production line can handle a maximum of 120 units of product 2 per day\nmodel.addCons(P3 >= 30) # company policy to produce at least 30 units of product 3 per day\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1043,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the cost of raw materials decreases as production increases. For each product, if production exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The company aims to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\n// Cost_A = max(8 - 0.02 * (A - 100), 8) * A\n// Cost_B = max(12 - 0.02 * (B - 100), 12) * B\n// Cost_C = max(16 - 0.02 * (C - 100), 16) * C\n// Profit_A = (10 - Cost_A) * A\n// Profit_B = (15 - Cost_B) * B\n// Profit_C = (20 - Cost_C) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg.\n// 5 * A + 7 * B + 9 * C <= 5000\n\n## Generate Constraint-2:\nThe market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units.\n// A <= 300; B <= 250; C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and production capacity. The profit per unit of Product A is $10, for Product B is $15, and for Product C is $20. Due to economies of scale, the cost of raw materials decreases as production increases. For each product, if production exceeds 100 units, the cost per unit decreases by $0.02 for each additional unit produced. The company aims to maximize the total profit, which is the difference between the revenue and the cost of raw materials.\n\n| Product | Profit per Unit | Raw Material Cost per Unit (if production > 100) | Raw Material Cost per Unit (if production <= 100) |\n|---------|-----------------|-------------------------------------------------|-------------------------------------------------|\n| A       | 10$             | 8 - 0.02 * (A - 100)                             | 8$                                              |\n| B       | 15$             | 12 - 0.02 * (B - 100)                            | 12$                                             |\n| C       | 20$             | 16 - 0.02 * (C - 100)                            | 16$                                             |\n\nThe company has a limited supply of raw materials. For Product A, 5 kg of raw materials are required per unit. For Product B, 7 kg are required per unit. For Product C, 9 kg are required per unit. The total available raw materials are 5000 kg. The market has a demand limit for each product. For Product A, the demand limit is 300 units. For Product B, the demand limit is 250 units. For Product C, the demand limit is 200 units.\n\nPlease help the company to determine the optimal production quantities of products A, B, and C to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of Product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # quantity of Product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(8 - 0.02 * (A - 100), 8) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 8 * A1 * A_b1 + (8 - 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(12 - 0.02 * (B - 100), 12) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 12 * B1 * B_b1 + (12 - 0.02 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(16 - 0.02 * (C - 100), 16) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 16 * C1 * C_b1 + (16 - 0.02 * (C2 - 100)) * C2 * C_b2\n## calculate profits\nProfit_A = (10 - Cost_A) * A\nProfit_B = (15 - Cost_B) * B\nProfit_C = (20 - Cost_C) * C\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit.\n// {\"number of workers on production unit 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production unit 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in production unit 1 can produce 10 units of component A, 15 units of component B, and 20 units of component C per hour. In production unit 2, each worker can produce 12 units of component A, 18 units of component B, and 22 units of component C per hour. In production unit 3, each worker can produce 14 units of component A, 20 units of component B, and 24 units of component C per hour. The company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. The objective is to minimize the total production time to meet these demands.\n// The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n// The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n// The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 50 workers available.\n// W1 + W2 + W3 <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company has three production units, each capable of producing these components. The manager needs to decide how many workers to allocate to each production unit. The productivity of each worker in each production unit is given in the following Table.\n\n| Production Unit | Component A | Component B | Component C |\n|-----------------|-------------|-------------|-------------|\n| 1               | 10 units/hr | 15 units/hr | 20 units/hr |\n| 2               | 12 units/hr | 18 units/hr | 22 units/hr |\n| 3               | 14 units/hr | 20 units/hr | 24 units/hr |\n\nThe company needs to meet a demand of at least 1000 units of component A, 1500 units of component B, and 2000 units of component C. There are a total of 50 workers available. The objective is to minimize the total production time to meet these demands. Please help the manager determine the optimal allocation of workers to each production unit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on production unit 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on production unit 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on production unit 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The production time for component A: T1 = 1000 / (10 * W1 + 12 * W2 + 14 * W3)\n## The production time for component B: T2 = 1500 / (15 * W1 + 18 * W2 + 20 * W3)\n## The production time for component C: T3 = 2000 / (20 * W1 + 22 * W2 + 24 * W3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication and set the objective as the maximum of T1, T2, T3\nT1 = model.addVar('T1')\nT2 = model.addVar('T2')\nT3 = model.addVar('T3')\nmodel.addCons(T1 * (10 * W1 + 12 * W2 + 14 * W3) == 1000)\nmodel.addCons(T2 * (15 * W1 + 18 * W2 + 20 * W3) == 1500)\nmodel.addCons(T3 * (20 * W1 + 22 * W2 + 24 * W3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Unit 1: \", model.getVal(W1))\n    print(\"Number of Workers on Production Unit 2: \", model.getVal(W2))\n    print(\"Number of Workers on Production Unit 3: \", model.getVal(W3))\n    print(\"Minimum Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 996,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand.\n// {\"quantity of Phone\": \"P\", \"range\": \"P >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablet\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptop\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for Phone is $100, for Tablet is $150, and for Laptop is $200. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the total profit, which is the revenue minus the cost.\n// Revenue_Phone = 100 * P\n// Cost_Phone = max(50 - 0.5 * (P - 100), 50) * P\n// Revenue_Tablet = 150 * T\n// Cost_Tablet = max(75 - 0.5 * (T - 100), 75) * T\n// Revenue_Laptop = 200 * L\n// Cost_Laptop = max(100 - 0.5 * (L - 100), 100) * L\n// So, the objective function is: Maximize (Revenue_Phone - Cost_Phone) + (Revenue_Tablet - Cost_Tablet) + (Revenue_Laptop - Cost_Laptop)\n\n## Generate Constraint-1:\nThe manufacturer has a limited budget for production. The cost of producing a Phone is $50 per unit, a Tablet is $75 per unit, and a Laptop is $100 per unit. The total budget for production is $10,000.\n// 50 * P + 75 * T + 100 * L <= 10000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. The demand for Phone is at most 500 units, for Tablet is at most 400 units, and for Laptop is at most 300 units.\n// P <= 500; T <= 400; L <= 300\n\n## Generate Constraint-3:\nThe manufacturer has a production capacity limit of 1000 units in total.\n// P + T + L <= 1000",
        "question": "A manufacturer produces three types of electronic devices: Phone, Tablet, and Laptop. They need to determine the production quantities of each device to maximize profit while considering the cost of production and market demand. The profit per unit for Phone is $100, for Tablet is $150, and for Laptop is $200. However, due to economies of scale, the cost of production decreases as the production quantity increases. For each type of device, if the production exceeds 100 units, the cost per unit decreases by $0.5 for each additional unit produced. The manufacturer wants to maximize the total profit, which is the revenue minus the cost.\n\n| Device  | Profit per Unit | Cost per Unit (up to 100 units) | Cost per Unit (over 100 units) |\n|---------|-----------------|---------------------------------|-------------------------------|\n| Phone   | $100            | $50                             | $50 - $0.5 * (P - 100)        |\n| Tablet  | $150            | $75                             | $75 - $0.5 * (T - 100)        |\n| Laptop  | $200            | $100                            | $100 - $0.5 * (L - 100)       |\n\nThe manufacturer has a limited budget for production. The cost of producing a Phone is $50 per unit, a Tablet is $75 per unit, and a Laptop is $100 per unit. The total budget for production is $10,000. The market has a demand limit for each device. The demand for Phone is at most 500 units, for Tablet is at most 400 units, and for Laptop is at most 300 units. The manufacturer also has a production capacity limit of 1000 units in total.\n\nPlease help the manufacturer to maximize the total profit by determining the optimal production quantities for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP = model.addVar(vtype=\"INTEGER\", name=\"P\", lb=0, ub=500) # quantity of Phone\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # quantity of Tablet\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # quantity of Laptop\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_Phone = max(50 - 0.5 * (P - 100), 50) * P\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=100)\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=100, ub=500)\nP_b1 = model.addVar(vtype=\"B\", name=\"P_b1\")\nP_b2 = model.addVar(vtype=\"B\", name=\"P_b2\")\nmodel.addCons(P_b1 + P_b2 == 1)\nmodel.addCons(P == P1*P_b1 + P2*P_b2)\nCost_Phone = 50 * P1 * P_b1 + (50 - 0.5 * (P2 - 100)) * P2 * P_b2\nRevenue_Phone = 100 * P\n## create piecewise variables for piecewise function: Cost_Tablet = max(75 - 0.5 * (T - 100), 75) * T\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0, ub=100)\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=100, ub=400)\nT_b1 = model.addVar(vtype=\"B\", name=\"T_b1\")\nT_b2 = model.addVar(vtype=\"B\", name=\"T_b2\")\nmodel.addCons(T_b1 + T_b2 == 1)\nmodel.addCons(T == T1*T_b1 + T2*T_b2)\nCost_Tablet = 75 * T1 * T_b1 + (75 - 0.5 * (T2 - 100)) * T2 * T_b2\nRevenue_Tablet = 150 * T\n## create piecewise variables for piecewise function: Cost_Laptop = max(100 - 0.5 * (L - 100), 100) * L\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0, ub=100)\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=100, ub=300)\nL_b1 = model.addVar(vtype=\"B\", name=\"L_b1\")\nL_b2 = model.addVar(vtype=\"B\", name=\"L_b2\")\nmodel.addCons(L_b1 + L_b2 == 1)\nmodel.addCons(L == L1*L_b1 + L2*L_b2)\nCost_Laptop = 100 * L1 * L_b1 + (100 - 0.5 * (L2 - 100)) * L2 * L_b2\nRevenue_Laptop = 200 * L\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Revenue_Phone - Cost_Phone) + (Revenue_Tablet - Cost_Tablet) + (Revenue_Laptop - Cost_Laptop)\nmodel.addCons(obj == (Revenue_Phone - Cost_Phone) + (Revenue_Tablet - Cost_Tablet) + (Revenue_Laptop - Cost_Laptop))\n\n# Add constraints\nmodel.addCons(50 * P + 75 * T + 100 * L <= 10000)\nmodel.addCons(P + T + L <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Phone: \", model.getVal(P))\n    print(\"Quantity of Tablet: \", model.getVal(T))\n    print(\"Quantity of Laptop: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1689,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturing plant incurs different costs for producing each component. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The plant also has a fixed overhead cost of $500 per day. The plant aims to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost divided by the total number of units produced.\n// Variable cost of A: Cost_A = 10 * A\n// Variable cost of B: Cost_B = 15 * B\n// Variable cost of C: Cost_C = 20 * C\n// Total cost: Total_Cost = (Cost_A + Cost_B + Cost_C + 500) / (A + B + C)\n// So, the objective function is: Minimize Total_Cost\n\n## Generate Constraint-1:\nThe plant has a daily budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C + 500 <= 1000",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine how many units of each component to produce to optimize its production efficiency. The cost of producing each component and the fixed overhead cost are given in the following Table.\n\n| Component | Production Cost per Unit |\n|-----------|--------------------------|\n| A         | $10                      |\n| B         | $15                      |\n| C         | $20                      |\n\nThe plant has a fixed overhead cost of $500 per day and a daily budget of $1000 for production costs. Please help the plant to minimize the total cost per unit produced, which is defined as the sum of the variable costs and the fixed overhead cost divided by the total number of units produced.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 10 * A\nCost_B = 15 * B\nCost_C = 20 * C\nTotal_Cost = Cost_A + Cost_B + Cost_C + 500\nTotal_Units = A + B + C\n## the objective function is: Minimize Total_Cost / Total_Units\n## convert the division to multiplication\nmodel.addCons(obj * Total_Units == Total_Cost)\n\n# Add constraints\n## The plant has a daily budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C + 500 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 783,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the cost of irrigation per acre is $100 for crop A, $150 for crop B, and $200 for crop C. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The water usage per acre is 5 units for crop A, 7 units for crop B, and 9 units for crop C.\n// Profit of crop A: Profit_A = (500 - 100) * A\n// Profit of crop B: Profit_B = (700 - 150) * B\n// Profit of crop C: Profit_C = (900 - 200) * C\n// Total water used: Water_used = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20\n\n## Generate Constraint-3:\nThe total cost of irrigation should not exceed $15,000.\n// 100 * A + 150 * B + 200 * C <= 15000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and the cost of irrigation per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost of Irrigation per Acre | Water Usage per Acre |\n|------|-----------------|-----------------------------|----------------------|\n| A    | $500            | $100                        | 5 units              |\n| B    | $700            | $150                        | 7 units              |\n| C    | $900            | $200                        | 9 units              |\n\nThe total available land for cultivation is 100 acres. The farmer wants to ensure at least 20 acres are dedicated to each crop. The total cost of irrigation should not exceed $15,000. \nPlease help the farmer to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * A\nProfit_B = (700 - 150) * B\nProfit_C = (900 - 200) * C\nWater_used = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n## The total cost of irrigation should not exceed $15,000.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 978,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop.\n// {\"amount of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of land for soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm owner wants to maximize the total profit from the crops. The profit per acre for corn is $300, for wheat is $250, and for soybeans is $200. However, the cost of fertilization per acre is $50 for corn, $30 for wheat, and $20 for soybeans. The owner wants to maximize the net profit per acre across all crops.\n// Profit_C = (300 - 50) * C\n// Profit_W = (250 - 30) * W\n// Profit_S = (200 - 20) * S\n// So, the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / (C + W + S)\n\n## Generate Constraint-1:\nThe total available land for farming is 100 acres.\n// C + W + S <= 100\n\n## Generate Constraint-2:\nThe farm has a budget constraint for fertilization, which is $4000.\n// 50 * C + 30 * W + 20 * S <= 4000\n\n## Generate Constraint-3:\nDue to market demand, the farm can only sell up to 50 acres of corn.\n// C <= 50",
        "question": "A farm needs to allocate resources to three different crops: corn, wheat, and soybeans. The farm owner needs to determine the amount of land to dedicate to each crop. The profit per acre for corn is $300, for wheat is $250, and for soybeans is $200. However, the cost of fertilization per acre is $50 for corn, $30 for wheat, and $20 for soybeans. The owner wants to maximize the net profit per acre across all crops. The total available land for farming is 100 acres. The farm has a budget constraint for fertilization, which is $4000. Due to market demand, the farm can only sell up to 50 acres of corn. Please help the farm owner to maximize the total profit from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of land for corn\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of land for wheat\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # amount of land for soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (300 - 50) * C\nProfit_W = (250 - 30) * W\nProfit_S = (200 - 20) * S\nTotalLand = C + W + S\n## the objective function is: Maximize (Profit_C + Profit_W + Profit_S) / TotalLand\n## convert the division to multiplication\nmodel.addCons(obj * TotalLand == Profit_C + Profit_W + Profit_S)\n\n# Add constraints\n## The total available land for farming is 100 acres.\nmodel.addCons(C + W + S <= 100)\n## The farm has a budget constraint for fertilization, which is $4000.\nmodel.addCons(50 * C + 30 * W + 20 * S <= 4000)\n## Due to market demand, the farm can only sell up to 50 acres of corn.\nmodel.addCons(C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for Corn: \", model.getVal(C))\n    print(\"Amount of Land for Wheat: \", model.getVal(W))\n    print(\"Amount of Land for Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 677,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations.\n// {\"quantity of ChemX\": \"ChemX\", \"range\": \"ChemX >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemY\": \"ChemY\", \"range\": \"ChemY >= 0\", \"type\": \"integer\"}\n// {\"quantity of ChemZ\": \"ChemZ\", \"range\": \"ChemZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ChemX is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nThe profit per unit of ChemY is $150, the production cost per unit is $70, and the storage cost per unit is $15. \nThe profit per unit of ChemZ is $200, the production cost per unit is $100, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit (profit minus production and storage costs).\n// NetProfit_ChemX = (100 - 50 - 10) * ChemX\n// NetProfit_ChemY = (150 - 70 - 15) * ChemY\n// NetProfit_ChemZ = (200 - 100 - 20) * ChemZ\n// So, the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / (ChemX + ChemY + ChemZ)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units across all chemicals.\n// ChemX + ChemY + ChemZ <= 200\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\n// ChemY <= 2 * ChemX\n\n## Generate Constraint-3:\nThe company has a budget of $10,000 for production costs.\n// 50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10,000",
        "question": "A manufacturing company produces three types of chemicals: ChemX, ChemY, and ChemZ. They need to determine the production quantities of each chemical to optimize their operations. The profit per unit, production cost per unit, and storage cost per unit for each chemical are given in the following Table.\n\n| Chemical | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|----------|-----------------|--------------------------|-----------------------|\n| ChemX    | $100            | $50                      | $10                   |\n| ChemY    | $150            | $70                      | $15                   |\n| ChemZ    | $200            | $100                     | $20                   |\n\nThe company has a total production capacity of 200 units across all chemicals. Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX. The company has a budget of $10,000 for production costs.\n\nPlease help the company to maximize the net profit per unit (profit minus production and storage costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemX = model.addVar(vtype=\"INTEGER\", name=\"ChemX\", lb=0) # quantity of ChemX\nChemY = model.addVar(vtype=\"INTEGER\", name=\"ChemY\", lb=0) # quantity of ChemY\nChemZ = model.addVar(vtype=\"INTEGER\", name=\"ChemZ\", lb=0) # quantity of ChemZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_ChemX = (100 - 50 - 10) * ChemX\nNetProfit_ChemY = (150 - 70 - 15) * ChemY\nNetProfit_ChemZ = (200 - 100 - 20) * ChemZ\nTotalProduction = ChemX + ChemY + ChemZ\n## the objective function is: Maximize (NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ) / TotalProduction\n## convert the division to multiplication\nmodel.addCons(obj * TotalProduction == NetProfit_ChemX + NetProfit_ChemY + NetProfit_ChemZ)\n\n# Add constraints\n## The company has a total production capacity of 200 units across all chemicals.\nmodel.addCons(ChemX + ChemY + ChemZ <= 200)\n## Due to safety regulations, the production of ChemY cannot exceed twice the production of ChemX.\nmodel.addCons(ChemY <= 2 * ChemX)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * ChemX + 70 * ChemY + 100 * ChemZ <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ChemX: \", model.getVal(ChemX))\n    print(\"Quantity of ChemY: \", model.getVal(ChemY))\n    print(\"Quantity of ChemZ: \", model.getVal(ChemZ))\n    print(\"Maximized Net Profit per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process.\n// {\"production quantity of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand.\n// Production cost of product 1: C1 = 50 - 0.002 * Automation * P1\n// Production cost of product 2: C2 = 70 - 0.002 * Automation * P2\n// Production cost of product 3: C3 = 90 - 0.002 * Automation * P3\n// Total production cost: Cost = C1 + C2 + C3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3.\n// P1 >= 100; P2 >= 150; P3 >= 200\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The cost of producing each unit of product 1 is $50, product 2 is $70, and product 3 is $90. Implementing automation reduces the production cost by $2 for each unit of product for every $1000 invested in automation. The company aims to minimize the total production cost while meeting a certain demand. The company must produce at least 100 units of product 1, 150 units of product 2, and 200 units of product 3. The total investment in automation cannot exceed $50,000. Please help the company to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=100) # production quantity of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=150) # production quantity of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=200) # production quantity of product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nC1 = 50 - 0.002 * Automation * P1\nC2 = 70 - 0.002 * Automation * P2\nC3 = 90 - 0.002 * Automation * P3\nCost = C1 + C2 + C3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(P1))\n    print(\"Production Quantity of Product 2: \", model.getVal(P2))\n    print(\"Production Quantity of Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 737,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rates of each product and the amount of money to invest in a new production line that will increase the efficiency of all products.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in new production line\": \"Investment\", \"range\": \"Investment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The initial production cost per unit for product 1 is $100, for product 2 is $150, and for product 3 is $200. The selling price per unit for product 1 is $150, for product 2 is $225, and for product 3 is $300. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - 100 + 0.0005 * Investment) * P1\n// Total profit for product 2: Profit2 = (225 - 150 + 0.0005 * Investment) * P2\n// Total profit for product 3: Profit3 = (300 - 200 + 0.0005 * Investment) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total investment in the new production line cannot exceed $500,000.\n// Investment <= 500000\n\n## Generate Constraint-2:\nThe company must produce at least 100 units of each product per day.\n// P1 >= 100; P2 >= 100; P3 >= 100\n\n## Generate Constraint-3:\nThe total production rate of all products must not exceed 500 units per day.\n// P1 + P2 + P3 <= 500",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rates of each product and the amount of money to invest in a new production line that will increase the efficiency of all products. The initial production cost per unit and the selling price per unit for each product are given in the following Table.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| 1       | $100                     | $150                   |\n| 2       | $150                     | $225                   |\n| 3       | $200                     | $300                   |\n\nThe production efficiency of each product increases by 5% for every $100,000 invested in the new production line. The total investment in the new production line cannot exceed $500,000. The company must produce at least 100 units of each product per day. The total production rate of all products must not exceed 500 units per day. \n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=100) # production rate of product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=100) # production rate of product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=100) # production rate of product 3\nInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"Investment\", lb=0) # investment in new production line\n\n# Define objective function\n## The production efficiency of each product increases by 5% for every $100,000 invested in the new production line.\n## Total profit for product 1: Profit1 = (150 - 100 + 0.0005 * Investment) * P1\n## Total profit for product 2: Profit2 = (225 - 150 + 0.0005 * Investment) * P2\n## Total profit for product 3: Profit3 = (300 - 200 + 0.0005 * Investment) * P3\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nProfit1 = (150 - 100 + 0.0005 * Investment) * P1\nProfit2 = (225 - 150 + 0.0005 * Investment) * P2\nProfit3 = (300 - 200 + 0.0005 * Investment) * P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total investment in the new production line cannot exceed $500,000.\nmodel.addCons(Investment <= 500000)\n## The company must produce at least 100 units of each product per day.\nmodel.addCons(P1 >= 100)\nmodel.addCons(P2 >= 100)\nmodel.addCons(P3 >= 100)\n## The total production rate of all products must not exceed 500 units per day.\nmodel.addCons(P1 + P2 + P3 <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product 1: \", model.getVal(P1))\n    print(\"Production Rate of Product 2: \", model.getVal(P2))\n    print(\"Production Rate of Product 3: \", model.getVal(P3))\n    print(\"Investment in New Production Line: \", model.getVal(Investment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1082,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit.\n// {\"number of units of WidgetA\": \"WidgetAUnits\", \"range\": \"WidgetAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetB\": \"WidgetBUnits\", \"range\": \"WidgetBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of WidgetC\": \"WidgetCUnits\", \"range\": \"WidgetCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for WidgetA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for WidgetB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for WidgetC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\n// Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\n// Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\n// So, the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA.\n// WidgetBUnits <= 2 * WidgetAUnits",
        "question": "A manufacturing company produces three types of widgets: WidgetA, WidgetB, and WidgetC. They need to decide how many units of each widget to produce to optimize their profit. The profit per unit for each widget decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit for WidgetA decreases by $0.1 for each unit produced beyond the first 100 units, the profit per unit for WidgetB decreases by $0.05 for each unit produced beyond the first 200 units, and the profit per unit for WidgetC decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n\n| Widget | Profit per Unit (first X units) | Decrease in Profit per Unit (beyond threshold) | Threshold |\n|--------|---------------------------------|----------------------------------------------|-----------|\n| WidgetA| $50                             | $0.1                                         | 100       |\n| WidgetB| $70                             | $0.05                                        | 200       |\n| WidgetC| $90                             | $0.02                                        | 300       |\n\nThe company has a total production capacity of 500 units. Due to resource limitations, the production of WidgetB cannot exceed twice the production of WidgetA. Please help the company determine the optimal number of units to produce for each widget to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetAUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetAUnits\", lb=0) # number of units of WidgetA\nWidgetBUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetBUnits\", lb=0) # number of units of WidgetB\nWidgetCUnits = model.addVar(vtype=\"INTEGER\", name=\"WidgetCUnits\", lb=0) # number of units of WidgetC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_WidgetA = (50 - 0.1 * max(WidgetAUnits - 100, 0)) * WidgetAUnits\nWidgetA1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA1\", lb=0, ub=100)\nWidgetA2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetA2\", lb=100, ub=500)\nWidgetA_b1 = model.addVar(vtype=\"B\", name=\"WidgetA_b1\")\nWidgetA_b2 = model.addVar(vtype=\"B\", name=\"WidgetA_b2\")\nmodel.addCons(WidgetA_b1 + WidgetA_b2 == 1)\nmodel.addCons(WidgetAUnits == WidgetA1*WidgetA_b1 + WidgetA2*WidgetA_b2)\nProfit_WidgetA = (50 - 0.1 * WidgetA2) * WidgetA2 * WidgetA_b2 + 50 * WidgetA1 * WidgetA_b1\n## create piecewise variables for piecewise function: Profit_WidgetB = (70 - 0.05 * max(WidgetBUnits - 200, 0)) * WidgetBUnits\nWidgetB1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB1\", lb=0, ub=200)\nWidgetB2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetB2\", lb=200, ub=500)\nWidgetB_b1 = model.addVar(vtype=\"B\", name=\"WidgetB_b1\")\nWidgetB_b2 = model.addVar(vtype=\"B\", name=\"WidgetB_b2\")\nmodel.addCons(WidgetB_b1 + WidgetB_b2 == 1)\nmodel.addCons(WidgetBUnits == WidgetB1*WidgetB_b1 + WidgetB2*WidgetB_b2)\nProfit_WidgetB = (70 - 0.05 * WidgetB2) * WidgetB2 * WidgetB_b2 + 70 * WidgetB1 * WidgetB_b1\n## create piecewise variables for piecewise function: Profit_WidgetC = (90 - 0.02 * max(WidgetCUnits - 300, 0)) * WidgetCUnits\nWidgetC1 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC1\", lb=0, ub=300)\nWidgetC2 = model.addVar(vtype=\"INTEGER\", name=\"WidgetC2\", lb=300, ub=500)\nWidgetC_b1 = model.addVar(vtype=\"B\", name=\"WidgetC_b1\")\nWidgetC_b2 = model.addVar(vtype=\"B\", name=\"WidgetC_b2\")\nmodel.addCons(WidgetC_b1 + WidgetC_b2 == 1)\nmodel.addCons(WidgetCUnits == WidgetC1*WidgetC_b1 + WidgetC2*WidgetC_b2)\nProfit_WidgetC = (90 - 0.02 * WidgetC2) * WidgetC2 * WidgetC_b2 + 90 * WidgetC1 * WidgetC_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\nmodel.addCons(obj == Profit_WidgetA + Profit_WidgetB + Profit_WidgetC)\n\n# Add constraints\nmodel.addCons(WidgetAUnits + WidgetBUnits + WidgetCUnits <= 500)\nmodel.addCons(WidgetBUnits <= 2 * WidgetAUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of WidgetA Units: \", model.getVal(WidgetAUnits))\n    print(\"Number of WidgetB Units: \", model.getVal(WidgetBUnits))\n    print(\"Number of WidgetC Units: \", model.getVal(WidgetCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1450,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products. The manufacturer has a budget of $50,000 for investing in the new production technology.\nPlease help the manufacturer determine the optimal production quantities for products A, B, and C, and the amount to invest in the new production technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBUnits <= 2 * ComponentAUnits",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for each component decreases as more units are produced beyond certain thresholds. Specifically, the profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n\n| Component | Profit per Unit (up to threshold) | Decrease per Unit beyond threshold | Threshold |\n|-----------|-----------------------------------|------------------------------------|-----------|\n| ComponentA | $50                               | $1                                 | 100 units  |\n| ComponentB | $70                               | $0.5                               | 200 units  |\n| ComponentC | $100                              | $2                                 | 150 units  |\n\nThe company has a total production capacity of 500 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. Please help the company determine the optimal number of units to produce for each component to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=0) # number of units of ComponentA\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=0) # number of units of ComponentB\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\nmodel.addCons(ComponentBUnits <= 2 * ComponentAUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1547,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand.\n// {\"number of machines for component A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands.\n// The operating hours for component A: HA = 500 / (10 * MA)\n// The operating hours for component B: HB = 600 / (12 * MB)\n// The operating hours for component C: HC = 750 / (15 * MC)\n// So, the objective function is: Minimize max(HA, HB, HC)\n\n## Generate Constraint-1:\nThere are a total of 20 machines available in the plant.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nEach type of machine can operate for a maximum of 10 hours per day.\n// HA <= 10; HB <= 10; HC <= 10",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of machines to allocate to each type of component production to optimize efficiency and meet demand. Each machine for component A produces 10 units per hour, for component B produces 12 units per hour, and for component C produces 15 units per hour. The plant needs to produce at least 500 units of component A, 600 units of component B, and 750 units of component C daily. The goal is to minimize the total operating hours required to meet these demands. There are a total of 20 machines available in the plant, and each type of machine can operate for a maximum of 10 hours per day. Please help the plant manager to determine the optimal allocation of machines to minimize the maximum operating hours required for each component.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"INTEGER\", name=\"MA\", lb=0) # number of machines for component A\nMB = model.addVar(vtype=\"INTEGER\", name=\"MB\", lb=0) # number of machines for component B\nMC = model.addVar(vtype=\"INTEGER\", name=\"MC\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nHA = model.addVar(name=\"HA\") # operating hours for component A\nHB = model.addVar(name=\"HB\") # operating hours for component B\nHC = model.addVar(name=\"HC\") # operating hours for component C\nmodel.addCons(HA == 500 / (10 * MA))\nmodel.addCons(HB == 600 / (12 * MB))\nmodel.addCons(HC == 750 / (15 * MC))\n## the objective function is: Minimize max(HA, HB, HC)\nmodel.addCons(obj >= HA)\nmodel.addCons(obj >= HB)\nmodel.addCons(obj >= HC)\n\n# Add constraints\n## There are a total of 20 machines available in the plant.\nmodel.addCons(MA + MB + MC <= 20)\n## Each type of machine can operate for a maximum of 10 hours per day.\nmodel.addCons(HA <= 10)\nmodel.addCons(HB <= 10)\nmodel.addCons(HC <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(MA))\n    print(\"Number of Machines for Component B: \", model.getVal(MB))\n    print(\"Number of Machines for Component C: \", model.getVal(MC))\n    print(\"Minimum Operating Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 858,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, each with varying profit margins and resource requirements. Additionally, the company needs to determine the level of automation to implement in the production process, which will affect the production costs.\n// {\"production quantity of Product 1\": \"Product1\", \"range\": \"Product1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Product2\", \"range\": \"Product2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Product3\", \"range\": \"Product3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\n// Total profit for the products: Profit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all products.\n// Product1 + Product2 + Product3 <= 10000\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production quantity of Product 1 must be at least 1,000 units.\n// Product1 >= 1000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products and the level of automation to implement in the production process. The profit margin for Product 1 is $10 per unit, for Product 2 is $15 per unit, and for Product 3 is $20 per unit. Implementing automation reduces the production cost per unit by $0.5 for every $1,000 invested in automation. The company aims to maximize the total profit from all products.\nThe company has a total production capacity of 10,000 units across all products. The total investment in automation cannot exceed $50,000. The production quantity of Product 1 must be at least 1,000 units.\nPlease help the company to determine the optimal production quantities for each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduct1 = model.addVar(vtype=\"INTEGER\", name=\"Product1\", lb=1000)  # production quantity of Product 1\nProduct2 = model.addVar(vtype=\"INTEGER\", name=\"Product2\", lb=0)  # production quantity of Product 2\nProduct3 = model.addVar(vtype=\"INTEGER\", name=\"Product3\", lb=0)  # production quantity of Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit = (10 - 0.0005 * Automation) * Product1 + (15 - 0.0005 * Automation) * Product2 + (20 - 0.0005 * Automation) * Product3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Product1 + Product2 + Product3 <= 10000)  # total production capacity constraint\nmodel.addCons(Automation <= 50000)  # investment in automation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Product1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Product2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Product3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from selling each smartphone is $100, each tablet is $200, and each laptop is $300. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.1 * T^2, and for laptops is 0.15 * L^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize P = 100S - 0.05S^2 + 200T - 0.1T^2 + 300L - 0.15L^2\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $50,000.\n// 0.05S^2 + 0.1T^2 + 0.15L^2 <= 50000",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from selling each smartphone is $100, each tablet is $200, and each laptop is $300. However, the production cost increases nonlinearly with the number of units produced due to economies of scale. The production cost for smartphones is 0.05 * S^2, for tablets is 0.1 * T^2, and for laptops is 0.15 * L^2. The company has a budget constraint that limits the total production cost to $50,000.\n\n| Device     | Selling Price | Production Cost Formula |\n|------------|---------------|-------------------------|\n| Smartphones | $100          | 0.05 * S^2             |\n| Tablets     | $200          | 0.1 * T^2              |\n| Laptops     | $300          | 0.15 * L^2             |\n\nPlease help the company to maximize the total profit, which is the revenue minus the production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize P = 100S - 0.05S^2 + 200T - 0.1T^2 + 300L - 0.15L^2\n## Convert the quadratic terms to linear terms by introducing new variables and constraints\nS_sq = model.addVar(vtype=\"INTEGER\", name=\"S_sq\")\nT_sq = model.addVar(vtype=\"INTEGER\", name=\"T_sq\")\nL_sq = model.addVar(vtype=\"INTEGER\", name=\"L_sq\")\nmodel.addCons(S_sq == S**2)\nmodel.addCons(T_sq == T**2)\nmodel.addCons(L_sq == L**2)\nmodel.addCons(obj == 100*S - 0.05*S_sq + 200*T - 0.1*T_sq + 300*L - 0.15*L_sq)\n\n# Add constraints\n## The company has a budget constraint that limits the total production cost to $50,000.\nmodel.addCons(0.05*S_sq + 0.1*T_sq + 0.15*L_sq <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\n// Profit from Crop A: Profit_A = (5 * 100 - 300) * A\n// Profit from Crop B: Profit_B = (7 * 120 - 400) * B\n// Profit from Crop C: Profit_C = (6 * 110 - 350) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to cultivate at least 10 acres of each crop.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-3:\nThe total cost of cultivation should not exceed $35,000.\n// 300 * A + 400 * B + 350 * C <= 35000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\nFor Crop A, the expected yield is 5 tons per acre, the selling price is $100 per ton, and the cost of cultivation is $300 per acre.\nFor Crop B, the expected yield is 7 tons per acre, the selling price is $120 per ton, and the cost of cultivation is $400 per acre.\nFor Crop C, the expected yield is 6 tons per acre, the selling price is $110 per ton, and the cost of cultivation is $350 per acre.\nThe farmer aims to maximize the net profit per acre (which is defined as the total profit from selling the crops divided by the total acres used).\nThe farm has a total of 100 acres available for cultivation. The farmer wants to cultivate at least 10 acres of each crop. The total cost of cultivation should not exceed $35,000.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to cultivate at least 10 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (5 * 100 - 300) * A\nProfit_B = (7 * 120 - 400) * B\nProfit_C = (6 * 110 - 350) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The total cost of cultivation should not exceed $35,000.\nmodel.addCons(300 * A + 400 * B + 350 * C <= 35000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 953,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n// The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n\n## Generate Constraint-1:\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n// 2A + 3B + 4C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit per unit of product A is $50, product B is $70, and product C is $90. The production process is nonlinear due to economies of scale in manufacturing. The profit function is given by: Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2).\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $90             | 4 hours                  |\n\nThe company has a total of 1000 hours of labor available for production. Producing one unit of product A requires 2 hours, product B requires 3 hours, and product C requires 4 hours.\n\nPlease help the company to maximize its profit while adhering to the constraint of having only 1000 hours of labor available for production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## The objective function is: Maximize Profit = 50A + 70B + 90C - 0.01(A^2 + B^2 + C^2)\n## Since pyscipopt does not support quadratic terms directly, we will linearize the quadratic terms\nA_sq = model.addVar(vtype=\"INTEGER\", name=\"A_sq\")\nB_sq = model.addVar(vtype=\"INTEGER\", name=\"B_sq\")\nC_sq = model.addVar(vtype=\"INTEGER\", name=\"C_sq\")\nmodel.addCons(A_sq == A**2)\nmodel.addCons(B_sq == B**2)\nmodel.addCons(C_sq == C**2)\n\nProfit = 50*A + 70*B + 90*C - 0.01*(A_sq + B_sq + C_sq)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a total of 1000 hours of labor available for production.\nmodel.addCons(2*A + 3*B + 4*C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that handle different types of products. The company needs to optimize the allocation of its limited budget to these warehouses to maximize the total value of products stored.\n// {\"budget allocation for warehouse 1\": \"B1\", \"range\": \"0 <= B1 <= 100000\", \"type\": \"real\"}\n// {\"budget allocation for warehouse 2\": \"B2\", \"range\": \"0 <= B2 <= 100000\", \"type\": \"real\"}\n// {\"budget allocation for warehouse 3\": \"B3\", \"range\": \"0 <= B3 <= 100000\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe value of products stored in each warehouse increases nonlinearly with the budget allocation. Specifically, the value V in each warehouse is given by:\n- Warehouse 1: V1 = 1000 * B1^0.7\n- Warehouse 2: V2 = 1500 * B2^0.6\n- Warehouse 3: V3 = 2000 * B3^0.5\nThe company aims to maximize the total value of products stored across all warehouses.\n// The objective function is: Maximize V = V1 + V2 + V3 = 1000 * B1^0.7 + 1500 * B2^0.6 + 2000 * B3^0.5\n\n## Generate Constraint-1:\nThe total budget available for allocation is $200,000.\n// B1 + B2 + B3 = 200000\n\n## Generate Constraint-2:\nAt least 25% of the total budget must be allocated to Warehouse 1.\n// B1 >= 0.25 * (B1 + B2 + B3)",
        "question": "A company operates three different warehouses that handle different types of products. The company needs to optimize the allocation of its limited budget to these warehouses to maximize the total value of products stored. The value of products stored in each warehouse increases nonlinearly with the budget allocation, as shown in the following Table.\n\n| Warehouse | Value Function                |\n|-----------|-------------------------------|\n| 1         | V1 = 1000 * B1^0.7           |\n| 2         | V2 = 1500 * B2^0.6           |\n| 3         | V3 = 2000 * B3^0.5           |\n\nThe total budget available for allocation is $200,000. At least 25% of the total budget must be allocated to Warehouse 1. Please help the company to maximize the total value of products stored across all warehouses.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nB1 = model.addVar(vtype=\"CONTINUOUS\", name=\"B1\", lb=0, ub=100000) # budget allocation for warehouse 1\nB2 = model.addVar(vtype=\"CONTINUOUS\", name=\"B2\", lb=0, ub=100000) # budget allocation for warehouse 2\nB3 = model.addVar(vtype=\"CONTINUOUS\", name=\"B3\", lb=0, ub=100000) # budget allocation for warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The value of products stored in each warehouse increases nonlinearly with the budget allocation.\nV1 = 1000 * B1**0.7\nV2 = 1500 * B2**0.6\nV3 = 2000 * B3**0.5\n## The objective function is: Maximize V = V1 + V2 + V3\nmodel.addCons(obj == V1 + V2 + V3)\n\n# Add constraints\n## The total budget available for allocation is $200,000.\nmodel.addCons(B1 + B2 + B3 == 200000)\n## At least 25% of the total budget must be allocated to Warehouse 1.\nmodel.addCons(B1 >= 0.25 * (B1 + B2 + B3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Budget Allocation for Warehouse 1: \", model.getVal(B1))\n    print(\"Budget Allocation for Warehouse 2: \", model.getVal(B2))\n    print(\"Budget Allocation for Warehouse 3: \", model.getVal(B3))\n    print(\"Maximized Total Value of Products: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company produces three types of chemicals in their factory. They need to decide the amount of raw materials to allocate to each chemical production process to optimize their profit.\n// {\"amount of raw material for chemical 1\": \"R1\", \"range\": \"R1 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 2\": \"R2\", \"range\": \"R2 >= 0\", \"type\": \"real\"}\n// {\"amount of raw material for chemical 3\": \"R3\", \"range\": \"R3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each chemical depends on the amount of raw material used. The profit functions are nonlinear and are given by:\n- Profit from chemical 1: P1 = 100 * R1 - 0.5 * R1^2\n- Profit from chemical 2: P2 = 150 * R2 - 0.7 * R2^2\n- Profit from chemical 3: P3 = 200 * R3 - 0.9 * R3^2\nThe company wants to maximize the total profit from all three chemicals.\n// The objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total amount of raw material available is 100 units.\n// R1 + R2 + R3 <= 100\n\n## Generate Constraint-2:\nThe production of chemical 1 requires at least 10 units of raw material.\n// R1 >= 10\n\n## Generate Constraint-3:\nThe production of chemical 3 cannot exceed 50% of the total raw material used.\n// R3 <= 0.5 * (R1 + R2 + R3)",
        "question": "A company produces three types of chemicals in their factory and needs to decide the amount of raw materials to allocate to each chemical production process to optimize their profit. The profit from each chemical depends on the amount of raw material used, and the profit functions are nonlinear, as shown in the following table:\n\n| Chemical | Profit Function                |\n|----------|--------------------------------|\n| 1        | P1 = 100 * R1 - 0.5 * R1^2    |\n| 2        | P2 = 150 * R2 - 0.7 * R2^2    |\n| 3        | P3 = 200 * R3 - 0.9 * R3^2    |\n\nThe company wants to maximize the total profit from all three chemicals. The total amount of raw material available is 100 units. The production of chemical 1 requires at least 10 units of raw material. The production of chemical 3 cannot exceed 50% of the total raw material used.\n\nPlease help the company determine the optimal allocation of raw materials (R1, R2, R3) to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR1 = model.addVar(vtype=\"CONTINUOUS\", name=\"R1\", lb=0) # amount of raw material for chemical 1\nR2 = model.addVar(vtype=\"CONTINUOUS\", name=\"R2\", lb=0) # amount of raw material for chemical 2\nR3 = model.addVar(vtype=\"CONTINUOUS\", name=\"R3\", lb=0) # amount of raw material for chemical 3\n\n# Define objective function\nP1 = 100 * R1 - 0.5 * R1**2\nP2 = 150 * R2 - 0.7 * R2**2\nP3 = 200 * R3 - 0.9 * R3**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(R1 + R2 + R3 <= 100) # total amount of raw material available is 100 units\nmodel.addCons(R1 >= 10) # production of chemical 1 requires at least 10 units of raw material\nmodel.addCons(R3 <= 0.5 * (R1 + R2 + R3)) # production of chemical 3 cannot exceed 50% of the total raw material used\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Raw Material for Chemical 1: \", model.getVal(R1))\n    print(\"Amount of Raw Material for Chemical 2: \", model.getVal(R2))\n    print(\"Amount of Raw Material for Chemical 3: \", model.getVal(R3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, ProductB is $70, and ProductC is $90. The cost of raw materials and labor per unit of ProductA is $20, ProductB is $30, and ProductC is $40. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (50 - 20) * QuantityA\n// Total profit for ProductB: ProfitB = (70 - 30) * QuantityB\n// Total profit for ProductC: ProfitC = (90 - 40) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials and labor, which cannot exceed $10,000.\n// 20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10,000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantities of each product to maximize profit while considering the cost of raw materials and labor. The profit per unit and the cost of raw materials and labor per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials and Labor per Unit |\n|---------|-----------------|-----------------------------------------|\n| ProductA | $50             | $20                                     |\n| ProductB | $70             | $30                                     |\n| ProductC | $90             | $40                                     |\n\nThe company has a limited budget for raw materials and labor, which cannot exceed $10,000. The production quantities of each product must be non-negative integers. Please help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\n\n# Define objective function\nProfitA = (50 - 20) * QuantityA\nProfitB = (70 - 30) * QuantityB\nProfitC = (90 - 40) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(20 * QuantityA + 30 * QuantityB + 40 * QuantityC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 960,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how many hours each factory should operate daily to meet production targets while minimizing costs.\n// {\"hours of operation for factory 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for factory 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"real\"}\n// {\"hours of operation for factory 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach factory has a different efficiency and cost structure. Factory 1 produces 100 units per hour at a cost of $50 per hour. Factory 2 produces 150 units per hour at a cost of $60 per hour. Factory 3 produces 200 units per hour at a cost of $70 per hour. The company needs to produce at least 3000 units daily. The objective is to minimize the total cost of operation.\n// The total cost of operation: C = 50 * H1 + 60 * H2 + 70 * H3\n// The total production: P = 100 * H1 + 150 * H2 + 200 * H3\n// So, the objective function is: Minimize C subject to P >= 3000\n\n## Generate Constraint-1:\nThe total hours of operation across all factories must not exceed 24 hours per day.\n// H1 + H2 + H3 <= 24\n\n## Generate Constraint-2:\nEach factory can operate a maximum of 10 hours per day.\n// H1 <= 10; H2 <= 10; H3 <= 10",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how many hours each factory should operate daily to meet production targets while minimizing costs. Factory 1 produces 100 units per hour at a cost of $50 per hour. Factory 2 produces 150 units per hour at a cost of $60 per hour. Factory 3 produces 200 units per hour at a cost of $70 per hour. The company needs to produce at least 3000 units daily. The total hours of operation across all factories must not exceed 24 hours per day, and each factory can operate a maximum of 10 hours per day. Please help the company to minimize the total cost of operation.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours of operation for factory 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours of operation for factory 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours of operation for factory 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## The total cost of operation: C = 50 * H1 + 60 * H2 + 70 * H3\nmodel.addCons(obj == 50 * H1 + 60 * H2 + 70 * H3)\n\n# Add constraints\n## The total production: P = 100 * H1 + 150 * H2 + 200 * H3\n## The company needs to produce at least 3000 units daily.\nmodel.addCons(100 * H1 + 150 * H2 + 200 * H3 >= 3000)\n## The total hours of operation across all factories must not exceed 24 hours per day.\nmodel.addCons(H1 + H2 + H3 <= 24)\n## Each factory can operate a maximum of 10 hours per day.\nmodel.addCons(H1 <= 10)\nmodel.addCons(H2 <= 10)\nmodel.addCons(H3 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for factory 1: \", model.getVal(H1))\n    print(\"Hours of operation for factory 2: \", model.getVal(H2))\n    print(\"Hours of operation for factory 3: \", model.getVal(H3))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 665,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n\n## Generate Constraint-3:\nThe market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\n// A <= 200\n// B <= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. The production cost for each product increases nonlinearly with the quantity produced due to economies of scale, with the cost functions given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| A       | $50             | 2 hours                  |\n| B       | $70             | 3 hours                  |\n| C       | $60             | 2.5 hours                |\n\nThe company has a limited production capacity of 1000 hours. The company must produce at least 10 units of each product to meet contractual obligations. The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\n\nPlease help the company to maximize its total profit by determining the optimal production quantities of products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=200) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=150) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # production quantity of product C\n\n# Define objective function\n## Revenue = 50 * A + 70 * B + 60 * C\n## Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n## Objective function: Maximize Profit = Revenue - Cost\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nProfit = Revenue - (Cost_A + Cost_B + Cost_C)\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1283,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor.\n// {\"amount of land for C1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"amount of land for C3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. \nEach unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. \nEach unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor.\nThe farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource).\n// Profit_C1 = 100 * L1\n// Profit_C2 = 150 * L2\n// Profit_C3 = 200 * L3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of land available.\n// L1 + L2 + L3 <= 100",
        "question": "A farm needs to optimize the allocation of resources for growing three different crops: C1, C2, and C3. The farm has a limited amount of land, water, and labor. Each unit of land for C1 yields a profit of $100, requires 2 units of water, and 1 unit of labor. Each unit of land for C2 yields a profit of $150, requires 3 units of water, and 2 units of labor. Each unit of land for C3 yields a profit of $200, requires 4 units of water, and 3 units of labor. The farm aims to maximize the total profit from all crops while considering the efficiency of resource use (profit per unit of resource). The farm has a total of 100 units of land available. Please help the farm determine the optimal allocation of land for each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"CONTINUOUS\", name=\"L1\", lb=0) # amount of land for C1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # amount of land for C2\nL3 = model.addVar(vtype=\"CONTINUOUS\", name=\"L3\", lb=0) # amount of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * L1\nProfit_C2 = 150 * L2\nProfit_C3 = 200 * L3\nResourceUse = 2 * L1 + 3 * L2 + 4 * L3 + L1 + 2 * L2 + 3 * L3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / ResourceUse\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUse == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 units of land available.\nmodel.addCons(L1 + L2 + L3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Land for C1: \", model.getVal(L1))\n    print(\"Amount of Land for C2: \", model.getVal(L2))\n    print(\"Amount of Land for C3: \", model.getVal(L3))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe yield per acre for crop A is 5 tons, for crop B is 7 tons, and for crop C is 9 tons. The cost per acre for crop A is $100, for crop B is $150, and for crop C is $200. The farmer aims to maximize the total yield while considering the cost-effectiveness of each crop. The objective is to maximize the total yield minus a penalty term that increases with the total cost.\n// Yield of crop A: Yield_A = 5 * A\n// Yield of crop B: Yield_B = 7 * B\n// Yield of crop C: Yield_C = 9 * C\n// Total cost: Cost = 100 * A + 150 * B + 200 * C\n// Penalty term: Penalty = 0.01 * Cost^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - Penalty\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $15,000 for cultivation costs.\n// 100 * A + 150 * B + 200 * C <= 15000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize yield while considering the available resources and constraints. The yield per acre and the cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Cost per Acre |\n|------|----------------|---------------|\n| A    | 5 tons         | $100          |\n| B    | 7 tons         | $150          |\n| C    | 9 tons         | $200          |\n\nThe farmer aims to maximize the total yield minus a penalty term that increases with the total cost. The farm has a total of 100 acres available for cultivation. The farmer has a budget of $15,000 for cultivation costs. Please help the farmer to maximize the objective function, which is the total yield minus the penalty term.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nCost = 100 * A + 150 * B + 200 * C\nPenalty = 0.01 * Cost**2\n\n# Set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Penalty)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(100 * A + 150 * B + 200 * C <= 15000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 820,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant aims to maximize the total profit, which is the difference between the total revenue and the total cost.\n// Total revenue: Revenue = 20A + 30B + 40C\n// Total cost: Cost = 10A + 20B + 30C\n// So, the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $1500 for production costs.\n// 10A + 20B + 30C <= 1500\n\n## Generate Constraint-2:\nThe plant has a maximum production capacity of 100 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours.\n// 2A + 3B + 4C <= 100",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize profit while considering production constraints. The profit per unit for product A is $20, for product B is $30, and for product C is $40. The production cost per unit for product A is $10, for product B is $20, and for product C is $30. The plant has a limited budget of $1500 for production costs and a maximum production capacity of 100 hours, with each unit of product A requiring 2 hours, product B requiring 3 hours, and product C requiring 4 hours. Please help the plant to maximize the total profit, which is the difference between the total revenue and the total cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 20 * A + 30 * B + 40 * C\nCost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Revenue - Cost) = Maximize (10A + 10B + 10C)\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n## The plant has a limited budget of $1500 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 1500)\n## The plant has a maximum production capacity of 100 hours.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 743,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, the labor hours allocated to each product, and the marketing budget for each product.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 3\": \"Prod3\", \"range\": \"Prod3 >= 0\", \"type\": \"integer\"}\n// {\"labor hours for Product 1\": \"Labor1\", \"range\": \"Labor1 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 2\": \"Labor2\", \"range\": \"Labor2 >= 0\", \"type\": \"continuous\"}\n// {\"labor hours for Product 3\": \"Labor3\", \"range\": \"Labor3 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 1\": \"Marketing1\", \"range\": \"Marketing1 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 2\": \"Marketing2\", \"range\": \"Marketing2 >= 0\", \"type\": \"continuous\"}\n// {\"marketing budget for Product 3\": \"Marketing3\", \"range\": \"Marketing3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each product is affected by the production quantity, labor hours, and marketing budget. The profit function is nonlinear and includes economies of scale and diminishing returns in labor and marketing. The company aims to maximize the total profit from all three products.\n// Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n// Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n// Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n// So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\n\n## Generate Constraint-1:\nThe total labor hours available for all products cannot exceed 1000 hours.\n// Labor1 + Labor2 + Labor3 <= 1000\n\n## Generate Constraint-2:\nThe total marketing budget for all products must not exceed $50,000.\n// Marketing1 + Marketing2 + Marketing3 <= 50000\n\n## Generate Constraint-3:\nThe production quantity of each product must be at least 10 units.\n// Prod1 >= 10; Prod2 >= 10; Prod3 >= 10",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of three different products, the labor hours allocated to each product, and the marketing budget for each product. The profit from each product is affected by the production quantity, labor hours, and marketing budget, with a nonlinear profit function that includes economies of scale and diminishing returns in labor and marketing. The company aims to maximize the total profit from all three products. The total labor hours available for all products cannot exceed 1000 hours, and the total marketing budget for all products must not exceed $50,000. Additionally, the production quantity of each product must be at least 10 units. Please help the company determine the optimal production quantity, labor hours, and marketing budget for each product to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=10)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=10)  # production quantity of Product 2\nProd3 = model.addVar(vtype=\"INTEGER\", name=\"Prod3\", lb=10)  # production quantity of Product 3\nLabor1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor1\", lb=0)  # labor hours for Product 1\nLabor2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor2\", lb=0)  # labor hours for Product 2\nLabor3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Labor3\", lb=0)  # labor hours for Product 3\nMarketing1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing1\", lb=0)  # marketing budget for Product 1\nMarketing2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing2\", lb=0)  # marketing budget for Product 2\nMarketing3 = model.addVar(vtype=\"CONTINUOUS\", name=\"Marketing3\", lb=0)  # marketing budget for Product 3\n\n# Define objective function\n# Total profit for Product 1: Profit1 = (100 * Prod1 - 0.01 * Prod1^2 + 20 * Labor1 - 0.05 * Labor1^2 + 10 * Marketing1 - 0.1 * Marketing1^2)\n# Total profit for Product 2: Profit2 = (150 * Prod2 - 0.015 * Prod2^2 + 25 * Labor2 - 0.05 * Labor2^2 + 15 * Marketing2 - 0.1 * Marketing2^2)\n# Total profit for Product 3: Profit3 = (200 * Prod3 - 0.02 * Prod3^2 + 30 * Labor3 - 0.05 * Labor3^2 + 20 * Marketing3 - 0.1 * Marketing3^2)\n# So, the objective function is: Maximize TotalProfit = Profit1 + Profit2 + Profit3\nProfit1 = 100 * Prod1 - 0.01 * Prod1**2 + 20 * Labor1 - 0.05 * Labor1**2 + 10 * Marketing1 - 0.1 * Marketing1**2\nProfit2 = 150 * Prod2 - 0.015 * Prod2**2 + 25 * Labor2 - 0.05 * Labor2**2 + 15 * Marketing2 - 0.1 * Marketing2**2\nProfit3 = 200 * Prod3 - 0.02 * Prod3**2 + 30 * Labor3 - 0.05 * Labor3**2 + 20 * Marketing3 - 0.1 * Marketing3**2\nTotalProfit = Profit1 + Profit2 + Profit3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(Labor1 + Labor2 + Labor3 <= 1000)  # total labor hours available for all products cannot exceed 1000 hours\nmodel.addCons(Marketing1 + Marketing2 + Marketing3 <= 50000)  # total marketing budget for all products must not exceed $50,000\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Production Quantity of Product 3: \", model.getVal(Prod3))\n    print(\"Labor Hours for Product 1: \", model.getVal(Labor1))\n    print(\"Labor Hours for Product 2: \", model.getVal(Labor2))\n    print(\"Labor Hours for Product 3: \", model.getVal(Labor3))\n    print(\"Marketing Budget for Product 1: \", model.getVal(Marketing1))\n    print(\"Marketing Budget for Product 2: \", model.getVal(Marketing2))\n    print(\"Marketing Budget for Product 3: \", model.getVal(Marketing3))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 908,
        "var_num": 9,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the cost of irrigation per acre is $100 for crop A, $150 for crop B, and $200 for crop C. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The water usage per acre is 5 units for crop A, 7 units for crop B, and 9 units for crop C.\n// Profit of crop A: Profit_A = (500 - 100) * A\n// Profit of crop B: Profit_B = (700 - 150) * B\n// Profit of crop C: Profit_C = (900 - 200) * C\n// Total water used: Water_used = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre and the cost of irrigation per acre for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost of Irrigation per Acre | Water Usage per Acre |\n|------|-----------------|-----------------------------|----------------------|\n| A    | $500            | $100                        | 5 units              |\n| B    | $700            | $150                        | 7 units              |\n| C    | $900            | $200                        | 9 units              |\n\nThe total available land for cultivation is 100 acres. The farmer wants to ensure at least 20 acres are dedicated to each crop. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used).\nPlease help the farmer to determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 20 acres are dedicated to each crop.\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=20) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * A\nProfit_B = (700 - 150) * B\nProfit_C = (900 - 200) * C\nWater_used = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1017,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new technology that reduces production costs.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing P1 is $30 per unit, and the cost of producing P2 is $40 per unit. The revenue for P1 is $50 per unit, and for P2 is $60 per unit. The new technology reduces the production cost by $1 for every $10,000 invested. The company aims to maximize the total profit from both products.\n// Total profit for P1: Profit_P1 = (50 - 30 + 0.0001 * TechnologyInvestment) * P1\n// Total profit for P2: Profit_P2 = (60 - 40 + 0.0001 * TechnologyInvestment) * P2\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 units for both products combined.\n// P1 + P2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for investing in the new technology.\n// TechnologyInvestment <= 50000\n\n## Generate Constraint-3:\nThe market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1.\n// P1 <= 50",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the production quantities of each product and the amount of money to invest in a new technology that reduces production costs. The cost of producing P1 is $30 per unit, and the cost of producing P2 is $40 per unit. The revenue for P1 is $50 per unit, and for P2 is $60 per unit. The new technology reduces the production cost by $1 for every $10,000 invested. The company aims to maximize the total profit from both products.\nThe company has a total production capacity of 200 units for both products combined. The company has a budget of $50,000 for investing in the new technology. The market demand for P1 is 50 units. So, the company can only sell a maximum of 50 units of P1.\nPlease help the company to determine the optimal production quantities of P1 and P2, and the amount to invest in the new technology to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0, ub=50)  # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0)  # quantity of P2\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfit_P1 = (50 - 30 + 0.0001 * TechnologyInvestment) * P1\nProfit_P2 = (60 - 40 + 0.0001 * TechnologyInvestment) * P2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\nmodel.addCons(P1 + P2 <= 200)\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Investment in New Technology: \", model.getVal(TechnologyInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 934,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n// Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n// So, the objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\n// MachinesA <= 10; MachinesB <= 12; MachinesC <= 8",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\nThe company has a total of 25 machines available for allocation. Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\nPlease help the company to maximize the total production output while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0, ub=10)  # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0, ub=12)  # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0, ub=8)    # number of machines for ComponentC\n\n# Define objective function\nOutput = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\nCost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n# So, the objective function is: Maximize (Output - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n# The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1012,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, but it requires 2 hours of labor and 3 units of raw material. Product B yields a profit of $70 per unit, requiring 3 hours of labor and 2 units of raw material. Product C yields a profit of $60 per unit, requiring 4 hours of labor and 1 unit of raw material. The company wants to maximize the total profit.\n// Total profit: Profit = 50A + 70B + 60C\n// Objective: Maximize Profit\n\n## Generate Constraint-1:\nThe total labor hours available per day are 200 hours.\n// 2A + 3B + 4C <= 200",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit while considering the production capacity and market demand. The profit per unit, labor hours required, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours Required | Raw Material Units Required |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $50             | 2                    | 3                           |\n| B       | $70             | 3                    | 2                           |\n| C       | $60             | 4                    | 1                           |\n\nThe company wants to maximize the total profit. The total labor hours available per day are 200 hours. Please help the company determine the optimal number of units to produce for each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 60C\nmodel.addCons(obj == 50*A + 70*B + 60*C)\n\n# Add constraints\n## The total labor hours available per day are 200 hours.\nmodel.addCons(2*A + 3*B + 4*C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 963,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 20 units per worker per hour, tablets are 15 units per worker per hour, and laptops are 10 units per worker per hour. The manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required.\n// Total hours for smartphones: H_S = 1000 / (20 * S)\n// Total hours for tablets: H_T = 800 / (15 * T)\n// Total hours for laptops: H_L = 500 / (10 * L)\n// The objective function is: Minimize max(H_S, H_T, H_L)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// S <= 20; T <= 20; L <= 20",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production rate of smartphones is 20 units per worker per hour, tablets are 15 units per worker per hour, and laptops are 10 units per worker per hour. The manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required. The manufacturer has a total of 50 workers available and each production line can accommodate a maximum of 20 workers. Please help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum of the total labor hours required for each device.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nH_S = 1000 / (20 * S)\nH_T = 800 / (15 * T)\nH_L = 500 / (10 * L)\n## convert the division to multiplication\nmodel.addCons(obj >= H_S)\nmodel.addCons(obj >= H_T)\nmodel.addCons(obj >= H_L)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(S + T + L <= 50)\n## Each production line can accommodate a maximum of 20 workers.\nmodel.addCons(S <= 20)\nmodel.addCons(T <= 20)\nmodel.addCons(L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimum Labor Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 690,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production process by adjusting the production rate, the number of workers, and the level of automation investment. The production rate determines the number of units produced per hour, the number of workers affects the labor cost, and the automation investment reduces the labor cost per unit.\n// {\"production rate\": \"ProductionRate\", \"range\": \"ProductionRate >= 0\", \"type\": \"continuous\"}\n// {\"number of workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n// {\"automation investment\": \"AutomationInvestment\", \"range\": \"AutomationInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per unit decreases by $0.5 for every $1000 invested in automation. The initial labor cost per unit is $10. The selling price per unit is $15. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (15 - 10 + 0.0005 * AutomationInvestment) * ProductionRate * Workers\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company can hire a maximum of 100 workers.\n// Workers <= 100\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// AutomationInvestment <= 50000\n\n## Generate Constraint-3:\nThe production rate must be at least 5 units per hour.\n// ProductionRate >= 5\n\n## Generate Constraint-4:\nThe number of workers must be at least 20 to maintain basic operations.\n// Workers >= 20",
        "question": "A manufacturing company is planning to optimize its production process by adjusting the production rate, the number of workers, and the level of automation investment. The production rate determines the number of units produced per hour, the number of workers affects the labor cost, and the automation investment reduces the labor cost per unit. The labor cost per unit decreases by $0.5 for every $1000 invested in automation. The initial labor cost per unit is $10, and the selling price per unit is $15. The company aims to maximize the total profit from the production.\n\n| Parameter                | Description                                                                 |\n|--------------------------|-----------------------------------------------------------------------------|\n| Production Rate          | Number of units produced per hour                                          |\n| Number of Workers        | Affects the labor cost                                                     |\n| Automation Investment    | Reduces labor cost per unit by $0.5 for every $1000 invested               |\n\nThe company can hire a maximum of 100 workers. The total investment in automation cannot exceed $50,000. The production rate must be at least 5 units per hour. The number of workers must be at least 20 to maintain basic operations.\n\nPlease help the company to maximize the total profit from the production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductionRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductionRate\", lb=5)  # production rate\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=20)  # number of workers\nAutomationInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"AutomationInvestment\", lb=0)  # automation investment\n\n# Define objective function\nProfit = (15 - 10 + 0.0005 * AutomationInvestment) * ProductionRate * Workers\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Workers <= 100)\nmodel.addCons(AutomationInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate: \", model.getVal(ProductionRate))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Automation Investment: \", model.getVal(AutomationInvestment))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1415,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the production process is such that the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) = Maximize (50 * A / (1 + 0.01 * A^2) + 70 * B / (1 + 0.02 * B^2) + 90 * C / (1 + 0.03 * C^2))\n\n## Generate Constraint-1:\nThe total production capacity of the factory is limited to 1000 units per week.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 200 units per week.\n// A >= 200",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize their profit while considering the production capacity and market demand.\nThe profit per unit of component A is $50, component B is $70, and component C is $90. However, the profit per unit decreases nonlinearly with the number of units produced due to economies of scale. The profit functions are: Profit_A = 50 * A / (1 + 0.01 * A^2), Profit_B = 70 * B / (1 + 0.02 * B^2), Profit_C = 90 * C / (1 + 0.03 * C^2). The company aims to maximize the total profit from all components.\nThe total production capacity of the factory is limited to 1000 units per week. The market demand for component A is at least 200 units per week.\nPlease help the company to maximize the total profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0)    # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0)    # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## Profit functions with nonlinear decrease\nProfit_A = 50 * A / (1 + 0.01 * A**2)\nProfit_B = 70 * B / (1 + 0.02 * B**2)\nProfit_C = 90 * C / (1 + 0.03 * C**2)\n\n## Convert the division to multiplication\nmodel.addCons(obj * (1 + 0.01 * A**2) == 50 * A)\nmodel.addCons(obj * (1 + 0.02 * B**2) == 70 * B)\nmodel.addCons(obj * (1 + 0.03 * C**2) == 90 * C)\n\n# Add constraints\n## Total production capacity constraint\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 865,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $10, but it increases by $0.02 for every unit produced after the 100th unit. The profit per unit of component B is $15, which increases by $0.03 for every unit produced after the 150th unit. The profit per unit of component C is $20, which increases by $0.04 for every unit produced after the 200th unit. The company aims to maximize the total profit from selling these components.\n// Profit_A = max(10 + 0.02 * (A - 100), 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150), 15) * B\n// Profit_C = max(20 + 0.04 * (C - 200), 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for component A is $5 per unit, for component B is $7 per unit, and for component C is $9 per unit. The company has a budget of $1000 for production costs.\n// 5 * A + 7 * B + 9 * C <= 1000\n\n## Generate Constraint-2:\nThe market demand for component A is at most 300 units, for component B is at most 250 units, and for component C is at most 200 units.\n// A <= 300; B <= 250; C <= 200\n\n## Generate Constraint-3:\nThe company has a production capacity of 600 units in total.\n// A + B + C <= 600",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The company needs to determine the optimal number of each component to produce to maximize profit while considering production constraints and market demand. The profit per unit of each component and the production cost are given in the following Table.\n\n| Component | Profit per Unit | Production Cost per Unit |\n|-----------|-----------------|---------------------------|\n| A         | $10 (increases by $0.02 after 100 units) | $5 |\n| B         | $15 (increases by $0.03 after 150 units) | $7 |\n| C         | $20 (increases by $0.04 after 200 units) | $9 |\n\nThe company has a budget of $1000 for production costs. The market demand for component A is at most 300 units, for component B is at most 250 units, and for component C is at most 200 units. The company has a production capacity of 600 units in total.\n\nPlease help the company to maximize the total profit from selling these components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The market demand for component A is at most 300 units, for component B is at most 250 units, and for component C is at most 200 units.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=300) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=200) # number of units of component C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100), 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=300)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150), 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.04 * (C - 200), 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=200)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.04 * (C2 - 200)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 7 * B + 9 * C <= 1000)\nmodel.addCons(A + B + C <= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 973,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity.\n// {\"production rate of C1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of C2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of C3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant aims to maximize the total profit.\n// Profit_C1 = 10 * P1 * 0.8 * P1\n// Profit_C2 = 15 * P2 * 0.9 * P2\n// Profit_C3 = 20 * P3 * 1.1 * P3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\n// P1 <= 50; P2 <= 50; P3 <= 50\n\n## Generate Constraint-2:\nThe storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\n// P1 + P2 + P3 <= 100",
        "question": "A manufacturing plant produces three types of chemicals: C1, C2, and C3. The plant needs to determine the optimal production rates for each chemical to maximize profit while considering the constraints of raw material availability and storage capacity. The profit per unit of C1 is $10, C2 is $15, and C3 is $20. The production process is nonlinear due to varying efficiencies at different production rates. The efficiency of producing C1 is 0.8 * P1, C2 is 0.9 * P2, and C3 is 1.1 * P3. The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical. The storage capacity for each chemical is limited, and the total amount of chemicals produced per hour must not exceed 100 units. Please help the plant to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of C1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of C2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 10 * P1 * 0.8 * P1\nProfit_C2 = 15 * P2 * 0.9 * P2\nProfit_C3 = 20 * P3 * 1.1 * P3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The plant has a limited supply of raw materials, which allows for a maximum production rate of 50 units per hour for each chemical.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 50)\nmodel.addCons(P3 <= 50)\n## The storage capacity for each chemical is limited. The total amount of chemicals produced per hour must not exceed 100 units.\nmodel.addCons(P1 + P2 + P3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of C1: \", model.getVal(P1))\n    print(\"Production Rate of C2: \", model.getVal(P2))\n    print(\"Production Rate of C3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 801,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\n// Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\n// Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBProduction <= 2 * DeviceAProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint that limits the total cost of production to $20,000. The cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction <= 20,000",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget constraint that limits the total cost of production to $20,000. The cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=0)\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=0)\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=0)\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAProduction == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBProduction == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCProduction == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 90 * DeviceC1 * DeviceC_b1 + (90 - 0.02 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500)\nmodel.addCons(DeviceBProduction <= 2 * DeviceAProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 926,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production efficiency varies for each device and depends on the number of workers assigned to each production line.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rate of smartphones is 20 units per worker per hour, tablets are 15 units per worker per hour, and laptops are 10 units per worker per hour. The manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required.\n// Total hours for smartphones: H_S = 1000 / (20 * S)\n// Total hours for tablets: H_T = 800 / (15 * T)\n// Total hours for laptops: H_L = 500 / (10 * L)\n// The objective function is: Minimize max(H_S, H_T, H_L)\n\n## Generate Constraint-1:\nThe manufacturer has a total of 50 workers available.\n// S + T + L <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate a maximum of 20 workers.\n// S <= 20; T <= 20; L <= 20\n\n## Generate Constraint-3:\nThe manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\n// S >= 5; T >= 5; L >= 5",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production rate of smartphones is 20 units per worker per hour, tablets are 15 units per worker per hour, and laptops are 10 units per worker per hour. The manufacturer aims to meet a daily demand of 1000 smartphones, 800 tablets, and 500 laptops while minimizing the total labor hours required. The manufacturer has a total of 50 workers available and each production line can accommodate a maximum of 20 workers. Additionally, the manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\nPlease help the manufacturer determine the optimal number of workers to assign to each production line to minimize the maximum of the total labor hours required for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer must assign at least 5 workers to each production line to maintain basic operational efficiency.\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=5) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=5) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=5) # number of workers on laptop production\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nH_S = 1000 / (20 * S)\nH_T = 800 / (15 * T)\nH_L = 500 / (10 * L)\n## The objective function is: Minimize max(H_S, H_T, H_L)\n## convert the division to multiplication\nmodel.addCons(obj >= H_S)\nmodel.addCons(obj >= H_T)\nmodel.addCons(obj >= H_L)\n\n# Add constraints\n## The manufacturer has a total of 50 workers available.\nmodel.addCons(S + T + L <= 50)\n## Each production line can accommodate a maximum of 20 workers.\nmodel.addCons(S <= 20)\nmodel.addCons(T <= 20)\nmodel.addCons(L <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Minimized Labor Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 818,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n// Net revenue of A: Revenue_A = (1000 - 400) * A\n// Net revenue of B: Revenue_B = (1500 - 600) * B\n// Net revenue of C: Revenue_C = (2000 - 800) * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (5 * A + 8 * B + 10 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $100,000 for seed costs for the upcoming season.\n// 400 * A + 600 * B + 800 * C <= 100000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop for the upcoming season.\nFor Crop A, the expected revenue per acre is $1000, the cost of seeds per acre is $400, and the required labor hours per acre is 5.\nFor Crop B, the expected revenue per acre is $1500, the cost of seeds per acre is $600, and the required labor hours per acre is 8.\nFor Crop C, the expected revenue per acre is $2000, the cost of seeds per acre is $800, and the required labor hours per acre is 10.\nThe farm has a budget of $100,000 for seed costs for the upcoming season.\nPlease help the farm to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = (1000 - 400) * A\nRevenue_B = (1500 - 600) * B\nRevenue_C = (2000 - 800) * C\nLaborHours = 5 * A + 8 * B + 10 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a budget of $100,000 for seed costs for the upcoming season.\nmodel.addCons(400 * A + 600 * B + 800 * C <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 765,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield.\n// {\"temperature setting for greenhouse A\": \"T_A\", \"range\": \"0 <= T_A <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse B\": \"T_B\", \"range\": \"0 <= T_B <= 100\", \"type\": \"real\"}\n// {\"temperature setting for greenhouse C\": \"T_C\", \"range\": \"0 <= T_C <= 100\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases. The farm aims to maximize the total yield from all greenhouses.\n// Yield of greenhouse A: Yield_A = (T_A^2 / 100) - (T_A - 50)^2\n// Yield of greenhouse B: Yield_B = (T_B^2 / 100) - (T_B - 70)^2\n// Yield of greenhouse C: Yield_C = (T_C^2 / 100) - (T_C - 60)^2\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\n\n## Generate Constraint-1:\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2.\n// T_A^2 + T_B^2 + T_C^2 <= 150",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be adjusted to different temperatures to optimize the growth of specific crops. The farm needs to determine the optimal temperature settings for each greenhouse to maximize crop yield. The yield of crops in greenhouse A increases with temperature up to 50 degrees and then decreases. The yield in greenhouse B increases with temperature up to 70 degrees and then decreases. The yield in greenhouse C increases with temperature up to 60 degrees and then decreases.\n\n| Greenhouse | Temperature Effect on Yield |\n|------------|------------------------------|\n| A          | Up to 50 degrees, then decreases |\n| B          | Up to 70 degrees, then decreases |\n| C          | Up to 60 degrees, then decreases |\n\nThe total energy consumption for all greenhouses must not exceed 150 energy units. The energy consumption for greenhouse A is T_A^2, for greenhouse B is T_B^2, and for greenhouse C is T_C^2. The farm aims to maximize the total yield from all greenhouses.\n\nPlease help the farm determine the optimal temperature settings for each greenhouse (T_A, T_B, T_C) within the range of 0 to 100 degrees to maximize the total yield while meeting the energy constraint.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT_A = model.addVar(vtype=\"CONTINUOUS\", name=\"T_A\", lb=0, ub=100) # temperature setting for greenhouse A\nT_B = model.addVar(vtype=\"CONTINUOUS\", name=\"T_B\", lb=0, ub=100) # temperature setting for greenhouse B\nT_C = model.addVar(vtype=\"CONTINUOUS\", name=\"T_C\", lb=0, ub=100) # temperature setting for greenhouse C\n\n# Define objective function\nYield_A = (T_A**2 / 100) - (T_A - 50)**2\nYield_B = (T_B**2 / 100) - (T_B - 70)**2\nYield_C = (T_C**2 / 100) - (T_C - 60)**2\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n# The total energy consumption for all greenhouses must not exceed 150 energy units.\nmodel.addCons(T_A**2 + T_B**2 + T_C**2 <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Temperature setting for greenhouse A: \", model.getVal(T_A))\n    print(\"Temperature setting for greenhouse B: \", model.getVal(T_B))\n    print(\"Temperature setting for greenhouse C: \", model.getVal(T_C))\n    print(\"Maximized Total Yield: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1251,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities for each device to optimize their profit.\n// {\"quantity of DeviceA\": \"DeviceA\", \"range\": \"DeviceA >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceB\": \"DeviceB\", \"range\": \"DeviceB >= 0\", \"type\": \"integer\"}\n// {\"quantity of DeviceC\": \"DeviceC\", \"range\": \"DeviceC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. Due to economies of scale, the profit per unit increases by $0.1 for each additional 10 units produced for each type of device. The company aims to maximize the total profit from the sales of these devices.\n// Profit_DeviceA = (100 + 0.1 * floor((DeviceA - 1) / 10)) * DeviceA\n// Profit_DeviceB = (150 + 0.1 * floor((DeviceB - 1) / 10)) * DeviceB\n// Profit_DeviceC = (200 + 0.1 * floor((DeviceC - 1) / 10)) * DeviceC\n// So, the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units across all devices.\n// DeviceA + DeviceB + DeviceC <= 500",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantities for each device to optimize their profit. The profit per unit for DeviceA is $100, for DeviceB is $150, and for DeviceC is $200. Due to economies of scale, the profit per unit increases by $0.1 for each additional 10 units produced for each type of device. The company aims to maximize the total profit from the sales of these devices. The company has a total production capacity of 500 units across all devices. Please help the company determine the optimal production quantities for each device to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceA = model.addVar(vtype=\"INTEGER\", name=\"DeviceA\", lb=0) # quantity of DeviceA\nDeviceB = model.addVar(vtype=\"INTEGER\", name=\"DeviceB\", lb=0) # quantity of DeviceB\nDeviceC = model.addVar(vtype=\"INTEGER\", name=\"DeviceC\", lb=0) # quantity of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (100 + 0.1 * floor((DeviceA - 1) / 10)) * DeviceA\nDeviceA_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceA_segment_{i}\") for i in range(50)]\nDeviceA_profits = [100 + 0.1 * i for i in range(50)]\nDeviceA_profit = sum(profit * segment for profit, segment in zip(DeviceA_profits, DeviceA_segments))\n## create piecewise variables for piecewise function: Profit_DeviceB = (150 + 0.1 * floor((DeviceB - 1) / 10)) * DeviceB\nDeviceB_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceB_segment_{i}\") for i in range(50)]\nDeviceB_profits = [150 + 0.1 * i for i in range(50)]\nDeviceB_profit = sum(profit * segment for profit, segment in zip(DeviceB_profits, DeviceB_segments))\n## create piecewise variables for piecewise function: Profit_DeviceC = (200 + 0.1 * floor((DeviceC - 1) / 10)) * DeviceC\nDeviceC_segments = [model.addVar(vtype=\"INTEGER\", name=f\"DeviceC_segment_{i}\") for i in range(50)]\nDeviceC_profits = [200 + 0.1 * i for i in range(50)]\nDeviceC_profit = sum(profit * segment for profit, segment in zip(DeviceC_profits, DeviceC_segments))\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_DeviceA + Profit_DeviceB + Profit_DeviceC\nmodel.addCons(obj == DeviceA_profit + DeviceB_profit + DeviceC_profit)\n\n# Add constraints\nmodel.addCons(DeviceA + DeviceB + DeviceC <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(DeviceA))\n    print(\"Quantity of DeviceB: \", model.getVal(DeviceB))\n    print(\"Quantity of DeviceC: \", model.getVal(DeviceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 676,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, but it requires 2 units of water per acre. \nFor crop B, the profit per acre is $700, requiring 3 units of water per acre. \nFor crop C, the profit per acre is $1000, requiring 4 units of water per acre.\nThe farm has a limited water supply and must balance the use of water with the desire to maximize profits. The objective is to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\n// Profit from crop A: Profit_A = 500 * A\n// Profit from crop B: Profit_B = 700 * B\n// Profit from crop C: Profit_C = 1000 * C\n// Water usage for crops: Water_A = 2 * A, Water_B = 3 * B, Water_C = 4 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a water supply of 300 units.\n// 2 * A + 3 * B + 4 * C <= 300",
        "question": "A farm produces three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to maximize the farm's profitability while considering the soil conditions and market demands. The profit per acre and water requirements for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Water Required per Acre |\n|------|-----------------|-------------------------|\n| A    | $500            | 2 units                 |\n| B    | $700            | 3 units                 |\n| C    | $1000           | 4 units                 |\n\nThe farm has a total of 100 acres available for cultivation. The farm has a water supply of 300 units. The objective is to maximize the total profit while considering the water usage efficiency (profit per unit of water used).\nPlease help the farmer to determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 1000 * C\nWater_A = 2 * A\nWater_B = 3 * B\nWater_C = 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Water_A + Water_B + Water_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_A + Water_B + Water_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a water supply of 300 units.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 879,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop.\n// {\"area of land for wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"area of land for corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"area of land for barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\n// Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n// Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n// Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n// So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\n\n## Generate Constraint-1:\nThe total area of land available for farming is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $10000 for irrigation and fertilization costs.\n// 50 * W^2 + 60 * C^2 + 40 * B^2 + 30 * W^1.5 + 40 * C^1.5 + 20 * B^1.5 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat.\n// W <= 50",
        "question": "A farmer grows three types of crops: wheat, corn, and barley. He needs to determine the area of land to allocate to each crop. The farmer's profit per hectare for wheat is $1000, for corn is $1200, and for barley is $800. The farmer also incurs costs for irrigation and fertilization, which are nonlinear functions of the area planted. The irrigation cost for wheat is $50 * W^2, for corn is $60 * C^2, and for barley is $40 * B^2. The fertilization cost for wheat is $30 * W^1.5, for corn is $40 * C^1.5, and for barley is $20 * B^1.5. The farmer wants to maximize his net profit.\nThe total area of land available for farming is 100 hectares. The farmer has a budget of $10000 for irrigation and fertilization costs. The market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat.\nPlease help the farmer to maximize his net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # area of land for wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area of land for corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area of land for barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_wheat = 1000 * W - 50 * W^2 - 30 * W^1.5\n## Profit_corn = 1200 * C - 60 * C^2 - 40 * C^1.5\n## Profit_barley = 800 * B - 40 * B^2 - 20 * B^1.5\n## So, the objective function is: Maximize (Profit_wheat + Profit_corn + Profit_barley)\nmodel.addCons(obj == 1000 * W - 50 * W**2 - 30 * W**1.5 + 1200 * C - 60 * C**2 - 40 * C**1.5 + 800 * B - 40 * B**2 - 20 * B**1.5)\n\n# Add constraints\n## The total area of land available for farming is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a budget of $10000 for irrigation and fertilization costs.\nmodel.addCons(50 * W**2 + 60 * C**2 + 40 * B**2 + 30 * W**1.5 + 40 * C**1.5 + 20 * B**1.5 <= 10000)\n## The market demand for wheat is 50 hectares. So, the farmer can only plant a maximum of 50 hectares of wheat.\nmodel.addCons(W <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for Wheat: \", model.getVal(W))\n    print(\"Area of Land for Corn: \", model.getVal(C))\n    print(\"Area of Land for Barley: \", model.getVal(B))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 877,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investment in production efficiency.\n// Efficiency <= 10000\n\n## Generate Constraint-3:\nThe company has a limited raw material budget of $5000.\n// 30 * A + 50 * B <= 5000\n\n## Generate Constraint-4:\nThe market demand for Product A is 100 units. So, the company can only sell a maximum of 100 units of Product A.\n// A <= 100\n\n## Generate Constraint-5:\nThe market demand for Product B is 80 units. So, the company can only sell a maximum of 80 units of Product B.\n// B <= 80",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company has a total production capacity of 200 hours and a budget of $10,000 for investment in production efficiency. The company also has a limited raw material budget of $5000. The market demand for Product A is 100 units, and for Product B is 80 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=80) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n## The company has a budget of $10,000 for investment in production efficiency.\nmodel.addCons(Efficiency <= 10000)\n## The company has a limited raw material budget of $5000.\nmodel.addCons(30 * A + 50 * B <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $6000 for cultivation costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 6000\n\n## Generate Constraint-3:\nThe market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\n// 5 * C1 <= 300\n\n## Generate Constraint-4:\nThe farmer must allocate at least 20% of the total land to C2 to maintain crop diversity.\n// C2 >= 0.2 * (C1 + C2 + C3)",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. The yield per acre, price per ton, and cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Price per Ton | Cost per Acre |\n|------|---------------|---------------|---------------|\n| C1   | 5 tons        | $100          | $50           |\n| C2   | 6 tons        | $120          | $60           |\n| C3   | 7 tons        | $140          | $70           |\n\nThe farmer has a total of 100 acres available for cultivation. The farmer has a budget of $6000 for cultivation costs. The market demand for C1 is 300 tons, which translates to a maximum of 60 acres of C1. The farmer must allocate at least 20% of the total land to C2 to maintain crop diversity. \nPlease help the farmer to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farmer has a budget of $6000 for cultivation costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 6000)\n## The market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\nmodel.addCons(5 * C1 <= 300)\n## The farmer must allocate at least 20% of the total land to C2 to maintain crop diversity.\nmodel.addCons(C2 >= 0.2 * (C1 + C2 + C3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 902,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel efficiency and maintenance costs. \nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\n// Operational cost for TruckA: Cost_TruckA = 500 / 10 * TruckA\n// Operational cost for TruckB: Cost_TruckB = 700 / 15 * TruckB\n// Operational cost for TruckC: Cost_TruckC = 900 / 20 * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per month for vehicle maintenance.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC <= 10,000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 100 tons.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC >= 100\n\n## Generate Constraint-3:\nDue to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined.\n// TruckC <= 0.5 * (TruckA + TruckB)\n\n## Generate Constraint-4:\nEach type of truck must have at least one vehicle in the fleet.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1",
        "question": "A logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity. The fuel efficiency, maintenance cost, and cargo capacity for each type of truck are given in the following Table.\n\n| Vehicle Type | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|--------------|-----------------------|----------------------------|-----------------------|\n| TruckA       | 10                    | 500                        | 5                     |\n| TruckB       | 15                    | 700                        | 7                     |\n| TruckC       | 20                    | 900                        | 10                    |\n\nThe company has a total budget of $10,000 per month for vehicle maintenance. The total cargo capacity of the fleet must be at least 100 tons. Due to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined. Each type of truck must have at least one vehicle in the fleet. \n\nPlease help the company to minimize the total operational cost, which is calculated as (maintenance cost) / (fuel efficiency) for each vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1)  # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1)  # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1)  # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = (500 / 10) * TruckA\nCost_TruckB = (700 / 15) * TruckB\nCost_TruckC = (900 / 20) * TruckC\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n## The company has a total budget of $10,000 per month for vehicle maintenance.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC <= 10000)\n## The total cargo capacity of the fleet must be at least 100 tons.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC >= 100)\n## Due to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined.\nmodel.addCons(TruckC <= 0.5 * (TruckA + TruckB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1259,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per hectare is $500, the water requirement is 1000 liters, and the labor hours needed are 50 hours.\nFor Crop B, the expected profit per hectare is $700, the water requirement is 1500 liters, and the labor hours needed are 70 hours.\nFor Crop C, the expected profit per hectare is $900, the water requirement is 2000 liters, and the labor hours needed are 90 hours.\nThe farm aims to maximize the profit per labor hour (which is defined as the total profit divided by the total labor hours).\n// Profit from A: Profit_A = 500 * A\n// Profit from B: Profit_B = 700 * B\n// Profit from C: Profit_C = 900 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (50 * A + 70 * B + 90 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 10000 liters of water available for irrigation.\n// 1000 * A + 1500 * B + 2000 * C <= 10000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 5 hectares to each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season. The expected profit per hectare, water requirement, and labor hours needed for each crop are given in the following Table.\n\n| Crop | Expected Profit per Hectare | Water Requirement per Hectare | Labor Hours Needed per Hectare |\n|------|------------------------------|-------------------------------|--------------------------------|\n| A    | $500                        | 1000 liters                   | 50 hours                       |\n| B    | $700                        | 1500 liters                   | 70 hours                       |\n| C    | $900                        | 2000 liters                   | 90 hours                       |\n\nThe farm has a total of 10000 liters of water available for irrigation. The farm wants to allocate at least 5 hectares to each crop. \nPlease help the farm to maximize the profit per labor hour (which is defined as the total profit divided by the total labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 hectares to each crop.\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=5) # hectares of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=5) # hectares of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=5) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nLaborHours = 50 * A + 70 * B + 90 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 10000 liters of water available for irrigation.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit per Labor Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1052,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment.\n// {\"production quantity of DeviceA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of DeviceC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices.\n// Total cost for DeviceA: CostA = (100 - 0.0001 * Automation) * QuantityA\n// Total cost for DeviceB: CostB = (150 - 0.0001 * Automation) * QuantityB\n// Total cost for DeviceC: CostC = (200 - 0.0001 * Automation) * QuantityC\n// Total revenue for DeviceA: RevenueA = 150 * QuantityA\n// Total revenue for DeviceB: RevenueB = 200 * QuantityB\n// Total revenue for DeviceC: RevenueC = 250 * QuantityC\n// Total profit: Profit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for automation investment.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all devices is 10,000 units.\n// QuantityA + QuantityB + QuantityC <= 10000\n\n## Generate Constraint-3:\nDue to market demand, DeviceA must be produced at least twice as much as DeviceB.\n// QuantityA >= 2 * QuantityB\n\n## Generate Constraint-4:\nThe company must ensure that at least 1,000 units of each device are produced.\n// QuantityA >= 1000; QuantityB >= 1000; QuantityC >= 1000\n\n## Generate Constraint-5:\nThe total cost of production, including automation investment, must not exceed $1,500,000.\n// (100 - 0.0001 * Automation) * QuantityA + (150 - 0.0001 * Automation) * QuantityB + (200 - 0.0001 * Automation) * QuantityC + Automation <= 1500000",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide the production quantity of each device and the level of automation to implement in the production process. Higher levels of automation reduce production costs but increase initial investment. The production cost per unit of DeviceA is $100, DeviceB is $150, and DeviceC is $200. Implementing automation reduces the production cost per unit by $1 for every $10,000 invested in automation. The selling price per unit of DeviceA is $150, DeviceB is $200, and DeviceC is $250. The company aims to maximize the total profit from all devices.\n\nThe company has a budget of $100,000 for automation investment. The total production capacity for all devices is 10,000 units. Due to market demand, DeviceA must be produced at least twice as much as DeviceB. The company must ensure that at least 1,000 units of each device are produced. The total cost of production, including automation investment, must not exceed $1,500,000.\n\nPlease help the company to maximize the total profit from all devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=1000) # production quantity of DeviceA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=1000) # production quantity of DeviceB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=1000) # production quantity of DeviceC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nCostA = (100 - 0.0001 * Automation) * QuantityA\nCostB = (150 - 0.0001 * Automation) * QuantityB\nCostC = (200 - 0.0001 * Automation) * QuantityC\nRevenueA = 150 * QuantityA\nRevenueB = 200 * QuantityB\nRevenueC = 250 * QuantityC\nProfit = (RevenueA - CostA) + (RevenueB - CostB) + (RevenueC - CostC)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Automation <= 100000)\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 10000)\nmodel.addCons(QuantityA >= 2 * QuantityB)\nmodel.addCons((100 - 0.0001 * Automation) * QuantityA + (150 - 0.0001 * Automation) * QuantityB + (200 - 0.0001 * Automation) * QuantityC + Automation <= 1500000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of DeviceA: \", model.getVal(QuantityA))\n    print(\"Quantity of DeviceB: \", model.getVal(QuantityB))\n    print(\"Quantity of DeviceC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1115,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of machines to allocate to each type of component to optimize production efficiency.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate for producing each type of component. Machine 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Machine 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Machine 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The company needs to produce at least 1000 units of A, 1500 units of B, and 2000 units of C daily. The machines can only operate or be idle simultaneously. Determine the minimum operating time to meet the daily demand.\n// The operating time for component A: T1 = 1000 / (10 * M1 + 15 * M2 + 20 * M3)\n// The operating time for component B: T2 = 1500 / (15 * M1 + 20 * M2 + 25 * M3)\n// The operating time for component C: T3 = 2000 / (20 * M1 + 25 * M2 + 30 * M3)\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThere are a total of 30 machines available.\n// M1 + M2 + M3 <= 30",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of machines to allocate to each type of component to optimize production efficiency. Each machine has a different efficiency rate for producing each type of component. Machine 1 produces 10 units of A, 15 units of B, and 20 units of C per hour. Machine 2 produces 15 units of A, 20 units of B, and 25 units of C per hour. Machine 3 produces 20 units of A, 25 units of B, and 30 units of C per hour. The company needs to produce at least 1000 units of A, 1500 units of B, and 2000 units of C daily. The machines can only operate or be idle simultaneously. There are a total of 30 machines available.\nPlease help the company determine the minimum operating time to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The operating time for component A: T1 = 1000 / (10 * M1 + 15 * M2 + 20 * M3)\n## The operating time for component B: T2 = 1500 / (15 * M1 + 20 * M2 + 25 * M3)\n## The operating time for component C: T3 = 2000 / (20 * M1 + 25 * M2 + 30 * M3)\n## So, the objective function is: Minimize max(T1, T2, T3)\n## Convert the division to multiplication\nT1 = model.addVar(name=\"T1\")\nT2 = model.addVar(name=\"T2\")\nT3 = model.addVar(name=\"T3\")\nmodel.addCons(T1 * (10 * M1 + 15 * M2 + 20 * M3) == 1000)\nmodel.addCons(T2 * (15 * M1 + 20 * M2 + 25 * M3) == 1500)\nmodel.addCons(T3 * (20 * M1 + 25 * M2 + 30 * M3) == 2000)\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## There are a total of 30 machines available.\nmodel.addCons(M1 + M2 + M3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Minimum Operating Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 808,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints.\n// {\"quantity of chemical A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of chemical C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n// Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\n// Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\n// Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available.\n// 5 * A + 8 * B + 10 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n// A <= 200; B <= 250; C <= 300",
        "question": "A manufacturing company produces three types of chemicals: A, B, and C. The company needs to determine the optimal quantities of each chemical to produce to maximize its profit while adhering to certain production constraints. The profit per unit of chemical A is $10, but it increases by $0.02 for every 10 units produced beyond 100 units. The profit per unit of chemical B is $15, but it increases by $0.03 for every 15 units produced beyond 150 units. The profit per unit of chemical C is $20, but it increases by $0.01 for every 20 units produced beyond 200 units. The company aims to maximize the total profit from the production of these chemicals.\n\nThe production of each chemical requires a specific amount of raw material. Chemical A requires 5 kg, chemical B requires 8 kg, and chemical C requires 10 kg. The company has a total of 1000 kg of raw material available. Additionally, the company has a storage capacity limit for each chemical. Chemical A can be stored up to 200 units, chemical B up to 250 units, and chemical C up to 300 units.\n\nPlease help the company to determine the optimal quantities of chemicals A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=200) # quantity of chemical A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=250) # quantity of chemical B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # quantity of chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = max(10 + 0.02 * (A - 100) / 10, 10) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=200)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 10 * A1 * A_b1 + (10 + 0.02 * (A2 - 100) / 10) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = max(15 + 0.03 * (B - 150) / 15, 15) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=250)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 15 * B1 * B_b1 + (15 + 0.03 * (B2 - 150) / 15) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = max(20 + 0.01 * (C - 200) / 20, 20) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 20 * C1 * C_b1 + (20 + 0.01 * (C2 - 200) / 20) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(5 * A + 8 * B + 10 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Chemical A: \", model.getVal(A))\n    print(\"Quantity of Chemical B: \", model.getVal(B))\n    print(\"Quantity of Chemical C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1170,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season.\n// {\"amount of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"amount of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"amount of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the selling price is $2 per unit, the cost of seeds is $0.5 per unit, and the water consumption is 3 liters per unit. \nFor Crop B, the selling price is $3 per unit, the cost of seeds is $1 per unit, and the water consumption is 5 liters per unit. \nFor Crop C, the selling price is $4 per unit, the cost of seeds is $1.5 per unit, and the water consumption is 7 liters per unit.\nThe farmer aims to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\n// Net profit of A: Profit_A = (2 - 0.5) * A\n// Net profit of B: Profit_B = (3 - 1) * B\n// Net profit of C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 5 * B + 7 * C)\n\n## Generate Constraint-1:\nThe farmer has a budget of $500 for seeds.\n// 0.5 * A + 1 * B + 1.5 * C <= 500",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season.\nFor Crop A, the selling price is $2 per unit, the cost of seeds is $0.5 per unit, and the water consumption is 3 liters per unit. \nFor Crop B, the selling price is $3 per unit, the cost of seeds is $1 per unit, and the water consumption is 5 liters per unit. \nFor Crop C, the selling price is $4 per unit, the cost of seeds is $1.5 per unit, and the water consumption is 7 liters per unit.\nThe farmer has a budget of $500 for seeds.\nPlease help the farmer to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # amount of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nWaterConsumption = 3 * A + 5 * B + 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a budget of $500 for seeds.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Crop A: \", model.getVal(A))\n    print(\"Amount of Crop B: \", model.getVal(B))\n    print(\"Amount of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 732,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how many units of labor to allocate to each facility to optimize production efficiency.\n// {\"units of labor at facility 1\": \"L1\", \"range\": \"L1 >= 0\", \"type\": \"integer\"}\n// {\"units of labor at facility 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"integer\"}\n// {\"units of labor at facility 3\": \"L3\", \"range\": \"L3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of labor at facility 1 produces 10 units of chemical A, 15 units of chemical B, and 20 units of chemical C per hour. At facility 2, each unit of labor produces 20 units of chemical A, 25 units of chemical B, and 30 units of chemical C per hour. At facility 3, each unit of labor produces 30 units of chemical A, 35 units of chemical B, and 40 units of chemical C per hour. The company needs to produce at least 300 units of chemical A, 450 units of chemical B, and 600 units of chemical C daily. The facilities operate simultaneously. Determine the minimum total labor hours required to meet the daily demand.\n// The labor hours for chemical A: H1 = 300 / (10 * L1 + 20 * L2 + 30 * L3)\n// The labor hours for chemical B: H2 = 450 / (15 * L1 + 25 * L2 + 35 * L3)\n// The labor hours for chemical C: H3 = 600 / (20 * L1 + 30 * L2 + 40 * L3)\n// So, the objective function is: Minimize max(H1, H2, H3)\n\n## Generate Constraint-1:\nThe company has a total of 60 units of labor available.\n// L1 + L2 + L3 <= 60",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how many units of labor to allocate to each facility to optimize production efficiency. Each unit of labor at facility 1 produces 10 units of chemical A, 15 units of chemical B, and 20 units of chemical C per hour. At facility 2, each unit of labor produces 20 units of chemical A, 25 units of chemical B, and 30 units of chemical C per hour. At facility 3, each unit of labor produces 30 units of chemical A, 35 units of chemical B, and 40 units of chemical C per hour. The company needs to produce at least 300 units of chemical A, 450 units of chemical B, and 600 units of chemical C daily. The facilities operate simultaneously. The company has a total of 60 units of labor available.\nPlease help the company determine the minimum total labor hours required to meet the daily demand.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nL1 = model.addVar(vtype=\"INTEGER\", name=\"L1\", lb=0) # units of labor at facility 1\nL2 = model.addVar(vtype=\"INTEGER\", name=\"L2\", lb=0) # units of labor at facility 2\nL3 = model.addVar(vtype=\"INTEGER\", name=\"L3\", lb=0) # units of labor at facility 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The labor hours for chemical A: H1 = 300 / (10 * L1 + 20 * L2 + 30 * L3)\n## The labor hours for chemical B: H2 = 450 / (15 * L1 + 25 * L2 + 35 * L3)\n## The labor hours for chemical C: H3 = 600 / (20 * L1 + 30 * L2 + 40 * L3)\n## So, the objective function is: Minimize max(H1, H2, H3)\n## Convert the division to multiplication\nH1 = model.addVar(name=\"H1\")\nH2 = model.addVar(name=\"H2\")\nH3 = model.addVar(name=\"H3\")\nmodel.addCons(H1 * (10 * L1 + 20 * L2 + 30 * L3) == 300)\nmodel.addCons(H2 * (15 * L1 + 25 * L2 + 35 * L3) == 450)\nmodel.addCons(H3 * (20 * L1 + 30 * L2 + 40 * L3) == 600)\nmodel.addCons(obj >= H1)\nmodel.addCons(obj >= H2)\nmodel.addCons(obj >= H3)\n\n# Add constraints\n## The company has a total of 60 units of labor available.\nmodel.addCons(L1 + L2 + L3 <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Units of Labor at Facility 1: \", model.getVal(L1))\n    print(\"Units of Labor at Facility 2: \", model.getVal(L2))\n    print(\"Units of Labor at Facility 3: \", model.getVal(L3))\n    print(\"Minimum Total Labor Hours: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The earnings, fuel costs, and maintenance costs per truck for each cargo type are given in the following Table.\n\n| Cargo Type | Earnings per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|--------------------|---------------------|----------------------------|\n| CargoA     | $5,000             | $1,000              | $500                       |\n| CargoB     | $7,000             | $1,500              | $700                       |\n| CargoC     | $10,000            | $2,000              | $1,000                     |\n\nThe company has a total of 50 trucks available for allocation. Please help the company to maximize the total net profit from all cargo types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=0) # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=0) # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=0) # number of trucks for CargoC\n\n# Define objective function\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 883,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints.\n// {\"number of machines of type 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines of type 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine type contributes differently to the profit. Machine type 1 generates a profit of $50 per hour, machine type 2 generates $70 per hour, and machine type 3 generates $60 per hour. The company wants to maximize the total profit from operating these machines.\n// The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\n// Objective: Maximize P\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available across all types.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 25 machines of any type can be operated simultaneously.\n// M1 <= 25; M2 <= 25; M3 <= 25\n\n## Generate Constraint-3:\nThe demand for widgets requires that at least 100 widgets are produced per hour. Each machine of type 1 produces 2 widgets per hour, type 2 produces 3 widgets per hour, and type 3 produces 2 widgets per hour.\n// 2 * M1 + 3 * M2 + 2 * M3 >= 100",
        "question": "A company operates three different types of machines to produce widgets. The company needs to decide how many machines of each type to operate to maximize profit while meeting certain production constraints. The profit generated per hour by each machine type is as follows:\n\n| Machine Type | Profit per Hour |\n|--------------|-----------------|\n| Type 1       | $50             |\n| Type 2       | $70             |\n| Type 3       | $60             |\n\nThe company has a total of 50 machines available across all types. Due to space limitations, no more than 25 machines of any type can be operated simultaneously. The demand for widgets requires that at least 100 widgets are produced per hour. Each machine of type 1 produces 2 widgets per hour, type 2 produces 3 widgets per hour, and type 3 produces 2 widgets per hour.\n\nPlease help the company to maximize the total profit from operating these machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines of type 1\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines of type 2\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines of type 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The total profit is given by: P = 50 * M1 + 70 * M2 + 60 * M3\nmodel.addCons(obj == 50 * M1 + 70 * M2 + 60 * M3)\n\n# Add constraints\n## The company has a total of 50 machines available across all types.\nmodel.addCons(M1 + M2 + M3 <= 50)\n## Due to space limitations, no more than 25 machines of any type can be operated simultaneously.\nmodel.addCons(M1 <= 25)\nmodel.addCons(M2 <= 25)\nmodel.addCons(M3 <= 25)\n## The demand for widgets requires that at least 100 widgets are produced per hour.\nmodel.addCons(2 * M1 + 3 * M2 + 2 * M3 >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines of Type 1: \", model.getVal(M1))\n    print(\"Number of Machines of Type 2: \", model.getVal(M2))\n    print(\"Number of Machines of Type 3: \", model.getVal(M3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n// Total production cost for product 1: Cost1 = 50 * P1 / (1 - 0.005 * Automation)\n// Total production cost for product 2: Cost2 = 70 * P2 / (1 - 0.005 * Automation)\n// Total daily production cost: TotalCost = Cost1 + Cost2\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\n// P1 <= 50; P2 <= 40\n\n## Generate Constraint-2:\nThe level of automation must not exceed 80%.\n// Automation <= 0.8\n\n## Generate Constraint-3:\nThe company must meet the daily demand of 100 units for product 1 and 150 units for product 2.\n// P1 * 24 >= 100; P2 * 24 >= 150",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line. The cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n\n| Product | Cost per Unit | Maximum Production Rate (units/hour) |\n|---------|---------------|--------------------------------------|\n| 1       | $50           | 50                                   |\n| 2       | $70           | 40                                   |\n\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2. The level of automation must not exceed 80%. The company must meet the daily demand of 100 units for product 1 and 150 units for product 2.\n\nPlease help the company to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0)  # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0)  # production rate for product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 50 * P1 / (1 - 0.005 * Automation)\nCost2 = 70 * P2 / (1 - 0.005 * Automation)\nTotalCost = Cost1 + Cost2\n## the objective function is: Minimize TotalCost\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 40)\n## The level of automation must not exceed 80%.\nmodel.addCons(Automation <= 0.8)\n## The company must meet the daily demand of 100 units for product 1 and 150 units for product 2.\nmodel.addCons(P1 * 24 >= 100)\nmodel.addCons(P2 * 24 >= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate for product 1: \", model.getVal(P1))\n    print(\"Production rate for product 2: \", model.getVal(P2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. Additionally, the farmer is considering investing in a new irrigation system that will affect the water usage and yield of each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in irrigation system\": \"Irrigation\", \"range\": \"Irrigation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield of crop A is 500 kg/acre, crop B is 700 kg/acre, and crop C is 900 kg/acre. The market price for crop A is $2/kg, crop B is $3/kg, and crop C is $4/kg. The investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n// Revenue from crop A: Revenue_A = 500 * A * 2\n// Revenue from crop B: Revenue_B = 700 * B * 3\n// Revenue from crop C: Revenue_C = 900 * C * 4\n// Water cost per acre after investment: WaterCost = 100 - 0.1 * Irrigation\n// Total water cost: TotalWaterCost = WaterCost * (A + B + C)\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe total investment in the irrigation system cannot exceed $10,000.\n// Irrigation <= 10000\n\n## Generate Constraint-3:\nThe farmer wants to ensure that at least 20 acres are dedicated to each crop.\n// A >= 20; B >= 20; C >= 20",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop and whether to invest in a new irrigation system that affects the water usage and yield of each crop. The yield and market price for each crop are given in the following Table.\n\n| Crop | Yield (kg/acre) | Market Price ($/kg) |\n|------|-----------------|---------------------|\n| A    | 500             | 2                   |\n| B    | 700             | 3                   |\n| C    | 900             | 4                   |\n\nThe investment in the irrigation system reduces the water usage per acre by 10% for every $1000 invested. The initial water cost per acre is $100. The farmer aims to maximize the net profit from the crops, considering both the revenue and the water cost.\n\nThe farmer has a total of 100 acres available for planting. The total investment in the irrigation system cannot exceed $10,000. The farmer wants to ensure that at least 20 acres are dedicated to each crop.\n\nPlease help the farmer to maximize the net profit from the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # acres of crop C\nIrrigation = model.addVar(vtype=\"CONTINUOUS\", name=\"Irrigation\", lb=0) # investment in irrigation system\n\n# Define objective function\nRevenue_A = 500 * A * 2\nRevenue_B = 700 * B * 3\nRevenue_C = 900 * C * 4\nWaterCost = 100 - 0.1 * Irrigation\nTotalWaterCost = WaterCost * (A + B + C)\n# So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - TotalWaterCost)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(Irrigation <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Investment in Irrigation System: \", model.getVal(Irrigation))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\n// {\"solar panels in Location A\": \"Solar_A\", \"range\": \"Solar_A >= 0\", \"type\": \"integer\"}\n// {\"wind turbines in Location B\": \"Wind_B\", \"range\": \"Wind_B >= 0\", \"type\": \"integer\"}\n// {\"energy-efficient lighting systems in Location C\": \"Light_C\", \"range\": \"Light_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n// NPV = \u03a3(annual energy savings - maintenance cost) / (1 + discount rate)^year - installation cost\n// So, the objective function is: Maximize NPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05)^1 + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05)^1 + (50 * Light_C - 5 * Light_C) / (1 + 0.05)^1 - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation of all systems.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000\n\n## Generate Constraint-2:\nAt least $50,000 must be spent on energy-efficient systems across all locations.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000\n\n## Generate Constraint-3:\nThe installation of solar panels in Location A must not exceed 200 units.\n// Solar_A <= 200\n\n## Generate Constraint-4:\nThe total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined.\n// Wind_B + Light_C <= 100",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\nThe company has a budget of $150,000 for the installation of all systems. At least $50,000 must be spent on energy-efficient systems across all locations. The installation of solar panels in Location A must not exceed 200 units. The total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined.\nPlease help the company determine the optimal number of solar panels in Location A, wind turbines in Location B, and energy-efficient lighting systems in Location C to maximize the NPV of the investment.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar_A = model.addVar(vtype=\"INTEGER\", name=\"Solar_A\", lb=0)  # solar panels in Location A\nWind_B = model.addVar(vtype=\"INTEGER\", name=\"Wind_B\", lb=0)  # wind turbines in Location B\nLight_C = model.addVar(vtype=\"INTEGER\", name=\"Light_C\", lb=0)  # energy-efficient lighting systems in Location C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate NPV\nNPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05) + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05) + (50 * Light_C - 5 * Light_C) / (1 + 0.05) - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## convert the division to multiplication\nmodel.addCons(obj * (1 + 0.05) == (100 * Solar_A - 10 * Solar_A) + (200 * Wind_B - 20 * Wind_B) + (50 * Light_C - 5 * Light_C) - obj * (1 + 0.05) * (500 * Solar_A + 1000 * Wind_B + 300 * Light_C))\n\n# Add constraints\n## The company has a budget of $150,000 for the installation of all systems.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000)\n\n## At least $50,000 must be spent on energy-efficient systems across all locations.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000)\n\n## The installation of solar panels in Location A must not exceed 200 units.\nmodel.addCons(Solar_A <= 200)\n\n## The total number of wind turbines in Location B and energy-efficient lighting systems in Location C must not exceed 100 units combined.\nmodel.addCons(Wind_B + Light_C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Location A: \", model.getVal(Solar_A))\n    print(\"Number of Wind Turbines in Location B: \", model.getVal(Wind_B))\n    print(\"Number of Energy-Efficient Lighting Systems in Location C: \", model.getVal(Light_C))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1498,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8\n\n## Generate Constraint-2:\nThe production of product A requires at least 1 hour per day due to contractual obligations.\n// H_A >= 1",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different and depends on the market demand and production costs. The details are as follows:\n\n| Product | Profit per Hour |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a total of 8 hours available for production in a day. Due to contractual obligations, the production of product A requires at least 1 hour per day. \n\nPlease help the company to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=1) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company wants to maximize the total profit, which is the sum of the profits from each product.\n// Total profit: Profit = 50A + 70B + 100C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 100 hours of labor available per week.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe company has a total of 70 hours of machine time available per week.\n// A + 2B + 3C <= 70",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company has a total of 100 hours of labor available per week. The company also has a total of 70 hours of machine time available per week.\nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 100C\nmodel.addCons(obj == 50*A + 70*B + 100*C)\n\n# Add constraints\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(2*A + 3*B + 4*C <= 100)\n## The company has a total of 70 hours of machine time available per week.\nmodel.addCons(A + 2*B + 3*C <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 726,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBUnits <= 2 * ComponentAUnits",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit. The company has a total production capacity of 500 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. Please help the company determine the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=0) # number of units of ComponentA\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=0) # number of units of ComponentB\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=0) # number of units of ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2\n\n## create piecewise variables for piecewise function: Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\nmodel.addCons(ComponentBUnits <= 2 * ComponentAUnits)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 896,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of device A is $100, for device B is $150, and for device C is $200. The production cost of each device is proportional to its profit, but with a diminishing return effect. Specifically, the production cost of each device is modeled as the square root of its profit multiplied by the quantity produced. The company aims to maximize the net profit, which is the total profit minus the total production cost.\n// Profit_A = 100 * A\n// Profit_B = 150 * B\n// Profit_C = 200 * C\n// Cost_A = sqrt(100 * A)\n// Cost_B = sqrt(150 * B)\n// Cost_C = sqrt(200 * C)\n// So, the objective function is: Maximize (Profit_A - Cost_A) + (Profit_B - Cost_B) + (Profit_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// sqrt(100 * A) + sqrt(150 * B) + sqrt(200 * C) <= 10000\n\n## Generate Constraint-2:\nThe company has a limited production capacity of 100 units in total.\n// A + B + C <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of each device to meet contractual obligations.\n// A >= 10; B >= 10; C >= 10",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities for each device to optimize their operations. The profit per unit of device A is $100, for device B is $150, and for device C is $200. The production cost of each device is modeled as the square root of its profit multiplied by the quantity produced. The company aims to maximize the net profit, which is the total profit minus the total production cost.\n\n| Device | Profit per Unit |\n|--------|-----------------|\n| A      | 100$            |\n| B      | 150$            |\n| C      | 200$            |\n\nThe company has a budget of $10,000 for production costs. The company has a limited production capacity of 100 units in total. The company must produce at least 10 units of each device to meet contractual obligations. Please help the company to maximize the net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 10 units of each device to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\n## convert square root to a variable\nCost_A = model.addVar(name=\"Cost_A\")\nCost_B = model.addVar(name=\"Cost_B\")\nCost_C = model.addVar(name=\"Cost_C\")\nmodel.addCons(Cost_A * Cost_A == 100 * A)\nmodel.addCons(Cost_B * Cost_B == 150 * B)\nmodel.addCons(Cost_C * Cost_C == 200 * C)\n## the objective function is: Maximize (Profit_A - Cost_A) + (Profit_B - Cost_B) + (Profit_C - Cost_C)\nmodel.addCons(obj == Profit_A - Cost_A + Profit_B - Cost_B + Profit_C - Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(Cost_A + Cost_B + Cost_C <= 10000)\n## The company has a limited production capacity of 100 units in total.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 900,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation.\n// {\"amount of solar panels\": \"Solar\", \"range\": \"Solar >= 0\", \"type\": \"integer\"}\n// {\"amount of wind turbines\": \"Wind\", \"range\": \"Wind >= 0\", \"type\": \"integer\"}\n// {\"amount of insulation upgrades\": \"Insulation\", \"range\": \"Insulation >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year.\nThe cost of each wind turbine is $2000, and it provides an energy saving of $300 per year.\nThe cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year.\nThe company wants to minimize the total cost of installation while maximizing the annual energy savings.\n// total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n// total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n// So, the objective function is: Minimize Cost / Savings\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for the installation.\n// 1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000\n\n## Generate Constraint-2:\nThe company aims to achieve at least $10,000 in annual energy savings.\n// 200 * Solar + 300 * Wind + 100 * Insulation >= 10000\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\n// 500 * Insulation >= 0.20 * 50000\n\n## Generate Constraint-4:\nNo more than 50% of the budget should be allocated to solar panels.\n// 1000 * Solar <= 0.50 * 50000\n\n## Generate Constraint-5:\nThe number of wind turbines should not exceed twice the number of solar panels.\n// Wind <= 2 * Solar",
        "question": "A company is planning to optimize its energy consumption by installing solar panels, wind turbines, and upgrading its insulation. The cost of installing each solar panel is $1000, and it provides an energy saving of $200 per year. The cost of each wind turbine is $2000, and it provides an energy saving of $300 per year. The cost of each insulation upgrade is $500, and it provides an energy saving of $100 per year. The company has a budget of $50,000 for the installation and aims to achieve at least $10,000 in annual energy savings. The company wants to ensure that at least 20% of the budget is spent on insulation upgrades and no more than 50% of the budget should be allocated to solar panels. Additionally, the number of wind turbines should not exceed twice the number of solar panels. Please help the company to minimize the total cost of installation while maximizing the annual energy savings.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar = model.addVar(vtype=\"INTEGER\", name=\"Solar\", lb=0) # amount of solar panels\nWind = model.addVar(vtype=\"INTEGER\", name=\"Wind\", lb=0) # amount of wind turbines\nInsulation = model.addVar(vtype=\"INTEGER\", name=\"Insulation\", lb=0) # amount of insulation upgrades\n\n# Define objective function\n## total installation cost: Cost = 1000 * Solar + 2000 * Wind + 500 * Insulation\n## total annual energy savings: Savings = 200 * Solar + 300 * Wind + 100 * Insulation\n## So, the objective function is: Minimize Cost / Savings\nCost = 1000 * Solar + 2000 * Wind + 500 * Insulation\nSavings = 200 * Solar + 300 * Wind + 100 * Insulation\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj * Savings == Cost)\n\n# Add constraints\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(1000 * Solar + 2000 * Wind + 500 * Insulation <= 50000)\n## The company aims to achieve at least $10,000 in annual energy savings.\nmodel.addCons(200 * Solar + 300 * Wind + 100 * Insulation >= 10000)\n## The company wants to ensure that at least 20% of the budget is spent on insulation upgrades.\nmodel.addCons(500 * Insulation >= 0.20 * 50000)\n## No more than 50% of the budget should be allocated to solar panels.\nmodel.addCons(1000 * Solar <= 0.50 * 50000)\n## The number of wind turbines should not exceed twice the number of solar panels.\nmodel.addCons(Wind <= 2 * Solar)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Solar Panels: \", model.getVal(Solar))\n    print(\"Amount of Wind Turbines: \", model.getVal(Wind))\n    print(\"Amount of Insulation Upgrades: \", model.getVal(Insulation))\n    print(\"Minimized Cost to Savings Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 906,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity.\n// {\"number of V1 vehicles\": \"V1\", \"range\": \"V1 >= 0\", \"type\": \"integer\"}\n// {\"number of V2 vehicles\": \"V2\", \"range\": \"V2 >= 0\", \"type\": \"integer\"}\n// {\"number of V3 vehicles\": \"V3\", \"range\": \"V3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000.\nFor V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000.\nFor V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000.\nThe company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries.\n// Total_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\n// Fuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\n// Total_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n// So, the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for purchasing vehicles.\n// 5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000\n\n## Generate Constraint-2:\nThe total weight of the deliveries should not exceed 10,000 kg.\n// 1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000\n\n## Generate Constraint-3:\nThe company must use at least 5 vehicles in total.\n// V1 + V2 + V3 >= 5\n\n## Generate Constraint-4:\nThe number of V3 vehicles should not exceed the total number of V1 and V2 vehicles.\n// V3 <= V1 + V2",
        "question": "A logistics company is planning its delivery routes using three types of vehicles: V1, V2, and V3. Each vehicle has different fuel efficiency and capacity. For V1, the fuel consumption per kilometer is 0.1 liters, the capacity is 1000 kg, and the cost per vehicle is $5000. For V2, the fuel consumption per kilometer is 0.08 liters, the capacity is 1500 kg, and the cost per vehicle is $6000. For V3, the fuel consumption per kilometer is 0.06 liters, the capacity is 2000 kg, and the cost per vehicle is $7000. The company has a budget of $100,000 for purchasing vehicles and the total weight of the deliveries should not exceed 10,000 kg. The company must use at least 5 vehicles in total, and the number of V3 vehicles should not exceed the total number of V1 and V2 vehicles. The company wants to minimize the total cost of ownership and fuel consumption per kilometer, considering the total weight of the deliveries. Please help the company determine the optimal number of each type of vehicle to use.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nV1 = model.addVar(vtype=\"INTEGER\", name=\"V1\", lb=0) # number of V1 vehicles\nV2 = model.addVar(vtype=\"INTEGER\", name=\"V2\", lb=0) # number of V2 vehicles\nV3 = model.addVar(vtype=\"INTEGER\", name=\"V3\", lb=0) # number of V3 vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nTotal_Cost = 5000 * V1 + 6000 * V2 + 7000 * V3\nFuel_Consumption = 0.1 * V1 + 0.08 * V2 + 0.06 * V3\nTotal_Weight = 1000 * V1 + 1500 * V2 + 2000 * V3\n## the objective function is: Minimize (Total_Cost + Fuel_Consumption * Total_Weight)\n## convert the multiplication to addition\nmodel.addCons(obj == Total_Cost + Fuel_Consumption * Total_Weight)\n\n# Add constraints\n## The company has a budget of $100,000 for purchasing vehicles.\nmodel.addCons(5000 * V1 + 6000 * V2 + 7000 * V3 <= 100000)\n## The total weight of the deliveries should not exceed 10,000 kg.\nmodel.addCons(1000 * V1 + 1500 * V2 + 2000 * V3 <= 10000)\n## The company must use at least 5 vehicles in total.\nmodel.addCons(V1 + V2 + V3 >= 5)\n## The number of V3 vehicles should not exceed the total number of V1 and V2 vehicles.\nmodel.addCons(V3 <= V1 + V2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of V1 Vehicles: \", model.getVal(V1))\n    print(\"Number of V2 Vehicles: \", model.getVal(V2))\n    print(\"Number of V3 Vehicles: \", model.getVal(V3))\n    print(\"Minimized Total Cost and Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1006,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the level of automation to implement, which affects the production efficiency.\n// {\"hours allocated to product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours allocated to product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours allocated to product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production efficiency for each product type increases with the level of automation. Specifically, for product 1, each unit of automation increases efficiency by 5%; for product 2, by 7%; and for product 3, by 6%. The company aims to maximize the total production output, which is the sum of the outputs of each product type.\n// Output of product 1: O1 = H1 * (1 + 0.05 * Automation)\n// Output of product 2: O2 = H2 * (1 + 0.07 * Automation)\n// Output of product 3: O3 = H3 * (1 + 0.06 * Automation)\n// So, the objective function is: Maximize O1 + O2 + O3\n\n## Generate Constraint-1:\nThe total hours available for production in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe level of automation must be between 0 and 100 units.\n// 0 <= Automation <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 500 units of product 1, 700 units of product 2, and 600 units of product 3.\n// O1 >= 500\n// O2 >= 700\n// O3 >= 600",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate to each product type and the level of automation to implement, which affects the production efficiency. The production efficiency for each product type increases with the level of automation. Specifically, for product 1, each unit of automation increases efficiency by 5%; for product 2, by 7%; and for product 3, by 6%. The company aims to maximize the total production output, which is the sum of the outputs of each product type.\nThe total hours available for production in a week is 168 hours. The level of automation must be between 0 and 100 units. The company must produce at least 500 units of product 1, 700 units of product 2, and 600 units of product 3.\nPlease help the company determine the optimal allocation of hours and level of automation to maximize the total production output.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0) # hours allocated to product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0) # hours allocated to product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0) # hours allocated to product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=100) # level of automation\n\n# Define objective function\nO1 = H1 * (1 + 0.05 * Automation)\nO2 = H2 * (1 + 0.07 * Automation)\nO3 = H3 * (1 + 0.06 * Automation)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == O1 + O2 + O3)\n\n# Add constraints\nmodel.addCons(H1 + H2 + H3 <= 168)\nmodel.addCons(O1 >= 500)\nmodel.addCons(O2 >= 700)\nmodel.addCons(O3 >= 600)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product 1: \", model.getVal(H1))\n    print(\"Hours allocated to Product 2: \", model.getVal(H2))\n    print(\"Hours allocated to Product 3: \", model.getVal(H3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type.\n// {\"number of machines for component A\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component B\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"integer\"}\n// {\"number of machines for component C\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe manufacturer aims to maximize the total profit from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour.\n// The profit for component A: P1 = 50 * 10 * M1\n// The profit for component B: P2 = 70 * 15 * M2\n// The profit for component C: P3 = 60 * 12 * M3\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe total number of machines available is 50.\n// M1 + M2 + M3 <= 50\n\n## Generate Constraint-2:\nThe production facility has a limited power supply that can support up to 25 machines running simultaneously.\n// M1^2 + M2^2 + M3^2 <= 25^2",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are determined by the number of machines allocated to each type. The manufacturer aims to maximize the total profit from the sales of these components. The profit per unit of component A is $50, for B is $70, and for C is $60. The production rate of each machine for component A is 10 units per hour, for B is 15 units per hour, and for C is 12 units per hour. The objective is to maximize the total profit per hour. The total number of machines available is 50. The production facility has a limited power supply that can support up to 25 machines running simultaneously. Please help the manufacturer determine the optimal allocation of machines to maximize the total profit per hour.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"INTEGER\", name=\"M1\", lb=0) # number of machines for component A\nM2 = model.addVar(vtype=\"INTEGER\", name=\"M2\", lb=0) # number of machines for component B\nM3 = model.addVar(vtype=\"INTEGER\", name=\"M3\", lb=0) # number of machines for component C\n\n# Define objective function\nP1 = 50 * 10 * M1\nP2 = 70 * 15 * M2\nP3 = 60 * 12 * M3\n# So, the objective function is: Maximize P = P1 + P2 + P3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total number of machines available is 50.\nmodel.addCons(M1 + M2 + M3 <= 50)\n# The production facility has a limited power supply that can support up to 25 machines running simultaneously.\nmodel.addCons(M1**2 + M2**2 + M3**2 <= 25**2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Component A: \", model.getVal(M1))\n    print(\"Number of Machines for Component B: \", model.getVal(M2))\n    print(\"Number of Machines for Component C: \", model.getVal(M3))\n    print(\"Maximized Profit per Hour: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit.\n// {\"hours of operation for production line A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"hours of operation for production line C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The goal is to maximize the total profit from all three lines.\n// The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\n\n## Generate Constraint-1:\nThe total hours of operation for all three lines cannot exceed 100 hours per day.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A.\n// A >= 5\n\n## Generate Constraint-3:\nThe minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B.\n// B >= 5\n\n## Generate Constraint-4:\nThe minimum daily production requirement for component C is 1000 units, which can be produced in 5 hours on line C.\n// C >= 5",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant manager needs to decide the number of hours to operate each of the three production lines to maximize profit. Each hour of operation for production line A yields a profit of 100 units, for line B yields 150 units, and for line C yields 200 units. However, the profit per hour decreases nonlinearly as more hours are worked due to fatigue and maintenance issues. The profit function is given by P(x) = 100x - 0.1x^2 for line A, P(y) = 150y - 0.2y^2 for line B, and P(z) = 200z - 0.3z^2 for line C. The total hours of operation for all three lines cannot exceed 100 hours per day. The minimum daily production requirement for component A is 500 units, which can be produced in 5 hours on line A. The minimum daily production requirement for component B is 750 units, which can be produced in 5 hours on line B. The minimum daily production requirement for component C is 1000 units, which can be produced in 5 hours on line C. Please help the plant manager to maximize the total profit from all three lines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=5)  # hours of operation for production line A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=5)  # hours of operation for production line B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=5)  # hours of operation for production line C\n\n# Define objective function\n# The objective function is: Maximize (100A - 0.1A^2) + (150B - 0.2B^2) + (200C - 0.3C^2)\nProfit_A = 100 * A - 0.1 * A**2\nProfit_B = 150 * B - 0.2 * B**2\nProfit_C = 200 * C - 0.3 * C**2\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total hours of operation for all three lines cannot exceed 100 hours per day.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours of operation for production line A: \", model.getVal(A))\n    print(\"Hours of operation for production line B: \", model.getVal(B))\n    print(\"Hours of operation for production line C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1097,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe production capacity for Product A is limited to 100 units.\n// ProductA <= 100\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Product B.\n// ProductB >= 50",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C). The profit per unit of Product A is $50 and it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company has a budget of $5000 for raw materials. The production capacity for Product A is limited to 100 units, and the company must produce at least 50 units of Product B. The company wants to maximize the total profit while considering the cost of raw materials. Please help the company to maximize the total profit minus the cost of raw materials.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=50) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n## The production capacity for Product A is limited to 100 units.\nmodel.addCons(ProductA <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A: \", model.getVal(ProductA))\n    print(\"Amount of Product B: \", model.getVal(ProductB))\n    print(\"Amount of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 712,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBUnits <= 2 * ComponentAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ComponentA is $20, for ComponentB is $30, and for ComponentC is $40.\n// 20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each component are produced to meet minimum order requirements.\n// ComponentAUnits >= 50; ComponentBUnits >= 50; ComponentCUnits >= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for each component and the conditions under which the profit decreases are given in the following Table.\n\n| Component | Profit per Unit | Decrease Condition | Decrease Rate |\n|-----------|-----------------|--------------------|---------------|\n| ComponentA | $50             | > 100 units        | $1 per unit   |\n| ComponentB | $70             | > 200 units        | $0.5 per unit |\n| ComponentC | $100            | > 150 units        | $2 per unit   |\n\nThe company has a total production capacity of 500 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. The company has a budget of $30,000 for raw materials for the month, with the cost of raw materials per unit for ComponentA being $20, for ComponentB being $30, and for ComponentC being $40. The company wants to ensure that at least 50 units of each component are produced to meet minimum order requirements.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=50)\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=50)\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=50)\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2 + 50 * ComponentA1 * ComponentA_b1\n\n# Create piecewise variables for piecewise function: Profit_ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2 + 70 * ComponentB1 * ComponentB_b1\n\n# Create piecewise variables for piecewise function: Profit_ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2 + 100 * ComponentC1 * ComponentC_b1\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\nmodel.addCons(ComponentBUnits <= 2 * ComponentAUnits)\nmodel.addCons(20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1310,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit.\n// {\"production quantity for DeviceA\": \"DeviceAProduction\", \"range\": \"DeviceAProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBProduction\", \"range\": \"DeviceBProduction >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCProduction\", \"range\": \"DeviceCProduction >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $90, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\n// Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\n// Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units.\n// DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBProduction <= 2 * DeviceAProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint that limits the total cost of production to $20,000. The cost per unit for DeviceA is $20, for DeviceB is $30, and for DeviceC is $40.\n// 20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least one unit of each device is produced.\n// DeviceAProduction >= 1; DeviceBProduction >= 1; DeviceCProduction >= 1",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit. The profit per unit for each device decreases as more units are produced beyond certain thresholds. The details of the profit structure and costs are given in the following Table.\n\n| Device | Profit per Unit (beyond threshold) | Cost per Unit | Threshold (units) |\n|--------|-----------------------------------|---------------|-------------------|\n| DeviceA | $50 - $0.1*(units - 100)          | $20           | 100               |\n| DeviceB | $70 - $0.05*(units - 200)         | $30           | 200               |\n| DeviceC | $90 - $0.02*(units - 300)         | $40           | 300               |\n\nThe company has a total production capacity of 500 units. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget constraint that limits the total cost of production to $20,000. The company wants to ensure that at least one unit of each device is produced.\n\nPlease help the company to maximize the total profit by determining the optimal production quantity for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceAProduction\", lb=1)  # production quantity for DeviceA\nDeviceBProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceBProduction\", lb=1)  # production quantity for DeviceB\nDeviceCProduction = model.addVar(vtype=\"INTEGER\", name=\"DeviceCProduction\", lb=1)  # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAProduction - 100)) * DeviceAProduction if DeviceAProduction > 100 else 50 * DeviceAProduction\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=1, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=101, ub=500)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAProduction == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.05 * (DeviceBProduction - 200)) * DeviceBProduction if DeviceBProduction > 200 else 70 * DeviceBProduction\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=1, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=201, ub=500)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBProduction == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.05 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n\n## create piecewise variables for piecewise function: Profit_DeviceC = (90 - 0.02 * (DeviceCProduction - 300)) * DeviceCProduction if DeviceCProduction > 300 else 90 * DeviceCProduction\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=1, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=301, ub=500)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCProduction == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 90 * DeviceC1 * DeviceC_b1 + (90 - 0.02 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAProduction + DeviceBProduction + DeviceCProduction <= 500)\nmodel.addCons(DeviceBProduction <= 2 * DeviceAProduction)\nmodel.addCons(20 * DeviceAProduction + 30 * DeviceBProduction + 40 * DeviceCProduction <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAProduction))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBProduction))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCProduction))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1238,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit.\n// {\"raw materials for product 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 2\": \"M2\", \"range\": \"M2 >= 0\", \"type\": \"real\"}\n// {\"raw materials for product 3\": \"M3\", \"range\": \"M3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. \nProduct 1 requires M1 units of raw material and generates a profit of 10M1. \nProduct 2 requires M2 units of raw material and generates a profit of 15M2. \nProduct 3 requires M3 units of raw material and generates a profit of 20M3.\nThe plant manager wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 10M1 + 15M2 + 20M3\n\n## Generate Constraint-1:\nThe total amount of raw materials available is 100 units.\n// M1 + M2 + M3 <= 100\n\n## Generate Constraint-2:\nThe production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used. The efficiency function is E1 = 1 / (1 + M1^2).\n// M1 <= 100 * E1\n\n## Generate Constraint-3:\nThe production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used. The efficiency function is E2 = M2^2 / (1 + M2^2).\n// M2 <= 100 * E2",
        "question": "A manufacturing plant produces three types of products using different machines. The plant manager needs to optimize the allocation of raw materials to maximize profit. Each unit of product 1, 2, and 3 requires different amounts of raw materials and generates different profits. Product 1 requires M1 units of raw material and generates a profit of 10M1. Product 2 requires M2 units of raw material and generates a profit of 15M2. Product 3 requires M3 units of raw material and generates a profit of 20M3. The total amount of raw materials available is 100 units. The production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used, with the efficiency function E1 = 1 / (1 + M1^2). The production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used, with the efficiency function E2 = M2^2 / (1 + M2^2). Please help the plant manager to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # raw materials for product 1\nM2 = model.addVar(vtype=\"CONTINUOUS\", name=\"M2\", lb=0) # raw materials for product 2\nM3 = model.addVar(vtype=\"CONTINUOUS\", name=\"M3\", lb=0) # raw materials for product 3\n\n# Define objective function\nP = model.addVar(name=\"P\") # total profit\nmodel.setObjective(P, \"maximize\")\nmodel.addCons(P == 10*M1 + 15*M2 + 20*M3)\n\n# Add constraints\n## The total amount of raw materials available is 100 units.\nmodel.addCons(M1 + M2 + M3 <= 100)\n\n## The production of product 1 is limited by a nonlinear constraint where the efficiency decreases as more raw materials are used. The efficiency function is E1 = 1 / (1 + M1^2).\nE1 = model.addVar(name=\"E1\")\nmodel.addCons(E1 == 1 / (1 + M1**2))\nmodel.addCons(M1 <= 100 * E1)\n\n## The production of product 2 is also subject to a nonlinear constraint where the efficiency increases with the square of the raw materials used. The efficiency function is E2 = M2^2 / (1 + M2^2).\nE2 = model.addVar(name=\"E2\")\nmodel.addCons(E2 == M2**2 / (1 + M2**2))\nmodel.addCons(M2 <= 100 * E2)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for product 1: \", model.getVal(M1))\n    print(\"Raw materials for product 2: \", model.getVal(M2))\n    print(\"Raw materials for product 3: \", model.getVal(M3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1023,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $6000 for cultivation costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 6000\n\n## Generate Constraint-3:\nThe market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\n// 5 * C1 <= 300",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. The yield per acre, price per ton, and cost per acre for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Price per Ton | Cost per Acre |\n|------|----------------|---------------|---------------|\n| C1   | 5 tons         | $100          | $50           |\n| C2   | 6 tons         | $120          | $60           |\n| C3   | 7 tons         | $140          | $70           |\n\nThe farmer has a total of 100 acres available for cultivation. The farmer has a budget of $6000 for cultivation costs. The market demand for C1 is 300 tons, which translates to a maximum of 60 acres of C1. The farmer wants to maximize the net profit per acre. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farmer has a budget of $6000 for cultivation costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 6000)\n## The market demand for C1 is 300 tons. So, the farmer can only sell a maximum of 300 tons of C1, which translates to 60 acres of C1.\nmodel.addCons(5 * C1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 888,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company aims to maximize the total profit.\n// The objective function is: Maximize P_total = P_S + P_T + P_L = (500S - 0.1S^2) + (600T - 0.15T^2) + (800L - 0.2L^2)\n\n## Generate Constraint-1:\nThe company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500.\n// 200S + 300T + 500L <= 100000\n\n## Generate Constraint-2:\nThe company has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units.\n// S + T + L <= 500\n\n## Generate Constraint-3:\nThe company has a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce.\n// S + T + L <= 400\n\n## Generate Constraint-4:\nThe company has a market demand constraint for each device. The maximum market demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// S <= 200; T <= 150; L <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit. The profit from each device varies nonlinearly with the quantity produced due to economies of scale and market saturation. The profit function for smartphones is P_S = 500S - 0.1S^2, for tablets is P_T = 600T - 0.15T^2, and for laptops is P_L = 800L - 0.2L^2. The company has a budget constraint that limits the total production cost to $100,000. The cost of producing a smartphone is $200, a tablet is $300, and a laptop is $500. The company also has a warehouse capacity constraint that limits the total number of devices that can be stored to 500 units. Additionally, there is a labor constraint that limits the total number of devices that can be produced to 400 units due to limited workforce. Lastly, the company has a market demand constraint for each device. The maximum market demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units. Please help the company to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=200)  # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=150)  # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=100)  # number of laptops\n\n# Define objective function\nP_S = 500 * S - 0.1 * S**2\nP_T = 600 * T - 0.15 * T**2\nP_L = 800 * L - 0.2 * L**2\nP_total = P_S + P_T + P_L\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_total)\n\n# Add constraints\nmodel.addCons(200 * S + 300 * T + 500 * L <= 100000)  # budget constraint\nmodel.addCons(S + T + L <= 500)  # warehouse capacity constraint\nmodel.addCons(S + T + L <= 400)  # labor constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot.\n// {\"quantity of Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 40 * B\n// Profit_C = 200 * C - 50 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares.\n// A + 2 * B + 3 * C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $5000 for purchasing fertilizer.\n// 30 * A + 40 * B + 50 * C <= 5000\n\n## Generate Constraint-3:\nThe farmer has a storage capacity of 200 tons in total.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe market demand for Crop A is 50 tons. So, the farmer can only sell a maximum of 50 tons of Crop A.\n// A <= 50",
        "question": "A farmer has three plots of land where he can grow three different crops: Crop A, Crop B, and Crop C. He needs to decide how much of each crop to plant on each plot. The farmer earns $100 per ton of Crop A, $150 per ton of Crop B, and $200 per ton of Crop C. However, the cost of fertilizer per ton of crop is $30 for Crop A, $40 for Crop B, and $50 for Crop C. The farmer wants to maximize his net profit (revenue minus cost).\n\nThe total area available for planting is 100 hectares. Each ton of Crop A requires 1 hectare, Crop B requires 2 hectares, and Crop C requires 3 hectares. The farmer has a budget of $5000 for purchasing fertilizer. The farmer also has a storage capacity of 200 tons in total. The market demand for Crop A is 50 tons, so the farmer can only sell a maximum of 50 tons of Crop A.\n\nPlease help the farmer to maximize his net profit by determining the optimal quantity of each crop to plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of Crop C\n\n# Define objective function\nProfit_A = 100 * A - 30 * A\nProfit_B = 150 * B - 40 * B\nProfit_C = 200 * C - 50 * C\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The total area available for planting is 100 hectares.\nmodel.addCons(A + 2 * B + 3 * C <= 100)\n# The farmer has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\n# The farmer has a storage capacity of 200 tons in total.\nmodel.addCons(A + B + C <= 200)\n# The market demand for Crop A is 50 tons.\nmodel.addCons(A <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Crop A: \", model.getVal(A))\n    print(\"Quantity of Crop B: \", model.getVal(B))\n    print(\"Quantity of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 914,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage.\n// {\"acreage for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"acreage for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"acreage for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. \nFor C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. \nFor C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points.\nThe farm wants to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.\n// Profit_C1 = 100 * A1\n// Profit_C2 = 150 * A2\n// Profit_C3 = 200 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (5 * A1 + 7 * A2 + 10 * A3)\n\n## Generate Constraint-1:\nThe farm has a limited water supply of 300 units.\n// 5 * A1 + 7 * A2 + 10 * A3 <= 300\n\n## Generate Constraint-2:\nThe soil fertility must remain above 50 points after planting all crops.\n// 2 * A1 + 3 * A2 + 5 * A3 <= 100 (assuming the initial soil fertility is 100 points)",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farm needs to determine the acreage for each crop to maximize its profit while considering the soil fertility and water usage. For C1, the profit per acre is $100, the water usage per acre is 5 units, and the soil fertility degradation per acre is 2 points. For C2, the profit per acre is $150, the water usage per acre is 7 units, and the soil fertility degradation per acre is 3 points. For C3, the profit per acre is $200, the water usage per acre is 10 units, and the soil fertility degradation per acre is 5 points. The farm has a limited water supply of 300 units. The soil fertility must remain above 50 points after planting all crops. Please help the farm to maximize the profit per unit of water used while maintaining soil fertility above a certain threshold.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # acreage for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # acreage for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # acreage for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 100 * A1\nProfit_C2 = 150 * A2\nProfit_C3 = 200 * A3\nWaterUsage = 5 * A1 + 7 * A2 + 10 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a limited water supply of 300 units.\nmodel.addCons(5 * A1 + 7 * A2 + 10 * A3 <= 300)\n## The soil fertility must remain above 50 points after planting all crops.\nmodel.addCons(2 * A1 + 3 * A2 + 5 * A3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acreage for C1: \", model.getVal(A1))\n    print(\"Acreage for C2: \", model.getVal(A2))\n    print(\"Acreage for C3: \", model.getVal(A3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 828,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations.\n// {\"production rate of MachineA\": \"MachineARate\", \"range\": \"MachineARate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBRate\", \"range\": \"MachineBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCRate\", \"range\": \"MachineCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit from all machines.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineARate\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBRate\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCRate\n// So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 100 units per day across all machine types.\n// MachineARate + MachineBRate + MachineCRate <= 100\n\n## Generate Constraint-2:\nDue to market demand, the production rate of MachineB must be at least twice the production rate of MachineA.\n// MachineBRate >= 2 * MachineARate\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials of $30,000 per day.\n// 300 * MachineARate + 400 * MachineBRate + 500 * MachineCRate <= 30,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine type to optimize their operations. The profit per unit and production cost per unit for each machine type are given in the following Table.\n\n| Machine Type | Profit per Unit | Production Cost per Unit |\n|--------------|-----------------|--------------------------|\n| MachineA     | $500            | $300                     |\n| MachineB     | $700            | $400                     |\n| MachineC     | $900            | $500                     |\n\nThe company has a total production capacity of 100 units per day across all machine types. Due to market demand, the production rate of MachineB must be at least twice the production rate of MachineA. The company has a budget constraint for raw materials of $30,000 per day. \n\nPlease help the company to maximize the total profit from all machines.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineARate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineARate\", lb=0) # production rate of MachineA\nMachineBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBRate\", lb=0) # production rate of MachineB\nMachineCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCRate\", lb=0) # production rate of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 300) * MachineARate\nProfit_MachineB = (700 - 400) * MachineBRate\nProfit_MachineC = (900 - 500) * MachineCRate\n# So, the objective function is: Maximize (Profit_MachineA + Profit_MachineB + Profit_MachineC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total production capacity of 100 units per day across all machine types.\nmodel.addCons(MachineARate + MachineBRate + MachineCRate <= 100)\n# Due to market demand, the production rate of MachineB must be at least twice the production rate of MachineA.\nmodel.addCons(MachineBRate >= 2 * MachineARate)\n# The company has a budget constraint for raw materials of $30,000 per day.\nmodel.addCons(300 * MachineARate + 400 * MachineBRate + 500 * MachineCRate <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineARate))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBRate))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 955,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop.\n// {\"hectares of wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"hectares of corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"hectares of soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Wheat, the expected yield is 5 tons per hectare, the selling price is $200 per ton, and the water usage is 1000 liters per hectare.\nFor Corn, the expected yield is 6 tons per hectare, the selling price is $250 per ton, and the water usage is 1200 liters per hectare.\nFor Soybeans, the expected yield is 4 tons per hectare, the selling price is $300 per ton, and the water usage is 800 liters per hectare.\nThe farmer wants to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n// Total profit: Profit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\n// Total water usage: Water = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n// So, the objective function is: Maximize Profit / Water\n\n## Generate Constraint-1:\nThe farmer has 100 hectares of land available.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farmer wants to ensure at least 30 hectares are dedicated to each crop.\n// Wheat >= 30; Corn >= 30; Soybeans >= 30",
        "question": "A farmer plans to cultivate three different crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many hectares to allocate for each crop. The expected yield, selling price, and water usage for each crop are given in the following Table.\n\n| Crop       | Expected Yield (tons/hectare) | Selling Price ($/ton) | Water Usage (liters/hectare) |\n|------------|-------------------------------|-----------------------|-----------------------------|\n| Wheat      | 5                             | 200                   | 1000                        |\n| Corn       | 6                             | 250                   | 1200                        |\n| Soybeans   | 4                             | 300                   | 800                         |\n\nThe farmer has 100 hectares of land available. The farmer wants to ensure at least 30 hectares are dedicated to each crop. Please help the farmer to maximize the Profit-Water Usage ratio (defined as the total profit from all crops divided by the total water usage for all crops).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to ensure at least 30 hectares are dedicated to each crop.\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=30) # hectares of wheat\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=30) # hectares of corn\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=30) # hectares of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 5 * 200 * Wheat + 6 * 250 * Corn + 4 * 300 * Soybeans\nWater = 1000 * Wheat + 1200 * Corn + 800 * Soybeans\n## the objective function is: Maximize Profit / Water\n## convert the division to multiplication\nmodel.addCons(obj * Water == Profit)\n\n# Add constraints\n## The farmer has 100 hectares of land available.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Wheat: \", model.getVal(Wheat))\n    print(\"Hectares of Corn: \", model.getVal(Corn))\n    print(\"Hectares of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit-Water Usage Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1036,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency.\n// {\"number of workers on machine 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on machine 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine has a different efficiency rate per worker. Machine 1 produces 10 units per worker per hour, Machine 2 produces 12 units per worker per hour, and Machine 3 produces 15 units per worker per hour. The goal is to maximize the total production rate of all machines.\n// The production rate for machine 1: P1 = 10 * W1\n// The production rate for machine 2: P2 = 12 * W2\n// The production rate for machine 3: P3 = 15 * W3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThere are a total of 30 workers available for allocation.\n// W1 + W2 + W3 <= 30\n\n## Generate Constraint-2:\nEach machine can operate with a maximum of 10 workers at a time.\n// W1 <= 10; W2 <= 10; W3 <= 10",
        "question": "A manufacturing plant produces three types of widgets using different machines. The manager needs to optimize the allocation of workers to each machine to maximize production efficiency. The efficiency rate per worker for each machine is given in the following Table.\n\n| Machine | Efficiency Rate per Worker (units/hour) |\n|---------|-----------------------------------------|\n| 1       | 10                                      |\n| 2       | 12                                      |\n| 3       | 15                                      |\n\nThe goal is to maximize the total production rate of all machines. There are a total of 30 workers available for allocation. Each machine can operate with a maximum of 10 workers at a time.\nPlease help the manager determine the optimal number of workers to assign to each machine (W1 for Machine 1, W2 for Machine 2, and W3 for Machine 3) to achieve the maximum total production rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0, ub=10) # number of workers on machine 1\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0, ub=10) # number of workers on machine 2\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0, ub=10) # number of workers on machine 3\n\n# Define objective function\nP1 = 10 * W1\nP2 = 12 * W2\nP3 = 15 * W3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\nmodel.addCons(W1 + W2 + W3 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of workers on machine 1: \", model.getVal(W1))\n    print(\"Number of workers on machine 2: \", model.getVal(W2))\n    print(\"Number of workers on machine 3: \", model.getVal(W3))\n    print(\"Total production rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nProduct A has a selling price of $50, a material cost of $20, and requires 1 hour of labor. Product B has a selling price of $70, a material cost of $30, and requires 2 hours of labor. Product C has a selling price of $100, a material cost of $40, and requires 3 hours of labor. The company aims to maximize its profit, which is defined as the total revenue minus the total cost.\n// Revenue of A: Revenue_A = 50 * A\n// Revenue of B: Revenue_B = 70 * B\n// Revenue of C: Revenue_C = 100 * C\n// Cost of A: Cost_A = 20 * A + 1 * A\n// Cost of B: Cost_B = 30 * B + 2 * B\n// Cost of C: Cost_C = 40 * C + 3 * C\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 for material costs for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit. The selling price, material cost, and labor hours required for each product are given in the following Table.\n\n| Product | Selling Price | Material Cost | Labor Hours |\n|---------|---------------|---------------|-------------|\n| A       | $50           | $20           | 1 hour      |\n| B       | $70           | $30           | 2 hours     |\n| C       | $100          | $40           | 3 hours     |\n\nThe company has a total budget of $10,000 for material costs for the next quarter. The company aims to maximize its profit, which is defined as the total revenue minus the total cost. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 50 * A\nRevenue_B = 70 * B\nRevenue_C = 100 * C\nCost_A = 20 * A + 1 * A\nCost_B = 30 * B + 2 * B\nCost_C = 40 * C + 3 * C\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Revenue_A + Revenue_B + Revenue_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n## The company has a total budget of $10,000 for material costs for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: Corn, Wheat, and Soybeans. Additionally, the farm needs to determine the amount of fertilizer to use for each crop.\n// {\"acres of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"integer\"}\n// {\"acres of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"integer\"}\n// {\"acres of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"integer\"}\n// {\"amount of fertilizer for each crop\": \"Fertilizer\", \"range\": \"Fertilizer >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe yield per acre of Corn is 1000 kg, Wheat is 800 kg, and Soybeans is 600 kg. The selling price per kg of Corn is $0.20, Wheat is $0.25, and Soybeans is $0.30. The cost of fertilizer per kg is $0.10, and it increases the yield by 5% per kg used. The farm aims to maximize its total revenue from the crops.\n// Revenue from Corn: Revenue_Corn = 0.20 * (1000 + 0.05 * Fertilizer) * Corn\n// Revenue from Wheat: Revenue_Wheat = 0.25 * (800 + 0.05 * Fertilizer) * Wheat\n// Revenue from Soybeans: Revenue_Soybeans = 0.30 * (600 + 0.05 * Fertilizer) * Soybeans\n// So, the objective function is: Maximize (Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\n\n## Generate Constraint-1:\nThe total acres available for planting are 100.\n// Corn + Wheat + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $5000 for purchasing fertilizer.\n// Fertilizer <= 5000",
        "question": "A farm is planning its crop production for the next season. The farm needs to decide how many acres to allocate to three different crops: Corn, Wheat, and Soybeans. Additionally, the farm needs to determine the amount of fertilizer to use for each crop. The yield per acre of Corn is 1000 kg, Wheat is 800 kg, and Soybeans is 600 kg. The selling price per kg of Corn is $0.20, Wheat is $0.25, and Soybeans is $0.30. The cost of fertilizer per kg is $0.10, and it increases the yield by 5% per kg used. The farm aims to maximize its total revenue from the crops. The total acres available for planting are 100. The farm has a budget of $5000 for purchasing fertilizer. Please help the farm maximize its total revenue from the crops.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCorn = model.addVar(vtype=\"INTEGER\", name=\"Corn\", lb=0)  # acres of Corn\nWheat = model.addVar(vtype=\"INTEGER\", name=\"Wheat\", lb=0)  # acres of Wheat\nSoybeans = model.addVar(vtype=\"INTEGER\", name=\"Soybeans\", lb=0)  # acres of Soybeans\nFertilizer = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer\", lb=0)  # amount of fertilizer\n\n# Define objective function\nRevenue_Corn = 0.20 * (1000 + 0.05 * Fertilizer) * Corn\nRevenue_Wheat = 0.25 * (800 + 0.05 * Fertilizer) * Wheat\nRevenue_Soybeans = 0.30 * (600 + 0.05 * Fertilizer) * Soybeans\n# So, the objective function is: Maximize (Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue_Corn + Revenue_Wheat + Revenue_Soybeans)\n\n# Add constraints\n# The total acres available for planting are 100.\nmodel.addCons(Corn + Wheat + Soybeans <= 100)\n# The farm has a budget of $5000 for purchasing fertilizer.\nmodel.addCons(Fertilizer <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Corn: \", model.getVal(Corn))\n    print(\"Acres of Wheat: \", model.getVal(Wheat))\n    print(\"Acres of Soybeans: \", model.getVal(Soybeans))\n    print(\"Amount of Fertilizer: \", model.getVal(Fertilizer))\n    print(\"Maximized Revenue: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 731,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce for each of its two products, Product A and Product B. Additionally, the company is considering investing in a new technology that could reduce production costs for both products.\n// {\"number of units of Product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A is $50, and for Product B is $70. The new technology reduces the production cost by $1 for every $10,000 invested. The selling price for each unit of Product A is $100, and for Product B is $120. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity of 1000 units for Product A and 800 units for Product B.\n// UnitsA <= 1000; UnitsB <= 800\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide the number of units to produce for each of its two products, Product A and Product B. The company is also considering investing in a new technology that could reduce production costs for both products. The cost of producing each unit of Product A is $50, and for Product B is $70. The new technology reduces the production cost by $1 for every $10,000 invested. The selling price for each unit of Product A is $100, and for Product B is $120. The company aims to maximize the total profit from both products.\n\n| Product | Cost per Unit | Selling Price |\n|---------|---------------|---------------|\n| A       | $50           | $100          |\n| B       | $70           | $120          |\n\nThe company has a production capacity of 1000 units for Product A and 800 units for Product B. The total investment in the new technology cannot exceed $50,000.\n\nPlease help the company determine the optimal number of units to produce for each product and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of Product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of Product B\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0) # investment in new technology\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit for the products: Profit = (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB\nmodel.addCons(obj == (100 - (50 - 0.0001 * TechInvestment)) * UnitsA + (120 - (70 - 0.0001 * TechInvestment)) * UnitsB)\n\n# Add constraints\n## The company has a production capacity of 1000 units for Product A and 800 units for Product B.\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 800)\n## The total investment in the new technology cannot exceed $50,000.\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Product B: \", model.getVal(UnitsB))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1107,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the number of each type of cake to bake in the next month to maximize profit while considering the limited resources.\n// {\"number of chocolate cakes\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of vanilla cakes\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of strawberry cakes\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach chocolate cake sells for $20, costs $10 to make, and requires 2 hours of labor. Each vanilla cake sells for $15, costs $8 to make, and requires 1.5 hours of labor. Each strawberry cake sells for $18, costs $9 to make, and requires 1.8 hours of labor. The bakery aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours).\n// Profit from chocolate cakes: Profit_C = (20 - 10) * C\n// Profit from vanilla cakes: Profit_V = (15 - 8) * V\n// Profit from strawberry cakes: Profit_S = (18 - 9) * S\n// Total labor hours: Labor = 2 * C + 1.5 * V + 1.8 * S\n// So, the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / Labor\n\n## Generate Constraint-1:\nThe bakery has a budget of $2000 for ingredients.\n// 10 * C + 8 * V + 9 * S <= 2000",
        "question": "A bakery produces three types of cakes: chocolate, vanilla, and strawberry. The bakery needs to determine the number of each type of cake to bake in the next month to maximize profit while considering the limited resources. Each chocolate cake sells for $20, costs $10 to make, and requires 2 hours of labor. Each vanilla cake sells for $15, costs $8 to make, and requires 1.5 hours of labor. Each strawberry cake sells for $18, costs $9 to make, and requires 1.8 hours of labor. The bakery aims to maximize the profit-to-labor ratio (defined as the total profit divided by the total labor hours). The bakery has a budget of $2000 for ingredients. Please help the bakery determine the optimal number of each type of cake to bake.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of chocolate cakes\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of vanilla cakes\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of strawberry cakes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C = (20 - 10) * C\nProfit_V = (15 - 8) * V\nProfit_S = (18 - 9) * S\nLabor = 2 * C + 1.5 * V + 1.8 * S\n## the objective function is: Maximize (Profit_C + Profit_V + Profit_S) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_C + Profit_V + Profit_S)\n\n# Add constraints\n## The bakery has a budget of $2000 for ingredients.\nmodel.addCons(10 * C + 8 * V + 9 * S <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Chocolate Cakes: \", model.getVal(C))\n    print(\"Number of Vanilla Cakes: \", model.getVal(V))\n    print(\"Number of Strawberry Cakes: \", model.getVal(S))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 729,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 1000 kg, the cost per acre is $500, and the market price per kg is $1. \nFor C2, the yield per acre is 1500 kg, the cost per acre is $600, and the market price per kg is $1.2. \nFor C3, the yield per acre is 2000 kg, the cost per acre is $700, and the market price per kg is $1.5.\nThe farm wants to maximize the profit per acre (revenue minus cost per acre).\n// Profit_C1 = (1000 * C1 * 1) - (500 * C1)\n// Profit_C2 = (1500 * C2 * 1.2) - (600 * C2)\n// Profit_C3 = (2000 * C3 * 1.5) - (700 * C3)\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres of land available.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $50,000 for crop production costs.\n// 500 * C1 + 600 * C2 + 700 * C3 <= 50000",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The yield per acre, cost per acre, and market price per kg for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Cost per Acre | Market Price per Kg |\n|------|----------------|---------------|---------------------|\n| C1   | 1000 kg        | $500          | $1                  |\n| C2   | 1500 kg        | $600          | $1.2                |\n| C3   | 2000 kg        | $700          | $1.5                |\n\nThe farm has a total of 100 acres of land available. The farm has a budget of $50,000 for crop production costs. Please help the farm to maximize the profit per acre (revenue minus cost per acre).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # area of land for C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # area of land for C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (1000 * C1 * 1) - (500 * C1)\nProfit_C2 = (1500 * C2 * 1.2) - (600 * C2)\nProfit_C3 = (2000 * C3 * 1.5) - (700 * C3)\nTotalArea = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalArea\n## convert the division to multiplication\nmodel.addCons(obj * TotalArea == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 acres of land available.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farm has a budget of $50,000 for crop production costs.\nmodel.addCons(500 * C1 + 600 * C2 + 700 * C3 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of land for C1: \", model.getVal(C1))\n    print(\"Area of land for C2: \", model.getVal(C2))\n    print(\"Area of land for C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 745,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $20, but requires 3 hours of labor and 2 units of raw material. \nEach unit of product B generates a profit of $30, but requires 4 hours of labor and 3 units of raw material. \nEach unit of product C generates a profit of $40, but requires 5 hours of labor and 4 units of raw material.\nThe plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material).\n// Profit from A: Profit_A = 20 * A\n// Profit from B: Profit_B = 30 * B\n// Profit from C: Profit_C = 40 * C\n// Resource usage: Resource_A = 3 * A + 2 * A = 5 * A; Resource_B = 4 * B + 3 * B = 7 * B; Resource_C = 5 * C + 4 * C = 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe plant has a total of 1000 hours of labor available.\n// 3 * A + 4 * B + 5 * C <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of units to produce for each product to maximize its profit. The profit, labor hours, and raw material units required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours per Unit | Raw Material Units per Unit |\n|---------|-----------------|----------------------|-----------------------------|\n| A       | $20             | 3                    | 2                           |\n| B       | $30             | 4                    | 3                           |\n| C       | $40             | 5                    | 4                           |\n\nThe plant aims to maximize its total profit while considering the efficiency of resource usage. The objective is to maximize the profit per unit of total resource used (labor and raw material). The plant has a total of 1000 hours of labor available.\n\nPlease help the plant to determine the optimal number of units to produce for each product to maximize the profit per unit of total resource used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 20 * A\nProfit_B = 30 * B\nProfit_C = 40 * C\nResource_A = 5 * A\nResource_B = 7 * B\nResource_C = 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a total of 1000 hours of labor available.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations.\n// {\"quantity of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the profit per unit is $20, but it requires 3 units of a critical component. For Device B, the profit per unit is $30, requiring 2 units of the same critical component. For Device C, the profit per unit is $40, requiring 4 units of the critical component. The company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices.\n// Profit_A = 20 * A - 0.05 * (3 * A)\n// Profit_B = 30 * B - 0.05 * (2 * B)\n// Profit_C = 40 * C - 0.05 * (4 * C)\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a limited supply of the critical component, with only 1000 units available.\n// 3 * A + 2 * B + 4 * C <= 1000",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The company needs to determine the production quantities of each device to optimize their operations. The profit per unit and the requirement of a critical component for each device are given in the following Table.\n\n| Device | Profit per Unit | Critical Component Required |\n|--------|-----------------|-----------------------------|\n| A      | $20             | 3 units                      |\n| B      | $30             | 2 units                      |\n| C      | $40             | 4 units                      |\n\nThe company aims to maximize the total profit, considering that the profit per unit decreases by $0.05 for each additional unit of the critical component used in the production of all devices. The company has a limited supply of the critical component, with only 1000 units available.\nPlease help the company to determine the optimal production quantities for devices A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate profits\nProfit_A = 20 * A - 0.05 * (3 * A)\nProfit_B = 30 * B - 0.05 * (2 * B)\nProfit_C = 40 * C - 0.05 * (4 * C)\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited supply of the critical component, with only 1000 units available.\nmodel.addCons(3 * A + 2 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 999,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 1200 minutes available for the holiday season.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 1200\n\n## Generate Constraint-2:\nThe bakery has a budget of $800 for ingredient costs.\n// 1 * P1 + 1.5 * P2 + 2 * P3 <= 800",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season. For Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. For Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. For Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes. The bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time). The bakery has a total baking time of 1200 minutes available for the holiday season and a budget of $800 for ingredient costs. Please help the bakery determine the optimal number of each pastry to bake to maximize profit efficiency.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 1200 minutes available for the holiday season.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 1200)\n## The bakery has a budget of $800 for ingredient costs.\nmodel.addCons(1 * P1 + 1.5 * P2 + 2 * P3 <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 859,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints.\n// {\"number of components A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of components B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of components C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for component A is $10, for component B is $15, and for component C is $20. The selling price for component A is $25, for component B is $30, and for component C is $40. The plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost.\n// Profit for component A: Profit_A = (25 - 10) * A\n// Profit for component B: Profit_B = (30 - 15) * B\n// Profit for component C: Profit_C = (40 - 20) * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 15 * B + 20 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 20 units of each component to meet minimum order requirements.\n// A >= 20; B >= 20; C >= 20",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency while meeting certain production constraints.\nThe production cost for component A is $10, for component B is $15, and for component C is $20. The selling price for component A is $25, for component B is $30, and for component C is $40. The plant aims to maximize the profit rate, which is defined as the total profit divided by the total production cost.\nThe plant has a budget of $1000 for production costs. The plant must produce at least 20 units of each component to meet minimum order requirements.\nPlease help the plant to maximize the profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 20 units of each component to meet minimum order requirements.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of components A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=20) # number of components B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=20) # number of components C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (25 - 10) * A\nProfit_B = (30 - 15) * B\nProfit_C = (40 - 20) * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 725,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit.\n// {\"production quantity for ProductA\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductB\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ProductC\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for ProductA\": \"AdBudgetA\", \"range\": \"AdBudgetA >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductB\": \"AdBudgetB\", \"range\": \"AdBudgetB >= 0\", \"type\": \"continuous\"}\n// {\"advertising budget for ProductC\": \"AdBudgetC\", \"range\": \"AdBudgetC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of ProductA is $50, and it increases by $0.5 for every $1000 spent on advertising. The profit per unit of ProductB is $70, and it increases by $0.7 for every $1000 spent on advertising. The profit per unit of ProductC is $90, and it increases by $0.9 for every $1000 spent on advertising. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n// Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n// Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe total advertising budget for all products cannot exceed $100,000.\n// AdBudgetA + AdBudgetB + AdBudgetC <= 100000\n\n## Generate Constraint-2:\nThe company has a production capacity of 5000 units for each product.\n// ProdA <= 5000; ProdB <= 5000; ProdC <= 5000\n\n## Generate Constraint-3:\nDue to market research, the company knows that ProductA must have at least twice the production of ProductB.\n// ProdA >= 2 * ProdB\n\n## Generate Constraint-4:\nThe company wants to ensure that each product has at least 1000 units produced.\n// ProdA >= 1000; ProdB >= 1000; ProdC >= 1000\n\n## Generate Constraint-5:\nThe advertising budget for each product must be at least $5000.\n// AdBudgetA >= 5000; AdBudgetB >= 5000; AdBudgetC >= 5000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the advertising budget for each product to maximize their profit. The profit per unit of each product increases with the advertising budget as shown in the following Table.\n\n| Product | Profit per Unit | Advertising Effect |\n|---------|-----------------|--------------------|\n| ProductA | $50 + 0.0005 * AdBudgetA | AdBudgetA |\n| ProductB | $70 + 0.0007 * AdBudgetB | AdBudgetB |\n| ProductC | $90 + 0.0009 * AdBudgetC | AdBudgetC |\n\nThe company has a total advertising budget of $100,000. The company has a production capacity of 5000 units for each product. Due to market research, ProductA must have at least twice the production of ProductB. The company wants to ensure that each product has at least 1000 units produced. The advertising budget for each product must be at least $5000.\n\nPlease help the company to maximize the total profit from all products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=1000) # production quantity for ProductA\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=1000) # production quantity for ProductB\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=1000) # production quantity for ProductC\nAdBudgetA = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetA\", lb=5000) # advertising budget for ProductA\nAdBudgetB = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetB\", lb=5000) # advertising budget for ProductB\nAdBudgetC = model.addVar(vtype=\"CONTINUOUS\", name=\"AdBudgetC\", lb=5000) # advertising budget for ProductC\n\n# Define objective function\n## Total profit for ProductA: Profit_A = (50 + 0.0005 * AdBudgetA) * ProdA\n## Total profit for ProductB: Profit_B = (70 + 0.0007 * AdBudgetB) * ProdB\n## Total profit for ProductC: Profit_C = (90 + 0.0009 * AdBudgetC) * ProdC\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (50 + 0.0005 * AdBudgetA) * ProdA\nProfit_B = (70 + 0.0007 * AdBudgetB) * ProdB\nProfit_C = (90 + 0.0009 * AdBudgetC) * ProdC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total advertising budget for all products cannot exceed $100,000.\nmodel.addCons(AdBudgetA + AdBudgetB + AdBudgetC <= 100000)\n## The company has a production capacity of 5000 units for each product.\nmodel.addCons(ProdA <= 5000)\nmodel.addCons(ProdB <= 5000)\nmodel.addCons(ProdC <= 5000)\n## Due to market research, the company knows that ProductA must have at least twice the production of ProductB.\nmodel.addCons(ProdA >= 2 * ProdB)\n## The company wants to ensure that each product has at least 1000 units produced.\nmodel.addCons(ProdA >= 1000)\nmodel.addCons(ProdB >= 1000)\nmodel.addCons(ProdC >= 1000)\n## The advertising budget for each product must be at least $5000.\nmodel.addCons(AdBudgetA >= 5000)\nmodel.addCons(AdBudgetB >= 5000)\nmodel.addCons(AdBudgetC >= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for ProductA: \", model.getVal(ProdA))\n    print(\"Production Quantity for ProductB: \", model.getVal(ProdB))\n    print(\"Production Quantity for ProductC: \", model.getVal(ProdC))\n    print(\"Advertising Budget for ProductA: \", model.getVal(AdBudgetA))\n    print(\"Advertising Budget for ProductB: \", model.getVal(AdBudgetB))\n    print(\"Advertising Budget for ProductC: \", model.getVal(AdBudgetC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels, wind turbines, and energy-efficient lighting systems in three different locations (Location A, Location B, and Location C).\n// {\"solar panels in Location A\": \"Solar_A\", \"range\": \"Solar_A >= 0\", \"type\": \"integer\"}\n// {\"wind turbines in Location B\": \"Wind_B\", \"range\": \"Wind_B >= 0\", \"type\": \"integer\"}\n// {\"energy-efficient lighting systems in Location C\": \"Light_C\", \"range\": \"Light_C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit.\nThe cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit.\nThe cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit.\nThe company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs.\n// NPV = \u03a3(annual energy savings - maintenance cost) / (1 + discount rate)^year - installation cost\n// So, the objective function is: Maximize NPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05)^1 + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05)^1 + (50 * Light_C - 5 * Light_C) / (1 + 0.05)^1 - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## Generate Constraint-1:\nThe company has a budget of $150,000 for the installation of all systems.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000\n\n## Generate Constraint-2:\nAt least $50,000 must be spent on energy-efficient systems across all locations.\n// 500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000",
        "question": "A company is planning to optimize its energy consumption by installing solar panels in Location A, wind turbines in Location B, and energy-efficient lighting systems in Location C. The cost of installing solar panels in Location A is $500 per unit, with an estimated annual energy savings of $100 per unit and a maintenance cost of $10 per unit. The cost of installing wind turbines in Location B is $1000 per unit, with an estimated annual energy savings of $200 per unit and a maintenance cost of $20 per unit. The cost of installing energy-efficient lighting systems in Location C is $300 per unit, with an estimated annual energy savings of $50 per unit and a maintenance cost of $5 per unit. The company wants to maximize the Net Present Value (NPV) of the investment, which is calculated as the sum of the discounted annual energy savings minus the sum of the installation and maintenance costs. The company has a budget of $150,000 for the installation of all systems and must spend at least $50,000 on energy-efficient systems across all locations. Please help the company determine the optimal number of solar panels in Location A, wind turbines in Location B, and energy-efficient lighting systems in Location C to maximize the NPV.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSolar_A = model.addVar(vtype=\"INTEGER\", name=\"Solar_A\", lb=0) # solar panels in Location A\nWind_B = model.addVar(vtype=\"INTEGER\", name=\"Wind_B\", lb=0) # wind turbines in Location B\nLight_C = model.addVar(vtype=\"INTEGER\", name=\"Light_C\", lb=0) # energy-efficient lighting systems in Location C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## calculate NPV\nNPV = (100 * Solar_A - 10 * Solar_A) / (1 + 0.05) + (200 * Wind_B - 20 * Wind_B) / (1 + 0.05) + (50 * Light_C - 5 * Light_C) / (1 + 0.05) - (500 * Solar_A + 1000 * Wind_B + 300 * Light_C)\n\n## the objective function is: Maximize NPV\nmodel.addCons(obj == NPV)\n\n# Add constraints\n## The company has a budget of $150,000 for the installation of all systems.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C <= 150000)\n## At least $50,000 must be spent on energy-efficient systems across all locations.\nmodel.addCons(500 * Solar_A + 1000 * Wind_B + 300 * Light_C >= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Location A: \", model.getVal(Solar_A))\n    print(\"Number of Wind Turbines in Location B: \", model.getVal(Wind_B))\n    print(\"Number of Energy-Efficient Lighting Systems in Location C: \", model.getVal(Light_C))\n    print(\"Maximized NPV: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1242,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse.\n// {\"number of climate control systems in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of climate control systems in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe effectiveness of each climate control system varies by greenhouse. In greenhouse A, each system increases crop yield by 10 kg per week. In greenhouse B, each system increases yield by 15 kg per week. In greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\n// Yield increase from greenhouse A: Yield_A = 10 * A\n// Yield increase from greenhouse B: Yield_B = 15 * B\n// Yield increase from greenhouse C: Yield_C = 20 * C\n// Cost of systems in greenhouse A: Cost_A = 500 * A\n// Cost of systems in greenhouse B: Cost_B = 700 * B\n// Cost of systems in greenhouse C: Cost_C = 900 * C\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe farm has a budget of $15,000 for installing climate control systems.\n// 500 * A + 700 * B + 900 * C <= 15000\n\n## Generate Constraint-2:\nThe farm wants to ensure that at least 500 kg of additional yield is achieved per week.\n// 10 * A + 15 * B + 20 * C >= 500\n\n## Generate Constraint-3:\nThe farm can install a maximum of 20 systems in total across all greenhouses.\n// A + B + C <= 20",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse can be equipped with a varying number of advanced climate control systems to optimize crop growth. The farm needs to decide how many systems to install in each greenhouse. The effectiveness of each climate control system varies by greenhouse: in greenhouse A, each system increases crop yield by 10 kg per week; in greenhouse B, each system increases yield by 15 kg per week; in greenhouse C, each system increases yield by 20 kg per week. The cost of each system also varies: $500 for A, $700 for B, and $900 for C. The farm aims to maximize the net profit, which is the total yield increase minus the total cost of systems.\n\n| Greenhouse | Yield Increase per System (kg/week) | Cost per System ($) |\n|------------|------------------------------------|---------------------|\n| A          | 10                                 | 500                 |\n| B          | 15                                 | 700                 |\n| C          | 20                                 | 900                 |\n\nThe farm has a budget of $15,000 for installing climate control systems. The farm wants to ensure that at least 500 kg of additional yield is achieved per week. The farm can install a maximum of 20 systems in total across all greenhouses.\n\nPlease help the farm to maximize the net profit by determining the optimal number of climate control systems to install in each greenhouse.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of climate control systems in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of climate control systems in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of climate control systems in greenhouse C\n\n# Define objective function\nYield_A = 10 * A\nYield_B = 15 * B\nYield_C = 20 * C\nCost_A = 500 * A\nCost_B = 700 * B\nCost_C = 900 * C\n# So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) - (Cost_A + Cost_B + Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Yield_A + Yield_B + Yield_C - Cost_A - Cost_B - Cost_C)\n\n# Add constraints\n# The farm has a budget of $15,000 for installing climate control systems.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 15000)\n# The farm wants to ensure that at least 500 kg of additional yield is achieved per week.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 500)\n# The farm can install a maximum of 20 systems in total across all greenhouses.\nmodel.addCons(A + B + C <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Climate Control Systems in Greenhouse A: \", model.getVal(A))\n    print(\"Number of Climate Control Systems in Greenhouse B: \", model.getVal(B))\n    print(\"Number of Climate Control Systems in Greenhouse C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1461,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations.\n// {\"production rate of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"production rate of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"production rate of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product A is $2, product B is $3, and product C is $4. The revenue generated from each unit of product A is $5, product B is $7, and product C is $9. The plant aims to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time. The production time for each unit of product A is 1 hour, product B is 2 hours, and product C is 3 hours.\n// Cost of A: Cost_A = 2 * PA\n// Cost of B: Cost_B = 3 * PB\n// Cost of C: Cost_C = 4 * PC\n// Revenue of A: Revenue_A = 5 * PA\n// Revenue of B: Revenue_B = 7 * PB\n// Revenue of C: Revenue_C = 9 * PC\n// Total Profit: Profit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\n// Total Production Time: Time = PA + 2 * PB + 3 * PC\n// So, the objective function is: Maximize Profit / Time\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for production costs.\n// 2 * PA + 3 * PB + 4 * PC <= 1000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production rate of each product to optimize its operations. The cost, revenue, and production time for each product are given in the following Table.\n\n| Product | Cost per Unit | Revenue per Unit | Production Time per Unit |\n|---------|---------------|------------------|--------------------------|\n| A       | $2            | $5               | 1 hour                    |\n| B       | $3            | $7               | 2 hours                   |\n| C       | $4            | $9               | 3 hours                   |\n\nThe plant has a budget of $1000 for production costs. Please help the plant to maximize its profit rate, which is defined as the total revenue minus the total cost, divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # production rate of product A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # production rate of product B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # production rate of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCost_A = 2 * PA\nCost_B = 3 * PB\nCost_C = 4 * PC\nRevenue_A = 5 * PA\nRevenue_B = 7 * PB\nRevenue_C = 9 * PC\nProfit = (Revenue_A + Revenue_B + Revenue_C) - (Cost_A + Cost_B + Cost_C)\nTime = PA + 2 * PB + 3 * PC\n## the objective function is: Maximize Profit / Time\n## convert the division to multiplication\nmodel.addCons(obj * Time == Profit)\n\n# Add constraints\n## The plant has a budget of $1000 for production costs.\nmodel.addCons(2 * PA + 3 * PB + 4 * PC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of Product A: \", model.getVal(PA))\n    print(\"Production Rate of Product B: \", model.getVal(PB))\n    print(\"Production Rate of Product C: \", model.getVal(PC))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 829,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of hours to operate each production line to maximize profit while considering various constraints.\n// {\"number of hours for ComponentA production\": \"HoursA\", \"range\": \"HoursA >= 0\", \"type\": \"real\"}\n// {\"number of hours for ComponentB production\": \"HoursB\", \"range\": \"HoursB >= 0\", \"type\": \"real\"}\n// {\"number of hours for ComponentC production\": \"HoursC\", \"range\": \"HoursC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for ComponentA is $500, for ComponentB is $700, and for ComponentC is $900. However, the production process for ComponentC has a diminishing return effect where the profit per hour decreases by $10 for every additional hour worked beyond the first 10 hours. The company aims to maximize the total daily profit from all components.\n// Total profit for ComponentA: ProfitA = 500 * HoursA\n// Total profit for ComponentB: ProfitB = 700 * HoursB\n// Total profit for ComponentC: ProfitC = 900 * HoursC - 10 * max(0, HoursC - 10)\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total available operational hours for all production lines combined is 12 hours.\n// HoursA + HoursB + HoursC <= 12\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentA must not exceed twice the production hours of ComponentB.\n// HoursA <= 2 * HoursB\n\n## Generate Constraint-3:\nThe company has a contractual obligation to produce at least 3 hours of ComponentC per day.\n// HoursC >= 3",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of hours to operate each production line to maximize profit while considering various constraints. The profit per hour for each component is given in the following Table.\n\n| Component | Profit per Hour |\n|-----------|-----------------|\n| ComponentA | $500            |\n| ComponentB | $700            |\n| ComponentC | $900            |\n\nHowever, the production process for ComponentC has a diminishing return effect where the profit per hour decreases by $10 for every additional hour worked beyond the first 10 hours. The company aims to maximize the total daily profit from all components.\n\nThe total available operational hours for all production lines combined is 12 hours. Due to resource limitations, the production of ComponentA must not exceed twice the production hours of ComponentB. The company also has a contractual obligation to produce at least 3 hours of ComponentC per day.\n\nPlease help the company to determine the optimal number of hours to operate each production line to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nHoursA = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursA\", lb=0) # number of hours for ComponentA production\nHoursB = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursB\", lb=0) # number of hours for ComponentB production\nHoursC = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC\", lb=3) # number of hours for ComponentC production\n\n# Define objective function\n## Total profit for ComponentA: ProfitA = 500 * HoursA\n## Total profit for ComponentB: ProfitB = 700 * HoursB\n## Total profit for ComponentC: ProfitC = 900 * HoursC - 10 * max(0, HoursC - 10)\n## Create piecewise variables for ComponentC\nHoursC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC1\", lb=0, ub=10)\nHoursC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"HoursC2\", lb=10, ub=12)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(HoursC == HoursC1*C_b1 + HoursC2*C_b2)\nProfitC = 900 * HoursC1 * C_b1 + (900 - 10 * (HoursC2 - 10)) * HoursC2 * C_b2\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == 500 * HoursA + 700 * HoursB + ProfitC)\n\n# Add constraints\n## The total available operational hours for all production lines combined is 12 hours.\nmodel.addCons(HoursA + HoursB + HoursC <= 12)\n## Due to resource limitations, the production of ComponentA must not exceed twice the production hours of ComponentB.\nmodel.addCons(HoursA <= 2 * HoursB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Hours for ComponentA: \", model.getVal(HoursA))\n    print(\"Number of Hours for ComponentB: \", model.getVal(HoursB))\n    print(\"Number of Hours for ComponentC: \", model.getVal(HoursC))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit.\n// {\"raw materials\": \"R\", \"range\": \"R >= 0\", \"type\": \"real\"}\n// {\"labor hours\": \"L\", \"range\": \"L >= 0\", \"type\": \"real\"}\n// {\"machine hours\": \"M\", \"range\": \"M >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each product depends on the amount of raw materials, labor hours, and machine hours used. The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The plant manager aims to maximize the total profit.\n// The objective function is: Maximize P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\n\n## Generate Constraint-1:\nThe total budget for raw materials is $5000.\n// R <= 5000",
        "question": "A manufacturing plant produces three types of products using a complex assembly line. The plant manager needs to optimize the allocation of raw materials, labor hours, and machine hours to maximize profit. The profit from each product depends on the amount of raw materials, labor hours, and machine hours used, and is given by the function P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2. The total budget for raw materials is $5000.\n\nPlease help the plant manager to maximize the total profit while considering the budget constraint for raw materials.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"CONTINUOUS\", name=\"R\", lb=0) # raw materials\nL = model.addVar(vtype=\"CONTINUOUS\", name=\"L\", lb=0) # labor hours\nM = model.addVar(vtype=\"CONTINUOUS\", name=\"M\", lb=0) # machine hours\n\n# Define objective function\n## The profit function is given by P = 100R - 0.5R^2 + 150L - 0.4L^2 + 200M - 0.3M^2\nP = 100*R - 0.5*R**2 + 150*L - 0.4*L**2 + 200*M - 0.3*M**2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P\nmodel.addCons(obj == P)\n\n# Add constraints\n## The total budget for raw materials is $5000.\nmodel.addCons(R <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw Materials: \", model.getVal(R))\n    print(\"Labor Hours: \", model.getVal(L))\n    print(\"Machine Hours: \", model.getVal(M))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 555,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 3\": \"B3\", \"range\": \"B3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer aims to maximize his total profit from selling the crops. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. However, the yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer wants to maximize the total profit, which is the product of the profit per acre and the yield per acre.\n// Profit from wheat: Profit_W = 500 * 0.8 * W1\n// Profit from corn: Profit_C = 700 * 0.9 * C2\n// Profit from barley: Profit_B = 600 * 0.75 * B3\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total available land for all three plots is 100 acres.\n// W1 + C2 + B3 <= 100\n\n## Generate Constraint-2:\nThe farmer must allocate at least 20 acres to wheat and 15 acres to barley.\n// W1 >= 20; B3 >= 15\n\n## Generate Constraint-3:\nThe farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres.\n// C2 <= (W1 + B3) + 10",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The profit per acre for wheat is $500, for corn is $700, and for barley is $600. The yield per acre varies with the plot and crop combination, with wheat having a yield of 0.8, corn 0.9, and barley 0.75. The farmer aims to maximize his total profit from selling the crops, which is the product of the profit per acre and the yield per acre.\n\n| Crop | Profit per Acre | Yield per Acre |\n|------|-----------------|----------------|\n| Wheat | $500           | 0.8            |\n| Corn  | $700           | 0.9            |\n| Barley| $600           | 0.75           |\n\nThe total available land for all three plots is 100 acres. The farmer must allocate at least 20 acres to wheat and 15 acres to barley. The farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres.\n\nPlease help the farmer to maximize his total profit from selling the crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of corn on plot 2\nB3 = model.addVar(vtype=\"INTEGER\", name=\"B3\", lb=15) # acres of barley on plot 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 500 * 0.8 * W1\nProfit_C = 700 * 0.9 * C2\nProfit_B = 600 * 0.75 * B3\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The total available land for all three plots is 100 acres.\nmodel.addCons(W1 + C2 + B3 <= 100)\n## The farmer must allocate at least 20 acres to wheat and 15 acres to barley.\nmodel.addCons(W1 >= 20)\nmodel.addCons(B3 >= 15)\n## The farmer wants to ensure that the total area of corn does not exceed the combined area of wheat and barley by more than 10 acres.\nmodel.addCons(C2 <= (W1 + B3) + 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 2: \", model.getVal(C2))\n    print(\"Acres of Barley on Plot 3: \", model.getVal(B3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1055,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates of these components depend on the number of machines dedicated to each type.\n// {\"number of machines for capacitors\": \"Cap\", \"range\": \"Cap >= 0\", \"type\": \"integer\"}\n// {\"number of machines for resistors\": \"Res\", \"range\": \"Res >= 0\", \"type\": \"integer\"}\n// {\"number of machines for inductors\": \"Ind\", \"range\": \"Ind >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for capacitors produces 100 units per hour, with a maintenance cost of $5 per hour. Each machine for resistors produces 150 units per hour, with a maintenance cost of $7 per hour. Each machine for inductors produces 200 units per hour, with a maintenance cost of $9 per hour. The manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The selling price for each capacitor is $0.1, for each resistor is $0.2, and for each inductor is $0.3.\n// Total production value: Value = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3\n// Total maintenance cost: Cost = 5 * Cap + 7 * Res + 9 * Ind\n// So, the objective function is: Maximize (Value - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $1500 per hour for maintenance costs.\n// 5 * Cap + 7 * Res + 9 * Ind <= 1500\n\n## Generate Constraint-2:\nThe total number of machines available is 20.\n// Cap + Res + Ind <= 20\n\n## Generate Constraint-3:\nAt least 5 machines must be dedicated to capacitors.\n// Cap >= 5",
        "question": "A manufacturer produces three types of electronic components: capacitors, resistors, and inductors. The production rates and maintenance costs for each type of machine are given in the following Table.\n\n| Component | Production Rate (units/hour) | Maintenance Cost ($/hour) | Selling Price ($/unit) |\n|-----------|-------------------------------|---------------------------|-------------------------|\n| Capacitors| 100                           | 5                         | 0.1                     |\n| Resistors | 150                           | 7                         | 0.2                     |\n| Inductors | 200                           | 9                         | 0.3                     |\n\nThe manufacturer wants to maximize the profit, which is the total production value minus the total maintenance cost. The manufacturer has a budget of $1500 per hour for maintenance costs. The total number of machines available is 20. At least 5 machines must be dedicated to capacitors.\nPlease help the manufacturer determine the optimal number of machines for each type of component to maximize profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCap = model.addVar(vtype=\"INTEGER\", name=\"Cap\", lb=5)  # number of machines for capacitors\nRes = model.addVar(vtype=\"INTEGER\", name=\"Res\", lb=0)  # number of machines for resistors\nInd = model.addVar(vtype=\"INTEGER\", name=\"Ind\", lb=0)  # number of machines for inductors\n\n# Define objective function\nValue = 100 * Cap * 0.1 + 150 * Res * 0.2 + 200 * Ind * 0.3  # Total production value\nCost = 5 * Cap + 7 * Res + 9 * Ind  # Total maintenance cost\n# So, the objective function is: Maximize (Value - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Value - Cost)\n\n# Add constraints\n# The manufacturer has a budget of $1500 per hour for maintenance costs.\nmodel.addCons(5 * Cap + 7 * Res + 9 * Ind <= 1500)\n# The total number of machines available is 20.\nmodel.addCons(Cap + Res + Ind <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for Capacitors: \", model.getVal(Cap))\n    print(\"Number of Machines for Resistors: \", model.getVal(Res))\n    print(\"Number of Machines for Inductors: \", model.getVal(Ind))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1105,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit.\n// {\"production quantity for ComponentA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity for ComponentC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Profit from ComponentA: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\n// Profit from ComponentB: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\n// Profit from ComponentC: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units per month.\n// QuantityA + QuantityB + QuantityC <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// QuantityB <= 2 * QuantityA",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the production quantities for each component to optimize their profit. The profit from ComponentA is $50 per unit, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit from ComponentB is $70 per unit, but it decreases by $0.05 for each unit produced beyond the first 200 units. The profit from ComponentC is $90 per unit, but it decreases by $0.02 for each unit produced beyond the first 300 units. The company has a total production capacity of 500 units per month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity for ComponentA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity for ComponentB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity for ComponentC\n\n# Define objective function\n## create piecewise variables for piecewise function: ProfitA = (50 - 0.1 * (QuantityA - 100)) * QuantityA if QuantityA > 100 else 50 * QuantityA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(QuantityA == A1*A_b1 + A2*A_b2)\nProfitA = 50 * A1 * A_b1 + (50 - 0.1 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: ProfitB = (70 - 0.05 * (QuantityB - 200)) * QuantityB if QuantityB > 200 else 70 * QuantityB\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=200)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=200, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(QuantityB == B1*B_b1 + B2*B_b2)\nProfitB = 70 * B1 * B_b1 + (70 - 0.05 * (B2 - 200)) * B2 * B_b2\n## create piecewise variables for piecewise function: ProfitC = (90 - 0.02 * (QuantityC - 300)) * QuantityC if QuantityC > 300 else 90 * QuantityC\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=300)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=300, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(QuantityC == C1*C_b1 + C2*C_b2)\nProfitC = 90 * C1 * C_b1 + (90 - 0.02 * (C2 - 300)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 500)\nmodel.addCons(QuantityB <= 2 * QuantityA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of ComponentA: \", model.getVal(QuantityA))\n    print(\"Quantity of ComponentB: \", model.getVal(QuantityB))\n    print(\"Quantity of ComponentC: \", model.getVal(QuantityC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit.\n// {\"production rate of machine 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"production rate of machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine produces a different product with varying profit margins. \nMachine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. \nMachine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. \nMachine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit.\nThe plant aims to maximize the total daily profit from all three products.\n// The daily profit from machine 1: D1 = 10 * P1 * 5\n// The daily profit from machine 2: D2 = 15 * P2 * 7\n// The daily profit from machine 3: D3 = 20 * P3 * 6\n// So, the objective function is: Maximize (D1 + D2 + D3)\n\n## Generate Constraint-1:\nThe total daily production time for all machines is limited to 8 hours.\n// P1 + P2 + P3 <= 8\n\n## Generate Constraint-2:\nThe production capacity of each machine is limited. Machine 1 can produce up to 100 units per day, Machine 2 up to 150 units per day, and Machine 3 up to 200 units per day.\n// 10 * P1 <= 100; 15 * P2 <= 150; 20 * P3 <= 200",
        "question": "A manufacturing plant produces three types of products using three different machines. The manager needs to determine the production rate of each machine to optimize profit. Machine 1 produces product A at a rate of 10 units per hour, with a profit of $5 per unit. Machine 2 produces product B at a rate of 15 units per hour, with a profit of $7 per unit. Machine 3 produces product C at a rate of 20 units per hour, with a profit of $6 per unit. The plant aims to maximize the total daily profit from all three products. The total daily production time for all machines is limited to 8 hours. The production capacity of each machine is limited: Machine 1 can produce up to 100 units per day, Machine 2 up to 150 units per day, and Machine 3 up to 200 units per day. Please help the manager to determine the optimal production rates for each machine to maximize the total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate of machine 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate of machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate of machine 3\n\n# Define objective function\nD1 = 10 * P1 * 5\nD2 = 15 * P2 * 7\nD3 = 20 * P3 * 6\n# So, the objective function is: Maximize (D1 + D2 + D3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == D1 + D2 + D3)\n\n# Add constraints\n# The total daily production time for all machines is limited to 8 hours.\nmodel.addCons(P1 + P2 + P3 <= 8)\n# The production capacity of each machine is limited.\nmodel.addCons(10 * P1 <= 100)\nmodel.addCons(15 * P2 <= 150)\nmodel.addCons(20 * P3 <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of Machine 1: \", model.getVal(P1))\n    print(\"Production rate of Machine 2: \", model.getVal(P2))\n    print(\"Production rate of Machine 3: \", model.getVal(P3))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 885,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three different products (Product A, Product B, and Product C).\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"real\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"real\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company wants to maximize the total profit while considering the cost of raw materials.\n// Total profit: Profit = 50 * ProductA + 70 * ProductB + 100 * ProductC\n// Cost of raw materials: RawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n// The objective function is: Maximize (Profit - RawMaterialCost)\n\n## Generate Constraint-1:\nThe company has a budget of $5000 for raw materials.\n// 2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000\n\n## Generate Constraint-2:\nThe production capacity for Product A is limited to 100 units.\n// ProductA <= 100",
        "question": "A company is planning to optimize its production of three different products (Product A, Product B, and Product C). The profit per unit of Product A is $50, but it requires 2 units of raw material. Product B yields a profit of $70 per unit and requires 3 units of raw material. Product C yields a profit of $100 per unit and requires 5 units of raw material. The company has a budget of $5000 for raw materials and the production capacity for Product A is limited to 100 units. The company wants to maximize the total profit while considering the cost of raw materials. Please help the company to maximize the total profit by determining the optimal amounts of Product A, Product B, and Product C to produce.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductA\", lb=0) # amount of Product A produced\nProductB = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductB\", lb=0) # amount of Product B produced\nProductC = model.addVar(vtype=\"CONTINUOUS\", name=\"ProductC\", lb=0) # amount of Product C produced\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * ProductA + 70 * ProductB + 100 * ProductC\nRawMaterialCost = 2 * ProductA + 3 * ProductB + 5 * ProductC\n## The objective function is: Maximize (Profit - RawMaterialCost)\nmodel.addCons(obj == Profit - RawMaterialCost)\n\n# Add constraints\n## The company has a budget of $5000 for raw materials.\nmodel.addCons(2 * ProductA + 3 * ProductB + 5 * ProductC <= 5000)\n## The production capacity for Product A is limited to 100 units.\nmodel.addCons(ProductA <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Profit after Raw Material Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 708,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin.\n// {\"production quantity for DeviceA\": \"DeviceAQty\", \"range\": \"DeviceAQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceB\": \"DeviceBQty\", \"range\": \"DeviceBQty >= 0\", \"type\": \"integer\"}\n// {\"production quantity for DeviceC\": \"DeviceCQty\", \"range\": \"DeviceCQty >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\n// Total profit for DeviceA: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\n// Total profit for DeviceB: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\n// Total profit for DeviceC: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 600 units for all devices combined.\n// DeviceAQty + DeviceBQty + DeviceCQty <= 600\n\n## Generate Constraint-2:\nDue to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBQty <= 2 * DeviceAQty\n\n## Generate Constraint-3:\nThe company has a fixed budget for raw materials, which limits the production of DeviceC to at most 300 units.\n// DeviceCQty <= 300",
        "question": "A manufacturing company is producing three types of electronic devices: DeviceA, DeviceB, and DeviceC. They need to determine the production quantity for each device to optimize their profit margin. The profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.2 for each unit produced beyond the first 200 units. The profit per unit for DeviceC is $100, but it decreases by $0.3 for each unit produced beyond the first 300 units. The company wants to maximize the total profit.\nThe company has a total production capacity of 600 units for all devices combined. Due to resource limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a fixed budget for raw materials, which limits the production of DeviceC to at most 300 units.\nPlease help the company to determine the optimal production quantities for DeviceA, DeviceB, and DeviceC to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceAQty\", lb=0) # production quantity for DeviceA\nDeviceBQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceBQty\", lb=0) # production quantity for DeviceB\nDeviceCQty = model.addVar(vtype=\"INTEGER\", name=\"DeviceCQty\", lb=0) # production quantity for DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_DeviceA = (50 - 0.1 * (DeviceAQty - 100)) * DeviceAQty if DeviceAQty > 100 else 50 * DeviceAQty\nDeviceA1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA1\", lb=0, ub=100)\nDeviceA2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA2\", lb=100, ub=600)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAQty == DeviceA1*DeviceA_b1 + DeviceA2*DeviceA_b2)\nProfit_DeviceA = 50 * DeviceA1 * DeviceA_b1 + (50 - 0.1 * (DeviceA2 - 100)) * DeviceA2 * DeviceA_b2\n## create piecewise variables for piecewise function: Profit_DeviceB = (70 - 0.2 * (DeviceBQty - 200)) * DeviceBQty if DeviceBQty > 200 else 70 * DeviceBQty\nDeviceB1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB1\", lb=0, ub=200)\nDeviceB2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB2\", lb=200, ub=600)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBQty == DeviceB1*DeviceB_b1 + DeviceB2*DeviceB_b2)\nProfit_DeviceB = 70 * DeviceB1 * DeviceB_b1 + (70 - 0.2 * (DeviceB2 - 200)) * DeviceB2 * DeviceB_b2\n## create piecewise variables for piecewise function: Profit_DeviceC = (100 - 0.3 * (DeviceCQty - 300)) * DeviceCQty if DeviceCQty > 300 else 100 * DeviceCQty\nDeviceC1 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC1\", lb=0, ub=300)\nDeviceC2 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC2\", lb=300, ub=600)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCQty == DeviceC1*DeviceC_b1 + DeviceC2*DeviceC_b2)\nProfit_DeviceC = 100 * DeviceC1 * DeviceC_b1 + (100 - 0.3 * (DeviceC2 - 300)) * DeviceC2 * DeviceC_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAQty + DeviceBQty + DeviceCQty <= 600)\nmodel.addCons(DeviceBQty <= 2 * DeviceAQty)\nmodel.addCons(DeviceCQty <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity for DeviceA: \", model.getVal(DeviceAQty))\n    print(\"Production Quantity for DeviceB: \", model.getVal(DeviceBQty))\n    print(\"Production Quantity for DeviceC: \", model.getVal(DeviceCQty))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000\n\n## Generate Constraint-2:\nThe total production capacity across all devices is limited to 2000 units.\n// S + T + L <= 2000\n\n## Generate Constraint-3:\nThe market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\n// S >= 500; T >= 300; L >= 400\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// S >= 2T",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The production capacity allows for a maximum of 1000 units of any single device type to be produced. The total production capacity across all devices is limited to 2000 units. The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units. The company has a policy to produce at least twice as many smartphones as tablets. Please help the company to maximize its total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=500) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=300) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=400) # number of laptops\n\n# Define objective function\nP = 100 * S + 150 * T + 200 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P)\n\n# Add constraints\n# The production capacity allows for a maximum of 1000 units of any single device type to be produced.\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n\n# The total production capacity across all devices is limited to 2000 units.\nmodel.addCons(S + T + L <= 2000)\n\n# The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\nmodel.addCons(S >= 500)\nmodel.addCons(T >= 300)\nmodel.addCons(L >= 400)\n\n# The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(S >= 2 * T)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 776,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products.\n// Total profit: Profit = P_a + P_b + P_c = 100Q_a - 0.5Q_a^2 + 150Q_b - 0.6Q_b^2 + 200Q_c - 0.7Q_c^2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nDue to market demand, the production of product A must not exceed 300 units.\n// Qa <= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit, considering the cost of raw materials and labor. The profit from each product depends on the production quantity and a nonlinear relationship between production and cost. The profit for product A is given by \\( P_a = 100Q_a - 0.5Q_a^2 \\), for product B by \\( P_b = 150Q_b - 0.6Q_b^2 \\), and for product C by \\( P_c = 200Q_c - 0.7Q_c^2 \\). The company aims to maximize the total profit from all products. The company has a limited budget for raw materials, which restricts the total production quantity to 1000 units. Due to market demand, the production of product A must not exceed 300 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0, ub=300) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit for product A is given by P_a = 100Q_a - 0.5Q_a^2\nP_a = model.addVar('P_a')\nmodel.addCons(P_a == 100 * Qa - 0.5 * Qa**2)\n## The profit for product B is given by P_b = 150Q_b - 0.6Q_b^2\nP_b = model.addVar('P_b')\nmodel.addCons(P_b == 150 * Qb - 0.6 * Qb**2)\n## The profit for product C is given by P_c = 200Q_c - 0.7Q_c^2\nP_c = model.addVar('P_c')\nmodel.addCons(P_c == 200 * Qc - 0.7 * Qc**2)\n## Total profit: Profit = P_a + P_b + P_c\nmodel.addCons(obj == P_a + P_b + P_c)\n\n# Add constraints\n## The company has a limited budget for raw materials, which restricts the total production quantity to 1000 units.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 826,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000\n\n## Generate Constraint-3:\nAt least 200 units of product A must be produced.\n// A >= 200\n\n## Generate Constraint-4:\nThe production of product B must not exceed 300 units.\n// B <= 300",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\nThe manufacturer has a budget of $50,000 for investing in the new production technology. The total production capacity is limited to 1000 units across all products. At least 200 units of product A must be produced. The production of product B must not exceed 300 units.\nPlease help the manufacturer to determine the optimal production quantities for products A, B, and C, and the investment in the new production technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=300) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1086,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit.\n// {\"production quantity of ProductA\": \"QuantityA\", \"range\": \"QuantityA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductB\": \"QuantityB\", \"range\": \"QuantityB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of ProductC\": \"QuantityC\", \"range\": \"QuantityC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products.\n// Total profit for ProductA: ProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\n// Total profit for ProductB: ProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\n// Total profit for ProductC: ProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n// So, the objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// QuantityA + QuantityB + QuantityC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: ProductA, ProductB, and ProductC. The company needs to determine the production quantity of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost per unit. The production cost per unit of ProductA is $50 - 0.01 * Automation, of ProductB is $70 - 0.015 * Automation, and of ProductC is $90 - 0.02 * Automation. The selling price per unit of ProductA is $100, of ProductB is $120, and of ProductC is $150. The company aims to maximize the total profit from all products. The company has a total production capacity of 1000 units across all products. The investment in automation cannot exceed $50,000. Please help the company to determine the optimal production quantities and level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQuantityA = model.addVar(vtype=\"INTEGER\", name=\"QuantityA\", lb=0) # production quantity of ProductA\nQuantityB = model.addVar(vtype=\"INTEGER\", name=\"QuantityB\", lb=0) # production quantity of ProductB\nQuantityC = model.addVar(vtype=\"INTEGER\", name=\"QuantityC\", lb=0) # production quantity of ProductC\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\nProfitA = (100 - (50 - 0.01 * Automation)) * QuantityA\nProfitB = (120 - (70 - 0.015 * Automation)) * QuantityB\nProfitC = (150 - (90 - 0.02 * Automation)) * QuantityC\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(QuantityA + QuantityB + QuantityC <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of ProductA: \", model.getVal(QuantityA))\n    print(\"Production Quantity of ProductB: \", model.getVal(QuantityB))\n    print(\"Production Quantity of ProductC: \", model.getVal(QuantityC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 866,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A sells for $100, costs $60 to produce, and requires 1.5 hours of labor. \nEach device B sells for $150, costs $80 to produce, and requires 2 hours of labor. \nEach device C sells for $200, costs $100 to produce, and requires 2.5 hours of labor.\nThe company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = (100 - 60) * A = 40 * A\n// Profit of B: Profit_B = (150 - 80) * B = 70 * B\n// Profit of C: Profit_C = (200 - 100) * C = 100 * C\n// Total labor hours: L = 1.5 * A + 2 * B + 2.5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / L = (40 * A + 70 * B + 100 * C) / (1.5 * A + 2 * B + 2.5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs next month.\n// 60 * A + 80 * B + 100 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each device next month.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources. The selling price, production cost, and labor hours required for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Labor Hours Required |\n|--------|---------------|-----------------|----------------------|\n| A      | $100          | $60             | 1.5 hours            |\n| B      | $150          | $80             | 2 hours              |\n| C      | $200          | $100            | 2.5 hours            |\n\nThe company has a budget of $10,000 for production costs next month. The company wants to produce at least 50 units of each device next month. The company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours. Please help the company determine the optimal number of units of each device to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each device next month.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 40 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nLaborHours = 1.5 * A + 2 * B + 2.5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs next month.\nmodel.addCons(60 * A + 80 * B + 100 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1014,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each product is influenced by a nonlinear relationship between production quantity and market demand. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products.\n// Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n// So, the objective function is: Maximize \\(P_{total}\\)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// \\(Q_a + Q_b + Q_c \\leq 1000\\)\n\n## Generate Constraint-2:\nThe production of product A must not exceed 400 units due to limited raw materials.\n// \\(Q_a \\leq 400\\)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to maximize profit while considering the costs of raw materials and labor. The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\). The company aims to maximize the total profit from all products. The total production capacity of the company is limited to 1000 units per month. The production of product A must not exceed 400 units due to limited raw materials. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=0) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=0) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## The profit from each product is influenced by a nonlinear relationship between production quantity and market demand.\n## The profit from product A is given by \\(P_a = 100Q_a - 0.1Q_a^2\\), from product B by \\(P_b = 150Q_b - 0.2Q_b^2\\), and from product C by \\(P_c = 200Q_c - 0.3Q_c^2\\).\n## The company aims to maximize the total profit from all products.\n## Total profit: \\(P_{total} = P_a + P_b + P_c = 100Q_a - 0.1Q_a^2 + 150Q_b - 0.2Q_b^2 + 200Q_c - 0.3Q_c^2\\)\n## So, the objective function is: Maximize \\(P_{total}\\)\nPa = 100 * Qa - 0.1 * Qa**2\nPb = 150 * Qb - 0.2 * Qb**2\nPc = 200 * Qc - 0.3 * Qc**2\nPtotal = Pa + Pb + Pc\n\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Ptotal)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per month.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n## The production of product A must not exceed 400 units due to limited raw materials.\nmodel.addCons(Qa <= 400)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 707,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C.\n// {\"number of Widget A produced\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost.\n// net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n// net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n// net profit per unit of Widget C: ProfitC = 60 - 25 = 35\n// The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n## Generate Constraint-1:\nThe company has a total budget of $15,000 for production costs.\n// 20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000\n\n## Generate Constraint-2:\nThe production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\n// WidgetA <= 200\n// WidgetB <= 300\n// WidgetC <= 250\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of any product.\n// WidgetA + WidgetB + WidgetC >= 100\n\n## Generate Constraint-4:\nThe company aims to produce no more than 60% of the total units in any single product.\n// WidgetA <= 0.6 * (WidgetA + WidgetB + WidgetC)\n// WidgetB <= 0.6 * (WidgetA + WidgetB + WidgetC)\n// WidgetC <= 0.6 * (WidgetA + WidgetB + WidgetC)",
        "question": "A manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C. The profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost. The company has a total budget of $15,000 for production costs. The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units. The company must produce at least 100 units of any product. The company aims to produce no more than 60% of the total units in any single product. Please help the company determine the optimal number of units to produce for each product to maximize their net profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0)  # number of Widget A produced\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0)  # number of Widget B produced\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0)  # number of Widget C produced\n\n# Define objective function\nProfitA = 30  # net profit per unit of Widget A\nProfitB = 40  # net profit per unit of Widget B\nProfitC = 35  # net profit per unit of Widget C\n# The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n# Add constraints\n# The company has a total budget of $15,000 for production costs.\nmodel.addCons(20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000)\n# The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\nmodel.addCons(WidgetA <= 200)\nmodel.addCons(WidgetB <= 300)\nmodel.addCons(WidgetC <= 250)\n# The company must produce at least 100 units of any product.\nmodel.addCons(WidgetA + WidgetB + WidgetC >= 100)\n# The company aims to produce no more than 60% of the total units in any single product.\nmodel.addCons(WidgetA <= 0.6 * (WidgetA + WidgetB + WidgetC))\nmodel.addCons(WidgetB <= 0.6 * (WidgetA + WidgetB + WidgetC))\nmodel.addCons(WidgetC <= 0.6 * (WidgetA + WidgetB + WidgetC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(WidgetA))\n    print(\"Number of Widget B produced: \", model.getVal(WidgetB))\n    print(\"Number of Widget C produced: \", model.getVal(WidgetC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 816,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations.\n// {\"number of trucks for CargoA\": \"CargoATrucks\", \"range\": \"CargoATrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoB\": \"CargoBTrucks\", \"range\": \"CargoBTrucks >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for CargoC\": \"CargoCTrucks\", \"range\": \"CargoCTrucks >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company earns $5,000 per truck for CargoA, incurs a fuel cost of $1,000 per truck, and a maintenance cost of $500 per truck. \nFor CargoB, the earnings are $7,000 per truck, with a fuel cost of $1,500 per truck and a maintenance cost of $700 per truck. \nFor CargoC, the earnings are $10,000 per truck, with a fuel cost of $2,000 per truck and a maintenance cost of $1,000 per truck.\nThe company aims to maximize the total net profit from all cargo types.\n// Total net profit for CargoA: Profit_CargoA = (5,000 - 1,000 - 500) * CargoATrucks\n// Total net profit for CargoB: Profit_CargoB = (7,000 - 1,500 - 700) * CargoBTrucks\n// Total net profit for CargoC: Profit_CargoC = (10,000 - 2,000 - 1,000) * CargoCTrucks\n// So, the objective function is: Maximize (Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// CargoATrucks + CargoBTrucks + CargoCTrucks <= 50\n\n## Generate Constraint-2:\nDue to operational requirements, CargoB must have at least half as many trucks as CargoA.\n// CargoBTrucks >= 0.5 * CargoATrucks\n\n## Generate Constraint-3:\nThe company has a budget of $100,000 for maintenance costs for the quarter.\n// 500 * CargoATrucks + 700 * CargoBTrucks + 1,000 * CargoCTrucks <= 100,000",
        "question": "A logistics company is managing three types of cargo shipments: CargoA, CargoB, and CargoC. They need to decide how many trucks to allocate for each type of cargo to optimize their operations. The earnings, fuel costs, and maintenance costs per truck for each cargo type are given in the following Table.\n\n| Cargo Type | Earnings per Truck | Fuel Cost per Truck | Maintenance Cost per Truck |\n|------------|--------------------|---------------------|----------------------------|\n| CargoA     | $5,000             | $1,000              | $500                       |\n| CargoB     | $7,000             | $1,500              | $700                       |\n| CargoC     | $10,000            | $2,000              | $1,000                     |\n\nThe company has a total of 50 trucks available for allocation. Due to operational requirements, CargoB must have at least half as many trucks as CargoA. The company has a budget of $100,000 for maintenance costs for the quarter. \n\nPlease help the company to maximize the total net profit from all cargo types.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nCargoATrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoATrucks\", lb=0)  # number of trucks for CargoA\nCargoBTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoBTrucks\", lb=0)  # number of trucks for CargoB\nCargoCTrucks = model.addVar(vtype=\"INTEGER\", name=\"CargoCTrucks\", lb=0)  # number of trucks for CargoC\n\n# Define objective function\nProfit_CargoA = (5000 - 1000 - 500) * CargoATrucks\nProfit_CargoB = (7000 - 1500 - 700) * CargoBTrucks\nProfit_CargoC = (10000 - 2000 - 1000) * CargoCTrucks\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_CargoA + Profit_CargoB + Profit_CargoC)\n\n# Add constraints\n# The company has a total of 50 trucks available for allocation.\nmodel.addCons(CargoATrucks + CargoBTrucks + CargoCTrucks <= 50)\n# Due to operational requirements, CargoB must have at least half as many trucks as CargoA.\nmodel.addCons(CargoBTrucks >= 0.5 * CargoATrucks)\n# The company has a budget of $100,000 for maintenance costs for the quarter.\nmodel.addCons(500 * CargoATrucks + 700 * CargoBTrucks + 1000 * CargoCTrucks <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for CargoA: \", model.getVal(CargoATrucks))\n    print(\"Number of Trucks for CargoB: \", model.getVal(CargoBTrucks))\n    print(\"Number of Trucks for CargoC: \", model.getVal(CargoCTrucks))\n    print(\"Maximized Total Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1051,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities.\n// {\"number of Trucks\": \"Trucks\", \"range\": \"Trucks >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"Vans\", \"range\": \"Vans >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"Bikes\", \"range\": \"Bikes >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company wants to maximize the net profit per dollar invested.\n// Total revenue: Revenue = 200,000 * Trucks + 100,000 * Vans + 20,000 * Bikes\n// Total cost: Cost = (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes) + (10,000 * Trucks + 5,000 * Vans + 1,000 * Bikes)\n// Net profit: Profit = Revenue - Cost\n// So, the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n\n## Generate Constraint-1:\nThe company has a budget of $5,000,000 for vehicle purchases.\n// 100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes <= 5,000,000\n\n## Generate Constraint-2:\nThe company must have at least 50 vehicles in total.\n// Trucks + Vans + Bikes >= 50\n\n## Generate Constraint-3:\nThe number of Trucks must not exceed twice the number of Vans.\n// Trucks <= 2 * Vans",
        "question": "A logistics company is planning its fleet expansion by considering three types of vehicles: Trucks, Vans, and Bikes. The company needs to decide how many of each type of vehicle to purchase to optimize its delivery capabilities. The cost of a Truck is $100,000, a Van is $50,000, and a Bike is $10,000. The annual maintenance cost for a Truck is $10,000, for a Van is $5,000, and for a Bike is $1,000. The company estimates that each Truck can generate $200,000 in revenue annually, each Van can generate $100,000, and each Bike can generate $20,000. The company has a budget of $5,000,000 for vehicle purchases and must have at least 50 vehicles in total. Additionally, the number of Trucks must not exceed twice the number of Vans. The company wants to maximize the net profit per dollar invested. Please help the company determine the optimal number of Trucks, Vans, and Bikes to purchase.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTrucks = model.addVar(vtype=\"INTEGER\", name=\"Trucks\", lb=0)  # number of Trucks\nVans = model.addVar(vtype=\"INTEGER\", name=\"Vans\", lb=0)  # number of Vans\nBikes = model.addVar(vtype=\"INTEGER\", name=\"Bikes\", lb=0)  # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue = 200000 * Trucks + 100000 * Vans + 20000 * Bikes\nCost = (100000 * Trucks + 50000 * Vans + 10000 * Bikes) + (10000 * Trucks + 5000 * Vans + 1000 * Bikes)\nProfit = Revenue - Cost\n## the objective function is: Maximize Profit / (100,000 * Trucks + 50,000 * Vans + 10,000 * Bikes)\n## convert the division to multiplication\nmodel.addCons(obj * (100000 * Trucks + 50000 * Vans + 10000 * Bikes) == Profit)\n\n# Add constraints\n## The company has a budget of $5,000,000 for vehicle purchases.\nmodel.addCons(100000 * Trucks + 50000 * Vans + 10000 * Bikes <= 5000000)\n## The company must have at least 50 vehicles in total.\nmodel.addCons(Trucks + Vans + Bikes >= 50)\n## The number of Trucks must not exceed twice the number of Vans.\nmodel.addCons(Trucks <= 2 * Vans)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(Trucks))\n    print(\"Number of Vans: \", model.getVal(Vans))\n    print(\"Number of Bikes: \", model.getVal(Bikes))\n    print(\"Maximized Net Profit per Dollar Invested: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 892,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C.\n// {\"number of Widget A produced\": \"WidgetA\", \"range\": \"WidgetA >= 0\", \"type\": \"integer\"}\n// {\"number of Widget B produced\": \"WidgetB\", \"range\": \"WidgetB >= 0\", \"type\": \"integer\"}\n// {\"number of Widget C produced\": \"WidgetC\", \"range\": \"WidgetC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Widget A is $50, Widget B is $70, and Widget C is $60. The production cost per unit of Widget A is $20, Widget B is $30, and Widget C is $25. The company wants to maximize the net profit per unit, which is the profit minus the cost.\n// net profit per unit of Widget A: ProfitA = 50 - 20 = 30\n// net profit per unit of Widget B: ProfitB = 70 - 30 = 40\n// net profit per unit of Widget C: ProfitC = 60 - 25 = 35\n// The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n## Generate Constraint-1:\nThe company has a total budget of $15,000 for production costs.\n// 20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000\n\n## Generate Constraint-2:\nThe production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\n// WidgetA <= 200\n// WidgetB <= 300\n// WidgetC <= 250\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of any product.\n// WidgetA + WidgetB + WidgetC >= 100\n\n## Generate Constraint-4:\nThe company aims to produce no more than 60% of the total units in any single product.\n// WidgetA <= 0.6 * (WidgetA + WidgetB + WidgetC)\n// WidgetB <= 0.6 * (WidgetA + WidgetB + WidgetC)\n// WidgetC <= 0.6 * (WidgetA + WidgetB + WidgetC)",
        "question": "A manufacturing company needs to optimize its production of three products: Widget A, Widget B, and Widget C. The profit per unit and production cost per unit for each widget are given in the following Table.\n\n| Widget | Profit per Unit | Production Cost per Unit |\n|--------|-----------------|--------------------------|\n| A      | $50             | $20                      |\n| B      | $70             | $30                      |\n| C      | $60             | $25                      |\n\nThe company has a total budget of $15,000 for production costs. The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units. The company must produce at least 100 units of any product. The company aims to produce no more than 60% of the total units in any single product. \n\nPlease help the company to maximize the net profit per unit, which is the profit minus the cost, by determining the optimal number of units to produce for each widget.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWidgetA = model.addVar(vtype=\"INTEGER\", name=\"WidgetA\", lb=0)  # number of Widget A produced\nWidgetB = model.addVar(vtype=\"INTEGER\", name=\"WidgetB\", lb=0)  # number of Widget B produced\nWidgetC = model.addVar(vtype=\"INTEGER\", name=\"WidgetC\", lb=0)  # number of Widget C produced\n\n# Define objective function\nProfitA = 30  # net profit per unit of Widget A\nProfitB = 40  # net profit per unit of Widget B\nProfitC = 35  # net profit per unit of Widget C\n# The objective function is: Maximize (ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA * WidgetA + ProfitB * WidgetB + ProfitC * WidgetC)\n\n# Add constraints\n# The company has a total budget of $15,000 for production costs.\nmodel.addCons(20 * WidgetA + 30 * WidgetB + 25 * WidgetC <= 15000)\n# The production capacity for Widget A is limited to 200 units, for Widget B to 300 units, and for Widget C to 250 units.\nmodel.addCons(WidgetA <= 200)\nmodel.addCons(WidgetB <= 300)\nmodel.addCons(WidgetC <= 250)\n# The company must produce at least 100 units of any product.\nmodel.addCons(WidgetA + WidgetB + WidgetC >= 100)\n# The company aims to produce no more than 60% of the total units in any single product.\nmodel.addCons(WidgetA <= 0.6 * (WidgetA + WidgetB + WidgetC))\nmodel.addCons(WidgetB <= 0.6 * (WidgetA + WidgetB + WidgetC))\nmodel.addCons(WidgetC <= 0.6 * (WidgetA + WidgetB + WidgetC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Widget A produced: \", model.getVal(WidgetA))\n    print(\"Number of Widget B produced: \", model.getVal(WidgetB))\n    print(\"Number of Widget C produced: \", model.getVal(WidgetC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 991,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for C1 is $1000, but it requires 2 units of water per acre. \nFor C2, the profit per acre is $1200, and it requires 3 units of water per acre. \nFor C3, the profit per acre is $1500, and it requires 4 units of water per acre.\nThe farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water).\n// Profit_C1 = 1000 * C1\n// Profit_C2 = 1200 * C2\n// Profit_C3 = 1500 * C3\n// Water_C1 = 2 * C1\n// Water_C2 = 3 * C2\n// Water_C3 = 4 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 50 acres available for cultivation.\n// C1 + C2 + C3 <= 50\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 100 units.\n// 2 * C1 + 3 * C2 + 4 * C3 <= 100",
        "question": "A farm produces three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for C1 is $1000, but it requires 2 units of water per acre. For C2, the profit per acre is $1200, and it requires 3 units of water per acre. For C3, the profit per acre is $1500, and it requires 4 units of water per acre. The farm has a limited water supply and can only use a total of 100 units of water. The farmer wants to maximize the total profit while considering the water usage efficiency (profit per unit of water). The farm has a total of 50 acres available for cultivation. Please help the farmer determine the optimal allocation of acres to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1\nProfit_C2 = 1200 * C2\nProfit_C3 = 1500 * C3\nWater_C1 = 2 * C1\nWater_C2 = 3 * C2\nWater_C3 = 4 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (Water_C1 + Water_C2 + Water_C3)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_C1 + Water_C2 + Water_C3) == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 50 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 50)\n## The farm has a limited water supply of 100 units.\nmodel.addCons(2 * C1 + 3 * C2 + 4 * C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Profit per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 705,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered.\n// Total daily cost: Cost = 500 * T + 300 * V + 100 * B\n// Total packages delivered: Packages = 100 * T + 50 * V + 20 * B\n// The company needs to deliver at least 2000 packages per day.\n// So, the objective function is: Minimize Cost subject to Packages >= 2000\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle operations.\n// 500 * T + 300 * V + 100 * B <= 10,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements. The delivery capacity and daily cost for each vehicle type are given in the following Table.\n\n| Vehicle Type | Delivery Capacity (packages/day) | Daily Cost ($) |\n|--------------|---------------------------------|----------------|\n| Trucks       | 100                             | 500            |\n| Vans         | 50                              | 300            |\n| Bikes        | 20                              | 100            |\n\nThe company has a budget of $10,000 per day for vehicle operations. Due to maintenance constraints, the total number of vehicles cannot exceed 30. The company needs to deliver at least 2000 packages per day. \n\nPlease help the company to minimize the total daily cost while ensuring all packages are delivered.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * T + 300 * V + 100 * B\nPackages = 100 * T + 50 * V + 20 * B\n## The company needs to deliver at least 2000 packages per day.\nmodel.addCons(Packages >= 2000)\n\n# Add constraints\n## The company has a budget of $10,000 per day for vehicle operations.\nmodel.addCons(500 * T + 300 * V + 100 * B <= 10000)\n## Due to maintenance constraints, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 974,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The initial production cost per unit for each product is $100. The selling price per unit for product 1 is $150, for product 2 is $200, and for product 3 is $250. The company aims to maximize the total profit from all products.\n// Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n// Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n// Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed 100 units per hour.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe production rate for each product must be at least 10 units per hour.\n// P1 >= 10; P2 >= 10; P3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation to be implemented, which affects the production cost. The selling price per unit and the initial production cost per unit for each product are given in the following Table.\n\n| Product | Selling Price per Unit | Initial Production Cost per Unit |\n|---------|------------------------|---------------------------------|\n| 1       | $150                   | $100                            |\n| 2       | $200                   | $100                            |\n| 3       | $250                   | $100                            |\n\nThe production cost per unit decreases by $5 for every $10,000 invested in automation. The company aims to maximize the total profit from all products. The total production rate for all products must not exceed 100 units per hour. The investment in automation cannot exceed $50,000. The production rate for each product must be at least 10 units per hour.\n\nPlease help the company determine the optimal production rates for each product and the level of automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=10) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=10) # production rate for product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=10) # production rate for product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for product 1: Profit1 = (150 - (100 - 0.0005 * Automation)) * P1\n## Total profit for product 2: Profit2 = (200 - (100 - 0.0005 * Automation)) * P2\n## Total profit for product 3: Profit3 = (250 - (100 - 0.0005 * Automation)) * P3\nProfit1 = (150 - (100 - 0.0005 * Automation)) * P1\nProfit2 = (200 - (100 - 0.0005 * Automation)) * P2\nProfit3 = (250 - (100 - 0.0005 * Automation)) * P3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit1 + Profit2 + Profit3)\nmodel.addCons(obj == Profit1 + Profit2 + Profit3)\n\n# Add constraints\n## The total production rate for all products must not exceed 100 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Production Rate for Product 3: \", model.getVal(P3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1227,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage.\n// {\"quantity of E1\": \"Q1\", \"range\": \"Q1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E2\": \"Q2\", \"range\": \"Q2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of E3\": \"Q3\", \"range\": \"Q3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of E1 is $30, with a production cost of $10 per unit and a power consumption of 5 watts per unit. \nThe profit per unit of E2 is $40, with a production cost of $15 per unit and a power consumption of 8 watts per unit. \nThe profit per unit of E3 is $50, with a production cost of $20 per unit and a power consumption of 10 watts per unit.\nThe manufacturer has a limited power supply of 500 watts. The goal is to maximize the profit per watt of power consumed.\n// Profit_E1 = 30 * Q1 - 10 * Q1\n// Profit_E2 = 40 * Q2 - 15 * Q2\n// Profit_E3 = 50 * Q3 - 20 * Q3\n// So, the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / (5 * Q1 + 8 * Q2 + 10 * Q3)\n\n## Generate Constraint-1:\nThe manufacturer has a limited power supply of 500 watts.\n// 5 * Q1 + 8 * Q2 + 10 * Q3 <= 500\n\n## Generate Constraint-2:\nThe manufacturer has a budget of $3000 for production costs.\n// 10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000",
        "question": "A manufacturer produces three types of electronic components: E1, E2, and E3. They need to determine the production quantities of each component to optimize their profit and resource usage. The profit per unit, production cost, and power consumption for each component are given in the following Table.\n\n| Component | Profit per Unit | Production Cost | Power Consumption |\n|-----------|-----------------|-----------------|-------------------|\n| E1        | $30             | $10             | 5 watts           |\n| E2        | $40             | $15             | 8 watts           |\n| E3        | $50             | $20             | 10 watts          |\n\nThe manufacturer has a limited power supply of 500 watts and a budget of $3000 for production costs. The goal is to maximize the profit per watt of power consumed. Please help the manufacturer determine the optimal production quantities for each component.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ1 = model.addVar(vtype=\"INTEGER\", name=\"Q1\", lb=0) # quantity of E1\nQ2 = model.addVar(vtype=\"INTEGER\", name=\"Q2\", lb=0) # quantity of E2\nQ3 = model.addVar(vtype=\"INTEGER\", name=\"Q3\", lb=0) # quantity of E3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_E1 = (30 - 10) * Q1\nProfit_E2 = (40 - 15) * Q2\nProfit_E3 = (50 - 20) * Q3\nPowerConsumption = 5 * Q1 + 8 * Q2 + 10 * Q3\n## the objective function is: Maximize (Profit_E1 + Profit_E2 + Profit_E3) / PowerConsumption\n## convert the division to multiplication\nmodel.addCons(obj * PowerConsumption == Profit_E1 + Profit_E2 + Profit_E3)\n\n# Add constraints\n## The manufacturer has a limited power supply of 500 watts.\nmodel.addCons(5 * Q1 + 8 * Q2 + 10 * Q3 <= 500)\n## The manufacturer has a budget of $3000 for production costs.\nmodel.addCons(10 * Q1 + 15 * Q2 + 20 * Q3 <= 3000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of E1: \", model.getVal(Q1))\n    print(\"Quantity of E2: \", model.getVal(Q2))\n    print(\"Quantity of E3: \", model.getVal(Q3))\n    print(\"Maximized Profit per Watt: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 911,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand.\n// {\"number of solar panels on building 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on building 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach solar panel on building 1 generates 2 kWh per day, on building 2 generates 3 kWh per day, and on building 3 generates 4 kWh per day. The cost of installing a solar panel on building 1 is $500, on building 2 is $600, and on building 3 is $700. The company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh.\n// Total daily energy generated: E = 2 * P1 + 3 * P2 + 4 * P3\n// Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\n// So, the objective function is: Minimize C\n\n## Generate Constraint-1:\nThe total daily energy generated must meet or exceed 100 kWh.\n// 2 * P1 + 3 * P2 + 4 * P3 >= 100\n\n## Generate Constraint-2:\nThe company has a budget of $50,000 for the installation.\n// 500 * P1 + 600 * P2 + 700 * P3 <= 50000\n\n## Generate Constraint-3:\nEach building has a limited space for solar panels. Building 1 can accommodate up to 50 panels, building 2 up to 60 panels, and building 3 up to 70 panels.\n// P1 <= 50; P2 <= 60; P3 <= 70",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different buildings. The company needs to decide the number of solar panels to install on each building to minimize energy costs while meeting the energy demand. The specifications for each building are given in the following Table.\n\n| Building | Energy Generated per Panel (kWh/day) | Cost per Panel ($) | Maximum Panels |\n|----------|-------------------------------------|--------------------|----------------|\n| 1        | 2                                   | 500               | 50             |\n| 2        | 3                                   | 600               | 60             |\n| 3        | 4                                   | 700               | 70             |\n\nThe company aims to minimize the total cost of installation while ensuring that the total daily energy generated meets or exceeds the required 100 kWh. The company has a budget of $50,000 for the installation. Each building has a limited space for solar panels as specified in the table. Please help the company determine the optimal number of solar panels to install on each building.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of solar panels on building 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of solar panels on building 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of solar panels on building 3\n\n# Define objective function\n## Total cost of installation: C = 500 * P1 + 600 * P2 + 700 * P3\nC = 500 * P1 + 600 * P2 + 700 * P3\n## So, the objective function is: Minimize C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == C)\n\n# Add constraints\n## The total daily energy generated must meet or exceed 100 kWh.\nmodel.addCons(2 * P1 + 3 * P2 + 4 * P3 >= 100)\n## The company has a budget of $50,000 for the installation.\nmodel.addCons(500 * P1 + 600 * P2 + 700 * P3 <= 50000)\n## Each building has a limited space for solar panels. Building 1 can accommodate up to 50 panels, building 2 up to 60 panels, and building 3 up to 70 panels.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 60)\nmodel.addCons(P3 <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Building 1: \", model.getVal(P1))\n    print(\"Number of Solar Panels on Building 2: \", model.getVal(P2))\n    print(\"Number of Solar Panels on Building 3: \", model.getVal(P3))\n    print(\"Minimized Cost of Installation: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1156,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the profit per acre is $100, but it requires 2 units of water per acre. \nFor Crop B, the profit per acre is $150, but it requires 3 units of water per acre. \nFor Crop C, the profit per acre is $200, but it requires 4 units of water per acre.\nThe farm aims to maximize the total profit from all crops.\n// Profit from Crop A: Profit_A = 100 * A\n// Profit from Crop B: Profit_B = 150 * B\n// Profit from Crop C: Profit_C = 200 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply, with a maximum of 300 units of water available.\n// 2 * A + 3 * B + 4 * C <= 300\n\n## Generate Constraint-3:\nDue to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\n// A <= 40; B <= 50",
        "question": "A farm produces three types of crops: A, B, and C. The farm needs to determine how much land to allocate to each crop to maximize its profit.\nFor Crop A, the profit per acre is $100, but it requires 2 units of water per acre. \nFor Crop B, the profit per acre is $150, but it requires 3 units of water per acre. \nFor Crop C, the profit per acre is $200, but it requires 4 units of water per acre.\nThe farm has a total of 100 acres available for cultivation. The farm has a limited water supply, with a maximum of 300 units of water available. Due to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\nPlease help the farm to maximize the total profit from all crops.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a limited water supply, with a maximum of 300 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 300)\n## Due to soil conditions, the farm can allocate at most 40 acres to Crop A and at most 50 acres to Crop B.\nmodel.addCons(A <= 40)\nmodel.addCons(B <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 712,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend.\n// {\"number of Croissants\": \"Croissant\", \"range\": \"Croissant >= 0\", \"type\": \"integer\"}\n// {\"number of Danishes\": \"Danish\", \"range\": \"Danish >= 0\", \"type\": \"integer\"}\n// {\"number of \u00c9clairs\": \"\u00c9clair\", \"range\": \"\u00c9clair >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n// Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\n// Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\n// Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n// So, the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\n\n## Generate Constraint-1:\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\n// 50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000\n\n## Generate Constraint-2:\nThe bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\n// Croissant <= 300; Danish <= 250; \u00c9clair <= 200",
        "question": "A bakery produces three types of pastries: Croissant, Danish, and \u00c9clair. The bakery needs to determine the number of each pastry to bake for the upcoming weekend. The profit per Croissant is $2, per Danish is $3, and per \u00c9clair is $4. Due to the freshness factor, the profit per unit increases by $0.02 for each additional unit produced beyond 100 units for that type. The bakery aims to maximize the total profit from selling the pastries.\n\n| Pastry   | Profit per Unit | Butter Required (g) | Daily Demand Limit |\n|----------|-----------------|---------------------|--------------------|\n| Croissant| $2              | 50                  | 300                |\n| Danish   | $3              | 40                  | 250                |\n| \u00c9clair   | $4              | 30                  | 200                |\n\nThe bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g. The bakery also has a daily demand limit for each pastry: the demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\n\nPlease help the bakery to maximize the total profit from selling the pastries while considering the constraints on butter supply and daily demand limits.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery has a daily demand limit for each pastry. The demand for Croissants is at most 300, for Danishes is at most 250, and for \u00c9clairs is at most 200.\nCroissant = model.addVar(vtype=\"INTEGER\", name=\"Croissant\", lb=0, ub=300) # number of Croissants\nDanish = model.addVar(vtype=\"INTEGER\", name=\"Danish\", lb=0, ub=250) # number of Danishes\n\u00c9clair = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair\", lb=0, ub=200) # number of \u00c9clairs\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Croissant = max(2 + 0.02 * (Croissant - 100), 2) * Croissant\nCroissant1 = model.addVar(vtype=\"INTEGER\", name=\"Croissant1\", lb=0, ub=100)\nCroissant2 = model.addVar(vtype=\"INTEGER\", name=\"Croissant2\", lb=100, ub=300)\nCroissant_b1 = model.addVar(vtype=\"B\", name=\"Croissant_b1\")\nCroissant_b2 = model.addVar(vtype=\"B\", name=\"Croissant_b2\")\nmodel.addCons(Croissant_b1 + Croissant_b2 == 1)\nmodel.addCons(Croissant == Croissant1*Croissant_b1 + Croissant2*Croissant_b2)\nProfit_Croissant = 2 * Croissant1 * Croissant_b1 + (2 + 0.02 * (Croissant2 - 100)) * Croissant2 * Croissant_b2\n## create piecewise variables for piecewise function: Profit_Danish = max(3 + 0.02 * (Danish - 100), 3) * Danish\nDanish1 = model.addVar(vtype=\"INTEGER\", name=\"Danish1\", lb=0, ub=100)\nDanish2 = model.addVar(vtype=\"INTEGER\", name=\"Danish2\", lb=100, ub=250)\nDanish_b1 = model.addVar(vtype=\"B\", name=\"Danish_b1\")\nDanish_b2 = model.addVar(vtype=\"B\", name=\"Danish_b2\")\nmodel.addCons(Danish_b1 + Danish_b2 == 1)\nmodel.addCons(Danish == Danish1*Danish_b1 + Danish2*Danish_b2)\nProfit_Danish = 3 * Danish1 * Danish_b1 + (3 + 0.02 * (Danish2 - 100)) * Danish2 * Danish_b2\n## create piecewise variables for piecewise function: Profit_\u00c9clair = max(4 + 0.02 * (\u00c9clair - 100), 4) * \u00c9clair\n\u00c9clair1 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair1\", lb=0, ub=100)\n\u00c9clair2 = model.addVar(vtype=\"INTEGER\", name=\"\u00c9clair2\", lb=100, ub=200)\n\u00c9clair_b1 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b1\")\n\u00c9clair_b2 = model.addVar(vtype=\"B\", name=\"\u00c9clair_b2\")\nmodel.addCons(\u00c9clair_b1 + \u00c9clair_b2 == 1)\nmodel.addCons(\u00c9clair == \u00c9clair1*\u00c9clair_b1 + \u00c9clair2*\u00c9clair_b2)\nProfit_\u00c9clair = 4 * \u00c9clair1 * \u00c9clair_b1 + (4 + 0.02 * (\u00c9clair2 - 100)) * \u00c9clair2 * \u00c9clair_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Croissant + Profit_Danish + Profit_\u00c9clair\nmodel.addCons(obj == Profit_Croissant + Profit_Danish + Profit_\u00c9clair)\n\n# Add constraints\n## The bakery has a limited supply of butter, which is a key ingredient. Each Croissant requires 50 g of butter, each Danish requires 40 g, and each \u00c9clair requires 30 g. The total available butter is 2000 g.\nmodel.addCons(50 * Croissant + 40 * Danish + 30 * \u00c9clair <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Croissants: \", model.getVal(Croissant))\n    print(\"Number of Danishes: \", model.getVal(Danish))\n    print(\"Number of \u00c9clairs: \", model.getVal(\u00c9clair))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1335,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock.\n// {\"number of units to produce\": \"Units\", \"range\": \"Units >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n// {\"amount of raw materials to stock\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100. The selling price per unit is $150. The company aims to maximize the total profit from the production.\n// Total profit: Profit = (150 - 100 + 0.005 * Automation) * Units\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for automation upgrades.\n// Automation <= 50000\n\n## Generate Constraint-2:\nThe total number of units produced must not exceed 10,000 units.\n// Units <= 10000\n\n## Generate Constraint-3:\nThe amount of raw materials stocked must be sufficient to produce at least 5,000 units.\n// RawMaterials >= 5000 * Units\n\n## Generate Constraint-4:\nThe level of automation must be at least 10% of the total budget allocated for automation.\n// Automation >= 0.1 * 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide the number of units to produce, the level of automation to implement in the production process, and the amount of raw materials to stock. The cost of production per unit decreases by $5 for every $1000 invested in automation. The initial production cost per unit is $100, and the selling price per unit is $150. The company aims to maximize the total profit from the production.\nThe company has a budget of $50,000 for automation upgrades. The total number of units produced must not exceed 10,000 units. The amount of raw materials stocked must be sufficient to produce at least 5,000 units. The level of automation must be at least 10% of the total budget allocated for automation.\nPlease help the company determine the optimal number of units to produce, the level of automation, and the amount of raw materials to stock to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits = model.addVar(vtype=\"INTEGER\", name=\"Units\", lb=0)  # number of units to produce\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0)  # amount of raw materials to stock\n\n# Define objective function\nProfit = (150 - 100 + 0.005 * Automation) * Units\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a budget of $50,000 for automation upgrades.\nmodel.addCons(Automation <= 50000)\n# The total number of units produced must not exceed 10,000 units.\nmodel.addCons(Units <= 10000)\n# The amount of raw materials stocked must be sufficient to produce at least 5,000 units.\nmodel.addCons(RawMaterials >= 5000 * Units)\n# The level of automation must be at least 10% of the total budget allocated for automation.\nmodel.addCons(Automation >= 0.1 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units: \", model.getVal(Units))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Amount of Raw Materials: \", model.getVal(RawMaterials))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 954,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\n// {\"number of TypeA solar panels\": \"TypeASolarPanels\", \"range\": \"TypeASolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeB solar panels\": \"TypeBSolarPanels\", \"range\": \"TypeBSolarPanels >= 0\", \"type\": \"integer\"}\n// {\"number of TypeC solar panels\": \"TypeCSolarPanels\", \"range\": \"TypeCSolarPanels >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company wants to maximize the total energy output per dollar spent.\n// Total energy output for TypeA: Energy_TypeA = 100 * 365 * 10 * TypeASolarPanels\n// Total energy output for TypeB: Energy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\n// Total energy output for TypeC: Energy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\n// Total cost for TypeA: Cost_TypeA = 500 * TypeASolarPanels\n// Total cost for TypeB: Cost_TypeB = 750 * TypeBSolarPanels\n// Total cost for TypeC: Cost_TypeC = 1000 * TypeCSolarPanels\n// So, the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n\n## Generate Constraint-1:\nThe company has a budget of $1,000,000 for the installation.\n// 500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1,000,000\n\n## Generate Constraint-2:\nThe facility has space for a maximum of 1500 solar panels.\n// TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500\n\n## Generate Constraint-3:\nDue to local regulations, at least 20% of the panels must be TypeA.\n// TypeASolarPanels >= 0.2 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels)",
        "question": "A renewable energy company is planning to install three types of solar panels: TypeA, TypeB, and TypeC. They need to determine the number of each type of solar panel to install in a new facility to maximize energy output while considering the cost and efficiency of each type.\nTypeA solar panels produce 100 kWh per day, cost $500 each, and have a lifespan of 10 years. \nTypeB solar panels produce 150 kWh per day, cost $750 each, and have a lifespan of 12 years. \nTypeC solar panels produce 200 kWh per day, cost $1000 each, and have a lifespan of 15 years.\nThe company has a budget of $1,000,000 for the installation. The facility has space for a maximum of 1500 solar panels. Due to local regulations, at least 20% of the panels must be TypeA.\nPlease help the company to maximize the total energy output per dollar spent.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTypeASolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeASolarPanels\", lb=0)\nTypeBSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeBSolarPanels\", lb=0)\nTypeCSolarPanels = model.addVar(vtype=\"INTEGER\", name=\"TypeCSolarPanels\", lb=0)\n\n# Define objective function\nEnergy_TypeA = 100 * 365 * 10 * TypeASolarPanels\nEnergy_TypeB = 150 * 365 * 12 * TypeBSolarPanels\nEnergy_TypeC = 200 * 365 * 15 * TypeCSolarPanels\nCost_TypeA = 500 * TypeASolarPanels\nCost_TypeB = 750 * TypeBSolarPanels\nCost_TypeC = 1000 * TypeCSolarPanels\n\n# set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n# the objective function is: Maximize (Energy_TypeA + Energy_TypeB + Energy_TypeC) / (Cost_TypeA + Cost_TypeB + Cost_TypeC)\n# convert the division to multiplication\nmodel.addCons(obj * (Cost_TypeA + Cost_TypeB + Cost_TypeC) == Energy_TypeA + Energy_TypeB + Energy_TypeC)\n\n# Add constraints\n# The company has a budget of $1,000,000 for the installation.\nmodel.addCons(500 * TypeASolarPanels + 750 * TypeBSolarPanels + 1000 * TypeCSolarPanels <= 1000000)\n# The facility has space for a maximum of 1500 solar panels.\nmodel.addCons(TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels <= 1500)\n# Due to local regulations, at least 20% of the panels must be TypeA.\nmodel.addCons(TypeASolarPanels >= 0.2 * (TypeASolarPanels + TypeBSolarPanels + TypeCSolarPanels))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TypeA Solar Panels: \", model.getVal(TypeASolarPanels))\n    print(\"Number of TypeB Solar Panels: \", model.getVal(TypeBSolarPanels))\n    print(\"Number of TypeC Solar Panels: \", model.getVal(TypeCSolarPanels))\n    print(\"Maximized Energy Output per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 824,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. \nEach machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. \nEach machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. \nThe company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The objective is to minimize the total cost of production, including setup and operating costs.\n// Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n// Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n// Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 50\n\n## Generate Constraint-2:\nDue to space limitations, no more than 20 machines can be allocated to ComponentA.\n// MachinesA <= 20\n\n## Generate Constraint-3:\nTo ensure a balanced production, at least 10 machines must be allocated to ComponentB.\n// MachinesB >= 10",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize production time. Each machine for ComponentA can produce 100 units per hour, with a setup cost of $500 and an hourly operating cost of $100. Each machine for ComponentB can produce 150 units per hour, with a setup cost of $600 and an hourly operating cost of $120. Each machine for ComponentC can produce 200 units per hour, with a setup cost of $700 and an hourly operating cost of $140. The company needs to produce at least 10,000 units of ComponentA, 15,000 units of ComponentB, and 20,000 units of ComponentC. The company has a total of 50 machines available for allocation. Due to space limitations, no more than 20 machines can be allocated to ComponentA. To ensure a balanced production, at least 10 machines must be allocated to ComponentB. Please help the company to minimize the total cost of production, including setup and operating costs.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=10) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Total cost for ComponentA: Cost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## convert the division to multiplication\nCost_A = 500 * MachinesA + 100 * (10000 / (100 * MachinesA))\n## Total cost for ComponentB: Cost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## convert the division to multiplication\nCost_B = 600 * MachinesB + 120 * (15000 / (150 * MachinesB))\n## Total cost for ComponentC: Cost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n## convert the division to multiplication\nCost_C = 700 * MachinesC + 140 * (20000 / (200 * MachinesC))\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a total of 50 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 50)\n## Due to space limitations, no more than 20 machines can be allocated to ComponentA.\nmodel.addCons(MachinesA <= 20)\n## To ensure a balanced production, at least 10 machines must be allocated to ComponentB.\nmodel.addCons(MachinesB >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1099,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. There are total 60 workers available. Please help the company to decide the optimal allocation of workers to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 679,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different wind farms to generate electricity. The manager needs to determine the optimal number of turbines to install in each farm to maximize efficiency while meeting certain power output requirements.\n// {\"number of turbines in farm 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of turbines in farm 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach turbine in farm 1 generates 10 MWh of electricity, in farm 2 generates 12 MWh, and in farm 3 generates 15 MWh. The efficiency of the farms decreases nonlinearly with the number of turbines installed due to resource sharing and maintenance constraints. The efficiency function is given by E(x) = 100 / (1 + x^2), where x is the number of turbines. The company aims to maximize the total electricity generated while considering the efficiency of each farm.\n// The total electricity generated: E_total = 10 * T1 * E(T1) + 12 * T2 * E(T2) + 15 * T3 * E(T3)\n// So, the objective function is: Maximize E_total\n\n## Generate Constraint-1:\nThe total budget allows for the installation of up to 50 turbines across all farms.\n// T1 + T2 + T3 <= 50\n\n## Generate Constraint-2:\nEach farm has a maximum capacity for installing turbines. Farm 1 can install up to 20 turbines, farm 2 up to 25 turbines, and farm 3 up to 30 turbines.\n// T1 <= 20; T2 <= 25; T3 <= 30\n\n## Generate Constraint-3:\nThe company must ensure that the total power output from all farms meets a minimum requirement of 500 MWh.\n// 10 * T1 + 12 * T2 + 15 * T3 >= 500",
        "question": "A company operates three different wind farms to generate electricity. The manager needs to determine the optimal number of turbines to install in each farm to maximize efficiency while meeting certain power output requirements. Each turbine in farm 1 generates 10 MWh of electricity, in farm 2 generates 12 MWh, and in farm 3 generates 15 MWh. The efficiency of the farms decreases nonlinearly with the number of turbines installed due to resource sharing and maintenance constraints. The efficiency function is given by E(x) = 100 / (1 + x^2), where x is the number of turbines. The company aims to maximize the total electricity generated while considering the efficiency of each farm.\n\n| Farm | Electricity per Turbine | Maximum Turbines |\n|------|-------------------------|------------------|\n| 1    | 10 MWh                  | 20               |\n| 2    | 12 MWh                  | 25               |\n| 3    | 15 MWh                  | 30               |\n\nThe total budget allows for the installation of up to 50 turbines across all farms. Each farm has a maximum capacity for installing turbines as specified in the table. The company must ensure that the total power output from all farms meets a minimum requirement of 500 MWh.\n\nPlease help the company to maximize the total electricity generated while considering the efficiency of each farm.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of turbines in farm 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of turbines in farm 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of turbines in farm 3\n\n# Define objective function\n## The efficiency function is given by E(x) = 100 / (1 + x^2)\nE_T1 = 100 / (1 + T1**2)\nE_T2 = 100 / (1 + T2**2)\nE_T3 = 100 / (1 + T3**2)\nE_total = 10 * T1 * E_T1 + 12 * T2 * E_T2 + 15 * T3 * E_T3\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize E_total\nmodel.addCons(obj == E_total)\n\n# Add constraints\n## The total budget allows for the installation of up to 50 turbines across all farms.\nmodel.addCons(T1 + T2 + T3 <= 50)\n## Each farm has a maximum capacity for installing turbines. Farm 1 can install up to 20 turbines, farm 2 up to 25 turbines, and farm 3 up to 30 turbines.\nmodel.addCons(T1 <= 20)\nmodel.addCons(T2 <= 25)\nmodel.addCons(T3 <= 30)\n## The company must ensure that the total power output from all farms meets a minimum requirement of 500 MWh.\nmodel.addCons(10 * T1 + 12 * T2 + 15 * T3 >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Turbines in Farm 1: \", model.getVal(T1))\n    print(\"Number of Turbines in Farm 2: \", model.getVal(T2))\n    print(\"Number of Turbines in Farm 3: \", model.getVal(T3))\n    print(\"Maximized Total Electricity Generated: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1351,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product.\n// {\"number of units of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"resources allocated to Product A\": \"ResourceA\", \"range\": \"ResourceA >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product B\": \"ResourceB\", \"range\": \"ResourceB >= 0\", \"type\": \"continuous\"}\n// {\"resources allocated to Product C\": \"ResourceC\", \"range\": \"ResourceC >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, Product B is $70, and Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n// Total profit for Product A: ProfitA = 50 * ProductA\n// Total profit for Product B: ProfitB = 70 * ProductB\n// Total profit for Product C: ProfitC = 60 * ProductC\n// The objective function is: Maximize (ProfitA + ProfitB + ProfitC)\n\n## Generate Constraint-1:\nThe total resources available are limited to 1000 units.\n// ResourceA + ResourceB + ResourceC <= 1000\n\n## Generate Constraint-2:\nThe production of Product A is limited to a maximum of 200 units.\n// ProductA <= 200\n\n## Generate Constraint-3:\nThe production of Product B must be at least 100 units.\n// ProductB >= 100\n\n## Generate Constraint-4:\nThe production of Product C cannot exceed 150 units.\n// ProductC <= 150",
        "question": "A manufacturer is planning to produce three types of products: A, B, and C. The production involves determining the number of units of each product to be produced and the amount of resources (labor and materials) allocated to each product. The profit per unit for Product A is $50, for Product B is $70, and for Product C is $60. The resource allocation affects the production efficiency, where more resources lead to a nonlinear increase in production capacity. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | 50$             |\n| B       | 70$             |\n| C       | 60$             |\n\nThe total resources available are limited to 1000 units. The production of Product A is limited to a maximum of 200 units. The production of Product B must be at least 100 units. The production of Product C cannot exceed 150 units.\n\nPlease help the manufacturer determine the optimal number of units of each product and the amount of resources allocated to each to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0, ub=200)  # number of units of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=100, ub=None)  # number of units of Product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0, ub=150)  # number of units of Product C\nResourceA = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceA\", lb=0)  # resources allocated to Product A\nResourceB = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceB\", lb=0)  # resources allocated to Product B\nResourceC = model.addVar(vtype=\"CONTINUOUS\", name=\"ResourceC\", lb=0)  # resources allocated to Product C\n\n# Define objective function\nProfitA = 50 * ProductA\nProfitB = 70 * ProductB\nProfitC = 60 * ProductC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB + ProfitC)\n\n# Add constraints\nmodel.addCons(ResourceA + ResourceB + ResourceC <= 1000)\nmodel.addCons(ProductA <= 200)\nmodel.addCons(ProductB >= 100)\nmodel.addCons(ProductC <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Resources Allocated to Product A: \", model.getVal(ResourceA))\n    print(\"Resources Allocated to Product B: \", model.getVal(ResourceB))\n    print(\"Resources Allocated to Product C: \", model.getVal(ResourceC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1076,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop.\n// {\"area for Crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"area for Crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"area for Crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water).\n// Profit_A = 1000 * A\n// Profit_B = 1500 * B\n// Profit_C = 2000 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe farmer has access to a total of 100 units of water.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe total available land for cultivation is 50 hectares.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe market demand for Crop A is limited to 20 hectares.\n// A <= 20",
        "question": "A farmer is planning to cultivate three different crops: Crop A, Crop B, and Crop C. The farmer needs to decide on the area (in hectares) to allocate for each crop. The profit per hectare for Crop A is $1000, but it requires 2 units of water per hectare. Crop B yields a profit of $1500 per hectare and requires 3 units of water per hectare. Crop C yields a profit of $2000 per hectare and requires 4 units of water per hectare. The farmer aims to maximize the total profit while considering the efficiency of water usage (profit per unit of water). The farmer has access to a total of 100 units of water. The total available land for cultivation is 50 hectares. The market demand for Crop A is limited to 20 hectares. Please help the farmer determine the optimal area to allocate for each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # area for Crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # area for Crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # area for Crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 1000 * A\nProfit_B = 1500 * B\nProfit_C = 2000 * C\nWaterUsage = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has access to a total of 100 units of water.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The total available land for cultivation is 50 hectares.\nmodel.addCons(A + B + C <= 50)\n## The market demand for Crop A is limited to 20 hectares.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for Crop A: \", model.getVal(A))\n    print(\"Area for Crop B: \", model.getVal(B))\n    print(\"Area for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 795,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Device A, the selling price is $100, the production cost is $50, and the energy consumption is 2 kWh per unit. \nFor Device B, the selling price is $150, the production cost is $70, and the energy consumption is 3 kWh per unit. \nFor Device C, the selling price is $200, the production cost is $90, and the energy consumption is 4 kWh per unit.\nThe manufacturer aims to maximize the profit per unit of energy consumed.\n// Profit of A: Profit_A = (100 - 50) * A\n// Profit of B: Profit_B = (150 - 70) * B\n// Profit of C: Profit_C = (200 - 90) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A + 3 * B + 4 * C)\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production costs.\n// 50 * A + 70 * B + 90 * C <= 10000\n\n## Generate Constraint-2:\nThe manufacturer wants to produce at least 50 units of each device.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturer produces three types of electronic devices: A, B, and C. The manufacturer needs to determine the production quantity of each device to optimize resource usage and profit. The selling price, production cost, and energy consumption for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Energy Consumption (kWh) |\n|--------|---------------|-----------------|--------------------------|\n| A      | 100$          | 50$             | 2                        |\n| B      | 150$          | 70$             | 3                        |\n| C      | 200$          | 90$             | 4                        |\n\nThe manufacturer has a budget of $10,000 for production costs. The manufacturer wants to produce at least 50 units of each device. Please help the manufacturer to maximize the profit per unit of energy consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The manufacturer wants to produce at least 50 units of each device.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 50) * A\nProfit_B = (150 - 70) * B\nProfit_C = (200 - 90) * C\nEnergyConsumption = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / EnergyConsumption\n## convert the division to multiplication\nmodel.addCons(obj * EnergyConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production costs.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit per Unit of Energy Consumed: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 868,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is planning to cultivate three types of crops: C1, C2, and C3. They need to determine the area (in acres) to allocate for each crop. Additionally, the farm needs to decide on the amount of fertilizer to use, which affects the yield and cost of each crop.\n// {\"area for C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"continuous\"}\n// {\"area for C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"continuous\"}\n// {\"area for C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"continuous\"}\n// {\"amount of fertilizer\": \"Fertilizer\", \"range\": \"Fertilizer >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nFor C1, the profit per acre is $1000, the cost of fertilizer per acre is $50, and the yield increases by 10% for every $100 of fertilizer used. \nFor C2, the profit per acre is $1200, the cost of fertilizer per acre is $60, and the yield increases by 12% for every $100 of fertilizer used. \nFor C3, the profit per acre is $1500, the cost of fertilizer per acre is $70, and the yield increases by 15% for every $100 of fertilizer used.\nThe farm wants to maximize the total profit from all crops, considering the yield enhancement from fertilizer.\n// Profit_C1 = 1000 * C1 * (1 + 0.1 * (Fertilizer / 100)) - 50 * C1\n// Profit_C2 = 1200 * C2 * (1 + 0.12 * (Fertilizer / 100)) - 60 * C2\n// Profit_C3 = 1500 * C3 * (1 + 0.15 * (Fertilizer / 100)) - 70 * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe total cost of fertilizer cannot exceed $5000.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 5000\n\n## Generate Constraint-3:\nThe farm must allocate at least 20 acres to C1.\n// C1 >= 20",
        "question": "A farm is planning to cultivate three types of crops: C1, C2, and C3. They need to determine the area (in acres) to allocate for each crop and the amount of fertilizer to use, which affects the yield and cost of each crop. The profit per acre, cost of fertilizer per acre, and yield increase per $100 of fertilizer used for each crop are given in the following Table.\n\n| Crop | Profit per Acre | Cost of Fertilizer per Acre | Yield Increase per $100 of Fertilizer |\n|------|-----------------|-----------------------------|--------------------------------------|\n| C1   | $1000           | $50                         | 10%                                  |\n| C2   | $1200           | $60                         | 12%                                  |\n| C3   | $1500           | $70                         | 15%                                  |\n\nThe farm has a total of 100 acres available for cultivation. The total cost of fertilizer cannot exceed $5000. The farm must allocate at least 20 acres to C1. \nPlease help the farm to maximize the total profit from all crops, considering the yield enhancement from fertilizer.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=20) # area for C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # area for C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # area for C3\nFertilizer = model.addVar(vtype=\"CONTINUOUS\", name=\"Fertilizer\", lb=0) # amount of fertilizer\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * C1 * (1 + 0.1 * (Fertilizer / 100)) - 50 * C1\nProfit_C2 = 1200 * C2 * (1 + 0.12 * (Fertilizer / 100)) - 60 * C2\nProfit_C3 = 1500 * C3 * (1 + 0.15 * (Fertilizer / 100)) - 70 * C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3)\nmodel.addCons(obj == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The total cost of fertilizer cannot exceed $5000.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area for C1: \", model.getVal(C1))\n    print(\"Area for C2: \", model.getVal(C2))\n    print(\"Area for C3: \", model.getVal(C3))\n    print(\"Amount of Fertilizer: \", model.getVal(Fertilizer))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1127,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency, increasing by 1 unit per hour for every $1000 invested. The initial production rate is 10 units per hour. The company aims to meet the demand of 1000 units for each product while minimizing the total production time.\n\nThe company has a total of 40 hours available for production in a week. Please help the company determine the optimal allocation of hours for each product and the investment in production efficiency to minimize the maximum production time for any of the three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=0)  # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=0)  # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=0)  # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0)  # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## Production time for each product\nT1 = 1000 / (10 + 0.001 * Efficiency) * H1\nT2 = 1000 / (10 + 0.001 * Efficiency) * H2\nT3 = 1000 / (10 + 0.001 * Efficiency) * H3\n\n## Convert the max function to a constraint\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 802,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. \nVehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. \nVehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons.\nThe company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency).\n// Cost per ton-km for A: Cost_A = 200 / (5 * 10 * A)\n// Cost per ton-km for B: Cost_B = 300 / (10 * 15 * B)\n// Cost per ton-km for C: Cost_C = 400 / (15 * 20 * C)\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle maintenance next month.\n// 200 * A + 300 * B + 400 * C <= 10000\n\n## Generate Constraint-2:\nThe company needs to transport at least 100 tons of cargo next month.\n// 5 * A + 10 * B + 15 * C >= 100",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine how many vehicles of each type to deploy for the next month to optimize their operations. Vehicle A has a fuel efficiency of 10 km/l, a maintenance cost of $200 per month, and a cargo capacity of 5 tons. Vehicle B has a fuel efficiency of 15 km/l, a maintenance cost of $300 per month, and a cargo capacity of 10 tons. Vehicle C has a fuel efficiency of 20 km/l, a maintenance cost of $400 per month, and a cargo capacity of 15 tons. The company has a budget of $10,000 for vehicle maintenance next month and needs to transport at least 100 tons of cargo next month. The company aims to minimize the total cost per ton-kilometer (defined as the sum of maintenance costs divided by the product of cargo capacity and fuel efficiency). Please help the company determine the optimal number of vehicles of each type to deploy.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 200 / (5 * 10 * A)\nCost_B = 300 / (10 * 15 * B)\nCost_C = 400 / (15 * 20 * C)\n## convert the division to multiplication\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle maintenance next month.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n## The company needs to transport at least 100 tons of cargo next month.\nmodel.addCons(5 * A + 10 * B + 15 * C >= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Minimized Cost per Ton-Kilometer: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 919,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit.\n// {\"number of units of DeviceA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.1 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.05 for each unit of DeviceA produced. The profit per unit for DeviceC is $100, but it decreases by $0.2 for each unit of DeviceB produced. The company aims to maximize the total profit.\n// Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\n// Profit_B = (70 - 0.05 * UnitsA) * UnitsB\n// Profit_C = (100 - 0.2 * UnitsB) * UnitsC\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe company has a production capacity of 500 units in total for all devices.\n// UnitsA + UnitsB + UnitsC <= 500\n\n## Generate Constraint-2:\nDue to market demand, the production of DeviceA must be at least twice the production of DeviceB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC.\n// 20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each device are produced to meet minimum market requirements.\n// UnitsA >= 50; UnitsB >= 50; UnitsC >= 50",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce in the next month to optimize its profit. The profit per unit for each device and the constraints on production are detailed in the following Table.\n\n| Device | Profit per Unit | Constraints on Profit |\n|--------|-----------------|-----------------------|\n| DeviceA | $50, decreasing by $0.1 for each unit beyond the first 100 | None |\n| DeviceB | $70, decreasing by $0.05 for each unit of DeviceA produced | None |\n| DeviceC | $100, decreasing by $0.2 for each unit of DeviceB produced | None |\n\nThe company has a production capacity of 500 units in total for all devices. Due to market demand, the production of DeviceA must be at least twice the production of DeviceB. The company has a budget of $20,000 for raw materials, and the cost of raw materials per unit is $20 for DeviceA, $30 for DeviceB, and $40 for DeviceC. The company wants to ensure that at least 50 units of each device are produced to meet minimum market requirements.\n\nPlease help the company to maximize the total profit by determining the optimal number of units to produce for each device.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=50) # number of units of DeviceA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=50) # number of units of DeviceB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=50) # number of units of DeviceC\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (50 - 0.1 * max(UnitsA - 100, 0)) * UnitsA\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(UnitsA == A1*A_b1 + A2*A_b2)\nProfit_A = (50 - 0.1 * A2) * A2 * A_b2 + 50 * A1 * A_b1\n## Profit_B = (70 - 0.05 * UnitsA) * UnitsB\nProfit_B = (70 - 0.05 * UnitsA) * UnitsB\n## Profit_C = (100 - 0.2 * UnitsB) * UnitsC\nProfit_C = (100 - 0.2 * UnitsB) * UnitsC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 500)\nmodel.addCons(UnitsA >= 2 * UnitsB)\nmodel.addCons(20 * UnitsA + 30 * UnitsB + 40 * UnitsC <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA: \", model.getVal(UnitsA))\n    print(\"Number of DeviceB: \", model.getVal(UnitsB))\n    print(\"Number of DeviceC: \", model.getVal(UnitsC))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1232,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line.\n// {\"number of workers on product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of workers on product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on product A can produce 10 units per hour, product B produces 15 units per hour, and product C produces 20 units per hour. The manufacturer wants to maximize the total production rate while considering the cost of labor. The cost of labor per hour for product A is $20, for product B is $25, and for product C is $30. The objective is to maximize the net production value (total production rate minus labor cost).\n// Total production rate: Production = 10 * A + 15 * B + 20 * C\n// Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n// So, the objective function is: Maximize (Production - Cost)\n\n## Generate Constraint-1:\nThe manufacturer has a total budget of $1000 per hour for labor.\n// 20 * A + 25 * B + 30 * C <= 1000\n\n## Generate Constraint-2:\nThe maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C.\n// A <= 20; B <= 15; C <= 10\n\n## Generate Constraint-3:\nThe manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\n// 10 * A >= 100\n// 15 * B >= 150\n// 20 * C >= 200",
        "question": "A manufacturer produces three types of products: A, B, and C. The production rate of each product depends on the number of workers assigned to each production line. The production rate and labor cost for each product are given in the following Table.\n\n| Product | Production Rate per Worker (units/hour) | Labor Cost per Worker (dollars/hour) |\n|---------|-----------------------------------------|-------------------------------------|\n| A       | 10                                      | 20                                  |\n| B       | 15                                      | 25                                  |\n| C       | 20                                      | 30                                  |\n\nThe manufacturer has a total budget of $1000 per hour for labor. The maximum number of workers that can be assigned to each product line is limited: 20 workers for product A, 15 workers for product B, and 10 workers for product C. The manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\n\nPlease help the manufacturer to maximize the net production value (total production rate minus labor cost).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=20) # number of workers on product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=15) # number of workers on product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=10) # number of workers on product C\n\n# Define objective function\n## Total production rate: Production = 10 * A + 15 * B + 20 * C\n## Total labor cost: Cost = 20 * A + 25 * B + 30 * C\n## So, the objective function is: Maximize (Production - Cost)\nProduction = 10 * A + 15 * B + 20 * C\nCost = 20 * A + 25 * B + 30 * C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Production - Cost)\n\n# Add constraints\n## The manufacturer has a total budget of $1000 per hour for labor.\nmodel.addCons(20 * A + 25 * B + 30 * C <= 1000)\n## The manufacturer must produce at least 100 units of product A, 150 units of product B, and 200 units of product C per hour.\nmodel.addCons(10 * A >= 100)\nmodel.addCons(15 * B >= 150)\nmodel.addCons(20 * C >= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Product A: \", model.getVal(A))\n    print(\"Number of Workers on Product B: \", model.getVal(B))\n    print(\"Number of Workers on Product C: \", model.getVal(C))\n    print(\"Maximized Net Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1177,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $400, and the required labor hours per hectare is 50.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $600, and the required labor hours per hectare is 70.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $800, and the required labor hours per hectare is 90.\nThe farm aims to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).\n// Net revenue of A: Net_Revenue_A = (1000 - 400) * A\n// Net revenue of B: Net_Revenue_B = (1500 - 600) * B\n// Net revenue of C: Net_Revenue_C = (2000 - 800) * C\n// So, the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / (50 * A + 70 * B + 90 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $10000 for seeds for the upcoming season.\n// 400 * A + 600 * B + 800 * C <= 10000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 5 hectares to each crop for the upcoming season.\n// A >= 5; B >= 5; C >= 5\n\n## Generate Constraint-3:\nThe farm has a total of 1000 labor hours available for the upcoming season.\n// 50 * A + 70 * B + 90 * C <= 1000",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $400, and the required labor hours per hectare is 50.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $600, and the required labor hours per hectare is 70.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $800, and the required labor hours per hectare is 90.\nThe farm has a budget of $10000 for seeds for the upcoming season. The farm wants to allocate at least 5 hectares to each crop for the upcoming season. The farm has a total of 1000 labor hours available for the upcoming season.\nPlease help the farm to maximize the rate at which it earns profits (which is defined as the sum of the net revenues divided by the sum of the labor hours).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 hectares to each crop for the upcoming season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_Revenue_A = (1000 - 400) * A\nNet_Revenue_B = (1500 - 600) * B\nNet_Revenue_C = (2000 - 800) * C\nLaborHours = 50 * A + 70 * B + 90 * C\n## the objective function is: Maximize (Net_Revenue_A + Net_Revenue_B + Net_Revenue_C) / LaborHours\n## convert the division to multiplication\nmodel.addCons(obj * LaborHours == Net_Revenue_A + Net_Revenue_B + Net_Revenue_C)\n\n# Add constraints\n## The farm has a budget of $10000 for seeds for the upcoming season.\nmodel.addCons(400 * A + 600 * B + 800 * C <= 10000)\n## The farm has a total of 1000 labor hours available for the upcoming season.\nmodel.addCons(50 * A + 70 * B + 90 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 951,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency.\n// {\"number of trucks for Warehouse A\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse B\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of trucks for Warehouse C\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total fuel consumption of all trucks. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n// Total fuel consumption for Warehouse A: Fuel_A = 5 * 100 * TruckA\n// Total fuel consumption for Warehouse B: Fuel_B = 6 * 100 * TruckB\n// Total fuel consumption for Warehouse C: Fuel_C = 7 * 100 * TruckC\n// So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a total of 50 trucks available for allocation.\n// TruckA + TruckB + TruckC <= 50\n\n## Generate Constraint-2:\nDue to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\n// TruckA <= 25\n\n## Generate Constraint-3:\nTo ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\n// TruckB >= 0.5 * TruckA\n\n## Generate Constraint-4:\nThe company wants to ensure that each warehouse has at least one truck assigned.\n// TruckA >= 1; TruckB >= 1; TruckC >= 1",
        "question": "A logistics company is managing three warehouses: Warehouse A, Warehouse B, and Warehouse C. They need to decide how many trucks to allocate to each warehouse to optimize their delivery efficiency. The fuel consumption rate for each truck varies depending on the warehouse: Warehouse A's trucks consume 5 liters per kilometer, Warehouse B's trucks consume 6 liters per kilometer, and Warehouse C's trucks consume 7 liters per kilometer. The company estimates that each truck will travel an average of 100 kilometers per day.\n\n| Warehouse | Fuel Consumption Rate (liters/km) |\n|-----------|-----------------------------------|\n| A         | 5                                 |\n| B         | 6                                 |\n| C         | 7                                 |\n\nThe company has a total of 50 trucks available for allocation. Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A. To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A. The company wants to ensure that each warehouse has at least one truck assigned.\n\nPlease help the company to minimize the total fuel consumption of all trucks.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that each warehouse has at least one truck assigned.\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=1) # number of trucks for Warehouse A\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=1) # number of trucks for Warehouse B\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=1) # number of trucks for Warehouse C\n\n# Define objective function\n## The company aims to minimize the total fuel consumption of all trucks.\nFuel_A = 5 * 100 * TruckA\nFuel_B = 6 * 100 * TruckB\nFuel_C = 7 * 100 * TruckC\n## So, the objective function is: Minimize (Fuel_A + Fuel_B + Fuel_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Fuel_A + Fuel_B + Fuel_C)\n\n# Add constraints\n## The company has a total of 50 trucks available for allocation.\nmodel.addCons(TruckA + TruckB + TruckC <= 50)\n## Due to maintenance constraints, no more than 25 trucks can be assigned to Warehouse A.\nmodel.addCons(TruckA <= 25)\n## To ensure balanced operations, Warehouse B must have at least half as many trucks as Warehouse A.\nmodel.addCons(TruckB >= 0.5 * TruckA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks for Warehouse A: \", model.getVal(TruckA))\n    print(\"Number of Trucks for Warehouse B: \", model.getVal(TruckB))\n    print(\"Number of Trucks for Warehouse C: \", model.getVal(TruckC))\n    print(\"Minimized Total Fuel Consumption: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1184,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit.\n// {\"quantity of Smartphones\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"quantity of Tablets\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"quantity of Laptops\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n// {\"investment in energy efficiency\": \"EnergyEfficiency\", \"range\": \"EnergyEfficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices.\n// Profit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\n// Profit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\n// Profit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n// So, the objective function is: Maximize Profit_Smartphones + Profit_Tablets + Profit_Laptops\n\n## Generate Constraint-1:\nThe company has a total production capacity of 10,000 units across all devices.\n// Smartphones + Tablets + Laptops <= 10000\n\n## Generate Constraint-2:\nThe total investment in energy efficiency upgrades cannot exceed $50,000.\n// EnergyEfficiency <= 50000\n\n## Generate Constraint-3:\nThe market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units.\n// Smartphones <= 5000; Tablets <= 3000; Laptops <= 2000\n\n## Generate Constraint-4:\nThe company must produce at least 1000 units of each device type to maintain market presence.\n// Smartphones >= 1000; Tablets >= 1000; Laptops >= 1000",
        "question": "A manufacturing company produces three types of electronic devices: Smartphones, Tablets, and Laptops. The company needs to determine the production quantities of each device type and the investment in a new energy-efficient technology that reduces the energy consumption per unit. The energy cost per unit of each device decreases by $0.5 for every $1000 invested in energy efficiency upgrades. The initial energy cost per unit for Smartphones is $10, for Tablets is $15, and for Laptops is $20. The selling price per unit for Smartphones is $100, for Tablets is $150, and for Laptops is $200. The company aims to maximize the total profit from all devices. The company has a total production capacity of 10,000 units across all devices. The total investment in energy efficiency upgrades cannot exceed $50,000. The market demand for Smartphones is at most 5000 units, for Tablets is at most 3000 units, and for Laptops is at most 2000 units. The company must produce at least 1000 units of each device type to maintain market presence. Please help the company to determine the optimal production quantities and investment in energy efficiency to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=1000)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=1000)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=1000)\nEnergyEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"EnergyEfficiency\", lb=0)\n\n# Define objective function\nProfit_Smartphones = (100 - 10 + 0.0005 * EnergyEfficiency) * Smartphones\nProfit_Tablets = (150 - 15 + 0.0005 * EnergyEfficiency) * Tablets\nProfit_Laptops = (200 - 20 + 0.0005 * EnergyEfficiency) * Laptops\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_Smartphones + Profit_Tablets + Profit_Laptops)\n\n# Add constraints\nmodel.addCons(Smartphones + Tablets + Laptops <= 10000)\nmodel.addCons(EnergyEfficiency <= 50000)\nmodel.addCons(Smartphones <= 5000)\nmodel.addCons(Tablets <= 3000)\nmodel.addCons(Laptops <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Smartphones: \", model.getVal(Smartphones))\n    print(\"Quantity of Tablets: \", model.getVal(Tablets))\n    print(\"Quantity of Laptops: \", model.getVal(Laptops))\n    print(\"Investment in Energy Efficiency: \", model.getVal(EnergyEfficiency))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1174,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources.\n// {\"number of units of device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach device A sells for $100, costs $60 to produce, and requires 1.5 hours of labor. \nEach device B sells for $150, costs $80 to produce, and requires 2 hours of labor. \nEach device C sells for $200, costs $100 to produce, and requires 2.5 hours of labor.\nThe company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours.\n// Profit of A: Profit_A = (100 - 60) * A = 40 * A\n// Profit of B: Profit_B = (150 - 80) * B = 70 * B\n// Profit of C: Profit_C = (200 - 100) * C = 100 * C\n// Total labor hours: L = 1.5 * A + 2 * B + 2.5 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / L = (40 * A + 70 * B + 100 * C) / (1.5 * A + 2 * B + 2.5 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs next month.\n// 60 * A + 80 * B + 100 * C <= 10000",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. The company needs to determine the number of units of each device to produce in the next month to optimize its resources. The selling price, production cost, and labor hours required for each device are given in the following Table.\n\n| Device | Selling Price | Production Cost | Labor Hours Required |\n|--------|---------------|-----------------|----------------------|\n| A      | $100          | $60             | 1.5 hours            |\n| B      | $150          | $80             | 2 hours              |\n| C      | $200          | $100            | 2.5 hours            |\n\nThe company has a budget of $10,000 for production costs next month. The company aims to maximize its profit-to-labor ratio, which is defined as the total profit divided by the total labor hours. Please help the company determine the optimal number of units of each device to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of device C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 40 * A\nProfit_B = 70 * B\nProfit_C = 100 * C\nLabor = 1.5 * A + 2 * B + 2.5 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Labor\n## convert the division to multiplication\nmodel.addCons(obj * Labor == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs next month.\nmodel.addCons(60 * A + 80 * B + 100 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Device A: \", model.getVal(A))\n    print(\"Number of Device B: \", model.getVal(B))\n    print(\"Number of Device C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Labor Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 940,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel efficiency and maintenance costs. \nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\n// Operational cost for TruckA: Cost_TruckA = 500 / 10 * TruckA\n// Operational cost for TruckB: Cost_TruckB = 700 / 15 * TruckB\n// Operational cost for TruckC: Cost_TruckC = 900 / 20 * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per month for vehicle maintenance.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC <= 10,000\n\n## Generate Constraint-2:\nThe total cargo capacity of the fleet must be at least 100 tons.\n// 5 * TruckA + 7 * TruckB + 10 * TruckC >= 100\n\n## Generate Constraint-3:\nDue to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined.\n// TruckC <= 0.5 * (TruckA + TruckB)",
        "question": "A logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|---------|-----------------------|---------------------------|----------------------|\n| TruckA  | 10                    | 500                       | 5                    |\n| TruckB  | 15                    | 700                       | 7                    |\n| TruckC  | 20                    | 900                       | 10                   |\n\nThe company has a total budget of $10,000 per month for vehicle maintenance. The total cargo capacity of the fleet must be at least 100 tons. Due to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined. \nPlease help the company to minimize the total operational cost, which is calculated as (maintenance cost) / (fuel efficiency) for each vehicle.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = 500 / 10 * TruckA\nCost_TruckB = 700 / 15 * TruckB\nCost_TruckC = 900 / 20 * TruckC\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n## The company has a total budget of $10,000 per month for vehicle maintenance.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC <= 10000)\n## The total cargo capacity of the fleet must be at least 100 tons.\nmodel.addCons(5 * TruckA + 7 * TruckB + 10 * TruckC >= 100)\n## Due to licensing restrictions, the number of TruckC cannot exceed half the number of TruckA and TruckB combined.\nmodel.addCons(TruckC <= 0.5 * (TruckA + TruckB))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1155,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs.\n// {\"number of machines for ComponentA\": \"MachinesA\", \"range\": \"MachinesA >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentB\": \"MachinesB\", \"range\": \"MachinesB >= 0\", \"type\": \"integer\"}\n// {\"number of machines for ComponentC\": \"MachinesC\", \"range\": \"MachinesC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach machine for ComponentA has a production rate of 100 units per hour and a maintenance cost of $50 per hour. Each machine for ComponentB has a production rate of 150 units per hour and a maintenance cost of $75 per hour. Each machine for ComponentC has a production rate of 200 units per hour and a maintenance cost of $100 per hour. The company wants to maximize the total production output while minimizing the total maintenance cost.\n// Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n// Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n// So, the objective function is: Maximize (Output - Cost)\n\n## Generate Constraint-1:\nThe company has a total of 25 machines available for allocation.\n// MachinesA + MachinesB + MachinesC <= 25\n\n## Generate Constraint-2:\nDue to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\n// MachinesA <= 10; MachinesB <= 12; MachinesC <= 8\n\n## Generate Constraint-3:\nThe company has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\n// 100 * MachinesA >= 1000\n// 150 * MachinesB >= 1500\n// 200 * MachinesC >= 2000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to determine the optimal number of machines to allocate to each component production line to maximize efficiency and minimize costs. The production rate and maintenance cost for each machine type are given in the following Table.\n\n| Component | Production Rate (units/hour) | Maintenance Cost ($/hour) |\n|-----------|------------------------------|--------------------------|\n| ComponentA | 100                          | 50                       |\n| ComponentB | 150                          | 75                       |\n| ComponentC | 200                          | 100                      |\n\nThe company has a total of 25 machines available for allocation. Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8. The company has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\n\nPlease help the company to maximize the total production output while minimizing the total maintenance cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachinesA = model.addVar(vtype=\"INTEGER\", name=\"MachinesA\", lb=0) # number of machines for ComponentA\nMachinesB = model.addVar(vtype=\"INTEGER\", name=\"MachinesB\", lb=0) # number of machines for ComponentB\nMachinesC = model.addVar(vtype=\"INTEGER\", name=\"MachinesC\", lb=0) # number of machines for ComponentC\n\n# Define objective function\n## Total production output: Output = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\n## Total maintenance cost: Cost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\n## So, the objective function is: Maximize (Output - Cost)\nOutput = 100 * MachinesA + 150 * MachinesB + 200 * MachinesC\nCost = 50 * MachinesA + 75 * MachinesB + 100 * MachinesC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Output - Cost)\n\n# Add constraints\n## The company has a total of 25 machines available for allocation.\nmodel.addCons(MachinesA + MachinesB + MachinesC <= 25)\n## Due to space limitations, the maximum number of machines that can be allocated to ComponentA is 10, to ComponentB is 12, and to ComponentC is 8.\nmodel.addCons(MachinesA <= 10)\nmodel.addCons(MachinesB <= 12)\nmodel.addCons(MachinesC <= 8)\n## The company has a minimum production requirement for each component: at least 1000 units of ComponentA, 1500 units of ComponentB, and 2000 units of ComponentC per day.\nmodel.addCons(100 * MachinesA >= 1000)\nmodel.addCons(150 * MachinesB >= 1500)\nmodel.addCons(200 * MachinesC >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Machines for ComponentA: \", model.getVal(MachinesA))\n    print(\"Number of Machines for ComponentB: \", model.getVal(MachinesB))\n    print(\"Number of Machines for ComponentC: \", model.getVal(MachinesC))\n    print(\"Maximized Net Production Output: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1204,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in advertising\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit: Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for advertising.\n// Advertising <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 2000 units.\n// ProductA + ProductB + ProductC <= 2000\n\n## Generate Constraint-3:\nThe production of product A must be at least 300 units.\n// ProductA >= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit. The profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company aims to maximize the total profit from all products.\n\n| Product | Profit per Unit |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a budget of $100,000 for advertising. The total production capacity for all products is 2000 units. The production of product A must be at least 300 units.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C, and the appropriate level of advertising investment to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=300) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # investment in advertising\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n## convert the multiplication with Advertising to a constraint\nmodel.addCons(obj == (50 * ProductA + 70 * ProductB + 60 * ProductC))\nmodel.addCons(obj <= Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for advertising.\nmodel.addCons(Advertising <= 100000)\n## The total production capacity for all products is 2000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Advertising: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand.\n// {\"quantity of Electric vehicles\": \"E\", \"range\": \"E >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"H\", \"range\": \"H >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hy\", \"range\": \"Hy >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit. For Electric vehicles, the CO2e saved per unit is 1000 kg, but the production cost per unit is $20,000. For Hybrid vehicles, the CO2e saved per unit is 500 kg, and the production cost per unit is $15,000. For Hydrogen vehicles, the CO2e saved per unit is 800 kg, and the production cost per unit is $25,000. The manufacturer wants to maximize the total environmental impact per dollar spent on production.\n// Impact_E = 1000 * E / 20000\n// Impact_H = 500 * H / 15000\n// Impact_Hy = 800 * Hy / 25000\n// So, the objective function is: Maximize (Impact_E + Impact_H + Impact_Hy)\n\n## Generate Constraint-1:\nThe manufacturer has a total production budget of $1,000,000.\n// 20000 * E + 15000 * H + 25000 * Hy <= 1000000\n\n## Generate Constraint-2:\nThe production capacity for each type of vehicle is limited. The maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units.\n// E <= 50; H <= 75; Hy <= 40",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric (E), Hybrid (H), and Hydrogen (Hy). They need to determine the optimal production quantities for each type of vehicle to maximize their environmental impact while considering production costs and market demand. The environmental impact of each vehicle type is measured in carbon dioxide equivalent (CO2e) emissions saved per unit, and the production cost per unit for each type is given in the following Table.\n\n| Vehicle Type | CO2e Saved per Unit | Production Cost per Unit |\n|--------------|---------------------|--------------------------|\n| Electric     | 1000 kg             | $20,000                  |\n| Hybrid       | 500 kg              | $15,000                  |\n| Hydrogen     | 800 kg              | $25,000                  |\n\nThe manufacturer has a total production budget of $1,000,000. The production capacity for each type of vehicle is limited: the maximum production capacity for Electric vehicles is 50 units, for Hybrid vehicles is 75 units, and for Hydrogen vehicles is 40 units. \n\nPlease help the manufacturer to maximize the total environmental impact per dollar spent on production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nE = model.addVar(vtype=\"INTEGER\", name=\"E\", lb=0, ub=50) # quantity of Electric vehicles\nH = model.addVar(vtype=\"INTEGER\", name=\"H\", lb=0, ub=75) # quantity of Hybrid vehicles\nHy = model.addVar(vtype=\"INTEGER\", name=\"Hy\", lb=0, ub=40) # quantity of Hydrogen vehicles\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nImpact_E = 1000 * E / 20000\nImpact_H = 500 * H / 15000\nImpact_Hy = 800 * Hy / 25000\n## convert the division to multiplication\nmodel.addCons(obj * (20000 * E + 15000 * H + 25000 * Hy) == 1000 * E + 500 * H + 800 * Hy)\n\n# Add constraints\n## The manufacturer has a total production budget of $1,000,000.\nmodel.addCons(20000 * E + 15000 * H + 25000 * Hy <= 1000000)\n## The production capacity for each type of vehicle is limited.\nmodel.addCons(E <= 50)\nmodel.addCons(H <= 75)\nmodel.addCons(Hy <= 40)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric vehicles: \", model.getVal(E))\n    print(\"Quantity of Hybrid vehicles: \", model.getVal(H))\n    print(\"Quantity of Hydrogen vehicles: \", model.getVal(Hy))\n    print(\"Maximized Environmental Impact per Dollar: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, and the amount of money to invest in a new technology that can improve the production efficiency of both products.\n// {\"number of units of Product 1\": \"Units1\", \"range\": \"Units1 >= 0\", \"type\": \"integer\"}\n// {\"number of units of Product 2\": \"Units2\", \"range\": \"Units2 >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvestment\", \"range\": \"TechInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product 1: Profit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\n// Total profit for Product 2: Profit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\n// So, the objective function is: Maximize (Profit1 + Profit2)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2.\n// Units1 <= 1000; Units2 <= 800\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechInvestment <= 50000",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of units to produce for two different products, Product 1 and Product 2, and the amount of money to invest in a new technology that can improve the production efficiency of both products. The new technology reduces the production cost per unit by $5 for every $10,000 invested. The initial production cost per unit for Product 1 is $100 and for Product 2 is $150. The selling price per unit for Product 1 is $150 and for Product 2 is $200. The company aims to maximize the total profit from both products. The company has a total production capacity of 1000 units for Product 1 and 800 units for Product 2. The total investment in the new technology cannot exceed $50,000. Please help the company to maximize the total profit from both products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnits1 = model.addVar(vtype=\"INTEGER\", name=\"Units1\", lb=0)  # number of units of Product 1\nUnits2 = model.addVar(vtype=\"INTEGER\", name=\"Units2\", lb=0)  # number of units of Product 2\nTechInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvestment\", lb=0)  # investment in new technology\n\n# Define objective function\nProfit1 = (150 - (100 - 0.0005 * TechInvestment)) * Units1\nProfit2 = (200 - (150 - 0.0005 * TechInvestment)) * Units2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2)\n\n# Add constraints\nmodel.addCons(Units1 <= 1000)\nmodel.addCons(Units2 <= 800)\nmodel.addCons(TechInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product 1: \", model.getVal(Units1))\n    print(\"Number of Units of Product 2: \", model.getVal(Units2))\n    print(\"Investment in New Technology: \", model.getVal(TechInvestment))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 860,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $100, and the cost of raw materials per unit is $30. The profit per unit of Product B is $150, and the cost of raw materials per unit is $50. For every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The initial production time per unit for Product A is 5 hours, and for Product B is 6 hours. The company wants to maximize the total profit.\n// Profit_A = 100 * A - 30 * A\n// Profit_B = 150 * B - 50 * B\n// Production_time_A = 5 - 0.001 * Efficiency\n// Production_time_B = 6 - 0.001 * Efficiency\n// So, the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 200 hours.\n// (5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for investment in production efficiency.\n// Efficiency <= 10000\n\n## Generate Constraint-3:\nThe company has a limited raw material budget of $5000.\n// 30 * A + 50 * B <= 5000\n\n## Generate Constraint-4:\nThe market demand for Product A is 100 units. So, the company can only sell a maximum of 100 units of Product A.\n// A <= 100\n\n## Generate Constraint-5:\nThe market demand for Product B is 80 units. So, the company can only sell a maximum of 80 units of Product B.\n// B <= 80",
        "question": "A manufacturing company produces two types of products: Product A and Product B. They need to determine the production quantities of each product to maximize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit, cost of raw materials per unit, and initial production time per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost of Raw Materials per Unit | Initial Production Time per Unit |\n|---------|-----------------|--------------------------------|----------------------------------|\n| A       | $100            | $30                            | 5 hours                          |\n| B       | $150            | $50                            | 6 hours                          |\n\nFor every $10,000 invested in production efficiency, the production time per unit decreases by 1 hour for both products. The company has a total production capacity of 200 hours. The company has a budget of $10,000 for investment in production efficiency. The company has a limited raw material budget of $5000. The market demand for Product A is 100 units, and for Product B is 80 units. \n\nPlease help the company to maximize the total profit, considering the constraints and the objective function which is defined as the sum of the profits from both products divided by the total production time.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=100) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=80) # quantity of Product B\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (100 - 30) * A\nProfit_B = (150 - 50) * B\nProduction_time_A = 5 - 0.001 * Efficiency\nProduction_time_B = 6 - 0.001 * Efficiency\n## the objective function is: Maximize (Profit_A + Profit_B) / (Production_time_A * A + Production_time_B * B)\n## convert the division to multiplication\nmodel.addCons(obj * (Production_time_A * A + Production_time_B * B) == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total production capacity of 200 hours.\nmodel.addCons((5 - 0.001 * Efficiency) * A + (6 - 0.001 * Efficiency) * B <= 200)\n## The company has a budget of $10,000 for investment in production efficiency.\nmodel.addCons(Efficiency <= 10000)\n## The company has a limited raw material budget of $5000.\nmodel.addCons(30 * A + 50 * B <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1383,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process.\n// {\"number of units of product A\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products.\n// Profit per unit of product A: ProfitA = 50 - 2 * Automation\n// Profit per unit of product B: ProfitB = 70 - 2 * Automation\n// Profit per unit of product C: ProfitC = 60 - 2 * Automation\n// Total profit: TotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n// So, the objective function is: Maximize TotalProfit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units in total for all products.\n// UnitsA + UnitsB + UnitsC <= 1000\n\n## Generate Constraint-2:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of units of each product to produce and the level of automation to implement in the production process. The profit per unit of product A is $50, product B is $70, and product C is $60. Implementing automation reduces the production cost per unit by $2 for every unit of automation. The company aims to maximize the total profit from all products. The company has a production capacity limit of 1000 units in total for all products. The investment in automation cannot exceed $50,000. Please help the company determine the optimal number of units of each product and the level of automation to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0)  # number of units of product A\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0)  # number of units of product B\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0)  # number of units of product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfitA = 50 - 2 * Automation\nProfitB = 70 - 2 * Automation\nProfitC = 60 - 2 * Automation\nTotalProfit = UnitsA * ProfitA + UnitsB * ProfitB + UnitsC * ProfitC\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == TotalProfit)\n\n# Add constraints\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Units of Product A: \", model.getVal(UnitsA))\n    print(\"Number of Units of Product B: \", model.getVal(UnitsB))\n    print(\"Number of Units of Product C: \", model.getVal(UnitsC))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 729,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints.\n// {\"production level of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production level of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production level of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total storage cost: Storage = 10 * A + 15 * B + 12 * C\n// So, the objective function is: Maximize (Profit - Storage)\n\n## Generate Constraint-1:\nThe total production capacity is limited to 1000 units across all components.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A must be met, which is at least 200 units.\n// A >= 200\n\n## Generate Constraint-3:\nThe production of component B must not exceed 50% of the total production.\n// B <= 0.5 * (A + B + C)",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production levels of these components are to be optimized to maximize profit while adhering to certain constraints. The profit from component A is $50 per unit, but it incurs a storage cost of $10 per unit. Component B yields a profit of $70 per unit with a storage cost of $15 per unit. Component C has a profit of $60 per unit and a storage cost of $12 per unit. The manufacturer wants to maximize the net profit, which is the total profit minus the total storage cost. The total production capacity is limited to 1000 units across all components. The demand for component A must be met, which is at least 200 units. The production of component B must not exceed 50% of the total production. Please help the manufacturer determine the optimal production levels for components A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # production level of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production level of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production level of component C\n\n# Define objective function\nProfit = 50 * A + 70 * B + 60 * C\nStorage = 10 * A + 15 * B + 12 * C\n# So, the objective function is: Maximize (Profit - Storage)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Storage)\n\n# Add constraints\n# The total production capacity is limited to 1000 units across all components.\nmodel.addCons(A + B + C <= 1000)\n# The demand for component A must be met, which is at least 200 units.\nmodel.addCons(A >= 200)\n# The production of component B must not exceed 50% of the total production.\nmodel.addCons(B <= 0.5 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production level of component A: \", model.getVal(A))\n    print(\"Production level of component B: \", model.getVal(B))\n    print(\"Production level of component C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 869,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: Wheat, Corn, and Soybeans. They need to determine the areas to allocate for each crop.\n// {\"area of Wheat\": \"Wheat\", \"range\": \"Wheat >= 0\", \"type\": \"real\"}\n// {\"area of Corn\": \"Corn\", \"range\": \"Corn >= 0\", \"type\": \"real\"}\n// {\"area of Soybeans\": \"Soybeans\", \"range\": \"Soybeans >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Wheat, the profit per hectare is $1000, but it requires 200 liters of water per hectare. For Corn, the profit per hectare is $1200, but it requires 250 liters of water per hectare. For Soybeans, the profit per hectare is $800, but it requires 150 liters of water per hectare. The farm wants to maximize the profit per unit of water used (profit efficiency).\n// Profit_Wheat = 1000 * Wheat\n// Profit_Corn = 1200 * Corn\n// Profit_Soybeans = 800 * Soybeans\n// Water_Wheat = 200 * Wheat\n// Water_Corn = 250 * Corn\n// Water_Soybeans = 150 * Soybeans\n// So, the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / (Water_Wheat + Water_Corn + Water_Soybeans)\n\n## Generate Constraint-1:\nThe farm has a total area of 100 hectares.\n// Wheat + Corn + Soybeans <= 100\n\n## Generate Constraint-2:\nThe farm has a limited water supply of 20000 liters.\n// 200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000\n\n## Generate Constraint-3:\nThe market demand for Wheat is 50 hectares. So, the farm can only sell a maximum of 50 hectares of Wheat.\n// Wheat <= 50\n\n## Generate Constraint-4:\nThe farm must allocate at least 10 hectares to Soybeans to maintain soil health.\n// Soybeans >= 10",
        "question": "A farm grows three types of crops: Wheat, Corn, and Soybeans. They need to determine the areas to allocate for each crop. For Wheat, the profit per hectare is $1000, but it requires 200 liters of water per hectare. For Corn, the profit per hectare is $1200, but it requires 250 liters of water per hectare. For Soybeans, the profit per hectare is $800, but it requires 150 liters of water per hectare. The farm wants to maximize the profit per unit of water used (profit efficiency). The farm has a total area of 100 hectares and a limited water supply of 20000 liters. The market demand for Wheat is 50 hectares, and the farm must allocate at least 10 hectares to Soybeans to maintain soil health. Please help the farm to maximize the profit per unit of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheat = model.addVar(vtype=\"CONTINUOUS\", name=\"Wheat\", lb=0) # area of Wheat\nCorn = model.addVar(vtype=\"CONTINUOUS\", name=\"Corn\", lb=0) # area of Corn\nSoybeans = model.addVar(vtype=\"CONTINUOUS\", name=\"Soybeans\", lb=0) # area of Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_Wheat = 1000 * Wheat\nProfit_Corn = 1200 * Corn\nProfit_Soybeans = 800 * Soybeans\nWater_Wheat = 200 * Wheat\nWater_Corn = 250 * Corn\nWater_Soybeans = 150 * Soybeans\n## the objective function is: Maximize (Profit_Wheat + Profit_Corn + Profit_Soybeans) / (Water_Wheat + Water_Corn + Water_Soybeans)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_Wheat + Water_Corn + Water_Soybeans) == Profit_Wheat + Profit_Corn + Profit_Soybeans)\n\n# Add constraints\n## The farm has a total area of 100 hectares.\nmodel.addCons(Wheat + Corn + Soybeans <= 100)\n## The farm has a limited water supply of 20000 liters.\nmodel.addCons(200 * Wheat + 250 * Corn + 150 * Soybeans <= 20000)\n## The market demand for Wheat is 50 hectares. So, the farm can only sell a maximum of 50 hectares of Wheat.\nmodel.addCons(Wheat <= 50)\n## The farm must allocate at least 10 hectares to Soybeans to maintain soil health.\nmodel.addCons(Soybeans >= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Wheat: \", model.getVal(Wheat))\n    print(\"Area of Corn: \", model.getVal(Corn))\n    print(\"Area of Soybeans: \", model.getVal(Soybeans))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 766,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the cost of irrigation per acre is $100 for crop A, $150 for crop B, and $200 for crop C. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The water usage per acre is 5 units for crop A, 7 units for crop B, and 9 units for crop C.\n// Profit of crop A: Profit_A = (500 - 100) * A\n// Profit of crop B: Profit_B = (700 - 150) * B\n// Profit of crop C: Profit_C = (900 - 200) * C\n// Total water used: Water_used = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n\n## Generate Constraint-1:\nThe total available land for cultivation is 100 acres.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the cost of irrigation per acre is $100 for crop A, $150 for crop B, and $200 for crop C. The water usage per acre is 5 units for crop A, 7 units for crop B, and 9 units for crop C. The farmer aims to maximize the net profit per unit of water used (defined as the total profit minus the total cost of irrigation, divided by the total water used). The total available land for cultivation is 100 acres. Please help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per unit of water used.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 100) * A\nProfit_B = (700 - 150) * B\nProfit_C = (900 - 200) * C\nWater_used = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The total available land for cultivation is 100 acres.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production.\n// {\"hours for production line A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"real\"}\n// {\"hours for production line B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"real\"}\n// {\"hours for production line C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The company aims to maximize the total production value, where the value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit.\n// The production value of component A: VA = 10 * PA * $5\n// The production value of component B: VB = 15 * PB * $7\n// The production value of component C: VC = 20 * PC * $9\n// So, the objective function is: Maximize (VA + VB + VC)\n\n## Generate Constraint-1:\nThe total operational hours for all lines must not exceed 120 hours per week.\n// PA + PB + PC <= 120\n\n## Generate Constraint-2:\nThe production line A can operate for a maximum of 40 hours per week.\n// PA <= 40\n\n## Generate Constraint-3:\nThe production line B can operate for a maximum of 50 hours per week.\n// PB <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to decide the number of hours to operate each of its three production lines to optimize its production. Each hour of operation for line A produces 10 units of component A, line B produces 15 units of component B, and line C produces 20 units of component C. The value of component A is $5 per unit, component B is $7 per unit, and component C is $9 per unit. The company aims to maximize the total production value. The total operational hours for all lines must not exceed 120 hours per week. The production line A can operate for a maximum of 40 hours per week, and the production line B can operate for a maximum of 50 hours per week. Please help the company determine the optimal number of hours to operate each production line.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"CONTINUOUS\", name=\"PA\", lb=0) # hours for production line A\nPB = model.addVar(vtype=\"CONTINUOUS\", name=\"PB\", lb=0) # hours for production line B\nPC = model.addVar(vtype=\"CONTINUOUS\", name=\"PC\", lb=0) # hours for production line C\n\n# Define objective function\nVA = 10 * PA * 5\nVB = 15 * PB * 7\nVC = 20 * PC * 9\n# So, the objective function is: Maximize (VA + VB + VC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == VA + VB + VC)\n\n# Add constraints\n# The total operational hours for all lines must not exceed 120 hours per week.\nmodel.addCons(PA + PB + PC <= 120)\n# The production line A can operate for a maximum of 40 hours per week.\nmodel.addCons(PA <= 40)\n# The production line B can operate for a maximum of 50 hours per week.\nmodel.addCons(PB <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Production Line A: \", model.getVal(PA))\n    print(\"Hours for Production Line B: \", model.getVal(PB))\n    print(\"Hours for Production Line C: \", model.getVal(PC))\n    print(\"Maximized Total Production Value: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 834,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit.\n// {\"number of workers on component A line\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component B line\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of workers on component C line\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. \nEach worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. \nEach worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker.\nThe company aims to maximize the total profit from all three components.\n// The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n// The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n// The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n// So, the objective function is: Maximize P = P1 + P2 + P3\n\n## Generate Constraint-1:\nThe company has a total of 50 workers available.\n// W1 + W2 + W3 <= 50",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to optimize the allocation of workers to each production line to maximize profit. Each worker on the component A line generates a profit of $100 per hour, but the profit per worker decreases by 1% for each additional worker. Each worker on the component B line generates a profit of $120 per hour, with a 0.5% decrease in profit per worker for each additional worker. Each worker on the component C line generates a profit of $150 per hour, with a 2% decrease in profit per worker for each additional worker. The company has a total of 50 workers available. Please help the company to maximize the total profit from all three components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of workers on component A line\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of workers on component B line\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of workers on component C line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n\n## The profit from component A: P1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\n## The profit from component B: P2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\n## The profit from component C: P3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\n## So, the objective function is: Maximize P = P1 + P2 + P3\nP1 = 100 * W1 * (1 - 0.01 * (W1 - 1))\nP2 = 120 * W2 * (1 - 0.005 * (W2 - 1))\nP3 = 150 * W3 * (1 - 0.02 * (W3 - 1))\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n## The company has a total of 50 workers available.\nmodel.addCons(W1 + W2 + W3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Component A Line: \", model.getVal(W1))\n    print(\"Number of Workers on Component B Line: \", model.getVal(W2))\n    print(\"Number of Workers on Component C Line: \", model.getVal(W3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 739,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs.\n// {\"number of production lines\": \"Lines\", \"range\": \"Lines >= 0\", \"type\": \"integer\"}\n// {\"number of shifts per line\": \"Shifts\", \"range\": \"Shifts >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe labor cost per shift decreases by $5 for every $10,000 invested in automation. The initial labor cost per shift is $150. The revenue generated per shift is $300. The company aims to maximize the total profit from all production lines.\n// Total profit for the production: Profit = (300 - 150 + 0.0005 * Automation) * Lines * Shifts\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 30 production lines available for the quarter. The company must ensure that at least 10 production lines are operated.\n// Lines <= 30; Lines >= 10\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe number of shifts per production line must be at least 5.\n// Shifts >= 5",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs. The labor cost per shift decreases by $5 for every $10,000 invested in automation, with an initial labor cost per shift of $150, and a revenue generated per shift of $300. The company aims to maximize the total profit from all production lines.\n\n| Parameter          | Value                |\n|--------------------|----------------------|\n| Labor cost per shift | $150                 |\n| Revenue per shift   | $300                 |\n| Automation effect   | $5 reduction per $10,000 investment |\n\nThe company has a total of 30 production lines available for the quarter and must ensure that at least 10 production lines are operated. The total investment in automation cannot exceed $50,000. The number of shifts per production line must be at least 5.\n\nPlease help the company determine the optimal number of production lines, shifts per line, and investment in automation to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company needs to decide on the number of production lines to operate, the number of shifts per line, and the level of automation investment to reduce labor costs.\nLines = model.addVar(vtype=\"INTEGER\", name=\"Lines\", lb=10, ub=30) # number of production lines\nShifts = model.addVar(vtype=\"INTEGER\", name=\"Shifts\", lb=5) # number of shifts per line\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## The labor cost per shift decreases by $5 for every $10,000 invested in automation. The initial labor cost per shift is $150. The revenue generated per shift is $300.\nLaborCostPerShift = 150 - 0.0005 * Automation\n## The company aims to maximize the total profit from all production lines.\nProfit = (300 - LaborCostPerShift) * Lines * Shifts\n## So, the objective function is: Maximize Profit\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Production Lines: \", model.getVal(Lines))\n    print(\"Number of Shifts per Line: \", model.getVal(Shifts))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1142,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency.\n// {\"number of workers on resistor production line\": \"R\", \"range\": \"R >= 0\", \"type\": \"integer\"}\n// {\"number of workers on capacitor production line\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"number of workers on inductor production line\": \"I\", \"range\": \"I >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The company aims to maximize the total production rate of all components. However, due to the nature of the components, the production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%.\n// The production rate of resistors: P_R = 50 * R * (1 - 0.01 * C)\n// The production rate of capacitors: P_C = 40 * C * (1 - 0.01 * I)\n// The production rate of inductors: P_I = 30 * I * (1 + 0.01 * R)\n// The objective function is: Maximize P_total = P_R + P_C + P_I\n\n## Generate Constraint-1:\nThere are a total of 60 workers available.\n// R + C + I <= 60\n\n## Generate Constraint-2:\nEach production line can be staffed by up to 25 workers at a time.\n// R <= 25; C <= 25; I <= 25",
        "question": "A manufacturing company produces three types of electronic components: resistors, capacitors, and inductors. The company has three different production lines dedicated to each type of component. The manager needs to determine the number of workers to assign to each production line to optimize production efficiency. Each worker on the resistor production line can produce 50 resistors per hour, on the capacitor line, 40 capacitors per hour, and on the inductor line, 30 inductors per hour. The production rate of each component is affected by the number of workers on the other lines. Specifically, for every additional worker on the capacitor line, the production rate of resistors decreases by 1%, and for every additional worker on the inductor line, the production rate of capacitors decreases by 1%. Conversely, for every additional worker on the resistor line, the production rate of inductors increases by 1%.\n\n| Component | Production Rate per Worker (per hour) |\n|-----------|---------------------------------------|\n| Resistors | 50                                    |\n| Capacitors| 40                                    |\n| Inductors | 30                                    |\n\nThe company has a total of 60 workers available. Each production line can be staffed by up to 25 workers at a time. Please help the company to maximize the total production rate of all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nR = model.addVar(vtype=\"INTEGER\", name=\"R\", lb=0) # number of workers on resistor production line\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of workers on capacitor production line\nI = model.addVar(vtype=\"INTEGER\", name=\"I\", lb=0) # number of workers on inductor production line\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nP_R = 50 * R * (1 - 0.01 * C)\nP_C = 40 * C * (1 - 0.01 * I)\nP_I = 30 * I * (1 + 0.01 * R)\n## the objective function is: Maximize P_total = P_R + P_C + P_I\nmodel.addCons(obj == P_R + P_C + P_I)\n\n# Add constraints\n## There are a total of 60 workers available.\nmodel.addCons(R + C + I <= 60)\n## Each production line can be staffed by up to 25 workers at a time.\nmodel.addCons(R <= 25)\nmodel.addCons(C <= 25)\nmodel.addCons(I <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Resistor Line: \", model.getVal(R))\n    print(\"Number of Workers on Capacitor Line: \", model.getVal(C))\n    print(\"Number of Workers on Inductor Line: \", model.getVal(I))\n    print(\"Maximized Total Production Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1387,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season.\n// {\"number of P1 pastries\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"number of P2 pastries\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"number of P3 pastries\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Pastry P1, the selling price is $3, the ingredient cost is $1, and the baking time is 15 minutes. \nFor Pastry P2, the selling price is $4, the ingredient cost is $1.5, and the baking time is 20 minutes. \nFor Pastry P3, the selling price is $5, the ingredient cost is $2, and the baking time is 25 minutes.\nThe bakery has a single oven and can only bake one type of pastry at a time. The bakery aims to maximize the profit efficiency (profit per minute of baking time).\n// Profit_P1 = (3 - 1) * P1\n// Profit_P2 = (4 - 1.5) * P2\n// Profit_P3 = (5 - 2) * P3\n// So, the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / (15 * P1 + 20 * P2 + 25 * P3)\n\n## Generate Constraint-1:\nThe bakery has a total baking time of 120 hours available.\n// 15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60\n\n## Generate Constraint-2:\nThe bakery has a budget of $1500 for ingredient costs.\n// 1 * P1 + 1.5 * P2 + 2 * P3 <= 1500",
        "question": "A bakery produces three types of pastries: P1, P2, and P3. The bakery needs to determine the number of each pastry to bake for the upcoming holiday season. The selling price, ingredient cost, and baking time for each pastry are given in the following Table.\n\n| Pastry | Selling Price | Ingredient Cost | Baking Time |\n|--------|---------------|-----------------|-------------|\n| P1     | $3            | $1              | 15 minutes  |\n| P2     | $4            | $1.5            | 20 minutes  |\n| P3     | $5            | $2              | 25 minutes  |\n\nThe bakery has a total baking time of 120 hours available. The bakery has a budget of $1500 for ingredient costs. The bakery has a single oven and can only bake one type of pastry at a time. \nPlease help the bakery to maximize the profit efficiency (profit per minute of baking time).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # number of P1 pastries\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # number of P2 pastries\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # number of P3 pastries\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_P1 = (3 - 1) * P1\nProfit_P2 = (4 - 1.5) * P2\nProfit_P3 = (5 - 2) * P3\nBakingTime = 15 * P1 + 20 * P2 + 25 * P3\n## the objective function is: Maximize (Profit_P1 + Profit_P2 + Profit_P3) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The bakery has a total baking time of 120 hours available.\nmodel.addCons(15 * P1 + 20 * P2 + 25 * P3 <= 120 * 60)\n## The bakery has a budget of $1500 for ingredient costs.\nmodel.addCons(1 * P1 + 1.5 * P2 + 2 * P3 <= 1500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of P1 Pastries: \", model.getVal(P1))\n    print(\"Number of P2 Pastries: \", model.getVal(P2))\n    print(\"Number of P3 Pastries: \", model.getVal(P3))\n    print(\"Maximized Profit Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 839,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints.\n// {\"daily production quantity of ChemicalA\": \"ChemicalAProduction\", \"range\": \"ChemicalAProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalB\": \"ChemicalBProduction\", \"range\": \"ChemicalBProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalC\": \"ChemicalCProduction\", \"range\": \"ChemicalCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals.\n// Total daily profit: Profit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily production capacity of the company is limited to 1000 units.\n// ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\n// ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction)\n\n## Generate Constraint-3:\nThe production of ChemicalA must be at least twice the production of ChemicalB.\n// ChemicalAProduction >= 2 * ChemicalBProduction",
        "question": "A manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints. The profit per unit for each chemical is as follows:\n\n| Chemical | Profit per Unit |\n|----------|-----------------|\n| ChemicalA | $50 |\n| ChemicalB | $70 |\n| ChemicalC | $90 |\n\nThe company has a total daily production capacity of 1000 units. Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production. Additionally, the production of ChemicalA must be at least twice the production of ChemicalB.\n\nPlease help the company to maximize the total daily profit from the production of these chemicals.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalAProduction\", lb=0) # daily production quantity of ChemicalA\nChemicalBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBProduction\", lb=0) # daily production quantity of ChemicalB\nChemicalCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCProduction\", lb=0) # daily production quantity of ChemicalC\n\n# Define objective function\nProfit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total daily production capacity of the company is limited to 1000 units.\nmodel.addCons(ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000)\n# Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\nmodel.addCons(ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction))\n# The production of ChemicalA must be at least twice the production of ChemicalB.\nmodel.addCons(ChemicalAProduction >= 2 * ChemicalBProduction)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production of ChemicalA: \", model.getVal(ChemicalAProduction))\n    print(\"Daily Production of ChemicalB: \", model.getVal(ChemicalBProduction))\n    print(\"Daily Production of ChemicalC: \", model.getVal(ChemicalCProduction))\n    print(\"Maximized Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints.\n// {\"number of units of DeviceA\": \"DeviceAUnits\", \"range\": \"DeviceAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceB\": \"DeviceBUnits\", \"range\": \"DeviceBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of DeviceC\": \"DeviceCUnits\", \"range\": \"DeviceCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for DeviceA is $50, but it decreases by $0.5 for each unit produced beyond the first 100 units. The profit per unit for DeviceB is $70, but it decreases by $0.3 for each unit produced beyond the first 150 units. The profit per unit for DeviceC is $90, but it decreases by $0.2 for each unit produced beyond the first 200 units. The company wants to maximize the total profit.\n// Profit_DeviceA = (50 - 0.5 * max(DeviceAUnits - 100, 0)) * DeviceAUnits\n// Profit_DeviceB = (70 - 0.3 * max(DeviceBUnits - 150, 0)) * DeviceBUnits\n// Profit_DeviceC = (90 - 0.2 * max(DeviceCUnits - 200, 0)) * DeviceCUnits\n// So, the objective function is: Maximize (Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for all devices combined.\n// DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500\n\n## Generate Constraint-2:\nDue to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA.\n// DeviceBUnits <= 2 * DeviceAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for production costs, and the cost per unit for each device is $20.\n// 20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30,000\n\n## Generate Constraint-4:\nTo ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n// DeviceAUnits >= 50; DeviceBUnits >= 30",
        "question": "A manufacturing company produces three types of electronic devices: DeviceA, DeviceB, and DeviceC. The company needs to decide how many units of each device to produce to optimize its profit while considering various constraints. The profit per unit for each device and the decrease in profit per unit beyond certain production levels are given in the following Table.\n\n| Device | Profit per Unit | Decrease in Profit per Unit Beyond | Threshold Units |\n|--------|-----------------|-----------------------------------|-----------------|\n| DeviceA | $50 | $0.5 | 100 |\n| DeviceB | $70 | $0.3 | 150 |\n| DeviceC | $90 | $0.2 | 200 |\n\nThe company has a total production capacity of 500 units for all devices combined. Due to supply chain limitations, the production of DeviceB cannot exceed twice the production of DeviceA. The company has a budget of $30,000 for production costs, and the cost per unit for each device is $20. To ensure market presence, the company must produce at least 50 units of DeviceA and 30 units of DeviceB.\n\nPlease help the company to maximize the total profit, considering the profit per unit decreases for each device beyond certain production levels.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nDeviceAUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceAUnits\", lb=50)  # number of units of DeviceA\nDeviceBUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceBUnits\", lb=30)  # number of units of DeviceB\nDeviceCUnits = model.addVar(vtype=\"INTEGER\", name=\"DeviceCUnits\", lb=0)    # number of units of DeviceC\n\n# Define objective function\n# Profit per unit for DeviceA decreases by $0.5 for each unit produced beyond the first 100 units\nDeviceA_100 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_100\", lb=0, ub=100)\nDeviceA_over100 = model.addVar(vtype=\"INTEGER\", name=\"DeviceA_over100\", lb=0)\nDeviceA_b1 = model.addVar(vtype=\"B\", name=\"DeviceA_b1\")\nDeviceA_b2 = model.addVar(vtype=\"B\", name=\"DeviceA_b2\")\nmodel.addCons(DeviceA_b1 + DeviceA_b2 == 1)\nmodel.addCons(DeviceAUnits == DeviceA_100*DeviceA_b1 + DeviceA_over100*DeviceA_b2)\nProfit_DeviceA = (50 - 0.5 * DeviceA_over100) * DeviceAUnits\n\n# Profit per unit for DeviceB decreases by $0.3 for each unit produced beyond the first 150 units\nDeviceB_150 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_150\", lb=0, ub=150)\nDeviceB_over150 = model.addVar(vtype=\"INTEGER\", name=\"DeviceB_over150\", lb=0)\nDeviceB_b1 = model.addVar(vtype=\"B\", name=\"DeviceB_b1\")\nDeviceB_b2 = model.addVar(vtype=\"B\", name=\"DeviceB_b2\")\nmodel.addCons(DeviceB_b1 + DeviceB_b2 == 1)\nmodel.addCons(DeviceBUnits == DeviceB_150*DeviceB_b1 + DeviceB_over150*DeviceB_b2)\nProfit_DeviceB = (70 - 0.3 * DeviceB_over150) * DeviceBUnits\n\n# Profit per unit for DeviceC decreases by $0.2 for each unit produced beyond the first 200 units\nDeviceC_200 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_200\", lb=0, ub=200)\nDeviceC_over200 = model.addVar(vtype=\"INTEGER\", name=\"DeviceC_over200\", lb=0)\nDeviceC_b1 = model.addVar(vtype=\"B\", name=\"DeviceC_b1\")\nDeviceC_b2 = model.addVar(vtype=\"B\", name=\"DeviceC_b2\")\nmodel.addCons(DeviceC_b1 + DeviceC_b2 == 1)\nmodel.addCons(DeviceCUnits == DeviceC_200*DeviceC_b1 + DeviceC_over200*DeviceC_b2)\nProfit_DeviceC = (90 - 0.2 * DeviceC_over200) * DeviceCUnits\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_DeviceA + Profit_DeviceB + Profit_DeviceC)\n\n# Add constraints\nmodel.addCons(DeviceAUnits + DeviceBUnits + DeviceCUnits <= 500)\nmodel.addCons(DeviceBUnits <= 2 * DeviceAUnits)\nmodel.addCons(20 * DeviceAUnits + 20 * DeviceBUnits + 20 * DeviceCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of DeviceA Units: \", model.getVal(DeviceAUnits))\n    print(\"Number of DeviceB Units: \", model.getVal(DeviceBUnits))\n    print(\"Number of DeviceC Units: \", model.getVal(DeviceCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1176,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company aims to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n// Profit from A: Profit_A = (30 * A) - 500\n// Profit from B: Profit_B = (40 * B) - 700\n// Profit from C: Profit_C = (50 * C) - 900\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a limited budget of $2000 for setup costs.\n// 500 * A + 700 * B + 900 * C <= 2000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 20 units, and for component B and C is at least 15 units each.\n// A >= 20; B >= 15; C >= 15",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity for each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, but it requires a setup cost of $500. \nThe profit per unit of component B is $40, with a setup cost of $700. \nThe profit per unit of component C is $50, with a setup cost of $900. \nThe company has a limited budget of $2000 for setup costs. The market demand for component A is at least 20 units, and for component B and C is at least 15 units each.\nPlease help the company to maximize the total profit, which is the sum of the profits from selling each component minus the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=20) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=15) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=15) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (30 * A) - 500\nProfit_B = (40 * B) - 700\nProfit_C = (50 * C) - 900\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a limited budget of $2000 for setup costs.\nmodel.addCons(500 * A + 700 * B + 900 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 767,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\n// Prod1 <= 1000; Prod2 <= 800\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n\n| Product | Cost per Unit | Selling Price | Automation Cost Reduction |\n|---------|---------------|---------------|---------------------------|\n| 1       | $100          | $200          | $5 per $10,000            |\n| 2       | $150          | $250          | $10 per $10,000           |\n\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2. The total investment in automation cannot exceed $50,000.\n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=0) # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=0) # production quantity of Product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\nProfit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\nmodel.addCons(Prod1 <= 1000)\nmodel.addCons(Prod2 <= 800)\n## The total investment in automation cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1146,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of each product to produce to maximize its profit while considering the limited resources and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach unit of product A generates a profit of $20, product B generates $30, and product C generates $40. However, the production process is nonlinear due to economies of scale; the profit per unit decreases as production increases. The profit function is defined as P = 20A - 0.1A^2, Q = 30B - 0.2B^2, and R = 40C - 0.3C^2. The plant aims to maximize the total profit from all products.\n// The objective function is: Maximize (20A - 0.1A^2) + (30B - 0.2B^2) + (40C - 0.3C^2)\n\n## Generate Constraint-1:\nThe plant has a limited budget of $10,000 for production costs. Each unit of product A costs $5, product B costs $10, and product C costs $15.\n// 5A + 10B + 15C <= 10000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the optimal number of each product to produce to maximize its profit while considering the limited resources and market demand. The profit per unit decreases as production increases due to economies of scale. The profit function for each product is given in the following Table.\n\n| Product | Profit Function          |\n|---------|--------------------------|\n| A       | P = 20A - 0.1A^2         |\n| B       | Q = 30B - 0.2B^2         |\n| C       | R = 40C - 0.3C^2         |\n\nThe plant has a limited budget of $10,000 for production costs. Each unit of product A costs $5, product B costs $10, and product C costs $15. The plant aims to maximize the total profit from all products. Please help the plant determine the optimal number of units of each product to produce.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The profit function is defined as P = 20A - 0.1A^2, Q = 30B - 0.2B^2, and R = 40C - 0.3C^2.\nP = 20 * A - 0.1 * A**2\nQ = 30 * B - 0.2 * B**2\nR = 40 * C - 0.3 * C**2\n## The objective function is: Maximize (20A - 0.1A^2) + (30B - 0.2B^2) + (40C - 0.3C^2)\nmodel.addCons(obj == P + Q + R)\n\n# Add constraints\n## The plant has a limited budget of $10,000 for production costs. Each unit of product A costs $5, product B costs $10, and product C costs $15.\nmodel.addCons(5 * A + 10 * B + 15 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 867,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process.\n// {\"quantity of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\n// Cost_A = (10 - 0.0001 * Automation) * A\n// Cost_B = (15 - 0.0001 * Automation) * B\n// Cost_C = (20 - 0.0001 * Automation) * C\n// So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe demand for component A is at least 200 units, and for component B is at least 150 units.\n// A >= 200; B >= 150\n\n## Generate Constraint-3:\nThe investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-4:\nThe company must produce at least 50 units of component C.\n// C >= 50\n\n## Generate Constraint-5:\nThe total investment in automation must be at least $10,000.\n// Automation >= 10000",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the production quantities of each component and the level of automation to be implemented in the production process. The cost of producing component A is $10 per unit, component B is $15 per unit, and component C is $20 per unit. The level of automation reduces the cost of production linearly. For every $1000 invested in automation, the production cost per unit decreases by $0.1 for all components. The company aims to minimize the total production cost.\nThe total production capacity of the company is 1000 units. The demand for component A is at least 200 units, and for component B is at least 150 units. The investment in automation cannot exceed $50,000. The company must produce at least 50 units of component C. The total investment in automation must be at least $10,000.\nPlease help the company to determine the optimal production quantities of components A, B, and C, and the level of automation to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # quantity of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # quantity of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # quantity of component C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=10000, ub=50000) # level of automation\n\n# Define objective function\nCost_A = (10 - 0.0001 * Automation) * A\nCost_B = (15 - 0.0001 * Automation) * B\nCost_C = (20 - 0.0001 * Automation) * C\n# So, the objective function is: Minimize Cost_A + Cost_B + Cost_C\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Component A: \", model.getVal(A))\n    print(\"Quantity of Component B: \", model.getVal(B))\n    print(\"Quantity of Component C: \", model.getVal(C))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1062,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget of $6000 for cultivation costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 6000",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre. The farmer has a total of 100 acres available for cultivation. The farmer also has a budget of $6000 for cultivation costs.\nPlease help the farmer to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n## The farmer has a budget of $6000 for cultivation costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 6000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 681,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit.\n// Profit_P1 = (30 - 10) * P1 = 20 * P1\n// Profit_P2 = (40 - 15) * P2 = 25 * P2\n// Profit_P3 = (50 - 20) * P3 = 30 * P3\n// So, the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\n\n## Generate Constraint-1:\nThe plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\n// P1 + P2 + P3 <= 100\n\n## Generate Constraint-2:\nThe plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\n// P1 <= 40; P2 <= 30; P3 <= 50",
        "question": "A manufacturing plant produces three types of products: P1, P2, and P3. The plant needs to determine the optimal number of each product to maximize profit while considering production constraints. The profit per unit of P1 is $30, P2 is $40, and P3 is $50. The production cost per unit of P1 is $10, P2 is $15, and P3 is $20. The plant aims to maximize the total profit. The plant has a limited raw material supply, which allows for a maximum production of 100 units in total. Additionally, the plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3. Please help the plant determine the optimal quantities of P1, P2, and P3 to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # quantity of P3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (20 * P1 + 25 * P2 + 30 * P3)\nmodel.addCons(obj == 20 * P1 + 25 * P2 + 30 * P3)\n\n# Add constraints\n## The plant has a limited raw material supply, which allows for a maximum production of 100 units in total.\nmodel.addCons(P1 + P2 + P3 <= 100)\n## The plant has a specific production capacity for each product: 40 units for P1, 30 units for P2, and 50 units for P3.\nmodel.addCons(P1 <= 40)\nmodel.addCons(P2 <= 30)\nmodel.addCons(P3 <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Quantity of P3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 711,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $100, for corn is $150, and for barley is $120. The farmer wants to maximize his total profit. However, due to the different growth rates and harvesting times, the efficiency of land use varies. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\n// Profit_W = 100 * W\n// Profit_C = 150 * C\n// Profit_B = 120 * B\n// Land_Efficiency_W = 0.9 * W\n// Land_Efficiency_C = 1.2 * C\n// Land_Efficiency_B = 1.1 * B\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres of land available.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $60.\n// 50 * W + 70 * C + 60 * B <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat is 50 acres. So, the farmer can only sell a maximum of 50 acres of wheat.\n// W <= 50\n\n## Generate Constraint-4:\nDue to labor constraints, the farmer can only manage a total of 80 acres.\n// W + C + B <= 80",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to dedicate to each crop. The profit per acre for wheat is $100, for corn is $150, and for barley is $120. The land efficiency for wheat is 0.9, for corn is 1.2, and for barley is 1.1. The farmer wants to maximize the profit per unit of land efficiency.\nThe farmer has a total of 100 acres of land available. He has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $60. The market demand for wheat is 50 acres. So, the farmer can only sell a maximum of 50 acres of wheat. Due to labor constraints, the farmer can only manage a total of 80 acres.\nPlease help the farmer to maximize his total profit per unit of land efficiency.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0, ub=50) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 100 * W\nProfit_C = 150 * C\nProfit_B = 120 * B\nLand_Efficiency_W = 0.9 * W\nLand_Efficiency_C = 1.2 * C\nLand_Efficiency_B = 1.1 * B\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_B) / (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B)\n## convert the division to multiplication\nmodel.addCons(obj * (Land_Efficiency_W + Land_Efficiency_C + Land_Efficiency_B) == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\n## The farmer has a total of 100 acres of land available.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizer of $10,000.\nmodel.addCons(50 * W + 70 * C + 60 * B <= 10000)\n## The market demand for wheat is 50 acres.\nmodel.addCons(W <= 50)\n## Due to labor constraints, the farmer can only manage a total of 80 acres.\nmodel.addCons(W + C + B <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Barley: \", model.getVal(B))\n    print(\"Maximized Profit per Unit of Land Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints.\n// {\"amount of chemical produced at facility 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from producing the chemical at each facility depends on the amount produced and the cost of production. The profit function is nonlinear and is given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\nThe company wants to maximize the total profit from all facilities.\n// The objective function is: Maximize F = F1 + F2 + F3\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all facilities must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints. The profit from producing the chemical at each facility depends on the amount produced and the cost of production, with the profit function being nonlinear and given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\n\nThe company wants to maximize the total profit from all facilities. Additionally, the total amount of chemical produced across all facilities must not exceed 1000 units.\n\nPlease help the company determine the optimal production amounts for each facility (P1, P2, P3) to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # amount of chemical produced at facility 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced at facility 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced at facility 3\n\n# Define objective function\n## The profit function is nonlinear and is given by:\nF1 = 100 * P1 - 0.5 * P1**2\nF2 = 120 * P2 - 0.6 * P2**2\nF3 = 110 * P3 - 0.4 * P3**2\n## The objective function is: Maximize F = F1 + F2 + F3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == F1 + F2 + F3)\n\n# Add constraints\n## The total amount of chemical produced across all facilities must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced at facility 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced at facility 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced at facility 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 872,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that handle different types of products. The company needs to optimize the allocation of its limited budget to these warehouses to maximize the total value of products stored.\n// {\"budget allocation for warehouse 1\": \"B1\", \"range\": \"0 <= B1 <= 100000\", \"type\": \"real\"}\n// {\"budget allocation for warehouse 2\": \"B2\", \"range\": \"0 <= B2 <= 100000\", \"type\": \"real\"}\n// {\"budget allocation for warehouse 3\": \"B3\", \"range\": \"0 <= B3 <= 100000\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe value of products stored in each warehouse increases nonlinearly with the budget allocation. Specifically, the value V in each warehouse is given by:\n- Warehouse 1: V1 = 1000 * B1^0.7\n- Warehouse 2: V2 = 1500 * B2^0.6\n- Warehouse 3: V3 = 2000 * B3^0.5\nThe company aims to maximize the total value of products stored across all warehouses.\n// The objective function is: Maximize V = V1 + V2 + V3 = 1000 * B1^0.7 + 1500 * B2^0.6 + 2000 * B3^0.5\n\n## Generate Constraint-1:\nThe total budget available for allocation is $200,000.\n// B1 + B2 + B3 = 200000\n\n## Generate Constraint-2:\nAt least 25% of the total budget must be allocated to Warehouse 1.\n// B1 >= 0.25 * (B1 + B2 + B3)",
        "question": "A company operates three different warehouses that handle different types of products. The company needs to optimize the allocation of its limited budget to these warehouses to maximize the total value of products stored. The value of products stored in each warehouse increases nonlinearly with the budget allocation. Specifically, the value V in each warehouse is given by:\n- Warehouse 1: V1 = 1000 * B1^0.7\n- Warehouse 2: V2 = 1500 * B2^0.6\n- Warehouse 3: V3 = 2000 * B3^0.5\nThe company aims to maximize the total value of products stored across all warehouses. The total budget available for allocation is $200,000. At least 25% of the total budget must be allocated to Warehouse 1. Please help the company determine the optimal budget allocation for each warehouse (B1, B2, B3) within the given constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nB1 = model.addVar(vtype=\"CONTINUOUS\", name=\"B1\", lb=0, ub=100000) # budget allocation for warehouse 1\nB2 = model.addVar(vtype=\"CONTINUOUS\", name=\"B2\", lb=0, ub=100000) # budget allocation for warehouse 2\nB3 = model.addVar(vtype=\"CONTINUOUS\", name=\"B3\", lb=0, ub=100000) # budget allocation for warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The value of products stored in each warehouse increases nonlinearly with the budget allocation.\nV1 = 1000 * B1**0.7\nV2 = 1500 * B2**0.6\nV3 = 2000 * B3**0.5\n## The objective function is: Maximize V = V1 + V2 + V3\nmodel.addCons(obj == V1 + V2 + V3)\n\n# Add constraints\n## The total budget available for allocation is $200,000.\nmodel.addCons(B1 + B2 + B3 == 200000)\n## At least 25% of the total budget must be allocated to Warehouse 1.\nmodel.addCons(B1 >= 0.25 * (B1 + B2 + B3))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Budget Allocation for Warehouse 1: \", model.getVal(B1))\n    print(\"Budget Allocation for Warehouse 2: \", model.getVal(B2))\n    print(\"Budget Allocation for Warehouse 3: \", model.getVal(B3))\n    print(\"Maximized Total Value of Products: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints.\n// {\"production rate of ChemicalA\": \"ChemicalARate\", \"range\": \"ChemicalARate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalB\": \"ChemicalBRate\", \"range\": \"ChemicalBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalC\": \"ChemicalCRate\", \"range\": \"ChemicalCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals.\n// Total profit for ChemicalA: Profit_ChemicalA = 50 * ChemicalARate\n// Total profit for ChemicalB: Profit_ChemicalB = 70 * ChemicalBRate\n// Total profit for ChemicalC: Profit_ChemicalC = 90 * ChemicalCRate\n// So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n## Generate Constraint-1:\nThe total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\n// ChemicalARate + ChemicalBRate + ChemicalCRate <= 100\n\n## Generate Constraint-2:\nThe production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\n// ChemicalBRate >= 2 * ChemicalARate",
        "question": "A manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals. The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity. The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand. Please help the company determine the optimal production rates for ChemicalA, ChemicalB, and ChemicalC.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalARate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalARate\", lb=0) # production rate of ChemicalA\nChemicalBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBRate\", lb=0) # production rate of ChemicalB\nChemicalCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCRate\", lb=0) # production rate of ChemicalC\n\n# Define objective function\nProfit_ChemicalA = 50 * ChemicalARate\nProfit_ChemicalB = 70 * ChemicalBRate\nProfit_ChemicalC = 90 * ChemicalCRate\n# So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n# Add constraints\n# The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\nmodel.addCons(ChemicalARate + ChemicalBRate + ChemicalCRate <= 100)\n# The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\nmodel.addCons(ChemicalBRate >= 2 * ChemicalARate)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemicalA: \", model.getVal(ChemicalARate))\n    print(\"Production Rate of ChemicalB: \", model.getVal(ChemicalBRate))\n    print(\"Production Rate of ChemicalC: \", model.getVal(ChemicalCRate))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 756,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its energy consumption by installing solar panels on three different types of roofs (flat, sloped, and green roofs). The company needs to decide how many panels to install on each type of roof.\n// {\"number of solar panels on flat roofs\": \"Flat\", \"range\": \"Flat >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on sloped roofs\": \"Slope\", \"range\": \"Slope >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels on green roofs\": \"Green\", \"range\": \"Green >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh.\n// Energy output from flat roofs: E_flat = 0.8 * Flat\n// Energy output from sloped roofs: E_slope = 0.9 * Slope\n// Energy output from green roofs: E_green = 0.75 * Green\n// Total energy output: E_total = E_flat + E_slope + E_green\n// Total cost: Cost = 1000 * Flat + 1200 * Slope + 800 * Green\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total energy output must be at least 100,000 kWh.\n// E_flat + E_slope + E_green >= 100000\n\n## Generate Constraint-2:\nThe company has a budget of $150,000 for the installation.\n// 1000 * Flat + 1200 * Slope + 800 * Green <= 150000\n\n## Generate Constraint-3:\nThe maximum number of panels that can be installed on flat roofs is 100.\n// Flat <= 100\n\n## Generate Constraint-4:\nThe maximum number of panels that can be installed on sloped roofs is 120.\n// Slope <= 120\n\n## Generate Constraint-5:\nThe maximum number of panels that can be installed on green roofs is 80.\n// Green <= 80",
        "question": "A company is planning to optimize its energy consumption by installing solar panels on three different types of roofs: flat, sloped, and green roofs. The company needs to decide how many panels to install on each type of roof. The efficiency of solar panels varies based on the type of roof: flat roofs have an efficiency of 80%, sloped roofs have an efficiency of 90%, and green roofs have an efficiency of 75%. The cost of installation per panel also varies: $1000 for flat, $1200 for sloped, and $800 for green roofs. The company wants to minimize the total cost of installation while ensuring a minimum energy output of 100,000 kWh. The company has a budget of $150,000 for the installation. The maximum number of panels that can be installed on flat roofs is 100, on sloped roofs is 120, and on green roofs is 80.\n\nPlease help the company to determine the optimal number of solar panels to install on each type of roof to minimize the total cost of installation while meeting the energy output requirement.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nFlat = model.addVar(vtype=\"INTEGER\", name=\"Flat\", lb=0, ub=100) # number of solar panels on flat roofs\nSlope = model.addVar(vtype=\"INTEGER\", name=\"Slope\", lb=0, ub=120) # number of solar panels on sloped roofs\nGreen = model.addVar(vtype=\"INTEGER\", name=\"Green\", lb=0, ub=80) # number of solar panels on green roofs\n\n# Define objective function\nCost = 1000 * Flat + 1200 * Slope + 800 * Green\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nE_flat = 0.8 * Flat\nE_slope = 0.9 * Slope\nE_green = 0.75 * Green\nE_total = E_flat + E_slope + E_green\nmodel.addCons(E_total >= 100000)\nmodel.addCons(1000 * Flat + 1200 * Slope + 800 * Green <= 150000)\nmodel.addCons(Flat <= 100)\nmodel.addCons(Slope <= 120)\nmodel.addCons(Green <= 80)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels on Flat Roofs: \", model.getVal(Flat))\n    print(\"Number of Solar Panels on Sloped Roofs: \", model.getVal(Slope))\n    print(\"Number of Solar Panels on Green Roofs: \", model.getVal(Green))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1011,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin.\n// {\"production rate of MachineA\": \"MachineAProduction\", \"range\": \"MachineAProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineB\": \"MachineBProduction\", \"range\": \"MachineBProduction >= 0\", \"type\": \"real\"}\n// {\"production rate of MachineC\": \"MachineCProduction\", \"range\": \"MachineCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company wants to maximize the total profit.\n// Total profit for MachineA: Profit_MachineA = (500 - 300) * MachineAProduction\n// Total profit for MachineB: Profit_MachineB = (700 - 400) * MachineBProduction\n// Total profit for MachineC: Profit_MachineC = (900 - 500) * MachineCProduction\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units per month.\n// MachineAProduction + MachineBProduction + MachineCProduction <= 1000\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineBProduction <= 2 * MachineAProduction\n\n## Generate Constraint-3:\nThe company has a budget constraint for raw materials of $450,000 per month.\n// 300 * MachineAProduction + 400 * MachineBProduction + 500 * MachineCProduction <= 450,000",
        "question": "A manufacturing company produces three types of machines: MachineA, MachineB, and MachineC. They need to determine the production rate of each machine to optimize their profit margin. The profit per unit for MachineA is $500, for MachineB is $700, and for MachineC is $900. The production cost per unit for MachineA is $300, for MachineB is $400, and for MachineC is $500. The company has a total production capacity of 1000 units per month. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company also has a budget constraint for raw materials of $450,000 per month. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineAProduction\", lb=0) # production rate of MachineA\nMachineBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineBProduction\", lb=0) # production rate of MachineB\nMachineCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"MachineCProduction\", lb=0) # production rate of MachineC\n\n# Define objective function\nProfit_MachineA = (500 - 300) * MachineAProduction\nProfit_MachineB = (700 - 400) * MachineBProduction\nProfit_MachineC = (900 - 500) * MachineCProduction\n# So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n# The company has a total production capacity of 1000 units per month.\nmodel.addCons(MachineAProduction + MachineBProduction + MachineCProduction <= 1000)\n# Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineBProduction <= 2 * MachineAProduction)\n# The company has a budget constraint for raw materials of $450,000 per month.\nmodel.addCons(300 * MachineAProduction + 400 * MachineBProduction + 500 * MachineCProduction <= 450000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of MachineA: \", model.getVal(MachineAProduction))\n    print(\"Production Rate of MachineB: \", model.getVal(MachineBProduction))\n    print(\"Production Rate of MachineC: \", model.getVal(MachineCProduction))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 681,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, corn is $15, and barley is $12. The farmer's goal is to maximize his total profit. However, the yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n// Profit_W = 10 * W * (1 + 0.005 * water_W)\n// Profit_C = 15 * C * (1 + 0.007 * water_C)\n// Profit_B = 12 * B * (1 + 0.006 * water_B)\n// Total_water = water_W + water_C + water_B = 500\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_B)\n\n## Generate Constraint-1:\nThe total water used for all crops cannot exceed 500 units.\n// water_W + water_C + water_B <= 500\n\n## Generate Constraint-2:\nThe farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit.\n// 2 * W + 3 * C + 2.5 * B <= 1000\n\n## Generate Constraint-3:\nThe market demand for wheat is limited to 100 units.\n// W <= 100\n\n## Generate Constraint-4:\nThe farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units.\n// W + C + B <= 200",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant on each plot to maximize his profit while considering the soil fertility and water availability. The profit per unit of wheat is $10, corn is $15, and barley is $12. The yield of each crop depends on the amount of water used, which is limited. The yield of wheat increases by 0.5% for each unit of water, corn by 0.7% per unit, and barley by 0.6% per unit. The total water available is 500 units.\n\n| Crop   | Profit per Unit | Water Yield Increase | Labor Hours per Unit |\n|--------|-----------------|----------------------|----------------------|\n| Wheat  | $10             | 0.5%                 | 2 hours              |\n| Corn   | $15             | 0.7%                 | 3 hours              |\n| Barley | $12             | 0.6%                 | 2.5 hours            |\n\nThe total water used for all crops cannot exceed 500 units. The farmer has a labor constraint where the total hours spent on all plots cannot exceed 1000 hours. Planting wheat requires 2 hours per unit, corn requires 3 hours per unit, and barley requires 2.5 hours per unit. The market demand for wheat is limited to 100 units. The farmer has a storage capacity constraint where the total amount of crops stored cannot exceed 200 units.\n\nPlease help the farmer to maximize his total profit by determining the optimal amount of wheat (W), corn (C), and barley (B) to plant.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0)  # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0)  # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0)  # amount of barley\nwater_W = model.addVar(vtype=\"CONTINUOUS\", name=\"water_W\", lb=0)  # water for wheat\nwater_C = model.addVar(vtype=\"CONTINUOUS\", name=\"water_C\", lb=0)  # water for corn\nwater_B = model.addVar(vtype=\"CONTINUOUS\", name=\"water_B\", lb=0)  # water for barley\n\n# Define objective function\nProfit_W = 10 * W * (1 + 0.005 * water_W)\nProfit_C = 15 * C * (1 + 0.007 * water_C)\nProfit_B = 12 * B * (1 + 0.006 * water_B)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W + Profit_C + Profit_B)\n\n# Add constraints\nmodel.addCons(water_W + water_C + water_B <= 500)  # total water constraint\nmodel.addCons(2 * W + 3 * C + 2.5 * B <= 1000)  # labor constraint\nmodel.addCons(W <= 100)  # market demand for wheat\nmodel.addCons(W + C + B <= 200)  # storage capacity constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1472,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product to maximize profit while considering the cost of overtime.\n// {\"production rate for Product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for Product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit for Product 1 is $50, for Product 2 is $70, and for Product 3 is $60. The overtime cost per hour is $100. The production line operates for 8 hours a day, and any overtime is charged at the rate of $100 per hour. The company aims to maximize the total daily profit.\n// Total profit for Product 1: Profit1 = 50 * P1 * 8\n// Total profit for Product 2: Profit2 = 70 * P2 * 8\n// Total profit for Product 3: Profit3 = 60 * P3 * 8\n// Overtime cost: Overtime = 100 * max(0, P1 + P2 + P3 - 8)\n// So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 - Overtime)\n\n## Generate Constraint-1:\nThe total production rate for all products must not exceed the production capacity of 10 units per hour.\n// P1 + P2 + P3 <= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product to maximize profit while considering the cost of overtime. The profit per unit for Product 1 is $50, for Product 2 is $70, and for Product 3 is $60. The overtime cost per hour is $100. The production line operates for 8 hours a day, and any overtime is charged at the rate of $100 per hour. The company aims to maximize the total daily profit. The total production rate for all products must not exceed the production capacity of 10 units per hour. Please help the company to determine the optimal production rates for each product.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for Product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for Product 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate for Product 3\n\n# Define objective function\n## Total profit for Product 1: Profit1 = 50 * P1 * 8\n## Total profit for Product 2: Profit2 = 70 * P2 * 8\n## Total profit for Product 3: Profit3 = 60 * P3 * 8\nProfit1 = 50 * P1 * 8\nProfit2 = 70 * P2 * 8\nProfit3 = 60 * P3 * 8\n## Overtime cost: Overtime = 100 * max(0, P1 + P2 + P3 - 8)\nOvertime = model.addVar(vtype=\"CONTINUOUS\", name=\"Overtime\")\nmodel.addCons(Overtime >= P1 + P2 + P3 - 8)\nmodel.addCons(Overtime >= 0)\n## So, the objective function is: Maximize (Profit1 + Profit2 + Profit3 - Overtime)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit1 + Profit2 + Profit3 - Overtime)\n\n# Add constraints\n## The total production rate for all products must not exceed the production capacity of 10 units per hour.\nmodel.addCons(P1 + P2 + P3 <= 10)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate for Product 1: \", model.getVal(P1))\n    print(\"Production rate for Product 2: \", model.getVal(P2))\n    print(\"Production rate for Product 3: \", model.getVal(P3))\n    print(\"Maximized Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 706,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints.\n// {\"daily production quantity of ChemicalA\": \"ChemicalAProduction\", \"range\": \"ChemicalAProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalB\": \"ChemicalBProduction\", \"range\": \"ChemicalBProduction >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of ChemicalC\": \"ChemicalCProduction\", \"range\": \"ChemicalCProduction >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals.\n// Total daily profit: Profit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe total daily production capacity of the company is limited to 1000 units.\n// ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000\n\n## Generate Constraint-2:\nDue to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\n// ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction)",
        "question": "A manufacturing company is planning to optimize the production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal daily production quantities for each chemical to maximize profit while considering various constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total daily profit from the production of these chemicals. The total daily production capacity of the company is limited to 1000 units. Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production. Please help the company to determine the optimal daily production quantities for each chemical to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalAProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalAProduction\", lb=0) # daily production quantity of ChemicalA\nChemicalBProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBProduction\", lb=0) # daily production quantity of ChemicalB\nChemicalCProduction = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCProduction\", lb=0) # daily production quantity of ChemicalC\n\n# Define objective function\nProfit = 50 * ChemicalAProduction + 70 * ChemicalBProduction + 90 * ChemicalCProduction\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The total daily production capacity of the company is limited to 1000 units.\nmodel.addCons(ChemicalAProduction + ChemicalBProduction + ChemicalCProduction <= 1000)\n# Due to safety regulations, the production of ChemicalC cannot exceed 30% of the total production.\nmodel.addCons(ChemicalCProduction <= 0.3 * (ChemicalAProduction + ChemicalBProduction + ChemicalCProduction))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production Quantity of ChemicalA: \", model.getVal(ChemicalAProduction))\n    print(\"Daily Production Quantity of ChemicalB: \", model.getVal(ChemicalBProduction))\n    print(\"Daily Production Quantity of ChemicalC: \", model.getVal(ChemicalCProduction))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 741,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line.\n// {\"production rate for product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"continuous\"}\n// {\"production rate for product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"continuous\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n// Total production cost for product 1: Cost1 = 50 * P1 / (1 - 0.005 * Automation)\n// Total production cost for product 2: Cost2 = 70 * P2 / (1 - 0.005 * Automation)\n// Total daily production cost: TotalCost = Cost1 + Cost2\n// So, the objective function is: Minimize TotalCost\n\n## Generate Constraint-1:\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\n// P1 <= 50; P2 <= 40\n\n## Generate Constraint-2:\nThe level of automation must not exceed 80%.\n// Automation <= 0.8",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to determine the production rate (units per hour) for each product and the level of automation (percentage) to be implemented in the production line. The cost of producing each unit of product 1 is $50, and for product 2 is $70. The automation level reduces the cost of production linearly, with a 1% increase in automation reducing the cost by $0.5 for both products. The company aims to minimize the total production cost while meeting a daily demand of 100 units for product 1 and 150 units for product 2.\n\n| Product | Cost per Unit | Maximum Production Rate (units/hour) |\n|---------|---------------|-------------------------------------|\n| 1       | $50           | 50                                  |\n| 2       | $70           | 40                                  |\n\nThe production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2. The level of automation must not exceed 80%. Please help the company to minimize the total daily production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # production rate for product 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # production rate for product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # level of automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost1 = 50 * P1 / (1 - 0.005 * Automation)\nCost2 = 70 * P2 / (1 - 0.005 * Automation)\nTotalCost = Cost1 + Cost2\n## the objective function is: Minimize TotalCost\nmodel.addCons(obj == TotalCost)\n\n# Add constraints\n## The production line can produce a maximum of 50 units per hour for product 1 and 40 units per hour for product 2.\nmodel.addCons(P1 <= 50)\nmodel.addCons(P2 <= 40)\n## The level of automation must not exceed 80%.\nmodel.addCons(Automation <= 0.8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate for Product 1: \", model.getVal(P1))\n    print(\"Production Rate for Product 2: \", model.getVal(P2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Minimized Total Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1110,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. The company needs to decide the daily production quantities of each chemical to optimize its profit.\n// {\"daily production quantity of Chemical A\": \"Q_A\", \"range\": \"Q_A >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of Chemical B\": \"Q_B\", \"range\": \"Q_B >= 0\", \"type\": \"real\"}\n// {\"daily production quantity of Chemical C\": \"Q_C\", \"range\": \"Q_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from Chemical A is $50 per unit, but it decreases by 1% for each unit produced beyond the first 100 units. The profit from Chemical B is $70 per unit, but it decreases by 0.5% for each unit produced beyond the first 50 units. The profit from Chemical C is $100 per unit, but it decreases by 0.2% for each unit produced beyond the first 200 units. The company aims to maximize its total daily profit.\n// Profit from Chemical A: Profit_A = 50 * Q_A - 0.01 * Q_A * (Q_A - 100) if Q_A > 100 else 50 * Q_A\n// Profit from Chemical B: Profit_B = 70 * Q_B - 0.005 * Q_B * (Q_B - 50) if Q_B > 50 else 70 * Q_B\n// Profit from Chemical C: Profit_C = 100 * Q_C - 0.002 * Q_C * (Q_C - 200) if Q_C > 200 else 100 * Q_C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a daily production capacity of 500 units in total.\n// Q_A + Q_B + Q_C <= 500\n\n## Generate Constraint-2:\nDue to safety regulations, the production of Chemical A must not exceed twice the production of Chemical B.\n// Q_A <= 2 * Q_B\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of Chemical C daily to meet contractual obligations.\n// Q_C >= 50\n\n## Generate Constraint-4:\nThe production of Chemical B is limited to a maximum of 150 units due to market demand constraints.\n// Q_B <= 150",
        "question": "A manufacturing company produces three types of chemicals: Chemical A, Chemical B, and Chemical C. The company needs to decide the daily production quantities of each chemical to optimize its profit. The profit from each chemical decreases as more units are produced beyond certain thresholds. Specifically, the profit from Chemical A is $50 per unit, but it decreases by 1% for each unit produced beyond the first 100 units. The profit from Chemical B is $70 per unit, but it decreases by 0.5% for each unit produced beyond the first 50 units. The profit from Chemical C is $100 per unit, but it decreases by 0.2% for each unit produced beyond the first 200 units. The company aims to maximize its total daily profit.\n\nThe company has a daily production capacity of 500 units in total. Due to safety regulations, the production of Chemical A must not exceed twice the production of Chemical B. The company must produce at least 50 units of Chemical C daily to meet contractual obligations. Additionally, the production of Chemical B is limited to a maximum of 150 units due to market demand constraints.\n\nPlease help the company to determine the optimal daily production quantities of Chemical A, Chemical B, and Chemical C to maximize its total daily profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQ_A = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_A\", lb=0) # daily production quantity of Chemical A\nQ_B = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_B\", lb=0) # daily production quantity of Chemical B\nQ_C = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_C\", lb=0) # daily production quantity of Chemical C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = 50 * Q_A - 0.01 * Q_A * (Q_A - 100) if Q_A > 100 else 50 * Q_A\nQ_A1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_A1\", lb=0, ub=100)\nQ_A2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(Q_A == Q_A1*A_b1 + Q_A2*A_b2)\nProfit_A = 50 * Q_A1 * A_b1 + (50 - 0.01 * (Q_A2 - 100)) * Q_A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = 70 * Q_B - 0.005 * Q_B * (Q_B - 50) if Q_B > 50 else 70 * Q_B\nQ_B1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_B1\", lb=0, ub=50)\nQ_B2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_B2\", lb=50, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(Q_B == Q_B1*B_b1 + Q_B2*B_b2)\nProfit_B = 70 * Q_B1 * B_b1 + (70 - 0.005 * (Q_B2 - 50)) * Q_B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = 100 * Q_C - 0.002 * Q_C * (Q_C - 200) if Q_C > 200 else 100 * Q_C\nQ_C1 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_C1\", lb=0, ub=200)\nQ_C2 = model.addVar(vtype=\"CONTINUOUS\", name=\"Q_C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(Q_C == Q_C1*C_b1 + Q_C2*C_b2)\nProfit_C = 100 * Q_C1 * C_b1 + (100 - 0.002 * (Q_C2 - 200)) * Q_C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(Q_A + Q_B + Q_C <= 500)\nmodel.addCons(Q_A <= 2 * Q_B)\nmodel.addCons(Q_C >= 50)\nmodel.addCons(Q_B <= 150)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Daily Production Quantity of Chemical A: \", model.getVal(Q_A))\n    print(\"Daily Production Quantity of Chemical B: \", model.getVal(Q_B))\n    print(\"Daily Production Quantity of Chemical C: \", model.getVal(Q_C))\n    print(\"Total Daily Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1260,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production.\n// {\"number of workers on smartphone production\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of workers on tablet production\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of workers on laptop production\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. The company needs to decide the optimal allocation of workers to maximize the total profit.\n// The profit from smartphones: P_S = 50 * 10 * S\n// The profit from tablets: P_T = 70 * 8 * T\n// The profit from laptops: P_L = 100 * 5 * L\n// So, the objective function is: Maximize P = P_S + P_T + P_L\n\n## Generate Constraint-1:\nThere are total 60 workers available.\n// S + T + L <= 60\n\n## Generate Constraint-2:\nEach production line can be utilized by up to 25 workers at a time.\n// S <= 25; T <= 25; L <= 25",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to determine the number of workers to assign to each type of device production. Each worker in the smartphone production line can produce 10 smartphones per hour, in the tablet production line can produce 8 tablets per hour, and in the laptop production line can produce 5 laptops per hour. The company aims to maximize its profit, where the profit from each smartphone is $50, from each tablet is $70, and from each laptop is $100. There are total 60 workers available, and each production line can be utilized by up to 25 workers at a time. Please help the company to decide the optimal allocation of workers to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of workers on smartphone production\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of workers on tablet production\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of workers on laptop production\n\n# Define objective function\nP_S = 50 * 10 * S\nP_T = 70 * 8 * T\nP_L = 100 * 5 * L\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P_S + P_T + P_L)\n\n# Add constraints\nmodel.addCons(S + T + L <= 60)\nmodel.addCons(S <= 25)\nmodel.addCons(T <= 25)\nmodel.addCons(L <= 25)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Smartphone Production: \", model.getVal(S))\n    print(\"Number of Workers on Tablet Production: \", model.getVal(T))\n    print(\"Number of Workers on Laptop Production: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 751,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit.\n// {\"number of units of ComponentA\": \"ComponentAUnits\", \"range\": \"ComponentAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"ComponentBUnits\", \"range\": \"ComponentBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"ComponentCUnits\", \"range\": \"ComponentCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company wants to maximize the total profit.\n// Profit_ComponentA = (50 - (ComponentAUnits > 100 ? (ComponentAUnits - 100) : 0)) * ComponentAUnits\n// Profit_ComponentB = (70 - (ComponentBUnits > 200 ? 0.5 * (ComponentBUnits - 200) : 0)) * ComponentBUnits\n// Profit_ComponentC = (100 - (ComponentCUnits > 150 ? 2 * (ComponentCUnits - 150) : 0)) * ComponentCUnits\n// So, the objective function is: Maximize (Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 500 units for the month.\n// ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500\n\n## Generate Constraint-2:\nDue to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA.\n// ComponentBUnits <= 2 * ComponentAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ComponentA is $20, for ComponentB is $30, and for ComponentC is $40.\n// 20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30,000\n\n## Generate Constraint-4:\nThe company wants to ensure that at least 50 units of each component are produced to meet minimum order requirements.\n// ComponentAUnits >= 50; ComponentBUnits >= 50; ComponentCUnits >= 50",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. They need to decide how many units of each component to produce in the next month to optimize their profit. The profit per unit for ComponentA is $50, but it decreases by $1 for every unit produced beyond the first 100 units. The profit per unit for ComponentB is $70, but it decreases by $0.5 for every unit produced beyond the first 200 units. The profit per unit for ComponentC is $100, but it decreases by $2 for every unit produced beyond the first 150 units. The company has a total production capacity of 500 units for the month. Due to resource limitations, the production of ComponentB cannot exceed twice the production of ComponentA. The company has a budget of $30,000 for raw materials for the month. The cost of raw materials per unit for ComponentA is $20, for ComponentB is $30, and for ComponentC is $40. The company wants to ensure that at least 50 units of each component are produced to meet minimum order requirements. Please help the company to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nComponentAUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentAUnits\", lb=50)\nComponentBUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentBUnits\", lb=50)\nComponentCUnits = model.addVar(vtype=\"INTEGER\", name=\"ComponentCUnits\", lb=50)\n\n# Define objective function\n# Create piecewise variables for piecewise function: Profit_ComponentA\nComponentA1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA1\", lb=0, ub=100)\nComponentA2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentA2\", lb=100, ub=500)\nComponentA_b1 = model.addVar(vtype=\"B\", name=\"ComponentA_b1\")\nComponentA_b2 = model.addVar(vtype=\"B\", name=\"ComponentA_b2\")\nmodel.addCons(ComponentA_b1 + ComponentA_b2 == 1)\nmodel.addCons(ComponentAUnits == ComponentA1*ComponentA_b1 + ComponentA2*ComponentA_b2)\nProfit_ComponentA = (50 - (ComponentA2 - 100)) * ComponentA2 * ComponentA_b2 + 50 * ComponentA1 * ComponentA_b1\n\n# Create piecewise variables for piecewise function: Profit_ComponentB\nComponentB1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB1\", lb=0, ub=200)\nComponentB2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentB2\", lb=200, ub=500)\nComponentB_b1 = model.addVar(vtype=\"B\", name=\"ComponentB_b1\")\nComponentB_b2 = model.addVar(vtype=\"B\", name=\"ComponentB_b2\")\nmodel.addCons(ComponentB_b1 + ComponentB_b2 == 1)\nmodel.addCons(ComponentBUnits == ComponentB1*ComponentB_b1 + ComponentB2*ComponentB_b2)\nProfit_ComponentB = (70 - 0.5 * (ComponentB2 - 200)) * ComponentB2 * ComponentB_b2 + 70 * ComponentB1 * ComponentB_b1\n\n# Create piecewise variables for piecewise function: Profit_ComponentC\nComponentC1 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC1\", lb=0, ub=150)\nComponentC2 = model.addVar(vtype=\"INTEGER\", name=\"ComponentC2\", lb=150, ub=500)\nComponentC_b1 = model.addVar(vtype=\"B\", name=\"ComponentC_b1\")\nComponentC_b2 = model.addVar(vtype=\"B\", name=\"ComponentC_b2\")\nmodel.addCons(ComponentC_b1 + ComponentC_b2 == 1)\nmodel.addCons(ComponentCUnits == ComponentC1*ComponentC_b1 + ComponentC2*ComponentC_b2)\nProfit_ComponentC = (100 - 2 * (ComponentC2 - 150)) * ComponentC2 * ComponentC_b2 + 100 * ComponentC1 * ComponentC_b1\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ComponentA + Profit_ComponentB + Profit_ComponentC)\n\n# Add constraints\nmodel.addCons(ComponentAUnits + ComponentBUnits + ComponentCUnits <= 500)\nmodel.addCons(ComponentBUnits <= 2 * ComponentAUnits)\nmodel.addCons(20 * ComponentAUnits + 30 * ComponentBUnits + 40 * ComponentCUnits <= 30000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA Units: \", model.getVal(ComponentAUnits))\n    print(\"Number of ComponentB Units: \", model.getVal(ComponentBUnits))\n    print(\"Number of ComponentC Units: \", model.getVal(ComponentCUnits))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1104,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $500, but it requires $200 per acre for maintenance. \nFor Crop B, the expected profit per acre is $700, but it requires $300 per acre for maintenance. \nFor Crop C, the expected profit per acre is $900, but it requires $400 per acre for maintenance.\nThe farmer aims to maximize the net profit per acre (which is defined as the difference between the expected profit and the maintenance cost per acre).\n// Net profit per acre of A: Profit_A = (500 - 200) * A\n// Net profit per acre of B: Profit_B = (700 - 300) * B\n// Net profit per acre of C: Profit_C = (900 - 400) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (A + B + C)\n\n## Generate Constraint-1:\nThe farmer has a budget of $10,000 for maintenance costs.\n// 200 * A + 300 * B + 400 * C <= 10000",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate for each crop. For Crop A, the expected profit per acre is $500, but it requires $200 per acre for maintenance. For Crop B, the expected profit per acre is $700, but it requires $300 per acre for maintenance. For Crop C, the expected profit per acre is $900, but it requires $400 per acre for maintenance. The farmer has a budget of $10,000 for maintenance costs. The farmer aims to maximize the net profit per acre (which is defined as the difference between the expected profit and the maintenance cost per acre). Please help the farmer determine the optimal allocation of acres for each crop to achieve this goal.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nTotalAcres = A + B + C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a budget of $10,000 for maintenance costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 735,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per quarter. \nFor Product B, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per quarter. \nFor Product C, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per quarter.\nThe company aims to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).\n// Selling profit of A: Profit_A = (50 - 30 - 5) * A\n// Selling profit of B: Profit_B = (70 - 40 - 7) * B\n// Selling profit of C: Profit_C = (90 - 50 - 9) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (5 * A + 7 * B + 9 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs for the next quarter.\n// 30 * A + 40 * B + 50 * C <= 10000\n\n## Generate Constraint-2:\nThe company wants to produce at least 50 units of each product for the next quarter.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantity of each product for the next quarter.\nFor Product A, the selling price is $50, the production cost is $30, and the storage cost is $5 per unit per quarter. \nFor Product B, the selling price is $70, the production cost is $40, and the storage cost is $7 per unit per quarter. \nFor Product C, the selling price is $90, the production cost is $50, and the storage cost is $9 per unit per quarter.\nThe company has a budget of $10,000 for production costs for the next quarter. The company wants to produce at least 50 units of each product for the next quarter.\nPlease help the company to maximize the net profit per unit of storage space used (which is defined as the sum of the selling profit minus the production and storage costs, divided by the sum of the storage costs).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to produce at least 50 units of each product for the next quarter.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 30 - 5) * A\nProfit_B = (70 - 40 - 7) * B\nProfit_C = (90 - 50 - 9) * C\nStorageCost = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs for the next quarter.\nmodel.addCons(30 * A + 40 * B + 50 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Space Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 898,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\n// {\"number of crops in greenhouse A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of crops in greenhouse C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 units of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 units of energy. \nThe farm aims to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.\n// Profit from greenhouse A: Profit_A = 50 * A\n// Profit from greenhouse B: Profit_B = 70 * B\n// Profit from greenhouse C: Profit_C = 90 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (2 * A^2 + 3 * B^2 + 4 * C^2)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available for all greenhouses.\n// 2 * A + 3 * B + 4 * C <= 100",
        "question": "A farm operates three different types of greenhouses: A, B, and C. Each greenhouse requires a specific amount of water and energy to maintain optimal growth conditions for crops. The farm needs to determine the optimal number of crops to grow in each greenhouse to maximize profit while considering resource constraints.\nEach crop in greenhouse A yields a profit of $50, requires 2 units of water, and 1 unit of energy. \nEach crop in greenhouse B yields a profit of $70, requires 3 units of water, and 2 unit of energy. \nEach crop in greenhouse C yields a profit of $90, requires 4 units of water, and 3 unit of energy. \nThe farm has a total of 100 units of water available for all greenhouses.\nPlease help the farm to maximize the total profit from all greenhouses, considering the nonlinear relationship between profit and resource usage.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of crops in greenhouse A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of crops in greenhouse B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of crops in greenhouse C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A\nProfit_B = 70 * B\nProfit_C = 90 * C\nResourceUsage = 2 * A**2 + 3 * B**2 + 4 * C**2\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available for all greenhouses.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of crops in greenhouse A: \", model.getVal(A))\n    print(\"Number of crops in greenhouse B: \", model.getVal(B))\n    print(\"Number of crops in greenhouse C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 840,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production.\n// {\"amount of chemical produced in factory 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each factory is determined by a nonlinear function of the amount of chemical produced. Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n// The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all factories must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nEach factory has a maximum production capacity. Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\n// P1 <= 400; P2 <= 350; P3 <= 300",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production. The profit from each factory is determined by a nonlinear function of the amount of chemical produced: Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The total amount of chemical produced across all factories must not exceed 1000 units. Each factory has a maximum production capacity: Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units. Please help the company to maximize the total profit from all three factories.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # amount of chemical produced in factory 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced in factory 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced in factory 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\nmodel.addCons(obj == 50*P1 - 0.1*P1**2 + 60*P2 - 0.2*P2**2 + 70*P3 - 0.3*P3**2)\n\n# Add constraints\n## The total amount of chemical produced across all factories must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n## Each factory has a maximum production capacity. Factory 1 can produce up to 400 units, Factory 2 up to 350 units, and Factory 3 up to 300 units.\nmodel.addCons(P1 <= 400)\nmodel.addCons(P2 <= 350)\nmodel.addCons(P3 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced in factory 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced in factory 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced in factory 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 806,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints.\n// {\"production rate of ChemicalA\": \"ChemicalARate\", \"range\": \"ChemicalARate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalB\": \"ChemicalBRate\", \"range\": \"ChemicalBRate >= 0\", \"type\": \"real\"}\n// {\"production rate of ChemicalC\": \"ChemicalCRate\", \"range\": \"ChemicalCRate >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The company wants to maximize the total profit from the production of these chemicals.\n// Total profit for ChemicalA: Profit_ChemicalA = 50 * ChemicalARate\n// Total profit for ChemicalB: Profit_ChemicalB = 70 * ChemicalBRate\n// Total profit for ChemicalC: Profit_ChemicalC = 90 * ChemicalCRate\n// So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n## Generate Constraint-1:\nThe total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\n// ChemicalARate + ChemicalBRate + ChemicalCRate <= 100\n\n## Generate Constraint-2:\nThe production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\n// ChemicalBRate >= 2 * ChemicalARate\n\n## Generate Constraint-3:\nThe company has a safety constraint that the production rate of ChemicalC must not exceed the sum of the production rates of ChemicalA and ChemicalB.\n// ChemicalCRate <= ChemicalARate + ChemicalBRate\n\n## Generate Constraint-4:\nThe company has a resource constraint that the total cost of production (including raw materials and labor) must not exceed $5000 per hour. The cost per unit of ChemicalA is $20, ChemicalB is $30, and ChemicalC is $40.\n// 20 * ChemicalARate + 30 * ChemicalBRate + 40 * ChemicalCRate <= 5000",
        "question": "A manufacturing company is planning to optimize its production of three different types of chemicals: ChemicalA, ChemicalB, and ChemicalC. They need to determine the optimal production rate for each chemical to maximize profit while adhering to safety and resource constraints. The profit per unit of ChemicalA is $50, ChemicalB is $70, and ChemicalC is $90. The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity. The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand. The company has a safety constraint that the production rate of ChemicalC must not exceed the sum of the production rates of ChemicalA and ChemicalB. The company has a resource constraint that the total cost of production (including raw materials and labor) must not exceed $5000 per hour. The cost per unit of ChemicalA is $20, ChemicalB is $30, and ChemicalC is $40.\n\nPlease help the company to maximize the total profit from the production of these chemicals.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nChemicalARate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalARate\", lb=0) # production rate of ChemicalA\nChemicalBRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalBRate\", lb=0) # production rate of ChemicalB\nChemicalCRate = model.addVar(vtype=\"CONTINUOUS\", name=\"ChemicalCRate\", lb=0) # production rate of ChemicalC\n\n# Define objective function\nProfit_ChemicalA = 50 * ChemicalARate\nProfit_ChemicalB = 70 * ChemicalBRate\nProfit_ChemicalC = 90 * ChemicalCRate\n# So, the objective function is: Maximize (Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_ChemicalA + Profit_ChemicalB + Profit_ChemicalC)\n\n# Add constraints\n# The total production rate of all chemicals must not exceed 100 units per hour due to equipment capacity.\nmodel.addCons(ChemicalARate + ChemicalBRate + ChemicalCRate <= 100)\n# The production of ChemicalB must be at least twice the production of ChemicalA to meet market demand.\nmodel.addCons(ChemicalBRate >= 2 * ChemicalARate)\n# The company has a safety constraint that the production rate of ChemicalC must not exceed the sum of the production rates of ChemicalA and ChemicalB.\nmodel.addCons(ChemicalCRate <= ChemicalARate + ChemicalBRate)\n# The company has a resource constraint that the total cost of production (including raw materials and labor) must not exceed $5000 per hour.\nmodel.addCons(20 * ChemicalARate + 30 * ChemicalBRate + 40 * ChemicalCRate <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Rate of ChemicalA: \", model.getVal(ChemicalARate))\n    print(\"Production Rate of ChemicalB: \", model.getVal(ChemicalBRate))\n    print(\"Production Rate of ChemicalC: \", model.getVal(ChemicalCRate))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1028,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a setup cost of $1000.\nThe profit from product B is $70 per unit, but it requires a setup cost of $1500.\nThe profit from product C is $90 per unit, but it requires a setup cost of $2000.\nThe company wants to maximize its total profit, considering the setup costs.\n// Total profit from product A: Profit_A = 50 * A - 1000\n// Total profit from product B: Profit_B = 70 * B - 1500\n// Total profit from product C: Profit_C = 90 * C - 2000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for setup costs.\n// 1000 * A + 1500 * B + 2000 * C <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities for each product to optimize its profit. The profit per unit and the setup cost for each product are given in the following Table.\n\n| Product | Profit per Unit | Setup Cost |\n|---------|-----------------|------------|\n| A       | $50             | $1000      |\n| B       | $70             | $1500      |\n| C       | $90             | $2000      |\n\nThe company has a budget of $50,000 for setup costs. The total production capacity is limited to 1000 units across all products. Please help the company to maximize its total profit, considering the setup costs.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 50 * A - 1000\nProfit_B = 70 * B - 1500\nProfit_C = 90 * C - 2000\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $50,000 for setup costs.\nmodel.addCons(1000 * A + 1500 * B + 2000 * C <= 50000)\n## The total production capacity is limited to 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 684,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and environmental impact of each device vary.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost of a smartphone is $100, with a profit margin of 20%. The environmental impact per unit is 5 carbon credits.\nThe production cost of a tablet is $200, with a profit margin of 25%. The environmental impact per unit is 8 carbon credits.\nThe production cost of a laptop is $300, with a profit margin of 30%. The environmental impact per unit is 10 carbon credits.\nThe manufacturer wants to maximize the Profit-to-Environmental Impact ratio. (The Profit-to-Environmental Impact ratio is defined as the total profit divided by the total environmental impact.)\n// Total profit: Profit = 20% * 100 * Smartphones + 25% * 200 * Tablets + 30% * 300 * Laptops\n// Total environmental impact: Impact = 5 * Smartphones + 8 * Tablets + 10 * Laptops\n// So, the objective function is: Maximize Profit / Impact\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for production.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000\n\n## Generate Constraint-2:\nThe manufacturer aims to produce at least $20,000 worth of products.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops >= 20000\n\n## Generate Constraint-3:\nThe manufacturer wants to ensure at least 100 units of each device are produced.\n// Smartphones >= 100; Tablets >= 100; Laptops >= 100\n\n## Generate Constraint-4:\nThe manufacturer cannot produce more than 50% of the total production in any one type of device.\n// Smartphones <= 0.5 * (Smartphones + Tablets + Laptops)\n// Tablets <= 0.5 * (Smartphones + Tablets + Laptops)\n// Laptops <= 0.5 * (Smartphones + Tablets + Laptops)",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and environmental impact of each device vary. The manufacturer wants to determine the optimal number of each device to produce. The details of each device are given in the following Table.\n\n| Device     | Production Cost | Profit Margin | Environmental Impact (Carbon Credits) |\n|------------|-----------------|---------------|---------------------------------------|\n| Smartphones| $100            | 20%           | 5                                     |\n| Tablets    | $200            | 25%           | 8                                     |\n| Laptops    | $300            | 30%           | 10                                    |\n\nThe manufacturer has a budget of $50,000 for production. The manufacturer aims to produce at least $20,000 worth of products. The manufacturer wants to ensure at least 100 units of each device are produced. The manufacturer cannot produce more than 50% of the total production in any one type of device. \n\nPlease help the manufacturer to maximize the Profit-to-Environmental Impact ratio (defined as the total profit divided by the total environmental impact).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=100)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=100)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=100)\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 0.2 * 100 * Smartphones + 0.25 * 200 * Tablets + 0.3 * 300 * Laptops\nImpact = 5 * Smartphones + 8 * Tablets + 10 * Laptops\n## the objective function is: Maximize Profit / Impact\n## convert the division to multiplication\nmodel.addCons(obj * Impact == Profit)\n\n# Add constraints\n## The manufacturer has a budget of $50,000 for production.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000)\n## The manufacturer aims to produce at least $20,000 worth of products.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops >= 20000)\n## The manufacturer wants to ensure at least 100 units of each device are produced.\nmodel.addCons(Smartphones >= 100)\nmodel.addCons(Tablets >= 100)\nmodel.addCons(Laptops >= 100)\n## The manufacturer cannot produce more than 50% of the total production in any one type of device.\nmodel.addCons(Smartphones <= 0.5 * (Smartphones + Tablets + Laptops))\nmodel.addCons(Tablets <= 0.5 * (Smartphones + Tablets + Laptops))\nmodel.addCons(Laptops <= 0.5 * (Smartphones + Tablets + Laptops))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit-to-Environmental Impact Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1226,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary.\n// {\"number of smartphones produced\": \"Smartphones\", \"range\": \"Smartphones >= 0\", \"type\": \"integer\"}\n// {\"number of tablets produced\": \"Tablets\", \"range\": \"Tablets >= 0\", \"type\": \"integer\"}\n// {\"number of laptops produced\": \"Laptops\", \"range\": \"Laptops >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production cost for smartphones is $100 each, with a profit margin of 20%. For tablets, the cost is $200 each, with a profit margin of 15%. For laptops, the cost is $300 each, with a profit margin of 10%. The market demand for each device is uncertain, but the manufacturer wants to maximize the total profit while considering the risk of overproduction. The risk is defined as the square of the difference between production and estimated demand.\n// Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n// Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n// So, the objective function is: Maximize Profit - Risk\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for production.\n// 100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000\n\n## Generate Constraint-2:\nThe estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\n// Smartphones <= 200\n// Tablets <= 150\n// Laptops <= 100\n\n## Generate Constraint-3:\nThe manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\n// Smartphones >= 0.5 * 200\n// Tablets >= 0.5 * 150\n// Laptops >= 0.5 * 100\n\n## Generate Constraint-4:\nThe manufacturer wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\n// 100 * Smartphones <= 0.6 * 50000\n// 200 * Tablets <= 0.6 * 50000\n// 300 * Laptops <= 0.6 * 50000",
        "question": "A manufacturer produces three types of electronic devices: smartphones, tablets, and laptops. The production cost, profit margin, and market demand for each device vary. The manufacturer wants to maximize the total profit while considering the risk of overproduction, which is defined as the square of the difference between production and estimated demand. The production cost, profit margin, and estimated demand for each device are given in the following Table.\n\n| Device       | Production Cost | Profit Margin | Estimated Demand |\n|--------------|-----------------|---------------|------------------|\n| Smartphones  | $100            | 20%           | 200 units        |\n| Tablets      | $200            | 15%           | 150 units        |\n| Laptops      | $300            | 10%           | 100 units        |\n\nThe manufacturer has a budget of $50,000 for production. The estimated demand for each device must be met at least 50% by the production. The manufacturer wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\n\nPlease help the manufacturer to maximize the total profit while considering the risk of overproduction.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nSmartphones = model.addVar(vtype=\"INTEGER\", name=\"Smartphones\", lb=0)\nTablets = model.addVar(vtype=\"INTEGER\", name=\"Tablets\", lb=0)\nLaptops = model.addVar(vtype=\"INTEGER\", name=\"Laptops\", lb=0)\n\n# Define objective function\n## Total profit: Profit = 20% * 100 * Smartphones + 15% * 200 * Tablets + 10% * 300 * Laptops\n## Risk: Risk = (Smartphones - Demand_Smartphones)^2 + (Tablets - Demand_Tablets)^2 + (Laptops - Demand_Laptops)^2\n## So, the objective function is: Maximize Profit - Risk\nProfit = 0.2 * 100 * Smartphones + 0.15 * 200 * Tablets + 0.1 * 300 * Laptops\nRisk = (Smartphones - 200)**2 + (Tablets - 150)**2 + (Laptops - 100)**2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit - Risk)\n\n# Add constraints\n## The manufacturer has a budget of $50,000 for production.\nmodel.addCons(100 * Smartphones + 200 * Tablets + 300 * Laptops <= 50000)\n## The estimated demand for smartphones is 200 units, for tablets is 150 units, and for laptops is 100 units.\nmodel.addCons(Smartphones <= 200)\nmodel.addCons(Tablets <= 150)\nmodel.addCons(Laptops <= 100)\n## The manufacturer wants to ensure at least 50% of the estimated demand is met for each device.\nmodel.addCons(Smartphones >= 0.5 * 200)\nmodel.addCons(Tablets >= 0.5 * 150)\nmodel.addCons(Laptops >= 0.5 * 100)\n## The manufacturer wants to diversify production to minimize risk, limiting the production of any single device to 60% of the total production budget.\nmodel.addCons(100 * Smartphones <= 0.6 * 50000)\nmodel.addCons(200 * Tablets <= 0.6 * 50000)\nmodel.addCons(300 * Laptops <= 0.6 * 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(Smartphones))\n    print(\"Number of Tablets: \", model.getVal(Tablets))\n    print(\"Number of Laptops: \", model.getVal(Laptops))\n    print(\"Maximized Profit - Risk: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1208,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to operate the production line for each product type and the level of automation to implement, which affects the production rate.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"integer\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"integer\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product increases with the level of automation. For Product 1, each hour produces 10 units without automation, increasing by 2 units for every unit increase in automation. For Product 2, each hour produces 15 units without automation, increasing by 3 units for every unit increase in automation. For Product 3, each hour produces 20 units without automation, increasing by 4 units for every unit increase in automation. The company aims to maximize the total production of all products.\n// Total production for Product 1: P1 = (10 + 2 * Automation) * H1\n// Total production for Product 2: P2 = (15 + 3 * Automation) * H2\n// Total production for Product 3: P3 = (20 + 4 * Automation) * H3\n// So, the objective function is: Maximize (P1 + P2 + P3)\n\n## Generate Constraint-1:\nThe total hours available for all products in a week is 168 hours.\n// H1 + H2 + H3 <= 168\n\n## Generate Constraint-2:\nThe level of automation must be between 0 and 10 units.\n// 0 <= Automation <= 10\n\n## Generate Constraint-3:\nThe company must produce at least 1000 units of Product 1, 1500 units of Product 2, and 2000 units of Product 3.\n// (10 + 2 * Automation) * H1 >= 1000\n// (15 + 3 * Automation) * H2 >= 1500\n// (20 + 4 * Automation) * H3 >= 2000",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to operate the production line for each product type and the level of automation to implement, which affects the production rate. The production rate for each product increases with the level of automation. For Product 1, each hour produces 10 units without automation, increasing by 2 units for every unit increase in automation. For Product 2, each hour produces 15 units without automation, increasing by 3 units for every unit increase in automation. For Product 3, each hour produces 20 units without automation, increasing by 4 units for every unit increase in automation. The company aims to maximize the total production of all products.\nThe total hours available for all products in a week is 168 hours. The level of automation must be between 0 and 10 units. The company must produce at least 1000 units of Product 1, 1500 units of Product 2, and 2000 units of Product 3.\nPlease help the company determine the optimal number of hours for each product and the level of automation to maximize the total production.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"INTEGER\", name=\"H1\", lb=0) # hours for Product 1\nH2 = model.addVar(vtype=\"INTEGER\", name=\"H2\", lb=0) # hours for Product 2\nH3 = model.addVar(vtype=\"INTEGER\", name=\"H3\", lb=0) # hours for Product 3\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0, ub=10) # level of automation\n\n# Define objective function\nP1 = (10 + 2 * Automation) * H1\nP2 = (15 + 3 * Automation) * H2\nP3 = (20 + 4 * Automation) * H3\n# So, the objective function is: Maximize (P1 + P2 + P3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == P1 + P2 + P3)\n\n# Add constraints\n# The total hours available for all products in a week is 168 hours.\nmodel.addCons(H1 + H2 + H3 <= 168)\n# The company must produce at least 1000 units of Product 1, 1500 units of Product 2, and 2000 units of Product 3.\nmodel.addCons((10 + 2 * Automation) * H1 >= 1000)\nmodel.addCons((15 + 3 * Automation) * H2 >= 1500)\nmodel.addCons((20 + 4 * Automation) * H3 >= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Total Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1159,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component requires different amounts of raw materials and labor. \nFor Component A, the cost of raw materials is $3 per unit, and the labor cost is $2 per unit. \nFor Component B, the cost of raw materials is $4 per unit, and the labor cost is $3 per unit. \nFor Component C, the cost of raw materials is $5 per unit, and the labor cost is $4 per unit.\nThe plant aims to maximize the profit rate, which is defined as the total profit divided by the total cost of production (raw materials plus labor).\n// Profit of A: Profit_A = 10 * A - (3 * A + 2 * A)\n// Profit of B: Profit_B = 15 * B - (4 * B + 3 * B)\n// Profit of C: Profit_C = 20 * C - (5 * C + 4 * C)\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ((3 + 2) * A + (4 + 3) * B + (5 + 4) * C)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 for raw materials.\n// 3 * A + 4 * B + 5 * C <= 1000",
        "question": "A manufacturing plant produces three types of electronic components: A, B, and C. The plant needs to determine the optimal number of each component to produce to maximize efficiency. The cost of raw materials and labor for each component are given in the following Table.\n\n| Component | Raw Material Cost | Labor Cost | Selling Price |\n|-----------|-------------------|------------|---------------|\n| A         | $3                | $2         | $10           |\n| B         | $4                | $3         | $15           |\n| C         | $5                | $4         | $20           |\n\nThe plant aims to maximize the profit rate, which is defined as the total profit divided by the total cost of production (raw materials plus labor). The plant has a budget of $1000 for raw materials.\n\nPlease help the plant determine the optimal number of units of each component to produce to maximize the profit rate.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A - (3 * A + 2 * A)\nProfit_B = 15 * B - (4 * B + 3 * B)\nProfit_C = 20 * C - (5 * C + 4 * C)\nProductionCost = (3 + 2) * A + (4 + 3) * B + (5 + 4) * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ProductionCost\n## convert the division to multiplication\nmodel.addCons(obj * ProductionCost == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The plant has a budget of $1000 for raw materials.\nmodel.addCons(3 * A + 4 * B + 5 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 907,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency.\n// {\"number of Truck A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of Truck B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of Truck C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed.\n// Efficiency_A = 10 * A / 5\n// Efficiency_B = 15 * B / 7\n// Efficiency_C = 20 * C / 9\n// So, the objective function is: Maximize (Efficiency_A + Efficiency_B + Efficiency_C)\n\n## Generate Constraint-1:\nThe company has a total fuel budget of 500 liters per day.\n// 5 * A + 7 * B + 9 * C <= 500\n\n## Generate Constraint-2:\nThe total number of trucks that can be deployed is limited to 50.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe company has a daily cargo requirement of at least 1000 tons.\n// 10 * A + 15 * B + 20 * C >= 1000\n\n## Generate Constraint-4:\nThe number of Truck A cannot exceed 20.\n// A <= 20",
        "question": "A logistics company operates three types of vehicles: Truck A, Truck B, and Truck C. They need to determine the number of each type of truck to deploy for maximizing efficiency. Each Truck A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. Each Truck B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. Each Truck C can carry 20 tons of cargo and consumes 9 liters of fuel per trip. The company wants to maximize the cargo carried per liter of fuel consumed. The company has a total fuel budget of 500 liters per day. The total number of trucks that can be deployed is limited to 50. The company has a daily cargo requirement of at least 1000 tons. The number of Truck A cannot exceed 20. Please help the company to determine the optimal number of each type of truck to deploy.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of Truck A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Truck B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of Truck C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nEfficiency_A = 10 * A / 5\nEfficiency_B = 15 * B / 7\nEfficiency_C = 20 * C / 9\n## convert the division to multiplication\nmodel.addCons(obj * (5 * A + 7 * B + 9 * C) == 10 * A + 15 * B + 20 * C)\n\n# Add constraints\n## The company has a total fuel budget of 500 liters per day.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 500)\n## The total number of trucks that can be deployed is limited to 50.\nmodel.addCons(A + B + C <= 50)\n## The company has a daily cargo requirement of at least 1000 tons.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 1000)\n## The number of Truck A cannot exceed 20.\nmodel.addCons(A <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Truck A: \", model.getVal(A))\n    print(\"Number of Truck B: \", model.getVal(B))\n    print(\"Number of Truck C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 812,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to decide how many units of each machine to produce to optimize their profit.\n// {\"number of units of MachineA\": \"MachineAUnits\", \"range\": \"MachineAUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineB\": \"MachineBUnits\", \"range\": \"MachineBUnits >= 0\", \"type\": \"integer\"}\n// {\"number of units of MachineC\": \"MachineCUnits\", \"range\": \"MachineCUnits >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for MachineA is $500, but it decreases by $10 for each unit produced beyond the first. The profit per unit for MachineB is $700, but it decreases by $15 for each unit produced beyond the first. The profit per unit for MachineC is $900, but it decreases by $20 for each unit produced beyond the first. The company wants to maximize the total profit.\n// Profit for MachineA: Profit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\n// Profit for MachineB: Profit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\n// Profit for MachineC: Profit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\n// So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\n\n## Generate Constraint-1:\nThe company has a total production capacity of 50 units for all machines combined.\n// MachineAUnits + MachineBUnits + MachineCUnits <= 50\n\n## Generate Constraint-2:\nDue to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\n// MachineBUnits <= 2 * MachineAUnits\n\n## Generate Constraint-3:\nThe company has a budget of $20,000 for production costs. The cost per unit for MachineA is $100, for MachineB is $150, and for MachineC is $200.\n// 100 * MachineAUnits + 150 * MachineBUnits + 200 * MachineCUnits <= 20,000",
        "question": "A manufacturing company is producing three types of machines: MachineA, MachineB, and MachineC. They need to decide how many units of each machine to produce to optimize their profit. The profit per unit for each machine decreases as more units are produced beyond the first unit. The profit per unit for MachineA starts at $500 and decreases by $10 for each additional unit, for MachineB starts at $700 and decreases by $15 for each additional unit, and for MachineC starts at $900 and decreases by $20 for each additional unit. The company wants to maximize the total profit.\n\n| Machine | Profit per Unit (first unit) | Decrease per Additional Unit |\n|---------|------------------------------|------------------------------|\n| MachineA | $500                         | $10                          |\n| MachineB | $700                         | $15                          |\n| MachineC | $900                         | $20                          |\n\nThe company has a total production capacity of 50 units for all machines combined. Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA. The company has a budget of $20,000 for production costs, with the cost per unit for MachineA being $100, for MachineB being $150, and for MachineC being $200.\n\nPlease help the company determine the optimal number of units to produce for each machine to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMachineAUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineAUnits\", lb=0) # number of units of MachineA\nMachineBUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineBUnits\", lb=0) # number of units of MachineB\nMachineCUnits = model.addVar(vtype=\"INTEGER\", name=\"MachineCUnits\", lb=0) # number of units of MachineC\n\n# Define objective function\n## Profit for MachineA: Profit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\n## Profit for MachineB: Profit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\n## Profit for MachineC: Profit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\n## So, the objective function is: Maximize Profit_MachineA + Profit_MachineB + Profit_MachineC\nProfit_MachineA = (500 - 10 * (MachineAUnits - 1)) * MachineAUnits\nProfit_MachineB = (700 - 15 * (MachineBUnits - 1)) * MachineBUnits\nProfit_MachineC = (900 - 20 * (MachineCUnits - 1)) * MachineCUnits\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_MachineA + Profit_MachineB + Profit_MachineC)\n\n# Add constraints\n## The company has a total production capacity of 50 units for all machines combined.\nmodel.addCons(MachineAUnits + MachineBUnits + MachineCUnits <= 50)\n## Due to resource limitations, the production of MachineB cannot exceed twice the production of MachineA.\nmodel.addCons(MachineBUnits <= 2 * MachineAUnits)\n## The company has a budget of $20,000 for production costs.\nmodel.addCons(100 * MachineAUnits + 150 * MachineBUnits + 200 * MachineCUnits <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of MachineA Units: \", model.getVal(MachineAUnits))\n    print(\"Number of MachineB Units: \", model.getVal(MachineBUnits))\n    print(\"Number of MachineC Units: \", model.getVal(MachineCUnits))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1422,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs.\n// {\"quantity of Product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nProduct A generates a revenue of $100 per unit and requires 2 labor hours per unit, while Product B generates a revenue of $150 per unit and requires 3 labor hours per unit. The labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company aims to maximize the total profit from both products.\n// Profit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\n// Profit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\n// So, the objective function is: Maximize (Profit_A + Profit_B)\n\n## Generate Constraint-1:\nThe company has a total of 200 labor hours available for the month.\n// 2 * A + 3 * B <= 200\n\n## Generate Constraint-2:\nThe total investment in automation technology cannot exceed $50,000.\n// Automation <= 50000",
        "question": "A manufacturer produces two types of products, A and B, which require different amounts of raw materials and labor hours. The company needs to determine the production quantities of both products and the investment in automation technology to reduce labor costs. The revenue and labor requirements for each product are given in the following Table.\n\n| Product | Revenue per Unit | Labor Hours per Unit |\n|---------|------------------|----------------------|\n| A       | $100             | 2                    |\n| B       | $150             | 3                    |\n\nThe labor cost per hour is $20, but for every $10,000 invested in automation, the labor cost per hour decreases by $1. The company has a total of 200 labor hours available for the month. The total investment in automation technology cannot exceed $50,000. \n\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # quantity of Product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # quantity of Product B\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate profit for each product\nProfit_A = 100 * A - 2 * (20 - 0.0001 * Automation) * A\nProfit_B = 150 * B - 3 * (20 - 0.0001 * Automation) * B\n## the objective function is: Maximize (Profit_A + Profit_B)\nmodel.addCons(obj == Profit_A + Profit_B)\n\n# Add constraints\n## The company has a total of 200 labor hours available for the month.\nmodel.addCons(2 * A + 3 * B <= 200)\n## The total investment in automation technology cannot exceed $50,000.\nmodel.addCons(Automation <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit.\n// {\"quantity of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"integer\"}\n// {\"quantity of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor C1, the revenue per unit is $100, the production cost per unit is $50, and the storage cost per unit is $10. \nFor C2, the revenue per unit is $120, the production cost per unit is $60, and the storage cost per unit is $15. \nFor C3, the revenue per unit is $150, the production cost per unit is $70, and the storage cost per unit is $20.\nThe company wants to maximize the net profit per unit stored.\n// NetProfit_C1 = (100 - 50 - 10) * C1\n// NetProfit_C2 = (120 - 60 - 15) * C2\n// NetProfit_C3 = (150 - 70 - 20) * C3\n// So, the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / (10 * C1 + 15 * C2 + 20 * C3)\n\n## Generate Constraint-1:\nThe company has a production capacity of 200 units in total.\n// C1 + C2 + C3 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for production costs.\n// 50 * C1 + 60 * C2 + 70 * C3 <= 10,000\n\n## Generate Constraint-3:\nThe storage space is limited to 150 units.\n// 10 * C1 + 15 * C2 + 20 * C3 <= 150\n\n## Generate Constraint-4:\nThe market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\n// C1 <= 50\n\n## Generate Constraint-5:\nThe company must produce at least 20 units of C2 to fulfill a contract.\n// C2 >= 20",
        "question": "A manufacturing company produces three types of chemicals: C1, C2, and C3. They need to determine the production quantities of each chemical to optimize their profit. The revenue per unit, production cost per unit, and storage cost per unit for each chemical are given in the following Table.\n\n| Chemical | Revenue per Unit | Production Cost per Unit | Storage Cost per Unit |\n|----------|------------------|--------------------------|-----------------------|\n| C1       | $100             | $50                      | $10                   |\n| C2       | $120             | $60                      | $15                   |\n| C3       | $150             | $70                      | $20                   |\n\nThe company has a production capacity of 200 units in total. The company has a budget of $10,000 for production costs. The storage space is limited to 150 units. The market demand for C1 is 50 units, so the company can only sell a maximum of 50 units of C1. The company must produce at least 20 units of C2 to fulfill a contract.\n\nPlease help the company to maximize the net profit per unit stored, which is defined as the sum of the net profits of each chemical divided by the sum of the storage costs of each chemical.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=50)  # quantity of C1\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=20)  # quantity of C2\nC3 = model.addVar(vtype=\"INTEGER\", name=\"C3\", lb=0)  # quantity of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNetProfit_C1 = (100 - 50 - 10) * C1\nNetProfit_C2 = (120 - 60 - 15) * C2\nNetProfit_C3 = (150 - 70 - 20) * C3\nStorageCost = 10 * C1 + 15 * C2 + 20 * C3\n## the objective function is: Maximize (NetProfit_C1 + NetProfit_C2 + NetProfit_C3) / StorageCost\n## convert the division to multiplication\nmodel.addCons(obj * StorageCost == NetProfit_C1 + NetProfit_C2 + NetProfit_C3)\n\n# Add constraints\n## The company has a production capacity of 200 units in total.\nmodel.addCons(C1 + C2 + C3 <= 200)\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(50 * C1 + 60 * C2 + 70 * C3 <= 10000)\n## The storage space is limited to 150 units.\nmodel.addCons(10 * C1 + 15 * C2 + 20 * C3 <= 150)\n## The market demand for C1 is 50 units. So, the company can only sell a maximum of 50 units of C1.\nmodel.addCons(C1 <= 50)\n## The company must produce at least 20 units of C2 to fulfill a contract.\nmodel.addCons(C2 >= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of C1: \", model.getVal(C1))\n    print(\"Quantity of C2: \", model.getVal(C2))\n    print(\"Quantity of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Unit Stored: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1230,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit.\n// {\"raw materials for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for machine 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"production rate adjustment for machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine contributes differently to the profit based on the raw materials and labor hours allocated. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines.\n// The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\n\n## Generate Constraint-1:\nThe total budget for raw materials and labor hours is $5000.\n// 100 * M1 + 150 * L2 + 500 * P3^2 <= 5000\n\n## Generate Constraint-2:\nThe maximum capacity for raw materials on Machine 1 is 30 units.\n// M1 <= 30\n\n## Generate Constraint-3:\nThe maximum labor hours available for Machine 2 is 20 hours.\n// L2 <= 20",
        "question": "A manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit. The profit generated by each machine is as follows: Machine 1 generates a profit of $100 per unit of raw material used, Machine 2 generates a profit of $150 per labor hour, and Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines.\n\n| Machine | Profit per Unit | Resource Type |\n|---------|-----------------|---------------|\n| 1       | $100            | Raw Materials |\n| 2       | $150            | Labor Hours   |\n| 3       | $500 * P3^2     | Production Rate Adjustment |\n\nThe total budget for raw materials and labor hours is $5000. The maximum capacity for raw materials on Machine 1 is 30 units, and the maximum labor hours available for Machine 2 is 20 hours.\n\nPlease help the company determine the optimal allocation of resources to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0)  # raw materials for machine 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0)  # labor hours for machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0)  # production rate adjustment for machine 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\nmodel.addCons(obj == 100 * M1 + 150 * L2 + 500 * P3**2)\n\n# Add constraints\n## The total budget for raw materials and labor hours is $5000.\nmodel.addCons(100 * M1 + 150 * L2 + 500 * P3**2 <= 5000)\n## The maximum capacity for raw materials on Machine 1 is 30 units.\nmodel.addCons(M1 <= 30)\n## The maximum labor hours available for Machine 2 is 20 hours.\nmodel.addCons(L2 <= 20)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for Machine 1: \", model.getVal(M1))\n    print(\"Labor hours for Machine 2: \", model.getVal(L2))\n    print(\"Production rate adjustment for Machine 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1091,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability.\n// {\"number of acres for Wheat\": \"WheatAcres\", \"range\": \"WheatAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Corn\": \"CornAcres\", \"range\": \"CornAcres >= 0\", \"type\": \"integer\"}\n// {\"number of acres for Soybeans\": \"SoybeansAcres\", \"range\": \"SoybeansAcres >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost.\n// Financial profit: Profit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\n// Environmental cost: Cost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\n// So, the objective function is: Maximize (Profit - Cost) / (WheatAcres + CornAcres + SoybeansAcres)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for planting.\n// WheatAcres + CornAcres + SoybeansAcres <= 100\n\n## Generate Constraint-2:\nDue to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\n// SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres)",
        "question": "A farmer is planning to plant three types of crops: Wheat, Corn, and Soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and sustainability. The profit per acre for Wheat is $200, for Corn is $300, and for Soybeans is $250. The farmer also considers the environmental impact, where Wheat has a cost of $50 per acre, Corn has a cost of $70 per acre, and Soybeans has a cost of $60 per acre. The farmer wants to maximize the net profit per acre, considering both financial profit and environmental cost. The farmer has a total of 100 acres available for planting. Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans. Please help the farmer to maximize the net profit per acre, considering both financial profit and environmental cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nWheatAcres = model.addVar(vtype=\"INTEGER\", name=\"WheatAcres\", lb=0) # number of acres for Wheat\nCornAcres = model.addVar(vtype=\"INTEGER\", name=\"CornAcres\", lb=0) # number of acres for Corn\nSoybeansAcres = model.addVar(vtype=\"INTEGER\", name=\"SoybeansAcres\", lb=0) # number of acres for Soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 200 * WheatAcres + 300 * CornAcres + 250 * SoybeansAcres\nCost = 50 * WheatAcres + 70 * CornAcres + 60 * SoybeansAcres\nTotalAcres = WheatAcres + CornAcres + SoybeansAcres\n## the objective function is: Maximize (Profit - Cost) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit - Cost)\n\n# Add constraints\n## The farmer has a total of 100 acres available for planting.\nmodel.addCons(WheatAcres + CornAcres + SoybeansAcres <= 100)\n## Due to soil conditions, the farmer must plant at least 20% of the total acres in Soybeans.\nmodel.addCons(SoybeansAcres >= 0.20 * (WheatAcres + CornAcres + SoybeansAcres))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Wheat: \", model.getVal(WheatAcres))\n    print(\"Number of Acres for Corn: \", model.getVal(CornAcres))\n    print(\"Number of Acres for Soybeans: \", model.getVal(SoybeansAcres))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 832,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products, A and B. The company needs to decide the production quantity of each product and the amount of investment in a new technology that can improve the production efficiency of both products.\n// {\"production quantity of Product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechnologyInvestment\", \"range\": \"TechnologyInvestment >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe new technology reduces the production cost per unit of both products by $5 for every $10,000 invested. The initial production cost per unit for Product A is $100 and for Product B is $150. The selling price per unit for Product A is $150 and for Product B is $200. The company aims to maximize the total profit from both products.\n// Total profit for Product A: ProfitA = (150 - 100 + 0.0005 * TechnologyInvestment) * ProductA\n// Total profit for Product B: ProfitB = (200 - 150 + 0.0005 * TechnologyInvestment) * ProductB\n// So, the objective function is: Maximize Profit = ProfitA + ProfitB\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units for both products combined.\n// ProductA + ProductB <= 1000\n\n## Generate Constraint-2:\nThe total investment in the new technology cannot exceed $50,000.\n// TechnologyInvestment <= 50000",
        "question": "A manufacturing company produces two types of products, A and B, and is considering investing in a new technology to improve the production efficiency of both products. The company needs to decide the production quantity of each product and the amount of investment in this new technology. The initial production cost per unit for Product A is $100 and for Product B is $150, while the selling price per unit for Product A is $150 and for Product B is $200. The new technology reduces the production cost per unit of both products by $5 for every $10,000 invested.\n\n| Product | Initial Production Cost | Selling Price | Reduction in Cost per $10,000 Investment |\n|---------|-------------------------|---------------|-----------------------------------------|\n| A       | $100                    | $150          | $5                                      |\n| B       | $150                    | $200          | $5                                      |\n\nThe company has a total production capacity of 1000 units for both products combined. The total investment in the new technology cannot exceed $50,000.\n\nPlease help the company to maximize the total profit from both products by determining the optimal production quantities of Product A and Product B, and the appropriate investment in the new technology.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=0) # production quantity of Product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # production quantity of Product B\nTechnologyInvestment = model.addVar(vtype=\"CONTINUOUS\", name=\"TechnologyInvestment\", lb=0) # investment in new technology\n\n# Define objective function\nProfitA = (150 - 100 + 0.0005 * TechnologyInvestment) * ProductA\nProfitB = (200 - 150 + 0.0005 * TechnologyInvestment) * ProductB\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == ProfitA + ProfitB)\n\n# Add constraints\nmodel.addCons(ProductA + ProductB <= 1000)\nmodel.addCons(TechnologyInvestment <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Production Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Investment in New Technology: \", model.getVal(TechnologyInvestment))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1307,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"land allocated to wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"land allocated to corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"land allocated to soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profitability of each crop varies with the amount of land allocated due to economies of scale and varying market prices. The profit from wheat is modeled as 50W - 0.1W^2, from corn as 70C - 0.2C^2, and from soybeans as 60S - 0.15S^2. The farmer aims to maximize the total profit from all crops.\n// Objective function: Maximize P = (50W - 0.1W^2) + (70C - 0.2C^2) + (60S - 0.15S^2)\n\n## Generate Constraint-1:\nThe total land available for farming is 100 acres.\n// W + C + S <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how much land to allocate to each crop to optimize the farm's profitability and resource usage. The profitability of each crop varies with the amount of land allocated due to economies of scale and varying market prices. The profit from wheat is modeled as 50W - 0.1W^2, from corn as 70C - 0.2C^2, and from soybeans as 60S - 0.15S^2. The farmer aims to maximize the total profit from all crops. The total land available for farming is 100 acres. Please help the farmer determine the optimal allocation of land to each crop.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # land allocated to wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to corn\nS = model.addVar(vtype=\"CONTINUOUS\", name=\"S\", lb=0) # land allocated to soybeans\n\n# Define objective function\n## The profit from wheat is modeled as 50W - 0.1W^2\n## The profit from corn is modeled as 70C - 0.2C^2\n## The profit from soybeans is modeled as 60S - 0.15S^2\n## Objective function: Maximize P = (50W - 0.1W^2) + (70C - 0.2C^2) + (60S - 0.15S^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50*W - 0.1*W**2 + 70*C - 0.2*C**2 + 60*S - 0.15*S**2)\n\n# Add constraints\n## The total land available for farming is 100 acres.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Wheat: \", model.getVal(W))\n    print(\"Land allocated to Corn: \", model.getVal(C))\n    print(\"Land allocated to Soybeans: \", model.getVal(S))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 614,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products. The company needs to determine the production rate of each product, as well as the amount of money invested in improving the production efficiency of each product.\n// {\"production rate of product 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"production rate of product 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"integer\"}\n// {\"investment in efficiency for product 1\": \"E1\", \"range\": \"E1 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 2\": \"E2\", \"range\": \"E2 >= 0\", \"type\": \"continuous\"}\n// {\"investment in efficiency for product 3\": \"E3\", \"range\": \"E3 >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5. The company aims to minimize the total production cost while meeting a certain demand.\n// Cost per unit of product 1: C1 = 100 - 0.005 * E1\n// Cost per unit of product 2: C2 = 150 - 0.005 * E2\n// Cost per unit of product 3: C3 = 200 - 0.005 * E3\n// Total production cost: Cost = C1 * P1 + C2 * P2 + C3 * P3\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe company must meet a total demand of at least 1000 units across all products.\n// P1 + P2 + P3 >= 1000\n\n## Generate Constraint-2:\nThe total investment in efficiency improvements cannot exceed $50,000.\n// E1 + E2 + E3 <= 50000",
        "question": "A manufacturing company produces three types of products. The company needs to determine the production rate of each product (P1, P2, P3) and the amount of money invested in improving the production efficiency of each product (E1, E2, E3). The cost of producing each unit of product 1, 2, and 3 is $100, $150, and $200 respectively. For every $1000 invested in efficiency improvements, the cost per unit decreases by $5.\n\nThe company aims to minimize the total production cost while meeting a certain demand. The company must meet a total demand of at least 1000 units across all products. The total investment in efficiency improvements cannot exceed $50,000.\n\nPlease help the company to determine the optimal production rates and investments in efficiency to minimize the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # production rate of product 1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # production rate of product 2\nP3 = model.addVar(vtype=\"INTEGER\", name=\"P3\", lb=0) # production rate of product 3\nE1 = model.addVar(vtype=\"CONTINUOUS\", name=\"E1\", lb=0) # investment in efficiency for product 1\nE2 = model.addVar(vtype=\"CONTINUOUS\", name=\"E2\", lb=0) # investment in efficiency for product 2\nE3 = model.addVar(vtype=\"CONTINUOUS\", name=\"E3\", lb=0) # investment in efficiency for product 3\n\n# Define objective function\nC1 = 100 - 0.005 * E1\nC2 = 150 - 0.005 * E2\nC3 = 200 - 0.005 * E3\nCost = C1 * P1 + C2 * P2 + C3 * P3\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\nmodel.addCons(P1 + P2 + P3 >= 1000)\nmodel.addCons(E1 + E2 + E3 <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production rate of product 1: \", model.getVal(P1))\n    print(\"Production rate of product 2: \", model.getVal(P2))\n    print(\"Production rate of product 3: \", model.getVal(P3))\n    print(\"Investment in efficiency for product 1: \", model.getVal(E1))\n    print(\"Investment in efficiency for product 2: \", model.getVal(E2))\n    print(\"Investment in efficiency for product 3: \", model.getVal(E3))\n    print(\"Minimized Total Production Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 796,
        "var_num": 6,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project.\n// {\"number of units of CondoX\": \"CondoX\", \"range\": \"CondoX >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoY\": \"CondoY\", \"range\": \"CondoY >= 0\", \"type\": \"integer\"}\n// {\"number of units of CondoZ\": \"CondoZ\", \"range\": \"CondoZ >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor CondoX, the selling price is $200,000, the construction cost is $120,000, and the construction time is 3 months. \nFor CondoY, the selling price is $250,000, the construction cost is $150,000, and the construction time is 4 months. \nFor CondoZ, the selling price is $300,000, the construction cost is $180,000, and the construction time is 5 months.\nThe developer aims to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).\n// Selling profit of CondoX: Profit_CondoX = (200,000 - 120,000) * CondoX\n// Selling profit of CondoY: Profit_CondoY = (250,000 - 150,000) * CondoY\n// Selling profit of CondoZ: Profit_CondoZ = (300,000 - 180,000) * CondoZ\n// So, the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / (3 * CondoX + 4 * CondoY + 5 * CondoZ)\n\n## Generate Constraint-1:\nThe developer has a budget of $10,000,000 for construction costs for the project.\n// 120,000 * CondoX + 150,000 * CondoY + 180,000 * CondoZ <= 10,000,000\n\n## Generate Constraint-2:\nThe developer wants to ensure that at least 50 units of each type of condo are built.\n// CondoX >= 50; CondoY >= 50; CondoZ >= 50\n\n## Generate Constraint-3:\nThe developer has a maximum construction time of 200 months for the entire project.\n// 3 * CondoX + 4 * CondoY + 5 * CondoZ <= 200",
        "question": "A real estate developer is planning to build three types of residential properties: CondoX, CondoY, and CondoZ. The developer needs to determine how many units of each type of condo to build in the next project. The selling price, construction cost, and construction time for each condo type are given in the following Table.\n\n| Condo Type | Selling Price | Construction Cost | Construction Time |\n|------------|---------------|-------------------|-------------------|\n| CondoX     | $200,000      | $120,000          | 3 months          |\n| CondoY     | $250,000      | $150,000          | 4 months          |\n| CondoZ     | $300,000      | $180,000          | 5 months          |\n\nThe developer has a budget of $10,000,000 for construction costs for the project. The developer wants to ensure that at least 50 units of each type of condo are built. The developer has a maximum construction time of 200 months for the entire project. \nPlease help the developer to maximize the rate at which it earns profits (which is defined as the sum of the selling profit divided by the sum of the construction times).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The developer wants to ensure that at least 50 units of each type of condo are built.\nCondoX = model.addVar(vtype=\"INTEGER\", name=\"CondoX\", lb=50) # number of units of CondoX\nCondoY = model.addVar(vtype=\"INTEGER\", name=\"CondoY\", lb=50) # number of units of CondoY\nCondoZ = model.addVar(vtype=\"INTEGER\", name=\"CondoZ\", lb=50) # number of units of CondoZ\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_CondoX = (200000 - 120000) * CondoX\nProfit_CondoY = (250000 - 150000) * CondoY\nProfit_CondoZ = (300000 - 180000) * CondoZ\nConstructionTime = 3 * CondoX + 4 * CondoY + 5 * CondoZ\n## the objective function is: Maximize (Profit_CondoX + Profit_CondoY + Profit_CondoZ) / ConstructionTime\n## convert the division to multiplication\nmodel.addCons(obj * ConstructionTime == Profit_CondoX + Profit_CondoY + Profit_CondoZ)\n\n# Add constraints\n## The developer has a budget of $10,000,000 for construction costs for the project.\nmodel.addCons(120000 * CondoX + 150000 * CondoY + 180000 * CondoZ <= 10000000)\n## The developer has a maximum construction time of 200 months for the entire project.\nmodel.addCons(3 * CondoX + 4 * CondoY + 5 * CondoZ <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of CondoX: \", model.getVal(CondoX))\n    print(\"Number of CondoY: \", model.getVal(CondoY))\n    print(\"Number of CondoZ: \", model.getVal(CondoZ))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1106,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different and depends on the market demand and production costs. The details are given in the following Table.\n\n| Product | Profit per Hour |\n|---------|-----------------|\n| A       | $50             |\n| B       | $70             |\n| C       | $60             |\n\nThe company has a total of 8 hours available for production in a day. Please help the company to maximize the total profit from all three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=0) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 642,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"investment in new production technology\": \"Technology\", \"range\": \"Technology >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n// Total cost for product A: Cost_A = (50 - 0.0002 * Technology) * A\n// Total cost for product B: Cost_B = (70 - 0.0002 * Technology) * B\n// Total cost for product C: Cost_C = (60 - 0.0002 * Technology) * C\n// Total revenue for product A: Revenue_A = 100 * A\n// Total revenue for product B: Revenue_B = 120 * B\n// Total revenue for product C: Revenue_C = 110 * C\n// Total profit: Profit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $50,000 for investing in the new production technology.\n// Technology <= 50000\n\n## Generate Constraint-2:\nThe total production capacity is limited to 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturer is producing three types of products (A, B, and C) and needs to decide the production quantities for each product. Additionally, the manufacturer is considering investing in a new production technology that can reduce the production cost per unit. The production cost per unit for product A is $50, for product B is $70, and for product C is $60. The new production technology reduces the production cost per unit by $2 for every $10,000 invested. The selling price per unit for product A is $100, for product B is $120, and for product C is $110. The manufacturer aims to maximize the total profit from all products.\n\n| Product | Production Cost per Unit | Selling Price per Unit |\n|---------|--------------------------|------------------------|\n| A       | $50                      | $100                   |\n| B       | $70                      | $120                   |\n| C       | $60                      | $110                   |\n\nThe manufacturer has a budget of $50,000 for investing in the new production technology. The total production capacity is limited to 1000 units across all products. Please help the manufacturer determine the optimal production quantities for products A, B, and C, and the investment in the new production technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\nTechnology = model.addVar(vtype=\"CONTINUOUS\", name=\"Technology\", lb=0) # investment in new production technology\n\n# Define objective function\nCost_A = (50 - 0.0002 * Technology) * A\nCost_B = (70 - 0.0002 * Technology) * B\nCost_C = (60 - 0.0002 * Technology) * C\nRevenue_A = 100 * A\nRevenue_B = 120 * B\nRevenue_C = 110 * C\nProfit = (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Technology <= 50000)\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Investment in New Technology: \", model.getVal(Technology))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1300,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit.\n// {\"hours allocated to product A\": \"H_A\", \"range\": \"H_A >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product B\": \"H_B\", \"range\": \"H_B >= 0\", \"type\": \"real\"}\n// {\"hours allocated to product C\": \"H_C\", \"range\": \"H_C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per hour for each product is different and depends on the market demand and production costs. For product A, the profit is $50 per hour; for product B, it's $70 per hour; and for product C, it's $60 per hour. The company wants to maximize the total profit from all three products.\n// The objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\n\n## Generate Constraint-1:\nThe total available hours for production in a day is 8 hours.\n// H_A + H_B + H_C <= 8\n\n## Generate Constraint-2:\nThe production of product A requires at least 1 hour per day due to contractual obligations.\n// H_A >= 1\n\n## Generate Constraint-3:\nThe production of product B cannot exceed 3 hours per day due to limited raw materials.\n// H_B <= 3",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the number of hours to allocate to each product on their production line to maximize profit. The profit per hour for each product is different: $50 per hour for product A, $70 per hour for product B, and $60 per hour for product C. The company has a total of 8 hours available for production in a day. Due to contractual obligations, at least 1 hour must be allocated to product A each day. Additionally, due to limited raw materials, the production of product B cannot exceed 3 hours per day. Please help the company maximize the total profit from all three products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH_A = model.addVar(vtype=\"CONTINUOUS\", name=\"H_A\", lb=0) # hours allocated to product A\nH_B = model.addVar(vtype=\"CONTINUOUS\", name=\"H_B\", lb=0) # hours allocated to product B\nH_C = model.addVar(vtype=\"CONTINUOUS\", name=\"H_C\", lb=0) # hours allocated to product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize P = 50 * H_A + 70 * H_B + 60 * H_C\nmodel.addCons(obj == 50 * H_A + 70 * H_B + 60 * H_C)\n\n# Add constraints\n## The total available hours for production in a day is 8 hours.\nmodel.addCons(H_A + H_B + H_C <= 8)\n## The production of product A requires at least 1 hour per day due to contractual obligations.\nmodel.addCons(H_A >= 1)\n## The production of product B cannot exceed 3 hours per day due to limited raw materials.\nmodel.addCons(H_B <= 3)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours allocated to Product A: \", model.getVal(H_A))\n    print(\"Hours allocated to Product B: \", model.getVal(H_B))\n    print(\"Hours allocated to Product C: \", model.getVal(H_C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 667,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit.\n// {\"number of pastries A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of pastries B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of pastries C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. \nEach pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. \nEach pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake.\nThe bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time.\n// Profit from A: Profit_A = (2 - 0.5) * A\n// Profit from B: Profit_B = (3 - 1) * B\n// Profit from C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (15 * A + 20 * B + 25 * C)\n\n## Generate Constraint-1:\nThe bakery has a daily budget of $100 for ingredients.\n// 0.5 * A + 1 * B + 1.5 * C <= 100\n\n## Generate Constraint-2:\nThe bakery wants to ensure it bakes at least 50 pastries of each type daily.\n// A >= 50; B >= 50; C >= 50",
        "question": "A bakery produces three types of pastries: A, B, and C. The bakery needs to determine the number of each pastry to bake daily to optimize its profit. Each pastry A sells for $2, costs $0.5 to make, and takes 15 minutes to bake. Each pastry B sells for $3, costs $1 to make, and takes 20 minutes to bake. Each pastry C sells for $4, costs $1.5 to make, and takes 25 minutes to bake. The bakery aims to maximize its profit rate, which is defined as the total profit divided by the total baking time. The bakery has a daily budget of $100 for ingredients. The bakery wants to ensure it bakes at least 50 pastries of each type daily. Please help the bakery to maximize its profit rate.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The bakery wants to ensure it bakes at least 50 pastries of each type daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of pastries A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of pastries B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of pastries C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nBakingTime = 15 * A + 20 * B + 25 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / BakingTime\n## convert the division to multiplication\nmodel.addCons(obj * BakingTime == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The bakery has a daily budget of $100 for ingredients.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Pastry A: \", model.getVal(A))\n    print(\"Number of Pastry B: \", model.getVal(B))\n    print(\"Number of Pastry C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 681,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products.\n// {\"production quantity of product A\": \"PA\", \"range\": \"PA >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"PB\", \"range\": \"PB >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"PC\", \"range\": \"PC >= 0\", \"type\": \"integer\"}\n// {\"investment in new technology\": \"TechInvest\", \"range\": \"TechInvest >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n// Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in the new technology.\n// TechInvest <= 100000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product and the amount of money to invest in a new technology that enhances the production efficiency of all products. The profit from each unit of product A is $100, product B is $150, and product C is $200. The new technology reduces the production cost by $5 for each unit of product A, $7 for each unit of product B, and $10 for each unit of product C for every $10,000 invested. The company aims to maximize the total profit.\n\n| Product | Profit per Unit | Technology Cost Reduction per Unit |\n|---------|-----------------|------------------------------------|\n| A       | $100            | $5 for every $10,000 invested     |\n| B       | $150            | $7 for every $10,000 invested     |\n| C       | $200            | $10 for every $10,000 invested    |\n\nThe company has a budget of $100,000 for investment in the new technology. Please help the company determine the optimal production quantities for products A, B, and C, and the amount to invest in the new technology to maximize the total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nPA = model.addVar(vtype=\"INTEGER\", name=\"PA\", lb=0) # production quantity of product A\nPB = model.addVar(vtype=\"INTEGER\", name=\"PB\", lb=0) # production quantity of product B\nPC = model.addVar(vtype=\"INTEGER\", name=\"PC\", lb=0) # production quantity of product C\nTechInvest = model.addVar(vtype=\"CONTINUOUS\", name=\"TechInvest\", lb=0) # investment in new technology\n\n# Define objective function\n## Total profit: Profit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\nProfit = (100 - 0.0005 * TechInvest) * PA + (150 - 0.0007 * TechInvest) * PB + (200 - 0.001 * TechInvest) * PC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in the new technology.\nmodel.addCons(TechInvest <= 100000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(PA))\n    print(\"Production Quantity of Product B: \", model.getVal(PB))\n    print(\"Production Quantity of Product C: \", model.getVal(PC))\n    print(\"Investment in New Technology: \", model.getVal(TechInvest))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1143,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $20, and product C is $30. The plant aims to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost.\n// Profit of A: Profit_A = (20 - 10) * A = 10 * A\n// Profit of B: Profit_B = (30 - 20) * B = 10 * B\n// Profit of C: Profit_C = (40 - 30) * C = 10 * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 20 * B + 30 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 5000",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations. The profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $20, and product C is $30. The plant aims to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost. The plant has a budget of $5000 for production costs.\nPlease help the plant to determine the optimal production quantities for products A, B, and C to maximize the ratio of total profit to the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 10 * B\nProfit_C = 10 * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 5000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit.\n// Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n// Profit from product B: Profit_B = 70 * B - 5 * B\n// Profit from product C: Profit_C = 100 * C - 1000\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a total production capacity of 1000 units across all products.\n// A + B + C <= 1000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to optimize its profit. The profit from product A is $50 per unit, but it requires a maintenance cost that increases quadratically with the number of units produced. The profit from product B is $70 per unit, and its maintenance cost is linear with the number of units produced. The profit from product C is $100 per unit, but it has a fixed maintenance cost. The company aims to maximize its total profit. The company has a total production capacity of 1000 units across all products. Please help the company determine the optimal production quantities for products A, B, and C.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # production quantity of product C\n\n# Define objective function\n## Profit from product A: Profit_A = 50 * A - 0.1 * A^2\n## Profit from product B: Profit_B = 70 * B - 5 * B\n## Profit from product C: Profit_C = 100 * C - 1000\nProfit_A = 50 * A - 0.1 * A**2\nProfit_B = 70 * B - 5 * B\nProfit_C = 100 * C - 1000\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a total production capacity of 1000 units across all products.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 720,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, the selling price is $100 per ton, and the water cost is $20 per ton. \nFor Crop B, the yield per acre is 7 tons, the selling price is $120 per ton, and the water cost is $25 per ton. \nFor Crop C, the yield per acre is 9 tons, the selling price is $150 per ton, and the water cost is $30 per ton.\nThe farm has limited water resources and aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost).\n// Revenue of A: Revenue_A = 5 * A * (100 - 20)\n// Revenue of B: Revenue_B = 7 * B * (120 - 25)\n// Revenue of C: Revenue_C = 9 * C * (150 - 30)\n// Water cost of A: Water_cost_A = 5 * A * 20\n// Water cost of B: Water_cost_B = 7 * B * 25\n// Water cost of C: Water_cost_C = 9 * C * 30\n// So, the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop. The yield per acre, selling price, and water cost for each crop are given in the following Table.\n\n| Crop | Yield per Acre | Selling Price per Ton | Water Cost per Ton |\n|------|----------------|-----------------------|--------------------|\n| A    | 5 tons         | $100                  | $20                |\n| B    | 7 tons         | $120                  | $25                |\n| C    | 9 tons         | $150                  | $30                |\n\nThe farm has a total of 100 acres available for cultivation. The farm aims to maximize the net revenue per unit of water used (which is defined as the total revenue minus the total water cost, divided by the total water cost). Please help the farmer determine the optimal allocation of acres to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nRevenue_A = 5 * A * (100 - 20)\nRevenue_B = 7 * B * (120 - 25)\nRevenue_C = 9 * C * (150 - 30)\nWater_cost_A = 5 * A * 20\nWater_cost_B = 7 * B * 25\nWater_cost_C = 9 * C * 30\n## the objective function is: Maximize (Revenue_A + Revenue_B + Revenue_C) / (Water_cost_A + Water_cost_B + Water_cost_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_cost_A + Water_cost_B + Water_cost_C) == Revenue_A + Revenue_B + Revenue_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 897,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production of each component has a different cost and efficiency. \nFor Component A, the production cost is $20 per unit, and the efficiency is 10 units per hour.\nFor Component B, the production cost is $30 per unit, and the efficiency is 15 units per hour.\nFor Component C, the production cost is $40 per unit, and the efficiency is 20 units per hour.\nThe plant aims to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n// Production cost of A: Cost_A = 20 * A\n// Production cost of B: Cost_B = 30 * B\n// Production cost of C: Cost_C = 40 * C\n// Production efficiency of A: Eff_A = 10 * A\n// Production efficiency of B: Eff_B = 15 * B\n// Production efficiency of C: Eff_C = 20 * C\n// So, the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n\n## Generate Constraint-1:\nThe plant has a budget of $1000 per day for production costs.\n// 20 * A + 30 * B + 40 * C <= 1000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each component daily.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing plant produces three types of components: A, B, and C. The plant needs to determine the optimal number of each component to produce daily to maximize efficiency. The production cost and efficiency for each component are given in the following Table.\n\n| Component | Production Cost per Unit | Efficiency (Units per Hour) |\n|-----------|--------------------------|-----------------------------|\n| A         | $20                      | 10                          |\n| B         | $30                      | 15                          |\n| C         | $40                      | 20                          |\n\nThe plant has a budget of $1000 per day for production costs. The plant must produce at least 50 units of each component daily. Please help the plant to minimize the total cost per unit of production (which is defined as the sum of the production costs divided by the sum of the production efficiencies).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each component daily.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_A = 20 * A\nCost_B = 30 * B\nCost_C = 40 * C\nEff_A = 10 * A\nEff_B = 15 * B\nEff_C = 20 * C\n## the objective function is: Minimize (Cost_A + Cost_B + Cost_C) / (Eff_A + Eff_B + Eff_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Eff_A + Eff_B + Eff_C) == Cost_A + Cost_B + Cost_C)\n\n# Add constraints\n## The plant has a budget of $1000 per day for production costs.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Minimized Cost per Unit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 927,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe selling price of product A is $50, with a raw material cost of $20 and a labor cost of $10 per unit. Product B sells for $70, with a raw material cost of $30 and a labor cost of $15 per unit. Product C sells for $100, with a raw material cost of $40 and a labor cost of $20 per unit. The company aims to maximize the total profit, which is the sum of the profits from each product.\n// Profit of product A: Profit_A = (50 - 20 - 10) * A = 20 * A\n// Profit of product B: Profit_B = (70 - 30 - 15) * B = 25 * B\n// Profit of product C: Profit_C = (100 - 40 - 20) * C = 40 * C\n// So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for raw materials for the next quarter.\n// 20 * A + 30 * B + 40 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a labor capacity constraint of 500 hours for the next quarter. The labor time required for product A is 2 hours, for product B is 3 hours, and for product C is 4 hours.\n// 2 * A + 3 * B + 4 * C <= 500\n\n## Generate Constraint-3:\nThe company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients.\n// A >= 50; B >= 50; C >= 50",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product for the next quarter to optimize its profit while considering the costs of raw materials and labor. The selling price, raw material cost, labor cost, and labor time for each product are given in the following Table.\n\n| Product | Selling Price | Raw Material Cost | Labor Cost | Labor Time |\n|---------|---------------|-------------------|------------|------------|\n| A       | $50           | $20               | $10        | 2 hours    |\n| B       | $70           | $30               | $15        | 3 hours    |\n| C       | $100          | $40               | $20        | 4 hours    |\n\nThe company has a budget of $10,000 for raw materials for the next quarter. The company has a labor capacity constraint of 500 hours for the next quarter. The company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients. \nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company wants to ensure that at least 50 units of each product are produced to meet the minimum order requirements from key clients.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## The company aims to maximize the total profit, which is the sum of the profits from each product.\nProfit_A = 20 * A\nProfit_B = 25 * B\nProfit_C = 40 * C\n## So, the objective function is: Maximize (20 * A + 25 * B + 40 * C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for raw materials for the next quarter.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 10000)\n## The company has a labor capacity constraint of 500 hours for the next quarter.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1129,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop.\n// {\"number of acres for crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres for crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the crops require different amounts of water and fertilizer, which affects the overall profitability. Crop A requires 2 units of water and 1 unit of fertilizer per acre, crop B requires 3 units of water and 2 units of fertilizer per acre, and crop C requires 4 units of water and 3 units of fertilizer per acre. The farm aims to maximize the total profit per unit of resource used (water and fertilizer combined).\n// Profit per acre of A: Profit_A = 500 * A\n// Profit per acre of B: Profit_B = 700 * B\n// Profit per acre of C: Profit_C = 900 * C\n// Resource usage for A: Resource_A = 2 * A + 1 * A = 3 * A\n// Resource usage for B: Resource_B = 3 * B + 2 * B = 5 * B\n// Resource usage for C: Resource_C = 4 * C + 3 * C = 7 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 units of water available.\n// 2 * A + 3 * B + 4 * C <= 100\n\n## Generate Constraint-2:\nThe farm has a total of 50 units of fertilizer available.\n// 1 * A + 2 * B + 3 * C <= 50\n\n## Generate Constraint-3:\nThe farm wants to allocate at least 5 acres to each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm is cultivating three types of crops: A, B, and C. The farm needs to decide how many acres to allocate for each crop. The profit per acre for crop A is $500, for crop B is $700, and for crop C is $900. However, the crops require different amounts of water and fertilizer, which affects the overall profitability. Crop A requires 2 units of water and 1 unit of fertilizer per acre, crop B requires 3 units of water and 2 units of fertilizer per acre, and crop C requires 4 units of water and 3 units of fertilizer per acre. The farm aims to maximize the total profit per unit of resource used (water and fertilizer combined). The farm has a total of 100 units of water available and 50 units of fertilizer available. The farm wants to allocate at least 5 acres to each crop. Please help the farm to determine the optimal allocation of acres for each crop to maximize the total profit per unit of resource used.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 acres to each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres for crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres for crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres for crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 500 * A\nProfit_B = 700 * B\nProfit_C = 900 * C\nResource_A = 3 * A\nResource_B = 5 * B\nResource_C = 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (Resource_A + Resource_B + Resource_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Resource_A + Resource_B + Resource_C) == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 units of water available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The farm has a total of 50 units of fertilizer available.\nmodel.addCons(1 * A + 2 * B + 3 * C <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres for Crop A: \", model.getVal(A))\n    print(\"Number of Acres for Crop B: \", model.getVal(B))\n    print(\"Number of Acres for Crop C: \", model.getVal(C))\n    print(\"Maximized Profit Rate: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 915,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The resource usage per unit of product A is 2 units, product B is 3 units, and product C is 4 units. The company wants to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage.\n// Total profit: Profit = 50 * A + 70 * B + 60 * C\n// Total resource usage: Resource = 2 * A + 3 * B + 4 * C\n// So, the objective function is: Maximize Profit / Resource\n\n## Generate Constraint-1:\nThe company has a total of 1000 units of resources available.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10",
        "question": "A company is planning to optimize its production of three products: A, B, and C. The production levels of these products directly affect the company's profit and resource usage. The profit per unit and resource usage per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Resource Usage per Unit |\n|---------|-----------------|-------------------------|\n| A       | $50             | 2 units                 |\n| B       | $70             | 3 units                 |\n| C       | $60             | 4 units                 |\n\nThe company has a total of 1000 units of resources available. The company must produce at least 10 units of each product to meet contractual obligations. \n\nPlease help the company to maximize the profit-to-resource ratio, which is defined as the total profit divided by the total resource usage.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The company must produce at least 10 units of each product to meet contractual obligations.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = 50 * A + 70 * B + 60 * C\nResource = 2 * A + 3 * B + 4 * C\n## the objective function is: Maximize Profit / Resource\n## convert the division to multiplication\nmodel.addCons(obj * Resource == Profit)\n\n# Add constraints\n## The company has a total of 1000 units of resources available.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 854,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres of each crop to plant this season.\n// {\"number of acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected profit per acre is $100, the water requirement is 500 gallons, and the labor hours needed are 10 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 750 gallons, and the labor hours needed are 15 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 1000 gallons, and the labor hours needed are 20 hours.\nThe farmer aims to maximize the profit-to-resource ratio (defined as the total profit divided by the total resource usage, where resource usage is the sum of water and labor hours).\n// Profit of A: Profit_A = 100 * A\n// Profit of B: Profit_B = 150 * B\n// Profit of C: Profit_C = 200 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (500 * A + 750 * B + 1000 * C + 10 * A + 15 * B + 20 * C)\n\n## Generate Constraint-1:\nThe farmer has a total of 50,000 gallons of water available for the season.\n// 500 * A + 750 * B + 1000 * C <= 50,000\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 5 acres of each crop.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farmer is planning to plant three types of crops: A, B, and C. The farmer needs to decide how many acres of each crop to plant this season.\nFor Crop A, the expected profit per acre is $100, the water requirement is 500 gallons, and the labor hours needed are 10 hours.\nFor Crop B, the expected profit per acre is $150, the water requirement is 750 gallons, and the labor hours needed are 15 hours.\nFor Crop C, the expected profit per acre is $200, the water requirement is 1000 gallons, and the labor hours needed are 20 hours.\nThe farmer has a total of 50,000 gallons of water available for the season. The farmer wants to plant at least 5 acres of each crop.\nPlease help the farmer to maximize the profit-to-resource ratio (defined as the total profit divided by the total resource usage, where resource usage is the sum of water and labor hours).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 5 acres of each crop.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # number of acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # number of acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 100 * A\nProfit_B = 150 * B\nProfit_C = 200 * C\nResourceUsage = 500 * A + 750 * B + 1000 * C + 10 * A + 15 * B + 20 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / ResourceUsage\n## convert the division to multiplication\nmodel.addCons(obj * ResourceUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a total of 50,000 gallons of water available for the season.\nmodel.addCons(500 * A + 750 * B + 1000 * C <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Acres of Crop A: \", model.getVal(A))\n    print(\"Number of Acres of Crop B: \", model.getVal(B))\n    print(\"Number of Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Profit-to-Resource Ratio: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 851,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation.\n// {\"area of G1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of G2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of G3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe yield per square meter for G1 is 10 kg, for G2 is 15 kg, and for G3 is 20 kg. The energy cost per square meter for G1 is $5, for G2 is $7, and for G3 is $9. The farm aims to maximize the net profit (yield * price per kg - energy cost). The price per kg of the crop is $2.\n// Profit_G1 = 10 * A1 * 2 - 5 * A1\n// Profit_G2 = 15 * A2 * 2 - 7 * A2\n// Profit_G3 = 20 * A3 * 2 - 9 * A3\n// So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\n\n## Generate Constraint-1:\nThe total area available for all greenhouses is 1000 square meters.\n// A1 + A2 + A3 <= 1000\n\n## Generate Constraint-2:\nThe total energy budget for the farm is $8000.\n// 5 * A1 + 7 * A2 + 9 * A3 <= 8000\n\n## Generate Constraint-3:\nThe farm has a minimum yield requirement of 12000 kg.\n// 10 * A1 + 15 * A2 + 20 * A3 >= 12000\n\n## Generate Constraint-4:\nThe area allocated to G1 cannot exceed 300 square meters.\n// A1 <= 300",
        "question": "A farm operates three different types of greenhouses: G1, G2, and G3. Each greenhouse has a different efficiency in terms of crop yield per square meter and energy consumption. The farm needs to determine the area to allocate to each greenhouse type to optimize its operation. The yield per square meter and energy cost per square meter for each greenhouse are given in the following Table.\n\n| Greenhouse | Yield per Square Meter | Energy Cost per Square Meter |\n|------------|------------------------|------------------------------|\n| G1         | 10 kg                  | $5                          |\n| G2         | 15 kg                  | $7                          |\n| G3         | 20 kg                  | $9                          |\n\nThe price per kg of the crop is $2. The farm aims to maximize the net profit (yield * price per kg - energy cost). The total area available for all greenhouses is 1000 square meters. The total energy budget for the farm is $8000. The farm has a minimum yield requirement of 12000 kg. The area allocated to G1 cannot exceed 300 square meters.\n\nPlease help the farm to determine the optimal area to allocate to each greenhouse type to maximize its net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of G1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of G2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of G3\n\n# Define objective function\nProfit_G1 = 10 * A1 * 2 - 5 * A1\nProfit_G2 = 15 * A2 * 2 - 7 * A2\nProfit_G3 = 20 * A3 * 2 - 9 * A3\n# So, the objective function is: Maximize (Profit_G1 + Profit_G2 + Profit_G3)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_G1 + Profit_G2 + Profit_G3)\n\n# Add constraints\n# The total area available for all greenhouses is 1000 square meters.\nmodel.addCons(A1 + A2 + A3 <= 1000)\n# The total energy budget for the farm is $8000.\nmodel.addCons(5 * A1 + 7 * A2 + 9 * A3 <= 8000)\n# The farm has a minimum yield requirement of 12000 kg.\nmodel.addCons(10 * A1 + 15 * A2 + 20 * A3 >= 12000)\n# The area allocated to G1 cannot exceed 300 square meters.\nmodel.addCons(A1 <= 300)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of G1: \", model.getVal(A1))\n    print(\"Area of G2: \", model.getVal(A2))\n    print(\"Area of G3: \", model.getVal(A3))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1202,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\n// Total net profit for ComponentA: Profit_A = (50 - 30 - 5) * UnitsA\n// Total net profit for ComponentB: Profit_B = (70 - 40 - 10) * UnitsB\n// Total net profit for ComponentC: Profit_C = (100 - 60 - 15) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units per type of component.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 2000 units across all components.\n// UnitsA + UnitsB + UnitsC <= 2000\n\n## Generate Constraint-3:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB\n\n## Generate Constraint-4:\nThe company has a budget constraint for production costs of $50,000.\n// 30 * UnitsA + 40 * UnitsB + 60 * UnitsC <= 50,000",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company has a production capacity limit of 1000 units per type of component. The total storage space available is limited to 2000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB. The company has a budget constraint for production costs of $50,000.\nPlease help the company to maximize the total net profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * UnitsA\nProfit_B = (70 - 40 - 10) * UnitsB\nProfit_C = (100 - 60 - 15) * UnitsC\n# So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n# The company has a production capacity limit of 1000 units per type of component.\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\n# The total storage space available is limited to 2000 units across all components.\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\n# Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nmodel.addCons(UnitsA >= 2 * UnitsB)\n# The company has a budget constraint for production costs of $50,000.\nmodel.addCons(30 * UnitsA + 40 * UnitsB + 60 * UnitsC <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1040,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how much land to allocate to each crop to maximize yield while considering soil fertility and water usage.\n// {\"land allocated to crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"land allocated to crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the yield per acre is 5 tons, but it requires 3 units of water per ton. \nFor Crop B, the yield per acre is 7 tons, but it requires 4 units of water per ton. \nFor Crop C, the yield per acre is 9 tons, but it requires 5 units of water per ton.\nThe farmer aims to maximize the total yield of crops (which is defined as the sum of the yields of each crop) while considering the water usage efficiency (which is defined as the total yield divided by the total water used).\n// Yield of A: Yield_A = 5 * A\n// Yield of B: Yield_B = 7 * B\n// Yield of C: Yield_C = 9 * C\n// Total water used: Water_used = 3 * 5 * A + 4 * 7 * B + 5 * 9 * C\n// So, the objective function is: Maximize (Yield_A + Yield_B + Yield_C) / Water_used\n\n## Generate Constraint-1:\nThe farmer has 100 acres of land available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farmer has a budget constraint that limits the total cost of seeds to $2000. The cost of seeds for Crop A is $20 per acre, for Crop B is $30 per acre, and for Crop C is $40 per acre.\n// 20 * A + 30 * B + 40 * C <= 2000",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how much land to allocate to each crop to maximize yield while considering soil fertility and water usage.\nFor Crop A, the yield per acre is 5 tons, but it requires 3 units of water per ton. \nFor Crop B, the yield per acre is 7 tons, but it requires 4 units of water per ton. \nFor Crop C, the yield per acre is 9 tons, but it requires 5 units of water per ton.\nThe farmer aims to maximize the total yield of crops (which is defined as the sum of the yields of each crop) while considering the water usage efficiency (which is defined as the total yield divided by the total water used).\nThe farmer has 100 acres of land available for cultivation. The farmer also has a budget constraint that limits the total cost of seeds to $2000, with the cost of seeds for Crop A being $20 per acre, for Crop B being $30 per acre, and for Crop C being $40 per acre.\nPlease help the farmer determine the optimal allocation of land to each crop to achieve the maximum yield while considering water usage efficiency and budget constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=0) # land allocated to crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # land allocated to crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # land allocated to crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nYield_A = 5 * A\nYield_B = 7 * B\nYield_C = 9 * C\nWater_used = 3 * 5 * A + 4 * 7 * B + 5 * 9 * C\n## the objective function is: Maximize (Yield_A + Yield_B + Yield_C) / Water_used\n## convert the division to multiplication\nmodel.addCons(obj * Water_used == Yield_A + Yield_B + Yield_C)\n\n# Add constraints\n## The farmer has 100 acres of land available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farmer has a budget constraint that limits the total cost of seeds to $2000.\nmodel.addCons(20 * A + 30 * B + 40 * C <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Land allocated to Crop A: \", model.getVal(A))\n    print(\"Land allocated to Crop B: \", model.getVal(B))\n    print(\"Land allocated to Crop C: \", model.getVal(C))\n    print(\"Maximized Yield per Water Usage: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1100,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 600 smartphones to be produced.\n// S <= 600\n\n## Generate Constraint-3:\nDue to market research, the company should produce no more than 400 tablets.\n// T <= 400\n\n## Generate Constraint-4:\nThe production line for laptops can handle up to 300 units.\n// L <= 300\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced product portfolio, requiring that the number of laptops produced should not exceed the combined number of smartphones and tablets by more than 100 units.\n// L - (S + T) <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation, and is given by the function: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively.\n\nThe company has the following constraints:\n1. The total production capacity of the company is limited to 1000 units per month.\n2. The raw material constraint allows for a maximum of 600 smartphones to be produced.\n3. Due to market research, the company should produce no more than 400 tablets.\n4. The production line for laptops can handle up to 300 units.\n5. The company aims to maintain a balanced product portfolio, requiring that the number of laptops produced should not exceed the combined number of smartphones and tablets by more than 100 units.\n\nPlease help the company to maximize the profit function given these constraints.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=600) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # number of laptops\n\n# Define objective function\n## The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n## Since pyscipopt does not support quadratic objective, we need to linearize it\n## Introduce new variables for squares and constraints to ensure they are equal to the squares of the original variables\nS_squared = model.addVar(vtype=\"INTEGER\", name=\"S_squared\")\nT_squared = model.addVar(vtype=\"INTEGER\", name=\"T_squared\")\nL_squared = model.addVar(vtype=\"INTEGER\", name=\"L_squared\")\nmodel.addCons(S_squared == S * S)\nmodel.addCons(T_squared == T * T)\nmodel.addCons(L_squared == L * L)\n\n## Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * S + 60 * T + 70 * L - 0.01 * (S_squared + T_squared + L_squared))\n\n# Add constraints\nmodel.addCons(S + T + L <= 1000) # Total production capacity\nmodel.addCons(L - (S + T) <= 100) # Balanced product portfolio\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1173,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity.\n// {\"number of TruckA\": \"TruckA\", \"range\": \"TruckA >= 0\", \"type\": \"integer\"}\n// {\"number of TruckB\": \"TruckB\", \"range\": \"TruckB >= 0\", \"type\": \"integer\"}\n// {\"number of TruckC\": \"TruckC\", \"range\": \"TruckC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company aims to minimize the total operational cost, which is a function of fuel efficiency and maintenance costs. \nFor TruckA, the fuel efficiency is 10 km/l, maintenance cost is $500 per month, and it can carry 5 tons.\nFor TruckB, the fuel efficiency is 15 km/l, maintenance cost is $700 per month, and it can carry 7 tons.\nFor TruckC, the fuel efficiency is 20 km/l, maintenance cost is $900 per month, and it can carry 10 tons.\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency).\n// Operational cost for TruckA: Cost_TruckA = 500 / 10 * TruckA\n// Operational cost for TruckB: Cost_TruckB = 700 / 15 * TruckB\n// Operational cost for TruckC: Cost_TruckC = 900 / 20 * TruckC\n// So, the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n## Generate Constraint-1:\nThe company has a total budget of $10,000 per month for vehicle maintenance.\n// 500 * TruckA + 700 * TruckB + 900 * TruckC <= 10,000",
        "question": "A logistics company is managing three types of vehicles: TruckA, TruckB, and TruckC. They need to determine the number of each type of vehicle to optimize their fleet for fuel efficiency and cargo capacity. The fuel efficiency, maintenance cost, and cargo capacity for each vehicle are given in the following Table.\n\n| Vehicle | Fuel Efficiency (km/l) | Maintenance Cost ($/month) | Cargo Capacity (tons) |\n|---------|-----------------------|---------------------------|----------------------|\n| TruckA  | 10                    | 500                       | 5                    |\n| TruckB  | 15                    | 700                       | 7                    |\n| TruckC  | 20                    | 900                       | 10                   |\n\nThe operational cost per vehicle per month is calculated as (maintenance cost) / (fuel efficiency). The company has a total budget of $10,000 per month for vehicle maintenance.\nPlease help the company to minimize the total operational cost (which is the sum of the operational costs for all vehicles).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nTruckA = model.addVar(vtype=\"INTEGER\", name=\"TruckA\", lb=0) # number of TruckA\nTruckB = model.addVar(vtype=\"INTEGER\", name=\"TruckB\", lb=0) # number of TruckB\nTruckC = model.addVar(vtype=\"INTEGER\", name=\"TruckC\", lb=0) # number of TruckC\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost_TruckA = 500 / 10 * TruckA\nCost_TruckB = 700 / 15 * TruckB\nCost_TruckC = 900 / 20 * TruckC\n## the objective function is: Minimize (Cost_TruckA + Cost_TruckB + Cost_TruckC)\nmodel.addCons(obj == Cost_TruckA + Cost_TruckB + Cost_TruckC)\n\n# Add constraints\n## The company has a total budget of $10,000 per month for vehicle maintenance.\nmodel.addCons(500 * TruckA + 700 * TruckB + 900 * TruckC <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of TruckA: \", model.getVal(TruckA))\n    print(\"Number of TruckB: \", model.getVal(TruckB))\n    print(\"Number of TruckC: \", model.getVal(TruckC))\n    print(\"Minimized Operational Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1057,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $20, product B is $30, and product C is $40. The production cost per unit of product A is $10, product B is $20, and product C is $30. The plant aims to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost.\n// Profit of A: Profit_A = (20 - 10) * A = 10 * A\n// Profit of B: Profit_B = (30 - 20) * B = 10 * B\n// Profit of C: Profit_C = (40 - 30) * C = 10 * C\n// Total profit: Total_Profit = Profit_A + Profit_B + Profit_C\n// Total production cost: Total_Cost = 10 * A + 20 * B + 30 * C\n// So, the objective function is: Maximize (Total_Profit / Total_Cost)\n\n## Generate Constraint-1:\nThe plant has a budget of $5000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 5000\n\n## Generate Constraint-2:\nThe plant must produce at least 50 units of each product to meet the minimum order requirements.\n// A >= 50; B >= 50; C >= 50\n\n## Generate Constraint-3:\nThe total production capacity of the plant is limited to 200 units.\n// A + B + C <= 200",
        "question": "A manufacturing plant produces three types of products: A, B, and C. The plant needs to determine the production quantities for each product to optimize its operations. The profit per unit, production cost per unit, and the production efficiency ratio for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit |\n|---------|-----------------|--------------------------|\n| A       | $20             | $10                      |\n| B       | $30             | $20                      |\n| C       | $40             | $30                      |\n\nThe plant has a budget of $5000 for production costs. The plant must produce at least 50 units of each product to meet the minimum order requirements. The total production capacity of the plant is limited to 200 units. \nPlease help the plant to maximize the total profit while considering the production efficiency, which is defined as the ratio of total profit to the total production cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The plant must produce at least 50 units of each product to meet the minimum order requirements.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=50) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=50) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = 10 * A\nProfit_B = 10 * B\nProfit_C = 10 * C\nTotal_Profit = Profit_A + Profit_B + Profit_C\nTotal_Cost = 10 * A + 20 * B + 30 * C\n## the objective function is: Maximize (Total_Profit / Total_Cost)\n## convert the division to multiplication\nmodel.addCons(obj * Total_Cost == Total_Profit)\n\n# Add constraints\n## The plant has a budget of $5000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 5000)\n## The total production capacity of the plant is limited to 200 units.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Production Efficiency: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 981,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n// Total revenue: Revenue = 50 * A + 70 * B + 90 * C\n// Total production cost: Cost = 0.01 * A^2 + 0.02 * B^2 + 0.03 * C^2\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe total production capacity of the company is 1000 units per month.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per month.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per month.\n// B >= 150\n\n## Generate Constraint-4:\nThe company cannot produce more than 300 units of product C due to limited raw material availability.\n// C <= 300\n\n## Generate Constraint-5:\nThe company must produce at least twice as many units of product A as product B.\n// A >= 2 * B",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the optimal production quantity for each product to maximize profit while considering the production capacity and market demand. The profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is modeled as 0.01 * A^2, for product B as 0.02 * B^2, and for product C as 0.03 * C^2. The company aims to maximize the total net profit, which is the total revenue minus the total production cost.\n\n| Product | Profit per Unit | Production Cost Model |\n|---------|-----------------|-----------------------|\n| A       | $50             | 0.01 * A^2           |\n| B       | $70             | 0.02 * B^2           |\n| C       | $90             | 0.03 * C^2           |\n\nThe total production capacity of the company is 1000 units per month. The market demand for product A is at least 200 units per month. The market demand for product B is at least 150 units per month. The company cannot produce more than 300 units of product C due to limited raw material availability. The company must produce at least twice as many units of product A as product B.\n\nPlease help the company to determine the optimal production quantities for products A, B, and C to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200)  # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150)  # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300)  # number of units of product C\n\n# Define objective function\nRevenue = 50 * A + 70 * B + 90 * C\nCost = 0.01 * A**2 + 0.02 * B**2 + 0.03 * C**2\nNetProfit = Revenue - Cost\n\n# Set objective as a variable\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == NetProfit)\n\n# Add constraints\nmodel.addCons(A + B + C <= 1000)  # Total production capacity constraint\nmodel.addCons(A >= 2 * B)  # Production ratio constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1441,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints.\n// {\"number of units of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company wants to maximize the total net profit.\n// Total revenue for product A: Revenue_A = 50 * ProductA\n// Total revenue for product B: Revenue_B = 70 * ProductB\n// Total revenue for product C: Revenue_C = 90 * ProductC\n// Total cost for product A: Cost_A = 1000 + 2 * (ProductA)^2\n// Total cost for product B: Cost_B = 1500 + 1.5 * (ProductB)^2\n// Total cost for product C: Cost_C = 2000 + (ProductC)^2\n// So, the objective function is: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited storage capacity of 10,000 cubic feet. Each unit of product A requires 10 cubic feet, product B requires 15 cubic feet, and product C requires 20 cubic feet.\n// 10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000\n\n## Generate Constraint-2:\nDue to labor constraints, the total production time for all products cannot exceed 500 hours. Producing one unit of product A takes 2 hours, product B takes 3 hours, and product C takes 4 hours.\n// 2 * ProductA + 3 * ProductB + 4 * ProductC <= 500\n\n## Generate Constraint-3:\nThe company must produce at least 100 units of product A and 50 units of product B to fulfill existing contracts.\n// ProductA >= 100\n// ProductB >= 50\n\n## Generate Constraint-4:\nThe company aims to produce at least twice as many units of product C as product A.\n// ProductC >= 2 * ProductA",
        "question": "A manufacturing company produces three types of products: A, B, and C. They need to determine the optimal production quantity for each product to maximize profit while considering various constraints. The profit per unit for product A is $50, for product B is $70, and for product C is $90. The production cost for each product increases nonlinearly with the quantity produced due to economies of scale. The production cost function is given by: Cost(x) = 1000 + 2x^2 for product A, Cost(y) = 1500 + 1.5y^2 for product B, and Cost(z) = 2000 + z^2 for product C. The company wants to maximize the total net profit.\n\n| Product | Profit per Unit | Production Cost Function | Storage Space Required | Production Time per Unit |\n|---------|-----------------|---------------------------|------------------------|--------------------------|\n| A       | $50             | 1000 + 2(ProductA)^2      | 10 cubic feet          | 2 hours                  |\n| B       | $70             | 1500 + 1.5(ProductB)^2    | 15 cubic feet          | 3 hours                  |\n| C       | $90             | 2000 + (ProductC)^2        | 20 cubic feet          | 4 hours                  |\n\nThe company has a limited storage capacity of 10,000 cubic feet. Due to labor constraints, the total production time for all products cannot exceed 500 hours. The company must produce at least 100 units of product A and 50 units of product B to fulfill existing contracts. The company aims to produce at least twice as many units of product C as product A.\n\nPlease help the company to determine the optimal production quantity for each product to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=100) # number of units of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50) # number of units of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # number of units of product C\n\n# Define objective function\n## Total revenue and cost for each product\nRevenue_A = 50 * ProductA\nCost_A = 1000 + 2 * (ProductA**2)\nRevenue_B = 70 * ProductB\nCost_B = 1500 + 1.5 * (ProductB**2)\nRevenue_C = 90 * ProductC\nCost_C = 2000 + (ProductC**2)\n## Objective function: Maximize (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == (Revenue_A - Cost_A) + (Revenue_B - Cost_B) + (Revenue_C - Cost_C))\n\n# Add constraints\n## Storage capacity constraint\nmodel.addCons(10 * ProductA + 15 * ProductB + 20 * ProductC <= 10000)\n## Production time constraint\nmodel.addCons(2 * ProductA + 3 * ProductB + 4 * ProductC <= 500)\n## Contract fulfillment constraint\nmodel.addCons(ProductA >= 100)\nmodel.addCons(ProductB >= 50)\n## Production ratio constraint\nmodel.addCons(ProductC >= 2 * ProductA)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(ProductA))\n    print(\"Number of Product B: \", model.getVal(ProductB))\n    print(\"Number of Product C: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1643,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints.\n// {\"amount of chemical produced at facility 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced at facility 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from producing the chemical at each facility depends on the amount produced and the cost of production. The profit function is nonlinear and is given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\nThe company wants to maximize the total profit from all facilities.\n// The objective function is: Maximize F = F1 + F2 + F3\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all facilities must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000\n\n## Generate Constraint-2:\nThe demand for the chemical at facility 1 is at least 200 units.\n// P1 >= 200",
        "question": "A company operates three different facilities that produce a specialized chemical. The company needs to decide how much of the chemical to produce at each facility to maximize profit while considering the cost of production and the demand constraints. The profit from producing the chemical at each facility depends on the amount produced and the cost of production. The profit function is nonlinear and is given by:\n- Profit at facility 1: F1 = 100 * P1 - 0.5 * P1^2\n- Profit at facility 2: F2 = 120 * P2 - 0.6 * P2^2\n- Profit at facility 3: F3 = 110 * P3 - 0.4 * P3^2\nThe company wants to maximize the total profit from all facilities. The total amount of chemical produced across all facilities must not exceed 1000 units. The demand for the chemical at facility 1 is at least 200 units. Please help the company determine the optimal production amounts for each facility.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=200) # amount of chemical produced at facility 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced at facility 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced at facility 3\n\n# Define objective function\n## The profit function is nonlinear and is given by:\nF1 = 100 * P1 - 0.5 * P1**2\nF2 = 120 * P2 - 0.6 * P2**2\nF3 = 110 * P3 - 0.4 * P3**2\n## The objective function is: Maximize F = F1 + F2 + F3\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == F1 + F2 + F3)\n\n# Add constraints\n## The total amount of chemical produced across all facilities must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced at facility 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced at facility 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced at facility 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 874,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, but it requires 2 hours of labor and 1 hour of machine time.\nThe profit per unit for product B is $70, but it requires 3 hours of labor and 2 hours of machine time.\nThe profit per unit for product C is $100, but it requires 4 hours of labor and 3 hours of machine time.\nThe company wants to maximize the total profit, which is the sum of the profits from each product.\n// Total profit: Profit = 50A + 70B + 100C\n// The objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total of 100 hours of labor available per week.\n// 2A + 3B + 4C <= 100\n\n## Generate Constraint-2:\nThe company has a total of 70 hours of machine time available per week.\n// A + 2B + 3C <= 70\n\n## Generate Constraint-3:\nThe company must produce at least 10 units of product A.\n// A >= 10\n\n## Generate Constraint-4:\nThe company must produce at least 5 units of product B.\n// B >= 5\n\n## Generate Constraint-5:\nThe company must produce at least 3 units of product C.\n// C >= 3",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to optimize their profit. The profit per unit, labor hours, and machine hours required for each product are given in the following Table.\n\n| Product | Profit per Unit | Labor Hours | Machine Hours |\n|---------|-----------------|-------------|---------------|\n| A       | $50             | 2           | 1             |\n| B       | $70             | 3           | 2             |\n| C       | $100            | 4           | 3             |\n\nThe company has a total of 100 hours of labor available per week and 70 hours of machine time available per week. The company must produce at least 10 units of product A, at least 5 units of product B, and at least 3 units of product C. \n\nPlease help the company to maximize the total profit, which is the sum of the profits from each product.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=3) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Total profit: Profit = 50A + 70B + 100C\nmodel.addCons(obj == 50 * A + 70 * B + 100 * C)\n\n# Add constraints\n## The company has a total of 100 hours of labor available per week.\nmodel.addCons(2 * A + 3 * B + 4 * C <= 100)\n## The company has a total of 70 hours of machine time available per week.\nmodel.addCons(A + 2 * B + 3 * C <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 924,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit.\n// {\"raw materials for machine 1\": \"M1\", \"range\": \"M1 >= 0\", \"type\": \"real\"}\n// {\"labor hours for machine 2\": \"L2\", \"range\": \"L2 >= 0\", \"type\": \"real\"}\n// {\"production rate adjustment for machine 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine contributes differently to the profit based on the raw materials and labor hours allocated. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines.\n// The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\n\n## Generate Constraint-1:\nThe total budget for raw materials and labor hours is $5000.\n// 100 * M1 + 150 * L2 + 500 * P3^2 <= 5000\n\n## Generate Constraint-2:\nThe maximum capacity for raw materials on Machine 1 is 30 units.\n// M1 <= 30",
        "question": "A manufacturing company produces three types of products using a set of machines. The company needs to optimize the allocation of raw materials and labor hours to each machine to maximize profit. Machine 1 generates a profit of $100 per unit of raw material used. Machine 2 generates a profit of $150 per labor hour. Machine 3's profit varies nonlinearly with the production rate adjustment, generating a profit of $500 * P3^2. The company aims to maximize the total profit from all three machines. The total budget for raw materials and labor hours is $5000. The maximum capacity for raw materials on Machine 1 is 30 units. Please help the company determine the optimal allocation of resources to maximize profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nM1 = model.addVar(vtype=\"CONTINUOUS\", name=\"M1\", lb=0) # raw materials for machine 1\nL2 = model.addVar(vtype=\"CONTINUOUS\", name=\"L2\", lb=0) # labor hours for machine 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # production rate adjustment for machine 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize Profit = 100 * M1 + 150 * L2 + 500 * P3^2\nmodel.addCons(obj == 100 * M1 + 150 * L2 + 500 * P3**2)\n\n# Add constraints\n## The total budget for raw materials and labor hours is $5000.\nmodel.addCons(100 * M1 + 150 * L2 + 500 * P3**2 <= 5000)\n## The maximum capacity for raw materials on Machine 1 is 30 units.\nmodel.addCons(M1 <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Raw materials for Machine 1: \", model.getVal(M1))\n    print(\"Labor hours for Machine 2: \", model.getVal(L2))\n    print(\"Production rate adjustment for Machine 3: \", model.getVal(P3))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 714,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function.\n// Formal definition: Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per month.\n// S + T + L <= 1000\n\n## Generate Constraint-2:\nThe raw material constraint allows for a maximum of 600 smartphones to be produced.\n// S <= 600\n\n## Generate Constraint-3:\nDue to market research, the company should produce no more than 400 tablets.\n// T <= 400\n\n## Generate Constraint-4:\nThe production line for laptops can handle up to 300 units.\n// L <= 300\n\n## Generate Constraint-5:\nThe company aims to maintain a balanced product portfolio, requiring that the number of laptops produced should not exceed the combined number of smartphones and tablets by more than 100 units.\n// L - (S + T) <= 100",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide the number of each device to produce to maximize profit while considering the constraints of raw materials and production capacity. The profit from each device varies with the number produced due to economies of scale and market saturation. The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2), where S, T, and L are the numbers of smartphones, tablets, and laptops produced, respectively. The company aims to maximize this profit function. The total production capacity of the company is limited to 1000 units per month. The raw material constraint allows for a maximum of 600 smartphones to be produced. Due to market research, the company should produce no more than 400 tablets. The production line for laptops can handle up to 300 units. The company aims to maintain a balanced product portfolio, requiring that the number of laptops produced should not exceed the combined number of smartphones and tablets by more than 100 units. Please help the company determine the optimal number of each device to produce to maximize profit under these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0, ub=600) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0, ub=400) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0, ub=300) # number of laptops\n\n# Define objective function\n## The profit function is given by: Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\n## Since pyscipopt does not support quadratic objective, we need to linearize it\n## Introduce new variables for squares and constraints to ensure they are equal to the squares of the original variables\nS_squared = model.addVar(vtype=\"INTEGER\", name=\"S_squared\")\nT_squared = model.addVar(vtype=\"INTEGER\", name=\"T_squared\")\nL_squared = model.addVar(vtype=\"INTEGER\", name=\"L_squared\")\nmodel.addCons(S_squared == S * S)\nmodel.addCons(T_squared == T * T)\nmodel.addCons(L_squared == L * L)\n\n## Maximize Profit = 50S + 60T + 70L - 0.01(S^2 + T^2 + L^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 50 * S + 60 * T + 70 * L - 0.01 * (S_squared + T_squared + L_squared))\n\n# Add constraints\nmodel.addCons(S + T + L <= 1000) # Total production capacity\nmodel.addCons(L - (S + T) <= 100) # Balanced product portfolio\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1209,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit.\n// {\"amount of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"real\"}\n// {\"amount of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n// {\"amount of barley\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. The farmer wants to maximize his total profit. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The objective is to maximize the total profit, which is given by:\n// Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\n\n## Generate Constraint-1:\nThe total area available for planting is 100 hectares.\n// W + C + B <= 100\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare.\n// 5W + 7C + 6B <= 1500\n\n## Generate Constraint-3:\nDue to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn.\n// W <= 50\n// C <= 60",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how much of each crop to plant in each plot to maximize his profit. The profit per unit of wheat is $10, the profit per unit of corn is $15, and the profit per unit of barley is $12. However, the soil quality varies across the plots, affecting the yield. The yield of wheat is 0.8W, the yield of corn is 0.9C, and the yield of barley is 0.7B. The total area available for planting is 100 hectares. The farmer has a limited budget for seeds and fertilizers, which is $1500. The cost of planting wheat is $5 per hectare, corn is $7 per hectare, and barley is $6 per hectare. Due to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn. Please help the farmer to maximize his total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"CONTINUOUS\", name=\"W\", lb=0) # amount of wheat\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=0) # amount of corn\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=0) # amount of barley\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Profit = 10 * 0.8W + 15 * 0.9C + 12 * 0.7B\nmodel.addCons(obj == 10 * 0.8 * W + 15 * 0.9 * C + 12 * 0.7 * B)\n\n# Add constraints\n## The total area available for planting is 100 hectares.\nmodel.addCons(W + C + B <= 100)\n## The farmer has a limited budget for seeds and fertilizers, which is $1500.\nmodel.addCons(5 * W + 7 * C + 6 * B <= 1500)\n## Due to market demand, the farmer can sell at most 50 units of wheat and 60 units of corn.\nmodel.addCons(W <= 50)\nmodel.addCons(C <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Wheat: \", model.getVal(W))\n    print(\"Amount of Corn: \", model.getVal(C))\n    print(\"Amount of Barley: \", model.getVal(B))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 810,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets.\n// {\"hours for machine A\": \"MA\", \"range\": \"MA >= 0\", \"type\": \"real\"}\n// {\"hours for machine B\": \"MB\", \"range\": \"MB >= 0\", \"type\": \"real\"}\n// {\"hours for machine C\": \"MC\", \"range\": \"MC >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nEach machine has a different efficiency and cost per hour. Machine A produces 5 units of widget A per hour at a cost of $10 per hour. Machine B produces 10 units of widget B per hour at a cost of $15 per hour. Machine C produces 15 units of widget C per hour at a cost of $20 per hour. The goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget.\n// The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\n// The production constraint for widget A: 5 * MA >= 100\n// The production constraint for widget B: 10 * MB >= 100\n// The production constraint for widget C: 15 * MC >= 100\n// So, the objective function is: Minimize Cost\n\n## Generate Constraint-1:\nThe total operating hours for all machines must not exceed 20 hours per day.\n// MA + MB + MC <= 20\n\n## Generate Constraint-2:\nMachine A can operate for a maximum of 8 hours per day.\n// MA <= 8",
        "question": "A manufacturing plant produces three types of widgets: A, B, and C. The plant manager needs to determine the optimal number of hours to operate each of the three machines dedicated to producing these widgets. The efficiency and cost per hour for each machine are given in the following Table.\n\n| Machine | Units Produced per Hour | Cost per Hour |\n|---------|-------------------------|---------------|\n| A       | 5 units of widget A     | $10           |\n| B       | 10 units of widget B    | $15           |\n| C       | 15 units of widget C    | $20           |\n\nThe goal is to minimize the total cost of production while ensuring a minimum production of 100 units of each widget. The total operating hours for all machines must not exceed 20 hours per day. Additionally, Machine A can operate for a maximum of 8 hours per day.\n\nPlease help the plant manager to determine the optimal number of hours to operate each machine to achieve the minimum production requirements while minimizing the total cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nMA = model.addVar(vtype=\"CONTINUOUS\", name=\"MA\", lb=0) # hours for machine A\nMB = model.addVar(vtype=\"CONTINUOUS\", name=\"MB\", lb=0) # hours for machine B\nMC = model.addVar(vtype=\"CONTINUOUS\", name=\"MC\", lb=0) # hours for machine C\n\n# Define objective function\n## The total cost function is: Cost = 10 * MA + 15 * MB + 20 * MC\nCost = 10 * MA + 15 * MB + 20 * MC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nmodel.addCons(obj == Cost)\n\n# Add constraints\n## The production constraint for widget A: 5 * MA >= 100\nmodel.addCons(5 * MA >= 100)\n## The production constraint for widget B: 10 * MB >= 100\nmodel.addCons(10 * MB >= 100)\n## The production constraint for widget C: 15 * MC >= 100\nmodel.addCons(15 * MC >= 100)\n## The total operating hours for all machines must not exceed 20 hours per day.\nmodel.addCons(MA + MB + MC <= 20)\n## Machine A can operate for a maximum of 8 hours per day.\nmodel.addCons(MA <= 8)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Machine A: \", model.getVal(MA))\n    print(\"Hours for Machine B: \", model.getVal(MB))\n    print(\"Hours for Machine C: \", model.getVal(MC))\n    print(\"Minimized Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1005,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop.\n// {\"area of land for C1\": \"A1\", \"range\": \"A1 >= 0\", \"type\": \"real\"}\n// {\"area of land for C2\": \"A2\", \"range\": \"A2 >= 0\", \"type\": \"real\"}\n// {\"area of land for C3\": \"A3\", \"range\": \"A3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe farm aims to maximize its profit from the crops. The profit per hectare for C1 is $1000, but it requires 2 units of water per hectare. For C2, the profit per hectare is $1500, requiring 3 units of water per hectare. For C3, the profit per hectare is $2000, requiring 4 units of water per hectare. The farm has a limited water supply and wants to maximize its profit per unit of water used.\n// Profit_C1 = 1000 * A1\n// Profit_C2 = 1500 * A2\n// Profit_C3 = 2000 * A3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (2 * A1 + 3 * A2 + 4 * A3)\n\n## Generate Constraint-1:\nThe farm has a total of 100 hectares of land available.\n// A1 + A2 + A3 <= 100",
        "question": "A farm produces three types of crops: C1, C2, and C3. They need to determine the area of land to allocate to each crop. The profit per hectare and the water requirement for each crop are given in the following Table.\n\n| Crop | Profit per Hectare | Water Requirement per Hectare |\n|------|---------------------|-------------------------------|\n| C1   | $1000               | 2 units                       |\n| C2   | $1500               | 3 units                       |\n| C3   | $2000               | 4 units                       |\n\nThe farm aims to maximize its profit from the crops while considering its limited water supply. The farm wants to maximize its profit per unit of water used. The farm has a total of 100 hectares of land available.\nPlease help the farm determine the optimal allocation of land to each crop to achieve this goal.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA1 = model.addVar(vtype=\"CONTINUOUS\", name=\"A1\", lb=0) # area of land for C1\nA2 = model.addVar(vtype=\"CONTINUOUS\", name=\"A2\", lb=0) # area of land for C2\nA3 = model.addVar(vtype=\"CONTINUOUS\", name=\"A3\", lb=0) # area of land for C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = 1000 * A1\nProfit_C2 = 1500 * A2\nProfit_C3 = 2000 * A3\nWaterUsage = 2 * A1 + 3 * A2 + 4 * A3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farm has a total of 100 hectares of land available.\nmodel.addCons(A1 + A2 + A3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Area of Land for C1: \", model.getVal(A1))\n    print(\"Area of Land for C2: \", model.getVal(A2))\n    print(\"Area of Land for C3: \", model.getVal(A3))\n    print(\"Maximized Profit Rate per Unit of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 843,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time.\n// {\"quantity of P1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"integer\"}\n// {\"quantity of P2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"integer\"}\n// {\"cost of raw materials\": \"RawMaterials\", \"range\": \"RawMaterials >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of P1 is $100, and the production time per unit is 1 hour. The profit per unit of P2 is $150, and the production time per unit is 2 hours. The cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company aims to maximize the total profit from both products.\n// Profit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\n// Profit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\n// Total profit: Profit = Profit_P1 + Profit_P2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a total production time of 200 hours.\n// P1 + 2 * P2 <= 200\n\n## Generate Constraint-2:\nThe company has a budget of $10,000 for raw materials.\n// RawMaterials <= 10000",
        "question": "A manufacturing company produces two types of products: P1 and P2. They need to determine the optimal production quantities of each product to maximize profit while considering the cost of raw materials and production time. The profit per unit and production time for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Time per Unit |\n|---------|-----------------|--------------------------|\n| P1      | $100            | 1 hour                   |\n| P2      | $150            | 2 hours                  |\n\nThe cost of raw materials affects the profit, reducing it by $5 for every $1000 spent on raw materials. The company has a total production time of 200 hours and a budget of $10,000 for raw materials. Please help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"INTEGER\", name=\"P1\", lb=0) # quantity of P1\nP2 = model.addVar(vtype=\"INTEGER\", name=\"P2\", lb=0) # quantity of P2\nRawMaterials = model.addVar(vtype=\"CONTINUOUS\", name=\"RawMaterials\", lb=0) # cost of raw materials\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\n## Profit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\n## Total profit: Profit = Profit_P1 + Profit_P2\nProfit_P1 = 100 * P1 - 0.005 * RawMaterials * P1\nProfit_P2 = 150 * P2 - 0.005 * RawMaterials * P2\nmodel.addCons(obj == Profit_P1 + Profit_P2)\n\n# Add constraints\n## The company has a total production time of 200 hours.\nmodel.addCons(P1 + 2 * P2 <= 200)\n## The company has a budget of $10,000 for raw materials.\nmodel.addCons(RawMaterials <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of P1: \", model.getVal(P1))\n    print(\"Quantity of P2: \", model.getVal(P2))\n    print(\"Cost of Raw Materials: \", model.getVal(RawMaterials))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 817,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\n// {\"number of units of component A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of component B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of component C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company aims to maximize the total profit after considering both production and storage costs. The storage cost is a function of the square of the production quantity due to space limitations.\n// Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n// Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n// Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 15 * B + 20 * C <= 10000\n\n## Generate Constraint-2:\nThe market demand for component A is at least 50 units, and for component B and C is at least 30 units each.\n// A >= 50; B >= 30; C >= 30\n\n## Generate Constraint-3:\nThe total production capacity of the company is limited to 200 units per month.\n// A + B + C <= 200\n\n## Generate Constraint-4:\nThe storage capacity for each component is limited to 100 units.\n// A <= 100; B <= 100; C <= 100",
        "question": "A manufacturing company produces three types of electronic components: A, B, and C. The company needs to determine the optimal production quantity of each component to maximize profit while considering production costs and market demand.\nThe profit per unit of component A is $30, with a production cost of $10 and a storage cost of $5 per unit per month. \nFor component B, the profit per unit is $40, with a production cost of $15 and a storage cost of $7 per unit per month. \nFor component C, the profit per unit is $50, with a production cost of $20 and a storage cost of $9 per unit per month.\nThe company has a budget of $10,000 for production costs. The market demand for component A is at least 50 units, and for component B and C is at least 30 units each. The total production capacity of the company is limited to 200 units per month. The storage capacity for each component is limited to 100 units.\nPlease help the company to maximize the total profit after considering both production and storage costs, where the storage cost is a function of the square of the production quantity due to space limitations.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50, ub=100) # number of units of component A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=30, ub=100) # number of units of component B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=30, ub=100) # number of units of component C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit of A: Profit_A = (30 - 10 - 5 * A^2) * A\n## Profit of B: Profit_B = (40 - 15 - 7 * B^2) * B\n## Profit of C: Profit_C = (50 - 20 - 9 * C^2) * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nProfit_A = (30 - 10 - 5 * A**2) * A\nProfit_B = (40 - 15 - 7 * B**2) * B\nProfit_C = (50 - 20 - 9 * C**2) * C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 15 * B + 20 * C <= 10000)\n## The total production capacity of the company is limited to 200 units per month.\nmodel.addCons(A + B + C <= 200)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Component A: \", model.getVal(A))\n    print(\"Number of Component B: \", model.getVal(B))\n    print(\"Number of Component C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1119,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season.\n// {\"amount of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"real\"}\n// {\"amount of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"real\"}\n// {\"amount of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor Crop A, the selling price is $2 per unit, the cost of seeds is $0.5 per unit, and the water consumption is 3 liters per unit. \nFor Crop B, the selling price is $3 per unit, the cost of seeds is $1 per unit, and the water consumption is 5 liters per unit. \nFor Crop C, the selling price is $4 per unit, the cost of seeds is $1.5 per unit, and the water consumption is 7 liters per unit.\nThe farmer aims to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\n// Net profit of A: Profit_A = (2 - 0.5) * A\n// Net profit of B: Profit_B = (3 - 1) * B\n// Net profit of C: Profit_C = (4 - 1.5) * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (3 * A + 5 * B + 7 * C)\n\n## Generate Constraint-1:\nThe farmer has a budget of $500 for seeds.\n// 0.5 * A + 1 * B + 1.5 * C <= 500\n\n## Generate Constraint-2:\nThe farmer wants to plant at least 50 units of each crop.\n// A >= 50; B >= 50; C >= 50",
        "question": "A farmer grows three types of crops: A, B, and C. The farmer needs to decide how much of each crop to plant in the upcoming season. The selling price, cost of seeds, and water consumption for each crop are given in the following Table.\n\n| Crop | Selling Price | Cost of Seeds | Water Consumption |\n|------|---------------|---------------|-------------------|\n| A    | $2            | $0.5          | 3 liters          |\n| B    | $3            | $1            | 5 liters          |\n| C    | $4            | $1.5          | 7 liters          |\n\nThe farmer has a budget of $500 for seeds. The farmer wants to plant at least 50 units of each crop. Please help the farmer to maximize the net profit per liter of water used (which is defined as the sum of the net profits divided by the sum of the water consumption).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farmer wants to plant at least 50 units of each crop.\nA = model.addVar(vtype=\"CONTINUOUS\", name=\"A\", lb=50) # amount of crop A\nB = model.addVar(vtype=\"CONTINUOUS\", name=\"B\", lb=50) # amount of crop B\nC = model.addVar(vtype=\"CONTINUOUS\", name=\"C\", lb=50) # amount of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (2 - 0.5) * A\nProfit_B = (3 - 1) * B\nProfit_C = (4 - 1.5) * C\nWaterConsumption = 3 * A + 5 * B + 7 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterConsumption\n## convert the division to multiplication\nmodel.addCons(obj * WaterConsumption == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farmer has a budget of $500 for seeds.\nmodel.addCons(0.5 * A + 1 * B + 1.5 * C <= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Crop A: \", model.getVal(A))\n    print(\"Amount of Crop B: \", model.getVal(B))\n    print(\"Amount of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 811,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic devices: A, B, and C. They need to determine the production quantities of each device to optimize their profit while considering the cost of raw materials and the efficiency of production.\n// {\"quantity of Device A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of Device C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Device A is $100, for Device B is $150, and for Device C is $200. However, due to economies of scale, the cost of production decreases as the quantity produced increases. For each device, if the production quantity exceeds 100 units, the cost per unit decreases by $0.5 for every additional unit produced. The company wants to maximize the total profit from selling the devices.\n// Cost_A = max(100 - 0.5 * (A - 100), 100) * A\n// Cost_B = max(150 - 0.5 * (B - 100), 150) * B\n// Cost_C = max(200 - 0.5 * (C - 100), 200) * C\n// So, the objective function is: Maximize (100 * A - Cost_A) + (150 * B - Cost_B) + (200 * C - Cost_C)\n\n## Generate Constraint-1:\nThe company has a limited supply of a critical component used in all devices. The component usage for Device A is 2 units, for Device B is 3 units, and for Device C is 4 units. The total supply of this component is 1000 units.\n// 2 * A + 3 * B + 4 * C <= 1000\n\n## Generate Constraint-2:\nThe market has a demand limit for each device. For Device A, the demand limit is 500 units. For Device B, the demand limit is 400 units. For Device C, the demand limit is 300 units.\n// A <= 500; B <= 400; C <= 300\n\n## Generate Constraint-3:\nThe company has a production capacity limit of 1200 units in total for all devices.\n// A + B + C <= 1200\n\n## Generate Constraint-4:\nThe production of Device B must be at least half the production of Device A.\n// B >= 0.5 * A",
        "question": "A manufacturing company produces three types of electronic devices: A, B, and C. They need to determine the production quantities of each device to optimize their profit while considering the cost of raw materials and the efficiency of production. The profit per unit of Device A is $100, for Device B is $150, and for Device C is $200. However, due to economies of scale, the cost of production decreases as the quantity produced increases. For each device, if the production quantity exceeds 100 units, the cost per unit decreases by $0.5 for every additional unit produced. The company has a limited supply of a critical component used in all devices. The component usage for Device A is 2 units, for Device B is 3 units, and for Device C is 4 units. The total supply of this component is 1000 units. The market has a demand limit for each device. For Device A, the demand limit is 500 units. For Device B, the demand limit is 400 units. For Device C, the demand limit is 300 units. The company has a production capacity limit of 1200 units in total for all devices. The production of Device B must be at least half the production of Device A. Please help the company to maximize the total profit from selling the devices.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0, ub=500) # quantity of Device A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0, ub=400) # quantity of Device B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0, ub=300) # quantity of Device C\n\n# Define objective function\n## create piecewise variables for piecewise function: Cost_A = max(100 - 0.5 * (A - 100), 100) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nCost_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 100)) * A2 * A_b2\n## create piecewise variables for piecewise function: Cost_B = max(150 - 0.5 * (B - 100), 150) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=100)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=100, ub=400)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nCost_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 100)) * B2 * B_b2\n## create piecewise variables for piecewise function: Cost_C = max(200 - 0.5 * (C - 100), 200) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=100)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=100, ub=300)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nCost_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 100)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize (100 * A - Cost_A) + (150 * B - Cost_B) + (200 * C - Cost_C)\nmodel.addCons(obj == (100 * A - Cost_A) + (150 * B - Cost_B) + (200 * C - Cost_C))\n\n# Add constraints\nmodel.addCons(2 * A + 3 * B + 4 * C <= 1000)\nmodel.addCons(A <= 500)\nmodel.addCons(B <= 400)\nmodel.addCons(C <= 300)\nmodel.addCons(A + B + C <= 1200)\nmodel.addCons(B >= 0.5 * A)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Device A: \", model.getVal(A))\n    print(\"Quantity of Device B: \", model.getVal(B))\n    print(\"Quantity of Device C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1225,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations.\n// {\"amount of Product A produced\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"amount of Product B produced\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"amount of Product C produced\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of Product A is $50, but it incurs a variable cost of $20 per unit.\nThe profit per unit of Product B is $70, but it incurs a variable cost of $30 per unit.\nThe profit per unit of Product C is $60, but it incurs a variable cost of $25 per unit.\nThe company aims to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n// Total revenue: Revenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\n// Total variable cost: Cost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n// So, the objective function is: Maximize (Revenue - Cost)\n\n## Generate Constraint-1:\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120.\n// 100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000\n\n## Generate Constraint-2:\nThe company has a labor constraint, with a maximum of 800 labor hours available per month. Each unit of Product A requires 2 hours, Product B requires 3 hours, and Product C requires 2.5 hours.\n// 2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800\n\n## Generate Constraint-3:\nThe company must produce at least 50 units of each product to meet contractual obligations.\n// ProductA >= 50\n// ProductB >= 50\n// ProductC >= 50\n\n## Generate Constraint-4:\nThe company aims to balance its product mix to maintain market share. No more than 40% of the total production can be of any single product.\n// ProductA <= 0.4 * (ProductA + ProductB + ProductC)\n// ProductB <= 0.4 * (ProductA + ProductB + ProductC)\n// ProductC <= 0.4 * (ProductA + ProductB + ProductC)",
        "question": "A company is planning to optimize its production of three products (Product A, Product B, and Product C) to maximize profit while considering production costs and resource limitations. The profit per unit, variable cost per unit, and labor hours required for each product are given in the following Table.\n\n| Product | Profit per Unit | Variable Cost per Unit | Labor Hours Required |\n|---------|-----------------|------------------------|----------------------|\n| A       | $50             | $20                    | 2                    |\n| B       | $70             | $30                    | 3                    |\n| C       | $60             | $25                    | 2.5                  |\n\nThe company has a limited supply of raw materials, which costs $10,000 per month. Each unit of Product A requires $100 of raw materials, Product B requires $150, and Product C requires $120. The company has a labor constraint, with a maximum of 800 labor hours available per month. The company must produce at least 50 units of each product to meet contractual obligations. Additionally, the company aims to balance its product mix to maintain market share, with no more than 40% of the total production being of any single product.\n\nPlease help the company to maximize the total net profit, which is the difference between the total revenue and the total variable cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=50)  # amount of Product A produced\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=50)  # amount of Product B produced\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=50)  # amount of Product C produced\n\n# Define objective function\nRevenue = 50 * ProductA + 70 * ProductB + 60 * ProductC\nCost = 20 * ProductA + 30 * ProductB + 25 * ProductC\n# So, the objective function is: Maximize (Revenue - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Revenue - Cost)\n\n# Add constraints\n# The company has a limited supply of raw materials, which costs $10,000 per month.\nmodel.addCons(100 * ProductA + 150 * ProductB + 120 * ProductC <= 10000)\n# The company has a labor constraint, with a maximum of 800 labor hours available per month.\nmodel.addCons(2 * ProductA + 3 * ProductB + 2.5 * ProductC <= 800)\n# The company must produce at least 50 units of each product to meet contractual obligations.\nmodel.addCons(ProductA >= 50)\nmodel.addCons(ProductB >= 50)\nmodel.addCons(ProductC >= 50)\n# The company aims to balance its product mix to maintain market share.\nmodel.addCons(ProductA <= 0.4 * (ProductA + ProductB + ProductC))\nmodel.addCons(ProductB <= 0.4 * (ProductA + ProductB + ProductC))\nmodel.addCons(ProductC <= 0.4 * (ProductA + ProductB + ProductC))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of Product A produced: \", model.getVal(ProductA))\n    print(\"Amount of Product B produced: \", model.getVal(ProductB))\n    print(\"Amount of Product C produced: \", model.getVal(ProductC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1368,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of C1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"real\"}\n// {\"acres of C2\": \"C2\", \"range\": \"C2 >= 0\", \"type\": \"real\"}\n// {\"acres of C3\": \"C3\", \"range\": \"C3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre.\n// Profit_C1 = (5 * 100 - 50) * C1\n// Profit_C2 = (6 * 120 - 60) * C2\n// Profit_C3 = (7 * 140 - 70) * C3\n// So, the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// C1 + C2 + C3 <= 100",
        "question": "A farmer grows three types of crops: C1, C2, and C3. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\nFor C1, the yield per acre is 5 tons, the price per ton is $100, and the cost per acre is $50. \nFor C2, the yield per acre is 6 tons, the price per ton is $120, and the cost per acre is $60. \nFor C3, the yield per acre is 7 tons, the price per ton is $140, and the cost per acre is $70.\nThe farmer wants to maximize the net profit per acre. The farmer has a total of 100 acres available for cultivation.\nPlease help the farmer determine the optimal allocation of acres to each crop to maximize the net profit per acre.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nC1 = model.addVar(vtype=\"CONTINUOUS\", name=\"C1\", lb=0) # acres of C1\nC2 = model.addVar(vtype=\"CONTINUOUS\", name=\"C2\", lb=0) # acres of C2\nC3 = model.addVar(vtype=\"CONTINUOUS\", name=\"C3\", lb=0) # acres of C3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_C1 = (5 * 100 - 50) * C1\nProfit_C2 = (6 * 120 - 60) * C2\nProfit_C3 = (7 * 140 - 70) * C3\nTotalAcres = C1 + C2 + C3\n## the objective function is: Maximize (Profit_C1 + Profit_C2 + Profit_C3) / TotalAcres\n## convert the division to multiplication\nmodel.addCons(obj * TotalAcres == Profit_C1 + Profit_C2 + Profit_C3)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(C1 + C2 + C3 <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of C1: \", model.getVal(C1))\n    print(\"Acres of C2: \", model.getVal(C2))\n    print(\"Acres of C3: \", model.getVal(C3))\n    print(\"Maximized Net Profit per Acre: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 675,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation.\n// {\"acres of wheat\": \"W\", \"range\": \"W >= 0\", \"type\": \"integer\"}\n// {\"acres of corn\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n// {\"acres of soybeans\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for wheat is $200, for corn is $300, and for soybeans is $150. The farmer also incurs costs for water usage, where wheat requires 5 units of water per acre, corn requires 8 units, and soybeans require 3 units. The farmer aims to maximize the net profit per unit of water used.\n// Profit from wheat: Profit_W = 200 * W\n// Profit from corn: Profit_C = 300 * C\n// Profit from soybeans: Profit_S = 150 * S\n// Water usage for wheat: Water_W = 5 * W\n// Water usage for corn: Water_C = 8 * C\n// Water usage for soybeans: Water_S = 3 * S\n// So, the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (Water_W + Water_C + Water_S)\n\n## Generate Constraint-1:\nThe farmer has a total of 100 acres available for cultivation.\n// W + C + S <= 100",
        "question": "A farmer grows three types of crops: wheat, corn, and soybeans. The farmer needs to decide how many acres to allocate to each crop to optimize their farming operation. The profit per acre and water usage for each crop are given in the following Table.\n\n| Crop     | Profit per Acre | Water Usage per Acre |\n|----------|-----------------|----------------------|\n| Wheat    | $200            | 5 units              |\n| Corn     | $300            | 8 units              |\n| Soybeans | $150            | 3 units              |\n\nThe farmer has a total of 100 acres available for cultivation. The farmer aims to maximize the net profit per unit of water used. Please help the farmer determine the optimal allocation of acres to wheat, corn, and soybeans.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW = model.addVar(vtype=\"INTEGER\", name=\"W\", lb=0) # acres of wheat\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of corn\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # acres of soybeans\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_W = 200 * W\nProfit_C = 300 * C\nProfit_S = 150 * S\nWater_W = 5 * W\nWater_C = 8 * C\nWater_S = 3 * S\n## the objective function is: Maximize (Profit_W + Profit_C + Profit_S) / (Water_W + Water_C + Water_S)\n## convert the division to multiplication\nmodel.addCons(obj * (Water_W + Water_C + Water_S) == Profit_W + Profit_C + Profit_S)\n\n# Add constraints\n## The farmer has a total of 100 acres available for cultivation.\nmodel.addCons(W + C + S <= 100)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat: \", model.getVal(W))\n    print(\"Acres of Corn: \", model.getVal(C))\n    print(\"Acres of Soybeans: \", model.getVal(S))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 748,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\n// {\"number of vehicles A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of vehicles C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The fuel cost is a significant factor in the company's operational costs.\n// Cargo carried by A: Cargo_A = 10 * A\n// Cargo carried by B: Cargo_B = 15 * B\n// Cargo carried by C: Cargo_C = 20 * C\n// Fuel consumed by A: Fuel_A = 5 * A\n// Fuel consumed by B: Fuel_B = 7 * B\n// Fuel consumed by C: Fuel_C = 9 * C\n// So, the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for vehicle fuel for the month.\n// 5 * A + 7 * B + 9 * C <= 10000\n\n## Generate Constraint-2:\nThe company has a maintenance capacity for at most 50 vehicles per month.\n// A + B + C <= 50\n\n## Generate Constraint-3:\nThe company needs to ensure that at least 500 tons of cargo are carried each month.\n// 10 * A + 15 * B + 20 * C >= 500",
        "question": "A logistics company operates three types of vehicles: A, B, and C. The company needs to determine the number of each type of vehicle to deploy for the upcoming month to optimize its operations.\nVehicle A can carry 10 tons of cargo and consumes 5 liters of fuel per trip. \nVehicle B can carry 15 tons of cargo and consumes 7 liters of fuel per trip. \nVehicle C can carry 20 tons of cargo and consumes 9 liters of fuel per trip.\nThe company aims to maximize the total cargo carried per liter of fuel consumed. The company has a budget of $10,000 for vehicle fuel for the month. The company has a maintenance capacity for at most 50 vehicles per month. The company needs to ensure that at least 500 tons of cargo are carried each month.\nPlease help the company to maximize the total cargo carried per liter of fuel consumed.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of vehicles A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of vehicles B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of vehicles C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nCargo_A = 10 * A\nCargo_B = 15 * B\nCargo_C = 20 * C\nFuel_A = 5 * A\nFuel_B = 7 * B\nFuel_C = 9 * C\n## the objective function is: Maximize (Cargo_A + Cargo_B + Cargo_C) / (Fuel_A + Fuel_B + Fuel_C)\n## convert the division to multiplication\nmodel.addCons(obj * (Fuel_A + Fuel_B + Fuel_C) == Cargo_A + Cargo_B + Cargo_C)\n\n# Add constraints\n## The company has a budget of $10,000 for vehicle fuel for the month.\nmodel.addCons(5 * A + 7 * B + 9 * C <= 10000)\n## The company has a maintenance capacity for at most 50 vehicles per month.\nmodel.addCons(A + B + C <= 50)\n## The company needs to ensure that at least 500 tons of cargo are carried each month.\nmodel.addCons(10 * A + 15 * B + 20 * C >= 500)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Vehicles A: \", model.getVal(A))\n    print(\"Number of Vehicles B: \", model.getVal(B))\n    print(\"Number of Vehicles C: \", model.getVal(C))\n    print(\"Maximized Cargo per Fuel: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 821,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency.\n// {\"hours for Product 1\": \"H1\", \"range\": \"H1 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 2\": \"H2\", \"range\": \"H2 >= 0\", \"type\": \"continuous\"}\n// {\"hours for Product 3\": \"H3\", \"range\": \"H3 >= 0\", \"type\": \"continuous\"}\n// {\"investment in production efficiency\": \"Efficiency\", \"range\": \"Efficiency >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe production rate for each product depends on the investment in efficiency. For every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n// Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n// Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n// Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n// So, the objective function is: Minimize max(T1, T2, T3)\n\n## Generate Constraint-1:\nThe total available hours for production in a week is 40 hours.\n// H1 + H2 + H3 <= 40\n\n## Generate Constraint-2:\nThe investment in production efficiency cannot exceed $50,000.\n// Efficiency <= 50000\n\n## Generate Constraint-3:\nAt least 10 hours must be allocated for each product.\n// H1 >= 10; H2 >= 10; H3 >= 10",
        "question": "A manufacturing company produces three types of products using a single production line. The company needs to decide the number of hours to allocate for each product type and the investment in enhancing the production line's efficiency. The production rate for each product depends on the investment in efficiency, where for every $1000 invested, the production rate increases by 1 unit per hour. The initial production rate is 10 units per hour. The company aims to minimize the total production time to meet the demand of 1000 units for each product.\n\nThe company has a total of 40 hours available for production in a week. The investment in production efficiency cannot exceed $50,000. At least 10 hours must be allocated for each product.\n\nPlease help the company to determine the optimal allocation of hours for each product and the investment in production efficiency to minimize the maximum production time for any of the three products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nH1 = model.addVar(vtype=\"CONTINUOUS\", name=\"H1\", lb=10) # hours for Product 1\nH2 = model.addVar(vtype=\"CONTINUOUS\", name=\"H2\", lb=10) # hours for Product 2\nH3 = model.addVar(vtype=\"CONTINUOUS\", name=\"H3\", lb=10) # hours for Product 3\nEfficiency = model.addVar(vtype=\"CONTINUOUS\", name=\"Efficiency\", lb=0) # investment in production efficiency\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n## Production time for Product 1: T1 = 1000 / (10 + 0.001 * Efficiency) * H1\n## Production time for Product 2: T2 = 1000 / (10 + 0.001 * Efficiency) * H2\n## Production time for Product 3: T3 = 1000 / (10 + 0.001 * Efficiency) * H3\n## So, the objective function is: Minimize max(T1, T2, T3)\nT1 = 1000 / (10 + 0.001 * Efficiency) * H1\nT2 = 1000 / (10 + 0.001 * Efficiency) * H2\nT3 = 1000 / (10 + 0.001 * Efficiency) * H3\nmodel.addCons(obj >= T1)\nmodel.addCons(obj >= T2)\nmodel.addCons(obj >= T3)\n\n# Add constraints\n## The total available hours for production in a week is 40 hours.\nmodel.addCons(H1 + H2 + H3 <= 40)\n## The investment in production efficiency cannot exceed $50,000.\nmodel.addCons(Efficiency <= 50000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hours for Product 1: \", model.getVal(H1))\n    print(\"Hours for Product 2: \", model.getVal(H2))\n    print(\"Hours for Product 3: \", model.getVal(H3))\n    print(\"Investment in Production Efficiency: \", model.getVal(Efficiency))\n    print(\"Minimized Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 944,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of smartphones\": \"S\", \"range\": \"S >= 0\", \"type\": \"integer\"}\n// {\"number of tablets\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of laptops\": \"L\", \"range\": \"L >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The company wants to maximize its total profit.\n// The objective function is: Maximize P = 100S + 150T + 200L\n\n## Generate Constraint-1:\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced.\n// S <= 1000; T <= 1000; L <= 1000\n\n## Generate Constraint-2:\nThe total production capacity across all devices is limited to 2000 units.\n// S + T + L <= 2000\n\n## Generate Constraint-3:\nThe market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\n// S >= 500; T >= 300; L >= 400\n\n## Generate Constraint-4:\nThe company has a policy to produce at least twice as many smartphones as tablets.\n// S >= 2T\n\n## Generate Constraint-5:\nThe production of laptops must not exceed the combined production of smartphones and tablets.\n// L <= S + T",
        "question": "A company manufactures three types of electronic devices: smartphones, tablets, and laptops. The company needs to decide how many units of each device to produce to maximize profit while considering the production capacity and market demand. The profit per unit for smartphones is $100, for tablets is $150, and for laptops is $200. The following table summarizes the profit per unit for each device:\n\n| Device     | Profit per Unit |\n|------------|-----------------|\n| Smartphones| 100$            |\n| Tablets    | 150$            |\n| Laptops    | 200$            |\n\nThe production capacity allows for a maximum of 1000 units of any single device type to be produced. The total production capacity across all devices is limited to 2000 units. The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units. The company has a policy to produce at least twice as many smartphones as tablets. The production of laptops must not exceed the combined production of smartphones and tablets.\n\nPlease help the company to maximize its total profit by determining the optimal number of units to produce for each device type.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS = model.addVar(vtype=\"INTEGER\", name=\"S\", lb=0) # number of smartphones\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of tablets\nL = model.addVar(vtype=\"INTEGER\", name=\"L\", lb=0) # number of laptops\n\n# Define objective function\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == 100*S + 150*T + 200*L)\n\n# Add constraints\n# The production capacity allows for a maximum of 1000 units of any single device type to be produced.\nmodel.addCons(S <= 1000)\nmodel.addCons(T <= 1000)\nmodel.addCons(L <= 1000)\n\n# The total production capacity across all devices is limited to 2000 units.\nmodel.addCons(S + T + L <= 2000)\n\n# The market demand for smartphones is at least 500 units, for tablets is at least 300 units, and for laptops is at least 400 units.\nmodel.addCons(S >= 500)\nmodel.addCons(T >= 300)\nmodel.addCons(L >= 400)\n\n# The company has a policy to produce at least twice as many smartphones as tablets.\nmodel.addCons(S >= 2*T)\n\n# The production of laptops must not exceed the combined production of smartphones and tablets.\nmodel.addCons(L <= S + T)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Smartphones: \", model.getVal(S))\n    print(\"Number of Tablets: \", model.getVal(T))\n    print(\"Number of Laptops: \", model.getVal(L))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1181,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $30, product B is $45, and product C is $60. The production cost per unit of product A is $10, product B is $20, and product C is $30. The storage cost per unit is $5 for all products. The company aims to maximize the total profit after deducting both production and storage costs.\n// Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n// Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n// Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 for production costs.\n// 10 * A + 20 * B + 30 * C <= 10000",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to determine the production quantities of each product to optimize their profit while considering the cost of production and storage. The profit per unit, production cost per unit, and storage cost per unit for each product are given in the following Table.\n\n| Product | Profit per Unit | Production Cost per Unit | Storage Cost per Unit |\n|---------|-----------------|--------------------------|-----------------------|\n| A       | $30             | $10                      | $5                    |\n| B       | $45             | $20                      | $5                    |\n| C       | $60             | $30                      | $5                    |\n\nThe company has a budget of $10,000 for production costs. The company aims to maximize the total profit after deducting both production and storage costs. Please help the company determine the optimal production quantities for products A, B, and C.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## Profit per unit of A: Profit_A = (30 - 10 - 5) * A = 15 * A\n## Profit per unit of B: Profit_B = (45 - 20 - 5) * B = 20 * B\n## Profit per unit of C: Profit_C = (60 - 30 - 5) * C = 25 * C\n## So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\nmodel.addCons(obj == 15 * A + 20 * B + 25 * C)\n\n# Add constraints\n## The company has a budget of $10,000 for production costs.\nmodel.addCons(10 * A + 20 * B + 30 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1002,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints.\n// {\"quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $10, but it decreases by $0.02 for each unit produced beyond the first 100 units. The profit per unit of product B is $15, but it decreases by $0.015 for each unit produced beyond the first 150 units. The profit per unit of product C is $20, but it decreases by $0.01 for each unit produced beyond the first 200 units. The company aims to maximize the total profit from selling these products.\n// Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\n// Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\n// Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe total production cost for all products must not exceed $1000. The cost per unit of product A is $3, product B is $5, and product C is $7.\n// 3 * A + 5 * B + 7 * C <= 1000\n\n## Generate Constraint-2:\nThe company has a storage capacity limit of 500 units for all products combined.\n// A + B + C <= 500\n\n## Generate Constraint-3:\nThe market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C.\n// A >= 50; B >= 75\n\n## Generate Constraint-4:\nThe company has a labor constraint where the total hours required for production must not exceed 800 hours. Product A requires 2 hours per unit, product B requires 3 hours per unit, and product C requires 4 hours per unit.\n// 2 * A + 3 * B + 4 * C <= 800",
        "question": "A manufacturer produces three types of products: A, B, and C. The company needs to determine the optimal production quantities for each product to maximize profit while considering various constraints. The profit per unit and production costs for each product are given in the following Table.\n\n| Product | Profit per Unit | Cost per Unit | Production Time per Unit |\n|---------|-----------------|---------------|--------------------------|\n| A       | $10, decreasing by $0.02 per unit beyond 100 units | $3 | 2 hours |\n| B       | $15, decreasing by $0.015 per unit beyond 150 units | $5 | 3 hours |\n| C       | $20, decreasing by $0.01 per unit beyond 200 units | $7 | 4 hours |\n\nThe total production cost for all products must not exceed $1000. The company has a storage capacity limit of 500 units for all products combined. The market demand for product A is at least 50 units and for product B is at least 75 units. There is no minimum demand specified for product C. The company has a labor constraint where the total hours required for production must not exceed 800 hours. \n\nPlease help the company to maximize the total profit from selling these products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=50) # quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=75) # quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # quantity of product C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (10 - 0.02 * max(A - 100, 0)) * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=100)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=100, ub=500)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = (10 - 0.02 * A2) * A2 * A_b2 + 10 * A1 * A_b1\n## create piecewise variables for piecewise function: Profit_B = (15 - 0.015 * max(B - 150, 0)) * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=150)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=150, ub=500)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = (15 - 0.015 * B2) * B2 * B_b2 + 15 * B1 * B_b1\n## create piecewise variables for piecewise function: Profit_C = (20 - 0.01 * max(C - 200, 0)) * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=200)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=200, ub=500)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = (20 - 0.01 * C2) * C2 * C_b2 + 20 * C1 * C_b1\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(3 * A + 5 * B + 7 * C <= 1000)\nmodel.addCons(A + B + C <= 500)\nmodel.addCons(2 * A + 3 * B + 4 * C <= 800)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(A))\n    print(\"Quantity of Product B: \", model.getVal(B))\n    print(\"Quantity of Product C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1166,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost.\n// Net Profit = 50A - Cost_A(A) + 70B - Cost_B(B) + 90C - Cost_C(C)\n// So, the objective function is: Maximize Net Profit\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per day.\n// A + B + C <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per day.\n// A >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per day.\n// B >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide how many units of each product to produce to maximize profit while considering the production capacity and market demand.\nThe profit per unit for product A is $50, for product B is $70, and for product C is $90. However, the production cost per unit for each product is a nonlinear function of the number of units produced, given by:\n- Cost_A(A) = 100 - 0.5A^2\n- Cost_B(B) = 120 - 0.4B^2\n- Cost_C(C) = 150 - 0.3C^2\nThe company wants to maximize the total net profit, which is the sum of the profits from selling each product minus the total production cost.\nThe total production capacity of the company is limited to 1000 units per day. The market demand for product A is at least 200 units per day. The market demand for product B is at least 150 units per day.\nPlease help the company to determine the optimal number of units of products A, B, and C to produce each day to maximize the total net profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=200) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=150) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## calculate the cost functions\nCost_A = 100 - 0.5 * A**2\nCost_B = 120 - 0.4 * B**2\nCost_C = 150 - 0.3 * C**2\n## calculate the net profit\nNet_Profit = 50 * A - Cost_A + 70 * B - Cost_B + 90 * C - Cost_C\n## the objective function is: Maximize Net Profit\nmodel.addCons(obj == Net_Profit)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per day.\nmodel.addCons(A + B + C <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1004,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops.\n// Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\n// Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\n// Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\n// So, the objective function is: Maximize Profit_A + Profit_B + Profit_C\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $5000 for seeds and fertilizers. The cost per acre for crop A is $30, for crop B is $40, and for crop C is $50.\n// 30 * A + 40 * B + 50 * C <= 5000\n\n## Generate Constraint-3:\nThe farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health.\n// A >= 10; B >= 10; C >= 10\n\n## Generate Constraint-4:\nDue to market demand, the farm cannot produce more than 50 acres of crop A and 60 acres of crop B.\n// A <= 50; B <= 60",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many acres to allocate to each crop to optimize its profit and resource usage. The profit per acre for crop A is $100, for crop B is $150, and for crop C is $200. However, due to soil degradation, the profit per acre decreases by $0.5 for each acre of the same crop planted in consecutive years. The farm aims to maximize the total profit from all crops. The farm has a total of 100 acres available for cultivation. The farm has a budget of $5000 for seeds and fertilizers, with costs per acre of $30 for crop A, $40 for crop B, and $50 for crop C. The farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health. Additionally, due to market demand, the farm cannot produce more than 50 acres of crop A and 60 acres of crop B. Please help the farm determine the optimal allocation of acres to each crop to maximize its total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm must allocate at least 10 acres to each crop to maintain crop diversity and soil health.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10) # acres of crop C\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_A = (100 - 0.5 * (A - 1)) * A if A > 0 else 100 * A\nA1 = model.addVar(vtype=\"INTEGER\", name=\"A1\", lb=0, ub=10)\nA2 = model.addVar(vtype=\"INTEGER\", name=\"A2\", lb=10, ub=50)\nA_b1 = model.addVar(vtype=\"B\", name=\"A_b1\")\nA_b2 = model.addVar(vtype=\"B\", name=\"A_b2\")\nmodel.addCons(A_b1 + A_b2 == 1)\nmodel.addCons(A == A1*A_b1 + A2*A_b2)\nProfit_A = 100 * A1 * A_b1 + (100 - 0.5 * (A2 - 1)) * A2 * A_b2\n## create piecewise variables for piecewise function: Profit_B = (150 - 0.5 * (B - 1)) * B if B > 0 else 150 * B\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0, ub=10)\nB2 = model.addVar(vtype=\"INTEGER\", name=\"B2\", lb=10, ub=60)\nB_b1 = model.addVar(vtype=\"B\", name=\"B_b1\")\nB_b2 = model.addVar(vtype=\"B\", name=\"B_b2\")\nmodel.addCons(B_b1 + B_b2 == 1)\nmodel.addCons(B == B1*B_b1 + B2*B_b2)\nProfit_B = 150 * B1 * B_b1 + (150 - 0.5 * (B2 - 1)) * B2 * B_b2\n## create piecewise variables for piecewise function: Profit_C = (200 - 0.5 * (C - 1)) * C if C > 0 else 200 * C\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0, ub=10)\nC2 = model.addVar(vtype=\"INTEGER\", name=\"C2\", lb=10, ub=100)\nC_b1 = model.addVar(vtype=\"B\", name=\"C_b1\")\nC_b2 = model.addVar(vtype=\"B\", name=\"C_b2\")\nmodel.addCons(C_b1 + C_b2 == 1)\nmodel.addCons(C == C1*C_b1 + C2*C_b2)\nProfit_C = 200 * C1 * C_b1 + (200 - 0.5 * (C2 - 1)) * C2 * C_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_A + Profit_B + Profit_C\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(A + B + C <= 100)\nmodel.addCons(30 * A + 40 * B + 50 * C <= 5000)\nmodel.addCons(A <= 50)\nmodel.addCons(B <= 60)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 942,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line.\n// {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n// {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n// The production time for component A: TA = 800 / (10 * WA)\n// The production time for component B: TB = 1200 / (15 * WB)\n// The production time for component C: TC = 1600 / (20 * WC)\n// So, the objective function is: Minimize max(TA, TB, TC)\n\n## Generate Constraint-1:\nThere are a total of 50 skilled workers available.\n// WA + WB + WC <= 50\n\n## Generate Constraint-2:\nEach production line can accommodate up to 25 workers.\n// WA <= 25; WB <= 25; WC <= 25\n\n## Generate Constraint-3:\nThe production of component B must be at least twice the production of component A.\n// 15 * WB >= 2 * (10 * WA)",
        "question": "A manufacturer produces three types of electronic components: A, B, and C. The production rate of each component varies depending on the number of skilled workers assigned to each production line. The production rates are as follows: Each worker on line A can produce 10 units of component A per hour, each worker on line B can produce 15 units of component B per hour, and each worker on line C can produce 20 units of component C per hour. The manufacturer needs to meet a weekly demand of at least 800 units of component A, 1200 units of component B, and 1600 units of component C. The goal is to minimize the total production time while meeting these demands.\n\n| Component | Production Rate per Worker (units/hour) |\n|-----------|-----------------------------------------|\n| A         | 10                                      |\n| B         | 15                                      |\n| C         | 20                                      |\n\nThere are a total of 50 skilled workers available. Each production line can accommodate up to 25 workers. The production of component B must be at least twice the production of component A.\n\nPlease help the manufacturer to minimize the maximum of the production times for components A, B, and C (defined as TA = 800 / (10 * WA), TB = 1200 / (15 * WB), and TC = 1600 / (20 * WC)).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## {\"number of workers on production line A\": \"WA\", \"range\": \"WA >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line B\": \"WB\", \"range\": \"WB >= 0\", \"type\": \"integer\"}\n## {\"number of workers on production line C\": \"WC\", \"range\": \"WC >= 0\", \"type\": \"integer\"}\nWA = model.addVar(vtype=\"INTEGER\", name=\"WA\", lb=0) # number of workers on production line A\nWB = model.addVar(vtype=\"INTEGER\", name=\"WB\", lb=0) # number of workers on production line B\nWC = model.addVar(vtype=\"INTEGER\", name=\"WC\", lb=0) # number of workers on production line C\n\n# Define objective function\n## The production time for component A: TA = 800 / (10 * WA)\n## The production time for component B: TB = 1200 / (15 * WB)\n## The production time for component C: TC = 1600 / (20 * WC)\n## So, the objective function is: Minimize max(TA, TB, TC)\nTA = model.addVar(name=\"TA\")\nTB = model.addVar(name=\"TB\")\nTC = model.addVar(name=\"TC\")\nmax_time = model.addVar(name=\"max_time\")\nmodel.setObjective(max_time, \"minimize\")\nmodel.addCons(TA == 800 / (10 * WA))\nmodel.addCons(TB == 1200 / (15 * WB))\nmodel.addCons(TC == 1600 / (20 * WC))\nmodel.addCons(max_time >= TA)\nmodel.addCons(max_time >= TB)\nmodel.addCons(max_time >= TC)\n\n# Add constraints\n## There are a total of 50 skilled workers available.\nmodel.addCons(WA + WB + WC <= 50)\n## Each production line can accommodate up to 25 workers.\nmodel.addCons(WA <= 25)\nmodel.addCons(WB <= 25)\nmodel.addCons(WC <= 25)\n## The production of component B must be at least twice the production of component A.\nmodel.addCons(15 * WB >= 2 * (10 * WA))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Workers on Production Line A: \", model.getVal(WA))\n    print(\"Number of Workers on Production Line B: \", model.getVal(WB))\n    print(\"Number of Workers on Production Line C: \", model.getVal(WC))\n    print(\"Minimum Max Production Time: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1325,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season.\n// {\"hectares of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"hectares of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Crop A, the expected revenue per hectare is $1000, the cost of seeds per hectare is $300, and the water requirement is 5000 liters.\nFor Crop B, the expected revenue per hectare is $1500, the cost of seeds per hectare is $500, and the water requirement is 7000 liters.\nFor Crop C, the expected revenue per hectare is $2000, the cost of seeds per hectare is $700, and the water requirement is 9000 liters.\nThe farm aims to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n// Net revenue of A: Net_A = (1000 - 300) * A\n// Net revenue of B: Net_B = (1500 - 500) * B\n// Net revenue of C: Net_C = (2000 - 700) * C\n// So, the objective function is: Maximize (Net_A + Net_B + Net_C) / (5000 * A + 7000 * B + 9000 * C)\n\n## Generate Constraint-1:\nThe farm has a budget of $10000 for seeds for the upcoming season.\n// 300 * A + 500 * B + 700 * C <= 10000\n\n## Generate Constraint-2:\nThe farm wants to allocate at least 5 hectares to each crop for the upcoming season.\n// A >= 5; B >= 5; C >= 5",
        "question": "A farm grows three types of crops: A, B, and C. The farm needs to decide how many hectares to allocate to each crop for the upcoming season. The expected revenue per hectare, cost of seeds per hectare, and water requirement for each crop are given in the following Table.\n\n| Crop | Expected Revenue per Hectare | Cost of Seeds per Hectare | Water Requirement per Hectare |\n|------|-------------------------------|---------------------------|-------------------------------|\n| A    | $1000                         | $300                      | 5000 liters                   |\n| B    | $1500                         | $500                      | 7000 liters                   |\n| C    | $2000                         | $700                      | 9000 liters                   |\n\nThe farm has a budget of $10000 for seeds for the upcoming season. The farm wants to allocate at least 5 hectares to each crop for the upcoming season. Please help the farm to maximize the net revenue per liter of water used (which is defined as the sum of the net revenues divided by the sum of the water requirements).\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## The farm wants to allocate at least 5 hectares to each crop for the upcoming season.\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=5) # hectares of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=5) # hectares of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=5) # hectares of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nNet_A = (1000 - 300) * A\nNet_B = (1500 - 500) * B\nNet_C = (2000 - 700) * C\nWaterUsage = 5000 * A + 7000 * B + 9000 * C\n## the objective function is: Maximize (Net_A + Net_B + Net_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Net_A + Net_B + Net_C)\n\n# Add constraints\n## The farm has a budget of $10000 for seeds for the upcoming season.\nmodel.addCons(300 * A + 500 * B + 700 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Hectares of Crop A: \", model.getVal(A))\n    print(\"Hectares of Crop B: \", model.getVal(B))\n    print(\"Hectares of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Revenue per Liter of Water: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1098,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\n// {\"acres of crop A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"acres of crop B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"acres of crop C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\n// Profit of A: Profit_A = 500 * A - 200 * A\n// Profit of B: Profit_B = 700 * B - 300 * B\n// Profit of C: Profit_C = 900 * C - 400 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / (1000 * A + 1500 * B + 2000 * C)\n\n## Generate Constraint-1:\nThe farm has a total of 100 acres available for cultivation.\n// A + B + C <= 100\n\n## Generate Constraint-2:\nThe farm has a budget of $20,000 for labor costs.\n// 200 * A + 300 * B + 400 * C <= 20000",
        "question": "A farm grows three types of crops: A, B, and C. The farmer needs to decide how many acres to allocate to each crop to optimize the farm's profitability and resource usage.\nFor crop A, the profit per acre is $500, the water usage is 1000 gallons per acre, and the labor cost is $200 per acre. \nFor crop B, the profit per acre is $700, the water usage is 1500 gallons per acre, and the labor cost is $300 per acre. \nFor crop C, the profit per acre is $900, the water usage is 2000 gallons per acre, and the labor cost is $400 per acre.\nThe farmer aims to maximize the net profit per unit of water used (which is defined as the total profit minus the total labor cost divided by the total water usage).\nThe farm has a total of 100 acres available for cultivation. The farm has a budget of $20,000 for labor costs.\nPlease help the farmer determine the optimal allocation of acres to each crop.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # acres of crop A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # acres of crop B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # acres of crop C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (500 - 200) * A\nProfit_B = (700 - 300) * B\nProfit_C = (900 - 400) * C\nWaterUsage = 1000 * A + 1500 * B + 2000 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C) / WaterUsage\n## convert the division to multiplication\nmodel.addCons(obj * WaterUsage == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\n## The farm has a total of 100 acres available for cultivation.\nmodel.addCons(A + B + C <= 100)\n## The farm has a budget of $20,000 for labor costs.\nmodel.addCons(200 * A + 300 * B + 400 * C <= 20000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Crop A: \", model.getVal(A))\n    print(\"Acres of Crop B: \", model.getVal(B))\n    print(\"Acres of Crop C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Water Used: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 889,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand.\n// {\"production quantity of product A\": \"Qa\", \"range\": \"Qa >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"Qb\", \"range\": \"Qb >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"Qc\", \"range\": \"Qc >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n// The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\n\n## Generate Constraint-1:\nThe total production capacity of the company is limited to 1000 units per week.\n// Qa + Qb + Qc <= 1000\n\n## Generate Constraint-2:\nThe market demand for product A is at least 200 units per week.\n// Qa >= 200\n\n## Generate Constraint-3:\nThe market demand for product B is at least 150 units per week.\n// Qb >= 150",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantities of each product to maximize profit while considering the available resources and market demand. The profit from product A is $50 per unit, product B is $70 per unit, and product C is $60 per unit. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The production cost for product A is 0.01 * Qa^2, for product B is 0.02 * Qb^2, and for product C is 0.015 * Qc^2. The objective is to maximize the total profit, which is the revenue minus the production cost.\n\n| Product | Profit per Unit | Production Cost Function |\n|---------|-----------------|---------------------------|\n| A       | $50             | 0.01 * Qa^2               |\n| B       | $70             | 0.02 * Qb^2               |\n| C       | $60             | 0.015 * Qc^2              |\n\nThe total production capacity of the company is limited to 1000 units per week. The market demand for product A is at least 200 units per week, and for product B is at least 150 units per week. Please help the company determine the optimal production quantities for products A, B, and C to maximize their total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nQa = model.addVar(vtype=\"INTEGER\", name=\"Qa\", lb=200) # production quantity of product A\nQb = model.addVar(vtype=\"INTEGER\", name=\"Qb\", lb=150) # production quantity of product B\nQc = model.addVar(vtype=\"INTEGER\", name=\"Qc\", lb=0) # production quantity of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## The objective function is: Maximize (50 * Qa - 0.01 * Qa^2) + (70 * Qb - 0.02 * Qb^2) + (60 * Qc - 0.015 * Qc^2)\nmodel.addCons(obj == 50 * Qa - 0.01 * Qa**2 + 70 * Qb - 0.02 * Qb**2 + 60 * Qc - 0.015 * Qc**2)\n\n# Add constraints\n## The total production capacity of the company is limited to 1000 units per week.\nmodel.addCons(Qa + Qb + Qc <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(Qa))\n    print(\"Production Quantity of Product B: \", model.getVal(Qb))\n    print(\"Production Quantity of Product C: \", model.getVal(Qc))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1246,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints.\n// {\"quantity of Electric vehicles\": \"Electric\", \"range\": \"Electric >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hybrid vehicles\": \"Hybrid\", \"range\": \"Hybrid >= 0\", \"type\": \"integer\"}\n// {\"quantity of Hydrogen vehicles\": \"Hydrogen\", \"range\": \"Hydrogen >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per Electric vehicle is $10,000. For Hybrid vehicles, it is $8,000. For Hydrogen vehicles, it is $12,000. Due to economies of scale, the profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The manufacturer wants to maximize the total profit from selling these vehicles.\n// Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\n// Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\n// Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\n// So, the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\n\n## Generate Constraint-1:\nThe production of each vehicle type requires a specific amount of a rare metal. Electric vehicles require 5 kg, Hybrid vehicles require 8 kg, and Hydrogen vehicles require 10 kg. The total supply of this rare metal is limited to 1000 kg.\n// 5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000\n\n## Generate Constraint-2:\nThere is a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\n// Electric <= 300; Hybrid <= 250; Hydrogen <= 200\n\n## Generate Constraint-3:\nThe manufacturer has a total production capacity of 700 units across all vehicle types.\n// Electric + Hybrid + Hydrogen <= 700",
        "question": "A manufacturer produces three types of eco-friendly vehicles: Electric, Hybrid, and Hydrogen. They need to determine the production quantities of each type to maximize profit while considering various constraints. The profit per vehicle and the requirements for a rare metal are given in the following Table.\n\n| Vehicle Type | Profit per Vehicle | Rare Metal Requirement |\n|--------------|--------------------|------------------------|\n| Electric     | $10,000            | 5 kg                   |\n| Hybrid       | $8,000             | 8 kg                   |\n| Hydrogen     | $12,000            | 10 kg                  |\n\nThe profit per unit increases by $10 for each additional vehicle produced beyond 100 units for each type. The manufacturer has a limited supply of 1000 kg of a rare metal required for production. The market demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units. The manufacturer also has a total production capacity of 700 units across all vehicle types.\n\nPlease help the manufacturer to maximize the total profit from selling these vehicles.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\n## There is a market demand limit for each type of vehicle. The demand for Electric vehicles is capped at 300 units, for Hybrid vehicles at 250 units, and for Hydrogen vehicles at 200 units.\nElectric = model.addVar(vtype=\"INTEGER\", name=\"Electric\", lb=0, ub=300) # quantity of Electric vehicles\nHybrid = model.addVar(vtype=\"INTEGER\", name=\"Hybrid\", lb=0, ub=250) # quantity of Hybrid vehicles\nHydrogen = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen\", lb=0, ub=200) # quantity of Hydrogen vehicles\n\n# Define objective function\n## create piecewise variables for piecewise function: Profit_Electric = max(10000 + 10 * (Electric - 100), 10000) * Electric\nElectric1 = model.addVar(vtype=\"INTEGER\", name=\"Electric1\", lb=0, ub=100)\nElectric2 = model.addVar(vtype=\"INTEGER\", name=\"Electric2\", lb=100, ub=300)\nElectric_b1 = model.addVar(vtype=\"B\", name=\"Electric_b1\")\nElectric_b2 = model.addVar(vtype=\"B\", name=\"Electric_b2\")\nmodel.addCons(Electric_b1 + Electric_b2 == 1)\nmodel.addCons(Electric == Electric1*Electric_b1 + Electric2*Electric_b2)\nProfit_Electric = 10000 * Electric1 * Electric_b1 + (10000 + 10 * (Electric2 - 100)) * Electric2 * Electric_b2\n## create piecewise variables for piecewise function: Profit_Hybrid = max(8000 + 10 * (Hybrid - 100), 8000) * Hybrid\nHybrid1 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid1\", lb=0, ub=100)\nHybrid2 = model.addVar(vtype=\"INTEGER\", name=\"Hybrid2\", lb=100, ub=250)\nHybrid_b1 = model.addVar(vtype=\"B\", name=\"Hybrid_b1\")\nHybrid_b2 = model.addVar(vtype=\"B\", name=\"Hybrid_b2\")\nmodel.addCons(Hybrid_b1 + Hybrid_b2 == 1)\nmodel.addCons(Hybrid == Hybrid1*Hybrid_b1 + Hybrid2*Hybrid_b2)\nProfit_Hybrid = 8000 * Hybrid1 * Hybrid_b1 + (8000 + 10 * (Hybrid2 - 100)) * Hybrid2 * Hybrid_b2\n## create piecewise variables for piecewise function: Profit_Hydrogen = max(12000 + 10 * (Hydrogen - 100), 12000) * Hydrogen\nHydrogen1 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen1\", lb=0, ub=100)\nHydrogen2 = model.addVar(vtype=\"INTEGER\", name=\"Hydrogen2\", lb=100, ub=200)\nHydrogen_b1 = model.addVar(vtype=\"B\", name=\"Hydrogen_b1\")\nHydrogen_b2 = model.addVar(vtype=\"B\", name=\"Hydrogen_b2\")\nmodel.addCons(Hydrogen_b1 + Hydrogen_b2 == 1)\nmodel.addCons(Hydrogen == Hydrogen1*Hydrogen_b1 + Hydrogen2*Hydrogen_b2)\nProfit_Hydrogen = 12000 * Hydrogen1 * Hydrogen_b1 + (12000 + 10 * (Hydrogen2 - 100)) * Hydrogen2 * Hydrogen_b2\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit_Electric + Profit_Hybrid + Profit_Hydrogen\nmodel.addCons(obj == Profit_Electric + Profit_Hybrid + Profit_Hydrogen)\n\n# Add constraints\nmodel.addCons(5 * Electric + 8 * Hybrid + 10 * Hydrogen <= 1000)\nmodel.addCons(Electric + Hybrid + Hydrogen <= 700)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Electric Vehicles: \", model.getVal(Electric))\n    print(\"Quantity of Hybrid Vehicles: \", model.getVal(Hybrid))\n    print(\"Quantity of Hydrogen Vehicles: \", model.getVal(Hydrogen))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1140,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\n// {\"number of units of ComponentA\": \"UnitsA\", \"range\": \"UnitsA >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentB\": \"UnitsB\", \"range\": \"UnitsB >= 0\", \"type\": \"integer\"}\n// {\"number of units of ComponentC\": \"UnitsC\", \"range\": \"UnitsC >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company wants to maximize the total net profit from all components.\n// Total net profit for ComponentA: Profit_A = (50 - 30 - 5) * UnitsA\n// Total net profit for ComponentB: Profit_B = (70 - 40 - 10) * UnitsB\n// Total net profit for ComponentC: Profit_C = (100 - 60 - 15) * UnitsC\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C)\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units per type of component.\n// UnitsA <= 1000; UnitsB <= 1000; UnitsC <= 1000\n\n## Generate Constraint-2:\nThe total storage space available is limited to 2000 units across all components.\n// UnitsA + UnitsB + UnitsC <= 2000\n\n## Generate Constraint-3:\nDue to market demand, the production of ComponentA must be at least twice the production of ComponentB.\n// UnitsA >= 2 * UnitsB",
        "question": "A manufacturing company produces three types of electronic components: ComponentA, ComponentB, and ComponentC. The company needs to decide how many units of each component to produce to maximize profit while considering the cost of production and market demand.\nThe profit per unit of ComponentA is $50, but the production cost per unit is $30, and the storage cost per unit is $5. \nThe profit per unit of ComponentB is $70, but the production cost per unit is $40, and the storage cost per unit is $10. \nThe profit per unit of ComponentC is $100, but the production cost per unit is $60, and the storage cost per unit is $15.\nThe company has a production capacity limit of 1000 units per type of component. The total storage space available is limited to 2000 units across all components. Due to market demand, the production of ComponentA must be at least twice the production of ComponentB.\nPlease help the company to maximize the total net profit from all components.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nUnitsA = model.addVar(vtype=\"INTEGER\", name=\"UnitsA\", lb=0) # number of units of ComponentA\nUnitsB = model.addVar(vtype=\"INTEGER\", name=\"UnitsB\", lb=0) # number of units of ComponentB\nUnitsC = model.addVar(vtype=\"INTEGER\", name=\"UnitsC\", lb=0) # number of units of ComponentC\n\n# Define objective function\nProfit_A = (50 - 30 - 5) * UnitsA\nProfit_B = (70 - 40 - 10) * UnitsB\nProfit_C = (100 - 60 - 15) * UnitsC\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_A + Profit_B + Profit_C)\n\n# Add constraints\nmodel.addCons(UnitsA <= 1000)\nmodel.addCons(UnitsB <= 1000)\nmodel.addCons(UnitsC <= 1000)\nmodel.addCons(UnitsA + UnitsB + UnitsC <= 2000)\nmodel.addCons(UnitsA >= 2 * UnitsB)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of ComponentA: \", model.getVal(UnitsA))\n    print(\"Number of ComponentB: \", model.getVal(UnitsB))\n    print(\"Number of ComponentC: \", model.getVal(UnitsC))\n    print(\"Maximized Net Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 971,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production levels of three products: Product A, Product B, and Product C. Additionally, the company is considering investing in automation technology to reduce production costs.\n// {\"production level of Product A\": \"ProdA\", \"range\": \"ProdA >= 0\", \"type\": \"integer\"}\n// {\"production level of Product B\": \"ProdB\", \"range\": \"ProdB >= 0\", \"type\": \"integer\"}\n// {\"production level of Product C\": \"ProdC\", \"range\": \"ProdC >= 0\", \"type\": \"integer\"}\n// {\"investment in automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product A, B, and C is $100, $150, and $200 respectively. The company can reduce these costs by $1 for every $1000 invested in automation. The selling price for each unit of Product A, B, and C is $150, $200, and $250 respectively. The company aims to maximize the total profit from the sales of all products.\n// Total profit for the products: Profit = (150 - (100 - 0.001 * Automation)) * ProdA + (200 - (150 - 0.001 * Automation)) * ProdB + (250 - (200 - 0.001 * Automation)) * ProdC\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for investment in automation.\n// Automation <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is limited to 1000 units.\n// ProdA + ProdB + ProdC <= 1000\n\n## Generate Constraint-3:\nThe production of Product A must be at least 200 units.\n// ProdA >= 200\n\n## Generate Constraint-4:\nThe production of Product B must be at least 150 units.\n// ProdB >= 150\n\n## Generate Constraint-5:\nThe production of Product C must be at least 100 units.\n// ProdC >= 100",
        "question": "A manufacturing company is planning its production for the next quarter and needs to decide on the production levels of three products: Product A, Product B, and Product C. Additionally, the company is considering investing in automation technology to reduce production costs. The cost of producing each unit of Product A, B, and C before considering automation is $100, $150, and $200 respectively, and the selling price for each unit is $150, $200, and $250 respectively. The company can reduce these costs by $1 for every $1000 invested in automation.\n\n| Product | Production Cost (without Automation) | Selling Price |\n|---------|--------------------------------------|---------------|\n| A       | $100                                 | $150          |\n| B       | $150                                 | $200          |\n| C       | $200                                 | $250          |\n\nThe company has a budget of $100,000 for investment in automation. The total production capacity for all products is limited to 1000 units. The production of Product A must be at least 200 units, Product B must be at least 150 units, and Product C must be at least 100 units.\n\nPlease help the company to maximize the total profit from the sales of all products by determining the optimal production levels of Product A, Product B, and Product C, and the investment in automation.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProdA = model.addVar(vtype=\"INTEGER\", name=\"ProdA\", lb=200) # production level of Product A\nProdB = model.addVar(vtype=\"INTEGER\", name=\"ProdB\", lb=150) # production level of Product B\nProdC = model.addVar(vtype=\"INTEGER\", name=\"ProdC\", lb=100) # production level of Product C\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0) # investment in automation\n\n# Define objective function\n## The cost of producing each unit of Product A, B, and C is $100, $150, and $200 respectively.\n## The company can reduce these costs by $1 for every $1000 invested in automation.\n## The selling price for each unit of Product A, B, and C is $150, $200, and $250 respectively.\nCostA = 100 - 0.001 * Automation\nCostB = 150 - 0.001 * Automation\nCostC = 200 - 0.001 * Automation\n## Total profit for the products: Profit = (150 - CostA) * ProdA + (200 - CostB) * ProdB + (250 - CostC) * ProdC\nProfit = (150 - CostA) * ProdA + (200 - CostB) * ProdB + (250 - CostC) * ProdC\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\n## the objective function is: Maximize Profit\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for investment in automation.\nmodel.addCons(Automation <= 100000)\n## The total production capacity for all products is limited to 1000 units.\nmodel.addCons(ProdA + ProdB + ProdC <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Level of Product A: \", model.getVal(ProdA))\n    print(\"Production Level of Product B: \", model.getVal(ProdB))\n    print(\"Production Level of Product C: \", model.getVal(ProdC))\n    print(\"Investment in Automation: \", model.getVal(Automation))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1371,
        "var_num": 4,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line.\n// {\"production quantity of the new product\": \"Production\", \"range\": \"Production >= 0\", \"type\": \"integer\"}\n// {\"advertising budget for the new product\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n// {\"number of skilled workers\": \"Workers\", \"range\": \"Workers >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe company estimates that the profit per unit of the product is $100, but this increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product.\n// Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $50,000 for advertising.\n// Advertising <= 50000\n\n## Generate Constraint-2:\nThe maximum number of skilled workers that can be hired is 50.\n// Workers <= 50",
        "question": "A manufacturing company is planning its production for the next quarter. The company needs to decide on the production quantity of a new product, the advertising budget for promoting the product, and the number of skilled workers to hire for the production line. The company estimates that the profit per unit of the product is $100, but this increases by $0.5 for every $1,000 spent on advertising. The production cost per unit is $40, and hiring an additional skilled worker reduces the production cost per unit by $2. The company aims to maximize the total profit from the product. The company has a budget of $50,000 for advertising. The maximum number of skilled workers that can be hired is 50. Please help the company determine the optimal production quantity, advertising budget, and number of skilled workers to maximize the total profit.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProduction = model.addVar(vtype=\"INTEGER\", name=\"Production\", lb=0) # production quantity of the new product\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # advertising budget for the new product\nWorkers = model.addVar(vtype=\"INTEGER\", name=\"Workers\", lb=0) # number of skilled workers\n\n# Define objective function\n## Total profit: Profit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (100 + 0.0005 * Advertising - 2 * (Workers / Production)) * Production - 40 * Production\nmodel.addCons(obj == Profit)\n\n# Add constraints\n## The company has a budget of $50,000 for advertising.\nmodel.addCons(Advertising <= 50000)\n## The maximum number of skilled workers that can be hired is 50.\nmodel.addCons(Workers <= 50)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the solution (variables' values and objective value)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity: \", model.getVal(Production))\n    print(\"Advertising Budget: \", model.getVal(Advertising))\n    print(\"Number of Workers: \", model.getVal(Workers))\n    print(\"Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 847,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space.\n// {\"number of solar panels in region 1\": \"S1\", \"range\": \"S1 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 2\": \"S2\", \"range\": \"S2 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 2\": \"W2\", \"range\": \"W2 >= 0\", \"type\": \"integer\"}\n// {\"number of solar panels in region 3\": \"S3\", \"range\": \"S3 >= 0\", \"type\": \"integer\"}\n// {\"number of wind turbines in region 3\": \"W3\", \"range\": \"W3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe energy production from each solar panel is 500 kWh, and each wind turbine produces 1000 kWh. The cost of installing a solar panel is $1000, and a wind turbine is $2000. The company aims to maximize the total energy production while keeping the total investment cost below $100,000.\n// Total energy production: Energy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\n// Total investment cost: Cost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n// The objective function is: Maximize (Energy - Cost)\n\n## Generate Constraint-1:\nThe total investment cost must not exceed $100,000.\n// 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000\n\n## Generate Constraint-2:\nThe total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70.\n// S1 + W1 <= 50; S2 + W2 <= 60; S3 + W3 <= 70",
        "question": "A renewable energy company is planning to install solar panels and wind turbines in three different regions. The company needs to determine the number of solar panels and wind turbines to install in each region to maximize energy production while considering the investment cost and available space. The energy production and installation costs for each type of installation are given in the following Table.\n\n| Installation Type | Energy Production | Installation Cost |\n|-------------------|-------------------|-------------------|\n| Solar Panel       | 500 kWh           | $1000             |\n| Wind Turbine      | 1000 kWh          | $2000             |\n\nThe company aims to maximize the total energy production while keeping the total investment cost below $100,000. The total area available for installation in each region is limited. Region 1 has space for at most 50 installations, Region 2 for 60, and Region 3 for 70.\n\nPlease help the company to maximize the total energy production while adhering to the constraints of investment cost and available space.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nS1 = model.addVar(vtype=\"INTEGER\", name=\"S1\", lb=0) # number of solar panels in region 1\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=0) # number of wind turbines in region 1\nS2 = model.addVar(vtype=\"INTEGER\", name=\"S2\", lb=0) # number of solar panels in region 2\nW2 = model.addVar(vtype=\"INTEGER\", name=\"W2\", lb=0) # number of wind turbines in region 2\nS3 = model.addVar(vtype=\"INTEGER\", name=\"S3\", lb=0) # number of solar panels in region 3\nW3 = model.addVar(vtype=\"INTEGER\", name=\"W3\", lb=0) # number of wind turbines in region 3\n\n# Define objective function\nEnergy = 500 * (S1 + S2 + S3) + 1000 * (W1 + W2 + W3)\nCost = 1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3)\n# The objective function is: Maximize (Energy - Cost)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Energy - Cost)\n\n# Add constraints\n# The total investment cost must not exceed $100,000.\nmodel.addCons(1000 * (S1 + S2 + S3) + 2000 * (W1 + W2 + W3) <= 100000)\n# The total area available for installation in each region is limited.\nmodel.addCons(S1 + W1 <= 50)\nmodel.addCons(S2 + W2 <= 60)\nmodel.addCons(S3 + W3 <= 70)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Solar Panels in Region 1: \", model.getVal(S1))\n    print(\"Number of Wind Turbines in Region 1: \", model.getVal(W1))\n    print(\"Number of Solar Panels in Region 2: \", model.getVal(S2))\n    print(\"Number of Wind Turbines in Region 2: \", model.getVal(W2))\n    print(\"Number of Solar Panels in Region 3: \", model.getVal(S3))\n    print(\"Number of Wind Turbines in Region 3: \", model.getVal(W3))\n    print(\"Maximized Net Energy Production: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1066,
        "var_num": 6,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit.\n// {\"quantity of product A\": \"ProductA\", \"range\": \"ProductA >= 0\", \"type\": \"integer\"}\n// {\"quantity of product B\": \"ProductB\", \"range\": \"ProductB >= 0\", \"type\": \"integer\"}\n// {\"quantity of product C\": \"ProductC\", \"range\": \"ProductC >= 0\", \"type\": \"integer\"}\n// {\"investment in advertising\": \"Advertising\", \"range\": \"Advertising >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company aims to maximize the total profit from all products.\n// Total profit: Profit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a budget of $100,000 for advertising.\n// Advertising <= 100000\n\n## Generate Constraint-2:\nThe total production capacity for all products is 2000 units.\n// ProductA + ProductB + ProductC <= 2000\n\n## Generate Constraint-3:\nThe production of product A must be at least 300 units.\n// ProductA >= 300",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide the production quantity of each product and the level of advertising investment to maximize profit. The profit per unit of product A is $50, product B is $70, and product C is $60. The advertising investment increases the sales of all products by 1% for every $1,000 invested. The company has a budget of $100,000 for advertising. The total production capacity for all products is 2000 units. The production of product A must be at least 300 units. Please help the company to maximize the total profit from all products.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProductA = model.addVar(vtype=\"INTEGER\", name=\"ProductA\", lb=300) # quantity of product A\nProductB = model.addVar(vtype=\"INTEGER\", name=\"ProductB\", lb=0) # quantity of product B\nProductC = model.addVar(vtype=\"INTEGER\", name=\"ProductC\", lb=0) # quantity of product C\nAdvertising = model.addVar(vtype=\"CONTINUOUS\", name=\"Advertising\", lb=0) # investment in advertising\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit = (50 * ProductA + 70 * ProductB + 60 * ProductC) * (1 + 0.001 * Advertising)\n## convert the multiplication with Advertising to a constraint\nmodel.addCons(obj == (50 * ProductA + 70 * ProductB + 60 * ProductC))\nmodel.addCons(obj <= Profit)\n\n# Add constraints\n## The company has a budget of $100,000 for advertising.\nmodel.addCons(Advertising <= 100000)\n## The total production capacity for all products is 2000 units.\nmodel.addCons(ProductA + ProductB + ProductC <= 2000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Quantity of Product A: \", model.getVal(ProductA))\n    print(\"Quantity of Product B: \", model.getVal(ProductB))\n    print(\"Quantity of Product C: \", model.getVal(ProductC))\n    print(\"Investment in Advertising: \", model.getVal(Advertising))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 619,
        "var_num": 4,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\n// {\"number of units of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"number of units of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"number of units of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer wants to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).\n// Profit of A: Profit_A = (50 - 100 / A) * A\n// Profit of B: Profit_B = (70 - 150 / B) * B\n// Profit of C: Profit_C = (90 - 200 / C) * C\n// Storage cost: Storage = 5 * A + 7 * B + 9 * C\n// So, the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n\n## Generate Constraint-1:\nThe manufacturer has a budget of $10,000 for production setup costs.\n// 100 * A + 150 * B + 200 * C <= 10000",
        "question": "A manufacturer produces three types of products: A, B, and C. The manufacturer needs to decide the production quantity for each product to optimize their operations.\nFor Product A, the profit per unit is $50, the storage cost per unit is $5, and the production setup cost is $100.\nFor Product B, the profit per unit is $70, the storage cost per unit is $7, and the production setup cost is $150.\nFor Product C, the profit per unit is $90, the storage cost per unit is $9, and the production setup cost is $200.\nThe manufacturer has a budget of $10,000 for production setup costs.\nPlease help the manufacturer to maximize the net profit per unit of storage cost (which is defined as the sum of the profits minus the setup costs divided by the sum of the storage costs).",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=0) # number of units of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of units of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=0) # number of units of product C\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nProfit_A = (50 - 100 / A) * A\nProfit_B = (70 - 150 / B) * B\nProfit_C = (90 - 200 / C) * C\nStorage = 5 * A + 7 * B + 9 * C\n## the objective function is: Maximize (Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C)) / Storage\n## convert the division to multiplication\nmodel.addCons(obj * Storage == Profit_A + Profit_B + Profit_C - (100 / A + 150 / B + 200 / C))\n\n# Add constraints\n## The manufacturer has a budget of $10,000 for production setup costs.\nmodel.addCons(100 * A + 150 * B + 200 * C <= 10000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Product A: \", model.getVal(A))\n    print(\"Number of Product B: \", model.getVal(B))\n    print(\"Number of Product C: \", model.getVal(C))\n    print(\"Maximized Net Profit per Unit of Storage Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 768,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines.\n// {\"number of trucks at warehouse 1\": \"T1\", \"range\": \"T1 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 2\": \"T2\", \"range\": \"T2 >= 0\", \"type\": \"integer\"}\n// {\"number of trucks at warehouse 3\": \"T3\", \"range\": \"T3 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe transportation cost per truck varies depending on the warehouse and the number of trucks allocated. \nAt warehouse 1, each truck incurs a cost of $500 per day, plus an additional $10 for each additional truck beyond the first. \nAt warehouse 2, each truck costs $600 per day, plus an additional $15 for each additional truck beyond the first. \nAt warehouse 3, each truck costs $700 per day, plus an additional $20 for each additional truck beyond the first. \nThe company aims to minimize the total daily transportation cost.\n// The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n// The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n// The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n// So, the objective function is: Minimize (C1 + C2 + C3)\n\n## Generate Constraint-1:\nThe company has a total of 30 trucks available for allocation.\n// T1 + T2 + T3 <= 30\n\n## Generate Constraint-2:\nEach warehouse can handle a maximum of 15 trucks.\n// T1 <= 15; T2 <= 15; T3 <= 15",
        "question": "A company operates three different warehouses that store and distribute products. The company needs to optimize the allocation of trucks to each warehouse to minimize transportation costs while meeting delivery deadlines. The transportation cost per truck varies depending on the warehouse and the number of trucks allocated. The cost structure for each warehouse is detailed in the following Table.\n\n| Warehouse | Cost per Truck (First Truck) | Additional Cost per Truck |\n|-----------|------------------------------|---------------------------|\n| 1         | $500                         | $10                       |\n| 2         | $600                         | $15                       |\n| 3         | $700                         | $20                       |\n\nThe company has a total of 30 trucks available for allocation. Each warehouse can handle a maximum of 15 trucks. Please help the company to minimize the total daily transportation cost.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT1 = model.addVar(vtype=\"INTEGER\", name=\"T1\", lb=0) # number of trucks at warehouse 1\nT2 = model.addVar(vtype=\"INTEGER\", name=\"T2\", lb=0) # number of trucks at warehouse 2\nT3 = model.addVar(vtype=\"INTEGER\", name=\"T3\", lb=0) # number of trucks at warehouse 3\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\n\n## The cost function for warehouse 1: C1 = 500 * T1 + 10 * (T1 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT1_sq = model.addVar(vtype=\"INTEGER\", name=\"T1_sq\")\nmodel.addCons(T1_sq == (T1 - 1)**2)\nC1 = 500 * T1 + 10 * T1_sq\n\n## The cost function for warehouse 2: C2 = 600 * T2 + 15 * (T2 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT2_sq = model.addVar(vtype=\"INTEGER\", name=\"T2_sq\")\nmodel.addCons(T2_sq == (T2 - 1)**2)\nC2 = 600 * T2 + 15 * T2_sq\n\n## The cost function for warehouse 3: C3 = 700 * T3 + 20 * (T3 - 1)^2\n## Convert the quadratic term to a linear term by introducing a new variable\nT3_sq = model.addVar(vtype=\"INTEGER\", name=\"T3_sq\")\nmodel.addCons(T3_sq == (T3 - 1)**2)\nC3 = 700 * T3 + 20 * T3_sq\n\n## the objective function is: Minimize (C1 + C2 + C3)\nmodel.addCons(obj == C1 + C2 + C3)\n\n# Add constraints\n## The company has a total of 30 trucks available for allocation.\nmodel.addCons(T1 + T2 + T3 <= 30)\n## Each warehouse can handle a maximum of 15 trucks.\nmodel.addCons(T1 <= 15)\nmodel.addCons(T2 <= 15)\nmodel.addCons(T3 <= 15)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks at Warehouse 1: \", model.getVal(T1))\n    print(\"Number of Trucks at Warehouse 2: \", model.getVal(T2))\n    print(\"Number of Trucks at Warehouse 3: \", model.getVal(T3))\n    print(\"Minimized Daily Transportation Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 952,
        "var_num": 3,
        "type": "nonlinear-table"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency.\n// {\"production quantity of Product 1\": \"Prod1\", \"range\": \"Prod1 >= 0\", \"type\": \"integer\"}\n// {\"production quantity of Product 2\": \"Prod2\", \"range\": \"Prod2 >= 0\", \"type\": \"integer\"}\n// {\"level of automation\": \"Automation\", \"range\": \"Automation >= 0\", \"type\": \"continuous\"}\n\n## Define Objective Function:\nThe cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\n// Total profit for the products: Profit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\n// So, the objective function is: Maximize Profit\n\n## Generate Constraint-1:\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2.\n// Prod1 <= 1000; Prod2 <= 800\n\n## Generate Constraint-2:\nThe total investment in automation cannot exceed $50,000.\n// Automation <= 50000\n\n## Generate Constraint-3:\nThe company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements.\n// Prod1 >= 200; Prod2 >= 150\n\n## Generate Constraint-4:\nThe total production quantity of both products must not exceed 1200 units.\n// Prod1 + Prod2 <= 1200",
        "question": "A manufacturing company produces two types of products. The company needs to determine the production quantities of each product and the level of automation to be implemented in the production process. The level of automation affects the production cost and efficiency. The cost of producing each unit of Product 1 is $100, and each unit of Product 2 is $150. Implementing automation reduces the production cost by $5 for Product 1 and $10 for Product 2 for every $10,000 invested in automation. The selling price of Product 1 is $200 and Product 2 is $250. The company aims to maximize the total profit from both products.\nThe company has a production capacity limit of 1000 units for Product 1 and 800 units for Product 2. The total investment in automation cannot exceed $50,000. The company must produce at least 200 units of Product 1 and 150 units of Product 2 to meet the minimum order requirements. The total production quantity of both products must not exceed 1200 units.\nPlease help the company to maximize the total profit from both products.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nProd1 = model.addVar(vtype=\"INTEGER\", name=\"Prod1\", lb=200, ub=1000)  # production quantity of Product 1\nProd2 = model.addVar(vtype=\"INTEGER\", name=\"Prod2\", lb=150, ub=800)  # production quantity of Product 2\nAutomation = model.addVar(vtype=\"CONTINUOUS\", name=\"Automation\", lb=0)  # level of automation\n\n# Define objective function\nProfit = (200 - 100 + 0.0005 * Automation) * Prod1 + (250 - 150 + 0.001 * Automation) * Prod2\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\nmodel.addCons(Prod1 + Prod2 <= 1200)  # total production quantity constraint\nmodel.addCons(Automation <= 50000)  # investment in automation constraint\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product 1: \", model.getVal(Prod1))\n    print(\"Production Quantity of Product 2: \", model.getVal(Prod2))\n    print(\"Level of Automation: \", model.getVal(Automation))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1054,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production.\n// {\"amount of chemical produced in factory 1\": \"P1\", \"range\": \"P1 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 2\": \"P2\", \"range\": \"P2 >= 0\", \"type\": \"real\"}\n// {\"amount of chemical produced in factory 3\": \"P3\", \"range\": \"P3 >= 0\", \"type\": \"real\"}\n\n## Define Objective Function:\nThe profit from each factory is determined by a nonlinear function of the amount of chemical produced. Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n// The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\n\n## Generate Constraint-1:\nThe total amount of chemical produced across all factories must not exceed 1000 units.\n// P1 + P2 + P3 <= 1000",
        "question": "A company operates three different factories that produce a certain chemical. The company needs to decide how much of the chemical to produce in each factory to maximize profit while considering the costs and constraints of production. The profit from each factory is determined by a nonlinear function of the amount of chemical produced: Factory 1 has a profit function of 50P1 - 0.1P1^2, Factory 2 has a profit function of 60P2 - 0.2P2^2, and Factory 3 has a profit function of 70P3 - 0.3P3^2. The company aims to maximize the total profit from all three factories.\n\nThe total amount of chemical produced across all factories must not exceed 1000 units.\n\nPlease help the company determine the optimal production levels for each factory to maximize total profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nP1 = model.addVar(vtype=\"CONTINUOUS\", name=\"P1\", lb=0) # amount of chemical produced in factory 1\nP2 = model.addVar(vtype=\"CONTINUOUS\", name=\"P2\", lb=0) # amount of chemical produced in factory 2\nP3 = model.addVar(vtype=\"CONTINUOUS\", name=\"P3\", lb=0) # amount of chemical produced in factory 3\n\n# Define objective function\n## The profit from each factory is determined by a nonlinear function of the amount of chemical produced.\nProfit_P1 = 50 * P1 - 0.1 * P1**2\nProfit_P2 = 60 * P2 - 0.2 * P2**2\nProfit_P3 = 70 * P3 - 0.3 * P3**2\n## The objective function is: Maximize (50P1 - 0.1P1^2) + (60P2 - 0.2P2^2) + (70P3 - 0.3P3^2)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_P1 + Profit_P2 + Profit_P3)\n\n# Add constraints\n## The total amount of chemical produced across all factories must not exceed 1000 units.\nmodel.addCons(P1 + P2 + P3 <= 1000)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Amount of chemical produced in factory 1: \", model.getVal(P1))\n    print(\"Amount of chemical produced in factory 2: \", model.getVal(P2))\n    print(\"Amount of chemical produced in factory 3: \", model.getVal(P3))\n    print(\"Maximized Total Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 763,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements.\n// {\"number of Trucks\": \"T\", \"range\": \"T >= 0\", \"type\": \"integer\"}\n// {\"number of Vans\": \"V\", \"range\": \"V >= 0\", \"type\": \"integer\"}\n// {\"number of Bikes\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nEach Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered.\n// Total daily cost: Cost = 500 * T + 300 * V + 100 * B\n// Total packages delivered: Packages = 100 * T + 50 * V + 20 * B\n// The company needs to deliver at least 2000 packages per day.\n// So, the objective function is: Minimize Cost subject to Packages >= 2000\n\n## Generate Constraint-1:\nThe company has a budget of $10,000 per day for vehicle operations.\n// 500 * T + 300 * V + 100 * B <= 10,000\n\n## Generate Constraint-2:\nDue to maintenance constraints, the total number of vehicles cannot exceed 30.\n// T + V + B <= 30",
        "question": "A logistics company operates three types of vehicles: Trucks, Vans, and Bikes, to deliver packages. The company needs to decide how many vehicles of each type to deploy to maximize efficiency while meeting delivery requirements. Each Truck can deliver 100 packages per day with a cost of $500 per day, each Van can deliver 50 packages per day with a cost of $300 per day, and each Bike can deliver 20 packages per day with a cost of $100 per day. The company aims to minimize the total daily cost while ensuring all packages are delivered. The company needs to deliver at least 2000 packages per day. The company has a budget of $10,000 per day for vehicle operations. Due to maintenance constraints, the total number of vehicles cannot exceed 30. Please help the company to minimize the total daily cost while meeting these constraints.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nT = model.addVar(vtype=\"INTEGER\", name=\"T\", lb=0) # number of Trucks\nV = model.addVar(vtype=\"INTEGER\", name=\"V\", lb=0) # number of Vans\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=0) # number of Bikes\n\n# Define objective function\n## set objective as a variable (pyscipopt does not support non-linear objective)\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"minimize\")\nCost = 500 * T + 300 * V + 100 * B\nPackages = 100 * T + 50 * V + 20 * B\n## The company needs to deliver at least 2000 packages per day.\nmodel.addCons(Packages >= 2000)\n\n# Add constraints\n## The company has a budget of $10,000 per day for vehicle operations.\nmodel.addCons(500 * T + 300 * V + 100 * B <= 10000)\n## Due to maintenance constraints, the total number of vehicles cannot exceed 30.\nmodel.addCons(T + V + B <= 30)\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Number of Trucks: \", model.getVal(T))\n    print(\"Number of Vans: \", model.getVal(V))\n    print(\"Number of Bikes: \", model.getVal(B))\n    print(\"Minimized Total Daily Cost: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 837,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot.\n// {\"acres of wheat on plot 1\": \"W1\", \"range\": \"W1 >= 0\", \"type\": \"integer\"}\n// {\"acres of corn on plot 1\": \"C1\", \"range\": \"C1 >= 0\", \"type\": \"integer\"}\n// {\"acres of barley on plot 1\": \"B1\", \"range\": \"B1 >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots.\n// Profit_W1 = 300 * 0.8 * W1\n// Profit_C1 = 400 * 1.2 * C1\n// Profit_B1 = 250 * 0.9 * B1\n// So, the objective function is: Maximize (Profit_W1 + Profit_C1 + Profit_B1)\n\n## Generate Constraint-1:\nThe total area of plot 1 is 50 acres.\n// W1 + C1 + B1 <= 50\n\n## Generate Constraint-2:\nThe farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40.\n// 50 * W1 + 70 * C1 + 40 * B1 <= 10000\n\n## Generate Constraint-3:\nThe market demand for wheat from plot 1 is at least 20 acres.\n// W1 >= 20",
        "question": "A farmer has three plots of land where he can grow wheat, corn, and barley. He needs to decide how many acres to allocate to each crop on each plot. The farmer estimates that the profit per acre for wheat is $300, for corn is $400, and for barley is $250. However, the yield per acre varies with the plot and the crop. The yield for wheat is 0.8 * W1, for corn is 1.2 * C1, and for barley is 0.9 * B1. The farmer wants to maximize the total profit from all plots. The total area of plot 1 is 50 acres. The farmer has a limited budget for seeds and fertilizer of $10,000. The cost per acre for wheat is $50, for corn is $70, and for barley is $40. The market demand for wheat from plot 1 is at least 20 acres. Please help the farmer determine the optimal allocation of acres for wheat (W1), corn (C1), and barley (B1) on plot 1 to maximize his profit.\n",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nW1 = model.addVar(vtype=\"INTEGER\", name=\"W1\", lb=20) # acres of wheat on plot 1\nC1 = model.addVar(vtype=\"INTEGER\", name=\"C1\", lb=0) # acres of corn on plot 1\nB1 = model.addVar(vtype=\"INTEGER\", name=\"B1\", lb=0) # acres of barley on plot 1\n\n# Define objective function\nProfit_W1 = 300 * 0.8 * W1\nProfit_C1 = 400 * 1.2 * C1\nProfit_B1 = 250 * 0.9 * B1\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit_W1 + Profit_C1 + Profit_B1)\n\n# Add constraints\nmodel.addCons(W1 + C1 + B1 <= 50) # total area of plot 1 is 50 acres\nmodel.addCons(50 * W1 + 70 * C1 + 40 * B1 <= 10000) # limited budget for seeds and fertilizer\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Acres of Wheat on Plot 1: \", model.getVal(W1))\n    print(\"Acres of Corn on Plot 1: \", model.getVal(C1))\n    print(\"Acres of Barley on Plot 1: \", model.getVal(B1))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 850,
        "var_num": 3,
        "type": "nonlinear-notable"
    },
    {
        "nl_solution": "## Define Variables:\nA manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints.\n// {\"production quantity of product A\": \"A\", \"range\": \"A >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product B\": \"B\", \"range\": \"B >= 0\", \"type\": \"integer\"}\n// {\"production quantity of product C\": \"C\", \"range\": \"C >= 0\", \"type\": \"integer\"}\n\n## Define Objective Function:\nThe profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company aims to maximize its total profit, which is the difference between the revenue and the cost.\n// Revenue = 50 * A + 70 * B + 60 * C\n// Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n// Objective function: Maximize Profit = Revenue - Cost = 50 * A + 70 * B + 60 * C - (0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2)\n\n## Generate Constraint-1:\nThe company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours.\n// 2 * A + 3 * B + 2.5 * C <= 1000\n\n## Generate Constraint-2:\nThe company must produce at least 10 units of each product to meet contractual obligations.\n// A >= 10\n// B >= 10\n// C >= 10\n\n## Generate Constraint-3:\nThe market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\n// A <= 200\n// B <= 150\n\n## Generate Constraint-4:\nThe company aims to balance its product portfolio. No more than 40% of the total production can be of one type of product.\n// A <= 0.4 * (A + B + C)\n// B <= 0.4 * (A + B + C)\n// C <= 0.4 * (A + B + C)",
        "question": "A manufacturing company produces three types of products: A, B, and C. The company needs to decide on the production quantities of each product to optimize its profit while considering various constraints. The profit per unit of product A is $50, product B is $70, and product C is $60. However, the production cost increases nonlinearly with the quantity produced due to economies of scale. The cost function for each product is given by: Cost_A = 0.01 * A^2, Cost_B = 0.015 * B^2, Cost_C = 0.012 * C^2. The company has a limited production capacity of 1000 hours. The production time for each unit of product A is 2 hours, product B is 3 hours, and product C is 2.5 hours. The company must produce at least 10 units of each product to meet contractual obligations. The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units. The company aims to balance its product portfolio. No more than 40% of the total production can be of one type of product.\n\nPlease help the company to maximize its total profit, which is the difference between the revenue and the cost.",
        "code_solution": "import math\nimport pyscipopt\n\n# Create a new model\nmodel = pyscipopt.Model()\n\n# Define variables\nA = model.addVar(vtype=\"INTEGER\", name=\"A\", lb=10, ub=200)  # production quantity of product A\nB = model.addVar(vtype=\"INTEGER\", name=\"B\", lb=10, ub=150)  # production quantity of product B\nC = model.addVar(vtype=\"INTEGER\", name=\"C\", lb=10)  # production quantity of product C\n\n# Define objective function\n# Revenue = 50 * A + 70 * B + 60 * C\n# Cost = 0.01 * A^2 + 0.015 * B^2 + 0.012 * C^2\n# Objective function: Maximize Profit = Revenue - Cost\nRevenue = 50 * A + 70 * B + 60 * C\nCost_A = 0.01 * A**2\nCost_B = 0.015 * B**2\nCost_C = 0.012 * C**2\nProfit = Revenue - (Cost_A + Cost_B + Cost_C)\n\nobj = model.addVar('obj')\nmodel.setObjective(obj, \"maximize\")\nmodel.addCons(obj == Profit)\n\n# Add constraints\n# The company has a limited production capacity of 1000 hours.\nmodel.addCons(2 * A + 3 * B + 2.5 * C <= 1000)\n\n# The company must produce at least 10 units of each product.\nmodel.addCons(A >= 10)\nmodel.addCons(B >= 10)\nmodel.addCons(C >= 10)\n\n# The market demand for product A should not exceed 200 units, and for product B, it should not exceed 150 units.\nmodel.addCons(A <= 200)\nmodel.addCons(B <= 150)\n\n# The company aims to balance its product portfolio.\nmodel.addCons(A <= 0.4 * (A + B + C))\nmodel.addCons(B <= 0.4 * (A + B + C))\nmodel.addCons(C <= 0.4 * (A + B + C))\n\n# Solve the problem\nmodel.optimize()\n\n# Print the optimal solution (value of the variables & the objective)\nprint('-'*10)\nif model.getStatus() == \"optimal\":\n    print(\"Production Quantity of Product A: \", model.getVal(A))\n    print(\"Production Quantity of Product B: \", model.getVal(B))\n    print(\"Production Quantity of Product C: \", model.getVal(C))\n    print(\"Maximized Profit: \", model.getObjVal())\nelse:\n    print(\"The problem could not be solved to optimality.\")\n",
        "length": 1114,
        "var_num": 3,
        "type": "nonlinear-notable"
    }
]